From: Cris Di Sclafani Date: Wed, 16 Sep 2020 15:19:53 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.3 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=475214f2a3a08b0c5d90ced8b5b59e16b043c496;p=motion2.git Built motion from commit (unavailable).|2.5.3 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index d71bb97..c95715b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.3", "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": "2020-09-16T14:57:01.774Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.3", "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": "2020-09-16T15:12:25.393Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c223264..60a3d8d 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.3", "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": "2020-09-16T14:57:01.774Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.3", "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": "2020-09-16T15:12:25.393Z", "url": "http://apidocjs.com", "version": "0.19.0" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 5de96c2..d0daea5 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 _0x6e43=['integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6e43,0x1a2));var _0x36e4=function(_0x20b5a6,_0x2c6a5e){_0x20b5a6=_0x20b5a6-0x0;var _0x258977=_0x6e43[_0x20b5a6];return _0x258977;};'use strict';var Sequelize=require(_0x36e4('0x0'));module[_0x36e4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4d151b){return this[_0x36e4('0x2')](_0x36e4('0x3'));}},'action':{'type':Sequelize[_0x36e4('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x36e4('0x5'),_0x36e4('0x6'),_0x36e4('0x7'),_0x36e4('0x8'),'urlForward',_0x36e4('0x9'),_0x36e4('0xa'),_0x36e4('0xb')]],'msg':_0x36e4('0xc')}},'comment':_0x36e4('0xc')},'data1':{'type':Sequelize[_0x36e4('0x4')](0x1000),'comment':_0x36e4('0xd')},'data2':{'type':Sequelize[_0x36e4('0x4')](0x1000),'comment':_0x36e4('0xe')},'data3':{'type':Sequelize[_0x36e4('0x4')](0x1000),'comment':_0x36e4('0xf')},'data4':{'type':Sequelize[_0x36e4('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x36e4('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x54ad=['exports','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x54ad,0x11d));var _0xd54a=function(_0xdbd1bc,_0x175520){_0xdbd1bc=_0xdbd1bc-0x0;var _0x346db9=_0x54ad[_0xdbd1bc];return _0x346db9;};'use strict';var Sequelize=require('sequelize');module[_0xd54a('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x63a38){return this[_0xd54a('0x1')]('action');}},'action':{'type':Sequelize[_0xd54a('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xd54a('0x3'),_0xd54a('0x4'),_0xd54a('0x5'),_0xd54a('0x6'),_0xd54a('0x7'),_0xd54a('0x8'),_0xd54a('0x9'),_0xd54a('0xa')]],'msg':_0xd54a('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xd54a('0x2')](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[_0xd54a('0x2')](0x1000),'comment':_0xd54a('0xc')},'data3':{'type':Sequelize[_0xd54a('0x2')](0x1000),'comment':_0xd54a('0xd')},'data4':{'type':Sequelize[_0xd54a('0x2')](0x1000)},'data5':{'type':Sequelize[_0xd54a('0x2')](0x1000)},'data6':{'type':Sequelize[_0xd54a('0x2')]},'data7':{'type':Sequelize[_0xd54a('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a28c082..0e475c8 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 _0x8153=['request-promise','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','stack','send','body','Action','find','catch','params','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0x8153,0x9c));var _0x3815=function(_0x98928c,_0x4bca61){_0x98928c=_0x98928c-0x0;var _0x49e851=_0x8153[_0x98928c];return _0x49e851;};'use strict';var pdf=require(_0x3815('0x0'));var emlformat=require(_0x3815('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3815('0x2'));var jsonpatch=require(_0x3815('0x3'));var rp=require(_0x3815('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3815('0x5'));var util=require('util');var path=require(_0x3815('0x6'));var sox=require(_0x3815('0x7'));var csv=require('to-csv');var ejs=require(_0x3815('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3815('0x9'));var crypto=require('crypto');var jsforce=require(_0x3815('0xa'));var deskjs=require(_0x3815('0xb'));var toCsv=require(_0x3815('0xc'));var querystring=require(_0x3815('0xd'));var Papa=require(_0x3815('0xe'));var Redis=require('ioredis');var authService=require(_0x3815('0xf'));var qs=require(_0x3815('0x10'));var as=require(_0x3815('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3815('0x12'));var utils=require(_0x3815('0x13'));var config=require(_0x3815('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bb2a5,_0x53a8ea){_0x53a8ea=_0x53a8ea||0xcc;return function(_0x22811f){if(_0x22811f){return _0x3bb2a5[_0x3815('0x15')](_0x53a8ea);}return _0x3bb2a5[_0x3815('0x16')](_0x53a8ea)[_0x3815('0x17')]();};}function respondWithResult(_0x26d521,_0x1353fe){_0x1353fe=_0x1353fe||0xc8;return function(_0xe46618){if(_0xe46618){return _0x26d521[_0x3815('0x16')](_0x1353fe)[_0x3815('0x18')](_0xe46618);}};}function respondWithFilteredResult(_0x14bc82,_0x3e34c1){return function(_0x580e0d){if(_0x580e0d){var _0x82c201=_0x580e0d['count'],_0x67ef36=_0x3e34c1['offset'],_0x3c7e70=_0x3e34c1[_0x3815('0x19')]+_0x3e34c1[_0x3815('0x1a')],_0x5cf168;if(_0x3c7e70>=_0x82c201){_0x3c7e70=_0x82c201;_0x5cf168=0xc8;}else{_0x5cf168=0xce;}_0x14bc82[_0x3815('0x16')](_0x5cf168);return _0x14bc82[_0x3815('0x1b')](_0x3815('0x1c'),_0x67ef36+'-'+_0x3c7e70+'/'+_0x82c201)['json'](_0x580e0d);}return null;};}function patchUpdates(_0x19f43e){return function(_0x5a8f75){try{jsonpatch[_0x3815('0x1d')](_0x5a8f75,_0x19f43e,!![]);}catch(_0xc3f32b){return BPromise['reject'](_0xc3f32b);}return _0x5a8f75['save']();};}function saveUpdates(_0x2fd6d5,_0xd9c251){return function(_0x362ea3){if(_0x362ea3){return _0x362ea3[_0x3815('0x1e')](_0x2fd6d5)[_0x3815('0x1f')](function(_0xa1c0ff){return _0xa1c0ff;});}return null;};}function removeEntity(_0x398bda,_0x54befc){return function(_0x277ee3){if(_0x277ee3){return _0x277ee3[_0x3815('0x20')]()[_0x3815('0x1f')](function(){_0x398bda[_0x3815('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43532b,_0x3b9e7f){return function(_0x355e6a){if(!_0x355e6a){_0x43532b[_0x3815('0x15')](0x194);}return _0x355e6a;};}function handleError(_0x3a346f,_0x18838a){_0x18838a=_0x18838a||0x1f4;return function(_0x17f2a7){logger['error'](_0x17f2a7[_0x3815('0x21')]);if(_0x17f2a7['name']){delete _0x17f2a7['name'];}_0x3a346f[_0x3815('0x16')](_0x18838a)[_0x3815('0x22')](_0x17f2a7);};}exports[_0x3815('0x1e')]=function(_0x3089f7,_0x5ab000){if(_0x3089f7[_0x3815('0x23')]['id']){delete _0x3089f7[_0x3815('0x23')]['id'];}return db[_0x3815('0x24')][_0x3815('0x25')]({'where':{'id':_0x3089f7['params']['id']}})[_0x3815('0x1f')](handleEntityNotFound(_0x5ab000,null))[_0x3815('0x1f')](saveUpdates(_0x3089f7[_0x3815('0x23')],null))[_0x3815('0x1f')](respondWithResult(_0x5ab000,null))[_0x3815('0x26')](handleError(_0x5ab000,null));};exports['destroy']=function(_0x30fc9f,_0x4b92e9){return db[_0x3815('0x24')]['find']({'where':{'id':_0x30fc9f[_0x3815('0x27')]['id']}})[_0x3815('0x1f')](handleEntityNotFound(_0x4b92e9,null))[_0x3815('0x1f')](removeEntity(_0x4b92e9,null))['catch'](handleError(_0x4b92e9,null));}; \ No newline at end of file +var _0x06bf=['json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','find','params','catch','Action','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end'];(function(_0x13fed6,_0x32f7d9){var _0x272cf3=function(_0x539a16){while(--_0x539a16){_0x13fed6['push'](_0x13fed6['shift']());}};_0x272cf3(++_0x32f7d9);}(_0x06bf,0x15e));var _0xf06b=function(_0x5a076c,_0x222cb0){_0x5a076c=_0x5a076c-0x0;var _0x5036c1=_0x06bf[_0x5a076c];return _0x5036c1;};'use strict';var pdf=require(_0xf06b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf06b('0x1'));var zipdir=require(_0xf06b('0x2'));var jsonpatch=require(_0xf06b('0x3'));var rp=require(_0xf06b('0x4'));var moment=require(_0xf06b('0x5'));var BPromise=require(_0xf06b('0x6'));var Mustache=require(_0xf06b('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf06b('0x8'));var csv=require(_0xf06b('0x9'));var ejs=require(_0xf06b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf06b('0xb'));var crypto=require('crypto');var jsforce=require(_0xf06b('0xc'));var deskjs=require(_0xf06b('0xd'));var toCsv=require(_0xf06b('0x9'));var querystring=require(_0xf06b('0xe'));var Papa=require(_0xf06b('0xf'));var Redis=require(_0xf06b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf06b('0x11'));var as=require(_0xf06b('0x12'));var hardwareService=require(_0xf06b('0x13'));var logger=require(_0xf06b('0x14'))(_0xf06b('0x15'));var utils=require(_0xf06b('0x16'));var config=require('../../config/environment');var db=require(_0xf06b('0x17'))['db'];function respondWithStatusCode(_0x25721d,_0x1846f3){_0x1846f3=_0x1846f3||0xcc;return function(_0x3e2a4f){if(_0x3e2a4f){return _0x25721d['sendStatus'](_0x1846f3);}return _0x25721d[_0xf06b('0x18')](_0x1846f3)[_0xf06b('0x19')]();};}function respondWithResult(_0x34df4e,_0x189253){_0x189253=_0x189253||0xc8;return function(_0x3a272a){if(_0x3a272a){return _0x34df4e[_0xf06b('0x18')](_0x189253)[_0xf06b('0x1a')](_0x3a272a);}};}function respondWithFilteredResult(_0x5628f9,_0x2510e6){return function(_0x56bd87){if(_0x56bd87){var _0x221702=_0x56bd87[_0xf06b('0x1b')],_0x75d33d=_0x2510e6[_0xf06b('0x1c')],_0x2af220=_0x2510e6[_0xf06b('0x1c')]+_0x2510e6['limit'],_0x15a042;if(_0x2af220>=_0x221702){_0x2af220=_0x221702;_0x15a042=0xc8;}else{_0x15a042=0xce;}_0x5628f9[_0xf06b('0x18')](_0x15a042);return _0x5628f9[_0xf06b('0x1d')](_0xf06b('0x1e'),_0x75d33d+'-'+_0x2af220+'/'+_0x221702)['json'](_0x56bd87);}return null;};}function patchUpdates(_0xe9dfed){return function(_0x42dec8){try{jsonpatch[_0xf06b('0x1f')](_0x42dec8,_0xe9dfed,!![]);}catch(_0x329801){return BPromise[_0xf06b('0x20')](_0x329801);}return _0x42dec8[_0xf06b('0x21')]();};}function saveUpdates(_0x2a9548,_0x1f1f2e){return function(_0x4e8bf3){if(_0x4e8bf3){return _0x4e8bf3[_0xf06b('0x22')](_0x2a9548)[_0xf06b('0x23')](function(_0x2a85ba){return _0x2a85ba;});}return null;};}function removeEntity(_0xcfab69,_0x475c03){return function(_0x26524d){if(_0x26524d){return _0x26524d[_0xf06b('0x24')]()[_0xf06b('0x23')](function(){_0xcfab69['status'](0xcc)[_0xf06b('0x19')]();});}};}function handleEntityNotFound(_0x2d876b,_0x13bbb2){return function(_0x1147f1){if(!_0x1147f1){_0x2d876b[_0xf06b('0x25')](0x194);}return _0x1147f1;};}function handleError(_0x233cbe,_0x236d32){_0x236d32=_0x236d32||0x1f4;return function(_0x521046){logger[_0xf06b('0x26')](_0x521046[_0xf06b('0x27')]);if(_0x521046[_0xf06b('0x28')]){delete _0x521046[_0xf06b('0x28')];}_0x233cbe[_0xf06b('0x18')](_0x236d32)[_0xf06b('0x29')](_0x521046);};}exports['update']=function(_0xd60ea5,_0x33deb6){if(_0xd60ea5[_0xf06b('0x2a')]['id']){delete _0xd60ea5[_0xf06b('0x2a')]['id'];}return db['Action'][_0xf06b('0x2b')]({'where':{'id':_0xd60ea5[_0xf06b('0x2c')]['id']}})['then'](handleEntityNotFound(_0x33deb6,null))['then'](saveUpdates(_0xd60ea5['body'],null))[_0xf06b('0x23')](respondWithResult(_0x33deb6,null))[_0xf06b('0x2d')](handleError(_0x33deb6,null));};exports['destroy']=function(_0xa0368b,_0x4aa082){return db[_0xf06b('0x2e')][_0xf06b('0x2b')]({'where':{'id':_0xa0368b[_0xf06b('0x2c')]['id']}})[_0xf06b('0x23')](handleEntityNotFound(_0x4aa082,null))[_0xf06b('0x23')](removeEntity(_0x4aa082,null))[_0xf06b('0x2d')](handleError(_0x4aa082,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 38de18a..76c7ac4 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 _0x5e3e=['./action.attributes','exports','define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5e3e,0xf3));var _0xe5e3=function(_0x1abbf4,_0x2f199d){_0x1abbf4=_0x1abbf4-0x0;var _0x4c28d9=_0x5e3e[_0x1abbf4];return _0x4c28d9;};'use strict';var _=require(_0xe5e3('0x0'));var util=require(_0xe5e3('0x1'));var logger=require(_0xe5e3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe5e3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5e3('0x4'));var rimraf=require(_0xe5e3('0x5'));var config=require(_0xe5e3('0x6'));var attributes=require(_0xe5e3('0x7'));module[_0xe5e3('0x8')]=function(_0x5e8004,_0x16d9d7){return _0x5e8004[_0xe5e3('0x9')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8198=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0x8198,0x150));var _0x8819=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0x8198[_0x421725];return _0x51b322;};'use strict';var _=require('lodash');var util=require(_0x8819('0x0'));var logger=require(_0x8819('0x1'))(_0x8819('0x2'));var moment=require(_0x8819('0x3'));var BPromise=require(_0x8819('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8819('0x5'));var config=require(_0x8819('0x6'));var attributes=require(_0x8819('0x7'));module[_0x8819('0x8')]=function(_0xb46eb5,_0x1f55ac){return _0xb46eb5[_0x8819('0x9')](_0x8819('0xa'),attributes,{'tableName':_0x8819('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 43a95b3..e57004c 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x21951f,_0x5ef884){var _0x17767=function(_0x358f1b){while(--_0x358f1b){_0x21951f['push'](_0x21951f['shift']());}};_0x17767(++_0x5ef884);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb7e7[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Action,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index a84809f..d83004a 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 _0xba29=['./action.controller','put','/:id','isAuthenticated','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xba29,0x171));var _0x9ba2=function(_0x766bbb,_0x3bf16c){_0x766bbb=_0x766bbb-0x0;var _0x910310=_0xba29[_0x766bbb];return _0x910310;};'use strict';var multer=require(_0x9ba2('0x0'));var util=require(_0x9ba2('0x1'));var path=require('path');var timeout=require(_0x9ba2('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x9ba2('0x3'));var interaction=require(_0x9ba2('0x4'));var config=require('../../config/environment');var controller=require(_0x9ba2('0x5'));router[_0x9ba2('0x6')](_0x9ba2('0x7'),auth[_0x9ba2('0x8')](),controller['update']);router['delete'](_0x9ba2('0x7'),auth['isAuthenticated'](),controller[_0x9ba2('0x9')]);module[_0x9ba2('0xa')]=router; \ No newline at end of file +var _0x950a=['/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./action.controller'];(function(_0x2ad850,_0x1ddb6d){var _0x484c6a=function(_0x141f4e){while(--_0x141f4e){_0x2ad850['push'](_0x2ad850['shift']());}};_0x484c6a(++_0x1ddb6d);}(_0x950a,0x1d9));var _0xa950=function(_0xcc7748,_0x265c81){_0xcc7748=_0xcc7748-0x0;var _0xd756ca=_0x950a[_0xcc7748];return _0xd756ca;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require(_0xa950('0x3'));var express=require('express');var router=express[_0xa950('0x4')]();var auth=require(_0xa950('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa950('0x6'));router['put'](_0xa950('0x7'),auth[_0xa950('0x8')](),controller[_0xa950('0x9')]);router[_0xa950('0xa')](_0xa950('0x7'),auth[_0xa950('0x8')](),controller['destroy']);module[_0xa950('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 2000bf8..f5fbc22 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 _0x5b56=['sequelize','exports','STRING','TEXT'];(function(_0x3cc292,_0x3dd4d7){var _0x39eae6=function(_0x49c503){while(--_0x49c503){_0x3cc292['push'](_0x3cc292['shift']());}};_0x39eae6(++_0x3dd4d7);}(_0x5b56,0x64));var _0x65b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b56[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x65b5('0x0'));module[_0x65b5('0x1')]={'name':{'type':Sequelize[_0x65b5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x65b5('0x2')]},'parent':{'type':Sequelize[_0x65b5('0x2')]},'table':{'type':Sequelize[_0x65b5('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x65b5('0x3')]}}; \ No newline at end of file +var _0x20c2=['TEXT','sequelize','exports','STRING'];(function(_0x37caf3,_0x1dfe90){var _0x553272=function(_0x4c3e88){while(--_0x4c3e88){_0x37caf3['push'](_0x37caf3['shift']());}};_0x553272(++_0x1dfe90);}(_0x20c2,0x1b1));var _0x220c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20c2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x220c('0x0'));module[_0x220c('0x1')]={'name':{'type':Sequelize[_0x220c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x220c('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x220c('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7b0087b..110d7d1 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 _0x22a4=['name','send','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','AnalyticCustomReport','includeAll','include','catch','show','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','update','params','join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','function','format','replace','order','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SUM(%s)','HOUR(%s)','ROUND(%s)','AnalyticMetric','findAll','metric','groupBy','orderBy','%s.%s\x20=\x20%s.%s','No\x20available\x20data','output','fullPath','randomstring','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','countTable','COUNT(*)','run','runReport','IS\x20EMPTY','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','dbH','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','get','CustomReports','UserProfileResource','destroy','error','stack'];(function(_0x265dbe,_0x20652d){var _0x520a14=function(_0x52f393){while(--_0x52f393){_0x265dbe['push'](_0x265dbe['shift']());}};_0x520a14(++_0x20652d);}(_0x22a4,0x1cb));var _0x422a=function(_0x5cca9f,_0x154684){_0x5cca9f=_0x5cca9f-0x0;var _0x55edda=_0x22a4[_0x5cca9f];return _0x55edda;};'use strict';var pdf=require(_0x422a('0x0'));var emlformat=require(_0x422a('0x1'));var rimraf=require(_0x422a('0x2'));var zipdir=require(_0x422a('0x3'));var jsonpatch=require(_0x422a('0x4'));var rp=require(_0x422a('0x5'));var moment=require(_0x422a('0x6'));var BPromise=require(_0x422a('0x7'));var Mustache=require('mustache');var util=require(_0x422a('0x8'));var path=require(_0x422a('0x9'));var sox=require(_0x422a('0xa'));var csv=require(_0x422a('0xb'));var ejs=require(_0x422a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x422a('0xd'));var crypto=require(_0x422a('0xe'));var jsforce=require(_0x422a('0xf'));var deskjs=require(_0x422a('0x10'));var toCsv=require(_0x422a('0xb'));var querystring=require(_0x422a('0x11'));var Papa=require(_0x422a('0x12'));var Redis=require(_0x422a('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x422a('0x14'));var hardwareService=require(_0x422a('0x15'));var logger=require(_0x422a('0x16'))(_0x422a('0x17'));var utils=require(_0x422a('0x18'));var config=require(_0x422a('0x19'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x422a('0x1a')];function respondWithStatusCode(_0x4dbed1,_0x5a0c59){_0x5a0c59=_0x5a0c59||0xcc;return function(_0x5a1200){if(_0x5a1200){return _0x4dbed1[_0x422a('0x1b')](_0x5a0c59);}return _0x4dbed1[_0x422a('0x1c')](_0x5a0c59)[_0x422a('0x1d')]();};}function respondWithResult(_0x2dc9b2,_0x147af5){_0x147af5=_0x147af5||0xc8;return function(_0x428752){if(_0x428752){return _0x2dc9b2[_0x422a('0x1c')](_0x147af5)[_0x422a('0x1e')](_0x428752);}};}function respondWithFilteredResult(_0xf9fcf7,_0x2ba53b){return function(_0x30b6e9){if(_0x30b6e9){var _0x441fa8=_0x30b6e9[_0x422a('0x1f')],_0x39c6a3=_0x2ba53b[_0x422a('0x20')],_0x3d5033=_0x2ba53b['offset']+_0x2ba53b[_0x422a('0x21')],_0x29f17b;if(_0x3d5033>=_0x441fa8){_0x3d5033=_0x441fa8;_0x29f17b=0xc8;}else{_0x29f17b=0xce;}_0xf9fcf7[_0x422a('0x1c')](_0x29f17b);return _0xf9fcf7['set'](_0x422a('0x22'),_0x39c6a3+'-'+_0x3d5033+'/'+_0x441fa8)['json'](_0x30b6e9);}return null;};}function patchUpdates(_0x552048){return function(_0x3ef74f){try{jsonpatch[_0x422a('0x23')](_0x3ef74f,_0x552048,!![]);}catch(_0x12d913){return BPromise[_0x422a('0x24')](_0x12d913);}return _0x3ef74f[_0x422a('0x25')]();};}function saveUpdates(_0x5f9720,_0x6569d4){return function(_0x26922a){if(_0x26922a){return _0x26922a['update'](_0x5f9720)[_0x422a('0x26')](function(_0x3284ed){return _0x3284ed;});}return null;};}function removeEntity(_0x211d93,_0x3d3213){return function(_0x2283ca){if(_0x2283ca){return _0x2283ca['destroy']()[_0x422a('0x26')](function(){var _0x33bc88=_0x2283ca[_0x422a('0x27')]({'plain':!![]});var _0x5e3138=_0x422a('0x28');return db[_0x422a('0x29')][_0x422a('0x2a')]({'where':{'type':_0x5e3138,'resourceId':_0x33bc88['id']}})[_0x422a('0x26')](function(){return _0x2283ca;});})[_0x422a('0x26')](function(){_0x211d93[_0x422a('0x1c')](0xcc)[_0x422a('0x1d')]();});}};}function handleEntityNotFound(_0xe39bf5,_0x535888){return function(_0x911cc9){if(!_0x911cc9){_0xe39bf5[_0x422a('0x1b')](0x194);}return _0x911cc9;};}function handleError(_0x572924,_0x83cb4d){_0x83cb4d=_0x83cb4d||0x1f4;return function(_0x49d75f){logger[_0x422a('0x2b')](_0x49d75f[_0x422a('0x2c')]);if(_0x49d75f[_0x422a('0x2d')]){delete _0x49d75f[_0x422a('0x2d')];}_0x572924['status'](_0x83cb4d)[_0x422a('0x2e')](_0x49d75f);};}exports[_0x422a('0x2f')]=function(_0x50cc29,_0x5826ac){var _0x3414ad={},_0x34226a={},_0x5e6218={'count':0x0,'rows':[]};var _0x494226=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x3c6a84){return{'name':_0x3c6a84[_0x422a('0x30')],'type':_0x3c6a84[_0x422a('0x31')][_0x422a('0x32')]};});_0x34226a[_0x422a('0x33')]=_['map'](_0x494226,_0x422a('0x2d'));_0x34226a[_0x422a('0x34')]=_[_0x422a('0x35')](_0x50cc29[_0x422a('0x34')]);_0x34226a[_0x422a('0x36')]=_[_0x422a('0x37')](_0x34226a[_0x422a('0x33')],_0x34226a['query']);_0x3414ad[_0x422a('0x38')]=_[_0x422a('0x37')](_0x34226a[_0x422a('0x33')],qs[_0x422a('0x39')](_0x50cc29['query'][_0x422a('0x39')]));_0x3414ad['attributes']=_0x3414ad[_0x422a('0x38')][_0x422a('0x3a')]?_0x3414ad['attributes']:_0x34226a[_0x422a('0x33')];if(!_0x50cc29[_0x422a('0x34')]['hasOwnProperty'](_0x422a('0x3b'))){_0x3414ad[_0x422a('0x21')]=qs[_0x422a('0x21')](_0x50cc29[_0x422a('0x34')][_0x422a('0x21')]);_0x3414ad[_0x422a('0x20')]=qs[_0x422a('0x20')](_0x50cc29[_0x422a('0x34')]['offset']);}_0x3414ad['order']=qs[_0x422a('0x3c')](_0x50cc29[_0x422a('0x34')][_0x422a('0x3c')]);_0x3414ad['where']=qs[_0x422a('0x36')](_[_0x422a('0x3d')](_0x50cc29['query'],_0x34226a['filters']),_0x494226);if(_0x50cc29[_0x422a('0x34')]['filter']){_0x3414ad[_0x422a('0x3e')]=_[_0x422a('0x3f')](_0x3414ad[_0x422a('0x3e')],{'$or':_['map'](_0x494226,function(_0x36661b){if(_0x36661b[_0x422a('0x31')]!==_0x422a('0x40')){var _0x4f598e={};_0x4f598e[_0x36661b['name']]={'$like':'%'+_0x50cc29[_0x422a('0x34')][_0x422a('0x41')]+'%'};return _0x4f598e;}})});}_0x3414ad=_[_0x422a('0x3f')]({},_0x3414ad,_0x50cc29['options']);var _0x99d274={'where':_0x3414ad[_0x422a('0x3e')]};return db[_0x422a('0x42')][_0x422a('0x1f')](_0x99d274)[_0x422a('0x26')](function(_0x590c9b){_0x5e6218[_0x422a('0x1f')]=_0x590c9b;if(_0x50cc29[_0x422a('0x34')][_0x422a('0x43')]){_0x3414ad[_0x422a('0x44')]=[{'all':!![]}];}return db[_0x422a('0x42')]['findAll'](_0x3414ad);})['then'](function(_0x2b700d){_0x5e6218['rows']=_0x2b700d;return _0x5e6218;})[_0x422a('0x26')](respondWithFilteredResult(_0x5826ac,_0x3414ad))[_0x422a('0x45')](handleError(_0x5826ac,null));};exports[_0x422a('0x46')]=function(_0x10302c,_0x474255){var _0x1e010c={'raw':![],'where':{'id':_0x10302c['params']['id']}},_0x39f7a3={};_0x39f7a3[_0x422a('0x33')]=_[_0x422a('0x35')](db[_0x422a('0x42')][_0x422a('0x47')]);_0x39f7a3[_0x422a('0x34')]=_[_0x422a('0x35')](_0x10302c[_0x422a('0x34')]);_0x39f7a3['filters']=_[_0x422a('0x37')](_0x39f7a3[_0x422a('0x33')],_0x39f7a3['query']);_0x1e010c[_0x422a('0x38')]=_[_0x422a('0x37')](_0x39f7a3[_0x422a('0x33')],qs[_0x422a('0x39')](_0x10302c[_0x422a('0x34')][_0x422a('0x39')]));_0x1e010c[_0x422a('0x38')]=_0x1e010c['attributes'][_0x422a('0x3a')]?_0x1e010c[_0x422a('0x38')]:_0x39f7a3[_0x422a('0x33')];if(_0x10302c[_0x422a('0x34')][_0x422a('0x43')]){_0x1e010c[_0x422a('0x44')]=[{'all':!![]}];}_0x1e010c=_[_0x422a('0x3f')]({},_0x1e010c,_0x10302c[_0x422a('0x48')]);return db[_0x422a('0x42')][_0x422a('0x49')](_0x1e010c)['then'](handleEntityNotFound(_0x474255,null))['then'](respondWithResult(_0x474255,null))[_0x422a('0x45')](handleError(_0x474255,null));};exports[_0x422a('0x4a')]=function(_0x5a6f7c,_0x2d5234){return db[_0x422a('0x42')][_0x422a('0x4a')](_0x5a6f7c[_0x422a('0x4b')],{})[_0x422a('0x26')](function(_0x792783){var _0x2c8f29=_0x5a6f7c[_0x422a('0x4c')][_0x422a('0x27')]({'plain':!![]});if(!_0x2c8f29)throw new Error(_0x422a('0x4d'));if(_0x2c8f29['role']==='user'){var _0xedc7dc=_0x792783[_0x422a('0x27')]({'plain':!![]});var _0x553ab8=_0x422a('0x4e');return db[_0x422a('0x4f')][_0x422a('0x49')]({'where':{'name':_0x553ab8,'userProfileId':_0x2c8f29[_0x422a('0x50')]},'raw':!![]})[_0x422a('0x26')](function(_0x3ca582){if(_0x3ca582&&_0x3ca582[_0x422a('0x51')]===0x0){return db['UserProfileResource'][_0x422a('0x4a')]({'name':_0xedc7dc[_0x422a('0x2d')],'resourceId':_0xedc7dc['id'],'type':_0x422a('0x28'),'sectionId':_0x3ca582['id']},{})[_0x422a('0x26')](function(){return _0x792783;});}else{return _0x792783;}})[_0x422a('0x45')](function(_0x28d1ba){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28d1ba);throw _0x28d1ba;});}return _0x792783;})[_0x422a('0x26')](respondWithResult(_0x2d5234,0xc9))[_0x422a('0x45')](handleError(_0x2d5234,null));};exports[_0x422a('0x52')]=function(_0x2e84be,_0x2a2121){if(_0x2e84be[_0x422a('0x4b')]['id']){delete _0x2e84be[_0x422a('0x4b')]['id'];}return db[_0x422a('0x42')][_0x422a('0x49')]({'where':{'id':_0x2e84be['params']['id']}})['then'](handleEntityNotFound(_0x2a2121,null))['then'](saveUpdates(_0x2e84be[_0x422a('0x4b')],null))[_0x422a('0x26')](respondWithResult(_0x2a2121,null))[_0x422a('0x45')](handleError(_0x2a2121,null));};exports[_0x422a('0x2a')]=function(_0x4c31fb,_0x3c04e6){return db[_0x422a('0x42')][_0x422a('0x49')]({'where':{'id':_0x4c31fb[_0x422a('0x53')]['id']}})[_0x422a('0x26')](handleEntityNotFound(_0x3c04e6,null))[_0x422a('0x26')](removeEntity(_0x3c04e6,null))['catch'](handleError(_0x3c04e6,null));};exports['preview']=function(_0x2c9c40,_0x8bbd8){var _0x41d1c5=0xa;var _0x5f2ea9=[_0x422a('0x54'),'left_join',_0x422a('0x55'),_0x422a('0x56')];var _0x56719c={'SUM':'SUM(%s)','COUNT':_0x422a('0x57'),'COUNT DISTINCT':_0x422a('0x58'),'MAX':'MAX(%s)','MIN':_0x422a('0x59'),'AVG':_0x422a('0x5a'),'GROUP_CONCAT':_0x422a('0x5b'),'GROUP_CONCAT ASC':_0x422a('0x5c'),'GROUP_CONCAT DESC':_0x422a('0x5d')};var _0x40e20a={'SEC_TO_TIME':_0x422a('0x5e'),'DATE':_0x422a('0x5f'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x422a('0x60')};var _0xbcc14a=function(_0x167679){return!_[_0x422a('0x61')]([_0x422a('0x62'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x422a('0x63')],_0x167679);};var _0x41bd93=function(_0x197106){if(!_0x197106||!_0x197106[_0x422a('0x64')]['length']){return'';}for(var _0x2ba320='(',_0x4bf66a=0x0;_0x4bf66a<_0x197106['rules']['length'];_0x4bf66a+=0x1){_0x4bf66a>0x0&&(_0x2ba320+='\x20'+_0x197106[_0x422a('0x65')]+'\x20');_0x2ba320+=_0x197106[_0x422a('0x64')][_0x4bf66a][_0x422a('0x66')]?_0x41bd93(_0x197106[_0x422a('0x64')][_0x4bf66a]['group']):_0x197106[_0x422a('0x64')][_0x4bf66a][_0x422a('0x67')]+'\x20'+_0x197106[_0x422a('0x64')][_0x4bf66a][_0x422a('0x68')]+(_0xbcc14a(_0x197106[_0x422a('0x64')][_0x4bf66a][_0x422a('0x68')])?'\x20'+_0x197106['rules'][_0x4bf66a][_0x422a('0x69')]:'');}return _0x2ba320+')';};var _0x3b391d={'where':{'id':_0x2c9c40['params']['id']}},_0xa33a64,_0x29aa5a,_0xcb4d6d,_0x46baef,_0x5e59b4;_0x3b391d=_[_0x422a('0x3f')]({},_0x3b391d,_0x2c9c40[_0x422a('0x48')]);return db[_0x422a('0x42')][_0x422a('0x49')](_0x3b391d)[_0x422a('0x26')](function(_0x174b1d){if(_0x174b1d){_0xa33a64=_0x174b1d;return _0x174b1d[_0x422a('0x6a')]();}return null;})[_0x422a('0x26')](function(_0x10fe43){if(_0x10fe43){if(!_0x10fe43['length']){throw new db[(_0x422a('0x6b'))][(_0x422a('0x6c'))](_0x422a('0x6d'),0x193);}_0x29aa5a=_0x10fe43;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x35009a){if(_0x35009a){_0xcb4d6d=_[_0x422a('0x6e')](_0x35009a,'id');var _0x14584a;var _0x2d2efe=squel[_0x422a('0x6f')]();_0x2d2efe[_0x422a('0x70')](_0xa33a64[_0x422a('0x71')]);for(var _0x3defd3=0x0;_0x3defd3<_0x29aa5a[_0x422a('0x3a')];_0x3defd3+=0x1){_0x14584a=_0x29aa5a[_0x3defd3][_0x422a('0x72')]?_0xcb4d6d[_0x29aa5a[_0x3defd3][_0x422a('0x72')]]['metric']:_0x29aa5a[_0x3defd3][_0x422a('0x67')];_0x14584a=_0x29aa5a[_0x3defd3][_0x422a('0x73')]?_['replace'](_0x56719c[_0x29aa5a[_0x3defd3][_0x422a('0x73')]],'%s',_0x14584a):_0x14584a;_0x14584a=_0x29aa5a[_0x3defd3][_0x422a('0x74')]?_[_0x422a('0x75')](_0x40e20a[_0x29aa5a[_0x3defd3][_0x422a('0x74')]],'%s',_0x14584a):_0x14584a;if(_0x29aa5a[_0x3defd3]['groupBy']){_0x2d2efe[_0x422a('0x66')](_0x14584a);}_0x29aa5a[_0x3defd3]['orderBy']&&_0x2d2efe[_0x422a('0x76')](_0x14584a,_0x29aa5a[_0x3defd3]['orderBy']===_0x422a('0x77')?![]:!![]);_0x2d2efe[_0x422a('0x67')](_0x14584a,_0x29aa5a[_0x3defd3][_0x422a('0x78')]||_0x14584a);}if(_0xa33a64[_0x422a('0x79')]){_0xa33a64[_0x422a('0x79')]=JSON[_0x422a('0x7a')](_0xa33a64[_0x422a('0x79')]);for(var _0x226343=0x0;_0x226343<_0xa33a64[_0x422a('0x79')][_0x422a('0x3a')];_0x226343+=0x1){if(_0xa33a64[_0x422a('0x79')][_0x226343][_0x422a('0x31')]&&_[_0x422a('0x61')](_0x5f2ea9,_0xa33a64['joins'][_0x226343]['type'])&&_0xa33a64[_0x422a('0x79')][_0x226343][_0x422a('0x7b')]&&_0xa33a64['joins'][_0x226343]['foreignTable']&&_0xa33a64[_0x422a('0x79')][_0x226343][_0x422a('0x7c')]){_0x2d2efe[_0xa33a64[_0x422a('0x79')][_0x226343]['type']](_0xa33a64['joins'][_0x226343][_0x422a('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0xa33a64[_0x422a('0x71')],_0xa33a64[_0x422a('0x79')][_0x226343][_0x422a('0x7b')],_0xa33a64[_0x422a('0x79')][_0x226343][_0x422a('0x7d')],_0xa33a64['joins'][_0x226343][_0x422a('0x7c')]));}}}if(_0xa33a64[_0x422a('0x7e')]){_0xa33a64['conditions']=JSON[_0x422a('0x7a')](_0xa33a64[_0x422a('0x7e')]);_0x2d2efe[_0x422a('0x3e')](_0x41bd93(_0xa33a64['conditions'][_0x422a('0x66')]));}_0x5e59b4=_0x2d2efe[_0x422a('0x7f')]();_0x2d2efe[_0x422a('0x21')](_0x41d1c5);_0x2d2efe[_0x422a('0x20')](0x0);logger[_0x422a('0x80')](_0x422a('0x81'),_0x2d2efe[_0x422a('0x82')]());return db['sequelize'][_0x422a('0x34')](_0x2d2efe[_0x422a('0x82')](),{'type':db[_0x422a('0x83')][_0x422a('0x84')][_0x422a('0x85')]});}})[_0x422a('0x26')](respondWithResult(_0x8bbd8,null))['catch'](handleError(_0x8bbd8,null));};function runReport(_0x514cc9,_0x2b017a,_0x345444){var _0x534dff=_0x2b017a[_0x422a('0x2d')];var _0x70b964=0xa;var _0x43d7d7=[_0x422a('0x54'),_0x422a('0x86'),'right_join','cross_join'];var _0x52e880={'SUM':_0x422a('0x87'),'COUNT':_0x422a('0x57'),'COUNT DISTINCT':_0x422a('0x58'),'MAX':'MAX(%s)','MIN':_0x422a('0x59'),'AVG':_0x422a('0x5a'),'GROUP_CONCAT':_0x422a('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x422a('0x5d')};var _0x3d45a2={'SEC_TO_TIME':_0x422a('0x5e'),'DATE':'DATE(%s)','HOUR':_0x422a('0x88'),'ROUND':_0x422a('0x89'),'UNIX_TIMESTAMP':_0x422a('0x60')};var _0x39b153=function(_0x33747c){return!_[_0x422a('0x61')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x422a('0x63')],_0x33747c);};var _0x5f42b0=function(_0x586f20){if(!_0x586f20||!_0x586f20['rules']['length']){return'';}for(var _0x328d96='(',_0x47e48b=0x0;_0x47e48b<_0x586f20[_0x422a('0x64')][_0x422a('0x3a')];_0x47e48b+=0x1){_0x47e48b>0x0&&(_0x328d96+='\x20'+_0x586f20[_0x422a('0x65')]+'\x20');_0x328d96+=_0x586f20[_0x422a('0x64')][_0x47e48b][_0x422a('0x66')]?_0x5f42b0(_0x586f20[_0x422a('0x64')][_0x47e48b][_0x422a('0x66')]):_0x586f20[_0x422a('0x64')][_0x47e48b][_0x422a('0x67')]+'\x20'+_0x586f20[_0x422a('0x64')][_0x47e48b][_0x422a('0x68')]+(_0x39b153(_0x586f20[_0x422a('0x64')][_0x47e48b][_0x422a('0x68')])?'\x20'+_0x586f20[_0x422a('0x64')][_0x47e48b]['value']:'');}return _0x328d96+')';};var _0x1c02ca={'where':{'id':_0x514cc9['id']}},_0x1e86ae,_0x93d934,_0x4358e6,_0x5aeac4,_0x402c77;_0x1c02ca=_[_0x422a('0x3f')]({},_0x1c02ca,_0x345444);return db['AnalyticCustomReport'][_0x422a('0x49')](_0x1c02ca)[_0x422a('0x26')](function(_0x568940){if(_0x568940){_0x1e86ae=_0x568940;return _0x568940[_0x422a('0x6a')]();}return null;})['then'](function(_0x5ef2d0){if(_0x5ef2d0){if(!_0x5ef2d0['length']){throw new db[(_0x422a('0x6b'))][(_0x422a('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x93d934=_0x5ef2d0;return db[_0x422a('0x8a')][_0x422a('0x8b')]({'raw':!![]});}return null;})[_0x422a('0x26')](function(_0x5a4ad9){if(_0x5a4ad9){_0x4358e6=_['keyBy'](_0x5a4ad9,'id');var _0x1d8d80;var _0x1d1b5e=squel[_0x422a('0x6f')]();_0x1d1b5e[_0x422a('0x70')](_0x1e86ae[_0x422a('0x71')]);for(var _0x21d6cb=0x0;_0x21d6cb<_0x93d934['length'];_0x21d6cb+=0x1){_0x1d8d80=_0x93d934[_0x21d6cb][_0x422a('0x72')]?_0x4358e6[_0x93d934[_0x21d6cb][_0x422a('0x72')]][_0x422a('0x8c')]:_0x93d934[_0x21d6cb]['field'];_0x1d8d80=_0x93d934[_0x21d6cb][_0x422a('0x73')]?_[_0x422a('0x75')](_0x52e880[_0x93d934[_0x21d6cb][_0x422a('0x73')]],'%s',_0x1d8d80):_0x1d8d80;_0x1d8d80=_0x93d934[_0x21d6cb][_0x422a('0x74')]?_[_0x422a('0x75')](_0x3d45a2[_0x93d934[_0x21d6cb][_0x422a('0x74')]],'%s',_0x1d8d80):_0x1d8d80;if(_0x93d934[_0x21d6cb][_0x422a('0x8d')]){_0x1d1b5e['group'](_0x1d8d80);}_0x93d934[_0x21d6cb][_0x422a('0x8e')]&&_0x1d1b5e['order'](_0x1d8d80,_0x93d934[_0x21d6cb]['orderBy']==='DESC'?![]:!![]);_0x1d1b5e[_0x422a('0x67')](_0x1d8d80,_0x93d934[_0x21d6cb][_0x422a('0x78')]||_0x1d8d80);}if(_0x1e86ae[_0x422a('0x79')]){_0x1e86ae['joins']=JSON[_0x422a('0x7a')](_0x1e86ae[_0x422a('0x79')]);for(var _0x42bec3=0x0;_0x42bec3<_0x1e86ae['joins']['length'];_0x42bec3+=0x1){if(_0x1e86ae[_0x422a('0x79')][_0x42bec3][_0x422a('0x31')]&&_[_0x422a('0x61')](_0x43d7d7,_0x1e86ae[_0x422a('0x79')][_0x42bec3]['type'])&&_0x1e86ae[_0x422a('0x79')][_0x42bec3][_0x422a('0x7b')]&&_0x1e86ae[_0x422a('0x79')][_0x42bec3][_0x422a('0x7d')]&&_0x1e86ae['joins'][_0x42bec3][_0x422a('0x7c')]){_0x1d1b5e[_0x1e86ae[_0x422a('0x79')][_0x42bec3]['type']](_0x1e86ae[_0x422a('0x79')][_0x42bec3][_0x422a('0x7d')],null,util[_0x422a('0x74')](_0x422a('0x8f'),_0x1e86ae[_0x422a('0x71')],_0x1e86ae[_0x422a('0x79')][_0x42bec3][_0x422a('0x7b')],_0x1e86ae[_0x422a('0x79')][_0x42bec3][_0x422a('0x7d')],_0x1e86ae[_0x422a('0x79')][_0x42bec3][_0x422a('0x7c')]));}}}if(_0x1e86ae[_0x422a('0x7e')]){_0x1e86ae[_0x422a('0x7e')]=JSON[_0x422a('0x7a')](_0x1e86ae['conditions']);_0x1d1b5e[_0x422a('0x3e')](_0x5f42b0(_0x1e86ae[_0x422a('0x7e')][_0x422a('0x66')]));}_0x402c77=_0x1d1b5e['clone']();_0x1d1b5e[_0x422a('0x21')](_0x70b964);_0x1d1b5e[_0x422a('0x20')](0x0);logger[_0x422a('0x80')]('Limited\x20Query:',_0x1d1b5e[_0x422a('0x82')]());return db[_0x422a('0x83')][_0x422a('0x34')](_0x1d1b5e[_0x422a('0x82')](),{'type':db[_0x422a('0x83')][_0x422a('0x84')]['SELECT']});}})[_0x422a('0x26')](function(_0x1302a8){if(!_0x1302a8[_0x422a('0x3a')]){throw new db[(_0x422a('0x6b'))]['ValidationErrorItem'](_0x422a('0x90'),0xcc);}if(_0x2b017a[_0x422a('0x91')]==='web'){return null;}var _0x298835=_[_0x422a('0x3f')](_0x2b017a,{'name':_0x2b017a[_0x422a('0x92')]||_0x2b017a[_0x422a('0x2d')]||_0x1e86ae[_0x422a('0x2d')],'basename':_0x534dff,'savename':util[_0x422a('0x74')]('%s-%s.%s',_0x2b017a[_0x422a('0x2d')]||_0x1e86ae[_0x422a('0x2d')],require(_0x422a('0x93'))[_0x422a('0x94')](0x4),_0x2b017a['output']||_0x422a('0x95')),'reportId':_0x1e86ae['id'],'reportType':_0x422a('0x96')});return db[_0x422a('0x97')][_0x422a('0x4a')](_0x298835,{'raw':!![]});})[_0x422a('0x26')](function(_0x530e5a){if(_0x1e86ae['table']===_0x422a('0x98')){_0x402c77['where'](_0x1e86ae[_0x422a('0x71')]+_0x422a('0x99'),_0x2b017a[_0x422a('0x9a')],_0x2b017a[_0x422a('0x9b')]);}else{_0x402c77[_0x422a('0x3e')](_0x1e86ae['table']+_0x422a('0x9c'),_0x2b017a[_0x422a('0x9a')],_0x2b017a[_0x422a('0x9b')]);}if(_0x530e5a){logger['info'](_0x422a('0x9d'),_0x402c77['toString']());require(_0x422a('0x9e'))[_0x422a('0x9f')](path[_0x422a('0x54')](__dirname,_0x422a('0xa0'),_0x530e5a[_0x422a('0x91')]),[_0x530e5a['id'],_0x402c77[_0x422a('0x82')](),path['join'](__dirname,_0x422a('0xa1'),_0x530e5a[_0x422a('0xa2')]),_0x534dff]);return _0x530e5a;}else{var _0xfd894d=squel['select']();_0xfd894d[_0x422a('0x70')]('('+_0x402c77['toString']()+')',_0x422a('0xa3'));_0xfd894d['field'](_0x422a('0xa4'),_0x422a('0x1f'));_0x402c77['limit'](_0x2b017a[_0x422a('0x21')]||_0x70b964);_0x402c77[_0x422a('0x20')](_0x2b017a['offset']||0x0);return dbH[_0x422a('0x83')][_0x422a('0x34')](_0xfd894d[_0x422a('0x82')](),{'type':dbH[_0x422a('0x83')][_0x422a('0x84')][_0x422a('0x85')]})[_0x422a('0x26')](function(_0x22ee94){if(!_0x22ee94[_0x422a('0x3a')]){_0x5aeac4=0x0;}else{_0x5aeac4=_0x22ee94[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x402c77[_0x422a('0x82')](),{'type':dbH[_0x422a('0x83')][_0x422a('0x84')][_0x422a('0x85')]});})[_0x422a('0x26')](function(_0x369528){return{'rows':_0x369528||[],'count':_0x5aeac4};});}});}exports[_0x422a('0xa5')]=function(_0x3136ee,_0xd058a5){return runReport(_0x3136ee[_0x422a('0x53')],_0x3136ee[_0x422a('0x34')],_0x3136ee[_0x422a('0x48')])[_0x422a('0x26')](respondWithResult(_0xd058a5,null))[_0x422a('0x45')](handleError(_0xd058a5,null));};exports[_0x422a('0xa6')]=runReport;exports[_0x422a('0x34')]=function(_0x2f93a7,_0x23cdae){var _0x2df36d=0xa;var _0x27b2d0=[_0x422a('0x54'),_0x422a('0x86'),_0x422a('0x55'),_0x422a('0x56')];var _0x4a157d={'SUM':'SUM(%s)','COUNT':_0x422a('0x57'),'COUNT DISTINCT':_0x422a('0x58'),'MAX':'MAX(%s)','MIN':_0x422a('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x422a('0x5b'),'GROUP_CONCAT ASC':_0x422a('0x5c'),'GROUP_CONCAT DESC':_0x422a('0x5d')};var _0x28d8f5={'SEC_TO_TIME':_0x422a('0x5e'),'DATE':'DATE(%s)','HOUR':_0x422a('0x88'),'ROUND':_0x422a('0x89'),'UNIX_TIMESTAMP':_0x422a('0x60')};var _0x4a8c72=function(_0x308499){return!_[_0x422a('0x61')]([_0x422a('0x62'),'IS\x20NOT\x20NULL',_0x422a('0xa7'),'IS\x20NOT\x20EMPTY'],_0x308499);};var _0x439fcc=function(_0x5d8353){if(!_0x5d8353||!_0x5d8353[_0x422a('0x64')][_0x422a('0x3a')]){return'';}for(var _0x290b20='(',_0x786699=0x0;_0x786699<_0x5d8353[_0x422a('0x64')][_0x422a('0x3a')];_0x786699+=0x1){_0x786699>0x0&&(_0x290b20+='\x20'+_0x5d8353[_0x422a('0x65')]+'\x20');_0x290b20+=_0x5d8353[_0x422a('0x64')][_0x786699][_0x422a('0x66')]?_0x439fcc(_0x5d8353[_0x422a('0x64')][_0x786699][_0x422a('0x66')]):_0x5d8353['rules'][_0x786699][_0x422a('0x67')]+'\x20'+_0x5d8353[_0x422a('0x64')][_0x786699]['condition']+(_0x4a8c72(_0x5d8353[_0x422a('0x64')][_0x786699][_0x422a('0x68')])?'\x20'+_0x5d8353['rules'][_0x786699]['value']:'');}return _0x290b20+')';};var _0x53a1bb={'where':{'id':_0x2f93a7[_0x422a('0x53')]['id']}},_0x275e98,_0x1435c0,_0x2d83d5,_0x4f9058,_0x2fda3e;_0x53a1bb=_[_0x422a('0x3f')]({},_0x53a1bb,_0x2f93a7[_0x422a('0x48')]);return db[_0x422a('0x42')][_0x422a('0x49')](_0x53a1bb)['then'](function(_0x36c39d){if(_0x36c39d){_0x275e98=_0x36c39d;return _0x36c39d[_0x422a('0x6a')]();}return null;})['then'](function(_0x45ac99){if(_0x45ac99){if(!_0x45ac99[_0x422a('0x3a')]){throw new db[(_0x422a('0x6b'))][(_0x422a('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1435c0=_0x45ac99;return db[_0x422a('0x8a')][_0x422a('0x8b')]({'raw':!![]});}return null;})[_0x422a('0x26')](function(_0x277402){if(_0x277402){_0x2d83d5=_[_0x422a('0x6e')](_0x277402,'id');var _0x2767c6;var _0x4bb4b1=squel['select']();_0x4bb4b1['from'](_0x275e98[_0x422a('0x71')]);for(var _0x13c970=0x0;_0x13c970<_0x1435c0[_0x422a('0x3a')];_0x13c970+=0x1){_0x2767c6=_0x1435c0[_0x13c970][_0x422a('0x72')]?_0x2d83d5[_0x1435c0[_0x13c970]['MetricId']][_0x422a('0x8c')]:_0x1435c0[_0x13c970]['field'];_0x2767c6=_0x1435c0[_0x13c970]['function']?_[_0x422a('0x75')](_0x4a157d[_0x1435c0[_0x13c970][_0x422a('0x73')]],'%s',_0x2767c6):_0x2767c6;_0x2767c6=_0x1435c0[_0x13c970][_0x422a('0x74')]?_[_0x422a('0x75')](_0x28d8f5[_0x1435c0[_0x13c970][_0x422a('0x74')]],'%s',_0x2767c6):_0x2767c6;if(_0x1435c0[_0x13c970][_0x422a('0x8d')]){_0x4bb4b1[_0x422a('0x66')](_0x2767c6);}_0x1435c0[_0x13c970][_0x422a('0x8e')]&&_0x4bb4b1[_0x422a('0x76')](_0x2767c6,_0x1435c0[_0x13c970][_0x422a('0x8e')]==='DESC'?![]:!![]);_0x4bb4b1[_0x422a('0x67')](_0x2767c6,_0x1435c0[_0x13c970][_0x422a('0x78')]||_0x2767c6);}if(_0x275e98['joins']){_0x275e98['joins']=JSON[_0x422a('0x7a')](_0x275e98[_0x422a('0x79')]);for(var _0x3ad2a7=0x0;_0x3ad2a7<_0x275e98[_0x422a('0x79')][_0x422a('0x3a')];_0x3ad2a7+=0x1){if(_0x275e98[_0x422a('0x79')][_0x3ad2a7][_0x422a('0x31')]&&_[_0x422a('0x61')](_0x27b2d0,_0x275e98[_0x422a('0x79')][_0x3ad2a7]['type'])&&_0x275e98[_0x422a('0x79')][_0x3ad2a7]['parentKey']&&_0x275e98[_0x422a('0x79')][_0x3ad2a7][_0x422a('0x7d')]&&_0x275e98[_0x422a('0x79')][_0x3ad2a7][_0x422a('0x7c')]){_0x4bb4b1[_0x275e98['joins'][_0x3ad2a7][_0x422a('0x31')]](_0x275e98[_0x422a('0x79')][_0x3ad2a7][_0x422a('0x7d')],null,util[_0x422a('0x74')](_0x422a('0x8f'),_0x275e98[_0x422a('0x71')],_0x275e98[_0x422a('0x79')][_0x3ad2a7][_0x422a('0x7b')],_0x275e98[_0x422a('0x79')][_0x3ad2a7][_0x422a('0x7d')],_0x275e98['joins'][_0x3ad2a7]['foreignKey']));}}}if(_0x275e98[_0x422a('0x7e')]){_0x275e98[_0x422a('0x7e')]=JSON[_0x422a('0x7a')](_0x275e98[_0x422a('0x7e')]);_0x4bb4b1[_0x422a('0x3e')](_0x439fcc(_0x275e98['conditions'][_0x422a('0x66')]));}_0x2fda3e=_0x4bb4b1[_0x422a('0x7f')]();_0x4bb4b1[_0x422a('0x21')](_0x2df36d);_0x4bb4b1[_0x422a('0x20')](0x0);logger[_0x422a('0x80')]('Limited\x20Query:',_0x4bb4b1['toString']());return db[_0x422a('0x83')]['query'](_0x4bb4b1[_0x422a('0x82')](),{'type':db[_0x422a('0x83')][_0x422a('0x84')][_0x422a('0x85')]});}})[_0x422a('0x26')](function(){return{'sql':_0x2fda3e[_0x422a('0x82')]()};})[_0x422a('0x26')](respondWithResult(_0x23cdae,null))['catch'](handleError(_0x23cdae,null));}; \ No newline at end of file +var _0xbed7=['runReport','keyBy','SELECT','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','rows','show','length','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','findAll','select','from','MetricId','metric','replace','function','format','groupBy','orderBy','alias','joins','parse','includes','foreignTable','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','left_join','MAX(%s)','GROUP_CONCAT(%s)','IS\x20NULL','IS\x20NOT\x20EMPTY','ValidationErrorItem','DESC','foreignKey','output','web','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run'];(function(_0xe3842c,_0x58d43a){var _0x459df3=function(_0x2ffcf7){while(--_0x2ffcf7){_0xe3842c['push'](_0xe3842c['shift']());}};_0x459df3(++_0x58d43a);}(_0xbed7,0x14b));var _0x7bed=function(_0x56261b,_0x1a71d0){_0x56261b=_0x56261b-0x0;var _0x3b6d6e=_0xbed7[_0x56261b];return _0x3b6d6e;};'use strict';var pdf=require(_0x7bed('0x0'));var emlformat=require(_0x7bed('0x1'));var rimraf=require(_0x7bed('0x2'));var zipdir=require(_0x7bed('0x3'));var jsonpatch=require(_0x7bed('0x4'));var rp=require('request-promise');var moment=require(_0x7bed('0x5'));var BPromise=require(_0x7bed('0x6'));var Mustache=require(_0x7bed('0x7'));var util=require(_0x7bed('0x8'));var path=require(_0x7bed('0x9'));var sox=require(_0x7bed('0xa'));var csv=require(_0x7bed('0xb'));var ejs=require(_0x7bed('0xc'));var fs=require('fs');var _=require(_0x7bed('0xd'));var squel=require('squel');var crypto=require(_0x7bed('0xe'));var jsforce=require(_0x7bed('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7bed('0xb'));var querystring=require(_0x7bed('0x10'));var Papa=require('papaparse');var Redis=require(_0x7bed('0x11'));var authService=require(_0x7bed('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7bed('0x13'));var hardwareService=require(_0x7bed('0x14'));var logger=require(_0x7bed('0x15'))(_0x7bed('0x16'));var utils=require('../../config/utils');var config=require(_0x7bed('0x17'));var db=require(_0x7bed('0x18'))['db'];var dbH=require(_0x7bed('0x18'))[_0x7bed('0x19')];function respondWithStatusCode(_0x3ded9d,_0x1b9809){_0x1b9809=_0x1b9809||0xcc;return function(_0x58e75b){if(_0x58e75b){return _0x3ded9d[_0x7bed('0x1a')](_0x1b9809);}return _0x3ded9d[_0x7bed('0x1b')](_0x1b9809)[_0x7bed('0x1c')]();};}function respondWithResult(_0x3befe2,_0x4aa30e){_0x4aa30e=_0x4aa30e||0xc8;return function(_0x212864){if(_0x212864){return _0x3befe2[_0x7bed('0x1b')](_0x4aa30e)[_0x7bed('0x1d')](_0x212864);}};}function respondWithFilteredResult(_0x274ea8,_0xbd9739){return function(_0x42c965){if(_0x42c965){var _0xf62393=_0x42c965[_0x7bed('0x1e')],_0x5f1952=_0xbd9739[_0x7bed('0x1f')],_0x512e54=_0xbd9739[_0x7bed('0x1f')]+_0xbd9739[_0x7bed('0x20')],_0x220c56;if(_0x512e54>=_0xf62393){_0x512e54=_0xf62393;_0x220c56=0xc8;}else{_0x220c56=0xce;}_0x274ea8[_0x7bed('0x1b')](_0x220c56);return _0x274ea8[_0x7bed('0x21')](_0x7bed('0x22'),_0x5f1952+'-'+_0x512e54+'/'+_0xf62393)[_0x7bed('0x1d')](_0x42c965);}return null;};}function patchUpdates(_0x315607){return function(_0x3c4ea0){try{jsonpatch[_0x7bed('0x23')](_0x3c4ea0,_0x315607,!![]);}catch(_0x4e3988){return BPromise[_0x7bed('0x24')](_0x4e3988);}return _0x3c4ea0[_0x7bed('0x25')]();};}function saveUpdates(_0x916fbe,_0x2ffbb9){return function(_0x203c60){if(_0x203c60){return _0x203c60[_0x7bed('0x26')](_0x916fbe)[_0x7bed('0x27')](function(_0x4640b9){return _0x4640b9;});}return null;};}function removeEntity(_0x3080d6,_0x3a9725){return function(_0xe8d590){if(_0xe8d590){return _0xe8d590[_0x7bed('0x28')]()[_0x7bed('0x27')](function(){var _0x42c63f=_0xe8d590[_0x7bed('0x29')]({'plain':!![]});var _0x5941b5='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x5941b5,'resourceId':_0x42c63f['id']}})[_0x7bed('0x27')](function(){return _0xe8d590;});})['then'](function(){_0x3080d6[_0x7bed('0x1b')](0xcc)[_0x7bed('0x1c')]();});}};}function handleEntityNotFound(_0x221fd3,_0x3c0116){return function(_0x53e281){if(!_0x53e281){_0x221fd3[_0x7bed('0x1a')](0x194);}return _0x53e281;};}function handleError(_0x2e34df,_0x143300){_0x143300=_0x143300||0x1f4;return function(_0x5ac836){logger[_0x7bed('0x2a')](_0x5ac836[_0x7bed('0x2b')]);if(_0x5ac836[_0x7bed('0x2c')]){delete _0x5ac836[_0x7bed('0x2c')];}_0x2e34df['status'](_0x143300)[_0x7bed('0x2d')](_0x5ac836);};}exports[_0x7bed('0x2e')]=function(_0x24c388,_0x4e359a){var _0x9eccbf={},_0x5f498c={},_0x35182f={'count':0x0,'rows':[]};var _0x51b603=_['map'](db['AnalyticCustomReport'][_0x7bed('0x2f')],function(_0x1825ff){return{'name':_0x1825ff['fieldName'],'type':_0x1825ff[_0x7bed('0x30')][_0x7bed('0x31')]};});_0x5f498c[_0x7bed('0x32')]=_['map'](_0x51b603,'name');_0x5f498c[_0x7bed('0x33')]=_[_0x7bed('0x34')](_0x24c388[_0x7bed('0x33')]);_0x5f498c[_0x7bed('0x35')]=_[_0x7bed('0x36')](_0x5f498c[_0x7bed('0x32')],_0x5f498c[_0x7bed('0x33')]);_0x9eccbf[_0x7bed('0x37')]=_[_0x7bed('0x36')](_0x5f498c[_0x7bed('0x32')],qs[_0x7bed('0x38')](_0x24c388[_0x7bed('0x33')][_0x7bed('0x38')]));_0x9eccbf['attributes']=_0x9eccbf[_0x7bed('0x37')]['length']?_0x9eccbf['attributes']:_0x5f498c[_0x7bed('0x32')];if(!_0x24c388[_0x7bed('0x33')][_0x7bed('0x39')](_0x7bed('0x3a'))){_0x9eccbf[_0x7bed('0x20')]=qs['limit'](_0x24c388['query'][_0x7bed('0x20')]);_0x9eccbf[_0x7bed('0x1f')]=qs['offset'](_0x24c388[_0x7bed('0x33')]['offset']);}_0x9eccbf[_0x7bed('0x3b')]=qs[_0x7bed('0x3c')](_0x24c388['query'][_0x7bed('0x3c')]);_0x9eccbf[_0x7bed('0x3d')]=qs[_0x7bed('0x35')](_[_0x7bed('0x3e')](_0x24c388[_0x7bed('0x33')],_0x5f498c[_0x7bed('0x35')]),_0x51b603);if(_0x24c388['query'][_0x7bed('0x3f')]){_0x9eccbf[_0x7bed('0x3d')]=_[_0x7bed('0x40')](_0x9eccbf[_0x7bed('0x3d')],{'$or':_['map'](_0x51b603,function(_0x308160){if(_0x308160[_0x7bed('0x30')]!==_0x7bed('0x41')){var _0x4dcf80={};_0x4dcf80[_0x308160[_0x7bed('0x2c')]]={'$like':'%'+_0x24c388['query'][_0x7bed('0x3f')]+'%'};return _0x4dcf80;}})});}_0x9eccbf=_['merge']({},_0x9eccbf,_0x24c388[_0x7bed('0x42')]);var _0x4dd57f={'where':_0x9eccbf[_0x7bed('0x3d')]};return db['AnalyticCustomReport']['count'](_0x4dd57f)[_0x7bed('0x27')](function(_0x136218){_0x35182f[_0x7bed('0x1e')]=_0x136218;if(_0x24c388[_0x7bed('0x33')]['includeAll']){_0x9eccbf['include']=[{'all':!![]}];}return db[_0x7bed('0x43')]['findAll'](_0x9eccbf);})[_0x7bed('0x27')](function(_0x336c0b){_0x35182f[_0x7bed('0x44')]=_0x336c0b;return _0x35182f;})[_0x7bed('0x27')](respondWithFilteredResult(_0x4e359a,_0x9eccbf))['catch'](handleError(_0x4e359a,null));};exports[_0x7bed('0x45')]=function(_0x48016b,_0x25df83){var _0x3c3cc9={'raw':![],'where':{'id':_0x48016b['params']['id']}},_0x4f2dd5={};_0x4f2dd5[_0x7bed('0x32')]=_['keys'](db[_0x7bed('0x43')][_0x7bed('0x2f')]);_0x4f2dd5['query']=_[_0x7bed('0x34')](_0x48016b[_0x7bed('0x33')]);_0x4f2dd5[_0x7bed('0x35')]=_[_0x7bed('0x36')](_0x4f2dd5[_0x7bed('0x32')],_0x4f2dd5[_0x7bed('0x33')]);_0x3c3cc9['attributes']=_[_0x7bed('0x36')](_0x4f2dd5[_0x7bed('0x32')],qs['fields'](_0x48016b[_0x7bed('0x33')][_0x7bed('0x38')]));_0x3c3cc9[_0x7bed('0x37')]=_0x3c3cc9[_0x7bed('0x37')][_0x7bed('0x46')]?_0x3c3cc9[_0x7bed('0x37')]:_0x4f2dd5[_0x7bed('0x32')];if(_0x48016b['query']['includeAll']){_0x3c3cc9[_0x7bed('0x47')]=[{'all':!![]}];}_0x3c3cc9=_['merge']({},_0x3c3cc9,_0x48016b['options']);return db[_0x7bed('0x43')][_0x7bed('0x48')](_0x3c3cc9)[_0x7bed('0x27')](handleEntityNotFound(_0x25df83,null))[_0x7bed('0x27')](respondWithResult(_0x25df83,null))[_0x7bed('0x49')](handleError(_0x25df83,null));};exports[_0x7bed('0x4a')]=function(_0x20a4c1,_0x4ddcb2){return db[_0x7bed('0x43')]['create'](_0x20a4c1['body'],{})[_0x7bed('0x27')](function(_0x343df3){var _0x3419b0=_0x20a4c1['user']['get']({'plain':!![]});if(!_0x3419b0)throw new Error(_0x7bed('0x4b'));if(_0x3419b0[_0x7bed('0x4c')]===_0x7bed('0x4d')){var _0x49be95=_0x343df3['get']({'plain':!![]});var _0x116bdd=_0x7bed('0x4e');return db[_0x7bed('0x4f')][_0x7bed('0x48')]({'where':{'name':_0x116bdd,'userProfileId':_0x3419b0[_0x7bed('0x50')]},'raw':!![]})[_0x7bed('0x27')](function(_0x5b208c){if(_0x5b208c&&_0x5b208c[_0x7bed('0x51')]===0x0){return db['UserProfileResource'][_0x7bed('0x4a')]({'name':_0x49be95[_0x7bed('0x2c')],'resourceId':_0x49be95['id'],'type':_0x7bed('0x52'),'sectionId':_0x5b208c['id']},{})['then'](function(){return _0x343df3;});}else{return _0x343df3;}})['catch'](function(_0x25f5e7){logger[_0x7bed('0x2a')](_0x7bed('0x53'),_0x25f5e7);throw _0x25f5e7;});}return _0x343df3;})['then'](respondWithResult(_0x4ddcb2,0xc9))[_0x7bed('0x49')](handleError(_0x4ddcb2,null));};exports[_0x7bed('0x26')]=function(_0x1313e7,_0x3464b1){if(_0x1313e7[_0x7bed('0x54')]['id']){delete _0x1313e7[_0x7bed('0x54')]['id'];}return db['AnalyticCustomReport'][_0x7bed('0x48')]({'where':{'id':_0x1313e7['params']['id']}})[_0x7bed('0x27')](handleEntityNotFound(_0x3464b1,null))[_0x7bed('0x27')](saveUpdates(_0x1313e7[_0x7bed('0x54')],null))[_0x7bed('0x27')](respondWithResult(_0x3464b1,null))[_0x7bed('0x49')](handleError(_0x3464b1,null));};exports['destroy']=function(_0x51097d,_0x57350a){return db[_0x7bed('0x43')]['find']({'where':{'id':_0x51097d[_0x7bed('0x55')]['id']}})[_0x7bed('0x27')](handleEntityNotFound(_0x57350a,null))[_0x7bed('0x27')](removeEntity(_0x57350a,null))['catch'](handleError(_0x57350a,null));};exports['preview']=function(_0x5233fb,_0x4a3d8e){var _0x2fcae2=0xa;var _0x67223f=['join','left_join',_0x7bed('0x56'),_0x7bed('0x57')];var _0x36c176={'SUM':_0x7bed('0x58'),'COUNT':_0x7bed('0x59'),'COUNT DISTINCT':_0x7bed('0x5a'),'MAX':'MAX(%s)','MIN':_0x7bed('0x5b'),'AVG':_0x7bed('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7bed('0x5d'),'GROUP_CONCAT DESC':_0x7bed('0x5e')};var _0x5527ac={'SEC_TO_TIME':_0x7bed('0x5f'),'DATE':_0x7bed('0x60'),'HOUR':_0x7bed('0x61'),'ROUND':_0x7bed('0x62'),'UNIX_TIMESTAMP':_0x7bed('0x63')};var _0x30c0a1=function(_0x38e863){return!_['includes'](['IS\x20NULL',_0x7bed('0x64'),_0x7bed('0x65'),'IS\x20NOT\x20EMPTY'],_0x38e863);};var _0x3f92eb=function(_0x59a800){if(!_0x59a800||!_0x59a800[_0x7bed('0x66')]['length']){return'';}for(var _0x57519f='(',_0x550779=0x0;_0x550779<_0x59a800[_0x7bed('0x66')][_0x7bed('0x46')];_0x550779+=0x1){_0x550779>0x0&&(_0x57519f+='\x20'+_0x59a800[_0x7bed('0x67')]+'\x20');_0x57519f+=_0x59a800[_0x7bed('0x66')][_0x550779][_0x7bed('0x68')]?_0x3f92eb(_0x59a800[_0x7bed('0x66')][_0x550779][_0x7bed('0x68')]):_0x59a800[_0x7bed('0x66')][_0x550779][_0x7bed('0x69')]+'\x20'+_0x59a800['rules'][_0x550779][_0x7bed('0x6a')]+(_0x30c0a1(_0x59a800[_0x7bed('0x66')][_0x550779][_0x7bed('0x6a')])?'\x20'+_0x59a800['rules'][_0x550779][_0x7bed('0x6b')]:'');}return _0x57519f+')';};var _0x5bc8a8={'where':{'id':_0x5233fb[_0x7bed('0x55')]['id']}},_0x5d5680,_0x9c60f0,_0x1ab485,_0x565cd0,_0x5db5df;_0x5bc8a8=_[_0x7bed('0x40')]({},_0x5bc8a8,_0x5233fb[_0x7bed('0x42')]);return db['AnalyticCustomReport'][_0x7bed('0x48')](_0x5bc8a8)[_0x7bed('0x27')](function(_0x31f5ad){if(_0x31f5ad){_0x5d5680=_0x31f5ad;return _0x31f5ad[_0x7bed('0x6c')]();}return null;})['then'](function(_0x2d4867){if(_0x2d4867){if(!_0x2d4867[_0x7bed('0x46')]){throw new db[(_0x7bed('0x6d'))]['ValidationErrorItem'](_0x7bed('0x6e'),0x193);}_0x9c60f0=_0x2d4867;return db['AnalyticMetric'][_0x7bed('0x6f')]({'raw':!![]});}return null;})[_0x7bed('0x27')](function(_0x286073){if(_0x286073){_0x1ab485=_['keyBy'](_0x286073,'id');var _0x4530e7;var _0x4f23b2=squel[_0x7bed('0x70')]();_0x4f23b2[_0x7bed('0x71')](_0x5d5680['table']);for(var _0x385b9b=0x0;_0x385b9b<_0x9c60f0['length'];_0x385b9b+=0x1){_0x4530e7=_0x9c60f0[_0x385b9b][_0x7bed('0x72')]?_0x1ab485[_0x9c60f0[_0x385b9b][_0x7bed('0x72')]][_0x7bed('0x73')]:_0x9c60f0[_0x385b9b]['field'];_0x4530e7=_0x9c60f0[_0x385b9b]['function']?_[_0x7bed('0x74')](_0x36c176[_0x9c60f0[_0x385b9b][_0x7bed('0x75')]],'%s',_0x4530e7):_0x4530e7;_0x4530e7=_0x9c60f0[_0x385b9b][_0x7bed('0x76')]?_[_0x7bed('0x74')](_0x5527ac[_0x9c60f0[_0x385b9b][_0x7bed('0x76')]],'%s',_0x4530e7):_0x4530e7;if(_0x9c60f0[_0x385b9b][_0x7bed('0x77')]){_0x4f23b2[_0x7bed('0x68')](_0x4530e7);}_0x9c60f0[_0x385b9b][_0x7bed('0x78')]&&_0x4f23b2['order'](_0x4530e7,_0x9c60f0[_0x385b9b][_0x7bed('0x78')]==='DESC'?![]:!![]);_0x4f23b2['field'](_0x4530e7,_0x9c60f0[_0x385b9b][_0x7bed('0x79')]||_0x4530e7);}if(_0x5d5680[_0x7bed('0x7a')]){_0x5d5680['joins']=JSON[_0x7bed('0x7b')](_0x5d5680[_0x7bed('0x7a')]);for(var _0x4162ad=0x0;_0x4162ad<_0x5d5680[_0x7bed('0x7a')]['length'];_0x4162ad+=0x1){if(_0x5d5680['joins'][_0x4162ad][_0x7bed('0x30')]&&_[_0x7bed('0x7c')](_0x67223f,_0x5d5680[_0x7bed('0x7a')][_0x4162ad][_0x7bed('0x30')])&&_0x5d5680[_0x7bed('0x7a')][_0x4162ad]['parentKey']&&_0x5d5680[_0x7bed('0x7a')][_0x4162ad][_0x7bed('0x7d')]&&_0x5d5680[_0x7bed('0x7a')][_0x4162ad]['foreignKey']){_0x4f23b2[_0x5d5680[_0x7bed('0x7a')][_0x4162ad][_0x7bed('0x30')]](_0x5d5680[_0x7bed('0x7a')][_0x4162ad]['foreignTable'],null,util[_0x7bed('0x76')]('%s.%s\x20=\x20%s.%s',_0x5d5680[_0x7bed('0x7e')],_0x5d5680['joins'][_0x4162ad][_0x7bed('0x7f')],_0x5d5680[_0x7bed('0x7a')][_0x4162ad][_0x7bed('0x7d')],_0x5d5680[_0x7bed('0x7a')][_0x4162ad]['foreignKey']));}}}if(_0x5d5680[_0x7bed('0x80')]){_0x5d5680['conditions']=JSON[_0x7bed('0x7b')](_0x5d5680[_0x7bed('0x80')]);_0x4f23b2['where'](_0x3f92eb(_0x5d5680['conditions'][_0x7bed('0x68')]));}_0x5db5df=_0x4f23b2[_0x7bed('0x81')]();_0x4f23b2[_0x7bed('0x20')](_0x2fcae2);_0x4f23b2['offset'](0x0);logger[_0x7bed('0x82')](_0x7bed('0x83'),_0x4f23b2[_0x7bed('0x84')]());return db[_0x7bed('0x85')][_0x7bed('0x33')](_0x4f23b2[_0x7bed('0x84')](),{'type':db[_0x7bed('0x85')][_0x7bed('0x86')]['SELECT']});}})[_0x7bed('0x27')](respondWithResult(_0x4a3d8e,null))['catch'](handleError(_0x4a3d8e,null));};function runReport(_0x514669,_0x20370a,_0x34a394){var _0x5ecc74=_0x20370a[_0x7bed('0x2c')];var _0x598ce2=0xa;var _0x3b891c=[_0x7bed('0x87'),_0x7bed('0x88'),_0x7bed('0x56'),_0x7bed('0x57')];var _0x17e3b2={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7bed('0x89'),'MIN':_0x7bed('0x5b'),'AVG':_0x7bed('0x5c'),'GROUP_CONCAT':_0x7bed('0x8a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x138b9a={'SEC_TO_TIME':_0x7bed('0x5f'),'DATE':_0x7bed('0x60'),'HOUR':_0x7bed('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7bed('0x63')};var _0x5be7bf=function(_0x285cdf){return!_[_0x7bed('0x7c')]([_0x7bed('0x8b'),_0x7bed('0x64'),_0x7bed('0x65'),_0x7bed('0x8c')],_0x285cdf);};var _0x2b853=function(_0x2a82da){if(!_0x2a82da||!_0x2a82da[_0x7bed('0x66')][_0x7bed('0x46')]){return'';}for(var _0x4c5a5e='(',_0xc34bae=0x0;_0xc34bae<_0x2a82da[_0x7bed('0x66')][_0x7bed('0x46')];_0xc34bae+=0x1){_0xc34bae>0x0&&(_0x4c5a5e+='\x20'+_0x2a82da[_0x7bed('0x67')]+'\x20');_0x4c5a5e+=_0x2a82da[_0x7bed('0x66')][_0xc34bae][_0x7bed('0x68')]?_0x2b853(_0x2a82da[_0x7bed('0x66')][_0xc34bae]['group']):_0x2a82da[_0x7bed('0x66')][_0xc34bae][_0x7bed('0x69')]+'\x20'+_0x2a82da['rules'][_0xc34bae]['condition']+(_0x5be7bf(_0x2a82da[_0x7bed('0x66')][_0xc34bae][_0x7bed('0x6a')])?'\x20'+_0x2a82da['rules'][_0xc34bae]['value']:'');}return _0x4c5a5e+')';};var _0x2679d9={'where':{'id':_0x514669['id']}},_0x5a9133,_0x5e7f23,_0x174489,_0x3f1250,_0x565778;_0x2679d9=_['merge']({},_0x2679d9,_0x34a394);return db[_0x7bed('0x43')][_0x7bed('0x48')](_0x2679d9)['then'](function(_0x125ec4){if(_0x125ec4){_0x5a9133=_0x125ec4;return _0x125ec4[_0x7bed('0x6c')]();}return null;})[_0x7bed('0x27')](function(_0x2dfec2){if(_0x2dfec2){if(!_0x2dfec2[_0x7bed('0x46')]){throw new db[(_0x7bed('0x6d'))][(_0x7bed('0x8d'))](_0x7bed('0x6e'),0x193);}_0x5e7f23=_0x2dfec2;return db['AnalyticMetric'][_0x7bed('0x6f')]({'raw':!![]});}return null;})[_0x7bed('0x27')](function(_0x4447a7){if(_0x4447a7){_0x174489=_['keyBy'](_0x4447a7,'id');var _0x155706;var _0x1c9729=squel[_0x7bed('0x70')]();_0x1c9729[_0x7bed('0x71')](_0x5a9133['table']);for(var _0x3ccfdb=0x0;_0x3ccfdb<_0x5e7f23[_0x7bed('0x46')];_0x3ccfdb+=0x1){_0x155706=_0x5e7f23[_0x3ccfdb][_0x7bed('0x72')]?_0x174489[_0x5e7f23[_0x3ccfdb][_0x7bed('0x72')]][_0x7bed('0x73')]:_0x5e7f23[_0x3ccfdb][_0x7bed('0x69')];_0x155706=_0x5e7f23[_0x3ccfdb]['function']?_[_0x7bed('0x74')](_0x17e3b2[_0x5e7f23[_0x3ccfdb][_0x7bed('0x75')]],'%s',_0x155706):_0x155706;_0x155706=_0x5e7f23[_0x3ccfdb][_0x7bed('0x76')]?_['replace'](_0x138b9a[_0x5e7f23[_0x3ccfdb][_0x7bed('0x76')]],'%s',_0x155706):_0x155706;if(_0x5e7f23[_0x3ccfdb][_0x7bed('0x77')]){_0x1c9729[_0x7bed('0x68')](_0x155706);}_0x5e7f23[_0x3ccfdb]['orderBy']&&_0x1c9729[_0x7bed('0x3b')](_0x155706,_0x5e7f23[_0x3ccfdb][_0x7bed('0x78')]===_0x7bed('0x8e')?![]:!![]);_0x1c9729[_0x7bed('0x69')](_0x155706,_0x5e7f23[_0x3ccfdb]['alias']||_0x155706);}if(_0x5a9133[_0x7bed('0x7a')]){_0x5a9133[_0x7bed('0x7a')]=JSON[_0x7bed('0x7b')](_0x5a9133['joins']);for(var _0xa2ddcb=0x0;_0xa2ddcb<_0x5a9133['joins'][_0x7bed('0x46')];_0xa2ddcb+=0x1){if(_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb]['type']&&_['includes'](_0x3b891c,_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb][_0x7bed('0x30')])&&_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb][_0x7bed('0x7f')]&&_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb][_0x7bed('0x7d')]&&_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb][_0x7bed('0x8f')]){_0x1c9729[_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb]['type']](_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb][_0x7bed('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5a9133[_0x7bed('0x7e')],_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb][_0x7bed('0x7f')],_0x5a9133[_0x7bed('0x7a')][_0xa2ddcb]['foreignTable'],_0x5a9133['joins'][_0xa2ddcb]['foreignKey']));}}}if(_0x5a9133['conditions']){_0x5a9133[_0x7bed('0x80')]=JSON[_0x7bed('0x7b')](_0x5a9133['conditions']);_0x1c9729[_0x7bed('0x3d')](_0x2b853(_0x5a9133['conditions'][_0x7bed('0x68')]));}_0x565778=_0x1c9729[_0x7bed('0x81')]();_0x1c9729['limit'](_0x598ce2);_0x1c9729[_0x7bed('0x1f')](0x0);logger[_0x7bed('0x82')]('Limited\x20Query:',_0x1c9729['toString']());return db[_0x7bed('0x85')][_0x7bed('0x33')](_0x1c9729['toString'](),{'type':db['sequelize'][_0x7bed('0x86')]['SELECT']});}})[_0x7bed('0x27')](function(_0x12bab3){if(!_0x12bab3[_0x7bed('0x46')]){throw new db[(_0x7bed('0x6d'))][(_0x7bed('0x8d'))]('No\x20available\x20data',0xcc);}if(_0x20370a[_0x7bed('0x90')]===_0x7bed('0x91')){return null;}var _0xd08c5a=_[_0x7bed('0x40')](_0x20370a,{'name':_0x20370a['fullPath']||_0x20370a[_0x7bed('0x2c')]||_0x5a9133[_0x7bed('0x2c')],'basename':_0x5ecc74,'savename':util[_0x7bed('0x76')]('%s-%s.%s',_0x20370a[_0x7bed('0x2c')]||_0x5a9133[_0x7bed('0x2c')],require('randomstring')[_0x7bed('0x92')](0x4),_0x20370a[_0x7bed('0x90')]||_0x7bed('0x93')),'reportId':_0x5a9133['id'],'reportType':_0x7bed('0x94')});return db[_0x7bed('0x95')][_0x7bed('0x4a')](_0xd08c5a,{'raw':!![]});})[_0x7bed('0x27')](function(_0x1dcce9){if(_0x5a9133[_0x7bed('0x7e')]==='cdr'){_0x565778[_0x7bed('0x3d')](_0x5a9133['table']+_0x7bed('0x96'),_0x20370a[_0x7bed('0x97')],_0x20370a['endDate']);}else{_0x565778[_0x7bed('0x3d')](_0x5a9133[_0x7bed('0x7e')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x20370a[_0x7bed('0x97')],_0x20370a[_0x7bed('0x98')]);}if(_0x1dcce9){logger['info'](_0x7bed('0x99'),_0x565778[_0x7bed('0x84')]());require(_0x7bed('0x9a'))[_0x7bed('0x9b')](path[_0x7bed('0x87')](__dirname,_0x7bed('0x9c'),_0x1dcce9['output']),[_0x1dcce9['id'],_0x565778['toString'](),path[_0x7bed('0x87')](__dirname,'../../files/reports',_0x1dcce9[_0x7bed('0x9d')]),_0x5ecc74]);return _0x1dcce9;}else{var _0x16211e=squel[_0x7bed('0x70')]();_0x16211e[_0x7bed('0x71')]('('+_0x565778[_0x7bed('0x84')]()+')',_0x7bed('0x9e'));_0x16211e[_0x7bed('0x69')](_0x7bed('0x9f'),_0x7bed('0x1e'));_0x565778[_0x7bed('0x20')](_0x20370a['limit']||_0x598ce2);_0x565778[_0x7bed('0x1f')](_0x20370a['offset']||0x0);return dbH[_0x7bed('0x85')][_0x7bed('0x33')](_0x16211e[_0x7bed('0x84')](),{'type':dbH[_0x7bed('0x85')][_0x7bed('0x86')]['SELECT']})['then'](function(_0x2ad661){if(!_0x2ad661['length']){_0x3f1250=0x0;}else{_0x3f1250=_0x2ad661[0x0][_0x7bed('0x1e')]||0x0;}return dbH[_0x7bed('0x85')][_0x7bed('0x33')](_0x565778[_0x7bed('0x84')](),{'type':dbH[_0x7bed('0x85')][_0x7bed('0x86')]['SELECT']});})[_0x7bed('0x27')](function(_0x5d83f3){return{'rows':_0x5d83f3||[],'count':_0x3f1250};});}});}exports[_0x7bed('0xa0')]=function(_0x3fc453,_0x22a894){return runReport(_0x3fc453['params'],_0x3fc453['query'],_0x3fc453[_0x7bed('0x42')])['then'](respondWithResult(_0x22a894,null))['catch'](handleError(_0x22a894,null));};exports[_0x7bed('0xa1')]=runReport;exports[_0x7bed('0x33')]=function(_0x1338a8,_0x3786ff){var _0xe581f9=0xa;var _0x19cba2=['join',_0x7bed('0x88'),'right_join',_0x7bed('0x57')];var _0x16481c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7bed('0x5b'),'AVG':_0x7bed('0x5c'),'GROUP_CONCAT':_0x7bed('0x8a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7bed('0x5e')};var _0x3c9763={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x7bed('0x60'),'HOUR':_0x7bed('0x61'),'ROUND':_0x7bed('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4451d7=function(_0x3276ce){return!_['includes']([_0x7bed('0x8b'),_0x7bed('0x64'),'IS\x20EMPTY',_0x7bed('0x8c')],_0x3276ce);};var _0xeb021c=function(_0x43b022){if(!_0x43b022||!_0x43b022[_0x7bed('0x66')][_0x7bed('0x46')]){return'';}for(var _0x1f5dde='(',_0x20f6d2=0x0;_0x20f6d2<_0x43b022[_0x7bed('0x66')][_0x7bed('0x46')];_0x20f6d2+=0x1){_0x20f6d2>0x0&&(_0x1f5dde+='\x20'+_0x43b022['operator']+'\x20');_0x1f5dde+=_0x43b022[_0x7bed('0x66')][_0x20f6d2][_0x7bed('0x68')]?_0xeb021c(_0x43b022[_0x7bed('0x66')][_0x20f6d2][_0x7bed('0x68')]):_0x43b022[_0x7bed('0x66')][_0x20f6d2][_0x7bed('0x69')]+'\x20'+_0x43b022[_0x7bed('0x66')][_0x20f6d2][_0x7bed('0x6a')]+(_0x4451d7(_0x43b022['rules'][_0x20f6d2][_0x7bed('0x6a')])?'\x20'+_0x43b022[_0x7bed('0x66')][_0x20f6d2]['value']:'');}return _0x1f5dde+')';};var _0x312a3b={'where':{'id':_0x1338a8[_0x7bed('0x55')]['id']}},_0x5d5da9,_0x36ebde,_0x56196f,_0x2f10df,_0x41494b;_0x312a3b=_[_0x7bed('0x40')]({},_0x312a3b,_0x1338a8[_0x7bed('0x42')]);return db[_0x7bed('0x43')][_0x7bed('0x48')](_0x312a3b)['then'](function(_0xcf6036){if(_0xcf6036){_0x5d5da9=_0xcf6036;return _0xcf6036[_0x7bed('0x6c')]();}return null;})[_0x7bed('0x27')](function(_0x246b03){if(_0x246b03){if(!_0x246b03['length']){throw new db[(_0x7bed('0x6d'))][(_0x7bed('0x8d'))](_0x7bed('0x6e'),0x193);}_0x36ebde=_0x246b03;return db['AnalyticMetric'][_0x7bed('0x6f')]({'raw':!![]});}return null;})['then'](function(_0x1d5ab8){if(_0x1d5ab8){_0x56196f=_[_0x7bed('0xa2')](_0x1d5ab8,'id');var _0x3a7163;var _0x55e416=squel['select']();_0x55e416[_0x7bed('0x71')](_0x5d5da9['table']);for(var _0x5ef90f=0x0;_0x5ef90f<_0x36ebde[_0x7bed('0x46')];_0x5ef90f+=0x1){_0x3a7163=_0x36ebde[_0x5ef90f][_0x7bed('0x72')]?_0x56196f[_0x36ebde[_0x5ef90f][_0x7bed('0x72')]][_0x7bed('0x73')]:_0x36ebde[_0x5ef90f][_0x7bed('0x69')];_0x3a7163=_0x36ebde[_0x5ef90f][_0x7bed('0x75')]?_[_0x7bed('0x74')](_0x16481c[_0x36ebde[_0x5ef90f][_0x7bed('0x75')]],'%s',_0x3a7163):_0x3a7163;_0x3a7163=_0x36ebde[_0x5ef90f]['format']?_[_0x7bed('0x74')](_0x3c9763[_0x36ebde[_0x5ef90f][_0x7bed('0x76')]],'%s',_0x3a7163):_0x3a7163;if(_0x36ebde[_0x5ef90f][_0x7bed('0x77')]){_0x55e416['group'](_0x3a7163);}_0x36ebde[_0x5ef90f][_0x7bed('0x78')]&&_0x55e416[_0x7bed('0x3b')](_0x3a7163,_0x36ebde[_0x5ef90f][_0x7bed('0x78')]==='DESC'?![]:!![]);_0x55e416[_0x7bed('0x69')](_0x3a7163,_0x36ebde[_0x5ef90f][_0x7bed('0x79')]||_0x3a7163);}if(_0x5d5da9['joins']){_0x5d5da9[_0x7bed('0x7a')]=JSON[_0x7bed('0x7b')](_0x5d5da9[_0x7bed('0x7a')]);for(var _0x4e0727=0x0;_0x4e0727<_0x5d5da9[_0x7bed('0x7a')][_0x7bed('0x46')];_0x4e0727+=0x1){if(_0x5d5da9[_0x7bed('0x7a')][_0x4e0727][_0x7bed('0x30')]&&_['includes'](_0x19cba2,_0x5d5da9['joins'][_0x4e0727][_0x7bed('0x30')])&&_0x5d5da9['joins'][_0x4e0727][_0x7bed('0x7f')]&&_0x5d5da9[_0x7bed('0x7a')][_0x4e0727]['foreignTable']&&_0x5d5da9[_0x7bed('0x7a')][_0x4e0727]['foreignKey']){_0x55e416[_0x5d5da9[_0x7bed('0x7a')][_0x4e0727][_0x7bed('0x30')]](_0x5d5da9[_0x7bed('0x7a')][_0x4e0727]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5d5da9[_0x7bed('0x7e')],_0x5d5da9['joins'][_0x4e0727][_0x7bed('0x7f')],_0x5d5da9[_0x7bed('0x7a')][_0x4e0727][_0x7bed('0x7d')],_0x5d5da9[_0x7bed('0x7a')][_0x4e0727]['foreignKey']));}}}if(_0x5d5da9[_0x7bed('0x80')]){_0x5d5da9['conditions']=JSON[_0x7bed('0x7b')](_0x5d5da9[_0x7bed('0x80')]);_0x55e416[_0x7bed('0x3d')](_0xeb021c(_0x5d5da9[_0x7bed('0x80')][_0x7bed('0x68')]));}_0x41494b=_0x55e416[_0x7bed('0x81')]();_0x55e416[_0x7bed('0x20')](_0xe581f9);_0x55e416['offset'](0x0);logger[_0x7bed('0x82')]('Limited\x20Query:',_0x55e416['toString']());return db[_0x7bed('0x85')][_0x7bed('0x33')](_0x55e416['toString'](),{'type':db['sequelize'][_0x7bed('0x86')][_0x7bed('0xa3')]});}})[_0x7bed('0x27')](function(){return{'sql':_0x41494b[_0x7bed('0x84')]()};})['then'](respondWithResult(_0x3786ff,null))['catch'](handleError(_0x3786ff,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 82f472f..c327331 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 _0x3e03=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x2d39a0,_0x2dbeff){var _0x547c89=function(_0x1f6e5b){while(--_0x1f6e5b){_0x2d39a0['push'](_0x2d39a0['shift']());}};_0x547c89(++_0x2dbeff);}(_0x3e03,0x160));var _0x33e0=function(_0x4bb2b9,_0x459c78){_0x4bb2b9=_0x4bb2b9-0x0;var _0x40e2a2=_0x3e03[_0x4bb2b9];return _0x40e2a2;};'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(_0x33e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x33e0('0x6'));var attributes=require(_0x33e0('0x7'));module['exports']=function(_0x5c20a0,_0x48aec2){return _0x5c20a0[_0x33e0('0x8')](_0x33e0('0x9'),attributes,{'tableName':_0x33e0('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e54=['AnalyticCustomReport','analytics_custom_reports','lodash','util','request-promise','path','rimraf','exports','define'];(function(_0x4d5062,_0xb7c15a){var _0x2b7fa5=function(_0xc26c50){while(--_0xc26c50){_0x4d5062['push'](_0x4d5062['shift']());}};_0x2b7fa5(++_0xb7c15a);}(_0x3e54,0x1cd));var _0x43e5=function(_0x34bd64,_0x429807){_0x34bd64=_0x34bd64-0x0;var _0x33089c=_0x3e54[_0x34bd64];return _0x33089c;};'use strict';var _=require(_0x43e5('0x0'));var util=require(_0x43e5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x43e5('0x2'));var fs=require('fs');var path=require(_0x43e5('0x3'));var rimraf=require(_0x43e5('0x4'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x43e5('0x5')]=function(_0x172065,_0x31f922){return _0x172065[_0x43e5('0x6')](_0x43e5('0x7'),attributes,{'tableName':_0x43e5('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 716cb53..896f669 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 _0x0558=['then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x7e557a,_0x3e41ab){var _0x3aba18=function(_0x591db6){while(--_0x591db6){_0x7e557a['push'](_0x7e557a['shift']());}};_0x3aba18(++_0x3e41ab);}(_0x0558,0xa4));var _0x8055=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x0558[_0x7dbd65];return _0x33d551;};'use strict';var _=require(_0x8055('0x0'));var util=require(_0x8055('0x1'));var moment=require(_0x8055('0x2'));var BPromise=require(_0x8055('0x3'));var rs=require(_0x8055('0x4'));var fs=require('fs');var Redis=require(_0x8055('0x5'));var db=require(_0x8055('0x6'))['db'];var utils=require(_0x8055('0x7'));var logger=require(_0x8055('0x8'))(_0x8055('0x9'));var config=require(_0x8055('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32bb1e,_0x542342,_0x1480f2){return new BPromise(function(_0x24120c,_0x75d973){return client[_0x8055('0xb')](_0x32bb1e,_0x1480f2)[_0x8055('0xc')](function(_0x35df56){logger['info'](_0x8055('0xd'),_0x542342,_0x8055('0xe'));logger['debug'](_0x8055('0xf'),_0x542342,_0x8055('0xe'),JSON['stringify'](_0x35df56));if(_0x35df56['error']){if(_0x35df56['error'][_0x8055('0x10')]===0x1f4){logger[_0x8055('0x11')](_0x8055('0xd'),_0x542342,_0x35df56[_0x8055('0x11')][_0x8055('0x12')]);return _0x75d973(_0x35df56[_0x8055('0x11')][_0x8055('0x12')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x542342,_0x35df56['error'][_0x8055('0x12')]);return _0x24120c(_0x35df56[_0x8055('0x11')][_0x8055('0x12')]);}else{logger[_0x8055('0x13')](_0x8055('0xd'),_0x542342,_0x8055('0xe'));_0x24120c(_0x35df56[_0x8055('0x14')][_0x8055('0x12')]);}})[_0x8055('0x15')](function(_0x196fd7){logger['error'](_0x8055('0xd'),_0x542342,_0x196fd7);_0x75d973(_0x196fd7);});});} \ No newline at end of file +var _0x88ea=['http','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x238202,_0x10da07){var _0x217367=function(_0x34f6d0){while(--_0x34f6d0){_0x238202['push'](_0x238202['shift']());}};_0x217367(++_0x10da07);}(_0x88ea,0x113));var _0xa88e=function(_0x3e57df,_0x5f4ce){_0x3e57df=_0x3e57df-0x0;var _0x168972=_0x88ea[_0x3e57df];return _0x168972;};'use strict';var _=require(_0xa88e('0x0'));var util=require(_0xa88e('0x1'));var moment=require(_0xa88e('0x2'));var BPromise=require(_0xa88e('0x3'));var rs=require(_0xa88e('0x4'));var fs=require('fs');var Redis=require(_0xa88e('0x5'));var db=require(_0xa88e('0x6'))['db'];var utils=require(_0xa88e('0x7'));var logger=require('../../config/logger')(_0xa88e('0x8'));var config=require('../../config/environment');var jayson=require(_0xa88e('0x9'));var client=jayson[_0xa88e('0xa')][_0xa88e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e6c40,_0x240ff2,_0x473009){return new BPromise(function(_0x21fe61,_0x207325){return client['request'](_0x5e6c40,_0x473009)['then'](function(_0x32edd0){logger[_0xa88e('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x240ff2,'request\x20sent');logger[_0xa88e('0xd')](_0xa88e('0xe'),_0x240ff2,'request\x20sent',JSON[_0xa88e('0xf')](_0x32edd0));if(_0x32edd0['error']){if(_0x32edd0[_0xa88e('0x10')][_0xa88e('0x11')]===0x1f4){logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x240ff2,_0x32edd0[_0xa88e('0x10')][_0xa88e('0x13')]);return _0x207325(_0x32edd0[_0xa88e('0x10')][_0xa88e('0x13')]);}logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x240ff2,_0x32edd0['error'][_0xa88e('0x13')]);return _0x21fe61(_0x32edd0['error'][_0xa88e('0x13')]);}else{logger[_0xa88e('0xc')](_0xa88e('0x12'),_0x240ff2,'request\x20sent');_0x21fe61(_0x32edd0[_0xa88e('0x14')]['message']);}})[_0xa88e('0x15')](function(_0x4e8d29){logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x240ff2,_0x4e8d29);_0x207325(_0x4e8d29);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8e506d1..29ac85d 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 _0x203d=['index','/:id','show','get','/:id/preview','/:id/run','run','/:id/query','query','create','put','delete','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated'];(function(_0x1f497a,_0x196869){var _0x28b7bf=function(_0x58ba60){while(--_0x58ba60){_0x1f497a['push'](_0x1f497a['shift']());}};_0x28b7bf(++_0x196869);}(_0x203d,0xca));var _0xd203=function(_0x190681,_0x590f58){_0x190681=_0x190681-0x0;var _0x4f2ada=_0x203d[_0x190681];return _0x4f2ada;};'use strict';var multer=require(_0xd203('0x0'));var util=require(_0xd203('0x1'));var path=require(_0xd203('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xd203('0x3'));var interaction=require(_0xd203('0x4'));var config=require(_0xd203('0x5'));var controller=require(_0xd203('0x6'));router['get']('/',auth[_0xd203('0x7')](),controller[_0xd203('0x8')]);router['get'](_0xd203('0x9'),auth[_0xd203('0x7')](),controller[_0xd203('0xa')]);router[_0xd203('0xb')](_0xd203('0xc'),auth[_0xd203('0x7')](),controller['preview']);router[_0xd203('0xb')](_0xd203('0xd'),auth[_0xd203('0x7')](),controller[_0xd203('0xe')]);router[_0xd203('0xb')](_0xd203('0xf'),auth['isAuthenticated'](),controller[_0xd203('0x10')]);router['post']('/',auth[_0xd203('0x7')](),controller[_0xd203('0x11')]);router[_0xd203('0x12')](_0xd203('0x9'),auth[_0xd203('0x7')](),controller['update']);router[_0xd203('0x13')](_0xd203('0x9'),auth[_0xd203('0x7')](),controller['destroy']);module[_0xd203('0x14')]=router; \ No newline at end of file +var _0x54aa=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','preview','run','query','create','update'];(function(_0x2451ae,_0x2ff3a4){var _0x5d6db9=function(_0x1b0200){while(--_0x1b0200){_0x2451ae['push'](_0x2451ae['shift']());}};_0x5d6db9(++_0x2ff3a4);}(_0x54aa,0x1c4));var _0xa54a=function(_0x613e48,_0x498bb8){_0x613e48=_0x613e48-0x0;var _0xe4a3fd=_0x54aa[_0x613e48];return _0xe4a3fd;};'use strict';var multer=require(_0xa54a('0x0'));var util=require(_0xa54a('0x1'));var path=require('path');var timeout=require(_0xa54a('0x2'));var express=require(_0xa54a('0x3'));var router=express[_0xa54a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa54a('0x5'));var config=require('../../config/environment');var controller=require(_0xa54a('0x6'));router[_0xa54a('0x7')]('/',auth[_0xa54a('0x8')](),controller['index']);router[_0xa54a('0x7')](_0xa54a('0x9'),auth[_0xa54a('0x8')](),controller[_0xa54a('0xa')]);router['get']('/:id/preview',auth[_0xa54a('0x8')](),controller[_0xa54a('0xb')]);router[_0xa54a('0x7')]('/:id/run',auth[_0xa54a('0x8')](),controller[_0xa54a('0xc')]);router[_0xa54a('0x7')]('/:id/query',auth['isAuthenticated'](),controller[_0xa54a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa54a('0xe')]);router['put'](_0xa54a('0x9'),auth[_0xa54a('0x8')](),controller[_0xa54a('0xf')]);router['delete'](_0xa54a('0x9'),auth[_0xa54a('0x8')](),controller[_0xa54a('0x10')]);module[_0xa54a('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 5a54d17..07d7f73 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 _0x4ee7=['exports','STRING','TEXT','sequelize'];(function(_0x194911,_0x5bdd71){var _0x855ae5=function(_0x4eef02){while(--_0x4eef02){_0x194911['push'](_0x194911['shift']());}};_0x855ae5(++_0x5bdd71);}(_0x4ee7,0x97));var _0x74ee=function(_0x3c380a,_0x4abb05){_0x3c380a=_0x3c380a-0x0;var _0x2b75cc=_0x4ee7[_0x3c380a];return _0x2b75cc;};'use strict';var Sequelize=require(_0x74ee('0x0'));module[_0x74ee('0x1')]={'name':{'type':Sequelize[_0x74ee('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x74ee('0x2')]},'parent':{'type':Sequelize[_0x74ee('0x2')]},'table':{'type':Sequelize[_0x74ee('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x74ee('0x3')]}}; \ No newline at end of file +var _0xf00f=['TEXT','sequelize','exports','STRING'];(function(_0x8c2c5e,_0x10046d){var _0x28c89e=function(_0x3bcd33){while(--_0x3bcd33){_0x8c2c5e['push'](_0x8c2c5e['shift']());}};_0x28c89e(++_0x10046d);}(_0xf00f,0x1e9));var _0xff00=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xf00f[_0x2ca616];return _0x53155f;};'use strict';var Sequelize=require(_0xff00('0x0'));module[_0xff00('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xff00('0x2')]},'parent':{'type':Sequelize[_0xff00('0x2')]},'table':{'type':Sequelize[_0xff00('0x2')]},'conditions':{'type':Sequelize[_0xff00('0x3')]},'joins':{'type':Sequelize[_0xff00('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index b590ad3..b7b1d5d 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 _0x9527=['randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','HOUR(%s)','ROUND(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','get','DefaultReports','UserProfileResource','then','sendStatus','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','user','role','Reports','userProfileId','body','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','left_join','COUNT(%s)','AVG(%s)','IS\x20NULL','AnalyticMetric','alias','%s.%s\x20=\x20%s.%s','debug','QueryTypes','output','web'];(function(_0x5665be,_0x46b479){var _0x5e7b08=function(_0x3d24bb){while(--_0x3d24bb){_0x5665be['push'](_0x5665be['shift']());}};_0x5e7b08(++_0x46b479);}(_0x9527,0x156));var _0x7952=function(_0x98384f,_0xa4093e){_0x98384f=_0x98384f-0x0;var _0x335843=_0x9527[_0x98384f];return _0x335843;};'use strict';var pdf=require(_0x7952('0x0'));var emlformat=require(_0x7952('0x1'));var rimraf=require(_0x7952('0x2'));var zipdir=require(_0x7952('0x3'));var jsonpatch=require(_0x7952('0x4'));var rp=require(_0x7952('0x5'));var moment=require('moment');var BPromise=require(_0x7952('0x6'));var Mustache=require(_0x7952('0x7'));var util=require('util');var path=require(_0x7952('0x8'));var sox=require(_0x7952('0x9'));var csv=require(_0x7952('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7952('0xb'));var squel=require(_0x7952('0xc'));var crypto=require(_0x7952('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7952('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7952('0xf'));var Papa=require(_0x7952('0x10'));var Redis=require('ioredis');var authService=require(_0x7952('0x11'));var qs=require(_0x7952('0x12'));var as=require(_0x7952('0x13'));var hardwareService=require(_0x7952('0x14'));var logger=require(_0x7952('0x15'))(_0x7952('0x16'));var utils=require(_0x7952('0x17'));var config=require('../../config/environment');var db=require(_0x7952('0x18'))['db'];var dbH=require(_0x7952('0x18'))[_0x7952('0x19')];function respondWithStatusCode(_0x1a1f05,_0x489225){_0x489225=_0x489225||0xcc;return function(_0x4c6729){if(_0x4c6729){return _0x1a1f05['sendStatus'](_0x489225);}return _0x1a1f05[_0x7952('0x1a')](_0x489225)[_0x7952('0x1b')]();};}function respondWithResult(_0xbea160,_0x1afa6f){_0x1afa6f=_0x1afa6f||0xc8;return function(_0x4cfce7){if(_0x4cfce7){return _0xbea160[_0x7952('0x1a')](_0x1afa6f)[_0x7952('0x1c')](_0x4cfce7);}};}function respondWithFilteredResult(_0x5b020f,_0x133c29){return function(_0x215577){if(_0x215577){var _0x4ee070=_0x215577['count'],_0x2808a5=_0x133c29[_0x7952('0x1d')],_0x43a2cb=_0x133c29[_0x7952('0x1d')]+_0x133c29[_0x7952('0x1e')],_0xd2fe0d;if(_0x43a2cb>=_0x4ee070){_0x43a2cb=_0x4ee070;_0xd2fe0d=0xc8;}else{_0xd2fe0d=0xce;}_0x5b020f[_0x7952('0x1a')](_0xd2fe0d);return _0x5b020f['set'](_0x7952('0x1f'),_0x2808a5+'-'+_0x43a2cb+'/'+_0x4ee070)[_0x7952('0x1c')](_0x215577);}return null;};}function patchUpdates(_0x36a3a4){return function(_0x205621){try{jsonpatch[_0x7952('0x20')](_0x205621,_0x36a3a4,!![]);}catch(_0x409eac){return BPromise[_0x7952('0x21')](_0x409eac);}return _0x205621[_0x7952('0x22')]();};}function saveUpdates(_0x314af4,_0x4c28d8){return function(_0x36572b){if(_0x36572b){return _0x36572b[_0x7952('0x23')](_0x314af4)['then'](function(_0x24a5e8){return _0x24a5e8;});}return null;};}function removeEntity(_0x2f6951,_0x134d0a){return function(_0x226479){if(_0x226479){return _0x226479[_0x7952('0x24')]()['then'](function(){var _0x55b4cb=_0x226479[_0x7952('0x25')]({'plain':!![]});var _0x5c1baa=_0x7952('0x26');return db[_0x7952('0x27')]['destroy']({'where':{'type':_0x5c1baa,'resourceId':_0x55b4cb['id']}})[_0x7952('0x28')](function(){return _0x226479;});})[_0x7952('0x28')](function(){_0x2f6951[_0x7952('0x1a')](0xcc)[_0x7952('0x1b')]();});}};}function handleEntityNotFound(_0x2e8e0f,_0x389c7e){return function(_0x782f3d){if(!_0x782f3d){_0x2e8e0f[_0x7952('0x29')](0x194);}return _0x782f3d;};}function handleError(_0x1fa096,_0x854812){_0x854812=_0x854812||0x1f4;return function(_0x3ab341){logger[_0x7952('0x2a')](_0x3ab341[_0x7952('0x2b')]);if(_0x3ab341[_0x7952('0x2c')]){delete _0x3ab341[_0x7952('0x2c')];}_0x1fa096['status'](_0x854812)['send'](_0x3ab341);};}exports[_0x7952('0x2d')]=function(_0x2f945d,_0x55d26f){var _0xf56a1a={},_0x1bb4e2={},_0x51ca93={'count':0x0,'rows':[]};var _0x26ca83=_[_0x7952('0x2e')](db[_0x7952('0x2f')][_0x7952('0x30')],function(_0x4fb57e){return{'name':_0x4fb57e['fieldName'],'type':_0x4fb57e[_0x7952('0x31')][_0x7952('0x32')]};});_0x1bb4e2['model']=_[_0x7952('0x2e')](_0x26ca83,_0x7952('0x2c'));_0x1bb4e2[_0x7952('0x33')]=_[_0x7952('0x34')](_0x2f945d[_0x7952('0x33')]);_0x1bb4e2[_0x7952('0x35')]=_[_0x7952('0x36')](_0x1bb4e2[_0x7952('0x37')],_0x1bb4e2[_0x7952('0x33')]);_0xf56a1a['attributes']=_[_0x7952('0x36')](_0x1bb4e2[_0x7952('0x37')],qs[_0x7952('0x38')](_0x2f945d['query'][_0x7952('0x38')]));_0xf56a1a['attributes']=_0xf56a1a['attributes'][_0x7952('0x39')]?_0xf56a1a[_0x7952('0x3a')]:_0x1bb4e2['model'];if(!_0x2f945d[_0x7952('0x33')][_0x7952('0x3b')](_0x7952('0x3c'))){_0xf56a1a[_0x7952('0x1e')]=qs[_0x7952('0x1e')](_0x2f945d[_0x7952('0x33')][_0x7952('0x1e')]);_0xf56a1a[_0x7952('0x1d')]=qs[_0x7952('0x1d')](_0x2f945d[_0x7952('0x33')][_0x7952('0x1d')]);}_0xf56a1a[_0x7952('0x3d')]=qs['sort'](_0x2f945d['query']['sort']);_0xf56a1a[_0x7952('0x3e')]=qs['filters'](_[_0x7952('0x3f')](_0x2f945d[_0x7952('0x33')],_0x1bb4e2[_0x7952('0x35')]),_0x26ca83);if(_0x2f945d[_0x7952('0x33')][_0x7952('0x40')]){_0xf56a1a[_0x7952('0x3e')]=_[_0x7952('0x41')](_0xf56a1a[_0x7952('0x3e')],{'$or':_[_0x7952('0x2e')](_0x26ca83,function(_0x4a7c0f){if(_0x4a7c0f[_0x7952('0x31')]!==_0x7952('0x42')){var _0x1e6e45={};_0x1e6e45[_0x4a7c0f[_0x7952('0x2c')]]={'$like':'%'+_0x2f945d[_0x7952('0x33')][_0x7952('0x40')]+'%'};return _0x1e6e45;}})});}_0xf56a1a=_['merge']({},_0xf56a1a,_0x2f945d[_0x7952('0x43')]);var _0xf937d6={'where':_0xf56a1a[_0x7952('0x3e')]};return db[_0x7952('0x2f')][_0x7952('0x44')](_0xf937d6)[_0x7952('0x28')](function(_0x3f6ee9){_0x51ca93[_0x7952('0x44')]=_0x3f6ee9;if(_0x2f945d['query']['includeAll']){_0xf56a1a[_0x7952('0x45')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x7952('0x46')](_0xf56a1a);})['then'](function(_0x40d512){_0x51ca93[_0x7952('0x47')]=_0x40d512;return _0x51ca93;})[_0x7952('0x28')](respondWithFilteredResult(_0x55d26f,_0xf56a1a))[_0x7952('0x48')](handleError(_0x55d26f,null));};exports[_0x7952('0x49')]=function(_0x323e45,_0x3ae7e8){var _0x1237ef={'raw':!![],'where':{'id':_0x323e45[_0x7952('0x4a')]['id']}},_0x59d6fc={};_0x59d6fc[_0x7952('0x37')]=_[_0x7952('0x34')](db[_0x7952('0x2f')][_0x7952('0x30')]);_0x59d6fc[_0x7952('0x33')]=_['keys'](_0x323e45[_0x7952('0x33')]);_0x59d6fc[_0x7952('0x35')]=_[_0x7952('0x36')](_0x59d6fc[_0x7952('0x37')],_0x59d6fc[_0x7952('0x33')]);_0x1237ef[_0x7952('0x3a')]=_['intersection'](_0x59d6fc[_0x7952('0x37')],qs[_0x7952('0x38')](_0x323e45['query']['fields']));_0x1237ef[_0x7952('0x3a')]=_0x1237ef[_0x7952('0x3a')][_0x7952('0x39')]?_0x1237ef['attributes']:_0x59d6fc['model'];if(_0x323e45[_0x7952('0x33')][_0x7952('0x4b')]){_0x1237ef[_0x7952('0x45')]=[{'all':!![]}];}_0x1237ef=_['merge']({},_0x1237ef,_0x323e45['options']);return db[_0x7952('0x2f')][_0x7952('0x4c')](_0x1237ef)['then'](handleEntityNotFound(_0x3ae7e8,null))[_0x7952('0x28')](respondWithResult(_0x3ae7e8,null))[_0x7952('0x48')](handleError(_0x3ae7e8,null));};exports[_0x7952('0x4d')]=function(_0x21e1fc,_0x2d4383){return db['AnalyticDefaultReport']['create'](_0x21e1fc['body'],{})[_0x7952('0x28')](function(_0x2adfc1){var _0x30dbb6=_0x21e1fc[_0x7952('0x4e')]['get']({'plain':!![]});if(!_0x30dbb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30dbb6[_0x7952('0x4f')]===_0x7952('0x4e')){var _0x530c5d=_0x2adfc1[_0x7952('0x25')]({'plain':!![]});var _0x2c54c7=_0x7952('0x50');return db['UserProfileSection'][_0x7952('0x4c')]({'where':{'name':_0x2c54c7,'userProfileId':_0x30dbb6[_0x7952('0x51')]},'raw':!![]})[_0x7952('0x28')](function(_0x5df70f){if(_0x5df70f&&_0x5df70f['autoAssociation']===0x0){return db[_0x7952('0x27')][_0x7952('0x4d')]({'name':_0x530c5d[_0x7952('0x2c')],'resourceId':_0x530c5d['id'],'type':'DefaultReports','sectionId':_0x5df70f['id']},{})[_0x7952('0x28')](function(){return _0x2adfc1;});}else{return _0x2adfc1;}})['catch'](function(_0x6775e1){logger[_0x7952('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6775e1);throw _0x6775e1;});}return _0x2adfc1;})[_0x7952('0x28')](respondWithResult(_0x2d4383,0xc9))['catch'](handleError(_0x2d4383,null));};exports[_0x7952('0x23')]=function(_0x2341a5,_0x2979e8){if(_0x2341a5['body']['id']){delete _0x2341a5[_0x7952('0x52')]['id'];}return db[_0x7952('0x2f')][_0x7952('0x4c')]({'where':{'id':_0x2341a5[_0x7952('0x4a')]['id']}})[_0x7952('0x28')](handleEntityNotFound(_0x2979e8,null))[_0x7952('0x28')](saveUpdates(_0x2341a5[_0x7952('0x52')],null))[_0x7952('0x28')](respondWithResult(_0x2979e8,null))[_0x7952('0x48')](handleError(_0x2979e8,null));};exports['destroy']=function(_0x2356c8,_0x5cf7a8){return db['AnalyticDefaultReport'][_0x7952('0x4c')]({'where':{'id':_0x2356c8[_0x7952('0x4a')]['id']}})[_0x7952('0x28')](handleEntityNotFound(_0x5cf7a8,null))[_0x7952('0x28')](removeEntity(_0x5cf7a8,null))['catch'](handleError(_0x5cf7a8,null));};exports['preview']=function(_0x239096,_0x4eebb4){var _0x2d24cd=0xa;var _0x50a947=['join','left_join',_0x7952('0x53'),_0x7952('0x54')];var _0x4ae29a={'SUM':_0x7952('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7952('0x56'),'MAX':_0x7952('0x57'),'MIN':_0x7952('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7952('0x59'),'GROUP_CONCAT ASC':_0x7952('0x5a'),'GROUP_CONCAT DESC':_0x7952('0x5b')};var _0x17a2d2={'SEC_TO_TIME':_0x7952('0x5c'),'DATE':_0x7952('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7952('0x5e')};var _0x48bf80=function(_0x2612d0){return!_['includes'](['IS\x20NULL',_0x7952('0x5f'),_0x7952('0x60'),_0x7952('0x61')],_0x2612d0);};var _0x1760e4=function(_0xfc8cd5){if(!_0xfc8cd5||!_0xfc8cd5[_0x7952('0x62')]['length']){return'';}for(var _0x52ba21='(',_0x2af383=0x0;_0x2af383<_0xfc8cd5[_0x7952('0x62')]['length'];_0x2af383+=0x1){_0x2af383>0x0&&(_0x52ba21+='\x20'+_0xfc8cd5[_0x7952('0x63')]+'\x20');_0x52ba21+=_0xfc8cd5[_0x7952('0x62')][_0x2af383]['group']?_0x1760e4(_0xfc8cd5['rules'][_0x2af383][_0x7952('0x64')]):_0xfc8cd5[_0x7952('0x62')][_0x2af383][_0x7952('0x65')]+'\x20'+_0xfc8cd5[_0x7952('0x62')][_0x2af383][_0x7952('0x66')]+(_0x48bf80(_0xfc8cd5[_0x7952('0x62')][_0x2af383][_0x7952('0x66')])?'\x20'+_0xfc8cd5[_0x7952('0x62')][_0x2af383][_0x7952('0x67')]:'');}return _0x52ba21+')';};var _0x3118a3={'where':{'id':_0x239096[_0x7952('0x4a')]['id']}},_0xd456d1,_0x703244,_0x9b2f6e,_0x537a91,_0x29f059;_0x3118a3=_[_0x7952('0x41')]({},_0x3118a3,_0x239096[_0x7952('0x43')]);return db[_0x7952('0x2f')][_0x7952('0x4c')](_0x3118a3)[_0x7952('0x28')](function(_0x5712f6){if(_0x5712f6){_0xd456d1=_0x5712f6;return _0x5712f6[_0x7952('0x68')]();}return null;})[_0x7952('0x28')](function(_0x323bc3){if(_0x323bc3){if(!_0x323bc3[_0x7952('0x39')]){throw new db[(_0x7952('0x69'))][(_0x7952('0x6a'))](_0x7952('0x6b'),0x193);}_0x703244=_0x323bc3;return db['AnalyticMetric'][_0x7952('0x46')]({'raw':!![]});}return null;})[_0x7952('0x28')](function(_0x13a28a){if(_0x13a28a){_0x9b2f6e=_[_0x7952('0x6c')](_0x13a28a,'id');var _0x354703;var _0x4c457f=squel[_0x7952('0x6d')]();_0x4c457f[_0x7952('0x6e')](_0xd456d1[_0x7952('0x6f')]);for(var _0x3e807c=0x0;_0x3e807c<_0x703244['length'];_0x3e807c+=0x1){_0x354703=_0x703244[_0x3e807c][_0x7952('0x70')]?_0x9b2f6e[_0x703244[_0x3e807c][_0x7952('0x70')]][_0x7952('0x71')]:_0x703244[_0x3e807c][_0x7952('0x65')];_0x354703=_0x703244[_0x3e807c][_0x7952('0x72')]?_[_0x7952('0x73')](_0x4ae29a[_0x703244[_0x3e807c]['function']],'%s',_0x354703):_0x354703;_0x354703=_0x703244[_0x3e807c][_0x7952('0x74')]?_[_0x7952('0x73')](_0x17a2d2[_0x703244[_0x3e807c]['format']],'%s',_0x354703):_0x354703;if(_0x703244[_0x3e807c][_0x7952('0x75')]){_0x4c457f[_0x7952('0x64')](_0x354703);}_0x703244[_0x3e807c][_0x7952('0x76')]&&_0x4c457f[_0x7952('0x3d')](_0x354703,_0x703244[_0x3e807c][_0x7952('0x76')]===_0x7952('0x77')?![]:!![]);_0x4c457f[_0x7952('0x65')](_0x354703,_0x703244[_0x3e807c]['alias']||_0x354703);}if(_0xd456d1[_0x7952('0x78')]){_0xd456d1['joins']=JSON[_0x7952('0x79')](_0xd456d1[_0x7952('0x78')]);for(var _0x4d0549=0x0;_0x4d0549<_0xd456d1['joins'][_0x7952('0x39')];_0x4d0549+=0x1){if(_0xd456d1[_0x7952('0x78')][_0x4d0549]['type']&&_[_0x7952('0x7a')](_0x50a947,_0xd456d1[_0x7952('0x78')][_0x4d0549][_0x7952('0x31')])&&_0xd456d1[_0x7952('0x78')][_0x4d0549][_0x7952('0x7b')]&&_0xd456d1['joins'][_0x4d0549][_0x7952('0x7c')]&&_0xd456d1['joins'][_0x4d0549][_0x7952('0x7d')]){_0x4c457f[_0xd456d1['joins'][_0x4d0549]['type']](_0xd456d1[_0x7952('0x78')][_0x4d0549][_0x7952('0x7c')],null,util[_0x7952('0x74')]('%s.%s\x20=\x20%s.%s',_0xd456d1[_0x7952('0x6f')],_0xd456d1[_0x7952('0x78')][_0x4d0549]['parentKey'],_0xd456d1[_0x7952('0x78')][_0x4d0549][_0x7952('0x7c')],_0xd456d1[_0x7952('0x78')][_0x4d0549][_0x7952('0x7d')]));}}}if(_0xd456d1[_0x7952('0x7e')]){_0xd456d1[_0x7952('0x7e')]=JSON[_0x7952('0x79')](_0xd456d1[_0x7952('0x7e')]);_0x4c457f[_0x7952('0x3e')](_0x1760e4(_0xd456d1[_0x7952('0x7e')][_0x7952('0x64')]));}_0x29f059=_0x4c457f[_0x7952('0x7f')]();_0x4c457f[_0x7952('0x1e')](_0x2d24cd);_0x4c457f[_0x7952('0x1d')](0x0);logger['debug'](_0x7952('0x80'),_0x4c457f[_0x7952('0x81')]());return db[_0x7952('0x82')][_0x7952('0x33')](_0x4c457f['toString'](),{'type':db[_0x7952('0x82')]['QueryTypes'][_0x7952('0x83')]});}})[_0x7952('0x28')](respondWithResult(_0x4eebb4,null))[_0x7952('0x48')](handleError(_0x4eebb4,null));};function runReport(_0x4447f1,_0x40e56,_0x145286){var _0x2d590e=_0x40e56['name'];var _0x34fa29=0xa;var _0x1207ab=[_0x7952('0x84'),_0x7952('0x85'),_0x7952('0x53'),_0x7952('0x54')];var _0x2d8d79={'SUM':'SUM(%s)','COUNT':_0x7952('0x86'),'COUNT DISTINCT':_0x7952('0x56'),'MAX':_0x7952('0x57'),'MIN':'MIN(%s)','AVG':_0x7952('0x87'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7952('0x5b')};var _0x2f627a={'SEC_TO_TIME':_0x7952('0x5c'),'DATE':_0x7952('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7952('0x5e')};var _0x4912f0=function(_0x377f26){return!_[_0x7952('0x7a')]([_0x7952('0x88'),_0x7952('0x5f'),_0x7952('0x60'),'IS\x20NOT\x20EMPTY'],_0x377f26);};var _0x5f128f=function(_0x395b3a){if(!_0x395b3a||!_0x395b3a[_0x7952('0x62')][_0x7952('0x39')]){return'';}for(var _0x5814b6='(',_0x33d818=0x0;_0x33d818<_0x395b3a[_0x7952('0x62')][_0x7952('0x39')];_0x33d818+=0x1){_0x33d818>0x0&&(_0x5814b6+='\x20'+_0x395b3a['operator']+'\x20');_0x5814b6+=_0x395b3a[_0x7952('0x62')][_0x33d818][_0x7952('0x64')]?_0x5f128f(_0x395b3a['rules'][_0x33d818]['group']):_0x395b3a[_0x7952('0x62')][_0x33d818][_0x7952('0x65')]+'\x20'+_0x395b3a[_0x7952('0x62')][_0x33d818][_0x7952('0x66')]+(_0x4912f0(_0x395b3a[_0x7952('0x62')][_0x33d818][_0x7952('0x66')])?'\x20'+_0x395b3a[_0x7952('0x62')][_0x33d818][_0x7952('0x67')]:'');}return _0x5814b6+')';};var _0x28f2c9={'where':{'id':_0x4447f1['id']}},_0x539314,_0x4ac53a,_0x19c419,_0x375053,_0x1f60ae;_0x28f2c9=_[_0x7952('0x41')]({},_0x28f2c9,_0x145286);return db[_0x7952('0x2f')]['find'](_0x28f2c9)[_0x7952('0x28')](function(_0x4262a7){if(_0x4262a7){_0x539314=_0x4262a7;return _0x4262a7['getFields']();}return null;})['then'](function(_0x1056ac){if(_0x1056ac){if(!_0x1056ac[_0x7952('0x39')]){throw new db[(_0x7952('0x69'))]['ValidationErrorItem'](_0x7952('0x6b'),0x193);}_0x4ac53a=_0x1056ac;return db[_0x7952('0x89')]['findAll']({'raw':!![]});}return null;})[_0x7952('0x28')](function(_0x39123c){if(_0x39123c){_0x19c419=_['keyBy'](_0x39123c,'id');var _0x58aef5;var _0x3d4508=squel[_0x7952('0x6d')]();_0x3d4508[_0x7952('0x6e')](_0x539314[_0x7952('0x6f')]);for(var _0x3267d7=0x0;_0x3267d7<_0x4ac53a[_0x7952('0x39')];_0x3267d7+=0x1){_0x58aef5=_0x4ac53a[_0x3267d7][_0x7952('0x70')]?_0x19c419[_0x4ac53a[_0x3267d7][_0x7952('0x70')]][_0x7952('0x71')]:_0x4ac53a[_0x3267d7][_0x7952('0x65')];_0x58aef5=_0x4ac53a[_0x3267d7][_0x7952('0x72')]?_[_0x7952('0x73')](_0x2d8d79[_0x4ac53a[_0x3267d7]['function']],'%s',_0x58aef5):_0x58aef5;_0x58aef5=_0x4ac53a[_0x3267d7]['format']?_[_0x7952('0x73')](_0x2f627a[_0x4ac53a[_0x3267d7][_0x7952('0x74')]],'%s',_0x58aef5):_0x58aef5;if(_0x4ac53a[_0x3267d7][_0x7952('0x75')]){_0x3d4508['group'](_0x58aef5);}_0x4ac53a[_0x3267d7][_0x7952('0x76')]&&_0x3d4508[_0x7952('0x3d')](_0x58aef5,_0x4ac53a[_0x3267d7][_0x7952('0x76')]==='DESC'?![]:!![]);_0x3d4508[_0x7952('0x65')](_0x58aef5,_0x4ac53a[_0x3267d7][_0x7952('0x8a')]||_0x58aef5);}if(_0x539314['joins']){_0x539314[_0x7952('0x78')]=JSON[_0x7952('0x79')](_0x539314['joins']);for(var _0x3f1982=0x0;_0x3f1982<_0x539314['joins']['length'];_0x3f1982+=0x1){if(_0x539314[_0x7952('0x78')][_0x3f1982][_0x7952('0x31')]&&_[_0x7952('0x7a')](_0x1207ab,_0x539314[_0x7952('0x78')][_0x3f1982][_0x7952('0x31')])&&_0x539314[_0x7952('0x78')][_0x3f1982]['parentKey']&&_0x539314[_0x7952('0x78')][_0x3f1982]['foreignTable']&&_0x539314['joins'][_0x3f1982][_0x7952('0x7d')]){_0x3d4508[_0x539314[_0x7952('0x78')][_0x3f1982]['type']](_0x539314['joins'][_0x3f1982][_0x7952('0x7c')],null,util[_0x7952('0x74')](_0x7952('0x8b'),_0x539314[_0x7952('0x6f')],_0x539314[_0x7952('0x78')][_0x3f1982][_0x7952('0x7b')],_0x539314[_0x7952('0x78')][_0x3f1982]['foreignTable'],_0x539314[_0x7952('0x78')][_0x3f1982]['foreignKey']));}}}if(_0x539314[_0x7952('0x7e')]){_0x539314['conditions']=JSON['parse'](_0x539314[_0x7952('0x7e')]);_0x3d4508[_0x7952('0x3e')](_0x5f128f(_0x539314[_0x7952('0x7e')][_0x7952('0x64')]));}_0x1f60ae=_0x3d4508[_0x7952('0x7f')]();_0x3d4508[_0x7952('0x1e')](_0x34fa29);_0x3d4508[_0x7952('0x1d')](0x0);logger[_0x7952('0x8c')](_0x7952('0x80'),_0x3d4508[_0x7952('0x81')]());return db[_0x7952('0x82')][_0x7952('0x33')](_0x3d4508['toString'](),{'type':db[_0x7952('0x82')][_0x7952('0x8d')][_0x7952('0x83')]});}})['then'](function(_0xa3afec){if(!_0xa3afec[_0x7952('0x39')]){throw new db[(_0x7952('0x69'))][(_0x7952('0x6a'))]('No\x20available\x20data',0xcc);}if(_0x40e56[_0x7952('0x8e')]===_0x7952('0x8f')){return null;}var _0x81c93=_[_0x7952('0x41')](_0x40e56,{'name':_0x40e56['fullPath']||_0x40e56[_0x7952('0x2c')]||_0x539314[_0x7952('0x2c')],'basename':_0x2d590e,'savename':util[_0x7952('0x74')]('%s-%s.%s',_0x40e56[_0x7952('0x2c')]||_0x539314['name'],require(_0x7952('0x90'))['generate'](0x4),_0x40e56['output']||_0x7952('0x91')),'reportId':_0x539314['id'],'reportType':_0x7952('0x92')});return db[_0x7952('0x93')]['create'](_0x81c93,{'raw':!![]});})['then'](function(_0x447f57){if(_0x539314['table']===_0x7952('0x94')){_0x1f60ae['where'](_0x539314[_0x7952('0x6f')]+_0x7952('0x95'),_0x40e56['startDate'],_0x40e56[_0x7952('0x96')]);}else{_0x1f60ae['where'](_0x539314[_0x7952('0x6f')]+_0x7952('0x97'),_0x40e56['startDate'],_0x40e56[_0x7952('0x96')]);}if(_0x447f57){logger[_0x7952('0x98')](_0x7952('0x99'),_0x1f60ae[_0x7952('0x81')]());require('child_process')['fork'](path[_0x7952('0x84')](__dirname,_0x7952('0x9a'),_0x447f57['output']),[_0x447f57['id'],_0x1f60ae['toString'](),path[_0x7952('0x84')](__dirname,_0x7952('0x9b'),_0x447f57[_0x7952('0x9c')]),_0x2d590e]);return _0x447f57;}else{var _0x13b91b=squel[_0x7952('0x6d')]();_0x13b91b[_0x7952('0x6e')]('('+_0x1f60ae[_0x7952('0x81')]()+')',_0x7952('0x9d'));_0x13b91b['field'](_0x7952('0x9e'),_0x7952('0x44'));_0x1f60ae[_0x7952('0x1e')](_0x40e56[_0x7952('0x1e')]||_0x34fa29);_0x1f60ae[_0x7952('0x1d')](_0x40e56['offset']||0x0);return dbH[_0x7952('0x82')][_0x7952('0x33')](_0x13b91b[_0x7952('0x81')](),{'type':dbH[_0x7952('0x82')][_0x7952('0x8d')]['SELECT']})['then'](function(_0x3a8260){if(!_0x3a8260[_0x7952('0x39')]){_0x375053=0x0;}else{_0x375053=_0x3a8260[0x0]['count']||0x0;}return dbH[_0x7952('0x82')]['query'](_0x1f60ae[_0x7952('0x81')](),{'type':dbH['sequelize'][_0x7952('0x8d')][_0x7952('0x83')]});})['then'](function(_0x17172d){return{'rows':_0x17172d||[],'count':_0x375053};});}});}exports[_0x7952('0x9f')]=function(_0x523294,_0x55adaa){return runReport(_0x523294[_0x7952('0x4a')],_0x523294['query'],_0x523294[_0x7952('0x43')])['then'](respondWithResult(_0x55adaa,null))[_0x7952('0x48')](handleError(_0x55adaa,null));};exports['runReport']=runReport;exports[_0x7952('0x33')]=function(_0x4ce545,_0x2687a0){var _0x1a0cea=0xa;var _0x3b83b8=[_0x7952('0x84'),_0x7952('0x85'),_0x7952('0x53'),_0x7952('0x54')];var _0x4aac12={'SUM':_0x7952('0x55'),'COUNT':_0x7952('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7952('0x57'),'MIN':_0x7952('0x58'),'AVG':_0x7952('0x87'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7952('0x5b')};var _0x49eb0e={'SEC_TO_TIME':_0x7952('0x5c'),'DATE':'DATE(%s)','HOUR':_0x7952('0xa0'),'ROUND':_0x7952('0xa1'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x184dd8=function(_0x167a98){return!_[_0x7952('0x7a')]([_0x7952('0x88'),'IS\x20NOT\x20NULL',_0x7952('0x60'),_0x7952('0x61')],_0x167a98);};var _0x45ad6f=function(_0x20bb21){if(!_0x20bb21||!_0x20bb21[_0x7952('0x62')][_0x7952('0x39')]){return'';}for(var _0x442f4e='(',_0x4732fb=0x0;_0x4732fb<_0x20bb21[_0x7952('0x62')][_0x7952('0x39')];_0x4732fb+=0x1){_0x4732fb>0x0&&(_0x442f4e+='\x20'+_0x20bb21[_0x7952('0x63')]+'\x20');_0x442f4e+=_0x20bb21[_0x7952('0x62')][_0x4732fb][_0x7952('0x64')]?_0x45ad6f(_0x20bb21[_0x7952('0x62')][_0x4732fb]['group']):_0x20bb21[_0x7952('0x62')][_0x4732fb][_0x7952('0x65')]+'\x20'+_0x20bb21[_0x7952('0x62')][_0x4732fb][_0x7952('0x66')]+(_0x184dd8(_0x20bb21[_0x7952('0x62')][_0x4732fb]['condition'])?'\x20'+_0x20bb21[_0x7952('0x62')][_0x4732fb][_0x7952('0x67')]:'');}return _0x442f4e+')';};var _0x5151f9={'where':{'id':_0x4ce545[_0x7952('0x4a')]['id']}},_0x537871,_0xeaf1b2,_0x54c1ed,_0x3c9100,_0x47c995;_0x5151f9=_['merge']({},_0x5151f9,_0x4ce545[_0x7952('0x43')]);return db[_0x7952('0x2f')]['find'](_0x5151f9)['then'](function(_0x144c6b){if(_0x144c6b){_0x537871=_0x144c6b;return _0x144c6b[_0x7952('0x68')]();}return null;})[_0x7952('0x28')](function(_0x2ff9d1){if(_0x2ff9d1){if(!_0x2ff9d1[_0x7952('0x39')]){throw new db[(_0x7952('0x69'))][(_0x7952('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xeaf1b2=_0x2ff9d1;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0xd4fc27){if(_0xd4fc27){_0x54c1ed=_[_0x7952('0x6c')](_0xd4fc27,'id');var _0x130213;var _0xefe95d=squel['select']();_0xefe95d[_0x7952('0x6e')](_0x537871[_0x7952('0x6f')]);for(var _0x4735ca=0x0;_0x4735ca<_0xeaf1b2[_0x7952('0x39')];_0x4735ca+=0x1){_0x130213=_0xeaf1b2[_0x4735ca][_0x7952('0x70')]?_0x54c1ed[_0xeaf1b2[_0x4735ca][_0x7952('0x70')]][_0x7952('0x71')]:_0xeaf1b2[_0x4735ca][_0x7952('0x65')];_0x130213=_0xeaf1b2[_0x4735ca][_0x7952('0x72')]?_[_0x7952('0x73')](_0x4aac12[_0xeaf1b2[_0x4735ca][_0x7952('0x72')]],'%s',_0x130213):_0x130213;_0x130213=_0xeaf1b2[_0x4735ca]['format']?_['replace'](_0x49eb0e[_0xeaf1b2[_0x4735ca][_0x7952('0x74')]],'%s',_0x130213):_0x130213;if(_0xeaf1b2[_0x4735ca][_0x7952('0x75')]){_0xefe95d[_0x7952('0x64')](_0x130213);}_0xeaf1b2[_0x4735ca][_0x7952('0x76')]&&_0xefe95d['order'](_0x130213,_0xeaf1b2[_0x4735ca][_0x7952('0x76')]===_0x7952('0x77')?![]:!![]);_0xefe95d[_0x7952('0x65')](_0x130213,_0xeaf1b2[_0x4735ca][_0x7952('0x8a')]||_0x130213);}if(_0x537871[_0x7952('0x78')]){_0x537871[_0x7952('0x78')]=JSON[_0x7952('0x79')](_0x537871[_0x7952('0x78')]);for(var _0x377fee=0x0;_0x377fee<_0x537871[_0x7952('0x78')][_0x7952('0x39')];_0x377fee+=0x1){if(_0x537871[_0x7952('0x78')][_0x377fee][_0x7952('0x31')]&&_[_0x7952('0x7a')](_0x3b83b8,_0x537871[_0x7952('0x78')][_0x377fee][_0x7952('0x31')])&&_0x537871[_0x7952('0x78')][_0x377fee][_0x7952('0x7b')]&&_0x537871[_0x7952('0x78')][_0x377fee][_0x7952('0x7c')]&&_0x537871[_0x7952('0x78')][_0x377fee]['foreignKey']){_0xefe95d[_0x537871[_0x7952('0x78')][_0x377fee]['type']](_0x537871[_0x7952('0x78')][_0x377fee]['foreignTable'],null,util['format'](_0x7952('0x8b'),_0x537871[_0x7952('0x6f')],_0x537871[_0x7952('0x78')][_0x377fee]['parentKey'],_0x537871['joins'][_0x377fee][_0x7952('0x7c')],_0x537871['joins'][_0x377fee][_0x7952('0x7d')]));}}}if(_0x537871['conditions']){_0x537871[_0x7952('0x7e')]=JSON[_0x7952('0x79')](_0x537871['conditions']);_0xefe95d[_0x7952('0x3e')](_0x45ad6f(_0x537871[_0x7952('0x7e')]['group']));}_0x47c995=_0xefe95d[_0x7952('0x7f')]();_0xefe95d['limit'](_0x1a0cea);_0xefe95d[_0x7952('0x1d')](0x0);logger['debug']('Limited\x20Query:',_0xefe95d['toString']());return db[_0x7952('0x82')][_0x7952('0x33')](_0xefe95d[_0x7952('0x81')](),{'type':db[_0x7952('0x82')][_0x7952('0x8d')][_0x7952('0x83')]});}})[_0x7952('0x28')](function(){return{'sql':_0x47c995['toString']()};})[_0x7952('0x28')](respondWithResult(_0x2687a0,null))[_0x7952('0x48')](handleError(_0x2687a0,null));}; \ No newline at end of file +var _0xe58c=['fields','length','nolimit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','params','include','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','find','autoAssociation','UserProfileResource','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','field','replace','function','format','groupBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','metric','orderBy','No\x20available\x20data','output','web','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','../../files/reports','from','countTable','COUNT(*)','runReport','%s.%s\x20=\x20%s.%s','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','dbH','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','status','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','attributes','intersection'];(function(_0x2467b2,_0xfed971){var _0x2eac26=function(_0x1fa95f){while(--_0x1fa95f){_0x2467b2['push'](_0x2467b2['shift']());}};_0x2eac26(++_0xfed971);}(_0xe58c,0x6c));var _0xce58=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xe58c[_0x556927];return _0x5f1235;};'use strict';var pdf=require(_0xce58('0x0'));var emlformat=require(_0xce58('0x1'));var rimraf=require(_0xce58('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce58('0x3'));var moment=require(_0xce58('0x4'));var BPromise=require(_0xce58('0x5'));var Mustache=require(_0xce58('0x6'));var util=require(_0xce58('0x7'));var path=require(_0xce58('0x8'));var sox=require(_0xce58('0x9'));var csv=require(_0xce58('0xa'));var ejs=require(_0xce58('0xb'));var fs=require('fs');var _=require(_0xce58('0xc'));var squel=require('squel');var crypto=require(_0xce58('0xd'));var jsforce=require(_0xce58('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xce58('0xa'));var querystring=require(_0xce58('0xf'));var Papa=require(_0xce58('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce58('0x11'));var as=require(_0xce58('0x12'));var hardwareService=require(_0xce58('0x13'));var logger=require('../../config/logger')(_0xce58('0x14'));var utils=require('../../config/utils');var config=require(_0xce58('0x15'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xce58('0x16')];function respondWithStatusCode(_0xea8063,_0x59fb0b){_0x59fb0b=_0x59fb0b||0xcc;return function(_0x38df66){if(_0x38df66){return _0xea8063['sendStatus'](_0x59fb0b);}return _0xea8063['status'](_0x59fb0b)[_0xce58('0x17')]();};}function respondWithResult(_0x364edb,_0x1979fb){_0x1979fb=_0x1979fb||0xc8;return function(_0x252218){if(_0x252218){return _0x364edb['status'](_0x1979fb)[_0xce58('0x18')](_0x252218);}};}function respondWithFilteredResult(_0xd87f9f,_0x3c185f){return function(_0xfc6378){if(_0xfc6378){var _0x1a10b8=_0xfc6378[_0xce58('0x19')],_0x4d71f2=_0x3c185f[_0xce58('0x1a')],_0xb2c28=_0x3c185f['offset']+_0x3c185f[_0xce58('0x1b')],_0x5b16e8;if(_0xb2c28>=_0x1a10b8){_0xb2c28=_0x1a10b8;_0x5b16e8=0xc8;}else{_0x5b16e8=0xce;}_0xd87f9f['status'](_0x5b16e8);return _0xd87f9f[_0xce58('0x1c')](_0xce58('0x1d'),_0x4d71f2+'-'+_0xb2c28+'/'+_0x1a10b8)[_0xce58('0x18')](_0xfc6378);}return null;};}function patchUpdates(_0xb69c59){return function(_0x62416){try{jsonpatch['apply'](_0x62416,_0xb69c59,!![]);}catch(_0x256228){return BPromise[_0xce58('0x1e')](_0x256228);}return _0x62416['save']();};}function saveUpdates(_0x38dda1,_0x51e9f7){return function(_0x3e2337){if(_0x3e2337){return _0x3e2337[_0xce58('0x1f')](_0x38dda1)['then'](function(_0x13c542){return _0x13c542;});}return null;};}function removeEntity(_0x4fadcb,_0x340a06){return function(_0x53170b){if(_0x53170b){return _0x53170b[_0xce58('0x20')]()[_0xce58('0x21')](function(){var _0x2600c3=_0x53170b['get']({'plain':!![]});var _0xde874='DefaultReports';return db['UserProfileResource'][_0xce58('0x20')]({'where':{'type':_0xde874,'resourceId':_0x2600c3['id']}})['then'](function(){return _0x53170b;});})[_0xce58('0x21')](function(){_0x4fadcb[_0xce58('0x22')](0xcc)[_0xce58('0x17')]();});}};}function handleEntityNotFound(_0x447a6b,_0x17aafb){return function(_0x3ca801){if(!_0x3ca801){_0x447a6b['sendStatus'](0x194);}return _0x3ca801;};}function handleError(_0x3f0bb8,_0x3317f7){_0x3317f7=_0x3317f7||0x1f4;return function(_0x1f8d2d){logger[_0xce58('0x23')](_0x1f8d2d[_0xce58('0x24')]);if(_0x1f8d2d[_0xce58('0x25')]){delete _0x1f8d2d['name'];}_0x3f0bb8[_0xce58('0x22')](_0x3317f7)['send'](_0x1f8d2d);};}exports[_0xce58('0x26')]=function(_0x4c035b,_0x14827e){var _0x4fb6eb={},_0x5f3062={},_0x40adf0={'count':0x0,'rows':[]};var _0x58b62d=_[_0xce58('0x27')](db[_0xce58('0x28')][_0xce58('0x29')],function(_0x2e32e3){return{'name':_0x2e32e3['fieldName'],'type':_0x2e32e3[_0xce58('0x2a')][_0xce58('0x2b')]};});_0x5f3062[_0xce58('0x2c')]=_['map'](_0x58b62d,_0xce58('0x25'));_0x5f3062[_0xce58('0x2d')]=_[_0xce58('0x2e')](_0x4c035b[_0xce58('0x2d')]);_0x5f3062['filters']=_['intersection'](_0x5f3062[_0xce58('0x2c')],_0x5f3062['query']);_0x4fb6eb[_0xce58('0x2f')]=_[_0xce58('0x30')](_0x5f3062[_0xce58('0x2c')],qs[_0xce58('0x31')](_0x4c035b[_0xce58('0x2d')][_0xce58('0x31')]));_0x4fb6eb[_0xce58('0x2f')]=_0x4fb6eb[_0xce58('0x2f')][_0xce58('0x32')]?_0x4fb6eb[_0xce58('0x2f')]:_0x5f3062[_0xce58('0x2c')];if(!_0x4c035b[_0xce58('0x2d')]['hasOwnProperty'](_0xce58('0x33'))){_0x4fb6eb[_0xce58('0x1b')]=qs[_0xce58('0x1b')](_0x4c035b['query']['limit']);_0x4fb6eb[_0xce58('0x1a')]=qs[_0xce58('0x1a')](_0x4c035b[_0xce58('0x2d')][_0xce58('0x1a')]);}_0x4fb6eb[_0xce58('0x34')]=qs['sort'](_0x4c035b[_0xce58('0x2d')][_0xce58('0x35')]);_0x4fb6eb['where']=qs['filters'](_[_0xce58('0x36')](_0x4c035b[_0xce58('0x2d')],_0x5f3062[_0xce58('0x37')]),_0x58b62d);if(_0x4c035b[_0xce58('0x2d')][_0xce58('0x38')]){_0x4fb6eb['where']=_[_0xce58('0x39')](_0x4fb6eb[_0xce58('0x3a')],{'$or':_[_0xce58('0x27')](_0x58b62d,function(_0x3ee7c2){if(_0x3ee7c2[_0xce58('0x2a')]!==_0xce58('0x3b')){var _0x5dc990={};_0x5dc990[_0x3ee7c2['name']]={'$like':'%'+_0x4c035b['query'][_0xce58('0x38')]+'%'};return _0x5dc990;}})});}_0x4fb6eb=_[_0xce58('0x39')]({},_0x4fb6eb,_0x4c035b[_0xce58('0x3c')]);var _0x269fdc={'where':_0x4fb6eb[_0xce58('0x3a')]};return db[_0xce58('0x28')]['count'](_0x269fdc)[_0xce58('0x21')](function(_0x5bef85){_0x40adf0[_0xce58('0x19')]=_0x5bef85;if(_0x4c035b[_0xce58('0x2d')][_0xce58('0x3d')]){_0x4fb6eb['include']=[{'all':!![]}];}return db[_0xce58('0x28')][_0xce58('0x3e')](_0x4fb6eb);})[_0xce58('0x21')](function(_0x541c69){_0x40adf0['rows']=_0x541c69;return _0x40adf0;})['then'](respondWithFilteredResult(_0x14827e,_0x4fb6eb))['catch'](handleError(_0x14827e,null));};exports[_0xce58('0x3f')]=function(_0x532544,_0x55ac1e){var _0x27aa96={'raw':!![],'where':{'id':_0x532544[_0xce58('0x40')]['id']}},_0x5e782b={};_0x5e782b[_0xce58('0x2c')]=_['keys'](db[_0xce58('0x28')][_0xce58('0x29')]);_0x5e782b[_0xce58('0x2d')]=_[_0xce58('0x2e')](_0x532544[_0xce58('0x2d')]);_0x5e782b[_0xce58('0x37')]=_[_0xce58('0x30')](_0x5e782b[_0xce58('0x2c')],_0x5e782b[_0xce58('0x2d')]);_0x27aa96['attributes']=_[_0xce58('0x30')](_0x5e782b[_0xce58('0x2c')],qs['fields'](_0x532544['query']['fields']));_0x27aa96[_0xce58('0x2f')]=_0x27aa96[_0xce58('0x2f')][_0xce58('0x32')]?_0x27aa96[_0xce58('0x2f')]:_0x5e782b[_0xce58('0x2c')];if(_0x532544[_0xce58('0x2d')][_0xce58('0x3d')]){_0x27aa96[_0xce58('0x41')]=[{'all':!![]}];}_0x27aa96=_['merge']({},_0x27aa96,_0x532544[_0xce58('0x3c')]);return db[_0xce58('0x28')]['find'](_0x27aa96)[_0xce58('0x21')](handleEntityNotFound(_0x55ac1e,null))['then'](respondWithResult(_0x55ac1e,null))[_0xce58('0x42')](handleError(_0x55ac1e,null));};exports[_0xce58('0x43')]=function(_0x568f47,_0x138c89){return db[_0xce58('0x28')][_0xce58('0x43')](_0x568f47[_0xce58('0x44')],{})['then'](function(_0x2e21e9){var _0x5664ae=_0x568f47['user'][_0xce58('0x45')]({'plain':!![]});if(!_0x5664ae)throw new Error(_0xce58('0x46'));if(_0x5664ae[_0xce58('0x47')]===_0xce58('0x48')){var _0xb125e=_0x2e21e9[_0xce58('0x45')]({'plain':!![]});var _0x4c95a9=_0xce58('0x49');return db[_0xce58('0x4a')][_0xce58('0x4b')]({'where':{'name':_0x4c95a9,'userProfileId':_0x5664ae['userProfileId']},'raw':!![]})['then'](function(_0x27b85e){if(_0x27b85e&&_0x27b85e[_0xce58('0x4c')]===0x0){return db[_0xce58('0x4d')][_0xce58('0x43')]({'name':_0xb125e['name'],'resourceId':_0xb125e['id'],'type':_0xce58('0x4e'),'sectionId':_0x27b85e['id']},{})[_0xce58('0x21')](function(){return _0x2e21e9;});}else{return _0x2e21e9;}})[_0xce58('0x42')](function(_0x10854b){logger['error'](_0xce58('0x4f'),_0x10854b);throw _0x10854b;});}return _0x2e21e9;})[_0xce58('0x21')](respondWithResult(_0x138c89,0xc9))[_0xce58('0x42')](handleError(_0x138c89,null));};exports[_0xce58('0x1f')]=function(_0x1c467f,_0x1cefa2){if(_0x1c467f[_0xce58('0x44')]['id']){delete _0x1c467f[_0xce58('0x44')]['id'];}return db['AnalyticDefaultReport'][_0xce58('0x4b')]({'where':{'id':_0x1c467f['params']['id']}})['then'](handleEntityNotFound(_0x1cefa2,null))[_0xce58('0x21')](saveUpdates(_0x1c467f[_0xce58('0x44')],null))['then'](respondWithResult(_0x1cefa2,null))[_0xce58('0x42')](handleError(_0x1cefa2,null));};exports['destroy']=function(_0x46c586,_0x218bfc){return db[_0xce58('0x28')][_0xce58('0x4b')]({'where':{'id':_0x46c586[_0xce58('0x40')]['id']}})[_0xce58('0x21')](handleEntityNotFound(_0x218bfc,null))[_0xce58('0x21')](removeEntity(_0x218bfc,null))[_0xce58('0x42')](handleError(_0x218bfc,null));};exports[_0xce58('0x50')]=function(_0x499dd1,_0x4f146e){var _0x6839d7=0xa;var _0x26fb9e=[_0xce58('0x51'),_0xce58('0x52'),_0xce58('0x53'),_0xce58('0x54')];var _0x179098={'SUM':'SUM(%s)','COUNT':_0xce58('0x55'),'COUNT DISTINCT':_0xce58('0x56'),'MAX':_0xce58('0x57'),'MIN':_0xce58('0x58'),'AVG':_0xce58('0x59'),'GROUP_CONCAT':_0xce58('0x5a'),'GROUP_CONCAT ASC':_0xce58('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x463fb2={'SEC_TO_TIME':_0xce58('0x5c'),'DATE':_0xce58('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4d161d=function(_0x5ddf6f){return!_[_0xce58('0x5e')]([_0xce58('0x5f'),_0xce58('0x60'),_0xce58('0x61'),'IS\x20NOT\x20EMPTY'],_0x5ddf6f);};var _0x45b533=function(_0x39fbc4){if(!_0x39fbc4||!_0x39fbc4[_0xce58('0x62')][_0xce58('0x32')]){return'';}for(var _0x33fb5d='(',_0x18ce25=0x0;_0x18ce25<_0x39fbc4[_0xce58('0x62')][_0xce58('0x32')];_0x18ce25+=0x1){_0x18ce25>0x0&&(_0x33fb5d+='\x20'+_0x39fbc4[_0xce58('0x63')]+'\x20');_0x33fb5d+=_0x39fbc4[_0xce58('0x62')][_0x18ce25][_0xce58('0x64')]?_0x45b533(_0x39fbc4[_0xce58('0x62')][_0x18ce25][_0xce58('0x64')]):_0x39fbc4[_0xce58('0x62')][_0x18ce25]['field']+'\x20'+_0x39fbc4[_0xce58('0x62')][_0x18ce25][_0xce58('0x65')]+(_0x4d161d(_0x39fbc4[_0xce58('0x62')][_0x18ce25][_0xce58('0x65')])?'\x20'+_0x39fbc4[_0xce58('0x62')][_0x18ce25][_0xce58('0x66')]:'');}return _0x33fb5d+')';};var _0x953e0f={'where':{'id':_0x499dd1['params']['id']}},_0x31fa73,_0x12713d,_0xf5538e,_0x162f37,_0xb5e833;_0x953e0f=_[_0xce58('0x39')]({},_0x953e0f,_0x499dd1[_0xce58('0x3c')]);return db['AnalyticDefaultReport'][_0xce58('0x4b')](_0x953e0f)[_0xce58('0x21')](function(_0x1f0e18){if(_0x1f0e18){_0x31fa73=_0x1f0e18;return _0x1f0e18[_0xce58('0x67')]();}return null;})[_0xce58('0x21')](function(_0x1fd80f){if(_0x1fd80f){if(!_0x1fd80f[_0xce58('0x32')]){throw new db[(_0xce58('0x68'))][(_0xce58('0x69'))](_0xce58('0x6a'),0x193);}_0x12713d=_0x1fd80f;return db[_0xce58('0x6b')][_0xce58('0x3e')]({'raw':!![]});}return null;})[_0xce58('0x21')](function(_0x1ddc0f){if(_0x1ddc0f){_0xf5538e=_[_0xce58('0x6c')](_0x1ddc0f,'id');var _0x121a9f;var _0x469b1b=squel[_0xce58('0x6d')]();_0x469b1b['from'](_0x31fa73[_0xce58('0x6e')]);for(var _0x32dba4=0x0;_0x32dba4<_0x12713d[_0xce58('0x32')];_0x32dba4+=0x1){_0x121a9f=_0x12713d[_0x32dba4][_0xce58('0x6f')]?_0xf5538e[_0x12713d[_0x32dba4][_0xce58('0x6f')]]['metric']:_0x12713d[_0x32dba4][_0xce58('0x70')];_0x121a9f=_0x12713d[_0x32dba4]['function']?_[_0xce58('0x71')](_0x179098[_0x12713d[_0x32dba4][_0xce58('0x72')]],'%s',_0x121a9f):_0x121a9f;_0x121a9f=_0x12713d[_0x32dba4][_0xce58('0x73')]?_['replace'](_0x463fb2[_0x12713d[_0x32dba4][_0xce58('0x73')]],'%s',_0x121a9f):_0x121a9f;if(_0x12713d[_0x32dba4][_0xce58('0x74')]){_0x469b1b[_0xce58('0x64')](_0x121a9f);}_0x12713d[_0x32dba4]['orderBy']&&_0x469b1b[_0xce58('0x34')](_0x121a9f,_0x12713d[_0x32dba4]['orderBy']===_0xce58('0x75')?![]:!![]);_0x469b1b[_0xce58('0x70')](_0x121a9f,_0x12713d[_0x32dba4][_0xce58('0x76')]||_0x121a9f);}if(_0x31fa73[_0xce58('0x77')]){_0x31fa73['joins']=JSON[_0xce58('0x78')](_0x31fa73[_0xce58('0x77')]);for(var _0x14f35c=0x0;_0x14f35c<_0x31fa73[_0xce58('0x77')][_0xce58('0x32')];_0x14f35c+=0x1){if(_0x31fa73[_0xce58('0x77')][_0x14f35c][_0xce58('0x2a')]&&_[_0xce58('0x5e')](_0x26fb9e,_0x31fa73['joins'][_0x14f35c][_0xce58('0x2a')])&&_0x31fa73['joins'][_0x14f35c][_0xce58('0x79')]&&_0x31fa73[_0xce58('0x77')][_0x14f35c][_0xce58('0x7a')]&&_0x31fa73[_0xce58('0x77')][_0x14f35c][_0xce58('0x7b')]){_0x469b1b[_0x31fa73['joins'][_0x14f35c]['type']](_0x31fa73[_0xce58('0x77')][_0x14f35c]['foreignTable'],null,util[_0xce58('0x73')]('%s.%s\x20=\x20%s.%s',_0x31fa73['table'],_0x31fa73['joins'][_0x14f35c]['parentKey'],_0x31fa73[_0xce58('0x77')][_0x14f35c][_0xce58('0x7a')],_0x31fa73['joins'][_0x14f35c]['foreignKey']));}}}if(_0x31fa73[_0xce58('0x7c')]){_0x31fa73[_0xce58('0x7c')]=JSON[_0xce58('0x78')](_0x31fa73[_0xce58('0x7c')]);_0x469b1b[_0xce58('0x3a')](_0x45b533(_0x31fa73[_0xce58('0x7c')][_0xce58('0x64')]));}_0xb5e833=_0x469b1b[_0xce58('0x7d')]();_0x469b1b['limit'](_0x6839d7);_0x469b1b[_0xce58('0x1a')](0x0);logger[_0xce58('0x7e')](_0xce58('0x7f'),_0x469b1b[_0xce58('0x80')]());return db['sequelize'][_0xce58('0x2d')](_0x469b1b[_0xce58('0x80')](),{'type':db[_0xce58('0x81')][_0xce58('0x82')][_0xce58('0x83')]});}})[_0xce58('0x21')](respondWithResult(_0x4f146e,null))[_0xce58('0x42')](handleError(_0x4f146e,null));};function runReport(_0x26f2d5,_0x5934cd,_0x4552c4){var _0x21e916=_0x5934cd['name'];var _0x28bd16=0xa;var _0x408fa=[_0xce58('0x51'),_0xce58('0x52'),_0xce58('0x53'),'cross_join'];var _0x5d47c8={'SUM':'SUM(%s)','COUNT':_0xce58('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xce58('0x57'),'MIN':_0xce58('0x58'),'AVG':_0xce58('0x59'),'GROUP_CONCAT':_0xce58('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xce58('0x84')};var _0x17b74f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xce58('0x5d'),'HOUR':_0xce58('0x85'),'ROUND':_0xce58('0x86'),'UNIX_TIMESTAMP':_0xce58('0x87')};var _0x3de851=function(_0x8beff1){return!_[_0xce58('0x5e')]([_0xce58('0x5f'),_0xce58('0x60'),_0xce58('0x61'),_0xce58('0x88')],_0x8beff1);};var _0x7acf24=function(_0x3c6266){if(!_0x3c6266||!_0x3c6266[_0xce58('0x62')][_0xce58('0x32')]){return'';}for(var _0x58c326='(',_0x275bd8=0x0;_0x275bd8<_0x3c6266['rules'][_0xce58('0x32')];_0x275bd8+=0x1){_0x275bd8>0x0&&(_0x58c326+='\x20'+_0x3c6266[_0xce58('0x63')]+'\x20');_0x58c326+=_0x3c6266['rules'][_0x275bd8][_0xce58('0x64')]?_0x7acf24(_0x3c6266[_0xce58('0x62')][_0x275bd8][_0xce58('0x64')]):_0x3c6266[_0xce58('0x62')][_0x275bd8][_0xce58('0x70')]+'\x20'+_0x3c6266['rules'][_0x275bd8]['condition']+(_0x3de851(_0x3c6266['rules'][_0x275bd8]['condition'])?'\x20'+_0x3c6266[_0xce58('0x62')][_0x275bd8][_0xce58('0x66')]:'');}return _0x58c326+')';};var _0x390950={'where':{'id':_0x26f2d5['id']}},_0x347e9b,_0x461bc2,_0x1f7990,_0x55b5b1,_0x4675b6;_0x390950=_[_0xce58('0x39')]({},_0x390950,_0x4552c4);return db[_0xce58('0x28')]['find'](_0x390950)['then'](function(_0x1c35c5){if(_0x1c35c5){_0x347e9b=_0x1c35c5;return _0x1c35c5['getFields']();}return null;})[_0xce58('0x21')](function(_0x21a9cc){if(_0x21a9cc){if(!_0x21a9cc[_0xce58('0x32')]){throw new db[(_0xce58('0x68'))][(_0xce58('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x461bc2=_0x21a9cc;return db['AnalyticMetric'][_0xce58('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x3f3d14){if(_0x3f3d14){_0x1f7990=_[_0xce58('0x6c')](_0x3f3d14,'id');var _0x3b3aef;var _0x93ec32=squel[_0xce58('0x6d')]();_0x93ec32['from'](_0x347e9b[_0xce58('0x6e')]);for(var _0xb34026=0x0;_0xb34026<_0x461bc2[_0xce58('0x32')];_0xb34026+=0x1){_0x3b3aef=_0x461bc2[_0xb34026][_0xce58('0x6f')]?_0x1f7990[_0x461bc2[_0xb34026][_0xce58('0x6f')]][_0xce58('0x89')]:_0x461bc2[_0xb34026]['field'];_0x3b3aef=_0x461bc2[_0xb34026][_0xce58('0x72')]?_[_0xce58('0x71')](_0x5d47c8[_0x461bc2[_0xb34026]['function']],'%s',_0x3b3aef):_0x3b3aef;_0x3b3aef=_0x461bc2[_0xb34026][_0xce58('0x73')]?_[_0xce58('0x71')](_0x17b74f[_0x461bc2[_0xb34026]['format']],'%s',_0x3b3aef):_0x3b3aef;if(_0x461bc2[_0xb34026][_0xce58('0x74')]){_0x93ec32['group'](_0x3b3aef);}_0x461bc2[_0xb34026][_0xce58('0x8a')]&&_0x93ec32[_0xce58('0x34')](_0x3b3aef,_0x461bc2[_0xb34026]['orderBy']===_0xce58('0x75')?![]:!![]);_0x93ec32[_0xce58('0x70')](_0x3b3aef,_0x461bc2[_0xb34026][_0xce58('0x76')]||_0x3b3aef);}if(_0x347e9b['joins']){_0x347e9b[_0xce58('0x77')]=JSON[_0xce58('0x78')](_0x347e9b['joins']);for(var _0x360ca0=0x0;_0x360ca0<_0x347e9b[_0xce58('0x77')][_0xce58('0x32')];_0x360ca0+=0x1){if(_0x347e9b[_0xce58('0x77')][_0x360ca0][_0xce58('0x2a')]&&_[_0xce58('0x5e')](_0x408fa,_0x347e9b['joins'][_0x360ca0][_0xce58('0x2a')])&&_0x347e9b[_0xce58('0x77')][_0x360ca0][_0xce58('0x79')]&&_0x347e9b['joins'][_0x360ca0][_0xce58('0x7a')]&&_0x347e9b[_0xce58('0x77')][_0x360ca0][_0xce58('0x7b')]){_0x93ec32[_0x347e9b[_0xce58('0x77')][_0x360ca0]['type']](_0x347e9b['joins'][_0x360ca0][_0xce58('0x7a')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x347e9b[_0xce58('0x6e')],_0x347e9b[_0xce58('0x77')][_0x360ca0][_0xce58('0x79')],_0x347e9b[_0xce58('0x77')][_0x360ca0][_0xce58('0x7a')],_0x347e9b[_0xce58('0x77')][_0x360ca0][_0xce58('0x7b')]));}}}if(_0x347e9b['conditions']){_0x347e9b['conditions']=JSON[_0xce58('0x78')](_0x347e9b['conditions']);_0x93ec32['where'](_0x7acf24(_0x347e9b['conditions'][_0xce58('0x64')]));}_0x4675b6=_0x93ec32[_0xce58('0x7d')]();_0x93ec32[_0xce58('0x1b')](_0x28bd16);_0x93ec32[_0xce58('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x93ec32[_0xce58('0x80')]());return db[_0xce58('0x81')]['query'](_0x93ec32[_0xce58('0x80')](),{'type':db[_0xce58('0x81')][_0xce58('0x82')]['SELECT']});}})['then'](function(_0xcc02ed){if(!_0xcc02ed[_0xce58('0x32')]){throw new db[(_0xce58('0x68'))][(_0xce58('0x69'))](_0xce58('0x8b'),0xcc);}if(_0x5934cd[_0xce58('0x8c')]===_0xce58('0x8d')){return null;}var _0x3a0bc5=_['merge'](_0x5934cd,{'name':_0x5934cd['fullPath']||_0x5934cd['name']||_0x347e9b[_0xce58('0x25')],'basename':_0x21e916,'savename':util[_0xce58('0x73')](_0xce58('0x8e'),_0x5934cd[_0xce58('0x25')]||_0x347e9b[_0xce58('0x25')],require(_0xce58('0x8f'))['generate'](0x4),_0x5934cd[_0xce58('0x8c')]||_0xce58('0x90')),'reportId':_0x347e9b['id'],'reportType':_0xce58('0x91')});return db[_0xce58('0x92')]['create'](_0x3a0bc5,{'raw':!![]});})['then'](function(_0xa4488c){if(_0x347e9b['table']==='cdr'){_0x4675b6[_0xce58('0x3a')](_0x347e9b[_0xce58('0x6e')]+_0xce58('0x93'),_0x5934cd['startDate'],_0x5934cd[_0xce58('0x94')]);}else{_0x4675b6[_0xce58('0x3a')](_0x347e9b[_0xce58('0x6e')]+_0xce58('0x95'),_0x5934cd[_0xce58('0x96')],_0x5934cd[_0xce58('0x94')]);}if(_0xa4488c){logger['info']('Run\x20Query:',_0x4675b6['toString']());require('child_process')['fork'](path[_0xce58('0x51')](__dirname,'../../components/export/',_0xa4488c[_0xce58('0x8c')]),[_0xa4488c['id'],_0x4675b6['toString'](),path[_0xce58('0x51')](__dirname,_0xce58('0x97'),_0xa4488c['savename']),_0x21e916]);return _0xa4488c;}else{var _0x17ced2=squel['select']();_0x17ced2[_0xce58('0x98')]('('+_0x4675b6['toString']()+')',_0xce58('0x99'));_0x17ced2[_0xce58('0x70')](_0xce58('0x9a'),_0xce58('0x19'));_0x4675b6[_0xce58('0x1b')](_0x5934cd[_0xce58('0x1b')]||_0x28bd16);_0x4675b6['offset'](_0x5934cd[_0xce58('0x1a')]||0x0);return dbH[_0xce58('0x81')][_0xce58('0x2d')](_0x17ced2[_0xce58('0x80')](),{'type':dbH[_0xce58('0x81')][_0xce58('0x82')][_0xce58('0x83')]})[_0xce58('0x21')](function(_0xc0a667){if(!_0xc0a667['length']){_0x55b5b1=0x0;}else{_0x55b5b1=_0xc0a667[0x0][_0xce58('0x19')]||0x0;}return dbH[_0xce58('0x81')]['query'](_0x4675b6[_0xce58('0x80')](),{'type':dbH[_0xce58('0x81')][_0xce58('0x82')]['SELECT']});})['then'](function(_0x3baf4e){return{'rows':_0x3baf4e||[],'count':_0x55b5b1};});}});}exports['run']=function(_0x44cfe0,_0x17ea69){return runReport(_0x44cfe0[_0xce58('0x40')],_0x44cfe0[_0xce58('0x2d')],_0x44cfe0[_0xce58('0x3c')])[_0xce58('0x21')](respondWithResult(_0x17ea69,null))[_0xce58('0x42')](handleError(_0x17ea69,null));};exports[_0xce58('0x9b')]=runReport;exports[_0xce58('0x2d')]=function(_0x51b830,_0x3de043){var _0x12e990=0xa;var _0x52ce91=[_0xce58('0x51'),'left_join',_0xce58('0x53'),'cross_join'];var _0x4b463a={'SUM':'SUM(%s)','COUNT':_0xce58('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xce58('0x57'),'MIN':_0xce58('0x58'),'AVG':_0xce58('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xce58('0x5b'),'GROUP_CONCAT DESC':_0xce58('0x84')};var _0x1adae9={'SEC_TO_TIME':_0xce58('0x5c'),'DATE':_0xce58('0x5d'),'HOUR':_0xce58('0x85'),'ROUND':_0xce58('0x86'),'UNIX_TIMESTAMP':_0xce58('0x87')};var _0xa9a830=function(_0x11fe6b){return!_[_0xce58('0x5e')](['IS\x20NULL',_0xce58('0x60'),'IS\x20EMPTY',_0xce58('0x88')],_0x11fe6b);};var _0x420323=function(_0x31360b){if(!_0x31360b||!_0x31360b[_0xce58('0x62')]['length']){return'';}for(var _0x2e54d1='(',_0x490ab7=0x0;_0x490ab7<_0x31360b[_0xce58('0x62')][_0xce58('0x32')];_0x490ab7+=0x1){_0x490ab7>0x0&&(_0x2e54d1+='\x20'+_0x31360b[_0xce58('0x63')]+'\x20');_0x2e54d1+=_0x31360b[_0xce58('0x62')][_0x490ab7][_0xce58('0x64')]?_0x420323(_0x31360b[_0xce58('0x62')][_0x490ab7][_0xce58('0x64')]):_0x31360b[_0xce58('0x62')][_0x490ab7][_0xce58('0x70')]+'\x20'+_0x31360b[_0xce58('0x62')][_0x490ab7][_0xce58('0x65')]+(_0xa9a830(_0x31360b[_0xce58('0x62')][_0x490ab7]['condition'])?'\x20'+_0x31360b[_0xce58('0x62')][_0x490ab7]['value']:'');}return _0x2e54d1+')';};var _0x4ab5a0={'where':{'id':_0x51b830[_0xce58('0x40')]['id']}},_0x4e3bbc,_0x498a7a,_0x4a38e8,_0x680102,_0x59455f;_0x4ab5a0=_['merge']({},_0x4ab5a0,_0x51b830['options']);return db[_0xce58('0x28')][_0xce58('0x4b')](_0x4ab5a0)['then'](function(_0x29cd0c){if(_0x29cd0c){_0x4e3bbc=_0x29cd0c;return _0x29cd0c['getFields']();}return null;})[_0xce58('0x21')](function(_0x3b1dca){if(_0x3b1dca){if(!_0x3b1dca[_0xce58('0x32')]){throw new db[(_0xce58('0x68'))][(_0xce58('0x69'))](_0xce58('0x6a'),0x193);}_0x498a7a=_0x3b1dca;return db['AnalyticMetric'][_0xce58('0x3e')]({'raw':!![]});}return null;})[_0xce58('0x21')](function(_0x2cfb55){if(_0x2cfb55){_0x4a38e8=_[_0xce58('0x6c')](_0x2cfb55,'id');var _0x430769;var _0x1b2269=squel[_0xce58('0x6d')]();_0x1b2269['from'](_0x4e3bbc[_0xce58('0x6e')]);for(var _0x4228d0=0x0;_0x4228d0<_0x498a7a['length'];_0x4228d0+=0x1){_0x430769=_0x498a7a[_0x4228d0][_0xce58('0x6f')]?_0x4a38e8[_0x498a7a[_0x4228d0][_0xce58('0x6f')]][_0xce58('0x89')]:_0x498a7a[_0x4228d0][_0xce58('0x70')];_0x430769=_0x498a7a[_0x4228d0][_0xce58('0x72')]?_['replace'](_0x4b463a[_0x498a7a[_0x4228d0][_0xce58('0x72')]],'%s',_0x430769):_0x430769;_0x430769=_0x498a7a[_0x4228d0]['format']?_['replace'](_0x1adae9[_0x498a7a[_0x4228d0][_0xce58('0x73')]],'%s',_0x430769):_0x430769;if(_0x498a7a[_0x4228d0][_0xce58('0x74')]){_0x1b2269['group'](_0x430769);}_0x498a7a[_0x4228d0][_0xce58('0x8a')]&&_0x1b2269[_0xce58('0x34')](_0x430769,_0x498a7a[_0x4228d0][_0xce58('0x8a')]===_0xce58('0x75')?![]:!![]);_0x1b2269[_0xce58('0x70')](_0x430769,_0x498a7a[_0x4228d0]['alias']||_0x430769);}if(_0x4e3bbc[_0xce58('0x77')]){_0x4e3bbc[_0xce58('0x77')]=JSON[_0xce58('0x78')](_0x4e3bbc[_0xce58('0x77')]);for(var _0x590351=0x0;_0x590351<_0x4e3bbc['joins'][_0xce58('0x32')];_0x590351+=0x1){if(_0x4e3bbc[_0xce58('0x77')][_0x590351]['type']&&_['includes'](_0x52ce91,_0x4e3bbc['joins'][_0x590351][_0xce58('0x2a')])&&_0x4e3bbc[_0xce58('0x77')][_0x590351][_0xce58('0x79')]&&_0x4e3bbc[_0xce58('0x77')][_0x590351][_0xce58('0x7a')]&&_0x4e3bbc[_0xce58('0x77')][_0x590351][_0xce58('0x7b')]){_0x1b2269[_0x4e3bbc[_0xce58('0x77')][_0x590351][_0xce58('0x2a')]](_0x4e3bbc[_0xce58('0x77')][_0x590351][_0xce58('0x7a')],null,util['format'](_0xce58('0x9c'),_0x4e3bbc[_0xce58('0x6e')],_0x4e3bbc[_0xce58('0x77')][_0x590351][_0xce58('0x79')],_0x4e3bbc[_0xce58('0x77')][_0x590351]['foreignTable'],_0x4e3bbc[_0xce58('0x77')][_0x590351][_0xce58('0x7b')]));}}}if(_0x4e3bbc['conditions']){_0x4e3bbc[_0xce58('0x7c')]=JSON[_0xce58('0x78')](_0x4e3bbc[_0xce58('0x7c')]);_0x1b2269[_0xce58('0x3a')](_0x420323(_0x4e3bbc[_0xce58('0x7c')][_0xce58('0x64')]));}_0x59455f=_0x1b2269[_0xce58('0x7d')]();_0x1b2269[_0xce58('0x1b')](_0x12e990);_0x1b2269[_0xce58('0x1a')](0x0);logger[_0xce58('0x7e')](_0xce58('0x7f'),_0x1b2269[_0xce58('0x80')]());return db['sequelize'][_0xce58('0x2d')](_0x1b2269[_0xce58('0x80')](),{'type':db['sequelize'][_0xce58('0x82')]['SELECT']});}})[_0xce58('0x21')](function(){return{'sql':_0x59455f[_0xce58('0x80')]()};})['then'](respondWithResult(_0x3de043,null))[_0xce58('0x42')](handleError(_0x3de043,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index abb8bb6..290a7a5 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 _0x93cc=['util','../../config/logger','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports'];(function(_0x218da0,_0x1f26fc){var _0x59b11b=function(_0x1678c3){while(--_0x1678c3){_0x218da0['push'](_0x218da0['shift']());}};_0x59b11b(++_0x1f26fc);}(_0x93cc,0x168));var _0xc93c=function(_0x40a80c,_0x6f5b2d){_0x40a80c=_0x40a80c-0x0;var _0x18d70f=_0x93cc[_0x40a80c];return _0x18d70f;};'use strict';var _=require('lodash');var util=require(_0xc93c('0x0'));var logger=require(_0xc93c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc93c('0x2'));var rimraf=require(_0xc93c('0x3'));var config=require(_0xc93c('0x4'));var attributes=require(_0xc93c('0x5'));module[_0xc93c('0x6')]=function(_0x2591d8,_0x5dd9df){return _0x2591d8['define'](_0xc93c('0x7'),attributes,{'tableName':_0xc93c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbba=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','../../config/logger','api'];(function(_0x415752,_0x5c8cbb){var _0x3ac5af=function(_0x155193){while(--_0x155193){_0x415752['push'](_0x415752['shift']());}};_0x3ac5af(++_0x5c8cbb);}(_0xbbba,0x100));var _0xabbb=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0xbbba[_0x1ba43c];return _0x2f60eb;};'use strict';var _=require(_0xabbb('0x0'));var util=require(_0xabbb('0x1'));var logger=require(_0xabbb('0x2'))(_0xabbb('0x3'));var moment=require(_0xabbb('0x4'));var BPromise=require(_0xabbb('0x5'));var rp=require(_0xabbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabbb('0x7'));var config=require(_0xabbb('0x8'));var attributes=require(_0xabbb('0x9'));module[_0xabbb('0xa')]=function(_0x4607f0,_0x1cface){return _0x4607f0[_0xabbb('0xb')](_0xabbb('0xc'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index fe7fe09..3ec5546 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 _0xa74d=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa74d,0x1cf));var _0xda74=function(_0x13309c,_0x5266eb){_0x13309c=_0x13309c-0x0;var _0x2de76c=_0xa74d[_0x13309c];return _0x2de76c;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var moment=require(_0xda74('0x1'));var BPromise=require(_0xda74('0x2'));var rs=require(_0xda74('0x3'));var fs=require('fs');var Redis=require(_0xda74('0x4'));var db=require(_0xda74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda74('0x6'))(_0xda74('0x7'));var config=require(_0xda74('0x8'));var jayson=require(_0xda74('0x9'));var client=jayson[_0xda74('0xa')][_0xda74('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2113f2,_0x3fa4e7,_0x5da443){return new BPromise(function(_0x23d5f5,_0x517251){return client['request'](_0x2113f2,_0x5da443)[_0xda74('0xc')](function(_0x411790){logger['info'](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));logger[_0xda74('0xf')](_0xda74('0x10'),_0x3fa4e7,_0xda74('0xe'),JSON[_0xda74('0x11')](_0x411790));if(_0x411790[_0xda74('0x12')]){if(_0x411790[_0xda74('0x12')]['code']===0x1f4){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')]['message']);return _0x517251(_0x411790[_0xda74('0x12')][_0xda74('0x13')]);}logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x411790[_0xda74('0x12')][_0xda74('0x13')]);return _0x23d5f5(_0x411790[_0xda74('0x12')]['message']);}else{logger[_0xda74('0x14')](_0xda74('0xd'),_0x3fa4e7,_0xda74('0xe'));_0x23d5f5(_0x411790[_0xda74('0x15')][_0xda74('0x13')]);}})['catch'](function(_0x1535d3){logger[_0xda74('0x12')](_0xda74('0xd'),_0x3fa4e7,_0x1535d3);_0x517251(_0x1535d3);});});} \ No newline at end of file +var _0xc94f=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x2ba7b1,_0x297946){var _0x1bd757=function(_0x432a79){while(--_0x432a79){_0x2ba7b1['push'](_0x2ba7b1['shift']());}};_0x1bd757(++_0x297946);}(_0xc94f,0xcd));var _0xfc94=function(_0xbea2f0,_0x3fbf98){_0xbea2f0=_0xbea2f0-0x0;var _0x5b4840=_0xc94f[_0xbea2f0];return _0x5b4840;};'use strict';var _=require(_0xfc94('0x0'));var util=require('util');var moment=require(_0xfc94('0x1'));var BPromise=require(_0xfc94('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc94('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc94('0x4'));var logger=require(_0xfc94('0x5'))(_0xfc94('0x6'));var config=require(_0xfc94('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x402ee9,_0xff28ad,_0x4dc395){return new BPromise(function(_0xe044e8,_0x47afb8){return client[_0xfc94('0x8')](_0x402ee9,_0x4dc395)[_0xfc94('0x9')](function(_0x4212af){logger[_0xfc94('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xff28ad,'request\x20sent');logger[_0xfc94('0xb')](_0xfc94('0xc'),_0xff28ad,_0xfc94('0xd'),JSON[_0xfc94('0xe')](_0x4212af));if(_0x4212af[_0xfc94('0xf')]){if(_0x4212af[_0xfc94('0xf')]['code']===0x1f4){logger['error'](_0xfc94('0x10'),_0xff28ad,_0x4212af[_0xfc94('0xf')][_0xfc94('0x11')]);return _0x47afb8(_0x4212af[_0xfc94('0xf')]['message']);}logger[_0xfc94('0xf')](_0xfc94('0x10'),_0xff28ad,_0x4212af[_0xfc94('0xf')][_0xfc94('0x11')]);return _0xe044e8(_0x4212af[_0xfc94('0xf')]['message']);}else{logger[_0xfc94('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xff28ad,_0xfc94('0xd'));_0xe044e8(_0x4212af['result'][_0xfc94('0x11')]);}})[_0xfc94('0x12')](function(_0x2f7bd6){logger['error'](_0xfc94('0x10'),_0xff28ad,_0x2f7bd6);_0x47afb8(_0x2f7bd6);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index adbd6d5..4a26038 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 _0x1c56=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/run','run','/:id/query','query','post','create','update','destroy'];(function(_0x282f99,_0x246527){var _0x40bda7=function(_0xa42c9e){while(--_0xa42c9e){_0x282f99['push'](_0x282f99['shift']());}};_0x40bda7(++_0x246527);}(_0x1c56,0x169));var _0x61c5=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x1c56[_0x4191af];return _0x27bebf;};'use strict';var multer=require(_0x61c5('0x0'));var util=require(_0x61c5('0x1'));var path=require(_0x61c5('0x2'));var timeout=require(_0x61c5('0x3'));var express=require(_0x61c5('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x61c5('0x5'));var config=require(_0x61c5('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x61c5('0x7')]('/',auth[_0x61c5('0x8')](),controller[_0x61c5('0x9')]);router['get'](_0x61c5('0xa'),auth[_0x61c5('0x8')](),controller['show']);router['get']('/:id/preview',auth[_0x61c5('0x8')](),controller['preview']);router['get'](_0x61c5('0xb'),auth[_0x61c5('0x8')](),controller[_0x61c5('0xc')]);router[_0x61c5('0x7')](_0x61c5('0xd'),auth['isAuthenticated'](),controller[_0x61c5('0xe')]);router[_0x61c5('0xf')]('/',auth['isAuthenticated'](),controller[_0x61c5('0x10')]);router['put'](_0x61c5('0xa'),auth[_0x61c5('0x8')](),controller[_0x61c5('0x11')]);router['delete'](_0x61c5('0xa'),auth['isAuthenticated'](),controller[_0x61c5('0x12')]);module[_0x61c5('0x13')]=router; \ No newline at end of file +var _0xda4d=['index','show','preview','/:id/run','run','/:id/query','query','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x130375,_0x4cee28){var _0x457d9e=function(_0x1af7c5){while(--_0x1af7c5){_0x130375['push'](_0x130375['shift']());}};_0x457d9e(++_0x4cee28);}(_0xda4d,0xc6));var _0xdda4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xda4d[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xdda4('0x0'));var util=require(_0xdda4('0x1'));var path=require(_0xdda4('0x2'));var timeout=require(_0xdda4('0x3'));var express=require(_0xdda4('0x4'));var router=express[_0xdda4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdda4('0x6'));router[_0xdda4('0x7')]('/',auth[_0xdda4('0x8')](),controller[_0xdda4('0x9')]);router[_0xdda4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdda4('0xa')]);router[_0xdda4('0x7')]('/:id/preview',auth['isAuthenticated'](),controller[_0xdda4('0xb')]);router['get'](_0xdda4('0xc'),auth[_0xdda4('0x8')](),controller[_0xdda4('0xd')]);router['get'](_0xdda4('0xe'),auth[_0xdda4('0x8')](),controller[_0xdda4('0xf')]);router[_0xdda4('0x10')]('/',auth['isAuthenticated'](),controller[_0xdda4('0x11')]);router['put'](_0xdda4('0x12'),auth[_0xdda4('0x8')](),controller[_0xdda4('0x13')]);router[_0xdda4('0x14')](_0xdda4('0x12'),auth[_0xdda4('0x8')](),controller[_0xdda4('0x15')]);module[_0xdda4('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e9f640b..52637db 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 _0x4cdd=['exports','STRING','ENUM','pdf','xlsx','DATE','Loading','manual','INTEGER','sequelize','moment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x4cdd,0xae));var _0xd4cd=function(_0x4f2e72,_0x47b849){_0x4f2e72=_0x4f2e72-0x0;var _0x230dc5=_0x4cdd[_0x4f2e72];return _0x230dc5;};'use strict';var Sequelize=require(_0xd4cd('0x0'));var moment=require(_0xd4cd('0x1'));module[_0xd4cd('0x2')]={'name':{'type':Sequelize[_0xd4cd('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xd4cd('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xd4cd('0x4')]('csv',_0xd4cd('0x5'),_0xd4cd('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xd4cd('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xd4cd('0x7')]},'status':{'type':Sequelize[_0xd4cd('0x3')],'defaultValue':_0xd4cd('0x8')},'type':{'type':Sequelize[_0xd4cd('0x4')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xd4cd('0x9')},'reportId':{'type':Sequelize[_0xd4cd('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xd4cd('0x3')]}}; \ No newline at end of file +var _0xb6a3=['Loading','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','DATE'];(function(_0x407240,_0x3d93af){var _0x20043a=function(_0x3d43e4){while(--_0x3d43e4){_0x407240['push'](_0x407240['shift']());}};_0x20043a(++_0x3d93af);}(_0xb6a3,0x1a5));var _0x3b6a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb6a3[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x3b6a('0x0'));var moment=require(_0x3b6a('0x1'));module[_0x3b6a('0x2')]={'name':{'type':Sequelize[_0x3b6a('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x3b6a('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x3b6a('0x4')](_0x3b6a('0x5'),_0x3b6a('0x6'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x3b6a('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3b6a('0x7')]},'endDate':{'type':Sequelize[_0x3b6a('0x7')]},'status':{'type':Sequelize[_0x3b6a('0x3')],'defaultValue':_0x3b6a('0x8')},'type':{'type':Sequelize['ENUM']('manual','scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x3b6a('0x9')](0xb)[_0x3b6a('0xa')]},'reportType':{'type':Sequelize[_0x3b6a('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index cc2e05a..4c3e326 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 _0x1bac=['../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','apply','save','update','then','destroy','ExtractedReports','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','existsSync','root','server/files/reports','ValidationError','exists','%s.%s','output','toLowerCase','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1bac,0xf7));var _0xc1ba=function(_0x1dffda,_0x2d9a13){_0x1dffda=_0x1dffda-0x0;var _0x2ba9ed=_0x1bac[_0x1dffda];return _0x2ba9ed;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc1ba('0x0'));var rp=require(_0xc1ba('0x1'));var moment=require('moment');var BPromise=require(_0xc1ba('0x2'));var Mustache=require(_0xc1ba('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc1ba('0x4'));var csv=require('to-csv');var ejs=require(_0xc1ba('0x5'));var fs=require('fs');var _=require(_0xc1ba('0x6'));var squel=require(_0xc1ba('0x7'));var crypto=require(_0xc1ba('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc1ba('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc1ba('0xa'));var Papa=require(_0xc1ba('0xb'));var Redis=require(_0xc1ba('0xc'));var authService=require(_0xc1ba('0xd'));var qs=require(_0xc1ba('0xe'));var as=require(_0xc1ba('0xf'));var hardwareService=require(_0xc1ba('0x10'));var logger=require(_0xc1ba('0x11'))(_0xc1ba('0x12'));var utils=require(_0xc1ba('0x13'));var config=require(_0xc1ba('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356731,_0x30d886){_0x30d886=_0x30d886||0xcc;return function(_0x5de542){if(_0x5de542){return _0x356731[_0xc1ba('0x15')](_0x30d886);}return _0x356731[_0xc1ba('0x16')](_0x30d886)[_0xc1ba('0x17')]();};}function respondWithResult(_0x1fc86d,_0x400a11){_0x400a11=_0x400a11||0xc8;return function(_0x48e3d3){if(_0x48e3d3){return _0x1fc86d[_0xc1ba('0x16')](_0x400a11)[_0xc1ba('0x18')](_0x48e3d3);}};}function respondWithFilteredResult(_0x1ccb8e,_0x195ed3){return function(_0x385a76){if(_0x385a76){var _0x75bb59=_0x385a76['count'],_0x1e36bd=_0x195ed3[_0xc1ba('0x19')],_0x4f9e9c=_0x195ed3[_0xc1ba('0x19')]+_0x195ed3['limit'],_0x2dd1a6;if(_0x4f9e9c>=_0x75bb59){_0x4f9e9c=_0x75bb59;_0x2dd1a6=0xc8;}else{_0x2dd1a6=0xce;}_0x1ccb8e[_0xc1ba('0x16')](_0x2dd1a6);return _0x1ccb8e['set']('Content-Range',_0x1e36bd+'-'+_0x4f9e9c+'/'+_0x75bb59)[_0xc1ba('0x18')](_0x385a76);}return null;};}function patchUpdates(_0x55d97f){return function(_0x2ce519){try{jsonpatch[_0xc1ba('0x1a')](_0x2ce519,_0x55d97f,!![]);}catch(_0x526a47){return BPromise['reject'](_0x526a47);}return _0x2ce519[_0xc1ba('0x1b')]();};}function saveUpdates(_0x2d90a7,_0x556f04){return function(_0x55c8f1){if(_0x55c8f1){return _0x55c8f1[_0xc1ba('0x1c')](_0x2d90a7)[_0xc1ba('0x1d')](function(_0x3e1329){return _0x3e1329;});}return null;};}function removeEntity(_0x1dcd78,_0x3944c3){return function(_0x5f0ba9){if(_0x5f0ba9){return _0x5f0ba9[_0xc1ba('0x1e')]()[_0xc1ba('0x1d')](function(){var _0x5f49c7=_0x5f0ba9['get']({'plain':!![]});var _0x178ed5=_0xc1ba('0x1f');return db[_0xc1ba('0x20')][_0xc1ba('0x1e')]({'where':{'type':_0x178ed5,'resourceId':_0x5f49c7['id']}})[_0xc1ba('0x1d')](function(){return _0x5f0ba9;});})[_0xc1ba('0x1d')](function(){_0x1dcd78[_0xc1ba('0x16')](0xcc)[_0xc1ba('0x17')]();});}};}function handleEntityNotFound(_0x1f3bf6,_0x31f43a){return function(_0x1c6f29){if(!_0x1c6f29){_0x1f3bf6[_0xc1ba('0x15')](0x194);}return _0x1c6f29;};}function handleError(_0x1e6124,_0x5934b8){_0x5934b8=_0x5934b8||0x1f4;return function(_0x267f24){logger[_0xc1ba('0x21')](_0x267f24[_0xc1ba('0x22')]);if(_0x267f24[_0xc1ba('0x23')]){delete _0x267f24[_0xc1ba('0x23')];}_0x1e6124[_0xc1ba('0x16')](_0x5934b8)['send'](_0x267f24);};}exports[_0xc1ba('0x24')]=function(_0x3a57c3,_0x2d60d4){var _0x5a2784={},_0xe137bb={},_0x920573={'count':0x0,'rows':[]};var _0x2f79ef=_[_0xc1ba('0x25')](db[_0xc1ba('0x26')][_0xc1ba('0x27')],function(_0x18fb21){return{'name':_0x18fb21['fieldName'],'type':_0x18fb21[_0xc1ba('0x28')]['key']};});_0xe137bb[_0xc1ba('0x29')]=_[_0xc1ba('0x25')](_0x2f79ef,_0xc1ba('0x23'));_0xe137bb[_0xc1ba('0x2a')]=_[_0xc1ba('0x2b')](_0x3a57c3[_0xc1ba('0x2a')]);_0xe137bb[_0xc1ba('0x2c')]=_[_0xc1ba('0x2d')](_0xe137bb[_0xc1ba('0x29')],_0xe137bb[_0xc1ba('0x2a')]);_0x5a2784[_0xc1ba('0x2e')]=_[_0xc1ba('0x2d')](_0xe137bb[_0xc1ba('0x29')],qs[_0xc1ba('0x2f')](_0x3a57c3[_0xc1ba('0x2a')][_0xc1ba('0x2f')]));_0x5a2784[_0xc1ba('0x2e')]=_0x5a2784['attributes'][_0xc1ba('0x30')]?_0x5a2784['attributes']:_0xe137bb[_0xc1ba('0x29')];if(!_0x3a57c3[_0xc1ba('0x2a')][_0xc1ba('0x31')](_0xc1ba('0x32'))){_0x5a2784[_0xc1ba('0x33')]=qs[_0xc1ba('0x33')](_0x3a57c3['query'][_0xc1ba('0x33')]);_0x5a2784[_0xc1ba('0x19')]=qs['offset'](_0x3a57c3[_0xc1ba('0x2a')][_0xc1ba('0x19')]);}_0x5a2784[_0xc1ba('0x34')]=qs['sort'](_0x3a57c3[_0xc1ba('0x2a')][_0xc1ba('0x35')]);_0x5a2784[_0xc1ba('0x36')]=qs[_0xc1ba('0x2c')](_[_0xc1ba('0x37')](_0x3a57c3[_0xc1ba('0x2a')],_0xe137bb[_0xc1ba('0x2c')]),_0x2f79ef);if(_0x3a57c3[_0xc1ba('0x2a')][_0xc1ba('0x38')]){_0x5a2784['where']=_[_0xc1ba('0x39')](_0x5a2784[_0xc1ba('0x36')],{'$or':_[_0xc1ba('0x25')](_0x2f79ef,function(_0x5eed7c){if(_0x5eed7c['type']!=='VIRTUAL'){var _0x587c2c={};_0x587c2c[_0x5eed7c[_0xc1ba('0x23')]]={'$like':'%'+_0x3a57c3[_0xc1ba('0x2a')][_0xc1ba('0x38')]+'%'};return _0x587c2c;}})});}_0x5a2784=_[_0xc1ba('0x39')]({},_0x5a2784,_0x3a57c3['options']);var _0x15cdc0={'where':_0x5a2784['where']};return db[_0xc1ba('0x26')][_0xc1ba('0x3a')](_0x15cdc0)[_0xc1ba('0x1d')](function(_0x41b7b4){_0x920573[_0xc1ba('0x3a')]=_0x41b7b4;if(_0x3a57c3[_0xc1ba('0x2a')][_0xc1ba('0x3b')]){_0x5a2784[_0xc1ba('0x3c')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xc1ba('0x3d')](_0x5a2784);})['then'](function(_0x15c42a){_0x920573[_0xc1ba('0x3e')]=_0x15c42a;return _0x920573;})[_0xc1ba('0x1d')](respondWithFilteredResult(_0x2d60d4,_0x5a2784))[_0xc1ba('0x3f')](handleError(_0x2d60d4,null));};exports[_0xc1ba('0x40')]=function(_0x26c804,_0x19970b){var _0x1fc1a8={'raw':!![],'where':{'id':_0x26c804[_0xc1ba('0x41')]['id']}},_0x4668ff={};_0x4668ff[_0xc1ba('0x29')]=_[_0xc1ba('0x2b')](db[_0xc1ba('0x26')][_0xc1ba('0x27')]);_0x4668ff[_0xc1ba('0x2a')]=_[_0xc1ba('0x2b')](_0x26c804[_0xc1ba('0x2a')]);_0x4668ff[_0xc1ba('0x2c')]=_['intersection'](_0x4668ff['model'],_0x4668ff[_0xc1ba('0x2a')]);_0x1fc1a8[_0xc1ba('0x2e')]=_[_0xc1ba('0x2d')](_0x4668ff[_0xc1ba('0x29')],qs['fields'](_0x26c804[_0xc1ba('0x2a')][_0xc1ba('0x2f')]));_0x1fc1a8[_0xc1ba('0x2e')]=_0x1fc1a8[_0xc1ba('0x2e')][_0xc1ba('0x30')]?_0x1fc1a8[_0xc1ba('0x2e')]:_0x4668ff[_0xc1ba('0x29')];if(_0x26c804[_0xc1ba('0x2a')][_0xc1ba('0x3b')]){_0x1fc1a8['include']=[{'all':!![]}];}_0x1fc1a8=_[_0xc1ba('0x39')]({},_0x1fc1a8,_0x26c804['options']);return db[_0xc1ba('0x26')][_0xc1ba('0x42')](_0x1fc1a8)[_0xc1ba('0x1d')](handleEntityNotFound(_0x19970b,null))[_0xc1ba('0x1d')](respondWithResult(_0x19970b,null))[_0xc1ba('0x3f')](handleError(_0x19970b,null));};exports['create']=function(_0x4bbc77,_0x20465a){return db['AnalyticExtractedReport'][_0xc1ba('0x43')](_0x4bbc77['body'],{})['then'](function(_0x4a8d26){var _0x46acf5=_0x4bbc77[_0xc1ba('0x44')][_0xc1ba('0x45')]({'plain':!![]});if(!_0x46acf5)throw new Error(_0xc1ba('0x46'));if(_0x46acf5[_0xc1ba('0x47')]===_0xc1ba('0x44')){var _0x5d2a24=_0x4a8d26[_0xc1ba('0x45')]({'plain':!![]});var _0x51df53=_0xc1ba('0x1f');return db[_0xc1ba('0x48')]['find']({'where':{'name':_0x51df53,'userProfileId':_0x46acf5[_0xc1ba('0x49')]},'raw':!![]})[_0xc1ba('0x1d')](function(_0x3818b3){if(_0x3818b3&&_0x3818b3[_0xc1ba('0x4a')]===0x0){return db[_0xc1ba('0x20')]['create']({'name':_0x5d2a24[_0xc1ba('0x23')],'resourceId':_0x5d2a24['id'],'type':_0x3818b3['name'],'sectionId':_0x3818b3['id']},{})[_0xc1ba('0x1d')](function(){return _0x4a8d26;});}else{return _0x4a8d26;}})[_0xc1ba('0x3f')](function(_0x399f8f){logger[_0xc1ba('0x21')](_0xc1ba('0x4b'),_0x399f8f);throw _0x399f8f;});}return _0x4a8d26;})[_0xc1ba('0x1d')](respondWithResult(_0x20465a,0xc9))[_0xc1ba('0x3f')](handleError(_0x20465a,null));};exports['update']=function(_0xadcad8,_0x50d90f){if(_0xadcad8[_0xc1ba('0x4c')]['id']){delete _0xadcad8[_0xc1ba('0x4c')]['id'];}return db[_0xc1ba('0x26')][_0xc1ba('0x42')]({'where':{'id':_0xadcad8[_0xc1ba('0x41')]['id']}})['then'](handleEntityNotFound(_0x50d90f,null))[_0xc1ba('0x1d')](saveUpdates(_0xadcad8['body'],null))['then'](respondWithResult(_0x50d90f,null))[_0xc1ba('0x3f')](handleError(_0x50d90f,null));};exports[_0xc1ba('0x1e')]=function(_0x40e107,_0x330ae8){return db[_0xc1ba('0x26')][_0xc1ba('0x42')]({'where':{'id':_0x40e107[_0xc1ba('0x41')]['id']}})[_0xc1ba('0x1d')](handleEntityNotFound(_0x330ae8,null))[_0xc1ba('0x1d')](removeEntity(_0x330ae8,null))[_0xc1ba('0x3f')](handleError(_0x330ae8,null));};exports[_0xc1ba('0x4d')]=function(_0x321e24,_0x5b9739,_0xfdd2de){return db[_0xc1ba('0x26')][_0xc1ba('0x42')]({'where':{'id':_0x321e24['params']['id']},'attributes':[_0xc1ba('0x23'),_0xc1ba('0x4e'),_0xc1ba('0x4f'),'output'],'raw':!![]})[_0xc1ba('0x1d')](handleEntityNotFound(_0x5b9739,null))['then'](function(_0x6d2f45){if(_0x6d2f45){if(!fs[_0xc1ba('0x50')](path['join'](config[_0xc1ba('0x51')],_0xc1ba('0x52'),_0x6d2f45['savename']))){throw new db['Sequelize'][(_0xc1ba('0x53'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x321e24[_0xc1ba('0x2a')][_0xc1ba('0x54')]){return _0x5b9739[_0xc1ba('0x15')](0xc8);}return _0x5b9739[_0xc1ba('0x4d')](path['join'](config[_0xc1ba('0x51')],_0xc1ba('0x52'),_0x6d2f45[_0xc1ba('0x4f')]),util['format'](_0xc1ba('0x55'),_0x6d2f45[_0xc1ba('0x4e')]||_0x6d2f45[_0xc1ba('0x23')],_0x6d2f45[_0xc1ba('0x56')][_0xc1ba('0x57')]()));}})['catch'](handleError(_0x5b9739,null));}; \ No newline at end of file +var _0xb045=['type','VIRTUAL','options','findAll','rows','show','params','length','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','format','%s.%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','index','map','AnalyticExtractedReport','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge'];(function(_0x547e1e,_0x5f12af){var _0x519156=function(_0x32a06e){while(--_0x32a06e){_0x547e1e['push'](_0x547e1e['shift']());}};_0x519156(++_0x5f12af);}(_0xb045,0x18c));var _0x5b04=function(_0x4b980d,_0x32fc6a){_0x4b980d=_0x4b980d-0x0;var _0x5c7974=_0xb045[_0x4b980d];return _0x5c7974;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5b04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b04('0x1'));var jsonpatch=require(_0x5b04('0x2'));var rp=require('request-promise');var moment=require(_0x5b04('0x3'));var BPromise=require(_0x5b04('0x4'));var Mustache=require(_0x5b04('0x5'));var util=require(_0x5b04('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5b04('0x7'));var fs=require('fs');var _=require(_0x5b04('0x8'));var squel=require(_0x5b04('0x9'));var crypto=require('crypto');var jsforce=require(_0x5b04('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b04('0xb'));var Papa=require(_0x5b04('0xc'));var Redis=require(_0x5b04('0xd'));var authService=require(_0x5b04('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5b04('0xf'));var hardwareService=require(_0x5b04('0x10'));var logger=require('../../config/logger')(_0x5b04('0x11'));var utils=require(_0x5b04('0x12'));var config=require(_0x5b04('0x13'));var db=require(_0x5b04('0x14'))['db'];function respondWithStatusCode(_0x5ec037,_0x126be4){_0x126be4=_0x126be4||0xcc;return function(_0x1d5e36){if(_0x1d5e36){return _0x5ec037['sendStatus'](_0x126be4);}return _0x5ec037[_0x5b04('0x15')](_0x126be4)[_0x5b04('0x16')]();};}function respondWithResult(_0x3b8a34,_0xbc70cb){_0xbc70cb=_0xbc70cb||0xc8;return function(_0xc28f6e){if(_0xc28f6e){return _0x3b8a34[_0x5b04('0x15')](_0xbc70cb)[_0x5b04('0x17')](_0xc28f6e);}};}function respondWithFilteredResult(_0x11f721,_0x411a40){return function(_0x43c802){if(_0x43c802){var _0x6a9d5b=_0x43c802[_0x5b04('0x18')],_0x1a696d=_0x411a40[_0x5b04('0x19')],_0x1c7ffd=_0x411a40[_0x5b04('0x19')]+_0x411a40[_0x5b04('0x1a')],_0xb0bf76;if(_0x1c7ffd>=_0x6a9d5b){_0x1c7ffd=_0x6a9d5b;_0xb0bf76=0xc8;}else{_0xb0bf76=0xce;}_0x11f721[_0x5b04('0x15')](_0xb0bf76);return _0x11f721['set'](_0x5b04('0x1b'),_0x1a696d+'-'+_0x1c7ffd+'/'+_0x6a9d5b)['json'](_0x43c802);}return null;};}function patchUpdates(_0x589ffd){return function(_0x55ca70){try{jsonpatch['apply'](_0x55ca70,_0x589ffd,!![]);}catch(_0x3bc4ff){return BPromise[_0x5b04('0x1c')](_0x3bc4ff);}return _0x55ca70[_0x5b04('0x1d')]();};}function saveUpdates(_0x101681,_0x50d13f){return function(_0x61081d){if(_0x61081d){return _0x61081d[_0x5b04('0x1e')](_0x101681)['then'](function(_0x178426){return _0x178426;});}return null;};}function removeEntity(_0x319fac,_0x11fecb){return function(_0x1c9dfd){if(_0x1c9dfd){return _0x1c9dfd[_0x5b04('0x1f')]()[_0x5b04('0x20')](function(){var _0x12ed5b=_0x1c9dfd[_0x5b04('0x21')]({'plain':!![]});var _0x3a384c=_0x5b04('0x22');return db[_0x5b04('0x23')][_0x5b04('0x1f')]({'where':{'type':_0x3a384c,'resourceId':_0x12ed5b['id']}})['then'](function(){return _0x1c9dfd;});})['then'](function(){_0x319fac[_0x5b04('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ed610,_0x49a8a9){return function(_0x4a5cb3){if(!_0x4a5cb3){_0x1ed610[_0x5b04('0x24')](0x194);}return _0x4a5cb3;};}function handleError(_0x5ae8ef,_0x184eaf){_0x184eaf=_0x184eaf||0x1f4;return function(_0xb78b3a){logger[_0x5b04('0x25')](_0xb78b3a[_0x5b04('0x26')]);if(_0xb78b3a['name']){delete _0xb78b3a[_0x5b04('0x27')];}_0x5ae8ef[_0x5b04('0x15')](_0x184eaf)['send'](_0xb78b3a);};}exports[_0x5b04('0x28')]=function(_0x11a279,_0x28988e){var _0x5273e9={},_0x21790e={},_0x49f46c={'count':0x0,'rows':[]};var _0x3ba93e=_[_0x5b04('0x29')](db[_0x5b04('0x2a')]['rawAttributes'],function(_0x4cd1b4){return{'name':_0x4cd1b4[_0x5b04('0x2b')],'type':_0x4cd1b4['type'][_0x5b04('0x2c')]};});_0x21790e[_0x5b04('0x2d')]=_[_0x5b04('0x29')](_0x3ba93e,_0x5b04('0x27'));_0x21790e[_0x5b04('0x2e')]=_[_0x5b04('0x2f')](_0x11a279[_0x5b04('0x2e')]);_0x21790e['filters']=_[_0x5b04('0x30')](_0x21790e['model'],_0x21790e['query']);_0x5273e9[_0x5b04('0x31')]=_[_0x5b04('0x30')](_0x21790e[_0x5b04('0x2d')],qs[_0x5b04('0x32')](_0x11a279[_0x5b04('0x2e')][_0x5b04('0x32')]));_0x5273e9['attributes']=_0x5273e9[_0x5b04('0x31')]['length']?_0x5273e9[_0x5b04('0x31')]:_0x21790e[_0x5b04('0x2d')];if(!_0x11a279[_0x5b04('0x2e')][_0x5b04('0x33')](_0x5b04('0x34'))){_0x5273e9['limit']=qs[_0x5b04('0x1a')](_0x11a279['query'][_0x5b04('0x1a')]);_0x5273e9[_0x5b04('0x19')]=qs['offset'](_0x11a279[_0x5b04('0x2e')][_0x5b04('0x19')]);}_0x5273e9[_0x5b04('0x35')]=qs[_0x5b04('0x36')](_0x11a279['query'][_0x5b04('0x36')]);_0x5273e9[_0x5b04('0x37')]=qs[_0x5b04('0x38')](_['pick'](_0x11a279['query'],_0x21790e[_0x5b04('0x38')]),_0x3ba93e);if(_0x11a279[_0x5b04('0x2e')][_0x5b04('0x39')]){_0x5273e9[_0x5b04('0x37')]=_[_0x5b04('0x3a')](_0x5273e9['where'],{'$or':_['map'](_0x3ba93e,function(_0xf0d735){if(_0xf0d735[_0x5b04('0x3b')]!==_0x5b04('0x3c')){var _0x4d56e1={};_0x4d56e1[_0xf0d735[_0x5b04('0x27')]]={'$like':'%'+_0x11a279['query']['filter']+'%'};return _0x4d56e1;}})});}_0x5273e9=_[_0x5b04('0x3a')]({},_0x5273e9,_0x11a279[_0x5b04('0x3d')]);var _0x36a2f4={'where':_0x5273e9[_0x5b04('0x37')]};return db['AnalyticExtractedReport'][_0x5b04('0x18')](_0x36a2f4)[_0x5b04('0x20')](function(_0x27a38a){_0x49f46c['count']=_0x27a38a;if(_0x11a279[_0x5b04('0x2e')]['includeAll']){_0x5273e9['include']=[{'all':!![]}];}return db[_0x5b04('0x2a')][_0x5b04('0x3e')](_0x5273e9);})[_0x5b04('0x20')](function(_0xdbe58){_0x49f46c[_0x5b04('0x3f')]=_0xdbe58;return _0x49f46c;})[_0x5b04('0x20')](respondWithFilteredResult(_0x28988e,_0x5273e9))['catch'](handleError(_0x28988e,null));};exports[_0x5b04('0x40')]=function(_0x5c378f,_0x2565ac){var _0x384a89={'raw':!![],'where':{'id':_0x5c378f[_0x5b04('0x41')]['id']}},_0x35ca15={};_0x35ca15[_0x5b04('0x2d')]=_[_0x5b04('0x2f')](db[_0x5b04('0x2a')]['rawAttributes']);_0x35ca15[_0x5b04('0x2e')]=_[_0x5b04('0x2f')](_0x5c378f[_0x5b04('0x2e')]);_0x35ca15[_0x5b04('0x38')]=_[_0x5b04('0x30')](_0x35ca15[_0x5b04('0x2d')],_0x35ca15[_0x5b04('0x2e')]);_0x384a89['attributes']=_[_0x5b04('0x30')](_0x35ca15['model'],qs[_0x5b04('0x32')](_0x5c378f[_0x5b04('0x2e')]['fields']));_0x384a89[_0x5b04('0x31')]=_0x384a89['attributes'][_0x5b04('0x42')]?_0x384a89[_0x5b04('0x31')]:_0x35ca15[_0x5b04('0x2d')];if(_0x5c378f[_0x5b04('0x2e')][_0x5b04('0x43')]){_0x384a89['include']=[{'all':!![]}];}_0x384a89=_[_0x5b04('0x3a')]({},_0x384a89,_0x5c378f['options']);return db[_0x5b04('0x2a')][_0x5b04('0x44')](_0x384a89)[_0x5b04('0x20')](handleEntityNotFound(_0x2565ac,null))[_0x5b04('0x20')](respondWithResult(_0x2565ac,null))[_0x5b04('0x45')](handleError(_0x2565ac,null));};exports['create']=function(_0xb70c8d,_0x18af75){return db[_0x5b04('0x2a')][_0x5b04('0x46')](_0xb70c8d['body'],{})['then'](function(_0x249b32){var _0x51a6fa=_0xb70c8d[_0x5b04('0x47')]['get']({'plain':!![]});if(!_0x51a6fa)throw new Error(_0x5b04('0x48'));if(_0x51a6fa[_0x5b04('0x49')]===_0x5b04('0x47')){var _0x40a3c5=_0x249b32['get']({'plain':!![]});var _0x38d767=_0x5b04('0x22');return db[_0x5b04('0x4a')][_0x5b04('0x44')]({'where':{'name':_0x38d767,'userProfileId':_0x51a6fa[_0x5b04('0x4b')]},'raw':!![]})['then'](function(_0x198418){if(_0x198418&&_0x198418[_0x5b04('0x4c')]===0x0){return db[_0x5b04('0x23')]['create']({'name':_0x40a3c5[_0x5b04('0x27')],'resourceId':_0x40a3c5['id'],'type':_0x198418[_0x5b04('0x27')],'sectionId':_0x198418['id']},{})[_0x5b04('0x20')](function(){return _0x249b32;});}else{return _0x249b32;}})['catch'](function(_0x5e193b){logger[_0x5b04('0x25')](_0x5b04('0x4d'),_0x5e193b);throw _0x5e193b;});}return _0x249b32;})['then'](respondWithResult(_0x18af75,0xc9))[_0x5b04('0x45')](handleError(_0x18af75,null));};exports[_0x5b04('0x1e')]=function(_0x283923,_0x186933){if(_0x283923['body']['id']){delete _0x283923[_0x5b04('0x4e')]['id'];}return db[_0x5b04('0x2a')]['find']({'where':{'id':_0x283923[_0x5b04('0x41')]['id']}})[_0x5b04('0x20')](handleEntityNotFound(_0x186933,null))['then'](saveUpdates(_0x283923[_0x5b04('0x4e')],null))[_0x5b04('0x20')](respondWithResult(_0x186933,null))[_0x5b04('0x45')](handleError(_0x186933,null));};exports[_0x5b04('0x1f')]=function(_0x358009,_0x59e6c8){return db['AnalyticExtractedReport'][_0x5b04('0x44')]({'where':{'id':_0x358009['params']['id']}})[_0x5b04('0x20')](handleEntityNotFound(_0x59e6c8,null))[_0x5b04('0x20')](removeEntity(_0x59e6c8,null))[_0x5b04('0x45')](handleError(_0x59e6c8,null));};exports[_0x5b04('0x4f')]=function(_0x44c38f,_0x4aad62,_0x3f1a0c){return db[_0x5b04('0x2a')][_0x5b04('0x44')]({'where':{'id':_0x44c38f[_0x5b04('0x41')]['id']},'attributes':[_0x5b04('0x27'),_0x5b04('0x50'),_0x5b04('0x51'),_0x5b04('0x52')],'raw':!![]})[_0x5b04('0x20')](handleEntityNotFound(_0x4aad62,null))[_0x5b04('0x20')](function(_0x5f2493){if(_0x5f2493){if(!fs[_0x5b04('0x53')](path[_0x5b04('0x54')](config[_0x5b04('0x55')],_0x5b04('0x56'),_0x5f2493['savename']))){throw new db[(_0x5b04('0x57'))]['ValidationError'](_0x5b04('0x58'));}if(_0x44c38f[_0x5b04('0x2e')]['exists']){return _0x4aad62[_0x5b04('0x24')](0xc8);}return _0x4aad62[_0x5b04('0x4f')](path[_0x5b04('0x54')](config[_0x5b04('0x55')],'server/files/reports',_0x5f2493[_0x5b04('0x51')]),util[_0x5b04('0x59')](_0x5b04('0x5a'),_0x5f2493['basename']||_0x5f2493['name'],_0x5f2493[_0x5b04('0x52')]['toLowerCase']()));}})[_0x5b04('0x45')](handleError(_0x4aad62,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 2e30034..61e2565 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 _0xb807=['./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x8db8d5,_0x414a01){var _0x13c3af=function(_0xac8828){while(--_0xac8828){_0x8db8d5['push'](_0x8db8d5['shift']());}};_0x13c3af(++_0x414a01);}(_0xb807,0x18d));var _0x7b80=function(_0x5a2db8,_0x409f2a){_0x5a2db8=_0x5a2db8-0x0;var _0x28b4f8=_0xb807[_0x5a2db8];return _0x28b4f8;};'use strict';var _=require(_0x7b80('0x0'));var util=require(_0x7b80('0x1'));var logger=require(_0x7b80('0x2'))(_0x7b80('0x3'));var moment=require(_0x7b80('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b80('0x5'));var fs=require('fs');var path=require(_0x7b80('0x6'));var rimraf=require(_0x7b80('0x7'));var config=require(_0x7b80('0x8'));var attributes=require(_0x7b80('0x9'));module[_0x7b80('0xa')]=function(_0x5434b0,_0x47df1c){return _0x5434b0[_0x7b80('0xb')](_0x7b80('0xc'),attributes,{'tableName':_0x7b80('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x016b=['api','moment','bluebird','path','rimraf','./analyticExtractedReport.attributes','exports','define','lodash','../../config/logger'];(function(_0x1c11ae,_0x349971){var _0x49be85=function(_0x589de5){while(--_0x589de5){_0x1c11ae['push'](_0x1c11ae['shift']());}};_0x49be85(++_0x349971);}(_0x016b,0xda));var _0xb016=function(_0x4676e2,_0xabfc50){_0x4676e2=_0x4676e2-0x0;var _0x4faf60=_0x016b[_0x4676e2];return _0x4faf60;};'use strict';var _=require(_0xb016('0x0'));var util=require('util');var logger=require(_0xb016('0x1'))(_0xb016('0x2'));var moment=require(_0xb016('0x3'));var BPromise=require(_0xb016('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb016('0x5'));var rimraf=require(_0xb016('0x6'));var config=require('../../config/environment');var attributes=require(_0xb016('0x7'));module[_0xb016('0x8')]=function(_0xcd8d8a,_0x343c5e){return _0xcd8d8a[_0xb016('0x9')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index c9ef2f0..6f03e2c 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 _0x7c65=['rpc','../../config/environment','jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x372d01,_0x385fa7){var _0xfbf76=function(_0x54664f){while(--_0x54664f){_0x372d01['push'](_0x372d01['shift']());}};_0xfbf76(++_0x385fa7);}(_0x7c65,0x152));var _0x57c6=function(_0x160332,_0x2334d4){_0x160332=_0x160332-0x0;var _0x14b5cc=_0x7c65[_0x160332];return _0x14b5cc;};'use strict';var _=require(_0x57c6('0x0'));var util=require(_0x57c6('0x1'));var moment=require('moment');var BPromise=require(_0x57c6('0x2'));var rs=require(_0x57c6('0x3'));var fs=require('fs');var Redis=require(_0x57c6('0x4'));var db=require(_0x57c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x57c6('0x6'))(_0x57c6('0x7'));var config=require(_0x57c6('0x8'));var jayson=require(_0x57c6('0x9'));var client=jayson[_0x57c6('0xa')][_0x57c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dfa41,_0x46eb24,_0x27cb09){return new BPromise(function(_0x28f0a2,_0x3c6566){return client[_0x57c6('0xc')](_0x1dfa41,_0x27cb09)['then'](function(_0x397d8f){logger['info'](_0x57c6('0xd'),_0x46eb24,_0x57c6('0xe'));logger['debug'](_0x57c6('0xf'),_0x46eb24,'request\x20sent',JSON[_0x57c6('0x10')](_0x397d8f));if(_0x397d8f[_0x57c6('0x11')]){if(_0x397d8f[_0x57c6('0x11')][_0x57c6('0x12')]===0x1f4){logger[_0x57c6('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x46eb24,_0x397d8f['error']['message']);return _0x3c6566(_0x397d8f[_0x57c6('0x11')][_0x57c6('0x13')]);}logger[_0x57c6('0x11')](_0x57c6('0xd'),_0x46eb24,_0x397d8f[_0x57c6('0x11')]['message']);return _0x28f0a2(_0x397d8f[_0x57c6('0x11')][_0x57c6('0x13')]);}else{logger[_0x57c6('0x14')](_0x57c6('0xd'),_0x46eb24,'request\x20sent');_0x28f0a2(_0x397d8f[_0x57c6('0x15')][_0x57c6('0x13')]);}})[_0x57c6('0x16')](function(_0x595e54){logger[_0x57c6('0x11')](_0x57c6('0xd'),_0x46eb24,_0x595e54);_0x3c6566(_0x595e54);});});} \ No newline at end of file +var _0xc94e=['jayson/promise','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x299d27,_0x4cbc19){var _0x5692a1=function(_0x431513){while(--_0x431513){_0x299d27['push'](_0x299d27['shift']());}};_0x5692a1(++_0x4cbc19);}(_0xc94e,0x13d));var _0xec94=function(_0x340497,_0x4eab6a){_0x340497=_0x340497-0x0;var _0x18af09=_0xc94e[_0x340497];return _0x18af09;};'use strict';var _=require('lodash');var util=require(_0xec94('0x0'));var moment=require(_0xec94('0x1'));var BPromise=require('bluebird');var rs=require(_0xec94('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec94('0x3'))['db'];var utils=require(_0xec94('0x4'));var logger=require(_0xec94('0x5'))(_0xec94('0x6'));var config=require('../../config/environment');var jayson=require(_0xec94('0x7'));var client=jayson[_0xec94('0x8')][_0xec94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b780b,_0x2ce7e0,_0xd7d52b){return new BPromise(function(_0x43bcda,_0x2c53df){return client['request'](_0x1b780b,_0xd7d52b)[_0xec94('0xa')](function(_0x2c3cc2){logger['info'](_0xec94('0xb'),_0x2ce7e0,_0xec94('0xc'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2ce7e0,_0xec94('0xc'),JSON[_0xec94('0xd')](_0x2c3cc2));if(_0x2c3cc2[_0xec94('0xe')]){if(_0x2c3cc2[_0xec94('0xe')][_0xec94('0xf')]===0x1f4){logger[_0xec94('0xe')](_0xec94('0xb'),_0x2ce7e0,_0x2c3cc2[_0xec94('0xe')][_0xec94('0x10')]);return _0x2c53df(_0x2c3cc2[_0xec94('0xe')][_0xec94('0x10')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x2ce7e0,_0x2c3cc2[_0xec94('0xe')][_0xec94('0x10')]);return _0x43bcda(_0x2c3cc2[_0xec94('0xe')][_0xec94('0x10')]);}else{logger['info'](_0xec94('0xb'),_0x2ce7e0,'request\x20sent');_0x43bcda(_0x2c3cc2['result']['message']);}})[_0xec94('0x11')](function(_0xa2f4e7){logger[_0xec94('0xe')](_0xec94('0xb'),_0x2ce7e0,_0xa2f4e7);_0x2c53df(_0xa2f4e7);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 757d26f..83ddbeb 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 _0xe9fa=['isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2b0e68,_0x442b96){var _0x18fc85=function(_0x469eca){while(--_0x469eca){_0x2b0e68['push'](_0x2b0e68['shift']());}};_0x18fc85(++_0x442b96);}(_0xe9fa,0x160));var _0xae9f=function(_0x196e4b,_0x11601b){_0x196e4b=_0x196e4b-0x0;var _0x5d122a=_0xe9fa[_0x196e4b];return _0x5d122a;};'use strict';var multer=require('multer');var util=require(_0xae9f('0x0'));var path=require(_0xae9f('0x1'));var timeout=require(_0xae9f('0x2'));var express=require(_0xae9f('0x3'));var router=express['Router']();var auth=require(_0xae9f('0x4'));var interaction=require(_0xae9f('0x5'));var config=require(_0xae9f('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xae9f('0x7')]('/',auth[_0xae9f('0x8')](),controller[_0xae9f('0x9')]);router[_0xae9f('0x7')](_0xae9f('0xa'),auth[_0xae9f('0x8')](),controller[_0xae9f('0xb')]);router[_0xae9f('0x7')](_0xae9f('0xc'),auth[_0xae9f('0x8')](),controller[_0xae9f('0xd')]);router[_0xae9f('0xe')]('/',auth[_0xae9f('0x8')](),controller['create']);router[_0xae9f('0xf')](_0xae9f('0xa'),auth['isAuthenticated'](),controller[_0xae9f('0x10')]);router[_0xae9f('0x11')](_0xae9f('0xa'),auth[_0xae9f('0x8')](),controller[_0xae9f('0x12')]);module[_0xae9f('0x13')]=router; \ No newline at end of file +var _0x0404=['download','create','put','update','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id/download'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x0404,0xf4));var _0x4040=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x0404[_0x28578d];return _0x524826;};'use strict';var multer=require('multer');var util=require(_0x4040('0x0'));var path=require(_0x4040('0x1'));var timeout=require(_0x4040('0x2'));var express=require(_0x4040('0x3'));var router=express[_0x4040('0x4')]();var auth=require(_0x4040('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4040('0x6'));var controller=require(_0x4040('0x7'));router[_0x4040('0x8')]('/',auth[_0x4040('0x9')](),controller['index']);router[_0x4040('0x8')]('/:id',auth[_0x4040('0x9')](),controller['show']);router['get'](_0x4040('0xa'),auth[_0x4040('0x9')](),controller[_0x4040('0xb')]);router['post']('/',auth[_0x4040('0x9')](),controller[_0x4040('0xc')]);router[_0x4040('0xd')]('/:id',auth[_0x4040('0x9')](),controller[_0x4040('0xe')]);router['delete'](_0x4040('0xf'),auth[_0x4040('0x9')](),controller['destroy']);module[_0x4040('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index dd7a2ac..2d96f19 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 _0xe14b=['sequelize','exports','STRING'];(function(_0xd3b185,_0x21a931){var _0xe5a1c9=function(_0x3b6d35){while(--_0x3b6d35){_0xd3b185['push'](_0xd3b185['shift']());}};_0xe5a1c9(++_0x21a931);}(_0xe14b,0x93));var _0xbe14=function(_0x371489,_0x2b2286){_0x371489=_0x371489-0x0;var _0x2d3deb=_0xe14b[_0x371489];return _0x2d3deb;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x2def39,_0x4f9f5b){var _0x1fe9d2=function(_0x48f629){while(--_0x48f629){_0x2def39['push'](_0x2def39['shift']());}};_0x1fe9d2(++_0x4f9f5b);}(_0x1261,0x144));var _0x1126=function(_0x44044a,_0x3a0097){_0x44044a=_0x44044a-0x0;var _0x43bb6e=_0x1261[_0x44044a];return _0x43bb6e;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index dd6dcf0..7572f61 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 _0xd91d=['keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','catch','show','rawAttributes','includeAll','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','sequelize','CustomReportId','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','json','apply','save','update','then','destroy','end','error','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xd91d,0x71));var _0xdd91=function(_0x58a82b,_0x29c7a5){_0x58a82b=_0x58a82b-0x0;var _0x106159=_0xd91d[_0x58a82b];return _0x106159;};'use strict';var pdf=require(_0xdd91('0x0'));var emlformat=require(_0xdd91('0x1'));var rimraf=require(_0xdd91('0x2'));var zipdir=require(_0xdd91('0x3'));var jsonpatch=require(_0xdd91('0x4'));var rp=require(_0xdd91('0x5'));var moment=require(_0xdd91('0x6'));var BPromise=require(_0xdd91('0x7'));var Mustache=require(_0xdd91('0x8'));var util=require(_0xdd91('0x9'));var path=require('path');var sox=require(_0xdd91('0xa'));var csv=require(_0xdd91('0xb'));var ejs=require(_0xdd91('0xc'));var fs=require('fs');var _=require(_0xdd91('0xd'));var squel=require(_0xdd91('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd91('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdd91('0x10'));var Papa=require(_0xdd91('0x11'));var Redis=require(_0xdd91('0x12'));var authService=require(_0xdd91('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdd91('0x14'));var hardwareService=require(_0xdd91('0x15'));var logger=require(_0xdd91('0x16'))('api');var utils=require(_0xdd91('0x17'));var config=require(_0xdd91('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x241d37,_0x4b87e9){_0x4b87e9=_0x4b87e9||0xcc;return function(_0x31947f){if(_0x31947f){return _0x241d37[_0xdd91('0x19')](_0x4b87e9);}return _0x241d37[_0xdd91('0x1a')](_0x4b87e9)['end']();};}function respondWithResult(_0x2ccc7f,_0x276aa7){_0x276aa7=_0x276aa7||0xc8;return function(_0x2b0311){if(_0x2b0311){return _0x2ccc7f['status'](_0x276aa7)['json'](_0x2b0311);}};}function respondWithFilteredResult(_0x3c919d,_0x29ada4){return function(_0x71df76){if(_0x71df76){var _0x5971d2=_0x71df76[_0xdd91('0x1b')],_0x177658=_0x29ada4['offset'],_0x420cdf=_0x29ada4[_0xdd91('0x1c')]+_0x29ada4[_0xdd91('0x1d')],_0x1e7879;if(_0x420cdf>=_0x5971d2){_0x420cdf=_0x5971d2;_0x1e7879=0xc8;}else{_0x1e7879=0xce;}_0x3c919d['status'](_0x1e7879);return _0x3c919d[_0xdd91('0x1e')]('Content-Range',_0x177658+'-'+_0x420cdf+'/'+_0x5971d2)[_0xdd91('0x1f')](_0x71df76);}return null;};}function patchUpdates(_0x3e957d){return function(_0x23f432){try{jsonpatch[_0xdd91('0x20')](_0x23f432,_0x3e957d,!![]);}catch(_0x446cdb){return BPromise['reject'](_0x446cdb);}return _0x23f432[_0xdd91('0x21')]();};}function saveUpdates(_0x2c8926,_0x25cc99){return function(_0x4a90d9){if(_0x4a90d9){return _0x4a90d9[_0xdd91('0x22')](_0x2c8926)[_0xdd91('0x23')](function(_0x3fec6f){return _0x3fec6f;});}return null;};}function removeEntity(_0x4b3cdf,_0x500d5f){return function(_0x4a4ac9){if(_0x4a4ac9){return _0x4a4ac9[_0xdd91('0x24')]()['then'](function(){_0x4b3cdf[_0xdd91('0x1a')](0xcc)[_0xdd91('0x25')]();});}};}function handleEntityNotFound(_0x585fc4,_0xa6dcd2){return function(_0x15f606){if(!_0x15f606){_0x585fc4[_0xdd91('0x19')](0x194);}return _0x15f606;};}function handleError(_0x24328c,_0x378a69){_0x378a69=_0x378a69||0x1f4;return function(_0x55933f){logger[_0xdd91('0x26')](_0x55933f['stack']);if(_0x55933f[_0xdd91('0x27')]){delete _0x55933f[_0xdd91('0x27')];}_0x24328c[_0xdd91('0x1a')](_0x378a69)[_0xdd91('0x28')](_0x55933f);};}exports[_0xdd91('0x29')]=function(_0x5cc93b,_0x3854f1){var _0x139880={},_0x54ec5a={},_0x29bd1b={'count':0x0,'rows':[]};var _0x6cb458=_[_0xdd91('0x2a')](db[_0xdd91('0x2b')]['rawAttributes'],function(_0xf3fe48){return{'name':_0xf3fe48[_0xdd91('0x2c')],'type':_0xf3fe48[_0xdd91('0x2d')][_0xdd91('0x2e')]};});_0x54ec5a[_0xdd91('0x2f')]=_['map'](_0x6cb458,'name');_0x54ec5a[_0xdd91('0x30')]=_[_0xdd91('0x31')](_0x5cc93b['query']);_0x54ec5a['filters']=_['intersection'](_0x54ec5a[_0xdd91('0x2f')],_0x54ec5a['query']);_0x139880[_0xdd91('0x32')]=_[_0xdd91('0x33')](_0x54ec5a[_0xdd91('0x2f')],qs[_0xdd91('0x34')](_0x5cc93b[_0xdd91('0x30')]['fields']));_0x139880['attributes']=_0x139880[_0xdd91('0x32')][_0xdd91('0x35')]?_0x139880['attributes']:_0x54ec5a[_0xdd91('0x2f')];if(!_0x5cc93b[_0xdd91('0x30')][_0xdd91('0x36')](_0xdd91('0x37'))){_0x139880['limit']=qs[_0xdd91('0x1d')](_0x5cc93b[_0xdd91('0x30')][_0xdd91('0x1d')]);_0x139880['offset']=qs[_0xdd91('0x1c')](_0x5cc93b[_0xdd91('0x30')][_0xdd91('0x1c')]);}_0x139880[_0xdd91('0x38')]=qs['sort'](_0x5cc93b[_0xdd91('0x30')][_0xdd91('0x39')]);_0x139880['where']=qs[_0xdd91('0x3a')](_[_0xdd91('0x3b')](_0x5cc93b[_0xdd91('0x30')],_0x54ec5a[_0xdd91('0x3a')]),_0x6cb458);if(_0x5cc93b['query'][_0xdd91('0x3c')]){_0x139880[_0xdd91('0x3d')]=_[_0xdd91('0x3e')](_0x139880['where'],{'$or':_[_0xdd91('0x2a')](_0x6cb458,function(_0x412328){if(_0x412328['type']!==_0xdd91('0x3f')){var _0xa66f30={};_0xa66f30[_0x412328[_0xdd91('0x27')]]={'$like':'%'+_0x5cc93b[_0xdd91('0x30')][_0xdd91('0x3c')]+'%'};return _0xa66f30;}})});}_0x139880=_['merge']({},_0x139880,_0x5cc93b[_0xdd91('0x40')]);var _0x513eb9={'where':_0x139880['where']};return db[_0xdd91('0x2b')]['count'](_0x513eb9)['then'](function(_0x48663d){_0x29bd1b['count']=_0x48663d;if(_0x5cc93b['query']['includeAll']){_0x139880[_0xdd91('0x41')]=[{'all':!![]}];}return db[_0xdd91('0x2b')]['findAll'](_0x139880);})[_0xdd91('0x23')](function(_0x43be27){_0x29bd1b['rows']=_0x43be27;return _0x29bd1b;})[_0xdd91('0x23')](respondWithFilteredResult(_0x3854f1,_0x139880))[_0xdd91('0x42')](handleError(_0x3854f1,null));};exports[_0xdd91('0x43')]=function(_0x5c3c8f,_0x3d3069){var _0x3c21f4={'raw':![],'where':{'id':_0x5c3c8f['params']['id']}},_0x4e70c2={};_0x4e70c2['model']=_[_0xdd91('0x31')](db[_0xdd91('0x2b')][_0xdd91('0x44')]);_0x4e70c2[_0xdd91('0x30')]=_[_0xdd91('0x31')](_0x5c3c8f[_0xdd91('0x30')]);_0x4e70c2[_0xdd91('0x3a')]=_[_0xdd91('0x33')](_0x4e70c2[_0xdd91('0x2f')],_0x4e70c2[_0xdd91('0x30')]);_0x3c21f4[_0xdd91('0x32')]=_[_0xdd91('0x33')](_0x4e70c2[_0xdd91('0x2f')],qs[_0xdd91('0x34')](_0x5c3c8f[_0xdd91('0x30')][_0xdd91('0x34')]));_0x3c21f4[_0xdd91('0x32')]=_0x3c21f4[_0xdd91('0x32')][_0xdd91('0x35')]?_0x3c21f4[_0xdd91('0x32')]:_0x4e70c2['model'];if(_0x5c3c8f[_0xdd91('0x30')][_0xdd91('0x45')]){_0x3c21f4[_0xdd91('0x41')]=[{'all':!![]}];}_0x3c21f4=_[_0xdd91('0x3e')]({},_0x3c21f4,_0x5c3c8f[_0xdd91('0x40')]);return db[_0xdd91('0x2b')][_0xdd91('0x46')](_0x3c21f4)[_0xdd91('0x23')](handleEntityNotFound(_0x3d3069,null))['then'](respondWithResult(_0x3d3069,null))[_0xdd91('0x42')](handleError(_0x3d3069,null));};exports[_0xdd91('0x47')]=function(_0x4c5b01,_0x6ae21d){return db[_0xdd91('0x2b')][_0xdd91('0x47')](_0x4c5b01[_0xdd91('0x48')],{})[_0xdd91('0x23')](respondWithResult(_0x6ae21d,0xc9))[_0xdd91('0x42')](handleError(_0x6ae21d,null));};exports[_0xdd91('0x49')]=function(_0x4c4abc,_0x259bb4){return db[_0xdd91('0x2b')]['bulkCreate'](_0x4c4abc[_0xdd91('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x259bb4,0xc9))[_0xdd91('0x42')](handleError(_0x259bb4,null));};exports[_0xdd91('0x22')]=function(_0x26f043,_0x3be113){if(_0x26f043[_0xdd91('0x48')]['id']){delete _0x26f043[_0xdd91('0x48')]['id'];}return db[_0xdd91('0x2b')][_0xdd91('0x46')]({'where':{'id':_0x26f043[_0xdd91('0x4a')]['id']}})[_0xdd91('0x23')](handleEntityNotFound(_0x3be113,null))[_0xdd91('0x23')](saveUpdates(_0x26f043[_0xdd91('0x48')],null))[_0xdd91('0x23')](respondWithResult(_0x3be113,null))[_0xdd91('0x42')](handleError(_0x3be113,null));};exports['destroy']=function(_0x1ce4fb,_0xb81bde){return db[_0xdd91('0x2b')][_0xdd91('0x46')]({'where':{'id':_0x1ce4fb[_0xdd91('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb81bde,null))[_0xdd91('0x23')](removeEntity(_0xb81bde,null))[_0xdd91('0x42')](handleError(_0xb81bde,null));};exports[_0xdd91('0x4b')]=function(_0x2fc872,_0x91e7e9){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x2fc872[_0xdd91('0x30')][_0xdd91('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xdd91('0x23')](respondWithResult(_0x91e7e9,0xcc))['catch'](handleError(_0x91e7e9,null));};exports[_0xdd91('0x4d')]=function(_0x509c00,_0x1cc23d,_0x2ee546){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x509c00['params']['id']}})['then'](handleEntityNotFound(_0x1cc23d,null))['then'](function(_0x3d0c22){if(_0x3d0c22){return db[_0xdd91('0x4e')]['transaction'](function(_0x45a8f8){return db[_0xdd91('0x2b')][_0xdd91('0x24')]({'where':{'CustomReportId':_0x509c00[_0xdd91('0x4a')]['id']},'transaction':_0x45a8f8})[_0xdd91('0x23')](function(_0x2b34d8){var _0x3c703b=_[_0xdd91('0x2a')](_0x509c00[_0xdd91('0x48')],function(_0x2ea895){delete _0x2ea895['id'];_0x2ea895[_0xdd91('0x4f')]=_0x509c00[_0xdd91('0x4a')]['id'];return _0x2ea895;});return db['AnalyticFieldReport'][_0xdd91('0x49')](_0x3c703b,{'transaction':_0x45a8f8});});})[_0xdd91('0x23')](function(){return db[_0xdd91('0x2b')][_0xdd91('0x50')]({'where':{'CustomReportId':_0x509c00['params']['id']}});});}})[_0xdd91('0x23')](respondWithResult(_0x1cc23d,null))[_0xdd91('0x42')](handleError(_0x1cc23d,null));}; \ No newline at end of file +var _0x4bd0=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','then','catch','show','params','rawAttributes','find','create','body','bulkCreate','ids','AnalyticCustomReport','findOne','sequelize','CustomReportId','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','error','name','send','index','map','AnalyticFieldReport','fieldName','key','query','keys','filters','intersection','model','fields'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4bd0,0x15d));var _0x04bd=function(_0x513119,_0x425e6f){_0x513119=_0x513119-0x0;var _0x587511=_0x4bd0[_0x513119];return _0x587511;};'use strict';var pdf=require(_0x04bd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x04bd('0x1'));var zipdir=require(_0x04bd('0x2'));var jsonpatch=require(_0x04bd('0x3'));var rp=require(_0x04bd('0x4'));var moment=require(_0x04bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x04bd('0x6'));var util=require(_0x04bd('0x7'));var path=require(_0x04bd('0x8'));var sox=require('sox');var csv=require(_0x04bd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x04bd('0xa'));var squel=require(_0x04bd('0xb'));var crypto=require('crypto');var jsforce=require(_0x04bd('0xc'));var deskjs=require(_0x04bd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x04bd('0xe'));var Papa=require(_0x04bd('0xf'));var Redis=require(_0x04bd('0x10'));var authService=require(_0x04bd('0x11'));var qs=require(_0x04bd('0x12'));var as=require(_0x04bd('0x13'));var hardwareService=require(_0x04bd('0x14'));var logger=require(_0x04bd('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x04bd('0x16'));var db=require(_0x04bd('0x17'))['db'];function respondWithStatusCode(_0x510d2d,_0x5136a2){_0x5136a2=_0x5136a2||0xcc;return function(_0x4c00e7){if(_0x4c00e7){return _0x510d2d[_0x04bd('0x18')](_0x5136a2);}return _0x510d2d['status'](_0x5136a2)[_0x04bd('0x19')]();};}function respondWithResult(_0x91a9a0,_0x4b6d87){_0x4b6d87=_0x4b6d87||0xc8;return function(_0x57a226){if(_0x57a226){return _0x91a9a0[_0x04bd('0x1a')](_0x4b6d87)[_0x04bd('0x1b')](_0x57a226);}};}function respondWithFilteredResult(_0x1fae0e,_0x2a132d){return function(_0x30d277){if(_0x30d277){var _0x1cde29=_0x30d277[_0x04bd('0x1c')],_0x4eb05f=_0x2a132d[_0x04bd('0x1d')],_0x51a86f=_0x2a132d[_0x04bd('0x1d')]+_0x2a132d[_0x04bd('0x1e')],_0x1b8a66;if(_0x51a86f>=_0x1cde29){_0x51a86f=_0x1cde29;_0x1b8a66=0xc8;}else{_0x1b8a66=0xce;}_0x1fae0e[_0x04bd('0x1a')](_0x1b8a66);return _0x1fae0e[_0x04bd('0x1f')](_0x04bd('0x20'),_0x4eb05f+'-'+_0x51a86f+'/'+_0x1cde29)['json'](_0x30d277);}return null;};}function patchUpdates(_0x15728f){return function(_0x543c0f){try{jsonpatch[_0x04bd('0x21')](_0x543c0f,_0x15728f,!![]);}catch(_0x554bbf){return BPromise['reject'](_0x554bbf);}return _0x543c0f[_0x04bd('0x22')]();};}function saveUpdates(_0x4f2357,_0x2bea5d){return function(_0x225819){if(_0x225819){return _0x225819[_0x04bd('0x23')](_0x4f2357)['then'](function(_0x1fc06f){return _0x1fc06f;});}return null;};}function removeEntity(_0x51ee2f,_0x4ecb16){return function(_0x51e9b5){if(_0x51e9b5){return _0x51e9b5[_0x04bd('0x24')]()['then'](function(){_0x51ee2f[_0x04bd('0x1a')](0xcc)[_0x04bd('0x19')]();});}};}function handleEntityNotFound(_0x3ebd20,_0x2954b0){return function(_0x3ab13b){if(!_0x3ab13b){_0x3ebd20[_0x04bd('0x18')](0x194);}return _0x3ab13b;};}function handleError(_0x33ae2e,_0x27c9c3){_0x27c9c3=_0x27c9c3||0x1f4;return function(_0x5f3c71){logger[_0x04bd('0x25')](_0x5f3c71['stack']);if(_0x5f3c71[_0x04bd('0x26')]){delete _0x5f3c71[_0x04bd('0x26')];}_0x33ae2e['status'](_0x27c9c3)[_0x04bd('0x27')](_0x5f3c71);};}exports[_0x04bd('0x28')]=function(_0x48e92a,_0x47e025){var _0x25fbf4={},_0x516b45={},_0x27465d={'count':0x0,'rows':[]};var _0x558dc4=_[_0x04bd('0x29')](db[_0x04bd('0x2a')]['rawAttributes'],function(_0xe080be){return{'name':_0xe080be[_0x04bd('0x2b')],'type':_0xe080be['type'][_0x04bd('0x2c')]};});_0x516b45['model']=_[_0x04bd('0x29')](_0x558dc4,_0x04bd('0x26'));_0x516b45[_0x04bd('0x2d')]=_[_0x04bd('0x2e')](_0x48e92a[_0x04bd('0x2d')]);_0x516b45[_0x04bd('0x2f')]=_[_0x04bd('0x30')](_0x516b45['model'],_0x516b45[_0x04bd('0x2d')]);_0x25fbf4['attributes']=_['intersection'](_0x516b45[_0x04bd('0x31')],qs['fields'](_0x48e92a[_0x04bd('0x2d')][_0x04bd('0x32')]));_0x25fbf4[_0x04bd('0x33')]=_0x25fbf4[_0x04bd('0x33')][_0x04bd('0x34')]?_0x25fbf4['attributes']:_0x516b45[_0x04bd('0x31')];if(!_0x48e92a[_0x04bd('0x2d')][_0x04bd('0x35')](_0x04bd('0x36'))){_0x25fbf4['limit']=qs['limit'](_0x48e92a[_0x04bd('0x2d')][_0x04bd('0x1e')]);_0x25fbf4[_0x04bd('0x1d')]=qs[_0x04bd('0x1d')](_0x48e92a[_0x04bd('0x2d')]['offset']);}_0x25fbf4[_0x04bd('0x37')]=qs['sort'](_0x48e92a[_0x04bd('0x2d')][_0x04bd('0x38')]);_0x25fbf4['where']=qs['filters'](_[_0x04bd('0x39')](_0x48e92a['query'],_0x516b45['filters']),_0x558dc4);if(_0x48e92a[_0x04bd('0x2d')][_0x04bd('0x3a')]){_0x25fbf4[_0x04bd('0x3b')]=_['merge'](_0x25fbf4[_0x04bd('0x3b')],{'$or':_[_0x04bd('0x29')](_0x558dc4,function(_0x38050e){if(_0x38050e[_0x04bd('0x3c')]!==_0x04bd('0x3d')){var _0x2db7eb={};_0x2db7eb[_0x38050e[_0x04bd('0x26')]]={'$like':'%'+_0x48e92a['query'][_0x04bd('0x3a')]+'%'};return _0x2db7eb;}})});}_0x25fbf4=_[_0x04bd('0x3e')]({},_0x25fbf4,_0x48e92a[_0x04bd('0x3f')]);var _0xdb123d={'where':_0x25fbf4[_0x04bd('0x3b')]};return db[_0x04bd('0x2a')][_0x04bd('0x1c')](_0xdb123d)['then'](function(_0x4e4902){_0x27465d[_0x04bd('0x1c')]=_0x4e4902;if(_0x48e92a[_0x04bd('0x2d')]['includeAll']){_0x25fbf4[_0x04bd('0x40')]=[{'all':!![]}];}return db[_0x04bd('0x2a')][_0x04bd('0x41')](_0x25fbf4);})[_0x04bd('0x42')](function(_0x17f58e){_0x27465d['rows']=_0x17f58e;return _0x27465d;})[_0x04bd('0x42')](respondWithFilteredResult(_0x47e025,_0x25fbf4))[_0x04bd('0x43')](handleError(_0x47e025,null));};exports[_0x04bd('0x44')]=function(_0x48c4f1,_0x2a4a41){var _0x3f067e={'raw':![],'where':{'id':_0x48c4f1[_0x04bd('0x45')]['id']}},_0x250d73={};_0x250d73[_0x04bd('0x31')]=_[_0x04bd('0x2e')](db[_0x04bd('0x2a')][_0x04bd('0x46')]);_0x250d73[_0x04bd('0x2d')]=_['keys'](_0x48c4f1[_0x04bd('0x2d')]);_0x250d73[_0x04bd('0x2f')]=_[_0x04bd('0x30')](_0x250d73['model'],_0x250d73[_0x04bd('0x2d')]);_0x3f067e[_0x04bd('0x33')]=_[_0x04bd('0x30')](_0x250d73[_0x04bd('0x31')],qs[_0x04bd('0x32')](_0x48c4f1['query'][_0x04bd('0x32')]));_0x3f067e[_0x04bd('0x33')]=_0x3f067e[_0x04bd('0x33')][_0x04bd('0x34')]?_0x3f067e[_0x04bd('0x33')]:_0x250d73[_0x04bd('0x31')];if(_0x48c4f1[_0x04bd('0x2d')]['includeAll']){_0x3f067e[_0x04bd('0x40')]=[{'all':!![]}];}_0x3f067e=_[_0x04bd('0x3e')]({},_0x3f067e,_0x48c4f1['options']);return db[_0x04bd('0x2a')][_0x04bd('0x47')](_0x3f067e)[_0x04bd('0x42')](handleEntityNotFound(_0x2a4a41,null))[_0x04bd('0x42')](respondWithResult(_0x2a4a41,null))[_0x04bd('0x43')](handleError(_0x2a4a41,null));};exports[_0x04bd('0x48')]=function(_0x38ba83,_0x2bc4da){return db['AnalyticFieldReport'][_0x04bd('0x48')](_0x38ba83[_0x04bd('0x49')],{})[_0x04bd('0x42')](respondWithResult(_0x2bc4da,0xc9))['catch'](handleError(_0x2bc4da,null));};exports[_0x04bd('0x4a')]=function(_0x1a892c,_0x189ae7){return db['AnalyticFieldReport'][_0x04bd('0x4a')](_0x1a892c[_0x04bd('0x49')],{'raw':![],'individualHooks':!![]})[_0x04bd('0x42')](respondWithResult(_0x189ae7,0xc9))['catch'](handleError(_0x189ae7,null));};exports[_0x04bd('0x23')]=function(_0x55ede8,_0x5e3ac0){if(_0x55ede8['body']['id']){delete _0x55ede8['body']['id'];}return db['AnalyticFieldReport'][_0x04bd('0x47')]({'where':{'id':_0x55ede8['params']['id']}})[_0x04bd('0x42')](handleEntityNotFound(_0x5e3ac0,null))['then'](saveUpdates(_0x55ede8['body'],null))[_0x04bd('0x42')](respondWithResult(_0x5e3ac0,null))['catch'](handleError(_0x5e3ac0,null));};exports[_0x04bd('0x24')]=function(_0x3dd80c,_0xf9f3ca){return db[_0x04bd('0x2a')][_0x04bd('0x47')]({'where':{'id':_0x3dd80c[_0x04bd('0x45')]['id']}})[_0x04bd('0x42')](handleEntityNotFound(_0xf9f3ca,null))[_0x04bd('0x42')](removeEntity(_0xf9f3ca,null))[_0x04bd('0x43')](handleError(_0xf9f3ca,null));};exports['bulkDestroy']=function(_0x38f41e,_0x3559ee){return db['AnalyticFieldReport'][_0x04bd('0x24')]({'where':{'id':_0x38f41e[_0x04bd('0x2d')][_0x04bd('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3559ee,0xcc))[_0x04bd('0x43')](handleError(_0x3559ee,null));};exports['addFields']=function(_0xf8759a,_0x22bd1d,_0x5e534d){return db[_0x04bd('0x4c')][_0x04bd('0x4d')]({'where':{'id':_0xf8759a['params']['id']}})[_0x04bd('0x42')](handleEntityNotFound(_0x22bd1d,null))['then'](function(_0x56f5ae){if(_0x56f5ae){return db[_0x04bd('0x4e')]['transaction'](function(_0xc6d4e6){return db[_0x04bd('0x2a')][_0x04bd('0x24')]({'where':{'CustomReportId':_0xf8759a[_0x04bd('0x45')]['id']},'transaction':_0xc6d4e6})[_0x04bd('0x42')](function(_0xe8b124){var _0x26c979=_[_0x04bd('0x29')](_0xf8759a[_0x04bd('0x49')],function(_0x4faac1){delete _0x4faac1['id'];_0x4faac1[_0x04bd('0x4f')]=_0xf8759a[_0x04bd('0x45')]['id'];return _0x4faac1;});return db[_0x04bd('0x2a')][_0x04bd('0x4a')](_0x26c979,{'transaction':_0xc6d4e6});});})['then'](function(){return db[_0x04bd('0x2a')]['findAll']({'where':{'CustomReportId':_0xf8759a[_0x04bd('0x45')]['id']}});});}})['then'](respondWithResult(_0x22bd1d,null))[_0x04bd('0x43')](handleError(_0x22bd1d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c56ef7b..fbb2d97 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 _0x1921=['exports','define','analytics_report_fields','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x1921,0x158));var _0x1192=function(_0x52da25,_0x19dfc3){_0x52da25=_0x52da25-0x0;var _0x135a8f=_0x1921[_0x52da25];return _0x135a8f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1192('0x0'))(_0x1192('0x1'));var moment=require(_0x1192('0x2'));var BPromise=require(_0x1192('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1192('0x4'));var rimraf=require(_0x1192('0x5'));var config=require(_0x1192('0x6'));var attributes=require(_0x1192('0x7'));module[_0x1192('0x8')]=function(_0x30f854,_0x14d1fc){return _0x30f854[_0x1192('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x1192('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6804=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x52fcc9,_0x559a63){var _0x1fa6af=function(_0x590cfe){while(--_0x590cfe){_0x52fcc9['push'](_0x52fcc9['shift']());}};_0x1fa6af(++_0x559a63);}(_0x6804,0x124));var _0x4680=function(_0x248979,_0x473389){_0x248979=_0x248979-0x0;var _0x5c4d8d=_0x6804[_0x248979];return _0x5c4d8d;};'use strict';var _=require(_0x4680('0x0'));var util=require(_0x4680('0x1'));var logger=require(_0x4680('0x2'))(_0x4680('0x3'));var moment=require(_0x4680('0x4'));var BPromise=require(_0x4680('0x5'));var rp=require(_0x4680('0x6'));var fs=require('fs');var path=require(_0x4680('0x7'));var rimraf=require(_0x4680('0x8'));var config=require(_0x4680('0x9'));var attributes=require('./analyticFieldReport.attributes');module[_0x4680('0xa')]=function(_0x2f9bd3,_0x1d1151){return _0x2f9bd3[_0x4680('0xb')](_0x4680('0xc'),attributes,{'tableName':_0x4680('0xd'),'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 dec23ae..a644a28 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 _0xc512=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x19feb5,_0x25f918){var _0x185339=function(_0x12ea4b){while(--_0x12ea4b){_0x19feb5['push'](_0x19feb5['shift']());}};_0x185339(++_0x25f918);}(_0xc512,0x161));var _0x2c51=function(_0xf7b425,_0x4e8416){_0xf7b425=_0xf7b425-0x0;var _0x2a16ba=_0xc512[_0xf7b425];return _0x2a16ba;};'use strict';var _=require(_0x2c51('0x0'));var util=require(_0x2c51('0x1'));var moment=require(_0x2c51('0x2'));var BPromise=require(_0x2c51('0x3'));var rs=require(_0x2c51('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2c51('0x5'))['db'];var utils=require(_0x2c51('0x6'));var logger=require(_0x2c51('0x7'))('rpc');var config=require(_0x2c51('0x8'));var jayson=require(_0x2c51('0x9'));var client=jayson[_0x2c51('0xa')][_0x2c51('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe6fe74,_0x1158f1,_0x30db09){return new BPromise(function(_0x1586cb,_0x29683a){return client[_0x2c51('0xc')](_0xe6fe74,_0x30db09)[_0x2c51('0xd')](function(_0xad9b7a){logger[_0x2c51('0xe')](_0x2c51('0xf'),_0x1158f1,_0x2c51('0x10'));logger[_0x2c51('0x11')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x1158f1,_0x2c51('0x10'),JSON[_0x2c51('0x12')](_0xad9b7a));if(_0xad9b7a[_0x2c51('0x13')]){if(_0xad9b7a[_0x2c51('0x13')][_0x2c51('0x14')]===0x1f4){logger[_0x2c51('0x13')](_0x2c51('0xf'),_0x1158f1,_0xad9b7a[_0x2c51('0x13')]['message']);return _0x29683a(_0xad9b7a[_0x2c51('0x13')][_0x2c51('0x15')]);}logger[_0x2c51('0x13')](_0x2c51('0xf'),_0x1158f1,_0xad9b7a[_0x2c51('0x13')]['message']);return _0x1586cb(_0xad9b7a['error']['message']);}else{logger[_0x2c51('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1158f1,_0x2c51('0x10'));_0x1586cb(_0xad9b7a[_0x2c51('0x16')]['message']);}})[_0x2c51('0x17')](function(_0x4b47e5){logger[_0x2c51('0x13')](_0x2c51('0xf'),_0x1158f1,_0x4b47e5);_0x29683a(_0x4b47e5);});});} \ No newline at end of file +var _0x0b87=['info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3fb5a2,_0x2b6729){var _0x5e1be9=function(_0x128e6e){while(--_0x128e6e){_0x3fb5a2['push'](_0x3fb5a2['shift']());}};_0x5e1be9(++_0x2b6729);}(_0x0b87,0x15a));var _0x70b8=function(_0x127d61,_0x4e4c25){_0x127d61=_0x127d61-0x0;var _0x3e52bf=_0x0b87[_0x127d61];return _0x3e52bf;};'use strict';var _=require(_0x70b8('0x0'));var util=require(_0x70b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x70b8('0x2'));var fs=require('fs');var Redis=require(_0x70b8('0x3'));var db=require(_0x70b8('0x4'))['db'];var utils=require(_0x70b8('0x5'));var logger=require(_0x70b8('0x6'))(_0x70b8('0x7'));var config=require(_0x70b8('0x8'));var jayson=require(_0x70b8('0x9'));var client=jayson[_0x70b8('0xa')][_0x70b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a05e4,_0x1bc292,_0x519223){return new BPromise(function(_0x4ed6de,_0x22d9c9){return client[_0x70b8('0xc')](_0x4a05e4,_0x519223)[_0x70b8('0xd')](function(_0x539f0e){logger[_0x70b8('0xe')](_0x70b8('0xf'),_0x1bc292,_0x70b8('0x10'));logger[_0x70b8('0x11')](_0x70b8('0x12'),_0x1bc292,_0x70b8('0x10'),JSON[_0x70b8('0x13')](_0x539f0e));if(_0x539f0e[_0x70b8('0x14')]){if(_0x539f0e[_0x70b8('0x14')][_0x70b8('0x15')]===0x1f4){logger[_0x70b8('0x14')](_0x70b8('0xf'),_0x1bc292,_0x539f0e[_0x70b8('0x14')][_0x70b8('0x16')]);return _0x22d9c9(_0x539f0e['error'][_0x70b8('0x16')]);}logger[_0x70b8('0x14')](_0x70b8('0xf'),_0x1bc292,_0x539f0e[_0x70b8('0x14')][_0x70b8('0x16')]);return _0x4ed6de(_0x539f0e['error'][_0x70b8('0x16')]);}else{logger['info'](_0x70b8('0xf'),_0x1bc292,'request\x20sent');_0x4ed6de(_0x539f0e['result'][_0x70b8('0x16')]);}})[_0x70b8('0x17')](function(_0x1b7f0c){logger[_0x70b8('0x14')](_0x70b8('0xf'),_0x1bc292,_0x1b7f0c);_0x22d9c9(_0x1b7f0c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a4f738d..3ff6dca 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 _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x55ca,0x126));var _0xa55c=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x55ca[_0x77d310];return _0x2cdce4;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x304386,_0x319535){var _0x2696b2=function(_0x8a098){while(--_0x8a098){_0x304386['push'](_0x304386['shift']());}};_0x2696b2(++_0x319535);}(_0xe14b,0x93));var _0xbe14=function(_0x51b46e,_0x4cf1a5){_0x51b46e=_0x51b46e-0x0;var _0x2ff5a1=_0xe14b[_0x51b46e];return _0x2ff5a1;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 851ac97..eaa3b38 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 _0x0efe=['STRING','TEXT','sequelize','exports','name'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0x0efe,0x110));var _0xe0ef=function(_0x462ab8,_0x8d6fc4){_0x462ab8=_0x462ab8-0x0;var _0x4c8f96=_0x0efe[_0x462ab8];return _0x4c8f96;};'use strict';var Sequelize=require(_0xe0ef('0x0'));module[_0xe0ef('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe0ef('0x2')},'table':{'type':Sequelize[_0xe0ef('0x3')]},'metric':{'type':Sequelize[_0xe0ef('0x4')]},'description':{'type':Sequelize[_0xe0ef('0x3')]}}; \ No newline at end of file +var _0xeb3e=['name','TEXT','exports','STRING'];(function(_0xbc012a,_0xdc259e){var _0xadc16=function(_0x5511bb){while(--_0x5511bb){_0xbc012a['push'](_0xbc012a['shift']());}};_0xadc16(++_0xdc259e);}(_0xeb3e,0x106));var _0xeeb3=function(_0x2db312,_0x5cb069){_0x2db312=_0x2db312-0x0;var _0x50ed2d=_0xeb3e[_0x2db312];return _0x50ed2d;};'use strict';var Sequelize=require('sequelize');module[_0xeeb3('0x0')]={'name':{'type':Sequelize[_0xeeb3('0x1')],'allowNull':![],'unique':_0xeeb3('0x2')},'table':{'type':Sequelize[_0xeeb3('0x1')]},'metric':{'type':Sequelize[_0xeeb3('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 4befea7..407f962 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 _0x5b12=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','destroy','then','get','Metrics','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','create','error'];(function(_0x1b4d8b,_0x1ba2a4){var _0x4ae75d=function(_0x1eff2d){while(--_0x1eff2d){_0x1b4d8b['push'](_0x1b4d8b['shift']());}};_0x4ae75d(++_0x1ba2a4);}(_0x5b12,0xa3));var _0x25b1=function(_0x4d2714,_0x48c741){_0x4d2714=_0x4d2714-0x0;var _0x52a94e=_0x5b12[_0x4d2714];return _0x52a94e;};'use strict';var pdf=require(_0x25b1('0x0'));var emlformat=require(_0x25b1('0x1'));var rimraf=require(_0x25b1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x25b1('0x3'));var rp=require('request-promise');var moment=require(_0x25b1('0x4'));var BPromise=require(_0x25b1('0x5'));var Mustache=require('mustache');var util=require(_0x25b1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x25b1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0x7'));var querystring=require(_0x25b1('0xc'));var Papa=require(_0x25b1('0xd'));var Redis=require(_0x25b1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0xf'));var as=require(_0x25b1('0x10'));var hardwareService=require(_0x25b1('0x11'));var logger=require(_0x25b1('0x12'))(_0x25b1('0x13'));var utils=require(_0x25b1('0x14'));var config=require(_0x25b1('0x15'));var db=require(_0x25b1('0x16'))['db'];function respondWithStatusCode(_0x90a241,_0x459070){_0x459070=_0x459070||0xcc;return function(_0xbdd348){if(_0xbdd348){return _0x90a241[_0x25b1('0x17')](_0x459070);}return _0x90a241[_0x25b1('0x18')](_0x459070)[_0x25b1('0x19')]();};}function respondWithResult(_0x1bdb9a,_0x76b5c4){_0x76b5c4=_0x76b5c4||0xc8;return function(_0x4ee40c){if(_0x4ee40c){return _0x1bdb9a[_0x25b1('0x18')](_0x76b5c4)[_0x25b1('0x1a')](_0x4ee40c);}};}function respondWithFilteredResult(_0x4de13f,_0xb5b9cf){return function(_0x4bb1bb){if(_0x4bb1bb){var _0xe32e02=_0x4bb1bb['count'],_0x4a5a58=_0xb5b9cf[_0x25b1('0x1b')],_0x593165=_0xb5b9cf[_0x25b1('0x1b')]+_0xb5b9cf[_0x25b1('0x1c')],_0x7b50ab;if(_0x593165>=_0xe32e02){_0x593165=_0xe32e02;_0x7b50ab=0xc8;}else{_0x7b50ab=0xce;}_0x4de13f[_0x25b1('0x18')](_0x7b50ab);return _0x4de13f[_0x25b1('0x1d')](_0x25b1('0x1e'),_0x4a5a58+'-'+_0x593165+'/'+_0xe32e02)[_0x25b1('0x1a')](_0x4bb1bb);}return null;};}function patchUpdates(_0x292463){return function(_0x53ce1b){try{jsonpatch['apply'](_0x53ce1b,_0x292463,!![]);}catch(_0x42a60e){return BPromise['reject'](_0x42a60e);}return _0x53ce1b[_0x25b1('0x1f')]();};}function saveUpdates(_0x50ae0f,_0x3bfd7d){return function(_0x59aa37){if(_0x59aa37){return _0x59aa37[_0x25b1('0x20')](_0x50ae0f)['then'](function(_0xb61b1){return _0xb61b1;});}return null;};}function removeEntity(_0x5b0be0,_0x4e3f48){return function(_0x565cfd){if(_0x565cfd){return _0x565cfd[_0x25b1('0x21')]()[_0x25b1('0x22')](function(){var _0x4affba=_0x565cfd[_0x25b1('0x23')]({'plain':!![]});var _0x26b555=_0x25b1('0x24');return db[_0x25b1('0x25')][_0x25b1('0x21')]({'where':{'type':_0x26b555,'resourceId':_0x4affba['id']}})['then'](function(){return _0x565cfd;});})[_0x25b1('0x22')](function(){_0x5b0be0[_0x25b1('0x18')](0xcc)[_0x25b1('0x19')]();});}};}function handleEntityNotFound(_0x282187,_0x1f37ed){return function(_0x1292bf){if(!_0x1292bf){_0x282187['sendStatus'](0x194);}return _0x1292bf;};}function handleError(_0x3c05c6,_0x27dd68){_0x27dd68=_0x27dd68||0x1f4;return function(_0x3d279f){logger['error'](_0x3d279f[_0x25b1('0x26')]);if(_0x3d279f[_0x25b1('0x27')]){delete _0x3d279f[_0x25b1('0x27')];}_0x3c05c6['status'](_0x27dd68)[_0x25b1('0x28')](_0x3d279f);};}exports['index']=function(_0x19ecd1,_0x3febb8){var _0x3a4475={},_0x293413={},_0x362118={'count':0x0,'rows':[]};var _0x300a14=_[_0x25b1('0x29')](db['AnalyticMetric'][_0x25b1('0x2a')],function(_0xca56f0){return{'name':_0xca56f0[_0x25b1('0x2b')],'type':_0xca56f0[_0x25b1('0x2c')][_0x25b1('0x2d')]};});_0x293413['model']=_[_0x25b1('0x29')](_0x300a14,_0x25b1('0x27'));_0x293413[_0x25b1('0x2e')]=_[_0x25b1('0x2f')](_0x19ecd1[_0x25b1('0x2e')]);_0x293413['filters']=_['intersection'](_0x293413[_0x25b1('0x30')],_0x293413['query']);_0x3a4475[_0x25b1('0x31')]=_[_0x25b1('0x32')](_0x293413[_0x25b1('0x30')],qs['fields'](_0x19ecd1['query'][_0x25b1('0x33')]));_0x3a4475[_0x25b1('0x31')]=_0x3a4475[_0x25b1('0x31')]['length']?_0x3a4475[_0x25b1('0x31')]:_0x293413[_0x25b1('0x30')];if(!_0x19ecd1[_0x25b1('0x2e')][_0x25b1('0x34')]('nolimit')){_0x3a4475[_0x25b1('0x1c')]=qs[_0x25b1('0x1c')](_0x19ecd1[_0x25b1('0x2e')]['limit']);_0x3a4475['offset']=qs[_0x25b1('0x1b')](_0x19ecd1['query'][_0x25b1('0x1b')]);}_0x3a4475[_0x25b1('0x35')]=qs[_0x25b1('0x36')](_0x19ecd1[_0x25b1('0x2e')][_0x25b1('0x36')]);_0x3a4475[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_[_0x25b1('0x39')](_0x19ecd1[_0x25b1('0x2e')],_0x293413[_0x25b1('0x38')]),_0x300a14);if(_0x19ecd1[_0x25b1('0x2e')][_0x25b1('0x3a')]){_0x3a4475[_0x25b1('0x37')]=_[_0x25b1('0x3b')](_0x3a4475[_0x25b1('0x37')],{'$or':_['map'](_0x300a14,function(_0x472ed3){if(_0x472ed3[_0x25b1('0x2c')]!=='VIRTUAL'){var _0x3c7bf2={};_0x3c7bf2[_0x472ed3[_0x25b1('0x27')]]={'$like':'%'+_0x19ecd1[_0x25b1('0x2e')][_0x25b1('0x3a')]+'%'};return _0x3c7bf2;}})});}_0x3a4475=_[_0x25b1('0x3b')]({},_0x3a4475,_0x19ecd1['options']);var _0x7346c3={'where':_0x3a4475['where']};return db[_0x25b1('0x3c')]['count'](_0x7346c3)[_0x25b1('0x22')](function(_0x158993){_0x362118[_0x25b1('0x3d')]=_0x158993;if(_0x19ecd1[_0x25b1('0x2e')][_0x25b1('0x3e')]){_0x3a4475[_0x25b1('0x3f')]=[{'all':!![]}];}return db[_0x25b1('0x3c')][_0x25b1('0x40')](_0x3a4475);})[_0x25b1('0x22')](function(_0x49f049){_0x362118[_0x25b1('0x41')]=_0x49f049;return _0x362118;})['then'](respondWithFilteredResult(_0x3febb8,_0x3a4475))[_0x25b1('0x42')](handleError(_0x3febb8,null));};exports[_0x25b1('0x43')]=function(_0x4d4e32,_0x52d3f8){var _0x39b4c7={'raw':!![],'where':{'id':_0x4d4e32[_0x25b1('0x44')]['id']}},_0x2ab993={};_0x2ab993[_0x25b1('0x30')]=_[_0x25b1('0x2f')](db[_0x25b1('0x3c')][_0x25b1('0x2a')]);_0x2ab993[_0x25b1('0x2e')]=_[_0x25b1('0x2f')](_0x4d4e32[_0x25b1('0x2e')]);_0x2ab993[_0x25b1('0x38')]=_[_0x25b1('0x32')](_0x2ab993[_0x25b1('0x30')],_0x2ab993[_0x25b1('0x2e')]);_0x39b4c7[_0x25b1('0x31')]=_[_0x25b1('0x32')](_0x2ab993[_0x25b1('0x30')],qs['fields'](_0x4d4e32['query']['fields']));_0x39b4c7[_0x25b1('0x31')]=_0x39b4c7['attributes'][_0x25b1('0x45')]?_0x39b4c7['attributes']:_0x2ab993[_0x25b1('0x30')];if(_0x4d4e32[_0x25b1('0x2e')][_0x25b1('0x3e')]){_0x39b4c7[_0x25b1('0x3f')]=[{'all':!![]}];}_0x39b4c7=_[_0x25b1('0x3b')]({},_0x39b4c7,_0x4d4e32[_0x25b1('0x46')]);return db['AnalyticMetric'][_0x25b1('0x47')](_0x39b4c7)[_0x25b1('0x22')](handleEntityNotFound(_0x52d3f8,null))[_0x25b1('0x22')](respondWithResult(_0x52d3f8,null))[_0x25b1('0x42')](handleError(_0x52d3f8,null));};exports['create']=function(_0x489f73,_0x27d8c6){return db[_0x25b1('0x3c')]['create'](_0x489f73[_0x25b1('0x48')],{})['then'](function(_0x344e8e){var _0x4b6181=_0x489f73['user'][_0x25b1('0x23')]({'plain':!![]});if(!_0x4b6181)throw new Error(_0x25b1('0x49'));if(_0x4b6181[_0x25b1('0x4a')]===_0x25b1('0x4b')){var _0x5de62e=_0x344e8e[_0x25b1('0x23')]({'plain':!![]});var _0x58e612=_0x25b1('0x24');return db['UserProfileSection'][_0x25b1('0x47')]({'where':{'name':_0x58e612,'userProfileId':_0x4b6181[_0x25b1('0x4c')]},'raw':!![]})[_0x25b1('0x22')](function(_0x4fb92e){if(_0x4fb92e&&_0x4fb92e[_0x25b1('0x4d')]===0x0){return db[_0x25b1('0x25')][_0x25b1('0x4e')]({'name':_0x5de62e[_0x25b1('0x27')],'resourceId':_0x5de62e['id'],'type':_0x4fb92e[_0x25b1('0x27')],'sectionId':_0x4fb92e['id']},{})[_0x25b1('0x22')](function(){return _0x344e8e;});}else{return _0x344e8e;}})['catch'](function(_0x134c64){logger[_0x25b1('0x4f')](_0x25b1('0x50'),_0x134c64);throw _0x134c64;});}return _0x344e8e;})[_0x25b1('0x22')](respondWithResult(_0x27d8c6,0xc9))[_0x25b1('0x42')](handleError(_0x27d8c6,null));};exports[_0x25b1('0x20')]=function(_0x291dac,_0x40d574){if(_0x291dac[_0x25b1('0x48')]['id']){delete _0x291dac[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x3c')][_0x25b1('0x47')]({'where':{'id':_0x291dac[_0x25b1('0x44')]['id']}})[_0x25b1('0x22')](handleEntityNotFound(_0x40d574,null))[_0x25b1('0x22')](saveUpdates(_0x291dac[_0x25b1('0x48')],null))[_0x25b1('0x22')](respondWithResult(_0x40d574,null))[_0x25b1('0x42')](handleError(_0x40d574,null));};exports['destroy']=function(_0x3c6658,_0x16e61e){return db[_0x25b1('0x3c')][_0x25b1('0x47')]({'where':{'id':_0x3c6658[_0x25b1('0x44')]['id']}})[_0x25b1('0x22')](handleEntityNotFound(_0x16e61e,null))['then'](removeEntity(_0x16e61e,null))[_0x25b1('0x42')](handleError(_0x16e61e,null));}; \ No newline at end of file +var _0xb9be=['rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','AnalyticMetric','includeAll','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','count','offset','limit','status','set','Content-Range','json','apply','save','update','destroy','then','get','Metrics','UserProfileResource','end','sendStatus','error','stack','name','index','map'];(function(_0x1b3462,_0x447fd2){var _0x452bfd=function(_0x1ed241){while(--_0x1ed241){_0x1b3462['push'](_0x1b3462['shift']());}};_0x452bfd(++_0x447fd2);}(_0xb9be,0xc5));var _0xeb9b=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0xb9be[_0x215dc8];return _0x583ea3;};'use strict';var pdf=require(_0xeb9b('0x0'));var emlformat=require(_0xeb9b('0x1'));var rimraf=require(_0xeb9b('0x2'));var zipdir=require(_0xeb9b('0x3'));var jsonpatch=require(_0xeb9b('0x4'));var rp=require(_0xeb9b('0x5'));var moment=require(_0xeb9b('0x6'));var BPromise=require(_0xeb9b('0x7'));var Mustache=require(_0xeb9b('0x8'));var util=require('util');var path=require('path');var sox=require(_0xeb9b('0x9'));var csv=require(_0xeb9b('0xa'));var ejs=require(_0xeb9b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0xa'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var db=require(_0xeb9b('0x17'))['db'];function respondWithStatusCode(_0x1def58,_0x3df18a){_0x3df18a=_0x3df18a||0xcc;return function(_0x2a01df){if(_0x2a01df){return _0x1def58['sendStatus'](_0x3df18a);}return _0x1def58['status'](_0x3df18a)['end']();};}function respondWithResult(_0x355edb,_0x1ef03f){_0x1ef03f=_0x1ef03f||0xc8;return function(_0x2674e6){if(_0x2674e6){return _0x355edb['status'](_0x1ef03f)['json'](_0x2674e6);}};}function respondWithFilteredResult(_0x4f8182,_0x32538b){return function(_0x1a5f27){if(_0x1a5f27){var _0x406afd=_0x1a5f27[_0xeb9b('0x18')],_0x3fa308=_0x32538b['offset'],_0x2c9aa6=_0x32538b[_0xeb9b('0x19')]+_0x32538b[_0xeb9b('0x1a')],_0x10da6e;if(_0x2c9aa6>=_0x406afd){_0x2c9aa6=_0x406afd;_0x10da6e=0xc8;}else{_0x10da6e=0xce;}_0x4f8182[_0xeb9b('0x1b')](_0x10da6e);return _0x4f8182[_0xeb9b('0x1c')](_0xeb9b('0x1d'),_0x3fa308+'-'+_0x2c9aa6+'/'+_0x406afd)[_0xeb9b('0x1e')](_0x1a5f27);}return null;};}function patchUpdates(_0x21010e){return function(_0x3342c1){try{jsonpatch[_0xeb9b('0x1f')](_0x3342c1,_0x21010e,!![]);}catch(_0x26e312){return BPromise['reject'](_0x26e312);}return _0x3342c1[_0xeb9b('0x20')]();};}function saveUpdates(_0x5a7ffd,_0x5d5f54){return function(_0x580498){if(_0x580498){return _0x580498[_0xeb9b('0x21')](_0x5a7ffd)['then'](function(_0xbed5ce){return _0xbed5ce;});}return null;};}function removeEntity(_0x2dabb1,_0x37935c){return function(_0x37d7e0){if(_0x37d7e0){return _0x37d7e0[_0xeb9b('0x22')]()[_0xeb9b('0x23')](function(){var _0x3e9a2a=_0x37d7e0[_0xeb9b('0x24')]({'plain':!![]});var _0x142d1c=_0xeb9b('0x25');return db[_0xeb9b('0x26')][_0xeb9b('0x22')]({'where':{'type':_0x142d1c,'resourceId':_0x3e9a2a['id']}})[_0xeb9b('0x23')](function(){return _0x37d7e0;});})[_0xeb9b('0x23')](function(){_0x2dabb1[_0xeb9b('0x1b')](0xcc)[_0xeb9b('0x27')]();});}};}function handleEntityNotFound(_0x4c997e,_0xd57390){return function(_0x4ed960){if(!_0x4ed960){_0x4c997e[_0xeb9b('0x28')](0x194);}return _0x4ed960;};}function handleError(_0x5d6846,_0x347ec1){_0x347ec1=_0x347ec1||0x1f4;return function(_0x4361b9){logger[_0xeb9b('0x29')](_0x4361b9[_0xeb9b('0x2a')]);if(_0x4361b9['name']){delete _0x4361b9[_0xeb9b('0x2b')];}_0x5d6846[_0xeb9b('0x1b')](_0x347ec1)['send'](_0x4361b9);};}exports[_0xeb9b('0x2c')]=function(_0x33bb1d,_0x5ce745){var _0x2a4b51={},_0x2ea20f={},_0x4188d5={'count':0x0,'rows':[]};var _0x48c5f4=_[_0xeb9b('0x2d')](db['AnalyticMetric'][_0xeb9b('0x2e')],function(_0x4c1331){return{'name':_0x4c1331[_0xeb9b('0x2f')],'type':_0x4c1331['type'][_0xeb9b('0x30')]};});_0x2ea20f['model']=_[_0xeb9b('0x2d')](_0x48c5f4,'name');_0x2ea20f[_0xeb9b('0x31')]=_[_0xeb9b('0x32')](_0x33bb1d[_0xeb9b('0x31')]);_0x2ea20f[_0xeb9b('0x33')]=_[_0xeb9b('0x34')](_0x2ea20f[_0xeb9b('0x35')],_0x2ea20f[_0xeb9b('0x31')]);_0x2a4b51[_0xeb9b('0x36')]=_[_0xeb9b('0x34')](_0x2ea20f[_0xeb9b('0x35')],qs['fields'](_0x33bb1d[_0xeb9b('0x31')][_0xeb9b('0x37')]));_0x2a4b51[_0xeb9b('0x36')]=_0x2a4b51[_0xeb9b('0x36')][_0xeb9b('0x38')]?_0x2a4b51[_0xeb9b('0x36')]:_0x2ea20f[_0xeb9b('0x35')];if(!_0x33bb1d['query'][_0xeb9b('0x39')](_0xeb9b('0x3a'))){_0x2a4b51[_0xeb9b('0x1a')]=qs['limit'](_0x33bb1d[_0xeb9b('0x31')][_0xeb9b('0x1a')]);_0x2a4b51[_0xeb9b('0x19')]=qs[_0xeb9b('0x19')](_0x33bb1d[_0xeb9b('0x31')][_0xeb9b('0x19')]);}_0x2a4b51['order']=qs[_0xeb9b('0x3b')](_0x33bb1d[_0xeb9b('0x31')]['sort']);_0x2a4b51[_0xeb9b('0x3c')]=qs[_0xeb9b('0x33')](_[_0xeb9b('0x3d')](_0x33bb1d[_0xeb9b('0x31')],_0x2ea20f[_0xeb9b('0x33')]),_0x48c5f4);if(_0x33bb1d[_0xeb9b('0x31')][_0xeb9b('0x3e')]){_0x2a4b51['where']=_[_0xeb9b('0x3f')](_0x2a4b51[_0xeb9b('0x3c')],{'$or':_[_0xeb9b('0x2d')](_0x48c5f4,function(_0x53d2f7){if(_0x53d2f7['type']!=='VIRTUAL'){var _0x26dc71={};_0x26dc71[_0x53d2f7[_0xeb9b('0x2b')]]={'$like':'%'+_0x33bb1d[_0xeb9b('0x31')]['filter']+'%'};return _0x26dc71;}})});}_0x2a4b51=_[_0xeb9b('0x3f')]({},_0x2a4b51,_0x33bb1d[_0xeb9b('0x40')]);var _0x240d8d={'where':_0x2a4b51[_0xeb9b('0x3c')]};return db[_0xeb9b('0x41')][_0xeb9b('0x18')](_0x240d8d)[_0xeb9b('0x23')](function(_0x492122){_0x4188d5[_0xeb9b('0x18')]=_0x492122;if(_0x33bb1d[_0xeb9b('0x31')][_0xeb9b('0x42')]){_0x2a4b51['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xeb9b('0x43')](_0x2a4b51);})[_0xeb9b('0x23')](function(_0x495998){_0x4188d5[_0xeb9b('0x44')]=_0x495998;return _0x4188d5;})['then'](respondWithFilteredResult(_0x5ce745,_0x2a4b51))[_0xeb9b('0x45')](handleError(_0x5ce745,null));};exports[_0xeb9b('0x46')]=function(_0x28b075,_0x300565){var _0xbee63e={'raw':!![],'where':{'id':_0x28b075[_0xeb9b('0x47')]['id']}},_0x10f483={};_0x10f483[_0xeb9b('0x35')]=_[_0xeb9b('0x32')](db[_0xeb9b('0x41')][_0xeb9b('0x2e')]);_0x10f483[_0xeb9b('0x31')]=_['keys'](_0x28b075['query']);_0x10f483[_0xeb9b('0x33')]=_['intersection'](_0x10f483[_0xeb9b('0x35')],_0x10f483[_0xeb9b('0x31')]);_0xbee63e[_0xeb9b('0x36')]=_['intersection'](_0x10f483[_0xeb9b('0x35')],qs[_0xeb9b('0x37')](_0x28b075['query'][_0xeb9b('0x37')]));_0xbee63e[_0xeb9b('0x36')]=_0xbee63e[_0xeb9b('0x36')][_0xeb9b('0x38')]?_0xbee63e[_0xeb9b('0x36')]:_0x10f483[_0xeb9b('0x35')];if(_0x28b075[_0xeb9b('0x31')][_0xeb9b('0x42')]){_0xbee63e['include']=[{'all':!![]}];}_0xbee63e=_['merge']({},_0xbee63e,_0x28b075[_0xeb9b('0x40')]);return db['AnalyticMetric']['find'](_0xbee63e)[_0xeb9b('0x23')](handleEntityNotFound(_0x300565,null))[_0xeb9b('0x23')](respondWithResult(_0x300565,null))[_0xeb9b('0x45')](handleError(_0x300565,null));};exports[_0xeb9b('0x48')]=function(_0x45bc74,_0x2fd6ee){return db['AnalyticMetric']['create'](_0x45bc74['body'],{})[_0xeb9b('0x23')](function(_0x4d086a){var _0x4901b0=_0x45bc74[_0xeb9b('0x49')][_0xeb9b('0x24')]({'plain':!![]});if(!_0x4901b0)throw new Error(_0xeb9b('0x4a'));if(_0x4901b0[_0xeb9b('0x4b')]===_0xeb9b('0x49')){var _0x202ef3=_0x4d086a[_0xeb9b('0x24')]({'plain':!![]});var _0x34755f=_0xeb9b('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x34755f,'userProfileId':_0x4901b0[_0xeb9b('0x4c')]},'raw':!![]})[_0xeb9b('0x23')](function(_0x542ef4){if(_0x542ef4&&_0x542ef4[_0xeb9b('0x4d')]===0x0){return db['UserProfileResource'][_0xeb9b('0x48')]({'name':_0x202ef3[_0xeb9b('0x2b')],'resourceId':_0x202ef3['id'],'type':_0x542ef4['name'],'sectionId':_0x542ef4['id']},{})['then'](function(){return _0x4d086a;});}else{return _0x4d086a;}})['catch'](function(_0x211238){logger[_0xeb9b('0x29')](_0xeb9b('0x4e'),_0x211238);throw _0x211238;});}return _0x4d086a;})['then'](respondWithResult(_0x2fd6ee,0xc9))['catch'](handleError(_0x2fd6ee,null));};exports[_0xeb9b('0x21')]=function(_0x1833c2,_0x3e6e73){if(_0x1833c2[_0xeb9b('0x4f')]['id']){delete _0x1833c2[_0xeb9b('0x4f')]['id'];}return db[_0xeb9b('0x41')]['find']({'where':{'id':_0x1833c2[_0xeb9b('0x47')]['id']}})[_0xeb9b('0x23')](handleEntityNotFound(_0x3e6e73,null))['then'](saveUpdates(_0x1833c2[_0xeb9b('0x4f')],null))['then'](respondWithResult(_0x3e6e73,null))[_0xeb9b('0x45')](handleError(_0x3e6e73,null));};exports[_0xeb9b('0x22')]=function(_0x5e3b36,_0x396aa9){return db['AnalyticMetric'][_0xeb9b('0x50')]({'where':{'id':_0x5e3b36[_0xeb9b('0x47')]['id']}})[_0xeb9b('0x23')](handleEntityNotFound(_0x396aa9,null))[_0xeb9b('0x23')](removeEntity(_0x396aa9,null))[_0xeb9b('0x45')](handleError(_0x396aa9,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5efcac8..0e7c062 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 _0x814e=['request-promise','path','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','../../config/logger','api','moment'];(function(_0x1abab4,_0x576c0d){var _0x2bd532=function(_0x7f2f0f){while(--_0x7f2f0f){_0x1abab4['push'](_0x1abab4['shift']());}};_0x2bd532(++_0x576c0d);}(_0x814e,0x153));var _0xe814=function(_0x234526,_0x4f4969){_0x234526=_0x234526-0x0;var _0x217c48=_0x814e[_0x234526];return _0x217c48;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe814('0x0'))(_0xe814('0x1'));var moment=require(_0xe814('0x2'));var BPromise=require('bluebird');var rp=require(_0xe814('0x3'));var fs=require('fs');var path=require(_0xe814('0x4'));var rimraf=require('rimraf');var config=require(_0xe814('0x5'));var attributes=require(_0xe814('0x6'));module[_0xe814('0x7')]=function(_0x2c7c2b,_0x2e1777){return _0x2c7c2b['define'](_0xe814('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d99=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','lodash','util','../../config/logger','api','moment'];(function(_0x29d7a0,_0x3901c4){var _0x555474=function(_0xf7335b){while(--_0xf7335b){_0x29d7a0['push'](_0x29d7a0['shift']());}};_0x555474(++_0x3901c4);}(_0x0d99,0xd8));var _0x90d9=function(_0x95a80,_0x1dd45d){_0x95a80=_0x95a80-0x0;var _0x2241b7=_0x0d99[_0x95a80];return _0x2241b7;};'use strict';var _=require(_0x90d9('0x0'));var util=require(_0x90d9('0x1'));var logger=require(_0x90d9('0x2'))(_0x90d9('0x3'));var moment=require(_0x90d9('0x4'));var BPromise=require(_0x90d9('0x5'));var rp=require(_0x90d9('0x6'));var fs=require('fs');var path=require(_0x90d9('0x7'));var rimraf=require(_0x90d9('0x8'));var config=require(_0x90d9('0x9'));var attributes=require('./analyticMetric.attributes');module[_0x90d9('0xa')]=function(_0x487324,_0x3fd43c){return _0x487324[_0x90d9('0xb')](_0x90d9('0xc'),attributes,{'tableName':'analytics_metrics','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 2781611..e52f9b3 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 _0xd9b4=['then','info','request\x20sent','debug','error','code','message','AnalyticMetric,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x17141f,_0x4d7c4b){var _0x3ee900=function(_0x5ec0f4){while(--_0x5ec0f4){_0x17141f['push'](_0x17141f['shift']());}};_0x3ee900(++_0x4d7c4b);}(_0xd9b4,0xe2));var _0x4d9b=function(_0x94bb86,_0x281cec){_0x94bb86=_0x94bb86-0x0;var _0x4aa831=_0xd9b4[_0x94bb86];return _0x4aa831;};'use strict';var _=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var moment=require(_0x4d9b('0x2'));var BPromise=require(_0x4d9b('0x3'));var rs=require(_0x4d9b('0x4'));var fs=require('fs');var Redis=require(_0x4d9b('0x5'));var db=require(_0x4d9b('0x6'))['db'];var utils=require(_0x4d9b('0x7'));var logger=require('../../config/logger')(_0x4d9b('0x8'));var config=require(_0x4d9b('0x9'));var jayson=require(_0x4d9b('0xa'));var client=jayson[_0x4d9b('0xb')][_0x4d9b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c820c,_0x4c0204,_0x3afd7c){return new BPromise(function(_0xcb4979,_0x2c6e3b){return client[_0x4d9b('0xd')](_0x3c820c,_0x3afd7c)[_0x4d9b('0xe')](function(_0x5b3cd2){logger[_0x4d9b('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x4c0204,_0x4d9b('0x10'));logger[_0x4d9b('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x4c0204,_0x4d9b('0x10'),JSON['stringify'](_0x5b3cd2));if(_0x5b3cd2[_0x4d9b('0x12')]){if(_0x5b3cd2[_0x4d9b('0x12')][_0x4d9b('0x13')]===0x1f4){logger[_0x4d9b('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x4c0204,_0x5b3cd2['error'][_0x4d9b('0x14')]);return _0x2c6e3b(_0x5b3cd2[_0x4d9b('0x12')][_0x4d9b('0x14')]);}logger[_0x4d9b('0x12')](_0x4d9b('0x15'),_0x4c0204,_0x5b3cd2[_0x4d9b('0x12')][_0x4d9b('0x14')]);return _0xcb4979(_0x5b3cd2[_0x4d9b('0x12')][_0x4d9b('0x14')]);}else{logger[_0x4d9b('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x4c0204,'request\x20sent');_0xcb4979(_0x5b3cd2[_0x4d9b('0x16')][_0x4d9b('0x14')]);}})[_0x4d9b('0x17')](function(_0x3db88b){logger[_0x4d9b('0x12')](_0x4d9b('0x15'),_0x4c0204,_0x3db88b);_0x2c6e3b(_0x3db88b);});});} \ No newline at end of file +var _0x413a=['catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xd3fe31,_0x4647dc){var _0x980119=function(_0x26dcbd){while(--_0x26dcbd){_0xd3fe31['push'](_0xd3fe31['shift']());}};_0x980119(++_0x4647dc);}(_0x413a,0x8d));var _0xa413=function(_0x39ca1d,_0x3d6d3d){_0x39ca1d=_0x39ca1d-0x0;var _0x233e44=_0x413a[_0x39ca1d];return _0x233e44;};'use strict';var _=require('lodash');var util=require(_0xa413('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa413('0x1'));var fs=require('fs');var Redis=require(_0xa413('0x2'));var db=require(_0xa413('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa413('0x4'))(_0xa413('0x5'));var config=require(_0xa413('0x6'));var jayson=require(_0xa413('0x7'));var client=jayson[_0xa413('0x8')][_0xa413('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b3aca,_0x5fb7eb,_0x2fc6fa){return new BPromise(function(_0x3f3bdf,_0x2629eb){return client['request'](_0x3b3aca,_0x2fc6fa)['then'](function(_0x3e2813){logger[_0xa413('0xa')](_0xa413('0xb'),_0x5fb7eb,_0xa413('0xc'));logger[_0xa413('0xd')](_0xa413('0xe'),_0x5fb7eb,_0xa413('0xc'),JSON[_0xa413('0xf')](_0x3e2813));if(_0x3e2813[_0xa413('0x10')]){if(_0x3e2813[_0xa413('0x10')]['code']===0x1f4){logger[_0xa413('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x5fb7eb,_0x3e2813[_0xa413('0x10')]['message']);return _0x2629eb(_0x3e2813[_0xa413('0x10')]['message']);}logger[_0xa413('0x10')](_0xa413('0xb'),_0x5fb7eb,_0x3e2813[_0xa413('0x10')][_0xa413('0x11')]);return _0x3f3bdf(_0x3e2813[_0xa413('0x10')][_0xa413('0x11')]);}else{logger[_0xa413('0xa')](_0xa413('0xb'),_0x5fb7eb,_0xa413('0xc'));_0x3f3bdf(_0x3e2813[_0xa413('0x12')]['message']);}})[_0xa413('0x13')](function(_0x2a176b){logger[_0xa413('0x10')](_0xa413('0xb'),_0x5fb7eb,_0x2a176b);_0x2629eb(_0x2a176b);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 7d2c36e..09962a1 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(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0x1261,0x144));var _0x1126=function(_0x47888a,_0x7d2f3a){_0x47888a=_0x47888a-0x0;var _0x2b15a4=_0x1261[_0x47888a];return _0x2b15a4;};'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 _0x187d=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0xbc7919,_0xf0cf39){var _0x58310c=function(_0x2e2fbe){while(--_0x2e2fbe){_0xbc7919['push'](_0xbc7919['shift']());}};_0x58310c(++_0xf0cf39);}(_0x187d,0x93));var _0xd187=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x187d[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var auth=require(_0xd187('0x5'));var interaction=require(_0xd187('0x6'));var config=require('../../config/environment');var controller=require(_0xd187('0x7'));router[_0xd187('0x8')]('/',auth['isAuthenticated'](),controller[_0xd187('0x9')]);router[_0xd187('0x8')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xc')]);router[_0xd187('0xd')]('/',auth[_0xd187('0xb')](),controller[_0xd187('0xe')]);router['put'](_0xd187('0xa'),auth[_0xd187('0xb')](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xa'),auth[_0xd187('0xb')](),controller['destroy']);module[_0xd187('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e681695..54ed4b2 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 _0xed48=['TEXT','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed48,0xca));var _0x8ed4=function(_0x25f3e3,_0x207891){_0x25f3e3=_0x25f3e3-0x0;var _0xa89b6d=_0xed48[_0x25f3e3];return _0xa89b6d;};'use strict';var Sequelize=require(_0x8ed4('0x0'));module[_0x8ed4('0x1')]={'tree':{'type':Sequelize[_0x8ed4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x03fe=['exports','TEXT','sequelize'];(function(_0x1efe64,_0x40b312){var _0x158a55=function(_0x3afc8b){while(--_0x3afc8b){_0x1efe64['push'](_0x1efe64['shift']());}};_0x158a55(++_0x40b312);}(_0x03fe,0x1d9));var _0xe03f=function(_0x2a9421,_0x12acc6){_0x2a9421=_0x2a9421-0x0;var _0x520dd6=_0x03fe[_0x2a9421];return _0x520dd6;};'use strict';var Sequelize=require(_0xe03f('0x0'));module[_0xe03f('0x1')]={'tree':{'type':Sequelize[_0xe03f('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 4181d51..f40d256 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 _0xa406=['find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','filters','query','attributes','intersection','fields','length','order','sort','pick','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','keys','merge'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xa406,0x1a7));var _0x6a40=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa406[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x6a40('0x0'));var emlformat=require(_0x6a40('0x1'));var rimraf=require(_0x6a40('0x2'));var zipdir=require(_0x6a40('0x3'));var jsonpatch=require(_0x6a40('0x4'));var rp=require(_0x6a40('0x5'));var moment=require(_0x6a40('0x6'));var BPromise=require(_0x6a40('0x7'));var Mustache=require(_0x6a40('0x8'));var util=require(_0x6a40('0x9'));var path=require(_0x6a40('0xa'));var sox=require(_0x6a40('0xb'));var csv=require(_0x6a40('0xc'));var ejs=require(_0x6a40('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a40('0xe'));var crypto=require(_0x6a40('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6a40('0x10'));var toCsv=require(_0x6a40('0xc'));var querystring=require('querystring');var Papa=require(_0x6a40('0x11'));var Redis=require(_0x6a40('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6a40('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a40('0x14'))(_0x6a40('0x15'));var utils=require('../../config/utils');var config=require(_0x6a40('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9ea2be,_0x25b394){_0x25b394=_0x25b394||0xcc;return function(_0x237902){if(_0x237902){return _0x9ea2be['sendStatus'](_0x25b394);}return _0x9ea2be[_0x6a40('0x17')](_0x25b394)[_0x6a40('0x18')]();};}function respondWithResult(_0x52c8c1,_0xf756af){_0xf756af=_0xf756af||0xc8;return function(_0x44a41e){if(_0x44a41e){return _0x52c8c1['status'](_0xf756af)[_0x6a40('0x19')](_0x44a41e);}};}function respondWithFilteredResult(_0x8dfeb6,_0x327668){return function(_0x5ce64a){if(_0x5ce64a){var _0x1d0d2d=_0x5ce64a[_0x6a40('0x1a')],_0xce80cd=_0x327668['offset'],_0x399857=_0x327668[_0x6a40('0x1b')]+_0x327668[_0x6a40('0x1c')],_0x9e7872;if(_0x399857>=_0x1d0d2d){_0x399857=_0x1d0d2d;_0x9e7872=0xc8;}else{_0x9e7872=0xce;}_0x8dfeb6[_0x6a40('0x17')](_0x9e7872);return _0x8dfeb6['set']('Content-Range',_0xce80cd+'-'+_0x399857+'/'+_0x1d0d2d)[_0x6a40('0x19')](_0x5ce64a);}return null;};}function patchUpdates(_0x2a12d4){return function(_0x293a49){try{jsonpatch['apply'](_0x293a49,_0x2a12d4,!![]);}catch(_0x2410fd){return BPromise[_0x6a40('0x1d')](_0x2410fd);}return _0x293a49[_0x6a40('0x1e')]();};}function saveUpdates(_0x1d52bd,_0x5d64b7){return function(_0x14012f){if(_0x14012f){return _0x14012f[_0x6a40('0x1f')](_0x1d52bd)[_0x6a40('0x20')](function(_0x25bcda){return _0x25bcda;});}return null;};}function removeEntity(_0xb1fa2,_0x2c5946){return function(_0x5a0db1){if(_0x5a0db1){return _0x5a0db1[_0x6a40('0x21')]()['then'](function(){_0xb1fa2['status'](0xcc)[_0x6a40('0x18')]();});}};}function handleEntityNotFound(_0x597d62,_0x276f4f){return function(_0x4287c6){if(!_0x4287c6){_0x597d62[_0x6a40('0x22')](0x194);}return _0x4287c6;};}function handleError(_0x298cd0,_0x46a9fd){_0x46a9fd=_0x46a9fd||0x1f4;return function(_0xbd5c30){logger[_0x6a40('0x23')](_0xbd5c30[_0x6a40('0x24')]);if(_0xbd5c30[_0x6a40('0x25')]){delete _0xbd5c30[_0x6a40('0x25')];}_0x298cd0[_0x6a40('0x17')](_0x46a9fd)[_0x6a40('0x26')](_0xbd5c30);};}exports[_0x6a40('0x27')]=function(_0x3847e3,_0x58fc70){var _0x5f58c8={},_0x1537c8={},_0x43210c={'count':0x0,'rows':[]};var _0x139f5e=_[_0x6a40('0x28')](db[_0x6a40('0x29')][_0x6a40('0x2a')],function(_0x2e5229){return{'name':_0x2e5229['fieldName'],'type':_0x2e5229[_0x6a40('0x2b')][_0x6a40('0x2c')]};});_0x1537c8[_0x6a40('0x2d')]=_[_0x6a40('0x28')](_0x139f5e,_0x6a40('0x25'));_0x1537c8['query']=_['keys'](_0x3847e3['query']);_0x1537c8[_0x6a40('0x2e')]=_['intersection'](_0x1537c8[_0x6a40('0x2d')],_0x1537c8[_0x6a40('0x2f')]);_0x5f58c8[_0x6a40('0x30')]=_[_0x6a40('0x31')](_0x1537c8[_0x6a40('0x2d')],qs[_0x6a40('0x32')](_0x3847e3[_0x6a40('0x2f')][_0x6a40('0x32')]));_0x5f58c8['attributes']=_0x5f58c8['attributes'][_0x6a40('0x33')]?_0x5f58c8[_0x6a40('0x30')]:_0x1537c8['model'];if(!_0x3847e3['query']['hasOwnProperty']('nolimit')){_0x5f58c8[_0x6a40('0x1c')]=qs[_0x6a40('0x1c')](_0x3847e3[_0x6a40('0x2f')][_0x6a40('0x1c')]);_0x5f58c8['offset']=qs['offset'](_0x3847e3[_0x6a40('0x2f')][_0x6a40('0x1b')]);}_0x5f58c8[_0x6a40('0x34')]=qs[_0x6a40('0x35')](_0x3847e3[_0x6a40('0x2f')][_0x6a40('0x35')]);_0x5f58c8['where']=qs[_0x6a40('0x2e')](_[_0x6a40('0x36')](_0x3847e3[_0x6a40('0x2f')],_0x1537c8[_0x6a40('0x2e')]),_0x139f5e);if(_0x3847e3[_0x6a40('0x2f')]['filter']){_0x5f58c8['where']=_['merge'](_0x5f58c8['where'],{'$or':_[_0x6a40('0x28')](_0x139f5e,function(_0x18febe){if(_0x18febe[_0x6a40('0x2b')]!==_0x6a40('0x37')){var _0x5973a9={};_0x5973a9[_0x18febe[_0x6a40('0x25')]]={'$like':'%'+_0x3847e3[_0x6a40('0x2f')]['filter']+'%'};return _0x5973a9;}})});}_0x5f58c8=_['merge']({},_0x5f58c8,_0x3847e3[_0x6a40('0x38')]);var _0x142b51={'where':_0x5f58c8[_0x6a40('0x39')]};return db['AnalyticTreeReport'][_0x6a40('0x1a')](_0x142b51)[_0x6a40('0x20')](function(_0x4a0f55){_0x43210c[_0x6a40('0x1a')]=_0x4a0f55;if(_0x3847e3[_0x6a40('0x2f')][_0x6a40('0x3a')]){_0x5f58c8[_0x6a40('0x3b')]=[{'all':!![]}];}return db[_0x6a40('0x29')][_0x6a40('0x3c')](_0x5f58c8);})[_0x6a40('0x20')](function(_0x1615d8){_0x43210c[_0x6a40('0x3d')]=_0x1615d8;return _0x43210c;})[_0x6a40('0x20')](respondWithFilteredResult(_0x58fc70,_0x5f58c8))[_0x6a40('0x3e')](handleError(_0x58fc70,null));};exports[_0x6a40('0x3f')]=function(_0x5e4729,_0xeb67e7){var _0x2dab9a={'raw':!![],'where':{'id':_0x5e4729[_0x6a40('0x40')]['id']}},_0x1542af={};_0x1542af[_0x6a40('0x2d')]=_[_0x6a40('0x41')](db['AnalyticTreeReport']['rawAttributes']);_0x1542af[_0x6a40('0x2f')]=_[_0x6a40('0x41')](_0x5e4729['query']);_0x1542af[_0x6a40('0x2e')]=_[_0x6a40('0x31')](_0x1542af['model'],_0x1542af[_0x6a40('0x2f')]);_0x2dab9a[_0x6a40('0x30')]=_[_0x6a40('0x31')](_0x1542af[_0x6a40('0x2d')],qs[_0x6a40('0x32')](_0x5e4729[_0x6a40('0x2f')][_0x6a40('0x32')]));_0x2dab9a[_0x6a40('0x30')]=_0x2dab9a[_0x6a40('0x30')][_0x6a40('0x33')]?_0x2dab9a[_0x6a40('0x30')]:_0x1542af['model'];if(_0x5e4729[_0x6a40('0x2f')][_0x6a40('0x3a')]){_0x2dab9a['include']=[{'all':!![]}];}_0x2dab9a=_[_0x6a40('0x42')]({},_0x2dab9a,_0x5e4729[_0x6a40('0x38')]);return db['AnalyticTreeReport'][_0x6a40('0x43')](_0x2dab9a)[_0x6a40('0x20')](handleEntityNotFound(_0xeb67e7,null))[_0x6a40('0x20')](respondWithResult(_0xeb67e7,null))[_0x6a40('0x3e')](handleError(_0xeb67e7,null));};exports[_0x6a40('0x44')]=function(_0x30e8ec,_0x3aa7f2){return db[_0x6a40('0x29')][_0x6a40('0x44')](_0x30e8ec['body'],{})[_0x6a40('0x20')](respondWithResult(_0x3aa7f2,0xc9))['catch'](handleError(_0x3aa7f2,null));};exports[_0x6a40('0x1f')]=function(_0x2c08ae,_0x324c36){if(_0x2c08ae[_0x6a40('0x45')]['id']){delete _0x2c08ae[_0x6a40('0x45')]['id'];}return db['AnalyticTreeReport'][_0x6a40('0x43')]({'where':{'id':_0x2c08ae['params']['id']}})[_0x6a40('0x20')](handleEntityNotFound(_0x324c36,null))['then'](saveUpdates(_0x2c08ae['body'],null))['then'](respondWithResult(_0x324c36,null))[_0x6a40('0x3e')](handleError(_0x324c36,null));};exports[_0x6a40('0x21')]=function(_0x2d6521,_0x4b35c9){return db[_0x6a40('0x29')][_0x6a40('0x43')]({'where':{'id':_0x2d6521[_0x6a40('0x40')]['id']}})[_0x6a40('0x20')](handleEntityNotFound(_0x4b35c9,null))[_0x6a40('0x20')](removeEntity(_0x4b35c9,null))[_0x6a40('0x3e')](handleError(_0x4b35c9,null));}; \ No newline at end of file +var _0x3f9d=['type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','AnalyticTreeReport','rawAttributes'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x3f9d,0x127));var _0xd3f9=function(_0x239f2e,_0x4c5c60){_0x239f2e=_0x239f2e-0x0;var _0x17dcf6=_0x3f9d[_0x239f2e];return _0x17dcf6;};'use strict';var pdf=require(_0xd3f9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd3f9('0x1'));var zipdir=require(_0xd3f9('0x2'));var jsonpatch=require(_0xd3f9('0x3'));var rp=require(_0xd3f9('0x4'));var moment=require('moment');var BPromise=require(_0xd3f9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd3f9('0x6'));var sox=require('sox');var csv=require(_0xd3f9('0x7'));var ejs=require(_0xd3f9('0x8'));var fs=require('fs');var _=require(_0xd3f9('0x9'));var squel=require(_0xd3f9('0xa'));var crypto=require(_0xd3f9('0xb'));var jsforce=require(_0xd3f9('0xc'));var deskjs=require(_0xd3f9('0xd'));var toCsv=require(_0xd3f9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd3f9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd3f9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3f9('0x10'))(_0xd3f9('0x11'));var utils=require(_0xd3f9('0x12'));var config=require(_0xd3f9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x88219f,_0x79576f){_0x79576f=_0x79576f||0xcc;return function(_0x350859){if(_0x350859){return _0x88219f['sendStatus'](_0x79576f);}return _0x88219f[_0xd3f9('0x14')](_0x79576f)[_0xd3f9('0x15')]();};}function respondWithResult(_0x24ef03,_0x3e4e60){_0x3e4e60=_0x3e4e60||0xc8;return function(_0x15394f){if(_0x15394f){return _0x24ef03[_0xd3f9('0x14')](_0x3e4e60)[_0xd3f9('0x16')](_0x15394f);}};}function respondWithFilteredResult(_0x305f4f,_0x36aeb9){return function(_0x889195){if(_0x889195){var _0x3cb5fe=_0x889195[_0xd3f9('0x17')],_0x1d6232=_0x36aeb9[_0xd3f9('0x18')],_0x59e04b=_0x36aeb9['offset']+_0x36aeb9[_0xd3f9('0x19')],_0x254d89;if(_0x59e04b>=_0x3cb5fe){_0x59e04b=_0x3cb5fe;_0x254d89=0xc8;}else{_0x254d89=0xce;}_0x305f4f[_0xd3f9('0x14')](_0x254d89);return _0x305f4f[_0xd3f9('0x1a')](_0xd3f9('0x1b'),_0x1d6232+'-'+_0x59e04b+'/'+_0x3cb5fe)[_0xd3f9('0x16')](_0x889195);}return null;};}function patchUpdates(_0x47377b){return function(_0x1f37ae){try{jsonpatch[_0xd3f9('0x1c')](_0x1f37ae,_0x47377b,!![]);}catch(_0x2168a7){return BPromise[_0xd3f9('0x1d')](_0x2168a7);}return _0x1f37ae[_0xd3f9('0x1e')]();};}function saveUpdates(_0xd25be5,_0x54bba5){return function(_0x3370d5){if(_0x3370d5){return _0x3370d5['update'](_0xd25be5)[_0xd3f9('0x1f')](function(_0x4ea91c){return _0x4ea91c;});}return null;};}function removeEntity(_0x38383a,_0x4bcc0a){return function(_0x5706ab){if(_0x5706ab){return _0x5706ab[_0xd3f9('0x20')]()[_0xd3f9('0x1f')](function(){_0x38383a['status'](0xcc)[_0xd3f9('0x15')]();});}};}function handleEntityNotFound(_0x58b8b6,_0x547174){return function(_0x201343){if(!_0x201343){_0x58b8b6['sendStatus'](0x194);}return _0x201343;};}function handleError(_0x44b82a,_0x19dd42){_0x19dd42=_0x19dd42||0x1f4;return function(_0x366040){logger[_0xd3f9('0x21')](_0x366040[_0xd3f9('0x22')]);if(_0x366040['name']){delete _0x366040[_0xd3f9('0x23')];}_0x44b82a[_0xd3f9('0x14')](_0x19dd42)['send'](_0x366040);};}exports[_0xd3f9('0x24')]=function(_0x59adca,_0x4ec657){var _0x45c46d={},_0x45106f={},_0x29a56f={'count':0x0,'rows':[]};var _0x44b930=_[_0xd3f9('0x25')](db[_0xd3f9('0x26')][_0xd3f9('0x27')],function(_0x1330ef){return{'name':_0x1330ef['fieldName'],'type':_0x1330ef[_0xd3f9('0x28')]['key']};});_0x45106f['model']=_[_0xd3f9('0x25')](_0x44b930,_0xd3f9('0x23'));_0x45106f[_0xd3f9('0x29')]=_['keys'](_0x59adca[_0xd3f9('0x29')]);_0x45106f[_0xd3f9('0x2a')]=_[_0xd3f9('0x2b')](_0x45106f[_0xd3f9('0x2c')],_0x45106f[_0xd3f9('0x29')]);_0x45c46d[_0xd3f9('0x2d')]=_[_0xd3f9('0x2b')](_0x45106f[_0xd3f9('0x2c')],qs['fields'](_0x59adca[_0xd3f9('0x29')][_0xd3f9('0x2e')]));_0x45c46d[_0xd3f9('0x2d')]=_0x45c46d['attributes'][_0xd3f9('0x2f')]?_0x45c46d['attributes']:_0x45106f[_0xd3f9('0x2c')];if(!_0x59adca[_0xd3f9('0x29')]['hasOwnProperty'](_0xd3f9('0x30'))){_0x45c46d[_0xd3f9('0x19')]=qs[_0xd3f9('0x19')](_0x59adca[_0xd3f9('0x29')][_0xd3f9('0x19')]);_0x45c46d[_0xd3f9('0x18')]=qs[_0xd3f9('0x18')](_0x59adca['query']['offset']);}_0x45c46d[_0xd3f9('0x31')]=qs[_0xd3f9('0x32')](_0x59adca[_0xd3f9('0x29')][_0xd3f9('0x32')]);_0x45c46d['where']=qs['filters'](_['pick'](_0x59adca[_0xd3f9('0x29')],_0x45106f['filters']),_0x44b930);if(_0x59adca[_0xd3f9('0x29')][_0xd3f9('0x33')]){_0x45c46d[_0xd3f9('0x34')]=_[_0xd3f9('0x35')](_0x45c46d[_0xd3f9('0x34')],{'$or':_['map'](_0x44b930,function(_0x27eeba){if(_0x27eeba[_0xd3f9('0x28')]!=='VIRTUAL'){var _0x487d47={};_0x487d47[_0x27eeba[_0xd3f9('0x23')]]={'$like':'%'+_0x59adca[_0xd3f9('0x29')][_0xd3f9('0x33')]+'%'};return _0x487d47;}})});}_0x45c46d=_[_0xd3f9('0x35')]({},_0x45c46d,_0x59adca[_0xd3f9('0x36')]);var _0x4e1579={'where':_0x45c46d[_0xd3f9('0x34')]};return db[_0xd3f9('0x26')]['count'](_0x4e1579)[_0xd3f9('0x1f')](function(_0x3c8274){_0x29a56f['count']=_0x3c8274;if(_0x59adca['query'][_0xd3f9('0x37')]){_0x45c46d[_0xd3f9('0x38')]=[{'all':!![]}];}return db[_0xd3f9('0x26')][_0xd3f9('0x39')](_0x45c46d);})[_0xd3f9('0x1f')](function(_0x1489b1){_0x29a56f[_0xd3f9('0x3a')]=_0x1489b1;return _0x29a56f;})[_0xd3f9('0x1f')](respondWithFilteredResult(_0x4ec657,_0x45c46d))[_0xd3f9('0x3b')](handleError(_0x4ec657,null));};exports[_0xd3f9('0x3c')]=function(_0x501b59,_0x170775){var _0xd76553={'raw':!![],'where':{'id':_0x501b59[_0xd3f9('0x3d')]['id']}},_0x30acc5={};_0x30acc5[_0xd3f9('0x2c')]=_[_0xd3f9('0x3e')](db[_0xd3f9('0x26')]['rawAttributes']);_0x30acc5[_0xd3f9('0x29')]=_[_0xd3f9('0x3e')](_0x501b59[_0xd3f9('0x29')]);_0x30acc5[_0xd3f9('0x2a')]=_[_0xd3f9('0x2b')](_0x30acc5[_0xd3f9('0x2c')],_0x30acc5[_0xd3f9('0x29')]);_0xd76553[_0xd3f9('0x2d')]=_[_0xd3f9('0x2b')](_0x30acc5['model'],qs[_0xd3f9('0x2e')](_0x501b59[_0xd3f9('0x29')]['fields']));_0xd76553['attributes']=_0xd76553[_0xd3f9('0x2d')][_0xd3f9('0x2f')]?_0xd76553[_0xd3f9('0x2d')]:_0x30acc5['model'];if(_0x501b59[_0xd3f9('0x29')][_0xd3f9('0x37')]){_0xd76553[_0xd3f9('0x38')]=[{'all':!![]}];}_0xd76553=_[_0xd3f9('0x35')]({},_0xd76553,_0x501b59[_0xd3f9('0x36')]);return db['AnalyticTreeReport']['find'](_0xd76553)[_0xd3f9('0x1f')](handleEntityNotFound(_0x170775,null))[_0xd3f9('0x1f')](respondWithResult(_0x170775,null))[_0xd3f9('0x3b')](handleError(_0x170775,null));};exports[_0xd3f9('0x3f')]=function(_0x2ab634,_0x244611){return db[_0xd3f9('0x26')][_0xd3f9('0x3f')](_0x2ab634[_0xd3f9('0x40')],{})[_0xd3f9('0x1f')](respondWithResult(_0x244611,0xc9))[_0xd3f9('0x3b')](handleError(_0x244611,null));};exports[_0xd3f9('0x41')]=function(_0x3cca99,_0x191e78){if(_0x3cca99[_0xd3f9('0x40')]['id']){delete _0x3cca99[_0xd3f9('0x40')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x3cca99['params']['id']}})[_0xd3f9('0x1f')](handleEntityNotFound(_0x191e78,null))[_0xd3f9('0x1f')](saveUpdates(_0x3cca99[_0xd3f9('0x40')],null))[_0xd3f9('0x1f')](respondWithResult(_0x191e78,null))[_0xd3f9('0x3b')](handleError(_0x191e78,null));};exports[_0xd3f9('0x20')]=function(_0x91612b,_0xe27fc7){return db[_0xd3f9('0x26')][_0xd3f9('0x42')]({'where':{'id':_0x91612b[_0xd3f9('0x3d')]['id']}})['then'](handleEntityNotFound(_0xe27fc7,null))[_0xd3f9('0x1f')](removeEntity(_0xe27fc7,null))['catch'](handleError(_0xe27fc7,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 924accf..59bf3a9 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 _0x110e=['path','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x110e,0x68));var _0xe110=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x110e[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var logger=require('../../config/logger')(_0xe110('0x2'));var moment=require(_0xe110('0x3'));var BPromise=require(_0xe110('0x4'));var rp=require(_0xe110('0x5'));var fs=require('fs');var path=require(_0xe110('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x37f938,_0x553f49){return _0x37f938[_0xe110('0x7')](_0xe110('0x8'),attributes,{'tableName':_0xe110('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfaf2=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x9e29c2,_0x20b611){var _0x140695=function(_0x273635){while(--_0x273635){_0x9e29c2['push'](_0x9e29c2['shift']());}};_0x140695(++_0x20b611);}(_0xfaf2,0x169));var _0x2faf=function(_0x28071d,_0x3f1f04){_0x28071d=_0x28071d-0x0;var _0x452e54=_0xfaf2[_0x28071d];return _0x452e54;};'use strict';var _=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var logger=require(_0x2faf('0x2'))(_0x2faf('0x3'));var moment=require(_0x2faf('0x4'));var BPromise=require('bluebird');var rp=require(_0x2faf('0x5'));var fs=require('fs');var path=require(_0x2faf('0x6'));var rimraf=require(_0x2faf('0x7'));var config=require(_0x2faf('0x8'));var attributes=require(_0x2faf('0x9'));module['exports']=function(_0x4eacb2,_0x5cf241){return _0x4eacb2[_0x2faf('0xa')](_0x2faf('0xb'),attributes,{'tableName':_0x2faf('0xc'),'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 157775c..a567f76 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 _0x053e=['stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x3638d9,_0x2ff921){var _0x1c1fb9=function(_0x5b2773){while(--_0x5b2773){_0x3638d9['push'](_0x3638d9['shift']());}};_0x1c1fb9(++_0x2ff921);}(_0x053e,0x1e8));var _0xe053=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x053e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe053('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe053('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe053('0x2'));var db=require(_0xe053('0x3'))['db'];var utils=require(_0xe053('0x4'));var logger=require(_0xe053('0x5'))(_0xe053('0x6'));var config=require(_0xe053('0x7'));var jayson=require(_0xe053('0x8'));var client=jayson[_0xe053('0x9')][_0xe053('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116cee,_0x3107ad,_0xc39cfa){return new BPromise(function(_0x4d70b3,_0x1da4f8){return client[_0xe053('0xb')](_0x116cee,_0xc39cfa)[_0xe053('0xc')](function(_0x100d2e){logger[_0xe053('0xd')](_0xe053('0xe'),_0x3107ad,_0xe053('0xf'));logger[_0xe053('0x10')](_0xe053('0x11'),_0x3107ad,'request\x20sent',JSON[_0xe053('0x12')](_0x100d2e));if(_0x100d2e[_0xe053('0x13')]){if(_0x100d2e[_0xe053('0x13')][_0xe053('0x14')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x3107ad,_0x100d2e['error'][_0xe053('0x15')]);return _0x1da4f8(_0x100d2e[_0xe053('0x13')]['message']);}logger[_0xe053('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3107ad,_0x100d2e[_0xe053('0x13')][_0xe053('0x15')]);return _0x4d70b3(_0x100d2e['error'][_0xe053('0x15')]);}else{logger['info'](_0xe053('0xe'),_0x3107ad,_0xe053('0xf'));_0x4d70b3(_0x100d2e['result'][_0xe053('0x15')]);}})[_0xe053('0x16')](function(_0x2e87e2){logger[_0xe053('0x13')](_0xe053('0xe'),_0x3107ad,_0x2e87e2);_0x1da4f8(_0x2e87e2);});});} \ No newline at end of file +var _0xddca=['info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x51c39f,_0x5bfb0b){var _0x274221=function(_0x5610d0){while(--_0x5610d0){_0x51c39f['push'](_0x51c39f['shift']());}};_0x274221(++_0x5bfb0b);}(_0xddca,0x1c2));var _0xaddc=function(_0x1ed2af,_0x35b554){_0x1ed2af=_0x1ed2af-0x0;var _0x444c90=_0xddca[_0x1ed2af];return _0x444c90;};'use strict';var _=require(_0xaddc('0x0'));var util=require('util');var moment=require(_0xaddc('0x1'));var BPromise=require(_0xaddc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaddc('0x3'));var db=require(_0xaddc('0x4'))['db'];var utils=require(_0xaddc('0x5'));var logger=require('../../config/logger')(_0xaddc('0x6'));var config=require(_0xaddc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaddc('0x8')][_0xaddc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51ce33,_0xb165bd,_0x25f748){return new BPromise(function(_0x1e8f40,_0x193db0){return client[_0xaddc('0xa')](_0x51ce33,_0x25f748)[_0xaddc('0xb')](function(_0x53d17f){logger[_0xaddc('0xc')](_0xaddc('0xd'),_0xb165bd,_0xaddc('0xe'));logger[_0xaddc('0xf')](_0xaddc('0x10'),_0xb165bd,'request\x20sent',JSON['stringify'](_0x53d17f));if(_0x53d17f[_0xaddc('0x11')]){if(_0x53d17f[_0xaddc('0x11')][_0xaddc('0x12')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0xb165bd,_0x53d17f[_0xaddc('0x11')][_0xaddc('0x13')]);return _0x193db0(_0x53d17f[_0xaddc('0x11')]['message']);}logger[_0xaddc('0x11')]('AnalyticTreeReport,\x20%s,\x20%s',_0xb165bd,_0x53d17f[_0xaddc('0x11')][_0xaddc('0x13')]);return _0x1e8f40(_0x53d17f['error'][_0xaddc('0x13')]);}else{logger[_0xaddc('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0xb165bd,_0xaddc('0xe'));_0x1e8f40(_0x53d17f[_0xaddc('0x14')][_0xaddc('0x13')]);}})[_0xaddc('0x15')](function(_0x17a4c1){logger[_0xaddc('0x11')]('AnalyticTreeReport,\x20%s,\x20%s',_0xb165bd,_0x17a4c1);_0x193db0(_0x17a4c1);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index a14253e..44030ce 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 _0x0dca=['/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x421f17,_0x14ef38){var _0x1faa08=function(_0x5ac3f0){while(--_0x5ac3f0){_0x421f17['push'](_0x421f17['shift']());}};_0x1faa08(++_0x14ef38);}(_0x0dca,0x1bc));var _0xa0dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0dca[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa0dc('0x0'));var util=require(_0xa0dc('0x1'));var path=require(_0xa0dc('0x2'));var timeout=require(_0xa0dc('0x3'));var express=require(_0xa0dc('0x4'));var router=express[_0xa0dc('0x5')]();var auth=require(_0xa0dc('0x6'));var interaction=require(_0xa0dc('0x7'));var config=require(_0xa0dc('0x8'));var controller=require('./analyticTreeReport.controller');router[_0xa0dc('0x9')]('/',auth[_0xa0dc('0xa')](),controller[_0xa0dc('0xb')]);router['get'](_0xa0dc('0xc'),auth[_0xa0dc('0xa')](),controller['show']);router[_0xa0dc('0xd')]('/',auth[_0xa0dc('0xa')](),controller['create']);router[_0xa0dc('0xe')]('/:id',auth[_0xa0dc('0xa')](),controller[_0xa0dc('0xf')]);router[_0xa0dc('0x10')](_0xa0dc('0xc'),auth[_0xa0dc('0xa')](),controller[_0xa0dc('0x11')]);module[_0xa0dc('0x12')]=router; \ No newline at end of file +var _0x9ae3=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x329e1a,_0x29733b){var _0x3ded41=function(_0x36a471){while(--_0x36a471){_0x329e1a['push'](_0x329e1a['shift']());}};_0x3ded41(++_0x29733b);}(_0x9ae3,0x10e));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x39ae('0x0'));var util=require('util');var path=require(_0x39ae('0x1'));var timeout=require(_0x39ae('0x2'));var express=require(_0x39ae('0x3'));var router=express[_0x39ae('0x4')]();var auth=require(_0x39ae('0x5'));var interaction=require(_0x39ae('0x6'));var config=require(_0x39ae('0x7'));var controller=require(_0x39ae('0x8'));router[_0x39ae('0x9')]('/',auth[_0x39ae('0xa')](),controller[_0x39ae('0xb')]);router[_0x39ae('0x9')](_0x39ae('0xc'),auth[_0x39ae('0xa')](),controller[_0x39ae('0xd')]);router[_0x39ae('0xe')]('/',auth[_0x39ae('0xa')](),controller[_0x39ae('0xf')]);router[_0x39ae('0x10')](_0x39ae('0xc'),auth[_0x39ae('0xa')](),controller[_0x39ae('0x11')]);router[_0x39ae('0x12')](_0x39ae('0xc'),auth[_0x39ae('0xa')](),controller[_0x39ae('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1c56b45..3761bf3 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 _0x022b=['STRING','sequelize'];(function(_0x532b8b,_0x4d0cb0){var _0x3e2607=function(_0x20f0fd){while(--_0x20f0fd){_0x532b8b['push'](_0x532b8b['shift']());}};_0x3e2607(++_0x4d0cb0);}(_0x022b,0x1a3));var _0xb022=function(_0x23f201,_0x58e734){_0x23f201=_0x23f201-0x0;var _0x25794f=_0x022b[_0x23f201];return _0x25794f;};'use strict';var Sequelize=require(_0xb022('0x0'));module['exports']={'name':{'type':Sequelize[_0xb022('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb022('0x1')]}}; \ No newline at end of file +var _0x7147=['exports','STRING'];(function(_0x39db42,_0x3c4cd8){var _0x29683d=function(_0x383fa0){while(--_0x383fa0){_0x39db42['push'](_0x39db42['shift']());}};_0x29683d(++_0x3c4cd8);}(_0x7147,0x1e6));var _0x7714=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x7147[_0x4d40dd];return _0x1c51f2;};'use strict';var Sequelize=require('sequelize');module[_0x7714('0x0')]={'name':{'type':Sequelize[_0x7714('0x1')]},'basename':{'type':Sequelize[_0x7714('0x1')]},'type':{'type':Sequelize[_0x7714('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index e1c8f0f..f8e6478 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 _0x6ed6=['root','server/files/attachments/','basename','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../mysqldb','status','end','json','count','offset','set','Content-Range','reject','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','filter','options','Attachment','includeAll','include','findAll','rows','show','params','keys','fields','find','catch','clone','length','get','omit','createdAt','updatedAt','body','create','file','filename','mimetype','download','join'];(function(_0xcae8b6,_0x5781ee){var _0x28daa0=function(_0x321ef0){while(--_0x321ef0){_0xcae8b6['push'](_0xcae8b6['shift']());}};_0x28daa0(++_0x5781ee);}(_0x6ed6,0x14f));var _0x66ed=function(_0x4e7abb,_0x4377b7){_0x4e7abb=_0x4e7abb-0x0;var _0x348db9=_0x6ed6[_0x4e7abb];return _0x348db9;};'use strict';var pdf=require(_0x66ed('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x66ed('0x1'));var jsonpatch=require(_0x66ed('0x2'));var rp=require(_0x66ed('0x3'));var moment=require(_0x66ed('0x4'));var BPromise=require(_0x66ed('0x5'));var Mustache=require(_0x66ed('0x6'));var util=require('util');var path=require(_0x66ed('0x7'));var sox=require('sox');var csv=require(_0x66ed('0x8'));var ejs=require(_0x66ed('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x66ed('0xa'));var crypto=require('crypto');var jsforce=require(_0x66ed('0xb'));var deskjs=require(_0x66ed('0xc'));var toCsv=require(_0x66ed('0x8'));var querystring=require(_0x66ed('0xd'));var Papa=require(_0x66ed('0xe'));var Redis=require('ioredis');var authService=require(_0x66ed('0xf'));var qs=require(_0x66ed('0x10'));var as=require(_0x66ed('0x11'));var hardwareService=require(_0x66ed('0x12'));var logger=require(_0x66ed('0x13'))(_0x66ed('0x14'));var utils=require(_0x66ed('0x15'));var config=require('../../config/environment');var db=require(_0x66ed('0x16'))['db'];function respondWithStatusCode(_0x290bfd,_0x1fa5e4){_0x1fa5e4=_0x1fa5e4||0xcc;return function(_0x31664e){if(_0x31664e){return _0x290bfd['sendStatus'](_0x1fa5e4);}return _0x290bfd[_0x66ed('0x17')](_0x1fa5e4)[_0x66ed('0x18')]();};}function respondWithResult(_0x5b629d,_0x97e38a){_0x97e38a=_0x97e38a||0xc8;return function(_0xc97ec5){if(_0xc97ec5){return _0x5b629d[_0x66ed('0x17')](_0x97e38a)[_0x66ed('0x19')](_0xc97ec5);}};}function respondWithFilteredResult(_0x4b317f,_0x3baad6){return function(_0x1513f6){if(_0x1513f6){var _0x324933=_0x1513f6[_0x66ed('0x1a')],_0x367e4f=_0x3baad6[_0x66ed('0x1b')],_0x6ff7db=_0x3baad6[_0x66ed('0x1b')]+_0x3baad6['limit'],_0x2460b6;if(_0x6ff7db>=_0x324933){_0x6ff7db=_0x324933;_0x2460b6=0xc8;}else{_0x2460b6=0xce;}_0x4b317f[_0x66ed('0x17')](_0x2460b6);return _0x4b317f[_0x66ed('0x1c')](_0x66ed('0x1d'),_0x367e4f+'-'+_0x6ff7db+'/'+_0x324933)[_0x66ed('0x19')](_0x1513f6);}return null;};}function patchUpdates(_0x40a9a7){return function(_0x5c8776){try{jsonpatch['apply'](_0x5c8776,_0x40a9a7,!![]);}catch(_0x29a94b){return BPromise[_0x66ed('0x1e')](_0x29a94b);}return _0x5c8776['save']();};}function saveUpdates(_0x1a445a,_0x35a6e4){return function(_0x4e319c){if(_0x4e319c){return _0x4e319c[_0x66ed('0x1f')](_0x1a445a)[_0x66ed('0x20')](function(_0x5a7b97){return _0x5a7b97;});}return null;};}function removeEntity(_0x4bcc84,_0x2cf544){return function(_0x553bae){if(_0x553bae){return _0x553bae[_0x66ed('0x21')]()['then'](function(){_0x4bcc84['status'](0xcc)[_0x66ed('0x18')]();});}};}function handleEntityNotFound(_0x2beb80,_0x5393ec){return function(_0x1bd3a8){if(!_0x1bd3a8){_0x2beb80['sendStatus'](0x194);}return _0x1bd3a8;};}function handleError(_0x285e65,_0x50ff88){_0x50ff88=_0x50ff88||0x1f4;return function(_0x276b87){logger[_0x66ed('0x22')](_0x276b87['stack']);if(_0x276b87[_0x66ed('0x23')]){delete _0x276b87[_0x66ed('0x23')];}_0x285e65['status'](_0x50ff88)[_0x66ed('0x24')](_0x276b87);};}exports['index']=function(_0x38688f,_0x173bd9){var _0xb98fbd={},_0x486158={},_0x1c9e33={'count':0x0,'rows':[]};var _0x3183ce=_[_0x66ed('0x25')](db['Attachment'][_0x66ed('0x26')],function(_0x2ce917){return{'name':_0x2ce917[_0x66ed('0x27')],'type':_0x2ce917[_0x66ed('0x28')][_0x66ed('0x29')]};});_0x486158['model']=_['map'](_0x3183ce,_0x66ed('0x23'));_0x486158[_0x66ed('0x2a')]=_['keys'](_0x38688f[_0x66ed('0x2a')]);_0x486158[_0x66ed('0x2b')]=_[_0x66ed('0x2c')](_0x486158[_0x66ed('0x2d')],_0x486158[_0x66ed('0x2a')]);_0xb98fbd['attributes']=_[_0x66ed('0x2c')](_0x486158[_0x66ed('0x2d')],qs['fields'](_0x38688f['query']['fields']));_0xb98fbd[_0x66ed('0x2e')]=_0xb98fbd['attributes']['length']?_0xb98fbd[_0x66ed('0x2e')]:_0x486158[_0x66ed('0x2d')];if(!_0x38688f[_0x66ed('0x2a')][_0x66ed('0x2f')](_0x66ed('0x30'))){_0xb98fbd['limit']=qs[_0x66ed('0x31')](_0x38688f[_0x66ed('0x2a')][_0x66ed('0x31')]);_0xb98fbd['offset']=qs[_0x66ed('0x1b')](_0x38688f[_0x66ed('0x2a')][_0x66ed('0x1b')]);}_0xb98fbd['order']=qs['sort'](_0x38688f[_0x66ed('0x2a')]['sort']);_0xb98fbd[_0x66ed('0x32')]=qs[_0x66ed('0x2b')](_[_0x66ed('0x33')](_0x38688f['query'],_0x486158['filters']),_0x3183ce);if(_0x38688f['query']['filter']){_0xb98fbd[_0x66ed('0x32')]=_[_0x66ed('0x34')](_0xb98fbd[_0x66ed('0x32')],{'$or':_[_0x66ed('0x25')](_0x3183ce,function(_0x923fc7){if(_0x923fc7['type']!==_0x66ed('0x35')){var _0x50d4fd={};_0x50d4fd[_0x923fc7[_0x66ed('0x23')]]={'$like':'%'+_0x38688f[_0x66ed('0x2a')][_0x66ed('0x36')]+'%'};return _0x50d4fd;}})});}_0xb98fbd=_[_0x66ed('0x34')]({},_0xb98fbd,_0x38688f[_0x66ed('0x37')]);var _0x2ed68c={'where':_0xb98fbd[_0x66ed('0x32')]};return db[_0x66ed('0x38')][_0x66ed('0x1a')](_0x2ed68c)[_0x66ed('0x20')](function(_0x4f8b0e){_0x1c9e33[_0x66ed('0x1a')]=_0x4f8b0e;if(_0x38688f[_0x66ed('0x2a')][_0x66ed('0x39')]){_0xb98fbd[_0x66ed('0x3a')]=[{'all':!![]}];}return db[_0x66ed('0x38')][_0x66ed('0x3b')](_0xb98fbd);})[_0x66ed('0x20')](function(_0x2db8a0){_0x1c9e33[_0x66ed('0x3c')]=_0x2db8a0;return _0x1c9e33;})[_0x66ed('0x20')](respondWithFilteredResult(_0x173bd9,_0xb98fbd))['catch'](handleError(_0x173bd9,null));};exports[_0x66ed('0x3d')]=function(_0x477e90,_0x498b8f){var _0x3cf27e={'raw':!![],'where':{'id':_0x477e90[_0x66ed('0x3e')]['id']}},_0x190bcb={};_0x190bcb[_0x66ed('0x2d')]=_[_0x66ed('0x3f')](db[_0x66ed('0x38')]['rawAttributes']);_0x190bcb[_0x66ed('0x2a')]=_['keys'](_0x477e90[_0x66ed('0x2a')]);_0x190bcb[_0x66ed('0x2b')]=_[_0x66ed('0x2c')](_0x190bcb[_0x66ed('0x2d')],_0x190bcb['query']);_0x3cf27e[_0x66ed('0x2e')]=_[_0x66ed('0x2c')](_0x190bcb[_0x66ed('0x2d')],qs[_0x66ed('0x40')](_0x477e90[_0x66ed('0x2a')][_0x66ed('0x40')]));_0x3cf27e[_0x66ed('0x2e')]=_0x3cf27e[_0x66ed('0x2e')]['length']?_0x3cf27e[_0x66ed('0x2e')]:_0x190bcb[_0x66ed('0x2d')];if(_0x477e90['query'][_0x66ed('0x39')]){_0x3cf27e['include']=[{'all':!![]}];}_0x3cf27e=_[_0x66ed('0x34')]({},_0x3cf27e,_0x477e90[_0x66ed('0x37')]);return db['Attachment'][_0x66ed('0x41')](_0x3cf27e)[_0x66ed('0x20')](handleEntityNotFound(_0x498b8f,null))[_0x66ed('0x20')](respondWithResult(_0x498b8f,null))[_0x66ed('0x42')](handleError(_0x498b8f,null));};exports[_0x66ed('0x43')]=function(_0x4ac430,_0x427f31){var _0x27279b={'where':{'id':_0x4ac430['params']['id']}},_0x22099d={};_0x22099d[_0x66ed('0x2d')]=_[_0x66ed('0x3f')](db[_0x66ed('0x38')]['rawAttributes']);_0x27279b[_0x66ed('0x2e')]=_['intersection'](_0x22099d['model'],qs[_0x66ed('0x40')](_0x4ac430[_0x66ed('0x2a')]['fields']));_0x27279b[_0x66ed('0x2e')]=_0x27279b[_0x66ed('0x2e')][_0x66ed('0x44')]?_0x27279b[_0x66ed('0x2e')]:_0x22099d[_0x66ed('0x2d')];if(_0x4ac430[_0x66ed('0x2a')][_0x66ed('0x39')]){_0x27279b[_0x66ed('0x3a')]=[{'all':!![]}];}_0x27279b=_['merge']({},_0x27279b,_0x4ac430[_0x66ed('0x37')]);return db[_0x66ed('0x38')]['find'](_0x27279b)[_0x66ed('0x20')](handleEntityNotFound(_0x427f31,null))['then'](function(_0x20954a){if(_0x20954a){var _0x41b4ab=_0x20954a[_0x66ed('0x45')]({'plain':!![]});_0x41b4ab=qs[_0x66ed('0x46')](_0x41b4ab,['id',_0x66ed('0x47'),_0x66ed('0x48')]);_0x4ac430[_0x66ed('0x49')]=_['omit'](_0x4ac430[_0x66ed('0x49')],['id',_0x66ed('0x47'),_0x66ed('0x48')]);return db[_0x66ed('0x38')][_0x66ed('0x4a')](_[_0x66ed('0x34')](_0x41b4ab,_0x4ac430['body']),{'include':_0x4ac430[_0x66ed('0x2a')][_0x66ed('0x39')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x427f31,0xc9))['catch'](handleError(_0x427f31,null));};exports[_0x66ed('0x1f')]=function(_0x158bfa,_0x116e2b){if(_0x158bfa[_0x66ed('0x49')]['id']){delete _0x158bfa['body']['id'];}return db[_0x66ed('0x38')][_0x66ed('0x41')]({'where':{'id':_0x158bfa[_0x66ed('0x3e')]['id']}})[_0x66ed('0x20')](handleEntityNotFound(_0x116e2b,null))[_0x66ed('0x20')](saveUpdates(_0x158bfa[_0x66ed('0x49')],null))[_0x66ed('0x20')](respondWithResult(_0x116e2b,null))['catch'](handleError(_0x116e2b,null));};exports[_0x66ed('0x21')]=function(_0x5a9a09,_0x2972f0){return db[_0x66ed('0x38')]['find']({'where':{'id':_0x5a9a09[_0x66ed('0x3e')]['id']}})[_0x66ed('0x20')](handleEntityNotFound(_0x2972f0,null))['then'](removeEntity(_0x2972f0,null))['catch'](handleError(_0x2972f0,null));};exports[_0x66ed('0x4a')]=function(_0x58b833,_0x3a617c,_0xa9762e){_0x58b833[_0x66ed('0x49')][_0x66ed('0x23')]=_0x58b833[_0x66ed('0x4b')]['originalname'];_0x58b833[_0x66ed('0x49')]['basename']=_0x58b833['file'][_0x66ed('0x4c')];_0x58b833[_0x66ed('0x49')]['type']=_0x58b833[_0x66ed('0x4b')][_0x66ed('0x4d')];return db[_0x66ed('0x38')][_0x66ed('0x4a')](_0x58b833[_0x66ed('0x49')])['then'](respondWithResult(_0x3a617c,0xc9))[_0x66ed('0x42')](handleError(_0x3a617c,null));};exports[_0x66ed('0x4e')]=function(_0x31617f,_0x3364db,_0x20d3e0){return db['Attachment']['findOne']({'where':{'id':_0x31617f[_0x66ed('0x3e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3364db,null))[_0x66ed('0x20')](function(_0x1ab6c9){if(_0x1ab6c9){return _0x3364db[_0x66ed('0x4e')](path[_0x66ed('0x4f')](config[_0x66ed('0x50')],_0x66ed('0x51'),_0x1ab6c9[_0x66ed('0x52')]));}})[_0x66ed('0x42')](handleError(_0x3364db,null));}; \ No newline at end of file +var _0x99bc=['mimetype','findOne','download','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','querystring','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','then','error','stack','send','index','map','Attachment','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','limit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','clone','get','omit','createdAt','body','updatedAt','create','update','file','originalname','basename','filename','type'];(function(_0x2e4c04,_0x3e7685){var _0x227792=function(_0x811fe3){while(--_0x811fe3){_0x2e4c04['push'](_0x2e4c04['shift']());}};_0x227792(++_0x3e7685);}(_0x99bc,0x166));var _0xc99b=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x99bc[_0x53ccf2];return _0x5a2964;};'use strict';var pdf=require(_0xc99b('0x0'));var emlformat=require(_0xc99b('0x1'));var rimraf=require(_0xc99b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc99b('0x3'));var rp=require(_0xc99b('0x4'));var moment=require('moment');var BPromise=require(_0xc99b('0x5'));var Mustache=require(_0xc99b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc99b('0x7'));var csv=require(_0xc99b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc99b('0x9'));var squel=require('squel');var crypto=require(_0xc99b('0xa'));var jsforce=require(_0xc99b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc99b('0x8'));var querystring=require(_0xc99b('0xc'));var Papa=require(_0xc99b('0xd'));var Redis=require(_0xc99b('0xe'));var authService=require(_0xc99b('0xf'));var qs=require(_0xc99b('0x10'));var as=require(_0xc99b('0x11'));var hardwareService=require(_0xc99b('0x12'));var logger=require('../../config/logger')(_0xc99b('0x13'));var utils=require(_0xc99b('0x14'));var config=require(_0xc99b('0x15'));var db=require(_0xc99b('0x16'))['db'];function respondWithStatusCode(_0x1767b6,_0x144887){_0x144887=_0x144887||0xcc;return function(_0x12312a){if(_0x12312a){return _0x1767b6[_0xc99b('0x17')](_0x144887);}return _0x1767b6[_0xc99b('0x18')](_0x144887)[_0xc99b('0x19')]();};}function respondWithResult(_0x31a144,_0x1581cf){_0x1581cf=_0x1581cf||0xc8;return function(_0x5584b4){if(_0x5584b4){return _0x31a144['status'](_0x1581cf)[_0xc99b('0x1a')](_0x5584b4);}};}function respondWithFilteredResult(_0x89ab93,_0x590e6a){return function(_0x378f0b){if(_0x378f0b){var _0x4fc301=_0x378f0b[_0xc99b('0x1b')],_0x11350f=_0x590e6a['offset'],_0x75dbf8=_0x590e6a[_0xc99b('0x1c')]+_0x590e6a['limit'],_0x2c8918;if(_0x75dbf8>=_0x4fc301){_0x75dbf8=_0x4fc301;_0x2c8918=0xc8;}else{_0x2c8918=0xce;}_0x89ab93[_0xc99b('0x18')](_0x2c8918);return _0x89ab93[_0xc99b('0x1d')](_0xc99b('0x1e'),_0x11350f+'-'+_0x75dbf8+'/'+_0x4fc301)[_0xc99b('0x1a')](_0x378f0b);}return null;};}function patchUpdates(_0x1b7192){return function(_0x4175f4){try{jsonpatch[_0xc99b('0x1f')](_0x4175f4,_0x1b7192,!![]);}catch(_0x5d2dbd){return BPromise[_0xc99b('0x20')](_0x5d2dbd);}return _0x4175f4[_0xc99b('0x21')]();};}function saveUpdates(_0x3f33b1,_0x275dac){return function(_0x8bcd5c){if(_0x8bcd5c){return _0x8bcd5c['update'](_0x3f33b1)['then'](function(_0x4b2b33){return _0x4b2b33;});}return null;};}function removeEntity(_0xebaa0e,_0x223613){return function(_0x4534ef){if(_0x4534ef){return _0x4534ef['destroy']()[_0xc99b('0x22')](function(){_0xebaa0e[_0xc99b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b6859,_0x55d09c){return function(_0x17be6e){if(!_0x17be6e){_0x1b6859[_0xc99b('0x17')](0x194);}return _0x17be6e;};}function handleError(_0x4e785a,_0x4a360a){_0x4a360a=_0x4a360a||0x1f4;return function(_0x3f69fe){logger[_0xc99b('0x23')](_0x3f69fe[_0xc99b('0x24')]);if(_0x3f69fe['name']){delete _0x3f69fe['name'];}_0x4e785a[_0xc99b('0x18')](_0x4a360a)[_0xc99b('0x25')](_0x3f69fe);};}exports[_0xc99b('0x26')]=function(_0x4615e7,_0x2b60bb){var _0xcf75c6={},_0x3ab2fc={},_0x52632e={'count':0x0,'rows':[]};var _0x486d46=_[_0xc99b('0x27')](db[_0xc99b('0x28')][_0xc99b('0x29')],function(_0x25cfeb){return{'name':_0x25cfeb[_0xc99b('0x2a')],'type':_0x25cfeb['type'][_0xc99b('0x2b')]};});_0x3ab2fc[_0xc99b('0x2c')]=_[_0xc99b('0x27')](_0x486d46,_0xc99b('0x2d'));_0x3ab2fc[_0xc99b('0x2e')]=_[_0xc99b('0x2f')](_0x4615e7[_0xc99b('0x2e')]);_0x3ab2fc[_0xc99b('0x30')]=_[_0xc99b('0x31')](_0x3ab2fc[_0xc99b('0x2c')],_0x3ab2fc['query']);_0xcf75c6[_0xc99b('0x32')]=_[_0xc99b('0x31')](_0x3ab2fc[_0xc99b('0x2c')],qs[_0xc99b('0x33')](_0x4615e7[_0xc99b('0x2e')]['fields']));_0xcf75c6[_0xc99b('0x32')]=_0xcf75c6['attributes'][_0xc99b('0x34')]?_0xcf75c6[_0xc99b('0x32')]:_0x3ab2fc[_0xc99b('0x2c')];if(!_0x4615e7[_0xc99b('0x2e')]['hasOwnProperty']('nolimit')){_0xcf75c6['limit']=qs[_0xc99b('0x35')](_0x4615e7[_0xc99b('0x2e')][_0xc99b('0x35')]);_0xcf75c6[_0xc99b('0x1c')]=qs[_0xc99b('0x1c')](_0x4615e7[_0xc99b('0x2e')][_0xc99b('0x1c')]);}_0xcf75c6['order']=qs[_0xc99b('0x36')](_0x4615e7[_0xc99b('0x2e')][_0xc99b('0x36')]);_0xcf75c6['where']=qs[_0xc99b('0x30')](_[_0xc99b('0x37')](_0x4615e7[_0xc99b('0x2e')],_0x3ab2fc[_0xc99b('0x30')]),_0x486d46);if(_0x4615e7[_0xc99b('0x2e')]['filter']){_0xcf75c6[_0xc99b('0x38')]=_[_0xc99b('0x39')](_0xcf75c6['where'],{'$or':_['map'](_0x486d46,function(_0x198c7d){if(_0x198c7d['type']!==_0xc99b('0x3a')){var _0x809bf={};_0x809bf[_0x198c7d[_0xc99b('0x2d')]]={'$like':'%'+_0x4615e7['query'][_0xc99b('0x3b')]+'%'};return _0x809bf;}})});}_0xcf75c6=_[_0xc99b('0x39')]({},_0xcf75c6,_0x4615e7[_0xc99b('0x3c')]);var _0xe417ed={'where':_0xcf75c6[_0xc99b('0x38')]};return db['Attachment']['count'](_0xe417ed)[_0xc99b('0x22')](function(_0xfc39aa){_0x52632e['count']=_0xfc39aa;if(_0x4615e7[_0xc99b('0x2e')][_0xc99b('0x3d')]){_0xcf75c6['include']=[{'all':!![]}];}return db[_0xc99b('0x28')][_0xc99b('0x3e')](_0xcf75c6);})[_0xc99b('0x22')](function(_0x35b6d6){_0x52632e[_0xc99b('0x3f')]=_0x35b6d6;return _0x52632e;})[_0xc99b('0x22')](respondWithFilteredResult(_0x2b60bb,_0xcf75c6))[_0xc99b('0x40')](handleError(_0x2b60bb,null));};exports[_0xc99b('0x41')]=function(_0x4a00fb,_0x27d806){var _0x42b4fc={'raw':!![],'where':{'id':_0x4a00fb[_0xc99b('0x42')]['id']}},_0x23b0c3={};_0x23b0c3['model']=_['keys'](db[_0xc99b('0x28')][_0xc99b('0x29')]);_0x23b0c3[_0xc99b('0x2e')]=_[_0xc99b('0x2f')](_0x4a00fb[_0xc99b('0x2e')]);_0x23b0c3[_0xc99b('0x30')]=_['intersection'](_0x23b0c3['model'],_0x23b0c3[_0xc99b('0x2e')]);_0x42b4fc['attributes']=_[_0xc99b('0x31')](_0x23b0c3['model'],qs[_0xc99b('0x33')](_0x4a00fb[_0xc99b('0x2e')][_0xc99b('0x33')]));_0x42b4fc[_0xc99b('0x32')]=_0x42b4fc[_0xc99b('0x32')][_0xc99b('0x34')]?_0x42b4fc['attributes']:_0x23b0c3[_0xc99b('0x2c')];if(_0x4a00fb[_0xc99b('0x2e')][_0xc99b('0x3d')]){_0x42b4fc[_0xc99b('0x43')]=[{'all':!![]}];}_0x42b4fc=_[_0xc99b('0x39')]({},_0x42b4fc,_0x4a00fb[_0xc99b('0x3c')]);return db[_0xc99b('0x28')][_0xc99b('0x44')](_0x42b4fc)[_0xc99b('0x22')](handleEntityNotFound(_0x27d806,null))['then'](respondWithResult(_0x27d806,null))['catch'](handleError(_0x27d806,null));};exports[_0xc99b('0x45')]=function(_0x6c8b31,_0x5d3fde){var _0x1c1528={'where':{'id':_0x6c8b31[_0xc99b('0x42')]['id']}},_0x550274={};_0x550274[_0xc99b('0x2c')]=_['keys'](db[_0xc99b('0x28')]['rawAttributes']);_0x1c1528[_0xc99b('0x32')]=_[_0xc99b('0x31')](_0x550274['model'],qs[_0xc99b('0x33')](_0x6c8b31[_0xc99b('0x2e')][_0xc99b('0x33')]));_0x1c1528[_0xc99b('0x32')]=_0x1c1528[_0xc99b('0x32')][_0xc99b('0x34')]?_0x1c1528[_0xc99b('0x32')]:_0x550274[_0xc99b('0x2c')];if(_0x6c8b31[_0xc99b('0x2e')][_0xc99b('0x3d')]){_0x1c1528['include']=[{'all':!![]}];}_0x1c1528=_['merge']({},_0x1c1528,_0x6c8b31['options']);return db['Attachment'][_0xc99b('0x44')](_0x1c1528)[_0xc99b('0x22')](handleEntityNotFound(_0x5d3fde,null))[_0xc99b('0x22')](function(_0xc3b485){if(_0xc3b485){var _0x282a10=_0xc3b485[_0xc99b('0x46')]({'plain':!![]});_0x282a10=qs[_0xc99b('0x47')](_0x282a10,['id',_0xc99b('0x48'),'updatedAt']);_0x6c8b31[_0xc99b('0x49')]=_[_0xc99b('0x47')](_0x6c8b31[_0xc99b('0x49')],['id','createdAt',_0xc99b('0x4a')]);return db[_0xc99b('0x28')][_0xc99b('0x4b')](_[_0xc99b('0x39')](_0x282a10,_0x6c8b31[_0xc99b('0x49')]),{'include':_0x6c8b31[_0xc99b('0x2e')][_0xc99b('0x3d')]?[{'all':!![]}]:undefined});}})[_0xc99b('0x22')](respondWithResult(_0x5d3fde,0xc9))[_0xc99b('0x40')](handleError(_0x5d3fde,null));};exports[_0xc99b('0x4c')]=function(_0x568a08,_0x913589){if(_0x568a08[_0xc99b('0x49')]['id']){delete _0x568a08[_0xc99b('0x49')]['id'];}return db['Attachment'][_0xc99b('0x44')]({'where':{'id':_0x568a08[_0xc99b('0x42')]['id']}})[_0xc99b('0x22')](handleEntityNotFound(_0x913589,null))[_0xc99b('0x22')](saveUpdates(_0x568a08[_0xc99b('0x49')],null))[_0xc99b('0x22')](respondWithResult(_0x913589,null))[_0xc99b('0x40')](handleError(_0x913589,null));};exports['destroy']=function(_0x47059e,_0x5d3c78){return db['Attachment'][_0xc99b('0x44')]({'where':{'id':_0x47059e[_0xc99b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d3c78,null))[_0xc99b('0x22')](removeEntity(_0x5d3c78,null))[_0xc99b('0x40')](handleError(_0x5d3c78,null));};exports[_0xc99b('0x4b')]=function(_0x499a36,_0x5a5419,_0x2b74b0){_0x499a36[_0xc99b('0x49')]['name']=_0x499a36[_0xc99b('0x4d')][_0xc99b('0x4e')];_0x499a36[_0xc99b('0x49')][_0xc99b('0x4f')]=_0x499a36['file'][_0xc99b('0x50')];_0x499a36[_0xc99b('0x49')][_0xc99b('0x51')]=_0x499a36[_0xc99b('0x4d')][_0xc99b('0x52')];return db[_0xc99b('0x28')][_0xc99b('0x4b')](_0x499a36[_0xc99b('0x49')])[_0xc99b('0x22')](respondWithResult(_0x5a5419,0xc9))[_0xc99b('0x40')](handleError(_0x5a5419,null));};exports['download']=function(_0x2d8b9c,_0x1c341a,_0x3a1de6){return db[_0xc99b('0x28')][_0xc99b('0x53')]({'where':{'id':_0x2d8b9c[_0xc99b('0x42')]['id']},'raw':!![]})[_0xc99b('0x22')](handleEntityNotFound(_0x1c341a,null))[_0xc99b('0x22')](function(_0xe24805){if(_0xe24805){return _0x1c341a[_0xc99b('0x54')](path[_0xc99b('0x55')](config[_0xc99b('0x56')],_0xc99b('0x57'),_0xe24805['basename']));}})[_0xc99b('0x40')](handleError(_0x1c341a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f76c474..d5ba3bf 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','util'];(function(_0x53b78f,_0x397490){var _0x2241a9=function(_0x2c4687){while(--_0x2c4687){_0x53b78f['push'](_0x53b78f['shift']());}};_0x2241a9(++_0x397490);}(_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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x373d=['define','Attachment','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x373d,0x1e2));var _0xd373=function(_0xff69c6,_0x18c4a8){_0xff69c6=_0xff69c6-0x0;var _0x17551f=_0x373d[_0xff69c6];return _0x17551f;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var logger=require(_0xd373('0x1'))(_0xd373('0x2'));var moment=require(_0xd373('0x3'));var BPromise=require(_0xd373('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd373('0x5'));var rimraf=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var attributes=require('./attachment.attributes');module['exports']=function(_0x31a0fb,_0x3e4443){return _0x31a0fb[_0xd373('0x8')](_0xd373('0x9'),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 3fdd600..d4a905a 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 _0xf751=['raw','stringify','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','create','options'];(function(_0x43fa29,_0x2aefa2){var _0x32637f=function(_0x2e83ba){while(--_0x2e83ba){_0x43fa29['push'](_0x43fa29['shift']());}};_0x32637f(++_0x2aefa2);}(_0xf751,0xda));var _0x1f75=function(_0x3983e1,_0x4c0f08){_0x3983e1=_0x3983e1-0x0;var _0x1c4d4d=_0xf751[_0x3983e1];return _0x1c4d4d;};'use strict';var _=require(_0x1f75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1f75('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f75('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f75('0x3'));var logger=require(_0x1f75('0x4'))(_0x1f75('0x5'));var config=require(_0x1f75('0x6'));var jayson=require(_0x1f75('0x7'));var client=jayson[_0x1f75('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0e55,_0x1dcc88,_0x411838){return new BPromise(function(_0x4d2c46,_0x3673d9){return client[_0x1f75('0x9')](_0x3b0e55,_0x411838)[_0x1f75('0xa')](function(_0x506653){logger[_0x1f75('0xb')]('Attachment,\x20%s,\x20%s',_0x1dcc88,'request\x20sent');logger[_0x1f75('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1dcc88,_0x1f75('0xd'),JSON['stringify'](_0x506653));if(_0x506653[_0x1f75('0xe')]){if(_0x506653[_0x1f75('0xe')]['code']===0x1f4){logger[_0x1f75('0xe')](_0x1f75('0xf'),_0x1dcc88,_0x506653['error'][_0x1f75('0x10')]);return _0x3673d9(_0x506653['error'][_0x1f75('0x10')]);}logger[_0x1f75('0xe')](_0x1f75('0xf'),_0x1dcc88,_0x506653[_0x1f75('0xe')]['message']);return _0x4d2c46(_0x506653[_0x1f75('0xe')]['message']);}else{logger[_0x1f75('0xb')]('Attachment,\x20%s,\x20%s',_0x1dcc88,_0x1f75('0xd'));_0x4d2c46(_0x506653[_0x1f75('0x11')][_0x1f75('0x10')]);}})[_0x1f75('0x12')](function(_0x54559d){logger[_0x1f75('0xe')](_0x1f75('0xf'),_0x1dcc88,_0x54559d);_0x3673d9(_0x54559d);});});}exports[_0x1f75('0x13')]=function(_0xcf9a0a){var _0x30798f=this;return new Promise(function(_0x35a174,_0x51d679){return db['Attachment'][_0x1f75('0x14')](_0xcf9a0a['body'],{'raw':_0xcf9a0a[_0x1f75('0x15')]?_0xcf9a0a[_0x1f75('0x15')][_0x1f75('0x16')]===undefined?!![]:![]:!![]})[_0x1f75('0xa')](function(_0x29f04c){logger[_0x1f75('0xb')](_0x1f75('0x13'),_0xcf9a0a);logger[_0x1f75('0xc')](_0x1f75('0x13'),_0xcf9a0a,JSON[_0x1f75('0x17')](_0x29f04c));_0x35a174(_0x29f04c);})[_0x1f75('0x12')](function(_0x528540){logger[_0x1f75('0xe')](_0x1f75('0x13'),_0x528540[_0x1f75('0x10')],_0xcf9a0a);_0x51d679(_0x30798f[_0x1f75('0xe')](0x1f4,_0x528540['message']));});});}; \ No newline at end of file +var _0xe4bb=['CreateAttachment','Attachment','body','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0xe4bb,0x8c));var _0xbe4b=function(_0x5b8104,_0x4a7fb9){_0x5b8104=_0x5b8104-0x0;var _0x1024f4=_0xe4bb[_0x5b8104];return _0x1024f4;};'use strict';var _=require(_0xbe4b('0x0'));var util=require(_0xbe4b('0x1'));var moment=require('moment');var BPromise=require(_0xbe4b('0x2'));var rs=require(_0xbe4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe4b('0x5'))(_0xbe4b('0x6'));var config=require(_0xbe4b('0x7'));var jayson=require(_0xbe4b('0x8'));var client=jayson['client'][_0xbe4b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441d71,_0x500f7b,_0x38a7a6){return new BPromise(function(_0x4a484d,_0x574dc4){return client['request'](_0x441d71,_0x38a7a6)[_0xbe4b('0xa')](function(_0x445c46){logger['info'](_0xbe4b('0xb'),_0x500f7b,_0xbe4b('0xc'));logger[_0xbe4b('0xd')](_0xbe4b('0xe'),_0x500f7b,'request\x20sent',JSON[_0xbe4b('0xf')](_0x445c46));if(_0x445c46[_0xbe4b('0x10')]){if(_0x445c46['error'][_0xbe4b('0x11')]===0x1f4){logger[_0xbe4b('0x10')](_0xbe4b('0xb'),_0x500f7b,_0x445c46[_0xbe4b('0x10')][_0xbe4b('0x12')]);return _0x574dc4(_0x445c46[_0xbe4b('0x10')][_0xbe4b('0x12')]);}logger[_0xbe4b('0x10')](_0xbe4b('0xb'),_0x500f7b,_0x445c46[_0xbe4b('0x10')][_0xbe4b('0x12')]);return _0x4a484d(_0x445c46[_0xbe4b('0x10')]['message']);}else{logger[_0xbe4b('0x13')](_0xbe4b('0xb'),_0x500f7b,_0xbe4b('0xc'));_0x4a484d(_0x445c46[_0xbe4b('0x14')][_0xbe4b('0x12')]);}})[_0xbe4b('0x15')](function(_0x21d1cf){logger[_0xbe4b('0x10')]('Attachment,\x20%s,\x20%s',_0x500f7b,_0x21d1cf);_0x574dc4(_0x21d1cf);});});}exports[_0xbe4b('0x16')]=function(_0x1ec80e){var _0x31a8bc=this;return new Promise(function(_0x3c6be8,_0x2b071f){return db[_0xbe4b('0x17')]['create'](_0x1ec80e[_0xbe4b('0x18')],{'raw':_0x1ec80e[_0xbe4b('0x19')]?_0x1ec80e[_0xbe4b('0x19')][_0xbe4b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5bda15){logger[_0xbe4b('0x13')](_0xbe4b('0x16'),_0x1ec80e);logger['debug']('CreateAttachment',_0x1ec80e,JSON[_0xbe4b('0xf')](_0x5bda15));_0x3c6be8(_0x5bda15);})[_0xbe4b('0x15')](function(_0x1c75be){logger[_0xbe4b('0x10')](_0xbe4b('0x16'),_0x1c75be[_0xbe4b('0x12')],_0x1ec80e);_0x2b071f(_0x31a8bc[_0xbe4b('0x10')](0x1f4,_0x1c75be[_0xbe4b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 12d5369..58c42d5 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 _0x0936=['isAuthenticated','index','/:id','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./attachment.controller','get'];(function(_0x3326c0,_0x259033){var _0x58a5f5=function(_0x146f0a){while(--_0x146f0a){_0x3326c0['push'](_0x3326c0['shift']());}};_0x58a5f5(++_0x259033);}(_0x0936,0xde));var _0x6093=function(_0x2bc324,_0x40d64d){_0x2bc324=_0x2bc324-0x0;var _0x312c10=_0x0936[_0x2bc324];return _0x312c10;};'use strict';var multer=require(_0x6093('0x0'));var util=require(_0x6093('0x1'));var path=require(_0x6093('0x2'));var timeout=require(_0x6093('0x3'));var express=require(_0x6093('0x4'));var router=express[_0x6093('0x5')]();var auth=require(_0x6093('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6093('0x7'));router[_0x6093('0x8')]('/',auth[_0x6093('0x9')](),controller[_0x6093('0xa')]);router[_0x6093('0x8')](_0x6093('0xb'),auth[_0x6093('0x9')](),controller['show']);router['get'](_0x6093('0xc'),auth[_0x6093('0x9')](),controller[_0x6093('0xd')]);router[_0x6093('0xe')](_0x6093('0xf'),auth[_0x6093('0x9')](),controller[_0x6093('0x10')]);var upload=multer({'storage':multer[_0x6093('0x11')]({'destination':function(_0x5c1841,_0x4b3d95,_0x3f384b){_0x3f384b(null,path[_0x6093('0x12')](config[_0x6093('0x13')],_0x6093('0x14')));},'filename':function(_0x259a49,_0x3fb34b,_0x38ac49){_0x38ac49(null,util[_0x6093('0x15')](_0x6093('0x16'),Date[_0x6093('0x17')](),_0x3fb34b[_0x6093('0x18')][_0x6093('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6093('0xe')]('/',upload[_0x6093('0x1a')](_0x6093('0x1b')),controller[_0x6093('0x1c')]);router[_0x6093('0x1d')](_0x6093('0xb'),auth[_0x6093('0x9')](),controller[_0x6093('0x1e')]);router[_0x6093('0x1f')](_0x6093('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6093('0x20')]=router; \ No newline at end of file +var _0xe35d=['put','/:id','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post','/:id/clone','diskStorage','root','originalname','replace','file','create'];(function(_0x5d4dd7,_0x38229c){var _0x2ce0ad=function(_0x54a7fb){while(--_0x54a7fb){_0x5d4dd7['push'](_0x5d4dd7['shift']());}};_0x2ce0ad(++_0x38229c);}(_0xe35d,0xd5));var _0xde35=function(_0x3e6552,_0x32dc0a){_0x3e6552=_0x3e6552-0x0;var _0x233c67=_0xe35d[_0x3e6552];return _0x233c67;};'use strict';var multer=require(_0xde35('0x0'));var util=require(_0xde35('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde35('0x2'));var router=express[_0xde35('0x3')]();var auth=require(_0xde35('0x4'));var interaction=require(_0xde35('0x5'));var config=require(_0xde35('0x6'));var controller=require(_0xde35('0x7'));router[_0xde35('0x8')]('/',auth[_0xde35('0x9')](),controller[_0xde35('0xa')]);router[_0xde35('0x8')]('/:id',auth[_0xde35('0x9')](),controller[_0xde35('0xb')]);router[_0xde35('0x8')](_0xde35('0xc'),auth[_0xde35('0x9')](),controller['download']);router[_0xde35('0xd')](_0xde35('0xe'),auth[_0xde35('0x9')](),controller['clone']);var upload=multer({'storage':multer[_0xde35('0xf')]({'destination':function(_0x2cbb1d,_0x5dfc41,_0x10e21e){_0x10e21e(null,path['join'](config[_0xde35('0x10')],'server/files/attachments/'));},'filename':function(_0x228a1c,_0x50b021,_0x51370b){_0x51370b(null,util['format']('%s-%s',Date['now'](),_0x50b021[_0xde35('0x11')][_0xde35('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload['single'](_0xde35('0x13')),controller[_0xde35('0x14')]);router[_0xde35('0x15')](_0xde35('0x16'),auth[_0xde35('0x9')](),controller['update']);router[_0xde35('0x17')](_0xde35('0x16'),auth[_0xde35('0x9')](),controller[_0xde35('0x18')]);module[_0xde35('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 89fb995..8198c72 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 _0x1fab=['use','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','find','map','emails','value','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','authenticate','google','profile','email','callback','/login'];(function(_0x3460bb,_0x30438b){var _0x5e4291=function(_0x21f19c){while(--_0x21f19c){_0x3460bb['push'](_0x3460bb['shift']());}};_0x5e4291(++_0x30438b);}(_0x1fab,0x109));var _0xb1fa=function(_0x32ebbb,_0x9c4c30){_0x32ebbb=_0x32ebbb-0x0;var _0x4c065c=_0x1fab[_0x32ebbb];return _0x4c065c;};'use strict';var _=require('lodash');var passport=require(_0xb1fa('0x0'));var GoogleStrategy=require(_0xb1fa('0x1'))[_0xb1fa('0x2')];var moment=require(_0xb1fa('0x3'));var db=require(_0xb1fa('0x4'))['db'];var config=require(_0xb1fa('0x5'));var signToken=require(_0xb1fa('0x6'))[_0xb1fa('0x7')];var utils=require(_0xb1fa('0x8'));exports['login']=passport[_0xb1fa('0x9')](_0xb1fa('0xa'),{'failureRedirect':'/login','scope':[_0xb1fa('0xb'),_0xb1fa('0xc')],'session':![]});exports[_0xb1fa('0xd')]=passport[_0xb1fa('0x9')]('google',{'failureRedirect':_0xb1fa('0xe'),'session':![]});passport[_0xb1fa('0xf')](new GoogleStrategy({'clientID':config[_0xb1fa('0xa')]?config[_0xb1fa('0xa')][_0xb1fa('0x10')]:'id','clientSecret':config['google']?config[_0xb1fa('0xa')][_0xb1fa('0x11')]:'secret','callbackURL':config['google']?config[_0xb1fa('0xa')][_0xb1fa('0x12')]:''},function(_0x4a383c,_0x25b235,_0x84a928,_0x3d921a){var _0xf9181,_0x85cb42;return db[_0xb1fa('0x13')][_0xb1fa('0x14')]({'where':{'id':0x1},'attributes':[_0xb1fa('0x15'),_0xb1fa('0x16')],'raw':!![]})[_0xb1fa('0x17')](function(_0x2e2056){_0xf9181=_0x2e2056;return db['User'][_0xb1fa('0x18')]({'where':{'email':_[_0xb1fa('0x19')](_0x84a928[_0xb1fa('0x1a')],_0xb1fa('0x1b')),'role':{'$or':[_0xb1fa('0x1c'),_0xb1fa('0x1d'),'agent']}}});})[_0xb1fa('0x17')](function(_0x3c23b2){_0x85cb42=_0x3c23b2;if(_0x85cb42){if(_0x85cb42['disabled']){return _0x3d921a(_0xb1fa('0x1e'));}else if(_0xf9181['blockDuration']>0x0){if(_0x85cb42['blocked']){if(moment(_0x85cb42[_0xb1fa('0x1f')])['add'](_0xf9181[_0xb1fa('0x16')],'minutes')>moment()){return _0x3d921a(_0xb1fa('0x1e'));}else{return utils[_0xb1fa('0x20')](_0x85cb42,0x0,![],null)[_0xb1fa('0x17')](function(){return utils[_0xb1fa('0x21')](_0x85cb42);})[_0xb1fa('0x17')](function(){return _0x3d921a(null,_0x85cb42);});}}else{return utils['getLicense'](_0x85cb42)[_0xb1fa('0x17')](function(){return _0x3d921a(null,_0x85cb42);});}}else{return utils['getLicense'](_0x85cb42)['then'](function(){return _0x3d921a(null,_0x85cb42);});}}return _0x3d921a(_0xb1fa('0x1e'));})[_0xb1fa('0x22')](function(_0x139905){_0x3d921a(_0x139905);});})); \ No newline at end of file +var _0x8183=['disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','authenticate','google','/login','callback','use','clientID','clientSecret','callbackURL','Setting','allowedLoginAttempts','blockDuration','User','find','value','admin','user','agent','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8183,0x71));var _0x3818=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x8183[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x3818('0x0'));var passport=require(_0x3818('0x1'));var GoogleStrategy=require(_0x3818('0x2'))[_0x3818('0x3')];var moment=require(_0x3818('0x4'));var db=require(_0x3818('0x5'))['db'];var config=require(_0x3818('0x6'));var signToken=require(_0x3818('0x7'))[_0x3818('0x8')];var utils=require('../../config/utils');exports['login']=passport[_0x3818('0x9')](_0x3818('0xa'),{'failureRedirect':_0x3818('0xb'),'scope':['profile','email'],'session':![]});exports[_0x3818('0xc')]=passport[_0x3818('0x9')](_0x3818('0xa'),{'failureRedirect':_0x3818('0xb'),'session':![]});passport[_0x3818('0xd')](new GoogleStrategy({'clientID':config['google']?config[_0x3818('0xa')][_0x3818('0xe')]:'id','clientSecret':config[_0x3818('0xa')]?config[_0x3818('0xa')][_0x3818('0xf')]:'secret','callbackURL':config[_0x3818('0xa')]?config[_0x3818('0xa')][_0x3818('0x10')]:''},function(_0xb41d42,_0x1d5a5a,_0x266151,_0x9506ae){var _0xed59bc,_0x4c9175;return db[_0x3818('0x11')]['findOne']({'where':{'id':0x1},'attributes':[_0x3818('0x12'),_0x3818('0x13')],'raw':!![]})['then'](function(_0x54264b){_0xed59bc=_0x54264b;return db[_0x3818('0x14')][_0x3818('0x15')]({'where':{'email':_['map'](_0x266151['emails'],_0x3818('0x16')),'role':{'$or':[_0x3818('0x17'),_0x3818('0x18'),_0x3818('0x19')]}}});})[_0x3818('0x1a')](function(_0x552bb0){_0x4c9175=_0x552bb0;if(_0x4c9175){if(_0x4c9175[_0x3818('0x1b')]){return _0x9506ae(_0x3818('0x1c'));}else if(_0xed59bc[_0x3818('0x13')]>0x0){if(_0x4c9175[_0x3818('0x1d')]){if(moment(_0x4c9175[_0x3818('0x1e')])[_0x3818('0x1f')](_0xed59bc[_0x3818('0x13')],_0x3818('0x20'))>moment()){return _0x9506ae(_0x3818('0x1c'));}else{return utils['clearBlockUser'](_0x4c9175,0x0,![],null)['then'](function(){return utils[_0x3818('0x21')](_0x4c9175);})[_0x3818('0x1a')](function(){return _0x9506ae(null,_0x4c9175);});}}else{return utils['getLicense'](_0x4c9175)[_0x3818('0x1a')](function(){return _0x9506ae(null,_0x4c9175);});}}else{return utils['getLicense'](_0x4c9175)[_0x3818('0x1a')](function(){return _0x9506ae(null,_0x4c9175);});}}return _0x9506ae(_0x3818('0x1c'));})[_0x3818('0x22')](function(_0xbf4498){_0x9506ae(_0xbf4498);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 951fb21..191255e 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 _0x7834=['./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0x5b9fd4,_0x5a61dd){var _0xd7cf72=function(_0x38de4a){while(--_0x38de4a){_0x5b9fd4['push'](_0x5b9fd4['shift']());}};_0xd7cf72(++_0x5a61dd);}(_0x7834,0x13f));var _0x4783=function(_0x110cbb,_0x186ee7){_0x110cbb=_0x110cbb-0x0;var _0x145f91=_0x7834[_0x110cbb];return _0x145f91;};'use strict';var express=require(_0x4783('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x4783('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x4783('0x2'));router[_0x4783('0x3')]('/',controller[_0x4783('0x4')]);router[_0x4783('0x3')](_0x4783('0x5'),controller[_0x4783('0x6')],authService[_0x4783('0x7')],userController['login'],authService[_0x4783('0x8')]);module[_0x4783('0x9')]=router; \ No newline at end of file +var _0xe062=['../user/user.controller.js','../../components/auth/service','get','/callback','login','setTokenCookie','express','passport','./authGoogle.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe062,0xd5));var _0x2e06=function(_0x50bb69,_0xf16ee4){_0x50bb69=_0x50bb69-0x0;var _0x1ad0c1=_0xe062[_0x50bb69];return _0x1ad0c1;};'use strict';var express=require(_0x2e06('0x0'));var passport=require(_0x2e06('0x1'));var router=express['Router']();var controller=require(_0x2e06('0x2'));var userController=require(_0x2e06('0x3'));var authService=require(_0x2e06('0x4'));router['get']('/',controller['login']);router[_0x2e06('0x5')](_0x2e06('0x6'),controller['callback'],authService['isMiddleware'],userController[_0x2e06('0x7')],authService[_0x2e06('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index ae8188d..40544c9 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 _0x484b=['send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','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.','securePassword','resetPasswordToken','resetPasswordExpires','passport-local','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','password','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status'];(function(_0x50269f,_0x1b4269){var _0x2e0af4=function(_0xeadea7){while(--_0xeadea7){_0x50269f['push'](_0x50269f['shift']());}};_0x2e0af4(++_0x1b4269);}(_0x484b,0x104));var _0xb484=function(_0x33f89c,_0x5b1dd5){_0x33f89c=_0x33f89c-0x0;var _0x4a51f1=_0x484b[_0x33f89c];return _0x4a51f1;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0xb484('0x0'))[_0xb484('0x1')];var jayson=require(_0xb484('0x2'));var _=require('lodash');var rs=require(_0xb484('0x3'));var moment=require(_0xb484('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xb484('0x5'));var utils=require(_0xb484('0x6'));var client=jayson[_0xb484('0x7')][_0xb484('0x8')]({'port':0x232b});function localAuthenticate(_0x50a2a6,_0x3a5067,_0x53eb64,_0x2780f5){var _0x2a1282,_0x13762a;return db[_0xb484('0x9')][_0xb484('0xa')]({'where':{'id':0x1},'attributes':[_0xb484('0xb'),_0xb484('0xc')],'raw':!![]})[_0xb484('0xd')](function(_0x4048e4){_0x2a1282=_0x4048e4;return _0x50a2a6[_0xb484('0xa')]({'attributes':['id','name',_0xb484('0xe'),'salt',_0xb484('0xf'),_0xb484('0x10'),_0xb484('0x11'),_0xb484('0x12'),_0xb484('0x13')],'where':{'name':_0x3a5067,'role':{'$or':[_0xb484('0x14'),'user',_0xb484('0x15')]}}});})[_0xb484('0xd')](function(_0x124fb1){if(!_0x124fb1||_0x124fb1&&_0x124fb1[_0xb484('0x16')]!==_0x3a5067){throw new Error(_0xb484('0x17'));}else{_0x13762a=_0x124fb1;return _0x13762a;}})[_0xb484('0xd')](function(){_0x13762a[_0xb484('0x18')](_0x53eb64,function(_0x37bea8,_0x138e69){var _0x47aac5=_0x13762a[_0xb484('0x13')]+0x1;if(_0x37bea8){return _0x2780f5(_0x37bea8);}else if(!_0x138e69){if(_0x13762a['disabled']){return _0x2780f5(null,![],{'message':_0xb484('0x17')});}else if(_0x2a1282['allowedLoginAttempts']>0x0){if(_0x13762a[_0xb484('0x11')]){if(_0x2a1282['blockDuration']>0x0){if(moment(_0x13762a['blockedAt'])[_0xb484('0x19')](_0x2a1282[_0xb484('0xc')],_0xb484('0x1a'))>moment()){return _0x2780f5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb484('0x1b')](_0x13762a,_0x47aac5,![],null)[_0xb484('0xd')](function(){return _0x2780f5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2780f5(null,![],{'message':_0xb484('0x17')});}}else{if(_0x47aac5>=_0x2a1282[_0xb484('0xb')]){return utils[_0xb484('0x1b')](_0x13762a,0x0,!![],moment())[_0xb484('0xd')](function(){return _0x2780f5(null,![],{'message':_0xb484('0x17')});});}else{return utils['clearBlockUser'](_0x13762a,_0x47aac5,![],null)[_0xb484('0xd')](function(){return _0x2780f5(null,![],{'message':_0xb484('0x17')});});}}}else{return _0x2780f5(null,![],{'message':_0xb484('0x17')});}}else{if(_0x13762a[_0xb484('0x10')]){return _0x2780f5(null,![],{'message':_0xb484('0x17')});}else if(_0x2a1282[_0xb484('0xb')]>0x0){if(_0x13762a[_0xb484('0x11')]){if(_0x2a1282[_0xb484('0xc')]>0x0){if(moment(_0x13762a[_0xb484('0x12')])[_0xb484('0x19')](_0x2a1282['blockDuration'],_0xb484('0x1a'))>moment()){return _0x2780f5(null,![],{'message':_0xb484('0x17')});}else{return utils[_0xb484('0x1b')](_0x13762a,0x0,![],null)[_0xb484('0xd')](function(){return utils[_0xb484('0x1c')](_0x13762a);})['then'](function(){return _0x2780f5(null,_0x13762a);});}}else{return _0x2780f5(null,![],{'message':_0xb484('0x17')});}}else{return utils[_0xb484('0x1b')](_0x13762a,0x0,![],null)[_0xb484('0xd')](function(){return utils[_0xb484('0x1c')](_0x13762a);})[_0xb484('0xd')](function(){return _0x2780f5(null,_0x13762a);})['catch'](function(_0x46cdea){return _0x2780f5(null,![],_0x46cdea);});}}else{if(_0x13762a[_0xb484('0x11')]){return _0x2780f5(null,![],{'message':_0xb484('0x17')});}else{return utils[_0xb484('0x1c')](_0x13762a)[_0xb484('0xd')](function(){return _0x2780f5(null,_0x13762a);});}}}});})[_0xb484('0x1d')](function(_0x18b59c){return _0x2780f5(null,![],_0x18b59c);});}function sendServiceMail(_0x1c2cb8){return db[_0xb484('0x1e')][_0xb484('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xb484('0x16'),_0xb484('0x20')],'include':[{'model':db['MailServerOut'],'as':_0xb484('0x21')}]})['then'](function(_0x3f1bbf){if(!_0x3f1bbf){throw new Error(_0xb484('0x22'));}var _0x2abfbf={'tls':{'rejectUnauthorized':![]}};if(_0x3f1bbf[_0xb484('0x21')]['service']){_0x2abfbf[_0xb484('0x23')]=_0x3f1bbf[_0xb484('0x21')][_0xb484('0x23')];}else{_0x2abfbf[_0xb484('0x24')]=_0x3f1bbf['Smtp'][_0xb484('0x24')];_0x2abfbf[_0xb484('0x25')]=_0x3f1bbf[_0xb484('0x21')][_0xb484('0x25')];_0x2abfbf[_0xb484('0x26')]=_0x3f1bbf[_0xb484('0x21')][_0xb484('0x26')];}if(_0x3f1bbf['Smtp'][_0xb484('0x27')]){_0x2abfbf[_0xb484('0x28')]={'user':_0x3f1bbf[_0xb484('0x21')][_0xb484('0x29')],'pass':_0x3f1bbf[_0xb484('0x21')]['pass']};}var _0x4f3321={'account':_0x2abfbf,'message':_['merge']({'from':util[_0xb484('0x2a')]('\x22%s\x22\x20<%s>',_0x3f1bbf[_0xb484('0x16')],_0x3f1bbf['email']||_0x3f1bbf[_0xb484('0x21')][_0xb484('0x29')])},_0x1c2cb8)};return client[_0xb484('0x2b')](_0xb484('0x2c'),_0x4f3321);})[_0xb484('0xd')](function(_0x4f75bc){if(_0x4f75bc[_0xb484('0x2d')]){throw new Error(util['format'](_0xb484('0x2e'),_0x4f75bc[_0xb484('0x2d')]['message']||JSON['stringify'](_0x4f75bc[_0xb484('0x2d')])));}return!![];});}function handleError(_0x395a98,_0x1470e8,_0x24d67d){return _0x395a98[_0xb484('0x2f')](_0x1470e8||0x1f4)[_0xb484('0x30')]({'message':_0x24d67d?_0x24d67d[_0xb484('0x31')]||_0x24d67d:''});}function checkPasswordPattern(_0x8a8841,_0x132146,_0x57f30b){if(_0x57f30b){var _0x1f6709=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f6709['test'](_0x132146)){return _0x8a8841;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x8a8841;}}exports[_0xb484('0x32')]=function(_0xeed473,_0x5a0027,_0x2fc1dc){passport[_0xb484('0x18')]('local',function(_0xd1c694,_0x5a6952,_0x21b132){var _0x2ee9aa=_0xd1c694||_0x21b132;if(_0x2ee9aa){return handleError(_0x5a0027,0x191,_0x2ee9aa);}if(!_0x5a6952){return handleError(_0x5a0027,0x194,{'message':_0xb484('0x33')});}else{var _0x31183f={'payload':{'id':_0x5a6952['id'],'role':_0x5a6952[_0xb484('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x31183f)[_0xb484('0xd')](function(_0x588b70){_0x5a0027[_0xb484('0x34')]({'id':_0x5a6952['id'],'token':_0x588b70,'statusCall':'','isAlreadyLogged':_0x5a6952[_0xb484('0x35')]});});}})(_0xeed473,_0x5a0027,_0x2fc1dc);};exports[_0xb484('0x36')]=function(_0x3dd26e,_0x4ba25a,_0x34d9cb){if(!_0x3dd26e[_0xb484('0x37')][_0xb484('0x20')]){return handleError(_0x4ba25a,0x1f4,{'message':_0xb484('0x38')});}var _0x3055da=rs[_0xb484('0x39')]();_0x3dd26e['body'][_0xb484('0x20')]=_0x3dd26e[_0xb484('0x37')][_0xb484('0x20')]['trim']()[_0xb484('0x3a')]();var _0x309680;return db[_0xb484('0x9')][_0xb484('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xb484('0xc')],'raw':!![]})[_0xb484('0xd')](function(_0x1c7392){_0x309680=_0x1c7392;return db[_0xb484('0x3b')][_0xb484('0x1f')]({'where':{'email':_0x3dd26e[_0xb484('0x37')][_0xb484('0x20')]}});})[_0xb484('0xd')](function(_0x3addc0){if(!_0x3addc0){throw new Error(_0xb484('0x3c'));}if(_0x3addc0[_0xb484('0x10')]){throw new Error(_0xb484('0x3d'));}if(_0x3addc0[_0xb484('0x11')]){if(moment(_0x3addc0['blockedAt'])[_0xb484('0x19')](_0x309680[_0xb484('0xc')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3addc0[_0xb484('0x11')]=![];_0x3addc0[_0xb484('0x12')]=null;}}_0x3addc0['resetPasswordToken']=_0x3055da;_0x3addc0['resetPasswordExpires']=Date[_0xb484('0x3e')]()+0x36ee80;return _0x3addc0[_0xb484('0x3f')]();})[_0xb484('0xd')](function(){return sendServiceMail({'to':_0x3dd26e[_0xb484('0x37')][_0xb484('0x20')],'subject':_0xb484('0x40'),'text':_0xb484('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xb484('0x42')+_0x3dd26e[_0xb484('0x43')][_0xb484('0x24')]+_0xb484('0x44')+_0x3055da+'\x0a\x0a'+_0xb484('0x45')});})[_0xb484('0xd')](function(){_0x4ba25a[_0xb484('0x2f')](0xc8)[_0xb484('0x30')]({'message':'Reset\x20Email\x20sent!'});})[_0xb484('0x1d')](function(_0x293f9a){return handleError(_0x4ba25a,0x1f4,_0x293f9a);});};exports[_0xb484('0x46')]=function(_0x480cce,_0x388912,_0x49eabd){var _0x57dc38;return db[_0xb484('0x3b')][_0xb484('0x1f')]({'where':{'resetPasswordToken':_0x480cce[_0xb484('0x47')][_0xb484('0x48')],'resetPasswordExpires':{'$gt':Date[_0xb484('0x3e')]()}}})[_0xb484('0xd')](function(_0x517882){_0x57dc38=_0x517882;if(!_0x57dc38){throw new Error(_0xb484('0x49'));}return db[_0xb484('0x9')][_0xb484('0xa')]({'attributes':['id',_0xb484('0x4a')]});})[_0xb484('0xd')](function(_0x332332){return checkPasswordPattern(_0x332332,_0x480cce[_0xb484('0x37')][_0xb484('0xe')],_0x332332[_0xb484('0x4a')]);})['then'](function(){_0x57dc38[_0xb484('0xe')]=_0x480cce['body']['password'];_0x57dc38[_0xb484('0x4b')]=null;_0x57dc38[_0xb484('0x4c')]=null;return _0x57dc38['save']();})[_0xb484('0xd')](function(){_0x388912[_0xb484('0x2f')](0xc8)[_0xb484('0x30')]({'message':'Password\x20reset!'});})[_0xb484('0x1d')](function(_0x5b1bc4){return handleError(_0x388912,0x1f4,_0x5b1bc4);});};passport['use'](new LocalStrategy({'usernameField':'name','passwordField':_0xb484('0xe')},function(_0x73d0b8,_0x37a0f9,_0x37716a){return localAuthenticate(db[_0xb484('0x3b')],_0x73d0b8,_0x37a0f9,_0x37716a);})); \ No newline at end of file +var _0xb550=['headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','use','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','Setting','allowedLoginAttempts','blockDuration','findOne','name','password','salt','disabled','loginAttempts','admin','then','blocked','blockedAt','minutes','clearBlockUser','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','catch','getLicense','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','user','merge','\x22%s\x22\x20<%s>','request','error','message','stringify','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','role','signToken','json','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','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','http://'];(function(_0x3e2936,_0x1d57a9){var _0x35d87a=function(_0x19dd6a){while(--_0x19dd6a){_0x3e2936['push'](_0x3e2936['shift']());}};_0x35d87a(++_0x1d57a9);}(_0xb550,0x13a));var _0x0b55=function(_0x23a4bf,_0x18d308){_0x23a4bf=_0x23a4bf-0x0;var _0x538408=_0xb550[_0x23a4bf];return _0x538408;};'use strict';var util=require(_0x0b55('0x0'));var passport=require(_0x0b55('0x1'));var LocalStrategy=require(_0x0b55('0x2'))[_0x0b55('0x3')];var jayson=require(_0x0b55('0x4'));var _=require(_0x0b55('0x5'));var rs=require('randomstring');var moment=require(_0x0b55('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x4a366c,_0x23fcd9,_0x135fe7,_0x4a7de1){var _0x525aae,_0x5ade9a;return db[_0x0b55('0x7')]['findOne']({'where':{'id':0x1},'attributes':[_0x0b55('0x8'),_0x0b55('0x9')],'raw':!![]})['then'](function(_0x519942){_0x525aae=_0x519942;return _0x4a366c[_0x0b55('0xa')]({'attributes':['id',_0x0b55('0xb'),_0x0b55('0xc'),_0x0b55('0xd'),'role',_0x0b55('0xe'),'blocked','blockedAt',_0x0b55('0xf')],'where':{'name':_0x23fcd9,'role':{'$or':[_0x0b55('0x10'),'user','agent']}}});})[_0x0b55('0x11')](function(_0x228477){if(!_0x228477||_0x228477&&_0x228477[_0x0b55('0xb')]!==_0x23fcd9){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5ade9a=_0x228477;return _0x5ade9a;}})[_0x0b55('0x11')](function(){_0x5ade9a['authenticate'](_0x135fe7,function(_0x37b268,_0x59a732){var _0x5c5fcd=_0x5ade9a[_0x0b55('0xf')]+0x1;if(_0x37b268){return _0x4a7de1(_0x37b268);}else if(!_0x59a732){if(_0x5ade9a[_0x0b55('0xe')]){return _0x4a7de1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x525aae[_0x0b55('0x8')]>0x0){if(_0x5ade9a[_0x0b55('0x12')]){if(_0x525aae[_0x0b55('0x9')]>0x0){if(moment(_0x5ade9a[_0x0b55('0x13')])['add'](_0x525aae[_0x0b55('0x9')],_0x0b55('0x14'))>moment()){return _0x4a7de1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0b55('0x15')](_0x5ade9a,_0x5c5fcd,![],null)[_0x0b55('0x11')](function(){return _0x4a7de1(null,![],{'message':_0x0b55('0x16')});});}}else{return _0x4a7de1(null,![],{'message':_0x0b55('0x16')});}}else{if(_0x5c5fcd>=_0x525aae[_0x0b55('0x8')]){return utils[_0x0b55('0x15')](_0x5ade9a,0x0,!![],moment())[_0x0b55('0x11')](function(){return _0x4a7de1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x0b55('0x15')](_0x5ade9a,_0x5c5fcd,![],null)[_0x0b55('0x11')](function(){return _0x4a7de1(null,![],{'message':_0x0b55('0x16')});});}}}else{return _0x4a7de1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5ade9a[_0x0b55('0xe')]){return _0x4a7de1(null,![],{'message':_0x0b55('0x16')});}else if(_0x525aae['allowedLoginAttempts']>0x0){if(_0x5ade9a[_0x0b55('0x12')]){if(_0x525aae[_0x0b55('0x9')]>0x0){if(moment(_0x5ade9a['blockedAt'])['add'](_0x525aae[_0x0b55('0x9')],_0x0b55('0x14'))>moment()){return _0x4a7de1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0b55('0x15')](_0x5ade9a,0x0,![],null)[_0x0b55('0x11')](function(){return utils['getLicense'](_0x5ade9a);})[_0x0b55('0x11')](function(){return _0x4a7de1(null,_0x5ade9a);});}}else{return _0x4a7de1(null,![],{'message':_0x0b55('0x16')});}}else{return utils[_0x0b55('0x15')](_0x5ade9a,0x0,![],null)['then'](function(){return utils['getLicense'](_0x5ade9a);})[_0x0b55('0x11')](function(){return _0x4a7de1(null,_0x5ade9a);})[_0x0b55('0x17')](function(_0x2cac22){return _0x4a7de1(null,![],_0x2cac22);});}}else{if(_0x5ade9a[_0x0b55('0x12')]){return _0x4a7de1(null,![],{'message':_0x0b55('0x16')});}else{return utils[_0x0b55('0x18')](_0x5ade9a)[_0x0b55('0x11')](function(){return _0x4a7de1(null,_0x5ade9a);});}}}});})[_0x0b55('0x17')](function(_0x3175fe){return _0x4a7de1(null,![],_0x3175fe);});}function sendServiceMail(_0x44fa03){return db[_0x0b55('0x19')][_0x0b55('0x1a')]({'where':{'service':!![]},'attributes':['id',_0x0b55('0xb'),_0x0b55('0x1b')],'include':[{'model':db[_0x0b55('0x1c')],'as':_0x0b55('0x1d')}]})[_0x0b55('0x11')](function(_0xd9b679){if(!_0xd9b679){throw new Error(_0x0b55('0x1e'));}var _0x27498f={'tls':{'rejectUnauthorized':![]}};if(_0xd9b679[_0x0b55('0x1d')][_0x0b55('0x1f')]){_0x27498f[_0x0b55('0x1f')]=_0xd9b679[_0x0b55('0x1d')][_0x0b55('0x1f')];}else{_0x27498f[_0x0b55('0x20')]=_0xd9b679['Smtp'][_0x0b55('0x20')];_0x27498f[_0x0b55('0x21')]=_0xd9b679[_0x0b55('0x1d')][_0x0b55('0x21')];_0x27498f[_0x0b55('0x22')]=_0xd9b679[_0x0b55('0x1d')][_0x0b55('0x22')];}if(_0xd9b679['Smtp']['authentication']){_0x27498f[_0x0b55('0x23')]={'user':_0xd9b679[_0x0b55('0x1d')][_0x0b55('0x24')],'pass':_0xd9b679['Smtp']['pass']};}var _0x1f1666={'account':_0x27498f,'message':_[_0x0b55('0x25')]({'from':util['format'](_0x0b55('0x26'),_0xd9b679[_0x0b55('0xb')],_0xd9b679['email']||_0xd9b679[_0x0b55('0x1d')][_0x0b55('0x24')])},_0x44fa03)};return client[_0x0b55('0x27')]('SendMail',_0x1f1666);})[_0x0b55('0x11')](function(_0x43120c){if(_0x43120c[_0x0b55('0x28')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x43120c[_0x0b55('0x28')][_0x0b55('0x29')]||JSON[_0x0b55('0x2a')](_0x43120c[_0x0b55('0x28')])));}return!![];});}function handleError(_0x34dfa2,_0x562bc6,_0x31d116){return _0x34dfa2['status'](_0x562bc6||0x1f4)[_0x0b55('0x2b')]({'message':_0x31d116?_0x31d116[_0x0b55('0x29')]||_0x31d116:''});}function checkPasswordPattern(_0x2f71fd,_0x36eb77,_0x175567){if(_0x175567){var _0x5d4e50=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d4e50[_0x0b55('0x2c')](_0x36eb77)){return _0x2f71fd;}else{throw new Error(_0x0b55('0x2d'));}}else{return _0x2f71fd;}}exports[_0x0b55('0x2e')]=function(_0xe84149,_0x5a1518,_0x40f523){passport['authenticate'](_0x0b55('0x2f'),function(_0x299754,_0x5e903e,_0x3cdf46){var _0x51705b=_0x299754||_0x3cdf46;if(_0x51705b){return handleError(_0x5a1518,0x191,_0x51705b);}if(!_0x5e903e){return handleError(_0x5a1518,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3c30e9={'payload':{'id':_0x5e903e['id'],'role':_0x5e903e[_0x0b55('0x30')]},'options':{'expiresIn':0x15180}};return authService[_0x0b55('0x31')](_0x3c30e9)[_0x0b55('0x11')](function(_0xd15e7b){_0x5a1518[_0x0b55('0x32')]({'id':_0x5e903e['id'],'token':_0xd15e7b,'statusCall':'','isAlreadyLogged':_0x5e903e['online']});});}})(_0xe84149,_0x5a1518,_0x40f523);};exports['forgot']=function(_0x34970d,_0x19dc5b,_0x555d89){if(!_0x34970d[_0x0b55('0x33')]['email']){return handleError(_0x19dc5b,0x1f4,{'message':_0x0b55('0x34')});}var _0x1d3240=rs['generate']();_0x34970d[_0x0b55('0x33')]['email']=_0x34970d[_0x0b55('0x33')]['email'][_0x0b55('0x35')]()[_0x0b55('0x36')]();var _0x5f189f;return db[_0x0b55('0x7')][_0x0b55('0xa')]({'where':{'id':0x1},'attributes':[_0x0b55('0x8'),'blockDuration'],'raw':!![]})[_0x0b55('0x11')](function(_0x319f00){_0x5f189f=_0x319f00;return db[_0x0b55('0x37')]['find']({'where':{'email':_0x34970d[_0x0b55('0x33')]['email']}});})['then'](function(_0x189c53){if(!_0x189c53){throw new Error(_0x0b55('0x38'));}if(_0x189c53[_0x0b55('0xe')]){throw new Error(_0x0b55('0x39'));}if(_0x189c53[_0x0b55('0x12')]){if(moment(_0x189c53[_0x0b55('0x13')])[_0x0b55('0x3a')](_0x5f189f['blockDuration'],_0x0b55('0x14'))>moment()){throw new Error(_0x0b55('0x3b'));}else{_0x189c53[_0x0b55('0x12')]=![];_0x189c53[_0x0b55('0x13')]=null;}}_0x189c53[_0x0b55('0x3c')]=_0x1d3240;_0x189c53[_0x0b55('0x3d')]=Date['now']()+0x36ee80;return _0x189c53[_0x0b55('0x3e')]();})[_0x0b55('0x11')](function(){return sendServiceMail({'to':_0x34970d['body'][_0x0b55('0x1b')],'subject':_0x0b55('0x3f'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x0b55('0x40')+_0x0b55('0x41')+_0x34970d[_0x0b55('0x42')]['host']+'/reset/'+_0x1d3240+'\x0a\x0a'+_0x0b55('0x43')});})[_0x0b55('0x11')](function(){_0x19dc5b[_0x0b55('0x44')](0xc8)['send']({'message':_0x0b55('0x45')});})[_0x0b55('0x17')](function(_0x40a858){return handleError(_0x19dc5b,0x1f4,_0x40a858);});};exports[_0x0b55('0x46')]=function(_0x5b24ed,_0x181c0c,_0x267dd1){var _0x6f9f36;return db[_0x0b55('0x37')][_0x0b55('0x1a')]({'where':{'resetPasswordToken':_0x5b24ed[_0x0b55('0x47')]['token'],'resetPasswordExpires':{'$gt':Date[_0x0b55('0x48')]()}}})['then'](function(_0x38c087){_0x6f9f36=_0x38c087;if(!_0x6f9f36){throw new Error(_0x0b55('0x49'));}return db[_0x0b55('0x7')][_0x0b55('0xa')]({'attributes':['id',_0x0b55('0x4a')]});})['then'](function(_0x4b6efe){return checkPasswordPattern(_0x4b6efe,_0x5b24ed[_0x0b55('0x33')][_0x0b55('0xc')],_0x4b6efe[_0x0b55('0x4a')]);})[_0x0b55('0x11')](function(){_0x6f9f36[_0x0b55('0xc')]=_0x5b24ed['body'][_0x0b55('0xc')];_0x6f9f36[_0x0b55('0x3c')]=null;_0x6f9f36[_0x0b55('0x3d')]=null;return _0x6f9f36[_0x0b55('0x3e')]();})[_0x0b55('0x11')](function(){_0x181c0c[_0x0b55('0x44')](0xc8)[_0x0b55('0x2b')]({'message':'Password\x20reset!'});})['catch'](function(_0x16146a){return handleError(_0x181c0c,0x1f4,_0x16146a);});};passport[_0x0b55('0x4b')](new LocalStrategy({'usernameField':'name','passwordField':_0x0b55('0xc')},function(_0x49b3da,_0x1466f4,_0x23787d){return localAuthenticate(db[_0x0b55('0x37')],_0x49b3da,_0x1466f4,_0x23787d);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b78af15..3c30441 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 _0xadf4=['post','login','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller'];(function(_0x4cf9b2,_0x574845){var _0x1fa2de=function(_0x5ad07d){while(--_0x5ad07d){_0x4cf9b2['push'](_0x4cf9b2['shift']());}};_0x1fa2de(++_0x574845);}(_0xadf4,0x16e));var _0x4adf=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0xadf4[_0x1406ae];return _0x23a076;};'use strict';var express=require(_0x4adf('0x0'));var router=express[_0x4adf('0x1')]();var controller=require(_0x4adf('0x2'));router[_0x4adf('0x3')]('/',controller[_0x4adf('0x4')]);router[_0x4adf('0x3')]('/forgot',controller[_0x4adf('0x5')]);router[_0x4adf('0x3')](_0x4adf('0x6'),controller[_0x4adf('0x7')]);module[_0x4adf('0x8')]=router; \ No newline at end of file +var _0x0762=['./authLocal.controller','login','post','/forgot','/reset/:token','reset','exports'];(function(_0x1916ca,_0x504540){var _0x2a5b04=function(_0x1225a4){while(--_0x1225a4){_0x1916ca['push'](_0x1916ca['shift']());}};_0x2a5b04(++_0x504540);}(_0x0762,0x18f));var _0x2076=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x0762[_0xcda377];return _0x1c024f;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x2076('0x0'));router['post']('/',controller[_0x2076('0x1')]);router[_0x2076('0x2')](_0x2076('0x3'),controller['forgot']);router[_0x2076('0x2')](_0x2076('0x4'),controller[_0x2076('0x5')]);module[_0x2076('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index a44ceeb..cd2b9c0 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 _0x9f01=['STRING','exports'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0x9f01,0x1bb));var _0x19f0=function(_0x53a77a,_0x58f607){_0x53a77a=_0x53a77a-0x0;var _0x32b622=_0x9f01[_0x53a77a];return _0x32b622;};'use strict';var Sequelize=require('sequelize');module[_0x19f0('0x0')]={'name':{'type':Sequelize[_0x19f0('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x19f0('0x1')]},'description':{'type':Sequelize[_0x19f0('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x60a8=['STRING','BOOLEAN','exports'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x60a8,0x65));var _0x860a=function(_0x434cb9,_0x20210a){_0x434cb9=_0x434cb9-0x0;var _0x2055b1=_0x60a8[_0x434cb9];return _0x2055b1;};'use strict';var Sequelize=require('sequelize');module[_0x860a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x860a('0x1')]},'description':{'type':Sequelize[_0x860a('0x1')]},'status':{'type':Sequelize[_0x860a('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index cf602a8..538353b 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 _0xa03e=['Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include','find','catch','body','destroy','addConditions','ids','omit','getConditions','findOne','Condition','order','addActions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa03e,0x1d0));var _0xea03=function(_0x164456,_0x48d1ac){_0x164456=_0x164456-0x0;var _0xc033ac=_0xa03e[_0x164456];return _0xc033ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xea03('0x0'));var rimraf=require(_0xea03('0x1'));var zipdir=require(_0xea03('0x2'));var jsonpatch=require(_0xea03('0x3'));var rp=require(_0xea03('0x4'));var moment=require(_0xea03('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xea03('0x6'));var util=require(_0xea03('0x7'));var path=require(_0xea03('0x8'));var sox=require(_0xea03('0x9'));var csv=require('to-csv');var ejs=require(_0xea03('0xa'));var fs=require('fs');var _=require(_0xea03('0xb'));var squel=require('squel');var crypto=require(_0xea03('0xc'));var jsforce=require(_0xea03('0xd'));var deskjs=require(_0xea03('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea03('0xf'));var Papa=require(_0xea03('0x10'));var Redis=require(_0xea03('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xea03('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea03('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x435e90,_0x3c638c){_0x3c638c=_0x3c638c||0xcc;return function(_0x175abd){if(_0x175abd){return _0x435e90[_0xea03('0x14')](_0x3c638c);}return _0x435e90[_0xea03('0x15')](_0x3c638c)[_0xea03('0x16')]();};}function respondWithResult(_0x1346ea,_0x422913){_0x422913=_0x422913||0xc8;return function(_0x525416){if(_0x525416){return _0x1346ea[_0xea03('0x15')](_0x422913)[_0xea03('0x17')](_0x525416);}};}function respondWithFilteredResult(_0x495385,_0x464942){return function(_0x6d4584){if(_0x6d4584){var _0x2faa28=_0x6d4584['count'],_0x3d810d=_0x464942[_0xea03('0x18')],_0x2ac9a6=_0x464942['offset']+_0x464942[_0xea03('0x19')],_0x537801;if(_0x2ac9a6>=_0x2faa28){_0x2ac9a6=_0x2faa28;_0x537801=0xc8;}else{_0x537801=0xce;}_0x495385[_0xea03('0x15')](_0x537801);return _0x495385[_0xea03('0x1a')](_0xea03('0x1b'),_0x3d810d+'-'+_0x2ac9a6+'/'+_0x2faa28)[_0xea03('0x17')](_0x6d4584);}return null;};}function patchUpdates(_0x2a1ab8){return function(_0x48815){try{jsonpatch[_0xea03('0x1c')](_0x48815,_0x2a1ab8,!![]);}catch(_0x5e877e){return BPromise['reject'](_0x5e877e);}return _0x48815[_0xea03('0x1d')]();};}function saveUpdates(_0x4f21a5,_0x2e1b16){return function(_0x9ec5b1){if(_0x9ec5b1){return _0x9ec5b1[_0xea03('0x1e')](_0x4f21a5)[_0xea03('0x1f')](function(_0x9db1b8){return _0x9db1b8;});}return null;};}function removeEntity(_0x760fcb,_0x429891){return function(_0x20eb22){if(_0x20eb22){return _0x20eb22['destroy']()[_0xea03('0x1f')](function(){_0x760fcb[_0xea03('0x15')](0xcc)[_0xea03('0x16')]();});}};}function handleEntityNotFound(_0x3987b2,_0x192abd){return function(_0x159280){if(!_0x159280){_0x3987b2['sendStatus'](0x194);}return _0x159280;};}function handleError(_0x2dfa58,_0x43b1a1){_0x43b1a1=_0x43b1a1||0x1f4;return function(_0xd022b3){logger[_0xea03('0x20')](_0xd022b3[_0xea03('0x21')]);if(_0xd022b3['name']){delete _0xd022b3[_0xea03('0x22')];}_0x2dfa58['status'](_0x43b1a1)['send'](_0xd022b3);};}exports[_0xea03('0x23')]=function(_0x2e7aca,_0x3ebb8a){var _0x153300={},_0x2e1d03={},_0x4a21f9={'count':0x0,'rows':[]};var _0x1418e5=_[_0xea03('0x24')](db[_0xea03('0x25')][_0xea03('0x26')],function(_0xb236da){return{'name':_0xb236da[_0xea03('0x27')],'type':_0xb236da[_0xea03('0x28')][_0xea03('0x29')]};});_0x2e1d03[_0xea03('0x2a')]=_[_0xea03('0x24')](_0x1418e5,_0xea03('0x22'));_0x2e1d03[_0xea03('0x2b')]=_[_0xea03('0x2c')](_0x2e7aca[_0xea03('0x2b')]);_0x2e1d03[_0xea03('0x2d')]=_[_0xea03('0x2e')](_0x2e1d03[_0xea03('0x2a')],_0x2e1d03[_0xea03('0x2b')]);_0x153300[_0xea03('0x2f')]=_['intersection'](_0x2e1d03['model'],qs[_0xea03('0x30')](_0x2e7aca[_0xea03('0x2b')][_0xea03('0x30')]));_0x153300['attributes']=_0x153300[_0xea03('0x2f')][_0xea03('0x31')]?_0x153300[_0xea03('0x2f')]:_0x2e1d03[_0xea03('0x2a')];if(!_0x2e7aca[_0xea03('0x2b')][_0xea03('0x32')](_0xea03('0x33'))){_0x153300[_0xea03('0x19')]=qs[_0xea03('0x19')](_0x2e7aca[_0xea03('0x2b')][_0xea03('0x19')]);_0x153300[_0xea03('0x18')]=qs[_0xea03('0x18')](_0x2e7aca[_0xea03('0x2b')]['offset']);}_0x153300['order']=qs[_0xea03('0x34')](_0x2e7aca[_0xea03('0x2b')][_0xea03('0x34')]);_0x153300[_0xea03('0x35')]=qs[_0xea03('0x2d')](_['pick'](_0x2e7aca['query'],_0x2e1d03[_0xea03('0x2d')]),_0x1418e5);if(_0x2e7aca['query']['filter']){_0x153300[_0xea03('0x35')]=_[_0xea03('0x36')](_0x153300[_0xea03('0x35')],{'$or':_[_0xea03('0x24')](_0x1418e5,function(_0x11a7f9){if(_0x11a7f9[_0xea03('0x28')]!==_0xea03('0x37')){var _0x3bad44={};_0x3bad44[_0x11a7f9[_0xea03('0x22')]]={'$like':'%'+_0x2e7aca[_0xea03('0x2b')][_0xea03('0x38')]+'%'};return _0x3bad44;}})});}_0x153300=_['merge']({},_0x153300,_0x2e7aca[_0xea03('0x39')]);var _0x297393={'where':_0x153300[_0xea03('0x35')]};return db[_0xea03('0x25')]['count'](_0x297393)[_0xea03('0x1f')](function(_0x3dc474){_0x4a21f9['count']=_0x3dc474;if(_0x2e7aca[_0xea03('0x2b')][_0xea03('0x3a')]){_0x153300['include']=[{'all':!![]}];}return db[_0xea03('0x25')]['findAll'](_0x153300);})['then'](function(_0x4c66fe){_0x4a21f9[_0xea03('0x3b')]=_0x4c66fe;return _0x4a21f9;})['then'](respondWithFilteredResult(_0x3ebb8a,_0x153300))['catch'](handleError(_0x3ebb8a,null));};exports[_0xea03('0x3c')]=function(_0x404b1d,_0x3cbb99){var _0x4a7871={'raw':![],'where':{'id':_0x404b1d[_0xea03('0x3d')]['id']}},_0x4fb9a3={};_0x4fb9a3['model']=_['keys'](db[_0xea03('0x25')][_0xea03('0x26')]);_0x4fb9a3[_0xea03('0x2b')]=_[_0xea03('0x2c')](_0x404b1d[_0xea03('0x2b')]);_0x4fb9a3[_0xea03('0x2d')]=_[_0xea03('0x2e')](_0x4fb9a3[_0xea03('0x2a')],_0x4fb9a3['query']);_0x4a7871['attributes']=_[_0xea03('0x2e')](_0x4fb9a3[_0xea03('0x2a')],qs[_0xea03('0x30')](_0x404b1d[_0xea03('0x2b')][_0xea03('0x30')]));_0x4a7871['attributes']=_0x4a7871['attributes']['length']?_0x4a7871[_0xea03('0x2f')]:_0x4fb9a3['model'];if(_0x404b1d[_0xea03('0x2b')][_0xea03('0x3a')]){_0x4a7871[_0xea03('0x3e')]=[{'all':!![]}];}_0x4a7871=_['merge']({},_0x4a7871,_0x404b1d[_0xea03('0x39')]);return db['Automation'][_0xea03('0x3f')](_0x4a7871)[_0xea03('0x1f')](handleEntityNotFound(_0x3cbb99,null))[_0xea03('0x1f')](respondWithResult(_0x3cbb99,null))[_0xea03('0x40')](handleError(_0x3cbb99,null));};exports['create']=function(_0x1fb247,_0x156d80){return db[_0xea03('0x25')]['create'](_0x1fb247[_0xea03('0x41')],{})[_0xea03('0x1f')](respondWithResult(_0x156d80,0xc9))[_0xea03('0x40')](handleError(_0x156d80,null));};exports[_0xea03('0x1e')]=function(_0x235d72,_0x12b48b){if(_0x235d72[_0xea03('0x41')]['id']){delete _0x235d72[_0xea03('0x41')]['id'];}return db[_0xea03('0x25')][_0xea03('0x3f')]({'where':{'id':_0x235d72[_0xea03('0x3d')]['id']}})['then'](handleEntityNotFound(_0x12b48b,null))['then'](saveUpdates(_0x235d72[_0xea03('0x41')],null))[_0xea03('0x1f')](respondWithResult(_0x12b48b,null))[_0xea03('0x40')](handleError(_0x12b48b,null));};exports[_0xea03('0x42')]=function(_0x47cf4f,_0x4a591b){return db['Automation']['find']({'where':{'id':_0x47cf4f['params']['id']}})[_0xea03('0x1f')](handleEntityNotFound(_0x4a591b,null))['then'](removeEntity(_0x4a591b,null))[_0xea03('0x40')](handleError(_0x4a591b,null));};exports['addConditions']=function(_0x5d3bea,_0x3c4916,_0x5e2231){return db['Condition'][_0xea03('0x3f')]({'where':{'id':_0x5d3bea[_0xea03('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c4916,null))[_0xea03('0x1f')](function(_0x2a2369){if(_0x2a2369){return _0x2a2369[_0xea03('0x43')](_0x5d3bea[_0xea03('0x41')][_0xea03('0x44')],_[_0xea03('0x45')](_0x5d3bea[_0xea03('0x41')],[_0xea03('0x44'),'id'])||{});}})[_0xea03('0x1f')](respondWithResult(_0x3c4916,null))[_0xea03('0x40')](handleError(_0x3c4916,null));};exports[_0xea03('0x46')]=function(_0x21bf13,_0x5a8a99,_0x4fa637){var _0x32f18e={};var _0x7540d9={};var _0x381225;var _0x288ced;return db['Automation'][_0xea03('0x47')]({'where':{'id':_0x21bf13['params']['id']}})[_0xea03('0x1f')](handleEntityNotFound(_0x5a8a99,null))[_0xea03('0x1f')](function(_0x47b473){if(_0x47b473){_0x381225=_0x47b473;_0x7540d9[_0xea03('0x2a')]=_[_0xea03('0x2c')](db[_0xea03('0x48')][_0xea03('0x26')]);_0x7540d9[_0xea03('0x2b')]=_[_0xea03('0x2c')](_0x21bf13[_0xea03('0x2b')]);_0x7540d9['filters']=_[_0xea03('0x2e')](_0x7540d9[_0xea03('0x2a')],_0x7540d9['query']);_0x32f18e['attributes']=_[_0xea03('0x2e')](_0x7540d9[_0xea03('0x2a')],qs[_0xea03('0x30')](_0x21bf13[_0xea03('0x2b')][_0xea03('0x30')]));_0x32f18e[_0xea03('0x2f')]=_0x32f18e[_0xea03('0x2f')][_0xea03('0x31')]?_0x32f18e[_0xea03('0x2f')]:_0x7540d9[_0xea03('0x2a')];_0x32f18e[_0xea03('0x49')]=qs[_0xea03('0x34')](_0x21bf13[_0xea03('0x2b')]['sort']);_0x32f18e[_0xea03('0x35')]=qs[_0xea03('0x2d')](_['pick'](_0x21bf13[_0xea03('0x2b')],_0x7540d9[_0xea03('0x2d')]));if(_0x21bf13[_0xea03('0x2b')][_0xea03('0x38')]){_0x32f18e[_0xea03('0x35')]=_[_0xea03('0x36')](_0x32f18e['where'],{'$or':_[_0xea03('0x24')](_0x32f18e['attributes'],function(_0x133109){var _0x40da14={};_0x40da14[_0x133109]={'$like':'%'+_0x21bf13['query']['filter']+'%'};return _0x40da14;})});}_0x32f18e=_['merge']({},_0x32f18e,_0x21bf13[_0xea03('0x39')]);return _0x381225[_0xea03('0x46')](_0x32f18e);}})['then'](function(_0x5a0b51){if(_0x5a0b51){_0x288ced=_0x5a0b51[_0xea03('0x31')];if(!_0x21bf13[_0xea03('0x2b')]['hasOwnProperty'](_0xea03('0x33'))){_0x32f18e[_0xea03('0x19')]=qs['limit'](_0x21bf13[_0xea03('0x2b')][_0xea03('0x19')]);_0x32f18e[_0xea03('0x18')]=qs[_0xea03('0x18')](_0x21bf13['query'][_0xea03('0x18')]);}return _0x381225[_0xea03('0x46')](_0x32f18e);}})[_0xea03('0x1f')](function(_0x131f68){if(_0x131f68){return _0x131f68?{'count':_0x288ced,'rows':_0x131f68}:null;}})[_0xea03('0x1f')](respondWithResult(_0x5a8a99,null))[_0xea03('0x40')](handleError(_0x5a8a99,null));};exports[_0xea03('0x4a')]=function(_0x1f3e99,_0x41733a,_0x13c1b7){return db[_0xea03('0x4b')][_0xea03('0x3f')]({'where':{'id':_0x1f3e99[_0xea03('0x3d')]['id']}})[_0xea03('0x1f')](handleEntityNotFound(_0x41733a,null))['then'](function(_0x2adc80){if(_0x2adc80){return _0x2adc80[_0xea03('0x4a')](_0x1f3e99[_0xea03('0x41')][_0xea03('0x44')],_[_0xea03('0x45')](_0x1f3e99[_0xea03('0x41')],[_0xea03('0x44'),'id'])||{});}})[_0xea03('0x1f')](respondWithResult(_0x41733a,null))[_0xea03('0x40')](handleError(_0x41733a,null));};exports['getActions']=function(_0x59be1a,_0x3c9bb6,_0x5efbe0){var _0x4de0b8={};var _0x28f2b9={};var _0x23bafe;var _0x2b7c62;return db[_0xea03('0x25')]['findOne']({'where':{'id':_0x59be1a[_0xea03('0x3d')]['id']}})[_0xea03('0x1f')](handleEntityNotFound(_0x3c9bb6,null))[_0xea03('0x1f')](function(_0x53e7d2){if(_0x53e7d2){_0x23bafe=_0x53e7d2;_0x28f2b9[_0xea03('0x2a')]=_['keys'](db[_0xea03('0x4b')][_0xea03('0x26')]);_0x28f2b9[_0xea03('0x2b')]=_[_0xea03('0x2c')](_0x59be1a[_0xea03('0x2b')]);_0x28f2b9[_0xea03('0x2d')]=_[_0xea03('0x2e')](_0x28f2b9[_0xea03('0x2a')],_0x28f2b9[_0xea03('0x2b')]);_0x4de0b8[_0xea03('0x2f')]=_[_0xea03('0x2e')](_0x28f2b9['model'],qs[_0xea03('0x30')](_0x59be1a[_0xea03('0x2b')][_0xea03('0x30')]));_0x4de0b8[_0xea03('0x2f')]=_0x4de0b8[_0xea03('0x2f')][_0xea03('0x31')]?_0x4de0b8[_0xea03('0x2f')]:_0x28f2b9[_0xea03('0x2a')];_0x4de0b8[_0xea03('0x49')]=qs[_0xea03('0x34')](_0x59be1a['query'][_0xea03('0x34')]);_0x4de0b8[_0xea03('0x35')]=qs[_0xea03('0x2d')](_['pick'](_0x59be1a[_0xea03('0x2b')],_0x28f2b9[_0xea03('0x2d')]));if(_0x59be1a[_0xea03('0x2b')][_0xea03('0x38')]){_0x4de0b8[_0xea03('0x35')]=_['merge'](_0x4de0b8[_0xea03('0x35')],{'$or':_[_0xea03('0x24')](_0x4de0b8[_0xea03('0x2f')],function(_0x5d5e31){var _0x40642e={};_0x40642e[_0x5d5e31]={'$like':'%'+_0x59be1a['query'][_0xea03('0x38')]+'%'};return _0x40642e;})});}_0x4de0b8=_[_0xea03('0x36')]({},_0x4de0b8,_0x59be1a[_0xea03('0x39')]);return _0x23bafe['getActions'](_0x4de0b8);}})[_0xea03('0x1f')](function(_0x55af5a){if(_0x55af5a){_0x2b7c62=_0x55af5a['length'];if(!_0x59be1a[_0xea03('0x2b')][_0xea03('0x32')](_0xea03('0x33'))){_0x4de0b8['limit']=qs[_0xea03('0x19')](_0x59be1a[_0xea03('0x2b')][_0xea03('0x19')]);_0x4de0b8[_0xea03('0x18')]=qs[_0xea03('0x18')](_0x59be1a[_0xea03('0x2b')][_0xea03('0x18')]);}return _0x23bafe[_0xea03('0x4c')](_0x4de0b8);}})[_0xea03('0x1f')](function(_0x4d1a52){if(_0x4d1a52){return _0x4d1a52?{'count':_0x2b7c62,'rows':_0x4d1a52}:null;}})['then'](respondWithResult(_0x3c9bb6,null))[_0xea03('0x40')](handleError(_0x3c9bb6,null));}; \ No newline at end of file +var _0xa006=['lodash','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','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','create','catch','body','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv'];(function(_0x2e2d89,_0x4bb615){var _0x3aba90=function(_0x9daf58){while(--_0x9daf58){_0x2e2d89['push'](_0x2e2d89['shift']());}};_0x3aba90(++_0x4bb615);}(_0xa006,0x9c));var _0x6a00=function(_0x5b7e2e,_0x54842d){_0x5b7e2e=_0x5b7e2e-0x0;var _0x34a6fd=_0xa006[_0x5b7e2e];return _0x34a6fd;};'use strict';var pdf=require(_0x6a00('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a00('0x1'));var zipdir=require(_0x6a00('0x2'));var jsonpatch=require(_0x6a00('0x3'));var rp=require(_0x6a00('0x4'));var moment=require(_0x6a00('0x5'));var BPromise=require(_0x6a00('0x6'));var Mustache=require(_0x6a00('0x7'));var util=require(_0x6a00('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x6a00('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6a00('0xa'));var squel=require('squel');var crypto=require(_0x6a00('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a00('0xc'));var toCsv=require(_0x6a00('0x9'));var querystring=require(_0x6a00('0xd'));var Papa=require(_0x6a00('0xe'));var Redis=require(_0x6a00('0xf'));var authService=require(_0x6a00('0x10'));var qs=require(_0x6a00('0x11'));var as=require(_0x6a00('0x12'));var hardwareService=require(_0x6a00('0x13'));var logger=require(_0x6a00('0x14'))(_0x6a00('0x15'));var utils=require(_0x6a00('0x16'));var config=require(_0x6a00('0x17'));var db=require(_0x6a00('0x18'))['db'];function respondWithStatusCode(_0x1244d9,_0x26dd8c){_0x26dd8c=_0x26dd8c||0xcc;return function(_0x2f9d4f){if(_0x2f9d4f){return _0x1244d9[_0x6a00('0x19')](_0x26dd8c);}return _0x1244d9[_0x6a00('0x1a')](_0x26dd8c)['end']();};}function respondWithResult(_0x3edd6f,_0x1e9de3){_0x1e9de3=_0x1e9de3||0xc8;return function(_0x3d6a7f){if(_0x3d6a7f){return _0x3edd6f[_0x6a00('0x1a')](_0x1e9de3)['json'](_0x3d6a7f);}};}function respondWithFilteredResult(_0x112642,_0x54daa0){return function(_0x4d83b3){if(_0x4d83b3){var _0x3edaf8=_0x4d83b3[_0x6a00('0x1b')],_0x49957f=_0x54daa0[_0x6a00('0x1c')],_0x1b57f0=_0x54daa0['offset']+_0x54daa0[_0x6a00('0x1d')],_0x2022a3;if(_0x1b57f0>=_0x3edaf8){_0x1b57f0=_0x3edaf8;_0x2022a3=0xc8;}else{_0x2022a3=0xce;}_0x112642[_0x6a00('0x1a')](_0x2022a3);return _0x112642[_0x6a00('0x1e')](_0x6a00('0x1f'),_0x49957f+'-'+_0x1b57f0+'/'+_0x3edaf8)[_0x6a00('0x20')](_0x4d83b3);}return null;};}function patchUpdates(_0xfbafb2){return function(_0x123bb8){try{jsonpatch['apply'](_0x123bb8,_0xfbafb2,!![]);}catch(_0x3f1607){return BPromise[_0x6a00('0x21')](_0x3f1607);}return _0x123bb8[_0x6a00('0x22')]();};}function saveUpdates(_0x166179,_0x31d292){return function(_0x310f67){if(_0x310f67){return _0x310f67[_0x6a00('0x23')](_0x166179)[_0x6a00('0x24')](function(_0x55cc08){return _0x55cc08;});}return null;};}function removeEntity(_0x44e9bc,_0x4345ad){return function(_0x23d8b0){if(_0x23d8b0){return _0x23d8b0[_0x6a00('0x25')]()[_0x6a00('0x24')](function(){_0x44e9bc[_0x6a00('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf15d6,_0x2a1f29){return function(_0x2c45ec){if(!_0x2c45ec){_0xf15d6['sendStatus'](0x194);}return _0x2c45ec;};}function handleError(_0x191b0c,_0x571db2){_0x571db2=_0x571db2||0x1f4;return function(_0x40196f){logger[_0x6a00('0x26')](_0x40196f[_0x6a00('0x27')]);if(_0x40196f['name']){delete _0x40196f[_0x6a00('0x28')];}_0x191b0c[_0x6a00('0x1a')](_0x571db2)[_0x6a00('0x29')](_0x40196f);};}exports[_0x6a00('0x2a')]=function(_0x704400,_0x8d03eb){var _0x5b2848={},_0x10b854={},_0x3f8603={'count':0x0,'rows':[]};var _0x2ada19=_[_0x6a00('0x2b')](db['Automation']['rawAttributes'],function(_0x1070df){return{'name':_0x1070df[_0x6a00('0x2c')],'type':_0x1070df[_0x6a00('0x2d')]['key']};});_0x10b854[_0x6a00('0x2e')]=_[_0x6a00('0x2b')](_0x2ada19,_0x6a00('0x28'));_0x10b854[_0x6a00('0x2f')]=_['keys'](_0x704400[_0x6a00('0x2f')]);_0x10b854[_0x6a00('0x30')]=_[_0x6a00('0x31')](_0x10b854[_0x6a00('0x2e')],_0x10b854['query']);_0x5b2848[_0x6a00('0x32')]=_[_0x6a00('0x31')](_0x10b854[_0x6a00('0x2e')],qs['fields'](_0x704400[_0x6a00('0x2f')][_0x6a00('0x33')]));_0x5b2848['attributes']=_0x5b2848[_0x6a00('0x32')][_0x6a00('0x34')]?_0x5b2848['attributes']:_0x10b854[_0x6a00('0x2e')];if(!_0x704400[_0x6a00('0x2f')][_0x6a00('0x35')]('nolimit')){_0x5b2848[_0x6a00('0x1d')]=qs[_0x6a00('0x1d')](_0x704400[_0x6a00('0x2f')][_0x6a00('0x1d')]);_0x5b2848['offset']=qs[_0x6a00('0x1c')](_0x704400['query'][_0x6a00('0x1c')]);}_0x5b2848[_0x6a00('0x36')]=qs[_0x6a00('0x37')](_0x704400[_0x6a00('0x2f')][_0x6a00('0x37')]);_0x5b2848[_0x6a00('0x38')]=qs['filters'](_[_0x6a00('0x39')](_0x704400[_0x6a00('0x2f')],_0x10b854[_0x6a00('0x30')]),_0x2ada19);if(_0x704400[_0x6a00('0x2f')][_0x6a00('0x3a')]){_0x5b2848['where']=_[_0x6a00('0x3b')](_0x5b2848['where'],{'$or':_[_0x6a00('0x2b')](_0x2ada19,function(_0x2185fd){if(_0x2185fd[_0x6a00('0x2d')]!==_0x6a00('0x3c')){var _0x5e6a53={};_0x5e6a53[_0x2185fd[_0x6a00('0x28')]]={'$like':'%'+_0x704400[_0x6a00('0x2f')][_0x6a00('0x3a')]+'%'};return _0x5e6a53;}})});}_0x5b2848=_['merge']({},_0x5b2848,_0x704400[_0x6a00('0x3d')]);var _0x216c10={'where':_0x5b2848['where']};return db[_0x6a00('0x3e')][_0x6a00('0x1b')](_0x216c10)['then'](function(_0x3c1c6f){_0x3f8603[_0x6a00('0x1b')]=_0x3c1c6f;if(_0x704400[_0x6a00('0x2f')][_0x6a00('0x3f')]){_0x5b2848[_0x6a00('0x40')]=[{'all':!![]}];}return db[_0x6a00('0x3e')][_0x6a00('0x41')](_0x5b2848);})['then'](function(_0x3c57da){_0x3f8603[_0x6a00('0x42')]=_0x3c57da;return _0x3f8603;})[_0x6a00('0x24')](respondWithFilteredResult(_0x8d03eb,_0x5b2848))['catch'](handleError(_0x8d03eb,null));};exports[_0x6a00('0x43')]=function(_0x162faf,_0x3f3a13){var _0x10dd91={'raw':![],'where':{'id':_0x162faf[_0x6a00('0x44')]['id']}},_0xef7c8={};_0xef7c8['model']=_['keys'](db[_0x6a00('0x3e')][_0x6a00('0x45')]);_0xef7c8['query']=_[_0x6a00('0x46')](_0x162faf['query']);_0xef7c8['filters']=_['intersection'](_0xef7c8[_0x6a00('0x2e')],_0xef7c8['query']);_0x10dd91[_0x6a00('0x32')]=_['intersection'](_0xef7c8['model'],qs['fields'](_0x162faf[_0x6a00('0x2f')]['fields']));_0x10dd91[_0x6a00('0x32')]=_0x10dd91[_0x6a00('0x32')][_0x6a00('0x34')]?_0x10dd91[_0x6a00('0x32')]:_0xef7c8[_0x6a00('0x2e')];if(_0x162faf[_0x6a00('0x2f')]['includeAll']){_0x10dd91['include']=[{'all':!![]}];}_0x10dd91=_['merge']({},_0x10dd91,_0x162faf['options']);return db[_0x6a00('0x3e')][_0x6a00('0x47')](_0x10dd91)['then'](handleEntityNotFound(_0x3f3a13,null))[_0x6a00('0x24')](respondWithResult(_0x3f3a13,null))['catch'](handleError(_0x3f3a13,null));};exports[_0x6a00('0x48')]=function(_0x13de22,_0x42f2d9){return db[_0x6a00('0x3e')]['create'](_0x13de22['body'],{})[_0x6a00('0x24')](respondWithResult(_0x42f2d9,0xc9))[_0x6a00('0x49')](handleError(_0x42f2d9,null));};exports[_0x6a00('0x23')]=function(_0x299916,_0x375a55){if(_0x299916[_0x6a00('0x4a')]['id']){delete _0x299916[_0x6a00('0x4a')]['id'];}return db['Automation']['find']({'where':{'id':_0x299916[_0x6a00('0x44')]['id']}})[_0x6a00('0x24')](handleEntityNotFound(_0x375a55,null))['then'](saveUpdates(_0x299916[_0x6a00('0x4a')],null))[_0x6a00('0x24')](respondWithResult(_0x375a55,null))[_0x6a00('0x49')](handleError(_0x375a55,null));};exports[_0x6a00('0x25')]=function(_0x5d3409,_0x2f2e68){return db[_0x6a00('0x3e')][_0x6a00('0x47')]({'where':{'id':_0x5d3409[_0x6a00('0x44')]['id']}})['then'](handleEntityNotFound(_0x2f2e68,null))[_0x6a00('0x24')](removeEntity(_0x2f2e68,null))[_0x6a00('0x49')](handleError(_0x2f2e68,null));};exports[_0x6a00('0x4b')]=function(_0x916d4d,_0x5e8382,_0x1380e4){return db[_0x6a00('0x4c')][_0x6a00('0x47')]({'where':{'id':_0x916d4d['params']['id']}})[_0x6a00('0x24')](handleEntityNotFound(_0x5e8382,null))['then'](function(_0x5344d6){if(_0x5344d6){return _0x5344d6['addConditions'](_0x916d4d[_0x6a00('0x4a')][_0x6a00('0x4d')],_[_0x6a00('0x4e')](_0x916d4d['body'],[_0x6a00('0x4d'),'id'])||{});}})[_0x6a00('0x24')](respondWithResult(_0x5e8382,null))[_0x6a00('0x49')](handleError(_0x5e8382,null));};exports[_0x6a00('0x4f')]=function(_0xc41903,_0x5ebc75,_0x1d4733){var _0x399cba={};var _0x1ed3e2={};var _0x1bce1b;var _0x8c4515;return db[_0x6a00('0x3e')][_0x6a00('0x50')]({'where':{'id':_0xc41903[_0x6a00('0x44')]['id']}})[_0x6a00('0x24')](handleEntityNotFound(_0x5ebc75,null))[_0x6a00('0x24')](function(_0x31f115){if(_0x31f115){_0x1bce1b=_0x31f115;_0x1ed3e2[_0x6a00('0x2e')]=_[_0x6a00('0x46')](db[_0x6a00('0x4c')][_0x6a00('0x45')]);_0x1ed3e2[_0x6a00('0x2f')]=_['keys'](_0xc41903[_0x6a00('0x2f')]);_0x1ed3e2[_0x6a00('0x30')]=_[_0x6a00('0x31')](_0x1ed3e2['model'],_0x1ed3e2[_0x6a00('0x2f')]);_0x399cba[_0x6a00('0x32')]=_[_0x6a00('0x31')](_0x1ed3e2[_0x6a00('0x2e')],qs[_0x6a00('0x33')](_0xc41903[_0x6a00('0x2f')][_0x6a00('0x33')]));_0x399cba['attributes']=_0x399cba[_0x6a00('0x32')][_0x6a00('0x34')]?_0x399cba['attributes']:_0x1ed3e2[_0x6a00('0x2e')];_0x399cba[_0x6a00('0x36')]=qs['sort'](_0xc41903[_0x6a00('0x2f')][_0x6a00('0x37')]);_0x399cba['where']=qs[_0x6a00('0x30')](_[_0x6a00('0x39')](_0xc41903['query'],_0x1ed3e2[_0x6a00('0x30')]));if(_0xc41903[_0x6a00('0x2f')]['filter']){_0x399cba[_0x6a00('0x38')]=_['merge'](_0x399cba[_0x6a00('0x38')],{'$or':_[_0x6a00('0x2b')](_0x399cba[_0x6a00('0x32')],function(_0x367810){var _0x2374e9={};_0x2374e9[_0x367810]={'$like':'%'+_0xc41903['query'][_0x6a00('0x3a')]+'%'};return _0x2374e9;})});}_0x399cba=_[_0x6a00('0x3b')]({},_0x399cba,_0xc41903[_0x6a00('0x3d')]);return _0x1bce1b[_0x6a00('0x4f')](_0x399cba);}})[_0x6a00('0x24')](function(_0x46c562){if(_0x46c562){_0x8c4515=_0x46c562[_0x6a00('0x34')];if(!_0xc41903['query'][_0x6a00('0x35')](_0x6a00('0x51'))){_0x399cba[_0x6a00('0x1d')]=qs[_0x6a00('0x1d')](_0xc41903[_0x6a00('0x2f')]['limit']);_0x399cba[_0x6a00('0x1c')]=qs[_0x6a00('0x1c')](_0xc41903['query'][_0x6a00('0x1c')]);}return _0x1bce1b['getConditions'](_0x399cba);}})[_0x6a00('0x24')](function(_0x3146db){if(_0x3146db){return _0x3146db?{'count':_0x8c4515,'rows':_0x3146db}:null;}})[_0x6a00('0x24')](respondWithResult(_0x5ebc75,null))[_0x6a00('0x49')](handleError(_0x5ebc75,null));};exports['addActions']=function(_0x412879,_0x560cd2,_0x5c5177){return db['Action']['find']({'where':{'id':_0x412879[_0x6a00('0x44')]['id']}})[_0x6a00('0x24')](handleEntityNotFound(_0x560cd2,null))['then'](function(_0x129708){if(_0x129708){return _0x129708['addActions'](_0x412879['body'][_0x6a00('0x4d')],_[_0x6a00('0x4e')](_0x412879['body'],['ids','id'])||{});}})[_0x6a00('0x24')](respondWithResult(_0x560cd2,null))[_0x6a00('0x49')](handleError(_0x560cd2,null));};exports[_0x6a00('0x52')]=function(_0x3181c9,_0x44a497,_0x1c3fb5){var _0x5e714c={};var _0x5ab81a={};var _0x9ef99;var _0x11f45e;return db[_0x6a00('0x3e')][_0x6a00('0x50')]({'where':{'id':_0x3181c9[_0x6a00('0x44')]['id']}})[_0x6a00('0x24')](handleEntityNotFound(_0x44a497,null))[_0x6a00('0x24')](function(_0x23a9c0){if(_0x23a9c0){_0x9ef99=_0x23a9c0;_0x5ab81a[_0x6a00('0x2e')]=_['keys'](db['Action'][_0x6a00('0x45')]);_0x5ab81a[_0x6a00('0x2f')]=_[_0x6a00('0x46')](_0x3181c9[_0x6a00('0x2f')]);_0x5ab81a[_0x6a00('0x30')]=_['intersection'](_0x5ab81a[_0x6a00('0x2e')],_0x5ab81a[_0x6a00('0x2f')]);_0x5e714c[_0x6a00('0x32')]=_[_0x6a00('0x31')](_0x5ab81a[_0x6a00('0x2e')],qs[_0x6a00('0x33')](_0x3181c9[_0x6a00('0x2f')]['fields']));_0x5e714c[_0x6a00('0x32')]=_0x5e714c['attributes']['length']?_0x5e714c[_0x6a00('0x32')]:_0x5ab81a['model'];_0x5e714c['order']=qs['sort'](_0x3181c9[_0x6a00('0x2f')]['sort']);_0x5e714c[_0x6a00('0x38')]=qs[_0x6a00('0x30')](_[_0x6a00('0x39')](_0x3181c9[_0x6a00('0x2f')],_0x5ab81a[_0x6a00('0x30')]));if(_0x3181c9[_0x6a00('0x2f')]['filter']){_0x5e714c[_0x6a00('0x38')]=_[_0x6a00('0x3b')](_0x5e714c[_0x6a00('0x38')],{'$or':_['map'](_0x5e714c['attributes'],function(_0x3009ae){var _0x5ed2a7={};_0x5ed2a7[_0x3009ae]={'$like':'%'+_0x3181c9[_0x6a00('0x2f')][_0x6a00('0x3a')]+'%'};return _0x5ed2a7;})});}_0x5e714c=_[_0x6a00('0x3b')]({},_0x5e714c,_0x3181c9[_0x6a00('0x3d')]);return _0x9ef99[_0x6a00('0x52')](_0x5e714c);}})[_0x6a00('0x24')](function(_0x56150a){if(_0x56150a){_0x11f45e=_0x56150a[_0x6a00('0x34')];if(!_0x3181c9['query']['hasOwnProperty'](_0x6a00('0x51'))){_0x5e714c[_0x6a00('0x1d')]=qs[_0x6a00('0x1d')](_0x3181c9['query'][_0x6a00('0x1d')]);_0x5e714c[_0x6a00('0x1c')]=qs[_0x6a00('0x1c')](_0x3181c9[_0x6a00('0x2f')][_0x6a00('0x1c')]);}return _0x9ef99[_0x6a00('0x52')](_0x5e714c);}})[_0x6a00('0x24')](function(_0x3380b9){if(_0x3380b9){return _0x3380b9?{'count':_0x11f45e,'rows':_0x3380b9}:null;}})[_0x6a00('0x24')](respondWithResult(_0x44a497,null))['catch'](handleError(_0x44a497,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ba8e3b5..21aa19a 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 _0xe3dc=['bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x282999,_0x4df660){var _0x30681f=function(_0x50e926){while(--_0x50e926){_0x282999['push'](_0x282999['shift']());}};_0x30681f(++_0x4df660);}(_0xe3dc,0x1e7));var _0xce3d=function(_0x52b6ee,_0xd14003){_0x52b6ee=_0x52b6ee-0x0;var _0x1e360a=_0xe3dc[_0x52b6ee];return _0x1e360a;};'use strict';var _=require(_0xce3d('0x0'));var util=require(_0xce3d('0x1'));var logger=require(_0xce3d('0x2'))(_0xce3d('0x3'));var moment=require(_0xce3d('0x4'));var BPromise=require(_0xce3d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce3d('0x6'));var rimraf=require(_0xce3d('0x7'));var config=require(_0xce3d('0x8'));var attributes=require(_0xce3d('0x9'));module[_0xce3d('0xa')]=function(_0x4f4fb7,_0x24f824){return _0x4f4fb7[_0xce3d('0xb')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x728e=['define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x728e,0x153));var _0xe728=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x728e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe728('0x0'));var util=require(_0xe728('0x1'));var logger=require(_0xe728('0x2'))(_0xe728('0x3'));var moment=require(_0xe728('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe728('0x5'));var rimraf=require(_0xe728('0x6'));var config=require(_0xe728('0x7'));var attributes=require(_0xe728('0x8'));module['exports']=function(_0x57c328,_0x4c8f92){return _0x57c328[_0xe728('0x9')](_0xe728('0xa'),attributes,{'tableName':_0xe728('0xb'),'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 5eb3d02..89ec7b4 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 _0x1454=['info','request\x20sent','debug','stringify','error','code','message','Automation,\x20%s,\x20%s','result','catch','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xdf2223,_0x92351f){var _0x5a7e7f=function(_0x550b6b){while(--_0x550b6b){_0xdf2223['push'](_0xdf2223['shift']());}};_0x5a7e7f(++_0x92351f);}(_0x1454,0x69));var _0x4145=function(_0x2da571,_0x113afe){_0x2da571=_0x2da571-0x0;var _0x3c0c5b=_0x1454[_0x2da571];return _0x3c0c5b;};'use strict';var _=require('lodash');var util=require(_0x4145('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4145('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4145('0x2'))(_0x4145('0x3'));var config=require(_0x4145('0x4'));var jayson=require(_0x4145('0x5'));var client=jayson[_0x4145('0x6')][_0x4145('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe9b8df,_0x48eb10,_0x5eb446){return new BPromise(function(_0x4ce78c,_0x10f4be){return client[_0x4145('0x8')](_0xe9b8df,_0x5eb446)['then'](function(_0x3226b6){logger[_0x4145('0x9')]('Automation,\x20%s,\x20%s',_0x48eb10,_0x4145('0xa'));logger[_0x4145('0xb')]('Automation,\x20%s,\x20%s,\x20%s',_0x48eb10,'request\x20sent',JSON[_0x4145('0xc')](_0x3226b6));if(_0x3226b6[_0x4145('0xd')]){if(_0x3226b6[_0x4145('0xd')][_0x4145('0xe')]===0x1f4){logger[_0x4145('0xd')]('Automation,\x20%s,\x20%s',_0x48eb10,_0x3226b6['error'][_0x4145('0xf')]);return _0x10f4be(_0x3226b6[_0x4145('0xd')][_0x4145('0xf')]);}logger[_0x4145('0xd')](_0x4145('0x10'),_0x48eb10,_0x3226b6[_0x4145('0xd')][_0x4145('0xf')]);return _0x4ce78c(_0x3226b6[_0x4145('0xd')][_0x4145('0xf')]);}else{logger[_0x4145('0x9')](_0x4145('0x10'),_0x48eb10,'request\x20sent');_0x4ce78c(_0x3226b6[_0x4145('0x11')][_0x4145('0xf')]);}})[_0x4145('0x12')](function(_0x3d2ca3){logger[_0x4145('0xd')](_0x4145('0x10'),_0x48eb10,_0x3d2ca3);_0x10f4be(_0x3d2ca3);});});} \ No newline at end of file +var _0x4c7a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','util','moment','bluebird'];(function(_0x301ee7,_0x4a292b){var _0x4894bc=function(_0xbea567){while(--_0xbea567){_0x301ee7['push'](_0x301ee7['shift']());}};_0x4894bc(++_0x4a292b);}(_0x4c7a,0x11a));var _0xa4c7=function(_0x21a5e6,_0x7d5c5){_0x21a5e6=_0x21a5e6-0x0;var _0x8b21bd=_0x4c7a[_0x21a5e6];return _0x8b21bd;};'use strict';var _=require(_0xa4c7('0x0'));var util=require(_0xa4c7('0x1'));var moment=require(_0xa4c7('0x2'));var BPromise=require(_0xa4c7('0x3'));var rs=require(_0xa4c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4c7('0x5'))['db'];var utils=require(_0xa4c7('0x6'));var logger=require(_0xa4c7('0x7'))(_0xa4c7('0x8'));var config=require(_0xa4c7('0x9'));var jayson=require(_0xa4c7('0xa'));var client=jayson[_0xa4c7('0xb')][_0xa4c7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49d11b,_0x43e47f,_0x4ce02d){return new BPromise(function(_0x373f04,_0x2eea5e){return client[_0xa4c7('0xd')](_0x49d11b,_0x4ce02d)[_0xa4c7('0xe')](function(_0x30c84b){logger[_0xa4c7('0xf')](_0xa4c7('0x10'),_0x43e47f,'request\x20sent');logger['debug'](_0xa4c7('0x11'),_0x43e47f,'request\x20sent',JSON['stringify'](_0x30c84b));if(_0x30c84b[_0xa4c7('0x12')]){if(_0x30c84b['error']['code']===0x1f4){logger['error'](_0xa4c7('0x10'),_0x43e47f,_0x30c84b[_0xa4c7('0x12')][_0xa4c7('0x13')]);return _0x2eea5e(_0x30c84b[_0xa4c7('0x12')][_0xa4c7('0x13')]);}logger[_0xa4c7('0x12')](_0xa4c7('0x10'),_0x43e47f,_0x30c84b[_0xa4c7('0x12')][_0xa4c7('0x13')]);return _0x373f04(_0x30c84b['error'][_0xa4c7('0x13')]);}else{logger[_0xa4c7('0xf')]('Automation,\x20%s,\x20%s',_0x43e47f,_0xa4c7('0x14'));_0x373f04(_0x30c84b['result'][_0xa4c7('0x13')]);}})[_0xa4c7('0x15')](function(_0x116023){logger['error']('Automation,\x20%s,\x20%s',_0x43e47f,_0x116023);_0x2eea5e(_0x116023);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 976a004..7516628 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 _0xcc22=['get','isAuthenticated','/:id','show','/:id/conditions','/:id/actions','getActions','post','addConditions','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./automation.controller'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xcc22,0x19c));var _0x2cc2=function(_0xb9706,_0x4a0ee2){_0xb9706=_0xb9706-0x0;var _0x350f0b=_0xcc22[_0xb9706];return _0x350f0b;};'use strict';var multer=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var path=require(_0x2cc2('0x2'));var timeout=require(_0x2cc2('0x3'));var express=require(_0x2cc2('0x4'));var router=express['Router']();var auth=require(_0x2cc2('0x5'));var interaction=require(_0x2cc2('0x6'));var config=require('../../config/environment');var controller=require(_0x2cc2('0x7'));router[_0x2cc2('0x8')]('/',auth[_0x2cc2('0x9')](),controller['index']);router[_0x2cc2('0x8')](_0x2cc2('0xa'),auth[_0x2cc2('0x9')](),controller[_0x2cc2('0xb')]);router['get'](_0x2cc2('0xc'),auth[_0x2cc2('0x9')](),controller['getConditions']);router[_0x2cc2('0x8')](_0x2cc2('0xd'),auth['isAuthenticated'](),controller[_0x2cc2('0xe')]);router['post']('/',auth[_0x2cc2('0x9')](),controller['create']);router[_0x2cc2('0xf')](_0x2cc2('0xc'),auth[_0x2cc2('0x9')](),controller[_0x2cc2('0x10')]);router['post'](_0x2cc2('0xd'),auth[_0x2cc2('0x9')](),controller['addActions']);router[_0x2cc2('0x11')]('/:id',auth[_0x2cc2('0x9')](),controller['update']);router[_0x2cc2('0x12')](_0x2cc2('0xa'),auth[_0x2cc2('0x9')](),controller[_0x2cc2('0x13')]);module['exports']=router; \ No newline at end of file +var _0xccf3=['addActions','put','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions','getActions','post','/:id/conditions'];(function(_0x32f3d0,_0x18caa6){var _0x3cfb65=function(_0x1b97ba){while(--_0x1b97ba){_0x32f3d0['push'](_0x32f3d0['shift']());}};_0x3cfb65(++_0x18caa6);}(_0xccf3,0x1d3));var _0x3ccf=function(_0x202023,_0x32a04d){_0x202023=_0x202023-0x0;var _0x2e3ec2=_0xccf3[_0x202023];return _0x2e3ec2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3ccf('0x0'));var express=require(_0x3ccf('0x1'));var router=express[_0x3ccf('0x2')]();var auth=require(_0x3ccf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3ccf('0x4'));var controller=require(_0x3ccf('0x5'));router[_0x3ccf('0x6')]('/',auth[_0x3ccf('0x7')](),controller[_0x3ccf('0x8')]);router['get'](_0x3ccf('0x9'),auth[_0x3ccf('0x7')](),controller[_0x3ccf('0xa')]);router[_0x3ccf('0x6')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x3ccf('0xb')]);router['get'](_0x3ccf('0xc'),auth[_0x3ccf('0x7')](),controller[_0x3ccf('0xd')]);router['post']('/',auth[_0x3ccf('0x7')](),controller['create']);router[_0x3ccf('0xe')](_0x3ccf('0xf'),auth['isAuthenticated'](),controller['addConditions']);router['post']('/:id/actions',auth[_0x3ccf('0x7')](),controller[_0x3ccf('0x10')]);router[_0x3ccf('0x11')](_0x3ccf('0x9'),auth[_0x3ccf('0x7')](),controller['update']);router[_0x3ccf('0x12')](_0x3ccf('0x9'),auth['isAuthenticated'](),controller[_0x3ccf('0x13')]);module[_0x3ccf('0x14')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 773326d..12dd7de 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 _0x6b59=['DESC','ASC','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x11079d,_0x39f9ec){var _0x2e5818=function(_0x1ba7d6){while(--_0x1ba7d6){_0x11079d['push'](_0x11079d['shift']());}};_0x2e5818(++_0x39f9ec);}(_0x6b59,0x9e));var _0x96b5=function(_0x5bdb0c,_0x22dacc){_0x5bdb0c=_0x5bdb0c-0x0;var _0x84c6d6=_0x6b59[_0x5bdb0c];return _0x84c6d6;};'use strict';var Sequelize=require(_0x96b5('0x0'));module['exports']={'name':{'type':Sequelize[_0x96b5('0x1')],'unique':_0x96b5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x96b5('0x3')](_0x96b5('0x4')),'allowNull':![],'defaultValue':_0x96b5('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x96b5('0x5')},'limitCalls':{'type':Sequelize[_0x96b5('0x6')](0x4)[_0x96b5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x96b5('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x96b5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x96b5('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96b5('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x96b5('0x6')](0x3)[_0x96b5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96b5('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x96b5('0x6')](0x5)[_0x96b5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96b5('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x96b5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96b5('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x96b5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x96b5('0x6')](0x3)[_0x96b5('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x96b5('0x6')](0x5)[_0x96b5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96b5('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x96b5('0x6')](0x3)[_0x96b5('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x96b5('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x96b5('0xe'),'never',_0x96b5('0xf')),'defaultValue':_0x96b5('0xe')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x96b5('0x6')](0x9)[_0x96b5('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x96b5('0x10')},'dialAMDGreeting':{'type':Sequelize[_0x96b5('0x6')](0x9)[_0x96b5('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x96b5('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x96b5('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x96b5('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0x96b5('0x6')](0x9)[_0x96b5('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x96b5('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x96b5('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x96b5('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x96b5('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x96b5('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x96b5('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x96b5('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x96b5('0x3')](_0x96b5('0x16'),_0x96b5('0x17')),'defaultValue':_0x96b5('0x16')},'dialPrefix':{'type':Sequelize[_0x96b5('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x96b5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x96b5('0x6')](0x3)[_0x96b5('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x96b5('0x6')](0x3)[_0x96b5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x96b5('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96b5('0x18')},'dialDropMaxRetry':{'type':Sequelize[_0x96b5('0x6')](0x3)[_0x96b5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96b5('0x19')},'dialDropRetryFrequency':{'type':Sequelize[_0x96b5('0x6')](0x5)[_0x96b5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x96b5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96b5('0x1a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x96b5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x96b5('0x6')](0x3)[_0x96b5('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x96b5('0x1b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x96b5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96b5('0x1c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x96b5('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x96b5('0x6')](0x5)[_0x96b5('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x96b5('0x1d')}}; \ No newline at end of file +var _0xe3b1=['#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','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','Active/Disactive\x20AMD'];(function(_0x25ce6d,_0x344d44){var _0x328b3b=function(_0x55e122){while(--_0x55e122){_0x25ce6d['push'](_0x25ce6d['shift']());}};_0x328b3b(++_0x344d44);}(_0xe3b1,0x83));var _0x1e3b=function(_0x461c9c,_0x2b1791){_0x461c9c=_0x461c9c-0x0;var _0x205ecc=_0xe3b1[_0x461c9c];return _0x205ecc;};'use strict';var Sequelize=require('sequelize');module[_0x1e3b('0x0')]={'name':{'type':Sequelize[_0x1e3b('0x1')],'unique':_0x1e3b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1e3b('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x1e3b('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1e3b('0x5')],'defaultValue':0x0,'comment':_0x1e3b('0x6')},'limitCalls':{'type':Sequelize[_0x1e3b('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1e3b('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1e3b('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x1e3b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e3b('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1e3b('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1e3b('0x7')](0x5)[_0x1e3b('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e3b('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x1e3b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e3b('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1e3b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e3b('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1e3b('0xa')],'defaultValue':0x3,'comment':_0x1e3b('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1e3b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e3b('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1e3b('0x7')](0x3)[_0x1e3b('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1e3b('0x10')},'dialTimezone':{'type':Sequelize[_0x1e3b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1e3b('0x11')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1e3b('0x12'),'never',_0x1e3b('0x13')),'defaultValue':_0x1e3b('0x12')},'dialAMDActive':{'type':Sequelize[_0x1e3b('0x5')],'defaultValue':0x0,'comment':_0x1e3b('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x1e3b('0x7')](0x9)[_0x1e3b('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1e3b('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x1e3b('0x7')](0x9)[_0x1e3b('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1e3b('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1e3b('0x7')](0x9)[_0x1e3b('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1e3b('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1e3b('0x7')](0x9)[_0x1e3b('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1e3b('0x7')](0x9)[_0x1e3b('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1e3b('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1e3b('0x7')](0x9)[_0x1e3b('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1e3b('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1e3b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1e3b('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1e3b('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1e3b('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1e3b('0x1b'),_0x1e3b('0x1c')),'defaultValue':_0x1e3b('0x1b')},'dialPrefix':{'type':Sequelize[_0x1e3b('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1e3b('0x7')](0x3)[_0x1e3b('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1e3b('0x1d')},'dialCutDigit':{'type':Sequelize[_0x1e3b('0x7')](0x3)[_0x1e3b('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1e3b('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1e3b('0x7')](0x5)[_0x1e3b('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1e3b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e3b('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x1e3b('0x7')](0x5)[_0x1e3b('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e3b('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e3b('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1e3b('0x7')](0x5)[_0x1e3b('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e3b('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x1e3b('0x7')](0x3)[_0x1e3b('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e3b('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1e3b('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e3b('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1e3b('0x7')](0x3)[_0x1e3b('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1e3b('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1e3b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1e3b('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index fb5dfae..3e9b0db 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 _0xa81f=['Content-Range','apply','reject','save','update','then','get','IvrCampaigns','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','Campaign','findAll','rows','catch','params','intersection','includeAll','include','find','create','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','body','updatedAt','role','UserProfileResource','CampaignId','CmHopper','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','omit','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','deletedAt\x20IS\x20NULL','push','sequelize','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set'];(function(_0x1062cd,_0x1a1e5e){var _0x3d7d4f=function(_0x57f3ae){while(--_0x57f3ae){_0x1062cd['push'](_0x1062cd['shift']());}};_0x3d7d4f(++_0x1a1e5e);}(_0xa81f,0x67));var _0xfa81=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0xa81f[_0x3a8db5];return _0x2c03cd;};'use strict';var pdf=require(_0xfa81('0x0'));var emlformat=require(_0xfa81('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfa81('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa81('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfa81('0x4'));var util=require('util');var path=require(_0xfa81('0x5'));var sox=require(_0xfa81('0x6'));var csv=require(_0xfa81('0x7'));var ejs=require(_0xfa81('0x8'));var fs=require('fs');var _=require(_0xfa81('0x9'));var squel=require('squel');var crypto=require(_0xfa81('0xa'));var jsforce=require(_0xfa81('0xb'));var deskjs=require(_0xfa81('0xc'));var toCsv=require(_0xfa81('0x7'));var querystring=require(_0xfa81('0xd'));var Papa=require(_0xfa81('0xe'));var Redis=require(_0xfa81('0xf'));var authService=require(_0xfa81('0x10'));var qs=require(_0xfa81('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa81('0x12'));var logger=require(_0xfa81('0x13'))(_0xfa81('0x14'));var utils=require(_0xfa81('0x15'));var config=require('../../config/environment');var db=require(_0xfa81('0x16'))['db'];function respondWithStatusCode(_0x34742a,_0x25195e){_0x25195e=_0x25195e||0xcc;return function(_0x1420c5){if(_0x1420c5){return _0x34742a[_0xfa81('0x17')](_0x25195e);}return _0x34742a[_0xfa81('0x18')](_0x25195e)['end']();};}function respondWithResult(_0x35a5d5,_0x29ddce){_0x29ddce=_0x29ddce||0xc8;return function(_0x7e89e1){if(_0x7e89e1){return _0x35a5d5['status'](_0x29ddce)[_0xfa81('0x19')](_0x7e89e1);}};}function respondWithFilteredResult(_0x1ce8fe,_0x3a8ee9){return function(_0x5d7e11){if(_0x5d7e11){var _0x341f62=_0x5d7e11[_0xfa81('0x1a')],_0x1a111f=_0x3a8ee9[_0xfa81('0x1b')],_0x32d2cc=_0x3a8ee9['offset']+_0x3a8ee9[_0xfa81('0x1c')],_0x1303ab;if(_0x32d2cc>=_0x341f62){_0x32d2cc=_0x341f62;_0x1303ab=0xc8;}else{_0x1303ab=0xce;}_0x1ce8fe[_0xfa81('0x18')](_0x1303ab);return _0x1ce8fe[_0xfa81('0x1d')](_0xfa81('0x1e'),_0x1a111f+'-'+_0x32d2cc+'/'+_0x341f62)[_0xfa81('0x19')](_0x5d7e11);}return null;};}function patchUpdates(_0x3a1476){return function(_0x71f284){try{jsonpatch[_0xfa81('0x1f')](_0x71f284,_0x3a1476,!![]);}catch(_0x29fcd4){return BPromise[_0xfa81('0x20')](_0x29fcd4);}return _0x71f284[_0xfa81('0x21')]();};}function saveUpdates(_0x4d57c4,_0x2c90dd){return function(_0x376c2b){if(_0x376c2b){return _0x376c2b[_0xfa81('0x22')](_0x4d57c4)['then'](function(_0x35d7f4){return _0x35d7f4;});}return null;};}function removeEntity(_0x234c92,_0x2aafd4){return function(_0x110556){if(_0x110556){return _0x110556['destroy']()[_0xfa81('0x23')](function(){var _0x41453e=_0x110556[_0xfa81('0x24')]({'plain':!![]});var _0x3054e2=_0xfa81('0x25');return db['UserProfileResource'][_0xfa81('0x26')]({'where':{'type':_0x3054e2,'resourceId':_0x41453e['id']}})['then'](function(){return _0x110556;});})['then'](function(){_0x234c92['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4296be,_0x1a7f32){return function(_0xae7693){if(!_0xae7693){_0x4296be[_0xfa81('0x17')](0x194);}return _0xae7693;};}function handleError(_0x19bafa,_0x389068){_0x389068=_0x389068||0x1f4;return function(_0x462768){logger['error'](_0x462768[_0xfa81('0x27')]);if(_0x462768[_0xfa81('0x28')]){delete _0x462768['name'];}_0x19bafa[_0xfa81('0x18')](_0x389068)[_0xfa81('0x29')](_0x462768);};}exports[_0xfa81('0x2a')]=function(_0x465ddf,_0x2d4acf){var _0x56ba2a={},_0x5d72c9={},_0x520ed4={'count':0x0,'rows':[]};var _0x21b67f=_['map'](db['Campaign'][_0xfa81('0x2b')],function(_0x511e2e){return{'name':_0x511e2e[_0xfa81('0x2c')],'type':_0x511e2e['type'][_0xfa81('0x2d')]};});_0x5d72c9[_0xfa81('0x2e')]=_[_0xfa81('0x2f')](_0x21b67f,_0xfa81('0x28'));_0x5d72c9[_0xfa81('0x30')]=_[_0xfa81('0x31')](_0x465ddf[_0xfa81('0x30')]);_0x5d72c9[_0xfa81('0x32')]=_['intersection'](_0x5d72c9['model'],_0x5d72c9[_0xfa81('0x30')]);_0x56ba2a[_0xfa81('0x33')]=_['intersection'](_0x5d72c9[_0xfa81('0x2e')],qs['fields'](_0x465ddf[_0xfa81('0x30')][_0xfa81('0x34')]));_0x56ba2a[_0xfa81('0x33')]=_0x56ba2a['attributes'][_0xfa81('0x35')]?_0x56ba2a[_0xfa81('0x33')]:_0x5d72c9[_0xfa81('0x2e')];if(!_0x465ddf[_0xfa81('0x30')][_0xfa81('0x36')](_0xfa81('0x37'))){_0x56ba2a[_0xfa81('0x1c')]=qs[_0xfa81('0x1c')](_0x465ddf[_0xfa81('0x30')][_0xfa81('0x1c')]);_0x56ba2a[_0xfa81('0x1b')]=qs[_0xfa81('0x1b')](_0x465ddf[_0xfa81('0x30')][_0xfa81('0x1b')]);}_0x56ba2a[_0xfa81('0x38')]=qs[_0xfa81('0x39')](_0x465ddf['query'][_0xfa81('0x39')]);_0x56ba2a[_0xfa81('0x3a')]=qs['filters'](_[_0xfa81('0x3b')](_0x465ddf[_0xfa81('0x30')],_0x5d72c9[_0xfa81('0x32')]),_0x21b67f);if(_0x465ddf[_0xfa81('0x30')][_0xfa81('0x3c')]){_0x56ba2a[_0xfa81('0x3a')]=_['merge'](_0x56ba2a['where'],{'$or':_[_0xfa81('0x2f')](_0x21b67f,function(_0x1e4fc0){if(_0x1e4fc0[_0xfa81('0x3d')]!=='VIRTUAL'){var _0x4433e1={};_0x4433e1[_0x1e4fc0[_0xfa81('0x28')]]={'$like':'%'+_0x465ddf[_0xfa81('0x30')][_0xfa81('0x3c')]+'%'};return _0x4433e1;}})});}_0x56ba2a=_[_0xfa81('0x3e')]({},_0x56ba2a,_0x465ddf[_0xfa81('0x3f')]);var _0x156453={'where':_0x56ba2a[_0xfa81('0x3a')]};return db[_0xfa81('0x40')][_0xfa81('0x1a')](_0x156453)['then'](function(_0x3b2261){_0x520ed4[_0xfa81('0x1a')]=_0x3b2261;if(_0x465ddf[_0xfa81('0x30')]['includeAll']){_0x56ba2a['include']=[{'all':!![]}];}return db[_0xfa81('0x40')][_0xfa81('0x41')](_0x56ba2a);})[_0xfa81('0x23')](function(_0x710e1e){_0x520ed4[_0xfa81('0x42')]=_0x710e1e;return _0x520ed4;})['then'](respondWithFilteredResult(_0x2d4acf,_0x56ba2a))[_0xfa81('0x43')](handleError(_0x2d4acf,null));};exports['show']=function(_0x4b7c15,_0x2475fc){var _0x1953d9={'raw':![],'where':{'id':_0x4b7c15[_0xfa81('0x44')]['id']}},_0x3030d4={};_0x3030d4['model']=_['keys'](db[_0xfa81('0x40')][_0xfa81('0x2b')]);_0x3030d4[_0xfa81('0x30')]=_[_0xfa81('0x31')](_0x4b7c15[_0xfa81('0x30')]);_0x3030d4['filters']=_['intersection'](_0x3030d4[_0xfa81('0x2e')],_0x3030d4['query']);_0x1953d9[_0xfa81('0x33')]=_[_0xfa81('0x45')](_0x3030d4['model'],qs[_0xfa81('0x34')](_0x4b7c15[_0xfa81('0x30')]['fields']));_0x1953d9[_0xfa81('0x33')]=_0x1953d9[_0xfa81('0x33')][_0xfa81('0x35')]?_0x1953d9['attributes']:_0x3030d4[_0xfa81('0x2e')];if(_0x4b7c15['query'][_0xfa81('0x46')]){_0x1953d9[_0xfa81('0x47')]=[{'all':!![]}];}_0x1953d9=_[_0xfa81('0x3e')]({},_0x1953d9,_0x4b7c15[_0xfa81('0x3f')]);return db[_0xfa81('0x40')][_0xfa81('0x48')](_0x1953d9)[_0xfa81('0x23')](handleEntityNotFound(_0x2475fc,null))['then'](respondWithResult(_0x2475fc,null))[_0xfa81('0x43')](handleError(_0x2475fc,null));};exports[_0xfa81('0x49')]=function(_0x4d3a92,_0x4e17f5){return db[_0xfa81('0x40')][_0xfa81('0x49')](_0x4d3a92['body'],{})[_0xfa81('0x23')](function(_0x4e5db1){var _0x85dbeb=_0x4d3a92['user'][_0xfa81('0x24')]({'plain':!![]});if(!_0x85dbeb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x85dbeb['role']===_0xfa81('0x4a')){var _0x434810=_0x4e5db1[_0xfa81('0x24')]({'plain':!![]});var _0x235679=_0xfa81('0x25');return db[_0xfa81('0x4b')][_0xfa81('0x48')]({'where':{'name':_0x235679,'userProfileId':_0x85dbeb['userProfileId']},'raw':!![]})[_0xfa81('0x23')](function(_0x41e501){if(_0x41e501&&_0x41e501[_0xfa81('0x4c')]===0x0){return db['UserProfileResource'][_0xfa81('0x49')]({'name':_0x434810[_0xfa81('0x28')],'resourceId':_0x434810['id'],'type':_0x41e501[_0xfa81('0x28')],'sectionId':_0x41e501['id']},{})[_0xfa81('0x23')](function(){return _0x4e5db1;});}else{return _0x4e5db1;}})[_0xfa81('0x43')](function(_0x69a233){logger[_0xfa81('0x4d')](_0xfa81('0x4e'),_0x69a233);throw _0x69a233;});}return _0x4e5db1;})[_0xfa81('0x23')](respondWithResult(_0x4e17f5,0xc9))[_0xfa81('0x43')](handleError(_0x4e17f5,null));};exports[_0xfa81('0x4f')]=function(_0x47415f,_0x3f94cb){var _0xf4d4d0={'where':{'id':_0x47415f[_0xfa81('0x44')]['id']}},_0x533476={};_0x533476[_0xfa81('0x2e')]=_['keys'](db[_0xfa81('0x40')][_0xfa81('0x2b')]);_0xf4d4d0[_0xfa81('0x33')]=_[_0xfa81('0x45')](_0x533476[_0xfa81('0x2e')],qs[_0xfa81('0x34')](_0x47415f[_0xfa81('0x30')][_0xfa81('0x34')]));_0xf4d4d0[_0xfa81('0x33')]=_0xf4d4d0['attributes'][_0xfa81('0x35')]?_0xf4d4d0[_0xfa81('0x33')]:_0x533476[_0xfa81('0x2e')];if(_0x47415f[_0xfa81('0x30')][_0xfa81('0x46')]){_0xf4d4d0[_0xfa81('0x47')]=[{'all':!![]}];}_0xf4d4d0=_[_0xfa81('0x3e')]({},_0xf4d4d0,_0x47415f[_0xfa81('0x3f')]);return db[_0xfa81('0x40')]['find'](_0xf4d4d0)[_0xfa81('0x23')](handleEntityNotFound(_0x3f94cb,null))[_0xfa81('0x23')](function(_0x351c32){if(_0x351c32){var _0x19fbde=_0x351c32['get']({'plain':!![]});_0x19fbde=qs['omit'](_0x19fbde,['id',_0xfa81('0x50'),'updatedAt']);_0x47415f['body']=_['omit'](_0x47415f[_0xfa81('0x51')],['id',_0xfa81('0x50'),_0xfa81('0x52')]);return db[_0xfa81('0x40')]['create'](_['merge'](_0x19fbde,_0x47415f['body']),{'include':_0x47415f[_0xfa81('0x30')][_0xfa81('0x46')]?[{'all':!![]}]:undefined})[_0xfa81('0x23')](function(_0x697e3c){var _0x2b27d4=_0x47415f[_0xfa81('0x4a')][_0xfa81('0x24')]({'plain':!![]});if(!_0x2b27d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b27d4[_0xfa81('0x53')]===_0xfa81('0x4a')){var _0x5e19e6=_0x697e3c['get']({'plain':!![]});var _0x173164=_0xfa81('0x25');return db[_0xfa81('0x4b')][_0xfa81('0x48')]({'where':{'name':_0x173164,'userProfileId':_0x2b27d4['userProfileId']},'raw':!![]})[_0xfa81('0x23')](function(_0x149b3a){if(_0x149b3a&&_0x149b3a[_0xfa81('0x4c')]===0x0){return db[_0xfa81('0x54')][_0xfa81('0x49')]({'name':_0x5e19e6['name'],'resourceId':_0x5e19e6['id'],'type':_0x149b3a[_0xfa81('0x28')],'sectionId':_0x149b3a['id']},{})['then'](function(){return _0x697e3c;});}else{return _0x697e3c;}})['catch'](function(_0x3dca58){logger[_0xfa81('0x4d')](_0xfa81('0x4e'),_0x3dca58);throw _0x3dca58;});}return _0x697e3c;});}})[_0xfa81('0x23')](respondWithResult(_0x3f94cb,0xc9))[_0xfa81('0x43')](handleError(_0x3f94cb,null));};exports['update']=function(_0x1b2c4e,_0xc68c63){if(_0x1b2c4e[_0xfa81('0x51')]['id']){delete _0x1b2c4e[_0xfa81('0x51')]['id'];}return db[_0xfa81('0x40')][_0xfa81('0x48')]({'where':{'id':_0x1b2c4e[_0xfa81('0x44')]['id']}})['then'](handleEntityNotFound(_0xc68c63,null))['then'](saveUpdates(_0x1b2c4e[_0xfa81('0x51')],null))[_0xfa81('0x23')](respondWithResult(_0xc68c63,null))[_0xfa81('0x43')](handleError(_0xc68c63,null));};exports['destroy']=function(_0x506bb3,_0xebbac8){return db[_0xfa81('0x40')][_0xfa81('0x48')]({'where':{'id':_0x506bb3[_0xfa81('0x44')]['id']}})['then'](handleEntityNotFound(_0xebbac8,null))[_0xfa81('0x23')](removeEntity(_0xebbac8,null))[_0xfa81('0x43')](handleError(_0xebbac8,null));};exports['getHoppers']=function(_0x4149b2,_0x2c71e7,_0x5b226f){var _0x21d8e9={'raw':!![],'where':{}};var _0x382cd8={};var _0x37c27b={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x4149b2[_0xfa81('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c71e7,null))['then'](function(_0x729a48){if(_0x729a48){_0x382cd8[_0xfa81('0x2e')]=_[_0xfa81('0x31')](db['CmHopper'][_0xfa81('0x2b')]);_0x382cd8[_0xfa81('0x30')]=_['keys'](_0x4149b2[_0xfa81('0x30')]);_0x382cd8[_0xfa81('0x32')]=_[_0xfa81('0x45')](_0x382cd8[_0xfa81('0x2e')],_0x382cd8[_0xfa81('0x30')]);_0x21d8e9['attributes']=_['intersection'](_0x382cd8['model'],qs[_0xfa81('0x34')](_0x4149b2['query'][_0xfa81('0x34')]));_0x21d8e9[_0xfa81('0x33')]=_0x21d8e9['attributes']['length']?_0x21d8e9[_0xfa81('0x33')]:_0x382cd8['model'];if(!_0x4149b2[_0xfa81('0x30')][_0xfa81('0x36')](_0xfa81('0x37'))){_0x21d8e9[_0xfa81('0x1c')]=qs[_0xfa81('0x1c')](_0x4149b2[_0xfa81('0x30')][_0xfa81('0x1c')]);_0x21d8e9[_0xfa81('0x1b')]=qs[_0xfa81('0x1b')](_0x4149b2['query'][_0xfa81('0x1b')]);}_0x21d8e9[_0xfa81('0x38')]=qs[_0xfa81('0x39')](_0x4149b2[_0xfa81('0x30')][_0xfa81('0x39')]);_0x21d8e9[_0xfa81('0x3a')]=qs[_0xfa81('0x32')](_['pick'](_0x4149b2[_0xfa81('0x30')],_0x382cd8[_0xfa81('0x32')]));_0x21d8e9[_0xfa81('0x3a')][_0xfa81('0x55')]=_0x729a48['id'];if(_0x4149b2[_0xfa81('0x30')][_0xfa81('0x3c')]){_0x21d8e9['where']=_[_0xfa81('0x3e')](_0x21d8e9['where'],{'$or':_[_0xfa81('0x2f')](_0x21d8e9[_0xfa81('0x33')],function(_0x597735){var _0x2f51bc={};_0x2f51bc[_0x597735]={'$like':'%'+_0x4149b2[_0xfa81('0x30')][_0xfa81('0x3c')]+'%'};return _0x2f51bc;})});}_0x21d8e9=_[_0xfa81('0x3e')]({},_0x21d8e9,_0x4149b2[_0xfa81('0x3f')]);return db[_0xfa81('0x56')][_0xfa81('0x1a')]({'where':_0x21d8e9[_0xfa81('0x3a')]})[_0xfa81('0x23')](function(_0x1cca1c){_0x37c27b[_0xfa81('0x1a')]=_0x1cca1c;if(_0x4149b2[_0xfa81('0x30')][_0xfa81('0x46')]){_0x21d8e9[_0xfa81('0x47')]=[{'all':!![]}];}return db[_0xfa81('0x56')][_0xfa81('0x41')](_0x21d8e9);})['then'](function(_0x4c907d){_0x37c27b[_0xfa81('0x42')]=_0x4c907d;return _0x37c27b;});}})[_0xfa81('0x23')](respondWithFilteredResult(_0x2c71e7,_0x21d8e9))[_0xfa81('0x43')](handleError(_0x2c71e7,null));};exports['getHopperHistories']=function(_0x4a22e3,_0x781f34,_0xcf320d){var _0x5b7f78={'raw':!![],'where':{}};var _0x287fe2={};var _0x3e0b21={'count':0x0,'rows':[]};return db['Campaign'][_0xfa81('0x57')]({'where':{'id':_0x4a22e3[_0xfa81('0x44')]['id']}})[_0xfa81('0x23')](handleEntityNotFound(_0x781f34,null))[_0xfa81('0x23')](function(_0x54f909){if(_0x54f909){_0x287fe2[_0xfa81('0x2e')]=_[_0xfa81('0x31')](db['CmHopperHistory']['rawAttributes']);_0x287fe2[_0xfa81('0x30')]=_[_0xfa81('0x31')](_0x4a22e3['query']);_0x287fe2['filters']=_['intersection'](_0x287fe2[_0xfa81('0x2e')],_0x287fe2[_0xfa81('0x30')]);_0x5b7f78['attributes']=_[_0xfa81('0x45')](_0x287fe2[_0xfa81('0x2e')],qs[_0xfa81('0x34')](_0x4a22e3[_0xfa81('0x30')][_0xfa81('0x34')]));_0x5b7f78[_0xfa81('0x33')]=_0x5b7f78[_0xfa81('0x33')][_0xfa81('0x35')]?_0x5b7f78[_0xfa81('0x33')]:_0x287fe2[_0xfa81('0x2e')];if(!_0x4a22e3[_0xfa81('0x30')]['hasOwnProperty'](_0xfa81('0x37'))){_0x5b7f78[_0xfa81('0x1c')]=qs[_0xfa81('0x1c')](_0x4a22e3[_0xfa81('0x30')]['limit']);_0x5b7f78[_0xfa81('0x1b')]=qs[_0xfa81('0x1b')](_0x4a22e3[_0xfa81('0x30')][_0xfa81('0x1b')]);}_0x5b7f78[_0xfa81('0x38')]=qs[_0xfa81('0x39')](_0x4a22e3[_0xfa81('0x30')]['sort']);_0x5b7f78['where']=qs[_0xfa81('0x32')](_['pick'](_0x4a22e3[_0xfa81('0x30')],_0x287fe2[_0xfa81('0x32')]));_0x5b7f78[_0xfa81('0x3a')][_0xfa81('0x55')]=_0x54f909['id'];if(_0x4a22e3[_0xfa81('0x30')][_0xfa81('0x3c')]){_0x5b7f78[_0xfa81('0x3a')]=_[_0xfa81('0x3e')](_0x5b7f78['where'],{'$or':_[_0xfa81('0x2f')](_0x5b7f78[_0xfa81('0x33')],function(_0x258a73){var _0x4e519b={};_0x4e519b[_0x258a73]={'$like':'%'+_0x4a22e3[_0xfa81('0x30')][_0xfa81('0x3c')]+'%'};return _0x4e519b;})});}_0x5b7f78=_[_0xfa81('0x3e')]({},_0x5b7f78,_0x4a22e3['options']);return db[_0xfa81('0x58')][_0xfa81('0x1a')]({'where':_0x5b7f78['where']})['then'](function(_0x404d75){_0x3e0b21['count']=_0x404d75;if(_0x4a22e3[_0xfa81('0x30')][_0xfa81('0x46')]){_0x5b7f78['include']=[{'all':!![]}];}return db[_0xfa81('0x58')][_0xfa81('0x41')](_0x5b7f78);})[_0xfa81('0x23')](function(_0x177989){_0x3e0b21[_0xfa81('0x42')]=_0x177989;return _0x3e0b21;});}})[_0xfa81('0x23')](respondWithFilteredResult(_0x781f34,_0x5b7f78))[_0xfa81('0x43')](handleError(_0x781f34,null));};exports[_0xfa81('0x59')]=function(_0x4ed747,_0x2ef75d,_0x26ebcd){var _0x4a4bda={'raw':!![],'where':{}};var _0x355e46={};var _0x361470={'count':0x0,'rows':[]};return db[_0xfa81('0x40')][_0xfa81('0x57')]({'where':{'id':_0x4ed747[_0xfa81('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ef75d,null))[_0xfa81('0x23')](function(_0x23881a){if(_0x23881a){_0x355e46[_0xfa81('0x2e')]=_[_0xfa81('0x31')](db[_0xfa81('0x5a')][_0xfa81('0x2b')]);_0x355e46['query']=_[_0xfa81('0x31')](_0x4ed747['query']);_0x355e46[_0xfa81('0x32')]=_['intersection'](_0x355e46[_0xfa81('0x2e')],_0x355e46['query']);_0x4a4bda['attributes']=_['intersection'](_0x355e46[_0xfa81('0x2e')],qs[_0xfa81('0x34')](_0x4ed747[_0xfa81('0x30')][_0xfa81('0x34')]));_0x4a4bda[_0xfa81('0x33')]=_0x4a4bda[_0xfa81('0x33')]['length']?_0x4a4bda['attributes']:_0x355e46[_0xfa81('0x2e')];if(!_0x4ed747[_0xfa81('0x30')][_0xfa81('0x36')](_0xfa81('0x37'))){_0x4a4bda[_0xfa81('0x1c')]=qs[_0xfa81('0x1c')](_0x4ed747[_0xfa81('0x30')]['limit']);_0x4a4bda[_0xfa81('0x1b')]=qs[_0xfa81('0x1b')](_0x4ed747[_0xfa81('0x30')][_0xfa81('0x1b')]);}_0x4a4bda[_0xfa81('0x38')]=qs[_0xfa81('0x39')](_0x4ed747[_0xfa81('0x30')][_0xfa81('0x39')]);_0x4a4bda[_0xfa81('0x3a')]=qs[_0xfa81('0x32')](_[_0xfa81('0x3b')](_0x4ed747[_0xfa81('0x30')],_0x355e46[_0xfa81('0x32')]));_0x4a4bda['where'][_0xfa81('0x55')]=_0x23881a['id'];if(_0x4ed747[_0xfa81('0x30')]['filter']){_0x4a4bda[_0xfa81('0x3a')]=_[_0xfa81('0x3e')](_0x4a4bda[_0xfa81('0x3a')],{'$or':_[_0xfa81('0x2f')](_0x4a4bda[_0xfa81('0x33')],function(_0x464c73){var _0x49b972={};_0x49b972[_0x464c73]={'$like':'%'+_0x4ed747['query']['filter']+'%'};return _0x49b972;})});}_0x4a4bda=_[_0xfa81('0x3e')]({},_0x4a4bda,_0x4ed747[_0xfa81('0x3f')]);return db[_0xfa81('0x5a')][_0xfa81('0x1a')]({'where':_0x4a4bda[_0xfa81('0x3a')]})[_0xfa81('0x23')](function(_0x4896c3){_0x361470[_0xfa81('0x1a')]=_0x4896c3;if(_0x4ed747['query'][_0xfa81('0x46')]){_0x4a4bda[_0xfa81('0x47')]=[{'all':!![]}];}return db[_0xfa81('0x5a')][_0xfa81('0x41')](_0x4a4bda);})[_0xfa81('0x23')](function(_0xdd5fc){_0x361470[_0xfa81('0x42')]=_0xdd5fc;return _0x361470;});}})['then'](respondWithFilteredResult(_0x2ef75d,_0x4a4bda))[_0xfa81('0x43')](handleError(_0x2ef75d,null));};exports[_0xfa81('0x5b')]=function(_0x2c03a8,_0x1c4755,_0x18b911){var _0x40c046={'raw':!![],'where':{}};var _0x27001e={};var _0x1a124a={'count':0x0,'rows':[]};return db[_0xfa81('0x40')][_0xfa81('0x57')]({'where':{'id':_0x2c03a8['params']['id']}})[_0xfa81('0x23')](handleEntityNotFound(_0x1c4755,null))[_0xfa81('0x23')](function(_0x316f69){if(_0x316f69){_0x27001e['model']=_[_0xfa81('0x31')](db['CmHopperBlack'][_0xfa81('0x2b')]);_0x27001e[_0xfa81('0x30')]=_[_0xfa81('0x31')](_0x2c03a8[_0xfa81('0x30')]);_0x27001e[_0xfa81('0x32')]=_[_0xfa81('0x45')](_0x27001e[_0xfa81('0x2e')],_0x27001e[_0xfa81('0x30')]);_0x40c046[_0xfa81('0x33')]=_[_0xfa81('0x45')](_0x27001e[_0xfa81('0x2e')],qs[_0xfa81('0x34')](_0x2c03a8['query'][_0xfa81('0x34')]));_0x40c046[_0xfa81('0x33')]=_0x40c046[_0xfa81('0x33')][_0xfa81('0x35')]?_0x40c046[_0xfa81('0x33')]:_0x27001e['model'];if(!_0x2c03a8[_0xfa81('0x30')]['hasOwnProperty']('nolimit')){_0x40c046[_0xfa81('0x1c')]=qs[_0xfa81('0x1c')](_0x2c03a8[_0xfa81('0x30')]['limit']);_0x40c046['offset']=qs[_0xfa81('0x1b')](_0x2c03a8[_0xfa81('0x30')]['offset']);}_0x40c046[_0xfa81('0x38')]=qs[_0xfa81('0x39')](_0x2c03a8[_0xfa81('0x30')][_0xfa81('0x39')]);_0x40c046[_0xfa81('0x3a')]=qs['filters'](_[_0xfa81('0x3b')](_0x2c03a8[_0xfa81('0x30')],_0x27001e['filters']));_0x40c046[_0xfa81('0x3a')][_0xfa81('0x55')]=_0x316f69['id'];if(_0x2c03a8[_0xfa81('0x30')]['filter']){_0x40c046[_0xfa81('0x3a')]=_[_0xfa81('0x3e')](_0x40c046[_0xfa81('0x3a')],{'$or':_['map'](_0x40c046[_0xfa81('0x33')],function(_0x1a4888){var _0xb235eb={};_0xb235eb[_0x1a4888]={'$like':'%'+_0x2c03a8[_0xfa81('0x30')][_0xfa81('0x3c')]+'%'};return _0xb235eb;})});}_0x40c046=_[_0xfa81('0x3e')]({},_0x40c046,_0x2c03a8[_0xfa81('0x3f')]);return db[_0xfa81('0x5c')]['count']({'where':_0x40c046[_0xfa81('0x3a')]})['then'](function(_0x56ae00){_0x1a124a[_0xfa81('0x1a')]=_0x56ae00;if(_0x2c03a8['query'][_0xfa81('0x46')]){_0x40c046['include']=[{'all':!![]}];}return db[_0xfa81('0x5c')]['findAll'](_0x40c046);})[_0xfa81('0x23')](function(_0x41a77c){_0x1a124a[_0xfa81('0x42')]=_0x41a77c;return _0x1a124a;});}})[_0xfa81('0x23')](respondWithFilteredResult(_0x1c4755,_0x40c046))[_0xfa81('0x43')](handleError(_0x1c4755,null));};exports[_0xfa81('0x5d')]=function(_0xfaff4c,_0x361837,_0x17f5fd){var _0x29b430={};var _0x4b058f={};var _0x588bf2;var _0x34a9a0;return db[_0xfa81('0x40')][_0xfa81('0x57')]({'where':{'id':_0xfaff4c[_0xfa81('0x44')]['id']}})[_0xfa81('0x23')](handleEntityNotFound(_0x361837,null))[_0xfa81('0x23')](function(_0x14558c){if(_0x14558c){_0x588bf2=_0x14558c;_0x4b058f['model']=_[_0xfa81('0x31')](db[_0xfa81('0x5e')][_0xfa81('0x2b')]);_0x4b058f['query']=_[_0xfa81('0x31')](_0xfaff4c[_0xfa81('0x30')]);_0x4b058f['filters']=_['intersection'](_0x4b058f[_0xfa81('0x2e')],_0x4b058f[_0xfa81('0x30')]);_0x29b430[_0xfa81('0x33')]=_[_0xfa81('0x45')](_0x4b058f[_0xfa81('0x2e')],qs[_0xfa81('0x34')](_0xfaff4c[_0xfa81('0x30')][_0xfa81('0x34')]));_0x29b430[_0xfa81('0x33')]=_0x29b430[_0xfa81('0x33')][_0xfa81('0x35')]?_0x29b430[_0xfa81('0x33')]:_0x4b058f['model'];_0x29b430[_0xfa81('0x38')]=qs['sort'](_0xfaff4c[_0xfa81('0x30')][_0xfa81('0x39')]);_0x29b430[_0xfa81('0x3a')]=qs['filters'](_['pick'](_0xfaff4c[_0xfa81('0x30')],_0x4b058f[_0xfa81('0x32')]));if(_0xfaff4c[_0xfa81('0x30')]['filter']){_0x29b430[_0xfa81('0x3a')]=_[_0xfa81('0x3e')](_0x29b430[_0xfa81('0x3a')],{'$or':_[_0xfa81('0x2f')](_0x29b430[_0xfa81('0x33')],function(_0x1a41d6){var _0x5869c9={};_0x5869c9[_0x1a41d6]={'$like':'%'+_0xfaff4c[_0xfa81('0x30')]['filter']+'%'};return _0x5869c9;})});}_0x29b430=_[_0xfa81('0x3e')]({},_0x29b430,_0xfaff4c[_0xfa81('0x3f')]);return _0x588bf2['getLists'](_0x29b430);}})[_0xfa81('0x23')](function(_0x4fb909){if(_0x4fb909){_0x34a9a0=_0x4fb909['length'];if(!_0xfaff4c[_0xfa81('0x30')][_0xfa81('0x36')]('nolimit')){_0x29b430[_0xfa81('0x1c')]=qs[_0xfa81('0x1c')](_0xfaff4c[_0xfa81('0x30')][_0xfa81('0x1c')]);_0x29b430['offset']=qs['offset'](_0xfaff4c[_0xfa81('0x30')][_0xfa81('0x1b')]);}return _0x588bf2['getLists'](_0x29b430);}})[_0xfa81('0x23')](function(_0xedf479){if(_0xedf479){return _0xedf479?{'count':_0x34a9a0,'rows':_0xedf479}:null;}})[_0xfa81('0x23')](respondWithResult(_0x361837,null))[_0xfa81('0x43')](handleError(_0x361837,null));};exports[_0xfa81('0x5f')]=function(_0x442214,_0x26e1a6,_0x2004ba){var _0x127b77,_0x11b32f;return db['Campaign'][_0xfa81('0x48')]({'where':{'id':_0x442214[_0xfa81('0x44')]['id']}})[_0xfa81('0x23')](handleEntityNotFound(_0x26e1a6,null))[_0xfa81('0x23')](function(_0x4140fc){if(_0x4140fc){_0x11b32f=_0x4140fc;return _0x4140fc[_0xfa81('0x5f')](_0x442214[_0xfa81('0x51')][_0xfa81('0x60')],_[_0xfa81('0x61')](_0x442214['body'],['ids','id'])||{});}return null;})['spread'](function(_0x41814c){var _0x7a532d;_0x127b77=_0x41814c||[];var _0x30e005=[];if(_0x41814c){for(var _0xcab190=0x0;_0xcab190<_0x41814c[_0xfa81('0x35')];_0xcab190+=0x1){var _0x5d24d3=_0x41814c[_0xcab190]['get']({'plain':!![]});_0x11b32f[_0xfa81('0x62')]=_0x442214[_0xfa81('0x51')][_0xfa81('0x62')]?_0x442214[_0xfa81('0x51')][_0xfa81('0x62')]:_0x11b32f[_0xfa81('0x62')];switch(_0x11b32f[_0xfa81('0x62')]){case _0xfa81('0x63'):_0x7a532d=squel[_0xfa81('0x64')]()[_0xfa81('0x65')](_0xfa81('0x66'))[_0xfa81('0x67')]([_0xfa81('0x68'),_0xfa81('0x69'),_0xfa81('0x6a'),_0xfa81('0x6b'),'CampaignId',_0xfa81('0x50'),_0xfa81('0x52')],squel[_0xfa81('0x6c')]()['field'](_0xfa81('0x68'),_0xfa81('0x68'))[_0xfa81('0x6d')]('NOW()',_0xfa81('0x69'))[_0xfa81('0x6d')]('id','ContactId')['field'](_0x5d24d3[_0xfa81('0x6e')][_0xfa81('0x6f')](),_0xfa81('0x6b'))[_0xfa81('0x6d')](_0x442214[_0xfa81('0x44')]['id']['toString'](),_0xfa81('0x55'))[_0xfa81('0x6d')](_0xfa81('0x70'),'createdAt')[_0xfa81('0x6d')]('NOW()',_0xfa81('0x52'))['from'](_0xfa81('0x71'))[_0xfa81('0x3a')]('deletedAt\x20IS\x20NULL')[_0xfa81('0x3a')](_0xfa81('0x72'),_0x5d24d3[_0xfa81('0x6e')][_0xfa81('0x6f')]())[_0xfa81('0x3a')](_0xfa81('0x73'))[_0xfa81('0x3a')](_0xfa81('0x74'),squel[_0xfa81('0x6c')]()[_0xfa81('0x6d')](_0xfa81('0x75'))['from'](_0xfa81('0x76'))[_0xfa81('0x3a')](_0xfa81('0x77'),_0x442214[_0xfa81('0x44')]['id'][_0xfa81('0x6f')]()))[_0xfa81('0x3a')](_0xfa81('0x74'),squel['select']()[_0xfa81('0x6d')](_0xfa81('0x78'))[_0xfa81('0x79')](_0xfa81('0x66'))[_0xfa81('0x3a')]('CampaignId\x20=\x20?',_0x442214[_0xfa81('0x44')]['id'][_0xfa81('0x6f')]())))[_0xfa81('0x6f')]();break;case _0xfa81('0x7a'):_0x7a532d=squel['insert']()[_0xfa81('0x65')](_0xfa81('0x66'))['fromQuery']([_0xfa81('0x68'),_0xfa81('0x69'),_0xfa81('0x6a'),_0xfa81('0x6b'),'CampaignId',_0xfa81('0x50'),_0xfa81('0x52')],squel['select']()[_0xfa81('0x6d')](_0xfa81('0x68'),_0xfa81('0x68'))[_0xfa81('0x6d')](_0xfa81('0x70'),_0xfa81('0x69'))[_0xfa81('0x6d')]('id',_0xfa81('0x6a'))['field'](_0x5d24d3[_0xfa81('0x6e')][_0xfa81('0x6f')](),_0xfa81('0x6b'))[_0xfa81('0x6d')](_0x442214[_0xfa81('0x44')]['id']['toString'](),_0xfa81('0x55'))[_0xfa81('0x6d')]('NOW()',_0xfa81('0x50'))[_0xfa81('0x6d')]('NOW()','updatedAt')['from'](_0xfa81('0x71'))['where'](_0xfa81('0x7b'))[_0xfa81('0x3a')]('ListId\x20=\x20?',_0x5d24d3[_0xfa81('0x6e')][_0xfa81('0x6f')]())['where'](_0xfa81('0x73'))[_0xfa81('0x3a')](_0xfa81('0x74'),squel[_0xfa81('0x6c')]()[_0xfa81('0x6d')]('COALESCE(phone,\x27\x27)')[_0xfa81('0x79')]('cm_hopper')[_0xfa81('0x3a')](_0xfa81('0x77'),_0x442214[_0xfa81('0x44')]['id']['toString']())))[_0xfa81('0x6f')]();break;default:_0x7a532d=squel[_0xfa81('0x64')]()[_0xfa81('0x65')](_0xfa81('0x66'))[_0xfa81('0x67')]([_0xfa81('0x68'),_0xfa81('0x69'),_0xfa81('0x6a'),_0xfa81('0x6b'),_0xfa81('0x55'),'createdAt','updatedAt'],squel[_0xfa81('0x6c')]()[_0xfa81('0x6d')](_0xfa81('0x68'),_0xfa81('0x68'))[_0xfa81('0x6d')](_0xfa81('0x70'),_0xfa81('0x69'))[_0xfa81('0x6d')]('id',_0xfa81('0x6a'))['field'](_0x5d24d3[_0xfa81('0x6e')][_0xfa81('0x6f')](),_0xfa81('0x6b'))[_0xfa81('0x6d')](_0x442214[_0xfa81('0x44')]['id']['toString'](),'CampaignId')[_0xfa81('0x6d')](_0xfa81('0x70'),'createdAt')['field']('NOW()',_0xfa81('0x52'))[_0xfa81('0x79')]('cm_contacts')[_0xfa81('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0xfa81('0x72'),_0x5d24d3['CmListId']['toString']())[_0xfa81('0x3a')](_0xfa81('0x73')))[_0xfa81('0x6f')]();}_0x30e005[_0xfa81('0x7c')](db[_0xfa81('0x7d')]['query'](_0x7a532d));}return BPromise['all'](_0x30e005);}})[_0xfa81('0x23')](function(){return _0x127b77;})[_0xfa81('0x23')](respondWithResult(_0x26e1a6,null))['catch'](handleError(_0x26e1a6,null));};exports[_0xfa81('0x7e')]=function(_0x14bed1,_0x3e6db5,_0x2e1f50){return db['Campaign']['find']({'where':{'id':_0x14bed1[_0xfa81('0x44')]['id']}})[_0xfa81('0x23')](handleEntityNotFound(_0x3e6db5,null))[_0xfa81('0x23')](function(_0x1cc2e6){if(_0x1cc2e6){return _0x1cc2e6[_0xfa81('0x7e')](_0x14bed1[_0xfa81('0x30')][_0xfa81('0x60')]);}})[_0xfa81('0x23')](function(_0x22a3fb){if(_0x22a3fb){return db[_0xfa81('0x56')]['destroy']({'where':{'ListId':_0x14bed1[_0xfa81('0x30')][_0xfa81('0x60')],'CampaignId':_0x14bed1['params']['id']}})[_0xfa81('0x23')](function(){return _0x22a3fb;});}})[_0xfa81('0x23')](respondWithStatusCode(_0x3e6db5,null))[_0xfa81('0x43')](handleError(_0x3e6db5,null));};exports[_0xfa81('0x7f')]=function(_0x2512af,_0x5a72f3,_0x271ca9){var _0x1d35aa={'raw':!![],'where':{}};var _0x5c96a7={};var _0x1ff8af={'count':0x0,'rows':[]};return db[_0xfa81('0x40')][_0xfa81('0x57')]({'where':{'id':_0x2512af[_0xfa81('0x44')]['id']}})[_0xfa81('0x23')](handleEntityNotFound(_0x5a72f3,null))['then'](function(_0x384079){if(_0x384079){_0x5c96a7[_0xfa81('0x2e')]=_[_0xfa81('0x31')](db[_0xfa81('0x5e')][_0xfa81('0x2b')]);_0x5c96a7[_0xfa81('0x30')]=_[_0xfa81('0x31')](_0x2512af[_0xfa81('0x30')]);_0x5c96a7[_0xfa81('0x32')]=_[_0xfa81('0x45')](_0x5c96a7['model'],_0x5c96a7[_0xfa81('0x30')]);_0x1d35aa[_0xfa81('0x33')]=_[_0xfa81('0x45')](_0x5c96a7[_0xfa81('0x2e')],qs[_0xfa81('0x34')](_0x2512af[_0xfa81('0x30')][_0xfa81('0x34')]));_0x1d35aa[_0xfa81('0x33')]=_0x1d35aa[_0xfa81('0x33')][_0xfa81('0x35')]?_0x1d35aa[_0xfa81('0x33')]:_0x5c96a7[_0xfa81('0x2e')];if(!_0x2512af[_0xfa81('0x30')]['hasOwnProperty'](_0xfa81('0x37'))){_0x1d35aa[_0xfa81('0x1c')]=qs[_0xfa81('0x1c')](_0x2512af[_0xfa81('0x30')][_0xfa81('0x1c')]);_0x1d35aa[_0xfa81('0x1b')]=qs[_0xfa81('0x1b')](_0x2512af[_0xfa81('0x30')][_0xfa81('0x1b')]);}_0x1d35aa[_0xfa81('0x38')]=qs[_0xfa81('0x39')](_0x2512af['query'][_0xfa81('0x39')]);_0x1d35aa[_0xfa81('0x3a')]=qs[_0xfa81('0x32')](_['pick'](_0x2512af[_0xfa81('0x30')],_0x5c96a7['filters']));_0x1d35aa[_0xfa81('0x3a')][_0xfa81('0x55')]=_0x384079['id'];if(_0x2512af['query'][_0xfa81('0x3c')]){_0x1d35aa[_0xfa81('0x3a')]=_['merge'](_0x1d35aa[_0xfa81('0x3a')],{'$or':_[_0xfa81('0x2f')](_0x1d35aa[_0xfa81('0x33')],function(_0x1255b0){var _0x482e67={};_0x482e67[_0x1255b0]={'$like':'%'+_0x2512af['query'][_0xfa81('0x3c')]+'%'};return _0x482e67;})});}_0x1d35aa=_[_0xfa81('0x3e')]({},_0x1d35aa,_0x2512af[_0xfa81('0x3f')]);return db[_0xfa81('0x5e')][_0xfa81('0x1a')]({'where':_0x1d35aa[_0xfa81('0x3a')]})[_0xfa81('0x23')](function(_0x2705dc){_0x1ff8af[_0xfa81('0x1a')]=_0x2705dc;if(_0x2512af[_0xfa81('0x30')][_0xfa81('0x46')]){_0x1d35aa[_0xfa81('0x47')]=[{'all':!![]}];}return db[_0xfa81('0x5e')][_0xfa81('0x41')](_0x1d35aa);})['then'](function(_0x1b5ca7){_0x1ff8af['rows']=_0x1b5ca7;return _0x1ff8af;});}})[_0xfa81('0x23')](respondWithFilteredResult(_0x5a72f3,_0x1d35aa))[_0xfa81('0x43')](handleError(_0x5a72f3,null));};exports[_0xfa81('0x80')]=function(_0x598c55,_0x24fba8,_0xa3e930){var _0x8e2f56,_0x1c07bf;return db[_0xfa81('0x40')]['find']({'where':{'id':_0x598c55[_0xfa81('0x44')]['id']}})[_0xfa81('0x23')](handleEntityNotFound(_0x24fba8,null))[_0xfa81('0x23')](function(_0x1f454a){if(_0x1f454a){_0x1c07bf=_0x1f454a;return _0x1f454a[_0xfa81('0x80')](_0x598c55[_0xfa81('0x51')][_0xfa81('0x60')],_[_0xfa81('0x61')](_0x598c55[_0xfa81('0x51')],['ids','id'])||{});}return null;})[_0xfa81('0x81')](function(_0x55ade0){var _0x15ba11;_0x8e2f56=_0x55ade0||[];var _0xab3bdb=[];if(_0x55ade0){for(var _0x37110d=0x0;_0x37110d<_0x55ade0['length'];_0x37110d+=0x1){var _0x1d968d=_0x55ade0[_0x37110d]['get']({'plain':!![]});_0x15ba11=squel[_0xfa81('0x64')]()[_0xfa81('0x65')](_0xfa81('0x82'))[_0xfa81('0x67')]([_0xfa81('0x68'),'ContactId',_0xfa81('0x6b'),_0xfa81('0x55'),'createdAt',_0xfa81('0x52')],squel[_0xfa81('0x6c')]()[_0xfa81('0x6d')](_0xfa81('0x68'),_0xfa81('0x68'))['field']('id','ContactId')[_0xfa81('0x6d')](_0x1d968d[_0xfa81('0x6e')][_0xfa81('0x6f')](),_0xfa81('0x6b'))[_0xfa81('0x6d')](_0x598c55[_0xfa81('0x44')]['id'][_0xfa81('0x6f')](),'CampaignId')['field'](_0xfa81('0x70'),_0xfa81('0x50'))[_0xfa81('0x6d')](_0xfa81('0x70'),_0xfa81('0x52'))[_0xfa81('0x79')](_0xfa81('0x71'))[_0xfa81('0x3a')](_0xfa81('0x7b'))['where'](_0xfa81('0x72'),_0x1d968d['CmListId'][_0xfa81('0x6f')]())[_0xfa81('0x3a')](_0xfa81('0x73')))['toString']();_0xab3bdb[_0xfa81('0x7c')](db[_0xfa81('0x7d')][_0xfa81('0x30')](_0x15ba11));}return BPromise[_0xfa81('0x83')](_0xab3bdb);}})['then'](function(){return _0x8e2f56;})[_0xfa81('0x23')](respondWithResult(_0x24fba8,null))[_0xfa81('0x43')](handleError(_0x24fba8,null));};exports[_0xfa81('0x84')]=function(_0x5889ca,_0x24e6d2,_0x2ad055){return db[_0xfa81('0x40')][_0xfa81('0x48')]({'where':{'id':_0x5889ca[_0xfa81('0x44')]['id']}})[_0xfa81('0x23')](handleEntityNotFound(_0x24e6d2,null))['then'](function(_0x17f681){if(_0x17f681){return _0x17f681[_0xfa81('0x84')](_0x5889ca[_0xfa81('0x30')][_0xfa81('0x60')]);}})[_0xfa81('0x23')](function(_0x42d461){if(_0x42d461){return db[_0xfa81('0x5c')][_0xfa81('0x26')]({'where':{'ListId':_0x5889ca[_0xfa81('0x30')][_0xfa81('0x60')],'CampaignId':_0x5889ca[_0xfa81('0x44')]['id']}})[_0xfa81('0x23')](function(){return _0x42d461;});}})['then'](respondWithStatusCode(_0x24e6d2,null))[_0xfa81('0x43')](handleError(_0x24e6d2,null));}; \ No newline at end of file +var _0x2993=['zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','status','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','UserProfileResource','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','ContactId','updatedAt','select','field','phone','NOW()','ListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','scheduledAt','CmListId','ListId\x20=\x20?','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','html-pdf','eml-format','rimraf'];(function(_0x1e94ae,_0x2fe37a){var _0x261ef9=function(_0xc978a2){while(--_0xc978a2){_0x1e94ae['push'](_0x1e94ae['shift']());}};_0x261ef9(++_0x2fe37a);}(_0x2993,0x105));var _0x3299=function(_0x44e201,_0x2477f9){_0x44e201=_0x44e201-0x0;var _0xb720a9=_0x2993[_0x44e201];return _0xb720a9;};'use strict';var pdf=require(_0x3299('0x0'));var emlformat=require(_0x3299('0x1'));var rimraf=require(_0x3299('0x2'));var zipdir=require(_0x3299('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3299('0x4'));var BPromise=require(_0x3299('0x5'));var Mustache=require(_0x3299('0x6'));var util=require(_0x3299('0x7'));var path=require(_0x3299('0x8'));var sox=require(_0x3299('0x9'));var csv=require('to-csv');var ejs=require(_0x3299('0xa'));var fs=require('fs');var _=require(_0x3299('0xb'));var squel=require(_0x3299('0xc'));var crypto=require(_0x3299('0xd'));var jsforce=require(_0x3299('0xe'));var deskjs=require(_0x3299('0xf'));var toCsv=require(_0x3299('0x10'));var querystring=require(_0x3299('0x11'));var Papa=require('papaparse');var Redis=require(_0x3299('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3299('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3299('0x14'));var logger=require(_0x3299('0x15'))(_0x3299('0x16'));var utils=require(_0x3299('0x17'));var config=require(_0x3299('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x135259,_0x2f3389){_0x2f3389=_0x2f3389||0xcc;return function(_0x2656c5){if(_0x2656c5){return _0x135259[_0x3299('0x19')](_0x2f3389);}return _0x135259['status'](_0x2f3389)[_0x3299('0x1a')]();};}function respondWithResult(_0x456ccc,_0x3567ca){_0x3567ca=_0x3567ca||0xc8;return function(_0x2d1398){if(_0x2d1398){return _0x456ccc['status'](_0x3567ca)[_0x3299('0x1b')](_0x2d1398);}};}function respondWithFilteredResult(_0x5cc22b,_0x223f4c){return function(_0x27fcdc){if(_0x27fcdc){var _0x4c2fd6=_0x27fcdc[_0x3299('0x1c')],_0x5a2ccd=_0x223f4c['offset'],_0x1babb7=_0x223f4c[_0x3299('0x1d')]+_0x223f4c[_0x3299('0x1e')],_0x3b9bf6;if(_0x1babb7>=_0x4c2fd6){_0x1babb7=_0x4c2fd6;_0x3b9bf6=0xc8;}else{_0x3b9bf6=0xce;}_0x5cc22b['status'](_0x3b9bf6);return _0x5cc22b['set'](_0x3299('0x1f'),_0x5a2ccd+'-'+_0x1babb7+'/'+_0x4c2fd6)['json'](_0x27fcdc);}return null;};}function patchUpdates(_0x1ef5fb){return function(_0x48e9af){try{jsonpatch[_0x3299('0x20')](_0x48e9af,_0x1ef5fb,!![]);}catch(_0x50fa65){return BPromise['reject'](_0x50fa65);}return _0x48e9af[_0x3299('0x21')]();};}function saveUpdates(_0x35403c,_0x58f022){return function(_0x588468){if(_0x588468){return _0x588468[_0x3299('0x22')](_0x35403c)[_0x3299('0x23')](function(_0x34bce2){return _0x34bce2;});}return null;};}function removeEntity(_0x2efbc4,_0x52678d){return function(_0x8fedb){if(_0x8fedb){return _0x8fedb[_0x3299('0x24')]()[_0x3299('0x23')](function(){var _0x59d8f2=_0x8fedb[_0x3299('0x25')]({'plain':!![]});var _0x3edb4a=_0x3299('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3edb4a,'resourceId':_0x59d8f2['id']}})[_0x3299('0x23')](function(){return _0x8fedb;});})[_0x3299('0x23')](function(){_0x2efbc4[_0x3299('0x27')](0xcc)[_0x3299('0x1a')]();});}};}function handleEntityNotFound(_0x666c08,_0x4ff0c5){return function(_0x5921f2){if(!_0x5921f2){_0x666c08[_0x3299('0x19')](0x194);}return _0x5921f2;};}function handleError(_0x217b0b,_0xd185bf){_0xd185bf=_0xd185bf||0x1f4;return function(_0x520fad){logger[_0x3299('0x28')](_0x520fad[_0x3299('0x29')]);if(_0x520fad[_0x3299('0x2a')]){delete _0x520fad[_0x3299('0x2a')];}_0x217b0b[_0x3299('0x27')](_0xd185bf)[_0x3299('0x2b')](_0x520fad);};}exports[_0x3299('0x2c')]=function(_0x57f10d,_0x5417c6){var _0x1cff82={},_0x48b676={},_0x3bfd26={'count':0x0,'rows':[]};var _0x103fd4=_[_0x3299('0x2d')](db[_0x3299('0x2e')][_0x3299('0x2f')],function(_0x4db70d){return{'name':_0x4db70d['fieldName'],'type':_0x4db70d[_0x3299('0x30')][_0x3299('0x31')]};});_0x48b676[_0x3299('0x32')]=_[_0x3299('0x2d')](_0x103fd4,_0x3299('0x2a'));_0x48b676[_0x3299('0x33')]=_[_0x3299('0x34')](_0x57f10d['query']);_0x48b676[_0x3299('0x35')]=_[_0x3299('0x36')](_0x48b676[_0x3299('0x32')],_0x48b676[_0x3299('0x33')]);_0x1cff82['attributes']=_[_0x3299('0x36')](_0x48b676[_0x3299('0x32')],qs[_0x3299('0x37')](_0x57f10d[_0x3299('0x33')][_0x3299('0x37')]));_0x1cff82[_0x3299('0x38')]=_0x1cff82[_0x3299('0x38')][_0x3299('0x39')]?_0x1cff82['attributes']:_0x48b676[_0x3299('0x32')];if(!_0x57f10d[_0x3299('0x33')]['hasOwnProperty'](_0x3299('0x3a'))){_0x1cff82[_0x3299('0x1e')]=qs[_0x3299('0x1e')](_0x57f10d['query'][_0x3299('0x1e')]);_0x1cff82[_0x3299('0x1d')]=qs[_0x3299('0x1d')](_0x57f10d['query'][_0x3299('0x1d')]);}_0x1cff82[_0x3299('0x3b')]=qs[_0x3299('0x3c')](_0x57f10d[_0x3299('0x33')]['sort']);_0x1cff82['where']=qs[_0x3299('0x35')](_[_0x3299('0x3d')](_0x57f10d[_0x3299('0x33')],_0x48b676[_0x3299('0x35')]),_0x103fd4);if(_0x57f10d[_0x3299('0x33')][_0x3299('0x3e')]){_0x1cff82['where']=_[_0x3299('0x3f')](_0x1cff82[_0x3299('0x40')],{'$or':_['map'](_0x103fd4,function(_0x5f5043){if(_0x5f5043[_0x3299('0x30')]!==_0x3299('0x41')){var _0x140cc0={};_0x140cc0[_0x5f5043['name']]={'$like':'%'+_0x57f10d[_0x3299('0x33')][_0x3299('0x3e')]+'%'};return _0x140cc0;}})});}_0x1cff82=_['merge']({},_0x1cff82,_0x57f10d[_0x3299('0x42')]);var _0x36321d={'where':_0x1cff82[_0x3299('0x40')]};return db[_0x3299('0x2e')][_0x3299('0x1c')](_0x36321d)[_0x3299('0x23')](function(_0x3973f4){_0x3bfd26['count']=_0x3973f4;if(_0x57f10d['query'][_0x3299('0x43')]){_0x1cff82[_0x3299('0x44')]=[{'all':!![]}];}return db[_0x3299('0x2e')][_0x3299('0x45')](_0x1cff82);})['then'](function(_0x3d1a57){_0x3bfd26[_0x3299('0x46')]=_0x3d1a57;return _0x3bfd26;})[_0x3299('0x23')](respondWithFilteredResult(_0x5417c6,_0x1cff82))[_0x3299('0x47')](handleError(_0x5417c6,null));};exports['show']=function(_0x6543f6,_0x5df99b){var _0x589b4a={'raw':![],'where':{'id':_0x6543f6[_0x3299('0x48')]['id']}},_0x423e2c={};_0x423e2c[_0x3299('0x32')]=_['keys'](db[_0x3299('0x2e')]['rawAttributes']);_0x423e2c[_0x3299('0x33')]=_[_0x3299('0x34')](_0x6543f6['query']);_0x423e2c[_0x3299('0x35')]=_[_0x3299('0x36')](_0x423e2c[_0x3299('0x32')],_0x423e2c[_0x3299('0x33')]);_0x589b4a[_0x3299('0x38')]=_['intersection'](_0x423e2c[_0x3299('0x32')],qs[_0x3299('0x37')](_0x6543f6[_0x3299('0x33')][_0x3299('0x37')]));_0x589b4a[_0x3299('0x38')]=_0x589b4a['attributes'][_0x3299('0x39')]?_0x589b4a[_0x3299('0x38')]:_0x423e2c[_0x3299('0x32')];if(_0x6543f6[_0x3299('0x33')]['includeAll']){_0x589b4a[_0x3299('0x44')]=[{'all':!![]}];}_0x589b4a=_[_0x3299('0x3f')]({},_0x589b4a,_0x6543f6[_0x3299('0x42')]);return db['Campaign'][_0x3299('0x49')](_0x589b4a)[_0x3299('0x23')](handleEntityNotFound(_0x5df99b,null))[_0x3299('0x23')](respondWithResult(_0x5df99b,null))['catch'](handleError(_0x5df99b,null));};exports[_0x3299('0x4a')]=function(_0x198c66,_0x34749d){return db[_0x3299('0x2e')][_0x3299('0x4a')](_0x198c66[_0x3299('0x4b')],{})[_0x3299('0x23')](function(_0x569cdd){var _0x30b51b=_0x198c66['user'][_0x3299('0x25')]({'plain':!![]});if(!_0x30b51b)throw new Error(_0x3299('0x4c'));if(_0x30b51b[_0x3299('0x4d')]===_0x3299('0x4e')){var _0x5a2e77=_0x569cdd['get']({'plain':!![]});var _0x5b7560='IvrCampaigns';return db[_0x3299('0x4f')][_0x3299('0x49')]({'where':{'name':_0x5b7560,'userProfileId':_0x30b51b['userProfileId']},'raw':!![]})[_0x3299('0x23')](function(_0x395826){if(_0x395826&&_0x395826[_0x3299('0x50')]===0x0){return db['UserProfileResource'][_0x3299('0x4a')]({'name':_0x5a2e77[_0x3299('0x2a')],'resourceId':_0x5a2e77['id'],'type':_0x395826[_0x3299('0x2a')],'sectionId':_0x395826['id']},{})['then'](function(){return _0x569cdd;});}else{return _0x569cdd;}})[_0x3299('0x47')](function(_0x28d0b9){logger['error'](_0x3299('0x51'),_0x28d0b9);throw _0x28d0b9;});}return _0x569cdd;})[_0x3299('0x23')](respondWithResult(_0x34749d,0xc9))[_0x3299('0x47')](handleError(_0x34749d,null));};exports['clone']=function(_0x53fc0c,_0x2ef654){var _0x7c4a00={'where':{'id':_0x53fc0c['params']['id']}},_0x4a806f={};_0x4a806f[_0x3299('0x32')]=_['keys'](db[_0x3299('0x2e')][_0x3299('0x2f')]);_0x7c4a00[_0x3299('0x38')]=_['intersection'](_0x4a806f[_0x3299('0x32')],qs[_0x3299('0x37')](_0x53fc0c[_0x3299('0x33')][_0x3299('0x37')]));_0x7c4a00[_0x3299('0x38')]=_0x7c4a00['attributes'][_0x3299('0x39')]?_0x7c4a00[_0x3299('0x38')]:_0x4a806f[_0x3299('0x32')];if(_0x53fc0c['query']['includeAll']){_0x7c4a00[_0x3299('0x44')]=[{'all':!![]}];}_0x7c4a00=_[_0x3299('0x3f')]({},_0x7c4a00,_0x53fc0c[_0x3299('0x42')]);return db[_0x3299('0x2e')]['find'](_0x7c4a00)[_0x3299('0x23')](handleEntityNotFound(_0x2ef654,null))[_0x3299('0x23')](function(_0x2d0381){if(_0x2d0381){var _0x46924=_0x2d0381[_0x3299('0x25')]({'plain':!![]});_0x46924=qs['omit'](_0x46924,['id','createdAt','updatedAt']);_0x53fc0c[_0x3299('0x4b')]=_[_0x3299('0x52')](_0x53fc0c[_0x3299('0x4b')],['id',_0x3299('0x53'),'updatedAt']);return db[_0x3299('0x2e')][_0x3299('0x4a')](_[_0x3299('0x3f')](_0x46924,_0x53fc0c['body']),{'include':_0x53fc0c[_0x3299('0x33')][_0x3299('0x43')]?[{'all':!![]}]:undefined})[_0x3299('0x23')](function(_0x206da3){var _0x2beef5=_0x53fc0c[_0x3299('0x4e')]['get']({'plain':!![]});if(!_0x2beef5)throw new Error(_0x3299('0x4c'));if(_0x2beef5[_0x3299('0x4d')]===_0x3299('0x4e')){var _0x33dc46=_0x206da3[_0x3299('0x25')]({'plain':!![]});var _0x5644f8=_0x3299('0x26');return db[_0x3299('0x4f')]['find']({'where':{'name':_0x5644f8,'userProfileId':_0x2beef5['userProfileId']},'raw':!![]})['then'](function(_0x4366d9){if(_0x4366d9&&_0x4366d9[_0x3299('0x50')]===0x0){return db[_0x3299('0x54')][_0x3299('0x4a')]({'name':_0x33dc46['name'],'resourceId':_0x33dc46['id'],'type':_0x4366d9[_0x3299('0x2a')],'sectionId':_0x4366d9['id']},{})['then'](function(){return _0x206da3;});}else{return _0x206da3;}})[_0x3299('0x47')](function(_0x29937d){logger[_0x3299('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29937d);throw _0x29937d;});}return _0x206da3;});}})[_0x3299('0x23')](respondWithResult(_0x2ef654,0xc9))[_0x3299('0x47')](handleError(_0x2ef654,null));};exports['update']=function(_0x18b743,_0x3fc849){if(_0x18b743[_0x3299('0x4b')]['id']){delete _0x18b743[_0x3299('0x4b')]['id'];}return db[_0x3299('0x2e')][_0x3299('0x49')]({'where':{'id':_0x18b743[_0x3299('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fc849,null))['then'](saveUpdates(_0x18b743[_0x3299('0x4b')],null))[_0x3299('0x23')](respondWithResult(_0x3fc849,null))['catch'](handleError(_0x3fc849,null));};exports[_0x3299('0x24')]=function(_0x34553a,_0x57e03a){return db[_0x3299('0x2e')][_0x3299('0x49')]({'where':{'id':_0x34553a[_0x3299('0x48')]['id']}})[_0x3299('0x23')](handleEntityNotFound(_0x57e03a,null))[_0x3299('0x23')](removeEntity(_0x57e03a,null))[_0x3299('0x47')](handleError(_0x57e03a,null));};exports['getHoppers']=function(_0x24d493,_0x5de441,_0x421e3b){var _0x108eda={'raw':!![],'where':{}};var _0x3d1319={};var _0x1aaeb9={'count':0x0,'rows':[]};return db[_0x3299('0x2e')][_0x3299('0x55')]({'where':{'id':_0x24d493[_0x3299('0x48')]['id']}})[_0x3299('0x23')](handleEntityNotFound(_0x5de441,null))[_0x3299('0x23')](function(_0x221064){if(_0x221064){_0x3d1319[_0x3299('0x32')]=_['keys'](db[_0x3299('0x56')][_0x3299('0x2f')]);_0x3d1319[_0x3299('0x33')]=_['keys'](_0x24d493[_0x3299('0x33')]);_0x3d1319[_0x3299('0x35')]=_[_0x3299('0x36')](_0x3d1319[_0x3299('0x32')],_0x3d1319[_0x3299('0x33')]);_0x108eda['attributes']=_[_0x3299('0x36')](_0x3d1319[_0x3299('0x32')],qs[_0x3299('0x37')](_0x24d493[_0x3299('0x33')]['fields']));_0x108eda[_0x3299('0x38')]=_0x108eda[_0x3299('0x38')]['length']?_0x108eda['attributes']:_0x3d1319[_0x3299('0x32')];if(!_0x24d493[_0x3299('0x33')][_0x3299('0x57')]('nolimit')){_0x108eda['limit']=qs[_0x3299('0x1e')](_0x24d493['query'][_0x3299('0x1e')]);_0x108eda[_0x3299('0x1d')]=qs['offset'](_0x24d493[_0x3299('0x33')][_0x3299('0x1d')]);}_0x108eda[_0x3299('0x3b')]=qs[_0x3299('0x3c')](_0x24d493[_0x3299('0x33')][_0x3299('0x3c')]);_0x108eda[_0x3299('0x40')]=qs['filters'](_[_0x3299('0x3d')](_0x24d493[_0x3299('0x33')],_0x3d1319[_0x3299('0x35')]));_0x108eda[_0x3299('0x40')][_0x3299('0x58')]=_0x221064['id'];if(_0x24d493[_0x3299('0x33')][_0x3299('0x3e')]){_0x108eda[_0x3299('0x40')]=_['merge'](_0x108eda[_0x3299('0x40')],{'$or':_[_0x3299('0x2d')](_0x108eda['attributes'],function(_0xc52f06){var _0x43fe38={};_0x43fe38[_0xc52f06]={'$like':'%'+_0x24d493[_0x3299('0x33')][_0x3299('0x3e')]+'%'};return _0x43fe38;})});}_0x108eda=_[_0x3299('0x3f')]({},_0x108eda,_0x24d493[_0x3299('0x42')]);return db[_0x3299('0x56')][_0x3299('0x1c')]({'where':_0x108eda[_0x3299('0x40')]})[_0x3299('0x23')](function(_0xabd010){_0x1aaeb9[_0x3299('0x1c')]=_0xabd010;if(_0x24d493['query'][_0x3299('0x43')]){_0x108eda[_0x3299('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0x3299('0x45')](_0x108eda);})[_0x3299('0x23')](function(_0x2b7dbf){_0x1aaeb9[_0x3299('0x46')]=_0x2b7dbf;return _0x1aaeb9;});}})['then'](respondWithFilteredResult(_0x5de441,_0x108eda))['catch'](handleError(_0x5de441,null));};exports[_0x3299('0x59')]=function(_0x3744ee,_0x3ee781,_0x5986ed){var _0x14610c={'raw':!![],'where':{}};var _0x14594c={};var _0x281f38={'count':0x0,'rows':[]};return db[_0x3299('0x2e')][_0x3299('0x55')]({'where':{'id':_0x3744ee[_0x3299('0x48')]['id']}})[_0x3299('0x23')](handleEntityNotFound(_0x3ee781,null))[_0x3299('0x23')](function(_0x1f66fe){if(_0x1f66fe){_0x14594c[_0x3299('0x32')]=_[_0x3299('0x34')](db[_0x3299('0x5a')][_0x3299('0x2f')]);_0x14594c[_0x3299('0x33')]=_[_0x3299('0x34')](_0x3744ee[_0x3299('0x33')]);_0x14594c[_0x3299('0x35')]=_[_0x3299('0x36')](_0x14594c['model'],_0x14594c['query']);_0x14610c[_0x3299('0x38')]=_['intersection'](_0x14594c[_0x3299('0x32')],qs[_0x3299('0x37')](_0x3744ee['query'][_0x3299('0x37')]));_0x14610c[_0x3299('0x38')]=_0x14610c['attributes'][_0x3299('0x39')]?_0x14610c[_0x3299('0x38')]:_0x14594c[_0x3299('0x32')];if(!_0x3744ee[_0x3299('0x33')]['hasOwnProperty'](_0x3299('0x3a'))){_0x14610c[_0x3299('0x1e')]=qs['limit'](_0x3744ee[_0x3299('0x33')][_0x3299('0x1e')]);_0x14610c['offset']=qs[_0x3299('0x1d')](_0x3744ee['query'][_0x3299('0x1d')]);}_0x14610c[_0x3299('0x3b')]=qs[_0x3299('0x3c')](_0x3744ee[_0x3299('0x33')][_0x3299('0x3c')]);_0x14610c['where']=qs[_0x3299('0x35')](_[_0x3299('0x3d')](_0x3744ee[_0x3299('0x33')],_0x14594c[_0x3299('0x35')]));_0x14610c['where'][_0x3299('0x58')]=_0x1f66fe['id'];if(_0x3744ee['query'][_0x3299('0x3e')]){_0x14610c[_0x3299('0x40')]=_[_0x3299('0x3f')](_0x14610c[_0x3299('0x40')],{'$or':_['map'](_0x14610c[_0x3299('0x38')],function(_0x159053){var _0xc464f3={};_0xc464f3[_0x159053]={'$like':'%'+_0x3744ee[_0x3299('0x33')][_0x3299('0x3e')]+'%'};return _0xc464f3;})});}_0x14610c=_[_0x3299('0x3f')]({},_0x14610c,_0x3744ee['options']);return db[_0x3299('0x5a')]['count']({'where':_0x14610c[_0x3299('0x40')]})[_0x3299('0x23')](function(_0x52a6b9){_0x281f38[_0x3299('0x1c')]=_0x52a6b9;if(_0x3744ee[_0x3299('0x33')][_0x3299('0x43')]){_0x14610c[_0x3299('0x44')]=[{'all':!![]}];}return db[_0x3299('0x5a')][_0x3299('0x45')](_0x14610c);})['then'](function(_0x7ecf85){_0x281f38['rows']=_0x7ecf85;return _0x281f38;});}})[_0x3299('0x23')](respondWithFilteredResult(_0x3ee781,_0x14610c))['catch'](handleError(_0x3ee781,null));};exports[_0x3299('0x5b')]=function(_0x165444,_0x5b4d61,_0x16c3f5){var _0x54a1f2={'raw':!![],'where':{}};var _0x25af3a={};var _0x2f85ae={'count':0x0,'rows':[]};return db[_0x3299('0x2e')][_0x3299('0x55')]({'where':{'id':_0x165444['params']['id']}})[_0x3299('0x23')](handleEntityNotFound(_0x5b4d61,null))[_0x3299('0x23')](function(_0x136702){if(_0x136702){_0x25af3a[_0x3299('0x32')]=_['keys'](db[_0x3299('0x5c')][_0x3299('0x2f')]);_0x25af3a['query']=_['keys'](_0x165444['query']);_0x25af3a[_0x3299('0x35')]=_[_0x3299('0x36')](_0x25af3a['model'],_0x25af3a['query']);_0x54a1f2[_0x3299('0x38')]=_[_0x3299('0x36')](_0x25af3a['model'],qs['fields'](_0x165444[_0x3299('0x33')][_0x3299('0x37')]));_0x54a1f2[_0x3299('0x38')]=_0x54a1f2[_0x3299('0x38')]['length']?_0x54a1f2[_0x3299('0x38')]:_0x25af3a['model'];if(!_0x165444['query']['hasOwnProperty'](_0x3299('0x3a'))){_0x54a1f2[_0x3299('0x1e')]=qs[_0x3299('0x1e')](_0x165444[_0x3299('0x33')][_0x3299('0x1e')]);_0x54a1f2[_0x3299('0x1d')]=qs[_0x3299('0x1d')](_0x165444[_0x3299('0x33')][_0x3299('0x1d')]);}_0x54a1f2[_0x3299('0x3b')]=qs[_0x3299('0x3c')](_0x165444[_0x3299('0x33')][_0x3299('0x3c')]);_0x54a1f2[_0x3299('0x40')]=qs[_0x3299('0x35')](_['pick'](_0x165444['query'],_0x25af3a[_0x3299('0x35')]));_0x54a1f2[_0x3299('0x40')]['CampaignId']=_0x136702['id'];if(_0x165444['query'][_0x3299('0x3e')]){_0x54a1f2[_0x3299('0x40')]=_[_0x3299('0x3f')](_0x54a1f2['where'],{'$or':_['map'](_0x54a1f2[_0x3299('0x38')],function(_0x7615c9){var _0x1c5ec0={};_0x1c5ec0[_0x7615c9]={'$like':'%'+_0x165444[_0x3299('0x33')][_0x3299('0x3e')]+'%'};return _0x1c5ec0;})});}_0x54a1f2=_['merge']({},_0x54a1f2,_0x165444[_0x3299('0x42')]);return db[_0x3299('0x5c')][_0x3299('0x1c')]({'where':_0x54a1f2['where']})['then'](function(_0x30725b){_0x2f85ae[_0x3299('0x1c')]=_0x30725b;if(_0x165444['query'][_0x3299('0x43')]){_0x54a1f2[_0x3299('0x44')]=[{'all':!![]}];}return db[_0x3299('0x5c')]['findAll'](_0x54a1f2);})[_0x3299('0x23')](function(_0x499dc7){_0x2f85ae[_0x3299('0x46')]=_0x499dc7;return _0x2f85ae;});}})[_0x3299('0x23')](respondWithFilteredResult(_0x5b4d61,_0x54a1f2))[_0x3299('0x47')](handleError(_0x5b4d61,null));};exports['getHopperBlacks']=function(_0x4b9c3b,_0x2ea5dd,_0x116678){var _0x551081={'raw':!![],'where':{}};var _0x45ca49={};var _0xafaa4b={'count':0x0,'rows':[]};return db[_0x3299('0x2e')][_0x3299('0x55')]({'where':{'id':_0x4b9c3b['params']['id']}})['then'](handleEntityNotFound(_0x2ea5dd,null))[_0x3299('0x23')](function(_0x528fc0){if(_0x528fc0){_0x45ca49[_0x3299('0x32')]=_[_0x3299('0x34')](db[_0x3299('0x5d')][_0x3299('0x2f')]);_0x45ca49['query']=_[_0x3299('0x34')](_0x4b9c3b[_0x3299('0x33')]);_0x45ca49['filters']=_['intersection'](_0x45ca49['model'],_0x45ca49[_0x3299('0x33')]);_0x551081[_0x3299('0x38')]=_['intersection'](_0x45ca49['model'],qs[_0x3299('0x37')](_0x4b9c3b[_0x3299('0x33')][_0x3299('0x37')]));_0x551081[_0x3299('0x38')]=_0x551081['attributes']['length']?_0x551081[_0x3299('0x38')]:_0x45ca49[_0x3299('0x32')];if(!_0x4b9c3b[_0x3299('0x33')]['hasOwnProperty'](_0x3299('0x3a'))){_0x551081[_0x3299('0x1e')]=qs[_0x3299('0x1e')](_0x4b9c3b[_0x3299('0x33')][_0x3299('0x1e')]);_0x551081[_0x3299('0x1d')]=qs[_0x3299('0x1d')](_0x4b9c3b[_0x3299('0x33')][_0x3299('0x1d')]);}_0x551081[_0x3299('0x3b')]=qs['sort'](_0x4b9c3b[_0x3299('0x33')][_0x3299('0x3c')]);_0x551081[_0x3299('0x40')]=qs['filters'](_[_0x3299('0x3d')](_0x4b9c3b['query'],_0x45ca49[_0x3299('0x35')]));_0x551081[_0x3299('0x40')][_0x3299('0x58')]=_0x528fc0['id'];if(_0x4b9c3b[_0x3299('0x33')][_0x3299('0x3e')]){_0x551081[_0x3299('0x40')]=_[_0x3299('0x3f')](_0x551081[_0x3299('0x40')],{'$or':_[_0x3299('0x2d')](_0x551081[_0x3299('0x38')],function(_0x36a431){var _0x242fae={};_0x242fae[_0x36a431]={'$like':'%'+_0x4b9c3b['query'][_0x3299('0x3e')]+'%'};return _0x242fae;})});}_0x551081=_[_0x3299('0x3f')]({},_0x551081,_0x4b9c3b[_0x3299('0x42')]);return db[_0x3299('0x5d')][_0x3299('0x1c')]({'where':_0x551081[_0x3299('0x40')]})['then'](function(_0x3ef52f){_0xafaa4b[_0x3299('0x1c')]=_0x3ef52f;if(_0x4b9c3b[_0x3299('0x33')][_0x3299('0x43')]){_0x551081[_0x3299('0x44')]=[{'all':!![]}];}return db[_0x3299('0x5d')][_0x3299('0x45')](_0x551081);})[_0x3299('0x23')](function(_0x1c0d21){_0xafaa4b[_0x3299('0x46')]=_0x1c0d21;return _0xafaa4b;});}})['then'](respondWithFilteredResult(_0x2ea5dd,_0x551081))['catch'](handleError(_0x2ea5dd,null));};exports['getLists']=function(_0x3c5d41,_0xed21b,_0x29775e){var _0x51d4ea={};var _0x2a9a32={};var _0x5aefd7;var _0x31f096;return db['Campaign'][_0x3299('0x55')]({'where':{'id':_0x3c5d41[_0x3299('0x48')]['id']}})['then'](handleEntityNotFound(_0xed21b,null))[_0x3299('0x23')](function(_0x449d27){if(_0x449d27){_0x5aefd7=_0x449d27;_0x2a9a32['model']=_[_0x3299('0x34')](db[_0x3299('0x5e')][_0x3299('0x2f')]);_0x2a9a32['query']=_[_0x3299('0x34')](_0x3c5d41[_0x3299('0x33')]);_0x2a9a32[_0x3299('0x35')]=_['intersection'](_0x2a9a32[_0x3299('0x32')],_0x2a9a32['query']);_0x51d4ea[_0x3299('0x38')]=_[_0x3299('0x36')](_0x2a9a32[_0x3299('0x32')],qs[_0x3299('0x37')](_0x3c5d41[_0x3299('0x33')][_0x3299('0x37')]));_0x51d4ea['attributes']=_0x51d4ea['attributes'][_0x3299('0x39')]?_0x51d4ea[_0x3299('0x38')]:_0x2a9a32[_0x3299('0x32')];_0x51d4ea[_0x3299('0x3b')]=qs[_0x3299('0x3c')](_0x3c5d41[_0x3299('0x33')][_0x3299('0x3c')]);_0x51d4ea[_0x3299('0x40')]=qs['filters'](_[_0x3299('0x3d')](_0x3c5d41[_0x3299('0x33')],_0x2a9a32['filters']));if(_0x3c5d41['query'][_0x3299('0x3e')]){_0x51d4ea[_0x3299('0x40')]=_[_0x3299('0x3f')](_0x51d4ea[_0x3299('0x40')],{'$or':_[_0x3299('0x2d')](_0x51d4ea[_0x3299('0x38')],function(_0x11b9d8){var _0x2254d5={};_0x2254d5[_0x11b9d8]={'$like':'%'+_0x3c5d41[_0x3299('0x33')]['filter']+'%'};return _0x2254d5;})});}_0x51d4ea=_['merge']({},_0x51d4ea,_0x3c5d41[_0x3299('0x42')]);return _0x5aefd7[_0x3299('0x5f')](_0x51d4ea);}})['then'](function(_0x599fe2){if(_0x599fe2){_0x31f096=_0x599fe2[_0x3299('0x39')];if(!_0x3c5d41[_0x3299('0x33')]['hasOwnProperty'](_0x3299('0x3a'))){_0x51d4ea[_0x3299('0x1e')]=qs[_0x3299('0x1e')](_0x3c5d41[_0x3299('0x33')][_0x3299('0x1e')]);_0x51d4ea[_0x3299('0x1d')]=qs[_0x3299('0x1d')](_0x3c5d41[_0x3299('0x33')][_0x3299('0x1d')]);}return _0x5aefd7[_0x3299('0x5f')](_0x51d4ea);}})[_0x3299('0x23')](function(_0x12b2b1){if(_0x12b2b1){return _0x12b2b1?{'count':_0x31f096,'rows':_0x12b2b1}:null;}})['then'](respondWithResult(_0xed21b,null))[_0x3299('0x47')](handleError(_0xed21b,null));};exports[_0x3299('0x60')]=function(_0x40c2ce,_0x16ac30,_0x3d666b){var _0x162702,_0x12518e;return db[_0x3299('0x2e')][_0x3299('0x49')]({'where':{'id':_0x40c2ce[_0x3299('0x48')]['id']}})[_0x3299('0x23')](handleEntityNotFound(_0x16ac30,null))[_0x3299('0x23')](function(_0xdc103c){if(_0xdc103c){_0x12518e=_0xdc103c;return _0xdc103c[_0x3299('0x60')](_0x40c2ce[_0x3299('0x4b')][_0x3299('0x61')],_[_0x3299('0x52')](_0x40c2ce[_0x3299('0x4b')],['ids','id'])||{});}return null;})[_0x3299('0x62')](function(_0x291200){var _0x11cf69;_0x162702=_0x291200||[];var _0x128c93=[];if(_0x291200){for(var _0x2acbb7=0x0;_0x2acbb7<_0x291200[_0x3299('0x39')];_0x2acbb7+=0x1){var _0x2535a9=_0x291200[_0x2acbb7]['get']({'plain':!![]});_0x12518e[_0x3299('0x63')]=_0x40c2ce[_0x3299('0x4b')][_0x3299('0x63')]?_0x40c2ce[_0x3299('0x4b')][_0x3299('0x63')]:_0x12518e[_0x3299('0x63')];switch(_0x12518e['dialCheckDuplicateType']){case _0x3299('0x64'):_0x11cf69=squel[_0x3299('0x65')]()[_0x3299('0x66')]('cm_hopper')[_0x3299('0x67')](['phone','scheduledAt',_0x3299('0x68'),'ListId',_0x3299('0x58'),_0x3299('0x53'),_0x3299('0x69')],squel[_0x3299('0x6a')]()[_0x3299('0x6b')](_0x3299('0x6c'),'phone')[_0x3299('0x6b')](_0x3299('0x6d'),'scheduledAt')[_0x3299('0x6b')]('id',_0x3299('0x68'))[_0x3299('0x6b')](_0x2535a9['CmListId']['toString'](),_0x3299('0x6e'))[_0x3299('0x6b')](_0x40c2ce[_0x3299('0x48')]['id'][_0x3299('0x6f')](),_0x3299('0x58'))['field'](_0x3299('0x6d'),_0x3299('0x53'))[_0x3299('0x6b')](_0x3299('0x6d'),'updatedAt')[_0x3299('0x70')](_0x3299('0x71'))[_0x3299('0x40')](_0x3299('0x72'))[_0x3299('0x40')]('ListId\x20=\x20?',_0x2535a9['CmListId'][_0x3299('0x6f')]())['where'](_0x3299('0x73'))[_0x3299('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3299('0x6a')]()[_0x3299('0x6b')]('COALESCE(calleridnum,\x27\x27)')[_0x3299('0x70')]('cm_hopper_final')['where'](_0x3299('0x74'),_0x40c2ce[_0x3299('0x48')]['id'][_0x3299('0x6f')]()))[_0x3299('0x40')](_0x3299('0x75'),squel['select']()[_0x3299('0x6b')](_0x3299('0x76'))['from'](_0x3299('0x77'))[_0x3299('0x40')]('CampaignId\x20=\x20?',_0x40c2ce[_0x3299('0x48')]['id']['toString']())))['toString']();break;case _0x3299('0x78'):_0x11cf69=squel[_0x3299('0x65')]()[_0x3299('0x66')](_0x3299('0x77'))[_0x3299('0x67')]([_0x3299('0x6c'),_0x3299('0x79'),_0x3299('0x68'),'ListId',_0x3299('0x58'),'createdAt',_0x3299('0x69')],squel['select']()[_0x3299('0x6b')]('phone',_0x3299('0x6c'))[_0x3299('0x6b')](_0x3299('0x6d'),_0x3299('0x79'))[_0x3299('0x6b')]('id',_0x3299('0x68'))[_0x3299('0x6b')](_0x2535a9[_0x3299('0x7a')]['toString'](),'ListId')[_0x3299('0x6b')](_0x40c2ce[_0x3299('0x48')]['id']['toString'](),_0x3299('0x58'))[_0x3299('0x6b')](_0x3299('0x6d'),'createdAt')[_0x3299('0x6b')]('NOW()','updatedAt')[_0x3299('0x70')](_0x3299('0x71'))[_0x3299('0x40')](_0x3299('0x72'))[_0x3299('0x40')](_0x3299('0x7b'),_0x2535a9['CmListId'][_0x3299('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0x3299('0x75'),squel[_0x3299('0x6a')]()[_0x3299('0x6b')]('COALESCE(phone,\x27\x27)')[_0x3299('0x70')]('cm_hopper')[_0x3299('0x40')](_0x3299('0x74'),_0x40c2ce[_0x3299('0x48')]['id'][_0x3299('0x6f')]())))[_0x3299('0x6f')]();break;default:_0x11cf69=squel['insert']()['into'](_0x3299('0x77'))[_0x3299('0x67')](['phone',_0x3299('0x79'),_0x3299('0x68'),'ListId',_0x3299('0x58'),_0x3299('0x53'),_0x3299('0x69')],squel[_0x3299('0x6a')]()[_0x3299('0x6b')](_0x3299('0x6c'),_0x3299('0x6c'))[_0x3299('0x6b')](_0x3299('0x6d'),_0x3299('0x79'))[_0x3299('0x6b')]('id',_0x3299('0x68'))[_0x3299('0x6b')](_0x2535a9[_0x3299('0x7a')][_0x3299('0x6f')](),_0x3299('0x6e'))[_0x3299('0x6b')](_0x40c2ce['params']['id'][_0x3299('0x6f')](),_0x3299('0x58'))[_0x3299('0x6b')](_0x3299('0x6d'),_0x3299('0x53'))[_0x3299('0x6b')](_0x3299('0x6d'),_0x3299('0x69'))[_0x3299('0x70')]('cm_contacts')['where'](_0x3299('0x72'))['where']('ListId\x20=\x20?',_0x2535a9[_0x3299('0x7a')][_0x3299('0x6f')]())[_0x3299('0x40')](_0x3299('0x73')))[_0x3299('0x6f')]();}_0x128c93[_0x3299('0x7c')](db['sequelize'][_0x3299('0x33')](_0x11cf69));}return BPromise[_0x3299('0x7d')](_0x128c93);}})[_0x3299('0x23')](function(){return _0x162702;})[_0x3299('0x23')](respondWithResult(_0x16ac30,null))[_0x3299('0x47')](handleError(_0x16ac30,null));};exports[_0x3299('0x7e')]=function(_0x237dbe,_0xfa16f0,_0x555473){return db[_0x3299('0x2e')][_0x3299('0x49')]({'where':{'id':_0x237dbe[_0x3299('0x48')]['id']}})[_0x3299('0x23')](handleEntityNotFound(_0xfa16f0,null))[_0x3299('0x23')](function(_0x376c28){if(_0x376c28){return _0x376c28[_0x3299('0x7e')](_0x237dbe[_0x3299('0x33')][_0x3299('0x61')]);}})[_0x3299('0x23')](function(_0x3fcda1){if(_0x3fcda1){return db['CmHopper'][_0x3299('0x24')]({'where':{'ListId':_0x237dbe[_0x3299('0x33')][_0x3299('0x61')],'CampaignId':_0x237dbe[_0x3299('0x48')]['id']}})['then'](function(){return _0x3fcda1;});}})[_0x3299('0x23')](respondWithStatusCode(_0xfa16f0,null))[_0x3299('0x47')](handleError(_0xfa16f0,null));};exports[_0x3299('0x7f')]=function(_0x44db3c,_0x501dc1,_0x1c4367){var _0x2bed3c={'raw':!![],'where':{}};var _0x38d1f5={};var _0x351427={'count':0x0,'rows':[]};return db['Campaign'][_0x3299('0x55')]({'where':{'id':_0x44db3c[_0x3299('0x48')]['id']}})['then'](handleEntityNotFound(_0x501dc1,null))[_0x3299('0x23')](function(_0x37a0aa){if(_0x37a0aa){_0x38d1f5['model']=_[_0x3299('0x34')](db[_0x3299('0x5e')][_0x3299('0x2f')]);_0x38d1f5['query']=_['keys'](_0x44db3c[_0x3299('0x33')]);_0x38d1f5[_0x3299('0x35')]=_[_0x3299('0x36')](_0x38d1f5[_0x3299('0x32')],_0x38d1f5[_0x3299('0x33')]);_0x2bed3c[_0x3299('0x38')]=_[_0x3299('0x36')](_0x38d1f5[_0x3299('0x32')],qs['fields'](_0x44db3c['query'][_0x3299('0x37')]));_0x2bed3c[_0x3299('0x38')]=_0x2bed3c['attributes']['length']?_0x2bed3c[_0x3299('0x38')]:_0x38d1f5[_0x3299('0x32')];if(!_0x44db3c[_0x3299('0x33')][_0x3299('0x57')]('nolimit')){_0x2bed3c[_0x3299('0x1e')]=qs[_0x3299('0x1e')](_0x44db3c['query']['limit']);_0x2bed3c['offset']=qs[_0x3299('0x1d')](_0x44db3c[_0x3299('0x33')][_0x3299('0x1d')]);}_0x2bed3c[_0x3299('0x3b')]=qs[_0x3299('0x3c')](_0x44db3c[_0x3299('0x33')][_0x3299('0x3c')]);_0x2bed3c[_0x3299('0x40')]=qs[_0x3299('0x35')](_[_0x3299('0x3d')](_0x44db3c[_0x3299('0x33')],_0x38d1f5[_0x3299('0x35')]));_0x2bed3c[_0x3299('0x40')][_0x3299('0x58')]=_0x37a0aa['id'];if(_0x44db3c[_0x3299('0x33')][_0x3299('0x3e')]){_0x2bed3c[_0x3299('0x40')]=_[_0x3299('0x3f')](_0x2bed3c[_0x3299('0x40')],{'$or':_[_0x3299('0x2d')](_0x2bed3c[_0x3299('0x38')],function(_0x4ee151){var _0x454fcc={};_0x454fcc[_0x4ee151]={'$like':'%'+_0x44db3c[_0x3299('0x33')][_0x3299('0x3e')]+'%'};return _0x454fcc;})});}_0x2bed3c=_[_0x3299('0x3f')]({},_0x2bed3c,_0x44db3c[_0x3299('0x42')]);return db[_0x3299('0x5e')][_0x3299('0x1c')]({'where':_0x2bed3c[_0x3299('0x40')]})[_0x3299('0x23')](function(_0x3599b4){_0x351427['count']=_0x3599b4;if(_0x44db3c[_0x3299('0x33')][_0x3299('0x43')]){_0x2bed3c[_0x3299('0x44')]=[{'all':!![]}];}return db[_0x3299('0x5e')]['findAll'](_0x2bed3c);})[_0x3299('0x23')](function(_0x4362e0){_0x351427[_0x3299('0x46')]=_0x4362e0;return _0x351427;});}})[_0x3299('0x23')](respondWithFilteredResult(_0x501dc1,_0x2bed3c))[_0x3299('0x47')](handleError(_0x501dc1,null));};exports[_0x3299('0x80')]=function(_0x2a6db3,_0x3cc2a3,_0x2ac7c5){var _0x4caeed,_0x478f3e;return db[_0x3299('0x2e')][_0x3299('0x49')]({'where':{'id':_0x2a6db3[_0x3299('0x48')]['id']}})['then'](handleEntityNotFound(_0x3cc2a3,null))[_0x3299('0x23')](function(_0x2079a3){if(_0x2079a3){_0x478f3e=_0x2079a3;return _0x2079a3['addBlackLists'](_0x2a6db3[_0x3299('0x4b')][_0x3299('0x61')],_[_0x3299('0x52')](_0x2a6db3[_0x3299('0x4b')],['ids','id'])||{});}return null;})[_0x3299('0x62')](function(_0x53ce15){var _0x1a8894;_0x4caeed=_0x53ce15||[];var _0xe8ff03=[];if(_0x53ce15){for(var _0x332fe5=0x0;_0x332fe5<_0x53ce15['length'];_0x332fe5+=0x1){var _0x2179cf=_0x53ce15[_0x332fe5][_0x3299('0x25')]({'plain':!![]});_0x1a8894=squel[_0x3299('0x65')]()[_0x3299('0x66')](_0x3299('0x81'))[_0x3299('0x67')]([_0x3299('0x6c'),_0x3299('0x68'),_0x3299('0x6e'),_0x3299('0x58'),_0x3299('0x53'),'updatedAt'],squel[_0x3299('0x6a')]()[_0x3299('0x6b')]('phone',_0x3299('0x6c'))[_0x3299('0x6b')]('id',_0x3299('0x68'))[_0x3299('0x6b')](_0x2179cf['CmListId'][_0x3299('0x6f')](),_0x3299('0x6e'))[_0x3299('0x6b')](_0x2a6db3[_0x3299('0x48')]['id'][_0x3299('0x6f')](),'CampaignId')[_0x3299('0x6b')](_0x3299('0x6d'),'createdAt')['field']('NOW()',_0x3299('0x69'))[_0x3299('0x70')]('cm_contacts')[_0x3299('0x40')]('deletedAt\x20IS\x20NULL')[_0x3299('0x40')](_0x3299('0x7b'),_0x2179cf['CmListId']['toString']())[_0x3299('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0x3299('0x6f')]();_0xe8ff03[_0x3299('0x7c')](db[_0x3299('0x82')][_0x3299('0x33')](_0x1a8894));}return BPromise[_0x3299('0x7d')](_0xe8ff03);}})[_0x3299('0x23')](function(){return _0x4caeed;})['then'](respondWithResult(_0x3cc2a3,null))['catch'](handleError(_0x3cc2a3,null));};exports[_0x3299('0x83')]=function(_0x222559,_0x42e352,_0x4a9378){return db[_0x3299('0x2e')][_0x3299('0x49')]({'where':{'id':_0x222559[_0x3299('0x48')]['id']}})[_0x3299('0x23')](handleEntityNotFound(_0x42e352,null))['then'](function(_0x3e8736){if(_0x3e8736){return _0x3e8736[_0x3299('0x83')](_0x222559[_0x3299('0x33')]['ids']);}})['then'](function(_0x202be6){if(_0x202be6){return db[_0x3299('0x5d')][_0x3299('0x24')]({'where':{'ListId':_0x222559[_0x3299('0x33')][_0x3299('0x61')],'CampaignId':_0x222559[_0x3299('0x48')]['id']}})[_0x3299('0x23')](function(){return _0x202be6;});}})[_0x3299('0x23')](respondWithStatusCode(_0x42e352,null))[_0x3299('0x47')](handleError(_0x42e352,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 501aea0..f29a9e1 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 _0xf19f=['moment','bluebird','request-promise','path','rimraf','./campaign.attributes','exports','Campaign','campaigns','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf19f,0x95));var _0xff19=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xf19f[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xff19('0x0'))('api');var moment=require(_0xff19('0x1'));var BPromise=require(_0xff19('0x2'));var rp=require(_0xff19('0x3'));var fs=require('fs');var path=require(_0xff19('0x4'));var rimraf=require(_0xff19('0x5'));var config=require('../../config/environment');var attributes=require(_0xff19('0x6'));module[_0xff19('0x7')]=function(_0x5f58ac,_0x5c9d0a){return _0x5f58ac['define'](_0xff19('0x8'),attributes,{'tableName':_0xff19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ae9=['path','rimraf','../../config/environment','exports','define','Campaign','campaigns','util','api','moment','bluebird','request-promise'];(function(_0xf52a44,_0x71229a){var _0x552834=function(_0x299d35){while(--_0x299d35){_0xf52a44['push'](_0xf52a44['shift']());}};_0x552834(++_0x71229a);}(_0x9ae9,0x17b));var _0x99ae=function(_0x4e3517,_0x351f7f){_0x4e3517=_0x4e3517-0x0;var _0x209144=_0x9ae9[_0x4e3517];return _0x209144;};'use strict';var _=require('lodash');var util=require(_0x99ae('0x0'));var logger=require('../../config/logger')(_0x99ae('0x1'));var moment=require(_0x99ae('0x2'));var BPromise=require(_0x99ae('0x3'));var rp=require(_0x99ae('0x4'));var fs=require('fs');var path=require(_0x99ae('0x5'));var rimraf=require(_0x99ae('0x6'));var config=require(_0x99ae('0x7'));var attributes=require('./campaign.attributes');module[_0x99ae('0x8')]=function(_0xfb4dca,_0xe13b25){return _0xfb4dca[_0x99ae('0x9')](_0x99ae('0xa'),attributes,{'tableName':_0x99ae('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 6b6c6fd..80b0287 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4e82bb,_0x258f06){var _0x4f37de=function(_0x51e7a4){while(--_0x51e7a4){_0x4e82bb['push'](_0x4e82bb['shift']());}};_0x4f37de(++_0x258f06);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x182da5,_0x4a9f94){var _0x21e50e=function(_0x4c7cd3){while(--_0x4c7cd3){_0x182da5['push'](_0x182da5['shift']());}};_0x21e50e(++_0x4a9f94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a297da4..3e64141 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 _0x09e0=['getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/interaction/service','./campaign.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x09e0,0x1ab));var _0x009e=function(_0x27714d,_0x457b53){_0x27714d=_0x27714d-0x0;var _0x18e2fb=_0x09e0[_0x27714d];return _0x18e2fb;};'use strict';var multer=require(_0x009e('0x0'));var util=require(_0x009e('0x1'));var path=require(_0x009e('0x2'));var timeout=require('connect-timeout');var express=require(_0x009e('0x3'));var router=express[_0x009e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x009e('0x5'));var config=require('../../config/environment');var controller=require(_0x009e('0x6'));router[_0x009e('0x7')]('/',auth['isAuthenticated'](),controller[_0x009e('0x8')]);router[_0x009e('0x7')](_0x009e('0x9'),auth['isAuthenticated'](),controller[_0x009e('0xa')]);router['get'](_0x009e('0xb'),auth[_0x009e('0xc')](),controller[_0x009e('0xd')]);router['get'](_0x009e('0xe'),auth[_0x009e('0xc')](),controller[_0x009e('0xf')]);router[_0x009e('0x7')]('/:id/hopper_finals',auth[_0x009e('0xc')](),controller[_0x009e('0x10')]);router['get'](_0x009e('0x11'),auth[_0x009e('0xc')](),controller['getHopperBlacks']);router[_0x009e('0x7')](_0x009e('0x12'),auth[_0x009e('0xc')](),controller[_0x009e('0x13')]);router[_0x009e('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x009e('0x14')]);router[_0x009e('0x15')]('/',auth['isAuthenticated'](),controller[_0x009e('0x16')]);router['post'](_0x009e('0x17'),auth['isAuthenticated'](),controller[_0x009e('0x18')]);router[_0x009e('0x15')](_0x009e('0x12'),auth['isAuthenticated'](),controller[_0x009e('0x19')]);router[_0x009e('0x15')](_0x009e('0x1a'),auth['isAuthenticated'](),controller[_0x009e('0x1b')]);router[_0x009e('0x1c')](_0x009e('0x9'),auth[_0x009e('0xc')](),controller['update']);router[_0x009e('0x1d')]('/:id',auth[_0x009e('0xc')](),controller[_0x009e('0x1e')]);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0x009e('0x1f')]);router[_0x009e('0x1d')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x009e('0x20')]);module[_0x009e('0x21')]=router; \ No newline at end of file +var _0xae3d=['create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','post'];(function(_0x851e3a,_0xa4fb3b){var _0x39993d=function(_0x17d055){while(--_0x17d055){_0x851e3a['push'](_0x851e3a['shift']());}};_0x39993d(++_0xa4fb3b);}(_0xae3d,0x148));var _0xdae3=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xae3d[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require(_0xdae3('0x0'));var path=require(_0xdae3('0x1'));var timeout=require(_0xdae3('0x2'));var express=require('express');var router=express[_0xdae3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xdae3('0x4'));var config=require(_0xdae3('0x5'));var controller=require(_0xdae3('0x6'));router[_0xdae3('0x7')]('/',auth['isAuthenticated'](),controller[_0xdae3('0x8')]);router[_0xdae3('0x7')](_0xdae3('0x9'),auth['isAuthenticated'](),controller[_0xdae3('0xa')]);router[_0xdae3('0x7')](_0xdae3('0xb'),auth[_0xdae3('0xc')](),controller[_0xdae3('0xd')]);router[_0xdae3('0x7')](_0xdae3('0xe'),auth[_0xdae3('0xc')](),controller[_0xdae3('0xf')]);router[_0xdae3('0x7')](_0xdae3('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xdae3('0x7')](_0xdae3('0x11'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x12')]);router[_0xdae3('0x7')](_0xdae3('0x13'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x14')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0xdae3('0x15')]('/',auth['isAuthenticated'](),controller[_0xdae3('0x16')]);router['post'](_0xdae3('0x17'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x18')]);router[_0xdae3('0x15')](_0xdae3('0x13'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x19')]);router[_0xdae3('0x15')](_0xdae3('0x1a'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x1b')]);router[_0xdae3('0x1c')](_0xdae3('0x9'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x1d')]);router[_0xdae3('0x1e')](_0xdae3('0x9'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x1f')]);router['delete'](_0xdae3('0x13'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x20')]);router[_0xdae3('0x1e')](_0xdae3('0x1a'),auth[_0xdae3('0xc')](),controller[_0xdae3('0x21')]);module[_0xdae3('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 42ad7b4..0918006 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 _0x5475=['STRING','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x436981,_0x371571){var _0x2e4f86=function(_0x2da649){while(--_0x2da649){_0x436981['push'](_0x436981['shift']());}};_0x2e4f86(++_0x371571);}(_0x5475,0x19d));var _0x5547=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x5475[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require(_0x5547('0x0'));module['exports']={'key':{'type':Sequelize[_0x5547('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x5547('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5547('0x1')]},'name':{'type':Sequelize[_0x5547('0x3')],'get':function(){return this[_0x5547('0x4')](_0x5547('0x5'));}}}; \ No newline at end of file +var _0x41be=['key','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x40225e,_0x5c981a){var _0x326c2b=function(_0x78ef97){while(--_0x78ef97){_0x40225e['push'](_0x40225e['shift']());}};_0x326c2b(++_0x5c981a);}(_0x41be,0x175));var _0xe41b=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x41be[_0x577519];return _0x5b12f7;};'use strict';var Sequelize=require(_0xe41b('0x0'));module[_0xe41b('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xe41b('0x2')]},'name':{'type':Sequelize[_0xe41b('0x3')],'get':function(){return this[_0xe41b('0x4')](_0xe41b('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c25803b..d6e8af5 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 _0xf451=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','json','apply','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','CannedAnswer','includeAll','include','findAll','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x50f55d,_0x5a1525){var _0x46ae1=function(_0x2f270d){while(--_0x2f270d){_0x50f55d['push'](_0x50f55d['shift']());}};_0x46ae1(++_0x5a1525);}(_0xf451,0x98));var _0x1f45=function(_0x232078,_0xf539bb){_0x232078=_0x232078-0x0;var _0x187868=_0xf451[_0x232078];return _0x187868;};'use strict';var pdf=require(_0x1f45('0x0'));var emlformat=require(_0x1f45('0x1'));var rimraf=require(_0x1f45('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f45('0x3'));var rp=require(_0x1f45('0x4'));var moment=require(_0x1f45('0x5'));var BPromise=require(_0x1f45('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1f45('0x7'));var csv=require(_0x1f45('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1f45('0x9'));var squel=require('squel');var crypto=require(_0x1f45('0xa'));var jsforce=require(_0x1f45('0xb'));var deskjs=require(_0x1f45('0xc'));var toCsv=require(_0x1f45('0x8'));var querystring=require('querystring');var Papa=require(_0x1f45('0xd'));var Redis=require(_0x1f45('0xe'));var authService=require(_0x1f45('0xf'));var qs=require(_0x1f45('0x10'));var as=require(_0x1f45('0x11'));var hardwareService=require(_0x1f45('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1f45('0x13'));var config=require(_0x1f45('0x14'));var db=require(_0x1f45('0x15'))['db'];function respondWithStatusCode(_0x234ef5,_0x508e1f){_0x508e1f=_0x508e1f||0xcc;return function(_0x468860){if(_0x468860){return _0x234ef5['sendStatus'](_0x508e1f);}return _0x234ef5[_0x1f45('0x16')](_0x508e1f)[_0x1f45('0x17')]();};}function respondWithResult(_0x56757f,_0x4cd2d4){_0x4cd2d4=_0x4cd2d4||0xc8;return function(_0x311cb7){if(_0x311cb7){return _0x56757f['status'](_0x4cd2d4)['json'](_0x311cb7);}};}function respondWithFilteredResult(_0x2811b5,_0xf69ea4){return function(_0x45b7ce){if(_0x45b7ce){var _0x472e15=_0x45b7ce[_0x1f45('0x18')],_0x13d997=_0xf69ea4['offset'],_0x9e1752=_0xf69ea4[_0x1f45('0x19')]+_0xf69ea4['limit'],_0x5ea6b5;if(_0x9e1752>=_0x472e15){_0x9e1752=_0x472e15;_0x5ea6b5=0xc8;}else{_0x5ea6b5=0xce;}_0x2811b5[_0x1f45('0x16')](_0x5ea6b5);return _0x2811b5[_0x1f45('0x1a')]('Content-Range',_0x13d997+'-'+_0x9e1752+'/'+_0x472e15)[_0x1f45('0x1b')](_0x45b7ce);}return null;};}function patchUpdates(_0x5bdcf5){return function(_0x1bebe8){try{jsonpatch[_0x1f45('0x1c')](_0x1bebe8,_0x5bdcf5,!![]);}catch(_0x164a69){return BPromise['reject'](_0x164a69);}return _0x1bebe8['save']();};}function saveUpdates(_0x5237c8,_0x2b7dea){return function(_0x3df2bb){if(_0x3df2bb){return _0x3df2bb[_0x1f45('0x1d')](_0x5237c8)[_0x1f45('0x1e')](function(_0x45d162){return _0x45d162;});}return null;};}function removeEntity(_0x1ac7fd,_0x1feac9){return function(_0x1029df){if(_0x1029df){return _0x1029df[_0x1f45('0x1f')]()[_0x1f45('0x1e')](function(){var _0x668bf=_0x1029df[_0x1f45('0x20')]({'plain':!![]});var _0x234031=_0x1f45('0x21');return db[_0x1f45('0x22')][_0x1f45('0x1f')]({'where':{'type':_0x234031,'resourceId':_0x668bf['id']}})[_0x1f45('0x1e')](function(){return _0x1029df;});})['then'](function(){_0x1ac7fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f021,_0x14e0ee){return function(_0x381355){if(!_0x381355){_0x54f021[_0x1f45('0x23')](0x194);}return _0x381355;};}function handleError(_0x43dd82,_0x347427){_0x347427=_0x347427||0x1f4;return function(_0x260545){logger['error'](_0x260545[_0x1f45('0x24')]);if(_0x260545[_0x1f45('0x25')]){delete _0x260545[_0x1f45('0x25')];}_0x43dd82[_0x1f45('0x16')](_0x347427)['send'](_0x260545);};}exports[_0x1f45('0x26')]=function(_0x36dfe5,_0xd36383){var _0x815ca0={},_0x22afce={},_0x9ae952={'count':0x0,'rows':[]};var _0x361dfb=_[_0x1f45('0x27')](db['CannedAnswer'][_0x1f45('0x28')],function(_0x279b2b){return{'name':_0x279b2b[_0x1f45('0x29')],'type':_0x279b2b[_0x1f45('0x2a')][_0x1f45('0x2b')]};});_0x22afce[_0x1f45('0x2c')]=_[_0x1f45('0x27')](_0x361dfb,'name');_0x22afce[_0x1f45('0x2d')]=_[_0x1f45('0x2e')](_0x36dfe5[_0x1f45('0x2d')]);_0x22afce[_0x1f45('0x2f')]=_[_0x1f45('0x30')](_0x22afce[_0x1f45('0x2c')],_0x22afce['query']);_0x815ca0[_0x1f45('0x31')]=_['intersection'](_0x22afce['model'],qs[_0x1f45('0x32')](_0x36dfe5[_0x1f45('0x2d')][_0x1f45('0x32')]));_0x815ca0[_0x1f45('0x31')]=_0x815ca0[_0x1f45('0x31')][_0x1f45('0x33')]?_0x815ca0[_0x1f45('0x31')]:_0x22afce[_0x1f45('0x2c')];if(!_0x36dfe5[_0x1f45('0x2d')][_0x1f45('0x34')](_0x1f45('0x35'))){_0x815ca0[_0x1f45('0x36')]=qs[_0x1f45('0x36')](_0x36dfe5[_0x1f45('0x2d')][_0x1f45('0x36')]);_0x815ca0['offset']=qs['offset'](_0x36dfe5['query']['offset']);}_0x815ca0[_0x1f45('0x37')]=qs[_0x1f45('0x38')](_0x36dfe5['query'][_0x1f45('0x38')]);_0x815ca0['where']=qs[_0x1f45('0x2f')](_[_0x1f45('0x39')](_0x36dfe5['query'],_0x22afce[_0x1f45('0x2f')]),_0x361dfb);if(_0x36dfe5[_0x1f45('0x2d')][_0x1f45('0x3a')]){_0x815ca0[_0x1f45('0x3b')]=_[_0x1f45('0x3c')](_0x815ca0[_0x1f45('0x3b')],{'$or':_[_0x1f45('0x27')](_0x361dfb,function(_0x26da40){if(_0x26da40[_0x1f45('0x2a')]!=='VIRTUAL'){var _0x3d0a7e={};_0x3d0a7e[_0x26da40[_0x1f45('0x25')]]={'$like':'%'+_0x36dfe5['query']['filter']+'%'};return _0x3d0a7e;}})});}_0x815ca0=_[_0x1f45('0x3c')]({},_0x815ca0,_0x36dfe5[_0x1f45('0x3d')]);var _0x219340={'where':_0x815ca0['where']};return db[_0x1f45('0x3e')][_0x1f45('0x18')](_0x219340)[_0x1f45('0x1e')](function(_0x2af758){_0x9ae952['count']=_0x2af758;if(_0x36dfe5['query'][_0x1f45('0x3f')]){_0x815ca0[_0x1f45('0x40')]=[{'all':!![]}];}return db[_0x1f45('0x3e')][_0x1f45('0x41')](_0x815ca0);})[_0x1f45('0x1e')](function(_0xd16b02){_0x9ae952[_0x1f45('0x42')]=_0xd16b02;return _0x9ae952;})['then'](respondWithFilteredResult(_0xd36383,_0x815ca0))[_0x1f45('0x43')](handleError(_0xd36383,null));};exports[_0x1f45('0x44')]=function(_0x5027f7,_0xa1efdb){var _0x145c21={'raw':!![],'where':{'id':_0x5027f7[_0x1f45('0x45')]['id']}},_0x198dbd={};_0x198dbd[_0x1f45('0x2c')]=_[_0x1f45('0x2e')](db['CannedAnswer']['rawAttributes']);_0x198dbd[_0x1f45('0x2d')]=_[_0x1f45('0x2e')](_0x5027f7[_0x1f45('0x2d')]);_0x198dbd[_0x1f45('0x2f')]=_[_0x1f45('0x30')](_0x198dbd['model'],_0x198dbd[_0x1f45('0x2d')]);_0x145c21[_0x1f45('0x31')]=_[_0x1f45('0x30')](_0x198dbd[_0x1f45('0x2c')],qs[_0x1f45('0x32')](_0x5027f7[_0x1f45('0x2d')]['fields']));_0x145c21[_0x1f45('0x31')]=_0x145c21[_0x1f45('0x31')][_0x1f45('0x33')]?_0x145c21[_0x1f45('0x31')]:_0x198dbd[_0x1f45('0x2c')];if(_0x5027f7[_0x1f45('0x2d')]['includeAll']){_0x145c21['include']=[{'all':!![]}];}_0x145c21=_['merge']({},_0x145c21,_0x5027f7[_0x1f45('0x3d')]);return db[_0x1f45('0x3e')][_0x1f45('0x46')](_0x145c21)[_0x1f45('0x1e')](handleEntityNotFound(_0xa1efdb,null))[_0x1f45('0x1e')](respondWithResult(_0xa1efdb,null))['catch'](handleError(_0xa1efdb,null));};exports[_0x1f45('0x1d')]=function(_0x46e459,_0x2c19d5){if(_0x46e459[_0x1f45('0x47')]['id']){delete _0x46e459[_0x1f45('0x47')]['id'];}return db[_0x1f45('0x3e')][_0x1f45('0x46')]({'where':{'id':_0x46e459[_0x1f45('0x45')]['id']}})[_0x1f45('0x1e')](handleEntityNotFound(_0x2c19d5,null))[_0x1f45('0x1e')](saveUpdates(_0x46e459[_0x1f45('0x47')],null))[_0x1f45('0x1e')](respondWithResult(_0x2c19d5,null))['catch'](handleError(_0x2c19d5,null));};exports['destroy']=function(_0x3c5bb4,_0x468f08){return db[_0x1f45('0x3e')][_0x1f45('0x46')]({'where':{'id':_0x3c5bb4[_0x1f45('0x45')]['id']}})[_0x1f45('0x1e')](handleEntityNotFound(_0x468f08,null))[_0x1f45('0x1e')](removeEntity(_0x468f08,null))[_0x1f45('0x43')](handleError(_0x468f08,null));};exports[_0x1f45('0x48')]=function(_0x4496c3,_0x5f0f52){var _0x2a675e={'key':_0x4496c3[_0x1f45('0x47')][_0x1f45('0x2b')]};if(_0x4496c3[_0x1f45('0x47')][_0x1f45('0x49')]){_0x2a675e[_0x1f45('0x49')]=_0x4496c3[_0x1f45('0x47')][_0x1f45('0x49')];}else if(_0x4496c3[_0x1f45('0x47')][_0x1f45('0x4a')]){_0x2a675e[_0x1f45('0x4a')]=_0x4496c3['body'][_0x1f45('0x4a')];}else if(_0x4496c3[_0x1f45('0x47')][_0x1f45('0x4b')]){_0x2a675e[_0x1f45('0x4b')]=_0x4496c3[_0x1f45('0x47')][_0x1f45('0x4b')];}else if(_0x4496c3['body']['ChatWebsiteId']){_0x2a675e['ChatWebsiteId']=_0x4496c3[_0x1f45('0x47')][_0x1f45('0x4c')];}return db[_0x1f45('0x3e')]['find']({'where':_0x2a675e})[_0x1f45('0x1e')](function(_0x5e388c){if(_0x5e388c){throw new db[(_0x1f45('0x4d'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x1f45('0x3e')][_0x1f45('0x48')](_0x4496c3['body']);})[_0x1f45('0x1e')](function(_0x29835c){var _0x3a8296=_0x4496c3[_0x1f45('0x4e')]['get']({'plain':!![]});if(!_0x3a8296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a8296[_0x1f45('0x4f')]===_0x1f45('0x4e')){var _0x36c087=_0x29835c[_0x1f45('0x20')]({'plain':!![]});return db[_0x1f45('0x50')]['find']({'where':{'name':_0x1f45('0x21'),'userProfileId':_0x3a8296[_0x1f45('0x51')]},'raw':!![]})['then'](function(_0x5138ac){if(_0x5138ac&&_0x5138ac[_0x1f45('0x52')]===0x0){return db['UserProfileResource'][_0x1f45('0x48')]({'name':_0x36c087[_0x1f45('0x25')],'resourceId':_0x36c087['id'],'type':_0x5138ac[_0x1f45('0x25')],'sectionId':_0x5138ac['id']},{})[_0x1f45('0x1e')](function(){return _0x29835c;});}else{return _0x29835c;}})['catch'](function(_0x71cd5e){logger['error'](_0x1f45('0x53'),_0x71cd5e);throw _0x71cd5e;});}return _0x29835c;})[_0x1f45('0x1e')](respondWithResult(_0x5f0f52,0xc9))[_0x1f45('0x43')](handleError(_0x5f0f52,null));}; \ No newline at end of file +var _0xd67f=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','length','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xd67f,0x160));var _0xfd67=function(_0x807c60,_0x18cfc1){_0x807c60=_0x807c60-0x0;var _0x1fedbe=_0xd67f[_0x807c60];return _0x1fedbe;};'use strict';var pdf=require(_0xfd67('0x0'));var emlformat=require(_0xfd67('0x1'));var rimraf=require(_0xfd67('0x2'));var zipdir=require(_0xfd67('0x3'));var jsonpatch=require(_0xfd67('0x4'));var rp=require(_0xfd67('0x5'));var moment=require(_0xfd67('0x6'));var BPromise=require(_0xfd67('0x7'));var Mustache=require(_0xfd67('0x8'));var util=require(_0xfd67('0x9'));var path=require(_0xfd67('0xa'));var sox=require(_0xfd67('0xb'));var csv=require(_0xfd67('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd67('0xd'));var squel=require('squel');var crypto=require(_0xfd67('0xe'));var jsforce=require(_0xfd67('0xf'));var deskjs=require(_0xfd67('0x10'));var toCsv=require(_0xfd67('0xc'));var querystring=require(_0xfd67('0x11'));var Papa=require(_0xfd67('0x12'));var Redis=require(_0xfd67('0x13'));var authService=require(_0xfd67('0x14'));var qs=require(_0xfd67('0x15'));var as=require(_0xfd67('0x16'));var hardwareService=require(_0xfd67('0x17'));var logger=require(_0xfd67('0x18'))(_0xfd67('0x19'));var utils=require(_0xfd67('0x1a'));var config=require(_0xfd67('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26dd16,_0x42ff69){_0x42ff69=_0x42ff69||0xcc;return function(_0xa5a22a){if(_0xa5a22a){return _0x26dd16['sendStatus'](_0x42ff69);}return _0x26dd16[_0xfd67('0x1c')](_0x42ff69)[_0xfd67('0x1d')]();};}function respondWithResult(_0x5e30d6,_0x37e216){_0x37e216=_0x37e216||0xc8;return function(_0x306eb8){if(_0x306eb8){return _0x5e30d6['status'](_0x37e216)[_0xfd67('0x1e')](_0x306eb8);}};}function respondWithFilteredResult(_0x30c291,_0x137284){return function(_0x30e927){if(_0x30e927){var _0xd33f01=_0x30e927[_0xfd67('0x1f')],_0x57f778=_0x137284[_0xfd67('0x20')],_0x5c1b59=_0x137284[_0xfd67('0x20')]+_0x137284[_0xfd67('0x21')],_0x2305d2;if(_0x5c1b59>=_0xd33f01){_0x5c1b59=_0xd33f01;_0x2305d2=0xc8;}else{_0x2305d2=0xce;}_0x30c291[_0xfd67('0x1c')](_0x2305d2);return _0x30c291[_0xfd67('0x22')](_0xfd67('0x23'),_0x57f778+'-'+_0x5c1b59+'/'+_0xd33f01)[_0xfd67('0x1e')](_0x30e927);}return null;};}function patchUpdates(_0x489bab){return function(_0x584790){try{jsonpatch['apply'](_0x584790,_0x489bab,!![]);}catch(_0x2f70a3){return BPromise[_0xfd67('0x24')](_0x2f70a3);}return _0x584790[_0xfd67('0x25')]();};}function saveUpdates(_0xfb91bd,_0x1bc172){return function(_0x1603cf){if(_0x1603cf){return _0x1603cf['update'](_0xfb91bd)[_0xfd67('0x26')](function(_0x4adb08){return _0x4adb08;});}return null;};}function removeEntity(_0x283e0e,_0x1f86da){return function(_0x5b8be1){if(_0x5b8be1){return _0x5b8be1[_0xfd67('0x27')]()[_0xfd67('0x26')](function(){var _0x2ed7ac=_0x5b8be1[_0xfd67('0x28')]({'plain':!![]});var _0x1b207c=_0xfd67('0x29');return db[_0xfd67('0x2a')][_0xfd67('0x27')]({'where':{'type':_0x1b207c,'resourceId':_0x2ed7ac['id']}})[_0xfd67('0x26')](function(){return _0x5b8be1;});})[_0xfd67('0x26')](function(){_0x283e0e[_0xfd67('0x1c')](0xcc)[_0xfd67('0x1d')]();});}};}function handleEntityNotFound(_0x4e06a2,_0x1aee3c){return function(_0x229e18){if(!_0x229e18){_0x4e06a2[_0xfd67('0x2b')](0x194);}return _0x229e18;};}function handleError(_0x1d451d,_0x4b643d){_0x4b643d=_0x4b643d||0x1f4;return function(_0xb8a3a2){logger['error'](_0xb8a3a2[_0xfd67('0x2c')]);if(_0xb8a3a2[_0xfd67('0x2d')]){delete _0xb8a3a2[_0xfd67('0x2d')];}_0x1d451d[_0xfd67('0x1c')](_0x4b643d)[_0xfd67('0x2e')](_0xb8a3a2);};}exports['index']=function(_0x7ebb04,_0x57a13c){var _0x2f4ab0={},_0x2de1d1={},_0x46cb98={'count':0x0,'rows':[]};var _0x2269bb=_[_0xfd67('0x2f')](db[_0xfd67('0x30')][_0xfd67('0x31')],function(_0x4ac337){return{'name':_0x4ac337[_0xfd67('0x32')],'type':_0x4ac337[_0xfd67('0x33')][_0xfd67('0x34')]};});_0x2de1d1[_0xfd67('0x35')]=_[_0xfd67('0x2f')](_0x2269bb,_0xfd67('0x2d'));_0x2de1d1[_0xfd67('0x36')]=_[_0xfd67('0x37')](_0x7ebb04[_0xfd67('0x36')]);_0x2de1d1[_0xfd67('0x38')]=_[_0xfd67('0x39')](_0x2de1d1['model'],_0x2de1d1[_0xfd67('0x36')]);_0x2f4ab0[_0xfd67('0x3a')]=_['intersection'](_0x2de1d1[_0xfd67('0x35')],qs[_0xfd67('0x3b')](_0x7ebb04[_0xfd67('0x36')][_0xfd67('0x3b')]));_0x2f4ab0[_0xfd67('0x3a')]=_0x2f4ab0[_0xfd67('0x3a')]['length']?_0x2f4ab0[_0xfd67('0x3a')]:_0x2de1d1[_0xfd67('0x35')];if(!_0x7ebb04[_0xfd67('0x36')]['hasOwnProperty']('nolimit')){_0x2f4ab0['limit']=qs[_0xfd67('0x21')](_0x7ebb04[_0xfd67('0x36')][_0xfd67('0x21')]);_0x2f4ab0[_0xfd67('0x20')]=qs['offset'](_0x7ebb04[_0xfd67('0x36')][_0xfd67('0x20')]);}_0x2f4ab0['order']=qs['sort'](_0x7ebb04[_0xfd67('0x36')]['sort']);_0x2f4ab0[_0xfd67('0x3c')]=qs[_0xfd67('0x38')](_[_0xfd67('0x3d')](_0x7ebb04[_0xfd67('0x36')],_0x2de1d1['filters']),_0x2269bb);if(_0x7ebb04['query'][_0xfd67('0x3e')]){_0x2f4ab0[_0xfd67('0x3c')]=_[_0xfd67('0x3f')](_0x2f4ab0[_0xfd67('0x3c')],{'$or':_[_0xfd67('0x2f')](_0x2269bb,function(_0x47b834){if(_0x47b834[_0xfd67('0x33')]!==_0xfd67('0x40')){var _0x105014={};_0x105014[_0x47b834[_0xfd67('0x2d')]]={'$like':'%'+_0x7ebb04[_0xfd67('0x36')][_0xfd67('0x3e')]+'%'};return _0x105014;}})});}_0x2f4ab0=_[_0xfd67('0x3f')]({},_0x2f4ab0,_0x7ebb04['options']);var _0xb3c1e9={'where':_0x2f4ab0[_0xfd67('0x3c')]};return db['CannedAnswer'][_0xfd67('0x1f')](_0xb3c1e9)['then'](function(_0x244ca0){_0x46cb98['count']=_0x244ca0;if(_0x7ebb04['query']['includeAll']){_0x2f4ab0[_0xfd67('0x41')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2f4ab0);})[_0xfd67('0x26')](function(_0xbcee8d){_0x46cb98[_0xfd67('0x42')]=_0xbcee8d;return _0x46cb98;})['then'](respondWithFilteredResult(_0x57a13c,_0x2f4ab0))[_0xfd67('0x43')](handleError(_0x57a13c,null));};exports[_0xfd67('0x44')]=function(_0x590a8c,_0x3516bb){var _0x118ead={'raw':!![],'where':{'id':_0x590a8c[_0xfd67('0x45')]['id']}},_0x30c068={};_0x30c068['model']=_['keys'](db[_0xfd67('0x30')][_0xfd67('0x31')]);_0x30c068[_0xfd67('0x36')]=_['keys'](_0x590a8c['query']);_0x30c068[_0xfd67('0x38')]=_[_0xfd67('0x39')](_0x30c068['model'],_0x30c068['query']);_0x118ead['attributes']=_[_0xfd67('0x39')](_0x30c068['model'],qs[_0xfd67('0x3b')](_0x590a8c[_0xfd67('0x36')][_0xfd67('0x3b')]));_0x118ead[_0xfd67('0x3a')]=_0x118ead[_0xfd67('0x3a')][_0xfd67('0x46')]?_0x118ead[_0xfd67('0x3a')]:_0x30c068[_0xfd67('0x35')];if(_0x590a8c[_0xfd67('0x36')][_0xfd67('0x47')]){_0x118ead[_0xfd67('0x41')]=[{'all':!![]}];}_0x118ead=_[_0xfd67('0x3f')]({},_0x118ead,_0x590a8c[_0xfd67('0x48')]);return db[_0xfd67('0x30')]['find'](_0x118ead)[_0xfd67('0x26')](handleEntityNotFound(_0x3516bb,null))['then'](respondWithResult(_0x3516bb,null))[_0xfd67('0x43')](handleError(_0x3516bb,null));};exports['update']=function(_0xedcd8,_0x271aff){if(_0xedcd8[_0xfd67('0x49')]['id']){delete _0xedcd8[_0xfd67('0x49')]['id'];}return db[_0xfd67('0x30')]['find']({'where':{'id':_0xedcd8[_0xfd67('0x45')]['id']}})[_0xfd67('0x26')](handleEntityNotFound(_0x271aff,null))[_0xfd67('0x26')](saveUpdates(_0xedcd8['body'],null))[_0xfd67('0x26')](respondWithResult(_0x271aff,null))['catch'](handleError(_0x271aff,null));};exports[_0xfd67('0x27')]=function(_0x423244,_0x490838){return db[_0xfd67('0x30')][_0xfd67('0x4a')]({'where':{'id':_0x423244[_0xfd67('0x45')]['id']}})['then'](handleEntityNotFound(_0x490838,null))[_0xfd67('0x26')](removeEntity(_0x490838,null))[_0xfd67('0x43')](handleError(_0x490838,null));};exports[_0xfd67('0x4b')]=function(_0x576580,_0xe898ec){var _0xa0f3bc={'key':_0x576580[_0xfd67('0x49')][_0xfd67('0x34')]};if(_0x576580[_0xfd67('0x49')][_0xfd67('0x4c')]){_0xa0f3bc['MailAccountId']=_0x576580['body'][_0xfd67('0x4c')];}else if(_0x576580['body'][_0xfd67('0x4d')]){_0xa0f3bc[_0xfd67('0x4d')]=_0x576580[_0xfd67('0x49')][_0xfd67('0x4d')];}else if(_0x576580[_0xfd67('0x49')][_0xfd67('0x4e')]){_0xa0f3bc['OpenchannelAccountId']=_0x576580['body'][_0xfd67('0x4e')];}else if(_0x576580[_0xfd67('0x49')][_0xfd67('0x4f')]){_0xa0f3bc[_0xfd67('0x4f')]=_0x576580[_0xfd67('0x49')][_0xfd67('0x4f')];}return db[_0xfd67('0x30')][_0xfd67('0x4a')]({'where':_0xa0f3bc})[_0xfd67('0x26')](function(_0x51eaa3){if(_0x51eaa3){throw new db[(_0xfd67('0x50'))]['ValidationError'](_0xfd67('0x51'));}return db[_0xfd67('0x30')][_0xfd67('0x4b')](_0x576580[_0xfd67('0x49')]);})['then'](function(_0x3aac4c){var _0x3d4047=_0x576580['user'][_0xfd67('0x28')]({'plain':!![]});if(!_0x3d4047)throw new Error(_0xfd67('0x52'));if(_0x3d4047[_0xfd67('0x53')]===_0xfd67('0x54')){var _0x10e2a0=_0x3aac4c[_0xfd67('0x28')]({'plain':!![]});return db['UserProfileSection'][_0xfd67('0x4a')]({'where':{'name':_0xfd67('0x29'),'userProfileId':_0x3d4047[_0xfd67('0x55')]},'raw':!![]})[_0xfd67('0x26')](function(_0x77543b){if(_0x77543b&&_0x77543b[_0xfd67('0x56')]===0x0){return db[_0xfd67('0x2a')][_0xfd67('0x4b')]({'name':_0x10e2a0[_0xfd67('0x2d')],'resourceId':_0x10e2a0['id'],'type':_0x77543b[_0xfd67('0x2d')],'sectionId':_0x77543b['id']},{})[_0xfd67('0x26')](function(){return _0x3aac4c;});}else{return _0x3aac4c;}})[_0xfd67('0x43')](function(_0x2b22ca){logger[_0xfd67('0x57')](_0xfd67('0x58'),_0x2b22ca);throw _0x2b22ca;});}return _0x3aac4c;})[_0xfd67('0x26')](respondWithResult(_0xe898ec,0xc9))[_0xfd67('0x43')](handleError(_0xe898ec,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8b4fb92..020ffdb 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 _0x8f7c=['rimraf','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path'];(function(_0x1b3c62,_0x4122d2){var _0x238f32=function(_0x24e55a){while(--_0x24e55a){_0x1b3c62['push'](_0x1b3c62['shift']());}};_0x238f32(++_0x4122d2);}(_0x8f7c,0x133));var _0xc8f7=function(_0x40c4fb,_0xbae0c6){_0x40c4fb=_0x40c4fb-0x0;var _0x31e673=_0x8f7c[_0x40c4fb];return _0x31e673;};'use strict';var _=require(_0xc8f7('0x0'));var util=require(_0xc8f7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc8f7('0x2'));var BPromise=require('bluebird');var rp=require(_0xc8f7('0x3'));var fs=require('fs');var path=require(_0xc8f7('0x4'));var rimraf=require(_0xc8f7('0x5'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0xc8f7('0x6')]=function(_0x5359e2,_0x208459){return _0x5359e2[_0xc8f7('0x7')](_0xc8f7('0x8'),attributes,{'tableName':_0xc8f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8f7('0xa'),'collate':_0xc8f7('0xb')});}; \ No newline at end of file +var _0x52b2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x68f7f4,_0x44645b){var _0x3be573=function(_0x6ded6c){while(--_0x6ded6c){_0x68f7f4['push'](_0x68f7f4['shift']());}};_0x3be573(++_0x44645b);}(_0x52b2,0x11e));var _0x252b=function(_0x4786e9,_0x1df2ed){_0x4786e9=_0x4786e9-0x0;var _0x5c2b6a=_0x52b2[_0x4786e9];return _0x5c2b6a;};'use strict';var _=require(_0x252b('0x0'));var util=require(_0x252b('0x1'));var logger=require(_0x252b('0x2'))(_0x252b('0x3'));var moment=require(_0x252b('0x4'));var BPromise=require(_0x252b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x252b('0x6'));var rimraf=require(_0x252b('0x7'));var config=require(_0x252b('0x8'));var attributes=require(_0x252b('0x9'));module[_0x252b('0xa')]=function(_0x571511,_0x1025af){return _0x571511[_0x252b('0xb')](_0x252b('0xc'),attributes,{'tableName':_0x252b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x252b('0xe'),'collate':_0x252b('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 307c6fd..46290eb 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 _0xaf99=['message','catch','CannedAnswer,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xaf99,0x161));var _0x9af9=function(_0xa35e2a,_0x3e4486){_0xa35e2a=_0xa35e2a-0x0;var _0x5e9aa3=_0xaf99[_0xa35e2a];return _0x5e9aa3;};'use strict';var _=require(_0x9af9('0x0'));var util=require(_0x9af9('0x1'));var moment=require(_0x9af9('0x2'));var BPromise=require(_0x9af9('0x3'));var rs=require(_0x9af9('0x4'));var fs=require('fs');var Redis=require(_0x9af9('0x5'));var db=require(_0x9af9('0x6'))['db'];var utils=require(_0x9af9('0x7'));var logger=require(_0x9af9('0x8'))(_0x9af9('0x9'));var config=require(_0x9af9('0xa'));var jayson=require(_0x9af9('0xb'));var client=jayson[_0x9af9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xebca36,_0x4926c7,_0x56d73d){return new BPromise(function(_0x1c75b6,_0x5a778a){return client[_0x9af9('0xd')](_0xebca36,_0x56d73d)[_0x9af9('0xe')](function(_0x51d917){logger[_0x9af9('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x4926c7,_0x9af9('0x10'));logger[_0x9af9('0x11')](_0x9af9('0x12'),_0x4926c7,_0x9af9('0x10'),JSON[_0x9af9('0x13')](_0x51d917));if(_0x51d917[_0x9af9('0x14')]){if(_0x51d917[_0x9af9('0x14')][_0x9af9('0x15')]===0x1f4){logger[_0x9af9('0x14')]('CannedAnswer,\x20%s,\x20%s',_0x4926c7,_0x51d917['error'][_0x9af9('0x16')]);return _0x5a778a(_0x51d917[_0x9af9('0x14')][_0x9af9('0x16')]);}logger[_0x9af9('0x14')]('CannedAnswer,\x20%s,\x20%s',_0x4926c7,_0x51d917[_0x9af9('0x14')][_0x9af9('0x16')]);return _0x1c75b6(_0x51d917[_0x9af9('0x14')][_0x9af9('0x16')]);}else{logger[_0x9af9('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x4926c7,_0x9af9('0x10'));_0x1c75b6(_0x51d917['result']['message']);}})[_0x9af9('0x17')](function(_0x49ad9f){logger[_0x9af9('0x14')](_0x9af9('0x18'),_0x4926c7,_0x49ad9f);_0x5a778a(_0x49ad9f);});});} \ No newline at end of file +var _0xd66f=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x349a6a,_0x291b2a){var _0x3f6577=function(_0x384071){while(--_0x384071){_0x349a6a['push'](_0x349a6a['shift']());}};_0x3f6577(++_0x291b2a);}(_0xd66f,0x104));var _0xfd66=function(_0xd34208,_0x26345a){_0xd34208=_0xd34208-0x0;var _0x1a1991=_0xd66f[_0xd34208];return _0x1a1991;};'use strict';var _=require(_0xfd66('0x0'));var util=require(_0xfd66('0x1'));var moment=require(_0xfd66('0x2'));var BPromise=require(_0xfd66('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd66('0x4'));var db=require(_0xfd66('0x5'))['db'];var utils=require(_0xfd66('0x6'));var logger=require('../../config/logger')(_0xfd66('0x7'));var config=require(_0xfd66('0x8'));var jayson=require(_0xfd66('0x9'));var client=jayson['client'][_0xfd66('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4595b7,_0x127cf1,_0x27f744){return new BPromise(function(_0x3ca0d3,_0x799886){return client[_0xfd66('0xb')](_0x4595b7,_0x27f744)[_0xfd66('0xc')](function(_0x22d985){logger['info'](_0xfd66('0xd'),_0x127cf1,_0xfd66('0xe'));logger[_0xfd66('0xf')](_0xfd66('0x10'),_0x127cf1,_0xfd66('0xe'),JSON[_0xfd66('0x11')](_0x22d985));if(_0x22d985[_0xfd66('0x12')]){if(_0x22d985[_0xfd66('0x12')][_0xfd66('0x13')]===0x1f4){logger['error'](_0xfd66('0xd'),_0x127cf1,_0x22d985[_0xfd66('0x12')][_0xfd66('0x14')]);return _0x799886(_0x22d985['error']['message']);}logger[_0xfd66('0x12')](_0xfd66('0xd'),_0x127cf1,_0x22d985[_0xfd66('0x12')]['message']);return _0x3ca0d3(_0x22d985[_0xfd66('0x12')][_0xfd66('0x14')]);}else{logger[_0xfd66('0x15')]('CannedAnswer,\x20%s,\x20%s',_0x127cf1,'request\x20sent');_0x3ca0d3(_0x22d985[_0xfd66('0x16')][_0xfd66('0x14')]);}})[_0xfd66('0x17')](function(_0x2d197d){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x127cf1,_0x2d197d);_0x799886(_0x2d197d);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 017621a..ff53318 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 _0x2b5e=['create','put','delete','/:id','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','show','isAuthenticated'];(function(_0x36085f,_0x1edd9d){var _0x354e2b=function(_0x279f6a){while(--_0x279f6a){_0x36085f['push'](_0x36085f['shift']());}};_0x354e2b(++_0x1edd9d);}(_0x2b5e,0xf4));var _0xe2b5=function(_0x4086f7,_0x5f35be){_0x4086f7=_0x4086f7-0x0;var _0x537053=_0x2b5e[_0x4086f7];return _0x537053;};'use strict';var multer=require(_0xe2b5('0x0'));var util=require(_0xe2b5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe2b5('0x2'));var router=express[_0xe2b5('0x3')]();var auth=require(_0xe2b5('0x4'));var interaction=require(_0xe2b5('0x5'));var config=require(_0xe2b5('0x6'));var controller=require(_0xe2b5('0x7'));router[_0xe2b5('0x8')]('/',auth['isAuthenticated'](),controller[_0xe2b5('0x9')]);router[_0xe2b5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe2b5('0xa')]);router['post']('/',auth[_0xe2b5('0xb')](),controller[_0xe2b5('0xc')]);router[_0xe2b5('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe2b5('0xe')](_0xe2b5('0xf'),auth[_0xe2b5('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x62fb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','update','multer','path','connect-timeout'];(function(_0x436a67,_0x4408ea){var _0x543596=function(_0x26d576){while(--_0x26d576){_0x436a67['push'](_0x436a67['shift']());}};_0x543596(++_0x4408ea);}(_0x62fb,0x1cd));var _0xb62f=function(_0x332f7b,_0x336d17){_0x332f7b=_0x332f7b-0x0;var _0x499b57=_0x62fb[_0x332f7b];return _0x499b57;};'use strict';var multer=require(_0xb62f('0x0'));var util=require('util');var path=require(_0xb62f('0x1'));var timeout=require(_0xb62f('0x2'));var express=require(_0xb62f('0x3'));var router=express[_0xb62f('0x4')]();var auth=require(_0xb62f('0x5'));var interaction=require(_0xb62f('0x6'));var config=require(_0xb62f('0x7'));var controller=require(_0xb62f('0x8'));router[_0xb62f('0x9')]('/',auth['isAuthenticated'](),controller[_0xb62f('0xa')]);router[_0xb62f('0x9')](_0xb62f('0xb'),auth[_0xb62f('0xc')](),controller[_0xb62f('0xd')]);router[_0xb62f('0xe')]('/',auth[_0xb62f('0xc')](),controller['create']);router['put'](_0xb62f('0xb'),auth[_0xb62f('0xc')](),controller[_0xb62f('0xf')]);router['delete']('/:id',auth[_0xb62f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index dd0d7e6..8203511 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 _0x9eb6=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x7d0dbf,_0x8d6950){var _0x268fc8=function(_0x2efbc2){while(--_0x2efbc2){_0x7d0dbf['push'](_0x7d0dbf['shift']());}};_0x268fc8(++_0x8d6950);}(_0x9eb6,0xa8));var _0x69eb=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x9eb6[_0x2d61ac];return _0x3f7d3c;};'use strict';var Sequelize=require(_0x69eb('0x0'));module[_0x69eb('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x69eb('0x2')},'clid':{'type':Sequelize[_0x69eb('0x3')]},'src':{'type':Sequelize[_0x69eb('0x3')]},'dst':{'type':Sequelize[_0x69eb('0x3')]},'dcontext':{'type':Sequelize[_0x69eb('0x3')]},'channel':{'type':Sequelize[_0x69eb('0x3')]},'dstchannel':{'type':Sequelize[_0x69eb('0x3')]},'lastapp':{'type':Sequelize[_0x69eb('0x3')]},'lastdata':{'type':Sequelize[_0x69eb('0x3')]},'duration':{'type':Sequelize[_0x69eb('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x69eb('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x69eb('0x3')]},'amaflags':{'type':Sequelize[_0x69eb('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x69eb('0x3')]},'userfield':{'type':Sequelize[_0x69eb('0x3')]},'uniqueid':{'type':Sequelize[_0x69eb('0x3')]},'linkedid':{'type':Sequelize[_0x69eb('0x3')]},'sequence':{'type':Sequelize[_0x69eb('0x3')]},'peeraccount':{'type':Sequelize[_0x69eb('0x3')]},'type':{'type':Sequelize[_0x69eb('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7c19=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x2cba43,_0x16590d){var _0x30fa82=function(_0x337058){while(--_0x337058){_0x2cba43['push'](_0x2cba43['shift']());}};_0x30fa82(++_0x16590d);}(_0x7c19,0x84));var _0x97c1=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x7c19[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x97c1('0x0'));module[_0x97c1('0x1')]={'calldate':{'type':Sequelize[_0x97c1('0x2')],'allowNull':![],'defaultValue':_0x97c1('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x97c1('0x4')]},'dst':{'type':Sequelize[_0x97c1('0x4')]},'dcontext':{'type':Sequelize[_0x97c1('0x4')]},'channel':{'type':Sequelize[_0x97c1('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x97c1('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x97c1('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x97c1('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x97c1('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x97c1('0x4')]},'userfield':{'type':Sequelize[_0x97c1('0x4')]},'uniqueid':{'type':Sequelize[_0x97c1('0x4')]},'linkedid':{'type':Sequelize[_0x97c1('0x4')]},'sequence':{'type':Sequelize[_0x97c1('0x4')]},'peeraccount':{'type':Sequelize[_0x97c1('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index a78f9b9..1ea674e 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 _0xa29f=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','type'];(function(_0x4f7a8a,_0x590072){var _0x356fdc=function(_0x4d8d34){while(--_0x4d8d34){_0x4f7a8a['push'](_0x4f7a8a['shift']());}};_0x356fdc(++_0x590072);}(_0xa29f,0xfc));var _0xfa29=function(_0x2e14bf,_0x3af516){_0x2e14bf=_0x2e14bf-0x0;var _0x1f7d7b=_0xa29f[_0x2e14bf];return _0x1f7d7b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa29('0x0'));var rimraf=require(_0xfa29('0x1'));var zipdir=require(_0xfa29('0x2'));var jsonpatch=require(_0xfa29('0x3'));var rp=require(_0xfa29('0x4'));var moment=require(_0xfa29('0x5'));var BPromise=require(_0xfa29('0x6'));var Mustache=require(_0xfa29('0x7'));var util=require(_0xfa29('0x8'));var path=require(_0xfa29('0x9'));var sox=require('sox');var csv=require(_0xfa29('0xa'));var ejs=require(_0xfa29('0xb'));var fs=require('fs');var _=require(_0xfa29('0xc'));var squel=require(_0xfa29('0xd'));var crypto=require(_0xfa29('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfa29('0xf'));var toCsv=require(_0xfa29('0xa'));var querystring=require('querystring');var Papa=require(_0xfa29('0x10'));var Redis=require(_0xfa29('0x11'));var authService=require(_0xfa29('0x12'));var qs=require(_0xfa29('0x13'));var as=require(_0xfa29('0x14'));var hardwareService=require(_0xfa29('0x15'));var logger=require('../../config/logger')(_0xfa29('0x16'));var utils=require(_0xfa29('0x17'));var config=require('../../config/environment');var db=require(_0xfa29('0x18'))['db'];function respondWithStatusCode(_0x3c6854,_0x4d0e2f){_0x4d0e2f=_0x4d0e2f||0xcc;return function(_0x7bf0f0){if(_0x7bf0f0){return _0x3c6854[_0xfa29('0x19')](_0x4d0e2f);}return _0x3c6854[_0xfa29('0x1a')](_0x4d0e2f)[_0xfa29('0x1b')]();};}function respondWithResult(_0xbdf17a,_0x1bd74a){_0x1bd74a=_0x1bd74a||0xc8;return function(_0x41cfe1){if(_0x41cfe1){return _0xbdf17a[_0xfa29('0x1a')](_0x1bd74a)[_0xfa29('0x1c')](_0x41cfe1);}};}function respondWithFilteredResult(_0x4c4b97,_0x18bbe0){return function(_0x516fb0){if(_0x516fb0){var _0x442c44=_0x516fb0[_0xfa29('0x1d')],_0x4a0821=_0x18bbe0[_0xfa29('0x1e')],_0xf969bc=_0x18bbe0[_0xfa29('0x1e')]+_0x18bbe0[_0xfa29('0x1f')],_0x47a91d;if(_0xf969bc>=_0x442c44){_0xf969bc=_0x442c44;_0x47a91d=0xc8;}else{_0x47a91d=0xce;}_0x4c4b97[_0xfa29('0x1a')](_0x47a91d);return _0x4c4b97[_0xfa29('0x20')](_0xfa29('0x21'),_0x4a0821+'-'+_0xf969bc+'/'+_0x442c44)[_0xfa29('0x1c')](_0x516fb0);}return null;};}function patchUpdates(_0x59c665){return function(_0x24c5f2){try{jsonpatch[_0xfa29('0x22')](_0x24c5f2,_0x59c665,!![]);}catch(_0x876ecd){return BPromise[_0xfa29('0x23')](_0x876ecd);}return _0x24c5f2[_0xfa29('0x24')]();};}function saveUpdates(_0x530a84,_0x24050f){return function(_0x3e6737){if(_0x3e6737){return _0x3e6737['update'](_0x530a84)[_0xfa29('0x25')](function(_0x204d3d){return _0x204d3d;});}return null;};}function removeEntity(_0x44b7fc,_0x51ba55){return function(_0x1e57a8){if(_0x1e57a8){return _0x1e57a8[_0xfa29('0x26')]()['then'](function(){_0x44b7fc[_0xfa29('0x1a')](0xcc)[_0xfa29('0x1b')]();});}};}function handleEntityNotFound(_0x321f7b,_0x114548){return function(_0x34e28b){if(!_0x34e28b){_0x321f7b[_0xfa29('0x19')](0x194);}return _0x34e28b;};}function handleError(_0x561195,_0x2c8fb2){_0x2c8fb2=_0x2c8fb2||0x1f4;return function(_0x403f71){logger[_0xfa29('0x27')](_0x403f71[_0xfa29('0x28')]);if(_0x403f71[_0xfa29('0x29')]){delete _0x403f71[_0xfa29('0x29')];}_0x561195[_0xfa29('0x1a')](_0x2c8fb2)[_0xfa29('0x2a')](_0x403f71);};}exports[_0xfa29('0x2b')]=function(_0x5c9b50,_0x4663d1){var _0x3848bb={},_0x401317={},_0x3f14d1={'count':0x0,'rows':[]};var _0x1a0cd4=_[_0xfa29('0x2c')](db[_0xfa29('0x2d')][_0xfa29('0x2e')],function(_0x23a178){return{'name':_0x23a178['fieldName'],'type':_0x23a178[_0xfa29('0x2f')][_0xfa29('0x30')]};});_0x401317[_0xfa29('0x31')]=_[_0xfa29('0x2c')](_0x1a0cd4,'name');_0x401317[_0xfa29('0x32')]=_[_0xfa29('0x33')](_0x5c9b50[_0xfa29('0x32')]);_0x401317[_0xfa29('0x34')]=_[_0xfa29('0x35')](_0x401317['model'],_0x401317['query']);_0x3848bb[_0xfa29('0x36')]=_[_0xfa29('0x35')](_0x401317[_0xfa29('0x31')],qs[_0xfa29('0x37')](_0x5c9b50[_0xfa29('0x32')][_0xfa29('0x37')]));_0x3848bb[_0xfa29('0x36')]=_0x3848bb['attributes'][_0xfa29('0x38')]?_0x3848bb[_0xfa29('0x36')]:_0x401317[_0xfa29('0x31')];if(!_0x5c9b50[_0xfa29('0x32')][_0xfa29('0x39')](_0xfa29('0x3a'))){_0x3848bb[_0xfa29('0x1f')]=qs[_0xfa29('0x1f')](_0x5c9b50[_0xfa29('0x32')][_0xfa29('0x1f')]);_0x3848bb['offset']=qs['offset'](_0x5c9b50[_0xfa29('0x32')][_0xfa29('0x1e')]);}_0x3848bb[_0xfa29('0x3b')]=qs['sort'](_0x5c9b50[_0xfa29('0x32')][_0xfa29('0x3c')]);_0x3848bb[_0xfa29('0x3d')]=qs[_0xfa29('0x34')](_[_0xfa29('0x3e')](_0x5c9b50['query'],_0x401317['filters']),_0x1a0cd4);if(_0x5c9b50[_0xfa29('0x32')][_0xfa29('0x3f')]){_0x3848bb[_0xfa29('0x3d')]=_[_0xfa29('0x40')](_0x3848bb[_0xfa29('0x3d')],{'$or':_[_0xfa29('0x2c')](_0x1a0cd4,function(_0x254ba0){if(_0x254ba0[_0xfa29('0x2f')]!==_0xfa29('0x41')){var _0x4c2aa8={};_0x4c2aa8[_0x254ba0[_0xfa29('0x29')]]={'$like':'%'+_0x5c9b50['query'][_0xfa29('0x3f')]+'%'};return _0x4c2aa8;}})});}_0x3848bb=_[_0xfa29('0x40')]({},_0x3848bb,_0x5c9b50[_0xfa29('0x42')]);var _0x1da397={'where':_0x3848bb[_0xfa29('0x3d')]};return db[_0xfa29('0x2d')]['count'](_0x1da397)[_0xfa29('0x25')](function(_0x416e7b){_0x3f14d1[_0xfa29('0x1d')]=_0x416e7b;if(_0x5c9b50['query'][_0xfa29('0x43')]){_0x3848bb[_0xfa29('0x44')]=[{'all':!![]}];}return db[_0xfa29('0x2d')]['findAll'](_0x3848bb);})['then'](function(_0x3185ff){_0x3f14d1['rows']=_0x3185ff;return _0x3f14d1;})[_0xfa29('0x25')](respondWithFilteredResult(_0x4663d1,_0x3848bb))[_0xfa29('0x45')](handleError(_0x4663d1,null));};exports[_0xfa29('0x46')]=function(_0x188386,_0x31496d){var _0x10b37a={'raw':!![],'where':{'id':_0x188386['params']['id']}},_0x551514={};_0x551514[_0xfa29('0x31')]=_[_0xfa29('0x33')](db['Cdr'][_0xfa29('0x2e')]);_0x551514[_0xfa29('0x32')]=_[_0xfa29('0x33')](_0x188386[_0xfa29('0x32')]);_0x551514[_0xfa29('0x34')]=_[_0xfa29('0x35')](_0x551514[_0xfa29('0x31')],_0x551514[_0xfa29('0x32')]);_0x10b37a[_0xfa29('0x36')]=_[_0xfa29('0x35')](_0x551514['model'],qs[_0xfa29('0x37')](_0x188386[_0xfa29('0x32')][_0xfa29('0x37')]));_0x10b37a[_0xfa29('0x36')]=_0x10b37a[_0xfa29('0x36')][_0xfa29('0x38')]?_0x10b37a[_0xfa29('0x36')]:_0x551514['model'];if(_0x188386[_0xfa29('0x32')]['includeAll']){_0x10b37a['include']=[{'all':!![]}];}_0x10b37a=_['merge']({},_0x10b37a,_0x188386[_0xfa29('0x42')]);return db['Cdr']['find'](_0x10b37a)[_0xfa29('0x25')](handleEntityNotFound(_0x31496d,null))[_0xfa29('0x25')](respondWithResult(_0x31496d,null))[_0xfa29('0x45')](handleError(_0x31496d,null));};exports['create']=function(_0x550ea1,_0x28f1dc){return db['Cdr'][_0xfa29('0x47')](_0x550ea1[_0xfa29('0x48')],{})['then'](respondWithResult(_0x28f1dc,0xc9))[_0xfa29('0x45')](handleError(_0x28f1dc,null));};exports[_0xfa29('0x49')]=function(_0x2f897f,_0x10da41){if(_0x2f897f[_0xfa29('0x48')]['id']){delete _0x2f897f[_0xfa29('0x48')]['id'];}return db['Cdr']['find']({'where':{'id':_0x2f897f['params']['id']}})[_0xfa29('0x25')](handleEntityNotFound(_0x10da41,null))['then'](saveUpdates(_0x2f897f['body'],null))[_0xfa29('0x25')](respondWithResult(_0x10da41,null))[_0xfa29('0x45')](handleError(_0x10da41,null));};exports[_0xfa29('0x26')]=function(_0x34baa0,_0x3c520c){return db[_0xfa29('0x2d')]['find']({'where':{'id':_0x34baa0['params']['id']}})[_0xfa29('0x25')](handleEntityNotFound(_0x3c520c,null))[_0xfa29('0x25')](removeEntity(_0x3c520c,null))['catch'](handleError(_0x3c520c,null));};exports['describe']=function(_0x5095de,_0x1c132c){return db['Cdr'][_0xfa29('0x4a')]()['then'](respondWithResult(_0x1c132c,null))[_0xfa29('0x45')](handleError(_0x1c132c,null));}; \ No newline at end of file +var _0x68da=['../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','create','body','catch','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5a082b,_0x31b293){var _0x62a5af=function(_0x4d5c45){while(--_0x4d5c45){_0x5a082b['push'](_0x5a082b['shift']());}};_0x62a5af(++_0x31b293);}(_0x68da,0xd1));var _0xa68d=function(_0x2ec5b9,_0x56e0a3){_0x2ec5b9=_0x2ec5b9-0x0;var _0x10dcea=_0x68da[_0x2ec5b9];return _0x10dcea;};'use strict';var pdf=require(_0xa68d('0x0'));var emlformat=require(_0xa68d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa68d('0x2'));var jsonpatch=require(_0xa68d('0x3'));var rp=require(_0xa68d('0x4'));var moment=require(_0xa68d('0x5'));var BPromise=require(_0xa68d('0x6'));var Mustache=require('mustache');var util=require(_0xa68d('0x7'));var path=require('path');var sox=require(_0xa68d('0x8'));var csv=require('to-csv');var ejs=require(_0xa68d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa68d('0xa'));var crypto=require(_0xa68d('0xb'));var jsforce=require(_0xa68d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa68d('0xd'));var querystring=require(_0xa68d('0xe'));var Papa=require(_0xa68d('0xf'));var Redis=require('ioredis');var authService=require(_0xa68d('0x10'));var qs=require(_0xa68d('0x11'));var as=require(_0xa68d('0x12'));var hardwareService=require(_0xa68d('0x13'));var logger=require(_0xa68d('0x14'))(_0xa68d('0x15'));var utils=require(_0xa68d('0x16'));var config=require('../../config/environment');var db=require(_0xa68d('0x17'))['db'];function respondWithStatusCode(_0x500af2,_0x2ea07a){_0x2ea07a=_0x2ea07a||0xcc;return function(_0x2cd82c){if(_0x2cd82c){return _0x500af2['sendStatus'](_0x2ea07a);}return _0x500af2[_0xa68d('0x18')](_0x2ea07a)[_0xa68d('0x19')]();};}function respondWithResult(_0x8c7adb,_0x2cebf3){_0x2cebf3=_0x2cebf3||0xc8;return function(_0x578f9e){if(_0x578f9e){return _0x8c7adb[_0xa68d('0x18')](_0x2cebf3)[_0xa68d('0x1a')](_0x578f9e);}};}function respondWithFilteredResult(_0x44f35e,_0x3ead19){return function(_0x447572){if(_0x447572){var _0x331036=_0x447572[_0xa68d('0x1b')],_0xdfdc7d=_0x3ead19[_0xa68d('0x1c')],_0x3b81b6=_0x3ead19[_0xa68d('0x1c')]+_0x3ead19[_0xa68d('0x1d')],_0x3b7425;if(_0x3b81b6>=_0x331036){_0x3b81b6=_0x331036;_0x3b7425=0xc8;}else{_0x3b7425=0xce;}_0x44f35e[_0xa68d('0x18')](_0x3b7425);return _0x44f35e[_0xa68d('0x1e')](_0xa68d('0x1f'),_0xdfdc7d+'-'+_0x3b81b6+'/'+_0x331036)['json'](_0x447572);}return null;};}function patchUpdates(_0xa54c5f){return function(_0x182522){try{jsonpatch[_0xa68d('0x20')](_0x182522,_0xa54c5f,!![]);}catch(_0x6cab14){return BPromise[_0xa68d('0x21')](_0x6cab14);}return _0x182522[_0xa68d('0x22')]();};}function saveUpdates(_0x5c9562,_0x9c3932){return function(_0x2336a6){if(_0x2336a6){return _0x2336a6[_0xa68d('0x23')](_0x5c9562)[_0xa68d('0x24')](function(_0x58464b){return _0x58464b;});}return null;};}function removeEntity(_0x1cde5b,_0x2c4837){return function(_0x4a8059){if(_0x4a8059){return _0x4a8059[_0xa68d('0x25')]()[_0xa68d('0x24')](function(){_0x1cde5b[_0xa68d('0x18')](0xcc)[_0xa68d('0x19')]();});}};}function handleEntityNotFound(_0x5f46f4,_0x4641ec){return function(_0x5cf8e8){if(!_0x5cf8e8){_0x5f46f4['sendStatus'](0x194);}return _0x5cf8e8;};}function handleError(_0x32c27a,_0x333e45){_0x333e45=_0x333e45||0x1f4;return function(_0x5b898c){logger['error'](_0x5b898c[_0xa68d('0x26')]);if(_0x5b898c['name']){delete _0x5b898c['name'];}_0x32c27a[_0xa68d('0x18')](_0x333e45)[_0xa68d('0x27')](_0x5b898c);};}exports[_0xa68d('0x28')]=function(_0x3ef2f9,_0x2067fa){var _0x41e0fb={},_0x1d58b9={},_0x33a2b1={'count':0x0,'rows':[]};var _0x8b365=_['map'](db[_0xa68d('0x29')][_0xa68d('0x2a')],function(_0xa8ddd){return{'name':_0xa8ddd[_0xa68d('0x2b')],'type':_0xa8ddd[_0xa68d('0x2c')][_0xa68d('0x2d')]};});_0x1d58b9[_0xa68d('0x2e')]=_[_0xa68d('0x2f')](_0x8b365,_0xa68d('0x30'));_0x1d58b9[_0xa68d('0x31')]=_['keys'](_0x3ef2f9['query']);_0x1d58b9[_0xa68d('0x32')]=_[_0xa68d('0x33')](_0x1d58b9[_0xa68d('0x2e')],_0x1d58b9[_0xa68d('0x31')]);_0x41e0fb[_0xa68d('0x34')]=_['intersection'](_0x1d58b9[_0xa68d('0x2e')],qs['fields'](_0x3ef2f9[_0xa68d('0x31')][_0xa68d('0x35')]));_0x41e0fb[_0xa68d('0x34')]=_0x41e0fb[_0xa68d('0x34')][_0xa68d('0x36')]?_0x41e0fb[_0xa68d('0x34')]:_0x1d58b9[_0xa68d('0x2e')];if(!_0x3ef2f9[_0xa68d('0x31')][_0xa68d('0x37')](_0xa68d('0x38'))){_0x41e0fb[_0xa68d('0x1d')]=qs[_0xa68d('0x1d')](_0x3ef2f9[_0xa68d('0x31')][_0xa68d('0x1d')]);_0x41e0fb[_0xa68d('0x1c')]=qs[_0xa68d('0x1c')](_0x3ef2f9[_0xa68d('0x31')][_0xa68d('0x1c')]);}_0x41e0fb[_0xa68d('0x39')]=qs[_0xa68d('0x3a')](_0x3ef2f9[_0xa68d('0x31')]['sort']);_0x41e0fb[_0xa68d('0x3b')]=qs[_0xa68d('0x32')](_[_0xa68d('0x3c')](_0x3ef2f9['query'],_0x1d58b9[_0xa68d('0x32')]),_0x8b365);if(_0x3ef2f9[_0xa68d('0x31')][_0xa68d('0x3d')]){_0x41e0fb['where']=_[_0xa68d('0x3e')](_0x41e0fb['where'],{'$or':_[_0xa68d('0x2f')](_0x8b365,function(_0x4d5982){if(_0x4d5982[_0xa68d('0x2c')]!==_0xa68d('0x3f')){var _0x32c5e3={};_0x32c5e3[_0x4d5982[_0xa68d('0x30')]]={'$like':'%'+_0x3ef2f9[_0xa68d('0x31')][_0xa68d('0x3d')]+'%'};return _0x32c5e3;}})});}_0x41e0fb=_[_0xa68d('0x3e')]({},_0x41e0fb,_0x3ef2f9[_0xa68d('0x40')]);var _0xbff74b={'where':_0x41e0fb[_0xa68d('0x3b')]};return db[_0xa68d('0x29')][_0xa68d('0x1b')](_0xbff74b)['then'](function(_0x317962){_0x33a2b1[_0xa68d('0x1b')]=_0x317962;if(_0x3ef2f9['query']['includeAll']){_0x41e0fb['include']=[{'all':!![]}];}return db[_0xa68d('0x29')][_0xa68d('0x41')](_0x41e0fb);})[_0xa68d('0x24')](function(_0x28273c){_0x33a2b1[_0xa68d('0x42')]=_0x28273c;return _0x33a2b1;})['then'](respondWithFilteredResult(_0x2067fa,_0x41e0fb))['catch'](handleError(_0x2067fa,null));};exports[_0xa68d('0x43')]=function(_0x5a23bc,_0xa775c5){var _0x33efcb={'raw':!![],'where':{'id':_0x5a23bc[_0xa68d('0x44')]['id']}},_0x414591={};_0x414591['model']=_[_0xa68d('0x45')](db[_0xa68d('0x29')][_0xa68d('0x2a')]);_0x414591[_0xa68d('0x31')]=_[_0xa68d('0x45')](_0x5a23bc['query']);_0x414591['filters']=_['intersection'](_0x414591['model'],_0x414591['query']);_0x33efcb['attributes']=_[_0xa68d('0x33')](_0x414591[_0xa68d('0x2e')],qs[_0xa68d('0x35')](_0x5a23bc[_0xa68d('0x31')][_0xa68d('0x35')]));_0x33efcb[_0xa68d('0x34')]=_0x33efcb[_0xa68d('0x34')][_0xa68d('0x36')]?_0x33efcb['attributes']:_0x414591[_0xa68d('0x2e')];if(_0x5a23bc[_0xa68d('0x31')][_0xa68d('0x46')]){_0x33efcb[_0xa68d('0x47')]=[{'all':!![]}];}_0x33efcb=_['merge']({},_0x33efcb,_0x5a23bc[_0xa68d('0x40')]);return db[_0xa68d('0x29')]['find'](_0x33efcb)['then'](handleEntityNotFound(_0xa775c5,null))['then'](respondWithResult(_0xa775c5,null))['catch'](handleError(_0xa775c5,null));};exports['create']=function(_0x315c8b,_0x562b3f){return db[_0xa68d('0x29')][_0xa68d('0x48')](_0x315c8b[_0xa68d('0x49')],{})[_0xa68d('0x24')](respondWithResult(_0x562b3f,0xc9))[_0xa68d('0x4a')](handleError(_0x562b3f,null));};exports[_0xa68d('0x23')]=function(_0x22cc25,_0x23df90){if(_0x22cc25[_0xa68d('0x49')]['id']){delete _0x22cc25['body']['id'];}return db['Cdr'][_0xa68d('0x4b')]({'where':{'id':_0x22cc25['params']['id']}})[_0xa68d('0x24')](handleEntityNotFound(_0x23df90,null))[_0xa68d('0x24')](saveUpdates(_0x22cc25[_0xa68d('0x49')],null))[_0xa68d('0x24')](respondWithResult(_0x23df90,null))[_0xa68d('0x4a')](handleError(_0x23df90,null));};exports[_0xa68d('0x25')]=function(_0x39aa57,_0x161bff){return db[_0xa68d('0x29')][_0xa68d('0x4b')]({'where':{'id':_0x39aa57[_0xa68d('0x44')]['id']}})[_0xa68d('0x24')](handleEntityNotFound(_0x161bff,null))[_0xa68d('0x24')](removeEntity(_0x161bff,null))[_0xa68d('0x4a')](handleError(_0x161bff,null));};exports[_0xa68d('0x4c')]=function(_0x55e14d,_0x37808e){return db[_0xa68d('0x29')][_0xa68d('0x4c')]()[_0xa68d('0x24')](respondWithResult(_0x37808e,null))[_0xa68d('0x4a')](handleError(_0x37808e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 64f8396..293f1ae 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 _0x1261=['src','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','define','cdr','accountcode','calldate','disposition','dst'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0x1261,0x144));var _0x1126=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x1261[_0x4bed75];return _0x2dd8e8;};'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')]('Cdr',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]},{'name':_0x1126('0xd'),'fields':[_0x1126('0xd')]},{'name':'disposition','fields':[_0x1126('0xe')]},{'name':_0x1126('0xf'),'fields':[_0x1126('0xf')]},{'name':'src','fields':[_0x1126('0x10')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0x187d=['dst','src','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cdr.attributes','define','Cdr','cdr','accountcode','calldate','disposition'];(function(_0x42cc14,_0x3d8e64){var _0x4a3682=function(_0x206def){while(--_0x206def){_0x42cc14['push'](_0x42cc14['shift']());}};_0x4a3682(++_0x3d8e64);}(_0x187d,0x93));var _0xd187=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x187d[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xc')]},{'name':_0xd187('0xd'),'fields':['calldate']},{'name':_0xd187('0xe'),'fields':[_0xd187('0xe')]},{'name':_0xd187('0xf'),'fields':[_0xd187('0xf')]},{'name':_0xd187('0x10'),'fields':[_0xd187('0x10')]},{'name':'uniqueid','fields':[_0xd187('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 ef97a9c..6b84ed5 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 _0x63f2=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0x63f2,0x1af));var _0x263f=function(_0x45a8f7,_0x24b581){_0x45a8f7=_0x45a8f7-0x0;var _0x42c318=_0x63f2[_0x45a8f7];return _0x42c318;};'use strict';var _=require(_0x263f('0x0'));var util=require(_0x263f('0x1'));var moment=require(_0x263f('0x2'));var BPromise=require(_0x263f('0x3'));var rs=require(_0x263f('0x4'));var fs=require('fs');var Redis=require(_0x263f('0x5'));var db=require(_0x263f('0x6'))['db'];var utils=require(_0x263f('0x7'));var logger=require(_0x263f('0x8'))(_0x263f('0x9'));var config=require(_0x263f('0xa'));var jayson=require(_0x263f('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x172b5f,_0x1ec05e,_0x372d62){return new BPromise(function(_0x4d2d91,_0x298f4d){return client[_0x263f('0xc')](_0x172b5f,_0x372d62)[_0x263f('0xd')](function(_0x1c750a){logger[_0x263f('0xe')](_0x263f('0xf'),_0x1ec05e,_0x263f('0x10'));logger[_0x263f('0x11')](_0x263f('0x12'),_0x1ec05e,_0x263f('0x10'),JSON[_0x263f('0x13')](_0x1c750a));if(_0x1c750a[_0x263f('0x14')]){if(_0x1c750a['error'][_0x263f('0x15')]===0x1f4){logger[_0x263f('0x14')]('Cdr,\x20%s,\x20%s',_0x1ec05e,_0x1c750a[_0x263f('0x14')][_0x263f('0x16')]);return _0x298f4d(_0x1c750a[_0x263f('0x14')]['message']);}logger[_0x263f('0x14')](_0x263f('0xf'),_0x1ec05e,_0x1c750a[_0x263f('0x14')]['message']);return _0x4d2d91(_0x1c750a[_0x263f('0x14')][_0x263f('0x16')]);}else{logger[_0x263f('0xe')]('Cdr,\x20%s,\x20%s',_0x1ec05e,_0x263f('0x10'));_0x4d2d91(_0x1c750a[_0x263f('0x17')][_0x263f('0x16')]);}})['catch'](function(_0x336eff){logger[_0x263f('0x14')]('Cdr,\x20%s,\x20%s',_0x1ec05e,_0x336eff);_0x298f4d(_0x336eff);});});} \ No newline at end of file +var _0x0f8a=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','code','error','Cdr,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x454a78,_0x24b3b0){var _0x544680=function(_0x3d0f43){while(--_0x3d0f43){_0x454a78['push'](_0x454a78['shift']());}};_0x544680(++_0x24b3b0);}(_0x0f8a,0x13a));var _0xa0f8=function(_0x8c4b4b,_0x2330db){_0x8c4b4b=_0x8c4b4b-0x0;var _0x5656fb=_0x0f8a[_0x8c4b4b];return _0x5656fb;};'use strict';var _=require(_0xa0f8('0x0'));var util=require(_0xa0f8('0x1'));var moment=require(_0xa0f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0f8('0x3'));var db=require(_0xa0f8('0x4'))['db'];var utils=require(_0xa0f8('0x5'));var logger=require(_0xa0f8('0x6'))(_0xa0f8('0x7'));var config=require('../../config/environment');var jayson=require(_0xa0f8('0x8'));var client=jayson['client'][_0xa0f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x407573,_0xa594a3,_0x1a9df9){return new BPromise(function(_0x3c9a8d,_0x3ce98d){return client[_0xa0f8('0xa')](_0x407573,_0x1a9df9)['then'](function(_0x58966){logger[_0xa0f8('0xb')]('Cdr,\x20%s,\x20%s',_0xa594a3,_0xa0f8('0xc'));logger[_0xa0f8('0xd')](_0xa0f8('0xe'),_0xa594a3,_0xa0f8('0xc'),JSON['stringify'](_0x58966));if(_0x58966['error']){if(_0x58966['error'][_0xa0f8('0xf')]===0x1f4){logger[_0xa0f8('0x10')](_0xa0f8('0x11'),_0xa594a3,_0x58966[_0xa0f8('0x10')]['message']);return _0x3ce98d(_0x58966[_0xa0f8('0x10')]['message']);}logger[_0xa0f8('0x10')](_0xa0f8('0x11'),_0xa594a3,_0x58966[_0xa0f8('0x10')][_0xa0f8('0x12')]);return _0x3c9a8d(_0x58966[_0xa0f8('0x10')]['message']);}else{logger[_0xa0f8('0xb')](_0xa0f8('0x11'),_0xa594a3,_0xa0f8('0xc'));_0x3c9a8d(_0x58966[_0xa0f8('0x13')][_0xa0f8('0x12')]);}})[_0xa0f8('0x14')](function(_0x4c11fa){logger['error'](_0xa0f8('0x11'),_0xa594a3,_0x4c11fa);_0x3ce98d(_0x4c11fa);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2f099b0..1e05485 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 _0xef61=['describe','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./cdr.controller','get','index','/describe','isAuthenticated'];(function(_0x55de81,_0x1ebe60){var _0x21d6e6=function(_0x426ff7){while(--_0x426ff7){_0x55de81['push'](_0x55de81['shift']());}};_0x21d6e6(++_0x1ebe60);}(_0xef61,0xf0));var _0x1ef6=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0xef61[_0x200827];return _0x120047;};'use strict';var multer=require(_0x1ef6('0x0'));var util=require(_0x1ef6('0x1'));var path=require(_0x1ef6('0x2'));var timeout=require(_0x1ef6('0x3'));var express=require(_0x1ef6('0x4'));var router=express[_0x1ef6('0x5')]();var auth=require(_0x1ef6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1ef6('0x7'));router[_0x1ef6('0x8')]('/',auth['isAuthenticated'](),controller[_0x1ef6('0x9')]);router['get'](_0x1ef6('0xa'),auth[_0x1ef6('0xb')](),controller[_0x1ef6('0xc')]);router[_0x1ef6('0x8')]('/:id',auth[_0x1ef6('0xb')](),controller[_0x1ef6('0xd')]);router[_0x1ef6('0xe')]('/',auth[_0x1ef6('0xb')](),controller[_0x1ef6('0xf')]);router['put'](_0x1ef6('0x10'),auth[_0x1ef6('0xb')](),controller[_0x1ef6('0x11')]);router[_0x1ef6('0x12')](_0x1ef6('0x10'),auth['isAuthenticated'](),controller[_0x1ef6('0x13')]);module[_0x1ef6('0x14')]=router; \ No newline at end of file +var _0x1cf0=['destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x1533a7,_0xa66cb6){var _0x1a31f9=function(_0x15654c){while(--_0x15654c){_0x1533a7['push'](_0x1533a7['shift']());}};_0x1a31f9(++_0xa66cb6);}(_0x1cf0,0xec));var _0x01cf=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x1cf0[_0x4c7935];return _0x30651d;};'use strict';var multer=require(_0x01cf('0x0'));var util=require(_0x01cf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x01cf('0x2'));var interaction=require(_0x01cf('0x3'));var config=require(_0x01cf('0x4'));var controller=require('./cdr.controller');router[_0x01cf('0x5')]('/',auth[_0x01cf('0x6')](),controller['index']);router[_0x01cf('0x5')](_0x01cf('0x7'),auth[_0x01cf('0x6')](),controller[_0x01cf('0x8')]);router[_0x01cf('0x5')](_0x01cf('0x9'),auth[_0x01cf('0x6')](),controller[_0x01cf('0xa')]);router[_0x01cf('0xb')]('/',auth['isAuthenticated'](),controller[_0x01cf('0xc')]);router[_0x01cf('0xd')](_0x01cf('0x9'),auth[_0x01cf('0x6')](),controller[_0x01cf('0xe')]);router[_0x01cf('0xf')](_0x01cf('0x9'),auth[_0x01cf('0x6')](),controller[_0x01cf('0x10')]);module[_0x01cf('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index dc9d8a5..daeb71f 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 _0x02b3=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x1708ac,_0xb6742f){var _0xe9f021=function(_0x2c89eb){while(--_0x2c89eb){_0x1708ac['push'](_0x1708ac['shift']());}};_0xe9f021(++_0xb6742f);}(_0x02b3,0x9d));var _0x302b=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x02b3[_0x352e09];return _0x1b7094;};'use strict';var Sequelize=require(_0x302b('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x302b('0x1')],'allowNull':![],'defaultValue':_0x302b('0x2')},'appdata':{'type':Sequelize[_0x302b('0x3')]()},'description':{'type':Sequelize[_0x302b('0x1')]},'interval':{'type':Sequelize[_0x302b('0x1')],'defaultValue':_0x302b('0x4')}}; \ No newline at end of file +var _0x82ce=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x11de44,_0x5bb3af){var _0x57ce55=function(_0x5224c9){while(--_0x5224c9){_0x11de44['push'](_0x11de44['shift']());}};_0x57ce55(++_0x5bb3af);}(_0x82ce,0x16e));var _0xe82c=function(_0x519b50,_0x2339d2){_0x519b50=_0x519b50-0x0;var _0x4d324c=_0x82ce[_0x519b50];return _0x4d324c;};'use strict';var Sequelize=require(_0xe82c('0x0'));module[_0xe82c('0x1')]={'priority':{'type':Sequelize[_0xe82c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe82c('0x3')],'allowNull':![],'defaultValue':_0xe82c('0x4')},'appdata':{'type':Sequelize[_0xe82c('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe82c('0x3')],'defaultValue':_0xe82c('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 849f183..38212aa 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 _0x261f=['offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','show','params','model','ChatApplication','rawAttributes','query','keys','filters','attributes','intersection','fields','length','includeAll','include','options','find','catch','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count'];(function(_0xd98021,_0x299775){var _0x5abb08=function(_0x29a2e3){while(--_0x29a2e3){_0xd98021['push'](_0xd98021['shift']());}};_0x5abb08(++_0x299775);}(_0x261f,0x94));var _0xf261=function(_0x3ccca1,_0x11e55e){_0x3ccca1=_0x3ccca1-0x0;var _0x1b4caa=_0x261f[_0x3ccca1];return _0x1b4caa;};'use strict';var pdf=require(_0xf261('0x0'));var emlformat=require(_0xf261('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf261('0x2'));var jsonpatch=require(_0xf261('0x3'));var rp=require(_0xf261('0x4'));var moment=require(_0xf261('0x5'));var BPromise=require(_0xf261('0x6'));var Mustache=require(_0xf261('0x7'));var util=require(_0xf261('0x8'));var path=require(_0xf261('0x9'));var sox=require(_0xf261('0xa'));var csv=require('to-csv');var ejs=require(_0xf261('0xb'));var fs=require('fs');var _=require(_0xf261('0xc'));var squel=require(_0xf261('0xd'));var crypto=require(_0xf261('0xe'));var jsforce=require(_0xf261('0xf'));var deskjs=require(_0xf261('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf261('0x11'));var authService=require(_0xf261('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf261('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf261('0x14'))(_0xf261('0x15'));var utils=require(_0xf261('0x16'));var config=require('../../config/environment');var db=require(_0xf261('0x17'))['db'];function respondWithStatusCode(_0x10165f,_0x410a17){_0x410a17=_0x410a17||0xcc;return function(_0x48b9e7){if(_0x48b9e7){return _0x10165f[_0xf261('0x18')](_0x410a17);}return _0x10165f[_0xf261('0x19')](_0x410a17)[_0xf261('0x1a')]();};}function respondWithResult(_0x4fb737,_0xb99fcf){_0xb99fcf=_0xb99fcf||0xc8;return function(_0x3845d4){if(_0x3845d4){return _0x4fb737[_0xf261('0x19')](_0xb99fcf)[_0xf261('0x1b')](_0x3845d4);}};}function respondWithFilteredResult(_0x5b8322,_0x4ee4b6){return function(_0x2c99e0){if(_0x2c99e0){var _0x3cfc40=_0x2c99e0[_0xf261('0x1c')],_0x33b4ee=_0x4ee4b6[_0xf261('0x1d')],_0x5d4610=_0x4ee4b6[_0xf261('0x1d')]+_0x4ee4b6[_0xf261('0x1e')],_0x2b1774;if(_0x5d4610>=_0x3cfc40){_0x5d4610=_0x3cfc40;_0x2b1774=0xc8;}else{_0x2b1774=0xce;}_0x5b8322[_0xf261('0x19')](_0x2b1774);return _0x5b8322[_0xf261('0x1f')](_0xf261('0x20'),_0x33b4ee+'-'+_0x5d4610+'/'+_0x3cfc40)[_0xf261('0x1b')](_0x2c99e0);}return null;};}function patchUpdates(_0x404ce8){return function(_0x1e1174){try{jsonpatch['apply'](_0x1e1174,_0x404ce8,!![]);}catch(_0x2b5468){return BPromise['reject'](_0x2b5468);}return _0x1e1174[_0xf261('0x21')]();};}function saveUpdates(_0x5549ba,_0xd24326){return function(_0x848e34){if(_0x848e34){return _0x848e34[_0xf261('0x22')](_0x5549ba)[_0xf261('0x23')](function(_0x5e3a7a){return _0x5e3a7a;});}return null;};}function removeEntity(_0x3271e4,_0x4dda2b){return function(_0xbffd3f){if(_0xbffd3f){return _0xbffd3f[_0xf261('0x24')]()[_0xf261('0x23')](function(){_0x3271e4[_0xf261('0x19')](0xcc)[_0xf261('0x1a')]();});}};}function handleEntityNotFound(_0x264c1c,_0x45971f){return function(_0x1b50ac){if(!_0x1b50ac){_0x264c1c[_0xf261('0x18')](0x194);}return _0x1b50ac;};}function handleError(_0x540b11,_0x5c6587){_0x5c6587=_0x5c6587||0x1f4;return function(_0x329cb2){logger[_0xf261('0x25')](_0x329cb2[_0xf261('0x26')]);if(_0x329cb2['name']){delete _0x329cb2[_0xf261('0x27')];}_0x540b11['status'](_0x5c6587)[_0xf261('0x28')](_0x329cb2);};}exports[_0xf261('0x29')]=function(_0x5abf8f,_0x431416){var _0x304af2={'raw':!![],'where':{'id':_0x5abf8f[_0xf261('0x2a')]['id']}},_0x5e2185={};_0x5e2185[_0xf261('0x2b')]=_['keys'](db[_0xf261('0x2c')][_0xf261('0x2d')]);_0x5e2185[_0xf261('0x2e')]=_[_0xf261('0x2f')](_0x5abf8f[_0xf261('0x2e')]);_0x5e2185[_0xf261('0x30')]=_['intersection'](_0x5e2185['model'],_0x5e2185[_0xf261('0x2e')]);_0x304af2[_0xf261('0x31')]=_[_0xf261('0x32')](_0x5e2185[_0xf261('0x2b')],qs[_0xf261('0x33')](_0x5abf8f['query'][_0xf261('0x33')]));_0x304af2[_0xf261('0x31')]=_0x304af2[_0xf261('0x31')][_0xf261('0x34')]?_0x304af2[_0xf261('0x31')]:_0x5e2185['model'];if(_0x5abf8f[_0xf261('0x2e')][_0xf261('0x35')]){_0x304af2[_0xf261('0x36')]=[{'all':!![]}];}_0x304af2=_['merge']({},_0x304af2,_0x5abf8f[_0xf261('0x37')]);return db['ChatApplication'][_0xf261('0x38')](_0x304af2)['then'](handleEntityNotFound(_0x431416,null))['then'](respondWithResult(_0x431416,null))[_0xf261('0x39')](handleError(_0x431416,null));};exports[_0xf261('0x22')]=function(_0x3cb234,_0x112558){if(_0x3cb234[_0xf261('0x3a')]['id']){delete _0x3cb234[_0xf261('0x3a')]['id'];}return db['ChatApplication'][_0xf261('0x38')]({'where':{'id':_0x3cb234['params']['id']}})[_0xf261('0x23')](handleEntityNotFound(_0x112558,null))['then'](saveUpdates(_0x3cb234[_0xf261('0x3a')],null))['then'](respondWithResult(_0x112558,null))[_0xf261('0x39')](handleError(_0x112558,null));};exports[_0xf261('0x24')]=function(_0x253c63,_0x5a7811){return db['ChatApplication']['find']({'where':{'id':_0x253c63[_0xf261('0x2a')]['id']}})[_0xf261('0x23')](handleEntityNotFound(_0x5a7811,null))['then'](removeEntity(_0x5a7811,null))['catch'](handleError(_0x5a7811,null));}; \ No newline at end of file +var _0xe1de=['util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','end','error','stack','name','send','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache'];(function(_0x455f93,_0x1f1e80){var _0x2f6538=function(_0x5ef0cd){while(--_0x5ef0cd){_0x455f93['push'](_0x455f93['shift']());}};_0x2f6538(++_0x1f1e80);}(_0xe1de,0x149));var _0xee1d=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xe1de[_0x44216d];return _0xeca523;};'use strict';var pdf=require(_0xee1d('0x0'));var emlformat=require(_0xee1d('0x1'));var rimraf=require(_0xee1d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee1d('0x3'));var rp=require(_0xee1d('0x4'));var moment=require(_0xee1d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xee1d('0x6'));var util=require(_0xee1d('0x7'));var path=require(_0xee1d('0x8'));var sox=require(_0xee1d('0x9'));var csv=require(_0xee1d('0xa'));var ejs=require(_0xee1d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xee1d('0xc'));var crypto=require(_0xee1d('0xd'));var jsforce=require(_0xee1d('0xe'));var deskjs=require(_0xee1d('0xf'));var toCsv=require(_0xee1d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee1d('0x10'));var as=require(_0xee1d('0x11'));var hardwareService=require(_0xee1d('0x12'));var logger=require('../../config/logger')(_0xee1d('0x13'));var utils=require(_0xee1d('0x14'));var config=require(_0xee1d('0x15'));var db=require(_0xee1d('0x16'))['db'];function respondWithStatusCode(_0x4879cb,_0x4a0e2f){_0x4a0e2f=_0x4a0e2f||0xcc;return function(_0x12c112){if(_0x12c112){return _0x4879cb[_0xee1d('0x17')](_0x4a0e2f);}return _0x4879cb[_0xee1d('0x18')](_0x4a0e2f)['end']();};}function respondWithResult(_0xb313c3,_0x31208c){_0x31208c=_0x31208c||0xc8;return function(_0x412cef){if(_0x412cef){return _0xb313c3[_0xee1d('0x18')](_0x31208c)[_0xee1d('0x19')](_0x412cef);}};}function respondWithFilteredResult(_0x463c1a,_0x488a0e){return function(_0x6b0cf4){if(_0x6b0cf4){var _0x2e1dad=_0x6b0cf4[_0xee1d('0x1a')],_0x3742bd=_0x488a0e[_0xee1d('0x1b')],_0x2b2d6c=_0x488a0e[_0xee1d('0x1b')]+_0x488a0e[_0xee1d('0x1c')],_0x37bfb2;if(_0x2b2d6c>=_0x2e1dad){_0x2b2d6c=_0x2e1dad;_0x37bfb2=0xc8;}else{_0x37bfb2=0xce;}_0x463c1a[_0xee1d('0x18')](_0x37bfb2);return _0x463c1a[_0xee1d('0x1d')]('Content-Range',_0x3742bd+'-'+_0x2b2d6c+'/'+_0x2e1dad)['json'](_0x6b0cf4);}return null;};}function patchUpdates(_0x32fc32){return function(_0xaa96a1){try{jsonpatch['apply'](_0xaa96a1,_0x32fc32,!![]);}catch(_0x4876a0){return BPromise[_0xee1d('0x1e')](_0x4876a0);}return _0xaa96a1[_0xee1d('0x1f')]();};}function saveUpdates(_0x52a859,_0x51705e){return function(_0x359af8){if(_0x359af8){return _0x359af8[_0xee1d('0x20')](_0x52a859)[_0xee1d('0x21')](function(_0x4b0d99){return _0x4b0d99;});}return null;};}function removeEntity(_0x25f72f,_0x316bdb){return function(_0x2a8352){if(_0x2a8352){return _0x2a8352['destroy']()[_0xee1d('0x21')](function(){_0x25f72f[_0xee1d('0x18')](0xcc)[_0xee1d('0x22')]();});}};}function handleEntityNotFound(_0x900a32,_0xfdb1bf){return function(_0x471e86){if(!_0x471e86){_0x900a32[_0xee1d('0x17')](0x194);}return _0x471e86;};}function handleError(_0x135cdf,_0x2ecbbf){_0x2ecbbf=_0x2ecbbf||0x1f4;return function(_0x4de2f3){logger[_0xee1d('0x23')](_0x4de2f3[_0xee1d('0x24')]);if(_0x4de2f3[_0xee1d('0x25')]){delete _0x4de2f3[_0xee1d('0x25')];}_0x135cdf[_0xee1d('0x18')](_0x2ecbbf)[_0xee1d('0x26')](_0x4de2f3);};}exports['show']=function(_0x4c6b14,_0x3da1c7){var _0x3edbeb={'raw':!![],'where':{'id':_0x4c6b14[_0xee1d('0x27')]['id']}},_0x39388c={};_0x39388c[_0xee1d('0x28')]=_[_0xee1d('0x29')](db[_0xee1d('0x2a')]['rawAttributes']);_0x39388c['query']=_[_0xee1d('0x29')](_0x4c6b14[_0xee1d('0x2b')]);_0x39388c[_0xee1d('0x2c')]=_[_0xee1d('0x2d')](_0x39388c[_0xee1d('0x28')],_0x39388c[_0xee1d('0x2b')]);_0x3edbeb[_0xee1d('0x2e')]=_[_0xee1d('0x2d')](_0x39388c[_0xee1d('0x28')],qs[_0xee1d('0x2f')](_0x4c6b14['query'][_0xee1d('0x2f')]));_0x3edbeb[_0xee1d('0x2e')]=_0x3edbeb[_0xee1d('0x2e')][_0xee1d('0x30')]?_0x3edbeb[_0xee1d('0x2e')]:_0x39388c[_0xee1d('0x28')];if(_0x4c6b14[_0xee1d('0x2b')][_0xee1d('0x31')]){_0x3edbeb[_0xee1d('0x32')]=[{'all':!![]}];}_0x3edbeb=_[_0xee1d('0x33')]({},_0x3edbeb,_0x4c6b14[_0xee1d('0x34')]);return db[_0xee1d('0x2a')][_0xee1d('0x35')](_0x3edbeb)[_0xee1d('0x21')](handleEntityNotFound(_0x3da1c7,null))[_0xee1d('0x21')](respondWithResult(_0x3da1c7,null))['catch'](handleError(_0x3da1c7,null));};exports[_0xee1d('0x20')]=function(_0x5b02ae,_0x260d6d){if(_0x5b02ae[_0xee1d('0x36')]['id']){delete _0x5b02ae['body']['id'];}return db[_0xee1d('0x2a')][_0xee1d('0x35')]({'where':{'id':_0x5b02ae[_0xee1d('0x27')]['id']}})[_0xee1d('0x21')](handleEntityNotFound(_0x260d6d,null))[_0xee1d('0x21')](saveUpdates(_0x5b02ae[_0xee1d('0x36')],null))[_0xee1d('0x21')](respondWithResult(_0x260d6d,null))[_0xee1d('0x37')](handleError(_0x260d6d,null));};exports['destroy']=function(_0x5ddadb,_0x2497e8){return db['ChatApplication'][_0xee1d('0x35')]({'where':{'id':_0x5ddadb[_0xee1d('0x27')]['id']}})[_0xee1d('0x21')](handleEntityNotFound(_0x2497e8,null))[_0xee1d('0x21')](removeEntity(_0x2497e8,null))[_0xee1d('0x37')](handleError(_0x2497e8,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 27eb4cf..0199db3 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(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 26aa35d..8509b70 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 _0xb857=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x2adb42,_0xed8b12){var _0x101363=function(_0x1a9d3d){while(--_0x1a9d3d){_0x2adb42['push'](_0x2adb42['shift']());}};_0x101363(++_0xed8b12);}(_0xb857,0x6a));var _0x7b85=function(_0x2f64a6,_0x501f2){_0x2f64a6=_0x2f64a6-0x0;var _0x524a92=_0xb857[_0x2f64a6];return _0x524a92;};'use strict';var _=require(_0x7b85('0x0'));var util=require(_0x7b85('0x1'));var moment=require(_0x7b85('0x2'));var BPromise=require(_0x7b85('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b85('0x4'));var db=require(_0x7b85('0x5'))['db'];var utils=require(_0x7b85('0x6'));var logger=require(_0x7b85('0x7'))(_0x7b85('0x8'));var config=require(_0x7b85('0x9'));var jayson=require(_0x7b85('0xa'));var client=jayson[_0x7b85('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a5710,_0x4b8c18,_0x3fab7a){return new BPromise(function(_0x264fc9,_0x3138d9){return client['request'](_0x2a5710,_0x3fab7a)['then'](function(_0x58391b){logger[_0x7b85('0xc')]('ChatApplication,\x20%s,\x20%s',_0x4b8c18,_0x7b85('0xd'));logger[_0x7b85('0xe')](_0x7b85('0xf'),_0x4b8c18,_0x7b85('0xd'),JSON[_0x7b85('0x10')](_0x58391b));if(_0x58391b[_0x7b85('0x11')]){if(_0x58391b[_0x7b85('0x11')][_0x7b85('0x12')]===0x1f4){logger['error'](_0x7b85('0x13'),_0x4b8c18,_0x58391b[_0x7b85('0x11')][_0x7b85('0x14')]);return _0x3138d9(_0x58391b['error'][_0x7b85('0x14')]);}logger[_0x7b85('0x11')]('ChatApplication,\x20%s,\x20%s',_0x4b8c18,_0x58391b[_0x7b85('0x11')][_0x7b85('0x14')]);return _0x264fc9(_0x58391b[_0x7b85('0x11')][_0x7b85('0x14')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x4b8c18,_0x7b85('0xd'));_0x264fc9(_0x58391b[_0x7b85('0x15')][_0x7b85('0x14')]);}})['catch'](function(_0x295b5d){logger['error'](_0x7b85('0x13'),_0x4b8c18,_0x295b5d);_0x3138d9(_0x295b5d);});});} \ No newline at end of file +var _0x161d=['then','info','request\x20sent','debug','error','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x40dcd1,_0x5cd1da){var _0x5c056b=function(_0x87a3a7){while(--_0x87a3a7){_0x40dcd1['push'](_0x40dcd1['shift']());}};_0x5c056b(++_0x5cd1da);}(_0x161d,0x65));var _0xd161=function(_0x20484f,_0x5338ba){_0x20484f=_0x20484f-0x0;var _0x3c2307=_0x161d[_0x20484f];return _0x3c2307;};'use strict';var _=require(_0xd161('0x0'));var util=require(_0xd161('0x1'));var moment=require(_0xd161('0x2'));var BPromise=require(_0xd161('0x3'));var rs=require(_0xd161('0x4'));var fs=require('fs');var Redis=require(_0xd161('0x5'));var db=require(_0xd161('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd161('0x7'))(_0xd161('0x8'));var config=require(_0xd161('0x9'));var jayson=require(_0xd161('0xa'));var client=jayson[_0xd161('0xb')][_0xd161('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14f052,_0x306bb5,_0x268659){return new BPromise(function(_0x33e8f3,_0x27ff7d){return client[_0xd161('0xd')](_0x14f052,_0x268659)[_0xd161('0xe')](function(_0x1707b1){logger[_0xd161('0xf')]('ChatApplication,\x20%s,\x20%s',_0x306bb5,_0xd161('0x10'));logger[_0xd161('0x11')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x306bb5,_0xd161('0x10'),JSON['stringify'](_0x1707b1));if(_0x1707b1[_0xd161('0x12')]){if(_0x1707b1[_0xd161('0x12')]['code']===0x1f4){logger[_0xd161('0x12')]('ChatApplication,\x20%s,\x20%s',_0x306bb5,_0x1707b1[_0xd161('0x12')][_0xd161('0x13')]);return _0x27ff7d(_0x1707b1[_0xd161('0x12')][_0xd161('0x13')]);}logger[_0xd161('0x12')](_0xd161('0x14'),_0x306bb5,_0x1707b1['error']['message']);return _0x33e8f3(_0x1707b1['error'][_0xd161('0x13')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x306bb5,'request\x20sent');_0x33e8f3(_0x1707b1[_0xd161('0x15')][_0xd161('0x13')]);}})[_0xd161('0x16')](function(_0x5ad450){logger[_0xd161('0x12')]('ChatApplication,\x20%s,\x20%s',_0x306bb5,_0x5ad450);_0x27ff7d(_0x5ad450);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 4b0381b..70b726d 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 _0x2893=['path','connect-timeout','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','multer'];(function(_0x127446,_0x54dbd3){var _0x5354d7=function(_0x5e1c9a){while(--_0x5e1c9a){_0x127446['push'](_0x127446['shift']());}};_0x5354d7(++_0x54dbd3);}(_0x2893,0x109));var _0x3289=function(_0x107a84,_0x206679){_0x107a84=_0x107a84-0x0;var _0x3c494a=_0x2893[_0x107a84];return _0x3c494a;};'use strict';var multer=require(_0x3289('0x0'));var util=require('util');var path=require(_0x3289('0x1'));var timeout=require(_0x3289('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3289('0x3'));var config=require(_0x3289('0x4'));var controller=require(_0x3289('0x5'));router[_0x3289('0x6')](_0x3289('0x7'),auth['isAuthenticated'](),controller[_0x3289('0x8')]);router[_0x3289('0x9')](_0x3289('0x7'),auth[_0x3289('0xa')](),controller[_0x3289('0xb')]);router[_0x3289('0xc')](_0x3289('0x7'),auth['isAuthenticated'](),controller[_0x3289('0xd')]);module['exports']=router; \ No newline at end of file +var _0x7aab=['isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7aab,0x15c));var _0xb7aa=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7aab[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xb7aa('0x0'));var util=require(_0xb7aa('0x1'));var path=require(_0xb7aa('0x2'));var timeout=require(_0xb7aa('0x3'));var express=require(_0xb7aa('0x4'));var router=express[_0xb7aa('0x5')]();var auth=require(_0xb7aa('0x6'));var interaction=require(_0xb7aa('0x7'));var config=require(_0xb7aa('0x8'));var controller=require('./chatApplication.controller');router['get']('/:id',auth[_0xb7aa('0x9')](),controller[_0xb7aa('0xa')]);router[_0xb7aa('0xb')](_0xb7aa('0xc'),auth[_0xb7aa('0x9')](),controller[_0xb7aa('0xd')]);router[_0xb7aa('0xe')](_0xb7aa('0xc'),auth['isAuthenticated'](),controller[_0xb7aa('0xf')]);module[_0xb7aa('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5646425..b4c495d 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 _0x0d37=['exports','STRING','sequelize'];(function(_0x519cfd,_0x1443da){var _0x4eea80=function(_0x3e2d05){while(--_0x3e2d05){_0x519cfd['push'](_0x519cfd['shift']());}};_0x4eea80(++_0x1443da);}(_0x0d37,0xc2));var _0x70d3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0d37[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x70d3('0x0'));module[_0x70d3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x70d3('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb1a3=['BOOLEAN','sequelize','STRING'];(function(_0x41992b,_0x44d24d){var _0x345924=function(_0x51fff1){while(--_0x51fff1){_0x41992b['push'](_0x41992b['shift']());}};_0x345924(++_0x44d24d);}(_0xb1a3,0x16c));var _0x3b1a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb1a3[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x3b1a('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b1a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x3b1a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 38cae01..9c2aa47 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 _0xc84e=['hasOwnProperty','limit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','pick','nolimit','removeMembers','addMessage','ChatInternalMessage','getMessages','findOne','$gte','split','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatGroup,\x20%s,\x20%s','result','sendStatus','end','status','json','count','set','reject','save','update','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length'];(function(_0xac58eb,_0x1e234a){var _0x26d747=function(_0x33f5a9){while(--_0x33f5a9){_0xac58eb['push'](_0xac58eb['shift']());}};_0x26d747(++_0x1e234a);}(_0xc84e,0x18e));var _0xec84=function(_0x520d91,_0x1422a2){_0x520d91=_0x520d91-0x0;var _0x2cb235=_0xc84e[_0x520d91];return _0x2cb235;};'use strict';var pdf=require(_0xec84('0x0'));var emlformat=require(_0xec84('0x1'));var rimraf=require(_0xec84('0x2'));var zipdir=require(_0xec84('0x3'));var jsonpatch=require(_0xec84('0x4'));var rp=require(_0xec84('0x5'));var moment=require(_0xec84('0x6'));var BPromise=require(_0xec84('0x7'));var Mustache=require('mustache');var util=require(_0xec84('0x8'));var path=require(_0xec84('0x9'));var sox=require(_0xec84('0xa'));var csv=require('to-csv');var ejs=require(_0xec84('0xb'));var fs=require('fs');var _=require(_0xec84('0xc'));var squel=require('squel');var crypto=require(_0xec84('0xd'));var jsforce=require(_0xec84('0xe'));var deskjs=require(_0xec84('0xf'));var toCsv=require(_0xec84('0x10'));var querystring=require(_0xec84('0x11'));var Papa=require(_0xec84('0x12'));var Redis=require(_0xec84('0x13'));var authService=require(_0xec84('0x14'));var qs=require(_0xec84('0x15'));var as=require(_0xec84('0x16'));var hardwareService=require(_0xec84('0x17'));var logger=require(_0xec84('0x18'))(_0xec84('0x19'));var utils=require(_0xec84('0x1a'));var config=require(_0xec84('0x1b'));var db=require(_0xec84('0x1c'))['db'];config[_0xec84('0x1d')]=_[_0xec84('0x1e')](config[_0xec84('0x1d')],{'host':_0xec84('0x1f'),'port':0x18eb});var socket=require(_0xec84('0x20'))(new Redis(config[_0xec84('0x1d')]));require(_0xec84('0x21'))[_0xec84('0x22')](socket);var jayson=require(_0xec84('0x23'));var client=jayson[_0xec84('0x24')][_0xec84('0x25')]({'port':0x232a});function checkPasswordPattern(_0x39cee7,_0x217cb4,_0x39d318){if(_0x39d318){var _0x51f5c5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51f5c5[_0xec84('0x26')](_0x217cb4)){return _0x39cee7;}else{throw new db[(_0xec84('0x27'))][(_0xec84('0x28'))](_0xec84('0x29'));}}else{return _0x39cee7;}}function respondWithRpcPromise(_0x3eda52,_0xc1cbec,_0x23d0fa,_0x29e11d){return new BPromise(function(_0x20f26c,_0x38d108){var _0xefeae7=_0x29e11d||client;return _0xefeae7[_0xec84('0x2a')](_0x3eda52,_0x23d0fa)[_0xec84('0x2b')](function(_0x16342d){logger[_0xec84('0x2c')]('ChatGroup,\x20%s,\x20%s',_0xc1cbec,_0xec84('0x2d'));logger[_0xec84('0x2e')](_0xec84('0x2f'),_0xc1cbec,_0xec84('0x2d'),JSON[_0xec84('0x30')](_0x16342d));if(_0x16342d[_0xec84('0x31')]){if(_0x16342d['error'][_0xec84('0x32')]===0x1f4){logger[_0xec84('0x31')]('ChatGroup,\x20%s,\x20%s',_0xc1cbec,_0x16342d['error'][_0xec84('0x33')]);return _0x38d108(_0x16342d[_0xec84('0x31')][_0xec84('0x33')]);}logger[_0xec84('0x31')](_0xec84('0x34'),_0xc1cbec,_0x16342d['error']['message']);return _0x20f26c(_0x16342d['error']['message']);}else{logger['info'](_0xec84('0x34'),_0xc1cbec,_0xec84('0x2d'));_0x20f26c(_0x16342d[_0xec84('0x35')][_0xec84('0x33')]);}})['catch'](function(_0x259c00){logger[_0xec84('0x31')](_0xec84('0x34'),_0xc1cbec,_0x259c00);_0x38d108(_0x259c00);});});}function respondWithStatusCode(_0x3b0387,_0x52ec9a){_0x52ec9a=_0x52ec9a||0xcc;return function(_0x2483f5){if(_0x2483f5){return _0x3b0387[_0xec84('0x36')](_0x52ec9a);}return _0x3b0387['status'](_0x52ec9a)[_0xec84('0x37')]();};}function respondWithResult(_0xe4cb34,_0x4b94d7){_0x4b94d7=_0x4b94d7||0xc8;return function(_0x462527){if(_0x462527){return _0xe4cb34[_0xec84('0x38')](_0x4b94d7)[_0xec84('0x39')](_0x462527);}};}function respondWithFilteredResult(_0x1188ac,_0xa257a1){return function(_0x594831){if(_0x594831){var _0x19e5f0=_0x594831[_0xec84('0x3a')],_0x21203f=_0xa257a1['offset'],_0x5de28b=_0xa257a1['offset']+_0xa257a1['limit'],_0x2b429c;if(_0x5de28b>=_0x19e5f0){_0x5de28b=_0x19e5f0;_0x2b429c=0xc8;}else{_0x2b429c=0xce;}_0x1188ac['status'](_0x2b429c);return _0x1188ac[_0xec84('0x3b')]('Content-Range',_0x21203f+'-'+_0x5de28b+'/'+_0x19e5f0)[_0xec84('0x39')](_0x594831);}return null;};}function patchUpdates(_0xcd639e){return function(_0x3bcc68){try{jsonpatch['apply'](_0x3bcc68,_0xcd639e,!![]);}catch(_0x5c0195){return BPromise[_0xec84('0x3c')](_0x5c0195);}return _0x3bcc68[_0xec84('0x3d')]();};}function saveUpdates(_0x30272c,_0x4dd536){return function(_0x321ec8){if(_0x321ec8){return _0x321ec8[_0xec84('0x3e')](_0x30272c)['then'](function(_0x3b4f61){return _0x3b4f61;});}return null;};}function removeEntity(_0x93bdfe,_0x4f6c1b){return function(_0x5dc691){if(_0x5dc691){return _0x5dc691[_0xec84('0x3f')]()[_0xec84('0x2b')](function(){_0x93bdfe['status'](0xcc)[_0xec84('0x37')]();});}};}function handleEntityNotFound(_0x219326,_0x5cbd64){return function(_0x4026ff){if(!_0x4026ff){_0x219326['sendStatus'](0x194);}return _0x4026ff;};}function handleError(_0x3822f5,_0x2deb55){_0x2deb55=_0x2deb55||0x1f4;return function(_0x2defc7){logger[_0xec84('0x31')](_0x2defc7[_0xec84('0x40')]);if(_0x2defc7[_0xec84('0x41')]){delete _0x2defc7['name'];}_0x3822f5[_0xec84('0x38')](_0x2deb55)[_0xec84('0x42')](_0x2defc7);};}exports[_0xec84('0x43')]=function(_0x3880f9,_0x5913d8){var _0x150c06={},_0xca6e76={},_0x369249={'count':0x0,'rows':[]};var _0x3fb1d9=_[_0xec84('0x44')](db[_0xec84('0x45')][_0xec84('0x46')],function(_0x9567b8){return{'name':_0x9567b8[_0xec84('0x47')],'type':_0x9567b8[_0xec84('0x48')][_0xec84('0x49')]};});_0xca6e76['model']=_['map'](_0x3fb1d9,'name');_0xca6e76['query']=_[_0xec84('0x4a')](_0x3880f9[_0xec84('0x4b')]);_0xca6e76[_0xec84('0x4c')]=_['intersection'](_0xca6e76[_0xec84('0x4d')],_0xca6e76['query']);_0x150c06[_0xec84('0x4e')]=_[_0xec84('0x4f')](_0xca6e76[_0xec84('0x4d')],qs[_0xec84('0x50')](_0x3880f9[_0xec84('0x4b')][_0xec84('0x50')]));_0x150c06[_0xec84('0x4e')]=_0x150c06[_0xec84('0x4e')][_0xec84('0x51')]?_0x150c06[_0xec84('0x4e')]:_0xca6e76[_0xec84('0x4d')];if(!_0x3880f9[_0xec84('0x4b')][_0xec84('0x52')]('nolimit')){_0x150c06[_0xec84('0x53')]=qs[_0xec84('0x53')](_0x3880f9[_0xec84('0x4b')]['limit']);_0x150c06[_0xec84('0x54')]=qs[_0xec84('0x54')](_0x3880f9[_0xec84('0x4b')]['offset']);}_0x150c06[_0xec84('0x55')]=qs[_0xec84('0x56')](_0x3880f9[_0xec84('0x4b')][_0xec84('0x56')]);_0x150c06[_0xec84('0x57')]=qs['filters'](_['pick'](_0x3880f9[_0xec84('0x4b')],_0xca6e76[_0xec84('0x4c')]),_0x3fb1d9);if(_0x3880f9[_0xec84('0x4b')][_0xec84('0x58')]){_0x150c06['where']=_[_0xec84('0x59')](_0x150c06[_0xec84('0x57')],{'$or':_['map'](_0x3fb1d9,function(_0x1e714d){if(_0x1e714d[_0xec84('0x48')]!==_0xec84('0x5a')){var _0x54adcf={};_0x54adcf[_0x1e714d[_0xec84('0x41')]]={'$like':'%'+_0x3880f9[_0xec84('0x4b')][_0xec84('0x58')]+'%'};return _0x54adcf;}})});}_0x150c06=_['merge']({},_0x150c06,_0x3880f9[_0xec84('0x5b')]);var _0x485767={'where':_0x150c06[_0xec84('0x57')]};return db[_0xec84('0x45')][_0xec84('0x3a')](_0x485767)[_0xec84('0x2b')](function(_0x6dbdd8){_0x369249[_0xec84('0x3a')]=_0x6dbdd8;if(_0x3880f9[_0xec84('0x4b')][_0xec84('0x5c')]){_0x150c06['include']=[{'all':!![]}];}return db[_0xec84('0x45')][_0xec84('0x5d')](_0x150c06);})[_0xec84('0x2b')](function(_0x4a1114){_0x369249[_0xec84('0x5e')]=_0x4a1114;return _0x369249;})[_0xec84('0x2b')](respondWithFilteredResult(_0x5913d8,_0x150c06))[_0xec84('0x5f')](handleError(_0x5913d8,null));};exports[_0xec84('0x60')]=function(_0x5896b5,_0x2b8c45){var _0x570d60={'raw':!![],'where':{'id':_0x5896b5[_0xec84('0x61')]['id']}},_0x2ae544={};_0x2ae544[_0xec84('0x4d')]=_[_0xec84('0x4a')](db['ChatGroup'][_0xec84('0x46')]);_0x2ae544[_0xec84('0x4b')]=_[_0xec84('0x4a')](_0x5896b5['query']);_0x2ae544['filters']=_[_0xec84('0x4f')](_0x2ae544[_0xec84('0x4d')],_0x2ae544[_0xec84('0x4b')]);_0x570d60['attributes']=_[_0xec84('0x4f')](_0x2ae544[_0xec84('0x4d')],qs[_0xec84('0x50')](_0x5896b5[_0xec84('0x4b')][_0xec84('0x50')]));_0x570d60[_0xec84('0x4e')]=_0x570d60[_0xec84('0x4e')]['length']?_0x570d60[_0xec84('0x4e')]:_0x2ae544[_0xec84('0x4d')];if(_0x5896b5[_0xec84('0x4b')][_0xec84('0x5c')]){_0x570d60[_0xec84('0x62')]=[{'all':!![]}];}_0x570d60=_[_0xec84('0x59')]({},_0x570d60,_0x5896b5[_0xec84('0x5b')]);return db[_0xec84('0x45')][_0xec84('0x63')](_0x570d60)[_0xec84('0x2b')](handleEntityNotFound(_0x2b8c45,null))[_0xec84('0x2b')](respondWithResult(_0x2b8c45,null))[_0xec84('0x5f')](handleError(_0x2b8c45,null));};exports[_0xec84('0x64')]=function(_0x18b0db,_0x4ab87b){return db['ChatGroup']['create'](_0x18b0db['body'],{})[_0xec84('0x2b')](respondWithResult(_0x4ab87b,0xc9))[_0xec84('0x5f')](handleError(_0x4ab87b,null));};exports[_0xec84('0x3e')]=function(_0x57c794,_0x3ceca0){if(_0x57c794['body']['id']){delete _0x57c794['body']['id'];}return db[_0xec84('0x45')]['find']({'where':{'id':_0x57c794['params']['id']}})[_0xec84('0x2b')](handleEntityNotFound(_0x3ceca0,null))[_0xec84('0x2b')](saveUpdates(_0x57c794[_0xec84('0x65')],null))[_0xec84('0x2b')](respondWithResult(_0x3ceca0,null))['catch'](handleError(_0x3ceca0,null));};exports[_0xec84('0x3f')]=function(_0x15b78b,_0x2784b8){return db['ChatGroup'][_0xec84('0x63')]({'where':{'id':_0x15b78b[_0xec84('0x61')]['id']}})['then'](handleEntityNotFound(_0x2784b8,null))[_0xec84('0x2b')](removeEntity(_0x2784b8,null))[_0xec84('0x5f')](handleError(_0x2784b8,null));};exports[_0xec84('0x66')]=function(_0x4395d3,_0x42c8de){return db[_0xec84('0x45')][_0xec84('0x66')]()[_0xec84('0x2b')](respondWithResult(_0x42c8de,null))[_0xec84('0x5f')](handleError(_0x42c8de,null));};exports[_0xec84('0x67')]=function(_0x25363f,_0xba5ec0,_0x393e15){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x25363f[_0xec84('0x61')]['id'],'ToId':_0x25363f[_0xec84('0x68')]['id'],'read':![]}})['then'](function(_0x99180f){return{'id':_[_0xec84('0x69')](_0x25363f[_0xec84('0x61')]['id']),'count':_0x99180f};})[_0xec84('0x2b')](respondWithResult(_0xba5ec0,null))[_0xec84('0x5f')](handleError(_0xba5ec0,null));};exports['addMembers']=function(_0x33b932,_0x4477b6,_0x424128){return db[_0xec84('0x45')][_0xec84('0x63')]({'where':{'id':_0x33b932[_0xec84('0x61')]['id']}})['then'](handleEntityNotFound(_0x4477b6,null))[_0xec84('0x2b')](function(_0x145dfc){if(_0x145dfc){return _0x145dfc[_0xec84('0x6a')](_0x33b932[_0xec84('0x65')][_0xec84('0x6b')],_[_0xec84('0x6c')](_0x33b932[_0xec84('0x65')],[_0xec84('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x4477b6,null))[_0xec84('0x5f')](handleError(_0x4477b6,null));};exports[_0xec84('0x6d')]=function(_0x5e1306,_0xdfe285,_0x74a50a){var _0x715591={};var _0x1aa8f1={};var _0x166163;var _0x3601d1;return db[_0xec84('0x45')]['findOne']({'where':{'id':_0x5e1306[_0xec84('0x61')]['id']}})[_0xec84('0x2b')](handleEntityNotFound(_0xdfe285,null))[_0xec84('0x2b')](function(_0x24964c){if(_0x24964c){_0x166163=_0x24964c;_0x1aa8f1[_0xec84('0x4d')]=_['keys'](db['User'][_0xec84('0x46')]);_0x1aa8f1[_0xec84('0x4b')]=_['keys'](_0x5e1306[_0xec84('0x4b')]);_0x1aa8f1[_0xec84('0x4c')]=_['intersection'](_0x1aa8f1[_0xec84('0x4d')],_0x1aa8f1[_0xec84('0x4b')]);_0x715591[_0xec84('0x4e')]=_[_0xec84('0x4f')](_0x1aa8f1[_0xec84('0x4d')],qs[_0xec84('0x50')](_0x5e1306[_0xec84('0x4b')][_0xec84('0x50')]));_0x715591['attributes']=_0x715591[_0xec84('0x4e')][_0xec84('0x51')]?_0x715591[_0xec84('0x4e')]:_0x1aa8f1[_0xec84('0x4d')];_0x715591[_0xec84('0x55')]=qs[_0xec84('0x56')](_0x5e1306[_0xec84('0x4b')][_0xec84('0x56')]);_0x715591[_0xec84('0x57')]=qs[_0xec84('0x4c')](_[_0xec84('0x6e')](_0x5e1306[_0xec84('0x4b')],_0x1aa8f1[_0xec84('0x4c')]));if(_0x5e1306[_0xec84('0x4b')][_0xec84('0x58')]){_0x715591[_0xec84('0x57')]=_[_0xec84('0x59')](_0x715591['where'],{'$or':_[_0xec84('0x44')](_0x715591[_0xec84('0x4e')],function(_0x138e43){var _0x37b2e0={};_0x37b2e0[_0x138e43]={'$like':'%'+_0x5e1306[_0xec84('0x4b')][_0xec84('0x58')]+'%'};return _0x37b2e0;})});}_0x715591=_[_0xec84('0x59')]({},_0x715591,_0x5e1306[_0xec84('0x5b')]);return _0x166163[_0xec84('0x6d')](_0x715591);}})[_0xec84('0x2b')](function(_0x33e268){if(_0x33e268){_0x3601d1=_0x33e268['length'];if(!_0x5e1306['query'][_0xec84('0x52')](_0xec84('0x6f'))){_0x715591[_0xec84('0x53')]=qs['limit'](_0x5e1306['query'][_0xec84('0x53')]);_0x715591[_0xec84('0x54')]=qs['offset'](_0x5e1306[_0xec84('0x4b')]['offset']);}return _0x166163[_0xec84('0x6d')](_0x715591);}})['then'](function(_0x2a9fed){if(_0x2a9fed){return _0x2a9fed?{'count':_0x3601d1,'rows':_0x2a9fed}:null;}})['then'](respondWithResult(_0xdfe285,null))[_0xec84('0x5f')](handleError(_0xdfe285,null));};exports[_0xec84('0x70')]=function(_0x34ca4,_0xa7d83a,_0x4ba455){return db[_0xec84('0x45')]['find']({'where':{'id':_0x34ca4[_0xec84('0x61')]['id']}})[_0xec84('0x2b')](handleEntityNotFound(_0xa7d83a,null))[_0xec84('0x2b')](function(_0xe7aaa2){if(_0xe7aaa2){return _0xe7aaa2[_0xec84('0x70')](_0x34ca4[_0xec84('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0xa7d83a,null))[_0xec84('0x5f')](handleError(_0xa7d83a,null));};exports[_0xec84('0x71')]=function(_0x30e239,_0x222aa8,_0x1aef9e){if(_0x30e239['body']['id']){delete _0x30e239['body']['id'];}return db[_0xec84('0x45')]['find']({'where':{'id':_0x30e239['params']['id']}})[_0xec84('0x2b')](handleEntityNotFound(_0x222aa8,null))[_0xec84('0x2b')](function(_0x1763e8){if(_0x1763e8){_0x30e239[_0xec84('0x65')]['ChatGroupId']=_0x1763e8['id'];return db[_0xec84('0x72')][_0xec84('0x64')](_0x30e239[_0xec84('0x65')]);}})['then'](respondWithResult(_0x222aa8,null))[_0xec84('0x5f')](handleError(_0x222aa8,null));};exports[_0xec84('0x73')]=function(_0x469739,_0x41c0db,_0x22ad2e){var _0x2fe5cd={};var _0x3b9822={};var _0x4a212c;var _0x56bd64;return db['ChatGroup'][_0xec84('0x74')]({'where':{'id':_0x469739[_0xec84('0x61')]['id']}})[_0xec84('0x2b')](handleEntityNotFound(_0x41c0db,null))['then'](function(_0x52e960){if(_0x52e960){_0x4a212c=_0x52e960;_0x3b9822[_0xec84('0x4d')]=_[_0xec84('0x4a')](db['ChatInternalMessage'][_0xec84('0x46')]);_0x3b9822[_0xec84('0x4b')]=_['keys'](_0x469739[_0xec84('0x4b')]);_0x3b9822[_0xec84('0x4c')]=_[_0xec84('0x4f')](_0x3b9822[_0xec84('0x4d')],_0x3b9822[_0xec84('0x4b')]);_0x2fe5cd[_0xec84('0x4e')]=_[_0xec84('0x4f')](_0x3b9822[_0xec84('0x4d')],qs[_0xec84('0x50')](_0x469739[_0xec84('0x4b')][_0xec84('0x50')]));_0x2fe5cd['attributes']=_0x2fe5cd['attributes'][_0xec84('0x51')]?_0x2fe5cd[_0xec84('0x4e')]:_0x3b9822['model'];_0x2fe5cd[_0xec84('0x55')]=qs[_0xec84('0x56')](_0x469739[_0xec84('0x4b')][_0xec84('0x56')]);_0x2fe5cd[_0xec84('0x57')]=qs[_0xec84('0x4c')](_[_0xec84('0x6e')](_0x469739[_0xec84('0x4b')],_0x3b9822['filters']));if(_0x469739['query'][_0xec84('0x58')]){_0x2fe5cd[_0xec84('0x57')]=_[_0xec84('0x59')](_0x2fe5cd[_0xec84('0x57')],{'$or':_[_0xec84('0x44')](_0x2fe5cd[_0xec84('0x4e')],function(_0x5819e3){var _0x300a55={};_0x300a55[_0x5819e3]={'$like':'%'+_0x469739[_0xec84('0x4b')][_0xec84('0x58')]+'%'};return _0x300a55;})});}if(_0x469739['query'][_0xec84('0x75')]){var _0x1796c1=_0x469739[_0xec84('0x4b')]['$gte'][_0xec84('0x76')](',');var _0x16874e={};_0x16874e[_0x1796c1[0x0]]={'$gte':moment(_0x1796c1[0x1])[_0xec84('0x77')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2fe5cd[_0xec84('0x57')]=_[_0xec84('0x59')](_0x2fe5cd[_0xec84('0x57')],_0x16874e);}_0x2fe5cd=_[_0xec84('0x59')]({},_0x2fe5cd,_0x469739[_0xec84('0x5b')]);return _0x4a212c[_0xec84('0x73')](_0x2fe5cd);}})[_0xec84('0x2b')](function(_0x132e37){if(_0x132e37){_0x56bd64=_0x132e37[_0xec84('0x51')];if(!_0x469739[_0xec84('0x4b')][_0xec84('0x52')]('nolimit')){_0x2fe5cd[_0xec84('0x53')]=qs[_0xec84('0x53')](_0x469739['query'][_0xec84('0x53')]);_0x2fe5cd[_0xec84('0x54')]=qs[_0xec84('0x54')](_0x469739['query'][_0xec84('0x54')]);}return _0x4a212c[_0xec84('0x73')](_0x2fe5cd);}})[_0xec84('0x2b')](function(_0x534b13){if(_0x534b13){return _0x534b13?{'count':_0x56bd64,'rows':_0x534b13}:null;}})[_0xec84('0x2b')](respondWithResult(_0x41c0db,null))[_0xec84('0x5f')](handleError(_0x41c0db,null));}; \ No newline at end of file +var _0x1138=['attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','ChatGroup','includeAll','include','rows','show','params','rawAttributes','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','client','http','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~!@#$%^&-_=+[{]}.','request','then','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','index','fieldName','key','model','map','query','keys','intersection'];(function(_0x582942,_0x4c6747){var _0x3a0b75=function(_0x1722bf){while(--_0x1722bf){_0x582942['push'](_0x582942['shift']());}};_0x3a0b75(++_0x4c6747);}(_0x1138,0x9c));var _0x8113=function(_0x3546fb,_0x137629){_0x3546fb=_0x3546fb-0x0;var _0x2446b9=_0x1138[_0x3546fb];return _0x2446b9;};'use strict';var pdf=require(_0x8113('0x0'));var emlformat=require(_0x8113('0x1'));var rimraf=require(_0x8113('0x2'));var zipdir=require(_0x8113('0x3'));var jsonpatch=require(_0x8113('0x4'));var rp=require(_0x8113('0x5'));var moment=require(_0x8113('0x6'));var BPromise=require(_0x8113('0x7'));var Mustache=require(_0x8113('0x8'));var util=require(_0x8113('0x9'));var path=require(_0x8113('0xa'));var sox=require(_0x8113('0xb'));var csv=require(_0x8113('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8113('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8113('0xc'));var querystring=require('querystring');var Papa=require(_0x8113('0xe'));var Redis=require(_0x8113('0xf'));var authService=require(_0x8113('0x10'));var qs=require(_0x8113('0x11'));var as=require(_0x8113('0x12'));var hardwareService=require(_0x8113('0x13'));var logger=require(_0x8113('0x14'))(_0x8113('0x15'));var utils=require('../../config/utils');var config=require(_0x8113('0x16'));var db=require(_0x8113('0x17'))['db'];config['redis']=_[_0x8113('0x18')](config['redis'],{'host':_0x8113('0x19'),'port':0x18eb});var socket=require(_0x8113('0x1a'))(new Redis(config[_0x8113('0x1b')]));require(_0x8113('0x1c'))[_0x8113('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8113('0x1e')][_0x8113('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x173999,_0x8c13a9,_0x7ae55d){if(_0x7ae55d){var _0x46a54a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46a54a['test'](_0x8c13a9)){return _0x173999;}else{throw new db[(_0x8113('0x20'))][(_0x8113('0x21'))](_0x8113('0x22'));}}else{return _0x173999;}}function respondWithRpcPromise(_0x216de4,_0x1b444a,_0x4ec7c2,_0x564426){return new BPromise(function(_0x325ee2,_0x16a122){var _0x330844=_0x564426||client;return _0x330844[_0x8113('0x23')](_0x216de4,_0x4ec7c2)[_0x8113('0x24')](function(_0x4b1a20){logger['info'](_0x8113('0x25'),_0x1b444a,'request\x20sent');logger[_0x8113('0x26')](_0x8113('0x27'),_0x1b444a,_0x8113('0x28'),JSON[_0x8113('0x29')](_0x4b1a20));if(_0x4b1a20[_0x8113('0x2a')]){if(_0x4b1a20[_0x8113('0x2a')][_0x8113('0x2b')]===0x1f4){logger[_0x8113('0x2a')](_0x8113('0x25'),_0x1b444a,_0x4b1a20['error'][_0x8113('0x2c')]);return _0x16a122(_0x4b1a20[_0x8113('0x2a')][_0x8113('0x2c')]);}logger[_0x8113('0x2a')](_0x8113('0x25'),_0x1b444a,_0x4b1a20[_0x8113('0x2a')][_0x8113('0x2c')]);return _0x325ee2(_0x4b1a20[_0x8113('0x2a')][_0x8113('0x2c')]);}else{logger[_0x8113('0x2d')](_0x8113('0x25'),_0x1b444a,_0x8113('0x28'));_0x325ee2(_0x4b1a20['result']['message']);}})[_0x8113('0x2e')](function(_0x4b8a0a){logger['error'](_0x8113('0x25'),_0x1b444a,_0x4b8a0a);_0x16a122(_0x4b8a0a);});});}function respondWithStatusCode(_0x34d1ff,_0x4b6859){_0x4b6859=_0x4b6859||0xcc;return function(_0x281d85){if(_0x281d85){return _0x34d1ff['sendStatus'](_0x4b6859);}return _0x34d1ff[_0x8113('0x2f')](_0x4b6859)[_0x8113('0x30')]();};}function respondWithResult(_0x2aba55,_0x4186eb){_0x4186eb=_0x4186eb||0xc8;return function(_0xea4f9){if(_0xea4f9){return _0x2aba55[_0x8113('0x2f')](_0x4186eb)[_0x8113('0x31')](_0xea4f9);}};}function respondWithFilteredResult(_0x143417,_0x461af4){return function(_0x3b6456){if(_0x3b6456){var _0x5d86ff=_0x3b6456[_0x8113('0x32')],_0x24a52b=_0x461af4[_0x8113('0x33')],_0x163fdf=_0x461af4[_0x8113('0x33')]+_0x461af4[_0x8113('0x34')],_0x4036a9;if(_0x163fdf>=_0x5d86ff){_0x163fdf=_0x5d86ff;_0x4036a9=0xc8;}else{_0x4036a9=0xce;}_0x143417['status'](_0x4036a9);return _0x143417[_0x8113('0x35')](_0x8113('0x36'),_0x24a52b+'-'+_0x163fdf+'/'+_0x5d86ff)['json'](_0x3b6456);}return null;};}function patchUpdates(_0x51d373){return function(_0x26d689){try{jsonpatch['apply'](_0x26d689,_0x51d373,!![]);}catch(_0x5d1cb6){return BPromise[_0x8113('0x37')](_0x5d1cb6);}return _0x26d689[_0x8113('0x38')]();};}function saveUpdates(_0x84a10b,_0x4d1f91){return function(_0x47ea5a){if(_0x47ea5a){return _0x47ea5a[_0x8113('0x39')](_0x84a10b)[_0x8113('0x24')](function(_0x115dcc){return _0x115dcc;});}return null;};}function removeEntity(_0x6aac46,_0xf35b79){return function(_0x345fe2){if(_0x345fe2){return _0x345fe2[_0x8113('0x3a')]()[_0x8113('0x24')](function(){_0x6aac46['status'](0xcc)[_0x8113('0x30')]();});}};}function handleEntityNotFound(_0x372209,_0x50b219){return function(_0x1a1221){if(!_0x1a1221){_0x372209[_0x8113('0x3b')](0x194);}return _0x1a1221;};}function handleError(_0x464dff,_0x918eab){_0x918eab=_0x918eab||0x1f4;return function(_0x5b64a9){logger[_0x8113('0x2a')](_0x5b64a9['stack']);if(_0x5b64a9[_0x8113('0x3c')]){delete _0x5b64a9[_0x8113('0x3c')];}_0x464dff[_0x8113('0x2f')](_0x918eab)[_0x8113('0x3d')](_0x5b64a9);};}exports[_0x8113('0x3e')]=function(_0x5f4e3a,_0x3a2d22){var _0x7d9644={},_0x37f3b7={},_0x271f54={'count':0x0,'rows':[]};var _0x36b554=_['map'](db['ChatGroup']['rawAttributes'],function(_0x38bc2e){return{'name':_0x38bc2e[_0x8113('0x3f')],'type':_0x38bc2e['type'][_0x8113('0x40')]};});_0x37f3b7[_0x8113('0x41')]=_[_0x8113('0x42')](_0x36b554,_0x8113('0x3c'));_0x37f3b7[_0x8113('0x43')]=_[_0x8113('0x44')](_0x5f4e3a[_0x8113('0x43')]);_0x37f3b7['filters']=_[_0x8113('0x45')](_0x37f3b7['model'],_0x37f3b7[_0x8113('0x43')]);_0x7d9644[_0x8113('0x46')]=_[_0x8113('0x45')](_0x37f3b7[_0x8113('0x41')],qs['fields'](_0x5f4e3a[_0x8113('0x43')][_0x8113('0x47')]));_0x7d9644[_0x8113('0x46')]=_0x7d9644[_0x8113('0x46')][_0x8113('0x48')]?_0x7d9644[_0x8113('0x46')]:_0x37f3b7['model'];if(!_0x5f4e3a[_0x8113('0x43')][_0x8113('0x49')]('nolimit')){_0x7d9644[_0x8113('0x34')]=qs[_0x8113('0x34')](_0x5f4e3a[_0x8113('0x43')][_0x8113('0x34')]);_0x7d9644[_0x8113('0x33')]=qs[_0x8113('0x33')](_0x5f4e3a[_0x8113('0x43')][_0x8113('0x33')]);}_0x7d9644[_0x8113('0x4a')]=qs['sort'](_0x5f4e3a[_0x8113('0x43')][_0x8113('0x4b')]);_0x7d9644[_0x8113('0x4c')]=qs[_0x8113('0x4d')](_['pick'](_0x5f4e3a[_0x8113('0x43')],_0x37f3b7[_0x8113('0x4d')]),_0x36b554);if(_0x5f4e3a[_0x8113('0x43')][_0x8113('0x4e')]){_0x7d9644[_0x8113('0x4c')]=_[_0x8113('0x4f')](_0x7d9644[_0x8113('0x4c')],{'$or':_[_0x8113('0x42')](_0x36b554,function(_0x476461){if(_0x476461[_0x8113('0x50')]!==_0x8113('0x51')){var _0x479249={};_0x479249[_0x476461[_0x8113('0x3c')]]={'$like':'%'+_0x5f4e3a[_0x8113('0x43')][_0x8113('0x4e')]+'%'};return _0x479249;}})});}_0x7d9644=_[_0x8113('0x4f')]({},_0x7d9644,_0x5f4e3a[_0x8113('0x52')]);var _0x4d9b9f={'where':_0x7d9644[_0x8113('0x4c')]};return db[_0x8113('0x53')][_0x8113('0x32')](_0x4d9b9f)[_0x8113('0x24')](function(_0x16181d){_0x271f54[_0x8113('0x32')]=_0x16181d;if(_0x5f4e3a[_0x8113('0x43')][_0x8113('0x54')]){_0x7d9644[_0x8113('0x55')]=[{'all':!![]}];}return db[_0x8113('0x53')]['findAll'](_0x7d9644);})[_0x8113('0x24')](function(_0x26e198){_0x271f54[_0x8113('0x56')]=_0x26e198;return _0x271f54;})[_0x8113('0x24')](respondWithFilteredResult(_0x3a2d22,_0x7d9644))[_0x8113('0x2e')](handleError(_0x3a2d22,null));};exports[_0x8113('0x57')]=function(_0x2fcffe,_0x4e009b){var _0x35a811={'raw':!![],'where':{'id':_0x2fcffe[_0x8113('0x58')]['id']}},_0x1e3ad1={};_0x1e3ad1[_0x8113('0x41')]=_['keys'](db[_0x8113('0x53')][_0x8113('0x59')]);_0x1e3ad1[_0x8113('0x43')]=_['keys'](_0x2fcffe['query']);_0x1e3ad1[_0x8113('0x4d')]=_['intersection'](_0x1e3ad1[_0x8113('0x41')],_0x1e3ad1['query']);_0x35a811[_0x8113('0x46')]=_['intersection'](_0x1e3ad1[_0x8113('0x41')],qs[_0x8113('0x47')](_0x2fcffe[_0x8113('0x43')][_0x8113('0x47')]));_0x35a811[_0x8113('0x46')]=_0x35a811[_0x8113('0x46')][_0x8113('0x48')]?_0x35a811[_0x8113('0x46')]:_0x1e3ad1[_0x8113('0x41')];if(_0x2fcffe['query'][_0x8113('0x54')]){_0x35a811[_0x8113('0x55')]=[{'all':!![]}];}_0x35a811=_[_0x8113('0x4f')]({},_0x35a811,_0x2fcffe[_0x8113('0x52')]);return db[_0x8113('0x53')][_0x8113('0x5a')](_0x35a811)[_0x8113('0x24')](handleEntityNotFound(_0x4e009b,null))[_0x8113('0x24')](respondWithResult(_0x4e009b,null))[_0x8113('0x2e')](handleError(_0x4e009b,null));};exports[_0x8113('0x5b')]=function(_0x2c6dce,_0x4f83ba){return db[_0x8113('0x53')][_0x8113('0x5b')](_0x2c6dce[_0x8113('0x5c')],{})['then'](respondWithResult(_0x4f83ba,0xc9))[_0x8113('0x2e')](handleError(_0x4f83ba,null));};exports[_0x8113('0x39')]=function(_0x2161bf,_0x512b37){if(_0x2161bf['body']['id']){delete _0x2161bf[_0x8113('0x5c')]['id'];}return db['ChatGroup'][_0x8113('0x5a')]({'where':{'id':_0x2161bf['params']['id']}})[_0x8113('0x24')](handleEntityNotFound(_0x512b37,null))[_0x8113('0x24')](saveUpdates(_0x2161bf['body'],null))['then'](respondWithResult(_0x512b37,null))[_0x8113('0x2e')](handleError(_0x512b37,null));};exports[_0x8113('0x3a')]=function(_0x424732,_0x277e65){return db[_0x8113('0x53')][_0x8113('0x5a')]({'where':{'id':_0x424732[_0x8113('0x58')]['id']}})[_0x8113('0x24')](handleEntityNotFound(_0x277e65,null))[_0x8113('0x24')](removeEntity(_0x277e65,null))[_0x8113('0x2e')](handleError(_0x277e65,null));};exports['describe']=function(_0x9d1092,_0x286d8f){return db[_0x8113('0x53')][_0x8113('0x5d')]()[_0x8113('0x24')](respondWithResult(_0x286d8f,null))[_0x8113('0x2e')](handleError(_0x286d8f,null));};exports[_0x8113('0x5e')]=function(_0x314b4d,_0x1185dd,_0x558d7e){return db[_0x8113('0x5f')][_0x8113('0x32')]({'where':{'ChatGroupId':_0x314b4d[_0x8113('0x58')]['id'],'ToId':_0x314b4d[_0x8113('0x60')]['id'],'read':![]}})[_0x8113('0x24')](function(_0x4cc530){return{'id':_[_0x8113('0x61')](_0x314b4d[_0x8113('0x58')]['id']),'count':_0x4cc530};})['then'](respondWithResult(_0x1185dd,null))[_0x8113('0x2e')](handleError(_0x1185dd,null));};exports[_0x8113('0x62')]=function(_0x130c25,_0x38e911,_0x1b1039){return db[_0x8113('0x53')]['find']({'where':{'id':_0x130c25[_0x8113('0x58')]['id']}})['then'](handleEntityNotFound(_0x38e911,null))['then'](function(_0x296078){if(_0x296078){return _0x296078[_0x8113('0x62')](_0x130c25[_0x8113('0x5c')][_0x8113('0x63')],_[_0x8113('0x64')](_0x130c25['body'],[_0x8113('0x63'),'id'])||{});}})[_0x8113('0x24')](respondWithResult(_0x38e911,null))[_0x8113('0x2e')](handleError(_0x38e911,null));};exports[_0x8113('0x65')]=function(_0x920fb,_0x3ca283,_0x2dd4f1){var _0x4a4ba4={};var _0x3cd5ab={};var _0x49ddc8;var _0x4440ab;return db[_0x8113('0x53')][_0x8113('0x66')]({'where':{'id':_0x920fb[_0x8113('0x58')]['id']}})[_0x8113('0x24')](handleEntityNotFound(_0x3ca283,null))[_0x8113('0x24')](function(_0x21771b){if(_0x21771b){_0x49ddc8=_0x21771b;_0x3cd5ab[_0x8113('0x41')]=_['keys'](db[_0x8113('0x67')][_0x8113('0x59')]);_0x3cd5ab['query']=_[_0x8113('0x44')](_0x920fb[_0x8113('0x43')]);_0x3cd5ab['filters']=_['intersection'](_0x3cd5ab[_0x8113('0x41')],_0x3cd5ab['query']);_0x4a4ba4[_0x8113('0x46')]=_[_0x8113('0x45')](_0x3cd5ab['model'],qs[_0x8113('0x47')](_0x920fb[_0x8113('0x43')][_0x8113('0x47')]));_0x4a4ba4[_0x8113('0x46')]=_0x4a4ba4[_0x8113('0x46')][_0x8113('0x48')]?_0x4a4ba4['attributes']:_0x3cd5ab[_0x8113('0x41')];_0x4a4ba4['order']=qs[_0x8113('0x4b')](_0x920fb[_0x8113('0x43')][_0x8113('0x4b')]);_0x4a4ba4['where']=qs[_0x8113('0x4d')](_['pick'](_0x920fb[_0x8113('0x43')],_0x3cd5ab[_0x8113('0x4d')]));if(_0x920fb[_0x8113('0x43')]['filter']){_0x4a4ba4[_0x8113('0x4c')]=_[_0x8113('0x4f')](_0x4a4ba4[_0x8113('0x4c')],{'$or':_[_0x8113('0x42')](_0x4a4ba4['attributes'],function(_0x3c6b2e){var _0x9e966b={};_0x9e966b[_0x3c6b2e]={'$like':'%'+_0x920fb['query'][_0x8113('0x4e')]+'%'};return _0x9e966b;})});}_0x4a4ba4=_[_0x8113('0x4f')]({},_0x4a4ba4,_0x920fb[_0x8113('0x52')]);return _0x49ddc8[_0x8113('0x65')](_0x4a4ba4);}})[_0x8113('0x24')](function(_0x306bda){if(_0x306bda){_0x4440ab=_0x306bda[_0x8113('0x48')];if(!_0x920fb[_0x8113('0x43')]['hasOwnProperty'](_0x8113('0x68'))){_0x4a4ba4[_0x8113('0x34')]=qs['limit'](_0x920fb[_0x8113('0x43')][_0x8113('0x34')]);_0x4a4ba4[_0x8113('0x33')]=qs['offset'](_0x920fb[_0x8113('0x43')][_0x8113('0x33')]);}return _0x49ddc8[_0x8113('0x65')](_0x4a4ba4);}})[_0x8113('0x24')](function(_0x6ff91a){if(_0x6ff91a){return _0x6ff91a?{'count':_0x4440ab,'rows':_0x6ff91a}:null;}})['then'](respondWithResult(_0x3ca283,null))[_0x8113('0x2e')](handleError(_0x3ca283,null));};exports['removeMembers']=function(_0x4701e5,_0x243c82,_0x27afc1){return db[_0x8113('0x53')][_0x8113('0x5a')]({'where':{'id':_0x4701e5[_0x8113('0x58')]['id']}})['then'](handleEntityNotFound(_0x243c82,null))[_0x8113('0x24')](function(_0xa061b9){if(_0xa061b9){return _0xa061b9[_0x8113('0x69')](_0x4701e5[_0x8113('0x43')]['ids']);}})[_0x8113('0x24')](respondWithStatusCode(_0x243c82,null))[_0x8113('0x2e')](handleError(_0x243c82,null));};exports[_0x8113('0x6a')]=function(_0x16dd26,_0x2f4f66,_0x413aa3){if(_0x16dd26[_0x8113('0x5c')]['id']){delete _0x16dd26['body']['id'];}return db[_0x8113('0x53')][_0x8113('0x5a')]({'where':{'id':_0x16dd26['params']['id']}})[_0x8113('0x24')](handleEntityNotFound(_0x2f4f66,null))[_0x8113('0x24')](function(_0x32c74a){if(_0x32c74a){_0x16dd26[_0x8113('0x5c')][_0x8113('0x6b')]=_0x32c74a['id'];return db['ChatInternalMessage'][_0x8113('0x5b')](_0x16dd26[_0x8113('0x5c')]);}})[_0x8113('0x24')](respondWithResult(_0x2f4f66,null))[_0x8113('0x2e')](handleError(_0x2f4f66,null));};exports[_0x8113('0x6c')]=function(_0x51bb2b,_0x58e58a,_0x24f41f){var _0x4916a0={};var _0xecdaa2={};var _0x1650bb;var _0x38fa95;return db[_0x8113('0x53')]['findOne']({'where':{'id':_0x51bb2b[_0x8113('0x58')]['id']}})[_0x8113('0x24')](handleEntityNotFound(_0x58e58a,null))[_0x8113('0x24')](function(_0x554727){if(_0x554727){_0x1650bb=_0x554727;_0xecdaa2[_0x8113('0x41')]=_[_0x8113('0x44')](db[_0x8113('0x5f')]['rawAttributes']);_0xecdaa2[_0x8113('0x43')]=_[_0x8113('0x44')](_0x51bb2b[_0x8113('0x43')]);_0xecdaa2[_0x8113('0x4d')]=_[_0x8113('0x45')](_0xecdaa2['model'],_0xecdaa2[_0x8113('0x43')]);_0x4916a0[_0x8113('0x46')]=_[_0x8113('0x45')](_0xecdaa2[_0x8113('0x41')],qs[_0x8113('0x47')](_0x51bb2b[_0x8113('0x43')][_0x8113('0x47')]));_0x4916a0[_0x8113('0x46')]=_0x4916a0[_0x8113('0x46')]['length']?_0x4916a0[_0x8113('0x46')]:_0xecdaa2[_0x8113('0x41')];_0x4916a0[_0x8113('0x4a')]=qs['sort'](_0x51bb2b[_0x8113('0x43')][_0x8113('0x4b')]);_0x4916a0[_0x8113('0x4c')]=qs[_0x8113('0x4d')](_['pick'](_0x51bb2b[_0x8113('0x43')],_0xecdaa2[_0x8113('0x4d')]));if(_0x51bb2b[_0x8113('0x43')]['filter']){_0x4916a0['where']=_[_0x8113('0x4f')](_0x4916a0[_0x8113('0x4c')],{'$or':_[_0x8113('0x42')](_0x4916a0[_0x8113('0x46')],function(_0x2477de){var _0x18a915={};_0x18a915[_0x2477de]={'$like':'%'+_0x51bb2b[_0x8113('0x43')][_0x8113('0x4e')]+'%'};return _0x18a915;})});}if(_0x51bb2b[_0x8113('0x43')][_0x8113('0x6d')]){var _0x2d2970=_0x51bb2b[_0x8113('0x43')][_0x8113('0x6d')][_0x8113('0x6e')](',');var _0x6ed06f={};_0x6ed06f[_0x2d2970[0x0]]={'$gte':moment(_0x2d2970[0x1])[_0x8113('0x6f')](_0x8113('0x70'))};_0x4916a0['where']=_[_0x8113('0x4f')](_0x4916a0[_0x8113('0x4c')],_0x6ed06f);}_0x4916a0=_[_0x8113('0x4f')]({},_0x4916a0,_0x51bb2b['options']);return _0x1650bb[_0x8113('0x6c')](_0x4916a0);}})[_0x8113('0x24')](function(_0x1bc52c){if(_0x1bc52c){_0x38fa95=_0x1bc52c[_0x8113('0x48')];if(!_0x51bb2b[_0x8113('0x43')]['hasOwnProperty'](_0x8113('0x68'))){_0x4916a0[_0x8113('0x34')]=qs[_0x8113('0x34')](_0x51bb2b['query'][_0x8113('0x34')]);_0x4916a0[_0x8113('0x33')]=qs[_0x8113('0x33')](_0x51bb2b[_0x8113('0x43')][_0x8113('0x33')]);}return _0x1650bb['getMessages'](_0x4916a0);}})[_0x8113('0x24')](function(_0x187bcb){if(_0x187bcb){return _0x187bcb?{'count':_0x38fa95,'rows':_0x187bcb}:null;}})['then'](respondWithResult(_0x58e58a,null))[_0x8113('0x2e')](handleError(_0x58e58a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 0a7b104..9e89cde 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0xadb5,0xad));var _0x5adb=function(_0xaaa83,_0x568109){_0xaaa83=_0xaaa83-0x0;var _0x249638=_0xadb5[_0xaaa83];return _0x249638;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x2032,0xd9));var _0x2203=function(_0x222fa2,_0x3542d9){_0x222fa2=_0x222fa2-0x0;var _0x26e5f6=_0x2032[_0x222fa2];return _0x26e5f6;};'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 3e3dca9..746dbf8 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 _0x44ae=['exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x44ae,0x17d));var _0xe44a=function(_0x29436c,_0x260a6a){_0x29436c=_0x29436c-0x0;var _0x3760a2=_0x44ae[_0x29436c];return _0x3760a2;};'use strict';var _=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var logger=require(_0xe44a('0x2'))(_0xe44a('0x3'));var moment=require('moment');var BPromise=require(_0xe44a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe44a('0x5'));var rimraf=require(_0xe44a('0x6'));var config=require(_0xe44a('0x7'));var attributes=require(_0xe44a('0x8'));module[_0xe44a('0x9')]=function(_0x3f9763,_0x5c1c49){return _0x3f9763[_0xe44a('0xa')](_0xe44a('0xb'),attributes,{'tableName':_0xe44a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe132=['ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x9ad1e1,_0x375db7){var _0x5da13d=function(_0x4f1556){while(--_0x4f1556){_0x9ad1e1['push'](_0x9ad1e1['shift']());}};_0x5da13d(++_0x375db7);}(_0xe132,0x162));var _0x2e13=function(_0x1495ec,_0x45dad5){_0x1495ec=_0x1495ec-0x0;var _0x46af4d=_0xe132[_0x1495ec];return _0x46af4d;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var logger=require(_0x2e13('0x1'))(_0x2e13('0x2'));var moment=require(_0x2e13('0x3'));var BPromise=require(_0x2e13('0x4'));var rp=require(_0x2e13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x260dc1,_0x2f9d00){return _0x260dc1[_0x2e13('0x8')](_0x2e13('0x9'),attributes,{'tableName':_0x2e13('0xa'),'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 f969b04..407702e 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 _0xf133=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x3f2991,_0x5f1834){var _0x38984d=function(_0x3c4f1c){while(--_0x3c4f1c){_0x3f2991['push'](_0x3f2991['shift']());}};_0x38984d(++_0x5f1834);}(_0xf133,0x15e));var _0x3f13=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xf133[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x3f13('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3f13('0x1'));var rs=require(_0x3f13('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f13('0x3'))['db'];var utils=require(_0x3f13('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3f13('0x5'));var jayson=require(_0x3f13('0x6'));var client=jayson[_0x3f13('0x7')][_0x3f13('0x8')]({'port':0x232a});config[_0x3f13('0x9')]=_[_0x3f13('0xa')](config[_0x3f13('0x9')],{'host':_0x3f13('0xb'),'port':0x18eb});var socket=require(_0x3f13('0xc'))(new Redis(config[_0x3f13('0x9')]));require(_0x3f13('0xd'))[_0x3f13('0xe')](socket);function respondWithRpcPromise(_0x2ac2ba,_0x516511,_0x4d533f){return new BPromise(function(_0x22b3f4,_0x5b4177){return client[_0x3f13('0xf')](_0x2ac2ba,_0x4d533f)[_0x3f13('0x10')](function(_0x312066){logger[_0x3f13('0x11')](_0x3f13('0x12'),_0x516511,'request\x20sent');logger['debug'](_0x3f13('0x13'),_0x516511,_0x3f13('0x14'),JSON[_0x3f13('0x15')](_0x312066));if(_0x312066[_0x3f13('0x16')]){if(_0x312066['error'][_0x3f13('0x17')]===0x1f4){logger[_0x3f13('0x16')](_0x3f13('0x12'),_0x516511,_0x312066['error'][_0x3f13('0x18')]);return _0x5b4177(_0x312066[_0x3f13('0x16')][_0x3f13('0x18')]);}logger['error'](_0x3f13('0x12'),_0x516511,_0x312066['error'][_0x3f13('0x18')]);return _0x22b3f4(_0x312066[_0x3f13('0x16')][_0x3f13('0x18')]);}else{logger[_0x3f13('0x11')](_0x3f13('0x12'),_0x516511,_0x3f13('0x14'));_0x22b3f4(_0x312066[_0x3f13('0x19')]['message']);}})[_0x3f13('0x1a')](function(_0x313d74){logger['error'](_0x3f13('0x12'),_0x516511,_0x313d74);_0x5b4177(_0x313d74);});});} \ No newline at end of file +var _0x1efb=['code','message','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x499749,_0x41fb37){var _0x484b46=function(_0x25b4d4){while(--_0x25b4d4){_0x499749['push'](_0x499749['shift']());}};_0x484b46(++_0x41fb37);}(_0x1efb,0x10a));var _0xb1ef=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x1efb[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xb1ef('0x0'));var util=require(_0xb1ef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1ef('0x2'))['db'];var utils=require(_0xb1ef('0x3'));var logger=require('../../config/logger')(_0xb1ef('0x4'));var config=require(_0xb1ef('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb1ef('0x6')][_0xb1ef('0x7')]({'port':0x232a});config[_0xb1ef('0x8')]=_[_0xb1ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb1ef('0xa'))(new Redis(config[_0xb1ef('0x8')]));require(_0xb1ef('0xb'))[_0xb1ef('0xc')](socket);function respondWithRpcPromise(_0x1041a3,_0x5b898f,_0x4cfb95){return new BPromise(function(_0xe17658,_0x4fbfae){return client[_0xb1ef('0xd')](_0x1041a3,_0x4cfb95)[_0xb1ef('0xe')](function(_0x88328e){logger[_0xb1ef('0xf')](_0xb1ef('0x10'),_0x5b898f,_0xb1ef('0x11'));logger[_0xb1ef('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5b898f,_0xb1ef('0x11'),JSON['stringify'](_0x88328e));if(_0x88328e[_0xb1ef('0x13')]){if(_0x88328e['error'][_0xb1ef('0x14')]===0x1f4){logger['error'](_0xb1ef('0x10'),_0x5b898f,_0x88328e[_0xb1ef('0x13')][_0xb1ef('0x15')]);return _0x4fbfae(_0x88328e[_0xb1ef('0x13')][_0xb1ef('0x15')]);}logger[_0xb1ef('0x13')](_0xb1ef('0x10'),_0x5b898f,_0x88328e['error'][_0xb1ef('0x15')]);return _0xe17658(_0x88328e['error'][_0xb1ef('0x15')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x5b898f,'request\x20sent');_0xe17658(_0x88328e['result']['message']);}})['catch'](function(_0x25d883){logger[_0xb1ef('0x13')](_0xb1ef('0x10'),_0x5b898f,_0x25d883);_0x4fbfae(_0x25d883);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index f9b0853..5612a9d 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 _0x71ee=['save','remove','update','removeListener','register','chatGroup:','./chatGroup.events'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x71ee,0x156));var _0xe71e=function(_0x49ed67,_0x290989){_0x49ed67=_0x49ed67-0x0;var _0x1523d5=_0x71ee[_0x49ed67];return _0x1523d5;};'use strict';var ChatGroupEvents=require(_0xe71e('0x0'));var events=[_0xe71e('0x1'),_0xe71e('0x2'),_0xe71e('0x3')];function createListener(_0x30980b,_0x4fe37e){return function(_0x2c8f38){_0x4fe37e['emit'](_0x30980b,_0x2c8f38);};}function removeListener(_0x529e0a,_0x166421){return function(){ChatGroupEvents[_0xe71e('0x4')](_0x529e0a,_0x166421);};}exports[_0xe71e('0x5')]=function(_0xc8dd9a){for(var _0x5c35bf=0x0,_0x18f465=events['length'];_0x5c35bf<_0x18f465;_0x5c35bf++){var _0x69c036=events[_0x5c35bf];var _0x414371=createListener(_0xe71e('0x6')+_0x69c036,_0xc8dd9a);ChatGroupEvents['on'](_0x69c036,_0x414371);}}; \ No newline at end of file +var _0x6131=['./chatGroup.events','save','remove','update','register','chatGroup:'];(function(_0x412652,_0x2e2c96){var _0x3c1eda=function(_0x3b18b1){while(--_0x3b18b1){_0x412652['push'](_0x412652['shift']());}};_0x3c1eda(++_0x2e2c96);}(_0x6131,0xa8));var _0x1613=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x6131[_0x4392af];return _0x9fa8eb;};'use strict';var ChatGroupEvents=require(_0x1613('0x0'));var events=[_0x1613('0x1'),_0x1613('0x2'),_0x1613('0x3')];function createListener(_0x10cc5b,_0x3c9d97){return function(_0x42217b){_0x3c9d97['emit'](_0x10cc5b,_0x42217b);};}function removeListener(_0x1db025,_0x3d2830){return function(){ChatGroupEvents['removeListener'](_0x1db025,_0x3d2830);};}exports[_0x1613('0x4')]=function(_0x4dc6f2){for(var _0x461d5d=0x0,_0x10e52f=events['length'];_0x461d5d<_0x10e52f;_0x461d5d++){var _0x288da0=events[_0x461d5d];var _0x59d6f3=createListener(_0x1613('0x5')+_0x288da0,_0x4dc6f2);ChatGroupEvents['on'](_0x288da0,_0x59d6f3);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3c78adb..390f498 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 _0x4784=['/:id/messages','post','create','update','delete','destroy','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers'];(function(_0x189b6e,_0x434f41){var _0x391552=function(_0x2a39da){while(--_0x2a39da){_0x189b6e['push'](_0x189b6e['shift']());}};_0x391552(++_0x434f41);}(_0x4784,0x9a));var _0x4478=function(_0x3f054a,_0x5e5dbb){_0x3f054a=_0x3f054a-0x0;var _0x29e8d4=_0x4784[_0x3f054a];return _0x29e8d4;};'use strict';var multer=require('multer');var util=require(_0x4478('0x0'));var path=require('path');var timeout=require(_0x4478('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4478('0x2'));var config=require(_0x4478('0x3'));var controller=require('./chatGroup.controller');router[_0x4478('0x4')]('/',auth[_0x4478('0x5')](),controller['index']);router[_0x4478('0x4')](_0x4478('0x6'),auth[_0x4478('0x5')](),controller[_0x4478('0x7')]);router[_0x4478('0x4')](_0x4478('0x8'),auth[_0x4478('0x5')](),controller[_0x4478('0x9')]);router[_0x4478('0x4')](_0x4478('0xa'),auth[_0x4478('0x5')](),controller[_0x4478('0xb')]);router[_0x4478('0x4')](_0x4478('0xc'),auth[_0x4478('0x5')](),controller[_0x4478('0xd')]);router[_0x4478('0x4')](_0x4478('0xe'),auth[_0x4478('0x5')](),controller['getMessages']);router[_0x4478('0xf')]('/',auth['isAuthenticated'](),controller[_0x4478('0x10')]);router['post'](_0x4478('0xc'),auth['isAuthenticated'](),controller['addMembers']);router[_0x4478('0xf')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['put'](_0x4478('0x8'),auth[_0x4478('0x5')](),controller[_0x4478('0x11')]);router[_0x4478('0x12')](_0x4478('0x8'),auth[_0x4478('0x5')](),controller[_0x4478('0x13')]);router[_0x4478('0x12')](_0x4478('0xc'),auth[_0x4478('0x5')](),controller['removeMembers']);module[_0x4478('0x14')]=router; \ No newline at end of file +var _0x6254=['addMessage','put','update','delete','removeMembers','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers'];(function(_0x517b56,_0x4502a1){var _0x42ebed=function(_0x1093cb){while(--_0x1093cb){_0x517b56['push'](_0x517b56['shift']());}};_0x42ebed(++_0x4502a1);}(_0x6254,0x144));var _0x4625=function(_0xc36d01,_0x3bf1a6){_0xc36d01=_0xc36d01-0x0;var _0xecb231=_0x6254[_0xc36d01];return _0xecb231;};'use strict';var multer=require(_0x4625('0x0'));var util=require('util');var path=require(_0x4625('0x1'));var timeout=require(_0x4625('0x2'));var express=require(_0x4625('0x3'));var router=express[_0x4625('0x4')]();var auth=require(_0x4625('0x5'));var interaction=require(_0x4625('0x6'));var config=require(_0x4625('0x7'));var controller=require(_0x4625('0x8'));router[_0x4625('0x9')]('/',auth[_0x4625('0xa')](),controller[_0x4625('0xb')]);router[_0x4625('0x9')](_0x4625('0xc'),auth[_0x4625('0xa')](),controller[_0x4625('0xd')]);router[_0x4625('0x9')](_0x4625('0xe'),auth[_0x4625('0xa')](),controller[_0x4625('0xf')]);router[_0x4625('0x9')](_0x4625('0x10'),auth[_0x4625('0xa')](),controller[_0x4625('0x11')]);router[_0x4625('0x9')](_0x4625('0x12'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x4625('0x13'),auth[_0x4625('0xa')](),controller[_0x4625('0x14')]);router[_0x4625('0x15')]('/',auth[_0x4625('0xa')](),controller[_0x4625('0x16')]);router['post'](_0x4625('0x12'),auth['isAuthenticated'](),controller[_0x4625('0x17')]);router[_0x4625('0x15')](_0x4625('0x13'),auth[_0x4625('0xa')](),controller[_0x4625('0x18')]);router[_0x4625('0x19')](_0x4625('0xe'),auth[_0x4625('0xa')](),controller[_0x4625('0x1a')]);router['delete']('/:id',auth[_0x4625('0xa')](),controller['destroy']);router[_0x4625('0x1b')](_0x4625('0x12'),auth[_0x4625('0xa')](),controller[_0x4625('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 195e525..33f2567 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 _0x91f4=['DATE','ENUM','out','sequelize','exports','star','thumb','TEXT','STRING','long'];(function(_0x3ba7c1,_0xbcf034){var _0x1ee076=function(_0x3c1b9c){while(--_0x3c1b9c){_0x3ba7c1['push'](_0x3ba7c1['shift']());}};_0x1ee076(++_0xbcf034);}(_0x91f4,0x139));var _0x491f=function(_0x44128e,_0x255ae0){_0x44128e=_0x44128e-0x0;var _0x1fae67=_0x91f4[_0x44128e];return _0x1fae67;};'use strict';var Sequelize=require(_0x491f('0x0'));module[_0x491f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x491f('0x2'),_0x491f('0x3')),'defaultValue':_0x491f('0x2')},'ratingMessage':{'type':Sequelize[_0x491f('0x4')]},'pathTranscript':{'type':Sequelize[_0x491f('0x4')]},'mailTranscript':{'type':Sequelize[_0x491f('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x491f('0x5')]},'note':{'type':Sequelize[_0x491f('0x5')]},'browserName':{'type':Sequelize[_0x491f('0x5')]},'browserVersion':{'type':Sequelize[_0x491f('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x491f('0x5')]},'deviceModel':{'type':Sequelize[_0x491f('0x5')]},'deviceVendor':{'type':Sequelize[_0x491f('0x5')]},'deviceType':{'type':Sequelize[_0x491f('0x5')]},'referer':{'type':Sequelize[_0x491f('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x491f('0x6'))},'read1stAt':{'type':Sequelize[_0x491f('0x7')]},'lastMsgAt':{'type':Sequelize[_0x491f('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x491f('0x8')]('in',_0x491f('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x491f('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x491f('0x4')]}}; \ No newline at end of file +var _0x7c63=['out','sequelize','exports','BOOLEAN','star','thumb','TEXT','STRING','DATE'];(function(_0x319fc1,_0x29179b){var _0xb768af=function(_0x3509ac){while(--_0x3509ac){_0x319fc1['push'](_0x319fc1['shift']());}};_0xb768af(++_0x29179b);}(_0x7c63,0x160));var _0x37c6=function(_0x3771e9,_0x56236c){_0x3771e9=_0x3771e9-0x0;var _0x3cf981=_0x7c63[_0x3771e9];return _0x3cf981;};'use strict';var Sequelize=require(_0x37c6('0x0'));module[_0x37c6('0x1')]={'closed':{'type':Sequelize[_0x37c6('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0x37c6('0x3'),_0x37c6('0x4')),'defaultValue':_0x37c6('0x3')},'ratingMessage':{'type':Sequelize[_0x37c6('0x5')]},'pathTranscript':{'type':Sequelize[_0x37c6('0x5')]},'mailTranscript':{'type':Sequelize[_0x37c6('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x37c6('0x7')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x37c6('0x6')]},'browserVersion':{'type':Sequelize[_0x37c6('0x6')]},'osName':{'type':Sequelize[_0x37c6('0x6')]},'osVersion':{'type':Sequelize[_0x37c6('0x6')]},'deviceModel':{'type':Sequelize[_0x37c6('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x37c6('0x6')]},'referer':{'type':Sequelize[_0x37c6('0x5')]},'customerIp':{'type':Sequelize[_0x37c6('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x37c6('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x37c6('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x37c6('0x6')]},'customerPort':{'type':Sequelize[_0x37c6('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x37c6('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 3e936d0..0f6fd2c 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 _0x9536=['MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','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','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','addTags','spread','emit','removeTags','unix','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','out','renderFile','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','reject','save','destroy','then','name','send','Users','map','TagIds','split','forEach','Tags','push','index','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','ui.ChatInteractionId','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','o.id\x20=\x20i.UserId','chat_websites','chat_messages','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','compact','isEmpty','ChatWebsiteId','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','ChatInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','params','includeAll','include','merge','options','create','update','describe','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync'];(function(_0x15a149,_0x533cd4){var _0x3e292a=function(_0x355ea2){while(--_0x355ea2){_0x15a149['push'](_0x15a149['shift']());}};_0x3e292a(++_0x533cd4);}(_0x9536,0x179));var _0x6953=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x9536[_0x130d82];return _0x112070;};'use strict';var pdf=require(_0x6953('0x0'));var emlformat=require(_0x6953('0x1'));var rimraf=require(_0x6953('0x2'));var zipdir=require(_0x6953('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6953('0x4'));var moment=require('moment');var BPromise=require(_0x6953('0x5'));var Mustache=require(_0x6953('0x6'));var util=require(_0x6953('0x7'));var path=require(_0x6953('0x8'));var sox=require(_0x6953('0x9'));var csv=require('to-csv');var ejs=require(_0x6953('0xa'));var fs=require('fs');var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0xf'));var querystring=require(_0x6953('0x10'));var Papa=require(_0x6953('0x11'));var Redis=require('ioredis');var authService=require(_0x6953('0x12'));var qs=require(_0x6953('0x13'));var as=require(_0x6953('0x14'));var hardwareService=require(_0x6953('0x15'));var logger=require(_0x6953('0x16'))(_0x6953('0x17'));var utils=require(_0x6953('0x18'));var config=require(_0x6953('0x19'));var db=require(_0x6953('0x1a'))['db'];config['redis']=_[_0x6953('0x1b')](config['redis'],{'host':_0x6953('0x1c'),'port':0x18eb});var socket=require(_0x6953('0x1d'))(new Redis(config[_0x6953('0x1e')]));require(_0x6953('0x1f'))[_0x6953('0x20')](socket);var jayson=require(_0x6953('0x21'));var client=jayson[_0x6953('0x22')][_0x6953('0x23')]({'port':0x232b});var client9004=jayson[_0x6953('0x22')][_0x6953('0x23')]({'port':0x232c});function checkPasswordPattern(_0xae5515,_0x548473,_0x5f49db){if(_0x5f49db){var _0x399b9b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x399b9b[_0x6953('0x24')](_0x548473)){return _0xae5515;}else{throw new db[(_0x6953('0x25'))][(_0x6953('0x26'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xae5515;}}function respondWithRpcPromise(_0x1b6dcb,_0x2da771,_0x4b43ae,_0x10858a){return new BPromise(function(_0x3207dd,_0x283cf4){var _0x174c59=_0x10858a||client;return _0x174c59[_0x6953('0x27')](_0x1b6dcb,_0x4b43ae)['then'](function(_0x3a93e1){logger[_0x6953('0x28')](_0x6953('0x29'),_0x2da771,_0x6953('0x2a'));logger[_0x6953('0x2b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2da771,_0x6953('0x2a'),JSON[_0x6953('0x2c')](_0x3a93e1));if(_0x3a93e1['error']){if(_0x3a93e1[_0x6953('0x2d')][_0x6953('0x2e')]===0x1f4){logger[_0x6953('0x2d')](_0x6953('0x29'),_0x2da771,_0x3a93e1['error'][_0x6953('0x2f')]);return _0x283cf4(_0x3a93e1[_0x6953('0x2d')][_0x6953('0x2f')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2da771,_0x3a93e1['error'][_0x6953('0x2f')]);return _0x3207dd(_0x3a93e1[_0x6953('0x2d')]['message']);}else{logger[_0x6953('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x2da771,_0x6953('0x2a'));_0x3207dd(_0x3a93e1[_0x6953('0x30')][_0x6953('0x2f')]);}})[_0x6953('0x31')](function(_0x191d80){logger[_0x6953('0x2d')]('ChatInteraction,\x20%s,\x20%s',_0x2da771,_0x191d80);_0x283cf4(_0x191d80);});});}function respondWithStatusCode(_0x3dd890,_0x3c1075){_0x3c1075=_0x3c1075||0xcc;return function(_0x527b9a){if(_0x527b9a){return _0x3dd890[_0x6953('0x32')](_0x3c1075);}return _0x3dd890['status'](_0x3c1075)[_0x6953('0x33')]();};}function respondWithResult(_0x3b1175,_0x426c7c){_0x426c7c=_0x426c7c||0xc8;return function(_0x4b0325){if(_0x4b0325){return _0x3b1175[_0x6953('0x34')](_0x426c7c)[_0x6953('0x35')](_0x4b0325);}};}function respondWithFilteredResult(_0xf78141,_0x47ed2f){return function(_0x4c49fc){if(_0x4c49fc){var _0x132a71=_0x4c49fc[_0x6953('0x36')],_0x481c6a=_0x47ed2f[_0x6953('0x37')],_0x4d856d=_0x47ed2f[_0x6953('0x37')]+_0x47ed2f[_0x6953('0x38')],_0xd80e42;if(_0x4d856d>=_0x132a71){_0x4d856d=_0x132a71;_0xd80e42=0xc8;}else{_0xd80e42=0xce;}_0xf78141['status'](_0xd80e42);return _0xf78141[_0x6953('0x39')]('Content-Range',_0x481c6a+'-'+_0x4d856d+'/'+_0x132a71)[_0x6953('0x35')](_0x4c49fc);}return null;};}function patchUpdates(_0x2e85c7){return function(_0x4ba704){try{jsonpatch['apply'](_0x4ba704,_0x2e85c7,!![]);}catch(_0x1f77a6){return BPromise[_0x6953('0x3a')](_0x1f77a6);}return _0x4ba704[_0x6953('0x3b')]();};}function saveUpdates(_0x4ffa69,_0x28cb92){return function(_0x5e01d2){if(_0x5e01d2){return _0x5e01d2['update'](_0x4ffa69)['then'](function(_0x5c4a8a){return _0x5c4a8a;});}return null;};}function removeEntity(_0x1ef067,_0x6c7862){return function(_0x2c7160){if(_0x2c7160){return _0x2c7160[_0x6953('0x3c')]()[_0x6953('0x3d')](function(){_0x1ef067[_0x6953('0x34')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b76a5,_0x5a8197){return function(_0x199c67){if(!_0x199c67){_0x2b76a5['sendStatus'](0x194);}return _0x199c67;};}function handleError(_0xc63da7,_0x383e31){_0x383e31=_0x383e31||0x1f4;return function(_0xd81149){logger[_0x6953('0x2d')](_0xd81149['stack']);if(_0xd81149[_0x6953('0x3e')]){delete _0xd81149[_0x6953('0x3e')];}_0xc63da7[_0x6953('0x34')](_0x383e31)[_0x6953('0x3f')](_0xd81149);};}function getInteractionUsers(_0x40b6ea,_0x475ea8){return new BPromise(function(_0x37b2b3,_0x81428b){try{if(_0x475ea8[_0x40b6ea['id']]){_0x40b6ea[_0x6953('0x40')]=_[_0x6953('0x41')](_0x475ea8[_0x40b6ea['id']],function(_0x2d9d81){return{'id':_0x2d9d81['id'],'fullname':_0x2d9d81['fullname']};});}}catch(_0x9d8ee1){_0x81428b(_0x9d8ee1);}_0x37b2b3(_0x40b6ea);});}function getInteractionTags(_0x3c03ab,_0x1f6571){return new BPromise(function(_0x5dff18,_0x47e7e7){try{if(_0x3c03ab[_0x6953('0x42')]){_0x3c03ab['Tags']=[];_0x3c03ab['TagIds'][_0x6953('0x43')](',')[_0x6953('0x44')](function(_0x4b5e1c){_0x3c03ab[_0x6953('0x45')][_0x6953('0x46')](_0x1f6571[_0x4b5e1c]);});}delete _0x3c03ab[_0x6953('0x42')];}catch(_0x419648){_0x47e7e7(_0x419648);}_0x5dff18(_0x3c03ab);});}function updateChatInteraction(_0x8df9fc,_0x4d7f59,_0x51137b){return new BPromise(function(_0x3a72e5,_0x2733e6){return getInteractionUsers(_0x8df9fc,_0x51137b)[_0x6953('0x3d')](function(_0x3a0104){return getInteractionTags(_0x3a0104,_0x4d7f59);})[_0x6953('0x3d')](function(_0x2a20bf){_0x3a72e5(_0x2a20bf);})['catch'](function(_0x5a40de){_0x2733e6(_0x5a40de);});});}exports[_0x6953('0x47')]=function(_0x54d7c2,_0x588ff8){var _0x2d5403={},_0x2e1197={},_0x2bdbb6={'count':0x0,'rows':[]};var _0x1da621=_[_0x6953('0x41')](db['ChatInteraction']['rawAttributes'],function(_0x1de4e4){return{'name':_0x1de4e4[_0x6953('0x48')],'type':_0x1de4e4['type'][_0x6953('0x49')]};});_0x2e1197['model']=_[_0x6953('0x41')](_0x1da621,_0x6953('0x3e'));_0x2e1197[_0x6953('0x4a')]=_[_0x6953('0x4b')](_0x54d7c2['query']);_0x2e1197[_0x6953('0x4c')]=_[_0x6953('0x4d')](_0x2e1197['model'],_0x2e1197[_0x6953('0x4a')]);_0x2d5403[_0x6953('0x4e')]=_[_0x6953('0x4d')](_0x2e1197[_0x6953('0x4f')],qs[_0x6953('0x50')](_0x54d7c2[_0x6953('0x4a')][_0x6953('0x50')]));_0x2d5403[_0x6953('0x4e')]=_0x2d5403[_0x6953('0x4e')][_0x6953('0x51')]?_0x2d5403[_0x6953('0x4e')]:_0x2e1197['model'];if(!_0x54d7c2[_0x6953('0x4a')]['hasOwnProperty'](_0x6953('0x52'))){_0x2d5403[_0x6953('0x38')]=qs[_0x6953('0x38')](_0x54d7c2['query'][_0x6953('0x38')]);_0x2d5403[_0x6953('0x37')]=qs['offset'](_0x54d7c2['query'][_0x6953('0x37')]);}_0x2d5403[_0x6953('0x53')]=qs[_0x6953('0x54')](_0x54d7c2[_0x6953('0x4a')][_0x6953('0x54')]);_0x2d5403[_0x6953('0x55')]=qs[_0x6953('0x4c')](_[_0x6953('0x56')](_0x54d7c2[_0x6953('0x4a')],_0x2e1197[_0x6953('0x4c')]),_0x1da621);var _0x1de9f8=[];var _0x493a91=squel['select']()[_0x6953('0x57')]('id')[_0x6953('0x57')](_0x6953('0x3e'))[_0x6953('0x57')](_0x6953('0x58'))[_0x6953('0x59')](_0x6953('0x5a'));var _0x238ab2=squel[_0x6953('0x5b')]()['field']('u.id')['field']('u.fullname')[_0x6953('0x57')](_0x6953('0x5c'))[_0x6953('0x59')]('user_has_chat_interactions','ui')['left_join'](_0x6953('0x5d'),'u',_0x6953('0x5e'));var _0x11a551=squel['select']()['from'](_0x6953('0x5f'),'i')[_0x6953('0x60')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x6953('0x60')](_0x6953('0x5d'),'o',_0x6953('0x61'))[_0x6953('0x60')](_0x6953('0x62'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x6953('0x60')](_0x6953('0x63'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x6953('0x60')]('chat_interaction_has_tags','it',_0x6953('0x64'))[_0x6953('0x60')](_0x6953('0x5a'),'t',_0x6953('0x65'));var _0x4f24bf=squel[_0x6953('0x66')]();var _0x366390=[];var _0x38b3b1=squel['expr']();var _0x47ef82;if(_0x54d7c2[_0x6953('0x4a')][_0x6953('0x67')]){_0x47ef82=as[_0x6953('0x68')](_0x54d7c2['query']['search']);var _0x44a01=_0x47ef82[_0x6953('0x69')];for(var _0x4c0f1c=0x0;_0x4c0f1c<_0x47ef82[_0x6953('0x6a')][_0x6953('0x51')];_0x4c0f1c++){var _0x4f4683=_0x47ef82[_0x6953('0x6a')][_0x4c0f1c];var _0x1e824a='i';var _0x109b5e=_[_0x6953('0x6b')](_0x1da621,[_0x6953('0x3e'),_0x4f4683['field']]);if(!_0x109b5e){switch(_0x4f4683[_0x6953('0x57')]){case _0x6953('0x6c'):if(_0x4f4683[_0x6953('0x6d')]==0x1){_0x11a551['having']('`'+_0x4f4683['field']+_0x6953('0x6e'));}else{_0x11a551[_0x6953('0x6f')]('`'+_0x4f4683[_0x6953('0x57')]+_0x6953('0x70'));}break;case _0x6953('0x71'):if(_0x4f4683['operator']===_0x6953('0x72')){if(_0x4f4683[_0x6953('0x6d')][_0x6953('0x43')]('\x20')[_0x6953('0x51')]>0x1){_0x4f24bf[_0x44a01](_0x6953('0x73'),qs[_0x6953('0x74')](_0x4f4683[_0x6953('0x6d')]),null);}else{var _0x435e74='%'+_0x4f4683[_0x6953('0x6d')]+'%';_0x4f24bf[_0x44a01](_0x6953('0x75'),_0x435e74,_0x435e74,_0x435e74);}}else{_0x109b5e=_[_0x6953('0x6b')](_0x1da621,[_0x6953('0x3e'),_0x6953('0x76')]);_0x4f4683['field']=_0x6953('0x76');_0x2d0c09=as[_0x6953('0x77')](_0x1e824a,_0x109b5e[_0x6953('0x78')],_0x4f4683);_0x4f24bf[_0x44a01](_0x2d0c09[_0x6953('0x79')],_0x2d0c09[_0x6953('0x6d')]['start'],_0x2d0c09['value'][_0x6953('0x33')]);}break;case'Tag':var _0x471872=_0x4f4683[_0x6953('0x6d')][_0x6953('0x43')](',')[_0x6953('0x41')](function(_0x4c8e6c){return Number(_0x4c8e6c);});_0x471872[_0x6953('0x44')](function(_0x3091fc){_0x38b3b1['or'](_0x6953('0x7a'),'%,'+_0x3091fc+',%');});_0x366390=_[_0x6953('0x7b')](_0x366390,_0x471872);break;case _0x6953('0x7c'):if(_0x4f4683[_0x6953('0x7d')]===_0x6953('0x72')){_0x4f24bf[_0x44a01](_0x6953('0x7e'),'%'+_0x4f4683[_0x6953('0x6d')]+'%',null);}else{_0x109b5e=_[_0x6953('0x6b')](_0x1da621,[_0x6953('0x3e'),_0x6953('0x7f')]);_0x4f4683[_0x6953('0x57')]=_0x6953('0x7f');_0x2d0c09=as[_0x6953('0x77')](_0x1e824a,_0x109b5e['type'],_0x4f4683);_0x4f24bf[_0x44a01](_0x2d0c09[_0x6953('0x79')],_0x2d0c09[_0x6953('0x6d')][_0x6953('0x80')],_0x2d0c09[_0x6953('0x6d')][_0x6953('0x33')]);}break;case _0x6953('0x81'):_0x2d0c09=as[_0x6953('0x77')]('me',null,_0x4f4683);_0x4f24bf[_0x44a01](_0x2d0c09['text'],_0x2d0c09[_0x6953('0x6d')][_0x6953('0x80')],_0x2d0c09['value'][_0x6953('0x33')]);break;}}else{var _0x2d0c09=as[_0x6953('0x77')](_0x1e824a,_0x109b5e['type'],_0x4f4683);_0x4f24bf[_0x44a01](_0x2d0c09['text'],_0x2d0c09[_0x6953('0x6d')][_0x6953('0x80')],_0x2d0c09[_0x6953('0x6d')][_0x6953('0x33')]);}}}else{var _0x1ad883=_(_0x54d7c2[_0x6953('0x4a')])[_0x6953('0x4b')]()[_0x6953('0x41')](function(_0x2d1bba){return _['some'](_0x1da621,[_0x6953('0x3e'),_0x2d1bba])?_0x2d1bba:undefined;})[_0x6953('0x82')]()[_0x6953('0x6d')]();if(!_[_0x6953('0x83')](_0x1ad883)){_0x1ad883['forEach'](function(_0x199ae6){if(_0x199ae6===_0x6953('0x84')){_0x11a551[_0x6953('0x55')]('i.ChatWebsiteId\x20IN\x20?',[][_0x6953('0x85')](_0x54d7c2[_0x6953('0x4a')][_0x199ae6]));}else if(_0x199ae6===_0x6953('0x86')){var _0x1b9588=JSON['parse'](_0x54d7c2[_0x6953('0x4a')][_0x199ae6])[_0x6953('0x87')];var _0x328191=JSON[_0x6953('0x88')](_0x54d7c2['query'][_0x199ae6])['$lte'];_0x11a551[_0x6953('0x55')](_0x6953('0x89'),_0x1b9588,_0x328191);}else{if(_0x54d7c2['query'][_0x199ae6]==='null'){_0x11a551[_0x6953('0x55')]('i.'+_0x199ae6+_0x6953('0x8a'));}else{_0x11a551[_0x6953('0x55')]('i.'+_0x199ae6+_0x6953('0x8b'),_0x54d7c2['query'][_0x199ae6]);}}});}if(_0x54d7c2[_0x6953('0x4a')][_0x6953('0x8c')]){if(_0x54d7c2['query'][_0x6953('0x8c')]==0x1){_0x11a551[_0x6953('0x6f')]('`unreadMessages`\x20=\x200');}else{_0x11a551['having']('`unreadMessages`\x20>\x200');}}if(_0x54d7c2[_0x6953('0x4a')][_0x6953('0x8d')]){_0x366390=_[_0x6953('0x8e')](_0x54d7c2[_0x6953('0x4a')][_0x6953('0x8d')])?_0x54d7c2[_0x6953('0x4a')][_0x6953('0x8d')]:new Array(_0x54d7c2[_0x6953('0x4a')]['tag']);_0x366390[_0x6953('0x44')](function(_0x14eab9){_0x38b3b1['or'](_0x6953('0x7a'),'%,'+_0x14eab9+',%');});}if(_0x54d7c2[_0x6953('0x4a')][_0x6953('0x8f')]){var _0x43ad3d=_0x54d7c2['query'][_0x6953('0x8f')]['replace']('\x5c','\x5c\x5c')[_0x6953('0x90')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x6953('0x91')](_0x43ad3d)){_0x4f24bf['or'](_0x6953('0x92'),_0x43ad3d+'%');}else{_0x4f24bf['or'](_0x6953('0x93'),qs['getFullTextValue'](_0x43ad3d))['or'](_0x6953('0x94'),_0x43ad3d+'%');}}}_0x11a551[_0x6953('0x55')](_0x4f24bf);_0x11a551[_0x6953('0x95')](_0x6953('0x96'));var _0x8832c7={'type':db[_0x6953('0x25')]['QueryTypes'][_0x6953('0x97')],'raw':!![]};var _0x15794b=_0x11a551[_0x6953('0x98')]();_0x15794b[_0x6953('0x57')](_0x6953('0x96'));_0x15794b[_0x6953('0x57')](_0x6953('0x99'),_0x6953('0x6c'));if(_0x2d5403[_0x6953('0x53')]){_0x2d5403[_0x6953('0x53')][_0x6953('0x44')](function(_0x47c935){_0x11a551[_0x6953('0x53')]('i.'+_0x47c935[0x0],_0x47c935[0x1]===_0x6953('0x9a')?![]:!![]);});}if(!_[_0x6953('0x83')](_0x366390)){_0x11a551[_0x6953('0x6f')](_0x38b3b1);_0x15794b[_0x6953('0x55')](_0x6953('0x9b'),_0x366390);}BPromise[_0x6953('0x9c')]()[_0x6953('0x3d')](function(){if(!_0x47ef82){if(_0x54d7c2[_0x6953('0x4a')][_0x6953('0x84')]||_0x54d7c2[_0x6953('0x4a')]['journey'])return;_0x15794b[_0x6953('0x55')](_0x6953('0x9d'));_0x11a551[_0x6953('0x55')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x54d7c2[_0x6953('0x9e')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x18f6cb){if(_[_0x6953('0x83')](_0x18f6cb)){_0x15794b[_0x6953('0x55')](_0x6953('0x9f'));_0x11a551[_0x6953('0x55')](_0x6953('0x9f'));}else{_0x15794b[_0x6953('0x55')]('i.ChatWebsiteId\x20IN\x20?',_[_0x6953('0x41')](_0x18f6cb,'id'));_0x11a551[_0x6953('0x55')](_0x6953('0xa0'),_['map'](_0x18f6cb,'id'));}});})[_0x6953('0x3d')](function(){db[_0x6953('0xa1')]['query'](_0x15794b[_0x6953('0xa2')](),_0x8832c7)['then'](function(_0x531b79){_0x2bdbb6[_0x6953('0x36')]=_0x531b79['length'];if(_0x2bdbb6['count']===0x0)return[];return db[_0x6953('0xa1')][_0x6953('0x4a')](_0x493a91[_0x6953('0xa2')](),_0x8832c7)['then'](function(_0x24a69e){_0x1de9f8=_[_0x6953('0xa3')](_0x24a69e,'id');_0x8832c7=_['merge'](_0x8832c7,{'model':db[_0x6953('0xa4')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54d7c2[_0x6953('0x4a')][_0x6953('0x50')]){_0x2d5403[_0x6953('0x4e')][_0x6953('0x44')](function(_0x31d847){_0x11a551[_0x6953('0x57')]('i.'+_0x31d847);});}else{_0x11a551[_0x6953('0x57')](_0x6953('0x99'),'unreadMessages');_0x11a551[_0x6953('0x57')](_0x6953('0xa5'),'Account.key');_0x11a551[_0x6953('0x57')](_0x6953('0xa6'),_0x6953('0xa7'));_0x11a551[_0x6953('0x57')](_0x6953('0xa8'));_0x11a551[_0x6953('0x57')](_0x6953('0xa9'),'Contact.firstName');_0x11a551[_0x6953('0x57')](_0x6953('0xaa'),_0x6953('0xab'));_0x11a551[_0x6953('0x57')](_0x6953('0xac'),_0x6953('0xad'));_0x11a551[_0x6953('0x57')](_0x6953('0xae'),_0x6953('0xaf'));_0x11a551['field'](_0x6953('0xb0'),'Contact.mobile');_0x11a551[_0x6953('0x57')]('c.fax',_0x6953('0xb1'));_0x11a551[_0x6953('0x57')](_0x6953('0xb2'),_0x6953('0xb3'));_0x11a551[_0x6953('0x57')]('o.internal',_0x6953('0xb4'));_0x11a551['field'](_0x6953('0xb5'),_0x6953('0x42'));}if(_0x2d5403[_0x6953('0x38')])_0x11a551[_0x6953('0x38')](_0x2d5403['limit']);if(_0x2d5403[_0x6953('0x37')])_0x11a551[_0x6953('0x37')](_0x2d5403[_0x6953('0x37')]);return db[_0x6953('0xa1')][_0x6953('0x4a')](_0x11a551[_0x6953('0xa2')](),_0x8832c7);})[_0x6953('0x3d')](function(_0x582bfa){_0x238ab2[_0x6953('0x55')](_0x6953('0xb6'),_[_0x6953('0x41')](_0x582bfa,'id'));return db[_0x6953('0xa1')][_0x6953('0x4a')](_0x238ab2['toString'](),_0x8832c7)['then'](function(_0x4e3420){var _0x20e315=_[_0x6953('0xb7')](_0x4e3420,_0x6953('0xb8'));var _0x518b5e=[];_0x582bfa[_0x6953('0x44')](function(_0x5268ba){_0x518b5e[_0x6953('0x46')](updateChatInteraction(_0x5268ba,_0x1de9f8,_0x20e315));});return BPromise[_0x6953('0xb9')](_0x518b5e);});});})['then'](function(_0x25851f){_0x2bdbb6['rows']=_0x25851f;return _0x2bdbb6;})[_0x6953('0x3d')](respondWithFilteredResult(_0x588ff8,_0x2d5403));})['catch'](handleError(_0x588ff8,null));};exports['show']=function(_0x1d765a,_0x45c9fc){var _0xbf0da2={'raw':![],'where':{'id':_0x1d765a[_0x6953('0xba')]['id']}},_0x14ad16={};_0x14ad16[_0x6953('0x4f')]=_[_0x6953('0x4b')](db[_0x6953('0xa4')]['rawAttributes']);_0x14ad16['query']=_['keys'](_0x1d765a[_0x6953('0x4a')]);_0x14ad16[_0x6953('0x4c')]=_[_0x6953('0x4d')](_0x14ad16[_0x6953('0x4f')],_0x14ad16[_0x6953('0x4a')]);_0xbf0da2['attributes']=_[_0x6953('0x4d')](_0x14ad16[_0x6953('0x4f')],qs[_0x6953('0x50')](_0x1d765a[_0x6953('0x4a')][_0x6953('0x50')]));_0xbf0da2[_0x6953('0x4e')]=_0xbf0da2[_0x6953('0x4e')][_0x6953('0x51')]?_0xbf0da2['attributes']:_0x14ad16[_0x6953('0x4f')];if(_0x1d765a['query'][_0x6953('0xbb')]){_0xbf0da2[_0x6953('0xbc')]=[{'all':!![]}];}_0xbf0da2=_[_0x6953('0xbd')]({},_0xbf0da2,_0x1d765a[_0x6953('0xbe')]);return db[_0x6953('0xa4')][_0x6953('0x6b')](_0xbf0da2)['then'](handleEntityNotFound(_0x45c9fc,null))[_0x6953('0x3d')](respondWithResult(_0x45c9fc,null))['catch'](handleError(_0x45c9fc,null));};exports[_0x6953('0xbf')]=function(_0x19a383,_0x3f4e63){return db[_0x6953('0xa4')][_0x6953('0xbf')](_0x19a383[_0x6953('0x81')],{})[_0x6953('0x3d')](respondWithResult(_0x3f4e63,0xc9))[_0x6953('0x31')](handleError(_0x3f4e63,null));};exports[_0x6953('0xc0')]=function(_0x4729b5,_0x151e3b){if(_0x4729b5[_0x6953('0x81')]['id']){delete _0x4729b5[_0x6953('0x81')]['id'];}return db[_0x6953('0xa4')]['find']({'where':{'id':_0x4729b5[_0x6953('0xba')]['id']}})['then'](handleEntityNotFound(_0x151e3b,null))['then'](saveUpdates(_0x4729b5['body'],null))[_0x6953('0x3d')](respondWithResult(_0x151e3b,null))[_0x6953('0x31')](handleError(_0x151e3b,null));};exports[_0x6953('0x3c')]=function(_0x271dd8,_0x3e2de8){return db[_0x6953('0xa4')][_0x6953('0x6b')]({'where':{'id':_0x271dd8[_0x6953('0xba')]['id']}})[_0x6953('0x3d')](handleEntityNotFound(_0x3e2de8,null))[_0x6953('0x3d')](removeEntity(_0x3e2de8,null))[_0x6953('0x31')](handleError(_0x3e2de8,null));};exports[_0x6953('0xc1')]=function(_0x105671,_0x597b7a){return db[_0x6953('0xa4')][_0x6953('0xc1')]()[_0x6953('0x3d')](respondWithResult(_0x597b7a,null))[_0x6953('0x31')](handleError(_0x597b7a,null));};exports['createVidaooSession']=function(_0x139e43,_0x162f01){var _0x5eaf51=_0x139e43[_0x6953('0xba')]['id'];var _0x2358e8;var _0x18dab4;var _0x2245a0;return db[_0x6953('0xa4')]['findOne']({'where':{'id':_0x5eaf51}})[_0x6953('0x3d')](function(_0x395cca){_0x2358e8=_0x395cca;return db[_0x6953('0xc2')][_0x6953('0xc3')]({'where':{'id':_0x395cca[_0x6953('0x84')]},'attributes':['id',_0x6953('0xc4'),_0x6953('0xc5')],'raw':!![]});})[_0x6953('0x3d')](function(_0x2ae12c){if(_0x2ae12c&&_0x2ae12c[_0x6953('0xc4')]&&_0x2ae12c[_0x6953('0xc5')]){_0x18dab4=_0x2ae12c;var _0x4b778e={'rejectUnauthorized':![],'method':'POST','uri':_0x6953('0xc6'),'headers':{'X-APIKEY':_0x2ae12c[_0x6953('0xc4')]},'body':{'name':_0x6953('0xc7')+_0x5eaf51},'redirect':_0x6953('0xc8'),'json':!![]};return rp(_0x4b778e);}else{throw new db[(_0x6953('0x25'))][(_0x6953('0x26'))](_0x6953('0xc9'));}})[_0x6953('0x3d')](function(_0x56cf6f){_0x2245a0=_0x56cf6f;if(_0x2245a0['id']){var _0x5e6892={'body':_0x2245a0[_0x6953('0xca')],'ChatWebsiteId':_0x18dab4['id'],'ChatInteractionId':_0x2358e8['id'],'direction':'out','UserId':_0x139e43[_0x6953('0x9e')]['id']};return db[_0x6953('0xcb')]['create'](_0x5e6892,{});}else{throw new db[(_0x6953('0x25'))][(_0x6953('0x26'))](_0x6953('0xcc'));}})[_0x6953('0x3d')](function(){return _0x2358e8[_0x6953('0xcd')]({'vidaooSessionId':_0x2245a0['id']});})['then'](respondWithResult(_0x162f01,null))[_0x6953('0x31')](handleError(_0x162f01,null));};exports['customUpdate']=function(_0x4eeecf,_0x247b13){if(_0x4eeecf['body']['id']){delete _0x4eeecf[_0x6953('0x81')]['id'];}return db[_0x6953('0xa4')]['find']({'where':{'id':_0x4eeecf[_0x6953('0xba')]['id']}})[_0x6953('0x3d')](handleEntityNotFound(_0x247b13,null))[_0x6953('0x3d')](saveUpdates(_0x4eeecf[_0x6953('0x81')],null))[_0x6953('0x3d')](respondWithResult(_0x247b13,null))[_0x6953('0x31')](handleError(_0x247b13,null));};exports[_0x6953('0xce')]=function(_0x2941a9,_0x524e20,_0x3dbe0b){if(_0x2941a9[_0x6953('0x81')]['id']){delete _0x2941a9[_0x6953('0x81')]['id'];}return db[_0x6953('0xa4')][_0x6953('0x6b')]({'where':{'id':_0x2941a9[_0x6953('0xba')]['id']}})[_0x6953('0x3d')](function(_0x2f3ed9){if(!_0x2f3ed9){logger['error'](_0x6953('0xcf'),_0x6953('0xce'),0x194,_0x6953('0xd0'));_0x524e20[_0x6953('0x32')](0x194);}else{if(_0x2f3ed9[_0x6953('0x7f')]){throw new db[(_0x6953('0x25'))][(_0x6953('0x26'))]('Interaction\x20already\x20assigned');}}return _0x2f3ed9;})['then'](function(_0x43c988){if(_0x43c988){return _0x43c988[_0x6953('0xc0')]({'closed':_0x2941a9[_0x6953('0x81')][_0x6953('0xd1')],'disposition':_0x2941a9[_0x6953('0x81')][_0x6953('0xd2')]})[_0x6953('0x3d')](function(_0x3c9bfb){return _0x3c9bfb;});}})[_0x6953('0x3d')](function(_0x255009){return respondWithRpcPromise(_0x6953('0xd3'),_0x6953('0xce'),_0x2941a9[_0x6953('0x81')],client9004);})[_0x6953('0x3d')](respondWithResult(_0x524e20,null))[_0x6953('0x31')](handleError(_0x524e20,null));};exports['attachmentUpload']=function(_0x1035b5,_0x480984,_0x4dd6f5){_0x1035b5[_0x6953('0x81')]['name']=_0x1035b5[_0x6953('0xd4')][_0x6953('0xd5')];_0x1035b5[_0x6953('0x81')][_0x6953('0xd6')]=_0x1035b5[_0x6953('0xd4')][_0x6953('0xd7')];_0x1035b5['body'][_0x6953('0x78')]=_0x1035b5[_0x6953('0xd4')][_0x6953('0xd8')];return db[_0x6953('0xd9')][_0x6953('0xbf')](_0x1035b5[_0x6953('0x81')])['then'](respondWithResult(_0x480984,0xc9))[_0x6953('0x31')](handleError(_0x480984,null));};exports[_0x6953('0xda')]=function(_0x28b61c,_0x3399a3,_0x3c58c4){return db['ChatInteraction'][_0x6953('0xc3')]({'where':{'id':_0x28b61c[_0x6953('0xba')]['id']},'raw':!![]})[_0x6953('0x3d')](handleEntityNotFound(_0x3399a3,null))[_0x6953('0x3d')](function(_0x132c54){if(_0x132c54){if(_0x132c54[_0x6953('0xd1')]){return _0x3399a3[_0x6953('0x34')](0x193)[_0x6953('0x35')]({'status':0x193,'message':_0x6953('0xdb')});}return db[_0x6953('0xd9')][_0x6953('0xc3')]({'where':{'id':_0x28b61c[_0x6953('0x4a')][_0x6953('0xdc')]},'raw':!![]})['then'](handleEntityNotFound(_0x3399a3,null));}})[_0x6953('0x3d')](function(_0x3f2cf1){if(_0x3f2cf1){return _0x3399a3[_0x6953('0xdd')](path[_0x6953('0xde')](config[_0x6953('0xdf')],_0x6953('0xe0'),_0x3f2cf1['basename']));}})['catch'](handleError(_0x3399a3,null));};exports[_0x6953('0xe1')]=function(_0x548f3e,_0x8f15bc){var _0x3a17bb=null;var _0x2e4737=null;var _0x331563=null;var _0x2ff051=null;if(_0x548f3e[_0x6953('0x81')]['id']){delete _0x548f3e['body']['id'];}if(_0x548f3e[_0x6953('0x81')][_0x6953('0xe2')]){_0x2ff051=path[_0x6953('0xde')](config[_0x6953('0xdf')],_0x6953('0xe3'),util[_0x6953('0xe4')](_0x6953('0xe5'),Date[_0x6953('0xe6')]()));_0x548f3e['body'][_0x6953('0xe7')]=_0x2ff051;}return db[_0x6953('0xa4')]['find']({'where':{'id':_0x548f3e[_0x6953('0xba')]['id']},'include':[{'model':db[_0x6953('0xcb')],'as':_0x6953('0xe8'),'include':[{'model':db[_0x6953('0x7c')],'as':_0x6953('0x7c')}]}]})[_0x6953('0x3d')](handleEntityNotFound(_0x8f15bc,null))[_0x6953('0x3d')](saveUpdates(_0x548f3e[_0x6953('0x81')],null))[_0x6953('0x3d')](function(_0x17563f){if(_0x17563f){_0x3a17bb=_0x17563f;return db['ChatWebsite'][_0x6953('0x6b')]({'where':{'id':_0x3a17bb['ChatWebsiteId']}});}})['then'](function(_0xd28ac9){if(_0xd28ac9){_0x331563=_0xd28ac9;return db[_0x6953('0xe9')][_0x6953('0x6b')]({'where':{'id':_0x3a17bb['ContactId']}});}})['then'](function(_0x2bfb1b){if(_0x2bfb1b){_0x2e4737=_0x2bfb1b;if(_0x2ff051){var _0x47aef1=null;for(var _0x304553=0x1;_0x304553<_0x3a17bb['Messages'][_0x6953('0x51')];++_0x304553){_0x47aef1=_0x3a17bb[_0x6953('0xe8')][_0x304553];var _0x5c63c7=_0x47aef1['UserId']?util[_0x6953('0xe4')](_0x6953('0xea'),_0x331563[_0x6953('0xeb')],_0x47aef1[_0x6953('0x7f')]):'System';var _0x5ef901=_0x548f3e[_0x6953('0x81')][_0x6953('0xec')]||util[_0x6953('0xe4')](_0x6953('0xea'),_0x6953('0xed'),_0x47aef1[_0x6953('0x76')]);switch(_0x331563[_0x6953('0xee')]){case _0x6953('0xef'):_0x5c63c7=_0x47aef1[_0x6953('0x7f')]?util['format'](_0x6953('0xea'),_0x331563[_0x6953('0xeb')],_0x47aef1[_0x6953('0x7f')]):_0x6953('0xf0');break;case _0x6953('0xf1'):_0x5c63c7=_0x47aef1[_0x6953('0x7f')]?_0x47aef1[_0x6953('0x7c')][_0x6953('0xf2')]||_0x47aef1[_0x6953('0x7c')][_0x6953('0xf3')]:_0x6953('0xf0');break;case _0x6953('0xf4'):_0x5c63c7=_0x47aef1[_0x6953('0x7f')]?_0x47aef1[_0x6953('0x7c')][_0x6953('0xf3')]:_0x6953('0xf0');break;default:_0x5c63c7=_0x47aef1[_0x6953('0x7f')]?util[_0x6953('0xe4')](_0x6953('0xea'),_0x331563[_0x6953('0xeb')],_0x47aef1[_0x6953('0x7f')]):_0x6953('0xf0');}var _0x40d8b4=util[_0x6953('0xe4')](_0x6953('0xf5'),moment(_0x47aef1['createdAt'])[_0x6953('0xe4')]('MM/DD/YYYY\x20HH:mm:ss'),_0x47aef1[_0x6953('0xf6')]==='in'?_0x5ef901:_0x5c63c7,_0x47aef1[_0x6953('0x81')]);if(!_0x47aef1[_0x6953('0xf7')]){fs[_0x6953('0xf8')](_0x2ff051,_0x40d8b4);}}return db[_0x6953('0xf9')][_0x6953('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0x6953('0xfa')],'as':'Smtp','raw':!![]}]});}}})[_0x6953('0x3d')](function(_0x43a23e){if(_0x43a23e&&_0x43a23e[_0x6953('0xfb')]&&_0x548f3e[_0x6953('0x81')]){var _0x1a2525={'tls':{'rejectUnauthorized':![]}};if(_0x43a23e[_0x6953('0xfb')][_0x6953('0xfc')]){_0x1a2525[_0x6953('0xfc')]=_0x43a23e[_0x6953('0xfb')][_0x6953('0xfc')];}else{_0x1a2525[_0x6953('0xfd')]=_0x43a23e[_0x6953('0xfb')]['host'];_0x1a2525[_0x6953('0xfe')]=_0x43a23e[_0x6953('0xfb')][_0x6953('0xfe')];_0x1a2525[_0x6953('0xff')]=_0x43a23e[_0x6953('0xfb')][_0x6953('0xff')];}if(_0x43a23e[_0x6953('0xfb')]['authentication']){_0x1a2525[_0x6953('0x100')]={'user':_0x43a23e[_0x6953('0xfb')][_0x6953('0x9e')],'pass':_0x43a23e[_0x6953('0xfb')][_0x6953('0x101')]};}return respondWithRpcPromise(_0x6953('0x102'),_0x6953('0x103'),{'account':_0x1a2525,'message':{'from':util[_0x6953('0xe4')](_0x6953('0x104'),_0x43a23e[_0x6953('0x3e')],_0x43a23e[_0x6953('0x105')]||_0x43a23e[_0x6953('0xfb')][_0x6953('0x9e')]),'to':_0x548f3e[_0x6953('0x81')][_0x6953('0xe2')],'subject':'Mail\x20Transcript','text':util[_0x6953('0xe4')](_0x6953('0x106'),_0x548f3e[_0x6953('0x81')]['mailTranscript']),'attachments':[{'path':_0x2ff051}]}})[_0x6953('0x3d')](function(){return _0x3a17bb;})[_0x6953('0x31')](function(_0x47c7ce){console['error'](_0x47c7ce);});}else{return _0x3a17bb;}})[_0x6953('0x3d')](respondWithStatusCode(_0x8f15bc,0xc8))['catch'](handleError(_0x8f15bc,null));};exports[_0x6953('0x107')]=function(_0x1bfc79,_0x466b60,_0x3cc2b7){return db['ChatMessage']['find']({'where':{'id':_0x1bfc79[_0x6953('0xba')]['id']}})[_0x6953('0x3d')](handleEntityNotFound(_0x466b60,null))[_0x6953('0x3d')](function(_0x3fe54f){if(_0x3fe54f){return _0x3fe54f[_0x6953('0x107')](_0x1bfc79[_0x6953('0x81')][_0x6953('0x108')],_[_0x6953('0x109')](_0x1bfc79[_0x6953('0x81')],[_0x6953('0x108'),'id'])||{});}})['then'](respondWithResult(_0x466b60,null))[_0x6953('0x31')](handleError(_0x466b60,null));};exports[_0x6953('0x10a')]=function(_0x580ba6,_0x4bdc48,_0x492b50){var _0x1bc457={'raw':![],'where':{}};var _0x81cd9={};var _0x2664c3={'count':0x0,'rows':[]};return db[_0x6953('0xa4')][_0x6953('0xc3')]({'where':{'id':_0x580ba6[_0x6953('0xba')]['id']}})[_0x6953('0x3d')](handleEntityNotFound(_0x4bdc48,null))[_0x6953('0x3d')](function(_0x5914f0){if(_0x5914f0){_0x81cd9[_0x6953('0x4f')]=_[_0x6953('0x4b')](db[_0x6953('0xcb')]['rawAttributes']);_0x81cd9[_0x6953('0x4a')]=_['keys'](_0x580ba6[_0x6953('0x4a')]);_0x81cd9[_0x6953('0x4c')]=_['intersection'](_0x81cd9[_0x6953('0x4f')],_0x81cd9[_0x6953('0x4a')]);_0x1bc457[_0x6953('0x4e')]=_[_0x6953('0x4d')](_0x81cd9[_0x6953('0x4f')],qs[_0x6953('0x50')](_0x580ba6[_0x6953('0x4a')][_0x6953('0x50')]));_0x1bc457[_0x6953('0x4e')]=_0x1bc457[_0x6953('0x4e')][_0x6953('0x51')]?_0x1bc457[_0x6953('0x4e')]:_0x81cd9[_0x6953('0x4f')];if(!_0x580ba6['query'][_0x6953('0x10b')](_0x6953('0x52'))){_0x1bc457[_0x6953('0x38')]=qs[_0x6953('0x38')](_0x580ba6['query'][_0x6953('0x38')]);_0x1bc457[_0x6953('0x37')]=qs[_0x6953('0x37')](_0x580ba6[_0x6953('0x4a')]['offset']);}_0x1bc457['order']=qs[_0x6953('0x54')](_0x580ba6[_0x6953('0x4a')][_0x6953('0x54')]);_0x1bc457['where']=qs[_0x6953('0x4c')](_[_0x6953('0x56')](_0x580ba6['query'],_0x81cd9['filters']));_0x1bc457[_0x6953('0x55')][_0x6953('0xb8')]=_0x5914f0['id'];if(_0x580ba6[_0x6953('0x4a')]['filter']){_0x1bc457['where']=_[_0x6953('0xbd')](_0x1bc457[_0x6953('0x55')],{'$or':_['map'](_0x1bc457['attributes'],function(_0x3851db){var _0x57cabc={};_0x57cabc[_0x3851db]={'$like':'%'+_0x580ba6[_0x6953('0x4a')][_0x6953('0x8f')]+'%'};return _0x57cabc;})});}if(_0x580ba6['query']['$gte']){var _0x2073b3=_0x580ba6['query'][_0x6953('0x87')][_0x6953('0x43')](',');var _0x46da4f={};_0x46da4f[_0x2073b3[0x0]]={'$gte':moment(_0x2073b3[0x1])[_0x6953('0xe4')](_0x6953('0x10c'))};_0x1bc457[_0x6953('0x55')]=_[_0x6953('0xbd')](_0x1bc457[_0x6953('0x55')],_0x46da4f);}_0x1bc457=_[_0x6953('0xbd')]({},_0x1bc457,_0x580ba6[_0x6953('0xbe')]);return db['ChatMessage'][_0x6953('0x36')]({'where':_0x1bc457['where']})[_0x6953('0x3d')](function(_0x715dbb){_0x2664c3[_0x6953('0x36')]=_0x715dbb;if(_0x580ba6[_0x6953('0x4a')][_0x6953('0xbb')]){_0x1bc457[_0x6953('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x6953('0x10d')](_0x1bc457);})[_0x6953('0x3d')](function(_0x94d96d){_0x2664c3[_0x6953('0x10e')]=_0x94d96d;return _0x2664c3;});}})[_0x6953('0x3d')](respondWithFilteredResult(_0x4bdc48,_0x1bc457))['catch'](handleError(_0x4bdc48,null));};exports[_0x6953('0x10f')]=function(_0x50e929,_0x105d95,_0xc39b7){var _0x48206b={'where':{}},_0x35a52d={},_0x3b6450={'count':0x0,'rows':[]};return db[_0x6953('0xa4')]['findOne']({'where':{'id':_0x50e929[_0x6953('0xba')]['id']}})['then'](handleEntityNotFound(_0x105d95,null))['then'](function(_0x1bc639){if(_0x1bc639){_0x35a52d[_0x6953('0x4f')]=_['keys'](db[_0x6953('0xcb')]['rawAttributes']);_0x35a52d[_0x6953('0x4a')]=_['keys'](_0x50e929['query']);_0x35a52d['filters']=_[_0x6953('0x4d')](_0x35a52d[_0x6953('0x4f')],_0x35a52d[_0x6953('0x4a')]);_0x48206b[_0x6953('0x4e')]=_[_0x6953('0x4d')](_0x35a52d[_0x6953('0x4f')],qs[_0x6953('0x50')](_0x50e929[_0x6953('0x4a')][_0x6953('0x50')]));_0x48206b[_0x6953('0x4e')]=_0x48206b[_0x6953('0x4e')][_0x6953('0x51')]?_0x48206b[_0x6953('0x4e')]:_0x35a52d['model'];if(!_0x50e929['query']['hasOwnProperty']('nolimit')){_0x48206b[_0x6953('0x38')]=qs[_0x6953('0x38')](_0x50e929[_0x6953('0x4a')]['limit']);_0x48206b[_0x6953('0x37')]=qs[_0x6953('0x37')](_0x50e929[_0x6953('0x4a')][_0x6953('0x37')]);}_0x48206b[_0x6953('0x53')]=qs[_0x6953('0x54')](_0x50e929[_0x6953('0x4a')][_0x6953('0x54')]);_0x48206b[_0x6953('0x55')]=qs[_0x6953('0x4c')](_['pick'](_0x50e929[_0x6953('0x4a')],_0x35a52d[_0x6953('0x4c')]));_0x48206b[_0x6953('0x55')][_0x6953('0xb8')]=_0x1bc639['id'];if(_0x50e929['query']['filter']){_0x48206b['where']=_[_0x6953('0xbd')](_0x48206b[_0x6953('0x55')],{'$or':_[_0x6953('0x41')](_0x48206b['attributes'],function(_0x39eebb){var _0xdc3da5={};_0xdc3da5[_0x39eebb]={'$like':'%'+_0x50e929['query'][_0x6953('0x8f')]+'%'};return _0xdc3da5;})});}_0x48206b[_0x6953('0x55')][_0x6953('0xf7')]=![];if(_0x50e929[_0x6953('0x4a')]['id']){_0x48206b[_0x6953('0x55')]['id']={'$gt':_0x50e929[_0x6953('0x4a')]['id']};}_0x48206b=_[_0x6953('0xbd')]({},_0x48206b,_0x50e929[_0x6953('0xbe')]);return db['ChatMessage'][_0x6953('0x36')]({'where':_0x48206b[_0x6953('0x55')]})['then'](function(_0x1df8fe){_0x3b6450['count']=_0x1df8fe;_0x48206b['include']=[];if(_0x50e929[_0x6953('0x4a')][_0x6953('0x110')]){_0x48206b[_0x6953('0xbc')][_0x6953('0x46')]({'model':db[_0x6953('0x7c')],'as':'User','attributes':['id',_0x6953('0xf3'),'alias']});}if(_0x50e929['query']['includeAll']){_0x48206b[_0x6953('0xbc')]=[{'all':!![]}];}return db[_0x6953('0xcb')][_0x6953('0x10d')](_0x48206b);})['then'](function(_0x5689de){_0x3b6450['rows']=_0x5689de;return _0x3b6450;});}})[_0x6953('0x3d')](respondWithFilteredResult(_0x105d95,_0x48206b))[_0x6953('0x31')](handleError(_0x105d95,null));};exports[_0x6953('0x111')]=function(_0x521cc2,_0x30d89c,_0x3e244b){return db[_0x6953('0xa4')]['find']({'where':{'id':_0x521cc2[_0x6953('0xba')]['id']}})['then'](handleEntityNotFound(_0x30d89c,null))[_0x6953('0x3d')](function(_0x8a809f){if(_0x8a809f){return _0x8a809f['setTags'](_0x521cc2[_0x6953('0x81')][_0x6953('0x108')],_[_0x6953('0x109')](_0x521cc2[_0x6953('0x81')],[_0x6953('0x108'),'id'])||{})[_0x6953('0x112')](function(){return db['Tag'][_0x6953('0x10d')]({'attributes':['id','name','color'],'where':{'id':_0x521cc2[_0x6953('0x81')]['ids']}});})[_0x6953('0x3d')](function(_0x542902){socket[_0x6953('0x113')]('chatInteractionTags:save',{'id':Number(_0x521cc2['params']['id']),'tags':_0x542902||[]});return{'id':Number(_0x521cc2[_0x6953('0xba')]['id']),'tags':_0x542902||[]};});}})['then'](respondWithResult(_0x30d89c,null))['catch'](handleError(_0x30d89c,null));};exports[_0x6953('0x114')]=function(_0x134ad4,_0x56178a,_0xe8b28e){return db[_0x6953('0xa4')][_0x6953('0x6b')]({'where':{'id':_0x134ad4[_0x6953('0xba')]['id']}})['then'](handleEntityNotFound(_0x56178a,null))[_0x6953('0x3d')](function(_0x5cddcf){if(_0x5cddcf){return _0x5cddcf[_0x6953('0x114')](_0x134ad4[_0x6953('0x4a')][_0x6953('0x108')]);}})['then'](respondWithStatusCode(_0x56178a,null))[_0x6953('0x31')](handleError(_0x56178a,null));};exports['download']=function(_0x47be80,_0x4efb0f){var _0x25f02a=moment()[_0x6953('0x115')]()[_0x6953('0xa2')]();var _0x45ef51=path[_0x6953('0xde')](config['root'],_0x6953('0x116'),_0x6953('0x117'),_0x6953('0x118'));var _0x4d497c=path[_0x6953('0xde')](config[_0x6953('0xdf')],'server',_0x6953('0x117'),'attachments');var _0x4ed530=path[_0x6953('0xde')](_0x45ef51,_0x25f02a);var _0x2fb5eb=util[_0x6953('0xe4')](_0x6953('0x119'),_0x47be80[_0x6953('0xba')]['id'],_0x25f02a);var _0x3a085e=path[_0x6953('0xde')](_0x45ef51,_0x2fb5eb);var _0x126396=[];_0x126396['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x126396[_0x6953('0x46')]({'model':db[_0x6953('0xe9')],'as':'Contact','attributes':['id',_0x6953('0x11a'),_0x6953('0x11b')],'raw':!![]});if(_0x47be80['query'][_0x6953('0x11c')]){_0x126396['push']({'model':db[_0x6953('0xd9')],'as':_0x6953('0xd9'),'raw':!![]});}var _0x3a42d4=[{'model':db[_0x6953('0xcb')],'as':_0x6953('0xe8'),'attributes':['id',_0x6953('0x81'),_0x6953('0x86'),_0x6953('0xf6'),'secret',_0x6953('0x8c')],'include':_0x126396}];_0x3a42d4[_0x6953('0x46')]({'model':db[_0x6953('0xc2')],'as':_0x6953('0x11d'),'attributes':['id',_0x6953('0x3e')]});_0x3a42d4[_0x6953('0x46')]({'model':db[_0x6953('0x7c')],'as':_0x6953('0x11e'),'attributes':['id',_0x6953('0xf3')]});return db[_0x6953('0xa4')]['find']({'where':{'id':_0x47be80[_0x6953('0xba')]['id']},'include':_0x3a42d4})[_0x6953('0x3d')](handleEntityNotFound(_0x4efb0f,null))[_0x6953('0x3d')](function(_0x1b2472){if(_0x1b2472){var _0x3c3472=_0x1b2472[_0x6953('0x11f')]({'plain':!![]});fs[_0x6953('0x120')](_0x4ed530);var _0x385d81={'format':'A4','border':'10px','header':{'height':_0x6953('0x121'),'contents':{'first':_0x6953('0x122')}},'footer':{'height':'30px','contents':{'default':util[_0x6953('0xe4')](_0x6953('0x123'),util[_0x6953('0xe4')](_0x6953('0x124'),'Chat',_0x3c3472['id']),moment()['format'](_0x6953('0x125'))[_0x6953('0xa2')]())}}};var _0x3a74ab={'channel':'Chat','account':_0x3c3472[_0x6953('0x11d')][_0x6953('0x3e')],'agent':_0x3c3472['Owner']?_0x3c3472[_0x6953('0x11e')]['fullname']:_0x6953('0x126'),'createdAt':moment(_0x3c3472['createdAt'])['format'](_0x6953('0x10c'))[_0x6953('0xa2')](),'closedAt':_0x3c3472[_0x6953('0xd1')]?moment(_0x3c3472[_0x6953('0x127')])['format'](_0x6953('0x10c'))[_0x6953('0xa2')]():'','disposition':_0x3c3472['disposition'],'chatInfo':{'browser':_0x3c3472[_0x6953('0x128')],'os':_0x3c3472['osName'],'referer':_0x3c3472[_0x6953('0x129')],'customerIp':_0x3c3472[_0x6953('0x12a')],'customerPort':_0x3c3472['customerPort']?_0x3c3472[_0x6953('0x12b')]:_0x6953('0x126')},'messages':_(_0x3c3472['Messages'])[_0x6953('0x12c')]()[_0x6953('0x8f')]({'secret':![]})[_0x6953('0x41')](function(_0x32a725){if(_0x32a725[_0x6953('0xd9')]){var _0x73af51=path[_0x6953('0xde')](_0x4d497c,_0x32a725[_0x6953('0xd9')][_0x6953('0xd6')]);if(fs[_0x6953('0x12d')](_0x73af51)){fs[_0x6953('0x12e')](_0x73af51)['pipe'](fs[_0x6953('0x12f')](path[_0x6953('0xde')](_0x4ed530,_0x32a725[_0x6953('0xd9')][_0x6953('0xd6')])));}}return{'date':moment(_0x32a725[_0x6953('0x86')])[_0x6953('0xe4')](_0x6953('0x10c'))['toString'](),'sender':_0x32a725[_0x6953('0xf6')]===_0x6953('0x130')?_0x32a725[_0x6953('0x7c')]?_0x32a725[_0x6953('0x7c')][_0x6953('0xf3')]:_0x6953('0xf0'):_0x32a725[_0x6953('0x71')][_0x6953('0x11a')]+(_0x32a725[_0x6953('0x71')][_0x6953('0x11b')]?'\x20'+_0x32a725[_0x6953('0x71')][_0x6953('0x11b')]:''),'body':_0x32a725['Attachment']?_0x32a725['Attachment'][_0x6953('0xd6')]:_0x32a725[_0x6953('0x81')],'direction':_0x32a725[_0x6953('0xf6')]===_0x6953('0x130')?'A':'C','secret':_0x32a725[_0x6953('0xf7')],'read':_0x32a725[_0x6953('0x8c')],'attachment':_0x32a725[_0x6953('0xd9')]};})[_0x6953('0x6d')]()};return ejs[_0x6953('0x131')](path[_0x6953('0xde')](config[_0x6953('0xdf')],'server',_0x6953('0x132'),'downloadInteraction.html'),{'interaction':_0x3a74ab})[_0x6953('0x3d')](function(_0x14a50c){return new BPromise(function(_0x5e9669,_0x47694e){pdf[_0x6953('0xbf')](_0x14a50c,_0x385d81)[_0x6953('0x133')](path[_0x6953('0xde')](_0x4ed530,_0x6953('0x134')+_0x3c3472['id']+'-'+_0x25f02a+_0x6953('0x135')),function(_0x56adaf,_0x3ee455){if(_0x56adaf)return _0x47694e(_0x56adaf);_0x5e9669(_0x3ee455);});});})[_0x6953('0x3d')](function(){return new BPromise(function(_0x3b5832,_0x14bbae){zipdir(_0x4ed530,{'saveTo':_0x3a085e},function(_0x50b625,_0x11a94a){if(_0x50b625)return _0x14bbae(_0x50b625);return _0x3b5832(_0x11a94a);});})[_0x6953('0x3d')](function(){return new BPromise(function(_0x4460ed,_0x2b0bb4){rimraf(_0x4ed530,function(_0x5517a0){if(_0x5517a0)_0x2b0bb4(_0x5517a0);return _0x4460ed();});});})[_0x6953('0x3d')](function(){return _0x4efb0f['download'](_0x3a085e,_0x2fb5eb,function(_0x10d883){if(_0x10d883){console[_0x6953('0x136')](_0x6953('0x137'),_0x10d883);}else{fs[_0x6953('0x138')](_0x3a085e);}});});});}else{return _0x4efb0f[_0x6953('0x32')](0xc8);}})['catch'](handleError(_0x4efb0f,null));}; \ No newline at end of file +var _0x430c=['findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','filename','mimetype','json','Unauthorized','Attachment','download','join','root','server/files/attachments/','basename','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','%s%d','System','agentIdentifier','website_alias','agentAlias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','Smtp','service','host','port','secure','authentication','pass','SendMail','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','getMessages','hasOwnProperty','ChatInteractionId','merge','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','includeAgent','addTags','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Account','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','Chat','YYYY-MM-DD','Owner','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','transcript-','err','html-pdf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','client','http','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~!@#$%^&-_=+[{]}.','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','nolimit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','union','User','find','UserId','start','keys','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','fields','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','create','body','update','describe','createVidaooSession'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x430c,0x1a1));var _0xc430=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x430c[_0x5ef55a];return _0x20ae40;};'use strict';var pdf=require(_0xc430('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc430('0x1'));var jsonpatch=require(_0xc430('0x2'));var rp=require(_0xc430('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc430('0x4'));var sox=require(_0xc430('0x5'));var csv=require('to-csv');var ejs=require(_0xc430('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0xb'));var querystring=require(_0xc430('0xc'));var Papa=require(_0xc430('0xd'));var Redis=require(_0xc430('0xe'));var authService=require(_0xc430('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0x10'));var hardwareService=require(_0xc430('0x11'));var logger=require('../../config/logger')(_0xc430('0x12'));var utils=require('../../config/utils');var config=require(_0xc430('0x13'));var db=require('../../mysqldb')['db'];config[_0xc430('0x14')]=_[_0xc430('0x15')](config[_0xc430('0x14')],{'host':_0xc430('0x16'),'port':0x18eb});var socket=require(_0xc430('0x17'))(new Redis(config[_0xc430('0x14')]));require(_0xc430('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc430('0x19')][_0xc430('0x1a')]({'port':0x232b});var client9004=jayson[_0xc430('0x19')][_0xc430('0x1a')]({'port':0x232c});function checkPasswordPattern(_0x31d3b7,_0x55cc6c,_0x111598){if(_0x111598){var _0x4aeb72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4aeb72['test'](_0x55cc6c)){return _0x31d3b7;}else{throw new db[(_0xc430('0x1b'))][(_0xc430('0x1c'))](_0xc430('0x1d'));}}else{return _0x31d3b7;}}function respondWithRpcPromise(_0x5830b0,_0x5d3acc,_0x36d112,_0x4c1937){return new BPromise(function(_0x2bcb21,_0x4f7094){var _0x564522=_0x4c1937||client;return _0x564522[_0xc430('0x1e')](_0x5830b0,_0x36d112)['then'](function(_0x302926){logger[_0xc430('0x1f')](_0xc430('0x20'),_0x5d3acc,_0xc430('0x21'));logger[_0xc430('0x22')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5d3acc,_0xc430('0x21'),JSON['stringify'](_0x302926));if(_0x302926['error']){if(_0x302926[_0xc430('0x23')][_0xc430('0x24')]===0x1f4){logger[_0xc430('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x5d3acc,_0x302926[_0xc430('0x23')]['message']);return _0x4f7094(_0x302926[_0xc430('0x23')][_0xc430('0x25')]);}logger['error'](_0xc430('0x20'),_0x5d3acc,_0x302926[_0xc430('0x23')]['message']);return _0x2bcb21(_0x302926[_0xc430('0x23')]['message']);}else{logger[_0xc430('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x5d3acc,_0xc430('0x21'));_0x2bcb21(_0x302926[_0xc430('0x26')]['message']);}})[_0xc430('0x27')](function(_0x2ec021){logger[_0xc430('0x23')](_0xc430('0x20'),_0x5d3acc,_0x2ec021);_0x4f7094(_0x2ec021);});});}function respondWithStatusCode(_0x285407,_0x57cd72){_0x57cd72=_0x57cd72||0xcc;return function(_0x2ccc13){if(_0x2ccc13){return _0x285407[_0xc430('0x28')](_0x57cd72);}return _0x285407[_0xc430('0x29')](_0x57cd72)[_0xc430('0x2a')]();};}function respondWithResult(_0x542cba,_0x1f8086){_0x1f8086=_0x1f8086||0xc8;return function(_0x4cf56c){if(_0x4cf56c){return _0x542cba[_0xc430('0x29')](_0x1f8086)['json'](_0x4cf56c);}};}function respondWithFilteredResult(_0x6b263b,_0x1045c0){return function(_0xfc8767){if(_0xfc8767){var _0x3d7ccf=_0xfc8767[_0xc430('0x2b')],_0x49977b=_0x1045c0[_0xc430('0x2c')],_0x17c975=_0x1045c0['offset']+_0x1045c0[_0xc430('0x2d')],_0x2a85aa;if(_0x17c975>=_0x3d7ccf){_0x17c975=_0x3d7ccf;_0x2a85aa=0xc8;}else{_0x2a85aa=0xce;}_0x6b263b[_0xc430('0x29')](_0x2a85aa);return _0x6b263b['set'](_0xc430('0x2e'),_0x49977b+'-'+_0x17c975+'/'+_0x3d7ccf)['json'](_0xfc8767);}return null;};}function patchUpdates(_0x5453a7){return function(_0x37d360){try{jsonpatch[_0xc430('0x2f')](_0x37d360,_0x5453a7,!![]);}catch(_0x7f7ad9){return BPromise[_0xc430('0x30')](_0x7f7ad9);}return _0x37d360[_0xc430('0x31')]();};}function saveUpdates(_0x63878e,_0x438879){return function(_0x25a81d){if(_0x25a81d){return _0x25a81d['update'](_0x63878e)[_0xc430('0x32')](function(_0x4c7fc8){return _0x4c7fc8;});}return null;};}function removeEntity(_0x119bee,_0x43029d){return function(_0x3fec7c){if(_0x3fec7c){return _0x3fec7c[_0xc430('0x33')]()['then'](function(){_0x119bee[_0xc430('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x517d2b,_0x2d6cec){return function(_0x3ebdc0){if(!_0x3ebdc0){_0x517d2b['sendStatus'](0x194);}return _0x3ebdc0;};}function handleError(_0x5ff73c,_0x10e589){_0x10e589=_0x10e589||0x1f4;return function(_0x104cfa){logger[_0xc430('0x23')](_0x104cfa[_0xc430('0x34')]);if(_0x104cfa[_0xc430('0x35')]){delete _0x104cfa[_0xc430('0x35')];}_0x5ff73c[_0xc430('0x29')](_0x10e589)[_0xc430('0x36')](_0x104cfa);};}function getInteractionUsers(_0x7e18ec,_0x2ef4a6){return new BPromise(function(_0x41a2c2,_0x5fd38b){try{if(_0x2ef4a6[_0x7e18ec['id']]){_0x7e18ec[_0xc430('0x37')]=_[_0xc430('0x38')](_0x2ef4a6[_0x7e18ec['id']],function(_0x537e4c){return{'id':_0x537e4c['id'],'fullname':_0x537e4c[_0xc430('0x39')]};});}}catch(_0x2e91e9){_0x5fd38b(_0x2e91e9);}_0x41a2c2(_0x7e18ec);});}function getInteractionTags(_0x24363b,_0x8c163e){return new BPromise(function(_0x5a05d8,_0x30f9b7){try{if(_0x24363b[_0xc430('0x3a')]){_0x24363b[_0xc430('0x3b')]=[];_0x24363b[_0xc430('0x3a')][_0xc430('0x3c')](',')[_0xc430('0x3d')](function(_0x52b1a7){_0x24363b[_0xc430('0x3b')][_0xc430('0x3e')](_0x8c163e[_0x52b1a7]);});}delete _0x24363b[_0xc430('0x3a')];}catch(_0x1efaf5){_0x30f9b7(_0x1efaf5);}_0x5a05d8(_0x24363b);});}function updateChatInteraction(_0x1d156c,_0x463873,_0x46f98d){return new BPromise(function(_0x2cde1e,_0x469a0c){return getInteractionUsers(_0x1d156c,_0x46f98d)[_0xc430('0x32')](function(_0x31f32a){return getInteractionTags(_0x31f32a,_0x463873);})[_0xc430('0x32')](function(_0x3bc969){_0x2cde1e(_0x3bc969);})[_0xc430('0x27')](function(_0x5a9c4b){_0x469a0c(_0x5a9c4b);});});}exports['index']=function(_0x4983e0,_0x262063){var _0x254611={},_0x438020={},_0xb69eae={'count':0x0,'rows':[]};var _0x3c52dc=_[_0xc430('0x38')](db[_0xc430('0x3f')][_0xc430('0x40')],function(_0x2d3473){return{'name':_0x2d3473[_0xc430('0x41')],'type':_0x2d3473[_0xc430('0x42')][_0xc430('0x43')]};});_0x438020[_0xc430('0x44')]=_[_0xc430('0x38')](_0x3c52dc,_0xc430('0x35'));_0x438020[_0xc430('0x45')]=_['keys'](_0x4983e0[_0xc430('0x45')]);_0x438020[_0xc430('0x46')]=_[_0xc430('0x47')](_0x438020[_0xc430('0x44')],_0x438020[_0xc430('0x45')]);_0x254611[_0xc430('0x48')]=_[_0xc430('0x47')](_0x438020[_0xc430('0x44')],qs['fields'](_0x4983e0[_0xc430('0x45')]['fields']));_0x254611[_0xc430('0x48')]=_0x254611[_0xc430('0x48')]['length']?_0x254611['attributes']:_0x438020[_0xc430('0x44')];if(!_0x4983e0['query']['hasOwnProperty'](_0xc430('0x49'))){_0x254611['limit']=qs[_0xc430('0x2d')](_0x4983e0[_0xc430('0x45')][_0xc430('0x2d')]);_0x254611['offset']=qs[_0xc430('0x2c')](_0x4983e0[_0xc430('0x45')][_0xc430('0x2c')]);}_0x254611['order']=qs[_0xc430('0x4a')](_0x4983e0[_0xc430('0x45')][_0xc430('0x4a')]);_0x254611[_0xc430('0x4b')]=qs[_0xc430('0x46')](_[_0xc430('0x4c')](_0x4983e0[_0xc430('0x45')],_0x438020['filters']),_0x3c52dc);var _0x115441=[];var _0x3e49c7=squel[_0xc430('0x4d')]()['field']('id')[_0xc430('0x4e')](_0xc430('0x35'))[_0xc430('0x4e')](_0xc430('0x4f'))['from'](_0xc430('0x50'));var _0x514c38=squel[_0xc430('0x4d')]()[_0xc430('0x4e')](_0xc430('0x51'))[_0xc430('0x4e')](_0xc430('0x52'))[_0xc430('0x4e')]('ui.ChatInteractionId')[_0xc430('0x53')](_0xc430('0x54'),'ui')['left_join'](_0xc430('0x55'),'u',_0xc430('0x56'));var _0x9cc64a=squel[_0xc430('0x4d')]()['from'](_0xc430('0x57'),'i')['left_join'](_0xc430('0x58'),'c',_0xc430('0x59'))[_0xc430('0x5a')](_0xc430('0x55'),'o','o.id\x20=\x20i.UserId')[_0xc430('0x5a')](_0xc430('0x5b'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0xc430('0x5c'),'me',_0xc430('0x5d'))[_0xc430('0x5a')](_0xc430('0x5e'),'it',_0xc430('0x5f'))[_0xc430('0x5a')](_0xc430('0x50'),'t','t.id\x20=\x20it.TagId');var _0x310aae=squel['expr']();var _0xf8bb6c=[];var _0x8cb2e3=squel[_0xc430('0x60')]();var _0x4184cc;if(_0x4983e0[_0xc430('0x45')][_0xc430('0x61')]){_0x4184cc=as['parseSearch'](_0x4983e0[_0xc430('0x45')][_0xc430('0x61')]);var _0xd91525=_0x4184cc[_0xc430('0x62')];for(var _0x10c7a4=0x0;_0x10c7a4<_0x4184cc[_0xc430('0x63')][_0xc430('0x64')];_0x10c7a4++){var _0x56e25a=_0x4184cc[_0xc430('0x63')][_0x10c7a4];var _0x52b5b4='i';var _0x2a4ad3=_['find'](_0x3c52dc,[_0xc430('0x35'),_0x56e25a[_0xc430('0x4e')]]);if(!_0x2a4ad3){switch(_0x56e25a[_0xc430('0x4e')]){case _0xc430('0x65'):if(_0x56e25a[_0xc430('0x66')]==0x1){_0x9cc64a[_0xc430('0x67')]('`'+_0x56e25a['field']+_0xc430('0x68'));}else{_0x9cc64a[_0xc430('0x67')]('`'+_0x56e25a['field']+'`\x20>\x200');}break;case _0xc430('0x69'):if(_0x56e25a[_0xc430('0x6a')]===_0xc430('0x6b')){if(_0x56e25a[_0xc430('0x66')][_0xc430('0x3c')]('\x20')[_0xc430('0x64')]>0x1){_0x310aae[_0xd91525](_0xc430('0x6c'),qs[_0xc430('0x6d')](_0x56e25a[_0xc430('0x66')]),null);}else{var _0x2c0e13='%'+_0x56e25a[_0xc430('0x66')]+'%';_0x310aae[_0xd91525](_0xc430('0x6e'),_0x2c0e13,_0x2c0e13,_0x2c0e13);}}else{_0x2a4ad3=_['find'](_0x3c52dc,['name',_0xc430('0x6f')]);_0x56e25a['field']=_0xc430('0x6f');_0x1c10b5=as[_0xc430('0x70')](_0x52b5b4,_0x2a4ad3['type'],_0x56e25a);_0x310aae[_0xd91525](_0x1c10b5[_0xc430('0x71')],_0x1c10b5['value']['start'],_0x1c10b5[_0xc430('0x66')][_0xc430('0x2a')]);}break;case'Tag':var _0x2ae493=_0x56e25a['value']['split'](',')[_0xc430('0x38')](function(_0x3ab0ac){return Number(_0x3ab0ac);});_0x2ae493[_0xc430('0x3d')](function(_0x2c1620){_0x8cb2e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2c1620+',%');});_0xf8bb6c=_[_0xc430('0x72')](_0xf8bb6c,_0x2ae493);break;case _0xc430('0x73'):if(_0x56e25a[_0xc430('0x6a')]===_0xc430('0x6b')){_0x310aae[_0xd91525]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x56e25a[_0xc430('0x66')]+'%',null);}else{_0x2a4ad3=_[_0xc430('0x74')](_0x3c52dc,[_0xc430('0x35'),_0xc430('0x75')]);_0x56e25a[_0xc430('0x4e')]=_0xc430('0x75');_0x1c10b5=as[_0xc430('0x70')](_0x52b5b4,_0x2a4ad3[_0xc430('0x42')],_0x56e25a);_0x310aae[_0xd91525](_0x1c10b5[_0xc430('0x71')],_0x1c10b5[_0xc430('0x66')][_0xc430('0x76')],_0x1c10b5['value']['end']);}break;case'body':_0x1c10b5=as[_0xc430('0x70')]('me',null,_0x56e25a);_0x310aae[_0xd91525](_0x1c10b5[_0xc430('0x71')],_0x1c10b5[_0xc430('0x66')]['start'],_0x1c10b5['value'][_0xc430('0x2a')]);break;}}else{var _0x1c10b5=as[_0xc430('0x70')](_0x52b5b4,_0x2a4ad3[_0xc430('0x42')],_0x56e25a);_0x310aae[_0xd91525](_0x1c10b5[_0xc430('0x71')],_0x1c10b5[_0xc430('0x66')][_0xc430('0x76')],_0x1c10b5[_0xc430('0x66')][_0xc430('0x2a')]);}}}else{var _0x52eb67=_(_0x4983e0['query'])[_0xc430('0x77')]()[_0xc430('0x38')](function(_0x1c6390){return _['some'](_0x3c52dc,['name',_0x1c6390])?_0x1c6390:undefined;})['compact']()[_0xc430('0x66')]();if(!_[_0xc430('0x78')](_0x52eb67)){_0x52eb67[_0xc430('0x3d')](function(_0x4314ec){if(_0x4314ec==='ChatWebsiteId'){_0x9cc64a[_0xc430('0x4b')](_0xc430('0x79'),[][_0xc430('0x7a')](_0x4983e0['query'][_0x4314ec]));}else if(_0x4314ec===_0xc430('0x7b')){var _0x596a4f=JSON[_0xc430('0x7c')](_0x4983e0[_0xc430('0x45')][_0x4314ec])[_0xc430('0x7d')];var _0x91aea8=JSON[_0xc430('0x7c')](_0x4983e0['query'][_0x4314ec])[_0xc430('0x7e')];_0x9cc64a[_0xc430('0x4b')](_0xc430('0x7f'),_0x596a4f,_0x91aea8);}else{if(_0x4983e0[_0xc430('0x45')][_0x4314ec]==='null'){_0x9cc64a['where']('i.'+_0x4314ec+_0xc430('0x80'));}else{_0x9cc64a['where']('i.'+_0x4314ec+'\x20=\x20?',_0x4983e0[_0xc430('0x45')][_0x4314ec]);}}});}if(_0x4983e0[_0xc430('0x45')]['read']){if(_0x4983e0[_0xc430('0x45')][_0xc430('0x81')]==0x1){_0x9cc64a[_0xc430('0x67')](_0xc430('0x82'));}else{_0x9cc64a[_0xc430('0x67')](_0xc430('0x83'));}}if(_0x4983e0['query'][_0xc430('0x84')]){_0xf8bb6c=_[_0xc430('0x85')](_0x4983e0[_0xc430('0x45')][_0xc430('0x84')])?_0x4983e0['query'][_0xc430('0x84')]:new Array(_0x4983e0[_0xc430('0x45')][_0xc430('0x84')]);_0xf8bb6c['forEach'](function(_0x156a89){_0x8cb2e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x156a89+',%');});}if(_0x4983e0['query'][_0xc430('0x86')]){var _0x547094=_0x4983e0[_0xc430('0x45')]['filter'][_0xc430('0x87')]('\x5c','\x5c\x5c')[_0xc430('0x87')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xc430('0x88')](_0x547094)){_0x310aae['or'](_0xc430('0x89'),_0x547094+'%');}else{_0x310aae['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc430('0x6d')](_0x547094))['or'](_0xc430('0x8a'),_0x547094+'%');}}}_0x9cc64a['where'](_0x310aae);_0x9cc64a[_0xc430('0x8b')](_0xc430('0x8c'));var _0x4f381d={'type':db[_0xc430('0x1b')][_0xc430('0x8d')][_0xc430('0x8e')],'raw':!![]};var _0x227dca=_0x9cc64a[_0xc430('0x8f')]();_0x227dca[_0xc430('0x4e')](_0xc430('0x8c'));_0x227dca[_0xc430('0x4e')](_0xc430('0x90'),_0xc430('0x65'));if(_0x254611[_0xc430('0x91')]){_0x254611['order'][_0xc430('0x3d')](function(_0x4e12a6){_0x9cc64a[_0xc430('0x91')]('i.'+_0x4e12a6[0x0],_0x4e12a6[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xf8bb6c)){_0x9cc64a[_0xc430('0x67')](_0x8cb2e3);_0x227dca['where'](_0xc430('0x92'),_0xf8bb6c);}BPromise[_0xc430('0x93')]()['then'](function(){if(!_0x4184cc){if(_0x4983e0['query'][_0xc430('0x94')]||_0x4983e0[_0xc430('0x45')][_0xc430('0x95')])return;_0x227dca['where'](_0xc430('0x96'));_0x9cc64a['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x4983e0[_0xc430('0x97')][_0xc430('0x98')]({'attributes':['id'],'raw':!![]})[_0xc430('0x32')](function(_0x591c44){if(_[_0xc430('0x78')](_0x591c44)){_0x227dca[_0xc430('0x4b')](_0xc430('0x99'));_0x9cc64a[_0xc430('0x4b')](_0xc430('0x99'));}else{_0x227dca['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xc430('0x38')](_0x591c44,'id'));_0x9cc64a[_0xc430('0x4b')](_0xc430('0x79'),_[_0xc430('0x38')](_0x591c44,'id'));}});})[_0xc430('0x32')](function(){db[_0xc430('0x9a')][_0xc430('0x45')](_0x227dca[_0xc430('0x9b')](),_0x4f381d)[_0xc430('0x32')](function(_0x31a3d8){_0xb69eae[_0xc430('0x2b')]=_0x31a3d8['length'];if(_0xb69eae[_0xc430('0x2b')]===0x0)return[];return db[_0xc430('0x9a')][_0xc430('0x45')](_0x3e49c7[_0xc430('0x9b')](),_0x4f381d)['then'](function(_0x50e7bd){_0x115441=_[_0xc430('0x9c')](_0x50e7bd,'id');_0x4f381d=_['merge'](_0x4f381d,{'model':db[_0xc430('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4983e0[_0xc430('0x45')][_0xc430('0x9d')]){_0x254611[_0xc430('0x48')][_0xc430('0x3d')](function(_0x59c102){_0x9cc64a['field']('i.'+_0x59c102);});}else{_0x9cc64a['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc430('0x65'));_0x9cc64a['field']('a.key',_0xc430('0x9e'));_0x9cc64a[_0xc430('0x4e')](_0xc430('0x9f'),_0xc430('0xa0'));_0x9cc64a[_0xc430('0x4e')](_0xc430('0xa1'));_0x9cc64a[_0xc430('0x4e')](_0xc430('0xa2'),_0xc430('0xa3'));_0x9cc64a[_0xc430('0x4e')](_0xc430('0xa4'),_0xc430('0xa5'));_0x9cc64a[_0xc430('0x4e')]('c.email',_0xc430('0xa6'));_0x9cc64a[_0xc430('0x4e')](_0xc430('0xa7'),_0xc430('0xa8'));_0x9cc64a[_0xc430('0x4e')](_0xc430('0xa9'),_0xc430('0xaa'));_0x9cc64a[_0xc430('0x4e')]('c.fax',_0xc430('0xab'));_0x9cc64a[_0xc430('0x4e')]('o.fullname',_0xc430('0xac'));_0x9cc64a[_0xc430('0x4e')](_0xc430('0xad'),_0xc430('0xae'));_0x9cc64a['field'](_0xc430('0xaf'),'TagIds');}if(_0x254611['limit'])_0x9cc64a[_0xc430('0x2d')](_0x254611[_0xc430('0x2d')]);if(_0x254611[_0xc430('0x2c')])_0x9cc64a[_0xc430('0x2c')](_0x254611[_0xc430('0x2c')]);return db[_0xc430('0x9a')]['query'](_0x9cc64a[_0xc430('0x9b')](),_0x4f381d);})[_0xc430('0x32')](function(_0xdfa7b8){_0x514c38[_0xc430('0x4b')](_0xc430('0xb0'),_[_0xc430('0x38')](_0xdfa7b8,'id'));return db[_0xc430('0x9a')][_0xc430('0x45')](_0x514c38[_0xc430('0x9b')](),_0x4f381d)[_0xc430('0x32')](function(_0x4fce45){var _0x2ab8f7=_[_0xc430('0xb1')](_0x4fce45,'ChatInteractionId');var _0x5659ff=[];_0xdfa7b8[_0xc430('0x3d')](function(_0x369514){_0x5659ff[_0xc430('0x3e')](updateChatInteraction(_0x369514,_0x115441,_0x2ab8f7));});return BPromise[_0xc430('0xb2')](_0x5659ff);});});})[_0xc430('0x32')](function(_0x53a038){_0xb69eae[_0xc430('0xb3')]=_0x53a038;return _0xb69eae;})[_0xc430('0x32')](respondWithFilteredResult(_0x262063,_0x254611));})[_0xc430('0x27')](handleError(_0x262063,null));};exports[_0xc430('0xb4')]=function(_0x47d2a1,_0x37ab87){var _0x59d117={'raw':![],'where':{'id':_0x47d2a1[_0xc430('0xb5')]['id']}},_0x520de2={};_0x520de2[_0xc430('0x44')]=_[_0xc430('0x77')](db[_0xc430('0x3f')]['rawAttributes']);_0x520de2[_0xc430('0x45')]=_[_0xc430('0x77')](_0x47d2a1['query']);_0x520de2['filters']=_[_0xc430('0x47')](_0x520de2[_0xc430('0x44')],_0x520de2['query']);_0x59d117[_0xc430('0x48')]=_[_0xc430('0x47')](_0x520de2[_0xc430('0x44')],qs[_0xc430('0x9d')](_0x47d2a1[_0xc430('0x45')][_0xc430('0x9d')]));_0x59d117[_0xc430('0x48')]=_0x59d117['attributes'][_0xc430('0x64')]?_0x59d117[_0xc430('0x48')]:_0x520de2[_0xc430('0x44')];if(_0x47d2a1['query'][_0xc430('0xb6')]){_0x59d117[_0xc430('0xb7')]=[{'all':!![]}];}_0x59d117=_['merge']({},_0x59d117,_0x47d2a1['options']);return db[_0xc430('0x3f')]['find'](_0x59d117)[_0xc430('0x32')](handleEntityNotFound(_0x37ab87,null))[_0xc430('0x32')](respondWithResult(_0x37ab87,null))[_0xc430('0x27')](handleError(_0x37ab87,null));};exports[_0xc430('0xb8')]=function(_0x4d8c47,_0x391234){return db[_0xc430('0x3f')][_0xc430('0xb8')](_0x4d8c47[_0xc430('0xb9')],{})[_0xc430('0x32')](respondWithResult(_0x391234,0xc9))[_0xc430('0x27')](handleError(_0x391234,null));};exports[_0xc430('0xba')]=function(_0x5a69b8,_0x1d10a3){if(_0x5a69b8[_0xc430('0xb9')]['id']){delete _0x5a69b8['body']['id'];}return db[_0xc430('0x3f')][_0xc430('0x74')]({'where':{'id':_0x5a69b8[_0xc430('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1d10a3,null))[_0xc430('0x32')](saveUpdates(_0x5a69b8[_0xc430('0xb9')],null))[_0xc430('0x32')](respondWithResult(_0x1d10a3,null))[_0xc430('0x27')](handleError(_0x1d10a3,null));};exports['destroy']=function(_0x23873f,_0x2272c3){return db[_0xc430('0x3f')][_0xc430('0x74')]({'where':{'id':_0x23873f[_0xc430('0xb5')]['id']}})[_0xc430('0x32')](handleEntityNotFound(_0x2272c3,null))[_0xc430('0x32')](removeEntity(_0x2272c3,null))[_0xc430('0x27')](handleError(_0x2272c3,null));};exports[_0xc430('0xbb')]=function(_0x2a17ed,_0x56a79a){return db[_0xc430('0x3f')][_0xc430('0xbb')]()[_0xc430('0x32')](respondWithResult(_0x56a79a,null))[_0xc430('0x27')](handleError(_0x56a79a,null));};exports[_0xc430('0xbc')]=function(_0x5834ad,_0x2f96f9){var _0x5deb37=_0x5834ad[_0xc430('0xb5')]['id'];var _0x5e05d5;var _0x512de7;var _0x3312d1;return db['ChatInteraction'][_0xc430('0xbd')]({'where':{'id':_0x5deb37}})[_0xc430('0x32')](function(_0xc85473){_0x5e05d5=_0xc85473;return db[_0xc430('0xbe')][_0xc430('0xbd')]({'where':{'id':_0xc85473[_0xc430('0x94')]},'attributes':['id',_0xc430('0xbf'),_0xc430('0xc0')],'raw':!![]});})[_0xc430('0x32')](function(_0x47d802){if(_0x47d802&&_0x47d802['vidaooApiKey']&&_0x47d802[_0xc430('0xc0')]){_0x512de7=_0x47d802;var _0x49f3c8={'rejectUnauthorized':![],'method':_0xc430('0xc1'),'uri':_0xc430('0xc2'),'headers':{'X-APIKEY':_0x47d802['vidaooApiKey']},'body':{'name':_0xc430('0xc3')+_0x5deb37},'redirect':_0xc430('0xc4'),'json':!![]};return rp(_0x49f3c8);}else{throw new db[(_0xc430('0x1b'))][(_0xc430('0x1c'))](_0xc430('0xc5'));}})[_0xc430('0x32')](function(_0x17fb84){_0x3312d1=_0x17fb84;if(_0x3312d1['id']){var _0x34df0d={'body':_0x3312d1['join_url'],'ChatWebsiteId':_0x512de7['id'],'ChatInteractionId':_0x5e05d5['id'],'direction':_0xc430('0xc6'),'UserId':_0x5834ad[_0xc430('0x97')]['id']};return db['ChatMessage'][_0xc430('0xb8')](_0x34df0d,{});}else{throw new db[(_0xc430('0x1b'))][(_0xc430('0x1c'))](_0xc430('0xc7'));}})[_0xc430('0x32')](function(){return _0x5e05d5[_0xc430('0xc8')]({'vidaooSessionId':_0x3312d1['id']});})[_0xc430('0x32')](respondWithResult(_0x2f96f9,null))[_0xc430('0x27')](handleError(_0x2f96f9,null));};exports[_0xc430('0xc9')]=function(_0x3dda26,_0x3ea33c){if(_0x3dda26['body']['id']){delete _0x3dda26[_0xc430('0xb9')]['id'];}return db[_0xc430('0x3f')][_0xc430('0x74')]({'where':{'id':_0x3dda26[_0xc430('0xb5')]['id']}})[_0xc430('0x32')](handleEntityNotFound(_0x3ea33c,null))[_0xc430('0x32')](saveUpdates(_0x3dda26[_0xc430('0xb9')],null))[_0xc430('0x32')](respondWithResult(_0x3ea33c,null))[_0xc430('0x27')](handleError(_0x3ea33c,null));};exports[_0xc430('0xca')]=function(_0x39a978,_0x3be21a,_0x24265b){if(_0x39a978[_0xc430('0xb9')]['id']){delete _0x39a978[_0xc430('0xb9')]['id'];}return db[_0xc430('0x3f')][_0xc430('0x74')]({'where':{'id':_0x39a978[_0xc430('0xb5')]['id']}})[_0xc430('0x32')](function(_0x2b003d){if(!_0x2b003d){logger[_0xc430('0x23')](_0xc430('0xcb'),_0xc430('0xca'),0x194,_0xc430('0xcc'));_0x3be21a['sendStatus'](0x194);}else{if(_0x2b003d[_0xc430('0x75')]){throw new db[(_0xc430('0x1b'))][(_0xc430('0x1c'))](_0xc430('0xcd'));}}return _0x2b003d;})[_0xc430('0x32')](function(_0x29d01d){if(_0x29d01d){return _0x29d01d['update']({'closed':_0x39a978['body'][_0xc430('0xce')],'disposition':_0x39a978['body'][_0xc430('0xcf')]})[_0xc430('0x32')](function(_0x568ed0){return _0x568ed0;});}})[_0xc430('0x32')](function(_0x39b3a9){return respondWithRpcPromise(_0xc430('0xd0'),_0xc430('0xca'),_0x39a978['body'],client9004);})[_0xc430('0x32')](respondWithResult(_0x3be21a,null))['catch'](handleError(_0x3be21a,null));};exports[_0xc430('0xd1')]=function(_0x1152e8,_0x3b6e7a,_0x14f80a){_0x1152e8[_0xc430('0xb9')][_0xc430('0x35')]=_0x1152e8[_0xc430('0xd2')][_0xc430('0xd3')];_0x1152e8['body']['basename']=_0x1152e8['file'][_0xc430('0xd4')];_0x1152e8[_0xc430('0xb9')][_0xc430('0x42')]=_0x1152e8['file'][_0xc430('0xd5')];return db['Attachment'][_0xc430('0xb8')](_0x1152e8[_0xc430('0xb9')])[_0xc430('0x32')](respondWithResult(_0x3b6e7a,0xc9))[_0xc430('0x27')](handleError(_0x3b6e7a,null));};exports['attachmentDownload']=function(_0x3926d2,_0x3e26be,_0x3fbbdf){return db[_0xc430('0x3f')][_0xc430('0xbd')]({'where':{'id':_0x3926d2[_0xc430('0xb5')]['id']},'raw':!![]})[_0xc430('0x32')](handleEntityNotFound(_0x3e26be,null))[_0xc430('0x32')](function(_0x4da19c){if(_0x4da19c){if(_0x4da19c[_0xc430('0xce')]){return _0x3e26be[_0xc430('0x29')](0x193)[_0xc430('0xd6')]({'status':0x193,'message':_0xc430('0xd7')});}return db[_0xc430('0xd8')][_0xc430('0xbd')]({'where':{'id':_0x3926d2[_0xc430('0x45')]['attachId']},'raw':!![]})[_0xc430('0x32')](handleEntityNotFound(_0x3e26be,null));}})[_0xc430('0x32')](function(_0x221649){if(_0x221649){return _0x3e26be[_0xc430('0xd9')](path[_0xc430('0xda')](config[_0xc430('0xdb')],_0xc430('0xdc'),_0x221649[_0xc430('0xdd')]));}})[_0xc430('0x27')](handleError(_0x3e26be,null));};exports[_0xc430('0xde')]=function(_0x129e41,_0xf4c77e){var _0x9175cd=null;var _0x1d0fc7=null;var _0x8be430=null;var _0x2823e8=null;if(_0x129e41[_0xc430('0xb9')]['id']){delete _0x129e41[_0xc430('0xb9')]['id'];}if(_0x129e41[_0xc430('0xb9')][_0xc430('0xdf')]){_0x2823e8=path['join'](config[_0xc430('0xdb')],'server/files/chat/upload/',util[_0xc430('0xe0')](_0xc430('0xe1'),Date[_0xc430('0xe2')]()));_0x129e41[_0xc430('0xb9')][_0xc430('0xe3')]=_0x2823e8;}return db[_0xc430('0x3f')][_0xc430('0x74')]({'where':{'id':_0x129e41[_0xc430('0xb5')]['id']},'include':[{'model':db[_0xc430('0xe4')],'as':_0xc430('0xe5'),'include':[{'model':db[_0xc430('0x73')],'as':_0xc430('0x73')}]}]})[_0xc430('0x32')](handleEntityNotFound(_0xf4c77e,null))[_0xc430('0x32')](saveUpdates(_0x129e41[_0xc430('0xb9')],null))[_0xc430('0x32')](function(_0x38ba70){if(_0x38ba70){_0x9175cd=_0x38ba70;return db[_0xc430('0xbe')][_0xc430('0x74')]({'where':{'id':_0x9175cd[_0xc430('0x94')]}});}})[_0xc430('0x32')](function(_0x4b94f1){if(_0x4b94f1){_0x8be430=_0x4b94f1;return db['CmContact'][_0xc430('0x74')]({'where':{'id':_0x9175cd[_0xc430('0x6f')]}});}})['then'](function(_0x1958d4){if(_0x1958d4){_0x1d0fc7=_0x1958d4;if(_0x2823e8){var _0x533a08=null;for(var _0x562991=0x1;_0x562991<_0x9175cd[_0xc430('0xe5')][_0xc430('0x64')];++_0x562991){_0x533a08=_0x9175cd['Messages'][_0x562991];var _0x560cdc=_0x533a08[_0xc430('0x75')]?util[_0xc430('0xe0')](_0xc430('0xe6'),_0x8be430['agentAlias'],_0x533a08[_0xc430('0x75')]):_0xc430('0xe7');var _0xfd62ab=_0x129e41[_0xc430('0xb9')]['customer']||util[_0xc430('0xe0')](_0xc430('0xe6'),'Visitor',_0x533a08['ContactId']);switch(_0x8be430[_0xc430('0xe8')]){case _0xc430('0xe9'):_0x560cdc=_0x533a08['UserId']?util['format'](_0xc430('0xe6'),_0x8be430[_0xc430('0xea')],_0x533a08[_0xc430('0x75')]):_0xc430('0xe7');break;case _0xc430('0xeb'):_0x560cdc=_0x533a08[_0xc430('0x75')]?_0x533a08[_0xc430('0x73')]['alias']||_0x533a08[_0xc430('0x73')][_0xc430('0x39')]:_0xc430('0xe7');break;case _0xc430('0xec'):_0x560cdc=_0x533a08[_0xc430('0x75')]?_0x533a08[_0xc430('0x73')][_0xc430('0x39')]:'System';break;default:_0x560cdc=_0x533a08['UserId']?util[_0xc430('0xe0')](_0xc430('0xe6'),_0x8be430[_0xc430('0xea')],_0x533a08[_0xc430('0x75')]):_0xc430('0xe7');}var _0x5ddde2=util[_0xc430('0xe0')](_0xc430('0xed'),moment(_0x533a08[_0xc430('0x7b')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x533a08[_0xc430('0xee')]==='in'?_0xfd62ab:_0x560cdc,_0x533a08[_0xc430('0xb9')]);if(!_0x533a08[_0xc430('0xef')]){fs['appendFileSync'](_0x2823e8,_0x5ddde2);}}return db['MailAccount'][_0xc430('0xbd')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc430('0xf0'),'raw':!![]}]});}}})[_0xc430('0x32')](function(_0x2ab6f2){if(_0x2ab6f2&&_0x2ab6f2[_0xc430('0xf0')]&&_0x129e41['body']){var _0x301544={'tls':{'rejectUnauthorized':![]}};if(_0x2ab6f2['Smtp']['service']){_0x301544['service']=_0x2ab6f2[_0xc430('0xf0')][_0xc430('0xf1')];}else{_0x301544['host']=_0x2ab6f2[_0xc430('0xf0')][_0xc430('0xf2')];_0x301544['port']=_0x2ab6f2['Smtp'][_0xc430('0xf3')];_0x301544[_0xc430('0xf4')]=_0x2ab6f2[_0xc430('0xf0')][_0xc430('0xf4')];}if(_0x2ab6f2[_0xc430('0xf0')][_0xc430('0xf5')]){_0x301544['auth']={'user':_0x2ab6f2['Smtp']['user'],'pass':_0x2ab6f2[_0xc430('0xf0')][_0xc430('0xf6')]};}return respondWithRpcPromise(_0xc430('0xf7'),_0xc430('0xf8'),{'account':_0x301544,'message':{'from':util['format'](_0xc430('0xf9'),_0x2ab6f2['name'],_0x2ab6f2[_0xc430('0xfa')]||_0x2ab6f2[_0xc430('0xf0')][_0xc430('0x97')]),'to':_0x129e41[_0xc430('0xb9')][_0xc430('0xdf')],'subject':'Mail\x20Transcript','text':util[_0xc430('0xe0')](_0xc430('0xfb'),_0x129e41[_0xc430('0xb9')][_0xc430('0xdf')]),'attachments':[{'path':_0x2823e8}]}})[_0xc430('0x32')](function(){return _0x9175cd;})['catch'](function(_0x2d0360){console[_0xc430('0x23')](_0x2d0360);});}else{return _0x9175cd;}})[_0xc430('0x32')](respondWithStatusCode(_0xf4c77e,0xc8))['catch'](handleError(_0xf4c77e,null));};exports[_0xc430('0xfc')]=function(_0x224d79,_0x49432d,_0x7c4fde){return db[_0xc430('0xe4')][_0xc430('0x74')]({'where':{'id':_0x224d79[_0xc430('0xb5')]['id']}})[_0xc430('0x32')](handleEntityNotFound(_0x49432d,null))[_0xc430('0x32')](function(_0x191eed){if(_0x191eed){return _0x191eed[_0xc430('0xfc')](_0x224d79['body'][_0xc430('0xfd')],_['omit'](_0x224d79[_0xc430('0xb9')],[_0xc430('0xfd'),'id'])||{});}})[_0xc430('0x32')](respondWithResult(_0x49432d,null))[_0xc430('0x27')](handleError(_0x49432d,null));};exports[_0xc430('0xfe')]=function(_0x596569,_0x2a8f0b,_0x3de00e){var _0x4e8e9c={'raw':![],'where':{}};var _0x4d91d3={};var _0x524979={'count':0x0,'rows':[]};return db[_0xc430('0x3f')][_0xc430('0xbd')]({'where':{'id':_0x596569[_0xc430('0xb5')]['id']}})[_0xc430('0x32')](handleEntityNotFound(_0x2a8f0b,null))[_0xc430('0x32')](function(_0x1b75f8){if(_0x1b75f8){_0x4d91d3['model']=_[_0xc430('0x77')](db[_0xc430('0xe4')][_0xc430('0x40')]);_0x4d91d3[_0xc430('0x45')]=_[_0xc430('0x77')](_0x596569['query']);_0x4d91d3[_0xc430('0x46')]=_[_0xc430('0x47')](_0x4d91d3[_0xc430('0x44')],_0x4d91d3[_0xc430('0x45')]);_0x4e8e9c[_0xc430('0x48')]=_[_0xc430('0x47')](_0x4d91d3['model'],qs[_0xc430('0x9d')](_0x596569[_0xc430('0x45')]['fields']));_0x4e8e9c[_0xc430('0x48')]=_0x4e8e9c['attributes'][_0xc430('0x64')]?_0x4e8e9c[_0xc430('0x48')]:_0x4d91d3['model'];if(!_0x596569[_0xc430('0x45')][_0xc430('0xff')](_0xc430('0x49'))){_0x4e8e9c[_0xc430('0x2d')]=qs[_0xc430('0x2d')](_0x596569[_0xc430('0x45')][_0xc430('0x2d')]);_0x4e8e9c['offset']=qs[_0xc430('0x2c')](_0x596569[_0xc430('0x45')][_0xc430('0x2c')]);}_0x4e8e9c[_0xc430('0x91')]=qs[_0xc430('0x4a')](_0x596569[_0xc430('0x45')][_0xc430('0x4a')]);_0x4e8e9c[_0xc430('0x4b')]=qs[_0xc430('0x46')](_[_0xc430('0x4c')](_0x596569[_0xc430('0x45')],_0x4d91d3[_0xc430('0x46')]));_0x4e8e9c[_0xc430('0x4b')][_0xc430('0x100')]=_0x1b75f8['id'];if(_0x596569[_0xc430('0x45')][_0xc430('0x86')]){_0x4e8e9c[_0xc430('0x4b')]=_[_0xc430('0x101')](_0x4e8e9c[_0xc430('0x4b')],{'$or':_['map'](_0x4e8e9c[_0xc430('0x48')],function(_0x35d0cb){var _0xd0679c={};_0xd0679c[_0x35d0cb]={'$like':'%'+_0x596569['query'][_0xc430('0x86')]+'%'};return _0xd0679c;})});}if(_0x596569['query'][_0xc430('0x7d')]){var _0x168fc7=_0x596569['query']['$gte']['split'](',');var _0x4fe44d={};_0x4fe44d[_0x168fc7[0x0]]={'$gte':moment(_0x168fc7[0x1])[_0xc430('0xe0')](_0xc430('0x102'))};_0x4e8e9c[_0xc430('0x4b')]=_['merge'](_0x4e8e9c[_0xc430('0x4b')],_0x4fe44d);}_0x4e8e9c=_['merge']({},_0x4e8e9c,_0x596569[_0xc430('0x103')]);return db[_0xc430('0xe4')][_0xc430('0x2b')]({'where':_0x4e8e9c[_0xc430('0x4b')]})[_0xc430('0x32')](function(_0xe75e39){_0x524979[_0xc430('0x2b')]=_0xe75e39;if(_0x596569[_0xc430('0x45')]['includeAll']){_0x4e8e9c['include']=[{'all':!![]}];}return db[_0xc430('0xe4')][_0xc430('0x104')](_0x4e8e9c);})[_0xc430('0x32')](function(_0x44dda8){_0x524979['rows']=_0x44dda8;return _0x524979;});}})['then'](respondWithFilteredResult(_0x2a8f0b,_0x4e8e9c))['catch'](handleError(_0x2a8f0b,null));};exports[_0xc430('0x105')]=function(_0x1bb27d,_0x1ca6a0,_0x294e37){var _0x3dd7c4={'where':{}},_0x47ff2a={},_0x1b17ff={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc430('0xbd')]({'where':{'id':_0x1bb27d[_0xc430('0xb5')]['id']}})[_0xc430('0x32')](handleEntityNotFound(_0x1ca6a0,null))[_0xc430('0x32')](function(_0x474e83){if(_0x474e83){_0x47ff2a[_0xc430('0x44')]=_[_0xc430('0x77')](db[_0xc430('0xe4')][_0xc430('0x40')]);_0x47ff2a[_0xc430('0x45')]=_[_0xc430('0x77')](_0x1bb27d[_0xc430('0x45')]);_0x47ff2a[_0xc430('0x46')]=_['intersection'](_0x47ff2a[_0xc430('0x44')],_0x47ff2a[_0xc430('0x45')]);_0x3dd7c4[_0xc430('0x48')]=_[_0xc430('0x47')](_0x47ff2a[_0xc430('0x44')],qs[_0xc430('0x9d')](_0x1bb27d[_0xc430('0x45')][_0xc430('0x9d')]));_0x3dd7c4[_0xc430('0x48')]=_0x3dd7c4[_0xc430('0x48')][_0xc430('0x64')]?_0x3dd7c4[_0xc430('0x48')]:_0x47ff2a[_0xc430('0x44')];if(!_0x1bb27d[_0xc430('0x45')][_0xc430('0xff')](_0xc430('0x49'))){_0x3dd7c4['limit']=qs[_0xc430('0x2d')](_0x1bb27d[_0xc430('0x45')][_0xc430('0x2d')]);_0x3dd7c4[_0xc430('0x2c')]=qs[_0xc430('0x2c')](_0x1bb27d[_0xc430('0x45')][_0xc430('0x2c')]);}_0x3dd7c4[_0xc430('0x91')]=qs[_0xc430('0x4a')](_0x1bb27d['query'][_0xc430('0x4a')]);_0x3dd7c4[_0xc430('0x4b')]=qs[_0xc430('0x46')](_[_0xc430('0x4c')](_0x1bb27d['query'],_0x47ff2a[_0xc430('0x46')]));_0x3dd7c4[_0xc430('0x4b')]['ChatInteractionId']=_0x474e83['id'];if(_0x1bb27d[_0xc430('0x45')][_0xc430('0x86')]){_0x3dd7c4['where']=_['merge'](_0x3dd7c4[_0xc430('0x4b')],{'$or':_[_0xc430('0x38')](_0x3dd7c4[_0xc430('0x48')],function(_0x5da66c){var _0x15b627={};_0x15b627[_0x5da66c]={'$like':'%'+_0x1bb27d[_0xc430('0x45')]['filter']+'%'};return _0x15b627;})});}_0x3dd7c4[_0xc430('0x4b')][_0xc430('0xef')]=![];if(_0x1bb27d[_0xc430('0x45')]['id']){_0x3dd7c4['where']['id']={'$gt':_0x1bb27d[_0xc430('0x45')]['id']};}_0x3dd7c4=_[_0xc430('0x101')]({},_0x3dd7c4,_0x1bb27d[_0xc430('0x103')]);return db[_0xc430('0xe4')][_0xc430('0x2b')]({'where':_0x3dd7c4[_0xc430('0x4b')]})['then'](function(_0x17e082){_0x1b17ff[_0xc430('0x2b')]=_0x17e082;_0x3dd7c4['include']=[];if(_0x1bb27d['query'][_0xc430('0x106')]){_0x3dd7c4[_0xc430('0xb7')][_0xc430('0x3e')]({'model':db[_0xc430('0x73')],'as':'User','attributes':['id',_0xc430('0x39'),'alias']});}if(_0x1bb27d[_0xc430('0x45')]['includeAll']){_0x3dd7c4[_0xc430('0xb7')]=[{'all':!![]}];}return db[_0xc430('0xe4')][_0xc430('0x104')](_0x3dd7c4);})[_0xc430('0x32')](function(_0x15cff2){_0x1b17ff[_0xc430('0xb3')]=_0x15cff2;return _0x1b17ff;});}})[_0xc430('0x32')](respondWithFilteredResult(_0x1ca6a0,_0x3dd7c4))[_0xc430('0x27')](handleError(_0x1ca6a0,null));};exports[_0xc430('0x107')]=function(_0x210701,_0x43f87f,_0x5060c2){return db['ChatInteraction']['find']({'where':{'id':_0x210701[_0xc430('0xb5')]['id']}})[_0xc430('0x32')](handleEntityNotFound(_0x43f87f,null))['then'](function(_0x4557a2){if(_0x4557a2){return _0x4557a2['setTags'](_0x210701[_0xc430('0xb9')]['ids'],_[_0xc430('0x108')](_0x210701['body'],['ids','id'])||{})[_0xc430('0x109')](function(){return db[_0xc430('0x10a')][_0xc430('0x104')]({'attributes':['id',_0xc430('0x35'),_0xc430('0x4f')],'where':{'id':_0x210701[_0xc430('0xb9')][_0xc430('0xfd')]}});})[_0xc430('0x32')](function(_0x12daf3){socket[_0xc430('0x10b')](_0xc430('0x10c'),{'id':Number(_0x210701[_0xc430('0xb5')]['id']),'tags':_0x12daf3||[]});return{'id':Number(_0x210701[_0xc430('0xb5')]['id']),'tags':_0x12daf3||[]};});}})['then'](respondWithResult(_0x43f87f,null))[_0xc430('0x27')](handleError(_0x43f87f,null));};exports[_0xc430('0x10d')]=function(_0x1b7935,_0x4118c9,_0x36ecd9){return db[_0xc430('0x3f')][_0xc430('0x74')]({'where':{'id':_0x1b7935[_0xc430('0xb5')]['id']}})['then'](handleEntityNotFound(_0x4118c9,null))[_0xc430('0x32')](function(_0x847e69){if(_0x847e69){return _0x847e69[_0xc430('0x10d')](_0x1b7935[_0xc430('0x45')][_0xc430('0xfd')]);}})[_0xc430('0x32')](respondWithStatusCode(_0x4118c9,null))['catch'](handleError(_0x4118c9,null));};exports[_0xc430('0xd9')]=function(_0x1c5c11,_0x2d9442){var _0x18d74e=moment()[_0xc430('0x10e')]()[_0xc430('0x9b')]();var _0x256a5d=path[_0xc430('0xda')](config[_0xc430('0xdb')],_0xc430('0x10f'),_0xc430('0x110'),'tmp');var _0x25268c=path[_0xc430('0xda')](config[_0xc430('0xdb')],_0xc430('0x10f'),_0xc430('0x110'),_0xc430('0x111'));var _0x5c62e7=path[_0xc430('0xda')](_0x256a5d,_0x18d74e);var _0x58aaf2=util['format'](_0xc430('0x112'),_0x1c5c11[_0xc430('0xb5')]['id'],_0x18d74e);var _0x48e9b0=path['join'](_0x256a5d,_0x58aaf2);var _0x22690e=[];_0x22690e['push']({'model':db['User'],'as':_0xc430('0x73'),'attributes':['id',_0xc430('0x39')],'raw':!![]});_0x22690e[_0xc430('0x3e')]({'model':db[_0xc430('0x113')],'as':_0xc430('0x69'),'attributes':['id',_0xc430('0x114'),_0xc430('0x115')],'raw':!![]});if(_0x1c5c11[_0xc430('0x45')]['attachments']){_0x22690e['push']({'model':db[_0xc430('0xd8')],'as':'Attachment','raw':!![]});}var _0x462bda=[{'model':db['ChatMessage'],'as':_0xc430('0xe5'),'attributes':['id',_0xc430('0xb9'),_0xc430('0x7b'),_0xc430('0xee'),'secret','read'],'include':_0x22690e}];_0x462bda[_0xc430('0x3e')]({'model':db[_0xc430('0xbe')],'as':_0xc430('0x116'),'attributes':['id',_0xc430('0x35')]});_0x462bda[_0xc430('0x3e')]({'model':db['User'],'as':'Owner','attributes':['id',_0xc430('0x39')]});return db[_0xc430('0x3f')][_0xc430('0x74')]({'where':{'id':_0x1c5c11['params']['id']},'include':_0x462bda})[_0xc430('0x32')](handleEntityNotFound(_0x2d9442,null))[_0xc430('0x32')](function(_0x42b0d7){if(_0x42b0d7){var _0x1e76bb=_0x42b0d7['get']({'plain':!![]});fs[_0xc430('0x117')](_0x5c62e7);var _0x7c68c2={'format':'A4','border':'10px','header':{'height':_0xc430('0x118'),'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':_0xc430('0x119'),'contents':{'default':util[_0xc430('0xe0')](_0xc430('0x11a'),util['format']('%s\x20#%d',_0xc430('0x11b'),_0x1e76bb['id']),moment()[_0xc430('0xe0')](_0xc430('0x11c'))[_0xc430('0x9b')]())}}};var _0x1cca56={'channel':_0xc430('0x11b'),'account':_0x1e76bb[_0xc430('0x116')][_0xc430('0x35')],'agent':_0x1e76bb[_0xc430('0x11d')]?_0x1e76bb['Owner'][_0xc430('0x39')]:_0xc430('0x11e'),'createdAt':moment(_0x1e76bb[_0xc430('0x7b')])[_0xc430('0xe0')](_0xc430('0x102'))[_0xc430('0x9b')](),'closedAt':_0x1e76bb['closed']?moment(_0x1e76bb[_0xc430('0x11f')])[_0xc430('0xe0')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc430('0x9b')]():'','disposition':_0x1e76bb[_0xc430('0xcf')],'chatInfo':{'browser':_0x1e76bb[_0xc430('0x120')],'os':_0x1e76bb[_0xc430('0x121')],'referer':_0x1e76bb[_0xc430('0x122')],'customerIp':_0x1e76bb[_0xc430('0x123')],'customerPort':_0x1e76bb[_0xc430('0x124')]?_0x1e76bb['customerPort']:_0xc430('0x11e')},'messages':_(_0x1e76bb[_0xc430('0xe5')])['tail']()['filter']({'secret':![]})['map'](function(_0x1c0de8){if(_0x1c0de8[_0xc430('0xd8')]){var _0xec0ad1=path[_0xc430('0xda')](_0x25268c,_0x1c0de8['Attachment'][_0xc430('0xdd')]);if(fs[_0xc430('0x125')](_0xec0ad1)){fs[_0xc430('0x126')](_0xec0ad1)[_0xc430('0x127')](fs[_0xc430('0x128')](path['join'](_0x5c62e7,_0x1c0de8[_0xc430('0xd8')]['basename'])));}}return{'date':moment(_0x1c0de8[_0xc430('0x7b')])[_0xc430('0xe0')](_0xc430('0x102'))[_0xc430('0x9b')](),'sender':_0x1c0de8['direction']===_0xc430('0xc6')?_0x1c0de8[_0xc430('0x73')]?_0x1c0de8[_0xc430('0x73')][_0xc430('0x39')]:'System':_0x1c0de8[_0xc430('0x69')][_0xc430('0x114')]+(_0x1c0de8[_0xc430('0x69')][_0xc430('0x115')]?'\x20'+_0x1c0de8[_0xc430('0x69')]['lastName']:''),'body':_0x1c0de8[_0xc430('0xd8')]?_0x1c0de8[_0xc430('0xd8')][_0xc430('0xdd')]:_0x1c0de8[_0xc430('0xb9')],'direction':_0x1c0de8[_0xc430('0xee')]===_0xc430('0xc6')?'A':'C','secret':_0x1c0de8['secret'],'read':_0x1c0de8['read'],'attachment':_0x1c0de8[_0xc430('0xd8')]};})['value']()};return ejs[_0xc430('0x129')](path['join'](config[_0xc430('0xdb')],_0xc430('0x10f'),_0xc430('0x12a'),_0xc430('0x12b')),{'interaction':_0x1cca56})['then'](function(_0xef5ee7){return new BPromise(function(_0x379f43,_0x30f811){pdf[_0xc430('0xb8')](_0xef5ee7,_0x7c68c2)[_0xc430('0x12c')](path[_0xc430('0xda')](_0x5c62e7,_0xc430('0x12d')+_0x1e76bb['id']+'-'+_0x18d74e+'.pdf'),function(_0x513df9,_0x2d7c2e){if(_0x513df9)return _0x30f811(_0x513df9);_0x379f43(_0x2d7c2e);});});})['then'](function(){return new BPromise(function(_0x18d104,_0x4248d3){zipdir(_0x5c62e7,{'saveTo':_0x48e9b0},function(_0x302446,_0xb1d0c1){if(_0x302446)return _0x4248d3(_0x302446);return _0x18d104(_0xb1d0c1);});})[_0xc430('0x32')](function(){return new BPromise(function(_0x10c97a,_0xa52822){rimraf(_0x5c62e7,function(_0x4328df){if(_0x4328df)_0xa52822(_0x4328df);return _0x10c97a();});});})['then'](function(){return _0x2d9442['download'](_0x48e9b0,_0x58aaf2,function(_0x237d9e){if(_0x237d9e){console['log'](_0xc430('0x12e'),_0x237d9e);}else{fs['unlinkSync'](_0x48e9b0);}});});});}else{return _0x2d9442[_0xc430('0x28')](0xc8);}})[_0xc430('0x27')](handleError(_0x2d9442,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f7e8dd6..17c94e5 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 _0xa3a6=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','hasOwnProperty','hook'];(function(_0x2a0c27,_0x72cc27){var _0x554791=function(_0x41dd99){while(--_0x41dd99){_0x2a0c27['push'](_0x2a0c27['shift']());}};_0x554791(++_0x72cc27);}(_0xa3a6,0xd1));var _0x6a3a=function(_0x3438a7,_0x104384){_0x3438a7=_0x3438a7-0x0;var _0x5a51df=_0xa3a6[_0x3438a7];return _0x5a51df;};'use strict';var EventEmitter=require(_0x6a3a('0x0'));var ChatInteraction=require(_0x6a3a('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x6a3a('0x1'))['db'][_0x6a3a('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6a3a('0x3')](0x0);var events={'afterCreate':_0x6a3a('0x4'),'afterUpdate':'update','afterDestroy':_0x6a3a('0x5')};function emitEvent(_0x113eb3){return function(_0x568ef1,_0x489d6b,_0x19db9f){_0x568ef1[_0x6a3a('0x6')]({'attributes':['id'],'raw':!![]})[_0x6a3a('0x7')](function(_0x5edc4a){_0x568ef1[_0x6a3a('0x8')](_0x6a3a('0x9'),_0x5edc4a[_0x6a3a('0xa')](function(_0x55e084){return{'id':_0x55e084['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x568ef1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6a3a('0x7')](function(_0x33927c){_0x568ef1['setDataValue'](_0x6a3a('0xb'),_0x33927c['length']);ChatInteractionEvents[_0x6a3a('0xc')](_0x113eb3+':'+_0x568ef1['id'],_0x568ef1);ChatInteractionEvents['emit'](_0x113eb3,_0x568ef1);_0x19db9f(null);})['catch'](_0x19db9f(null));};}for(var e in events){if(events[_0x6a3a('0xd')](e)){var event=events[e];ChatInteraction[_0x6a3a('0xe')](e,emitEvent(event));}}module[_0x6a3a('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xced6=['save','update','remove','getUsers','then','map','setDataValue','unreadMessages','length','emit','catch','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x2a253c,_0x40935c){var _0x191e53=function(_0x3ca47e){while(--_0x3ca47e){_0x2a253c['push'](_0x2a253c['shift']());}};_0x191e53(++_0x40935c);}(_0xced6,0x1b5));var _0x6ced=function(_0x4f26f3,_0x23a6b9){_0x4f26f3=_0x4f26f3-0x0;var _0x24b4cf=_0xced6[_0x4f26f3];return _0x24b4cf;};'use strict';var EventEmitter=require(_0x6ced('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x6ced('0x1')];var ChatMessage=require(_0x6ced('0x2'))['db'][_0x6ced('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6ced('0x4')](0x0);var events={'afterCreate':_0x6ced('0x5'),'afterUpdate':_0x6ced('0x6'),'afterDestroy':_0x6ced('0x7')};function emitEvent(_0x5f2c26){return function(_0x57fb4b,_0x4bc7a3,_0x53d8b4){_0x57fb4b[_0x6ced('0x8')]({'attributes':['id'],'raw':!![]})[_0x6ced('0x9')](function(_0x58fcb7){_0x57fb4b['setDataValue']('Users',_0x58fcb7[_0x6ced('0xa')](function(_0x24c3de){return{'id':_0x24c3de['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x57fb4b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6ced('0x9')](function(_0x80d8c0){_0x57fb4b[_0x6ced('0xb')](_0x6ced('0xc'),_0x80d8c0[_0x6ced('0xd')]);ChatInteractionEvents[_0x6ced('0xe')](_0x5f2c26+':'+_0x57fb4b['id'],_0x57fb4b);ChatInteractionEvents['emit'](_0x5f2c26,_0x57fb4b);_0x53d8b4(null);})[_0x6ced('0xf')](_0x53d8b4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x6ced('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4bcc6d0..94c757e 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 _0x8e04=['exports','ChatInteraction','chat_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatInteraction.attributes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8e04,0x118));var _0x48e0=function(_0x51f492,_0x6b3e08){_0x51f492=_0x51f492-0x0;var _0x4c76eb=_0x8e04[_0x51f492];return _0x4c76eb;};'use strict';var _=require(_0x48e0('0x0'));var util=require(_0x48e0('0x1'));var logger=require(_0x48e0('0x2'))(_0x48e0('0x3'));var moment=require(_0x48e0('0x4'));var BPromise=require(_0x48e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48e0('0x6'));var rimraf=require('rimraf');var config=require(_0x48e0('0x7'));var attributes=require(_0x48e0('0x8'));module[_0x48e0('0x9')]=function(_0xd8de1f,_0xa80c5f){return _0xd8de1f['define'](_0x48e0('0xa'),attributes,{'tableName':_0x48e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b5a6a,_0xcac9cb,_0x21bc28){if(_0x2b5a6a['changed']('closed')){_0x2b5a6a[_0x48e0('0xc')]=moment()[_0x48e0('0xd')](_0x48e0('0xe'));}_0x21bc28(null,_0x2b5a6a);}},'charset':_0x48e0('0xf'),'collate':_0x48e0('0x10')});}; \ No newline at end of file +var _0xd60b=['define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xd60b,0x198));var _0xbd60=function(_0x12ed2d,_0x301cb8){_0x12ed2d=_0x12ed2d-0x0;var _0x410024=_0xd60b[_0x12ed2d];return _0x410024;};'use strict';var _=require(_0xbd60('0x0'));var util=require('util');var logger=require(_0xbd60('0x1'))(_0xbd60('0x2'));var moment=require(_0xbd60('0x3'));var BPromise=require(_0xbd60('0x4'));var rp=require(_0xbd60('0x5'));var fs=require('fs');var path=require(_0xbd60('0x6'));var rimraf=require(_0xbd60('0x7'));var config=require(_0xbd60('0x8'));var attributes=require('./chatInteraction.attributes');module[_0xbd60('0x9')]=function(_0x23fa5e,_0x3e284c){return _0x23fa5e[_0xbd60('0xa')](_0xbd60('0xb'),attributes,{'tableName':_0xbd60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8de6bb,_0x161ed3,_0x47dd99){if(_0x8de6bb[_0xbd60('0xd')](_0xbd60('0xe'))){_0x8de6bb[_0xbd60('0xf')]=moment()[_0xbd60('0x10')](_0xbd60('0x11'));}_0x47dd99(null,_0x8de6bb);}},'charset':'utf8mb4','collate':_0xbd60('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0a834b3..bc49715 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 _0xd0bf=['options','raw','where','limit','AddTagsToChatInteraction','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body'];(function(_0x13c2d6,_0x3cb435){var _0x48dcf2=function(_0xa4a9a2){while(--_0xa4a9a2){_0x13c2d6['push'](_0x13c2d6['shift']());}};_0x48dcf2(++_0x3cb435);}(_0xd0bf,0x8a));var _0xfd0b=function(_0x54928a,_0x56b315){_0x54928a=_0x54928a-0x0;var _0x4388db=_0xd0bf[_0x54928a];return _0x4388db;};'use strict';var _=require(_0xfd0b('0x0'));var util=require(_0xfd0b('0x1'));var moment=require(_0xfd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xfd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd0b('0x4'))['db'];var utils=require(_0xfd0b('0x5'));var logger=require(_0xfd0b('0x6'))(_0xfd0b('0x7'));var config=require(_0xfd0b('0x8'));var jayson=require(_0xfd0b('0x9'));var client=jayson[_0xfd0b('0xa')][_0xfd0b('0xb')]({'port':0x232a});config[_0xfd0b('0xc')]=_[_0xfd0b('0xd')](config[_0xfd0b('0xc')],{'host':_0xfd0b('0xe'),'port':0x18eb});var socket=require(_0xfd0b('0xf'))(new Redis(config[_0xfd0b('0xc')]));require('./chatInteraction.socket')[_0xfd0b('0x10')](socket);function respondWithRpcPromise(_0x23a97a,_0x53aff4,_0x1772ba){return new BPromise(function(_0x13dc30,_0x553f9e){return client[_0xfd0b('0x11')](_0x23a97a,_0x1772ba)[_0xfd0b('0x12')](function(_0x15fbd2){logger[_0xfd0b('0x13')](_0xfd0b('0x14'),_0x53aff4,_0xfd0b('0x15'));logger[_0xfd0b('0x16')](_0xfd0b('0x17'),_0x53aff4,'request\x20sent',JSON[_0xfd0b('0x18')](_0x15fbd2));if(_0x15fbd2[_0xfd0b('0x19')]){if(_0x15fbd2[_0xfd0b('0x19')][_0xfd0b('0x1a')]===0x1f4){logger[_0xfd0b('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x53aff4,_0x15fbd2[_0xfd0b('0x19')]['message']);return _0x553f9e(_0x15fbd2[_0xfd0b('0x19')][_0xfd0b('0x1b')]);}logger[_0xfd0b('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x53aff4,_0x15fbd2[_0xfd0b('0x19')][_0xfd0b('0x1b')]);return _0x13dc30(_0x15fbd2[_0xfd0b('0x19')][_0xfd0b('0x1b')]);}else{logger[_0xfd0b('0x13')](_0xfd0b('0x14'),_0x53aff4,_0xfd0b('0x15'));_0x13dc30(_0x15fbd2[_0xfd0b('0x1c')]['message']);}})[_0xfd0b('0x1d')](function(_0x88ae77){logger[_0xfd0b('0x19')](_0xfd0b('0x14'),_0x53aff4,_0x88ae77);_0x553f9e(_0x88ae77);});});}exports[_0xfd0b('0x1e')]=function(_0x2a6b0c){var _0x28298d=this;return new Promise(function(_0x3da0fd,_0x35521d){return db[_0xfd0b('0x1f')][_0xfd0b('0x20')](_0x2a6b0c[_0xfd0b('0x21')],{'raw':_0x2a6b0c[_0xfd0b('0x22')]?_0x2a6b0c['options'][_0xfd0b('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a6b0c[_0xfd0b('0x22')]?_0x2a6b0c[_0xfd0b('0x22')][_0xfd0b('0x24')]||null:null,'attributes':_0x2a6b0c[_0xfd0b('0x22')]?_0x2a6b0c[_0xfd0b('0x22')]['attributes']||null:null,'limit':_0x2a6b0c['options']?_0x2a6b0c['options'][_0xfd0b('0x25')]||null:null})['then'](function(_0x31c472){logger['info']('UpdateChatInteraction',_0x2a6b0c);logger[_0xfd0b('0x16')]('UpdateChatInteraction',_0x2a6b0c,JSON[_0xfd0b('0x18')](_0x31c472));_0x3da0fd(_0x31c472);})[_0xfd0b('0x1d')](function(_0x3628cd){logger[_0xfd0b('0x19')](_0xfd0b('0x1e'),_0x3628cd[_0xfd0b('0x1b')],_0x2a6b0c);_0x35521d(_0x28298d['error'](0x1f4,_0x3628cd['message']));});});};exports[_0xfd0b('0x26')]=function(_0x2f2b52){return new Promise(function(_0xda32a4,_0x362f45){return db[_0xfd0b('0x1f')]['find']({'where':_0x2f2b52[_0xfd0b('0x22')]?_0x2f2b52[_0xfd0b('0x22')][_0xfd0b('0x24')]||null:null})[_0xfd0b('0x12')](function(_0x374eb8){if(_0x374eb8){return _0x374eb8[_0xfd0b('0x27')](_0x2f2b52['body'][_0xfd0b('0x28')],_[_0xfd0b('0x29')](_0x2f2b52[_0xfd0b('0x21')],[_0xfd0b('0x28'),'id'])||{});}})['spread'](function(_0x12cd39){logger[_0xfd0b('0x13')](_0xfd0b('0x2a'),_0x2f2b52);logger['debug']('AddTags',_0x2f2b52,JSON['stringify'](_0x12cd39));_0xda32a4(_0x12cd39);})['catch'](function(_0x144f6e){logger[_0xfd0b('0x19')]('AddTags',_0x144f6e[_0xfd0b('0x1b')],_0x2f2b52);_0x362f45(_this[_0xfd0b('0x19')](0x1f4,_0x144f6e[_0xfd0b('0x1b')]));});});}; \ No newline at end of file +var _0x196e=['../../config/environment','client','redis','localhost','socket.io-emitter','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ChatInteraction','update','options','where','UpdateChatInteraction','addTags','body','ids','omit','spread','AddTags','util','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x196e,0x189));var _0xe196=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x196e[_0x2786ea];return _0x5c38e5;};'use strict';var _=require('lodash');var util=require(_0xe196('0x0'));var moment=require('moment');var BPromise=require(_0xe196('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe196('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe196('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xe196('0x4')]['http']({'port':0x232a});config[_0xe196('0x5')]=_['defaults'](config[_0xe196('0x5')],{'host':_0xe196('0x6'),'port':0x18eb});var socket=require(_0xe196('0x7'))(new Redis(config[_0xe196('0x5')]));require('./chatInteraction.socket')[_0xe196('0x8')](socket);function respondWithRpcPromise(_0x436533,_0x179540,_0x3773a3){return new BPromise(function(_0x234063,_0x109046){return client[_0xe196('0x9')](_0x436533,_0x3773a3)[_0xe196('0xa')](function(_0x5e367a){logger['info'](_0xe196('0xb'),_0x179540,_0xe196('0xc'));logger[_0xe196('0xd')](_0xe196('0xe'),_0x179540,_0xe196('0xc'),JSON[_0xe196('0xf')](_0x5e367a));if(_0x5e367a['error']){if(_0x5e367a[_0xe196('0x10')][_0xe196('0x11')]===0x1f4){logger[_0xe196('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x179540,_0x5e367a[_0xe196('0x10')][_0xe196('0x12')]);return _0x109046(_0x5e367a[_0xe196('0x10')][_0xe196('0x12')]);}logger[_0xe196('0x10')](_0xe196('0xb'),_0x179540,_0x5e367a[_0xe196('0x10')][_0xe196('0x12')]);return _0x234063(_0x5e367a['error']['message']);}else{logger[_0xe196('0x13')](_0xe196('0xb'),_0x179540,_0xe196('0xc'));_0x234063(_0x5e367a[_0xe196('0x14')]['message']);}})[_0xe196('0x15')](function(_0x400238){logger[_0xe196('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x179540,_0x400238);_0x109046(_0x400238);});});}exports['UpdateChatInteraction']=function(_0x24e5a0){var _0x4d6964=this;return new Promise(function(_0xc47f5f,_0x33192f){return db[_0xe196('0x16')][_0xe196('0x17')](_0x24e5a0['body'],{'raw':_0x24e5a0[_0xe196('0x18')]?_0x24e5a0[_0xe196('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24e5a0[_0xe196('0x18')]?_0x24e5a0[_0xe196('0x18')][_0xe196('0x19')]||null:null,'attributes':_0x24e5a0[_0xe196('0x18')]?_0x24e5a0[_0xe196('0x18')]['attributes']||null:null,'limit':_0x24e5a0['options']?_0x24e5a0[_0xe196('0x18')]['limit']||null:null})[_0xe196('0xa')](function(_0x198ee5){logger[_0xe196('0x13')]('UpdateChatInteraction',_0x24e5a0);logger['debug']('UpdateChatInteraction',_0x24e5a0,JSON['stringify'](_0x198ee5));_0xc47f5f(_0x198ee5);})[_0xe196('0x15')](function(_0x52a83e){logger[_0xe196('0x10')](_0xe196('0x1a'),_0x52a83e[_0xe196('0x12')],_0x24e5a0);_0x33192f(_0x4d6964[_0xe196('0x10')](0x1f4,_0x52a83e[_0xe196('0x12')]));});});};exports['AddTagsToChatInteraction']=function(_0x266c3a){return new Promise(function(_0x71e48c,_0x3815ef){return db['ChatInteraction']['find']({'where':_0x266c3a['options']?_0x266c3a['options'][_0xe196('0x19')]||null:null})[_0xe196('0xa')](function(_0x173a68){if(_0x173a68){return _0x173a68[_0xe196('0x1b')](_0x266c3a[_0xe196('0x1c')][_0xe196('0x1d')],_[_0xe196('0x1e')](_0x266c3a[_0xe196('0x1c')],[_0xe196('0x1d'),'id'])||{});}})[_0xe196('0x1f')](function(_0x337019){logger[_0xe196('0x13')](_0xe196('0x20'),_0x266c3a);logger['debug']('AddTags',_0x266c3a,JSON[_0xe196('0xf')](_0x337019));_0x71e48c(_0x337019);})[_0xe196('0x15')](function(_0x29d844){logger['error']('AddTags',_0x29d844[_0xe196('0x12')],_0x266c3a);_0x3815ef(_this[_0xe196('0x10')](0x1f4,_0x29d844['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index fa2892f..c6c4339 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 _0x8206=['remove','update','emit','removeListener','register','length','chatInteraction:','save'];(function(_0x1cb267,_0xab55ce){var _0x8b30ff=function(_0x119b6e){while(--_0x119b6e){_0x1cb267['push'](_0x1cb267['shift']());}};_0x8b30ff(++_0xab55ce);}(_0x8206,0x147));var _0x6820=function(_0x2fc9a5,_0x235b92){_0x2fc9a5=_0x2fc9a5-0x0;var _0x3fd730=_0x8206[_0x2fc9a5];return _0x3fd730;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x6820('0x0'),_0x6820('0x1'),_0x6820('0x2')];function createListener(_0xc1bf47,_0x5d85f6){return function(_0x48f28a){_0x5d85f6[_0x6820('0x3')](_0xc1bf47,_0x48f28a);};}function removeListener(_0x333dea,_0x5e4299){return function(){ChatInteractionEvents[_0x6820('0x4')](_0x333dea,_0x5e4299);};}exports[_0x6820('0x5')]=function(_0x538adc){for(var _0x21bf55=0x0,_0x3397a7=events[_0x6820('0x6')];_0x21bf55<_0x3397a7;_0x21bf55++){var _0x2ad457=events[_0x21bf55];var _0x4933c2=createListener(_0x6820('0x7')+_0x2ad457,_0x538adc);ChatInteractionEvents['on'](_0x2ad457,_0x4933c2);}}; \ No newline at end of file +var _0x416b=['chatInteraction:','./chatInteraction.events','save','emit','removeListener','register','length'];(function(_0x205e83,_0x2df5a4){var _0x10bb19=function(_0x41a375){while(--_0x41a375){_0x205e83['push'](_0x205e83['shift']());}};_0x10bb19(++_0x2df5a4);}(_0x416b,0x1c8));var _0xb416=function(_0xf937d7,_0x59d955){_0xf937d7=_0xf937d7-0x0;var _0x39edc8=_0x416b[_0xf937d7];return _0x39edc8;};'use strict';var ChatInteractionEvents=require(_0xb416('0x0'));var events=[_0xb416('0x1'),'remove','update'];function createListener(_0x31fc53,_0x51d809){return function(_0x1e699d){_0x51d809[_0xb416('0x2')](_0x31fc53,_0x1e699d);};}function removeListener(_0x24a6c7,_0x3bac24){return function(){ChatInteractionEvents[_0xb416('0x3')](_0x24a6c7,_0x3bac24);};}exports[_0xb416('0x4')]=function(_0x386517){for(var _0x35bf96=0x0,_0x11956d=events[_0xb416('0x5')];_0x35bf96<_0x11956d;_0x35bf96++){var _0x3f3868=events[_0x35bf96];var _0x53974f=createListener(_0xb416('0x6')+_0x3f3868,_0x386517);ChatInteractionEvents['on'](_0x3f3868,_0x53974f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 7d73146..96d2b29 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 _0x6d2d=['download','post','create','createVidaooSession','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','addTags','chatinteraction:update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','/:id','tracked','chatinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x4d3635,_0x1aac7e){_0x4d3635=_0x4d3635-0x0;var _0x20f703=_0x6d2d[_0x4d3635];return _0x20f703;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6d2('0x0'));var timeout=require(_0xd6d2('0x1'));var express=require(_0xd6d2('0x2'));var router=express['Router']();var auth=require(_0xd6d2('0x3'));var interaction=require(_0xd6d2('0x4'));var config=require(_0xd6d2('0x5'));var controller=require(_0xd6d2('0x6'));router[_0xd6d2('0x7')]('/',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x9')]);router[_0xd6d2('0x7')]('/describe',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xa')]);router[_0xd6d2('0x7')]('/:id',auth[_0xd6d2('0xb')](),controller[_0xd6d2('0xc')]);router[_0xd6d2('0x7')](_0xd6d2('0xd'),auth[_0xd6d2('0xb')](),controller[_0xd6d2('0xe')]);router[_0xd6d2('0x7')](_0xd6d2('0xf'),auth['isAuthenticated'](),controller[_0xd6d2('0x10')]);router[_0xd6d2('0x7')](_0xd6d2('0x11'),auth[_0xd6d2('0xb')](),controller[_0xd6d2('0x12')]);router[_0xd6d2('0x7')](_0xd6d2('0x13'),auth['isAuthenticated'](),controller[_0xd6d2('0x14')]);router[_0xd6d2('0x15')]('/',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x16')]);router[_0xd6d2('0x15')]('/:id/vidaoo',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c93ce,_0xef4acc,_0x1cca32){_0x1cca32(null,path['join'](config[_0xd6d2('0x18')],_0xd6d2('0x19')));},'filename':function(_0x5a8ecc,_0x470b19,_0x21c13b){_0x21c13b(null,util[_0xd6d2('0x1a')](_0xd6d2('0x1b'),Date[_0xd6d2('0x1c')](),_0x470b19[_0xd6d2('0x1d')][_0xd6d2('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd6d2('0x15')](_0xd6d2('0x1f'),upload[_0xd6d2('0x20')](_0xd6d2('0x21')),controller[_0xd6d2('0x22')]);router[_0xd6d2('0x15')](_0xd6d2('0xf'),auth[_0xd6d2('0xb')](),controller[_0xd6d2('0x23')]);router[_0xd6d2('0x15')](_0xd6d2('0x24'),auth[_0xd6d2('0x8')](),interaction['tracked'](_0xd6d2('0x25'),'chatinteraction:addtags'),controller[_0xd6d2('0x26')]);router['put']('/:id',auth[_0xd6d2('0x8')](),interaction['tracked']('chat',_0xd6d2('0x27')),controller['update']);router[_0xd6d2('0x28')](_0xd6d2('0x29'),controller[_0xd6d2('0x2a')]);router['put'](_0xd6d2('0x2b'),auth[_0xd6d2('0xb')](),controller[_0xd6d2('0x2c')]);router[_0xd6d2('0x28')]('/:id/close',controller[_0xd6d2('0x2d')]);router['delete'](_0xd6d2('0x2e'),auth[_0xd6d2('0x8')](),interaction[_0xd6d2('0x2f')]('chat',_0xd6d2('0x30')),controller[_0xd6d2('0x31')]);router['delete'](_0xd6d2('0x24'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x32')]);module[_0xd6d2('0x33')]=router; \ No newline at end of file +var _0x1cc3=['createVidaooSession','diskStorage','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo'];(function(_0x56c6c9,_0x2ffc61){var _0xe2a5b9=function(_0xebfed1){while(--_0xebfed1){_0x56c6c9['push'](_0x56c6c9['shift']());}};_0xe2a5b9(++_0x2ffc61);}(_0x1cc3,0x11b));var _0x31cc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1cc3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x31cc('0x0'));var util=require(_0x31cc('0x1'));var path=require('path');var timeout=require(_0x31cc('0x2'));var express=require('express');var router=express[_0x31cc('0x3')]();var auth=require(_0x31cc('0x4'));var interaction=require(_0x31cc('0x5'));var config=require('../../config/environment');var controller=require(_0x31cc('0x6'));router[_0x31cc('0x7')]('/',auth[_0x31cc('0x8')](),controller['index']);router[_0x31cc('0x7')](_0x31cc('0x9'),auth[_0x31cc('0x8')](),controller[_0x31cc('0xa')]);router[_0x31cc('0x7')](_0x31cc('0xb'),auth[_0x31cc('0xc')](),controller[_0x31cc('0xd')]);router[_0x31cc('0x7')]('/:id/attachment_download',auth[_0x31cc('0xc')](),controller[_0x31cc('0xe')]);router[_0x31cc('0x7')](_0x31cc('0xf'),auth[_0x31cc('0x8')](),controller[_0x31cc('0x10')]);router[_0x31cc('0x7')](_0x31cc('0x11'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x12')]);router['get'](_0x31cc('0x13'),auth[_0x31cc('0x8')](),controller['download']);router[_0x31cc('0x14')]('/',auth[_0x31cc('0x8')](),controller[_0x31cc('0x15')]);router[_0x31cc('0x14')](_0x31cc('0x16'),auth[_0x31cc('0x8')](),controller[_0x31cc('0x17')]);var upload=multer({'storage':multer[_0x31cc('0x18')]({'destination':function(_0x1227ad,_0xc22d83,_0x171917){_0x171917(null,path['join'](config[_0x31cc('0x19')],_0x31cc('0x1a')));},'filename':function(_0x390350,_0x5ae7de,_0x2908cd){_0x2908cd(null,util[_0x31cc('0x1b')]('%s-%s',Date[_0x31cc('0x1c')](),_0x5ae7de[_0x31cc('0x1d')][_0x31cc('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x31cc('0x14')](_0x31cc('0x1f'),upload['single'](_0x31cc('0x20')),controller[_0x31cc('0x21')]);router[_0x31cc('0x14')](_0x31cc('0xf'),auth[_0x31cc('0xc')](),controller[_0x31cc('0x22')]);router[_0x31cc('0x14')](_0x31cc('0x23'),auth['isAuthenticated'](),interaction[_0x31cc('0x24')](_0x31cc('0x25'),_0x31cc('0x26')),controller['addTags']);router[_0x31cc('0x27')]('/:id',auth[_0x31cc('0x8')](),interaction['tracked'](_0x31cc('0x25'),'chatinteraction:update'),controller[_0x31cc('0x28')]);router['put'](_0x31cc('0x29'),controller[_0x31cc('0x2a')]);router['put'](_0x31cc('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x31cc('0x2c')]);router['put'](_0x31cc('0x2d'),controller['close']);router[_0x31cc('0x2e')](_0x31cc('0xb'),auth[_0x31cc('0x8')](),interaction[_0x31cc('0x24')](_0x31cc('0x25'),_0x31cc('0x2f')),controller[_0x31cc('0x30')]);router['delete']('/:id/tags',auth[_0x31cc('0x8')](),controller[_0x31cc('0x31')]);module[_0x31cc('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index a512a11..4b29560 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 _0x1967=['INTEGER','exports','TEXT','medium','BOOLEAN'];(function(_0x2fc046,_0x4a2579){var _0x4b86a4=function(_0x31340e){while(--_0x31340e){_0x2fc046['push'](_0x2fc046['shift']());}};_0x4b86a4(++_0x4a2579);}(_0x1967,0x173));var _0x7196=function(_0x1dcb66,_0x13c4fe){_0x1dcb66=_0x1dcb66-0x0;var _0x449812=_0x1967[_0x1dcb66];return _0x449812;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'body':{'type':Sequelize[_0x7196('0x1')](_0x7196('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7196('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7196('0x4')]}}; \ No newline at end of file +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x183be5,_0x5b8e6a){var _0x49248c=function(_0x33c619){while(--_0x33c619){_0x183be5['push'](_0x183be5['shift']());}};_0x49248c(++_0x5b8e6a);}(_0xdb28,0x106));var _0x8db2=function(_0x595774,_0x4a5b47){_0x595774=_0x595774-0x0;var _0x4335b8=_0xdb28[_0x595774];return _0x4335b8;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index bacea4c..203b84d 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 _0x50e6=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','create','body','update','find','describe','get','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','role','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','isEmpty','push','FromId','ToId','-createdAt','all','html-pdf','eml-format','rimraf','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x475d32,_0x45102b){var _0x3adbd3=function(_0x466fa8){while(--_0x466fa8){_0x475d32['push'](_0x475d32['shift']());}};_0x3adbd3(++_0x45102b);}(_0x50e6,0x195));var _0x650e=function(_0x432e9a,_0x5a80af){_0x432e9a=_0x432e9a-0x0;var _0x2a8f17=_0x50e6[_0x432e9a];return _0x2a8f17;};'use strict';var pdf=require(_0x650e('0x0'));var emlformat=require(_0x650e('0x1'));var rimraf=require(_0x650e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x650e('0x3'));var rp=require(_0x650e('0x4'));var moment=require(_0x650e('0x5'));var BPromise=require(_0x650e('0x6'));var Mustache=require(_0x650e('0x7'));var util=require(_0x650e('0x8'));var path=require(_0x650e('0x9'));var sox=require(_0x650e('0xa'));var csv=require('to-csv');var ejs=require(_0x650e('0xb'));var fs=require('fs');var _=require(_0x650e('0xc'));var squel=require(_0x650e('0xd'));var crypto=require('crypto');var jsforce=require(_0x650e('0xe'));var deskjs=require(_0x650e('0xf'));var toCsv=require(_0x650e('0x10'));var querystring=require(_0x650e('0x11'));var Papa=require(_0x650e('0x12'));var Redis=require('ioredis');var authService=require(_0x650e('0x13'));var qs=require(_0x650e('0x14'));var as=require(_0x650e('0x15'));var hardwareService=require(_0x650e('0x16'));var logger=require('../../config/logger')(_0x650e('0x17'));var utils=require(_0x650e('0x18'));var config=require(_0x650e('0x19'));var db=require(_0x650e('0x1a'))['db'];config[_0x650e('0x1b')]=_[_0x650e('0x1c')](config['redis'],{'host':_0x650e('0x1d'),'port':0x18eb});var socket=require(_0x650e('0x1e'))(new Redis(config[_0x650e('0x1b')]));require('./chatInternalMessage.socket')[_0x650e('0x1f')](socket);function respondWithStatusCode(_0x1212db,_0x111653){_0x111653=_0x111653||0xcc;return function(_0x5962bd){if(_0x5962bd){return _0x1212db[_0x650e('0x20')](_0x111653);}return _0x1212db[_0x650e('0x21')](_0x111653)[_0x650e('0x22')]();};}function respondWithResult(_0x21e344,_0x58685a){_0x58685a=_0x58685a||0xc8;return function(_0xa8910e){if(_0xa8910e){return _0x21e344[_0x650e('0x21')](_0x58685a)[_0x650e('0x23')](_0xa8910e);}};}function respondWithFilteredResult(_0x4d27ab,_0x48a554){return function(_0x1cb5bf){if(_0x1cb5bf){var _0x2281a1=_0x1cb5bf[_0x650e('0x24')],_0x20ddcc=_0x48a554[_0x650e('0x25')],_0x16e255=_0x48a554['offset']+_0x48a554[_0x650e('0x26')],_0xf90e02;if(_0x16e255>=_0x2281a1){_0x16e255=_0x2281a1;_0xf90e02=0xc8;}else{_0xf90e02=0xce;}_0x4d27ab[_0x650e('0x21')](_0xf90e02);return _0x4d27ab[_0x650e('0x27')]('Content-Range',_0x20ddcc+'-'+_0x16e255+'/'+_0x2281a1)['json'](_0x1cb5bf);}return null;};}function patchUpdates(_0x4d765e){return function(_0x2d3030){try{jsonpatch[_0x650e('0x28')](_0x2d3030,_0x4d765e,!![]);}catch(_0x5b2d8c){return BPromise[_0x650e('0x29')](_0x5b2d8c);}return _0x2d3030['save']();};}function saveUpdates(_0x271949,_0x48526b){return function(_0xe12dde){if(_0xe12dde){return _0xe12dde['update'](_0x271949)[_0x650e('0x2a')](function(_0x1420e4){return _0x1420e4;});}return null;};}function removeEntity(_0x3ba9ea,_0x1baacc){return function(_0x1252f7){if(_0x1252f7){return _0x1252f7[_0x650e('0x2b')]()[_0x650e('0x2a')](function(){_0x3ba9ea[_0x650e('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x588dcd,_0x151507){return function(_0x4a9f4b){if(!_0x4a9f4b){_0x588dcd['sendStatus'](0x194);}return _0x4a9f4b;};}function handleError(_0x2c0331,_0x5c4832){_0x5c4832=_0x5c4832||0x1f4;return function(_0x240d6f){logger['error'](_0x240d6f[_0x650e('0x2c')]);if(_0x240d6f['name']){delete _0x240d6f[_0x650e('0x2d')];}_0x2c0331[_0x650e('0x21')](_0x5c4832)[_0x650e('0x2e')](_0x240d6f);};}exports['index']=function(_0x52675b,_0xbea27){var _0xca18cd={},_0x106b45={},_0x591fab={'count':0x0,'rows':[]};var _0x4ea8b5=_['map'](db[_0x650e('0x2f')][_0x650e('0x30')],function(_0xb3738){return{'name':_0xb3738[_0x650e('0x31')],'type':_0xb3738['type'][_0x650e('0x32')]};});_0x106b45['model']=_[_0x650e('0x33')](_0x4ea8b5,_0x650e('0x2d'));_0x106b45[_0x650e('0x34')]=_[_0x650e('0x35')](_0x52675b[_0x650e('0x34')]);_0x106b45['filters']=_[_0x650e('0x36')](_0x106b45[_0x650e('0x37')],_0x106b45[_0x650e('0x34')]);_0xca18cd['attributes']=_[_0x650e('0x36')](_0x106b45[_0x650e('0x37')],qs['fields'](_0x52675b[_0x650e('0x34')][_0x650e('0x38')]));_0xca18cd[_0x650e('0x39')]=_0xca18cd['attributes'][_0x650e('0x3a')]?_0xca18cd[_0x650e('0x39')]:_0x106b45[_0x650e('0x37')];if(!_0x52675b[_0x650e('0x34')][_0x650e('0x3b')](_0x650e('0x3c'))){_0xca18cd[_0x650e('0x26')]=qs[_0x650e('0x26')](_0x52675b[_0x650e('0x34')][_0x650e('0x26')]);_0xca18cd['offset']=qs['offset'](_0x52675b[_0x650e('0x34')][_0x650e('0x25')]);}_0xca18cd[_0x650e('0x3d')]=qs[_0x650e('0x3e')](_0x52675b['query'][_0x650e('0x3e')]);_0xca18cd[_0x650e('0x3f')]=qs[_0x650e('0x40')](_['pick'](_0x52675b[_0x650e('0x34')],_0x106b45[_0x650e('0x40')]),_0x4ea8b5);if(_0x52675b[_0x650e('0x34')][_0x650e('0x41')]){_0xca18cd[_0x650e('0x3f')]=_['merge'](_0xca18cd[_0x650e('0x3f')],{'$or':_[_0x650e('0x33')](_0x4ea8b5,function(_0x36a257){if(_0x36a257[_0x650e('0x42')]!==_0x650e('0x43')){var _0x3883c1={};_0x3883c1[_0x36a257[_0x650e('0x2d')]]={'$like':'%'+_0x52675b[_0x650e('0x34')][_0x650e('0x41')]+'%'};return _0x3883c1;}})});}_0xca18cd=_[_0x650e('0x44')]({},_0xca18cd,_0x52675b[_0x650e('0x45')]);var _0x489a6c={'where':_0xca18cd[_0x650e('0x3f')]};return db[_0x650e('0x2f')][_0x650e('0x24')](_0x489a6c)[_0x650e('0x2a')](function(_0x4b3971){_0x591fab['count']=_0x4b3971;if(_0x52675b[_0x650e('0x34')][_0x650e('0x46')]){_0xca18cd[_0x650e('0x47')]=[{'all':!![]}];}return db[_0x650e('0x2f')]['findAll'](_0xca18cd);})[_0x650e('0x2a')](function(_0x408de2){_0x591fab[_0x650e('0x48')]=_0x408de2;return _0x591fab;})['then'](respondWithFilteredResult(_0xbea27,_0xca18cd))['catch'](handleError(_0xbea27,null));};exports[_0x650e('0x49')]=function(_0x1cc5b6,_0x17c102){var _0x3dffa7={'raw':!![],'where':{'id':_0x1cc5b6[_0x650e('0x4a')]['id']}},_0x23e05a={};_0x23e05a[_0x650e('0x37')]=_[_0x650e('0x35')](db['ChatInternalMessage'][_0x650e('0x30')]);_0x23e05a[_0x650e('0x34')]=_['keys'](_0x1cc5b6['query']);_0x23e05a['filters']=_[_0x650e('0x36')](_0x23e05a['model'],_0x23e05a[_0x650e('0x34')]);_0x3dffa7[_0x650e('0x39')]=_[_0x650e('0x36')](_0x23e05a['model'],qs[_0x650e('0x38')](_0x1cc5b6['query'][_0x650e('0x38')]));_0x3dffa7[_0x650e('0x39')]=_0x3dffa7[_0x650e('0x39')][_0x650e('0x3a')]?_0x3dffa7[_0x650e('0x39')]:_0x23e05a[_0x650e('0x37')];if(_0x1cc5b6[_0x650e('0x34')]['includeAll']){_0x3dffa7['include']=[{'all':!![]}];}_0x3dffa7=_[_0x650e('0x44')]({},_0x3dffa7,_0x1cc5b6[_0x650e('0x45')]);return db[_0x650e('0x2f')]['find'](_0x3dffa7)[_0x650e('0x2a')](handleEntityNotFound(_0x17c102,null))[_0x650e('0x2a')](respondWithResult(_0x17c102,null))[_0x650e('0x4b')](handleError(_0x17c102,null));};exports[_0x650e('0x4c')]=function(_0x3bd1d9,_0x46d6f0){return db[_0x650e('0x2f')][_0x650e('0x4c')](_0x3bd1d9[_0x650e('0x4d')],{})[_0x650e('0x2a')](respondWithResult(_0x46d6f0,0xc9))['catch'](handleError(_0x46d6f0,null));};exports[_0x650e('0x4e')]=function(_0x2d7bf3,_0x5ec5cf){if(_0x2d7bf3[_0x650e('0x4d')]['id']){delete _0x2d7bf3[_0x650e('0x4d')]['id'];}return db[_0x650e('0x2f')]['find']({'where':{'id':_0x2d7bf3[_0x650e('0x4a')]['id']}})[_0x650e('0x2a')](handleEntityNotFound(_0x5ec5cf,null))['then'](saveUpdates(_0x2d7bf3[_0x650e('0x4d')],null))['then'](respondWithResult(_0x5ec5cf,null))[_0x650e('0x4b')](handleError(_0x5ec5cf,null));};exports['destroy']=function(_0x297c81,_0x48b9a3){return db[_0x650e('0x2f')][_0x650e('0x4f')]({'where':{'id':_0x297c81[_0x650e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48b9a3,null))[_0x650e('0x2a')](removeEntity(_0x48b9a3,null))[_0x650e('0x4b')](handleError(_0x48b9a3,null));};exports['describe']=function(_0x164a9a,_0x453041){return db['ChatInternalMessage'][_0x650e('0x50')]()[_0x650e('0x2a')](respondWithResult(_0x453041,null))[_0x650e('0x4b')](handleError(_0x453041,null));};function wrapUser(_0x22c1a8){return function(_0x40aaea){var _0x11a3d4=_0x22c1a8[_0x650e('0x51')]({'plain':!![]});_0x11a3d4[_0x650e('0x52')]=[];if(_0x40aaea){_0x11a3d4['lastMessageAt']=_0x40aaea[_0x650e('0x53')];_0x11a3d4[_0x650e('0x54')]=_0x40aaea;}else{_0x11a3d4[_0x650e('0x55')]=moment(0x0)['format'](_0x650e('0x56'));_0x11a3d4[_0x650e('0x54')]={};}return _0x11a3d4;};}exports[_0x650e('0x57')]=function(_0x3cc728,_0x1ac939,_0x42f5dc){var _0x4d4eb8=[];return db[_0x650e('0x58')][_0x650e('0x59')]({'where':{'role':[_0x650e('0x5a'),'admin',_0x650e('0x5b')]},'attributes':['id','fullname',_0x650e('0x2d'),_0x650e('0x5c'),'userpic',_0x650e('0x5d'),'online',_0x650e('0x5e'),_0x650e('0x5f'),_0x650e('0x60')],'order':qs[_0x650e('0x3e')](_0x650e('0x61')),'include':[{'model':db['VoiceQueue'],'as':_0x650e('0x62'),'attributes':['id',_0x650e('0x2d'),_0x650e('0x42')],'through':{'attributes':[]}}]})[_0x650e('0x2a')](function(_0x2bf67e){if(_0x2bf67e){var _0x525b0d=_0x3cc728[_0x650e('0x5b')][_0x650e('0x51')]({'plain':!![]});if(!_0x525b0d)throw new Error(_0x650e('0x63'));if(_0x525b0d[_0x650e('0x5c')]===_0x650e('0x5b')){return db['UserProfileSection']['find']({'where':{'name':'Agents','userProfileId':_0x525b0d[_0x650e('0x64')]},'raw':!![]})[_0x650e('0x2a')](function(_0x38a402){if(_0x38a402){if(_0x38a402['autoAssociation']===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x38a402['id']},'raw':!![]})['then'](function(_0x576034){var _0xcb72b6=[];if(_[_0x650e('0x65')](_0x576034)){_0xcb72b6=_['filter'](_0x2bf67e,function(_0x3738ed){if(_0x3738ed[_0x650e('0x5c')]!==_0x650e('0x5a')){return _0x3738ed;}});return _0xcb72b6;}else{for(var _0x1a2064=0x0;_0x1a2064<_0x2bf67e[_0x650e('0x3a')];_0x1a2064++){var _0x326180=_0x2bf67e[_0x1a2064];if(_0x326180[_0x650e('0x5c')]==='agent'){var _0x13ca74=_[_0x650e('0x4f')](_0x576034,function(_0x4b5905){return _0x4b5905['resourceId']===_0x326180['id'];});if(_0x13ca74)_0xcb72b6[_0x650e('0x66')](_0x326180);}else{_0xcb72b6[_0x650e('0x66')](_0x326180);}}return _0xcb72b6;}});}else{return _0x2bf67e;}}else{var _0x3cc8b8=_[_0x650e('0x41')](_0x2bf67e,function(_0xab41be){if(_0xab41be['role']!==_0x650e('0x5a')){return _0xab41be;}});return _0x3cc8b8;}});}else{return _0x2bf67e;}}})['then'](function(_0x2d5eec){var _0x518cf2=[];if(_0x2d5eec){_0x4d4eb8=_0x2d5eec;for(var _0x2f48de=0x0;_0x2f48de<_0x2d5eec['length'];_0x2f48de+=0x1){_0x4d4eb8[_0x2f48de][_0x650e('0x52')]=[];_0x518cf2[_0x650e('0x66')](db[_0x650e('0x2f')][_0x650e('0x4f')]({'where':{'FromId':[_0x3cc728[_0x650e('0x5b')]['id'],_0x2d5eec[_0x2f48de]['id']],'ToId':[_0x3cc728[_0x650e('0x5b')]['id'],_0x2d5eec[_0x2f48de]['id']],'ChatGroupId':null},'attributes':['id',_0x650e('0x53'),_0x650e('0x67'),_0x650e('0x68'),'read',_0x650e('0x4d')],'order':qs['sort'](_0x650e('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x650e('0x2a')](wrapUser(_0x2d5eec[_0x2f48de])));}return BPromise[_0x650e('0x6a')](_0x518cf2);}return[];})[_0x650e('0x2a')](function(_0x26470c){return{'rows':_0x26470c,'count':_0x26470c[_0x650e('0x3a')]};})[_0x650e('0x2a')](respondWithResult(_0x1ac939,null))[_0x650e('0x4b')](handleError(_0x1ac939,null));}; \ No newline at end of file +var _0xa329=['limit','Content-Range','json','reject','save','then','stack','name','index','map','ChatInternalMessage','fieldName','type','key','keys','query','filters','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','show','rawAttributes','intersection','include','find','catch','create','body','update','destroy','params','describe','get','messages','lastMessageAt','createdAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','allowmessenger','-online','VoiceQueue','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','agent','length','resourceId','push','ToId','read','-createdAt','all','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','redis','./chatInternalMessage.socket','register','sendStatus','status','end','count','offset'];(function(_0x1226d6,_0x38127d){var _0x1592b3=function(_0x100446){while(--_0x100446){_0x1226d6['push'](_0x1226d6['shift']());}};_0x1592b3(++_0x38127d);}(_0xa329,0xb1));var _0x9a32=function(_0x27ef21,_0x10f730){_0x27ef21=_0x27ef21-0x0;var _0x2639ed=_0xa329[_0x27ef21];return _0x2639ed;};'use strict';var pdf=require(_0x9a32('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9a32('0x1'));var zipdir=require(_0x9a32('0x2'));var jsonpatch=require(_0x9a32('0x3'));var rp=require('request-promise');var moment=require(_0x9a32('0x4'));var BPromise=require(_0x9a32('0x5'));var Mustache=require(_0x9a32('0x6'));var util=require(_0x9a32('0x7'));var path=require(_0x9a32('0x8'));var sox=require(_0x9a32('0x9'));var csv=require(_0x9a32('0xa'));var ejs=require(_0x9a32('0xb'));var fs=require('fs');var _=require(_0x9a32('0xc'));var squel=require(_0x9a32('0xd'));var crypto=require(_0x9a32('0xe'));var jsforce=require(_0x9a32('0xf'));var deskjs=require(_0x9a32('0x10'));var toCsv=require(_0x9a32('0xa'));var querystring=require(_0x9a32('0x11'));var Papa=require(_0x9a32('0x12'));var Redis=require('ioredis');var authService=require(_0x9a32('0x13'));var qs=require(_0x9a32('0x14'));var as=require(_0x9a32('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a32('0x16'))('api');var utils=require(_0x9a32('0x17'));var config=require(_0x9a32('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9a32('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a32('0x19')]));require(_0x9a32('0x1a'))[_0x9a32('0x1b')](socket);function respondWithStatusCode(_0x3cacf7,_0x3db249){_0x3db249=_0x3db249||0xcc;return function(_0x497f6e){if(_0x497f6e){return _0x3cacf7[_0x9a32('0x1c')](_0x3db249);}return _0x3cacf7[_0x9a32('0x1d')](_0x3db249)[_0x9a32('0x1e')]();};}function respondWithResult(_0x5d5fee,_0xd7fa32){_0xd7fa32=_0xd7fa32||0xc8;return function(_0x98ab1d){if(_0x98ab1d){return _0x5d5fee['status'](_0xd7fa32)['json'](_0x98ab1d);}};}function respondWithFilteredResult(_0x374bd2,_0x426daf){return function(_0x2e507a){if(_0x2e507a){var _0x232409=_0x2e507a[_0x9a32('0x1f')],_0x1ed1c6=_0x426daf[_0x9a32('0x20')],_0x178984=_0x426daf[_0x9a32('0x20')]+_0x426daf[_0x9a32('0x21')],_0x4d1db6;if(_0x178984>=_0x232409){_0x178984=_0x232409;_0x4d1db6=0xc8;}else{_0x4d1db6=0xce;}_0x374bd2[_0x9a32('0x1d')](_0x4d1db6);return _0x374bd2['set'](_0x9a32('0x22'),_0x1ed1c6+'-'+_0x178984+'/'+_0x232409)[_0x9a32('0x23')](_0x2e507a);}return null;};}function patchUpdates(_0x181bd0){return function(_0x4c8fd8){try{jsonpatch['apply'](_0x4c8fd8,_0x181bd0,!![]);}catch(_0x20051e){return BPromise[_0x9a32('0x24')](_0x20051e);}return _0x4c8fd8[_0x9a32('0x25')]();};}function saveUpdates(_0x10f480,_0x11c179){return function(_0x1d8fa7){if(_0x1d8fa7){return _0x1d8fa7['update'](_0x10f480)[_0x9a32('0x26')](function(_0x414a4c){return _0x414a4c;});}return null;};}function removeEntity(_0x395e9e,_0x2eb287){return function(_0x532b08){if(_0x532b08){return _0x532b08['destroy']()[_0x9a32('0x26')](function(){_0x395e9e[_0x9a32('0x1d')](0xcc)[_0x9a32('0x1e')]();});}};}function handleEntityNotFound(_0x110889,_0x3eac3a){return function(_0x33ba5c){if(!_0x33ba5c){_0x110889[_0x9a32('0x1c')](0x194);}return _0x33ba5c;};}function handleError(_0xed8dc8,_0x53359c){_0x53359c=_0x53359c||0x1f4;return function(_0x312b64){logger['error'](_0x312b64[_0x9a32('0x27')]);if(_0x312b64[_0x9a32('0x28')]){delete _0x312b64[_0x9a32('0x28')];}_0xed8dc8['status'](_0x53359c)['send'](_0x312b64);};}exports[_0x9a32('0x29')]=function(_0x11aa1a,_0xeabf1f){var _0x4baa56={},_0x442ee5={},_0x14ae1e={'count':0x0,'rows':[]};var _0x350209=_[_0x9a32('0x2a')](db[_0x9a32('0x2b')]['rawAttributes'],function(_0x1955ee){return{'name':_0x1955ee[_0x9a32('0x2c')],'type':_0x1955ee[_0x9a32('0x2d')][_0x9a32('0x2e')]};});_0x442ee5['model']=_[_0x9a32('0x2a')](_0x350209,_0x9a32('0x28'));_0x442ee5['query']=_[_0x9a32('0x2f')](_0x11aa1a[_0x9a32('0x30')]);_0x442ee5[_0x9a32('0x31')]=_['intersection'](_0x442ee5['model'],_0x442ee5[_0x9a32('0x30')]);_0x4baa56[_0x9a32('0x32')]=_['intersection'](_0x442ee5[_0x9a32('0x33')],qs['fields'](_0x11aa1a[_0x9a32('0x30')][_0x9a32('0x34')]));_0x4baa56[_0x9a32('0x32')]=_0x4baa56[_0x9a32('0x32')]['length']?_0x4baa56[_0x9a32('0x32')]:_0x442ee5['model'];if(!_0x11aa1a[_0x9a32('0x30')][_0x9a32('0x35')](_0x9a32('0x36'))){_0x4baa56[_0x9a32('0x21')]=qs[_0x9a32('0x21')](_0x11aa1a['query'][_0x9a32('0x21')]);_0x4baa56[_0x9a32('0x20')]=qs[_0x9a32('0x20')](_0x11aa1a[_0x9a32('0x30')][_0x9a32('0x20')]);}_0x4baa56[_0x9a32('0x37')]=qs[_0x9a32('0x38')](_0x11aa1a['query'][_0x9a32('0x38')]);_0x4baa56[_0x9a32('0x39')]=qs[_0x9a32('0x31')](_[_0x9a32('0x3a')](_0x11aa1a[_0x9a32('0x30')],_0x442ee5[_0x9a32('0x31')]),_0x350209);if(_0x11aa1a[_0x9a32('0x30')]['filter']){_0x4baa56[_0x9a32('0x39')]=_[_0x9a32('0x3b')](_0x4baa56[_0x9a32('0x39')],{'$or':_[_0x9a32('0x2a')](_0x350209,function(_0x398bf6){if(_0x398bf6[_0x9a32('0x2d')]!=='VIRTUAL'){var _0x40049f={};_0x40049f[_0x398bf6[_0x9a32('0x28')]]={'$like':'%'+_0x11aa1a[_0x9a32('0x30')][_0x9a32('0x3c')]+'%'};return _0x40049f;}})});}_0x4baa56=_[_0x9a32('0x3b')]({},_0x4baa56,_0x11aa1a[_0x9a32('0x3d')]);var _0x2bb6ac={'where':_0x4baa56[_0x9a32('0x39')]};return db['ChatInternalMessage'][_0x9a32('0x1f')](_0x2bb6ac)[_0x9a32('0x26')](function(_0x25d6e6){_0x14ae1e[_0x9a32('0x1f')]=_0x25d6e6;if(_0x11aa1a[_0x9a32('0x30')][_0x9a32('0x3e')]){_0x4baa56['include']=[{'all':!![]}];}return db[_0x9a32('0x2b')][_0x9a32('0x3f')](_0x4baa56);})[_0x9a32('0x26')](function(_0x3f0090){_0x14ae1e['rows']=_0x3f0090;return _0x14ae1e;})[_0x9a32('0x26')](respondWithFilteredResult(_0xeabf1f,_0x4baa56))['catch'](handleError(_0xeabf1f,null));};exports[_0x9a32('0x40')]=function(_0x520e92,_0x354140){var _0x182e01={'raw':!![],'where':{'id':_0x520e92['params']['id']}},_0xf117ce={};_0xf117ce[_0x9a32('0x33')]=_[_0x9a32('0x2f')](db['ChatInternalMessage'][_0x9a32('0x41')]);_0xf117ce['query']=_['keys'](_0x520e92['query']);_0xf117ce[_0x9a32('0x31')]=_[_0x9a32('0x42')](_0xf117ce[_0x9a32('0x33')],_0xf117ce[_0x9a32('0x30')]);_0x182e01[_0x9a32('0x32')]=_[_0x9a32('0x42')](_0xf117ce[_0x9a32('0x33')],qs[_0x9a32('0x34')](_0x520e92[_0x9a32('0x30')][_0x9a32('0x34')]));_0x182e01[_0x9a32('0x32')]=_0x182e01[_0x9a32('0x32')]['length']?_0x182e01['attributes']:_0xf117ce[_0x9a32('0x33')];if(_0x520e92['query'][_0x9a32('0x3e')]){_0x182e01[_0x9a32('0x43')]=[{'all':!![]}];}_0x182e01=_['merge']({},_0x182e01,_0x520e92['options']);return db[_0x9a32('0x2b')][_0x9a32('0x44')](_0x182e01)[_0x9a32('0x26')](handleEntityNotFound(_0x354140,null))['then'](respondWithResult(_0x354140,null))[_0x9a32('0x45')](handleError(_0x354140,null));};exports[_0x9a32('0x46')]=function(_0x56da67,_0x5d7017){return db[_0x9a32('0x2b')][_0x9a32('0x46')](_0x56da67[_0x9a32('0x47')],{})[_0x9a32('0x26')](respondWithResult(_0x5d7017,0xc9))[_0x9a32('0x45')](handleError(_0x5d7017,null));};exports[_0x9a32('0x48')]=function(_0x3dc1f2,_0x3c0898){if(_0x3dc1f2['body']['id']){delete _0x3dc1f2[_0x9a32('0x47')]['id'];}return db[_0x9a32('0x2b')]['find']({'where':{'id':_0x3dc1f2['params']['id']}})[_0x9a32('0x26')](handleEntityNotFound(_0x3c0898,null))[_0x9a32('0x26')](saveUpdates(_0x3dc1f2[_0x9a32('0x47')],null))[_0x9a32('0x26')](respondWithResult(_0x3c0898,null))[_0x9a32('0x45')](handleError(_0x3c0898,null));};exports[_0x9a32('0x49')]=function(_0x2e4d73,_0x5f4c50){return db[_0x9a32('0x2b')][_0x9a32('0x44')]({'where':{'id':_0x2e4d73[_0x9a32('0x4a')]['id']}})[_0x9a32('0x26')](handleEntityNotFound(_0x5f4c50,null))[_0x9a32('0x26')](removeEntity(_0x5f4c50,null))[_0x9a32('0x45')](handleError(_0x5f4c50,null));};exports[_0x9a32('0x4b')]=function(_0x17cfd7,_0x5f3332){return db[_0x9a32('0x2b')][_0x9a32('0x4b')]()['then'](respondWithResult(_0x5f3332,null))['catch'](handleError(_0x5f3332,null));};function wrapUser(_0x3bebfb){return function(_0x4b687f){var _0x1be7d3=_0x3bebfb[_0x9a32('0x4c')]({'plain':!![]});_0x1be7d3[_0x9a32('0x4d')]=[];if(_0x4b687f){_0x1be7d3[_0x9a32('0x4e')]=_0x4b687f[_0x9a32('0x4f')];_0x1be7d3['lastMessage']=_0x4b687f;}else{_0x1be7d3['lastMessageAt']=moment(0x0)['format'](_0x9a32('0x50'));_0x1be7d3['lastMessage']={};}return _0x1be7d3;};}exports[_0x9a32('0x51')]=function(_0x369fc4,_0x3ab4ee,_0x1e3416){var _0x564240=[];return db[_0x9a32('0x52')][_0x9a32('0x3f')]({'where':{'role':['agent',_0x9a32('0x53'),_0x9a32('0x54')]},'attributes':['id',_0x9a32('0x55'),_0x9a32('0x28'),_0x9a32('0x56'),_0x9a32('0x57'),_0x9a32('0x58'),'online','lastLoginAt',_0x9a32('0x59'),'showWebBar'],'order':qs[_0x9a32('0x38')](_0x9a32('0x5a')),'include':[{'model':db[_0x9a32('0x5b')],'as':_0x9a32('0x5c'),'attributes':['id','name',_0x9a32('0x2d')],'through':{'attributes':[]}}]})[_0x9a32('0x26')](function(_0x5cba97){if(_0x5cba97){var _0x4d5550=_0x369fc4[_0x9a32('0x54')][_0x9a32('0x4c')]({'plain':!![]});if(!_0x4d5550)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d5550[_0x9a32('0x56')]==='user'){return db[_0x9a32('0x5d')][_0x9a32('0x44')]({'where':{'name':'Agents','userProfileId':_0x4d5550[_0x9a32('0x5e')]},'raw':!![]})[_0x9a32('0x26')](function(_0x343b9f){if(_0x343b9f){if(_0x343b9f[_0x9a32('0x5f')]===0x0){return db[_0x9a32('0x60')][_0x9a32('0x3f')]({'where':{'sectionId':_0x343b9f['id']},'raw':!![]})[_0x9a32('0x26')](function(_0x1c1e80){var _0x22a374=[];if(_['isEmpty'](_0x1c1e80)){_0x22a374=_['filter'](_0x5cba97,function(_0x4463a7){if(_0x4463a7[_0x9a32('0x56')]!==_0x9a32('0x61')){return _0x4463a7;}});return _0x22a374;}else{for(var _0x7e82d9=0x0;_0x7e82d9<_0x5cba97[_0x9a32('0x62')];_0x7e82d9++){var _0x26c2a1=_0x5cba97[_0x7e82d9];if(_0x26c2a1['role']===_0x9a32('0x61')){var _0x44138c=_['find'](_0x1c1e80,function(_0x4bb003){return _0x4bb003[_0x9a32('0x63')]===_0x26c2a1['id'];});if(_0x44138c)_0x22a374[_0x9a32('0x64')](_0x26c2a1);}else{_0x22a374['push'](_0x26c2a1);}}return _0x22a374;}});}else{return _0x5cba97;}}else{var _0x1025ed=_['filter'](_0x5cba97,function(_0x2f74f7){if(_0x2f74f7[_0x9a32('0x56')]!=='agent'){return _0x2f74f7;}});return _0x1025ed;}});}else{return _0x5cba97;}}})[_0x9a32('0x26')](function(_0xbe7252){var _0x460516=[];if(_0xbe7252){_0x564240=_0xbe7252;for(var _0x2be369=0x0;_0x2be369<_0xbe7252[_0x9a32('0x62')];_0x2be369+=0x1){_0x564240[_0x2be369][_0x9a32('0x4d')]=[];_0x460516[_0x9a32('0x64')](db[_0x9a32('0x2b')][_0x9a32('0x44')]({'where':{'FromId':[_0x369fc4['user']['id'],_0xbe7252[_0x2be369]['id']],'ToId':[_0x369fc4['user']['id'],_0xbe7252[_0x2be369]['id']],'ChatGroupId':null},'attributes':['id',_0x9a32('0x4f'),'FromId',_0x9a32('0x65'),_0x9a32('0x66'),_0x9a32('0x47')],'order':qs[_0x9a32('0x38')](_0x9a32('0x67')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9a32('0x26')](wrapUser(_0xbe7252[_0x2be369])));}return BPromise[_0x9a32('0x68')](_0x460516);}return[];})[_0x9a32('0x26')](function(_0x67799e){return{'rows':_0x67799e,'count':_0x67799e[_0x9a32('0x62')]};})[_0x9a32('0x26')](respondWithResult(_0x3ab4ee,null))[_0x9a32('0x45')](handleError(_0x3ab4ee,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3c4d0f4..bd55956 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 _0xf776=['exports','events','ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x23e859,_0x419ccc){var _0xe4964=function(_0x2e2501){while(--_0x2e2501){_0x23e859['push'](_0x23e859['shift']());}};_0xe4964(++_0x419ccc);}(_0xf776,0x169));var _0x6f77=function(_0x471bd9,_0x144273){_0x471bd9=_0x471bd9-0x0;var _0x265a2c=_0xf776[_0x471bd9];return _0x265a2c;};'use strict';var EventEmitter=require(_0x6f77('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x6f77('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6f77('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f77('0x3'),'afterDestroy':_0x6f77('0x4')};function emitEvent(_0x3897be){return function(_0x16874b,_0x53ec9b,_0xf025ec){ChatInternalMessageEvents['emit'](_0x3897be+':'+_0x16874b['id'],_0x16874b);ChatInternalMessageEvents[_0x6f77('0x5')](_0x3897be,_0x16874b);_0xf025ec(null);};}for(var e in events){if(events[_0x6f77('0x6')](e)){var event=events[e];ChatInternalMessage[_0x6f77('0x7')](e,emitEvent(event));}}module[_0x6f77('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xc288=['remove','emit','hasOwnProperty','events','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0xc288,0x18b));var _0x8c28=function(_0xda8e70,_0x40ed02){_0xda8e70=_0xda8e70-0x0;var _0x476a7d=_0xc288[_0xda8e70];return _0x476a7d;};'use strict';var EventEmitter=require(_0x8c28('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x8c28('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8c28('0x2')](0x0);var events={'afterCreate':_0x8c28('0x3'),'afterUpdate':_0x8c28('0x4'),'afterDestroy':_0x8c28('0x5')};function emitEvent(_0x18026e){return function(_0xd0a89b,_0x124c78,_0x334838){ChatInternalMessageEvents[_0x8c28('0x6')](_0x18026e+':'+_0xd0a89b['id'],_0xd0a89b);ChatInternalMessageEvents['emit'](_0x18026e,_0xd0a89b);_0x334838(null);};}for(var e in events){if(events[_0x8c28('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index dd23395..63b5166 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['../../config/environment','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','rimraf'];(function(_0x3fa1dd,_0x471110){var _0x1792ed=function(_0x2f65f3){while(--_0x2f65f3){_0x3fa1dd['push'](_0x3fa1dd['shift']());}};_0x1792ed(++_0x471110);}(_0xda3f,0xec));var _0xfda3=function(_0x4bd809,_0x28f004){_0x4bd809=_0x4bd809-0x0;var _0x456716=_0xda3f[_0x4bd809];return _0x456716;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./chatInternalMessage.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfda3('0x8'),'collate':_0xfda3('0x9')});}; \ No newline at end of file +var _0xd8b0=['define','chat_internal_messages','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x51c1e6,_0x5ee8ca){var _0x4f0c73=function(_0x1a9fd7){while(--_0x1a9fd7){_0x51c1e6['push'](_0x51c1e6['shift']());}};_0x4f0c73(++_0x5ee8ca);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'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 d1f3598..54cbd90 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 _0xd01a=['request\x20sent','debug','error','code','message','result','util','moment','randomstring','../../config/utils','rpc','client','defaults','redis','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s'];(function(_0x256d9a,_0x1dc479){var _0x705ca4=function(_0x237e82){while(--_0x237e82){_0x256d9a['push'](_0x256d9a['shift']());}};_0x705ca4(++_0x1dc479);}(_0xd01a,0x180));var _0xad01=function(_0x292c75,_0x2f1c7a){_0x292c75=_0x292c75-0x0;var _0x582d3e=_0xd01a[_0x292c75];return _0x582d3e;};'use strict';var _=require('lodash');var util=require(_0xad01('0x0'));var moment=require(_0xad01('0x1'));var BPromise=require('bluebird');var rs=require(_0xad01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad01('0x3'));var logger=require('../../config/logger')(_0xad01('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xad01('0x5')]['http']({'port':0x232a});config['redis']=_[_0xad01('0x6')](config[_0xad01('0x7')],{'host':_0xad01('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xad01('0x7')]));require(_0xad01('0x9'))[_0xad01('0xa')](socket);function respondWithRpcPromise(_0x4fa65d,_0x4834e9,_0x435265){return new BPromise(function(_0x341d92,_0x210313){return client[_0xad01('0xb')](_0x4fa65d,_0x435265)[_0xad01('0xc')](function(_0x464776){logger[_0xad01('0xd')](_0xad01('0xe'),_0x4834e9,_0xad01('0xf'));logger[_0xad01('0x10')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4834e9,_0xad01('0xf'),JSON['stringify'](_0x464776));if(_0x464776[_0xad01('0x11')]){if(_0x464776[_0xad01('0x11')][_0xad01('0x12')]===0x1f4){logger[_0xad01('0x11')](_0xad01('0xe'),_0x4834e9,_0x464776['error'][_0xad01('0x13')]);return _0x210313(_0x464776[_0xad01('0x11')]['message']);}logger[_0xad01('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x4834e9,_0x464776['error'][_0xad01('0x13')]);return _0x341d92(_0x464776[_0xad01('0x11')][_0xad01('0x13')]);}else{logger[_0xad01('0xd')]('ChatInternalMessage,\x20%s,\x20%s',_0x4834e9,_0xad01('0xf'));_0x341d92(_0x464776[_0xad01('0x14')][_0xad01('0x13')]);}})['catch'](function(_0x6c5688){logger['error'](_0xad01('0xe'),_0x4834e9,_0x6c5688);_0x210313(_0x6c5688);});});} \ No newline at end of file +var _0xc32c=['ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5d7123,_0x539f04){var _0x406521=function(_0x4c4257){while(--_0x4c4257){_0x5d7123['push'](_0x5d7123['shift']());}};_0x406521(++_0x539f04);}(_0xc32c,0x167));var _0xcc32=function(_0xe0e18,_0x195e61){_0xe0e18=_0xe0e18-0x0;var _0x1bd018=_0xc32c[_0xe0e18];return _0x1bd018;};'use strict';var _=require(_0xcc32('0x0'));var util=require(_0xcc32('0x1'));var moment=require(_0xcc32('0x2'));var BPromise=require(_0xcc32('0x3'));var rs=require(_0xcc32('0x4'));var fs=require('fs');var Redis=require(_0xcc32('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc32('0x6'));var config=require(_0xcc32('0x7'));var jayson=require(_0xcc32('0x8'));var client=jayson[_0xcc32('0x9')][_0xcc32('0xa')]({'port':0x232a});config[_0xcc32('0xb')]=_[_0xcc32('0xc')](config[_0xcc32('0xb')],{'host':_0xcc32('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc32('0xb')]));require(_0xcc32('0xe'))[_0xcc32('0xf')](socket);function respondWithRpcPromise(_0x3a386c,_0x2002dd,_0x55705d){return new BPromise(function(_0x46a4f3,_0x1a2685){return client[_0xcc32('0x10')](_0x3a386c,_0x55705d)[_0xcc32('0x11')](function(_0x2560a4){logger[_0xcc32('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x2002dd,_0xcc32('0x13'));logger[_0xcc32('0x14')](_0xcc32('0x15'),_0x2002dd,_0xcc32('0x13'),JSON[_0xcc32('0x16')](_0x2560a4));if(_0x2560a4['error']){if(_0x2560a4[_0xcc32('0x17')][_0xcc32('0x18')]===0x1f4){logger[_0xcc32('0x17')](_0xcc32('0x19'),_0x2002dd,_0x2560a4['error'][_0xcc32('0x1a')]);return _0x1a2685(_0x2560a4['error'][_0xcc32('0x1a')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x2002dd,_0x2560a4['error'][_0xcc32('0x1a')]);return _0x46a4f3(_0x2560a4['error'][_0xcc32('0x1a')]);}else{logger[_0xcc32('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x2002dd,_0xcc32('0x13'));_0x46a4f3(_0x2560a4['result'][_0xcc32('0x1a')]);}})[_0xcc32('0x1b')](function(_0x2a6a31){logger[_0xcc32('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x2002dd,_0x2a6a31);_0x1a2685(_0x2a6a31);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e102c48..ddf0479 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 _0xd4bd=['length','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x5d4ce7,_0x4e1373){var _0x4d91e9=function(_0x4a1224){while(--_0x4a1224){_0x5d4ce7['push'](_0x5d4ce7['shift']());}};_0x4d91e9(++_0x4e1373);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x4287e9,_0x31f01c){_0x4287e9=_0x4287e9-0x0;var _0x2f8390=_0xd4bd[_0x4287e9];return _0x2f8390;};'use strict';var ChatInternalMessageEvents=require(_0xdd4b('0x0'));var events=[_0xdd4b('0x1'),_0xdd4b('0x2'),_0xdd4b('0x3')];function createListener(_0x54b1db,_0x5f2139){return function(_0x37f821){_0x5f2139[_0xdd4b('0x4')](_0x54b1db,_0x37f821);};}function removeListener(_0x176535,_0x378465){return function(){ChatInternalMessageEvents[_0xdd4b('0x5')](_0x176535,_0x378465);};}exports['register']=function(_0x48eda4){for(var _0x1c72c7=0x0,_0x543281=events[_0xdd4b('0x6')];_0x1c72c7<_0x543281;_0x1c72c7++){var _0x173584=events[_0x1c72c7];var _0x4ac6a5=createListener('chatInternalMessage:'+_0x173584,_0x48eda4);ChatInternalMessageEvents['on'](_0x173584,_0x4ac6a5);}}; \ No newline at end of file +var _0x98d3=['./chatInternalMessage.events','save','update','emit','register','length','chatInternalMessage:'];(function(_0x26177f,_0x13a995){var _0x284dbf=function(_0x2f78c1){while(--_0x2f78c1){_0x26177f['push'](_0x26177f['shift']());}};_0x284dbf(++_0x13a995);}(_0x98d3,0x173));var _0x398d=function(_0x16e93c,_0x239cc9){_0x16e93c=_0x16e93c-0x0;var _0x113572=_0x98d3[_0x16e93c];return _0x113572;};'use strict';var ChatInternalMessageEvents=require(_0x398d('0x0'));var events=[_0x398d('0x1'),'remove',_0x398d('0x2')];function createListener(_0x4f5ff0,_0x18da44){return function(_0x48fcf0){_0x18da44[_0x398d('0x3')](_0x4f5ff0,_0x48fcf0);};}function removeListener(_0x41f57c,_0x4f7a58){return function(){ChatInternalMessageEvents['removeListener'](_0x41f57c,_0x4f7a58);};}exports[_0x398d('0x4')]=function(_0x25d38f){for(var _0x2c3c4c=0x0,_0x502652=events[_0x398d('0x5')];_0x2c3c4c<_0x502652;_0x2c3c4c++){var _0x391d99=events[_0x2c3c4c];var _0x3029f3=createListener(_0x398d('0x6')+_0x391d99,_0x25d38f);ChatInternalMessageEvents['on'](_0x391d99,_0x3029f3);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d13994d..fc1acea 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x5a9f01,_0x51c64f){var _0x45b805=function(_0x338dc4){while(--_0x338dc4){_0x5a9f01['push'](_0x5a9f01['shift']());}};_0x45b805(++_0x51c64f);}(_0x70e0,0x17b));var _0x070e=function(_0xfac7a7,_0x3290f4){_0xfac7a7=_0xfac7a7-0x0;var _0xc01b91=_0x70e0[_0xfac7a7];return _0xc01b91;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x296553,_0xca5af3){var _0x3ffb45=function(_0x3c467d){while(--_0x3c467d){_0x296553['push'](_0x296553['shift']());}};_0x3ffb45(++_0xca5af3);}(_0xb7e7,0x121));var _0x7b7e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb7e7[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7ac26ff..55c53bc 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 _0x312e=['medium','BOOLEAN','ENUM','out','DATE','exports','TEXT'];(function(_0x31f5b0,_0x3ceb60){var _0x25dfd3=function(_0x4f81da){while(--_0x4f81da){_0x31f5b0['push'](_0x31f5b0['shift']());}};_0x25dfd3(++_0x3ceb60);}(_0x312e,0x171));var _0xe312=function(_0x1d2c9b,_0x32cff5){_0x1d2c9b=_0x1d2c9b-0x0;var _0x2b6a9f=_0x312e[_0x1d2c9b];return _0x2b6a9f;};'use strict';var Sequelize=require('sequelize');module[_0xe312('0x0')]={'body':{'type':Sequelize[_0xe312('0x1')](_0xe312('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe312('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe312('0x4')]('in',_0xe312('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe312('0x6')]}}; \ No newline at end of file +var _0x8976=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x5497f8,_0x280014){var _0x218bd5=function(_0x41ddf0){while(--_0x41ddf0){_0x5497f8['push'](_0x5497f8['shift']());}};_0x218bd5(++_0x280014);}(_0x8976,0x1e0));var _0x6897=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8976[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6897('0x0'));module[_0x6897('0x1')]={'body':{'type':Sequelize[_0x6897('0x2')](_0x6897('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6897('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6897('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6897('0x5')]('in',_0x6897('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x6897('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index fd1fa80..4a45d25 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 _0xf782=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatMessage.socket','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','name','send','ChatMessage','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filters','merge','type','filter','options','count','include','findAll','rows','show','params','fields','includeAll','find','body','chat-interactions','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','ChatInteraction','isNil','get','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','formData','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','html-pdf'];(function(_0x1c3ff6,_0x5a480e){var _0x5663fe=function(_0x35ad98){while(--_0x35ad98){_0x1c3ff6['push'](_0x1c3ff6['shift']());}};_0x5663fe(++_0x5a480e);}(_0xf782,0x1e3));var _0x2f78=function(_0x26dd9a,_0x28a8e1){_0x26dd9a=_0x26dd9a-0x0;var _0x32c5f8=_0xf782[_0x26dd9a];return _0x32c5f8;};'use strict';var pdf=require(_0x2f78('0x0'));var emlformat=require(_0x2f78('0x1'));var rimraf=require(_0x2f78('0x2'));var zipdir=require(_0x2f78('0x3'));var jsonpatch=require(_0x2f78('0x4'));var rp=require(_0x2f78('0x5'));var moment=require(_0x2f78('0x6'));var BPromise=require(_0x2f78('0x7'));var Mustache=require(_0x2f78('0x8'));var util=require(_0x2f78('0x9'));var path=require(_0x2f78('0xa'));var sox=require('sox');var csv=require(_0x2f78('0xb'));var ejs=require(_0x2f78('0xc'));var fs=require('fs');var _=require(_0x2f78('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2f78('0xe'));var deskjs=require(_0x2f78('0xf'));var toCsv=require(_0x2f78('0xb'));var querystring=require(_0x2f78('0x10'));var Papa=require('papaparse');var Redis=require(_0x2f78('0x11'));var authService=require(_0x2f78('0x12'));var qs=require(_0x2f78('0x13'));var as=require(_0x2f78('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f78('0x15'))(_0x2f78('0x16'));var utils=require(_0x2f78('0x17'));var config=require(_0x2f78('0x18'));var db=require(_0x2f78('0x19'))['db'];config[_0x2f78('0x1a')]=_['defaults'](config['redis'],{'host':_0x2f78('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f78('0x1a')]));require(_0x2f78('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2f78('0x1d')][_0x2f78('0x1e')]({'port':0x232c});var client9002=jayson[_0x2f78('0x1d')][_0x2f78('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x36f07b,_0x3059b1,_0x2c42bc){if(_0x2c42bc){var _0x1da315=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1da315[_0x2f78('0x1f')](_0x3059b1)){return _0x36f07b;}else{throw new db['Sequelize']['ValidationError'](_0x2f78('0x20'));}}else{return _0x36f07b;}}function respondWithRpcPromise(_0x33506a,_0x199b98,_0x468026,_0x344e1e){return new BPromise(function(_0xe40e25,_0x395c39){var _0x32bbe9=_0x344e1e||client;return _0x32bbe9[_0x2f78('0x21')](_0x33506a,_0x468026)['then'](function(_0x1e6bf3){logger[_0x2f78('0x22')](_0x2f78('0x23'),_0x199b98,_0x2f78('0x24'));logger[_0x2f78('0x25')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x199b98,'request\x20sent',JSON[_0x2f78('0x26')](_0x1e6bf3));if(_0x1e6bf3[_0x2f78('0x27')]){if(_0x1e6bf3[_0x2f78('0x27')][_0x2f78('0x28')]===0x1f4){logger[_0x2f78('0x27')](_0x2f78('0x23'),_0x199b98,_0x1e6bf3['error'][_0x2f78('0x29')]);return _0x395c39(_0x1e6bf3[_0x2f78('0x27')][_0x2f78('0x29')]);}logger[_0x2f78('0x27')]('ChatMessage,\x20%s,\x20%s',_0x199b98,_0x1e6bf3[_0x2f78('0x27')][_0x2f78('0x29')]);return _0xe40e25(_0x1e6bf3[_0x2f78('0x27')][_0x2f78('0x29')]);}else{logger[_0x2f78('0x22')](_0x2f78('0x23'),_0x199b98,_0x2f78('0x24'));_0xe40e25(_0x1e6bf3[_0x2f78('0x2a')][_0x2f78('0x29')]);}})[_0x2f78('0x2b')](function(_0x3d0ca1){logger[_0x2f78('0x27')](_0x2f78('0x23'),_0x199b98,_0x3d0ca1);_0x395c39(_0x3d0ca1);});});}function respondWithStatusCode(_0x4ab906,_0x2f8584){_0x2f8584=_0x2f8584||0xcc;return function(_0x44e460){if(_0x44e460){return _0x4ab906[_0x2f78('0x2c')](_0x2f8584);}return _0x4ab906[_0x2f78('0x2d')](_0x2f8584)['end']();};}function respondWithResult(_0x2fe496,_0x5d3f6f){_0x5d3f6f=_0x5d3f6f||0xc8;return function(_0x2cb62e){if(_0x2cb62e){return _0x2fe496['status'](_0x5d3f6f)['json'](_0x2cb62e);}};}function respondWithFilteredResult(_0x5a1fd5,_0x45b997){return function(_0x51ffb1){if(_0x51ffb1){var _0x2185ec=_0x51ffb1['count'],_0x16cdd2=_0x45b997[_0x2f78('0x2e')],_0x327afc=_0x45b997['offset']+_0x45b997[_0x2f78('0x2f')],_0x5e2b82;if(_0x327afc>=_0x2185ec){_0x327afc=_0x2185ec;_0x5e2b82=0xc8;}else{_0x5e2b82=0xce;}_0x5a1fd5[_0x2f78('0x2d')](_0x5e2b82);return _0x5a1fd5[_0x2f78('0x30')](_0x2f78('0x31'),_0x16cdd2+'-'+_0x327afc+'/'+_0x2185ec)['json'](_0x51ffb1);}return null;};}function patchUpdates(_0x5f29d4){return function(_0x87154b){try{jsonpatch[_0x2f78('0x32')](_0x87154b,_0x5f29d4,!![]);}catch(_0x32e9c4){return BPromise[_0x2f78('0x33')](_0x32e9c4);}return _0x87154b['save']();};}function saveUpdates(_0x2de6fe,_0x5c766e){return function(_0x5d90ce){if(_0x5d90ce){return _0x5d90ce[_0x2f78('0x34')](_0x2de6fe)[_0x2f78('0x35')](function(_0x8f5f82){return _0x8f5f82;});}return null;};}function removeEntity(_0xe65e46,_0x10ac9c){return function(_0x4878a1){if(_0x4878a1){return _0x4878a1[_0x2f78('0x36')]()['then'](function(){_0xe65e46[_0x2f78('0x2d')](0xcc)[_0x2f78('0x37')]();});}};}function handleEntityNotFound(_0x16a572,_0x3c2250){return function(_0x37056e){if(!_0x37056e){_0x16a572[_0x2f78('0x2c')](0x194);}return _0x37056e;};}function handleError(_0xb48a4e,_0x42d04a){_0x42d04a=_0x42d04a||0x1f4;return function(_0x55e822){logger[_0x2f78('0x27')](_0x55e822['stack']);if(_0x55e822[_0x2f78('0x38')]){delete _0x55e822[_0x2f78('0x38')];}_0xb48a4e[_0x2f78('0x2d')](_0x42d04a)[_0x2f78('0x39')](_0x55e822);};}exports['index']=function(_0x69675,_0x37d007){var _0x2437b7={},_0x5ad207={},_0x173d01={'count':0x0,'rows':[]};var _0x3a2836=_['map'](db[_0x2f78('0x3a')][_0x2f78('0x3b')],function(_0x2ebcf6){return{'name':_0x2ebcf6[_0x2f78('0x3c')],'type':_0x2ebcf6['type'][_0x2f78('0x3d')]};});_0x5ad207[_0x2f78('0x3e')]=_[_0x2f78('0x3f')](_0x3a2836,_0x2f78('0x38'));_0x5ad207['query']=_[_0x2f78('0x40')](_0x69675[_0x2f78('0x41')]);_0x5ad207['filters']=_['intersection'](_0x5ad207[_0x2f78('0x3e')],_0x5ad207[_0x2f78('0x41')]);_0x2437b7['attributes']=_[_0x2f78('0x42')](_0x5ad207[_0x2f78('0x3e')],qs['fields'](_0x69675['query']['fields']));_0x2437b7['attributes']=_0x2437b7[_0x2f78('0x43')][_0x2f78('0x44')]?_0x2437b7['attributes']:_0x5ad207[_0x2f78('0x3e')];if(!_0x69675[_0x2f78('0x41')][_0x2f78('0x45')]('nolimit')){_0x2437b7[_0x2f78('0x2f')]=qs[_0x2f78('0x2f')](_0x69675['query'][_0x2f78('0x2f')]);_0x2437b7[_0x2f78('0x2e')]=qs[_0x2f78('0x2e')](_0x69675[_0x2f78('0x41')][_0x2f78('0x2e')]);}_0x2437b7[_0x2f78('0x46')]=qs['sort'](_0x69675[_0x2f78('0x41')][_0x2f78('0x47')]);_0x2437b7[_0x2f78('0x48')]=qs['filters'](_[_0x2f78('0x49')](_0x69675[_0x2f78('0x41')],_0x5ad207[_0x2f78('0x4a')]),_0x3a2836);if(_0x69675['query']['filter']){_0x2437b7[_0x2f78('0x48')]=_[_0x2f78('0x4b')](_0x2437b7[_0x2f78('0x48')],{'$or':_[_0x2f78('0x3f')](_0x3a2836,function(_0x57f1c8){if(_0x57f1c8[_0x2f78('0x4c')]!=='VIRTUAL'){var _0x514257={};_0x514257[_0x57f1c8[_0x2f78('0x38')]]={'$like':'%'+_0x69675[_0x2f78('0x41')][_0x2f78('0x4d')]+'%'};return _0x514257;}})});}_0x2437b7=_['merge']({},_0x2437b7,_0x69675[_0x2f78('0x4e')]);var _0x1e2e50={'where':_0x2437b7['where']};return db[_0x2f78('0x3a')][_0x2f78('0x4f')](_0x1e2e50)[_0x2f78('0x35')](function(_0x127e8c){_0x173d01[_0x2f78('0x4f')]=_0x127e8c;if(_0x69675['query']['includeAll']){_0x2437b7[_0x2f78('0x50')]=[{'all':!![]}];}return db[_0x2f78('0x3a')][_0x2f78('0x51')](_0x2437b7);})[_0x2f78('0x35')](function(_0x3e90c9){_0x173d01[_0x2f78('0x52')]=_0x3e90c9;return _0x173d01;})['then'](respondWithFilteredResult(_0x37d007,_0x2437b7))[_0x2f78('0x2b')](handleError(_0x37d007,null));};exports[_0x2f78('0x53')]=function(_0x3c0b06,_0x3f97ba){var _0x1a1f24={'raw':!![],'where':{'id':_0x3c0b06[_0x2f78('0x54')]['id']}},_0x2dd351={};_0x2dd351[_0x2f78('0x3e')]=_[_0x2f78('0x40')](db[_0x2f78('0x3a')][_0x2f78('0x3b')]);_0x2dd351[_0x2f78('0x41')]=_['keys'](_0x3c0b06[_0x2f78('0x41')]);_0x2dd351[_0x2f78('0x4a')]=_[_0x2f78('0x42')](_0x2dd351[_0x2f78('0x3e')],_0x2dd351[_0x2f78('0x41')]);_0x1a1f24['attributes']=_[_0x2f78('0x42')](_0x2dd351['model'],qs[_0x2f78('0x55')](_0x3c0b06[_0x2f78('0x41')]['fields']));_0x1a1f24[_0x2f78('0x43')]=_0x1a1f24['attributes'][_0x2f78('0x44')]?_0x1a1f24['attributes']:_0x2dd351[_0x2f78('0x3e')];if(_0x3c0b06[_0x2f78('0x41')][_0x2f78('0x56')]){_0x1a1f24['include']=[{'all':!![]}];}_0x1a1f24=_[_0x2f78('0x4b')]({},_0x1a1f24,_0x3c0b06[_0x2f78('0x4e')]);return db[_0x2f78('0x3a')][_0x2f78('0x57')](_0x1a1f24)[_0x2f78('0x35')](handleEntityNotFound(_0x3f97ba,null))[_0x2f78('0x35')](respondWithResult(_0x3f97ba,null))[_0x2f78('0x2b')](handleError(_0x3f97ba,null));};exports['create']=function(_0x3658cb,_0x189ef1){return db[_0x2f78('0x3a')]['create'](_0x3658cb['body'],{})['then'](respondWithResult(_0x189ef1,0xc9))[_0x2f78('0x2b')](handleError(_0x189ef1,null));};exports[_0x2f78('0x34')]=function(_0x69ef77,_0x3baa8f){if(_0x69ef77['body']['id']){delete _0x69ef77['body']['id'];}return db['ChatMessage'][_0x2f78('0x57')]({'where':{'id':_0x69ef77[_0x2f78('0x54')]['id']}})[_0x2f78('0x35')](handleEntityNotFound(_0x3baa8f,null))[_0x2f78('0x35')](saveUpdates(_0x69ef77[_0x2f78('0x58')],null))[_0x2f78('0x35')](respondWithResult(_0x3baa8f,null))['catch'](handleError(_0x3baa8f,null));};exports['destroy']=function(_0x4fcaf5,_0x150578){return db['ChatMessage'][_0x2f78('0x57')]({'where':{'id':_0x4fcaf5['params']['id']}})[_0x2f78('0x35')](handleEntityNotFound(_0x150578,null))['then'](removeEntity(_0x150578,null))[_0x2f78('0x2b')](handleError(_0x150578,null));};exports['describe']=function(_0x150e59,_0x16c642){return db[_0x2f78('0x3a')]['describe']()[_0x2f78('0x35')](respondWithResult(_0x16c642,null))[_0x2f78('0x2b')](handleError(_0x16c642,null));};var interaction_log=require(_0x2f78('0x15'))(_0x2f78('0x59'));exports['accept']=function(_0xe1f2d5,_0x50e763,_0x234302){var _0x235b66={'channel':'chat'};if(_0xe1f2d5[_0x2f78('0x58')]['id']){delete _0xe1f2d5['body']['id'];}_0xe1f2d5[_0x2f78('0x58')][_0x2f78('0x5a')]=!![];_0xe1f2d5[_0x2f78('0x58')]['readAt']=moment()[_0x2f78('0x5b')](_0x2f78('0x5c'));_0xe1f2d5[_0x2f78('0x58')][_0x2f78('0x5d')]=_0xe1f2d5[_0x2f78('0x58')][_0x2f78('0x5d')]||_0xe1f2d5[_0x2f78('0x5e')]['id'];return db[_0x2f78('0x3a')][_0x2f78('0x57')]({'where':{'id':_0xe1f2d5[_0x2f78('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x2f78('0x5f')],'as':_0x2f78('0x60')}]})[_0x2f78('0x35')](handleEntityNotFound(_0x50e763,null))[_0x2f78('0x35')](saveUpdates(_0xe1f2d5['body'],null))[_0x2f78('0x35')](function(_0x13876b){if(_0x13876b){_0x235b66['message']=_0x13876b['get']({'plain':!![]});return db[_0x2f78('0x61')]['find']({'where':{'id':_0x13876b['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x50e763,null))[_0x2f78('0x35')](function(_0x2153cb){if(_0x2153cb){return _0x2153cb[_0x2f78('0x34')]({'UserId':_0xe1f2d5[_0x2f78('0x58')][_0x2f78('0x5d')],'read1stAt':_[_0x2f78('0x62')](_0x2153cb['read1stAt'])?moment()[_0x2f78('0x5b')](_0x2f78('0x5c')):undefined});}return null;})[_0x2f78('0x35')](function(_0x10e530){if(_0x10e530){_0x235b66['interaction']=_0x10e530[_0x2f78('0x63')]({'plain':!![]});interaction_log[_0x2f78('0x22')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe1f2d5[_0x2f78('0x5e')]['id'],_0xe1f2d5[_0x2f78('0x5e')]['name'],_0xe1f2d5[_0x2f78('0x5e')]['role'],_0x235b66[_0x2f78('0x64')]['id'],_0xe1f2d5['body']?JSON[_0x2f78('0x26')](_0xe1f2d5[_0x2f78('0x58')]):_0x2f78('0x65'));return respondWithRpcPromise(_0x2f78('0x66'),_0x2f78('0x67'),_0x235b66);}return null;})[_0x2f78('0x35')](function(_0x4d11bd){if(_0x4d11bd){if(_0xe1f2d5['body'][_0x2f78('0x68')]){_0x235b66[_0x2f78('0x29')][_0x2f78('0x69')]=util['format'](_0x2f78('0x6a'),_0xe1f2d5[_0x2f78('0x5e')][_0x2f78('0x38')]);_0x235b66['message']['channel']=_0x235b66[_0x2f78('0x6b')];_0x235b66[_0x2f78('0x29')][_0x2f78('0x6c')]=_0x2f78('0x6d');return respondWithRpcPromise(_0x2f78('0x6e'),_0x2f78('0x6e'),{'event':_0x2f78('0x6f'),'message':_[_0x2f78('0x4b')](_0x235b66[_0x2f78('0x29')],JSON[_0x2f78('0x70')](_0x235b66[_0x2f78('0x64')][_0x2f78('0x71')]))},client9002)[_0x2f78('0x35')](function(){return _0x235b66;});}return _0x235b66;}return null;})['then'](respondWithResult(_0x50e763,null))[_0x2f78('0x2b')](handleError(_0x50e763,null));};var interaction_log=require('../../config/logger')(_0x2f78('0x59'));exports[_0x2f78('0x33')]=function(_0x269e8b,_0x297287,_0x442cf0){var _0x150488={'agent':{},'channel':'chat'};if(_0x269e8b['body']['id']){delete _0x269e8b[_0x2f78('0x58')]['id'];}_0x269e8b[_0x2f78('0x58')][_0x2f78('0x5d')]=_0x269e8b[_0x2f78('0x58')][_0x2f78('0x5d')]||_0x269e8b['user']['id'];_0x150488[_0x2f78('0x72')]['id']=_0x269e8b[_0x2f78('0x58')][_0x2f78('0x5d')];return db[_0x2f78('0x3a')][_0x2f78('0x57')]({'where':{'id':_0x269e8b[_0x2f78('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x297287,null))[_0x2f78('0x35')](function(_0x2c1975){if(_0x2c1975){_0x150488[_0x2f78('0x29')]=_0x2c1975[_0x2f78('0x63')]({'plain':!![]});return db[_0x2f78('0x61')][_0x2f78('0x57')]({'where':{'id':_0x2c1975[_0x2f78('0x73')]}});}return null;})[_0x2f78('0x35')](handleEntityNotFound(_0x297287,null))[_0x2f78('0x35')](function(_0x55dce2){if(_0x55dce2){_0x150488['interaction']=_0x55dce2[_0x2f78('0x63')]({'plain':!![]});interaction_log['info'](_0x2f78('0x74'),_0x269e8b['user']['id'],_0x269e8b['user'][_0x2f78('0x38')],_0x269e8b[_0x2f78('0x5e')][_0x2f78('0x75')],_0x150488[_0x2f78('0x64')]['id'],_0x269e8b[_0x2f78('0x58')]?JSON['stringify'](_0x269e8b[_0x2f78('0x58')]):_0x2f78('0x65'));return respondWithRpcPromise(_0x2f78('0x76'),_0x2f78('0x77'),_0x150488);}return null;})[_0x2f78('0x35')](function(_0x32f77b){if(_0x32f77b){_0x32f77b['message']['interface']=util[_0x2f78('0x5b')]('SIP/%s',_0x269e8b['user'][_0x2f78('0x38')]);_0x32f77b['message'][_0x2f78('0x6b')]=_0x150488['channel'];_0x32f77b[_0x2f78('0x29')]['event']=_0x2f78('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0x2f78('0x78'),'message':_0x32f77b[_0x2f78('0x29')]},client9002);return _0x150488;}return null;})[_0x2f78('0x35')](respondWithResult(_0x297287,null))[_0x2f78('0x2b')](handleError(_0x297287,null));}; \ No newline at end of file +var _0xfd2a=['api','../../config/utils','../../config/environment','redis','defaults','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','request\x20sent','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','reject','save','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','show','params','intersection','includeAll','find','create','update','body','destroy','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','accept','EventManager','acceptmessage','parse','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2d01b2,_0x2aee8f){var _0x1504cc=function(_0x5b49c5){while(--_0x5b49c5){_0x2d01b2['push'](_0x2d01b2['shift']());}};_0x1504cc(++_0x2aee8f);}(_0xfd2a,0x15c));var _0xafd2=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xfd2a[_0x2064e5];return _0x21a233;};'use strict';var pdf=require(_0xafd2('0x0'));var emlformat=require(_0xafd2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xafd2('0x2'));var jsonpatch=require(_0xafd2('0x3'));var rp=require(_0xafd2('0x4'));var moment=require(_0xafd2('0x5'));var BPromise=require(_0xafd2('0x6'));var Mustache=require(_0xafd2('0x7'));var util=require(_0xafd2('0x8'));var path=require(_0xafd2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xafd2('0xa'));var fs=require('fs');var _=require(_0xafd2('0xb'));var squel=require('squel');var crypto=require(_0xafd2('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xafd2('0xd'));var querystring=require(_0xafd2('0xe'));var Papa=require(_0xafd2('0xf'));var Redis=require(_0xafd2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xafd2('0x11'));var as=require(_0xafd2('0x12'));var hardwareService=require(_0xafd2('0x13'));var logger=require(_0xafd2('0x14'))(_0xafd2('0x15'));var utils=require(_0xafd2('0x16'));var config=require(_0xafd2('0x17'));var db=require('../../mysqldb')['db'];config[_0xafd2('0x18')]=_[_0xafd2('0x19')](config[_0xafd2('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xafd2('0x18')]));require('./chatMessage.socket')[_0xafd2('0x1a')](socket);var jayson=require(_0xafd2('0x1b'));var client=jayson[_0xafd2('0x1c')][_0xafd2('0x1d')]({'port':0x232c});var client9002=jayson[_0xafd2('0x1c')][_0xafd2('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x539d8f,_0x5b2e93,_0x654910){if(_0x654910){var _0x172f20=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x172f20[_0xafd2('0x1e')](_0x5b2e93)){return _0x539d8f;}else{throw new db[(_0xafd2('0x1f'))][(_0xafd2('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x539d8f;}}function respondWithRpcPromise(_0x4127bb,_0x5b4fb0,_0x4cd393,_0xb262f3){return new BPromise(function(_0x139d75,_0x4daadb){var _0x2d0b7e=_0xb262f3||client;return _0x2d0b7e[_0xafd2('0x21')](_0x4127bb,_0x4cd393)[_0xafd2('0x22')](function(_0x277c7f){logger['info']('ChatMessage,\x20%s,\x20%s',_0x5b4fb0,_0xafd2('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5b4fb0,_0xafd2('0x23'),JSON[_0xafd2('0x24')](_0x277c7f));if(_0x277c7f[_0xafd2('0x25')]){if(_0x277c7f[_0xafd2('0x25')]['code']===0x1f4){logger[_0xafd2('0x25')](_0xafd2('0x26'),_0x5b4fb0,_0x277c7f['error'][_0xafd2('0x27')]);return _0x4daadb(_0x277c7f[_0xafd2('0x25')][_0xafd2('0x27')]);}logger[_0xafd2('0x25')]('ChatMessage,\x20%s,\x20%s',_0x5b4fb0,_0x277c7f[_0xafd2('0x25')][_0xafd2('0x27')]);return _0x139d75(_0x277c7f[_0xafd2('0x25')][_0xafd2('0x27')]);}else{logger[_0xafd2('0x28')]('ChatMessage,\x20%s,\x20%s',_0x5b4fb0,'request\x20sent');_0x139d75(_0x277c7f['result']['message']);}})[_0xafd2('0x29')](function(_0x20c140){logger['error'](_0xafd2('0x26'),_0x5b4fb0,_0x20c140);_0x4daadb(_0x20c140);});});}function respondWithStatusCode(_0x2b3330,_0x5a10b9){_0x5a10b9=_0x5a10b9||0xcc;return function(_0x4909ce){if(_0x4909ce){return _0x2b3330[_0xafd2('0x2a')](_0x5a10b9);}return _0x2b3330[_0xafd2('0x2b')](_0x5a10b9)[_0xafd2('0x2c')]();};}function respondWithResult(_0x531670,_0x24b02c){_0x24b02c=_0x24b02c||0xc8;return function(_0x14df52){if(_0x14df52){return _0x531670[_0xafd2('0x2b')](_0x24b02c)[_0xafd2('0x2d')](_0x14df52);}};}function respondWithFilteredResult(_0x3f4c9b,_0x7dd9a){return function(_0x20517a){if(_0x20517a){var _0x4b6fdc=_0x20517a[_0xafd2('0x2e')],_0x50582f=_0x7dd9a[_0xafd2('0x2f')],_0x1e3a7e=_0x7dd9a[_0xafd2('0x2f')]+_0x7dd9a[_0xafd2('0x30')],_0x2d4ae6;if(_0x1e3a7e>=_0x4b6fdc){_0x1e3a7e=_0x4b6fdc;_0x2d4ae6=0xc8;}else{_0x2d4ae6=0xce;}_0x3f4c9b[_0xafd2('0x2b')](_0x2d4ae6);return _0x3f4c9b[_0xafd2('0x31')]('Content-Range',_0x50582f+'-'+_0x1e3a7e+'/'+_0x4b6fdc)[_0xafd2('0x2d')](_0x20517a);}return null;};}function patchUpdates(_0x2f6951){return function(_0xe90a3){try{jsonpatch['apply'](_0xe90a3,_0x2f6951,!![]);}catch(_0x30efbf){return BPromise[_0xafd2('0x32')](_0x30efbf);}return _0xe90a3[_0xafd2('0x33')]();};}function saveUpdates(_0x4c1394,_0x28789d){return function(_0x27aea6){if(_0x27aea6){return _0x27aea6['update'](_0x4c1394)[_0xafd2('0x22')](function(_0x1af802){return _0x1af802;});}return null;};}function removeEntity(_0x4aae39,_0x3f4d82){return function(_0xfcc9e8){if(_0xfcc9e8){return _0xfcc9e8['destroy']()[_0xafd2('0x22')](function(){_0x4aae39['status'](0xcc)[_0xafd2('0x2c')]();});}};}function handleEntityNotFound(_0xb25cbb,_0x737ac9){return function(_0x578c24){if(!_0x578c24){_0xb25cbb[_0xafd2('0x2a')](0x194);}return _0x578c24;};}function handleError(_0x10552f,_0x1d195b){_0x1d195b=_0x1d195b||0x1f4;return function(_0x3e002c){logger[_0xafd2('0x25')](_0x3e002c['stack']);if(_0x3e002c[_0xafd2('0x34')]){delete _0x3e002c[_0xafd2('0x34')];}_0x10552f[_0xafd2('0x2b')](_0x1d195b)[_0xafd2('0x35')](_0x3e002c);};}exports[_0xafd2('0x36')]=function(_0x4539a0,_0x570626){var _0x23f0dd={},_0x5ada3b={},_0x304cb1={'count':0x0,'rows':[]};var _0x2dafc3=_[_0xafd2('0x37')](db[_0xafd2('0x38')][_0xafd2('0x39')],function(_0x2f25b4){return{'name':_0x2f25b4['fieldName'],'type':_0x2f25b4[_0xafd2('0x3a')][_0xafd2('0x3b')]};});_0x5ada3b[_0xafd2('0x3c')]=_['map'](_0x2dafc3,'name');_0x5ada3b[_0xafd2('0x3d')]=_[_0xafd2('0x3e')](_0x4539a0['query']);_0x5ada3b[_0xafd2('0x3f')]=_['intersection'](_0x5ada3b['model'],_0x5ada3b[_0xafd2('0x3d')]);_0x23f0dd[_0xafd2('0x40')]=_['intersection'](_0x5ada3b[_0xafd2('0x3c')],qs['fields'](_0x4539a0[_0xafd2('0x3d')][_0xafd2('0x41')]));_0x23f0dd['attributes']=_0x23f0dd[_0xafd2('0x40')][_0xafd2('0x42')]?_0x23f0dd[_0xafd2('0x40')]:_0x5ada3b[_0xafd2('0x3c')];if(!_0x4539a0['query'][_0xafd2('0x43')](_0xafd2('0x44'))){_0x23f0dd[_0xafd2('0x30')]=qs[_0xafd2('0x30')](_0x4539a0[_0xafd2('0x3d')]['limit']);_0x23f0dd[_0xafd2('0x2f')]=qs['offset'](_0x4539a0[_0xafd2('0x3d')][_0xafd2('0x2f')]);}_0x23f0dd[_0xafd2('0x45')]=qs[_0xafd2('0x46')](_0x4539a0[_0xafd2('0x3d')][_0xafd2('0x46')]);_0x23f0dd['where']=qs[_0xafd2('0x3f')](_[_0xafd2('0x47')](_0x4539a0[_0xafd2('0x3d')],_0x5ada3b[_0xafd2('0x3f')]),_0x2dafc3);if(_0x4539a0['query'][_0xafd2('0x48')]){_0x23f0dd['where']=_[_0xafd2('0x49')](_0x23f0dd[_0xafd2('0x4a')],{'$or':_['map'](_0x2dafc3,function(_0x5c7513){if(_0x5c7513[_0xafd2('0x3a')]!==_0xafd2('0x4b')){var _0x35afd4={};_0x35afd4[_0x5c7513['name']]={'$like':'%'+_0x4539a0[_0xafd2('0x3d')][_0xafd2('0x48')]+'%'};return _0x35afd4;}})});}_0x23f0dd=_[_0xafd2('0x49')]({},_0x23f0dd,_0x4539a0[_0xafd2('0x4c')]);var _0x43b937={'where':_0x23f0dd[_0xafd2('0x4a')]};return db[_0xafd2('0x38')][_0xafd2('0x2e')](_0x43b937)[_0xafd2('0x22')](function(_0xbeb19a){_0x304cb1[_0xafd2('0x2e')]=_0xbeb19a;if(_0x4539a0[_0xafd2('0x3d')]['includeAll']){_0x23f0dd[_0xafd2('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0xafd2('0x4e')](_0x23f0dd);})[_0xafd2('0x22')](function(_0x5724e1){_0x304cb1[_0xafd2('0x4f')]=_0x5724e1;return _0x304cb1;})[_0xafd2('0x22')](respondWithFilteredResult(_0x570626,_0x23f0dd))[_0xafd2('0x29')](handleError(_0x570626,null));};exports[_0xafd2('0x50')]=function(_0x3c0fd2,_0x15b673){var _0xf845f3={'raw':!![],'where':{'id':_0x3c0fd2[_0xafd2('0x51')]['id']}},_0x6057f8={};_0x6057f8[_0xafd2('0x3c')]=_[_0xafd2('0x3e')](db[_0xafd2('0x38')][_0xafd2('0x39')]);_0x6057f8[_0xafd2('0x3d')]=_[_0xafd2('0x3e')](_0x3c0fd2['query']);_0x6057f8[_0xafd2('0x3f')]=_[_0xafd2('0x52')](_0x6057f8[_0xafd2('0x3c')],_0x6057f8[_0xafd2('0x3d')]);_0xf845f3['attributes']=_['intersection'](_0x6057f8[_0xafd2('0x3c')],qs['fields'](_0x3c0fd2['query'][_0xafd2('0x41')]));_0xf845f3[_0xafd2('0x40')]=_0xf845f3[_0xafd2('0x40')][_0xafd2('0x42')]?_0xf845f3[_0xafd2('0x40')]:_0x6057f8['model'];if(_0x3c0fd2[_0xafd2('0x3d')][_0xafd2('0x53')]){_0xf845f3[_0xafd2('0x4d')]=[{'all':!![]}];}_0xf845f3=_['merge']({},_0xf845f3,_0x3c0fd2[_0xafd2('0x4c')]);return db[_0xafd2('0x38')][_0xafd2('0x54')](_0xf845f3)[_0xafd2('0x22')](handleEntityNotFound(_0x15b673,null))[_0xafd2('0x22')](respondWithResult(_0x15b673,null))[_0xafd2('0x29')](handleError(_0x15b673,null));};exports[_0xafd2('0x55')]=function(_0x373bac,_0x1d3448){return db['ChatMessage'][_0xafd2('0x55')](_0x373bac['body'],{})[_0xafd2('0x22')](respondWithResult(_0x1d3448,0xc9))[_0xafd2('0x29')](handleError(_0x1d3448,null));};exports[_0xafd2('0x56')]=function(_0x23e566,_0x10763c){if(_0x23e566[_0xafd2('0x57')]['id']){delete _0x23e566[_0xafd2('0x57')]['id'];}return db['ChatMessage'][_0xafd2('0x54')]({'where':{'id':_0x23e566[_0xafd2('0x51')]['id']}})[_0xafd2('0x22')](handleEntityNotFound(_0x10763c,null))['then'](saveUpdates(_0x23e566['body'],null))['then'](respondWithResult(_0x10763c,null))['catch'](handleError(_0x10763c,null));};exports[_0xafd2('0x58')]=function(_0x3cc047,_0x48ffc5){return db['ChatMessage'][_0xafd2('0x54')]({'where':{'id':_0x3cc047[_0xafd2('0x51')]['id']}})[_0xafd2('0x22')](handleEntityNotFound(_0x48ffc5,null))[_0xafd2('0x22')](removeEntity(_0x48ffc5,null))[_0xafd2('0x29')](handleError(_0x48ffc5,null));};exports[_0xafd2('0x59')]=function(_0x29555d,_0x486afb){return db[_0xafd2('0x38')][_0xafd2('0x59')]()[_0xafd2('0x22')](respondWithResult(_0x486afb,null))['catch'](handleError(_0x486afb,null));};var interaction_log=require(_0xafd2('0x14'))(_0xafd2('0x5a'));exports['accept']=function(_0x5a8d62,_0x3c3a41,_0xa02951){var _0x1cf025={'channel':_0xafd2('0x5b')};if(_0x5a8d62[_0xafd2('0x57')]['id']){delete _0x5a8d62[_0xafd2('0x57')]['id'];}_0x5a8d62[_0xafd2('0x57')][_0xafd2('0x5c')]=!![];_0x5a8d62[_0xafd2('0x57')][_0xafd2('0x5d')]=moment()[_0xafd2('0x5e')](_0xafd2('0x5f'));_0x5a8d62[_0xafd2('0x57')][_0xafd2('0x60')]=_0x5a8d62[_0xafd2('0x57')][_0xafd2('0x60')]||_0x5a8d62[_0xafd2('0x61')]['id'];return db[_0xafd2('0x38')]['find']({'where':{'id':_0x5a8d62[_0xafd2('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3c3a41,null))['then'](saveUpdates(_0x5a8d62[_0xafd2('0x57')],null))[_0xafd2('0x22')](function(_0x54d0e8){if(_0x54d0e8){_0x1cf025[_0xafd2('0x27')]=_0x54d0e8['get']({'plain':!![]});return db[_0xafd2('0x62')][_0xafd2('0x54')]({'where':{'id':_0x54d0e8[_0xafd2('0x63')]}});}return null;})[_0xafd2('0x22')](handleEntityNotFound(_0x3c3a41,null))[_0xafd2('0x22')](function(_0x29b6af){if(_0x29b6af){return _0x29b6af[_0xafd2('0x56')]({'UserId':_0x5a8d62[_0xafd2('0x57')][_0xafd2('0x60')],'read1stAt':_[_0xafd2('0x64')](_0x29b6af[_0xafd2('0x65')])?moment()[_0xafd2('0x5e')](_0xafd2('0x5f')):undefined});}return null;})[_0xafd2('0x22')](function(_0x4dd1c1){if(_0x4dd1c1){_0x1cf025[_0xafd2('0x66')]=_0x4dd1c1[_0xafd2('0x67')]({'plain':!![]});interaction_log[_0xafd2('0x28')](_0xafd2('0x68'),_0x5a8d62[_0xafd2('0x61')]['id'],_0x5a8d62['user'][_0xafd2('0x34')],_0x5a8d62[_0xafd2('0x61')][_0xafd2('0x69')],_0x1cf025[_0xafd2('0x66')]['id'],_0x5a8d62[_0xafd2('0x57')]?JSON[_0xafd2('0x24')](_0x5a8d62[_0xafd2('0x57')]):_0xafd2('0x6a'));return respondWithRpcPromise(_0xafd2('0x6b'),_0xafd2('0x6c'),_0x1cf025);}return null;})[_0xafd2('0x22')](function(_0x4da102){if(_0x4da102){if(_0x5a8d62[_0xafd2('0x57')][_0xafd2('0x6d')]){_0x1cf025[_0xafd2('0x27')][_0xafd2('0x6e')]=util['format'](_0xafd2('0x6f'),_0x5a8d62[_0xafd2('0x61')][_0xafd2('0x34')]);_0x1cf025[_0xafd2('0x27')]['channel']=_0x1cf025['channel'];_0x1cf025[_0xafd2('0x27')][_0xafd2('0x70')]=_0xafd2('0x71');return respondWithRpcPromise(_0xafd2('0x72'),'EventManager',{'event':_0xafd2('0x73'),'message':_[_0xafd2('0x49')](_0x1cf025[_0xafd2('0x27')],JSON[_0xafd2('0x74')](_0x1cf025[_0xafd2('0x66')]['formData']))},client9002)[_0xafd2('0x22')](function(){return _0x1cf025;});}return _0x1cf025;}return null;})[_0xafd2('0x22')](respondWithResult(_0x3c3a41,null))[_0xafd2('0x29')](handleError(_0x3c3a41,null));};var interaction_log=require(_0xafd2('0x14'))('chat-interactions');exports[_0xafd2('0x32')]=function(_0xc98552,_0x50f5e9,_0x1b819b){var _0x194a37={'agent':{},'channel':_0xafd2('0x5b')};if(_0xc98552[_0xafd2('0x57')]['id']){delete _0xc98552[_0xafd2('0x57')]['id'];}_0xc98552[_0xafd2('0x57')][_0xafd2('0x60')]=_0xc98552[_0xafd2('0x57')]['UserId']||_0xc98552[_0xafd2('0x61')]['id'];_0x194a37[_0xafd2('0x75')]['id']=_0xc98552['body'][_0xafd2('0x60')];return db[_0xafd2('0x38')]['find']({'where':{'id':_0xc98552[_0xafd2('0x51')]['id'],'UserId':null}})[_0xafd2('0x22')](handleEntityNotFound(_0x50f5e9,null))['then'](function(_0x209779){if(_0x209779){_0x194a37[_0xafd2('0x27')]=_0x209779[_0xafd2('0x67')]({'plain':!![]});return db['ChatInteraction'][_0xafd2('0x54')]({'where':{'id':_0x209779[_0xafd2('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x50f5e9,null))[_0xafd2('0x22')](function(_0x5e9292){if(_0x5e9292){_0x194a37['interaction']=_0x5e9292[_0xafd2('0x67')]({'plain':!![]});interaction_log['info'](_0xafd2('0x76'),_0xc98552[_0xafd2('0x61')]['id'],_0xc98552['user']['name'],_0xc98552[_0xafd2('0x61')]['role'],_0x194a37['interaction']['id'],_0xc98552['body']?JSON['stringify'](_0xc98552['body']):_0xafd2('0x6a'));return respondWithRpcPromise(_0xafd2('0x77'),_0xafd2('0x78'),_0x194a37);}return null;})[_0xafd2('0x22')](function(_0x16d1ba){if(_0x16d1ba){_0x16d1ba[_0xafd2('0x27')][_0xafd2('0x6e')]=util[_0xafd2('0x5e')](_0xafd2('0x6f'),_0xc98552['user'][_0xafd2('0x34')]);_0x16d1ba[_0xafd2('0x27')][_0xafd2('0x79')]=_0x194a37[_0xafd2('0x79')];_0x16d1ba[_0xafd2('0x27')][_0xafd2('0x70')]='reject';respondWithRpcPromise(_0xafd2('0x72'),'EventManager',{'event':_0xafd2('0x7a'),'message':_0x16d1ba['message']},client9002);return _0x194a37;}return null;})[_0xafd2('0x22')](respondWithResult(_0x50f5e9,null))['catch'](handleError(_0x50f5e9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0fa7e64..d351e9f 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 _0xd37f=['events','save','update','remove','hook','exports'];(function(_0x3bc95a,_0x5c93d5){var _0x5c4bd3=function(_0x29acab){while(--_0x29acab){_0x3bc95a['push'](_0x3bc95a['shift']());}};_0x5c4bd3(++_0x5c93d5);}(_0xd37f,0xfc));var _0xfd37=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xd37f[_0x37bd26];return _0xe83dc4;};'use strict';var EventEmitter=require(_0xfd37('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd37('0x1'),'afterUpdate':_0xfd37('0x2'),'afterDestroy':_0xfd37('0x3')};function emitEvent(_0x3f3819){return function(_0x5dae98,_0x16f1e3,_0x8c515d){ChatMessageEvents['emit'](_0x3f3819+':'+_0x5dae98['id'],_0x5dae98);ChatMessageEvents['emit'](_0x3f3819,_0x5dae98);_0x8c515d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xfd37('0x4')](e,emitEvent(event));}}module[_0xfd37('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x5638=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2af036,_0x513c90){var _0x1cc2fa=function(_0x36e0a8){while(--_0x36e0a8){_0x2af036['push'](_0x2af036['shift']());}};_0x1cc2fa(++_0x513c90);}(_0x5638,0x9f));var _0x8563=function(_0x3209b5,_0x1ec291){_0x3209b5=_0x3209b5-0x0;var _0x424f61=_0x5638[_0x3209b5];return _0x424f61;};'use strict';var EventEmitter=require(_0x8563('0x0'));var ChatMessage=require(_0x8563('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8563('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8563('0x3'),'afterDestroy':_0x8563('0x4')};function emitEvent(_0x12a896){return function(_0x1b7850,_0x1bfa66,_0xb8a6ac){ChatMessageEvents[_0x8563('0x5')](_0x12a896+':'+_0x1b7850['id'],_0x1b7850);ChatMessageEvents['emit'](_0x12a896,_0x1b7850);_0xb8a6ac(null);};}for(var e in events){if(events[_0x8563('0x6')](e)){var event=events[e];ChatMessage[_0x8563('0x7')](e,emitEvent(event));}}module[_0x8563('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 49ab9e8..47af76b 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 _0x0d91=['error','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','body','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','ChatInteractionId','update','createdAt','catch'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x0d91,0x99));var _0x10d9=function(_0x24cfb3,_0x2da737){_0x24cfb3=_0x24cfb3-0x0;var _0x1e2159=_0x0d91[_0x24cfb3];return _0x1e2159;};'use strict';var _=require(_0x10d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10d9('0x1'));var moment=require('moment');var BPromise=require(_0x10d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x10d9('0x3'));var config=require(_0x10d9('0x4'));var attributes=require(_0x10d9('0x5'));module['exports']=function(_0x58468b,_0x461f60){return _0x58468b[_0x10d9('0x6')](_0x10d9('0x7'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x10d9('0x8')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16efe9,_0x99a151,_0x5ab94e){var _0x2bd664=_0x58468b[_0x10d9('0x9')];var _0x41b79d=_0x16efe9[_0x10d9('0xa')]({'plain':!![]});if(_0x41b79d['direction'][_0x10d9('0xb')]()==='in'||_0x41b79d[_0x10d9('0xc')][_0x10d9('0xb')]()===_0x10d9('0xd')&&!_0x41b79d[_0x10d9('0xe')]&&!_[_0x10d9('0xf')](_0x41b79d[_0x10d9('0x10')])){_0x2bd664['ChatInteraction'][_0x10d9('0x11')]({'where':{'id':_0x41b79d[_0x10d9('0x12')]}})['then'](function(_0x7aaccb){if(_0x7aaccb){_0x7aaccb[_0x10d9('0x13')]({'lastMsgAt':_0x41b79d[_0x10d9('0x14')],'lastMsgDirection':_0x41b79d['direction'][_0x10d9('0xb')]()});}})[_0x10d9('0x15')](function(_0x7df53e){console[_0x10d9('0x16')](_0x7df53e);});}_0x5ab94e();}},'charset':_0x10d9('0x17'),'collate':_0x10d9('0x18')});}; \ No newline at end of file +var _0x8408=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','update','createdAt','error','utf8mb4','lodash'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x8408,0x86));var _0x8840=function(_0x109767,_0x151aa9){_0x109767=_0x109767-0x0;var _0x515859=_0x8408[_0x109767];return _0x515859;};'use strict';var _=require(_0x8840('0x0'));var util=require('util');var logger=require(_0x8840('0x1'))(_0x8840('0x2'));var moment=require('moment');var BPromise=require(_0x8840('0x3'));var rp=require(_0x8840('0x4'));var fs=require('fs');var path=require(_0x8840('0x5'));var rimraf=require(_0x8840('0x6'));var config=require(_0x8840('0x7'));var attributes=require(_0x8840('0x8'));module[_0x8840('0x9')]=function(_0x47403b,_0x5019f7){return _0x47403b[_0x8840('0xa')]('ChatMessage',attributes,{'tableName':_0x8840('0xb'),'paranoid':![],'indexes':[{'name':_0x8840('0xc'),'fields':[_0x8840('0xd')],'type':_0x8840('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ec487,_0x45ba9f,_0x1b4cfc){var _0x296687=_0x47403b['models'];var _0x3a815b=_0x4ec487['get']({'plain':!![]});if(_0x3a815b[_0x8840('0xf')][_0x8840('0x10')]()==='in'||_0x3a815b[_0x8840('0xf')]['toLowerCase']()===_0x8840('0x11')&&!_0x3a815b[_0x8840('0x12')]&&!_[_0x8840('0x13')](_0x3a815b[_0x8840('0x14')])){_0x296687[_0x8840('0x15')]['findOne']({'where':{'id':_0x3a815b[_0x8840('0x16')]}})['then'](function(_0x4c9884){if(_0x4c9884){_0x4c9884[_0x8840('0x17')]({'lastMsgAt':_0x3a815b[_0x8840('0x18')],'lastMsgDirection':_0x3a815b[_0x8840('0xf')][_0x8840('0x10')]()});}})['catch'](function(_0x34a7dc){console[_0x8840('0x19')](_0x34a7dc);});}_0x1b4cfc();}},'charset':_0x8840('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 0dcb6fe..0d4ba79 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 _0x8a74=['ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body','options','raw','CreateChatMessage','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0x8a74,0x136));var _0x48a7=function(_0x3ddebb,_0x4cf354){_0x3ddebb=_0x3ddebb-0x0;var _0x23c40f=_0x8a74[_0x3ddebb];return _0x23c40f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x48a7('0x0'));var BPromise=require(_0x48a7('0x1'));var rs=require(_0x48a7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48a7('0x3'))['db'];var utils=require(_0x48a7('0x4'));var logger=require(_0x48a7('0x5'))(_0x48a7('0x6'));var config=require('../../config/environment');var jayson=require(_0x48a7('0x7'));var client=jayson[_0x48a7('0x8')][_0x48a7('0x9')]({'port':0x232a});config[_0x48a7('0xa')]=_[_0x48a7('0xb')](config[_0x48a7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x48a7('0xc'))(new Redis(config[_0x48a7('0xa')]));require(_0x48a7('0xd'))[_0x48a7('0xe')](socket);function respondWithRpcPromise(_0x948e72,_0x212455,_0x417f1d){return new BPromise(function(_0x2356fb,_0x2cbf7b){return client['request'](_0x948e72,_0x417f1d)[_0x48a7('0xf')](function(_0x2b594d){logger[_0x48a7('0x10')](_0x48a7('0x11'),_0x212455,_0x48a7('0x12'));logger[_0x48a7('0x13')](_0x48a7('0x14'),_0x212455,_0x48a7('0x12'),JSON['stringify'](_0x2b594d));if(_0x2b594d['error']){if(_0x2b594d[_0x48a7('0x15')][_0x48a7('0x16')]===0x1f4){logger[_0x48a7('0x15')]('ChatMessage,\x20%s,\x20%s',_0x212455,_0x2b594d['error'][_0x48a7('0x17')]);return _0x2cbf7b(_0x2b594d[_0x48a7('0x15')][_0x48a7('0x17')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x212455,_0x2b594d[_0x48a7('0x15')][_0x48a7('0x17')]);return _0x2356fb(_0x2b594d['error'][_0x48a7('0x17')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x212455,_0x48a7('0x12'));_0x2356fb(_0x2b594d[_0x48a7('0x18')][_0x48a7('0x17')]);}})[_0x48a7('0x19')](function(_0x1b0d08){logger['error'](_0x48a7('0x11'),_0x212455,_0x1b0d08);_0x2cbf7b(_0x1b0d08);});});}exports['CreateChatMessage']=function(_0x3c5894){var _0x556d2d=this;return new Promise(function(_0x31a9c1,_0x463742){return db['ChatMessage']['create'](_0x3c5894[_0x48a7('0x1a')],{'raw':_0x3c5894[_0x48a7('0x1b')]?_0x3c5894['options'][_0x48a7('0x1c')]===undefined?!![]:![]:!![]})[_0x48a7('0xf')](function(_0x4e54ae){logger[_0x48a7('0x10')](_0x48a7('0x1d'),_0x3c5894);logger['debug'](_0x48a7('0x1d'),_0x3c5894,JSON['stringify'](_0x4e54ae));_0x31a9c1(_0x4e54ae);})[_0x48a7('0x19')](function(_0x5a8e2f){logger['error'](_0x48a7('0x1d'),_0x5a8e2f['message'],_0x3c5894);_0x463742(_0x556d2d['error'](0x1f4,_0x5a8e2f['message']));});});}; \ No newline at end of file +var _0x2b66=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','ChatMessage','body','raw','then','CreateChatMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4668a6,_0x4e8a1f){var _0x23215d=function(_0x4f4cfc){while(--_0x4f4cfc){_0x4668a6['push'](_0x4668a6['shift']());}};_0x23215d(++_0x4e8a1f);}(_0x2b66,0x19a));var _0x62b6=function(_0x3e8800,_0x4901c1){_0x3e8800=_0x3e8800-0x0;var _0xac79d2=_0x2b66[_0x3e8800];return _0xac79d2;};'use strict';var _=require(_0x62b6('0x0'));var util=require(_0x62b6('0x1'));var moment=require(_0x62b6('0x2'));var BPromise=require(_0x62b6('0x3'));var rs=require(_0x62b6('0x4'));var fs=require('fs');var Redis=require(_0x62b6('0x5'));var db=require(_0x62b6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x62b6('0x7'))(_0x62b6('0x8'));var config=require(_0x62b6('0x9'));var jayson=require(_0x62b6('0xa'));var client=jayson['client'][_0x62b6('0xb')]({'port':0x232a});config[_0x62b6('0xc')]=_[_0x62b6('0xd')](config[_0x62b6('0xc')],{'host':_0x62b6('0xe'),'port':0x18eb});var socket=require(_0x62b6('0xf'))(new Redis(config[_0x62b6('0xc')]));require('./chatMessage.socket')[_0x62b6('0x10')](socket);function respondWithRpcPromise(_0x34436d,_0x2f912a,_0x49cd0b){return new BPromise(function(_0x4a65a3,_0x1d08a6){return client[_0x62b6('0x11')](_0x34436d,_0x49cd0b)['then'](function(_0x6aa42e){logger['info'](_0x62b6('0x12'),_0x2f912a,_0x62b6('0x13'));logger[_0x62b6('0x14')](_0x62b6('0x15'),_0x2f912a,_0x62b6('0x13'),JSON['stringify'](_0x6aa42e));if(_0x6aa42e[_0x62b6('0x16')]){if(_0x6aa42e['error']['code']===0x1f4){logger[_0x62b6('0x16')](_0x62b6('0x12'),_0x2f912a,_0x6aa42e[_0x62b6('0x16')]['message']);return _0x1d08a6(_0x6aa42e[_0x62b6('0x16')]['message']);}logger[_0x62b6('0x16')](_0x62b6('0x12'),_0x2f912a,_0x6aa42e[_0x62b6('0x16')][_0x62b6('0x17')]);return _0x4a65a3(_0x6aa42e[_0x62b6('0x16')][_0x62b6('0x17')]);}else{logger[_0x62b6('0x18')](_0x62b6('0x12'),_0x2f912a,'request\x20sent');_0x4a65a3(_0x6aa42e[_0x62b6('0x19')][_0x62b6('0x17')]);}})['catch'](function(_0x5985c5){logger[_0x62b6('0x16')](_0x62b6('0x12'),_0x2f912a,_0x5985c5);_0x1d08a6(_0x5985c5);});});}exports['CreateChatMessage']=function(_0x4ca224){var _0x3767ad=this;return new Promise(function(_0x53e6c8,_0x108c72){return db[_0x62b6('0x1a')]['create'](_0x4ca224[_0x62b6('0x1b')],{'raw':_0x4ca224['options']?_0x4ca224['options'][_0x62b6('0x1c')]===undefined?!![]:![]:!![]})[_0x62b6('0x1d')](function(_0x57e1ec){logger[_0x62b6('0x18')](_0x62b6('0x1e'),_0x4ca224);logger[_0x62b6('0x14')](_0x62b6('0x1e'),_0x4ca224,JSON['stringify'](_0x57e1ec));_0x53e6c8(_0x57e1ec);})[_0x62b6('0x1f')](function(_0x37f074){logger[_0x62b6('0x16')](_0x62b6('0x1e'),_0x37f074[_0x62b6('0x17')],_0x4ca224);_0x108c72(_0x3767ad['error'](0x1f4,_0x37f074[_0x62b6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8155a79..2ac491a 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 _0xafc4=['register','length','chatMessage:','./chatMessage.events','remove','emit'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xafc4,0x69));var _0x4afc=function(_0xf4e0a5,_0x299e46){_0xf4e0a5=_0xf4e0a5-0x0;var _0x43ba57=_0xafc4[_0xf4e0a5];return _0x43ba57;};'use strict';var ChatMessageEvents=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(){ChatMessageEvents['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);ChatMessageEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file +var _0xe3da=['length','chatMessage:','./chatMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x49bdb8,_0x1b3337){var _0x5aecc8=function(_0xffe959){while(--_0xffe959){_0x49bdb8['push'](_0x49bdb8['shift']());}};_0x5aecc8(++_0x1b3337);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var ChatMessageEvents=require(_0xae3d('0x0'));var events=[_0xae3d('0x1'),_0xae3d('0x2'),_0xae3d('0x3')];function createListener(_0x2bba92,_0x190f0d){return function(_0x109dca){_0x190f0d[_0xae3d('0x4')](_0x2bba92,_0x109dca);};}function removeListener(_0xb2dfd3,_0x22bacf){return function(){ChatMessageEvents[_0xae3d('0x5')](_0xb2dfd3,_0x22bacf);};}exports[_0xae3d('0x6')]=function(_0xa9a1a){for(var _0xa54808=0x0,_0x476579=events[_0xae3d('0x7')];_0xa54808<_0x476579;_0xa54808++){var _0x583b98=events[_0xa54808];var _0x2a5c45=createListener(_0xae3d('0x8')+_0x583b98,_0xa9a1a);ChatMessageEvents['on'](_0x583b98,_0x2a5c45);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 94c62e3..b8023d4 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 _0xe13f=['get','index','/describe','isAuthenticated','show','post','chat','create','put','update','/:id/accept','/:id/reject','reject','delete','/:id','destroy','exports','util','path','Router','../../config/environment','./chatMessage.controller'];(function(_0x1d7394,_0x2b50fb){var _0x134dc4=function(_0x512a7b){while(--_0x512a7b){_0x1d7394['push'](_0x1d7394['shift']());}};_0x134dc4(++_0x2b50fb);}(_0xe13f,0x7f));var _0xfe13=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xe13f[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require('multer');var util=require(_0xfe13('0x0'));var path=require(_0xfe13('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfe13('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfe13('0x3'));var controller=require(_0xfe13('0x4'));router[_0xfe13('0x5')]('/',auth['isAuthenticated'](),controller[_0xfe13('0x6')]);router['get'](_0xfe13('0x7'),auth[_0xfe13('0x8')](),controller['describe']);router[_0xfe13('0x5')]('/:id',auth[_0xfe13('0x8')](),controller[_0xfe13('0x9')]);router[_0xfe13('0xa')]('/',auth[_0xfe13('0x8')](),interaction['tracked'](_0xfe13('0xb'),'chatmessage:create'),controller[_0xfe13('0xc')]);router[_0xfe13('0xd')]('/:id',controller[_0xfe13('0xe')]);router[_0xfe13('0xd')](_0xfe13('0xf'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xfe13('0x10'),auth[_0xfe13('0x8')](),controller[_0xfe13('0x11')]);router[_0xfe13('0x12')](_0xfe13('0x13'),auth['isAuthenticated'](),controller[_0xfe13('0x14')]);module[_0xfe13('0x15')]=router; \ No newline at end of file +var _0x0c60=['index','describe','/:id','show','post','tracked','chat','chatmessage:create','create','update','put','/:id/accept','/:id/reject','reject','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0x0c60,0x16c));var _0x00c6=function(_0x3174d2,_0x4dbb8a){_0x3174d2=_0x3174d2-0x0;var _0x28519a=_0x0c60[_0x3174d2];return _0x28519a;};'use strict';var multer=require('multer');var util=require(_0x00c6('0x0'));var path=require(_0x00c6('0x1'));var timeout=require(_0x00c6('0x2'));var express=require(_0x00c6('0x3'));var router=express[_0x00c6('0x4')]();var auth=require(_0x00c6('0x5'));var interaction=require(_0x00c6('0x6'));var config=require(_0x00c6('0x7'));var controller=require(_0x00c6('0x8'));router[_0x00c6('0x9')]('/',auth[_0x00c6('0xa')](),controller[_0x00c6('0xb')]);router[_0x00c6('0x9')]('/describe',auth[_0x00c6('0xa')](),controller[_0x00c6('0xc')]);router[_0x00c6('0x9')](_0x00c6('0xd'),auth['isAuthenticated'](),controller[_0x00c6('0xe')]);router[_0x00c6('0xf')]('/',auth[_0x00c6('0xa')](),interaction[_0x00c6('0x10')](_0x00c6('0x11'),_0x00c6('0x12')),controller[_0x00c6('0x13')]);router['put'](_0x00c6('0xd'),controller[_0x00c6('0x14')]);router[_0x00c6('0x15')](_0x00c6('0x16'),auth[_0x00c6('0xa')](),controller['accept']);router[_0x00c6('0x15')](_0x00c6('0x17'),auth['isAuthenticated'](),controller[_0x00c6('0x18')]);router['delete'](_0x00c6('0xd'),auth[_0x00c6('0xa')](),controller['destroy']);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 c96dd6a..b9819bf 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 _0x448d=['sequelize','exports','TEXT'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x448d,0x75));var _0xd448=function(_0x51d444,_0x5954c5){_0x51d444=_0x51d444-0x0;var _0x309bd0=_0x448d[_0x51d444];return _0x309bd0;};'use strict';var Sequelize=require(_0xd448('0x0'));module[_0xd448('0x1')]={'body':{'type':Sequelize[_0xd448('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xae42=['medium','exports','TEXT'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0xae42,0x169));var _0x2ae4=function(_0x3976bd,_0x29d9a8){_0x3976bd=_0x3976bd-0x0;var _0x54a873=_0xae42[_0x3976bd];return _0x54a873;};'use strict';var Sequelize=require('sequelize');module[_0x2ae4('0x0')]={'body':{'type':Sequelize[_0x2ae4('0x1')](_0x2ae4('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 a65cbb0..4ac02e2 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 _0x7da7=['api','../../config/utils','../../mysqldb','status','end','json','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','pick','filter','where','VIRTUAL','merge','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','ChatOfflineMessage','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(_0x2de452,_0x43aa68){var _0x4c9462=function(_0x25778e){while(--_0x25778e){_0x2de452['push'](_0x2de452['shift']());}};_0x4c9462(++_0x43aa68);}(_0x7da7,0x10d));var _0x77da=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7da7[_0x2dadb9];return _0x2f0097;};'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 db=require(_0x77da('0x15'))['db'];function respondWithStatusCode(_0x3bcea0,_0x2acc65){_0x2acc65=_0x2acc65||0xcc;return function(_0x5d6e2f){if(_0x5d6e2f){return _0x3bcea0['sendStatus'](_0x2acc65);}return _0x3bcea0[_0x77da('0x16')](_0x2acc65)[_0x77da('0x17')]();};}function respondWithResult(_0x589aa1,_0x3b0ff2){_0x3b0ff2=_0x3b0ff2||0xc8;return function(_0x369df0){if(_0x369df0){return _0x589aa1[_0x77da('0x16')](_0x3b0ff2)[_0x77da('0x18')](_0x369df0);}};}function respondWithFilteredResult(_0x519253,_0x2172d0){return function(_0x4e130c){if(_0x4e130c){var _0x29cd7b=_0x4e130c['count'],_0x366443=_0x2172d0['offset'],_0x1b0e17=_0x2172d0['offset']+_0x2172d0['limit'],_0x4500c4;if(_0x1b0e17>=_0x29cd7b){_0x1b0e17=_0x29cd7b;_0x4500c4=0xc8;}else{_0x4500c4=0xce;}_0x519253[_0x77da('0x16')](_0x4500c4);return _0x519253[_0x77da('0x19')](_0x77da('0x1a'),_0x366443+'-'+_0x1b0e17+'/'+_0x29cd7b)[_0x77da('0x18')](_0x4e130c);}return null;};}function patchUpdates(_0x19a00c){return function(_0x12d2b1){try{jsonpatch[_0x77da('0x1b')](_0x12d2b1,_0x19a00c,!![]);}catch(_0x3b6dde){return BPromise['reject'](_0x3b6dde);}return _0x12d2b1['save']();};}function saveUpdates(_0xd5a809,_0x4d1512){return function(_0x507979){if(_0x507979){return _0x507979[_0x77da('0x1c')](_0xd5a809)[_0x77da('0x1d')](function(_0x24aa8a){return _0x24aa8a;});}return null;};}function removeEntity(_0x5ab79a,_0x58270c){return function(_0x3e6cfe){if(_0x3e6cfe){return _0x3e6cfe['destroy']()[_0x77da('0x1d')](function(){_0x5ab79a[_0x77da('0x16')](0xcc)[_0x77da('0x17')]();});}};}function handleEntityNotFound(_0x27b6c7,_0x10399a){return function(_0x270318){if(!_0x270318){_0x27b6c7[_0x77da('0x1e')](0x194);}return _0x270318;};}function handleError(_0x50799d,_0x4885ec){_0x4885ec=_0x4885ec||0x1f4;return function(_0xfd160){logger[_0x77da('0x1f')](_0xfd160[_0x77da('0x20')]);if(_0xfd160[_0x77da('0x21')]){delete _0xfd160['name'];}_0x50799d[_0x77da('0x16')](_0x4885ec)[_0x77da('0x22')](_0xfd160);};}exports[_0x77da('0x23')]=function(_0x36115b,_0x446ae7){var _0x5997b6={},_0xce24b8={},_0x3e090d={'count':0x0,'rows':[]};var _0x1f2279=_[_0x77da('0x24')](db['ChatOfflineMessage']['rawAttributes'],function(_0x4d395a){return{'name':_0x4d395a[_0x77da('0x25')],'type':_0x4d395a[_0x77da('0x26')][_0x77da('0x27')]};});_0xce24b8[_0x77da('0x28')]=_[_0x77da('0x24')](_0x1f2279,'name');_0xce24b8[_0x77da('0x29')]=_[_0x77da('0x2a')](_0x36115b[_0x77da('0x29')]);_0xce24b8[_0x77da('0x2b')]=_[_0x77da('0x2c')](_0xce24b8[_0x77da('0x28')],_0xce24b8['query']);_0x5997b6[_0x77da('0x2d')]=_[_0x77da('0x2c')](_0xce24b8[_0x77da('0x28')],qs[_0x77da('0x2e')](_0x36115b[_0x77da('0x29')][_0x77da('0x2e')]));_0x5997b6[_0x77da('0x2d')]=_0x5997b6[_0x77da('0x2d')]['length']?_0x5997b6['attributes']:_0xce24b8[_0x77da('0x28')];if(!_0x36115b[_0x77da('0x29')]['hasOwnProperty'](_0x77da('0x2f'))){_0x5997b6[_0x77da('0x30')]=qs[_0x77da('0x30')](_0x36115b[_0x77da('0x29')][_0x77da('0x30')]);_0x5997b6[_0x77da('0x31')]=qs[_0x77da('0x31')](_0x36115b['query'][_0x77da('0x31')]);}_0x5997b6['order']=qs['sort'](_0x36115b['query'][_0x77da('0x32')]);_0x5997b6['where']=qs[_0x77da('0x2b')](_[_0x77da('0x33')](_0x36115b[_0x77da('0x29')],_0xce24b8[_0x77da('0x2b')]),_0x1f2279);if(_0x36115b[_0x77da('0x29')][_0x77da('0x34')]){_0x5997b6[_0x77da('0x35')]=_['merge'](_0x5997b6[_0x77da('0x35')],{'$or':_[_0x77da('0x24')](_0x1f2279,function(_0x1ca53a){if(_0x1ca53a[_0x77da('0x26')]!==_0x77da('0x36')){var _0x188284={};_0x188284[_0x1ca53a['name']]={'$like':'%'+_0x36115b[_0x77da('0x29')][_0x77da('0x34')]+'%'};return _0x188284;}})});}_0x5997b6=_[_0x77da('0x37')]({},_0x5997b6,_0x36115b['options']);var _0xc5f0b8={'where':_0x5997b6['where']};return db['ChatOfflineMessage']['count'](_0xc5f0b8)['then'](function(_0x19f9f7){_0x3e090d[_0x77da('0x38')]=_0x19f9f7;if(_0x36115b[_0x77da('0x29')]['includeAll']){_0x5997b6[_0x77da('0x39')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x77da('0x3a')](_0x5997b6);})['then'](function(_0x3c216f){_0x3e090d[_0x77da('0x3b')]=_0x3c216f;return _0x3e090d;})[_0x77da('0x1d')](respondWithFilteredResult(_0x446ae7,_0x5997b6))[_0x77da('0x3c')](handleError(_0x446ae7,null));};exports[_0x77da('0x3d')]=function(_0x5ecf12,_0x759b86){var _0x1f48bd={'raw':!![],'where':{'id':_0x5ecf12[_0x77da('0x3e')]['id']}},_0x44717a={};_0x44717a[_0x77da('0x28')]=_[_0x77da('0x2a')](db['ChatOfflineMessage'][_0x77da('0x3f')]);_0x44717a[_0x77da('0x29')]=_[_0x77da('0x2a')](_0x5ecf12[_0x77da('0x29')]);_0x44717a[_0x77da('0x2b')]=_[_0x77da('0x2c')](_0x44717a['model'],_0x44717a[_0x77da('0x29')]);_0x1f48bd['attributes']=_[_0x77da('0x2c')](_0x44717a[_0x77da('0x28')],qs[_0x77da('0x2e')](_0x5ecf12['query'][_0x77da('0x2e')]));_0x1f48bd[_0x77da('0x2d')]=_0x1f48bd[_0x77da('0x2d')][_0x77da('0x40')]?_0x1f48bd[_0x77da('0x2d')]:_0x44717a[_0x77da('0x28')];if(_0x5ecf12[_0x77da('0x29')][_0x77da('0x41')]){_0x1f48bd[_0x77da('0x39')]=[{'all':!![]}];}_0x1f48bd=_['merge']({},_0x1f48bd,_0x5ecf12[_0x77da('0x42')]);return db[_0x77da('0x43')][_0x77da('0x44')](_0x1f48bd)[_0x77da('0x1d')](handleEntityNotFound(_0x759b86,null))[_0x77da('0x1d')](respondWithResult(_0x759b86,null))[_0x77da('0x3c')](handleError(_0x759b86,null));};exports['create']=function(_0x54f88c,_0x240d7b){return db[_0x77da('0x43')][_0x77da('0x45')](_0x54f88c[_0x77da('0x46')],{})[_0x77da('0x1d')](respondWithResult(_0x240d7b,0xc9))[_0x77da('0x3c')](handleError(_0x240d7b,null));};exports['update']=function(_0x6ccb8f,_0x357ee4){if(_0x6ccb8f[_0x77da('0x46')]['id']){delete _0x6ccb8f[_0x77da('0x46')]['id'];}return db['ChatOfflineMessage'][_0x77da('0x44')]({'where':{'id':_0x6ccb8f['params']['id']}})['then'](handleEntityNotFound(_0x357ee4,null))[_0x77da('0x1d')](saveUpdates(_0x6ccb8f[_0x77da('0x46')],null))[_0x77da('0x1d')](respondWithResult(_0x357ee4,null))[_0x77da('0x3c')](handleError(_0x357ee4,null));};exports['destroy']=function(_0x16bf4b,_0x1e36ee){return db['ChatOfflineMessage'][_0x77da('0x44')]({'where':{'id':_0x16bf4b[_0x77da('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1e36ee,null))[_0x77da('0x1d')](removeEntity(_0x1e36ee,null))[_0x77da('0x3c')](handleError(_0x1e36ee,null));};exports[_0x77da('0x47')]=function(_0xef2496,_0xfc13ed){return db[_0x77da('0x43')][_0x77da('0x47')]()[_0x77da('0x1d')](respondWithResult(_0xfc13ed,null))[_0x77da('0x3c')](handleError(_0xfc13ed,null));}; \ No newline at end of file +var _0x1cb9=['end','json','count','offset','limit','set','apply','save','then','destroy','error','stack','index','map','ChatOfflineMessage','rawAttributes','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','includeAll','options','find','create','body','update','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','sendStatus','status'];(function(_0x4427b5,_0x33c339){var _0x5799b6=function(_0x184597){while(--_0x184597){_0x4427b5['push'](_0x4427b5['shift']());}};_0x5799b6(++_0x33c339);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5287a4,_0x259199){_0x5287a4=_0x5287a4-0x0;var _0x4c3f75=_0x1cb9[_0x5287a4];return _0x4c3f75;};'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 db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1f56,_0x366f09){_0x366f09=_0x366f09||0xcc;return function(_0x4ba2f2){if(_0x4ba2f2){return _0x3c1f56[_0x91cb('0x18')](_0x366f09);}return _0x3c1f56[_0x91cb('0x19')](_0x366f09)[_0x91cb('0x1a')]();};}function respondWithResult(_0x2c7d40,_0x4a7d45){_0x4a7d45=_0x4a7d45||0xc8;return function(_0x4cc6ef){if(_0x4cc6ef){return _0x2c7d40[_0x91cb('0x19')](_0x4a7d45)[_0x91cb('0x1b')](_0x4cc6ef);}};}function respondWithFilteredResult(_0x585470,_0x528f73){return function(_0x576369){if(_0x576369){var _0xc3629e=_0x576369[_0x91cb('0x1c')],_0x347980=_0x528f73['offset'],_0x5ea796=_0x528f73[_0x91cb('0x1d')]+_0x528f73[_0x91cb('0x1e')],_0x238f11;if(_0x5ea796>=_0xc3629e){_0x5ea796=_0xc3629e;_0x238f11=0xc8;}else{_0x238f11=0xce;}_0x585470[_0x91cb('0x19')](_0x238f11);return _0x585470[_0x91cb('0x1f')]('Content-Range',_0x347980+'-'+_0x5ea796+'/'+_0xc3629e)[_0x91cb('0x1b')](_0x576369);}return null;};}function patchUpdates(_0x7dcf60){return function(_0x4ca8e8){try{jsonpatch[_0x91cb('0x20')](_0x4ca8e8,_0x7dcf60,!![]);}catch(_0x4c9fb2){return BPromise['reject'](_0x4c9fb2);}return _0x4ca8e8[_0x91cb('0x21')]();};}function saveUpdates(_0x160ded,_0x56e409){return function(_0x51a1d5){if(_0x51a1d5){return _0x51a1d5['update'](_0x160ded)[_0x91cb('0x22')](function(_0x18827b){return _0x18827b;});}return null;};}function removeEntity(_0x20aff5,_0x1dbee2){return function(_0x5c6a15){if(_0x5c6a15){return _0x5c6a15[_0x91cb('0x23')]()[_0x91cb('0x22')](function(){_0x20aff5[_0x91cb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(!_0x2447e7){_0x26f18f[_0x91cb('0x18')](0x194);}return _0x2447e7;};}function handleError(_0x3ca500,_0x7ad361){_0x7ad361=_0x7ad361||0x1f4;return function(_0x414e60){logger[_0x91cb('0x24')](_0x414e60[_0x91cb('0x25')]);if(_0x414e60['name']){delete _0x414e60['name'];}_0x3ca500[_0x91cb('0x19')](_0x7ad361)['send'](_0x414e60);};}exports[_0x91cb('0x26')]=function(_0x34d372,_0x318031){var _0x5595c5={},_0x9b26a6={},_0x4f5a7b={'count':0x0,'rows':[]};var _0x4572f6=_[_0x91cb('0x27')](db[_0x91cb('0x28')][_0x91cb('0x29')],function(_0x468908){return{'name':_0x468908['fieldName'],'type':_0x468908[_0x91cb('0x2a')]['key']};});_0x9b26a6[_0x91cb('0x2b')]=_[_0x91cb('0x27')](_0x4572f6,_0x91cb('0x2c'));_0x9b26a6['query']=_[_0x91cb('0x2d')](_0x34d372[_0x91cb('0x2e')]);_0x9b26a6[_0x91cb('0x2f')]=_[_0x91cb('0x30')](_0x9b26a6[_0x91cb('0x2b')],_0x9b26a6[_0x91cb('0x2e')]);_0x5595c5[_0x91cb('0x31')]=_[_0x91cb('0x30')](_0x9b26a6[_0x91cb('0x2b')],qs['fields'](_0x34d372[_0x91cb('0x2e')][_0x91cb('0x32')]));_0x5595c5[_0x91cb('0x31')]=_0x5595c5[_0x91cb('0x31')][_0x91cb('0x33')]?_0x5595c5['attributes']:_0x9b26a6[_0x91cb('0x2b')];if(!_0x34d372[_0x91cb('0x2e')][_0x91cb('0x34')](_0x91cb('0x35'))){_0x5595c5[_0x91cb('0x1e')]=qs['limit'](_0x34d372[_0x91cb('0x2e')]['limit']);_0x5595c5['offset']=qs['offset'](_0x34d372[_0x91cb('0x2e')]['offset']);}_0x5595c5[_0x91cb('0x36')]=qs['sort'](_0x34d372['query'][_0x91cb('0x37')]);_0x5595c5[_0x91cb('0x38')]=qs[_0x91cb('0x2f')](_[_0x91cb('0x39')](_0x34d372[_0x91cb('0x2e')],_0x9b26a6['filters']),_0x4572f6);if(_0x34d372[_0x91cb('0x2e')][_0x91cb('0x3a')]){_0x5595c5[_0x91cb('0x38')]=_[_0x91cb('0x3b')](_0x5595c5['where'],{'$or':_['map'](_0x4572f6,function(_0x1eed21){if(_0x1eed21[_0x91cb('0x2a')]!=='VIRTUAL'){var _0x39bd64={};_0x39bd64[_0x1eed21[_0x91cb('0x2c')]]={'$like':'%'+_0x34d372['query'][_0x91cb('0x3a')]+'%'};return _0x39bd64;}})});}_0x5595c5=_[_0x91cb('0x3b')]({},_0x5595c5,_0x34d372['options']);var _0x43d4fe={'where':_0x5595c5['where']};return db[_0x91cb('0x28')][_0x91cb('0x1c')](_0x43d4fe)[_0x91cb('0x22')](function(_0x279ad5){_0x4f5a7b[_0x91cb('0x1c')]=_0x279ad5;if(_0x34d372[_0x91cb('0x2e')]['includeAll']){_0x5595c5[_0x91cb('0x3c')]=[{'all':!![]}];}return db[_0x91cb('0x28')]['findAll'](_0x5595c5);})[_0x91cb('0x22')](function(_0x4ecbd7){_0x4f5a7b[_0x91cb('0x3d')]=_0x4ecbd7;return _0x4f5a7b;})[_0x91cb('0x22')](respondWithFilteredResult(_0x318031,_0x5595c5))[_0x91cb('0x3e')](handleError(_0x318031,null));};exports[_0x91cb('0x3f')]=function(_0x5e98c4,_0x435fff){var _0x5af0e6={'raw':!![],'where':{'id':_0x5e98c4[_0x91cb('0x40')]['id']}},_0x2cf27e={};_0x2cf27e[_0x91cb('0x2b')]=_[_0x91cb('0x2d')](db[_0x91cb('0x28')][_0x91cb('0x29')]);_0x2cf27e[_0x91cb('0x2e')]=_[_0x91cb('0x2d')](_0x5e98c4['query']);_0x2cf27e[_0x91cb('0x2f')]=_['intersection'](_0x2cf27e[_0x91cb('0x2b')],_0x2cf27e['query']);_0x5af0e6[_0x91cb('0x31')]=_['intersection'](_0x2cf27e[_0x91cb('0x2b')],qs[_0x91cb('0x32')](_0x5e98c4[_0x91cb('0x2e')][_0x91cb('0x32')]));_0x5af0e6['attributes']=_0x5af0e6[_0x91cb('0x31')][_0x91cb('0x33')]?_0x5af0e6['attributes']:_0x2cf27e[_0x91cb('0x2b')];if(_0x5e98c4[_0x91cb('0x2e')][_0x91cb('0x41')]){_0x5af0e6[_0x91cb('0x3c')]=[{'all':!![]}];}_0x5af0e6=_[_0x91cb('0x3b')]({},_0x5af0e6,_0x5e98c4[_0x91cb('0x42')]);return db[_0x91cb('0x28')][_0x91cb('0x43')](_0x5af0e6)[_0x91cb('0x22')](handleEntityNotFound(_0x435fff,null))['then'](respondWithResult(_0x435fff,null))[_0x91cb('0x3e')](handleError(_0x435fff,null));};exports[_0x91cb('0x44')]=function(_0x2b7323,_0x470996){return db[_0x91cb('0x28')][_0x91cb('0x44')](_0x2b7323[_0x91cb('0x45')],{})[_0x91cb('0x22')](respondWithResult(_0x470996,0xc9))['catch'](handleError(_0x470996,null));};exports[_0x91cb('0x46')]=function(_0x46caf1,_0x2b8b7f){if(_0x46caf1[_0x91cb('0x45')]['id']){delete _0x46caf1['body']['id'];}return db[_0x91cb('0x28')][_0x91cb('0x43')]({'where':{'id':_0x46caf1['params']['id']}})[_0x91cb('0x22')](handleEntityNotFound(_0x2b8b7f,null))['then'](saveUpdates(_0x46caf1[_0x91cb('0x45')],null))['then'](respondWithResult(_0x2b8b7f,null))['catch'](handleError(_0x2b8b7f,null));};exports['destroy']=function(_0x98245b,_0xff3d11){return db[_0x91cb('0x28')][_0x91cb('0x43')]({'where':{'id':_0x98245b[_0x91cb('0x40')]['id']}})['then'](handleEntityNotFound(_0xff3d11,null))['then'](removeEntity(_0xff3d11,null))[_0x91cb('0x3e')](handleError(_0xff3d11,null));};exports[_0x91cb('0x47')]=function(_0x140994,_0x14eaab){return db['ChatOfflineMessage']['describe']()['then'](respondWithResult(_0x14eaab,null))[_0x91cb('0x3e')](handleError(_0x14eaab,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b8e368a..88905ce 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 _0x72b1=['path','rimraf','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x72b1,0x16e));var _0x172b=function(_0x187c06,_0x46b0ea){_0x187c06=_0x187c06-0x0;var _0x497168=_0x72b1[_0x187c06];return _0x497168;};'use strict';var _=require(_0x172b('0x0'));var util=require('util');var logger=require(_0x172b('0x1'))(_0x172b('0x2'));var moment=require(_0x172b('0x3'));var BPromise=require(_0x172b('0x4'));var rp=require(_0x172b('0x5'));var fs=require('fs');var path=require(_0x172b('0x6'));var rimraf=require(_0x172b('0x7'));var config=require('../../config/environment');var attributes=require(_0x172b('0x8'));module[_0x172b('0x9')]=function(_0x475fd6,_0x222624){return _0x475fd6['define'](_0x172b('0xa'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x172b('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9bde=['utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3c78a2,_0xf2ce9f){_0x3c78a2=_0x3c78a2-0x0;var _0x16ada4=_0x9bde[_0x3c78a2];return _0x16ada4;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe9bd('0xc'),'collate':_0xe9bd('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 015a8ad..d8dd68a 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 _0xdcc2=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis'];(function(_0x3ad29a,_0x1b00a9){var _0x5d2ce0=function(_0x49be28){while(--_0x49be28){_0x3ad29a['push'](_0x3ad29a['shift']());}};_0x5d2ce0(++_0x1b00a9);}(_0xdcc2,0xa4));var _0x2dcc=function(_0x551330,_0x566db4){_0x551330=_0x551330-0x0;var _0x2808cb=_0xdcc2[_0x551330];return _0x2808cb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2dcc('0x0'));var BPromise=require(_0x2dcc('0x1'));var rs=require(_0x2dcc('0x2'));var fs=require('fs');var Redis=require(_0x2dcc('0x3'));var db=require(_0x2dcc('0x4'))['db'];var utils=require(_0x2dcc('0x5'));var logger=require(_0x2dcc('0x6'))(_0x2dcc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2dcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58579d,_0x1efc33,_0x312821){return new BPromise(function(_0x528050,_0xcd0ab1){return client[_0x2dcc('0x9')](_0x58579d,_0x312821)[_0x2dcc('0xa')](function(_0x5dc231){logger[_0x2dcc('0xb')](_0x2dcc('0xc'),_0x1efc33,'request\x20sent');logger[_0x2dcc('0xd')](_0x2dcc('0xe'),_0x1efc33,_0x2dcc('0xf'),JSON[_0x2dcc('0x10')](_0x5dc231));if(_0x5dc231[_0x2dcc('0x11')]){if(_0x5dc231['error'][_0x2dcc('0x12')]===0x1f4){logger['error'](_0x2dcc('0xc'),_0x1efc33,_0x5dc231[_0x2dcc('0x11')][_0x2dcc('0x13')]);return _0xcd0ab1(_0x5dc231[_0x2dcc('0x11')][_0x2dcc('0x13')]);}logger[_0x2dcc('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1efc33,_0x5dc231[_0x2dcc('0x11')][_0x2dcc('0x13')]);return _0x528050(_0x5dc231[_0x2dcc('0x11')][_0x2dcc('0x13')]);}else{logger[_0x2dcc('0xb')](_0x2dcc('0xc'),_0x1efc33,'request\x20sent');_0x528050(_0x5dc231['result'][_0x2dcc('0x13')]);}})[_0x2dcc('0x14')](function(_0x183434){logger[_0x2dcc('0x11')](_0x2dcc('0xc'),_0x1efc33,_0x183434);_0xcd0ab1(_0x183434);});});} \ No newline at end of file +var _0x5a89=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0x5a89,0x13d));var _0x95a8=function(_0x449516,_0x3eb41b){_0x449516=_0x449516-0x0;var _0x4a9a5f=_0x5a89[_0x449516];return _0x4a9a5f;};'use strict';var _=require(_0x95a8('0x0'));var util=require(_0x95a8('0x1'));var moment=require(_0x95a8('0x2'));var BPromise=require(_0x95a8('0x3'));var rs=require(_0x95a8('0x4'));var fs=require('fs');var Redis=require(_0x95a8('0x5'));var db=require(_0x95a8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x95a8('0x7'))('rpc');var config=require(_0x95a8('0x8'));var jayson=require(_0x95a8('0x9'));var client=jayson['client'][_0x95a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4282e1,_0x39af32,_0x3fa4f3){return new BPromise(function(_0x18ed9a,_0x535e10){return client[_0x95a8('0xb')](_0x4282e1,_0x3fa4f3)[_0x95a8('0xc')](function(_0x267e90){logger[_0x95a8('0xd')](_0x95a8('0xe'),_0x39af32,_0x95a8('0xf'));logger[_0x95a8('0x10')](_0x95a8('0x11'),_0x39af32,_0x95a8('0xf'),JSON['stringify'](_0x267e90));if(_0x267e90[_0x95a8('0x12')]){if(_0x267e90[_0x95a8('0x12')][_0x95a8('0x13')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x39af32,_0x267e90[_0x95a8('0x12')][_0x95a8('0x14')]);return _0x535e10(_0x267e90[_0x95a8('0x12')][_0x95a8('0x14')]);}logger[_0x95a8('0x12')](_0x95a8('0xe'),_0x39af32,_0x267e90[_0x95a8('0x12')][_0x95a8('0x14')]);return _0x18ed9a(_0x267e90[_0x95a8('0x12')][_0x95a8('0x14')]);}else{logger['info'](_0x95a8('0xe'),_0x39af32,_0x95a8('0xf'));_0x18ed9a(_0x267e90[_0x95a8('0x15')][_0x95a8('0x14')]);}})[_0x95a8('0x16')](function(_0x780f1c){logger['error'](_0x95a8('0xe'),_0x39af32,_0x780f1c);_0x535e10(_0x780f1c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 500a4d2..e04134c 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 _0xb7dc=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xb7dc,0x1db));var _0xcb7d=function(_0x1bca62,_0x326f16){_0x1bca62=_0x1bca62-0x0;var _0x4abe76=_0xb7dc[_0x1bca62];return _0x4abe76;};'use strict';var multer=require(_0xcb7d('0x0'));var util=require(_0xcb7d('0x1'));var path=require('path');var timeout=require(_0xcb7d('0x2'));var express=require(_0xcb7d('0x3'));var router=express['Router']();var auth=require(_0xcb7d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcb7d('0x5'));var controller=require(_0xcb7d('0x6'));router[_0xcb7d('0x7')]('/',auth[_0xcb7d('0x8')](),controller[_0xcb7d('0x9')]);router[_0xcb7d('0x7')]('/describe',auth[_0xcb7d('0x8')](),controller[_0xcb7d('0xa')]);router['get'](_0xcb7d('0xb'),auth[_0xcb7d('0x8')](),controller[_0xcb7d('0xc')]);router[_0xcb7d('0xd')]('/',auth[_0xcb7d('0x8')](),controller[_0xcb7d('0xe')]);router[_0xcb7d('0xf')]('/:id',auth[_0xcb7d('0x8')](),controller[_0xcb7d('0x10')]);router[_0xcb7d('0x11')](_0xcb7d('0xb'),auth[_0xcb7d('0x8')](),controller[_0xcb7d('0x12')]);module[_0xcb7d('0x13')]=router; \ No newline at end of file +var _0x47b9=['connect-timeout','express','Router','../../components/auth/service','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','multer','util','path'];(function(_0x42d7c9,_0x3ee28e){var _0x5f227b=function(_0xf579ff){while(--_0xf579ff){_0x42d7c9['push'](_0x42d7c9['shift']());}};_0x5f227b(++_0x3ee28e);}(_0x47b9,0x1b5));var _0x947b=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0x47b9[_0x810025];return _0x4dbc81;};'use strict';var multer=require(_0x947b('0x0'));var util=require(_0x947b('0x1'));var path=require(_0x947b('0x2'));var timeout=require(_0x947b('0x3'));var express=require(_0x947b('0x4'));var router=express[_0x947b('0x5')]();var auth=require(_0x947b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x947b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x947b('0x8')]);router[_0x947b('0x9')](_0x947b('0xa'),auth[_0x947b('0xb')](),controller[_0x947b('0xc')]);router[_0x947b('0x9')](_0x947b('0xd'),auth[_0x947b('0xb')](),controller[_0x947b('0xe')]);router[_0x947b('0xf')]('/',auth[_0x947b('0xb')](),controller[_0x947b('0x10')]);router[_0x947b('0x11')]('/:id',auth[_0x947b('0xb')](),controller['update']);router[_0x947b('0x12')](_0x947b('0xd'),auth['isAuthenticated'](),controller[_0x947b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index e8d33da..e0ffa53 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 _0x755e=['exports','ENUM','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0x755e,0x15d));var _0xe755=function(_0x699072,_0x3aca68){_0x699072=_0x699072-0x0;var _0x44edc2=_0x755e[_0x699072];return _0x44edc2;};'use strict';var Sequelize=require(_0xe755('0x0'));module[_0xe755('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe755('0x2')](_0xe755('0x3'),_0xe755('0x4')),'defaultValue':_0xe755('0x3')},'selector':{'type':Sequelize[_0xe755('0x5')]},'timeout':{'type':Sequelize[_0xe755('0x6')]}}; \ No newline at end of file +var _0x847c=['ENUM','timeout','INTEGER','sequelize','STRING'];(function(_0x5331cb,_0x9bed06){var _0xf64f51=function(_0x109dab){while(--_0x109dab){_0x5331cb['push'](_0x5331cb['shift']());}};_0xf64f51(++_0x9bed06);}(_0x847c,0x1a7));var _0xc847=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x847c[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0xc847('0x0'));module['exports']={'name':{'type':Sequelize[_0xc847('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc847('0x2')]('mouseOver',_0xc847('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xc847('0x1')]},'timeout':{'type':Sequelize[_0xc847('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 7c9fb13..849fe6d 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 _0xa9e0=['keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','create','body','catch','params','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','show','model'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={'raw':!![],'where':{'id':_0x526cf3['params']['id']}},_0x45a1e7={};_0x45a1e7[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x45a1e7[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x526cf3[_0x0a9e('0x2a')]);_0x45a1e7[_0x0a9e('0x2b')]=_['intersection'](_0x45a1e7[_0x0a9e('0x26')],_0x45a1e7[_0x0a9e('0x2a')]);_0x479bc4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x45a1e7['model'],qs[_0x0a9e('0x2e')](_0x526cf3[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x479bc4[_0x0a9e('0x2c')]=_0x479bc4[_0x0a9e('0x2c')][_0x0a9e('0x2f')]?_0x479bc4[_0x0a9e('0x2c')]:_0x45a1e7[_0x0a9e('0x26')];if(_0x526cf3[_0x0a9e('0x2a')]['includeAll']){_0x479bc4[_0x0a9e('0x30')]=[{'all':!![]}];}_0x479bc4=_['merge']({},_0x479bc4,_0x526cf3[_0x0a9e('0x31')]);return db[_0x0a9e('0x28')][_0x0a9e('0x32')](_0x479bc4)[_0x0a9e('0x1f')](handleEntityNotFound(_0x384319,null))[_0x0a9e('0x1f')](respondWithResult(_0x384319,null))['catch'](handleError(_0x384319,null));};exports[_0x0a9e('0x33')]=function(_0x46f0a5,_0x40cb85){return db[_0x0a9e('0x28')][_0x0a9e('0x33')](_0x46f0a5[_0x0a9e('0x34')],{})[_0x0a9e('0x1f')](respondWithResult(_0x40cb85,0xc9))[_0x0a9e('0x35')](handleError(_0x40cb85,null));};exports['update']=function(_0x44295a,_0x5e7238){if(_0x44295a[_0x0a9e('0x34')]['id']){delete _0x44295a[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x44295a['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5e7238,null))[_0x0a9e('0x1f')](saveUpdates(_0x44295a[_0x0a9e('0x34')],null))[_0x0a9e('0x1f')](respondWithResult(_0x5e7238,null))['catch'](handleError(_0x5e7238,null));};exports['destroy']=function(_0x1e8694,_0x5640eb){return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x1e8694[_0x0a9e('0x36')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5640eb,null))['then'](removeEntity(_0x5640eb,null))[_0x0a9e('0x35')](handleError(_0x5640eb,null));}; \ No newline at end of file +var _0xcb91=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0xcb91[_0x48d6a3];return _0x38bfa0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['show']=function(_0xd6891c,_0x21effa){var _0x41a9a0={'raw':!![],'where':{'id':_0xd6891c[_0x1cb9('0x26')]['id']}},_0x1804fd={};_0x1804fd[_0x1cb9('0x27')]=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')]);_0x1804fd[_0x1cb9('0x2b')]=_['keys'](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2c')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0x1804fd[_0x1cb9('0x27')],qs['fields'](_0xd6891c[_0x1cb9('0x2b')]['fields']));_0x41a9a0[_0x1cb9('0x2d')]=_0x41a9a0[_0x1cb9('0x2d')][_0x1cb9('0x2e')]?_0x41a9a0['attributes']:_0x1804fd[_0x1cb9('0x27')];if(_0xd6891c['query'][_0x1cb9('0x2f')]){_0x41a9a0['include']=[{'all':!![]}];}_0x41a9a0=_[_0x1cb9('0x30')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x31')]);return db[_0x1cb9('0x29')][_0x1cb9('0x32')](_0x41a9a0)['then'](handleEntityNotFound(_0x21effa,null))[_0x1cb9('0x1f')](respondWithResult(_0x21effa,null))[_0x1cb9('0x33')](handleError(_0x21effa,null));};exports[_0x1cb9('0x34')]=function(_0x91a1db,_0xc6784c){return db[_0x1cb9('0x29')][_0x1cb9('0x34')](_0x91a1db[_0x1cb9('0x35')],{})[_0x1cb9('0x1f')](respondWithResult(_0xc6784c,0xc9))[_0x1cb9('0x33')](handleError(_0xc6784c,null));};exports[_0x1cb9('0x36')]=function(_0x26b950,_0x29f149){if(_0x26b950['body']['id']){delete _0x26b950['body']['id'];}return db[_0x1cb9('0x29')][_0x1cb9('0x32')]({'where':{'id':_0x26b950[_0x1cb9('0x26')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x29f149,null))[_0x1cb9('0x1f')](saveUpdates(_0x26b950[_0x1cb9('0x35')],null))[_0x1cb9('0x1f')](respondWithResult(_0x29f149,null))[_0x1cb9('0x33')](handleError(_0x29f149,null));};exports['destroy']=function(_0x2aa59b,_0x1482c4){return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x2aa59b[_0x1cb9('0x26')]['id']}})['then'](handleEntityNotFound(_0x1482c4,null))[_0x1cb9('0x1f')](removeEntity(_0x1482c4,null))['catch'](handleError(_0x1482c4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index becb10c..0ace983 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 _0xf667=['moment','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','util','../../config/logger','api'];(function(_0x197a74,_0x5746a7){var _0x31d7a5=function(_0xae1ff5){while(--_0xae1ff5){_0x197a74['push'](_0x197a74['shift']());}};_0x31d7a5(++_0x5746a7);}(_0xf667,0x97));var _0x7f66=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xf667[_0x1992f1];return _0x413dfe;};'use strict';var _=require('lodash');var util=require(_0x7f66('0x0'));var logger=require(_0x7f66('0x1'))(_0x7f66('0x2'));var moment=require(_0x7f66('0x3'));var BPromise=require('bluebird');var rp=require(_0x7f66('0x4'));var fs=require('fs');var path=require(_0x7f66('0x5'));var rimraf=require('rimraf');var config=require(_0x7f66('0x6'));var attributes=require(_0x7f66('0x7'));module[_0x7f66('0x8')]=function(_0x16f96f,_0x145d8b){return _0x16f96f[_0x7f66('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x7f66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ff5=['rimraf','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1907dd,_0x24dc54){var _0x3c4ce1=function(_0x5dc93e){while(--_0x5dc93e){_0x1907dd['push'](_0x1907dd['shift']());}};_0x3c4ce1(++_0x24dc54);}(_0x1ff5,0x189));var _0x51ff=function(_0x3db81f,_0x47edc5){_0x3db81f=_0x3db81f-0x0;var _0x59e086=_0x1ff5[_0x3db81f];return _0x59e086;};'use strict';var _=require(_0x51ff('0x0'));var util=require(_0x51ff('0x1'));var logger=require(_0x51ff('0x2'))('api');var moment=require(_0x51ff('0x3'));var BPromise=require(_0x51ff('0x4'));var rp=require(_0x51ff('0x5'));var fs=require('fs');var path=require(_0x51ff('0x6'));var rimraf=require(_0x51ff('0x7'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x24fc6b,_0x46d623){return _0x24fc6b['define'](_0x51ff('0x8'),attributes,{'tableName':_0x51ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index a1ee6c1..a6350bb 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 _0x5f29=['client','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2587ca,_0x231303){var _0x5aada1=function(_0x2d21e1){while(--_0x2d21e1){_0x2587ca['push'](_0x2587ca['shift']());}};_0x5aada1(++_0x231303);}(_0x5f29,0x189));var _0x95f2=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0x5f29[_0x3ef4f1];return _0x69953c;};'use strict';var _=require(_0x95f2('0x0'));var util=require(_0x95f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95f2('0x2'))['db'];var utils=require(_0x95f2('0x3'));var logger=require('../../config/logger')(_0x95f2('0x4'));var config=require(_0x95f2('0x5'));var jayson=require(_0x95f2('0x6'));var client=jayson[_0x95f2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe11552,_0x2995d5,_0x181499){return new BPromise(function(_0x101993,_0x520939){return client['request'](_0xe11552,_0x181499)[_0x95f2('0x8')](function(_0x325359){logger[_0x95f2('0x9')]('ChatProactiveAction,\x20%s,\x20%s',_0x2995d5,_0x95f2('0xa'));logger[_0x95f2('0xb')](_0x95f2('0xc'),_0x2995d5,'request\x20sent',JSON[_0x95f2('0xd')](_0x325359));if(_0x325359[_0x95f2('0xe')]){if(_0x325359[_0x95f2('0xe')][_0x95f2('0xf')]===0x1f4){logger[_0x95f2('0xe')](_0x95f2('0x10'),_0x2995d5,_0x325359[_0x95f2('0xe')][_0x95f2('0x11')]);return _0x520939(_0x325359[_0x95f2('0xe')][_0x95f2('0x11')]);}logger[_0x95f2('0xe')](_0x95f2('0x10'),_0x2995d5,_0x325359[_0x95f2('0xe')][_0x95f2('0x11')]);return _0x101993(_0x325359['error'][_0x95f2('0x11')]);}else{logger[_0x95f2('0x9')](_0x95f2('0x10'),_0x2995d5,_0x95f2('0xa'));_0x101993(_0x325359[_0x95f2('0x12')][_0x95f2('0x11')]);}})[_0x95f2('0x13')](function(_0x5ef6ba){logger[_0x95f2('0xe')](_0x95f2('0x10'),_0x2995d5,_0x5ef6ba);_0x520939(_0x5ef6ba);});});} \ No newline at end of file +var _0xa344=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa344,0x71));var _0x4a34=function(_0x5cbc1d,_0x4ff4f0){_0x5cbc1d=_0x5cbc1d-0x0;var _0x36f811=_0xa344[_0x5cbc1d];return _0x36f811;};'use strict';var _=require('lodash');var util=require(_0x4a34('0x0'));var moment=require(_0x4a34('0x1'));var BPromise=require(_0x4a34('0x2'));var rs=require(_0x4a34('0x3'));var fs=require('fs');var Redis=require(_0x4a34('0x4'));var db=require(_0x4a34('0x5'))['db'];var utils=require(_0x4a34('0x6'));var logger=require(_0x4a34('0x7'))('rpc');var config=require(_0x4a34('0x8'));var jayson=require(_0x4a34('0x9'));var client=jayson[_0x4a34('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e131a,_0x3ea76b,_0x5012e7){return new BPromise(function(_0x94af7b,_0x47bf66){return client[_0x4a34('0xb')](_0x2e131a,_0x5012e7)[_0x4a34('0xc')](function(_0x45c720){logger[_0x4a34('0xd')](_0x4a34('0xe'),_0x3ea76b,_0x4a34('0xf'));logger[_0x4a34('0x10')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3ea76b,_0x4a34('0xf'),JSON[_0x4a34('0x11')](_0x45c720));if(_0x45c720[_0x4a34('0x12')]){if(_0x45c720[_0x4a34('0x12')][_0x4a34('0x13')]===0x1f4){logger[_0x4a34('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x3ea76b,_0x45c720[_0x4a34('0x12')][_0x4a34('0x14')]);return _0x47bf66(_0x45c720[_0x4a34('0x12')][_0x4a34('0x14')]);}logger[_0x4a34('0x12')](_0x4a34('0xe'),_0x3ea76b,_0x45c720[_0x4a34('0x12')][_0x4a34('0x14')]);return _0x94af7b(_0x45c720['error'][_0x4a34('0x14')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x3ea76b,_0x4a34('0xf'));_0x94af7b(_0x45c720[_0x4a34('0x15')][_0x4a34('0x14')]);}})['catch'](function(_0x4bf1d4){logger[_0x4a34('0x12')](_0x4a34('0xe'),_0x3ea76b,_0x4bf1d4);_0x47bf66(_0x4bf1d4);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 2d6ccc3..aa76b29 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 _0x674b=['Router','../../components/auth/service','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','update','exports','multer','util','path','connect-timeout','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x674b,0xcd));var _0xb674=function(_0x16c493,_0x504324){_0x16c493=_0x16c493-0x0;var _0x4d814b=_0x674b[_0x16c493];return _0x4d814b;};'use strict';var multer=require(_0xb674('0x0'));var util=require(_0xb674('0x1'));var path=require(_0xb674('0x2'));var timeout=require(_0xb674('0x3'));var express=require(_0xb674('0x4'));var router=express[_0xb674('0x5')]();var auth=require(_0xb674('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb674('0x7'));router['get'](_0xb674('0x8'),auth[_0xb674('0x9')](),controller['show']);router[_0xb674('0xa')]('/',auth[_0xb674('0x9')](),controller[_0xb674('0xb')]);router['put'](_0xb674('0x8'),auth[_0xb674('0x9')](),controller[_0xb674('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb674('0xd')]=router; \ No newline at end of file +var _0xdf10=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x1a73e6,_0x41662c){var _0x5d5598=function(_0x3724e3){while(--_0x3724e3){_0x1a73e6['push'](_0x1a73e6['shift']());}};_0x5d5598(++_0x41662c);}(_0xdf10,0x8c));var _0x0df1=function(_0x24903d,_0x4ae7c6){_0x24903d=_0x24903d-0x0;var _0x45932c=_0xdf10[_0x24903d];return _0x45932c;};'use strict';var multer=require(_0x0df1('0x0'));var util=require(_0x0df1('0x1'));var path=require(_0x0df1('0x2'));var timeout=require(_0x0df1('0x3'));var express=require(_0x0df1('0x4'));var router=express['Router']();var auth=require(_0x0df1('0x5'));var interaction=require(_0x0df1('0x6'));var config=require(_0x0df1('0x7'));var controller=require(_0x0df1('0x8'));router[_0x0df1('0x9')](_0x0df1('0xa'),auth[_0x0df1('0xb')](),controller[_0x0df1('0xc')]);router[_0x0df1('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0df1('0xe')](_0x0df1('0xa'),auth[_0x0df1('0xb')](),controller[_0x0df1('0xf')]);router[_0x0df1('0x10')](_0x0df1('0xa'),auth[_0x0df1('0xb')](),controller[_0x0df1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ff94a56..f3477e5 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 _0x214e=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0xf81ac7,_0x16bb88){var _0x42879b=function(_0x38bbe8){while(--_0x38bbe8){_0xf81ac7['push'](_0xf81ac7['shift']());}};_0x42879b(++_0x16bb88);}(_0x214e,0xb9));var _0xe214=function(_0x426772,_0x2ab616){_0x426772=_0x426772-0x0;var _0xb2d825=_0x214e[_0x426772];return _0xb2d825;};'use strict';var Sequelize=require(_0xe214('0x0'));module[_0xe214('0x1')]={'name':{'type':Sequelize[_0xe214('0x2')],'unique':_0xe214('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe214('0x2')]},'timeout':{'type':Sequelize[_0xe214('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe214('0x5')](_0xe214('0x6'),_0xe214('0x7'),_0xe214('0x8'))}}; \ No newline at end of file +var _0xfe77=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x104cfc,_0x39f419){var _0x451ad5=function(_0x206765){while(--_0x206765){_0x104cfc['push'](_0x104cfc['shift']());}};_0x451ad5(++_0x39f419);}(_0xfe77,0x1ab));var _0x7fe7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe77[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7fe7('0x0'));module[_0x7fe7('0x1')]={'name':{'type':Sequelize[_0x7fe7('0x2')],'unique':_0x7fe7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7fe7('0x2')]},'timeout':{'type':Sequelize[_0x7fe7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7fe7('0x5')](_0x7fe7('0x6'),_0x7fe7('0x7'),_0x7fe7('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 32258b5..4b75d70 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 _0x5caa=['stack','name','send','index','ChatQueue','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','user','role','ChatQueues','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','length','nolimit','ChatQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','rimraf','moment','bluebird','mustache','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','get','UserProfileResource','destroy'];(function(_0x29a0f4,_0x1b0842){var _0x37e4f2=function(_0x5e1012){while(--_0x5e1012){_0x29a0f4['push'](_0x29a0f4['shift']());}};_0x37e4f2(++_0x1b0842);}(_0x5caa,0x18c));var _0xa5ca=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x5caa[_0x510c60];return _0x49c4aa;};'use strict';var pdf=require(_0xa5ca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa5ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5ca('0x2'));var BPromise=require(_0xa5ca('0x3'));var Mustache=require(_0xa5ca('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa5ca('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa5ca('0x6'));var squel=require(_0xa5ca('0x7'));var crypto=require('crypto');var jsforce=require(_0xa5ca('0x8'));var deskjs=require(_0xa5ca('0x9'));var toCsv=require('to-csv');var querystring=require(_0xa5ca('0xa'));var Papa=require(_0xa5ca('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa5ca('0xc'));var as=require(_0xa5ca('0xd'));var hardwareService=require(_0xa5ca('0xe'));var logger=require('../../config/logger')(_0xa5ca('0xf'));var utils=require('../../config/utils');var config=require(_0xa5ca('0x10'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa5ca('0x11')](config[_0xa5ca('0x12')],{'host':_0xa5ca('0x13'),'port':0x18eb});var socket=require(_0xa5ca('0x14'))(new Redis(config[_0xa5ca('0x12')]));require(_0xa5ca('0x15'))[_0xa5ca('0x16')](socket);var jayson=require(_0xa5ca('0x17'));var client=jayson[_0xa5ca('0x18')][_0xa5ca('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1ac211,_0xf0da3a,_0x5f517e){if(_0x5f517e){var _0x423985=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x423985[_0xa5ca('0x1a')](_0xf0da3a)){return _0x1ac211;}else{throw new db['Sequelize']['ValidationError'](_0xa5ca('0x1b'));}}else{return _0x1ac211;}}function respondWithRpcPromise(_0x2d7823,_0x403b2c,_0x4a252c,_0x4b548a){return new BPromise(function(_0x154d24,_0x4a8495){var _0x24ffcb=_0x4b548a||client;return _0x24ffcb['request'](_0x2d7823,_0x4a252c)[_0xa5ca('0x1c')](function(_0x435f20){logger[_0xa5ca('0x1d')](_0xa5ca('0x1e'),_0x403b2c,'request\x20sent');logger[_0xa5ca('0x1f')](_0xa5ca('0x20'),_0x403b2c,_0xa5ca('0x21'),JSON[_0xa5ca('0x22')](_0x435f20));if(_0x435f20[_0xa5ca('0x23')]){if(_0x435f20[_0xa5ca('0x23')][_0xa5ca('0x24')]===0x1f4){logger['error'](_0xa5ca('0x1e'),_0x403b2c,_0x435f20[_0xa5ca('0x23')][_0xa5ca('0x25')]);return _0x4a8495(_0x435f20[_0xa5ca('0x23')][_0xa5ca('0x25')]);}logger[_0xa5ca('0x23')](_0xa5ca('0x1e'),_0x403b2c,_0x435f20['error']['message']);return _0x154d24(_0x435f20[_0xa5ca('0x23')][_0xa5ca('0x25')]);}else{logger[_0xa5ca('0x1d')]('ChatQueue,\x20%s,\x20%s',_0x403b2c,_0xa5ca('0x21'));_0x154d24(_0x435f20[_0xa5ca('0x26')][_0xa5ca('0x25')]);}})[_0xa5ca('0x27')](function(_0xc5c414){logger['error'](_0xa5ca('0x1e'),_0x403b2c,_0xc5c414);_0x4a8495(_0xc5c414);});});}function respondWithStatusCode(_0x4102be,_0x1abd9a){_0x1abd9a=_0x1abd9a||0xcc;return function(_0x505dd5){if(_0x505dd5){return _0x4102be[_0xa5ca('0x28')](_0x1abd9a);}return _0x4102be['status'](_0x1abd9a)[_0xa5ca('0x29')]();};}function respondWithResult(_0x1a72bf,_0x1d8716){_0x1d8716=_0x1d8716||0xc8;return function(_0x1ba81d){if(_0x1ba81d){return _0x1a72bf[_0xa5ca('0x2a')](_0x1d8716)[_0xa5ca('0x2b')](_0x1ba81d);}};}function respondWithFilteredResult(_0x52efd7,_0x1ac918){return function(_0x5dfcad){if(_0x5dfcad){var _0x59bf34=_0x5dfcad[_0xa5ca('0x2c')],_0xe8def4=_0x1ac918[_0xa5ca('0x2d')],_0x15a6cf=_0x1ac918[_0xa5ca('0x2d')]+_0x1ac918[_0xa5ca('0x2e')],_0x67c258;if(_0x15a6cf>=_0x59bf34){_0x15a6cf=_0x59bf34;_0x67c258=0xc8;}else{_0x67c258=0xce;}_0x52efd7['status'](_0x67c258);return _0x52efd7['set'](_0xa5ca('0x2f'),_0xe8def4+'-'+_0x15a6cf+'/'+_0x59bf34)[_0xa5ca('0x2b')](_0x5dfcad);}return null;};}function patchUpdates(_0x2b4ada){return function(_0x36b7cd){try{jsonpatch[_0xa5ca('0x30')](_0x36b7cd,_0x2b4ada,!![]);}catch(_0x2fe7b5){return BPromise[_0xa5ca('0x31')](_0x2fe7b5);}return _0x36b7cd[_0xa5ca('0x32')]();};}function saveUpdates(_0x3c6cf7,_0x202090){return function(_0x21cf7f){if(_0x21cf7f){return _0x21cf7f['update'](_0x3c6cf7)[_0xa5ca('0x1c')](function(_0x46a940){return _0x46a940;});}return null;};}function removeEntity(_0x1da685,_0x32eeeb){return function(_0x3ceb79){if(_0x3ceb79){return _0x3ceb79['destroy']()[_0xa5ca('0x1c')](function(){var _0x2fa5b9=_0x3ceb79[_0xa5ca('0x33')]({'plain':!![]});var _0xfa83a1='ChatQueues';return db[_0xa5ca('0x34')][_0xa5ca('0x35')]({'where':{'type':_0xfa83a1,'resourceId':_0x2fa5b9['id']}})[_0xa5ca('0x1c')](function(){return _0x3ceb79;});})[_0xa5ca('0x1c')](function(){_0x1da685[_0xa5ca('0x2a')](0xcc)[_0xa5ca('0x29')]();});}};}function handleEntityNotFound(_0x18a0f8,_0x4ff570){return function(_0xd850c){if(!_0xd850c){_0x18a0f8[_0xa5ca('0x28')](0x194);}return _0xd850c;};}function handleError(_0x312c93,_0x26ba16){_0x26ba16=_0x26ba16||0x1f4;return function(_0x23640e){logger[_0xa5ca('0x23')](_0x23640e[_0xa5ca('0x36')]);if(_0x23640e[_0xa5ca('0x37')]){delete _0x23640e[_0xa5ca('0x37')];}_0x312c93[_0xa5ca('0x2a')](_0x26ba16)[_0xa5ca('0x38')](_0x23640e);};}exports[_0xa5ca('0x39')]=function(_0x166662,_0x55ec4e){var _0x4f6bbd={},_0x15c270={},_0x59aedb={'count':0x0,'rows':[]};var _0x5a09b4=_['map'](db[_0xa5ca('0x3a')]['rawAttributes'],function(_0xc61ad9){return{'name':_0xc61ad9['fieldName'],'type':_0xc61ad9[_0xa5ca('0x3b')]['key']};});_0x15c270[_0xa5ca('0x3c')]=_[_0xa5ca('0x3d')](_0x5a09b4,'name');_0x15c270['query']=_[_0xa5ca('0x3e')](_0x166662[_0xa5ca('0x3f')]);_0x15c270[_0xa5ca('0x40')]=_[_0xa5ca('0x41')](_0x15c270[_0xa5ca('0x3c')],_0x15c270['query']);_0x4f6bbd[_0xa5ca('0x42')]=_['intersection'](_0x15c270['model'],qs[_0xa5ca('0x43')](_0x166662[_0xa5ca('0x3f')]['fields']));_0x4f6bbd[_0xa5ca('0x42')]=_0x4f6bbd['attributes']['length']?_0x4f6bbd[_0xa5ca('0x42')]:_0x15c270[_0xa5ca('0x3c')];if(!_0x166662[_0xa5ca('0x3f')][_0xa5ca('0x44')]('nolimit')){_0x4f6bbd['limit']=qs[_0xa5ca('0x2e')](_0x166662[_0xa5ca('0x3f')]['limit']);_0x4f6bbd[_0xa5ca('0x2d')]=qs[_0xa5ca('0x2d')](_0x166662[_0xa5ca('0x3f')][_0xa5ca('0x2d')]);}_0x4f6bbd[_0xa5ca('0x45')]=qs['sort'](_0x166662[_0xa5ca('0x3f')][_0xa5ca('0x46')]);_0x4f6bbd[_0xa5ca('0x47')]=qs[_0xa5ca('0x40')](_[_0xa5ca('0x48')](_0x166662[_0xa5ca('0x3f')],_0x15c270[_0xa5ca('0x40')]),_0x5a09b4);if(_0x166662[_0xa5ca('0x3f')]['filter']){_0x4f6bbd[_0xa5ca('0x47')]=_[_0xa5ca('0x49')](_0x4f6bbd[_0xa5ca('0x47')],{'$or':_[_0xa5ca('0x3d')](_0x5a09b4,function(_0x229c26){if(_0x229c26[_0xa5ca('0x3b')]!=='VIRTUAL'){var _0x4ab9bb={};_0x4ab9bb[_0x229c26[_0xa5ca('0x37')]]={'$like':'%'+_0x166662['query'][_0xa5ca('0x4a')]+'%'};return _0x4ab9bb;}})});}_0x4f6bbd=_[_0xa5ca('0x49')]({},_0x4f6bbd,_0x166662[_0xa5ca('0x4b')]);var _0x5f4008={'where':_0x4f6bbd[_0xa5ca('0x47')]};return db[_0xa5ca('0x3a')][_0xa5ca('0x2c')](_0x5f4008)[_0xa5ca('0x1c')](function(_0x3423a8){_0x59aedb[_0xa5ca('0x2c')]=_0x3423a8;if(_0x166662['query'][_0xa5ca('0x4c')]){_0x4f6bbd[_0xa5ca('0x4d')]=[{'all':!![]}];}return db[_0xa5ca('0x3a')][_0xa5ca('0x4e')](_0x4f6bbd);})[_0xa5ca('0x1c')](function(_0x11356a){_0x59aedb[_0xa5ca('0x4f')]=_0x11356a;return _0x59aedb;})[_0xa5ca('0x1c')](respondWithFilteredResult(_0x55ec4e,_0x4f6bbd))[_0xa5ca('0x27')](handleError(_0x55ec4e,null));};exports[_0xa5ca('0x50')]=function(_0x412a27,_0x5f0ac9){var _0x1b45ba={'raw':!![],'where':{'id':_0x412a27[_0xa5ca('0x51')]['id']}},_0x236ac3={};_0x236ac3['model']=_[_0xa5ca('0x3e')](db[_0xa5ca('0x3a')][_0xa5ca('0x52')]);_0x236ac3[_0xa5ca('0x3f')]=_[_0xa5ca('0x3e')](_0x412a27[_0xa5ca('0x3f')]);_0x236ac3['filters']=_[_0xa5ca('0x41')](_0x236ac3[_0xa5ca('0x3c')],_0x236ac3[_0xa5ca('0x3f')]);_0x1b45ba[_0xa5ca('0x42')]=_[_0xa5ca('0x41')](_0x236ac3[_0xa5ca('0x3c')],qs[_0xa5ca('0x43')](_0x412a27[_0xa5ca('0x3f')]['fields']));_0x1b45ba[_0xa5ca('0x42')]=_0x1b45ba['attributes']['length']?_0x1b45ba[_0xa5ca('0x42')]:_0x236ac3[_0xa5ca('0x3c')];if(_0x412a27[_0xa5ca('0x3f')][_0xa5ca('0x4c')]){_0x1b45ba[_0xa5ca('0x4d')]=[{'all':!![]}];}_0x1b45ba=_['merge']({},_0x1b45ba,_0x412a27[_0xa5ca('0x4b')]);return db[_0xa5ca('0x3a')]['find'](_0x1b45ba)[_0xa5ca('0x1c')](handleEntityNotFound(_0x5f0ac9,null))[_0xa5ca('0x1c')](respondWithResult(_0x5f0ac9,null))[_0xa5ca('0x27')](handleError(_0x5f0ac9,null));};exports['create']=function(_0x491cbf,_0x10fbfd){return db[_0xa5ca('0x3a')][_0xa5ca('0x53')](_0x491cbf[_0xa5ca('0x54')],{})[_0xa5ca('0x1c')](function(_0x51c540){var _0x155dcd=_0x491cbf[_0xa5ca('0x55')][_0xa5ca('0x33')]({'plain':!![]});if(!_0x155dcd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x155dcd[_0xa5ca('0x56')]==='user'){var _0x402aef=_0x51c540[_0xa5ca('0x33')]({'plain':!![]});var _0x5abadf=_0xa5ca('0x57');return db[_0xa5ca('0x58')][_0xa5ca('0x59')]({'where':{'name':_0x5abadf,'userProfileId':_0x155dcd['userProfileId']},'raw':!![]})[_0xa5ca('0x1c')](function(_0x5b36db){if(_0x5b36db&&_0x5b36db[_0xa5ca('0x5a')]===0x0){return db[_0xa5ca('0x34')]['create']({'name':_0x402aef['name'],'resourceId':_0x402aef['id'],'type':_0x5b36db['name'],'sectionId':_0x5b36db['id']},{})['then'](function(){return _0x51c540;});}else{return _0x51c540;}})['catch'](function(_0x29c582){logger[_0xa5ca('0x23')](_0xa5ca('0x5b'),_0x29c582);throw _0x29c582;});}return _0x51c540;})[_0xa5ca('0x1c')](respondWithResult(_0x10fbfd,0xc9))[_0xa5ca('0x27')](handleError(_0x10fbfd,null));};exports['update']=function(_0x4dc38b,_0x3074f9){if(_0x4dc38b[_0xa5ca('0x54')]['id']){delete _0x4dc38b[_0xa5ca('0x54')]['id'];}return db['ChatQueue'][_0xa5ca('0x59')]({'where':{'id':_0x4dc38b[_0xa5ca('0x51')]['id']}})[_0xa5ca('0x1c')](handleEntityNotFound(_0x3074f9,null))[_0xa5ca('0x1c')](saveUpdates(_0x4dc38b['body'],null))[_0xa5ca('0x1c')](respondWithResult(_0x3074f9,null))[_0xa5ca('0x27')](handleError(_0x3074f9,null));};exports[_0xa5ca('0x35')]=function(_0x2f7250,_0x2c19da){return db[_0xa5ca('0x3a')][_0xa5ca('0x59')]({'where':{'id':_0x2f7250[_0xa5ca('0x51')]['id']}})[_0xa5ca('0x1c')](handleEntityNotFound(_0x2c19da,null))[_0xa5ca('0x1c')](removeEntity(_0x2c19da,null))[_0xa5ca('0x27')](handleError(_0x2c19da,null));};exports[_0xa5ca('0x5c')]=function(_0x18a03e,_0x5530b4){return db[_0xa5ca('0x3a')][_0xa5ca('0x5c')]()[_0xa5ca('0x1c')](respondWithResult(_0x5530b4,null))[_0xa5ca('0x27')](handleError(_0x5530b4,null));};exports[_0xa5ca('0x5d')]=function(_0x5e23df,_0x2a9235,_0x55a586){var _0x26223b={'raw':!![],'where':{}},_0x2b54c2={},_0x14d9b7;return db[_0xa5ca('0x3a')][_0xa5ca('0x5e')]({'where':{'id':_0x5e23df[_0xa5ca('0x51')]['id']}})[_0xa5ca('0x1c')](handleEntityNotFound(_0x2a9235,null))[_0xa5ca('0x1c')](function(_0x46d3b2){if(_0x46d3b2){_0x14d9b7=_0x46d3b2[_0xa5ca('0x33')]({'plain':!![]});_0x2b54c2[_0xa5ca('0x3c')]=_[_0xa5ca('0x3e')](db[_0xa5ca('0x5f')][_0xa5ca('0x52')]);_0x2b54c2[_0xa5ca('0x3f')]=_[_0xa5ca('0x3e')](_0x5e23df[_0xa5ca('0x3f')]);_0x2b54c2[_0xa5ca('0x40')]=_['intersection'](_0x2b54c2['model'],_0x2b54c2[_0xa5ca('0x3f')]);_0x26223b[_0xa5ca('0x42')]=_[_0xa5ca('0x41')](_0x2b54c2['model'],qs[_0xa5ca('0x43')](_0x5e23df[_0xa5ca('0x3f')]['fields']));_0x26223b[_0xa5ca('0x42')]=_0x26223b['attributes'][_0xa5ca('0x60')]?_0x26223b[_0xa5ca('0x42')]:_0x2b54c2[_0xa5ca('0x3c')];if(!_0x5e23df[_0xa5ca('0x3f')][_0xa5ca('0x44')](_0xa5ca('0x61'))){_0x26223b[_0xa5ca('0x2e')]=qs[_0xa5ca('0x2e')](_0x5e23df[_0xa5ca('0x3f')][_0xa5ca('0x2e')]);_0x26223b[_0xa5ca('0x2d')]=qs[_0xa5ca('0x2d')](_0x5e23df[_0xa5ca('0x3f')][_0xa5ca('0x2d')]);}_0x26223b[_0xa5ca('0x45')]=qs['sort'](_0x5e23df[_0xa5ca('0x3f')]['sort']);_0x26223b[_0xa5ca('0x47')]=qs[_0xa5ca('0x40')](_[_0xa5ca('0x48')](_0x5e23df[_0xa5ca('0x3f')],_0x2b54c2['filters']));_0x26223b[_0xa5ca('0x47')][_0xa5ca('0x62')]=_0x46d3b2['id'];if(_0x5e23df[_0xa5ca('0x3f')][_0xa5ca('0x4a')]){_0x26223b['where']=_[_0xa5ca('0x49')](_0x26223b[_0xa5ca('0x47')],{'$or':_[_0xa5ca('0x3d')](_0x26223b[_0xa5ca('0x42')],function(_0x5b4a77){var _0x1646e2={};_0x1646e2[_0x5b4a77]={'$like':'%'+_0x5e23df[_0xa5ca('0x3f')][_0xa5ca('0x4a')]+'%'};return _0x1646e2;})});}_0x26223b=_[_0xa5ca('0x49')]({},_0x26223b,_0x5e23df[_0xa5ca('0x4b')]);return db[_0xa5ca('0x5f')][_0xa5ca('0x4e')](_0x26223b);}})[_0xa5ca('0x1c')](function(_0x13efce){if(_0x13efce){return db[_0xa5ca('0x63')][_0xa5ca('0x64')]({'where':{'id':_[_0xa5ca('0x3d')](_0x13efce,_0xa5ca('0x65')),'role':_0xa5ca('0x66')},'attributes':['id',_0xa5ca('0x37'),'chatPause',_0xa5ca('0x67'),_0xa5ca('0x68')]});}})['then'](function(_0x1844f0){if(_0x1844f0){return{'count':_0x1844f0['count'],'rows':_[_0xa5ca('0x3d')](_0x1844f0[_0xa5ca('0x4f')],function(_0x25a362){return{'membername':_0x25a362['name'],'UserId':_0x25a362['id'],'queue_name':_0x14d9b7[_0xa5ca('0x37')],'ChatQueueId':_0x14d9b7['id'],'interface':util[_0xa5ca('0x69')](_0xa5ca('0x6a'),_0xa5ca('0x6b'),_0x25a362[_0xa5ca('0x37')]),'penalty':0x0,'paused':_0x25a362[_0xa5ca('0x6c')],'createdAt':_0x25a362[_0xa5ca('0x68')],'updatedAt':_0x25a362[_0xa5ca('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa5ca('0x1c')](respondWithFilteredResult(_0x2a9235,_0x26223b))['catch'](handleError(_0x2a9235,null));};exports[_0xa5ca('0x6d')]=function(_0x596ec8,_0x45466c,_0x1468ca){var _0x42c00d={};var _0x3d6c1c={};var _0x5c92bf;var _0xe26239;return db[_0xa5ca('0x3a')]['findOne']({'where':{'id':_0x596ec8[_0xa5ca('0x51')]['id']}})[_0xa5ca('0x1c')](handleEntityNotFound(_0x45466c,null))[_0xa5ca('0x1c')](function(_0x2f77ec){if(_0x2f77ec){_0x5c92bf=_0x2f77ec;_0x3d6c1c[_0xa5ca('0x3c')]=_[_0xa5ca('0x3e')](db[_0xa5ca('0x6e')][_0xa5ca('0x52')]);_0x3d6c1c['query']=_[_0xa5ca('0x3e')](_0x596ec8['query']);_0x3d6c1c['filters']=_[_0xa5ca('0x41')](_0x3d6c1c[_0xa5ca('0x3c')],_0x3d6c1c[_0xa5ca('0x3f')]);_0x42c00d['attributes']=_[_0xa5ca('0x41')](_0x3d6c1c[_0xa5ca('0x3c')],qs[_0xa5ca('0x43')](_0x596ec8[_0xa5ca('0x3f')][_0xa5ca('0x43')]));_0x42c00d[_0xa5ca('0x42')]=_0x42c00d['attributes'][_0xa5ca('0x60')]?_0x42c00d[_0xa5ca('0x42')]:_0x3d6c1c[_0xa5ca('0x3c')];_0x42c00d[_0xa5ca('0x45')]=qs[_0xa5ca('0x46')](_0x596ec8[_0xa5ca('0x3f')][_0xa5ca('0x46')]);_0x42c00d['where']=qs[_0xa5ca('0x40')](_[_0xa5ca('0x48')](_0x596ec8[_0xa5ca('0x3f')],_0x3d6c1c['filters']));if(_0x596ec8['query'][_0xa5ca('0x4a')]){_0x42c00d[_0xa5ca('0x47')]=_[_0xa5ca('0x49')](_0x42c00d[_0xa5ca('0x47')],{'$or':_[_0xa5ca('0x3d')](_0x42c00d[_0xa5ca('0x42')],function(_0x3dc337){var _0x1fa052={};_0x1fa052[_0x3dc337]={'$like':'%'+_0x596ec8['query'][_0xa5ca('0x4a')]+'%'};return _0x1fa052;})});}_0x42c00d=_[_0xa5ca('0x49')]({},_0x42c00d,_0x596ec8[_0xa5ca('0x4b')]);return _0x5c92bf[_0xa5ca('0x6d')](_0x42c00d);}})['then'](function(_0x514dc8){if(_0x514dc8){_0xe26239=_0x514dc8['length'];if(!_0x596ec8['query'][_0xa5ca('0x44')]('nolimit')){_0x42c00d[_0xa5ca('0x2e')]=qs[_0xa5ca('0x2e')](_0x596ec8['query'][_0xa5ca('0x2e')]);_0x42c00d['offset']=qs['offset'](_0x596ec8[_0xa5ca('0x3f')][_0xa5ca('0x2d')]);}return _0x5c92bf[_0xa5ca('0x6d')](_0x42c00d);}})['then'](function(_0x3c8e38){if(_0x3c8e38){return _0x3c8e38?{'count':_0xe26239,'rows':_0x3c8e38}:null;}})[_0xa5ca('0x1c')](respondWithResult(_0x45466c,null))[_0xa5ca('0x27')](handleError(_0x45466c,null));};exports[_0xa5ca('0x6f')]=function(_0x4dada0,_0x4a0a0a,_0x1de4ff){var _0x2d3129=_0x4dada0[_0xa5ca('0x54')][_0xa5ca('0x70')];return db[_0xa5ca('0x6e')]['findAll']({'where':{'id':_0x2d3129},'attributes':['id'],'include':[{'model':db[_0xa5ca('0x63')],'as':_0xa5ca('0x71'),'attributes':['id',_0xa5ca('0x37'),_0xa5ca('0x72'),_0xa5ca('0x73'),'interface'],'raw':!![]}]})[_0xa5ca('0x1c')](function(_0x2f7ed){if(_0x2f7ed){var _0x2e8351=_['flatMap'](_0x2f7ed,function(_0x58b88b){var _0x5edb60=_0x58b88b[_0xa5ca('0x33')]({'plain':!![]});return _0x5edb60[_0xa5ca('0x71')];});return db[_0xa5ca('0x3a')]['find']({'where':{'id':_0x4dada0['params']['id']}})[_0xa5ca('0x1c')](function(_0x11b3e9){return db[_0xa5ca('0x74')][_0xa5ca('0x75')](function(_0x11feec){return _0x11b3e9[_0xa5ca('0x6f')](_0x2d3129,{'transaction':_0x11feec})[_0xa5ca('0x1c')](function(){return BPromise[_0xa5ca('0x76')](_0x2e8351,function(_0x27d4d0){return db['UserChatQueue'][_0xa5ca('0x77')]({'where':{'UserId':_0x27d4d0['id'],'ChatQueueId':_0x4dada0['params']['id']},'transaction':_0x11feec});});})[_0xa5ca('0x1c')](function(){_0x2e8351[_0xa5ca('0x78')](function(_0x28b0d6){socket[_0xa5ca('0x79')](_0xa5ca('0x7a'),{'UserId':_0x28b0d6['id'],'ChatQueueId':_0x11b3e9['id']});});});});});}})['then'](respondWithStatusCode(_0x4a0a0a,null))[_0xa5ca('0x27')](handleError(_0x4a0a0a,null));};exports[_0xa5ca('0x7b')]=function(_0x3283ae,_0x30a024,_0x1bbb37){return db[_0xa5ca('0x6e')][_0xa5ca('0x4e')]({'where':{'id':_0x3283ae[_0xa5ca('0x3f')][_0xa5ca('0x70')]},'attributes':['id'],'include':[{'model':db[_0xa5ca('0x63')],'as':_0xa5ca('0x71'),'attributes':['id'],'raw':!![]}]})[_0xa5ca('0x1c')](handleEntityNotFound(_0x30a024,null))[_0xa5ca('0x1c')](function(_0x383645){var _0x19b243=_[_0xa5ca('0x3d')](_0x383645,'id');var _0x4dcdd4=[];var _0x410656=[];var _0x1f1088=squel[_0xa5ca('0x7c')]();_0x1f1088[_0xa5ca('0x7d')](_0xa5ca('0x7e'))['from'](_0xa5ca('0x7f'),'tq')[_0xa5ca('0x80')](_0xa5ca('0x81'),'ut',_0xa5ca('0x82'))[_0xa5ca('0x47')](_0xa5ca('0x83'),_0x3283ae[_0xa5ca('0x51')]['id']);for(var _0x39ce0f=0x0;_0x39ce0f<_0x383645[_0xa5ca('0x60')];_0x39ce0f+=0x1){let _0x5d9566=_0x383645[_0x39ce0f];for(var _0x482e7a=0x0;_0x482e7a<_0x5d9566[_0xa5ca('0x71')][_0xa5ca('0x60')];_0x482e7a+=0x1){let _0x2ddb23=_0x5d9566[_0xa5ca('0x71')][_0x482e7a];var _0x545621=_0x1f1088[_0xa5ca('0x84')]();_0x545621[_0xa5ca('0x47')]('ut.UserId\x20=\x20?',_0x2ddb23['id']);_0x410656[_0xa5ca('0x85')](db[_0xa5ca('0x74')][_0xa5ca('0x3f')](_0x545621[_0xa5ca('0x86')](),{'type':db[_0xa5ca('0x74')][_0xa5ca('0x87')][_0xa5ca('0x88')]})[_0xa5ca('0x1c')](function(_0x4cdca1){if(_0x4cdca1[_0xa5ca('0x60')]===0x1){return _0x2ddb23['id'];}else{var _0x5ba87f=_[_0xa5ca('0x89')](_[_0xa5ca('0x3d')](_0x4cdca1,_0xa5ca('0x8a')),function(_0x494c1d){return _[_0xa5ca('0x8b')](_0x19b243,_0x494c1d);});if(_0x5ba87f){return _0x2ddb23['id'];}}}));}}return BPromise[_0xa5ca('0x8c')](_0x410656)['then'](function(_0x115e1f){_0x4dcdd4=_(_0x4dcdd4)[_0xa5ca('0x8d')](_0x115e1f)[_0xa5ca('0x8e')]()['value']();return db[_0xa5ca('0x3a')][_0xa5ca('0x59')]({'where':{'id':_0x3283ae[_0xa5ca('0x51')]['id']}})[_0xa5ca('0x1c')](function(_0x66fa8f){return db[_0xa5ca('0x74')]['transaction'](function(_0x29376a){return _0x66fa8f['removeTeams'](_0x3283ae[_0xa5ca('0x3f')][_0xa5ca('0x70')],{'transaction':_0x29376a})['then'](function(){if(!_[_0xa5ca('0x8f')](_0x4dcdd4)){return _0x66fa8f[_0xa5ca('0x90')](_0x4dcdd4,{'transaction':_0x29376a});}})[_0xa5ca('0x1c')](function(){_0x4dcdd4[_0xa5ca('0x78')](function(_0x1d4562){socket[_0xa5ca('0x79')](_0xa5ca('0x91'),{'UserId':_0x1d4562,'ChatQueueId':_0x66fa8f['id']});});});});});});})[_0xa5ca('0x1c')](respondWithStatusCode(_0x30a024,null))['catch'](handleError(_0x30a024,null));};exports[_0xa5ca('0x92')]=function(_0x534372,_0x47e536,_0x3196d5){return db[_0xa5ca('0x3a')]['find']({'where':{'id':_0x534372['params']['id']}})[_0xa5ca('0x1c')](handleEntityNotFound(_0x47e536,null))[_0xa5ca('0x1c')](function(_0x3dace8){if(_0x3dace8){return _0x3dace8[_0xa5ca('0x92')](_0x534372[_0xa5ca('0x54')][_0xa5ca('0x70')],_[_0xa5ca('0x93')](_0x534372[_0xa5ca('0x54')],[_0xa5ca('0x70'),'id'])||{})[_0xa5ca('0x94')](function(_0x382112){for(var _0x1475d2=0x0;_0x1475d2<_0x534372[_0xa5ca('0x54')][_0xa5ca('0x70')][_0xa5ca('0x60')];_0x1475d2+=0x1){socket['emit'](_0xa5ca('0x7a'),{'UserId':_0x534372['body'][_0xa5ca('0x70')][_0x1475d2],'ChatQueueId':_0x534372[_0xa5ca('0x51')]['id']});}return _0x382112;});}})[_0xa5ca('0x1c')](respondWithResult(_0x47e536,null))[_0xa5ca('0x27')](handleError(_0x47e536,null));};exports['removeAgents']=function(_0x2c8d31,_0x27b456,_0x2148bc){return db['ChatQueue'][_0xa5ca('0x59')]({'where':{'id':_0x2c8d31['params']['id']}})[_0xa5ca('0x1c')](handleEntityNotFound(_0x27b456,null))[_0xa5ca('0x1c')](function(_0x2a7cfa){if(_0x2a7cfa){return _0x2a7cfa['removeAgents'](_0x2c8d31['query'][_0xa5ca('0x70')])[_0xa5ca('0x1c')](function(){if(_['isArray'](_0x2c8d31[_0xa5ca('0x3f')][_0xa5ca('0x70')])){for(var _0x3f8ab8=0x0;_0x3f8ab8<_0x2c8d31[_0xa5ca('0x3f')][_0xa5ca('0x70')]['length'];_0x3f8ab8+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x2c8d31[_0xa5ca('0x3f')][_0xa5ca('0x70')][_0x3f8ab8]),'ChatQueueId':Number(_0x2c8d31['params']['id'])});}}else{socket['emit'](_0xa5ca('0x91'),{'UserId':Number(_0x2c8d31[_0xa5ca('0x3f')][_0xa5ca('0x70')]),'ChatQueueId':Number(_0x2c8d31['params']['id'])});}});}})['then'](respondWithStatusCode(_0x27b456,null))[_0xa5ca('0x27')](handleError(_0x27b456,null));};exports['getAgents']=function(_0x57bcbe,_0x41af6a,_0x58bef5){var _0xd7f7ed={};var _0x10204a={};var _0x1a4caf;var _0x320b2b;return db[_0xa5ca('0x3a')]['findOne']({'where':{'id':_0x57bcbe[_0xa5ca('0x51')]['id']}})['then'](handleEntityNotFound(_0x41af6a,null))[_0xa5ca('0x1c')](function(_0xf41dc3){if(_0xf41dc3){_0x1a4caf=_0xf41dc3;_0x10204a['model']=_[_0xa5ca('0x3e')](db[_0xa5ca('0x63')][_0xa5ca('0x52')]);_0x10204a[_0xa5ca('0x3f')]=_[_0xa5ca('0x3e')](_0x57bcbe[_0xa5ca('0x3f')]);_0x10204a[_0xa5ca('0x40')]=_[_0xa5ca('0x41')](_0x10204a[_0xa5ca('0x3c')],_0x10204a['query']);_0xd7f7ed[_0xa5ca('0x42')]=_[_0xa5ca('0x41')](_0x10204a['model'],qs[_0xa5ca('0x43')](_0x57bcbe[_0xa5ca('0x3f')][_0xa5ca('0x43')]));_0xd7f7ed[_0xa5ca('0x42')]=_0xd7f7ed[_0xa5ca('0x42')][_0xa5ca('0x60')]?_0xd7f7ed[_0xa5ca('0x42')]:_0x10204a[_0xa5ca('0x3c')];_0xd7f7ed[_0xa5ca('0x45')]=qs[_0xa5ca('0x46')](_0x57bcbe['query'][_0xa5ca('0x46')]);_0xd7f7ed[_0xa5ca('0x47')]=qs[_0xa5ca('0x40')](_[_0xa5ca('0x48')](_0x57bcbe[_0xa5ca('0x3f')],_0x10204a[_0xa5ca('0x40')]));if(_0x57bcbe[_0xa5ca('0x3f')][_0xa5ca('0x4a')]){_0xd7f7ed[_0xa5ca('0x47')]=_[_0xa5ca('0x49')](_0xd7f7ed[_0xa5ca('0x47')],{'$or':_['map'](_0xd7f7ed[_0xa5ca('0x42')],function(_0xd74c7c){var _0x53aaba={};_0x53aaba[_0xd74c7c]={'$like':'%'+_0x57bcbe[_0xa5ca('0x3f')][_0xa5ca('0x4a')]+'%'};return _0x53aaba;})});}_0xd7f7ed=_[_0xa5ca('0x49')]({},_0xd7f7ed,_0x57bcbe[_0xa5ca('0x4b')]);return _0x1a4caf[_0xa5ca('0x95')](_0xd7f7ed);}})[_0xa5ca('0x1c')](function(_0x32137d){if(_0x32137d){_0x320b2b=_0x32137d[_0xa5ca('0x60')];if(!_0x57bcbe['query'][_0xa5ca('0x44')](_0xa5ca('0x61'))){_0xd7f7ed['limit']=qs['limit'](_0x57bcbe[_0xa5ca('0x3f')][_0xa5ca('0x2e')]);_0xd7f7ed[_0xa5ca('0x2d')]=qs[_0xa5ca('0x2d')](_0x57bcbe[_0xa5ca('0x3f')][_0xa5ca('0x2d')]);}return _0x1a4caf['getAgents'](_0xd7f7ed);}})[_0xa5ca('0x1c')](function(_0x94e0cc){if(_0x94e0cc){return _0x94e0cc?{'count':_0x320b2b,'rows':_0x94e0cc}:null;}})[_0xa5ca('0x1c')](respondWithResult(_0x41af6a,null))[_0xa5ca('0x27')](handleError(_0x41af6a,null));}; \ No newline at end of file +var _0x04c9=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatQueue.socket','register','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','request\x20sent','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','ChatQueue','includeAll','include','findAll','show','params','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','autoAssociation','UserProfileResource','body','describe','getMembers','findOne','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','ids','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','isArray','getAgents'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x04c9,0x9e));var _0x904c=function(_0x551b38,_0x14ce3d){_0x551b38=_0x551b38-0x0;var _0xd22a6=_0x04c9[_0x551b38];return _0xd22a6;};'use strict';var pdf=require(_0x904c('0x0'));var emlformat=require(_0x904c('0x1'));var rimraf=require(_0x904c('0x2'));var zipdir=require(_0x904c('0x3'));var jsonpatch=require(_0x904c('0x4'));var rp=require(_0x904c('0x5'));var moment=require(_0x904c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x904c('0x7'));var util=require('util');var path=require('path');var sox=require(_0x904c('0x8'));var csv=require('to-csv');var ejs=require(_0x904c('0x9'));var fs=require('fs');var _=require(_0x904c('0xa'));var squel=require(_0x904c('0xb'));var crypto=require(_0x904c('0xc'));var jsforce=require(_0x904c('0xd'));var deskjs=require(_0x904c('0xe'));var toCsv=require(_0x904c('0xf'));var querystring=require(_0x904c('0x10'));var Papa=require(_0x904c('0x11'));var Redis=require(_0x904c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x904c('0x13'));var hardwareService=require(_0x904c('0x14'));var logger=require(_0x904c('0x15'))('api');var utils=require(_0x904c('0x16'));var config=require(_0x904c('0x17'));var db=require(_0x904c('0x18'))['db'];config[_0x904c('0x19')]=_['defaults'](config[_0x904c('0x19')],{'host':_0x904c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x904c('0x19')]));require(_0x904c('0x1b'))[_0x904c('0x1c')](socket);var jayson=require(_0x904c('0x1d'));var client=jayson['client'][_0x904c('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x12bda4,_0x4fa0ce,_0x3c65c3){if(_0x3c65c3){var _0x981aa4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x981aa4[_0x904c('0x1f')](_0x4fa0ce)){return _0x12bda4;}else{throw new db[(_0x904c('0x20'))]['ValidationError'](_0x904c('0x21'));}}else{return _0x12bda4;}}function respondWithRpcPromise(_0x249dbd,_0x97d2d5,_0x50c926,_0xb74248){return new BPromise(function(_0xad60a4,_0x9ee653){var _0x5cd5d7=_0xb74248||client;return _0x5cd5d7['request'](_0x249dbd,_0x50c926)[_0x904c('0x22')](function(_0x476ec0){logger['info']('ChatQueue,\x20%s,\x20%s',_0x97d2d5,'request\x20sent');logger[_0x904c('0x23')](_0x904c('0x24'),_0x97d2d5,'request\x20sent',JSON[_0x904c('0x25')](_0x476ec0));if(_0x476ec0[_0x904c('0x26')]){if(_0x476ec0['error'][_0x904c('0x27')]===0x1f4){logger[_0x904c('0x26')](_0x904c('0x28'),_0x97d2d5,_0x476ec0['error'][_0x904c('0x29')]);return _0x9ee653(_0x476ec0[_0x904c('0x26')][_0x904c('0x29')]);}logger[_0x904c('0x26')](_0x904c('0x28'),_0x97d2d5,_0x476ec0[_0x904c('0x26')][_0x904c('0x29')]);return _0xad60a4(_0x476ec0[_0x904c('0x26')][_0x904c('0x29')]);}else{logger[_0x904c('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x97d2d5,_0x904c('0x2b'));_0xad60a4(_0x476ec0['result'][_0x904c('0x29')]);}})[_0x904c('0x2c')](function(_0x14c498){logger['error'](_0x904c('0x28'),_0x97d2d5,_0x14c498);_0x9ee653(_0x14c498);});});}function respondWithStatusCode(_0x21645d,_0x1d4bf4){_0x1d4bf4=_0x1d4bf4||0xcc;return function(_0x39b31d){if(_0x39b31d){return _0x21645d[_0x904c('0x2d')](_0x1d4bf4);}return _0x21645d[_0x904c('0x2e')](_0x1d4bf4)[_0x904c('0x2f')]();};}function respondWithResult(_0x1342aa,_0x593224){_0x593224=_0x593224||0xc8;return function(_0x3248cc){if(_0x3248cc){return _0x1342aa['status'](_0x593224)[_0x904c('0x30')](_0x3248cc);}};}function respondWithFilteredResult(_0x100ae7,_0x22adae){return function(_0x96e220){if(_0x96e220){var _0xc93be0=_0x96e220[_0x904c('0x31')],_0x26b084=_0x22adae[_0x904c('0x32')],_0x38f1ac=_0x22adae['offset']+_0x22adae[_0x904c('0x33')],_0x275bfe;if(_0x38f1ac>=_0xc93be0){_0x38f1ac=_0xc93be0;_0x275bfe=0xc8;}else{_0x275bfe=0xce;}_0x100ae7[_0x904c('0x2e')](_0x275bfe);return _0x100ae7[_0x904c('0x34')](_0x904c('0x35'),_0x26b084+'-'+_0x38f1ac+'/'+_0xc93be0)[_0x904c('0x30')](_0x96e220);}return null;};}function patchUpdates(_0x2f6b13){return function(_0x2862be){try{jsonpatch[_0x904c('0x36')](_0x2862be,_0x2f6b13,!![]);}catch(_0x1b04e4){return BPromise[_0x904c('0x37')](_0x1b04e4);}return _0x2862be[_0x904c('0x38')]();};}function saveUpdates(_0x3dc65b,_0x3c0e67){return function(_0x433599){if(_0x433599){return _0x433599[_0x904c('0x39')](_0x3dc65b)[_0x904c('0x22')](function(_0x16ab93){return _0x16ab93;});}return null;};}function removeEntity(_0x3caec8,_0x29bd79){return function(_0x42e320){if(_0x42e320){return _0x42e320['destroy']()['then'](function(){var _0x37997b=_0x42e320[_0x904c('0x3a')]({'plain':!![]});var _0x590488='ChatQueues';return db['UserProfileResource'][_0x904c('0x3b')]({'where':{'type':_0x590488,'resourceId':_0x37997b['id']}})[_0x904c('0x22')](function(){return _0x42e320;});})[_0x904c('0x22')](function(){_0x3caec8[_0x904c('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a1742,_0x481222){return function(_0x3182d1){if(!_0x3182d1){_0x1a1742[_0x904c('0x2d')](0x194);}return _0x3182d1;};}function handleError(_0x44b02c,_0x59531d){_0x59531d=_0x59531d||0x1f4;return function(_0x14ab3d){logger[_0x904c('0x26')](_0x14ab3d['stack']);if(_0x14ab3d[_0x904c('0x3c')]){delete _0x14ab3d[_0x904c('0x3c')];}_0x44b02c[_0x904c('0x2e')](_0x59531d)[_0x904c('0x3d')](_0x14ab3d);};}exports['index']=function(_0x21729b,_0x5e5343){var _0x34280b={},_0x3edcfe={},_0x4f4847={'count':0x0,'rows':[]};var _0x41b9ff=_[_0x904c('0x3e')](db['ChatQueue'][_0x904c('0x3f')],function(_0xccce64){return{'name':_0xccce64[_0x904c('0x40')],'type':_0xccce64[_0x904c('0x41')][_0x904c('0x42')]};});_0x3edcfe[_0x904c('0x43')]=_[_0x904c('0x3e')](_0x41b9ff,'name');_0x3edcfe[_0x904c('0x44')]=_[_0x904c('0x45')](_0x21729b[_0x904c('0x44')]);_0x3edcfe[_0x904c('0x46')]=_[_0x904c('0x47')](_0x3edcfe[_0x904c('0x43')],_0x3edcfe['query']);_0x34280b['attributes']=_[_0x904c('0x47')](_0x3edcfe[_0x904c('0x43')],qs[_0x904c('0x48')](_0x21729b['query'][_0x904c('0x48')]));_0x34280b[_0x904c('0x49')]=_0x34280b[_0x904c('0x49')]['length']?_0x34280b[_0x904c('0x49')]:_0x3edcfe['model'];if(!_0x21729b['query'][_0x904c('0x4a')](_0x904c('0x4b'))){_0x34280b[_0x904c('0x33')]=qs[_0x904c('0x33')](_0x21729b[_0x904c('0x44')][_0x904c('0x33')]);_0x34280b[_0x904c('0x32')]=qs[_0x904c('0x32')](_0x21729b['query']['offset']);}_0x34280b[_0x904c('0x4c')]=qs[_0x904c('0x4d')](_0x21729b[_0x904c('0x44')]['sort']);_0x34280b[_0x904c('0x4e')]=qs['filters'](_['pick'](_0x21729b[_0x904c('0x44')],_0x3edcfe[_0x904c('0x46')]),_0x41b9ff);if(_0x21729b[_0x904c('0x44')][_0x904c('0x4f')]){_0x34280b[_0x904c('0x4e')]=_[_0x904c('0x50')](_0x34280b[_0x904c('0x4e')],{'$or':_['map'](_0x41b9ff,function(_0x237956){if(_0x237956[_0x904c('0x41')]!==_0x904c('0x51')){var _0x2a2269={};_0x2a2269[_0x237956[_0x904c('0x3c')]]={'$like':'%'+_0x21729b[_0x904c('0x44')][_0x904c('0x4f')]+'%'};return _0x2a2269;}})});}_0x34280b=_['merge']({},_0x34280b,_0x21729b['options']);var _0x18c075={'where':_0x34280b[_0x904c('0x4e')]};return db[_0x904c('0x52')][_0x904c('0x31')](_0x18c075)['then'](function(_0xa17dd5){_0x4f4847[_0x904c('0x31')]=_0xa17dd5;if(_0x21729b[_0x904c('0x44')][_0x904c('0x53')]){_0x34280b[_0x904c('0x54')]=[{'all':!![]}];}return db[_0x904c('0x52')][_0x904c('0x55')](_0x34280b);})['then'](function(_0xd08ade){_0x4f4847['rows']=_0xd08ade;return _0x4f4847;})[_0x904c('0x22')](respondWithFilteredResult(_0x5e5343,_0x34280b))[_0x904c('0x2c')](handleError(_0x5e5343,null));};exports[_0x904c('0x56')]=function(_0x1bb097,_0x2b58dc){var _0x141934={'raw':!![],'where':{'id':_0x1bb097[_0x904c('0x57')]['id']}},_0x51c0dc={};_0x51c0dc['model']=_['keys'](db[_0x904c('0x52')][_0x904c('0x3f')]);_0x51c0dc[_0x904c('0x44')]=_[_0x904c('0x45')](_0x1bb097[_0x904c('0x44')]);_0x51c0dc[_0x904c('0x46')]=_['intersection'](_0x51c0dc[_0x904c('0x43')],_0x51c0dc[_0x904c('0x44')]);_0x141934[_0x904c('0x49')]=_[_0x904c('0x47')](_0x51c0dc['model'],qs[_0x904c('0x48')](_0x1bb097[_0x904c('0x44')][_0x904c('0x48')]));_0x141934[_0x904c('0x49')]=_0x141934[_0x904c('0x49')][_0x904c('0x58')]?_0x141934[_0x904c('0x49')]:_0x51c0dc['model'];if(_0x1bb097[_0x904c('0x44')][_0x904c('0x53')]){_0x141934[_0x904c('0x54')]=[{'all':!![]}];}_0x141934=_['merge']({},_0x141934,_0x1bb097[_0x904c('0x59')]);return db[_0x904c('0x52')][_0x904c('0x5a')](_0x141934)['then'](handleEntityNotFound(_0x2b58dc,null))['then'](respondWithResult(_0x2b58dc,null))['catch'](handleError(_0x2b58dc,null));};exports[_0x904c('0x5b')]=function(_0x152111,_0x4cd32e){return db['ChatQueue']['create'](_0x152111['body'],{})[_0x904c('0x22')](function(_0x2538f7){var _0x600292=_0x152111[_0x904c('0x5c')]['get']({'plain':!![]});if(!_0x600292)throw new Error(_0x904c('0x5d'));if(_0x600292[_0x904c('0x5e')]===_0x904c('0x5c')){var _0x4d26d0=_0x2538f7[_0x904c('0x3a')]({'plain':!![]});var _0x4b3a6a=_0x904c('0x5f');return db[_0x904c('0x60')][_0x904c('0x5a')]({'where':{'name':_0x4b3a6a,'userProfileId':_0x600292['userProfileId']},'raw':!![]})['then'](function(_0x8f6d74){if(_0x8f6d74&&_0x8f6d74[_0x904c('0x61')]===0x0){return db[_0x904c('0x62')]['create']({'name':_0x4d26d0[_0x904c('0x3c')],'resourceId':_0x4d26d0['id'],'type':_0x8f6d74[_0x904c('0x3c')],'sectionId':_0x8f6d74['id']},{})[_0x904c('0x22')](function(){return _0x2538f7;});}else{return _0x2538f7;}})['catch'](function(_0x41533b){logger[_0x904c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41533b);throw _0x41533b;});}return _0x2538f7;})['then'](respondWithResult(_0x4cd32e,0xc9))[_0x904c('0x2c')](handleError(_0x4cd32e,null));};exports[_0x904c('0x39')]=function(_0x3189c2,_0x7637af){if(_0x3189c2['body']['id']){delete _0x3189c2[_0x904c('0x63')]['id'];}return db[_0x904c('0x52')][_0x904c('0x5a')]({'where':{'id':_0x3189c2[_0x904c('0x57')]['id']}})['then'](handleEntityNotFound(_0x7637af,null))[_0x904c('0x22')](saveUpdates(_0x3189c2[_0x904c('0x63')],null))[_0x904c('0x22')](respondWithResult(_0x7637af,null))[_0x904c('0x2c')](handleError(_0x7637af,null));};exports[_0x904c('0x3b')]=function(_0x434b29,_0x11583e){return db['ChatQueue']['find']({'where':{'id':_0x434b29[_0x904c('0x57')]['id']}})[_0x904c('0x22')](handleEntityNotFound(_0x11583e,null))['then'](removeEntity(_0x11583e,null))[_0x904c('0x2c')](handleError(_0x11583e,null));};exports[_0x904c('0x64')]=function(_0x531e16,_0x109376){return db[_0x904c('0x52')][_0x904c('0x64')]()[_0x904c('0x22')](respondWithResult(_0x109376,null))[_0x904c('0x2c')](handleError(_0x109376,null));};exports[_0x904c('0x65')]=function(_0x34c5a8,_0x84e915,_0x94a907){var _0x4f6b31={'raw':!![],'where':{}},_0x2453ad={},_0x151b97;return db['ChatQueue'][_0x904c('0x66')]({'where':{'id':_0x34c5a8[_0x904c('0x57')]['id']}})[_0x904c('0x22')](handleEntityNotFound(_0x84e915,null))[_0x904c('0x22')](function(_0x36c952){if(_0x36c952){_0x151b97=_0x36c952['get']({'plain':!![]});_0x2453ad[_0x904c('0x43')]=_['keys'](db[_0x904c('0x67')][_0x904c('0x3f')]);_0x2453ad[_0x904c('0x44')]=_['keys'](_0x34c5a8[_0x904c('0x44')]);_0x2453ad[_0x904c('0x46')]=_[_0x904c('0x47')](_0x2453ad[_0x904c('0x43')],_0x2453ad[_0x904c('0x44')]);_0x4f6b31[_0x904c('0x49')]=_['intersection'](_0x2453ad[_0x904c('0x43')],qs[_0x904c('0x48')](_0x34c5a8[_0x904c('0x44')]['fields']));_0x4f6b31[_0x904c('0x49')]=_0x4f6b31[_0x904c('0x49')]['length']?_0x4f6b31[_0x904c('0x49')]:_0x2453ad[_0x904c('0x43')];if(!_0x34c5a8[_0x904c('0x44')]['hasOwnProperty']('nolimit')){_0x4f6b31[_0x904c('0x33')]=qs[_0x904c('0x33')](_0x34c5a8[_0x904c('0x44')][_0x904c('0x33')]);_0x4f6b31['offset']=qs[_0x904c('0x32')](_0x34c5a8[_0x904c('0x44')][_0x904c('0x32')]);}_0x4f6b31[_0x904c('0x4c')]=qs['sort'](_0x34c5a8['query'][_0x904c('0x4d')]);_0x4f6b31['where']=qs['filters'](_[_0x904c('0x68')](_0x34c5a8['query'],_0x2453ad['filters']));_0x4f6b31[_0x904c('0x4e')][_0x904c('0x69')]=_0x36c952['id'];if(_0x34c5a8['query'][_0x904c('0x4f')]){_0x4f6b31[_0x904c('0x4e')]=_[_0x904c('0x50')](_0x4f6b31[_0x904c('0x4e')],{'$or':_[_0x904c('0x3e')](_0x4f6b31[_0x904c('0x49')],function(_0x403bff){var _0x263d13={};_0x263d13[_0x403bff]={'$like':'%'+_0x34c5a8[_0x904c('0x44')][_0x904c('0x4f')]+'%'};return _0x263d13;})});}_0x4f6b31=_[_0x904c('0x50')]({},_0x4f6b31,_0x34c5a8[_0x904c('0x59')]);return db[_0x904c('0x67')]['findAll'](_0x4f6b31);}})['then'](function(_0x93c2d7){if(_0x93c2d7){return db[_0x904c('0x6a')][_0x904c('0x6b')]({'where':{'id':_['map'](_0x93c2d7,_0x904c('0x6c')),'role':_0x904c('0x6d')},'attributes':['id',_0x904c('0x3c'),_0x904c('0x6e'),_0x904c('0x6f'),_0x904c('0x70')]});}})[_0x904c('0x22')](function(_0x2df00a){if(_0x2df00a){return{'count':_0x2df00a['count'],'rows':_[_0x904c('0x3e')](_0x2df00a[_0x904c('0x71')],function(_0x230e05){return{'membername':_0x230e05[_0x904c('0x3c')],'UserId':_0x230e05['id'],'queue_name':_0x151b97['name'],'ChatQueueId':_0x151b97['id'],'interface':util['format'](_0x904c('0x72'),_0x904c('0x73'),_0x230e05['name']),'penalty':0x0,'paused':_0x230e05[_0x904c('0x6e')],'createdAt':_0x230e05[_0x904c('0x70')],'updatedAt':_0x230e05['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x904c('0x22')](respondWithFilteredResult(_0x84e915,_0x4f6b31))[_0x904c('0x2c')](handleError(_0x84e915,null));};exports[_0x904c('0x74')]=function(_0xc7c347,_0x52994a,_0x51bdcf){var _0x584639={};var _0x182991={};var _0x24c2b5;var _0x587d31;return db[_0x904c('0x52')][_0x904c('0x66')]({'where':{'id':_0xc7c347[_0x904c('0x57')]['id']}})['then'](handleEntityNotFound(_0x52994a,null))[_0x904c('0x22')](function(_0x1ecb19){if(_0x1ecb19){_0x24c2b5=_0x1ecb19;_0x182991[_0x904c('0x43')]=_[_0x904c('0x45')](db['Team'][_0x904c('0x3f')]);_0x182991['query']=_[_0x904c('0x45')](_0xc7c347['query']);_0x182991[_0x904c('0x46')]=_[_0x904c('0x47')](_0x182991[_0x904c('0x43')],_0x182991['query']);_0x584639[_0x904c('0x49')]=_[_0x904c('0x47')](_0x182991[_0x904c('0x43')],qs['fields'](_0xc7c347[_0x904c('0x44')][_0x904c('0x48')]));_0x584639[_0x904c('0x49')]=_0x584639[_0x904c('0x49')][_0x904c('0x58')]?_0x584639[_0x904c('0x49')]:_0x182991[_0x904c('0x43')];_0x584639[_0x904c('0x4c')]=qs['sort'](_0xc7c347['query'][_0x904c('0x4d')]);_0x584639['where']=qs['filters'](_['pick'](_0xc7c347[_0x904c('0x44')],_0x182991[_0x904c('0x46')]));if(_0xc7c347['query'][_0x904c('0x4f')]){_0x584639['where']=_[_0x904c('0x50')](_0x584639[_0x904c('0x4e')],{'$or':_[_0x904c('0x3e')](_0x584639[_0x904c('0x49')],function(_0x176356){var _0x45d5ba={};_0x45d5ba[_0x176356]={'$like':'%'+_0xc7c347[_0x904c('0x44')]['filter']+'%'};return _0x45d5ba;})});}_0x584639=_['merge']({},_0x584639,_0xc7c347[_0x904c('0x59')]);return _0x24c2b5[_0x904c('0x74')](_0x584639);}})[_0x904c('0x22')](function(_0x4a6974){if(_0x4a6974){_0x587d31=_0x4a6974[_0x904c('0x58')];if(!_0xc7c347[_0x904c('0x44')][_0x904c('0x4a')](_0x904c('0x4b'))){_0x584639['limit']=qs['limit'](_0xc7c347[_0x904c('0x44')][_0x904c('0x33')]);_0x584639[_0x904c('0x32')]=qs[_0x904c('0x32')](_0xc7c347[_0x904c('0x44')][_0x904c('0x32')]);}return _0x24c2b5['getTeams'](_0x584639);}})[_0x904c('0x22')](function(_0x3d3796){if(_0x3d3796){return _0x3d3796?{'count':_0x587d31,'rows':_0x3d3796}:null;}})[_0x904c('0x22')](respondWithResult(_0x52994a,null))[_0x904c('0x2c')](handleError(_0x52994a,null));};exports[_0x904c('0x75')]=function(_0x50d2a9,_0x289681,_0x51617b){var _0x1a2990=_0x50d2a9[_0x904c('0x63')]['ids'];return db[_0x904c('0x76')][_0x904c('0x55')]({'where':{'id':_0x1a2990},'attributes':['id'],'include':[{'model':db[_0x904c('0x6a')],'as':_0x904c('0x77'),'attributes':['id',_0x904c('0x3c'),_0x904c('0x78'),_0x904c('0x79'),_0x904c('0x7a')],'raw':!![]}]})[_0x904c('0x22')](function(_0x2d17dd){if(_0x2d17dd){var _0xcbe6d=_[_0x904c('0x7b')](_0x2d17dd,function(_0x2bb355){var _0x690be1=_0x2bb355[_0x904c('0x3a')]({'plain':!![]});return _0x690be1[_0x904c('0x77')];});return db['ChatQueue']['find']({'where':{'id':_0x50d2a9[_0x904c('0x57')]['id']}})[_0x904c('0x22')](function(_0x1463e0){return db[_0x904c('0x7c')][_0x904c('0x7d')](function(_0x36461e){return _0x1463e0[_0x904c('0x75')](_0x1a2990,{'transaction':_0x36461e})[_0x904c('0x22')](function(){return BPromise[_0x904c('0x7e')](_0xcbe6d,function(_0x1e7663){return db[_0x904c('0x67')][_0x904c('0x7f')]({'where':{'UserId':_0x1e7663['id'],'ChatQueueId':_0x50d2a9[_0x904c('0x57')]['id']},'transaction':_0x36461e});});})[_0x904c('0x22')](function(){_0xcbe6d['forEach'](function(_0x160898){socket['emit'](_0x904c('0x80'),{'UserId':_0x160898['id'],'ChatQueueId':_0x1463e0['id']});});});});});}})[_0x904c('0x22')](respondWithStatusCode(_0x289681,null))[_0x904c('0x2c')](handleError(_0x289681,null));};exports['removeTeams']=function(_0xdf712f,_0x559aaa,_0xd17cc2){return db['Team'][_0x904c('0x55')]({'where':{'id':_0xdf712f[_0x904c('0x44')]['ids']},'attributes':['id'],'include':[{'model':db[_0x904c('0x6a')],'as':_0x904c('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x559aaa,null))[_0x904c('0x22')](function(_0x574251){var _0x2f536d=_[_0x904c('0x3e')](_0x574251,'id');var _0x3df73b=[];var _0x1c82d1=[];var _0x1011fc=squel['select']();_0x1011fc[_0x904c('0x81')](_0x904c('0x82'))[_0x904c('0x83')](_0x904c('0x84'),'tq')[_0x904c('0x85')](_0x904c('0x86'),'ut',_0x904c('0x87'))[_0x904c('0x4e')]('ChatQueueId\x20=\x20?',_0xdf712f['params']['id']);for(var _0x558bb9=0x0;_0x558bb9<_0x574251[_0x904c('0x58')];_0x558bb9+=0x1){let _0x59a342=_0x574251[_0x558bb9];for(var _0x3f8b20=0x0;_0x3f8b20<_0x59a342[_0x904c('0x77')][_0x904c('0x58')];_0x3f8b20+=0x1){let _0x547799=_0x59a342['Agents'][_0x3f8b20];var _0xf210f8=_0x1011fc[_0x904c('0x88')]();_0xf210f8['where'](_0x904c('0x89'),_0x547799['id']);_0x1c82d1[_0x904c('0x8a')](db[_0x904c('0x7c')]['query'](_0xf210f8[_0x904c('0x8b')](),{'type':db[_0x904c('0x7c')][_0x904c('0x8c')][_0x904c('0x8d')]})[_0x904c('0x22')](function(_0x1f0a0b){if(_0x1f0a0b[_0x904c('0x58')]===0x1){return _0x547799['id'];}else{var _0x1ecad3=_[_0x904c('0x8e')](_[_0x904c('0x3e')](_0x1f0a0b,_0x904c('0x8f')),function(_0x183ffb){return _[_0x904c('0x90')](_0x2f536d,_0x183ffb);});if(_0x1ecad3){return _0x547799['id'];}}}));}}return BPromise[_0x904c('0x91')](_0x1c82d1)[_0x904c('0x22')](function(_0x52eb23){_0x3df73b=_(_0x3df73b)['union'](_0x52eb23)[_0x904c('0x92')]()[_0x904c('0x93')]();return db[_0x904c('0x52')][_0x904c('0x5a')]({'where':{'id':_0xdf712f[_0x904c('0x57')]['id']}})[_0x904c('0x22')](function(_0x22ca4a){return db['sequelize'][_0x904c('0x7d')](function(_0x21d289){return _0x22ca4a[_0x904c('0x94')](_0xdf712f[_0x904c('0x44')][_0x904c('0x95')],{'transaction':_0x21d289})[_0x904c('0x22')](function(){if(!_[_0x904c('0x96')](_0x3df73b)){return _0x22ca4a[_0x904c('0x97')](_0x3df73b,{'transaction':_0x21d289});}})[_0x904c('0x22')](function(){_0x3df73b[_0x904c('0x98')](function(_0x289ad3){socket[_0x904c('0x99')](_0x904c('0x9a'),{'UserId':_0x289ad3,'ChatQueueId':_0x22ca4a['id']});});});});});});})[_0x904c('0x22')](respondWithStatusCode(_0x559aaa,null))['catch'](handleError(_0x559aaa,null));};exports[_0x904c('0x9b')]=function(_0x567400,_0x54a2dc,_0x106bbf){return db[_0x904c('0x52')]['find']({'where':{'id':_0x567400[_0x904c('0x57')]['id']}})[_0x904c('0x22')](handleEntityNotFound(_0x54a2dc,null))['then'](function(_0x5355e3){if(_0x5355e3){return _0x5355e3['addAgents'](_0x567400[_0x904c('0x63')]['ids'],_['omit'](_0x567400[_0x904c('0x63')],[_0x904c('0x95'),'id'])||{})['spread'](function(_0x1b4783){for(var _0x1c4766=0x0;_0x1c4766<_0x567400[_0x904c('0x63')]['ids'][_0x904c('0x58')];_0x1c4766+=0x1){socket[_0x904c('0x99')](_0x904c('0x80'),{'UserId':_0x567400['body'][_0x904c('0x95')][_0x1c4766],'ChatQueueId':_0x567400[_0x904c('0x57')]['id']});}return _0x1b4783;});}})[_0x904c('0x22')](respondWithResult(_0x54a2dc,null))[_0x904c('0x2c')](handleError(_0x54a2dc,null));};exports['removeAgents']=function(_0x57914e,_0x40371b,_0x14314f){return db[_0x904c('0x52')]['find']({'where':{'id':_0x57914e[_0x904c('0x57')]['id']}})[_0x904c('0x22')](handleEntityNotFound(_0x40371b,null))[_0x904c('0x22')](function(_0x44d2b3){if(_0x44d2b3){return _0x44d2b3[_0x904c('0x97')](_0x57914e[_0x904c('0x44')][_0x904c('0x95')])[_0x904c('0x22')](function(){if(_[_0x904c('0x9c')](_0x57914e[_0x904c('0x44')]['ids'])){for(var _0x185f1e=0x0;_0x185f1e<_0x57914e[_0x904c('0x44')][_0x904c('0x95')]['length'];_0x185f1e+=0x1){socket[_0x904c('0x99')]('userChatQueue:remove',{'UserId':Number(_0x57914e[_0x904c('0x44')][_0x904c('0x95')][_0x185f1e]),'ChatQueueId':Number(_0x57914e[_0x904c('0x57')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x57914e[_0x904c('0x44')][_0x904c('0x95')]),'ChatQueueId':Number(_0x57914e[_0x904c('0x57')]['id'])});}});}})[_0x904c('0x22')](respondWithStatusCode(_0x40371b,null))[_0x904c('0x2c')](handleError(_0x40371b,null));};exports[_0x904c('0x9d')]=function(_0x3d4464,_0x342d8e,_0x512387){var _0x4d0331={};var _0x292698={};var _0x399ef8;var _0x27365a;return db[_0x904c('0x52')][_0x904c('0x66')]({'where':{'id':_0x3d4464['params']['id']}})['then'](handleEntityNotFound(_0x342d8e,null))[_0x904c('0x22')](function(_0x14ce47){if(_0x14ce47){_0x399ef8=_0x14ce47;_0x292698[_0x904c('0x43')]=_['keys'](db[_0x904c('0x6a')][_0x904c('0x3f')]);_0x292698[_0x904c('0x44')]=_[_0x904c('0x45')](_0x3d4464[_0x904c('0x44')]);_0x292698[_0x904c('0x46')]=_[_0x904c('0x47')](_0x292698[_0x904c('0x43')],_0x292698[_0x904c('0x44')]);_0x4d0331[_0x904c('0x49')]=_[_0x904c('0x47')](_0x292698[_0x904c('0x43')],qs[_0x904c('0x48')](_0x3d4464[_0x904c('0x44')][_0x904c('0x48')]));_0x4d0331[_0x904c('0x49')]=_0x4d0331[_0x904c('0x49')][_0x904c('0x58')]?_0x4d0331[_0x904c('0x49')]:_0x292698[_0x904c('0x43')];_0x4d0331[_0x904c('0x4c')]=qs[_0x904c('0x4d')](_0x3d4464[_0x904c('0x44')][_0x904c('0x4d')]);_0x4d0331[_0x904c('0x4e')]=qs[_0x904c('0x46')](_[_0x904c('0x68')](_0x3d4464[_0x904c('0x44')],_0x292698['filters']));if(_0x3d4464[_0x904c('0x44')]['filter']){_0x4d0331[_0x904c('0x4e')]=_[_0x904c('0x50')](_0x4d0331[_0x904c('0x4e')],{'$or':_['map'](_0x4d0331['attributes'],function(_0x331620){var _0x585b02={};_0x585b02[_0x331620]={'$like':'%'+_0x3d4464[_0x904c('0x44')][_0x904c('0x4f')]+'%'};return _0x585b02;})});}_0x4d0331=_[_0x904c('0x50')]({},_0x4d0331,_0x3d4464[_0x904c('0x59')]);return _0x399ef8['getAgents'](_0x4d0331);}})[_0x904c('0x22')](function(_0x519094){if(_0x519094){_0x27365a=_0x519094[_0x904c('0x58')];if(!_0x3d4464['query'][_0x904c('0x4a')](_0x904c('0x4b'))){_0x4d0331[_0x904c('0x33')]=qs[_0x904c('0x33')](_0x3d4464[_0x904c('0x44')][_0x904c('0x33')]);_0x4d0331[_0x904c('0x32')]=qs[_0x904c('0x32')](_0x3d4464[_0x904c('0x44')][_0x904c('0x32')]);}return _0x399ef8[_0x904c('0x9d')](_0x4d0331);}})[_0x904c('0x22')](function(_0x5422d1){if(_0x5422d1){return _0x5422d1?{'count':_0x27365a,'rows':_0x5422d1}:null;}})[_0x904c('0x22')](respondWithResult(_0x342d8e,null))['catch'](handleError(_0x342d8e,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 7a2bda5..faf2351 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1806ed,_0x5090de){var _0x31884f=function(_0x461d06){while(--_0x461d06){_0x1806ed['push'](_0x1806ed['shift']());}};_0x31884f(++_0x5090de);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3b2be5,_0x9c01ae){_0x3b2be5=_0x3b2be5-0x0;var _0x14cd8=_0x0b0e[_0x3b2be5];return _0x14cd8;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0xadb5,0xad));var _0x5adb=function(_0x443291,_0x19f20f){_0x443291=_0x443291-0x0;var _0x3168f9=_0xadb5[_0x443291];return _0x3168f9;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5adb('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatQueueEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatQueueEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatQueue[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 304e509..7e3bee1 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 _0x12de=['ChatQueue','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0x4c6edd,_0x158e0d){var _0x55be00=function(_0x15859f){while(--_0x15859f){_0x4c6edd['push'](_0x4c6edd['shift']());}};_0x55be00(++_0x158e0d);}(_0x12de,0x1d5));var _0xe12d=function(_0x3a49c9,_0x186a07){_0x3a49c9=_0x3a49c9-0x0;var _0x2d98b3=_0x12de[_0x3a49c9];return _0x2d98b3;};'use strict';var _=require(_0xe12d('0x0'));var util=require(_0xe12d('0x1'));var logger=require(_0xe12d('0x2'))(_0xe12d('0x3'));var moment=require('moment');var BPromise=require(_0xe12d('0x4'));var rp=require(_0xe12d('0x5'));var fs=require('fs');var path=require(_0xe12d('0x6'));var rimraf=require(_0xe12d('0x7'));var config=require(_0xe12d('0x8'));var attributes=require(_0xe12d('0x9'));module[_0xe12d('0xa')]=function(_0x5500d3,_0x47b233){return _0x5500d3['define'](_0xe12d('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c3c=['chat_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatQueue'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8c3c,0xa6));var _0xc8c3=function(_0x448cf3,_0x371ced){_0x448cf3=_0x448cf3-0x0;var _0x545739=_0x8c3c[_0x448cf3];return _0x545739;};'use strict';var _=require(_0xc8c3('0x0'));var util=require(_0xc8c3('0x1'));var logger=require(_0xc8c3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc8c3('0x3'));var rp=require(_0xc8c3('0x4'));var fs=require('fs');var path=require(_0xc8c3('0x5'));var rimraf=require(_0xc8c3('0x6'));var config=require(_0xc8c3('0x7'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x32eebb,_0x4fbae8){return _0x32eebb[_0xc8c3('0x8')](_0xc8c3('0x9'),attributes,{'tableName':_0xc8c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 815e2fa..d2b6db5 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 _0x4c4d=['raw','where','attributes','limit','include','model','map','GetChatQueue','stringify','find','ShowChatQueue','lodash','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','error','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','options'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x2f37e0,_0x393ef9){_0x2f37e0=_0x2f37e0-0x0;var _0x43ccce=_0x4c4d[_0x2f37e0];return _0x43ccce;};'use strict';var _=require(_0xd4c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4c4('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4c4('0x2'));var logger=require(_0xd4c4('0x3'))(_0xd4c4('0x4'));var config=require(_0xd4c4('0x5'));var jayson=require(_0xd4c4('0x6'));var client=jayson[_0xd4c4('0x7')]['http']({'port':0x232a});config[_0xd4c4('0x8')]=_[_0xd4c4('0x9')](config[_0xd4c4('0x8')],{'host':_0xd4c4('0xa'),'port':0x18eb});var socket=require(_0xd4c4('0xb'))(new Redis(config['redis']));require(_0xd4c4('0xc'))[_0xd4c4('0xd')](socket);function respondWithRpcPromise(_0xee7e59,_0x32370d,_0x3a3dc9){return new BPromise(function(_0x2e6360,_0x1696bf){return client[_0xd4c4('0xe')](_0xee7e59,_0x3a3dc9)[_0xd4c4('0xf')](function(_0x49a291){logger[_0xd4c4('0x10')]('ChatQueue,\x20%s,\x20%s',_0x32370d,_0xd4c4('0x11'));logger[_0xd4c4('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x32370d,_0xd4c4('0x11'),JSON['stringify'](_0x49a291));if(_0x49a291['error']){if(_0x49a291['error']['code']===0x1f4){logger[_0xd4c4('0x13')](_0xd4c4('0x14'),_0x32370d,_0x49a291['error'][_0xd4c4('0x15')]);return _0x1696bf(_0x49a291[_0xd4c4('0x13')][_0xd4c4('0x15')]);}logger[_0xd4c4('0x13')](_0xd4c4('0x14'),_0x32370d,_0x49a291[_0xd4c4('0x13')][_0xd4c4('0x15')]);return _0x2e6360(_0x49a291[_0xd4c4('0x13')][_0xd4c4('0x15')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x32370d,_0xd4c4('0x11'));_0x2e6360(_0x49a291[_0xd4c4('0x16')][_0xd4c4('0x15')]);}})[_0xd4c4('0x17')](function(_0x38170d){logger['error'](_0xd4c4('0x14'),_0x32370d,_0x38170d);_0x1696bf(_0x38170d);});});}exports['GetChatQueue']=function(_0x2109a5){var _0xaa596=this;return new Promise(function(_0x579554,_0x20224b){return db[_0xd4c4('0x18')]['findAll']({'raw':_0x2109a5[_0xd4c4('0x19')]?_0x2109a5[_0xd4c4('0x19')][_0xd4c4('0x1a')]===undefined?!![]:![]:!![],'where':_0x2109a5['options']?_0x2109a5[_0xd4c4('0x19')][_0xd4c4('0x1b')]||null:null,'attributes':_0x2109a5['options']?_0x2109a5['options'][_0xd4c4('0x1c')]||null:null,'limit':_0x2109a5[_0xd4c4('0x19')]?_0x2109a5['options'][_0xd4c4('0x1d')]||null:null,'include':_0x2109a5[_0xd4c4('0x19')]?_0x2109a5['options'][_0xd4c4('0x1e')]?_['map'](_0x2109a5[_0xd4c4('0x19')][_0xd4c4('0x1e')],function(_0x2cb2db){return{'model':db[_0x2cb2db[_0xd4c4('0x1f')]],'as':_0x2cb2db['as'],'attributes':_0x2cb2db[_0xd4c4('0x1c')],'include':_0x2cb2db['include']?_['map'](_0x2cb2db[_0xd4c4('0x1e')],function(_0x5781ed){return{'model':db[_0x5781ed['model']],'as':_0x5781ed['as'],'attributes':_0x5781ed['attributes'],'include':_0x5781ed['include']?_[_0xd4c4('0x20')](_0x5781ed[_0xd4c4('0x1e')],function(_0x416c3f){return{'model':db[_0x416c3f['model']],'as':_0x416c3f['as'],'attributes':_0x416c3f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4c4('0xf')](function(_0x2c7654){logger[_0xd4c4('0x10')](_0xd4c4('0x21'),_0x2109a5);logger[_0xd4c4('0x12')]('GetChatQueue',_0x2109a5,JSON[_0xd4c4('0x22')](_0x2c7654));_0x579554(_0x2c7654);})[_0xd4c4('0x17')](function(_0x4d48bb){logger['error']('GetChatQueue',_0x4d48bb[_0xd4c4('0x15')],_0x2109a5);_0x20224b(_0xaa596['error'](0x1f4,_0x4d48bb[_0xd4c4('0x15')]));});});};exports['ShowChatQueue']=function(_0x3333cb){var _0x5da0bc=this;return new Promise(function(_0x3d8329,_0x3164c3){return db[_0xd4c4('0x18')][_0xd4c4('0x23')]({'raw':_0x3333cb[_0xd4c4('0x19')]?_0x3333cb[_0xd4c4('0x19')][_0xd4c4('0x1a')]===undefined?!![]:![]:!![],'where':_0x3333cb['options']?_0x3333cb['options'][_0xd4c4('0x1b')]||null:null,'attributes':_0x3333cb[_0xd4c4('0x19')]?_0x3333cb[_0xd4c4('0x19')][_0xd4c4('0x1c')]||null:null,'include':_0x3333cb['options']?_0x3333cb['options'][_0xd4c4('0x1e')]?_['map'](_0x3333cb['options'][_0xd4c4('0x1e')],function(_0x3cdb33){return{'model':db[_0x3cdb33[_0xd4c4('0x1f')]],'as':_0x3cdb33['as'],'attributes':_0x3cdb33['attributes'],'include':_0x3cdb33['include']?_[_0xd4c4('0x20')](_0x3cdb33['include'],function(_0x5f56db){return{'model':db[_0x5f56db[_0xd4c4('0x1f')]],'as':_0x5f56db['as'],'attributes':_0x5f56db[_0xd4c4('0x1c')],'include':_0x5f56db[_0xd4c4('0x1e')]?_[_0xd4c4('0x20')](_0x5f56db[_0xd4c4('0x1e')],function(_0x51ba04){return{'model':db[_0x51ba04[_0xd4c4('0x1f')]],'as':_0x51ba04['as'],'attributes':_0x51ba04[_0xd4c4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd4c4('0xf')](function(_0x2c3ec4){logger['info'](_0xd4c4('0x24'),_0x3333cb);logger['debug'](_0xd4c4('0x24'),_0x3333cb,JSON[_0xd4c4('0x22')](_0x2c3ec4));_0x3d8329(_0x2c3ec4);})['catch'](function(_0x36a25b){logger['error'](_0xd4c4('0x24'),_0x36a25b['message'],_0x3333cb);_0x3164c3(_0x5da0bc[_0xd4c4('0x13')](0x1f4,_0x36a25b[_0xd4c4('0x15')]));});});}; \ No newline at end of file +var _0xd824=['where','attributes','limit','include','map','model','ShowChatQueue','find','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','GetChatQueue','ChatQueue','findAll','options','raw'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4d82('0x9')](config[_0x4d82('0xa')],{'host':_0x4d82('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d82('0xa')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x580bbd,_0x27b777,_0x392f17){return new BPromise(function(_0x480c05,_0x318d1d){return client['request'](_0x580bbd,_0x392f17)[_0x4d82('0xc')](function(_0x303645){logger[_0x4d82('0xd')]('ChatQueue,\x20%s,\x20%s',_0x27b777,'request\x20sent');logger[_0x4d82('0xe')](_0x4d82('0xf'),_0x27b777,_0x4d82('0x10'),JSON[_0x4d82('0x11')](_0x303645));if(_0x303645['error']){if(_0x303645[_0x4d82('0x12')][_0x4d82('0x13')]===0x1f4){logger[_0x4d82('0x12')]('ChatQueue,\x20%s,\x20%s',_0x27b777,_0x303645[_0x4d82('0x12')]['message']);return _0x318d1d(_0x303645[_0x4d82('0x12')]['message']);}logger[_0x4d82('0x12')]('ChatQueue,\x20%s,\x20%s',_0x27b777,_0x303645[_0x4d82('0x12')][_0x4d82('0x14')]);return _0x480c05(_0x303645[_0x4d82('0x12')][_0x4d82('0x14')]);}else{logger[_0x4d82('0xd')](_0x4d82('0x15'),_0x27b777,_0x4d82('0x10'));_0x480c05(_0x303645[_0x4d82('0x16')][_0x4d82('0x14')]);}})['catch'](function(_0x2919b0){logger[_0x4d82('0x12')](_0x4d82('0x15'),_0x27b777,_0x2919b0);_0x318d1d(_0x2919b0);});});}exports[_0x4d82('0x17')]=function(_0xe6260){var _0xd5f47=this;return new Promise(function(_0x1a513d,_0x64669c){return db[_0x4d82('0x18')][_0x4d82('0x19')]({'raw':_0xe6260[_0x4d82('0x1a')]?_0xe6260['options'][_0x4d82('0x1b')]===undefined?!![]:![]:!![],'where':_0xe6260[_0x4d82('0x1a')]?_0xe6260['options'][_0x4d82('0x1c')]||null:null,'attributes':_0xe6260[_0x4d82('0x1a')]?_0xe6260[_0x4d82('0x1a')][_0x4d82('0x1d')]||null:null,'limit':_0xe6260[_0x4d82('0x1a')]?_0xe6260[_0x4d82('0x1a')][_0x4d82('0x1e')]||null:null,'include':_0xe6260[_0x4d82('0x1a')]?_0xe6260[_0x4d82('0x1a')][_0x4d82('0x1f')]?_[_0x4d82('0x20')](_0xe6260[_0x4d82('0x1a')][_0x4d82('0x1f')],function(_0x284c66){return{'model':db[_0x284c66[_0x4d82('0x21')]],'as':_0x284c66['as'],'attributes':_0x284c66['attributes'],'include':_0x284c66['include']?_[_0x4d82('0x20')](_0x284c66[_0x4d82('0x1f')],function(_0x2a0572){return{'model':db[_0x2a0572[_0x4d82('0x21')]],'as':_0x2a0572['as'],'attributes':_0x2a0572['attributes'],'include':_0x2a0572[_0x4d82('0x1f')]?_[_0x4d82('0x20')](_0x2a0572[_0x4d82('0x1f')],function(_0x11d022){return{'model':db[_0x11d022['model']],'as':_0x11d022['as'],'attributes':_0x11d022[_0x4d82('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d9ac4){logger['info']('GetChatQueue',_0xe6260);logger[_0x4d82('0xe')](_0x4d82('0x17'),_0xe6260,JSON[_0x4d82('0x11')](_0x4d9ac4));_0x1a513d(_0x4d9ac4);})['catch'](function(_0x713c56){logger[_0x4d82('0x12')]('GetChatQueue',_0x713c56['message'],_0xe6260);_0x64669c(_0xd5f47[_0x4d82('0x12')](0x1f4,_0x713c56[_0x4d82('0x14')]));});});};exports[_0x4d82('0x22')]=function(_0x175961){var _0x5447f8=this;return new Promise(function(_0x33d2a9,_0x59cd4f){return db[_0x4d82('0x18')][_0x4d82('0x23')]({'raw':_0x175961['options']?_0x175961['options'][_0x4d82('0x1b')]===undefined?!![]:![]:!![],'where':_0x175961[_0x4d82('0x1a')]?_0x175961[_0x4d82('0x1a')][_0x4d82('0x1c')]||null:null,'attributes':_0x175961[_0x4d82('0x1a')]?_0x175961[_0x4d82('0x1a')][_0x4d82('0x1d')]||null:null,'include':_0x175961[_0x4d82('0x1a')]?_0x175961[_0x4d82('0x1a')][_0x4d82('0x1f')]?_['map'](_0x175961[_0x4d82('0x1a')][_0x4d82('0x1f')],function(_0x34bd5f){return{'model':db[_0x34bd5f['model']],'as':_0x34bd5f['as'],'attributes':_0x34bd5f[_0x4d82('0x1d')],'include':_0x34bd5f[_0x4d82('0x1f')]?_['map'](_0x34bd5f[_0x4d82('0x1f')],function(_0x11d8c3){return{'model':db[_0x11d8c3[_0x4d82('0x21')]],'as':_0x11d8c3['as'],'attributes':_0x11d8c3['attributes'],'include':_0x11d8c3[_0x4d82('0x1f')]?_[_0x4d82('0x20')](_0x11d8c3['include'],function(_0x203f79){return{'model':db[_0x203f79['model']],'as':_0x203f79['as'],'attributes':_0x203f79[_0x4d82('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0xc')](function(_0x504557){logger[_0x4d82('0xd')]('ShowChatQueue',_0x175961);logger[_0x4d82('0xe')]('ShowChatQueue',_0x175961,JSON['stringify'](_0x504557));_0x33d2a9(_0x504557);})[_0x4d82('0x24')](function(_0x51ff9e){logger[_0x4d82('0x12')]('ShowChatQueue',_0x51ff9e[_0x4d82('0x14')],_0x175961);_0x59cd4f(_0x5447f8[_0x4d82('0x12')](0x1f4,_0x51ff9e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 570ddb0..3040432 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(_0x14ec75,_0x56a3d4){var _0x40b9e9=function(_0x4d2f39){while(--_0x4d2f39){_0x14ec75['push'](_0x14ec75['shift']());}};_0x40b9e9(++_0x56a3d4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3bc639,_0x2374e3){_0x3bc639=_0x3bc639-0x0;var _0x560afc=_0x5f2f[_0x3bc639];return _0x560afc;};'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(_0x4a0f11,_0x41d80b){var _0x2e9592=function(_0x2a21e7){while(--_0x2a21e7){_0x4a0f11['push'](_0x4a0f11['shift']());}};_0x2e9592(++_0x41d80b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 a836b6b..be9d12b 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 _0x80b5=['removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','create','post','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x80b5,0x17b));var _0x580b=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x80b5[_0x13f980];return _0x27153c;};'use strict';var multer=require('multer');var util=require(_0x580b('0x0'));var path=require(_0x580b('0x1'));var timeout=require(_0x580b('0x2'));var express=require(_0x580b('0x3'));var router=express[_0x580b('0x4')]();var auth=require(_0x580b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x580b('0x6'));var controller=require('./chatQueue.controller');router['get']('/',auth[_0x580b('0x7')](),controller[_0x580b('0x8')]);router[_0x580b('0x9')](_0x580b('0xa'),auth[_0x580b('0x7')](),controller[_0x580b('0xb')]);router[_0x580b('0x9')](_0x580b('0xc'),auth[_0x580b('0x7')](),controller['show']);router[_0x580b('0x9')](_0x580b('0xd'),auth[_0x580b('0x7')](),controller[_0x580b('0xe')]);router[_0x580b('0x9')](_0x580b('0xf'),auth[_0x580b('0x7')](),controller[_0x580b('0x10')]);router[_0x580b('0x9')]('/:id/users',auth[_0x580b('0x7')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x580b('0x11')]);router[_0x580b('0x12')](_0x580b('0xf'),auth[_0x580b('0x7')](),controller[_0x580b('0x13')]);router[_0x580b('0x12')](_0x580b('0x14'),auth[_0x580b('0x7')](),controller[_0x580b('0x15')]);router[_0x580b('0x16')](_0x580b('0xc'),auth[_0x580b('0x7')](),controller[_0x580b('0x17')]);router[_0x580b('0x18')](_0x580b('0xc'),auth[_0x580b('0x7')](),controller[_0x580b('0x19')]);router['delete']('/:id/teams',auth[_0x580b('0x7')](),controller[_0x580b('0x1a')]);router[_0x580b('0x18')]('/:id/users',auth[_0x580b('0x7')](),controller[_0x580b('0x1b')]);module[_0x580b('0x1c')]=router; \ No newline at end of file +var _0x9517=['removeTeams','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete'];(function(_0x37376e,_0x247d16){var _0x107c23=function(_0x40004a){while(--_0x40004a){_0x37376e['push'](_0x37376e['shift']());}};_0x107c23(++_0x247d16);}(_0x9517,0xca));var _0x7951=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9517[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x7951('0x0'));var util=require(_0x7951('0x1'));var path=require(_0x7951('0x2'));var timeout=require(_0x7951('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7951('0x4'));var config=require(_0x7951('0x5'));var controller=require('./chatQueue.controller');router[_0x7951('0x6')]('/',auth[_0x7951('0x7')](),controller['index']);router[_0x7951('0x6')](_0x7951('0x8'),auth[_0x7951('0x7')](),controller['describe']);router[_0x7951('0x6')](_0x7951('0x9'),auth[_0x7951('0x7')](),controller[_0x7951('0xa')]);router[_0x7951('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0x7951('0xb')]);router['get'](_0x7951('0xc'),auth[_0x7951('0x7')](),controller[_0x7951('0xd')]);router['get'](_0x7951('0xe'),auth[_0x7951('0x7')](),controller[_0x7951('0xf')]);router[_0x7951('0x10')]('/',auth[_0x7951('0x7')](),controller[_0x7951('0x11')]);router[_0x7951('0x10')](_0x7951('0xc'),auth[_0x7951('0x7')](),controller[_0x7951('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x7951('0x13')]);router[_0x7951('0x14')]('/:id',auth[_0x7951('0x7')](),controller[_0x7951('0x15')]);router[_0x7951('0x16')](_0x7951('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x7951('0x16')](_0x7951('0xc'),auth[_0x7951('0x7')](),controller[_0x7951('0x17')]);router[_0x7951('0x16')](_0x7951('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x7951('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index a311b91..8be8f56 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 _0x91ce=['DATE','moment','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91ce,0x171));var _0xe91c=function(_0x2ee974,_0x1cceb5){_0x2ee974=_0x2ee974-0x0;var _0x20c5fb=_0x91ce[_0x2ee974];return _0x20c5fb;};'use strict';var moment=require(_0xe91c('0x0'));var Sequelize=require(_0xe91c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe91c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe91c('0x2')]},'joinAt':{'type':Sequelize[_0xe91c('0x3')]},'leaveAt':{'type':Sequelize[_0xe91c('0x3')]},'acceptAt':{'type':Sequelize[_0xe91c('0x3')]},'exitAt':{'type':Sequelize[_0xe91c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdf8c=['exports','STRING','DATE','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf8c,0x17b));var _0xcdf8=function(_0x5008f9,_0x1e1bb5){_0x5008f9=_0x5008f9-0x0;var _0x11d0c0=_0xdf8c[_0x5008f9];return _0x11d0c0;};'use strict';var moment=require(_0xcdf8('0x0'));var Sequelize=require('sequelize');module[_0xcdf8('0x1')]={'uniqueid':{'type':Sequelize[_0xcdf8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcdf8('0x2')]},'joinAt':{'type':Sequelize[_0xcdf8('0x3')]},'leaveAt':{'type':Sequelize[_0xcdf8('0x3')]},'acceptAt':{'type':Sequelize[_0xcdf8('0x3')]},'exitAt':{'type':Sequelize[_0xcdf8('0x3')]},'reason':{'type':Sequelize[_0xcdf8('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 76b3afa..8c55d19 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 _0x757a=['count','findAll','rows','catch','params','keys','includeAll','include','create','body','find','describe','eml-format','rimraf','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','end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','VIRTUAL','options','ChatQueueReport'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x757a,0xde));var _0xa757=function(_0x551847,_0x54a87c){_0x551847=_0x551847-0x0;var _0x130f19=_0x757a[_0x551847];return _0x130f19;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56acfb,_0x4db68e){_0x4db68e=_0x4db68e||0xcc;return function(_0x421040){if(_0x421040){return _0x56acfb['sendStatus'](_0x4db68e);}return _0x56acfb['status'](_0x4db68e)[_0xa757('0x16')]();};}function respondWithResult(_0x513b1f,_0x481508){_0x481508=_0x481508||0xc8;return function(_0x32112b){if(_0x32112b){return _0x513b1f[_0xa757('0x17')](_0x481508)[_0xa757('0x18')](_0x32112b);}};}function respondWithFilteredResult(_0x4a0c38,_0x86abd){return function(_0x31cfd2){if(_0x31cfd2){var _0xf12b68=_0x31cfd2['count'],_0x2f7947=_0x86abd[_0xa757('0x19')],_0x185011=_0x86abd[_0xa757('0x19')]+_0x86abd[_0xa757('0x1a')],_0x3df1f9;if(_0x185011>=_0xf12b68){_0x185011=_0xf12b68;_0x3df1f9=0xc8;}else{_0x3df1f9=0xce;}_0x4a0c38['status'](_0x3df1f9);return _0x4a0c38['set'](_0xa757('0x1b'),_0x2f7947+'-'+_0x185011+'/'+_0xf12b68)[_0xa757('0x18')](_0x31cfd2);}return null;};}function patchUpdates(_0x1bd14c){return function(_0x340599){try{jsonpatch[_0xa757('0x1c')](_0x340599,_0x1bd14c,!![]);}catch(_0xe2d567){return BPromise['reject'](_0xe2d567);}return _0x340599[_0xa757('0x1d')]();};}function saveUpdates(_0x4fec52,_0x32c2a1){return function(_0x167640){if(_0x167640){return _0x167640[_0xa757('0x1e')](_0x4fec52)[_0xa757('0x1f')](function(_0x4d598c){return _0x4d598c;});}return null;};}function removeEntity(_0x5638c7,_0x40ec48){return function(_0x2159cf){if(_0x2159cf){return _0x2159cf[_0xa757('0x20')]()[_0xa757('0x1f')](function(){_0x5638c7[_0xa757('0x17')](0xcc)[_0xa757('0x16')]();});}};}function handleEntityNotFound(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(!_0x2bf276){_0x2ca10d['sendStatus'](0x194);}return _0x2bf276;};}function handleError(_0x3707c1,_0x59e9d4){_0x59e9d4=_0x59e9d4||0x1f4;return function(_0x422e9e){logger['error'](_0x422e9e[_0xa757('0x21')]);if(_0x422e9e[_0xa757('0x22')]){delete _0x422e9e[_0xa757('0x22')];}_0x3707c1['status'](_0x59e9d4)[_0xa757('0x23')](_0x422e9e);};}exports[_0xa757('0x24')]=function(_0x471e84,_0x3bf7f3){var _0x5b4779={},_0x449a7d={},_0x54263b={'count':0x0,'rows':[]};var _0x5a5664=_['map'](db['ChatQueueReport'][_0xa757('0x25')],function(_0x596ae2){return{'name':_0x596ae2[_0xa757('0x26')],'type':_0x596ae2[_0xa757('0x27')]['key']};});_0x449a7d[_0xa757('0x28')]=_['map'](_0x5a5664,_0xa757('0x22'));_0x449a7d[_0xa757('0x29')]=_['keys'](_0x471e84[_0xa757('0x29')]);_0x449a7d['filters']=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],_0x449a7d[_0xa757('0x29')]);_0x5b4779[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x471e84[_0xa757('0x29')][_0xa757('0x2c')]));_0x5b4779[_0xa757('0x2b')]=_0x5b4779[_0xa757('0x2b')][_0xa757('0x2d')]?_0x5b4779[_0xa757('0x2b')]:_0x449a7d[_0xa757('0x28')];if(!_0x471e84[_0xa757('0x29')][_0xa757('0x2e')](_0xa757('0x2f'))){_0x5b4779[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x471e84[_0xa757('0x29')][_0xa757('0x1a')]);_0x5b4779[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x471e84[_0xa757('0x29')]['offset']);}_0x5b4779[_0xa757('0x30')]=qs[_0xa757('0x31')](_0x471e84[_0xa757('0x29')][_0xa757('0x31')]);_0x5b4779[_0xa757('0x32')]=qs['filters'](_[_0xa757('0x33')](_0x471e84[_0xa757('0x29')],_0x449a7d[_0xa757('0x34')]),_0x5a5664);if(_0x471e84[_0xa757('0x29')][_0xa757('0x35')]){_0x5b4779[_0xa757('0x32')]=_['merge'](_0x5b4779[_0xa757('0x32')],{'$or':_[_0xa757('0x36')](_0x5a5664,function(_0x2cade7){if(_0x2cade7[_0xa757('0x27')]!==_0xa757('0x37')){var _0x111cfe={};_0x111cfe[_0x2cade7[_0xa757('0x22')]]={'$like':'%'+_0x471e84[_0xa757('0x29')][_0xa757('0x35')]+'%'};return _0x111cfe;}})});}_0x5b4779=_['merge']({},_0x5b4779,_0x471e84[_0xa757('0x38')]);var _0x34fba8={'where':_0x5b4779[_0xa757('0x32')]};return db[_0xa757('0x39')][_0xa757('0x3a')](_0x34fba8)[_0xa757('0x1f')](function(_0x501e26){_0x54263b[_0xa757('0x3a')]=_0x501e26;if(_0x471e84[_0xa757('0x29')]['includeAll']){_0x5b4779['include']=[{'all':!![]}];}return db[_0xa757('0x39')][_0xa757('0x3b')](_0x5b4779);})['then'](function(_0x51c3d1){_0x54263b[_0xa757('0x3c')]=_0x51c3d1;return _0x54263b;})[_0xa757('0x1f')](respondWithFilteredResult(_0x3bf7f3,_0x5b4779))[_0xa757('0x3d')](handleError(_0x3bf7f3,null));};exports['show']=function(_0x830dc4,_0x13a8f4){var _0x26802c={'raw':!![],'where':{'id':_0x830dc4[_0xa757('0x3e')]['id']}},_0x1ba399={};_0x1ba399['model']=_[_0xa757('0x3f')](db['ChatQueueReport']['rawAttributes']);_0x1ba399[_0xa757('0x29')]=_[_0xa757('0x3f')](_0x830dc4[_0xa757('0x29')]);_0x1ba399[_0xa757('0x34')]=_[_0xa757('0x2a')](_0x1ba399['model'],_0x1ba399['query']);_0x26802c[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x1ba399[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x830dc4[_0xa757('0x29')][_0xa757('0x2c')]));_0x26802c['attributes']=_0x26802c[_0xa757('0x2b')][_0xa757('0x2d')]?_0x26802c['attributes']:_0x1ba399[_0xa757('0x28')];if(_0x830dc4['query'][_0xa757('0x40')]){_0x26802c[_0xa757('0x41')]=[{'all':!![]}];}_0x26802c=_['merge']({},_0x26802c,_0x830dc4[_0xa757('0x38')]);return db[_0xa757('0x39')]['find'](_0x26802c)[_0xa757('0x1f')](handleEntityNotFound(_0x13a8f4,null))[_0xa757('0x1f')](respondWithResult(_0x13a8f4,null))[_0xa757('0x3d')](handleError(_0x13a8f4,null));};exports[_0xa757('0x42')]=function(_0x543b5b,_0x199dc9){return db[_0xa757('0x39')][_0xa757('0x42')](_0x543b5b[_0xa757('0x43')],{})['then'](respondWithResult(_0x199dc9,0xc9))[_0xa757('0x3d')](handleError(_0x199dc9,null));};exports['update']=function(_0x50c131,_0x2acf88){if(_0x50c131[_0xa757('0x43')]['id']){delete _0x50c131[_0xa757('0x43')]['id'];}return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x50c131['params']['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x2acf88,null))[_0xa757('0x1f')](saveUpdates(_0x50c131[_0xa757('0x43')],null))[_0xa757('0x1f')](respondWithResult(_0x2acf88,null))[_0xa757('0x3d')](handleError(_0x2acf88,null));};exports[_0xa757('0x20')]=function(_0x57bf73,_0x505cd){return db['ChatQueueReport'][_0xa757('0x44')]({'where':{'id':_0x57bf73[_0xa757('0x3e')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x505cd,null))[_0xa757('0x1f')](removeEntity(_0x505cd,null))[_0xa757('0x3d')](handleError(_0x505cd,null));};exports[_0xa757('0x45')]=function(_0x15bad7,_0x2c5b3c){return db[_0xa757('0x39')][_0xa757('0x45')]()[_0xa757('0x1f')](respondWithResult(_0x2c5b3c,null))[_0xa757('0x3d')](handleError(_0x2c5b3c,null));}; \ No newline at end of file +var _0xa9e0=['merge','options','include','findAll','catch','params','includeAll','create','body','find','describe','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL'];(function(_0x38507f,_0x36b871){var _0xf57247=function(_0x5e2b1b){while(--_0x5e2b1b){_0x38507f['push'](_0x38507f['shift']());}};_0xf57247(++_0x36b871);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x45')]=function(_0x3fe430,_0x4f7240){return db['ChatQueueReport']['describe']()[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,null))[_0x0a9e('0x3f')](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index dcd3f63..508deba 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 _0x764b=['bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x136a0d,_0x476fe2){var _0x212ea5=function(_0xa288e){while(--_0xa288e){_0x136a0d['push'](_0x136a0d['shift']());}};_0x212ea5(++_0x476fe2);}(_0x764b,0x19f));var _0xb764=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x764b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xb764('0x0'));var util=require(_0xb764('0x1'));var logger=require(_0xb764('0x2'))(_0xb764('0x3'));var moment=require(_0xb764('0x4'));var BPromise=require(_0xb764('0x5'));var rp=require(_0xb764('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb764('0x7'));var config=require(_0xb764('0x8'));var attributes=require(_0xb764('0x9'));module[_0xb764('0xa')]=function(_0x593fbd,_0x507301){return _0x593fbd[_0xb764('0xb')](_0xb764('0xc'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb764('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b8c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','uniqueid','util'];(function(_0x102da0,_0x539e28){var _0x41361c=function(_0x460e1d){while(--_0x460e1d){_0x102da0['push'](_0x102da0['shift']());}};_0x41361c(++_0x539e28);}(_0x2b8c,0x137));var _0xc2b8=function(_0x1ed5ee,_0x18b95a){_0x1ed5ee=_0x1ed5ee-0x0;var _0x3ca878=_0x2b8c[_0x1ed5ee];return _0x3ca878;};'use strict';var _=require('lodash');var util=require(_0xc2b8('0x0'));var logger=require(_0xc2b8('0x1'))(_0xc2b8('0x2'));var moment=require(_0xc2b8('0x3'));var BPromise=require(_0xc2b8('0x4'));var rp=require(_0xc2b8('0x5'));var fs=require('fs');var path=require(_0xc2b8('0x6'));var rimraf=require('rimraf');var config=require(_0xc2b8('0x7'));var attributes=require(_0xc2b8('0x8'));module[_0xc2b8('0x9')]=function(_0xcbbf0a,_0x57cebe){return _0xcbbf0a[_0xc2b8('0xa')](_0xc2b8('0xb'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0xc2b8('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 efbbea8..4baf7f2 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 _0x0647=['limit','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where'];(function(_0x1eed64,_0x1e8a13){var _0x63536f=function(_0xcb6b20){while(--_0xcb6b20){_0x1eed64['push'](_0x1eed64['shift']());}};_0x63536f(++_0x1e8a13);}(_0x0647,0x97));var _0x7064=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x0647[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x7064('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7064('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7064('0x2'));var db=require(_0x7064('0x3'))['db'];var utils=require(_0x7064('0x4'));var logger=require(_0x7064('0x5'))(_0x7064('0x6'));var config=require(_0x7064('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7064('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34d09d,_0x24b4cf,_0x5c90e0){return new BPromise(function(_0x4ee919,_0x57b25e){return client[_0x7064('0x9')](_0x34d09d,_0x5c90e0)[_0x7064('0xa')](function(_0x3e5856){logger[_0x7064('0xb')](_0x7064('0xc'),_0x24b4cf,'request\x20sent');logger[_0x7064('0xd')](_0x7064('0xe'),_0x24b4cf,_0x7064('0xf'),JSON[_0x7064('0x10')](_0x3e5856));if(_0x3e5856[_0x7064('0x11')]){if(_0x3e5856[_0x7064('0x11')]['code']===0x1f4){logger[_0x7064('0x11')](_0x7064('0xc'),_0x24b4cf,_0x3e5856[_0x7064('0x11')][_0x7064('0x12')]);return _0x57b25e(_0x3e5856[_0x7064('0x11')]['message']);}logger['error'](_0x7064('0xc'),_0x24b4cf,_0x3e5856[_0x7064('0x11')]['message']);return _0x4ee919(_0x3e5856[_0x7064('0x11')][_0x7064('0x12')]);}else{logger['info'](_0x7064('0xc'),_0x24b4cf,'request\x20sent');_0x4ee919(_0x3e5856[_0x7064('0x13')]['message']);}})[_0x7064('0x14')](function(_0x209bf2){logger[_0x7064('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x24b4cf,_0x209bf2);_0x57b25e(_0x209bf2);});});}exports[_0x7064('0x15')]=function(_0x447fd6){var _0x5baaa6=this;return new Promise(function(_0x100cad,_0x501286){return db[_0x7064('0x16')]['create'](_0x447fd6[_0x7064('0x17')],{'raw':_0x447fd6[_0x7064('0x18')]?_0x447fd6[_0x7064('0x18')][_0x7064('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x270636){logger[_0x7064('0xb')]('CreateChatQueueReport',_0x447fd6);logger[_0x7064('0xd')]('CreateChatQueueReport',_0x447fd6,JSON[_0x7064('0x10')](_0x270636));_0x100cad(_0x270636);})[_0x7064('0x14')](function(_0x11d4b5){logger[_0x7064('0x11')](_0x7064('0x15'),_0x11d4b5[_0x7064('0x12')],_0x447fd6);_0x501286(_0x5baaa6[_0x7064('0x11')](0x1f4,_0x11d4b5[_0x7064('0x12')]));});});};exports[_0x7064('0x1a')]=function(_0x435734){var _0x558446=this;return new Promise(function(_0x24a487,_0x58d981){return db['ChatQueueReport'][_0x7064('0x1b')](_0x435734['body'],{'raw':_0x435734[_0x7064('0x18')]?_0x435734[_0x7064('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x435734['options']?_0x435734[_0x7064('0x18')][_0x7064('0x1c')]||null:null,'attributes':_0x435734['options']?_0x435734['options']['attributes']||null:null,'limit':_0x435734['options']?_0x435734[_0x7064('0x18')][_0x7064('0x1d')]||null:null})[_0x7064('0xa')](function(_0x393409){logger[_0x7064('0xb')]('UpdateChatQueueReport',_0x435734);logger[_0x7064('0xd')](_0x7064('0x1a'),_0x435734,JSON[_0x7064('0x10')](_0x393409));_0x24a487(_0x393409);})[_0x7064('0x14')](function(_0x367539){logger[_0x7064('0x11')](_0x7064('0x1a'),_0x367539['message'],_0x435734);_0x58d981(_0x558446['error'](0x1f4,_0x367539[_0x7064('0x12')]));});});}; \ No newline at end of file +var _0x3099=['create','body','options','stringify','catch','update','raw','where','attributes','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateChatQueueReport','ChatQueueReport'];(function(_0x55d6b0,_0x3a0d7b){var _0x22792a=function(_0x9ad727){while(--_0x9ad727){_0x55d6b0['push'](_0x55d6b0['shift']());}};_0x22792a(++_0x3a0d7b);}(_0x3099,0x10a));var _0x9309=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3099[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9309('0x0'));var util=require(_0x9309('0x1'));var moment=require(_0x9309('0x2'));var BPromise=require(_0x9309('0x3'));var rs=require(_0x9309('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9309('0x5'))['db'];var utils=require(_0x9309('0x6'));var logger=require('../../config/logger')(_0x9309('0x7'));var config=require(_0x9309('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9309('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x134c85,_0x5ddb35,_0x209644){return new BPromise(function(_0x380f24,_0x1938eb){return client[_0x9309('0xa')](_0x134c85,_0x209644)[_0x9309('0xb')](function(_0x593dd4){logger[_0x9309('0xc')](_0x9309('0xd'),_0x5ddb35,_0x9309('0xe'));logger[_0x9309('0xf')](_0x9309('0x10'),_0x5ddb35,'request\x20sent',JSON['stringify'](_0x593dd4));if(_0x593dd4[_0x9309('0x11')]){if(_0x593dd4[_0x9309('0x11')]['code']===0x1f4){logger['error'](_0x9309('0xd'),_0x5ddb35,_0x593dd4['error'][_0x9309('0x12')]);return _0x1938eb(_0x593dd4[_0x9309('0x11')][_0x9309('0x12')]);}logger[_0x9309('0x11')](_0x9309('0xd'),_0x5ddb35,_0x593dd4[_0x9309('0x11')][_0x9309('0x12')]);return _0x380f24(_0x593dd4[_0x9309('0x11')][_0x9309('0x12')]);}else{logger[_0x9309('0xc')](_0x9309('0xd'),_0x5ddb35,_0x9309('0xe'));_0x380f24(_0x593dd4[_0x9309('0x13')][_0x9309('0x12')]);}})['catch'](function(_0x12917e){logger[_0x9309('0x11')](_0x9309('0xd'),_0x5ddb35,_0x12917e);_0x1938eb(_0x12917e);});});}exports[_0x9309('0x14')]=function(_0x393c61){var _0x3c9c3d=this;return new Promise(function(_0x258701,_0xce8d19){return db[_0x9309('0x15')][_0x9309('0x16')](_0x393c61[_0x9309('0x17')],{'raw':_0x393c61[_0x9309('0x18')]?_0x393c61[_0x9309('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4ccf90){logger[_0x9309('0xc')](_0x9309('0x14'),_0x393c61);logger[_0x9309('0xf')](_0x9309('0x14'),_0x393c61,JSON[_0x9309('0x19')](_0x4ccf90));_0x258701(_0x4ccf90);})[_0x9309('0x1a')](function(_0x531898){logger['error'](_0x9309('0x14'),_0x531898['message'],_0x393c61);_0xce8d19(_0x3c9c3d['error'](0x1f4,_0x531898[_0x9309('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x3ee0cb){var _0x25cf1d=this;return new Promise(function(_0x432c22,_0x515ac1){return db[_0x9309('0x15')][_0x9309('0x1b')](_0x3ee0cb['body'],{'raw':_0x3ee0cb[_0x9309('0x18')]?_0x3ee0cb[_0x9309('0x18')][_0x9309('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ee0cb[_0x9309('0x18')]?_0x3ee0cb[_0x9309('0x18')][_0x9309('0x1d')]||null:null,'attributes':_0x3ee0cb[_0x9309('0x18')]?_0x3ee0cb['options'][_0x9309('0x1e')]||null:null,'limit':_0x3ee0cb[_0x9309('0x18')]?_0x3ee0cb[_0x9309('0x18')]['limit']||null:null})[_0x9309('0xb')](function(_0x3d547d){logger['info']('UpdateChatQueueReport',_0x3ee0cb);logger[_0x9309('0xf')](_0x9309('0x1f'),_0x3ee0cb,JSON[_0x9309('0x19')](_0x3d547d));_0x432c22(_0x3d547d);})['catch'](function(_0x3ab03d){logger[_0x9309('0x11')]('UpdateChatQueueReport',_0x3ab03d['message'],_0x3ee0cb);_0x515ac1(_0x25cf1d[_0x9309('0x11')](0x1f4,_0x3ab03d[_0x9309('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e8d7f56..e028640 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 _0xd818=['describe','/:id','show','post','put','update','delete','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x59a7da,_0x24a045){var _0x579329=function(_0x20ef89){while(--_0x20ef89){_0x59a7da['push'](_0x59a7da['shift']());}};_0x579329(++_0x24a045);}(_0xd818,0x103));var _0x8d81=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0xd818[_0x2ca2d0];return _0x521c23;};'use strict';var multer=require(_0x8d81('0x0'));var util=require(_0x8d81('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8d81('0x2')]();var auth=require(_0x8d81('0x3'));var interaction=require(_0x8d81('0x4'));var config=require(_0x8d81('0x5'));var controller=require(_0x8d81('0x6'));router['get']('/',auth[_0x8d81('0x7')](),controller[_0x8d81('0x8')]);router[_0x8d81('0x9')](_0x8d81('0xa'),auth[_0x8d81('0x7')](),controller[_0x8d81('0xb')]);router[_0x8d81('0x9')](_0x8d81('0xc'),auth[_0x8d81('0x7')](),controller[_0x8d81('0xd')]);router[_0x8d81('0xe')]('/',auth[_0x8d81('0x7')](),controller['create']);router[_0x8d81('0xf')](_0x8d81('0xc'),auth[_0x8d81('0x7')](),controller[_0x8d81('0x10')]);router[_0x8d81('0x11')](_0x8d81('0xc'),auth[_0x8d81('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x63e9=['describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0xdb9a80,_0x2c33be){var _0xdac2f5=function(_0x3c71e1){while(--_0x3c71e1){_0xdb9a80['push'](_0xdb9a80['shift']());}};_0xdac2f5(++_0x2c33be);}(_0x63e9,0x6d));var _0x963e=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x63e9[_0x3a2e49];return _0x257140;};'use strict';var multer=require(_0x963e('0x0'));var util=require(_0x963e('0x1'));var path=require('path');var timeout=require(_0x963e('0x2'));var express=require('express');var router=express[_0x963e('0x3')]();var auth=require(_0x963e('0x4'));var interaction=require(_0x963e('0x5'));var config=require(_0x963e('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x963e('0x7')](),controller[_0x963e('0x8')]);router[_0x963e('0x9')](_0x963e('0xa'),auth[_0x963e('0x7')](),controller[_0x963e('0xb')]);router[_0x963e('0x9')](_0x963e('0xc'),auth[_0x963e('0x7')](),controller[_0x963e('0xd')]);router[_0x963e('0xe')]('/',auth[_0x963e('0x7')](),controller[_0x963e('0xf')]);router[_0x963e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x963e('0x11')]);router[_0x963e('0x12')](_0x963e('0xc'),auth[_0x963e('0x7')](),controller[_0x963e('0x13')]);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 de42b52..7abd9a9 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 _0x88e3=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x3b93bc,_0x581379){var _0x2a7fea=function(_0x28c135){while(--_0x28c135){_0x3b93bc['push'](_0x3b93bc['shift']());}};_0x2a7fea(++_0x581379);}(_0x88e3,0x1c6));var _0x388e=function(_0x1c461e,_0x1b98ff){_0x1c461e=_0x1c461e-0x0;var _0x1dce4f=_0x88e3[_0x1c461e];return _0x1dce4f;};'use strict';var moment=require('moment');var Sequelize=require(_0x388e('0x0'));module[_0x388e('0x1')]={'uniqueid':{'type':Sequelize[_0x388e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x388e('0x3')](_0x388e('0x4'),_0x388e('0x5'),_0x388e('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x388e('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x2264=['STRING','ENUM','account','agent','queue','NOW','moment','sequelize'];(function(_0x38a60b,_0x395cea){var _0x2eb8dc=function(_0x2c64d2){while(--_0x2c64d2){_0x38a60b['push'](_0x38a60b['shift']());}};_0x2eb8dc(++_0x395cea);}(_0x2264,0x196));var _0x4226=function(_0x3d7c94,_0x3546cd){_0x3d7c94=_0x3d7c94-0x0;var _0x525f0e=_0x2264[_0x3d7c94];return _0x525f0e;};'use strict';var moment=require(_0x4226('0x0'));var Sequelize=require(_0x4226('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x4226('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4226('0x3')](_0x4226('0x4'),_0x4226('0x5'),_0x4226('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4226('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1342792..9e5aebf 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 _0xbeab=['to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','body','params','describe','html-pdf','eml-format','request-promise','moment','util','path','sox','ejs','squel','crypto','jsforce','desk.js'];(function(_0x1f4f1c,_0x15a31d){var _0x4d4880=function(_0x59136a){while(--_0x59136a){_0x1f4f1c['push'](_0x1f4f1c['shift']());}};_0x4d4880(++_0x15a31d);}(_0xbeab,0x7e));var _0xbbea=function(_0x35653b,_0xd9b6f3){_0x35653b=_0x35653b-0x0;var _0x28ef17=_0xbeab[_0x35653b];return _0x28ef17;};'use strict';var pdf=require(_0xbbea('0x0'));var emlformat=require(_0xbbea('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbbea('0x2'));var moment=require(_0xbbea('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbbea('0x4'));var path=require(_0xbbea('0x5'));var sox=require(_0xbbea('0x6'));var csv=require('to-csv');var ejs=require(_0xbbea('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbbea('0x8'));var crypto=require(_0xbbea('0x9'));var jsforce=require(_0xbbea('0xa'));var deskjs=require(_0xbbea('0xb'));var toCsv=require(_0xbbea('0xc'));var querystring=require(_0xbbea('0xd'));var Papa=require('papaparse');var Redis=require(_0xbbea('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbbea('0xf'));var as=require(_0xbbea('0x10'));var hardwareService=require(_0xbbea('0x11'));var logger=require(_0xbbea('0x12'))('api');var utils=require(_0xbbea('0x13'));var config=require(_0xbbea('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x255302,_0x52c7ed){_0x52c7ed=_0x52c7ed||0xcc;return function(_0x33ae66){if(_0x33ae66){return _0x255302[_0xbbea('0x15')](_0x52c7ed);}return _0x255302['status'](_0x52c7ed)['end']();};}function respondWithResult(_0x54ad65,_0x38763e){_0x38763e=_0x38763e||0xc8;return function(_0x2f36be){if(_0x2f36be){return _0x54ad65[_0xbbea('0x16')](_0x38763e)[_0xbbea('0x17')](_0x2f36be);}};}function respondWithFilteredResult(_0x4aaccf,_0x89e31d){return function(_0x294378){if(_0x294378){var _0x4a9bc0=_0x294378[_0xbbea('0x18')],_0x5d56a0=_0x89e31d['offset'],_0x3a351a=_0x89e31d[_0xbbea('0x19')]+_0x89e31d['limit'],_0xe0a3b0;if(_0x3a351a>=_0x4a9bc0){_0x3a351a=_0x4a9bc0;_0xe0a3b0=0xc8;}else{_0xe0a3b0=0xce;}_0x4aaccf['status'](_0xe0a3b0);return _0x4aaccf[_0xbbea('0x1a')](_0xbbea('0x1b'),_0x5d56a0+'-'+_0x3a351a+'/'+_0x4a9bc0)[_0xbbea('0x17')](_0x294378);}return null;};}function patchUpdates(_0x3e51af){return function(_0x4c662d){try{jsonpatch[_0xbbea('0x1c')](_0x4c662d,_0x3e51af,!![]);}catch(_0x10cce9){return BPromise['reject'](_0x10cce9);}return _0x4c662d[_0xbbea('0x1d')]();};}function saveUpdates(_0x5e7da7,_0x14c83b){return function(_0x377273){if(_0x377273){return _0x377273[_0xbbea('0x1e')](_0x5e7da7)[_0xbbea('0x1f')](function(_0x20c5eb){return _0x20c5eb;});}return null;};}function removeEntity(_0x1f755c,_0x2a3718){return function(_0x4aad0e){if(_0x4aad0e){return _0x4aad0e[_0xbbea('0x20')]()[_0xbbea('0x1f')](function(){_0x1f755c[_0xbbea('0x16')](0xcc)[_0xbbea('0x21')]();});}};}function handleEntityNotFound(_0x4e0592,_0x35beaa){return function(_0x447f94){if(!_0x447f94){_0x4e0592[_0xbbea('0x15')](0x194);}return _0x447f94;};}function handleError(_0x58b33f,_0x1eed0e){_0x1eed0e=_0x1eed0e||0x1f4;return function(_0x45064d){logger[_0xbbea('0x22')](_0x45064d[_0xbbea('0x23')]);if(_0x45064d[_0xbbea('0x24')]){delete _0x45064d[_0xbbea('0x24')];}_0x58b33f[_0xbbea('0x16')](_0x1eed0e)[_0xbbea('0x25')](_0x45064d);};}exports[_0xbbea('0x26')]=function(_0x49d9cf,_0x39f7db){var _0x533d57={},_0xc67c32={},_0x225adb={'count':0x0,'rows':[]};var _0x2a0ea8=_['map'](db[_0xbbea('0x27')][_0xbbea('0x28')],function(_0x589a1f){return{'name':_0x589a1f[_0xbbea('0x29')],'type':_0x589a1f[_0xbbea('0x2a')][_0xbbea('0x2b')]};});_0xc67c32[_0xbbea('0x2c')]=_[_0xbbea('0x2d')](_0x2a0ea8,_0xbbea('0x24'));_0xc67c32['query']=_[_0xbbea('0x2e')](_0x49d9cf[_0xbbea('0x2f')]);_0xc67c32[_0xbbea('0x30')]=_[_0xbbea('0x31')](_0xc67c32[_0xbbea('0x2c')],_0xc67c32[_0xbbea('0x2f')]);_0x533d57[_0xbbea('0x32')]=_[_0xbbea('0x31')](_0xc67c32['model'],qs[_0xbbea('0x33')](_0x49d9cf[_0xbbea('0x2f')][_0xbbea('0x33')]));_0x533d57[_0xbbea('0x32')]=_0x533d57[_0xbbea('0x32')]['length']?_0x533d57['attributes']:_0xc67c32[_0xbbea('0x2c')];if(!_0x49d9cf['query']['hasOwnProperty']('nolimit')){_0x533d57[_0xbbea('0x34')]=qs[_0xbbea('0x34')](_0x49d9cf['query'][_0xbbea('0x34')]);_0x533d57[_0xbbea('0x19')]=qs[_0xbbea('0x19')](_0x49d9cf[_0xbbea('0x2f')][_0xbbea('0x19')]);}_0x533d57['order']=qs['sort'](_0x49d9cf['query'][_0xbbea('0x35')]);_0x533d57[_0xbbea('0x36')]=qs[_0xbbea('0x30')](_[_0xbbea('0x37')](_0x49d9cf[_0xbbea('0x2f')],_0xc67c32[_0xbbea('0x30')]),_0x2a0ea8);if(_0x49d9cf[_0xbbea('0x2f')][_0xbbea('0x38')]){_0x533d57[_0xbbea('0x36')]=_[_0xbbea('0x39')](_0x533d57[_0xbbea('0x36')],{'$or':_[_0xbbea('0x2d')](_0x2a0ea8,function(_0x5f4c5e){if(_0x5f4c5e[_0xbbea('0x2a')]!==_0xbbea('0x3a')){var _0x3f92de={};_0x3f92de[_0x5f4c5e[_0xbbea('0x24')]]={'$like':'%'+_0x49d9cf[_0xbbea('0x2f')][_0xbbea('0x38')]+'%'};return _0x3f92de;}})});}_0x533d57=_[_0xbbea('0x39')]({},_0x533d57,_0x49d9cf[_0xbbea('0x3b')]);var _0x78b6a1={'where':_0x533d57['where']};return db[_0xbbea('0x27')][_0xbbea('0x18')](_0x78b6a1)[_0xbbea('0x1f')](function(_0x5a9d39){_0x225adb[_0xbbea('0x18')]=_0x5a9d39;if(_0x49d9cf[_0xbbea('0x2f')][_0xbbea('0x3c')]){_0x533d57['include']=[{'all':!![]}];}return db[_0xbbea('0x27')][_0xbbea('0x3d')](_0x533d57);})['then'](function(_0x5a6273){_0x225adb[_0xbbea('0x3e')]=_0x5a6273;return _0x225adb;})['then'](respondWithFilteredResult(_0x39f7db,_0x533d57))[_0xbbea('0x3f')](handleError(_0x39f7db,null));};exports[_0xbbea('0x40')]=function(_0x1b1d12,_0x196651){var _0x2bce5f={'raw':!![],'where':{'id':_0x1b1d12['params']['id']}},_0x16f62f={};_0x16f62f[_0xbbea('0x2c')]=_[_0xbbea('0x2e')](db[_0xbbea('0x27')][_0xbbea('0x28')]);_0x16f62f[_0xbbea('0x2f')]=_[_0xbbea('0x2e')](_0x1b1d12['query']);_0x16f62f[_0xbbea('0x30')]=_[_0xbbea('0x31')](_0x16f62f['model'],_0x16f62f[_0xbbea('0x2f')]);_0x2bce5f[_0xbbea('0x32')]=_[_0xbbea('0x31')](_0x16f62f[_0xbbea('0x2c')],qs[_0xbbea('0x33')](_0x1b1d12[_0xbbea('0x2f')][_0xbbea('0x33')]));_0x2bce5f[_0xbbea('0x32')]=_0x2bce5f[_0xbbea('0x32')]['length']?_0x2bce5f[_0xbbea('0x32')]:_0x16f62f[_0xbbea('0x2c')];if(_0x1b1d12[_0xbbea('0x2f')][_0xbbea('0x3c')]){_0x2bce5f['include']=[{'all':!![]}];}_0x2bce5f=_[_0xbbea('0x39')]({},_0x2bce5f,_0x1b1d12[_0xbbea('0x3b')]);return db[_0xbbea('0x27')][_0xbbea('0x41')](_0x2bce5f)['then'](handleEntityNotFound(_0x196651,null))[_0xbbea('0x1f')](respondWithResult(_0x196651,null))['catch'](handleError(_0x196651,null));};exports['create']=function(_0x39b869,_0x45c9d5){return db[_0xbbea('0x27')]['create'](_0x39b869[_0xbbea('0x42')],{})[_0xbbea('0x1f')](respondWithResult(_0x45c9d5,0xc9))['catch'](handleError(_0x45c9d5,null));};exports[_0xbbea('0x1e')]=function(_0x246b2f,_0x9a6217){if(_0x246b2f[_0xbbea('0x42')]['id']){delete _0x246b2f['body']['id'];}return db[_0xbbea('0x27')][_0xbbea('0x41')]({'where':{'id':_0x246b2f[_0xbbea('0x43')]['id']}})['then'](handleEntityNotFound(_0x9a6217,null))[_0xbbea('0x1f')](saveUpdates(_0x246b2f[_0xbbea('0x42')],null))[_0xbbea('0x1f')](respondWithResult(_0x9a6217,null))[_0xbbea('0x3f')](handleError(_0x9a6217,null));};exports['destroy']=function(_0x329a1b,_0xe46c7){return db[_0xbbea('0x27')][_0xbbea('0x41')]({'where':{'id':_0x329a1b[_0xbbea('0x43')]['id']}})[_0xbbea('0x1f')](handleEntityNotFound(_0xe46c7,null))[_0xbbea('0x1f')](removeEntity(_0xe46c7,null))[_0xbbea('0x3f')](handleError(_0xe46c7,null));};exports[_0xbbea('0x44')]=function(_0x3ef6c7,_0x51b5ac){return db['ChatTransferReport'][_0xbbea('0x44')]()[_0xbbea('0x1f')](respondWithResult(_0x51b5ac,null))[_0xbbea('0x3f')](handleError(_0x51b5ac,null));}; \ No newline at end of file +var _0x753d=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','json','apply','reject','save','destroy','then','error','stack','name','send','map','ChatTransferReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick'];(function(_0x1f9f93,_0x28c9c8){var _0xfdd798=function(_0x5d27bc){while(--_0x5d27bc){_0x1f9f93['push'](_0x1f9f93['shift']());}};_0xfdd798(++_0x28c9c8);}(_0x753d,0x16d));var _0xd753=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x753d[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xd753('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd753('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd753('0x2'));var rp=require(_0xd753('0x3'));var moment=require(_0xd753('0x4'));var BPromise=require(_0xd753('0x5'));var Mustache=require(_0xd753('0x6'));var util=require('util');var path=require(_0xd753('0x7'));var sox=require('sox');var csv=require(_0xd753('0x8'));var ejs=require(_0xd753('0x9'));var fs=require('fs');var _=require(_0xd753('0xa'));var squel=require(_0xd753('0xb'));var crypto=require('crypto');var jsforce=require(_0xd753('0xc'));var deskjs=require(_0xd753('0xd'));var toCsv=require(_0xd753('0x8'));var querystring=require(_0xd753('0xe'));var Papa=require(_0xd753('0xf'));var Redis=require(_0xd753('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd753('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd753('0x12'))(_0xd753('0x13'));var utils=require(_0xd753('0x14'));var config=require('../../config/environment');var db=require(_0xd753('0x15'))['db'];function respondWithStatusCode(_0x47f27a,_0x52f2a8){_0x52f2a8=_0x52f2a8||0xcc;return function(_0x491495){if(_0x491495){return _0x47f27a[_0xd753('0x16')](_0x52f2a8);}return _0x47f27a['status'](_0x52f2a8)[_0xd753('0x17')]();};}function respondWithResult(_0x70f20b,_0x2eb7da){_0x2eb7da=_0x2eb7da||0xc8;return function(_0x3014a0){if(_0x3014a0){return _0x70f20b[_0xd753('0x18')](_0x2eb7da)['json'](_0x3014a0);}};}function respondWithFilteredResult(_0x15b3df,_0x23bf27){return function(_0x19f9b1){if(_0x19f9b1){var _0x4559c8=_0x19f9b1[_0xd753('0x19')],_0x25c0dd=_0x23bf27[_0xd753('0x1a')],_0x49a7a2=_0x23bf27['offset']+_0x23bf27[_0xd753('0x1b')],_0x403c43;if(_0x49a7a2>=_0x4559c8){_0x49a7a2=_0x4559c8;_0x403c43=0xc8;}else{_0x403c43=0xce;}_0x15b3df['status'](_0x403c43);return _0x15b3df['set']('Content-Range',_0x25c0dd+'-'+_0x49a7a2+'/'+_0x4559c8)[_0xd753('0x1c')](_0x19f9b1);}return null;};}function patchUpdates(_0x48767b){return function(_0x5df23f){try{jsonpatch[_0xd753('0x1d')](_0x5df23f,_0x48767b,!![]);}catch(_0x4a62f5){return BPromise[_0xd753('0x1e')](_0x4a62f5);}return _0x5df23f[_0xd753('0x1f')]();};}function saveUpdates(_0x5c3f19,_0x2a7004){return function(_0x662100){if(_0x662100){return _0x662100['update'](_0x5c3f19)['then'](function(_0x5b3762){return _0x5b3762;});}return null;};}function removeEntity(_0x377e3c,_0x2e4dbc){return function(_0x4f748d){if(_0x4f748d){return _0x4f748d[_0xd753('0x20')]()[_0xd753('0x21')](function(){_0x377e3c['status'](0xcc)[_0xd753('0x17')]();});}};}function handleEntityNotFound(_0x519306,_0x4e211e){return function(_0x1cd659){if(!_0x1cd659){_0x519306[_0xd753('0x16')](0x194);}return _0x1cd659;};}function handleError(_0x100314,_0x51daec){_0x51daec=_0x51daec||0x1f4;return function(_0x354c38){logger[_0xd753('0x22')](_0x354c38[_0xd753('0x23')]);if(_0x354c38[_0xd753('0x24')]){delete _0x354c38[_0xd753('0x24')];}_0x100314[_0xd753('0x18')](_0x51daec)[_0xd753('0x25')](_0x354c38);};}exports['index']=function(_0x3cda6f,_0x5989ab){var _0x29be6f={},_0x43dcc2={},_0x175ca9={'count':0x0,'rows':[]};var _0x5a865b=_[_0xd753('0x26')](db[_0xd753('0x27')][_0xd753('0x28')],function(_0x49500d){return{'name':_0x49500d['fieldName'],'type':_0x49500d[_0xd753('0x29')][_0xd753('0x2a')]};});_0x43dcc2[_0xd753('0x2b')]=_[_0xd753('0x26')](_0x5a865b,_0xd753('0x24'));_0x43dcc2[_0xd753('0x2c')]=_[_0xd753('0x2d')](_0x3cda6f[_0xd753('0x2c')]);_0x43dcc2['filters']=_[_0xd753('0x2e')](_0x43dcc2[_0xd753('0x2b')],_0x43dcc2[_0xd753('0x2c')]);_0x29be6f['attributes']=_[_0xd753('0x2e')](_0x43dcc2[_0xd753('0x2b')],qs[_0xd753('0x2f')](_0x3cda6f[_0xd753('0x2c')]['fields']));_0x29be6f[_0xd753('0x30')]=_0x29be6f[_0xd753('0x30')][_0xd753('0x31')]?_0x29be6f[_0xd753('0x30')]:_0x43dcc2[_0xd753('0x2b')];if(!_0x3cda6f['query']['hasOwnProperty'](_0xd753('0x32'))){_0x29be6f['limit']=qs[_0xd753('0x1b')](_0x3cda6f[_0xd753('0x2c')][_0xd753('0x1b')]);_0x29be6f[_0xd753('0x1a')]=qs[_0xd753('0x1a')](_0x3cda6f['query'][_0xd753('0x1a')]);}_0x29be6f['order']=qs[_0xd753('0x33')](_0x3cda6f[_0xd753('0x2c')]['sort']);_0x29be6f[_0xd753('0x34')]=qs[_0xd753('0x35')](_[_0xd753('0x36')](_0x3cda6f[_0xd753('0x2c')],_0x43dcc2[_0xd753('0x35')]),_0x5a865b);if(_0x3cda6f[_0xd753('0x2c')][_0xd753('0x37')]){_0x29be6f['where']=_[_0xd753('0x38')](_0x29be6f[_0xd753('0x34')],{'$or':_[_0xd753('0x26')](_0x5a865b,function(_0x5ca23f){if(_0x5ca23f[_0xd753('0x29')]!==_0xd753('0x39')){var _0x245512={};_0x245512[_0x5ca23f['name']]={'$like':'%'+_0x3cda6f[_0xd753('0x2c')]['filter']+'%'};return _0x245512;}})});}_0x29be6f=_['merge']({},_0x29be6f,_0x3cda6f[_0xd753('0x3a')]);var _0x2acd7e={'where':_0x29be6f[_0xd753('0x34')]};return db[_0xd753('0x27')]['count'](_0x2acd7e)[_0xd753('0x21')](function(_0x41b0b0){_0x175ca9['count']=_0x41b0b0;if(_0x3cda6f[_0xd753('0x2c')][_0xd753('0x3b')]){_0x29be6f[_0xd753('0x3c')]=[{'all':!![]}];}return db[_0xd753('0x27')][_0xd753('0x3d')](_0x29be6f);})['then'](function(_0x282ebb){_0x175ca9[_0xd753('0x3e')]=_0x282ebb;return _0x175ca9;})[_0xd753('0x21')](respondWithFilteredResult(_0x5989ab,_0x29be6f))[_0xd753('0x3f')](handleError(_0x5989ab,null));};exports[_0xd753('0x40')]=function(_0xc311a,_0x1fc9e2){var _0x94ba15={'raw':!![],'where':{'id':_0xc311a[_0xd753('0x41')]['id']}},_0x56a268={};_0x56a268[_0xd753('0x2b')]=_['keys'](db[_0xd753('0x27')][_0xd753('0x28')]);_0x56a268[_0xd753('0x2c')]=_['keys'](_0xc311a[_0xd753('0x2c')]);_0x56a268[_0xd753('0x35')]=_[_0xd753('0x2e')](_0x56a268[_0xd753('0x2b')],_0x56a268[_0xd753('0x2c')]);_0x94ba15['attributes']=_[_0xd753('0x2e')](_0x56a268[_0xd753('0x2b')],qs['fields'](_0xc311a[_0xd753('0x2c')][_0xd753('0x2f')]));_0x94ba15[_0xd753('0x30')]=_0x94ba15['attributes']['length']?_0x94ba15[_0xd753('0x30')]:_0x56a268[_0xd753('0x2b')];if(_0xc311a['query'][_0xd753('0x3b')]){_0x94ba15[_0xd753('0x3c')]=[{'all':!![]}];}_0x94ba15=_[_0xd753('0x38')]({},_0x94ba15,_0xc311a[_0xd753('0x3a')]);return db['ChatTransferReport'][_0xd753('0x42')](_0x94ba15)[_0xd753('0x21')](handleEntityNotFound(_0x1fc9e2,null))['then'](respondWithResult(_0x1fc9e2,null))[_0xd753('0x3f')](handleError(_0x1fc9e2,null));};exports[_0xd753('0x43')]=function(_0x16e90a,_0x504619){return db[_0xd753('0x27')][_0xd753('0x43')](_0x16e90a[_0xd753('0x44')],{})[_0xd753('0x21')](respondWithResult(_0x504619,0xc9))['catch'](handleError(_0x504619,null));};exports['update']=function(_0x2a3cc9,_0x5d36c0){if(_0x2a3cc9['body']['id']){delete _0x2a3cc9[_0xd753('0x44')]['id'];}return db['ChatTransferReport'][_0xd753('0x42')]({'where':{'id':_0x2a3cc9['params']['id']}})[_0xd753('0x21')](handleEntityNotFound(_0x5d36c0,null))[_0xd753('0x21')](saveUpdates(_0x2a3cc9[_0xd753('0x44')],null))['then'](respondWithResult(_0x5d36c0,null))['catch'](handleError(_0x5d36c0,null));};exports[_0xd753('0x20')]=function(_0x29489c,_0x5afd94){return db[_0xd753('0x27')]['find']({'where':{'id':_0x29489c[_0xd753('0x41')]['id']}})['then'](handleEntityNotFound(_0x5afd94,null))[_0xd753('0x21')](removeEntity(_0x5afd94,null))['catch'](handleError(_0x5afd94,null));};exports['describe']=function(_0x2204b2,_0x165676){return db[_0xd753('0x27')][_0xd753('0x45')]()[_0xd753('0x21')](respondWithResult(_0x165676,null))['catch'](handleError(_0x165676,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 45dc51b..49165ca 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 _0x6633=['exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x4d7bf0,_0x3ec9f6){var _0x39700a=function(_0x156dda){while(--_0x156dda){_0x4d7bf0['push'](_0x4d7bf0['shift']());}};_0x39700a(++_0x3ec9f6);}(_0x6633,0x116));var _0x3663=function(_0x6812e1,_0x4a69d3){_0x6812e1=_0x6812e1-0x0;var _0x356bcf=_0x6633[_0x6812e1];return _0x356bcf;};'use strict';var _=require(_0x3663('0x0'));var util=require(_0x3663('0x1'));var logger=require('../../config/logger')(_0x3663('0x2'));var moment=require(_0x3663('0x3'));var BPromise=require('bluebird');var rp=require(_0x3663('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3663('0x5'));var config=require(_0x3663('0x6'));var attributes=require(_0x3663('0x7'));module[_0x3663('0x8')]=function(_0x1fc3cd,_0x297b7e){return _0x1fc3cd[_0x3663('0x9')](_0x3663('0xa'),attributes,{'tableName':_0x3663('0xb'),'paranoid':![],'indexes':[{'name':_0x3663('0xc'),'fields':[_0x3663('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbacb=['report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x59f9cb,_0x34cea8){var _0xc6043d=function(_0x320144){while(--_0x320144){_0x59f9cb['push'](_0x59f9cb['shift']());}};_0xc6043d(++_0x34cea8);}(_0xbacb,0x1a6));var _0xbbac=function(_0x56b354,_0x5882c5){_0x56b354=_0x56b354-0x0;var _0x4ec539=_0xbacb[_0x56b354];return _0x4ec539;};'use strict';var _=require(_0xbbac('0x0'));var util=require(_0xbbac('0x1'));var logger=require('../../config/logger')(_0xbbac('0x2'));var moment=require(_0xbbac('0x3'));var BPromise=require(_0xbbac('0x4'));var rp=require(_0xbbac('0x5'));var fs=require('fs');var path=require(_0xbbac('0x6'));var rimraf=require(_0xbbac('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0xbbac('0x8')]=function(_0x2b9236,_0x210763){return _0x2b9236[_0xbbac('0x9')]('ChatTransferReport',attributes,{'tableName':_0xbbac('0xa'),'paranoid':![],'indexes':[{'name':_0xbbac('0xb'),'fields':[_0xbbac('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 272793d..2640304 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 _0x521e=['../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0x521e,0x101));var _0xe521=function(_0x465522,_0x27b025){_0x465522=_0x465522-0x0;var _0x42c683=_0x521e[_0x465522];return _0x42c683;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe521('0x0'));var BPromise=require(_0xe521('0x1'));var rs=require(_0xe521('0x2'));var fs=require('fs');var Redis=require(_0xe521('0x3'));var db=require(_0xe521('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe521('0x5'))(_0xe521('0x6'));var config=require(_0xe521('0x7'));var jayson=require(_0xe521('0x8'));var client=jayson[_0xe521('0x9')][_0xe521('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x414b24,_0x3e3622,_0x5dda6a){return new BPromise(function(_0x286c0b,_0x58087b){return client[_0xe521('0xb')](_0x414b24,_0x5dda6a)[_0xe521('0xc')](function(_0x25abde){logger['info'](_0xe521('0xd'),_0x3e3622,_0xe521('0xe'));logger[_0xe521('0xf')](_0xe521('0x10'),_0x3e3622,_0xe521('0xe'),JSON[_0xe521('0x11')](_0x25abde));if(_0x25abde['error']){if(_0x25abde[_0xe521('0x12')][_0xe521('0x13')]===0x1f4){logger[_0xe521('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x3e3622,_0x25abde[_0xe521('0x12')]['message']);return _0x58087b(_0x25abde[_0xe521('0x12')][_0xe521('0x14')]);}logger['error'](_0xe521('0xd'),_0x3e3622,_0x25abde['error']['message']);return _0x286c0b(_0x25abde[_0xe521('0x12')][_0xe521('0x14')]);}else{logger[_0xe521('0x15')]('ChatTransferReport,\x20%s,\x20%s',_0x3e3622,_0xe521('0xe'));_0x286c0b(_0x25abde[_0xe521('0x16')][_0xe521('0x14')]);}})[_0xe521('0x17')](function(_0x3fe959){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x3e3622,_0x3fe959);_0x58087b(_0x3fe959);});});} \ No newline at end of file +var _0x800c=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1d7490,_0x24b525){var _0x53862c=function(_0x468088){while(--_0x468088){_0x1d7490['push'](_0x1d7490['shift']());}};_0x53862c(++_0x24b525);}(_0x800c,0xa7));var _0xc800=function(_0x5dc10a,_0x4601a6){_0x5dc10a=_0x5dc10a-0x0;var _0x42006f=_0x800c[_0x5dc10a];return _0x42006f;};'use strict';var _=require(_0xc800('0x0'));var util=require(_0xc800('0x1'));var moment=require(_0xc800('0x2'));var BPromise=require(_0xc800('0x3'));var rs=require(_0xc800('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc800('0x5'))['db'];var utils=require(_0xc800('0x6'));var logger=require(_0xc800('0x7'))('rpc');var config=require(_0xc800('0x8'));var jayson=require(_0xc800('0x9'));var client=jayson[_0xc800('0xa')][_0xc800('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1edd67,_0x497bdc,_0x518994){return new BPromise(function(_0x50a974,_0xa2c12){return client[_0xc800('0xc')](_0x1edd67,_0x518994)[_0xc800('0xd')](function(_0x207ccb){logger[_0xc800('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x497bdc,_0xc800('0xf'));logger[_0xc800('0x10')](_0xc800('0x11'),_0x497bdc,_0xc800('0xf'),JSON[_0xc800('0x12')](_0x207ccb));if(_0x207ccb['error']){if(_0x207ccb[_0xc800('0x13')][_0xc800('0x14')]===0x1f4){logger['error'](_0xc800('0x15'),_0x497bdc,_0x207ccb[_0xc800('0x13')][_0xc800('0x16')]);return _0xa2c12(_0x207ccb[_0xc800('0x13')]['message']);}logger['error'](_0xc800('0x15'),_0x497bdc,_0x207ccb[_0xc800('0x13')]['message']);return _0x50a974(_0x207ccb[_0xc800('0x13')][_0xc800('0x16')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x497bdc,'request\x20sent');_0x50a974(_0x207ccb['result'][_0xc800('0x16')]);}})[_0xc800('0x17')](function(_0xddcbbd){logger[_0xc800('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x497bdc,_0xddcbbd);_0xa2c12(_0xddcbbd);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index f29ff71..a0100c5 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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x757a,0xde));var _0xa757=function(_0x19a6bd,_0x5d23cc){_0x19a6bd=_0x19a6bd-0x0;var _0xb42783=_0x757a[_0x19a6bd];return _0xb42783;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0x757a,0xde));var _0xa757=function(_0x4a4373,_0x762911){_0x4a4373=_0x4a4373-0x0;var _0x3d5875=_0x757a[_0x4a4373];return _0x3d5875;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 91e0b2e..51b8d7e 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 _0x1a64=['address','email','#9f946a','#ffffff','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','exports','STRING'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x1a64,0x16d));var _0x41a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a64[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x41a6('0x0'));var rs=require('randomstring');module[_0x41a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x41a6('0x2')],'allowNull':![],'unique':_0x41a6('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x4')},'mapKeyOffline':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x41a6('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x41a6('0x2')],'allowNull':![],'defaultValue':_0x41a6('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x41a6('0x2')],'allowNull':![],'defaultValue':_0x41a6('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x41a6('0x2')],'allowNull':![],'defaultValue':_0x41a6('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x41a6('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x41a6('0x7')](_0x41a6('0x8'),_0x41a6('0x9')),'defaultValue':_0x41a6('0x8')},'header_online':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x41a6('0xb')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0xc')},'download_transcript':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x41a6('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x41a6('0x10')]},'closingQuestion':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x41a6('0x13')},'noteTitle':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x14')},'closingMessageButton':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x15')},'skipMessageButton':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x16')},'conditionAgreement':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x17')},'ratingType':{'type':Sequelize[_0x41a6('0x7')](_0x41a6('0x18'),_0x41a6('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x41a6('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x41a6('0x10')],'defaultValue':function(){return JSON[_0x41a6('0x1a')]({'items':[{'type':_0x41a6('0x1b'),'variable':null,'config':{'placeholder':_0x41a6('0x1c'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x41a6('0x1b'),'props':{'title':_0x41a6('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x41a6('0x1d')](_0x41a6('0x1e'))?JSON[_0x41a6('0x1f')](this[_0x41a6('0x1d')]('onlineForm')):{};},'set':function(_0x5ec438){return this[_0x41a6('0x20')](_0x41a6('0x1e'),JSON['stringify'](_0x5ec438));}},'offlineForm':{'type':Sequelize[_0x41a6('0x10')],'defaultValue':function(){return JSON[_0x41a6('0x1a')]({'items':[{'type':_0x41a6('0x1b'),'props':{'title':_0x41a6('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x41a6('0x4'),'type':_0x41a6('0x4')},'variable':null},{'type':_0x41a6('0x21'),'config':{'placeholder':_0x41a6('0x22')},'props':{'title':_0x41a6('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x41a6('0x1d')](_0x41a6('0x23'))?JSON[_0x41a6('0x1f')](this[_0x41a6('0x1d')](_0x41a6('0x23'))):{};},'set':function(_0x956ea5){return this[_0x41a6('0x20')](_0x41a6('0x23'),JSON['stringify'](_0x956ea5));}},'token':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x41a6('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x41a6('0x2')]},'waitingTitle':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x24')},'waitingMessage':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x25')},'offlineMessageBody':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x41a6('0x15')},'enableCustomerAttachment':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x41a6('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x41a6('0x2')]},'notificationTemplate':{'type':Sequelize[_0x41a6('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x41a6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x41a6('0x28')},'verticalAlignment':{'type':Sequelize[_0x41a6('0xe')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x29')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x41a6('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x41a6('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x41a6('0x2')],'allowNull':![],'defaultValue':_0x41a6('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x41a6('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':_0x41a6('0x2b')},'systemAvatar':{'type':Sequelize[_0x41a6('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x41a6('0xe')],'comment':_0x41a6('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x270826){if(!_0x270826)this[_0x41a6('0x20')](_0x41a6('0x2d'),null);this[_0x41a6('0x20')]('mandatoryDisposition',_0x270826);}},'vidaooEscalation':{'type':Sequelize[_0x41a6('0xd')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x41a6('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x28e1=['parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','email','#9f946a','#ffffff','INTEGER','ENUM','rounded','squared','Send','Contact\x20us','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','stringify','input','name','text','onlineForm'];(function(_0xb1496a,_0x190543){var _0x301916=function(_0x4e17ab){while(--_0x4e17ab){_0xb1496a['push'](_0xb1496a['shift']());}};_0x301916(++_0x190543);}(_0x28e1,0x6e));var _0x128e=function(_0x2baf44,_0x5be181){_0x2baf44=_0x2baf44-0x0;var _0x2f7728=_0x28e1[_0x2baf44];return _0x2f7728;};'use strict';var Sequelize=require(_0x128e('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x128e('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x128e('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x128e('0x1')]},'mapKey':{'type':Sequelize[_0x128e('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x2')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x128e('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x128e('0x3'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x128e('0x1')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x128e('0x1')],'allowNull':![],'defaultValue':_0x128e('0x4'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x128e('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x128e('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x128e('0x6')](_0x128e('0x7'),_0x128e('0x8')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x128e('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x128e('0x9')},'header_offline':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0xa')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x128e('0x5')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0xb')},'defaultWhiteLabel':{'type':Sequelize[_0x128e('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x128e('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x128e('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0xf')},'noteTitle':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x10')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x11')},'closingMessageButton':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x9')},'skipMessageButton':{'type':Sequelize[_0x128e('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x12')},'ratingType':{'type':Sequelize[_0x128e('0x6')](_0x128e('0x13'),'thumb'),'defaultValue':_0x128e('0x13')},'ratingStarsNumber':{'type':Sequelize[_0x128e('0x5')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x128e('0xd')],'defaultValue':function(){return JSON[_0x128e('0x14')]({'items':[{'type':_0x128e('0x15'),'variable':null,'config':{'placeholder':_0x128e('0x16'),'type':_0x128e('0x17'),'required':!![]},'props':{'title':_0x128e('0x16'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x128e('0x2'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x128e('0x18'))?JSON[_0x128e('0x19')](this[_0x128e('0x1a')]('onlineForm')):{};},'set':function(_0x1920c6){return this[_0x128e('0x1b')](_0x128e('0x18'),JSON[_0x128e('0x14')](_0x1920c6));}},'offlineForm':{'type':Sequelize[_0x128e('0xd')],'defaultValue':function(){return JSON[_0x128e('0x14')]({'items':[{'type':_0x128e('0x15'),'props':{'title':_0x128e('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x128e('0x2'),'type':'email'},'variable':null},{'type':_0x128e('0x1c'),'config':{'placeholder':_0x128e('0x1d')},'props':{'title':_0x128e('0x1d'),'helpText':_0x128e('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0x128e('0x1a')]('offlineForm')?JSON[_0x128e('0x19')](this['getDataValue'](_0x128e('0x1f'))):{};},'set':function(_0x1c016f){return this[_0x128e('0x1b')](_0x128e('0x1f'),JSON[_0x128e('0x14')](_0x1c016f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x128e('0xc')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x128e('0x1')]},'forwardOffline':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x128e('0x1')]},'waitingTitle':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x20')},'waitingMessage':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x21')},'offlineMessageSubject':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x22')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x128e('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x128e('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x24')},'skipUnmanaged':{'type':Sequelize[_0x128e('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x9')},'enableCustomerAttachment':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x128e('0xd')]},'showAgentAvatar':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x128e('0xd')],'defaultValue':function(){return _0x128e('0x25');}},'notificationSound':{'type':Sequelize[_0x128e('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0x128e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x128e('0x27')},'verticalAlignment':{'type':Sequelize[_0x128e('0x5')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x128e('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x128e('0x1')]},'customerAvatar':{'type':Sequelize[_0x128e('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x128e('0x5')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x128e('0x1')],'allowNull':![],'defaultValue':_0x128e('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x128e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x128e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x128e('0x1')],'defaultValue':_0x128e('0x29')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x128e('0x5')],'comment':_0x128e('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4e607b){if(!_0x4e607b)this[_0x128e('0x1b')](_0x128e('0x2b'),null);this[_0x128e('0x1b')](_0x128e('0x2c'),_0x4e607b);}},'vidaooEscalation':{'type':Sequelize[_0x128e('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x128e('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7031bfe..62f8b60 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 _0xa5db=['ChatWebsite','rawAttributes','fieldName','type','key','model','map','name','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','options','count','includeAll','include','findAll','catch','show','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','params','describe','addDisposition','ChatWebsiteId','Disposition','findOne','order','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','existsSync','join','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','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','difference','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','ChatApplication','Applications','list','applications','orderBy','priority','asc','account','customerIp','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','interaction','ChatInteraction','contact','messageId','created','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','push','all','some','readFileSync','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','end','stack','send','index','Pause','mandatoryDispositionPause'];(function(_0x200276,_0x3a39b5){var _0x496325=function(_0x36551d){while(--_0x36551d){_0x200276['push'](_0x200276['shift']());}};_0x496325(++_0x3a39b5);}(_0xa5db,0xe8));var _0xba5d=function(_0x575e7d,_0x321647){_0x575e7d=_0x575e7d-0x0;var _0x34592d=_0xa5db[_0x575e7d];return _0x34592d;};'use strict';var pdf=require(_0xba5d('0x0'));var emlformat=require(_0xba5d('0x1'));var rimraf=require(_0xba5d('0x2'));var zipdir=require(_0xba5d('0x3'));var jsonpatch=require(_0xba5d('0x4'));var rp=require(_0xba5d('0x5'));var moment=require(_0xba5d('0x6'));var BPromise=require(_0xba5d('0x7'));var Mustache=require(_0xba5d('0x8'));var util=require(_0xba5d('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xba5d('0xa'));var ejs=require(_0xba5d('0xb'));var fs=require('fs');var _=require(_0xba5d('0xc'));var squel=require(_0xba5d('0xd'));var crypto=require(_0xba5d('0xe'));var jsforce=require(_0xba5d('0xf'));var deskjs=require(_0xba5d('0x10'));var toCsv=require(_0xba5d('0xa'));var querystring=require(_0xba5d('0x11'));var Papa=require(_0xba5d('0x12'));var Redis=require(_0xba5d('0x13'));var authService=require(_0xba5d('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba5d('0x15'));var logger=require(_0xba5d('0x16'))(_0xba5d('0x17'));var utils=require(_0xba5d('0x18'));var config=require(_0xba5d('0x19'));var db=require(_0xba5d('0x1a'))['db'];config[_0xba5d('0x1b')]=_[_0xba5d('0x1c')](config[_0xba5d('0x1b')],{'host':_0xba5d('0x1d'),'port':0x18eb});var socket=require(_0xba5d('0x1e'))(new Redis(config[_0xba5d('0x1b')]));require(_0xba5d('0x1f'))[_0xba5d('0x20')](socket);var jayson=require(_0xba5d('0x21'));var client=jayson[_0xba5d('0x22')][_0xba5d('0x23')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson['client'][_0xba5d('0x23')]({'port':0x232b});function checkPasswordPattern(_0xa3e5c1,_0x561b0b,_0x4dece1){if(_0x4dece1){var _0x1791c7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1791c7[_0xba5d('0x24')](_0x561b0b)){return _0xa3e5c1;}else{throw new db['Sequelize'][(_0xba5d('0x25'))](_0xba5d('0x26'));}}else{return _0xa3e5c1;}}function respondWithRpcPromise(_0x2efbbf,_0x27dc29,_0x2e8c75,_0x4870a0){return new BPromise(function(_0x31399a,_0x414181){var _0x35ec75=_0x4870a0||client;return _0x35ec75['request'](_0x2efbbf,_0x2e8c75)[_0xba5d('0x27')](function(_0x293122){logger['info'](_0xba5d('0x28'),_0x27dc29,_0xba5d('0x29'));logger[_0xba5d('0x2a')](_0xba5d('0x2b'),_0x27dc29,_0xba5d('0x29'),JSON[_0xba5d('0x2c')](_0x293122));if(_0x293122['error']){if(_0x293122[_0xba5d('0x2d')]['code']===0x1f4){logger['error'](_0xba5d('0x28'),_0x27dc29,_0x293122['error'][_0xba5d('0x2e')]);return _0x414181(_0x293122[_0xba5d('0x2d')]['message']);}logger[_0xba5d('0x2d')](_0xba5d('0x28'),_0x27dc29,_0x293122[_0xba5d('0x2d')]['message']);return _0x31399a(_0x293122['error'][_0xba5d('0x2e')]);}else{logger[_0xba5d('0x2f')](_0xba5d('0x28'),_0x27dc29,_0xba5d('0x29'));_0x31399a(_0x293122['result'][_0xba5d('0x2e')]);}})['catch'](function(_0x27dd58){logger[_0xba5d('0x2d')]('ChatWebsite,\x20%s,\x20%s',_0x27dc29,_0x27dd58);_0x414181(_0x27dd58);});});}function respondWithStatusCode(_0x32be18,_0x197c1a){_0x197c1a=_0x197c1a||0xcc;return function(_0x33d5eb){if(_0x33d5eb){return _0x32be18[_0xba5d('0x30')](_0x197c1a);}return _0x32be18['status'](_0x197c1a)['end']();};}function respondWithResult(_0x1f2ac3,_0x1f581e){_0x1f581e=_0x1f581e||0xc8;return function(_0xba2338){if(_0xba2338){return _0x1f2ac3[_0xba5d('0x31')](_0x1f581e)[_0xba5d('0x32')](_0xba2338);}};}function respondWithFilteredResult(_0x229130,_0x253245){return function(_0x2f84fc){if(_0x2f84fc){var _0x5a9520=_0x2f84fc['count'],_0xa6d32b=_0x253245['offset'],_0x39dd1e=_0x253245[_0xba5d('0x33')]+_0x253245[_0xba5d('0x34')],_0x2f72fb;if(_0x39dd1e>=_0x5a9520){_0x39dd1e=_0x5a9520;_0x2f72fb=0xc8;}else{_0x2f72fb=0xce;}_0x229130[_0xba5d('0x31')](_0x2f72fb);return _0x229130[_0xba5d('0x35')](_0xba5d('0x36'),_0xa6d32b+'-'+_0x39dd1e+'/'+_0x5a9520)['json'](_0x2f84fc);}return null;};}function patchUpdates(_0x33210b){return function(_0x165fba){try{jsonpatch[_0xba5d('0x37')](_0x165fba,_0x33210b,!![]);}catch(_0x45cf31){return BPromise[_0xba5d('0x38')](_0x45cf31);}return _0x165fba[_0xba5d('0x39')]();};}function saveUpdates(_0x5abc7b,_0x57ef7e){return function(_0xdbda55){if(_0xdbda55){return _0xdbda55[_0xba5d('0x3a')](_0x5abc7b)[_0xba5d('0x27')](function(_0x3f4b56){return _0x3f4b56;});}return null;};}function removeEntity(_0x5ab1b9,_0x252081){return function(_0x3c5d18){if(_0x3c5d18){return _0x3c5d18[_0xba5d('0x3b')]()[_0xba5d('0x27')](function(){var _0x4183ed=_0x3c5d18[_0xba5d('0x3c')]({'plain':!![]});var _0x1dc3bb=_0xba5d('0x3d');return db['UserProfileResource']['destroy']({'where':{'type':_0x1dc3bb,'resourceId':_0x4183ed['id']}})['then'](function(){return _0x3c5d18;});})[_0xba5d('0x27')](function(){_0x5ab1b9['status'](0xcc)[_0xba5d('0x3e')]();});}};}function handleEntityNotFound(_0x17ff34,_0x1f72ba){return function(_0x444efb){if(!_0x444efb){_0x17ff34['sendStatus'](0x194);}return _0x444efb;};}function handleError(_0x288027,_0x7011db){_0x7011db=_0x7011db||0x1f4;return function(_0x457e22){logger['error'](_0x457e22[_0xba5d('0x3f')]);if(_0x457e22['name']){delete _0x457e22['name'];}_0x288027[_0xba5d('0x31')](_0x7011db)[_0xba5d('0x40')](_0x457e22);};}exports[_0xba5d('0x41')]=function(_0xdf69ae,_0x30ce19){var _0x53d78f={'include':[{'model':db[_0xba5d('0x42')],'as':_0xba5d('0x43')}]},_0x3eebaa={},_0x300ccf={'count':0x0,'rows':[]};var _0x345544=_['map'](db[_0xba5d('0x44')][_0xba5d('0x45')],function(_0x265cd6){return{'name':_0x265cd6[_0xba5d('0x46')],'type':_0x265cd6[_0xba5d('0x47')][_0xba5d('0x48')]};});_0x3eebaa[_0xba5d('0x49')]=_[_0xba5d('0x4a')](_0x345544,_0xba5d('0x4b'));_0x3eebaa[_0xba5d('0x4c')]=_['keys'](_0xdf69ae[_0xba5d('0x4c')]);_0x3eebaa[_0xba5d('0x4d')]=_['intersection'](_0x3eebaa[_0xba5d('0x49')],_0x3eebaa[_0xba5d('0x4c')]);_0x53d78f[_0xba5d('0x4e')]=_[_0xba5d('0x4f')](_0x3eebaa[_0xba5d('0x49')],qs[_0xba5d('0x50')](_0xdf69ae[_0xba5d('0x4c')][_0xba5d('0x50')]));_0x53d78f['attributes']=_0x53d78f['attributes']['length']?_0x53d78f[_0xba5d('0x4e')]:_0x3eebaa[_0xba5d('0x49')];if(!_0xdf69ae[_0xba5d('0x4c')][_0xba5d('0x51')](_0xba5d('0x52'))){_0x53d78f[_0xba5d('0x34')]=qs[_0xba5d('0x34')](_0xdf69ae[_0xba5d('0x4c')]['limit']);_0x53d78f[_0xba5d('0x33')]=qs['offset'](_0xdf69ae[_0xba5d('0x4c')][_0xba5d('0x33')]);}_0x53d78f['order']=qs[_0xba5d('0x53')](_0xdf69ae['query'][_0xba5d('0x53')]);_0x53d78f[_0xba5d('0x54')]=qs[_0xba5d('0x4d')](_[_0xba5d('0x55')](_0xdf69ae[_0xba5d('0x4c')],_0x3eebaa[_0xba5d('0x4d')]),_0x345544);if(_0xdf69ae[_0xba5d('0x4c')]['filter']){_0x53d78f['where']=_[_0xba5d('0x56')](_0x53d78f[_0xba5d('0x54')],{'$or':_[_0xba5d('0x4a')](_0x345544,function(_0x599727){if(_0x599727[_0xba5d('0x47')]!=='VIRTUAL'){var _0x4b97c1={};_0x4b97c1[_0x599727[_0xba5d('0x4b')]]={'$like':'%'+_0xdf69ae[_0xba5d('0x4c')]['filter']+'%'};return _0x4b97c1;}})});}_0x53d78f=_[_0xba5d('0x56')]({},_0x53d78f,_0xdf69ae[_0xba5d('0x57')]);var _0x3f3bc5={'where':_0x53d78f[_0xba5d('0x54')]};return db['ChatWebsite'][_0xba5d('0x58')](_0x3f3bc5)[_0xba5d('0x27')](function(_0xc6709b){_0x300ccf[_0xba5d('0x58')]=_0xc6709b;if(_0xdf69ae[_0xba5d('0x4c')][_0xba5d('0x59')]){_0x53d78f[_0xba5d('0x5a')]=[{'all':!![]}];}return db['ChatWebsite'][_0xba5d('0x5b')](_0x53d78f);})[_0xba5d('0x27')](function(_0xf9dd8d){_0x300ccf['rows']=_0xf9dd8d;return _0x300ccf;})[_0xba5d('0x27')](respondWithFilteredResult(_0x30ce19,_0x53d78f))[_0xba5d('0x5c')](handleError(_0x30ce19,null));};exports[_0xba5d('0x5d')]=function(_0x768c02,_0x804142){var _0xaf568={'raw':![],'where':{'id':_0x768c02['params']['id']},'include':[{'model':db['Pause'],'as':_0xba5d('0x43')}]},_0x1791dc={};_0x1791dc[_0xba5d('0x49')]=_[_0xba5d('0x5e')](db[_0xba5d('0x44')][_0xba5d('0x45')]);_0x1791dc[_0xba5d('0x4c')]=_[_0xba5d('0x5e')](_0x768c02[_0xba5d('0x4c')]);_0x1791dc[_0xba5d('0x4d')]=_[_0xba5d('0x4f')](_0x1791dc['model'],_0x1791dc['query']);_0xaf568[_0xba5d('0x4e')]=_[_0xba5d('0x4f')](_0x1791dc['model'],qs['fields'](_0x768c02['query']['fields']));_0xaf568[_0xba5d('0x4e')]=_0xaf568[_0xba5d('0x4e')][_0xba5d('0x5f')]?_0xaf568[_0xba5d('0x4e')]:_0x1791dc['model'];if(_0x768c02[_0xba5d('0x4c')][_0xba5d('0x59')]){_0xaf568[_0xba5d('0x5a')]=[{'all':!![]}];}_0xaf568=_[_0xba5d('0x56')]({},_0xaf568,_0x768c02[_0xba5d('0x57')]);return db[_0xba5d('0x44')][_0xba5d('0x60')](_0xaf568)[_0xba5d('0x27')](handleEntityNotFound(_0x804142,null))[_0xba5d('0x27')](respondWithResult(_0x804142,null))['catch'](handleError(_0x804142,null));};exports[_0xba5d('0x61')]=function(_0xb7795f,_0x4c4cec){return db[_0xba5d('0x44')]['create'](_0xb7795f[_0xba5d('0x62')],{})[_0xba5d('0x27')](function(_0x298fe2){var _0x3cb6cf=_0xb7795f[_0xba5d('0x63')][_0xba5d('0x3c')]({'plain':!![]});if(!_0x3cb6cf)throw new Error(_0xba5d('0x64'));if(_0x3cb6cf[_0xba5d('0x65')]===_0xba5d('0x63')){var _0x35484f=_0x298fe2[_0xba5d('0x3c')]({'plain':!![]});var _0x375347=_0xba5d('0x3d');return db[_0xba5d('0x66')][_0xba5d('0x60')]({'where':{'name':_0x375347,'userProfileId':_0x3cb6cf[_0xba5d('0x67')]},'raw':!![]})[_0xba5d('0x27')](function(_0x37d03a){if(_0x37d03a&&_0x37d03a['autoAssociation']===0x0){return db[_0xba5d('0x68')][_0xba5d('0x61')]({'name':_0x35484f[_0xba5d('0x4b')],'resourceId':_0x35484f['id'],'type':_0x37d03a[_0xba5d('0x4b')],'sectionId':_0x37d03a['id']},{})[_0xba5d('0x27')](function(){return _0x298fe2;});}else{return _0x298fe2;}})['catch'](function(_0x58af7c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58af7c);throw _0x58af7c;});}return _0x298fe2;})['then'](respondWithResult(_0x4c4cec,0xc9))['catch'](handleError(_0x4c4cec,null));};exports[_0xba5d('0x3a')]=function(_0x4acdc7,_0x34b1a2){if(_0x4acdc7[_0xba5d('0x62')]['id']){delete _0x4acdc7[_0xba5d('0x62')]['id'];}return db[_0xba5d('0x44')]['find']({'where':{'id':_0x4acdc7['params']['id']},'include':[{'model':db[_0xba5d('0x42')],'as':_0xba5d('0x43')}]})[_0xba5d('0x27')](handleEntityNotFound(_0x34b1a2,null))[_0xba5d('0x27')](saveUpdates(_0x4acdc7[_0xba5d('0x62')],null))[_0xba5d('0x27')](respondWithResult(_0x34b1a2,null))[_0xba5d('0x5c')](handleError(_0x34b1a2,null));};exports['destroy']=function(_0x4d70d4,_0x359ff9){return db[_0xba5d('0x44')][_0xba5d('0x60')]({'where':{'id':_0x4d70d4[_0xba5d('0x69')]['id']}})['then'](handleEntityNotFound(_0x359ff9,null))[_0xba5d('0x27')](removeEntity(_0x359ff9,null))[_0xba5d('0x5c')](handleError(_0x359ff9,null));};exports['describe']=function(_0x2eb561,_0x2d4e2c){return db[_0xba5d('0x44')][_0xba5d('0x6a')]()[_0xba5d('0x27')](respondWithResult(_0x2d4e2c,null))[_0xba5d('0x5c')](handleError(_0x2d4e2c,null));};exports[_0xba5d('0x6b')]=function(_0x2a4b88,_0x45c762,_0x5412ce){if(_0x2a4b88[_0xba5d('0x62')]['id']){delete _0x2a4b88[_0xba5d('0x62')]['id'];}return db[_0xba5d('0x44')][_0xba5d('0x60')]({'where':{'id':_0x2a4b88['params']['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x45c762,null))['then'](function(_0x18d5bf){if(_0x18d5bf){_0x2a4b88[_0xba5d('0x62')][_0xba5d('0x6c')]=_0x18d5bf['id'];return db[_0xba5d('0x6d')][_0xba5d('0x61')](_0x2a4b88[_0xba5d('0x62')]);}})[_0xba5d('0x27')](respondWithResult(_0x45c762,null))[_0xba5d('0x5c')](handleError(_0x45c762,null));};exports['getDispositions']=function(_0x22e216,_0x3c620b,_0x4daa0f){var _0x2333f2={'raw':![],'where':{}};var _0x59b1ad={};var _0x163d91={'count':0x0,'rows':[]};return db[_0xba5d('0x44')][_0xba5d('0x6e')]({'where':{'id':_0x22e216[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x3c620b,null))['then'](function(_0x4443a0){if(_0x4443a0){_0x59b1ad[_0xba5d('0x49')]=_[_0xba5d('0x5e')](db[_0xba5d('0x6d')]['rawAttributes']);_0x59b1ad['query']=_[_0xba5d('0x5e')](_0x22e216[_0xba5d('0x4c')]);_0x59b1ad[_0xba5d('0x4d')]=_[_0xba5d('0x4f')](_0x59b1ad[_0xba5d('0x49')],_0x59b1ad[_0xba5d('0x4c')]);_0x2333f2[_0xba5d('0x4e')]=_[_0xba5d('0x4f')](_0x59b1ad[_0xba5d('0x49')],qs[_0xba5d('0x50')](_0x22e216[_0xba5d('0x4c')][_0xba5d('0x50')]));_0x2333f2[_0xba5d('0x4e')]=_0x2333f2['attributes'][_0xba5d('0x5f')]?_0x2333f2['attributes']:_0x59b1ad[_0xba5d('0x49')];if(!_0x22e216['query']['hasOwnProperty'](_0xba5d('0x52'))){_0x2333f2[_0xba5d('0x34')]=qs[_0xba5d('0x34')](_0x22e216[_0xba5d('0x4c')][_0xba5d('0x34')]);_0x2333f2[_0xba5d('0x33')]=qs['offset'](_0x22e216[_0xba5d('0x4c')][_0xba5d('0x33')]);}_0x2333f2[_0xba5d('0x6f')]=qs[_0xba5d('0x53')](_0x22e216['query'][_0xba5d('0x53')]);_0x2333f2[_0xba5d('0x54')]=qs[_0xba5d('0x4d')](_['pick'](_0x22e216['query'],_0x59b1ad['filters']));_0x2333f2[_0xba5d('0x54')][_0xba5d('0x6c')]=_0x4443a0['id'];if(_0x22e216[_0xba5d('0x4c')][_0xba5d('0x70')]){_0x2333f2[_0xba5d('0x54')]=_['merge'](_0x2333f2['where'],{'$or':_['map'](_0x2333f2[_0xba5d('0x4e')],function(_0x5c6ba3){var _0x1b9dd1={};_0x1b9dd1[_0x5c6ba3]={'$like':'%'+_0x22e216[_0xba5d('0x4c')]['filter']+'%'};return _0x1b9dd1;})});}_0x2333f2=_[_0xba5d('0x56')]({},_0x2333f2,_0x22e216[_0xba5d('0x57')]);return db['Disposition'][_0xba5d('0x58')]({'where':_0x2333f2[_0xba5d('0x54')]})[_0xba5d('0x27')](function(_0x3eaced){_0x163d91[_0xba5d('0x58')]=_0x3eaced;if(_0x22e216[_0xba5d('0x4c')][_0xba5d('0x59')]){_0x2333f2[_0xba5d('0x5a')]=[{'all':!![]}];}return db[_0xba5d('0x6d')][_0xba5d('0x5b')](_0x2333f2);})[_0xba5d('0x27')](function(_0x33f42a){_0x163d91[_0xba5d('0x71')]=_0x33f42a;return _0x163d91;});}})[_0xba5d('0x27')](respondWithFilteredResult(_0x3c620b,_0x2333f2))[_0xba5d('0x5c')](handleError(_0x3c620b,null));};exports['removeDispositions']=function(_0x5ebe27,_0x45210d,_0x4e1365){return db[_0xba5d('0x44')][_0xba5d('0x60')]({'where':{'id':_0x5ebe27['params']['id']}})['then'](handleEntityNotFound(_0x45210d,null))['then'](function(_0x168be9){if(_0x168be9){return _0x168be9[_0xba5d('0x72')](_0x5ebe27[_0xba5d('0x4c')][_0xba5d('0x73')]);}})['then'](respondWithStatusCode(_0x45210d,null))[_0xba5d('0x5c')](handleError(_0x45210d,null));};exports[_0xba5d('0x74')]=function(_0x4ecdc0,_0x170712,_0x30df80){if(_0x4ecdc0['body']['id']){delete _0x4ecdc0[_0xba5d('0x62')]['id'];}return db[_0xba5d('0x44')]['find']({'where':{'id':_0x4ecdc0[_0xba5d('0x69')]['id']}})['then'](handleEntityNotFound(_0x170712,null))[_0xba5d('0x27')](function(_0x49ef96){if(_0x49ef96){_0x4ecdc0[_0xba5d('0x62')][_0xba5d('0x6c')]=_0x49ef96['id'];return db[_0xba5d('0x75')][_0xba5d('0x61')](_0x4ecdc0['body']);}})[_0xba5d('0x27')](respondWithResult(_0x170712,null))[_0xba5d('0x5c')](handleError(_0x170712,null));};exports[_0xba5d('0x76')]=function(_0x1a5eab,_0x6ea804,_0x13888c){var _0x43d34a={'raw':![],'where':{}};var _0x544925={};var _0xe9ebcf={'count':0x0,'rows':[]};return db[_0xba5d('0x44')][_0xba5d('0x6e')]({'where':{'id':_0x1a5eab['params']['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x6ea804,null))[_0xba5d('0x27')](function(_0x1a5ba1){if(_0x1a5ba1){_0x544925[_0xba5d('0x49')]=_[_0xba5d('0x5e')](db[_0xba5d('0x75')]['rawAttributes']);_0x544925['query']=_[_0xba5d('0x5e')](_0x1a5eab[_0xba5d('0x4c')]);_0x544925['filters']=_[_0xba5d('0x4f')](_0x544925[_0xba5d('0x49')],_0x544925['query']);_0x43d34a[_0xba5d('0x4e')]=_[_0xba5d('0x4f')](_0x544925[_0xba5d('0x49')],qs[_0xba5d('0x50')](_0x1a5eab[_0xba5d('0x4c')][_0xba5d('0x50')]));_0x43d34a[_0xba5d('0x4e')]=_0x43d34a[_0xba5d('0x4e')]['length']?_0x43d34a[_0xba5d('0x4e')]:_0x544925['model'];if(!_0x1a5eab[_0xba5d('0x4c')][_0xba5d('0x51')](_0xba5d('0x52'))){_0x43d34a['limit']=qs[_0xba5d('0x34')](_0x1a5eab[_0xba5d('0x4c')]['limit']);_0x43d34a[_0xba5d('0x33')]=qs[_0xba5d('0x33')](_0x1a5eab[_0xba5d('0x4c')][_0xba5d('0x33')]);}_0x43d34a['order']=qs[_0xba5d('0x53')](_0x1a5eab[_0xba5d('0x4c')][_0xba5d('0x53')]);_0x43d34a[_0xba5d('0x54')]=qs[_0xba5d('0x4d')](_[_0xba5d('0x55')](_0x1a5eab[_0xba5d('0x4c')],_0x544925['filters']));_0x43d34a[_0xba5d('0x54')][_0xba5d('0x6c')]=_0x1a5ba1['id'];if(_0x1a5eab[_0xba5d('0x4c')][_0xba5d('0x70')]){_0x43d34a[_0xba5d('0x54')]=_[_0xba5d('0x56')](_0x43d34a[_0xba5d('0x54')],{'$or':_[_0xba5d('0x4a')](_0x43d34a[_0xba5d('0x4e')],function(_0x33388a){var _0x14585b={};_0x14585b[_0x33388a]={'$like':'%'+_0x1a5eab[_0xba5d('0x4c')][_0xba5d('0x70')]+'%'};return _0x14585b;})});}_0x43d34a=_[_0xba5d('0x56')]({},_0x43d34a,_0x1a5eab[_0xba5d('0x57')]);return db[_0xba5d('0x75')]['count']({'where':_0x43d34a[_0xba5d('0x54')]})[_0xba5d('0x27')](function(_0x24831d){_0xe9ebcf['count']=_0x24831d;if(_0x1a5eab['query'][_0xba5d('0x59')]){_0x43d34a[_0xba5d('0x5a')]=[{'all':!![]}];}return db[_0xba5d('0x75')][_0xba5d('0x5b')](_0x43d34a);})[_0xba5d('0x27')](function(_0x34534b){_0xe9ebcf[_0xba5d('0x71')]=_0x34534b;return _0xe9ebcf;});}})[_0xba5d('0x27')](respondWithFilteredResult(_0x6ea804,_0x43d34a))[_0xba5d('0x5c')](handleError(_0x6ea804,null));};exports['removeAnswers']=function(_0x5d1888,_0x1003b0,_0x24662c){return db['ChatWebsite'][_0xba5d('0x60')]({'where':{'id':_0x5d1888[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x1003b0,null))[_0xba5d('0x27')](function(_0x170775){if(_0x170775){return _0x170775['removeAnswers'](_0x5d1888['query'][_0xba5d('0x73')]);}})['then'](respondWithStatusCode(_0x1003b0,null))[_0xba5d('0x5c')](handleError(_0x1003b0,null));};exports[_0xba5d('0x77')]=function(_0xc4c24c,_0x4392a1,_0x1dd67f){_0xc4c24c[_0xba5d('0x62')][_0xba5d('0x78')]=_0xc4c24c[_0xba5d('0x79')][_0xba5d('0x7a')];return db['ChatWebsite'][_0xba5d('0x60')]({'where':{'id':_0xc4c24c['params']['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x4392a1,null))[_0xba5d('0x27')](saveUpdates(_0xc4c24c['body'],null))['then'](respondWithResult(_0x4392a1,null))['catch'](handleError(_0x4392a1,null));};exports[_0xba5d('0x7b')]=function(_0xdd64fa,_0x2ea2ac,_0x455e6b){_0xdd64fa[_0xba5d('0x62')][_0xba5d('0x7c')]=_0xdd64fa[_0xba5d('0x79')][_0xba5d('0x7a')];return db[_0xba5d('0x44')][_0xba5d('0x60')]({'where':{'id':_0xdd64fa['params']['id']}})['then'](handleEntityNotFound(_0x2ea2ac,null))[_0xba5d('0x27')](saveUpdates(_0xdd64fa[_0xba5d('0x62')],null))[_0xba5d('0x27')](respondWithResult(_0x2ea2ac,null))[_0xba5d('0x5c')](handleError(_0x2ea2ac,null));};exports['addCustomerAvatar']=function(_0xa83912,_0x4f2682,_0x410558){_0xa83912[_0xba5d('0x62')][_0xba5d('0x7d')]=_0xa83912[_0xba5d('0x79')]['filename'];return db['ChatWebsite'][_0xba5d('0x60')]({'where':{'id':_0xa83912[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x4f2682,null))[_0xba5d('0x27')](saveUpdates(_0xa83912['body'],null))['then'](respondWithResult(_0x4f2682,null))[_0xba5d('0x5c')](handleError(_0x4f2682,null));};exports[_0xba5d('0x7e')]=function(_0x5ccdf1,_0x577301,_0x214fef){_0x5ccdf1[_0xba5d('0x62')][_0xba5d('0x7f')]=_0x5ccdf1['file']['filename'];return db[_0xba5d('0x44')]['find']({'where':{'id':_0x5ccdf1[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x577301,null))[_0xba5d('0x27')](saveUpdates(_0x5ccdf1['body'],null))[_0xba5d('0x27')](respondWithResult(_0x577301,null))['catch'](handleError(_0x577301,null));};exports[_0xba5d('0x80')]=function(_0x35f25b,_0x53f4fe,_0xa6b0d2){var _0x3aa1d6=path['join'](config[_0xba5d('0x81')],'server/files/images/logos/default_logo.png');var _0x17b278={'where':{'id':_0x35f25b['params']['id']},'attributes':['id',_0xba5d('0x78')],'raw':!![]};var _0x389ee9=![];return require(_0xba5d('0x82'))[_0xba5d('0x83')]()[_0xba5d('0x27')](function(_0x15f7c0){if(_0x15f7c0){_0x389ee9=_0x15f7c0[_0xba5d('0x84')];}})['then'](function(){return db[_0xba5d('0x44')][_0xba5d('0x60')](_0x17b278);})[_0xba5d('0x27')](handleEntityNotFound(_0x53f4fe,null))['then'](function(_0x41c4db){if(_0x41c4db){if(!_[_0xba5d('0x85')](_0x41c4db['sitepic'])){if(fs[_0xba5d('0x86')](path[_0xba5d('0x87')](config['root'],_0xba5d('0x88'),_0x41c4db['sitepic']))&&_0x389ee9){_0x3aa1d6=path['join'](config[_0xba5d('0x81')],_0xba5d('0x88'),_0x41c4db[_0xba5d('0x78')]);}}return _0x53f4fe[_0xba5d('0x89')](_0x3aa1d6);}})[_0xba5d('0x5c')](handleError(_0x53f4fe,null));};exports[_0xba5d('0x8a')]=function(_0xb19d06,_0x1579b0,_0x7af994){var _0x3b2803=path[_0xba5d('0x87')](config[_0xba5d('0x81')],_0xba5d('0x8b'));var _0x2a7ad5={'where':{'id':_0xb19d06['params']['id']},'attributes':['id',_0xba5d('0x7c')],'raw':!![]};return db['ChatWebsite'][_0xba5d('0x60')](_0x2a7ad5)[_0xba5d('0x27')](handleEntityNotFound(_0x1579b0,null))[_0xba5d('0x27')](function(_0x27425b){if(_0x27425b){if(!_[_0xba5d('0x85')](_0x27425b[_0xba5d('0x7c')])){if(fs[_0xba5d('0x86')](path[_0xba5d('0x87')](config[_0xba5d('0x81')],_0xba5d('0x8c'),_0x27425b[_0xba5d('0x7c')]))){_0x3b2803=path['join'](config['root'],_0xba5d('0x8c'),_0x27425b[_0xba5d('0x7c')]);}}return _0x1579b0[_0xba5d('0x89')](_0x3b2803);}})[_0xba5d('0x5c')](handleError(_0x1579b0,null));};exports[_0xba5d('0x8d')]=function(_0x1c5add,_0x258352,_0x2d0f82){var _0x3175a9=path[_0xba5d('0x87')](config[_0xba5d('0x81')],_0xba5d('0x8e'));var _0x488efc={'where':{'id':_0x1c5add[_0xba5d('0x69')]['id']},'attributes':['id',_0xba5d('0x7d'),_0xba5d('0x8f')],'raw':!![]};return db[_0xba5d('0x44')][_0xba5d('0x60')](_0x488efc)[_0xba5d('0x27')](handleEntityNotFound(_0x258352,null))['then'](function(_0x5a8dc0){if(_0x5a8dc0){if(!_[_0xba5d('0x85')](_0x5a8dc0[_0xba5d('0x7d')])){if(fs[_0xba5d('0x86')](path[_0xba5d('0x87')](config[_0xba5d('0x81')],_0xba5d('0x8c'),_0x5a8dc0[_0xba5d('0x7d')]))&&_0x5a8dc0[_0xba5d('0x8f')]){_0x3175a9=path[_0xba5d('0x87')](config['root'],_0xba5d('0x8c'),_0x5a8dc0[_0xba5d('0x7d')]);}}return _0x258352['download'](_0x3175a9);}})[_0xba5d('0x5c')](handleError(_0x258352,null));};exports[_0xba5d('0x90')]=function(_0x1f4076,_0x3ed8d3,_0x1f1842){var _0x442f33=path[_0xba5d('0x87')](config['root'],_0xba5d('0x91'));var _0x597890={'where':{'id':_0x1f4076['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xba5d('0x60')](_0x597890)[_0xba5d('0x27')](handleEntityNotFound(_0x3ed8d3,null))[_0xba5d('0x27')](function(_0x118274){if(_0x118274){if(!_[_0xba5d('0x85')](_0x118274['systemAvatar'])){if(fs['existsSync'](path['join'](config['root'],'server/files/images/avatars/',_0x118274[_0xba5d('0x7f')]))){_0x442f33=path['join'](config[_0xba5d('0x81')],_0xba5d('0x8c'),_0x118274[_0xba5d('0x7f')]);}}return _0x3ed8d3['download'](_0x442f33);}})[_0xba5d('0x5c')](handleError(_0x3ed8d3,null));};exports[_0xba5d('0x92')]=function(_0xb24c09,_0x1f680b,_0x5c3f37){var _0x95ce52=require('user-agent-parser');var _0x106365=new _0x95ce52();var _0x357963=_0x106365[_0xba5d('0x93')](_0xb24c09[_0xba5d('0x94')][_0xba5d('0x95')])[_0xba5d('0x96')]();var _0x260a20={'body':_0xb24c09[_0xba5d('0x62')],'channel':_0xba5d('0x97')};var _0x2af25b=[];var _0x4e9b2c=[];var _0x25fc18={};var _0x1196e2=![];return db[_0xba5d('0x98')][_0xba5d('0x6a')]()[_0xba5d('0x27')](function(_0x31f624){if(!_0x31f624){throw new db['Sequelize'][(_0xba5d('0x25'))]('no\x20available\x20attributes');}_0x2af25b=_[_0xba5d('0x99')](_[_0xba5d('0x5e')](_0x31f624),['createdAt',_0xba5d('0x9a')]);_0x4e9b2c=_[_0xba5d('0x99')](_[_0xba5d('0x5e')](_0x31f624),[_0xba5d('0x9b'),_0xba5d('0x9a'),_0xba5d('0x9c'),_0xba5d('0x9d')]);if(_0xb24c09[_0xba5d('0x62')]['id']){delete _0xb24c09[_0xba5d('0x62')]['id'];}if(_[_0xba5d('0x85')](_0xb24c09['body'][_0xba5d('0x9e')])){throw new db[(_0xba5d('0x9f'))]['ValidationError'](_0xba5d('0xa0'));}if(_[_0xba5d('0x85')](_0xb24c09[_0xba5d('0x62')][_0xba5d('0x62')])||_0xb24c09[_0xba5d('0x62')][_0xba5d('0x62')]===''){throw new db['Sequelize'][(_0xba5d('0x25'))](_0xba5d('0xa1'));}if(_['isNil'](_0xb24c09[_0xba5d('0x62')][_0xba5d('0xa2')])){throw new db[(_0xba5d('0x9f'))][(_0xba5d('0x25'))](_0xba5d('0xa3')+_0x4e9b2c);}if(!_[_0xba5d('0xa4')](_0x4e9b2c,_0xb24c09[_0xba5d('0x62')][_0xba5d('0xa2')])){throw new db[(_0xba5d('0x9f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e9b2c);}_0x25fc18[_0xb24c09[_0xba5d('0x62')]['mapKey']]=_0xb24c09[_0xba5d('0x62')][_0xba5d('0x9e')];})['then'](function(){return db[_0xba5d('0x44')][_0xba5d('0x60')]({'where':{'id':_0xb24c09[_0xba5d('0x69')]['id']},'include':[{'model':db[_0xba5d('0xa5')],'as':_0xba5d('0xa6'),'include':[{'model':db[_0xba5d('0x98')],'as':_0xba5d('0xa7'),'where':_0x25fc18,'limit':0x1,'order':[[_0xba5d('0x9a'),'DESC']]}]},{'model':db[_0xba5d('0xa8')],'as':_0xba5d('0xa9')}]});})[_0xba5d('0x27')](handleEntityNotFound(_0x1f680b,null))[_0xba5d('0x27')](function(_0x464e8d){if(_0x464e8d&&_0x464e8d[_0xba5d('0xa6')]){_0x260a20['account']=_0x464e8d;_0x260a20['applications']=_0x464e8d[_0xba5d('0xa9')];_0x260a20[_0xba5d('0xaa')]=_0x464e8d['List'];_0x260a20[_0xba5d('0xab')]=_[_0xba5d('0xac')](_0x260a20[_0xba5d('0xab')],[_0xba5d('0xad')],[_0xba5d('0xae')]);if(_0x260a20[_0xba5d('0xaf')][_0xba5d('0xa9')]){delete _0x260a20[_0xba5d('0xaf')][_0xba5d('0xa9')];}if(_0x260a20[_0xba5d('0xaf')]['List']&&_0x260a20['account']['List'][_0xba5d('0xa7')]['length']){return _0x260a20[_0xba5d('0xaf')][_0xba5d('0xa6')][_0xba5d('0xa7')][0x0];}var _0x3417b0=_[_0xba5d('0x1c')](_0xb24c09[_0xba5d('0x62')],{'firstName':_0xb24c09[_0xba5d('0x62')][_0xba5d('0x9e')],'ListId':_0x464e8d[_0xba5d('0x9d')]});_0x3417b0[_0xb24c09[_0xba5d('0x62')][_0xba5d('0xa2')]]=_0xb24c09['body'][_0xba5d('0x9e')];return db['CmContact']['create'](_0x3417b0,{'fields':_0x2af25b,'raw':!![]});}})['then'](handleEntityNotFound(_0x1f680b,null))[_0xba5d('0x27')](function(_0x2ab19c){_0x260a20['contact']=_0x2ab19c;var _0x1f9c39=_0xb24c09[_0xba5d('0x62')][_0xba5d('0xb0')];if(_0xb24c09[_0xba5d('0x94')]['cf-connecting-ip']){_0x1f9c39=_0xb24c09[_0xba5d('0x94')]['cf-connecting-ip'];}else if(_0xb24c09[_0xba5d('0x94')]['x-forwarded-for']){_0x1f9c39=_[_0xba5d('0xb1')](_0xb24c09[_0xba5d('0x94')][_0xba5d('0xb2')][_0xba5d('0xb3')](','));}if(_0x2ab19c){var _0x5aee40={'ContactId':_0x2ab19c['id'],'ChatWebsiteId':_0xb24c09['params']['id'],'from':(_0x2ab19c[_0xba5d('0xb4')]||'')+'\x20'+(_0x2ab19c[_0xba5d('0xb5')]||''),'customerIp':_0x1f9c39,'customerPort':_0xb24c09[_0xba5d('0x94')][_0xba5d('0xb6')]?_0xb24c09[_0xba5d('0x94')][_0xba5d('0xb6')]:null,'referer':_0xb24c09[_0xba5d('0x62')][_0xba5d('0xb7')],'browserName':_0x357963['browser'][_0xba5d('0x4b')]&&_0x357963['browser'][_0xba5d('0xb8')]?util[_0xba5d('0xb9')](_0xba5d('0xba'),_0x357963[_0xba5d('0xbb')][_0xba5d('0x4b')],_0x357963[_0xba5d('0xbb')][_0xba5d('0xb8')]):_0xba5d('0xbc'),'browserVersion':_0x357963[_0xba5d('0xbb')]['version']||_0xba5d('0xbc'),'osName':util['format']('%s\x20%s',_0x357963['os'][_0xba5d('0x4b')],_0x357963['os'][_0xba5d('0xb8')]),'osVersion':_0x357963['os']['version'],'deviceModel':_0x357963[_0xba5d('0xbd')][_0xba5d('0x49')]&&_0x357963[_0xba5d('0xbd')][_0xba5d('0xbe')]?util[_0xba5d('0xb9')](_0xba5d('0xbf'),_0x357963['device'][_0xba5d('0x49')],_0x357963['device']['vendor'],_0x357963[_0xba5d('0xbd')][_0xba5d('0x47')]):null,'deviceVendor':_0x357963['device']['vendor'],'deviceType':_0x357963[_0xba5d('0xbd')][_0xba5d('0x47')],'formData':JSON[_0xba5d('0x2c')](_0xb24c09[_0xba5d('0x62')])};var _0x2397fa={'ChatWebsiteId':_0xb24c09['params']['id'],'closed':![]};if(_0xb24c09[_0xba5d('0x62')][_0xba5d('0xc0')]){_0x2397fa[_0xba5d('0xc0')]=_0xb24c09['body'][_0xba5d('0xc0')];return db['ChatInteraction'][_0xba5d('0x60')]({'where':_0x2397fa})[_0xba5d('0x27')](function(_0x4dc092){if(_0x4dc092){return[_0x4dc092,![]];}_0x5aee40[_0xba5d('0xc0')]=_0xb24c09['body']['threadId'];_0x5aee40['externalUrl']=_0xb24c09[_0xba5d('0x62')][_0xba5d('0xc1')];return db['ChatInteraction'][_0xba5d('0x61')](_0x5aee40)['then'](function(_0x19105f){return[_0x19105f,!![]];});});}_0x2397fa['ContactId']=_0x2ab19c['id'];if(_0xb24c09[_0xba5d('0x62')][_0xba5d('0xc2')]&&_0xb24c09[_0xba5d('0x62')][_0xba5d('0xc2')]['id']){_0x2397fa['id']=_0xb24c09[_0xba5d('0x62')]['interaction']['id'];return db[_0xba5d('0xc3')][_0xba5d('0x60')]({'where':_0x2397fa})[_0xba5d('0x27')](function(_0x46b75e){if(_0x46b75e){return[_0x46b75e,![]];}return db[_0xba5d('0xc3')][_0xba5d('0x61')](_0x5aee40)[_0xba5d('0x27')](function(_0xfcba10){return[_0xfcba10,!![]];});});}return db['ChatInteraction'][_0xba5d('0x61')](_0x5aee40)['then'](function(_0x407e11){return[_0x407e11,!![]];});}})['spread'](function(_0x51966f,_0x516552){if(_0x51966f){_0x1196e2=_0x516552;if(!_0x516552){var _0x282aba={'from':(_0x260a20[_0xba5d('0xc4')][_0xba5d('0xb4')]||'')+'\x20'+(_0x260a20[_0xba5d('0xc4')][_0xba5d('0xb5')]||'')};if(_0xb24c09[_0xba5d('0x62')][_0xba5d('0xc0')]&&_0xb24c09['body'][_0xba5d('0xc5')]&&_0xb24c09[_0xba5d('0x62')][_0xba5d('0xc0')]!=_0xb24c09[_0xba5d('0x62')][_0xba5d('0xc5')]){_0x282aba[_0xba5d('0xc0')]=_0xb24c09[_0xba5d('0x62')][_0xba5d('0xc5')];}return _0x51966f[_0xba5d('0x3a')](_0x282aba);}else{return _0x51966f;}}})[_0xba5d('0x27')](function(_0x18c3f2){_0x260a20['interaction']=_0x18c3f2[_0xba5d('0x3c')]({'plain':!![]});_0x260a20[_0xba5d('0xc2')][_0xba5d('0xc6')]=_0x1196e2;if(_0x260a20[_0xba5d('0xc2')][_0xba5d('0xc6')]){if(_0x260a20[_0xba5d('0xaf')]['autoclose']){_0x260a20[_0xba5d('0xab')]['push']({'id':0x0,'priority':_0x260a20['applications'][_0xba5d('0x5f')]+0x1,'app':'close','appdata':_0xba5d('0xc7'),'interval':_0xba5d('0xc8')});}}return db[_0xba5d('0xc9')][_0xba5d('0x61')]({'body':_0xb24c09[_0xba5d('0x62')][_0xba5d('0x62')],'ChatWebsiteId':_0xb24c09[_0xba5d('0x69')]['id'],'ChatInteractionId':_0x18c3f2['id'],'direction':'in','ContactId':_0x260a20['contact']['id'],'AttachmentId':_0xb24c09[_0xba5d('0x62')][_0xba5d('0xca')]});})['then'](function(_0x52724c){_0x260a20[_0xba5d('0x2e')]=_0x52724c;if(_0x260a20[_0xba5d('0xc2')][_0xba5d('0xcb')]){return db[_0xba5d('0xcc')]['find']({'attributes':['id',_0xba5d('0x4b')],'where':{'id':_0x260a20['interaction'][_0xba5d('0xcb')]}})[_0xba5d('0x27')](function(_0x317b3d){if(_0x317b3d){_0x260a20[_0xba5d('0xab')][_0xba5d('0xcd')]({'id':0x0,'priority':0x0,'app':_0xba5d('0xce'),'appdata':_0x317b3d[_0xba5d('0x4b')]+','+(_0x260a20[_0xba5d('0xaf')][_0xba5d('0xcf')]||0xa),'interval':_0xba5d('0xc8')});_0x260a20[_0xba5d('0xd0')]=!![];}return respondWithRpcPromise('Start',_0xba5d('0xd1'),_0x260a20);});}return respondWithRpcPromise(_0xba5d('0xd2'),_0xba5d('0xd1'),_0x260a20);})[_0xba5d('0x27')](function(_0x59758c){respondWithRpcPromise(_0xba5d('0xd3'),_0xba5d('0xd3'),{'event':_0xba5d('0x92'),'message':_0x59758c},client9002);return _0x59758c;})[_0xba5d('0x27')](respondWithResult(_0x1f680b,null))['catch'](handleError(_0x1f680b,null));};exports[_0xba5d('0xd4')]=function(_0x4ff7f3,_0xd22719,_0x1b8a3a){var _0x4078f4,_0x502922,_0x34bb91;var _0xaf0794=[];var _0x15e8d0=[];var _0x1d4ee3={};return db[_0xba5d('0x98')]['describe']()[_0xba5d('0x27')](function(_0x37de52){if(!_0x37de52){throw new db[(_0xba5d('0x9f'))][(_0xba5d('0x25'))](_0xba5d('0xd5'));}_0x15e8d0=_[_0xba5d('0x99')](_['keys'](_0x37de52),['createdAt',_0xba5d('0x9a')]);_0xaf0794=_['difference'](_[_0xba5d('0x5e')](_0x37de52),[_0xba5d('0x9b'),_0xba5d('0x9a'),_0xba5d('0x9c'),_0xba5d('0x9d')]);if(_0x4ff7f3[_0xba5d('0x62')]['id']){delete _0x4ff7f3[_0xba5d('0x62')]['id'];}if(_['isNil'](_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0x9e')])){throw _0xd22719[_0xba5d('0x31')](0x1f4)[_0xba5d('0x40')](new db[(_0xba5d('0x9f'))]['ValidationError'](_0xba5d('0xa0')));}if(_[_0xba5d('0x85')](_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0x62')])||_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0x62')]===''){throw _0xd22719[_0xba5d('0x31')](0x1f4)[_0xba5d('0x40')](new db[(_0xba5d('0x9f'))][(_0xba5d('0x25'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xba5d('0x85')](_0x4ff7f3['body'][_0xba5d('0xd6')])){throw _0xd22719[_0xba5d('0x31')](0x1f4)[_0xba5d('0x40')](new db[(_0xba5d('0x9f'))][(_0xba5d('0x25'))](_0xba5d('0xd7')+_0xaf0794));}if(!_[_0xba5d('0xa4')](_0xaf0794,_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0xd6')])){throw _0xd22719[_0xba5d('0x31')](0x1f4)[_0xba5d('0x40')](new db[(_0xba5d('0x9f'))][(_0xba5d('0x25'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xaf0794));}_0x1d4ee3[_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0xd6')]]=_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0x9e')];})[_0xba5d('0x27')](function(){return db[_0xba5d('0x44')]['find']({'where':{'id':_0x4ff7f3[_0xba5d('0x69')]['id']},'include':[{'model':db[_0xba5d('0xa5')],'as':'List'}]});})[_0xba5d('0x27')](handleEntityNotFound(_0xd22719,null))[_0xba5d('0x27')](function(_0x34f948){if(_0x34f948&&_0x34f948[_0xba5d('0xa6')]){_0x502922=_0x34f948;var _0x114479=_[_0xba5d('0x1c')](_0x4ff7f3[_0xba5d('0x62')],{'firstName':_0x4ff7f3[_0xba5d('0x62')]['from'],'phone':_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0x9e')],'ListId':_0x34f948[_0xba5d('0x9d')]});_0x114479[_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0xd6')]]=_0x4ff7f3[_0xba5d('0x62')][_0xba5d('0x9e')];return db[_0xba5d('0x98')][_0xba5d('0xd8')]({'where':_0x1d4ee3,'defaults':_0x114479});}})[_0xba5d('0xd9')](function(_0x201dc4){if(_0x201dc4){_0x34bb91=_0x201dc4;var _0x5cfdab=fs['readFileSync'](path['join'](config[_0xba5d('0x81')],_0xba5d('0xda')),'utf8');var _0x4a9775=ejs[_0xba5d('0xdb')](_0x5cfdab,{'body':_[_0xba5d('0xdc')](_0x4ff7f3['body']['body']),'bodyTitle':_0x502922[_0xba5d('0xdd')]});return db[_0xba5d('0xde')]['create']({'body':_0x4a9775,'ContactId':_0x201dc4['id'],'ChatWebsiteId':_0x502922['id']});}})[_0xba5d('0x27')](function(_0x857575){if(_0x857575){_0x4078f4=_0x857575;return db[_0xba5d('0xdf')][_0xba5d('0x6e')]({'where':{'service':!![]},'include':[{'model':db[_0xba5d('0xe0')],'as':_0xba5d('0xe1'),'raw':!![]}]});}})[_0xba5d('0x27')](function(_0x16d417){if(_0x16d417&&_0x16d417['Smtp']&&_0x502922['forwardOfflineAddress']){var _0x4d86a7={'tls':{'rejectUnauthorized':![]}};if(_0x16d417['Smtp'][_0xba5d('0xe2')]){_0x4d86a7['service']=_0x16d417[_0xba5d('0xe1')][_0xba5d('0xe2')];}else{_0x4d86a7['host']=_0x16d417['Smtp'][_0xba5d('0xe3')];_0x4d86a7[_0xba5d('0xe4')]=_0x16d417[_0xba5d('0xe1')][_0xba5d('0xe4')];_0x4d86a7[_0xba5d('0xe5')]=_0x16d417[_0xba5d('0xe1')][_0xba5d('0xe5')];}if(_0x16d417[_0xba5d('0xe1')][_0xba5d('0xe6')]){_0x4d86a7[_0xba5d('0xe7')]={'user':_0x16d417[_0xba5d('0xe1')][_0xba5d('0x63')],'pass':_0x16d417[_0xba5d('0xe1')][_0xba5d('0xe8')]};}return respondWithRpcPromise(_0xba5d('0xe9'),_0xba5d('0xea'),{'account':_0x4d86a7,'message':{'from':util[_0xba5d('0xb9')]('\x22%s\x22\x20<%s>',_0x16d417[_0xba5d('0x4b')],_0x16d417[_0xba5d('0xeb')]||_0x16d417[_0xba5d('0xe1')][_0xba5d('0x63')]),'to':_0x502922[_0xba5d('0xec')],'subject':_0x502922[_0xba5d('0xed')],'text':_0x4078f4[_0xba5d('0x62')]}},client9003)['then'](function(){return _0x4078f4;})[_0xba5d('0x5c')](function(_0x39bc79){console[_0xba5d('0x2d')](_0x39bc79);});}})['then'](function(){if(_0x4078f4){return _0x4078f4;}})[_0xba5d('0x27')](respondWithResult(_0xd22719,null))[_0xba5d('0x5c')](handleError(_0xd22719,null));};exports[_0xba5d('0xee')]=function(_0x4e8678,_0x5e5453,_0x1a26d5){return db[_0xba5d('0xc3')]['find']({'where':{'id':_0x4e8678[_0xba5d('0x69')]['id']}})['then'](handleEntityNotFound(_0x5e5453,null))[_0xba5d('0x27')](function(_0x5d3094){if(_0x5d3094){return _0x5d3094['addInteraction'](_0x4e8678[_0xba5d('0x62')][_0xba5d('0x73')],_[_0xba5d('0xef')](_0x4e8678[_0xba5d('0x62')],[_0xba5d('0x73'),'id'])||{});}})[_0xba5d('0x27')](respondWithResult(_0x5e5453,null))[_0xba5d('0x5c')](handleError(_0x5e5453,null));};exports['getInteractions']=function(_0x88a7b4,_0x2a7088,_0x1f9d29){var _0x28597a={'raw':![],'where':{}};var _0x272891={};var _0x40a596={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xba5d('0x6e')]({'where':{'id':_0x88a7b4[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x2a7088,null))['then'](function(_0xfa4e3e){if(_0xfa4e3e){_0x272891['model']=_[_0xba5d('0x5e')](db[_0xba5d('0xc3')][_0xba5d('0x45')]);_0x272891[_0xba5d('0x4c')]=_['keys'](_0x88a7b4['query']);_0x272891[_0xba5d('0x4d')]=_[_0xba5d('0x4f')](_0x272891['model'],_0x272891[_0xba5d('0x4c')]);_0x28597a[_0xba5d('0x4e')]=_['intersection'](_0x272891[_0xba5d('0x49')],qs['fields'](_0x88a7b4[_0xba5d('0x4c')]['fields']));_0x28597a['attributes']=_0x28597a['attributes'][_0xba5d('0x5f')]?_0x28597a[_0xba5d('0x4e')]:_0x272891[_0xba5d('0x49')];if(!_0x88a7b4[_0xba5d('0x4c')][_0xba5d('0x51')](_0xba5d('0x52'))){_0x28597a['limit']=qs[_0xba5d('0x34')](_0x88a7b4[_0xba5d('0x4c')][_0xba5d('0x34')]);_0x28597a[_0xba5d('0x33')]=qs['offset'](_0x88a7b4[_0xba5d('0x4c')]['offset']);}_0x28597a[_0xba5d('0x6f')]=qs['sort'](_0x88a7b4[_0xba5d('0x4c')][_0xba5d('0x53')]);_0x28597a['where']=qs['filters'](_[_0xba5d('0x55')](_0x88a7b4[_0xba5d('0x4c')],_0x272891[_0xba5d('0x4d')]));_0x28597a['where'][_0xba5d('0x6c')]=_0xfa4e3e['id'];if(_0x88a7b4[_0xba5d('0x4c')]['filter']){_0x28597a['where']=_[_0xba5d('0x56')](_0x28597a['where'],{'$or':_[_0xba5d('0x4a')](_0x28597a[_0xba5d('0x4e')],function(_0x3df2a8){var _0x16f1a8={};_0x16f1a8[_0x3df2a8]={'$like':'%'+_0x88a7b4[_0xba5d('0x4c')][_0xba5d('0x70')]+'%'};return _0x16f1a8;})});}_0x28597a=_[_0xba5d('0x56')]({},_0x28597a,_0x88a7b4['options']);return db[_0xba5d('0xc3')][_0xba5d('0x58')]({'where':_0x28597a[_0xba5d('0x54')]})[_0xba5d('0x27')](function(_0x3371af){_0x40a596['count']=_0x3371af;if(_0x88a7b4[_0xba5d('0x4c')][_0xba5d('0x59')]){_0x28597a['include']=[{'model':db['CmContact'],'as':_0xba5d('0xf0'),'required':![]},{'model':db['User'],'as':_0xba5d('0xf1'),'attributes':['name',_0xba5d('0xf2'),_0xba5d('0xf3')],'required':![]},{'model':db[_0xba5d('0xf4')],'as':_0xba5d('0xf5'),'attributes':['id','name','color'],'where':_0x88a7b4[_0xba5d('0x4c')][_0xba5d('0xf6')]?{'id':_0x88a7b4[_0xba5d('0x4c')]['tag']}:undefined,'required':_0x88a7b4[_0xba5d('0x4c')]['tag']?!![]:![]}];}return db[_0xba5d('0xc3')]['findAll'](_0x28597a);})[_0xba5d('0x27')](function(_0x555798){_0x40a596['rows']=_0x555798;return _0x40a596;});}})[_0xba5d('0x27')](respondWithFilteredResult(_0x2a7088,_0x28597a))[_0xba5d('0x5c')](handleError(_0x2a7088,null));};function iftimePromise(_0x8c44f8,_0xb0e308){return respondWithRpcPromise(_0xba5d('0xf7'),_0xba5d('0xf8'),{'command':_0xb0e308['timezone']?util['format'](_0xba5d('0xf9'),_0x8c44f8[_0xba5d('0xfa')],_0xb0e308[_0xba5d('0xfb')]):util[_0xba5d('0xb9')](_0xba5d('0xfc'),_0x8c44f8[_0xba5d('0xfa')])},client9002)[_0xba5d('0x27')](function(_0x3b528e){var _0x1817d3=_0x3b528e&&_0x3b528e[_0xba5d('0xfd')](_0xba5d('0xfe'))>=0x0?!![]:![];logger[_0xba5d('0x2f')](_0xba5d('0xff'),_0xb0e308['id'],_0x8c44f8['id'],_0x8c44f8[_0xba5d('0xfa')],_0x1817d3?_0xba5d('0x100'):_0xba5d('0x101'),_0xb0e308['timezone']?_0xb0e308[_0xba5d('0xfb')]:_0xba5d('0x102'));return _0x1817d3;})[_0xba5d('0x5c')](function(_0xa56e4e){logger[_0xba5d('0x2d')](_0xba5d('0xff'),_0xb0e308['id'],_0x8c44f8['id'],_0x8c44f8['interval'],util[_0xba5d('0x103')](_0xa56e4e,{'showHidden':![],'depth':null}),_0xb0e308['timezone']?_0xb0e308['timezone']:_0xba5d('0x102'));return![];});}exports[_0xba5d('0xf8')]=function(_0x13e468,_0x331a92,_0x1138f9){var _0x24de5e=0x0;var _0x1450ad=0x0;var _0x3edc0b=![];var _0x305fba;var _0x330e89;return db[_0xba5d('0x44')][_0xba5d('0x60')]({'where':{'id':_0x13e468['params']['id']},'include':[{'model':db[_0xba5d('0x104')],'as':_0xba5d('0x104'),'include':[{'model':db[_0xba5d('0x104')],'as':_0xba5d('0x105'),'attributes':['id',_0xba5d('0xfa')],'raw':!![]}]}]})[_0xba5d('0x27')](handleEntityNotFound(_0x331a92,null))[_0xba5d('0x27')](function(_0x3df65d){if(_0x3df65d){_0x305fba=_0x3df65d;return _0x3df65d[_0xba5d('0x106')]({'raw':!![]});}})[_0xba5d('0x27')](function(_0x13a1c9){if(_0x305fba){if(_0x13a1c9){_0x330e89=_0x13a1c9;}}return require('../../config/license/util')[_0xba5d('0x83')]();})['then'](function(_0xa98eb2){if(_0xa98eb2){_0x1450ad=_0xa98eb2[_0xba5d('0x107')];_0x3edc0b=_0xa98eb2[_0xba5d('0x84')];}})[_0xba5d('0x27')](function(){return db[_0xba5d('0xc3')][_0xba5d('0x58')]({'where':{'closed':![]}});})[_0xba5d('0x27')](function(_0x3abd0e){_0x24de5e=_0x3abd0e;if(_0x1450ad&&_0x3abd0e>_0x1450ad){return db['License'][_0xba5d('0x6e')]({'where':{'id':0x1}})[_0xba5d('0x27')](function(_0x24517c){if(_0x24517c){_0x24517c[_0xba5d('0x108')](_0xba5d('0x109'));}});}})['then'](function(){if(_0x305fba[_0xba5d('0x104')]&&_0x305fba[_0xba5d('0x104')]['Intervals']){var _0x5e2ea0=[];for(var _0x695d62=0x0;_0x695d62<_0x305fba[_0xba5d('0x104')][_0xba5d('0x105')][_0xba5d('0x5f')];_0x695d62++){var _0x50b5e8=_0x305fba[_0xba5d('0x104')]['Intervals'][_0x695d62][_0xba5d('0x3c')]({'plain':!![]});_0x5e2ea0[_0xba5d('0x10a')](iftimePromise(_0x50b5e8,_0x305fba));}return BPromise[_0xba5d('0x10b')](_0x5e2ea0)[_0xba5d('0x27')](function(_0x381376){return _[_0xba5d('0x10c')](_0x381376);});}else{return!![];}})[_0xba5d('0x27')](function(_0x59747b){var _0x199b7c=fs[_0xba5d('0x10d')](path['join'](config[_0xba5d('0x81')],_0xba5d('0x10e')),'utf8');var _0x2712c9={'remote':_0x305fba[_0xba5d('0x10f')],'query':querystring[_0xba5d('0x2c')](_[_0xba5d('0x56')](_0x305fba[_0xba5d('0x3c')]({'plain':!![]}),{'customerIp':_0x13e468[_0xba5d('0x94')][_0xba5d('0xb2')]||_0x13e468[_0xba5d('0x94')][_0xba5d('0x110')]||_0x13e468[_0xba5d('0x111')][_0xba5d('0x112')]||_0x13e468['ip'],'referer':_0x13e468[_0xba5d('0x94')]['referer'],'openedInteractions':_0x24de5e,'maxInteractions':_0x1450ad,'virtual':_0x3edc0b[_0xba5d('0x107')],'online':_0x59747b,'custom':_0x3edc0b}))[_0xba5d('0x113')](/'/g,'\x5c\x27')};_0x331a92[_0xba5d('0x40')](ejs[_0xba5d('0xdb')](Mustache[_0xba5d('0xdb')](_0x199b7c,_0x2712c9),{'proactiveActions':_0x330e89,'alignment':_0x305fba[_0xba5d('0x114')],'verticalAlignment':_0x305fba[_0xba5d('0x115')],'div_color':_0x305fba['color'],'text_color':_0x305fba['textColor']}));})[_0xba5d('0x5c')](handleError(_0x331a92,null));};exports[_0xba5d('0x116')]=function(_0xb9d419,_0x22d89f,_0x59e3f7){return db[_0xba5d('0x44')][_0xba5d('0x6e')]({'where':{'id':_0xb9d419[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x22d89f,null))[_0xba5d('0x27')](function(_0x3162d9){if(_0x3162d9){return db[_0xba5d('0x117')][_0xba5d('0x118')](function(_0x28cc93){return db[_0xba5d('0xa8')]['destroy']({'where':{'ChatWebsiteId':_0xb9d419['params']['id']},'transaction':_0x28cc93})[_0xba5d('0x27')](function(_0x37791d){var _0x2cca11=_[_0xba5d('0x4a')](_0xb9d419[_0xba5d('0x62')],function(_0x2f3043){_0x2f3043['ChatWebsiteId']=_0xb9d419[_0xba5d('0x69')]['id'];return _0x2f3043;});return db[_0xba5d('0xa8')][_0xba5d('0x119')](_0x2cca11,{'transaction':_0x28cc93});});})[_0xba5d('0x27')](function(){return db[_0xba5d('0xa8')][_0xba5d('0x11a')]({'where':{'ChatWebsiteId':_0xb9d419[_0xba5d('0x69')]['id']},'order':_0xba5d('0xad')});});}})['then'](respondWithResult(_0x22d89f,null))[_0xba5d('0x5c')](handleError(_0x22d89f,null));};exports['getApplications']=function(_0x2b19c2,_0x10cf7a,_0x2dd8e0){var _0x19519a={};var _0x5e48d9={};var _0xc16e9c;var _0x1f5bad;return db[_0xba5d('0x44')][_0xba5d('0x6e')]({'where':{'id':_0x2b19c2[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x10cf7a,null))[_0xba5d('0x27')](function(_0x9d3fc0){if(_0x9d3fc0){_0xc16e9c=_0x9d3fc0;_0x5e48d9[_0xba5d('0x49')]=_[_0xba5d('0x5e')](db[_0xba5d('0xa8')][_0xba5d('0x45')]);_0x5e48d9['query']=_[_0xba5d('0x5e')](_0x2b19c2[_0xba5d('0x4c')]);_0x5e48d9[_0xba5d('0x4d')]=_[_0xba5d('0x4f')](_0x5e48d9['model'],_0x5e48d9[_0xba5d('0x4c')]);_0x19519a[_0xba5d('0x4e')]=_[_0xba5d('0x4f')](_0x5e48d9['model'],qs[_0xba5d('0x50')](_0x2b19c2[_0xba5d('0x4c')][_0xba5d('0x50')]));_0x19519a[_0xba5d('0x4e')]=_0x19519a[_0xba5d('0x4e')][_0xba5d('0x5f')]?_0x19519a[_0xba5d('0x4e')]:_0x5e48d9[_0xba5d('0x49')];_0x19519a[_0xba5d('0x6f')]=qs['sort'](_0x2b19c2['query'][_0xba5d('0x53')]);_0x19519a['where']=qs[_0xba5d('0x4d')](_[_0xba5d('0x55')](_0x2b19c2[_0xba5d('0x4c')],_0x5e48d9['filters']));if(_0x2b19c2['query'][_0xba5d('0x70')]){_0x19519a['where']=_[_0xba5d('0x56')](_0x19519a[_0xba5d('0x54')],{'$or':_['map'](_0x19519a['attributes'],function(_0x37ab13){var _0x38d633={};_0x38d633[_0x37ab13]={'$like':'%'+_0x2b19c2[_0xba5d('0x4c')][_0xba5d('0x70')]+'%'};return _0x38d633;})});}_0x19519a=_[_0xba5d('0x56')]({},_0x19519a,_0x2b19c2[_0xba5d('0x57')]);return _0xc16e9c['getApplications'](_0x19519a);}})[_0xba5d('0x27')](function(_0x50d76e){if(_0x50d76e){_0x1f5bad=_0x50d76e[_0xba5d('0x5f')];if(!_0x2b19c2['query'][_0xba5d('0x51')]('nolimit')){_0x19519a[_0xba5d('0x34')]=qs[_0xba5d('0x34')](_0x2b19c2[_0xba5d('0x4c')]['limit']);_0x19519a[_0xba5d('0x33')]=qs['offset'](_0x2b19c2[_0xba5d('0x4c')][_0xba5d('0x33')]);}return _0xc16e9c[_0xba5d('0x11b')](_0x19519a);}})['then'](function(_0xd62b11){if(_0xd62b11){return _0xd62b11?{'count':_0x1f5bad,'rows':_0xd62b11}:null;}})[_0xba5d('0x27')](respondWithResult(_0x10cf7a,null))[_0xba5d('0x5c')](handleError(_0x10cf7a,null));};exports[_0xba5d('0x11c')]=function(_0x2f6a89,_0x3c0927,_0x3c1761){return db[_0xba5d('0x11d')][_0xba5d('0x60')]({'where':{'id':_0x2f6a89[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x3c0927,null))[_0xba5d('0x27')](function(_0x264f30){if(_0x264f30){return _0x264f30[_0xba5d('0x11c')](_0x2f6a89[_0xba5d('0x62')]['ids'],_[_0xba5d('0xef')](_0x2f6a89[_0xba5d('0x62')],[_0xba5d('0x73'),'id'])||{});}})[_0xba5d('0x27')](respondWithResult(_0x3c0927,null))[_0xba5d('0x5c')](handleError(_0x3c0927,null));};exports['getProactiveActions']=function(_0x49bcb3,_0x59fd31,_0x57b379){var _0x11f040={};var _0x457079={};var _0x260223;var _0x2167a3;return db['ChatWebsite']['findOne']({'where':{'id':_0x49bcb3['params']['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x59fd31,null))[_0xba5d('0x27')](function(_0x1c7517){if(_0x1c7517){_0x260223=_0x1c7517;_0x457079[_0xba5d('0x49')]=_['keys'](db[_0xba5d('0x11e')][_0xba5d('0x45')]);_0x457079[_0xba5d('0x4c')]=_[_0xba5d('0x5e')](_0x49bcb3[_0xba5d('0x4c')]);_0x457079[_0xba5d('0x4d')]=_[_0xba5d('0x4f')](_0x457079[_0xba5d('0x49')],_0x457079[_0xba5d('0x4c')]);_0x11f040[_0xba5d('0x4e')]=_[_0xba5d('0x4f')](_0x457079['model'],qs['fields'](_0x49bcb3[_0xba5d('0x4c')][_0xba5d('0x50')]));_0x11f040['attributes']=_0x11f040[_0xba5d('0x4e')][_0xba5d('0x5f')]?_0x11f040[_0xba5d('0x4e')]:_0x457079[_0xba5d('0x49')];_0x11f040[_0xba5d('0x6f')]=qs[_0xba5d('0x53')](_0x49bcb3[_0xba5d('0x4c')][_0xba5d('0x53')]);_0x11f040[_0xba5d('0x54')]=qs['filters'](_['pick'](_0x49bcb3[_0xba5d('0x4c')],_0x457079['filters']));if(_0x49bcb3['query'][_0xba5d('0x70')]){_0x11f040[_0xba5d('0x54')]=_[_0xba5d('0x56')](_0x11f040['where'],{'$or':_[_0xba5d('0x4a')](_0x11f040[_0xba5d('0x4e')],function(_0x1f2017){var _0x13368d={};_0x13368d[_0x1f2017]={'$like':'%'+_0x49bcb3[_0xba5d('0x4c')]['filter']+'%'};return _0x13368d;})});}_0x11f040=_[_0xba5d('0x56')]({},_0x11f040,_0x49bcb3[_0xba5d('0x57')]);return _0x260223['getProactiveActions'](_0x11f040);}})[_0xba5d('0x27')](function(_0x3b242a){if(_0x3b242a){_0x2167a3=_0x3b242a[_0xba5d('0x5f')];if(!_0x49bcb3[_0xba5d('0x4c')]['hasOwnProperty'](_0xba5d('0x52'))){_0x11f040[_0xba5d('0x34')]=qs[_0xba5d('0x34')](_0x49bcb3[_0xba5d('0x4c')][_0xba5d('0x34')]);_0x11f040[_0xba5d('0x33')]=qs['offset'](_0x49bcb3[_0xba5d('0x4c')][_0xba5d('0x33')]);}return _0x260223['getProactiveActions'](_0x11f040);}})[_0xba5d('0x27')](function(_0x3518e3){if(_0x3518e3){return _0x3518e3?{'count':_0x2167a3,'rows':_0x3518e3}:null;}})[_0xba5d('0x27')](respondWithResult(_0x59fd31,null))[_0xba5d('0x5c')](handleError(_0x59fd31,null));};exports[_0xba5d('0x11f')]=function(_0x552135,_0x5e959d,_0x4f4850){var _0x99d489=_0x552135['query'][_0xba5d('0x120')]===_0xba5d('0x121')?'offlineForm':_0xba5d('0x122');return db['ChatWebsite'][_0xba5d('0x60')]({'attributes':['id',_0x99d489],'where':{'id':_0x552135[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x5e959d,null))[_0xba5d('0x27')](function(_0x508bf6){if(_0x508bf6){var _0x2c74a4=_0x508bf6[_0x99d489];var _0x386c01=_0x2c74a4&&_0x2c74a4['items']?_0x2c74a4[_0xba5d('0x123')]:[];_0x5e959d[_0xba5d('0x40')]({'fromKey':_[_0xba5d('0x85')](_0x2c74a4[_0xba5d('0x124')])?undefined:_0x2c74a4[_0xba5d('0x124')],'count':_0x386c01[_0xba5d('0x5f')],'rows':_0x386c01});}})['catch'](handleError(_0x5e959d,null));};exports[_0xba5d('0x125')]=function(_0x473e,_0x7bde2d,_0x49d2b7){var _0x3dd7ab={'raw':![],'where':{}};var _0x5e18d0={};var _0xbf44f6={'count':0x0,'rows':[]};return db[_0xba5d('0x44')]['findOne']({'where':{'id':_0x473e['params']['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x7bde2d,null))[_0xba5d('0x27')](function(_0x30d59d){if(_0x30d59d){_0x5e18d0[_0xba5d('0x49')]=_[_0xba5d('0x5e')](db[_0xba5d('0xde')][_0xba5d('0x45')]);_0x5e18d0[_0xba5d('0x4c')]=_['keys'](_0x473e[_0xba5d('0x4c')]);_0x5e18d0[_0xba5d('0x4d')]=_[_0xba5d('0x4f')](_0x5e18d0[_0xba5d('0x49')],_0x5e18d0[_0xba5d('0x4c')]);_0x3dd7ab[_0xba5d('0x4e')]=_[_0xba5d('0x4f')](_0x5e18d0['model'],qs[_0xba5d('0x50')](_0x473e[_0xba5d('0x4c')][_0xba5d('0x50')]));_0x3dd7ab[_0xba5d('0x4e')]=_0x3dd7ab['attributes'][_0xba5d('0x5f')]?_0x3dd7ab[_0xba5d('0x4e')]:_0x5e18d0[_0xba5d('0x49')];if(!_0x473e['query']['hasOwnProperty'](_0xba5d('0x52'))){_0x3dd7ab[_0xba5d('0x34')]=qs[_0xba5d('0x34')](_0x473e[_0xba5d('0x4c')]['limit']);_0x3dd7ab['offset']=qs[_0xba5d('0x33')](_0x473e[_0xba5d('0x4c')][_0xba5d('0x33')]);}_0x3dd7ab[_0xba5d('0x6f')]=qs[_0xba5d('0x53')](_0x473e[_0xba5d('0x4c')][_0xba5d('0x53')]);_0x3dd7ab['where']=qs[_0xba5d('0x4d')](_[_0xba5d('0x55')](_0x473e['query'],_0x5e18d0[_0xba5d('0x4d')]));_0x3dd7ab[_0xba5d('0x54')][_0xba5d('0x6c')]=_0x30d59d['id'];if(_0x473e[_0xba5d('0x4c')]['filter']){_0x3dd7ab[_0xba5d('0x54')]=_[_0xba5d('0x56')](_0x3dd7ab[_0xba5d('0x54')],{'$or':_[_0xba5d('0x4a')](_0x3dd7ab[_0xba5d('0x4e')],function(_0x533612){var _0x206caa={};_0x206caa[_0x533612]={'$like':'%'+_0x473e[_0xba5d('0x4c')][_0xba5d('0x70')]+'%'};return _0x206caa;})});}_0x3dd7ab=_[_0xba5d('0x56')]({},_0x3dd7ab,_0x473e[_0xba5d('0x57')]);return db[_0xba5d('0xde')][_0xba5d('0x58')]({'where':_0x3dd7ab[_0xba5d('0x54')]})[_0xba5d('0x27')](function(_0x5adf94){_0xbf44f6[_0xba5d('0x58')]=_0x5adf94;if(_0x473e[_0xba5d('0x4c')][_0xba5d('0x59')]){_0x3dd7ab[_0xba5d('0x5a')]=[{'all':!![]}];}else{_0x3dd7ab[_0xba5d('0x5a')]=[{'model':db[_0xba5d('0x98')],'as':_0xba5d('0xf0'),'required':![]}];}return db[_0xba5d('0xde')][_0xba5d('0x5b')](_0x3dd7ab);})[_0xba5d('0x27')](function(_0x251960){_0xbf44f6[_0xba5d('0x71')]=_0x251960;return _0xbf44f6;});}})[_0xba5d('0x27')](respondWithFilteredResult(_0x7bde2d,_0x3dd7ab))[_0xba5d('0x5c')](handleError(_0x7bde2d,null));};exports[_0xba5d('0x126')]=function(_0x95bb0c,_0x4d82fd,_0x1aa4f0){return db['ChatWebsite'][_0xba5d('0x60')]({'where':{'id':_0x95bb0c['params']['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x4d82fd,null))['then'](function(_0x3c36d3){if(_0x3c36d3){return _0x3c36d3[_0xba5d('0x126')](_0x95bb0c[_0xba5d('0x62')][_0xba5d('0x73')],_['omit'](_0x95bb0c[_0xba5d('0x62')],['ids','id'])||{})[_0xba5d('0xd9')](function(_0x57702b){for(var _0x94cf8f=0x0;_0x94cf8f<_0x95bb0c[_0xba5d('0x62')]['ids']['length'];_0x94cf8f+=0x1){socket['emit'](_0xba5d('0x127'),{'UserId':_0x95bb0c['body'][_0xba5d('0x73')][_0x94cf8f],'ChatWebsiteId':_0x95bb0c[_0xba5d('0x69')]['id']});}return _0x57702b;});}})['then'](respondWithResult(_0x4d82fd,null))[_0xba5d('0x5c')](handleError(_0x4d82fd,null));};exports['removeAgents']=function(_0x505d3e,_0x4f53e8,_0x3f04d5){return db[_0xba5d('0x44')][_0xba5d('0x60')]({'where':{'id':_0x505d3e[_0xba5d('0x69')]['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x4f53e8,null))[_0xba5d('0x27')](function(_0xd91125){if(_0xd91125){return _0xd91125[_0xba5d('0x128')](_0x505d3e[_0xba5d('0x4c')][_0xba5d('0x73')])[_0xba5d('0x27')](function(){if(_[_0xba5d('0x129')](_0x505d3e['query']['ids'])){for(var _0x47f8cf=0x0;_0x47f8cf<_0x505d3e['query'][_0xba5d('0x73')][_0xba5d('0x5f')];_0x47f8cf+=0x1){socket[_0xba5d('0x12a')](_0xba5d('0x12b'),{'UserId':Number(_0x505d3e[_0xba5d('0x4c')][_0xba5d('0x73')][_0x47f8cf]),'ChatWebsiteId':Number(_0x505d3e[_0xba5d('0x69')]['id'])});}}else{socket[_0xba5d('0x12a')](_0xba5d('0x12b'),{'UserId':Number(_0x505d3e[_0xba5d('0x4c')][_0xba5d('0x73')]),'ChatWebsiteId':Number(_0x505d3e[_0xba5d('0x69')]['id'])});}});}})['then'](respondWithStatusCode(_0x4f53e8,null))[_0xba5d('0x5c')](handleError(_0x4f53e8,null));};exports['getAgents']=function(_0x1c3f9c,_0x53e075,_0x1aeae8){var _0xae6218={};var _0x511109={};var _0x379251;var _0x18718f;return db['ChatWebsite'][_0xba5d('0x6e')]({'where':{'id':_0x1c3f9c['params']['id']}})[_0xba5d('0x27')](handleEntityNotFound(_0x53e075,null))[_0xba5d('0x27')](function(_0x2b05fc){if(_0x2b05fc){_0x379251=_0x2b05fc;_0x511109['model']=_[_0xba5d('0x5e')](db[_0xba5d('0xcc')][_0xba5d('0x45')]);_0x511109[_0xba5d('0x4c')]=_[_0xba5d('0x5e')](_0x1c3f9c['query']);_0x511109[_0xba5d('0x4d')]=_[_0xba5d('0x4f')](_0x511109[_0xba5d('0x49')],_0x511109['query']);_0xae6218['attributes']=_[_0xba5d('0x4f')](_0x511109[_0xba5d('0x49')],qs[_0xba5d('0x50')](_0x1c3f9c[_0xba5d('0x4c')][_0xba5d('0x50')]));_0xae6218[_0xba5d('0x4e')]=_0xae6218['attributes'][_0xba5d('0x5f')]?_0xae6218['attributes']:_0x511109[_0xba5d('0x49')];_0xae6218[_0xba5d('0x6f')]=qs[_0xba5d('0x53')](_0x1c3f9c['query']['sort']);_0xae6218[_0xba5d('0x54')]=qs[_0xba5d('0x4d')](_[_0xba5d('0x55')](_0x1c3f9c[_0xba5d('0x4c')],_0x511109[_0xba5d('0x4d')]));if(_0x1c3f9c[_0xba5d('0x4c')][_0xba5d('0x70')]){_0xae6218[_0xba5d('0x54')]=_[_0xba5d('0x56')](_0xae6218[_0xba5d('0x54')],{'$or':_['map'](_0xae6218[_0xba5d('0x4e')],function(_0x284c2f){var _0x2f0450={};_0x2f0450[_0x284c2f]={'$like':'%'+_0x1c3f9c[_0xba5d('0x4c')][_0xba5d('0x70')]+'%'};return _0x2f0450;})});}_0xae6218=_['merge']({},_0xae6218,_0x1c3f9c[_0xba5d('0x57')]);return _0x379251['getAgents'](_0xae6218);}})[_0xba5d('0x27')](function(_0x2265ef){if(_0x2265ef){_0x18718f=_0x2265ef[_0xba5d('0x5f')];if(!_0x1c3f9c['query'][_0xba5d('0x51')](_0xba5d('0x52'))){_0xae6218['limit']=qs[_0xba5d('0x34')](_0x1c3f9c[_0xba5d('0x4c')]['limit']);_0xae6218[_0xba5d('0x33')]=qs[_0xba5d('0x33')](_0x1c3f9c[_0xba5d('0x4c')]['offset']);}return _0x379251['getAgents'](_0xae6218);}})[_0xba5d('0x27')](function(_0x2b59f2){if(_0x2b59f2){return _0x2b59f2?{'count':_0x18718f,'rows':_0x2b59f2}:null;}})[_0xba5d('0x27')](respondWithResult(_0x53e075,null))['catch'](handleError(_0x53e075,null));}; \ No newline at end of file +var _0x80fe=['server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','account','applications','Applications','list','priority','asc','mapKey','from','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','type','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','no\x20available\x20attributes','mapKeyOffline','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','Contact','User','Owner','fullname','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','getProactiveActions','virtual','chatLicenseExceeded','Intervals','push','some','server/files/chat/iframe.js','remote','x-real-ip','remoteAddress','replace','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','omit','false','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','nolimit','include','removeDispositions','ids','addAnswer','findOne','CannedAnswer','order','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x80fe,0x1b2));var _0xe80f=function(_0x40a755,_0x507056){_0x40a755=_0x40a755-0x0;var _0x30e392=_0x80fe[_0x40a755];return _0x30e392;};'use strict';var pdf=require(_0xe80f('0x0'));var emlformat=require(_0xe80f('0x1'));var rimraf=require(_0xe80f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe80f('0x3'));var rp=require(_0xe80f('0x4'));var moment=require(_0xe80f('0x5'));var BPromise=require(_0xe80f('0x6'));var Mustache=require('mustache');var util=require(_0xe80f('0x7'));var path=require(_0xe80f('0x8'));var sox=require(_0xe80f('0x9'));var csv=require(_0xe80f('0xa'));var ejs=require(_0xe80f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe80f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe80f('0xa'));var querystring=require(_0xe80f('0xd'));var Papa=require(_0xe80f('0xe'));var Redis=require(_0xe80f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe80f('0x10'));var as=require(_0xe80f('0x11'));var hardwareService=require(_0xe80f('0x12'));var logger=require(_0xe80f('0x13'))(_0xe80f('0x14'));var utils=require('../../config/utils');var config=require(_0xe80f('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xe80f('0x16')](config[_0xe80f('0x17')],{'host':_0xe80f('0x18'),'port':0x18eb});var socket=require(_0xe80f('0x19'))(new Redis(config[_0xe80f('0x17')]));require(_0xe80f('0x1a'))[_0xe80f('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe80f('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0xe80f('0x1d')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});function checkPasswordPattern(_0x209ad1,_0x4ff88e,_0x4ed2cf){if(_0x4ed2cf){var _0x2a9f32=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a9f32[_0xe80f('0x1e')](_0x4ff88e)){return _0x209ad1;}else{throw new db['Sequelize'][(_0xe80f('0x1f'))](_0xe80f('0x20'));}}else{return _0x209ad1;}}function respondWithRpcPromise(_0x5441d1,_0x4bed41,_0x3c198a,_0x22830c){return new BPromise(function(_0x1db470,_0x2daf95){var _0x32cdcc=_0x22830c||client;return _0x32cdcc['request'](_0x5441d1,_0x3c198a)[_0xe80f('0x21')](function(_0x4f85af){logger['info'](_0xe80f('0x22'),_0x4bed41,'request\x20sent');logger[_0xe80f('0x23')](_0xe80f('0x24'),_0x4bed41,'request\x20sent',JSON['stringify'](_0x4f85af));if(_0x4f85af['error']){if(_0x4f85af[_0xe80f('0x25')][_0xe80f('0x26')]===0x1f4){logger[_0xe80f('0x25')](_0xe80f('0x22'),_0x4bed41,_0x4f85af[_0xe80f('0x25')][_0xe80f('0x27')]);return _0x2daf95(_0x4f85af[_0xe80f('0x25')][_0xe80f('0x27')]);}logger[_0xe80f('0x25')](_0xe80f('0x22'),_0x4bed41,_0x4f85af[_0xe80f('0x25')][_0xe80f('0x27')]);return _0x1db470(_0x4f85af[_0xe80f('0x25')]['message']);}else{logger[_0xe80f('0x28')](_0xe80f('0x22'),_0x4bed41,_0xe80f('0x29'));_0x1db470(_0x4f85af[_0xe80f('0x2a')][_0xe80f('0x27')]);}})[_0xe80f('0x2b')](function(_0x467f9d){logger[_0xe80f('0x25')](_0xe80f('0x22'),_0x4bed41,_0x467f9d);_0x2daf95(_0x467f9d);});});}function respondWithStatusCode(_0xa1aaeb,_0x4ccc4d){_0x4ccc4d=_0x4ccc4d||0xcc;return function(_0x224d5b){if(_0x224d5b){return _0xa1aaeb[_0xe80f('0x2c')](_0x4ccc4d);}return _0xa1aaeb[_0xe80f('0x2d')](_0x4ccc4d)['end']();};}function respondWithResult(_0x5a3719,_0x59687a){_0x59687a=_0x59687a||0xc8;return function(_0x5a95ee){if(_0x5a95ee){return _0x5a3719[_0xe80f('0x2d')](_0x59687a)[_0xe80f('0x2e')](_0x5a95ee);}};}function respondWithFilteredResult(_0x168a9c,_0x53037d){return function(_0x1ce329){if(_0x1ce329){var _0x40c6fa=_0x1ce329[_0xe80f('0x2f')],_0x154ed7=_0x53037d['offset'],_0x2d0369=_0x53037d[_0xe80f('0x30')]+_0x53037d['limit'],_0x5d514e;if(_0x2d0369>=_0x40c6fa){_0x2d0369=_0x40c6fa;_0x5d514e=0xc8;}else{_0x5d514e=0xce;}_0x168a9c[_0xe80f('0x2d')](_0x5d514e);return _0x168a9c[_0xe80f('0x31')](_0xe80f('0x32'),_0x154ed7+'-'+_0x2d0369+'/'+_0x40c6fa)[_0xe80f('0x2e')](_0x1ce329);}return null;};}function patchUpdates(_0x566166){return function(_0x586d9e){try{jsonpatch[_0xe80f('0x33')](_0x586d9e,_0x566166,!![]);}catch(_0x39a581){return BPromise[_0xe80f('0x34')](_0x39a581);}return _0x586d9e[_0xe80f('0x35')]();};}function saveUpdates(_0x50ee88,_0x46b766){return function(_0x485292){if(_0x485292){return _0x485292[_0xe80f('0x36')](_0x50ee88)[_0xe80f('0x21')](function(_0x40cd17){return _0x40cd17;});}return null;};}function removeEntity(_0x454fc6,_0x326d45){return function(_0x35684c){if(_0x35684c){return _0x35684c[_0xe80f('0x37')]()['then'](function(){var _0x1aaedf=_0x35684c[_0xe80f('0x38')]({'plain':!![]});var _0x9a51f3=_0xe80f('0x39');return db[_0xe80f('0x3a')]['destroy']({'where':{'type':_0x9a51f3,'resourceId':_0x1aaedf['id']}})[_0xe80f('0x21')](function(){return _0x35684c;});})[_0xe80f('0x21')](function(){_0x454fc6[_0xe80f('0x2d')](0xcc)[_0xe80f('0x3b')]();});}};}function handleEntityNotFound(_0x5a7b75,_0x381b97){return function(_0x2546e0){if(!_0x2546e0){_0x5a7b75[_0xe80f('0x2c')](0x194);}return _0x2546e0;};}function handleError(_0x49bce,_0x5fa710){_0x5fa710=_0x5fa710||0x1f4;return function(_0x58ad30){logger[_0xe80f('0x25')](_0x58ad30[_0xe80f('0x3c')]);if(_0x58ad30['name']){delete _0x58ad30[_0xe80f('0x3d')];}_0x49bce[_0xe80f('0x2d')](_0x5fa710)[_0xe80f('0x3e')](_0x58ad30);};}exports[_0xe80f('0x3f')]=function(_0x20b560,_0x33e23d){var _0x36ecf9={'include':[{'model':db[_0xe80f('0x40')],'as':_0xe80f('0x41')}]},_0x4de5f1={},_0xf33cd8={'count':0x0,'rows':[]};var _0x33d366=_[_0xe80f('0x42')](db[_0xe80f('0x43')][_0xe80f('0x44')],function(_0x1589e8){return{'name':_0x1589e8[_0xe80f('0x45')],'type':_0x1589e8['type'][_0xe80f('0x46')]};});_0x4de5f1['model']=_[_0xe80f('0x42')](_0x33d366,_0xe80f('0x3d'));_0x4de5f1[_0xe80f('0x47')]=_[_0xe80f('0x48')](_0x20b560[_0xe80f('0x47')]);_0x4de5f1[_0xe80f('0x49')]=_[_0xe80f('0x4a')](_0x4de5f1[_0xe80f('0x4b')],_0x4de5f1[_0xe80f('0x47')]);_0x36ecf9['attributes']=_[_0xe80f('0x4a')](_0x4de5f1['model'],qs[_0xe80f('0x4c')](_0x20b560[_0xe80f('0x47')][_0xe80f('0x4c')]));_0x36ecf9['attributes']=_0x36ecf9[_0xe80f('0x4d')][_0xe80f('0x4e')]?_0x36ecf9['attributes']:_0x4de5f1[_0xe80f('0x4b')];if(!_0x20b560[_0xe80f('0x47')][_0xe80f('0x4f')]('nolimit')){_0x36ecf9['limit']=qs[_0xe80f('0x50')](_0x20b560[_0xe80f('0x47')][_0xe80f('0x50')]);_0x36ecf9[_0xe80f('0x30')]=qs[_0xe80f('0x30')](_0x20b560[_0xe80f('0x47')][_0xe80f('0x30')]);}_0x36ecf9['order']=qs[_0xe80f('0x51')](_0x20b560[_0xe80f('0x47')][_0xe80f('0x51')]);_0x36ecf9[_0xe80f('0x52')]=qs['filters'](_[_0xe80f('0x53')](_0x20b560[_0xe80f('0x47')],_0x4de5f1[_0xe80f('0x49')]),_0x33d366);if(_0x20b560[_0xe80f('0x47')][_0xe80f('0x54')]){_0x36ecf9[_0xe80f('0x52')]=_[_0xe80f('0x55')](_0x36ecf9['where'],{'$or':_[_0xe80f('0x42')](_0x33d366,function(_0x37702d){if(_0x37702d['type']!==_0xe80f('0x56')){var _0x4c1bf9={};_0x4c1bf9[_0x37702d[_0xe80f('0x3d')]]={'$like':'%'+_0x20b560['query'][_0xe80f('0x54')]+'%'};return _0x4c1bf9;}})});}_0x36ecf9=_[_0xe80f('0x55')]({},_0x36ecf9,_0x20b560[_0xe80f('0x57')]);var _0x59df05={'where':_0x36ecf9['where']};return db['ChatWebsite'][_0xe80f('0x2f')](_0x59df05)['then'](function(_0x296453){_0xf33cd8[_0xe80f('0x2f')]=_0x296453;if(_0x20b560[_0xe80f('0x47')][_0xe80f('0x58')]){_0x36ecf9['include']=[{'all':!![]}];}return db[_0xe80f('0x43')][_0xe80f('0x59')](_0x36ecf9);})[_0xe80f('0x21')](function(_0x176006){_0xf33cd8[_0xe80f('0x5a')]=_0x176006;return _0xf33cd8;})[_0xe80f('0x21')](respondWithFilteredResult(_0x33e23d,_0x36ecf9))['catch'](handleError(_0x33e23d,null));};exports[_0xe80f('0x5b')]=function(_0x36f559,_0x5cb7e9){var _0x4193f9={'raw':![],'where':{'id':_0x36f559[_0xe80f('0x5c')]['id']},'include':[{'model':db[_0xe80f('0x40')],'as':_0xe80f('0x41')}]},_0x509728={};_0x509728[_0xe80f('0x4b')]=_['keys'](db['ChatWebsite'][_0xe80f('0x44')]);_0x509728[_0xe80f('0x47')]=_[_0xe80f('0x48')](_0x36f559[_0xe80f('0x47')]);_0x509728[_0xe80f('0x49')]=_[_0xe80f('0x4a')](_0x509728[_0xe80f('0x4b')],_0x509728[_0xe80f('0x47')]);_0x4193f9['attributes']=_['intersection'](_0x509728[_0xe80f('0x4b')],qs[_0xe80f('0x4c')](_0x36f559['query']['fields']));_0x4193f9['attributes']=_0x4193f9[_0xe80f('0x4d')][_0xe80f('0x4e')]?_0x4193f9[_0xe80f('0x4d')]:_0x509728['model'];if(_0x36f559[_0xe80f('0x47')]['includeAll']){_0x4193f9['include']=[{'all':!![]}];}_0x4193f9=_[_0xe80f('0x55')]({},_0x4193f9,_0x36f559[_0xe80f('0x57')]);return db[_0xe80f('0x43')]['find'](_0x4193f9)['then'](handleEntityNotFound(_0x5cb7e9,null))[_0xe80f('0x21')](respondWithResult(_0x5cb7e9,null))[_0xe80f('0x2b')](handleError(_0x5cb7e9,null));};exports[_0xe80f('0x5d')]=function(_0x163b0b,_0x9a30dd){return db[_0xe80f('0x43')][_0xe80f('0x5d')](_0x163b0b[_0xe80f('0x5e')],{})[_0xe80f('0x21')](function(_0x53daa8){var _0xd22267=_0x163b0b[_0xe80f('0x5f')][_0xe80f('0x38')]({'plain':!![]});if(!_0xd22267)throw new Error(_0xe80f('0x60'));if(_0xd22267[_0xe80f('0x61')]===_0xe80f('0x5f')){var _0x1cde76=_0x53daa8[_0xe80f('0x38')]({'plain':!![]});var _0x78a9d4=_0xe80f('0x39');return db[_0xe80f('0x62')][_0xe80f('0x63')]({'where':{'name':_0x78a9d4,'userProfileId':_0xd22267[_0xe80f('0x64')]},'raw':!![]})[_0xe80f('0x21')](function(_0x40f384){if(_0x40f384&&_0x40f384['autoAssociation']===0x0){return db[_0xe80f('0x3a')][_0xe80f('0x5d')]({'name':_0x1cde76[_0xe80f('0x3d')],'resourceId':_0x1cde76['id'],'type':_0x40f384[_0xe80f('0x3d')],'sectionId':_0x40f384['id']},{})['then'](function(){return _0x53daa8;});}else{return _0x53daa8;}})[_0xe80f('0x2b')](function(_0x21d364){logger[_0xe80f('0x25')](_0xe80f('0x65'),_0x21d364);throw _0x21d364;});}return _0x53daa8;})['then'](respondWithResult(_0x9a30dd,0xc9))[_0xe80f('0x2b')](handleError(_0x9a30dd,null));};exports[_0xe80f('0x36')]=function(_0x4fa5cf,_0x54437c){if(_0x4fa5cf[_0xe80f('0x5e')]['id']){delete _0x4fa5cf[_0xe80f('0x5e')]['id'];}return db['ChatWebsite'][_0xe80f('0x63')]({'where':{'id':_0x4fa5cf[_0xe80f('0x5c')]['id']},'include':[{'model':db[_0xe80f('0x40')],'as':_0xe80f('0x41')}]})[_0xe80f('0x21')](handleEntityNotFound(_0x54437c,null))[_0xe80f('0x21')](saveUpdates(_0x4fa5cf['body'],null))[_0xe80f('0x21')](respondWithResult(_0x54437c,null))[_0xe80f('0x2b')](handleError(_0x54437c,null));};exports[_0xe80f('0x37')]=function(_0x5316b2,_0x3e987f){return db['ChatWebsite']['find']({'where':{'id':_0x5316b2[_0xe80f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3e987f,null))[_0xe80f('0x21')](removeEntity(_0x3e987f,null))[_0xe80f('0x2b')](handleError(_0x3e987f,null));};exports[_0xe80f('0x66')]=function(_0xd77369,_0x2db0ee){return db[_0xe80f('0x43')]['describe']()[_0xe80f('0x21')](respondWithResult(_0x2db0ee,null))[_0xe80f('0x2b')](handleError(_0x2db0ee,null));};exports[_0xe80f('0x67')]=function(_0x19f549,_0x1d6637,_0x149fea){if(_0x19f549['body']['id']){delete _0x19f549[_0xe80f('0x5e')]['id'];}return db[_0xe80f('0x43')][_0xe80f('0x63')]({'where':{'id':_0x19f549[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x1d6637,null))['then'](function(_0x5d5037){if(_0x5d5037){_0x19f549[_0xe80f('0x5e')][_0xe80f('0x68')]=_0x5d5037['id'];return db[_0xe80f('0x69')]['create'](_0x19f549['body']);}})[_0xe80f('0x21')](respondWithResult(_0x1d6637,null))[_0xe80f('0x2b')](handleError(_0x1d6637,null));};exports['getDispositions']=function(_0x41001e,_0x583955,_0x5c3892){var _0x101fad={'raw':![],'where':{}};var _0x5e3e55={};var _0x29f7ce={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x41001e[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x583955,null))[_0xe80f('0x21')](function(_0x20c207){if(_0x20c207){_0x5e3e55[_0xe80f('0x4b')]=_[_0xe80f('0x48')](db[_0xe80f('0x69')][_0xe80f('0x44')]);_0x5e3e55[_0xe80f('0x47')]=_[_0xe80f('0x48')](_0x41001e[_0xe80f('0x47')]);_0x5e3e55[_0xe80f('0x49')]=_[_0xe80f('0x4a')](_0x5e3e55[_0xe80f('0x4b')],_0x5e3e55['query']);_0x101fad[_0xe80f('0x4d')]=_[_0xe80f('0x4a')](_0x5e3e55[_0xe80f('0x4b')],qs[_0xe80f('0x4c')](_0x41001e[_0xe80f('0x47')][_0xe80f('0x4c')]));_0x101fad[_0xe80f('0x4d')]=_0x101fad[_0xe80f('0x4d')][_0xe80f('0x4e')]?_0x101fad['attributes']:_0x5e3e55['model'];if(!_0x41001e['query'][_0xe80f('0x4f')](_0xe80f('0x6a'))){_0x101fad[_0xe80f('0x50')]=qs[_0xe80f('0x50')](_0x41001e[_0xe80f('0x47')][_0xe80f('0x50')]);_0x101fad['offset']=qs[_0xe80f('0x30')](_0x41001e[_0xe80f('0x47')]['offset']);}_0x101fad['order']=qs['sort'](_0x41001e[_0xe80f('0x47')][_0xe80f('0x51')]);_0x101fad[_0xe80f('0x52')]=qs['filters'](_[_0xe80f('0x53')](_0x41001e[_0xe80f('0x47')],_0x5e3e55[_0xe80f('0x49')]));_0x101fad[_0xe80f('0x52')][_0xe80f('0x68')]=_0x20c207['id'];if(_0x41001e['query'][_0xe80f('0x54')]){_0x101fad['where']=_[_0xe80f('0x55')](_0x101fad[_0xe80f('0x52')],{'$or':_[_0xe80f('0x42')](_0x101fad[_0xe80f('0x4d')],function(_0x1a2c98){var _0x55d00e={};_0x55d00e[_0x1a2c98]={'$like':'%'+_0x41001e['query'][_0xe80f('0x54')]+'%'};return _0x55d00e;})});}_0x101fad=_[_0xe80f('0x55')]({},_0x101fad,_0x41001e[_0xe80f('0x57')]);return db['Disposition'][_0xe80f('0x2f')]({'where':_0x101fad['where']})[_0xe80f('0x21')](function(_0x23bb65){_0x29f7ce[_0xe80f('0x2f')]=_0x23bb65;if(_0x41001e[_0xe80f('0x47')][_0xe80f('0x58')]){_0x101fad[_0xe80f('0x6b')]=[{'all':!![]}];}return db[_0xe80f('0x69')][_0xe80f('0x59')](_0x101fad);})[_0xe80f('0x21')](function(_0x5e5902){_0x29f7ce[_0xe80f('0x5a')]=_0x5e5902;return _0x29f7ce;});}})[_0xe80f('0x21')](respondWithFilteredResult(_0x583955,_0x101fad))['catch'](handleError(_0x583955,null));};exports[_0xe80f('0x6c')]=function(_0x24c886,_0x49f223,_0x4d0d1b){return db[_0xe80f('0x43')][_0xe80f('0x63')]({'where':{'id':_0x24c886[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x49f223,null))[_0xe80f('0x21')](function(_0x1cfe8c){if(_0x1cfe8c){return _0x1cfe8c['removeDispositions'](_0x24c886[_0xe80f('0x47')][_0xe80f('0x6d')]);}})['then'](respondWithStatusCode(_0x49f223,null))[_0xe80f('0x2b')](handleError(_0x49f223,null));};exports[_0xe80f('0x6e')]=function(_0x1d05de,_0x807c16,_0x5b4669){if(_0x1d05de['body']['id']){delete _0x1d05de[_0xe80f('0x5e')]['id'];}return db[_0xe80f('0x43')][_0xe80f('0x63')]({'where':{'id':_0x1d05de['params']['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x807c16,null))['then'](function(_0x5bcab4){if(_0x5bcab4){_0x1d05de[_0xe80f('0x5e')][_0xe80f('0x68')]=_0x5bcab4['id'];return db['CannedAnswer'][_0xe80f('0x5d')](_0x1d05de[_0xe80f('0x5e')]);}})[_0xe80f('0x21')](respondWithResult(_0x807c16,null))[_0xe80f('0x2b')](handleError(_0x807c16,null));};exports['getAnswers']=function(_0x2bd261,_0x18bd75,_0xe3fb76){var _0x651e43={'raw':![],'where':{}};var _0x551c3c={};var _0x15c7bc={'count':0x0,'rows':[]};return db[_0xe80f('0x43')][_0xe80f('0x6f')]({'where':{'id':_0x2bd261[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x18bd75,null))[_0xe80f('0x21')](function(_0xa0fc6c){if(_0xa0fc6c){_0x551c3c['model']=_[_0xe80f('0x48')](db[_0xe80f('0x70')][_0xe80f('0x44')]);_0x551c3c['query']=_[_0xe80f('0x48')](_0x2bd261[_0xe80f('0x47')]);_0x551c3c[_0xe80f('0x49')]=_[_0xe80f('0x4a')](_0x551c3c[_0xe80f('0x4b')],_0x551c3c[_0xe80f('0x47')]);_0x651e43['attributes']=_[_0xe80f('0x4a')](_0x551c3c['model'],qs['fields'](_0x2bd261[_0xe80f('0x47')][_0xe80f('0x4c')]));_0x651e43[_0xe80f('0x4d')]=_0x651e43['attributes'][_0xe80f('0x4e')]?_0x651e43['attributes']:_0x551c3c[_0xe80f('0x4b')];if(!_0x2bd261['query']['hasOwnProperty'](_0xe80f('0x6a'))){_0x651e43[_0xe80f('0x50')]=qs[_0xe80f('0x50')](_0x2bd261[_0xe80f('0x47')]['limit']);_0x651e43[_0xe80f('0x30')]=qs['offset'](_0x2bd261[_0xe80f('0x47')][_0xe80f('0x30')]);}_0x651e43[_0xe80f('0x71')]=qs['sort'](_0x2bd261['query'][_0xe80f('0x51')]);_0x651e43['where']=qs[_0xe80f('0x49')](_[_0xe80f('0x53')](_0x2bd261[_0xe80f('0x47')],_0x551c3c[_0xe80f('0x49')]));_0x651e43[_0xe80f('0x52')][_0xe80f('0x68')]=_0xa0fc6c['id'];if(_0x2bd261['query'][_0xe80f('0x54')]){_0x651e43[_0xe80f('0x52')]=_[_0xe80f('0x55')](_0x651e43[_0xe80f('0x52')],{'$or':_[_0xe80f('0x42')](_0x651e43[_0xe80f('0x4d')],function(_0x396cbe){var _0x29780a={};_0x29780a[_0x396cbe]={'$like':'%'+_0x2bd261[_0xe80f('0x47')][_0xe80f('0x54')]+'%'};return _0x29780a;})});}_0x651e43=_['merge']({},_0x651e43,_0x2bd261[_0xe80f('0x57')]);return db[_0xe80f('0x70')][_0xe80f('0x2f')]({'where':_0x651e43[_0xe80f('0x52')]})[_0xe80f('0x21')](function(_0x27c57a){_0x15c7bc[_0xe80f('0x2f')]=_0x27c57a;if(_0x2bd261['query'][_0xe80f('0x58')]){_0x651e43[_0xe80f('0x6b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x651e43);})[_0xe80f('0x21')](function(_0x410766){_0x15c7bc[_0xe80f('0x5a')]=_0x410766;return _0x15c7bc;});}})['then'](respondWithFilteredResult(_0x18bd75,_0x651e43))[_0xe80f('0x2b')](handleError(_0x18bd75,null));};exports[_0xe80f('0x72')]=function(_0x1e578d,_0x1e7283,_0x57cc67){return db['ChatWebsite'][_0xe80f('0x63')]({'where':{'id':_0x1e578d[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x1e7283,null))[_0xe80f('0x21')](function(_0x337c0a){if(_0x337c0a){return _0x337c0a[_0xe80f('0x72')](_0x1e578d['query'][_0xe80f('0x6d')]);}})[_0xe80f('0x21')](respondWithStatusCode(_0x1e7283,null))[_0xe80f('0x2b')](handleError(_0x1e7283,null));};exports[_0xe80f('0x73')]=function(_0xc9a758,_0x386e5a,_0x59f3f2){_0xc9a758[_0xe80f('0x5e')][_0xe80f('0x74')]=_0xc9a758[_0xe80f('0x75')][_0xe80f('0x76')];return db[_0xe80f('0x43')][_0xe80f('0x63')]({'where':{'id':_0xc9a758[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x386e5a,null))['then'](saveUpdates(_0xc9a758[_0xe80f('0x5e')],null))['then'](respondWithResult(_0x386e5a,null))[_0xe80f('0x2b')](handleError(_0x386e5a,null));};exports['addAvatar']=function(_0x4335d6,_0x3a0891,_0x59cabf){_0x4335d6['body'][_0xe80f('0x77')]=_0x4335d6[_0xe80f('0x75')][_0xe80f('0x76')];return db[_0xe80f('0x43')][_0xe80f('0x63')]({'where':{'id':_0x4335d6[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x3a0891,null))['then'](saveUpdates(_0x4335d6['body'],null))['then'](respondWithResult(_0x3a0891,null))['catch'](handleError(_0x3a0891,null));};exports['addCustomerAvatar']=function(_0x4b2ded,_0x17c4e1,_0x11fa86){_0x4b2ded[_0xe80f('0x5e')][_0xe80f('0x78')]=_0x4b2ded[_0xe80f('0x75')][_0xe80f('0x76')];return db[_0xe80f('0x43')]['find']({'where':{'id':_0x4b2ded['params']['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x17c4e1,null))['then'](saveUpdates(_0x4b2ded[_0xe80f('0x5e')],null))[_0xe80f('0x21')](respondWithResult(_0x17c4e1,null))[_0xe80f('0x2b')](handleError(_0x17c4e1,null));};exports[_0xe80f('0x79')]=function(_0x115f5c,_0x48dbcc,_0x552366){_0x115f5c[_0xe80f('0x5e')][_0xe80f('0x7a')]=_0x115f5c[_0xe80f('0x75')][_0xe80f('0x76')];return db[_0xe80f('0x43')][_0xe80f('0x63')]({'where':{'id':_0x115f5c['params']['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x48dbcc,null))['then'](saveUpdates(_0x115f5c[_0xe80f('0x5e')],null))[_0xe80f('0x21')](respondWithResult(_0x48dbcc,null))['catch'](handleError(_0x48dbcc,null));};exports[_0xe80f('0x7b')]=function(_0x2a6d02,_0x5e0fb7,_0xd46b53){var _0x14dc66=path[_0xe80f('0x7c')](config['root'],_0xe80f('0x7d'));var _0x1274cd={'where':{'id':_0x2a6d02[_0xe80f('0x5c')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x58f4e8=![];return require(_0xe80f('0x7e'))[_0xe80f('0x7f')]()['then'](function(_0x21333a){if(_0x21333a){_0x58f4e8=_0x21333a[_0xe80f('0x80')];}})[_0xe80f('0x21')](function(){return db['ChatWebsite'][_0xe80f('0x63')](_0x1274cd);})[_0xe80f('0x21')](handleEntityNotFound(_0x5e0fb7,null))['then'](function(_0x356935){if(_0x356935){if(!_[_0xe80f('0x81')](_0x356935['sitepic'])){if(fs[_0xe80f('0x82')](path[_0xe80f('0x7c')](config[_0xe80f('0x83')],_0xe80f('0x84'),_0x356935[_0xe80f('0x74')]))&&_0x58f4e8){_0x14dc66=path[_0xe80f('0x7c')](config[_0xe80f('0x83')],_0xe80f('0x84'),_0x356935[_0xe80f('0x74')]);}}return _0x5e0fb7[_0xe80f('0x85')](_0x14dc66);}})[_0xe80f('0x2b')](handleError(_0x5e0fb7,null));};exports[_0xe80f('0x86')]=function(_0x57f2ac,_0x596682,_0x3ba6b0){var _0x3704c3=path[_0xe80f('0x7c')](config[_0xe80f('0x83')],'server/files/images/avatars/default_avatar.png');var _0x5c9581={'where':{'id':_0x57f2ac[_0xe80f('0x5c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xe80f('0x43')][_0xe80f('0x63')](_0x5c9581)[_0xe80f('0x21')](handleEntityNotFound(_0x596682,null))[_0xe80f('0x21')](function(_0x1ae47b){if(_0x1ae47b){if(!_[_0xe80f('0x81')](_0x1ae47b[_0xe80f('0x77')])){if(fs[_0xe80f('0x82')](path[_0xe80f('0x7c')](config[_0xe80f('0x83')],_0xe80f('0x87'),_0x1ae47b[_0xe80f('0x77')]))){_0x3704c3=path['join'](config[_0xe80f('0x83')],'server/files/images/avatars/',_0x1ae47b[_0xe80f('0x77')]);}}return _0x596682[_0xe80f('0x85')](_0x3704c3);}})[_0xe80f('0x2b')](handleError(_0x596682,null));};exports[_0xe80f('0x88')]=function(_0x1c51c1,_0x29074b,_0x3f5501){var _0x33541f=path[_0xe80f('0x7c')](config[_0xe80f('0x83')],_0xe80f('0x89'));var _0xd0c2a0={'where':{'id':_0x1c51c1['params']['id']},'attributes':['id',_0xe80f('0x78'),_0xe80f('0x8a')],'raw':!![]};return db[_0xe80f('0x43')]['find'](_0xd0c2a0)[_0xe80f('0x21')](handleEntityNotFound(_0x29074b,null))['then'](function(_0x276ab0){if(_0x276ab0){if(!_['isNil'](_0x276ab0[_0xe80f('0x78')])){if(fs[_0xe80f('0x82')](path[_0xe80f('0x7c')](config[_0xe80f('0x83')],_0xe80f('0x87'),_0x276ab0[_0xe80f('0x78')]))&&_0x276ab0[_0xe80f('0x8a')]){_0x33541f=path[_0xe80f('0x7c')](config[_0xe80f('0x83')],'server/files/images/avatars/',_0x276ab0[_0xe80f('0x78')]);}}return _0x29074b[_0xe80f('0x85')](_0x33541f);}})[_0xe80f('0x2b')](handleError(_0x29074b,null));};exports[_0xe80f('0x8b')]=function(_0x4ebc98,_0x40d456,_0x1fbf0b){var _0x556fc9=path[_0xe80f('0x7c')](config[_0xe80f('0x83')],_0xe80f('0x8c'));var _0x26d4e3={'where':{'id':_0x4ebc98[_0xe80f('0x5c')]['id']},'attributes':['id',_0xe80f('0x7a')],'raw':!![]};return db['ChatWebsite']['find'](_0x26d4e3)['then'](handleEntityNotFound(_0x40d456,null))[_0xe80f('0x21')](function(_0x284678){if(_0x284678){if(!_[_0xe80f('0x81')](_0x284678['systemAvatar'])){if(fs[_0xe80f('0x82')](path['join'](config[_0xe80f('0x83')],_0xe80f('0x87'),_0x284678[_0xe80f('0x7a')]))){_0x556fc9=path[_0xe80f('0x7c')](config[_0xe80f('0x83')],_0xe80f('0x87'),_0x284678[_0xe80f('0x7a')]);}}return _0x40d456['download'](_0x556fc9);}})[_0xe80f('0x2b')](handleError(_0x40d456,null));};exports[_0xe80f('0x8d')]=function(_0x41d189,_0x3abc99,_0x1a9840){var _0x32b311=require('user-agent-parser');var _0x31258d=new _0x32b311();var _0x3f4718=_0x31258d[_0xe80f('0x8e')](_0x41d189[_0xe80f('0x8f')][_0xe80f('0x90')])[_0xe80f('0x91')]();var _0x5ae5d9={'body':_0x41d189[_0xe80f('0x5e')],'channel':_0xe80f('0x92')};var _0x3dfade=[];var _0x1d4565=[];var _0x372c60={};var _0x430a8d=![];return db[_0xe80f('0x93')][_0xe80f('0x66')]()[_0xe80f('0x21')](function(_0x40f780){if(!_0x40f780){throw new db[(_0xe80f('0x94'))][(_0xe80f('0x1f'))]('no\x20available\x20attributes');}_0x3dfade=_[_0xe80f('0x95')](_[_0xe80f('0x48')](_0x40f780),[_0xe80f('0x96'),_0xe80f('0x97')]);_0x1d4565=_['difference'](_[_0xe80f('0x48')](_0x40f780),[_0xe80f('0x96'),_0xe80f('0x97'),_0xe80f('0x98'),_0xe80f('0x99')]);if(_0x41d189[_0xe80f('0x5e')]['id']){delete _0x41d189['body']['id'];}if(_['isNil'](_0x41d189[_0xe80f('0x5e')]['from'])){throw new db[(_0xe80f('0x94'))]['ValidationError'](_0xe80f('0x9a'));}if(_[_0xe80f('0x81')](_0x41d189[_0xe80f('0x5e')][_0xe80f('0x5e')])||_0x41d189[_0xe80f('0x5e')]['body']===''){throw new db['Sequelize'][(_0xe80f('0x1f'))](_0xe80f('0x9b'));}if(_['isNil'](_0x41d189[_0xe80f('0x5e')]['mapKey'])){throw new db['Sequelize'][(_0xe80f('0x1f'))](_0xe80f('0x9c')+_0x1d4565);}if(!_['includes'](_0x1d4565,_0x41d189[_0xe80f('0x5e')]['mapKey'])){throw new db[(_0xe80f('0x94'))]['ValidationError'](_0xe80f('0x9d')+_0x1d4565);}_0x372c60[_0x41d189[_0xe80f('0x5e')]['mapKey']]=_0x41d189[_0xe80f('0x5e')]['from'];})[_0xe80f('0x21')](function(){return db[_0xe80f('0x43')]['find']({'where':{'id':_0x41d189[_0xe80f('0x5c')]['id']},'include':[{'model':db[_0xe80f('0x9e')],'as':_0xe80f('0x9f'),'include':[{'model':db['CmContact'],'as':_0xe80f('0xa0'),'where':_0x372c60,'limit':0x1,'order':[[_0xe80f('0x97'),'DESC']]}]},{'model':db[_0xe80f('0xa1')],'as':'Applications'}]});})[_0xe80f('0x21')](handleEntityNotFound(_0x3abc99,null))[_0xe80f('0x21')](function(_0x243678){if(_0x243678&&_0x243678[_0xe80f('0x9f')]){_0x5ae5d9[_0xe80f('0xa2')]=_0x243678;_0x5ae5d9[_0xe80f('0xa3')]=_0x243678[_0xe80f('0xa4')];_0x5ae5d9[_0xe80f('0xa5')]=_0x243678[_0xe80f('0x9f')];_0x5ae5d9[_0xe80f('0xa3')]=_['orderBy'](_0x5ae5d9[_0xe80f('0xa3')],[_0xe80f('0xa6')],[_0xe80f('0xa7')]);if(_0x5ae5d9[_0xe80f('0xa2')]['Applications']){delete _0x5ae5d9[_0xe80f('0xa2')][_0xe80f('0xa4')];}if(_0x5ae5d9[_0xe80f('0xa2')][_0xe80f('0x9f')]&&_0x5ae5d9[_0xe80f('0xa2')][_0xe80f('0x9f')]['Contacts'][_0xe80f('0x4e')]){return _0x5ae5d9[_0xe80f('0xa2')][_0xe80f('0x9f')]['Contacts'][0x0];}var _0x7114da=_['defaults'](_0x41d189['body'],{'firstName':_0x41d189[_0xe80f('0x5e')]['from'],'ListId':_0x243678[_0xe80f('0x99')]});_0x7114da[_0x41d189[_0xe80f('0x5e')][_0xe80f('0xa8')]]=_0x41d189[_0xe80f('0x5e')][_0xe80f('0xa9')];return db[_0xe80f('0x93')][_0xe80f('0x5d')](_0x7114da,{'fields':_0x3dfade,'raw':!![]});}})['then'](handleEntityNotFound(_0x3abc99,null))['then'](function(_0x5b5d5e){_0x5ae5d9['contact']=_0x5b5d5e;var _0x4ab3b8=_0x41d189[_0xe80f('0x5e')]['customerIp'];if(_0x41d189[_0xe80f('0x8f')]['cf-connecting-ip']){_0x4ab3b8=_0x41d189[_0xe80f('0x8f')][_0xe80f('0xaa')];}else if(_0x41d189[_0xe80f('0x8f')][_0xe80f('0xab')]){_0x4ab3b8=_['first'](_0x41d189[_0xe80f('0x8f')][_0xe80f('0xab')]['split'](','));}if(_0x5b5d5e){var _0x5796d8={'ContactId':_0x5b5d5e['id'],'ChatWebsiteId':_0x41d189['params']['id'],'from':(_0x5b5d5e[_0xe80f('0xac')]||'')+'\x20'+(_0x5b5d5e[_0xe80f('0xad')]||''),'customerIp':_0x4ab3b8,'customerPort':_0x41d189['headers'][_0xe80f('0xae')]?_0x41d189[_0xe80f('0x8f')][_0xe80f('0xae')]:null,'referer':_0x41d189[_0xe80f('0x5e')]['referer'],'browserName':_0x3f4718[_0xe80f('0xaf')]['name']&&_0x3f4718[_0xe80f('0xaf')][_0xe80f('0xb0')]?util[_0xe80f('0xb1')](_0xe80f('0xb2'),_0x3f4718['browser'][_0xe80f('0x3d')],_0x3f4718[_0xe80f('0xaf')][_0xe80f('0xb0')]):'unknown','browserVersion':_0x3f4718[_0xe80f('0xaf')][_0xe80f('0xb0')]||_0xe80f('0xb3'),'osName':util[_0xe80f('0xb1')](_0xe80f('0xb2'),_0x3f4718['os'][_0xe80f('0x3d')],_0x3f4718['os'][_0xe80f('0xb0')]),'osVersion':_0x3f4718['os'][_0xe80f('0xb0')],'deviceModel':_0x3f4718[_0xe80f('0xb4')][_0xe80f('0x4b')]&&_0x3f4718['device']['vendor']?util[_0xe80f('0xb1')](_0xe80f('0xb5'),_0x3f4718[_0xe80f('0xb4')][_0xe80f('0x4b')],_0x3f4718[_0xe80f('0xb4')][_0xe80f('0xb6')],_0x3f4718[_0xe80f('0xb4')][_0xe80f('0xb7')]):null,'deviceVendor':_0x3f4718[_0xe80f('0xb4')][_0xe80f('0xb6')],'deviceType':_0x3f4718[_0xe80f('0xb4')][_0xe80f('0xb7')],'formData':JSON[_0xe80f('0xb8')](_0x41d189[_0xe80f('0x5e')])};var _0xefee41={'ChatWebsiteId':_0x41d189[_0xe80f('0x5c')]['id'],'closed':![]};if(_0x41d189[_0xe80f('0x5e')][_0xe80f('0xb9')]){_0xefee41[_0xe80f('0xb9')]=_0x41d189[_0xe80f('0x5e')][_0xe80f('0xb9')];return db[_0xe80f('0xba')]['find']({'where':_0xefee41})[_0xe80f('0x21')](function(_0x291cc1){if(_0x291cc1){return[_0x291cc1,![]];}_0x5796d8[_0xe80f('0xb9')]=_0x41d189[_0xe80f('0x5e')][_0xe80f('0xb9')];_0x5796d8['externalUrl']=_0x41d189['body'][_0xe80f('0xbb')];return db[_0xe80f('0xba')]['create'](_0x5796d8)[_0xe80f('0x21')](function(_0x444cb0){return[_0x444cb0,!![]];});});}_0xefee41[_0xe80f('0xbc')]=_0x5b5d5e['id'];if(_0x41d189['body'][_0xe80f('0xbd')]&&_0x41d189['body'][_0xe80f('0xbd')]['id']){_0xefee41['id']=_0x41d189['body'][_0xe80f('0xbd')]['id'];return db[_0xe80f('0xba')]['find']({'where':_0xefee41})['then'](function(_0x280f41){if(_0x280f41){return[_0x280f41,![]];}return db[_0xe80f('0xba')]['create'](_0x5796d8)['then'](function(_0x4265ad){return[_0x4265ad,!![]];});});}return db[_0xe80f('0xba')]['create'](_0x5796d8)[_0xe80f('0x21')](function(_0x204919){return[_0x204919,!![]];});}})['spread'](function(_0x3cfadd,_0x5eb8e3){if(_0x3cfadd){_0x430a8d=_0x5eb8e3;if(!_0x5eb8e3){var _0x42a2de={'from':(_0x5ae5d9[_0xe80f('0xbe')][_0xe80f('0xac')]||'')+'\x20'+(_0x5ae5d9[_0xe80f('0xbe')][_0xe80f('0xad')]||'')};if(_0x41d189[_0xe80f('0x5e')][_0xe80f('0xb9')]&&_0x41d189[_0xe80f('0x5e')]['messageId']&&_0x41d189[_0xe80f('0x5e')][_0xe80f('0xb9')]!=_0x41d189[_0xe80f('0x5e')][_0xe80f('0xbf')]){_0x42a2de[_0xe80f('0xb9')]=_0x41d189[_0xe80f('0x5e')][_0xe80f('0xbf')];}return _0x3cfadd[_0xe80f('0x36')](_0x42a2de);}else{return _0x3cfadd;}}})[_0xe80f('0x21')](function(_0x27d571){_0x5ae5d9[_0xe80f('0xbd')]=_0x27d571[_0xe80f('0x38')]({'plain':!![]});_0x5ae5d9[_0xe80f('0xbd')][_0xe80f('0xc0')]=_0x430a8d;if(_0x5ae5d9[_0xe80f('0xbd')][_0xe80f('0xc0')]){if(_0x5ae5d9[_0xe80f('0xa2')][_0xe80f('0xc1')]){_0x5ae5d9['applications']['push']({'id':0x0,'priority':_0x5ae5d9['applications'][_0xe80f('0x4e')]+0x1,'app':_0xe80f('0xc2'),'appdata':_0xe80f('0xc3'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x41d189[_0xe80f('0x5e')][_0xe80f('0x5e')],'ChatWebsiteId':_0x41d189[_0xe80f('0x5c')]['id'],'ChatInteractionId':_0x27d571['id'],'direction':'in','ContactId':_0x5ae5d9[_0xe80f('0xbe')]['id'],'AttachmentId':_0x41d189[_0xe80f('0x5e')][_0xe80f('0xc4')]});})[_0xe80f('0x21')](function(_0x5c616a){_0x5ae5d9[_0xe80f('0x27')]=_0x5c616a;if(_0x5ae5d9[_0xe80f('0xbd')]['UserId']){return db['User']['find']({'attributes':['id',_0xe80f('0x3d')],'where':{'id':_0x5ae5d9[_0xe80f('0xbd')][_0xe80f('0xc5')]}})[_0xe80f('0x21')](function(_0x250a77){if(_0x250a77){_0x5ae5d9[_0xe80f('0xa3')][_0xe80f('0xc6')]({'id':0x0,'priority':0x0,'app':_0xe80f('0xc7'),'appdata':_0x250a77['name']+','+(_0x5ae5d9['account'][_0xe80f('0xc8')]||0xa),'interval':'*,*,*,*'});_0x5ae5d9[_0xe80f('0xc9')]=!![];}return respondWithRpcPromise(_0xe80f('0xca'),'startRouting',_0x5ae5d9);});}return respondWithRpcPromise(_0xe80f('0xca'),_0xe80f('0xcb'),_0x5ae5d9);})[_0xe80f('0x21')](function(_0x5e4737){respondWithRpcPromise(_0xe80f('0xcc'),_0xe80f('0xcc'),{'event':_0xe80f('0x8d'),'message':_0x5e4737},client9002);return _0x5e4737;})[_0xe80f('0x21')](respondWithResult(_0x3abc99,null))[_0xe80f('0x2b')](handleError(_0x3abc99,null));};exports['offline']=function(_0xac461e,_0x5513c9,_0x581f40){var _0x20c7d9,_0x5cb0c4,_0x10a713;var _0x389c08=[];var _0x4e85e5=[];var _0x2f5efa={};return db['CmContact']['describe']()['then'](function(_0x11cf90){if(!_0x11cf90){throw new db[(_0xe80f('0x94'))][(_0xe80f('0x1f'))](_0xe80f('0xcd'));}_0x4e85e5=_[_0xe80f('0x95')](_[_0xe80f('0x48')](_0x11cf90),[_0xe80f('0x96'),'updatedAt']);_0x389c08=_[_0xe80f('0x95')](_[_0xe80f('0x48')](_0x11cf90),[_0xe80f('0x96'),'updatedAt',_0xe80f('0x98'),_0xe80f('0x99')]);if(_0xac461e[_0xe80f('0x5e')]['id']){delete _0xac461e['body']['id'];}if(_[_0xe80f('0x81')](_0xac461e[_0xe80f('0x5e')][_0xe80f('0xa9')])){throw _0x5513c9[_0xe80f('0x2d')](0x1f4)['send'](new db[(_0xe80f('0x94'))]['ValidationError'](_0xe80f('0x9a')));}if(_[_0xe80f('0x81')](_0xac461e[_0xe80f('0x5e')][_0xe80f('0x5e')])||_0xac461e['body']['body']===''){throw _0x5513c9['status'](0x1f4)[_0xe80f('0x3e')](new db[(_0xe80f('0x94'))][(_0xe80f('0x1f'))](_0xe80f('0x9b')));}if(_[_0xe80f('0x81')](_0xac461e['body'][_0xe80f('0xce')])){throw _0x5513c9[_0xe80f('0x2d')](0x1f4)[_0xe80f('0x3e')](new db[(_0xe80f('0x94'))][(_0xe80f('0x1f'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x389c08));}if(!_[_0xe80f('0xcf')](_0x389c08,_0xac461e[_0xe80f('0x5e')][_0xe80f('0xce')])){throw _0x5513c9['status'](0x1f4)[_0xe80f('0x3e')](new db[(_0xe80f('0x94'))][(_0xe80f('0x1f'))](_0xe80f('0xd0')+_0x389c08));}_0x2f5efa[_0xac461e[_0xe80f('0x5e')][_0xe80f('0xce')]]=_0xac461e[_0xe80f('0x5e')][_0xe80f('0xa9')];})[_0xe80f('0x21')](function(){return db[_0xe80f('0x43')][_0xe80f('0x63')]({'where':{'id':_0xac461e[_0xe80f('0x5c')]['id']},'include':[{'model':db[_0xe80f('0x9e')],'as':_0xe80f('0x9f')}]});})['then'](handleEntityNotFound(_0x5513c9,null))['then'](function(_0x33f5ac){if(_0x33f5ac&&_0x33f5ac[_0xe80f('0x9f')]){_0x5cb0c4=_0x33f5ac;var _0x55e68f=_[_0xe80f('0x16')](_0xac461e[_0xe80f('0x5e')],{'firstName':_0xac461e[_0xe80f('0x5e')][_0xe80f('0xa9')],'phone':_0xac461e[_0xe80f('0x5e')][_0xe80f('0xa9')],'ListId':_0x33f5ac[_0xe80f('0x99')]});_0x55e68f[_0xac461e[_0xe80f('0x5e')][_0xe80f('0xce')]]=_0xac461e[_0xe80f('0x5e')][_0xe80f('0xa9')];return db[_0xe80f('0x93')][_0xe80f('0xd1')]({'where':_0x2f5efa,'defaults':_0x55e68f});}})[_0xe80f('0xd2')](function(_0x2f7cf3){if(_0x2f7cf3){_0x10a713=_0x2f7cf3;var _0x4ec634=fs[_0xe80f('0xd3')](path[_0xe80f('0x7c')](config['root'],_0xe80f('0xd4')),_0xe80f('0xd5'));var _0x5255c6=ejs[_0xe80f('0xd6')](_0x4ec634,{'body':_[_0xe80f('0xd7')](_0xac461e[_0xe80f('0x5e')][_0xe80f('0x5e')]),'bodyTitle':_0x5cb0c4['offlineMessageBody']});return db[_0xe80f('0xd8')]['create']({'body':_0x5255c6,'ContactId':_0x2f7cf3['id'],'ChatWebsiteId':_0x5cb0c4['id']});}})[_0xe80f('0x21')](function(_0x344c8d){if(_0x344c8d){_0x20c7d9=_0x344c8d;return db[_0xe80f('0xd9')][_0xe80f('0x6f')]({'where':{'service':!![]},'include':[{'model':db[_0xe80f('0xda')],'as':'Smtp','raw':!![]}]});}})['then'](function(_0x4d2852){if(_0x4d2852&&_0x4d2852[_0xe80f('0xdb')]&&_0x5cb0c4['forwardOfflineAddress']){var _0x3b6e44={'tls':{'rejectUnauthorized':![]}};if(_0x4d2852[_0xe80f('0xdb')][_0xe80f('0xdc')]){_0x3b6e44[_0xe80f('0xdc')]=_0x4d2852['Smtp'][_0xe80f('0xdc')];}else{_0x3b6e44[_0xe80f('0xdd')]=_0x4d2852['Smtp']['host'];_0x3b6e44[_0xe80f('0xde')]=_0x4d2852['Smtp'][_0xe80f('0xde')];_0x3b6e44['secure']=_0x4d2852['Smtp'][_0xe80f('0xdf')];}if(_0x4d2852[_0xe80f('0xdb')]['authentication']){_0x3b6e44['auth']={'user':_0x4d2852[_0xe80f('0xdb')][_0xe80f('0x5f')],'pass':_0x4d2852[_0xe80f('0xdb')][_0xe80f('0xe0')]};}return respondWithRpcPromise(_0xe80f('0xe1'),_0xe80f('0xe2'),{'account':_0x3b6e44,'message':{'from':util[_0xe80f('0xb1')](_0xe80f('0xe3'),_0x4d2852[_0xe80f('0x3d')],_0x4d2852[_0xe80f('0xe4')]||_0x4d2852[_0xe80f('0xdb')][_0xe80f('0x5f')]),'to':_0x5cb0c4[_0xe80f('0xe5')],'subject':_0x5cb0c4[_0xe80f('0xe6')],'text':_0x20c7d9[_0xe80f('0x5e')]}},client9003)[_0xe80f('0x21')](function(){return _0x20c7d9;})[_0xe80f('0x2b')](function(_0x685077){console[_0xe80f('0x25')](_0x685077);});}})[_0xe80f('0x21')](function(){if(_0x20c7d9){return _0x20c7d9;}})['then'](respondWithResult(_0x5513c9,null))['catch'](handleError(_0x5513c9,null));};exports[_0xe80f('0xe7')]=function(_0x475f80,_0x544130,_0x2e8b90){return db[_0xe80f('0xba')][_0xe80f('0x63')]({'where':{'id':_0x475f80[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x544130,null))[_0xe80f('0x21')](function(_0x48b869){if(_0x48b869){return _0x48b869[_0xe80f('0xe7')](_0x475f80[_0xe80f('0x5e')][_0xe80f('0x6d')],_['omit'](_0x475f80[_0xe80f('0x5e')],['ids','id'])||{});}})[_0xe80f('0x21')](respondWithResult(_0x544130,null))[_0xe80f('0x2b')](handleError(_0x544130,null));};exports['getInteractions']=function(_0x2b8185,_0x5cbbc5,_0x520b10){var _0x27d53d={'raw':![],'where':{}};var _0x39689a={};var _0x5301d9={'count':0x0,'rows':[]};return db[_0xe80f('0x43')][_0xe80f('0x6f')]({'where':{'id':_0x2b8185['params']['id']}})['then'](handleEntityNotFound(_0x5cbbc5,null))[_0xe80f('0x21')](function(_0x582368){if(_0x582368){_0x39689a[_0xe80f('0x4b')]=_['keys'](db[_0xe80f('0xba')][_0xe80f('0x44')]);_0x39689a[_0xe80f('0x47')]=_[_0xe80f('0x48')](_0x2b8185[_0xe80f('0x47')]);_0x39689a[_0xe80f('0x49')]=_[_0xe80f('0x4a')](_0x39689a[_0xe80f('0x4b')],_0x39689a[_0xe80f('0x47')]);_0x27d53d[_0xe80f('0x4d')]=_[_0xe80f('0x4a')](_0x39689a[_0xe80f('0x4b')],qs[_0xe80f('0x4c')](_0x2b8185[_0xe80f('0x47')][_0xe80f('0x4c')]));_0x27d53d[_0xe80f('0x4d')]=_0x27d53d['attributes'][_0xe80f('0x4e')]?_0x27d53d['attributes']:_0x39689a[_0xe80f('0x4b')];if(!_0x2b8185[_0xe80f('0x47')][_0xe80f('0x4f')](_0xe80f('0x6a'))){_0x27d53d[_0xe80f('0x50')]=qs[_0xe80f('0x50')](_0x2b8185[_0xe80f('0x47')]['limit']);_0x27d53d[_0xe80f('0x30')]=qs[_0xe80f('0x30')](_0x2b8185['query']['offset']);}_0x27d53d[_0xe80f('0x71')]=qs['sort'](_0x2b8185[_0xe80f('0x47')]['sort']);_0x27d53d['where']=qs['filters'](_[_0xe80f('0x53')](_0x2b8185[_0xe80f('0x47')],_0x39689a['filters']));_0x27d53d[_0xe80f('0x52')]['ChatWebsiteId']=_0x582368['id'];if(_0x2b8185[_0xe80f('0x47')][_0xe80f('0x54')]){_0x27d53d[_0xe80f('0x52')]=_[_0xe80f('0x55')](_0x27d53d[_0xe80f('0x52')],{'$or':_[_0xe80f('0x42')](_0x27d53d[_0xe80f('0x4d')],function(_0x5265c1){var _0x7f64c={};_0x7f64c[_0x5265c1]={'$like':'%'+_0x2b8185['query'][_0xe80f('0x54')]+'%'};return _0x7f64c;})});}_0x27d53d=_[_0xe80f('0x55')]({},_0x27d53d,_0x2b8185[_0xe80f('0x57')]);return db[_0xe80f('0xba')][_0xe80f('0x2f')]({'where':_0x27d53d[_0xe80f('0x52')]})[_0xe80f('0x21')](function(_0x5956f1){_0x5301d9[_0xe80f('0x2f')]=_0x5956f1;if(_0x2b8185['query'][_0xe80f('0x58')]){_0x27d53d[_0xe80f('0x6b')]=[{'model':db[_0xe80f('0x93')],'as':_0xe80f('0xe8'),'required':![]},{'model':db[_0xe80f('0xe9')],'as':_0xe80f('0xea'),'attributes':[_0xe80f('0x3d'),_0xe80f('0xeb'),'internal'],'required':![]},{'model':db[_0xe80f('0xec')],'as':_0xe80f('0xed'),'attributes':['id','name',_0xe80f('0xee')],'where':_0x2b8185[_0xe80f('0x47')][_0xe80f('0xef')]?{'id':_0x2b8185[_0xe80f('0x47')][_0xe80f('0xef')]}:undefined,'required':_0x2b8185[_0xe80f('0x47')]['tag']?!![]:![]}];}return db[_0xe80f('0xba')][_0xe80f('0x59')](_0x27d53d);})[_0xe80f('0x21')](function(_0x104083){_0x5301d9[_0xe80f('0x5a')]=_0x104083;return _0x5301d9;});}})[_0xe80f('0x21')](respondWithFilteredResult(_0x5cbbc5,_0x27d53d))[_0xe80f('0x2b')](handleError(_0x5cbbc5,null));};function iftimePromise(_0x3968df,_0x443630){return respondWithRpcPromise(_0xe80f('0xf0'),'getSnippet',{'command':_0x443630[_0xe80f('0xf1')]?util['format'](_0xe80f('0xf2'),_0x3968df['interval'],_0x443630[_0xe80f('0xf1')]):util[_0xe80f('0xb1')](_0xe80f('0xf3'),_0x3968df[_0xe80f('0xf4')])},client9002)[_0xe80f('0x21')](function(_0x11df67){var _0x3c6f63=_0x11df67&&_0x11df67[_0xe80f('0xf5')](_0xe80f('0xf6'))>=0x0?!![]:![];logger[_0xe80f('0x28')](_0xe80f('0xf7'),_0x443630['id'],_0x3968df['id'],_0x3968df[_0xe80f('0xf4')],_0x3c6f63?_0xe80f('0xf8'):_0xe80f('0xf9'),_0x443630[_0xe80f('0xf1')]?_0x443630['timezone']:_0xe80f('0xfa'));return _0x3c6f63;})['catch'](function(_0x5213e3){logger[_0xe80f('0x25')](_0xe80f('0xf7'),_0x443630['id'],_0x3968df['id'],_0x3968df[_0xe80f('0xf4')],util[_0xe80f('0xfb')](_0x5213e3,{'showHidden':![],'depth':null}),_0x443630[_0xe80f('0xf1')]?_0x443630[_0xe80f('0xf1')]:_0xe80f('0xfa'));return![];});}exports[_0xe80f('0xfc')]=function(_0x40fcc9,_0x11ffef,_0x33c21f){var _0x5a0876=0x0;var _0x869742=0x0;var _0x4f9760=![];var _0x2072af;var _0x43bb19;return db[_0xe80f('0x43')]['find']({'where':{'id':_0x40fcc9['params']['id']},'include':[{'model':db['Interval'],'as':_0xe80f('0xfd'),'include':[{'model':db[_0xe80f('0xfd')],'as':'Intervals','attributes':['id',_0xe80f('0xf4')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x11ffef,null))[_0xe80f('0x21')](function(_0x4b2095){if(_0x4b2095){_0x2072af=_0x4b2095;return _0x4b2095[_0xe80f('0xfe')]({'raw':!![]});}})['then'](function(_0x464fac){if(_0x2072af){if(_0x464fac){_0x43bb19=_0x464fac;}}return require(_0xe80f('0x7e'))[_0xe80f('0x7f')]();})['then'](function(_0x4df094){if(_0x4df094){_0x869742=_0x4df094[_0xe80f('0xff')];_0x4f9760=_0x4df094['custom'];}})[_0xe80f('0x21')](function(){return db[_0xe80f('0xba')]['count']({'where':{'closed':![]}});})[_0xe80f('0x21')](function(_0x30ccb2){_0x5a0876=_0x30ccb2;if(_0x869742&&_0x30ccb2>_0x869742){return db['License'][_0xe80f('0x6f')]({'where':{'id':0x1}})['then'](function(_0x46328d){if(_0x46328d){_0x46328d['increment'](_0xe80f('0x100'));}});}})[_0xe80f('0x21')](function(){if(_0x2072af[_0xe80f('0xfd')]&&_0x2072af[_0xe80f('0xfd')][_0xe80f('0x101')]){var _0x3dfd63=[];for(var _0x1b2130=0x0;_0x1b2130<_0x2072af[_0xe80f('0xfd')][_0xe80f('0x101')][_0xe80f('0x4e')];_0x1b2130++){var _0x3d9243=_0x2072af['Interval'][_0xe80f('0x101')][_0x1b2130][_0xe80f('0x38')]({'plain':!![]});_0x3dfd63[_0xe80f('0x102')](iftimePromise(_0x3d9243,_0x2072af));}return BPromise['all'](_0x3dfd63)[_0xe80f('0x21')](function(_0x34b8d2){return _[_0xe80f('0x103')](_0x34b8d2);});}else{return!![];}})['then'](function(_0x857f6b){var _0x557946=fs[_0xe80f('0xd3')](path[_0xe80f('0x7c')](config[_0xe80f('0x83')],_0xe80f('0x104')),_0xe80f('0xd5'));var _0x24db30={'remote':_0x2072af[_0xe80f('0x105')],'query':querystring[_0xe80f('0xb8')](_['merge'](_0x2072af[_0xe80f('0x38')]({'plain':!![]}),{'customerIp':_0x40fcc9[_0xe80f('0x8f')][_0xe80f('0xab')]||_0x40fcc9['headers'][_0xe80f('0x106')]||_0x40fcc9['connection'][_0xe80f('0x107')]||_0x40fcc9['ip'],'referer':_0x40fcc9[_0xe80f('0x8f')]['referer'],'openedInteractions':_0x5a0876,'maxInteractions':_0x869742,'virtual':_0x4f9760[_0xe80f('0xff')],'online':_0x857f6b,'custom':_0x4f9760}))[_0xe80f('0x108')](/'/g,'\x5c\x27')};_0x11ffef['send'](ejs['render'](Mustache[_0xe80f('0xd6')](_0x557946,_0x24db30),{'proactiveActions':_0x43bb19,'alignment':_0x2072af['alignment'],'verticalAlignment':_0x2072af[_0xe80f('0x109')],'div_color':_0x2072af[_0xe80f('0xee')],'text_color':_0x2072af[_0xe80f('0x10a')]}));})[_0xe80f('0x2b')](handleError(_0x11ffef,null));};exports[_0xe80f('0x10b')]=function(_0x40215b,_0x4e0cd0,_0x554cd1){return db[_0xe80f('0x43')]['findOne']({'where':{'id':_0x40215b[_0xe80f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4e0cd0,null))[_0xe80f('0x21')](function(_0x3a1199){if(_0x3a1199){return db[_0xe80f('0x10c')][_0xe80f('0x10d')](function(_0x85a49f){return db[_0xe80f('0xa1')][_0xe80f('0x37')]({'where':{'ChatWebsiteId':_0x40215b['params']['id']},'transaction':_0x85a49f})[_0xe80f('0x21')](function(_0xa1a9f1){var _0x3c856f=_[_0xe80f('0x42')](_0x40215b['body'],function(_0x6fb493){_0x6fb493[_0xe80f('0x68')]=_0x40215b[_0xe80f('0x5c')]['id'];return _0x6fb493;});return db['ChatApplication'][_0xe80f('0x10e')](_0x3c856f,{'transaction':_0x85a49f});});})[_0xe80f('0x21')](function(){return db[_0xe80f('0xa1')][_0xe80f('0x10f')]({'where':{'ChatWebsiteId':_0x40215b['params']['id']},'order':_0xe80f('0xa6')});});}})[_0xe80f('0x21')](respondWithResult(_0x4e0cd0,null))[_0xe80f('0x2b')](handleError(_0x4e0cd0,null));};exports['getApplications']=function(_0x3bd1b0,_0x4f44d9,_0x439e51){var _0x39bbd4={};var _0x432df4={};var _0x2c21d4;var _0x4017c8;return db[_0xe80f('0x43')][_0xe80f('0x6f')]({'where':{'id':_0x3bd1b0[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x4f44d9,null))[_0xe80f('0x21')](function(_0x2fac84){if(_0x2fac84){_0x2c21d4=_0x2fac84;_0x432df4[_0xe80f('0x4b')]=_[_0xe80f('0x48')](db['ChatApplication'][_0xe80f('0x44')]);_0x432df4[_0xe80f('0x47')]=_[_0xe80f('0x48')](_0x3bd1b0[_0xe80f('0x47')]);_0x432df4[_0xe80f('0x49')]=_[_0xe80f('0x4a')](_0x432df4[_0xe80f('0x4b')],_0x432df4[_0xe80f('0x47')]);_0x39bbd4['attributes']=_[_0xe80f('0x4a')](_0x432df4[_0xe80f('0x4b')],qs[_0xe80f('0x4c')](_0x3bd1b0[_0xe80f('0x47')][_0xe80f('0x4c')]));_0x39bbd4[_0xe80f('0x4d')]=_0x39bbd4[_0xe80f('0x4d')][_0xe80f('0x4e')]?_0x39bbd4[_0xe80f('0x4d')]:_0x432df4[_0xe80f('0x4b')];_0x39bbd4[_0xe80f('0x71')]=qs[_0xe80f('0x51')](_0x3bd1b0['query'][_0xe80f('0x51')]);_0x39bbd4[_0xe80f('0x52')]=qs[_0xe80f('0x49')](_['pick'](_0x3bd1b0[_0xe80f('0x47')],_0x432df4[_0xe80f('0x49')]));if(_0x3bd1b0[_0xe80f('0x47')][_0xe80f('0x54')]){_0x39bbd4['where']=_[_0xe80f('0x55')](_0x39bbd4[_0xe80f('0x52')],{'$or':_[_0xe80f('0x42')](_0x39bbd4[_0xe80f('0x4d')],function(_0xb2d8e1){var _0x51262f={};_0x51262f[_0xb2d8e1]={'$like':'%'+_0x3bd1b0[_0xe80f('0x47')][_0xe80f('0x54')]+'%'};return _0x51262f;})});}_0x39bbd4=_['merge']({},_0x39bbd4,_0x3bd1b0[_0xe80f('0x57')]);return _0x2c21d4[_0xe80f('0x110')](_0x39bbd4);}})[_0xe80f('0x21')](function(_0x44570b){if(_0x44570b){_0x4017c8=_0x44570b['length'];if(!_0x3bd1b0[_0xe80f('0x47')][_0xe80f('0x4f')](_0xe80f('0x6a'))){_0x39bbd4[_0xe80f('0x50')]=qs[_0xe80f('0x50')](_0x3bd1b0['query'][_0xe80f('0x50')]);_0x39bbd4[_0xe80f('0x30')]=qs[_0xe80f('0x30')](_0x3bd1b0[_0xe80f('0x47')]['offset']);}return _0x2c21d4[_0xe80f('0x110')](_0x39bbd4);}})[_0xe80f('0x21')](function(_0x1fd92f){if(_0x1fd92f){return _0x1fd92f?{'count':_0x4017c8,'rows':_0x1fd92f}:null;}})[_0xe80f('0x21')](respondWithResult(_0x4f44d9,null))[_0xe80f('0x2b')](handleError(_0x4f44d9,null));};exports['addProactiveActions']=function(_0x1c6c1d,_0x2787fe,_0x3e5535){return db[_0xe80f('0x111')][_0xe80f('0x63')]({'where':{'id':_0x1c6c1d['params']['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x2787fe,null))[_0xe80f('0x21')](function(_0x33a6d5){if(_0x33a6d5){return _0x33a6d5[_0xe80f('0x112')](_0x1c6c1d[_0xe80f('0x5e')]['ids'],_[_0xe80f('0x113')](_0x1c6c1d['body'],[_0xe80f('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x2787fe,null))[_0xe80f('0x2b')](handleError(_0x2787fe,null));};exports[_0xe80f('0xfe')]=function(_0x362485,_0x387de4,_0x53a725){var _0x43bb98={};var _0xeb0f0f={};var _0x3ba44e;var _0x1c21d6;return db['ChatWebsite']['findOne']({'where':{'id':_0x362485[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x387de4,null))[_0xe80f('0x21')](function(_0x44c0d4){if(_0x44c0d4){_0x3ba44e=_0x44c0d4;_0xeb0f0f[_0xe80f('0x4b')]=_['keys'](db['ChatProactiveAction'][_0xe80f('0x44')]);_0xeb0f0f[_0xe80f('0x47')]=_[_0xe80f('0x48')](_0x362485[_0xe80f('0x47')]);_0xeb0f0f['filters']=_[_0xe80f('0x4a')](_0xeb0f0f['model'],_0xeb0f0f[_0xe80f('0x47')]);_0x43bb98[_0xe80f('0x4d')]=_[_0xe80f('0x4a')](_0xeb0f0f[_0xe80f('0x4b')],qs[_0xe80f('0x4c')](_0x362485[_0xe80f('0x47')][_0xe80f('0x4c')]));_0x43bb98[_0xe80f('0x4d')]=_0x43bb98[_0xe80f('0x4d')]['length']?_0x43bb98[_0xe80f('0x4d')]:_0xeb0f0f[_0xe80f('0x4b')];_0x43bb98[_0xe80f('0x71')]=qs[_0xe80f('0x51')](_0x362485[_0xe80f('0x47')][_0xe80f('0x51')]);_0x43bb98[_0xe80f('0x52')]=qs[_0xe80f('0x49')](_['pick'](_0x362485[_0xe80f('0x47')],_0xeb0f0f[_0xe80f('0x49')]));if(_0x362485[_0xe80f('0x47')][_0xe80f('0x54')]){_0x43bb98['where']=_[_0xe80f('0x55')](_0x43bb98[_0xe80f('0x52')],{'$or':_[_0xe80f('0x42')](_0x43bb98['attributes'],function(_0x5b6124){var _0x3cb9bc={};_0x3cb9bc[_0x5b6124]={'$like':'%'+_0x362485[_0xe80f('0x47')][_0xe80f('0x54')]+'%'};return _0x3cb9bc;})});}_0x43bb98=_[_0xe80f('0x55')]({},_0x43bb98,_0x362485['options']);return _0x3ba44e[_0xe80f('0xfe')](_0x43bb98);}})[_0xe80f('0x21')](function(_0x407fc6){if(_0x407fc6){_0x1c21d6=_0x407fc6['length'];if(!_0x362485[_0xe80f('0x47')]['hasOwnProperty'](_0xe80f('0x6a'))){_0x43bb98[_0xe80f('0x50')]=qs[_0xe80f('0x50')](_0x362485[_0xe80f('0x47')][_0xe80f('0x50')]);_0x43bb98[_0xe80f('0x30')]=qs[_0xe80f('0x30')](_0x362485['query']['offset']);}return _0x3ba44e[_0xe80f('0xfe')](_0x43bb98);}})['then'](function(_0x3b271e){if(_0x3b271e){return _0x3b271e?{'count':_0x1c21d6,'rows':_0x3b271e}:null;}})['then'](respondWithResult(_0x387de4,null))[_0xe80f('0x2b')](handleError(_0x387de4,null));};exports['getFields']=function(_0x4f609f,_0x31b63f,_0x56cbbe){var _0x399328=_0x4f609f['query']['online']===_0xe80f('0x114')?'offlineForm':'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0x399328],'where':{'id':_0x4f609f[_0xe80f('0x5c')]['id']}})['then'](handleEntityNotFound(_0x31b63f,null))[_0xe80f('0x21')](function(_0x5ad3dd){if(_0x5ad3dd){var _0x253fb5=_0x5ad3dd[_0x399328];var _0x15970d=_0x253fb5&&_0x253fb5['items']?_0x253fb5[_0xe80f('0x115')]:[];_0x31b63f['send']({'fromKey':_['isNil'](_0x253fb5['fromKey'])?undefined:_0x253fb5[_0xe80f('0x116')],'count':_0x15970d[_0xe80f('0x4e')],'rows':_0x15970d});}})[_0xe80f('0x2b')](handleError(_0x31b63f,null));};exports[_0xe80f('0x117')]=function(_0x5da2dc,_0x2ef11e,_0x47bfa4){var _0x37b82f={'raw':![],'where':{}};var _0x4a6c9e={};var _0x128453={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe80f('0x6f')]({'where':{'id':_0x5da2dc[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x2ef11e,null))[_0xe80f('0x21')](function(_0x5f3b5f){if(_0x5f3b5f){_0x4a6c9e[_0xe80f('0x4b')]=_['keys'](db[_0xe80f('0xd8')]['rawAttributes']);_0x4a6c9e[_0xe80f('0x47')]=_['keys'](_0x5da2dc[_0xe80f('0x47')]);_0x4a6c9e[_0xe80f('0x49')]=_[_0xe80f('0x4a')](_0x4a6c9e[_0xe80f('0x4b')],_0x4a6c9e[_0xe80f('0x47')]);_0x37b82f[_0xe80f('0x4d')]=_['intersection'](_0x4a6c9e['model'],qs[_0xe80f('0x4c')](_0x5da2dc['query'][_0xe80f('0x4c')]));_0x37b82f[_0xe80f('0x4d')]=_0x37b82f['attributes'][_0xe80f('0x4e')]?_0x37b82f[_0xe80f('0x4d')]:_0x4a6c9e['model'];if(!_0x5da2dc[_0xe80f('0x47')][_0xe80f('0x4f')](_0xe80f('0x6a'))){_0x37b82f[_0xe80f('0x50')]=qs['limit'](_0x5da2dc[_0xe80f('0x47')][_0xe80f('0x50')]);_0x37b82f['offset']=qs['offset'](_0x5da2dc[_0xe80f('0x47')]['offset']);}_0x37b82f[_0xe80f('0x71')]=qs['sort'](_0x5da2dc['query'][_0xe80f('0x51')]);_0x37b82f[_0xe80f('0x52')]=qs[_0xe80f('0x49')](_[_0xe80f('0x53')](_0x5da2dc[_0xe80f('0x47')],_0x4a6c9e[_0xe80f('0x49')]));_0x37b82f[_0xe80f('0x52')][_0xe80f('0x68')]=_0x5f3b5f['id'];if(_0x5da2dc[_0xe80f('0x47')]['filter']){_0x37b82f[_0xe80f('0x52')]=_[_0xe80f('0x55')](_0x37b82f[_0xe80f('0x52')],{'$or':_['map'](_0x37b82f[_0xe80f('0x4d')],function(_0x3b8c07){var _0x5782ab={};_0x5782ab[_0x3b8c07]={'$like':'%'+_0x5da2dc[_0xe80f('0x47')][_0xe80f('0x54')]+'%'};return _0x5782ab;})});}_0x37b82f=_[_0xe80f('0x55')]({},_0x37b82f,_0x5da2dc[_0xe80f('0x57')]);return db[_0xe80f('0xd8')][_0xe80f('0x2f')]({'where':_0x37b82f[_0xe80f('0x52')]})['then'](function(_0x11964c){_0x128453['count']=_0x11964c;if(_0x5da2dc['query'][_0xe80f('0x58')]){_0x37b82f[_0xe80f('0x6b')]=[{'all':!![]}];}else{_0x37b82f[_0xe80f('0x6b')]=[{'model':db[_0xe80f('0x93')],'as':_0xe80f('0xe8'),'required':![]}];}return db[_0xe80f('0xd8')]['findAll'](_0x37b82f);})[_0xe80f('0x21')](function(_0x1d1198){_0x128453[_0xe80f('0x5a')]=_0x1d1198;return _0x128453;});}})[_0xe80f('0x21')](respondWithFilteredResult(_0x2ef11e,_0x37b82f))[_0xe80f('0x2b')](handleError(_0x2ef11e,null));};exports[_0xe80f('0x118')]=function(_0x3f5b4c,_0x117084,_0x4269e4){return db['ChatWebsite']['find']({'where':{'id':_0x3f5b4c[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x117084,null))[_0xe80f('0x21')](function(_0x373b84){if(_0x373b84){return _0x373b84[_0xe80f('0x118')](_0x3f5b4c[_0xe80f('0x5e')]['ids'],_[_0xe80f('0x113')](_0x3f5b4c[_0xe80f('0x5e')],[_0xe80f('0x6d'),'id'])||{})['spread'](function(_0x2f2725){for(var _0x6694ec=0x0;_0x6694ec<_0x3f5b4c[_0xe80f('0x5e')][_0xe80f('0x6d')]['length'];_0x6694ec+=0x1){socket[_0xe80f('0x119')](_0xe80f('0x11a'),{'UserId':_0x3f5b4c[_0xe80f('0x5e')][_0xe80f('0x6d')][_0x6694ec],'ChatWebsiteId':_0x3f5b4c[_0xe80f('0x5c')]['id']});}return _0x2f2725;});}})[_0xe80f('0x21')](respondWithResult(_0x117084,null))[_0xe80f('0x2b')](handleError(_0x117084,null));};exports[_0xe80f('0x11b')]=function(_0x3e500f,_0x599774,_0x2335cf){return db[_0xe80f('0x43')][_0xe80f('0x63')]({'where':{'id':_0x3e500f[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x599774,null))[_0xe80f('0x21')](function(_0x92119e){if(_0x92119e){return _0x92119e[_0xe80f('0x11b')](_0x3e500f[_0xe80f('0x47')]['ids'])[_0xe80f('0x21')](function(){if(_[_0xe80f('0x11c')](_0x3e500f[_0xe80f('0x47')][_0xe80f('0x6d')])){for(var _0x4a1c27=0x0;_0x4a1c27<_0x3e500f[_0xe80f('0x47')][_0xe80f('0x6d')][_0xe80f('0x4e')];_0x4a1c27+=0x1){socket[_0xe80f('0x119')](_0xe80f('0x11d'),{'UserId':Number(_0x3e500f[_0xe80f('0x47')]['ids'][_0x4a1c27]),'ChatWebsiteId':Number(_0x3e500f['params']['id'])});}}else{socket[_0xe80f('0x119')](_0xe80f('0x11d'),{'UserId':Number(_0x3e500f[_0xe80f('0x47')][_0xe80f('0x6d')]),'ChatWebsiteId':Number(_0x3e500f[_0xe80f('0x5c')]['id'])});}});}})[_0xe80f('0x21')](respondWithStatusCode(_0x599774,null))[_0xe80f('0x2b')](handleError(_0x599774,null));};exports[_0xe80f('0x11e')]=function(_0x157fab,_0x277573,_0x38d5ce){var _0x231d06={};var _0x4daf0e={};var _0x46f2bd;var _0xe66700;return db[_0xe80f('0x43')][_0xe80f('0x6f')]({'where':{'id':_0x157fab[_0xe80f('0x5c')]['id']}})[_0xe80f('0x21')](handleEntityNotFound(_0x277573,null))[_0xe80f('0x21')](function(_0x4dac46){if(_0x4dac46){_0x46f2bd=_0x4dac46;_0x4daf0e[_0xe80f('0x4b')]=_[_0xe80f('0x48')](db[_0xe80f('0xe9')][_0xe80f('0x44')]);_0x4daf0e[_0xe80f('0x47')]=_[_0xe80f('0x48')](_0x157fab['query']);_0x4daf0e[_0xe80f('0x49')]=_[_0xe80f('0x4a')](_0x4daf0e[_0xe80f('0x4b')],_0x4daf0e[_0xe80f('0x47')]);_0x231d06['attributes']=_[_0xe80f('0x4a')](_0x4daf0e[_0xe80f('0x4b')],qs[_0xe80f('0x4c')](_0x157fab[_0xe80f('0x47')][_0xe80f('0x4c')]));_0x231d06[_0xe80f('0x4d')]=_0x231d06[_0xe80f('0x4d')]['length']?_0x231d06[_0xe80f('0x4d')]:_0x4daf0e[_0xe80f('0x4b')];_0x231d06[_0xe80f('0x71')]=qs['sort'](_0x157fab[_0xe80f('0x47')][_0xe80f('0x51')]);_0x231d06[_0xe80f('0x52')]=qs[_0xe80f('0x49')](_[_0xe80f('0x53')](_0x157fab[_0xe80f('0x47')],_0x4daf0e['filters']));if(_0x157fab[_0xe80f('0x47')][_0xe80f('0x54')]){_0x231d06['where']=_[_0xe80f('0x55')](_0x231d06[_0xe80f('0x52')],{'$or':_['map'](_0x231d06[_0xe80f('0x4d')],function(_0x51364b){var _0x7ecfb1={};_0x7ecfb1[_0x51364b]={'$like':'%'+_0x157fab[_0xe80f('0x47')][_0xe80f('0x54')]+'%'};return _0x7ecfb1;})});}_0x231d06=_['merge']({},_0x231d06,_0x157fab[_0xe80f('0x57')]);return _0x46f2bd[_0xe80f('0x11e')](_0x231d06);}})[_0xe80f('0x21')](function(_0x4edd77){if(_0x4edd77){_0xe66700=_0x4edd77[_0xe80f('0x4e')];if(!_0x157fab['query'][_0xe80f('0x4f')](_0xe80f('0x6a'))){_0x231d06[_0xe80f('0x50')]=qs[_0xe80f('0x50')](_0x157fab['query']['limit']);_0x231d06[_0xe80f('0x30')]=qs['offset'](_0x157fab['query'][_0xe80f('0x30')]);}return _0x46f2bd['getAgents'](_0x231d06);}})['then'](function(_0x134ffe){if(_0x134ffe){return _0x134ffe?{'count':_0xe66700,'rows':_0x134ffe}:null;}})[_0xe80f('0x21')](respondWithResult(_0x277573,null))[_0xe80f('0x2b')](handleError(_0x277573,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 551f7ba..8a7bebe 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 _0x8d37=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x85968f,_0x51e753){var _0x1dc114=function(_0x3987ed){while(--_0x3987ed){_0x85968f['push'](_0x85968f['shift']());}};_0x1dc114(++_0x51e753);}(_0x8d37,0xbc));var _0x78d3=function(_0x4428b2,_0x124514){_0x4428b2=_0x4428b2-0x0;var _0x16e15c=_0x8d37[_0x4428b2];return _0x16e15c;};'use strict';var EventEmitter=require(_0x78d3('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x78d3('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x78d3('0x2')](0x0);var events={'afterCreate':_0x78d3('0x3'),'afterUpdate':_0x78d3('0x4'),'afterDestroy':_0x78d3('0x5')};function emitEvent(_0x3a623a){return function(_0x17130e,_0x524ca0,_0x14c49a){ChatWebsiteEvents[_0x78d3('0x6')](_0x3a623a+':'+_0x17130e['id'],_0x17130e);ChatWebsiteEvents['emit'](_0x3a623a,_0x17130e);_0x14c49a(null);};}for(var e in events){if(events[_0x78d3('0x7')](e)){var event=events[e];ChatWebsite[_0x78d3('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x97ed=['update','emit','hasOwnProperty','exports','events','../../mysqldb','save'];(function(_0x5e31e2,_0x273090){var _0x294e2c=function(_0x20ab82){while(--_0x20ab82){_0x5e31e2['push'](_0x5e31e2['shift']());}};_0x294e2c(++_0x273090);}(_0x97ed,0x1e7));var _0xd97e=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x97ed[_0x50a0c2];return _0x5ebadd;};'use strict';var EventEmitter=require(_0xd97e('0x0'));var ChatWebsite=require(_0xd97e('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd97e('0x2'),'afterUpdate':_0xd97e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x457b81){return function(_0x27b80c,_0x3d09f8,_0x474f15){ChatWebsiteEvents['emit'](_0x457b81+':'+_0x27b80c['id'],_0x27b80c);ChatWebsiteEvents[_0xd97e('0x4')](_0x457b81,_0x27b80c);_0x474f15(null);};}for(var e in events){if(events[_0xd97e('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xd97e('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index cd40dcd..975a59b 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 _0x57f8=['ChatWebsite','chat_websites','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x57f8,0x198));var _0x857f=function(_0x366e75,_0x533d1d){_0x366e75=_0x366e75-0x0;var _0x3b167b=_0x57f8[_0x366e75];return _0x3b167b;};'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'));module[_0x857f('0xa')]=function(_0x369c40,_0x5d22e4){return _0x369c40[_0x857f('0xb')](_0x857f('0xc'),attributes,{'tableName':_0x857f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bca=['ChatWebsite','chat_websites','util','moment','request-promise','path','rimraf','./chatWebsite.attributes','exports'];(function(_0x1b0a00,_0xb772fd){var _0x24ba40=function(_0x47301a){while(--_0x47301a){_0x1b0a00['push'](_0x1b0a00['shift']());}};_0x24ba40(++_0xb772fd);}(_0x1bca,0xb6));var _0xa1bc=function(_0x159045,_0x1f7d77){_0x159045=_0x159045-0x0;var _0x423010=_0x1bca[_0x159045];return _0x423010;};'use strict';var _=require('lodash');var util=require(_0xa1bc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa1bc('0x1'));var BPromise=require('bluebird');var rp=require(_0xa1bc('0x2'));var fs=require('fs');var path=require(_0xa1bc('0x3'));var rimraf=require(_0xa1bc('0x4'));var config=require('../../config/environment');var attributes=require(_0xa1bc('0x5'));module[_0xa1bc('0x6')]=function(_0x168b44,_0x268ced){return _0x168b44['define'](_0xa1bc('0x7'),attributes,{'tableName':_0xa1bc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index fc6a18e..9a969ad 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 _0xadb5=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xadb5,0xad));var _0x5adb=function(_0x41aa30,_0x51ef56){_0x41aa30=_0x41aa30-0x0;var _0x8ce8c1=_0xadb5[_0x41aa30];return _0x8ce8c1;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});} \ No newline at end of file +var _0x7880=['defaults','localhost','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7880,0x1f4));var _0x0788=function(_0x58d3c5,_0x5865c6){_0x58d3c5=_0x58d3c5-0x0;var _0x4722f8=_0x7880[_0x58d3c5];return _0x4722f8;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});config[_0x0788('0xc')]=_[_0x0788('0xd')](config[_0x0788('0xc')],{'host':_0x0788('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0788('0xc')]));require('./chatWebsite.socket')[_0x0788('0xf')](socket);function respondWithRpcPromise(_0x53b2f2,_0x433c26,_0x3c6d18){return new BPromise(function(_0x1f9ff6,_0xee8670){return client[_0x0788('0x10')](_0x53b2f2,_0x3c6d18)['then'](function(_0x1920b3){logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,_0x0788('0x13'));logger[_0x0788('0x14')](_0x0788('0x15'),_0x433c26,_0x0788('0x13'),JSON['stringify'](_0x1920b3));if(_0x1920b3[_0x0788('0x16')]){if(_0x1920b3[_0x0788('0x16')][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x433c26,_0x1920b3[_0x0788('0x16')]['message']);return _0xee8670(_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);}logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x1920b3[_0x0788('0x16')][_0x0788('0x18')]);return _0x1f9ff6(_0x1920b3['error']['message']);}else{logger[_0x0788('0x11')](_0x0788('0x12'),_0x433c26,'request\x20sent');_0x1f9ff6(_0x1920b3[_0x0788('0x19')][_0x0788('0x18')]);}})[_0x0788('0x1a')](function(_0x52c339){logger[_0x0788('0x16')](_0x0788('0x12'),_0x433c26,_0x52c339);_0xee8670(_0x52c339);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index cf0636b..74cee46 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x231473,_0x33b93e){var _0x16d666=function(_0x35ed3a){while(--_0x35ed3a){_0x231473['push'](_0x231473['shift']());}};_0x16d666(++_0x33b93e);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc1e968,_0x4a8fc5){_0xc1e968=_0xc1e968-0x0;var _0x29de11=_0x5f2f[_0xc1e968];return _0x29de11;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x215954,_0x59b51e){var _0x2f8a10=function(_0x5f0033){while(--_0x5f0033){_0x215954['push'](_0x215954['shift']());}};_0x2f8a10(++_0x59b51e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x478232,_0x545ee2){_0x478232=_0x478232-0x0;var _0x4f8f84=_0x5f2f[_0x478232];return _0x4f8f84;};'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 911c8b0..4b18f7a 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 _0xe623=['/:id/offline','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','put','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','/:id/dispositions','addAnswer','diskStorage','join','format','%s-%s','originalname','single','file','root','server/files/images/avatars/','addAvatar','now','addCustomerAvatar','/:id/notify','notify'];(function(_0x21c48,_0x49ac0a){var _0x1f2cea=function(_0x51a5eb){while(--_0x51a5eb){_0x21c48['push'](_0x21c48['shift']());}};_0x1f2cea(++_0x49ac0a);}(_0xe623,0x8c));var _0x3e62=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe623[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0x3e62('0x0'));var util=require(_0x3e62('0x1'));var path=require('path');var timeout=require(_0x3e62('0x2'));var express=require(_0x3e62('0x3'));var router=express[_0x3e62('0x4')]();var auth=require(_0x3e62('0x5'));var interaction=require(_0x3e62('0x6'));var config=require('../../config/environment');var controller=require(_0x3e62('0x7'));router[_0x3e62('0x8')]('/',auth[_0x3e62('0x9')](),controller[_0x3e62('0xa')]);router[_0x3e62('0x8')](_0x3e62('0xb'),auth[_0x3e62('0x9')](),controller[_0x3e62('0xc')]);router[_0x3e62('0x8')](_0x3e62('0xd'),auth[_0x3e62('0x9')](),controller[_0x3e62('0xe')]);router['get']('/:id/dispositions',auth[_0x3e62('0x9')](),controller[_0x3e62('0xf')]);router[_0x3e62('0x8')](_0x3e62('0x10'),auth[_0x3e62('0x9')](),controller[_0x3e62('0x11')]);router[_0x3e62('0x8')](_0x3e62('0x12'),controller[_0x3e62('0x13')]);router[_0x3e62('0x8')](_0x3e62('0x14'),controller[_0x3e62('0x15')]);router[_0x3e62('0x8')](_0x3e62('0x16'),controller[_0x3e62('0x17')]);router[_0x3e62('0x8')]('/:id/system_avatar',controller[_0x3e62('0x18')]);router[_0x3e62('0x8')]('/:id/interactions',auth[_0x3e62('0x9')](),controller[_0x3e62('0x19')]);router['get'](_0x3e62('0x1a'),controller[_0x3e62('0x1b')]);router[_0x3e62('0x8')](_0x3e62('0x1c'),auth[_0x3e62('0x9')](),controller['getApplications']);router[_0x3e62('0x8')]('/:id/proactive_actions',auth[_0x3e62('0x9')](),controller[_0x3e62('0x1d')]);router[_0x3e62('0x8')](_0x3e62('0x1e'),controller[_0x3e62('0x1f')]);router['get'](_0x3e62('0x20'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x3e62('0x8')](_0x3e62('0x21'),auth['isAuthenticated'](),controller[_0x3e62('0x22')]);router[_0x3e62('0x23')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3e62('0x23')](_0x3e62('0x24'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x3e62('0x23')](_0x3e62('0x10'),auth['isAuthenticated'](),controller[_0x3e62('0x25')]);var upload=multer({'storage':multer[_0x3e62('0x26')]({'destination':function(_0x14d977,_0x4cad98,_0x21b65b){_0x21b65b(null,path[_0x3e62('0x27')](config['root'],'server/files/images/logos/'));},'filename':function(_0xb370ac,_0xd2e8f6,_0x5addf3){_0x5addf3(null,util[_0x3e62('0x28')](_0x3e62('0x29'),Date['now'](),_0xd2e8f6[_0x3e62('0x2a')]));}})});router[_0x3e62('0x23')](_0x3e62('0x12'),upload[_0x3e62('0x2b')](_0x3e62('0x2c')),controller['addLogo']);var upload=multer({'storage':multer[_0x3e62('0x26')]({'destination':function(_0x1f2f39,_0x422e5d,_0x471f33){_0x471f33(null,path['join'](config[_0x3e62('0x2d')],_0x3e62('0x2e')));},'filename':function(_0x5e82e0,_0x5d5120,_0x3bc989){_0x3bc989(null,util[_0x3e62('0x28')](_0x3e62('0x29'),Date['now'](),_0x5d5120[_0x3e62('0x2a')]));}})});router[_0x3e62('0x23')](_0x3e62('0x14'),upload['single'](_0x3e62('0x2c')),controller[_0x3e62('0x2f')]);var upload=multer({'storage':multer[_0x3e62('0x26')]({'destination':function(_0x54cda7,_0x3bdfb5,_0x32bfac){_0x32bfac(null,path[_0x3e62('0x27')](config[_0x3e62('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x1264ee,_0x23aed1,_0x2573dd){_0x2573dd(null,util[_0x3e62('0x28')](_0x3e62('0x29'),Date[_0x3e62('0x30')](),_0x23aed1['originalname']));}})});router[_0x3e62('0x23')](_0x3e62('0x16'),upload[_0x3e62('0x2b')]('file'),controller[_0x3e62('0x31')]);var upload=multer({'storage':multer[_0x3e62('0x26')]({'destination':function(_0x4d8d52,_0x59cd4d,_0x3e5cc2){_0x3e5cc2(null,path[_0x3e62('0x27')](config['root'],_0x3e62('0x2e')));},'filename':function(_0x3d857a,_0x3bd8a2,_0x54ef2a){_0x54ef2a(null,util[_0x3e62('0x28')](_0x3e62('0x29'),Date[_0x3e62('0x30')](),_0x3bd8a2['originalname']));}})});router['post']('/:id/system_avatar',upload['single'](_0x3e62('0x2c')),controller['addSystemAvatar']);router[_0x3e62('0x23')](_0x3e62('0x32'),controller[_0x3e62('0x33')]);router[_0x3e62('0x23')](_0x3e62('0x34'),controller[_0x3e62('0x35')]);router[_0x3e62('0x23')](_0x3e62('0x36'),auth[_0x3e62('0x9')](),controller['addInteraction']);router[_0x3e62('0x23')](_0x3e62('0x1c'),auth['isAuthenticated'](),controller[_0x3e62('0x37')]);router['post']('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x3e62('0x38')]);router['post'](_0x3e62('0x21'),auth[_0x3e62('0x9')](),controller[_0x3e62('0x39')]);router[_0x3e62('0x3a')]('/:id',auth[_0x3e62('0x9')](),controller['update']);router['delete'](_0x3e62('0xd'),auth['isAuthenticated'](),controller[_0x3e62('0x3b')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3e62('0x3c')]);router['delete'](_0x3e62('0x10'),auth[_0x3e62('0x9')](),controller[_0x3e62('0x3d')]);router['delete']('/:id/users',auth[_0x3e62('0x9')](),controller[_0x3e62('0x3e')]);module[_0x3e62('0x3f')]=router; \ No newline at end of file +var _0x681d=['file','addLogo','originalname','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/canned_answers','addAnswer','diskStorage','join','root','format','%s-%s','now','/:id/logo','single'];(function(_0x44be9a,_0x5ce1a6){var _0x3dbb78=function(_0x19fdd0){while(--_0x19fdd0){_0x44be9a['push'](_0x44be9a['shift']());}};_0x3dbb78(++_0x5ce1a6);}(_0x681d,0x11c));var _0xd681=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x681d[_0x53abe5];return _0xc1c37e;};'use strict';var multer=require('multer');var util=require(_0xd681('0x0'));var path=require(_0xd681('0x1'));var timeout=require(_0xd681('0x2'));var express=require(_0xd681('0x3'));var router=express[_0xd681('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd681('0x5'));var controller=require(_0xd681('0x6'));router[_0xd681('0x7')]('/',auth[_0xd681('0x8')](),controller[_0xd681('0x9')]);router[_0xd681('0x7')](_0xd681('0xa'),auth[_0xd681('0x8')](),controller[_0xd681('0xb')]);router[_0xd681('0x7')](_0xd681('0xc'),auth[_0xd681('0x8')](),controller[_0xd681('0xd')]);router[_0xd681('0x7')](_0xd681('0xe'),auth[_0xd681('0x8')](),controller[_0xd681('0xf')]);router[_0xd681('0x7')]('/:id/canned_answers',auth[_0xd681('0x8')](),controller['getAnswers']);router[_0xd681('0x7')]('/:id/logo',controller[_0xd681('0x10')]);router[_0xd681('0x7')](_0xd681('0x11'),controller['getAvatar']);router[_0xd681('0x7')](_0xd681('0x12'),controller['getCustomerAvatar']);router[_0xd681('0x7')](_0xd681('0x13'),controller[_0xd681('0x14')]);router[_0xd681('0x7')](_0xd681('0x15'),auth[_0xd681('0x8')](),controller[_0xd681('0x16')]);router[_0xd681('0x7')](_0xd681('0x17'),controller['getSnippet']);router[_0xd681('0x7')](_0xd681('0x18'),auth[_0xd681('0x8')](),controller[_0xd681('0x19')]);router[_0xd681('0x7')](_0xd681('0x1a'),auth[_0xd681('0x8')](),controller[_0xd681('0x1b')]);router[_0xd681('0x7')](_0xd681('0x1c'),controller[_0xd681('0x1d')]);router[_0xd681('0x7')](_0xd681('0x1e'),auth['isAuthenticated'](),controller[_0xd681('0x1f')]);router[_0xd681('0x7')](_0xd681('0x20'),auth[_0xd681('0x8')](),controller[_0xd681('0x21')]);router[_0xd681('0x22')]('/',auth[_0xd681('0x8')](),controller[_0xd681('0x23')]);router[_0xd681('0x22')](_0xd681('0xe'),auth[_0xd681('0x8')](),controller['addDisposition']);router[_0xd681('0x22')](_0xd681('0x24'),auth[_0xd681('0x8')](),controller[_0xd681('0x25')]);var upload=multer({'storage':multer[_0xd681('0x26')]({'destination':function(_0x423fb3,_0x58c855,_0x302d19){_0x302d19(null,path[_0xd681('0x27')](config[_0xd681('0x28')],'server/files/images/logos/'));},'filename':function(_0x3f0361,_0x1e77b6,_0x572a3b){_0x572a3b(null,util[_0xd681('0x29')](_0xd681('0x2a'),Date[_0xd681('0x2b')](),_0x1e77b6['originalname']));}})});router[_0xd681('0x22')](_0xd681('0x2c'),upload[_0xd681('0x2d')](_0xd681('0x2e')),controller[_0xd681('0x2f')]);var upload=multer({'storage':multer[_0xd681('0x26')]({'destination':function(_0x394b4b,_0x3695dc,_0x23ec2d){_0x23ec2d(null,path[_0xd681('0x27')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x49e5aa,_0x262b37,_0x2d4339){_0x2d4339(null,util[_0xd681('0x29')](_0xd681('0x2a'),Date[_0xd681('0x2b')](),_0x262b37[_0xd681('0x30')]));}})});router[_0xd681('0x22')](_0xd681('0x11'),upload[_0xd681('0x2d')](_0xd681('0x2e')),controller[_0xd681('0x31')]);var upload=multer({'storage':multer[_0xd681('0x26')]({'destination':function(_0x3b06b4,_0x34a745,_0x3dbbb5){_0x3dbbb5(null,path[_0xd681('0x27')](config['root'],_0xd681('0x32')));},'filename':function(_0x353baf,_0xf78ea5,_0x5f1e98){_0x5f1e98(null,util[_0xd681('0x29')](_0xd681('0x2a'),Date[_0xd681('0x2b')](),_0xf78ea5[_0xd681('0x30')]));}})});router[_0xd681('0x22')](_0xd681('0x12'),upload[_0xd681('0x2d')]('file'),controller[_0xd681('0x33')]);var upload=multer({'storage':multer[_0xd681('0x26')]({'destination':function(_0x4a0d70,_0x506f60,_0x58233c){_0x58233c(null,path[_0xd681('0x27')](config['root'],_0xd681('0x32')));},'filename':function(_0x8e3e84,_0x395cf6,_0x1bf2f2){_0x1bf2f2(null,util[_0xd681('0x29')](_0xd681('0x2a'),Date[_0xd681('0x2b')](),_0x395cf6[_0xd681('0x30')]));}})});router[_0xd681('0x22')]('/:id/system_avatar',upload[_0xd681('0x2d')](_0xd681('0x2e')),controller[_0xd681('0x34')]);router[_0xd681('0x22')](_0xd681('0x35'),controller[_0xd681('0x36')]);router[_0xd681('0x22')]('/:id/offline',controller[_0xd681('0x37')]);router['post'](_0xd681('0x15'),auth['isAuthenticated'](),controller[_0xd681('0x38')]);router[_0xd681('0x22')]('/:id/applications',auth[_0xd681('0x8')](),controller[_0xd681('0x39')]);router[_0xd681('0x22')](_0xd681('0x1a'),auth[_0xd681('0x8')](),controller[_0xd681('0x3a')]);router[_0xd681('0x22')]('/:id/users',auth[_0xd681('0x8')](),controller['addAgents']);router[_0xd681('0x3b')](_0xd681('0xc'),auth[_0xd681('0x8')](),controller[_0xd681('0x3c')]);router[_0xd681('0x3d')](_0xd681('0xc'),auth[_0xd681('0x8')](),controller[_0xd681('0x3e')]);router[_0xd681('0x3d')](_0xd681('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xd681('0x3d')](_0xd681('0x24'),auth[_0xd681('0x8')](),controller[_0xd681('0x3f')]);router['delete'](_0xd681('0x20'),auth[_0xd681('0x8')](),controller[_0xd681('0x40')]);module[_0xd681('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 debf666..e51823a 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 _0x8d0a=['sequelize','exports','STRING','AmazonAWS','Google'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x8d0a,0x172));var _0xa8d0=function(_0x2e503b,_0x1f10f9){_0x2e503b=_0x2e503b-0x0;var _0x28eaf9=_0x8d0a[_0x2e503b];return _0x28eaf9;};'use strict';var Sequelize=require(_0xa8d0('0x0'));module[_0xa8d0('0x1')]={'name':{'type':Sequelize[_0xa8d0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xa8d0('0x3'),_0xa8d0('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xa8d0('0x2')]}}; \ No newline at end of file +var _0x1a61=['AmazonAWS','Google','sequelize','STRING'];(function(_0x39dda2,_0x383be4){var _0x10aaaa=function(_0x417d69){while(--_0x417d69){_0x39dda2['push'](_0x39dda2['shift']());}};_0x10aaaa(++_0x383be4);}(_0x1a61,0x1e6));var _0x11a6=function(_0x128128,_0x232b0d){_0x128128=_0x128128-0x0;var _0x4b072d=_0x1a61[_0x128128];return _0x4b072d;};'use strict';var Sequelize=require(_0x11a6('0x0'));module['exports']={'name':{'type':Sequelize[_0x11a6('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x11a6('0x2'),_0x11a6('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x11a6('0x1')]},'data2':{'type':Sequelize[_0x11a6('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 31f3999..60f6a88 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 _0xe168=['save','then','destroy','stack','name','index','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','options','catch','create','update','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xe168,0x1ed));var _0x8e16=function(_0x1f2b45,_0x560ec6){_0x1f2b45=_0x1f2b45-0x0;var _0x5677df=_0xe168[_0x1f2b45];return _0x5677df;};'use strict';var pdf=require(_0x8e16('0x0'));var emlformat=require(_0x8e16('0x1'));var rimraf=require(_0x8e16('0x2'));var zipdir=require(_0x8e16('0x3'));var jsonpatch=require(_0x8e16('0x4'));var rp=require(_0x8e16('0x5'));var moment=require(_0x8e16('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8e16('0x7'));var util=require(_0x8e16('0x8'));var path=require(_0x8e16('0x9'));var sox=require(_0x8e16('0xa'));var csv=require(_0x8e16('0xb'));var ejs=require(_0x8e16('0xc'));var fs=require('fs');var _=require(_0x8e16('0xd'));var squel=require(_0x8e16('0xe'));var crypto=require(_0x8e16('0xf'));var jsforce=require(_0x8e16('0x10'));var deskjs=require(_0x8e16('0x11'));var toCsv=require('to-csv');var querystring=require(_0x8e16('0x12'));var Papa=require(_0x8e16('0x13'));var Redis=require(_0x8e16('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x8e16('0x15'));var as=require(_0x8e16('0x16'));var hardwareService=require(_0x8e16('0x17'));var logger=require(_0x8e16('0x18'))(_0x8e16('0x19'));var utils=require(_0x8e16('0x1a'));var config=require(_0x8e16('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x572dde,_0x47e906){_0x47e906=_0x47e906||0xcc;return function(_0x71d004){if(_0x71d004){return _0x572dde[_0x8e16('0x1c')](_0x47e906);}return _0x572dde['status'](_0x47e906)[_0x8e16('0x1d')]();};}function respondWithResult(_0x552d63,_0x30469f){_0x30469f=_0x30469f||0xc8;return function(_0x5e554f){if(_0x5e554f){return _0x552d63[_0x8e16('0x1e')](_0x30469f)[_0x8e16('0x1f')](_0x5e554f);}};}function respondWithFilteredResult(_0xe064d6,_0x4651d7){return function(_0x52e772){if(_0x52e772){var _0x559fd7=_0x52e772[_0x8e16('0x20')],_0x4d485f=_0x4651d7[_0x8e16('0x21')],_0x4fd00b=_0x4651d7['offset']+_0x4651d7[_0x8e16('0x22')],_0x1021a2;if(_0x4fd00b>=_0x559fd7){_0x4fd00b=_0x559fd7;_0x1021a2=0xc8;}else{_0x1021a2=0xce;}_0xe064d6[_0x8e16('0x1e')](_0x1021a2);return _0xe064d6[_0x8e16('0x23')](_0x8e16('0x24'),_0x4d485f+'-'+_0x4fd00b+'/'+_0x559fd7)[_0x8e16('0x1f')](_0x52e772);}return null;};}function patchUpdates(_0x19433e){return function(_0x35a095){try{jsonpatch[_0x8e16('0x25')](_0x35a095,_0x19433e,!![]);}catch(_0x26e3bf){return BPromise[_0x8e16('0x26')](_0x26e3bf);}return _0x35a095[_0x8e16('0x27')]();};}function saveUpdates(_0x156c66,_0x47ae1f){return function(_0x22c4ba){if(_0x22c4ba){return _0x22c4ba['update'](_0x156c66)[_0x8e16('0x28')](function(_0x5c7f2b){return _0x5c7f2b;});}return null;};}function removeEntity(_0x2b1407,_0x5a7245){return function(_0x11ea60){if(_0x11ea60){return _0x11ea60[_0x8e16('0x29')]()['then'](function(){_0x2b1407[_0x8e16('0x1e')](0xcc)[_0x8e16('0x1d')]();});}};}function handleEntityNotFound(_0x14e343,_0x3c72ae){return function(_0x557948){if(!_0x557948){_0x14e343[_0x8e16('0x1c')](0x194);}return _0x557948;};}function handleError(_0x13abbe,_0x28cdea){_0x28cdea=_0x28cdea||0x1f4;return function(_0xd5d36){logger['error'](_0xd5d36[_0x8e16('0x2a')]);if(_0xd5d36[_0x8e16('0x2b')]){delete _0xd5d36[_0x8e16('0x2b')];}_0x13abbe[_0x8e16('0x1e')](_0x28cdea)['send'](_0xd5d36);};}exports[_0x8e16('0x2c')]=function(_0xfae7ac,_0x2bd536){var _0x5ab027={},_0x1ac632={},_0x55fd12={'count':0x0,'rows':[]};var _0x537733=_['map'](db[_0x8e16('0x2d')][_0x8e16('0x2e')],function(_0x51a998){return{'name':_0x51a998[_0x8e16('0x2f')],'type':_0x51a998[_0x8e16('0x30')][_0x8e16('0x31')]};});_0x1ac632[_0x8e16('0x32')]=_['map'](_0x537733,'name');_0x1ac632[_0x8e16('0x33')]=_[_0x8e16('0x34')](_0xfae7ac[_0x8e16('0x33')]);_0x1ac632[_0x8e16('0x35')]=_['intersection'](_0x1ac632[_0x8e16('0x32')],_0x1ac632[_0x8e16('0x33')]);_0x5ab027[_0x8e16('0x36')]=_[_0x8e16('0x37')](_0x1ac632[_0x8e16('0x32')],qs[_0x8e16('0x38')](_0xfae7ac[_0x8e16('0x33')][_0x8e16('0x38')]));_0x5ab027[_0x8e16('0x36')]=_0x5ab027['attributes'][_0x8e16('0x39')]?_0x5ab027[_0x8e16('0x36')]:_0x1ac632['model'];if(!_0xfae7ac['query'][_0x8e16('0x3a')]('nolimit')){_0x5ab027['limit']=qs[_0x8e16('0x22')](_0xfae7ac[_0x8e16('0x33')]['limit']);_0x5ab027[_0x8e16('0x21')]=qs[_0x8e16('0x21')](_0xfae7ac['query']['offset']);}_0x5ab027[_0x8e16('0x3b')]=qs[_0x8e16('0x3c')](_0xfae7ac[_0x8e16('0x33')]['sort']);_0x5ab027[_0x8e16('0x3d')]=qs[_0x8e16('0x35')](_[_0x8e16('0x3e')](_0xfae7ac[_0x8e16('0x33')],_0x1ac632['filters']),_0x537733);if(_0xfae7ac[_0x8e16('0x33')][_0x8e16('0x3f')]){_0x5ab027[_0x8e16('0x3d')]=_[_0x8e16('0x40')](_0x5ab027['where'],{'$or':_[_0x8e16('0x41')](_0x537733,function(_0x174462){if(_0x174462[_0x8e16('0x30')]!==_0x8e16('0x42')){var _0x5cd0e4={};_0x5cd0e4[_0x174462['name']]={'$like':'%'+_0xfae7ac[_0x8e16('0x33')][_0x8e16('0x3f')]+'%'};return _0x5cd0e4;}})});}_0x5ab027=_[_0x8e16('0x40')]({},_0x5ab027,_0xfae7ac['options']);var _0x31cb83={'where':_0x5ab027[_0x8e16('0x3d')]};return db['CloudProvider'][_0x8e16('0x20')](_0x31cb83)[_0x8e16('0x28')](function(_0x7039a8){_0x55fd12['count']=_0x7039a8;if(_0xfae7ac['query'][_0x8e16('0x43')]){_0x5ab027[_0x8e16('0x44')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x5ab027);})[_0x8e16('0x28')](function(_0x36209b){_0x55fd12['rows']=_0x36209b;return _0x55fd12;})[_0x8e16('0x28')](respondWithFilteredResult(_0x2bd536,_0x5ab027))['catch'](handleError(_0x2bd536,null));};exports['show']=function(_0x41bd47,_0x44a020){var _0x42bb44={'raw':!![],'where':{'id':_0x41bd47['params']['id']}},_0x4d178a={};_0x4d178a[_0x8e16('0x32')]=_[_0x8e16('0x34')](db[_0x8e16('0x2d')]['rawAttributes']);_0x4d178a[_0x8e16('0x33')]=_[_0x8e16('0x34')](_0x41bd47['query']);_0x4d178a[_0x8e16('0x35')]=_[_0x8e16('0x37')](_0x4d178a[_0x8e16('0x32')],_0x4d178a['query']);_0x42bb44[_0x8e16('0x36')]=_['intersection'](_0x4d178a[_0x8e16('0x32')],qs[_0x8e16('0x38')](_0x41bd47[_0x8e16('0x33')][_0x8e16('0x38')]));_0x42bb44[_0x8e16('0x36')]=_0x42bb44['attributes'][_0x8e16('0x39')]?_0x42bb44[_0x8e16('0x36')]:_0x4d178a[_0x8e16('0x32')];if(_0x41bd47[_0x8e16('0x33')]['includeAll']){_0x42bb44['include']=[{'all':!![]}];}_0x42bb44=_[_0x8e16('0x40')]({},_0x42bb44,_0x41bd47[_0x8e16('0x45')]);return db[_0x8e16('0x2d')]['find'](_0x42bb44)[_0x8e16('0x28')](handleEntityNotFound(_0x44a020,null))[_0x8e16('0x28')](respondWithResult(_0x44a020,null))[_0x8e16('0x46')](handleError(_0x44a020,null));};exports[_0x8e16('0x47')]=function(_0xb5c96c,_0x336ab5){return db[_0x8e16('0x2d')][_0x8e16('0x47')](_0xb5c96c['body'],{})[_0x8e16('0x28')](respondWithResult(_0x336ab5,0xc9))[_0x8e16('0x46')](handleError(_0x336ab5,null));};exports[_0x8e16('0x48')]=function(_0x39b1fa,_0x59332a){if(_0x39b1fa['body']['id']){delete _0x39b1fa[_0x8e16('0x49')]['id'];}return db[_0x8e16('0x2d')][_0x8e16('0x4a')]({'where':{'id':_0x39b1fa[_0x8e16('0x4b')]['id']}})[_0x8e16('0x28')](handleEntityNotFound(_0x59332a,null))[_0x8e16('0x28')](saveUpdates(_0x39b1fa[_0x8e16('0x49')],null))[_0x8e16('0x28')](respondWithResult(_0x59332a,null))[_0x8e16('0x46')](handleError(_0x59332a,null));};exports['destroy']=function(_0x2e16b9,_0x560201){return db[_0x8e16('0x2d')][_0x8e16('0x4a')]({'where':{'id':_0x2e16b9[_0x8e16('0x4b')]['id']}})[_0x8e16('0x28')](handleEntityNotFound(_0x560201,null))['then'](removeEntity(_0x560201,null))['catch'](handleError(_0x560201,null));}; \ No newline at end of file +var _0x1772=['fields','length','order','sort','pick','filter','where','VIRTUAL','merge','CloudProvider','includeAll','findAll','catch','show','params','include','options','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1772,0xa2));var _0x2177=function(_0xd6d148,_0x171fa5){_0xd6d148=_0xd6d148-0x0;var _0x80d2fc=_0x1772[_0xd6d148];return _0x80d2fc;};'use strict';var pdf=require(_0x2177('0x0'));var emlformat=require(_0x2177('0x1'));var rimraf=require(_0x2177('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2177('0x3'));var moment=require(_0x2177('0x4'));var BPromise=require(_0x2177('0x5'));var Mustache=require(_0x2177('0x6'));var util=require(_0x2177('0x7'));var path=require(_0x2177('0x8'));var sox=require(_0x2177('0x9'));var csv=require('to-csv');var ejs=require(_0x2177('0xa'));var fs=require('fs');var _=require(_0x2177('0xb'));var squel=require('squel');var crypto=require(_0x2177('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2177('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2177('0xe'));var Redis=require(_0x2177('0xf'));var authService=require(_0x2177('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2177('0x11'));var hardwareService=require(_0x2177('0x12'));var logger=require(_0x2177('0x13'))('api');var utils=require(_0x2177('0x14'));var config=require(_0x2177('0x15'));var db=require(_0x2177('0x16'))['db'];function respondWithStatusCode(_0x1f1f89,_0x23e6f5){_0x23e6f5=_0x23e6f5||0xcc;return function(_0x2b07af){if(_0x2b07af){return _0x1f1f89[_0x2177('0x17')](_0x23e6f5);}return _0x1f1f89['status'](_0x23e6f5)[_0x2177('0x18')]();};}function respondWithResult(_0x3c6948,_0x3756b2){_0x3756b2=_0x3756b2||0xc8;return function(_0x32af5b){if(_0x32af5b){return _0x3c6948[_0x2177('0x19')](_0x3756b2)[_0x2177('0x1a')](_0x32af5b);}};}function respondWithFilteredResult(_0x56c5d3,_0x506e5c){return function(_0x4d869d){if(_0x4d869d){var _0x5a431d=_0x4d869d[_0x2177('0x1b')],_0x2c3bd3=_0x506e5c['offset'],_0x4c65ae=_0x506e5c[_0x2177('0x1c')]+_0x506e5c[_0x2177('0x1d')],_0x483934;if(_0x4c65ae>=_0x5a431d){_0x4c65ae=_0x5a431d;_0x483934=0xc8;}else{_0x483934=0xce;}_0x56c5d3['status'](_0x483934);return _0x56c5d3[_0x2177('0x1e')](_0x2177('0x1f'),_0x2c3bd3+'-'+_0x4c65ae+'/'+_0x5a431d)[_0x2177('0x1a')](_0x4d869d);}return null;};}function patchUpdates(_0x4a32b9){return function(_0x1a1639){try{jsonpatch['apply'](_0x1a1639,_0x4a32b9,!![]);}catch(_0x3240e6){return BPromise[_0x2177('0x20')](_0x3240e6);}return _0x1a1639[_0x2177('0x21')]();};}function saveUpdates(_0xc8a5dd,_0x109a06){return function(_0x40b747){if(_0x40b747){return _0x40b747[_0x2177('0x22')](_0xc8a5dd)[_0x2177('0x23')](function(_0x204dda){return _0x204dda;});}return null;};}function removeEntity(_0x150df8,_0x5752f){return function(_0x41949f){if(_0x41949f){return _0x41949f[_0x2177('0x24')]()['then'](function(){_0x150df8['status'](0xcc)[_0x2177('0x18')]();});}};}function handleEntityNotFound(_0x55e46e,_0x5ccd1a){return function(_0x46662c){if(!_0x46662c){_0x55e46e[_0x2177('0x17')](0x194);}return _0x46662c;};}function handleError(_0x552b6d,_0x4d5a51){_0x4d5a51=_0x4d5a51||0x1f4;return function(_0x32628c){logger[_0x2177('0x25')](_0x32628c['stack']);if(_0x32628c[_0x2177('0x26')]){delete _0x32628c[_0x2177('0x26')];}_0x552b6d[_0x2177('0x19')](_0x4d5a51)[_0x2177('0x27')](_0x32628c);};}exports[_0x2177('0x28')]=function(_0x1d4d34,_0x424e3d){var _0x5be41c={},_0x308e68={},_0x472f38={'count':0x0,'rows':[]};var _0x33a120=_[_0x2177('0x29')](db['CloudProvider'][_0x2177('0x2a')],function(_0x20cfdb){return{'name':_0x20cfdb['fieldName'],'type':_0x20cfdb[_0x2177('0x2b')][_0x2177('0x2c')]};});_0x308e68[_0x2177('0x2d')]=_[_0x2177('0x29')](_0x33a120,'name');_0x308e68['query']=_[_0x2177('0x2e')](_0x1d4d34[_0x2177('0x2f')]);_0x308e68[_0x2177('0x30')]=_[_0x2177('0x31')](_0x308e68[_0x2177('0x2d')],_0x308e68[_0x2177('0x2f')]);_0x5be41c[_0x2177('0x32')]=_[_0x2177('0x31')](_0x308e68['model'],qs[_0x2177('0x33')](_0x1d4d34['query'][_0x2177('0x33')]));_0x5be41c[_0x2177('0x32')]=_0x5be41c[_0x2177('0x32')][_0x2177('0x34')]?_0x5be41c[_0x2177('0x32')]:_0x308e68[_0x2177('0x2d')];if(!_0x1d4d34[_0x2177('0x2f')]['hasOwnProperty']('nolimit')){_0x5be41c[_0x2177('0x1d')]=qs[_0x2177('0x1d')](_0x1d4d34['query'][_0x2177('0x1d')]);_0x5be41c[_0x2177('0x1c')]=qs[_0x2177('0x1c')](_0x1d4d34[_0x2177('0x2f')]['offset']);}_0x5be41c[_0x2177('0x35')]=qs[_0x2177('0x36')](_0x1d4d34[_0x2177('0x2f')]['sort']);_0x5be41c['where']=qs[_0x2177('0x30')](_[_0x2177('0x37')](_0x1d4d34[_0x2177('0x2f')],_0x308e68[_0x2177('0x30')]),_0x33a120);if(_0x1d4d34[_0x2177('0x2f')][_0x2177('0x38')]){_0x5be41c[_0x2177('0x39')]=_['merge'](_0x5be41c[_0x2177('0x39')],{'$or':_[_0x2177('0x29')](_0x33a120,function(_0x578946){if(_0x578946[_0x2177('0x2b')]!==_0x2177('0x3a')){var _0x2582b7={};_0x2582b7[_0x578946['name']]={'$like':'%'+_0x1d4d34['query'][_0x2177('0x38')]+'%'};return _0x2582b7;}})});}_0x5be41c=_[_0x2177('0x3b')]({},_0x5be41c,_0x1d4d34['options']);var _0x10c5d1={'where':_0x5be41c[_0x2177('0x39')]};return db[_0x2177('0x3c')][_0x2177('0x1b')](_0x10c5d1)[_0x2177('0x23')](function(_0x25d2e0){_0x472f38[_0x2177('0x1b')]=_0x25d2e0;if(_0x1d4d34[_0x2177('0x2f')][_0x2177('0x3d')]){_0x5be41c['include']=[{'all':!![]}];}return db[_0x2177('0x3c')][_0x2177('0x3e')](_0x5be41c);})[_0x2177('0x23')](function(_0x3a1431){_0x472f38['rows']=_0x3a1431;return _0x472f38;})['then'](respondWithFilteredResult(_0x424e3d,_0x5be41c))[_0x2177('0x3f')](handleError(_0x424e3d,null));};exports[_0x2177('0x40')]=function(_0x1c40ce,_0x3dd7ed){var _0x35c2b2={'raw':!![],'where':{'id':_0x1c40ce[_0x2177('0x41')]['id']}},_0x4dde37={};_0x4dde37['model']=_[_0x2177('0x2e')](db[_0x2177('0x3c')]['rawAttributes']);_0x4dde37[_0x2177('0x2f')]=_[_0x2177('0x2e')](_0x1c40ce[_0x2177('0x2f')]);_0x4dde37[_0x2177('0x30')]=_[_0x2177('0x31')](_0x4dde37[_0x2177('0x2d')],_0x4dde37[_0x2177('0x2f')]);_0x35c2b2[_0x2177('0x32')]=_[_0x2177('0x31')](_0x4dde37['model'],qs['fields'](_0x1c40ce[_0x2177('0x2f')]['fields']));_0x35c2b2[_0x2177('0x32')]=_0x35c2b2[_0x2177('0x32')][_0x2177('0x34')]?_0x35c2b2[_0x2177('0x32')]:_0x4dde37[_0x2177('0x2d')];if(_0x1c40ce[_0x2177('0x2f')][_0x2177('0x3d')]){_0x35c2b2[_0x2177('0x42')]=[{'all':!![]}];}_0x35c2b2=_[_0x2177('0x3b')]({},_0x35c2b2,_0x1c40ce[_0x2177('0x43')]);return db[_0x2177('0x3c')]['find'](_0x35c2b2)['then'](handleEntityNotFound(_0x3dd7ed,null))[_0x2177('0x23')](respondWithResult(_0x3dd7ed,null))[_0x2177('0x3f')](handleError(_0x3dd7ed,null));};exports[_0x2177('0x44')]=function(_0x68b8c9,_0x3cf78d){return db['CloudProvider'][_0x2177('0x44')](_0x68b8c9['body'],{})[_0x2177('0x23')](respondWithResult(_0x3cf78d,0xc9))[_0x2177('0x3f')](handleError(_0x3cf78d,null));};exports['update']=function(_0x5e2c76,_0x5ef268){if(_0x5e2c76[_0x2177('0x45')]['id']){delete _0x5e2c76['body']['id'];}return db[_0x2177('0x3c')]['find']({'where':{'id':_0x5e2c76['params']['id']}})[_0x2177('0x23')](handleEntityNotFound(_0x5ef268,null))[_0x2177('0x23')](saveUpdates(_0x5e2c76[_0x2177('0x45')],null))[_0x2177('0x23')](respondWithResult(_0x5ef268,null))[_0x2177('0x3f')](handleError(_0x5ef268,null));};exports[_0x2177('0x24')]=function(_0xd8278c,_0x212bca){return db[_0x2177('0x3c')][_0x2177('0x46')]({'where':{'id':_0xd8278c['params']['id']}})[_0x2177('0x23')](handleEntityNotFound(_0x212bca,null))[_0x2177('0x23')](removeEntity(_0x212bca,null))[_0x2177('0x3f')](handleError(_0x212bca,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b843513..06564ca 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 _0xf49f=['moment','bluebird','path','rimraf','cloud_providers','lodash','util','../../config/logger','api'];(function(_0x502b5f,_0x16cccb){var _0x30e1e8=function(_0x1c7ec4){while(--_0x1c7ec4){_0x502b5f['push'](_0x502b5f['shift']());}};_0x30e1e8(++_0x16cccb);}(_0xf49f,0xb0));var _0xff49=function(_0x8a654f,_0x3d91e7){_0x8a654f=_0x8a654f-0x0;var _0x33d780=_0xf49f[_0x8a654f];return _0x33d780;};'use strict';var _=require(_0xff49('0x0'));var util=require(_0xff49('0x1'));var logger=require(_0xff49('0x2'))(_0xff49('0x3'));var moment=require(_0xff49('0x4'));var BPromise=require(_0xff49('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff49('0x6'));var rimraf=require(_0xff49('0x7'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x26d020,_0x11bbf5){return _0x26d020['define']('CloudProvider',attributes,{'tableName':_0xff49('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62bb=['CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','define'];(function(_0x7efae9,_0x29c8b9){var _0x379048=function(_0x1734e3){while(--_0x1734e3){_0x7efae9['push'](_0x7efae9['shift']());}};_0x379048(++_0x29c8b9);}(_0x62bb,0xc2));var _0xb62b=function(_0x53b65e,_0x59a3de){_0x53b65e=_0x53b65e-0x0;var _0x126423=_0x62bb[_0x53b65e];return _0x126423;};'use strict';var _=require(_0xb62b('0x0'));var util=require('util');var logger=require(_0xb62b('0x1'))(_0xb62b('0x2'));var moment=require(_0xb62b('0x3'));var BPromise=require(_0xb62b('0x4'));var rp=require(_0xb62b('0x5'));var fs=require('fs');var path=require(_0xb62b('0x6'));var rimraf=require(_0xb62b('0x7'));var config=require('../../config/environment');var attributes=require(_0xb62b('0x8'));module['exports']=function(_0x36ecc2,_0x258c95){return _0x36ecc2[_0xb62b('0x9')](_0xb62b('0xa'),attributes,{'tableName':_0xb62b('0xb'),'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 cbcd0b8..144d76b 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 _0x99e8=['CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e6826,_0x59dd66){var _0x349aee=function(_0x4b7bc7){while(--_0x4b7bc7){_0x3e6826['push'](_0x3e6826['shift']());}};_0x349aee(++_0x59dd66);}(_0x99e8,0x79));var _0x899e=function(_0x474e66,_0x58bcb1){_0x474e66=_0x474e66-0x0;var _0x585e9c=_0x99e8[_0x474e66];return _0x585e9c;};'use strict';var _=require(_0x899e('0x0'));var util=require(_0x899e('0x1'));var moment=require(_0x899e('0x2'));var BPromise=require(_0x899e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x899e('0x4'))['db'];var utils=require(_0x899e('0x5'));var logger=require(_0x899e('0x6'))(_0x899e('0x7'));var config=require(_0x899e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x899e('0x9')][_0x899e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x592eee,_0x13a758,_0x45932e){return new BPromise(function(_0x15d673,_0x36ee3d){return client[_0x899e('0xb')](_0x592eee,_0x45932e)[_0x899e('0xc')](function(_0x30c629){logger[_0x899e('0xd')](_0x899e('0xe'),_0x13a758,_0x899e('0xf'));logger[_0x899e('0x10')](_0x899e('0x11'),_0x13a758,_0x899e('0xf'),JSON[_0x899e('0x12')](_0x30c629));if(_0x30c629[_0x899e('0x13')]){if(_0x30c629['error']['code']===0x1f4){logger[_0x899e('0x13')](_0x899e('0xe'),_0x13a758,_0x30c629[_0x899e('0x13')][_0x899e('0x14')]);return _0x36ee3d(_0x30c629[_0x899e('0x13')][_0x899e('0x14')]);}logger['error'](_0x899e('0xe'),_0x13a758,_0x30c629[_0x899e('0x13')][_0x899e('0x14')]);return _0x15d673(_0x30c629[_0x899e('0x13')][_0x899e('0x14')]);}else{logger[_0x899e('0xd')](_0x899e('0xe'),_0x13a758,_0x899e('0xf'));_0x15d673(_0x30c629[_0x899e('0x15')]['message']);}})[_0x899e('0x16')](function(_0x221155){logger[_0x899e('0x13')]('CloudProvider,\x20%s,\x20%s',_0x13a758,_0x221155);_0x36ee3d(_0x221155);});});} \ No newline at end of file +var _0x8097=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x13664d,_0x156372){var _0x9c4d8a=function(_0x5b0a46){while(--_0x5b0a46){_0x13664d['push'](_0x13664d['shift']());}};_0x9c4d8a(++_0x156372);}(_0x8097,0x19f));var _0x7809=function(_0x361589,_0x3e0545){_0x361589=_0x361589-0x0;var _0x538248=_0x8097[_0x361589];return _0x538248;};'use strict';var _=require(_0x7809('0x0'));var util=require(_0x7809('0x1'));var moment=require(_0x7809('0x2'));var BPromise=require(_0x7809('0x3'));var rs=require(_0x7809('0x4'));var fs=require('fs');var Redis=require(_0x7809('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7809('0x6'));var logger=require(_0x7809('0x7'))(_0x7809('0x8'));var config=require('../../config/environment');var jayson=require(_0x7809('0x9'));var client=jayson[_0x7809('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe02d74,_0x417709,_0x471cd7){return new BPromise(function(_0x3a0c2e,_0x30cdc3){return client[_0x7809('0xb')](_0xe02d74,_0x471cd7)['then'](function(_0x3672e4){logger['info']('CloudProvider,\x20%s,\x20%s',_0x417709,_0x7809('0xc'));logger[_0x7809('0xd')](_0x7809('0xe'),_0x417709,_0x7809('0xc'),JSON[_0x7809('0xf')](_0x3672e4));if(_0x3672e4[_0x7809('0x10')]){if(_0x3672e4['error']['code']===0x1f4){logger[_0x7809('0x10')](_0x7809('0x11'),_0x417709,_0x3672e4['error'][_0x7809('0x12')]);return _0x30cdc3(_0x3672e4[_0x7809('0x10')][_0x7809('0x12')]);}logger[_0x7809('0x10')](_0x7809('0x11'),_0x417709,_0x3672e4[_0x7809('0x10')][_0x7809('0x12')]);return _0x3a0c2e(_0x3672e4[_0x7809('0x10')][_0x7809('0x12')]);}else{logger[_0x7809('0x13')](_0x7809('0x11'),_0x417709,_0x7809('0xc'));_0x3a0c2e(_0x3672e4[_0x7809('0x14')]['message']);}})[_0x7809('0x15')](function(_0x1d28b8){logger['error']('CloudProvider,\x20%s,\x20%s',_0x417709,_0x1d28b8);_0x30cdc3(_0x1d28b8);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2e04c90..d5e9729 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 _0x7931=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x1c1b60,_0x488e7d){var _0x349ae2=function(_0x458a96){while(--_0x458a96){_0x1c1b60['push'](_0x1c1b60['shift']());}};_0x349ae2(++_0x488e7d);}(_0x7931,0x1c8));var _0x1793=function(_0x3955d8,_0x187cc2){_0x3955d8=_0x3955d8-0x0;var _0x10aa72=_0x7931[_0x3955d8];return _0x10aa72;};'use strict';var multer=require(_0x1793('0x0'));var util=require('util');var path=require(_0x1793('0x1'));var timeout=require(_0x1793('0x2'));var express=require('express');var router=express[_0x1793('0x3')]();var auth=require(_0x1793('0x4'));var interaction=require(_0x1793('0x5'));var config=require(_0x1793('0x6'));var controller=require(_0x1793('0x7'));router[_0x1793('0x8')]('/',auth[_0x1793('0x9')](),controller[_0x1793('0xa')]);router['get'](_0x1793('0xb'),auth[_0x1793('0x9')](),controller['show']);router[_0x1793('0xc')]('/',auth[_0x1793('0x9')](),controller[_0x1793('0xd')]);router[_0x1793('0xe')](_0x1793('0xb'),auth[_0x1793('0x9')](),controller[_0x1793('0xf')]);router[_0x1793('0x10')](_0x1793('0xb'),auth[_0x1793('0x9')](),controller[_0x1793('0x11')]);module[_0x1793('0x12')]=router; \ No newline at end of file +var _0x9a65=['index','show','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x9a65,0xbd));var _0x59a6=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0x9a65[_0x7a3247];return _0x1bfde5;};'use strict';var multer=require('multer');var util=require(_0x59a6('0x0'));var path=require(_0x59a6('0x1'));var timeout=require(_0x59a6('0x2'));var express=require(_0x59a6('0x3'));var router=express[_0x59a6('0x4')]();var auth=require(_0x59a6('0x5'));var interaction=require(_0x59a6('0x6'));var config=require(_0x59a6('0x7'));var controller=require(_0x59a6('0x8'));router[_0x59a6('0x9')]('/',auth[_0x59a6('0xa')](),controller[_0x59a6('0xb')]);router[_0x59a6('0x9')]('/:id',auth[_0x59a6('0xa')](),controller[_0x59a6('0xc')]);router[_0x59a6('0xd')]('/',auth['isAuthenticated'](),controller[_0x59a6('0xe')]);router[_0x59a6('0xf')](_0x59a6('0x10'),auth['isAuthenticated'](),controller[_0x59a6('0x11')]);router[_0x59a6('0x12')](_0x59a6('0x10'),auth[_0x59a6('0xa')](),controller['destroy']);module[_0x59a6('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 852e9fd..877d336 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 _0xbbf7=['name','sequelize','STRING'];(function(_0x4e3ee6,_0x1cac16){var _0x3a1887=function(_0x1d4b44){while(--_0x1d4b44){_0x4e3ee6['push'](_0x4e3ee6['shift']());}};_0x3a1887(++_0x1cac16);}(_0xbbf7,0x127));var _0x7bbf=function(_0x357bd0,_0x16b15d){_0x357bd0=_0x357bd0-0x0;var _0x2fd95f=_0xbbf7[_0x357bd0];return _0x2fd95f;};'use strict';var Sequelize=require(_0x7bbf('0x0'));module['exports']={'name':{'type':Sequelize[_0x7bbf('0x1')],'unique':_0x7bbf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7bbf('0x1')]},'companyId':{'type':Sequelize[_0x7bbf('0x1')]},'website':{'type':Sequelize[_0x7bbf('0x1')]},'phone':{'type':Sequelize[_0x7bbf('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7bbf('0x1')]},'street':{'type':Sequelize[_0x7bbf('0x1')]},'postalCode':{'type':Sequelize[_0x7bbf('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7bbf('0x1')]},'email':{'type':Sequelize[_0x7bbf('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x7bbf('0x1')]},'sCity':{'type':Sequelize[_0x7bbf('0x1')]},'sCountry':{'type':Sequelize[_0x7bbf('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x489e=['sequelize','exports','STRING'];(function(_0x1a66d0,_0x187b54){var _0x5acf3a=function(_0x4249ee){while(--_0x4249ee){_0x1a66d0['push'](_0x1a66d0['shift']());}};_0x5acf3a(++_0x187b54);}(_0x489e,0x1c2));var _0xe489=function(_0x36f2f9,_0xb7c797){_0x36f2f9=_0x36f2f9-0x0;var _0x367f52=_0x489e[_0x36f2f9];return _0x367f52;};'use strict';var Sequelize=require(_0xe489('0x0'));module[_0xe489('0x1')]={'name':{'type':Sequelize[_0xe489('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe489('0x2')]},'fax':{'type':Sequelize[_0xe489('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xe489('0x2')]},'postalCode':{'type':Sequelize[_0xe489('0x2')]},'city':{'type':Sequelize[_0xe489('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe489('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xe489('0x2')]},'sCity':{'type':Sequelize[_0xe489('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe489('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e7c9fda..240cf3d 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 _0xdba3=['get','Companies','UserProfileResource','end','error','name','index','CmCompany','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','describe','addContacts','CmContact','ids','omit','getContacts','findOne','pick','map','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','reject','save','update','then','destroy'];(function(_0x2722bc,_0x221dd9){var _0x5ac515=function(_0x387030){while(--_0x387030){_0x2722bc['push'](_0x2722bc['shift']());}};_0x5ac515(++_0x221dd9);}(_0xdba3,0x181));var _0x3dba=function(_0x431ee9,_0x455012){_0x431ee9=_0x431ee9-0x0;var _0xd2dcd0=_0xdba3[_0x431ee9];return _0xd2dcd0;};'use strict';var pdf=require(_0x3dba('0x0'));var emlformat=require(_0x3dba('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3dba('0x2'));var jsonpatch=require(_0x3dba('0x3'));var rp=require('request-promise');var moment=require(_0x3dba('0x4'));var BPromise=require(_0x3dba('0x5'));var Mustache=require(_0x3dba('0x6'));var util=require(_0x3dba('0x7'));var path=require(_0x3dba('0x8'));var sox=require(_0x3dba('0x9'));var csv=require('to-csv');var ejs=require(_0x3dba('0xa'));var fs=require('fs');var _=require(_0x3dba('0xb'));var squel=require('squel');var crypto=require(_0x3dba('0xc'));var jsforce=require(_0x3dba('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3dba('0xe'));var querystring=require('querystring');var Papa=require(_0x3dba('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3dba('0x10'));var as=require(_0x3dba('0x11'));var hardwareService=require(_0x3dba('0x12'));var logger=require(_0x3dba('0x13'))(_0x3dba('0x14'));var utils=require(_0x3dba('0x15'));var config=require(_0x3dba('0x16'));var db=require(_0x3dba('0x17'))['db'];function respondWithStatusCode(_0x260a8d,_0x11ff77){_0x11ff77=_0x11ff77||0xcc;return function(_0x3dafb5){if(_0x3dafb5){return _0x260a8d[_0x3dba('0x18')](_0x11ff77);}return _0x260a8d[_0x3dba('0x19')](_0x11ff77)['end']();};}function respondWithResult(_0x479099,_0x2efc60){_0x2efc60=_0x2efc60||0xc8;return function(_0x2d9776){if(_0x2d9776){return _0x479099['status'](_0x2efc60)[_0x3dba('0x1a')](_0x2d9776);}};}function respondWithFilteredResult(_0x4da9e5,_0x2499fe){return function(_0x9dd5f8){if(_0x9dd5f8){var _0x3eba7c=_0x9dd5f8[_0x3dba('0x1b')],_0xd077ba=_0x2499fe['offset'],_0x512cff=_0x2499fe[_0x3dba('0x1c')]+_0x2499fe['limit'],_0x1b03a5;if(_0x512cff>=_0x3eba7c){_0x512cff=_0x3eba7c;_0x1b03a5=0xc8;}else{_0x1b03a5=0xce;}_0x4da9e5[_0x3dba('0x19')](_0x1b03a5);return _0x4da9e5[_0x3dba('0x1d')]('Content-Range',_0xd077ba+'-'+_0x512cff+'/'+_0x3eba7c)[_0x3dba('0x1a')](_0x9dd5f8);}return null;};}function patchUpdates(_0x1b6bd4){return function(_0x50924f){try{jsonpatch['apply'](_0x50924f,_0x1b6bd4,!![]);}catch(_0x4d1052){return BPromise[_0x3dba('0x1e')](_0x4d1052);}return _0x50924f[_0x3dba('0x1f')]();};}function saveUpdates(_0x3bba21,_0x47ccae){return function(_0x30637d){if(_0x30637d){return _0x30637d[_0x3dba('0x20')](_0x3bba21)[_0x3dba('0x21')](function(_0x2bf156){return _0x2bf156;});}return null;};}function removeEntity(_0x319b86,_0x1fa6ae){return function(_0x184da5){if(_0x184da5){return _0x184da5[_0x3dba('0x22')]()[_0x3dba('0x21')](function(){var _0x4d49ae=_0x184da5[_0x3dba('0x23')]({'plain':!![]});var _0x4ea3dc=_0x3dba('0x24');return db[_0x3dba('0x25')]['destroy']({'where':{'type':_0x4ea3dc,'resourceId':_0x4d49ae['id']}})[_0x3dba('0x21')](function(){return _0x184da5;});})[_0x3dba('0x21')](function(){_0x319b86[_0x3dba('0x19')](0xcc)[_0x3dba('0x26')]();});}};}function handleEntityNotFound(_0x33f40b,_0x123d09){return function(_0x500cd8){if(!_0x500cd8){_0x33f40b['sendStatus'](0x194);}return _0x500cd8;};}function handleError(_0x2037f2,_0x481a75){_0x481a75=_0x481a75||0x1f4;return function(_0x1efe13){logger[_0x3dba('0x27')](_0x1efe13['stack']);if(_0x1efe13['name']){delete _0x1efe13[_0x3dba('0x28')];}_0x2037f2[_0x3dba('0x19')](_0x481a75)['send'](_0x1efe13);};}exports[_0x3dba('0x29')]=function(_0x5cde21,_0x285476){var _0x2a3139={},_0xa0480d={},_0x4c4350={'count':0x0,'rows':[]};return db[_0x3dba('0x2a')]['describe']()[_0x3dba('0x21')](function(_0xb4f100){_0xa0480d[_0x3dba('0x2b')]=_['keys'](_0xb4f100);_0xa0480d[_0x3dba('0x2c')]=_[_0x3dba('0x2d')](_0x5cde21[_0x3dba('0x2c')]);_0xa0480d['filters']=_[_0x3dba('0x2e')](_0xa0480d['model'],_0xa0480d[_0x3dba('0x2c')]);_0x2a3139[_0x3dba('0x2f')]=_[_0x3dba('0x2e')](_0xa0480d['model'],qs['fields'](_0x5cde21[_0x3dba('0x2c')][_0x3dba('0x30')]));_0x2a3139[_0x3dba('0x2f')]=_0x2a3139[_0x3dba('0x2f')][_0x3dba('0x31')]?_0x2a3139[_0x3dba('0x2f')]:_0xa0480d[_0x3dba('0x2b')];if(!_0x5cde21[_0x3dba('0x2c')][_0x3dba('0x32')](_0x3dba('0x33'))){_0x2a3139[_0x3dba('0x34')]=qs[_0x3dba('0x34')](_0x5cde21[_0x3dba('0x2c')][_0x3dba('0x34')]);_0x2a3139[_0x3dba('0x1c')]=qs[_0x3dba('0x1c')](_0x5cde21[_0x3dba('0x2c')][_0x3dba('0x1c')]);}_0x2a3139[_0x3dba('0x35')]=qs[_0x3dba('0x36')](_0x5cde21['query']['sort']);_0x2a3139[_0x3dba('0x37')]=qs[_0x3dba('0x38')](_['pick'](_0x5cde21[_0x3dba('0x2c')],_0xa0480d[_0x3dba('0x38')]),_0xb4f100);if(_0x5cde21[_0x3dba('0x2c')][_0x3dba('0x39')]){_0x2a3139[_0x3dba('0x37')]=_[_0x3dba('0x3a')](_0x2a3139[_0x3dba('0x37')],{'$or':_['map'](_0x2a3139[_0x3dba('0x2f')],function(_0x4f1fcd){var _0x484b20={};_0x484b20[_0x4f1fcd]={'$like':'%'+_0x5cde21[_0x3dba('0x2c')]['filter']+'%'};return _0x484b20;})});}_0x2a3139=_[_0x3dba('0x3a')]({},_0x2a3139,_0x5cde21[_0x3dba('0x3b')]);var _0x30309f={'where':_0x2a3139[_0x3dba('0x37')]};return db[_0x3dba('0x2a')][_0x3dba('0x1b')](_0x30309f)[_0x3dba('0x21')](function(_0x3d9663){_0x4c4350[_0x3dba('0x1b')]=_0x3d9663;if(_0x5cde21[_0x3dba('0x2c')][_0x3dba('0x3c')]){_0x2a3139[_0x3dba('0x3d')]=[{'all':!![]}];}return db[_0x3dba('0x2a')]['findAll'](_0x2a3139);})[_0x3dba('0x21')](function(_0x3cbc6d){_0x4c4350[_0x3dba('0x3e')]=_0x3cbc6d;return _0x4c4350;})[_0x3dba('0x21')](respondWithFilteredResult(_0x285476,_0x2a3139))[_0x3dba('0x3f')](handleError(_0x285476,null));})[_0x3dba('0x3f')](handleError(_0x285476,null));};exports[_0x3dba('0x40')]=function(_0x420beb,_0x587845){var _0x3d8287={'raw':![],'where':{'id':_0x420beb[_0x3dba('0x41')]['id']}},_0x52c87c={};_0x52c87c[_0x3dba('0x2b')]=_[_0x3dba('0x2d')](db['CmCompany'][_0x3dba('0x42')]);_0x52c87c[_0x3dba('0x2c')]=_['keys'](_0x420beb['query']);_0x52c87c[_0x3dba('0x38')]=_[_0x3dba('0x2e')](_0x52c87c[_0x3dba('0x2b')],_0x52c87c[_0x3dba('0x2c')]);_0x3d8287[_0x3dba('0x2f')]=_[_0x3dba('0x2e')](_0x52c87c[_0x3dba('0x2b')],qs[_0x3dba('0x30')](_0x420beb[_0x3dba('0x2c')][_0x3dba('0x30')]));_0x3d8287['attributes']=_0x3d8287['attributes'][_0x3dba('0x31')]?_0x3d8287[_0x3dba('0x2f')]:_0x52c87c[_0x3dba('0x2b')];if(_0x420beb[_0x3dba('0x2c')][_0x3dba('0x3c')]){_0x3d8287['include']=[{'all':!![]}];}_0x3d8287=_[_0x3dba('0x3a')]({},_0x3d8287,_0x420beb[_0x3dba('0x3b')]);return db[_0x3dba('0x2a')][_0x3dba('0x43')](_0x3d8287)[_0x3dba('0x21')](handleEntityNotFound(_0x587845,null))[_0x3dba('0x21')](respondWithResult(_0x587845,null))[_0x3dba('0x3f')](handleError(_0x587845,null));};exports[_0x3dba('0x44')]=function(_0x1ca53d,_0x40b8fe){return db['CmCompany'][_0x3dba('0x44')](_0x1ca53d['body'],{})[_0x3dba('0x21')](function(_0x5051d7){var _0x4aed83=_0x1ca53d[_0x3dba('0x45')][_0x3dba('0x23')]({'plain':!![]});if(!_0x4aed83)throw new Error(_0x3dba('0x46'));if(_0x4aed83[_0x3dba('0x47')]===_0x3dba('0x45')){var _0x449c0=_0x5051d7[_0x3dba('0x23')]({'plain':!![]});var _0x49a555='Companies';return db[_0x3dba('0x48')]['find']({'where':{'name':_0x49a555,'userProfileId':_0x4aed83[_0x3dba('0x49')]},'raw':!![]})[_0x3dba('0x21')](function(_0x4b9c02){if(_0x4b9c02&&_0x4b9c02['autoAssociation']===0x0){return db[_0x3dba('0x25')][_0x3dba('0x44')]({'name':_0x449c0[_0x3dba('0x28')],'resourceId':_0x449c0['id'],'type':_0x4b9c02[_0x3dba('0x28')],'sectionId':_0x4b9c02['id']},{})[_0x3dba('0x21')](function(){return _0x5051d7;});}else{return _0x5051d7;}})[_0x3dba('0x3f')](function(_0x3e5e1e){logger[_0x3dba('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e5e1e);throw _0x3e5e1e;});}return _0x5051d7;})[_0x3dba('0x21')](respondWithResult(_0x40b8fe,0xc9))[_0x3dba('0x3f')](handleError(_0x40b8fe,null));};exports[_0x3dba('0x20')]=function(_0x4e1974,_0x15f92a){if(_0x4e1974[_0x3dba('0x4a')]['id']){delete _0x4e1974['body']['id'];}return db[_0x3dba('0x2a')][_0x3dba('0x43')]({'where':{'id':_0x4e1974[_0x3dba('0x41')]['id']}})[_0x3dba('0x21')](handleEntityNotFound(_0x15f92a,null))[_0x3dba('0x21')](saveUpdates(_0x4e1974[_0x3dba('0x4a')],null))[_0x3dba('0x21')](respondWithResult(_0x15f92a,null))[_0x3dba('0x3f')](handleError(_0x15f92a,null));};exports['destroy']=function(_0x55e7f0,_0x50b47e){return db[_0x3dba('0x2a')][_0x3dba('0x43')]({'where':{'id':_0x55e7f0[_0x3dba('0x41')]['id']}})['then'](handleEntityNotFound(_0x50b47e,null))['then'](removeEntity(_0x50b47e,null))['catch'](handleError(_0x50b47e,null));};exports[_0x3dba('0x4b')]=function(_0x1df18f,_0x389a63){return db[_0x3dba('0x2a')][_0x3dba('0x4b')]()[_0x3dba('0x21')](respondWithResult(_0x389a63,null))[_0x3dba('0x3f')](handleError(_0x389a63,null));};exports[_0x3dba('0x4c')]=function(_0x3d761f,_0x5553d6,_0x3488c7){return db[_0x3dba('0x4d')]['find']({'where':{'id':_0x3d761f['params']['id']}})['then'](handleEntityNotFound(_0x5553d6,null))[_0x3dba('0x21')](function(_0x520cd7){if(_0x520cd7){return _0x520cd7[_0x3dba('0x4c')](_0x3d761f[_0x3dba('0x4a')][_0x3dba('0x4e')],_[_0x3dba('0x4f')](_0x3d761f[_0x3dba('0x4a')],[_0x3dba('0x4e'),'id'])||{});}})[_0x3dba('0x21')](respondWithResult(_0x5553d6,null))[_0x3dba('0x3f')](handleError(_0x5553d6,null));};exports[_0x3dba('0x50')]=function(_0x4d4065,_0x15f5f5,_0x21e9f3){var _0x4f8e32={};var _0x3288b1={};var _0x483a04;var _0x1ae69b;return db['CmCompany'][_0x3dba('0x51')]({'where':{'id':_0x4d4065[_0x3dba('0x41')]['id']}})[_0x3dba('0x21')](handleEntityNotFound(_0x15f5f5,null))[_0x3dba('0x21')](function(_0x14fb18){if(_0x14fb18){_0x483a04=_0x14fb18;_0x3288b1[_0x3dba('0x2b')]=_[_0x3dba('0x2d')](db['CmContact'][_0x3dba('0x42')]);_0x3288b1[_0x3dba('0x2c')]=_[_0x3dba('0x2d')](_0x4d4065[_0x3dba('0x2c')]);_0x3288b1[_0x3dba('0x38')]=_[_0x3dba('0x2e')](_0x3288b1['model'],_0x3288b1[_0x3dba('0x2c')]);_0x4f8e32[_0x3dba('0x2f')]=_[_0x3dba('0x2e')](_0x3288b1[_0x3dba('0x2b')],qs['fields'](_0x4d4065[_0x3dba('0x2c')][_0x3dba('0x30')]));_0x4f8e32['attributes']=_0x4f8e32[_0x3dba('0x2f')][_0x3dba('0x31')]?_0x4f8e32[_0x3dba('0x2f')]:_0x3288b1[_0x3dba('0x2b')];_0x4f8e32[_0x3dba('0x35')]=qs['sort'](_0x4d4065['query'][_0x3dba('0x36')]);_0x4f8e32['where']=qs[_0x3dba('0x38')](_[_0x3dba('0x52')](_0x4d4065[_0x3dba('0x2c')],_0x3288b1[_0x3dba('0x38')]));if(_0x4d4065[_0x3dba('0x2c')][_0x3dba('0x39')]){_0x4f8e32[_0x3dba('0x37')]=_[_0x3dba('0x3a')](_0x4f8e32[_0x3dba('0x37')],{'$or':_[_0x3dba('0x53')](_0x4f8e32['attributes'],function(_0x42a1ca){var _0x56099f={};_0x56099f[_0x42a1ca]={'$like':'%'+_0x4d4065[_0x3dba('0x2c')][_0x3dba('0x39')]+'%'};return _0x56099f;})});}_0x4f8e32=_['merge']({},_0x4f8e32,_0x4d4065['options']);return _0x483a04[_0x3dba('0x50')](_0x4f8e32);}})['then'](function(_0x524e56){if(_0x524e56){_0x1ae69b=_0x524e56[_0x3dba('0x31')];if(!_0x4d4065[_0x3dba('0x2c')]['hasOwnProperty'](_0x3dba('0x33'))){_0x4f8e32[_0x3dba('0x34')]=qs['limit'](_0x4d4065[_0x3dba('0x2c')]['limit']);_0x4f8e32[_0x3dba('0x1c')]=qs['offset'](_0x4d4065[_0x3dba('0x2c')][_0x3dba('0x1c')]);}return _0x483a04['getContacts'](_0x4f8e32);}})[_0x3dba('0x21')](function(_0x38aab4){if(_0x38aab4){return _0x38aab4?{'count':_0x1ae69b,'rows':_0x38aab4}:null;}})[_0x3dba('0x21')](respondWithResult(_0x15f5f5,null))[_0x3dba('0x3f')](handleError(_0x15f5f5,null));}; \ No newline at end of file +var _0x3e03=['lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','destroy','then','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','addContacts','CmContact','ids','getContacts','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x117821,_0xaa1933){var _0x4ae9ff=function(_0x253662){while(--_0x253662){_0x117821['push'](_0x117821['shift']());}};_0x4ae9ff(++_0xaa1933);}(_0x3e03,0x19c));var _0x33e0=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0x3e03[_0x29d2d2];return _0x3f6476;};'use strict';var pdf=require(_0x33e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x33e0('0x1'));var zipdir=require(_0x33e0('0x2'));var jsonpatch=require(_0x33e0('0x3'));var rp=require(_0x33e0('0x4'));var moment=require(_0x33e0('0x5'));var BPromise=require(_0x33e0('0x6'));var Mustache=require(_0x33e0('0x7'));var util=require(_0x33e0('0x8'));var path=require(_0x33e0('0x9'));var sox=require(_0x33e0('0xa'));var csv=require(_0x33e0('0xb'));var ejs=require(_0x33e0('0xc'));var fs=require('fs');var _=require(_0x33e0('0xd'));var squel=require('squel');var crypto=require(_0x33e0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x33e0('0xf'));var toCsv=require(_0x33e0('0xb'));var querystring=require(_0x33e0('0x10'));var Papa=require(_0x33e0('0x11'));var Redis=require('ioredis');var authService=require(_0x33e0('0x12'));var qs=require(_0x33e0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33e0('0x14'));var logger=require(_0x33e0('0x15'))(_0x33e0('0x16'));var utils=require(_0x33e0('0x17'));var config=require(_0x33e0('0x18'));var db=require(_0x33e0('0x19'))['db'];function respondWithStatusCode(_0x54e6bf,_0x4a14b3){_0x4a14b3=_0x4a14b3||0xcc;return function(_0x93f56e){if(_0x93f56e){return _0x54e6bf[_0x33e0('0x1a')](_0x4a14b3);}return _0x54e6bf[_0x33e0('0x1b')](_0x4a14b3)[_0x33e0('0x1c')]();};}function respondWithResult(_0x1a6d78,_0x13f737){_0x13f737=_0x13f737||0xc8;return function(_0x5f4630){if(_0x5f4630){return _0x1a6d78[_0x33e0('0x1b')](_0x13f737)['json'](_0x5f4630);}};}function respondWithFilteredResult(_0x3cea0f,_0x1b28dc){return function(_0x88d4c){if(_0x88d4c){var _0xbbe5fb=_0x88d4c[_0x33e0('0x1d')],_0x548f8c=_0x1b28dc['offset'],_0x5978be=_0x1b28dc[_0x33e0('0x1e')]+_0x1b28dc[_0x33e0('0x1f')],_0x2da951;if(_0x5978be>=_0xbbe5fb){_0x5978be=_0xbbe5fb;_0x2da951=0xc8;}else{_0x2da951=0xce;}_0x3cea0f[_0x33e0('0x1b')](_0x2da951);return _0x3cea0f[_0x33e0('0x20')]('Content-Range',_0x548f8c+'-'+_0x5978be+'/'+_0xbbe5fb)[_0x33e0('0x21')](_0x88d4c);}return null;};}function patchUpdates(_0x4b0dfe){return function(_0x5edc2a){try{jsonpatch[_0x33e0('0x22')](_0x5edc2a,_0x4b0dfe,!![]);}catch(_0x210e26){return BPromise['reject'](_0x210e26);}return _0x5edc2a[_0x33e0('0x23')]();};}function saveUpdates(_0x1d8f26,_0x2a363d){return function(_0x4dff20){if(_0x4dff20){return _0x4dff20[_0x33e0('0x24')](_0x1d8f26)['then'](function(_0x4bfb20){return _0x4bfb20;});}return null;};}function removeEntity(_0x3c92c4,_0x5368f2){return function(_0x2ec6aa){if(_0x2ec6aa){return _0x2ec6aa[_0x33e0('0x25')]()[_0x33e0('0x26')](function(){var _0x2603c7=_0x2ec6aa['get']({'plain':!![]});var _0x17b222=_0x33e0('0x27');return db[_0x33e0('0x28')]['destroy']({'where':{'type':_0x17b222,'resourceId':_0x2603c7['id']}})[_0x33e0('0x26')](function(){return _0x2ec6aa;});})[_0x33e0('0x26')](function(){_0x3c92c4['status'](0xcc)[_0x33e0('0x1c')]();});}};}function handleEntityNotFound(_0x482182,_0x2b3c1b){return function(_0x41468b){if(!_0x41468b){_0x482182[_0x33e0('0x1a')](0x194);}return _0x41468b;};}function handleError(_0x7a805f,_0x30c07e){_0x30c07e=_0x30c07e||0x1f4;return function(_0x4059cd){logger[_0x33e0('0x29')](_0x4059cd[_0x33e0('0x2a')]);if(_0x4059cd[_0x33e0('0x2b')]){delete _0x4059cd[_0x33e0('0x2b')];}_0x7a805f[_0x33e0('0x1b')](_0x30c07e)[_0x33e0('0x2c')](_0x4059cd);};}exports[_0x33e0('0x2d')]=function(_0x393a76,_0x499301){var _0x21c0fd={},_0x56e36d={},_0x1c99d0={'count':0x0,'rows':[]};return db[_0x33e0('0x2e')][_0x33e0('0x2f')]()['then'](function(_0x32eb30){_0x56e36d[_0x33e0('0x30')]=_['keys'](_0x32eb30);_0x56e36d[_0x33e0('0x31')]=_[_0x33e0('0x32')](_0x393a76[_0x33e0('0x31')]);_0x56e36d['filters']=_[_0x33e0('0x33')](_0x56e36d['model'],_0x56e36d[_0x33e0('0x31')]);_0x21c0fd[_0x33e0('0x34')]=_[_0x33e0('0x33')](_0x56e36d['model'],qs[_0x33e0('0x35')](_0x393a76[_0x33e0('0x31')][_0x33e0('0x35')]));_0x21c0fd[_0x33e0('0x34')]=_0x21c0fd[_0x33e0('0x34')][_0x33e0('0x36')]?_0x21c0fd[_0x33e0('0x34')]:_0x56e36d['model'];if(!_0x393a76[_0x33e0('0x31')][_0x33e0('0x37')](_0x33e0('0x38'))){_0x21c0fd[_0x33e0('0x1f')]=qs[_0x33e0('0x1f')](_0x393a76['query'][_0x33e0('0x1f')]);_0x21c0fd[_0x33e0('0x1e')]=qs[_0x33e0('0x1e')](_0x393a76[_0x33e0('0x31')][_0x33e0('0x1e')]);}_0x21c0fd[_0x33e0('0x39')]=qs[_0x33e0('0x3a')](_0x393a76[_0x33e0('0x31')][_0x33e0('0x3a')]);_0x21c0fd[_0x33e0('0x3b')]=qs[_0x33e0('0x3c')](_[_0x33e0('0x3d')](_0x393a76['query'],_0x56e36d[_0x33e0('0x3c')]),_0x32eb30);if(_0x393a76[_0x33e0('0x31')][_0x33e0('0x3e')]){_0x21c0fd[_0x33e0('0x3b')]=_[_0x33e0('0x3f')](_0x21c0fd[_0x33e0('0x3b')],{'$or':_[_0x33e0('0x40')](_0x21c0fd[_0x33e0('0x34')],function(_0x21b378){var _0x148b20={};_0x148b20[_0x21b378]={'$like':'%'+_0x393a76[_0x33e0('0x31')][_0x33e0('0x3e')]+'%'};return _0x148b20;})});}_0x21c0fd=_[_0x33e0('0x3f')]({},_0x21c0fd,_0x393a76[_0x33e0('0x41')]);var _0x37f3fe={'where':_0x21c0fd[_0x33e0('0x3b')]};return db[_0x33e0('0x2e')][_0x33e0('0x1d')](_0x37f3fe)[_0x33e0('0x26')](function(_0x45b62e){_0x1c99d0[_0x33e0('0x1d')]=_0x45b62e;if(_0x393a76[_0x33e0('0x31')][_0x33e0('0x42')]){_0x21c0fd[_0x33e0('0x43')]=[{'all':!![]}];}return db['CmCompany'][_0x33e0('0x44')](_0x21c0fd);})[_0x33e0('0x26')](function(_0x399df0){_0x1c99d0['rows']=_0x399df0;return _0x1c99d0;})['then'](respondWithFilteredResult(_0x499301,_0x21c0fd))[_0x33e0('0x45')](handleError(_0x499301,null));})[_0x33e0('0x45')](handleError(_0x499301,null));};exports[_0x33e0('0x46')]=function(_0x1df1f3,_0x3332b4){var _0x3082bd={'raw':![],'where':{'id':_0x1df1f3[_0x33e0('0x47')]['id']}},_0x59a7ab={};_0x59a7ab[_0x33e0('0x30')]=_[_0x33e0('0x32')](db[_0x33e0('0x2e')][_0x33e0('0x48')]);_0x59a7ab[_0x33e0('0x31')]=_[_0x33e0('0x32')](_0x1df1f3['query']);_0x59a7ab[_0x33e0('0x3c')]=_['intersection'](_0x59a7ab[_0x33e0('0x30')],_0x59a7ab[_0x33e0('0x31')]);_0x3082bd[_0x33e0('0x34')]=_['intersection'](_0x59a7ab[_0x33e0('0x30')],qs[_0x33e0('0x35')](_0x1df1f3['query'][_0x33e0('0x35')]));_0x3082bd['attributes']=_0x3082bd['attributes'][_0x33e0('0x36')]?_0x3082bd[_0x33e0('0x34')]:_0x59a7ab[_0x33e0('0x30')];if(_0x1df1f3[_0x33e0('0x31')]['includeAll']){_0x3082bd[_0x33e0('0x43')]=[{'all':!![]}];}_0x3082bd=_[_0x33e0('0x3f')]({},_0x3082bd,_0x1df1f3['options']);return db[_0x33e0('0x2e')][_0x33e0('0x49')](_0x3082bd)[_0x33e0('0x26')](handleEntityNotFound(_0x3332b4,null))[_0x33e0('0x26')](respondWithResult(_0x3332b4,null))[_0x33e0('0x45')](handleError(_0x3332b4,null));};exports[_0x33e0('0x4a')]=function(_0x415539,_0x2ca003){return db[_0x33e0('0x2e')][_0x33e0('0x4a')](_0x415539[_0x33e0('0x4b')],{})['then'](function(_0x3fdaac){var _0x6b39ef=_0x415539[_0x33e0('0x4c')]['get']({'plain':!![]});if(!_0x6b39ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6b39ef['role']===_0x33e0('0x4c')){var _0x2414e0=_0x3fdaac[_0x33e0('0x4d')]({'plain':!![]});var _0x2c1cf9=_0x33e0('0x27');return db[_0x33e0('0x4e')]['find']({'where':{'name':_0x2c1cf9,'userProfileId':_0x6b39ef[_0x33e0('0x4f')]},'raw':!![]})[_0x33e0('0x26')](function(_0x353004){if(_0x353004&&_0x353004[_0x33e0('0x50')]===0x0){return db[_0x33e0('0x28')][_0x33e0('0x4a')]({'name':_0x2414e0[_0x33e0('0x2b')],'resourceId':_0x2414e0['id'],'type':_0x353004[_0x33e0('0x2b')],'sectionId':_0x353004['id']},{})[_0x33e0('0x26')](function(){return _0x3fdaac;});}else{return _0x3fdaac;}})[_0x33e0('0x45')](function(_0x3c9ac8){logger[_0x33e0('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c9ac8);throw _0x3c9ac8;});}return _0x3fdaac;})[_0x33e0('0x26')](respondWithResult(_0x2ca003,0xc9))[_0x33e0('0x45')](handleError(_0x2ca003,null));};exports[_0x33e0('0x24')]=function(_0x370cf7,_0xee4d9f){if(_0x370cf7[_0x33e0('0x4b')]['id']){delete _0x370cf7[_0x33e0('0x4b')]['id'];}return db['CmCompany'][_0x33e0('0x49')]({'where':{'id':_0x370cf7[_0x33e0('0x47')]['id']}})[_0x33e0('0x26')](handleEntityNotFound(_0xee4d9f,null))[_0x33e0('0x26')](saveUpdates(_0x370cf7['body'],null))['then'](respondWithResult(_0xee4d9f,null))[_0x33e0('0x45')](handleError(_0xee4d9f,null));};exports['destroy']=function(_0x3b0cf5,_0x1401d3){return db[_0x33e0('0x2e')][_0x33e0('0x49')]({'where':{'id':_0x3b0cf5[_0x33e0('0x47')]['id']}})[_0x33e0('0x26')](handleEntityNotFound(_0x1401d3,null))['then'](removeEntity(_0x1401d3,null))[_0x33e0('0x45')](handleError(_0x1401d3,null));};exports[_0x33e0('0x2f')]=function(_0x383276,_0x109e47){return db['CmCompany'][_0x33e0('0x2f')]()[_0x33e0('0x26')](respondWithResult(_0x109e47,null))['catch'](handleError(_0x109e47,null));};exports[_0x33e0('0x51')]=function(_0x1b50fd,_0x36d5e5,_0x330c9d){return db[_0x33e0('0x52')][_0x33e0('0x49')]({'where':{'id':_0x1b50fd[_0x33e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x36d5e5,null))['then'](function(_0x59a087){if(_0x59a087){return _0x59a087[_0x33e0('0x51')](_0x1b50fd[_0x33e0('0x4b')][_0x33e0('0x53')],_['omit'](_0x1b50fd['body'],[_0x33e0('0x53'),'id'])||{});}})[_0x33e0('0x26')](respondWithResult(_0x36d5e5,null))[_0x33e0('0x45')](handleError(_0x36d5e5,null));};exports['getContacts']=function(_0x1bd6c9,_0x3caf87,_0x7f0273){var _0x3cc801={};var _0x3fdf27={};var _0x55ccc6;var _0x1df932;return db['CmCompany']['findOne']({'where':{'id':_0x1bd6c9[_0x33e0('0x47')]['id']}})[_0x33e0('0x26')](handleEntityNotFound(_0x3caf87,null))[_0x33e0('0x26')](function(_0x17137a){if(_0x17137a){_0x55ccc6=_0x17137a;_0x3fdf27[_0x33e0('0x30')]=_[_0x33e0('0x32')](db['CmContact'][_0x33e0('0x48')]);_0x3fdf27['query']=_[_0x33e0('0x32')](_0x1bd6c9['query']);_0x3fdf27[_0x33e0('0x3c')]=_[_0x33e0('0x33')](_0x3fdf27[_0x33e0('0x30')],_0x3fdf27[_0x33e0('0x31')]);_0x3cc801[_0x33e0('0x34')]=_[_0x33e0('0x33')](_0x3fdf27[_0x33e0('0x30')],qs['fields'](_0x1bd6c9['query'][_0x33e0('0x35')]));_0x3cc801['attributes']=_0x3cc801[_0x33e0('0x34')]['length']?_0x3cc801['attributes']:_0x3fdf27[_0x33e0('0x30')];_0x3cc801[_0x33e0('0x39')]=qs['sort'](_0x1bd6c9[_0x33e0('0x31')][_0x33e0('0x3a')]);_0x3cc801[_0x33e0('0x3b')]=qs['filters'](_[_0x33e0('0x3d')](_0x1bd6c9[_0x33e0('0x31')],_0x3fdf27[_0x33e0('0x3c')]));if(_0x1bd6c9[_0x33e0('0x31')][_0x33e0('0x3e')]){_0x3cc801['where']=_[_0x33e0('0x3f')](_0x3cc801[_0x33e0('0x3b')],{'$or':_[_0x33e0('0x40')](_0x3cc801[_0x33e0('0x34')],function(_0x39ab3b){var _0x972238={};_0x972238[_0x39ab3b]={'$like':'%'+_0x1bd6c9['query'][_0x33e0('0x3e')]+'%'};return _0x972238;})});}_0x3cc801=_[_0x33e0('0x3f')]({},_0x3cc801,_0x1bd6c9[_0x33e0('0x41')]);return _0x55ccc6[_0x33e0('0x54')](_0x3cc801);}})['then'](function(_0x9322fc){if(_0x9322fc){_0x1df932=_0x9322fc[_0x33e0('0x36')];if(!_0x1bd6c9[_0x33e0('0x31')][_0x33e0('0x37')]('nolimit')){_0x3cc801['limit']=qs[_0x33e0('0x1f')](_0x1bd6c9[_0x33e0('0x31')]['limit']);_0x3cc801[_0x33e0('0x1e')]=qs[_0x33e0('0x1e')](_0x1bd6c9[_0x33e0('0x31')][_0x33e0('0x1e')]);}return _0x55ccc6[_0x33e0('0x54')](_0x3cc801);}})[_0x33e0('0x26')](function(_0x301c7f){if(_0x301c7f){return _0x301c7f?{'count':_0x1df932,'rows':_0x301c7f}:null;}})[_0x33e0('0x26')](respondWithResult(_0x3caf87,null))[_0x33e0('0x45')](handleError(_0x3caf87,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 63753b4..9d19fb9 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 _0x0fda=['bluebird','request-promise','path','rimraf','exports','define','CmCompany','cm_companies','lodash','../../config/logger','api','moment'];(function(_0x2e0aa1,_0x4aaa46){var _0x2f9ac7=function(_0x2bdf20){while(--_0x2bdf20){_0x2e0aa1['push'](_0x2e0aa1['shift']());}};_0x2f9ac7(++_0x4aaa46);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x21706a,_0x26a23a){_0x21706a=_0x21706a-0x0;var _0x3038f1=_0x0fda[_0x21706a];return _0x3038f1;};'use strict';var _=require(_0xa0fd('0x0'));var util=require('util');var logger=require(_0xa0fd('0x1'))(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var BPromise=require(_0xa0fd('0x4'));var rp=require(_0xa0fd('0x5'));var fs=require('fs');var path=require(_0xa0fd('0x6'));var rimraf=require(_0xa0fd('0x7'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0xa0fd('0x8')]=function(_0x4aec58,_0x49b3c1){return _0x4aec58[_0xa0fd('0x9')](_0xa0fd('0xa'),attributes,{'tableName':_0xa0fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x943c=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies'];(function(_0x42c880,_0x31e4c8){var _0x30e437=function(_0x3fa990){while(--_0x3fa990){_0x42c880['push'](_0x42c880['shift']());}};_0x30e437(++_0x31e4c8);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var logger=require(_0xc943('0x2'))(_0xc943('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc943('0x4'));var fs=require('fs');var path=require(_0xc943('0x5'));var rimraf=require(_0xc943('0x6'));var config=require('../../config/environment');var attributes=require(_0xc943('0x7'));module[_0xc943('0x8')]=function(_0x3307ef,_0xaff37f){return _0x3307ef[_0xc943('0x9')](_0xc943('0xa'),attributes,{'tableName':_0xc943('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 1d2d701..7c4c509 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 _0x8be8=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x21284e,_0x535ad3){var _0x557461=function(_0x37f698){while(--_0x37f698){_0x21284e['push'](_0x21284e['shift']());}};_0x557461(++_0x535ad3);}(_0x8be8,0x1c9));var _0x88be=function(_0x551876,_0x14bc1b){_0x551876=_0x551876-0x0;var _0x337952=_0x8be8[_0x551876];return _0x337952;};'use strict';var _=require(_0x88be('0x0'));var util=require(_0x88be('0x1'));var moment=require(_0x88be('0x2'));var BPromise=require(_0x88be('0x3'));var rs=require(_0x88be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x88be('0x5'))('rpc');var config=require(_0x88be('0x6'));var jayson=require(_0x88be('0x7'));var client=jayson[_0x88be('0x8')][_0x88be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d3da,_0x16301b,_0x278921){return new BPromise(function(_0x4a3d37,_0x52dc83){return client[_0x88be('0xa')](_0x3d3da,_0x278921)[_0x88be('0xb')](function(_0x15edd7){logger[_0x88be('0xc')](_0x88be('0xd'),_0x16301b,_0x88be('0xe'));logger['debug'](_0x88be('0xf'),_0x16301b,_0x88be('0xe'),JSON['stringify'](_0x15edd7));if(_0x15edd7[_0x88be('0x10')]){if(_0x15edd7[_0x88be('0x10')][_0x88be('0x11')]===0x1f4){logger[_0x88be('0x10')](_0x88be('0xd'),_0x16301b,_0x15edd7[_0x88be('0x10')][_0x88be('0x12')]);return _0x52dc83(_0x15edd7[_0x88be('0x10')][_0x88be('0x12')]);}logger[_0x88be('0x10')](_0x88be('0xd'),_0x16301b,_0x15edd7['error']['message']);return _0x4a3d37(_0x15edd7[_0x88be('0x10')][_0x88be('0x12')]);}else{logger['info'](_0x88be('0xd'),_0x16301b,_0x88be('0xe'));_0x4a3d37(_0x15edd7[_0x88be('0x13')]['message']);}})[_0x88be('0x14')](function(_0x291ed6){logger[_0x88be('0x10')](_0x88be('0xd'),_0x16301b,_0x291ed6);_0x52dc83(_0x291ed6);});});} \ No newline at end of file +var _0xdb8f=['message','CmCompany,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x2f2149,_0x247eae){var _0xff9526=function(_0x4bc1c3){while(--_0x4bc1c3){_0x2f2149['push'](_0x2f2149['shift']());}};_0xff9526(++_0x247eae);}(_0xdb8f,0x17f));var _0xfdb8=function(_0xf3fb4e,_0x1f8665){_0xf3fb4e=_0xf3fb4e-0x0;var _0x561bdb=_0xdb8f[_0xf3fb4e];return _0x561bdb;};'use strict';var _=require(_0xfdb8('0x0'));var util=require(_0xfdb8('0x1'));var moment=require('moment');var BPromise=require(_0xfdb8('0x2'));var rs=require(_0xfdb8('0x3'));var fs=require('fs');var Redis=require(_0xfdb8('0x4'));var db=require(_0xfdb8('0x5'))['db'];var utils=require(_0xfdb8('0x6'));var logger=require('../../config/logger')(_0xfdb8('0x7'));var config=require('../../config/environment');var jayson=require(_0xfdb8('0x8'));var client=jayson[_0xfdb8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0e3a,_0x59044b,_0x5edd62){return new BPromise(function(_0x20fe40,_0x5c5ce6){return client[_0xfdb8('0xa')](_0x4e0e3a,_0x5edd62)[_0xfdb8('0xb')](function(_0x114025){logger[_0xfdb8('0xc')]('CmCompany,\x20%s,\x20%s',_0x59044b,_0xfdb8('0xd'));logger[_0xfdb8('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x59044b,_0xfdb8('0xd'),JSON[_0xfdb8('0xf')](_0x114025));if(_0x114025[_0xfdb8('0x10')]){if(_0x114025[_0xfdb8('0x10')]['code']===0x1f4){logger[_0xfdb8('0x10')]('CmCompany,\x20%s,\x20%s',_0x59044b,_0x114025[_0xfdb8('0x10')][_0xfdb8('0x11')]);return _0x5c5ce6(_0x114025[_0xfdb8('0x10')][_0xfdb8('0x11')]);}logger['error'](_0xfdb8('0x12'),_0x59044b,_0x114025[_0xfdb8('0x10')][_0xfdb8('0x11')]);return _0x20fe40(_0x114025[_0xfdb8('0x10')][_0xfdb8('0x11')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x59044b,_0xfdb8('0xd'));_0x20fe40(_0x114025['result'][_0xfdb8('0x11')]);}})[_0xfdb8('0x13')](function(_0x5f4f3c){logger['error']('CmCompany,\x20%s,\x20%s',_0x59044b,_0x5f4f3c);_0x5c5ce6(_0x5f4f3c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 7f2e06c..e1a201d 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 _0xef0f=['isAuthenticated','index','/describe','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x561854,_0x414a2d){var _0x157589=function(_0x4a7c87){while(--_0x4a7c87){_0x561854['push'](_0x561854['shift']());}};_0x157589(++_0x414a2d);}(_0xef0f,0x168));var _0xfef0=function(_0x3c9454,_0x4e9f7a){_0x3c9454=_0x3c9454-0x0;var _0x468dd3=_0xef0f[_0x3c9454];return _0x468dd3;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var auth=require(_0xfef0('0x4'));var interaction=require(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var controller=require('./cmCompany.controller');router[_0xfef0('0x7')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0x9')]);router[_0xfef0('0x7')](_0xfef0('0xa'),auth[_0xfef0('0x8')](),controller['describe']);router[_0xfef0('0x7')]('/:id',auth[_0xfef0('0x8')](),controller[_0xfef0('0xb')]);router[_0xfef0('0x7')](_0xfef0('0xc'),auth[_0xfef0('0x8')](),controller[_0xfef0('0xd')]);router[_0xfef0('0xe')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0xf')]);router[_0xfef0('0xe')](_0xfef0('0xc'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')]('/:id',auth[_0xfef0('0x8')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0x14'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x15')]);module[_0xfef0('0x16')]=router; \ No newline at end of file +var _0x0adf=['getContacts','post','create','addContacts','put','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts'];(function(_0x29dc35,_0x1f1be3){var _0x3993d8=function(_0x512901){while(--_0x512901){_0x29dc35['push'](_0x29dc35['shift']());}};_0x3993d8(++_0x1f1be3);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x3be5d7,_0x51ae04){_0x3be5d7=_0x3be5d7-0x0;var _0x359534=_0x0adf[_0x3be5d7];return _0x359534;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var auth=require(_0xf0ad('0x5'));var interaction=require(_0xf0ad('0x6'));var config=require(_0xf0ad('0x7'));var controller=require(_0xf0ad('0x8'));router[_0xf0ad('0x9')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0xa')]);router['get'](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0x9')](_0xf0ad('0xe'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xf')]);router['get'](_0xf0ad('0x10'),auth['isAuthenticated'](),controller[_0xf0ad('0x11')]);router[_0xf0ad('0x12')]('/',auth[_0xf0ad('0xc')](),controller[_0xf0ad('0x13')]);router[_0xf0ad('0x12')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xf0ad('0x14')]);router[_0xf0ad('0x15')](_0xf0ad('0xe'),auth[_0xf0ad('0xc')](),controller['update']);router[_0xf0ad('0x16')](_0xf0ad('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8e1592d..467fb93 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 _0x19fb=['lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x25790f,_0x39d0be){var _0x988775=function(_0x27cdde){while(--_0x27cdde){_0x25790f['push'](_0x25790f['shift']());}};_0x988775(++_0x39d0be);}(_0x19fb,0x180));var _0xb19f=function(_0x2962b7,_0x5a3544){_0x2962b7=_0x2962b7-0x0;var _0x9cdeae=_0x19fb[_0x2962b7];return _0x9cdeae;};'use strict';var _=require(_0xb19f('0x0'));var Sequelize=require('sequelize');module[_0xb19f('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xb19f('0x2')]},'street':{'type':Sequelize[_0xb19f('0x2')]},'postalCode':{'type':Sequelize[_0xb19f('0x2')]},'city':{'type':Sequelize[_0xb19f('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xb19f('0x2')]},'description':{'type':Sequelize[_0xb19f('0x3')]},'phone':{'type':Sequelize[_0xb19f('0x2')]},'mobile':{'type':Sequelize[_0xb19f('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb19f('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xb19f('0x2')]},'fb_data':{'type':Sequelize[_0xb19f('0x2')]},'twitter':{'type':Sequelize[_0xb19f('0x2')]},'skype':{'type':Sequelize[_0xb19f('0x2')]},'teams':{'type':Sequelize[_0xb19f('0x2')]},'viber':{'type':Sequelize[_0xb19f('0x2')]},'line':{'type':Sequelize[_0xb19f('0x2')]},'wechat':{'type':Sequelize[_0xb19f('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xb19f('0x4')]},'priority':{'type':Sequelize[_0xb19f('0x4')](0x2)[_0xb19f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb19f('0x6')],'defaultValue':Sequelize[_0xb19f('0x7')]}}; \ No newline at end of file +var _0xdb55=['NOW','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x50e7e0,_0x5affce){var _0x1a0307=function(_0x32d343){while(--_0x32d343){_0x50e7e0['push'](_0x50e7e0['shift']());}};_0x1a0307(++_0x5affce);}(_0xdb55,0x89));var _0x5db5=function(_0x4354f2,_0x3137e9){_0x4354f2=_0x4354f2-0x0;var _0xa46482=_0xdb55[_0x4354f2];return _0xa46482;};'use strict';var _=require('lodash');var Sequelize=require(_0x5db5('0x0'));module[_0x5db5('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x5db5('0x2')]},'street':{'type':Sequelize[_0x5db5('0x2')]},'postalCode':{'type':Sequelize[_0x5db5('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x5db5('0x2')]},'dateOfBirth':{'type':Sequelize[_0x5db5('0x2')]},'description':{'type':Sequelize[_0x5db5('0x3')]},'phone':{'type':Sequelize[_0x5db5('0x2')]},'mobile':{'type':Sequelize[_0x5db5('0x2')]},'fax':{'type':Sequelize[_0x5db5('0x2')]},'email':{'type':Sequelize[_0x5db5('0x2')]},'url':{'type':Sequelize[_0x5db5('0x2')]},'facebook':{'type':Sequelize[_0x5db5('0x2')]},'fb_data':{'type':Sequelize[_0x5db5('0x2')]},'twitter':{'type':Sequelize[_0x5db5('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x5db5('0x2')]},'viber':{'type':Sequelize[_0x5db5('0x2')]},'line':{'type':Sequelize[_0x5db5('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x5db5('0x2')]},'UserId':{'type':Sequelize[_0x5db5('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x5db5('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5db5('0x6')],'defaultValue':Sequelize[_0x5db5('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0c7bf6e..53eef5b 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 _0x60c9=['count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','CmContact','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','fieldType','type','query','filters','model','attributes','fields','nolimit','order','sort','where','pick','select','field','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','sqlOperator','conditions','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','buildExpression','text','start','hasOwnProperty','filter','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','having','resolve','some','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','c.firstName','c.lastName','c.mobile','c.fax','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','rows','catch','find','params','describe','tags','columnName','displayName','findAll','custom','body','get','mergeWith','isArray','join','info','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','duplicates','$or','spread','show','$and','omit','format','pickBy','table','setFields','id\x20=\x20?','values','phone','intersection','merge','options','getTags','setTags','ids','rawAttributes','CmHopper','includeAll','include','getHopperHistories','getHopperFinals','CmHopperFinal','ContactId','uploadCsv','No\x20ListId\x20specified','binding_keys','socket_timestamp','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','binding_values','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','path','parse','meta','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./cmContact.socket','sendStatus','status','json'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x60c9,0xcd));var _0x960c=function(_0x2b3930,_0x10623c){_0x2b3930=_0x2b3930-0x0;var _0x34ba15=_0x60c9[_0x2b3930];return _0x34ba15;};'use strict';var pdf=require(_0x960c('0x0'));var emlformat=require(_0x960c('0x1'));var rimraf=require(_0x960c('0x2'));var zipdir=require(_0x960c('0x3'));var jsonpatch=require(_0x960c('0x4'));var rp=require(_0x960c('0x5'));var moment=require(_0x960c('0x6'));var BPromise=require(_0x960c('0x7'));var Mustache=require(_0x960c('0x8'));var util=require(_0x960c('0x9'));var path=require('path');var sox=require(_0x960c('0xa'));var csv=require(_0x960c('0xb'));var ejs=require(_0x960c('0xc'));var fs=require('fs');var _=require(_0x960c('0xd'));var squel=require(_0x960c('0xe'));var crypto=require(_0x960c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x960c('0x10'));var toCsv=require(_0x960c('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x960c('0x11'));var authService=require(_0x960c('0x12'));var qs=require(_0x960c('0x13'));var as=require(_0x960c('0x14'));var hardwareService=require(_0x960c('0x15'));var logger=require(_0x960c('0x16'))(_0x960c('0x17'));var utils=require('../../config/utils');var config=require(_0x960c('0x18'));var db=require(_0x960c('0x19'))['db'];config[_0x960c('0x1a')]=_[_0x960c('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x960c('0x1a')]));require(_0x960c('0x1c'))['register'](socket);function respondWithStatusCode(_0x2dfba1,_0xdbe82f){_0xdbe82f=_0xdbe82f||0xcc;return function(_0x131962){if(_0x131962){return _0x2dfba1[_0x960c('0x1d')](_0xdbe82f);}return _0x2dfba1[_0x960c('0x1e')](_0xdbe82f)['end']();};}function respondWithResult(_0x448d1c,_0x315351){_0x315351=_0x315351||0xc8;return function(_0x1818ae){if(_0x1818ae){return _0x448d1c['status'](_0x315351)[_0x960c('0x1f')](_0x1818ae);}};}function respondWithFilteredResult(_0x2a2338,_0x3b29bb){return function(_0x46db3b){if(_0x46db3b){var _0x1fdf79=_0x46db3b[_0x960c('0x20')],_0x52ec96=_0x3b29bb[_0x960c('0x21')],_0x2fe523=_0x3b29bb['offset']+_0x3b29bb[_0x960c('0x22')],_0x1e721e;if(_0x2fe523>=_0x1fdf79){_0x2fe523=_0x1fdf79;_0x1e721e=0xc8;}else{_0x1e721e=0xce;}_0x2a2338[_0x960c('0x1e')](_0x1e721e);return _0x2a2338[_0x960c('0x23')](_0x960c('0x24'),_0x52ec96+'-'+_0x2fe523+'/'+_0x1fdf79)[_0x960c('0x1f')](_0x46db3b);}return null;};}function patchUpdates(_0x3f3306){return function(_0x57ca24){try{jsonpatch['apply'](_0x57ca24,_0x3f3306,!![]);}catch(_0x464a34){return BPromise[_0x960c('0x25')](_0x464a34);}return _0x57ca24[_0x960c('0x26')]();};}function saveUpdates(_0x3b4ee9,_0x32fdde){return function(_0x1b4635){if(_0x1b4635){return _0x1b4635[_0x960c('0x27')](_0x3b4ee9)[_0x960c('0x28')](function(_0x179351){return _0x179351;});}return null;};}function removeEntity(_0x407dd8,_0x5e44f6){return function(_0x31b056){if(_0x31b056){return _0x31b056[_0x960c('0x29')]()[_0x960c('0x28')](function(){_0x407dd8[_0x960c('0x1e')](0xcc)[_0x960c('0x2a')]();});}};}function handleEntityNotFound(_0x13d701,_0x127a92){return function(_0x59112b){if(!_0x59112b){_0x13d701[_0x960c('0x1d')](0x194);}return _0x59112b;};}function handleError(_0x1ceb5e,_0x1a670e){_0x1a670e=_0x1a670e||0x1f4;return function(_0x3da24d){logger[_0x960c('0x2b')](_0x3da24d[_0x960c('0x2c')]);if(_0x3da24d[_0x960c('0x2d')]){delete _0x3da24d[_0x960c('0x2d')];}_0x1ceb5e[_0x960c('0x1e')](_0x1a670e)[_0x960c('0x2e')](_0x3da24d);};}exports['index']=function(_0x3f2df1,_0x13b7ef){var _0x5dbb96={},_0xdc1610={},_0x4daa5a={'count':0x0,'rows':[]};return db[_0x960c('0x2f')]['describe']()[_0x960c('0x28')](function(_0x213f81){var _0x7367ef=[];for(var _0xb28fb5=0x0;_0xb28fb50x1){_0x461069['or'](_0x960c('0x6c'),qs[_0x960c('0x6d')](_0x2a1073),null);}else{if(qs[_0x960c('0x6e')](_0x2a1073)){_0x461069['or'](_0x960c('0x6f'),_0x2a1073+'%');_0x461069['or'](_0x960c('0x70'),_0x2a1073+'%');_0x461069['or'](_0x960c('0x71'),_0x2a1073+'%');_0x461069['or'](_0x960c('0x72'),_0x2a1073+'%');}else if(qs['isEmail'](_0x2a1073)){_0x461069['or'](_0x960c('0x73'),_0x2a1073+'%');}else{_0x461069['or'](_0x960c('0x74'),'%'+_0x2a1073+'%');_0x461069['or'](_0x960c('0x75'),'%'+_0x2a1073+'%');_0x461069['or'](_0x960c('0x73'),'%'+_0x2a1073+'%');}}}}_0x68ec15[_0x960c('0x43')](_0x461069);_0x68ec15[_0x960c('0x76')](_0x960c('0x77'));var _0x190193={'type':db['Sequelize'][_0x960c('0x78')][_0x960c('0x79')],'raw':!![]};var _0x52399d=_0x68ec15['clone']()[_0x960c('0x46')](_0x960c('0x77'));if(_0x5dbb96['order']){_0x5dbb96[_0x960c('0x41')][_0x960c('0x58')](function(_0x386584){_0x68ec15[_0x960c('0x41')]('c.'+_0x386584[0x0],_0x386584[0x1]==='DESC'?![]:!![]);});}if(!_[_0x960c('0x65')](_0x3df8e8)){_0x68ec15[_0x960c('0x7a')](_0x42d92f);_0x52399d['where']('t.id\x20IN\x20?',_0x3df8e8);}BPromise[_0x960c('0x7b')]()[_0x960c('0x28')](function(){if(_0x18721a&&!_[_0x960c('0x7c')](_0x18721a[_0x960c('0x54')],[_0x960c('0x46'),'User'])){return _0x3f2df1['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x960c('0x28')](function(_0x4601de){if(_['isEmpty'](_0x4601de)){_0x52399d[_0x960c('0x43')](_0x960c('0x7d'));_0x68ec15[_0x960c('0x43')](_0x960c('0x7d'));}else{_0x52399d[_0x960c('0x43')](_0x960c('0x67'),_['map'](_0x4601de,'id'));_0x68ec15['where'](_0x960c('0x67'),_[_0x960c('0x57')](_0x4601de,'id'));}});}else{return;}})[_0x960c('0x28')](function(){db[_0x960c('0x7e')]['query'](_0x52399d[_0x960c('0x7f')](),_0x190193)[_0x960c('0x28')](function(_0x323b2a){_0x4daa5a[_0x960c('0x20')]=_0x323b2a[_0x960c('0x31')];if(_0x4daa5a[_0x960c('0x20')]===0x0)return[];return db['sequelize'][_0x960c('0x3b')](_0x426e00[_0x960c('0x7f')](),_0x190193);})['then'](function(_0x47adc8){_0x2d48fb=_[_0x960c('0x80')](_0x47adc8,'id');_0x190193=_['merge'](_0x190193,{'model':db[_0x960c('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f2df1['query'][_0x960c('0x3f')]){_0x5dbb96[_0x960c('0x3e')][_0x960c('0x58')](function(_0xde40b4){_0x68ec15[_0x960c('0x46')]('c.'+_0xde40b4);});}else{_0x68ec15[_0x960c('0x46')]('c.id');_0x68ec15[_0x960c('0x46')](_0x960c('0x81'));_0x68ec15['field'](_0x960c('0x82'));_0x68ec15[_0x960c('0x46')]('c.phone');_0x68ec15[_0x960c('0x46')](_0x960c('0x83'));_0x68ec15[_0x960c('0x46')](_0x960c('0x84'));_0x68ec15[_0x960c('0x46')]('c.email');_0x68ec15[_0x960c('0x46')](_0x960c('0x85'));_0x68ec15[_0x960c('0x46')](_0x960c('0x86'));_0x68ec15[_0x960c('0x46')](_0x960c('0x87'),_0x960c('0x88'));}if(_0x5dbb96[_0x960c('0x22')])_0x68ec15[_0x960c('0x22')](_0x5dbb96[_0x960c('0x22')]);if(_0x5dbb96[_0x960c('0x21')])_0x68ec15['offset'](_0x5dbb96['offset']);return db[_0x960c('0x7e')][_0x960c('0x3b')](_0x68ec15[_0x960c('0x7f')](),_0x190193);})['then'](function(_0x3c311b){_0x3c311b['forEach'](function(_0x48e48b){if(_0x48e48b['TagIds']){_0x48e48b[_0x960c('0x89')]=[];_0x48e48b['TagIds'][_0x960c('0x8a')](',')['forEach'](function(_0x123e0c){_0x48e48b[_0x960c('0x89')][_0x960c('0x33')](_0x2d48fb[_0x123e0c]);});}delete _0x48e48b['TagIds'];});_0x4daa5a[_0x960c('0x8b')]=_0x3c311b;return _0x4daa5a;})[_0x960c('0x28')](respondWithFilteredResult(_0x13b7ef,_0x5dbb96));});})[_0x960c('0x8c')](handleError(_0x13b7ef,null));};exports['destroy']=function(_0x5184ab,_0x1b5455){return db[_0x960c('0x2f')][_0x960c('0x8d')]({'where':{'id':_0x5184ab[_0x960c('0x8e')]['id']}})[_0x960c('0x28')](handleEntityNotFound(_0x1b5455,null))[_0x960c('0x28')](removeEntity(_0x1b5455,null))[_0x960c('0x8c')](handleError(_0x1b5455,null));};exports[_0x960c('0x8f')]=function(_0x3d39a9,_0xf66bfb){return db[_0x960c('0x2f')]['describe']()[_0x960c('0x28')](function(_0x481f98){delete _0x481f98[_0x960c('0x90')];for(var _0x157ea6=0x0;_0x157ea6=_0x5bb5b6){_0x14c85e=_0x5bb5b6;_0x21bd4e=0xc8;}else{_0x21bd4e=0xce;}_0x3184f6[_0x1ca8('0x29')](_0x21bd4e);return _0x3184f6[_0x1ca8('0x2a')](_0x1ca8('0x2b'),_0x2f80d8+'-'+_0x14c85e+'/'+_0x5bb5b6)[_0x1ca8('0x25')](_0x3159ac);}return null;};}function patchUpdates(_0x3043e4){return function(_0x22cfda){try{jsonpatch[_0x1ca8('0x2c')](_0x22cfda,_0x3043e4,!![]);}catch(_0x27f2df){return BPromise[_0x1ca8('0x2d')](_0x27f2df);}return _0x22cfda['save']();};}function saveUpdates(_0x400a19,_0x42f6dd){return function(_0x399082){if(_0x399082){return _0x399082['update'](_0x400a19)['then'](function(_0x39ff0d){return _0x39ff0d;});}return null;};}function removeEntity(_0x395f7e,_0x54f601){return function(_0x193226){if(_0x193226){return _0x193226['destroy']()[_0x1ca8('0x2e')](function(){_0x395f7e[_0x1ca8('0x29')](0xcc)[_0x1ca8('0x24')]();});}};}function handleEntityNotFound(_0x50cde2,_0x4b9c25){return function(_0x4c23df){if(!_0x4c23df){_0x50cde2[_0x1ca8('0x23')](0x194);}return _0x4c23df;};}function handleError(_0x49f0c7,_0x180cb4){_0x180cb4=_0x180cb4||0x1f4;return function(_0x1d81a4){logger[_0x1ca8('0x2f')](_0x1d81a4['stack']);if(_0x1d81a4[_0x1ca8('0x30')]){delete _0x1d81a4[_0x1ca8('0x30')];}_0x49f0c7[_0x1ca8('0x29')](_0x180cb4)[_0x1ca8('0x31')](_0x1d81a4);};}exports[_0x1ca8('0x32')]=function(_0x4576f8,_0x310a1e){var _0x450ad3={},_0x2f00b1={},_0x44d4f8={'count':0x0,'rows':[]};return db[_0x1ca8('0x33')][_0x1ca8('0x34')]()[_0x1ca8('0x2e')](function(_0x5a0e40){var _0x2a5ad7=[];for(var _0x88456=0x0;_0x884560x1){_0x5987ae['or'](_0x1ca8('0x72'),qs[_0x1ca8('0x73')](_0xdc5de6),null);}else{if(qs[_0x1ca8('0x74')](_0xdc5de6)){_0x5987ae['or']('c.id\x20LIKE\x20?',_0xdc5de6+'%');_0x5987ae['or'](_0x1ca8('0x75'),_0xdc5de6+'%');_0x5987ae['or'](_0x1ca8('0x76'),_0xdc5de6+'%');_0x5987ae['or'](_0x1ca8('0x77'),_0xdc5de6+'%');}else if(qs[_0x1ca8('0x78')](_0xdc5de6)){_0x5987ae['or']('c.email\x20LIKE\x20?',_0xdc5de6+'%');}else{_0x5987ae['or'](_0x1ca8('0x79'),'%'+_0xdc5de6+'%');_0x5987ae['or'](_0x1ca8('0x7a'),'%'+_0xdc5de6+'%');_0x5987ae['or'](_0x1ca8('0x7b'),'%'+_0xdc5de6+'%');}}}}_0x50947b['where'](_0x5987ae);_0x50947b[_0x1ca8('0x7c')](_0x1ca8('0x7d'));var _0x2e067b={'type':db[_0x1ca8('0x7e')][_0x1ca8('0x7f')][_0x1ca8('0x80')],'raw':!![]};var _0xff819a=_0x50947b[_0x1ca8('0x81')]()[_0x1ca8('0x49')]('c.id');if(_0x450ad3[_0x1ca8('0x45')]){_0x450ad3['order'][_0x1ca8('0x5a')](function(_0x1a72d1){_0x50947b['order']('c.'+_0x1a72d1[0x0],_0x1a72d1[0x1]===_0x1ca8('0x82')?![]:!![]);});}if(!_['isEmpty'](_0x2526ad)){_0x50947b[_0x1ca8('0x83')](_0x44bd99);_0xff819a[_0x1ca8('0x6a')](_0x1ca8('0x84'),_0x2526ad);}BPromise['resolve']()[_0x1ca8('0x2e')](function(){if(_0xfebf2f&&!_['some'](_0xfebf2f['conditions'],[_0x1ca8('0x49'),'User'])){return _0x4576f8['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x1ca8('0x2e')](function(_0x4c857c){if(_['isEmpty'](_0x4c857c)){_0xff819a[_0x1ca8('0x6a')](_0x1ca8('0x85'));_0x50947b[_0x1ca8('0x6a')](_0x1ca8('0x85'));}else{_0xff819a[_0x1ca8('0x6a')](_0x1ca8('0x86'),_[_0x1ca8('0x59')](_0x4c857c,'id'));_0x50947b[_0x1ca8('0x6a')](_0x1ca8('0x86'),_[_0x1ca8('0x59')](_0x4c857c,'id'));}});}else{return;}})[_0x1ca8('0x2e')](function(){db[_0x1ca8('0x87')][_0x1ca8('0x3e')](_0xff819a['toString'](),_0x2e067b)['then'](function(_0x548fd6){_0x44d4f8[_0x1ca8('0x26')]=_0x548fd6[_0x1ca8('0x3a')];if(_0x44d4f8[_0x1ca8('0x26')]===0x0)return[];return db[_0x1ca8('0x87')][_0x1ca8('0x3e')](_0x43f215[_0x1ca8('0x88')](),_0x2e067b);})[_0x1ca8('0x2e')](function(_0x31e883){_0x11e138=_[_0x1ca8('0x89')](_0x31e883,'id');_0x2e067b=_['merge'](_0x2e067b,{'model':db[_0x1ca8('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4576f8[_0x1ca8('0x3e')]['fields']){_0x450ad3[_0x1ca8('0x42')][_0x1ca8('0x5a')](function(_0x198ae3){_0x50947b[_0x1ca8('0x49')]('c.'+_0x198ae3);});}else{_0x50947b[_0x1ca8('0x49')](_0x1ca8('0x7d'));_0x50947b[_0x1ca8('0x49')](_0x1ca8('0x8a'));_0x50947b[_0x1ca8('0x49')](_0x1ca8('0x8b'));_0x50947b[_0x1ca8('0x49')](_0x1ca8('0x8c'));_0x50947b[_0x1ca8('0x49')](_0x1ca8('0x8d'));_0x50947b[_0x1ca8('0x49')]('c.fax');_0x50947b[_0x1ca8('0x49')]('c.email');_0x50947b[_0x1ca8('0x49')](_0x1ca8('0x8e'));_0x50947b[_0x1ca8('0x49')](_0x1ca8('0x8f'));_0x50947b[_0x1ca8('0x49')](_0x1ca8('0x90'),'TagIds');}if(_0x450ad3['limit'])_0x50947b['limit'](_0x450ad3['limit']);if(_0x450ad3[_0x1ca8('0x27')])_0x50947b['offset'](_0x450ad3[_0x1ca8('0x27')]);return db[_0x1ca8('0x87')]['query'](_0x50947b[_0x1ca8('0x88')](),_0x2e067b);})['then'](function(_0x11171d){_0x11171d['forEach'](function(_0x1172b2){if(_0x1172b2[_0x1ca8('0x91')]){_0x1172b2[_0x1ca8('0x92')]=[];_0x1172b2[_0x1ca8('0x91')][_0x1ca8('0x58')](',')[_0x1ca8('0x5a')](function(_0x4858da){_0x1172b2[_0x1ca8('0x92')][_0x1ca8('0x67')](_0x11e138[_0x4858da]);});}delete _0x1172b2['TagIds'];});_0x44d4f8[_0x1ca8('0x93')]=_0x11171d;return _0x44d4f8;})['then'](respondWithFilteredResult(_0x310a1e,_0x450ad3));});})[_0x1ca8('0x94')](handleError(_0x310a1e,null));};exports[_0x1ca8('0x95')]=function(_0x46250e,_0xf46c5b){return db['CmContact'][_0x1ca8('0x55')]({'where':{'id':_0x46250e[_0x1ca8('0x96')]['id']}})[_0x1ca8('0x2e')](handleEntityNotFound(_0xf46c5b,null))[_0x1ca8('0x2e')](removeEntity(_0xf46c5b,null))[_0x1ca8('0x94')](handleError(_0xf46c5b,null));};exports[_0x1ca8('0x34')]=function(_0x46bfbe,_0x1883aa){return db[_0x1ca8('0x33')]['describe']()[_0x1ca8('0x2e')](function(_0x60da80){delete _0x60da80[_0x1ca8('0x97')];for(var _0x3763fe=0x0;_0x3763fe{}\s\\|]/g,'-');_0x506424(null,util[_0xa24c('0x23')](_0xa24c('0x24'),path['basename'](_0x48a768[_0xa24c('0x21')],path['extname'](_0x48a768[_0xa24c('0x21')])),Date[_0xa24c('0x25')](),path['extname'](_0x48a768[_0xa24c('0x21')])));}})});router[_0xa24c('0x18')](_0xa24c('0x26'),upload[_0xa24c('0x27')](_0xa24c('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xa24c('0x1d')]({'destination':function(_0x5cc9cb,_0x2365f9,_0x3951ae){_0x3951ae(null,path[_0xa24c('0x1e')](config['root'],_0xa24c('0x20')));},'filename':function(_0x31c4d9,_0x14fd5a,_0x314121){_0x14fd5a[_0xa24c('0x21')]=_0x14fd5a[_0xa24c('0x21')][_0xa24c('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x314121(null,util['format'](_0xa24c('0x24'),path[_0xa24c('0x29')](_0x14fd5a[_0xa24c('0x21')],path[_0xa24c('0x2a')](_0x14fd5a['originalname'])),Date[_0xa24c('0x25')](),path[_0xa24c('0x2a')](_0x14fd5a[_0xa24c('0x21')])));}})});router['post'](_0xa24c('0x2b'),upload[_0xa24c('0x27')](_0xa24c('0x28')),controller['upload']);router[_0xa24c('0x18')]('/upload/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0x2c')]);router[_0xa24c('0x2d')]('/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0x2e')]);router[_0xa24c('0x2f')]('/:id',auth[_0xa24c('0x9')](),controller['destroy']);module[_0xa24c('0x30')]=router; \ No newline at end of file +var _0xae24=['path','express','Router','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','/create_many','bulkCreate','setTags','diskStorage','join','root','originalname','format','extname','now','single','file','uploadCsv','server/files/tmp','replace','%s-%s%s','upload','/upload/:id','import','put','update','delete','destroy','exports','multer'];(function(_0x1510c5,_0xde9022){var _0x433a86=function(_0x114896){while(--_0x114896){_0x1510c5['push'](_0x1510c5['shift']());}};_0x433a86(++_0xde9022);}(_0xae24,0x182));var _0x4ae2=function(_0x2450d0,_0x65f909){_0x2450d0=_0x2450d0-0x0;var _0x28568e=_0xae24[_0x2450d0];return _0x28568e;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ae2('0x4'));var controller=require('./cmContact.controller');router[_0x4ae2('0x5')]('/',auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x7')]);router[_0x4ae2('0x5')](_0x4ae2('0x8'),auth[_0x4ae2('0x6')](),controller['describe']);router['get'](_0x4ae2('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x4ae2('0x5')](_0x4ae2('0xa'),auth['isAuthenticated'](),controller[_0x4ae2('0xb')]);router[_0x4ae2('0x5')](_0x4ae2('0xc'),auth[_0x4ae2('0x6')](),controller['getHoppers']);router[_0x4ae2('0x5')](_0x4ae2('0xd'),auth[_0x4ae2('0x6')](),controller['getHopperHistories']);router[_0x4ae2('0x5')](_0x4ae2('0xe'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0xf')]);router[_0x4ae2('0x5')](_0x4ae2('0x10'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x11')]);router[_0x4ae2('0x12')]('/merge',auth['isAuthenticated'](),controller['merge']);router[_0x4ae2('0x12')]('/',auth[_0x4ae2('0x6')](),controller['create']);router[_0x4ae2('0x12')](_0x4ae2('0x13'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x14')]);router[_0x4ae2('0x12')](_0x4ae2('0xa'),auth[_0x4ae2('0x6')](),controller[_0x4ae2('0x15')]);var upload=multer({'storage':multer[_0x4ae2('0x16')]({'destination':function(_0x18936a,_0x4d5071,_0x4a97af){_0x4a97af(null,path[_0x4ae2('0x17')](config[_0x4ae2('0x18')],'server/files/tmp'));},'filename':function(_0x45c1bf,_0x343db1,_0xccb3b){_0x343db1[_0x4ae2('0x19')]=_0x343db1[_0x4ae2('0x19')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\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 diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index e9263a7..d9263c6 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 _0x67d8=['select','parse','values','isArray','setDataValue','BOOLEAN','lodash','exports','VIRTUAL','getDataValue','alias','STRING','TEXT'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x67d8,0x124));var _0x867d=function(_0x57c927,_0x26795b){_0x57c927=_0x57c927-0x0;var _0x2a1e04=_0x67d8[_0x57c927];return _0x2a1e04;};'use strict';var Sequelize=require('sequelize');var _=require(_0x867d('0x0'));module[_0x867d('0x1')]={'name':{'type':Sequelize[_0x867d('0x2')],'get':function(_0x5463c0){return this[_0x867d('0x3')](_0x867d('0x4'));}},'alias':{'type':Sequelize[_0x867d('0x5')],'allowNull':![],'set':function(_0x5b7881){this['setDataValue'](_0x867d('0x4'),_0x5b7881?_0x5b7881:this[_0x867d('0x3')]('name'));}},'type':{'type':Sequelize[_0x867d('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x867d('0x6')]('long'),'get':function(){if(this[_0x867d('0x3')]('type')===_0x867d('0x7')){return JSON[_0x867d('0x8')](this['getDataValue'](_0x867d('0x9')));}else{return this[_0x867d('0x3')](_0x867d('0x9'));}},'set':function(_0x1f13d0){if(Array[_0x867d('0xa')](_0x1f13d0)){this[_0x867d('0xb')](_0x867d('0x9'),JSON['stringify'](_0x1f13d0));}else{this['setDataValue'](_0x867d('0x9'),_0x1f13d0);}}},'required':{'type':Sequelize[_0x867d('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x2012=['stringify','BOOLEAN','sequelize','VIRTUAL','alias','STRING','setDataValue','getDataValue','name','type','select','values','isArray'];(function(_0x2546c5,_0x9d3feb){var _0x538858=function(_0x1dc286){while(--_0x1dc286){_0x2546c5['push'](_0x2546c5['shift']());}};_0x538858(++_0x9d3feb);}(_0x2012,0xdf));var _0x2201=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x2012[_0x19ac6e];return _0x1cdcf3;};'use strict';var Sequelize=require(_0x2201('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x2201('0x1')],'get':function(_0x5555fe){return this['getDataValue'](_0x2201('0x2'));}},'alias':{'type':Sequelize[_0x2201('0x3')],'allowNull':![],'set':function(_0x4bb78a){this[_0x2201('0x4')](_0x2201('0x2'),_0x4bb78a?_0x4bb78a:this[_0x2201('0x5')](_0x2201('0x6')));}},'type':{'type':Sequelize[_0x2201('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x2201('0x5')](_0x2201('0x7'))===_0x2201('0x8')){return JSON['parse'](this['getDataValue'](_0x2201('0x9')));}else{return this[_0x2201('0x5')]('values');}},'set':function(_0x2ac168){if(Array[_0x2201('0xa')](_0x2ac168)){this[_0x2201('0x4')](_0x2201('0x9'),JSON[_0x2201('0xb')](_0x2ac168));}else{this[_0x2201('0x4')](_0x2201('0x9'),_0x2ac168);}}},'required':{'type':Sequelize[_0x2201('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0a48fab..a0a616e 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 _0xf5c4=['body','find','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','name','map','CmCustomField','fieldName','type','differenceBy','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','merge'];(function(_0x3b8ee6,_0x52ebaa){var _0xf4daed=function(_0x15de31){while(--_0x15de31){_0x3b8ee6['push'](_0x3b8ee6['shift']());}};_0xf4daed(++_0x52ebaa);}(_0xf5c4,0x1c4));var _0x4f5c=function(_0x2bd875,_0x56e6d4){_0x2bd875=_0x2bd875-0x0;var _0x593bcc=_0xf5c4[_0x2bd875];return _0x593bcc;};'use strict';var pdf=require(_0x4f5c('0x0'));var emlformat=require(_0x4f5c('0x1'));var rimraf=require(_0x4f5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f5c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4f5c('0x4'));var Mustache=require(_0x4f5c('0x5'));var util=require(_0x4f5c('0x6'));var path=require(_0x4f5c('0x7'));var sox=require(_0x4f5c('0x8'));var csv=require('to-csv');var ejs=require(_0x4f5c('0x9'));var fs=require('fs');var _=require(_0x4f5c('0xa'));var squel=require('squel');var crypto=require(_0x4f5c('0xb'));var jsforce=require(_0x4f5c('0xc'));var deskjs=require(_0x4f5c('0xd'));var toCsv=require(_0x4f5c('0xe'));var querystring=require(_0x4f5c('0xf'));var Papa=require('papaparse');var Redis=require(_0x4f5c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f5c('0x11'));var as=require(_0x4f5c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f5c('0x13'))(_0x4f5c('0x14'));var utils=require(_0x4f5c('0x15'));var config=require(_0x4f5c('0x16'));var db=require(_0x4f5c('0x17'))['db'];function respondWithStatusCode(_0x35fc6c,_0xb9949){_0xb9949=_0xb9949||0xcc;return function(_0x2621e3){if(_0x2621e3){return _0x35fc6c[_0x4f5c('0x18')](_0xb9949);}return _0x35fc6c[_0x4f5c('0x19')](_0xb9949)[_0x4f5c('0x1a')]();};}function respondWithResult(_0x40b5ea,_0x3fb588){_0x3fb588=_0x3fb588||0xc8;return function(_0x3009e0){if(_0x3009e0){return _0x40b5ea[_0x4f5c('0x19')](_0x3fb588)[_0x4f5c('0x1b')](_0x3009e0);}};}function respondWithFilteredResult(_0x37cc42,_0x4157f2){return function(_0x3d91dc){if(_0x3d91dc){var _0x469e10=_0x3d91dc[_0x4f5c('0x1c')],_0x3294a8=_0x4157f2[_0x4f5c('0x1d')],_0x4b26f4=_0x4157f2[_0x4f5c('0x1d')]+_0x4157f2['limit'],_0x9d19ce;if(_0x4b26f4>=_0x469e10){_0x4b26f4=_0x469e10;_0x9d19ce=0xc8;}else{_0x9d19ce=0xce;}_0x37cc42[_0x4f5c('0x19')](_0x9d19ce);return _0x37cc42['set'](_0x4f5c('0x1e'),_0x3294a8+'-'+_0x4b26f4+'/'+_0x469e10)[_0x4f5c('0x1b')](_0x3d91dc);}return null;};}function patchUpdates(_0x56e1ef){return function(_0x2f108f){try{jsonpatch[_0x4f5c('0x1f')](_0x2f108f,_0x56e1ef,!![]);}catch(_0x24343e){return BPromise[_0x4f5c('0x20')](_0x24343e);}return _0x2f108f[_0x4f5c('0x21')]();};}function saveUpdates(_0x584386,_0x42f375){return function(_0x1bf3e5){if(_0x1bf3e5){return _0x1bf3e5[_0x4f5c('0x22')](_0x584386)[_0x4f5c('0x23')](function(_0x4bfb00){return _0x4bfb00;});}return null;};}function removeEntity(_0x1b5bc0,_0x5b6b51){return function(_0x5f66bf){if(_0x5f66bf){return _0x5f66bf[_0x4f5c('0x24')]()[_0x4f5c('0x23')](function(){_0x1b5bc0[_0x4f5c('0x19')](0xcc)[_0x4f5c('0x1a')]();});}};}function handleEntityNotFound(_0x4b3b47,_0x4897e5){return function(_0x226d92){if(!_0x226d92){_0x4b3b47['sendStatus'](0x194);}return _0x226d92;};}function handleError(_0x38ae7e,_0x306e89){_0x306e89=_0x306e89||0x1f4;return function(_0x29603e){logger['error'](_0x29603e['stack']);if(_0x29603e[_0x4f5c('0x25')]){delete _0x29603e[_0x4f5c('0x25')];}_0x38ae7e[_0x4f5c('0x19')](_0x306e89)['send'](_0x29603e);};}exports['index']=function(_0x4931da,_0x12b3bc){var _0xb4206b={},_0x2ab552={},_0x328bfe={'count':0x0,'rows':[]};var _0x4af8a1=_[_0x4f5c('0x26')](db[_0x4f5c('0x27')]['rawAttributes'],function(_0x118550){return{'name':_0x118550[_0x4f5c('0x28')],'type':_0x118550[_0x4f5c('0x29')]['key']};});_0x2ab552['model']=_[_0x4f5c('0x2a')](_['map'](_0x4af8a1,_0x4f5c('0x25')),[_0x4f5c('0x25')]);_0x2ab552[_0x4f5c('0x2b')]=_[_0x4f5c('0x2c')](_0x4931da[_0x4f5c('0x2b')]);_0x2ab552['filters']=_[_0x4f5c('0x2d')](_0x2ab552['model'],_0x2ab552[_0x4f5c('0x2b')]);_0xb4206b[_0x4f5c('0x2e')]=_[_0x4f5c('0x2d')](_0x2ab552[_0x4f5c('0x2f')],qs['fields'](_0x4931da['query'][_0x4f5c('0x30')]));_0xb4206b[_0x4f5c('0x2e')]=_0xb4206b[_0x4f5c('0x2e')][_0x4f5c('0x31')]?_0xb4206b['attributes']:_0x2ab552[_0x4f5c('0x2f')];if(!_0x4931da[_0x4f5c('0x2b')][_0x4f5c('0x32')](_0x4f5c('0x33'))){_0xb4206b[_0x4f5c('0x34')]=qs[_0x4f5c('0x34')](_0x4931da[_0x4f5c('0x2b')]['limit']);_0xb4206b[_0x4f5c('0x1d')]=qs[_0x4f5c('0x1d')](_0x4931da['query'][_0x4f5c('0x1d')]);}_0xb4206b[_0x4f5c('0x35')]=qs[_0x4f5c('0x36')](_0x4931da[_0x4f5c('0x2b')]['sort']);_0xb4206b[_0x4f5c('0x37')]=qs[_0x4f5c('0x38')](_[_0x4f5c('0x39')](_0x4931da[_0x4f5c('0x2b')],_0x2ab552[_0x4f5c('0x38')]),_0x4af8a1);if(_0x4931da[_0x4f5c('0x2b')]['filter']){_0xb4206b[_0x4f5c('0x37')]=_['merge'](_0xb4206b[_0x4f5c('0x37')],{'$or':_[_0x4f5c('0x26')](_0x4af8a1,function(_0x3842af){if(_0x3842af[_0x4f5c('0x29')]!==_0x4f5c('0x3a')){var _0x5a8b5d={};_0x5a8b5d[_0x3842af[_0x4f5c('0x25')]]={'$like':'%'+_0x4931da['query'][_0x4f5c('0x3b')]+'%'};return _0x5a8b5d;}})});}_0xb4206b=_['merge']({},_0xb4206b,_0x4931da[_0x4f5c('0x3c')]);var _0x57f789={'where':_0xb4206b[_0x4f5c('0x37')]};return db[_0x4f5c('0x27')]['count'](_0x57f789)['then'](function(_0x42c5a6){_0x328bfe[_0x4f5c('0x1c')]=_0x42c5a6;if(_0x4931da[_0x4f5c('0x2b')]['includeAll']){_0xb4206b['include']=[{'all':!![]}];}return db[_0x4f5c('0x27')][_0x4f5c('0x3d')](_0xb4206b);})[_0x4f5c('0x23')](function(_0x2529c9){_0x328bfe[_0x4f5c('0x3e')]=_0x2529c9;return _0x328bfe;})[_0x4f5c('0x23')](respondWithFilteredResult(_0x12b3bc,_0xb4206b))[_0x4f5c('0x3f')](handleError(_0x12b3bc,null));};exports[_0x4f5c('0x40')]=function(_0x5dba55,_0x4ba872){var _0x4f09da={'raw':!![],'where':{'id':_0x5dba55[_0x4f5c('0x41')]['id']}},_0x12c280={};_0x12c280['model']=_[_0x4f5c('0x2c')](db[_0x4f5c('0x27')][_0x4f5c('0x42')]);_0x12c280[_0x4f5c('0x2b')]=_[_0x4f5c('0x2c')](_0x5dba55[_0x4f5c('0x2b')]);_0x12c280[_0x4f5c('0x38')]=_['intersection'](_0x12c280[_0x4f5c('0x2f')],_0x12c280[_0x4f5c('0x2b')]);_0x4f09da['attributes']=_[_0x4f5c('0x2d')](_0x12c280[_0x4f5c('0x2f')],qs['fields'](_0x5dba55['query'][_0x4f5c('0x30')]));_0x4f09da['attributes']=_0x4f09da[_0x4f5c('0x2e')]['length']?_0x4f09da[_0x4f5c('0x2e')]:_0x12c280[_0x4f5c('0x2f')];if(_0x5dba55['query'][_0x4f5c('0x43')]){_0x4f09da[_0x4f5c('0x44')]=[{'all':!![]}];}_0x4f09da=_[_0x4f5c('0x45')]({},_0x4f09da,_0x5dba55[_0x4f5c('0x3c')]);return db[_0x4f5c('0x27')]['find'](_0x4f09da)[_0x4f5c('0x23')](handleEntityNotFound(_0x4ba872,null))[_0x4f5c('0x23')](respondWithResult(_0x4ba872,null))[_0x4f5c('0x3f')](handleError(_0x4ba872,null));};exports['update']=function(_0x3e12b0,_0x419c6e){if(_0x3e12b0[_0x4f5c('0x46')]['id']){delete _0x3e12b0[_0x4f5c('0x46')]['id'];}return db[_0x4f5c('0x27')][_0x4f5c('0x47')]({'where':{'id':_0x3e12b0['params']['id']}})[_0x4f5c('0x23')](handleEntityNotFound(_0x419c6e,null))['then'](saveUpdates(_0x3e12b0[_0x4f5c('0x46')],null))['then'](respondWithResult(_0x419c6e,null))[_0x4f5c('0x3f')](handleError(_0x419c6e,null));};exports[_0x4f5c('0x24')]=function(_0x107abf,_0x35e774){return db[_0x4f5c('0x27')][_0x4f5c('0x47')]({'where':{'id':_0x107abf['params']['id']}})[_0x4f5c('0x23')](handleEntityNotFound(_0x35e774,null))[_0x4f5c('0x23')](removeEntity(_0x35e774,null))[_0x4f5c('0x3f')](handleError(_0x35e774,null));};exports[_0x4f5c('0x48')]=function(_0x28abff,_0x3dfc38){var _0x3aa826;return db[_0x4f5c('0x49')]['transaction'](function(_0x48a346){return db[_0x4f5c('0x27')][_0x4f5c('0x48')](_0x28abff[_0x4f5c('0x46')],{'transaction':_0x48a346})[_0x4f5c('0x23')](function(_0x24861f){_0x3aa826=_0x24861f;var _0x11dcc1={'type':db[_0x4f5c('0x4a')][_0x4f5c('0x4b')],'transaction':_0x48a346};switch(_0x28abff[_0x4f5c('0x46')][_0x4f5c('0x29')]){case _0x4f5c('0x4c'):_0x11dcc1['type']=db[_0x4f5c('0x4a')][_0x4f5c('0x4b')];break;case _0x4f5c('0x4d'):_0x11dcc1['type']=db[_0x4f5c('0x4a')][_0x4f5c('0x4e')];break;case _0x4f5c('0x4f'):_0x11dcc1[_0x4f5c('0x29')]=db[_0x4f5c('0x4a')][_0x4f5c('0x50')];_0x11dcc1[_0x4f5c('0x51')]=![];break;default:}return db[_0x4f5c('0x49')][_0x4f5c('0x52')][_0x4f5c('0x53')](_0x4f5c('0x54'),util[_0x4f5c('0x55')](_0x4f5c('0x56'),_0x3aa826['id']),_0x11dcc1);})[_0x4f5c('0x23')](function(){return _0x3aa826;});})[_0x4f5c('0x23')](respondWithResult(_0x3dfc38,0xc9))[_0x4f5c('0x3f')](handleError(_0x3dfc38,null));}; \ No newline at end of file +var _0xa363=['count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','index','CmCustomField','fieldName','key','model','differenceBy','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','keys','find','body','destroy','create','sequelize','transaction','TEXT','type','text','Sequelize','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json'];(function(_0x72ca57,_0x16106b){var _0x10af80=function(_0x1267b1){while(--_0x1267b1){_0x72ca57['push'](_0x72ca57['shift']());}};_0x10af80(++_0x16106b);}(_0xa363,0x92));var _0x3a36=function(_0x2869fc,_0x219d71){_0x2869fc=_0x2869fc-0x0;var _0x233d89=_0xa363[_0x2869fc];return _0x233d89;};'use strict';var pdf=require(_0x3a36('0x0'));var emlformat=require(_0x3a36('0x1'));var rimraf=require(_0x3a36('0x2'));var zipdir=require(_0x3a36('0x3'));var jsonpatch=require(_0x3a36('0x4'));var rp=require(_0x3a36('0x5'));var moment=require(_0x3a36('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3a36('0x7'));var util=require(_0x3a36('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3a36('0x9'));var ejs=require(_0x3a36('0xa'));var fs=require('fs');var _=require(_0x3a36('0xb'));var squel=require(_0x3a36('0xc'));var crypto=require(_0x3a36('0xd'));var jsforce=require(_0x3a36('0xe'));var deskjs=require(_0x3a36('0xf'));var toCsv=require(_0x3a36('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3a36('0x10'));var authService=require(_0x3a36('0x11'));var qs=require(_0x3a36('0x12'));var as=require(_0x3a36('0x13'));var hardwareService=require(_0x3a36('0x14'));var logger=require(_0x3a36('0x15'))(_0x3a36('0x16'));var utils=require('../../config/utils');var config=require(_0x3a36('0x17'));var db=require(_0x3a36('0x18'))['db'];function respondWithStatusCode(_0x55da69,_0x30e1ac){_0x30e1ac=_0x30e1ac||0xcc;return function(_0x3a7439){if(_0x3a7439){return _0x55da69['sendStatus'](_0x30e1ac);}return _0x55da69[_0x3a36('0x19')](_0x30e1ac)[_0x3a36('0x1a')]();};}function respondWithResult(_0x23e30a,_0x185319){_0x185319=_0x185319||0xc8;return function(_0x24fc58){if(_0x24fc58){return _0x23e30a[_0x3a36('0x19')](_0x185319)[_0x3a36('0x1b')](_0x24fc58);}};}function respondWithFilteredResult(_0x2da912,_0x4ad949){return function(_0x19c972){if(_0x19c972){var _0x2ea693=_0x19c972[_0x3a36('0x1c')],_0x590776=_0x4ad949[_0x3a36('0x1d')],_0x3ef7dd=_0x4ad949['offset']+_0x4ad949[_0x3a36('0x1e')],_0x54552f;if(_0x3ef7dd>=_0x2ea693){_0x3ef7dd=_0x2ea693;_0x54552f=0xc8;}else{_0x54552f=0xce;}_0x2da912[_0x3a36('0x19')](_0x54552f);return _0x2da912[_0x3a36('0x1f')](_0x3a36('0x20'),_0x590776+'-'+_0x3ef7dd+'/'+_0x2ea693)[_0x3a36('0x1b')](_0x19c972);}return null;};}function patchUpdates(_0x47db58){return function(_0x3d2eee){try{jsonpatch[_0x3a36('0x21')](_0x3d2eee,_0x47db58,!![]);}catch(_0x42b6fe){return BPromise['reject'](_0x42b6fe);}return _0x3d2eee[_0x3a36('0x22')]();};}function saveUpdates(_0x2526bd,_0x40f55f){return function(_0x2d0bfb){if(_0x2d0bfb){return _0x2d0bfb[_0x3a36('0x23')](_0x2526bd)['then'](function(_0x84c4e8){return _0x84c4e8;});}return null;};}function removeEntity(_0x1e924c,_0x548716){return function(_0x14007f){if(_0x14007f){return _0x14007f['destroy']()[_0x3a36('0x24')](function(){_0x1e924c['status'](0xcc)[_0x3a36('0x1a')]();});}};}function handleEntityNotFound(_0x28b12c,_0x91d94){return function(_0x32057d){if(!_0x32057d){_0x28b12c['sendStatus'](0x194);}return _0x32057d;};}function handleError(_0x32c243,_0x3f74fe){_0x3f74fe=_0x3f74fe||0x1f4;return function(_0x50d2c9){logger[_0x3a36('0x25')](_0x50d2c9[_0x3a36('0x26')]);if(_0x50d2c9[_0x3a36('0x27')]){delete _0x50d2c9[_0x3a36('0x27')];}_0x32c243[_0x3a36('0x19')](_0x3f74fe)['send'](_0x50d2c9);};}exports[_0x3a36('0x28')]=function(_0x444a7b,_0x20d1d4){var _0xf87d07={},_0x4c7fa6={},_0x8fea41={'count':0x0,'rows':[]};var _0x26928e=_['map'](db[_0x3a36('0x29')]['rawAttributes'],function(_0x4553ee){return{'name':_0x4553ee[_0x3a36('0x2a')],'type':_0x4553ee['type'][_0x3a36('0x2b')]};});_0x4c7fa6[_0x3a36('0x2c')]=_[_0x3a36('0x2d')](_[_0x3a36('0x2e')](_0x26928e,_0x3a36('0x27')),[_0x3a36('0x27')]);_0x4c7fa6[_0x3a36('0x2f')]=_['keys'](_0x444a7b[_0x3a36('0x2f')]);_0x4c7fa6[_0x3a36('0x30')]=_[_0x3a36('0x31')](_0x4c7fa6[_0x3a36('0x2c')],_0x4c7fa6['query']);_0xf87d07['attributes']=_[_0x3a36('0x31')](_0x4c7fa6[_0x3a36('0x2c')],qs[_0x3a36('0x32')](_0x444a7b[_0x3a36('0x2f')][_0x3a36('0x32')]));_0xf87d07[_0x3a36('0x33')]=_0xf87d07[_0x3a36('0x33')][_0x3a36('0x34')]?_0xf87d07[_0x3a36('0x33')]:_0x4c7fa6[_0x3a36('0x2c')];if(!_0x444a7b[_0x3a36('0x2f')][_0x3a36('0x35')](_0x3a36('0x36'))){_0xf87d07[_0x3a36('0x1e')]=qs[_0x3a36('0x1e')](_0x444a7b[_0x3a36('0x2f')][_0x3a36('0x1e')]);_0xf87d07['offset']=qs[_0x3a36('0x1d')](_0x444a7b[_0x3a36('0x2f')][_0x3a36('0x1d')]);}_0xf87d07[_0x3a36('0x37')]=qs['sort'](_0x444a7b[_0x3a36('0x2f')][_0x3a36('0x38')]);_0xf87d07['where']=qs[_0x3a36('0x30')](_[_0x3a36('0x39')](_0x444a7b['query'],_0x4c7fa6['filters']),_0x26928e);if(_0x444a7b[_0x3a36('0x2f')][_0x3a36('0x3a')]){_0xf87d07[_0x3a36('0x3b')]=_[_0x3a36('0x3c')](_0xf87d07[_0x3a36('0x3b')],{'$or':_['map'](_0x26928e,function(_0xd25f72){if(_0xd25f72['type']!==_0x3a36('0x3d')){var _0x530c70={};_0x530c70[_0xd25f72['name']]={'$like':'%'+_0x444a7b[_0x3a36('0x2f')]['filter']+'%'};return _0x530c70;}})});}_0xf87d07=_['merge']({},_0xf87d07,_0x444a7b[_0x3a36('0x3e')]);var _0x17ebad={'where':_0xf87d07[_0x3a36('0x3b')]};return db[_0x3a36('0x29')]['count'](_0x17ebad)[_0x3a36('0x24')](function(_0x5d9888){_0x8fea41[_0x3a36('0x1c')]=_0x5d9888;if(_0x444a7b['query'][_0x3a36('0x3f')]){_0xf87d07[_0x3a36('0x40')]=[{'all':!![]}];}return db[_0x3a36('0x29')]['findAll'](_0xf87d07);})[_0x3a36('0x24')](function(_0x36db38){_0x8fea41['rows']=_0x36db38;return _0x8fea41;})[_0x3a36('0x24')](respondWithFilteredResult(_0x20d1d4,_0xf87d07))[_0x3a36('0x41')](handleError(_0x20d1d4,null));};exports[_0x3a36('0x42')]=function(_0x57bb96,_0x1f2057){var _0x2cc900={'raw':!![],'where':{'id':_0x57bb96[_0x3a36('0x43')]['id']}},_0x28d87={};_0x28d87['model']=_['keys'](db[_0x3a36('0x29')][_0x3a36('0x44')]);_0x28d87['query']=_[_0x3a36('0x45')](_0x57bb96[_0x3a36('0x2f')]);_0x28d87['filters']=_[_0x3a36('0x31')](_0x28d87[_0x3a36('0x2c')],_0x28d87[_0x3a36('0x2f')]);_0x2cc900[_0x3a36('0x33')]=_['intersection'](_0x28d87['model'],qs[_0x3a36('0x32')](_0x57bb96[_0x3a36('0x2f')][_0x3a36('0x32')]));_0x2cc900[_0x3a36('0x33')]=_0x2cc900[_0x3a36('0x33')][_0x3a36('0x34')]?_0x2cc900[_0x3a36('0x33')]:_0x28d87[_0x3a36('0x2c')];if(_0x57bb96['query'][_0x3a36('0x3f')]){_0x2cc900['include']=[{'all':!![]}];}_0x2cc900=_[_0x3a36('0x3c')]({},_0x2cc900,_0x57bb96[_0x3a36('0x3e')]);return db['CmCustomField'][_0x3a36('0x46')](_0x2cc900)['then'](handleEntityNotFound(_0x1f2057,null))[_0x3a36('0x24')](respondWithResult(_0x1f2057,null))[_0x3a36('0x41')](handleError(_0x1f2057,null));};exports[_0x3a36('0x23')]=function(_0x250d2c,_0x639832){if(_0x250d2c[_0x3a36('0x47')]['id']){delete _0x250d2c['body']['id'];}return db[_0x3a36('0x29')][_0x3a36('0x46')]({'where':{'id':_0x250d2c['params']['id']}})[_0x3a36('0x24')](handleEntityNotFound(_0x639832,null))[_0x3a36('0x24')](saveUpdates(_0x250d2c[_0x3a36('0x47')],null))[_0x3a36('0x24')](respondWithResult(_0x639832,null))[_0x3a36('0x41')](handleError(_0x639832,null));};exports[_0x3a36('0x48')]=function(_0x1ec179,_0x1482b2){return db['CmCustomField']['find']({'where':{'id':_0x1ec179[_0x3a36('0x43')]['id']}})['then'](handleEntityNotFound(_0x1482b2,null))['then'](removeEntity(_0x1482b2,null))[_0x3a36('0x41')](handleError(_0x1482b2,null));};exports[_0x3a36('0x49')]=function(_0x430689,_0x3dc36f){var _0x2af4c1;return db[_0x3a36('0x4a')][_0x3a36('0x4b')](function(_0x5d3d9e){return db[_0x3a36('0x29')][_0x3a36('0x49')](_0x430689['body'],{'transaction':_0x5d3d9e})[_0x3a36('0x24')](function(_0x20b3b7){_0x2af4c1=_0x20b3b7;var _0x550df4={'type':db['Sequelize'][_0x3a36('0x4c')],'transaction':_0x5d3d9e};switch(_0x430689['body'][_0x3a36('0x4d')]){case _0x3a36('0x4e'):_0x550df4[_0x3a36('0x4d')]=db[_0x3a36('0x4f')][_0x3a36('0x4c')];break;case'number':_0x550df4[_0x3a36('0x4d')]=db[_0x3a36('0x4f')][_0x3a36('0x50')];break;case _0x3a36('0x51'):_0x550df4[_0x3a36('0x4d')]=db[_0x3a36('0x4f')]['BOOLEAN'];_0x550df4[_0x3a36('0x52')]=![];break;default:}return db[_0x3a36('0x4a')][_0x3a36('0x53')][_0x3a36('0x54')](_0x3a36('0x55'),util['format'](_0x3a36('0x56'),_0x2af4c1['id']),_0x550df4);})[_0x3a36('0x24')](function(){return _0x2af4c1;});})['then'](respondWithResult(_0x3dc36f,0xc9))['catch'](handleError(_0x3dc36f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 5320b42..a616dc4 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 _0x0600=['api','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','define','lodash','util','../../config/logger'];(function(_0x3448ea,_0x5eabdf){var _0x9b9c03=function(_0x30e240){while(--_0x30e240){_0x3448ea['push'](_0x3448ea['shift']());}};_0x9b9c03(++_0x5eabdf);}(_0x0600,0x81));var _0x0060=function(_0x5a91a5,_0x1eb099){_0x5a91a5=_0x5a91a5-0x0;var _0x8f99de=_0x0600[_0x5a91a5];return _0x8f99de;};'use strict';var _=require(_0x0060('0x0'));var util=require(_0x0060('0x1'));var logger=require(_0x0060('0x2'))(_0x0060('0x3'));var moment=require(_0x0060('0x4'));var BPromise=require(_0x0060('0x5'));var rp=require(_0x0060('0x6'));var fs=require('fs');var path=require(_0x0060('0x7'));var rimraf=require(_0x0060('0x8'));var config=require('../../config/environment');var attributes=require(_0x0060('0x9'));module['exports']=function(_0x15d0de,_0x3e8170){return _0x15d0de[_0x0060('0xa')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37b2=['api','moment','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0x1b9453,_0x50fa06){var _0x505ddc=function(_0x5e9224){while(--_0x5e9224){_0x1b9453['push'](_0x1b9453['shift']());}};_0x505ddc(++_0x50fa06);}(_0x37b2,0x14d));var _0x237b=function(_0x179388,_0x4c4ce3){_0x179388=_0x179388-0x0;var _0xaa9a2f=_0x37b2[_0x179388];return _0xaa9a2f;};'use strict';var _=require(_0x237b('0x0'));var util=require(_0x237b('0x1'));var logger=require(_0x237b('0x2'))(_0x237b('0x3'));var moment=require(_0x237b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x237b('0x5'));var config=require(_0x237b('0x6'));var attributes=require(_0x237b('0x7'));module[_0x237b('0x8')]=function(_0x4976e8,_0x549889){return _0x4976e8[_0x237b('0x9')](_0x237b('0xa'),attributes,{'tableName':_0x237b('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index e65b60f..f90fe8c 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 _0xf72b=['../../config/environment','jayson/promise','client','request','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x166b14,_0x3ce1ce){var _0x5dc7c6=function(_0x43b519){while(--_0x43b519){_0x166b14['push'](_0x166b14['shift']());}};_0x5dc7c6(++_0x3ce1ce);}(_0xf72b,0x1d9));var _0xbf72=function(_0x461ea3,_0x454c5f){_0x461ea3=_0x461ea3-0x0;var _0x180530=_0xf72b[_0x461ea3];return _0x180530;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});} \ No newline at end of file +var _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x518ac1,_0x455010){var _0x5afd62=function(_0x3ecafa){while(--_0x3ecafa){_0x518ac1['push'](_0x518ac1['shift']());}};_0x5afd62(++_0x455010);}(_0x84ab,0x12f));var _0xb84a=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x84ab[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('CmCustomField,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2796431..2c37244 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 _0xeee9=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x10c277,_0x101d66){var _0x3e517b=function(_0x455a53){while(--_0x455a53){_0x10c277['push'](_0x10c277['shift']());}};_0x3e517b(++_0x101d66);}(_0xeee9,0x153));var _0x9eee=function(_0x17be55,_0x207c3e){_0x17be55=_0x17be55-0x0;var _0x10126d=_0xeee9[_0x17be55];return _0x10126d;};'use strict';var multer=require('multer');var util=require(_0x9eee('0x0'));var path=require(_0x9eee('0x1'));var timeout=require(_0x9eee('0x2'));var express=require(_0x9eee('0x3'));var router=express[_0x9eee('0x4')]();var auth=require(_0x9eee('0x5'));var interaction=require(_0x9eee('0x6'));var config=require(_0x9eee('0x7'));var controller=require(_0x9eee('0x8'));router['get']('/',auth[_0x9eee('0x9')](),controller[_0x9eee('0xa')]);router[_0x9eee('0xb')](_0x9eee('0xc'),auth[_0x9eee('0x9')](),controller['show']);router[_0x9eee('0xd')]('/',auth[_0x9eee('0x9')](),controller[_0x9eee('0xe')]);router[_0x9eee('0xf')](_0x9eee('0xc'),auth[_0x9eee('0x9')](),controller['update']);router[_0x9eee('0x10')](_0x9eee('0xc'),auth[_0x9eee('0x9')](),controller[_0x9eee('0x11')]);module[_0x9eee('0x12')]=router; \ No newline at end of file +var _0x9815=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy'];(function(_0x24a15e,_0x4862ce){var _0x10256f=function(_0x43ed6e){while(--_0x43ed6e){_0x24a15e['push'](_0x24a15e['shift']());}};_0x10256f(++_0x4862ce);}(_0x9815,0x1cb));var _0x5981=function(_0x17458f,_0x52caf0){_0x17458f=_0x17458f-0x0;var _0x3f38af=_0x9815[_0x17458f];return _0x3f38af;};'use strict';var multer=require('multer');var util=require(_0x5981('0x0'));var path=require(_0x5981('0x1'));var timeout=require(_0x5981('0x2'));var express=require('express');var router=express[_0x5981('0x3')]();var auth=require(_0x5981('0x4'));var interaction=require(_0x5981('0x5'));var config=require('../../config/environment');var controller=require(_0x5981('0x6'));router[_0x5981('0x7')]('/',auth[_0x5981('0x8')](),controller[_0x5981('0x9')]);router[_0x5981('0x7')]('/:id',auth[_0x5981('0x8')](),controller[_0x5981('0xa')]);router['post']('/',auth[_0x5981('0x8')](),controller[_0x5981('0xb')]);router[_0x5981('0xc')](_0x5981('0xd'),auth['isAuthenticated'](),controller[_0x5981('0xe')]);router[_0x5981('0xf')](_0x5981('0xd'),auth[_0x5981('0x8')](),controller[_0x5981('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index cd7526a..2524fe9 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 _0x56e7=['STRING','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x3b2369,_0x4c68b9){var _0x5a1367=function(_0x58ddcf){while(--_0x58ddcf){_0x3b2369['push'](_0x3b2369['shift']());}};_0x5a1367(++_0x4c68b9);}(_0x56e7,0x7b));var _0x756e=function(_0x5baf04,_0x2b116d){_0x5baf04=_0x5baf04-0x0;var _0x3ae3c4=_0x56e7[_0x5baf04];return _0x3ae3c4;};'use strict';var moment=require('moment');var Sequelize=require(_0x756e('0x0'));module[_0x756e('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x756e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x756e('0x3')],'defaultValue':moment()[_0x756e('0x4')](_0x756e('0x5'))},'countbusyretry':{'type':Sequelize[_0x756e('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x756e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x756e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x756e('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x756e('0x3')]},'priority':{'type':Sequelize[_0x756e('0x6')](0x2)[_0x756e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x756e('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x756e('0x6')],'unique':_0x756e('0x9')},'UserId':{'type':Sequelize[_0x756e('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x756e('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x756e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x756e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x756e('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x756e('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x814b=['exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x814b,0x1a2));var _0xb814=function(_0x337651,_0x2af690){_0x337651=_0x337651-0x0;var _0x20893c=_0x814b[_0x337651];return _0x20893c;};'use strict';var moment=require(_0xb814('0x0'));var Sequelize=require(_0xb814('0x1'));module[_0xb814('0x2')]={'phone':{'type':Sequelize[_0xb814('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb814('0x5')],'defaultValue':moment()['format'](_0xb814('0x6'))},'countbusyretry':{'type':Sequelize[_0xb814('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb814('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb814('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb814('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xb814('0x7')](0x2)[_0xb814('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb814('0x7')],'unique':_0xb814('0x9')},'ListId':{'type':Sequelize[_0xb814('0x7')],'unique':_0xb814('0x9')},'UserId':{'type':Sequelize[_0xb814('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xb814('0x7')],'unique':_0xb814('0x9')},'CampaignId':{'type':Sequelize[_0xb814('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xb814('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb814('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb814('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb814('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 f2ae62d..34246e8 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 _0x47ae=['lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','status','json','count','limit','set','apply','reject','save','update','then','end','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$and','$or','$gte','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','merge','filter','options','includeAll','include','findAll','catch','show','params','CmHopper','intersection','create','body','find','describe','destroy','VoiceQueueId','Campaign','CampaignId','deleted','campaign','membername','user','deletedat','format','phone','campaigntype','queue','ivr','ContactId','firstName','isNil','calleridname','lastName','CmHopperFinal','getPreview','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','to-csv'];(function(_0x48cb10,_0x343485){var _0x301ae0=function(_0x260de4){while(--_0x260de4){_0x48cb10['push'](_0x48cb10['shift']());}};_0x301ae0(++_0x343485);}(_0x47ae,0xf9));var _0xe47a=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0x47ae[_0x5805d7];return _0x170fe4;};'use strict';var pdf=require(_0xe47a('0x0'));var emlformat=require(_0xe47a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe47a('0x2'));var rp=require(_0xe47a('0x3'));var moment=require('moment');var BPromise=require(_0xe47a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe47a('0x5'));var sox=require('sox');var csv=require(_0xe47a('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe47a('0x7'));var squel=require(_0xe47a('0x8'));var crypto=require(_0xe47a('0x9'));var jsforce=require(_0xe47a('0xa'));var deskjs=require(_0xe47a('0xb'));var toCsv=require(_0xe47a('0x6'));var querystring=require(_0xe47a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe47a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe47a('0xe'));var logger=require('../../config/logger')(_0xe47a('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe47a('0x10'))['db'];function respondWithStatusCode(_0x147418,_0x20fe41){_0x20fe41=_0x20fe41||0xcc;return function(_0x512d78){if(_0x512d78){return _0x147418['sendStatus'](_0x20fe41);}return _0x147418[_0xe47a('0x11')](_0x20fe41)['end']();};}function respondWithResult(_0x1a5c94,_0x4d5f92){_0x4d5f92=_0x4d5f92||0xc8;return function(_0x5ad163){if(_0x5ad163){return _0x1a5c94[_0xe47a('0x11')](_0x4d5f92)[_0xe47a('0x12')](_0x5ad163);}};}function respondWithFilteredResult(_0x40d488,_0x52f0f1){return function(_0x41ce70){if(_0x41ce70){var _0x47d896=_0x41ce70[_0xe47a('0x13')],_0x3882db=_0x52f0f1['offset'],_0x561013=_0x52f0f1['offset']+_0x52f0f1[_0xe47a('0x14')],_0x36fccd;if(_0x561013>=_0x47d896){_0x561013=_0x47d896;_0x36fccd=0xc8;}else{_0x36fccd=0xce;}_0x40d488[_0xe47a('0x11')](_0x36fccd);return _0x40d488[_0xe47a('0x15')]('Content-Range',_0x3882db+'-'+_0x561013+'/'+_0x47d896)['json'](_0x41ce70);}return null;};}function patchUpdates(_0x14b700){return function(_0x2a3895){try{jsonpatch[_0xe47a('0x16')](_0x2a3895,_0x14b700,!![]);}catch(_0x26eb2b){return BPromise[_0xe47a('0x17')](_0x26eb2b);}return _0x2a3895[_0xe47a('0x18')]();};}function saveUpdates(_0x4af7de,_0x312992){return function(_0x4c9da6){if(_0x4c9da6){return _0x4c9da6[_0xe47a('0x19')](_0x4af7de)[_0xe47a('0x1a')](function(_0x262f42){return _0x262f42;});}return null;};}function removeEntity(_0x6e7f41,_0x2b3c4d){return function(_0x5e9599){if(_0x5e9599){return _0x5e9599['destroy']()[_0xe47a('0x1a')](function(){_0x6e7f41[_0xe47a('0x11')](0xcc)[_0xe47a('0x1b')]();});}};}function handleEntityNotFound(_0x18bd6b,_0x4d187b){return function(_0x3d0101){if(!_0x3d0101){_0x18bd6b[_0xe47a('0x1c')](0x194);}return _0x3d0101;};}function handleError(_0x5c959b,_0x337488){_0x337488=_0x337488||0x1f4;return function(_0x3077fd){logger[_0xe47a('0x1d')](_0x3077fd['stack']);if(_0x3077fd[_0xe47a('0x1e')]){delete _0x3077fd[_0xe47a('0x1e')];}_0x5c959b[_0xe47a('0x11')](_0x337488)['send'](_0x3077fd);};}exports[_0xe47a('0x1f')]=function(_0x2cd752,_0x3d9627){var _0x5d5940={},_0x53bf83={},_0x19609e={'count':0x0,'rows':[]};var _0x22da07=_[_0xe47a('0x20')](db['CmHopper'][_0xe47a('0x21')],function(_0x220950){return{'name':_0x220950[_0xe47a('0x22')],'type':_0x220950[_0xe47a('0x23')][_0xe47a('0x24')]};});_0x53bf83[_0xe47a('0x25')]=_[_0xe47a('0x20')](_0x22da07,_0xe47a('0x1e'));_0x53bf83[_0xe47a('0x26')]=_[_0xe47a('0x27')](_0x2cd752[_0xe47a('0x26')]);_0x53bf83[_0xe47a('0x28')]=_['intersection'](_0x53bf83['model'],_0x53bf83[_0xe47a('0x26')]);_0x53bf83['filters']=_[_0xe47a('0x29')](_0x53bf83[_0xe47a('0x28')],[_0xe47a('0x2a'),_0xe47a('0x2b'),'$gt',_0xe47a('0x2c'),'$lt',_0xe47a('0x2d'),_0xe47a('0x2e'),_0xe47a('0x2f'),'$not',_0xe47a('0x30'),_0xe47a('0x31'),'$in',_0xe47a('0x32'),_0xe47a('0x33'),_0xe47a('0x34'),'$iLike',_0xe47a('0x35'),_0xe47a('0x33'),_0xe47a('0x36'),_0xe47a('0x37'),_0xe47a('0x38'),'$any']);_0x5d5940[_0xe47a('0x39')]=_['intersection'](_0x53bf83[_0xe47a('0x25')],qs[_0xe47a('0x3a')](_0x2cd752['query'][_0xe47a('0x3a')]));_0x5d5940[_0xe47a('0x39')]=_0x5d5940['attributes'][_0xe47a('0x3b')]?_0x5d5940[_0xe47a('0x39')]:_0x53bf83['model'];if(!_0x2cd752[_0xe47a('0x26')][_0xe47a('0x3c')](_0xe47a('0x3d'))){_0x5d5940['limit']=qs[_0xe47a('0x14')](_0x2cd752[_0xe47a('0x26')]['limit']);_0x5d5940[_0xe47a('0x3e')]=qs[_0xe47a('0x3e')](_0x2cd752[_0xe47a('0x26')][_0xe47a('0x3e')]);}_0x5d5940[_0xe47a('0x3f')]=qs[_0xe47a('0x40')](_0x2cd752[_0xe47a('0x26')][_0xe47a('0x40')]);_0x5d5940[_0xe47a('0x41')]=qs['filters'](_['pick'](_0x2cd752[_0xe47a('0x26')],_0x53bf83[_0xe47a('0x28')]),_0x22da07);if(_0x2cd752[_0xe47a('0x26')]['filter']){_0x5d5940['where']=_[_0xe47a('0x42')](_0x5d5940[_0xe47a('0x41')],{'$or':_[_0xe47a('0x20')](_0x22da07,function(_0x2728f4){if(_0x2728f4['type']!=='VIRTUAL'){var _0x5792e0={};_0x5792e0[_0x2728f4['name']]={'$like':'%'+_0x2cd752[_0xe47a('0x26')][_0xe47a('0x43')]+'%'};return _0x5792e0;}})});}_0x5d5940=_[_0xe47a('0x42')]({},_0x5d5940,_0x2cd752[_0xe47a('0x44')]);var _0x19a45d={'where':_0x5d5940[_0xe47a('0x41')]};return db['CmHopper'][_0xe47a('0x13')](_0x19a45d)[_0xe47a('0x1a')](function(_0x12f204){_0x19609e[_0xe47a('0x13')]=_0x12f204;if(_0x2cd752[_0xe47a('0x26')][_0xe47a('0x45')]){_0x5d5940[_0xe47a('0x46')]=[{'all':!![]}];}return db['CmHopper'][_0xe47a('0x47')](_0x5d5940);})[_0xe47a('0x1a')](function(_0x596af5){_0x19609e['rows']=_0x596af5;return _0x19609e;})[_0xe47a('0x1a')](respondWithFilteredResult(_0x3d9627,_0x5d5940))[_0xe47a('0x48')](handleError(_0x3d9627,null));};exports[_0xe47a('0x49')]=function(_0x1c8470,_0x53da25){var _0x17d4b2={'raw':!![],'where':{'id':_0x1c8470[_0xe47a('0x4a')]['id']}},_0x1421b4={};_0x1421b4[_0xe47a('0x25')]=_[_0xe47a('0x27')](db[_0xe47a('0x4b')][_0xe47a('0x21')]);_0x1421b4[_0xe47a('0x26')]=_[_0xe47a('0x27')](_0x1c8470[_0xe47a('0x26')]);_0x1421b4['filters']=_[_0xe47a('0x4c')](_0x1421b4[_0xe47a('0x25')],_0x1421b4['query']);_0x17d4b2[_0xe47a('0x39')]=_[_0xe47a('0x4c')](_0x1421b4[_0xe47a('0x25')],qs['fields'](_0x1c8470['query'][_0xe47a('0x3a')]));_0x17d4b2[_0xe47a('0x39')]=_0x17d4b2[_0xe47a('0x39')][_0xe47a('0x3b')]?_0x17d4b2['attributes']:_0x1421b4[_0xe47a('0x25')];if(_0x1c8470[_0xe47a('0x26')][_0xe47a('0x45')]){_0x17d4b2['include']=[{'all':!![]}];}_0x17d4b2=_[_0xe47a('0x42')]({},_0x17d4b2,_0x1c8470['options']);return db['CmHopper']['find'](_0x17d4b2)['then'](handleEntityNotFound(_0x53da25,null))[_0xe47a('0x1a')](respondWithResult(_0x53da25,null))['catch'](handleError(_0x53da25,null));};exports['create']=function(_0x14665d,_0x31ae20){return db[_0xe47a('0x4b')][_0xe47a('0x4d')](_0x14665d[_0xe47a('0x4e')],{})[_0xe47a('0x1a')](respondWithResult(_0x31ae20,0xc9))[_0xe47a('0x48')](handleError(_0x31ae20,null));};exports['update']=function(_0x188276,_0x414f52){if(_0x188276[_0xe47a('0x4e')]['id']){delete _0x188276[_0xe47a('0x4e')]['id'];}return db[_0xe47a('0x4b')][_0xe47a('0x4f')]({'where':{'id':_0x188276[_0xe47a('0x4a')]['id']}})[_0xe47a('0x1a')](handleEntityNotFound(_0x414f52,null))[_0xe47a('0x1a')](saveUpdates(_0x188276[_0xe47a('0x4e')],null))[_0xe47a('0x1a')](respondWithResult(_0x414f52,null))[_0xe47a('0x48')](handleError(_0x414f52,null));};exports[_0xe47a('0x50')]=function(_0x58c243,_0x29d87f){return db[_0xe47a('0x4b')][_0xe47a('0x50')]()['then'](respondWithResult(_0x29d87f,null))['catch'](handleError(_0x29d87f,null));};exports[_0xe47a('0x51')]=function(_0x465de4,_0x3afa85){var _0x562008;return db[_0xe47a('0x4b')][_0xe47a('0x4f')]({'where':{'id':_0x465de4[_0xe47a('0x4a')]['id']}})[_0xe47a('0x1a')](handleEntityNotFound(_0x3afa85,null))[_0xe47a('0x1a')](function(_0x244a3f){if(_0x244a3f){return _0x244a3f['destroy']()[_0xe47a('0x1a')](function(_0x45d8c8){return _0x45d8c8;});}})[_0xe47a('0x1a')](function(_0x557601){_0x562008=_0x557601;if(_0x557601){if(_0x557601[_0xe47a('0x52')]||_0x557601['CampaignId']){return db[_0x557601[_0xe47a('0x52')]?'VoiceQueue':_0xe47a('0x53')][_0xe47a('0x4f')]({'where':{'id':_0x557601['VoiceQueueId']?_0x557601[_0xe47a('0x52')]:_0x557601[_0xe47a('0x54')]},'attributes':['id',_0xe47a('0x1e')],'raw':!![]});}}})[_0xe47a('0x1a')](function(_0x1ffac8){var _0xa5f47c={};if(_0x1ffac8){_[_0xe47a('0x42')](_0xa5f47c,_['omit'](_0x562008['dataValues'],['createdAt','updatedAt','id']));_0xa5f47c['state']=0x15;_0xa5f47c['statedesc']=_0xe47a('0x55');_0xa5f47c[_0xe47a('0x56')]=_0x1ffac8[_0xe47a('0x1e')];_0xa5f47c[_0xe47a('0x57')]=_0x465de4[_0xe47a('0x58')][_0xe47a('0x1e')];_0xa5f47c['UserId']=_0x465de4[_0xe47a('0x58')]['id'];_0xa5f47c['deleted']=!![];_0xa5f47c[_0xe47a('0x59')]=moment()[_0xe47a('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0xa5f47c['calleridnum']=_0x562008[_0xe47a('0x5b')];_0xa5f47c[_0xe47a('0x5c')]=_0x562008[_0xe47a('0x52')]?_0xe47a('0x5d'):_0xe47a('0x5e');return db['CmContact']['find']({'where':{'id':_0xa5f47c[_0xe47a('0x5f')]},'attributes':[_0xe47a('0x60'),'lastName']})[_0xe47a('0x1a')](function(_0x69c810){if(!_[_0xe47a('0x61')](_0x3afa85)&&!_[_0xe47a('0x61')](_0x69c810['firstName'])){_0xa5f47c[_0xe47a('0x62')]=_0x69c810[_0xe47a('0x60')];if(!_[_0xe47a('0x61')](_0x69c810['lastName'])){_0xa5f47c[_0xe47a('0x62')]+='\x20'+_0x69c810[_0xe47a('0x63')];}}})['finally'](function(){return db[_0xe47a('0x64')][_0xe47a('0x4d')](_0xa5f47c);});}})[_0xe47a('0x1a')](function(){return _0x3afa85[_0xe47a('0x11')](0xcc)['end']();})[_0xe47a('0x48')](handleError(_0x3afa85,null));};exports[_0xe47a('0x65')]=function(_0xc9cd48,_0x47c531,_0x123b26){var _0x5165f5=[];return db[_0xe47a('0x66')][_0xe47a('0x50')]()['then'](function(_0x40489f){_0x5165f5=_[_0xe47a('0x27')](_0x40489f);return _0xc9cd48[_0xe47a('0x58')][_0xe47a('0x67')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe47a('0x68')},'attributes':['id',_0xe47a('0x69')],'raw':!![]});})[_0xe47a('0x1a')](function(_0x1e8f37){if(_0x1e8f37&&_0x1e8f37[_0xe47a('0x3b')]){return db[_0xe47a('0x6a')][_0xe47a('0x6b')](function(_0x4d7206){var _0x251873={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe47a('0x5a')](_0xe47a('0x6c'))},'VoiceQueueId':{'$in':_['map'](_0x1e8f37,'id')},'$or':[{'UserId':null},{'UserId':_0xc9cd48[_0xe47a('0x58')]['id']}]};var _0x5add88=[];if(_0xc9cd48['body'][_0xe47a('0x6d')]&&_0xc9cd48[_0xe47a('0x4e')]['direction']===_0xe47a('0x6e')){if(!_['isEmpty'](_0xc9cd48['body'][_0xe47a('0x6f')])){_0x251873['id']={'$in':_0xc9cd48['body'][_0xe47a('0x6f')]};}_0x5add88=[[_0xe47a('0x70'),_0xe47a('0x71')],['scheduledAt',_0x1e8f37[0x0][_0xe47a('0x69')]===_0xe47a('0x71')?'DESC':_0xe47a('0x71')],db[_0xe47a('0x6a')][_0xe47a('0x72')](_0xe47a('0x73')),['id','DESC']];}else{if(!_['isEmpty'](_0xc9cd48['body']['hopperIds'])){_0x251873['id']={'$notIn':_0xc9cd48[_0xe47a('0x4e')]['hopperIds']};}_0x5add88=[[_0xe47a('0x70'),_0xe47a('0x74')],['scheduledAt',_0x1e8f37[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0xe47a('0x72')](_0xe47a('0x75')),['id',_0xe47a('0x71')]];}return db[_0xe47a('0x4b')][_0xe47a('0x76')]({'attributes':['id',_0xe47a('0x77')],'where':_0x251873,'order':_0x5add88,'transaction':_0x4d7206,'lock':_0x4d7206['LOCK'][_0xe47a('0x78')],'include':[{'model':db[_0xe47a('0x66')],'as':_0xe47a('0x79'),'attributes':_0x5165f5,'include':[{'model':db[_0xe47a('0x7a')],'as':_0xe47a('0x7b'),'attributes':['id',_0xe47a('0x1e')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xe47a('0x1e')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xe47a('0x1e'),_0xe47a('0x7c')]}]})[_0xe47a('0x1a')](function(_0x400182){if(_0x400182){return _0x400182[_0xe47a('0x19')]({'UserId':_0xc9cd48[_0xe47a('0x58')]['id']},{'transaction':_0x4d7206});}});});}})[_0xe47a('0x1a')](handleEntityNotFound(_0x47c531,null))[_0xe47a('0x1a')](respondWithResult(_0x47c531,null))[_0xe47a('0x48')](handleError(_0x47c531,null));};exports[_0xe47a('0x7d')]=function(_0x3c0fa8,_0x514cbc,_0x2048f0){return _0x3c0fa8[_0xe47a('0x58')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xe47a('0x68')},'attributes':['id'],'raw':!![]})['then'](function(_0x41fa25){if(_0x41fa25&&_0x41fa25[_0xe47a('0x3b')]){return db['CmHopper'][_0xe47a('0x13')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe47a('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe47a('0x20')](_0x41fa25,'id')},'$or':[{'UserId':null},{'UserId':_0x3c0fa8[_0xe47a('0x58')]['id']}]}});}return 0x0;})['then'](function(_0x1b38f2){if(!_[_0xe47a('0x61')](_0x1b38f2)&&_[_0xe47a('0x7e')](_0x1b38f2)){return _0x514cbc[_0xe47a('0x11')](0xc8)[_0xe47a('0x12')]({'contacts':_0x1b38f2});}else{logger[_0xe47a('0x1d')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0xe47a('0x7f'));_0x514cbc[_0xe47a('0x1c')](0x194);}})[_0xe47a('0x48')](handleError(_0x514cbc,null));}; \ No newline at end of file +var _0x8aa1=['VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','describe','params','VoiceQueueId','CampaignId','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','hopperIds','priority','scheduledAt','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','Company','CmList','List','VoiceQueue','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','sendStatus','error','name','index','map','CmHopper','fieldName','type','key','model','query','intersection','concat','filters','$and','$or','$gt','$lt','$ne','$eq','$not','$between','$in','$notIn','$like','$notILike','$overlap','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x8aa1,0x15d));var _0x18aa=function(_0x5436a1,_0x43ce08){_0x5436a1=_0x5436a1-0x0;var _0x46c586=_0x8aa1[_0x5436a1];return _0x46c586;};'use strict';var pdf=require(_0x18aa('0x0'));var emlformat=require(_0x18aa('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x18aa('0x2'));var rp=require(_0x18aa('0x3'));var moment=require(_0x18aa('0x4'));var BPromise=require(_0x18aa('0x5'));var Mustache=require('mustache');var util=require(_0x18aa('0x6'));var path=require(_0x18aa('0x7'));var sox=require('sox');var csv=require(_0x18aa('0x8'));var ejs=require(_0x18aa('0x9'));var fs=require('fs');var _=require(_0x18aa('0xa'));var squel=require(_0x18aa('0xb'));var crypto=require('crypto');var jsforce=require(_0x18aa('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x18aa('0xd'));var Redis=require(_0x18aa('0xe'));var authService=require(_0x18aa('0xf'));var qs=require(_0x18aa('0x10'));var as=require(_0x18aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x18aa('0x12'));var config=require(_0x18aa('0x13'));var db=require(_0x18aa('0x14'))['db'];function respondWithStatusCode(_0x34d2be,_0x2e5acd){_0x2e5acd=_0x2e5acd||0xcc;return function(_0x2e5817){if(_0x2e5817){return _0x34d2be['sendStatus'](_0x2e5acd);}return _0x34d2be[_0x18aa('0x15')](_0x2e5acd)[_0x18aa('0x16')]();};}function respondWithResult(_0x5577c7,_0x33926e){_0x33926e=_0x33926e||0xc8;return function(_0x39007b){if(_0x39007b){return _0x5577c7[_0x18aa('0x15')](_0x33926e)[_0x18aa('0x17')](_0x39007b);}};}function respondWithFilteredResult(_0x1c79c9,_0x11f9e9){return function(_0x2ca8b2){if(_0x2ca8b2){var _0x361397=_0x2ca8b2[_0x18aa('0x18')],_0x452e02=_0x11f9e9[_0x18aa('0x19')],_0x3a401a=_0x11f9e9[_0x18aa('0x19')]+_0x11f9e9[_0x18aa('0x1a')],_0x46d7db;if(_0x3a401a>=_0x361397){_0x3a401a=_0x361397;_0x46d7db=0xc8;}else{_0x46d7db=0xce;}_0x1c79c9['status'](_0x46d7db);return _0x1c79c9[_0x18aa('0x1b')](_0x18aa('0x1c'),_0x452e02+'-'+_0x3a401a+'/'+_0x361397)[_0x18aa('0x17')](_0x2ca8b2);}return null;};}function patchUpdates(_0x33373b){return function(_0x1efb20){try{jsonpatch[_0x18aa('0x1d')](_0x1efb20,_0x33373b,!![]);}catch(_0x2c1ca6){return BPromise['reject'](_0x2c1ca6);}return _0x1efb20['save']();};}function saveUpdates(_0x59f951,_0x3d27a6){return function(_0x268b95){if(_0x268b95){return _0x268b95[_0x18aa('0x1e')](_0x59f951)['then'](function(_0xbe8f66){return _0xbe8f66;});}return null;};}function removeEntity(_0x2da0bf,_0x3519ff){return function(_0x506e82){if(_0x506e82){return _0x506e82[_0x18aa('0x1f')]()[_0x18aa('0x20')](function(){_0x2da0bf[_0x18aa('0x15')](0xcc)[_0x18aa('0x16')]();});}};}function handleEntityNotFound(_0x17f0b9,_0xb50524){return function(_0x701d36){if(!_0x701d36){_0x17f0b9[_0x18aa('0x21')](0x194);}return _0x701d36;};}function handleError(_0x147043,_0x4e2478){_0x4e2478=_0x4e2478||0x1f4;return function(_0x20c312){logger[_0x18aa('0x22')](_0x20c312['stack']);if(_0x20c312[_0x18aa('0x23')]){delete _0x20c312[_0x18aa('0x23')];}_0x147043[_0x18aa('0x15')](_0x4e2478)['send'](_0x20c312);};}exports[_0x18aa('0x24')]=function(_0xfc4b78,_0xbc585d){var _0xc6f2e0={},_0x599015={},_0x546786={'count':0x0,'rows':[]};var _0x5a100e=_[_0x18aa('0x25')](db[_0x18aa('0x26')]['rawAttributes'],function(_0x53cffb){return{'name':_0x53cffb[_0x18aa('0x27')],'type':_0x53cffb[_0x18aa('0x28')][_0x18aa('0x29')]};});_0x599015[_0x18aa('0x2a')]=_[_0x18aa('0x25')](_0x5a100e,'name');_0x599015[_0x18aa('0x2b')]=_['keys'](_0xfc4b78[_0x18aa('0x2b')]);_0x599015['filters']=_[_0x18aa('0x2c')](_0x599015[_0x18aa('0x2a')],_0x599015[_0x18aa('0x2b')]);_0x599015['filters']=_[_0x18aa('0x2d')](_0x599015[_0x18aa('0x2e')],[_0x18aa('0x2f'),_0x18aa('0x30'),_0x18aa('0x31'),'$gte',_0x18aa('0x32'),'$lte',_0x18aa('0x33'),_0x18aa('0x34'),_0x18aa('0x35'),_0x18aa('0x36'),'$notBetween',_0x18aa('0x37'),_0x18aa('0x38'),_0x18aa('0x39'),'$notLike','$iLike',_0x18aa('0x3a'),_0x18aa('0x39'),_0x18aa('0x3b'),'$contains','$contained',_0x18aa('0x3c')]);_0xc6f2e0[_0x18aa('0x3d')]=_[_0x18aa('0x2c')](_0x599015[_0x18aa('0x2a')],qs[_0x18aa('0x3e')](_0xfc4b78[_0x18aa('0x2b')][_0x18aa('0x3e')]));_0xc6f2e0['attributes']=_0xc6f2e0[_0x18aa('0x3d')][_0x18aa('0x3f')]?_0xc6f2e0[_0x18aa('0x3d')]:_0x599015[_0x18aa('0x2a')];if(!_0xfc4b78[_0x18aa('0x2b')][_0x18aa('0x40')](_0x18aa('0x41'))){_0xc6f2e0[_0x18aa('0x1a')]=qs[_0x18aa('0x1a')](_0xfc4b78['query'][_0x18aa('0x1a')]);_0xc6f2e0[_0x18aa('0x19')]=qs['offset'](_0xfc4b78['query'][_0x18aa('0x19')]);}_0xc6f2e0[_0x18aa('0x42')]=qs[_0x18aa('0x43')](_0xfc4b78[_0x18aa('0x2b')][_0x18aa('0x43')]);_0xc6f2e0[_0x18aa('0x44')]=qs['filters'](_[_0x18aa('0x45')](_0xfc4b78[_0x18aa('0x2b')],_0x599015[_0x18aa('0x2e')]),_0x5a100e);if(_0xfc4b78[_0x18aa('0x2b')]['filter']){_0xc6f2e0[_0x18aa('0x44')]=_[_0x18aa('0x46')](_0xc6f2e0[_0x18aa('0x44')],{'$or':_[_0x18aa('0x25')](_0x5a100e,function(_0x4cee7c){if(_0x4cee7c[_0x18aa('0x28')]!==_0x18aa('0x47')){var _0x5a4cbd={};_0x5a4cbd[_0x4cee7c['name']]={'$like':'%'+_0xfc4b78[_0x18aa('0x2b')][_0x18aa('0x48')]+'%'};return _0x5a4cbd;}})});}_0xc6f2e0=_[_0x18aa('0x46')]({},_0xc6f2e0,_0xfc4b78[_0x18aa('0x49')]);var _0x1f8784={'where':_0xc6f2e0[_0x18aa('0x44')]};return db[_0x18aa('0x26')][_0x18aa('0x18')](_0x1f8784)[_0x18aa('0x20')](function(_0x503680){_0x546786[_0x18aa('0x18')]=_0x503680;if(_0xfc4b78[_0x18aa('0x2b')][_0x18aa('0x4a')]){_0xc6f2e0[_0x18aa('0x4b')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0xc6f2e0);})[_0x18aa('0x20')](function(_0x4462e2){_0x546786[_0x18aa('0x4c')]=_0x4462e2;return _0x546786;})[_0x18aa('0x20')](respondWithFilteredResult(_0xbc585d,_0xc6f2e0))[_0x18aa('0x4d')](handleError(_0xbc585d,null));};exports[_0x18aa('0x4e')]=function(_0x514d51,_0x259859){var _0x4a6c76={'raw':!![],'where':{'id':_0x514d51['params']['id']}},_0xb6d02={};_0xb6d02[_0x18aa('0x2a')]=_[_0x18aa('0x4f')](db[_0x18aa('0x26')][_0x18aa('0x50')]);_0xb6d02[_0x18aa('0x2b')]=_['keys'](_0x514d51[_0x18aa('0x2b')]);_0xb6d02[_0x18aa('0x2e')]=_[_0x18aa('0x2c')](_0xb6d02[_0x18aa('0x2a')],_0xb6d02[_0x18aa('0x2b')]);_0x4a6c76[_0x18aa('0x3d')]=_[_0x18aa('0x2c')](_0xb6d02['model'],qs[_0x18aa('0x3e')](_0x514d51['query'][_0x18aa('0x3e')]));_0x4a6c76[_0x18aa('0x3d')]=_0x4a6c76['attributes'][_0x18aa('0x3f')]?_0x4a6c76[_0x18aa('0x3d')]:_0xb6d02[_0x18aa('0x2a')];if(_0x514d51[_0x18aa('0x2b')][_0x18aa('0x4a')]){_0x4a6c76[_0x18aa('0x4b')]=[{'all':!![]}];}_0x4a6c76=_[_0x18aa('0x46')]({},_0x4a6c76,_0x514d51[_0x18aa('0x49')]);return db[_0x18aa('0x26')][_0x18aa('0x51')](_0x4a6c76)[_0x18aa('0x20')](handleEntityNotFound(_0x259859,null))[_0x18aa('0x20')](respondWithResult(_0x259859,null))['catch'](handleError(_0x259859,null));};exports[_0x18aa('0x52')]=function(_0x34bfe3,_0x5b8b0d){return db[_0x18aa('0x26')][_0x18aa('0x52')](_0x34bfe3[_0x18aa('0x53')],{})['then'](respondWithResult(_0x5b8b0d,0xc9))[_0x18aa('0x4d')](handleError(_0x5b8b0d,null));};exports['update']=function(_0x4e2445,_0x31ef94){if(_0x4e2445[_0x18aa('0x53')]['id']){delete _0x4e2445[_0x18aa('0x53')]['id'];}return db[_0x18aa('0x26')][_0x18aa('0x51')]({'where':{'id':_0x4e2445['params']['id']}})[_0x18aa('0x20')](handleEntityNotFound(_0x31ef94,null))[_0x18aa('0x20')](saveUpdates(_0x4e2445[_0x18aa('0x53')],null))[_0x18aa('0x20')](respondWithResult(_0x31ef94,null))['catch'](handleError(_0x31ef94,null));};exports[_0x18aa('0x54')]=function(_0x468bad,_0x5840b8){return db[_0x18aa('0x26')]['describe']()[_0x18aa('0x20')](respondWithResult(_0x5840b8,null))['catch'](handleError(_0x5840b8,null));};exports[_0x18aa('0x1f')]=function(_0x22515e,_0x330cd8){var _0x229b34;return db[_0x18aa('0x26')]['find']({'where':{'id':_0x22515e[_0x18aa('0x55')]['id']}})[_0x18aa('0x20')](handleEntityNotFound(_0x330cd8,null))['then'](function(_0x1514c3){if(_0x1514c3){return _0x1514c3['destroy']()[_0x18aa('0x20')](function(_0x1ba079){return _0x1ba079;});}})[_0x18aa('0x20')](function(_0x5397c0){_0x229b34=_0x5397c0;if(_0x5397c0){if(_0x5397c0[_0x18aa('0x56')]||_0x5397c0[_0x18aa('0x57')]){return db[_0x5397c0[_0x18aa('0x56')]?'VoiceQueue':'Campaign'][_0x18aa('0x51')]({'where':{'id':_0x5397c0[_0x18aa('0x56')]?_0x5397c0[_0x18aa('0x56')]:_0x5397c0[_0x18aa('0x57')]},'attributes':['id',_0x18aa('0x23')],'raw':!![]});}}})[_0x18aa('0x20')](function(_0x389489){var _0x46681e={};if(_0x389489){_[_0x18aa('0x46')](_0x46681e,_[_0x18aa('0x58')](_0x229b34['dataValues'],[_0x18aa('0x59'),_0x18aa('0x5a'),'id']));_0x46681e[_0x18aa('0x5b')]=0x15;_0x46681e[_0x18aa('0x5c')]=_0x18aa('0x5d');_0x46681e[_0x18aa('0x5e')]=_0x389489[_0x18aa('0x23')];_0x46681e[_0x18aa('0x5f')]=_0x22515e[_0x18aa('0x60')][_0x18aa('0x23')];_0x46681e['UserId']=_0x22515e[_0x18aa('0x60')]['id'];_0x46681e[_0x18aa('0x5d')]=!![];_0x46681e[_0x18aa('0x61')]=moment()[_0x18aa('0x62')](_0x18aa('0x63'));_0x46681e['calleridnum']=_0x229b34['phone'];_0x46681e[_0x18aa('0x64')]=_0x229b34[_0x18aa('0x56')]?_0x18aa('0x65'):'ivr';return db[_0x18aa('0x66')][_0x18aa('0x51')]({'where':{'id':_0x46681e[_0x18aa('0x67')]},'attributes':[_0x18aa('0x68'),_0x18aa('0x69')]})[_0x18aa('0x20')](function(_0x5524be){if(!_[_0x18aa('0x6a')](_0x330cd8)&&!_[_0x18aa('0x6a')](_0x5524be[_0x18aa('0x68')])){_0x46681e[_0x18aa('0x6b')]=_0x5524be[_0x18aa('0x68')];if(!_[_0x18aa('0x6a')](_0x5524be[_0x18aa('0x69')])){_0x46681e[_0x18aa('0x6b')]+='\x20'+_0x5524be[_0x18aa('0x69')];}}})[_0x18aa('0x6c')](function(){return db['CmHopperFinal'][_0x18aa('0x52')](_0x46681e);});}})['then'](function(){return _0x330cd8[_0x18aa('0x15')](0xcc)['end']();})[_0x18aa('0x4d')](handleError(_0x330cd8,null));};exports[_0x18aa('0x6d')]=function(_0x16e1aa,_0x4a860a,_0x151b75){var _0x5b1872=[];return db['CmContact'][_0x18aa('0x54')]()[_0x18aa('0x20')](function(_0x401a0a){_0x5b1872=_[_0x18aa('0x4f')](_0x401a0a);return _0x16e1aa[_0x18aa('0x60')][_0x18aa('0x6e')]({'where':{'type':_0x18aa('0x6f'),'dialActive':!![],'dialMethod':_0x18aa('0x70')},'attributes':['id',_0x18aa('0x71')],'raw':!![]});})['then'](function(_0x369139){if(_0x369139&&_0x369139[_0x18aa('0x3f')]){return db[_0x18aa('0x72')][_0x18aa('0x73')](function(_0x8b4949){var _0x1b2c2f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x18aa('0x25')](_0x369139,'id')},'$or':[{'UserId':null},{'UserId':_0x16e1aa[_0x18aa('0x60')]['id']}]};var _0x7f6610=[];if(_0x16e1aa[_0x18aa('0x53')][_0x18aa('0x74')]&&_0x16e1aa['body'][_0x18aa('0x74')]===_0x18aa('0x75')){if(!_['isEmpty'](_0x16e1aa['body'][_0x18aa('0x76')])){_0x1b2c2f['id']={'$in':_0x16e1aa[_0x18aa('0x53')][_0x18aa('0x76')]};}_0x7f6610=[[_0x18aa('0x77'),'ASC'],[_0x18aa('0x78'),_0x369139[0x0][_0x18aa('0x71')]==='ASC'?_0x18aa('0x79'):_0x18aa('0x7a')],db[_0x18aa('0x72')][_0x18aa('0x7b')](_0x18aa('0x7c')),['id',_0x18aa('0x79')]];}else{if(!_[_0x18aa('0x7d')](_0x16e1aa[_0x18aa('0x53')][_0x18aa('0x76')])){_0x1b2c2f['id']={'$notIn':_0x16e1aa[_0x18aa('0x53')]['hopperIds']};}_0x7f6610=[['priority',_0x18aa('0x79')],['scheduledAt',_0x369139[0x0][_0x18aa('0x71')]],db[_0x18aa('0x72')]['literal'](_0x18aa('0x7e')),['id','ASC']];}return db['CmHopper'][_0x18aa('0x7f')]({'attributes':['id',_0x18aa('0x80')],'where':_0x1b2c2f,'order':_0x7f6610,'transaction':_0x8b4949,'lock':_0x8b4949[_0x18aa('0x81')][_0x18aa('0x82')],'include':[{'model':db['CmContact'],'as':_0x18aa('0x83'),'attributes':_0x5b1872,'include':[{'model':db['CmCompany'],'as':_0x18aa('0x84'),'attributes':['id','name']}]},{'model':db[_0x18aa('0x85')],'as':_0x18aa('0x86'),'attributes':['id',_0x18aa('0x23')]},{'model':db[_0x18aa('0x87')],'as':_0x18aa('0x88'),'attributes':['id',_0x18aa('0x23'),'dialActive']}]})[_0x18aa('0x20')](function(_0x1c45de){if(_0x1c45de){return _0x1c45de['update']({'UserId':_0x16e1aa[_0x18aa('0x60')]['id']},{'transaction':_0x8b4949});}});});}})[_0x18aa('0x20')](handleEntityNotFound(_0x4a860a,null))[_0x18aa('0x20')](respondWithResult(_0x4a860a,null))[_0x18aa('0x4d')](handleError(_0x4a860a,null));};exports[_0x18aa('0x89')]=function(_0x49548c,_0x21bde7,_0x3dfae6){return _0x49548c[_0x18aa('0x60')][_0x18aa('0x6e')]({'where':{'type':_0x18aa('0x6f'),'dialActive':!![],'dialMethod':_0x18aa('0x70')},'attributes':['id'],'raw':!![]})[_0x18aa('0x20')](function(_0x1bd450){if(_0x1bd450&&_0x1bd450['length']){return db[_0x18aa('0x26')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x18aa('0x62')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x18aa('0x25')](_0x1bd450,'id')},'$or':[{'UserId':null},{'UserId':_0x49548c[_0x18aa('0x60')]['id']}]}});}return 0x0;})[_0x18aa('0x20')](function(_0x3609e8){if(!_[_0x18aa('0x6a')](_0x3609e8)&&_[_0x18aa('0x8a')](_0x3609e8)){return _0x21bde7[_0x18aa('0x15')](0xc8)[_0x18aa('0x17')]({'contacts':_0x3609e8});}else{logger[_0x18aa('0x22')](_0x18aa('0x8b'),_0x18aa('0x89'),0x194,'entity\x20not\x20found');_0x21bde7[_0x18aa('0x21')](0x194);}})[_0x18aa('0x4d')](handleError(_0x21bde7,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 96277c2..598c120 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 _0xa539=['rimraf','exports','define','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x15013e,_0x529995){var _0x555872=function(_0x2cb32b){while(--_0x2cb32b){_0x15013e['push'](_0x15013e['shift']());}};_0x555872(++_0x529995);}(_0xa539,0x77));var _0x9a53=function(_0x512150,_0x1caa4e){_0x512150=_0x512150-0x0;var _0x293921=_0xa539[_0x512150];return _0x293921;};'use strict';var _=require(_0x9a53('0x0'));var util=require('util');var logger=require(_0x9a53('0x1'))(_0x9a53('0x2'));var moment=require(_0x9a53('0x3'));var BPromise=require(_0x9a53('0x4'));var rp=require(_0x9a53('0x5'));var fs=require('fs');var path=require(_0x9a53('0x6'));var rimraf=require(_0x9a53('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x9a53('0x8')]=function(_0x51dc9b,_0xae2ac1){return _0x51dc9b[_0x9a53('0x9')]('CmHopper',attributes,{'tableName':_0x9a53('0xa'),'paranoid':![],'indexes':[{'name':_0x9a53('0xb'),'fields':[_0x9a53('0xb')]},{'name':'phone','fields':[_0x9a53('0xc')]},{'name':_0x9a53('0xd'),'fields':[_0x9a53('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1630=['bluebird','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1630,0x109));var _0x0163=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1630[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x0163('0x0'));var util=require(_0x0163('0x1'));var logger=require(_0x0163('0x2'))(_0x0163('0x3'));var moment=require(_0x0163('0x4'));var BPromise=require(_0x0163('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0163('0x6'));var rimraf=require(_0x0163('0x7'));var config=require('../../config/environment');var attributes=require(_0x0163('0x8'));module[_0x0163('0x9')]=function(_0x17f5e3,_0x196639){return _0x17f5e3[_0x0163('0xa')](_0x0163('0xb'),attributes,{'tableName':_0x0163('0xc'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':'phone','fields':[_0x0163('0xd')]},{'name':'priority','fields':[_0x0163('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 67f1561..ffc8fa6 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 _0x4d47=['info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','include','map','attributes','model','ShowCmHopper','then','debug','create','body','CreateCmHopper','UpdateCmHopper','limit','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','LOCK','User','name','voicePause','length','includes','UserId','push','update','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','order','UPDATE','GetCmHopperPreview','keys','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1a21db,_0x9489fb){var _0x13ea9b=function(_0xb91444){while(--_0xb91444){_0x1a21db['push'](_0x1a21db['shift']());}};_0x13ea9b(++_0x9489fb);}(_0x4d47,0x15b));var _0x74d4=function(_0x477491,_0x5ca700){_0x477491=_0x477491-0x0;var _0xac6aec=_0x4d47[_0x477491];return _0xac6aec;};'use strict';var _=require('lodash');var util=require(_0x74d4('0x0'));var moment=require(_0x74d4('0x1'));var BPromise=require(_0x74d4('0x2'));var rs=require(_0x74d4('0x3'));var fs=require('fs');var Redis=require(_0x74d4('0x4'));var db=require(_0x74d4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74d4('0x6'))(_0x74d4('0x7'));var config=require(_0x74d4('0x8'));var jayson=require(_0x74d4('0x9'));var client=jayson[_0x74d4('0xa')][_0x74d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c94c1,_0x65a2f8,_0x54f453){return new BPromise(function(_0x25dc87,_0x45162d){return client[_0x74d4('0xc')](_0x5c94c1,_0x54f453)['then'](function(_0x540e22){logger[_0x74d4('0xd')](_0x74d4('0xe'),_0x65a2f8,_0x74d4('0xf'));logger['debug'](_0x74d4('0x10'),_0x65a2f8,_0x74d4('0xf'),JSON[_0x74d4('0x11')](_0x540e22));if(_0x540e22[_0x74d4('0x12')]){if(_0x540e22[_0x74d4('0x12')][_0x74d4('0x13')]===0x1f4){logger['error'](_0x74d4('0xe'),_0x65a2f8,_0x540e22['error'][_0x74d4('0x14')]);return _0x45162d(_0x540e22[_0x74d4('0x12')][_0x74d4('0x14')]);}logger[_0x74d4('0x12')](_0x74d4('0xe'),_0x65a2f8,_0x540e22[_0x74d4('0x12')][_0x74d4('0x14')]);return _0x25dc87(_0x540e22[_0x74d4('0x12')]['message']);}else{logger[_0x74d4('0xd')](_0x74d4('0xe'),_0x65a2f8,_0x74d4('0xf'));_0x25dc87(_0x540e22[_0x74d4('0x15')]['message']);}})[_0x74d4('0x16')](function(_0x24ce2c){logger[_0x74d4('0x12')]('CmHopper,\x20%s,\x20%s',_0x65a2f8,_0x24ce2c);_0x45162d(_0x24ce2c);});});}exports[_0x74d4('0x17')]=function(_0x3c9d18){var _0x3cc6c9=this;return new Promise(function(_0x3da6fe,_0x1725e3){return db[_0x74d4('0x18')][_0x74d4('0x19')]({'raw':_0x3c9d18[_0x74d4('0x1a')]?_0x3c9d18[_0x74d4('0x1a')][_0x74d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c9d18[_0x74d4('0x1a')]?_0x3c9d18[_0x74d4('0x1a')][_0x74d4('0x1c')]||null:null,'attributes':_0x3c9d18[_0x74d4('0x1a')]?_0x3c9d18[_0x74d4('0x1a')]['attributes']||null:null,'limit':_0x3c9d18['options']?_0x3c9d18[_0x74d4('0x1a')]['limit']||null:null,'include':_0x3c9d18['options']?_0x3c9d18[_0x74d4('0x1a')][_0x74d4('0x1d')]?_[_0x74d4('0x1e')](_0x3c9d18[_0x74d4('0x1a')]['include'],function(_0x533271){return{'model':db[_0x533271['model']],'as':_0x533271['as'],'attributes':_0x533271[_0x74d4('0x1f')],'include':_0x533271[_0x74d4('0x1d')]?_[_0x74d4('0x1e')](_0x533271[_0x74d4('0x1d')],function(_0xc00de8){return{'model':db[_0xc00de8[_0x74d4('0x20')]],'as':_0xc00de8['as'],'attributes':_0xc00de8[_0x74d4('0x1f')],'include':_0xc00de8[_0x74d4('0x1d')]?_[_0x74d4('0x1e')](_0xc00de8[_0x74d4('0x1d')],function(_0x4d1e21){return{'model':db[_0x4d1e21[_0x74d4('0x20')]],'as':_0x4d1e21['as'],'attributes':_0x4d1e21[_0x74d4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54552f){logger[_0x74d4('0xd')](_0x74d4('0x17'),_0x3c9d18);logger['debug'](_0x74d4('0x17'),_0x3c9d18,JSON[_0x74d4('0x11')](_0x54552f));_0x3da6fe(_0x54552f);})[_0x74d4('0x16')](function(_0x45ed11){logger[_0x74d4('0x12')](_0x74d4('0x17'),_0x45ed11['message'],_0x3c9d18);_0x1725e3(_0x3cc6c9['error'](0x1f4,_0x45ed11[_0x74d4('0x14')]));});});};exports[_0x74d4('0x21')]=function(_0x5c7b59){var _0x154bea=this;return new Promise(function(_0x3a0913,_0x2e9dff){return db['CmHopper']['find']({'raw':_0x5c7b59[_0x74d4('0x1a')]?_0x5c7b59[_0x74d4('0x1a')][_0x74d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c7b59[_0x74d4('0x1a')]?_0x5c7b59['options'][_0x74d4('0x1c')]||null:null,'attributes':_0x5c7b59[_0x74d4('0x1a')]?_0x5c7b59[_0x74d4('0x1a')][_0x74d4('0x1f')]||null:null,'include':_0x5c7b59[_0x74d4('0x1a')]?_0x5c7b59['options']['include']?_[_0x74d4('0x1e')](_0x5c7b59[_0x74d4('0x1a')][_0x74d4('0x1d')],function(_0x3de605){return{'model':db[_0x3de605[_0x74d4('0x20')]],'as':_0x3de605['as'],'attributes':_0x3de605[_0x74d4('0x1f')],'include':_0x3de605['include']?_[_0x74d4('0x1e')](_0x3de605[_0x74d4('0x1d')],function(_0x461bf1){return{'model':db[_0x461bf1['model']],'as':_0x461bf1['as'],'attributes':_0x461bf1[_0x74d4('0x1f')],'include':_0x461bf1[_0x74d4('0x1d')]?_['map'](_0x461bf1[_0x74d4('0x1d')],function(_0x4256f7){return{'model':db[_0x4256f7['model']],'as':_0x4256f7['as'],'attributes':_0x4256f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x74d4('0x22')](function(_0x44cb73){logger[_0x74d4('0xd')](_0x74d4('0x21'),_0x5c7b59);logger[_0x74d4('0x23')](_0x74d4('0x21'),_0x5c7b59,JSON[_0x74d4('0x11')](_0x44cb73));_0x3a0913(_0x44cb73);})[_0x74d4('0x16')](function(_0x92dbc4){logger[_0x74d4('0x12')]('ShowCmHopper',_0x92dbc4['message'],_0x5c7b59);_0x2e9dff(_0x154bea['error'](0x1f4,_0x92dbc4[_0x74d4('0x14')]));});});};exports['CreateCmHopper']=function(_0x3f32a6){var _0x221bcb=this;return new Promise(function(_0x597218,_0x3c7dcd){return db[_0x74d4('0x18')][_0x74d4('0x24')](_0x3f32a6[_0x74d4('0x25')],{'raw':_0x3f32a6[_0x74d4('0x1a')]?_0x3f32a6[_0x74d4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x74d4('0x22')](function(_0x275dc7){logger[_0x74d4('0xd')](_0x74d4('0x26'),_0x3f32a6);logger[_0x74d4('0x23')](_0x74d4('0x26'),_0x3f32a6,JSON[_0x74d4('0x11')](_0x275dc7));_0x597218(_0x275dc7);})[_0x74d4('0x16')](function(_0x3330f4){logger[_0x74d4('0x12')]('CreateCmHopper',_0x3330f4['message'],_0x3f32a6);_0x3c7dcd(_0x221bcb[_0x74d4('0x12')](0x1f4,_0x3330f4[_0x74d4('0x14')]));});});};exports[_0x74d4('0x27')]=function(_0x3c92d0){var _0x4a5c61=this;return new Promise(function(_0x3c565a,_0x2d33aa){return db[_0x74d4('0x18')]['update'](_0x3c92d0[_0x74d4('0x25')],{'raw':_0x3c92d0[_0x74d4('0x1a')]?_0x3c92d0[_0x74d4('0x1a')][_0x74d4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c92d0['options']?_0x3c92d0[_0x74d4('0x1a')]['where']||null:null,'attributes':_0x3c92d0[_0x74d4('0x1a')]?_0x3c92d0[_0x74d4('0x1a')]['attributes']||null:null,'limit':_0x3c92d0[_0x74d4('0x1a')]?_0x3c92d0[_0x74d4('0x1a')][_0x74d4('0x28')]||null:null})[_0x74d4('0x22')](function(_0x11c448){logger[_0x74d4('0xd')](_0x74d4('0x27'),_0x3c92d0);logger[_0x74d4('0x23')]('UpdateCmHopper',_0x3c92d0,JSON[_0x74d4('0x11')](_0x11c448));_0x3c565a(_0x11c448);})['catch'](function(_0x3982a9){logger[_0x74d4('0x12')](_0x74d4('0x27'),_0x3982a9[_0x74d4('0x14')],_0x3c92d0);_0x2d33aa(_0x4a5c61[_0x74d4('0x12')](0x1f4,_0x3982a9['message']));});});};exports[_0x74d4('0x29')]=function(_0x263b37){var _0x2ce0cc=this;return new Promise(function(_0x2cb6a1,_0x458c78){return db[_0x74d4('0x18')][_0x74d4('0x2a')]({'where':_0x263b37[_0x74d4('0x1a')]?_0x263b37[_0x74d4('0x1a')]['where']||null:null})[_0x74d4('0x22')](function(_0x4423dc){logger[_0x74d4('0xd')](_0x74d4('0x29'),_0x263b37);logger['debug'](_0x74d4('0x29'),_0x263b37,JSON[_0x74d4('0x11')](_0x4423dc));_0x2cb6a1(_0x4423dc);})[_0x74d4('0x16')](function(_0x1727c6){logger['error'](_0x74d4('0x29'),_0x1727c6['message'],_0x263b37);_0x458c78(_0x2ce0cc[_0x74d4('0x12')](0x1f4,_0x1727c6[_0x74d4('0x14')]));});});};exports[_0x74d4('0x2b')]=function(_0x493168){var _0x3a65da=this;return new Promise(function(_0x310ed1,_0x2cfcf0){return db[_0x74d4('0x2c')]['describe']()[_0x74d4('0x22')](function(_0x34f402){return db[_0x74d4('0x2d')][_0x74d4('0x2e')](function(_0x3ed7b4){return db[_0x74d4('0x18')][_0x74d4('0x19')]({'where':_0x493168[_0x74d4('0x1a')]?_0x493168[_0x74d4('0x1a')][_0x74d4('0x1c')]||null:null,'attributes':_0x493168['options']?_0x493168[_0x74d4('0x1a')][_0x74d4('0x1f')]||null:null,'limit':_0x493168[_0x74d4('0x1a')]?_0x493168[_0x74d4('0x1a')]['limit']||null:null,'order':_0x493168['options']?_0x493168[_0x74d4('0x1a')]['order']||null:null,'transaction':_0x3ed7b4,'lock':_0x3ed7b4[_0x74d4('0x2f')]['UPDATE'],'include':[{'model':db[_0x74d4('0x2c')],'as':'Contact','attributes':_['keys'](_0x34f402)},{'model':db[_0x74d4('0x30')],'as':'Agent','attributes':['id',_0x74d4('0x31'),_0x74d4('0x32')]}]})[_0x74d4('0x22')](function(_0xe9f1b3){var _0x5b97a1=[];var _0x2ac491=[];for(var _0x461803=0x0;_0x461803<_0xe9f1b3[_0x74d4('0x33')];_0x461803+=0x1){if(!_0x2ac491[_0x74d4('0x34')](_0xe9f1b3[_0x461803][_0x74d4('0x35')])){_0x2ac491[_0x74d4('0x36')](_0xe9f1b3[_0x461803][_0x74d4('0x35')]);_0x5b97a1[_0x74d4('0x36')](_0xe9f1b3[_0x461803][_0x74d4('0x37')](_0x493168[_0x74d4('0x25')],{'transaction':_0x3ed7b4}));}}return BPromise[_0x74d4('0x38')](_0x5b97a1);});})[_0x74d4('0x22')](function(_0x4b5a97){logger[_0x74d4('0xd')](_0x74d4('0x2b'),_0x493168);logger['debug'](_0x74d4('0x2b'),_0x493168,JSON[_0x74d4('0x11')](_0x4b5a97));_0x310ed1(_0x4b5a97);})[_0x74d4('0x16')](function(_0x165de4){logger[_0x74d4('0x12')](_0x74d4('0x2b'),_0x165de4[_0x74d4('0x14')],_0x493168);_0x2cfcf0(_0x3a65da[_0x74d4('0x12')](0x1f4,_0x165de4[_0x74d4('0x14')]));});});});};exports[_0x74d4('0x39')]=function(_0x76d09d){var _0x412a6e=this;return new Promise(function(_0x1c7f50,_0x24a661){return db['sequelize'][_0x74d4('0x2e')](function(_0xdc488e){return db['CmHopperFinal'][_0x74d4('0x24')](_0x76d09d[_0x74d4('0x25')],{'raw':_0x76d09d[_0x74d4('0x1a')]?_0x76d09d['options']['raw']===undefined?!![]:![]:!![],'transaction':_0xdc488e})['then'](function(){return db[_0x74d4('0x18')][_0x74d4('0x2a')]({'where':_0x76d09d[_0x74d4('0x1a')]?_0x76d09d[_0x74d4('0x1a')][_0x74d4('0x1c')]||null:null,'transaction':_0xdc488e});});})[_0x74d4('0x22')](function(_0x48ed60){logger[_0x74d4('0xd')]('MoveContactManagedDialer',_0x76d09d);logger[_0x74d4('0x23')](_0x74d4('0x39'),_0x76d09d,JSON[_0x74d4('0x11')](_0x48ed60));_0x1c7f50(_0x48ed60);})['catch'](function(_0x2e51f6){logger[_0x74d4('0x12')]('MoveContactManagedDialer',_0x2e51f6[_0x74d4('0x14')],_0x76d09d);_0x24a661(_0x412a6e['error'](0x1f4,_0x2e51f6[_0x74d4('0x14')]));});});};exports[_0x74d4('0x3a')]=function(_0x44a126){var _0x25a739=this;return new Promise(function(_0x4e2f6b,_0x4a10cb){return db['CmHopper'][_0x74d4('0x19')]({'raw':_0x44a126[_0x74d4('0x1a')]?_0x44a126[_0x74d4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x44a126[_0x74d4('0x1a')]?_0x44a126['options']['where']||null:null,'attributes':[[db[_0x74d4('0x2d')]['fn'](_0x74d4('0x3b'),db[_0x74d4('0x2d')]['fn']('IF',db[_0x74d4('0x2d')][_0x74d4('0x3c')]('`scheduledat`\x20>=\x20'+util[_0x74d4('0x3d')](_0x74d4('0x3e'),moment()[_0x74d4('0x3d')](_0x74d4('0x3f')))+_0x74d4('0x40')))),_0x74d4('0x41')]]})[_0x74d4('0x22')](function(_0x57ec26){logger[_0x74d4('0xd')](_0x74d4('0x3a'),_0x44a126);logger[_0x74d4('0x23')](_0x74d4('0x3a'),_0x44a126,JSON[_0x74d4('0x11')](_0x57ec26));_0x4e2f6b(_0x57ec26);})['catch'](function(_0xdb93f4){logger['error']('CountReScheduled',_0xdb93f4[_0x74d4('0x14')],_0x44a126);_0x4a10cb(_0x25a739[_0x74d4('0x12')](0x1f4,_0xdb93f4[_0x74d4('0x14')]));});});};exports[_0x74d4('0x42')]=function(_0x8e679){var _0x5bdc65=this;return new Promise(function(_0x5e68f3,_0x5ee103){return db['CmContact'][_0x74d4('0x43')]()['then'](function(_0x3de25a){return db[_0x74d4('0x2d')][_0x74d4('0x2e')](function(_0x523b3d){return db['CmHopper'][_0x74d4('0x19')]({'where':_0x8e679['options']?_0x8e679[_0x74d4('0x1a')][_0x74d4('0x1c')]||null:null,'attributes':_0x8e679[_0x74d4('0x1a')]?_0x8e679['options'][_0x74d4('0x1f')]||null:null,'limit':0x1,'order':_0x8e679[_0x74d4('0x1a')]?_0x8e679['options'][_0x74d4('0x44')]||null:null,'group':db[_0x74d4('0x18')]['UserId'],'transaction':_0x523b3d,'lock':_0x523b3d[_0x74d4('0x2f')][_0x74d4('0x45')],'include':_0x8e679[_0x74d4('0x1a')]?_0x8e679['options']['include']?_[_0x74d4('0x1e')](_0x8e679[_0x74d4('0x1a')][_0x74d4('0x1d')],function(_0x28e996){return{'model':db[_0x28e996[_0x74d4('0x20')]],'as':_0x28e996['as'],'attributes':_0x28e996['attributes'],'include':_0x28e996[_0x74d4('0x1d')]?_['map'](_0x28e996[_0x74d4('0x1d')],function(_0x54b44e){return{'model':db[_0x54b44e[_0x74d4('0x20')]],'as':_0x54b44e['as'],'attributes':_0x54b44e['attributes'],'include':_0x54b44e[_0x74d4('0x1d')]?_[_0x74d4('0x1e')](_0x54b44e[_0x74d4('0x1d')],function(_0xde7d22){return{'model':db[_0xde7d22[_0x74d4('0x20')]],'as':_0xde7d22['as'],'attributes':_0xde7d22['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a0a1c){var _0x50ccf4=[];for(var _0x5c87b1=0x0;_0x5c87b1<_0x1a0a1c[_0x74d4('0x33')];_0x5c87b1+=0x1){_0x50ccf4[_0x74d4('0x36')](_0x1a0a1c[_0x5c87b1][_0x74d4('0x37')](_0x8e679[_0x74d4('0x25')],{'transaction':_0x523b3d}));}return BPromise[_0x74d4('0x38')](_0x50ccf4);});})['then'](function(_0x48170d){logger['info'](_0x74d4('0x42'),_0x8e679);logger[_0x74d4('0x23')](_0x74d4('0x42'),_0x8e679,JSON['stringify'](_0x48170d));_0x5e68f3(_0x48170d);})['catch'](function(_0x2123e2){logger[_0x74d4('0x12')](_0x74d4('0x42'),_0x2123e2['message'],_0x8e679);_0x5ee103(_0x5bdc65['error'](0x1f4,_0x2123e2[_0x74d4('0x14')]));});});});};exports[_0x74d4('0x46')]=function(_0x1a8edb){var _0x2ffe85=this;return new Promise(function(_0x357cbf,_0x3a7149){db[_0x74d4('0x2c')][_0x74d4('0x43')]()[_0x74d4('0x22')](function(_0x19b017){return db[_0x74d4('0x18')][_0x74d4('0x19')]({'raw':_0x1a8edb[_0x74d4('0x1a')]?_0x1a8edb['options'][_0x74d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x1a8edb[_0x74d4('0x1a')]?_0x1a8edb[_0x74d4('0x1a')]['where']||null:null,'attributes':_0x1a8edb[_0x74d4('0x1a')]?_0x1a8edb[_0x74d4('0x1a')][_0x74d4('0x1f')]||null:null,'limit':_0x1a8edb['options']?_0x1a8edb['options'][_0x74d4('0x28')]||null:null,'include':_0x1a8edb['options']?_0x1a8edb['options']['include']?_['map'](_0x1a8edb[_0x74d4('0x1a')]['include'],function(_0x26d057){return{'model':db[_0x26d057['model']],'as':_0x26d057['as'],'attributes':_0x26d057['as']==='Contact'?_[_0x74d4('0x47')](_0x19b017):_0x26d057[_0x74d4('0x1f')],'include':_0x26d057['include']?_[_0x74d4('0x1e')](_0x26d057[_0x74d4('0x1d')],function(_0x20872a){return{'model':db[_0x20872a['model']],'as':_0x20872a['as'],'attributes':_0x20872a[_0x74d4('0x1f')],'include':_0x20872a[_0x74d4('0x1d')]?_[_0x74d4('0x1e')](_0x20872a[_0x74d4('0x1d')],function(_0x3a249a){return{'model':db[_0x3a249a[_0x74d4('0x20')]],'as':_0x3a249a['as'],'attributes':_0x3a249a[_0x74d4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x74d4('0x22')](function(_0x3ead4d){logger['info'](_0x74d4('0x17'),_0x1a8edb);logger[_0x74d4('0x23')](_0x74d4('0x17'),_0x1a8edb,JSON[_0x74d4('0x11')](_0x3ead4d));_0x357cbf(_0x3ead4d);})[_0x74d4('0x16')](function(_0x183a97){logger[_0x74d4('0x12')](_0x74d4('0x17'),_0x183a97[_0x74d4('0x14')],_0x1a8edb);_0x3a7149(_0x2ffe85[_0x74d4('0x12')](0x1f4,_0x183a97[_0x74d4('0x14')]));});});});}; \ No newline at end of file +var _0xc221=['length','UserId','push','update','all','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowCmHopper','CmHopper','find','CreateCmHopper','create','UpdateCmHopper','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','order','LOCK','Contact','keys','User','Agent','name','voicePause'];(function(_0x5ec15d,_0xcd4a96){var _0x40d583=function(_0x352ffc){while(--_0x352ffc){_0x5ec15d['push'](_0x5ec15d['shift']());}};_0x40d583(++_0xcd4a96);}(_0xc221,0x12c));var _0x1c22=function(_0x375e11,_0x2a75cb){_0x375e11=_0x375e11-0x0;var _0x48c531=_0xc221[_0x375e11];return _0x48c531;};'use strict';var _=require(_0x1c22('0x0'));var util=require(_0x1c22('0x1'));var moment=require('moment');var BPromise=require(_0x1c22('0x2'));var rs=require(_0x1c22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c22('0x4'))['db'];var utils=require(_0x1c22('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1c22('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x183b63,_0x30ee9c,_0x518b2e){return new BPromise(function(_0x14a264,_0x798525){return client[_0x1c22('0x7')](_0x183b63,_0x518b2e)['then'](function(_0x10235a){logger[_0x1c22('0x8')](_0x1c22('0x9'),_0x30ee9c,_0x1c22('0xa'));logger[_0x1c22('0xb')](_0x1c22('0xc'),_0x30ee9c,_0x1c22('0xa'),JSON[_0x1c22('0xd')](_0x10235a));if(_0x10235a[_0x1c22('0xe')]){if(_0x10235a[_0x1c22('0xe')][_0x1c22('0xf')]===0x1f4){logger[_0x1c22('0xe')](_0x1c22('0x9'),_0x30ee9c,_0x10235a[_0x1c22('0xe')][_0x1c22('0x10')]);return _0x798525(_0x10235a[_0x1c22('0xe')][_0x1c22('0x10')]);}logger[_0x1c22('0xe')](_0x1c22('0x9'),_0x30ee9c,_0x10235a[_0x1c22('0xe')]['message']);return _0x14a264(_0x10235a['error'][_0x1c22('0x10')]);}else{logger[_0x1c22('0x8')](_0x1c22('0x9'),_0x30ee9c,_0x1c22('0xa'));_0x14a264(_0x10235a[_0x1c22('0x11')][_0x1c22('0x10')]);}})[_0x1c22('0x12')](function(_0x4c8c04){logger[_0x1c22('0xe')]('CmHopper,\x20%s,\x20%s',_0x30ee9c,_0x4c8c04);_0x798525(_0x4c8c04);});});}exports[_0x1c22('0x13')]=function(_0xc29def){var _0x4e0416=this;return new Promise(function(_0x54dd7f,_0x41f577){return db['CmHopper'][_0x1c22('0x14')]({'raw':_0xc29def[_0x1c22('0x15')]?_0xc29def[_0x1c22('0x15')][_0x1c22('0x16')]===undefined?!![]:![]:!![],'where':_0xc29def[_0x1c22('0x15')]?_0xc29def[_0x1c22('0x15')][_0x1c22('0x17')]||null:null,'attributes':_0xc29def[_0x1c22('0x15')]?_0xc29def[_0x1c22('0x15')][_0x1c22('0x18')]||null:null,'limit':_0xc29def[_0x1c22('0x15')]?_0xc29def[_0x1c22('0x15')][_0x1c22('0x19')]||null:null,'include':_0xc29def[_0x1c22('0x15')]?_0xc29def['options']['include']?_[_0x1c22('0x1a')](_0xc29def['options'][_0x1c22('0x1b')],function(_0x58b0c0){return{'model':db[_0x58b0c0[_0x1c22('0x1c')]],'as':_0x58b0c0['as'],'attributes':_0x58b0c0[_0x1c22('0x18')],'include':_0x58b0c0[_0x1c22('0x1b')]?_[_0x1c22('0x1a')](_0x58b0c0[_0x1c22('0x1b')],function(_0x1e726d){return{'model':db[_0x1e726d['model']],'as':_0x1e726d['as'],'attributes':_0x1e726d[_0x1c22('0x18')],'include':_0x1e726d['include']?_[_0x1c22('0x1a')](_0x1e726d['include'],function(_0x4670c9){return{'model':db[_0x4670c9[_0x1c22('0x1c')]],'as':_0x4670c9['as'],'attributes':_0x4670c9[_0x1c22('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1c22('0x1d')](function(_0x456cf0){logger[_0x1c22('0x8')](_0x1c22('0x13'),_0xc29def);logger[_0x1c22('0xb')](_0x1c22('0x13'),_0xc29def,JSON[_0x1c22('0xd')](_0x456cf0));_0x54dd7f(_0x456cf0);})[_0x1c22('0x12')](function(_0x4b107a){logger[_0x1c22('0xe')](_0x1c22('0x13'),_0x4b107a['message'],_0xc29def);_0x41f577(_0x4e0416[_0x1c22('0xe')](0x1f4,_0x4b107a['message']));});});};exports[_0x1c22('0x1e')]=function(_0x2ad424){var _0x3c14b2=this;return new Promise(function(_0x201a00,_0x1cbdae){return db[_0x1c22('0x1f')][_0x1c22('0x20')]({'raw':_0x2ad424[_0x1c22('0x15')]?_0x2ad424[_0x1c22('0x15')][_0x1c22('0x16')]===undefined?!![]:![]:!![],'where':_0x2ad424[_0x1c22('0x15')]?_0x2ad424[_0x1c22('0x15')][_0x1c22('0x17')]||null:null,'attributes':_0x2ad424[_0x1c22('0x15')]?_0x2ad424[_0x1c22('0x15')][_0x1c22('0x18')]||null:null,'include':_0x2ad424[_0x1c22('0x15')]?_0x2ad424['options'][_0x1c22('0x1b')]?_[_0x1c22('0x1a')](_0x2ad424[_0x1c22('0x15')]['include'],function(_0x44b7de){return{'model':db[_0x44b7de['model']],'as':_0x44b7de['as'],'attributes':_0x44b7de[_0x1c22('0x18')],'include':_0x44b7de[_0x1c22('0x1b')]?_[_0x1c22('0x1a')](_0x44b7de[_0x1c22('0x1b')],function(_0x48219b){return{'model':db[_0x48219b[_0x1c22('0x1c')]],'as':_0x48219b['as'],'attributes':_0x48219b['attributes'],'include':_0x48219b['include']?_[_0x1c22('0x1a')](_0x48219b['include'],function(_0x1516ed){return{'model':db[_0x1516ed[_0x1c22('0x1c')]],'as':_0x1516ed['as'],'attributes':_0x1516ed[_0x1c22('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1c22('0x1d')](function(_0x3d4e94){logger[_0x1c22('0x8')](_0x1c22('0x1e'),_0x2ad424);logger[_0x1c22('0xb')](_0x1c22('0x1e'),_0x2ad424,JSON[_0x1c22('0xd')](_0x3d4e94));_0x201a00(_0x3d4e94);})['catch'](function(_0x23edd1){logger[_0x1c22('0xe')](_0x1c22('0x1e'),_0x23edd1[_0x1c22('0x10')],_0x2ad424);_0x1cbdae(_0x3c14b2[_0x1c22('0xe')](0x1f4,_0x23edd1['message']));});});};exports[_0x1c22('0x21')]=function(_0x5c91d2){var _0xd6a59f=this;return new Promise(function(_0x30d641,_0x53fd6b){return db[_0x1c22('0x1f')][_0x1c22('0x22')](_0x5c91d2['body'],{'raw':_0x5c91d2[_0x1c22('0x15')]?_0x5c91d2[_0x1c22('0x15')][_0x1c22('0x16')]===undefined?!![]:![]:!![]})[_0x1c22('0x1d')](function(_0x506213){logger[_0x1c22('0x8')](_0x1c22('0x21'),_0x5c91d2);logger['debug'](_0x1c22('0x21'),_0x5c91d2,JSON[_0x1c22('0xd')](_0x506213));_0x30d641(_0x506213);})[_0x1c22('0x12')](function(_0x2c597e){logger[_0x1c22('0xe')]('CreateCmHopper',_0x2c597e['message'],_0x5c91d2);_0x53fd6b(_0xd6a59f[_0x1c22('0xe')](0x1f4,_0x2c597e[_0x1c22('0x10')]));});});};exports[_0x1c22('0x23')]=function(_0x4a017e){var _0x5618a2=this;return new Promise(function(_0x5c0636,_0x7144a){return db[_0x1c22('0x1f')]['update'](_0x4a017e[_0x1c22('0x24')],{'raw':_0x4a017e[_0x1c22('0x15')]?_0x4a017e[_0x1c22('0x15')][_0x1c22('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a017e[_0x1c22('0x15')]?_0x4a017e[_0x1c22('0x15')]['where']||null:null,'attributes':_0x4a017e[_0x1c22('0x15')]?_0x4a017e[_0x1c22('0x15')][_0x1c22('0x18')]||null:null,'limit':_0x4a017e[_0x1c22('0x15')]?_0x4a017e[_0x1c22('0x15')][_0x1c22('0x19')]||null:null})[_0x1c22('0x1d')](function(_0x2deb91){logger[_0x1c22('0x8')]('UpdateCmHopper',_0x4a017e);logger['debug']('UpdateCmHopper',_0x4a017e,JSON[_0x1c22('0xd')](_0x2deb91));_0x5c0636(_0x2deb91);})[_0x1c22('0x12')](function(_0x4c732e){logger[_0x1c22('0xe')](_0x1c22('0x23'),_0x4c732e[_0x1c22('0x10')],_0x4a017e);_0x7144a(_0x5618a2[_0x1c22('0xe')](0x1f4,_0x4c732e[_0x1c22('0x10')]));});});};exports[_0x1c22('0x25')]=function(_0xf2dcd5){var _0x250f0e=this;return new Promise(function(_0x5a7251,_0x55a87b){return db[_0x1c22('0x1f')][_0x1c22('0x26')]({'where':_0xf2dcd5[_0x1c22('0x15')]?_0xf2dcd5[_0x1c22('0x15')][_0x1c22('0x17')]||null:null})['then'](function(_0x5d4c7e){logger[_0x1c22('0x8')](_0x1c22('0x25'),_0xf2dcd5);logger['debug'](_0x1c22('0x25'),_0xf2dcd5,JSON['stringify'](_0x5d4c7e));_0x5a7251(_0x5d4c7e);})[_0x1c22('0x12')](function(_0x5e806e){logger[_0x1c22('0xe')](_0x1c22('0x25'),_0x5e806e[_0x1c22('0x10')],_0xf2dcd5);_0x55a87b(_0x250f0e[_0x1c22('0xe')](0x1f4,_0x5e806e[_0x1c22('0x10')]));});});};exports[_0x1c22('0x27')]=function(_0x41c358){var _0x2d1a05=this;return new Promise(function(_0x17314e,_0x9a6b38){return db[_0x1c22('0x28')][_0x1c22('0x29')]()[_0x1c22('0x1d')](function(_0x494ff9){return db['sequelize']['transaction'](function(_0x1f73c0){return db[_0x1c22('0x1f')][_0x1c22('0x14')]({'where':_0x41c358[_0x1c22('0x15')]?_0x41c358[_0x1c22('0x15')]['where']||null:null,'attributes':_0x41c358['options']?_0x41c358[_0x1c22('0x15')][_0x1c22('0x18')]||null:null,'limit':_0x41c358[_0x1c22('0x15')]?_0x41c358[_0x1c22('0x15')][_0x1c22('0x19')]||null:null,'order':_0x41c358[_0x1c22('0x15')]?_0x41c358[_0x1c22('0x15')][_0x1c22('0x2a')]||null:null,'transaction':_0x1f73c0,'lock':_0x1f73c0[_0x1c22('0x2b')]['UPDATE'],'include':[{'model':db[_0x1c22('0x28')],'as':_0x1c22('0x2c'),'attributes':_[_0x1c22('0x2d')](_0x494ff9)},{'model':db[_0x1c22('0x2e')],'as':_0x1c22('0x2f'),'attributes':['id',_0x1c22('0x30'),_0x1c22('0x31')]}]})[_0x1c22('0x1d')](function(_0x4b4ba6){var _0x59c6d1=[];var _0x2eda98=[];for(var _0x25de84=0x0;_0x25de84<_0x4b4ba6[_0x1c22('0x32')];_0x25de84+=0x1){if(!_0x2eda98['includes'](_0x4b4ba6[_0x25de84][_0x1c22('0x33')])){_0x2eda98[_0x1c22('0x34')](_0x4b4ba6[_0x25de84]['UserId']);_0x59c6d1[_0x1c22('0x34')](_0x4b4ba6[_0x25de84][_0x1c22('0x35')](_0x41c358[_0x1c22('0x24')],{'transaction':_0x1f73c0}));}}return BPromise[_0x1c22('0x36')](_0x59c6d1);});})['then'](function(_0x416961){logger[_0x1c22('0x8')](_0x1c22('0x27'),_0x41c358);logger[_0x1c22('0xb')](_0x1c22('0x27'),_0x41c358,JSON[_0x1c22('0xd')](_0x416961));_0x17314e(_0x416961);})[_0x1c22('0x12')](function(_0x3e9339){logger[_0x1c22('0xe')](_0x1c22('0x27'),_0x3e9339[_0x1c22('0x10')],_0x41c358);_0x9a6b38(_0x2d1a05[_0x1c22('0xe')](0x1f4,_0x3e9339[_0x1c22('0x10')]));});});});};exports[_0x1c22('0x37')]=function(_0x2676e9){var _0x2409c9=this;return new Promise(function(_0x5c698f,_0x2d76df){return db[_0x1c22('0x38')][_0x1c22('0x39')](function(_0x2c761e){return db[_0x1c22('0x3a')][_0x1c22('0x22')](_0x2676e9['body'],{'raw':_0x2676e9[_0x1c22('0x15')]?_0x2676e9[_0x1c22('0x15')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2c761e})[_0x1c22('0x1d')](function(){return db['CmHopper'][_0x1c22('0x26')]({'where':_0x2676e9['options']?_0x2676e9[_0x1c22('0x15')][_0x1c22('0x17')]||null:null,'transaction':_0x2c761e});});})['then'](function(_0x432f51){logger[_0x1c22('0x8')]('MoveContactManagedDialer',_0x2676e9);logger[_0x1c22('0xb')](_0x1c22('0x37'),_0x2676e9,JSON[_0x1c22('0xd')](_0x432f51));_0x5c698f(_0x432f51);})[_0x1c22('0x12')](function(_0x1a0024){logger[_0x1c22('0xe')]('MoveContactManagedDialer',_0x1a0024['message'],_0x2676e9);_0x2d76df(_0x2409c9['error'](0x1f4,_0x1a0024[_0x1c22('0x10')]));});});};exports[_0x1c22('0x3b')]=function(_0x23282c){var _0x4c1458=this;return new Promise(function(_0x2dc515,_0x8bee0d){return db[_0x1c22('0x1f')][_0x1c22('0x14')]({'raw':_0x23282c[_0x1c22('0x15')]?_0x23282c[_0x1c22('0x15')][_0x1c22('0x16')]===undefined?!![]:![]:!![],'where':_0x23282c['options']?_0x23282c[_0x1c22('0x15')][_0x1c22('0x17')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1c22('0x3c'),db[_0x1c22('0x38')]['fn']('IF',db[_0x1c22('0x38')][_0x1c22('0x3d')](_0x1c22('0x3e')+util[_0x1c22('0x3f')](_0x1c22('0x40'),moment()['format'](_0x1c22('0x41')))+'\x20,\x201,\x20null'))),_0x1c22('0x42')]]})[_0x1c22('0x1d')](function(_0x2bda89){logger[_0x1c22('0x8')](_0x1c22('0x3b'),_0x23282c);logger[_0x1c22('0xb')](_0x1c22('0x3b'),_0x23282c,JSON[_0x1c22('0xd')](_0x2bda89));_0x2dc515(_0x2bda89);})['catch'](function(_0x5924b1){logger[_0x1c22('0xe')]('CountReScheduled',_0x5924b1[_0x1c22('0x10')],_0x23282c);_0x8bee0d(_0x4c1458['error'](0x1f4,_0x5924b1[_0x1c22('0x10')]));});});};exports[_0x1c22('0x43')]=function(_0x495f01){var _0x23082d=this;return new Promise(function(_0x188d4c,_0xa1b07b){return db[_0x1c22('0x28')]['describe']()[_0x1c22('0x1d')](function(_0x114c98){return db[_0x1c22('0x38')][_0x1c22('0x39')](function(_0x2454fa){return db[_0x1c22('0x1f')]['findAll']({'where':_0x495f01['options']?_0x495f01[_0x1c22('0x15')][_0x1c22('0x17')]||null:null,'attributes':_0x495f01['options']?_0x495f01['options']['attributes']||null:null,'limit':0x1,'order':_0x495f01[_0x1c22('0x15')]?_0x495f01[_0x1c22('0x15')][_0x1c22('0x2a')]||null:null,'group':db[_0x1c22('0x1f')]['UserId'],'transaction':_0x2454fa,'lock':_0x2454fa['LOCK'][_0x1c22('0x44')],'include':_0x495f01['options']?_0x495f01[_0x1c22('0x15')]['include']?_['map'](_0x495f01['options'][_0x1c22('0x1b')],function(_0x226f20){return{'model':db[_0x226f20[_0x1c22('0x1c')]],'as':_0x226f20['as'],'attributes':_0x226f20[_0x1c22('0x18')],'include':_0x226f20[_0x1c22('0x1b')]?_[_0x1c22('0x1a')](_0x226f20[_0x1c22('0x1b')],function(_0x16241c){return{'model':db[_0x16241c[_0x1c22('0x1c')]],'as':_0x16241c['as'],'attributes':_0x16241c['attributes'],'include':_0x16241c['include']?_[_0x1c22('0x1a')](_0x16241c['include'],function(_0xb73133){return{'model':db[_0xb73133[_0x1c22('0x1c')]],'as':_0xb73133['as'],'attributes':_0xb73133[_0x1c22('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1c22('0x1d')](function(_0x372946){var _0xba78ee=[];for(var _0x37fd67=0x0;_0x37fd67<_0x372946[_0x1c22('0x32')];_0x37fd67+=0x1){_0xba78ee[_0x1c22('0x34')](_0x372946[_0x37fd67]['update'](_0x495f01['body'],{'transaction':_0x2454fa}));}return BPromise[_0x1c22('0x36')](_0xba78ee);});})[_0x1c22('0x1d')](function(_0x3b9e51){logger[_0x1c22('0x8')](_0x1c22('0x43'),_0x495f01);logger[_0x1c22('0xb')]('GetContactRecallMe',_0x495f01,JSON[_0x1c22('0xd')](_0x3b9e51));_0x188d4c(_0x3b9e51);})[_0x1c22('0x12')](function(_0x3bbb63){logger[_0x1c22('0xe')]('GetContactRecallMe',_0x3bbb63['message'],_0x495f01);_0xa1b07b(_0x23082d[_0x1c22('0xe')](0x1f4,_0x3bbb63['message']));});});});};exports[_0x1c22('0x45')]=function(_0x3de7c2){var _0x43b889=this;return new Promise(function(_0x54dbd6,_0x4bdb23){db[_0x1c22('0x28')][_0x1c22('0x29')]()['then'](function(_0x444de5){return db[_0x1c22('0x1f')][_0x1c22('0x14')]({'raw':_0x3de7c2[_0x1c22('0x15')]?_0x3de7c2[_0x1c22('0x15')][_0x1c22('0x16')]===undefined?!![]:![]:!![],'where':_0x3de7c2['options']?_0x3de7c2['options'][_0x1c22('0x17')]||null:null,'attributes':_0x3de7c2['options']?_0x3de7c2[_0x1c22('0x15')]['attributes']||null:null,'limit':_0x3de7c2['options']?_0x3de7c2['options'][_0x1c22('0x19')]||null:null,'include':_0x3de7c2[_0x1c22('0x15')]?_0x3de7c2[_0x1c22('0x15')][_0x1c22('0x1b')]?_[_0x1c22('0x1a')](_0x3de7c2['options'][_0x1c22('0x1b')],function(_0x23c152){return{'model':db[_0x23c152[_0x1c22('0x1c')]],'as':_0x23c152['as'],'attributes':_0x23c152['as']===_0x1c22('0x2c')?_[_0x1c22('0x2d')](_0x444de5):_0x23c152[_0x1c22('0x18')],'include':_0x23c152[_0x1c22('0x1b')]?_[_0x1c22('0x1a')](_0x23c152[_0x1c22('0x1b')],function(_0x686bb1){return{'model':db[_0x686bb1[_0x1c22('0x1c')]],'as':_0x686bb1['as'],'attributes':_0x686bb1[_0x1c22('0x18')],'include':_0x686bb1[_0x1c22('0x1b')]?_[_0x1c22('0x1a')](_0x686bb1[_0x1c22('0x1b')],function(_0x774028){return{'model':db[_0x774028['model']],'as':_0x774028['as'],'attributes':_0x774028[_0x1c22('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1c22('0x1d')](function(_0x3ac23b){logger[_0x1c22('0x8')](_0x1c22('0x13'),_0x3de7c2);logger[_0x1c22('0xb')](_0x1c22('0x13'),_0x3de7c2,JSON['stringify'](_0x3ac23b));_0x54dbd6(_0x3ac23b);})[_0x1c22('0x12')](function(_0x442165){logger[_0x1c22('0xe')](_0x1c22('0x13'),_0x442165['message'],_0x3de7c2);_0x4bdb23(_0x43b889[_0x1c22('0xe')](0x1f4,_0x442165['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 58de3b7..ddd3a17 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 _0xdb28=['getOpenContacts','show','post','create','getPreview','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','describe','get','/opencontacts'];(function(_0xe2ac4f,_0x39f810){var _0x530e4b=function(_0x40a281){while(--_0x40a281){_0xe2ac4f['push'](_0xe2ac4f['shift']());}};_0x530e4b(++_0x39f810);}(_0xdb28,0x106));var _0x8db2=function(_0x56737a,_0x384a22){_0x56737a=_0x56737a-0x0;var _0x549518=_0xdb28[_0x56737a];return _0x549518;};'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']('/describe',auth[_0x8db2('0x9')](),controller[_0x8db2('0xb')]);router[_0x8db2('0xc')](_0x8db2('0xd'),auth[_0x8db2('0x9')](),controller[_0x8db2('0xe')]);router[_0x8db2('0xc')]('/:id',auth[_0x8db2('0x9')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/',auth['isAuthenticated'](),controller[_0x8db2('0x11')]);router[_0x8db2('0x10')]('/preview',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 +var _0xb0ee=['/:id','show','post','create','/preview','getPreview','put','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0xb0ee,0x18f));var _0xeb0e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xb0ee[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require('multer');var util=require(_0xeb0e('0x0'));var path=require(_0xeb0e('0x1'));var timeout=require(_0xeb0e('0x2'));var express=require(_0xeb0e('0x3'));var router=express[_0xeb0e('0x4')]();var auth=require(_0xeb0e('0x5'));var interaction=require(_0xeb0e('0x6'));var config=require(_0xeb0e('0x7'));var controller=require(_0xeb0e('0x8'));router[_0xeb0e('0x9')]('/',auth['isAuthenticated'](),controller[_0xeb0e('0xa')]);router[_0xeb0e('0x9')](_0xeb0e('0xb'),auth[_0xeb0e('0xc')](),controller['describe']);router[_0xeb0e('0x9')](_0xeb0e('0xd'),auth[_0xeb0e('0xc')](),controller[_0xeb0e('0xe')]);router[_0xeb0e('0x9')](_0xeb0e('0xf'),auth[_0xeb0e('0xc')](),controller[_0xeb0e('0x10')]);router[_0xeb0e('0x11')]('/',auth[_0xeb0e('0xc')](),controller[_0xeb0e('0x12')]);router[_0xeb0e('0x11')](_0xeb0e('0x13'),auth[_0xeb0e('0xc')](),controller[_0xeb0e('0x14')]);router[_0xeb0e('0x15')](_0xeb0e('0xf'),auth[_0xeb0e('0xc')](),controller['update']);router['delete'](_0xeb0e('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb0e('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c62d5e8..7495aac 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 _0x51d1=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x49e3c7,_0x3ed22e){var _0x34c26d=function(_0x1802f1){while(--_0x1802f1){_0x49e3c7['push'](_0x49e3c7['shift']());}};_0x34c26d(++_0x3ed22e);}(_0x51d1,0x8c));var _0x151d=function(_0x550651,_0x32926b){_0x550651=_0x550651-0x0;var _0x53edcf=_0x51d1[_0x550651];return _0x53edcf;};'use strict';var moment=require(_0x151d('0x0'));var Sequelize=require(_0x151d('0x1'));module['exports']={'phone':{'type':Sequelize[_0x151d('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x151d('0x3')],'unique':_0x151d('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x151d('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x8c08=['INTEGER','contactListQueue','exports','STRING'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0x8c08,0x152));var _0x88c0=function(_0x1ae491,_0x5b83b9){_0x1ae491=_0x1ae491-0x0;var _0x4958a5=_0x8c08[_0x1ae491];return _0x4958a5;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x88c0('0x0')]={'phone':{'type':Sequelize[_0x88c0('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x88c0('0x2')],'unique':_0x88c0('0x3')},'ListId':{'type':Sequelize[_0x88c0('0x2')],'unique':_0x88c0('0x3')},'VoiceQueueId':{'type':Sequelize[_0x88c0('0x2')],'unique':_0x88c0('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9ec83ef..258acc4 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x3cbe23,_0x178c4f){var _0x160755=function(_0x19a576){while(--_0x19a576){_0x3cbe23['push'](_0x3cbe23['shift']());}};_0x160755(++_0x178c4f);}(_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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x46c297,_0x1adc53){var _0x198058=function(_0x430305){while(--_0x430305){_0x46c297['push'](_0x46c297['shift']());}};_0x198058(++_0x1adc53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 7b6e65d..514b2bb 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 _0x1ed0=['path','rimraf','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x1ed0,0xdd));var _0x01ed=function(_0x1bba6c,_0x1f94cf){_0x1bba6c=_0x1bba6c-0x0;var _0x415735=_0x1ed0[_0x1bba6c];return _0x415735;};'use strict';var _=require(_0x01ed('0x0'));var util=require(_0x01ed('0x1'));var logger=require(_0x01ed('0x2'))(_0x01ed('0x3'));var moment=require(_0x01ed('0x4'));var BPromise=require(_0x01ed('0x5'));var rp=require(_0x01ed('0x6'));var fs=require('fs');var path=require(_0x01ed('0x7'));var rimraf=require(_0x01ed('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x01ed('0x9')]=function(_0x9e1a53,_0xbf0c1c){return _0x9e1a53[_0x01ed('0xa')]('CmHopperBlack',attributes,{'tableName':_0x01ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5354=['cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack'];(function(_0x12b1a6,_0x22df2d){var _0x5813d3=function(_0x57773e){while(--_0x57773e){_0x12b1a6['push'](_0x12b1a6['shift']());}};_0x5813d3(++_0x22df2d);}(_0x5354,0x83));var _0x4535=function(_0x2d9933,_0xa4bfb0){_0x2d9933=_0x2d9933-0x0;var _0x59f6ae=_0x5354[_0x2d9933];return _0x59f6ae;};'use strict';var _=require(_0x4535('0x0'));var util=require(_0x4535('0x1'));var logger=require(_0x4535('0x2'))(_0x4535('0x3'));var moment=require(_0x4535('0x4'));var BPromise=require('bluebird');var rp=require(_0x4535('0x5'));var fs=require('fs');var path=require(_0x4535('0x6'));var rimraf=require(_0x4535('0x7'));var config=require(_0x4535('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x4535('0x9')]=function(_0x586e83,_0x1fa508){return _0x586e83[_0x4535('0xa')](_0x4535('0xb'),attributes,{'tableName':_0x4535('0xc'),'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 9963b52..0d263fb 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 _0x6cee=['stringify','UpdateCmHopperBlack','CmHopperBlack','body','debug','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetCmHopperBlack','findAll','options','raw','attributes','limit','include','model','map'];(function(_0x53c987,_0x9e3a2){var _0x13a5a4=function(_0x289045){while(--_0x289045){_0x53c987['push'](_0x53c987['shift']());}};_0x13a5a4(++_0x9e3a2);}(_0x6cee,0x138));var _0xe6ce=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x6cee[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xe6ce('0x0'));var util=require('util');var moment=require(_0xe6ce('0x1'));var BPromise=require(_0xe6ce('0x2'));var rs=require(_0xe6ce('0x3'));var fs=require('fs');var Redis=require(_0xe6ce('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6ce('0x5'));var logger=require(_0xe6ce('0x6'))('rpc');var config=require(_0xe6ce('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe6ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42a92e,_0x6ecfca,_0x28ea72){return new BPromise(function(_0x3d8198,_0x2ad82c){return client['request'](_0x42a92e,_0x28ea72)[_0xe6ce('0x9')](function(_0x2facf5){logger[_0xe6ce('0xa')](_0xe6ce('0xb'),_0x6ecfca,'request\x20sent');logger['debug'](_0xe6ce('0xc'),_0x6ecfca,_0xe6ce('0xd'),JSON['stringify'](_0x2facf5));if(_0x2facf5['error']){if(_0x2facf5[_0xe6ce('0xe')][_0xe6ce('0xf')]===0x1f4){logger[_0xe6ce('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x6ecfca,_0x2facf5[_0xe6ce('0xe')]['message']);return _0x2ad82c(_0x2facf5['error']['message']);}logger[_0xe6ce('0xe')](_0xe6ce('0xb'),_0x6ecfca,_0x2facf5[_0xe6ce('0xe')][_0xe6ce('0x10')]);return _0x3d8198(_0x2facf5[_0xe6ce('0xe')]['message']);}else{logger[_0xe6ce('0xa')](_0xe6ce('0xb'),_0x6ecfca,_0xe6ce('0xd'));_0x3d8198(_0x2facf5[_0xe6ce('0x11')][_0xe6ce('0x10')]);}})[_0xe6ce('0x12')](function(_0x2b02e8){logger[_0xe6ce('0xe')](_0xe6ce('0xb'),_0x6ecfca,_0x2b02e8);_0x2ad82c(_0x2b02e8);});});}exports[_0xe6ce('0x13')]=function(_0x29ba5e){var _0x458c71=this;return new Promise(function(_0x1c5d6a,_0x3df179){return db['CmHopperBlack'][_0xe6ce('0x14')]({'raw':_0x29ba5e[_0xe6ce('0x15')]?_0x29ba5e[_0xe6ce('0x15')][_0xe6ce('0x16')]===undefined?!![]:![]:!![],'where':_0x29ba5e[_0xe6ce('0x15')]?_0x29ba5e['options']['where']||null:null,'attributes':_0x29ba5e['options']?_0x29ba5e[_0xe6ce('0x15')][_0xe6ce('0x17')]||null:null,'limit':_0x29ba5e[_0xe6ce('0x15')]?_0x29ba5e[_0xe6ce('0x15')][_0xe6ce('0x18')]||null:null,'include':_0x29ba5e['options']?_0x29ba5e[_0xe6ce('0x15')]['include']?_['map'](_0x29ba5e[_0xe6ce('0x15')][_0xe6ce('0x19')],function(_0x15a89a){return{'model':db[_0x15a89a['model']],'as':_0x15a89a['as'],'attributes':_0x15a89a[_0xe6ce('0x17')],'include':_0x15a89a['include']?_['map'](_0x15a89a['include'],function(_0x1b3c88){return{'model':db[_0x1b3c88[_0xe6ce('0x1a')]],'as':_0x1b3c88['as'],'attributes':_0x1b3c88['attributes'],'include':_0x1b3c88[_0xe6ce('0x19')]?_[_0xe6ce('0x1b')](_0x1b3c88[_0xe6ce('0x19')],function(_0x5d5f7e){return{'model':db[_0x5d5f7e[_0xe6ce('0x1a')]],'as':_0x5d5f7e['as'],'attributes':_0x5d5f7e[_0xe6ce('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe6ce('0x9')](function(_0x45a8ff){logger[_0xe6ce('0xa')]('GetCmHopperBlack',_0x29ba5e);logger['debug'](_0xe6ce('0x13'),_0x29ba5e,JSON[_0xe6ce('0x1c')](_0x45a8ff));_0x1c5d6a(_0x45a8ff);})[_0xe6ce('0x12')](function(_0x15848f){logger[_0xe6ce('0xe')](_0xe6ce('0x13'),_0x15848f[_0xe6ce('0x10')],_0x29ba5e);_0x3df179(_0x458c71[_0xe6ce('0xe')](0x1f4,_0x15848f[_0xe6ce('0x10')]));});});};exports[_0xe6ce('0x1d')]=function(_0x30f970){var _0x40680d=this;return new Promise(function(_0x3034f3,_0x1b9c31){return db[_0xe6ce('0x1e')]['update'](_0x30f970[_0xe6ce('0x1f')],{'raw':_0x30f970[_0xe6ce('0x15')]?_0x30f970['options'][_0xe6ce('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f970[_0xe6ce('0x15')]?_0x30f970[_0xe6ce('0x15')]['where']||null:null,'attributes':_0x30f970[_0xe6ce('0x15')]?_0x30f970[_0xe6ce('0x15')][_0xe6ce('0x17')]||null:null,'limit':_0x30f970[_0xe6ce('0x15')]?_0x30f970['options'][_0xe6ce('0x18')]||null:null})[_0xe6ce('0x9')](function(_0x47fb40){logger[_0xe6ce('0xa')](_0xe6ce('0x1d'),_0x30f970);logger[_0xe6ce('0x20')](_0xe6ce('0x1d'),_0x30f970,JSON[_0xe6ce('0x1c')](_0x47fb40));_0x3034f3(_0x47fb40);})['catch'](function(_0x4fc805){logger[_0xe6ce('0xe')]('UpdateCmHopperBlack',_0x4fc805['message'],_0x30f970);_0x1b9c31(_0x40680d[_0xe6ce('0xe')](0x1f4,_0x4fc805['message']));});});};exports[_0xe6ce('0x21')]=function(_0x31093f){var _0x276d14=this;return new Promise(function(_0x38d003,_0x235dc8){return db[_0xe6ce('0x1e')]['destroy']({'where':_0x31093f[_0xe6ce('0x15')]?_0x31093f['options']['where']||null:null})[_0xe6ce('0x9')](function(_0x3c8a80){logger[_0xe6ce('0xa')](_0xe6ce('0x21'),_0x31093f);logger['debug'](_0xe6ce('0x21'),_0x31093f,JSON['stringify'](_0x3c8a80));_0x38d003(_0x3c8a80);})['catch'](function(_0x22608a){logger['error'](_0xe6ce('0x21'),_0x22608a[_0xe6ce('0x10')],_0x31093f);_0x235dc8(_0x276d14[_0xe6ce('0xe')](0x1f4,_0x22608a['message']));});});}; \ No newline at end of file +var _0x90cc=['then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','include','model','attributes','map','stringify','UpdateCmHopperBlack','CmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x90cc,0x96));var _0xc90c=function(_0x4ca735,_0x103265){_0x4ca735=_0x4ca735-0x0;var _0x3e2643=_0x90cc[_0x4ca735];return _0x3e2643;};'use strict';var _=require('lodash');var util=require(_0xc90c('0x0'));var moment=require(_0xc90c('0x1'));var BPromise=require(_0xc90c('0x2'));var rs=require(_0xc90c('0x3'));var fs=require('fs');var Redis=require(_0xc90c('0x4'));var db=require(_0xc90c('0x5'))['db'];var utils=require(_0xc90c('0x6'));var logger=require(_0xc90c('0x7'))(_0xc90c('0x8'));var config=require(_0xc90c('0x9'));var jayson=require(_0xc90c('0xa'));var client=jayson[_0xc90c('0xb')][_0xc90c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49b10d,_0x5a5211,_0x5b8a29){return new BPromise(function(_0x1bb1a2,_0x701639){return client[_0xc90c('0xd')](_0x49b10d,_0x5b8a29)[_0xc90c('0xe')](function(_0x50af28){logger[_0xc90c('0xf')](_0xc90c('0x10'),_0x5a5211,_0xc90c('0x11'));logger['debug'](_0xc90c('0x12'),_0x5a5211,_0xc90c('0x11'),JSON['stringify'](_0x50af28));if(_0x50af28[_0xc90c('0x13')]){if(_0x50af28[_0xc90c('0x13')]['code']===0x1f4){logger[_0xc90c('0x13')](_0xc90c('0x10'),_0x5a5211,_0x50af28[_0xc90c('0x13')]['message']);return _0x701639(_0x50af28[_0xc90c('0x13')][_0xc90c('0x14')]);}logger['error'](_0xc90c('0x10'),_0x5a5211,_0x50af28[_0xc90c('0x13')][_0xc90c('0x14')]);return _0x1bb1a2(_0x50af28['error'][_0xc90c('0x14')]);}else{logger[_0xc90c('0xf')](_0xc90c('0x10'),_0x5a5211,'request\x20sent');_0x1bb1a2(_0x50af28[_0xc90c('0x15')][_0xc90c('0x14')]);}})[_0xc90c('0x16')](function(_0x11c4f3){logger[_0xc90c('0x13')](_0xc90c('0x10'),_0x5a5211,_0x11c4f3);_0x701639(_0x11c4f3);});});}exports[_0xc90c('0x17')]=function(_0x13290f){var _0x31b2db=this;return new Promise(function(_0x37e210,_0x212080){return db['CmHopperBlack'][_0xc90c('0x18')]({'raw':_0x13290f[_0xc90c('0x19')]?_0x13290f[_0xc90c('0x19')][_0xc90c('0x1a')]===undefined?!![]:![]:!![],'where':_0x13290f[_0xc90c('0x19')]?_0x13290f[_0xc90c('0x19')][_0xc90c('0x1b')]||null:null,'attributes':_0x13290f[_0xc90c('0x19')]?_0x13290f[_0xc90c('0x19')]['attributes']||null:null,'limit':_0x13290f['options']?_0x13290f[_0xc90c('0x19')]['limit']||null:null,'include':_0x13290f[_0xc90c('0x19')]?_0x13290f[_0xc90c('0x19')][_0xc90c('0x1c')]?_['map'](_0x13290f[_0xc90c('0x19')][_0xc90c('0x1c')],function(_0x245499){return{'model':db[_0x245499[_0xc90c('0x1d')]],'as':_0x245499['as'],'attributes':_0x245499[_0xc90c('0x1e')],'include':_0x245499[_0xc90c('0x1c')]?_['map'](_0x245499[_0xc90c('0x1c')],function(_0x56f923){return{'model':db[_0x56f923['model']],'as':_0x56f923['as'],'attributes':_0x56f923[_0xc90c('0x1e')],'include':_0x56f923[_0xc90c('0x1c')]?_[_0xc90c('0x1f')](_0x56f923[_0xc90c('0x1c')],function(_0x1e1852){return{'model':db[_0x1e1852[_0xc90c('0x1d')]],'as':_0x1e1852['as'],'attributes':_0x1e1852[_0xc90c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc90c('0xe')](function(_0x36e343){logger[_0xc90c('0xf')](_0xc90c('0x17'),_0x13290f);logger['debug'](_0xc90c('0x17'),_0x13290f,JSON[_0xc90c('0x20')](_0x36e343));_0x37e210(_0x36e343);})['catch'](function(_0x3f23a6){logger[_0xc90c('0x13')]('GetCmHopperBlack',_0x3f23a6[_0xc90c('0x14')],_0x13290f);_0x212080(_0x31b2db[_0xc90c('0x13')](0x1f4,_0x3f23a6[_0xc90c('0x14')]));});});};exports[_0xc90c('0x21')]=function(_0x132f3c){var _0x3f217e=this;return new Promise(function(_0x49b778,_0xb4ea4c){return db[_0xc90c('0x22')][_0xc90c('0x23')](_0x132f3c[_0xc90c('0x24')],{'raw':_0x132f3c[_0xc90c('0x19')]?_0x132f3c[_0xc90c('0x19')][_0xc90c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132f3c['options']?_0x132f3c[_0xc90c('0x19')]['where']||null:null,'attributes':_0x132f3c[_0xc90c('0x19')]?_0x132f3c[_0xc90c('0x19')][_0xc90c('0x1e')]||null:null,'limit':_0x132f3c[_0xc90c('0x19')]?_0x132f3c['options'][_0xc90c('0x25')]||null:null})[_0xc90c('0xe')](function(_0x27dce6){logger[_0xc90c('0xf')](_0xc90c('0x21'),_0x132f3c);logger['debug']('UpdateCmHopperBlack',_0x132f3c,JSON[_0xc90c('0x20')](_0x27dce6));_0x49b778(_0x27dce6);})[_0xc90c('0x16')](function(_0xd69410){logger[_0xc90c('0x13')](_0xc90c('0x21'),_0xd69410['message'],_0x132f3c);_0xb4ea4c(_0x3f217e['error'](0x1f4,_0xd69410[_0xc90c('0x14')]));});});};exports[_0xc90c('0x26')]=function(_0x3017aa){var _0x1e81d9=this;return new Promise(function(_0x51aeaf,_0x5b3985){return db[_0xc90c('0x22')][_0xc90c('0x27')]({'where':_0x3017aa[_0xc90c('0x19')]?_0x3017aa[_0xc90c('0x19')][_0xc90c('0x1b')]||null:null})[_0xc90c('0xe')](function(_0x2627ee){logger[_0xc90c('0xf')](_0xc90c('0x26'),_0x3017aa);logger[_0xc90c('0x28')]('DestroyCmHopperBlack',_0x3017aa,JSON[_0xc90c('0x20')](_0x2627ee));_0x51aeaf(_0x2627ee);})[_0xc90c('0x16')](function(_0x32bb0e){logger['error'](_0xc90c('0x26'),_0x32bb0e[_0xc90c('0x14')],_0x3017aa);_0x5b3985(_0x1e81d9[_0xc90c('0x13')](0x1f4,_0x32bb0e[_0xc90c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 64b7a17..fd322bf 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 _0xb821=['/:id','show','put','update','delete','destroy','exports','util','path','Router','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe'];(function(_0x207f7f,_0x5f22ab){var _0x52f64a=function(_0x238fc0){while(--_0x238fc0){_0x207f7f['push'](_0x207f7f['shift']());}};_0x52f64a(++_0x5f22ab);}(_0xb821,0xa7));var _0x1b82=function(_0x12c702,_0x2d974f){_0x12c702=_0x12c702-0x0;var _0x57fde7=_0xb821[_0x12c702];return _0x57fde7;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b82('0x3'));var controller=require(_0x1b82('0x4'));router[_0x1b82('0x5')]('/',auth[_0x1b82('0x6')](),controller['index']);router[_0x1b82('0x5')](_0x1b82('0x7'),auth[_0x1b82('0x6')](),controller[_0x1b82('0x8')]);router[_0x1b82('0x5')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')]('/:id',auth[_0x1b82('0x6')](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')](_0x1b82('0x9'),auth[_0x1b82('0x6')](),controller[_0x1b82('0xe')]);module[_0x1b82('0xf')]=router; \ No newline at end of file +var _0xf2ca=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','put','update','delete','/:id'];(function(_0xef8eb,_0x3b787d){var _0x2b940a=function(_0x5ba4f0){while(--_0x5ba4f0){_0xef8eb['push'](_0xef8eb['shift']());}};_0x2b940a(++_0x3b787d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0xf2ca[_0xf0ec6e];return _0x8bbc27;};'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('0xb')]('/:id',auth[_0xaf2c('0x9')](),controller['show']);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf2c('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 89c597b..16369ae 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 _0xec77=['DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xec77,0x151));var _0x7ec7=function(_0x339565,_0x4df8f9){_0x339565=_0x339565-0x0;var _0x1afc0d=_0xec77[_0x339565];return _0x1afc0d;};'use strict';var Sequelize=require(_0x7ec7('0x0'));var moment=require(_0x7ec7('0x1'));module['exports']={'state':{'type':Sequelize[_0x7ec7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7ec7('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7ec7('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7ec7('0x3')]},'calleridname':{'type':Sequelize[_0x7ec7('0x3')]},'starttime':{'type':Sequelize[_0x7ec7('0x4')]},'responsetime':{'type':Sequelize[_0x7ec7('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7ec7('0x4')]},'endtime':{'type':Sequelize[_0x7ec7('0x4')]},'ringtime':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7ec7('0x3')]},'campaign':{'type':Sequelize[_0x7ec7('0x3')]},'campaigntype':{'type':Sequelize[_0x7ec7('0x3')]},'membername':{'type':Sequelize[_0x7ec7('0x3')]},'reason':{'type':Sequelize[_0x7ec7('0x3')]},'disposition':{'type':Sequelize[_0x7ec7('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x489a14){var _0x1dee59=this[_0x7ec7('0x5')](_0x7ec7('0x6'));if(_0x1dee59&&_0x489a14){this[_0x7ec7('0x7')]('followuptime',moment(_0x489a14)[_0x7ec7('0x8')](moment(_0x1dee59),_0x7ec7('0x9')));}return this[_0x7ec7('0x7')]('dispositionat',_0x489a14);}},'amd':{'type':Sequelize[_0x7ec7('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7ec7('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7ec7('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7ec7('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7ec7('0x4')]},'deleted':{'type':Sequelize[_0x7ec7('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x7ec7('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7ec7('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7ec7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaf1c=['moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN'];(function(_0x11fa16,_0x544e25){var _0x3b88b3=function(_0x44ef05){while(--_0x44ef05){_0x11fa16['push'](_0x11fa16['shift']());}};_0x3b88b3(++_0x544e25);}(_0xaf1c,0x113));var _0xcaf1=function(_0x5cf969,_0x37a1c9){_0x5cf969=_0x5cf969-0x0;var _0x3235a0=_0xaf1c[_0x5cf969];return _0x3235a0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcaf1('0x0'));module[_0xcaf1('0x1')]={'state':{'type':Sequelize[_0xcaf1('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xcaf1('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xcaf1('0x3')]},'calleridname':{'type':Sequelize[_0xcaf1('0x3')]},'starttime':{'type':Sequelize[_0xcaf1('0x4')]},'responsetime':{'type':Sequelize[_0xcaf1('0x4')]},'answertime':{'type':Sequelize[_0xcaf1('0x4')]},'droptime':{'type':Sequelize[_0xcaf1('0x4')]},'endtime':{'type':Sequelize[_0xcaf1('0x4')]},'ringtime':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcaf1('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xcaf1('0x3')]},'reason':{'type':Sequelize[_0xcaf1('0x3')]},'disposition':{'type':Sequelize[_0xcaf1('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4f9bd4){var _0x58aab5=this[_0xcaf1('0x5')](_0xcaf1('0x6'));if(_0x58aab5&&_0x4f9bd4){this[_0xcaf1('0x7')]('followuptime',moment(_0x4f9bd4)[_0xcaf1('0x8')](moment(_0x58aab5),_0xcaf1('0x9')));}return this[_0xcaf1('0x7')]('dispositionat',_0x4f9bd4);}},'amd':{'type':Sequelize[_0xcaf1('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xcaf1('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xcaf1('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xcaf1('0x4')]},'callback':{'type':Sequelize[_0xcaf1('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcaf1('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xcaf1('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcaf1('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 cc92e89..4f8aba1 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 _0xfb0b=['ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','save','then','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperFinal','include','findAll','catch','show','params','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','insert','into','cm_hopper','fromQuery','phone','scheduledAt'];(function(_0x4bc9fb,_0x572f67){var _0x2baa87=function(_0x31f298){while(--_0x31f298){_0x4bc9fb['push'](_0x4bc9fb['shift']());}};_0x2baa87(++_0x572f67);}(_0xfb0b,0x94));var _0xbfb0=function(_0xf4d29d,_0x5ea667){_0xf4d29d=_0xf4d29d-0x0;var _0x5555de=_0xfb0b[_0xf4d29d];return _0x5555de;};'use strict';var pdf=require(_0xbfb0('0x0'));var emlformat=require(_0xbfb0('0x1'));var rimraf=require(_0xbfb0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbfb0('0x3'));var rp=require(_0xbfb0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbfb0('0x5'));var util=require('util');var path=require(_0xbfb0('0x6'));var sox=require(_0xbfb0('0x7'));var csv=require(_0xbfb0('0x8'));var ejs=require(_0xbfb0('0x9'));var fs=require('fs');var _=require(_0xbfb0('0xa'));var squel=require(_0xbfb0('0xb'));var crypto=require('crypto');var jsforce=require(_0xbfb0('0xc'));var deskjs=require(_0xbfb0('0xd'));var toCsv=require(_0xbfb0('0x8'));var querystring=require(_0xbfb0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbfb0('0xf'));var hardwareService=require(_0xbfb0('0x10'));var logger=require(_0xbfb0('0x11'))('api');var utils=require(_0xbfb0('0x12'));var config=require('../../config/environment');var db=require(_0xbfb0('0x13'))['db'];function respondWithStatusCode(_0x3f8439,_0x41afc9){_0x41afc9=_0x41afc9||0xcc;return function(_0x410d77){if(_0x410d77){return _0x3f8439[_0xbfb0('0x14')](_0x41afc9);}return _0x3f8439[_0xbfb0('0x15')](_0x41afc9)['end']();};}function respondWithResult(_0x1883ec,_0x567237){_0x567237=_0x567237||0xc8;return function(_0x4dc587){if(_0x4dc587){return _0x1883ec['status'](_0x567237)[_0xbfb0('0x16')](_0x4dc587);}};}function respondWithFilteredResult(_0x2c9768,_0x198001){return function(_0x3617f3){if(_0x3617f3){var _0x27f7a1=_0x3617f3[_0xbfb0('0x17')],_0x213994=_0x198001[_0xbfb0('0x18')],_0x2470cf=_0x198001[_0xbfb0('0x18')]+_0x198001['limit'],_0x2d8773;if(_0x2470cf>=_0x27f7a1){_0x2470cf=_0x27f7a1;_0x2d8773=0xc8;}else{_0x2d8773=0xce;}_0x2c9768['status'](_0x2d8773);return _0x2c9768[_0xbfb0('0x19')](_0xbfb0('0x1a'),_0x213994+'-'+_0x2470cf+'/'+_0x27f7a1)['json'](_0x3617f3);}return null;};}function patchUpdates(_0x206442){return function(_0x55a53){try{jsonpatch['apply'](_0x55a53,_0x206442,!![]);}catch(_0x3834a6){return BPromise['reject'](_0x3834a6);}return _0x55a53[_0xbfb0('0x1b')]();};}function saveUpdates(_0x4350fe,_0xf52bd5){return function(_0x14eae9){if(_0x14eae9){return _0x14eae9['update'](_0x4350fe)[_0xbfb0('0x1c')](function(_0x5219c3){return _0x5219c3;});}return null;};}function removeEntity(_0x300e16,_0x5317fe){return function(_0x16bb6e){if(_0x16bb6e){return _0x16bb6e['destroy']()[_0xbfb0('0x1c')](function(){_0x300e16['status'](0xcc)[_0xbfb0('0x1d')]();});}};}function handleEntityNotFound(_0x19e16d,_0x40bb06){return function(_0x3ab347){if(!_0x3ab347){_0x19e16d['sendStatus'](0x194);}return _0x3ab347;};}function handleError(_0x2efb2a,_0x17f46c){_0x17f46c=_0x17f46c||0x1f4;return function(_0x4b174f){logger['error'](_0x4b174f[_0xbfb0('0x1e')]);if(_0x4b174f[_0xbfb0('0x1f')]){delete _0x4b174f[_0xbfb0('0x1f')];}_0x2efb2a['status'](_0x17f46c)[_0xbfb0('0x20')](_0x4b174f);};}exports['index']=function(_0x7bd2b2,_0x46dac3){var _0x250ce8={},_0x402db3={},_0x1ecd46={'count':0x0,'rows':[]};var _0x1d0e8d=_[_0xbfb0('0x21')](db['CmHopperFinal'][_0xbfb0('0x22')],function(_0x14711){return{'name':_0x14711[_0xbfb0('0x23')],'type':_0x14711[_0xbfb0('0x24')]['key']};});_0x402db3[_0xbfb0('0x25')]=_[_0xbfb0('0x21')](_0x1d0e8d,'name');_0x402db3[_0xbfb0('0x26')]=_[_0xbfb0('0x27')](_0x7bd2b2[_0xbfb0('0x26')]);_0x402db3[_0xbfb0('0x28')]=_[_0xbfb0('0x29')](_0x402db3[_0xbfb0('0x25')],_0x402db3[_0xbfb0('0x26')]);_0x250ce8[_0xbfb0('0x2a')]=_[_0xbfb0('0x29')](_0x402db3[_0xbfb0('0x25')],qs[_0xbfb0('0x2b')](_0x7bd2b2[_0xbfb0('0x26')]['fields']));_0x250ce8['attributes']=_0x250ce8['attributes'][_0xbfb0('0x2c')]?_0x250ce8[_0xbfb0('0x2a')]:_0x402db3[_0xbfb0('0x25')];if(!_0x7bd2b2[_0xbfb0('0x26')][_0xbfb0('0x2d')](_0xbfb0('0x2e'))){_0x250ce8[_0xbfb0('0x2f')]=qs[_0xbfb0('0x2f')](_0x7bd2b2['query']['limit']);_0x250ce8['offset']=qs[_0xbfb0('0x18')](_0x7bd2b2[_0xbfb0('0x26')][_0xbfb0('0x18')]);}_0x250ce8[_0xbfb0('0x30')]=qs[_0xbfb0('0x31')](_0x7bd2b2['query']['sort']);_0x250ce8[_0xbfb0('0x32')]=qs[_0xbfb0('0x28')](_[_0xbfb0('0x33')](_0x7bd2b2[_0xbfb0('0x26')],_0x402db3[_0xbfb0('0x28')]),_0x1d0e8d);if(_0x7bd2b2[_0xbfb0('0x26')][_0xbfb0('0x34')]){_0x250ce8[_0xbfb0('0x32')]=_[_0xbfb0('0x35')](_0x250ce8[_0xbfb0('0x32')],{'$or':_['map'](_0x1d0e8d,function(_0x580234){if(_0x580234[_0xbfb0('0x24')]!==_0xbfb0('0x36')){var _0x550187={};_0x550187[_0x580234[_0xbfb0('0x1f')]]={'$like':'%'+_0x7bd2b2['query'][_0xbfb0('0x34')]+'%'};return _0x550187;}})});}_0x250ce8=_[_0xbfb0('0x35')]({},_0x250ce8,_0x7bd2b2['options']);var _0x4acf91={'where':_0x250ce8[_0xbfb0('0x32')]};return db[_0xbfb0('0x37')]['count'](_0x4acf91)[_0xbfb0('0x1c')](function(_0x49f90d){_0x1ecd46[_0xbfb0('0x17')]=_0x49f90d;if(_0x7bd2b2['query']['includeAll']){_0x250ce8[_0xbfb0('0x38')]=[{'all':!![]}];}return db[_0xbfb0('0x37')][_0xbfb0('0x39')](_0x250ce8);})[_0xbfb0('0x1c')](function(_0x45702d){_0x1ecd46['rows']=_0x45702d;return _0x1ecd46;})[_0xbfb0('0x1c')](respondWithFilteredResult(_0x46dac3,_0x250ce8))[_0xbfb0('0x3a')](handleError(_0x46dac3,null));};exports[_0xbfb0('0x3b')]=function(_0x3958c8,_0x245db1){var _0x90da0c={'raw':!![],'where':{'id':_0x3958c8[_0xbfb0('0x3c')]['id']}},_0x14c3bf={};_0x14c3bf[_0xbfb0('0x25')]=_[_0xbfb0('0x27')](db[_0xbfb0('0x37')][_0xbfb0('0x22')]);_0x14c3bf[_0xbfb0('0x26')]=_[_0xbfb0('0x27')](_0x3958c8[_0xbfb0('0x26')]);_0x14c3bf[_0xbfb0('0x28')]=_[_0xbfb0('0x29')](_0x14c3bf[_0xbfb0('0x25')],_0x14c3bf['query']);_0x90da0c[_0xbfb0('0x2a')]=_[_0xbfb0('0x29')](_0x14c3bf[_0xbfb0('0x25')],qs[_0xbfb0('0x2b')](_0x3958c8[_0xbfb0('0x26')][_0xbfb0('0x2b')]));_0x90da0c[_0xbfb0('0x2a')]=_0x90da0c[_0xbfb0('0x2a')][_0xbfb0('0x2c')]?_0x90da0c[_0xbfb0('0x2a')]:_0x14c3bf['model'];if(_0x3958c8['query'][_0xbfb0('0x3d')]){_0x90da0c[_0xbfb0('0x38')]=[{'all':!![]}];}_0x90da0c=_['merge']({},_0x90da0c,_0x3958c8['options']);return db[_0xbfb0('0x37')][_0xbfb0('0x3e')](_0x90da0c)[_0xbfb0('0x1c')](handleEntityNotFound(_0x245db1,null))[_0xbfb0('0x1c')](respondWithResult(_0x245db1,null))[_0xbfb0('0x3a')](handleError(_0x245db1,null));};exports[_0xbfb0('0x3f')]=function(_0x5d7e84,_0x519965){return db[_0xbfb0('0x37')][_0xbfb0('0x3f')]()[_0xbfb0('0x1c')](respondWithResult(_0x519965,null))[_0xbfb0('0x3a')](handleError(_0x519965,null));};exports[_0xbfb0('0x40')]=function(_0xa7aecb,_0x8887b0){if(_0xa7aecb[_0xbfb0('0x41')][_0xbfb0('0x42')]){delete _0xa7aecb[_0xbfb0('0x41')][_0xbfb0('0x42')];}return db[_0xbfb0('0x37')][_0xbfb0('0x3e')]({'where':{'uniqueid':_0xa7aecb[_0xbfb0('0x3c')]['id']}})[_0xbfb0('0x1c')](handleEntityNotFound(_0x8887b0,null))[_0xbfb0('0x1c')](saveUpdates(_0xa7aecb[_0xbfb0('0x41')],null))[_0xbfb0('0x1c')](respondWithResult(_0x8887b0,null))[_0xbfb0('0x3a')](handleError(_0x8887b0,null));};exports[_0xbfb0('0x43')]=function(_0xa45778,_0x3f1972,_0x35b22e){return db['CmHopperFinal'][_0xbfb0('0x39')]({'raw':![],'where':{'VoiceQueueId':_0xa45778[_0xbfb0('0x3c')]['id']},'attributes':[[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db[_0xbfb0('0x44')]['fn']('IF',db[_0xbfb0('0x44')][_0xbfb0('0x46')]('`state`\x20=\x200,\x201,\x20null'))),_0xbfb0('0x47')],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db['sequelize']['fn']('IF',db[_0xbfb0('0x44')]['literal'](_0xbfb0('0x48')))),_0xbfb0('0x49')],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db['sequelize']['fn']('IF',db[_0xbfb0('0x44')][_0xbfb0('0x46')]('`state`\x20=\x205,\x201,\x20null'))),_0xbfb0('0x4a')],[db[_0xbfb0('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xbfb0('0x46')](_0xbfb0('0x4b')))),'congestionContacts'],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db[_0xbfb0('0x44')]['fn']('IF',db[_0xbfb0('0x44')]['literal'](_0xbfb0('0x4c')))),_0xbfb0('0x4d')],[db[_0xbfb0('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xbfb0('0x4e')))),_0xbfb0('0x4f')],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db[_0xbfb0('0x44')]['fn']('IF',db[_0xbfb0('0x44')][_0xbfb0('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0xbfb0('0x50')],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db[_0xbfb0('0x44')]['fn']('IF',db[_0xbfb0('0x44')][_0xbfb0('0x46')]('`state`\x20=\x2019,\x201,\x20null'))),_0xbfb0('0x51')]]})[_0xbfb0('0x1c')](handleEntityNotFound(_0x3f1972,null))['then'](respondWithResult(_0x3f1972,null))[_0xbfb0('0x3a')](handleError(_0x3f1972,null));};exports[_0xbfb0('0x52')]=function(_0x3cd928,_0xdac5c0,_0x53656a){return db[_0xbfb0('0x37')][_0xbfb0('0x39')]({'raw':![],'where':{'CampaignId':_0x3cd928[_0xbfb0('0x3c')]['id']},'attributes':[[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db[_0xbfb0('0x44')]['fn']('IF',db['sequelize'][_0xbfb0('0x46')](_0xbfb0('0x53')))),_0xbfb0('0x47')],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db['sequelize']['fn']('IF',db[_0xbfb0('0x44')][_0xbfb0('0x46')](_0xbfb0('0x48')))),'noAnswerContacts'],[db[_0xbfb0('0x44')]['fn']('COUNT',db[_0xbfb0('0x44')]['fn']('IF',db[_0xbfb0('0x44')]['literal'](_0xbfb0('0x54')))),_0xbfb0('0x4a')],[db['sequelize']['fn']('COUNT',db[_0xbfb0('0x44')]['fn']('IF',db['sequelize']['literal'](_0xbfb0('0x4b')))),_0xbfb0('0x55')],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db['sequelize']['fn']('IF',db['sequelize'][_0xbfb0('0x46')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db[_0xbfb0('0x44')]['fn']('IF',db[_0xbfb0('0x44')][_0xbfb0('0x46')](_0xbfb0('0x4e')))),'abandonedContacts'],[db[_0xbfb0('0x44')]['fn'](_0xbfb0('0x45'),db[_0xbfb0('0x44')]['fn']('IF',db[_0xbfb0('0x44')][_0xbfb0('0x46')](_0xbfb0('0x56')))),_0xbfb0('0x50')],[db['sequelize']['fn'](_0xbfb0('0x45'),db[_0xbfb0('0x44')]['fn']('IF',db[_0xbfb0('0x44')]['literal'](_0xbfb0('0x57')))),_0xbfb0('0x51')]]})[_0xbfb0('0x1c')](handleEntityNotFound(_0xdac5c0,null))[_0xbfb0('0x1c')](respondWithResult(_0xdac5c0,null))[_0xbfb0('0x3a')](handleError(_0xdac5c0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa3db83,_0x32e1c6,_0x4e58dc){return db['VoiceQueue']['find']({'where':{'id':_0xa3db83[_0xbfb0('0x3c')]['id']}})[_0xbfb0('0x1c')](handleEntityNotFound(_0x32e1c6,null))[_0xbfb0('0x1c')](function(_0x3a694c){var _0x53da97;if(_0x3a694c){_0x53da97=squel[_0xbfb0('0x58')]()[_0xbfb0('0x59')](_0xbfb0('0x5a'))[_0xbfb0('0x5b')]([_0xbfb0('0x5c'),_0xbfb0('0x5d'),_0xbfb0('0x5e'),_0xbfb0('0x5f'),_0xbfb0('0x60'),_0xbfb0('0x61'),_0xbfb0('0x62')],squel[_0xbfb0('0x63')]()[_0xbfb0('0x64')]('ANY_VALUE(calleridnum)',_0xbfb0('0x5c'))[_0xbfb0('0x64')](_0xbfb0('0x65'),_0xbfb0('0x5d'))['field'](_0xbfb0('0x66'),'ContactId')[_0xbfb0('0x64')](_0xbfb0('0x67'),_0xbfb0('0x5f'))['field'](_0xbfb0('0x68'),_0xbfb0('0x60'))[_0xbfb0('0x64')](_0xbfb0('0x65'),'createdAt')[_0xbfb0('0x64')](_0xbfb0('0x65'),'updatedAt')[_0xbfb0('0x69')](_0xbfb0('0x6a'))[_0xbfb0('0x32')](_0xbfb0('0x6b'),_0xa3db83['params']['id']['toString']())[_0xbfb0('0x32')](_0xbfb0('0x6c'),_0xa3db83[_0xbfb0('0x41')]['state'][_0xbfb0('0x6d')]())[_0xbfb0('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xbfb0('0x32')](_0xbfb0('0x6e'),squel[_0xbfb0('0x63')]()[_0xbfb0('0x64')](_0xbfb0('0x5c'))[_0xbfb0('0x69')](_0xbfb0('0x5a'))[_0xbfb0('0x32')]('VoiceQueueId\x20=\x20?',_0xa3db83[_0xbfb0('0x3c')]['id'][_0xbfb0('0x6d')]()))[_0xbfb0('0x32')](_0xbfb0('0x6e'),squel[_0xbfb0('0x63')]()['field'](_0xbfb0('0x6f'))[_0xbfb0('0x69')](_0xbfb0('0x6a'))[_0xbfb0('0x32')](_0xbfb0('0x6b'),_0xa3db83[_0xbfb0('0x3c')]['id'][_0xbfb0('0x6d')]())['where'](_0xbfb0('0x70')))[_0xbfb0('0x71')](_0xbfb0('0x5e')))[_0xbfb0('0x6d')]();return db['sequelize'][_0xbfb0('0x26')](_0x53da97);}return[];})[_0xbfb0('0x1c')](respondWithResult(_0x32e1c6,null))['catch'](handleError(_0x32e1c6,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x528c18,_0x49b184,_0x1e2e67){return db['Campaign']['find']({'where':{'id':_0x528c18[_0xbfb0('0x3c')]['id']}})['then'](handleEntityNotFound(_0x49b184,null))['then'](function(_0x24c7f3){var _0x12df0e;if(_0x24c7f3){_0x12df0e=squel['insert']()[_0xbfb0('0x59')](_0xbfb0('0x5a'))['fromQuery']([_0xbfb0('0x5c'),_0xbfb0('0x5d'),'ContactId',_0xbfb0('0x5f'),_0xbfb0('0x72'),_0xbfb0('0x61'),_0xbfb0('0x62')],squel[_0xbfb0('0x63')]()['field'](_0xbfb0('0x73'),_0xbfb0('0x5c'))['field'](_0xbfb0('0x65'),_0xbfb0('0x5d'))[_0xbfb0('0x64')](_0xbfb0('0x66'),_0xbfb0('0x5e'))[_0xbfb0('0x64')](_0xbfb0('0x67'),'ListId')['field'](_0xbfb0('0x74'),_0xbfb0('0x72'))['field'](_0xbfb0('0x65'),'createdAt')['field'](_0xbfb0('0x65'),_0xbfb0('0x62'))[_0xbfb0('0x69')](_0xbfb0('0x6a'))[_0xbfb0('0x32')](_0xbfb0('0x75'),_0x528c18[_0xbfb0('0x3c')]['id'][_0xbfb0('0x6d')]())[_0xbfb0('0x32')](_0xbfb0('0x6c'),_0x528c18[_0xbfb0('0x41')][_0xbfb0('0x76')][_0xbfb0('0x6d')]())['where'](_0xbfb0('0x77'))[_0xbfb0('0x32')](_0xbfb0('0x6e'),squel[_0xbfb0('0x63')]()[_0xbfb0('0x64')](_0xbfb0('0x5c'))[_0xbfb0('0x69')](_0xbfb0('0x5a'))['where'](_0xbfb0('0x75'),_0x528c18['params']['id'][_0xbfb0('0x6d')]()))[_0xbfb0('0x32')](_0xbfb0('0x6e'),squel[_0xbfb0('0x63')]()[_0xbfb0('0x64')](_0xbfb0('0x6f'))[_0xbfb0('0x69')](_0xbfb0('0x6a'))[_0xbfb0('0x32')]('CampaignId\x20=\x20?',_0x528c18[_0xbfb0('0x3c')]['id']['toString']())[_0xbfb0('0x32')](_0xbfb0('0x70')))[_0xbfb0('0x71')]('ContactId'))['toString']();return db[_0xbfb0('0x44')][_0xbfb0('0x26')](_0x12df0e);}return[];})[_0xbfb0('0x1c')](respondWithResult(_0x49b184,null))['catch'](handleError(_0x49b184,null));};exports[_0xbfb0('0x78')]=function(_0x2fbdce,_0x493635,_0x1ce198){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x2fbdce[_0xbfb0('0x41')]['VoiceQueueId'],'CampaignId':_0x2fbdce[_0xbfb0('0x41')][_0xbfb0('0x72')],'ContactId':_0x2fbdce[_0xbfb0('0x41')][_0xbfb0('0x5e')]}})[_0xbfb0('0x1c')](handleEntityNotFound(_0x493635,null))[_0xbfb0('0x1c')](function(_0x5acf26){if(_0x5acf26){return _0x5acf26;}return null;})[_0xbfb0('0x1c')](respondWithResult(_0x493635,null))[_0xbfb0('0x3a')](handleError(_0x493635,null));}; \ No newline at end of file +var _0x2b29=['save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','CmHopperFinal','includeAll','include','findAll','show','keys','find','describe','catch','uniqueid','body','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','answeringMachine','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','cm_hopper','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(CampaignId)','CampaignId','state','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject'];(function(_0x54c4de,_0x154df7){var _0x5e6903=function(_0x517369){while(--_0x517369){_0x54c4de['push'](_0x54c4de['shift']());}};_0x5e6903(++_0x154df7);}(_0x2b29,0x163));var _0x92b2=function(_0xdd83ea,_0x1c7099){_0xdd83ea=_0xdd83ea-0x0;var _0x118081=_0x2b29[_0xdd83ea];return _0x118081;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x92b2('0x0'));var rimraf=require(_0x92b2('0x1'));var zipdir=require(_0x92b2('0x2'));var jsonpatch=require(_0x92b2('0x3'));var rp=require('request-promise');var moment=require(_0x92b2('0x4'));var BPromise=require(_0x92b2('0x5'));var Mustache=require(_0x92b2('0x6'));var util=require(_0x92b2('0x7'));var path=require(_0x92b2('0x8'));var sox=require(_0x92b2('0x9'));var csv=require('to-csv');var ejs=require(_0x92b2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x92b2('0xb'));var crypto=require(_0x92b2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x92b2('0xd'));var toCsv=require(_0x92b2('0xe'));var querystring=require(_0x92b2('0xf'));var Papa=require(_0x92b2('0x10'));var Redis=require('ioredis');var authService=require(_0x92b2('0x11'));var qs=require(_0x92b2('0x12'));var as=require(_0x92b2('0x13'));var hardwareService=require(_0x92b2('0x14'));var logger=require(_0x92b2('0x15'))(_0x92b2('0x16'));var utils=require(_0x92b2('0x17'));var config=require('../../config/environment');var db=require(_0x92b2('0x18'))['db'];function respondWithStatusCode(_0x2c0d0f,_0x160e75){_0x160e75=_0x160e75||0xcc;return function(_0x58b009){if(_0x58b009){return _0x2c0d0f[_0x92b2('0x19')](_0x160e75);}return _0x2c0d0f[_0x92b2('0x1a')](_0x160e75)[_0x92b2('0x1b')]();};}function respondWithResult(_0x4d597b,_0x12c2d1){_0x12c2d1=_0x12c2d1||0xc8;return function(_0x179834){if(_0x179834){return _0x4d597b['status'](_0x12c2d1)[_0x92b2('0x1c')](_0x179834);}};}function respondWithFilteredResult(_0x5c42b5,_0x299a9d){return function(_0x2be641){if(_0x2be641){var _0x2ac0c8=_0x2be641['count'],_0x4899fa=_0x299a9d[_0x92b2('0x1d')],_0x5cbb30=_0x299a9d['offset']+_0x299a9d[_0x92b2('0x1e')],_0xbb9cef;if(_0x5cbb30>=_0x2ac0c8){_0x5cbb30=_0x2ac0c8;_0xbb9cef=0xc8;}else{_0xbb9cef=0xce;}_0x5c42b5[_0x92b2('0x1a')](_0xbb9cef);return _0x5c42b5[_0x92b2('0x1f')](_0x92b2('0x20'),_0x4899fa+'-'+_0x5cbb30+'/'+_0x2ac0c8)[_0x92b2('0x1c')](_0x2be641);}return null;};}function patchUpdates(_0x3dfd47){return function(_0x1cb43e){try{jsonpatch[_0x92b2('0x21')](_0x1cb43e,_0x3dfd47,!![]);}catch(_0x21bc07){return BPromise[_0x92b2('0x22')](_0x21bc07);}return _0x1cb43e[_0x92b2('0x23')]();};}function saveUpdates(_0x3bdda8,_0x20395d){return function(_0x422ab6){if(_0x422ab6){return _0x422ab6[_0x92b2('0x24')](_0x3bdda8)['then'](function(_0x46078b){return _0x46078b;});}return null;};}function removeEntity(_0x546c1c,_0x2f5d19){return function(_0xe6f05f){if(_0xe6f05f){return _0xe6f05f[_0x92b2('0x25')]()[_0x92b2('0x26')](function(){_0x546c1c[_0x92b2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x547848,_0x131b6b){return function(_0x31567c){if(!_0x31567c){_0x547848[_0x92b2('0x19')](0x194);}return _0x31567c;};}function handleError(_0x386a80,_0x5a6c76){_0x5a6c76=_0x5a6c76||0x1f4;return function(_0x30a205){logger[_0x92b2('0x27')](_0x30a205[_0x92b2('0x28')]);if(_0x30a205[_0x92b2('0x29')]){delete _0x30a205['name'];}_0x386a80[_0x92b2('0x1a')](_0x5a6c76)['send'](_0x30a205);};}exports[_0x92b2('0x2a')]=function(_0x4a587f,_0x5e9688){var _0x105270={},_0x2d707f={},_0x1ef68b={'count':0x0,'rows':[]};var _0x5a874e=_[_0x92b2('0x2b')](db['CmHopperFinal'][_0x92b2('0x2c')],function(_0x2c19f6){return{'name':_0x2c19f6[_0x92b2('0x2d')],'type':_0x2c19f6[_0x92b2('0x2e')][_0x92b2('0x2f')]};});_0x2d707f[_0x92b2('0x30')]=_[_0x92b2('0x2b')](_0x5a874e,'name');_0x2d707f['query']=_['keys'](_0x4a587f[_0x92b2('0x31')]);_0x2d707f[_0x92b2('0x32')]=_[_0x92b2('0x33')](_0x2d707f['model'],_0x2d707f['query']);_0x105270[_0x92b2('0x34')]=_[_0x92b2('0x33')](_0x2d707f[_0x92b2('0x30')],qs[_0x92b2('0x35')](_0x4a587f[_0x92b2('0x31')]['fields']));_0x105270['attributes']=_0x105270['attributes'][_0x92b2('0x36')]?_0x105270[_0x92b2('0x34')]:_0x2d707f['model'];if(!_0x4a587f[_0x92b2('0x31')][_0x92b2('0x37')](_0x92b2('0x38'))){_0x105270[_0x92b2('0x1e')]=qs[_0x92b2('0x1e')](_0x4a587f[_0x92b2('0x31')][_0x92b2('0x1e')]);_0x105270[_0x92b2('0x1d')]=qs['offset'](_0x4a587f[_0x92b2('0x31')][_0x92b2('0x1d')]);}_0x105270[_0x92b2('0x39')]=qs['sort'](_0x4a587f[_0x92b2('0x31')]['sort']);_0x105270[_0x92b2('0x3a')]=qs[_0x92b2('0x32')](_['pick'](_0x4a587f['query'],_0x2d707f[_0x92b2('0x32')]),_0x5a874e);if(_0x4a587f[_0x92b2('0x31')]['filter']){_0x105270['where']=_[_0x92b2('0x3b')](_0x105270[_0x92b2('0x3a')],{'$or':_['map'](_0x5a874e,function(_0x2c117f){if(_0x2c117f[_0x92b2('0x2e')]!==_0x92b2('0x3c')){var _0x4fc817={};_0x4fc817[_0x2c117f[_0x92b2('0x29')]]={'$like':'%'+_0x4a587f['query'][_0x92b2('0x3d')]+'%'};return _0x4fc817;}})});}_0x105270=_[_0x92b2('0x3b')]({},_0x105270,_0x4a587f[_0x92b2('0x3e')]);var _0x40c3db={'where':_0x105270[_0x92b2('0x3a')]};return db[_0x92b2('0x3f')]['count'](_0x40c3db)[_0x92b2('0x26')](function(_0x35ca4d){_0x1ef68b['count']=_0x35ca4d;if(_0x4a587f[_0x92b2('0x31')][_0x92b2('0x40')]){_0x105270[_0x92b2('0x41')]=[{'all':!![]}];}return db[_0x92b2('0x3f')][_0x92b2('0x42')](_0x105270);})[_0x92b2('0x26')](function(_0x1fc49f){_0x1ef68b['rows']=_0x1fc49f;return _0x1ef68b;})[_0x92b2('0x26')](respondWithFilteredResult(_0x5e9688,_0x105270))['catch'](handleError(_0x5e9688,null));};exports[_0x92b2('0x43')]=function(_0x572cd2,_0xbeb1db){var _0xefc848={'raw':!![],'where':{'id':_0x572cd2['params']['id']}},_0x1545bb={};_0x1545bb[_0x92b2('0x30')]=_[_0x92b2('0x44')](db[_0x92b2('0x3f')]['rawAttributes']);_0x1545bb[_0x92b2('0x31')]=_[_0x92b2('0x44')](_0x572cd2[_0x92b2('0x31')]);_0x1545bb[_0x92b2('0x32')]=_['intersection'](_0x1545bb['model'],_0x1545bb['query']);_0xefc848[_0x92b2('0x34')]=_[_0x92b2('0x33')](_0x1545bb[_0x92b2('0x30')],qs['fields'](_0x572cd2[_0x92b2('0x31')]['fields']));_0xefc848[_0x92b2('0x34')]=_0xefc848[_0x92b2('0x34')][_0x92b2('0x36')]?_0xefc848[_0x92b2('0x34')]:_0x1545bb[_0x92b2('0x30')];if(_0x572cd2[_0x92b2('0x31')][_0x92b2('0x40')]){_0xefc848[_0x92b2('0x41')]=[{'all':!![]}];}_0xefc848=_[_0x92b2('0x3b')]({},_0xefc848,_0x572cd2[_0x92b2('0x3e')]);return db[_0x92b2('0x3f')][_0x92b2('0x45')](_0xefc848)['then'](handleEntityNotFound(_0xbeb1db,null))[_0x92b2('0x26')](respondWithResult(_0xbeb1db,null))['catch'](handleError(_0xbeb1db,null));};exports[_0x92b2('0x46')]=function(_0x524630,_0x18b4ba){return db[_0x92b2('0x3f')][_0x92b2('0x46')]()['then'](respondWithResult(_0x18b4ba,null))[_0x92b2('0x47')](handleError(_0x18b4ba,null));};exports['update']=function(_0xd89d2,_0x10123b){if(_0xd89d2['body'][_0x92b2('0x48')]){delete _0xd89d2[_0x92b2('0x49')][_0x92b2('0x48')];}return db[_0x92b2('0x3f')][_0x92b2('0x45')]({'where':{'uniqueid':_0xd89d2[_0x92b2('0x4a')]['id']}})[_0x92b2('0x26')](handleEntityNotFound(_0x10123b,null))[_0x92b2('0x26')](saveUpdates(_0xd89d2[_0x92b2('0x49')],null))[_0x92b2('0x26')](respondWithResult(_0x10123b,null))[_0x92b2('0x47')](handleError(_0x10123b,null));};exports[_0x92b2('0x4b')]=function(_0x3b85e2,_0x12f255,_0x563ded){return db[_0x92b2('0x3f')][_0x92b2('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x3b85e2['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x92b2('0x4c')]['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')](_0x92b2('0x4f')))),_0x92b2('0x50')],[db[_0x92b2('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x92b2('0x4e')]('`state`\x20=\x205,\x201,\x20null'))),_0x92b2('0x51')],[db['sequelize']['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x92b2('0x52')],[db[_0x92b2('0x4c')]['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')](_0x92b2('0x53')))),_0x92b2('0x54')],[db[_0x92b2('0x4c')]['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')](_0x92b2('0x55')))),_0x92b2('0x56')],[db['sequelize']['fn']('COUNT',db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x92b2('0x57')],[db[_0x92b2('0x4c')]['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')](_0x92b2('0x58')))),'answeringMachine']]})[_0x92b2('0x26')](handleEntityNotFound(_0x12f255,null))[_0x92b2('0x26')](respondWithResult(_0x12f255,null))[_0x92b2('0x47')](handleError(_0x12f255,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x340324,_0x16afd0,_0x574d6e){return db['CmHopperFinal'][_0x92b2('0x42')]({'raw':![],'where':{'CampaignId':_0x340324[_0x92b2('0x4a')]['id']},'attributes':[[db['sequelize']['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')](_0x92b2('0x59')))),_0x92b2('0x5a')],[db[_0x92b2('0x4c')]['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')]['literal'](_0x92b2('0x4f')))),_0x92b2('0x50')],[db[_0x92b2('0x4c')]['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x92b2('0x5b')))),_0x92b2('0x51')],[db[_0x92b2('0x4c')]['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x92b2('0x52')],[db[_0x92b2('0x4c')]['fn']('COUNT',db[_0x92b2('0x4c')]['fn']('IF',db['sequelize'][_0x92b2('0x4e')](_0x92b2('0x53')))),_0x92b2('0x54')],[db['sequelize']['fn']('COUNT',db[_0x92b2('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x92b2('0x55')))),_0x92b2('0x56')],[db[_0x92b2('0x4c')]['fn'](_0x92b2('0x4d'),db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x92b2('0x57')],[db[_0x92b2('0x4c')]['fn']('COUNT',db[_0x92b2('0x4c')]['fn']('IF',db[_0x92b2('0x4c')][_0x92b2('0x4e')](_0x92b2('0x58')))),_0x92b2('0x5c')]]})['then'](handleEntityNotFound(_0x16afd0,null))[_0x92b2('0x26')](respondWithResult(_0x16afd0,null))[_0x92b2('0x47')](handleError(_0x16afd0,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x18a2be,_0x127bf4,_0x2ebf05){return db[_0x92b2('0x5d')][_0x92b2('0x45')]({'where':{'id':_0x18a2be[_0x92b2('0x4a')]['id']}})[_0x92b2('0x26')](handleEntityNotFound(_0x127bf4,null))['then'](function(_0x1d28cd){var _0x3a2ea5;if(_0x1d28cd){_0x3a2ea5=squel[_0x92b2('0x5e')]()[_0x92b2('0x5f')]('cm_hopper')[_0x92b2('0x60')]([_0x92b2('0x61'),_0x92b2('0x62'),_0x92b2('0x63'),'ListId',_0x92b2('0x64'),_0x92b2('0x65'),_0x92b2('0x66')],squel[_0x92b2('0x67')]()[_0x92b2('0x68')](_0x92b2('0x69'),_0x92b2('0x61'))[_0x92b2('0x68')](_0x92b2('0x6a'),_0x92b2('0x62'))[_0x92b2('0x68')](_0x92b2('0x6b'),_0x92b2('0x63'))[_0x92b2('0x68')](_0x92b2('0x6c'),_0x92b2('0x6d'))[_0x92b2('0x68')](_0x92b2('0x6e'),_0x92b2('0x64'))[_0x92b2('0x68')](_0x92b2('0x6a'),_0x92b2('0x65'))['field']('NOW()','updatedAt')['from'](_0x92b2('0x6f'))[_0x92b2('0x3a')](_0x92b2('0x70'),_0x18a2be['params']['id'][_0x92b2('0x71')]())[_0x92b2('0x3a')](_0x92b2('0x72'),_0x18a2be[_0x92b2('0x49')]['state'][_0x92b2('0x71')]())[_0x92b2('0x3a')](_0x92b2('0x73'))[_0x92b2('0x3a')](_0x92b2('0x74'),squel[_0x92b2('0x67')]()[_0x92b2('0x68')](_0x92b2('0x61'))[_0x92b2('0x75')](_0x92b2('0x76'))['where'](_0x92b2('0x70'),_0x18a2be[_0x92b2('0x4a')]['id']['toString']()))[_0x92b2('0x3a')](_0x92b2('0x74'),squel[_0x92b2('0x67')]()[_0x92b2('0x68')](_0x92b2('0x77'))[_0x92b2('0x75')](_0x92b2('0x6f'))[_0x92b2('0x3a')](_0x92b2('0x70'),_0x18a2be[_0x92b2('0x4a')]['id'][_0x92b2('0x71')]())[_0x92b2('0x3a')](_0x92b2('0x78')))[_0x92b2('0x79')](_0x92b2('0x63')))[_0x92b2('0x71')]();return db[_0x92b2('0x4c')]['query'](_0x3a2ea5);}return[];})[_0x92b2('0x26')](respondWithResult(_0x127bf4,null))[_0x92b2('0x47')](handleError(_0x127bf4,null));};exports[_0x92b2('0x7a')]=function(_0x125851,_0x48ca8b,_0x4cf881){return db[_0x92b2('0x7b')]['find']({'where':{'id':_0x125851[_0x92b2('0x4a')]['id']}})[_0x92b2('0x26')](handleEntityNotFound(_0x48ca8b,null))[_0x92b2('0x26')](function(_0x187afc){var _0x9a100e;if(_0x187afc){_0x9a100e=squel[_0x92b2('0x5e')]()[_0x92b2('0x5f')](_0x92b2('0x76'))['fromQuery']([_0x92b2('0x61'),_0x92b2('0x62'),'ContactId',_0x92b2('0x6d'),'CampaignId',_0x92b2('0x65'),'updatedAt'],squel[_0x92b2('0x67')]()[_0x92b2('0x68')](_0x92b2('0x69'),_0x92b2('0x61'))[_0x92b2('0x68')](_0x92b2('0x6a'),_0x92b2('0x62'))[_0x92b2('0x68')]('ANY_VALUE(ContactId)',_0x92b2('0x63'))['field'](_0x92b2('0x6c'),_0x92b2('0x6d'))[_0x92b2('0x68')](_0x92b2('0x7c'),_0x92b2('0x7d'))[_0x92b2('0x68')](_0x92b2('0x6a'),'createdAt')[_0x92b2('0x68')](_0x92b2('0x6a'),_0x92b2('0x66'))[_0x92b2('0x75')]('cm_hopper_final')[_0x92b2('0x3a')]('CampaignId\x20=\x20?',_0x125851[_0x92b2('0x4a')]['id'][_0x92b2('0x71')]())[_0x92b2('0x3a')](_0x92b2('0x72'),_0x125851[_0x92b2('0x49')][_0x92b2('0x7e')][_0x92b2('0x71')]())[_0x92b2('0x3a')](_0x92b2('0x73'))['where'](_0x92b2('0x74'),squel[_0x92b2('0x67')]()['field'](_0x92b2('0x61'))['from'](_0x92b2('0x76'))[_0x92b2('0x3a')](_0x92b2('0x7f'),_0x125851[_0x92b2('0x4a')]['id'][_0x92b2('0x71')]()))['where'](_0x92b2('0x74'),squel[_0x92b2('0x67')]()[_0x92b2('0x68')](_0x92b2('0x77'))[_0x92b2('0x75')]('cm_hopper_final')[_0x92b2('0x3a')](_0x92b2('0x7f'),_0x125851[_0x92b2('0x4a')]['id'][_0x92b2('0x71')]())[_0x92b2('0x3a')](_0x92b2('0x78')))[_0x92b2('0x79')](_0x92b2('0x63')))[_0x92b2('0x71')]();return db[_0x92b2('0x4c')]['query'](_0x9a100e);}return[];})[_0x92b2('0x26')](respondWithResult(_0x48ca8b,null))['catch'](handleError(_0x48ca8b,null));};exports[_0x92b2('0x80')]=function(_0x32af40,_0x5d3db9,_0x3b37c1){return db['CmHopper'][_0x92b2('0x81')]({'where':{'VoiceQueueId':_0x32af40[_0x92b2('0x49')][_0x92b2('0x64')],'CampaignId':_0x32af40['body'][_0x92b2('0x7d')],'ContactId':_0x32af40[_0x92b2('0x49')][_0x92b2('0x63')]}})[_0x92b2('0x26')](handleEntityNotFound(_0x5d3db9,null))[_0x92b2('0x26')](function(_0xc05160){if(_0xc05160){return _0xc05160;}return null;})['then'](respondWithResult(_0x5d3db9,null))[_0x92b2('0x47')](handleError(_0x5d3db9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 8811992..1593e5b 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 _0x56d4=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5f50eb,_0x3e7d18){var _0xb912b6=function(_0x19d99d){while(--_0x19d99d){_0x5f50eb['push'](_0x5f50eb['shift']());}};_0xb912b6(++_0x3e7d18);}(_0x56d4,0xf6));var _0x456d=function(_0x35ecf6,_0x203089){_0x35ecf6=_0x35ecf6-0x0;var _0x4b4a2e=_0x56d4[_0x35ecf6];return _0x4b4a2e;};'use strict';var _=require(_0x456d('0x0'));var util=require('util');var logger=require(_0x456d('0x1'))(_0x456d('0x2'));var moment=require(_0x456d('0x3'));var BPromise=require(_0x456d('0x4'));var rp=require(_0x456d('0x5'));var fs=require('fs');var path=require(_0x456d('0x6'));var rimraf=require(_0x456d('0x7'));var config=require(_0x456d('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0x456d('0x9')]=function(_0x508bdd,_0x183b4b){return _0x508bdd[_0x456d('0xa')](_0x456d('0xb'),attributes,{'tableName':_0x456d('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x456d('0xd')]},{'name':_0x456d('0xe'),'fields':[_0x456d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ecb=['../../config/environment','./cmHopperFinal.attributes','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7ecb,0x10e));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb7ec('0x0'));var util=require(_0xb7ec('0x1'));var logger=require(_0xb7ec('0x2'))('api');var moment=require(_0xb7ec('0x3'));var BPromise=require(_0xb7ec('0x4'));var rp=require(_0xb7ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb7ec('0x6'));var attributes=require(_0xb7ec('0x7'));module['exports']=function(_0x1d3dcd,_0x3af931){return _0x1d3dcd[_0xb7ec('0x8')]('CmHopperFinal',attributes,{'tableName':_0xb7ec('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xb7ec('0xa')]},{'name':'uniqueid','fields':[_0xb7ec('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 7749aab..df8420f 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 _0x93b3=['CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x3dba51,_0x16fc4c){var _0x2d7352=function(_0x21a91a){while(--_0x21a91a){_0x3dba51['push'](_0x3dba51['shift']());}};_0x2d7352(++_0x16fc4c);}(_0x93b3,0x1c6));var _0x393b=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x93b3[_0x2fdf82];return _0x2382f5;};'use strict';var _=require(_0x393b('0x0'));var util=require(_0x393b('0x1'));var moment=require(_0x393b('0x2'));var BPromise=require(_0x393b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x393b('0x4'));var db=require(_0x393b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x393b('0x6'))(_0x393b('0x7'));var config=require(_0x393b('0x8'));var jayson=require(_0x393b('0x9'));var client=jayson[_0x393b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x233a8d,_0xc1e164,_0xe9d88d){return new BPromise(function(_0x20a11a,_0xec056a){return client[_0x393b('0xb')](_0x233a8d,_0xe9d88d)[_0x393b('0xc')](function(_0x281f89){logger[_0x393b('0xd')](_0x393b('0xe'),_0xc1e164,_0x393b('0xf'));logger[_0x393b('0x10')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0xc1e164,_0x393b('0xf'),JSON[_0x393b('0x11')](_0x281f89));if(_0x281f89[_0x393b('0x12')]){if(_0x281f89[_0x393b('0x12')]['code']===0x1f4){logger['error'](_0x393b('0xe'),_0xc1e164,_0x281f89[_0x393b('0x12')][_0x393b('0x13')]);return _0xec056a(_0x281f89[_0x393b('0x12')][_0x393b('0x13')]);}logger[_0x393b('0x12')](_0x393b('0xe'),_0xc1e164,_0x281f89[_0x393b('0x12')]['message']);return _0x20a11a(_0x281f89['error'][_0x393b('0x13')]);}else{logger[_0x393b('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0xc1e164,_0x393b('0xf'));_0x20a11a(_0x281f89[_0x393b('0x14')]['message']);}})[_0x393b('0x15')](function(_0x89f557){logger[_0x393b('0x12')](_0x393b('0xe'),_0xc1e164,_0x89f557);_0xec056a(_0x89f557);});});}exports[_0x393b('0x16')]=function(_0x4b52ba){var _0x3990ff=this;return new Promise(function(_0xfd48ae,_0x5568ff){return db[_0x393b('0x17')][_0x393b('0x18')](_0x4b52ba[_0x393b('0x19')],{'raw':_0x4b52ba[_0x393b('0x1a')]?_0x4b52ba[_0x393b('0x1a')][_0x393b('0x1b')]===undefined?!![]:![]:!![]})[_0x393b('0xc')](function(_0x5ba753){logger[_0x393b('0xd')](_0x393b('0x16'),_0x4b52ba);logger[_0x393b('0x10')]('CreateCmHopperFinal',_0x4b52ba,JSON[_0x393b('0x11')](_0x5ba753));_0xfd48ae(_0x5ba753);})['catch'](function(_0x2ce3be){logger[_0x393b('0x12')]('CreateCmHopperFinal',_0x2ce3be[_0x393b('0x13')],_0x4b52ba);_0x5568ff(_0x3990ff[_0x393b('0x12')](0x1f4,_0x2ce3be[_0x393b('0x13')]));});});}; \ No newline at end of file +var _0x2228=['http','then','info','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','code','error','message','CmHopperFinal,\x20%s,\x20%s','result','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4673af,_0x308ff9){var _0x4566a6=function(_0x5dec3a){while(--_0x5dec3a){_0x4673af['push'](_0x4673af['shift']());}};_0x4566a6(++_0x308ff9);}(_0x2228,0x118));var _0x8222=function(_0x5606c1,_0x3c1972){_0x5606c1=_0x5606c1-0x0;var _0x1f41d5=_0x2228[_0x5606c1];return _0x1f41d5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8222('0x0'));var BPromise=require('bluebird');var rs=require(_0x8222('0x1'));var fs=require('fs');var Redis=require(_0x8222('0x2'));var db=require(_0x8222('0x3'))['db'];var utils=require(_0x8222('0x4'));var logger=require(_0x8222('0x5'))(_0x8222('0x6'));var config=require(_0x8222('0x7'));var jayson=require(_0x8222('0x8'));var client=jayson[_0x8222('0x9')][_0x8222('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29a3ee,_0x11ebc0,_0x626919){return new BPromise(function(_0x2a588e,_0x2e8815){return client['request'](_0x29a3ee,_0x626919)[_0x8222('0xb')](function(_0x378bb4){logger[_0x8222('0xc')]('CmHopperFinal,\x20%s,\x20%s',_0x11ebc0,_0x8222('0xd'));logger[_0x8222('0xe')](_0x8222('0xf'),_0x11ebc0,_0x8222('0xd'),JSON[_0x8222('0x10')](_0x378bb4));if(_0x378bb4['error']){if(_0x378bb4['error'][_0x8222('0x11')]===0x1f4){logger[_0x8222('0x12')]('CmHopperFinal,\x20%s,\x20%s',_0x11ebc0,_0x378bb4['error'][_0x8222('0x13')]);return _0x2e8815(_0x378bb4['error'][_0x8222('0x13')]);}logger['error'](_0x8222('0x14'),_0x11ebc0,_0x378bb4['error']['message']);return _0x2a588e(_0x378bb4[_0x8222('0x12')][_0x8222('0x13')]);}else{logger[_0x8222('0xc')](_0x8222('0x14'),_0x11ebc0,_0x8222('0xd'));_0x2a588e(_0x378bb4[_0x8222('0x15')][_0x8222('0x13')]);}})['catch'](function(_0xd20b69){logger['error'](_0x8222('0x14'),_0x11ebc0,_0xd20b69);_0x2e8815(_0xd20b69);});});}exports[_0x8222('0x16')]=function(_0x259985){var _0x1547ba=this;return new Promise(function(_0x5409c6,_0x5a6ad6){return db[_0x8222('0x17')][_0x8222('0x18')](_0x259985[_0x8222('0x19')],{'raw':_0x259985[_0x8222('0x1a')]?_0x259985['options'][_0x8222('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3d7cc8){logger['info'](_0x8222('0x16'),_0x259985);logger['debug'](_0x8222('0x16'),_0x259985,JSON[_0x8222('0x10')](_0x3d7cc8));_0x5409c6(_0x3d7cc8);})[_0x8222('0x1c')](function(_0x72c575){logger['error'](_0x8222('0x16'),_0x72c575['message'],_0x259985);_0x5a6ad6(_0x1547ba[_0x8222('0x12')](0x1f4,_0x72c575[_0x8222('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 172a0ec..e458ced 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 _0xd22c=['moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','/describe','describe','get','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id'];(function(_0x150eb9,_0x47b0e1){var _0x2f0feb=function(_0x2edba5){while(--_0x2edba5){_0x150eb9['push'](_0x150eb9['shift']());}};_0x2f0feb(++_0x47b0e1);}(_0xd22c,0x132));var _0xcd22=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0xd22c[_0x120bc2];return _0x454a41;};'use strict';var multer=require(_0xcd22('0x0'));var util=require(_0xcd22('0x1'));var path=require(_0xcd22('0x2'));var timeout=require(_0xcd22('0x3'));var express=require(_0xcd22('0x4'));var router=express['Router']();var auth=require(_0xcd22('0x5'));var interaction=require(_0xcd22('0x6'));var config=require(_0xcd22('0x7'));var controller=require(_0xcd22('0x8'));router['get']('/',auth[_0xcd22('0x9')](),controller[_0xcd22('0xa')]);router['get'](_0xcd22('0xb'),auth[_0xcd22('0x9')](),controller[_0xcd22('0xc')]);router[_0xcd22('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xcd22('0xe')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xcd22('0x9')](),controller[_0xcd22('0xf')]);router[_0xcd22('0xd')]('/campaign/countAttributes/:id',auth[_0xcd22('0x9')](),controller[_0xcd22('0x10')]);router['post'](_0xcd22('0x11'),auth[_0xcd22('0x9')](),controller[_0xcd22('0x12')]);router[_0xcd22('0x13')](_0xcd22('0x14'),auth[_0xcd22('0x9')](),controller[_0xcd22('0x15')]);router[_0xcd22('0x13')](_0xcd22('0x16'),auth[_0xcd22('0x9')](),controller[_0xcd22('0x17')]);router[_0xcd22('0x18')](_0xcd22('0x19'),auth[_0xcd22('0x9')](),controller[_0xcd22('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x79ae=['exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','get','/describe','isAuthenticated','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','put','update'];(function(_0x42e972,_0x4c3394){var _0x4f5522=function(_0x5d1d2b){while(--_0x5d1d2b){_0x42e972['push'](_0x42e972['shift']());}};_0x4f5522(++_0x4c3394);}(_0x79ae,0xe2));var _0xe79a=function(_0x24d289,_0x5d2748){_0x24d289=_0x24d289-0x0;var _0x8fc1fd=_0x79ae[_0x24d289];return _0x8fc1fd;};'use strict';var multer=require(_0xe79a('0x0'));var util=require(_0xe79a('0x1'));var path=require(_0xe79a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe79a('0x3'));var router=express[_0xe79a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe79a('0x5'));var config=require(_0xe79a('0x6'));var controller=require(_0xe79a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe79a('0x8')]);router[_0xe79a('0x9')](_0xe79a('0xa'),auth[_0xe79a('0xb')](),controller[_0xe79a('0xc')]);router['get'](_0xe79a('0xd'),auth[_0xe79a('0xb')](),controller[_0xe79a('0xe')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xe79a('0xb')](),controller[_0xe79a('0xf')]);router[_0xe79a('0x9')](_0xe79a('0x10'),auth[_0xe79a('0xb')](),controller[_0xe79a('0x11')]);router[_0xe79a('0x12')](_0xe79a('0x13'),auth['isAuthenticated'](),controller[_0xe79a('0x14')]);router[_0xe79a('0x12')]('/voice/campaign/moveContacts/:id',auth[_0xe79a('0xb')](),controller[_0xe79a('0x15')]);router['post']('/checkContactHopper',auth[_0xe79a('0xb')](),controller['checkContactHopper']);router[_0xe79a('0x16')](_0xe79a('0xd'),auth[_0xe79a('0xb')](),controller[_0xe79a('0x17')]);module[_0xe79a('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index f1c32a6..d66b8d2 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 _0x9f52=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x1cd568,_0x573cf8){var _0xaa7285=function(_0x3e1ef5){while(--_0x3e1ef5){_0x1cd568['push'](_0x1cd568['shift']());}};_0xaa7285(++_0x573cf8);}(_0x9f52,0x7e));var _0x29f5=function(_0x58257c,_0x26762b){_0x58257c=_0x58257c-0x0;var _0x407df3=_0x9f52[_0x58257c];return _0x407df3;};'use strict';var Sequelize=require(_0x29f5('0x0'));module[_0x29f5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x29f5('0x2')]},'scheduledat':{'type':Sequelize[_0x29f5('0x3')]},'countbusyretry':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x29f5('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x29f5('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x29f5('0x2')]},'starttime':{'type':Sequelize[_0x29f5('0x3')]},'responsetime':{'type':Sequelize[_0x29f5('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f5('0x3')]},'ringtime':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x29f5('0x2')]},'campaign':{'type':Sequelize[_0x29f5('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x29f5('0x2')]},'reason':{'type':Sequelize[_0x29f5('0x2')]},'amd':{'type':Sequelize[_0x29f5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x29f5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x29f5('0x3')]},'recallme':{'type':Sequelize[_0x29f5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x29f5('0x3')]},'edited':{'type':Sequelize[_0x29f5('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x29f5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2848=['DATE','STRING','BOOLEAN','exports','INTEGER'];(function(_0x145d4b,_0x504c75){var _0x3f3104=function(_0x4d3b31){while(--_0x4d3b31){_0x145d4b['push'](_0x145d4b['shift']());}};_0x3f3104(++_0x504c75);}(_0x2848,0xcb));var _0x8284=function(_0x569f86,_0x1a78bd){_0x569f86=_0x569f86-0x0;var _0x2aaecd=_0x2848[_0x569f86];return _0x2aaecd;};'use strict';var Sequelize=require('sequelize');module[_0x8284('0x0')]={'state':{'type':Sequelize[_0x8284('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8284('0x2')]},'countbusyretry':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8284('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8284('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8284('0x3')]},'calleridnum':{'type':Sequelize[_0x8284('0x3')]},'calleridname':{'type':Sequelize[_0x8284('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8284('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8284('0x2')]},'endtime':{'type':Sequelize[_0x8284('0x2')]},'ringtime':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8284('0x3')]},'campaigntype':{'type':Sequelize[_0x8284('0x3')]},'membername':{'type':Sequelize[_0x8284('0x3')]},'reason':{'type':Sequelize[_0x8284('0x3')]},'amd':{'type':Sequelize[_0x8284('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x8284('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8284('0x2')]},'edited':{'type':Sequelize[_0x8284('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8284('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 447e061..0df613e 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 _0xe86f=['type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CmHopperHistory','findAll','catch','show','length','includeAll','include','find','create','describe','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xe86f,0x1d2));var _0xfe86=function(_0x1bedd0,_0x132864){_0x1bedd0=_0x1bedd0-0x0;var _0x16f69d=_0xe86f[_0x1bedd0];return _0x16f69d;};'use strict';var pdf=require(_0xfe86('0x0'));var emlformat=require(_0xfe86('0x1'));var rimraf=require(_0xfe86('0x2'));var zipdir=require(_0xfe86('0x3'));var jsonpatch=require(_0xfe86('0x4'));var rp=require('request-promise');var moment=require(_0xfe86('0x5'));var BPromise=require(_0xfe86('0x6'));var Mustache=require(_0xfe86('0x7'));var util=require(_0xfe86('0x8'));var path=require('path');var sox=require(_0xfe86('0x9'));var csv=require(_0xfe86('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe86('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfe86('0xc'));var deskjs=require(_0xfe86('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfe86('0xe'));var Papa=require('papaparse');var Redis=require(_0xfe86('0xf'));var authService=require(_0xfe86('0x10'));var qs=require(_0xfe86('0x11'));var as=require(_0xfe86('0x12'));var hardwareService=require(_0xfe86('0x13'));var logger=require(_0xfe86('0x14'))(_0xfe86('0x15'));var utils=require(_0xfe86('0x16'));var config=require(_0xfe86('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f8d67,_0x3aa566){_0x3aa566=_0x3aa566||0xcc;return function(_0x3d856e){if(_0x3d856e){return _0x1f8d67[_0xfe86('0x18')](_0x3aa566);}return _0x1f8d67[_0xfe86('0x19')](_0x3aa566)[_0xfe86('0x1a')]();};}function respondWithResult(_0x3554f4,_0x463df7){_0x463df7=_0x463df7||0xc8;return function(_0x5dd6c1){if(_0x5dd6c1){return _0x3554f4[_0xfe86('0x19')](_0x463df7)['json'](_0x5dd6c1);}};}function respondWithFilteredResult(_0x32249a,_0x916eaf){return function(_0xffdce8){if(_0xffdce8){var _0x59655c=_0xffdce8[_0xfe86('0x1b')],_0x2fe7f1=_0x916eaf[_0xfe86('0x1c')],_0x317776=_0x916eaf['offset']+_0x916eaf[_0xfe86('0x1d')],_0x188ca9;if(_0x317776>=_0x59655c){_0x317776=_0x59655c;_0x188ca9=0xc8;}else{_0x188ca9=0xce;}_0x32249a['status'](_0x188ca9);return _0x32249a[_0xfe86('0x1e')](_0xfe86('0x1f'),_0x2fe7f1+'-'+_0x317776+'/'+_0x59655c)[_0xfe86('0x20')](_0xffdce8);}return null;};}function patchUpdates(_0x28f689){return function(_0xb3cc1d){try{jsonpatch['apply'](_0xb3cc1d,_0x28f689,!![]);}catch(_0x1d9d77){return BPromise[_0xfe86('0x21')](_0x1d9d77);}return _0xb3cc1d[_0xfe86('0x22')]();};}function saveUpdates(_0x3e93dd,_0x3f2864){return function(_0xe3294){if(_0xe3294){return _0xe3294[_0xfe86('0x23')](_0x3e93dd)[_0xfe86('0x24')](function(_0x446df3){return _0x446df3;});}return null;};}function removeEntity(_0x57b0d3,_0x2addaf){return function(_0x55761d){if(_0x55761d){return _0x55761d[_0xfe86('0x25')]()[_0xfe86('0x24')](function(){_0x57b0d3[_0xfe86('0x19')](0xcc)[_0xfe86('0x1a')]();});}};}function handleEntityNotFound(_0x232746,_0x4ffa30){return function(_0x4fe627){if(!_0x4fe627){_0x232746[_0xfe86('0x18')](0x194);}return _0x4fe627;};}function handleError(_0x2279c4,_0x209147){_0x209147=_0x209147||0x1f4;return function(_0x49bd6c){logger[_0xfe86('0x26')](_0x49bd6c[_0xfe86('0x27')]);if(_0x49bd6c['name']){delete _0x49bd6c[_0xfe86('0x28')];}_0x2279c4[_0xfe86('0x19')](_0x209147)['send'](_0x49bd6c);};}exports[_0xfe86('0x29')]=function(_0x2326a0,_0x386c23){var _0x52d905={},_0x1edddb={},_0x4c1249={'count':0x0,'rows':[]};var _0x1c1d3e=_[_0xfe86('0x2a')](db['CmHopperHistory'][_0xfe86('0x2b')],function(_0x59cc37){return{'name':_0x59cc37[_0xfe86('0x2c')],'type':_0x59cc37[_0xfe86('0x2d')]['key']};});_0x1edddb[_0xfe86('0x2e')]=_[_0xfe86('0x2a')](_0x1c1d3e,'name');_0x1edddb[_0xfe86('0x2f')]=_[_0xfe86('0x30')](_0x2326a0[_0xfe86('0x2f')]);_0x1edddb[_0xfe86('0x31')]=_['intersection'](_0x1edddb[_0xfe86('0x2e')],_0x1edddb[_0xfe86('0x2f')]);_0x52d905[_0xfe86('0x32')]=_[_0xfe86('0x33')](_0x1edddb['model'],qs[_0xfe86('0x34')](_0x2326a0[_0xfe86('0x2f')][_0xfe86('0x34')]));_0x52d905[_0xfe86('0x32')]=_0x52d905[_0xfe86('0x32')]['length']?_0x52d905[_0xfe86('0x32')]:_0x1edddb[_0xfe86('0x2e')];if(!_0x2326a0[_0xfe86('0x2f')][_0xfe86('0x35')](_0xfe86('0x36'))){_0x52d905[_0xfe86('0x1d')]=qs[_0xfe86('0x1d')](_0x2326a0[_0xfe86('0x2f')][_0xfe86('0x1d')]);_0x52d905[_0xfe86('0x1c')]=qs['offset'](_0x2326a0[_0xfe86('0x2f')][_0xfe86('0x1c')]);}_0x52d905[_0xfe86('0x37')]=qs[_0xfe86('0x38')](_0x2326a0[_0xfe86('0x2f')][_0xfe86('0x38')]);_0x52d905[_0xfe86('0x39')]=qs[_0xfe86('0x31')](_['pick'](_0x2326a0[_0xfe86('0x2f')],_0x1edddb[_0xfe86('0x31')]),_0x1c1d3e);if(_0x2326a0[_0xfe86('0x2f')][_0xfe86('0x3a')]){_0x52d905[_0xfe86('0x39')]=_[_0xfe86('0x3b')](_0x52d905[_0xfe86('0x39')],{'$or':_[_0xfe86('0x2a')](_0x1c1d3e,function(_0x3c8b6c){if(_0x3c8b6c['type']!=='VIRTUAL'){var _0x1c3640={};_0x1c3640[_0x3c8b6c[_0xfe86('0x28')]]={'$like':'%'+_0x2326a0[_0xfe86('0x2f')][_0xfe86('0x3a')]+'%'};return _0x1c3640;}})});}_0x52d905=_[_0xfe86('0x3b')]({},_0x52d905,_0x2326a0[_0xfe86('0x3c')]);var _0x2b5264={'where':_0x52d905[_0xfe86('0x39')]};return db[_0xfe86('0x3d')][_0xfe86('0x1b')](_0x2b5264)[_0xfe86('0x24')](function(_0x50ace2){_0x4c1249[_0xfe86('0x1b')]=_0x50ace2;if(_0x2326a0[_0xfe86('0x2f')]['includeAll']){_0x52d905['include']=[{'all':!![]}];}return db[_0xfe86('0x3d')][_0xfe86('0x3e')](_0x52d905);})[_0xfe86('0x24')](function(_0x49fd42){_0x4c1249['rows']=_0x49fd42;return _0x4c1249;})[_0xfe86('0x24')](respondWithFilteredResult(_0x386c23,_0x52d905))[_0xfe86('0x3f')](handleError(_0x386c23,null));};exports[_0xfe86('0x40')]=function(_0x310000,_0x42fef2){var _0x267a30={'raw':!![],'where':{'id':_0x310000['params']['id']}},_0x282c63={};_0x282c63[_0xfe86('0x2e')]=_[_0xfe86('0x30')](db['CmHopperHistory'][_0xfe86('0x2b')]);_0x282c63[_0xfe86('0x2f')]=_['keys'](_0x310000['query']);_0x282c63[_0xfe86('0x31')]=_[_0xfe86('0x33')](_0x282c63[_0xfe86('0x2e')],_0x282c63[_0xfe86('0x2f')]);_0x267a30[_0xfe86('0x32')]=_[_0xfe86('0x33')](_0x282c63[_0xfe86('0x2e')],qs['fields'](_0x310000[_0xfe86('0x2f')][_0xfe86('0x34')]));_0x267a30[_0xfe86('0x32')]=_0x267a30[_0xfe86('0x32')][_0xfe86('0x41')]?_0x267a30[_0xfe86('0x32')]:_0x282c63['model'];if(_0x310000[_0xfe86('0x2f')][_0xfe86('0x42')]){_0x267a30[_0xfe86('0x43')]=[{'all':!![]}];}_0x267a30=_[_0xfe86('0x3b')]({},_0x267a30,_0x310000[_0xfe86('0x3c')]);return db['CmHopperHistory'][_0xfe86('0x44')](_0x267a30)[_0xfe86('0x24')](handleEntityNotFound(_0x42fef2,null))['then'](respondWithResult(_0x42fef2,null))[_0xfe86('0x3f')](handleError(_0x42fef2,null));};exports[_0xfe86('0x45')]=function(_0x2028ff,_0x11217f){return db['CmHopperHistory'][_0xfe86('0x45')](_0x2028ff['body'],{})[_0xfe86('0x24')](respondWithResult(_0x11217f,0xc9))['catch'](handleError(_0x11217f,null));};exports[_0xfe86('0x46')]=function(_0x40210a,_0x37de40){return db[_0xfe86('0x3d')][_0xfe86('0x46')]()['then'](respondWithResult(_0x37de40,null))['catch'](handleError(_0x37de40,null));};exports[_0xfe86('0x23')]=function(_0x5852a0,_0x5c705a){if(_0x5852a0[_0xfe86('0x47')]['uniqueid']){delete _0x5852a0[_0xfe86('0x47')]['uniqueid'];}return db['CmHopperHistory'][_0xfe86('0x44')]({'where':{'uniqueid':_0x5852a0[_0xfe86('0x48')]['id']}})[_0xfe86('0x24')](handleEntityNotFound(_0x5c705a,null))[_0xfe86('0x24')](saveUpdates(_0x5852a0[_0xfe86('0x47')],null))[_0xfe86('0x24')](respondWithResult(_0x5c705a,null))[_0xfe86('0x3f')](handleError(_0x5c705a,null));}; \ No newline at end of file +var _0x0403=['filter','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','describe','uniqueid','find','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL'];(function(_0x442201,_0x50588e){var _0x28ca10=function(_0x2caf60){while(--_0x2caf60){_0x442201['push'](_0x442201['shift']());}};_0x28ca10(++_0x50588e);}(_0x0403,0xe7));var _0x3040=function(_0x1a4cd0,_0x470bb6){_0x1a4cd0=_0x1a4cd0-0x0;var _0x2022e7=_0x0403[_0x1a4cd0];return _0x2022e7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3040('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3040('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3040('0x2'));var moment=require('moment');var BPromise=require(_0x3040('0x3'));var Mustache=require(_0x3040('0x4'));var util=require(_0x3040('0x5'));var path=require('path');var sox=require(_0x3040('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3040('0x7'));var crypto=require('crypto');var jsforce=require(_0x3040('0x8'));var deskjs=require(_0x3040('0x9'));var toCsv=require(_0x3040('0xa'));var querystring=require(_0x3040('0xb'));var Papa=require(_0x3040('0xc'));var Redis=require(_0x3040('0xd'));var authService=require(_0x3040('0xe'));var qs=require(_0x3040('0xf'));var as=require(_0x3040('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3040('0x11'));var utils=require(_0x3040('0x12'));var config=require(_0x3040('0x13'));var db=require(_0x3040('0x14'))['db'];function respondWithStatusCode(_0x5bb00a,_0x2d1f38){_0x2d1f38=_0x2d1f38||0xcc;return function(_0x229d21){if(_0x229d21){return _0x5bb00a['sendStatus'](_0x2d1f38);}return _0x5bb00a['status'](_0x2d1f38)[_0x3040('0x15')]();};}function respondWithResult(_0x33d54d,_0x41a273){_0x41a273=_0x41a273||0xc8;return function(_0x32b773){if(_0x32b773){return _0x33d54d[_0x3040('0x16')](_0x41a273)[_0x3040('0x17')](_0x32b773);}};}function respondWithFilteredResult(_0x5d9950,_0x1359f4){return function(_0x77376c){if(_0x77376c){var _0x1b2c03=_0x77376c['count'],_0x4a5af7=_0x1359f4[_0x3040('0x18')],_0x395a76=_0x1359f4[_0x3040('0x18')]+_0x1359f4[_0x3040('0x19')],_0x36556b;if(_0x395a76>=_0x1b2c03){_0x395a76=_0x1b2c03;_0x36556b=0xc8;}else{_0x36556b=0xce;}_0x5d9950[_0x3040('0x16')](_0x36556b);return _0x5d9950[_0x3040('0x1a')](_0x3040('0x1b'),_0x4a5af7+'-'+_0x395a76+'/'+_0x1b2c03)[_0x3040('0x17')](_0x77376c);}return null;};}function patchUpdates(_0x168722){return function(_0x5002d3){try{jsonpatch[_0x3040('0x1c')](_0x5002d3,_0x168722,!![]);}catch(_0x4358a1){return BPromise['reject'](_0x4358a1);}return _0x5002d3[_0x3040('0x1d')]();};}function saveUpdates(_0x1fea0b,_0x3697d2){return function(_0x5418f5){if(_0x5418f5){return _0x5418f5[_0x3040('0x1e')](_0x1fea0b)[_0x3040('0x1f')](function(_0x32ad58){return _0x32ad58;});}return null;};}function removeEntity(_0xa31a8,_0x3b80c4){return function(_0x52a5f1){if(_0x52a5f1){return _0x52a5f1[_0x3040('0x20')]()['then'](function(){_0xa31a8['status'](0xcc)[_0x3040('0x15')]();});}};}function handleEntityNotFound(_0x426557,_0x59ab7f){return function(_0x9f4607){if(!_0x9f4607){_0x426557['sendStatus'](0x194);}return _0x9f4607;};}function handleError(_0x42c47a,_0x492077){_0x492077=_0x492077||0x1f4;return function(_0x27b43e){logger['error'](_0x27b43e['stack']);if(_0x27b43e[_0x3040('0x21')]){delete _0x27b43e[_0x3040('0x21')];}_0x42c47a[_0x3040('0x16')](_0x492077)[_0x3040('0x22')](_0x27b43e);};}exports[_0x3040('0x23')]=function(_0x226ecb,_0x28b83f){var _0x594217={},_0xa967e5={},_0x4c504d={'count':0x0,'rows':[]};var _0x17a372=_['map'](db[_0x3040('0x24')][_0x3040('0x25')],function(_0x45ae6c){return{'name':_0x45ae6c[_0x3040('0x26')],'type':_0x45ae6c[_0x3040('0x27')][_0x3040('0x28')]};});_0xa967e5[_0x3040('0x29')]=_[_0x3040('0x2a')](_0x17a372,'name');_0xa967e5[_0x3040('0x2b')]=_[_0x3040('0x2c')](_0x226ecb['query']);_0xa967e5[_0x3040('0x2d')]=_[_0x3040('0x2e')](_0xa967e5[_0x3040('0x29')],_0xa967e5['query']);_0x594217[_0x3040('0x2f')]=_[_0x3040('0x2e')](_0xa967e5[_0x3040('0x29')],qs[_0x3040('0x30')](_0x226ecb[_0x3040('0x2b')]['fields']));_0x594217[_0x3040('0x2f')]=_0x594217['attributes'][_0x3040('0x31')]?_0x594217['attributes']:_0xa967e5[_0x3040('0x29')];if(!_0x226ecb['query'][_0x3040('0x32')](_0x3040('0x33'))){_0x594217[_0x3040('0x19')]=qs[_0x3040('0x19')](_0x226ecb[_0x3040('0x2b')][_0x3040('0x19')]);_0x594217[_0x3040('0x18')]=qs[_0x3040('0x18')](_0x226ecb[_0x3040('0x2b')][_0x3040('0x18')]);}_0x594217['order']=qs['sort'](_0x226ecb[_0x3040('0x2b')][_0x3040('0x34')]);_0x594217[_0x3040('0x35')]=qs[_0x3040('0x2d')](_[_0x3040('0x36')](_0x226ecb[_0x3040('0x2b')],_0xa967e5[_0x3040('0x2d')]),_0x17a372);if(_0x226ecb[_0x3040('0x2b')]['filter']){_0x594217[_0x3040('0x35')]=_[_0x3040('0x37')](_0x594217[_0x3040('0x35')],{'$or':_[_0x3040('0x2a')](_0x17a372,function(_0x561eb1){if(_0x561eb1[_0x3040('0x27')]!==_0x3040('0x38')){var _0x5e0b9b={};_0x5e0b9b[_0x561eb1['name']]={'$like':'%'+_0x226ecb['query'][_0x3040('0x39')]+'%'};return _0x5e0b9b;}})});}_0x594217=_[_0x3040('0x37')]({},_0x594217,_0x226ecb[_0x3040('0x3a')]);var _0x360cee={'where':_0x594217[_0x3040('0x35')]};return db['CmHopperHistory']['count'](_0x360cee)['then'](function(_0x4e4322){_0x4c504d[_0x3040('0x3b')]=_0x4e4322;if(_0x226ecb[_0x3040('0x2b')][_0x3040('0x3c')]){_0x594217['include']=[{'all':!![]}];}return db[_0x3040('0x24')][_0x3040('0x3d')](_0x594217);})[_0x3040('0x1f')](function(_0x37c836){_0x4c504d[_0x3040('0x3e')]=_0x37c836;return _0x4c504d;})[_0x3040('0x1f')](respondWithFilteredResult(_0x28b83f,_0x594217))[_0x3040('0x3f')](handleError(_0x28b83f,null));};exports[_0x3040('0x40')]=function(_0xcada4,_0x48023d){var _0x4ee9c7={'raw':!![],'where':{'id':_0xcada4[_0x3040('0x41')]['id']}},_0x5bb79a={};_0x5bb79a[_0x3040('0x29')]=_['keys'](db[_0x3040('0x24')][_0x3040('0x25')]);_0x5bb79a[_0x3040('0x2b')]=_[_0x3040('0x2c')](_0xcada4[_0x3040('0x2b')]);_0x5bb79a[_0x3040('0x2d')]=_[_0x3040('0x2e')](_0x5bb79a[_0x3040('0x29')],_0x5bb79a[_0x3040('0x2b')]);_0x4ee9c7[_0x3040('0x2f')]=_[_0x3040('0x2e')](_0x5bb79a[_0x3040('0x29')],qs[_0x3040('0x30')](_0xcada4['query']['fields']));_0x4ee9c7[_0x3040('0x2f')]=_0x4ee9c7[_0x3040('0x2f')][_0x3040('0x31')]?_0x4ee9c7[_0x3040('0x2f')]:_0x5bb79a[_0x3040('0x29')];if(_0xcada4[_0x3040('0x2b')][_0x3040('0x3c')]){_0x4ee9c7[_0x3040('0x42')]=[{'all':!![]}];}_0x4ee9c7=_[_0x3040('0x37')]({},_0x4ee9c7,_0xcada4[_0x3040('0x3a')]);return db['CmHopperHistory']['find'](_0x4ee9c7)[_0x3040('0x1f')](handleEntityNotFound(_0x48023d,null))['then'](respondWithResult(_0x48023d,null))[_0x3040('0x3f')](handleError(_0x48023d,null));};exports[_0x3040('0x43')]=function(_0x1fb5d9,_0xe18aa9){return db[_0x3040('0x24')]['create'](_0x1fb5d9[_0x3040('0x44')],{})['then'](respondWithResult(_0xe18aa9,0xc9))[_0x3040('0x3f')](handleError(_0xe18aa9,null));};exports[_0x3040('0x45')]=function(_0x1a836c,_0x595e3f){return db[_0x3040('0x24')]['describe']()[_0x3040('0x1f')](respondWithResult(_0x595e3f,null))['catch'](handleError(_0x595e3f,null));};exports['update']=function(_0x2075c2,_0xd4a785){if(_0x2075c2[_0x3040('0x44')][_0x3040('0x46')]){delete _0x2075c2['body']['uniqueid'];}return db['CmHopperHistory'][_0x3040('0x47')]({'where':{'uniqueid':_0x2075c2['params']['id']}})[_0x3040('0x1f')](handleEntityNotFound(_0xd4a785,null))['then'](saveUpdates(_0x2075c2['body'],null))[_0x3040('0x1f')](respondWithResult(_0xd4a785,null))[_0x3040('0x3f')](handleError(_0xd4a785,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index fb083e8..f0f650e 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 _0xb022=['cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','request-promise','path','./cmHopperHistory.attributes','exports','CmHopperHistory'];(function(_0x206205,_0x35ea5c){var _0x483159=function(_0x120373){while(--_0x120373){_0x206205['push'](_0x206205['shift']());}};_0x483159(++_0x35ea5c);}(_0xb022,0x1e3));var _0x2b02=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb022[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x2b02('0x0'));var util=require(_0x2b02('0x1'));var logger=require('../../config/logger')(_0x2b02('0x2'));var moment=require(_0x2b02('0x3'));var BPromise=require('bluebird');var rp=require(_0x2b02('0x4'));var fs=require('fs');var path=require(_0x2b02('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b02('0x6'));module[_0x2b02('0x7')]=function(_0x56412d,_0x8238f2){return _0x56412d['define'](_0x2b02('0x8'),attributes,{'tableName':_0x2b02('0x9'),'paranoid':![],'indexes':[{'name':_0x2b02('0xa'),'fields':[_0x2b02('0xa')]},{'name':_0x2b02('0xb'),'fields':[_0x2b02('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc2a=['request-promise','rimraf','../../config/environment','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','api'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xfc2a,0x15d));var _0xafc2=function(_0x507b56,_0x1ec32c){_0x507b56=_0x507b56-0x0;var _0x6ce95b=_0xfc2a[_0x507b56];return _0x6ce95b;};'use strict';var _=require(_0xafc2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xafc2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xafc2('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafc2('0x3'));var config=require(_0xafc2('0x4'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x406d95,_0xa82467){return _0x406d95['define'](_0xafc2('0x5'),attributes,{'tableName':_0xafc2('0x6'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xafc2('0x7')]},{'name':'uniqueid','fields':[_0xafc2('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 829cc0b..55ba3a1 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 _0x34b7=['stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','outboundReCallsDay','name','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x34b7,0x196));var _0x734b=function(_0x1f5236,_0xea7afc){_0x1f5236=_0x1f5236-0x0;var _0x2efe18=_0x34b7[_0x1f5236];return _0x2efe18;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateCmHopperHistory',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});};exports[_0x734b('0x1c')]=function(_0x46d432){var _0x26d118=this;return new Promise(function(_0x26eccf,_0x104fff){return db[_0x734b('0x16')][_0x734b('0x1d')]({'raw':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x46d432['options']?_0x46d432['options'][_0x734b('0x1e')]||null:null,'attributes':[[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')][_0x734b('0x20')]('id')),_0x734b('0x21')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x23')))),_0x734b('0x24')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x26')))),_0x734b('0x27')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x28')))),_0x734b('0x29')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x2a'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x2b')))),_0x734b('0x2c')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x2a'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x2d')))),'predictiveIntervalAvgTalktime']]})[_0x734b('0x1b')](function(_0x5e2444){logger[_0x734b('0xa')](_0x734b('0x1c'),_0x46d432);logger[_0x734b('0xc')](_0x734b('0x1c'),_0x46d432,JSON[_0x734b('0xe')](_0x5e2444));_0x26eccf(_0x5e2444);})[_0x734b('0x14')](function(_0x55bd2e){logger['error'](_0x734b('0x1c'),_0x55bd2e['message'],_0x46d432);_0x104fff(_0x26d118[_0x734b('0xf')](0x1f4,_0x55bd2e['message']));});});};exports[_0x734b('0x2e')]=function(_0x4b30eb){var _0x1875f1=this;return new Promise(function(_0x5ea4a0,_0x37d891){return db[_0x734b('0x16')][_0x734b('0x1d')]({'raw':_0x4b30eb[_0x734b('0x19')]?_0x4b30eb[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4b30eb[_0x734b('0x19')]?_0x4b30eb['options'][_0x734b('0x1e')]||null:null,'attributes':[[_0x734b('0x2f'),'name'],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x30')))),_0x734b('0x31')],[db['sequelize']['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x32')))),_0x734b('0x33')],[db[_0x734b('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x734b('0x1f')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x734b('0x34')],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x35')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x36')))),'outboundCongestionCallsDay'],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x734b('0x37')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x734b('0x38')],[db['sequelize']['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x39')))),_0x734b('0x3a')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')](_0x734b('0x3b')))),_0x734b('0x3c')],[db['sequelize']['fn'](_0x734b('0x22'),db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0x734b('0x3d')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')]['literal'](_0x734b('0x3e')))),'outboundRejectCallsDay'],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')](_0x734b('0x3f')))),_0x734b('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),_0x734b('0x41')],[db[_0x734b('0x1f')]['fn']('COUNT',db[_0x734b('0x1f')]['fn']('IF',db[_0x734b('0x1f')][_0x734b('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x734b('0x42')]],'group':[_0x734b('0x2f')]})[_0x734b('0x1b')](function(_0xe605be){logger['info'](_0x734b('0x2e'),_0x4b30eb);logger[_0x734b('0xc')](_0x734b('0x2e'),_0x4b30eb,JSON[_0x734b('0xe')](_0xe605be));_0x5ea4a0(_0xe605be);})['catch'](function(_0x27f0ff){logger['error'](_0x734b('0x2e'),_0x27f0ff[_0x734b('0x12')],_0x4b30eb);_0x37d891(_0x1875f1[_0x734b('0xf')](0x1f4,_0x27f0ff[_0x734b('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x2b9da7){var _0x1af382=this;return new Promise(function(_0x5b9adc,_0x541e70){return db[_0x734b('0x16')]['findAll']({'raw':_0x2b9da7[_0x734b('0x19')]?_0x2b9da7[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b9da7['options']?_0x2b9da7[_0x734b('0x19')]['where']||null:null,'attributes':[[_0x734b('0x2f'),_0x734b('0x43')],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db['sequelize'][_0x734b('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x734b('0x1f')]['fn'](_0x734b('0x22'),db[_0x734b('0x1f')]['fn']('IF',db['sequelize'][_0x734b('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x734b('0x44')]],'group':[_0x734b('0x2f')]})[_0x734b('0x1b')](function(_0x257a87){logger['info'](_0x734b('0x45'),_0x2b9da7);logger['debug'](_0x734b('0x45'),_0x2b9da7,JSON[_0x734b('0xe')](_0x257a87));_0x5b9adc(_0x257a87);})[_0x734b('0x14')](function(_0x4dbff2){logger[_0x734b('0xf')](_0x734b('0x45'),_0x4dbff2[_0x734b('0x12')],_0x2b9da7);_0x541e70(_0x1af382[_0x734b('0xf')](0x1f4,_0x4dbff2[_0x734b('0x12')]));});});}; \ No newline at end of file +var _0x96cc=['`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit'];(function(_0x313927,_0x2b3a6d){var _0x545b28=function(_0x1be96e){while(--_0x1be96e){_0x313927['push'](_0x313927['shift']());}};_0x545b28(++_0x2b3a6d);}(_0x96cc,0x16c));var _0xc96c=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x96cc[_0x10291b];return _0x1d5fbe;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});}exports[_0xc96c('0x17')]=function(_0x99c402){var _0x16b6ce=this;return new Promise(function(_0x2ae19a,_0x4aa6a3){return db[_0xc96c('0x18')][_0xc96c('0x19')](_0x99c402[_0xc96c('0x1a')],{'raw':_0x99c402[_0xc96c('0x1b')]?_0x99c402[_0xc96c('0x1b')][_0xc96c('0x1c')]===undefined?!![]:![]:!![]})[_0xc96c('0xc')](function(_0x41daba){logger[_0xc96c('0xd')](_0xc96c('0x17'),_0x99c402);logger[_0xc96c('0x1d')](_0xc96c('0x17'),_0x99c402,JSON[_0xc96c('0x11')](_0x41daba));_0x2ae19a(_0x41daba);})[_0xc96c('0x16')](function(_0x325c54){logger[_0xc96c('0x12')](_0xc96c('0x17'),_0x325c54['message'],_0x99c402);_0x4aa6a3(_0x16b6ce[_0xc96c('0x12')](0x1f4,_0x325c54[_0xc96c('0x14')]));});});};exports[_0xc96c('0x1e')]=function(_0x10ae21){var _0x2b1df9=this;return new Promise(function(_0x35f480,_0x40f23d){return db[_0xc96c('0x18')][_0xc96c('0x1f')]({'raw':_0x10ae21[_0xc96c('0x1b')]?_0x10ae21['options'][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x10ae21[_0xc96c('0x1b')]?_0x10ae21[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xc96c('0x21')][_0xc96c('0x22')]('id')),_0xc96c('0x23')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x27')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal'](_0xc96c('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')](_0xc96c('0x29')))),_0xc96c('0x2a')],[db[_0xc96c('0x21')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x2b')))),'predictiveIntervalAvgHoldtime'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x2c'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal'](_0xc96c('0x2d')))),_0xc96c('0x2e')]]})['then'](function(_0x2b1dec){logger[_0xc96c('0xd')](_0xc96c('0x1e'),_0x10ae21);logger[_0xc96c('0x1d')](_0xc96c('0x1e'),_0x10ae21,JSON[_0xc96c('0x11')](_0x2b1dec));_0x35f480(_0x2b1dec);})['catch'](function(_0x35dfb7){logger[_0xc96c('0x12')](_0xc96c('0x1e'),_0x35dfb7[_0xc96c('0x14')],_0x10ae21);_0x40f23d(_0x2b1df9[_0xc96c('0x12')](0x1f4,_0x35dfb7[_0xc96c('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x56b5c9){var _0x33b4bb=this;return new Promise(function(_0x156d0f,_0x5006ec){return db['CmHopperHistory'][_0xc96c('0x1f')]({'raw':_0x56b5c9[_0xc96c('0x1b')]?_0x56b5c9[_0xc96c('0x1b')][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x56b5c9[_0xc96c('0x1b')]?_0x56b5c9[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[_0xc96c('0x2f'),_0xc96c('0x30')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x31')))),_0xc96c('0x32')],[db['sequelize']['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xc96c('0x33')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x34')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc96c('0x35')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x36')))),'outboundDropCallsDayTimeout'],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc96c('0x37')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x38')))),_0xc96c('0x39')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0xc96c('0x3a')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')]('`state`\x20=\x2014,\x201,\x20null'))),_0xc96c('0x3b')],[db[_0xc96c('0x21')]['fn']('COUNT',db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x3c')))),_0xc96c('0x3d')],[db[_0xc96c('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc96c('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0xc96c('0x3e')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x3f')))),_0xc96c('0x3d')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db['sequelize']['fn']('IF',db[_0xc96c('0x21')][_0xc96c('0x25')](_0xc96c('0x40')))),_0xc96c('0x41')]],'group':[_0xc96c('0x2f')]})[_0xc96c('0xc')](function(_0xad88c3){logger[_0xc96c('0xd')]('GetVoiceQueueHopperHistory',_0x56b5c9);logger['debug']('GetVoiceQueueHopperHistory',_0x56b5c9,JSON['stringify'](_0xad88c3));_0x156d0f(_0xad88c3);})[_0xc96c('0x16')](function(_0x46c6fb){logger[_0xc96c('0x12')](_0xc96c('0x42'),_0x46c6fb[_0xc96c('0x14')],_0x56b5c9);_0x5006ec(_0x33b4bb[_0xc96c('0x12')](0x1f4,_0x46c6fb[_0xc96c('0x14')]));});});};exports['GetCampaignHopperHistory']=function(_0x47115b){var _0x48dc98=this;return new Promise(function(_0x3c4b60,_0x103e90){return db[_0xc96c('0x18')][_0xc96c('0x1f')]({'raw':_0x47115b[_0xc96c('0x1b')]?_0x47115b['options'][_0xc96c('0x1c')]===undefined?!![]:![]:!![],'where':_0x47115b[_0xc96c('0x1b')]?_0x47115b[_0xc96c('0x1b')][_0xc96c('0x20')]||null:null,'attributes':[[_0xc96c('0x2f'),_0xc96c('0x30')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')][_0xc96c('0x22')]('id')),_0xc96c('0x43')],[db[_0xc96c('0x21')]['fn'](_0xc96c('0x24'),db[_0xc96c('0x21')]['fn']('IF',db['sequelize'][_0xc96c('0x25')](_0xc96c('0x26')))),_0xc96c('0x44')]],'group':[_0xc96c('0x2f')]})[_0xc96c('0xc')](function(_0x55219a){logger[_0xc96c('0xd')](_0xc96c('0x45'),_0x47115b);logger[_0xc96c('0x1d')](_0xc96c('0x45'),_0x47115b,JSON['stringify'](_0x55219a));_0x3c4b60(_0x55219a);})[_0xc96c('0x16')](function(_0x4629ce){logger['error']('GetCampaignHopperHistory',_0x4629ce['message'],_0x47115b);_0x103e90(_0x48dc98[_0xc96c('0x12')](0x1f4,_0x4629ce[_0xc96c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c29e855..f3e5b78 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 _0x853e=['../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','util','connect-timeout','Router','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x853e,0x1ea));var _0xe853=function(_0x10f46e,_0x2cfaaa){_0x10f46e=_0x10f46e-0x0;var _0x3e48cc=_0x853e[_0x10f46e];return _0x3e48cc;};'use strict';var multer=require('multer');var util=require(_0xe853('0x0'));var path=require('path');var timeout=require(_0xe853('0x1'));var express=require('express');var router=express[_0xe853('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe853('0x3'));var config=require(_0xe853('0x4'));var controller=require(_0xe853('0x5'));router[_0xe853('0x6')]('/',auth[_0xe853('0x7')](),controller['index']);router[_0xe853('0x6')](_0xe853('0x8'),auth[_0xe853('0x7')](),controller[_0xe853('0x9')]);router[_0xe853('0x6')](_0xe853('0xa'),auth[_0xe853('0x7')](),controller[_0xe853('0xb')]);router[_0xe853('0xc')]('/',auth[_0xe853('0x7')](),controller['create']);router['put']('/:id',auth[_0xe853('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x09f6=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x544d0f,_0x106b83){var _0x2bb39a=function(_0x232712){while(--_0x232712){_0x544d0f['push'](_0x544d0f['shift']());}};_0x2bb39a(++_0x106b83);}(_0x09f6,0xfd));var _0x609f=function(_0x4d9d4e,_0x23d33f){_0x4d9d4e=_0x4d9d4e-0x0;var _0x57238c=_0x09f6[_0x4d9d4e];return _0x57238c;};'use strict';var multer=require(_0x609f('0x0'));var util=require('util');var path=require(_0x609f('0x1'));var timeout=require(_0x609f('0x2'));var express=require(_0x609f('0x3'));var router=express[_0x609f('0x4')]();var auth=require(_0x609f('0x5'));var interaction=require(_0x609f('0x6'));var config=require(_0x609f('0x7'));var controller=require(_0x609f('0x8'));router[_0x609f('0x9')]('/',auth[_0x609f('0xa')](),controller[_0x609f('0xb')]);router[_0x609f('0x9')](_0x609f('0xc'),auth[_0x609f('0xa')](),controller['describe']);router[_0x609f('0x9')](_0x609f('0xd'),auth[_0x609f('0xa')](),controller[_0x609f('0xe')]);router[_0x609f('0xf')]('/',auth[_0x609f('0xa')](),controller['create']);router[_0x609f('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x609f('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 d26318d..7d28052 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 _0x3f51=['STRING','name','exports'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x3f51,0x65));var _0x13f5=function(_0x485ec3,_0x10837c){_0x485ec3=_0x485ec3-0x0;var _0xe2cc1c=_0x3f51[_0x485ec3];return _0xe2cc1c;};'use strict';var Sequelize=require('sequelize');module[_0x13f5('0x0')]={'name':{'type':Sequelize[_0x13f5('0x1')],'unique':_0x13f5('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x13f5('0x1')]},'dialPrefix':{'type':Sequelize[_0x13f5('0x1')]}}; \ No newline at end of file +var _0xa854=['STRING','sequelize'];(function(_0x388db3,_0x3bd5b8){var _0x5bc35f=function(_0x225761){while(--_0x225761){_0x388db3['push'](_0x388db3['shift']());}};_0x5bc35f(++_0x3bd5b8);}(_0xa854,0xe7));var _0x4a85=function(_0x5a0ff2,_0x3b5275){_0x5a0ff2=_0x5a0ff2-0x0;var _0xaf6f91=_0xa854[_0x5a0ff2];return _0xaf6f91;};'use strict';var Sequelize=require(_0x4a85('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a85('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4a85('0x1')]},'dialPrefix':{'type':Sequelize[_0x4a85('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index aeecf51..66f14ea 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 _0xd4b7=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./cmList.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','options','includeAll','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','raw','getContactsCsv','cf_%d','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x172eb7,_0x4589bd){var _0x5dc528=function(_0x583b8e){while(--_0x583b8e){_0x172eb7['push'](_0x172eb7['shift']());}};_0x5dc528(++_0x4589bd);}(_0xd4b7,0x1b4));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7d4b('0x0'));var emlformat=require(_0x7d4b('0x1'));var rimraf=require(_0x7d4b('0x2'));var zipdir=require(_0x7d4b('0x3'));var jsonpatch=require(_0x7d4b('0x4'));var rp=require(_0x7d4b('0x5'));var moment=require('moment');var BPromise=require(_0x7d4b('0x6'));var Mustache=require(_0x7d4b('0x7'));var util=require(_0x7d4b('0x8'));var path=require('path');var sox=require(_0x7d4b('0x9'));var csv=require(_0x7d4b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d4b('0xb'));var squel=require(_0x7d4b('0xc'));var crypto=require(_0x7d4b('0xd'));var jsforce=require(_0x7d4b('0xe'));var deskjs=require(_0x7d4b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7d4b('0x10'));var Papa=require(_0x7d4b('0x11'));var Redis=require(_0x7d4b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7d4b('0x13'));var as=require(_0x7d4b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d4b('0x15'));var utils=require(_0x7d4b('0x16'));var config=require(_0x7d4b('0x17'));var db=require(_0x7d4b('0x18'))['db'];config['redis']=_[_0x7d4b('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d4b('0x1a')]));require(_0x7d4b('0x1b'))['register'](socket);function respondWithStatusCode(_0x5070e8,_0x5f10a1){_0x5f10a1=_0x5f10a1||0xcc;return function(_0x4efcb8){if(_0x4efcb8){return _0x5070e8[_0x7d4b('0x1c')](_0x5f10a1);}return _0x5070e8[_0x7d4b('0x1d')](_0x5f10a1)[_0x7d4b('0x1e')]();};}function respondWithResult(_0x21adf8,_0x36644a){_0x36644a=_0x36644a||0xc8;return function(_0x5b5987){if(_0x5b5987){return _0x21adf8[_0x7d4b('0x1d')](_0x36644a)[_0x7d4b('0x1f')](_0x5b5987);}};}function respondWithFilteredResult(_0x42e137,_0x247115){return function(_0x5d339e){if(_0x5d339e){var _0x5ca5f1=_0x5d339e[_0x7d4b('0x20')],_0x4ac837=_0x247115['offset'],_0x3aa1e4=_0x247115[_0x7d4b('0x21')]+_0x247115[_0x7d4b('0x22')],_0x38b9ed;if(_0x3aa1e4>=_0x5ca5f1){_0x3aa1e4=_0x5ca5f1;_0x38b9ed=0xc8;}else{_0x38b9ed=0xce;}_0x42e137[_0x7d4b('0x1d')](_0x38b9ed);return _0x42e137[_0x7d4b('0x23')](_0x7d4b('0x24'),_0x4ac837+'-'+_0x3aa1e4+'/'+_0x5ca5f1)['json'](_0x5d339e);}return null;};}function patchUpdates(_0x4e36c9){return function(_0x284a0e){try{jsonpatch[_0x7d4b('0x25')](_0x284a0e,_0x4e36c9,!![]);}catch(_0x360aa0){return BPromise[_0x7d4b('0x26')](_0x360aa0);}return _0x284a0e['save']();};}function saveUpdates(_0x180b1c,_0x2c5e33){return function(_0x53fcf1){if(_0x53fcf1){return _0x53fcf1[_0x7d4b('0x27')](_0x180b1c)[_0x7d4b('0x28')](function(_0x43cd4f){return _0x43cd4f;});}return null;};}function removeEntity(_0x270b82,_0x35a6a0){return function(_0x2875f8){if(_0x2875f8){return _0x2875f8[_0x7d4b('0x29')]()[_0x7d4b('0x28')](function(){var _0x17b600=_0x2875f8[_0x7d4b('0x2a')]({'plain':!![]});var _0x78c13c='Lists';return db[_0x7d4b('0x2b')][_0x7d4b('0x29')]({'where':{'type':_0x78c13c,'resourceId':_0x17b600['id']}})['then'](function(){return _0x2875f8;});})[_0x7d4b('0x28')](function(){_0x270b82['status'](0xcc)[_0x7d4b('0x1e')]();});}};}function handleEntityNotFound(_0x2c6dcb,_0x3c5e16){return function(_0x196faf){if(!_0x196faf){_0x2c6dcb[_0x7d4b('0x1c')](0x194);}return _0x196faf;};}function handleError(_0x380cfc,_0x38450b){_0x38450b=_0x38450b||0x1f4;return function(_0x345efa){logger[_0x7d4b('0x2c')](_0x345efa[_0x7d4b('0x2d')]);if(_0x345efa[_0x7d4b('0x2e')]){delete _0x345efa[_0x7d4b('0x2e')];}_0x380cfc[_0x7d4b('0x1d')](_0x38450b)[_0x7d4b('0x2f')](_0x345efa);};}exports[_0x7d4b('0x30')]=function(_0x4c2653,_0x377538){var _0x3dba4a={},_0x15ac64={},_0x4495c6={'count':0x0,'rows':[]};var _0x409e=_[_0x7d4b('0x31')](db[_0x7d4b('0x32')][_0x7d4b('0x33')],function(_0x52e8cd){return{'name':_0x52e8cd['fieldName'],'type':_0x52e8cd[_0x7d4b('0x34')][_0x7d4b('0x35')]};});_0x15ac64[_0x7d4b('0x36')]=_[_0x7d4b('0x31')](_0x409e,_0x7d4b('0x2e'));_0x15ac64[_0x7d4b('0x37')]=_[_0x7d4b('0x38')](_0x4c2653[_0x7d4b('0x37')]);_0x15ac64['filters']=_[_0x7d4b('0x39')](_0x15ac64[_0x7d4b('0x36')],_0x15ac64[_0x7d4b('0x37')]);_0x3dba4a['attributes']=_[_0x7d4b('0x39')](_0x15ac64['model'],qs['fields'](_0x4c2653[_0x7d4b('0x37')][_0x7d4b('0x3a')]));_0x3dba4a[_0x7d4b('0x3b')]=_0x3dba4a[_0x7d4b('0x3b')][_0x7d4b('0x3c')]?_0x3dba4a[_0x7d4b('0x3b')]:_0x15ac64[_0x7d4b('0x36')];if(!_0x4c2653[_0x7d4b('0x37')][_0x7d4b('0x3d')]('nolimit')){_0x3dba4a[_0x7d4b('0x22')]=qs[_0x7d4b('0x22')](_0x4c2653['query']['limit']);_0x3dba4a[_0x7d4b('0x21')]=qs[_0x7d4b('0x21')](_0x4c2653[_0x7d4b('0x37')][_0x7d4b('0x21')]);}_0x3dba4a[_0x7d4b('0x3e')]=qs[_0x7d4b('0x3f')](_0x4c2653[_0x7d4b('0x37')]['sort']);_0x3dba4a[_0x7d4b('0x40')]=qs[_0x7d4b('0x41')](_[_0x7d4b('0x42')](_0x4c2653[_0x7d4b('0x37')],_0x15ac64[_0x7d4b('0x41')]),_0x409e);if(_0x4c2653['query'][_0x7d4b('0x43')]){_0x3dba4a[_0x7d4b('0x40')]=_[_0x7d4b('0x44')](_0x3dba4a[_0x7d4b('0x40')],{'$or':_[_0x7d4b('0x31')](_0x409e,function(_0x8a3fb5){if(_0x8a3fb5[_0x7d4b('0x34')]!==_0x7d4b('0x45')){var _0x3cd04a={};_0x3cd04a[_0x8a3fb5['name']]={'$like':'%'+_0x4c2653['query'][_0x7d4b('0x43')]+'%'};return _0x3cd04a;}})});}_0x3dba4a=_[_0x7d4b('0x44')]({},_0x3dba4a,_0x4c2653['options']);var _0x568d8f={'where':_0x3dba4a[_0x7d4b('0x40')]};return db[_0x7d4b('0x32')][_0x7d4b('0x20')](_0x568d8f)[_0x7d4b('0x28')](function(_0x3cae99){_0x4495c6['count']=_0x3cae99;if(_0x4c2653['query']['includeAll']){_0x3dba4a[_0x7d4b('0x46')]=[{'all':!![]}];}return db['CmList'][_0x7d4b('0x47')](_0x3dba4a);})[_0x7d4b('0x28')](function(_0x49552b){_0x4495c6[_0x7d4b('0x48')]=_0x49552b;return _0x4495c6;})['then'](respondWithFilteredResult(_0x377538,_0x3dba4a))[_0x7d4b('0x49')](handleError(_0x377538,null));};exports[_0x7d4b('0x4a')]=function(_0x151f74,_0x5eb1ab){var _0x73079d={'raw':![],'where':{'id':_0x151f74['params']['id']}},_0x5db5d4={};_0x5db5d4[_0x7d4b('0x36')]=_[_0x7d4b('0x38')](db['CmList'][_0x7d4b('0x33')]);_0x5db5d4[_0x7d4b('0x37')]=_[_0x7d4b('0x38')](_0x151f74[_0x7d4b('0x37')]);_0x5db5d4[_0x7d4b('0x41')]=_['intersection'](_0x5db5d4[_0x7d4b('0x36')],_0x5db5d4[_0x7d4b('0x37')]);_0x73079d[_0x7d4b('0x3b')]=_[_0x7d4b('0x39')](_0x5db5d4[_0x7d4b('0x36')],qs[_0x7d4b('0x3a')](_0x151f74[_0x7d4b('0x37')]['fields']));_0x73079d[_0x7d4b('0x3b')]=_0x73079d['attributes'][_0x7d4b('0x3c')]?_0x73079d[_0x7d4b('0x3b')]:_0x5db5d4['model'];if(_0x151f74[_0x7d4b('0x37')]['includeAll']){_0x73079d[_0x7d4b('0x46')]=[{'all':!![]}];}_0x73079d=_['merge']({},_0x73079d,_0x151f74['options']);return db['CmList'][_0x7d4b('0x4b')](_0x73079d)['then'](handleEntityNotFound(_0x5eb1ab,null))[_0x7d4b('0x28')](respondWithResult(_0x5eb1ab,null))['catch'](handleError(_0x5eb1ab,null));};exports[_0x7d4b('0x4c')]=function(_0x14d163,_0x17bca2){return db['CmList']['create'](_0x14d163['body'],{})[_0x7d4b('0x28')](function(_0x1be3ce){var _0x5d1262=_0x14d163[_0x7d4b('0x4d')][_0x7d4b('0x2a')]({'plain':!![]});if(!_0x5d1262)throw new Error(_0x7d4b('0x4e'));if(_0x5d1262[_0x7d4b('0x4f')]==='user'){var _0x5ae474=_0x1be3ce[_0x7d4b('0x2a')]({'plain':!![]});var _0x3e20c7=_0x7d4b('0x50');return db[_0x7d4b('0x51')][_0x7d4b('0x4b')]({'where':{'name':_0x3e20c7,'userProfileId':_0x5d1262[_0x7d4b('0x52')]},'raw':!![]})['then'](function(_0x52e22c){if(_0x52e22c&&_0x52e22c[_0x7d4b('0x53')]===0x0){return db[_0x7d4b('0x2b')]['create']({'name':_0x5ae474[_0x7d4b('0x2e')],'resourceId':_0x5ae474['id'],'type':_0x52e22c['name'],'sectionId':_0x52e22c['id']},{})[_0x7d4b('0x28')](function(){return _0x1be3ce;});}else{return _0x1be3ce;}})[_0x7d4b('0x49')](function(_0x51de50){logger['error'](_0x7d4b('0x54'),_0x51de50);throw _0x51de50;});}return _0x1be3ce;})[_0x7d4b('0x28')](respondWithResult(_0x17bca2,0xc9))['catch'](handleError(_0x17bca2,null));};exports['update']=function(_0x19316e,_0x276557){if(_0x19316e[_0x7d4b('0x55')]['id']){delete _0x19316e[_0x7d4b('0x55')]['id'];}return db[_0x7d4b('0x32')][_0x7d4b('0x4b')]({'where':{'id':_0x19316e[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x276557,null))[_0x7d4b('0x28')](saveUpdates(_0x19316e[_0x7d4b('0x55')],null))[_0x7d4b('0x28')](respondWithResult(_0x276557,null))[_0x7d4b('0x49')](handleError(_0x276557,null));};exports[_0x7d4b('0x29')]=function(_0x4829ef,_0x108b06){return db[_0x7d4b('0x32')][_0x7d4b('0x4b')]({'where':{'id':_0x4829ef['params']['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x108b06,null))[_0x7d4b('0x28')](removeEntity(_0x108b06,null))['catch'](handleError(_0x108b06,null));};exports[_0x7d4b('0x57')]=function(_0x1768de,_0x531d65){return db[_0x7d4b('0x32')][_0x7d4b('0x57')]()[_0x7d4b('0x28')](respondWithResult(_0x531d65,null))[_0x7d4b('0x49')](handleError(_0x531d65,null));};exports[_0x7d4b('0x58')]=function(_0x20260c,_0x3a32b1,_0x5c1c8d){if(_0x20260c['body']['id']){delete _0x20260c[_0x7d4b('0x55')]['id'];}return db[_0x7d4b('0x32')][_0x7d4b('0x4b')]({'where':{'id':_0x20260c[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x3a32b1,null))['then'](function(_0x495aae){if(_0x495aae){_0x20260c[_0x7d4b('0x55')][_0x7d4b('0x59')]=_0x495aae['id'];return db[_0x7d4b('0x5a')]['create'](_0x20260c[_0x7d4b('0x55')]);}})[_0x7d4b('0x28')](respondWithResult(_0x3a32b1,null))[_0x7d4b('0x49')](handleError(_0x3a32b1,null));};exports[_0x7d4b('0x5b')]=function(_0x53d626,_0x579fa2,_0x51242c){var _0x47d166={'raw':![],'where':{}};var _0xe56605={};var _0xe24e87={'count':0x0,'rows':[]};return db[_0x7d4b('0x32')][_0x7d4b('0x5c')]({'where':{'id':_0x53d626[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x579fa2,null))['then'](function(_0xf467b0){if(_0xf467b0){_0xe56605[_0x7d4b('0x36')]=_[_0x7d4b('0x38')](db[_0x7d4b('0x5a')][_0x7d4b('0x33')]);_0xe56605['query']=_['keys'](_0x53d626[_0x7d4b('0x37')]);_0xe56605['filters']=_[_0x7d4b('0x39')](_0xe56605[_0x7d4b('0x36')],_0xe56605[_0x7d4b('0x37')]);_0x47d166[_0x7d4b('0x3b')]=_['intersection'](_0xe56605[_0x7d4b('0x36')],qs['fields'](_0x53d626[_0x7d4b('0x37')][_0x7d4b('0x3a')]));_0x47d166[_0x7d4b('0x3b')]=_0x47d166[_0x7d4b('0x3b')][_0x7d4b('0x3c')]?_0x47d166[_0x7d4b('0x3b')]:_0xe56605[_0x7d4b('0x36')];if(!_0x53d626[_0x7d4b('0x37')][_0x7d4b('0x3d')](_0x7d4b('0x5d'))){_0x47d166['limit']=qs['limit'](_0x53d626[_0x7d4b('0x37')][_0x7d4b('0x22')]);_0x47d166[_0x7d4b('0x21')]=qs[_0x7d4b('0x21')](_0x53d626['query']['offset']);}_0x47d166[_0x7d4b('0x3e')]=qs[_0x7d4b('0x3f')](_0x53d626['query'][_0x7d4b('0x3f')]);_0x47d166[_0x7d4b('0x40')]=qs[_0x7d4b('0x41')](_['pick'](_0x53d626[_0x7d4b('0x37')],_0xe56605[_0x7d4b('0x41')]));_0x47d166[_0x7d4b('0x40')][_0x7d4b('0x59')]=_0xf467b0['id'];if(_0x53d626['query']['filter']){_0x47d166['where']=_[_0x7d4b('0x44')](_0x47d166[_0x7d4b('0x40')],{'$or':_[_0x7d4b('0x31')](_0x47d166['attributes'],function(_0x516936){var _0x4054df={};_0x4054df[_0x516936]={'$like':'%'+_0x53d626[_0x7d4b('0x37')][_0x7d4b('0x43')]+'%'};return _0x4054df;})});}_0x47d166=_['merge']({},_0x47d166,_0x53d626[_0x7d4b('0x5e')]);return db[_0x7d4b('0x5a')][_0x7d4b('0x20')]({'where':_0x47d166[_0x7d4b('0x40')]})[_0x7d4b('0x28')](function(_0x4f615e){_0xe24e87['count']=_0x4f615e;if(_0x53d626[_0x7d4b('0x37')][_0x7d4b('0x5f')]){_0x47d166[_0x7d4b('0x46')]=[{'all':!![]}];}return db[_0x7d4b('0x5a')][_0x7d4b('0x47')](_0x47d166);})[_0x7d4b('0x28')](function(_0xeed33f){_0xe24e87['rows']=_0xeed33f;return _0xe24e87;});}})[_0x7d4b('0x28')](respondWithFilteredResult(_0x579fa2,_0x47d166))[_0x7d4b('0x49')](handleError(_0x579fa2,null));};exports['removeDispositions']=function(_0x51c94a,_0x1d12bd,_0x4557d4){return db[_0x7d4b('0x32')][_0x7d4b('0x4b')]({'where':{'id':_0x51c94a['params']['id']}})['then'](handleEntityNotFound(_0x1d12bd,null))['then'](function(_0x78e64c){if(_0x78e64c){return _0x78e64c[_0x7d4b('0x60')](_0x51c94a[_0x7d4b('0x37')][_0x7d4b('0x61')]);}})[_0x7d4b('0x28')](respondWithStatusCode(_0x1d12bd,null))['catch'](handleError(_0x1d12bd,null));};exports[_0x7d4b('0x62')]=function(_0x2b7902,_0x3618c7,_0x4befc4){return db[_0x7d4b('0x32')]['find']({'where':{'id':_0x2b7902[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x3618c7,null))[_0x7d4b('0x28')](function(_0x4e24e7){if(_0x4e24e7){var _0x2891ed=[];var _0xd20b99={'success':[],'errors':[]};return db[_0x7d4b('0x63')][_0x7d4b('0x57')]()[_0x7d4b('0x28')](function(_0x46937e){if(_0x2b7902[_0x7d4b('0x55')]['tags']&&_['isArray'](_0x2b7902[_0x7d4b('0x55')][_0x7d4b('0x64')])){if(_0x2b7902[_0x7d4b('0x55')][_0x7d4b('0x64')][_0x7d4b('0x3c')]){_0x2b7902[_0x7d4b('0x55')][_0x7d4b('0x64')]=_0x2b7902['body'][_0x7d4b('0x64')][_0x7d4b('0x65')](';')+';';}else{_0x2b7902[_0x7d4b('0x55')][_0x7d4b('0x64')]=null;}}else{_0x2b7902[_0x7d4b('0x55')][_0x7d4b('0x64')]=null;}if(_0x2b7902['body']&&_[_0x7d4b('0x66')](_0x2b7902[_0x7d4b('0x55')])){for(var _0x200c8d=0x0;_0x200c8d<_0x2b7902[_0x7d4b('0x55')]['length'];_0x200c8d+=0x1){_0x2b7902[_0x7d4b('0x55')][_0x200c8d][_0x7d4b('0x59')]=_0x2b7902[_0x7d4b('0x56')]['id'];_0x2891ed[_0x7d4b('0x67')](_0x2b7902[_0x7d4b('0x55')][_0x200c8d]);}return BPromise[_0x7d4b('0x68')](_0x2891ed,function(_0x2dba72){return db[_0x7d4b('0x63')][_0x7d4b('0x4c')](_[_0x7d4b('0x69')](_0x2dba72,['ids','id'])||{},{'fields':_['keys'](_0x46937e),'raw':!![]})[_0x7d4b('0x28')](function(_0x148fd3){_0xd20b99[_0x7d4b('0x6a')][_0x7d4b('0x67')](_0x148fd3[_0x7d4b('0x6b')]);})[_0x7d4b('0x49')](function(_0x396fbb){_0xd20b99[_0x7d4b('0x6c')][_0x7d4b('0x67')]({'data':_0x2dba72,'error':_0x396fbb[_0x7d4b('0x6d')]});});})['then'](function(_0x361a89){return _0xd20b99;})['catch'](function(_0x429650){return _0x429650;});}else{_0x3618c7['status'](0x190)[_0x7d4b('0x1f')]({'message':_0x7d4b('0x6e')});}});}})[_0x7d4b('0x28')](respondWithResult(_0x3618c7,null))[_0x7d4b('0x49')](handleError(_0x3618c7,null));};exports[_0x7d4b('0x6f')]=function(_0x46e2ff,_0x4ebc04,_0x59cf01){var _0x825638;return db['CmList']['find']({'where':{'id':_0x46e2ff['params']['id']},'include':[{'model':db[_0x7d4b('0x70')],'as':_0x7d4b('0x71')}]})[_0x7d4b('0x28')](handleEntityNotFound(_0x4ebc04,null))[_0x7d4b('0x28')](function(_0x41a7be){if(_0x41a7be){_0x825638=_0x41a7be;return db['CmContact'][_0x7d4b('0x33')];}})['then'](function(_0x1c8e25){if(_0x1c8e25){var _0x142ddd={};var _0x45c9e0={};_0x45c9e0[_0x7d4b('0x36')]=_[_0x7d4b('0x72')](_[_0x7d4b('0x38')](_0x1c8e25),_[_0x7d4b('0x31')](_0x825638[_0x7d4b('0x71')],function(_0xbd585b){return util['format']('cf_%d',_0xbd585b['id']);}));_0x45c9e0['query']=_['keys'](_0x46e2ff[_0x7d4b('0x37')]);_0x45c9e0[_0x7d4b('0x41')]=_[_0x7d4b('0x39')](_0x45c9e0[_0x7d4b('0x36')],_0x45c9e0[_0x7d4b('0x37')]);_0x142ddd[_0x7d4b('0x3b')]=_['intersection'](_0x45c9e0['model'],qs[_0x7d4b('0x3a')](_0x46e2ff[_0x7d4b('0x37')]['fields']));_0x142ddd[_0x7d4b('0x3b')]=_0x142ddd[_0x7d4b('0x3b')][_0x7d4b('0x3c')]?_0x142ddd[_0x7d4b('0x3b')]:_0x45c9e0[_0x7d4b('0x36')];if(!_0x46e2ff[_0x7d4b('0x37')]['hasOwnProperty'](_0x7d4b('0x5d'))){_0x142ddd[_0x7d4b('0x22')]=qs[_0x7d4b('0x22')](_0x46e2ff[_0x7d4b('0x37')][_0x7d4b('0x22')]);_0x142ddd[_0x7d4b('0x21')]=qs[_0x7d4b('0x21')](_0x46e2ff[_0x7d4b('0x37')][_0x7d4b('0x21')]);}_0x142ddd[_0x7d4b('0x3e')]=qs[_0x7d4b('0x3f')](_0x46e2ff[_0x7d4b('0x37')]['sort']);_0x142ddd['where']=qs[_0x7d4b('0x41')](_[_0x7d4b('0x42')](_0x46e2ff[_0x7d4b('0x37')],_0x45c9e0[_0x7d4b('0x41')]));_0x142ddd[_0x7d4b('0x73')]=!![];if(_0x46e2ff[_0x7d4b('0x37')]['filter']){_0x142ddd['where']=_['merge'](_0x142ddd[_0x7d4b('0x40')],{'$or':_[_0x7d4b('0x31')](_0x142ddd[_0x7d4b('0x3b')],function(_0x293287){var _0x39c9c1={};_0x39c9c1[_0x293287]={'$like':'%'+_0x46e2ff[_0x7d4b('0x37')]['filter']+'%'};return _0x39c9c1;})});}_0x142ddd=_[_0x7d4b('0x44')]({},_0x142ddd,_0x46e2ff[_0x7d4b('0x5e')]);return _0x825638['getContacts'](_0x142ddd);}})[_0x7d4b('0x28')](respondWithResult(_0x4ebc04,null))['catch'](handleError(_0x4ebc04,null));};exports[_0x7d4b('0x74')]=function(_0x441b6c,_0x5cb3a3,_0x13bf3d){var _0x265a60;return db[_0x7d4b('0x32')]['find']({'where':{'id':_0x441b6c[_0x7d4b('0x56')]['id']},'include':[{'model':db[_0x7d4b('0x70')],'as':'CustomFields'}]})[_0x7d4b('0x28')](handleEntityNotFound(_0x5cb3a3,null))['then'](function(_0x5414e7){if(_0x5414e7){_0x265a60=_0x5414e7;return db['CmContact'][_0x7d4b('0x33')];}})['then'](function(_0x314ceb){if(_0x314ceb){var _0x5dd5dc={};var _0x4c62e7={};_0x4c62e7[_0x7d4b('0x36')]=_[_0x7d4b('0x72')](_[_0x7d4b('0x38')](_0x314ceb),_[_0x7d4b('0x31')](_0x265a60['CustomFields'],function(_0xac5592){return util['format'](_0x7d4b('0x75'),_0xac5592['id']);}));_0x4c62e7[_0x7d4b('0x37')]=_[_0x7d4b('0x38')](_0x441b6c['query']);_0x4c62e7[_0x7d4b('0x41')]=_[_0x7d4b('0x39')](_0x4c62e7[_0x7d4b('0x36')],_0x4c62e7[_0x7d4b('0x37')]);_0x5dd5dc[_0x7d4b('0x3b')]=_[_0x7d4b('0x39')](_0x4c62e7[_0x7d4b('0x36')],qs['fields'](_0x441b6c[_0x7d4b('0x37')][_0x7d4b('0x3a')]));_0x5dd5dc[_0x7d4b('0x3b')]=_0x5dd5dc[_0x7d4b('0x3b')][_0x7d4b('0x3c')]?_0x5dd5dc[_0x7d4b('0x3b')]:_0x4c62e7['model'];if(!_0x441b6c[_0x7d4b('0x37')][_0x7d4b('0x3d')](_0x7d4b('0x5d'))){_0x5dd5dc['limit']=qs[_0x7d4b('0x22')](_0x441b6c[_0x7d4b('0x37')][_0x7d4b('0x22')]);_0x5dd5dc[_0x7d4b('0x21')]=qs[_0x7d4b('0x21')](_0x441b6c[_0x7d4b('0x37')][_0x7d4b('0x21')]);}_0x5dd5dc[_0x7d4b('0x3e')]=qs[_0x7d4b('0x3f')](_0x441b6c[_0x7d4b('0x37')][_0x7d4b('0x3f')]);_0x5dd5dc['where']=qs[_0x7d4b('0x41')](_[_0x7d4b('0x42')](_0x441b6c[_0x7d4b('0x37')],_0x4c62e7['filters']));_0x5dd5dc['raw']=!![];if(_0x441b6c[_0x7d4b('0x37')][_0x7d4b('0x43')]){_0x5dd5dc[_0x7d4b('0x40')]=_[_0x7d4b('0x44')](_0x5dd5dc[_0x7d4b('0x40')],{'$or':_[_0x7d4b('0x31')](_0x5dd5dc[_0x7d4b('0x3b')],function(_0x21f31c){var _0x5abb37={};_0x5abb37[_0x21f31c]={'$like':'%'+_0x441b6c[_0x7d4b('0x37')][_0x7d4b('0x43')]+'%'};return _0x5abb37;})});}_0x5dd5dc=_[_0x7d4b('0x44')]({},_0x5dd5dc,_0x441b6c['options']);return _0x265a60['getContacts'](_0x5dd5dc);}})['then'](function(_0x466391){if(!_[_0x7d4b('0x76')](_0x466391)){var _0x139dd1=toCsv(_0x466391);var _0x280cdb=Date[_0x7d4b('0x77')]();fs[_0x7d4b('0x78')](util[_0x7d4b('0x79')](_0x7d4b('0x7a'),_0x265a60['id'],_0x280cdb),_0x139dd1);_0x5cb3a3[_0x7d4b('0x7b')](_0x7d4b('0x7c'),_0x7d4b('0x7d')+util[_0x7d4b('0x79')]('list_%d_%s.csv',_0x265a60['id'],_0x280cdb));_0x5cb3a3['setHeader'](_0x7d4b('0x7e'),_0x7d4b('0x7f'));return _0x5cb3a3[_0x7d4b('0x80')](util[_0x7d4b('0x79')]('/tmp/list_%d_%s.csv',_0x265a60['id'],_0x280cdb));}else{return _0x5cb3a3['sendStatus'](0xcc);}})[_0x7d4b('0x49')](handleError(_0x5cb3a3,null));};exports[_0x7d4b('0x81')]=function(_0x3d4f69,_0x115254,_0x1bbfd6){var _0xc35d76;delete _0x3d4f69['body']['id'];return db[_0x7d4b('0x32')][_0x7d4b('0x5c')]({'where':{'id':_0x3d4f69[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x115254,null))['then'](function(_0x42f6bb){if(_0x42f6bb){return db[_0x7d4b('0x82')][_0x7d4b('0x83')](function(_0x243c8f){return db[_0x7d4b('0x70')][_0x7d4b('0x4c')](_0x3d4f69[_0x7d4b('0x55')],{'transaction':_0x243c8f})[_0x7d4b('0x28')](function(_0x2242bd){_0xc35d76=_0x2242bd;return _0x42f6bb[_0x7d4b('0x84')](_0x2242bd,{'transaction':_0x243c8f});})[_0x7d4b('0x28')](function(){var _0x476033={'type':db[_0x7d4b('0x85')][_0x7d4b('0x86')],'transaction':_0x243c8f};switch(_0x3d4f69[_0x7d4b('0x55')][_0x7d4b('0x34')]){case _0x7d4b('0x87'):_0x476033[_0x7d4b('0x34')]=db[_0x7d4b('0x85')][_0x7d4b('0x86')];break;case _0x7d4b('0x88'):_0x476033[_0x7d4b('0x34')]=db[_0x7d4b('0x85')]['INTEGER'];break;case _0x7d4b('0x89'):_0x476033[_0x7d4b('0x34')]=db[_0x7d4b('0x85')][_0x7d4b('0x8a')];_0x476033[_0x7d4b('0x8b')]=![];break;default:}return db[_0x7d4b('0x82')][_0x7d4b('0x8c')]['addColumn']('cm_contacts',util[_0x7d4b('0x79')](_0x7d4b('0x8d'),_0xc35d76['id']),_0x476033);})[_0x7d4b('0x28')](function(){return _0xc35d76;});});}})[_0x7d4b('0x28')](respondWithResult(_0x115254,null))['catch'](handleError(_0x115254,null));};exports[_0x7d4b('0x8e')]=function(_0x59bdfc,_0x5b8260,_0x992b9c){var _0x2eca3c={};var _0x5816a6={};var _0x212364;var _0x3d4325;return db[_0x7d4b('0x32')][_0x7d4b('0x5c')]({'where':{'id':_0x59bdfc[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x5b8260,null))['then'](function(_0xf87373){if(_0xf87373){_0x212364=_0xf87373;_0x5816a6['model']=_['keys'](db[_0x7d4b('0x70')][_0x7d4b('0x33')]);_0x5816a6[_0x7d4b('0x37')]=_['keys'](_0x59bdfc['query']);_0x5816a6['filters']=_[_0x7d4b('0x39')](_0x5816a6['model'],_0x5816a6[_0x7d4b('0x37')]);_0x2eca3c[_0x7d4b('0x3b')]=_['intersection'](_0x5816a6[_0x7d4b('0x36')],qs[_0x7d4b('0x3a')](_0x59bdfc['query']['fields']));_0x2eca3c[_0x7d4b('0x3b')]=_0x2eca3c[_0x7d4b('0x3b')][_0x7d4b('0x3c')]?_0x2eca3c[_0x7d4b('0x3b')]:_0x5816a6[_0x7d4b('0x36')];_0x2eca3c[_0x7d4b('0x3e')]=qs[_0x7d4b('0x3f')](_0x59bdfc['query'][_0x7d4b('0x3f')]);_0x2eca3c[_0x7d4b('0x40')]=qs[_0x7d4b('0x41')](_['pick'](_0x59bdfc['query'],_0x5816a6[_0x7d4b('0x41')]));_0x2eca3c[_0x7d4b('0x40')]=_['merge'](_0x2eca3c['where'],{'$or':[{'ListId':_0xf87373['id']},{'ListId':null}]});if(_0x59bdfc[_0x7d4b('0x37')][_0x7d4b('0x43')]){_0x2eca3c['where']=_[_0x7d4b('0x44')](_0x2eca3c[_0x7d4b('0x40')],{'$or':_[_0x7d4b('0x31')](_0x2eca3c['attributes'],function(_0x1a9cfd){var _0x40b2f6={};_0x40b2f6[_0x1a9cfd]={'$like':'%'+_0x59bdfc['query'][_0x7d4b('0x43')]+'%'};return _0x40b2f6;})});}_0x2eca3c=_[_0x7d4b('0x44')]({},_0x2eca3c,_0x59bdfc[_0x7d4b('0x5e')]);return db[_0x7d4b('0x70')][_0x7d4b('0x8f')](_0x2eca3c);}})[_0x7d4b('0x28')](respondWithResult(_0x5b8260,null))[_0x7d4b('0x49')](handleError(_0x5b8260,null));};exports[_0x7d4b('0x90')]=function(_0x2f620f,_0x2cc10f,_0x320573){return db[_0x7d4b('0x32')][_0x7d4b('0x4b')]({'where':{'id':_0x2f620f[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x2cc10f,null))[_0x7d4b('0x28')](function(_0x158f84){if(_0x158f84){return _0x158f84[_0x7d4b('0x90')](_0x2f620f['body'][_0x7d4b('0x61')],_[_0x7d4b('0x69')](_0x2f620f['body'],['ids','id'])||{})[_0x7d4b('0x91')](function(_0x54a73c){for(var _0x2c0d24=0x0;_0x2c0d24<_0x2f620f[_0x7d4b('0x55')][_0x7d4b('0x61')]['length'];_0x2c0d24+=0x1){socket[_0x7d4b('0x92')](_0x7d4b('0x93'),{'UserId':_0x2f620f[_0x7d4b('0x55')][_0x7d4b('0x61')][_0x2c0d24],'CmListId':_0x2f620f[_0x7d4b('0x56')]['id']});}return _0x54a73c;});}})['then'](respondWithResult(_0x2cc10f,null))['catch'](handleError(_0x2cc10f,null));};exports[_0x7d4b('0x94')]=function(_0x35b068,_0x1a2bfe,_0x515150){return db[_0x7d4b('0x32')][_0x7d4b('0x4b')]({'where':{'id':_0x35b068[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x1a2bfe,null))[_0x7d4b('0x28')](function(_0x5f05bf){if(_0x5f05bf){return _0x5f05bf['removeAgents'](_0x35b068[_0x7d4b('0x37')][_0x7d4b('0x61')])[_0x7d4b('0x28')](function(){if(_[_0x7d4b('0x66')](_0x35b068['query'][_0x7d4b('0x61')])){for(var _0x2efa66=0x0;_0x2efa66<_0x35b068[_0x7d4b('0x37')][_0x7d4b('0x61')][_0x7d4b('0x3c')];_0x2efa66+=0x1){socket[_0x7d4b('0x92')](_0x7d4b('0x95'),{'UserId':Number(_0x35b068[_0x7d4b('0x37')][_0x7d4b('0x61')][_0x2efa66]),'CmListId':Number(_0x35b068['params']['id'])});}}else{socket['emit'](_0x7d4b('0x95'),{'UserId':Number(_0x35b068['query'][_0x7d4b('0x61')]),'CmListId':Number(_0x35b068[_0x7d4b('0x56')]['id'])});}});}})[_0x7d4b('0x28')](respondWithStatusCode(_0x1a2bfe,null))[_0x7d4b('0x49')](handleError(_0x1a2bfe,null));};exports[_0x7d4b('0x96')]=function(_0x840d9f,_0x21b859,_0x48b391){var _0x5ae687={};var _0x3eb976={};var _0x422983;var _0x387d9f;return db[_0x7d4b('0x32')]['findOne']({'where':{'id':_0x840d9f[_0x7d4b('0x56')]['id']}})[_0x7d4b('0x28')](handleEntityNotFound(_0x21b859,null))['then'](function(_0x51d85d){if(_0x51d85d){_0x422983=_0x51d85d;_0x3eb976[_0x7d4b('0x36')]=_[_0x7d4b('0x38')](db[_0x7d4b('0x97')][_0x7d4b('0x33')]);_0x3eb976[_0x7d4b('0x37')]=_[_0x7d4b('0x38')](_0x840d9f[_0x7d4b('0x37')]);_0x3eb976['filters']=_['intersection'](_0x3eb976[_0x7d4b('0x36')],_0x3eb976[_0x7d4b('0x37')]);_0x5ae687['attributes']=_[_0x7d4b('0x39')](_0x3eb976[_0x7d4b('0x36')],qs[_0x7d4b('0x3a')](_0x840d9f[_0x7d4b('0x37')][_0x7d4b('0x3a')]));_0x5ae687[_0x7d4b('0x3b')]=_0x5ae687[_0x7d4b('0x3b')][_0x7d4b('0x3c')]?_0x5ae687['attributes']:_0x3eb976['model'];_0x5ae687[_0x7d4b('0x3e')]=qs[_0x7d4b('0x3f')](_0x840d9f[_0x7d4b('0x37')][_0x7d4b('0x3f')]);_0x5ae687[_0x7d4b('0x40')]=qs[_0x7d4b('0x41')](_[_0x7d4b('0x42')](_0x840d9f[_0x7d4b('0x37')],_0x3eb976['filters']));if(_0x840d9f[_0x7d4b('0x37')][_0x7d4b('0x43')]){_0x5ae687[_0x7d4b('0x40')]=_[_0x7d4b('0x44')](_0x5ae687[_0x7d4b('0x40')],{'$or':_['map'](_0x5ae687[_0x7d4b('0x3b')],function(_0x453c85){var _0x41aec3={};_0x41aec3[_0x453c85]={'$like':'%'+_0x840d9f['query']['filter']+'%'};return _0x41aec3;})});}_0x5ae687=_['merge']({},_0x5ae687,_0x840d9f[_0x7d4b('0x5e')]);return _0x422983[_0x7d4b('0x96')](_0x5ae687);}})['then'](function(_0x2dcb69){if(_0x2dcb69){_0x387d9f=_0x2dcb69['length'];if(!_0x840d9f['query'][_0x7d4b('0x3d')]('nolimit')){_0x5ae687[_0x7d4b('0x22')]=qs[_0x7d4b('0x22')](_0x840d9f[_0x7d4b('0x37')][_0x7d4b('0x22')]);_0x5ae687[_0x7d4b('0x21')]=qs[_0x7d4b('0x21')](_0x840d9f[_0x7d4b('0x37')][_0x7d4b('0x21')]);}return _0x422983['getAgents'](_0x5ae687);}})[_0x7d4b('0x28')](function(_0x19fcbd){if(_0x19fcbd){return _0x19fcbd?{'count':_0x387d9f,'rows':_0x19fcbd}:null;}})[_0x7d4b('0x28')](respondWithResult(_0x21b859,null))[_0x7d4b('0x49')](handleError(_0x21b859,null));}; \ No newline at end of file +var _0x68bb=['merge','options','count','includeAll','show','params','intersection','find','catch','create','user','role','get','autoAssociation','UserProfileResource','body','describe','addDisposition','ListId','findOne','Disposition','nolimit','include','findAll','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','success','errors','message','getContacts','CustomFields','cf_%d','order','raw','getContactsCsv','CmCustomField','concat','format','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','Lists','error','stack','name','map','CmList','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','sort','pick','filter','where'];(function(_0x60d0a8,_0x8b516f){var _0x4e381c=function(_0x250bf8){while(--_0x250bf8){_0x60d0a8['push'](_0x60d0a8['shift']());}};_0x4e381c(++_0x8b516f);}(_0x68bb,0x1ea));var _0xb68b=function(_0x2df015,_0x4616d2){_0x2df015=_0x2df015-0x0;var _0x57a798=_0x68bb[_0x2df015];return _0x57a798;};'use strict';var pdf=require(_0xb68b('0x0'));var emlformat=require(_0xb68b('0x1'));var rimraf=require(_0xb68b('0x2'));var zipdir=require(_0xb68b('0x3'));var jsonpatch=require(_0xb68b('0x4'));var rp=require('request-promise');var moment=require(_0xb68b('0x5'));var BPromise=require(_0xb68b('0x6'));var Mustache=require(_0xb68b('0x7'));var util=require('util');var path=require('path');var sox=require(_0xb68b('0x8'));var csv=require(_0xb68b('0x9'));var ejs=require(_0xb68b('0xa'));var fs=require('fs');var _=require(_0xb68b('0xb'));var squel=require(_0xb68b('0xc'));var crypto=require(_0xb68b('0xd'));var jsforce=require(_0xb68b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb68b('0x9'));var querystring=require(_0xb68b('0xf'));var Papa=require(_0xb68b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb68b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb68b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xb68b('0x13'));var config=require(_0xb68b('0x14'));var db=require(_0xb68b('0x15'))['db'];config[_0xb68b('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb68b('0x17'))(new Redis(config[_0xb68b('0x16')]));require(_0xb68b('0x18'))[_0xb68b('0x19')](socket);function respondWithStatusCode(_0x21de38,_0x2de933){_0x2de933=_0x2de933||0xcc;return function(_0xba06c8){if(_0xba06c8){return _0x21de38[_0xb68b('0x1a')](_0x2de933);}return _0x21de38[_0xb68b('0x1b')](_0x2de933)[_0xb68b('0x1c')]();};}function respondWithResult(_0x41eac9,_0x36e863){_0x36e863=_0x36e863||0xc8;return function(_0x227726){if(_0x227726){return _0x41eac9[_0xb68b('0x1b')](_0x36e863)[_0xb68b('0x1d')](_0x227726);}};}function respondWithFilteredResult(_0x29ef6e,_0x307fb2){return function(_0x335624){if(_0x335624){var _0x40ad77=_0x335624['count'],_0x29ce07=_0x307fb2['offset'],_0x94d552=_0x307fb2[_0xb68b('0x1e')]+_0x307fb2['limit'],_0x3ae50e;if(_0x94d552>=_0x40ad77){_0x94d552=_0x40ad77;_0x3ae50e=0xc8;}else{_0x3ae50e=0xce;}_0x29ef6e[_0xb68b('0x1b')](_0x3ae50e);return _0x29ef6e[_0xb68b('0x1f')](_0xb68b('0x20'),_0x29ce07+'-'+_0x94d552+'/'+_0x40ad77)['json'](_0x335624);}return null;};}function patchUpdates(_0x2eeab9){return function(_0x5503f4){try{jsonpatch[_0xb68b('0x21')](_0x5503f4,_0x2eeab9,!![]);}catch(_0xd8a1bb){return BPromise[_0xb68b('0x22')](_0xd8a1bb);}return _0x5503f4[_0xb68b('0x23')]();};}function saveUpdates(_0x5365f3,_0x4623e7){return function(_0x5824c4){if(_0x5824c4){return _0x5824c4[_0xb68b('0x24')](_0x5365f3)[_0xb68b('0x25')](function(_0xb1a7d0){return _0xb1a7d0;});}return null;};}function removeEntity(_0x106386,_0xf8a98f){return function(_0x4bd457){if(_0x4bd457){return _0x4bd457[_0xb68b('0x26')]()[_0xb68b('0x25')](function(){var _0x451d5e=_0x4bd457['get']({'plain':!![]});var _0x103220=_0xb68b('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x103220,'resourceId':_0x451d5e['id']}})[_0xb68b('0x25')](function(){return _0x4bd457;});})[_0xb68b('0x25')](function(){_0x106386[_0xb68b('0x1b')](0xcc)[_0xb68b('0x1c')]();});}};}function handleEntityNotFound(_0x425c5c,_0x1e1f7d){return function(_0x25119b){if(!_0x25119b){_0x425c5c[_0xb68b('0x1a')](0x194);}return _0x25119b;};}function handleError(_0x4384ba,_0x4c5b3e){_0x4c5b3e=_0x4c5b3e||0x1f4;return function(_0x186081){logger[_0xb68b('0x28')](_0x186081[_0xb68b('0x29')]);if(_0x186081[_0xb68b('0x2a')]){delete _0x186081['name'];}_0x4384ba[_0xb68b('0x1b')](_0x4c5b3e)['send'](_0x186081);};}exports['index']=function(_0xdc0bd8,_0x16c04b){var _0x18981b={},_0x195827={},_0x3ce797={'count':0x0,'rows':[]};var _0x30f987=_[_0xb68b('0x2b')](db[_0xb68b('0x2c')][_0xb68b('0x2d')],function(_0x3df4ec){return{'name':_0x3df4ec[_0xb68b('0x2e')],'type':_0x3df4ec[_0xb68b('0x2f')][_0xb68b('0x30')]};});_0x195827[_0xb68b('0x31')]=_[_0xb68b('0x2b')](_0x30f987,_0xb68b('0x2a'));_0x195827['query']=_[_0xb68b('0x32')](_0xdc0bd8[_0xb68b('0x33')]);_0x195827[_0xb68b('0x34')]=_['intersection'](_0x195827[_0xb68b('0x31')],_0x195827[_0xb68b('0x33')]);_0x18981b[_0xb68b('0x35')]=_['intersection'](_0x195827['model'],qs[_0xb68b('0x36')](_0xdc0bd8[_0xb68b('0x33')][_0xb68b('0x36')]));_0x18981b['attributes']=_0x18981b[_0xb68b('0x35')][_0xb68b('0x37')]?_0x18981b[_0xb68b('0x35')]:_0x195827[_0xb68b('0x31')];if(!_0xdc0bd8[_0xb68b('0x33')][_0xb68b('0x38')]('nolimit')){_0x18981b[_0xb68b('0x39')]=qs[_0xb68b('0x39')](_0xdc0bd8[_0xb68b('0x33')][_0xb68b('0x39')]);_0x18981b[_0xb68b('0x1e')]=qs[_0xb68b('0x1e')](_0xdc0bd8['query'][_0xb68b('0x1e')]);}_0x18981b['order']=qs[_0xb68b('0x3a')](_0xdc0bd8[_0xb68b('0x33')]['sort']);_0x18981b['where']=qs[_0xb68b('0x34')](_[_0xb68b('0x3b')](_0xdc0bd8['query'],_0x195827[_0xb68b('0x34')]),_0x30f987);if(_0xdc0bd8['query'][_0xb68b('0x3c')]){_0x18981b[_0xb68b('0x3d')]=_[_0xb68b('0x3e')](_0x18981b['where'],{'$or':_['map'](_0x30f987,function(_0x81392f){if(_0x81392f[_0xb68b('0x2f')]!=='VIRTUAL'){var _0x30a7ad={};_0x30a7ad[_0x81392f[_0xb68b('0x2a')]]={'$like':'%'+_0xdc0bd8['query'][_0xb68b('0x3c')]+'%'};return _0x30a7ad;}})});}_0x18981b=_[_0xb68b('0x3e')]({},_0x18981b,_0xdc0bd8[_0xb68b('0x3f')]);var _0x4c0463={'where':_0x18981b['where']};return db[_0xb68b('0x2c')][_0xb68b('0x40')](_0x4c0463)[_0xb68b('0x25')](function(_0x303e12){_0x3ce797[_0xb68b('0x40')]=_0x303e12;if(_0xdc0bd8[_0xb68b('0x33')][_0xb68b('0x41')]){_0x18981b['include']=[{'all':!![]}];}return db[_0xb68b('0x2c')]['findAll'](_0x18981b);})['then'](function(_0x288627){_0x3ce797['rows']=_0x288627;return _0x3ce797;})[_0xb68b('0x25')](respondWithFilteredResult(_0x16c04b,_0x18981b))['catch'](handleError(_0x16c04b,null));};exports[_0xb68b('0x42')]=function(_0x4306d7,_0x5e3752){var _0x20c387={'raw':![],'where':{'id':_0x4306d7[_0xb68b('0x43')]['id']}},_0x4c420a={};_0x4c420a[_0xb68b('0x31')]=_['keys'](db['CmList']['rawAttributes']);_0x4c420a[_0xb68b('0x33')]=_['keys'](_0x4306d7[_0xb68b('0x33')]);_0x4c420a['filters']=_[_0xb68b('0x44')](_0x4c420a[_0xb68b('0x31')],_0x4c420a['query']);_0x20c387[_0xb68b('0x35')]=_['intersection'](_0x4c420a[_0xb68b('0x31')],qs['fields'](_0x4306d7[_0xb68b('0x33')][_0xb68b('0x36')]));_0x20c387[_0xb68b('0x35')]=_0x20c387[_0xb68b('0x35')]['length']?_0x20c387['attributes']:_0x4c420a[_0xb68b('0x31')];if(_0x4306d7[_0xb68b('0x33')][_0xb68b('0x41')]){_0x20c387['include']=[{'all':!![]}];}_0x20c387=_[_0xb68b('0x3e')]({},_0x20c387,_0x4306d7['options']);return db['CmList'][_0xb68b('0x45')](_0x20c387)[_0xb68b('0x25')](handleEntityNotFound(_0x5e3752,null))['then'](respondWithResult(_0x5e3752,null))[_0xb68b('0x46')](handleError(_0x5e3752,null));};exports[_0xb68b('0x47')]=function(_0x2034c3,_0x44fa37){return db[_0xb68b('0x2c')]['create'](_0x2034c3['body'],{})[_0xb68b('0x25')](function(_0x54b962){var _0x8572e9=_0x2034c3[_0xb68b('0x48')]['get']({'plain':!![]});if(!_0x8572e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8572e9[_0xb68b('0x49')]===_0xb68b('0x48')){var _0x15d6d3=_0x54b962[_0xb68b('0x4a')]({'plain':!![]});var _0x4ef011=_0xb68b('0x27');return db['UserProfileSection'][_0xb68b('0x45')]({'where':{'name':_0x4ef011,'userProfileId':_0x8572e9['userProfileId']},'raw':!![]})[_0xb68b('0x25')](function(_0x1710c1){if(_0x1710c1&&_0x1710c1[_0xb68b('0x4b')]===0x0){return db[_0xb68b('0x4c')][_0xb68b('0x47')]({'name':_0x15d6d3[_0xb68b('0x2a')],'resourceId':_0x15d6d3['id'],'type':_0x1710c1['name'],'sectionId':_0x1710c1['id']},{})['then'](function(){return _0x54b962;});}else{return _0x54b962;}})[_0xb68b('0x46')](function(_0x12595f){logger[_0xb68b('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12595f);throw _0x12595f;});}return _0x54b962;})['then'](respondWithResult(_0x44fa37,0xc9))[_0xb68b('0x46')](handleError(_0x44fa37,null));};exports[_0xb68b('0x24')]=function(_0x17791b,_0x1d78ed){if(_0x17791b[_0xb68b('0x4d')]['id']){delete _0x17791b[_0xb68b('0x4d')]['id'];}return db[_0xb68b('0x2c')][_0xb68b('0x45')]({'where':{'id':_0x17791b[_0xb68b('0x43')]['id']}})[_0xb68b('0x25')](handleEntityNotFound(_0x1d78ed,null))['then'](saveUpdates(_0x17791b[_0xb68b('0x4d')],null))[_0xb68b('0x25')](respondWithResult(_0x1d78ed,null))[_0xb68b('0x46')](handleError(_0x1d78ed,null));};exports['destroy']=function(_0x1d4f3e,_0x557d51){return db[_0xb68b('0x2c')][_0xb68b('0x45')]({'where':{'id':_0x1d4f3e[_0xb68b('0x43')]['id']}})[_0xb68b('0x25')](handleEntityNotFound(_0x557d51,null))[_0xb68b('0x25')](removeEntity(_0x557d51,null))[_0xb68b('0x46')](handleError(_0x557d51,null));};exports[_0xb68b('0x4e')]=function(_0x48a08e,_0x4e047a){return db['CmList']['describe']()[_0xb68b('0x25')](respondWithResult(_0x4e047a,null))['catch'](handleError(_0x4e047a,null));};exports[_0xb68b('0x4f')]=function(_0x1e4a30,_0x82cf34,_0x478dab){if(_0x1e4a30[_0xb68b('0x4d')]['id']){delete _0x1e4a30['body']['id'];}return db[_0xb68b('0x2c')][_0xb68b('0x45')]({'where':{'id':_0x1e4a30[_0xb68b('0x43')]['id']}})['then'](handleEntityNotFound(_0x82cf34,null))[_0xb68b('0x25')](function(_0x105487){if(_0x105487){_0x1e4a30['body'][_0xb68b('0x50')]=_0x105487['id'];return db['Disposition'][_0xb68b('0x47')](_0x1e4a30[_0xb68b('0x4d')]);}})['then'](respondWithResult(_0x82cf34,null))[_0xb68b('0x46')](handleError(_0x82cf34,null));};exports['getDispositions']=function(_0x23d4d4,_0x4eb278,_0x4174e7){var _0x242e87={'raw':![],'where':{}};var _0x316fd3={};var _0x20b7c0={'count':0x0,'rows':[]};return db[_0xb68b('0x2c')][_0xb68b('0x51')]({'where':{'id':_0x23d4d4[_0xb68b('0x43')]['id']}})[_0xb68b('0x25')](handleEntityNotFound(_0x4eb278,null))[_0xb68b('0x25')](function(_0x4ba169){if(_0x4ba169){_0x316fd3[_0xb68b('0x31')]=_[_0xb68b('0x32')](db[_0xb68b('0x52')]['rawAttributes']);_0x316fd3['query']=_[_0xb68b('0x32')](_0x23d4d4[_0xb68b('0x33')]);_0x316fd3['filters']=_['intersection'](_0x316fd3[_0xb68b('0x31')],_0x316fd3[_0xb68b('0x33')]);_0x242e87['attributes']=_[_0xb68b('0x44')](_0x316fd3['model'],qs[_0xb68b('0x36')](_0x23d4d4[_0xb68b('0x33')]['fields']));_0x242e87['attributes']=_0x242e87['attributes'][_0xb68b('0x37')]?_0x242e87[_0xb68b('0x35')]:_0x316fd3[_0xb68b('0x31')];if(!_0x23d4d4[_0xb68b('0x33')]['hasOwnProperty'](_0xb68b('0x53'))){_0x242e87['limit']=qs['limit'](_0x23d4d4['query'][_0xb68b('0x39')]);_0x242e87[_0xb68b('0x1e')]=qs[_0xb68b('0x1e')](_0x23d4d4['query'][_0xb68b('0x1e')]);}_0x242e87['order']=qs['sort'](_0x23d4d4['query']['sort']);_0x242e87[_0xb68b('0x3d')]=qs['filters'](_[_0xb68b('0x3b')](_0x23d4d4[_0xb68b('0x33')],_0x316fd3[_0xb68b('0x34')]));_0x242e87['where'][_0xb68b('0x50')]=_0x4ba169['id'];if(_0x23d4d4[_0xb68b('0x33')][_0xb68b('0x3c')]){_0x242e87[_0xb68b('0x3d')]=_[_0xb68b('0x3e')](_0x242e87[_0xb68b('0x3d')],{'$or':_['map'](_0x242e87[_0xb68b('0x35')],function(_0x539444){var _0x597420={};_0x597420[_0x539444]={'$like':'%'+_0x23d4d4[_0xb68b('0x33')][_0xb68b('0x3c')]+'%'};return _0x597420;})});}_0x242e87=_[_0xb68b('0x3e')]({},_0x242e87,_0x23d4d4[_0xb68b('0x3f')]);return db[_0xb68b('0x52')][_0xb68b('0x40')]({'where':_0x242e87[_0xb68b('0x3d')]})[_0xb68b('0x25')](function(_0x342b0b){_0x20b7c0[_0xb68b('0x40')]=_0x342b0b;if(_0x23d4d4[_0xb68b('0x33')][_0xb68b('0x41')]){_0x242e87[_0xb68b('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xb68b('0x55')](_0x242e87);})[_0xb68b('0x25')](function(_0x2ee87f){_0x20b7c0['rows']=_0x2ee87f;return _0x20b7c0;});}})['then'](respondWithFilteredResult(_0x4eb278,_0x242e87))[_0xb68b('0x46')](handleError(_0x4eb278,null));};exports[_0xb68b('0x56')]=function(_0x22f26a,_0x7d900f,_0x3c4874){return db[_0xb68b('0x2c')][_0xb68b('0x45')]({'where':{'id':_0x22f26a[_0xb68b('0x43')]['id']}})[_0xb68b('0x25')](handleEntityNotFound(_0x7d900f,null))[_0xb68b('0x25')](function(_0xf92af4){if(_0xf92af4){return _0xf92af4[_0xb68b('0x56')](_0x22f26a[_0xb68b('0x33')][_0xb68b('0x57')]);}})['then'](respondWithStatusCode(_0x7d900f,null))[_0xb68b('0x46')](handleError(_0x7d900f,null));};exports[_0xb68b('0x58')]=function(_0x5d6ccb,_0x2efeb0,_0x1ff8fc){return db[_0xb68b('0x2c')]['find']({'where':{'id':_0x5d6ccb[_0xb68b('0x43')]['id']}})[_0xb68b('0x25')](handleEntityNotFound(_0x2efeb0,null))['then'](function(_0x216602){if(_0x216602){var _0x403a4f=[];var _0x54921a={'success':[],'errors':[]};return db[_0xb68b('0x59')][_0xb68b('0x4e')]()[_0xb68b('0x25')](function(_0x247334){if(_0x5d6ccb[_0xb68b('0x4d')]['tags']&&_[_0xb68b('0x5a')](_0x5d6ccb['body'][_0xb68b('0x5b')])){if(_0x5d6ccb[_0xb68b('0x4d')][_0xb68b('0x5b')][_0xb68b('0x37')]){_0x5d6ccb[_0xb68b('0x4d')][_0xb68b('0x5b')]=_0x5d6ccb[_0xb68b('0x4d')][_0xb68b('0x5b')][_0xb68b('0x5c')](';')+';';}else{_0x5d6ccb[_0xb68b('0x4d')][_0xb68b('0x5b')]=null;}}else{_0x5d6ccb[_0xb68b('0x4d')][_0xb68b('0x5b')]=null;}if(_0x5d6ccb['body']&&_['isArray'](_0x5d6ccb[_0xb68b('0x4d')])){for(var _0x25fb67=0x0;_0x25fb67<_0x5d6ccb[_0xb68b('0x4d')][_0xb68b('0x37')];_0x25fb67+=0x1){_0x5d6ccb['body'][_0x25fb67][_0xb68b('0x50')]=_0x5d6ccb[_0xb68b('0x43')]['id'];_0x403a4f[_0xb68b('0x5d')](_0x5d6ccb[_0xb68b('0x4d')][_0x25fb67]);}return BPromise[_0xb68b('0x5e')](_0x403a4f,function(_0x353923){return db['CmContact'][_0xb68b('0x47')](_['omit'](_0x353923,[_0xb68b('0x57'),'id'])||{},{'fields':_[_0xb68b('0x32')](_0x247334),'raw':!![]})[_0xb68b('0x25')](function(_0x3c5a73){_0x54921a[_0xb68b('0x5f')][_0xb68b('0x5d')](_0x3c5a73['dataValues']);})[_0xb68b('0x46')](function(_0x4e8e58){_0x54921a[_0xb68b('0x60')][_0xb68b('0x5d')]({'data':_0x353923,'error':_0x4e8e58[_0xb68b('0x61')]});});})[_0xb68b('0x25')](function(_0x1579b9){return _0x54921a;})['catch'](function(_0x5f0dcb){return _0x5f0dcb;});}else{_0x2efeb0[_0xb68b('0x1b')](0x190)[_0xb68b('0x1d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xb68b('0x25')](respondWithResult(_0x2efeb0,null))[_0xb68b('0x46')](handleError(_0x2efeb0,null));};exports[_0xb68b('0x62')]=function(_0x2aacd2,_0x5655c2,_0x487584){var _0x5d16ad;return db[_0xb68b('0x2c')][_0xb68b('0x45')]({'where':{'id':_0x2aacd2[_0xb68b('0x43')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xb68b('0x63')}]})[_0xb68b('0x25')](handleEntityNotFound(_0x5655c2,null))[_0xb68b('0x25')](function(_0x5f6c6){if(_0x5f6c6){_0x5d16ad=_0x5f6c6;return db[_0xb68b('0x59')][_0xb68b('0x2d')];}})[_0xb68b('0x25')](function(_0x5aa8b3){if(_0x5aa8b3){var _0x57859f={};var _0x235519={};_0x235519[_0xb68b('0x31')]=_['concat'](_[_0xb68b('0x32')](_0x5aa8b3),_[_0xb68b('0x2b')](_0x5d16ad[_0xb68b('0x63')],function(_0x4136fc){return util['format'](_0xb68b('0x64'),_0x4136fc['id']);}));_0x235519[_0xb68b('0x33')]=_[_0xb68b('0x32')](_0x2aacd2[_0xb68b('0x33')]);_0x235519[_0xb68b('0x34')]=_[_0xb68b('0x44')](_0x235519[_0xb68b('0x31')],_0x235519['query']);_0x57859f[_0xb68b('0x35')]=_[_0xb68b('0x44')](_0x235519[_0xb68b('0x31')],qs[_0xb68b('0x36')](_0x2aacd2['query'][_0xb68b('0x36')]));_0x57859f[_0xb68b('0x35')]=_0x57859f['attributes'][_0xb68b('0x37')]?_0x57859f[_0xb68b('0x35')]:_0x235519[_0xb68b('0x31')];if(!_0x2aacd2[_0xb68b('0x33')][_0xb68b('0x38')](_0xb68b('0x53'))){_0x57859f[_0xb68b('0x39')]=qs[_0xb68b('0x39')](_0x2aacd2[_0xb68b('0x33')][_0xb68b('0x39')]);_0x57859f['offset']=qs['offset'](_0x2aacd2[_0xb68b('0x33')]['offset']);}_0x57859f[_0xb68b('0x65')]=qs[_0xb68b('0x3a')](_0x2aacd2[_0xb68b('0x33')][_0xb68b('0x3a')]);_0x57859f[_0xb68b('0x3d')]=qs['filters'](_['pick'](_0x2aacd2[_0xb68b('0x33')],_0x235519[_0xb68b('0x34')]));_0x57859f[_0xb68b('0x66')]=!![];if(_0x2aacd2['query']['filter']){_0x57859f[_0xb68b('0x3d')]=_[_0xb68b('0x3e')](_0x57859f[_0xb68b('0x3d')],{'$or':_[_0xb68b('0x2b')](_0x57859f[_0xb68b('0x35')],function(_0x1c7642){var _0x539889={};_0x539889[_0x1c7642]={'$like':'%'+_0x2aacd2[_0xb68b('0x33')][_0xb68b('0x3c')]+'%'};return _0x539889;})});}_0x57859f=_[_0xb68b('0x3e')]({},_0x57859f,_0x2aacd2[_0xb68b('0x3f')]);return _0x5d16ad['getContacts'](_0x57859f);}})[_0xb68b('0x25')](respondWithResult(_0x5655c2,null))['catch'](handleError(_0x5655c2,null));};exports[_0xb68b('0x67')]=function(_0x116c29,_0x22ff95,_0x304aa5){var _0x5e727a;return db['CmList']['find']({'where':{'id':_0x116c29['params']['id']},'include':[{'model':db[_0xb68b('0x68')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x22ff95,null))[_0xb68b('0x25')](function(_0x40c7ee){if(_0x40c7ee){_0x5e727a=_0x40c7ee;return db[_0xb68b('0x59')][_0xb68b('0x2d')];}})[_0xb68b('0x25')](function(_0x33357f){if(_0x33357f){var _0x348e78={};var _0x23005b={};_0x23005b['model']=_[_0xb68b('0x69')](_['keys'](_0x33357f),_['map'](_0x5e727a['CustomFields'],function(_0x2b1750){return util[_0xb68b('0x6a')]('cf_%d',_0x2b1750['id']);}));_0x23005b[_0xb68b('0x33')]=_['keys'](_0x116c29[_0xb68b('0x33')]);_0x23005b['filters']=_[_0xb68b('0x44')](_0x23005b['model'],_0x23005b[_0xb68b('0x33')]);_0x348e78[_0xb68b('0x35')]=_[_0xb68b('0x44')](_0x23005b[_0xb68b('0x31')],qs['fields'](_0x116c29[_0xb68b('0x33')][_0xb68b('0x36')]));_0x348e78[_0xb68b('0x35')]=_0x348e78[_0xb68b('0x35')][_0xb68b('0x37')]?_0x348e78[_0xb68b('0x35')]:_0x23005b[_0xb68b('0x31')];if(!_0x116c29[_0xb68b('0x33')]['hasOwnProperty'](_0xb68b('0x53'))){_0x348e78[_0xb68b('0x39')]=qs[_0xb68b('0x39')](_0x116c29['query'][_0xb68b('0x39')]);_0x348e78[_0xb68b('0x1e')]=qs['offset'](_0x116c29[_0xb68b('0x33')]['offset']);}_0x348e78[_0xb68b('0x65')]=qs[_0xb68b('0x3a')](_0x116c29[_0xb68b('0x33')]['sort']);_0x348e78[_0xb68b('0x3d')]=qs[_0xb68b('0x34')](_[_0xb68b('0x3b')](_0x116c29[_0xb68b('0x33')],_0x23005b[_0xb68b('0x34')]));_0x348e78[_0xb68b('0x66')]=!![];if(_0x116c29[_0xb68b('0x33')][_0xb68b('0x3c')]){_0x348e78[_0xb68b('0x3d')]=_[_0xb68b('0x3e')](_0x348e78[_0xb68b('0x3d')],{'$or':_['map'](_0x348e78['attributes'],function(_0x2ff611){var _0x582957={};_0x582957[_0x2ff611]={'$like':'%'+_0x116c29[_0xb68b('0x33')][_0xb68b('0x3c')]+'%'};return _0x582957;})});}_0x348e78=_[_0xb68b('0x3e')]({},_0x348e78,_0x116c29['options']);return _0x5e727a[_0xb68b('0x62')](_0x348e78);}})[_0xb68b('0x25')](function(_0x7142eb){if(!_['isEmpty'](_0x7142eb)){var _0x225519=toCsv(_0x7142eb);var _0x521e6d=Date['now']();fs[_0xb68b('0x6b')](util[_0xb68b('0x6a')](_0xb68b('0x6c'),_0x5e727a['id'],_0x521e6d),_0x225519);_0x22ff95['setHeader'](_0xb68b('0x6d'),'attachment;\x20filename='+util[_0xb68b('0x6a')](_0xb68b('0x6e'),_0x5e727a['id'],_0x521e6d));_0x22ff95[_0xb68b('0x6f')](_0xb68b('0x70'),_0xb68b('0x71'));return _0x22ff95[_0xb68b('0x72')](util[_0xb68b('0x6a')](_0xb68b('0x6c'),_0x5e727a['id'],_0x521e6d));}else{return _0x22ff95[_0xb68b('0x1a')](0xcc);}})[_0xb68b('0x46')](handleError(_0x22ff95,null));};exports[_0xb68b('0x73')]=function(_0x1648fd,_0x431cb5,_0x4ffcdf){var _0x4dfeb2;delete _0x1648fd[_0xb68b('0x4d')]['id'];return db[_0xb68b('0x2c')]['findOne']({'where':{'id':_0x1648fd[_0xb68b('0x43')]['id']}})['then'](handleEntityNotFound(_0x431cb5,null))[_0xb68b('0x25')](function(_0x13c143){if(_0x13c143){return db['sequelize'][_0xb68b('0x74')](function(_0x254961){return db['CmCustomField'][_0xb68b('0x47')](_0x1648fd['body'],{'transaction':_0x254961})[_0xb68b('0x25')](function(_0x307e24){_0x4dfeb2=_0x307e24;return _0x13c143[_0xb68b('0x75')](_0x307e24,{'transaction':_0x254961});})[_0xb68b('0x25')](function(){var _0x117503={'type':db[_0xb68b('0x76')][_0xb68b('0x77')],'transaction':_0x254961};switch(_0x1648fd['body'][_0xb68b('0x2f')]){case _0xb68b('0x78'):_0x117503[_0xb68b('0x2f')]=db['Sequelize'][_0xb68b('0x77')];break;case _0xb68b('0x79'):_0x117503['type']=db[_0xb68b('0x76')]['INTEGER'];break;case _0xb68b('0x7a'):_0x117503[_0xb68b('0x2f')]=db['Sequelize'][_0xb68b('0x7b')];_0x117503[_0xb68b('0x7c')]=![];break;default:}return db['sequelize'][_0xb68b('0x7d')][_0xb68b('0x7e')](_0xb68b('0x7f'),util[_0xb68b('0x6a')](_0xb68b('0x80'),_0x4dfeb2['id']),_0x117503);})[_0xb68b('0x25')](function(){return _0x4dfeb2;});});}})[_0xb68b('0x25')](respondWithResult(_0x431cb5,null))[_0xb68b('0x46')](handleError(_0x431cb5,null));};exports[_0xb68b('0x81')]=function(_0x3d5b36,_0x81b5cd,_0x4215d5){var _0xb60c25={};var _0x401830={};var _0x157386;var _0x2f681e;return db[_0xb68b('0x2c')][_0xb68b('0x51')]({'where':{'id':_0x3d5b36['params']['id']}})[_0xb68b('0x25')](handleEntityNotFound(_0x81b5cd,null))[_0xb68b('0x25')](function(_0x43f467){if(_0x43f467){_0x157386=_0x43f467;_0x401830[_0xb68b('0x31')]=_['keys'](db[_0xb68b('0x68')]['rawAttributes']);_0x401830[_0xb68b('0x33')]=_['keys'](_0x3d5b36[_0xb68b('0x33')]);_0x401830[_0xb68b('0x34')]=_[_0xb68b('0x44')](_0x401830[_0xb68b('0x31')],_0x401830[_0xb68b('0x33')]);_0xb60c25[_0xb68b('0x35')]=_[_0xb68b('0x44')](_0x401830[_0xb68b('0x31')],qs['fields'](_0x3d5b36[_0xb68b('0x33')]['fields']));_0xb60c25[_0xb68b('0x35')]=_0xb60c25[_0xb68b('0x35')][_0xb68b('0x37')]?_0xb60c25[_0xb68b('0x35')]:_0x401830[_0xb68b('0x31')];_0xb60c25[_0xb68b('0x65')]=qs[_0xb68b('0x3a')](_0x3d5b36[_0xb68b('0x33')][_0xb68b('0x3a')]);_0xb60c25[_0xb68b('0x3d')]=qs[_0xb68b('0x34')](_[_0xb68b('0x3b')](_0x3d5b36['query'],_0x401830[_0xb68b('0x34')]));_0xb60c25[_0xb68b('0x3d')]=_[_0xb68b('0x3e')](_0xb60c25[_0xb68b('0x3d')],{'$or':[{'ListId':_0x43f467['id']},{'ListId':null}]});if(_0x3d5b36[_0xb68b('0x33')][_0xb68b('0x3c')]){_0xb60c25[_0xb68b('0x3d')]=_[_0xb68b('0x3e')](_0xb60c25['where'],{'$or':_[_0xb68b('0x2b')](_0xb60c25['attributes'],function(_0x59d1d5){var _0x5db2e1={};_0x5db2e1[_0x59d1d5]={'$like':'%'+_0x3d5b36['query']['filter']+'%'};return _0x5db2e1;})});}_0xb60c25=_[_0xb68b('0x3e')]({},_0xb60c25,_0x3d5b36[_0xb68b('0x3f')]);return db['CmCustomField']['findAndCountAll'](_0xb60c25);}})[_0xb68b('0x25')](respondWithResult(_0x81b5cd,null))[_0xb68b('0x46')](handleError(_0x81b5cd,null));};exports['addAgents']=function(_0x87681b,_0xca292a,_0x1befec){return db[_0xb68b('0x2c')][_0xb68b('0x45')]({'where':{'id':_0x87681b['params']['id']}})['then'](handleEntityNotFound(_0xca292a,null))[_0xb68b('0x25')](function(_0x3a7667){if(_0x3a7667){return _0x3a7667[_0xb68b('0x82')](_0x87681b['body'][_0xb68b('0x57')],_[_0xb68b('0x83')](_0x87681b['body'],[_0xb68b('0x57'),'id'])||{})[_0xb68b('0x84')](function(_0x2cdb72){for(var _0x4808ab=0x0;_0x4808ab<_0x87681b[_0xb68b('0x4d')][_0xb68b('0x57')][_0xb68b('0x37')];_0x4808ab+=0x1){socket[_0xb68b('0x85')]('userCmList:save',{'UserId':_0x87681b[_0xb68b('0x4d')]['ids'][_0x4808ab],'CmListId':_0x87681b[_0xb68b('0x43')]['id']});}return _0x2cdb72;});}})[_0xb68b('0x25')](respondWithResult(_0xca292a,null))['catch'](handleError(_0xca292a,null));};exports[_0xb68b('0x86')]=function(_0x43a559,_0x26f0b8,_0x586dd9){return db[_0xb68b('0x2c')][_0xb68b('0x45')]({'where':{'id':_0x43a559['params']['id']}})[_0xb68b('0x25')](handleEntityNotFound(_0x26f0b8,null))[_0xb68b('0x25')](function(_0x38af69){if(_0x38af69){return _0x38af69[_0xb68b('0x86')](_0x43a559[_0xb68b('0x33')][_0xb68b('0x57')])[_0xb68b('0x25')](function(){if(_[_0xb68b('0x5a')](_0x43a559[_0xb68b('0x33')][_0xb68b('0x57')])){for(var _0x5c02db=0x0;_0x5c02db<_0x43a559[_0xb68b('0x33')][_0xb68b('0x57')][_0xb68b('0x37')];_0x5c02db+=0x1){socket[_0xb68b('0x85')]('userCmList:remove',{'UserId':Number(_0x43a559[_0xb68b('0x33')][_0xb68b('0x57')][_0x5c02db]),'CmListId':Number(_0x43a559['params']['id'])});}}else{socket[_0xb68b('0x85')](_0xb68b('0x87'),{'UserId':Number(_0x43a559[_0xb68b('0x33')][_0xb68b('0x57')]),'CmListId':Number(_0x43a559['params']['id'])});}});}})[_0xb68b('0x25')](respondWithStatusCode(_0x26f0b8,null))[_0xb68b('0x46')](handleError(_0x26f0b8,null));};exports[_0xb68b('0x88')]=function(_0x475d3b,_0x1a8991,_0x5f5b83){var _0x8e78ea={};var _0x1e2cd2={};var _0x55cb40;var _0x42525a;return db[_0xb68b('0x2c')][_0xb68b('0x51')]({'where':{'id':_0x475d3b[_0xb68b('0x43')]['id']}})[_0xb68b('0x25')](handleEntityNotFound(_0x1a8991,null))[_0xb68b('0x25')](function(_0x12dc0c){if(_0x12dc0c){_0x55cb40=_0x12dc0c;_0x1e2cd2[_0xb68b('0x31')]=_[_0xb68b('0x32')](db[_0xb68b('0x89')][_0xb68b('0x2d')]);_0x1e2cd2['query']=_[_0xb68b('0x32')](_0x475d3b[_0xb68b('0x33')]);_0x1e2cd2['filters']=_['intersection'](_0x1e2cd2[_0xb68b('0x31')],_0x1e2cd2['query']);_0x8e78ea[_0xb68b('0x35')]=_[_0xb68b('0x44')](_0x1e2cd2['model'],qs[_0xb68b('0x36')](_0x475d3b[_0xb68b('0x33')][_0xb68b('0x36')]));_0x8e78ea['attributes']=_0x8e78ea[_0xb68b('0x35')][_0xb68b('0x37')]?_0x8e78ea[_0xb68b('0x35')]:_0x1e2cd2['model'];_0x8e78ea['order']=qs[_0xb68b('0x3a')](_0x475d3b['query'][_0xb68b('0x3a')]);_0x8e78ea[_0xb68b('0x3d')]=qs[_0xb68b('0x34')](_[_0xb68b('0x3b')](_0x475d3b[_0xb68b('0x33')],_0x1e2cd2[_0xb68b('0x34')]));if(_0x475d3b[_0xb68b('0x33')][_0xb68b('0x3c')]){_0x8e78ea['where']=_[_0xb68b('0x3e')](_0x8e78ea[_0xb68b('0x3d')],{'$or':_[_0xb68b('0x2b')](_0x8e78ea[_0xb68b('0x35')],function(_0x20a25d){var _0x350ba2={};_0x350ba2[_0x20a25d]={'$like':'%'+_0x475d3b[_0xb68b('0x33')][_0xb68b('0x3c')]+'%'};return _0x350ba2;})});}_0x8e78ea=_['merge']({},_0x8e78ea,_0x475d3b[_0xb68b('0x3f')]);return _0x55cb40[_0xb68b('0x88')](_0x8e78ea);}})[_0xb68b('0x25')](function(_0x33c1e9){if(_0x33c1e9){_0x42525a=_0x33c1e9[_0xb68b('0x37')];if(!_0x475d3b[_0xb68b('0x33')][_0xb68b('0x38')](_0xb68b('0x53'))){_0x8e78ea[_0xb68b('0x39')]=qs['limit'](_0x475d3b[_0xb68b('0x33')][_0xb68b('0x39')]);_0x8e78ea[_0xb68b('0x1e')]=qs[_0xb68b('0x1e')](_0x475d3b[_0xb68b('0x33')][_0xb68b('0x1e')]);}return _0x55cb40[_0xb68b('0x88')](_0x8e78ea);}})[_0xb68b('0x25')](function(_0x96463f){if(_0x96463f){return _0x96463f?{'count':_0x42525a,'rows':_0x96463f}:null;}})['then'](respondWithResult(_0x1a8991,null))[_0xb68b('0x46')](handleError(_0x1a8991,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3e320b2..6433758 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 _0x858d=['save','update','emit','hasOwnProperty','hook','events','CmList'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x858d,0x83));var _0xd858=function(_0x359b3b,_0x21e4c2){_0x359b3b=_0x359b3b-0x0;var _0x2f0b37=_0x858d[_0x359b3b];return _0x2f0b37;};'use strict';var EventEmitter=require(_0xd858('0x0'));var CmList=require('../../mysqldb')['db'][_0xd858('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd858('0x2'),'afterUpdate':_0xd858('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1af558){return function(_0x89f4e1,_0x359aba,_0x36d7a8){CmListEvents[_0xd858('0x4')](_0x1af558+':'+_0x89f4e1['id'],_0x89f4e1);CmListEvents[_0xd858('0x4')](_0x1af558,_0x89f4e1);_0x36d7a8(null);};}for(var e in events){if(events[_0xd858('0x5')](e)){var event=events[e];CmList[_0xd858('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0xf55c=['events','../../mysqldb','CmList','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x396abb,_0xb35306){var _0x2bc6c6=function(_0x1db640){while(--_0x1db640){_0x396abb['push'](_0x396abb['shift']());}};_0x2bc6c6(++_0xb35306);}(_0xf55c,0xea));var _0xcf55=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xf55c[_0x387777];return _0x3f84c0;};'use strict';var EventEmitter=require(_0xcf55('0x0'));var CmList=require(_0xcf55('0x1'))['db'][_0xcf55('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xcf55('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf55('0x4'),'afterDestroy':'remove'};function emitEvent(_0x511fc4){return function(_0x146a68,_0x1e13d2,_0x9c08b6){CmListEvents[_0xcf55('0x5')](_0x511fc4+':'+_0x146a68['id'],_0x146a68);CmListEvents[_0xcf55('0x5')](_0x511fc4,_0x146a68);_0x9c08b6(null);};}for(var e in events){if(events[_0xcf55('0x6')](e)){var event=events[e];CmList[_0xcf55('0x7')](e,emitEvent(event));}}module[_0xcf55('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 16cac80..55a14b6 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 _0x564d=['path','exports','define','CmList','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x25cd30,_0x2c5807){var _0x3c0b3c=function(_0x13c799){while(--_0x13c799){_0x25cd30['push'](_0x25cd30['shift']());}};_0x3c0b3c(++_0x2c5807);}(_0x564d,0x108));var _0xd564=function(_0x6f5229,_0x1e9031){_0x6f5229=_0x6f5229-0x0;var _0x5d2f3d=_0x564d[_0x6f5229];return _0x5d2f3d;};'use strict';var _=require(_0xd564('0x0'));var util=require(_0xd564('0x1'));var logger=require(_0xd564('0x2'))(_0xd564('0x3'));var moment=require(_0xd564('0x4'));var BPromise=require(_0xd564('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd564('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0xd564('0x7')]=function(_0x54e9a2,_0x598cd2){return _0x54e9a2[_0xd564('0x8')](_0xd564('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bad=['../../config/environment','exports','CmList','util','../../config/logger','api','moment','path'];(function(_0x3ead55,_0x22bc51){var _0x3ea16d=function(_0x2a59e0){while(--_0x2a59e0){_0x3ead55['push'](_0x3ead55['shift']());}};_0x3ea16d(++_0x22bc51);}(_0x7bad,0x153));var _0xd7ba=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0x7bad[_0x313df3];return _0x241d59;};'use strict';var _=require('lodash');var util=require(_0xd7ba('0x0'));var logger=require(_0xd7ba('0x1'))(_0xd7ba('0x2'));var moment=require(_0xd7ba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7ba('0x4'));var rimraf=require('rimraf');var config=require(_0xd7ba('0x5'));var attributes=require('./cmList.attributes');module[_0xd7ba('0x6')]=function(_0x589a67,_0xc1b584){return _0x589a67['define'](_0xd7ba('0x7'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 0ae34d5..5fb9139 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 _0x039c=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','info','request\x20sent','debug','stringify','error','code','message','CmList,\x20%s,\x20%s'];(function(_0x2bf3ef,_0x1f97a8){var _0x2315ce=function(_0x54e2c0){while(--_0x54e2c0){_0x2bf3ef['push'](_0x2bf3ef['shift']());}};_0x2315ce(++_0x1f97a8);}(_0x039c,0x16e));var _0xc039=function(_0x46b749,_0x1f40b4){_0x46b749=_0x46b749-0x0;var _0x4b1357=_0x039c[_0x46b749];return _0x4b1357;};'use strict';var _=require(_0xc039('0x0'));var util=require(_0xc039('0x1'));var moment=require(_0xc039('0x2'));var BPromise=require(_0xc039('0x3'));var rs=require(_0xc039('0x4'));var fs=require('fs');var Redis=require(_0xc039('0x5'));var db=require(_0xc039('0x6'))['db'];var utils=require(_0xc039('0x7'));var logger=require(_0xc039('0x8'))(_0xc039('0x9'));var config=require('../../config/environment');var jayson=require(_0xc039('0xa'));var client=jayson[_0xc039('0xb')]['http']({'port':0x232a});config[_0xc039('0xc')]=_[_0xc039('0xd')](config['redis'],{'host':_0xc039('0xe'),'port':0x18eb});var socket=require(_0xc039('0xf'))(new Redis(config[_0xc039('0xc')]));require(_0xc039('0x10'))[_0xc039('0x11')](socket);function respondWithRpcPromise(_0x60d6a5,_0x1b3178,_0x188bf2){return new BPromise(function(_0x58ce70,_0x4fc4e2){return client['request'](_0x60d6a5,_0x188bf2)['then'](function(_0x2288f9){logger[_0xc039('0x12')]('CmList,\x20%s,\x20%s',_0x1b3178,_0xc039('0x13'));logger[_0xc039('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x1b3178,'request\x20sent',JSON[_0xc039('0x15')](_0x2288f9));if(_0x2288f9[_0xc039('0x16')]){if(_0x2288f9['error'][_0xc039('0x17')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x1b3178,_0x2288f9[_0xc039('0x16')][_0xc039('0x18')]);return _0x4fc4e2(_0x2288f9[_0xc039('0x16')][_0xc039('0x18')]);}logger[_0xc039('0x16')](_0xc039('0x19'),_0x1b3178,_0x2288f9['error'][_0xc039('0x18')]);return _0x58ce70(_0x2288f9[_0xc039('0x16')]['message']);}else{logger[_0xc039('0x12')]('CmList,\x20%s,\x20%s',_0x1b3178,'request\x20sent');_0x58ce70(_0x2288f9[_0xc039('0x1a')][_0xc039('0x18')]);}})[_0xc039('0x1b')](function(_0x5dd16a){logger['error']('CmList,\x20%s,\x20%s',_0x1b3178,_0x5dd16a);_0x4fc4e2(_0x5dd16a);});});} \ No newline at end of file +var _0x93bb=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','request\x20sent','debug','error','code','CmList,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x93bb,0x1c7));var _0xb93b=function(_0x4c4f25,_0x49acd3){_0x4c4f25=_0x4c4f25-0x0;var _0xdd89d8=_0x93bb[_0x4c4f25];return _0xdd89d8;};'use strict';var _=require(_0xb93b('0x0'));var util=require(_0xb93b('0x1'));var moment=require(_0xb93b('0x2'));var BPromise=require(_0xb93b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb93b('0x4'));var db=require(_0xb93b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb93b('0x6'))(_0xb93b('0x7'));var config=require(_0xb93b('0x8'));var jayson=require(_0xb93b('0x9'));var client=jayson[_0xb93b('0xa')][_0xb93b('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb93b('0xc')],{'host':_0xb93b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb93b('0xc')]));require('./cmList.socket')[_0xb93b('0xe')](socket);function respondWithRpcPromise(_0x4b6d20,_0x5de8c7,_0x16d095){return new BPromise(function(_0x2dcee9,_0x16d2fd){return client[_0xb93b('0xf')](_0x4b6d20,_0x16d095)['then'](function(_0x47ecca){logger['info']('CmList,\x20%s,\x20%s',_0x5de8c7,_0xb93b('0x10'));logger[_0xb93b('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x5de8c7,'request\x20sent',JSON['stringify'](_0x47ecca));if(_0x47ecca['error']){if(_0x47ecca[_0xb93b('0x12')][_0xb93b('0x13')]===0x1f4){logger[_0xb93b('0x12')](_0xb93b('0x14'),_0x5de8c7,_0x47ecca[_0xb93b('0x12')]['message']);return _0x16d2fd(_0x47ecca[_0xb93b('0x12')][_0xb93b('0x15')]);}logger[_0xb93b('0x12')](_0xb93b('0x14'),_0x5de8c7,_0x47ecca[_0xb93b('0x12')][_0xb93b('0x15')]);return _0x2dcee9(_0x47ecca['error']['message']);}else{logger[_0xb93b('0x16')](_0xb93b('0x14'),_0x5de8c7,'request\x20sent');_0x2dcee9(_0x47ecca[_0xb93b('0x17')][_0xb93b('0x15')]);}})['catch'](function(_0x32dadd){logger[_0xb93b('0x12')](_0xb93b('0x14'),_0x5de8c7,_0x32dadd);_0x16d2fd(_0x32dadd);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 2210184..8fbe2cd 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 _0xd9c8=['./cmList.events','save','update','emit','length','cmList:'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd9c8[_0x278e3c];return _0x3e2d9b;};'use strict';var CmListEvents=require(_0x8d9c('0x0'));var events=[_0x8d9c('0x1'),'remove',_0x8d9c('0x2')];function createListener(_0x240e64,_0x2140c9){return function(_0xaecd58){_0x2140c9[_0x8d9c('0x3')](_0x240e64,_0xaecd58);};}function removeListener(_0x376ce5,_0xa7b017){return function(){CmListEvents['removeListener'](_0x376ce5,_0xa7b017);};}exports['register']=function(_0x53567f){for(var _0x2c083c=0x0,_0x1ebb5a=events[_0x8d9c('0x4')];_0x2c083c<_0x1ebb5a;_0x2c083c++){var _0x49c96f=events[_0x2c083c];var _0x3790f6=createListener(_0x8d9c('0x5')+_0x49c96f,_0x53567f);CmListEvents['on'](_0x49c96f,_0x3790f6);}}; \ No newline at end of file +var _0x8a8b=['update','removeListener','register','cmList:','./cmList.events'];(function(_0x79e2b5,_0x5a0bb0){var _0x5d4e24=function(_0x233014){while(--_0x233014){_0x79e2b5['push'](_0x79e2b5['shift']());}};_0x5d4e24(++_0x5a0bb0);}(_0x8a8b,0xae));var _0xb8a8=function(_0x52211d,_0x1dd5a3){_0x52211d=_0x52211d-0x0;var _0x47d12a=_0x8a8b[_0x52211d];return _0x47d12a;};'use strict';var CmListEvents=require(_0xb8a8('0x0'));var events=['save','remove',_0xb8a8('0x1')];function createListener(_0x308da3,_0x4f56d4){return function(_0x13bc8b){_0x4f56d4['emit'](_0x308da3,_0x13bc8b);};}function removeListener(_0xca9854,_0x4fe301){return function(){CmListEvents[_0xb8a8('0x2')](_0xca9854,_0x4fe301);};}exports[_0xb8a8('0x3')]=function(_0xcca5ca){for(var _0x578e1b=0x0,_0x37e48d=events['length'];_0x578e1b<_0x37e48d;_0x578e1b++){var _0x32d542=events[_0x578e1b];var _0x4c46e9=createListener(_0xb8a8('0x4')+_0x32d542,_0xcca5ca);CmListEvents['on'](_0x32d542,_0x4c46e9);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 25be5fd..53ff63a 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 _0x29ee=['getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','getAgents','post','create','addDisposition','/:id/fields','/:id/users','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','./cmList.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/dispositions'];(function(_0x2a4080,_0x4dca0a){var _0x4e5f64=function(_0x117beb){while(--_0x117beb){_0x2a4080['push'](_0x2a4080['shift']());}};_0x4e5f64(++_0x4dca0a);}(_0x29ee,0x73));var _0xe29e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x29ee[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0xe29e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe29e('0x1'));var express=require(_0xe29e('0x2'));var router=express[_0xe29e('0x3')]();var auth=require(_0xe29e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe29e('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe29e('0x6')](_0xe29e('0x7'),auth['isAuthenticated'](),controller[_0xe29e('0x8')]);router[_0xe29e('0x6')](_0xe29e('0x9'),auth[_0xe29e('0xa')](),controller[_0xe29e('0xb')]);router[_0xe29e('0x6')](_0xe29e('0xc'),auth[_0xe29e('0xa')](),controller[_0xe29e('0xd')]);router[_0xe29e('0x6')](_0xe29e('0xe'),auth[_0xe29e('0xa')](),controller[_0xe29e('0xf')]);router[_0xe29e('0x6')](_0xe29e('0x10'),auth['isAuthenticated'](),controller[_0xe29e('0x11')]);router['get']('/:id/fields',auth[_0xe29e('0xa')](),controller[_0xe29e('0x12')]);router[_0xe29e('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xe29e('0x13')]);router[_0xe29e('0x14')]('/',auth[_0xe29e('0xa')](),controller[_0xe29e('0x15')]);router[_0xe29e('0x14')](_0xe29e('0xc'),auth[_0xe29e('0xa')](),controller[_0xe29e('0x16')]);router[_0xe29e('0x14')](_0xe29e('0xe'),auth[_0xe29e('0xa')](),controller['addContacts']);router[_0xe29e('0x14')](_0xe29e('0x17'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xe29e('0x14')](_0xe29e('0x18'),auth['isAuthenticated'](),controller['addAgents']);router[_0xe29e('0x19')](_0xe29e('0x9'),auth[_0xe29e('0xa')](),controller[_0xe29e('0x1a')]);router[_0xe29e('0x1b')](_0xe29e('0x9'),auth[_0xe29e('0xa')](),controller[_0xe29e('0x1c')]);router[_0xe29e('0x1b')](_0xe29e('0xc'),auth[_0xe29e('0xa')](),controller[_0xe29e('0x1d')]);router[_0xe29e('0x1b')](_0xe29e('0x18'),auth[_0xe29e('0xa')](),controller[_0xe29e('0x1e')]);module[_0xe29e('0x1f')]=router; \ No newline at end of file +var _0x266d=['show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','create','post','addDisposition','addContacts','addCustomField','addAgents','put','update','destroy','delete','removeDispositions','/:id/users','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x266d,0x188));var _0xd266=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x266d[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xd266('0x0'));var util=require(_0xd266('0x1'));var path=require(_0xd266('0x2'));var timeout=require('connect-timeout');var express=require(_0xd266('0x3'));var router=express[_0xd266('0x4')]();var auth=require(_0xd266('0x5'));var interaction=require(_0xd266('0x6'));var config=require(_0xd266('0x7'));var controller=require(_0xd266('0x8'));router[_0xd266('0x9')]('/',auth[_0xd266('0xa')](),controller[_0xd266('0xb')]);router[_0xd266('0x9')](_0xd266('0xc'),auth[_0xd266('0xa')](),controller[_0xd266('0xd')]);router[_0xd266('0x9')](_0xd266('0xe'),auth['isAuthenticated'](),controller[_0xd266('0xf')]);router[_0xd266('0x9')](_0xd266('0x10'),auth[_0xd266('0xa')](),controller[_0xd266('0x11')]);router[_0xd266('0x9')](_0xd266('0x12'),auth[_0xd266('0xa')](),controller[_0xd266('0x13')]);router[_0xd266('0x9')](_0xd266('0x14'),auth[_0xd266('0xa')](),controller['getContactsCsv']);router[_0xd266('0x9')](_0xd266('0x15'),auth[_0xd266('0xa')](),controller[_0xd266('0x16')]);router['get']('/:id/users',auth[_0xd266('0xa')](),controller[_0xd266('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd266('0x18')]);router[_0xd266('0x19')](_0xd266('0x10'),auth[_0xd266('0xa')](),controller[_0xd266('0x1a')]);router[_0xd266('0x19')](_0xd266('0x12'),auth[_0xd266('0xa')](),controller[_0xd266('0x1b')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0xd266('0x1c')]);router[_0xd266('0x19')]('/:id/users',auth[_0xd266('0xa')](),controller[_0xd266('0x1d')]);router[_0xd266('0x1e')](_0xd266('0xe'),auth[_0xd266('0xa')](),controller[_0xd266('0x1f')]);router['delete']('/:id',auth[_0xd266('0xa')](),controller[_0xd266('0x20')]);router[_0xd266('0x21')]('/:id/dispositions',auth[_0xd266('0xa')](),controller[_0xd266('0x22')]);router[_0xd266('0x21')](_0xd266('0x23'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xd266('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 2d5d230..75dd735 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(_0x12c6ec,_0x22c509){var _0x4923cb=function(_0x57a1a8){while(--_0x57a1a8){_0x12c6ec['push'](_0x12c6ec['shift']());}};_0x4923cb(++_0x22c509);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0xb3cfd0,_0x459724){var _0x24b3a6=function(_0x4f9749){while(--_0x4f9749){_0xb3cfd0['push'](_0xb3cfd0['shift']());}};_0x24b3a6(++_0x459724);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 55b6132..4467f01 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 _0x0058=['html-pdf','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','destroy','then','stack','name','body','Condition','find','catch','params'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0058,0x1ae));var _0x8005=function(_0x403792,_0x64be4b){_0x403792=_0x403792-0x0;var _0x5aa70c=_0x0058[_0x403792];return _0x5aa70c;};'use strict';var pdf=require(_0x8005('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8005('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8005('0x2'));var rp=require('request-promise');var moment=require(_0x8005('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8005('0x4'));var path=require(_0x8005('0x5'));var sox=require(_0x8005('0x6'));var csv=require(_0x8005('0x7'));var ejs=require(_0x8005('0x8'));var fs=require('fs');var _=require(_0x8005('0x9'));var squel=require(_0x8005('0xa'));var crypto=require(_0x8005('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8005('0xc'));var toCsv=require(_0x8005('0x7'));var querystring=require(_0x8005('0xd'));var Papa=require('papaparse');var Redis=require(_0x8005('0xe'));var authService=require(_0x8005('0xf'));var qs=require(_0x8005('0x10'));var as=require(_0x8005('0x11'));var hardwareService=require(_0x8005('0x12'));var logger=require(_0x8005('0x13'))(_0x8005('0x14'));var utils=require(_0x8005('0x15'));var config=require(_0x8005('0x16'));var db=require(_0x8005('0x17'))['db'];function respondWithStatusCode(_0x566606,_0x4f640d){_0x4f640d=_0x4f640d||0xcc;return function(_0x54a0c9){if(_0x54a0c9){return _0x566606[_0x8005('0x18')](_0x4f640d);}return _0x566606[_0x8005('0x19')](_0x4f640d)['end']();};}function respondWithResult(_0x2d1f62,_0x3a7934){_0x3a7934=_0x3a7934||0xc8;return function(_0x34f1af){if(_0x34f1af){return _0x2d1f62[_0x8005('0x19')](_0x3a7934)[_0x8005('0x1a')](_0x34f1af);}};}function respondWithFilteredResult(_0x2a959e,_0x1cff41){return function(_0x5277bf){if(_0x5277bf){var _0x51d769=_0x5277bf[_0x8005('0x1b')],_0x5b581f=_0x1cff41[_0x8005('0x1c')],_0x165071=_0x1cff41[_0x8005('0x1c')]+_0x1cff41[_0x8005('0x1d')],_0x471dfa;if(_0x165071>=_0x51d769){_0x165071=_0x51d769;_0x471dfa=0xc8;}else{_0x471dfa=0xce;}_0x2a959e['status'](_0x471dfa);return _0x2a959e[_0x8005('0x1e')]('Content-Range',_0x5b581f+'-'+_0x165071+'/'+_0x51d769)['json'](_0x5277bf);}return null;};}function patchUpdates(_0x4ce890){return function(_0x3c9e94){try{jsonpatch['apply'](_0x3c9e94,_0x4ce890,!![]);}catch(_0x4669b1){return BPromise[_0x8005('0x1f')](_0x4669b1);}return _0x3c9e94[_0x8005('0x20')]();};}function saveUpdates(_0x25b774,_0x4eb4cb){return function(_0x22885c){if(_0x22885c){return _0x22885c[_0x8005('0x21')](_0x25b774)['then'](function(_0x3becbe){return _0x3becbe;});}return null;};}function removeEntity(_0x3a42e0,_0x111e48){return function(_0x2b91f6){if(_0x2b91f6){return _0x2b91f6[_0x8005('0x22')]()[_0x8005('0x23')](function(){_0x3a42e0[_0x8005('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2003a2,_0x438b55){return function(_0x2495f3){if(!_0x2495f3){_0x2003a2[_0x8005('0x18')](0x194);}return _0x2495f3;};}function handleError(_0x4b602f,_0x395120){_0x395120=_0x395120||0x1f4;return function(_0x57ec24){logger['error'](_0x57ec24[_0x8005('0x24')]);if(_0x57ec24['name']){delete _0x57ec24[_0x8005('0x25')];}_0x4b602f[_0x8005('0x19')](_0x395120)['send'](_0x57ec24);};}exports[_0x8005('0x21')]=function(_0x2f3ac3,_0x393d20){if(_0x2f3ac3[_0x8005('0x26')]['id']){delete _0x2f3ac3[_0x8005('0x26')]['id'];}return db[_0x8005('0x27')][_0x8005('0x28')]({'where':{'id':_0x2f3ac3['params']['id']}})['then'](handleEntityNotFound(_0x393d20,null))[_0x8005('0x23')](saveUpdates(_0x2f3ac3[_0x8005('0x26')],null))[_0x8005('0x23')](respondWithResult(_0x393d20,null))[_0x8005('0x29')](handleError(_0x393d20,null));};exports[_0x8005('0x22')]=function(_0x269f6f,_0x2c66bd){return db[_0x8005('0x27')]['find']({'where':{'id':_0x269f6f[_0x8005('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2c66bd,null))[_0x8005('0x23')](removeEntity(_0x2c66bd,null))[_0x8005('0x29')](handleError(_0x2c66bd,null));}; \ No newline at end of file +var _0x38fe=['sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','end','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','body','Condition','find','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util'];(function(_0x20639d,_0x35a0b2){var _0x34deec=function(_0x483ca2){while(--_0x483ca2){_0x20639d['push'](_0x20639d['shift']());}};_0x34deec(++_0x35a0b2);}(_0x38fe,0xfa));var _0xe38f=function(_0x3121eb,_0x37b57c){_0x3121eb=_0x3121eb-0x0;var _0x3d1cf0=_0x38fe[_0x3121eb];return _0x3d1cf0;};'use strict';var pdf=require(_0xe38f('0x0'));var emlformat=require(_0xe38f('0x1'));var rimraf=require(_0xe38f('0x2'));var zipdir=require(_0xe38f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe38f('0x4'));var moment=require('moment');var BPromise=require(_0xe38f('0x5'));var Mustache=require(_0xe38f('0x6'));var util=require(_0xe38f('0x7'));var path=require('path');var sox=require(_0xe38f('0x8'));var csv=require(_0xe38f('0x9'));var ejs=require(_0xe38f('0xa'));var fs=require('fs');var _=require(_0xe38f('0xb'));var squel=require('squel');var crypto=require(_0xe38f('0xc'));var jsforce=require(_0xe38f('0xd'));var deskjs=require(_0xe38f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe38f('0xf'));var Papa=require(_0xe38f('0x10'));var Redis=require(_0xe38f('0x11'));var authService=require(_0xe38f('0x12'));var qs=require(_0xe38f('0x13'));var as=require(_0xe38f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe38f('0x15'))(_0xe38f('0x16'));var utils=require(_0xe38f('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55febd,_0x51796e){_0x51796e=_0x51796e||0xcc;return function(_0x2b9e54){if(_0x2b9e54){return _0x55febd['sendStatus'](_0x51796e);}return _0x55febd['status'](_0x51796e)[_0xe38f('0x18')]();};}function respondWithResult(_0x3ff180,_0x155466){_0x155466=_0x155466||0xc8;return function(_0x4e3454){if(_0x4e3454){return _0x3ff180[_0xe38f('0x19')](_0x155466)[_0xe38f('0x1a')](_0x4e3454);}};}function respondWithFilteredResult(_0x87dab3,_0x5945cc){return function(_0xbdd440){if(_0xbdd440){var _0x83e23f=_0xbdd440['count'],_0x3503a9=_0x5945cc[_0xe38f('0x1b')],_0x28e042=_0x5945cc['offset']+_0x5945cc[_0xe38f('0x1c')],_0x5303e1;if(_0x28e042>=_0x83e23f){_0x28e042=_0x83e23f;_0x5303e1=0xc8;}else{_0x5303e1=0xce;}_0x87dab3[_0xe38f('0x19')](_0x5303e1);return _0x87dab3[_0xe38f('0x1d')](_0xe38f('0x1e'),_0x3503a9+'-'+_0x28e042+'/'+_0x83e23f)[_0xe38f('0x1a')](_0xbdd440);}return null;};}function patchUpdates(_0x4f5dac){return function(_0x3e490b){try{jsonpatch[_0xe38f('0x1f')](_0x3e490b,_0x4f5dac,!![]);}catch(_0x42432a){return BPromise['reject'](_0x42432a);}return _0x3e490b[_0xe38f('0x20')]();};}function saveUpdates(_0xa34eae,_0x3b5dad){return function(_0x4f5f24){if(_0x4f5f24){return _0x4f5f24[_0xe38f('0x21')](_0xa34eae)[_0xe38f('0x22')](function(_0x4b1cd0){return _0x4b1cd0;});}return null;};}function removeEntity(_0x4b67ed,_0x4c843c){return function(_0x4cde4d){if(_0x4cde4d){return _0x4cde4d[_0xe38f('0x23')]()[_0xe38f('0x22')](function(){_0x4b67ed[_0xe38f('0x19')](0xcc)[_0xe38f('0x18')]();});}};}function handleEntityNotFound(_0xe1c110,_0x21bb5c){return function(_0xcabfba){if(!_0xcabfba){_0xe1c110['sendStatus'](0x194);}return _0xcabfba;};}function handleError(_0x2f176a,_0x104d6a){_0x104d6a=_0x104d6a||0x1f4;return function(_0x4aa913){logger[_0xe38f('0x24')](_0x4aa913['stack']);if(_0x4aa913[_0xe38f('0x25')]){delete _0x4aa913[_0xe38f('0x25')];}_0x2f176a[_0xe38f('0x19')](_0x104d6a)[_0xe38f('0x26')](_0x4aa913);};}exports[_0xe38f('0x21')]=function(_0x39b1af,_0x3644e8){if(_0x39b1af[_0xe38f('0x27')]['id']){delete _0x39b1af[_0xe38f('0x27')]['id'];}return db[_0xe38f('0x28')][_0xe38f('0x29')]({'where':{'id':_0x39b1af['params']['id']}})['then'](handleEntityNotFound(_0x3644e8,null))[_0xe38f('0x22')](saveUpdates(_0x39b1af[_0xe38f('0x27')],null))['then'](respondWithResult(_0x3644e8,null))[_0xe38f('0x2a')](handleError(_0x3644e8,null));};exports['destroy']=function(_0x119611,_0x1f8805){return db[_0xe38f('0x28')][_0xe38f('0x29')]({'where':{'id':_0x119611['params']['id']}})[_0xe38f('0x22')](handleEntityNotFound(_0x1f8805,null))[_0xe38f('0x22')](removeEntity(_0x1f8805,null))[_0xe38f('0x2a')](handleError(_0x1f8805,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2a4f1b7..b00253e 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 _0xfb7b=['./condition.attributes','exports','tools_conditions','util','moment','request-promise','rimraf','../../config/environment'];(function(_0x5c7883,_0x2d0e2e){var _0x2e4777=function(_0x86e0cc){while(--_0x86e0cc){_0x5c7883['push'](_0x5c7883['shift']());}};_0x2e4777(++_0x2d0e2e);}(_0xfb7b,0x133));var _0xbfb7=function(_0x37ba0c,_0x4465e0){_0x37ba0c=_0x37ba0c-0x0;var _0x511492=_0xfb7b[_0x37ba0c];return _0x511492;};'use strict';var _=require('lodash');var util=require(_0xbfb7('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbfb7('0x1'));var BPromise=require('bluebird');var rp=require(_0xbfb7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfb7('0x3'));var config=require(_0xbfb7('0x4'));var attributes=require(_0xbfb7('0x5'));module[_0xbfb7('0x6')]=function(_0x29a59b,_0x5f3ee9){return _0x29a59b['define']('Condition',attributes,{'tableName':_0xbfb7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7f7=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','tools_conditions','lodash'];(function(_0x489017,_0x4ea392){var _0x21f52f=function(_0x86ed9){while(--_0x86ed9){_0x489017['push'](_0x489017['shift']());}};_0x21f52f(++_0x4ea392);}(_0xa7f7,0x7f));var _0x7a7f=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xa7f7[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0x7a7f('0x0'));var util=require('util');var logger=require(_0x7a7f('0x1'))('api');var moment=require(_0x7a7f('0x2'));var BPromise=require(_0x7a7f('0x3'));var rp=require(_0x7a7f('0x4'));var fs=require('fs');var path=require(_0x7a7f('0x5'));var rimraf=require('rimraf');var config=require(_0x7a7f('0x6'));var attributes=require('./condition.attributes');module['exports']=function(_0x28c297,_0x40ba74){return _0x28c297['define']('Condition',attributes,{'tableName':_0x7a7f('0x7'),'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 f685b14..3c80773 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 _0x835e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','Condition,\x20%s,\x20%s','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xf7a9cf,_0x2cfa33){var _0x7fdc45=function(_0x44b354){while(--_0x44b354){_0xf7a9cf['push'](_0xf7a9cf['shift']());}};_0x7fdc45(++_0x2cfa33);}(_0x835e,0xb8));var _0xe835=function(_0x5323eb,_0x8d92a9){_0x5323eb=_0x5323eb-0x0;var _0x50f25f=_0x835e[_0x5323eb];return _0x50f25f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe835('0x0'));var BPromise=require(_0xe835('0x1'));var rs=require(_0xe835('0x2'));var fs=require('fs');var Redis=require(_0xe835('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe835('0x4'));var logger=require(_0xe835('0x5'))(_0xe835('0x6'));var config=require(_0xe835('0x7'));var jayson=require(_0xe835('0x8'));var client=jayson['client'][_0xe835('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2428db,_0x2b0b22,_0x5d3419){return new BPromise(function(_0x21bfd8,_0x171b1d){return client[_0xe835('0xa')](_0x2428db,_0x5d3419)[_0xe835('0xb')](function(_0x18e3b8){logger['info']('Condition,\x20%s,\x20%s',_0x2b0b22,_0xe835('0xc'));logger['debug'](_0xe835('0xd'),_0x2b0b22,_0xe835('0xc'),JSON['stringify'](_0x18e3b8));if(_0x18e3b8['error']){if(_0x18e3b8[_0xe835('0xe')][_0xe835('0xf')]===0x1f4){logger[_0xe835('0xe')]('Condition,\x20%s,\x20%s',_0x2b0b22,_0x18e3b8[_0xe835('0xe')]['message']);return _0x171b1d(_0x18e3b8['error'][_0xe835('0x10')]);}logger[_0xe835('0xe')](_0xe835('0x11'),_0x2b0b22,_0x18e3b8[_0xe835('0xe')][_0xe835('0x10')]);return _0x21bfd8(_0x18e3b8[_0xe835('0xe')][_0xe835('0x10')]);}else{logger[_0xe835('0x12')]('Condition,\x20%s,\x20%s',_0x2b0b22,_0xe835('0xc'));_0x21bfd8(_0x18e3b8[_0xe835('0x13')][_0xe835('0x10')]);}})[_0xe835('0x14')](function(_0x8a2d73){logger[_0xe835('0xe')]('Condition,\x20%s,\x20%s',_0x2b0b22,_0x8a2d73);_0x171b1d(_0x8a2d73);});});} \ No newline at end of file +var _0xbbaa=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0xbbaa,0x198));var _0xabba=function(_0x20ea39,_0x2a56c0){_0x20ea39=_0x20ea39-0x0;var _0x4435fd=_0xbbaa[_0x20ea39];return _0x4435fd;};'use strict';var _=require(_0xabba('0x0'));var util=require(_0xabba('0x1'));var moment=require(_0xabba('0x2'));var BPromise=require(_0xabba('0x3'));var rs=require(_0xabba('0x4'));var fs=require('fs');var Redis=require(_0xabba('0x5'));var db=require(_0xabba('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xabba('0x7'));var config=require(_0xabba('0x8'));var jayson=require(_0xabba('0x9'));var client=jayson[_0xabba('0xa')][_0xabba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x326f48,_0x3567d0,_0x1275fd){return new BPromise(function(_0x56d643,_0x32e9f9){return client[_0xabba('0xc')](_0x326f48,_0x1275fd)[_0xabba('0xd')](function(_0x5f3ca2){logger['info']('Condition,\x20%s,\x20%s',_0x3567d0,_0xabba('0xe'));logger['debug'](_0xabba('0xf'),_0x3567d0,_0xabba('0xe'),JSON[_0xabba('0x10')](_0x5f3ca2));if(_0x5f3ca2[_0xabba('0x11')]){if(_0x5f3ca2['error'][_0xabba('0x12')]===0x1f4){logger[_0xabba('0x11')]('Condition,\x20%s,\x20%s',_0x3567d0,_0x5f3ca2[_0xabba('0x11')][_0xabba('0x13')]);return _0x32e9f9(_0x5f3ca2[_0xabba('0x11')]['message']);}logger[_0xabba('0x11')](_0xabba('0x14'),_0x3567d0,_0x5f3ca2[_0xabba('0x11')][_0xabba('0x13')]);return _0x56d643(_0x5f3ca2[_0xabba('0x11')][_0xabba('0x13')]);}else{logger['info'](_0xabba('0x14'),_0x3567d0,_0xabba('0xe'));_0x56d643(_0x5f3ca2[_0xabba('0x15')][_0xabba('0x13')]);}})[_0xabba('0x16')](function(_0x1e8cb7){logger[_0xabba('0x11')](_0xabba('0x14'),_0x3567d0,_0x1e8cb7);_0x32e9f9(_0x1e8cb7);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index b606e1c..754074d 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 _0x09a5=['./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x2baea6,_0x16dc01){var _0x925501=function(_0x583903){while(--_0x583903){_0x2baea6['push'](_0x2baea6['shift']());}};_0x925501(++_0x16dc01);}(_0x09a5,0xb0));var _0x509a=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x09a5[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require('multer');var util=require(_0x509a('0x0'));var path=require(_0x509a('0x1'));var timeout=require(_0x509a('0x2'));var express=require(_0x509a('0x3'));var router=express[_0x509a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x509a('0x5'));var controller=require(_0x509a('0x6'));router[_0x509a('0x7')](_0x509a('0x8'),auth[_0x509a('0x9')](),controller[_0x509a('0xa')]);router[_0x509a('0xb')]('/:id',auth[_0x509a('0x9')](),controller[_0x509a('0xc')]);module[_0x509a('0xd')]=router; \ No newline at end of file +var _0xdf1c=['update','delete','isAuthenticated','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x1fb664,_0xf48213){var _0x3a8faf=function(_0xcbc978){while(--_0xcbc978){_0x1fb664['push'](_0x1fb664['shift']());}};_0x3a8faf(++_0xf48213);}(_0xdf1c,0xf4));var _0xcdf1=function(_0x337ab2,_0x380494){_0x337ab2=_0x337ab2-0x0;var _0x4c4ea7=_0xdf1c[_0x337ab2];return _0x4c4ea7;};'use strict';var multer=require(_0xcdf1('0x0'));var util=require(_0xcdf1('0x1'));var path=require(_0xcdf1('0x2'));var timeout=require(_0xcdf1('0x3'));var express=require(_0xcdf1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcdf1('0x5'));var config=require(_0xcdf1('0x6'));var controller=require(_0xcdf1('0x7'));router['put']('/:id',auth['isAuthenticated'](),controller[_0xcdf1('0x8')]);router[_0xcdf1('0x9')]('/:id',auth[_0xcdf1('0xa')](),controller[_0xcdf1('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 70cc188..adc083b 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 _0x705e=['STRING','name','exports'];(function(_0x19fde2,_0xe0237f){var _0xedf877=function(_0x42c0db){while(--_0x42c0db){_0x19fde2['push'](_0x19fde2['shift']());}};_0xedf877(++_0xe0237f);}(_0x705e,0x107));var _0xe705=function(_0x12dccf,_0x5d6207){_0x12dccf=_0x12dccf-0x0;var _0xc4efbf=_0x705e[_0x12dccf];return _0xc4efbf;};'use strict';var Sequelize=require('sequelize');module[_0xe705('0x0')]={'name':{'type':Sequelize[_0xe705('0x1')],'allowNull':![],'unique':_0xe705('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5379=['STRING','sequelize','exports'];(function(_0x179f68,_0x40f6af){var _0x1734c8=function(_0x45766e){while(--_0x45766e){_0x179f68['push'](_0x179f68['shift']());}};_0x1734c8(++_0x40f6af);}(_0x5379,0x1a2));var _0x9537=function(_0x512e3a,_0x56336f){_0x512e3a=_0x512e3a-0x0;var _0x5b40df=_0x5379[_0x512e3a];return _0x5b40df;};'use strict';var Sequelize=require(_0x9537('0x0'));module[_0x9537('0x1')]={'name':{'type':Sequelize[_0x9537('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x9537('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 2040984..2f44eba 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 _0x3639=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','CustomDashboards','UserProfileResource','sendStatus','error','name','send','index','map','Dashboard','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs','https://','custom','attrPath','attrHourFormat','value','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','pick','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3639,0x1e3));var _0x9363=function(_0x5918e9,_0x1142f5){_0x5918e9=_0x5918e9-0x0;var _0x151838=_0x3639[_0x5918e9];return _0x151838;};'use strict';var pdf=require(_0x9363('0x0'));var emlformat=require(_0x9363('0x1'));var rimraf=require(_0x9363('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9363('0x3'));var rp=require(_0x9363('0x4'));var moment=require('moment');var BPromise=require(_0x9363('0x5'));var Mustache=require('mustache');var util=require(_0x9363('0x6'));var path=require(_0x9363('0x7'));var sox=require(_0x9363('0x8'));var csv=require(_0x9363('0x9'));var ejs=require(_0x9363('0xa'));var fs=require('fs');var _=require(_0x9363('0xb'));var squel=require(_0x9363('0xc'));var crypto=require(_0x9363('0xd'));var jsforce=require(_0x9363('0xe'));var deskjs=require(_0x9363('0xf'));var toCsv=require(_0x9363('0x9'));var querystring=require(_0x9363('0x10'));var Papa=require(_0x9363('0x11'));var Redis=require('ioredis');var authService=require(_0x9363('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9363('0x13'));var hardwareService=require(_0x9363('0x14'));var logger=require(_0x9363('0x15'))(_0x9363('0x16'));var utils=require(_0x9363('0x17'));var config=require(_0x9363('0x18'));var db=require(_0x9363('0x19'))['db'];config['redis']=_[_0x9363('0x1a')](config[_0x9363('0x1b')],{'host':_0x9363('0x1c'),'port':0x18eb});var socket=require(_0x9363('0x1d'))(new Redis(config[_0x9363('0x1b')]));require(_0x9363('0x1e'))[_0x9363('0x1f')](socket);function respondWithStatusCode(_0x3910bd,_0x51857c){_0x51857c=_0x51857c||0xcc;return function(_0x58e511){if(_0x58e511){return _0x3910bd['sendStatus'](_0x51857c);}return _0x3910bd[_0x9363('0x20')](_0x51857c)[_0x9363('0x21')]();};}function respondWithResult(_0x53cb66,_0x4411d6){_0x4411d6=_0x4411d6||0xc8;return function(_0x3126ec){if(_0x3126ec){return _0x53cb66[_0x9363('0x20')](_0x4411d6)[_0x9363('0x22')](_0x3126ec);}};}function respondWithFilteredResult(_0x561b40,_0x4cf500){return function(_0x5d57df){if(_0x5d57df){var _0x361fd6=_0x5d57df[_0x9363('0x23')],_0x59209f=_0x4cf500['offset'],_0x3ee396=_0x4cf500[_0x9363('0x24')]+_0x4cf500['limit'],_0x9b957;if(_0x3ee396>=_0x361fd6){_0x3ee396=_0x361fd6;_0x9b957=0xc8;}else{_0x9b957=0xce;}_0x561b40[_0x9363('0x20')](_0x9b957);return _0x561b40[_0x9363('0x25')](_0x9363('0x26'),_0x59209f+'-'+_0x3ee396+'/'+_0x361fd6)[_0x9363('0x22')](_0x5d57df);}return null;};}function patchUpdates(_0x2c5948){return function(_0x8ca334){try{jsonpatch[_0x9363('0x27')](_0x8ca334,_0x2c5948,!![]);}catch(_0x13993d){return BPromise[_0x9363('0x28')](_0x13993d);}return _0x8ca334[_0x9363('0x29')]();};}function saveUpdates(_0x161485,_0x59fa44){return function(_0x2d5f72){if(_0x2d5f72){return _0x2d5f72['update'](_0x161485)['then'](function(_0x49a985){return _0x49a985;});}return null;};}function removeEntity(_0x492796,_0x3a4896){return function(_0x533414){if(_0x533414){return _0x533414[_0x9363('0x2a')]()[_0x9363('0x2b')](function(){var _0x2ae61c=_0x533414[_0x9363('0x2c')]({'plain':!![]});var _0xabbebe=_0x9363('0x2d');return db[_0x9363('0x2e')]['destroy']({'where':{'type':_0xabbebe,'resourceId':_0x2ae61c['id']}})['then'](function(){return _0x533414;});})['then'](function(){_0x492796[_0x9363('0x20')](0xcc)[_0x9363('0x21')]();});}};}function handleEntityNotFound(_0x1fe55c,_0x4cf20d){return function(_0x2a0b73){if(!_0x2a0b73){_0x1fe55c[_0x9363('0x2f')](0x194);}return _0x2a0b73;};}function handleError(_0x2d117f,_0x52405f){_0x52405f=_0x52405f||0x1f4;return function(_0x23d4e1){logger[_0x9363('0x30')](_0x23d4e1['stack']);if(_0x23d4e1[_0x9363('0x31')]){delete _0x23d4e1['name'];}_0x2d117f[_0x9363('0x20')](_0x52405f)[_0x9363('0x32')](_0x23d4e1);};}exports[_0x9363('0x33')]=function(_0x2bd2ca,_0x838fe7){var _0xaebc23={},_0xa355a1={},_0x29de7c={'count':0x0,'rows':[]};var _0x3aacc3=_[_0x9363('0x34')](db[_0x9363('0x35')][_0x9363('0x36')],function(_0x36bc38){return{'name':_0x36bc38['fieldName'],'type':_0x36bc38[_0x9363('0x37')][_0x9363('0x38')]};});_0xa355a1[_0x9363('0x39')]=_[_0x9363('0x34')](_0x3aacc3,_0x9363('0x31'));_0xa355a1[_0x9363('0x3a')]=_[_0x9363('0x3b')](_0x2bd2ca[_0x9363('0x3a')]);_0xa355a1[_0x9363('0x3c')]=_[_0x9363('0x3d')](_0xa355a1[_0x9363('0x39')],_0xa355a1[_0x9363('0x3a')]);_0xaebc23['attributes']=_[_0x9363('0x3d')](_0xa355a1[_0x9363('0x39')],qs['fields'](_0x2bd2ca['query'][_0x9363('0x3e')]));_0xaebc23['attributes']=_0xaebc23[_0x9363('0x3f')][_0x9363('0x40')]?_0xaebc23[_0x9363('0x3f')]:_0xa355a1['model'];if(!_0x2bd2ca[_0x9363('0x3a')][_0x9363('0x41')](_0x9363('0x42'))){_0xaebc23[_0x9363('0x43')]=qs[_0x9363('0x43')](_0x2bd2ca[_0x9363('0x3a')]['limit']);_0xaebc23['offset']=qs[_0x9363('0x24')](_0x2bd2ca[_0x9363('0x3a')][_0x9363('0x24')]);}_0xaebc23[_0x9363('0x44')]=qs['sort'](_0x2bd2ca['query'][_0x9363('0x45')]);_0xaebc23[_0x9363('0x46')]=qs[_0x9363('0x3c')](_['pick'](_0x2bd2ca[_0x9363('0x3a')],_0xa355a1[_0x9363('0x3c')]),_0x3aacc3);if(_0x2bd2ca['query'][_0x9363('0x47')]){_0xaebc23[_0x9363('0x46')]=_[_0x9363('0x48')](_0xaebc23['where'],{'$or':_['map'](_0x3aacc3,function(_0x29a395){if(_0x29a395[_0x9363('0x37')]!=='VIRTUAL'){var _0x22e84f={};_0x22e84f[_0x29a395['name']]={'$like':'%'+_0x2bd2ca[_0x9363('0x3a')][_0x9363('0x47')]+'%'};return _0x22e84f;}})});}_0xaebc23=_[_0x9363('0x48')]({},_0xaebc23,_0x2bd2ca[_0x9363('0x49')]);var _0x13b941={'where':_0xaebc23[_0x9363('0x46')]};return db['Dashboard'][_0x9363('0x23')](_0x13b941)['then'](function(_0x42dd28){_0x29de7c[_0x9363('0x23')]=_0x42dd28;if(_0x2bd2ca[_0x9363('0x3a')][_0x9363('0x4a')]){_0xaebc23[_0x9363('0x4b')]=[{'all':!![]}];}return db[_0x9363('0x35')]['findAll'](_0xaebc23);})['then'](function(_0x3332bb){_0x29de7c[_0x9363('0x4c')]=_0x3332bb;return _0x29de7c;})['then'](respondWithFilteredResult(_0x838fe7,_0xaebc23))[_0x9363('0x4d')](handleError(_0x838fe7,null));};exports[_0x9363('0x4e')]=function(_0x175aff,_0x4b4de9){var _0x48608f={'raw':![],'where':{'id':_0x175aff[_0x9363('0x4f')]['id']}},_0x40b475={};_0x40b475['model']=_[_0x9363('0x3b')](db[_0x9363('0x35')][_0x9363('0x36')]);_0x40b475[_0x9363('0x3a')]=_[_0x9363('0x3b')](_0x175aff['query']);_0x40b475['filters']=_[_0x9363('0x3d')](_0x40b475[_0x9363('0x39')],_0x40b475[_0x9363('0x3a')]);_0x48608f[_0x9363('0x3f')]=_['intersection'](_0x40b475[_0x9363('0x39')],qs[_0x9363('0x3e')](_0x175aff[_0x9363('0x3a')][_0x9363('0x3e')]));_0x48608f[_0x9363('0x3f')]=_0x48608f[_0x9363('0x3f')][_0x9363('0x40')]?_0x48608f[_0x9363('0x3f')]:_0x40b475[_0x9363('0x39')];if(_0x175aff[_0x9363('0x3a')][_0x9363('0x4a')]){_0x48608f['include']=[{'all':!![]}];}_0x48608f=_[_0x9363('0x48')]({},_0x48608f,_0x175aff['options']);return db[_0x9363('0x35')][_0x9363('0x50')](_0x48608f)[_0x9363('0x2b')](handleEntityNotFound(_0x4b4de9,null))[_0x9363('0x2b')](respondWithResult(_0x4b4de9,null))['catch'](handleError(_0x4b4de9,null));};exports[_0x9363('0x51')]=function(_0x1c7006,_0x4a42a1){return db['Dashboard']['create'](_0x1c7006[_0x9363('0x52')],{})[_0x9363('0x2b')](function(_0x27ca36){var _0xf2011f=_0x1c7006['user'][_0x9363('0x2c')]({'plain':!![]});if(!_0xf2011f)throw new Error(_0x9363('0x53'));if(_0xf2011f[_0x9363('0x54')]===_0x9363('0x55')){var _0x1c3888=_0x27ca36['get']({'plain':!![]});var _0xc632f4=_0x9363('0x2d');return db[_0x9363('0x56')][_0x9363('0x50')]({'where':{'name':_0xc632f4,'userProfileId':_0xf2011f['userProfileId']},'raw':!![]})[_0x9363('0x2b')](function(_0x3c954){if(_0x3c954&&_0x3c954['autoAssociation']===0x0){return db[_0x9363('0x2e')][_0x9363('0x51')]({'name':_0x1c3888[_0x9363('0x31')],'resourceId':_0x1c3888['id'],'type':_0x3c954['name'],'sectionId':_0x3c954['id']},{})['then'](function(){return _0x27ca36;});}else{return _0x27ca36;}})[_0x9363('0x4d')](function(_0xe01a43){logger[_0x9363('0x30')](_0x9363('0x57'),_0xe01a43);throw _0xe01a43;});}return _0x27ca36;})[_0x9363('0x2b')](respondWithResult(_0x4a42a1,0xc9))['catch'](handleError(_0x4a42a1,null));};exports[_0x9363('0x58')]=function(_0x369bea,_0x4ff563){var _0x452547={'where':{'id':_0x369bea[_0x9363('0x4f')]['id']}},_0x555791={};_0x555791[_0x9363('0x39')]=_[_0x9363('0x3b')](db[_0x9363('0x35')]['rawAttributes']);_0x452547[_0x9363('0x3f')]=_[_0x9363('0x3d')](_0x555791['model'],qs['fields'](_0x369bea['query'][_0x9363('0x3e')]));_0x452547[_0x9363('0x3f')]=_0x452547[_0x9363('0x3f')]['length']?_0x452547['attributes']:_0x555791[_0x9363('0x39')];if(_0x369bea['query'][_0x9363('0x4a')]){_0x452547[_0x9363('0x4b')]=[{'all':!![]}];}_0x452547=_[_0x9363('0x48')]({},_0x452547,_0x369bea[_0x9363('0x49')]);return db[_0x9363('0x35')][_0x9363('0x50')](_0x452547)['then'](handleEntityNotFound(_0x4ff563,null))[_0x9363('0x2b')](function(_0x4758a2){if(_0x4758a2){var _0x83f722=_0x4758a2[_0x9363('0x2c')]({'plain':!![]});_0x83f722=qs[_0x9363('0x59')](_0x83f722,['id',_0x9363('0x5a'),_0x9363('0x5b')]);_0x369bea['body']=_['omit'](_0x369bea['body'],['id',_0x9363('0x5a'),_0x9363('0x5b')]);return db[_0x9363('0x35')]['create'](_[_0x9363('0x48')](_0x83f722,_0x369bea[_0x9363('0x52')]),{'include':_0x369bea[_0x9363('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x9363('0x2b')](function(_0x5761e8){var _0x19c95c=_0x369bea[_0x9363('0x55')][_0x9363('0x2c')]({'plain':!![]});if(!_0x19c95c)throw new Error(_0x9363('0x53'));if(_0x19c95c[_0x9363('0x54')]==='user'){var _0x4f9a80=_0x5761e8[_0x9363('0x2c')]({'plain':!![]});var _0x5321d2='CustomDashboards';return db[_0x9363('0x56')][_0x9363('0x50')]({'where':{'name':_0x5321d2,'userProfileId':_0x19c95c[_0x9363('0x5c')]},'raw':!![]})[_0x9363('0x2b')](function(_0x59bb48){if(_0x59bb48&&_0x59bb48['autoAssociation']===0x0){return db[_0x9363('0x2e')]['create']({'name':_0x4f9a80[_0x9363('0x31')],'resourceId':_0x4f9a80['id'],'type':_0x59bb48[_0x9363('0x31')],'sectionId':_0x59bb48['id']},{})[_0x9363('0x2b')](function(){return _0x5761e8;});}else{return _0x5761e8;}})[_0x9363('0x4d')](function(_0x391e16){logger[_0x9363('0x30')](_0x9363('0x57'),_0x391e16);throw _0x391e16;});}return _0x5761e8;});}})['then'](respondWithResult(_0x4ff563,0xc9))[_0x9363('0x4d')](handleError(_0x4ff563,null));};exports['update']=function(_0x1fa2a5,_0x17e8f5){if(_0x1fa2a5[_0x9363('0x52')]['id']){delete _0x1fa2a5[_0x9363('0x52')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x1fa2a5['params']['id']}})[_0x9363('0x2b')](handleEntityNotFound(_0x17e8f5,null))[_0x9363('0x2b')](saveUpdates(_0x1fa2a5['body'],null))[_0x9363('0x2b')](respondWithResult(_0x17e8f5,null))[_0x9363('0x4d')](handleError(_0x17e8f5,null));};exports[_0x9363('0x2a')]=function(_0x2d2969,_0x594323){return db[_0x9363('0x35')][_0x9363('0x50')]({'where':{'id':_0x2d2969[_0x9363('0x4f')]['id']}})[_0x9363('0x2b')](handleEntityNotFound(_0x594323,null))[_0x9363('0x2b')](removeEntity(_0x594323,null))[_0x9363('0x4d')](handleError(_0x594323,null));};function widgetAttributes(_0x257679){try{switch(_0x257679[_0x9363('0x37')]){case _0x9363('0x5d'):return[{'name':_0x9363('0x5e'),'value':_0x257679[_0x9363('0x5e')]||(_0x257679[_0x9363('0x5f')]&&_0x257679['attrs'][0x0]?_0x257679[_0x9363('0x5f')][0x0]['value']:undefined)||_0x9363('0x60')}];case _0x9363('0x61'):return[{'name':_0x9363('0x62'),'value':_0x257679[_0x9363('0x62')]||(_0x257679[_0x9363('0x5f')]&&_0x257679['attrs'][0x0]?_0x257679[_0x9363('0x5f')][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x257679[_0x9363('0x63')]||(_0x257679[_0x9363('0x5f')]&&_0x257679[_0x9363('0x5f')][0x0]?_0x257679[_0x9363('0x5f')][0x0][_0x9363('0x64')]:undefined)||_0x9363('0x65')},{'name':'attrTimezone','value':_0x257679['attrTimezone']||(_0x257679[_0x9363('0x5f')]&&_0x257679[_0x9363('0x5f')][0x1]?_0x257679[_0x9363('0x5f')][0x1][_0x9363('0x64')]:undefined)||_0x9363('0x66')},{'name':_0x9363('0x67'),'value':_0x257679['attrFontSize']||(_0x257679['attrs']&&_0x257679[_0x9363('0x5f')][0x2]?_0x257679['attrs'][0x2][_0x9363('0x64')]:undefined)||0xc}];case _0x9363('0x68'):return[{'name':_0x9363('0x69'),'value':_0x257679[_0x9363('0x69')]||(_0x257679['attrs']&&_0x257679[_0x9363('0x5f')][0x0]?_0x257679[_0x9363('0x5f')][0x0]['value']:undefined)||'total'},{'name':_0x9363('0x6a'),'value':_0x257679[_0x9363('0x6a')]||(_0x257679[_0x9363('0x5f')]&&_0x257679[_0x9363('0x5f')][0x1]?_0x257679['attrs'][0x1][_0x9363('0x64')]:undefined)||[]},{'name':_0x9363('0x67'),'value':_0x257679[_0x9363('0x67')]||(_0x257679['attrs']&&_0x257679[_0x9363('0x5f')][0x2]?_0x257679[_0x9363('0x5f')][0x2][_0x9363('0x64')]:undefined)||0x14}];case _0x9363('0x6b'):case _0x9363('0x6c'):return[{'name':_0x9363('0x6d'),'value':_0x257679[_0x9363('0x6d')]||(_0x257679[_0x9363('0x5f')]&&_0x257679[_0x9363('0x5f')][0x0]?_0x257679[_0x9363('0x5f')][0x0][_0x9363('0x64')]:undefined)||_0x9363('0x6e')},{'name':_0x9363('0x6f'),'value':_0x257679[_0x9363('0x6f')]||(_0x257679[_0x9363('0x5f')]&&_0x257679[_0x9363('0x5f')][0x1]?_0x257679[_0x9363('0x5f')][0x1]['value']:undefined)||null},{'name':_0x9363('0x70'),'value':_0x257679[_0x9363('0x70')]||(_0x257679['attrs']&&_0x257679[_0x9363('0x5f')][0x2]?_0x257679['attrs'][0x2][_0x9363('0x64')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x257679['attrVoiceQueues']||(_0x257679['attrs']&&_0x257679[_0x9363('0x5f')][0x3]?_0x257679[_0x9363('0x5f')][0x3]['value']:undefined)||[]}];case _0x9363('0x71'):return[{'name':_0x9363('0x72'),'type':_0x257679[_0x9363('0x73')]||(_0x257679['attrs']&&_0x257679[_0x9363('0x5f')][0x0]?_0x257679['attrs'][0x0][_0x9363('0x37')]:undefined)||null,'value':_0x257679[_0x9363('0x72')]||(_0x257679['attrs']&&_0x257679['attrs'][0x0]?_0x257679[_0x9363('0x5f')][0x0][_0x9363('0x64')]:undefined)||null},{'name':'attrRefresh','value':_0x257679[_0x9363('0x74')]||(_0x257679[_0x9363('0x5f')]&&_0x257679[_0x9363('0x5f')][0x1]?_0x257679[_0x9363('0x5f')][0x1][_0x9363('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x55ab29){logger[_0x9363('0x30')](_0x9363('0x75'),JSON['stringify'](_0x55ab29));return[];}}exports[_0x9363('0x76')]=function(_0x407f76,_0x5db17d,_0x51f1ff){if(_0x407f76[_0x9363('0x52')]['id']){delete _0x407f76['body']['id'];}return db[_0x9363('0x35')][_0x9363('0x50')]({'where':{'id':_0x407f76[_0x9363('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5db17d,null))[_0x9363('0x2b')](function(_0x3d05d8){if(_0x3d05d8){_0x407f76[_0x9363('0x52')][_0x9363('0x77')]=_0x3d05d8['id'];_0x407f76[_0x9363('0x52')][_0x9363('0x5f')]=widgetAttributes(_0x407f76['body']);return db[_0x9363('0x78')][_0x9363('0x51')](_0x407f76[_0x9363('0x52')]);}})[_0x9363('0x2b')](respondWithResult(_0x5db17d,null))[_0x9363('0x4d')](handleError(_0x5db17d,null));};exports[_0x9363('0x79')]=function(_0x4cf08d,_0x36b0a7,_0x4915c2){var _0xb2666={};var _0x5ebc42={};var _0x5673fe;var _0x2c0760;return db[_0x9363('0x35')][_0x9363('0x7a')]({'where':{'id':_0x4cf08d['params']['id']}})[_0x9363('0x2b')](handleEntityNotFound(_0x36b0a7,null))[_0x9363('0x2b')](function(_0x496ee4){if(_0x496ee4){_0x5673fe=_0x496ee4;_0x5ebc42[_0x9363('0x39')]=_['keys'](db['DashboardItem'][_0x9363('0x36')]);_0x5ebc42['query']=_[_0x9363('0x3b')](_0x4cf08d[_0x9363('0x3a')]);_0x5ebc42['filters']=_[_0x9363('0x3d')](_0x5ebc42[_0x9363('0x39')],_0x5ebc42[_0x9363('0x3a')]);_0xb2666['attributes']=_[_0x9363('0x3d')](_0x5ebc42['model'],qs[_0x9363('0x3e')](_0x4cf08d[_0x9363('0x3a')]['fields']));_0xb2666['attributes']=_0xb2666[_0x9363('0x3f')][_0x9363('0x40')]?_0xb2666[_0x9363('0x3f')]:_0x5ebc42['model'];_0xb2666['order']=qs[_0x9363('0x45')](_0x4cf08d[_0x9363('0x3a')][_0x9363('0x45')]);_0xb2666[_0x9363('0x46')]=qs[_0x9363('0x3c')](_[_0x9363('0x7b')](_0x4cf08d[_0x9363('0x3a')],_0x5ebc42[_0x9363('0x3c')]));if(_0x4cf08d[_0x9363('0x3a')][_0x9363('0x47')]){_0xb2666[_0x9363('0x46')]=_[_0x9363('0x48')](_0xb2666['where'],{'$or':_['map'](_0xb2666['attributes'],function(_0x34db8a){var _0x3eb8b3={};_0x3eb8b3[_0x34db8a]={'$like':'%'+_0x4cf08d[_0x9363('0x3a')][_0x9363('0x47')]+'%'};return _0x3eb8b3;})});}_0xb2666=_[_0x9363('0x48')]({},_0xb2666,_0x4cf08d['options']);return _0x5673fe[_0x9363('0x79')](_0xb2666);}})[_0x9363('0x2b')](function(_0xa813d2){if(_0xa813d2){_0x2c0760=_0xa813d2[_0x9363('0x40')];if(!_0x4cf08d[_0x9363('0x3a')][_0x9363('0x41')](_0x9363('0x42'))){_0xb2666[_0x9363('0x43')]=qs[_0x9363('0x43')](_0x4cf08d[_0x9363('0x3a')][_0x9363('0x43')]);_0xb2666[_0x9363('0x24')]=qs[_0x9363('0x24')](_0x4cf08d[_0x9363('0x3a')][_0x9363('0x24')]);}return _0x5673fe['getItems'](_0xb2666);}})[_0x9363('0x2b')](function(_0x513dee){if(_0x513dee){return _0x513dee?{'count':_0x2c0760,'rows':_0x513dee}:null;}})[_0x9363('0x2b')](respondWithResult(_0x36b0a7,null))['catch'](handleError(_0x36b0a7,null));}; \ No newline at end of file +var _0xb6ef=['attrFontSize','attrMetric','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','order','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','redis','./dashboard.socket','sendStatus','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','CustomDashboards','UserProfileResource','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','findAll','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','include','omit','createdAt','updatedAt','UserProfileSection','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone'];(function(_0x3450ce,_0x217d11){var _0xfcfbc1=function(_0x1241c0){while(--_0x1241c0){_0x3450ce['push'](_0x3450ce['shift']());}};_0xfcfbc1(++_0x217d11);}(_0xb6ef,0x1de));var _0xfb6e=function(_0x5eee79,_0x5e9cbb){_0x5eee79=_0x5eee79-0x0;var _0x5b6872=_0xb6ef[_0x5eee79];return _0x5b6872;};'use strict';var pdf=require(_0xfb6e('0x0'));var emlformat=require(_0xfb6e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfb6e('0x2'));var rp=require(_0xfb6e('0x3'));var moment=require(_0xfb6e('0x4'));var BPromise=require(_0xfb6e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfb6e('0x6'));var sox=require('sox');var csv=require(_0xfb6e('0x7'));var ejs=require(_0xfb6e('0x8'));var fs=require('fs');var _=require(_0xfb6e('0x9'));var squel=require(_0xfb6e('0xa'));var crypto=require(_0xfb6e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfb6e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfb6e('0xd'));var Papa=require(_0xfb6e('0xe'));var Redis=require(_0xfb6e('0xf'));var authService=require(_0xfb6e('0x10'));var qs=require(_0xfb6e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb6e('0x12'));var logger=require(_0xfb6e('0x13'))(_0xfb6e('0x14'));var utils=require(_0xfb6e('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xfb6e('0x16')](config[_0xfb6e('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb6e('0x17')]));require(_0xfb6e('0x18'))['register'](socket);function respondWithStatusCode(_0x39130a,_0xd7f8c7){_0xd7f8c7=_0xd7f8c7||0xcc;return function(_0x169976){if(_0x169976){return _0x39130a[_0xfb6e('0x19')](_0xd7f8c7);}return _0x39130a[_0xfb6e('0x1a')](_0xd7f8c7)['end']();};}function respondWithResult(_0x31f120,_0x465f7b){_0x465f7b=_0x465f7b||0xc8;return function(_0x3865c0){if(_0x3865c0){return _0x31f120[_0xfb6e('0x1a')](_0x465f7b)[_0xfb6e('0x1b')](_0x3865c0);}};}function respondWithFilteredResult(_0x5396da,_0x468750){return function(_0x382756){if(_0x382756){var _0x207c3f=_0x382756[_0xfb6e('0x1c')],_0x3ddafb=_0x468750['offset'],_0x5f201a=_0x468750[_0xfb6e('0x1d')]+_0x468750[_0xfb6e('0x1e')],_0x2beabd;if(_0x5f201a>=_0x207c3f){_0x5f201a=_0x207c3f;_0x2beabd=0xc8;}else{_0x2beabd=0xce;}_0x5396da[_0xfb6e('0x1a')](_0x2beabd);return _0x5396da['set'](_0xfb6e('0x1f'),_0x3ddafb+'-'+_0x5f201a+'/'+_0x207c3f)[_0xfb6e('0x1b')](_0x382756);}return null;};}function patchUpdates(_0xb56bba){return function(_0x5298d3){try{jsonpatch[_0xfb6e('0x20')](_0x5298d3,_0xb56bba,!![]);}catch(_0xe05f78){return BPromise['reject'](_0xe05f78);}return _0x5298d3['save']();};}function saveUpdates(_0x56a4b9,_0x4b0559){return function(_0x212662){if(_0x212662){return _0x212662[_0xfb6e('0x21')](_0x56a4b9)[_0xfb6e('0x22')](function(_0x196626){return _0x196626;});}return null;};}function removeEntity(_0x336e00,_0x4cd67c){return function(_0x127ca1){if(_0x127ca1){return _0x127ca1[_0xfb6e('0x23')]()[_0xfb6e('0x22')](function(){var _0x2bf3fb=_0x127ca1['get']({'plain':!![]});var _0x7c09f3=_0xfb6e('0x24');return db[_0xfb6e('0x25')]['destroy']({'where':{'type':_0x7c09f3,'resourceId':_0x2bf3fb['id']}})[_0xfb6e('0x22')](function(){return _0x127ca1;});})['then'](function(){_0x336e00[_0xfb6e('0x1a')](0xcc)[_0xfb6e('0x26')]();});}};}function handleEntityNotFound(_0x223fac,_0x10be52){return function(_0x520aa6){if(!_0x520aa6){_0x223fac[_0xfb6e('0x19')](0x194);}return _0x520aa6;};}function handleError(_0x5986f0,_0x110009){_0x110009=_0x110009||0x1f4;return function(_0x1c4422){logger[_0xfb6e('0x27')](_0x1c4422[_0xfb6e('0x28')]);if(_0x1c4422[_0xfb6e('0x29')]){delete _0x1c4422[_0xfb6e('0x29')];}_0x5986f0[_0xfb6e('0x1a')](_0x110009)[_0xfb6e('0x2a')](_0x1c4422);};}exports['index']=function(_0x5de112,_0xd55f57){var _0x4af80c={},_0x2d306c={},_0x5b02c5={'count':0x0,'rows':[]};var _0x2487c5=_[_0xfb6e('0x2b')](db['Dashboard'][_0xfb6e('0x2c')],function(_0x4efa1c){return{'name':_0x4efa1c[_0xfb6e('0x2d')],'type':_0x4efa1c[_0xfb6e('0x2e')][_0xfb6e('0x2f')]};});_0x2d306c[_0xfb6e('0x30')]=_[_0xfb6e('0x2b')](_0x2487c5,_0xfb6e('0x29'));_0x2d306c[_0xfb6e('0x31')]=_[_0xfb6e('0x32')](_0x5de112[_0xfb6e('0x31')]);_0x2d306c[_0xfb6e('0x33')]=_['intersection'](_0x2d306c[_0xfb6e('0x30')],_0x2d306c[_0xfb6e('0x31')]);_0x4af80c[_0xfb6e('0x34')]=_[_0xfb6e('0x35')](_0x2d306c[_0xfb6e('0x30')],qs['fields'](_0x5de112['query'][_0xfb6e('0x36')]));_0x4af80c[_0xfb6e('0x34')]=_0x4af80c[_0xfb6e('0x34')][_0xfb6e('0x37')]?_0x4af80c[_0xfb6e('0x34')]:_0x2d306c[_0xfb6e('0x30')];if(!_0x5de112[_0xfb6e('0x31')][_0xfb6e('0x38')](_0xfb6e('0x39'))){_0x4af80c[_0xfb6e('0x1e')]=qs['limit'](_0x5de112[_0xfb6e('0x31')][_0xfb6e('0x1e')]);_0x4af80c[_0xfb6e('0x1d')]=qs['offset'](_0x5de112[_0xfb6e('0x31')]['offset']);}_0x4af80c['order']=qs['sort'](_0x5de112['query'][_0xfb6e('0x3a')]);_0x4af80c[_0xfb6e('0x3b')]=qs['filters'](_[_0xfb6e('0x3c')](_0x5de112['query'],_0x2d306c[_0xfb6e('0x33')]),_0x2487c5);if(_0x5de112[_0xfb6e('0x31')][_0xfb6e('0x3d')]){_0x4af80c[_0xfb6e('0x3b')]=_[_0xfb6e('0x3e')](_0x4af80c[_0xfb6e('0x3b')],{'$or':_[_0xfb6e('0x2b')](_0x2487c5,function(_0x44ec7c){if(_0x44ec7c['type']!==_0xfb6e('0x3f')){var _0x3146cc={};_0x3146cc[_0x44ec7c[_0xfb6e('0x29')]]={'$like':'%'+_0x5de112[_0xfb6e('0x31')][_0xfb6e('0x3d')]+'%'};return _0x3146cc;}})});}_0x4af80c=_[_0xfb6e('0x3e')]({},_0x4af80c,_0x5de112[_0xfb6e('0x40')]);var _0x29a55d={'where':_0x4af80c['where']};return db[_0xfb6e('0x41')][_0xfb6e('0x1c')](_0x29a55d)[_0xfb6e('0x22')](function(_0x2a2ed8){_0x5b02c5[_0xfb6e('0x1c')]=_0x2a2ed8;if(_0x5de112[_0xfb6e('0x31')]['includeAll']){_0x4af80c['include']=[{'all':!![]}];}return db[_0xfb6e('0x41')][_0xfb6e('0x42')](_0x4af80c);})['then'](function(_0x3fe010){_0x5b02c5['rows']=_0x3fe010;return _0x5b02c5;})[_0xfb6e('0x22')](respondWithFilteredResult(_0xd55f57,_0x4af80c))['catch'](handleError(_0xd55f57,null));};exports[_0xfb6e('0x43')]=function(_0xa7cb59,_0x45151b){var _0x4eff93={'raw':![],'where':{'id':_0xa7cb59[_0xfb6e('0x44')]['id']}},_0x669f4d={};_0x669f4d[_0xfb6e('0x30')]=_['keys'](db[_0xfb6e('0x41')][_0xfb6e('0x2c')]);_0x669f4d['query']=_[_0xfb6e('0x32')](_0xa7cb59[_0xfb6e('0x31')]);_0x669f4d[_0xfb6e('0x33')]=_['intersection'](_0x669f4d[_0xfb6e('0x30')],_0x669f4d['query']);_0x4eff93[_0xfb6e('0x34')]=_[_0xfb6e('0x35')](_0x669f4d[_0xfb6e('0x30')],qs[_0xfb6e('0x36')](_0xa7cb59[_0xfb6e('0x31')]['fields']));_0x4eff93[_0xfb6e('0x34')]=_0x4eff93[_0xfb6e('0x34')][_0xfb6e('0x37')]?_0x4eff93[_0xfb6e('0x34')]:_0x669f4d['model'];if(_0xa7cb59['query'][_0xfb6e('0x45')]){_0x4eff93['include']=[{'all':!![]}];}_0x4eff93=_[_0xfb6e('0x3e')]({},_0x4eff93,_0xa7cb59[_0xfb6e('0x40')]);return db['Dashboard'][_0xfb6e('0x46')](_0x4eff93)[_0xfb6e('0x22')](handleEntityNotFound(_0x45151b,null))['then'](respondWithResult(_0x45151b,null))['catch'](handleError(_0x45151b,null));};exports[_0xfb6e('0x47')]=function(_0xd7530d,_0x4427f4){return db[_0xfb6e('0x41')]['create'](_0xd7530d[_0xfb6e('0x48')],{})['then'](function(_0xfc1491){var _0x39574f=_0xd7530d[_0xfb6e('0x49')][_0xfb6e('0x4a')]({'plain':!![]});if(!_0x39574f)throw new Error(_0xfb6e('0x4b'));if(_0x39574f[_0xfb6e('0x4c')]==='user'){var _0x5f31b9=_0xfc1491[_0xfb6e('0x4a')]({'plain':!![]});var _0x3556db='CustomDashboards';return db['UserProfileSection']['find']({'where':{'name':_0x3556db,'userProfileId':_0x39574f[_0xfb6e('0x4d')]},'raw':!![]})[_0xfb6e('0x22')](function(_0xe0cfa7){if(_0xe0cfa7&&_0xe0cfa7[_0xfb6e('0x4e')]===0x0){return db[_0xfb6e('0x25')][_0xfb6e('0x47')]({'name':_0x5f31b9[_0xfb6e('0x29')],'resourceId':_0x5f31b9['id'],'type':_0xe0cfa7[_0xfb6e('0x29')],'sectionId':_0xe0cfa7['id']},{})[_0xfb6e('0x22')](function(){return _0xfc1491;});}else{return _0xfc1491;}})['catch'](function(_0x34fe2c){logger[_0xfb6e('0x27')](_0xfb6e('0x4f'),_0x34fe2c);throw _0x34fe2c;});}return _0xfc1491;})['then'](respondWithResult(_0x4427f4,0xc9))[_0xfb6e('0x50')](handleError(_0x4427f4,null));};exports[_0xfb6e('0x51')]=function(_0x105cca,_0x235a64){var _0x30542b={'where':{'id':_0x105cca[_0xfb6e('0x44')]['id']}},_0x5155f3={};_0x5155f3[_0xfb6e('0x30')]=_[_0xfb6e('0x32')](db[_0xfb6e('0x41')][_0xfb6e('0x2c')]);_0x30542b[_0xfb6e('0x34')]=_[_0xfb6e('0x35')](_0x5155f3[_0xfb6e('0x30')],qs[_0xfb6e('0x36')](_0x105cca[_0xfb6e('0x31')][_0xfb6e('0x36')]));_0x30542b[_0xfb6e('0x34')]=_0x30542b['attributes']['length']?_0x30542b[_0xfb6e('0x34')]:_0x5155f3['model'];if(_0x105cca[_0xfb6e('0x31')]['includeAll']){_0x30542b[_0xfb6e('0x52')]=[{'all':!![]}];}_0x30542b=_['merge']({},_0x30542b,_0x105cca['options']);return db['Dashboard'][_0xfb6e('0x46')](_0x30542b)[_0xfb6e('0x22')](handleEntityNotFound(_0x235a64,null))[_0xfb6e('0x22')](function(_0x5574f1){if(_0x5574f1){var _0x446902=_0x5574f1['get']({'plain':!![]});_0x446902=qs[_0xfb6e('0x53')](_0x446902,['id',_0xfb6e('0x54'),_0xfb6e('0x55')]);_0x105cca['body']=_['omit'](_0x105cca[_0xfb6e('0x48')],['id',_0xfb6e('0x54'),_0xfb6e('0x55')]);return db[_0xfb6e('0x41')][_0xfb6e('0x47')](_['merge'](_0x446902,_0x105cca['body']),{'include':_0x105cca[_0xfb6e('0x31')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4f4ef1){var _0x3c1820=_0x105cca['user'][_0xfb6e('0x4a')]({'plain':!![]});if(!_0x3c1820)throw new Error(_0xfb6e('0x4b'));if(_0x3c1820[_0xfb6e('0x4c')]==='user'){var _0x197e69=_0x4f4ef1[_0xfb6e('0x4a')]({'plain':!![]});var _0x125ec4=_0xfb6e('0x24');return db[_0xfb6e('0x56')][_0xfb6e('0x46')]({'where':{'name':_0x125ec4,'userProfileId':_0x3c1820[_0xfb6e('0x4d')]},'raw':!![]})[_0xfb6e('0x22')](function(_0x36bf86){if(_0x36bf86&&_0x36bf86['autoAssociation']===0x0){return db[_0xfb6e('0x25')][_0xfb6e('0x47')]({'name':_0x197e69[_0xfb6e('0x29')],'resourceId':_0x197e69['id'],'type':_0x36bf86['name'],'sectionId':_0x36bf86['id']},{})[_0xfb6e('0x22')](function(){return _0x4f4ef1;});}else{return _0x4f4ef1;}})[_0xfb6e('0x50')](function(_0x1843cb){logger[_0xfb6e('0x27')](_0xfb6e('0x4f'),_0x1843cb);throw _0x1843cb;});}return _0x4f4ef1;});}})[_0xfb6e('0x22')](respondWithResult(_0x235a64,0xc9))[_0xfb6e('0x50')](handleError(_0x235a64,null));};exports['update']=function(_0x22e9e2,_0x5e6b76){if(_0x22e9e2[_0xfb6e('0x48')]['id']){delete _0x22e9e2[_0xfb6e('0x48')]['id'];}return db['Dashboard'][_0xfb6e('0x46')]({'where':{'id':_0x22e9e2['params']['id']}})[_0xfb6e('0x22')](handleEntityNotFound(_0x5e6b76,null))[_0xfb6e('0x22')](saveUpdates(_0x22e9e2['body'],null))[_0xfb6e('0x22')](respondWithResult(_0x5e6b76,null))[_0xfb6e('0x50')](handleError(_0x5e6b76,null));};exports['destroy']=function(_0x2c12df,_0x4d1b02){return db[_0xfb6e('0x41')]['find']({'where':{'id':_0x2c12df[_0xfb6e('0x44')]['id']}})[_0xfb6e('0x22')](handleEntityNotFound(_0x4d1b02,null))['then'](removeEntity(_0x4d1b02,null))[_0xfb6e('0x50')](handleError(_0x4d1b02,null));};function widgetAttributes(_0x78d176){try{switch(_0x78d176[_0xfb6e('0x2e')]){case _0xfb6e('0x57'):return[{'name':_0xfb6e('0x58'),'value':_0x78d176[_0xfb6e('0x58')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176['attrs'][0x0]?_0x78d176[_0xfb6e('0x59')][0x0]['value']:undefined)||_0xfb6e('0x5a')}];case _0xfb6e('0x5b'):return[{'name':'attrPath','value':_0x78d176[_0xfb6e('0x5c')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x0]?_0x78d176[_0xfb6e('0x59')][0x0][_0xfb6e('0x5d')]:undefined)||''}];case'clock':return[{'name':_0xfb6e('0x5e'),'value':_0x78d176['attrHourFormat']||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x0]?_0x78d176[_0xfb6e('0x59')][0x0][_0xfb6e('0x5d')]:undefined)||_0xfb6e('0x5f')},{'name':_0xfb6e('0x60'),'value':_0x78d176[_0xfb6e('0x60')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x1]?_0x78d176['attrs'][0x1]['value']:undefined)||'0.00'},{'name':_0xfb6e('0x61'),'value':_0x78d176['attrFontSize']||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x2]?_0x78d176['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x78d176[_0xfb6e('0x62')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x0]?_0x78d176['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x78d176['attrVoiceQueues']||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x1]?_0x78d176[_0xfb6e('0x59')][0x1][_0xfb6e('0x5d')]:undefined)||[]},{'name':'attrFontSize','value':_0x78d176[_0xfb6e('0x61')]||(_0x78d176['attrs']&&_0x78d176['attrs'][0x2]?_0x78d176['attrs'][0x2][_0xfb6e('0x5d')]:undefined)||0x14}];case _0xfb6e('0x63'):case _0xfb6e('0x64'):return[{'name':_0xfb6e('0x65'),'value':_0x78d176[_0xfb6e('0x65')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176['attrs'][0x0]?_0x78d176[_0xfb6e('0x59')][0x0][_0xfb6e('0x5d')]:undefined)||'total'},{'name':_0xfb6e('0x66'),'value':_0x78d176[_0xfb6e('0x66')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x1]?_0x78d176['attrs'][0x1][_0xfb6e('0x5d')]:undefined)||null},{'name':_0xfb6e('0x67'),'value':_0x78d176['attrSerie3']||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x2]?_0x78d176[_0xfb6e('0x59')][0x2]['value']:undefined)||null},{'name':_0xfb6e('0x68'),'value':_0x78d176[_0xfb6e('0x68')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176[_0xfb6e('0x59')][0x3]?_0x78d176[_0xfb6e('0x59')][0x3][_0xfb6e('0x5d')]:undefined)||[]}];case _0xfb6e('0x69'):return[{'name':_0xfb6e('0x6a'),'type':_0x78d176[_0xfb6e('0x6b')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176['attrs'][0x0]?_0x78d176[_0xfb6e('0x59')][0x0]['type']:undefined)||null,'value':_0x78d176[_0xfb6e('0x6a')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176['attrs'][0x0]?_0x78d176[_0xfb6e('0x59')][0x0][_0xfb6e('0x5d')]:undefined)||null},{'name':_0xfb6e('0x6c'),'value':_0x78d176[_0xfb6e('0x6c')]||(_0x78d176[_0xfb6e('0x59')]&&_0x78d176['attrs'][0x1]?_0x78d176['attrs'][0x1][_0xfb6e('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x3884e6){logger[_0xfb6e('0x27')]('widgetAttributes:\x20%s',JSON[_0xfb6e('0x6d')](_0x3884e6));return[];}}exports['addItem']=function(_0x56fae2,_0x543863,_0x5a999c){if(_0x56fae2[_0xfb6e('0x48')]['id']){delete _0x56fae2[_0xfb6e('0x48')]['id'];}return db[_0xfb6e('0x41')]['find']({'where':{'id':_0x56fae2[_0xfb6e('0x44')]['id']}})[_0xfb6e('0x22')](handleEntityNotFound(_0x543863,null))[_0xfb6e('0x22')](function(_0x55e8a7){if(_0x55e8a7){_0x56fae2[_0xfb6e('0x48')][_0xfb6e('0x6e')]=_0x55e8a7['id'];_0x56fae2[_0xfb6e('0x48')][_0xfb6e('0x59')]=widgetAttributes(_0x56fae2[_0xfb6e('0x48')]);return db[_0xfb6e('0x6f')][_0xfb6e('0x47')](_0x56fae2['body']);}})[_0xfb6e('0x22')](respondWithResult(_0x543863,null))[_0xfb6e('0x50')](handleError(_0x543863,null));};exports[_0xfb6e('0x70')]=function(_0xf641a9,_0x436393,_0x45207f){var _0x29cdaf={};var _0x8a45e={};var _0xdaed1a;var _0xde65e6;return db[_0xfb6e('0x41')][_0xfb6e('0x71')]({'where':{'id':_0xf641a9[_0xfb6e('0x44')]['id']}})[_0xfb6e('0x22')](handleEntityNotFound(_0x436393,null))[_0xfb6e('0x22')](function(_0x4a4da7){if(_0x4a4da7){_0xdaed1a=_0x4a4da7;_0x8a45e[_0xfb6e('0x30')]=_[_0xfb6e('0x32')](db[_0xfb6e('0x6f')][_0xfb6e('0x2c')]);_0x8a45e[_0xfb6e('0x31')]=_[_0xfb6e('0x32')](_0xf641a9[_0xfb6e('0x31')]);_0x8a45e[_0xfb6e('0x33')]=_['intersection'](_0x8a45e[_0xfb6e('0x30')],_0x8a45e[_0xfb6e('0x31')]);_0x29cdaf[_0xfb6e('0x34')]=_[_0xfb6e('0x35')](_0x8a45e[_0xfb6e('0x30')],qs[_0xfb6e('0x36')](_0xf641a9[_0xfb6e('0x31')][_0xfb6e('0x36')]));_0x29cdaf[_0xfb6e('0x34')]=_0x29cdaf[_0xfb6e('0x34')][_0xfb6e('0x37')]?_0x29cdaf['attributes']:_0x8a45e[_0xfb6e('0x30')];_0x29cdaf[_0xfb6e('0x72')]=qs[_0xfb6e('0x3a')](_0xf641a9[_0xfb6e('0x31')][_0xfb6e('0x3a')]);_0x29cdaf[_0xfb6e('0x3b')]=qs[_0xfb6e('0x33')](_[_0xfb6e('0x3c')](_0xf641a9[_0xfb6e('0x31')],_0x8a45e['filters']));if(_0xf641a9[_0xfb6e('0x31')]['filter']){_0x29cdaf['where']=_[_0xfb6e('0x3e')](_0x29cdaf[_0xfb6e('0x3b')],{'$or':_[_0xfb6e('0x2b')](_0x29cdaf[_0xfb6e('0x34')],function(_0x10e667){var _0xf47bbf={};_0xf47bbf[_0x10e667]={'$like':'%'+_0xf641a9[_0xfb6e('0x31')][_0xfb6e('0x3d')]+'%'};return _0xf47bbf;})});}_0x29cdaf=_['merge']({},_0x29cdaf,_0xf641a9['options']);return _0xdaed1a[_0xfb6e('0x70')](_0x29cdaf);}})[_0xfb6e('0x22')](function(_0x489a8b){if(_0x489a8b){_0xde65e6=_0x489a8b[_0xfb6e('0x37')];if(!_0xf641a9['query'][_0xfb6e('0x38')](_0xfb6e('0x39'))){_0x29cdaf['limit']=qs[_0xfb6e('0x1e')](_0xf641a9[_0xfb6e('0x31')][_0xfb6e('0x1e')]);_0x29cdaf['offset']=qs['offset'](_0xf641a9['query'][_0xfb6e('0x1d')]);}return _0xdaed1a['getItems'](_0x29cdaf);}})['then'](function(_0x524da9){if(_0x524da9){return _0x524da9?{'count':_0xde65e6,'rows':_0x524da9}:null;}})['then'](respondWithResult(_0x436393,null))[_0xfb6e('0x50')](handleError(_0x436393,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 05225e7..5b3a8af 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 _0x007f=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','update'];(function(_0x520cff,_0x22088e){var _0x363eea=function(_0x3d9de7){while(--_0x3d9de7){_0x520cff['push'](_0x520cff['shift']());}};_0x363eea(++_0x22088e);}(_0x007f,0x124));var _0xf007=function(_0x3f06c7,_0xd58ada){_0x3f06c7=_0x3f06c7-0x0;var _0x4aa19f=_0x007f[_0x3f06c7];return _0x4aa19f;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xf007('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf007('0x1'),'afterDestroy':_0xf007('0x2')};function emitEvent(_0x48a6e5){return function(_0x4edb36,_0x39180e,_0x4721ac){DashboardEvents[_0xf007('0x3')](_0x48a6e5+':'+_0x4edb36['id'],_0x4edb36);DashboardEvents['emit'](_0x48a6e5,_0x4edb36);_0x4721ac(null);};}for(var e in events){if(events[_0xf007('0x4')](e)){var event=events[e];Dashboard[_0xf007('0x5')](e,emitEvent(event));}}module[_0xf007('0x6')]=DashboardEvents; \ No newline at end of file +var _0xd1ff=['hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','update','remove','emit'];(function(_0x197fe6,_0x5bd3b5){var _0xbb5f77=function(_0x164014){while(--_0x164014){_0x197fe6['push'](_0x197fe6['shift']());}};_0xbb5f77(++_0x5bd3b5);}(_0xd1ff,0x6f));var _0xfd1f=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xd1ff[_0x1d87fc];return _0x492b56;};'use strict';var EventEmitter=require(_0xfd1f('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xfd1f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfd1f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd1f('0x3'),'afterDestroy':_0xfd1f('0x4')};function emitEvent(_0x32ef2d){return function(_0x5c9d03,_0x172963,_0x2875ab){DashboardEvents['emit'](_0x32ef2d+':'+_0x5c9d03['id'],_0x5c9d03);DashboardEvents[_0xfd1f('0x5')](_0x32ef2d,_0x5c9d03);_0x2875ab(null);};}for(var e in events){if(events[_0xfd1f('0x6')](e)){var event=events[e];Dashboard[_0xfd1f('0x7')](e,emitEvent(event));}}module[_0xfd1f('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a3a745a..bee9a52 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 _0x6771=['exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x44e401,_0x242da7){var _0x267ab4=function(_0x270522){while(--_0x270522){_0x44e401['push'](_0x44e401['shift']());}};_0x267ab4(++_0x242da7);}(_0x6771,0x1b1));var _0x1677=function(_0x57ef04,_0x2216c0){_0x57ef04=_0x57ef04-0x0;var _0x24b17f=_0x6771[_0x57ef04];return _0x24b17f;};'use strict';var _=require(_0x1677('0x0'));var util=require(_0x1677('0x1'));var logger=require(_0x1677('0x2'))(_0x1677('0x3'));var moment=require(_0x1677('0x4'));var BPromise=require(_0x1677('0x5'));var rp=require(_0x1677('0x6'));var fs=require('fs');var path=require(_0x1677('0x7'));var rimraf=require('rimraf');var config=require(_0x1677('0x8'));var attributes=require('./dashboard.attributes');module[_0x1677('0x9')]=function(_0x5cffb7,_0x2e22a0){return _0x5cffb7[_0x1677('0xa')](_0x1677('0xb'),attributes,{'tableName':_0x1677('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb7e=['request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','lodash','api'];(function(_0x3bed08,_0x1792f9){var _0x348729=function(_0x257891){while(--_0x257891){_0x3bed08['push'](_0x3bed08['shift']());}};_0x348729(++_0x1792f9);}(_0xbb7e,0xe8));var _0xebb7=function(_0x3040f2,_0x41c98d){_0x3040f2=_0x3040f2-0x0;var _0x4955de=_0xbb7e[_0x3040f2];return _0x4955de;};'use strict';var _=require(_0xebb7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xebb7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xebb7('0x2'));var fs=require('fs');var path=require(_0xebb7('0x3'));var rimraf=require(_0xebb7('0x4'));var config=require(_0xebb7('0x5'));var attributes=require(_0xebb7('0x6'));module[_0xebb7('0x7')]=function(_0x16da84,_0x3913c2){return _0x16da84[_0xebb7('0x8')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8023489..e2626e0 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 _0x9e56=['request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','./dashboard.socket','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9e56,0x1cf));var _0x69e5=function(_0xfa3280,_0x42246f){_0xfa3280=_0xfa3280-0x0;var _0x1d6b04=_0x9e56[_0xfa3280];return _0x1d6b04;};'use strict';var _=require(_0x69e5('0x0'));var util=require('util');var moment=require(_0x69e5('0x1'));var BPromise=require(_0x69e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69e5('0x3'));var db=require(_0x69e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x69e5('0x5'))('rpc');var config=require(_0x69e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x69e5('0x7')]['http']({'port':0x232a});config[_0x69e5('0x8')]=_[_0x69e5('0x9')](config[_0x69e5('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x69e5('0x8')]));require(_0x69e5('0xa'))[_0x69e5('0xb')](socket);function respondWithRpcPromise(_0x387e41,_0x34f023,_0x1099fb){return new BPromise(function(_0x5334e9,_0x1debd2){return client[_0x69e5('0xc')](_0x387e41,_0x1099fb)[_0x69e5('0xd')](function(_0xd503d5){logger[_0x69e5('0xe')](_0x69e5('0xf'),_0x34f023,_0x69e5('0x10'));logger[_0x69e5('0x11')](_0x69e5('0x12'),_0x34f023,_0x69e5('0x10'),JSON[_0x69e5('0x13')](_0xd503d5));if(_0xd503d5[_0x69e5('0x14')]){if(_0xd503d5[_0x69e5('0x14')][_0x69e5('0x15')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x34f023,_0xd503d5[_0x69e5('0x14')]['message']);return _0x1debd2(_0xd503d5[_0x69e5('0x14')]['message']);}logger[_0x69e5('0x14')](_0x69e5('0xf'),_0x34f023,_0xd503d5[_0x69e5('0x14')][_0x69e5('0x16')]);return _0x5334e9(_0xd503d5[_0x69e5('0x14')][_0x69e5('0x16')]);}else{logger[_0x69e5('0xe')](_0x69e5('0xf'),_0x34f023,_0x69e5('0x10'));_0x5334e9(_0xd503d5[_0x69e5('0x17')]['message']);}})[_0x69e5('0x18')](function(_0x5279cb){logger[_0x69e5('0x14')](_0x69e5('0xf'),_0x34f023,_0x5279cb);_0x1debd2(_0x5279cb);});});} \ No newline at end of file +var _0xed87=['debug','stringify','code','Dashboard,\x20%s,\x20%s','message','error','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xed87,0xfa));var _0x7ed8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xed87[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7ed8('0x0'));var util=require(_0x7ed8('0x1'));var moment=require(_0x7ed8('0x2'));var BPromise=require(_0x7ed8('0x3'));var rs=require(_0x7ed8('0x4'));var fs=require('fs');var Redis=require(_0x7ed8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ed8('0x6'));var logger=require(_0x7ed8('0x7'))(_0x7ed8('0x8'));var config=require(_0x7ed8('0x9'));var jayson=require(_0x7ed8('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x7ed8('0xb')]=_['defaults'](config['redis'],{'host':_0x7ed8('0xc'),'port':0x18eb});var socket=require(_0x7ed8('0xd'))(new Redis(config[_0x7ed8('0xb')]));require(_0x7ed8('0xe'))[_0x7ed8('0xf')](socket);function respondWithRpcPromise(_0x288ce7,_0x47e568,_0x583076){return new BPromise(function(_0x35667a,_0x3d7f05){return client[_0x7ed8('0x10')](_0x288ce7,_0x583076)[_0x7ed8('0x11')](function(_0x2f383c){logger[_0x7ed8('0x12')]('Dashboard,\x20%s,\x20%s',_0x47e568,_0x7ed8('0x13'));logger[_0x7ed8('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x47e568,_0x7ed8('0x13'),JSON[_0x7ed8('0x15')](_0x2f383c));if(_0x2f383c['error']){if(_0x2f383c['error'][_0x7ed8('0x16')]===0x1f4){logger['error'](_0x7ed8('0x17'),_0x47e568,_0x2f383c['error'][_0x7ed8('0x18')]);return _0x3d7f05(_0x2f383c[_0x7ed8('0x19')][_0x7ed8('0x18')]);}logger[_0x7ed8('0x19')](_0x7ed8('0x17'),_0x47e568,_0x2f383c[_0x7ed8('0x19')][_0x7ed8('0x18')]);return _0x35667a(_0x2f383c['error'][_0x7ed8('0x18')]);}else{logger[_0x7ed8('0x12')](_0x7ed8('0x17'),_0x47e568,_0x7ed8('0x13'));_0x35667a(_0x2f383c[_0x7ed8('0x1a')][_0x7ed8('0x18')]);}})['catch'](function(_0x3b0bd6){logger[_0x7ed8('0x19')]('Dashboard,\x20%s,\x20%s',_0x47e568,_0x3b0bd6);_0x3d7f05(_0x3b0bd6);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index f51a5c4..ff854ad 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 _0x35eb=['length','dashboard:','remove','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35eb,0xc5));var _0xb35e=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x35eb[_0x616290];return _0x453879;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xb35e('0x0'),'update'];function createListener(_0x38a4b9,_0x64882){return function(_0xa343d8){_0x64882['emit'](_0x38a4b9,_0xa343d8);};}function removeListener(_0x46baca,_0x157397){return function(){DashboardEvents[_0xb35e('0x1')](_0x46baca,_0x157397);};}exports[_0xb35e('0x2')]=function(_0x14496c){for(var _0x3108cd=0x0,_0x54c5d9=events[_0xb35e('0x3')];_0x3108cd<_0x54c5d9;_0x3108cd++){var _0x4798ba=events[_0x3108cd];var _0x3dc910=createListener(_0xb35e('0x4')+_0x4798ba,_0x14496c);DashboardEvents['on'](_0x4798ba,_0x3dc910);}}; \ No newline at end of file +var _0xb1c5=['remove','update','emit','removeListener'];(function(_0x139b2e,_0x53f096){var _0x39e832=function(_0x3442b7){while(--_0x3442b7){_0x139b2e['push'](_0x139b2e['shift']());}};_0x39e832(++_0x53f096);}(_0xb1c5,0x88));var _0x5b1c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xb1c5[_0x57b54c];return _0x59cc19;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x5b1c('0x0'),_0x5b1c('0x1')];function createListener(_0x28ab0e,_0xe3e828){return function(_0x137351){_0xe3e828[_0x5b1c('0x2')](_0x28ab0e,_0x137351);};}function removeListener(_0x51b9f5,_0x31a044){return function(){DashboardEvents[_0x5b1c('0x3')](_0x51b9f5,_0x31a044);};}exports['register']=function(_0x431d7d){for(var _0x318a03=0x0,_0x743cd8=events['length'];_0x318a03<_0x743cd8;_0x318a03++){var _0x33d87d=events[_0x318a03];var _0x32086a=createListener('dashboard:'+_0x33d87d,_0x431d7d);DashboardEvents['on'](_0x33d87d,_0x32086a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e49bfb1..60791ca 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 _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(_0x4941bc,_0x199598){var _0xf3862d=function(_0x7bdbd5){while(--_0x7bdbd5){_0x4941bc['push'](_0x4941bc['shift']());}};_0xf3862d(++_0x199598);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0xcb91[_0x5d9867];return _0x7d2118;};'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 +var _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0xb7e7,0x121));var _0x7b7e=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xb7e7[_0x68ee8b];return _0x5148f7;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 9968b85..f7fe721 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 _0x0a88=['#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x4b7fee,_0x13b72b){var _0x32b162=function(_0xf69652){while(--_0xf69652){_0x4b7fee['push'](_0x4b7fee['shift']());}};_0x32b162(++_0x13b72b);}(_0x0a88,0x1f0));var _0x80a8=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x0a88[_0x4e9d3c];return _0x2d0825;};'use strict';var Sequelize=require(_0x80a8('0x0'));var squel=require(_0x80a8('0x1'));var _=require(_0x80a8('0x2'));module[_0x80a8('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x80a8('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x80a8('0x5')](_0x80a8('0x6')),'get':function(){try{return JSON[_0x80a8('0x7')](this[_0x80a8('0x8')](_0x80a8('0x9')));}catch(_0xe9c051){return[];}},'set':function(_0x2f8013){try{this[_0x80a8('0xa')](_0x80a8('0x9'),JSON[_0x80a8('0xb')](_0x2f8013));}catch(_0x44d706){this[_0x80a8('0xa')](_0x80a8('0x9'),JSON[_0x80a8('0xb')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x80a8('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x80a8('0xc')]},'col':{'type':Sequelize[_0x80a8('0xc')]},'background':{'type':Sequelize[_0x80a8('0x4')],'allowNull':![],'defaultValue':_0x80a8('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x80a8('0x4')],'allowNull':![],'defaultValue':_0x80a8('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x80a8('0x4')]}}; \ No newline at end of file +var _0x3951=['attrs','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','long','parse','setDataValue','stringify'];(function(_0x22f276,_0x11a99e){var _0x32e4c5=function(_0x765777){while(--_0x765777){_0x22f276['push'](_0x22f276['shift']());}};_0x32e4c5(++_0x11a99e);}(_0x3951,0xe1));var _0x1395=function(_0x52acf2,_0x494d05){_0x52acf2=_0x52acf2-0x0;var _0x44d097=_0x3951[_0x52acf2];return _0x44d097;};'use strict';var Sequelize=require(_0x1395('0x0'));var squel=require('squel');var _=require(_0x1395('0x1'));module[_0x1395('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1395('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x1395('0x4')](_0x1395('0x5')),'get':function(){try{return JSON[_0x1395('0x6')](this['getDataValue']('attrs'));}catch(_0x2c011f){return[];}},'set':function(_0x390fac){try{this[_0x1395('0x7')]('attrs',JSON[_0x1395('0x8')](_0x390fac));}catch(_0x5ad95c){this[_0x1395('0x7')](_0x1395('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x1395('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x1395('0xa')]},'background':{'type':Sequelize[_0x1395('0x3')],'allowNull':![],'defaultValue':_0x1395('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x1395('0x3')],'allowNull':![],'defaultValue':_0x1395('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x1395('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 7549940..ce780aa 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 _0xda23=['attrSerie1','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','catch','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','register','status','end','count','offset','limit','set','Content-Range','json','apply','update','destroy','then','sendStatus','error','name','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart'];(function(_0x3ea3ae,_0x29dd29){var _0x2aa587=function(_0x1d6dca){while(--_0x1d6dca){_0x3ea3ae['push'](_0x3ea3ae['shift']());}};_0x2aa587(++_0x29dd29);}(_0xda23,0x148));var _0x3da2=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xda23[_0x164eca];return _0x2ce562;};'use strict';var pdf=require(_0x3da2('0x0'));var emlformat=require(_0x3da2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3da2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3da2('0x3'));var Mustache=require(_0x3da2('0x4'));var util=require(_0x3da2('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x3da2('0x6'));var ejs=require(_0x3da2('0x7'));var fs=require('fs');var _=require(_0x3da2('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3da2('0x9'));var toCsv=require(_0x3da2('0x6'));var querystring=require(_0x3da2('0xa'));var Papa=require(_0x3da2('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3da2('0xc'));var as=require(_0x3da2('0xd'));var hardwareService=require(_0x3da2('0xe'));var logger=require(_0x3da2('0xf'))(_0x3da2('0x10'));var utils=require(_0x3da2('0x11'));var config=require('../../config/environment');var db=require(_0x3da2('0x12'))['db'];config[_0x3da2('0x13')]=_[_0x3da2('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3da2('0x13')]));require('./dashboardItem.socket')[_0x3da2('0x15')](socket);function respondWithStatusCode(_0x2cd848,_0x128559){_0x128559=_0x128559||0xcc;return function(_0x16c07a){if(_0x16c07a){return _0x2cd848['sendStatus'](_0x128559);}return _0x2cd848[_0x3da2('0x16')](_0x128559)[_0x3da2('0x17')]();};}function respondWithResult(_0x2a254c,_0x29c100){_0x29c100=_0x29c100||0xc8;return function(_0x23482b){if(_0x23482b){return _0x2a254c[_0x3da2('0x16')](_0x29c100)['json'](_0x23482b);}};}function respondWithFilteredResult(_0x378af0,_0x339bf0){return function(_0x2f1f95){if(_0x2f1f95){var _0x483eba=_0x2f1f95[_0x3da2('0x18')],_0x59fa87=_0x339bf0[_0x3da2('0x19')],_0x47e196=_0x339bf0[_0x3da2('0x19')]+_0x339bf0[_0x3da2('0x1a')],_0x2c2cca;if(_0x47e196>=_0x483eba){_0x47e196=_0x483eba;_0x2c2cca=0xc8;}else{_0x2c2cca=0xce;}_0x378af0[_0x3da2('0x16')](_0x2c2cca);return _0x378af0[_0x3da2('0x1b')](_0x3da2('0x1c'),_0x59fa87+'-'+_0x47e196+'/'+_0x483eba)[_0x3da2('0x1d')](_0x2f1f95);}return null;};}function patchUpdates(_0x3ede8a){return function(_0x40e4c7){try{jsonpatch[_0x3da2('0x1e')](_0x40e4c7,_0x3ede8a,!![]);}catch(_0x10b644){return BPromise['reject'](_0x10b644);}return _0x40e4c7['save']();};}function saveUpdates(_0x13ce0f,_0x28665d){return function(_0x4e17e3){if(_0x4e17e3){return _0x4e17e3[_0x3da2('0x1f')](_0x13ce0f)['then'](function(_0x532924){return _0x532924;});}return null;};}function removeEntity(_0x1cfacc,_0x1e0dcb){return function(_0x56a31e){if(_0x56a31e){return _0x56a31e[_0x3da2('0x20')]()[_0x3da2('0x21')](function(){_0x1cfacc[_0x3da2('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d63a3,_0x2c1ff1){return function(_0x54598d){if(!_0x54598d){_0x3d63a3[_0x3da2('0x22')](0x194);}return _0x54598d;};}function handleError(_0x1d5d99,_0x5212da){_0x5212da=_0x5212da||0x1f4;return function(_0xbc8c01){logger[_0x3da2('0x23')](_0xbc8c01['stack']);if(_0xbc8c01['name']){delete _0xbc8c01[_0x3da2('0x24')];}_0x1d5d99[_0x3da2('0x16')](_0x5212da)['send'](_0xbc8c01);};}exports['show']=function(_0x1e957d,_0x46c8b8){var _0x165eba={'raw':![],'where':{'id':_0x1e957d[_0x3da2('0x25')]['id']}},_0x21a4ca={};_0x21a4ca[_0x3da2('0x26')]=_[_0x3da2('0x27')](db[_0x3da2('0x28')][_0x3da2('0x29')]);_0x21a4ca[_0x3da2('0x2a')]=_[_0x3da2('0x27')](_0x1e957d[_0x3da2('0x2a')]);_0x21a4ca['filters']=_[_0x3da2('0x2b')](_0x21a4ca['model'],_0x21a4ca['query']);_0x165eba[_0x3da2('0x2c')]=_['intersection'](_0x21a4ca[_0x3da2('0x26')],qs['fields'](_0x1e957d[_0x3da2('0x2a')][_0x3da2('0x2d')]));_0x165eba[_0x3da2('0x2c')]=_0x165eba[_0x3da2('0x2c')][_0x3da2('0x2e')]?_0x165eba['attributes']:_0x21a4ca[_0x3da2('0x26')];if(_0x1e957d[_0x3da2('0x2a')][_0x3da2('0x2f')]){_0x165eba[_0x3da2('0x30')]=[{'all':!![]}];}_0x165eba=_[_0x3da2('0x31')]({},_0x165eba,_0x1e957d[_0x3da2('0x32')]);return db[_0x3da2('0x28')][_0x3da2('0x33')](_0x165eba)[_0x3da2('0x21')](handleEntityNotFound(_0x46c8b8,null))['then'](respondWithResult(_0x46c8b8,null))['catch'](handleError(_0x46c8b8,null));};exports[_0x3da2('0x20')]=function(_0x164d57,_0x15ff90){return db['DashboardItem'][_0x3da2('0x33')]({'where':{'id':_0x164d57[_0x3da2('0x25')]['id']}})['then'](handleEntityNotFound(_0x15ff90,null))['then'](removeEntity(_0x15ff90,null))['catch'](handleError(_0x15ff90,null));};function widgetAttributes(_0x217e81){try{switch(_0x217e81['type']){case'iframe':return[{'name':_0x3da2('0x34'),'value':_0x217e81[_0x3da2('0x34')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x0]?_0x217e81['attrs'][0x0][_0x3da2('0x36')]:undefined)||'https://'}];case _0x3da2('0x37'):return[{'name':_0x3da2('0x38'),'value':_0x217e81[_0x3da2('0x38')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x0]?_0x217e81['attrs'][0x0][_0x3da2('0x36')]:undefined)||''}];case _0x3da2('0x39'):return[{'name':_0x3da2('0x3a'),'value':_0x217e81['attrHourFormat']||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x0]?_0x217e81[_0x3da2('0x35')][0x0]['value']:undefined)||_0x3da2('0x3b')},{'name':'attrTimezone','value':_0x217e81[_0x3da2('0x3c')]||(_0x217e81['attrs']&&_0x217e81[_0x3da2('0x35')][0x1]?_0x217e81[_0x3da2('0x35')][0x1]['value']:undefined)||_0x3da2('0x3d')},{'name':_0x3da2('0x3e'),'value':_0x217e81[_0x3da2('0x3e')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x2]?_0x217e81[_0x3da2('0x35')][0x2][_0x3da2('0x36')]:undefined)||0xc}];case _0x3da2('0x3f'):return[{'name':_0x3da2('0x40'),'value':_0x217e81[_0x3da2('0x40')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x0]?_0x217e81[_0x3da2('0x35')][0x0][_0x3da2('0x36')]:undefined)||'total'},{'name':_0x3da2('0x41'),'value':_0x217e81[_0x3da2('0x41')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x1]?_0x217e81['attrs'][0x1]['value']:undefined)||[]},{'name':_0x3da2('0x3e'),'value':_0x217e81['attrFontSize']||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x2]?_0x217e81[_0x3da2('0x35')][0x2][_0x3da2('0x36')]:undefined)||0x14}];case _0x3da2('0x42'):case'pie-chart':return[{'name':_0x3da2('0x43'),'value':_0x217e81[_0x3da2('0x43')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x0]?_0x217e81[_0x3da2('0x35')][0x0]['value']:undefined)||'total'},{'name':_0x3da2('0x44'),'value':_0x217e81[_0x3da2('0x44')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x1]?_0x217e81[_0x3da2('0x35')][0x1][_0x3da2('0x36')]:undefined)||null},{'name':_0x3da2('0x45'),'value':_0x217e81[_0x3da2('0x45')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81['attrs'][0x2]?_0x217e81['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x217e81[_0x3da2('0x41')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x3]?_0x217e81[_0x3da2('0x35')][0x3]['value']:undefined)||[]}];case _0x3da2('0x46'):return[{'name':'attrReport','type':_0x217e81[_0x3da2('0x47')]||(_0x217e81[_0x3da2('0x35')]&&_0x217e81[_0x3da2('0x35')][0x0]?_0x217e81[_0x3da2('0x35')][0x0][_0x3da2('0x48')]:undefined)||null,'value':_0x217e81[_0x3da2('0x49')]||(_0x217e81['attrs']&&_0x217e81[_0x3da2('0x35')][0x0]?_0x217e81[_0x3da2('0x35')][0x0][_0x3da2('0x36')]:undefined)||null},{'name':_0x3da2('0x4a'),'value':_0x217e81[_0x3da2('0x4a')]||(_0x217e81['attrs']&&_0x217e81[_0x3da2('0x35')][0x1]?_0x217e81[_0x3da2('0x35')][0x1][_0x3da2('0x36')]:undefined)||0x0}];default:return[];}}catch(_0x45cc85){logger[_0x3da2('0x23')](_0x3da2('0x4b'),JSON['stringify'](_0x45cc85));return[];}}exports[_0x3da2('0x4c')]=function(_0x1a2149,_0x2638cc){if(_0x1a2149['body']){_0x1a2149['body']['attrs']=widgetAttributes(_0x1a2149['body']);}return db[_0x3da2('0x28')]['create'](_0x1a2149[_0x3da2('0x4d')],{})[_0x3da2('0x21')](respondWithResult(_0x2638cc,0xc9))['catch'](handleError(_0x2638cc,null));};exports[_0x3da2('0x1f')]=function(_0x45543a,_0x10f11a){if(_0x45543a['body']['id']){delete _0x45543a[_0x3da2('0x4d')]['id'];}_0x45543a[_0x3da2('0x4d')][_0x3da2('0x35')]=widgetAttributes(_0x45543a['body']);return db[_0x3da2('0x28')][_0x3da2('0x33')]({'where':{'id':_0x45543a['params']['id']}})[_0x3da2('0x21')](handleEntityNotFound(_0x10f11a,null))[_0x3da2('0x21')](saveUpdates(_0x45543a[_0x3da2('0x4d')],null))[_0x3da2('0x21')](respondWithResult(_0x10f11a,null))[_0x3da2('0x4e')](handleError(_0x10f11a,null));}; \ No newline at end of file +var _0xba1d=['attrVoiceQueues','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','body','create','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','limit','Content-Range','apply','reject','update','then','error','stack','name','send','show','model','keys','rawAttributes','query','filters','attributes','intersection','length','includeAll','merge','options','DashboardItem','find','params','catch','type','iframe','attrUrl','attrs','https://','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total'];(function(_0x18b12c,_0x5ecc39){var _0x396258=function(_0x1992fc){while(--_0x1992fc){_0x18b12c['push'](_0x18b12c['shift']());}};_0x396258(++_0x5ecc39);}(_0xba1d,0x10d));var _0xdba1=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0xba1d[_0x34bd34];return _0x4e36d6;};'use strict';var pdf=require(_0xdba1('0x0'));var emlformat=require(_0xdba1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdba1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdba1('0x3'));var BPromise=require(_0xdba1('0x4'));var Mustache=require('mustache');var util=require(_0xdba1('0x5'));var path=require(_0xdba1('0x6'));var sox=require(_0xdba1('0x7'));var csv=require('to-csv');var ejs=require(_0xdba1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdba1('0x9'));var crypto=require(_0xdba1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdba1('0xb'));var toCsv=require(_0xdba1('0xc'));var querystring=require(_0xdba1('0xd'));var Papa=require(_0xdba1('0xe'));var Redis=require(_0xdba1('0xf'));var authService=require(_0xdba1('0x10'));var qs=require(_0xdba1('0x11'));var as=require(_0xdba1('0x12'));var hardwareService=require(_0xdba1('0x13'));var logger=require(_0xdba1('0x14'))(_0xdba1('0x15'));var utils=require('../../config/utils');var config=require(_0xdba1('0x16'));var db=require(_0xdba1('0x17'))['db'];config['redis']=_[_0xdba1('0x18')](config[_0xdba1('0x19')],{'host':_0xdba1('0x1a'),'port':0x18eb});var socket=require(_0xdba1('0x1b'))(new Redis(config[_0xdba1('0x19')]));require(_0xdba1('0x1c'))[_0xdba1('0x1d')](socket);function respondWithStatusCode(_0x3018f3,_0x27bc34){_0x27bc34=_0x27bc34||0xcc;return function(_0x5d2827){if(_0x5d2827){return _0x3018f3['sendStatus'](_0x27bc34);}return _0x3018f3[_0xdba1('0x1e')](_0x27bc34)[_0xdba1('0x1f')]();};}function respondWithResult(_0xfd9a8f,_0x4214d6){_0x4214d6=_0x4214d6||0xc8;return function(_0x17fc7e){if(_0x17fc7e){return _0xfd9a8f[_0xdba1('0x1e')](_0x4214d6)[_0xdba1('0x20')](_0x17fc7e);}};}function respondWithFilteredResult(_0x92afc2,_0x145d83){return function(_0x2c2e1d){if(_0x2c2e1d){var _0x32ac7f=_0x2c2e1d['count'],_0xd51172=_0x145d83[_0xdba1('0x21')],_0x43d2b9=_0x145d83[_0xdba1('0x21')]+_0x145d83[_0xdba1('0x22')],_0x258bbe;if(_0x43d2b9>=_0x32ac7f){_0x43d2b9=_0x32ac7f;_0x258bbe=0xc8;}else{_0x258bbe=0xce;}_0x92afc2['status'](_0x258bbe);return _0x92afc2['set'](_0xdba1('0x23'),_0xd51172+'-'+_0x43d2b9+'/'+_0x32ac7f)[_0xdba1('0x20')](_0x2c2e1d);}return null;};}function patchUpdates(_0x5cfaff){return function(_0x46d04c){try{jsonpatch[_0xdba1('0x24')](_0x46d04c,_0x5cfaff,!![]);}catch(_0x659e02){return BPromise[_0xdba1('0x25')](_0x659e02);}return _0x46d04c['save']();};}function saveUpdates(_0x49b9f8,_0x421a68){return function(_0x296d55){if(_0x296d55){return _0x296d55[_0xdba1('0x26')](_0x49b9f8)[_0xdba1('0x27')](function(_0x29bf3f){return _0x29bf3f;});}return null;};}function removeEntity(_0x2002fc,_0x2dc207){return function(_0x537a7f){if(_0x537a7f){return _0x537a7f['destroy']()['then'](function(){_0x2002fc[_0xdba1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3181a2,_0x5993e3){return function(_0x1ad8cc){if(!_0x1ad8cc){_0x3181a2['sendStatus'](0x194);}return _0x1ad8cc;};}function handleError(_0x3434b9,_0x1942ae){_0x1942ae=_0x1942ae||0x1f4;return function(_0x204274){logger[_0xdba1('0x28')](_0x204274[_0xdba1('0x29')]);if(_0x204274[_0xdba1('0x2a')]){delete _0x204274[_0xdba1('0x2a')];}_0x3434b9[_0xdba1('0x1e')](_0x1942ae)[_0xdba1('0x2b')](_0x204274);};}exports[_0xdba1('0x2c')]=function(_0x593d87,_0x2234a4){var _0x18ad18={'raw':![],'where':{'id':_0x593d87['params']['id']}},_0xfc6c2b={};_0xfc6c2b[_0xdba1('0x2d')]=_[_0xdba1('0x2e')](db['DashboardItem'][_0xdba1('0x2f')]);_0xfc6c2b[_0xdba1('0x30')]=_[_0xdba1('0x2e')](_0x593d87[_0xdba1('0x30')]);_0xfc6c2b[_0xdba1('0x31')]=_['intersection'](_0xfc6c2b[_0xdba1('0x2d')],_0xfc6c2b[_0xdba1('0x30')]);_0x18ad18[_0xdba1('0x32')]=_[_0xdba1('0x33')](_0xfc6c2b[_0xdba1('0x2d')],qs['fields'](_0x593d87[_0xdba1('0x30')]['fields']));_0x18ad18['attributes']=_0x18ad18[_0xdba1('0x32')][_0xdba1('0x34')]?_0x18ad18[_0xdba1('0x32')]:_0xfc6c2b[_0xdba1('0x2d')];if(_0x593d87[_0xdba1('0x30')][_0xdba1('0x35')]){_0x18ad18['include']=[{'all':!![]}];}_0x18ad18=_[_0xdba1('0x36')]({},_0x18ad18,_0x593d87[_0xdba1('0x37')]);return db[_0xdba1('0x38')][_0xdba1('0x39')](_0x18ad18)[_0xdba1('0x27')](handleEntityNotFound(_0x2234a4,null))[_0xdba1('0x27')](respondWithResult(_0x2234a4,null))['catch'](handleError(_0x2234a4,null));};exports['destroy']=function(_0x51622f,_0x2555e8){return db[_0xdba1('0x38')][_0xdba1('0x39')]({'where':{'id':_0x51622f[_0xdba1('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2555e8,null))['then'](removeEntity(_0x2555e8,null))[_0xdba1('0x3b')](handleError(_0x2555e8,null));};function widgetAttributes(_0x193963){try{switch(_0x193963[_0xdba1('0x3c')]){case _0xdba1('0x3d'):return[{'name':'attrUrl','value':_0x193963[_0xdba1('0x3e')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963[_0xdba1('0x3f')][0x0]?_0x193963['attrs'][0x0]['value']:undefined)||_0xdba1('0x40')}];case'custom':return[{'name':'attrPath','value':_0x193963['attrPath']||(_0x193963[_0xdba1('0x3f')]&&_0x193963['attrs'][0x0]?_0x193963[_0xdba1('0x3f')][0x0][_0xdba1('0x41')]:undefined)||''}];case _0xdba1('0x42'):return[{'name':_0xdba1('0x43'),'value':_0x193963[_0xdba1('0x43')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963[_0xdba1('0x3f')][0x0]?_0x193963['attrs'][0x0][_0xdba1('0x41')]:undefined)||_0xdba1('0x44')},{'name':_0xdba1('0x45'),'value':_0x193963[_0xdba1('0x45')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963[_0xdba1('0x3f')][0x1]?_0x193963[_0xdba1('0x3f')][0x1]['value']:undefined)||_0xdba1('0x46')},{'name':_0xdba1('0x47'),'value':_0x193963[_0xdba1('0x47')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963[_0xdba1('0x3f')][0x2]?_0x193963[_0xdba1('0x3f')][0x2][_0xdba1('0x41')]:undefined)||0xc}];case _0xdba1('0x48'):return[{'name':_0xdba1('0x49'),'value':_0x193963[_0xdba1('0x49')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963[_0xdba1('0x3f')][0x0]?_0x193963[_0xdba1('0x3f')][0x0][_0xdba1('0x41')]:undefined)||_0xdba1('0x4a')},{'name':_0xdba1('0x4b'),'value':_0x193963[_0xdba1('0x4b')]||(_0x193963['attrs']&&_0x193963[_0xdba1('0x3f')][0x1]?_0x193963[_0xdba1('0x3f')][0x1][_0xdba1('0x41')]:undefined)||[]},{'name':_0xdba1('0x47'),'value':_0x193963[_0xdba1('0x47')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963['attrs'][0x2]?_0x193963[_0xdba1('0x3f')][0x2][_0xdba1('0x41')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xdba1('0x4c'),'value':_0x193963[_0xdba1('0x4c')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963[_0xdba1('0x3f')][0x0]?_0x193963[_0xdba1('0x3f')][0x0][_0xdba1('0x41')]:undefined)||_0xdba1('0x4a')},{'name':_0xdba1('0x4d'),'value':_0x193963[_0xdba1('0x4d')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963['attrs'][0x1]?_0x193963[_0xdba1('0x3f')][0x1][_0xdba1('0x41')]:undefined)||null},{'name':'attrSerie3','value':_0x193963[_0xdba1('0x4e')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963[_0xdba1('0x3f')][0x2]?_0x193963[_0xdba1('0x3f')][0x2][_0xdba1('0x41')]:undefined)||null},{'name':_0xdba1('0x4b'),'value':_0x193963[_0xdba1('0x4b')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963['attrs'][0x3]?_0x193963[_0xdba1('0x3f')][0x3][_0xdba1('0x41')]:undefined)||[]}];case _0xdba1('0x4f'):return[{'name':_0xdba1('0x50'),'type':_0x193963[_0xdba1('0x51')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963['attrs'][0x0]?_0x193963['attrs'][0x0]['type']:undefined)||null,'value':_0x193963['attrReport']||(_0x193963['attrs']&&_0x193963[_0xdba1('0x3f')][0x0]?_0x193963['attrs'][0x0]['value']:undefined)||null},{'name':_0xdba1('0x52'),'value':_0x193963[_0xdba1('0x52')]||(_0x193963[_0xdba1('0x3f')]&&_0x193963[_0xdba1('0x3f')][0x1]?_0x193963[_0xdba1('0x3f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x53f901){logger[_0xdba1('0x28')]('widgetAttributes:\x20%s',JSON[_0xdba1('0x53')](_0x53f901));return[];}}exports['create']=function(_0x586509,_0x5b2adf){if(_0x586509['body']){_0x586509[_0xdba1('0x54')][_0xdba1('0x3f')]=widgetAttributes(_0x586509[_0xdba1('0x54')]);}return db[_0xdba1('0x38')][_0xdba1('0x55')](_0x586509['body'],{})[_0xdba1('0x27')](respondWithResult(_0x5b2adf,0xc9))[_0xdba1('0x3b')](handleError(_0x5b2adf,null));};exports[_0xdba1('0x26')]=function(_0x15d6b2,_0x3ea971){if(_0x15d6b2['body']['id']){delete _0x15d6b2[_0xdba1('0x54')]['id'];}_0x15d6b2[_0xdba1('0x54')][_0xdba1('0x3f')]=widgetAttributes(_0x15d6b2[_0xdba1('0x54')]);return db[_0xdba1('0x38')][_0xdba1('0x39')]({'where':{'id':_0x15d6b2[_0xdba1('0x3a')]['id']}})[_0xdba1('0x27')](handleEntityNotFound(_0x3ea971,null))['then'](saveUpdates(_0x15d6b2[_0xdba1('0x54')],null))[_0xdba1('0x27')](respondWithResult(_0x3ea971,null))[_0xdba1('0x3b')](handleError(_0x3ea971,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index e2c1e41..0a18d97 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 _0x3b2e=['../../mysqldb','DashboardItem','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0xa5e821,_0x4dd2f6){var _0x62d0cd=function(_0x119f86){while(--_0x119f86){_0xa5e821['push'](_0xa5e821['shift']());}};_0x62d0cd(++_0x4dd2f6);}(_0x3b2e,0x10a));var _0xe3b2=function(_0x2d321f,_0x196439){_0x2d321f=_0x2d321f-0x0;var _0x16744f=_0x3b2e[_0x2d321f];return _0x16744f;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xe3b2('0x0'))['db'][_0xe3b2('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe3b2('0x2')](0x0);var events={'afterCreate':_0xe3b2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x397f0d){return function(_0x3c8da4,_0x4b2fa9,_0xfe5995){DashboardItemEvents[_0xe3b2('0x4')](_0x397f0d+':'+_0x3c8da4['id'],_0x3c8da4);DashboardItemEvents[_0xe3b2('0x4')](_0x397f0d,_0x3c8da4);_0xfe5995(null);};}for(var e in events){if(events[_0xe3b2('0x5')](e)){var event=events[e];DashboardItem[_0xe3b2('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x905c=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0x905c,0x14e));var _0xc905=function(_0x553dab,_0x4beef7){_0x553dab=_0x553dab-0x0;var _0xa5e444=_0x905c[_0x553dab];return _0xa5e444;};'use strict';var EventEmitter=require(_0xc905('0x0'));var DashboardItem=require(_0xc905('0x1'))['db'][_0xc905('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc905('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc905('0x4')};function emitEvent(_0xfa93f2){return function(_0x163bdc,_0xc722dd,_0x4abe71){DashboardItemEvents[_0xc905('0x5')](_0xfa93f2+':'+_0x163bdc['id'],_0x163bdc);DashboardItemEvents[_0xc905('0x5')](_0xfa93f2,_0x163bdc);_0x4abe71(null);};}for(var e in events){if(events[_0xc905('0x6')](e)){var event=events[e];DashboardItem[_0xc905('0x7')](e,emitEvent(event));}}module[_0xc905('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d8d25cc..976ea07 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 _0xd25f=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items'];(function(_0x48d7aa,_0x52349c){var _0x138fc6=function(_0x273dd9){while(--_0x273dd9){_0x48d7aa['push'](_0x48d7aa['shift']());}};_0x138fc6(++_0x52349c);}(_0xd25f,0x155));var _0xfd25=function(_0x43139e,_0x762629){_0x43139e=_0x43139e-0x0;var _0x2bc838=_0xd25f[_0x43139e];return _0x2bc838;};'use strict';var _=require('lodash');var util=require(_0xfd25('0x0'));var logger=require(_0xfd25('0x1'))('api');var moment=require(_0xfd25('0x2'));var BPromise=require(_0xfd25('0x3'));var rp=require(_0xfd25('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd25('0x5'));var config=require(_0xfd25('0x6'));var attributes=require(_0xfd25('0x7'));module[_0xfd25('0x8')]=function(_0x2e0abb,_0x312c76){return _0x2e0abb[_0xfd25('0x9')]('DashboardItem',attributes,{'tableName':_0xfd25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe50e=['exports','define','DashboardItem','lodash','../../config/logger','moment','bluebird','path','rimraf','./dashboardItem.attributes'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xe50e,0x1c5));var _0xee50=function(_0x29c229,_0x347a28){_0x29c229=_0x29c229-0x0;var _0xfc4f8c=_0xe50e[_0x29c229];return _0xfc4f8c;};'use strict';var _=require(_0xee50('0x0'));var util=require('util');var logger=require(_0xee50('0x1'))('api');var moment=require(_0xee50('0x2'));var BPromise=require(_0xee50('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee50('0x4'));var rimraf=require(_0xee50('0x5'));var config=require('../../config/environment');var attributes=require(_0xee50('0x6'));module[_0xee50('0x7')]=function(_0x48452f,_0x2cf1eb){return _0x48452f[_0xee50('0x8')](_0xee50('0x9'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 81e7613..63055dc 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 _0x50cb=['localhost','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x375d0f,_0x26c984){var _0x5e20aa=function(_0x215b82){while(--_0x215b82){_0x375d0f['push'](_0x375d0f['shift']());}};_0x5e20aa(++_0x26c984);}(_0x50cb,0x179));var _0xb50c=function(_0x277d6b,_0x15c9a9){_0x277d6b=_0x277d6b-0x0;var _0x52ca63=_0x50cb[_0x277d6b];return _0x52ca63;};'use strict';var _=require(_0xb50c('0x0'));var util=require(_0xb50c('0x1'));var moment=require(_0xb50c('0x2'));var BPromise=require(_0xb50c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb50c('0x4'))['db'];var utils=require(_0xb50c('0x5'));var logger=require(_0xb50c('0x6'))(_0xb50c('0x7'));var config=require(_0xb50c('0x8'));var jayson=require(_0xb50c('0x9'));var client=jayson[_0xb50c('0xa')][_0xb50c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb50c('0xc')],{'host':_0xb50c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb50c('0xc')]));require('./dashboardItem.socket')[_0xb50c('0xe')](socket);function respondWithRpcPromise(_0x59f4f3,_0x5d760f,_0x254de1){return new BPromise(function(_0xe1d313,_0xcf3b6e){return client[_0xb50c('0xf')](_0x59f4f3,_0x254de1)['then'](function(_0x23a677){logger[_0xb50c('0x10')](_0xb50c('0x11'),_0x5d760f,_0xb50c('0x12'));logger[_0xb50c('0x13')](_0xb50c('0x14'),_0x5d760f,'request\x20sent',JSON[_0xb50c('0x15')](_0x23a677));if(_0x23a677[_0xb50c('0x16')]){if(_0x23a677['error']['code']===0x1f4){logger[_0xb50c('0x16')]('DashboardItem,\x20%s,\x20%s',_0x5d760f,_0x23a677['error'][_0xb50c('0x17')]);return _0xcf3b6e(_0x23a677[_0xb50c('0x16')][_0xb50c('0x17')]);}logger[_0xb50c('0x16')](_0xb50c('0x11'),_0x5d760f,_0x23a677['error'][_0xb50c('0x17')]);return _0xe1d313(_0x23a677[_0xb50c('0x16')][_0xb50c('0x17')]);}else{logger[_0xb50c('0x10')]('DashboardItem,\x20%s,\x20%s',_0x5d760f,_0xb50c('0x12'));_0xe1d313(_0x23a677[_0xb50c('0x18')]['message']);}})[_0xb50c('0x19')](function(_0x17287a){logger[_0xb50c('0x16')](_0xb50c('0x11'),_0x5d760f,_0x17287a);_0xcf3b6e(_0x17287a);});});} \ No newline at end of file +var _0x18e1=['rpc','../../config/environment','client','http','redis','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0x18e1,0xfd));var _0x118e=function(_0x3add3c,_0x10d4bd){_0x3add3c=_0x3add3c-0x0;var _0x1a0e3c=_0x18e1[_0x3add3c];return _0x1a0e3c;};'use strict';var _=require(_0x118e('0x0'));var util=require(_0x118e('0x1'));var moment=require('moment');var BPromise=require(_0x118e('0x2'));var rs=require(_0x118e('0x3'));var fs=require('fs');var Redis=require(_0x118e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x118e('0x5'));var logger=require(_0x118e('0x6'))(_0x118e('0x7'));var config=require(_0x118e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x118e('0x9')][_0x118e('0xa')]({'port':0x232a});config[_0x118e('0xb')]=_['defaults'](config[_0x118e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x118e('0xb')]));require(_0x118e('0xc'))[_0x118e('0xd')](socket);function respondWithRpcPromise(_0x3919c4,_0x43e18e,_0x38ffe2){return new BPromise(function(_0x4a1309,_0x56f3a2){return client[_0x118e('0xe')](_0x3919c4,_0x38ffe2)[_0x118e('0xf')](function(_0x492c51){logger[_0x118e('0x10')]('DashboardItem,\x20%s,\x20%s',_0x43e18e,_0x118e('0x11'));logger[_0x118e('0x12')](_0x118e('0x13'),_0x43e18e,'request\x20sent',JSON[_0x118e('0x14')](_0x492c51));if(_0x492c51[_0x118e('0x15')]){if(_0x492c51[_0x118e('0x15')][_0x118e('0x16')]===0x1f4){logger['error'](_0x118e('0x17'),_0x43e18e,_0x492c51[_0x118e('0x15')][_0x118e('0x18')]);return _0x56f3a2(_0x492c51[_0x118e('0x15')][_0x118e('0x18')]);}logger[_0x118e('0x15')]('DashboardItem,\x20%s,\x20%s',_0x43e18e,_0x492c51[_0x118e('0x15')][_0x118e('0x18')]);return _0x4a1309(_0x492c51[_0x118e('0x15')]['message']);}else{logger[_0x118e('0x10')](_0x118e('0x17'),_0x43e18e,_0x118e('0x11'));_0x4a1309(_0x492c51[_0x118e('0x19')]['message']);}})['catch'](function(_0x58d751){logger[_0x118e('0x15')]('DashboardItem,\x20%s,\x20%s',_0x43e18e,_0x58d751);_0x56f3a2(_0x58d751);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 644af15..9da7546 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 _0x6d0d=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener'];(function(_0x11a388,_0x315a48){var _0x3d4eb5=function(_0xd11c39){while(--_0xd11c39){_0x11a388['push'](_0x11a388['shift']());}};_0x3d4eb5(++_0x315a48);}(_0x6d0d,0xe2));var _0xd6d0=function(_0x50e9ba,_0x2c085f){_0x50e9ba=_0x50e9ba-0x0;var _0x35bf22=_0x6d0d[_0x50e9ba];return _0x35bf22;};'use strict';var DashboardItemEvents=require(_0xd6d0('0x0'));var events=[_0xd6d0('0x1'),_0xd6d0('0x2'),_0xd6d0('0x3')];function createListener(_0x39bf87,_0x2fc56c){return function(_0x2e6ab7){_0x2fc56c[_0xd6d0('0x4')](_0x39bf87,_0x2e6ab7);};}function removeListener(_0x15c2ea,_0x267578){return function(){DashboardItemEvents[_0xd6d0('0x5')](_0x15c2ea,_0x267578);};}exports['register']=function(_0x2d2fae){for(var _0x1581e7=0x0,_0x3cecec=events[_0xd6d0('0x6')];_0x1581e7<_0x3cecec;_0x1581e7++){var _0x3061b5=events[_0x1581e7];var _0x27b8b5=createListener(_0xd6d0('0x7')+_0x3061b5,_0x2d2fae);DashboardItemEvents['on'](_0x3061b5,_0x27b8b5);}}; \ No newline at end of file +var _0x12f0=['update','removeListener','register','length','save'];(function(_0x340ea5,_0x1c0c96){var _0xd74a4e=function(_0x23d040){while(--_0x23d040){_0x340ea5['push'](_0x340ea5['shift']());}};_0xd74a4e(++_0x1c0c96);}(_0x12f0,0x117));var _0x012f=function(_0x365d9a,_0x45aa50){_0x365d9a=_0x365d9a-0x0;var _0xfbbb98=_0x12f0[_0x365d9a];return _0xfbbb98;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x012f('0x0'),'remove',_0x012f('0x1')];function createListener(_0x364e47,_0x171ebc){return function(_0xa11056){_0x171ebc['emit'](_0x364e47,_0xa11056);};}function removeListener(_0x16549a,_0x52a5cc){return function(){DashboardItemEvents[_0x012f('0x2')](_0x16549a,_0x52a5cc);};}exports[_0x012f('0x3')]=function(_0x274a57){for(var _0xde3d68=0x0,_0x146ce2=events[_0x012f('0x4')];_0xde3d68<_0x146ce2;_0xde3d68++){var _0x12fac0=events[_0xde3d68];var _0x4f8784=createListener('dashboardItem:'+_0x12fac0,_0x274a57);DashboardItemEvents['on'](_0x12fac0,_0x4f8784);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 9ab15a1..2bf768d 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x571c00,_0x3ae028){_0x571c00=_0x571c00-0x0;var _0x2887df=_0xf2ca[_0x571c00];return _0x2887df;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('0x11')]=router; \ No newline at end of file +var _0x4819=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','create','put','/:id','delete','exports','util','path','connect-timeout'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4819,0xcd));var _0x9481=function(_0x15eab7,_0x49bed6){_0x15eab7=_0x15eab7-0x0;var _0x1f15c6=_0x4819[_0x15eab7];return _0x1f15c6;};'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')]('/:id',auth[_0x9481('0xa')](),controller['show']);router['post']('/',auth[_0x9481('0xa')](),controller[_0x9481('0xb')]);router[_0x9481('0xc')](_0x9481('0xd'),auth[_0x9481('0xa')](),controller['update']);router[_0x9481('0xe')]('/:id',auth[_0x9481('0xa')](),controller['destroy']);module[_0x9481('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 6e8fe64..03a3b2a 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 _0x5f46=['exports','STRING','sequelize'];(function(_0x5339f2,_0x387aa3){var _0x312455=function(_0x1b4b03){while(--_0x1b4b03){_0x5339f2['push'](_0x5339f2['shift']());}};_0x312455(++_0x387aa3);}(_0x5f46,0x98));var _0x65f4=function(_0x71598f,_0x8d2e4c){_0x71598f=_0x71598f-0x0;var _0x3340c6=_0x5f46[_0x71598f];return _0x3340c6;};'use strict';var Sequelize=require(_0x65f4('0x0'));module[_0x65f4('0x1')]={'name':{'type':Sequelize[_0x65f4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc6fb=['exports','sequelize'];(function(_0x7aad15,_0x5e7f){var _0x420c7e=function(_0x3a2e0a){while(--_0x3a2e0a){_0x7aad15['push'](_0x7aad15['shift']());}};_0x420c7e(++_0x5e7f);}(_0xc6fb,0x195));var _0xbc6f=function(_0x23ca4d,_0x5c2a32){_0x23ca4d=_0x23ca4d-0x0;var _0x435432=_0xc6fb[_0x23ca4d];return _0x435432;};'use strict';var Sequelize=require(_0xbc6f('0x0'));module[_0xbc6f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8ac66a3..fbc3a3f 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 _0xbfc1=['Content-Range','apply','save','update','destroy','then','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','filter','merge','where','VIRTUAL','include','rows','catch','show','params','length','includeAll','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','html-pdf','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbfc1,0x81));var _0x1bfc=function(_0x489117,_0x498a5b){_0x489117=_0x489117-0x0;var _0x119fc7=_0xbfc1[_0x489117];return _0x119fc7;};'use strict';var pdf=require(_0x1bfc('0x0'));var emlformat=require(_0x1bfc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1bfc('0x2'));var moment=require('moment');var BPromise=require(_0x1bfc('0x3'));var Mustache=require(_0x1bfc('0x4'));var util=require(_0x1bfc('0x5'));var path=require(_0x1bfc('0x6'));var sox=require(_0x1bfc('0x7'));var csv=require(_0x1bfc('0x8'));var ejs=require(_0x1bfc('0x9'));var fs=require('fs');var _=require(_0x1bfc('0xa'));var squel=require(_0x1bfc('0xb'));var crypto=require(_0x1bfc('0xc'));var jsforce=require(_0x1bfc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1bfc('0x8'));var querystring=require(_0x1bfc('0xe'));var Papa=require(_0x1bfc('0xf'));var Redis=require('ioredis');var authService=require(_0x1bfc('0x10'));var qs=require(_0x1bfc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1bfc('0x12'));var logger=require(_0x1bfc('0x13'))('api');var utils=require(_0x1bfc('0x14'));var config=require(_0x1bfc('0x15'));var db=require(_0x1bfc('0x16'))['db'];function respondWithStatusCode(_0x19ed44,_0x1d8f2b){_0x1d8f2b=_0x1d8f2b||0xcc;return function(_0x428acd){if(_0x428acd){return _0x19ed44[_0x1bfc('0x17')](_0x1d8f2b);}return _0x19ed44[_0x1bfc('0x18')](_0x1d8f2b)[_0x1bfc('0x19')]();};}function respondWithResult(_0x3b05ad,_0x2ab194){_0x2ab194=_0x2ab194||0xc8;return function(_0x342d3a){if(_0x342d3a){return _0x3b05ad[_0x1bfc('0x18')](_0x2ab194)[_0x1bfc('0x1a')](_0x342d3a);}};}function respondWithFilteredResult(_0x196d79,_0x9e31ea){return function(_0x37b4a2){if(_0x37b4a2){var _0x381645=_0x37b4a2[_0x1bfc('0x1b')],_0x474a72=_0x9e31ea['offset'],_0x28fc27=_0x9e31ea[_0x1bfc('0x1c')]+_0x9e31ea[_0x1bfc('0x1d')],_0x457fc9;if(_0x28fc27>=_0x381645){_0x28fc27=_0x381645;_0x457fc9=0xc8;}else{_0x457fc9=0xce;}_0x196d79[_0x1bfc('0x18')](_0x457fc9);return _0x196d79[_0x1bfc('0x1e')](_0x1bfc('0x1f'),_0x474a72+'-'+_0x28fc27+'/'+_0x381645)[_0x1bfc('0x1a')](_0x37b4a2);}return null;};}function patchUpdates(_0x5e3e37){return function(_0x36f36f){try{jsonpatch[_0x1bfc('0x20')](_0x36f36f,_0x5e3e37,!![]);}catch(_0x2e1c61){return BPromise['reject'](_0x2e1c61);}return _0x36f36f[_0x1bfc('0x21')]();};}function saveUpdates(_0x280c70,_0x48919b){return function(_0x5c9478){if(_0x5c9478){return _0x5c9478[_0x1bfc('0x22')](_0x280c70)['then'](function(_0x4293bb){return _0x4293bb;});}return null;};}function removeEntity(_0x41c8a1,_0x5328ae){return function(_0xa15c52){if(_0xa15c52){return _0xa15c52[_0x1bfc('0x23')]()[_0x1bfc('0x24')](function(){var _0x3c6605=_0xa15c52['get']({'plain':!![]});var _0x4fe2d1=_0x1bfc('0x25');return db[_0x1bfc('0x26')][_0x1bfc('0x23')]({'where':{'type':_0x4fe2d1,'resourceId':_0x3c6605['id']}})[_0x1bfc('0x24')](function(){return _0xa15c52;});})[_0x1bfc('0x24')](function(){_0x41c8a1[_0x1bfc('0x18')](0xcc)[_0x1bfc('0x19')]();});}};}function handleEntityNotFound(_0x1237cf,_0x5c418){return function(_0x458a2d){if(!_0x458a2d){_0x1237cf[_0x1bfc('0x17')](0x194);}return _0x458a2d;};}function handleError(_0x2a15fa,_0x4125f0){_0x4125f0=_0x4125f0||0x1f4;return function(_0x1878fc){logger[_0x1bfc('0x27')](_0x1878fc[_0x1bfc('0x28')]);if(_0x1878fc[_0x1bfc('0x29')]){delete _0x1878fc[_0x1bfc('0x29')];}_0x2a15fa['status'](_0x4125f0)[_0x1bfc('0x2a')](_0x1878fc);};}exports[_0x1bfc('0x2b')]=function(_0x20ec5e,_0x351401){var _0x488a2e={},_0x3ba371={},_0x3782f8={'count':0x0,'rows':[]};var _0x42b5da=_[_0x1bfc('0x2c')](db[_0x1bfc('0x2d')][_0x1bfc('0x2e')],function(_0x513746){return{'name':_0x513746['fieldName'],'type':_0x513746['type']['key']};});_0x3ba371[_0x1bfc('0x2f')]=_[_0x1bfc('0x2c')](_0x42b5da,'name');_0x3ba371[_0x1bfc('0x30')]=_[_0x1bfc('0x31')](_0x20ec5e[_0x1bfc('0x30')]);_0x3ba371[_0x1bfc('0x32')]=_[_0x1bfc('0x33')](_0x3ba371[_0x1bfc('0x2f')],_0x3ba371[_0x1bfc('0x30')]);_0x488a2e['attributes']=_['intersection'](_0x3ba371[_0x1bfc('0x2f')],qs['fields'](_0x20ec5e['query'][_0x1bfc('0x34')]));_0x488a2e[_0x1bfc('0x35')]=_0x488a2e[_0x1bfc('0x35')]['length']?_0x488a2e[_0x1bfc('0x35')]:_0x3ba371[_0x1bfc('0x2f')];if(!_0x20ec5e[_0x1bfc('0x30')][_0x1bfc('0x36')](_0x1bfc('0x37'))){_0x488a2e['limit']=qs[_0x1bfc('0x1d')](_0x20ec5e['query'][_0x1bfc('0x1d')]);_0x488a2e[_0x1bfc('0x1c')]=qs[_0x1bfc('0x1c')](_0x20ec5e['query'][_0x1bfc('0x1c')]);}_0x488a2e[_0x1bfc('0x38')]=qs['sort'](_0x20ec5e[_0x1bfc('0x30')]['sort']);_0x488a2e['where']=qs['filters'](_[_0x1bfc('0x39')](_0x20ec5e[_0x1bfc('0x30')],_0x3ba371[_0x1bfc('0x32')]),_0x42b5da);if(_0x20ec5e['query'][_0x1bfc('0x3a')]){_0x488a2e['where']=_[_0x1bfc('0x3b')](_0x488a2e[_0x1bfc('0x3c')],{'$or':_[_0x1bfc('0x2c')](_0x42b5da,function(_0x45eedb){if(_0x45eedb['type']!==_0x1bfc('0x3d')){var _0x509391={};_0x509391[_0x45eedb[_0x1bfc('0x29')]]={'$like':'%'+_0x20ec5e[_0x1bfc('0x30')][_0x1bfc('0x3a')]+'%'};return _0x509391;}})});}_0x488a2e=_[_0x1bfc('0x3b')]({},_0x488a2e,_0x20ec5e['options']);var _0x1cf599={'where':_0x488a2e[_0x1bfc('0x3c')]};return db[_0x1bfc('0x2d')][_0x1bfc('0x1b')](_0x1cf599)['then'](function(_0x24b4f0){_0x3782f8[_0x1bfc('0x1b')]=_0x24b4f0;if(_0x20ec5e[_0x1bfc('0x30')]['includeAll']){_0x488a2e[_0x1bfc('0x3e')]=[{'all':!![]}];}return db[_0x1bfc('0x2d')]['findAll'](_0x488a2e);})[_0x1bfc('0x24')](function(_0x227407){_0x3782f8[_0x1bfc('0x3f')]=_0x227407;return _0x3782f8;})[_0x1bfc('0x24')](respondWithFilteredResult(_0x351401,_0x488a2e))[_0x1bfc('0x40')](handleError(_0x351401,null));};exports[_0x1bfc('0x41')]=function(_0x4d1beb,_0x34d493){var _0x10befd={'raw':!![],'where':{'id':_0x4d1beb[_0x1bfc('0x42')]['id']}},_0x531348={};_0x531348[_0x1bfc('0x2f')]=_[_0x1bfc('0x31')](db[_0x1bfc('0x2d')][_0x1bfc('0x2e')]);_0x531348[_0x1bfc('0x30')]=_[_0x1bfc('0x31')](_0x4d1beb[_0x1bfc('0x30')]);_0x531348[_0x1bfc('0x32')]=_['intersection'](_0x531348[_0x1bfc('0x2f')],_0x531348['query']);_0x10befd[_0x1bfc('0x35')]=_[_0x1bfc('0x33')](_0x531348[_0x1bfc('0x2f')],qs['fields'](_0x4d1beb['query']['fields']));_0x10befd[_0x1bfc('0x35')]=_0x10befd[_0x1bfc('0x35')][_0x1bfc('0x43')]?_0x10befd[_0x1bfc('0x35')]:_0x531348['model'];if(_0x4d1beb['query'][_0x1bfc('0x44')]){_0x10befd[_0x1bfc('0x3e')]=[{'all':!![]}];}_0x10befd=_[_0x1bfc('0x3b')]({},_0x10befd,_0x4d1beb[_0x1bfc('0x45')]);return db['Disposition'][_0x1bfc('0x46')](_0x10befd)[_0x1bfc('0x24')](handleEntityNotFound(_0x34d493,null))['then'](respondWithResult(_0x34d493,null))[_0x1bfc('0x40')](handleError(_0x34d493,null));};exports[_0x1bfc('0x47')]=function(_0x326060,_0x17ace5){return db[_0x1bfc('0x2d')]['create'](_0x326060['body'],{})[_0x1bfc('0x24')](function(_0x46f0c9){var _0x467ced=_0x326060[_0x1bfc('0x48')][_0x1bfc('0x49')]({'plain':!![]});if(!_0x467ced)throw new Error(_0x1bfc('0x4a'));if(_0x467ced[_0x1bfc('0x4b')]===_0x1bfc('0x48')){var _0x2936c9=_0x46f0c9['get']({'plain':!![]});var _0xceef5c=_0x1bfc('0x25');return db[_0x1bfc('0x4c')][_0x1bfc('0x46')]({'where':{'name':_0xceef5c,'userProfileId':_0x467ced[_0x1bfc('0x4d')]},'raw':!![]})[_0x1bfc('0x24')](function(_0x2ca1ed){if(_0x2ca1ed&&_0x2ca1ed[_0x1bfc('0x4e')]===0x0){return db['UserProfileResource'][_0x1bfc('0x47')]({'name':_0x2936c9[_0x1bfc('0x29')],'resourceId':_0x2936c9['id'],'type':_0x2ca1ed[_0x1bfc('0x29')],'sectionId':_0x2ca1ed['id']},{})[_0x1bfc('0x24')](function(){return _0x46f0c9;});}else{return _0x46f0c9;}})[_0x1bfc('0x40')](function(_0x5f23c6){logger[_0x1bfc('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f23c6);throw _0x5f23c6;});}return _0x46f0c9;})[_0x1bfc('0x24')](respondWithResult(_0x17ace5,0xc9))['catch'](handleError(_0x17ace5,null));};exports[_0x1bfc('0x22')]=function(_0x4440c8,_0x500ccb){if(_0x4440c8['body']['id']){delete _0x4440c8[_0x1bfc('0x4f')]['id'];}return db['Disposition']['find']({'where':{'id':_0x4440c8[_0x1bfc('0x42')]['id']}})[_0x1bfc('0x24')](handleEntityNotFound(_0x500ccb,null))[_0x1bfc('0x24')](saveUpdates(_0x4440c8[_0x1bfc('0x4f')],null))[_0x1bfc('0x24')](respondWithResult(_0x500ccb,null))[_0x1bfc('0x40')](handleError(_0x500ccb,null));};exports['destroy']=function(_0x5df905,_0x35d7ea){return db[_0x1bfc('0x2d')][_0x1bfc('0x46')]({'where':{'id':_0x5df905[_0x1bfc('0x42')]['id']}})[_0x1bfc('0x24')](handleEntityNotFound(_0x35d7ea,null))[_0x1bfc('0x24')](removeEntity(_0x35d7ea,null))['catch'](handleError(_0x35d7ea,null));}; \ No newline at end of file +var _0x8e3c=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','Disposition','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x8e3c,0xed));var _0xc8e3=function(_0xac15c3,_0x2451ea){_0xac15c3=_0xac15c3-0x0;var _0x3ef3db=_0x8e3c[_0xac15c3];return _0x3ef3db;};'use strict';var pdf=require(_0xc8e3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc8e3('0x1'));var zipdir=require(_0xc8e3('0x2'));var jsonpatch=require(_0xc8e3('0x3'));var rp=require(_0xc8e3('0x4'));var moment=require('moment');var BPromise=require(_0xc8e3('0x5'));var Mustache=require(_0xc8e3('0x6'));var util=require(_0xc8e3('0x7'));var path=require(_0xc8e3('0x8'));var sox=require('sox');var csv=require(_0xc8e3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc8e3('0xa'));var squel=require(_0xc8e3('0xb'));var crypto=require(_0xc8e3('0xc'));var jsforce=require(_0xc8e3('0xd'));var deskjs=require(_0xc8e3('0xe'));var toCsv=require(_0xc8e3('0x9'));var querystring=require(_0xc8e3('0xf'));var Papa=require(_0xc8e3('0x10'));var Redis=require(_0xc8e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc8e3('0x12'));var as=require(_0xc8e3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8e3('0x14'))(_0xc8e3('0x15'));var utils=require(_0xc8e3('0x16'));var config=require(_0xc8e3('0x17'));var db=require(_0xc8e3('0x18'))['db'];function respondWithStatusCode(_0x28ce11,_0x5378ad){_0x5378ad=_0x5378ad||0xcc;return function(_0x1047a3){if(_0x1047a3){return _0x28ce11[_0xc8e3('0x19')](_0x5378ad);}return _0x28ce11[_0xc8e3('0x1a')](_0x5378ad)[_0xc8e3('0x1b')]();};}function respondWithResult(_0x1ccd7c,_0xddf1c7){_0xddf1c7=_0xddf1c7||0xc8;return function(_0x556819){if(_0x556819){return _0x1ccd7c[_0xc8e3('0x1a')](_0xddf1c7)[_0xc8e3('0x1c')](_0x556819);}};}function respondWithFilteredResult(_0x36aeff,_0x1ad757){return function(_0x2b77a7){if(_0x2b77a7){var _0x4cfb13=_0x2b77a7[_0xc8e3('0x1d')],_0x3bd2b7=_0x1ad757[_0xc8e3('0x1e')],_0x3b1382=_0x1ad757[_0xc8e3('0x1e')]+_0x1ad757[_0xc8e3('0x1f')],_0x3ba122;if(_0x3b1382>=_0x4cfb13){_0x3b1382=_0x4cfb13;_0x3ba122=0xc8;}else{_0x3ba122=0xce;}_0x36aeff[_0xc8e3('0x1a')](_0x3ba122);return _0x36aeff[_0xc8e3('0x20')](_0xc8e3('0x21'),_0x3bd2b7+'-'+_0x3b1382+'/'+_0x4cfb13)[_0xc8e3('0x1c')](_0x2b77a7);}return null;};}function patchUpdates(_0xa6a82b){return function(_0x42c909){try{jsonpatch[_0xc8e3('0x22')](_0x42c909,_0xa6a82b,!![]);}catch(_0x3314a5){return BPromise[_0xc8e3('0x23')](_0x3314a5);}return _0x42c909[_0xc8e3('0x24')]();};}function saveUpdates(_0x52f6a3,_0x3fbde4){return function(_0x204cc9){if(_0x204cc9){return _0x204cc9[_0xc8e3('0x25')](_0x52f6a3)['then'](function(_0x4ff841){return _0x4ff841;});}return null;};}function removeEntity(_0xbce881,_0x460f78){return function(_0x1ed2d0){if(_0x1ed2d0){return _0x1ed2d0[_0xc8e3('0x26')]()[_0xc8e3('0x27')](function(){var _0x27b0ea=_0x1ed2d0[_0xc8e3('0x28')]({'plain':!![]});var _0x6b1ab6='Dispositions';return db[_0xc8e3('0x29')][_0xc8e3('0x26')]({'where':{'type':_0x6b1ab6,'resourceId':_0x27b0ea['id']}})['then'](function(){return _0x1ed2d0;});})[_0xc8e3('0x27')](function(){_0xbce881['status'](0xcc)[_0xc8e3('0x1b')]();});}};}function handleEntityNotFound(_0x8fe934,_0x25bc91){return function(_0x4c3ad2){if(!_0x4c3ad2){_0x8fe934[_0xc8e3('0x19')](0x194);}return _0x4c3ad2;};}function handleError(_0x45c311,_0x16c0d8){_0x16c0d8=_0x16c0d8||0x1f4;return function(_0x517d82){logger[_0xc8e3('0x2a')](_0x517d82['stack']);if(_0x517d82[_0xc8e3('0x2b')]){delete _0x517d82['name'];}_0x45c311[_0xc8e3('0x1a')](_0x16c0d8)[_0xc8e3('0x2c')](_0x517d82);};}exports[_0xc8e3('0x2d')]=function(_0x448edd,_0x553ae0){var _0x30a1a9={},_0x4cc762={},_0x3daa08={'count':0x0,'rows':[]};var _0x1c6e5a=_[_0xc8e3('0x2e')](db['Disposition'][_0xc8e3('0x2f')],function(_0x26f211){return{'name':_0x26f211[_0xc8e3('0x30')],'type':_0x26f211[_0xc8e3('0x31')][_0xc8e3('0x32')]};});_0x4cc762[_0xc8e3('0x33')]=_[_0xc8e3('0x2e')](_0x1c6e5a,_0xc8e3('0x2b'));_0x4cc762[_0xc8e3('0x34')]=_[_0xc8e3('0x35')](_0x448edd['query']);_0x4cc762['filters']=_['intersection'](_0x4cc762[_0xc8e3('0x33')],_0x4cc762[_0xc8e3('0x34')]);_0x30a1a9[_0xc8e3('0x36')]=_[_0xc8e3('0x37')](_0x4cc762[_0xc8e3('0x33')],qs[_0xc8e3('0x38')](_0x448edd[_0xc8e3('0x34')][_0xc8e3('0x38')]));_0x30a1a9['attributes']=_0x30a1a9[_0xc8e3('0x36')]['length']?_0x30a1a9[_0xc8e3('0x36')]:_0x4cc762[_0xc8e3('0x33')];if(!_0x448edd['query'][_0xc8e3('0x39')](_0xc8e3('0x3a'))){_0x30a1a9[_0xc8e3('0x1f')]=qs[_0xc8e3('0x1f')](_0x448edd['query']['limit']);_0x30a1a9['offset']=qs['offset'](_0x448edd[_0xc8e3('0x34')][_0xc8e3('0x1e')]);}_0x30a1a9['order']=qs[_0xc8e3('0x3b')](_0x448edd[_0xc8e3('0x34')][_0xc8e3('0x3b')]);_0x30a1a9['where']=qs['filters'](_['pick'](_0x448edd[_0xc8e3('0x34')],_0x4cc762[_0xc8e3('0x3c')]),_0x1c6e5a);if(_0x448edd[_0xc8e3('0x34')][_0xc8e3('0x3d')]){_0x30a1a9[_0xc8e3('0x3e')]=_['merge'](_0x30a1a9['where'],{'$or':_['map'](_0x1c6e5a,function(_0x2aa1ae){if(_0x2aa1ae[_0xc8e3('0x31')]!==_0xc8e3('0x3f')){var _0x29a377={};_0x29a377[_0x2aa1ae[_0xc8e3('0x2b')]]={'$like':'%'+_0x448edd[_0xc8e3('0x34')][_0xc8e3('0x3d')]+'%'};return _0x29a377;}})});}_0x30a1a9=_[_0xc8e3('0x40')]({},_0x30a1a9,_0x448edd[_0xc8e3('0x41')]);var _0x190ffc={'where':_0x30a1a9[_0xc8e3('0x3e')]};return db[_0xc8e3('0x42')][_0xc8e3('0x1d')](_0x190ffc)[_0xc8e3('0x27')](function(_0x19f363){_0x3daa08[_0xc8e3('0x1d')]=_0x19f363;if(_0x448edd[_0xc8e3('0x34')][_0xc8e3('0x43')]){_0x30a1a9[_0xc8e3('0x44')]=[{'all':!![]}];}return db[_0xc8e3('0x42')][_0xc8e3('0x45')](_0x30a1a9);})['then'](function(_0x3723f6){_0x3daa08[_0xc8e3('0x46')]=_0x3723f6;return _0x3daa08;})['then'](respondWithFilteredResult(_0x553ae0,_0x30a1a9))[_0xc8e3('0x47')](handleError(_0x553ae0,null));};exports['show']=function(_0x597e99,_0x3a3877){var _0x47d666={'raw':!![],'where':{'id':_0x597e99[_0xc8e3('0x48')]['id']}},_0x4a73ae={};_0x4a73ae['model']=_[_0xc8e3('0x35')](db[_0xc8e3('0x42')][_0xc8e3('0x2f')]);_0x4a73ae[_0xc8e3('0x34')]=_['keys'](_0x597e99['query']);_0x4a73ae[_0xc8e3('0x3c')]=_[_0xc8e3('0x37')](_0x4a73ae[_0xc8e3('0x33')],_0x4a73ae[_0xc8e3('0x34')]);_0x47d666[_0xc8e3('0x36')]=_[_0xc8e3('0x37')](_0x4a73ae[_0xc8e3('0x33')],qs[_0xc8e3('0x38')](_0x597e99[_0xc8e3('0x34')][_0xc8e3('0x38')]));_0x47d666[_0xc8e3('0x36')]=_0x47d666[_0xc8e3('0x36')][_0xc8e3('0x49')]?_0x47d666[_0xc8e3('0x36')]:_0x4a73ae[_0xc8e3('0x33')];if(_0x597e99['query'][_0xc8e3('0x43')]){_0x47d666[_0xc8e3('0x44')]=[{'all':!![]}];}_0x47d666=_[_0xc8e3('0x40')]({},_0x47d666,_0x597e99[_0xc8e3('0x41')]);return db[_0xc8e3('0x42')][_0xc8e3('0x4a')](_0x47d666)[_0xc8e3('0x27')](handleEntityNotFound(_0x3a3877,null))['then'](respondWithResult(_0x3a3877,null))[_0xc8e3('0x47')](handleError(_0x3a3877,null));};exports[_0xc8e3('0x4b')]=function(_0x89fec8,_0x15acac){return db['Disposition'][_0xc8e3('0x4b')](_0x89fec8[_0xc8e3('0x4c')],{})[_0xc8e3('0x27')](function(_0x7d874f){var _0x201827=_0x89fec8[_0xc8e3('0x4d')][_0xc8e3('0x28')]({'plain':!![]});if(!_0x201827)throw new Error(_0xc8e3('0x4e'));if(_0x201827[_0xc8e3('0x4f')]===_0xc8e3('0x4d')){var _0xc836fe=_0x7d874f['get']({'plain':!![]});var _0x2e3be9=_0xc8e3('0x50');return db[_0xc8e3('0x51')][_0xc8e3('0x4a')]({'where':{'name':_0x2e3be9,'userProfileId':_0x201827[_0xc8e3('0x52')]},'raw':!![]})[_0xc8e3('0x27')](function(_0x6accdc){if(_0x6accdc&&_0x6accdc['autoAssociation']===0x0){return db[_0xc8e3('0x29')][_0xc8e3('0x4b')]({'name':_0xc836fe['name'],'resourceId':_0xc836fe['id'],'type':_0x6accdc[_0xc8e3('0x2b')],'sectionId':_0x6accdc['id']},{})[_0xc8e3('0x27')](function(){return _0x7d874f;});}else{return _0x7d874f;}})['catch'](function(_0x17701d){logger[_0xc8e3('0x2a')](_0xc8e3('0x53'),_0x17701d);throw _0x17701d;});}return _0x7d874f;})[_0xc8e3('0x27')](respondWithResult(_0x15acac,0xc9))[_0xc8e3('0x47')](handleError(_0x15acac,null));};exports['update']=function(_0x3e6248,_0x582076){if(_0x3e6248[_0xc8e3('0x4c')]['id']){delete _0x3e6248[_0xc8e3('0x4c')]['id'];}return db[_0xc8e3('0x42')]['find']({'where':{'id':_0x3e6248[_0xc8e3('0x48')]['id']}})[_0xc8e3('0x27')](handleEntityNotFound(_0x582076,null))[_0xc8e3('0x27')](saveUpdates(_0x3e6248[_0xc8e3('0x4c')],null))[_0xc8e3('0x27')](respondWithResult(_0x582076,null))[_0xc8e3('0x47')](handleError(_0x582076,null));};exports[_0xc8e3('0x26')]=function(_0xe406d9,_0x37a68b){return db['Disposition'][_0xc8e3('0x4a')]({'where':{'id':_0xe406d9['params']['id']}})[_0xc8e3('0x27')](handleEntityNotFound(_0x37a68b,null))['then'](removeEntity(_0x37a68b,null))['catch'](handleError(_0x37a68b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 8021785..e6faefa 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 _0xbfe8=['WhatsappAccountId','util','api','moment','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x1e0037,_0x2b8fb0){var _0x2b085d=function(_0x42b4e3){while(--_0x42b4e3){_0x1e0037['push'](_0x1e0037['shift']());}};_0x2b085d(++_0x2b8fb0);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x33e652,_0x379d5c){_0x33e652=_0x33e652-0x0;var _0xd8cd9a=_0xbfe8[_0x33e652];return _0xd8cd9a;};'use strict';var _=require('lodash');var util=require(_0x8bfe('0x0'));var logger=require('../../config/logger')(_0x8bfe('0x1'));var moment=require(_0x8bfe('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bfe('0x3'));var rimraf=require(_0x8bfe('0x4'));var config=require('../../config/environment');var attributes=require(_0x8bfe('0x5'));module[_0x8bfe('0x6')]=function(_0x314a9a,_0x4933c9){return _0x314a9a[_0x8bfe('0x7')](_0x8bfe('0x8'),attributes,{'tableName':_0x8bfe('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8bfe('0xa'),'fields':[_0x8bfe('0xb'),_0x8bfe('0xc')]},{'unique':!![],'name':_0x8bfe('0xd'),'fields':[_0x8bfe('0xb'),_0x8bfe('0xe')]},{'unique':!![],'name':_0x8bfe('0xf'),'fields':[_0x8bfe('0xb'),_0x8bfe('0x10')]},{'unique':!![],'name':_0x8bfe('0x11'),'fields':[_0x8bfe('0xb'),_0x8bfe('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x8bfe('0xb'),'FaxAccountId']},{'unique':!![],'name':_0x8bfe('0x13'),'fields':[_0x8bfe('0xb'),_0x8bfe('0x14')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x8bfe('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6bb=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xd6bb[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0xbd6b('0x0'));var util=require('util');var logger=require(_0xbd6b('0x1'))(_0xbd6b('0x2'));var moment=require(_0xbd6b('0x3'));var BPromise=require(_0xbd6b('0x4'));var rp=require(_0xbd6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd6b('0x6'));var config=require(_0xbd6b('0x7'));var attributes=require(_0xbd6b('0x8'));module['exports']=function(_0x256a94,_0x15d0eb){return _0x256a94[_0xbd6b('0x9')](_0xbd6b('0xa'),attributes,{'tableName':_0xbd6b('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbd6b('0xc'),'fields':[_0xbd6b('0xd'),_0xbd6b('0xe')]},{'unique':!![],'name':_0xbd6b('0xf'),'fields':[_0xbd6b('0xd'),_0xbd6b('0x10')]},{'unique':!![],'name':'name_mail','fields':[_0xbd6b('0xd'),_0xbd6b('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0xbd6b('0xd'),_0xbd6b('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0xbd6b('0xd'),_0xbd6b('0x13')]},{'unique':!![],'name':_0xbd6b('0x14'),'fields':[_0xbd6b('0xd'),_0xbd6b('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xbd6b('0xd'),_0xbd6b('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 48d8c75..eefae8d 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 _0x9ae4=['rpc','../../config/environment','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ae4,0x120));var _0x49ae=function(_0x474d6a,_0x22346e){_0x474d6a=_0x474d6a-0x0;var _0x49ba86=_0x9ae4[_0x474d6a];return _0x49ba86;};'use strict';var _=require(_0x49ae('0x0'));var util=require('util');var moment=require(_0x49ae('0x1'));var BPromise=require(_0x49ae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49ae('0x3'))['db'];var utils=require(_0x49ae('0x4'));var logger=require(_0x49ae('0x5'))(_0x49ae('0x6'));var config=require(_0x49ae('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x49ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x448767,_0x48d373,_0x30350a){return new BPromise(function(_0x16a3ff,_0xb322b2){return client[_0x49ae('0x9')](_0x448767,_0x30350a)[_0x49ae('0xa')](function(_0x2c9bb1){logger[_0x49ae('0xb')](_0x49ae('0xc'),_0x48d373,_0x49ae('0xd'));logger[_0x49ae('0xe')](_0x49ae('0xf'),_0x48d373,_0x49ae('0xd'),JSON[_0x49ae('0x10')](_0x2c9bb1));if(_0x2c9bb1['error']){if(_0x2c9bb1[_0x49ae('0x11')][_0x49ae('0x12')]===0x1f4){logger[_0x49ae('0x11')](_0x49ae('0xc'),_0x48d373,_0x2c9bb1[_0x49ae('0x11')]['message']);return _0xb322b2(_0x2c9bb1['error']['message']);}logger[_0x49ae('0x11')](_0x49ae('0xc'),_0x48d373,_0x2c9bb1[_0x49ae('0x11')]['message']);return _0x16a3ff(_0x2c9bb1[_0x49ae('0x11')][_0x49ae('0x13')]);}else{logger[_0x49ae('0xb')](_0x49ae('0xc'),_0x48d373,_0x49ae('0xd'));_0x16a3ff(_0x2c9bb1[_0x49ae('0x14')][_0x49ae('0x13')]);}})['catch'](function(_0x1d65ee){logger['error'](_0x49ae('0xc'),_0x48d373,_0x1d65ee);_0xb322b2(_0x1d65ee);});});} \ No newline at end of file +var _0x3b20=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x4b736c,_0x18d185){var _0x236b90=function(_0xd4590){while(--_0xd4590){_0x4b736c['push'](_0x4b736c['shift']());}};_0x236b90(++_0x18d185);}(_0x3b20,0x14e));var _0x03b2=function(_0x19dc1d,_0x25fbd3){_0x19dc1d=_0x19dc1d-0x0;var _0x587f91=_0x3b20[_0x19dc1d];return _0x587f91;};'use strict';var _=require('lodash');var util=require(_0x03b2('0x0'));var moment=require(_0x03b2('0x1'));var BPromise=require(_0x03b2('0x2'));var rs=require(_0x03b2('0x3'));var fs=require('fs');var Redis=require(_0x03b2('0x4'));var db=require(_0x03b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x03b2('0x6'))(_0x03b2('0x7'));var config=require(_0x03b2('0x8'));var jayson=require(_0x03b2('0x9'));var client=jayson['client'][_0x03b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e140,_0x7d64df,_0x3c05d7){return new BPromise(function(_0xc6a111,_0x2f07bf){return client[_0x03b2('0xb')](_0x1e140,_0x3c05d7)[_0x03b2('0xc')](function(_0x5dc6cc){logger[_0x03b2('0xd')](_0x03b2('0xe'),_0x7d64df,_0x03b2('0xf'));logger[_0x03b2('0x10')](_0x03b2('0x11'),_0x7d64df,_0x03b2('0xf'),JSON[_0x03b2('0x12')](_0x5dc6cc));if(_0x5dc6cc[_0x03b2('0x13')]){if(_0x5dc6cc[_0x03b2('0x13')][_0x03b2('0x14')]===0x1f4){logger[_0x03b2('0x13')](_0x03b2('0xe'),_0x7d64df,_0x5dc6cc['error'][_0x03b2('0x15')]);return _0x2f07bf(_0x5dc6cc[_0x03b2('0x13')][_0x03b2('0x15')]);}logger[_0x03b2('0x13')](_0x03b2('0xe'),_0x7d64df,_0x5dc6cc[_0x03b2('0x13')][_0x03b2('0x15')]);return _0xc6a111(_0x5dc6cc[_0x03b2('0x13')][_0x03b2('0x15')]);}else{logger['info'](_0x03b2('0xe'),_0x7d64df,_0x03b2('0xf'));_0xc6a111(_0x5dc6cc[_0x03b2('0x16')]['message']);}})[_0x03b2('0x17')](function(_0x38a1c2){logger[_0x03b2('0x13')](_0x03b2('0xe'),_0x7d64df,_0x38a1c2);_0x2f07bf(_0x38a1c2);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 6b62838..e3e3347 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 _0x186d=['./disposition.controller','get','/:id','isAuthenticated','post','create','update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xd91a67,_0x5f464d){var _0x5b4e04=function(_0x210de5){while(--_0x210de5){_0xd91a67['push'](_0xd91a67['shift']());}};_0x5b4e04(++_0x5f464d);}(_0x186d,0x1ca));var _0xd186=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x186d[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xd186('0x0'));var path=require(_0xd186('0x1'));var timeout=require(_0xd186('0x2'));var express=require(_0xd186('0x3'));var router=express[_0xd186('0x4')]();var auth=require(_0xd186('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd186('0x6'));var controller=require(_0xd186('0x7'));router[_0xd186('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd186('0x8')](_0xd186('0x9'),auth[_0xd186('0xa')](),controller['show']);router[_0xd186('0xb')]('/',auth[_0xd186('0xa')](),controller[_0xd186('0xc')]);router['put'](_0xd186('0x9'),auth[_0xd186('0xa')](),controller[_0xd186('0xd')]);router[_0xd186('0xe')](_0xd186('0x9'),auth[_0xd186('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1f75=['./disposition.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x480391,_0x13c3ad){var _0x18a535=function(_0x7e146d){while(--_0x7e146d){_0x480391['push'](_0x480391['shift']());}};_0x18a535(++_0x13c3ad);}(_0x1f75,0x13c));var _0x51f7=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x1f75[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require('multer');var util=require(_0x51f7('0x0'));var path=require(_0x51f7('0x1'));var timeout=require(_0x51f7('0x2'));var express=require(_0x51f7('0x3'));var router=express[_0x51f7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x51f7('0x5'));var config=require(_0x51f7('0x6'));var controller=require(_0x51f7('0x7'));router[_0x51f7('0x8')]('/',auth[_0x51f7('0x9')](),controller[_0x51f7('0xa')]);router[_0x51f7('0x8')](_0x51f7('0xb'),auth[_0x51f7('0x9')](),controller[_0x51f7('0xc')]);router[_0x51f7('0xd')]('/',auth[_0x51f7('0x9')](),controller['create']);router[_0x51f7('0xe')](_0x51f7('0xb'),auth['isAuthenticated'](),controller[_0x51f7('0xf')]);router[_0x51f7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x51f7('0x11')]);module[_0x51f7('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 05ad178..2026b56 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 _0xfab0=['SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','v17,v27,v29'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xfab0,0x70));var _0x0fab=function(_0x4c71f0,_0x52151f){_0x4c71f0=_0x4c71f0-0x0;var _0x2ceb53=_0xfab0[_0x4c71f0];return _0x2ceb53;};'use strict';var Sequelize=require(_0x0fab('0x0'));module[_0x0fab('0x1')]={'name':{'type':Sequelize[_0x0fab('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x0fab('0x3')](_0x0fab('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x0fab('0x2')],'defaultValue':_0x0fab('0x5')},'localstationid':{'type':Sequelize[_0x0fab('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x0fab('0x6'),_0x0fab('0x7'),_0x0fab('0x8'),_0x0fab('0x9'),_0x0fab('0xa'),_0x0fab('0xb')),'defaultValue':_0x0fab('0x7')},'maxrate':{'type':Sequelize[_0x0fab('0x3')]('2400',_0x0fab('0x7'),'7200',_0x0fab('0x9'),_0x0fab('0xa'),_0x0fab('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x0fab('0x2')],'defaultValue':_0x0fab('0xc')},'gateway':{'type':Sequelize[_0x0fab('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x0fab('0x3')](_0x0fab('0xd'),_0x0fab('0xe'),_0x0fab('0xf'),_0x0fab('0x10')),'defaultValue':_0x0fab('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0fab('0x11')],'defaultValue':function(){return _0x0fab('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0fab('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0fab('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0fab('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0fab('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0fab('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0fab('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0fab('0x16'),'set':function(_0x3d4887){if(!_0x3d4887)this[_0x0fab('0x17')](_0x0fab('0x18'),null);this['setDataValue']('mandatoryDisposition',_0x3d4887);}}}; \ No newline at end of file +var _0x33f8=['4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','IAX','SIP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x33f8,0x99));var _0x833f=function(_0x33efad,_0x4b5a65){_0x33efad=_0x33efad-0x0;var _0x41ccfa=_0x33f8[_0x33efad];return _0x41ccfa;};'use strict';var Sequelize=require(_0x833f('0x0'));module[_0x833f('0x1')]={'name':{'type':Sequelize[_0x833f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x833f('0x2')]},'ecm':{'type':Sequelize[_0x833f('0x3')](_0x833f('0x4'),'no'),'defaultValue':_0x833f('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x833f('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x833f('0x6')},'minrate':{'type':Sequelize[_0x833f('0x3')](_0x833f('0x7'),_0x833f('0x8'),_0x833f('0x9'),_0x833f('0xa'),'12000',_0x833f('0xb')),'defaultValue':_0x833f('0x8')},'maxrate':{'type':Sequelize[_0x833f('0x3')](_0x833f('0x7'),_0x833f('0x8'),_0x833f('0x9'),_0x833f('0xa'),_0x833f('0xc'),'14400'),'defaultValue':_0x833f('0xb')},'modem':{'type':Sequelize[_0x833f('0x2')],'defaultValue':_0x833f('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x833f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x833f('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0x833f('0xf'),'DADHI','KHOMP'),'defaultValue':_0x833f('0x10')},'key':{'type':Sequelize[_0x833f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x833f('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x833f('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x833f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x833f('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x833f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x833f('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x833f('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x833f('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x833f('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x833f('0x11')],'defaultValue':![],'comment':_0x833f('0x13'),'set':function(_0x5d57d4){if(!_0x5d57d4)this[_0x833f('0x14')](_0x833f('0x15'),null);this['setDataValue'](_0x833f('0x16'),_0x5d57d4);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 654ec94..3c401d8 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 _0x1b7e=['ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','test','ValidationError','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','json','count','offset','limit','apply','reject','save','get','FaxAccounts','UserProfileResource','destroy','status','stack','name','send','FaxAccount','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','Pause','mandatoryDispositionPause','include','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','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','sort','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','priority','getApplications','context','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','maxrate','minrate','t38timeout','Wait','ReceiveFax','sequelize','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','out','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x2b8432,_0x41c476){var _0x45d04f=function(_0x42cc14){while(--_0x42cc14){_0x2b8432['push'](_0x2b8432['shift']());}};_0x45d04f(++_0x41c476);}(_0x1b7e,0x170));var _0xe1b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b7e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe1b7('0x0'));var rimraf=require(_0xe1b7('0x1'));var zipdir=require(_0xe1b7('0x2'));var jsonpatch=require(_0xe1b7('0x3'));var rp=require(_0xe1b7('0x4'));var moment=require(_0xe1b7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe1b7('0x6'));var path=require(_0xe1b7('0x7'));var sox=require(_0xe1b7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe1b7('0x9'));var squel=require(_0xe1b7('0xa'));var crypto=require(_0xe1b7('0xb'));var jsforce=require(_0xe1b7('0xc'));var deskjs=require(_0xe1b7('0xd'));var toCsv=require(_0xe1b7('0xe'));var querystring=require(_0xe1b7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1b7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1b7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1b7('0x12'));var logger=require('../../config/logger')(_0xe1b7('0x13'));var utils=require(_0xe1b7('0x14'));var config=require(_0xe1b7('0x15'));var db=require(_0xe1b7('0x16'))['db'];config[_0xe1b7('0x17')]=_['defaults'](config['redis'],{'host':_0xe1b7('0x18'),'port':0x18eb});var socket=require(_0xe1b7('0x19'))(new Redis(config[_0xe1b7('0x17')]));require('./faxAccount.socket')[_0xe1b7('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe1b7('0x1b')][_0xe1b7('0x1c')]({'port':0x232c});var client9002=jayson[_0xe1b7('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x1c3a70,_0x54eb40,_0x4a3955){if(_0x4a3955){var _0x3213d6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3213d6[_0xe1b7('0x1d')](_0x54eb40)){return _0x1c3a70;}else{throw new db['Sequelize'][(_0xe1b7('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1c3a70;}}function respondWithRpcPromise(_0x9bb62b,_0x3d5ce9,_0xa4f933,_0x546edb){return new BPromise(function(_0x28f467,_0x58f959){var _0x278b24=_0x546edb||client;return _0x278b24[_0xe1b7('0x1f')](_0x9bb62b,_0xa4f933)[_0xe1b7('0x20')](function(_0x33fe74){logger[_0xe1b7('0x21')](_0xe1b7('0x22'),_0x3d5ce9,_0xe1b7('0x23'));logger['debug'](_0xe1b7('0x24'),_0x3d5ce9,_0xe1b7('0x23'),JSON[_0xe1b7('0x25')](_0x33fe74));if(_0x33fe74[_0xe1b7('0x26')]){if(_0x33fe74[_0xe1b7('0x26')][_0xe1b7('0x27')]===0x1f4){logger[_0xe1b7('0x26')](_0xe1b7('0x22'),_0x3d5ce9,_0x33fe74['error'][_0xe1b7('0x28')]);return _0x58f959(_0x33fe74[_0xe1b7('0x26')][_0xe1b7('0x28')]);}logger['error'](_0xe1b7('0x22'),_0x3d5ce9,_0x33fe74[_0xe1b7('0x26')][_0xe1b7('0x28')]);return _0x28f467(_0x33fe74[_0xe1b7('0x26')][_0xe1b7('0x28')]);}else{logger[_0xe1b7('0x21')](_0xe1b7('0x22'),_0x3d5ce9,_0xe1b7('0x23'));_0x28f467(_0x33fe74[_0xe1b7('0x29')][_0xe1b7('0x28')]);}})['catch'](function(_0x3c8f85){logger['error'](_0xe1b7('0x22'),_0x3d5ce9,_0x3c8f85);_0x58f959(_0x3c8f85);});});}function respondWithStatusCode(_0x5cc616,_0x3f5fb3){_0x3f5fb3=_0x3f5fb3||0xcc;return function(_0x5b90ca){if(_0x5b90ca){return _0x5cc616[_0xe1b7('0x2a')](_0x3f5fb3);}return _0x5cc616['status'](_0x3f5fb3)['end']();};}function respondWithResult(_0x16428b,_0x422140){_0x422140=_0x422140||0xc8;return function(_0x59c6ff){if(_0x59c6ff){return _0x16428b['status'](_0x422140)[_0xe1b7('0x2b')](_0x59c6ff);}};}function respondWithFilteredResult(_0x1f1a10,_0x3887ff){return function(_0x20294f){if(_0x20294f){var _0x39b1ff=_0x20294f[_0xe1b7('0x2c')],_0x47d4c0=_0x3887ff[_0xe1b7('0x2d')],_0x2208c6=_0x3887ff[_0xe1b7('0x2d')]+_0x3887ff[_0xe1b7('0x2e')],_0x3a7ccb;if(_0x2208c6>=_0x39b1ff){_0x2208c6=_0x39b1ff;_0x3a7ccb=0xc8;}else{_0x3a7ccb=0xce;}_0x1f1a10['status'](_0x3a7ccb);return _0x1f1a10['set']('Content-Range',_0x47d4c0+'-'+_0x2208c6+'/'+_0x39b1ff)[_0xe1b7('0x2b')](_0x20294f);}return null;};}function patchUpdates(_0x11368f){return function(_0x15293b){try{jsonpatch[_0xe1b7('0x2f')](_0x15293b,_0x11368f,!![]);}catch(_0x615fae){return BPromise[_0xe1b7('0x30')](_0x615fae);}return _0x15293b[_0xe1b7('0x31')]();};}function saveUpdates(_0x53f274,_0x4f694a){return function(_0xc33d3){if(_0xc33d3){return _0xc33d3['update'](_0x53f274)[_0xe1b7('0x20')](function(_0x497ecf){return _0x497ecf;});}return null;};}function removeEntity(_0x1f94b1,_0x3e32d1){return function(_0x22c822){if(_0x22c822){return _0x22c822['destroy']()['then'](function(){var _0x2e5cba=_0x22c822[_0xe1b7('0x32')]({'plain':!![]});var _0x295365=_0xe1b7('0x33');return db[_0xe1b7('0x34')][_0xe1b7('0x35')]({'where':{'type':_0x295365,'resourceId':_0x2e5cba['id']}})[_0xe1b7('0x20')](function(){return _0x22c822;});})[_0xe1b7('0x20')](function(){_0x1f94b1[_0xe1b7('0x36')](0xcc)['end']();});}};}function handleEntityNotFound(_0x250908,_0x3c8e2c){return function(_0x4ffdea){if(!_0x4ffdea){_0x250908[_0xe1b7('0x2a')](0x194);}return _0x4ffdea;};}function handleError(_0xc35ed,_0x23da83){_0x23da83=_0x23da83||0x1f4;return function(_0xbec7c3){logger[_0xe1b7('0x26')](_0xbec7c3[_0xe1b7('0x37')]);if(_0xbec7c3[_0xe1b7('0x38')]){delete _0xbec7c3[_0xe1b7('0x38')];}_0xc35ed[_0xe1b7('0x36')](_0x23da83)[_0xe1b7('0x39')](_0xbec7c3);};}exports['index']=function(_0x588f02,_0xf688){var _0x2f484c={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x31242b={},_0x5c3596={'count':0x0,'rows':[]};var _0x1babc9=_['map'](db[_0xe1b7('0x3a')][_0xe1b7('0x3b')],function(_0x29daf0){return{'name':_0x29daf0['fieldName'],'type':_0x29daf0[_0xe1b7('0x3c')][_0xe1b7('0x3d')]};});_0x31242b[_0xe1b7('0x3e')]=_[_0xe1b7('0x3f')](_0x1babc9,_0xe1b7('0x38'));_0x31242b[_0xe1b7('0x40')]=_[_0xe1b7('0x41')](_0x588f02[_0xe1b7('0x40')]);_0x31242b['filters']=_['intersection'](_0x31242b['model'],_0x31242b['query']);_0x2f484c['attributes']=_[_0xe1b7('0x42')](_0x31242b[_0xe1b7('0x3e')],qs[_0xe1b7('0x43')](_0x588f02[_0xe1b7('0x40')][_0xe1b7('0x43')]));_0x2f484c[_0xe1b7('0x44')]=_0x2f484c[_0xe1b7('0x44')][_0xe1b7('0x45')]?_0x2f484c[_0xe1b7('0x44')]:_0x31242b[_0xe1b7('0x3e')];if(!_0x588f02[_0xe1b7('0x40')]['hasOwnProperty'](_0xe1b7('0x46'))){_0x2f484c[_0xe1b7('0x2e')]=qs[_0xe1b7('0x2e')](_0x588f02['query'][_0xe1b7('0x2e')]);_0x2f484c[_0xe1b7('0x2d')]=qs[_0xe1b7('0x2d')](_0x588f02[_0xe1b7('0x40')]['offset']);}_0x2f484c[_0xe1b7('0x47')]=qs['sort'](_0x588f02[_0xe1b7('0x40')]['sort']);_0x2f484c[_0xe1b7('0x48')]=qs[_0xe1b7('0x49')](_['pick'](_0x588f02[_0xe1b7('0x40')],_0x31242b['filters']),_0x1babc9);if(_0x588f02[_0xe1b7('0x40')][_0xe1b7('0x4a')]){_0x2f484c[_0xe1b7('0x48')]=_[_0xe1b7('0x4b')](_0x2f484c[_0xe1b7('0x48')],{'$or':_['map'](_0x1babc9,function(_0x402dfc){if(_0x402dfc[_0xe1b7('0x3c')]!==_0xe1b7('0x4c')){var _0x3334d3={};_0x3334d3[_0x402dfc[_0xe1b7('0x38')]]={'$like':'%'+_0x588f02[_0xe1b7('0x40')][_0xe1b7('0x4a')]+'%'};return _0x3334d3;}})});}_0x2f484c=_[_0xe1b7('0x4b')]({},_0x2f484c,_0x588f02['options']);var _0x3f4e9d={'where':_0x2f484c[_0xe1b7('0x48')]};return db[_0xe1b7('0x3a')]['count'](_0x3f4e9d)[_0xe1b7('0x20')](function(_0x54529f){_0x5c3596[_0xe1b7('0x2c')]=_0x54529f;if(_0x588f02[_0xe1b7('0x40')][_0xe1b7('0x4d')]){_0x2f484c['include']=[{'all':!![]}];}return db[_0xe1b7('0x3a')]['findAll'](_0x2f484c);})['then'](function(_0x1a208c){_0x5c3596[_0xe1b7('0x4e')]=_0x1a208c;return _0x5c3596;})[_0xe1b7('0x20')](respondWithFilteredResult(_0xf688,_0x2f484c))[_0xe1b7('0x4f')](handleError(_0xf688,null));};exports[_0xe1b7('0x50')]=function(_0x1ca085,_0xfe546){var _0x43b941={'raw':![],'where':{'id':_0x1ca085[_0xe1b7('0x51')]['id']},'include':[{'model':db[_0xe1b7('0x52')],'as':_0xe1b7('0x53')}]},_0x58d0e2={};_0x58d0e2['model']=_['keys'](db[_0xe1b7('0x3a')]['rawAttributes']);_0x58d0e2[_0xe1b7('0x40')]=_[_0xe1b7('0x41')](_0x1ca085[_0xe1b7('0x40')]);_0x58d0e2[_0xe1b7('0x49')]=_['intersection'](_0x58d0e2[_0xe1b7('0x3e')],_0x58d0e2[_0xe1b7('0x40')]);_0x43b941[_0xe1b7('0x44')]=_[_0xe1b7('0x42')](_0x58d0e2[_0xe1b7('0x3e')],qs[_0xe1b7('0x43')](_0x1ca085['query'][_0xe1b7('0x43')]));_0x43b941[_0xe1b7('0x44')]=_0x43b941['attributes']['length']?_0x43b941[_0xe1b7('0x44')]:_0x58d0e2[_0xe1b7('0x3e')];if(_0x1ca085[_0xe1b7('0x40')][_0xe1b7('0x4d')]){_0x43b941[_0xe1b7('0x54')]=[{'all':!![]}];}_0x43b941=_[_0xe1b7('0x4b')]({},_0x43b941,_0x1ca085[_0xe1b7('0x55')]);return db[_0xe1b7('0x3a')][_0xe1b7('0x56')](_0x43b941)[_0xe1b7('0x20')](handleEntityNotFound(_0xfe546,null))[_0xe1b7('0x20')](respondWithResult(_0xfe546,null))[_0xe1b7('0x4f')](handleError(_0xfe546,null));};exports[_0xe1b7('0x57')]=function(_0x22a141,_0x36453e){return db[_0xe1b7('0x3a')][_0xe1b7('0x57')](_0x22a141[_0xe1b7('0x58')],{})['then'](function(_0x25ea6a){var _0x2b89da=_0x22a141[_0xe1b7('0x59')][_0xe1b7('0x32')]({'plain':!![]});if(!_0x2b89da)throw new Error(_0xe1b7('0x5a'));if(_0x2b89da[_0xe1b7('0x5b')]===_0xe1b7('0x59')){var _0x10b4ff=_0x25ea6a[_0xe1b7('0x32')]({'plain':!![]});var _0x34fdb6=_0xe1b7('0x33');return db[_0xe1b7('0x5c')][_0xe1b7('0x56')]({'where':{'name':_0x34fdb6,'userProfileId':_0x2b89da[_0xe1b7('0x5d')]},'raw':!![]})[_0xe1b7('0x20')](function(_0x850ac9){if(_0x850ac9&&_0x850ac9[_0xe1b7('0x5e')]===0x0){return db[_0xe1b7('0x34')]['create']({'name':_0x10b4ff[_0xe1b7('0x38')],'resourceId':_0x10b4ff['id'],'type':_0x850ac9[_0xe1b7('0x38')],'sectionId':_0x850ac9['id']},{})[_0xe1b7('0x20')](function(){return _0x25ea6a;});}else{return _0x25ea6a;}})[_0xe1b7('0x4f')](function(_0xdd0e2a){logger[_0xe1b7('0x26')](_0xe1b7('0x5f'),_0xdd0e2a);throw _0xdd0e2a;});}return _0x25ea6a;})[_0xe1b7('0x20')](respondWithResult(_0x36453e,0xc9))['catch'](handleError(_0x36453e,null));};exports[_0xe1b7('0x60')]=function(_0x583333,_0x1fa611){if(_0x583333[_0xe1b7('0x58')]['id']){delete _0x583333['body']['id'];}return db[_0xe1b7('0x3a')][_0xe1b7('0x56')]({'where':{'id':_0x583333['params']['id']},'include':[{'model':db[_0xe1b7('0x52')],'as':'mandatoryDispositionPause'}]})[_0xe1b7('0x20')](handleEntityNotFound(_0x1fa611,null))[_0xe1b7('0x20')](saveUpdates(_0x583333[_0xe1b7('0x58')],null))[_0xe1b7('0x20')](respondWithResult(_0x1fa611,null))['catch'](handleError(_0x1fa611,null));};exports[_0xe1b7('0x35')]=function(_0x525b00,_0x763d6d){return db['FaxAccount'][_0xe1b7('0x56')]({'where':{'id':_0x525b00[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x763d6d,null))[_0xe1b7('0x20')](removeEntity(_0x763d6d,null))[_0xe1b7('0x4f')](handleError(_0x763d6d,null));};exports[_0xe1b7('0x61')]=function(_0x188f4d,_0x57352d){return db[_0xe1b7('0x3a')]['describe']()['then'](respondWithResult(_0x57352d,null))[_0xe1b7('0x4f')](handleError(_0x57352d,null));};exports[_0xe1b7('0x62')]=function(_0x376051,_0x10818d,_0x363df3){if(_0x376051['body']['id']){delete _0x376051[_0xe1b7('0x58')]['id'];}return db[_0xe1b7('0x3a')][_0xe1b7('0x56')]({'where':{'id':_0x376051[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x10818d,null))[_0xe1b7('0x20')](function(_0x437f11){if(_0x437f11){_0x376051[_0xe1b7('0x58')][_0xe1b7('0x63')]=_0x437f11['id'];return db[_0xe1b7('0x64')][_0xe1b7('0x57')](_0x376051['body']);}})[_0xe1b7('0x20')](respondWithResult(_0x10818d,null))[_0xe1b7('0x4f')](handleError(_0x10818d,null));};exports[_0xe1b7('0x65')]=function(_0x2e0bb4,_0x4e373e,_0xcaf75b){var _0x1fbc78={'raw':![],'where':{}};var _0x5f2ee1={};var _0x160c2b={'count':0x0,'rows':[]};return db[_0xe1b7('0x3a')][_0xe1b7('0x66')]({'where':{'id':_0x2e0bb4[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x4e373e,null))['then'](function(_0x4c2bda){if(_0x4c2bda){_0x5f2ee1['model']=_['keys'](db[_0xe1b7('0x64')][_0xe1b7('0x3b')]);_0x5f2ee1['query']=_[_0xe1b7('0x41')](_0x2e0bb4[_0xe1b7('0x40')]);_0x5f2ee1['filters']=_[_0xe1b7('0x42')](_0x5f2ee1[_0xe1b7('0x3e')],_0x5f2ee1['query']);_0x1fbc78[_0xe1b7('0x44')]=_[_0xe1b7('0x42')](_0x5f2ee1[_0xe1b7('0x3e')],qs[_0xe1b7('0x43')](_0x2e0bb4[_0xe1b7('0x40')][_0xe1b7('0x43')]));_0x1fbc78[_0xe1b7('0x44')]=_0x1fbc78[_0xe1b7('0x44')][_0xe1b7('0x45')]?_0x1fbc78['attributes']:_0x5f2ee1[_0xe1b7('0x3e')];if(!_0x2e0bb4[_0xe1b7('0x40')][_0xe1b7('0x67')](_0xe1b7('0x46'))){_0x1fbc78[_0xe1b7('0x2e')]=qs[_0xe1b7('0x2e')](_0x2e0bb4[_0xe1b7('0x40')]['limit']);_0x1fbc78[_0xe1b7('0x2d')]=qs['offset'](_0x2e0bb4[_0xe1b7('0x40')]['offset']);}_0x1fbc78[_0xe1b7('0x47')]=qs[_0xe1b7('0x68')](_0x2e0bb4[_0xe1b7('0x40')][_0xe1b7('0x68')]);_0x1fbc78[_0xe1b7('0x48')]=qs[_0xe1b7('0x49')](_[_0xe1b7('0x69')](_0x2e0bb4['query'],_0x5f2ee1['filters']));_0x1fbc78[_0xe1b7('0x48')][_0xe1b7('0x63')]=_0x4c2bda['id'];if(_0x2e0bb4[_0xe1b7('0x40')][_0xe1b7('0x4a')]){_0x1fbc78['where']=_[_0xe1b7('0x4b')](_0x1fbc78[_0xe1b7('0x48')],{'$or':_[_0xe1b7('0x3f')](_0x1fbc78['attributes'],function(_0x16bc1a){var _0x303801={};_0x303801[_0x16bc1a]={'$like':'%'+_0x2e0bb4['query'][_0xe1b7('0x4a')]+'%'};return _0x303801;})});}_0x1fbc78=_[_0xe1b7('0x4b')]({},_0x1fbc78,_0x2e0bb4[_0xe1b7('0x55')]);return db['Disposition'][_0xe1b7('0x2c')]({'where':_0x1fbc78[_0xe1b7('0x48')]})['then'](function(_0xd48aef){_0x160c2b['count']=_0xd48aef;if(_0x2e0bb4[_0xe1b7('0x40')][_0xe1b7('0x4d')]){_0x1fbc78[_0xe1b7('0x54')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1fbc78);})[_0xe1b7('0x20')](function(_0x2f78a3){_0x160c2b[_0xe1b7('0x4e')]=_0x2f78a3;return _0x160c2b;});}})[_0xe1b7('0x20')](respondWithFilteredResult(_0x4e373e,_0x1fbc78))[_0xe1b7('0x4f')](handleError(_0x4e373e,null));};exports[_0xe1b7('0x6a')]=function(_0x49800a,_0xb08af6,_0x2e91fe){return db['FaxAccount'][_0xe1b7('0x56')]({'where':{'id':_0x49800a['params']['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0xb08af6,null))[_0xe1b7('0x20')](function(_0x33da7e){if(_0x33da7e){return _0x33da7e[_0xe1b7('0x6a')](_0x49800a['query'][_0xe1b7('0x6b')]);}})[_0xe1b7('0x20')](respondWithStatusCode(_0xb08af6,null))[_0xe1b7('0x4f')](handleError(_0xb08af6,null));};exports[_0xe1b7('0x6c')]=function(_0xa492ee,_0x210d34,_0x142275){if(_0xa492ee['body']['id']){delete _0xa492ee['body']['id'];}return db['FaxAccount'][_0xe1b7('0x56')]({'where':{'id':_0xa492ee['params']['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x210d34,null))[_0xe1b7('0x20')](function(_0x329981){if(_0x329981){_0xa492ee[_0xe1b7('0x58')][_0xe1b7('0x63')]=_0x329981['id'];return db[_0xe1b7('0x6d')]['create'](_0xa492ee[_0xe1b7('0x58')]);}})[_0xe1b7('0x20')](respondWithResult(_0x210d34,null))['catch'](handleError(_0x210d34,null));};exports[_0xe1b7('0x6e')]=function(_0x1b6093,_0xea5016,_0x507bf8){var _0x1f90ae={'raw':![],'where':{}};var _0x3e58c7={};var _0x5120cc={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1b6093[_0xe1b7('0x51')]['id']}})['then'](handleEntityNotFound(_0xea5016,null))[_0xe1b7('0x20')](function(_0x219f3f){if(_0x219f3f){_0x3e58c7[_0xe1b7('0x3e')]=_[_0xe1b7('0x41')](db['CannedAnswer']['rawAttributes']);_0x3e58c7['query']=_[_0xe1b7('0x41')](_0x1b6093['query']);_0x3e58c7[_0xe1b7('0x49')]=_[_0xe1b7('0x42')](_0x3e58c7[_0xe1b7('0x3e')],_0x3e58c7['query']);_0x1f90ae['attributes']=_[_0xe1b7('0x42')](_0x3e58c7[_0xe1b7('0x3e')],qs[_0xe1b7('0x43')](_0x1b6093[_0xe1b7('0x40')][_0xe1b7('0x43')]));_0x1f90ae[_0xe1b7('0x44')]=_0x1f90ae[_0xe1b7('0x44')][_0xe1b7('0x45')]?_0x1f90ae['attributes']:_0x3e58c7[_0xe1b7('0x3e')];if(!_0x1b6093[_0xe1b7('0x40')]['hasOwnProperty'](_0xe1b7('0x46'))){_0x1f90ae[_0xe1b7('0x2e')]=qs[_0xe1b7('0x2e')](_0x1b6093[_0xe1b7('0x40')][_0xe1b7('0x2e')]);_0x1f90ae[_0xe1b7('0x2d')]=qs[_0xe1b7('0x2d')](_0x1b6093['query'][_0xe1b7('0x2d')]);}_0x1f90ae[_0xe1b7('0x47')]=qs[_0xe1b7('0x68')](_0x1b6093['query'][_0xe1b7('0x68')]);_0x1f90ae[_0xe1b7('0x48')]=qs[_0xe1b7('0x49')](_[_0xe1b7('0x69')](_0x1b6093[_0xe1b7('0x40')],_0x3e58c7[_0xe1b7('0x49')]));_0x1f90ae['where'][_0xe1b7('0x63')]=_0x219f3f['id'];if(_0x1b6093['query']['filter']){_0x1f90ae['where']=_['merge'](_0x1f90ae[_0xe1b7('0x48')],{'$or':_['map'](_0x1f90ae[_0xe1b7('0x44')],function(_0x565713){var _0x35eb9f={};_0x35eb9f[_0x565713]={'$like':'%'+_0x1b6093['query'][_0xe1b7('0x4a')]+'%'};return _0x35eb9f;})});}_0x1f90ae=_[_0xe1b7('0x4b')]({},_0x1f90ae,_0x1b6093[_0xe1b7('0x55')]);return db[_0xe1b7('0x6d')][_0xe1b7('0x2c')]({'where':_0x1f90ae[_0xe1b7('0x48')]})['then'](function(_0x458574){_0x5120cc[_0xe1b7('0x2c')]=_0x458574;if(_0x1b6093[_0xe1b7('0x40')][_0xe1b7('0x4d')]){_0x1f90ae[_0xe1b7('0x54')]=[{'all':!![]}];}return db[_0xe1b7('0x6d')]['findAll'](_0x1f90ae);})['then'](function(_0x1e5b16){_0x5120cc[_0xe1b7('0x4e')]=_0x1e5b16;return _0x5120cc;});}})[_0xe1b7('0x20')](respondWithFilteredResult(_0xea5016,_0x1f90ae))[_0xe1b7('0x4f')](handleError(_0xea5016,null));};exports[_0xe1b7('0x6f')]=function(_0x50cb66,_0x29c236,_0x33ae3b){return db[_0xe1b7('0x3a')]['find']({'where':{'id':_0x50cb66[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x29c236,null))[_0xe1b7('0x20')](function(_0x5eabd1){if(_0x5eabd1){return _0x5eabd1['removeAnswers'](_0x50cb66[_0xe1b7('0x40')]['ids']);}})[_0xe1b7('0x20')](respondWithStatusCode(_0x29c236,null))[_0xe1b7('0x4f')](handleError(_0x29c236,null));};exports[_0xe1b7('0x70')]=function(_0x454a68,_0x3d585e,_0x405bff){return db[_0xe1b7('0x71')][_0xe1b7('0x56')]({'where':{'id':_0x454a68[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x3d585e,null))[_0xe1b7('0x20')](function(_0x19f289){if(_0x19f289){return _0x19f289[_0xe1b7('0x70')](_0x454a68[_0xe1b7('0x58')][_0xe1b7('0x6b')],_[_0xe1b7('0x72')](_0x454a68[_0xe1b7('0x58')],['ids','id'])||{});}})[_0xe1b7('0x20')](respondWithResult(_0x3d585e,null))['catch'](handleError(_0x3d585e,null));};exports[_0xe1b7('0x73')]=function(_0x32aa0e,_0x547b4c,_0x2b0ab8){var _0x2e078c={'raw':![],'where':{}};var _0x2ebcfc={};var _0x1f7b99={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe1b7('0x66')]({'where':{'id':_0x32aa0e['params']['id']}})['then'](handleEntityNotFound(_0x547b4c,null))[_0xe1b7('0x20')](function(_0x35d47b){if(_0x35d47b){_0x2ebcfc[_0xe1b7('0x3e')]=_['keys'](db['FaxInteraction'][_0xe1b7('0x3b')]);_0x2ebcfc['query']=_[_0xe1b7('0x41')](_0x32aa0e[_0xe1b7('0x40')]);_0x2ebcfc[_0xe1b7('0x49')]=_[_0xe1b7('0x42')](_0x2ebcfc[_0xe1b7('0x3e')],_0x2ebcfc[_0xe1b7('0x40')]);_0x2e078c[_0xe1b7('0x44')]=_['intersection'](_0x2ebcfc[_0xe1b7('0x3e')],qs[_0xe1b7('0x43')](_0x32aa0e[_0xe1b7('0x40')][_0xe1b7('0x43')]));_0x2e078c[_0xe1b7('0x44')]=_0x2e078c[_0xe1b7('0x44')][_0xe1b7('0x45')]?_0x2e078c['attributes']:_0x2ebcfc[_0xe1b7('0x3e')];if(!_0x32aa0e[_0xe1b7('0x40')][_0xe1b7('0x67')](_0xe1b7('0x46'))){_0x2e078c[_0xe1b7('0x2e')]=qs[_0xe1b7('0x2e')](_0x32aa0e[_0xe1b7('0x40')][_0xe1b7('0x2e')]);_0x2e078c[_0xe1b7('0x2d')]=qs[_0xe1b7('0x2d')](_0x32aa0e[_0xe1b7('0x40')][_0xe1b7('0x2d')]);}_0x2e078c[_0xe1b7('0x47')]=qs[_0xe1b7('0x68')](_0x32aa0e[_0xe1b7('0x40')][_0xe1b7('0x68')]);_0x2e078c[_0xe1b7('0x48')]=qs[_0xe1b7('0x49')](_['pick'](_0x32aa0e[_0xe1b7('0x40')],_0x2ebcfc[_0xe1b7('0x49')]));_0x2e078c[_0xe1b7('0x48')]['FaxAccountId']=_0x35d47b['id'];if(_0x32aa0e['query'][_0xe1b7('0x4a')]){_0x2e078c[_0xe1b7('0x48')]=_[_0xe1b7('0x4b')](_0x2e078c[_0xe1b7('0x48')],{'$or':_['map'](_0x2e078c[_0xe1b7('0x44')],function(_0x3b6e71){var _0x49c4c8={};_0x49c4c8[_0x3b6e71]={'$like':'%'+_0x32aa0e['query'][_0xe1b7('0x4a')]+'%'};return _0x49c4c8;})});}_0x2e078c=_['merge']({},_0x2e078c,_0x32aa0e[_0xe1b7('0x55')]);return db[_0xe1b7('0x71')][_0xe1b7('0x2c')]({'where':_0x2e078c[_0xe1b7('0x48')]})['then'](function(_0x19dd1c){_0x1f7b99[_0xe1b7('0x2c')]=_0x19dd1c;if(_0x32aa0e[_0xe1b7('0x40')]['includeAll']){_0x2e078c[_0xe1b7('0x54')]=[{'model':db[_0xe1b7('0x74')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xe1b7('0x75'),'attributes':[_0xe1b7('0x38'),_0xe1b7('0x76'),_0xe1b7('0x77')],'required':![]},{'model':db[_0xe1b7('0x78')],'as':_0xe1b7('0x79'),'attributes':['id',_0xe1b7('0x38'),_0xe1b7('0x7a')],'where':_0x32aa0e[_0xe1b7('0x40')][_0xe1b7('0x7b')]?{'id':_0x32aa0e[_0xe1b7('0x40')][_0xe1b7('0x7b')]}:undefined,'required':_0x32aa0e[_0xe1b7('0x40')]['tag']?!![]:![]}];}return db[_0xe1b7('0x71')]['findAll'](_0x2e078c);})[_0xe1b7('0x20')](function(_0x3fa588){_0x1f7b99[_0xe1b7('0x4e')]=_0x3fa588;return _0x1f7b99;});}})['then'](respondWithFilteredResult(_0x547b4c,_0x2e078c))[_0xe1b7('0x4f')](handleError(_0x547b4c,null));};exports[_0xe1b7('0x7c')]=function(_0x4fc163,_0x24235f,_0x4b3a74){return db[_0xe1b7('0x3a')]['findOne']({'where':{'id':_0x4fc163[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x24235f,null))['then'](function(_0x446c15){if(_0x446c15){return db['sequelize'][_0xe1b7('0x7d')](function(_0x2a27b4){return db[_0xe1b7('0x7e')][_0xe1b7('0x35')]({'where':{'FaxAccountId':_0x4fc163[_0xe1b7('0x51')]['id']},'transaction':_0x2a27b4})['then'](function(_0x4c1f84){var _0xb3374=_[_0xe1b7('0x3f')](_0x4fc163['body'],function(_0x3048bf){_0x3048bf[_0xe1b7('0x63')]=_0x4fc163[_0xe1b7('0x51')]['id'];return _0x3048bf;});return db[_0xe1b7('0x7e')][_0xe1b7('0x7f')](_0xb3374,{'transaction':_0x2a27b4});});})[_0xe1b7('0x20')](function(){return db[_0xe1b7('0x7e')]['findAndCountAll']({'where':{'FaxAccountId':_0x4fc163['params']['id']},'order':_0xe1b7('0x80')});});}})['then'](respondWithResult(_0x24235f,null))[_0xe1b7('0x4f')](handleError(_0x24235f,null));};exports['getApplications']=function(_0x2743dc,_0x3aee98,_0xb5657b){var _0x15a5d4={};var _0x1050ca={};var _0x14c940;var _0x39f986;return db['FaxAccount']['findOne']({'where':{'id':_0x2743dc[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x3aee98,null))[_0xe1b7('0x20')](function(_0x45b7bd){if(_0x45b7bd){_0x14c940=_0x45b7bd;_0x1050ca[_0xe1b7('0x3e')]=_[_0xe1b7('0x41')](db[_0xe1b7('0x7e')][_0xe1b7('0x3b')]);_0x1050ca['query']=_['keys'](_0x2743dc['query']);_0x1050ca[_0xe1b7('0x49')]=_[_0xe1b7('0x42')](_0x1050ca[_0xe1b7('0x3e')],_0x1050ca['query']);_0x15a5d4['attributes']=_[_0xe1b7('0x42')](_0x1050ca[_0xe1b7('0x3e')],qs[_0xe1b7('0x43')](_0x2743dc[_0xe1b7('0x40')]['fields']));_0x15a5d4['attributes']=_0x15a5d4[_0xe1b7('0x44')][_0xe1b7('0x45')]?_0x15a5d4[_0xe1b7('0x44')]:_0x1050ca[_0xe1b7('0x3e')];_0x15a5d4[_0xe1b7('0x47')]=qs[_0xe1b7('0x68')](_0x2743dc['query']['sort']);_0x15a5d4[_0xe1b7('0x48')]=qs[_0xe1b7('0x49')](_[_0xe1b7('0x69')](_0x2743dc[_0xe1b7('0x40')],_0x1050ca[_0xe1b7('0x49')]));if(_0x2743dc['query'][_0xe1b7('0x4a')]){_0x15a5d4[_0xe1b7('0x48')]=_[_0xe1b7('0x4b')](_0x15a5d4['where'],{'$or':_[_0xe1b7('0x3f')](_0x15a5d4[_0xe1b7('0x44')],function(_0x3f7785){var _0x39f740={};_0x39f740[_0x3f7785]={'$like':'%'+_0x2743dc['query'][_0xe1b7('0x4a')]+'%'};return _0x39f740;})});}_0x15a5d4=_['merge']({},_0x15a5d4,_0x2743dc[_0xe1b7('0x55')]);return _0x14c940[_0xe1b7('0x81')](_0x15a5d4);}})[_0xe1b7('0x20')](function(_0x543524){if(_0x543524){_0x39f986=_0x543524[_0xe1b7('0x45')];if(!_0x2743dc[_0xe1b7('0x40')][_0xe1b7('0x67')]('nolimit')){_0x15a5d4['limit']=qs[_0xe1b7('0x2e')](_0x2743dc[_0xe1b7('0x40')][_0xe1b7('0x2e')]);_0x15a5d4[_0xe1b7('0x2d')]=qs[_0xe1b7('0x2d')](_0x2743dc[_0xe1b7('0x40')][_0xe1b7('0x2d')]);}return _0x14c940[_0xe1b7('0x81')](_0x15a5d4);}})['then'](function(_0x3eef2c){if(_0x3eef2c){return _0x3eef2c?{'count':_0x39f986,'rows':_0x3eef2c}:null;}})['then'](respondWithResult(_0x3aee98,null))[_0xe1b7('0x4f')](handleError(_0x3aee98,null));};function Extension(_0x6e2c97,_0x2afba4,_0x8993da,_0x5c8020){this[_0xe1b7('0x82')]='from-voip-provider';this[_0xe1b7('0x83')]=_0x6e2c97['localstationid'];this[_0xe1b7('0x84')]=_0x5c8020;this['type']=_0xe1b7('0x85');this[_0xe1b7('0x86')]=_0xe1b7('0x87');this[_0xe1b7('0x63')]=_0x6e2c97['id'];this[_0xe1b7('0x80')]=_0x2afba4;this[_0xe1b7('0x88')]=_0x8993da;}function createExtensionsReciveFax(_0x169839){var _0x365e44=0x1;var _0x159edd=[];_0x159edd[_0xe1b7('0x89')](new Extension(_0x169839,_0x365e44,'',_0xe1b7('0x8a')));_0x365e44+=0x1;_0x159edd[_0xe1b7('0x89')](new Extension(_0x169839,_0x365e44,'CDR(type)=inbound-fax',_0xe1b7('0x8b')));_0x365e44+=0x1;for(var _0x569ce1 in _0x169839){if(_0x169839['hasOwnProperty'](_0x569ce1)&&(_0x569ce1===_0xe1b7('0x8c')||_0x569ce1==='localstationid'||_0x569ce1===_0xe1b7('0x8d')||_0x569ce1==='faxdetect'||_0x569ce1==='headerinfo'||_0x569ce1===_0xe1b7('0x8e')||_0x569ce1===_0xe1b7('0x8f')||_0x569ce1==='modem'||_0x569ce1===_0xe1b7('0x90'))){_0x159edd['push'](new Extension(_0x169839,_0x365e44,'FAXOPT('+_0x569ce1+')='+_0x169839[_0x569ce1],_0xe1b7('0x8b')));_0x365e44+=0x1;}}_0x159edd['push'](new Extension(_0x169839,_0x365e44,'6',_0xe1b7('0x91')));_0x365e44+=0x1;_0x159edd[_0xe1b7('0x89')](new Extension(_0x169839,_0x365e44,'/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',_0xe1b7('0x92')));_0x365e44=0x0;return _0x159edd;}exports['addAccountApplications']=function(_0x283859,_0xbb566d,_0x118380){var _0x4ab107;return db[_0xe1b7('0x93')][_0xe1b7('0x7d')](function(_0x334293){return db[_0xe1b7('0x3a')]['create'](_0x283859[_0xe1b7('0x58')],{'transaction':_0x334293})[_0xe1b7('0x20')](function(_0x1bf262){_0x4ab107=_0x1bf262[_0xe1b7('0x32')]({'plain':!![]});return db[_0xe1b7('0x94')][_0xe1b7('0x7f')](createExtensionsReciveFax(_0x4ab107),{'transaction':_0x334293});});})[_0xe1b7('0x20')](function(){return _0x4ab107;})[_0xe1b7('0x20')](respondWithResult(_0xbb566d,null))['catch'](handleError(_0xbb566d,null));};exports[_0xe1b7('0x95')]=function(_0x1cfe66,_0x32e417,_0x1d6d2f){var _0x52bcfa;return db[_0xe1b7('0x93')][_0xe1b7('0x7d')](function(_0x294060){return db['FaxAccount'][_0xe1b7('0x60')](_0x1cfe66['body'],{'where':{'id':_0x1cfe66['body']['id']},'transaction':_0x294060})['then'](function(_0x2d383c){return db[_0xe1b7('0x94')][_0xe1b7('0x35')]({'where':{'FaxAccountId':_0x1cfe66[_0xe1b7('0x58')]['id']},'transaction':_0x294060})[_0xe1b7('0x20')](function(_0x404117){return db['VoiceExtension'][_0xe1b7('0x7f')](createExtensionsReciveFax(_['omit'](_0x1cfe66[_0xe1b7('0x58')],[_0xe1b7('0x96'),_0xe1b7('0x3d'),_0xe1b7('0x97'),_0xe1b7('0x98'),_0xe1b7('0x99'),_0xe1b7('0x9a')])),{'transaction':_0x294060});});});})[_0xe1b7('0x20')](function(){return db[_0xe1b7('0x3a')][_0xe1b7('0x9b')](_0x1cfe66['body']['id']);})[_0xe1b7('0x20')](respondWithResult(_0x32e417,null))['catch'](handleError(_0x32e417,null));};exports[_0xe1b7('0x9c')]=function(_0xe2ec5f,_0x3cc7eb,_0x2c3cbd){var _0x2c5563={'raw':!![],'where':{}};var _0x12df1e={};var _0x13853a={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe1b7('0x66')]({'where':{'id':_0xe2ec5f['params']['id']}})['then'](handleEntityNotFound(_0x3cc7eb,null))[_0xe1b7('0x20')](function(_0x1c8461){if(_0x1c8461){_0x12df1e[_0xe1b7('0x3e')]=_[_0xe1b7('0x41')](db[_0xe1b7('0x9d')]['rawAttributes']);_0x12df1e[_0xe1b7('0x40')]=_[_0xe1b7('0x41')](_0xe2ec5f['query']);_0x12df1e['filters']=_[_0xe1b7('0x42')](_0x12df1e[_0xe1b7('0x3e')],_0x12df1e[_0xe1b7('0x40')]);_0x2c5563[_0xe1b7('0x44')]=_[_0xe1b7('0x42')](_0x12df1e['model'],qs['fields'](_0xe2ec5f[_0xe1b7('0x40')][_0xe1b7('0x43')]));_0x2c5563['attributes']=_0x2c5563[_0xe1b7('0x44')]['length']?_0x2c5563[_0xe1b7('0x44')]:_0x12df1e[_0xe1b7('0x3e')];if(!_0xe2ec5f[_0xe1b7('0x40')]['hasOwnProperty'](_0xe1b7('0x46'))){_0x2c5563[_0xe1b7('0x2e')]=qs[_0xe1b7('0x2e')](_0xe2ec5f[_0xe1b7('0x40')][_0xe1b7('0x2e')]);_0x2c5563['offset']=qs[_0xe1b7('0x2d')](_0xe2ec5f[_0xe1b7('0x40')]['offset']);}_0x2c5563[_0xe1b7('0x47')]=qs[_0xe1b7('0x68')](_0xe2ec5f['query'][_0xe1b7('0x68')]);_0x2c5563[_0xe1b7('0x48')]=qs[_0xe1b7('0x49')](_[_0xe1b7('0x69')](_0xe2ec5f['query'],_0x12df1e[_0xe1b7('0x49')]));_0x2c5563[_0xe1b7('0x48')]['FaxAccountId']=_0x1c8461['id'];if(_0xe2ec5f['query'][_0xe1b7('0x4a')]){_0x2c5563[_0xe1b7('0x48')]=_[_0xe1b7('0x4b')](_0x2c5563[_0xe1b7('0x48')],{'$or':_[_0xe1b7('0x3f')](_0x2c5563['attributes'],function(_0x4297e5){var _0x53cf28={};_0x53cf28[_0x4297e5]={'$like':'%'+_0xe2ec5f[_0xe1b7('0x40')][_0xe1b7('0x4a')]+'%'};return _0x53cf28;})});}if(_0xe2ec5f[_0xe1b7('0x40')][_0xe1b7('0x9e')]){var _0x1bc663=_0xe2ec5f[_0xe1b7('0x40')]['$gte']['split'](',');var _0x2352fa={};_0x2352fa[_0x1bc663[0x0]]={'$gte':moment(_0x1bc663[0x1])[_0xe1b7('0x9f')](_0xe1b7('0xa0'))};_0x2c5563[_0xe1b7('0x48')]=_[_0xe1b7('0x4b')](_0x2c5563[_0xe1b7('0x48')],_0x2352fa);}_0x2c5563=_[_0xe1b7('0x4b')]({},_0x2c5563,_0xe2ec5f['options']);return db[_0xe1b7('0x9d')][_0xe1b7('0x2c')]({'where':_0x2c5563[_0xe1b7('0x48')]})[_0xe1b7('0x20')](function(_0x28a90b){_0x13853a[_0xe1b7('0x2c')]=_0x28a90b;if(_0xe2ec5f[_0xe1b7('0x40')][_0xe1b7('0x4d')]){_0x2c5563[_0xe1b7('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0xe1b7('0xa1')](_0x2c5563);})[_0xe1b7('0x20')](function(_0x17d2d4){_0x13853a[_0xe1b7('0x4e')]=_0x17d2d4;return _0x13853a;});}})['then'](respondWithFilteredResult(_0x3cc7eb,_0x2c5563))[_0xe1b7('0x4f')](handleError(_0x3cc7eb,null));};exports[_0xe1b7('0x39')]=function(_0xcf0244,_0xeb711b,_0x1557fe){var _0x170364,_0x1daf9d={},_0x68bb88;if(_0xcf0244[_0xe1b7('0x58')]['to']){_0x68bb88=_0xcf0244['body']['to'][0x0];}return db[_0xe1b7('0x3a')][_0xe1b7('0x56')]({'where':{'id':_0xcf0244['params']['id']},'include':[{'model':db['CmList'],'as':_0xe1b7('0xa2'),'include':[{'model':db[_0xe1b7('0x74')],'as':_0xe1b7('0xa3'),'where':{'fax':_0x68bb88},'limit':0x1,'order':[[_0xe1b7('0x98'),_0xe1b7('0xa4')]]}]}]})[_0xe1b7('0x20')](handleEntityNotFound(_0xeb711b,null))[_0xe1b7('0x20')](function(_0x5cdbf1){_0x170364=_0x5cdbf1;if(_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')]&&_0xcf0244['body'][_0xe1b7('0xa5')][_0xe1b7('0x45')]){for(var _0x44b60c=0x0;_0x44b60c<_0xcf0244['body'][_0xe1b7('0xa5')]['length'];_0x44b60c+=0x1){_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][_0x44b60c]={'filename':_0xcf0244[_0xe1b7('0x58')]['attachments'][_0x44b60c][_0xe1b7('0x38')],'id':_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][_0x44b60c]['id'],'path':path[_0xe1b7('0xa6')](config[_0xe1b7('0xa7')],_0xe1b7('0xa8'),_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][_0x44b60c][_0xe1b7('0xa9')])};}}return respondWithRpcPromise(_0xe1b7('0xaa'),_0xe1b7('0xaa'),{'FaxAccountId':_[_0xe1b7('0xab')](_0xcf0244[_0xe1b7('0x51')]['id'])?undefined:_0xcf0244[_0xe1b7('0x51')]['id'],'path':_[_0xe1b7('0xab')](_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][0x0][_0xe1b7('0x7')])?undefined:_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][0x0][_0xe1b7('0x7')],'fax':_['isNil'](_0xcf0244[_0xe1b7('0x58')]['to'][0x0])?undefined:_0xcf0244[_0xe1b7('0x58')]['to'][0x0]},client9002);})[_0xe1b7('0x20')](function(){if(_0x170364){if(_[_0xe1b7('0xab')](_0xcf0244['body'][_0xe1b7('0xac')])){_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xac')]=util[_0xe1b7('0x9f')](_0xe1b7('0xad'),_0x170364[_0xe1b7('0x38')],_0x170364[_0xe1b7('0xae')]);}if(_0x170364[_0xe1b7('0xa2')]){if(_0x170364[_0xe1b7('0xa2')][_0xe1b7('0xa3')][_0xe1b7('0x45')]){return _0x170364[_0xe1b7('0xa2')][_0xe1b7('0xa3')][0x0];}else{return db[_0xe1b7('0x74')]['create'](_['defaults'](_0xcf0244['body'],{'firstName':_0xcf0244[_0xe1b7('0x58')]['to'][0x0],'phone':_0xcf0244['body']['to'][0x0],'fax':_0xcf0244[_0xe1b7('0x58')]['to'][0x0],'ListId':_0x170364[_0xe1b7('0x9a')]}));}}else{throw new Error(_0xe1b7('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xe1b7('0x20')](function(_0x21d314){if(_0x21d314){return db[_0xe1b7('0x71')][_0xe1b7('0x56')]({'where':{'ContactId':_0x21d314['id'],'closed':![],'FaxAccountId':_0x170364['id']}})[_0xe1b7('0x20')](function(_0x4b04f7){if(_0x4b04f7){return[_0x4b04f7,![]];}return db['FaxInteraction'][_0xe1b7('0x57')]({'UserId':_0xcf0244[_0xe1b7('0x59')]['id'],'ContactId':_0x21d314['id'],'FaxAccountId':_0x170364['id'],'fax':_0xcf0244[_0xe1b7('0x58')]['to'][0x0],'firstMsgDirection':_0xe1b7('0xb0'),'Messages':[_[_0xe1b7('0x4b')](_0xcf0244[_0xe1b7('0x58')],{'read':![],'body':_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][0x0][_0xe1b7('0xb1')],'FaxAccountId':_0x170364['id'],'UserId':_0xcf0244[_0xe1b7('0x59')]['id'],'ContactId':_0x21d314['id'],'AttachmentId':_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0xe1b7('0x9d')],'as':'Messages'}]})['then'](function(_0x35b987){return[_0x35b987,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x41f527,_0x44f958){if(_0x44f958){return _0x41f527;}return db[_0xe1b7('0x9d')][_0xe1b7('0x57')]({'direction':_0xe1b7('0xb0'),'read':![],'body':_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][0x0][_0xe1b7('0xb1')],'FaxAccountId':_0x170364['id'],'FaxInteractionId':_0x41f527['id'],'UserId':_0xcf0244[_0xe1b7('0x59')]['id'],'ContactId':_0x41f527[_0xe1b7('0xb2')],'AttachmentId':_0xcf0244['body']['attachments'][0x0]['id']})[_0xe1b7('0x20')](function(_0x10547a){_0x41f527[_0xe1b7('0xb3')][_0xe1b7('0xb4')]=[];_0x41f527['dataValues']['Messages'][_0xe1b7('0x89')](_0x10547a[_0xe1b7('0xb3')]);return _0x41f527;});})[_0xe1b7('0x20')](function(_0x1b48ad){respondWithRpcPromise(_0xe1b7('0xb5'),_0xe1b7('0xb5'),{'FaxAccountId':_[_0xe1b7('0xab')](_0xcf0244[_0xe1b7('0x51')]['id'])?undefined:_0xcf0244[_0xe1b7('0x51')]['id'],'path':_[_0xe1b7('0xab')](_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][0x0][_0xe1b7('0x7')])?undefined:_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][0x0]['path'],'fax':_['isNil'](_0xcf0244[_0xe1b7('0x58')]['to'][0x0])?undefined:_0xcf0244['body']['to'][0x0],'AttachmentId':_0xcf0244[_0xe1b7('0x58')][_0xe1b7('0xa5')][0x0]['id']},client9002)[_0xe1b7('0x20')](function(_0x295c5e){logger[_0xe1b7('0x21')](_0xe1b7('0xb6'),_0x295c5e);})[_0xe1b7('0x4f')](function(_0x1b0896){logger['info'](_0xe1b7('0xb6'),_0x1b0896);});return _0x1b48ad;})['then'](respondWithResult(_0xeb711b,null))[_0xe1b7('0x4f')](handleError(_0xeb711b,null));};exports[_0xe1b7('0xb7')]=function(_0x5e1b92,_0x39379a,_0x24aa99){return db[_0xe1b7('0x3a')][_0xe1b7('0x56')]({'where':{'id':_0x5e1b92[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x39379a,null))['then'](function(_0x96cc04){if(_0x96cc04){return _0x96cc04[_0xe1b7('0xb7')](_0x5e1b92['body'][_0xe1b7('0x6b')],_[_0xe1b7('0x72')](_0x5e1b92[_0xe1b7('0x58')],[_0xe1b7('0x6b'),'id'])||{})[_0xe1b7('0xb8')](function(_0x4afb59){for(var _0x290636=0x0;_0x290636<_0x5e1b92[_0xe1b7('0x58')][_0xe1b7('0x6b')]['length'];_0x290636+=0x1){socket[_0xe1b7('0xb9')](_0xe1b7('0xba'),{'UserId':_0x5e1b92[_0xe1b7('0x58')][_0xe1b7('0x6b')][_0x290636],'FaxAccountId':_0x5e1b92[_0xe1b7('0x51')]['id']});}return _0x4afb59;});}})[_0xe1b7('0x20')](respondWithResult(_0x39379a,null))[_0xe1b7('0x4f')](handleError(_0x39379a,null));};exports['removeAgents']=function(_0x4b2247,_0x9671df,_0x33ad44){return db[_0xe1b7('0x3a')][_0xe1b7('0x56')]({'where':{'id':_0x4b2247[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x9671df,null))[_0xe1b7('0x20')](function(_0x4f6558){if(_0x4f6558){return _0x4f6558[_0xe1b7('0xbb')](_0x4b2247['query'][_0xe1b7('0x6b')])[_0xe1b7('0x20')](function(){if(_[_0xe1b7('0xbc')](_0x4b2247[_0xe1b7('0x40')]['ids'])){for(var _0x1d7d5e=0x0;_0x1d7d5e<_0x4b2247[_0xe1b7('0x40')]['ids'][_0xe1b7('0x45')];_0x1d7d5e+=0x1){socket[_0xe1b7('0xb9')](_0xe1b7('0xbd'),{'UserId':Number(_0x4b2247[_0xe1b7('0x40')][_0xe1b7('0x6b')][_0x1d7d5e]),'FaxAccountId':Number(_0x4b2247[_0xe1b7('0x51')]['id'])});}}else{socket[_0xe1b7('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x4b2247[_0xe1b7('0x40')][_0xe1b7('0x6b')]),'FaxAccountId':Number(_0x4b2247[_0xe1b7('0x51')]['id'])});}});}})[_0xe1b7('0x20')](respondWithStatusCode(_0x9671df,null))[_0xe1b7('0x4f')](handleError(_0x9671df,null));};exports[_0xe1b7('0xbe')]=function(_0x49ef6e,_0x4ae7dc,_0x4d0817){var _0x29cb85={};var _0x3221ce={};var _0x24c4ba;var _0x585dbc;return db['FaxAccount'][_0xe1b7('0x66')]({'where':{'id':_0x49ef6e[_0xe1b7('0x51')]['id']}})[_0xe1b7('0x20')](handleEntityNotFound(_0x4ae7dc,null))['then'](function(_0x4b0528){if(_0x4b0528){_0x24c4ba=_0x4b0528;_0x3221ce[_0xe1b7('0x3e')]=_[_0xe1b7('0x41')](db[_0xe1b7('0xbf')][_0xe1b7('0x3b')]);_0x3221ce[_0xe1b7('0x40')]=_[_0xe1b7('0x41')](_0x49ef6e[_0xe1b7('0x40')]);_0x3221ce[_0xe1b7('0x49')]=_['intersection'](_0x3221ce[_0xe1b7('0x3e')],_0x3221ce[_0xe1b7('0x40')]);_0x29cb85[_0xe1b7('0x44')]=_[_0xe1b7('0x42')](_0x3221ce['model'],qs['fields'](_0x49ef6e[_0xe1b7('0x40')][_0xe1b7('0x43')]));_0x29cb85[_0xe1b7('0x44')]=_0x29cb85[_0xe1b7('0x44')][_0xe1b7('0x45')]?_0x29cb85['attributes']:_0x3221ce[_0xe1b7('0x3e')];_0x29cb85[_0xe1b7('0x47')]=qs[_0xe1b7('0x68')](_0x49ef6e[_0xe1b7('0x40')][_0xe1b7('0x68')]);_0x29cb85[_0xe1b7('0x48')]=qs['filters'](_[_0xe1b7('0x69')](_0x49ef6e['query'],_0x3221ce['filters']));if(_0x49ef6e[_0xe1b7('0x40')][_0xe1b7('0x4a')]){_0x29cb85[_0xe1b7('0x48')]=_[_0xe1b7('0x4b')](_0x29cb85[_0xe1b7('0x48')],{'$or':_[_0xe1b7('0x3f')](_0x29cb85['attributes'],function(_0x5c0d43){var _0x5adc4b={};_0x5adc4b[_0x5c0d43]={'$like':'%'+_0x49ef6e[_0xe1b7('0x40')][_0xe1b7('0x4a')]+'%'};return _0x5adc4b;})});}_0x29cb85=_['merge']({},_0x29cb85,_0x49ef6e['options']);return _0x24c4ba['getAgents'](_0x29cb85);}})[_0xe1b7('0x20')](function(_0x1aa5c9){if(_0x1aa5c9){_0x585dbc=_0x1aa5c9[_0xe1b7('0x45')];if(!_0x49ef6e[_0xe1b7('0x40')][_0xe1b7('0x67')](_0xe1b7('0x46'))){_0x29cb85[_0xe1b7('0x2e')]=qs[_0xe1b7('0x2e')](_0x49ef6e[_0xe1b7('0x40')][_0xe1b7('0x2e')]);_0x29cb85['offset']=qs['offset'](_0x49ef6e['query'][_0xe1b7('0x2d')]);}return _0x24c4ba['getAgents'](_0x29cb85);}})[_0xe1b7('0x20')](function(_0x5341e1){if(_0x5341e1){return _0x5341e1?{'count':_0x585dbc,'rows':_0x5341e1}:null;}})[_0xe1b7('0x20')](respondWithResult(_0x4ae7dc,null))[_0xe1b7('0x4f')](handleError(_0x4ae7dc,null));}; \ No newline at end of file +var _0x8edb=['headerinfo','maxrate','minrate','modem','t38timeout','push','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List','List\x20not\x20found','filename','Messages','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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','../../mysqldb','redis','defaults','socket.io-emitter','./faxAccount.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','fields','create','body','user','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','CDR(type)=inbound-fax','Set','ecm','gateway'];(function(_0x33a3b2,_0x179a67){var _0x2ab255=function(_0x2a63d8){while(--_0x2a63d8){_0x33a3b2['push'](_0x33a3b2['shift']());}};_0x2ab255(++_0x179a67);}(_0x8edb,0xf8));var _0xb8ed=function(_0x55b6cc,_0x33f45a){_0x55b6cc=_0x55b6cc-0x0;var _0xa7dee3=_0x8edb[_0x55b6cc];return _0xa7dee3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb8ed('0x0'));var rimraf=require(_0xb8ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8ed('0x2'));var rp=require(_0xb8ed('0x3'));var moment=require(_0xb8ed('0x4'));var BPromise=require(_0xb8ed('0x5'));var Mustache=require(_0xb8ed('0x6'));var util=require('util');var path=require(_0xb8ed('0x7'));var sox=require(_0xb8ed('0x8'));var csv=require(_0xb8ed('0x9'));var ejs=require(_0xb8ed('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb8ed('0xb'));var crypto=require(_0xb8ed('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb8ed('0xd'));var toCsv=require(_0xb8ed('0x9'));var querystring=require(_0xb8ed('0xe'));var Papa=require(_0xb8ed('0xf'));var Redis=require(_0xb8ed('0x10'));var authService=require(_0xb8ed('0x11'));var qs=require(_0xb8ed('0x12'));var as=require(_0xb8ed('0x13'));var hardwareService=require(_0xb8ed('0x14'));var logger=require(_0xb8ed('0x15'))(_0xb8ed('0x16'));var utils=require(_0xb8ed('0x17'));var config=require(_0xb8ed('0x18'));var db=require(_0xb8ed('0x19'))['db'];config[_0xb8ed('0x1a')]=_[_0xb8ed('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb8ed('0x1c'))(new Redis(config[_0xb8ed('0x1a')]));require(_0xb8ed('0x1d'))[_0xb8ed('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb8ed('0x1f')][_0xb8ed('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xb8ed('0x20')]({'port':0x232a});function checkPasswordPattern(_0x2c276f,_0x362e0d,_0xcf765d){if(_0xcf765d){var _0x51d448=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51d448[_0xb8ed('0x21')](_0x362e0d)){return _0x2c276f;}else{throw new db[(_0xb8ed('0x22'))]['ValidationError'](_0xb8ed('0x23'));}}else{return _0x2c276f;}}function respondWithRpcPromise(_0x3c38ef,_0x1e1c6f,_0x41f824,_0x3453f9){return new BPromise(function(_0x53a66e,_0x3bf512){var _0x116bc0=_0x3453f9||client;return _0x116bc0['request'](_0x3c38ef,_0x41f824)[_0xb8ed('0x24')](function(_0x165383){logger[_0xb8ed('0x25')](_0xb8ed('0x26'),_0x1e1c6f,_0xb8ed('0x27'));logger[_0xb8ed('0x28')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1e1c6f,'request\x20sent',JSON[_0xb8ed('0x29')](_0x165383));if(_0x165383[_0xb8ed('0x2a')]){if(_0x165383[_0xb8ed('0x2a')][_0xb8ed('0x2b')]===0x1f4){logger['error'](_0xb8ed('0x26'),_0x1e1c6f,_0x165383[_0xb8ed('0x2a')][_0xb8ed('0x2c')]);return _0x3bf512(_0x165383[_0xb8ed('0x2a')][_0xb8ed('0x2c')]);}logger[_0xb8ed('0x2a')](_0xb8ed('0x26'),_0x1e1c6f,_0x165383[_0xb8ed('0x2a')][_0xb8ed('0x2c')]);return _0x53a66e(_0x165383[_0xb8ed('0x2a')][_0xb8ed('0x2c')]);}else{logger['info'](_0xb8ed('0x26'),_0x1e1c6f,_0xb8ed('0x27'));_0x53a66e(_0x165383['result']['message']);}})[_0xb8ed('0x2d')](function(_0x29c36d){logger['error'](_0xb8ed('0x26'),_0x1e1c6f,_0x29c36d);_0x3bf512(_0x29c36d);});});}function respondWithStatusCode(_0x36ef67,_0x2d5de4){_0x2d5de4=_0x2d5de4||0xcc;return function(_0x18f7a0){if(_0x18f7a0){return _0x36ef67['sendStatus'](_0x2d5de4);}return _0x36ef67[_0xb8ed('0x2e')](_0x2d5de4)['end']();};}function respondWithResult(_0x150ba1,_0x2c24aa){_0x2c24aa=_0x2c24aa||0xc8;return function(_0x3e7643){if(_0x3e7643){return _0x150ba1[_0xb8ed('0x2e')](_0x2c24aa)[_0xb8ed('0x2f')](_0x3e7643);}};}function respondWithFilteredResult(_0x1351de,_0x4c509f){return function(_0x483f00){if(_0x483f00){var _0x261b88=_0x483f00[_0xb8ed('0x30')],_0x224b95=_0x4c509f['offset'],_0x396d92=_0x4c509f[_0xb8ed('0x31')]+_0x4c509f[_0xb8ed('0x32')],_0x3df67a;if(_0x396d92>=_0x261b88){_0x396d92=_0x261b88;_0x3df67a=0xc8;}else{_0x3df67a=0xce;}_0x1351de['status'](_0x3df67a);return _0x1351de[_0xb8ed('0x33')](_0xb8ed('0x34'),_0x224b95+'-'+_0x396d92+'/'+_0x261b88)[_0xb8ed('0x2f')](_0x483f00);}return null;};}function patchUpdates(_0x40342b){return function(_0x150b1e){try{jsonpatch[_0xb8ed('0x35')](_0x150b1e,_0x40342b,!![]);}catch(_0x20e1a6){return BPromise[_0xb8ed('0x36')](_0x20e1a6);}return _0x150b1e[_0xb8ed('0x37')]();};}function saveUpdates(_0x426136,_0x192a7a){return function(_0x51b9ea){if(_0x51b9ea){return _0x51b9ea[_0xb8ed('0x38')](_0x426136)[_0xb8ed('0x24')](function(_0x54a1ca){return _0x54a1ca;});}return null;};}function removeEntity(_0x4fff17,_0x1de029){return function(_0x3e91e8){if(_0x3e91e8){return _0x3e91e8[_0xb8ed('0x39')]()[_0xb8ed('0x24')](function(){var _0x43f574=_0x3e91e8['get']({'plain':!![]});var _0x37b5b2='FaxAccounts';return db[_0xb8ed('0x3a')]['destroy']({'where':{'type':_0x37b5b2,'resourceId':_0x43f574['id']}})[_0xb8ed('0x24')](function(){return _0x3e91e8;});})['then'](function(){_0x4fff17[_0xb8ed('0x2e')](0xcc)[_0xb8ed('0x3b')]();});}};}function handleEntityNotFound(_0xec109e,_0x95ddc6){return function(_0x58a96d){if(!_0x58a96d){_0xec109e[_0xb8ed('0x3c')](0x194);}return _0x58a96d;};}function handleError(_0x2afd80,_0xa1b33b){_0xa1b33b=_0xa1b33b||0x1f4;return function(_0x317593){logger[_0xb8ed('0x2a')](_0x317593[_0xb8ed('0x3d')]);if(_0x317593[_0xb8ed('0x3e')]){delete _0x317593[_0xb8ed('0x3e')];}_0x2afd80['status'](_0xa1b33b)[_0xb8ed('0x3f')](_0x317593);};}exports[_0xb8ed('0x40')]=function(_0x4d8df2,_0x344c65){var _0x1986ca={'include':[{'model':db[_0xb8ed('0x41')],'as':_0xb8ed('0x42')}]},_0x21c5c3={},_0x4fe1c2={'count':0x0,'rows':[]};var _0x17c2d6=_[_0xb8ed('0x43')](db[_0xb8ed('0x44')][_0xb8ed('0x45')],function(_0x62b576){return{'name':_0x62b576[_0xb8ed('0x46')],'type':_0x62b576[_0xb8ed('0x47')][_0xb8ed('0x48')]};});_0x21c5c3[_0xb8ed('0x49')]=_[_0xb8ed('0x43')](_0x17c2d6,'name');_0x21c5c3[_0xb8ed('0x4a')]=_['keys'](_0x4d8df2['query']);_0x21c5c3[_0xb8ed('0x4b')]=_[_0xb8ed('0x4c')](_0x21c5c3[_0xb8ed('0x49')],_0x21c5c3[_0xb8ed('0x4a')]);_0x1986ca['attributes']=_[_0xb8ed('0x4c')](_0x21c5c3['model'],qs['fields'](_0x4d8df2['query']['fields']));_0x1986ca['attributes']=_0x1986ca['attributes'][_0xb8ed('0x4d')]?_0x1986ca[_0xb8ed('0x4e')]:_0x21c5c3[_0xb8ed('0x49')];if(!_0x4d8df2[_0xb8ed('0x4a')][_0xb8ed('0x4f')](_0xb8ed('0x50'))){_0x1986ca[_0xb8ed('0x32')]=qs[_0xb8ed('0x32')](_0x4d8df2['query']['limit']);_0x1986ca[_0xb8ed('0x31')]=qs[_0xb8ed('0x31')](_0x4d8df2['query'][_0xb8ed('0x31')]);}_0x1986ca['order']=qs[_0xb8ed('0x51')](_0x4d8df2[_0xb8ed('0x4a')][_0xb8ed('0x51')]);_0x1986ca[_0xb8ed('0x52')]=qs[_0xb8ed('0x4b')](_[_0xb8ed('0x53')](_0x4d8df2[_0xb8ed('0x4a')],_0x21c5c3[_0xb8ed('0x4b')]),_0x17c2d6);if(_0x4d8df2[_0xb8ed('0x4a')][_0xb8ed('0x54')]){_0x1986ca[_0xb8ed('0x52')]=_[_0xb8ed('0x55')](_0x1986ca[_0xb8ed('0x52')],{'$or':_[_0xb8ed('0x43')](_0x17c2d6,function(_0x4c056c){if(_0x4c056c[_0xb8ed('0x47')]!=='VIRTUAL'){var _0x5896fb={};_0x5896fb[_0x4c056c[_0xb8ed('0x3e')]]={'$like':'%'+_0x4d8df2[_0xb8ed('0x4a')][_0xb8ed('0x54')]+'%'};return _0x5896fb;}})});}_0x1986ca=_[_0xb8ed('0x55')]({},_0x1986ca,_0x4d8df2[_0xb8ed('0x56')]);var _0x4e2437={'where':_0x1986ca[_0xb8ed('0x52')]};return db[_0xb8ed('0x44')][_0xb8ed('0x30')](_0x4e2437)[_0xb8ed('0x24')](function(_0x471205){_0x4fe1c2['count']=_0x471205;if(_0x4d8df2[_0xb8ed('0x4a')][_0xb8ed('0x57')]){_0x1986ca[_0xb8ed('0x58')]=[{'all':!![]}];}return db[_0xb8ed('0x44')][_0xb8ed('0x59')](_0x1986ca);})[_0xb8ed('0x24')](function(_0x4c48e9){_0x4fe1c2[_0xb8ed('0x5a')]=_0x4c48e9;return _0x4fe1c2;})[_0xb8ed('0x24')](respondWithFilteredResult(_0x344c65,_0x1986ca))[_0xb8ed('0x2d')](handleError(_0x344c65,null));};exports[_0xb8ed('0x5b')]=function(_0x4de98a,_0x5da73c){var _0x1ca342={'raw':![],'where':{'id':_0x4de98a[_0xb8ed('0x5c')]['id']},'include':[{'model':db[_0xb8ed('0x41')],'as':_0xb8ed('0x42')}]},_0x44ed1b={};_0x44ed1b['model']=_[_0xb8ed('0x5d')](db[_0xb8ed('0x44')][_0xb8ed('0x45')]);_0x44ed1b[_0xb8ed('0x4a')]=_['keys'](_0x4de98a[_0xb8ed('0x4a')]);_0x44ed1b[_0xb8ed('0x4b')]=_[_0xb8ed('0x4c')](_0x44ed1b[_0xb8ed('0x49')],_0x44ed1b[_0xb8ed('0x4a')]);_0x1ca342['attributes']=_[_0xb8ed('0x4c')](_0x44ed1b['model'],qs['fields'](_0x4de98a[_0xb8ed('0x4a')][_0xb8ed('0x5e')]));_0x1ca342[_0xb8ed('0x4e')]=_0x1ca342['attributes'][_0xb8ed('0x4d')]?_0x1ca342['attributes']:_0x44ed1b[_0xb8ed('0x49')];if(_0x4de98a['query'][_0xb8ed('0x57')]){_0x1ca342[_0xb8ed('0x58')]=[{'all':!![]}];}_0x1ca342=_[_0xb8ed('0x55')]({},_0x1ca342,_0x4de98a[_0xb8ed('0x56')]);return db[_0xb8ed('0x44')]['find'](_0x1ca342)['then'](handleEntityNotFound(_0x5da73c,null))[_0xb8ed('0x24')](respondWithResult(_0x5da73c,null))[_0xb8ed('0x2d')](handleError(_0x5da73c,null));};exports[_0xb8ed('0x5f')]=function(_0x4f0843,_0x1eed46){return db[_0xb8ed('0x44')][_0xb8ed('0x5f')](_0x4f0843[_0xb8ed('0x60')],{})['then'](function(_0xed3ebd){var _0x5a9611=_0x4f0843[_0xb8ed('0x61')]['get']({'plain':!![]});if(!_0x5a9611)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a9611['role']===_0xb8ed('0x61')){var _0x1e03f=_0xed3ebd['get']({'plain':!![]});var _0x96d9f5=_0xb8ed('0x62');return db[_0xb8ed('0x63')][_0xb8ed('0x64')]({'where':{'name':_0x96d9f5,'userProfileId':_0x5a9611[_0xb8ed('0x65')]},'raw':!![]})['then'](function(_0x903292){if(_0x903292&&_0x903292[_0xb8ed('0x66')]===0x0){return db[_0xb8ed('0x3a')][_0xb8ed('0x5f')]({'name':_0x1e03f[_0xb8ed('0x3e')],'resourceId':_0x1e03f['id'],'type':_0x903292[_0xb8ed('0x3e')],'sectionId':_0x903292['id']},{})['then'](function(){return _0xed3ebd;});}else{return _0xed3ebd;}})[_0xb8ed('0x2d')](function(_0x276733){logger[_0xb8ed('0x2a')](_0xb8ed('0x67'),_0x276733);throw _0x276733;});}return _0xed3ebd;})[_0xb8ed('0x24')](respondWithResult(_0x1eed46,0xc9))[_0xb8ed('0x2d')](handleError(_0x1eed46,null));};exports['update']=function(_0x52360a,_0x2a9d23){if(_0x52360a[_0xb8ed('0x60')]['id']){delete _0x52360a[_0xb8ed('0x60')]['id'];}return db[_0xb8ed('0x44')][_0xb8ed('0x64')]({'where':{'id':_0x52360a[_0xb8ed('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0xb8ed('0x42')}]})[_0xb8ed('0x24')](handleEntityNotFound(_0x2a9d23,null))[_0xb8ed('0x24')](saveUpdates(_0x52360a[_0xb8ed('0x60')],null))[_0xb8ed('0x24')](respondWithResult(_0x2a9d23,null))['catch'](handleError(_0x2a9d23,null));};exports[_0xb8ed('0x39')]=function(_0x4ad3d0,_0x307b23){return db[_0xb8ed('0x44')]['find']({'where':{'id':_0x4ad3d0[_0xb8ed('0x5c')]['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x307b23,null))[_0xb8ed('0x24')](removeEntity(_0x307b23,null))[_0xb8ed('0x2d')](handleError(_0x307b23,null));};exports[_0xb8ed('0x68')]=function(_0x2d77bf,_0x55ebd2){return db[_0xb8ed('0x44')]['describe']()['then'](respondWithResult(_0x55ebd2,null))[_0xb8ed('0x2d')](handleError(_0x55ebd2,null));};exports[_0xb8ed('0x69')]=function(_0x544ef4,_0x5076d0,_0x197f14){if(_0x544ef4[_0xb8ed('0x60')]['id']){delete _0x544ef4[_0xb8ed('0x60')]['id'];}return db[_0xb8ed('0x44')]['find']({'where':{'id':_0x544ef4[_0xb8ed('0x5c')]['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x5076d0,null))['then'](function(_0x36f09e){if(_0x36f09e){_0x544ef4['body'][_0xb8ed('0x6a')]=_0x36f09e['id'];return db[_0xb8ed('0x6b')][_0xb8ed('0x5f')](_0x544ef4[_0xb8ed('0x60')]);}})[_0xb8ed('0x24')](respondWithResult(_0x5076d0,null))[_0xb8ed('0x2d')](handleError(_0x5076d0,null));};exports['getDispositions']=function(_0x557684,_0x467152,_0x54b846){var _0x4c3cc6={'raw':![],'where':{}};var _0x1b1900={};var _0x1d1307={'count':0x0,'rows':[]};return db[_0xb8ed('0x44')][_0xb8ed('0x6c')]({'where':{'id':_0x557684[_0xb8ed('0x5c')]['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x467152,null))[_0xb8ed('0x24')](function(_0x104700){if(_0x104700){_0x1b1900[_0xb8ed('0x49')]=_['keys'](db[_0xb8ed('0x6b')][_0xb8ed('0x45')]);_0x1b1900[_0xb8ed('0x4a')]=_[_0xb8ed('0x5d')](_0x557684[_0xb8ed('0x4a')]);_0x1b1900[_0xb8ed('0x4b')]=_['intersection'](_0x1b1900[_0xb8ed('0x49')],_0x1b1900[_0xb8ed('0x4a')]);_0x4c3cc6['attributes']=_[_0xb8ed('0x4c')](_0x1b1900[_0xb8ed('0x49')],qs[_0xb8ed('0x5e')](_0x557684[_0xb8ed('0x4a')]['fields']));_0x4c3cc6[_0xb8ed('0x4e')]=_0x4c3cc6['attributes'][_0xb8ed('0x4d')]?_0x4c3cc6[_0xb8ed('0x4e')]:_0x1b1900[_0xb8ed('0x49')];if(!_0x557684['query'][_0xb8ed('0x4f')](_0xb8ed('0x50'))){_0x4c3cc6['limit']=qs[_0xb8ed('0x32')](_0x557684['query'][_0xb8ed('0x32')]);_0x4c3cc6[_0xb8ed('0x31')]=qs[_0xb8ed('0x31')](_0x557684[_0xb8ed('0x4a')][_0xb8ed('0x31')]);}_0x4c3cc6[_0xb8ed('0x6d')]=qs[_0xb8ed('0x51')](_0x557684[_0xb8ed('0x4a')]['sort']);_0x4c3cc6[_0xb8ed('0x52')]=qs['filters'](_['pick'](_0x557684[_0xb8ed('0x4a')],_0x1b1900['filters']));_0x4c3cc6[_0xb8ed('0x52')][_0xb8ed('0x6a')]=_0x104700['id'];if(_0x557684[_0xb8ed('0x4a')]['filter']){_0x4c3cc6[_0xb8ed('0x52')]=_[_0xb8ed('0x55')](_0x4c3cc6['where'],{'$or':_[_0xb8ed('0x43')](_0x4c3cc6['attributes'],function(_0x58f201){var _0x1e303a={};_0x1e303a[_0x58f201]={'$like':'%'+_0x557684[_0xb8ed('0x4a')][_0xb8ed('0x54')]+'%'};return _0x1e303a;})});}_0x4c3cc6=_[_0xb8ed('0x55')]({},_0x4c3cc6,_0x557684[_0xb8ed('0x56')]);return db[_0xb8ed('0x6b')]['count']({'where':_0x4c3cc6['where']})[_0xb8ed('0x24')](function(_0x2d8b27){_0x1d1307['count']=_0x2d8b27;if(_0x557684[_0xb8ed('0x4a')][_0xb8ed('0x57')]){_0x4c3cc6[_0xb8ed('0x58')]=[{'all':!![]}];}return db[_0xb8ed('0x6b')]['findAll'](_0x4c3cc6);})['then'](function(_0x322147){_0x1d1307[_0xb8ed('0x5a')]=_0x322147;return _0x1d1307;});}})[_0xb8ed('0x24')](respondWithFilteredResult(_0x467152,_0x4c3cc6))[_0xb8ed('0x2d')](handleError(_0x467152,null));};exports[_0xb8ed('0x6e')]=function(_0x48eff7,_0x16b658,_0xc013c6){return db[_0xb8ed('0x44')][_0xb8ed('0x64')]({'where':{'id':_0x48eff7[_0xb8ed('0x5c')]['id']}})['then'](handleEntityNotFound(_0x16b658,null))[_0xb8ed('0x24')](function(_0x821f4e){if(_0x821f4e){return _0x821f4e[_0xb8ed('0x6e')](_0x48eff7[_0xb8ed('0x4a')][_0xb8ed('0x6f')]);}})[_0xb8ed('0x24')](respondWithStatusCode(_0x16b658,null))[_0xb8ed('0x2d')](handleError(_0x16b658,null));};exports[_0xb8ed('0x70')]=function(_0x468b54,_0x14a81a,_0x1efb9d){if(_0x468b54[_0xb8ed('0x60')]['id']){delete _0x468b54[_0xb8ed('0x60')]['id'];}return db[_0xb8ed('0x44')][_0xb8ed('0x64')]({'where':{'id':_0x468b54[_0xb8ed('0x5c')]['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x14a81a,null))['then'](function(_0x336979){if(_0x336979){_0x468b54[_0xb8ed('0x60')][_0xb8ed('0x6a')]=_0x336979['id'];return db[_0xb8ed('0x71')]['create'](_0x468b54[_0xb8ed('0x60')]);}})['then'](respondWithResult(_0x14a81a,null))[_0xb8ed('0x2d')](handleError(_0x14a81a,null));};exports[_0xb8ed('0x72')]=function(_0x504451,_0x37dfbc,_0x50893b){var _0x36a31c={'raw':![],'where':{}};var _0x3c481f={};var _0x448420={'count':0x0,'rows':[]};return db[_0xb8ed('0x44')][_0xb8ed('0x6c')]({'where':{'id':_0x504451[_0xb8ed('0x5c')]['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x37dfbc,null))[_0xb8ed('0x24')](function(_0x549c23){if(_0x549c23){_0x3c481f[_0xb8ed('0x49')]=_[_0xb8ed('0x5d')](db['CannedAnswer']['rawAttributes']);_0x3c481f[_0xb8ed('0x4a')]=_[_0xb8ed('0x5d')](_0x504451[_0xb8ed('0x4a')]);_0x3c481f[_0xb8ed('0x4b')]=_[_0xb8ed('0x4c')](_0x3c481f[_0xb8ed('0x49')],_0x3c481f['query']);_0x36a31c[_0xb8ed('0x4e')]=_[_0xb8ed('0x4c')](_0x3c481f[_0xb8ed('0x49')],qs[_0xb8ed('0x5e')](_0x504451[_0xb8ed('0x4a')]['fields']));_0x36a31c[_0xb8ed('0x4e')]=_0x36a31c[_0xb8ed('0x4e')][_0xb8ed('0x4d')]?_0x36a31c[_0xb8ed('0x4e')]:_0x3c481f['model'];if(!_0x504451[_0xb8ed('0x4a')][_0xb8ed('0x4f')]('nolimit')){_0x36a31c['limit']=qs[_0xb8ed('0x32')](_0x504451[_0xb8ed('0x4a')][_0xb8ed('0x32')]);_0x36a31c[_0xb8ed('0x31')]=qs[_0xb8ed('0x31')](_0x504451[_0xb8ed('0x4a')]['offset']);}_0x36a31c[_0xb8ed('0x6d')]=qs[_0xb8ed('0x51')](_0x504451[_0xb8ed('0x4a')][_0xb8ed('0x51')]);_0x36a31c[_0xb8ed('0x52')]=qs['filters'](_['pick'](_0x504451[_0xb8ed('0x4a')],_0x3c481f[_0xb8ed('0x4b')]));_0x36a31c[_0xb8ed('0x52')][_0xb8ed('0x6a')]=_0x549c23['id'];if(_0x504451[_0xb8ed('0x4a')][_0xb8ed('0x54')]){_0x36a31c[_0xb8ed('0x52')]=_[_0xb8ed('0x55')](_0x36a31c[_0xb8ed('0x52')],{'$or':_[_0xb8ed('0x43')](_0x36a31c[_0xb8ed('0x4e')],function(_0x3e5b06){var _0x1f0534={};_0x1f0534[_0x3e5b06]={'$like':'%'+_0x504451['query'][_0xb8ed('0x54')]+'%'};return _0x1f0534;})});}_0x36a31c=_[_0xb8ed('0x55')]({},_0x36a31c,_0x504451[_0xb8ed('0x56')]);return db[_0xb8ed('0x71')][_0xb8ed('0x30')]({'where':_0x36a31c[_0xb8ed('0x52')]})[_0xb8ed('0x24')](function(_0x24ab00){_0x448420[_0xb8ed('0x30')]=_0x24ab00;if(_0x504451[_0xb8ed('0x4a')][_0xb8ed('0x57')]){_0x36a31c[_0xb8ed('0x58')]=[{'all':!![]}];}return db[_0xb8ed('0x71')][_0xb8ed('0x59')](_0x36a31c);})[_0xb8ed('0x24')](function(_0x27f6cc){_0x448420['rows']=_0x27f6cc;return _0x448420;});}})[_0xb8ed('0x24')](respondWithFilteredResult(_0x37dfbc,_0x36a31c))[_0xb8ed('0x2d')](handleError(_0x37dfbc,null));};exports[_0xb8ed('0x73')]=function(_0x13bf5b,_0x1de121,_0x4d5486){return db['FaxAccount']['find']({'where':{'id':_0x13bf5b['params']['id']}})['then'](handleEntityNotFound(_0x1de121,null))[_0xb8ed('0x24')](function(_0x138017){if(_0x138017){return _0x138017[_0xb8ed('0x73')](_0x13bf5b[_0xb8ed('0x4a')][_0xb8ed('0x6f')]);}})[_0xb8ed('0x24')](respondWithStatusCode(_0x1de121,null))[_0xb8ed('0x2d')](handleError(_0x1de121,null));};exports[_0xb8ed('0x74')]=function(_0x496bc8,_0x464044,_0x5525d4){return db[_0xb8ed('0x75')]['find']({'where':{'id':_0x496bc8[_0xb8ed('0x5c')]['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x464044,null))['then'](function(_0xa52ed5){if(_0xa52ed5){return _0xa52ed5[_0xb8ed('0x74')](_0x496bc8[_0xb8ed('0x60')][_0xb8ed('0x6f')],_[_0xb8ed('0x76')](_0x496bc8['body'],[_0xb8ed('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x464044,null))[_0xb8ed('0x2d')](handleError(_0x464044,null));};exports[_0xb8ed('0x77')]=function(_0x373235,_0x3b96fd,_0x1578ce){var _0x489a38={'raw':![],'where':{}};var _0x3995eb={};var _0x38b349={'count':0x0,'rows':[]};return db[_0xb8ed('0x44')][_0xb8ed('0x6c')]({'where':{'id':_0x373235['params']['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x3b96fd,null))[_0xb8ed('0x24')](function(_0x1c444d){if(_0x1c444d){_0x3995eb[_0xb8ed('0x49')]=_['keys'](db[_0xb8ed('0x75')][_0xb8ed('0x45')]);_0x3995eb['query']=_[_0xb8ed('0x5d')](_0x373235['query']);_0x3995eb[_0xb8ed('0x4b')]=_[_0xb8ed('0x4c')](_0x3995eb[_0xb8ed('0x49')],_0x3995eb['query']);_0x489a38['attributes']=_[_0xb8ed('0x4c')](_0x3995eb['model'],qs[_0xb8ed('0x5e')](_0x373235[_0xb8ed('0x4a')][_0xb8ed('0x5e')]));_0x489a38[_0xb8ed('0x4e')]=_0x489a38['attributes']['length']?_0x489a38[_0xb8ed('0x4e')]:_0x3995eb['model'];if(!_0x373235[_0xb8ed('0x4a')]['hasOwnProperty']('nolimit')){_0x489a38[_0xb8ed('0x32')]=qs[_0xb8ed('0x32')](_0x373235[_0xb8ed('0x4a')][_0xb8ed('0x32')]);_0x489a38[_0xb8ed('0x31')]=qs[_0xb8ed('0x31')](_0x373235[_0xb8ed('0x4a')][_0xb8ed('0x31')]);}_0x489a38['order']=qs['sort'](_0x373235[_0xb8ed('0x4a')][_0xb8ed('0x51')]);_0x489a38[_0xb8ed('0x52')]=qs[_0xb8ed('0x4b')](_[_0xb8ed('0x53')](_0x373235[_0xb8ed('0x4a')],_0x3995eb[_0xb8ed('0x4b')]));_0x489a38[_0xb8ed('0x52')]['FaxAccountId']=_0x1c444d['id'];if(_0x373235[_0xb8ed('0x4a')][_0xb8ed('0x54')]){_0x489a38[_0xb8ed('0x52')]=_[_0xb8ed('0x55')](_0x489a38[_0xb8ed('0x52')],{'$or':_[_0xb8ed('0x43')](_0x489a38[_0xb8ed('0x4e')],function(_0x22e401){var _0x37c212={};_0x37c212[_0x22e401]={'$like':'%'+_0x373235['query'][_0xb8ed('0x54')]+'%'};return _0x37c212;})});}_0x489a38=_[_0xb8ed('0x55')]({},_0x489a38,_0x373235[_0xb8ed('0x56')]);return db[_0xb8ed('0x75')][_0xb8ed('0x30')]({'where':_0x489a38[_0xb8ed('0x52')]})[_0xb8ed('0x24')](function(_0x2e0a28){_0x38b349[_0xb8ed('0x30')]=_0x2e0a28;if(_0x373235[_0xb8ed('0x4a')][_0xb8ed('0x57')]){_0x489a38[_0xb8ed('0x58')]=[{'model':db[_0xb8ed('0x78')],'as':_0xb8ed('0x79'),'required':![]},{'model':db[_0xb8ed('0x7a')],'as':_0xb8ed('0x7b'),'attributes':[_0xb8ed('0x3e'),_0xb8ed('0x7c'),'internal'],'required':![]},{'model':db[_0xb8ed('0x7d')],'as':_0xb8ed('0x7e'),'attributes':['id',_0xb8ed('0x3e'),'color'],'where':_0x373235[_0xb8ed('0x4a')][_0xb8ed('0x7f')]?{'id':_0x373235[_0xb8ed('0x4a')]['tag']}:undefined,'required':_0x373235[_0xb8ed('0x4a')][_0xb8ed('0x7f')]?!![]:![]}];}return db[_0xb8ed('0x75')][_0xb8ed('0x59')](_0x489a38);})[_0xb8ed('0x24')](function(_0x5724ca){_0x38b349[_0xb8ed('0x5a')]=_0x5724ca;return _0x38b349;});}})[_0xb8ed('0x24')](respondWithFilteredResult(_0x3b96fd,_0x489a38))[_0xb8ed('0x2d')](handleError(_0x3b96fd,null));};exports[_0xb8ed('0x80')]=function(_0x22e7e8,_0x21d33c,_0x5ac04b){return db['FaxAccount'][_0xb8ed('0x6c')]({'where':{'id':_0x22e7e8['params']['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x21d33c,null))[_0xb8ed('0x24')](function(_0x29614d){if(_0x29614d){return db[_0xb8ed('0x81')][_0xb8ed('0x82')](function(_0x401aa1){return db[_0xb8ed('0x83')][_0xb8ed('0x39')]({'where':{'FaxAccountId':_0x22e7e8[_0xb8ed('0x5c')]['id']},'transaction':_0x401aa1})['then'](function(_0x217fa0){var _0x26d69b=_[_0xb8ed('0x43')](_0x22e7e8[_0xb8ed('0x60')],function(_0xa09b4d){_0xa09b4d['FaxAccountId']=_0x22e7e8[_0xb8ed('0x5c')]['id'];return _0xa09b4d;});return db[_0xb8ed('0x83')]['bulkCreate'](_0x26d69b,{'transaction':_0x401aa1});});})[_0xb8ed('0x24')](function(){return db[_0xb8ed('0x83')][_0xb8ed('0x84')]({'where':{'FaxAccountId':_0x22e7e8['params']['id']},'order':_0xb8ed('0x85')});});}})[_0xb8ed('0x24')](respondWithResult(_0x21d33c,null))[_0xb8ed('0x2d')](handleError(_0x21d33c,null));};exports[_0xb8ed('0x86')]=function(_0x225e90,_0x3101da,_0x4291b1){var _0x33f9e9={};var _0x1fdaa5={};var _0x370181;var _0x903e87;return db[_0xb8ed('0x44')][_0xb8ed('0x6c')]({'where':{'id':_0x225e90['params']['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x3101da,null))[_0xb8ed('0x24')](function(_0x17e469){if(_0x17e469){_0x370181=_0x17e469;_0x1fdaa5[_0xb8ed('0x49')]=_['keys'](db['FaxApplication'][_0xb8ed('0x45')]);_0x1fdaa5[_0xb8ed('0x4a')]=_[_0xb8ed('0x5d')](_0x225e90['query']);_0x1fdaa5[_0xb8ed('0x4b')]=_['intersection'](_0x1fdaa5[_0xb8ed('0x49')],_0x1fdaa5[_0xb8ed('0x4a')]);_0x33f9e9[_0xb8ed('0x4e')]=_[_0xb8ed('0x4c')](_0x1fdaa5[_0xb8ed('0x49')],qs[_0xb8ed('0x5e')](_0x225e90['query'][_0xb8ed('0x5e')]));_0x33f9e9['attributes']=_0x33f9e9[_0xb8ed('0x4e')][_0xb8ed('0x4d')]?_0x33f9e9['attributes']:_0x1fdaa5[_0xb8ed('0x49')];_0x33f9e9[_0xb8ed('0x6d')]=qs[_0xb8ed('0x51')](_0x225e90['query']['sort']);_0x33f9e9[_0xb8ed('0x52')]=qs[_0xb8ed('0x4b')](_['pick'](_0x225e90[_0xb8ed('0x4a')],_0x1fdaa5[_0xb8ed('0x4b')]));if(_0x225e90[_0xb8ed('0x4a')]['filter']){_0x33f9e9[_0xb8ed('0x52')]=_[_0xb8ed('0x55')](_0x33f9e9[_0xb8ed('0x52')],{'$or':_[_0xb8ed('0x43')](_0x33f9e9[_0xb8ed('0x4e')],function(_0x354832){var _0x40d3f5={};_0x40d3f5[_0x354832]={'$like':'%'+_0x225e90[_0xb8ed('0x4a')][_0xb8ed('0x54')]+'%'};return _0x40d3f5;})});}_0x33f9e9=_[_0xb8ed('0x55')]({},_0x33f9e9,_0x225e90[_0xb8ed('0x56')]);return _0x370181[_0xb8ed('0x86')](_0x33f9e9);}})[_0xb8ed('0x24')](function(_0x860905){if(_0x860905){_0x903e87=_0x860905[_0xb8ed('0x4d')];if(!_0x225e90[_0xb8ed('0x4a')][_0xb8ed('0x4f')](_0xb8ed('0x50'))){_0x33f9e9[_0xb8ed('0x32')]=qs[_0xb8ed('0x32')](_0x225e90['query'][_0xb8ed('0x32')]);_0x33f9e9['offset']=qs[_0xb8ed('0x31')](_0x225e90[_0xb8ed('0x4a')][_0xb8ed('0x31')]);}return _0x370181[_0xb8ed('0x86')](_0x33f9e9);}})[_0xb8ed('0x24')](function(_0x2d3467){if(_0x2d3467){return _0x2d3467?{'count':_0x903e87,'rows':_0x2d3467}:null;}})[_0xb8ed('0x24')](respondWithResult(_0x3101da,null))['catch'](handleError(_0x3101da,null));};function Extension(_0x720e48,_0x5bd3d3,_0x4fe22d,_0xa8b2f0){this[_0xb8ed('0x87')]=_0xb8ed('0x88');this[_0xb8ed('0x89')]=_0x720e48[_0xb8ed('0x8a')];this[_0xb8ed('0x8b')]=_0xa8b2f0;this[_0xb8ed('0x47')]=_0xb8ed('0x8c');this[_0xb8ed('0x8d')]=_0xb8ed('0x8e');this['FaxAccountId']=_0x720e48['id'];this['priority']=_0x5bd3d3;this[_0xb8ed('0x8f')]=_0x4fe22d;}function createExtensionsReciveFax(_0xe3962e){var _0x5b2255=0x1;var _0x51b114=[];_0x51b114['push'](new Extension(_0xe3962e,_0x5b2255,'','Answer'));_0x5b2255+=0x1;_0x51b114['push'](new Extension(_0xe3962e,_0x5b2255,_0xb8ed('0x90'),_0xb8ed('0x91')));_0x5b2255+=0x1;for(var _0xbb8e8b in _0xe3962e){if(_0xe3962e[_0xb8ed('0x4f')](_0xbb8e8b)&&(_0xbb8e8b===_0xb8ed('0x92')||_0xbb8e8b===_0xb8ed('0x8a')||_0xbb8e8b===_0xb8ed('0x93')||_0xbb8e8b==='faxdetect'||_0xbb8e8b===_0xb8ed('0x94')||_0xbb8e8b===_0xb8ed('0x95')||_0xbb8e8b===_0xb8ed('0x96')||_0xbb8e8b===_0xb8ed('0x97')||_0xbb8e8b===_0xb8ed('0x98'))){_0x51b114[_0xb8ed('0x99')](new Extension(_0xe3962e,_0x5b2255,'FAXOPT('+_0xbb8e8b+')='+_0xe3962e[_0xbb8e8b],'Set'));_0x5b2255+=0x1;}}_0x51b114[_0xb8ed('0x99')](new Extension(_0xe3962e,_0x5b2255,'6','Wait'));_0x5b2255+=0x1;_0x51b114[_0xb8ed('0x99')](new Extension(_0xe3962e,_0x5b2255,_0xb8ed('0x9a'),_0xb8ed('0x9b')));_0x5b2255=0x0;return _0x51b114;}exports[_0xb8ed('0x9c')]=function(_0x16ea0d,_0x52c587,_0x4cd28d){var _0x1b2cb5;return db[_0xb8ed('0x81')][_0xb8ed('0x82')](function(_0x578ad3){return db['FaxAccount']['create'](_0x16ea0d[_0xb8ed('0x60')],{'transaction':_0x578ad3})[_0xb8ed('0x24')](function(_0x31bbd9){_0x1b2cb5=_0x31bbd9['get']({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x1b2cb5),{'transaction':_0x578ad3});});})[_0xb8ed('0x24')](function(){return _0x1b2cb5;})[_0xb8ed('0x24')](respondWithResult(_0x52c587,null))[_0xb8ed('0x2d')](handleError(_0x52c587,null));};exports[_0xb8ed('0x9d')]=function(_0x4463a1,_0x29576c,_0xe7a7e4){var _0x625aaa;return db[_0xb8ed('0x81')][_0xb8ed('0x82')](function(_0x295bab){return db['FaxAccount'][_0xb8ed('0x38')](_0x4463a1[_0xb8ed('0x60')],{'where':{'id':_0x4463a1[_0xb8ed('0x60')]['id']},'transaction':_0x295bab})[_0xb8ed('0x24')](function(_0x2a7999){return db[_0xb8ed('0x9e')][_0xb8ed('0x39')]({'where':{'FaxAccountId':_0x4463a1['body']['id']},'transaction':_0x295bab})[_0xb8ed('0x24')](function(_0x3f6c01){return db[_0xb8ed('0x9e')][_0xb8ed('0x9f')](createExtensionsReciveFax(_[_0xb8ed('0x76')](_0x4463a1[_0xb8ed('0x60')],[_0xb8ed('0xa0'),'key',_0xb8ed('0xa1'),_0xb8ed('0xa2'),'TrunkId',_0xb8ed('0xa3')])),{'transaction':_0x295bab});});});})[_0xb8ed('0x24')](function(){return db[_0xb8ed('0x44')][_0xb8ed('0xa4')](_0x4463a1[_0xb8ed('0x60')]['id']);})[_0xb8ed('0x24')](respondWithResult(_0x29576c,null))[_0xb8ed('0x2d')](handleError(_0x29576c,null));};exports[_0xb8ed('0xa5')]=function(_0x21bdd2,_0x45d2fd,_0xaaefea){var _0x296b39={'raw':!![],'where':{}};var _0x3a5fbf={};var _0x39f3ce={'count':0x0,'rows':[]};return db[_0xb8ed('0x44')][_0xb8ed('0x6c')]({'where':{'id':_0x21bdd2[_0xb8ed('0x5c')]['id']}})[_0xb8ed('0x24')](handleEntityNotFound(_0x45d2fd,null))['then'](function(_0xfdf649){if(_0xfdf649){_0x3a5fbf['model']=_['keys'](db[_0xb8ed('0xa6')]['rawAttributes']);_0x3a5fbf[_0xb8ed('0x4a')]=_[_0xb8ed('0x5d')](_0x21bdd2['query']);_0x3a5fbf[_0xb8ed('0x4b')]=_[_0xb8ed('0x4c')](_0x3a5fbf['model'],_0x3a5fbf[_0xb8ed('0x4a')]);_0x296b39[_0xb8ed('0x4e')]=_[_0xb8ed('0x4c')](_0x3a5fbf['model'],qs[_0xb8ed('0x5e')](_0x21bdd2[_0xb8ed('0x4a')][_0xb8ed('0x5e')]));_0x296b39['attributes']=_0x296b39[_0xb8ed('0x4e')][_0xb8ed('0x4d')]?_0x296b39[_0xb8ed('0x4e')]:_0x3a5fbf[_0xb8ed('0x49')];if(!_0x21bdd2['query'][_0xb8ed('0x4f')](_0xb8ed('0x50'))){_0x296b39[_0xb8ed('0x32')]=qs[_0xb8ed('0x32')](_0x21bdd2['query'][_0xb8ed('0x32')]);_0x296b39[_0xb8ed('0x31')]=qs[_0xb8ed('0x31')](_0x21bdd2[_0xb8ed('0x4a')][_0xb8ed('0x31')]);}_0x296b39[_0xb8ed('0x6d')]=qs[_0xb8ed('0x51')](_0x21bdd2[_0xb8ed('0x4a')][_0xb8ed('0x51')]);_0x296b39['where']=qs[_0xb8ed('0x4b')](_['pick'](_0x21bdd2[_0xb8ed('0x4a')],_0x3a5fbf['filters']));_0x296b39[_0xb8ed('0x52')][_0xb8ed('0x6a')]=_0xfdf649['id'];if(_0x21bdd2[_0xb8ed('0x4a')]['filter']){_0x296b39[_0xb8ed('0x52')]=_[_0xb8ed('0x55')](_0x296b39[_0xb8ed('0x52')],{'$or':_[_0xb8ed('0x43')](_0x296b39[_0xb8ed('0x4e')],function(_0x57cc6f){var _0x236450={};_0x236450[_0x57cc6f]={'$like':'%'+_0x21bdd2['query'][_0xb8ed('0x54')]+'%'};return _0x236450;})});}if(_0x21bdd2[_0xb8ed('0x4a')]['$gte']){var _0x51da8a=_0x21bdd2['query']['$gte'][_0xb8ed('0xa7')](',');var _0x6faf6f={};_0x6faf6f[_0x51da8a[0x0]]={'$gte':moment(_0x51da8a[0x1])[_0xb8ed('0xa8')](_0xb8ed('0xa9'))};_0x296b39[_0xb8ed('0x52')]=_[_0xb8ed('0x55')](_0x296b39[_0xb8ed('0x52')],_0x6faf6f);}_0x296b39=_[_0xb8ed('0x55')]({},_0x296b39,_0x21bdd2['options']);return db['FaxMessage']['count']({'where':_0x296b39[_0xb8ed('0x52')]})[_0xb8ed('0x24')](function(_0x347e02){_0x39f3ce[_0xb8ed('0x30')]=_0x347e02;if(_0x21bdd2[_0xb8ed('0x4a')]['includeAll']){_0x296b39[_0xb8ed('0x58')]=[{'all':!![]}];}return db[_0xb8ed('0xa6')][_0xb8ed('0x59')](_0x296b39);})[_0xb8ed('0x24')](function(_0x54b799){_0x39f3ce['rows']=_0x54b799;return _0x39f3ce;});}})['then'](respondWithFilteredResult(_0x45d2fd,_0x296b39))[_0xb8ed('0x2d')](handleError(_0x45d2fd,null));};exports[_0xb8ed('0x3f')]=function(_0x1c2d51,_0x5a8951,_0x3c47d9){var _0x5e464b,_0x49db31={},_0x265039;if(_0x1c2d51['body']['to']){_0x265039=_0x1c2d51[_0xb8ed('0x60')]['to'][0x0];}return db[_0xb8ed('0x44')]['find']({'where':{'id':_0x1c2d51[_0xb8ed('0x5c')]['id']},'include':[{'model':db[_0xb8ed('0xaa')],'as':'List','include':[{'model':db[_0xb8ed('0x78')],'as':_0xb8ed('0xab'),'where':{'fax':_0x265039},'limit':0x1,'order':[['updatedAt',_0xb8ed('0xac')]]}]}]})[_0xb8ed('0x24')](handleEntityNotFound(_0x5a8951,null))[_0xb8ed('0x24')](function(_0x469288){_0x5e464b=_0x469288;if(_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')]&&_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][_0xb8ed('0x4d')]){for(var _0x58415c=0x0;_0x58415c<_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][_0xb8ed('0x4d')];_0x58415c+=0x1){_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][_0x58415c]={'filename':_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][_0x58415c][_0xb8ed('0x3e')],'id':_0x1c2d51['body'][_0xb8ed('0xad')][_0x58415c]['id'],'path':path[_0xb8ed('0xae')](config[_0xb8ed('0xaf')],_0xb8ed('0xb0'),_0x1c2d51[_0xb8ed('0x60')]['attachments'][_0x58415c][_0xb8ed('0xb1')])};}}return respondWithRpcPromise('CheckAfterSend',_0xb8ed('0xb2'),{'FaxAccountId':_['isNil'](_0x1c2d51[_0xb8ed('0x5c')]['id'])?undefined:_0x1c2d51[_0xb8ed('0x5c')]['id'],'path':_[_0xb8ed('0xb3')](_0x1c2d51[_0xb8ed('0x60')]['attachments'][0x0][_0xb8ed('0x7')])?undefined:_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][0x0][_0xb8ed('0x7')],'fax':_[_0xb8ed('0xb3')](_0x1c2d51[_0xb8ed('0x60')]['to'][0x0])?undefined:_0x1c2d51['body']['to'][0x0]},client9002);})[_0xb8ed('0x24')](function(){if(_0x5e464b){if(_[_0xb8ed('0xb3')](_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xb4')])){_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xb4')]=util['format'](_0xb8ed('0xb5'),_0x5e464b['name'],_0x5e464b['fax']);}if(_0x5e464b[_0xb8ed('0xb6')]){if(_0x5e464b[_0xb8ed('0xb6')][_0xb8ed('0xab')]['length']){return _0x5e464b[_0xb8ed('0xb6')][_0xb8ed('0xab')][0x0];}else{return db[_0xb8ed('0x78')][_0xb8ed('0x5f')](_[_0xb8ed('0x1b')](_0x1c2d51[_0xb8ed('0x60')],{'firstName':_0x1c2d51[_0xb8ed('0x60')]['to'][0x0],'phone':_0x1c2d51[_0xb8ed('0x60')]['to'][0x0],'fax':_0x1c2d51[_0xb8ed('0x60')]['to'][0x0],'ListId':_0x5e464b[_0xb8ed('0xa3')]}));}}else{throw new Error(_0xb8ed('0xb7'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xb8ed('0x24')](function(_0x23d39a){if(_0x23d39a){return db[_0xb8ed('0x75')]['find']({'where':{'ContactId':_0x23d39a['id'],'closed':![],'FaxAccountId':_0x5e464b['id']}})['then'](function(_0x395156){if(_0x395156){return[_0x395156,![]];}return db[_0xb8ed('0x75')]['create']({'UserId':_0x1c2d51[_0xb8ed('0x61')]['id'],'ContactId':_0x23d39a['id'],'FaxAccountId':_0x5e464b['id'],'fax':_0x1c2d51[_0xb8ed('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xb8ed('0x55')](_0x1c2d51['body'],{'read':![],'body':_0x1c2d51['body'][_0xb8ed('0xad')][0x0][_0xb8ed('0xb8')],'FaxAccountId':_0x5e464b['id'],'UserId':_0x1c2d51['user']['id'],'ContactId':_0x23d39a['id'],'AttachmentId':_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xb8ed('0xa6')],'as':_0xb8ed('0xb9')}]})['then'](function(_0x2f975d){return[_0x2f975d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb8ed('0xba')](function(_0x10d5a8,_0x4b1467){if(_0x4b1467){return _0x10d5a8;}return db[_0xb8ed('0xa6')]['create']({'direction':_0xb8ed('0xbb'),'read':![],'body':_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][0x0]['filename'],'FaxAccountId':_0x5e464b['id'],'FaxInteractionId':_0x10d5a8['id'],'UserId':_0x1c2d51[_0xb8ed('0x61')]['id'],'ContactId':_0x10d5a8[_0xb8ed('0xbc')],'AttachmentId':_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][0x0]['id']})['then'](function(_0x181e73){_0x10d5a8[_0xb8ed('0xbd')][_0xb8ed('0xb9')]=[];_0x10d5a8['dataValues'][_0xb8ed('0xb9')]['push'](_0x181e73['dataValues']);return _0x10d5a8;});})['then'](function(_0x4095d3){respondWithRpcPromise('SendFax',_0xb8ed('0xbe'),{'FaxAccountId':_[_0xb8ed('0xb3')](_0x1c2d51['params']['id'])?undefined:_0x1c2d51[_0xb8ed('0x5c')]['id'],'path':_[_0xb8ed('0xb3')](_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][0x0][_0xb8ed('0x7')])?undefined:_0x1c2d51['body'][_0xb8ed('0xad')][0x0][_0xb8ed('0x7')],'fax':_[_0xb8ed('0xb3')](_0x1c2d51[_0xb8ed('0x60')]['to'][0x0])?undefined:_0x1c2d51[_0xb8ed('0x60')]['to'][0x0],'AttachmentId':_0x1c2d51[_0xb8ed('0x60')][_0xb8ed('0xad')][0x0]['id']},client9002)[_0xb8ed('0x24')](function(_0x5de5a6){logger[_0xb8ed('0x25')](_0xb8ed('0xbf'),_0x5de5a6);})[_0xb8ed('0x2d')](function(_0x2776f3){logger[_0xb8ed('0x25')](_0xb8ed('0xbf'),_0x2776f3);});return _0x4095d3;})[_0xb8ed('0x24')](respondWithResult(_0x5a8951,null))[_0xb8ed('0x2d')](handleError(_0x5a8951,null));};exports[_0xb8ed('0xc0')]=function(_0x4a42e5,_0x4e02fe,_0x33c49c){return db[_0xb8ed('0x44')][_0xb8ed('0x64')]({'where':{'id':_0x4a42e5[_0xb8ed('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4e02fe,null))['then'](function(_0x6f2362){if(_0x6f2362){return _0x6f2362[_0xb8ed('0xc0')](_0x4a42e5[_0xb8ed('0x60')][_0xb8ed('0x6f')],_[_0xb8ed('0x76')](_0x4a42e5[_0xb8ed('0x60')],[_0xb8ed('0x6f'),'id'])||{})[_0xb8ed('0xba')](function(_0x51cb5f){for(var _0x2c965a=0x0;_0x2c965a<_0x4a42e5[_0xb8ed('0x60')]['ids'][_0xb8ed('0x4d')];_0x2c965a+=0x1){socket[_0xb8ed('0xc1')](_0xb8ed('0xc2'),{'UserId':_0x4a42e5['body'][_0xb8ed('0x6f')][_0x2c965a],'FaxAccountId':_0x4a42e5[_0xb8ed('0x5c')]['id']});}return _0x51cb5f;});}})[_0xb8ed('0x24')](respondWithResult(_0x4e02fe,null))['catch'](handleError(_0x4e02fe,null));};exports[_0xb8ed('0xc3')]=function(_0x3743cf,_0x454058,_0x3dbc76){return db[_0xb8ed('0x44')][_0xb8ed('0x64')]({'where':{'id':_0x3743cf[_0xb8ed('0x5c')]['id']}})['then'](handleEntityNotFound(_0x454058,null))[_0xb8ed('0x24')](function(_0x1aa501){if(_0x1aa501){return _0x1aa501[_0xb8ed('0xc3')](_0x3743cf['query'][_0xb8ed('0x6f')])['then'](function(){if(_[_0xb8ed('0xc4')](_0x3743cf['query'][_0xb8ed('0x6f')])){for(var _0x52fae1=0x0;_0x52fae1<_0x3743cf[_0xb8ed('0x4a')][_0xb8ed('0x6f')][_0xb8ed('0x4d')];_0x52fae1+=0x1){socket[_0xb8ed('0xc1')](_0xb8ed('0xc5'),{'UserId':Number(_0x3743cf[_0xb8ed('0x4a')][_0xb8ed('0x6f')][_0x52fae1]),'FaxAccountId':Number(_0x3743cf['params']['id'])});}}else{socket[_0xb8ed('0xc1')](_0xb8ed('0xc5'),{'UserId':Number(_0x3743cf[_0xb8ed('0x4a')][_0xb8ed('0x6f')]),'FaxAccountId':Number(_0x3743cf[_0xb8ed('0x5c')]['id'])});}});}})[_0xb8ed('0x24')](respondWithStatusCode(_0x454058,null))[_0xb8ed('0x2d')](handleError(_0x454058,null));};exports['getAgents']=function(_0x4f32ba,_0x4481ff,_0x118e73){var _0x7f0d89={};var _0x5806b6={};var _0x3ea4b4;var _0x51d3e1;return db[_0xb8ed('0x44')][_0xb8ed('0x6c')]({'where':{'id':_0x4f32ba[_0xb8ed('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4481ff,null))[_0xb8ed('0x24')](function(_0x52bc10){if(_0x52bc10){_0x3ea4b4=_0x52bc10;_0x5806b6[_0xb8ed('0x49')]=_[_0xb8ed('0x5d')](db['User'][_0xb8ed('0x45')]);_0x5806b6['query']=_['keys'](_0x4f32ba[_0xb8ed('0x4a')]);_0x5806b6['filters']=_[_0xb8ed('0x4c')](_0x5806b6[_0xb8ed('0x49')],_0x5806b6[_0xb8ed('0x4a')]);_0x7f0d89[_0xb8ed('0x4e')]=_[_0xb8ed('0x4c')](_0x5806b6['model'],qs[_0xb8ed('0x5e')](_0x4f32ba[_0xb8ed('0x4a')][_0xb8ed('0x5e')]));_0x7f0d89[_0xb8ed('0x4e')]=_0x7f0d89[_0xb8ed('0x4e')][_0xb8ed('0x4d')]?_0x7f0d89[_0xb8ed('0x4e')]:_0x5806b6['model'];_0x7f0d89['order']=qs[_0xb8ed('0x51')](_0x4f32ba[_0xb8ed('0x4a')][_0xb8ed('0x51')]);_0x7f0d89[_0xb8ed('0x52')]=qs[_0xb8ed('0x4b')](_[_0xb8ed('0x53')](_0x4f32ba['query'],_0x5806b6[_0xb8ed('0x4b')]));if(_0x4f32ba['query'][_0xb8ed('0x54')]){_0x7f0d89['where']=_[_0xb8ed('0x55')](_0x7f0d89[_0xb8ed('0x52')],{'$or':_[_0xb8ed('0x43')](_0x7f0d89['attributes'],function(_0x33c762){var _0x55379a={};_0x55379a[_0x33c762]={'$like':'%'+_0x4f32ba[_0xb8ed('0x4a')][_0xb8ed('0x54')]+'%'};return _0x55379a;})});}_0x7f0d89=_['merge']({},_0x7f0d89,_0x4f32ba[_0xb8ed('0x56')]);return _0x3ea4b4['getAgents'](_0x7f0d89);}})[_0xb8ed('0x24')](function(_0x259615){if(_0x259615){_0x51d3e1=_0x259615['length'];if(!_0x4f32ba['query'][_0xb8ed('0x4f')](_0xb8ed('0x50'))){_0x7f0d89[_0xb8ed('0x32')]=qs[_0xb8ed('0x32')](_0x4f32ba['query'][_0xb8ed('0x32')]);_0x7f0d89[_0xb8ed('0x31')]=qs['offset'](_0x4f32ba[_0xb8ed('0x4a')]['offset']);}return _0x3ea4b4['getAgents'](_0x7f0d89);}})[_0xb8ed('0x24')](function(_0x2fc66b){if(_0x2fc66b){return _0x2fc66b?{'count':_0x51d3e1,'rows':_0x2fc66b}:null;}})[_0xb8ed('0x24')](respondWithResult(_0x4481ff,null))[_0xb8ed('0x2d')](handleError(_0x4481ff,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cd475df..0c504aa 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 _0x38fb=['save','update','emit','hasOwnProperty','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x14691c,_0xe1c878){var _0xbec98=function(_0x100b9e){while(--_0x100b9e){_0x14691c['push'](_0x14691c['shift']());}};_0xbec98(++_0xe1c878);}(_0x38fb,0x74));var _0xb38f=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0x38fb[_0x4e8286];return _0x44a440;};'use strict';var EventEmitter=require(_0xb38f('0x0'));var FaxAccount=require(_0xb38f('0x1'))['db'][_0xb38f('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb38f('0x3')](0x0);var events={'afterCreate':_0xb38f('0x4'),'afterUpdate':_0xb38f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x53696a){return function(_0x4a40e8,_0x56c968,_0x8898e8){FaxAccountEvents['emit'](_0x53696a+':'+_0x4a40e8['id'],_0x4a40e8);FaxAccountEvents[_0xb38f('0x6')](_0x53696a,_0x4a40e8);_0x8898e8(null);};}for(var e in events){if(events[_0xb38f('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x2eb7=['emit','hasOwnProperty','exports','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x4e4ece,_0x10bb56){var _0x2cdc7a=function(_0xf72919){while(--_0xf72919){_0x4e4ece['push'](_0x4e4ece['shift']());}};_0x2cdc7a(++_0x10bb56);}(_0x2eb7,0x143));var _0x72eb=function(_0x455fa8,_0xf22cd9){_0x455fa8=_0x455fa8-0x0;var _0x490d94=_0x2eb7[_0x455fa8];return _0x490d94;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x72eb('0x0'))['db'][_0x72eb('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x72eb('0x2')](0x0);var events={'afterCreate':_0x72eb('0x3'),'afterUpdate':_0x72eb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x42ec66){return function(_0x59c49b,_0x16c173,_0x333945){FaxAccountEvents['emit'](_0x42ec66+':'+_0x59c49b['id'],_0x59c49b);FaxAccountEvents[_0x72eb('0x5')](_0x42ec66,_0x59c49b);_0x333945(null);};}for(var e in events){if(events[_0x72eb('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x72eb('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 3fd89f7..c02660f 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 _0xe177=['FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x1d7f12,_0x38000e){var _0x68c6d7=function(_0x36ebc0){while(--_0x36ebc0){_0x1d7f12['push'](_0x1d7f12['shift']());}};_0x68c6d7(++_0x38000e);}(_0xe177,0xda));var _0x7e17=function(_0xced02b,_0x2c4ce6){_0xced02b=_0xced02b-0x0;var _0x360a87=_0xe177[_0xced02b];return _0x360a87;};'use strict';var _=require(_0x7e17('0x0'));var util=require(_0x7e17('0x1'));var logger=require(_0x7e17('0x2'))(_0x7e17('0x3'));var moment=require(_0x7e17('0x4'));var BPromise=require(_0x7e17('0x5'));var rp=require(_0x7e17('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e17('0x7'));var attributes=require('./faxAccount.attributes');module[_0x7e17('0x8')]=function(_0xf7adc4,_0x104e1d){return _0xf7adc4[_0x7e17('0x9')](_0x7e17('0xa'),attributes,{'tableName':_0x7e17('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0711=['api','bluebird','rimraf','./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger'];(function(_0x4206d5,_0x19e52d){var _0x116f44=function(_0x5c81fc){while(--_0x5c81fc){_0x4206d5['push'](_0x4206d5['shift']());}};_0x116f44(++_0x19e52d);}(_0x0711,0x183));var _0x1071=function(_0x43015b,_0x48667c){_0x43015b=_0x43015b-0x0;var _0x59bedf=_0x0711[_0x43015b];return _0x59bedf;};'use strict';var _=require(_0x1071('0x0'));var util=require(_0x1071('0x1'));var logger=require(_0x1071('0x2'))(_0x1071('0x3'));var moment=require('moment');var BPromise=require(_0x1071('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1071('0x5'));var config=require('../../config/environment');var attributes=require(_0x1071('0x6'));module[_0x1071('0x7')]=function(_0x5cc4f3,_0x421884){return _0x5cc4f3[_0x1071('0x8')]('FaxAccount',attributes,{'tableName':_0x1071('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 57b25d4..1238d01 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 _0x73e4=['difference','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','Contacts','DESC','FaxApplication','applications','Applications','list','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','find','agent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','include','model','map','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt'];(function(_0xacba7a,_0x172a69){var _0x9ffb50=function(_0x473044){while(--_0x473044){_0xacba7a['push'](_0xacba7a['shift']());}};_0x9ffb50(++_0x172a69);}(_0x73e4,0x188));var _0x473e=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x73e4[_0x49fcfb];return _0x964926;};'use strict';var _=require('lodash');var util=require(_0x473e('0x0'));var moment=require(_0x473e('0x1'));var BPromise=require(_0x473e('0x2'));var rs=require(_0x473e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x473e('0x4'))(_0x473e('0x5'));var config=require('../../config/environment');var jayson=require(_0x473e('0x6'));var client=jayson['client'][_0x473e('0x7')]({'port':0x232c});config[_0x473e('0x8')]=_[_0x473e('0x9')](config[_0x473e('0x8')],{'host':_0x473e('0xa'),'port':0x18eb});var socket=require(_0x473e('0xb'))(new Redis(config[_0x473e('0x8')]));require(_0x473e('0xc'))[_0x473e('0xd')](socket);function respondWithRpcPromise(_0x1200ce,_0x78ba6c,_0x6ce72){return new BPromise(function(_0x360a9a,_0x4148f0){return client['request'](_0x1200ce,_0x6ce72)[_0x473e('0xe')](function(_0x5a608d){logger[_0x473e('0xf')](_0x473e('0x10'),_0x78ba6c,_0x473e('0x11'));logger[_0x473e('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x78ba6c,'request\x20sent',JSON['stringify'](_0x5a608d));if(_0x5a608d[_0x473e('0x13')]){if(_0x5a608d[_0x473e('0x13')][_0x473e('0x14')]===0x1f4){logger[_0x473e('0x13')](_0x473e('0x10'),_0x78ba6c,_0x5a608d['error'][_0x473e('0x15')]);return _0x4148f0(_0x5a608d['error'][_0x473e('0x15')]);}logger[_0x473e('0x13')]('FaxAccount,\x20%s,\x20%s',_0x78ba6c,_0x5a608d[_0x473e('0x13')]['message']);return _0x360a9a(_0x5a608d['error']['message']);}else{logger[_0x473e('0xf')](_0x473e('0x10'),_0x78ba6c,_0x473e('0x11'));_0x360a9a(_0x5a608d['result'][_0x473e('0x15')]);}})[_0x473e('0x16')](function(_0x4f77b4){logger[_0x473e('0x13')](_0x473e('0x10'),_0x78ba6c,_0x4f77b4);_0x4148f0(_0x4f77b4);});});}exports[_0x473e('0x17')]=function(_0x33997f){var _0x1202b8=this;return new Promise(function(_0x48db72,_0x3db97a){return db[_0x473e('0x18')][_0x473e('0x19')]({'raw':_0x33997f['options']?_0x33997f[_0x473e('0x1a')][_0x473e('0x1b')]===undefined?!![]:![]:!![],'where':_0x33997f[_0x473e('0x1a')]?_0x33997f[_0x473e('0x1a')]['where']||null:null,'attributes':_0x33997f[_0x473e('0x1a')]?_0x33997f[_0x473e('0x1a')][_0x473e('0x1c')]||null:null,'limit':_0x33997f[_0x473e('0x1a')]?_0x33997f[_0x473e('0x1a')]['limit']||null:null,'include':_0x33997f[_0x473e('0x1a')]?_0x33997f['options'][_0x473e('0x1d')]?_['map'](_0x33997f[_0x473e('0x1a')]['include'],function(_0x5a66de){return{'model':db[_0x5a66de[_0x473e('0x1e')]],'as':_0x5a66de['as'],'attributes':_0x5a66de[_0x473e('0x1c')],'include':_0x5a66de[_0x473e('0x1d')]?_[_0x473e('0x1f')](_0x5a66de[_0x473e('0x1d')],function(_0x282480){return{'model':db[_0x282480[_0x473e('0x1e')]],'as':_0x282480['as'],'attributes':_0x282480[_0x473e('0x1c')],'include':_0x282480[_0x473e('0x1d')]?_[_0x473e('0x1f')](_0x282480[_0x473e('0x1d')],function(_0x8079cf){return{'model':db[_0x8079cf[_0x473e('0x1e')]],'as':_0x8079cf['as'],'attributes':_0x8079cf[_0x473e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x473e('0xe')](function(_0x1e8aac){logger[_0x473e('0xf')](_0x473e('0x17'),_0x33997f);logger['debug']('GetFaxAccount',_0x33997f,JSON[_0x473e('0x20')](_0x1e8aac));_0x48db72(_0x1e8aac);})[_0x473e('0x16')](function(_0x1a91e0){logger[_0x473e('0x13')](_0x473e('0x17'),_0x1a91e0[_0x473e('0x15')],_0x33997f);_0x3db97a(_0x1202b8['error'](0x1f4,_0x1a91e0[_0x473e('0x15')]));});});};exports[_0x473e('0x21')]=function(_0x3ed251,_0xbc3b65,_0x540975){var _0x477e99=this;return new Promise(function(_0x5afd93,_0x4ba3a6){var _0x3b9572={'body':_0x3ed251[_0x473e('0x22')],'channel':_0x473e('0x23')};var _0x42308d=[];var _0x49b4c1=[];var _0x3986f4={};return db[_0x473e('0x24')][_0x473e('0x25')]()['then'](function(_0x3de9ba){if(!_0x3de9ba){throw new db[(_0x473e('0x26'))][(_0x473e('0x27'))](_0x473e('0x28'));}_0x42308d=_['difference'](_['keys'](_0x3de9ba),[_0x473e('0x29'),_0x473e('0x2a')]);_0x49b4c1=_[_0x473e('0x2b')](_[_0x473e('0x2c')](_0x3de9ba),[_0x473e('0x29'),'updatedAt',_0x473e('0x2d'),_0x473e('0x2e')]);if(_0x3ed251[_0x473e('0x22')]['id']){delete _0x3ed251['body']['id'];}if(_[_0x473e('0x2f')](_0x3ed251[_0x473e('0x22')][_0x473e('0x30')])){throw new db[(_0x473e('0x26'))][(_0x473e('0x27'))](_0x473e('0x31'));}if(_[_0x473e('0x2f')](_0x3ed251['body'][_0x473e('0x22')])||_0x3ed251[_0x473e('0x22')]['body']===''){throw new db[(_0x473e('0x26'))][(_0x473e('0x27'))](_0x473e('0x32'));}if(_['isNil'](_0x3ed251[_0x473e('0x22')]['mapKey'])){throw new db[(_0x473e('0x26'))][(_0x473e('0x27'))](_0x473e('0x33')+_0x49b4c1);}if(!_[_0x473e('0x34')](_0x49b4c1,_0x3ed251[_0x473e('0x22')]['mapKey'])){throw new db[(_0x473e('0x26'))][(_0x473e('0x27'))](_0x473e('0x35')+_0x49b4c1);}_0x3986f4[_0x3ed251[_0x473e('0x22')][_0x473e('0x36')]]=_0x3ed251['body']['from'];})[_0x473e('0xe')](function(){return db[_0x473e('0x18')]['find']({'where':{'id':_0x3ed251[_0x473e('0x37')]['id']},'include':[{'model':db[_0x473e('0x38')],'as':_0x473e('0x39'),'include':[{'model':db['CmContact'],'as':_0x473e('0x3a'),'where':_0x3986f4,'limit':0x1,'order':[['updatedAt',_0x473e('0x3b')]]}]},{'model':db[_0x473e('0x3c')],'as':'Applications'}]});})[_0x473e('0xe')](function(_0x1b7406){if(_0x1b7406&&_0x1b7406[_0x473e('0x39')]){var _0x17491d=_0x1b7406['get']({'plain':!![]});_0x3b9572[_0x473e('0x37')]=_0x17491d;_0x3b9572[_0x473e('0x3d')]=_0x17491d[_0x473e('0x3e')];_0x3b9572[_0x473e('0x3f')]=_0x17491d[_0x473e('0x39')];_0x3b9572[_0x473e('0x3d')]=_[_0x473e('0x40')](_0x3b9572[_0x473e('0x3d')],[_0x473e('0x41')],['asc']);if(_0x3b9572[_0x473e('0x37')][_0x473e('0x3e')]){delete _0x3b9572['account'][_0x473e('0x3e')];}if(_0x3b9572['account'][_0x473e('0x39')]&&_0x3b9572['account'][_0x473e('0x39')][_0x473e('0x3a')][_0x473e('0x42')]){return _0x3b9572[_0x473e('0x37')][_0x473e('0x39')][_0x473e('0x3a')][0x0];}var _0x56430c=_['defaults'](_0x3ed251[_0x473e('0x22')],{'firstName':_0x3ed251[_0x473e('0x22')][_0x473e('0x30')],'ListId':_0x17491d[_0x473e('0x2e')]});_0x56430c[_0x3ed251[_0x473e('0x22')]['mapKey']]=_0x3ed251[_0x473e('0x22')][_0x473e('0x30')];return db[_0x473e('0x24')][_0x473e('0x43')](_0x56430c,{'fields':_0x42308d,'raw':!![]});}})[_0x473e('0xe')](function(_0x34074f){_0x3b9572[_0x473e('0x44')]=_0x34074f;if(_0x34074f){var _0x287565={'ContactId':_0x34074f['id'],'FaxAccountId':_0x3ed251[_0x473e('0x37')]['id'],'fax':_0x34074f[_0x473e('0x23')]};return db[_0x473e('0x45')]['find']({'where':{'ContactId':_0x34074f['id'],'closed':![],'FaxAccountId':_0x3ed251[_0x473e('0x37')]['id']}})['then'](function(_0x4743d0){if(_0x4743d0){return[_0x4743d0,![]];}return db[_0x473e('0x45')][_0x473e('0x43')](_0x287565)['then'](function(_0x5afd41){return[_0x5afd41,!![]];});});}else{throw new Error(_0x473e('0x46'));}})[_0x473e('0x47')](function(_0x4d46ee,_0x4cfe62){var _0x42719e=_0x4d46ee[_0x473e('0x48')]({'plain':!![]});if(_0x4cfe62){if(_0x3b9572[_0x473e('0x37')][_0x473e('0x49')]){_0x3b9572[_0x473e('0x3d')]['push']({'id':0x0,'priority':_0x3b9572[_0x473e('0x3d')][_0x473e('0x42')]+0x1,'app':_0x473e('0x4a'),'appdata':_0x473e('0x4b'),'interval':'*,*,*,*'});}_0x42719e[_0x473e('0x4c')]=!![];}else{_0x42719e[_0x473e('0x4c')]=![];}_0x3b9572[_0x473e('0x4d')]=_0x42719e;return db[_0x473e('0x4e')][_0x473e('0x43')]({'body':_0x3ed251[_0x473e('0x22')]['body'],'FaxAccountId':_0x3ed251[_0x473e('0x37')]['id'],'FaxInteractionId':_0x4d46ee['id'],'direction':'in','ContactId':_0x4d46ee[_0x473e('0x4f')],'AttachmentId':_0x3ed251[_0x473e('0x22')][_0x473e('0x50')]});})[_0x473e('0xe')](function(_0xc1965a){_0x3b9572[_0x473e('0x15')]=_0xc1965a;if(_0x3b9572[_0x473e('0x4d')][_0x473e('0x51')]){return db['User'][_0x473e('0x52')]({'attributes':['id','name'],'where':{'id':_0x3b9572[_0x473e('0x4d')]['UserId']}})[_0x473e('0xe')](function(_0x175cc5){if(_0x175cc5){_0x3b9572[_0x473e('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x473e('0x53'),'appdata':_0x175cc5['name']+','+(_0x3b9572[_0x473e('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x473e('0x54')});}return respondWithRpcPromise(_0x473e('0x55'),_0x473e('0x56'),_0x3b9572);});}return respondWithRpcPromise('Start',_0x473e('0x56'),_0x3b9572);})[_0x473e('0xe')](function(_0x2cf14b){_0x5afd93(_0x2cf14b);})[_0x473e('0x16')](function(_0x2a56d0){_0x4ba3a6(_0x477e99[_0x473e('0x13')](0x1f4,_0x2a56d0[_0x473e('0x15')]));});});}; \ No newline at end of file +var _0xfdca=['http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','include','map','model','attributes','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','length','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','interaction','FaxMessage','create','ContactId','AttachmentId','UserId','agent','name','*,*,*,*','startRouting','Start','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xc7c974,_0x386dfd){var _0x140f44=function(_0x5903c5){while(--_0x5903c5){_0xc7c974['push'](_0xc7c974['shift']());}};_0x140f44(++_0x386dfd);}(_0xfdca,0xf9));var _0xafdc=function(_0x396182,_0x26b42c){_0x396182=_0x396182-0x0;var _0x5457f6=_0xfdca[_0x396182];return _0x5457f6;};'use strict';var _=require(_0xafdc('0x0'));var util=require(_0xafdc('0x1'));var moment=require(_0xafdc('0x2'));var BPromise=require('bluebird');var rs=require(_0xafdc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xafdc('0x4'));var logger=require(_0xafdc('0x5'))(_0xafdc('0x6'));var config=require(_0xafdc('0x7'));var jayson=require(_0xafdc('0x8'));var client=jayson['client'][_0xafdc('0x9')]({'port':0x232c});config['redis']=_[_0xafdc('0xa')](config[_0xafdc('0xb')],{'host':_0xafdc('0xc'),'port':0x18eb});var socket=require(_0xafdc('0xd'))(new Redis(config['redis']));require(_0xafdc('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e317f,_0x23b0da,_0x3f7182){return new BPromise(function(_0x5488e5,_0xb54aa9){return client[_0xafdc('0xf')](_0x1e317f,_0x3f7182)[_0xafdc('0x10')](function(_0x4e23e6){logger[_0xafdc('0x11')]('FaxAccount,\x20%s,\x20%s',_0x23b0da,'request\x20sent');logger[_0xafdc('0x12')](_0xafdc('0x13'),_0x23b0da,_0xafdc('0x14'),JSON['stringify'](_0x4e23e6));if(_0x4e23e6[_0xafdc('0x15')]){if(_0x4e23e6['error']['code']===0x1f4){logger[_0xafdc('0x15')](_0xafdc('0x16'),_0x23b0da,_0x4e23e6[_0xafdc('0x15')]['message']);return _0xb54aa9(_0x4e23e6[_0xafdc('0x15')][_0xafdc('0x17')]);}logger[_0xafdc('0x15')](_0xafdc('0x16'),_0x23b0da,_0x4e23e6['error'][_0xafdc('0x17')]);return _0x5488e5(_0x4e23e6['error']['message']);}else{logger[_0xafdc('0x11')](_0xafdc('0x16'),_0x23b0da,_0xafdc('0x14'));_0x5488e5(_0x4e23e6[_0xafdc('0x18')]['message']);}})[_0xafdc('0x19')](function(_0x4d64c9){logger[_0xafdc('0x15')](_0xafdc('0x16'),_0x23b0da,_0x4d64c9);_0xb54aa9(_0x4d64c9);});});}exports[_0xafdc('0x1a')]=function(_0x3b5af7){var _0x21a1ad=this;return new Promise(function(_0x209be9,_0x46eca4){return db[_0xafdc('0x1b')]['findAll']({'raw':_0x3b5af7[_0xafdc('0x1c')]?_0x3b5af7[_0xafdc('0x1c')][_0xafdc('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b5af7[_0xafdc('0x1c')]?_0x3b5af7['options'][_0xafdc('0x1e')]||null:null,'attributes':_0x3b5af7['options']?_0x3b5af7[_0xafdc('0x1c')]['attributes']||null:null,'limit':_0x3b5af7[_0xafdc('0x1c')]?_0x3b5af7[_0xafdc('0x1c')]['limit']||null:null,'include':_0x3b5af7[_0xafdc('0x1c')]?_0x3b5af7[_0xafdc('0x1c')][_0xafdc('0x1f')]?_[_0xafdc('0x20')](_0x3b5af7['options'][_0xafdc('0x1f')],function(_0x4746ce){return{'model':db[_0x4746ce[_0xafdc('0x21')]],'as':_0x4746ce['as'],'attributes':_0x4746ce['attributes'],'include':_0x4746ce[_0xafdc('0x1f')]?_[_0xafdc('0x20')](_0x4746ce[_0xafdc('0x1f')],function(_0x40762f){return{'model':db[_0x40762f['model']],'as':_0x40762f['as'],'attributes':_0x40762f[_0xafdc('0x22')],'include':_0x40762f['include']?_['map'](_0x40762f['include'],function(_0x223d1a){return{'model':db[_0x223d1a[_0xafdc('0x21')]],'as':_0x223d1a['as'],'attributes':_0x223d1a['attributes']};}):[]};}):[]};}):[]:[]})[_0xafdc('0x10')](function(_0xc41f){logger[_0xafdc('0x11')](_0xafdc('0x1a'),_0x3b5af7);logger['debug'](_0xafdc('0x1a'),_0x3b5af7,JSON['stringify'](_0xc41f));_0x209be9(_0xc41f);})[_0xafdc('0x19')](function(_0xc53616){logger[_0xafdc('0x15')]('GetFaxAccount',_0xc53616[_0xafdc('0x17')],_0x3b5af7);_0x46eca4(_0x21a1ad[_0xafdc('0x15')](0x1f4,_0xc53616[_0xafdc('0x17')]));});});};exports[_0xafdc('0x23')]=function(_0x1fb5a4,_0x5f41d6,_0x4943c6){var _0x16e0a6=this;return new Promise(function(_0xee2f01,_0x1f9138){var _0xe2b1d8={'body':_0x1fb5a4[_0xafdc('0x24')],'channel':_0xafdc('0x25')};var _0x35f290=[];var _0x3eba6d=[];var _0x46e7e0={};return db[_0xafdc('0x26')]['describe']()['then'](function(_0x13e148){if(!_0x13e148){throw new db[(_0xafdc('0x27'))][(_0xafdc('0x28'))]('no\x20available\x20attributes');}_0x35f290=_[_0xafdc('0x29')](_[_0xafdc('0x2a')](_0x13e148),[_0xafdc('0x2b'),'updatedAt']);_0x3eba6d=_[_0xafdc('0x29')](_[_0xafdc('0x2a')](_0x13e148),[_0xafdc('0x2b'),_0xafdc('0x2c'),'CompanyId',_0xafdc('0x2d')]);if(_0x1fb5a4[_0xafdc('0x24')]['id']){delete _0x1fb5a4[_0xafdc('0x24')]['id'];}if(_[_0xafdc('0x2e')](_0x1fb5a4[_0xafdc('0x24')][_0xafdc('0x2f')])){throw new db[(_0xafdc('0x27'))][(_0xafdc('0x28'))](_0xafdc('0x30'));}if(_[_0xafdc('0x2e')](_0x1fb5a4['body'][_0xafdc('0x24')])||_0x1fb5a4[_0xafdc('0x24')][_0xafdc('0x24')]===''){throw new db['Sequelize']['ValidationError'](_0xafdc('0x31'));}if(_[_0xafdc('0x2e')](_0x1fb5a4[_0xafdc('0x24')]['mapKey'])){throw new db[(_0xafdc('0x27'))]['ValidationError'](_0xafdc('0x32')+_0x3eba6d);}if(!_['includes'](_0x3eba6d,_0x1fb5a4[_0xafdc('0x24')][_0xafdc('0x33')])){throw new db[(_0xafdc('0x27'))][(_0xafdc('0x28'))](_0xafdc('0x34')+_0x3eba6d);}_0x46e7e0[_0x1fb5a4[_0xafdc('0x24')][_0xafdc('0x33')]]=_0x1fb5a4[_0xafdc('0x24')][_0xafdc('0x2f')];})['then'](function(){return db[_0xafdc('0x1b')][_0xafdc('0x35')]({'where':{'id':_0x1fb5a4[_0xafdc('0x36')]['id']},'include':[{'model':db[_0xafdc('0x37')],'as':_0xafdc('0x38'),'include':[{'model':db['CmContact'],'as':_0xafdc('0x39'),'where':_0x46e7e0,'limit':0x1,'order':[[_0xafdc('0x2c'),_0xafdc('0x3a')]]}]},{'model':db[_0xafdc('0x3b')],'as':_0xafdc('0x3c')}]});})[_0xafdc('0x10')](function(_0xc9deb2){if(_0xc9deb2&&_0xc9deb2[_0xafdc('0x38')]){var _0x493b8c=_0xc9deb2[_0xafdc('0x3d')]({'plain':!![]});_0xe2b1d8[_0xafdc('0x36')]=_0x493b8c;_0xe2b1d8[_0xafdc('0x3e')]=_0x493b8c['Applications'];_0xe2b1d8[_0xafdc('0x3f')]=_0x493b8c[_0xafdc('0x38')];_0xe2b1d8[_0xafdc('0x3e')]=_[_0xafdc('0x40')](_0xe2b1d8[_0xafdc('0x3e')],['priority'],[_0xafdc('0x41')]);if(_0xe2b1d8[_0xafdc('0x36')][_0xafdc('0x3c')]){delete _0xe2b1d8[_0xafdc('0x36')][_0xafdc('0x3c')];}if(_0xe2b1d8[_0xafdc('0x36')]['List']&&_0xe2b1d8[_0xafdc('0x36')][_0xafdc('0x38')][_0xafdc('0x39')][_0xafdc('0x42')]){return _0xe2b1d8[_0xafdc('0x36')]['List']['Contacts'][0x0];}var _0x3faf9d=_[_0xafdc('0xa')](_0x1fb5a4['body'],{'firstName':_0x1fb5a4[_0xafdc('0x24')][_0xafdc('0x2f')],'ListId':_0x493b8c['ListId']});_0x3faf9d[_0x1fb5a4[_0xafdc('0x24')]['mapKey']]=_0x1fb5a4[_0xafdc('0x24')][_0xafdc('0x2f')];return db[_0xafdc('0x26')]['create'](_0x3faf9d,{'fields':_0x35f290,'raw':!![]});}})[_0xafdc('0x10')](function(_0x1fb118){_0xe2b1d8['contact']=_0x1fb118;if(_0x1fb118){var _0x598eb0={'ContactId':_0x1fb118['id'],'FaxAccountId':_0x1fb5a4[_0xafdc('0x36')]['id'],'fax':_0x1fb118[_0xafdc('0x25')]};return db['FaxInteraction'][_0xafdc('0x35')]({'where':{'ContactId':_0x1fb118['id'],'closed':![],'FaxAccountId':_0x1fb5a4['account']['id']}})[_0xafdc('0x10')](function(_0x1f8f2f){if(_0x1f8f2f){return[_0x1f8f2f,![]];}return db[_0xafdc('0x43')]['create'](_0x598eb0)[_0xafdc('0x10')](function(_0x30367c){return[_0x30367c,!![]];});});}else{throw new Error(_0xafdc('0x44'));}})[_0xafdc('0x45')](function(_0x39ec6d,_0x76306a){var _0x2c46ac=_0x39ec6d['get']({'plain':!![]});if(_0x76306a){if(_0xe2b1d8[_0xafdc('0x36')][_0xafdc('0x46')]){_0xe2b1d8[_0xafdc('0x3e')][_0xafdc('0x47')]({'id':0x0,'priority':_0xe2b1d8[_0xafdc('0x3e')][_0xafdc('0x42')]+0x1,'app':_0xafdc('0x48'),'appdata':_0xafdc('0x49'),'interval':'*,*,*,*'});}_0x2c46ac[_0xafdc('0x4a')]=!![];}else{_0x2c46ac[_0xafdc('0x4a')]=![];}_0xe2b1d8[_0xafdc('0x4b')]=_0x2c46ac;return db[_0xafdc('0x4c')][_0xafdc('0x4d')]({'body':_0x1fb5a4[_0xafdc('0x24')]['body'],'FaxAccountId':_0x1fb5a4[_0xafdc('0x36')]['id'],'FaxInteractionId':_0x39ec6d['id'],'direction':'in','ContactId':_0x39ec6d[_0xafdc('0x4e')],'AttachmentId':_0x1fb5a4['body'][_0xafdc('0x4f')]});})[_0xafdc('0x10')](function(_0x33909d){_0xe2b1d8[_0xafdc('0x17')]=_0x33909d;if(_0xe2b1d8[_0xafdc('0x4b')][_0xafdc('0x50')]){return db['User'][_0xafdc('0x35')]({'attributes':['id','name'],'where':{'id':_0xe2b1d8[_0xafdc('0x4b')]['UserId']}})[_0xafdc('0x10')](function(_0x4ecfc6){if(_0x4ecfc6){_0xe2b1d8[_0xafdc('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xafdc('0x51'),'appdata':_0x4ecfc6[_0xafdc('0x52')]+','+(_0xe2b1d8[_0xafdc('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0xafdc('0x53')});}return respondWithRpcPromise('Start',_0xafdc('0x54'),_0xe2b1d8);});}return respondWithRpcPromise(_0xafdc('0x55'),_0xafdc('0x54'),_0xe2b1d8);})[_0xafdc('0x10')](function(_0x249324){_0xee2f01(_0x249324);})[_0xafdc('0x19')](function(_0x38d1aa){_0x1f9138(_0x16e0a6[_0xafdc('0x15')](0x1f4,_0x38d1aa[_0xafdc('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 98f6306..285f970 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 _0x5496=['faxAccount:','./faxAccount.events','save','remove','update','removeListener'];(function(_0x12c5e0,_0x43be95){var _0x1aec02=function(_0x3e69a9){while(--_0x3e69a9){_0x12c5e0['push'](_0x12c5e0['shift']());}};_0x1aec02(++_0x43be95);}(_0x5496,0x175));var _0x6549=function(_0x2fe79f,_0xa8a10e){_0x2fe79f=_0x2fe79f-0x0;var _0x38b4d3=_0x5496[_0x2fe79f];return _0x38b4d3;};'use strict';var FaxAccountEvents=require(_0x6549('0x0'));var events=[_0x6549('0x1'),_0x6549('0x2'),_0x6549('0x3')];function createListener(_0x465fee,_0x4b616a){return function(_0x21585c){_0x4b616a['emit'](_0x465fee,_0x21585c);};}function removeListener(_0x2d2155,_0x8112c5){return function(){FaxAccountEvents[_0x6549('0x4')](_0x2d2155,_0x8112c5);};}exports['register']=function(_0x5a4658){for(var _0x43cb17=0x0,_0x1d8cea=events['length'];_0x43cb17<_0x1d8cea;_0x43cb17++){var _0x1ca8fc=events[_0x43cb17];var _0x3442c3=createListener(_0x6549('0x5')+_0x1ca8fc,_0x5a4658);FaxAccountEvents['on'](_0x1ca8fc,_0x3442c3);}}; \ No newline at end of file +var _0x3a6d=['faxAccount:','./faxAccount.events','save','update','emit','removeListener','register'];(function(_0x2d6798,_0x5707e8){var _0x3f6a87=function(_0x5762f8){while(--_0x5762f8){_0x2d6798['push'](_0x2d6798['shift']());}};_0x3f6a87(++_0x5707e8);}(_0x3a6d,0x143));var _0xd3a6=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x3a6d[_0x68c979];return _0x4f0001;};'use strict';var FaxAccountEvents=require(_0xd3a6('0x0'));var events=[_0xd3a6('0x1'),'remove',_0xd3a6('0x2')];function createListener(_0x177d8b,_0x31619a){return function(_0x37a8f2){_0x31619a[_0xd3a6('0x3')](_0x177d8b,_0x37a8f2);};}function removeListener(_0x585473,_0x1cb966){return function(){FaxAccountEvents[_0xd3a6('0x4')](_0x585473,_0x1cb966);};}exports[_0xd3a6('0x5')]=function(_0x1fc450){for(var _0x25b042=0x0,_0x282cb1=events['length'];_0x25b042<_0x282cb1;_0x25b042++){var _0x121bd2=events[_0x25b042];var _0x134dd3=createListener(_0xd3a6('0x6')+_0x121bd2,_0x1fc450);FaxAccountEvents['on'](_0x121bd2,_0x134dd3);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e2e10c6..39adc1e 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 _0x3922=['addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','post','create','/:id/dispositions','addDisposition','addAnswer'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x3922,0x8d));var _0x2392=function(_0x13d4ad,_0x421315){_0x13d4ad=_0x13d4ad-0x0;var _0xe34a1=_0x3922[_0x13d4ad];return _0xe34a1;};'use strict';var multer=require('multer');var util=require(_0x2392('0x0'));var path=require(_0x2392('0x1'));var timeout=require(_0x2392('0x2'));var express=require(_0x2392('0x3'));var router=express[_0x2392('0x4')]();var auth=require(_0x2392('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2392('0x6'));router[_0x2392('0x7')]('/',auth[_0x2392('0x8')](),controller[_0x2392('0x9')]);router[_0x2392('0x7')]('/describe',auth[_0x2392('0x8')](),controller[_0x2392('0xa')]);router[_0x2392('0x7')](_0x2392('0xb'),auth[_0x2392('0x8')](),controller[_0x2392('0xc')]);router[_0x2392('0x7')]('/:id/dispositions',auth[_0x2392('0x8')](),controller[_0x2392('0xd')]);router[_0x2392('0x7')](_0x2392('0xe'),auth[_0x2392('0x8')](),controller[_0x2392('0xf')]);router[_0x2392('0x7')](_0x2392('0x10'),auth[_0x2392('0x8')](),controller[_0x2392('0x11')]);router[_0x2392('0x7')](_0x2392('0x12'),auth[_0x2392('0x8')](),controller[_0x2392('0x13')]);router[_0x2392('0x7')](_0x2392('0x14'),auth[_0x2392('0x8')](),controller[_0x2392('0x15')]);router['get']('/:id/users',auth[_0x2392('0x8')](),controller['getAgents']);router[_0x2392('0x16')]('/',auth[_0x2392('0x8')](),controller[_0x2392('0x17')]);router[_0x2392('0x16')](_0x2392('0x18'),auth[_0x2392('0x8')](),controller[_0x2392('0x19')]);router['post']('/:id/canned_answers',auth[_0x2392('0x8')](),controller[_0x2392('0x1a')]);router['post'](_0x2392('0x10'),auth[_0x2392('0x8')](),controller[_0x2392('0x1b')]);router[_0x2392('0x16')](_0x2392('0x12'),auth['isAuthenticated'](),controller[_0x2392('0x1c')]);router[_0x2392('0x16')](_0x2392('0x1d'),auth[_0x2392('0x8')](),controller[_0x2392('0x1e')]);router[_0x2392('0x16')]('/updateaccountapplications',auth[_0x2392('0x8')](),controller[_0x2392('0x1f')]);router['post'](_0x2392('0x20'),auth[_0x2392('0x8')](),controller['send']);router[_0x2392('0x16')]('/:id/users',auth[_0x2392('0x8')](),controller[_0x2392('0x21')]);router[_0x2392('0x22')](_0x2392('0xb'),auth[_0x2392('0x8')](),controller[_0x2392('0x23')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2392('0x24')]);router[_0x2392('0x25')](_0x2392('0x18'),auth[_0x2392('0x8')](),controller[_0x2392('0x26')]);router[_0x2392('0x25')](_0x2392('0xe'),auth[_0x2392('0x8')](),controller[_0x2392('0x27')]);router[_0x2392('0x25')]('/:id/users',auth[_0x2392('0x8')](),controller[_0x2392('0x28')]);module[_0x2392('0x29')]=router; \ No newline at end of file +var _0x4427=['removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','addAgents','put','update','delete','destroy','removeDispositions'];(function(_0x25dea5,_0x440b95){var _0x5cc4af=function(_0x22ad08){while(--_0x22ad08){_0x25dea5['push'](_0x25dea5['shift']());}};_0x5cc4af(++_0x440b95);}(_0x4427,0xd5));var _0x7442=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x4427[_0x207d2f];return _0x3c3498;};'use strict';var multer=require(_0x7442('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7442('0x1'));var express=require(_0x7442('0x2'));var router=express[_0x7442('0x3')]();var auth=require(_0x7442('0x4'));var interaction=require(_0x7442('0x5'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x7442('0x6')]('/',auth[_0x7442('0x7')](),controller[_0x7442('0x8')]);router[_0x7442('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x7442('0x9')]);router[_0x7442('0x6')](_0x7442('0xa'),auth[_0x7442('0x7')](),controller[_0x7442('0xb')]);router['get'](_0x7442('0xc'),auth[_0x7442('0x7')](),controller[_0x7442('0xd')]);router[_0x7442('0x6')](_0x7442('0xe'),auth[_0x7442('0x7')](),controller[_0x7442('0xf')]);router[_0x7442('0x6')](_0x7442('0x10'),auth[_0x7442('0x7')](),controller[_0x7442('0x11')]);router[_0x7442('0x6')](_0x7442('0x12'),auth['isAuthenticated'](),controller[_0x7442('0x13')]);router[_0x7442('0x6')]('/:id/messages',auth[_0x7442('0x7')](),controller[_0x7442('0x14')]);router['get'](_0x7442('0x15'),auth[_0x7442('0x7')](),controller[_0x7442('0x16')]);router[_0x7442('0x17')]('/',auth[_0x7442('0x7')](),controller[_0x7442('0x18')]);router['post'](_0x7442('0xc'),auth[_0x7442('0x7')](),controller[_0x7442('0x19')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7442('0x1a')]);router[_0x7442('0x17')](_0x7442('0x10'),auth[_0x7442('0x7')](),controller[_0x7442('0x1b')]);router[_0x7442('0x17')](_0x7442('0x12'),auth['isAuthenticated'](),controller[_0x7442('0x1c')]);router[_0x7442('0x17')](_0x7442('0x1d'),auth[_0x7442('0x7')](),controller[_0x7442('0x1e')]);router[_0x7442('0x17')]('/updateaccountapplications',auth[_0x7442('0x7')](),controller[_0x7442('0x1f')]);router[_0x7442('0x17')](_0x7442('0x20'),auth[_0x7442('0x7')](),controller['send']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x7442('0x21')]);router[_0x7442('0x22')]('/:id',auth[_0x7442('0x7')](),controller[_0x7442('0x23')]);router[_0x7442('0x24')](_0x7442('0xa'),auth[_0x7442('0x7')](),controller[_0x7442('0x25')]);router['delete'](_0x7442('0xc'),auth[_0x7442('0x7')](),controller[_0x7442('0x26')]);router[_0x7442('0x24')](_0x7442('0xe'),auth['isAuthenticated'](),controller[_0x7442('0x27')]);router[_0x7442('0x24')](_0x7442('0x15'),auth[_0x7442('0x7')](),controller[_0x7442('0x28')]);module[_0x7442('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c1daea3..4b9cb07 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 _0xfa4d=['sequelize','exports','STRING','*,*,*,*'];(function(_0x4ac85a,_0x644ea){var _0x585481=function(_0x4b428e){while(--_0x4b428e){_0x4ac85a['push'](_0x4ac85a['shift']());}};_0x585481(++_0x644ea);}(_0xfa4d,0x90));var _0xdfa4=function(_0x20f5a3,_0x282bbb){_0x20f5a3=_0x20f5a3-0x0;var _0xce508c=_0xfa4d[_0x20f5a3];return _0xce508c;};'use strict';var Sequelize=require(_0xdfa4('0x0'));module[_0xdfa4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdfa4('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xdfa4('0x2')],'defaultValue':_0xdfa4('0x3')}}; \ No newline at end of file +var _0xcf54=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x518b99,_0x4333e4){var _0x45faed=function(_0x48efa3){while(--_0x48efa3){_0x518b99['push'](_0x518b99['shift']());}};_0x45faed(++_0x4333e4);}(_0xcf54,0x125));var _0x4cf5=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0xcf54[_0x3a607e];return _0x37b106;};'use strict';var Sequelize=require('sequelize');module[_0x4cf5('0x0')]={'priority':{'type':Sequelize[_0x4cf5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4cf5('0x2')],'allowNull':![],'defaultValue':_0x4cf5('0x3')},'appdata':{'type':Sequelize[_0x4cf5('0x4')]()},'description':{'type':Sequelize[_0x4cf5('0x2')]},'interval':{'type':Sequelize[_0x4cf5('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e9614e0..7661327 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 _0xe14b=['options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','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','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','FaxApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL'];(function(_0x3e7d0d,_0x4d16ab){var _0x2e5c70=function(_0x5ee512){while(--_0x5ee512){_0x3e7d0d['push'](_0x3e7d0d['shift']());}};_0x2e5c70(++_0x4d16ab);}(_0xe14b,0x93));var _0xbe14=function(_0x38a36d,_0x845cb4){_0x38a36d=_0x38a36d-0x0;var _0x794036=_0xe14b[_0x38a36d];return _0x794036;};'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 db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['FaxApplication'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['FaxApplication'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));}; \ No newline at end of file +var _0x9957=['params','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','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','FaxApplication','count','includeAll','include','findAll','rows','show','find','catch','create','body','update'];(function(_0x9fec40,_0x584096){var _0x46fe45=function(_0x3ba788){while(--_0x3ba788){_0x9fec40['push'](_0x9fec40['shift']());}};_0x46fe45(++_0x584096);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['FaxApplication'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 41590aa..8964b8f 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 _0x03c6=['FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./faxApplication.attributes','exports','define'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0x03c6,0xc8));var _0x603c=function(_0x6c6334,_0x17896c){_0x6c6334=_0x6c6334-0x0;var _0xf1d531=_0x03c6[_0x6c6334];return _0xf1d531;};'use strict';var _=require(_0x603c('0x0'));var util=require('util');var logger=require(_0x603c('0x1'))(_0x603c('0x2'));var moment=require(_0x603c('0x3'));var BPromise=require(_0x603c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x603c('0x5'));var rimraf=require(_0x603c('0x6'));var config=require('../../config/environment');var attributes=require(_0x603c('0x7'));module[_0x603c('0x8')]=function(_0x575334,_0x378217){return _0x575334[_0x603c('0x9')](_0x603c('0xa'),attributes,{'tableName':_0x603c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x603c('0xc'),'collate':_0x603c('0xd')});}; \ No newline at end of file +var _0x7445=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0xfe61ca,_0x3095a9){var _0x58e87e=function(_0x1d147e){while(--_0x1d147e){_0xfe61ca['push'](_0xfe61ca['shift']());}};_0x58e87e(++_0x3095a9);}(_0x7445,0xd2));var _0x5744=function(_0x29cf89,_0x10ce1f){_0x29cf89=_0x29cf89-0x0;var _0x34ac61=_0x7445[_0x29cf89];return _0x34ac61;};'use strict';var _=require('lodash');var util=require(_0x5744('0x0'));var logger=require(_0x5744('0x1'))(_0x5744('0x2'));var moment=require(_0x5744('0x3'));var BPromise=require(_0x5744('0x4'));var rp=require(_0x5744('0x5'));var fs=require('fs');var path=require(_0x5744('0x6'));var rimraf=require(_0x5744('0x7'));var config=require(_0x5744('0x8'));var attributes=require(_0x5744('0x9'));module[_0x5744('0xa')]=function(_0x34d90c,_0x1a1f63){return _0x34d90c['define'](_0x5744('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5744('0xc'),'collate':_0x5744('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 6f0d51a..727e21d 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 _0x5ddc=['jayson/promise','client','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','UpdateFaxApplication','update','body','options','raw','where','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0x5ddc,0xeb));var _0xc5dd=function(_0x21ff74,_0x267181){_0x21ff74=_0x21ff74-0x0;var _0x2ab139=_0x5ddc[_0x21ff74];return _0x2ab139;};'use strict';var _=require(_0xc5dd('0x0'));var util=require('util');var moment=require(_0xc5dd('0x1'));var BPromise=require(_0xc5dd('0x2'));var rs=require(_0xc5dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc5dd('0x4'));var logger=require(_0xc5dd('0x5'))(_0xc5dd('0x6'));var config=require(_0xc5dd('0x7'));var jayson=require(_0xc5dd('0x8'));var client=jayson[_0xc5dd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a284d,_0x3ccaa8,_0x4793cd){return new BPromise(function(_0x3758c1,_0xa9baf2){return client['request'](_0x5a284d,_0x4793cd)[_0xc5dd('0xa')](function(_0x572c99){logger['info'](_0xc5dd('0xb'),_0x3ccaa8,_0xc5dd('0xc'));logger[_0xc5dd('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3ccaa8,_0xc5dd('0xc'),JSON[_0xc5dd('0xe')](_0x572c99));if(_0x572c99[_0xc5dd('0xf')]){if(_0x572c99[_0xc5dd('0xf')][_0xc5dd('0x10')]===0x1f4){logger[_0xc5dd('0xf')](_0xc5dd('0xb'),_0x3ccaa8,_0x572c99[_0xc5dd('0xf')]['message']);return _0xa9baf2(_0x572c99[_0xc5dd('0xf')][_0xc5dd('0x11')]);}logger['error'](_0xc5dd('0xb'),_0x3ccaa8,_0x572c99[_0xc5dd('0xf')][_0xc5dd('0x11')]);return _0x3758c1(_0x572c99[_0xc5dd('0xf')][_0xc5dd('0x11')]);}else{logger[_0xc5dd('0x12')](_0xc5dd('0xb'),_0x3ccaa8,_0xc5dd('0xc'));_0x3758c1(_0x572c99['result'][_0xc5dd('0x11')]);}})[_0xc5dd('0x13')](function(_0x49a30c){logger[_0xc5dd('0xf')](_0xc5dd('0xb'),_0x3ccaa8,_0x49a30c);_0xa9baf2(_0x49a30c);});});}exports[_0xc5dd('0x14')]=function(_0x434342){var _0x44449b=this;return new Promise(function(_0x40f77a,_0x216553){return db['FaxApplication'][_0xc5dd('0x15')](_0x434342[_0xc5dd('0x16')],{'raw':_0x434342[_0xc5dd('0x17')]?_0x434342[_0xc5dd('0x17')][_0xc5dd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x434342[_0xc5dd('0x17')]?_0x434342[_0xc5dd('0x17')][_0xc5dd('0x19')]||null:null,'attributes':_0x434342[_0xc5dd('0x17')]?_0x434342[_0xc5dd('0x17')]['attributes']||null:null,'limit':_0x434342[_0xc5dd('0x17')]?_0x434342[_0xc5dd('0x17')][_0xc5dd('0x1a')]||null:null})[_0xc5dd('0xa')](function(_0x2e458a){logger[_0xc5dd('0x12')](_0xc5dd('0x14'),_0x434342);logger[_0xc5dd('0xd')]('UpdateFaxApplication',_0x434342,JSON[_0xc5dd('0xe')](_0x2e458a));_0x40f77a(_0x2e458a);})[_0xc5dd('0x13')](function(_0x4586f4){logger[_0xc5dd('0xf')](_0xc5dd('0x14'),_0x4586f4['message'],_0x434342);_0x216553(_0x44449b[_0xc5dd('0xf')](0x1f4,_0x4586f4[_0xc5dd('0x11')]));});});}; \ No newline at end of file +var _0x8f25=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','UpdateFaxApplication','update','options','raw','where','attributes','limit','catch','lodash','util'];(function(_0x2c7377,_0x32ade5){var _0x35e181=function(_0x1be1e6){while(--_0x1be1e6){_0x2c7377['push'](_0x2c7377['shift']());}};_0x35e181(++_0x32ade5);}(_0x8f25,0xd7));var _0x58f2=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8f25[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var moment=require(_0x58f2('0x2'));var BPromise=require(_0x58f2('0x3'));var rs=require(_0x58f2('0x4'));var fs=require('fs');var Redis=require(_0x58f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x58f2('0x6'));var logger=require(_0x58f2('0x7'))('rpc');var config=require(_0x58f2('0x8'));var jayson=require(_0x58f2('0x9'));var client=jayson[_0x58f2('0xa')][_0x58f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ad28c,_0x1da43a,_0x5d8d63){return new BPromise(function(_0x422a3a,_0x2638cd){return client[_0x58f2('0xc')](_0x5ad28c,_0x5d8d63)[_0x58f2('0xd')](function(_0x13621a){logger['info'](_0x58f2('0xe'),_0x1da43a,_0x58f2('0xf'));logger[_0x58f2('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1da43a,_0x58f2('0xf'),JSON[_0x58f2('0x11')](_0x13621a));if(_0x13621a[_0x58f2('0x12')]){if(_0x13621a['error'][_0x58f2('0x13')]===0x1f4){logger[_0x58f2('0x12')](_0x58f2('0xe'),_0x1da43a,_0x13621a[_0x58f2('0x12')][_0x58f2('0x14')]);return _0x2638cd(_0x13621a[_0x58f2('0x12')][_0x58f2('0x14')]);}logger[_0x58f2('0x12')](_0x58f2('0xe'),_0x1da43a,_0x13621a['error'][_0x58f2('0x14')]);return _0x422a3a(_0x13621a['error'][_0x58f2('0x14')]);}else{logger[_0x58f2('0x15')](_0x58f2('0xe'),_0x1da43a,_0x58f2('0xf'));_0x422a3a(_0x13621a[_0x58f2('0x16')][_0x58f2('0x14')]);}})['catch'](function(_0x5bb74f){logger[_0x58f2('0x12')]('FaxApplication,\x20%s,\x20%s',_0x1da43a,_0x5bb74f);_0x2638cd(_0x5bb74f);});});}exports[_0x58f2('0x17')]=function(_0x4cdb2a){var _0x326df7=this;return new Promise(function(_0x3ab0b2,_0x268115){return db['FaxApplication'][_0x58f2('0x18')](_0x4cdb2a['body'],{'raw':_0x4cdb2a[_0x58f2('0x19')]?_0x4cdb2a[_0x58f2('0x19')][_0x58f2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cdb2a[_0x58f2('0x19')]?_0x4cdb2a[_0x58f2('0x19')][_0x58f2('0x1b')]||null:null,'attributes':_0x4cdb2a['options']?_0x4cdb2a[_0x58f2('0x19')][_0x58f2('0x1c')]||null:null,'limit':_0x4cdb2a['options']?_0x4cdb2a['options'][_0x58f2('0x1d')]||null:null})['then'](function(_0x1bde5f){logger[_0x58f2('0x15')](_0x58f2('0x17'),_0x4cdb2a);logger[_0x58f2('0x10')]('UpdateFaxApplication',_0x4cdb2a,JSON[_0x58f2('0x11')](_0x1bde5f));_0x3ab0b2(_0x1bde5f);})[_0x58f2('0x1e')](function(_0x9eeb1e){logger[_0x58f2('0x12')]('UpdateFaxApplication',_0x9eeb1e['message'],_0x4cdb2a);_0x268115(_0x326df7[_0x58f2('0x12')](0x1f4,_0x9eeb1e[_0x58f2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index cf852b2..2cbd761 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 _0x2675=['post','put','update','delete','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2083cc,_0x56f83f){var _0x2e3543=function(_0x34000a){while(--_0x34000a){_0x2083cc['push'](_0x2083cc['shift']());}};_0x2e3543(++_0x56f83f);}(_0x2675,0x75));var _0x5267=function(_0xe3ef06,_0x5c549e){_0xe3ef06=_0xe3ef06-0x0;var _0x9d5308=_0x2675[_0xe3ef06];return _0x9d5308;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./faxApplication.controller');router[_0x5267('0x5')]('/',auth[_0x5267('0x6')](),controller[_0x5267('0x7')]);router[_0x5267('0x5')](_0x5267('0x8'),auth[_0x5267('0x6')](),controller['show']);router[_0x5267('0x9')]('/',auth[_0x5267('0x6')](),controller['create']);router[_0x5267('0xa')]('/:id',auth[_0x5267('0x6')](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x6')](),controller['destroy']);module[_0x5267('0xd')]=router; \ No newline at end of file +var _0x2675=['post','put','update','delete','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0xca78f1,_0x484915){var _0x335260=function(_0x665794){while(--_0x665794){_0xca78f1['push'](_0xca78f1['shift']());}};_0x335260(++_0x484915);}(_0x2675,0x75));var _0x5267=function(_0x2d2839,_0x471f73){_0x2d2839=_0x2d2839-0x0;var _0x4715b1=_0x2675[_0x2d2839];return _0x4715b1;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./faxApplication.controller');router[_0x5267('0x5')]('/',auth[_0x5267('0x6')](),controller[_0x5267('0x7')]);router[_0x5267('0x5')](_0x5267('0x8'),auth[_0x5267('0x6')](),controller['show']);router[_0x5267('0x9')]('/',auth[_0x5267('0x6')](),controller['create']);router[_0x5267('0xa')]('/:id',auth[_0x5267('0x6')](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x6')](),controller['destroy']);module[_0x5267('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index cee2dc4..b33d546 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 _0x8170=['STRING','out','exports','BOOLEAN','DATE'];(function(_0xc4be99,_0x55478d){var _0x56a73e=function(_0x1030e0){while(--_0x1030e0){_0xc4be99['push'](_0xc4be99['shift']());}};_0x56a73e(++_0x55478d);}(_0x8170,0x183));var _0x0817=function(_0x4b0855,_0x157a23){_0x4b0855=_0x4b0855-0x0;var _0x433f30=_0x8170[_0x4b0855];return _0x433f30;};'use strict';var Sequelize=require('sequelize');module[_0x0817('0x0')]={'closed':{'type':Sequelize[_0x0817('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0817('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0817('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0817('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2f1d=['ENUM','out','BOOLEAN','STRING','DATE'];(function(_0xdca284,_0x588ba6){var _0x4ad799=function(_0x3bc793){while(--_0x3bc793){_0xdca284['push'](_0xdca284['shift']());}};_0x4ad799(++_0x588ba6);}(_0x2f1d,0x129));var _0xd2f1=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x2f1d[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xd2f1('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd2f1('0x1')]},'note':{'type':Sequelize[_0xd2f1('0x1')]},'read1stAt':{'type':Sequelize[_0xd2f1('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xd2f1('0x3')]('in',_0xd2f1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd2f1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd2f1('0x3')]('in',_0xd2f1('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 0173b77..aec6e26 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 _0xdbfc=['SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','catch','show','includeAll','include','options','create','update','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','filter','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','server','files','join','attachments','format','Attachment','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','log','unlinkSync','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','FaxInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','\x27\x27\x27\x27','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone'];(function(_0x23b666,_0x4fa683){var _0x12a93d=function(_0x3aa4a9){while(--_0x3aa4a9){_0x23b666['push'](_0x23b666['shift']());}};_0x12a93d(++_0x4fa683);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x2e5b8d,_0x2a07aa){_0x2e5b8d=_0x2e5b8d-0x0;var _0x5f4f18=_0xdbfc[_0x2e5b8d];return _0x5f4f18;};'use strict';var pdf=require(_0xcdbf('0x0'));var emlformat=require(_0xcdbf('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdbf('0x2'));var rp=require(_0xcdbf('0x3'));var moment=require(_0xcdbf('0x4'));var BPromise=require(_0xcdbf('0x5'));var Mustache=require(_0xcdbf('0x6'));var util=require(_0xcdbf('0x7'));var path=require(_0xcdbf('0x8'));var sox=require('sox');var csv=require(_0xcdbf('0x9'));var ejs=require(_0xcdbf('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcdbf('0xb'));var crypto=require(_0xcdbf('0xc'));var jsforce=require(_0xcdbf('0xd'));var deskjs=require(_0xcdbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcdbf('0xf'));var Papa=require(_0xcdbf('0x10'));var Redis=require(_0xcdbf('0x11'));var authService=require(_0xcdbf('0x12'));var qs=require(_0xcdbf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdbf('0x14'));var logger=require('../../config/logger')(_0xcdbf('0x15'));var utils=require('../../config/utils');var config=require(_0xcdbf('0x16'));var db=require('../../mysqldb')['db'];config[_0xcdbf('0x17')]=_[_0xcdbf('0x18')](config[_0xcdbf('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdbf('0x19'))(new Redis(config['redis']));require(_0xcdbf('0x1a'))[_0xcdbf('0x1b')](socket);function respondWithStatusCode(_0xe632be,_0x395ff8){_0x395ff8=_0x395ff8||0xcc;return function(_0x3e3881){if(_0x3e3881){return _0xe632be['sendStatus'](_0x395ff8);}return _0xe632be[_0xcdbf('0x1c')](_0x395ff8)[_0xcdbf('0x1d')]();};}function respondWithResult(_0x1ce3bb,_0x461b53){_0x461b53=_0x461b53||0xc8;return function(_0x17334c){if(_0x17334c){return _0x1ce3bb[_0xcdbf('0x1c')](_0x461b53)[_0xcdbf('0x1e')](_0x17334c);}};}function respondWithFilteredResult(_0x263f54,_0x2fd95b){return function(_0x3b3630){if(_0x3b3630){var _0x133959=_0x3b3630[_0xcdbf('0x1f')],_0x4b7f78=_0x2fd95b[_0xcdbf('0x20')],_0x270e96=_0x2fd95b[_0xcdbf('0x20')]+_0x2fd95b[_0xcdbf('0x21')],_0x402166;if(_0x270e96>=_0x133959){_0x270e96=_0x133959;_0x402166=0xc8;}else{_0x402166=0xce;}_0x263f54['status'](_0x402166);return _0x263f54[_0xcdbf('0x22')](_0xcdbf('0x23'),_0x4b7f78+'-'+_0x270e96+'/'+_0x133959)[_0xcdbf('0x1e')](_0x3b3630);}return null;};}function patchUpdates(_0x3c044c){return function(_0x169e41){try{jsonpatch['apply'](_0x169e41,_0x3c044c,!![]);}catch(_0x264c6b){return BPromise[_0xcdbf('0x24')](_0x264c6b);}return _0x169e41[_0xcdbf('0x25')]();};}function saveUpdates(_0x123d96,_0x4e90cc){return function(_0x40da4f){if(_0x40da4f){return _0x40da4f['update'](_0x123d96)['then'](function(_0xeb67c4){return _0xeb67c4;});}return null;};}function removeEntity(_0x488013,_0x7fb6b7){return function(_0x16b328){if(_0x16b328){return _0x16b328[_0xcdbf('0x26')]()[_0xcdbf('0x27')](function(){_0x488013[_0xcdbf('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x464c9f,_0x102f5c){return function(_0x19898b){if(!_0x19898b){_0x464c9f[_0xcdbf('0x28')](0x194);}return _0x19898b;};}function handleError(_0x3b6da3,_0x3ef24b){_0x3ef24b=_0x3ef24b||0x1f4;return function(_0x2e95bf){logger['error'](_0x2e95bf[_0xcdbf('0x29')]);if(_0x2e95bf[_0xcdbf('0x2a')]){delete _0x2e95bf[_0xcdbf('0x2a')];}_0x3b6da3[_0xcdbf('0x1c')](_0x3ef24b)[_0xcdbf('0x2b')](_0x2e95bf);};}function getInteractionUsers(_0x48f4a,_0x3c3c4b){return new BPromise(function(_0x55088d,_0x30b753){try{if(_0x3c3c4b[_0x48f4a['id']]){_0x48f4a[_0xcdbf('0x2c')]=_[_0xcdbf('0x2d')](_0x3c3c4b[_0x48f4a['id']],function(_0x3e1228){return{'id':_0x3e1228['id'],'fullname':_0x3e1228[_0xcdbf('0x2e')]};});}}catch(_0x575be6){_0x30b753(_0x575be6);}_0x55088d(_0x48f4a);});}function getInteractionTags(_0x2863d0,_0x10cac2){return new BPromise(function(_0xcc7e4e,_0x1dfce2){try{if(_0x2863d0[_0xcdbf('0x2f')]){_0x2863d0[_0xcdbf('0x30')]=[];_0x2863d0['TagIds'][_0xcdbf('0x31')](',')[_0xcdbf('0x32')](function(_0x39e439){_0x2863d0[_0xcdbf('0x30')][_0xcdbf('0x33')](_0x10cac2[_0x39e439]);});}delete _0x2863d0['TagIds'];}catch(_0x157399){_0x1dfce2(_0x157399);}_0xcc7e4e(_0x2863d0);});}function updateFaxInteraction(_0x272e27,_0xbfe717,_0x3cb09f){return new BPromise(function(_0x209e39,_0x42513e){return getInteractionUsers(_0x272e27,_0x3cb09f)[_0xcdbf('0x27')](function(_0x8fea82){return getInteractionTags(_0x8fea82,_0xbfe717);})[_0xcdbf('0x27')](function(_0x40bac1){_0x209e39(_0x40bac1);})['catch'](function(_0x531bf8){_0x42513e(_0x531bf8);});});}exports[_0xcdbf('0x34')]=function(_0x44a0a8,_0xc6695){var _0x483837={},_0x13b93a={},_0x40c17d={'count':0x0,'rows':[]};var _0x1fa97f=_[_0xcdbf('0x2d')](db[_0xcdbf('0x35')][_0xcdbf('0x36')],function(_0x40cffe){return{'name':_0x40cffe[_0xcdbf('0x37')],'type':_0x40cffe['type'][_0xcdbf('0x38')]};});_0x13b93a['model']=_[_0xcdbf('0x2d')](_0x1fa97f,'name');_0x13b93a[_0xcdbf('0x39')]=_[_0xcdbf('0x3a')](_0x44a0a8[_0xcdbf('0x39')]);_0x13b93a[_0xcdbf('0x3b')]=_[_0xcdbf('0x3c')](_0x13b93a[_0xcdbf('0x3d')],_0x13b93a[_0xcdbf('0x39')]);_0x483837[_0xcdbf('0x3e')]=_[_0xcdbf('0x3c')](_0x13b93a[_0xcdbf('0x3d')],qs['fields'](_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x3f')]));_0x483837[_0xcdbf('0x3e')]=_0x483837[_0xcdbf('0x3e')]['length']?_0x483837[_0xcdbf('0x3e')]:_0x13b93a[_0xcdbf('0x3d')];if(!_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x40')](_0xcdbf('0x41'))){_0x483837[_0xcdbf('0x21')]=qs[_0xcdbf('0x21')](_0x44a0a8[_0xcdbf('0x39')]['limit']);_0x483837[_0xcdbf('0x20')]=qs[_0xcdbf('0x20')](_0x44a0a8['query'][_0xcdbf('0x20')]);}_0x483837[_0xcdbf('0x42')]=qs[_0xcdbf('0x43')](_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x43')]);_0x483837[_0xcdbf('0x44')]=qs[_0xcdbf('0x3b')](_[_0xcdbf('0x45')](_0x44a0a8[_0xcdbf('0x39')],_0x13b93a[_0xcdbf('0x3b')]),_0x1fa97f);var _0x17e564=[];var _0x4c444a=squel[_0xcdbf('0x46')]()[_0xcdbf('0x47')]('id')[_0xcdbf('0x47')]('name')[_0xcdbf('0x47')](_0xcdbf('0x48'))[_0xcdbf('0x49')](_0xcdbf('0x4a'));var _0x3df41b=squel[_0xcdbf('0x46')]()['field'](_0xcdbf('0x4b'))[_0xcdbf('0x47')](_0xcdbf('0x4c'))[_0xcdbf('0x47')]('ui.FaxInteractionId')['from'](_0xcdbf('0x4d'),'ui')[_0xcdbf('0x4e')](_0xcdbf('0x4f'),'u',_0xcdbf('0x50'));var _0x153884=squel['select']()[_0xcdbf('0x49')]('fax_interactions','i')[_0xcdbf('0x4e')](_0xcdbf('0x51'),'c',_0xcdbf('0x52'))['left_join'](_0xcdbf('0x4f'),'o','o.id\x20=\x20i.UserId')[_0xcdbf('0x4e')](_0xcdbf('0x53'),'a',_0xcdbf('0x54'))[_0xcdbf('0x4e')](_0xcdbf('0x55'),'me',_0xcdbf('0x56'))[_0xcdbf('0x4e')](_0xcdbf('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xcdbf('0x4e')](_0xcdbf('0x4a'),'t',_0xcdbf('0x58'));var _0x44e701=squel['expr']();var _0x2c0066=[];var _0x296633=squel[_0xcdbf('0x59')]();var _0x254dc4;if(_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x5a')]){_0x254dc4=as['parseSearch'](_0x44a0a8['query'][_0xcdbf('0x5a')]);var _0x241907=_0x254dc4[_0xcdbf('0x5b')];for(var _0x582efb=0x0;_0x582efb<_0x254dc4[_0xcdbf('0x5c')][_0xcdbf('0x5d')];_0x582efb++){var _0x1c0739=_0x254dc4[_0xcdbf('0x5c')][_0x582efb];var _0x2b5fdb='i';var _0x49f54f=_[_0xcdbf('0x5e')](_0x1fa97f,[_0xcdbf('0x2a'),_0x1c0739['field']]);if(!_0x49f54f){switch(_0x1c0739[_0xcdbf('0x47')]){case _0xcdbf('0x5f'):if(_0x1c0739[_0xcdbf('0x60')]==0x1){_0x153884[_0xcdbf('0x61')]('`'+_0x1c0739[_0xcdbf('0x47')]+_0xcdbf('0x62'));}else{_0x153884[_0xcdbf('0x61')]('`'+_0x1c0739[_0xcdbf('0x47')]+_0xcdbf('0x63'));}break;case'Contact':if(_0x1c0739['operator']==='$substring'){if(_0x1c0739[_0xcdbf('0x60')]['split']('\x20')[_0xcdbf('0x5d')]>0x1){_0x44e701[_0x241907]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcdbf('0x64')](_0x1c0739['value']),null);}else{var _0x5083db='%'+_0x1c0739[_0xcdbf('0x60')]+'%';_0x44e701[_0x241907]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5083db,_0x5083db,_0x5083db);}}else{_0x49f54f=_[_0xcdbf('0x5e')](_0x1fa97f,[_0xcdbf('0x2a'),_0xcdbf('0x65')]);_0x1c0739['field']='ContactId';_0x2d9399=as[_0xcdbf('0x66')](_0x2b5fdb,_0x49f54f[_0xcdbf('0x67')],_0x1c0739);_0x44e701[_0x241907](_0x2d9399[_0xcdbf('0x68')],_0x2d9399[_0xcdbf('0x60')][_0xcdbf('0x69')],_0x2d9399['value'][_0xcdbf('0x1d')]);}break;case _0xcdbf('0x6a'):var _0x287a1b=_0x1c0739[_0xcdbf('0x60')][_0xcdbf('0x31')](',')[_0xcdbf('0x2d')](function(_0x32cba1){return Number(_0x32cba1);});_0x287a1b[_0xcdbf('0x32')](function(_0x1f6f3c){_0x296633['or'](_0xcdbf('0x6b'),'%,'+_0x1f6f3c+',%');});_0x2c0066=_[_0xcdbf('0x6c')](_0x2c0066,_0x287a1b);break;case'User':if(_0x1c0739[_0xcdbf('0x6d')]===_0xcdbf('0x6e')){_0x44e701[_0x241907](_0xcdbf('0x6f'),'%'+_0x1c0739['value']+'%',null);}else{_0x49f54f=_[_0xcdbf('0x5e')](_0x1fa97f,[_0xcdbf('0x2a'),'UserId']);_0x1c0739[_0xcdbf('0x47')]=_0xcdbf('0x70');_0x2d9399=as[_0xcdbf('0x66')](_0x2b5fdb,_0x49f54f[_0xcdbf('0x67')],_0x1c0739);_0x44e701[_0x241907](_0x2d9399[_0xcdbf('0x68')],_0x2d9399[_0xcdbf('0x60')][_0xcdbf('0x69')],_0x2d9399[_0xcdbf('0x60')][_0xcdbf('0x1d')]);}break;case _0xcdbf('0x71'):_0x2d9399=as[_0xcdbf('0x66')]('me',null,_0x1c0739);_0x44e701[_0x241907](_0x2d9399[_0xcdbf('0x68')],_0x2d9399[_0xcdbf('0x60')][_0xcdbf('0x69')],_0x2d9399[_0xcdbf('0x60')][_0xcdbf('0x1d')]);break;}}else{var _0x2d9399=as[_0xcdbf('0x66')](_0x2b5fdb,_0x49f54f[_0xcdbf('0x67')],_0x1c0739);_0x44e701[_0x241907](_0x2d9399['text'],_0x2d9399[_0xcdbf('0x60')][_0xcdbf('0x69')],_0x2d9399[_0xcdbf('0x60')][_0xcdbf('0x1d')]);}}}else{var _0x4124ab=_(_0x44a0a8[_0xcdbf('0x39')])['keys']()[_0xcdbf('0x2d')](function(_0x106f4a){return _[_0xcdbf('0x72')](_0x1fa97f,[_0xcdbf('0x2a'),_0x106f4a])?_0x106f4a:undefined;})[_0xcdbf('0x73')]()[_0xcdbf('0x60')]();if(!_[_0xcdbf('0x74')](_0x4124ab)){_0x4124ab['forEach'](function(_0x570e85){if(_0x570e85==='FaxAccountId'){_0x153884[_0xcdbf('0x44')](_0xcdbf('0x75'),[]['concat'](_0x44a0a8[_0xcdbf('0x39')][_0x570e85]));}else if(_0x570e85===_0xcdbf('0x76')){var _0x3af934=JSON['parse'](_0x44a0a8[_0xcdbf('0x39')][_0x570e85])[_0xcdbf('0x77')];var _0x1fa963=JSON[_0xcdbf('0x78')](_0x44a0a8['query'][_0x570e85])[_0xcdbf('0x79')];_0x153884[_0xcdbf('0x44')](_0xcdbf('0x7a'),_0x3af934,_0x1fa963);}else{if(_0x44a0a8[_0xcdbf('0x39')][_0x570e85]===_0xcdbf('0x7b')){_0x153884[_0xcdbf('0x44')]('i.'+_0x570e85+_0xcdbf('0x7c'));}else{_0x153884[_0xcdbf('0x44')]('i.'+_0x570e85+'\x20=\x20?',_0x44a0a8[_0xcdbf('0x39')][_0x570e85]);}}});}if(_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x7d')]){if(_0x44a0a8['query'][_0xcdbf('0x7d')]==0x1){_0x153884[_0xcdbf('0x61')](_0xcdbf('0x7e'));}else{_0x153884[_0xcdbf('0x61')](_0xcdbf('0x7f'));}}if(_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x80')]){_0x2c0066=_[_0xcdbf('0x81')](_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x80')])?_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x80')]:new Array(_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x80')]);_0x2c0066[_0xcdbf('0x32')](function(_0x3919be){_0x296633['or'](_0xcdbf('0x6b'),'%,'+_0x3919be+',%');});}if(_0x44a0a8[_0xcdbf('0x39')]['filter']){var _0x4a384b=_0x44a0a8[_0xcdbf('0x39')]['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xcdbf('0x82'));if(qs['isNumeric'](_0x4a384b)){_0x44e701['or']('i.id\x20LIKE\x20?',_0x4a384b+'%')['or'](_0xcdbf('0x83'),_0x4a384b+'%');}_0x44e701['or'](_0xcdbf('0x84'),_0x4a384b+'%');}}_0x153884['where'](_0x44e701);_0x153884[_0xcdbf('0x85')](_0xcdbf('0x86'));var _0x456653={'type':db[_0xcdbf('0x87')][_0xcdbf('0x88')][_0xcdbf('0x89')],'raw':!![]};var _0x53a2bc=_0x153884[_0xcdbf('0x8a')]();_0x53a2bc[_0xcdbf('0x47')](_0xcdbf('0x86'));_0x53a2bc[_0xcdbf('0x47')](_0xcdbf('0x8b'),'unreadMessages');if(_0x483837[_0xcdbf('0x42')]){_0x483837[_0xcdbf('0x42')]['forEach'](function(_0x41225f){_0x153884[_0xcdbf('0x42')]('i.'+_0x41225f[0x0],_0x41225f[0x1]==='DESC'?![]:!![]);});}if(!_[_0xcdbf('0x74')](_0x2c0066)){_0x153884[_0xcdbf('0x61')](_0x296633);_0x53a2bc[_0xcdbf('0x44')](_0xcdbf('0x8c'),_0x2c0066);}BPromise[_0xcdbf('0x8d')]()[_0xcdbf('0x27')](function(){if(!_0x254dc4){if(_0x44a0a8[_0xcdbf('0x39')][_0xcdbf('0x8e')]||_0x44a0a8[_0xcdbf('0x39')]['journey'])return;_0x53a2bc['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x153884[_0xcdbf('0x44')](_0xcdbf('0x8f'));return;}return _0x44a0a8[_0xcdbf('0x90')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x1b1793){if(_[_0xcdbf('0x74')](_0x1b1793)){_0x53a2bc['where'](_0xcdbf('0x91'));_0x153884['where'](_0xcdbf('0x91'));}else{_0x53a2bc[_0xcdbf('0x44')](_0xcdbf('0x75'),_['map'](_0x1b1793,'id'));_0x153884[_0xcdbf('0x44')](_0xcdbf('0x75'),_['map'](_0x1b1793,'id'));}});})[_0xcdbf('0x27')](function(){db[_0xcdbf('0x92')]['query'](_0x53a2bc[_0xcdbf('0x93')](),_0x456653)[_0xcdbf('0x27')](function(_0x14f740){_0x40c17d['count']=_0x14f740[_0xcdbf('0x5d')];if(_0x40c17d['count']===0x0)return[];return db['sequelize'][_0xcdbf('0x39')](_0x4c444a[_0xcdbf('0x93')](),_0x456653)[_0xcdbf('0x27')](function(_0x32514d){_0x17e564=_['keyBy'](_0x32514d,'id');_0x456653=_[_0xcdbf('0x94')](_0x456653,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44a0a8['query']['fields']){_0x483837['attributes'][_0xcdbf('0x32')](function(_0x479a6d){_0x153884[_0xcdbf('0x47')]('i.'+_0x479a6d);});}else{_0x153884[_0xcdbf('0x47')](_0xcdbf('0x8b'),_0xcdbf('0x5f'));_0x153884[_0xcdbf('0x47')](_0xcdbf('0x95'),_0xcdbf('0x96'));_0x153884['field']('a.mandatoryDisposition',_0xcdbf('0x97'));_0x153884[_0xcdbf('0x47')](_0xcdbf('0x98'));_0x153884[_0xcdbf('0x47')]('c.firstName',_0xcdbf('0x99'));_0x153884[_0xcdbf('0x47')](_0xcdbf('0x9a'),_0xcdbf('0x9b'));_0x153884[_0xcdbf('0x47')](_0xcdbf('0x9c'),_0xcdbf('0x9d'));_0x153884[_0xcdbf('0x47')](_0xcdbf('0x9e'),_0xcdbf('0x9f'));_0x153884[_0xcdbf('0x47')](_0xcdbf('0xa0'),'Contact.mobile');_0x153884[_0xcdbf('0x47')](_0xcdbf('0xa1'),_0xcdbf('0xa2'));_0x153884[_0xcdbf('0x47')](_0xcdbf('0xa3'),_0xcdbf('0xa4'));_0x153884[_0xcdbf('0x47')](_0xcdbf('0xa5'),_0xcdbf('0xa6'));_0x153884[_0xcdbf('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xcdbf('0x2f'));}if(_0x483837['limit'])_0x153884[_0xcdbf('0x21')](_0x483837[_0xcdbf('0x21')]);if(_0x483837[_0xcdbf('0x20')])_0x153884[_0xcdbf('0x20')](_0x483837[_0xcdbf('0x20')]);return db[_0xcdbf('0x92')][_0xcdbf('0x39')](_0x153884[_0xcdbf('0x93')](),_0x456653);})[_0xcdbf('0x27')](function(_0x1e6dba){_0x3df41b['where'](_0xcdbf('0xa7'),_[_0xcdbf('0x2d')](_0x1e6dba,'id'));return db[_0xcdbf('0x92')][_0xcdbf('0x39')](_0x3df41b[_0xcdbf('0x93')](),_0x456653)[_0xcdbf('0x27')](function(_0x1a6883){var _0x1dc828=_['groupBy'](_0x1a6883,_0xcdbf('0xa8'));var _0x27f5d0=[];_0x1e6dba[_0xcdbf('0x32')](function(_0x50b638){_0x27f5d0[_0xcdbf('0x33')](updateFaxInteraction(_0x50b638,_0x17e564,_0x1dc828));});return BPromise[_0xcdbf('0xa9')](_0x27f5d0);});});})[_0xcdbf('0x27')](function(_0x216733){_0x40c17d[_0xcdbf('0xaa')]=_0x216733;return _0x40c17d;})[_0xcdbf('0x27')](respondWithFilteredResult(_0xc6695,_0x483837));})[_0xcdbf('0xab')](handleError(_0xc6695,null));};exports[_0xcdbf('0xac')]=function(_0x613cbb,_0x173d4a){var _0x11cd0a={'raw':![],'where':{'id':_0x613cbb['params']['id']}},_0x30abb0={};_0x30abb0[_0xcdbf('0x3d')]=_[_0xcdbf('0x3a')](db['FaxInteraction'][_0xcdbf('0x36')]);_0x30abb0['query']=_[_0xcdbf('0x3a')](_0x613cbb[_0xcdbf('0x39')]);_0x30abb0[_0xcdbf('0x3b')]=_[_0xcdbf('0x3c')](_0x30abb0[_0xcdbf('0x3d')],_0x30abb0[_0xcdbf('0x39')]);_0x11cd0a[_0xcdbf('0x3e')]=_[_0xcdbf('0x3c')](_0x30abb0[_0xcdbf('0x3d')],qs[_0xcdbf('0x3f')](_0x613cbb['query'][_0xcdbf('0x3f')]));_0x11cd0a[_0xcdbf('0x3e')]=_0x11cd0a[_0xcdbf('0x3e')][_0xcdbf('0x5d')]?_0x11cd0a[_0xcdbf('0x3e')]:_0x30abb0[_0xcdbf('0x3d')];if(_0x613cbb[_0xcdbf('0x39')][_0xcdbf('0xad')]){_0x11cd0a[_0xcdbf('0xae')]=[{'all':!![]}];}_0x11cd0a=_[_0xcdbf('0x94')]({},_0x11cd0a,_0x613cbb[_0xcdbf('0xaf')]);return db[_0xcdbf('0x35')][_0xcdbf('0x5e')](_0x11cd0a)[_0xcdbf('0x27')](handleEntityNotFound(_0x173d4a,null))['then'](respondWithResult(_0x173d4a,null))['catch'](handleError(_0x173d4a,null));};exports[_0xcdbf('0xb0')]=function(_0x57f253,_0x16b7b6){return db['FaxInteraction']['create'](_0x57f253[_0xcdbf('0x71')],{})['then'](respondWithResult(_0x16b7b6,0xc9))[_0xcdbf('0xab')](handleError(_0x16b7b6,null));};exports[_0xcdbf('0xb1')]=function(_0x30a624,_0x53dc32){if(_0x30a624[_0xcdbf('0x71')]['id']){delete _0x30a624[_0xcdbf('0x71')]['id'];}return db[_0xcdbf('0x35')][_0xcdbf('0x5e')]({'where':{'id':_0x30a624[_0xcdbf('0xb2')]['id']}})['then'](handleEntityNotFound(_0x53dc32,null))[_0xcdbf('0x27')](saveUpdates(_0x30a624[_0xcdbf('0x71')],null))[_0xcdbf('0x27')](respondWithResult(_0x53dc32,null))[_0xcdbf('0xab')](handleError(_0x53dc32,null));};exports[_0xcdbf('0x26')]=function(_0x25b0b2,_0x3e435c){return db[_0xcdbf('0x35')]['find']({'where':{'id':_0x25b0b2[_0xcdbf('0xb2')]['id']}})[_0xcdbf('0x27')](handleEntityNotFound(_0x3e435c,null))[_0xcdbf('0x27')](removeEntity(_0x3e435c,null))['catch'](handleError(_0x3e435c,null));};exports[_0xcdbf('0xb3')]=function(_0x351c30,_0x52073d){return db[_0xcdbf('0x35')][_0xcdbf('0xb3')]()[_0xcdbf('0x27')](respondWithResult(_0x52073d,null))[_0xcdbf('0xab')](handleError(_0x52073d,null));};exports[_0xcdbf('0xb4')]=function(_0x7617dd,_0x737e52,_0x310bd6){return db[_0xcdbf('0xb5')][_0xcdbf('0x5e')]({'where':{'id':_0x7617dd[_0xcdbf('0xb2')]['id']}})['then'](handleEntityNotFound(_0x737e52,null))[_0xcdbf('0x27')](function(_0x7e660){if(_0x7e660){return _0x7e660[_0xcdbf('0xb4')](_0x7617dd[_0xcdbf('0x71')][_0xcdbf('0xb6')],_[_0xcdbf('0xb7')](_0x7617dd[_0xcdbf('0x71')],['ids','id'])||{});}})[_0xcdbf('0x27')](respondWithResult(_0x737e52,null))[_0xcdbf('0xab')](handleError(_0x737e52,null));};exports[_0xcdbf('0xb8')]=function(_0x47cb58,_0x1c0259,_0x177dca){var _0x48093f={'raw':![],'where':{}};var _0x435d48={};var _0xd8c274={'count':0x0,'rows':[]};return db[_0xcdbf('0x35')][_0xcdbf('0xb9')]({'where':{'id':_0x47cb58[_0xcdbf('0xb2')]['id']}})[_0xcdbf('0x27')](handleEntityNotFound(_0x1c0259,null))[_0xcdbf('0x27')](function(_0x11c69a){if(_0x11c69a){_0x435d48[_0xcdbf('0x3d')]=_[_0xcdbf('0x3a')](db[_0xcdbf('0xb5')][_0xcdbf('0x36')]);_0x435d48['query']=_[_0xcdbf('0x3a')](_0x47cb58['query']);_0x435d48[_0xcdbf('0x3b')]=_[_0xcdbf('0x3c')](_0x435d48[_0xcdbf('0x3d')],_0x435d48[_0xcdbf('0x39')]);_0x48093f[_0xcdbf('0x3e')]=_['intersection'](_0x435d48['model'],qs[_0xcdbf('0x3f')](_0x47cb58['query'][_0xcdbf('0x3f')]));_0x48093f[_0xcdbf('0x3e')]=_0x48093f[_0xcdbf('0x3e')][_0xcdbf('0x5d')]?_0x48093f[_0xcdbf('0x3e')]:_0x435d48['model'];if(!_0x47cb58[_0xcdbf('0x39')][_0xcdbf('0x40')](_0xcdbf('0x41'))){_0x48093f['limit']=qs[_0xcdbf('0x21')](_0x47cb58['query'][_0xcdbf('0x21')]);_0x48093f[_0xcdbf('0x20')]=qs[_0xcdbf('0x20')](_0x47cb58[_0xcdbf('0x39')][_0xcdbf('0x20')]);}_0x48093f['order']=qs[_0xcdbf('0x43')](_0x47cb58[_0xcdbf('0x39')][_0xcdbf('0x43')]);_0x48093f[_0xcdbf('0x44')]=qs['filters'](_['pick'](_0x47cb58['query'],_0x435d48[_0xcdbf('0x3b')]));_0x48093f[_0xcdbf('0x44')][_0xcdbf('0xa8')]=_0x11c69a['id'];if(_0x47cb58[_0xcdbf('0x39')]['filter']){_0x48093f[_0xcdbf('0x44')]=_[_0xcdbf('0x94')](_0x48093f[_0xcdbf('0x44')],{'$or':_[_0xcdbf('0x2d')](_0x48093f['attributes'],function(_0x482ca8){var _0x636ea0={};_0x636ea0[_0x482ca8]={'$like':'%'+_0x47cb58[_0xcdbf('0x39')][_0xcdbf('0xba')]+'%'};return _0x636ea0;})});}if(_0x47cb58[_0xcdbf('0x39')][_0xcdbf('0x77')]){var _0x539874=_0x47cb58[_0xcdbf('0x39')][_0xcdbf('0x77')][_0xcdbf('0x31')](',');var _0x524267={};_0x524267[_0x539874[0x0]]={'$gte':moment(_0x539874[0x1])['format'](_0xcdbf('0xbb'))};_0x48093f[_0xcdbf('0x44')]=_[_0xcdbf('0x94')](_0x48093f['where'],_0x524267);}_0x48093f=_['merge']({},_0x48093f,_0x47cb58[_0xcdbf('0xaf')]);return db[_0xcdbf('0xb5')]['count']({'where':_0x48093f[_0xcdbf('0x44')]})[_0xcdbf('0x27')](function(_0x458c9c){_0xd8c274[_0xcdbf('0x1f')]=_0x458c9c;if(_0x47cb58[_0xcdbf('0x39')]['includeAll']){_0x48093f[_0xcdbf('0xae')]=[{'all':!![]}];}return db[_0xcdbf('0xb5')][_0xcdbf('0xbc')](_0x48093f);})[_0xcdbf('0x27')](function(_0x2cdcf8){_0xd8c274[_0xcdbf('0xaa')]=_0x2cdcf8;return _0xd8c274;});}})[_0xcdbf('0x27')](respondWithFilteredResult(_0x1c0259,_0x48093f))[_0xcdbf('0xab')](handleError(_0x1c0259,null));};exports['addTags']=function(_0xfd291d,_0x29d40b,_0xc395b9){return db[_0xcdbf('0x35')]['find']({'where':{'id':_0xfd291d[_0xcdbf('0xb2')]['id']}})[_0xcdbf('0x27')](handleEntityNotFound(_0x29d40b,null))[_0xcdbf('0x27')](function(_0x489611){if(_0x489611){return _0x489611[_0xcdbf('0xbd')](_0xfd291d[_0xcdbf('0x71')][_0xcdbf('0xb6')],_[_0xcdbf('0xb7')](_0xfd291d['body'],['ids','id'])||{})[_0xcdbf('0xbe')](function(){return db[_0xcdbf('0x6a')][_0xcdbf('0xbc')]({'attributes':['id',_0xcdbf('0x2a'),'color'],'where':{'id':_0xfd291d['body']['ids']}});})[_0xcdbf('0x27')](function(_0xb5d179){socket[_0xcdbf('0xbf')](_0xcdbf('0xc0'),{'id':Number(_0xfd291d[_0xcdbf('0xb2')]['id']),'tags':_0xb5d179||[]});return{'id':Number(_0xfd291d[_0xcdbf('0xb2')]['id']),'tags':_0xb5d179||[]};});}})[_0xcdbf('0x27')](respondWithResult(_0x29d40b,null))[_0xcdbf('0xab')](handleError(_0x29d40b,null));};exports[_0xcdbf('0xc1')]=function(_0x3dd5b9,_0x48dd90,_0x52468a){return db[_0xcdbf('0x35')][_0xcdbf('0x5e')]({'where':{'id':_0x3dd5b9[_0xcdbf('0xb2')]['id']}})[_0xcdbf('0x27')](handleEntityNotFound(_0x48dd90,null))['then'](function(_0x298ac6){if(_0x298ac6){return _0x298ac6[_0xcdbf('0xc1')](_0x3dd5b9['query'][_0xcdbf('0xb6')]);}})['then'](respondWithStatusCode(_0x48dd90,null))[_0xcdbf('0xab')](handleError(_0x48dd90,null));};exports[_0xcdbf('0xc2')]=function(_0x4a8a4a,_0x36c31d){var _0x5bc5bf=moment()[_0xcdbf('0xc3')]()[_0xcdbf('0x93')]();var _0x14c506=path['join'](config[_0xcdbf('0xc4')],_0xcdbf('0xc5'),_0xcdbf('0xc6'),'tmp');var _0x18f4f4=path[_0xcdbf('0xc7')](config[_0xcdbf('0xc4')],_0xcdbf('0xc5'),'files',_0xcdbf('0xc8'));var _0x59ceac=path[_0xcdbf('0xc7')](_0x14c506,_0x5bc5bf);var _0x3e3743=util[_0xcdbf('0xc9')]('transcript-%d-%s.zip',_0x4a8a4a[_0xcdbf('0xb2')]['id'],_0x5bc5bf);var _0x4ea841=path[_0xcdbf('0xc7')](_0x14c506,_0x3e3743);var _0x1bb2e2=[];_0x1bb2e2[_0xcdbf('0x33')]({'model':db[_0xcdbf('0xca')],'as':_0xcdbf('0xca'),'raw':!![]});var _0x40a2e9=[{'model':db['FaxMessage'],'as':_0xcdbf('0xcb'),'attributes':['id',_0xcdbf('0x71'),_0xcdbf('0x76')],'include':_0x1bb2e2}];return db[_0xcdbf('0x35')]['find']({'where':{'id':_0x4a8a4a[_0xcdbf('0xb2')]['id']},'include':_0x40a2e9})[_0xcdbf('0x27')](handleEntityNotFound(_0x36c31d,null))[_0xcdbf('0x27')](function(_0x12298d){if(_0x12298d&&_0x12298d[_0xcdbf('0xcb')]){var _0x315dc1=_0x12298d[_0xcdbf('0xcc')]({'plain':!![]});fs[_0xcdbf('0xcd')](_0x59ceac);for(var _0xe62489=0x0;_0xe62489<_0x315dc1[_0xcdbf('0xcb')]['length'];_0xe62489++){var _0x292200=_0x315dc1['Messages'][_0xe62489][_0xcdbf('0xca')];if(_0x292200){var _0x23779b=path[_0xcdbf('0xc7')](_0x18f4f4,_0x292200[_0xcdbf('0xce')]);if(fs[_0xcdbf('0xcf')](_0x23779b)){fs['createReadStream'](_0x23779b)[_0xcdbf('0xd0')](fs[_0xcdbf('0xd1')](path['join'](_0x59ceac,_0x292200['basename'])));}}}return BPromise[_0xcdbf('0x8d')]()[_0xcdbf('0x27')](function(){return new BPromise(function(_0x1fd20d,_0x55e9e7){zipdir(_0x59ceac,{'saveTo':_0x4ea841},function(_0x2e570c,_0x24fcb8){if(_0x2e570c)return _0x55e9e7(_0x2e570c);return _0x1fd20d(_0x24fcb8);});})[_0xcdbf('0x27')](function(){return new BPromise(function(_0x56aac4,_0x6fc9cd){rimraf(_0x59ceac,function(_0x1c3c19){if(_0x1c3c19)_0x6fc9cd(_0x1c3c19);return _0x56aac4();});});})['then'](function(){return _0x36c31d[_0xcdbf('0xc2')](_0x4ea841,_0x3e3743,function(_0x5a5752){if(_0x5a5752){console[_0xcdbf('0xd2')]('err',_0x5a5752);}else{fs[_0xcdbf('0xd3')](_0x4ea841);}});});});}else{return _0x36c31d[_0xcdbf('0x28')](0xc8);}})['catch'](handleError(_0x36c31d,null));}; \ No newline at end of file +var _0x236c=['fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type','body','some','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','FaxAccountId','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','getFaxAccounts','i.FaxAccountId\x20IN\x20?','toString','count','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','sequelize','groupBy','FaxInteractionId','all','show','params','includeAll','include','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','sendStatus','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','./faxInteraction.socket','register','end','status','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','Users','map','fullname','Tags','TagIds','push','catch','index','FaxInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x236c,0x155));var _0xc236=function(_0x409445,_0x38aa75){_0x409445=_0x409445-0x0;var _0x46b956=_0x236c[_0x409445];return _0x46b956;};'use strict';var pdf=require(_0xc236('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc236('0x1'));var zipdir=require(_0xc236('0x2'));var jsonpatch=require(_0xc236('0x3'));var rp=require(_0xc236('0x4'));var moment=require(_0xc236('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc236('0x6'));var util=require(_0xc236('0x7'));var path=require(_0xc236('0x8'));var sox=require(_0xc236('0x9'));var csv=require(_0xc236('0xa'));var ejs=require(_0xc236('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var db=require(_0xc236('0x16'))['db'];config[_0xc236('0x17')]=_['defaults'](config[_0xc236('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc236('0x17')]));require(_0xc236('0x18'))[_0xc236('0x19')](socket);function respondWithStatusCode(_0x71bce2,_0x5052db){_0x5052db=_0x5052db||0xcc;return function(_0x13a42b){if(_0x13a42b){return _0x71bce2['sendStatus'](_0x5052db);}return _0x71bce2['status'](_0x5052db)[_0xc236('0x1a')]();};}function respondWithResult(_0x32f2fd,_0x443a46){_0x443a46=_0x443a46||0xc8;return function(_0x1aeafc){if(_0x1aeafc){return _0x32f2fd[_0xc236('0x1b')](_0x443a46)['json'](_0x1aeafc);}};}function respondWithFilteredResult(_0x588aa1,_0x57355b){return function(_0x3f5884){if(_0x3f5884){var _0x76f45=_0x3f5884['count'],_0x11ec65=_0x57355b['offset'],_0x541a20=_0x57355b[_0xc236('0x1c')]+_0x57355b[_0xc236('0x1d')],_0x13b432;if(_0x541a20>=_0x76f45){_0x541a20=_0x76f45;_0x13b432=0xc8;}else{_0x13b432=0xce;}_0x588aa1[_0xc236('0x1b')](_0x13b432);return _0x588aa1[_0xc236('0x1e')](_0xc236('0x1f'),_0x11ec65+'-'+_0x541a20+'/'+_0x76f45)[_0xc236('0x20')](_0x3f5884);}return null;};}function patchUpdates(_0x3f0e2f){return function(_0x27c96a){try{jsonpatch[_0xc236('0x21')](_0x27c96a,_0x3f0e2f,!![]);}catch(_0x32876d){return BPromise[_0xc236('0x22')](_0x32876d);}return _0x27c96a['save']();};}function saveUpdates(_0x208c3f,_0x34d73a){return function(_0x3bd41b){if(_0x3bd41b){return _0x3bd41b[_0xc236('0x23')](_0x208c3f)[_0xc236('0x24')](function(_0x21fab8){return _0x21fab8;});}return null;};}function removeEntity(_0x3a315b,_0xf921e6){return function(_0x1d65e2){if(_0x1d65e2){return _0x1d65e2[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x3a315b['status'](0xcc)[_0xc236('0x1a')]();});}};}function handleEntityNotFound(_0x21d78f,_0x356042){return function(_0x9017ec){if(!_0x9017ec){_0x21d78f['sendStatus'](0x194);}return _0x9017ec;};}function handleError(_0x42f248,_0x5da4b2){_0x5da4b2=_0x5da4b2||0x1f4;return function(_0x5351bc){logger[_0xc236('0x26')](_0x5351bc['stack']);if(_0x5351bc[_0xc236('0x27')]){delete _0x5351bc['name'];}_0x42f248[_0xc236('0x1b')](_0x5da4b2)['send'](_0x5351bc);};}function getInteractionUsers(_0x423842,_0x1d144b){return new BPromise(function(_0x4f5175,_0x5a61b5){try{if(_0x1d144b[_0x423842['id']]){_0x423842[_0xc236('0x28')]=_[_0xc236('0x29')](_0x1d144b[_0x423842['id']],function(_0x1f4995){return{'id':_0x1f4995['id'],'fullname':_0x1f4995[_0xc236('0x2a')]};});}}catch(_0x5f3891){_0x5a61b5(_0x5f3891);}_0x4f5175(_0x423842);});}function getInteractionTags(_0x4e3262,_0x28ffa5){return new BPromise(function(_0x53b767,_0x2c756f){try{if(_0x4e3262['TagIds']){_0x4e3262[_0xc236('0x2b')]=[];_0x4e3262[_0xc236('0x2c')]['split'](',')['forEach'](function(_0x2537f9){_0x4e3262[_0xc236('0x2b')][_0xc236('0x2d')](_0x28ffa5[_0x2537f9]);});}delete _0x4e3262[_0xc236('0x2c')];}catch(_0x944298){_0x2c756f(_0x944298);}_0x53b767(_0x4e3262);});}function updateFaxInteraction(_0xa298f8,_0x259c0f,_0x22a2ca){return new BPromise(function(_0x3f58a0,_0x4942d7){return getInteractionUsers(_0xa298f8,_0x22a2ca)['then'](function(_0x5c151a){return getInteractionTags(_0x5c151a,_0x259c0f);})[_0xc236('0x24')](function(_0xfda1f9){_0x3f58a0(_0xfda1f9);})[_0xc236('0x2e')](function(_0x3b09a9){_0x4942d7(_0x3b09a9);});});}exports[_0xc236('0x2f')]=function(_0x1f4b38,_0x3ad726){var _0x5761de={},_0x15f8c0={},_0x3f9b1d={'count':0x0,'rows':[]};var _0xc77281=_['map'](db[_0xc236('0x30')][_0xc236('0x31')],function(_0x3740c9){return{'name':_0x3740c9[_0xc236('0x32')],'type':_0x3740c9['type'][_0xc236('0x33')]};});_0x15f8c0[_0xc236('0x34')]=_[_0xc236('0x29')](_0xc77281,_0xc236('0x27'));_0x15f8c0[_0xc236('0x35')]=_[_0xc236('0x36')](_0x1f4b38[_0xc236('0x35')]);_0x15f8c0[_0xc236('0x37')]=_[_0xc236('0x38')](_0x15f8c0[_0xc236('0x34')],_0x15f8c0[_0xc236('0x35')]);_0x5761de[_0xc236('0x39')]=_[_0xc236('0x38')](_0x15f8c0[_0xc236('0x34')],qs[_0xc236('0x3a')](_0x1f4b38[_0xc236('0x35')][_0xc236('0x3a')]));_0x5761de['attributes']=_0x5761de['attributes']['length']?_0x5761de['attributes']:_0x15f8c0[_0xc236('0x34')];if(!_0x1f4b38['query'][_0xc236('0x3b')](_0xc236('0x3c'))){_0x5761de[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x1f4b38[_0xc236('0x35')][_0xc236('0x1d')]);_0x5761de[_0xc236('0x1c')]=qs[_0xc236('0x1c')](_0x1f4b38[_0xc236('0x35')][_0xc236('0x1c')]);}_0x5761de[_0xc236('0x3d')]=qs[_0xc236('0x3e')](_0x1f4b38[_0xc236('0x35')][_0xc236('0x3e')]);_0x5761de[_0xc236('0x3f')]=qs['filters'](_[_0xc236('0x40')](_0x1f4b38[_0xc236('0x35')],_0x15f8c0['filters']),_0xc77281);var _0xb90a83=[];var _0x5b0bc5=squel[_0xc236('0x41')]()['field']('id')[_0xc236('0x42')](_0xc236('0x27'))[_0xc236('0x42')]('color')[_0xc236('0x43')](_0xc236('0x44'));var _0x1b8480=squel['select']()[_0xc236('0x42')](_0xc236('0x45'))[_0xc236('0x42')](_0xc236('0x46'))[_0xc236('0x42')](_0xc236('0x47'))['from'](_0xc236('0x48'),'ui')['left_join'](_0xc236('0x49'),'u',_0xc236('0x4a'));var _0x21b7ff=squel[_0xc236('0x41')]()[_0xc236('0x43')](_0xc236('0x4b'),'i')[_0xc236('0x4c')]('cm_contacts','c',_0xc236('0x4d'))['left_join'](_0xc236('0x49'),'o',_0xc236('0x4e'))['left_join'](_0xc236('0x4f'),'a',_0xc236('0x50'))[_0xc236('0x4c')](_0xc236('0x51'),'me',_0xc236('0x52'))[_0xc236('0x4c')](_0xc236('0x53'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join'](_0xc236('0x44'),'t',_0xc236('0x54'));var _0x510f7f=squel[_0xc236('0x55')]();var _0x4467da=[];var _0xeac3bd=squel[_0xc236('0x55')]();var _0x45fa20;if(_0x1f4b38[_0xc236('0x35')][_0xc236('0x56')]){_0x45fa20=as[_0xc236('0x57')](_0x1f4b38[_0xc236('0x35')]['search']);var _0x2d101c=_0x45fa20[_0xc236('0x58')];for(var _0x41b7d5=0x0;_0x41b7d5<_0x45fa20[_0xc236('0x59')][_0xc236('0x5a')];_0x41b7d5++){var _0x28e6b4=_0x45fa20[_0xc236('0x59')][_0x41b7d5];var _0x53724f='i';var _0x18d7e1=_[_0xc236('0x5b')](_0xc77281,[_0xc236('0x27'),_0x28e6b4[_0xc236('0x42')]]);if(!_0x18d7e1){switch(_0x28e6b4['field']){case _0xc236('0x5c'):if(_0x28e6b4[_0xc236('0x5d')]==0x1){_0x21b7ff[_0xc236('0x5e')]('`'+_0x28e6b4[_0xc236('0x42')]+_0xc236('0x5f'));}else{_0x21b7ff['having']('`'+_0x28e6b4[_0xc236('0x42')]+'`\x20>\x200');}break;case _0xc236('0x60'):if(_0x28e6b4[_0xc236('0x61')]===_0xc236('0x62')){if(_0x28e6b4[_0xc236('0x5d')][_0xc236('0x63')]('\x20')['length']>0x1){_0x510f7f[_0x2d101c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc236('0x64')](_0x28e6b4[_0xc236('0x5d')]),null);}else{var _0x205d09='%'+_0x28e6b4[_0xc236('0x5d')]+'%';_0x510f7f[_0x2d101c](_0xc236('0x65'),_0x205d09,_0x205d09,_0x205d09);}}else{_0x18d7e1=_[_0xc236('0x5b')](_0xc77281,[_0xc236('0x27'),_0xc236('0x66')]);_0x28e6b4[_0xc236('0x42')]=_0xc236('0x66');_0x59a87c=as['buildExpression'](_0x53724f,_0x18d7e1['type'],_0x28e6b4);_0x510f7f[_0x2d101c](_0x59a87c[_0xc236('0x67')],_0x59a87c[_0xc236('0x5d')][_0xc236('0x68')],_0x59a87c[_0xc236('0x5d')]['end']);}break;case _0xc236('0x69'):var _0x460076=_0x28e6b4['value'][_0xc236('0x63')](',')[_0xc236('0x29')](function(_0x445f03){return Number(_0x445f03);});_0x460076[_0xc236('0x6a')](function(_0x5801d6){_0xeac3bd['or'](_0xc236('0x6b'),'%,'+_0x5801d6+',%');});_0x4467da=_[_0xc236('0x6c')](_0x4467da,_0x460076);break;case _0xc236('0x6d'):if(_0x28e6b4[_0xc236('0x61')]===_0xc236('0x62')){_0x510f7f[_0x2d101c](_0xc236('0x6e'),'%'+_0x28e6b4[_0xc236('0x5d')]+'%',null);}else{_0x18d7e1=_['find'](_0xc77281,[_0xc236('0x27'),'UserId']);_0x28e6b4[_0xc236('0x42')]=_0xc236('0x6f');_0x59a87c=as[_0xc236('0x70')](_0x53724f,_0x18d7e1[_0xc236('0x71')],_0x28e6b4);_0x510f7f[_0x2d101c](_0x59a87c['text'],_0x59a87c[_0xc236('0x5d')][_0xc236('0x68')],_0x59a87c[_0xc236('0x5d')]['end']);}break;case _0xc236('0x72'):_0x59a87c=as[_0xc236('0x70')]('me',null,_0x28e6b4);_0x510f7f[_0x2d101c](_0x59a87c[_0xc236('0x67')],_0x59a87c[_0xc236('0x5d')][_0xc236('0x68')],_0x59a87c[_0xc236('0x5d')]['end']);break;}}else{var _0x59a87c=as[_0xc236('0x70')](_0x53724f,_0x18d7e1[_0xc236('0x71')],_0x28e6b4);_0x510f7f[_0x2d101c](_0x59a87c[_0xc236('0x67')],_0x59a87c[_0xc236('0x5d')][_0xc236('0x68')],_0x59a87c[_0xc236('0x5d')][_0xc236('0x1a')]);}}}else{var _0x553f58=_(_0x1f4b38['query'])['keys']()[_0xc236('0x29')](function(_0x3c11da){return _[_0xc236('0x73')](_0xc77281,[_0xc236('0x27'),_0x3c11da])?_0x3c11da:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x553f58)){_0x553f58['forEach'](function(_0x145e86){if(_0x145e86==='FaxAccountId'){_0x21b7ff[_0xc236('0x3f')]('i.FaxAccountId\x20IN\x20?',[][_0xc236('0x74')](_0x1f4b38[_0xc236('0x35')][_0x145e86]));}else if(_0x145e86===_0xc236('0x75')){var _0x380b7e=JSON[_0xc236('0x76')](_0x1f4b38[_0xc236('0x35')][_0x145e86])[_0xc236('0x77')];var _0x48f0bd=JSON[_0xc236('0x76')](_0x1f4b38['query'][_0x145e86])[_0xc236('0x78')];_0x21b7ff[_0xc236('0x3f')](_0xc236('0x79'),_0x380b7e,_0x48f0bd);}else{if(_0x1f4b38[_0xc236('0x35')][_0x145e86]===_0xc236('0x7a')){_0x21b7ff[_0xc236('0x3f')]('i.'+_0x145e86+'\x20IS\x20NULL');}else{_0x21b7ff[_0xc236('0x3f')]('i.'+_0x145e86+_0xc236('0x7b'),_0x1f4b38['query'][_0x145e86]);}}});}if(_0x1f4b38[_0xc236('0x35')][_0xc236('0x7c')]){if(_0x1f4b38[_0xc236('0x35')]['read']==0x1){_0x21b7ff[_0xc236('0x5e')](_0xc236('0x7d'));}else{_0x21b7ff[_0xc236('0x5e')](_0xc236('0x7e'));}}if(_0x1f4b38[_0xc236('0x35')][_0xc236('0x7f')]){_0x4467da=_[_0xc236('0x80')](_0x1f4b38[_0xc236('0x35')][_0xc236('0x7f')])?_0x1f4b38[_0xc236('0x35')][_0xc236('0x7f')]:new Array(_0x1f4b38[_0xc236('0x35')]['tag']);_0x4467da[_0xc236('0x6a')](function(_0x2b9fd8){_0xeac3bd['or'](_0xc236('0x6b'),'%,'+_0x2b9fd8+',%');});}if(_0x1f4b38['query'][_0xc236('0x81')]){var _0x245b18=_0x1f4b38[_0xc236('0x35')][_0xc236('0x81')]['replace']('\x5c','\x5c\x5c')[_0xc236('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xc236('0x83')](_0x245b18)){_0x510f7f['or']('i.id\x20LIKE\x20?',_0x245b18+'%')['or'](_0xc236('0x84'),_0x245b18+'%');}_0x510f7f['or'](_0xc236('0x85'),_0x245b18+'%');}}_0x21b7ff['where'](_0x510f7f);_0x21b7ff['group']('i.id');var _0x930527={'type':db['Sequelize'][_0xc236('0x86')][_0xc236('0x87')],'raw':!![]};var _0x4be322=_0x21b7ff[_0xc236('0x88')]();_0x4be322[_0xc236('0x42')]('i.id');_0x4be322[_0xc236('0x42')](_0xc236('0x89'),_0xc236('0x5c'));if(_0x5761de[_0xc236('0x3d')]){_0x5761de['order'][_0xc236('0x6a')](function(_0x515b8b){_0x21b7ff[_0xc236('0x3d')]('i.'+_0x515b8b[0x0],_0x515b8b[0x1]===_0xc236('0x8a')?![]:!![]);});}if(!_[_0xc236('0x8b')](_0x4467da)){_0x21b7ff[_0xc236('0x5e')](_0xeac3bd);_0x4be322[_0xc236('0x3f')]('t.id\x20IN\x20?',_0x4467da);}BPromise['resolve']()[_0xc236('0x24')](function(){if(!_0x45fa20){if(_0x1f4b38[_0xc236('0x35')][_0xc236('0x8c')]||_0x1f4b38[_0xc236('0x35')][_0xc236('0x8d')])return;_0x4be322[_0xc236('0x3f')](_0xc236('0x8e'));_0x21b7ff[_0xc236('0x3f')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x1f4b38['user'][_0xc236('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x35e0d8){if(_[_0xc236('0x8b')](_0x35e0d8)){_0x4be322[_0xc236('0x3f')]('i.FaxAccountId\x20IS\x20NULL');_0x21b7ff[_0xc236('0x3f')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4be322[_0xc236('0x3f')](_0xc236('0x90'),_[_0xc236('0x29')](_0x35e0d8,'id'));_0x21b7ff[_0xc236('0x3f')]('i.FaxAccountId\x20IN\x20?',_[_0xc236('0x29')](_0x35e0d8,'id'));}});})[_0xc236('0x24')](function(){db['sequelize'][_0xc236('0x35')](_0x4be322[_0xc236('0x91')](),_0x930527)[_0xc236('0x24')](function(_0x14995f){_0x3f9b1d[_0xc236('0x92')]=_0x14995f[_0xc236('0x5a')];if(_0x3f9b1d[_0xc236('0x92')]===0x0)return[];return db['sequelize'][_0xc236('0x35')](_0x5b0bc5[_0xc236('0x91')](),_0x930527)[_0xc236('0x24')](function(_0xd965d0){_0xb90a83=_['keyBy'](_0xd965d0,'id');_0x930527=_[_0xc236('0x93')](_0x930527,{'model':db[_0xc236('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f4b38['query'][_0xc236('0x3a')]){_0x5761de['attributes'][_0xc236('0x6a')](function(_0xfc94e8){_0x21b7ff['field']('i.'+_0xfc94e8);});}else{_0x21b7ff[_0xc236('0x42')](_0xc236('0x89'),'unreadMessages');_0x21b7ff['field'](_0xc236('0x94'),_0xc236('0x95'));_0x21b7ff[_0xc236('0x42')](_0xc236('0x96'),_0xc236('0x97'));_0x21b7ff[_0xc236('0x42')]('i.*');_0x21b7ff[_0xc236('0x42')](_0xc236('0x98'),_0xc236('0x99'));_0x21b7ff[_0xc236('0x42')]('c.lastName',_0xc236('0x9a'));_0x21b7ff[_0xc236('0x42')](_0xc236('0x9b'),_0xc236('0x9c'));_0x21b7ff[_0xc236('0x42')]('c.phone','Contact.phone');_0x21b7ff[_0xc236('0x42')]('c.mobile',_0xc236('0x9d'));_0x21b7ff[_0xc236('0x42')](_0xc236('0x9e'),_0xc236('0x9f'));_0x21b7ff['field'](_0xc236('0xa0'),'Owner.fullname');_0x21b7ff[_0xc236('0x42')]('o.internal',_0xc236('0xa1'));_0x21b7ff[_0xc236('0x42')](_0xc236('0xa2'),_0xc236('0x2c'));}if(_0x5761de[_0xc236('0x1d')])_0x21b7ff[_0xc236('0x1d')](_0x5761de[_0xc236('0x1d')]);if(_0x5761de[_0xc236('0x1c')])_0x21b7ff[_0xc236('0x1c')](_0x5761de['offset']);return db['sequelize'][_0xc236('0x35')](_0x21b7ff[_0xc236('0x91')](),_0x930527);})[_0xc236('0x24')](function(_0x1e2afe){_0x1b8480[_0xc236('0x3f')](_0xc236('0xa3'),_['map'](_0x1e2afe,'id'));return db[_0xc236('0xa4')][_0xc236('0x35')](_0x1b8480[_0xc236('0x91')](),_0x930527)[_0xc236('0x24')](function(_0x3cf81c){var _0xd519d7=_[_0xc236('0xa5')](_0x3cf81c,_0xc236('0xa6'));var _0x45d4aa=[];_0x1e2afe[_0xc236('0x6a')](function(_0x44652e){_0x45d4aa[_0xc236('0x2d')](updateFaxInteraction(_0x44652e,_0xb90a83,_0xd519d7));});return BPromise[_0xc236('0xa7')](_0x45d4aa);});});})[_0xc236('0x24')](function(_0x475c8f){_0x3f9b1d['rows']=_0x475c8f;return _0x3f9b1d;})[_0xc236('0x24')](respondWithFilteredResult(_0x3ad726,_0x5761de));})[_0xc236('0x2e')](handleError(_0x3ad726,null));};exports[_0xc236('0xa8')]=function(_0x1070a3,_0x2bc6ed){var _0x4ed695={'raw':![],'where':{'id':_0x1070a3[_0xc236('0xa9')]['id']}},_0x424b51={};_0x424b51[_0xc236('0x34')]=_['keys'](db[_0xc236('0x30')]['rawAttributes']);_0x424b51['query']=_[_0xc236('0x36')](_0x1070a3[_0xc236('0x35')]);_0x424b51[_0xc236('0x37')]=_[_0xc236('0x38')](_0x424b51[_0xc236('0x34')],_0x424b51['query']);_0x4ed695[_0xc236('0x39')]=_[_0xc236('0x38')](_0x424b51[_0xc236('0x34')],qs[_0xc236('0x3a')](_0x1070a3[_0xc236('0x35')]['fields']));_0x4ed695['attributes']=_0x4ed695[_0xc236('0x39')][_0xc236('0x5a')]?_0x4ed695[_0xc236('0x39')]:_0x424b51[_0xc236('0x34')];if(_0x1070a3['query'][_0xc236('0xaa')]){_0x4ed695[_0xc236('0xab')]=[{'all':!![]}];}_0x4ed695=_[_0xc236('0x93')]({},_0x4ed695,_0x1070a3[_0xc236('0xac')]);return db[_0xc236('0x30')]['find'](_0x4ed695)[_0xc236('0x24')](handleEntityNotFound(_0x2bc6ed,null))[_0xc236('0x24')](respondWithResult(_0x2bc6ed,null))[_0xc236('0x2e')](handleError(_0x2bc6ed,null));};exports[_0xc236('0xad')]=function(_0x466967,_0x4a796e){return db[_0xc236('0x30')][_0xc236('0xad')](_0x466967['body'],{})[_0xc236('0x24')](respondWithResult(_0x4a796e,0xc9))[_0xc236('0x2e')](handleError(_0x4a796e,null));};exports[_0xc236('0x23')]=function(_0x6404d,_0xccf825){if(_0x6404d['body']['id']){delete _0x6404d[_0xc236('0x72')]['id'];}return db[_0xc236('0x30')][_0xc236('0x5b')]({'where':{'id':_0x6404d[_0xc236('0xa9')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0xccf825,null))[_0xc236('0x24')](saveUpdates(_0x6404d['body'],null))[_0xc236('0x24')](respondWithResult(_0xccf825,null))['catch'](handleError(_0xccf825,null));};exports[_0xc236('0x25')]=function(_0x515d01,_0x14deba){return db['FaxInteraction'][_0xc236('0x5b')]({'where':{'id':_0x515d01['params']['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x14deba,null))[_0xc236('0x24')](removeEntity(_0x14deba,null))[_0xc236('0x2e')](handleError(_0x14deba,null));};exports[_0xc236('0xae')]=function(_0x26fbe6,_0x53be06){return db['FaxInteraction'][_0xc236('0xae')]()[_0xc236('0x24')](respondWithResult(_0x53be06,null))[_0xc236('0x2e')](handleError(_0x53be06,null));};exports[_0xc236('0xaf')]=function(_0x824919,_0x46d7ef,_0x424875){return db[_0xc236('0xb0')][_0xc236('0x5b')]({'where':{'id':_0x824919[_0xc236('0xa9')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x46d7ef,null))[_0xc236('0x24')](function(_0x2bed4b){if(_0x2bed4b){return _0x2bed4b[_0xc236('0xaf')](_0x824919[_0xc236('0x72')][_0xc236('0xb1')],_[_0xc236('0xb2')](_0x824919[_0xc236('0x72')],[_0xc236('0xb1'),'id'])||{});}})['then'](respondWithResult(_0x46d7ef,null))[_0xc236('0x2e')](handleError(_0x46d7ef,null));};exports[_0xc236('0xb3')]=function(_0x210989,_0x5164e5,_0x123661){var _0x32765e={'raw':![],'where':{}};var _0x4f9faf={};var _0x1d9538={'count':0x0,'rows':[]};return db[_0xc236('0x30')]['findOne']({'where':{'id':_0x210989[_0xc236('0xa9')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x5164e5,null))[_0xc236('0x24')](function(_0xfb7a98){if(_0xfb7a98){_0x4f9faf['model']=_[_0xc236('0x36')](db['FaxMessage'][_0xc236('0x31')]);_0x4f9faf[_0xc236('0x35')]=_[_0xc236('0x36')](_0x210989[_0xc236('0x35')]);_0x4f9faf[_0xc236('0x37')]=_['intersection'](_0x4f9faf[_0xc236('0x34')],_0x4f9faf[_0xc236('0x35')]);_0x32765e[_0xc236('0x39')]=_[_0xc236('0x38')](_0x4f9faf[_0xc236('0x34')],qs[_0xc236('0x3a')](_0x210989[_0xc236('0x35')][_0xc236('0x3a')]));_0x32765e[_0xc236('0x39')]=_0x32765e[_0xc236('0x39')][_0xc236('0x5a')]?_0x32765e['attributes']:_0x4f9faf['model'];if(!_0x210989[_0xc236('0x35')][_0xc236('0x3b')](_0xc236('0x3c'))){_0x32765e[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x210989[_0xc236('0x35')][_0xc236('0x1d')]);_0x32765e[_0xc236('0x1c')]=qs[_0xc236('0x1c')](_0x210989[_0xc236('0x35')][_0xc236('0x1c')]);}_0x32765e['order']=qs[_0xc236('0x3e')](_0x210989[_0xc236('0x35')][_0xc236('0x3e')]);_0x32765e[_0xc236('0x3f')]=qs[_0xc236('0x37')](_[_0xc236('0x40')](_0x210989[_0xc236('0x35')],_0x4f9faf[_0xc236('0x37')]));_0x32765e['where']['FaxInteractionId']=_0xfb7a98['id'];if(_0x210989['query'][_0xc236('0x81')]){_0x32765e['where']=_[_0xc236('0x93')](_0x32765e[_0xc236('0x3f')],{'$or':_[_0xc236('0x29')](_0x32765e[_0xc236('0x39')],function(_0x208b08){var _0x43216e={};_0x43216e[_0x208b08]={'$like':'%'+_0x210989[_0xc236('0x35')]['filter']+'%'};return _0x43216e;})});}if(_0x210989[_0xc236('0x35')][_0xc236('0x77')]){var _0x9e156d=_0x210989[_0xc236('0x35')][_0xc236('0x77')]['split'](',');var _0x719f39={};_0x719f39[_0x9e156d[0x0]]={'$gte':moment(_0x9e156d[0x1])[_0xc236('0xb4')](_0xc236('0xb5'))};_0x32765e[_0xc236('0x3f')]=_[_0xc236('0x93')](_0x32765e[_0xc236('0x3f')],_0x719f39);}_0x32765e=_[_0xc236('0x93')]({},_0x32765e,_0x210989[_0xc236('0xac')]);return db[_0xc236('0xb0')]['count']({'where':_0x32765e[_0xc236('0x3f')]})[_0xc236('0x24')](function(_0x3e9eac){_0x1d9538[_0xc236('0x92')]=_0x3e9eac;if(_0x210989['query'][_0xc236('0xaa')]){_0x32765e[_0xc236('0xab')]=[{'all':!![]}];}return db['FaxMessage'][_0xc236('0xb6')](_0x32765e);})[_0xc236('0x24')](function(_0xa90b88){_0x1d9538[_0xc236('0xb7')]=_0xa90b88;return _0x1d9538;});}})[_0xc236('0x24')](respondWithFilteredResult(_0x5164e5,_0x32765e))[_0xc236('0x2e')](handleError(_0x5164e5,null));};exports[_0xc236('0xb8')]=function(_0x34811a,_0x5ebbd7,_0x41c64f){return db[_0xc236('0x30')][_0xc236('0x5b')]({'where':{'id':_0x34811a[_0xc236('0xa9')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x5ebbd7,null))['then'](function(_0xa63522){if(_0xa63522){return _0xa63522['setTags'](_0x34811a[_0xc236('0x72')][_0xc236('0xb1')],_[_0xc236('0xb2')](_0x34811a[_0xc236('0x72')],[_0xc236('0xb1'),'id'])||{})[_0xc236('0xb9')](function(){return db[_0xc236('0x69')][_0xc236('0xb6')]({'attributes':['id',_0xc236('0x27'),_0xc236('0xba')],'where':{'id':_0x34811a[_0xc236('0x72')][_0xc236('0xb1')]}});})[_0xc236('0x24')](function(_0x424207){socket[_0xc236('0xbb')](_0xc236('0xbc'),{'id':Number(_0x34811a[_0xc236('0xa9')]['id']),'tags':_0x424207||[]});return{'id':Number(_0x34811a['params']['id']),'tags':_0x424207||[]};});}})[_0xc236('0x24')](respondWithResult(_0x5ebbd7,null))['catch'](handleError(_0x5ebbd7,null));};exports[_0xc236('0xbd')]=function(_0x68968d,_0x2cccfd,_0x1bae1d){return db[_0xc236('0x30')][_0xc236('0x5b')]({'where':{'id':_0x68968d[_0xc236('0xa9')]['id']}})['then'](handleEntityNotFound(_0x2cccfd,null))[_0xc236('0x24')](function(_0x29ac5e){if(_0x29ac5e){return _0x29ac5e[_0xc236('0xbd')](_0x68968d['query'][_0xc236('0xb1')]);}})[_0xc236('0x24')](respondWithStatusCode(_0x2cccfd,null))[_0xc236('0x2e')](handleError(_0x2cccfd,null));};exports[_0xc236('0xbe')]=function(_0x1e67a8,_0x12a401){var _0x242c6a=moment()[_0xc236('0xbf')]()['toString']();var _0x1fa92a=path[_0xc236('0xc0')](config[_0xc236('0xc1')],_0xc236('0xc2'),_0xc236('0xc3'),_0xc236('0xc4'));var _0x34f075=path['join'](config[_0xc236('0xc1')],_0xc236('0xc2'),_0xc236('0xc3'),'attachments');var _0x68300d=path[_0xc236('0xc0')](_0x1fa92a,_0x242c6a);var _0x21a9f8=util[_0xc236('0xb4')](_0xc236('0xc5'),_0x1e67a8[_0xc236('0xa9')]['id'],_0x242c6a);var _0x5670a3=path[_0xc236('0xc0')](_0x1fa92a,_0x21a9f8);var _0x3cae3b=[];_0x3cae3b[_0xc236('0x2d')]({'model':db[_0xc236('0xc6')],'as':_0xc236('0xc6'),'raw':!![]});var _0x5b1869=[{'model':db[_0xc236('0xb0')],'as':_0xc236('0xc7'),'attributes':['id','body',_0xc236('0x75')],'include':_0x3cae3b}];return db['FaxInteraction']['find']({'where':{'id':_0x1e67a8[_0xc236('0xa9')]['id']},'include':_0x5b1869})[_0xc236('0x24')](handleEntityNotFound(_0x12a401,null))[_0xc236('0x24')](function(_0x24386c){if(_0x24386c&&_0x24386c['Messages']){var _0x138300=_0x24386c[_0xc236('0xc8')]({'plain':!![]});fs['mkdirSync'](_0x68300d);for(var _0x1fbeb4=0x0;_0x1fbeb4<_0x138300[_0xc236('0xc7')][_0xc236('0x5a')];_0x1fbeb4++){var _0x3ce8f8=_0x138300['Messages'][_0x1fbeb4]['Attachment'];if(_0x3ce8f8){var _0x3979d6=path[_0xc236('0xc0')](_0x34f075,_0x3ce8f8[_0xc236('0xc9')]);if(fs[_0xc236('0xca')](_0x3979d6)){fs[_0xc236('0xcb')](_0x3979d6)[_0xc236('0xcc')](fs[_0xc236('0xcd')](path[_0xc236('0xc0')](_0x68300d,_0x3ce8f8[_0xc236('0xc9')])));}}}return BPromise[_0xc236('0xce')]()[_0xc236('0x24')](function(){return new BPromise(function(_0x5d8d92,_0x35789a){zipdir(_0x68300d,{'saveTo':_0x5670a3},function(_0x1a77fe,_0x580405){if(_0x1a77fe)return _0x35789a(_0x1a77fe);return _0x5d8d92(_0x580405);});})['then'](function(){return new BPromise(function(_0x538165,_0x2566a7){rimraf(_0x68300d,function(_0x56814a){if(_0x56814a)_0x2566a7(_0x56814a);return _0x538165();});});})[_0xc236('0x24')](function(){return _0x12a401['download'](_0x5670a3,_0x21a9f8,function(_0x48e748){if(_0x48e748){console[_0xc236('0xcf')](_0xc236('0xd0'),_0x48e748);}else{fs[_0xc236('0xd1')](_0x5670a3);}});});});}else{return _0x12a401[_0xc236('0xd2')](0xc8);}})[_0xc236('0x2e')](handleError(_0x12a401,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b3fdcc7..a52846b 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(_0x2b901e,_0x346aa5){var _0x1ced96=function(_0x270143){while(--_0x270143){_0x2b901e['push'](_0x2b901e['shift']());}};_0x1ced96(++_0x346aa5);}(_0x1261,0x144));var _0x1126=function(_0x393bf5,_0x225cac){_0x393bf5=_0x393bf5-0x0;var _0xcb023=_0x1261[_0x393bf5];return _0xcb023;};'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 _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x4776f6,_0x3b3a20){var _0x870e1c=function(_0x5e96fe){while(--_0x5e96fe){_0x4776f6['push'](_0x4776f6['shift']());}};_0x870e1c(++_0x3b3a20);}(_0x814b,0x1a2));var _0xb814=function(_0x4fc421,_0x94e88){_0x4fc421=_0x4fc421-0x0;var _0x8c6d63=_0x814b[_0x4fc421];return _0x8c6d63;};'use strict';var EventEmitter=require(_0xb814('0x0'));var FaxInteraction=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var FaxMessage=require(_0xb814('0x1'))['db'][_0xb814('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb814('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb814('0x5'),'afterDestroy':_0xb814('0x6')};function emitEvent(_0x258866){return function(_0x4237bc,_0x44931c,_0x322a70){_0x4237bc['getUsers']({'attributes':['id'],'raw':!![]})[_0xb814('0x7')](function(_0x2e6272){_0x4237bc['setDataValue'](_0xb814('0x8'),_0x2e6272[_0xb814('0x9')](function(_0x186d5a){return{'id':_0x186d5a['id']};}));return FaxMessage[_0xb814('0xa')]({'where':{'FaxInteractionId':_0x4237bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb814('0x7')](function(_0x21d4a5){_0x4237bc[_0xb814('0xb')](_0xb814('0xc'),_0x21d4a5[_0xb814('0xd')]);FaxInteractionEvents[_0xb814('0xe')](_0x258866+':'+_0x4237bc['id'],_0x4237bc);FaxInteractionEvents[_0xb814('0xe')](_0x258866,_0x4237bc);_0x322a70(null);})['catch'](_0x322a70(null));};}for(var e in events){if(events[_0xb814('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xb814('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b3ceb8c..fbbc54f 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 _0x4d52=['YYYY-MM-DD\x20HH:mm:ss','lodash','moment','request-promise','path','rimraf','../../config/environment','fax_interactions','changed','closed','closedAt'];(function(_0x137f70,_0x3725c4){var _0x586216=function(_0x55126d){while(--_0x55126d){_0x137f70['push'](_0x137f70['shift']());}};_0x586216(++_0x3725c4);}(_0x4d52,0x156));var _0x24d5=function(_0x4bf5fe,_0x456321){_0x4bf5fe=_0x4bf5fe-0x0;var _0x233443=_0x4d52[_0x4bf5fe];return _0x233443;};'use strict';var _=require(_0x24d5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x24d5('0x1'));var BPromise=require('bluebird');var rp=require(_0x24d5('0x2'));var fs=require('fs');var path=require(_0x24d5('0x3'));var rimraf=require(_0x24d5('0x4'));var config=require(_0x24d5('0x5'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x45b47f,_0x30cdc2){return _0x45b47f['define']('FaxInteraction',attributes,{'tableName':_0x24d5('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x243210,_0x384c9a,_0xc91bc2){if(_0x243210[_0x24d5('0x7')](_0x24d5('0x8'))){_0x243210[_0x24d5('0x9')]=moment()['format'](_0x24d5('0xa'));}_0xc91bc2(null,_0x243210);}}});}; \ No newline at end of file +var _0x8995=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxInteraction','fax_interactions','closed','closedAt','format'];(function(_0x4eda22,_0x3d2db4){var _0x4a5706=function(_0x4345e3){while(--_0x4345e3){_0x4eda22['push'](_0x4eda22['shift']());}};_0x4a5706(++_0x3d2db4);}(_0x8995,0xef));var _0x5899=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x8995[_0x58547b];return _0x1d3fd2;};'use strict';var _=require(_0x5899('0x0'));var util=require(_0x5899('0x1'));var logger=require('../../config/logger')(_0x5899('0x2'));var moment=require(_0x5899('0x3'));var BPromise=require(_0x5899('0x4'));var rp=require(_0x5899('0x5'));var fs=require('fs');var path=require(_0x5899('0x6'));var rimraf=require(_0x5899('0x7'));var config=require(_0x5899('0x8'));var attributes=require('./faxInteraction.attributes');module[_0x5899('0x9')]=function(_0x5a9e6f,_0x2e7856){return _0x5a9e6f[_0x5899('0xa')](_0x5899('0xb'),attributes,{'tableName':_0x5899('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3edd51,_0x21b363,_0x1f87cc){if(_0x3edd51['changed'](_0x5899('0xd'))){_0x3edd51[_0x5899('0xe')]=moment()[_0x5899('0xf')](_0x5899('0x10'));}_0x1f87cc(null,_0x3edd51);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index aadf84c..b98f71d 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 _0x73ac=['client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','error','code','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','limit','stringify','AddTagsToFaxInteraction','where','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ec9f8,_0x529c73){var _0x3c5d8e=function(_0x5eb868){while(--_0x5eb868){_0x2ec9f8['push'](_0x2ec9f8['shift']());}};_0x3c5d8e(++_0x529c73);}(_0x73ac,0x73));var _0xc73a=function(_0x297b4e,_0x139e0f){_0x297b4e=_0x297b4e-0x0;var _0x37882a=_0x73ac[_0x297b4e];return _0x37882a;};'use strict';var _=require('lodash');var util=require(_0xc73a('0x0'));var moment=require(_0xc73a('0x1'));var BPromise=require(_0xc73a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc73a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc73a('0x4'))(_0xc73a('0x5'));var config=require(_0xc73a('0x6'));var jayson=require(_0xc73a('0x7'));var client=jayson[_0xc73a('0x8')][_0xc73a('0x9')]({'port':0x232a});config[_0xc73a('0xa')]=_[_0xc73a('0xb')](config[_0xc73a('0xa')],{'host':_0xc73a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc73a('0xa')]));require(_0xc73a('0xd'))[_0xc73a('0xe')](socket);function respondWithRpcPromise(_0x1e2fcb,_0x4bd62e,_0xa34db2){return new BPromise(function(_0x2b916e,_0x1fc3f6){return client[_0xc73a('0xf')](_0x1e2fcb,_0xa34db2)[_0xc73a('0x10')](function(_0x4e32e5){logger[_0xc73a('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x4bd62e,_0xc73a('0x12'));logger[_0xc73a('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4bd62e,_0xc73a('0x12'),JSON['stringify'](_0x4e32e5));if(_0x4e32e5[_0xc73a('0x14')]){if(_0x4e32e5[_0xc73a('0x14')][_0xc73a('0x15')]===0x1f4){logger['error'](_0xc73a('0x16'),_0x4bd62e,_0x4e32e5[_0xc73a('0x14')]['message']);return _0x1fc3f6(_0x4e32e5['error']['message']);}logger['error'](_0xc73a('0x16'),_0x4bd62e,_0x4e32e5[_0xc73a('0x14')][_0xc73a('0x17')]);return _0x2b916e(_0x4e32e5['error'][_0xc73a('0x17')]);}else{logger[_0xc73a('0x11')](_0xc73a('0x16'),_0x4bd62e,_0xc73a('0x12'));_0x2b916e(_0x4e32e5['result']['message']);}})[_0xc73a('0x18')](function(_0x3e6658){logger['error'](_0xc73a('0x16'),_0x4bd62e,_0x3e6658);_0x1fc3f6(_0x3e6658);});});}exports[_0xc73a('0x19')]=function(_0x3e97b3){var _0x4dfab6=this;return new Promise(function(_0x57fe35,_0x100a79){return db[_0xc73a('0x1a')][_0xc73a('0x1b')](_0x3e97b3['body'],{'raw':_0x3e97b3[_0xc73a('0x1c')]?_0x3e97b3['options'][_0xc73a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e97b3['options']?_0x3e97b3['options']['where']||null:null,'attributes':_0x3e97b3[_0xc73a('0x1c')]?_0x3e97b3[_0xc73a('0x1c')][_0xc73a('0x1e')]||null:null,'limit':_0x3e97b3[_0xc73a('0x1c')]?_0x3e97b3[_0xc73a('0x1c')][_0xc73a('0x1f')]||null:null})[_0xc73a('0x10')](function(_0x1b3e3f){logger[_0xc73a('0x11')]('UpdateFaxInteraction',_0x3e97b3);logger[_0xc73a('0x13')](_0xc73a('0x19'),_0x3e97b3,JSON[_0xc73a('0x20')](_0x1b3e3f));_0x57fe35(_0x1b3e3f);})[_0xc73a('0x18')](function(_0x508960){logger[_0xc73a('0x14')](_0xc73a('0x19'),_0x508960['message'],_0x3e97b3);_0x100a79(_0x4dfab6[_0xc73a('0x14')](0x1f4,_0x508960[_0xc73a('0x17')]));});});};exports[_0xc73a('0x21')]=function(_0x178ade){return new Promise(function(_0x10dd40,_0x17725b){return db[_0xc73a('0x1a')]['find']({'where':_0x178ade[_0xc73a('0x1c')]?_0x178ade['options'][_0xc73a('0x22')]||null:null})[_0xc73a('0x10')](function(_0x18d3a4){if(_0x18d3a4){return _0x18d3a4[_0xc73a('0x23')](_0x178ade['body'][_0xc73a('0x24')],_[_0xc73a('0x25')](_0x178ade[_0xc73a('0x26')],['ids','id'])||{});}})[_0xc73a('0x27')](function(_0x2e654e){logger[_0xc73a('0x11')](_0xc73a('0x28'),_0x178ade);logger['debug'](_0xc73a('0x28'),_0x178ade,JSON['stringify'](_0x2e654e));_0x10dd40(_0x2e654e);})[_0xc73a('0x18')](function(_0x581b33){logger[_0xc73a('0x14')](_0xc73a('0x28'),_0x581b33[_0xc73a('0x17')],_0x178ade);_0x17725b(_this[_0xc73a('0x14')](0x1f4,_0x581b33[_0xc73a('0x17')]));});});}; \ No newline at end of file +var _0x5e2d=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','limit','AddTagsToFaxInteraction','where','addTags','ids','omit','body','spread','AddTags','util'];(function(_0xa6cb09,_0x39410f){var _0x12b437=function(_0x1813cc){while(--_0x1813cc){_0xa6cb09['push'](_0xa6cb09['shift']());}};_0x12b437(++_0x39410f);}(_0x5e2d,0xef));var _0xd5e2=function(_0x2bd385,_0x49d05f){_0x2bd385=_0x2bd385-0x0;var _0x44c7f7=_0x5e2d[_0x2bd385];return _0x44c7f7;};'use strict';var _=require('lodash');var util=require(_0xd5e2('0x0'));var moment=require(_0xd5e2('0x1'));var BPromise=require(_0xd5e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd5e2('0x4'))(_0xd5e2('0x5'));var config=require(_0xd5e2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd5e2('0x7')]['http']({'port':0x232a});config[_0xd5e2('0x8')]=_[_0xd5e2('0x9')](config[_0xd5e2('0x8')],{'host':_0xd5e2('0xa'),'port':0x18eb});var socket=require(_0xd5e2('0xb'))(new Redis(config['redis']));require(_0xd5e2('0xc'))[_0xd5e2('0xd')](socket);function respondWithRpcPromise(_0x529ad3,_0x4d2936,_0x234b90){return new BPromise(function(_0x397394,_0x141b56){return client[_0xd5e2('0xe')](_0x529ad3,_0x234b90)[_0xd5e2('0xf')](function(_0x49c4cc){logger['info'](_0xd5e2('0x10'),_0x4d2936,'request\x20sent');logger[_0xd5e2('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4d2936,_0xd5e2('0x12'),JSON[_0xd5e2('0x13')](_0x49c4cc));if(_0x49c4cc['error']){if(_0x49c4cc[_0xd5e2('0x14')][_0xd5e2('0x15')]===0x1f4){logger[_0xd5e2('0x14')](_0xd5e2('0x10'),_0x4d2936,_0x49c4cc[_0xd5e2('0x14')][_0xd5e2('0x16')]);return _0x141b56(_0x49c4cc[_0xd5e2('0x14')][_0xd5e2('0x16')]);}logger[_0xd5e2('0x14')](_0xd5e2('0x10'),_0x4d2936,_0x49c4cc[_0xd5e2('0x14')][_0xd5e2('0x16')]);return _0x397394(_0x49c4cc[_0xd5e2('0x14')][_0xd5e2('0x16')]);}else{logger[_0xd5e2('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x4d2936,'request\x20sent');_0x397394(_0x49c4cc['result'][_0xd5e2('0x16')]);}})[_0xd5e2('0x18')](function(_0x597f7b){logger[_0xd5e2('0x14')](_0xd5e2('0x10'),_0x4d2936,_0x597f7b);_0x141b56(_0x597f7b);});});}exports[_0xd5e2('0x19')]=function(_0x17d7c3){var _0x7690b6=this;return new Promise(function(_0x5af1ed,_0x348069){return db[_0xd5e2('0x1a')][_0xd5e2('0x1b')](_0x17d7c3['body'],{'raw':_0x17d7c3[_0xd5e2('0x1c')]?_0x17d7c3['options'][_0xd5e2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17d7c3[_0xd5e2('0x1c')]?_0x17d7c3['options']['where']||null:null,'attributes':_0x17d7c3[_0xd5e2('0x1c')]?_0x17d7c3[_0xd5e2('0x1c')][_0xd5e2('0x1e')]||null:null,'limit':_0x17d7c3['options']?_0x17d7c3[_0xd5e2('0x1c')][_0xd5e2('0x1f')]||null:null})[_0xd5e2('0xf')](function(_0x4c6ad8){logger[_0xd5e2('0x17')](_0xd5e2('0x19'),_0x17d7c3);logger[_0xd5e2('0x11')]('UpdateFaxInteraction',_0x17d7c3,JSON[_0xd5e2('0x13')](_0x4c6ad8));_0x5af1ed(_0x4c6ad8);})[_0xd5e2('0x18')](function(_0x5a56cf){logger[_0xd5e2('0x14')](_0xd5e2('0x19'),_0x5a56cf['message'],_0x17d7c3);_0x348069(_0x7690b6[_0xd5e2('0x14')](0x1f4,_0x5a56cf['message']));});});};exports[_0xd5e2('0x20')]=function(_0x11a126){return new Promise(function(_0x5a15fc,_0x5289f4){return db[_0xd5e2('0x1a')]['find']({'where':_0x11a126['options']?_0x11a126['options'][_0xd5e2('0x21')]||null:null})[_0xd5e2('0xf')](function(_0x48daa8){if(_0x48daa8){return _0x48daa8[_0xd5e2('0x22')](_0x11a126['body'][_0xd5e2('0x23')],_[_0xd5e2('0x24')](_0x11a126[_0xd5e2('0x25')],[_0xd5e2('0x23'),'id'])||{});}})[_0xd5e2('0x26')](function(_0x12cd3c){logger[_0xd5e2('0x17')](_0xd5e2('0x27'),_0x11a126);logger[_0xd5e2('0x11')](_0xd5e2('0x27'),_0x11a126,JSON[_0xd5e2('0x13')](_0x12cd3c));_0x5a15fc(_0x12cd3c);})[_0xd5e2('0x18')](function(_0x6628dc){logger['error'](_0xd5e2('0x27'),_0x6628dc[_0xd5e2('0x16')],_0x11a126);_0x5289f4(_this[_0xd5e2('0x14')](0x1f4,_0x6628dc['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d5f5dcc..0ad673c 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 _0xc84b=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x4f9da3,_0x500e1e){var _0x19332a=function(_0x20cac6){while(--_0x20cac6){_0x4f9da3['push'](_0x4f9da3['shift']());}};_0x19332a(++_0x500e1e);}(_0xc84b,0x18c));var _0xbc84=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc84b[_0x4e676e];return _0x336a3c;};'use strict';var FaxInteractionEvents=require(_0xbc84('0x0'));var events=[_0xbc84('0x1'),_0xbc84('0x2'),'update'];function createListener(_0x5f12a0,_0x12d87f){return function(_0x49daee){_0x12d87f[_0xbc84('0x3')](_0x5f12a0,_0x49daee);};}function removeListener(_0x5dc581,_0xd80afa){return function(){FaxInteractionEvents[_0xbc84('0x4')](_0x5dc581,_0xd80afa);};}exports[_0xbc84('0x5')]=function(_0x19f4fb){for(var _0x31711c=0x0,_0x4f972d=events[_0xbc84('0x6')];_0x31711c<_0x4f972d;_0x31711c++){var _0x24b95d=events[_0x31711c];var _0x393c82=createListener(_0xbc84('0x7')+_0x24b95d,_0x19f4fb);FaxInteractionEvents['on'](_0x24b95d,_0x393c82);}}; \ No newline at end of file +var _0xdd54=['faxInteraction:','./faxInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x5458af,_0x635da8){var _0x2b530f=function(_0x3150e6){while(--_0x3150e6){_0x5458af['push'](_0x5458af['shift']());}};_0x2b530f(++_0x635da8);}(_0xdd54,0x159));var _0x4dd5=function(_0x463f89,_0xf317cf){_0x463f89=_0x463f89-0x0;var _0x1e0849=_0xdd54[_0x463f89];return _0x1e0849;};'use strict';var FaxInteractionEvents=require(_0x4dd5('0x0'));var events=[_0x4dd5('0x1'),_0x4dd5('0x2'),_0x4dd5('0x3')];function createListener(_0x4a42cf,_0x25627a){return function(_0x11a9a2){_0x25627a['emit'](_0x4a42cf,_0x11a9a2);};}function removeListener(_0x5247df,_0x3de4b1){return function(){FaxInteractionEvents[_0x4dd5('0x4')](_0x5247df,_0x3de4b1);};}exports[_0x4dd5('0x5')]=function(_0x20b2ec){for(var _0x380e40=0x0,_0x447b6c=events[_0x4dd5('0x6')];_0x380e40<_0x447b6c;_0x380e40++){var _0x51f586=events[_0x380e40];var _0x146965=createListener(_0x4dd5('0x7')+_0x51f586,_0x20b2ec);FaxInteractionEvents['on'](_0x51f586,_0x146965);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 0ce1e1e..8de2839 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 _0xaaf2=['download','post','create','addMessage','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xaaf2,0x71));var _0x2aaf=function(_0x324316,_0x4ad17a){_0x324316=_0x324316-0x0;var _0x2e17a7=_0xaaf2[_0x324316];return _0x2e17a7;};'use strict';var multer=require(_0x2aaf('0x0'));var util=require('util');var path=require(_0x2aaf('0x1'));var timeout=require(_0x2aaf('0x2'));var express=require(_0x2aaf('0x3'));var router=express[_0x2aaf('0x4')]();var auth=require(_0x2aaf('0x5'));var interaction=require(_0x2aaf('0x6'));var config=require(_0x2aaf('0x7'));var controller=require(_0x2aaf('0x8'));router[_0x2aaf('0x9')]('/',auth[_0x2aaf('0xa')](),controller[_0x2aaf('0xb')]);router[_0x2aaf('0x9')](_0x2aaf('0xc'),auth[_0x2aaf('0xa')](),controller[_0x2aaf('0xd')]);router[_0x2aaf('0x9')](_0x2aaf('0xe'),auth['isAuthenticated'](),controller[_0x2aaf('0xf')]);router[_0x2aaf('0x9')](_0x2aaf('0x10'),auth[_0x2aaf('0xa')](),controller[_0x2aaf('0x11')]);router['get'](_0x2aaf('0x12'),auth[_0x2aaf('0xa')](),controller[_0x2aaf('0x13')]);router[_0x2aaf('0x14')]('/',auth[_0x2aaf('0xa')](),controller[_0x2aaf('0x15')]);router['post']('/:id/messages',auth[_0x2aaf('0xa')](),controller[_0x2aaf('0x16')]);router[_0x2aaf('0x14')](_0x2aaf('0x17'),auth[_0x2aaf('0xa')](),interaction[_0x2aaf('0x18')](_0x2aaf('0x19'),'faxinteraction:addtags'),controller[_0x2aaf('0x1a')]);router[_0x2aaf('0x1b')](_0x2aaf('0xe'),auth[_0x2aaf('0xa')](),interaction['tracked']('fax',_0x2aaf('0x1c')),controller[_0x2aaf('0x1d')]);router[_0x2aaf('0x1e')](_0x2aaf('0xe'),auth[_0x2aaf('0xa')](),interaction['tracked'](_0x2aaf('0x19'),'faxinteraction:destroy'),controller[_0x2aaf('0x1f')]);router[_0x2aaf('0x1e')](_0x2aaf('0x17'),auth[_0x2aaf('0xa')](),controller['removeTags']);module[_0x2aaf('0x20')]=router; \ No newline at end of file +var _0x0f54=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','create','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout','express','Router'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0f54,0x1db));var _0x40f5=function(_0x233b38,_0x17e127){_0x233b38=_0x233b38-0x0;var _0x586e12=_0x0f54[_0x233b38];return _0x586e12;};'use strict';var multer=require(_0x40f5('0x0'));var util=require(_0x40f5('0x1'));var path=require('path');var timeout=require(_0x40f5('0x2'));var express=require(_0x40f5('0x3'));var router=express[_0x40f5('0x4')]();var auth=require(_0x40f5('0x5'));var interaction=require(_0x40f5('0x6'));var config=require(_0x40f5('0x7'));var controller=require(_0x40f5('0x8'));router[_0x40f5('0x9')]('/',auth[_0x40f5('0xa')](),controller[_0x40f5('0xb')]);router[_0x40f5('0x9')]('/describe',auth[_0x40f5('0xa')](),controller[_0x40f5('0xc')]);router[_0x40f5('0x9')](_0x40f5('0xd'),auth[_0x40f5('0xa')](),controller[_0x40f5('0xe')]);router[_0x40f5('0x9')](_0x40f5('0xf'),auth[_0x40f5('0xa')](),controller['getMessages']);router[_0x40f5('0x9')](_0x40f5('0x10'),auth[_0x40f5('0xa')](),controller[_0x40f5('0x11')]);router['post']('/',auth[_0x40f5('0xa')](),controller[_0x40f5('0x12')]);router[_0x40f5('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x40f5('0x14')]);router[_0x40f5('0x13')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x40f5('0x15')](_0x40f5('0x16'),_0x40f5('0x17')),controller[_0x40f5('0x18')]);router['put'](_0x40f5('0xd'),auth[_0x40f5('0xa')](),interaction[_0x40f5('0x15')](_0x40f5('0x16'),_0x40f5('0x19')),controller[_0x40f5('0x1a')]);router[_0x40f5('0x1b')](_0x40f5('0xd'),auth[_0x40f5('0xa')](),interaction['tracked'](_0x40f5('0x16'),_0x40f5('0x1c')),controller[_0x40f5('0x1d')]);router['delete'](_0x40f5('0x1e'),auth['isAuthenticated'](),controller['removeTags']);module[_0x40f5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b02f281..b1cf6ba 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 _0xe90b=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x8601fd,_0x221c29){var _0x28948d=function(_0x4f3460){while(--_0x4f3460){_0x8601fd['push'](_0x8601fd['shift']());}};_0x28948d(++_0x221c29);}(_0xe90b,0x10b));var _0xbe90=function(_0x5db6cf,_0x321c5d){_0x5db6cf=_0x5db6cf-0x0;var _0x4f3521=_0xe90b[_0x5db6cf];return _0x4f3521;};'use strict';var Sequelize=require(_0xbe90('0x0'));module[_0xbe90('0x1')]={'body':{'type':Sequelize[_0xbe90('0x2')](_0xbe90('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbe90('0x4')]('in','out'),'defaultValue':_0xbe90('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbe90('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbe90('0x6')]}}; \ No newline at end of file +var _0x7db9=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7db9,0xb3));var _0x97db=function(_0x367555,_0x2c7767){_0x367555=_0x367555-0x0;var _0x3e22eb=_0x7db9[_0x367555];return _0x3e22eb;};'use strict';var Sequelize=require(_0x97db('0x0'));module[_0x97db('0x1')]={'body':{'type':Sequelize[_0x97db('0x2')](_0x97db('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x97db('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x97db('0x5')]('in','out'),'defaultValue':_0x97db('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x97db('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x97db('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index eb0e76f..e9a43a0 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 _0x9def=['jayson/promise','client','http','test','Sequelize','ValidationError','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','end','sendStatus','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','create','Attachment','findOne','SendFax','FaxAccountId','basename','AttachmentId','join','server','files','attachments','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x3e51c8,_0xf03af8){var _0x3a96a4=function(_0x2d13ba){while(--_0x2d13ba){_0x3e51c8['push'](_0x3e51c8['shift']());}};_0x3a96a4(++_0xf03af8);}(_0x9def,0x17c));var _0xf9de=function(_0x5873d4,_0x3667f5){_0x5873d4=_0x5873d4-0x0;var _0x596e07=_0x9def[_0x5873d4];return _0x596e07;};'use strict';var pdf=require(_0xf9de('0x0'));var emlformat=require(_0xf9de('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf9de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf9de('0x3'));var moment=require(_0xf9de('0x4'));var BPromise=require(_0xf9de('0x5'));var Mustache=require(_0xf9de('0x6'));var util=require(_0xf9de('0x7'));var path=require(_0xf9de('0x8'));var sox=require('sox');var csv=require(_0xf9de('0x9'));var ejs=require(_0xf9de('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf9de('0xb'));var jsforce=require(_0xf9de('0xc'));var deskjs=require(_0xf9de('0xd'));var toCsv=require(_0xf9de('0x9'));var querystring=require(_0xf9de('0xe'));var Papa=require(_0xf9de('0xf'));var Redis=require(_0xf9de('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf9de('0x11'));var as=require(_0xf9de('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9de('0x13'))(_0xf9de('0x14'));var utils=require('../../config/utils');var config=require(_0xf9de('0x15'));var db=require(_0xf9de('0x16'))['db'];config['redis']=_[_0xf9de('0x17')](config[_0xf9de('0x18')],{'host':_0xf9de('0x19'),'port':0x18eb});var socket=require(_0xf9de('0x1a'))(new Redis(config[_0xf9de('0x18')]));require(_0xf9de('0x1b'))['register'](socket);var jayson=require(_0xf9de('0x1c'));var client=jayson[_0xf9de('0x1d')][_0xf9de('0x1e')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5abde8,_0xbfd8f1,_0x540218){if(_0x540218){var _0x5d3c16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d3c16[_0xf9de('0x1f')](_0xbfd8f1)){return _0x5abde8;}else{throw new db[(_0xf9de('0x20'))][(_0xf9de('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5abde8;}}function respondWithRpcPromise(_0x156625,_0x3db143,_0x431777,_0x865cc8){return new BPromise(function(_0x30e8bc,_0x9bcb83){var _0x282152=_0x865cc8||client;return _0x282152[_0xf9de('0x22')](_0x156625,_0x431777)[_0xf9de('0x23')](function(_0x29026c){logger['info'](_0xf9de('0x24'),_0x3db143,_0xf9de('0x25'));logger[_0xf9de('0x26')](_0xf9de('0x27'),_0x3db143,_0xf9de('0x25'),JSON[_0xf9de('0x28')](_0x29026c));if(_0x29026c[_0xf9de('0x29')]){if(_0x29026c[_0xf9de('0x29')][_0xf9de('0x2a')]===0x1f4){logger['error'](_0xf9de('0x24'),_0x3db143,_0x29026c['error']['message']);return _0x9bcb83(_0x29026c[_0xf9de('0x29')][_0xf9de('0x2b')]);}logger[_0xf9de('0x29')](_0xf9de('0x24'),_0x3db143,_0x29026c[_0xf9de('0x29')]['message']);return _0x30e8bc(_0x29026c[_0xf9de('0x29')][_0xf9de('0x2b')]);}else{logger[_0xf9de('0x2c')]('FaxMessage,\x20%s,\x20%s',_0x3db143,_0xf9de('0x25'));_0x30e8bc(_0x29026c['result'][_0xf9de('0x2b')]);}})['catch'](function(_0x17d911){logger[_0xf9de('0x29')](_0xf9de('0x24'),_0x3db143,_0x17d911);_0x9bcb83(_0x17d911);});});}function respondWithStatusCode(_0x2d819b,_0x37a9ec){_0x37a9ec=_0x37a9ec||0xcc;return function(_0x51ed59){if(_0x51ed59){return _0x2d819b['sendStatus'](_0x37a9ec);}return _0x2d819b[_0xf9de('0x2d')](_0x37a9ec)['end']();};}function respondWithResult(_0xa46d4a,_0x215560){_0x215560=_0x215560||0xc8;return function(_0x27af19){if(_0x27af19){return _0xa46d4a[_0xf9de('0x2d')](_0x215560)[_0xf9de('0x2e')](_0x27af19);}};}function respondWithFilteredResult(_0x1d2f3c,_0x2bf867){return function(_0x68612){if(_0x68612){var _0x402ed7=_0x68612[_0xf9de('0x2f')],_0x3e53c9=_0x2bf867[_0xf9de('0x30')],_0x112312=_0x2bf867['offset']+_0x2bf867[_0xf9de('0x31')],_0x389eae;if(_0x112312>=_0x402ed7){_0x112312=_0x402ed7;_0x389eae=0xc8;}else{_0x389eae=0xce;}_0x1d2f3c[_0xf9de('0x2d')](_0x389eae);return _0x1d2f3c[_0xf9de('0x32')](_0xf9de('0x33'),_0x3e53c9+'-'+_0x112312+'/'+_0x402ed7)[_0xf9de('0x2e')](_0x68612);}return null;};}function patchUpdates(_0x2aa9d6){return function(_0x562407){try{jsonpatch[_0xf9de('0x34')](_0x562407,_0x2aa9d6,!![]);}catch(_0x5f2c43){return BPromise['reject'](_0x5f2c43);}return _0x562407['save']();};}function saveUpdates(_0x279484,_0x3ba24d){return function(_0x6811ce){if(_0x6811ce){return _0x6811ce[_0xf9de('0x35')](_0x279484)[_0xf9de('0x23')](function(_0x4705c9){return _0x4705c9;});}return null;};}function removeEntity(_0x51db4c,_0x4c840d){return function(_0x205625){if(_0x205625){return _0x205625[_0xf9de('0x36')]()[_0xf9de('0x23')](function(){_0x51db4c[_0xf9de('0x2d')](0xcc)[_0xf9de('0x37')]();});}};}function handleEntityNotFound(_0x3c06b6,_0x18b8e1){return function(_0x32ad62){if(!_0x32ad62){_0x3c06b6[_0xf9de('0x38')](0x194);}return _0x32ad62;};}function handleError(_0x456133,_0x5b66de){_0x5b66de=_0x5b66de||0x1f4;return function(_0x2ad1d0){logger[_0xf9de('0x29')](_0x2ad1d0[_0xf9de('0x39')]);if(_0x2ad1d0[_0xf9de('0x3a')]){delete _0x2ad1d0[_0xf9de('0x3a')];}_0x456133[_0xf9de('0x2d')](_0x5b66de)['send'](_0x2ad1d0);};}exports[_0xf9de('0x3b')]=function(_0x39f8e7,_0x9e2889){var _0x207a5a={},_0x186909={},_0x2767e3={'count':0x0,'rows':[]};var _0x5c867d=_[_0xf9de('0x3c')](db[_0xf9de('0x3d')][_0xf9de('0x3e')],function(_0x2db251){return{'name':_0x2db251[_0xf9de('0x3f')],'type':_0x2db251[_0xf9de('0x40')][_0xf9de('0x41')]};});_0x186909['model']=_[_0xf9de('0x3c')](_0x5c867d,_0xf9de('0x3a'));_0x186909[_0xf9de('0x42')]=_[_0xf9de('0x43')](_0x39f8e7['query']);_0x186909[_0xf9de('0x44')]=_[_0xf9de('0x45')](_0x186909[_0xf9de('0x46')],_0x186909['query']);_0x207a5a[_0xf9de('0x47')]=_[_0xf9de('0x45')](_0x186909[_0xf9de('0x46')],qs[_0xf9de('0x48')](_0x39f8e7[_0xf9de('0x42')][_0xf9de('0x48')]));_0x207a5a[_0xf9de('0x47')]=_0x207a5a[_0xf9de('0x47')]['length']?_0x207a5a[_0xf9de('0x47')]:_0x186909['model'];if(!_0x39f8e7[_0xf9de('0x42')][_0xf9de('0x49')]('nolimit')){_0x207a5a[_0xf9de('0x31')]=qs[_0xf9de('0x31')](_0x39f8e7[_0xf9de('0x42')][_0xf9de('0x31')]);_0x207a5a['offset']=qs[_0xf9de('0x30')](_0x39f8e7[_0xf9de('0x42')][_0xf9de('0x30')]);}_0x207a5a[_0xf9de('0x4a')]=qs['sort'](_0x39f8e7[_0xf9de('0x42')][_0xf9de('0x4b')]);_0x207a5a[_0xf9de('0x4c')]=qs[_0xf9de('0x44')](_[_0xf9de('0x4d')](_0x39f8e7[_0xf9de('0x42')],_0x186909[_0xf9de('0x44')]),_0x5c867d);if(_0x39f8e7[_0xf9de('0x42')][_0xf9de('0x4e')]){_0x207a5a[_0xf9de('0x4c')]=_[_0xf9de('0x4f')](_0x207a5a[_0xf9de('0x4c')],{'$or':_[_0xf9de('0x3c')](_0x5c867d,function(_0x56a628){if(_0x56a628['type']!==_0xf9de('0x50')){var _0x4d1212={};_0x4d1212[_0x56a628[_0xf9de('0x3a')]]={'$like':'%'+_0x39f8e7[_0xf9de('0x42')][_0xf9de('0x4e')]+'%'};return _0x4d1212;}})});}_0x207a5a=_[_0xf9de('0x4f')]({},_0x207a5a,_0x39f8e7[_0xf9de('0x51')]);var _0x23ba1c={'where':_0x207a5a[_0xf9de('0x4c')]};return db[_0xf9de('0x3d')][_0xf9de('0x2f')](_0x23ba1c)['then'](function(_0x18967a){_0x2767e3['count']=_0x18967a;if(_0x39f8e7[_0xf9de('0x42')]['includeAll']){_0x207a5a[_0xf9de('0x52')]=[{'all':!![]}];}return db[_0xf9de('0x3d')]['findAll'](_0x207a5a);})['then'](function(_0x162d5a){_0x2767e3[_0xf9de('0x53')]=_0x162d5a;return _0x2767e3;})[_0xf9de('0x23')](respondWithFilteredResult(_0x9e2889,_0x207a5a))[_0xf9de('0x54')](handleError(_0x9e2889,null));};exports[_0xf9de('0x55')]=function(_0x58572b,_0x5c046f){var _0xfcba58={'raw':!![],'where':{'id':_0x58572b[_0xf9de('0x56')]['id']}},_0x4d113d={};_0x4d113d[_0xf9de('0x46')]=_[_0xf9de('0x43')](db[_0xf9de('0x3d')][_0xf9de('0x3e')]);_0x4d113d['query']=_[_0xf9de('0x43')](_0x58572b[_0xf9de('0x42')]);_0x4d113d[_0xf9de('0x44')]=_[_0xf9de('0x45')](_0x4d113d[_0xf9de('0x46')],_0x4d113d['query']);_0xfcba58[_0xf9de('0x47')]=_[_0xf9de('0x45')](_0x4d113d[_0xf9de('0x46')],qs[_0xf9de('0x48')](_0x58572b['query'][_0xf9de('0x48')]));_0xfcba58[_0xf9de('0x47')]=_0xfcba58[_0xf9de('0x47')]['length']?_0xfcba58[_0xf9de('0x47')]:_0x4d113d[_0xf9de('0x46')];if(_0x58572b['query']['includeAll']){_0xfcba58[_0xf9de('0x52')]=[{'all':!![]}];}_0xfcba58=_[_0xf9de('0x4f')]({},_0xfcba58,_0x58572b[_0xf9de('0x51')]);return db[_0xf9de('0x3d')][_0xf9de('0x57')](_0xfcba58)[_0xf9de('0x23')](handleEntityNotFound(_0x5c046f,null))[_0xf9de('0x23')](respondWithResult(_0x5c046f,null))[_0xf9de('0x54')](handleError(_0x5c046f,null));};exports[_0xf9de('0x35')]=function(_0x4209c5,_0x37cb20){if(_0x4209c5[_0xf9de('0x58')]['id']){delete _0x4209c5[_0xf9de('0x58')]['id'];}return db[_0xf9de('0x3d')][_0xf9de('0x57')]({'where':{'id':_0x4209c5[_0xf9de('0x56')]['id']}})[_0xf9de('0x23')](handleEntityNotFound(_0x37cb20,null))['then'](saveUpdates(_0x4209c5[_0xf9de('0x58')],null))[_0xf9de('0x23')](respondWithResult(_0x37cb20,null))['catch'](handleError(_0x37cb20,null));};exports[_0xf9de('0x36')]=function(_0x57187e,_0x48c1a9){return db[_0xf9de('0x3d')]['find']({'where':{'id':_0x57187e['params']['id']}})[_0xf9de('0x23')](handleEntityNotFound(_0x48c1a9,null))[_0xf9de('0x23')](removeEntity(_0x48c1a9,null))[_0xf9de('0x54')](handleError(_0x48c1a9,null));};exports[_0xf9de('0x59')]=function(_0x4dccd9,_0x27d131){return db[_0xf9de('0x3d')]['describe']()[_0xf9de('0x23')](respondWithResult(_0x27d131,null))[_0xf9de('0x54')](handleError(_0x27d131,null));};var interaction_log=require(_0xf9de('0x13'))(_0xf9de('0x5a'));exports[_0xf9de('0x5b')]=function(_0x2e3f8e,_0x3aff41,_0x575f21){var _0x2ca7c3={'channel':_0xf9de('0x5c')};if(_0x2e3f8e[_0xf9de('0x58')]['id']){delete _0x2e3f8e[_0xf9de('0x58')]['id'];}_0x2e3f8e[_0xf9de('0x58')][_0xf9de('0x5d')]=!![];_0x2e3f8e[_0xf9de('0x58')][_0xf9de('0x5e')]=moment()[_0xf9de('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e3f8e['body'][_0xf9de('0x60')]=_0x2e3f8e[_0xf9de('0x58')]['UserId']||_0x2e3f8e[_0xf9de('0x61')]['id'];return db[_0xf9de('0x3d')][_0xf9de('0x57')]({'where':{'id':_0x2e3f8e[_0xf9de('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xf9de('0x62')],'as':_0xf9de('0x63')}]})[_0xf9de('0x23')](handleEntityNotFound(_0x3aff41,null))['then'](saveUpdates(_0x2e3f8e[_0xf9de('0x58')],null))[_0xf9de('0x23')](function(_0x58f23a){if(_0x58f23a){_0x2ca7c3[_0xf9de('0x2b')]=_0x58f23a['get']({'plain':!![]});return db[_0xf9de('0x64')][_0xf9de('0x57')]({'where':{'id':_0x58f23a[_0xf9de('0x65')]}});}return null;})[_0xf9de('0x23')](handleEntityNotFound(_0x3aff41,null))[_0xf9de('0x23')](function(_0x4f978b){if(_0x4f978b){return _0x4f978b[_0xf9de('0x35')]({'UserId':_0x2e3f8e[_0xf9de('0x58')][_0xf9de('0x60')],'read1stAt':_[_0xf9de('0x66')](_0x4f978b[_0xf9de('0x67')])?moment()['format'](_0xf9de('0x68')):undefined});}return null;})['then'](function(_0x377e21){if(_0x377e21){_0x2ca7c3[_0xf9de('0x69')]=_0x377e21[_0xf9de('0x6a')]({'plain':!![]});interaction_log['info'](_0xf9de('0x6b'),_0x2e3f8e[_0xf9de('0x61')]['id'],_0x2e3f8e[_0xf9de('0x61')][_0xf9de('0x3a')],_0x2e3f8e[_0xf9de('0x61')][_0xf9de('0x6c')],_0x2ca7c3['interaction']['id'],_0x2e3f8e[_0xf9de('0x58')]?JSON['stringify'](_0x2e3f8e[_0xf9de('0x58')]):_0xf9de('0x6d'));return respondWithRpcPromise(_0xf9de('0x6e'),_0xf9de('0x6f'),_0x2ca7c3);}return null;})[_0xf9de('0x23')](function(_0x363278){if(_0x363278){if(_0x2e3f8e[_0xf9de('0x58')][_0xf9de('0x70')]){_0x2ca7c3[_0xf9de('0x2b')][_0xf9de('0x71')]=util[_0xf9de('0x5f')]('SIP/%s',_0x2e3f8e[_0xf9de('0x61')][_0xf9de('0x3a')]);_0x2ca7c3['message']['channel']=_0x2ca7c3[_0xf9de('0x72')];_0x2ca7c3[_0xf9de('0x2b')][_0xf9de('0x73')]=_0xf9de('0x5b');return respondWithRpcPromise(_0xf9de('0x74'),'EventManager',{'event':_0xf9de('0x75'),'message':_0x2ca7c3['message']},client9002)[_0xf9de('0x23')](function(){return _0x2ca7c3;});}return _0x2ca7c3;}return null;})['then'](respondWithResult(_0x3aff41,null))[_0xf9de('0x54')](handleError(_0x3aff41,null));};var interaction_log=require(_0xf9de('0x13'))(_0xf9de('0x5a'));exports[_0xf9de('0x76')]=function(_0x17b50a,_0x448b65,_0x104a30){var _0x4ca554={'agent':{},'channel':_0xf9de('0x5c')};if(_0x17b50a[_0xf9de('0x58')]['id']){delete _0x17b50a[_0xf9de('0x58')]['id'];}_0x17b50a[_0xf9de('0x58')][_0xf9de('0x60')]=_0x17b50a[_0xf9de('0x58')]['UserId']||_0x17b50a[_0xf9de('0x61')]['id'];_0x4ca554[_0xf9de('0x77')]['id']=_0x17b50a[_0xf9de('0x58')][_0xf9de('0x60')];return db[_0xf9de('0x3d')][_0xf9de('0x57')]({'where':{'id':_0x17b50a[_0xf9de('0x56')]['id'],'UserId':null}})[_0xf9de('0x23')](handleEntityNotFound(_0x448b65,null))[_0xf9de('0x23')](function(_0x33124f){if(_0x33124f){_0x4ca554[_0xf9de('0x2b')]=_0x33124f['get']({'plain':!![]});return db['FaxInteraction'][_0xf9de('0x57')]({'where':{'id':_0x33124f[_0xf9de('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x448b65,null))[_0xf9de('0x23')](function(_0x732d5){if(_0x732d5){_0x4ca554['interaction']=_0x732d5['get']({'plain':!![]});interaction_log[_0xf9de('0x2c')](_0xf9de('0x78'),_0x17b50a[_0xf9de('0x61')]['id'],_0x17b50a[_0xf9de('0x61')]['name'],_0x17b50a[_0xf9de('0x61')][_0xf9de('0x6c')],_0x4ca554[_0xf9de('0x69')]['id'],_0x17b50a['body']?JSON[_0xf9de('0x28')](_0x17b50a['body']):_0xf9de('0x6d'));return respondWithRpcPromise(_0xf9de('0x79'),_0xf9de('0x7a'),_0x4ca554);}return null;})[_0xf9de('0x23')](function(_0x1da4d5){if(_0x1da4d5){_0x1da4d5[_0xf9de('0x2b')]['interface']=util[_0xf9de('0x5f')](_0xf9de('0x7b'),_0x17b50a['user'][_0xf9de('0x3a')]);_0x1da4d5[_0xf9de('0x2b')][_0xf9de('0x72')]=_0x4ca554['channel'];_0x1da4d5[_0xf9de('0x2b')][_0xf9de('0x73')]=_0xf9de('0x76');respondWithRpcPromise(_0xf9de('0x74'),_0xf9de('0x74'),{'event':_0xf9de('0x7c'),'message':_0x1da4d5[_0xf9de('0x2b')]},client9002);return _0x4ca554;}return null;})[_0xf9de('0x23')](respondWithResult(_0x448b65,null))[_0xf9de('0x54')](handleError(_0x448b65,null));};exports['create']=function(_0x55b1fb,_0x5ee624){var _0x3b8117;return db[_0xf9de('0x3d')][_0xf9de('0x7d')](_0x55b1fb[_0xf9de('0x58')],{})[_0xf9de('0x23')](function(_0x22b4ec){_0x3b8117=_0x22b4ec;return db[_0xf9de('0x62')]['findOne']({'where':{'id':_0x3b8117['ContactId']}});})[_0xf9de('0x23')](function(_0x48f71f){if(_[_0xf9de('0x66')](_0x48f71f)){return;}else{_0x3b8117[_0xf9de('0x5c')]=_0x48f71f['fax'];return db[_0xf9de('0x7e')][_0xf9de('0x7f')]({'where':{'id':_0x3b8117['AttachmentId']}});}})[_0xf9de('0x23')](function(_0x5c8b21){return respondWithRpcPromise(_0xf9de('0x80'),_0xf9de('0x80'),{'FaxAccountId':_[_0xf9de('0x66')](_0x55b1fb['body'])?undefined:_0x55b1fb[_0xf9de('0x58')][_0xf9de('0x81')],'path':_['isNil'](_0x5c8b21)?undefined:util[_0xf9de('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x5c8b21[_0xf9de('0x82')]),'fax':_[_0xf9de('0x66')](_0x3b8117[_0xf9de('0x5c')])?undefined:_0x3b8117[_0xf9de('0x5c')],'AttachmentId':_0x3b8117[_0xf9de('0x83')]},client9002);})[_0xf9de('0x23')](respondWithResult(_0x5ee624,0xc9))[_0xf9de('0x54')](handleError(_0x5ee624,null));};exports['download']=function(_0x5e8692,_0x59622d){var _0xb16ab7=path[_0xf9de('0x84')](config['root'],_0xf9de('0x85'),_0xf9de('0x86'),_0xf9de('0x87'));return db['FaxMessage'][_0xf9de('0x57')]({'where':{'id':_0x5e8692[_0xf9de('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0xf9de('0x7e')}]})[_0xf9de('0x23')](handleEntityNotFound(_0x59622d,null))[_0xf9de('0x23')](function(_0xbb822d){if(_0xbb822d){return _0x59622d['download'](path['join'](_0xb16ab7,_0xbb822d[_0xf9de('0x7e')][_0xf9de('0x82')]));}})[_0xf9de('0x54')](handleError(_0x59622d,null));}; \ No newline at end of file +var _0x15e9=['then','FaxMessage,\x20%s,\x20%s','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','destroy','stack','send','index','map','FaxMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','name','filter','options','include','show','params','includeAll','find','body','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','FaxInteraction','isNil','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','basename','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x15e9,0x172));var _0x915e=function(_0x3ba031,_0x24a120){_0x3ba031=_0x3ba031-0x0;var _0x3c7875=_0x15e9[_0x3ba031];return _0x3c7875;};'use strict';var pdf=require(_0x915e('0x0'));var emlformat=require(_0x915e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x915e('0x2'));var jsonpatch=require(_0x915e('0x3'));var rp=require(_0x915e('0x4'));var moment=require(_0x915e('0x5'));var BPromise=require(_0x915e('0x6'));var Mustache=require(_0x915e('0x7'));var util=require(_0x915e('0x8'));var path=require(_0x915e('0x9'));var sox=require(_0x915e('0xa'));var csv=require('to-csv');var ejs=require(_0x915e('0xb'));var fs=require('fs');var _=require(_0x915e('0xc'));var squel=require(_0x915e('0xd'));var crypto=require(_0x915e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x915e('0xf'));var toCsv=require(_0x915e('0x10'));var querystring=require(_0x915e('0x11'));var Papa=require(_0x915e('0x12'));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(_0x915e('0x13'));var logger=require(_0x915e('0x14'))(_0x915e('0x15'));var utils=require(_0x915e('0x16'));var config=require(_0x915e('0x17'));var db=require(_0x915e('0x18'))['db'];config[_0x915e('0x19')]=_[_0x915e('0x1a')](config[_0x915e('0x19')],{'host':_0x915e('0x1b'),'port':0x18eb});var socket=require(_0x915e('0x1c'))(new Redis(config[_0x915e('0x19')]));require(_0x915e('0x1d'))[_0x915e('0x1e')](socket);var jayson=require(_0x915e('0x1f'));var client=jayson['client'][_0x915e('0x20')]({'port':0x232c});var client9002=jayson[_0x915e('0x21')]['http']({'port':0x232a});function checkPasswordPattern(_0x5e5184,_0x7e52f9,_0xd1c332){if(_0xd1c332){var _0x5227cd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5227cd[_0x915e('0x22')](_0x7e52f9)){return _0x5e5184;}else{throw new db[(_0x915e('0x23'))]['ValidationError'](_0x915e('0x24'));}}else{return _0x5e5184;}}function respondWithRpcPromise(_0x151bb0,_0x26a127,_0x555121,_0x836844){return new BPromise(function(_0x5d954d,_0x279af3){var _0x8e70e6=_0x836844||client;return _0x8e70e6[_0x915e('0x25')](_0x151bb0,_0x555121)[_0x915e('0x26')](function(_0x3b66b8){logger['info'](_0x915e('0x27'),_0x26a127,'request\x20sent');logger['debug'](_0x915e('0x28'),_0x26a127,_0x915e('0x29'),JSON['stringify'](_0x3b66b8));if(_0x3b66b8['error']){if(_0x3b66b8[_0x915e('0x2a')][_0x915e('0x2b')]===0x1f4){logger[_0x915e('0x2a')](_0x915e('0x27'),_0x26a127,_0x3b66b8[_0x915e('0x2a')]['message']);return _0x279af3(_0x3b66b8[_0x915e('0x2a')]['message']);}logger[_0x915e('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x26a127,_0x3b66b8[_0x915e('0x2a')][_0x915e('0x2c')]);return _0x5d954d(_0x3b66b8[_0x915e('0x2a')][_0x915e('0x2c')]);}else{logger[_0x915e('0x2d')]('FaxMessage,\x20%s,\x20%s',_0x26a127,_0x915e('0x29'));_0x5d954d(_0x3b66b8['result']['message']);}})[_0x915e('0x2e')](function(_0x2a5028){logger['error'](_0x915e('0x27'),_0x26a127,_0x2a5028);_0x279af3(_0x2a5028);});});}function respondWithStatusCode(_0x20302f,_0x276c93){_0x276c93=_0x276c93||0xcc;return function(_0x2064bd){if(_0x2064bd){return _0x20302f[_0x915e('0x2f')](_0x276c93);}return _0x20302f['status'](_0x276c93)[_0x915e('0x30')]();};}function respondWithResult(_0x1ece18,_0x5e1c63){_0x5e1c63=_0x5e1c63||0xc8;return function(_0x1b5bda){if(_0x1b5bda){return _0x1ece18['status'](_0x5e1c63)[_0x915e('0x31')](_0x1b5bda);}};}function respondWithFilteredResult(_0x39187a,_0xb7cd36){return function(_0xea148b){if(_0xea148b){var _0x5ce6ae=_0xea148b[_0x915e('0x32')],_0x12311b=_0xb7cd36[_0x915e('0x33')],_0x1b6b62=_0xb7cd36[_0x915e('0x33')]+_0xb7cd36[_0x915e('0x34')],_0x4a38a9;if(_0x1b6b62>=_0x5ce6ae){_0x1b6b62=_0x5ce6ae;_0x4a38a9=0xc8;}else{_0x4a38a9=0xce;}_0x39187a[_0x915e('0x35')](_0x4a38a9);return _0x39187a[_0x915e('0x36')](_0x915e('0x37'),_0x12311b+'-'+_0x1b6b62+'/'+_0x5ce6ae)[_0x915e('0x31')](_0xea148b);}return null;};}function patchUpdates(_0x3d98a4){return function(_0x20f242){try{jsonpatch[_0x915e('0x38')](_0x20f242,_0x3d98a4,!![]);}catch(_0x1e9617){return BPromise['reject'](_0x1e9617);}return _0x20f242[_0x915e('0x39')]();};}function saveUpdates(_0x4c0d7f,_0x3fe4f2){return function(_0x43cbe2){if(_0x43cbe2){return _0x43cbe2[_0x915e('0x3a')](_0x4c0d7f)[_0x915e('0x26')](function(_0x36401c){return _0x36401c;});}return null;};}function removeEntity(_0x2f2466,_0x23d011){return function(_0x24655b){if(_0x24655b){return _0x24655b[_0x915e('0x3b')]()[_0x915e('0x26')](function(){_0x2f2466[_0x915e('0x35')](0xcc)[_0x915e('0x30')]();});}};}function handleEntityNotFound(_0x2e9f13,_0x4fc8d2){return function(_0x30d55a){if(!_0x30d55a){_0x2e9f13[_0x915e('0x2f')](0x194);}return _0x30d55a;};}function handleError(_0x2ea24d,_0x55c674){_0x55c674=_0x55c674||0x1f4;return function(_0x530b87){logger['error'](_0x530b87[_0x915e('0x3c')]);if(_0x530b87['name']){delete _0x530b87['name'];}_0x2ea24d[_0x915e('0x35')](_0x55c674)[_0x915e('0x3d')](_0x530b87);};}exports[_0x915e('0x3e')]=function(_0x26bb7f,_0x5a0ead){var _0x125a57={},_0x1f6434={},_0xf1e695={'count':0x0,'rows':[]};var _0x56fa34=_[_0x915e('0x3f')](db[_0x915e('0x40')][_0x915e('0x41')],function(_0x3c938f){return{'name':_0x3c938f[_0x915e('0x42')],'type':_0x3c938f['type'][_0x915e('0x43')]};});_0x1f6434[_0x915e('0x44')]=_['map'](_0x56fa34,'name');_0x1f6434['query']=_[_0x915e('0x45')](_0x26bb7f[_0x915e('0x46')]);_0x1f6434[_0x915e('0x47')]=_[_0x915e('0x48')](_0x1f6434[_0x915e('0x44')],_0x1f6434['query']);_0x125a57[_0x915e('0x49')]=_[_0x915e('0x48')](_0x1f6434[_0x915e('0x44')],qs[_0x915e('0x4a')](_0x26bb7f[_0x915e('0x46')][_0x915e('0x4a')]));_0x125a57['attributes']=_0x125a57[_0x915e('0x49')][_0x915e('0x4b')]?_0x125a57['attributes']:_0x1f6434['model'];if(!_0x26bb7f[_0x915e('0x46')][_0x915e('0x4c')](_0x915e('0x4d'))){_0x125a57[_0x915e('0x34')]=qs[_0x915e('0x34')](_0x26bb7f[_0x915e('0x46')][_0x915e('0x34')]);_0x125a57[_0x915e('0x33')]=qs[_0x915e('0x33')](_0x26bb7f[_0x915e('0x46')]['offset']);}_0x125a57['order']=qs['sort'](_0x26bb7f['query'][_0x915e('0x4e')]);_0x125a57[_0x915e('0x4f')]=qs[_0x915e('0x47')](_[_0x915e('0x50')](_0x26bb7f[_0x915e('0x46')],_0x1f6434[_0x915e('0x47')]),_0x56fa34);if(_0x26bb7f[_0x915e('0x46')]['filter']){_0x125a57[_0x915e('0x4f')]=_[_0x915e('0x51')](_0x125a57[_0x915e('0x4f')],{'$or':_[_0x915e('0x3f')](_0x56fa34,function(_0x187531){if(_0x187531[_0x915e('0x52')]!==_0x915e('0x53')){var _0x2aad4c={};_0x2aad4c[_0x187531[_0x915e('0x54')]]={'$like':'%'+_0x26bb7f[_0x915e('0x46')][_0x915e('0x55')]+'%'};return _0x2aad4c;}})});}_0x125a57=_[_0x915e('0x51')]({},_0x125a57,_0x26bb7f[_0x915e('0x56')]);var _0x30d680={'where':_0x125a57[_0x915e('0x4f')]};return db[_0x915e('0x40')][_0x915e('0x32')](_0x30d680)[_0x915e('0x26')](function(_0x2b8e7f){_0xf1e695[_0x915e('0x32')]=_0x2b8e7f;if(_0x26bb7f['query']['includeAll']){_0x125a57[_0x915e('0x57')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x125a57);})['then'](function(_0x24c23d){_0xf1e695['rows']=_0x24c23d;return _0xf1e695;})[_0x915e('0x26')](respondWithFilteredResult(_0x5a0ead,_0x125a57))[_0x915e('0x2e')](handleError(_0x5a0ead,null));};exports[_0x915e('0x58')]=function(_0x46237e,_0x38f79d){var _0x2627b1={'raw':!![],'where':{'id':_0x46237e[_0x915e('0x59')]['id']}},_0x25e8c7={};_0x25e8c7[_0x915e('0x44')]=_[_0x915e('0x45')](db[_0x915e('0x40')][_0x915e('0x41')]);_0x25e8c7[_0x915e('0x46')]=_[_0x915e('0x45')](_0x46237e[_0x915e('0x46')]);_0x25e8c7['filters']=_[_0x915e('0x48')](_0x25e8c7[_0x915e('0x44')],_0x25e8c7[_0x915e('0x46')]);_0x2627b1[_0x915e('0x49')]=_[_0x915e('0x48')](_0x25e8c7[_0x915e('0x44')],qs['fields'](_0x46237e[_0x915e('0x46')][_0x915e('0x4a')]));_0x2627b1[_0x915e('0x49')]=_0x2627b1[_0x915e('0x49')][_0x915e('0x4b')]?_0x2627b1[_0x915e('0x49')]:_0x25e8c7['model'];if(_0x46237e[_0x915e('0x46')][_0x915e('0x5a')]){_0x2627b1[_0x915e('0x57')]=[{'all':!![]}];}_0x2627b1=_[_0x915e('0x51')]({},_0x2627b1,_0x46237e[_0x915e('0x56')]);return db['FaxMessage'][_0x915e('0x5b')](_0x2627b1)[_0x915e('0x26')](handleEntityNotFound(_0x38f79d,null))[_0x915e('0x26')](respondWithResult(_0x38f79d,null))[_0x915e('0x2e')](handleError(_0x38f79d,null));};exports[_0x915e('0x3a')]=function(_0x20afa6,_0x48eed7){if(_0x20afa6[_0x915e('0x5c')]['id']){delete _0x20afa6['body']['id'];}return db['FaxMessage'][_0x915e('0x5b')]({'where':{'id':_0x20afa6['params']['id']}})[_0x915e('0x26')](handleEntityNotFound(_0x48eed7,null))[_0x915e('0x26')](saveUpdates(_0x20afa6[_0x915e('0x5c')],null))['then'](respondWithResult(_0x48eed7,null))[_0x915e('0x2e')](handleError(_0x48eed7,null));};exports[_0x915e('0x3b')]=function(_0x3bbbd5,_0x3b03ec){return db[_0x915e('0x40')]['find']({'where':{'id':_0x3bbbd5[_0x915e('0x59')]['id']}})['then'](handleEntityNotFound(_0x3b03ec,null))[_0x915e('0x26')](removeEntity(_0x3b03ec,null))[_0x915e('0x2e')](handleError(_0x3b03ec,null));};exports['describe']=function(_0x54d9b1,_0x1af018){return db[_0x915e('0x40')][_0x915e('0x5d')]()[_0x915e('0x26')](respondWithResult(_0x1af018,null))[_0x915e('0x2e')](handleError(_0x1af018,null));};var interaction_log=require('../../config/logger')(_0x915e('0x5e'));exports['accept']=function(_0x383d3d,_0x173197,_0xc4b2d2){var _0x54290e={'channel':_0x915e('0x5f')};if(_0x383d3d[_0x915e('0x5c')]['id']){delete _0x383d3d['body']['id'];}_0x383d3d[_0x915e('0x5c')][_0x915e('0x60')]=!![];_0x383d3d[_0x915e('0x5c')][_0x915e('0x61')]=moment()[_0x915e('0x62')](_0x915e('0x63'));_0x383d3d[_0x915e('0x5c')][_0x915e('0x64')]=_0x383d3d['body']['UserId']||_0x383d3d[_0x915e('0x65')]['id'];return db[_0x915e('0x40')][_0x915e('0x5b')]({'where':{'id':_0x383d3d[_0x915e('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x915e('0x66')],'as':'Contact'}]})[_0x915e('0x26')](handleEntityNotFound(_0x173197,null))[_0x915e('0x26')](saveUpdates(_0x383d3d[_0x915e('0x5c')],null))[_0x915e('0x26')](function(_0x261e4a){if(_0x261e4a){_0x54290e[_0x915e('0x2c')]=_0x261e4a['get']({'plain':!![]});return db[_0x915e('0x67')]['find']({'where':{'id':_0x261e4a['FaxInteractionId']}});}return null;})[_0x915e('0x26')](handleEntityNotFound(_0x173197,null))['then'](function(_0x26424d){if(_0x26424d){return _0x26424d[_0x915e('0x3a')]({'UserId':_0x383d3d['body'][_0x915e('0x64')],'read1stAt':_[_0x915e('0x68')](_0x26424d['read1stAt'])?moment()['format'](_0x915e('0x63')):undefined});}return null;})[_0x915e('0x26')](function(_0x3a043d){if(_0x3a043d){_0x54290e[_0x915e('0x69')]=_0x3a043d[_0x915e('0x6a')]({'plain':!![]});interaction_log[_0x915e('0x2d')](_0x915e('0x6b'),_0x383d3d[_0x915e('0x65')]['id'],_0x383d3d[_0x915e('0x65')][_0x915e('0x54')],_0x383d3d['user'][_0x915e('0x6c')],_0x54290e[_0x915e('0x69')]['id'],_0x383d3d[_0x915e('0x5c')]?JSON['stringify'](_0x383d3d[_0x915e('0x5c')]):_0x915e('0x6d'));return respondWithRpcPromise(_0x915e('0x6e'),_0x915e('0x6f'),_0x54290e);}return null;})['then'](function(_0x310817){if(_0x310817){if(_0x383d3d[_0x915e('0x5c')]['manual']){_0x54290e[_0x915e('0x2c')][_0x915e('0x70')]=util[_0x915e('0x62')]('SIP/%s',_0x383d3d['user']['name']);_0x54290e['message'][_0x915e('0x71')]=_0x54290e['channel'];_0x54290e['message'][_0x915e('0x72')]='accept';return respondWithRpcPromise('EventManager',_0x915e('0x73'),{'event':_0x915e('0x74'),'message':_0x54290e[_0x915e('0x2c')]},client9002)[_0x915e('0x26')](function(){return _0x54290e;});}return _0x54290e;}return null;})[_0x915e('0x26')](respondWithResult(_0x173197,null))['catch'](handleError(_0x173197,null));};var interaction_log=require(_0x915e('0x14'))(_0x915e('0x5e'));exports[_0x915e('0x75')]=function(_0x5ae423,_0x210eb2,_0x30f7fa){var _0x4ed172={'agent':{},'channel':'fax'};if(_0x5ae423['body']['id']){delete _0x5ae423[_0x915e('0x5c')]['id'];}_0x5ae423[_0x915e('0x5c')][_0x915e('0x64')]=_0x5ae423[_0x915e('0x5c')][_0x915e('0x64')]||_0x5ae423[_0x915e('0x65')]['id'];_0x4ed172[_0x915e('0x76')]['id']=_0x5ae423['body'][_0x915e('0x64')];return db[_0x915e('0x40')][_0x915e('0x5b')]({'where':{'id':_0x5ae423[_0x915e('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x210eb2,null))[_0x915e('0x26')](function(_0x2f4721){if(_0x2f4721){_0x4ed172[_0x915e('0x2c')]=_0x2f4721[_0x915e('0x6a')]({'plain':!![]});return db['FaxInteraction'][_0x915e('0x5b')]({'where':{'id':_0x2f4721['FaxInteractionId']}});}return null;})[_0x915e('0x26')](handleEntityNotFound(_0x210eb2,null))[_0x915e('0x26')](function(_0x2cbbf5){if(_0x2cbbf5){_0x4ed172[_0x915e('0x69')]=_0x2cbbf5[_0x915e('0x6a')]({'plain':!![]});interaction_log['info'](_0x915e('0x77'),_0x5ae423[_0x915e('0x65')]['id'],_0x5ae423[_0x915e('0x65')][_0x915e('0x54')],_0x5ae423[_0x915e('0x65')][_0x915e('0x6c')],_0x4ed172[_0x915e('0x69')]['id'],_0x5ae423['body']?JSON['stringify'](_0x5ae423['body']):'null');return respondWithRpcPromise('RejectMessage',_0x915e('0x78'),_0x4ed172);}return null;})[_0x915e('0x26')](function(_0x5c7d61){if(_0x5c7d61){_0x5c7d61['message'][_0x915e('0x70')]=util[_0x915e('0x62')](_0x915e('0x79'),_0x5ae423[_0x915e('0x65')][_0x915e('0x54')]);_0x5c7d61['message']['channel']=_0x4ed172['channel'];_0x5c7d61[_0x915e('0x2c')][_0x915e('0x72')]=_0x915e('0x75');respondWithRpcPromise(_0x915e('0x73'),'EventManager',{'event':'rejectmessage','message':_0x5c7d61['message']},client9002);return _0x4ed172;}return null;})['then'](respondWithResult(_0x210eb2,null))['catch'](handleError(_0x210eb2,null));};exports[_0x915e('0x7a')]=function(_0x5b2a20,_0x3d827f){var _0x1c9c99;return db[_0x915e('0x40')]['create'](_0x5b2a20[_0x915e('0x5c')],{})[_0x915e('0x26')](function(_0x327abf){_0x1c9c99=_0x327abf;return db['CmContact'][_0x915e('0x7b')]({'where':{'id':_0x1c9c99['ContactId']}});})[_0x915e('0x26')](function(_0x4c1a55){if(_[_0x915e('0x68')](_0x4c1a55)){return;}else{_0x1c9c99[_0x915e('0x5f')]=_0x4c1a55[_0x915e('0x5f')];return db[_0x915e('0x7c')][_0x915e('0x7b')]({'where':{'id':_0x1c9c99[_0x915e('0x7d')]}});}})[_0x915e('0x26')](function(_0x26751c){return respondWithRpcPromise(_0x915e('0x7e'),_0x915e('0x7e'),{'FaxAccountId':_[_0x915e('0x68')](_0x5b2a20['body'])?undefined:_0x5b2a20[_0x915e('0x5c')][_0x915e('0x7f')],'path':_[_0x915e('0x68')](_0x26751c)?undefined:util['format'](_0x915e('0x80'),_0x26751c['basename']),'fax':_[_0x915e('0x68')](_0x1c9c99[_0x915e('0x5f')])?undefined:_0x1c9c99[_0x915e('0x5f')],'AttachmentId':_0x1c9c99[_0x915e('0x7d')]},client9002);})['then'](respondWithResult(_0x3d827f,0xc9))[_0x915e('0x2e')](handleError(_0x3d827f,null));};exports[_0x915e('0x81')]=function(_0x2cbfa5,_0x223f86){var _0x45e704=path[_0x915e('0x82')](config[_0x915e('0x83')],_0x915e('0x84'),_0x915e('0x85'),_0x915e('0x86'));return db[_0x915e('0x40')]['find']({'where':{'id':_0x2cbfa5[_0x915e('0x59')]['id']},'include':[{'model':db[_0x915e('0x7c')],'as':_0x915e('0x7c')}]})[_0x915e('0x26')](handleEntityNotFound(_0x223f86,null))['then'](function(_0x317a5f){if(_0x317a5f){return _0x223f86[_0x915e('0x81')](path['join'](_0x45e704,_0x317a5f[_0x915e('0x7c')][_0x915e('0x87')]));}})[_0x915e('0x2e')](handleError(_0x223f86,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 1b2d5a1..e0ccb1f 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x5222cf,_0x469dc3){var _0x4ffa2e=function(_0x4010e5){while(--_0x4010e5){_0x5222cf['push'](_0x5222cf['shift']());}};_0x4ffa2e(++_0x469dc3);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x34e8,0x12c));var _0x834e=function(_0xd9be7c,_0x5ee534){_0xd9be7c=_0xd9be7c-0x0;var _0x4854a6=_0x34e8[_0xd9be7c];return _0x4854a6;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index cf55bee..a4a4876 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 _0x43b9=['fti_fax_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','FaxMessage','fax_messages'];(function(_0x36560d,_0x24b47b){var _0x4cb2a8=function(_0x2cabaf){while(--_0x2cabaf){_0x36560d['push'](_0x36560d['shift']());}};_0x4cb2a8(++_0x24b47b);}(_0x43b9,0x1ca));var _0x943b=function(_0x4b1a19,_0x372bc1){_0x4b1a19=_0x4b1a19-0x0;var _0x229657=_0x43b9[_0x4b1a19];return _0x229657;};'use strict';var _=require(_0x943b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x943b('0x1'));var moment=require(_0x943b('0x2'));var BPromise=require(_0x943b('0x3'));var rp=require(_0x943b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x943b('0x5'));var config=require(_0x943b('0x6'));var attributes=require(_0x943b('0x7'));module['exports']=function(_0x366eff,_0x2961ac){return _0x366eff['define'](_0x943b('0x8'),attributes,{'tableName':_0x943b('0x9'),'paranoid':![],'indexes':[{'name':_0x943b('0xa'),'fields':[_0x943b('0xb')],'type':_0x943b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e169c,_0x11c068,_0x29d52c){var _0x47c0dc=_0x366eff['models'];var _0x45661f=_0x5e169c['get']({'plain':!![]});if(_0x45661f[_0x943b('0xd')][_0x943b('0xe')]()==='in'||_0x45661f[_0x943b('0xd')][_0x943b('0xe')]()===_0x943b('0xf')&&!_0x45661f[_0x943b('0x10')]&&!_[_0x943b('0x11')](_0x45661f[_0x943b('0x12')])){_0x47c0dc[_0x943b('0x13')]['findOne']({'where':{'id':_0x45661f[_0x943b('0x14')]}})[_0x943b('0x15')](function(_0x274b52){if(_0x274b52){_0x274b52['update']({'lastMsgAt':_0x45661f[_0x943b('0x16')],'lastMsgDirection':_0x45661f['direction'][_0x943b('0xe')]()});}})['catch'](function(_0x3639fb){console[_0x943b('0x17')](_0x3639fb);});}_0x29d52c();}},'charset':_0x943b('0x18'),'collate':_0x943b('0x19')});}; \ No newline at end of file +var _0x432f=['path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','then','createdAt','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x478eb4,_0x5e0ac4){var _0x2db771=function(_0x1afb2b){while(--_0x1afb2b){_0x478eb4['push'](_0x478eb4['shift']());}};_0x2db771(++_0x5e0ac4);}(_0x432f,0x1da));var _0xf432=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x432f[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0xf432('0x0'));var util=require(_0xf432('0x1'));var logger=require('../../config/logger')(_0xf432('0x2'));var moment=require(_0xf432('0x3'));var BPromise=require(_0xf432('0x4'));var rp=require(_0xf432('0x5'));var fs=require('fs');var path=require(_0xf432('0x6'));var rimraf=require(_0xf432('0x7'));var config=require(_0xf432('0x8'));var attributes=require(_0xf432('0x9'));module[_0xf432('0xa')]=function(_0x19974c,_0x17195b){return _0x19974c['define'](_0xf432('0xb'),attributes,{'tableName':_0xf432('0xc'),'paranoid':![],'indexes':[{'name':_0xf432('0xd'),'fields':[_0xf432('0xe')],'type':_0xf432('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52c2a4,_0x407b56,_0x4022a3){var _0x4f4c78=_0x19974c[_0xf432('0x10')];var _0x528b15=_0x52c2a4[_0xf432('0x11')]({'plain':!![]});if(_0x528b15['direction'][_0xf432('0x12')]()==='in'||_0x528b15[_0xf432('0x13')]['toLowerCase']()===_0xf432('0x14')&&!_0x528b15[_0xf432('0x15')]&&!_[_0xf432('0x16')](_0x528b15[_0xf432('0x17')])){_0x4f4c78[_0xf432('0x18')][_0xf432('0x19')]({'where':{'id':_0x528b15['FaxInteractionId']}})[_0xf432('0x1a')](function(_0x40a03c){if(_0x40a03c){_0x40a03c['update']({'lastMsgAt':_0x528b15[_0xf432('0x1b')],'lastMsgDirection':_0x528b15['direction'][_0xf432('0x12')]()});}})['catch'](function(_0x2dc873){console[_0xf432('0x1c')](_0x2dc873);});}_0x4022a3();}},'charset':'utf8mb4','collate':_0xf432('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 9790309..d0c8407 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 _0x9a77=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','where','attributes','limit','lodash','util','moment'];(function(_0xee4dc3,_0x29f13e){var _0x181895=function(_0x8af473){while(--_0x8af473){_0xee4dc3['push'](_0xee4dc3['shift']());}};_0x181895(++_0x29f13e);}(_0x9a77,0x100));var _0x79a7=function(_0x41e037,_0x1d7574){_0x41e037=_0x41e037-0x0;var _0x5ded2f=_0x9a77[_0x41e037];return _0x5ded2f;};'use strict';var _=require(_0x79a7('0x0'));var util=require(_0x79a7('0x1'));var moment=require(_0x79a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x79a7('0x3'));var fs=require('fs');var Redis=require(_0x79a7('0x4'));var db=require(_0x79a7('0x5'))['db'];var utils=require(_0x79a7('0x6'));var logger=require(_0x79a7('0x7'))('rpc');var config=require(_0x79a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x79a7('0x9')][_0x79a7('0xa')]({'port':0x232a});config[_0x79a7('0xb')]=_[_0x79a7('0xc')](config[_0x79a7('0xb')],{'host':_0x79a7('0xd'),'port':0x18eb});var socket=require(_0x79a7('0xe'))(new Redis(config[_0x79a7('0xb')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5d0be1,_0x219c03,_0x529c){return new BPromise(function(_0x1815b2,_0x254138){return client[_0x79a7('0xf')](_0x5d0be1,_0x529c)[_0x79a7('0x10')](function(_0x73cf89){logger['info']('FaxMessage,\x20%s,\x20%s',_0x219c03,_0x79a7('0x11'));logger[_0x79a7('0x12')](_0x79a7('0x13'),_0x219c03,_0x79a7('0x11'),JSON[_0x79a7('0x14')](_0x73cf89));if(_0x73cf89['error']){if(_0x73cf89[_0x79a7('0x15')][_0x79a7('0x16')]===0x1f4){logger['error'](_0x79a7('0x17'),_0x219c03,_0x73cf89[_0x79a7('0x15')][_0x79a7('0x18')]);return _0x254138(_0x73cf89[_0x79a7('0x15')][_0x79a7('0x18')]);}logger['error'](_0x79a7('0x17'),_0x219c03,_0x73cf89[_0x79a7('0x15')]['message']);return _0x1815b2(_0x73cf89['error']['message']);}else{logger[_0x79a7('0x19')](_0x79a7('0x17'),_0x219c03,_0x79a7('0x11'));_0x1815b2(_0x73cf89[_0x79a7('0x1a')][_0x79a7('0x18')]);}})[_0x79a7('0x1b')](function(_0x225f65){logger['error'](_0x79a7('0x17'),_0x219c03,_0x225f65);_0x254138(_0x225f65);});});}exports[_0x79a7('0x1c')]=function(_0x2ffbbd){var _0x5cb8ac=this;return new Promise(function(_0x2a1586,_0xbbea6c){return db[_0x79a7('0x1d')]['create'](_0x2ffbbd[_0x79a7('0x1e')],{'raw':_0x2ffbbd['options']?_0x2ffbbd[_0x79a7('0x1f')][_0x79a7('0x20')]===undefined?!![]:![]:!![]})[_0x79a7('0x10')](function(_0x1f9981){logger[_0x79a7('0x19')](_0x79a7('0x1c'),_0x2ffbbd);logger[_0x79a7('0x12')](_0x79a7('0x1c'),_0x2ffbbd,JSON[_0x79a7('0x14')](_0x1f9981));_0x2a1586(_0x1f9981);})['catch'](function(_0x2a989a){logger[_0x79a7('0x15')](_0x79a7('0x1c'),_0x2a989a[_0x79a7('0x18')],_0x2ffbbd);_0xbbea6c(_0x5cb8ac[_0x79a7('0x15')](0x1f4,_0x2a989a[_0x79a7('0x18')]));});});};exports[_0x79a7('0x21')]=function(_0x2375ca){var _0x5100ef=this;return new Promise(function(_0x4aaa45,_0x4e1c50){return db[_0x79a7('0x1d')]['update'](_0x2375ca[_0x79a7('0x1e')],{'raw':_0x2375ca[_0x79a7('0x1f')]?_0x2375ca[_0x79a7('0x1f')][_0x79a7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2375ca[_0x79a7('0x1f')]?_0x2375ca[_0x79a7('0x1f')][_0x79a7('0x22')]||null:null,'attributes':_0x2375ca['options']?_0x2375ca[_0x79a7('0x1f')][_0x79a7('0x23')]||null:null,'limit':_0x2375ca['options']?_0x2375ca[_0x79a7('0x1f')][_0x79a7('0x24')]||null:null})[_0x79a7('0x10')](function(_0x4fe0fd){logger[_0x79a7('0x19')](_0x79a7('0x21'),_0x2375ca);logger[_0x79a7('0x12')](_0x79a7('0x21'),_0x2375ca,JSON[_0x79a7('0x14')](_0x4fe0fd));_0x4aaa45(_0x4fe0fd);})[_0x79a7('0x1b')](function(_0x715f5f){logger[_0x79a7('0x15')](_0x79a7('0x21'),_0x715f5f[_0x79a7('0x18')],_0x2375ca);_0x4e1c50(_0x5100ef[_0x79a7('0x15')](0x1f4,_0x715f5f[_0x79a7('0x18')]));});});}; \ No newline at end of file +var _0xbf74=['debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','where','attributes','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x2da354,_0x269f63){var _0x91b5c4=function(_0x2a4999){while(--_0x2a4999){_0x2da354['push'](_0x2da354['shift']());}};_0x91b5c4(++_0x269f63);}(_0xbf74,0x75));var _0x4bf7=function(_0x1aaf90,_0x49fac6){_0x1aaf90=_0x1aaf90-0x0;var _0x365f0e=_0xbf74[_0x1aaf90];return _0x365f0e;};'use strict';var _=require('lodash');var util=require(_0x4bf7('0x0'));var moment=require('moment');var BPromise=require(_0x4bf7('0x1'));var rs=require(_0x4bf7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bf7('0x3'))['db'];var utils=require(_0x4bf7('0x4'));var logger=require(_0x4bf7('0x5'))('rpc');var config=require(_0x4bf7('0x6'));var jayson=require(_0x4bf7('0x7'));var client=jayson[_0x4bf7('0x8')][_0x4bf7('0x9')]({'port':0x232a});config['redis']=_[_0x4bf7('0xa')](config['redis'],{'host':_0x4bf7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4bf7('0xc')]));require(_0x4bf7('0xd'))['register'](socket);function respondWithRpcPromise(_0x3980ff,_0x4693ac,_0x11be56){return new BPromise(function(_0x3c54d8,_0x58b0e9){return client[_0x4bf7('0xe')](_0x3980ff,_0x11be56)[_0x4bf7('0xf')](function(_0x6b1ec9){logger[_0x4bf7('0x10')](_0x4bf7('0x11'),_0x4693ac,_0x4bf7('0x12'));logger[_0x4bf7('0x13')](_0x4bf7('0x14'),_0x4693ac,'request\x20sent',JSON[_0x4bf7('0x15')](_0x6b1ec9));if(_0x6b1ec9['error']){if(_0x6b1ec9[_0x4bf7('0x16')]['code']===0x1f4){logger[_0x4bf7('0x16')]('FaxMessage,\x20%s,\x20%s',_0x4693ac,_0x6b1ec9[_0x4bf7('0x16')][_0x4bf7('0x17')]);return _0x58b0e9(_0x6b1ec9[_0x4bf7('0x16')]['message']);}logger[_0x4bf7('0x16')]('FaxMessage,\x20%s,\x20%s',_0x4693ac,_0x6b1ec9[_0x4bf7('0x16')][_0x4bf7('0x17')]);return _0x3c54d8(_0x6b1ec9[_0x4bf7('0x16')]['message']);}else{logger['info'](_0x4bf7('0x11'),_0x4693ac,_0x4bf7('0x12'));_0x3c54d8(_0x6b1ec9['result']['message']);}})[_0x4bf7('0x18')](function(_0x33ff0e){logger[_0x4bf7('0x16')](_0x4bf7('0x11'),_0x4693ac,_0x33ff0e);_0x58b0e9(_0x33ff0e);});});}exports[_0x4bf7('0x19')]=function(_0x3583fc){var _0x25f91b=this;return new Promise(function(_0x44fbed,_0x517c0d){return db[_0x4bf7('0x1a')]['create'](_0x3583fc[_0x4bf7('0x1b')],{'raw':_0x3583fc['options']?_0x3583fc[_0x4bf7('0x1c')][_0x4bf7('0x1d')]===undefined?!![]:![]:!![]})[_0x4bf7('0xf')](function(_0x30e6fb){logger[_0x4bf7('0x10')](_0x4bf7('0x19'),_0x3583fc);logger[_0x4bf7('0x13')](_0x4bf7('0x19'),_0x3583fc,JSON[_0x4bf7('0x15')](_0x30e6fb));_0x44fbed(_0x30e6fb);})[_0x4bf7('0x18')](function(_0x5323c6){logger[_0x4bf7('0x16')](_0x4bf7('0x19'),_0x5323c6['message'],_0x3583fc);_0x517c0d(_0x25f91b[_0x4bf7('0x16')](0x1f4,_0x5323c6[_0x4bf7('0x17')]));});});};exports[_0x4bf7('0x1e')]=function(_0x43b325){var _0xd57135=this;return new Promise(function(_0x28c1fa,_0x37907e){return db[_0x4bf7('0x1a')][_0x4bf7('0x1f')](_0x43b325['body'],{'raw':_0x43b325[_0x4bf7('0x1c')]?_0x43b325['options'][_0x4bf7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43b325[_0x4bf7('0x1c')]?_0x43b325['options'][_0x4bf7('0x20')]||null:null,'attributes':_0x43b325[_0x4bf7('0x1c')]?_0x43b325[_0x4bf7('0x1c')][_0x4bf7('0x21')]||null:null,'limit':_0x43b325[_0x4bf7('0x1c')]?_0x43b325['options']['limit']||null:null})['then'](function(_0x2ae7d7){logger['info'](_0x4bf7('0x1e'),_0x43b325);logger[_0x4bf7('0x13')](_0x4bf7('0x1e'),_0x43b325,JSON[_0x4bf7('0x15')](_0x2ae7d7));_0x28c1fa(_0x2ae7d7);})['catch'](function(_0x4bf10f){logger[_0x4bf7('0x16')]('UpdateFaxMessage',_0x4bf10f[_0x4bf7('0x17')],_0x43b325);_0x37907e(_0xd57135[_0x4bf7('0x16')](0x1f4,_0x4bf10f[_0x4bf7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 840e923..5c0a071 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(_0x4e783c,_0x51a362){var _0x2fbd6d=function(_0x513e00){while(--_0x513e00){_0x4e783c['push'](_0x4e783c['shift']());}};_0x2fbd6d(++_0x51a362);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c5f9193..ba206e3 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 _0xfad0=['exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','/:id/reject','destroy'];(function(_0x400e30,_0x19c954){var _0x407f9d=function(_0x26d5d5){while(--_0x26d5d5){_0x400e30['push'](_0x400e30['shift']());}};_0x407f9d(++_0x19c954);}(_0xfad0,0xb0));var _0x0fad=function(_0x2c640c,_0x1bcaf6){_0x2c640c=_0x2c640c-0x0;var _0x562ff0=_0xfad0[_0x2c640c];return _0x562ff0;};'use strict';var multer=require('multer');var util=require(_0x0fad('0x0'));var path=require('path');var timeout=require(_0x0fad('0x1'));var express=require(_0x0fad('0x2'));var router=express['Router']();var auth=require(_0x0fad('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0fad('0x4'));var controller=require(_0x0fad('0x5'));router[_0x0fad('0x6')]('/',auth[_0x0fad('0x7')](),controller[_0x0fad('0x8')]);router[_0x0fad('0x6')](_0x0fad('0x9'),auth[_0x0fad('0x7')](),controller[_0x0fad('0xa')]);router[_0x0fad('0x6')](_0x0fad('0xb'),auth[_0x0fad('0x7')](),controller[_0x0fad('0xc')]);router[_0x0fad('0x6')](_0x0fad('0xd'),auth[_0x0fad('0x7')](),controller['download']);router[_0x0fad('0xe')]('/',auth['isAuthenticated'](),interaction[_0x0fad('0xf')](_0x0fad('0x10'),_0x0fad('0x11')),controller[_0x0fad('0x12')]);router[_0x0fad('0x13')](_0x0fad('0xb'),auth[_0x0fad('0x7')](),controller['update']);router[_0x0fad('0x13')](_0x0fad('0x14'),auth['isAuthenticated'](),controller[_0x0fad('0x15')]);router[_0x0fad('0x13')](_0x0fad('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth[_0x0fad('0x7')](),controller[_0x0fad('0x17')]);module[_0x0fad('0x18')]=router; \ No newline at end of file +var _0xa4de=['reject','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','/:id/download','download','post','tracked','faxmessage:create','create','/:id','update','/:id/accept','accept','put','/:id/reject'];(function(_0x1ac79b,_0x218275){var _0x10db60=function(_0x660758){while(--_0x660758){_0x1ac79b['push'](_0x1ac79b['shift']());}};_0x10db60(++_0x218275);}(_0xa4de,0x17d));var _0xea4d=function(_0x4e7d17,_0x5d75de){_0x4e7d17=_0x4e7d17-0x0;var _0x7d8a4=_0xa4de[_0x4e7d17];return _0x7d8a4;};'use strict';var multer=require(_0xea4d('0x0'));var util=require('util');var path=require(_0xea4d('0x1'));var timeout=require(_0xea4d('0x2'));var express=require(_0xea4d('0x3'));var router=express[_0xea4d('0x4')]();var auth=require(_0xea4d('0x5'));var interaction=require(_0xea4d('0x6'));var config=require(_0xea4d('0x7'));var controller=require(_0xea4d('0x8'));router[_0xea4d('0x9')]('/',auth[_0xea4d('0xa')](),controller['index']);router[_0xea4d('0x9')]('/describe',auth[_0xea4d('0xa')](),controller[_0xea4d('0xb')]);router[_0xea4d('0x9')]('/:id',auth[_0xea4d('0xa')](),controller['show']);router[_0xea4d('0x9')](_0xea4d('0xc'),auth['isAuthenticated'](),controller[_0xea4d('0xd')]);router[_0xea4d('0xe')]('/',auth[_0xea4d('0xa')](),interaction[_0xea4d('0xf')]('fax',_0xea4d('0x10')),controller[_0xea4d('0x11')]);router['put'](_0xea4d('0x12'),auth[_0xea4d('0xa')](),controller[_0xea4d('0x13')]);router['put'](_0xea4d('0x14'),auth[_0xea4d('0xa')](),controller[_0xea4d('0x15')]);router[_0xea4d('0x16')](_0xea4d('0x17'),auth['isAuthenticated'](),controller[_0xea4d('0x18')]);router['delete'](_0xea4d('0x12'),auth[_0xea4d('0xa')](),controller[_0xea4d('0x19')]);module[_0xea4d('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 1c6eef7..ac04012 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 _0x0c4c=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x354886,_0x54368c){var _0xd5e102=function(_0xad7513){while(--_0xad7513){_0x354886['push'](_0x354886['shift']());}};_0xd5e102(++_0x54368c);}(_0x0c4c,0x140));var _0xc0c4=function(_0x30fb22,_0x15f3cd){_0x30fb22=_0x30fb22-0x0;var _0x58bbe4=_0x0c4c[_0x30fb22];return _0x58bbe4;};'use strict';var Sequelize=require('sequelize');module[_0xc0c4('0x0')]={'name':{'type':Sequelize[_0xc0c4('0x1')],'unique':_0xc0c4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc0c4('0x1')]},'timeout':{'type':Sequelize[_0xc0c4('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc0c4('0x4')](_0xc0c4('0x5'),_0xc0c4('0x6'),_0xc0c4('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc0c4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x67bf=['roundrobin','sequelize','STRING','name','INTEGER','rrmemory','beepall'];(function(_0x2e3fb5,_0x3fba9e){var _0x52efcd=function(_0x2a82a0){while(--_0x2a82a0){_0x2e3fb5['push'](_0x2e3fb5['shift']());}};_0x52efcd(++_0x3fba9e);}(_0x67bf,0xe1));var _0xf67b=function(_0x81d9af,_0x11ae9b){_0x81d9af=_0x81d9af-0x0;var _0x4753c9=_0x67bf[_0x81d9af];return _0x4753c9;};'use strict';var Sequelize=require(_0xf67b('0x0'));module['exports']={'name':{'type':Sequelize[_0xf67b('0x1')],'unique':_0xf67b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf67b('0x1')]},'timeout':{'type':Sequelize[_0xf67b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf67b('0x4'),_0xf67b('0x5'),_0xf67b('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xf67b('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 38b43d4..4a9a94b 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 _0x2c91=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','include','rows','catch','show','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','describe','getMembers','UserFaxQueue','pick','User','UserId','faxPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','userFaxQueue:save','removeTeams','findAll','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','every','all','compact','value','transaction','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','omit','spread','isArray','findOne','getAgents','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','end','sendStatus','error','name','send','index','map','FaxQueue','type','key','model','query','keys'];(function(_0xb6bddf,_0x2372c3){var _0x1a7749=function(_0x3e020e){while(--_0x3e020e){_0xb6bddf['push'](_0xb6bddf['shift']());}};_0x1a7749(++_0x2372c3);}(_0x2c91,0x158));var _0x12c9=function(_0x9f6f37,_0x23ebc8){_0x9f6f37=_0x9f6f37-0x0;var _0x26b867=_0x2c91[_0x9f6f37];return _0x26b867;};'use strict';var pdf=require(_0x12c9('0x0'));var emlformat=require(_0x12c9('0x1'));var rimraf=require(_0x12c9('0x2'));var zipdir=require(_0x12c9('0x3'));var jsonpatch=require(_0x12c9('0x4'));var rp=require(_0x12c9('0x5'));var moment=require(_0x12c9('0x6'));var BPromise=require(_0x12c9('0x7'));var Mustache=require('mustache');var util=require(_0x12c9('0x8'));var path=require(_0x12c9('0x9'));var sox=require(_0x12c9('0xa'));var csv=require(_0x12c9('0xb'));var ejs=require(_0x12c9('0xc'));var fs=require('fs');var _=require(_0x12c9('0xd'));var squel=require(_0x12c9('0xe'));var crypto=require('crypto');var jsforce=require(_0x12c9('0xf'));var deskjs=require(_0x12c9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x12c9('0x11'));var Papa=require(_0x12c9('0x12'));var Redis=require('ioredis');var authService=require(_0x12c9('0x13'));var qs=require(_0x12c9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12c9('0x15'));var logger=require(_0x12c9('0x16'))('api');var utils=require(_0x12c9('0x17'));var config=require(_0x12c9('0x18'));var db=require(_0x12c9('0x19'))['db'];config[_0x12c9('0x1a')]=_[_0x12c9('0x1b')](config[_0x12c9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x12c9('0x1c'))(new Redis(config[_0x12c9('0x1a')]));require(_0x12c9('0x1d'))['register'](socket);function respondWithStatusCode(_0x4bf1a9,_0x490854){_0x490854=_0x490854||0xcc;return function(_0x4e20b0){if(_0x4e20b0){return _0x4bf1a9['sendStatus'](_0x490854);}return _0x4bf1a9[_0x12c9('0x1e')](_0x490854)['end']();};}function respondWithResult(_0x3a83b4,_0x4460d5){_0x4460d5=_0x4460d5||0xc8;return function(_0x1d7716){if(_0x1d7716){return _0x3a83b4[_0x12c9('0x1e')](_0x4460d5)[_0x12c9('0x1f')](_0x1d7716);}};}function respondWithFilteredResult(_0x529a6a,_0x2f704c){return function(_0x34d219){if(_0x34d219){var _0x1890d4=_0x34d219[_0x12c9('0x20')],_0x38c12e=_0x2f704c[_0x12c9('0x21')],_0x44e9af=_0x2f704c['offset']+_0x2f704c[_0x12c9('0x22')],_0x1def14;if(_0x44e9af>=_0x1890d4){_0x44e9af=_0x1890d4;_0x1def14=0xc8;}else{_0x1def14=0xce;}_0x529a6a['status'](_0x1def14);return _0x529a6a[_0x12c9('0x23')](_0x12c9('0x24'),_0x38c12e+'-'+_0x44e9af+'/'+_0x1890d4)[_0x12c9('0x1f')](_0x34d219);}return null;};}function patchUpdates(_0x17675e){return function(_0x10c9ec){try{jsonpatch['apply'](_0x10c9ec,_0x17675e,!![]);}catch(_0x285cb7){return BPromise[_0x12c9('0x25')](_0x285cb7);}return _0x10c9ec[_0x12c9('0x26')]();};}function saveUpdates(_0x36d400,_0x370126){return function(_0x21a6e7){if(_0x21a6e7){return _0x21a6e7[_0x12c9('0x27')](_0x36d400)[_0x12c9('0x28')](function(_0x210a77){return _0x210a77;});}return null;};}function removeEntity(_0x2eecec,_0x905751){return function(_0x58c25e){if(_0x58c25e){return _0x58c25e[_0x12c9('0x29')]()[_0x12c9('0x28')](function(){var _0x1909cc=_0x58c25e[_0x12c9('0x2a')]({'plain':!![]});var _0x1f0dcd=_0x12c9('0x2b');return db[_0x12c9('0x2c')][_0x12c9('0x29')]({'where':{'type':_0x1f0dcd,'resourceId':_0x1909cc['id']}})[_0x12c9('0x28')](function(){return _0x58c25e;});})[_0x12c9('0x28')](function(){_0x2eecec[_0x12c9('0x1e')](0xcc)[_0x12c9('0x2d')]();});}};}function handleEntityNotFound(_0x447dec,_0x2224ce){return function(_0x415d2c){if(!_0x415d2c){_0x447dec[_0x12c9('0x2e')](0x194);}return _0x415d2c;};}function handleError(_0x248bff,_0xa53d40){_0xa53d40=_0xa53d40||0x1f4;return function(_0x9a8f1e){logger[_0x12c9('0x2f')](_0x9a8f1e['stack']);if(_0x9a8f1e[_0x12c9('0x30')]){delete _0x9a8f1e[_0x12c9('0x30')];}_0x248bff[_0x12c9('0x1e')](_0xa53d40)[_0x12c9('0x31')](_0x9a8f1e);};}exports[_0x12c9('0x32')]=function(_0x5138cc,_0x98660f){var _0x59ba1a={},_0x179def={},_0x35a37d={'count':0x0,'rows':[]};var _0x32a344=_[_0x12c9('0x33')](db[_0x12c9('0x34')]['rawAttributes'],function(_0x238239){return{'name':_0x238239['fieldName'],'type':_0x238239[_0x12c9('0x35')][_0x12c9('0x36')]};});_0x179def[_0x12c9('0x37')]=_[_0x12c9('0x33')](_0x32a344,_0x12c9('0x30'));_0x179def[_0x12c9('0x38')]=_[_0x12c9('0x39')](_0x5138cc[_0x12c9('0x38')]);_0x179def[_0x12c9('0x3a')]=_['intersection'](_0x179def['model'],_0x179def[_0x12c9('0x38')]);_0x59ba1a[_0x12c9('0x3b')]=_[_0x12c9('0x3c')](_0x179def[_0x12c9('0x37')],qs[_0x12c9('0x3d')](_0x5138cc[_0x12c9('0x38')][_0x12c9('0x3d')]));_0x59ba1a['attributes']=_0x59ba1a[_0x12c9('0x3b')][_0x12c9('0x3e')]?_0x59ba1a[_0x12c9('0x3b')]:_0x179def['model'];if(!_0x5138cc[_0x12c9('0x38')][_0x12c9('0x3f')]('nolimit')){_0x59ba1a[_0x12c9('0x22')]=qs[_0x12c9('0x22')](_0x5138cc[_0x12c9('0x38')]['limit']);_0x59ba1a[_0x12c9('0x21')]=qs[_0x12c9('0x21')](_0x5138cc[_0x12c9('0x38')][_0x12c9('0x21')]);}_0x59ba1a[_0x12c9('0x40')]=qs[_0x12c9('0x41')](_0x5138cc[_0x12c9('0x38')][_0x12c9('0x41')]);_0x59ba1a[_0x12c9('0x42')]=qs[_0x12c9('0x3a')](_['pick'](_0x5138cc[_0x12c9('0x38')],_0x179def[_0x12c9('0x3a')]),_0x32a344);if(_0x5138cc[_0x12c9('0x38')][_0x12c9('0x43')]){_0x59ba1a[_0x12c9('0x42')]=_['merge'](_0x59ba1a[_0x12c9('0x42')],{'$or':_['map'](_0x32a344,function(_0x372ae3){if(_0x372ae3[_0x12c9('0x35')]!==_0x12c9('0x44')){var _0x49f803={};_0x49f803[_0x372ae3['name']]={'$like':'%'+_0x5138cc[_0x12c9('0x38')][_0x12c9('0x43')]+'%'};return _0x49f803;}})});}_0x59ba1a=_[_0x12c9('0x45')]({},_0x59ba1a,_0x5138cc[_0x12c9('0x46')]);var _0x168eaa={'where':_0x59ba1a['where']};return db[_0x12c9('0x34')][_0x12c9('0x20')](_0x168eaa)['then'](function(_0x18b73a){_0x35a37d[_0x12c9('0x20')]=_0x18b73a;if(_0x5138cc[_0x12c9('0x38')]['includeAll']){_0x59ba1a[_0x12c9('0x47')]=[{'all':!![]}];}return db[_0x12c9('0x34')]['findAll'](_0x59ba1a);})[_0x12c9('0x28')](function(_0x14e404){_0x35a37d[_0x12c9('0x48')]=_0x14e404;return _0x35a37d;})[_0x12c9('0x28')](respondWithFilteredResult(_0x98660f,_0x59ba1a))[_0x12c9('0x49')](handleError(_0x98660f,null));};exports[_0x12c9('0x4a')]=function(_0x11cbe8,_0x5a2f0f){var _0x1468d7={'raw':!![],'where':{'id':_0x11cbe8['params']['id']}},_0x112413={};_0x112413[_0x12c9('0x37')]=_[_0x12c9('0x39')](db[_0x12c9('0x34')][_0x12c9('0x4b')]);_0x112413[_0x12c9('0x38')]=_[_0x12c9('0x39')](_0x11cbe8[_0x12c9('0x38')]);_0x112413['filters']=_[_0x12c9('0x3c')](_0x112413['model'],_0x112413[_0x12c9('0x38')]);_0x1468d7['attributes']=_['intersection'](_0x112413[_0x12c9('0x37')],qs[_0x12c9('0x3d')](_0x11cbe8['query'][_0x12c9('0x3d')]));_0x1468d7[_0x12c9('0x3b')]=_0x1468d7[_0x12c9('0x3b')][_0x12c9('0x3e')]?_0x1468d7[_0x12c9('0x3b')]:_0x112413[_0x12c9('0x37')];if(_0x11cbe8[_0x12c9('0x38')]['includeAll']){_0x1468d7[_0x12c9('0x47')]=[{'all':!![]}];}_0x1468d7=_[_0x12c9('0x45')]({},_0x1468d7,_0x11cbe8[_0x12c9('0x46')]);return db[_0x12c9('0x34')]['find'](_0x1468d7)[_0x12c9('0x28')](handleEntityNotFound(_0x5a2f0f,null))['then'](respondWithResult(_0x5a2f0f,null))[_0x12c9('0x49')](handleError(_0x5a2f0f,null));};exports[_0x12c9('0x4c')]=function(_0x3e312a,_0x1dcdea){return db['FaxQueue'][_0x12c9('0x4c')](_0x3e312a[_0x12c9('0x4d')],{})[_0x12c9('0x28')](function(_0x58d2ff){var _0xb525a=_0x3e312a['user'][_0x12c9('0x2a')]({'plain':!![]});if(!_0xb525a)throw new Error(_0x12c9('0x4e'));if(_0xb525a['role']==='user'){var _0x59fc17=_0x58d2ff[_0x12c9('0x2a')]({'plain':!![]});var _0xe80b04=_0x12c9('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0xe80b04,'userProfileId':_0xb525a[_0x12c9('0x4f')]},'raw':!![]})[_0x12c9('0x28')](function(_0x5b8695){if(_0x5b8695&&_0x5b8695[_0x12c9('0x50')]===0x0){return db[_0x12c9('0x2c')][_0x12c9('0x4c')]({'name':_0x59fc17[_0x12c9('0x30')],'resourceId':_0x59fc17['id'],'type':_0x5b8695[_0x12c9('0x30')],'sectionId':_0x5b8695['id']},{})[_0x12c9('0x28')](function(){return _0x58d2ff;});}else{return _0x58d2ff;}})[_0x12c9('0x49')](function(_0x434ab3){logger['error'](_0x12c9('0x51'),_0x434ab3);throw _0x434ab3;});}return _0x58d2ff;})[_0x12c9('0x28')](respondWithResult(_0x1dcdea,0xc9))[_0x12c9('0x49')](handleError(_0x1dcdea,null));};exports[_0x12c9('0x27')]=function(_0x387bd6,_0x5ac215){if(_0x387bd6['body']['id']){delete _0x387bd6[_0x12c9('0x4d')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x387bd6[_0x12c9('0x52')]['id']}})[_0x12c9('0x28')](handleEntityNotFound(_0x5ac215,null))['then'](saveUpdates(_0x387bd6[_0x12c9('0x4d')],null))[_0x12c9('0x28')](respondWithResult(_0x5ac215,null))[_0x12c9('0x49')](handleError(_0x5ac215,null));};exports[_0x12c9('0x29')]=function(_0x3485d7,_0x3c3ba4){return db[_0x12c9('0x34')][_0x12c9('0x53')]({'where':{'id':_0x3485d7[_0x12c9('0x52')]['id']}})[_0x12c9('0x28')](handleEntityNotFound(_0x3c3ba4,null))[_0x12c9('0x28')](removeEntity(_0x3c3ba4,null))[_0x12c9('0x49')](handleError(_0x3c3ba4,null));};exports[_0x12c9('0x54')]=function(_0x315aea,_0x422411){return db[_0x12c9('0x34')]['describe']()[_0x12c9('0x28')](respondWithResult(_0x422411,null))[_0x12c9('0x49')](handleError(_0x422411,null));};exports[_0x12c9('0x55')]=function(_0x5866f5,_0x453982,_0x200a6b){var _0x2c4065={'raw':!![],'where':{}},_0xae69aa={},_0x3060f9;return db[_0x12c9('0x34')]['findOne']({'where':{'id':_0x5866f5[_0x12c9('0x52')]['id']}})['then'](handleEntityNotFound(_0x453982,null))[_0x12c9('0x28')](function(_0x38f6e7){if(_0x38f6e7){_0x3060f9=_0x38f6e7[_0x12c9('0x2a')]({'plain':!![]});_0xae69aa[_0x12c9('0x37')]=_['keys'](db[_0x12c9('0x56')][_0x12c9('0x4b')]);_0xae69aa[_0x12c9('0x38')]=_[_0x12c9('0x39')](_0x5866f5['query']);_0xae69aa['filters']=_['intersection'](_0xae69aa[_0x12c9('0x37')],_0xae69aa[_0x12c9('0x38')]);_0x2c4065[_0x12c9('0x3b')]=_[_0x12c9('0x3c')](_0xae69aa[_0x12c9('0x37')],qs[_0x12c9('0x3d')](_0x5866f5['query'][_0x12c9('0x3d')]));_0x2c4065[_0x12c9('0x3b')]=_0x2c4065[_0x12c9('0x3b')][_0x12c9('0x3e')]?_0x2c4065[_0x12c9('0x3b')]:_0xae69aa[_0x12c9('0x37')];if(!_0x5866f5[_0x12c9('0x38')][_0x12c9('0x3f')]('nolimit')){_0x2c4065[_0x12c9('0x22')]=qs[_0x12c9('0x22')](_0x5866f5[_0x12c9('0x38')][_0x12c9('0x22')]);_0x2c4065[_0x12c9('0x21')]=qs[_0x12c9('0x21')](_0x5866f5[_0x12c9('0x38')]['offset']);}_0x2c4065[_0x12c9('0x40')]=qs[_0x12c9('0x41')](_0x5866f5[_0x12c9('0x38')][_0x12c9('0x41')]);_0x2c4065[_0x12c9('0x42')]=qs[_0x12c9('0x3a')](_[_0x12c9('0x57')](_0x5866f5['query'],_0xae69aa[_0x12c9('0x3a')]));_0x2c4065['where']['FaxQueueId']=_0x38f6e7['id'];if(_0x5866f5[_0x12c9('0x38')][_0x12c9('0x43')]){_0x2c4065['where']=_[_0x12c9('0x45')](_0x2c4065['where'],{'$or':_[_0x12c9('0x33')](_0x2c4065[_0x12c9('0x3b')],function(_0x10cec1){var _0xe659f5={};_0xe659f5[_0x10cec1]={'$like':'%'+_0x5866f5['query'][_0x12c9('0x43')]+'%'};return _0xe659f5;})});}_0x2c4065=_[_0x12c9('0x45')]({},_0x2c4065,_0x5866f5[_0x12c9('0x46')]);return db[_0x12c9('0x56')]['findAll'](_0x2c4065);}})[_0x12c9('0x28')](function(_0x1dd13d){if(_0x1dd13d){return db[_0x12c9('0x58')]['findAndCountAll']({'where':{'id':_[_0x12c9('0x33')](_0x1dd13d,_0x12c9('0x59')),'role':'agent'},'attributes':['id',_0x12c9('0x30'),_0x12c9('0x5a'),_0x12c9('0x5b'),_0x12c9('0x5c')]});}})[_0x12c9('0x28')](function(_0x5e2bcb){if(_0x5e2bcb){return{'count':_0x5e2bcb[_0x12c9('0x20')],'rows':_['map'](_0x5e2bcb['rows'],function(_0x1440e2){return{'membername':_0x1440e2[_0x12c9('0x30')],'UserId':_0x1440e2['id'],'queue_name':_0x3060f9['name'],'FaxQueueId':_0x3060f9['id'],'interface':util[_0x12c9('0x5d')]('%s/%s',_0x12c9('0x5e'),_0x1440e2[_0x12c9('0x30')]),'penalty':0x0,'paused':_0x1440e2['faxPause'],'createdAt':_0x1440e2[_0x12c9('0x5c')],'updatedAt':_0x1440e2[_0x12c9('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x12c9('0x28')](respondWithFilteredResult(_0x453982,_0x2c4065))['catch'](handleError(_0x453982,null));};exports[_0x12c9('0x5f')]=function(_0x49fec9,_0x3dec46,_0x4a27d7){var _0x2fd170={};var _0x262da0={};var _0x2857ca;var _0x13bea6;return db[_0x12c9('0x34')]['findOne']({'where':{'id':_0x49fec9[_0x12c9('0x52')]['id']}})[_0x12c9('0x28')](handleEntityNotFound(_0x3dec46,null))['then'](function(_0x4dd3d1){if(_0x4dd3d1){_0x2857ca=_0x4dd3d1;_0x262da0[_0x12c9('0x37')]=_[_0x12c9('0x39')](db[_0x12c9('0x60')][_0x12c9('0x4b')]);_0x262da0[_0x12c9('0x38')]=_[_0x12c9('0x39')](_0x49fec9[_0x12c9('0x38')]);_0x262da0[_0x12c9('0x3a')]=_[_0x12c9('0x3c')](_0x262da0['model'],_0x262da0[_0x12c9('0x38')]);_0x2fd170[_0x12c9('0x3b')]=_[_0x12c9('0x3c')](_0x262da0['model'],qs['fields'](_0x49fec9['query'][_0x12c9('0x3d')]));_0x2fd170[_0x12c9('0x3b')]=_0x2fd170[_0x12c9('0x3b')]['length']?_0x2fd170[_0x12c9('0x3b')]:_0x262da0['model'];_0x2fd170[_0x12c9('0x40')]=qs[_0x12c9('0x41')](_0x49fec9[_0x12c9('0x38')][_0x12c9('0x41')]);_0x2fd170[_0x12c9('0x42')]=qs['filters'](_[_0x12c9('0x57')](_0x49fec9[_0x12c9('0x38')],_0x262da0['filters']));if(_0x49fec9[_0x12c9('0x38')][_0x12c9('0x43')]){_0x2fd170[_0x12c9('0x42')]=_[_0x12c9('0x45')](_0x2fd170[_0x12c9('0x42')],{'$or':_[_0x12c9('0x33')](_0x2fd170[_0x12c9('0x3b')],function(_0x4b8e24){var _0x4d33b0={};_0x4d33b0[_0x4b8e24]={'$like':'%'+_0x49fec9['query'][_0x12c9('0x43')]+'%'};return _0x4d33b0;})});}_0x2fd170=_['merge']({},_0x2fd170,_0x49fec9[_0x12c9('0x46')]);return _0x2857ca['getTeams'](_0x2fd170);}})['then'](function(_0x10e74c){if(_0x10e74c){_0x13bea6=_0x10e74c['length'];if(!_0x49fec9[_0x12c9('0x38')][_0x12c9('0x3f')]('nolimit')){_0x2fd170[_0x12c9('0x22')]=qs[_0x12c9('0x22')](_0x49fec9[_0x12c9('0x38')][_0x12c9('0x22')]);_0x2fd170[_0x12c9('0x21')]=qs[_0x12c9('0x21')](_0x49fec9[_0x12c9('0x38')][_0x12c9('0x21')]);}return _0x2857ca[_0x12c9('0x5f')](_0x2fd170);}})['then'](function(_0xafd2d4){if(_0xafd2d4){return _0xafd2d4?{'count':_0x13bea6,'rows':_0xafd2d4}:null;}})[_0x12c9('0x28')](respondWithResult(_0x3dec46,null))[_0x12c9('0x49')](handleError(_0x3dec46,null));};exports[_0x12c9('0x61')]=function(_0x4c109a,_0x46418d,_0x37b072){var _0x3abfd8=_0x4c109a[_0x12c9('0x4d')][_0x12c9('0x62')];return db[_0x12c9('0x60')]['findAll']({'where':{'id':_0x3abfd8},'attributes':['id'],'include':[{'model':db[_0x12c9('0x58')],'as':_0x12c9('0x63'),'attributes':['id',_0x12c9('0x30'),_0x12c9('0x64'),'voicePause',_0x12c9('0x65')],'raw':!![]}]})[_0x12c9('0x28')](function(_0xf05b26){if(_0xf05b26){var _0x19176a=_[_0x12c9('0x66')](_0xf05b26,function(_0x3d4f84){var _0x4c2634=_0x3d4f84[_0x12c9('0x2a')]({'plain':!![]});return _0x4c2634[_0x12c9('0x63')];});return db[_0x12c9('0x34')][_0x12c9('0x53')]({'where':{'id':_0x4c109a[_0x12c9('0x52')]['id']}})['then'](function(_0x285082){return db['sequelize']['transaction'](function(_0x34ad9a){return _0x285082[_0x12c9('0x61')](_0x3abfd8,{'transaction':_0x34ad9a})[_0x12c9('0x28')](function(){return BPromise[_0x12c9('0x67')](_0x19176a,function(_0x340c26){return db[_0x12c9('0x56')][_0x12c9('0x68')]({'where':{'UserId':_0x340c26['id'],'FaxQueueId':_0x4c109a['params']['id']},'transaction':_0x34ad9a});});})['then'](function(){_0x19176a['forEach'](function(_0x48d28d){socket['emit'](_0x12c9('0x69'),{'UserId':_0x48d28d['id'],'FaxQueueId':_0x285082['id']});});});});});}})[_0x12c9('0x28')](respondWithStatusCode(_0x46418d,null))[_0x12c9('0x49')](handleError(_0x46418d,null));};exports[_0x12c9('0x6a')]=function(_0x49b64a,_0x4d6c9f,_0x191487){return db['Team'][_0x12c9('0x6b')]({'where':{'id':_0x49b64a[_0x12c9('0x38')][_0x12c9('0x62')]},'attributes':['id'],'include':[{'model':db[_0x12c9('0x58')],'as':_0x12c9('0x63'),'attributes':['id'],'raw':!![]}]})[_0x12c9('0x28')](handleEntityNotFound(_0x4d6c9f,null))[_0x12c9('0x28')](function(_0x116022){var _0xd521fe=_['map'](_0x116022,'id');var _0x135499=[];var _0x41bde0=[];var _0x3548b1=squel['select']();_0x3548b1['field'](_0x12c9('0x6c'))[_0x12c9('0x6d')](_0x12c9('0x6e'),'tq')['join'](_0x12c9('0x6f'),'ut',_0x12c9('0x70'))[_0x12c9('0x42')](_0x12c9('0x71'),_0x49b64a[_0x12c9('0x52')]['id']);for(var _0x749f4a=0x0;_0x749f4a<_0x116022[_0x12c9('0x3e')];_0x749f4a+=0x1){let _0x4b8eb9=_0x116022[_0x749f4a];for(var _0x37182e=0x0;_0x37182e<_0x4b8eb9[_0x12c9('0x63')][_0x12c9('0x3e')];_0x37182e+=0x1){let _0x1c5bec=_0x4b8eb9[_0x12c9('0x63')][_0x37182e];var _0x34b989=_0x3548b1[_0x12c9('0x72')]();_0x34b989['where'](_0x12c9('0x73'),_0x1c5bec['id']);_0x41bde0[_0x12c9('0x74')](db['sequelize'][_0x12c9('0x38')](_0x34b989['toString'](),{'type':db[_0x12c9('0x75')]['QueryTypes']['SELECT']})[_0x12c9('0x28')](function(_0x3dd37d){if(_0x3dd37d[_0x12c9('0x3e')]===0x1){return _0x1c5bec['id'];}else{var _0x2fe583=_[_0x12c9('0x76')](_[_0x12c9('0x33')](_0x3dd37d,'TeamId'),function(_0x40ae9b){return _['includes'](_0xd521fe,_0x40ae9b);});if(_0x2fe583){return _0x1c5bec['id'];}}}));}}return BPromise[_0x12c9('0x77')](_0x41bde0)[_0x12c9('0x28')](function(_0x3ec38e){_0x135499=_(_0x135499)['union'](_0x3ec38e)[_0x12c9('0x78')]()[_0x12c9('0x79')]();return db[_0x12c9('0x34')][_0x12c9('0x53')]({'where':{'id':_0x49b64a[_0x12c9('0x52')]['id']}})['then'](function(_0x5f1915){return db['sequelize'][_0x12c9('0x7a')](function(_0x2bc94b){return _0x5f1915[_0x12c9('0x6a')](_0x49b64a[_0x12c9('0x38')]['ids'],{'transaction':_0x2bc94b})[_0x12c9('0x28')](function(){if(!_[_0x12c9('0x7b')](_0x135499)){return _0x5f1915[_0x12c9('0x7c')](_0x135499,{'transaction':_0x2bc94b});}})[_0x12c9('0x28')](function(){_0x135499[_0x12c9('0x7d')](function(_0x535d42){socket[_0x12c9('0x7e')](_0x12c9('0x7f'),{'UserId':_0x535d42,'FaxQueueId':_0x5f1915['id']});});});});});});})['then'](respondWithStatusCode(_0x4d6c9f,null))[_0x12c9('0x49')](handleError(_0x4d6c9f,null));};exports['addAgents']=function(_0x29ea35,_0x3d1e62,_0x362a6f){return db[_0x12c9('0x34')][_0x12c9('0x53')]({'where':{'id':_0x29ea35[_0x12c9('0x52')]['id']}})[_0x12c9('0x28')](handleEntityNotFound(_0x3d1e62,null))[_0x12c9('0x28')](function(_0x184300){if(_0x184300){return _0x184300['addAgents'](_0x29ea35[_0x12c9('0x4d')]['ids'],_[_0x12c9('0x80')](_0x29ea35['body'],[_0x12c9('0x62'),'id'])||{})[_0x12c9('0x81')](function(_0x3d8695){for(var _0x365b8d=0x0;_0x365b8d<_0x29ea35[_0x12c9('0x4d')][_0x12c9('0x62')][_0x12c9('0x3e')];_0x365b8d+=0x1){socket[_0x12c9('0x7e')](_0x12c9('0x69'),{'UserId':_0x29ea35[_0x12c9('0x4d')][_0x12c9('0x62')][_0x365b8d],'FaxQueueId':_0x29ea35[_0x12c9('0x52')]['id']});}return _0x3d8695;});}})[_0x12c9('0x28')](respondWithResult(_0x3d1e62,null))['catch'](handleError(_0x3d1e62,null));};exports[_0x12c9('0x7c')]=function(_0x21a8fb,_0x4629a1,_0x442587){return db[_0x12c9('0x34')][_0x12c9('0x53')]({'where':{'id':_0x21a8fb[_0x12c9('0x52')]['id']}})[_0x12c9('0x28')](handleEntityNotFound(_0x4629a1,null))[_0x12c9('0x28')](function(_0x136454){if(_0x136454){return _0x136454[_0x12c9('0x7c')](_0x21a8fb[_0x12c9('0x38')][_0x12c9('0x62')])[_0x12c9('0x28')](function(){if(_[_0x12c9('0x82')](_0x21a8fb[_0x12c9('0x38')][_0x12c9('0x62')])){for(var _0x3931e6=0x0;_0x3931e6<_0x21a8fb['query'][_0x12c9('0x62')]['length'];_0x3931e6+=0x1){socket[_0x12c9('0x7e')](_0x12c9('0x7f'),{'UserId':Number(_0x21a8fb['query']['ids'][_0x3931e6]),'FaxQueueId':Number(_0x21a8fb['params']['id'])});}}else{socket[_0x12c9('0x7e')](_0x12c9('0x7f'),{'UserId':Number(_0x21a8fb['query'][_0x12c9('0x62')]),'FaxQueueId':Number(_0x21a8fb[_0x12c9('0x52')]['id'])});}});}})[_0x12c9('0x28')](respondWithStatusCode(_0x4629a1,null))['catch'](handleError(_0x4629a1,null));};exports['getAgents']=function(_0x385ec7,_0x4a937f,_0x20a1e5){var _0xe9b6af={};var _0x18082e={};var _0x5b19ed;var _0x40ec72;return db['FaxQueue'][_0x12c9('0x83')]({'where':{'id':_0x385ec7['params']['id']}})['then'](handleEntityNotFound(_0x4a937f,null))[_0x12c9('0x28')](function(_0x332d95){if(_0x332d95){_0x5b19ed=_0x332d95;_0x18082e['model']=_[_0x12c9('0x39')](db[_0x12c9('0x58')][_0x12c9('0x4b')]);_0x18082e[_0x12c9('0x38')]=_[_0x12c9('0x39')](_0x385ec7[_0x12c9('0x38')]);_0x18082e[_0x12c9('0x3a')]=_['intersection'](_0x18082e[_0x12c9('0x37')],_0x18082e[_0x12c9('0x38')]);_0xe9b6af[_0x12c9('0x3b')]=_[_0x12c9('0x3c')](_0x18082e[_0x12c9('0x37')],qs['fields'](_0x385ec7[_0x12c9('0x38')][_0x12c9('0x3d')]));_0xe9b6af['attributes']=_0xe9b6af[_0x12c9('0x3b')]['length']?_0xe9b6af['attributes']:_0x18082e[_0x12c9('0x37')];_0xe9b6af['order']=qs[_0x12c9('0x41')](_0x385ec7['query']['sort']);_0xe9b6af[_0x12c9('0x42')]=qs[_0x12c9('0x3a')](_['pick'](_0x385ec7['query'],_0x18082e['filters']));if(_0x385ec7[_0x12c9('0x38')][_0x12c9('0x43')]){_0xe9b6af[_0x12c9('0x42')]=_[_0x12c9('0x45')](_0xe9b6af[_0x12c9('0x42')],{'$or':_[_0x12c9('0x33')](_0xe9b6af[_0x12c9('0x3b')],function(_0x547456){var _0x1b3cff={};_0x1b3cff[_0x547456]={'$like':'%'+_0x385ec7[_0x12c9('0x38')][_0x12c9('0x43')]+'%'};return _0x1b3cff;})});}_0xe9b6af=_[_0x12c9('0x45')]({},_0xe9b6af,_0x385ec7['options']);return _0x5b19ed[_0x12c9('0x84')](_0xe9b6af);}})[_0x12c9('0x28')](function(_0x507039){if(_0x507039){_0x40ec72=_0x507039[_0x12c9('0x3e')];if(!_0x385ec7[_0x12c9('0x38')][_0x12c9('0x3f')](_0x12c9('0x85'))){_0xe9b6af[_0x12c9('0x22')]=qs[_0x12c9('0x22')](_0x385ec7[_0x12c9('0x38')][_0x12c9('0x22')]);_0xe9b6af['offset']=qs[_0x12c9('0x21')](_0x385ec7[_0x12c9('0x38')]['offset']);}return _0x5b19ed['getAgents'](_0xe9b6af);}})[_0x12c9('0x28')](function(_0x35c770){if(_0x35c770){return _0x35c770?{'count':_0x40ec72,'rows':_0x35c770}:null;}})[_0x12c9('0x28')](respondWithResult(_0x4a937f,null))[_0x12c9('0x49')](handleError(_0x4a937f,null));}; \ No newline at end of file +var _0x42f4=['register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','hasOwnProperty','pick','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','Team','getTeams','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','userFaxQueue:remove','omit','spread','userFaxQueue:save','removeAgents','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket'];(function(_0x3f6f82,_0x3e3b11){var _0x4593f7=function(_0x210c50){while(--_0x210c50){_0x3f6f82['push'](_0x3f6f82['shift']());}};_0x4593f7(++_0x3e3b11);}(_0x42f4,0x19d));var _0x442f=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x42f4[_0xccf869];return _0x21a9db;};'use strict';var pdf=require(_0x442f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x442f('0x1'));var zipdir=require(_0x442f('0x2'));var jsonpatch=require(_0x442f('0x3'));var rp=require(_0x442f('0x4'));var moment=require(_0x442f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x442f('0x6'));var sox=require(_0x442f('0x7'));var csv=require('to-csv');var ejs=require(_0x442f('0x8'));var fs=require('fs');var _=require(_0x442f('0x9'));var squel=require(_0x442f('0xa'));var crypto=require(_0x442f('0xb'));var jsforce=require(_0x442f('0xc'));var deskjs=require(_0x442f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x442f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x442f('0xf'));var as=require(_0x442f('0x10'));var hardwareService=require(_0x442f('0x11'));var logger=require(_0x442f('0x12'))(_0x442f('0x13'));var utils=require(_0x442f('0x14'));var config=require(_0x442f('0x15'));var db=require(_0x442f('0x16'))['db'];config[_0x442f('0x17')]=_[_0x442f('0x18')](config['redis'],{'host':_0x442f('0x19'),'port':0x18eb});var socket=require(_0x442f('0x1a'))(new Redis(config[_0x442f('0x17')]));require(_0x442f('0x1b'))[_0x442f('0x1c')](socket);function respondWithStatusCode(_0x3ce63d,_0x444fac){_0x444fac=_0x444fac||0xcc;return function(_0xdf1c8){if(_0xdf1c8){return _0x3ce63d[_0x442f('0x1d')](_0x444fac);}return _0x3ce63d[_0x442f('0x1e')](_0x444fac)[_0x442f('0x1f')]();};}function respondWithResult(_0x3d075a,_0x42fb1b){_0x42fb1b=_0x42fb1b||0xc8;return function(_0x2f0ff8){if(_0x2f0ff8){return _0x3d075a[_0x442f('0x1e')](_0x42fb1b)[_0x442f('0x20')](_0x2f0ff8);}};}function respondWithFilteredResult(_0x5ee97b,_0xa37e23){return function(_0x57bd3f){if(_0x57bd3f){var _0x54c48a=_0x57bd3f[_0x442f('0x21')],_0x5668e0=_0xa37e23[_0x442f('0x22')],_0x5e3dda=_0xa37e23[_0x442f('0x22')]+_0xa37e23[_0x442f('0x23')],_0x1b18fd;if(_0x5e3dda>=_0x54c48a){_0x5e3dda=_0x54c48a;_0x1b18fd=0xc8;}else{_0x1b18fd=0xce;}_0x5ee97b[_0x442f('0x1e')](_0x1b18fd);return _0x5ee97b['set'](_0x442f('0x24'),_0x5668e0+'-'+_0x5e3dda+'/'+_0x54c48a)['json'](_0x57bd3f);}return null;};}function patchUpdates(_0x364ada){return function(_0x20178f){try{jsonpatch[_0x442f('0x25')](_0x20178f,_0x364ada,!![]);}catch(_0x5f51b1){return BPromise[_0x442f('0x26')](_0x5f51b1);}return _0x20178f[_0x442f('0x27')]();};}function saveUpdates(_0x5dd019,_0x51c5e1){return function(_0x25a8f7){if(_0x25a8f7){return _0x25a8f7[_0x442f('0x28')](_0x5dd019)[_0x442f('0x29')](function(_0x4004e9){return _0x4004e9;});}return null;};}function removeEntity(_0x2a2ae7,_0x127b9c){return function(_0x31d445){if(_0x31d445){return _0x31d445[_0x442f('0x2a')]()[_0x442f('0x29')](function(){var _0x58bcc8=_0x31d445[_0x442f('0x2b')]({'plain':!![]});var _0x1b5b56=_0x442f('0x2c');return db[_0x442f('0x2d')]['destroy']({'where':{'type':_0x1b5b56,'resourceId':_0x58bcc8['id']}})[_0x442f('0x29')](function(){return _0x31d445;});})[_0x442f('0x29')](function(){_0x2a2ae7[_0x442f('0x1e')](0xcc)[_0x442f('0x1f')]();});}};}function handleEntityNotFound(_0x55c9dc,_0x5ee478){return function(_0x23fccf){if(!_0x23fccf){_0x55c9dc[_0x442f('0x1d')](0x194);}return _0x23fccf;};}function handleError(_0x541a19,_0x37da9d){_0x37da9d=_0x37da9d||0x1f4;return function(_0x5a272e){logger[_0x442f('0x2e')](_0x5a272e[_0x442f('0x2f')]);if(_0x5a272e[_0x442f('0x30')]){delete _0x5a272e['name'];}_0x541a19[_0x442f('0x1e')](_0x37da9d)[_0x442f('0x31')](_0x5a272e);};}exports[_0x442f('0x32')]=function(_0x422019,_0x3f8aa6){var _0x59d0d8={},_0x487491={},_0x3cc574={'count':0x0,'rows':[]};var _0x5436ba=_[_0x442f('0x33')](db[_0x442f('0x34')][_0x442f('0x35')],function(_0x1b9a60){return{'name':_0x1b9a60[_0x442f('0x36')],'type':_0x1b9a60[_0x442f('0x37')][_0x442f('0x38')]};});_0x487491[_0x442f('0x39')]=_[_0x442f('0x33')](_0x5436ba,'name');_0x487491[_0x442f('0x3a')]=_['keys'](_0x422019[_0x442f('0x3a')]);_0x487491[_0x442f('0x3b')]=_['intersection'](_0x487491[_0x442f('0x39')],_0x487491[_0x442f('0x3a')]);_0x59d0d8[_0x442f('0x3c')]=_[_0x442f('0x3d')](_0x487491[_0x442f('0x39')],qs['fields'](_0x422019[_0x442f('0x3a')][_0x442f('0x3e')]));_0x59d0d8[_0x442f('0x3c')]=_0x59d0d8[_0x442f('0x3c')][_0x442f('0x3f')]?_0x59d0d8['attributes']:_0x487491[_0x442f('0x39')];if(!_0x422019[_0x442f('0x3a')]['hasOwnProperty'](_0x442f('0x40'))){_0x59d0d8[_0x442f('0x23')]=qs['limit'](_0x422019[_0x442f('0x3a')][_0x442f('0x23')]);_0x59d0d8[_0x442f('0x22')]=qs[_0x442f('0x22')](_0x422019[_0x442f('0x3a')][_0x442f('0x22')]);}_0x59d0d8[_0x442f('0x41')]=qs['sort'](_0x422019[_0x442f('0x3a')][_0x442f('0x42')]);_0x59d0d8['where']=qs[_0x442f('0x3b')](_['pick'](_0x422019[_0x442f('0x3a')],_0x487491[_0x442f('0x3b')]),_0x5436ba);if(_0x422019[_0x442f('0x3a')]['filter']){_0x59d0d8['where']=_['merge'](_0x59d0d8[_0x442f('0x43')],{'$or':_[_0x442f('0x33')](_0x5436ba,function(_0x19c46a){if(_0x19c46a[_0x442f('0x37')]!==_0x442f('0x44')){var _0x2d3e39={};_0x2d3e39[_0x19c46a['name']]={'$like':'%'+_0x422019[_0x442f('0x3a')][_0x442f('0x45')]+'%'};return _0x2d3e39;}})});}_0x59d0d8=_[_0x442f('0x46')]({},_0x59d0d8,_0x422019[_0x442f('0x47')]);var _0x44754b={'where':_0x59d0d8['where']};return db['FaxQueue']['count'](_0x44754b)['then'](function(_0x38f6e0){_0x3cc574[_0x442f('0x21')]=_0x38f6e0;if(_0x422019['query'][_0x442f('0x48')]){_0x59d0d8[_0x442f('0x49')]=[{'all':!![]}];}return db['FaxQueue'][_0x442f('0x4a')](_0x59d0d8);})['then'](function(_0x103524){_0x3cc574[_0x442f('0x4b')]=_0x103524;return _0x3cc574;})['then'](respondWithFilteredResult(_0x3f8aa6,_0x59d0d8))[_0x442f('0x4c')](handleError(_0x3f8aa6,null));};exports[_0x442f('0x4d')]=function(_0x1f40e7,_0x381996){var _0xeefc91={'raw':!![],'where':{'id':_0x1f40e7[_0x442f('0x4e')]['id']}},_0x1a3e25={};_0x1a3e25['model']=_[_0x442f('0x4f')](db[_0x442f('0x34')][_0x442f('0x35')]);_0x1a3e25[_0x442f('0x3a')]=_[_0x442f('0x4f')](_0x1f40e7[_0x442f('0x3a')]);_0x1a3e25[_0x442f('0x3b')]=_[_0x442f('0x3d')](_0x1a3e25[_0x442f('0x39')],_0x1a3e25[_0x442f('0x3a')]);_0xeefc91[_0x442f('0x3c')]=_[_0x442f('0x3d')](_0x1a3e25['model'],qs[_0x442f('0x3e')](_0x1f40e7[_0x442f('0x3a')][_0x442f('0x3e')]));_0xeefc91[_0x442f('0x3c')]=_0xeefc91[_0x442f('0x3c')][_0x442f('0x3f')]?_0xeefc91[_0x442f('0x3c')]:_0x1a3e25[_0x442f('0x39')];if(_0x1f40e7[_0x442f('0x3a')][_0x442f('0x48')]){_0xeefc91[_0x442f('0x49')]=[{'all':!![]}];}_0xeefc91=_[_0x442f('0x46')]({},_0xeefc91,_0x1f40e7[_0x442f('0x47')]);return db[_0x442f('0x34')][_0x442f('0x50')](_0xeefc91)['then'](handleEntityNotFound(_0x381996,null))[_0x442f('0x29')](respondWithResult(_0x381996,null))[_0x442f('0x4c')](handleError(_0x381996,null));};exports['create']=function(_0x1214c8,_0x237234){return db['FaxQueue'][_0x442f('0x51')](_0x1214c8[_0x442f('0x52')],{})[_0x442f('0x29')](function(_0x1eaa09){var _0x4b09d2=_0x1214c8['user']['get']({'plain':!![]});if(!_0x4b09d2)throw new Error(_0x442f('0x53'));if(_0x4b09d2[_0x442f('0x54')]===_0x442f('0x55')){var _0x1ed4ca=_0x1eaa09[_0x442f('0x2b')]({'plain':!![]});var _0xa2cc80='FaxQueues';return db[_0x442f('0x56')][_0x442f('0x50')]({'where':{'name':_0xa2cc80,'userProfileId':_0x4b09d2[_0x442f('0x57')]},'raw':!![]})[_0x442f('0x29')](function(_0x177988){if(_0x177988&&_0x177988[_0x442f('0x58')]===0x0){return db[_0x442f('0x2d')][_0x442f('0x51')]({'name':_0x1ed4ca[_0x442f('0x30')],'resourceId':_0x1ed4ca['id'],'type':_0x177988['name'],'sectionId':_0x177988['id']},{})[_0x442f('0x29')](function(){return _0x1eaa09;});}else{return _0x1eaa09;}})[_0x442f('0x4c')](function(_0x44d838){logger[_0x442f('0x2e')](_0x442f('0x59'),_0x44d838);throw _0x44d838;});}return _0x1eaa09;})['then'](respondWithResult(_0x237234,0xc9))[_0x442f('0x4c')](handleError(_0x237234,null));};exports[_0x442f('0x28')]=function(_0x3a5076,_0x541190){if(_0x3a5076[_0x442f('0x52')]['id']){delete _0x3a5076[_0x442f('0x52')]['id'];}return db[_0x442f('0x34')]['find']({'where':{'id':_0x3a5076[_0x442f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x541190,null))[_0x442f('0x29')](saveUpdates(_0x3a5076[_0x442f('0x52')],null))[_0x442f('0x29')](respondWithResult(_0x541190,null))[_0x442f('0x4c')](handleError(_0x541190,null));};exports[_0x442f('0x2a')]=function(_0x3e2a84,_0x461c1e){return db[_0x442f('0x34')][_0x442f('0x50')]({'where':{'id':_0x3e2a84['params']['id']}})[_0x442f('0x29')](handleEntityNotFound(_0x461c1e,null))['then'](removeEntity(_0x461c1e,null))[_0x442f('0x4c')](handleError(_0x461c1e,null));};exports[_0x442f('0x5a')]=function(_0x59acfc,_0x56cad9){return db[_0x442f('0x34')][_0x442f('0x5a')]()[_0x442f('0x29')](respondWithResult(_0x56cad9,null))[_0x442f('0x4c')](handleError(_0x56cad9,null));};exports['getMembers']=function(_0x5345f1,_0x393b68,_0x33791a){var _0x4e61db={'raw':!![],'where':{}},_0x20f2db={},_0x35f247;return db[_0x442f('0x34')][_0x442f('0x5b')]({'where':{'id':_0x5345f1[_0x442f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x393b68,null))[_0x442f('0x29')](function(_0x281afa){if(_0x281afa){_0x35f247=_0x281afa['get']({'plain':!![]});_0x20f2db['model']=_[_0x442f('0x4f')](db[_0x442f('0x5c')][_0x442f('0x35')]);_0x20f2db['query']=_[_0x442f('0x4f')](_0x5345f1[_0x442f('0x3a')]);_0x20f2db[_0x442f('0x3b')]=_['intersection'](_0x20f2db[_0x442f('0x39')],_0x20f2db['query']);_0x4e61db['attributes']=_['intersection'](_0x20f2db['model'],qs[_0x442f('0x3e')](_0x5345f1[_0x442f('0x3a')][_0x442f('0x3e')]));_0x4e61db[_0x442f('0x3c')]=_0x4e61db[_0x442f('0x3c')][_0x442f('0x3f')]?_0x4e61db[_0x442f('0x3c')]:_0x20f2db[_0x442f('0x39')];if(!_0x5345f1['query'][_0x442f('0x5d')](_0x442f('0x40'))){_0x4e61db[_0x442f('0x23')]=qs[_0x442f('0x23')](_0x5345f1[_0x442f('0x3a')][_0x442f('0x23')]);_0x4e61db[_0x442f('0x22')]=qs[_0x442f('0x22')](_0x5345f1[_0x442f('0x3a')]['offset']);}_0x4e61db[_0x442f('0x41')]=qs[_0x442f('0x42')](_0x5345f1[_0x442f('0x3a')][_0x442f('0x42')]);_0x4e61db[_0x442f('0x43')]=qs[_0x442f('0x3b')](_[_0x442f('0x5e')](_0x5345f1['query'],_0x20f2db['filters']));_0x4e61db[_0x442f('0x43')][_0x442f('0x5f')]=_0x281afa['id'];if(_0x5345f1[_0x442f('0x3a')][_0x442f('0x45')]){_0x4e61db[_0x442f('0x43')]=_['merge'](_0x4e61db[_0x442f('0x43')],{'$or':_[_0x442f('0x33')](_0x4e61db[_0x442f('0x3c')],function(_0x1095a4){var _0x5d9393={};_0x5d9393[_0x1095a4]={'$like':'%'+_0x5345f1[_0x442f('0x3a')][_0x442f('0x45')]+'%'};return _0x5d9393;})});}_0x4e61db=_['merge']({},_0x4e61db,_0x5345f1['options']);return db['UserFaxQueue'][_0x442f('0x4a')](_0x4e61db);}})[_0x442f('0x29')](function(_0x3ff603){if(_0x3ff603){return db[_0x442f('0x60')][_0x442f('0x61')]({'where':{'id':_[_0x442f('0x33')](_0x3ff603,_0x442f('0x62')),'role':_0x442f('0x63')},'attributes':['id',_0x442f('0x30'),_0x442f('0x64'),_0x442f('0x65'),'createdAt']});}})[_0x442f('0x29')](function(_0x479d50){if(_0x479d50){return{'count':_0x479d50['count'],'rows':_[_0x442f('0x33')](_0x479d50[_0x442f('0x4b')],function(_0x29b460){return{'membername':_0x29b460['name'],'UserId':_0x29b460['id'],'queue_name':_0x35f247['name'],'FaxQueueId':_0x35f247['id'],'interface':util[_0x442f('0x66')](_0x442f('0x67'),_0x442f('0x68'),_0x29b460[_0x442f('0x30')]),'penalty':0x0,'paused':_0x29b460[_0x442f('0x64')],'createdAt':_0x29b460[_0x442f('0x69')],'updatedAt':_0x29b460[_0x442f('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x442f('0x29')](respondWithFilteredResult(_0x393b68,_0x4e61db))['catch'](handleError(_0x393b68,null));};exports['getTeams']=function(_0x15708c,_0x164ad4,_0x11b230){var _0x4aee57={};var _0x141793={};var _0x5af59d;var _0x4d4620;return db[_0x442f('0x34')][_0x442f('0x5b')]({'where':{'id':_0x15708c[_0x442f('0x4e')]['id']}})[_0x442f('0x29')](handleEntityNotFound(_0x164ad4,null))[_0x442f('0x29')](function(_0x4bdf0f){if(_0x4bdf0f){_0x5af59d=_0x4bdf0f;_0x141793[_0x442f('0x39')]=_[_0x442f('0x4f')](db[_0x442f('0x6a')][_0x442f('0x35')]);_0x141793[_0x442f('0x3a')]=_['keys'](_0x15708c[_0x442f('0x3a')]);_0x141793[_0x442f('0x3b')]=_['intersection'](_0x141793[_0x442f('0x39')],_0x141793[_0x442f('0x3a')]);_0x4aee57[_0x442f('0x3c')]=_[_0x442f('0x3d')](_0x141793[_0x442f('0x39')],qs[_0x442f('0x3e')](_0x15708c[_0x442f('0x3a')]['fields']));_0x4aee57[_0x442f('0x3c')]=_0x4aee57['attributes'][_0x442f('0x3f')]?_0x4aee57[_0x442f('0x3c')]:_0x141793[_0x442f('0x39')];_0x4aee57[_0x442f('0x41')]=qs[_0x442f('0x42')](_0x15708c[_0x442f('0x3a')][_0x442f('0x42')]);_0x4aee57[_0x442f('0x43')]=qs[_0x442f('0x3b')](_[_0x442f('0x5e')](_0x15708c[_0x442f('0x3a')],_0x141793['filters']));if(_0x15708c[_0x442f('0x3a')][_0x442f('0x45')]){_0x4aee57[_0x442f('0x43')]=_[_0x442f('0x46')](_0x4aee57[_0x442f('0x43')],{'$or':_[_0x442f('0x33')](_0x4aee57[_0x442f('0x3c')],function(_0x4d914d){var _0x16d397={};_0x16d397[_0x4d914d]={'$like':'%'+_0x15708c[_0x442f('0x3a')][_0x442f('0x45')]+'%'};return _0x16d397;})});}_0x4aee57=_[_0x442f('0x46')]({},_0x4aee57,_0x15708c[_0x442f('0x47')]);return _0x5af59d[_0x442f('0x6b')](_0x4aee57);}})[_0x442f('0x29')](function(_0x5ced46){if(_0x5ced46){_0x4d4620=_0x5ced46[_0x442f('0x3f')];if(!_0x15708c[_0x442f('0x3a')][_0x442f('0x5d')](_0x442f('0x40'))){_0x4aee57[_0x442f('0x23')]=qs[_0x442f('0x23')](_0x15708c[_0x442f('0x3a')][_0x442f('0x23')]);_0x4aee57['offset']=qs[_0x442f('0x22')](_0x15708c[_0x442f('0x3a')][_0x442f('0x22')]);}return _0x5af59d[_0x442f('0x6b')](_0x4aee57);}})[_0x442f('0x29')](function(_0x56f66d){if(_0x56f66d){return _0x56f66d?{'count':_0x4d4620,'rows':_0x56f66d}:null;}})[_0x442f('0x29')](respondWithResult(_0x164ad4,null))[_0x442f('0x4c')](handleError(_0x164ad4,null));};exports[_0x442f('0x6c')]=function(_0x791b60,_0x59be21,_0x12e5ba){var _0x4643b5=_0x791b60[_0x442f('0x52')][_0x442f('0x6d')];return db['Team'][_0x442f('0x4a')]({'where':{'id':_0x4643b5},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x442f('0x30'),_0x442f('0x6e'),_0x442f('0x6f'),'interface'],'raw':!![]}]})[_0x442f('0x29')](function(_0x2ac2e4){if(_0x2ac2e4){var _0x427427=_[_0x442f('0x70')](_0x2ac2e4,function(_0x1467c0){var _0x5009ac=_0x1467c0[_0x442f('0x2b')]({'plain':!![]});return _0x5009ac[_0x442f('0x71')];});return db[_0x442f('0x34')][_0x442f('0x50')]({'where':{'id':_0x791b60[_0x442f('0x4e')]['id']}})['then'](function(_0x5865fd){return db[_0x442f('0x72')][_0x442f('0x73')](function(_0x17dcd5){return _0x5865fd[_0x442f('0x6c')](_0x4643b5,{'transaction':_0x17dcd5})[_0x442f('0x29')](function(){return BPromise[_0x442f('0x74')](_0x427427,function(_0x43dffa){return db[_0x442f('0x5c')][_0x442f('0x75')]({'where':{'UserId':_0x43dffa['id'],'FaxQueueId':_0x791b60[_0x442f('0x4e')]['id']},'transaction':_0x17dcd5});});})[_0x442f('0x29')](function(){_0x427427[_0x442f('0x76')](function(_0x47da45){socket[_0x442f('0x77')]('userFaxQueue:save',{'UserId':_0x47da45['id'],'FaxQueueId':_0x5865fd['id']});});});});});}})[_0x442f('0x29')](respondWithStatusCode(_0x59be21,null))[_0x442f('0x4c')](handleError(_0x59be21,null));};exports[_0x442f('0x78')]=function(_0x141c71,_0x11d3f8,_0x3e40d7){return db[_0x442f('0x6a')]['findAll']({'where':{'id':_0x141c71[_0x442f('0x3a')][_0x442f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x442f('0x60')],'as':_0x442f('0x71'),'attributes':['id'],'raw':!![]}]})[_0x442f('0x29')](handleEntityNotFound(_0x11d3f8,null))[_0x442f('0x29')](function(_0xcae86c){var _0x446cef=_['map'](_0xcae86c,'id');var _0x27ec49=[];var _0x3c8a2c=[];var _0x346423=squel[_0x442f('0x79')]();_0x346423[_0x442f('0x7a')](_0x442f('0x7b'))[_0x442f('0x7c')](_0x442f('0x7d'),'tq')[_0x442f('0x7e')](_0x442f('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x442f('0x80'),_0x141c71[_0x442f('0x4e')]['id']);for(var _0x39e9f9=0x0;_0x39e9f9<_0xcae86c['length'];_0x39e9f9+=0x1){let _0x919876=_0xcae86c[_0x39e9f9];for(var _0x59fd37=0x0;_0x59fd37<_0x919876[_0x442f('0x71')][_0x442f('0x3f')];_0x59fd37+=0x1){let _0x535b37=_0x919876['Agents'][_0x59fd37];var _0x379da5=_0x346423[_0x442f('0x81')]();_0x379da5[_0x442f('0x43')](_0x442f('0x82'),_0x535b37['id']);_0x3c8a2c[_0x442f('0x83')](db[_0x442f('0x72')][_0x442f('0x3a')](_0x379da5[_0x442f('0x84')](),{'type':db[_0x442f('0x72')][_0x442f('0x85')]['SELECT']})[_0x442f('0x29')](function(_0x3a766e){if(_0x3a766e[_0x442f('0x3f')]===0x1){return _0x535b37['id'];}else{var _0x57554d=_[_0x442f('0x86')](_[_0x442f('0x33')](_0x3a766e,'TeamId'),function(_0x251fd0){return _[_0x442f('0x87')](_0x446cef,_0x251fd0);});if(_0x57554d){return _0x535b37['id'];}}}));}}return BPromise[_0x442f('0x88')](_0x3c8a2c)[_0x442f('0x29')](function(_0x53a976){_0x27ec49=_(_0x27ec49)[_0x442f('0x89')](_0x53a976)[_0x442f('0x8a')]()[_0x442f('0x8b')]();return db[_0x442f('0x34')][_0x442f('0x50')]({'where':{'id':_0x141c71[_0x442f('0x4e')]['id']}})[_0x442f('0x29')](function(_0x3bce0c){return db[_0x442f('0x72')][_0x442f('0x73')](function(_0x3aedfd){return _0x3bce0c['removeTeams'](_0x141c71[_0x442f('0x3a')]['ids'],{'transaction':_0x3aedfd})[_0x442f('0x29')](function(){if(!_[_0x442f('0x8c')](_0x27ec49)){return _0x3bce0c['removeAgents'](_0x27ec49,{'transaction':_0x3aedfd});}})[_0x442f('0x29')](function(){_0x27ec49[_0x442f('0x76')](function(_0x404e0e){socket[_0x442f('0x77')](_0x442f('0x8d'),{'UserId':_0x404e0e,'FaxQueueId':_0x3bce0c['id']});});});});});});})[_0x442f('0x29')](respondWithStatusCode(_0x11d3f8,null))[_0x442f('0x4c')](handleError(_0x11d3f8,null));};exports['addAgents']=function(_0x24cd62,_0x14d05e,_0x1d0ef2){return db[_0x442f('0x34')][_0x442f('0x50')]({'where':{'id':_0x24cd62[_0x442f('0x4e')]['id']}})[_0x442f('0x29')](handleEntityNotFound(_0x14d05e,null))[_0x442f('0x29')](function(_0xda4f2f){if(_0xda4f2f){return _0xda4f2f['addAgents'](_0x24cd62[_0x442f('0x52')][_0x442f('0x6d')],_[_0x442f('0x8e')](_0x24cd62[_0x442f('0x52')],[_0x442f('0x6d'),'id'])||{})[_0x442f('0x8f')](function(_0x28c7fb){for(var _0xb461ba=0x0;_0xb461ba<_0x24cd62[_0x442f('0x52')]['ids'][_0x442f('0x3f')];_0xb461ba+=0x1){socket['emit'](_0x442f('0x90'),{'UserId':_0x24cd62[_0x442f('0x52')]['ids'][_0xb461ba],'FaxQueueId':_0x24cd62[_0x442f('0x4e')]['id']});}return _0x28c7fb;});}})['then'](respondWithResult(_0x14d05e,null))[_0x442f('0x4c')](handleError(_0x14d05e,null));};exports[_0x442f('0x91')]=function(_0x1d3d0e,_0x5756ca,_0x338e8d){return db[_0x442f('0x34')]['find']({'where':{'id':_0x1d3d0e[_0x442f('0x4e')]['id']}})[_0x442f('0x29')](handleEntityNotFound(_0x5756ca,null))[_0x442f('0x29')](function(_0x310c81){if(_0x310c81){return _0x310c81[_0x442f('0x91')](_0x1d3d0e[_0x442f('0x3a')]['ids'])[_0x442f('0x29')](function(){if(_['isArray'](_0x1d3d0e[_0x442f('0x3a')][_0x442f('0x6d')])){for(var _0x267a8f=0x0;_0x267a8f<_0x1d3d0e[_0x442f('0x3a')]['ids'][_0x442f('0x3f')];_0x267a8f+=0x1){socket['emit'](_0x442f('0x8d'),{'UserId':Number(_0x1d3d0e['query'][_0x442f('0x6d')][_0x267a8f]),'FaxQueueId':Number(_0x1d3d0e['params']['id'])});}}else{socket[_0x442f('0x77')](_0x442f('0x8d'),{'UserId':Number(_0x1d3d0e[_0x442f('0x3a')][_0x442f('0x6d')]),'FaxQueueId':Number(_0x1d3d0e[_0x442f('0x4e')]['id'])});}});}})[_0x442f('0x29')](respondWithStatusCode(_0x5756ca,null))[_0x442f('0x4c')](handleError(_0x5756ca,null));};exports[_0x442f('0x92')]=function(_0x2763f8,_0x3051bc,_0xcdd4b){var _0x3f836a={};var _0x5f26af={};var _0x36855;var _0x206556;return db[_0x442f('0x34')]['findOne']({'where':{'id':_0x2763f8[_0x442f('0x4e')]['id']}})[_0x442f('0x29')](handleEntityNotFound(_0x3051bc,null))['then'](function(_0x241f1e){if(_0x241f1e){_0x36855=_0x241f1e;_0x5f26af[_0x442f('0x39')]=_[_0x442f('0x4f')](db[_0x442f('0x60')][_0x442f('0x35')]);_0x5f26af['query']=_[_0x442f('0x4f')](_0x2763f8['query']);_0x5f26af['filters']=_['intersection'](_0x5f26af['model'],_0x5f26af[_0x442f('0x3a')]);_0x3f836a[_0x442f('0x3c')]=_[_0x442f('0x3d')](_0x5f26af[_0x442f('0x39')],qs[_0x442f('0x3e')](_0x2763f8[_0x442f('0x3a')][_0x442f('0x3e')]));_0x3f836a[_0x442f('0x3c')]=_0x3f836a[_0x442f('0x3c')][_0x442f('0x3f')]?_0x3f836a[_0x442f('0x3c')]:_0x5f26af[_0x442f('0x39')];_0x3f836a[_0x442f('0x41')]=qs[_0x442f('0x42')](_0x2763f8[_0x442f('0x3a')][_0x442f('0x42')]);_0x3f836a[_0x442f('0x43')]=qs[_0x442f('0x3b')](_[_0x442f('0x5e')](_0x2763f8[_0x442f('0x3a')],_0x5f26af['filters']));if(_0x2763f8[_0x442f('0x3a')]['filter']){_0x3f836a[_0x442f('0x43')]=_[_0x442f('0x46')](_0x3f836a[_0x442f('0x43')],{'$or':_[_0x442f('0x33')](_0x3f836a['attributes'],function(_0x453c60){var _0x2c6bd9={};_0x2c6bd9[_0x453c60]={'$like':'%'+_0x2763f8[_0x442f('0x3a')][_0x442f('0x45')]+'%'};return _0x2c6bd9;})});}_0x3f836a=_[_0x442f('0x46')]({},_0x3f836a,_0x2763f8[_0x442f('0x47')]);return _0x36855[_0x442f('0x92')](_0x3f836a);}})[_0x442f('0x29')](function(_0x4df604){if(_0x4df604){_0x206556=_0x4df604[_0x442f('0x3f')];if(!_0x2763f8[_0x442f('0x3a')]['hasOwnProperty'](_0x442f('0x40'))){_0x3f836a['limit']=qs[_0x442f('0x23')](_0x2763f8[_0x442f('0x3a')][_0x442f('0x23')]);_0x3f836a[_0x442f('0x22')]=qs[_0x442f('0x22')](_0x2763f8['query'][_0x442f('0x22')]);}return _0x36855[_0x442f('0x92')](_0x3f836a);}})['then'](function(_0x59348f){if(_0x59348f){return _0x59348f?{'count':_0x206556,'rows':_0x59348f}:null;}})[_0x442f('0x29')](respondWithResult(_0x3051bc,null))[_0x442f('0x4c')](handleError(_0x3051bc,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index d35fd5b..054eee7 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 _0x2f77=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x559aba,_0x392da1){var _0x4a3380=function(_0xb5cda8){while(--_0xb5cda8){_0x559aba['push'](_0x559aba['shift']());}};_0x4a3380(++_0x392da1);}(_0x2f77,0x12b));var _0x72f7=function(_0x57c0a0,_0x185648){_0x57c0a0=_0x57c0a0-0x0;var _0x2750db=_0x2f77[_0x57c0a0];return _0x2750db;};'use strict';var EventEmitter=require(_0x72f7('0x0'));var FaxQueue=require(_0x72f7('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x72f7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x72f7('0x3'),'afterDestroy':_0x72f7('0x4')};function emitEvent(_0x117d3c){return function(_0x1466fa,_0x474889,_0xf6505d){FaxQueueEvents[_0x72f7('0x5')](_0x117d3c+':'+_0x1466fa['id'],_0x1466fa);FaxQueueEvents['emit'](_0x117d3c,_0x1466fa);_0xf6505d(null);};}for(var e in events){if(events[_0x72f7('0x6')](e)){var event=events[e];FaxQueue[_0x72f7('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x3152=['remove','emit','hook','exports','events','../../mysqldb','save','update'];(function(_0x57966a,_0x477964){var _0x191765=function(_0x106a01){while(--_0x106a01){_0x57966a['push'](_0x57966a['shift']());}};_0x191765(++_0x477964);}(_0x3152,0xec));var _0x2315=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3152[_0x5a776b];return _0xbbef59;};'use strict';var EventEmitter=require(_0x2315('0x0'));var FaxQueue=require(_0x2315('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2315('0x2'),'afterUpdate':_0x2315('0x3'),'afterDestroy':_0x2315('0x4')};function emitEvent(_0x3259a2){return function(_0x55363d,_0x5101d6,_0x123457){FaxQueueEvents[_0x2315('0x5')](_0x3259a2+':'+_0x55363d['id'],_0x55363d);FaxQueueEvents[_0x2315('0x5')](_0x3259a2,_0x55363d);_0x123457(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x2315('0x6')](e,emitEvent(event));}}module[_0x2315('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 9b910de..79a7b5c 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 _0xeedc=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./faxQueue.attributes'];(function(_0x369bd2,_0x1e9332){var _0x4ca84f=function(_0x47e5b5){while(--_0x47e5b5){_0x369bd2['push'](_0x369bd2['shift']());}};_0x4ca84f(++_0x1e9332);}(_0xeedc,0x13c));var _0xceed=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xeedc[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xceed('0x0'));var util=require(_0xceed('0x1'));var logger=require(_0xceed('0x2'))('api');var moment=require(_0xceed('0x3'));var BPromise=require(_0xceed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xceed('0x5'));var rimraf=require('rimraf');var config=require(_0xceed('0x6'));var attributes=require(_0xceed('0x7'));module[_0xceed('0x8')]=function(_0x56ef9f,_0x27e8f0){return _0x56ef9f[_0xceed('0x9')](_0xceed('0xa'),attributes,{'tableName':_0xceed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b9e=['moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','fax_queues','lodash','../../config/logger','api'];(function(_0x16aa70,_0x5b1f73){var _0x11875f=function(_0x18c7be){while(--_0x18c7be){_0x16aa70['push'](_0x16aa70['shift']());}};_0x11875f(++_0x5b1f73);}(_0x3b9e,0x165));var _0xe3b9=function(_0x505249,_0x534d68){_0x505249=_0x505249-0x0;var _0x23a61c=_0x3b9e[_0x505249];return _0x23a61c;};'use strict';var _=require(_0xe3b9('0x0'));var util=require('util');var logger=require(_0xe3b9('0x1'))(_0xe3b9('0x2'));var moment=require(_0xe3b9('0x3'));var BPromise=require(_0xe3b9('0x4'));var rp=require(_0xe3b9('0x5'));var fs=require('fs');var path=require(_0xe3b9('0x6'));var rimraf=require(_0xe3b9('0x7'));var config=require('../../config/environment');var attributes=require(_0xe3b9('0x8'));module['exports']=function(_0x3d3b9c,_0x2740c9){return _0x3d3b9c['define']('FaxQueue',attributes,{'tableName':_0xe3b9('0x9'),'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 2c49d7b..ebc865f 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 _0x7ad2=['FaxQueue','findAll','options','where','include','map','attributes','model','GetFaxQueue','ShowFaxQueue','find','raw','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7ad2,0x1e0));var _0x27ad=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7ad2[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x27ad('0x0'));var util=require(_0x27ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x27ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27ad('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x27ad('0x4'));var config=require(_0x27ad('0x5'));var jayson=require(_0x27ad('0x6'));var client=jayson[_0x27ad('0x7')][_0x27ad('0x8')]({'port':0x232a});config[_0x27ad('0x9')]=_[_0x27ad('0xa')](config[_0x27ad('0x9')],{'host':_0x27ad('0xb'),'port':0x18eb});var socket=require(_0x27ad('0xc'))(new Redis(config[_0x27ad('0x9')]));require(_0x27ad('0xd'))[_0x27ad('0xe')](socket);function respondWithRpcPromise(_0x32647b,_0x56ceb4,_0x2e4dc7){return new BPromise(function(_0x27f579,_0x3ca2fe){return client[_0x27ad('0xf')](_0x32647b,_0x2e4dc7)[_0x27ad('0x10')](function(_0x24ed31){logger[_0x27ad('0x11')](_0x27ad('0x12'),_0x56ceb4,_0x27ad('0x13'));logger[_0x27ad('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x56ceb4,_0x27ad('0x13'),JSON[_0x27ad('0x15')](_0x24ed31));if(_0x24ed31[_0x27ad('0x16')]){if(_0x24ed31['error'][_0x27ad('0x17')]===0x1f4){logger[_0x27ad('0x16')](_0x27ad('0x12'),_0x56ceb4,_0x24ed31['error'][_0x27ad('0x18')]);return _0x3ca2fe(_0x24ed31[_0x27ad('0x16')][_0x27ad('0x18')]);}logger['error'](_0x27ad('0x12'),_0x56ceb4,_0x24ed31[_0x27ad('0x16')][_0x27ad('0x18')]);return _0x27f579(_0x24ed31['error']['message']);}else{logger[_0x27ad('0x11')](_0x27ad('0x12'),_0x56ceb4,_0x27ad('0x13'));_0x27f579(_0x24ed31[_0x27ad('0x19')]['message']);}})[_0x27ad('0x1a')](function(_0x5c3769){logger[_0x27ad('0x16')](_0x27ad('0x12'),_0x56ceb4,_0x5c3769);_0x3ca2fe(_0x5c3769);});});}exports['GetFaxQueue']=function(_0x1162ed){var _0x3cef58=this;return new Promise(function(_0x38dce4,_0x2cf7e7){return db[_0x27ad('0x1b')][_0x27ad('0x1c')]({'raw':_0x1162ed[_0x27ad('0x1d')]?_0x1162ed[_0x27ad('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1162ed['options']?_0x1162ed[_0x27ad('0x1d')][_0x27ad('0x1e')]||null:null,'attributes':_0x1162ed[_0x27ad('0x1d')]?_0x1162ed[_0x27ad('0x1d')]['attributes']||null:null,'limit':_0x1162ed[_0x27ad('0x1d')]?_0x1162ed[_0x27ad('0x1d')]['limit']||null:null,'include':_0x1162ed['options']?_0x1162ed[_0x27ad('0x1d')][_0x27ad('0x1f')]?_[_0x27ad('0x20')](_0x1162ed['options'][_0x27ad('0x1f')],function(_0x332110){return{'model':db[_0x332110['model']],'as':_0x332110['as'],'attributes':_0x332110[_0x27ad('0x21')],'include':_0x332110[_0x27ad('0x1f')]?_[_0x27ad('0x20')](_0x332110['include'],function(_0x2331d2){return{'model':db[_0x2331d2['model']],'as':_0x2331d2['as'],'attributes':_0x2331d2[_0x27ad('0x21')],'include':_0x2331d2['include']?_[_0x27ad('0x20')](_0x2331d2[_0x27ad('0x1f')],function(_0x393f3e){return{'model':db[_0x393f3e[_0x27ad('0x22')]],'as':_0x393f3e['as'],'attributes':_0x393f3e[_0x27ad('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x398937){logger[_0x27ad('0x11')]('GetFaxQueue',_0x1162ed);logger[_0x27ad('0x14')]('GetFaxQueue',_0x1162ed,JSON[_0x27ad('0x15')](_0x398937));_0x38dce4(_0x398937);})[_0x27ad('0x1a')](function(_0x5400b9){logger[_0x27ad('0x16')](_0x27ad('0x23'),_0x5400b9[_0x27ad('0x18')],_0x1162ed);_0x2cf7e7(_0x3cef58[_0x27ad('0x16')](0x1f4,_0x5400b9['message']));});});};exports[_0x27ad('0x24')]=function(_0x2a02df){var _0x2ecbf5=this;return new Promise(function(_0x4b4dcb,_0x3f2e2b){return db['FaxQueue'][_0x27ad('0x25')]({'raw':_0x2a02df[_0x27ad('0x1d')]?_0x2a02df[_0x27ad('0x1d')][_0x27ad('0x26')]===undefined?!![]:![]:!![],'where':_0x2a02df[_0x27ad('0x1d')]?_0x2a02df[_0x27ad('0x1d')]['where']||null:null,'attributes':_0x2a02df[_0x27ad('0x1d')]?_0x2a02df[_0x27ad('0x1d')][_0x27ad('0x21')]||null:null,'include':_0x2a02df['options']?_0x2a02df[_0x27ad('0x1d')][_0x27ad('0x1f')]?_[_0x27ad('0x20')](_0x2a02df['options'][_0x27ad('0x1f')],function(_0x5609cc){return{'model':db[_0x5609cc[_0x27ad('0x22')]],'as':_0x5609cc['as'],'attributes':_0x5609cc['attributes'],'include':_0x5609cc[_0x27ad('0x1f')]?_[_0x27ad('0x20')](_0x5609cc[_0x27ad('0x1f')],function(_0x18ba55){return{'model':db[_0x18ba55[_0x27ad('0x22')]],'as':_0x18ba55['as'],'attributes':_0x18ba55[_0x27ad('0x21')],'include':_0x18ba55[_0x27ad('0x1f')]?_[_0x27ad('0x20')](_0x18ba55[_0x27ad('0x1f')],function(_0x5f48bb){return{'model':db[_0x5f48bb[_0x27ad('0x22')]],'as':_0x5f48bb['as'],'attributes':_0x5f48bb['attributes']};}):[]};}):[]};}):[]:[]})[_0x27ad('0x10')](function(_0x2c2da8){logger[_0x27ad('0x11')](_0x27ad('0x24'),_0x2a02df);logger[_0x27ad('0x14')](_0x27ad('0x24'),_0x2a02df,JSON[_0x27ad('0x15')](_0x2c2da8));_0x4b4dcb(_0x2c2da8);})[_0x27ad('0x1a')](function(_0x3a5727){logger[_0x27ad('0x16')](_0x27ad('0x24'),_0x3a5727[_0x27ad('0x18')],_0x2a02df);_0x3f2e2b(_0x2ecbf5['error'](0x1f4,_0x3a5727[_0x27ad('0x18')]));});});}; \ No newline at end of file +var _0xe186=['./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','include','map','model','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xe186,0xb6));var _0x6e18=function(_0x88621f,_0x3594b1){_0x88621f=_0x88621f-0x0;var _0x58686f=_0xe186[_0x88621f];return _0x58686f;};'use strict';var _=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var moment=require(_0x6e18('0x2'));var BPromise=require(_0x6e18('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e18('0x4'));var db=require(_0x6e18('0x5'))['db'];var utils=require(_0x6e18('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6e18('0x7'));var client=jayson[_0x6e18('0x8')][_0x6e18('0x9')]({'port':0x232a});config['redis']=_[_0x6e18('0xa')](config[_0x6e18('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e18('0xc'))(new Redis(config[_0x6e18('0xb')]));require(_0x6e18('0xd'))[_0x6e18('0xe')](socket);function respondWithRpcPromise(_0x45248b,_0x417a9d,_0x3b6a5e){return new BPromise(function(_0x295efd,_0x1c3c6d){return client[_0x6e18('0xf')](_0x45248b,_0x3b6a5e)[_0x6e18('0x10')](function(_0x4f53e6){logger[_0x6e18('0x11')](_0x6e18('0x12'),_0x417a9d,'request\x20sent');logger[_0x6e18('0x13')](_0x6e18('0x14'),_0x417a9d,_0x6e18('0x15'),JSON[_0x6e18('0x16')](_0x4f53e6));if(_0x4f53e6[_0x6e18('0x17')]){if(_0x4f53e6[_0x6e18('0x17')][_0x6e18('0x18')]===0x1f4){logger[_0x6e18('0x17')](_0x6e18('0x12'),_0x417a9d,_0x4f53e6[_0x6e18('0x17')][_0x6e18('0x19')]);return _0x1c3c6d(_0x4f53e6[_0x6e18('0x17')][_0x6e18('0x19')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x417a9d,_0x4f53e6['error'][_0x6e18('0x19')]);return _0x295efd(_0x4f53e6[_0x6e18('0x17')]['message']);}else{logger[_0x6e18('0x11')](_0x6e18('0x12'),_0x417a9d,'request\x20sent');_0x295efd(_0x4f53e6[_0x6e18('0x1a')]['message']);}})[_0x6e18('0x1b')](function(_0x223eb8){logger[_0x6e18('0x17')](_0x6e18('0x12'),_0x417a9d,_0x223eb8);_0x1c3c6d(_0x223eb8);});});}exports[_0x6e18('0x1c')]=function(_0x15321b){var _0x326beb=this;return new Promise(function(_0x250ab0,_0x2cb3e0){return db[_0x6e18('0x1d')]['findAll']({'raw':_0x15321b[_0x6e18('0x1e')]?_0x15321b['options'][_0x6e18('0x1f')]===undefined?!![]:![]:!![],'where':_0x15321b['options']?_0x15321b[_0x6e18('0x1e')][_0x6e18('0x20')]||null:null,'attributes':_0x15321b[_0x6e18('0x1e')]?_0x15321b['options'][_0x6e18('0x21')]||null:null,'limit':_0x15321b[_0x6e18('0x1e')]?_0x15321b[_0x6e18('0x1e')]['limit']||null:null,'include':_0x15321b[_0x6e18('0x1e')]?_0x15321b['options'][_0x6e18('0x22')]?_[_0x6e18('0x23')](_0x15321b[_0x6e18('0x1e')][_0x6e18('0x22')],function(_0xda7cff){return{'model':db[_0xda7cff[_0x6e18('0x24')]],'as':_0xda7cff['as'],'attributes':_0xda7cff['attributes'],'include':_0xda7cff[_0x6e18('0x22')]?_[_0x6e18('0x23')](_0xda7cff['include'],function(_0x599c09){return{'model':db[_0x599c09[_0x6e18('0x24')]],'as':_0x599c09['as'],'attributes':_0x599c09[_0x6e18('0x21')],'include':_0x599c09[_0x6e18('0x22')]?_['map'](_0x599c09[_0x6e18('0x22')],function(_0x4588dc){return{'model':db[_0x4588dc[_0x6e18('0x24')]],'as':_0x4588dc['as'],'attributes':_0x4588dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e18('0x10')](function(_0x2de19e){logger[_0x6e18('0x11')](_0x6e18('0x1c'),_0x15321b);logger[_0x6e18('0x13')](_0x6e18('0x1c'),_0x15321b,JSON['stringify'](_0x2de19e));_0x250ab0(_0x2de19e);})['catch'](function(_0x327c77){logger['error'](_0x6e18('0x1c'),_0x327c77[_0x6e18('0x19')],_0x15321b);_0x2cb3e0(_0x326beb[_0x6e18('0x17')](0x1f4,_0x327c77[_0x6e18('0x19')]));});});};exports[_0x6e18('0x25')]=function(_0x146f1e){var _0x31dcb4=this;return new Promise(function(_0x2b1d00,_0x4fc14c){return db[_0x6e18('0x1d')][_0x6e18('0x26')]({'raw':_0x146f1e[_0x6e18('0x1e')]?_0x146f1e['options'][_0x6e18('0x1f')]===undefined?!![]:![]:!![],'where':_0x146f1e[_0x6e18('0x1e')]?_0x146f1e[_0x6e18('0x1e')][_0x6e18('0x20')]||null:null,'attributes':_0x146f1e['options']?_0x146f1e['options'][_0x6e18('0x21')]||null:null,'include':_0x146f1e[_0x6e18('0x1e')]?_0x146f1e[_0x6e18('0x1e')][_0x6e18('0x22')]?_[_0x6e18('0x23')](_0x146f1e[_0x6e18('0x1e')][_0x6e18('0x22')],function(_0x5dddf8){return{'model':db[_0x5dddf8[_0x6e18('0x24')]],'as':_0x5dddf8['as'],'attributes':_0x5dddf8[_0x6e18('0x21')],'include':_0x5dddf8['include']?_['map'](_0x5dddf8[_0x6e18('0x22')],function(_0x3ec62b){return{'model':db[_0x3ec62b[_0x6e18('0x24')]],'as':_0x3ec62b['as'],'attributes':_0x3ec62b[_0x6e18('0x21')],'include':_0x3ec62b['include']?_['map'](_0x3ec62b[_0x6e18('0x22')],function(_0x393b7e){return{'model':db[_0x393b7e[_0x6e18('0x24')]],'as':_0x393b7e['as'],'attributes':_0x393b7e[_0x6e18('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6e18('0x10')](function(_0x74a181){logger[_0x6e18('0x11')](_0x6e18('0x25'),_0x146f1e);logger[_0x6e18('0x13')](_0x6e18('0x25'),_0x146f1e,JSON['stringify'](_0x74a181));_0x2b1d00(_0x74a181);})[_0x6e18('0x1b')](function(_0x20f4f2){logger[_0x6e18('0x17')](_0x6e18('0x25'),_0x20f4f2[_0x6e18('0x19')],_0x146f1e);_0x4fc14c(_0x31dcb4[_0x6e18('0x17')](0x1f4,_0x20f4f2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d03fd9b..d83aae5 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 _0x9f2a=['register','length','faxQueue:','./faxQueue.events','remove','update','removeListener'];(function(_0x3653c7,_0xadb356){var _0x58a021=function(_0x20b237){while(--_0x20b237){_0x3653c7['push'](_0x3653c7['shift']());}};_0x58a021(++_0xadb356);}(_0x9f2a,0xc7));var _0xa9f2=function(_0x24203e,_0x9f488a){_0x24203e=_0x24203e-0x0;var _0x3a9174=_0x9f2a[_0x24203e];return _0x3a9174;};'use strict';var FaxQueueEvents=require(_0xa9f2('0x0'));var events=['save',_0xa9f2('0x1'),_0xa9f2('0x2')];function createListener(_0x3d0486,_0x330100){return function(_0x1724f5){_0x330100['emit'](_0x3d0486,_0x1724f5);};}function removeListener(_0x30beef,_0x494435){return function(){FaxQueueEvents[_0xa9f2('0x3')](_0x30beef,_0x494435);};}exports[_0xa9f2('0x4')]=function(_0xf99eb1){for(var _0x50d39a=0x0,_0x144ba6=events[_0xa9f2('0x5')];_0x50d39a<_0x144ba6;_0x50d39a++){var _0x354247=events[_0x50d39a];var _0x324c5d=createListener(_0xa9f2('0x6')+_0x354247,_0xf99eb1);FaxQueueEvents['on'](_0x354247,_0x324c5d);}}; \ No newline at end of file +var _0x0add=['removeListener','register','faxQueue:','save','emit'];(function(_0x404993,_0x2f6aa2){var _0x151692=function(_0x592d40){while(--_0x592d40){_0x404993['push'](_0x404993['shift']());}};_0x151692(++_0x2f6aa2);}(_0x0add,0x71));var _0xd0ad=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0add[_0x4c12ec];return _0x3ae42c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xd0ad('0x0'),'remove','update'];function createListener(_0x1eddf6,_0x177acb){return function(_0x37ef8a){_0x177acb[_0xd0ad('0x1')](_0x1eddf6,_0x37ef8a);};}function removeListener(_0x1c0fbe,_0x153da4){return function(){FaxQueueEvents[_0xd0ad('0x2')](_0x1c0fbe,_0x153da4);};}exports[_0xd0ad('0x3')]=function(_0xdd9e5a){for(var _0x259b34=0x0,_0xd8ddfb=events['length'];_0x259b34<_0xd8ddfb;_0x259b34++){var _0x337daf=events[_0x259b34];var _0x30bfe3=createListener(_0xd0ad('0x4')+_0x337daf,_0xdd9e5a);FaxQueueEvents['on'](_0x337daf,_0x30bfe3);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e308695..9755e6c 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(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1f175e,_0x25487c){_0x1f175e=_0x1f175e-0x0;var _0x4ab74c=_0xb10b[_0x1f175e];return _0x4ab74c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/members','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','/:id/teams'];(function(_0x176ed7,_0x4d125d){var _0x40e6c3=function(_0x13e288){while(--_0x13e288){_0x176ed7['push'](_0x176ed7['shift']());}};_0x40e6c3(++_0x4d125d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x151542,_0x2203e9){_0x151542=_0x151542-0x0;var _0xfb7a36=_0x5f2f[_0x151542];return _0xfb7a36;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getMembers']);router[_0xf5f2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x8')]('/:id/users',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x10')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x10')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['addAgents']);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x16')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x16')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x16')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1a')]);module[_0xf5f2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 30f65f7..a3a3952 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 _0xbac7=['moment','exports','STRING','DATE'];(function(_0x4884a1,_0x27b7ee){var _0x25cfc1=function(_0x276861){while(--_0x276861){_0x4884a1['push'](_0x4884a1['shift']());}};_0x25cfc1(++_0x27b7ee);}(_0xbac7,0xfc));var _0x7bac=function(_0x20980a,_0x2cc865){_0x20980a=_0x20980a-0x0;var _0x3bf1ec=_0xbac7[_0x20980a];return _0x3bf1ec;};'use strict';var moment=require(_0x7bac('0x0'));var Sequelize=require('sequelize');module[_0x7bac('0x1')]={'uniqueid':{'type':Sequelize[_0x7bac('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7bac('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7bac('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7bac('0x3')]},'reason':{'type':Sequelize[_0x7bac('0x2')]}}; \ No newline at end of file +var _0x7fbb=['sequelize','STRING','DATE','moment'];(function(_0x1d1867,_0x31a490){var _0x31202e=function(_0xad696f){while(--_0xad696f){_0x1d1867['push'](_0x1d1867['shift']());}};_0x31202e(++_0x31a490);}(_0x7fbb,0x1c3));var _0xb7fb=function(_0x54249e,_0x538038){_0x54249e=_0x54249e-0x0;var _0x98c4c4=_0x7fbb[_0x54249e];return _0x98c4c4;};'use strict';var moment=require(_0xb7fb('0x0'));var Sequelize=require(_0xb7fb('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb7fb('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb7fb('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb7fb('0x3')]},'reason':{'type':Sequelize[_0xb7fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 3d80a80..3e3754f 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 _0x3643=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','FaxQueueReport','rows','catch','show','keys','include','options','find','create','body','destroy','params','describe'];(function(_0x1a3921,_0x586fdd){var _0x2a1e32=function(_0x3c9a8e){while(--_0x3c9a8e){_0x1a3921['push'](_0x1a3921['shift']());}};_0x2a1e32(++_0x586fdd);}(_0x3643,0x1bc));var _0x3364=function(_0x7a3848,_0x5af3a9){_0x7a3848=_0x7a3848-0x0;var _0x11067b=_0x3643[_0x7a3848];return _0x11067b;};'use strict';var pdf=require(_0x3364('0x0'));var emlformat=require(_0x3364('0x1'));var rimraf=require(_0x3364('0x2'));var zipdir=require(_0x3364('0x3'));var jsonpatch=require(_0x3364('0x4'));var rp=require('request-promise');var moment=require(_0x3364('0x5'));var BPromise=require(_0x3364('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3364('0x7'));var csv=require('to-csv');var ejs=require(_0x3364('0x8'));var fs=require('fs');var _=require(_0x3364('0x9'));var squel=require(_0x3364('0xa'));var crypto=require(_0x3364('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3364('0xc'));var toCsv=require(_0x3364('0xd'));var querystring=require('querystring');var Papa=require(_0x3364('0xe'));var Redis=require(_0x3364('0xf'));var authService=require(_0x3364('0x10'));var qs=require(_0x3364('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3364('0x12'));var logger=require(_0x3364('0x13'))(_0x3364('0x14'));var utils=require(_0x3364('0x15'));var config=require(_0x3364('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23dbe2,_0x350c3a){_0x350c3a=_0x350c3a||0xcc;return function(_0x3a2261){if(_0x3a2261){return _0x23dbe2[_0x3364('0x17')](_0x350c3a);}return _0x23dbe2[_0x3364('0x18')](_0x350c3a)['end']();};}function respondWithResult(_0xa72532,_0x53ca44){_0x53ca44=_0x53ca44||0xc8;return function(_0x33eac0){if(_0x33eac0){return _0xa72532[_0x3364('0x18')](_0x53ca44)[_0x3364('0x19')](_0x33eac0);}};}function respondWithFilteredResult(_0x28e831,_0xa3cd62){return function(_0x2c08bb){if(_0x2c08bb){var _0x34deae=_0x2c08bb[_0x3364('0x1a')],_0x5c6ee6=_0xa3cd62['offset'],_0x3807e5=_0xa3cd62[_0x3364('0x1b')]+_0xa3cd62[_0x3364('0x1c')],_0xdc5f92;if(_0x3807e5>=_0x34deae){_0x3807e5=_0x34deae;_0xdc5f92=0xc8;}else{_0xdc5f92=0xce;}_0x28e831['status'](_0xdc5f92);return _0x28e831[_0x3364('0x1d')](_0x3364('0x1e'),_0x5c6ee6+'-'+_0x3807e5+'/'+_0x34deae)['json'](_0x2c08bb);}return null;};}function patchUpdates(_0x516a10){return function(_0x18e2ab){try{jsonpatch['apply'](_0x18e2ab,_0x516a10,!![]);}catch(_0x24ff95){return BPromise['reject'](_0x24ff95);}return _0x18e2ab[_0x3364('0x1f')]();};}function saveUpdates(_0x41c3fa,_0x4d4906){return function(_0x2e8093){if(_0x2e8093){return _0x2e8093[_0x3364('0x20')](_0x41c3fa)[_0x3364('0x21')](function(_0x531cb2){return _0x531cb2;});}return null;};}function removeEntity(_0x59e1c3,_0x1f080e){return function(_0x150557){if(_0x150557){return _0x150557['destroy']()['then'](function(){_0x59e1c3[_0x3364('0x18')](0xcc)[_0x3364('0x22')]();});}};}function handleEntityNotFound(_0x556707,_0x2aeeee){return function(_0x4fc925){if(!_0x4fc925){_0x556707[_0x3364('0x17')](0x194);}return _0x4fc925;};}function handleError(_0x4dccf1,_0x2f9ba3){_0x2f9ba3=_0x2f9ba3||0x1f4;return function(_0x2c86c8){logger[_0x3364('0x23')](_0x2c86c8[_0x3364('0x24')]);if(_0x2c86c8['name']){delete _0x2c86c8[_0x3364('0x25')];}_0x4dccf1[_0x3364('0x18')](_0x2f9ba3)[_0x3364('0x26')](_0x2c86c8);};}exports[_0x3364('0x27')]=function(_0x106b12,_0x26f7a2){var _0x2d83c3={},_0x3a3ec2={},_0x932ca9={'count':0x0,'rows':[]};var _0x21b14a=_[_0x3364('0x28')](db['FaxQueueReport'][_0x3364('0x29')],function(_0x49b3c7){return{'name':_0x49b3c7[_0x3364('0x2a')],'type':_0x49b3c7[_0x3364('0x2b')][_0x3364('0x2c')]};});_0x3a3ec2[_0x3364('0x2d')]=_[_0x3364('0x28')](_0x21b14a,_0x3364('0x25'));_0x3a3ec2[_0x3364('0x2e')]=_['keys'](_0x106b12[_0x3364('0x2e')]);_0x3a3ec2['filters']=_[_0x3364('0x2f')](_0x3a3ec2['model'],_0x3a3ec2[_0x3364('0x2e')]);_0x2d83c3[_0x3364('0x30')]=_[_0x3364('0x2f')](_0x3a3ec2[_0x3364('0x2d')],qs[_0x3364('0x31')](_0x106b12[_0x3364('0x2e')][_0x3364('0x31')]));_0x2d83c3[_0x3364('0x30')]=_0x2d83c3['attributes'][_0x3364('0x32')]?_0x2d83c3[_0x3364('0x30')]:_0x3a3ec2[_0x3364('0x2d')];if(!_0x106b12[_0x3364('0x2e')]['hasOwnProperty'](_0x3364('0x33'))){_0x2d83c3['limit']=qs[_0x3364('0x1c')](_0x106b12[_0x3364('0x2e')][_0x3364('0x1c')]);_0x2d83c3[_0x3364('0x1b')]=qs[_0x3364('0x1b')](_0x106b12['query'][_0x3364('0x1b')]);}_0x2d83c3[_0x3364('0x34')]=qs[_0x3364('0x35')](_0x106b12[_0x3364('0x2e')]['sort']);_0x2d83c3[_0x3364('0x36')]=qs['filters'](_[_0x3364('0x37')](_0x106b12['query'],_0x3a3ec2[_0x3364('0x38')]),_0x21b14a);if(_0x106b12[_0x3364('0x2e')][_0x3364('0x39')]){_0x2d83c3[_0x3364('0x36')]=_['merge'](_0x2d83c3[_0x3364('0x36')],{'$or':_[_0x3364('0x28')](_0x21b14a,function(_0x6a76b2){if(_0x6a76b2[_0x3364('0x2b')]!==_0x3364('0x3a')){var _0x2c5e19={};_0x2c5e19[_0x6a76b2[_0x3364('0x25')]]={'$like':'%'+_0x106b12['query'][_0x3364('0x39')]+'%'};return _0x2c5e19;}})});}_0x2d83c3=_[_0x3364('0x3b')]({},_0x2d83c3,_0x106b12['options']);var _0x5977d6={'where':_0x2d83c3[_0x3364('0x36')]};return db['FaxQueueReport'][_0x3364('0x1a')](_0x5977d6)[_0x3364('0x21')](function(_0x2a23c3){_0x932ca9[_0x3364('0x1a')]=_0x2a23c3;if(_0x106b12['query'][_0x3364('0x3c')]){_0x2d83c3['include']=[{'all':!![]}];}return db[_0x3364('0x3d')]['findAll'](_0x2d83c3);})['then'](function(_0x3f578e){_0x932ca9[_0x3364('0x3e')]=_0x3f578e;return _0x932ca9;})[_0x3364('0x21')](respondWithFilteredResult(_0x26f7a2,_0x2d83c3))[_0x3364('0x3f')](handleError(_0x26f7a2,null));};exports[_0x3364('0x40')]=function(_0x370ad8,_0x8d709b){var _0x4a6203={'raw':!![],'where':{'id':_0x370ad8['params']['id']}},_0x207400={};_0x207400[_0x3364('0x2d')]=_[_0x3364('0x41')](db[_0x3364('0x3d')][_0x3364('0x29')]);_0x207400[_0x3364('0x2e')]=_[_0x3364('0x41')](_0x370ad8[_0x3364('0x2e')]);_0x207400[_0x3364('0x38')]=_[_0x3364('0x2f')](_0x207400['model'],_0x207400[_0x3364('0x2e')]);_0x4a6203[_0x3364('0x30')]=_[_0x3364('0x2f')](_0x207400[_0x3364('0x2d')],qs[_0x3364('0x31')](_0x370ad8[_0x3364('0x2e')][_0x3364('0x31')]));_0x4a6203[_0x3364('0x30')]=_0x4a6203[_0x3364('0x30')][_0x3364('0x32')]?_0x4a6203[_0x3364('0x30')]:_0x207400['model'];if(_0x370ad8[_0x3364('0x2e')][_0x3364('0x3c')]){_0x4a6203[_0x3364('0x42')]=[{'all':!![]}];}_0x4a6203=_['merge']({},_0x4a6203,_0x370ad8[_0x3364('0x43')]);return db[_0x3364('0x3d')][_0x3364('0x44')](_0x4a6203)[_0x3364('0x21')](handleEntityNotFound(_0x8d709b,null))[_0x3364('0x21')](respondWithResult(_0x8d709b,null))[_0x3364('0x3f')](handleError(_0x8d709b,null));};exports['create']=function(_0x26c091,_0x3ce451){return db[_0x3364('0x3d')][_0x3364('0x45')](_0x26c091[_0x3364('0x46')],{})['then'](respondWithResult(_0x3ce451,0xc9))[_0x3364('0x3f')](handleError(_0x3ce451,null));};exports[_0x3364('0x20')]=function(_0x5ac1af,_0x159830){if(_0x5ac1af[_0x3364('0x46')]['id']){delete _0x5ac1af[_0x3364('0x46')]['id'];}return db[_0x3364('0x3d')][_0x3364('0x44')]({'where':{'id':_0x5ac1af['params']['id']}})[_0x3364('0x21')](handleEntityNotFound(_0x159830,null))['then'](saveUpdates(_0x5ac1af['body'],null))[_0x3364('0x21')](respondWithResult(_0x159830,null))[_0x3364('0x3f')](handleError(_0x159830,null));};exports[_0x3364('0x47')]=function(_0x4bdb88,_0x4aacb6){return db[_0x3364('0x3d')][_0x3364('0x44')]({'where':{'id':_0x4bdb88[_0x3364('0x48')]['id']}})[_0x3364('0x21')](handleEntityNotFound(_0x4aacb6,null))[_0x3364('0x21')](removeEntity(_0x4aacb6,null))[_0x3364('0x3f')](handleError(_0x4aacb6,null));};exports[_0x3364('0x49')]=function(_0x3a721c,_0x570acc){return db[_0x3364('0x3d')][_0x3364('0x49')]()[_0x3364('0x21')](respondWithResult(_0x570acc,null))[_0x3364('0x3f')](handleError(_0x570acc,null));}; \ No newline at end of file +var _0x7f21=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','FaxQueueReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','rows','catch','show','keys','find','create','body','params'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0x7f21,0x95));var _0x17f2=function(_0x2c32fa,_0x277194){_0x2c32fa=_0x2c32fa-0x0;var _0x10e4b8=_0x7f21[_0x2c32fa];return _0x10e4b8;};'use strict';var pdf=require(_0x17f2('0x0'));var emlformat=require(_0x17f2('0x1'));var rimraf=require(_0x17f2('0x2'));var zipdir=require(_0x17f2('0x3'));var jsonpatch=require(_0x17f2('0x4'));var rp=require('request-promise');var moment=require(_0x17f2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x17f2('0x6'));var util=require('util');var path=require(_0x17f2('0x7'));var sox=require('sox');var csv=require(_0x17f2('0x8'));var ejs=require(_0x17f2('0x9'));var fs=require('fs');var _=require(_0x17f2('0xa'));var squel=require('squel');var crypto=require(_0x17f2('0xb'));var jsforce=require(_0x17f2('0xc'));var deskjs=require(_0x17f2('0xd'));var toCsv=require(_0x17f2('0x8'));var querystring=require(_0x17f2('0xe'));var Papa=require(_0x17f2('0xf'));var Redis=require(_0x17f2('0x10'));var authService=require(_0x17f2('0x11'));var qs=require(_0x17f2('0x12'));var as=require(_0x17f2('0x13'));var hardwareService=require(_0x17f2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x17f2('0x15'));var db=require(_0x17f2('0x16'))['db'];function respondWithStatusCode(_0x416a37,_0xab7c84){_0xab7c84=_0xab7c84||0xcc;return function(_0x58465d){if(_0x58465d){return _0x416a37['sendStatus'](_0xab7c84);}return _0x416a37[_0x17f2('0x17')](_0xab7c84)[_0x17f2('0x18')]();};}function respondWithResult(_0x18bc97,_0x22f6c2){_0x22f6c2=_0x22f6c2||0xc8;return function(_0x238496){if(_0x238496){return _0x18bc97['status'](_0x22f6c2)[_0x17f2('0x19')](_0x238496);}};}function respondWithFilteredResult(_0x57324c,_0x258347){return function(_0x4becbe){if(_0x4becbe){var _0x337437=_0x4becbe['count'],_0x30d44a=_0x258347[_0x17f2('0x1a')],_0x18f4a9=_0x258347[_0x17f2('0x1a')]+_0x258347['limit'],_0x51e3c2;if(_0x18f4a9>=_0x337437){_0x18f4a9=_0x337437;_0x51e3c2=0xc8;}else{_0x51e3c2=0xce;}_0x57324c[_0x17f2('0x17')](_0x51e3c2);return _0x57324c[_0x17f2('0x1b')](_0x17f2('0x1c'),_0x30d44a+'-'+_0x18f4a9+'/'+_0x337437)['json'](_0x4becbe);}return null;};}function patchUpdates(_0x901911){return function(_0x439e1b){try{jsonpatch[_0x17f2('0x1d')](_0x439e1b,_0x901911,!![]);}catch(_0x5bb421){return BPromise[_0x17f2('0x1e')](_0x5bb421);}return _0x439e1b[_0x17f2('0x1f')]();};}function saveUpdates(_0x3a6526,_0x4dbfe3){return function(_0x247b95){if(_0x247b95){return _0x247b95[_0x17f2('0x20')](_0x3a6526)[_0x17f2('0x21')](function(_0x27b9d1){return _0x27b9d1;});}return null;};}function removeEntity(_0xa6f088,_0x3bc000){return function(_0x1582d7){if(_0x1582d7){return _0x1582d7[_0x17f2('0x22')]()[_0x17f2('0x21')](function(){_0xa6f088['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x565fe8,_0x490771){return function(_0x195c58){if(!_0x195c58){_0x565fe8[_0x17f2('0x23')](0x194);}return _0x195c58;};}function handleError(_0xe47529,_0x363995){_0x363995=_0x363995||0x1f4;return function(_0x1e7cca){logger['error'](_0x1e7cca[_0x17f2('0x24')]);if(_0x1e7cca[_0x17f2('0x25')]){delete _0x1e7cca[_0x17f2('0x25')];}_0xe47529['status'](_0x363995)[_0x17f2('0x26')](_0x1e7cca);};}exports[_0x17f2('0x27')]=function(_0x1281b9,_0x1c2fe5){var _0xd7f276={},_0x19a314={},_0x259d53={'count':0x0,'rows':[]};var _0x12e910=_[_0x17f2('0x28')](db[_0x17f2('0x29')][_0x17f2('0x2a')],function(_0x46c389){return{'name':_0x46c389['fieldName'],'type':_0x46c389[_0x17f2('0x2b')][_0x17f2('0x2c')]};});_0x19a314['model']=_[_0x17f2('0x28')](_0x12e910,_0x17f2('0x25'));_0x19a314['query']=_['keys'](_0x1281b9[_0x17f2('0x2d')]);_0x19a314[_0x17f2('0x2e')]=_[_0x17f2('0x2f')](_0x19a314[_0x17f2('0x30')],_0x19a314[_0x17f2('0x2d')]);_0xd7f276[_0x17f2('0x31')]=_[_0x17f2('0x2f')](_0x19a314[_0x17f2('0x30')],qs[_0x17f2('0x32')](_0x1281b9[_0x17f2('0x2d')][_0x17f2('0x32')]));_0xd7f276['attributes']=_0xd7f276[_0x17f2('0x31')][_0x17f2('0x33')]?_0xd7f276[_0x17f2('0x31')]:_0x19a314[_0x17f2('0x30')];if(!_0x1281b9['query'][_0x17f2('0x34')](_0x17f2('0x35'))){_0xd7f276[_0x17f2('0x36')]=qs['limit'](_0x1281b9[_0x17f2('0x2d')][_0x17f2('0x36')]);_0xd7f276[_0x17f2('0x1a')]=qs[_0x17f2('0x1a')](_0x1281b9[_0x17f2('0x2d')]['offset']);}_0xd7f276[_0x17f2('0x37')]=qs[_0x17f2('0x38')](_0x1281b9[_0x17f2('0x2d')][_0x17f2('0x38')]);_0xd7f276[_0x17f2('0x39')]=qs[_0x17f2('0x2e')](_[_0x17f2('0x3a')](_0x1281b9[_0x17f2('0x2d')],_0x19a314['filters']),_0x12e910);if(_0x1281b9[_0x17f2('0x2d')]['filter']){_0xd7f276[_0x17f2('0x39')]=_[_0x17f2('0x3b')](_0xd7f276[_0x17f2('0x39')],{'$or':_[_0x17f2('0x28')](_0x12e910,function(_0x1decae){if(_0x1decae[_0x17f2('0x2b')]!==_0x17f2('0x3c')){var _0x4b92a6={};_0x4b92a6[_0x1decae[_0x17f2('0x25')]]={'$like':'%'+_0x1281b9[_0x17f2('0x2d')][_0x17f2('0x3d')]+'%'};return _0x4b92a6;}})});}_0xd7f276=_['merge']({},_0xd7f276,_0x1281b9[_0x17f2('0x3e')]);var _0x1dfcea={'where':_0xd7f276['where']};return db[_0x17f2('0x29')][_0x17f2('0x3f')](_0x1dfcea)[_0x17f2('0x21')](function(_0x3b81b5){_0x259d53[_0x17f2('0x3f')]=_0x3b81b5;if(_0x1281b9[_0x17f2('0x2d')][_0x17f2('0x40')]){_0xd7f276['include']=[{'all':!![]}];}return db[_0x17f2('0x29')]['findAll'](_0xd7f276);})[_0x17f2('0x21')](function(_0x5d66ae){_0x259d53[_0x17f2('0x41')]=_0x5d66ae;return _0x259d53;})[_0x17f2('0x21')](respondWithFilteredResult(_0x1c2fe5,_0xd7f276))[_0x17f2('0x42')](handleError(_0x1c2fe5,null));};exports[_0x17f2('0x43')]=function(_0x45d5f2,_0x59d30a){var _0x5cf204={'raw':!![],'where':{'id':_0x45d5f2['params']['id']}},_0x1c7d4c={};_0x1c7d4c[_0x17f2('0x30')]=_['keys'](db[_0x17f2('0x29')][_0x17f2('0x2a')]);_0x1c7d4c[_0x17f2('0x2d')]=_[_0x17f2('0x44')](_0x45d5f2[_0x17f2('0x2d')]);_0x1c7d4c[_0x17f2('0x2e')]=_[_0x17f2('0x2f')](_0x1c7d4c['model'],_0x1c7d4c[_0x17f2('0x2d')]);_0x5cf204['attributes']=_[_0x17f2('0x2f')](_0x1c7d4c[_0x17f2('0x30')],qs[_0x17f2('0x32')](_0x45d5f2[_0x17f2('0x2d')]['fields']));_0x5cf204[_0x17f2('0x31')]=_0x5cf204[_0x17f2('0x31')][_0x17f2('0x33')]?_0x5cf204[_0x17f2('0x31')]:_0x1c7d4c['model'];if(_0x45d5f2['query']['includeAll']){_0x5cf204['include']=[{'all':!![]}];}_0x5cf204=_[_0x17f2('0x3b')]({},_0x5cf204,_0x45d5f2[_0x17f2('0x3e')]);return db[_0x17f2('0x29')][_0x17f2('0x45')](_0x5cf204)['then'](handleEntityNotFound(_0x59d30a,null))[_0x17f2('0x21')](respondWithResult(_0x59d30a,null))[_0x17f2('0x42')](handleError(_0x59d30a,null));};exports['create']=function(_0x351703,_0x94de24){return db[_0x17f2('0x29')][_0x17f2('0x46')](_0x351703['body'],{})[_0x17f2('0x21')](respondWithResult(_0x94de24,0xc9))['catch'](handleError(_0x94de24,null));};exports['update']=function(_0x44472c,_0x3ef636){if(_0x44472c[_0x17f2('0x47')]['id']){delete _0x44472c[_0x17f2('0x47')]['id'];}return db[_0x17f2('0x29')][_0x17f2('0x45')]({'where':{'id':_0x44472c[_0x17f2('0x48')]['id']}})[_0x17f2('0x21')](handleEntityNotFound(_0x3ef636,null))[_0x17f2('0x21')](saveUpdates(_0x44472c['body'],null))['then'](respondWithResult(_0x3ef636,null))[_0x17f2('0x42')](handleError(_0x3ef636,null));};exports['destroy']=function(_0x348985,_0x2931b7){return db[_0x17f2('0x29')][_0x17f2('0x45')]({'where':{'id':_0x348985['params']['id']}})[_0x17f2('0x21')](handleEntityNotFound(_0x2931b7,null))[_0x17f2('0x21')](removeEntity(_0x2931b7,null))['catch'](handleError(_0x2931b7,null));};exports[_0x17f2('0x49')]=function(_0x5b3db4,_0xcc9b9a){return db[_0x17f2('0x29')][_0x17f2('0x49')]()[_0x17f2('0x21')](respondWithResult(_0xcc9b9a,null))['catch'](handleError(_0xcc9b9a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 830dc3c..e3dadec 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 _0x51de=['../../config/environment','exports','FaxQueueReport','report_fax_queue','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xd1714b,_0x5cb648){var _0x40717d=function(_0x691150){while(--_0x691150){_0xd1714b['push'](_0xd1714b['shift']());}};_0x40717d(++_0x5cb648);}(_0x51de,0x10d));var _0xe51d=function(_0x2e14ed,_0x25b30b){_0x2e14ed=_0x2e14ed-0x0;var _0x2b294c=_0x51de[_0x2e14ed];return _0x2b294c;};'use strict';var _=require('lodash');var util=require(_0xe51d('0x0'));var logger=require('../../config/logger')(_0xe51d('0x1'));var moment=require(_0xe51d('0x2'));var BPromise=require(_0xe51d('0x3'));var rp=require(_0xe51d('0x4'));var fs=require('fs');var path=require(_0xe51d('0x5'));var rimraf=require(_0xe51d('0x6'));var config=require(_0xe51d('0x7'));var attributes=require('./faxQueueReport.attributes');module[_0xe51d('0x8')]=function(_0x1796fa,_0x55baff){return _0x1796fa['define'](_0xe51d('0x9'),attributes,{'tableName':_0xe51d('0xa'),'paranoid':![],'indexes':[{'name':_0xe51d('0xb'),'fields':[_0xe51d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde6c=['api','bluebird','rimraf','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','lodash','util'];(function(_0x1dc536,_0x29c3d8){var _0x23d493=function(_0x34e48d){while(--_0x34e48d){_0x1dc536['push'](_0x1dc536['shift']());}};_0x23d493(++_0x29c3d8);}(_0xde6c,0x19c));var _0xcde6=function(_0x5a2660,_0x52e389){_0x5a2660=_0x5a2660-0x0;var _0x542d3b=_0xde6c[_0x5a2660];return _0x542d3b;};'use strict';var _=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var logger=require('../../config/logger')(_0xcde6('0x2'));var moment=require('moment');var BPromise=require(_0xcde6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcde6('0x4'));var config=require('../../config/environment');var attributes=require(_0xcde6('0x5'));module['exports']=function(_0x2454fa,_0x21a095){return _0x2454fa[_0xcde6('0x6')]('FaxQueueReport',attributes,{'tableName':_0xcde6('0x7'),'paranoid':![],'indexes':[{'name':_0xcde6('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 8495400..9b970b8 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 _0x3872=['error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','attributes','limit','UpdateFaxQueueReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x13a10e,_0x215f40){var _0x29ca7d=function(_0x49bfa4){while(--_0x49bfa4){_0x13a10e['push'](_0x13a10e['shift']());}};_0x29ca7d(++_0x215f40);}(_0x3872,0x1a8));var _0x2387=function(_0x533abd,_0x2c87e9){_0x533abd=_0x533abd-0x0;var _0x2be59a=_0x3872[_0x533abd];return _0x2be59a;};'use strict';var _=require('lodash');var util=require(_0x2387('0x0'));var moment=require(_0x2387('0x1'));var BPromise=require('bluebird');var rs=require(_0x2387('0x2'));var fs=require('fs');var Redis=require(_0x2387('0x3'));var db=require(_0x2387('0x4'))['db'];var utils=require(_0x2387('0x5'));var logger=require(_0x2387('0x6'))(_0x2387('0x7'));var config=require(_0x2387('0x8'));var jayson=require(_0x2387('0x9'));var client=jayson['client'][_0x2387('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31aa7a,_0x3ef7d6,_0x1cddee){return new BPromise(function(_0x798d7b,_0x4ddd81){return client['request'](_0x31aa7a,_0x1cddee)[_0x2387('0xb')](function(_0x5e5d6f){logger[_0x2387('0xc')](_0x2387('0xd'),_0x3ef7d6,_0x2387('0xe'));logger[_0x2387('0xf')](_0x2387('0x10'),_0x3ef7d6,_0x2387('0xe'),JSON[_0x2387('0x11')](_0x5e5d6f));if(_0x5e5d6f[_0x2387('0x12')]){if(_0x5e5d6f[_0x2387('0x12')][_0x2387('0x13')]===0x1f4){logger['error'](_0x2387('0xd'),_0x3ef7d6,_0x5e5d6f[_0x2387('0x12')][_0x2387('0x14')]);return _0x4ddd81(_0x5e5d6f[_0x2387('0x12')][_0x2387('0x14')]);}logger[_0x2387('0x12')](_0x2387('0xd'),_0x3ef7d6,_0x5e5d6f['error'][_0x2387('0x14')]);return _0x798d7b(_0x5e5d6f[_0x2387('0x12')]['message']);}else{logger[_0x2387('0xc')](_0x2387('0xd'),_0x3ef7d6,_0x2387('0xe'));_0x798d7b(_0x5e5d6f[_0x2387('0x15')][_0x2387('0x14')]);}})[_0x2387('0x16')](function(_0x1c3fd6){logger[_0x2387('0x12')](_0x2387('0xd'),_0x3ef7d6,_0x1c3fd6);_0x4ddd81(_0x1c3fd6);});});}exports[_0x2387('0x17')]=function(_0x584e5f){var _0x1c182f=this;return new Promise(function(_0x582d6a,_0x3032b2){return db[_0x2387('0x18')][_0x2387('0x19')](_0x584e5f[_0x2387('0x1a')],{'raw':_0x584e5f['options']?_0x584e5f[_0x2387('0x1b')][_0x2387('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x22ecc3){logger[_0x2387('0xc')](_0x2387('0x17'),_0x584e5f);logger[_0x2387('0xf')](_0x2387('0x17'),_0x584e5f,JSON['stringify'](_0x22ecc3));_0x582d6a(_0x22ecc3);})[_0x2387('0x16')](function(_0x519aec){logger[_0x2387('0x12')](_0x2387('0x17'),_0x519aec[_0x2387('0x14')],_0x584e5f);_0x3032b2(_0x1c182f[_0x2387('0x12')](0x1f4,_0x519aec['message']));});});};exports['UpdateFaxQueueReport']=function(_0x2e8988){var _0x703061=this;return new Promise(function(_0x2b6410,_0x47b1c2){return db['FaxQueueReport'][_0x2387('0x1d')](_0x2e8988[_0x2387('0x1a')],{'raw':_0x2e8988[_0x2387('0x1b')]?_0x2e8988[_0x2387('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e8988['options']?_0x2e8988[_0x2387('0x1b')][_0x2387('0x1e')]||null:null,'attributes':_0x2e8988[_0x2387('0x1b')]?_0x2e8988[_0x2387('0x1b')][_0x2387('0x1f')]||null:null,'limit':_0x2e8988[_0x2387('0x1b')]?_0x2e8988[_0x2387('0x1b')][_0x2387('0x20')]||null:null})['then'](function(_0x373eb){logger[_0x2387('0xc')](_0x2387('0x21'),_0x2e8988);logger['debug']('UpdateFaxQueueReport',_0x2e8988,JSON[_0x2387('0x11')](_0x373eb));_0x2b6410(_0x373eb);})['catch'](function(_0x40ab7c){logger[_0x2387('0x12')](_0x2387('0x21'),_0x40ab7c['message'],_0x2e8988);_0x47b1c2(_0x703061[_0x2387('0x12')](0x1f4,_0x40ab7c[_0x2387('0x14')]));});});}; \ No newline at end of file +var _0x1ed7=['info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','catch','UpdateFaxQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request'];(function(_0x107983,_0x1f31d6){var _0xca47cc=function(_0x115181){while(--_0x115181){_0x107983['push'](_0x107983['shift']());}};_0xca47cc(++_0x1f31d6);}(_0x1ed7,0x121));var _0x71ed=function(_0x416e13,_0x260c05){_0x416e13=_0x416e13-0x0;var _0x41e2ba=_0x1ed7[_0x416e13];return _0x41e2ba;};'use strict';var _=require(_0x71ed('0x0'));var util=require(_0x71ed('0x1'));var moment=require(_0x71ed('0x2'));var BPromise=require(_0x71ed('0x3'));var rs=require(_0x71ed('0x4'));var fs=require('fs');var Redis=require(_0x71ed('0x5'));var db=require(_0x71ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x71ed('0x7'))(_0x71ed('0x8'));var config=require(_0x71ed('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43b28a,_0x27d367,_0x493ed9){return new BPromise(function(_0xfe5417,_0x2e3048){return client[_0x71ed('0xa')](_0x43b28a,_0x493ed9)['then'](function(_0x38bac2){logger[_0x71ed('0xb')](_0x71ed('0xc'),_0x27d367,_0x71ed('0xd'));logger[_0x71ed('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x27d367,_0x71ed('0xd'),JSON[_0x71ed('0xf')](_0x38bac2));if(_0x38bac2['error']){if(_0x38bac2[_0x71ed('0x10')][_0x71ed('0x11')]===0x1f4){logger[_0x71ed('0x10')](_0x71ed('0xc'),_0x27d367,_0x38bac2[_0x71ed('0x10')][_0x71ed('0x12')]);return _0x2e3048(_0x38bac2['error'][_0x71ed('0x12')]);}logger[_0x71ed('0x10')](_0x71ed('0xc'),_0x27d367,_0x38bac2['error'][_0x71ed('0x12')]);return _0xfe5417(_0x38bac2[_0x71ed('0x10')][_0x71ed('0x12')]);}else{logger['info'](_0x71ed('0xc'),_0x27d367,'request\x20sent');_0xfe5417(_0x38bac2[_0x71ed('0x13')][_0x71ed('0x12')]);}})['catch'](function(_0x21c2b1){logger[_0x71ed('0x10')](_0x71ed('0xc'),_0x27d367,_0x21c2b1);_0x2e3048(_0x21c2b1);});});}exports[_0x71ed('0x14')]=function(_0x2b2dca){var _0x36d89f=this;return new Promise(function(_0x163087,_0x3e54da){return db[_0x71ed('0x15')][_0x71ed('0x16')](_0x2b2dca[_0x71ed('0x17')],{'raw':_0x2b2dca['options']?_0x2b2dca[_0x71ed('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2cb9c8){logger[_0x71ed('0xb')](_0x71ed('0x14'),_0x2b2dca);logger['debug'](_0x71ed('0x14'),_0x2b2dca,JSON[_0x71ed('0xf')](_0x2cb9c8));_0x163087(_0x2cb9c8);})[_0x71ed('0x19')](function(_0x46763b){logger['error'](_0x71ed('0x14'),_0x46763b['message'],_0x2b2dca);_0x3e54da(_0x36d89f['error'](0x1f4,_0x46763b[_0x71ed('0x12')]));});});};exports[_0x71ed('0x1a')]=function(_0x173842){var _0x59ae7d=this;return new Promise(function(_0x38001c,_0x379803){return db[_0x71ed('0x15')][_0x71ed('0x1b')](_0x173842[_0x71ed('0x17')],{'raw':_0x173842[_0x71ed('0x18')]?_0x173842[_0x71ed('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x173842[_0x71ed('0x18')]?_0x173842[_0x71ed('0x18')][_0x71ed('0x1c')]||null:null,'attributes':_0x173842[_0x71ed('0x18')]?_0x173842[_0x71ed('0x18')][_0x71ed('0x1d')]||null:null,'limit':_0x173842[_0x71ed('0x18')]?_0x173842['options']['limit']||null:null})['then'](function(_0x4430f4){logger[_0x71ed('0xb')]('UpdateFaxQueueReport',_0x173842);logger[_0x71ed('0xe')]('UpdateFaxQueueReport',_0x173842,JSON['stringify'](_0x4430f4));_0x38001c(_0x4430f4);})[_0x71ed('0x19')](function(_0x553bf6){logger[_0x71ed('0x10')](_0x71ed('0x1a'),_0x553bf6['message'],_0x173842);_0x379803(_0x59ae7d['error'](0x1f4,_0x553bf6[_0x71ed('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 161360e..bf08f54 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 _0x2204=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2204,0x10e));var _0x4220=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2204[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4220('0x0'));var util=require(_0x4220('0x1'));var path=require('path');var timeout=require(_0x4220('0x2'));var express=require(_0x4220('0x3'));var router=express['Router']();var auth=require(_0x4220('0x4'));var interaction=require(_0x4220('0x5'));var config=require(_0x4220('0x6'));var controller=require(_0x4220('0x7'));router[_0x4220('0x8')]('/',auth[_0x4220('0x9')](),controller[_0x4220('0xa')]);router[_0x4220('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4220('0x8')](_0x4220('0xb'),auth[_0x4220('0x9')](),controller[_0x4220('0xc')]);router['post']('/',auth[_0x4220('0x9')](),controller['create']);router[_0x4220('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4220('0xe')]);router[_0x4220('0xf')](_0x4220('0xb'),auth['isAuthenticated'](),controller[_0x4220('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3789=['../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','get','describe','/:id','post','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x190e94,_0x117fc1){var _0x3012a0=function(_0x500c69){while(--_0x500c69){_0x190e94['push'](_0x190e94['shift']());}};_0x3012a0(++_0x117fc1);}(_0x3789,0x84));var _0x9378=function(_0x5b65ff,_0x45f82f){_0x5b65ff=_0x5b65ff-0x0;var _0xb0d2e6=_0x3789[_0x5b65ff];return _0xb0d2e6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9378('0x0'));var express=require(_0x9378('0x1'));var router=express[_0x9378('0x2')]();var auth=require(_0x9378('0x3'));var interaction=require(_0x9378('0x4'));var config=require(_0x9378('0x5'));var controller=require(_0x9378('0x6'));router['get']('/',auth[_0x9378('0x7')](),controller['index']);router[_0x9378('0x8')]('/describe',auth[_0x9378('0x7')](),controller[_0x9378('0x9')]);router['get'](_0x9378('0xa'),auth[_0x9378('0x7')](),controller['show']);router[_0x9378('0xb')]('/',auth[_0x9378('0x7')](),controller['create']);router[_0x9378('0xc')](_0x9378('0xa'),auth[_0x9378('0x7')](),controller[_0x9378('0xd')]);router[_0x9378('0xe')](_0x9378('0xa'),auth[_0x9378('0x7')](),controller[_0x9378('0xf')]);module[_0x9378('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index de33761..7065195 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 _0xdbf7=['exports','STRING','ENUM','agent','queue','DATE','NOW'];(function(_0x34bfd2,_0xd8017){var _0x344102=function(_0x1b8854){while(--_0x1b8854){_0x34bfd2['push'](_0x34bfd2['shift']());}};_0x344102(++_0xd8017);}(_0xdbf7,0xb6));var _0x7dbf=function(_0x1065a9,_0x951135){_0x1065a9=_0x1065a9-0x0;var _0x2bef4d=_0xdbf7[_0x1065a9];return _0x2bef4d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x7dbf('0x0')]={'uniqueid':{'type':Sequelize[_0x7dbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7dbf('0x2')]('account',_0x7dbf('0x3'),_0x7dbf('0x4')),'allowNull':![],'defaultValue':_0x7dbf('0x4')},'transferredAt':{'type':Sequelize[_0x7dbf('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x7dbf('0x6')]}}; \ No newline at end of file +var _0x8c37=['queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x555a2e,_0x2e9dde){var _0x2b8b77=function(_0x2845e7){while(--_0x2845e7){_0x555a2e['push'](_0x555a2e['shift']());}};_0x2b8b77(++_0x2e9dde);}(_0x8c37,0x133));var _0x78c3=function(_0x1251fb,_0x57ac81){_0x1251fb=_0x1251fb-0x0;var _0x2f5b9a=_0x8c37[_0x1251fb];return _0x2f5b9a;};'use strict';var moment=require(_0x78c3('0x0'));var Sequelize=require(_0x78c3('0x1'));module[_0x78c3('0x2')]={'uniqueid':{'type':Sequelize[_0x78c3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x78c3('0x4')]('account','agent',_0x78c3('0x5')),'allowNull':![],'defaultValue':_0x78c3('0x5')},'transferredAt':{'type':Sequelize[_0x78c3('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x78c3('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index a44dab9..302de73 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 _0x5f66=['show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','FaxTransferReport','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x1853aa,_0x35e91f){var _0x4a7b08=function(_0x483de2){while(--_0x483de2){_0x1853aa['push'](_0x1853aa['shift']());}};_0x4a7b08(++_0x35e91f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]),_0x325cb4);if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['FaxTransferReport'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));};exports[_0x65f6('0x43')]=function(_0x49ba5a,_0x22d745){return db[_0x65f6('0x26')]['describe']()[_0x65f6('0x1f')](respondWithResult(_0x22d745,null))['catch'](handleError(_0x22d745,null));}; \ No newline at end of file +var _0xadb5=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','VIRTUAL','merge','options','FaxTransferReport','findAll','rows','catch','show','rawAttributes','fields','includeAll','include','find','create','body','update','describe','eml-format','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/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','destroy','stack','name','send','index'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xadb5,0xad));var _0x5adb=function(_0x5a2fae,_0x21dd65){_0x5a2fae=_0x5a2fae-0x0;var _0x29138f=_0xadb5[_0x5a2fae];return _0x29138f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];function respondWithStatusCode(_0x56012f,_0x2a0b70){_0x2a0b70=_0x2a0b70||0xcc;return function(_0x5433bf){if(_0x5433bf){return _0x56012f[_0x5adb('0x18')](_0x2a0b70);}return _0x56012f[_0x5adb('0x19')](_0x2a0b70)[_0x5adb('0x1a')]();};}function respondWithResult(_0x5c929a,_0x2a545b){_0x2a545b=_0x2a545b||0xc8;return function(_0x34af2c){if(_0x34af2c){return _0x5c929a[_0x5adb('0x19')](_0x2a545b)['json'](_0x34af2c);}};}function respondWithFilteredResult(_0x2312de,_0x518823){return function(_0x367d82){if(_0x367d82){var _0x42a482=_0x367d82[_0x5adb('0x1b')],_0x30614e=_0x518823[_0x5adb('0x1c')],_0x304784=_0x518823[_0x5adb('0x1c')]+_0x518823[_0x5adb('0x1d')],_0x1c0f97;if(_0x304784>=_0x42a482){_0x304784=_0x42a482;_0x1c0f97=0xc8;}else{_0x1c0f97=0xce;}_0x2312de['status'](_0x1c0f97);return _0x2312de[_0x5adb('0x1e')]('Content-Range',_0x30614e+'-'+_0x304784+'/'+_0x42a482)[_0x5adb('0x1f')](_0x367d82);}return null;};}function patchUpdates(_0x558f76){return function(_0x3ef465){try{jsonpatch['apply'](_0x3ef465,_0x558f76,!![]);}catch(_0x5e218c){return BPromise[_0x5adb('0x20')](_0x5e218c);}return _0x3ef465[_0x5adb('0x21')]();};}function saveUpdates(_0x438671,_0x1fd4a7){return function(_0x99bc6c){if(_0x99bc6c){return _0x99bc6c['update'](_0x438671)[_0x5adb('0x22')](function(_0x5c296e){return _0x5c296e;});}return null;};}function removeEntity(_0x4e9f16,_0x3754cc){return function(_0x379b33){if(_0x379b33){return _0x379b33[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0x4e9f16[_0x5adb('0x19')](0xcc)[_0x5adb('0x1a')]();});}};}function handleEntityNotFound(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(!_0x4b1957){_0xfd9bb9[_0x5adb('0x18')](0x194);}return _0x4b1957;};}function handleError(_0x3220cd,_0x3839fb){_0x3839fb=_0x3839fb||0x1f4;return function(_0xeb556c){logger['error'](_0xeb556c[_0x5adb('0x24')]);if(_0xeb556c[_0x5adb('0x25')]){delete _0xeb556c['name'];}_0x3220cd[_0x5adb('0x19')](_0x3839fb)[_0x5adb('0x26')](_0xeb556c);};}exports[_0x5adb('0x27')]=function(_0x55b40a,_0x13ad1d){var _0xbe21b1={},_0x3a4fca={},_0x2c64a3={'count':0x0,'rows':[]};var _0x36459b=_[_0x5adb('0x28')](db['FaxTransferReport']['rawAttributes'],function(_0x5d457e){return{'name':_0x5d457e[_0x5adb('0x29')],'type':_0x5d457e[_0x5adb('0x2a')][_0x5adb('0x2b')]};});_0x3a4fca[_0x5adb('0x2c')]=_[_0x5adb('0x28')](_0x36459b,'name');_0x3a4fca[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x55b40a[_0x5adb('0x2d')]);_0x3a4fca[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],_0x3a4fca[_0x5adb('0x2d')]);_0xbe21b1[_0x5adb('0x31')]=_[_0x5adb('0x30')](_0x3a4fca[_0x5adb('0x2c')],qs['fields'](_0x55b40a[_0x5adb('0x2d')]['fields']));_0xbe21b1[_0x5adb('0x31')]=_0xbe21b1[_0x5adb('0x31')]['length']?_0xbe21b1[_0x5adb('0x31')]:_0x3a4fca[_0x5adb('0x2c')];if(!_0x55b40a[_0x5adb('0x2d')]['hasOwnProperty'](_0x5adb('0x32'))){_0xbe21b1[_0x5adb('0x1d')]=qs['limit'](_0x55b40a['query'][_0x5adb('0x1d')]);_0xbe21b1['offset']=qs[_0x5adb('0x1c')](_0x55b40a[_0x5adb('0x2d')][_0x5adb('0x1c')]);}_0xbe21b1[_0x5adb('0x33')]=qs[_0x5adb('0x34')](_0x55b40a['query'][_0x5adb('0x34')]);_0xbe21b1[_0x5adb('0x35')]=qs[_0x5adb('0x2f')](_['pick'](_0x55b40a['query'],_0x3a4fca[_0x5adb('0x2f')]),_0x36459b);if(_0x55b40a[_0x5adb('0x2d')]['filter']){_0xbe21b1[_0x5adb('0x35')]=_['merge'](_0xbe21b1[_0x5adb('0x35')],{'$or':_['map'](_0x36459b,function(_0x11cb37){if(_0x11cb37['type']!==_0x5adb('0x36')){var _0x23a1db={};_0x23a1db[_0x11cb37['name']]={'$like':'%'+_0x55b40a[_0x5adb('0x2d')]['filter']+'%'};return _0x23a1db;}})});}_0xbe21b1=_[_0x5adb('0x37')]({},_0xbe21b1,_0x55b40a[_0x5adb('0x38')]);var _0xd5660c={'where':_0xbe21b1['where']};return db[_0x5adb('0x39')][_0x5adb('0x1b')](_0xd5660c)[_0x5adb('0x22')](function(_0x132803){_0x2c64a3[_0x5adb('0x1b')]=_0x132803;if(_0x55b40a['query']['includeAll']){_0xbe21b1['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x5adb('0x3a')](_0xbe21b1);})[_0x5adb('0x22')](function(_0x3a104a){_0x2c64a3[_0x5adb('0x3b')]=_0x3a104a;return _0x2c64a3;})[_0x5adb('0x22')](respondWithFilteredResult(_0x13ad1d,_0xbe21b1))[_0x5adb('0x3c')](handleError(_0x13ad1d,null));};exports[_0x5adb('0x3d')]=function(_0x3bf282,_0x478a70){var _0x53f2c6={'raw':!![],'where':{'id':_0x3bf282['params']['id']}},_0x27dbb7={};_0x27dbb7[_0x5adb('0x2c')]=_[_0x5adb('0x2e')](db[_0x5adb('0x39')][_0x5adb('0x3e')]);_0x27dbb7[_0x5adb('0x2d')]=_['keys'](_0x3bf282[_0x5adb('0x2d')]);_0x27dbb7[_0x5adb('0x2f')]=_['intersection'](_0x27dbb7[_0x5adb('0x2c')],_0x27dbb7[_0x5adb('0x2d')]);_0x53f2c6['attributes']=_[_0x5adb('0x30')](_0x27dbb7[_0x5adb('0x2c')],qs[_0x5adb('0x3f')](_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x3f')]));_0x53f2c6[_0x5adb('0x31')]=_0x53f2c6[_0x5adb('0x31')]['length']?_0x53f2c6['attributes']:_0x27dbb7[_0x5adb('0x2c')];if(_0x3bf282[_0x5adb('0x2d')][_0x5adb('0x40')]){_0x53f2c6[_0x5adb('0x41')]=[{'all':!![]}];}_0x53f2c6=_['merge']({},_0x53f2c6,_0x3bf282['options']);return db[_0x5adb('0x39')][_0x5adb('0x42')](_0x53f2c6)[_0x5adb('0x22')](handleEntityNotFound(_0x478a70,null))[_0x5adb('0x22')](respondWithResult(_0x478a70,null))[_0x5adb('0x3c')](handleError(_0x478a70,null));};exports['create']=function(_0x182cbc,_0x437f52){return db['FaxTransferReport'][_0x5adb('0x43')](_0x182cbc[_0x5adb('0x44')],{})[_0x5adb('0x22')](respondWithResult(_0x437f52,0xc9))[_0x5adb('0x3c')](handleError(_0x437f52,null));};exports[_0x5adb('0x45')]=function(_0x3a5409,_0x39840e){if(_0x3a5409[_0x5adb('0x44')]['id']){delete _0x3a5409['body']['id'];}return db[_0x5adb('0x39')]['find']({'where':{'id':_0x3a5409['params']['id']}})['then'](handleEntityNotFound(_0x39840e,null))[_0x5adb('0x22')](saveUpdates(_0x3a5409[_0x5adb('0x44')],null))[_0x5adb('0x22')](respondWithResult(_0x39840e,null))['catch'](handleError(_0x39840e,null));};exports[_0x5adb('0x23')]=function(_0x5cbab5,_0x177a81){return db[_0x5adb('0x39')][_0x5adb('0x42')]({'where':{'id':_0x5cbab5['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x177a81,null))['then'](removeEntity(_0x177a81,null))[_0x5adb('0x3c')](handleError(_0x177a81,null));};exports[_0x5adb('0x46')]=function(_0x55c535,_0x2402a3){return db[_0x5adb('0x39')][_0x5adb('0x46')]()[_0x5adb('0x22')](respondWithResult(_0x2402a3,null))[_0x5adb('0x3c')](handleError(_0x2402a3,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 8f24ebf..999d50e 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 _0xa7e7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid','lodash'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xa7e7,0x1ee));var _0x7a7e=function(_0x1e833f,_0x491d21){_0x1e833f=_0x1e833f-0x0;var _0x2e4869=_0xa7e7[_0x1e833f];return _0x2e4869;};'use strict';var _=require(_0x7a7e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7a7e('0x1'));var BPromise=require(_0x7a7e('0x2'));var rp=require(_0x7a7e('0x3'));var fs=require('fs');var path=require(_0x7a7e('0x4'));var rimraf=require(_0x7a7e('0x5'));var config=require(_0x7a7e('0x6'));var attributes=require(_0x7a7e('0x7'));module[_0x7a7e('0x8')]=function(_0x278796,_0x2c69d2){return _0x278796[_0x7a7e('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7a7e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6abf=['uniqueid','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x29cd78,_0x193864){var _0xd1e23b=function(_0x490232){while(--_0x490232){_0x29cd78['push'](_0x29cd78['shift']());}};_0xd1e23b(++_0x193864);}(_0x6abf,0x112));var _0xf6ab=function(_0x5a8080,_0x4889c1){_0x5a8080=_0x5a8080-0x0;var _0x5ddb35=_0x6abf[_0x5a8080];return _0x5ddb35;};'use strict';var _=require(_0xf6ab('0x0'));var util=require(_0xf6ab('0x1'));var logger=require('../../config/logger')(_0xf6ab('0x2'));var moment=require('moment');var BPromise=require(_0xf6ab('0x3'));var rp=require(_0xf6ab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6ab('0x5'));var config=require(_0xf6ab('0x6'));var attributes=require(_0xf6ab('0x7'));module[_0xf6ab('0x8')]=function(_0xf7b734,_0xeb86ca){return _0xf7b734[_0xf6ab('0x9')](_0xf6ab('0xa'),attributes,{'tableName':_0xf6ab('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf6ab('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 964ad46..42b83ba 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 _0x464b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x464b,0x127));var _0xb464=function(_0x7d0dc3,_0x5399eb){_0x7d0dc3=_0x7d0dc3-0x0;var _0xb266cc=_0x464b[_0x7d0dc3];return _0xb266cc;};'use strict';var _=require(_0xb464('0x0'));var util=require(_0xb464('0x1'));var moment=require(_0xb464('0x2'));var BPromise=require(_0xb464('0x3'));var rs=require(_0xb464('0x4'));var fs=require('fs');var Redis=require(_0xb464('0x5'));var db=require(_0xb464('0x6'))['db'];var utils=require(_0xb464('0x7'));var logger=require(_0xb464('0x8'))(_0xb464('0x9'));var config=require(_0xb464('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb464('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x424c97,_0x42c72c,_0x3648e0){return new BPromise(function(_0x4c724c,_0x453bf1){return client['request'](_0x424c97,_0x3648e0)['then'](function(_0x18ac1a){logger[_0xb464('0xc')](_0xb464('0xd'),_0x42c72c,'request\x20sent');logger[_0xb464('0xe')](_0xb464('0xf'),_0x42c72c,'request\x20sent',JSON['stringify'](_0x18ac1a));if(_0x18ac1a[_0xb464('0x10')]){if(_0x18ac1a[_0xb464('0x10')]['code']===0x1f4){logger[_0xb464('0x10')](_0xb464('0xd'),_0x42c72c,_0x18ac1a[_0xb464('0x10')][_0xb464('0x11')]);return _0x453bf1(_0x18ac1a[_0xb464('0x10')][_0xb464('0x11')]);}logger['error'](_0xb464('0xd'),_0x42c72c,_0x18ac1a[_0xb464('0x10')][_0xb464('0x11')]);return _0x4c724c(_0x18ac1a['error'][_0xb464('0x11')]);}else{logger[_0xb464('0xc')](_0xb464('0xd'),_0x42c72c,_0xb464('0x12'));_0x4c724c(_0x18ac1a['result'][_0xb464('0x11')]);}})[_0xb464('0x13')](function(_0x937591){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x42c72c,_0x937591);_0x453bf1(_0x937591);});});} \ No newline at end of file +var _0xfc2b=['FaxTransferReport,\x20%s,\x20%s','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xfc2b,0x8d));var _0xbfc2=function(_0x393eac,_0x4505f3){_0x393eac=_0x393eac-0x0;var _0x37a891=_0xfc2b[_0x393eac];return _0x37a891;};'use strict';var _=require('lodash');var util=require(_0xbfc2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbfc2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfc2('0x2'))['db'];var utils=require(_0xbfc2('0x3'));var logger=require(_0xbfc2('0x4'))(_0xbfc2('0x5'));var config=require(_0xbfc2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbfc2('0x7')][_0xbfc2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fe77e,_0x3292fa,_0xb7e1b){return new BPromise(function(_0x2e7674,_0x5aa95f){return client[_0xbfc2('0x9')](_0x2fe77e,_0xb7e1b)[_0xbfc2('0xa')](function(_0x346180){logger[_0xbfc2('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x3292fa,'request\x20sent');logger[_0xbfc2('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3292fa,_0xbfc2('0xd'),JSON[_0xbfc2('0xe')](_0x346180));if(_0x346180[_0xbfc2('0xf')]){if(_0x346180[_0xbfc2('0xf')][_0xbfc2('0x10')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x3292fa,_0x346180['error'][_0xbfc2('0x11')]);return _0x5aa95f(_0x346180[_0xbfc2('0xf')][_0xbfc2('0x11')]);}logger[_0xbfc2('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3292fa,_0x346180['error'][_0xbfc2('0x11')]);return _0x2e7674(_0x346180[_0xbfc2('0xf')]['message']);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x3292fa,'request\x20sent');_0x2e7674(_0x346180[_0xbfc2('0x12')][_0xbfc2('0x11')]);}})['catch'](function(_0x356718){logger['error'](_0xbfc2('0x13'),_0x3292fa,_0x356718);_0x5aa95f(_0x356718);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 7f06a65..715dfd5 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 _0x7416=['get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x544b6e,_0xebfac7){var _0x3f2957=function(_0x408c36){while(--_0x408c36){_0x544b6e['push'](_0x544b6e['shift']());}};_0x3f2957(++_0xebfac7);}(_0x7416,0x1f0));var _0x6741=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x7416[_0x5a19fc];return _0x34b413;};'use strict';var multer=require('multer');var util=require(_0x6741('0x0'));var path=require(_0x6741('0x1'));var timeout=require(_0x6741('0x2'));var express=require(_0x6741('0x3'));var router=express[_0x6741('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6741('0x5'));var config=require(_0x6741('0x6'));var controller=require(_0x6741('0x7'));router[_0x6741('0x8')]('/',auth['isAuthenticated'](),controller[_0x6741('0x9')]);router[_0x6741('0x8')](_0x6741('0xa'),auth[_0x6741('0xb')](),controller['describe']);router[_0x6741('0x8')](_0x6741('0xc'),auth['isAuthenticated'](),controller[_0x6741('0xd')]);router[_0x6741('0xe')]('/',auth[_0x6741('0xb')](),controller[_0x6741('0xf')]);router[_0x6741('0x10')](_0x6741('0xc'),auth[_0x6741('0xb')](),controller[_0x6741('0x11')]);router[_0x6741('0x12')](_0x6741('0xc'),auth['isAuthenticated'](),controller[_0x6741('0x13')]);module[_0x6741('0x14')]=router; \ No newline at end of file +var _0x53cf=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x53cf,0xc6));var _0xf53c=function(_0x2843b1,_0x3f0ef6){_0x2843b1=_0x2843b1-0x0;var _0x503c42=_0x53cf[_0x2843b1];return _0x503c42;};'use strict';var multer=require(_0xf53c('0x0'));var util=require(_0xf53c('0x1'));var path=require(_0xf53c('0x2'));var timeout=require(_0xf53c('0x3'));var express=require('express');var router=express[_0xf53c('0x4')]();var auth=require(_0xf53c('0x5'));var interaction=require(_0xf53c('0x6'));var config=require(_0xf53c('0x7'));var controller=require(_0xf53c('0x8'));router[_0xf53c('0x9')]('/',auth['isAuthenticated'](),controller[_0xf53c('0xa')]);router[_0xf53c('0x9')]('/describe',auth[_0xf53c('0xb')](),controller['describe']);router[_0xf53c('0x9')](_0xf53c('0xc'),auth[_0xf53c('0xb')](),controller[_0xf53c('0xd')]);router[_0xf53c('0xe')]('/',auth[_0xf53c('0xb')](),controller[_0xf53c('0xf')]);router[_0xf53c('0x10')](_0xf53c('0xc'),auth[_0xf53c('0xb')](),controller[_0xf53c('0x11')]);router[_0xf53c('0x12')](_0xf53c('0xc'),auth[_0xf53c('0xb')](),controller['destroy']);module[_0xf53c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index d8b6375..d0003a0 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 _0xbfe8=['create','put','destroy','exports','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x6c5aaf,_0x2941d4){var _0x2876c2=function(_0x4f1844){while(--_0x4f1844){_0x6c5aaf['push'](_0x6c5aaf['shift']());}};_0x2876c2(++_0x2941d4);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x4215bb,_0x122998){_0x4215bb=_0x4215bb-0x0;var _0x4e741=_0xbfe8[_0x4215bb];return _0x4e741;};'use strict';var multer=require('multer');var util=require(_0x8bfe('0x0'));var path=require('path');var timeout=require(_0x8bfe('0x1'));var express=require(_0x8bfe('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8bfe('0x3'));var config=require(_0x8bfe('0x4'));var controller=require('./intDeskAccount.controller');router[_0x8bfe('0x5')]('/',auth[_0x8bfe('0x6')](),controller[_0x8bfe('0x7')]);router['get'](_0x8bfe('0x8'),auth[_0x8bfe('0x6')](),controller[_0x8bfe('0x9')]);router[_0x8bfe('0x5')](_0x8bfe('0xa'),auth[_0x8bfe('0x6')](),controller[_0x8bfe('0xb')]);router[_0x8bfe('0x5')](_0x8bfe('0xc'),auth[_0x8bfe('0x6')](),controller[_0x8bfe('0xd')]);router[_0x8bfe('0xe')]('/',auth[_0x8bfe('0x6')](),controller[_0x8bfe('0xf')]);router[_0x8bfe('0xe')]('/:id/configurations',auth[_0x8bfe('0x6')](),controller['addConfiguration']);router[_0x8bfe('0x10')](_0x8bfe('0x8'),auth[_0x8bfe('0x6')](),controller['update']);router['delete'](_0x8bfe('0x8'),auth[_0x8bfe('0x6')](),controller[_0x8bfe('0x11')]);module[_0x8bfe('0x12')]=router; \ No newline at end of file +var _0x3c17=['path','express','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','delete','destroy','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c17,0x1a1));var _0x73c1=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x3c17[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x73c1('0x0'));var util=require('util');var path=require(_0x73c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x73c1('0x2'));var router=express[_0x73c1('0x3')]();var auth=require(_0x73c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x73c1('0x5'));var controller=require(_0x73c1('0x6'));router[_0x73c1('0x7')]('/',auth[_0x73c1('0x8')](),controller['index']);router[_0x73c1('0x7')]('/:id',auth[_0x73c1('0x8')](),controller[_0x73c1('0x9')]);router[_0x73c1('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x73c1('0xa')]);router[_0x73c1('0x7')](_0x73c1('0xb'),auth[_0x73c1('0x8')](),controller[_0x73c1('0xc')]);router[_0x73c1('0xd')]('/',auth[_0x73c1('0x8')](),controller['create']);router['post'](_0x73c1('0xe'),auth[_0x73c1('0x8')](),controller[_0x73c1('0xf')]);router[_0x73c1('0x10')]('/:id',auth[_0x73c1('0x8')](),controller['update']);router[_0x73c1('0x11')]('/:id',auth[_0x73c1('0x8')](),controller[_0x73c1('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 6dc362b..04b471b 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 _0xc089=['newTab','sequelize','STRING','basic','integrationTab'];(function(_0x14a408,_0x420aa6){var _0x100dac=function(_0x5a1ffb){while(--_0x5a1ffb){_0x14a408['push'](_0x14a408['shift']());}};_0x100dac(++_0x420aa6);}(_0xc089,0xb0));var _0x9c08=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc089[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x9c08('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c08('0x1')]},'description':{'type':Sequelize[_0x9c08('0x1')]},'username':{'type':Sequelize[_0x9c08('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0x9c08('0x2')},'password':{'type':Sequelize[_0x9c08('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x9c08('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9c08('0x1')]},'type':{'type':Sequelize['ENUM'](_0x9c08('0x3'),_0x9c08('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x65d1=['STRING','ENUM','basic','integrationTab','newTab','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x65d1,0x10d));var _0x165d=function(_0x16b667,_0xadec02){_0x16b667=_0x16b667-0x0;var _0x58620e=_0x65d1[_0x16b667];return _0x58620e;};'use strict';var Sequelize=require('sequelize');module[_0x165d('0x0')]={'name':{'type':Sequelize[_0x165d('0x1')]},'description':{'type':Sequelize[_0x165d('0x1')]},'username':{'type':Sequelize[_0x165d('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x165d('0x2')](_0x165d('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x165d('0x1')]},'consumerKey':{'type':Sequelize[_0x165d('0x1')]},'consumerSecret':{'type':Sequelize[_0x165d('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x165d('0x1')]},'serverUrl':{'type':Sequelize[_0x165d('0x1')]},'type':{'type':Sequelize[_0x165d('0x2')](_0x165d('0x4'),_0x165d('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 bd0752d..0ef6c40 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 _0x78bb=['sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskAccount,\x20%s,\x20%s','info','result','catch','end','json','count','offset','limit','status','set','Content-Range','reject','save','destroy','sendStatus','name','map','DeskAccount','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','show','params','rawAttributes','intersection','include','options','find','create','body','update','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','remoteUri','authType','username','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','_embedded','active','label','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0x78bb,0x72));var _0xb78b=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0x78bb[_0x61b3ab];return _0x57097f;};'use strict';var pdf=require(_0xb78b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb78b('0x1'));var zipdir=require(_0xb78b('0x2'));var jsonpatch=require(_0xb78b('0x3'));var rp=require(_0xb78b('0x4'));var moment=require(_0xb78b('0x5'));var BPromise=require(_0xb78b('0x6'));var Mustache=require(_0xb78b('0x7'));var util=require('util');var path=require(_0xb78b('0x8'));var sox=require(_0xb78b('0x9'));var csv=require(_0xb78b('0xa'));var ejs=require(_0xb78b('0xb'));var fs=require('fs');var _=require(_0xb78b('0xc'));var squel=require('squel');var crypto=require(_0xb78b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb78b('0xe'));var toCsv=require(_0xb78b('0xa'));var querystring=require(_0xb78b('0xf'));var Papa=require('papaparse');var Redis=require(_0xb78b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb78b('0x11'));var as=require(_0xb78b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb78b('0x13'));var utils=require(_0xb78b('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xb78b('0x15'));var jayson=require(_0xb78b('0x16'));var client=jayson[_0xb78b('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0xe562ef,_0x2370a5,_0x2feaf1){if(_0x2feaf1){var _0x2dc12b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2dc12b[_0xb78b('0x18')](_0x2370a5)){return _0xe562ef;}else{throw new db[(_0xb78b('0x19'))]['ValidationError'](_0xb78b('0x1a'));}}else{return _0xe562ef;}}function respondWithRpcPromise(_0x4beaf6,_0x4db7d2,_0x12b773,_0x134303){return new BPromise(function(_0x372b66,_0x481e6a){var _0x2672c4=_0x134303||client;return _0x2672c4['request'](_0x4beaf6,_0x12b773)[_0xb78b('0x1b')](function(_0x40ab85){logger['info']('DeskAccount,\x20%s,\x20%s',_0x4db7d2,_0xb78b('0x1c'));logger[_0xb78b('0x1d')](_0xb78b('0x1e'),_0x4db7d2,_0xb78b('0x1c'),JSON[_0xb78b('0x1f')](_0x40ab85));if(_0x40ab85[_0xb78b('0x20')]){if(_0x40ab85[_0xb78b('0x20')][_0xb78b('0x21')]===0x1f4){logger[_0xb78b('0x20')]('DeskAccount,\x20%s,\x20%s',_0x4db7d2,_0x40ab85[_0xb78b('0x20')][_0xb78b('0x22')]);return _0x481e6a(_0x40ab85[_0xb78b('0x20')]['message']);}logger[_0xb78b('0x20')](_0xb78b('0x23'),_0x4db7d2,_0x40ab85[_0xb78b('0x20')][_0xb78b('0x22')]);return _0x372b66(_0x40ab85[_0xb78b('0x20')][_0xb78b('0x22')]);}else{logger[_0xb78b('0x24')](_0xb78b('0x23'),_0x4db7d2,'request\x20sent');_0x372b66(_0x40ab85[_0xb78b('0x25')][_0xb78b('0x22')]);}})[_0xb78b('0x26')](function(_0x35dc3d){logger['error']('DeskAccount,\x20%s,\x20%s',_0x4db7d2,_0x35dc3d);_0x481e6a(_0x35dc3d);});});}function respondWithStatusCode(_0x578b7d,_0x10dcc1){_0x10dcc1=_0x10dcc1||0xcc;return function(_0x11190b){if(_0x11190b){return _0x578b7d['sendStatus'](_0x10dcc1);}return _0x578b7d['status'](_0x10dcc1)[_0xb78b('0x27')]();};}function respondWithResult(_0x2adfb2,_0xb41583){_0xb41583=_0xb41583||0xc8;return function(_0x111b2b){if(_0x111b2b){return _0x2adfb2['status'](_0xb41583)[_0xb78b('0x28')](_0x111b2b);}};}function respondWithFilteredResult(_0x54a115,_0x5b4a9d){return function(_0x5f04b4){if(_0x5f04b4){var _0x450bc6=_0x5f04b4[_0xb78b('0x29')],_0x1e3242=_0x5b4a9d[_0xb78b('0x2a')],_0x5e0784=_0x5b4a9d['offset']+_0x5b4a9d[_0xb78b('0x2b')],_0x3d1a78;if(_0x5e0784>=_0x450bc6){_0x5e0784=_0x450bc6;_0x3d1a78=0xc8;}else{_0x3d1a78=0xce;}_0x54a115[_0xb78b('0x2c')](_0x3d1a78);return _0x54a115[_0xb78b('0x2d')](_0xb78b('0x2e'),_0x1e3242+'-'+_0x5e0784+'/'+_0x450bc6)['json'](_0x5f04b4);}return null;};}function patchUpdates(_0xa79a05){return function(_0x1f9a9a){try{jsonpatch['apply'](_0x1f9a9a,_0xa79a05,!![]);}catch(_0xc4b1ce){return BPromise[_0xb78b('0x2f')](_0xc4b1ce);}return _0x1f9a9a[_0xb78b('0x30')]();};}function saveUpdates(_0x5383bf,_0x7042e1){return function(_0x3987c7){if(_0x3987c7){return _0x3987c7['update'](_0x5383bf)['then'](function(_0x32c950){return _0x32c950;});}return null;};}function removeEntity(_0x3575fa,_0x42b13a){return function(_0x229bb9){if(_0x229bb9){return _0x229bb9[_0xb78b('0x31')]()[_0xb78b('0x1b')](function(){_0x3575fa[_0xb78b('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37aabf,_0x9482c8){return function(_0x57de1f){if(!_0x57de1f){_0x37aabf[_0xb78b('0x32')](0x194);}return _0x57de1f;};}function handleError(_0x59c4cc,_0x35a72b){_0x35a72b=_0x35a72b||0x1f4;return function(_0x7ae5de){logger[_0xb78b('0x20')](_0x7ae5de['stack']);if(_0x7ae5de['name']){delete _0x7ae5de[_0xb78b('0x33')];}_0x59c4cc[_0xb78b('0x2c')](_0x35a72b)['send'](_0x7ae5de);};}exports['index']=function(_0x211975,_0x1333e2){var _0x5bce23={},_0x28dd19={},_0x412097={'count':0x0,'rows':[]};var _0x34f4b1=_[_0xb78b('0x34')](db[_0xb78b('0x35')]['rawAttributes'],function(_0x30381e){return{'name':_0x30381e[_0xb78b('0x36')],'type':_0x30381e[_0xb78b('0x37')][_0xb78b('0x38')]};});_0x28dd19[_0xb78b('0x39')]=_[_0xb78b('0x34')](_0x34f4b1,_0xb78b('0x33'));_0x28dd19[_0xb78b('0x3a')]=_[_0xb78b('0x3b')](_0x211975['query']);_0x28dd19['filters']=_['intersection'](_0x28dd19[_0xb78b('0x39')],_0x28dd19[_0xb78b('0x3a')]);_0x5bce23[_0xb78b('0x3c')]=_['intersection'](_0x28dd19[_0xb78b('0x39')],qs['fields'](_0x211975[_0xb78b('0x3a')][_0xb78b('0x3d')]));_0x5bce23['attributes']=_0x5bce23[_0xb78b('0x3c')][_0xb78b('0x3e')]?_0x5bce23['attributes']:_0x28dd19[_0xb78b('0x39')];if(!_0x211975[_0xb78b('0x3a')][_0xb78b('0x3f')](_0xb78b('0x40'))){_0x5bce23[_0xb78b('0x2b')]=qs[_0xb78b('0x2b')](_0x211975[_0xb78b('0x3a')][_0xb78b('0x2b')]);_0x5bce23[_0xb78b('0x2a')]=qs[_0xb78b('0x2a')](_0x211975[_0xb78b('0x3a')][_0xb78b('0x2a')]);}_0x5bce23[_0xb78b('0x41')]=qs[_0xb78b('0x42')](_0x211975['query'][_0xb78b('0x42')]);_0x5bce23[_0xb78b('0x43')]=qs['filters'](_[_0xb78b('0x44')](_0x211975[_0xb78b('0x3a')],_0x28dd19[_0xb78b('0x45')]),_0x34f4b1);if(_0x211975[_0xb78b('0x3a')][_0xb78b('0x46')]){_0x5bce23['where']=_['merge'](_0x5bce23['where'],{'$or':_['map'](_0x34f4b1,function(_0x4a6038){if(_0x4a6038[_0xb78b('0x37')]!==_0xb78b('0x47')){var _0x45534c={};_0x45534c[_0x4a6038[_0xb78b('0x33')]]={'$like':'%'+_0x211975[_0xb78b('0x3a')][_0xb78b('0x46')]+'%'};return _0x45534c;}})});}_0x5bce23=_[_0xb78b('0x48')]({},_0x5bce23,_0x211975['options']);var _0x527695={'where':_0x5bce23['where']};return db[_0xb78b('0x35')][_0xb78b('0x29')](_0x527695)['then'](function(_0x2eb073){_0x412097['count']=_0x2eb073;if(_0x211975[_0xb78b('0x3a')][_0xb78b('0x49')]){_0x5bce23['include']=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x5bce23);})[_0xb78b('0x1b')](function(_0x1e762b){_0x412097['rows']=_0x1e762b;return _0x412097;})[_0xb78b('0x1b')](respondWithFilteredResult(_0x1333e2,_0x5bce23))[_0xb78b('0x26')](handleError(_0x1333e2,null));};exports[_0xb78b('0x4a')]=function(_0x3d714c,_0x5e52b1){var _0x223ee1={'raw':![],'where':{'id':_0x3d714c[_0xb78b('0x4b')]['id']}},_0x2eee7b={};_0x2eee7b[_0xb78b('0x39')]=_[_0xb78b('0x3b')](db[_0xb78b('0x35')][_0xb78b('0x4c')]);_0x2eee7b['query']=_[_0xb78b('0x3b')](_0x3d714c['query']);_0x2eee7b[_0xb78b('0x45')]=_[_0xb78b('0x4d')](_0x2eee7b['model'],_0x2eee7b['query']);_0x223ee1[_0xb78b('0x3c')]=_['intersection'](_0x2eee7b[_0xb78b('0x39')],qs[_0xb78b('0x3d')](_0x3d714c[_0xb78b('0x3a')][_0xb78b('0x3d')]));_0x223ee1[_0xb78b('0x3c')]=_0x223ee1[_0xb78b('0x3c')][_0xb78b('0x3e')]?_0x223ee1[_0xb78b('0x3c')]:_0x2eee7b['model'];if(_0x3d714c['query'][_0xb78b('0x49')]){_0x223ee1[_0xb78b('0x4e')]=[{'all':!![]}];}_0x223ee1=_['merge']({},_0x223ee1,_0x3d714c[_0xb78b('0x4f')]);return db[_0xb78b('0x35')][_0xb78b('0x50')](_0x223ee1)[_0xb78b('0x1b')](handleEntityNotFound(_0x5e52b1,null))[_0xb78b('0x1b')](respondWithResult(_0x5e52b1,null))[_0xb78b('0x26')](handleError(_0x5e52b1,null));};exports[_0xb78b('0x51')]=function(_0x2d9360,_0x1040f7){return db[_0xb78b('0x35')][_0xb78b('0x51')](_0x2d9360[_0xb78b('0x52')],{})[_0xb78b('0x1b')](respondWithResult(_0x1040f7,0xc9))['catch'](handleError(_0x1040f7,null));};exports[_0xb78b('0x53')]=function(_0x169710,_0x5719d9){if(_0x169710[_0xb78b('0x52')]['id']){delete _0x169710[_0xb78b('0x52')]['id'];}return db[_0xb78b('0x35')][_0xb78b('0x50')]({'where':{'id':_0x169710[_0xb78b('0x4b')]['id']}})[_0xb78b('0x1b')](handleEntityNotFound(_0x5719d9,null))[_0xb78b('0x1b')](saveUpdates(_0x169710['body'],null))[_0xb78b('0x1b')](respondWithResult(_0x5719d9,null))['catch'](handleError(_0x5719d9,null));};exports[_0xb78b('0x31')]=function(_0x4aece8,_0x2cbc70){return db[_0xb78b('0x35')][_0xb78b('0x50')]({'where':{'id':_0x4aece8[_0xb78b('0x4b')]['id']}})[_0xb78b('0x1b')](handleEntityNotFound(_0x2cbc70,null))['then'](removeEntity(_0x2cbc70,null))['catch'](handleError(_0x2cbc70,null));};exports[_0xb78b('0x54')]=function(_0x2837fe,_0x46f4bd,_0xdc1d4a){var _0x13d30e={};var _0x2ed3c7={};var _0x1f1418;var _0x3d416c;return db[_0xb78b('0x35')][_0xb78b('0x55')]({'where':{'id':_0x2837fe[_0xb78b('0x4b')]['id']}})[_0xb78b('0x1b')](handleEntityNotFound(_0x46f4bd,null))['then'](function(_0x4042ff){if(_0x4042ff){_0x1f1418=_0x4042ff;_0x2ed3c7['model']=_[_0xb78b('0x3b')](db[_0xb78b('0x56')][_0xb78b('0x4c')]);_0x2ed3c7[_0xb78b('0x3a')]=_[_0xb78b('0x3b')](_0x2837fe[_0xb78b('0x3a')]);_0x2ed3c7[_0xb78b('0x45')]=_[_0xb78b('0x4d')](_0x2ed3c7[_0xb78b('0x39')],_0x2ed3c7['query']);_0x13d30e[_0xb78b('0x3c')]=_['intersection'](_0x2ed3c7[_0xb78b('0x39')],qs[_0xb78b('0x3d')](_0x2837fe[_0xb78b('0x3a')][_0xb78b('0x3d')]));_0x13d30e[_0xb78b('0x3c')]=_0x13d30e[_0xb78b('0x3c')][_0xb78b('0x3e')]?_0x13d30e[_0xb78b('0x3c')]:_0x2ed3c7[_0xb78b('0x39')];_0x13d30e['order']=qs['sort'](_0x2837fe['query'][_0xb78b('0x42')]);_0x13d30e['where']=qs[_0xb78b('0x45')](_['pick'](_0x2837fe[_0xb78b('0x3a')],_0x2ed3c7[_0xb78b('0x45')]));if(_0x2837fe[_0xb78b('0x3a')][_0xb78b('0x46')]){_0x13d30e[_0xb78b('0x43')]=_[_0xb78b('0x48')](_0x13d30e[_0xb78b('0x43')],{'$or':_[_0xb78b('0x34')](_0x13d30e[_0xb78b('0x3c')],function(_0x550bbb){var _0x440681={};_0x440681[_0x550bbb]={'$like':'%'+_0x2837fe[_0xb78b('0x3a')][_0xb78b('0x46')]+'%'};return _0x440681;})});}_0x13d30e=_[_0xb78b('0x48')]({},_0x13d30e,_0x2837fe['options']);return _0x1f1418['getConfigurations'](_0x13d30e);}})[_0xb78b('0x1b')](function(_0x51812d){if(_0x51812d){_0x3d416c=_0x51812d['length'];if(!_0x2837fe[_0xb78b('0x3a')][_0xb78b('0x3f')](_0xb78b('0x40'))){_0x13d30e[_0xb78b('0x2b')]=qs[_0xb78b('0x2b')](_0x2837fe['query'][_0xb78b('0x2b')]);_0x13d30e[_0xb78b('0x2a')]=qs[_0xb78b('0x2a')](_0x2837fe[_0xb78b('0x3a')][_0xb78b('0x2a')]);}return _0x1f1418['getConfigurations'](_0x13d30e);}})[_0xb78b('0x1b')](function(_0x5abc25){if(_0x5abc25){return _0x5abc25?{'count':_0x3d416c,'rows':_0x5abc25}:null;}})[_0xb78b('0x1b')](respondWithResult(_0x46f4bd,null))[_0xb78b('0x26')](handleError(_0x46f4bd,null));};exports[_0xb78b('0x57')]=function(_0x4a6dd6,_0x5cd10e,_0x3de52a){if(_0x4a6dd6[_0xb78b('0x52')]['id']){delete _0x4a6dd6[_0xb78b('0x52')]['id'];}return db[_0xb78b('0x35')][_0xb78b('0x55')]({'where':{'id':_0x4a6dd6['params']['id']}})[_0xb78b('0x1b')](handleEntityNotFound(_0x5cd10e,null))['then'](function(_0x38945c){if(_0x38945c){_0x4a6dd6[_0xb78b('0x52')][_0xb78b('0x58')]=_0x38945c['id'];_0x4a6dd6[_0xb78b('0x52')]['Subjects']=integrations[_0xb78b('0x59')](_0x4a6dd6[_0xb78b('0x52')][_0xb78b('0x5a')],_0x4a6dd6[_0xb78b('0x52')][_0xb78b('0x37')]);_0x4a6dd6['body'][_0xb78b('0x5b')]=integrations[_0xb78b('0x5c')](_0x4a6dd6[_0xb78b('0x52')][_0xb78b('0x5a')],_0x4a6dd6[_0xb78b('0x52')][_0xb78b('0x37')]);return db[_0xb78b('0x56')][_0xb78b('0x51')](_0x4a6dd6[_0xb78b('0x52')],{'include':[{'model':db[_0xb78b('0x5d')],'as':_0xb78b('0x5e')},{'model':db[_0xb78b('0x5d')],'as':_0xb78b('0x5b')}]});}return null;})[_0xb78b('0x1b')](respondWithResult(_0x5cd10e,null))[_0xb78b('0x26')](handleError(_0x5cd10e,null));};exports['getFields']=function(_0x1550f7,_0x1368b1,_0xc9628b){var _0x1ce06d=[{'name':_0xb78b('0x5f'),'label':_0xb78b('0x5f'),'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 _0x36299e='';return db[_0xb78b('0x35')]['findOne']({'where':{'id':_0x1550f7[_0xb78b('0x4b')]['id']},'attributes':['id',_0xb78b('0x60'),_0xb78b('0x61'),_0xb78b('0x62'),'password','consumerKey',_0xb78b('0x63'),_0xb78b('0x64'),_0xb78b('0x65')]})['then'](handleEntityNotFound(_0x1368b1,null))[_0xb78b('0x1b')](function(_0x62f9d6){if(_0x62f9d6){_0x36299e=_0x62f9d6['remoteUri'];var _0x534b4a=_0x36299e[_0xb78b('0x66')](-0x1);if(_0x534b4a==='/'){_0x36299e=_0x36299e[_0xb78b('0x67')](0x0,_0x36299e[_0xb78b('0x68')](_0x534b4a));}var _0x41f6a7={'method':_0xb78b('0x69'),'uri':util[_0xb78b('0x6a')](_0xb78b('0x6b'),_0x36299e),'headers':{'Content-Type':'application/json','Accept':_0xb78b('0x6c')},'json':!![]};if(_0x62f9d6[_0xb78b('0x61')]===_0xb78b('0x6d')){_0x41f6a7[_0xb78b('0x6e')]['Authorization']=util[_0xb78b('0x6a')](_0xb78b('0x6f'),new Buffer(util[_0xb78b('0x6a')](_0xb78b('0x70'),_0x62f9d6[_0xb78b('0x62')],_0x62f9d6['password']))[_0xb78b('0x71')](_0xb78b('0x72')));}return rp(_0x41f6a7)['then'](function(_0x356aa5){return _0x1ce06d['concat'](_[_0xb78b('0x34')](_0x356aa5[_0xb78b('0x73')]['entries'],function(_0x181c01){return{'id':_0x181c01[_0xb78b('0x33')],'name':_0x181c01[_0xb78b('0x33')],'type':_0x181c01[_0xb78b('0x37')],'active':_0x181c01[_0xb78b('0x74')],'label':_0x181c01[_0xb78b('0x75')],'custom':!![]};}));});}})[_0xb78b('0x1b')](function(_0x191e62){return{'count':_0x191e62[_0xb78b('0x3e')],'rows':_0x191e62};})['then'](respondWithResult(_0x1368b1,null))['catch'](function(_0x1ae4bb){var _0x309779=_0x1550f7['query'][_0xb78b('0x18')]?0x1f4:_0x1ae4bb['statusCode']||0x1f4;logger['error'](_0xb78b('0x76'),_0xb78b('0x77'),_0x309779,JSON[_0xb78b('0x1f')](_0x1ae4bb));delete _0x1ae4bb[_0xb78b('0x33')];if(_0x309779===0x191){_0x309779=0x190;}_0x1368b1['status'](_0x309779)[_0xb78b('0x78')](_0x1550f7[_0xb78b('0x3a')][_0xb78b('0x18')]?{'message':_0xb78b('0x79'),'statusCode':_0x1ae4bb[_0xb78b('0x7a')]}:_0x1ae4bb);});}; \ No newline at end of file +var _0xdf2d=['basic','headers','toString','base64','concat','entries','active','label','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','merge','findAll','rows','show','fields','includeAll','options','find','create','body','params','findOne','DeskConfiguration','pick','getConfigurations','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','username','password','tokenSecret','slice','substring','lastIndexOf','format','application/json','authType'];(function(_0xf8d692,_0x329ed7){var _0x5c709a=function(_0x558831){while(--_0x558831){_0xf8d692['push'](_0xf8d692['shift']());}};_0x5c709a(++_0x329ed7);}(_0xdf2d,0x7d));var _0xddf2=function(_0x42be47,_0x40c821){_0x42be47=_0x42be47-0x0;var _0x21de76=_0xdf2d[_0x42be47];return _0x21de76;};'use strict';var pdf=require(_0xddf2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xddf2('0x1'));var jsonpatch=require(_0xddf2('0x2'));var rp=require(_0xddf2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xddf2('0x4'));var path=require('path');var sox=require(_0xddf2('0x5'));var csv=require('to-csv');var ejs=require(_0xddf2('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xddf2('0x7'));var crypto=require(_0xddf2('0x8'));var jsforce=require(_0xddf2('0x9'));var deskjs=require(_0xddf2('0xa'));var toCsv=require(_0xddf2('0xb'));var querystring=require(_0xddf2('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddf2('0xd'));var qs=require(_0xddf2('0xe'));var as=require(_0xddf2('0xf'));var hardwareService=require(_0xddf2('0x10'));var logger=require(_0xddf2('0x11'))(_0xddf2('0x12'));var utils=require(_0xddf2('0x13'));var config=require(_0xddf2('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xddf2('0x15'));var jayson=require(_0xddf2('0x16'));var client=jayson['client'][_0xddf2('0x17')]({'port':0x232a});function checkPasswordPattern(_0x578e4c,_0x58407c,_0x269b70){if(_0x269b70){var _0x5b9677=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b9677[_0xddf2('0x18')](_0x58407c)){return _0x578e4c;}else{throw new db['Sequelize']['ValidationError'](_0xddf2('0x19'));}}else{return _0x578e4c;}}function respondWithRpcPromise(_0x4fb6de,_0x45d32a,_0x20bf70,_0x507426){return new BPromise(function(_0x19c512,_0x21de8b){var _0x271f24=_0x507426||client;return _0x271f24[_0xddf2('0x1a')](_0x4fb6de,_0x20bf70)[_0xddf2('0x1b')](function(_0x2eb9ca){logger[_0xddf2('0x1c')]('DeskAccount,\x20%s,\x20%s',_0x45d32a,'request\x20sent');logger[_0xddf2('0x1d')](_0xddf2('0x1e'),_0x45d32a,_0xddf2('0x1f'),JSON[_0xddf2('0x20')](_0x2eb9ca));if(_0x2eb9ca['error']){if(_0x2eb9ca[_0xddf2('0x21')][_0xddf2('0x22')]===0x1f4){logger[_0xddf2('0x21')](_0xddf2('0x23'),_0x45d32a,_0x2eb9ca[_0xddf2('0x21')][_0xddf2('0x24')]);return _0x21de8b(_0x2eb9ca[_0xddf2('0x21')][_0xddf2('0x24')]);}logger['error'](_0xddf2('0x23'),_0x45d32a,_0x2eb9ca[_0xddf2('0x21')]['message']);return _0x19c512(_0x2eb9ca['error'][_0xddf2('0x24')]);}else{logger[_0xddf2('0x1c')]('DeskAccount,\x20%s,\x20%s',_0x45d32a,'request\x20sent');_0x19c512(_0x2eb9ca[_0xddf2('0x25')][_0xddf2('0x24')]);}})[_0xddf2('0x26')](function(_0x35b415){logger[_0xddf2('0x21')](_0xddf2('0x23'),_0x45d32a,_0x35b415);_0x21de8b(_0x35b415);});});}function respondWithStatusCode(_0x4ee6c5,_0x496e70){_0x496e70=_0x496e70||0xcc;return function(_0x2769e7){if(_0x2769e7){return _0x4ee6c5[_0xddf2('0x27')](_0x496e70);}return _0x4ee6c5[_0xddf2('0x28')](_0x496e70)[_0xddf2('0x29')]();};}function respondWithResult(_0x291088,_0x277dd9){_0x277dd9=_0x277dd9||0xc8;return function(_0x157b24){if(_0x157b24){return _0x291088[_0xddf2('0x28')](_0x277dd9)[_0xddf2('0x2a')](_0x157b24);}};}function respondWithFilteredResult(_0x41c2f9,_0x212e3b){return function(_0x33c576){if(_0x33c576){var _0x4b7836=_0x33c576[_0xddf2('0x2b')],_0x50b119=_0x212e3b[_0xddf2('0x2c')],_0x4431f1=_0x212e3b[_0xddf2('0x2c')]+_0x212e3b[_0xddf2('0x2d')],_0x33b08c;if(_0x4431f1>=_0x4b7836){_0x4431f1=_0x4b7836;_0x33b08c=0xc8;}else{_0x33b08c=0xce;}_0x41c2f9[_0xddf2('0x28')](_0x33b08c);return _0x41c2f9[_0xddf2('0x2e')](_0xddf2('0x2f'),_0x50b119+'-'+_0x4431f1+'/'+_0x4b7836)[_0xddf2('0x2a')](_0x33c576);}return null;};}function patchUpdates(_0x17f055){return function(_0x8b0f6c){try{jsonpatch[_0xddf2('0x30')](_0x8b0f6c,_0x17f055,!![]);}catch(_0x5b8efc){return BPromise[_0xddf2('0x31')](_0x5b8efc);}return _0x8b0f6c[_0xddf2('0x32')]();};}function saveUpdates(_0x562240,_0x12e8bc){return function(_0x1b4cd2){if(_0x1b4cd2){return _0x1b4cd2['update'](_0x562240)[_0xddf2('0x1b')](function(_0x28ec15){return _0x28ec15;});}return null;};}function removeEntity(_0x3abbde,_0x336e55){return function(_0x536a60){if(_0x536a60){return _0x536a60[_0xddf2('0x33')]()[_0xddf2('0x1b')](function(){_0x3abbde[_0xddf2('0x28')](0xcc)[_0xddf2('0x29')]();});}};}function handleEntityNotFound(_0x46189a,_0x18d1c6){return function(_0x3b3743){if(!_0x3b3743){_0x46189a[_0xddf2('0x27')](0x194);}return _0x3b3743;};}function handleError(_0x1731a0,_0x267360){_0x267360=_0x267360||0x1f4;return function(_0x475aca){logger[_0xddf2('0x21')](_0x475aca[_0xddf2('0x34')]);if(_0x475aca[_0xddf2('0x35')]){delete _0x475aca[_0xddf2('0x35')];}_0x1731a0[_0xddf2('0x28')](_0x267360)[_0xddf2('0x36')](_0x475aca);};}exports[_0xddf2('0x37')]=function(_0x337cb0,_0x130de9){var _0x52d468={},_0x3e3afb={},_0x1d2280={'count':0x0,'rows':[]};var _0x24998d=_[_0xddf2('0x38')](db[_0xddf2('0x39')][_0xddf2('0x3a')],function(_0x70fe98){return{'name':_0x70fe98[_0xddf2('0x3b')],'type':_0x70fe98[_0xddf2('0x3c')][_0xddf2('0x3d')]};});_0x3e3afb['model']=_['map'](_0x24998d,_0xddf2('0x35'));_0x3e3afb['query']=_[_0xddf2('0x3e')](_0x337cb0[_0xddf2('0x3f')]);_0x3e3afb[_0xddf2('0x40')]=_['intersection'](_0x3e3afb[_0xddf2('0x41')],_0x3e3afb[_0xddf2('0x3f')]);_0x52d468[_0xddf2('0x42')]=_[_0xddf2('0x43')](_0x3e3afb[_0xddf2('0x41')],qs['fields'](_0x337cb0['query']['fields']));_0x52d468[_0xddf2('0x42')]=_0x52d468['attributes'][_0xddf2('0x44')]?_0x52d468['attributes']:_0x3e3afb[_0xddf2('0x41')];if(!_0x337cb0[_0xddf2('0x3f')][_0xddf2('0x45')](_0xddf2('0x46'))){_0x52d468[_0xddf2('0x2d')]=qs[_0xddf2('0x2d')](_0x337cb0[_0xddf2('0x3f')][_0xddf2('0x2d')]);_0x52d468[_0xddf2('0x2c')]=qs[_0xddf2('0x2c')](_0x337cb0['query'][_0xddf2('0x2c')]);}_0x52d468['order']=qs[_0xddf2('0x47')](_0x337cb0[_0xddf2('0x3f')]['sort']);_0x52d468[_0xddf2('0x48')]=qs[_0xddf2('0x40')](_['pick'](_0x337cb0['query'],_0x3e3afb[_0xddf2('0x40')]),_0x24998d);if(_0x337cb0['query'][_0xddf2('0x49')]){_0x52d468['where']=_[_0xddf2('0x4a')](_0x52d468[_0xddf2('0x48')],{'$or':_[_0xddf2('0x38')](_0x24998d,function(_0x435f3c){if(_0x435f3c[_0xddf2('0x3c')]!=='VIRTUAL'){var _0x3499ab={};_0x3499ab[_0x435f3c[_0xddf2('0x35')]]={'$like':'%'+_0x337cb0['query'][_0xddf2('0x49')]+'%'};return _0x3499ab;}})});}_0x52d468=_['merge']({},_0x52d468,_0x337cb0['options']);var _0x96793d={'where':_0x52d468[_0xddf2('0x48')]};return db[_0xddf2('0x39')]['count'](_0x96793d)[_0xddf2('0x1b')](function(_0x2453d5){_0x1d2280[_0xddf2('0x2b')]=_0x2453d5;if(_0x337cb0['query']['includeAll']){_0x52d468['include']=[{'all':!![]}];}return db[_0xddf2('0x39')][_0xddf2('0x4b')](_0x52d468);})['then'](function(_0x306c58){_0x1d2280[_0xddf2('0x4c')]=_0x306c58;return _0x1d2280;})[_0xddf2('0x1b')](respondWithFilteredResult(_0x130de9,_0x52d468))['catch'](handleError(_0x130de9,null));};exports[_0xddf2('0x4d')]=function(_0x2407a4,_0x166c38){var _0x429b28={'raw':![],'where':{'id':_0x2407a4['params']['id']}},_0x279d81={};_0x279d81[_0xddf2('0x41')]=_[_0xddf2('0x3e')](db[_0xddf2('0x39')]['rawAttributes']);_0x279d81['query']=_[_0xddf2('0x3e')](_0x2407a4['query']);_0x279d81[_0xddf2('0x40')]=_['intersection'](_0x279d81[_0xddf2('0x41')],_0x279d81[_0xddf2('0x3f')]);_0x429b28['attributes']=_['intersection'](_0x279d81['model'],qs[_0xddf2('0x4e')](_0x2407a4[_0xddf2('0x3f')][_0xddf2('0x4e')]));_0x429b28[_0xddf2('0x42')]=_0x429b28['attributes'][_0xddf2('0x44')]?_0x429b28['attributes']:_0x279d81[_0xddf2('0x41')];if(_0x2407a4[_0xddf2('0x3f')][_0xddf2('0x4f')]){_0x429b28['include']=[{'all':!![]}];}_0x429b28=_['merge']({},_0x429b28,_0x2407a4[_0xddf2('0x50')]);return db['DeskAccount'][_0xddf2('0x51')](_0x429b28)[_0xddf2('0x1b')](handleEntityNotFound(_0x166c38,null))['then'](respondWithResult(_0x166c38,null))[_0xddf2('0x26')](handleError(_0x166c38,null));};exports[_0xddf2('0x52')]=function(_0x306cab,_0x39d7f7){return db['DeskAccount'][_0xddf2('0x52')](_0x306cab['body'],{})[_0xddf2('0x1b')](respondWithResult(_0x39d7f7,0xc9))[_0xddf2('0x26')](handleError(_0x39d7f7,null));};exports['update']=function(_0x5cb07e,_0x6386ba){if(_0x5cb07e[_0xddf2('0x53')]['id']){delete _0x5cb07e[_0xddf2('0x53')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x5cb07e[_0xddf2('0x54')]['id']}})[_0xddf2('0x1b')](handleEntityNotFound(_0x6386ba,null))['then'](saveUpdates(_0x5cb07e[_0xddf2('0x53')],null))['then'](respondWithResult(_0x6386ba,null))['catch'](handleError(_0x6386ba,null));};exports[_0xddf2('0x33')]=function(_0x14c3eb,_0x53f3c0){return db['DeskAccount']['find']({'where':{'id':_0x14c3eb[_0xddf2('0x54')]['id']}})['then'](handleEntityNotFound(_0x53f3c0,null))[_0xddf2('0x1b')](removeEntity(_0x53f3c0,null))[_0xddf2('0x26')](handleError(_0x53f3c0,null));};exports['getConfigurations']=function(_0x17ddb5,_0xd25d58,_0x3978b8){var _0x4b462f={};var _0x1ebaaf={};var _0x249b24;var _0x317d52;return db[_0xddf2('0x39')][_0xddf2('0x55')]({'where':{'id':_0x17ddb5[_0xddf2('0x54')]['id']}})['then'](handleEntityNotFound(_0xd25d58,null))[_0xddf2('0x1b')](function(_0x3728de){if(_0x3728de){_0x249b24=_0x3728de;_0x1ebaaf['model']=_[_0xddf2('0x3e')](db[_0xddf2('0x56')][_0xddf2('0x3a')]);_0x1ebaaf[_0xddf2('0x3f')]=_[_0xddf2('0x3e')](_0x17ddb5['query']);_0x1ebaaf[_0xddf2('0x40')]=_[_0xddf2('0x43')](_0x1ebaaf[_0xddf2('0x41')],_0x1ebaaf[_0xddf2('0x3f')]);_0x4b462f[_0xddf2('0x42')]=_[_0xddf2('0x43')](_0x1ebaaf['model'],qs[_0xddf2('0x4e')](_0x17ddb5[_0xddf2('0x3f')]['fields']));_0x4b462f[_0xddf2('0x42')]=_0x4b462f[_0xddf2('0x42')]['length']?_0x4b462f[_0xddf2('0x42')]:_0x1ebaaf[_0xddf2('0x41')];_0x4b462f['order']=qs[_0xddf2('0x47')](_0x17ddb5['query']['sort']);_0x4b462f[_0xddf2('0x48')]=qs[_0xddf2('0x40')](_[_0xddf2('0x57')](_0x17ddb5[_0xddf2('0x3f')],_0x1ebaaf[_0xddf2('0x40')]));if(_0x17ddb5[_0xddf2('0x3f')]['filter']){_0x4b462f[_0xddf2('0x48')]=_[_0xddf2('0x4a')](_0x4b462f['where'],{'$or':_[_0xddf2('0x38')](_0x4b462f[_0xddf2('0x42')],function(_0x8081b9){var _0x882d90={};_0x882d90[_0x8081b9]={'$like':'%'+_0x17ddb5[_0xddf2('0x3f')][_0xddf2('0x49')]+'%'};return _0x882d90;})});}_0x4b462f=_['merge']({},_0x4b462f,_0x17ddb5['options']);return _0x249b24[_0xddf2('0x58')](_0x4b462f);}})['then'](function(_0x3725e7){if(_0x3725e7){_0x317d52=_0x3725e7[_0xddf2('0x44')];if(!_0x17ddb5[_0xddf2('0x3f')][_0xddf2('0x45')](_0xddf2('0x46'))){_0x4b462f[_0xddf2('0x2d')]=qs[_0xddf2('0x2d')](_0x17ddb5[_0xddf2('0x3f')]['limit']);_0x4b462f[_0xddf2('0x2c')]=qs[_0xddf2('0x2c')](_0x17ddb5[_0xddf2('0x3f')]['offset']);}return _0x249b24[_0xddf2('0x58')](_0x4b462f);}})[_0xddf2('0x1b')](function(_0x4d9e41){if(_0x4d9e41){return _0x4d9e41?{'count':_0x317d52,'rows':_0x4d9e41}:null;}})[_0xddf2('0x1b')](respondWithResult(_0xd25d58,null))[_0xddf2('0x26')](handleError(_0xd25d58,null));};exports['addConfiguration']=function(_0x3a4fe5,_0x48b228,_0x239b7a){if(_0x3a4fe5['body']['id']){delete _0x3a4fe5['body']['id'];}return db['DeskAccount'][_0xddf2('0x55')]({'where':{'id':_0x3a4fe5['params']['id']}})[_0xddf2('0x1b')](handleEntityNotFound(_0x48b228,null))[_0xddf2('0x1b')](function(_0x2d21f6){if(_0x2d21f6){_0x3a4fe5['body']['AccountId']=_0x2d21f6['id'];_0x3a4fe5[_0xddf2('0x53')][_0xddf2('0x59')]=integrations[_0xddf2('0x5a')](_0x3a4fe5[_0xddf2('0x53')]['channel'],_0x3a4fe5[_0xddf2('0x53')][_0xddf2('0x3c')]);_0x3a4fe5[_0xddf2('0x53')][_0xddf2('0x5b')]=integrations[_0xddf2('0x5c')](_0x3a4fe5[_0xddf2('0x53')][_0xddf2('0x5d')],_0x3a4fe5[_0xddf2('0x53')][_0xddf2('0x3c')]);return db[_0xddf2('0x56')][_0xddf2('0x52')](_0x3a4fe5[_0xddf2('0x53')],{'include':[{'model':db[_0xddf2('0x5e')],'as':_0xddf2('0x59')},{'model':db['DeskField'],'as':_0xddf2('0x5b')}]});}return null;})[_0xddf2('0x1b')](respondWithResult(_0x48b228,null))[_0xddf2('0x26')](handleError(_0x48b228,null));};exports[_0xddf2('0x5f')]=function(_0x5a7162,_0xc0fefe,_0x5f2582){var _0x519a32=[{'name':_0xddf2('0x60'),'label':_0xddf2('0x60'),'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 _0x8624a9='';return db[_0xddf2('0x39')][_0xddf2('0x55')]({'where':{'id':_0x5a7162['params']['id']},'attributes':['id',_0xddf2('0x61'),'authType',_0xddf2('0x62'),_0xddf2('0x63'),'consumerKey','consumerSecret','token',_0xddf2('0x64')]})[_0xddf2('0x1b')](handleEntityNotFound(_0xc0fefe,null))[_0xddf2('0x1b')](function(_0x18d3f1){if(_0x18d3f1){_0x8624a9=_0x18d3f1[_0xddf2('0x61')];var _0x3fe41e=_0x8624a9[_0xddf2('0x65')](-0x1);if(_0x3fe41e==='/'){_0x8624a9=_0x8624a9[_0xddf2('0x66')](0x0,_0x8624a9[_0xddf2('0x67')](_0x3fe41e));}var _0x1f0abf={'method':'GET','uri':util[_0xddf2('0x68')]('%s/custom_fields',_0x8624a9),'headers':{'Content-Type':_0xddf2('0x69'),'Accept':'application/json'},'json':!![]};if(_0x18d3f1[_0xddf2('0x6a')]===_0xddf2('0x6b')){_0x1f0abf[_0xddf2('0x6c')]['Authorization']=util[_0xddf2('0x68')]('Basic\x20%s',new Buffer(util[_0xddf2('0x68')]('%s:%s',_0x18d3f1[_0xddf2('0x62')],_0x18d3f1[_0xddf2('0x63')]))[_0xddf2('0x6d')](_0xddf2('0x6e')));}return rp(_0x1f0abf)['then'](function(_0x189f9e){return _0x519a32[_0xddf2('0x6f')](_[_0xddf2('0x38')](_0x189f9e['_embedded'][_0xddf2('0x70')],function(_0x5b5257){return{'id':_0x5b5257[_0xddf2('0x35')],'name':_0x5b5257['name'],'type':_0x5b5257[_0xddf2('0x3c')],'active':_0x5b5257[_0xddf2('0x71')],'label':_0x5b5257[_0xddf2('0x72')],'custom':!![]};}));});}})[_0xddf2('0x1b')](function(_0x3fad9e){return{'count':_0x3fad9e[_0xddf2('0x44')],'rows':_0x3fad9e};})[_0xddf2('0x1b')](respondWithResult(_0xc0fefe,null))[_0xddf2('0x26')](function(_0x2af893){var _0x5ec2e6=_0x5a7162[_0xddf2('0x3f')][_0xddf2('0x18')]?0x1f4:_0x2af893['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xddf2('0x5f'),_0x5ec2e6,JSON[_0xddf2('0x20')](_0x2af893));delete _0x2af893[_0xddf2('0x35')];if(_0x5ec2e6===0x191){_0x5ec2e6=0x190;}_0xc0fefe[_0xddf2('0x28')](_0x5ec2e6)[_0xddf2('0x36')](_0x5a7162[_0xddf2('0x3f')]['test']?{'message':_0xddf2('0x73'),'statusCode':_0x2af893['statusCode']}:_0x2af893);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5924b89..d6d2fae 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 _0xd37d=['DeskAccount','int_desk_accounts','util','bluebird','request-promise','./intDeskAccount.attributes','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xd37d,0xcd));var _0xdd37=function(_0x54f978,_0x3a6b7e){_0x54f978=_0x54f978-0x0;var _0x5d40b3=_0xd37d[_0x54f978];return _0x5d40b3;};'use strict';var _=require('lodash');var util=require(_0xdd37('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdd37('0x1'));var rp=require(_0xdd37('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdd37('0x3'));var integrations=require('../../components/integrations/configuration');module[_0xdd37('0x4')]=function(_0x19848f,_0xd95edc){return _0x19848f['define'](_0xdd37('0x5'),attributes,{'tableName':_0xdd37('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12a2=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d0556,_0x320b1a){var _0x32272f=function(_0x2de3ab){while(--_0x2de3ab){_0x4d0556['push'](_0x4d0556['shift']());}};_0x32272f(++_0x320b1a);}(_0x12a2,0x1bf));var _0x212a=function(_0x16476b,_0x44cf5e){_0x16476b=_0x16476b-0x0;var _0xbfe31b=_0x12a2[_0x16476b];return _0xbfe31b;};'use strict';var _=require(_0x212a('0x0'));var util=require('util');var logger=require(_0x212a('0x1'))(_0x212a('0x2'));var moment=require(_0x212a('0x3'));var BPromise=require(_0x212a('0x4'));var rp=require(_0x212a('0x5'));var fs=require('fs');var path=require(_0x212a('0x6'));var rimraf=require(_0x212a('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x212a('0x8'));module[_0x212a('0x9')]=function(_0x2823d9,_0x507139){return _0x2823d9[_0x212a('0xa')](_0x212a('0xb'),attributes,{'tableName':_0x212a('0xc'),'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 fe82c5a..4cd7c77 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 _0x0c4a=['rpc','../../config/environment','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','include','map','model','attributes','then','info','ShowDeskAccount','find','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0x0c4a,0x166));var _0xa0c4=function(_0x5a564d,_0x2a2cdc){_0x5a564d=_0x5a564d-0x0;var _0x35d31d=_0x0c4a[_0x5a564d];return _0x35d31d;};'use strict';var _=require('lodash');var util=require(_0xa0c4('0x0'));var moment=require(_0xa0c4('0x1'));var BPromise=require(_0xa0c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0c4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa0c4('0x4'))(_0xa0c4('0x5'));var config=require(_0xa0c4('0x6'));var jayson=require(_0xa0c4('0x7'));var client=jayson[_0xa0c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x126f9f,_0x139678,_0x421d06){return new BPromise(function(_0x3869bd,_0x5a3f41){return client[_0xa0c4('0x9')](_0x126f9f,_0x421d06)['then'](function(_0x14553e){logger['info'](_0xa0c4('0xa'),_0x139678,_0xa0c4('0xb'));logger[_0xa0c4('0xc')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x139678,_0xa0c4('0xb'),JSON[_0xa0c4('0xd')](_0x14553e));if(_0x14553e[_0xa0c4('0xe')]){if(_0x14553e[_0xa0c4('0xe')][_0xa0c4('0xf')]===0x1f4){logger['error'](_0xa0c4('0xa'),_0x139678,_0x14553e[_0xa0c4('0xe')][_0xa0c4('0x10')]);return _0x5a3f41(_0x14553e[_0xa0c4('0xe')]['message']);}logger['error'](_0xa0c4('0xa'),_0x139678,_0x14553e[_0xa0c4('0xe')][_0xa0c4('0x10')]);return _0x3869bd(_0x14553e[_0xa0c4('0xe')][_0xa0c4('0x10')]);}else{logger['info'](_0xa0c4('0xa'),_0x139678,_0xa0c4('0xb'));_0x3869bd(_0x14553e[_0xa0c4('0x11')]['message']);}})[_0xa0c4('0x12')](function(_0xbf9e96){logger[_0xa0c4('0xe')](_0xa0c4('0xa'),_0x139678,_0xbf9e96);_0x5a3f41(_0xbf9e96);});});}exports[_0xa0c4('0x13')]=function(_0x28e231){var _0x10c173=this;return new Promise(function(_0x477ab7,_0x35604f){return db[_0xa0c4('0x14')][_0xa0c4('0x15')]({'raw':_0x28e231['options']?_0x28e231[_0xa0c4('0x16')][_0xa0c4('0x17')]===undefined?!![]:![]:!![],'where':_0x28e231[_0xa0c4('0x16')]?_0x28e231['options'][_0xa0c4('0x18')]||null:null,'attributes':_0x28e231['options']?_0x28e231['options']['attributes']||null:null,'limit':_0x28e231[_0xa0c4('0x16')]?_0x28e231['options']['limit']||null:null,'include':_0x28e231[_0xa0c4('0x16')]?_0x28e231[_0xa0c4('0x16')][_0xa0c4('0x19')]?_[_0xa0c4('0x1a')](_0x28e231['options'][_0xa0c4('0x19')],function(_0x301ff7){return{'model':db[_0x301ff7[_0xa0c4('0x1b')]],'as':_0x301ff7['as'],'attributes':_0x301ff7[_0xa0c4('0x1c')],'include':_0x301ff7[_0xa0c4('0x19')]?_[_0xa0c4('0x1a')](_0x301ff7[_0xa0c4('0x19')],function(_0x4ece07){return{'model':db[_0x4ece07[_0xa0c4('0x1b')]],'as':_0x4ece07['as'],'attributes':_0x4ece07[_0xa0c4('0x1c')],'include':_0x4ece07['include']?_[_0xa0c4('0x1a')](_0x4ece07[_0xa0c4('0x19')],function(_0x8d61a3){return{'model':db[_0x8d61a3[_0xa0c4('0x1b')]],'as':_0x8d61a3['as'],'attributes':_0x8d61a3['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0c4('0x1d')](function(_0x1306f8){logger[_0xa0c4('0x1e')](_0xa0c4('0x13'),_0x28e231);logger[_0xa0c4('0xc')](_0xa0c4('0x13'),_0x28e231,JSON['stringify'](_0x1306f8));_0x477ab7(_0x1306f8);})[_0xa0c4('0x12')](function(_0x16c143){logger[_0xa0c4('0xe')]('GetDeskAccount',_0x16c143['message'],_0x28e231);_0x35604f(_0x10c173['error'](0x1f4,_0x16c143[_0xa0c4('0x10')]));});});};exports[_0xa0c4('0x1f')]=function(_0x59e39d){var _0x5a7548=this;return new Promise(function(_0x421eb6,_0x2cb8){return db[_0xa0c4('0x14')][_0xa0c4('0x20')]({'raw':_0x59e39d[_0xa0c4('0x16')]?_0x59e39d['options'][_0xa0c4('0x17')]===undefined?!![]:![]:!![],'where':_0x59e39d[_0xa0c4('0x16')]?_0x59e39d[_0xa0c4('0x16')]['where']||null:null,'attributes':_0x59e39d['options']?_0x59e39d[_0xa0c4('0x16')][_0xa0c4('0x1c')]||null:null,'include':_0x59e39d['options']?_0x59e39d[_0xa0c4('0x16')]['include']?_[_0xa0c4('0x1a')](_0x59e39d[_0xa0c4('0x16')][_0xa0c4('0x19')],function(_0x18060f){return{'model':db[_0x18060f['model']],'as':_0x18060f['as'],'attributes':_0x18060f[_0xa0c4('0x1c')],'include':_0x18060f['include']?_['map'](_0x18060f[_0xa0c4('0x19')],function(_0x2e91ae){return{'model':db[_0x2e91ae[_0xa0c4('0x1b')]],'as':_0x2e91ae['as'],'attributes':_0x2e91ae['attributes'],'include':_0x2e91ae[_0xa0c4('0x19')]?_['map'](_0x2e91ae[_0xa0c4('0x19')],function(_0x554510){return{'model':db[_0x554510[_0xa0c4('0x1b')]],'as':_0x554510['as'],'attributes':_0x554510['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0c4('0x1d')](function(_0x2017eb){logger[_0xa0c4('0x1e')](_0xa0c4('0x1f'),_0x59e39d);logger['debug'](_0xa0c4('0x1f'),_0x59e39d,JSON[_0xa0c4('0xd')](_0x2017eb));_0x421eb6(_0x2017eb);})['catch'](function(_0x558f6f){logger['error'](_0xa0c4('0x1f'),_0x558f6f[_0xa0c4('0x10')],_0x59e39d);_0x2cb8(_0x5a7548[_0xa0c4('0xe')](0x1f4,_0x558f6f[_0xa0c4('0x10')]));});});}; \ No newline at end of file +var _0x7bcd=['../../config/environment','jayson/promise','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','attributes','limit','include','map','model','find','raw','ShowDeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3a465a,_0x3e8001){var _0x1ed244=function(_0x1349e9){while(--_0x1349e9){_0x3a465a['push'](_0x3a465a['shift']());}};_0x1ed244(++_0x3e8001);}(_0x7bcd,0x138));var _0xd7bc=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0x7bcd[_0x4cfa2e];return _0x279b50;};'use strict';var _=require(_0xd7bc('0x0'));var util=require(_0xd7bc('0x1'));var moment=require(_0xd7bc('0x2'));var BPromise=require('bluebird');var rs=require(_0xd7bc('0x3'));var fs=require('fs');var Redis=require(_0xd7bc('0x4'));var db=require(_0xd7bc('0x5'))['db'];var utils=require(_0xd7bc('0x6'));var logger=require('../../config/logger')(_0xd7bc('0x7'));var config=require(_0xd7bc('0x8'));var jayson=require(_0xd7bc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f58e0,_0x46774b,_0x24c627){return new BPromise(function(_0x524dd6,_0x231d11){return client['request'](_0x2f58e0,_0x24c627)[_0xd7bc('0xa')](function(_0x3289d4){logger[_0xd7bc('0xb')](_0xd7bc('0xc'),_0x46774b,_0xd7bc('0xd'));logger[_0xd7bc('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x46774b,_0xd7bc('0xd'),JSON[_0xd7bc('0xf')](_0x3289d4));if(_0x3289d4['error']){if(_0x3289d4['error']['code']===0x1f4){logger[_0xd7bc('0x10')](_0xd7bc('0xc'),_0x46774b,_0x3289d4[_0xd7bc('0x10')][_0xd7bc('0x11')]);return _0x231d11(_0x3289d4[_0xd7bc('0x10')][_0xd7bc('0x11')]);}logger['error'](_0xd7bc('0xc'),_0x46774b,_0x3289d4[_0xd7bc('0x10')][_0xd7bc('0x11')]);return _0x524dd6(_0x3289d4[_0xd7bc('0x10')][_0xd7bc('0x11')]);}else{logger['info'](_0xd7bc('0xc'),_0x46774b,_0xd7bc('0xd'));_0x524dd6(_0x3289d4[_0xd7bc('0x12')][_0xd7bc('0x11')]);}})[_0xd7bc('0x13')](function(_0x2c2109){logger[_0xd7bc('0x10')]('DeskAccount,\x20%s,\x20%s',_0x46774b,_0x2c2109);_0x231d11(_0x2c2109);});});}exports[_0xd7bc('0x14')]=function(_0x4c5af9){var _0x7636e4=this;return new Promise(function(_0x44e8d2,_0x259e1e){return db[_0xd7bc('0x15')][_0xd7bc('0x16')]({'raw':_0x4c5af9[_0xd7bc('0x17')]?_0x4c5af9[_0xd7bc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4c5af9['options']?_0x4c5af9[_0xd7bc('0x17')]['where']||null:null,'attributes':_0x4c5af9[_0xd7bc('0x17')]?_0x4c5af9['options'][_0xd7bc('0x18')]||null:null,'limit':_0x4c5af9[_0xd7bc('0x17')]?_0x4c5af9[_0xd7bc('0x17')][_0xd7bc('0x19')]||null:null,'include':_0x4c5af9[_0xd7bc('0x17')]?_0x4c5af9['options'][_0xd7bc('0x1a')]?_['map'](_0x4c5af9[_0xd7bc('0x17')][_0xd7bc('0x1a')],function(_0x5c922c){return{'model':db[_0x5c922c['model']],'as':_0x5c922c['as'],'attributes':_0x5c922c[_0xd7bc('0x18')],'include':_0x5c922c[_0xd7bc('0x1a')]?_[_0xd7bc('0x1b')](_0x5c922c['include'],function(_0x19e704){return{'model':db[_0x19e704[_0xd7bc('0x1c')]],'as':_0x19e704['as'],'attributes':_0x19e704['attributes'],'include':_0x19e704['include']?_[_0xd7bc('0x1b')](_0x19e704[_0xd7bc('0x1a')],function(_0x3b9794){return{'model':db[_0x3b9794['model']],'as':_0x3b9794['as'],'attributes':_0x3b9794['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7bc('0xa')](function(_0xb05e10){logger[_0xd7bc('0xb')]('GetDeskAccount',_0x4c5af9);logger['debug']('GetDeskAccount',_0x4c5af9,JSON[_0xd7bc('0xf')](_0xb05e10));_0x44e8d2(_0xb05e10);})[_0xd7bc('0x13')](function(_0x40912e){logger[_0xd7bc('0x10')](_0xd7bc('0x14'),_0x40912e[_0xd7bc('0x11')],_0x4c5af9);_0x259e1e(_0x7636e4[_0xd7bc('0x10')](0x1f4,_0x40912e[_0xd7bc('0x11')]));});});};exports['ShowDeskAccount']=function(_0x5e80e3){var _0x10b263=this;return new Promise(function(_0x5e2152,_0xd37a4e){return db[_0xd7bc('0x15')][_0xd7bc('0x1d')]({'raw':_0x5e80e3[_0xd7bc('0x17')]?_0x5e80e3['options'][_0xd7bc('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e80e3[_0xd7bc('0x17')]?_0x5e80e3[_0xd7bc('0x17')]['where']||null:null,'attributes':_0x5e80e3['options']?_0x5e80e3['options']['attributes']||null:null,'include':_0x5e80e3[_0xd7bc('0x17')]?_0x5e80e3['options'][_0xd7bc('0x1a')]?_['map'](_0x5e80e3[_0xd7bc('0x17')][_0xd7bc('0x1a')],function(_0x4a9c45){return{'model':db[_0x4a9c45[_0xd7bc('0x1c')]],'as':_0x4a9c45['as'],'attributes':_0x4a9c45['attributes'],'include':_0x4a9c45[_0xd7bc('0x1a')]?_[_0xd7bc('0x1b')](_0x4a9c45[_0xd7bc('0x1a')],function(_0x5b04fe){return{'model':db[_0x5b04fe['model']],'as':_0x5b04fe['as'],'attributes':_0x5b04fe[_0xd7bc('0x18')],'include':_0x5b04fe[_0xd7bc('0x1a')]?_[_0xd7bc('0x1b')](_0x5b04fe[_0xd7bc('0x1a')],function(_0x152a15){return{'model':db[_0x152a15[_0xd7bc('0x1c')]],'as':_0x152a15['as'],'attributes':_0x152a15[_0xd7bc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd7bc('0xa')](function(_0x33b61d){logger[_0xd7bc('0xb')](_0xd7bc('0x1f'),_0x5e80e3);logger[_0xd7bc('0xe')]('ShowDeskAccount',_0x5e80e3,JSON[_0xd7bc('0xf')](_0x33b61d));_0x5e2152(_0x33b61d);})['catch'](function(_0x2367ec){logger[_0xd7bc('0x10')](_0xd7bc('0x1f'),_0x2367ec[_0xd7bc('0x11')],_0x5e80e3);_0xd37a4e(_0x10b263[_0xd7bc('0x10')](0x1f4,_0x2367ec[_0xd7bc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 89f5eda..efef1fa 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 _0x7958=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','index','/:id','show','/:id/fields'];(function(_0x586f1f,_0x13d57a){var _0xbfece6=function(_0x2fa7ea){while(--_0x2fa7ea){_0x586f1f['push'](_0x586f1f['shift']());}};_0xbfece6(++_0x13d57a);}(_0x7958,0x126));var _0x8795=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7958[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var path=require('path');var timeout=require(_0x8795('0x2'));var express=require(_0x8795('0x3'));var router=express[_0x8795('0x4')]();var auth=require(_0x8795('0x5'));var interaction=require(_0x8795('0x6'));var config=require(_0x8795('0x7'));var controller=require(_0x8795('0x8'));router[_0x8795('0x9')]('/',auth['isAuthenticated'](),controller[_0x8795('0xa')]);router[_0x8795('0x9')](_0x8795('0xb'),auth['isAuthenticated'](),controller[_0x8795('0xc')]);router['get'](_0x8795('0xd'),auth[_0x8795('0xe')](),controller[_0x8795('0xf')]);router[_0x8795('0x9')](_0x8795('0x10'),auth[_0x8795('0xe')](),controller[_0x8795('0x11')]);router[_0x8795('0x9')](_0x8795('0x12'),auth[_0x8795('0xe')](),controller[_0x8795('0x13')]);router[_0x8795('0x9')](_0x8795('0x14'),auth['isAuthenticated'](),controller[_0x8795('0x15')]);router[_0x8795('0x16')]('/',auth[_0x8795('0xe')](),controller[_0x8795('0x17')]);router[_0x8795('0x16')](_0x8795('0x14'),auth[_0x8795('0xe')](),controller['setTags']);router['put']('/:id',auth[_0x8795('0xe')](),controller[_0x8795('0x18')]);router[_0x8795('0x19')](_0x8795('0xb'),auth[_0x8795('0xe')](),controller[_0x8795('0x1a')]);module[_0x8795('0x1b')]=router; \ No newline at end of file +var _0xe558=['/:id/fields','getFields','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xe558,0x70));var _0x8e55=function(_0xc37b6b,_0x12b8ed){_0xc37b6b=_0xc37b6b-0x0;var _0x2048dc=_0xe558[_0xc37b6b];return _0x2048dc;};'use strict';var multer=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var path=require(_0x8e55('0x2'));var timeout=require(_0x8e55('0x3'));var express=require(_0x8e55('0x4'));var router=express[_0x8e55('0x5')]();var auth=require(_0x8e55('0x6'));var interaction=require(_0x8e55('0x7'));var config=require(_0x8e55('0x8'));var controller=require('./intDeskConfiguration.controller');router[_0x8e55('0x9')]('/',auth[_0x8e55('0xa')](),controller[_0x8e55('0xb')]);router[_0x8e55('0x9')](_0x8e55('0xc'),auth[_0x8e55('0xa')](),controller['show']);router[_0x8e55('0x9')](_0x8e55('0xd'),auth['isAuthenticated'](),controller[_0x8e55('0xe')]);router['get']('/:id/subjects',auth[_0x8e55('0xa')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x8e55('0xa')](),controller[_0x8e55('0xf')]);router[_0x8e55('0x9')](_0x8e55('0x10'),auth['isAuthenticated'](),controller[_0x8e55('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8e55('0x12')]('/:id/tags',auth[_0x8e55('0xa')](),controller[_0x8e55('0x13')]);router[_0x8e55('0x14')](_0x8e55('0xc'),auth[_0x8e55('0xa')](),controller[_0x8e55('0x15')]);router[_0x8e55('0x16')](_0x8e55('0xc'),auth[_0x8e55('0xa')](),controller[_0x8e55('0x17')]);module[_0x8e55('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 1e43c03..920e533 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 _0x4bc6=['exports','STRING','sequelize'];(function(_0x2697ed,_0x5a95be){var _0x4e7fd4=function(_0xe48bc1){while(--_0xe48bc1){_0x2697ed['push'](_0x2697ed['shift']());}};_0x4e7fd4(++_0x5a95be);}(_0x4bc6,0x161));var _0x64bc=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4bc6[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x64bc('0x0'));module[_0x64bc('0x1')]={'name':{'type':Sequelize[_0x64bc('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe49c=['sequelize','exports','STRING'];(function(_0x442650,_0x4ccd30){var _0x408d52=function(_0x4fc5ce){while(--_0x4fc5ce){_0x442650['push'](_0x442650['shift']());}};_0x408d52(++_0x4ccd30);}(_0xe49c,0x189));var _0xce49=function(_0xd58fc1,_0x1d931c){_0xd58fc1=_0xd58fc1-0x0;var _0xc71c40=_0xe49c[_0xd58fc1];return _0xc71c40;};'use strict';var Sequelize=require(_0xce49('0x0'));module[_0xce49('0x1')]={'name':{'type':Sequelize[_0xce49('0x2')]},'description':{'type':Sequelize[_0xce49('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e296b89..e5fc814 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 _0x9224=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','limit','Content-Range','apply','then','destroy','end','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','length','find','create','update','body','params','findOne','DeskField','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','http','test','Sequelize'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x9224,0xa3));var _0x4922=function(_0x3dedc6,_0x1d2125){_0x3dedc6=_0x3dedc6-0x0;var _0xf95121=_0x9224[_0x3dedc6];return _0xf95121;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4922('0x0'));var rimraf=require(_0x4922('0x1'));var zipdir=require(_0x4922('0x2'));var jsonpatch=require(_0x4922('0x3'));var rp=require(_0x4922('0x4'));var moment=require(_0x4922('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4922('0x6'));var sox=require('sox');var csv=require(_0x4922('0x7'));var ejs=require(_0x4922('0x8'));var fs=require('fs');var _=require(_0x4922('0x9'));var squel=require(_0x4922('0xa'));var crypto=require(_0x4922('0xb'));var jsforce=require(_0x4922('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4922('0x7'));var querystring=require(_0x4922('0xd'));var Papa=require('papaparse');var Redis=require(_0x4922('0xe'));var authService=require(_0x4922('0xf'));var qs=require(_0x4922('0x10'));var as=require(_0x4922('0x11'));var hardwareService=require(_0x4922('0x12'));var logger=require(_0x4922('0x13'))(_0x4922('0x14'));var utils=require(_0x4922('0x15'));var config=require('../../config/environment');var db=require(_0x4922('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4922('0x17')][_0x4922('0x18')]({'port':0x232a});function checkPasswordPattern(_0x35ca3d,_0x3e8ba3,_0x11ba0f){if(_0x11ba0f){var _0x51bebd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51bebd[_0x4922('0x19')](_0x3e8ba3)){return _0x35ca3d;}else{throw new db[(_0x4922('0x1a'))]['ValidationError'](_0x4922('0x1b'));}}else{return _0x35ca3d;}}function respondWithRpcPromise(_0x24bf4d,_0x15bf3a,_0x3010bb,_0x434f62){return new BPromise(function(_0x4385d2,_0x337046){var _0x4d2b8b=_0x434f62||client;return _0x4d2b8b[_0x4922('0x1c')](_0x24bf4d,_0x3010bb)['then'](function(_0x15fe9e){logger[_0x4922('0x1d')](_0x4922('0x1e'),_0x15bf3a,_0x4922('0x1f'));logger[_0x4922('0x20')](_0x4922('0x21'),_0x15bf3a,'request\x20sent',JSON[_0x4922('0x22')](_0x15fe9e));if(_0x15fe9e[_0x4922('0x23')]){if(_0x15fe9e[_0x4922('0x23')][_0x4922('0x24')]===0x1f4){logger[_0x4922('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x15bf3a,_0x15fe9e[_0x4922('0x23')][_0x4922('0x25')]);return _0x337046(_0x15fe9e[_0x4922('0x23')][_0x4922('0x25')]);}logger[_0x4922('0x23')](_0x4922('0x1e'),_0x15bf3a,_0x15fe9e[_0x4922('0x23')][_0x4922('0x25')]);return _0x4385d2(_0x15fe9e['error'][_0x4922('0x25')]);}else{logger[_0x4922('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x15bf3a,_0x4922('0x1f'));_0x4385d2(_0x15fe9e[_0x4922('0x26')]['message']);}})[_0x4922('0x27')](function(_0x4a4fa0){logger[_0x4922('0x23')](_0x4922('0x1e'),_0x15bf3a,_0x4a4fa0);_0x337046(_0x4a4fa0);});});}function respondWithStatusCode(_0x26bb17,_0x4ee748){_0x4ee748=_0x4ee748||0xcc;return function(_0x234ddf){if(_0x234ddf){return _0x26bb17[_0x4922('0x28')](_0x4ee748);}return _0x26bb17[_0x4922('0x29')](_0x4ee748)['end']();};}function respondWithResult(_0x3eb5d,_0x57580c){_0x57580c=_0x57580c||0xc8;return function(_0x3f39d5){if(_0x3f39d5){return _0x3eb5d[_0x4922('0x29')](_0x57580c)[_0x4922('0x2a')](_0x3f39d5);}};}function respondWithFilteredResult(_0x34c75d,_0x30b538){return function(_0x4a7934){if(_0x4a7934){var _0x46cd81=_0x4a7934['count'],_0x4cc26e=_0x30b538['offset'],_0x3e3c7d=_0x30b538['offset']+_0x30b538[_0x4922('0x2b')],_0x416e26;if(_0x3e3c7d>=_0x46cd81){_0x3e3c7d=_0x46cd81;_0x416e26=0xc8;}else{_0x416e26=0xce;}_0x34c75d['status'](_0x416e26);return _0x34c75d['set'](_0x4922('0x2c'),_0x4cc26e+'-'+_0x3e3c7d+'/'+_0x46cd81)[_0x4922('0x2a')](_0x4a7934);}return null;};}function patchUpdates(_0x481ae3){return function(_0x2b132d){try{jsonpatch[_0x4922('0x2d')](_0x2b132d,_0x481ae3,!![]);}catch(_0x146884){return BPromise['reject'](_0x146884);}return _0x2b132d['save']();};}function saveUpdates(_0x2092de,_0x3c0fe0){return function(_0x3d6fb1){if(_0x3d6fb1){return _0x3d6fb1['update'](_0x2092de)[_0x4922('0x2e')](function(_0x421a2f){return _0x421a2f;});}return null;};}function removeEntity(_0x2315f0,_0x5ef9fb){return function(_0x52f58e){if(_0x52f58e){return _0x52f58e[_0x4922('0x2f')]()[_0x4922('0x2e')](function(){_0x2315f0['status'](0xcc)[_0x4922('0x30')]();});}};}function handleEntityNotFound(_0x4e3bdf,_0x251c40){return function(_0x464d12){if(!_0x464d12){_0x4e3bdf[_0x4922('0x28')](0x194);}return _0x464d12;};}function handleError(_0x18cf1b,_0x18fda3){_0x18fda3=_0x18fda3||0x1f4;return function(_0x3d509b){logger[_0x4922('0x23')](_0x3d509b['stack']);if(_0x3d509b[_0x4922('0x31')]){delete _0x3d509b[_0x4922('0x31')];}_0x18cf1b[_0x4922('0x29')](_0x18fda3)[_0x4922('0x32')](_0x3d509b);};}exports[_0x4922('0x33')]=function(_0x1209eb,_0x349b14){var _0x2e925e={},_0x2da8b2={},_0x336841={'count':0x0,'rows':[]};var _0x51fc44=_['map'](db[_0x4922('0x34')][_0x4922('0x35')],function(_0x2c9fc9){return{'name':_0x2c9fc9[_0x4922('0x36')],'type':_0x2c9fc9[_0x4922('0x37')]['key']};});_0x2da8b2['model']=_[_0x4922('0x38')](_0x51fc44,_0x4922('0x31'));_0x2da8b2[_0x4922('0x39')]=_[_0x4922('0x3a')](_0x1209eb[_0x4922('0x39')]);_0x2da8b2['filters']=_[_0x4922('0x3b')](_0x2da8b2[_0x4922('0x3c')],_0x2da8b2[_0x4922('0x39')]);_0x2e925e[_0x4922('0x3d')]=_[_0x4922('0x3b')](_0x2da8b2['model'],qs['fields'](_0x1209eb[_0x4922('0x39')][_0x4922('0x3e')]));_0x2e925e['attributes']=_0x2e925e[_0x4922('0x3d')]['length']?_0x2e925e[_0x4922('0x3d')]:_0x2da8b2[_0x4922('0x3c')];if(!_0x1209eb[_0x4922('0x39')][_0x4922('0x3f')](_0x4922('0x40'))){_0x2e925e['limit']=qs['limit'](_0x1209eb[_0x4922('0x39')][_0x4922('0x2b')]);_0x2e925e[_0x4922('0x41')]=qs[_0x4922('0x41')](_0x1209eb[_0x4922('0x39')][_0x4922('0x41')]);}_0x2e925e[_0x4922('0x42')]=qs[_0x4922('0x43')](_0x1209eb[_0x4922('0x39')]['sort']);_0x2e925e[_0x4922('0x44')]=qs[_0x4922('0x45')](_[_0x4922('0x46')](_0x1209eb[_0x4922('0x39')],_0x2da8b2['filters']),_0x51fc44);if(_0x1209eb[_0x4922('0x39')][_0x4922('0x47')]){_0x2e925e[_0x4922('0x44')]=_[_0x4922('0x48')](_0x2e925e['where'],{'$or':_['map'](_0x51fc44,function(_0x51f881){if(_0x51f881[_0x4922('0x37')]!==_0x4922('0x49')){var _0x4cefe9={};_0x4cefe9[_0x51f881['name']]={'$like':'%'+_0x1209eb[_0x4922('0x39')][_0x4922('0x47')]+'%'};return _0x4cefe9;}})});}_0x2e925e=_[_0x4922('0x48')]({},_0x2e925e,_0x1209eb[_0x4922('0x4a')]);var _0x382829={'where':_0x2e925e[_0x4922('0x44')]};return db[_0x4922('0x34')][_0x4922('0x4b')](_0x382829)['then'](function(_0x2f5da9){_0x336841[_0x4922('0x4b')]=_0x2f5da9;if(_0x1209eb[_0x4922('0x39')][_0x4922('0x4c')]){_0x2e925e[_0x4922('0x4d')]=[{'all':!![]}];}return db[_0x4922('0x34')][_0x4922('0x4e')](_0x2e925e);})[_0x4922('0x2e')](function(_0x31a9cf){_0x336841[_0x4922('0x4f')]=_0x31a9cf;return _0x336841;})[_0x4922('0x2e')](respondWithFilteredResult(_0x349b14,_0x2e925e))[_0x4922('0x27')](handleError(_0x349b14,null));};exports[_0x4922('0x50')]=function(_0xdc811d,_0x4c7c02){var _0x58fadf={'raw':![],'where':{'id':_0xdc811d['params']['id']}},_0x404b5d={};_0x404b5d[_0x4922('0x3c')]=_[_0x4922('0x3a')](db[_0x4922('0x34')]['rawAttributes']);_0x404b5d['query']=_[_0x4922('0x3a')](_0xdc811d[_0x4922('0x39')]);_0x404b5d['filters']=_[_0x4922('0x3b')](_0x404b5d[_0x4922('0x3c')],_0x404b5d['query']);_0x58fadf[_0x4922('0x3d')]=_[_0x4922('0x3b')](_0x404b5d[_0x4922('0x3c')],qs[_0x4922('0x3e')](_0xdc811d[_0x4922('0x39')][_0x4922('0x3e')]));_0x58fadf[_0x4922('0x3d')]=_0x58fadf[_0x4922('0x3d')][_0x4922('0x51')]?_0x58fadf[_0x4922('0x3d')]:_0x404b5d[_0x4922('0x3c')];if(_0xdc811d['query'][_0x4922('0x4c')]){_0x58fadf[_0x4922('0x4d')]=[{'all':!![]}];}_0x58fadf=_[_0x4922('0x48')]({},_0x58fadf,_0xdc811d[_0x4922('0x4a')]);return db[_0x4922('0x34')][_0x4922('0x52')](_0x58fadf)[_0x4922('0x2e')](handleEntityNotFound(_0x4c7c02,null))[_0x4922('0x2e')](respondWithResult(_0x4c7c02,null))[_0x4922('0x27')](handleError(_0x4c7c02,null));};exports[_0x4922('0x53')]=function(_0x53e2a5,_0x505e76){return db[_0x4922('0x34')][_0x4922('0x53')](_0x53e2a5['body'],{})[_0x4922('0x2e')](respondWithResult(_0x505e76,0xc9))[_0x4922('0x27')](handleError(_0x505e76,null));};exports[_0x4922('0x54')]=function(_0x198216,_0x302c3f){if(_0x198216[_0x4922('0x55')]['id']){delete _0x198216[_0x4922('0x55')]['id'];}return db[_0x4922('0x34')][_0x4922('0x52')]({'where':{'id':_0x198216[_0x4922('0x56')]['id']}})[_0x4922('0x2e')](handleEntityNotFound(_0x302c3f,null))[_0x4922('0x2e')](saveUpdates(_0x198216['body'],null))[_0x4922('0x2e')](respondWithResult(_0x302c3f,null))[_0x4922('0x27')](handleError(_0x302c3f,null));};exports[_0x4922('0x2f')]=function(_0x36398e,_0x13d585){return db['DeskConfiguration'][_0x4922('0x52')]({'where':{'id':_0x36398e[_0x4922('0x56')]['id']}})[_0x4922('0x2e')](handleEntityNotFound(_0x13d585,null))[_0x4922('0x2e')](removeEntity(_0x13d585,null))[_0x4922('0x27')](handleError(_0x13d585,null));};exports['getFields']=function(_0x526662,_0xb81454,_0x10d1eb){var _0x2534db={};var _0x3b98f9={};var _0x153cb4;var _0x31541c;return db[_0x4922('0x34')][_0x4922('0x57')]({'where':{'id':_0x526662[_0x4922('0x56')]['id']}})[_0x4922('0x2e')](handleEntityNotFound(_0xb81454,null))[_0x4922('0x2e')](function(_0x505a3f){if(_0x505a3f){_0x153cb4=_0x505a3f;_0x3b98f9[_0x4922('0x3c')]=_[_0x4922('0x3a')](db[_0x4922('0x58')][_0x4922('0x35')]);_0x3b98f9[_0x4922('0x39')]=_[_0x4922('0x3a')](_0x526662['query']);_0x3b98f9[_0x4922('0x45')]=_[_0x4922('0x3b')](_0x3b98f9['model'],_0x3b98f9[_0x4922('0x39')]);_0x2534db[_0x4922('0x3d')]=_[_0x4922('0x3b')](_0x3b98f9[_0x4922('0x3c')],qs[_0x4922('0x3e')](_0x526662[_0x4922('0x39')][_0x4922('0x3e')]));_0x2534db[_0x4922('0x3d')]=_0x2534db[_0x4922('0x3d')]['length']?_0x2534db[_0x4922('0x3d')]:_0x3b98f9[_0x4922('0x3c')];_0x2534db[_0x4922('0x42')]=qs[_0x4922('0x43')](_0x526662[_0x4922('0x39')]['sort']);_0x2534db[_0x4922('0x44')]=qs['filters'](_[_0x4922('0x46')](_0x526662[_0x4922('0x39')],_0x3b98f9[_0x4922('0x45')]));if(_0x526662[_0x4922('0x39')][_0x4922('0x47')]){_0x2534db['where']=_[_0x4922('0x48')](_0x2534db[_0x4922('0x44')],{'$or':_[_0x4922('0x38')](_0x2534db[_0x4922('0x3d')],function(_0x301ab9){var _0x1ab8aa={};_0x1ab8aa[_0x301ab9]={'$like':'%'+_0x526662[_0x4922('0x39')][_0x4922('0x47')]+'%'};return _0x1ab8aa;})});}_0x2534db=_[_0x4922('0x48')]({},_0x2534db,_0x526662[_0x4922('0x4a')]);return _0x153cb4[_0x4922('0x59')](_0x2534db);}})[_0x4922('0x2e')](function(_0x3d6941){if(_0x3d6941){_0x31541c=_0x3d6941[_0x4922('0x51')];if(!_0x526662[_0x4922('0x39')][_0x4922('0x3f')](_0x4922('0x40'))){_0x2534db['limit']=qs['limit'](_0x526662[_0x4922('0x39')][_0x4922('0x2b')]);_0x2534db[_0x4922('0x41')]=qs['offset'](_0x526662['query']['offset']);}return _0x153cb4[_0x4922('0x59')](_0x2534db);}})[_0x4922('0x2e')](function(_0x35e712){if(_0x35e712){return _0x35e712?{'count':_0x31541c,'rows':_0x35e712}:null;}})[_0x4922('0x2e')](respondWithResult(_0xb81454,null))['catch'](handleError(_0xb81454,null));};exports[_0x4922('0x5a')]=function(_0x4801bf,_0x3266d,_0x5a17ea){var _0x3a5fd5={};var _0x775a05={};var _0x5076fa;var _0x4a090b;return db['DeskConfiguration'][_0x4922('0x57')]({'where':{'id':_0x4801bf[_0x4922('0x56')]['id']}})[_0x4922('0x2e')](handleEntityNotFound(_0x3266d,null))['then'](function(_0xa08c83){if(_0xa08c83){_0x5076fa=_0xa08c83;_0x775a05[_0x4922('0x3c')]=_[_0x4922('0x3a')](db['DeskField'][_0x4922('0x35')]);_0x775a05[_0x4922('0x39')]=_[_0x4922('0x3a')](_0x4801bf['query']);_0x775a05[_0x4922('0x45')]=_[_0x4922('0x3b')](_0x775a05['model'],_0x775a05['query']);_0x3a5fd5[_0x4922('0x3d')]=_[_0x4922('0x3b')](_0x775a05[_0x4922('0x3c')],qs[_0x4922('0x3e')](_0x4801bf['query'][_0x4922('0x3e')]));_0x3a5fd5[_0x4922('0x3d')]=_0x3a5fd5[_0x4922('0x3d')][_0x4922('0x51')]?_0x3a5fd5['attributes']:_0x775a05[_0x4922('0x3c')];_0x3a5fd5['order']=qs[_0x4922('0x43')](_0x4801bf[_0x4922('0x39')][_0x4922('0x43')]);_0x3a5fd5[_0x4922('0x44')]=qs['filters'](_['pick'](_0x4801bf['query'],_0x775a05[_0x4922('0x45')]));if(_0x4801bf['query'][_0x4922('0x47')]){_0x3a5fd5['where']=_['merge'](_0x3a5fd5[_0x4922('0x44')],{'$or':_[_0x4922('0x38')](_0x3a5fd5[_0x4922('0x3d')],function(_0x2dea02){var _0x12fb3a={};_0x12fb3a[_0x2dea02]={'$like':'%'+_0x4801bf[_0x4922('0x39')]['filter']+'%'};return _0x12fb3a;})});}_0x3a5fd5=_[_0x4922('0x48')]({},_0x3a5fd5,_0x4801bf['options']);return _0x5076fa[_0x4922('0x5a')](_0x3a5fd5);}})['then'](function(_0xbfba5f){if(_0xbfba5f){_0x4a090b=_0xbfba5f[_0x4922('0x51')];if(!_0x4801bf[_0x4922('0x39')][_0x4922('0x3f')](_0x4922('0x40'))){_0x3a5fd5[_0x4922('0x2b')]=qs['limit'](_0x4801bf[_0x4922('0x39')][_0x4922('0x2b')]);_0x3a5fd5[_0x4922('0x41')]=qs[_0x4922('0x41')](_0x4801bf[_0x4922('0x39')][_0x4922('0x41')]);}return _0x5076fa[_0x4922('0x5a')](_0x3a5fd5);}})[_0x4922('0x2e')](function(_0xfcc0ae){if(_0xfcc0ae){return _0xfcc0ae?{'count':_0x4a090b,'rows':_0xfcc0ae}:null;}})['then'](respondWithResult(_0x3266d,null))[_0x4922('0x27')](handleError(_0x3266d,null));};exports[_0x4922('0x5b')]=function(_0x154f27,_0x480f9b,_0x103a55){var _0x4cc2c0={};var _0x4016c6={};var _0x9f93fe;var _0x361047;return db['DeskConfiguration']['findOne']({'where':{'id':_0x154f27[_0x4922('0x56')]['id']}})[_0x4922('0x2e')](handleEntityNotFound(_0x480f9b,null))[_0x4922('0x2e')](function(_0x5ca525){if(_0x5ca525){_0x9f93fe=_0x5ca525;_0x4016c6['model']=_[_0x4922('0x3a')](db[_0x4922('0x58')][_0x4922('0x35')]);_0x4016c6[_0x4922('0x39')]=_[_0x4922('0x3a')](_0x154f27['query']);_0x4016c6['filters']=_['intersection'](_0x4016c6[_0x4922('0x3c')],_0x4016c6[_0x4922('0x39')]);_0x4cc2c0['attributes']=_[_0x4922('0x3b')](_0x4016c6['model'],qs['fields'](_0x154f27[_0x4922('0x39')]['fields']));_0x4cc2c0[_0x4922('0x3d')]=_0x4cc2c0[_0x4922('0x3d')][_0x4922('0x51')]?_0x4cc2c0[_0x4922('0x3d')]:_0x4016c6[_0x4922('0x3c')];_0x4cc2c0[_0x4922('0x42')]=qs['sort'](_0x154f27[_0x4922('0x39')][_0x4922('0x43')]);_0x4cc2c0['where']=qs[_0x4922('0x45')](_[_0x4922('0x46')](_0x154f27[_0x4922('0x39')],_0x4016c6[_0x4922('0x45')]));if(_0x154f27[_0x4922('0x39')][_0x4922('0x47')]){_0x4cc2c0['where']=_['merge'](_0x4cc2c0[_0x4922('0x44')],{'$or':_[_0x4922('0x38')](_0x4cc2c0['attributes'],function(_0x427737){var _0x36aa78={};_0x36aa78[_0x427737]={'$like':'%'+_0x154f27[_0x4922('0x39')][_0x4922('0x47')]+'%'};return _0x36aa78;})});}_0x4cc2c0=_[_0x4922('0x48')]({},_0x4cc2c0,_0x154f27[_0x4922('0x4a')]);return _0x9f93fe[_0x4922('0x5b')](_0x4cc2c0);}})[_0x4922('0x2e')](function(_0x5343e2){if(_0x5343e2){_0x361047=_0x5343e2['length'];if(!_0x154f27['query'][_0x4922('0x3f')](_0x4922('0x40'))){_0x4cc2c0[_0x4922('0x2b')]=qs[_0x4922('0x2b')](_0x154f27[_0x4922('0x39')][_0x4922('0x2b')]);_0x4cc2c0['offset']=qs[_0x4922('0x41')](_0x154f27['query'][_0x4922('0x41')]);}return _0x9f93fe[_0x4922('0x5b')](_0x4cc2c0);}})[_0x4922('0x2e')](function(_0x2c4a82){if(_0x2c4a82){return _0x2c4a82?{'count':_0x361047,'rows':_0x2c4a82}:null;}})[_0x4922('0x2e')](respondWithResult(_0x480f9b,null))['catch'](handleError(_0x480f9b,null));};exports['getTags']=function(_0x196a2f,_0x78b1ef,_0x245ff4){var _0x7c1d1f={};var _0x36560c={};var _0x43d678;var _0x2a82b6;return db[_0x4922('0x34')][_0x4922('0x57')]({'where':{'id':_0x196a2f[_0x4922('0x56')]['id']}})[_0x4922('0x2e')](handleEntityNotFound(_0x78b1ef,null))['then'](function(_0x12592f){if(_0x12592f){_0x43d678=_0x12592f;_0x36560c[_0x4922('0x3c')]=_[_0x4922('0x3a')](db[_0x4922('0x5c')][_0x4922('0x35')]);_0x36560c['query']=_[_0x4922('0x3a')](_0x196a2f[_0x4922('0x39')]);_0x36560c[_0x4922('0x45')]=_[_0x4922('0x3b')](_0x36560c[_0x4922('0x3c')],_0x36560c[_0x4922('0x39')]);_0x7c1d1f[_0x4922('0x3d')]=_['intersection'](_0x36560c['model'],qs[_0x4922('0x3e')](_0x196a2f[_0x4922('0x39')]['fields']));_0x7c1d1f[_0x4922('0x3d')]=_0x7c1d1f[_0x4922('0x3d')][_0x4922('0x51')]?_0x7c1d1f[_0x4922('0x3d')]:_0x36560c[_0x4922('0x3c')];_0x7c1d1f[_0x4922('0x42')]=qs[_0x4922('0x43')](_0x196a2f[_0x4922('0x39')][_0x4922('0x43')]);_0x7c1d1f[_0x4922('0x44')]=qs[_0x4922('0x45')](_[_0x4922('0x46')](_0x196a2f['query'],_0x36560c[_0x4922('0x45')]));if(_0x196a2f[_0x4922('0x39')][_0x4922('0x47')]){_0x7c1d1f[_0x4922('0x44')]=_[_0x4922('0x48')](_0x7c1d1f['where'],{'$or':_[_0x4922('0x38')](_0x7c1d1f['attributes'],function(_0x1fd37d){var _0x517a99={};_0x517a99[_0x1fd37d]={'$like':'%'+_0x196a2f[_0x4922('0x39')][_0x4922('0x47')]+'%'};return _0x517a99;})});}_0x7c1d1f=_['merge']({},_0x7c1d1f,_0x196a2f[_0x4922('0x4a')]);return _0x43d678[_0x4922('0x5d')](_0x7c1d1f);}})['then'](function(_0x25990e){if(_0x25990e){_0x2a82b6=_0x25990e[_0x4922('0x51')];if(!_0x196a2f['query'][_0x4922('0x3f')]('nolimit')){_0x7c1d1f[_0x4922('0x2b')]=qs['limit'](_0x196a2f[_0x4922('0x39')]['limit']);_0x7c1d1f['offset']=qs[_0x4922('0x41')](_0x196a2f['query'][_0x4922('0x41')]);}return _0x43d678[_0x4922('0x5d')](_0x7c1d1f);}})[_0x4922('0x2e')](function(_0x585cf0){if(_0x585cf0){return _0x585cf0?{'count':_0x2a82b6,'rows':_0x585cf0}:null;}})['then'](respondWithResult(_0x78b1ef,null))[_0x4922('0x27')](handleError(_0x78b1ef,null));};exports[_0x4922('0x5e')]=function(_0x21e7d0,_0x425fd7,_0x3b84d9){if(_0x21e7d0[_0x4922('0x55')]['id']){delete _0x21e7d0['body']['id'];}return db[_0x4922('0x34')][_0x4922('0x57')]({'where':{'id':_0x21e7d0[_0x4922('0x56')]['id']}})['then'](handleEntityNotFound(_0x425fd7,null))['then'](function(_0x34860f){if(_0x34860f){return _0x34860f['setTags'](_0x21e7d0[_0x4922('0x55')]['ids']||[]);}return null;})[_0x4922('0x2e')](respondWithResult(_0x425fd7,null))[_0x4922('0x27')](handleError(_0x425fd7,null));}; \ No newline at end of file +var _0x1a8f=['map','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','offset','order','sort','filter','where','merge','VIRTUAL','options','includeAll','DeskConfiguration','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','DeskField','pick','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','json','count','limit','set','reject','save','update','destroy','sendStatus','stack','name','send','index'];(function(_0x289cf5,_0x501dfc){var _0x1f316d=function(_0x4180c4){while(--_0x4180c4){_0x289cf5['push'](_0x289cf5['shift']());}};_0x1f316d(++_0x501dfc);}(_0x1a8f,0x87));var _0xf1a8=function(_0xc9df8b,_0x21744d){_0xc9df8b=_0xc9df8b-0x0;var _0x35ca5d=_0x1a8f[_0xc9df8b];return _0x35ca5d;};'use strict';var pdf=require(_0xf1a8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf1a8('0x1'));var zipdir=require(_0xf1a8('0x2'));var jsonpatch=require(_0xf1a8('0x3'));var rp=require(_0xf1a8('0x4'));var moment=require(_0xf1a8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf1a8('0x6'));var csv=require(_0xf1a8('0x7'));var ejs=require(_0xf1a8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf1a8('0x9'));var crypto=require('crypto');var jsforce=require(_0xf1a8('0xa'));var deskjs=require(_0xf1a8('0xb'));var toCsv=require(_0xf1a8('0x7'));var querystring=require('querystring');var Papa=require(_0xf1a8('0xc'));var Redis=require('ioredis');var authService=require(_0xf1a8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf1a8('0xe'));var hardwareService=require(_0xf1a8('0xf'));var logger=require(_0xf1a8('0x10'))(_0xf1a8('0x11'));var utils=require('../../config/utils');var config=require(_0xf1a8('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf1a8('0x13'));var client=jayson['client'][_0xf1a8('0x14')]({'port':0x232a});function checkPasswordPattern(_0xaa16cd,_0xf9f63,_0x1ad08f){if(_0x1ad08f){var _0x2d0965=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d0965[_0xf1a8('0x15')](_0xf9f63)){return _0xaa16cd;}else{throw new db[(_0xf1a8('0x16'))][(_0xf1a8('0x17'))](_0xf1a8('0x18'));}}else{return _0xaa16cd;}}function respondWithRpcPromise(_0x5854c5,_0xd9c1bf,_0x3efcf1,_0x18533d){return new BPromise(function(_0x65d930,_0x7c2937){var _0x2280f2=_0x18533d||client;return _0x2280f2[_0xf1a8('0x19')](_0x5854c5,_0x3efcf1)[_0xf1a8('0x1a')](function(_0x1fa067){logger[_0xf1a8('0x1b')](_0xf1a8('0x1c'),_0xd9c1bf,_0xf1a8('0x1d'));logger[_0xf1a8('0x1e')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0xd9c1bf,_0xf1a8('0x1d'),JSON[_0xf1a8('0x1f')](_0x1fa067));if(_0x1fa067[_0xf1a8('0x20')]){if(_0x1fa067[_0xf1a8('0x20')][_0xf1a8('0x21')]===0x1f4){logger['error'](_0xf1a8('0x1c'),_0xd9c1bf,_0x1fa067['error'][_0xf1a8('0x22')]);return _0x7c2937(_0x1fa067[_0xf1a8('0x20')][_0xf1a8('0x22')]);}logger[_0xf1a8('0x20')](_0xf1a8('0x1c'),_0xd9c1bf,_0x1fa067[_0xf1a8('0x20')][_0xf1a8('0x22')]);return _0x65d930(_0x1fa067[_0xf1a8('0x20')]['message']);}else{logger[_0xf1a8('0x1b')](_0xf1a8('0x1c'),_0xd9c1bf,_0xf1a8('0x1d'));_0x65d930(_0x1fa067[_0xf1a8('0x23')][_0xf1a8('0x22')]);}})['catch'](function(_0x121df2){logger[_0xf1a8('0x20')](_0xf1a8('0x1c'),_0xd9c1bf,_0x121df2);_0x7c2937(_0x121df2);});});}function respondWithStatusCode(_0x25c04e,_0x4b90a5){_0x4b90a5=_0x4b90a5||0xcc;return function(_0x2db901){if(_0x2db901){return _0x25c04e['sendStatus'](_0x4b90a5);}return _0x25c04e[_0xf1a8('0x24')](_0x4b90a5)[_0xf1a8('0x25')]();};}function respondWithResult(_0x2903c8,_0x5ef78e){_0x5ef78e=_0x5ef78e||0xc8;return function(_0x50c807){if(_0x50c807){return _0x2903c8[_0xf1a8('0x24')](_0x5ef78e)[_0xf1a8('0x26')](_0x50c807);}};}function respondWithFilteredResult(_0x2bdc47,_0x53e500){return function(_0xcf038e){if(_0xcf038e){var _0x4deba8=_0xcf038e[_0xf1a8('0x27')],_0x1424bc=_0x53e500['offset'],_0x1acbba=_0x53e500['offset']+_0x53e500[_0xf1a8('0x28')],_0x566154;if(_0x1acbba>=_0x4deba8){_0x1acbba=_0x4deba8;_0x566154=0xc8;}else{_0x566154=0xce;}_0x2bdc47[_0xf1a8('0x24')](_0x566154);return _0x2bdc47[_0xf1a8('0x29')]('Content-Range',_0x1424bc+'-'+_0x1acbba+'/'+_0x4deba8)[_0xf1a8('0x26')](_0xcf038e);}return null;};}function patchUpdates(_0x327f16){return function(_0x26deb2){try{jsonpatch['apply'](_0x26deb2,_0x327f16,!![]);}catch(_0x382571){return BPromise[_0xf1a8('0x2a')](_0x382571);}return _0x26deb2[_0xf1a8('0x2b')]();};}function saveUpdates(_0x3eaca9,_0x3cb923){return function(_0x1fb6bb){if(_0x1fb6bb){return _0x1fb6bb[_0xf1a8('0x2c')](_0x3eaca9)[_0xf1a8('0x1a')](function(_0x29d3e1){return _0x29d3e1;});}return null;};}function removeEntity(_0x2c0382,_0x5e4480){return function(_0x416e49){if(_0x416e49){return _0x416e49[_0xf1a8('0x2d')]()[_0xf1a8('0x1a')](function(){_0x2c0382['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ce19,_0x37826c){return function(_0xf07d02){if(!_0xf07d02){_0x12ce19[_0xf1a8('0x2e')](0x194);}return _0xf07d02;};}function handleError(_0x449ac1,_0x4c4088){_0x4c4088=_0x4c4088||0x1f4;return function(_0x430d10){logger['error'](_0x430d10[_0xf1a8('0x2f')]);if(_0x430d10[_0xf1a8('0x30')]){delete _0x430d10['name'];}_0x449ac1[_0xf1a8('0x24')](_0x4c4088)[_0xf1a8('0x31')](_0x430d10);};}exports[_0xf1a8('0x32')]=function(_0x3442d5,_0x27051d){var _0x3db203={},_0x5bf98c={},_0x245023={'count':0x0,'rows':[]};var _0x17dc8b=_[_0xf1a8('0x33')](db['DeskConfiguration'][_0xf1a8('0x34')],function(_0x464a6a){return{'name':_0x464a6a['fieldName'],'type':_0x464a6a[_0xf1a8('0x35')][_0xf1a8('0x36')]};});_0x5bf98c['model']=_[_0xf1a8('0x33')](_0x17dc8b,_0xf1a8('0x30'));_0x5bf98c['query']=_[_0xf1a8('0x37')](_0x3442d5[_0xf1a8('0x38')]);_0x5bf98c[_0xf1a8('0x39')]=_[_0xf1a8('0x3a')](_0x5bf98c['model'],_0x5bf98c[_0xf1a8('0x38')]);_0x3db203[_0xf1a8('0x3b')]=_['intersection'](_0x5bf98c[_0xf1a8('0x3c')],qs['fields'](_0x3442d5[_0xf1a8('0x38')][_0xf1a8('0x3d')]));_0x3db203['attributes']=_0x3db203[_0xf1a8('0x3b')][_0xf1a8('0x3e')]?_0x3db203[_0xf1a8('0x3b')]:_0x5bf98c[_0xf1a8('0x3c')];if(!_0x3442d5[_0xf1a8('0x38')][_0xf1a8('0x3f')]('nolimit')){_0x3db203[_0xf1a8('0x28')]=qs['limit'](_0x3442d5[_0xf1a8('0x38')][_0xf1a8('0x28')]);_0x3db203[_0xf1a8('0x40')]=qs['offset'](_0x3442d5[_0xf1a8('0x38')][_0xf1a8('0x40')]);}_0x3db203[_0xf1a8('0x41')]=qs[_0xf1a8('0x42')](_0x3442d5[_0xf1a8('0x38')][_0xf1a8('0x42')]);_0x3db203['where']=qs[_0xf1a8('0x39')](_['pick'](_0x3442d5[_0xf1a8('0x38')],_0x5bf98c[_0xf1a8('0x39')]),_0x17dc8b);if(_0x3442d5[_0xf1a8('0x38')][_0xf1a8('0x43')]){_0x3db203[_0xf1a8('0x44')]=_[_0xf1a8('0x45')](_0x3db203[_0xf1a8('0x44')],{'$or':_[_0xf1a8('0x33')](_0x17dc8b,function(_0x156205){if(_0x156205[_0xf1a8('0x35')]!==_0xf1a8('0x46')){var _0x40d66d={};_0x40d66d[_0x156205[_0xf1a8('0x30')]]={'$like':'%'+_0x3442d5[_0xf1a8('0x38')][_0xf1a8('0x43')]+'%'};return _0x40d66d;}})});}_0x3db203=_[_0xf1a8('0x45')]({},_0x3db203,_0x3442d5[_0xf1a8('0x47')]);var _0x1e6ca1={'where':_0x3db203[_0xf1a8('0x44')]};return db['DeskConfiguration'][_0xf1a8('0x27')](_0x1e6ca1)['then'](function(_0x3c8b93){_0x245023[_0xf1a8('0x27')]=_0x3c8b93;if(_0x3442d5[_0xf1a8('0x38')][_0xf1a8('0x48')]){_0x3db203['include']=[{'all':!![]}];}return db[_0xf1a8('0x49')][_0xf1a8('0x4a')](_0x3db203);})[_0xf1a8('0x1a')](function(_0x4bb994){_0x245023[_0xf1a8('0x4b')]=_0x4bb994;return _0x245023;})[_0xf1a8('0x1a')](respondWithFilteredResult(_0x27051d,_0x3db203))[_0xf1a8('0x4c')](handleError(_0x27051d,null));};exports[_0xf1a8('0x4d')]=function(_0x44c330,_0xf69e59){var _0x31c05b={'raw':![],'where':{'id':_0x44c330[_0xf1a8('0x4e')]['id']}},_0x3b8087={};_0x3b8087[_0xf1a8('0x3c')]=_['keys'](db[_0xf1a8('0x49')][_0xf1a8('0x34')]);_0x3b8087['query']=_[_0xf1a8('0x37')](_0x44c330[_0xf1a8('0x38')]);_0x3b8087[_0xf1a8('0x39')]=_[_0xf1a8('0x3a')](_0x3b8087[_0xf1a8('0x3c')],_0x3b8087[_0xf1a8('0x38')]);_0x31c05b[_0xf1a8('0x3b')]=_[_0xf1a8('0x3a')](_0x3b8087[_0xf1a8('0x3c')],qs['fields'](_0x44c330[_0xf1a8('0x38')][_0xf1a8('0x3d')]));_0x31c05b[_0xf1a8('0x3b')]=_0x31c05b['attributes']['length']?_0x31c05b['attributes']:_0x3b8087['model'];if(_0x44c330[_0xf1a8('0x38')][_0xf1a8('0x48')]){_0x31c05b[_0xf1a8('0x4f')]=[{'all':!![]}];}_0x31c05b=_[_0xf1a8('0x45')]({},_0x31c05b,_0x44c330[_0xf1a8('0x47')]);return db[_0xf1a8('0x49')][_0xf1a8('0x50')](_0x31c05b)[_0xf1a8('0x1a')](handleEntityNotFound(_0xf69e59,null))[_0xf1a8('0x1a')](respondWithResult(_0xf69e59,null))['catch'](handleError(_0xf69e59,null));};exports[_0xf1a8('0x51')]=function(_0x386ac8,_0x494bd3){return db[_0xf1a8('0x49')]['create'](_0x386ac8[_0xf1a8('0x52')],{})[_0xf1a8('0x1a')](respondWithResult(_0x494bd3,0xc9))['catch'](handleError(_0x494bd3,null));};exports[_0xf1a8('0x2c')]=function(_0x2f8c27,_0xc5c396){if(_0x2f8c27['body']['id']){delete _0x2f8c27['body']['id'];}return db[_0xf1a8('0x49')][_0xf1a8('0x50')]({'where':{'id':_0x2f8c27[_0xf1a8('0x4e')]['id']}})[_0xf1a8('0x1a')](handleEntityNotFound(_0xc5c396,null))[_0xf1a8('0x1a')](saveUpdates(_0x2f8c27['body'],null))[_0xf1a8('0x1a')](respondWithResult(_0xc5c396,null))['catch'](handleError(_0xc5c396,null));};exports[_0xf1a8('0x2d')]=function(_0x3bf46,_0x2aefa7){return db[_0xf1a8('0x49')][_0xf1a8('0x50')]({'where':{'id':_0x3bf46[_0xf1a8('0x4e')]['id']}})[_0xf1a8('0x1a')](handleEntityNotFound(_0x2aefa7,null))[_0xf1a8('0x1a')](removeEntity(_0x2aefa7,null))[_0xf1a8('0x4c')](handleError(_0x2aefa7,null));};exports[_0xf1a8('0x53')]=function(_0x5dc853,_0x4c4bbc,_0x29e2c8){var _0x17d7ee={};var _0x360805={};var _0x58ead1;var _0x4b808c;return db[_0xf1a8('0x49')][_0xf1a8('0x54')]({'where':{'id':_0x5dc853[_0xf1a8('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c4bbc,null))['then'](function(_0x53ff4e){if(_0x53ff4e){_0x58ead1=_0x53ff4e;_0x360805['model']=_[_0xf1a8('0x37')](db[_0xf1a8('0x55')][_0xf1a8('0x34')]);_0x360805['query']=_['keys'](_0x5dc853[_0xf1a8('0x38')]);_0x360805['filters']=_['intersection'](_0x360805[_0xf1a8('0x3c')],_0x360805['query']);_0x17d7ee[_0xf1a8('0x3b')]=_[_0xf1a8('0x3a')](_0x360805['model'],qs[_0xf1a8('0x3d')](_0x5dc853[_0xf1a8('0x38')][_0xf1a8('0x3d')]));_0x17d7ee['attributes']=_0x17d7ee['attributes'][_0xf1a8('0x3e')]?_0x17d7ee['attributes']:_0x360805[_0xf1a8('0x3c')];_0x17d7ee[_0xf1a8('0x41')]=qs[_0xf1a8('0x42')](_0x5dc853[_0xf1a8('0x38')][_0xf1a8('0x42')]);_0x17d7ee['where']=qs[_0xf1a8('0x39')](_[_0xf1a8('0x56')](_0x5dc853[_0xf1a8('0x38')],_0x360805[_0xf1a8('0x39')]));if(_0x5dc853[_0xf1a8('0x38')][_0xf1a8('0x43')]){_0x17d7ee['where']=_[_0xf1a8('0x45')](_0x17d7ee[_0xf1a8('0x44')],{'$or':_[_0xf1a8('0x33')](_0x17d7ee[_0xf1a8('0x3b')],function(_0x1c280d){var _0x1bb679={};_0x1bb679[_0x1c280d]={'$like':'%'+_0x5dc853[_0xf1a8('0x38')][_0xf1a8('0x43')]+'%'};return _0x1bb679;})});}_0x17d7ee=_[_0xf1a8('0x45')]({},_0x17d7ee,_0x5dc853[_0xf1a8('0x47')]);return _0x58ead1[_0xf1a8('0x53')](_0x17d7ee);}})['then'](function(_0x2df771){if(_0x2df771){_0x4b808c=_0x2df771[_0xf1a8('0x3e')];if(!_0x5dc853[_0xf1a8('0x38')][_0xf1a8('0x3f')](_0xf1a8('0x57'))){_0x17d7ee[_0xf1a8('0x28')]=qs[_0xf1a8('0x28')](_0x5dc853['query']['limit']);_0x17d7ee[_0xf1a8('0x40')]=qs[_0xf1a8('0x40')](_0x5dc853[_0xf1a8('0x38')][_0xf1a8('0x40')]);}return _0x58ead1[_0xf1a8('0x53')](_0x17d7ee);}})[_0xf1a8('0x1a')](function(_0x58b67e){if(_0x58b67e){return _0x58b67e?{'count':_0x4b808c,'rows':_0x58b67e}:null;}})['then'](respondWithResult(_0x4c4bbc,null))[_0xf1a8('0x4c')](handleError(_0x4c4bbc,null));};exports[_0xf1a8('0x58')]=function(_0x5df52d,_0x212859,_0x39ee89){var _0x3cd3f2={};var _0x3464ef={};var _0x458daf;var _0x3123d9;return db[_0xf1a8('0x49')][_0xf1a8('0x54')]({'where':{'id':_0x5df52d[_0xf1a8('0x4e')]['id']}})[_0xf1a8('0x1a')](handleEntityNotFound(_0x212859,null))[_0xf1a8('0x1a')](function(_0x3bb9d3){if(_0x3bb9d3){_0x458daf=_0x3bb9d3;_0x3464ef[_0xf1a8('0x3c')]=_['keys'](db[_0xf1a8('0x55')]['rawAttributes']);_0x3464ef['query']=_[_0xf1a8('0x37')](_0x5df52d[_0xf1a8('0x38')]);_0x3464ef[_0xf1a8('0x39')]=_['intersection'](_0x3464ef[_0xf1a8('0x3c')],_0x3464ef['query']);_0x3cd3f2['attributes']=_[_0xf1a8('0x3a')](_0x3464ef['model'],qs['fields'](_0x5df52d[_0xf1a8('0x38')]['fields']));_0x3cd3f2[_0xf1a8('0x3b')]=_0x3cd3f2[_0xf1a8('0x3b')][_0xf1a8('0x3e')]?_0x3cd3f2[_0xf1a8('0x3b')]:_0x3464ef[_0xf1a8('0x3c')];_0x3cd3f2[_0xf1a8('0x41')]=qs[_0xf1a8('0x42')](_0x5df52d[_0xf1a8('0x38')][_0xf1a8('0x42')]);_0x3cd3f2[_0xf1a8('0x44')]=qs[_0xf1a8('0x39')](_[_0xf1a8('0x56')](_0x5df52d['query'],_0x3464ef['filters']));if(_0x5df52d[_0xf1a8('0x38')][_0xf1a8('0x43')]){_0x3cd3f2[_0xf1a8('0x44')]=_[_0xf1a8('0x45')](_0x3cd3f2[_0xf1a8('0x44')],{'$or':_['map'](_0x3cd3f2[_0xf1a8('0x3b')],function(_0x139dff){var _0x205ed3={};_0x205ed3[_0x139dff]={'$like':'%'+_0x5df52d[_0xf1a8('0x38')]['filter']+'%'};return _0x205ed3;})});}_0x3cd3f2=_['merge']({},_0x3cd3f2,_0x5df52d[_0xf1a8('0x47')]);return _0x458daf[_0xf1a8('0x58')](_0x3cd3f2);}})[_0xf1a8('0x1a')](function(_0x2c5000){if(_0x2c5000){_0x3123d9=_0x2c5000['length'];if(!_0x5df52d[_0xf1a8('0x38')][_0xf1a8('0x3f')](_0xf1a8('0x57'))){_0x3cd3f2['limit']=qs['limit'](_0x5df52d[_0xf1a8('0x38')][_0xf1a8('0x28')]);_0x3cd3f2[_0xf1a8('0x40')]=qs[_0xf1a8('0x40')](_0x5df52d[_0xf1a8('0x38')][_0xf1a8('0x40')]);}return _0x458daf[_0xf1a8('0x58')](_0x3cd3f2);}})['then'](function(_0x125bb6){if(_0x125bb6){return _0x125bb6?{'count':_0x3123d9,'rows':_0x125bb6}:null;}})['then'](respondWithResult(_0x212859,null))[_0xf1a8('0x4c')](handleError(_0x212859,null));};exports[_0xf1a8('0x59')]=function(_0x5c1ba3,_0x1566ef,_0x50659b){var _0x25a589={};var _0x35f97b={};var _0x2267c0;var _0x11bc84;return db[_0xf1a8('0x49')][_0xf1a8('0x54')]({'where':{'id':_0x5c1ba3['params']['id']}})[_0xf1a8('0x1a')](handleEntityNotFound(_0x1566ef,null))[_0xf1a8('0x1a')](function(_0x9c8e04){if(_0x9c8e04){_0x2267c0=_0x9c8e04;_0x35f97b[_0xf1a8('0x3c')]=_['keys'](db['DeskField'][_0xf1a8('0x34')]);_0x35f97b[_0xf1a8('0x38')]=_[_0xf1a8('0x37')](_0x5c1ba3[_0xf1a8('0x38')]);_0x35f97b['filters']=_[_0xf1a8('0x3a')](_0x35f97b[_0xf1a8('0x3c')],_0x35f97b[_0xf1a8('0x38')]);_0x25a589[_0xf1a8('0x3b')]=_[_0xf1a8('0x3a')](_0x35f97b[_0xf1a8('0x3c')],qs[_0xf1a8('0x3d')](_0x5c1ba3[_0xf1a8('0x38')][_0xf1a8('0x3d')]));_0x25a589[_0xf1a8('0x3b')]=_0x25a589[_0xf1a8('0x3b')]['length']?_0x25a589['attributes']:_0x35f97b['model'];_0x25a589['order']=qs[_0xf1a8('0x42')](_0x5c1ba3[_0xf1a8('0x38')][_0xf1a8('0x42')]);_0x25a589['where']=qs[_0xf1a8('0x39')](_[_0xf1a8('0x56')](_0x5c1ba3[_0xf1a8('0x38')],_0x35f97b[_0xf1a8('0x39')]));if(_0x5c1ba3[_0xf1a8('0x38')][_0xf1a8('0x43')]){_0x25a589[_0xf1a8('0x44')]=_['merge'](_0x25a589[_0xf1a8('0x44')],{'$or':_[_0xf1a8('0x33')](_0x25a589[_0xf1a8('0x3b')],function(_0x14eaae){var _0x24afea={};_0x24afea[_0x14eaae]={'$like':'%'+_0x5c1ba3[_0xf1a8('0x38')]['filter']+'%'};return _0x24afea;})});}_0x25a589=_['merge']({},_0x25a589,_0x5c1ba3[_0xf1a8('0x47')]);return _0x2267c0['getDescriptions'](_0x25a589);}})['then'](function(_0x1ea447){if(_0x1ea447){_0x11bc84=_0x1ea447[_0xf1a8('0x3e')];if(!_0x5c1ba3['query'][_0xf1a8('0x3f')]('nolimit')){_0x25a589[_0xf1a8('0x28')]=qs['limit'](_0x5c1ba3[_0xf1a8('0x38')][_0xf1a8('0x28')]);_0x25a589['offset']=qs[_0xf1a8('0x40')](_0x5c1ba3[_0xf1a8('0x38')][_0xf1a8('0x40')]);}return _0x2267c0[_0xf1a8('0x59')](_0x25a589);}})[_0xf1a8('0x1a')](function(_0x31077f){if(_0x31077f){return _0x31077f?{'count':_0x11bc84,'rows':_0x31077f}:null;}})[_0xf1a8('0x1a')](respondWithResult(_0x1566ef,null))[_0xf1a8('0x4c')](handleError(_0x1566ef,null));};exports['getTags']=function(_0x59847c,_0x114868,_0x4ac01e){var _0x383b45={};var _0x4ceb11={};var _0x583993;var _0x3d67b6;return db['DeskConfiguration']['findOne']({'where':{'id':_0x59847c[_0xf1a8('0x4e')]['id']}})[_0xf1a8('0x1a')](handleEntityNotFound(_0x114868,null))[_0xf1a8('0x1a')](function(_0x2b6768){if(_0x2b6768){_0x583993=_0x2b6768;_0x4ceb11[_0xf1a8('0x3c')]=_[_0xf1a8('0x37')](db[_0xf1a8('0x5a')][_0xf1a8('0x34')]);_0x4ceb11[_0xf1a8('0x38')]=_[_0xf1a8('0x37')](_0x59847c[_0xf1a8('0x38')]);_0x4ceb11[_0xf1a8('0x39')]=_[_0xf1a8('0x3a')](_0x4ceb11[_0xf1a8('0x3c')],_0x4ceb11['query']);_0x383b45[_0xf1a8('0x3b')]=_[_0xf1a8('0x3a')](_0x4ceb11['model'],qs[_0xf1a8('0x3d')](_0x59847c[_0xf1a8('0x38')]['fields']));_0x383b45['attributes']=_0x383b45[_0xf1a8('0x3b')][_0xf1a8('0x3e')]?_0x383b45['attributes']:_0x4ceb11['model'];_0x383b45[_0xf1a8('0x41')]=qs[_0xf1a8('0x42')](_0x59847c['query']['sort']);_0x383b45['where']=qs[_0xf1a8('0x39')](_[_0xf1a8('0x56')](_0x59847c[_0xf1a8('0x38')],_0x4ceb11['filters']));if(_0x59847c['query'][_0xf1a8('0x43')]){_0x383b45[_0xf1a8('0x44')]=_[_0xf1a8('0x45')](_0x383b45[_0xf1a8('0x44')],{'$or':_[_0xf1a8('0x33')](_0x383b45[_0xf1a8('0x3b')],function(_0x37d828){var _0x341f1e={};_0x341f1e[_0x37d828]={'$like':'%'+_0x59847c[_0xf1a8('0x38')][_0xf1a8('0x43')]+'%'};return _0x341f1e;})});}_0x383b45=_[_0xf1a8('0x45')]({},_0x383b45,_0x59847c[_0xf1a8('0x47')]);return _0x583993['getTags'](_0x383b45);}})[_0xf1a8('0x1a')](function(_0x3b401d){if(_0x3b401d){_0x3d67b6=_0x3b401d[_0xf1a8('0x3e')];if(!_0x59847c['query']['hasOwnProperty']('nolimit')){_0x383b45[_0xf1a8('0x28')]=qs[_0xf1a8('0x28')](_0x59847c[_0xf1a8('0x38')][_0xf1a8('0x28')]);_0x383b45['offset']=qs[_0xf1a8('0x40')](_0x59847c[_0xf1a8('0x38')][_0xf1a8('0x40')]);}return _0x583993[_0xf1a8('0x5b')](_0x383b45);}})['then'](function(_0x66a869){if(_0x66a869){return _0x66a869?{'count':_0x3d67b6,'rows':_0x66a869}:null;}})['then'](respondWithResult(_0x114868,null))[_0xf1a8('0x4c')](handleError(_0x114868,null));};exports[_0xf1a8('0x5c')]=function(_0x575097,_0x26f84f,_0x3ba598){if(_0x575097['body']['id']){delete _0x575097['body']['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x575097[_0xf1a8('0x4e')]['id']}})[_0xf1a8('0x1a')](handleEntityNotFound(_0x26f84f,null))[_0xf1a8('0x1a')](function(_0x587dd7){if(_0x587dd7){return _0x587dd7[_0xf1a8('0x5c')](_0x575097[_0xf1a8('0x52')]['ids']||[]);}return null;})[_0xf1a8('0x1a')](respondWithResult(_0x26f84f,null))[_0xf1a8('0x4c')](handleError(_0x26f84f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2040e33..4a0e9e0 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 _0xe739=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x4e7abc,_0x2aeca1){var _0x428796=function(_0xa2c1d){while(--_0xa2c1d){_0x4e7abc['push'](_0x4e7abc['shift']());}};_0x428796(++_0x2aeca1);}(_0xe739,0x129));var _0x9e73=function(_0x53e84e,_0x2d34f1){_0x53e84e=_0x53e84e-0x0;var _0xfd813b=_0xe739[_0x53e84e];return _0xfd813b;};'use strict';var _=require(_0x9e73('0x0'));var util=require(_0x9e73('0x1'));var logger=require(_0x9e73('0x2'))(_0x9e73('0x3'));var moment=require(_0x9e73('0x4'));var BPromise=require(_0x9e73('0x5'));var rp=require(_0x9e73('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e73('0x7'));var attributes=require(_0x9e73('0x8'));module[_0x9e73('0x9')]=function(_0x25b21d,_0x209f76){return _0x25b21d[_0x9e73('0xa')](_0x9e73('0xb'),attributes,{'tableName':_0x9e73('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91a7=['DeskConfiguration','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define'];(function(_0x5be119,_0x2606cd){var _0x37dd24=function(_0x7649d3){while(--_0x7649d3){_0x5be119['push'](_0x5be119['shift']());}};_0x37dd24(++_0x2606cd);}(_0x91a7,0x1e5));var _0x791a=function(_0x6faafb,_0x144d03){_0x6faafb=_0x6faafb-0x0;var _0x2e87c1=_0x91a7[_0x6faafb];return _0x2e87c1;};'use strict';var _=require(_0x791a('0x0'));var util=require(_0x791a('0x1'));var logger=require(_0x791a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require(_0x791a('0x4'));var fs=require('fs');var path=require(_0x791a('0x5'));var rimraf=require(_0x791a('0x6'));var config=require('../../config/environment');var attributes=require(_0x791a('0x7'));module[_0x791a('0x8')]=function(_0x3076c4,_0x41f350){return _0x3076c4[_0x791a('0x9')](_0x791a('0xa'),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 a0c1742..e35fc50 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 _0x5668=['debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0xa6c7f0,_0x10dcad){var _0x53a4df=function(_0x2e2179){while(--_0x2e2179){_0xa6c7f0['push'](_0xa6c7f0['shift']());}};_0x53a4df(++_0x10dcad);}(_0x5668,0x8b));var _0x8566=function(_0x12714d,_0x3ebb45){_0x12714d=_0x12714d-0x0;var _0x46d1b5=_0x5668[_0x12714d];return _0x46d1b5;};'use strict';var _=require(_0x8566('0x0'));var util=require(_0x8566('0x1'));var moment=require(_0x8566('0x2'));var BPromise=require(_0x8566('0x3'));var rs=require(_0x8566('0x4'));var fs=require('fs');var Redis=require(_0x8566('0x5'));var db=require(_0x8566('0x6'))['db'];var utils=require(_0x8566('0x7'));var logger=require(_0x8566('0x8'))(_0x8566('0x9'));var config=require(_0x8566('0xa'));var jayson=require(_0x8566('0xb'));var client=jayson[_0x8566('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355fce,_0x2ffec4,_0x49f55a){return new BPromise(function(_0x4aaf3f,_0x4045ed){return client['request'](_0x355fce,_0x49f55a)['then'](function(_0x1a01a2){logger['info'](_0x8566('0xd'),_0x2ffec4,_0x8566('0xe'));logger[_0x8566('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2ffec4,_0x8566('0xe'),JSON[_0x8566('0x10')](_0x1a01a2));if(_0x1a01a2['error']){if(_0x1a01a2['error']['code']===0x1f4){logger['error'](_0x8566('0xd'),_0x2ffec4,_0x1a01a2[_0x8566('0x11')][_0x8566('0x12')]);return _0x4045ed(_0x1a01a2[_0x8566('0x11')][_0x8566('0x12')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x2ffec4,_0x1a01a2['error']['message']);return _0x4aaf3f(_0x1a01a2['error'][_0x8566('0x12')]);}else{logger[_0x8566('0x13')](_0x8566('0xd'),_0x2ffec4,_0x8566('0xe'));_0x4aaf3f(_0x1a01a2[_0x8566('0x14')]['message']);}})[_0x8566('0x15')](function(_0xe208c7){logger[_0x8566('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2ffec4,_0xe208c7);_0x4045ed(_0xe208c7);});});} \ No newline at end of file +var _0xc112=['error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3297db,_0x4e607c){var _0x3b4842=function(_0xf311fd){while(--_0xf311fd){_0x3297db['push'](_0x3297db['shift']());}};_0x3b4842(++_0x4e607c);}(_0xc112,0xec));var _0x2c11=function(_0x3e92f4,_0x2265d1){_0x3e92f4=_0x3e92f4-0x0;var _0x1d1fe2=_0xc112[_0x3e92f4];return _0x1d1fe2;};'use strict';var _=require(_0x2c11('0x0'));var util=require(_0x2c11('0x1'));var moment=require(_0x2c11('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c11('0x3'));var fs=require('fs');var Redis=require(_0x2c11('0x4'));var db=require(_0x2c11('0x5'))['db'];var utils=require(_0x2c11('0x6'));var logger=require(_0x2c11('0x7'))(_0x2c11('0x8'));var config=require(_0x2c11('0x9'));var jayson=require(_0x2c11('0xa'));var client=jayson[_0x2c11('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2399,_0x39c244,_0x1fada4){return new BPromise(function(_0x29dfcf,_0x43c1f5){return client['request'](_0x5c2399,_0x1fada4)[_0x2c11('0xc')](function(_0x1e0381){logger['info'](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));logger[_0x2c11('0xf')](_0x2c11('0x10'),_0x39c244,_0x2c11('0xe'),JSON['stringify'](_0x1e0381));if(_0x1e0381[_0x2c11('0x11')]){if(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x12')]===0x1f4){logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x43c1f5(_0x1e0381['error'][_0x2c11('0x13')]);}logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x29dfcf(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);}else{logger[_0x2c11('0x14')](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));_0x29dfcf(_0x1e0381[_0x2c11('0x15')]['message']);}})[_0x2c11('0x16')](function(_0x3c31e4){logger[_0x2c11('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x39c244,_0x3c31e4);_0x43c1f5(_0x3c31e4);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 819e78d..c453e05 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 _0x4dfa=['isAuthenticated','index','/:id','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x36514b,_0xe51f83){var _0x486deb=function(_0xb1bf1){while(--_0xb1bf1){_0x36514b['push'](_0x36514b['shift']());}};_0x486deb(++_0xe51f83);}(_0x4dfa,0x181));var _0xa4df=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4dfa[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xa4df('0x0'));var util=require(_0xa4df('0x1'));var path=require(_0xa4df('0x2'));var timeout=require(_0xa4df('0x3'));var express=require(_0xa4df('0x4'));var router=express[_0xa4df('0x5')]();var auth=require(_0xa4df('0x6'));var interaction=require(_0xa4df('0x7'));var config=require(_0xa4df('0x8'));var controller=require(_0xa4df('0x9'));router[_0xa4df('0xa')]('/',auth[_0xa4df('0xb')](),controller[_0xa4df('0xc')]);router[_0xa4df('0xa')](_0xa4df('0xd'),auth[_0xa4df('0xb')](),controller['show']);router['post']('/',auth[_0xa4df('0xb')](),controller['create']);router[_0xa4df('0xe')](_0xa4df('0xd'),auth[_0xa4df('0xb')](),controller[_0xa4df('0xf')]);router['delete'](_0xa4df('0xd'),auth[_0xa4df('0xb')](),controller[_0xa4df('0x10')]);module[_0xa4df('0x11')]=router; \ No newline at end of file +var _0xb513=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','/:id','isAuthenticated','post','create','delete','destroy','exports','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb513,0x185));var _0x3b51=function(_0x1b925b,_0x1ab3c9){_0x1b925b=_0x1b925b-0x0;var _0x275f07=_0xb513[_0x1b925b];return _0x275f07;};'use strict';var multer=require('multer');var util=require(_0x3b51('0x0'));var path=require('path');var timeout=require(_0x3b51('0x1'));var express=require('express');var router=express[_0x3b51('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3b51('0x3'));var config=require(_0x3b51('0x4'));var controller=require(_0x3b51('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x3b51('0x6')]);router[_0x3b51('0x7')](_0x3b51('0x8'),auth[_0x3b51('0x9')](),controller['show']);router[_0x3b51('0xa')]('/',auth[_0x3b51('0x9')](),controller[_0x3b51('0xb')]);router['put'](_0x3b51('0x8'),auth[_0x3b51('0x9')](),controller['update']);router[_0x3b51('0xc')](_0x3b51('0x8'),auth[_0x3b51('0x9')](),controller[_0x3b51('0xd')]);module[_0x3b51('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index b5590d5..2d92f6d 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 _0xbb64=['string','STRING','ENUM','variable','customVariable','keyValue'];(function(_0x2f39a7,_0x8badcc){var _0x37b40f=function(_0x1fab4b){while(--_0x1fab4b){_0x2f39a7['push'](_0x2f39a7['shift']());}};_0x37b40f(++_0x8badcc);}(_0xbb64,0x68));var _0x4bb6=function(_0x2c143d,_0x5e3548){_0x2c143d=_0x2c143d-0x0;var _0x44288b=_0xbb64[_0x2c143d];return _0x44288b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x4bb6('0x0')]('string',_0x4bb6('0x1'),_0x4bb6('0x2'),_0x4bb6('0x3')),'defaultValue':_0x4bb6('0x4')},'content':{'type':Sequelize[_0x4bb6('0x5')]},'key':{'type':Sequelize[_0x4bb6('0x5')]},'keyType':{'type':Sequelize[_0x4bb6('0x0')](_0x4bb6('0x4'),_0x4bb6('0x1'),_0x4bb6('0x2'))},'keyContent':{'type':Sequelize[_0x4bb6('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4bb6('0x5')]}}; \ No newline at end of file +var _0x85c3=['string','exports','ENUM','variable','customVariable','keyValue','STRING'];(function(_0x38322a,_0x30adf0){var _0x16bfae=function(_0xc9d2c5){while(--_0xc9d2c5){_0x38322a['push'](_0x38322a['shift']());}};_0x16bfae(++_0x30adf0);}(_0x85c3,0x151));var _0x385c=function(_0x328b56,_0x5d6d5d){_0x328b56=_0x328b56-0x0;var _0x27637d=_0x85c3[_0x328b56];return _0x27637d;};'use strict';var Sequelize=require('sequelize');module[_0x385c('0x0')]={'type':{'type':Sequelize[_0x385c('0x1')]('string',_0x385c('0x2'),_0x385c('0x3'),_0x385c('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x385c('0x5')]},'key':{'type':Sequelize[_0x385c('0x5')]},'keyType':{'type':Sequelize[_0x385c('0x1')](_0x385c('0x6'),'variable',_0x385c('0x3'))},'keyContent':{'type':Sequelize[_0x385c('0x5')]},'idField':{'type':Sequelize[_0x385c('0x5')]},'nameField':{'type':Sequelize[_0x385c('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x385c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 10642fb..ea50151 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 _0x5fc3=['includeAll','include','findAll','rows','show','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','json','apply','reject','update','then','error','stack','name','send','index','DeskField','rawAttributes','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5fc3,0x18c));var _0x35fc=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0x5fc3[_0x344adc];return _0x4014b2;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require(_0x35fc('0x2'));var zipdir=require(_0x35fc('0x3'));var jsonpatch=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var moment=require(_0x35fc('0x6'));var BPromise=require(_0x35fc('0x7'));var Mustache=require(_0x35fc('0x8'));var util=require(_0x35fc('0x9'));var path=require(_0x35fc('0xa'));var sox=require('sox');var csv=require(_0x35fc('0xb'));var ejs=require(_0x35fc('0xc'));var fs=require('fs');var _=require(_0x35fc('0xd'));var squel=require(_0x35fc('0xe'));var crypto=require(_0x35fc('0xf'));var jsforce=require(_0x35fc('0x10'));var deskjs=require(_0x35fc('0x11'));var toCsv=require(_0x35fc('0xb'));var querystring=require(_0x35fc('0x12'));var Papa=require(_0x35fc('0x13'));var Redis=require(_0x35fc('0x14'));var authService=require(_0x35fc('0x15'));var qs=require(_0x35fc('0x16'));var as=require(_0x35fc('0x17'));var hardwareService=require(_0x35fc('0x18'));var logger=require('../../config/logger')(_0x35fc('0x19'));var utils=require(_0x35fc('0x1a'));var config=require(_0x35fc('0x1b'));var db=require(_0x35fc('0x1c'))['db'];function respondWithStatusCode(_0x21a646,_0x550def){_0x550def=_0x550def||0xcc;return function(_0x27cb16){if(_0x27cb16){return _0x21a646[_0x35fc('0x1d')](_0x550def);}return _0x21a646[_0x35fc('0x1e')](_0x550def)[_0x35fc('0x1f')]();};}function respondWithResult(_0x2bd9ac,_0x407f45){_0x407f45=_0x407f45||0xc8;return function(_0x4bdb6d){if(_0x4bdb6d){return _0x2bd9ac[_0x35fc('0x1e')](_0x407f45)['json'](_0x4bdb6d);}};}function respondWithFilteredResult(_0x52c28c,_0x4eb52a){return function(_0x14e6e9){if(_0x14e6e9){var _0x51fdf7=_0x14e6e9['count'],_0x18d1c8=_0x4eb52a['offset'],_0x16c6d2=_0x4eb52a['offset']+_0x4eb52a[_0x35fc('0x20')],_0x1cd3d5;if(_0x16c6d2>=_0x51fdf7){_0x16c6d2=_0x51fdf7;_0x1cd3d5=0xc8;}else{_0x1cd3d5=0xce;}_0x52c28c[_0x35fc('0x1e')](_0x1cd3d5);return _0x52c28c['set']('Content-Range',_0x18d1c8+'-'+_0x16c6d2+'/'+_0x51fdf7)[_0x35fc('0x21')](_0x14e6e9);}return null;};}function patchUpdates(_0x42caf5){return function(_0xdee185){try{jsonpatch[_0x35fc('0x22')](_0xdee185,_0x42caf5,!![]);}catch(_0x4aa9cd){return BPromise[_0x35fc('0x23')](_0x4aa9cd);}return _0xdee185['save']();};}function saveUpdates(_0x563c46,_0x1511dd){return function(_0x244b46){if(_0x244b46){return _0x244b46[_0x35fc('0x24')](_0x563c46)[_0x35fc('0x25')](function(_0x4b6267){return _0x4b6267;});}return null;};}function removeEntity(_0x3b4eb5,_0x5939a6){return function(_0x241f2f){if(_0x241f2f){return _0x241f2f['destroy']()['then'](function(){_0x3b4eb5['status'](0xcc)[_0x35fc('0x1f')]();});}};}function handleEntityNotFound(_0x386787,_0x4faaa7){return function(_0x310135){if(!_0x310135){_0x386787['sendStatus'](0x194);}return _0x310135;};}function handleError(_0x30d8e0,_0x3e82b0){_0x3e82b0=_0x3e82b0||0x1f4;return function(_0x297717){logger[_0x35fc('0x26')](_0x297717[_0x35fc('0x27')]);if(_0x297717[_0x35fc('0x28')]){delete _0x297717['name'];}_0x30d8e0[_0x35fc('0x1e')](_0x3e82b0)[_0x35fc('0x29')](_0x297717);};}exports[_0x35fc('0x2a')]=function(_0x463dd3,_0x54308d){var _0x440394={},_0xf8c97={},_0x4176b8={'count':0x0,'rows':[]};var _0x3036ef=_['map'](db[_0x35fc('0x2b')][_0x35fc('0x2c')],function(_0x5800d5){return{'name':_0x5800d5['fieldName'],'type':_0x5800d5['type'][_0x35fc('0x2d')]};});_0xf8c97['model']=_['map'](_0x3036ef,'name');_0xf8c97[_0x35fc('0x2e')]=_[_0x35fc('0x2f')](_0x463dd3[_0x35fc('0x2e')]);_0xf8c97['filters']=_[_0x35fc('0x30')](_0xf8c97['model'],_0xf8c97['query']);_0x440394[_0x35fc('0x31')]=_[_0x35fc('0x30')](_0xf8c97['model'],qs[_0x35fc('0x32')](_0x463dd3[_0x35fc('0x2e')][_0x35fc('0x32')]));_0x440394['attributes']=_0x440394[_0x35fc('0x31')][_0x35fc('0x33')]?_0x440394[_0x35fc('0x31')]:_0xf8c97[_0x35fc('0x34')];if(!_0x463dd3[_0x35fc('0x2e')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x440394[_0x35fc('0x20')]=qs[_0x35fc('0x20')](_0x463dd3[_0x35fc('0x2e')]['limit']);_0x440394[_0x35fc('0x37')]=qs[_0x35fc('0x37')](_0x463dd3[_0x35fc('0x2e')][_0x35fc('0x37')]);}_0x440394[_0x35fc('0x38')]=qs[_0x35fc('0x39')](_0x463dd3['query'][_0x35fc('0x39')]);_0x440394[_0x35fc('0x3a')]=qs[_0x35fc('0x3b')](_[_0x35fc('0x3c')](_0x463dd3['query'],_0xf8c97[_0x35fc('0x3b')]),_0x3036ef);if(_0x463dd3[_0x35fc('0x2e')][_0x35fc('0x3d')]){_0x440394[_0x35fc('0x3a')]=_[_0x35fc('0x3e')](_0x440394[_0x35fc('0x3a')],{'$or':_['map'](_0x3036ef,function(_0x49678a){if(_0x49678a['type']!==_0x35fc('0x3f')){var _0x5386c5={};_0x5386c5[_0x49678a[_0x35fc('0x28')]]={'$like':'%'+_0x463dd3[_0x35fc('0x2e')][_0x35fc('0x3d')]+'%'};return _0x5386c5;}})});}_0x440394=_[_0x35fc('0x3e')]({},_0x440394,_0x463dd3[_0x35fc('0x40')]);var _0x726bb8={'where':_0x440394[_0x35fc('0x3a')]};return db[_0x35fc('0x2b')][_0x35fc('0x41')](_0x726bb8)[_0x35fc('0x25')](function(_0x4ee7d9){_0x4176b8[_0x35fc('0x41')]=_0x4ee7d9;if(_0x463dd3[_0x35fc('0x2e')][_0x35fc('0x42')]){_0x440394[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2b')][_0x35fc('0x44')](_0x440394);})['then'](function(_0xd90b72){_0x4176b8[_0x35fc('0x45')]=_0xd90b72;return _0x4176b8;})[_0x35fc('0x25')](respondWithFilteredResult(_0x54308d,_0x440394))['catch'](handleError(_0x54308d,null));};exports[_0x35fc('0x46')]=function(_0x449c69,_0x53fe5a){var _0x2f2576={'raw':!![],'where':{'id':_0x449c69['params']['id']}},_0x33dea3={};_0x33dea3['model']=_[_0x35fc('0x2f')](db[_0x35fc('0x2b')][_0x35fc('0x2c')]);_0x33dea3[_0x35fc('0x2e')]=_[_0x35fc('0x2f')](_0x449c69[_0x35fc('0x2e')]);_0x33dea3['filters']=_[_0x35fc('0x30')](_0x33dea3[_0x35fc('0x34')],_0x33dea3[_0x35fc('0x2e')]);_0x2f2576[_0x35fc('0x31')]=_[_0x35fc('0x30')](_0x33dea3[_0x35fc('0x34')],qs['fields'](_0x449c69[_0x35fc('0x2e')]['fields']));_0x2f2576[_0x35fc('0x31')]=_0x2f2576['attributes'][_0x35fc('0x33')]?_0x2f2576['attributes']:_0x33dea3['model'];if(_0x449c69[_0x35fc('0x2e')][_0x35fc('0x42')]){_0x2f2576[_0x35fc('0x43')]=[{'all':!![]}];}_0x2f2576=_['merge']({},_0x2f2576,_0x449c69[_0x35fc('0x40')]);return db[_0x35fc('0x2b')][_0x35fc('0x47')](_0x2f2576)['then'](handleEntityNotFound(_0x53fe5a,null))['then'](respondWithResult(_0x53fe5a,null))[_0x35fc('0x48')](handleError(_0x53fe5a,null));};exports[_0x35fc('0x49')]=function(_0x1c950f,_0x322583){return db[_0x35fc('0x2b')][_0x35fc('0x49')](_0x1c950f[_0x35fc('0x4a')],{})[_0x35fc('0x25')](respondWithResult(_0x322583,0xc9))[_0x35fc('0x48')](handleError(_0x322583,null));};exports[_0x35fc('0x24')]=function(_0x4d0fbc,_0x381a82){if(_0x4d0fbc['body']['id']){delete _0x4d0fbc['body']['id'];}return db[_0x35fc('0x2b')][_0x35fc('0x47')]({'where':{'id':_0x4d0fbc[_0x35fc('0x4b')]['id']}})[_0x35fc('0x25')](handleEntityNotFound(_0x381a82,null))[_0x35fc('0x25')](saveUpdates(_0x4d0fbc[_0x35fc('0x4a')],null))[_0x35fc('0x25')](respondWithResult(_0x381a82,null))[_0x35fc('0x48')](handleError(_0x381a82,null));};exports[_0x35fc('0x4c')]=function(_0x4718a4,_0x3f2c2e){return db['DeskField'][_0x35fc('0x47')]({'where':{'id':_0x4718a4['params']['id']}})['then'](handleEntityNotFound(_0x3f2c2e,null))[_0x35fc('0x25')](removeEntity(_0x3f2c2e,null))[_0x35fc('0x48')](handleError(_0x3f2c2e,null));}; \ No newline at end of file +var _0x8d2b=['name','send','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','catch','create','body','update','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','destroy','then','error','stack'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x8d2b,0x143));var _0xb8d2=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x8d2b[_0x4bc65f];return _0x44f85f;};'use strict';var pdf=require(_0xb8d2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb8d2('0x1'));var zipdir=require(_0xb8d2('0x2'));var jsonpatch=require(_0xb8d2('0x3'));var rp=require(_0xb8d2('0x4'));var moment=require(_0xb8d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb8d2('0x6'));var util=require(_0xb8d2('0x7'));var path=require('path');var sox=require(_0xb8d2('0x8'));var csv=require(_0xb8d2('0x9'));var ejs=require(_0xb8d2('0xa'));var fs=require('fs');var _=require(_0xb8d2('0xb'));var squel=require('squel');var crypto=require(_0xb8d2('0xc'));var jsforce=require(_0xb8d2('0xd'));var deskjs=require(_0xb8d2('0xe'));var toCsv=require(_0xb8d2('0x9'));var querystring=require(_0xb8d2('0xf'));var Papa=require('papaparse');var Redis=require(_0xb8d2('0x10'));var authService=require(_0xb8d2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb8d2('0x12'));var hardwareService=require(_0xb8d2('0x13'));var logger=require(_0xb8d2('0x14'))(_0xb8d2('0x15'));var utils=require(_0xb8d2('0x16'));var config=require(_0xb8d2('0x17'));var db=require(_0xb8d2('0x18'))['db'];function respondWithStatusCode(_0x1f901a,_0x3cb0c5){_0x3cb0c5=_0x3cb0c5||0xcc;return function(_0x2e26e5){if(_0x2e26e5){return _0x1f901a[_0xb8d2('0x19')](_0x3cb0c5);}return _0x1f901a[_0xb8d2('0x1a')](_0x3cb0c5)[_0xb8d2('0x1b')]();};}function respondWithResult(_0x377aa4,_0x4ea76c){_0x4ea76c=_0x4ea76c||0xc8;return function(_0x28a3ca){if(_0x28a3ca){return _0x377aa4['status'](_0x4ea76c)[_0xb8d2('0x1c')](_0x28a3ca);}};}function respondWithFilteredResult(_0x57bdc9,_0xcd23d2){return function(_0x402d44){if(_0x402d44){var _0x1c92c0=_0x402d44[_0xb8d2('0x1d')],_0x2eb475=_0xcd23d2[_0xb8d2('0x1e')],_0x4a9cbd=_0xcd23d2[_0xb8d2('0x1e')]+_0xcd23d2['limit'],_0x2ed299;if(_0x4a9cbd>=_0x1c92c0){_0x4a9cbd=_0x1c92c0;_0x2ed299=0xc8;}else{_0x2ed299=0xce;}_0x57bdc9['status'](_0x2ed299);return _0x57bdc9['set'](_0xb8d2('0x1f'),_0x2eb475+'-'+_0x4a9cbd+'/'+_0x1c92c0)[_0xb8d2('0x1c')](_0x402d44);}return null;};}function patchUpdates(_0x196b1f){return function(_0x175809){try{jsonpatch['apply'](_0x175809,_0x196b1f,!![]);}catch(_0x515abb){return BPromise[_0xb8d2('0x20')](_0x515abb);}return _0x175809['save']();};}function saveUpdates(_0x1e4fe9,_0x122da3){return function(_0x4fc9f0){if(_0x4fc9f0){return _0x4fc9f0['update'](_0x1e4fe9)['then'](function(_0x3b96fe){return _0x3b96fe;});}return null;};}function removeEntity(_0x1209a3,_0x193dd3){return function(_0x231158){if(_0x231158){return _0x231158[_0xb8d2('0x21')]()[_0xb8d2('0x22')](function(){_0x1209a3[_0xb8d2('0x1a')](0xcc)[_0xb8d2('0x1b')]();});}};}function handleEntityNotFound(_0x4a68a6,_0x310305){return function(_0x3e3f18){if(!_0x3e3f18){_0x4a68a6[_0xb8d2('0x19')](0x194);}return _0x3e3f18;};}function handleError(_0xc59c5c,_0x29ac05){_0x29ac05=_0x29ac05||0x1f4;return function(_0x3ce9e8){logger[_0xb8d2('0x23')](_0x3ce9e8[_0xb8d2('0x24')]);if(_0x3ce9e8[_0xb8d2('0x25')]){delete _0x3ce9e8['name'];}_0xc59c5c['status'](_0x29ac05)[_0xb8d2('0x26')](_0x3ce9e8);};}exports[_0xb8d2('0x27')]=function(_0x3e7441,_0x23ddc2){var _0x26aeda={},_0x30a05e={},_0x2a3d7a={'count':0x0,'rows':[]};var _0x1d0493=_[_0xb8d2('0x28')](db[_0xb8d2('0x29')][_0xb8d2('0x2a')],function(_0x213506){return{'name':_0x213506['fieldName'],'type':_0x213506[_0xb8d2('0x2b')][_0xb8d2('0x2c')]};});_0x30a05e[_0xb8d2('0x2d')]=_['map'](_0x1d0493,_0xb8d2('0x25'));_0x30a05e[_0xb8d2('0x2e')]=_[_0xb8d2('0x2f')](_0x3e7441[_0xb8d2('0x2e')]);_0x30a05e[_0xb8d2('0x30')]=_[_0xb8d2('0x31')](_0x30a05e[_0xb8d2('0x2d')],_0x30a05e['query']);_0x26aeda['attributes']=_[_0xb8d2('0x31')](_0x30a05e[_0xb8d2('0x2d')],qs['fields'](_0x3e7441[_0xb8d2('0x2e')][_0xb8d2('0x32')]));_0x26aeda[_0xb8d2('0x33')]=_0x26aeda[_0xb8d2('0x33')][_0xb8d2('0x34')]?_0x26aeda[_0xb8d2('0x33')]:_0x30a05e['model'];if(!_0x3e7441[_0xb8d2('0x2e')][_0xb8d2('0x35')]('nolimit')){_0x26aeda[_0xb8d2('0x36')]=qs[_0xb8d2('0x36')](_0x3e7441[_0xb8d2('0x2e')][_0xb8d2('0x36')]);_0x26aeda[_0xb8d2('0x1e')]=qs[_0xb8d2('0x1e')](_0x3e7441[_0xb8d2('0x2e')][_0xb8d2('0x1e')]);}_0x26aeda[_0xb8d2('0x37')]=qs[_0xb8d2('0x38')](_0x3e7441['query'][_0xb8d2('0x38')]);_0x26aeda[_0xb8d2('0x39')]=qs[_0xb8d2('0x30')](_['pick'](_0x3e7441['query'],_0x30a05e['filters']),_0x1d0493);if(_0x3e7441['query']['filter']){_0x26aeda[_0xb8d2('0x39')]=_['merge'](_0x26aeda[_0xb8d2('0x39')],{'$or':_[_0xb8d2('0x28')](_0x1d0493,function(_0x167512){if(_0x167512[_0xb8d2('0x2b')]!==_0xb8d2('0x3a')){var _0x2e3579={};_0x2e3579[_0x167512[_0xb8d2('0x25')]]={'$like':'%'+_0x3e7441[_0xb8d2('0x2e')][_0xb8d2('0x3b')]+'%'};return _0x2e3579;}})});}_0x26aeda=_[_0xb8d2('0x3c')]({},_0x26aeda,_0x3e7441[_0xb8d2('0x3d')]);var _0x1359a3={'where':_0x26aeda[_0xb8d2('0x39')]};return db[_0xb8d2('0x29')][_0xb8d2('0x1d')](_0x1359a3)[_0xb8d2('0x22')](function(_0x293c06){_0x2a3d7a['count']=_0x293c06;if(_0x3e7441[_0xb8d2('0x2e')][_0xb8d2('0x3e')]){_0x26aeda[_0xb8d2('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0xb8d2('0x40')](_0x26aeda);})[_0xb8d2('0x22')](function(_0x26f051){_0x2a3d7a[_0xb8d2('0x41')]=_0x26f051;return _0x2a3d7a;})[_0xb8d2('0x22')](respondWithFilteredResult(_0x23ddc2,_0x26aeda))['catch'](handleError(_0x23ddc2,null));};exports['show']=function(_0x293f40,_0x38c496){var _0xa5ffd7={'raw':!![],'where':{'id':_0x293f40[_0xb8d2('0x42')]['id']}},_0x3ca684={};_0x3ca684[_0xb8d2('0x2d')]=_[_0xb8d2('0x2f')](db['DeskField'][_0xb8d2('0x2a')]);_0x3ca684['query']=_['keys'](_0x293f40[_0xb8d2('0x2e')]);_0x3ca684[_0xb8d2('0x30')]=_[_0xb8d2('0x31')](_0x3ca684[_0xb8d2('0x2d')],_0x3ca684[_0xb8d2('0x2e')]);_0xa5ffd7[_0xb8d2('0x33')]=_[_0xb8d2('0x31')](_0x3ca684[_0xb8d2('0x2d')],qs[_0xb8d2('0x32')](_0x293f40[_0xb8d2('0x2e')]['fields']));_0xa5ffd7[_0xb8d2('0x33')]=_0xa5ffd7[_0xb8d2('0x33')][_0xb8d2('0x34')]?_0xa5ffd7['attributes']:_0x3ca684[_0xb8d2('0x2d')];if(_0x293f40[_0xb8d2('0x2e')][_0xb8d2('0x3e')]){_0xa5ffd7[_0xb8d2('0x3f')]=[{'all':!![]}];}_0xa5ffd7=_['merge']({},_0xa5ffd7,_0x293f40[_0xb8d2('0x3d')]);return db[_0xb8d2('0x29')]['find'](_0xa5ffd7)[_0xb8d2('0x22')](handleEntityNotFound(_0x38c496,null))[_0xb8d2('0x22')](respondWithResult(_0x38c496,null))[_0xb8d2('0x43')](handleError(_0x38c496,null));};exports[_0xb8d2('0x44')]=function(_0x13ea00,_0x41463e){return db[_0xb8d2('0x29')][_0xb8d2('0x44')](_0x13ea00[_0xb8d2('0x45')],{})[_0xb8d2('0x22')](respondWithResult(_0x41463e,0xc9))[_0xb8d2('0x43')](handleError(_0x41463e,null));};exports[_0xb8d2('0x46')]=function(_0x20ce26,_0x2a75d4){if(_0x20ce26[_0xb8d2('0x45')]['id']){delete _0x20ce26[_0xb8d2('0x45')]['id'];}return db[_0xb8d2('0x29')][_0xb8d2('0x47')]({'where':{'id':_0x20ce26['params']['id']}})['then'](handleEntityNotFound(_0x2a75d4,null))[_0xb8d2('0x22')](saveUpdates(_0x20ce26[_0xb8d2('0x45')],null))[_0xb8d2('0x22')](respondWithResult(_0x2a75d4,null))[_0xb8d2('0x43')](handleError(_0x2a75d4,null));};exports[_0xb8d2('0x21')]=function(_0x4c2d28,_0x303e11){return db[_0xb8d2('0x29')][_0xb8d2('0x47')]({'where':{'id':_0x4c2d28[_0xb8d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x303e11,null))[_0xb8d2('0x22')](removeEntity(_0x303e11,null))[_0xb8d2('0x43')](handleError(_0x303e11,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index db5d132..6e5a836 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 _0xda0d=['../../config/environment','exports','DeskField','int_desk_fields','desk_unique_index','idField','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xda0d,0x1e6));var _0xdda0=function(_0x32301e,_0x13e80e){_0x32301e=_0x32301e-0x0;var _0x1bf8fb=_0xda0d[_0x32301e];return _0x1bf8fb;};'use strict';var _=require('lodash');var util=require(_0xdda0('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdda0('0x1'));var BPromise=require(_0xdda0('0x2'));var rp=require(_0xdda0('0x3'));var fs=require('fs');var path=require(_0xdda0('0x4'));var rimraf=require(_0xdda0('0x5'));var config=require(_0xdda0('0x6'));var attributes=require('./intDeskField.attributes');module[_0xdda0('0x7')]=function(_0x3b6000,_0x121ac3){return _0x3b6000['define'](_0xdda0('0x8'),attributes,{'tableName':_0xdda0('0x9'),'paranoid':![],'indexes':[{'name':_0xdda0('0xa'),'fields':[_0xdda0('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf64a=['idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','int_desk_fields','desk_unique_index'];(function(_0x1a219d,_0x405933){var _0x5f133b=function(_0x3ccf2a){while(--_0x3ccf2a){_0x1a219d['push'](_0x1a219d['shift']());}};_0x5f133b(++_0x405933);}(_0xf64a,0x1d0));var _0xaf64=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xf64a[_0x3bfdde];return _0x3f752a;};'use strict';var _=require(_0xaf64('0x0'));var util=require(_0xaf64('0x1'));var logger=require('../../config/logger')(_0xaf64('0x2'));var moment=require(_0xaf64('0x3'));var BPromise=require(_0xaf64('0x4'));var rp=require(_0xaf64('0x5'));var fs=require('fs');var path=require(_0xaf64('0x6'));var rimraf=require(_0xaf64('0x7'));var config=require(_0xaf64('0x8'));var attributes=require('./intDeskField.attributes');module[_0xaf64('0x9')]=function(_0x38fbb5,_0xf05c1c){return _0x38fbb5['define']('DeskField',attributes,{'tableName':_0xaf64('0xa'),'paranoid':![],'indexes':[{'name':_0xaf64('0xb'),'fields':[_0xaf64('0xc'),_0xaf64('0xd')],'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 ac67c8f..46061e5 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 _0x82e0=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x260e29,_0x1d8d60){var _0x263384=function(_0x4b34ca){while(--_0x4b34ca){_0x260e29['push'](_0x260e29['shift']());}};_0x263384(++_0x1d8d60);}(_0x82e0,0x85));var _0x082e=function(_0x5df943,_0x4f63b9){_0x5df943=_0x5df943-0x0;var _0x4ba651=_0x82e0[_0x5df943];return _0x4ba651;};'use strict';var _=require('lodash');var util=require(_0x082e('0x0'));var moment=require('moment');var BPromise=require(_0x082e('0x1'));var rs=require(_0x082e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x082e('0x3'))['db'];var utils=require(_0x082e('0x4'));var logger=require(_0x082e('0x5'))(_0x082e('0x6'));var config=require(_0x082e('0x7'));var jayson=require(_0x082e('0x8'));var client=jayson[_0x082e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4df77f,_0xf42b60,_0x5627c0){return new BPromise(function(_0x8326b5,_0x6c41d4){return client[_0x082e('0xa')](_0x4df77f,_0x5627c0)[_0x082e('0xb')](function(_0x5ef9eb){logger[_0x082e('0xc')](_0x082e('0xd'),_0xf42b60,_0x082e('0xe'));logger[_0x082e('0xf')](_0x082e('0x10'),_0xf42b60,_0x082e('0xe'),JSON[_0x082e('0x11')](_0x5ef9eb));if(_0x5ef9eb['error']){if(_0x5ef9eb[_0x082e('0x12')]['code']===0x1f4){logger['error'](_0x082e('0xd'),_0xf42b60,_0x5ef9eb[_0x082e('0x12')][_0x082e('0x13')]);return _0x6c41d4(_0x5ef9eb['error'][_0x082e('0x13')]);}logger[_0x082e('0x12')](_0x082e('0xd'),_0xf42b60,_0x5ef9eb[_0x082e('0x12')][_0x082e('0x13')]);return _0x8326b5(_0x5ef9eb['error']['message']);}else{logger[_0x082e('0xc')](_0x082e('0xd'),_0xf42b60,_0x082e('0xe'));_0x8326b5(_0x5ef9eb['result'][_0x082e('0x13')]);}})[_0x082e('0x14')](function(_0x1d7dae){logger['error'](_0x082e('0xd'),_0xf42b60,_0x1d7dae);_0x6c41d4(_0x1d7dae);});});} \ No newline at end of file +var _0x90cd=['request\x20sent','debug','stringify','error','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x77e5d6,_0x16e152){var _0x38b5bb=function(_0x31cb34){while(--_0x31cb34){_0x77e5d6['push'](_0x77e5d6['shift']());}};_0x38b5bb(++_0x16e152);}(_0x90cd,0x1d6));var _0xd90c=function(_0x5d2cf1,_0x5c8d53){_0x5d2cf1=_0x5d2cf1-0x0;var _0x30bdc3=_0x90cd[_0x5d2cf1];return _0x30bdc3;};'use strict';var _=require(_0xd90c('0x0'));var util=require(_0xd90c('0x1'));var moment=require(_0xd90c('0x2'));var BPromise=require('bluebird');var rs=require(_0xd90c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd90c('0x4'))['db'];var utils=require(_0xd90c('0x5'));var logger=require(_0xd90c('0x6'))(_0xd90c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd90c('0x8'));var client=jayson[_0xd90c('0x9')][_0xd90c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5537ea,_0x58fc52,_0x4f05ed){return new BPromise(function(_0x3cac12,_0x3e8b8a){return client[_0xd90c('0xb')](_0x5537ea,_0x4f05ed)[_0xd90c('0xc')](function(_0x235f19){logger[_0xd90c('0xd')]('DeskField,\x20%s,\x20%s',_0x58fc52,_0xd90c('0xe'));logger[_0xd90c('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x58fc52,'request\x20sent',JSON[_0xd90c('0x10')](_0x235f19));if(_0x235f19[_0xd90c('0x11')]){if(_0x235f19[_0xd90c('0x11')]['code']===0x1f4){logger[_0xd90c('0x11')](_0xd90c('0x12'),_0x58fc52,_0x235f19[_0xd90c('0x11')][_0xd90c('0x13')]);return _0x3e8b8a(_0x235f19[_0xd90c('0x11')][_0xd90c('0x13')]);}logger[_0xd90c('0x11')]('DeskField,\x20%s,\x20%s',_0x58fc52,_0x235f19[_0xd90c('0x11')][_0xd90c('0x13')]);return _0x3cac12(_0x235f19[_0xd90c('0x11')][_0xd90c('0x13')]);}else{logger[_0xd90c('0xd')](_0xd90c('0x12'),_0x58fc52,_0xd90c('0xe'));_0x3cac12(_0x235f19[_0xd90c('0x14')][_0xd90c('0x13')]);}})[_0xd90c('0x15')](function(_0x17f123){logger[_0xd90c('0x11')](_0xd90c('0x12'),_0x58fc52,_0x17f123);_0x3e8b8a(_0x17f123);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 4981959..b19f551 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 _0xe30c=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get'];(function(_0x39834d,_0x4fa4c8){var _0x336d1c=function(_0x5be459){while(--_0x5be459){_0x39834d['push'](_0x39834d['shift']());}};_0x336d1c(++_0x4fa4c8);}(_0xe30c,0xbd));var _0xce30=function(_0x48afb4,_0x31345e){_0x48afb4=_0x48afb4-0x0;var _0x1db2ae=_0xe30c[_0x48afb4];return _0x1db2ae;};'use strict';var multer=require(_0xce30('0x0'));var util=require('util');var path=require(_0xce30('0x1'));var timeout=require(_0xce30('0x2'));var express=require(_0xce30('0x3'));var router=express[_0xce30('0x4')]();var auth=require(_0xce30('0x5'));var interaction=require(_0xce30('0x6'));var config=require(_0xce30('0x7'));var controller=require(_0xce30('0x8'));router['get']('/',auth[_0xce30('0x9')](),controller['index']);router[_0xce30('0xa')](_0xce30('0xb'),auth[_0xce30('0x9')](),controller[_0xce30('0xc')]);router['get'](_0xce30('0xd'),auth[_0xce30('0x9')](),controller[_0xce30('0xe')]);router[_0xce30('0xa')](_0xce30('0xf'),auth[_0xce30('0x9')](),controller[_0xce30('0x10')]);router[_0xce30('0x11')]('/',auth[_0xce30('0x9')](),controller[_0xce30('0x12')]);router[_0xce30('0x11')](_0xce30('0xd'),auth[_0xce30('0x9')](),controller[_0xce30('0x13')]);router[_0xce30('0x14')]('/:id',auth[_0xce30('0x9')](),controller[_0xce30('0x15')]);router[_0xce30('0x16')](_0xce30('0xb'),auth[_0xce30('0x9')](),controller[_0xce30('0x17')]);module[_0xce30('0x18')]=router; \ No newline at end of file +var _0xa5c6=['addConfiguration','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','create'];(function(_0x932f27,_0x432daa){var _0x5db619=function(_0x3bab48){while(--_0x3bab48){_0x932f27['push'](_0x932f27['shift']());}};_0x5db619(++_0x432daa);}(_0xa5c6,0xf5));var _0x6a5c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa5c6[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x6a5c('0x0'));var path=require(_0x6a5c('0x1'));var timeout=require(_0x6a5c('0x2'));var express=require('express');var router=express[_0x6a5c('0x3')]();var auth=require(_0x6a5c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6a5c('0x5'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x6a5c('0x6')](),controller[_0x6a5c('0x7')]);router[_0x6a5c('0x8')]('/:id',auth[_0x6a5c('0x6')](),controller[_0x6a5c('0x9')]);router[_0x6a5c('0x8')](_0x6a5c('0xa'),auth['isAuthenticated'](),controller[_0x6a5c('0xb')]);router['get']('/:id/fields',auth[_0x6a5c('0x6')](),controller[_0x6a5c('0xc')]);router[_0x6a5c('0xd')]('/',auth[_0x6a5c('0x6')](),controller[_0x6a5c('0xe')]);router[_0x6a5c('0xd')]('/:id/configurations',auth[_0x6a5c('0x6')](),controller[_0x6a5c('0xf')]);router['put'](_0x6a5c('0x10'),auth[_0x6a5c('0x6')](),controller['update']);router[_0x6a5c('0x11')](_0x6a5c('0x10'),auth[_0x6a5c('0x6')](),controller[_0x6a5c('0x12')]);module[_0x6a5c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d3b05be..c65e575 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 _0x90d1=['STRING','exports'];(function(_0x211ce7,_0xf3f511){var _0x5a84ce=function(_0x5b1f97){while(--_0x5b1f97){_0x211ce7['push'](_0x211ce7['shift']());}};_0x5a84ce(++_0xf3f511);}(_0x90d1,0xa3));var _0x190d=function(_0xada87a,_0x16223c){_0xada87a=_0xada87a-0x0;var _0x7ad44c=_0x90d1[_0xada87a];return _0x7ad44c;};'use strict';var Sequelize=require('sequelize');module[_0x190d('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x190d('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x190d('0x1')]},'clientId':{'type':Sequelize[_0x190d('0x1')]},'clientSecret':{'type':Sequelize[_0x190d('0x1')]},'serverUrl':{'type':Sequelize[_0x190d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc17e=['STRING','sequelize','exports'];(function(_0x5b9a38,_0x2fb7eb){var _0x5b6467=function(_0x9e162f){while(--_0x9e162f){_0x5b9a38['push'](_0x5b9a38['shift']());}};_0x5b6467(++_0x2fb7eb);}(_0xc17e,0xaf));var _0xec17=function(_0x372590,_0x1ebb65){_0x372590=_0x372590-0x0;var _0x21abe6=_0xc17e[_0x372590];return _0x21abe6;};'use strict';var Sequelize=require(_0xec17('0x0'));module[_0xec17('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xec17('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xec17('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xec17('0x2')]},'serverUrl':{'type':Sequelize[_0xec17('0x2')]},'description':{'type':Sequelize[_0xec17('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9b5c3fb..44bf2ae 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 _0x3a58=['UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','stack','index','map','Dynamics365Account','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','show','params','rawAttributes','keys','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','Incident','PhoneCall','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','versionnumber','concat','remoteUri','tenantId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','username','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','send','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label'];(function(_0x4c14ee,_0x21c1ea){var _0x1daf81=function(_0x13642c){while(--_0x13642c){_0x4c14ee['push'](_0x4c14ee['shift']());}};_0x1daf81(++_0x21c1ea);}(_0x3a58,0xea));var _0x83a5=function(_0x469a04,_0x48d923){_0x469a04=_0x469a04-0x0;var _0xe4a100=_0x3a58[_0x469a04];return _0xe4a100;};'use strict';var pdf=require(_0x83a5('0x0'));var emlformat=require(_0x83a5('0x1'));var rimraf=require(_0x83a5('0x2'));var zipdir=require(_0x83a5('0x3'));var jsonpatch=require(_0x83a5('0x4'));var rp=require(_0x83a5('0x5'));var moment=require(_0x83a5('0x6'));var BPromise=require(_0x83a5('0x7'));var Mustache=require(_0x83a5('0x8'));var util=require(_0x83a5('0x9'));var path=require(_0x83a5('0xa'));var sox=require(_0x83a5('0xb'));var csv=require('to-csv');var ejs=require(_0x83a5('0xc'));var fs=require('fs');var _=require(_0x83a5('0xd'));var squel=require(_0x83a5('0xe'));var crypto=require('crypto');var jsforce=require(_0x83a5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x83a5('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x83a5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x83a5('0x12'));var hardwareService=require(_0x83a5('0x13'));var logger=require(_0x83a5('0x14'))(_0x83a5('0x15'));var utils=require(_0x83a5('0x16'));var config=require(_0x83a5('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x83a5('0x18'));var jayson=require(_0x83a5('0x19'));var client=jayson['client'][_0x83a5('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x279b84,_0xf94d63,_0xda7077){if(_0xda7077){var _0x11c77e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11c77e['test'](_0xf94d63)){return _0x279b84;}else{throw new db[(_0x83a5('0x1b'))][(_0x83a5('0x1c'))](_0x83a5('0x1d'));}}else{return _0x279b84;}}function respondWithRpcPromise(_0x482829,_0x4667e1,_0x5a6489,_0x51ec41){return new BPromise(function(_0xbb76aa,_0x3258c9){var _0x33b1a8=_0x51ec41||client;return _0x33b1a8[_0x83a5('0x1e')](_0x482829,_0x5a6489)['then'](function(_0x3fdc90){logger[_0x83a5('0x1f')](_0x83a5('0x20'),_0x4667e1,'request\x20sent');logger[_0x83a5('0x21')](_0x83a5('0x22'),_0x4667e1,_0x83a5('0x23'),JSON[_0x83a5('0x24')](_0x3fdc90));if(_0x3fdc90[_0x83a5('0x25')]){if(_0x3fdc90[_0x83a5('0x25')][_0x83a5('0x26')]===0x1f4){logger[_0x83a5('0x25')](_0x83a5('0x20'),_0x4667e1,_0x3fdc90[_0x83a5('0x25')]['message']);return _0x3258c9(_0x3fdc90[_0x83a5('0x25')][_0x83a5('0x27')]);}logger[_0x83a5('0x25')](_0x83a5('0x20'),_0x4667e1,_0x3fdc90[_0x83a5('0x25')][_0x83a5('0x27')]);return _0xbb76aa(_0x3fdc90[_0x83a5('0x25')]['message']);}else{logger[_0x83a5('0x1f')](_0x83a5('0x20'),_0x4667e1,_0x83a5('0x23'));_0xbb76aa(_0x3fdc90[_0x83a5('0x28')][_0x83a5('0x27')]);}})[_0x83a5('0x29')](function(_0x3c5a6e){logger[_0x83a5('0x25')](_0x83a5('0x20'),_0x4667e1,_0x3c5a6e);_0x3258c9(_0x3c5a6e);});});}function respondWithStatusCode(_0x59d521,_0x45da39){_0x45da39=_0x45da39||0xcc;return function(_0x2556fc){if(_0x2556fc){return _0x59d521[_0x83a5('0x2a')](_0x45da39);}return _0x59d521[_0x83a5('0x2b')](_0x45da39)[_0x83a5('0x2c')]();};}function respondWithResult(_0x462902,_0x15588e){_0x15588e=_0x15588e||0xc8;return function(_0xcb144){if(_0xcb144){return _0x462902[_0x83a5('0x2b')](_0x15588e)[_0x83a5('0x2d')](_0xcb144);}};}function respondWithFilteredResult(_0x22a1af,_0x1936c6){return function(_0x1a5b83){if(_0x1a5b83){var _0x4b619b=_0x1a5b83[_0x83a5('0x2e')],_0x3491a9=_0x1936c6[_0x83a5('0x2f')],_0x2185b8=_0x1936c6['offset']+_0x1936c6[_0x83a5('0x30')],_0x4ab6c4;if(_0x2185b8>=_0x4b619b){_0x2185b8=_0x4b619b;_0x4ab6c4=0xc8;}else{_0x4ab6c4=0xce;}_0x22a1af[_0x83a5('0x2b')](_0x4ab6c4);return _0x22a1af['set'](_0x83a5('0x31'),_0x3491a9+'-'+_0x2185b8+'/'+_0x4b619b)['json'](_0x1a5b83);}return null;};}function patchUpdates(_0x95feb9){return function(_0x51a0ec){try{jsonpatch['apply'](_0x51a0ec,_0x95feb9,!![]);}catch(_0x4a4393){return BPromise[_0x83a5('0x32')](_0x4a4393);}return _0x51a0ec[_0x83a5('0x33')]();};}function saveUpdates(_0x438c6d,_0x4dc873){return function(_0x521bf1){if(_0x521bf1){return _0x521bf1[_0x83a5('0x34')](_0x438c6d)['then'](function(_0x16ab9c){return _0x16ab9c;});}return null;};}function removeEntity(_0x5765dd,_0x54ca17){return function(_0x757aee){if(_0x757aee){return _0x757aee[_0x83a5('0x35')]()[_0x83a5('0x36')](function(){_0x5765dd[_0x83a5('0x2b')](0xcc)[_0x83a5('0x2c')]();});}};}function handleEntityNotFound(_0x11d972,_0x591719){return function(_0x7528df){if(!_0x7528df){_0x11d972[_0x83a5('0x2a')](0x194);}return _0x7528df;};}function handleError(_0x289ee5,_0x2718a3){_0x2718a3=_0x2718a3||0x1f4;return function(_0x54119e){logger['error'](_0x54119e[_0x83a5('0x37')]);if(_0x54119e['name']){delete _0x54119e['name'];}_0x289ee5[_0x83a5('0x2b')](_0x2718a3)['send'](_0x54119e);};}exports[_0x83a5('0x38')]=function(_0x4f5949,_0x5ab699){var _0x92c96a={},_0xec6967={},_0x18f52f={'count':0x0,'rows':[]};var _0x828055=_[_0x83a5('0x39')](db[_0x83a5('0x3a')]['rawAttributes'],function(_0x4c9a5d){return{'name':_0x4c9a5d[_0x83a5('0x3b')],'type':_0x4c9a5d[_0x83a5('0x3c')]['key']};});_0xec6967[_0x83a5('0x3d')]=_[_0x83a5('0x39')](_0x828055,'name');_0xec6967[_0x83a5('0x3e')]=_['keys'](_0x4f5949[_0x83a5('0x3e')]);_0xec6967[_0x83a5('0x3f')]=_[_0x83a5('0x40')](_0xec6967[_0x83a5('0x3d')],_0xec6967[_0x83a5('0x3e')]);_0x92c96a[_0x83a5('0x41')]=_[_0x83a5('0x40')](_0xec6967['model'],qs[_0x83a5('0x42')](_0x4f5949[_0x83a5('0x3e')][_0x83a5('0x42')]));_0x92c96a[_0x83a5('0x41')]=_0x92c96a[_0x83a5('0x41')][_0x83a5('0x43')]?_0x92c96a['attributes']:_0xec6967[_0x83a5('0x3d')];if(!_0x4f5949['query'][_0x83a5('0x44')]('nolimit')){_0x92c96a[_0x83a5('0x30')]=qs['limit'](_0x4f5949[_0x83a5('0x3e')][_0x83a5('0x30')]);_0x92c96a[_0x83a5('0x2f')]=qs[_0x83a5('0x2f')](_0x4f5949['query'][_0x83a5('0x2f')]);}_0x92c96a[_0x83a5('0x45')]=qs[_0x83a5('0x46')](_0x4f5949[_0x83a5('0x3e')][_0x83a5('0x46')]);_0x92c96a['where']=qs[_0x83a5('0x3f')](_[_0x83a5('0x47')](_0x4f5949[_0x83a5('0x3e')],_0xec6967['filters']),_0x828055);if(_0x4f5949[_0x83a5('0x3e')]['filter']){_0x92c96a[_0x83a5('0x48')]=_[_0x83a5('0x49')](_0x92c96a[_0x83a5('0x48')],{'$or':_[_0x83a5('0x39')](_0x828055,function(_0x5c4466){if(_0x5c4466['type']!==_0x83a5('0x4a')){var _0x5b94e3={};_0x5b94e3[_0x5c4466[_0x83a5('0x4b')]]={'$like':'%'+_0x4f5949[_0x83a5('0x3e')][_0x83a5('0x4c')]+'%'};return _0x5b94e3;}})});}_0x92c96a=_[_0x83a5('0x49')]({},_0x92c96a,_0x4f5949[_0x83a5('0x4d')]);var _0x1d23e6={'where':_0x92c96a[_0x83a5('0x48')]};return db[_0x83a5('0x3a')][_0x83a5('0x2e')](_0x1d23e6)[_0x83a5('0x36')](function(_0x1a765f){_0x18f52f['count']=_0x1a765f;if(_0x4f5949[_0x83a5('0x3e')][_0x83a5('0x4e')]){_0x92c96a[_0x83a5('0x4f')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x83a5('0x50')](_0x92c96a);})[_0x83a5('0x36')](function(_0x1375b5){_0x18f52f['rows']=_0x1375b5;return _0x18f52f;})[_0x83a5('0x36')](respondWithFilteredResult(_0x5ab699,_0x92c96a))[_0x83a5('0x29')](handleError(_0x5ab699,null));};exports[_0x83a5('0x51')]=function(_0x2725df,_0x3dda35){var _0x3acf24={'raw':![],'where':{'id':_0x2725df[_0x83a5('0x52')]['id']}},_0x26e819={};_0x26e819['model']=_['keys'](db[_0x83a5('0x3a')][_0x83a5('0x53')]);_0x26e819[_0x83a5('0x3e')]=_[_0x83a5('0x54')](_0x2725df[_0x83a5('0x3e')]);_0x26e819['filters']=_['intersection'](_0x26e819[_0x83a5('0x3d')],_0x26e819[_0x83a5('0x3e')]);_0x3acf24['attributes']=_['intersection'](_0x26e819[_0x83a5('0x3d')],qs[_0x83a5('0x42')](_0x2725df['query'][_0x83a5('0x42')]));_0x3acf24['attributes']=_0x3acf24['attributes']['length']?_0x3acf24[_0x83a5('0x41')]:_0x26e819[_0x83a5('0x3d')];if(_0x2725df[_0x83a5('0x3e')][_0x83a5('0x4e')]){_0x3acf24['include']=[{'all':!![]}];}_0x3acf24=_['merge']({},_0x3acf24,_0x2725df[_0x83a5('0x4d')]);return db[_0x83a5('0x3a')][_0x83a5('0x55')](_0x3acf24)[_0x83a5('0x36')](handleEntityNotFound(_0x3dda35,null))[_0x83a5('0x36')](respondWithResult(_0x3dda35,null))[_0x83a5('0x29')](handleError(_0x3dda35,null));};exports[_0x83a5('0x56')]=function(_0x48cbbe,_0x4c9eb1){return db[_0x83a5('0x3a')][_0x83a5('0x56')](_0x48cbbe[_0x83a5('0x57')],{})['then'](respondWithResult(_0x4c9eb1,0xc9))[_0x83a5('0x29')](handleError(_0x4c9eb1,null));};exports[_0x83a5('0x34')]=function(_0x573518,_0xf2e4a9){if(_0x573518[_0x83a5('0x57')]['id']){delete _0x573518[_0x83a5('0x57')]['id'];}return db[_0x83a5('0x3a')]['find']({'where':{'id':_0x573518[_0x83a5('0x52')]['id']}})[_0x83a5('0x36')](handleEntityNotFound(_0xf2e4a9,null))[_0x83a5('0x36')](saveUpdates(_0x573518[_0x83a5('0x57')],null))['then'](respondWithResult(_0xf2e4a9,null))[_0x83a5('0x29')](handleError(_0xf2e4a9,null));};exports[_0x83a5('0x35')]=function(_0x5b13f7,_0x263330){return db[_0x83a5('0x3a')][_0x83a5('0x55')]({'where':{'id':_0x5b13f7[_0x83a5('0x52')]['id']}})[_0x83a5('0x36')](handleEntityNotFound(_0x263330,null))['then'](removeEntity(_0x263330,null))[_0x83a5('0x29')](handleError(_0x263330,null));};exports[_0x83a5('0x58')]=function(_0x556b99,_0x5a0f54,_0x853815){var _0x203245={};var _0x5a4397={};var _0x270b0e;var _0xa7b17f;return db[_0x83a5('0x3a')][_0x83a5('0x59')]({'where':{'id':_0x556b99[_0x83a5('0x52')]['id']}})[_0x83a5('0x36')](handleEntityNotFound(_0x5a0f54,null))[_0x83a5('0x36')](function(_0x549431){if(_0x549431){_0x270b0e=_0x549431;_0x5a4397['model']=_['keys'](db[_0x83a5('0x5a')][_0x83a5('0x53')]);_0x5a4397[_0x83a5('0x3e')]=_[_0x83a5('0x54')](_0x556b99['query']);_0x5a4397[_0x83a5('0x3f')]=_[_0x83a5('0x40')](_0x5a4397['model'],_0x5a4397[_0x83a5('0x3e')]);_0x203245['attributes']=_['intersection'](_0x5a4397[_0x83a5('0x3d')],qs[_0x83a5('0x42')](_0x556b99[_0x83a5('0x3e')][_0x83a5('0x42')]));_0x203245['attributes']=_0x203245[_0x83a5('0x41')]['length']?_0x203245[_0x83a5('0x41')]:_0x5a4397[_0x83a5('0x3d')];_0x203245[_0x83a5('0x45')]=qs['sort'](_0x556b99[_0x83a5('0x3e')][_0x83a5('0x46')]);_0x203245[_0x83a5('0x48')]=qs['filters'](_['pick'](_0x556b99[_0x83a5('0x3e')],_0x5a4397[_0x83a5('0x3f')]));if(_0x556b99[_0x83a5('0x3e')][_0x83a5('0x4c')]){_0x203245[_0x83a5('0x48')]=_[_0x83a5('0x49')](_0x203245[_0x83a5('0x48')],{'$or':_[_0x83a5('0x39')](_0x203245['attributes'],function(_0x5b1572){var _0x1b1265={};_0x1b1265[_0x5b1572]={'$like':'%'+_0x556b99[_0x83a5('0x3e')][_0x83a5('0x4c')]+'%'};return _0x1b1265;})});}_0x203245=_[_0x83a5('0x49')]({},_0x203245,_0x556b99[_0x83a5('0x4d')]);return _0x270b0e[_0x83a5('0x58')](_0x203245);}})[_0x83a5('0x36')](function(_0x52a950){if(_0x52a950){_0xa7b17f=_0x52a950[_0x83a5('0x43')];if(!_0x556b99[_0x83a5('0x3e')]['hasOwnProperty']('nolimit')){_0x203245[_0x83a5('0x30')]=qs['limit'](_0x556b99[_0x83a5('0x3e')][_0x83a5('0x30')]);_0x203245[_0x83a5('0x2f')]=qs['offset'](_0x556b99[_0x83a5('0x3e')][_0x83a5('0x2f')]);}return _0x270b0e[_0x83a5('0x58')](_0x203245);}})[_0x83a5('0x36')](function(_0x2d8b15){if(_0x2d8b15){return _0x2d8b15?{'count':_0xa7b17f,'rows':_0x2d8b15}:null;}})['then'](respondWithResult(_0x5a0f54,null))[_0x83a5('0x29')](handleError(_0x5a0f54,null));};exports[_0x83a5('0x5b')]=function(_0x41af85,_0x5577bc,_0x58fdf1){if(_0x41af85[_0x83a5('0x57')]['id']){delete _0x41af85['body']['id'];}return db[_0x83a5('0x3a')][_0x83a5('0x59')]({'where':{'id':_0x41af85[_0x83a5('0x52')]['id']}})[_0x83a5('0x36')](handleEntityNotFound(_0x5577bc,null))['then'](function(_0xf8d781){if(_0xf8d781){_0x41af85['body'][_0x83a5('0x5c')]=_0xf8d781['id'];_0x41af85[_0x83a5('0x57')][_0x83a5('0x5d')]=integrations[_0x83a5('0x5e')](_0x41af85[_0x83a5('0x57')][_0x83a5('0x5f')],_0x41af85['body'][_0x83a5('0x3c')]);_0x41af85['body'][_0x83a5('0x60')]=integrations[_0x83a5('0x61')](_0x41af85[_0x83a5('0x57')][_0x83a5('0x5f')],_0x41af85[_0x83a5('0x57')][_0x83a5('0x3c')]);return db['Dynamics365Configuration'][_0x83a5('0x56')](_0x41af85[_0x83a5('0x57')],{'include':[{'model':db[_0x83a5('0x62')],'as':_0x83a5('0x5d')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x83a5('0x36')](respondWithResult(_0x5577bc,null))['catch'](handleError(_0x5577bc,null));};exports['getFields']=function(_0x5f05b7,_0x54110a,_0x59bce2){var _0xa5bab7=_0x5f05b7['query'][_0x83a5('0x63')];var _0x29cc1e=_0xa5bab7==='incident'?_0x83a5('0x64'):_0x83a5('0x65');var _0x369dd4='';var _0x3b69e5='';var _0x445676='';var _0x11449d='';var _0x75761='';var _0x569f7c='';var _0x541d98='';var _0x25f479='';var _0xd87d74=['title','description',_0x83a5('0x66'),_0x83a5('0x67'),_0x83a5('0x68'),_0x83a5('0x69'),_0x83a5('0x6a'),_0x83a5('0x6b'),_0x83a5('0x6c'),_0x83a5('0x6d')];var _0x5ad9eb=['accountidname',_0x83a5('0x6e'),_0x83a5('0x6f'),_0x83a5('0x70'),_0x83a5('0x71'),_0x83a5('0x72'),_0x83a5('0x73'),_0x83a5('0x74'),_0x83a5('0x75'),_0x83a5('0x76'),_0x83a5('0x77'),_0x83a5('0x78'),_0x83a5('0x79'),_0x83a5('0x7a'),_0x83a5('0x7b'),'customeridname',_0x83a5('0x7c'),_0x83a5('0x7d'),_0x83a5('0x7e'),_0x83a5('0x7f'),_0x83a5('0x80'),_0x83a5('0x81'),'escalatedon','exchangerate',_0x83a5('0x82'),_0x83a5('0x83'),_0x83a5('0x84'),_0x83a5('0x85'),_0x83a5('0x86'),_0x83a5('0x87'),'masteridname',_0x83a5('0x88'),_0x83a5('0x89'),'modifiedbyname','modifiedbyyominame','modifiedon',_0x83a5('0x8a'),_0x83a5('0x8b'),_0x83a5('0x8c'),'msdyn_iotalertname','numberofchildincidents',_0x83a5('0x8d'),_0x83a5('0x8e'),_0x83a5('0x8f'),_0x83a5('0x90'),_0x83a5('0x91'),_0x83a5('0x92'),_0x83a5('0x93'),_0x83a5('0x94'),_0x83a5('0x95'),_0x83a5('0x96'),_0x83a5('0x97'),_0x83a5('0x98'),_0x83a5('0x99'),_0x83a5('0x9a'),_0x83a5('0x9b'),_0x83a5('0x9c'),_0x83a5('0x9d'),_0x83a5('0x9e'),_0x83a5('0x9f'),_0x83a5('0xa0'),'statecode',_0x83a5('0xa1'),'subjectidname',_0x83a5('0xa2'),'timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0x83a5('0xa3')];var _0x4aaa3f=_0xd87d74[_0x83a5('0xa4')](_0x5ad9eb);return db[_0x83a5('0x3a')][_0x83a5('0x59')]({'where':{'id':_0x5f05b7['params']['id']},'attributes':['id','username','password',_0x83a5('0xa5'),_0x83a5('0xa6'),'clientId',_0x83a5('0xa7')]})[_0x83a5('0x36')](handleEntityNotFound(_0x54110a,null))[_0x83a5('0x36')](function(_0x4e3340){if(_0x4e3340){_0x25f479=_0x4e3340[_0x83a5('0xa5')];var _0x41c07d=_0x25f479[_0x83a5('0xa8')](-0x1);if(_0x41c07d==='/'){_0x25f479=_0x25f479[_0x83a5('0xa9')](0x0,_0x25f479[_0x83a5('0xaa')](_0x41c07d));}_0x541d98=util[_0x83a5('0xab')](_0x83a5('0xac'),_0x25f479);var _0xaea75e={'method':_0x83a5('0xad'),'uri':_0x83a5('0xae')+_0x4e3340[_0x83a5('0xa6')]+_0x83a5('0xaf'),'form':{'client_id':_0x4e3340[_0x83a5('0xb0')],'resource':_0x25f479,'username':_0x4e3340[_0x83a5('0xb1')],'password':_0x4e3340[_0x83a5('0xb2')],'grant_type':'password','client_secret':_0x4e3340[_0x83a5('0xa7')]},'json':!![]};return rp(_0xaea75e);}})[_0x83a5('0x36')](function(_0xade276){_0x569f7c=_0xade276[_0x83a5('0xb3')];var _0x200fc2={'method':'GET','uri':encodeURI(_0x541d98+_0x83a5('0xb4')+_0x29cc1e+'\x27'),'headers':{'Authorization':_0x83a5('0xb5')+_0x569f7c,'If-None-Match':null,'OData-Version':_0x83a5('0xb6')},'json':!![]};return rp(_0x200fc2);})[_0x83a5('0x36')](function(_0x18c8bf){var _0x9de016=_0x18c8bf['value'][0x0];var _0x45e2cd=_0x9de016[_0x83a5('0xb7')];var _0x44028f={'method':_0x83a5('0xb8'),'uri':_0x541d98+_0x83a5('0xb9')+_0x45e2cd+_0x83a5('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x569f7c,'If-None-Match':null,'OData-Version':_0x83a5('0xb6')},'json':!![]};return rp(_0x44028f);})[_0x83a5('0x36')](function(_0x844c67){_0x369dd4=_0x844c67;_0x3b69e5=_0x369dd4[_0x83a5('0xbb')];_0x3b69e5=_['remove'](_0x3b69e5,function(_0xc6816a){return!_0x4aaa3f[_0x83a5('0xbc')](_0xc6816a[_0x83a5('0xbd')]);});var _0x2e9fa0=[];var _0x75f2d6=[];_0x3b69e5[_0x83a5('0xbe')](function(_0xf2d27a){if(_0xf2d27a[_0x83a5('0xbf')]){var _0x3a48cc=_0xf2d27a[_0x83a5('0xbf')]['substring'](_0xf2d27a[_0x83a5('0xbf')][_0x83a5('0xaa')]('.')+0x1);if(_0x3a48cc===_0x83a5('0xc0')){_0x2e9fa0[_0x83a5('0xc1')](getSelectList(_0x541d98,_0xa5bab7,_0x75f2d6,_0x369dd4['MetadataId'],_0xf2d27a[_0x83a5('0xb7')],_0x569f7c));}}});return Promise[_0x83a5('0xc2')](_0x2e9fa0);})['then'](function(_0x254710){_0x445676=_0x254710[0x0];var _0x31489e=[];var _0x4cc491=[];_0x3b69e5[_0x83a5('0xbe')](function(_0x2e7c50){if(!_[_0x83a5('0xc3')](_0x2e7c50[_0x83a5('0xbf')])){var _0x48e121=_0x2e7c50[_0x83a5('0xbf')]['substring'](_0x2e7c50[_0x83a5('0xbf')][_0x83a5('0xaa')]('.')+0x1);if(_0x48e121===_0x83a5('0xc4')){_0x31489e[_0x83a5('0xc1')](getBooleanList(_0x541d98,_0xa5bab7,_0x4cc491,_0x369dd4[_0x83a5('0xb7')],_0x2e7c50[_0x83a5('0xb7')],_0x569f7c));}}});return Promise[_0x83a5('0xc2')](_0x31489e);})['then'](function(_0x1b4b90){_0x11449d=_0x1b4b90[0x0];var _0x115756=[];var _0x4d0f93=[];_0x3b69e5[_0x83a5('0xbe')](function(_0xa2e3e8){if(_0xa2e3e8[_0x83a5('0xbf')]){var _0x48be91=_0xa2e3e8[_0x83a5('0xbf')]['substring'](_0xa2e3e8['@odata.type']['lastIndexOf']('.')+0x1);if(_0x48be91===_0x83a5('0xc5')||_0x48be91==='DoubleAttributeMetadata'||_0x48be91===_0x83a5('0xc6')||_0x48be91===_0x83a5('0xc7')||_0x48be91===_0x83a5('0xc8')||_0x48be91===_0x83a5('0xc9')||_0x48be91===_0x83a5('0xca')||_0x48be91===_0x83a5('0xcb')||_0x48be91==='StateAttributeMetadata'||_0x48be91===_0x83a5('0xcc')){_0x115756[_0x83a5('0xc1')](getInputList(_0x541d98,_0xa5bab7,_0x48be91,_0x4d0f93,_0x369dd4['MetadataId'],_0xa2e3e8[_0x83a5('0xb7')],_0x569f7c));}}});return Promise[_0x83a5('0xc2')](_0x115756);})[_0x83a5('0x36')](function(_0x27901a){_0x75761=_0x27901a[0x0];var _0x421436=_0x445676['concat'](_0x11449d)[_0x83a5('0xa4')](_0x75761);var _0x2c0d0a={'count':_0x421436[_0x83a5('0x43')],'rows':_0x421436};return _0x2c0d0a;})['then'](respondWithResult(_0x54110a,null))[_0x83a5('0x29')](function(_0x11bb10){var _0xfd938e=_0x5f05b7[_0x83a5('0x3e')]['test']?0x1f4:_0x11bb10['statusCode']||0x1f4;logger[_0x83a5('0x25')](_0x11bb10[_0x83a5('0x37')]);delete _0x11bb10[_0x83a5('0x4b')];if(_0xfd938e===0x191){_0xfd938e=0x190;}_0x54110a[_0x83a5('0x2b')](_0xfd938e)[_0x83a5('0xcd')](_0x5f05b7[_0x83a5('0x3e')][_0x83a5('0xce')]?{'message':_0x83a5('0xcf'),'statusCode':_0x11bb10[_0x83a5('0xd0')]}:_0x11bb10);});};function getSelectList(_0x3b8c4a,_0x3d2e5d,_0x22d4ae,_0x172c51,_0x3fad59,_0x681a16){var _0x5bb1cd={'method':_0x83a5('0xb8'),'uri':_0x3b8c4a+_0x83a5('0xb9')+_0x172c51+_0x83a5('0xd1')+_0x3fad59+_0x83a5('0xd2')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x83a5('0xb5')+_0x681a16,'If-None-Match':null,'OData-Version':_0x83a5('0xb6')},'json':!![]};return rp(_0x5bb1cd)[_0x83a5('0x36')](function(_0x746adc){var _0x1857a1=[];var _0x41db06=_0x746adc[_0x83a5('0xd3')][_0x83a5('0xd4')];_0x41db06['forEach'](function(_0x3c6663){_0x1857a1[_0x83a5('0xc1')]({'name':_0x3c6663[_0x83a5('0xd5')][_0x83a5('0xd6')][_0x83a5('0xd5')],'value':String(_0x3c6663[_0x83a5('0xd7')])});});var _0x41b992={'id':_0x3d2e5d+'_'+_0x746adc[_0x83a5('0xbd')],'name':_0x746adc['DisplayName'][_0x83a5('0xd6')][_0x83a5('0xd5')],'custom':![],'options':_0x1857a1};_0x22d4ae[_0x83a5('0xc1')](_0x41b992);return _0x22d4ae;});}function getBooleanList(_0x2fb758,_0x40e49c,_0x4986a3,_0x4609d1,_0x1a31b7,_0x3b48fd){var _0x2be9ba={'method':_0x83a5('0xb8'),'uri':_0x2fb758+_0x83a5('0xb9')+_0x4609d1+_0x83a5('0xd1')+_0x1a31b7+_0x83a5('0xd8'),'headers':{'Authorization':_0x83a5('0xb5')+_0x3b48fd,'If-None-Match':null,'OData-Version':_0x83a5('0xb6')},'json':!![]};return rp(_0x2be9ba)[_0x83a5('0x36')](function(_0x591a28){var _0x462a78=[];_0x462a78['push']({'name':_0x591a28[_0x83a5('0xd3')][_0x83a5('0xd9')][_0x83a5('0xd5')][_0x83a5('0xd6')][_0x83a5('0xd5')],'value':_0x83a5('0xda')},{'name':_0x591a28['OptionSet'][_0x83a5('0xdb')]['Label'][_0x83a5('0xd6')][_0x83a5('0xd5')],'value':_0x83a5('0xdc')});var _0x1d69c4={'id':_0x40e49c+'_'+_0x591a28[_0x83a5('0xbd')],'name':_0x591a28[_0x83a5('0xdd')][_0x83a5('0xd6')]['Label'],'custom':![],'options':_0x462a78};_0x4986a3[_0x83a5('0xc1')](_0x1d69c4);return _0x4986a3;});}function getInputList(_0x1444e1,_0x51bb0d,_0x2a491c,_0x4c5fdf,_0x4f9ea4,_0x290238,_0x40147b){var _0x441221={'method':'GET','uri':_0x1444e1+'EntityDefinitions('+_0x4f9ea4+_0x83a5('0xd1')+_0x290238+_0x83a5('0xde')+_0x2a491c+_0x83a5('0xdf'),'headers':{'Authorization':_0x83a5('0xb5')+_0x40147b,'If-None-Match':null,'OData-Version':_0x83a5('0xb6')},'json':!![]};return rp(_0x441221)[_0x83a5('0x36')](function(_0x49a01a){var _0x51c961={'id':_0x51bb0d+'_'+_0x49a01a['LogicalName'],'name':_0x49a01a[_0x83a5('0xdd')][_0x83a5('0xd6')]?_0x49a01a[_0x83a5('0xdd')]['UserLocalizedLabel'][_0x83a5('0xd5')]:_0x49a01a[_0x83a5('0xbd')],'custom':![],'options':[]};_0x4c5fdf[_0x83a5('0xc1')](_0x51c961);return _0x4c5fdf;});} \ No newline at end of file +var _0x330c=['createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_url','exchangerate','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','all','isNil','substring','push','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Attributes(','TrueOption','true','OptionSet','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','count','offset','set','apply','reject','update','then','destroy','end','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','keys','include','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Field','getFields','Incident','PhoneCall','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame'];(function(_0x843dca,_0x9a024f){var _0xda3ea=function(_0x57ae49){while(--_0x57ae49){_0x843dca['push'](_0x843dca['shift']());}};_0xda3ea(++_0x9a024f);}(_0x330c,0x14e));var _0xc330=function(_0x29eaaf,_0xb4ba16){_0x29eaaf=_0x29eaaf-0x0;var _0x23aac7=_0x330c[_0x29eaaf];return _0x23aac7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc330('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc330('0x1'));var rp=require(_0xc330('0x2'));var moment=require(_0xc330('0x3'));var BPromise=require(_0xc330('0x4'));var Mustache=require(_0xc330('0x5'));var util=require('util');var path=require(_0xc330('0x6'));var sox=require(_0xc330('0x7'));var csv=require(_0xc330('0x8'));var ejs=require(_0xc330('0x9'));var fs=require('fs');var _=require(_0xc330('0xa'));var squel=require(_0xc330('0xb'));var crypto=require('crypto');var jsforce=require(_0xc330('0xc'));var deskjs=require(_0xc330('0xd'));var toCsv=require(_0xc330('0x8'));var querystring=require(_0xc330('0xe'));var Papa=require(_0xc330('0xf'));var Redis=require(_0xc330('0x10'));var authService=require(_0xc330('0x11'));var qs=require(_0xc330('0x12'));var as=require(_0xc330('0x13'));var hardwareService=require(_0xc330('0x14'));var logger=require(_0xc330('0x15'))(_0xc330('0x16'));var utils=require(_0xc330('0x17'));var config=require('../../config/environment');var db=require(_0xc330('0x18'))['db'];var integrations=require(_0xc330('0x19'));var jayson=require(_0xc330('0x1a'));var client=jayson[_0xc330('0x1b')][_0xc330('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1ccaca,_0x4e5fd3,_0x413b85){if(_0x413b85){var _0xb1e1e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xb1e1e4['test'](_0x4e5fd3)){return _0x1ccaca;}else{throw new db[(_0xc330('0x1d'))][(_0xc330('0x1e'))](_0xc330('0x1f'));}}else{return _0x1ccaca;}}function respondWithRpcPromise(_0x20dc10,_0x2e8661,_0x59ed0c,_0x37099a){return new BPromise(function(_0x165079,_0x19ccb5){var _0x5f5ab7=_0x37099a||client;return _0x5f5ab7[_0xc330('0x20')](_0x20dc10,_0x59ed0c)['then'](function(_0x6c7cff){logger[_0xc330('0x21')](_0xc330('0x22'),_0x2e8661,_0xc330('0x23'));logger[_0xc330('0x24')](_0xc330('0x25'),_0x2e8661,_0xc330('0x23'),JSON['stringify'](_0x6c7cff));if(_0x6c7cff[_0xc330('0x26')]){if(_0x6c7cff[_0xc330('0x26')][_0xc330('0x27')]===0x1f4){logger['error'](_0xc330('0x22'),_0x2e8661,_0x6c7cff[_0xc330('0x26')][_0xc330('0x28')]);return _0x19ccb5(_0x6c7cff[_0xc330('0x26')][_0xc330('0x28')]);}logger[_0xc330('0x26')](_0xc330('0x22'),_0x2e8661,_0x6c7cff[_0xc330('0x26')][_0xc330('0x28')]);return _0x165079(_0x6c7cff['error']['message']);}else{logger[_0xc330('0x21')](_0xc330('0x22'),_0x2e8661,_0xc330('0x23'));_0x165079(_0x6c7cff[_0xc330('0x29')]['message']);}})[_0xc330('0x2a')](function(_0x2efcef){logger[_0xc330('0x26')](_0xc330('0x22'),_0x2e8661,_0x2efcef);_0x19ccb5(_0x2efcef);});});}function respondWithStatusCode(_0x486f46,_0x159f52){_0x159f52=_0x159f52||0xcc;return function(_0x4ab1e7){if(_0x4ab1e7){return _0x486f46['sendStatus'](_0x159f52);}return _0x486f46[_0xc330('0x2b')](_0x159f52)['end']();};}function respondWithResult(_0x124a26,_0xdd3cc2){_0xdd3cc2=_0xdd3cc2||0xc8;return function(_0x5a499e){if(_0x5a499e){return _0x124a26[_0xc330('0x2b')](_0xdd3cc2)[_0xc330('0x2c')](_0x5a499e);}};}function respondWithFilteredResult(_0x4f9601,_0x2683f1){return function(_0x3cb744){if(_0x3cb744){var _0x5939db=_0x3cb744[_0xc330('0x2d')],_0x7ca696=_0x2683f1['offset'],_0x10c4c5=_0x2683f1[_0xc330('0x2e')]+_0x2683f1['limit'],_0x405e6c;if(_0x10c4c5>=_0x5939db){_0x10c4c5=_0x5939db;_0x405e6c=0xc8;}else{_0x405e6c=0xce;}_0x4f9601['status'](_0x405e6c);return _0x4f9601[_0xc330('0x2f')]('Content-Range',_0x7ca696+'-'+_0x10c4c5+'/'+_0x5939db)[_0xc330('0x2c')](_0x3cb744);}return null;};}function patchUpdates(_0x4ebfd5){return function(_0x1098f6){try{jsonpatch[_0xc330('0x30')](_0x1098f6,_0x4ebfd5,!![]);}catch(_0x105060){return BPromise[_0xc330('0x31')](_0x105060);}return _0x1098f6['save']();};}function saveUpdates(_0x24d40b,_0x2e5c07){return function(_0x4a777b){if(_0x4a777b){return _0x4a777b[_0xc330('0x32')](_0x24d40b)[_0xc330('0x33')](function(_0x42d8ff){return _0x42d8ff;});}return null;};}function removeEntity(_0x491fec,_0x10cb7d){return function(_0x30f753){if(_0x30f753){return _0x30f753[_0xc330('0x34')]()['then'](function(){_0x491fec['status'](0xcc)[_0xc330('0x35')]();});}};}function handleEntityNotFound(_0x4aabed,_0x55e389){return function(_0x64ad3a){if(!_0x64ad3a){_0x4aabed['sendStatus'](0x194);}return _0x64ad3a;};}function handleError(_0x271fe5,_0x48c189){_0x48c189=_0x48c189||0x1f4;return function(_0x2ba241){logger[_0xc330('0x26')](_0x2ba241['stack']);if(_0x2ba241[_0xc330('0x36')]){delete _0x2ba241[_0xc330('0x36')];}_0x271fe5['status'](_0x48c189)[_0xc330('0x37')](_0x2ba241);};}exports[_0xc330('0x38')]=function(_0x3b75dd,_0x1050ad){var _0x4a7af8={},_0x312324={},_0x4a2f44={'count':0x0,'rows':[]};var _0x12c3a8=_[_0xc330('0x39')](db[_0xc330('0x3a')][_0xc330('0x3b')],function(_0x4e6ddf){return{'name':_0x4e6ddf[_0xc330('0x3c')],'type':_0x4e6ddf[_0xc330('0x3d')][_0xc330('0x3e')]};});_0x312324[_0xc330('0x3f')]=_[_0xc330('0x39')](_0x12c3a8,'name');_0x312324['query']=_['keys'](_0x3b75dd[_0xc330('0x40')]);_0x312324['filters']=_[_0xc330('0x41')](_0x312324[_0xc330('0x3f')],_0x312324[_0xc330('0x40')]);_0x4a7af8['attributes']=_[_0xc330('0x41')](_0x312324['model'],qs[_0xc330('0x42')](_0x3b75dd[_0xc330('0x40')][_0xc330('0x42')]));_0x4a7af8[_0xc330('0x43')]=_0x4a7af8[_0xc330('0x43')][_0xc330('0x44')]?_0x4a7af8['attributes']:_0x312324[_0xc330('0x3f')];if(!_0x3b75dd['query'][_0xc330('0x45')](_0xc330('0x46'))){_0x4a7af8[_0xc330('0x47')]=qs[_0xc330('0x47')](_0x3b75dd['query'][_0xc330('0x47')]);_0x4a7af8['offset']=qs['offset'](_0x3b75dd[_0xc330('0x40')][_0xc330('0x2e')]);}_0x4a7af8[_0xc330('0x48')]=qs[_0xc330('0x49')](_0x3b75dd[_0xc330('0x40')][_0xc330('0x49')]);_0x4a7af8[_0xc330('0x4a')]=qs[_0xc330('0x4b')](_[_0xc330('0x4c')](_0x3b75dd[_0xc330('0x40')],_0x312324[_0xc330('0x4b')]),_0x12c3a8);if(_0x3b75dd[_0xc330('0x40')]['filter']){_0x4a7af8[_0xc330('0x4a')]=_[_0xc330('0x4d')](_0x4a7af8[_0xc330('0x4a')],{'$or':_[_0xc330('0x39')](_0x12c3a8,function(_0x17fd7c){if(_0x17fd7c[_0xc330('0x3d')]!==_0xc330('0x4e')){var _0x33db52={};_0x33db52[_0x17fd7c[_0xc330('0x36')]]={'$like':'%'+_0x3b75dd[_0xc330('0x40')][_0xc330('0x4f')]+'%'};return _0x33db52;}})});}_0x4a7af8=_[_0xc330('0x4d')]({},_0x4a7af8,_0x3b75dd[_0xc330('0x50')]);var _0x1332fe={'where':_0x4a7af8[_0xc330('0x4a')]};return db['Dynamics365Account'][_0xc330('0x2d')](_0x1332fe)[_0xc330('0x33')](function(_0x3b8d70){_0x4a2f44[_0xc330('0x2d')]=_0x3b8d70;if(_0x3b75dd[_0xc330('0x40')][_0xc330('0x51')]){_0x4a7af8['include']=[{'all':!![]}];}return db[_0xc330('0x3a')][_0xc330('0x52')](_0x4a7af8);})[_0xc330('0x33')](function(_0x452c1c){_0x4a2f44[_0xc330('0x53')]=_0x452c1c;return _0x4a2f44;})['then'](respondWithFilteredResult(_0x1050ad,_0x4a7af8))['catch'](handleError(_0x1050ad,null));};exports[_0xc330('0x54')]=function(_0x38ce9e,_0x53c9dc){var _0x4be94b={'raw':![],'where':{'id':_0x38ce9e['params']['id']}},_0x5732d0={};_0x5732d0[_0xc330('0x3f')]=_['keys'](db['Dynamics365Account'][_0xc330('0x3b')]);_0x5732d0[_0xc330('0x40')]=_[_0xc330('0x55')](_0x38ce9e['query']);_0x5732d0[_0xc330('0x4b')]=_['intersection'](_0x5732d0['model'],_0x5732d0[_0xc330('0x40')]);_0x4be94b[_0xc330('0x43')]=_[_0xc330('0x41')](_0x5732d0[_0xc330('0x3f')],qs[_0xc330('0x42')](_0x38ce9e[_0xc330('0x40')][_0xc330('0x42')]));_0x4be94b[_0xc330('0x43')]=_0x4be94b['attributes'][_0xc330('0x44')]?_0x4be94b[_0xc330('0x43')]:_0x5732d0['model'];if(_0x38ce9e[_0xc330('0x40')][_0xc330('0x51')]){_0x4be94b[_0xc330('0x56')]=[{'all':!![]}];}_0x4be94b=_[_0xc330('0x4d')]({},_0x4be94b,_0x38ce9e[_0xc330('0x50')]);return db[_0xc330('0x3a')][_0xc330('0x57')](_0x4be94b)[_0xc330('0x33')](handleEntityNotFound(_0x53c9dc,null))['then'](respondWithResult(_0x53c9dc,null))[_0xc330('0x2a')](handleError(_0x53c9dc,null));};exports[_0xc330('0x58')]=function(_0x2467e5,_0x284c7e){return db[_0xc330('0x3a')][_0xc330('0x58')](_0x2467e5['body'],{})[_0xc330('0x33')](respondWithResult(_0x284c7e,0xc9))[_0xc330('0x2a')](handleError(_0x284c7e,null));};exports[_0xc330('0x32')]=function(_0x1567bb,_0x371e51){if(_0x1567bb[_0xc330('0x59')]['id']){delete _0x1567bb[_0xc330('0x59')]['id'];}return db[_0xc330('0x3a')][_0xc330('0x57')]({'where':{'id':_0x1567bb['params']['id']}})[_0xc330('0x33')](handleEntityNotFound(_0x371e51,null))[_0xc330('0x33')](saveUpdates(_0x1567bb[_0xc330('0x59')],null))[_0xc330('0x33')](respondWithResult(_0x371e51,null))[_0xc330('0x2a')](handleError(_0x371e51,null));};exports['destroy']=function(_0x497f23,_0x577c64){return db['Dynamics365Account'][_0xc330('0x57')]({'where':{'id':_0x497f23[_0xc330('0x5a')]['id']}})['then'](handleEntityNotFound(_0x577c64,null))[_0xc330('0x33')](removeEntity(_0x577c64,null))[_0xc330('0x2a')](handleError(_0x577c64,null));};exports[_0xc330('0x5b')]=function(_0x12d91d,_0x297b87,_0x22a4e0){var _0x39bb72={};var _0x11814c={};var _0x4bdc23;var _0x1c13db;return db[_0xc330('0x3a')][_0xc330('0x5c')]({'where':{'id':_0x12d91d[_0xc330('0x5a')]['id']}})[_0xc330('0x33')](handleEntityNotFound(_0x297b87,null))['then'](function(_0x35e56f){if(_0x35e56f){_0x4bdc23=_0x35e56f;_0x11814c['model']=_['keys'](db[_0xc330('0x5d')][_0xc330('0x3b')]);_0x11814c['query']=_['keys'](_0x12d91d[_0xc330('0x40')]);_0x11814c[_0xc330('0x4b')]=_[_0xc330('0x41')](_0x11814c['model'],_0x11814c[_0xc330('0x40')]);_0x39bb72[_0xc330('0x43')]=_[_0xc330('0x41')](_0x11814c[_0xc330('0x3f')],qs['fields'](_0x12d91d[_0xc330('0x40')][_0xc330('0x42')]));_0x39bb72['attributes']=_0x39bb72[_0xc330('0x43')][_0xc330('0x44')]?_0x39bb72[_0xc330('0x43')]:_0x11814c[_0xc330('0x3f')];_0x39bb72[_0xc330('0x48')]=qs[_0xc330('0x49')](_0x12d91d[_0xc330('0x40')][_0xc330('0x49')]);_0x39bb72[_0xc330('0x4a')]=qs[_0xc330('0x4b')](_['pick'](_0x12d91d[_0xc330('0x40')],_0x11814c['filters']));if(_0x12d91d[_0xc330('0x40')][_0xc330('0x4f')]){_0x39bb72[_0xc330('0x4a')]=_['merge'](_0x39bb72[_0xc330('0x4a')],{'$or':_[_0xc330('0x39')](_0x39bb72[_0xc330('0x43')],function(_0x10d5cf){var _0x2602a0={};_0x2602a0[_0x10d5cf]={'$like':'%'+_0x12d91d[_0xc330('0x40')]['filter']+'%'};return _0x2602a0;})});}_0x39bb72=_['merge']({},_0x39bb72,_0x12d91d[_0xc330('0x50')]);return _0x4bdc23[_0xc330('0x5b')](_0x39bb72);}})[_0xc330('0x33')](function(_0x2ccb6e){if(_0x2ccb6e){_0x1c13db=_0x2ccb6e[_0xc330('0x44')];if(!_0x12d91d['query'][_0xc330('0x45')]('nolimit')){_0x39bb72[_0xc330('0x47')]=qs[_0xc330('0x47')](_0x12d91d[_0xc330('0x40')][_0xc330('0x47')]);_0x39bb72[_0xc330('0x2e')]=qs[_0xc330('0x2e')](_0x12d91d['query'][_0xc330('0x2e')]);}return _0x4bdc23[_0xc330('0x5b')](_0x39bb72);}})['then'](function(_0x3418b2){if(_0x3418b2){return _0x3418b2?{'count':_0x1c13db,'rows':_0x3418b2}:null;}})[_0xc330('0x33')](respondWithResult(_0x297b87,null))['catch'](handleError(_0x297b87,null));};exports[_0xc330('0x5e')]=function(_0x50b498,_0xf1ae9a,_0x482d95){if(_0x50b498[_0xc330('0x59')]['id']){delete _0x50b498[_0xc330('0x59')]['id'];}return db[_0xc330('0x3a')]['findOne']({'where':{'id':_0x50b498[_0xc330('0x5a')]['id']}})[_0xc330('0x33')](handleEntityNotFound(_0xf1ae9a,null))[_0xc330('0x33')](function(_0x5e7c68){if(_0x5e7c68){_0x50b498[_0xc330('0x59')][_0xc330('0x5f')]=_0x5e7c68['id'];_0x50b498[_0xc330('0x59')][_0xc330('0x60')]=integrations[_0xc330('0x61')](_0x50b498[_0xc330('0x59')]['channel'],_0x50b498[_0xc330('0x59')]['type']);_0x50b498[_0xc330('0x59')][_0xc330('0x62')]=integrations[_0xc330('0x63')](_0x50b498[_0xc330('0x59')]['channel'],_0x50b498[_0xc330('0x59')][_0xc330('0x3d')]);return db[_0xc330('0x5d')][_0xc330('0x58')](_0x50b498[_0xc330('0x59')],{'include':[{'model':db['Dynamics365Field'],'as':_0xc330('0x60')},{'model':db[_0xc330('0x64')],'as':_0xc330('0x62')}]});}return null;})[_0xc330('0x33')](respondWithResult(_0xf1ae9a,null))[_0xc330('0x2a')](handleError(_0xf1ae9a,null));};exports[_0xc330('0x65')]=function(_0x3dee5a,_0x51703d,_0x2223c2){var _0x57a1eb=_0x3dee5a[_0xc330('0x40')]['ticketType'];var _0x2586d9=_0x57a1eb==='incident'?_0xc330('0x66'):_0xc330('0x67');var _0x7b3a3e='';var _0x4fe8e5='';var _0x5d2b8e='';var _0x34c76d='';var _0x26fec2='';var _0x33a789='';var _0x27cd61='';var _0x4d9c22='';var _0x42a49f=['title',_0xc330('0x68'),_0xc330('0x69'),_0xc330('0x6a'),_0xc330('0x6b'),'subject',_0xc330('0x6c'),_0xc330('0x6d'),_0xc330('0x6e'),'phonecall_activity_parties'];var _0x4de1e8=[_0xc330('0x6f'),'accountidyominame',_0xc330('0x70'),_0xc330('0x71'),_0xc330('0x72'),_0xc330('0x73'),_0xc330('0x74'),_0xc330('0x75'),_0xc330('0x76'),_0xc330('0x77'),_0xc330('0x78'),_0xc330('0x79'),_0xc330('0x7a'),_0xc330('0x7b'),_0xc330('0x7c'),_0xc330('0x7d'),'customeridtype',_0xc330('0x7e'),'emailaddress',_0xc330('0x7f'),'entityimage_timestamp',_0xc330('0x80'),'escalatedon',_0xc330('0x81'),'firstresponsebykpiidname',_0xc330('0x82'),'importsequencenumber',_0xc330('0x83'),_0xc330('0x84'),'lastonholdtime',_0xc330('0x85'),_0xc330('0x86'),_0xc330('0x87'),_0xc330('0x88'),_0xc330('0x89'),_0xc330('0x8a'),'modifiedonbehalfbyname',_0xc330('0x8b'),_0xc330('0x8c'),'msdyn_iotalertname',_0xc330('0x8d'),_0xc330('0x8e'),_0xc330('0x8f'),_0xc330('0x90'),_0xc330('0x91'),_0xc330('0x92'),_0xc330('0x93'),_0xc330('0x94'),'primarycontactidyominame',_0xc330('0x95'),'productidname',_0xc330('0x96'),_0xc330('0x97'),_0xc330('0x98'),_0xc330('0x99'),_0xc330('0x9a'),_0xc330('0x9b'),_0xc330('0x9c'),_0xc330('0x9d'),_0xc330('0x9e'),_0xc330('0x9f'),_0xc330('0xa0'),_0xc330('0xa1'),_0xc330('0xa2'),_0xc330('0xa3'),_0xc330('0xa4'),_0xc330('0xa5'),_0xc330('0xa6'),_0xc330('0xa7'),_0xc330('0xa8')];var _0x4d5cb5=_0x42a49f[_0xc330('0xa9')](_0x4de1e8);return db[_0xc330('0x3a')][_0xc330('0x5c')]({'where':{'id':_0x3dee5a['params']['id']},'attributes':['id',_0xc330('0xaa'),_0xc330('0xab'),_0xc330('0xac'),_0xc330('0xad'),'clientId',_0xc330('0xae')]})[_0xc330('0x33')](handleEntityNotFound(_0x51703d,null))[_0xc330('0x33')](function(_0x53ece4){if(_0x53ece4){_0x4d9c22=_0x53ece4[_0xc330('0xac')];var _0x8a3168=_0x4d9c22['slice'](-0x1);if(_0x8a3168==='/'){_0x4d9c22=_0x4d9c22['substring'](0x0,_0x4d9c22['lastIndexOf'](_0x8a3168));}_0x27cd61=util[_0xc330('0xaf')](_0xc330('0xb0'),_0x4d9c22);var _0xf56806={'method':_0xc330('0xb1'),'uri':_0xc330('0xb2')+_0x53ece4['tenantId']+_0xc330('0xb3'),'form':{'client_id':_0x53ece4[_0xc330('0xb4')],'resource':_0x4d9c22,'username':_0x53ece4[_0xc330('0xaa')],'password':_0x53ece4[_0xc330('0xab')],'grant_type':_0xc330('0xab'),'client_secret':_0x53ece4[_0xc330('0xae')]},'json':!![]};return rp(_0xf56806);}})[_0xc330('0x33')](function(_0x3c0978){_0x33a789=_0x3c0978[_0xc330('0xb5')];var _0x1fa137={'method':'GET','uri':encodeURI(_0x27cd61+_0xc330('0xb6')+_0x2586d9+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x33a789,'If-None-Match':null,'OData-Version':_0xc330('0xb7')},'json':!![]};return rp(_0x1fa137);})[_0xc330('0x33')](function(_0x183f22){var _0x3bbaf7=_0x183f22[_0xc330('0xb8')][0x0];var _0x49463b=_0x3bbaf7[_0xc330('0xb9')];var _0x384ff0={'method':_0xc330('0xba'),'uri':_0x27cd61+_0xc330('0xbb')+_0x49463b+_0xc330('0xbc'),'headers':{'Authorization':_0xc330('0xbd')+_0x33a789,'If-None-Match':null,'OData-Version':_0xc330('0xb7')},'json':!![]};return rp(_0x384ff0);})[_0xc330('0x33')](function(_0x16cfbe){_0x7b3a3e=_0x16cfbe;_0x4fe8e5=_0x7b3a3e[_0xc330('0xbe')];_0x4fe8e5=_['remove'](_0x4fe8e5,function(_0x4127fe){return!_0x4d5cb5['includes'](_0x4127fe['LogicalName']);});var _0xe4a104=[];var _0x49b7f0=[];_0x4fe8e5[_0xc330('0xbf')](function(_0xd837f){if(_0xd837f[_0xc330('0xc0')]){var _0x500c1e=_0xd837f[_0xc330('0xc0')]['substring'](_0xd837f['@odata.type'][_0xc330('0xc1')]('.')+0x1);if(_0x500c1e===_0xc330('0xc2')){_0xe4a104['push'](getSelectList(_0x27cd61,_0x57a1eb,_0x49b7f0,_0x7b3a3e[_0xc330('0xb9')],_0xd837f[_0xc330('0xb9')],_0x33a789));}}});return Promise[_0xc330('0xc3')](_0xe4a104);})['then'](function(_0x409fdb){_0x5d2b8e=_0x409fdb[0x0];var _0x14c8a3=[];var _0xf7ce8d=[];_0x4fe8e5[_0xc330('0xbf')](function(_0x2ae898){if(!_[_0xc330('0xc4')](_0x2ae898[_0xc330('0xc0')])){var _0x983faa=_0x2ae898[_0xc330('0xc0')][_0xc330('0xc5')](_0x2ae898[_0xc330('0xc0')][_0xc330('0xc1')]('.')+0x1);if(_0x983faa==='BooleanAttributeMetadata'){_0x14c8a3[_0xc330('0xc6')](getBooleanList(_0x27cd61,_0x57a1eb,_0xf7ce8d,_0x7b3a3e[_0xc330('0xb9')],_0x2ae898[_0xc330('0xb9')],_0x33a789));}}});return Promise[_0xc330('0xc3')](_0x14c8a3);})[_0xc330('0x33')](function(_0x24d293){_0x34c76d=_0x24d293[0x0];var _0x487353=[];var _0x5d50bc=[];_0x4fe8e5[_0xc330('0xbf')](function(_0x3c06b5){if(_0x3c06b5['@odata.type']){var _0x1925cb=_0x3c06b5[_0xc330('0xc0')][_0xc330('0xc5')](_0x3c06b5['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1925cb===_0xc330('0xc7')||_0x1925cb==='DoubleAttributeMetadata'||_0x1925cb===_0xc330('0xc8')||_0x1925cb===_0xc330('0xc9')||_0x1925cb===_0xc330('0xca')||_0x1925cb===_0xc330('0xcb')||_0x1925cb===_0xc330('0xcc')||_0x1925cb===_0xc330('0xcd')||_0x1925cb===_0xc330('0xce')||_0x1925cb===_0xc330('0xcf')){_0x487353[_0xc330('0xc6')](getInputList(_0x27cd61,_0x57a1eb,_0x1925cb,_0x5d50bc,_0x7b3a3e[_0xc330('0xb9')],_0x3c06b5['MetadataId'],_0x33a789));}}});return Promise[_0xc330('0xc3')](_0x487353);})[_0xc330('0x33')](function(_0x18b2f7){_0x26fec2=_0x18b2f7[0x0];var _0x2316f9=_0x5d2b8e[_0xc330('0xa9')](_0x34c76d)[_0xc330('0xa9')](_0x26fec2);var _0x5996eb={'count':_0x2316f9[_0xc330('0x44')],'rows':_0x2316f9};return _0x5996eb;})[_0xc330('0x33')](respondWithResult(_0x51703d,null))[_0xc330('0x2a')](function(_0x5d878f){var _0x325e35=_0x3dee5a[_0xc330('0x40')][_0xc330('0xd0')]?0x1f4:_0x5d878f[_0xc330('0xd1')]||0x1f4;logger['error'](_0x5d878f[_0xc330('0xd2')]);delete _0x5d878f[_0xc330('0x36')];if(_0x325e35===0x191){_0x325e35=0x190;}_0x51703d['status'](_0x325e35)['send'](_0x3dee5a[_0xc330('0x40')][_0xc330('0xd0')]?{'message':_0xc330('0xd3'),'statusCode':_0x5d878f[_0xc330('0xd1')]}:_0x5d878f);});};function getSelectList(_0x1d65f8,_0x3fcb82,_0x307055,_0x2ba0ac,_0x1fb308,_0x32898d){var _0xc958b9={'method':_0xc330('0xba'),'uri':_0x1d65f8+_0xc330('0xbb')+_0x2ba0ac+')/Attributes('+_0x1fb308+_0xc330('0xd4')+_0xc330('0xd5'),'headers':{'Authorization':_0xc330('0xbd')+_0x32898d,'If-None-Match':null,'OData-Version':_0xc330('0xb7')},'json':!![]};return rp(_0xc958b9)[_0xc330('0x33')](function(_0x149e64){var _0x23b6a0=[];var _0x24a354=_0x149e64['OptionSet']['Options'];_0x24a354[_0xc330('0xbf')](function(_0x121e46){_0x23b6a0[_0xc330('0xc6')]({'name':_0x121e46[_0xc330('0xd6')][_0xc330('0xd7')]['Label'],'value':String(_0x121e46[_0xc330('0xd8')])});});var _0x5f002a={'id':_0x3fcb82+'_'+_0x149e64[_0xc330('0xd9')],'name':_0x149e64[_0xc330('0xda')][_0xc330('0xd7')][_0xc330('0xd6')],'custom':![],'options':_0x23b6a0};_0x307055[_0xc330('0xc6')](_0x5f002a);return _0x307055;});}function getBooleanList(_0x6f96f1,_0x4c7938,_0x14ba45,_0x324571,_0x99c86a,_0x2e0f4e){var _0x39a763={'method':'GET','uri':_0x6f96f1+_0xc330('0xbb')+_0x324571+_0xc330('0xdb')+_0x99c86a+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc330('0xbd')+_0x2e0f4e,'If-None-Match':null,'OData-Version':_0xc330('0xb7')},'json':!![]};return rp(_0x39a763)[_0xc330('0x33')](function(_0x7dcf6c){var _0x3c36d6=[];_0x3c36d6[_0xc330('0xc6')]({'name':_0x7dcf6c['OptionSet'][_0xc330('0xdc')][_0xc330('0xd6')][_0xc330('0xd7')]['Label'],'value':_0xc330('0xdd')},{'name':_0x7dcf6c[_0xc330('0xde')][_0xc330('0xdf')][_0xc330('0xd6')][_0xc330('0xd7')][_0xc330('0xd6')],'value':_0xc330('0xe0')});var _0x1619d7={'id':_0x4c7938+'_'+_0x7dcf6c[_0xc330('0xd9')],'name':_0x7dcf6c[_0xc330('0xda')][_0xc330('0xd7')][_0xc330('0xd6')],'custom':![],'options':_0x3c36d6};_0x14ba45[_0xc330('0xc6')](_0x1619d7);return _0x14ba45;});}function getInputList(_0x3ac045,_0x21a122,_0x30e0d6,_0x31638e,_0xd0a316,_0x575808,_0x85c9a6){var _0x87ea12={'method':_0xc330('0xba'),'uri':_0x3ac045+'EntityDefinitions('+_0xd0a316+')/Attributes('+_0x575808+_0xc330('0xe1')+_0x30e0d6+_0xc330('0xe2'),'headers':{'Authorization':_0xc330('0xbd')+_0x85c9a6,'If-None-Match':null,'OData-Version':_0xc330('0xb7')},'json':!![]};return rp(_0x87ea12)[_0xc330('0x33')](function(_0x4896c8){var _0x406914={'id':_0x21a122+'_'+_0x4896c8[_0xc330('0xd9')],'name':_0x4896c8['DisplayName']['UserLocalizedLabel']?_0x4896c8[_0xc330('0xda')][_0xc330('0xd7')][_0xc330('0xd6')]:_0x4896c8[_0xc330('0xd9')],'custom':![],'options':[]};_0x31638e[_0xc330('0xc6')](_0x406914);return _0x31638e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f126099..12d4a1b 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 _0x4052=['moment','path','rimraf','../../config/environment','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4052,0xdf));var _0x2405=function(_0x375f5b,_0x2660cf){_0x375f5b=_0x375f5b-0x0;var _0x5b2b07=_0x4052[_0x375f5b];return _0x5b2b07;};'use strict';var _=require('lodash');var util=require(_0x2405('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2405('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2405('0x2'));var rimraf=require(_0x2405('0x3'));var config=require(_0x2405('0x4'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x2405('0x5'));module['exports']=function(_0x4aeaf8,_0x4177c5){return _0x4aeaf8['define'](_0x2405('0x6'),attributes,{'tableName':_0x2405('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd215=['./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0xd215,0xe9));var _0x5d21=function(_0x1936fa,_0x21ddcf){_0x1936fa=_0x1936fa-0x0;var _0x4fb29f=_0xd215[_0x1936fa];return _0x4fb29f;};'use strict';var _=require('lodash');var util=require(_0x5d21('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5d21('0x1'));var BPromise=require(_0x5d21('0x2'));var rp=require(_0x5d21('0x3'));var fs=require('fs');var path=require(_0x5d21('0x4'));var rimraf=require(_0x5d21('0x5'));var config=require(_0x5d21('0x6'));var attributes=require(_0x5d21('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x5d21('0x8')]=function(_0x565928,_0x34b98f){return _0x565928[_0x5d21('0x9')](_0x5d21('0xa'),attributes,{'tableName':_0x5d21('0xb'),'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 33d0e6e..06c72c2 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 _0x5a63=['message','result','catch','GetDynamics365Account','findAll','options','where','attributes','limit','include','map','model','ShowDynamics365Account','Dynamics365Account','find','raw','stringify','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3a61b1,_0xe64783){var _0x401ff0=function(_0x2ddc83){while(--_0x2ddc83){_0x3a61b1['push'](_0x3a61b1['shift']());}};_0x401ff0(++_0xe64783);}(_0x5a63,0xe3));var _0x35a6=function(_0x3138de,_0x2ae68a){_0x3138de=_0x3138de-0x0;var _0x50b2ce=_0x5a63[_0x3138de];return _0x50b2ce;};'use strict';var _=require(_0x35a6('0x0'));var util=require(_0x35a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35a6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x35a6('0x3'));var logger=require(_0x35a6('0x4'))(_0x35a6('0x5'));var config=require(_0x35a6('0x6'));var jayson=require(_0x35a6('0x7'));var client=jayson['client'][_0x35a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bdbfd,_0x210b8c,_0x4b06ed){return new BPromise(function(_0x3f3c96,_0x5089e2){return client[_0x35a6('0x9')](_0x5bdbfd,_0x4b06ed)[_0x35a6('0xa')](function(_0x44c4b5){logger[_0x35a6('0xb')](_0x35a6('0xc'),_0x210b8c,'request\x20sent');logger[_0x35a6('0xd')](_0x35a6('0xe'),_0x210b8c,_0x35a6('0xf'),JSON['stringify'](_0x44c4b5));if(_0x44c4b5[_0x35a6('0x10')]){if(_0x44c4b5['error'][_0x35a6('0x11')]===0x1f4){logger[_0x35a6('0x10')](_0x35a6('0xc'),_0x210b8c,_0x44c4b5[_0x35a6('0x10')][_0x35a6('0x12')]);return _0x5089e2(_0x44c4b5['error'][_0x35a6('0x12')]);}logger[_0x35a6('0x10')](_0x35a6('0xc'),_0x210b8c,_0x44c4b5[_0x35a6('0x10')][_0x35a6('0x12')]);return _0x3f3c96(_0x44c4b5[_0x35a6('0x10')]['message']);}else{logger[_0x35a6('0xb')](_0x35a6('0xc'),_0x210b8c,_0x35a6('0xf'));_0x3f3c96(_0x44c4b5[_0x35a6('0x13')][_0x35a6('0x12')]);}})[_0x35a6('0x14')](function(_0x502b5e){logger[_0x35a6('0x10')](_0x35a6('0xc'),_0x210b8c,_0x502b5e);_0x5089e2(_0x502b5e);});});}exports[_0x35a6('0x15')]=function(_0x39e50d){var _0x20cbf9=this;return new Promise(function(_0x108fb3,_0xc71d4d){return db['Dynamics365Account'][_0x35a6('0x16')]({'raw':_0x39e50d[_0x35a6('0x17')]?_0x39e50d[_0x35a6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x39e50d[_0x35a6('0x17')]?_0x39e50d[_0x35a6('0x17')][_0x35a6('0x18')]||null:null,'attributes':_0x39e50d['options']?_0x39e50d[_0x35a6('0x17')][_0x35a6('0x19')]||null:null,'limit':_0x39e50d['options']?_0x39e50d[_0x35a6('0x17')][_0x35a6('0x1a')]||null:null,'include':_0x39e50d['options']?_0x39e50d['options'][_0x35a6('0x1b')]?_[_0x35a6('0x1c')](_0x39e50d[_0x35a6('0x17')][_0x35a6('0x1b')],function(_0x643a2a){return{'model':db[_0x643a2a[_0x35a6('0x1d')]],'as':_0x643a2a['as'],'attributes':_0x643a2a[_0x35a6('0x19')],'include':_0x643a2a[_0x35a6('0x1b')]?_[_0x35a6('0x1c')](_0x643a2a[_0x35a6('0x1b')],function(_0x32553e){return{'model':db[_0x32553e[_0x35a6('0x1d')]],'as':_0x32553e['as'],'attributes':_0x32553e[_0x35a6('0x19')],'include':_0x32553e[_0x35a6('0x1b')]?_[_0x35a6('0x1c')](_0x32553e['include'],function(_0x55a867){return{'model':db[_0x55a867[_0x35a6('0x1d')]],'as':_0x55a867['as'],'attributes':_0x55a867[_0x35a6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35a6('0xa')](function(_0x4d68cd){logger[_0x35a6('0xb')](_0x35a6('0x15'),_0x39e50d);logger[_0x35a6('0xd')](_0x35a6('0x15'),_0x39e50d,JSON['stringify'](_0x4d68cd));_0x108fb3(_0x4d68cd);})[_0x35a6('0x14')](function(_0x386235){logger[_0x35a6('0x10')](_0x35a6('0x15'),_0x386235['message'],_0x39e50d);_0xc71d4d(_0x20cbf9['error'](0x1f4,_0x386235[_0x35a6('0x12')]));});});};exports[_0x35a6('0x1e')]=function(_0x47aa11){var _0x2a0719=this;return new Promise(function(_0x88953f,_0x26b173){return db[_0x35a6('0x1f')][_0x35a6('0x20')]({'raw':_0x47aa11[_0x35a6('0x17')]?_0x47aa11['options'][_0x35a6('0x21')]===undefined?!![]:![]:!![],'where':_0x47aa11[_0x35a6('0x17')]?_0x47aa11[_0x35a6('0x17')][_0x35a6('0x18')]||null:null,'attributes':_0x47aa11[_0x35a6('0x17')]?_0x47aa11['options'][_0x35a6('0x19')]||null:null,'include':_0x47aa11[_0x35a6('0x17')]?_0x47aa11['options'][_0x35a6('0x1b')]?_[_0x35a6('0x1c')](_0x47aa11[_0x35a6('0x17')][_0x35a6('0x1b')],function(_0x1b6725){return{'model':db[_0x1b6725[_0x35a6('0x1d')]],'as':_0x1b6725['as'],'attributes':_0x1b6725[_0x35a6('0x19')],'include':_0x1b6725[_0x35a6('0x1b')]?_[_0x35a6('0x1c')](_0x1b6725[_0x35a6('0x1b')],function(_0x19ed0c){return{'model':db[_0x19ed0c[_0x35a6('0x1d')]],'as':_0x19ed0c['as'],'attributes':_0x19ed0c[_0x35a6('0x19')],'include':_0x19ed0c[_0x35a6('0x1b')]?_['map'](_0x19ed0c['include'],function(_0x1dcec9){return{'model':db[_0x1dcec9['model']],'as':_0x1dcec9['as'],'attributes':_0x1dcec9[_0x35a6('0x19')]};}):[]};}):[]};}):[]:[]})[_0x35a6('0xa')](function(_0x22a8f5){logger['info']('ShowDynamics365Account',_0x47aa11);logger[_0x35a6('0xd')](_0x35a6('0x1e'),_0x47aa11,JSON[_0x35a6('0x22')](_0x22a8f5));_0x88953f(_0x22a8f5);})[_0x35a6('0x14')](function(_0x217a42){logger[_0x35a6('0x10')](_0x35a6('0x1e'),_0x217a42[_0x35a6('0x12')],_0x47aa11);_0x26b173(_0x2a0719['error'](0x1f4,_0x217a42[_0x35a6('0x12')]));});});}; \ No newline at end of file +var _0x3b74=['error','code','Dynamics365Account,\x20%s,\x20%s','message','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','catch','ShowDynamics365Account','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x34721e,_0x3fdee9){var _0x200b03=function(_0x5bef43){while(--_0x5bef43){_0x34721e['push'](_0x34721e['shift']());}};_0x200b03(++_0x3fdee9);}(_0x3b74,0x80));var _0x43b7=function(_0x7cdaf1,_0x40e620){_0x7cdaf1=_0x7cdaf1-0x0;var _0xf58e9a=_0x3b74[_0x7cdaf1];return _0xf58e9a;};'use strict';var _=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var moment=require(_0x43b7('0x2'));var BPromise=require(_0x43b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43b7('0x4'));var db=require(_0x43b7('0x5'))['db'];var utils=require(_0x43b7('0x6'));var logger=require(_0x43b7('0x7'))('rpc');var config=require(_0x43b7('0x8'));var jayson=require(_0x43b7('0x9'));var client=jayson[_0x43b7('0xa')][_0x43b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x454419,_0x2fb827,_0x536dc1){return new BPromise(function(_0x547b96,_0x1d88bc){return client[_0x43b7('0xc')](_0x454419,_0x536dc1)['then'](function(_0x11662a){logger[_0x43b7('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x2fb827,_0x43b7('0xe'));logger['debug'](_0x43b7('0xf'),_0x2fb827,_0x43b7('0xe'),JSON['stringify'](_0x11662a));if(_0x11662a['error']){if(_0x11662a[_0x43b7('0x10')][_0x43b7('0x11')]===0x1f4){logger['error'](_0x43b7('0x12'),_0x2fb827,_0x11662a['error'][_0x43b7('0x13')]);return _0x1d88bc(_0x11662a[_0x43b7('0x10')][_0x43b7('0x13')]);}logger['error'](_0x43b7('0x12'),_0x2fb827,_0x11662a[_0x43b7('0x10')][_0x43b7('0x13')]);return _0x547b96(_0x11662a[_0x43b7('0x10')][_0x43b7('0x13')]);}else{logger[_0x43b7('0xd')](_0x43b7('0x12'),_0x2fb827,_0x43b7('0xe'));_0x547b96(_0x11662a['result'][_0x43b7('0x13')]);}})['catch'](function(_0x1c7b95){logger[_0x43b7('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2fb827,_0x1c7b95);_0x1d88bc(_0x1c7b95);});});}exports[_0x43b7('0x14')]=function(_0xaaeba5){var _0x111798=this;return new Promise(function(_0xf8906d,_0x47905a){return db[_0x43b7('0x15')][_0x43b7('0x16')]({'raw':_0xaaeba5[_0x43b7('0x17')]?_0xaaeba5[_0x43b7('0x17')][_0x43b7('0x18')]===undefined?!![]:![]:!![],'where':_0xaaeba5[_0x43b7('0x17')]?_0xaaeba5[_0x43b7('0x17')][_0x43b7('0x19')]||null:null,'attributes':_0xaaeba5[_0x43b7('0x17')]?_0xaaeba5['options'][_0x43b7('0x1a')]||null:null,'limit':_0xaaeba5['options']?_0xaaeba5[_0x43b7('0x17')][_0x43b7('0x1b')]||null:null,'include':_0xaaeba5[_0x43b7('0x17')]?_0xaaeba5[_0x43b7('0x17')][_0x43b7('0x1c')]?_[_0x43b7('0x1d')](_0xaaeba5['options'][_0x43b7('0x1c')],function(_0x348257){return{'model':db[_0x348257['model']],'as':_0x348257['as'],'attributes':_0x348257[_0x43b7('0x1a')],'include':_0x348257['include']?_[_0x43b7('0x1d')](_0x348257[_0x43b7('0x1c')],function(_0x1f6bd7){return{'model':db[_0x1f6bd7[_0x43b7('0x1e')]],'as':_0x1f6bd7['as'],'attributes':_0x1f6bd7[_0x43b7('0x1a')],'include':_0x1f6bd7[_0x43b7('0x1c')]?_['map'](_0x1f6bd7[_0x43b7('0x1c')],function(_0x3be8a9){return{'model':db[_0x3be8a9['model']],'as':_0x3be8a9['as'],'attributes':_0x3be8a9[_0x43b7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x43b7('0x1f')](function(_0x461bed){logger[_0x43b7('0xd')]('GetDynamics365Account',_0xaaeba5);logger[_0x43b7('0x20')](_0x43b7('0x14'),_0xaaeba5,JSON['stringify'](_0x461bed));_0xf8906d(_0x461bed);})[_0x43b7('0x21')](function(_0x406b39){logger['error'](_0x43b7('0x14'),_0x406b39['message'],_0xaaeba5);_0x47905a(_0x111798[_0x43b7('0x10')](0x1f4,_0x406b39[_0x43b7('0x13')]));});});};exports[_0x43b7('0x22')]=function(_0xc8625c){var _0x1eede6=this;return new Promise(function(_0x246719,_0x26fc49){return db[_0x43b7('0x15')]['find']({'raw':_0xc8625c[_0x43b7('0x17')]?_0xc8625c[_0x43b7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xc8625c[_0x43b7('0x17')]?_0xc8625c[_0x43b7('0x17')][_0x43b7('0x19')]||null:null,'attributes':_0xc8625c[_0x43b7('0x17')]?_0xc8625c[_0x43b7('0x17')][_0x43b7('0x1a')]||null:null,'include':_0xc8625c[_0x43b7('0x17')]?_0xc8625c[_0x43b7('0x17')]['include']?_[_0x43b7('0x1d')](_0xc8625c[_0x43b7('0x17')][_0x43b7('0x1c')],function(_0x5b2d63){return{'model':db[_0x5b2d63['model']],'as':_0x5b2d63['as'],'attributes':_0x5b2d63[_0x43b7('0x1a')],'include':_0x5b2d63[_0x43b7('0x1c')]?_['map'](_0x5b2d63[_0x43b7('0x1c')],function(_0x13c096){return{'model':db[_0x13c096[_0x43b7('0x1e')]],'as':_0x13c096['as'],'attributes':_0x13c096[_0x43b7('0x1a')],'include':_0x13c096[_0x43b7('0x1c')]?_['map'](_0x13c096[_0x43b7('0x1c')],function(_0x289fcf){return{'model':db[_0x289fcf[_0x43b7('0x1e')]],'as':_0x289fcf['as'],'attributes':_0x289fcf['attributes']};}):[]};}):[]};}):[]:[]})[_0x43b7('0x1f')](function(_0xacb382){logger[_0x43b7('0xd')](_0x43b7('0x22'),_0xc8625c);logger[_0x43b7('0x20')](_0x43b7('0x22'),_0xc8625c,JSON[_0x43b7('0x23')](_0xacb382));_0x246719(_0xacb382);})[_0x43b7('0x21')](function(_0x3f7eb2){logger[_0x43b7('0x10')](_0x43b7('0x22'),_0x3f7eb2['message'],_0xc8625c);_0x26fc49(_0x1eede6['error'](0x1f4,_0x3f7eb2[_0x43b7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 083842f..c55d0a7 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 _0x2c89=['isAuthenticated','index','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x137267,_0x3ab102){var _0x555fc0=function(_0xdc72f6){while(--_0xdc72f6){_0x137267['push'](_0x137267['shift']());}};_0x555fc0(++_0x3ab102);}(_0x2c89,0xa7));var _0x92c8=function(_0x24e5b2,_0x219f56){_0x24e5b2=_0x24e5b2-0x0;var _0x4f4820=_0x2c89[_0x24e5b2];return _0x4f4820;};'use strict';var multer=require(_0x92c8('0x0'));var util=require('util');var path=require(_0x92c8('0x1'));var timeout=require(_0x92c8('0x2'));var express=require(_0x92c8('0x3'));var router=express[_0x92c8('0x4')]();var auth=require(_0x92c8('0x5'));var interaction=require(_0x92c8('0x6'));var config=require(_0x92c8('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0x92c8('0x8')]('/',auth[_0x92c8('0x9')](),controller[_0x92c8('0xa')]);router[_0x92c8('0x8')]('/:id',auth[_0x92c8('0x9')](),controller[_0x92c8('0xb')]);router[_0x92c8('0x8')](_0x92c8('0xc'),auth[_0x92c8('0x9')](),controller[_0x92c8('0xd')]);router[_0x92c8('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x92c8('0x8')](_0x92c8('0xe'),auth[_0x92c8('0x9')](),controller[_0x92c8('0xf')]);router[_0x92c8('0x10')]('/',auth['isAuthenticated'](),controller[_0x92c8('0x11')]);router[_0x92c8('0x12')](_0x92c8('0x13'),auth[_0x92c8('0x9')](),controller['update']);router[_0x92c8('0x14')](_0x92c8('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0x92c8('0x15')]=router; \ No newline at end of file +var _0x9ba9=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x355675,_0xdfada4){var _0xe330e0=function(_0x6acd1d){while(--_0x6acd1d){_0x355675['push'](_0x355675['shift']());}};_0xe330e0(++_0xdfada4);}(_0x9ba9,0x7b));var _0x99ba=function(_0x142f98,_0x35d63e){_0x142f98=_0x142f98-0x0;var _0x2153bd=_0x9ba9[_0x142f98];return _0x2153bd;};'use strict';var multer=require(_0x99ba('0x0'));var util=require(_0x99ba('0x1'));var path=require(_0x99ba('0x2'));var timeout=require('connect-timeout');var express=require(_0x99ba('0x3'));var router=express[_0x99ba('0x4')]();var auth=require(_0x99ba('0x5'));var interaction=require(_0x99ba('0x6'));var config=require(_0x99ba('0x7'));var controller=require(_0x99ba('0x8'));router[_0x99ba('0x9')]('/',auth[_0x99ba('0xa')](),controller[_0x99ba('0xb')]);router[_0x99ba('0x9')](_0x99ba('0xc'),auth[_0x99ba('0xa')](),controller['show']);router['get']('/:id/fields',auth[_0x99ba('0xa')](),controller[_0x99ba('0xd')]);router[_0x99ba('0x9')](_0x99ba('0xe'),auth['isAuthenticated'](),controller[_0x99ba('0xf')]);router[_0x99ba('0x9')](_0x99ba('0x10'),auth[_0x99ba('0xa')](),controller[_0x99ba('0x11')]);router[_0x99ba('0x12')]('/',auth[_0x99ba('0xa')](),controller[_0x99ba('0x13')]);router['put'](_0x99ba('0xc'),auth[_0x99ba('0xa')](),controller[_0x99ba('0x14')]);router[_0x99ba('0x15')]('/:id',auth[_0x99ba('0xa')](),controller[_0x99ba('0x16')]);module[_0x99ba('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index bb8f3c3..8cdcddb 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 _0x7fc8=['incident','phonecall','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7fc8,0x6e));var _0x87fc=function(_0x23c459,_0x323a1a){_0x23c459=_0x23c459-0x0;var _0x5e7e89=_0x7fc8[_0x23c459];return _0x5e7e89;};'use strict';var Sequelize=require(_0x87fc('0x0'));module[_0x87fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x87fc('0x2'),_0x87fc('0x3')),'defaultValue':_0x87fc('0x2')}}; \ No newline at end of file +var _0x200c=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0x301075,_0x33b785){var _0x1a04c5=function(_0x8d5143){while(--_0x8d5143){_0x301075['push'](_0x301075['shift']());}};_0x1a04c5(++_0x33b785);}(_0x200c,0xb2));var _0xc200=function(_0x2a0858,_0x6cb40f){_0x2a0858=_0x2a0858-0x0;var _0xebcf30=_0x200c[_0x2a0858];return _0xebcf30;};'use strict';var Sequelize=require(_0xc200('0x0'));module[_0xc200('0x1')]={'name':{'type':Sequelize[_0xc200('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xc200('0x3')](_0xc200('0x4'),_0xc200('0x5')),'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 54ae450..a7e6114 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 _0x40ca=['ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','params','length','find','create','body','update','destroy','getFields','keys','Dynamics365Field','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x5ce766,_0xebd39){var _0x3c8a01=function(_0x561ff1){while(--_0x561ff1){_0x5ce766['push'](_0x5ce766['shift']());}};_0x3c8a01(++_0xebd39);}(_0x40ca,0xb5));var _0xa40c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x40ca[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0xa40c('0x0'));var emlformat=require(_0xa40c('0x1'));var rimraf=require(_0xa40c('0x2'));var zipdir=require(_0xa40c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa40c('0x4'));var moment=require(_0xa40c('0x5'));var BPromise=require(_0xa40c('0x6'));var Mustache=require(_0xa40c('0x7'));var util=require(_0xa40c('0x8'));var path=require(_0xa40c('0x9'));var sox=require(_0xa40c('0xa'));var csv=require('to-csv');var ejs=require(_0xa40c('0xb'));var fs=require('fs');var _=require(_0xa40c('0xc'));var squel=require(_0xa40c('0xd'));var crypto=require(_0xa40c('0xe'));var jsforce=require(_0xa40c('0xf'));var deskjs=require(_0xa40c('0x10'));var toCsv=require(_0xa40c('0x11'));var querystring=require(_0xa40c('0x12'));var Papa=require(_0xa40c('0x13'));var Redis=require('ioredis');var authService=require(_0xa40c('0x14'));var qs=require(_0xa40c('0x15'));var as=require(_0xa40c('0x16'));var hardwareService=require(_0xa40c('0x17'));var logger=require(_0xa40c('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xa40c('0x19'));var db=require(_0xa40c('0x1a'))['db'];var jayson=require(_0xa40c('0x1b'));var client=jayson[_0xa40c('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x33a2c7,_0x20d87a,_0x3901c3){if(_0x3901c3){var _0x379dc6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x379dc6[_0xa40c('0x1d')](_0x20d87a)){return _0x33a2c7;}else{throw new db[(_0xa40c('0x1e'))][(_0xa40c('0x1f'))](_0xa40c('0x20'));}}else{return _0x33a2c7;}}function respondWithRpcPromise(_0x5f0449,_0x32ca4e,_0x29a4a6,_0x245a1d){return new BPromise(function(_0x23e85b,_0x1f8b6c){var _0x36b31c=_0x245a1d||client;return _0x36b31c[_0xa40c('0x21')](_0x5f0449,_0x29a4a6)[_0xa40c('0x22')](function(_0x4738c4){logger[_0xa40c('0x23')]('Dynamics365Configuration,\x20%s,\x20%s',_0x32ca4e,_0xa40c('0x24'));logger['debug'](_0xa40c('0x25'),_0x32ca4e,_0xa40c('0x24'),JSON[_0xa40c('0x26')](_0x4738c4));if(_0x4738c4[_0xa40c('0x27')]){if(_0x4738c4[_0xa40c('0x27')][_0xa40c('0x28')]===0x1f4){logger[_0xa40c('0x27')](_0xa40c('0x29'),_0x32ca4e,_0x4738c4[_0xa40c('0x27')][_0xa40c('0x2a')]);return _0x1f8b6c(_0x4738c4[_0xa40c('0x27')]['message']);}logger[_0xa40c('0x27')]('Dynamics365Configuration,\x20%s,\x20%s',_0x32ca4e,_0x4738c4[_0xa40c('0x27')][_0xa40c('0x2a')]);return _0x23e85b(_0x4738c4[_0xa40c('0x27')]['message']);}else{logger[_0xa40c('0x23')]('Dynamics365Configuration,\x20%s,\x20%s',_0x32ca4e,_0xa40c('0x24'));_0x23e85b(_0x4738c4[_0xa40c('0x2b')][_0xa40c('0x2a')]);}})[_0xa40c('0x2c')](function(_0x192507){logger[_0xa40c('0x27')](_0xa40c('0x29'),_0x32ca4e,_0x192507);_0x1f8b6c(_0x192507);});});}function respondWithStatusCode(_0x321a3f,_0x47e701){_0x47e701=_0x47e701||0xcc;return function(_0x11e9a8){if(_0x11e9a8){return _0x321a3f[_0xa40c('0x2d')](_0x47e701);}return _0x321a3f[_0xa40c('0x2e')](_0x47e701)[_0xa40c('0x2f')]();};}function respondWithResult(_0x33d1d3,_0xb14745){_0xb14745=_0xb14745||0xc8;return function(_0x5d8772){if(_0x5d8772){return _0x33d1d3[_0xa40c('0x2e')](_0xb14745)['json'](_0x5d8772);}};}function respondWithFilteredResult(_0x49475a,_0x8f9f15){return function(_0x20bca7){if(_0x20bca7){var _0x283d6f=_0x20bca7[_0xa40c('0x30')],_0xaad5cc=_0x8f9f15['offset'],_0x6dfb12=_0x8f9f15[_0xa40c('0x31')]+_0x8f9f15[_0xa40c('0x32')],_0x6add0;if(_0x6dfb12>=_0x283d6f){_0x6dfb12=_0x283d6f;_0x6add0=0xc8;}else{_0x6add0=0xce;}_0x49475a[_0xa40c('0x2e')](_0x6add0);return _0x49475a['set'](_0xa40c('0x33'),_0xaad5cc+'-'+_0x6dfb12+'/'+_0x283d6f)['json'](_0x20bca7);}return null;};}function patchUpdates(_0x489627){return function(_0x259442){try{jsonpatch[_0xa40c('0x34')](_0x259442,_0x489627,!![]);}catch(_0x5d6704){return BPromise[_0xa40c('0x35')](_0x5d6704);}return _0x259442[_0xa40c('0x36')]();};}function saveUpdates(_0x21e974,_0x22c3d5){return function(_0x3f36c3){if(_0x3f36c3){return _0x3f36c3['update'](_0x21e974)[_0xa40c('0x22')](function(_0x5c1c32){return _0x5c1c32;});}return null;};}function removeEntity(_0x482019,_0x212902){return function(_0x1bcad2){if(_0x1bcad2){return _0x1bcad2['destroy']()[_0xa40c('0x22')](function(){_0x482019[_0xa40c('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcd6aa3,_0x3f5f91){return function(_0x5993d8){if(!_0x5993d8){_0xcd6aa3[_0xa40c('0x2d')](0x194);}return _0x5993d8;};}function handleError(_0x230f43,_0x3fd9fe){_0x3fd9fe=_0x3fd9fe||0x1f4;return function(_0x2a0b16){logger[_0xa40c('0x27')](_0x2a0b16[_0xa40c('0x37')]);if(_0x2a0b16['name']){delete _0x2a0b16[_0xa40c('0x38')];}_0x230f43[_0xa40c('0x2e')](_0x3fd9fe)[_0xa40c('0x39')](_0x2a0b16);};}exports[_0xa40c('0x3a')]=function(_0x5687f6,_0x2f8219){var _0x5b4a23={},_0x8bf645={},_0x1af709={'count':0x0,'rows':[]};var _0x53e604=_[_0xa40c('0x3b')](db[_0xa40c('0x3c')][_0xa40c('0x3d')],function(_0x7fb8d7){return{'name':_0x7fb8d7[_0xa40c('0x3e')],'type':_0x7fb8d7[_0xa40c('0x3f')][_0xa40c('0x40')]};});_0x8bf645[_0xa40c('0x41')]=_[_0xa40c('0x3b')](_0x53e604,_0xa40c('0x38'));_0x8bf645[_0xa40c('0x42')]=_['keys'](_0x5687f6[_0xa40c('0x42')]);_0x8bf645['filters']=_['intersection'](_0x8bf645[_0xa40c('0x41')],_0x8bf645['query']);_0x5b4a23[_0xa40c('0x43')]=_[_0xa40c('0x44')](_0x8bf645[_0xa40c('0x41')],qs[_0xa40c('0x45')](_0x5687f6[_0xa40c('0x42')][_0xa40c('0x45')]));_0x5b4a23[_0xa40c('0x43')]=_0x5b4a23[_0xa40c('0x43')]['length']?_0x5b4a23[_0xa40c('0x43')]:_0x8bf645[_0xa40c('0x41')];if(!_0x5687f6[_0xa40c('0x42')][_0xa40c('0x46')](_0xa40c('0x47'))){_0x5b4a23[_0xa40c('0x32')]=qs[_0xa40c('0x32')](_0x5687f6['query']['limit']);_0x5b4a23[_0xa40c('0x31')]=qs[_0xa40c('0x31')](_0x5687f6['query'][_0xa40c('0x31')]);}_0x5b4a23[_0xa40c('0x48')]=qs[_0xa40c('0x49')](_0x5687f6[_0xa40c('0x42')][_0xa40c('0x49')]);_0x5b4a23['where']=qs[_0xa40c('0x4a')](_[_0xa40c('0x4b')](_0x5687f6['query'],_0x8bf645['filters']),_0x53e604);if(_0x5687f6[_0xa40c('0x42')][_0xa40c('0x4c')]){_0x5b4a23[_0xa40c('0x4d')]=_[_0xa40c('0x4e')](_0x5b4a23[_0xa40c('0x4d')],{'$or':_[_0xa40c('0x3b')](_0x53e604,function(_0x651013){if(_0x651013[_0xa40c('0x3f')]!==_0xa40c('0x4f')){var _0x2bf038={};_0x2bf038[_0x651013[_0xa40c('0x38')]]={'$like':'%'+_0x5687f6[_0xa40c('0x42')][_0xa40c('0x4c')]+'%'};return _0x2bf038;}})});}_0x5b4a23=_[_0xa40c('0x4e')]({},_0x5b4a23,_0x5687f6[_0xa40c('0x50')]);var _0xef6ea0={'where':_0x5b4a23['where']};return db[_0xa40c('0x3c')]['count'](_0xef6ea0)[_0xa40c('0x22')](function(_0x6419d2){_0x1af709['count']=_0x6419d2;if(_0x5687f6[_0xa40c('0x42')][_0xa40c('0x51')]){_0x5b4a23['include']=[{'all':!![]}];}return db[_0xa40c('0x3c')][_0xa40c('0x52')](_0x5b4a23);})[_0xa40c('0x22')](function(_0x26db34){_0x1af709['rows']=_0x26db34;return _0x1af709;})[_0xa40c('0x22')](respondWithFilteredResult(_0x2f8219,_0x5b4a23))[_0xa40c('0x2c')](handleError(_0x2f8219,null));};exports['show']=function(_0x36b5fa,_0x4b193a){var _0x51846f={'raw':![],'where':{'id':_0x36b5fa[_0xa40c('0x53')]['id']}},_0x552edf={};_0x552edf[_0xa40c('0x41')]=_['keys'](db[_0xa40c('0x3c')][_0xa40c('0x3d')]);_0x552edf[_0xa40c('0x42')]=_['keys'](_0x36b5fa[_0xa40c('0x42')]);_0x552edf[_0xa40c('0x4a')]=_[_0xa40c('0x44')](_0x552edf[_0xa40c('0x41')],_0x552edf[_0xa40c('0x42')]);_0x51846f[_0xa40c('0x43')]=_[_0xa40c('0x44')](_0x552edf[_0xa40c('0x41')],qs[_0xa40c('0x45')](_0x36b5fa['query'][_0xa40c('0x45')]));_0x51846f[_0xa40c('0x43')]=_0x51846f['attributes'][_0xa40c('0x54')]?_0x51846f[_0xa40c('0x43')]:_0x552edf[_0xa40c('0x41')];if(_0x36b5fa['query'][_0xa40c('0x51')]){_0x51846f['include']=[{'all':!![]}];}_0x51846f=_[_0xa40c('0x4e')]({},_0x51846f,_0x36b5fa[_0xa40c('0x50')]);return db[_0xa40c('0x3c')][_0xa40c('0x55')](_0x51846f)[_0xa40c('0x22')](handleEntityNotFound(_0x4b193a,null))[_0xa40c('0x22')](respondWithResult(_0x4b193a,null))[_0xa40c('0x2c')](handleError(_0x4b193a,null));};exports[_0xa40c('0x56')]=function(_0x2026ba,_0x11605f){return db[_0xa40c('0x3c')][_0xa40c('0x56')](_0x2026ba[_0xa40c('0x57')],{})[_0xa40c('0x22')](respondWithResult(_0x11605f,0xc9))[_0xa40c('0x2c')](handleError(_0x11605f,null));};exports[_0xa40c('0x58')]=function(_0x2e64fc,_0x3a7f01){if(_0x2e64fc['body']['id']){delete _0x2e64fc[_0xa40c('0x57')]['id'];}return db[_0xa40c('0x3c')][_0xa40c('0x55')]({'where':{'id':_0x2e64fc[_0xa40c('0x53')]['id']}})[_0xa40c('0x22')](handleEntityNotFound(_0x3a7f01,null))[_0xa40c('0x22')](saveUpdates(_0x2e64fc[_0xa40c('0x57')],null))['then'](respondWithResult(_0x3a7f01,null))['catch'](handleError(_0x3a7f01,null));};exports[_0xa40c('0x59')]=function(_0x1db520,_0x515c0e){return db['Dynamics365Configuration'][_0xa40c('0x55')]({'where':{'id':_0x1db520[_0xa40c('0x53')]['id']}})['then'](handleEntityNotFound(_0x515c0e,null))[_0xa40c('0x22')](removeEntity(_0x515c0e,null))[_0xa40c('0x2c')](handleError(_0x515c0e,null));};exports[_0xa40c('0x5a')]=function(_0x5bd6b7,_0xbc0b2c,_0x149bec){var _0x3c8271={};var _0x1d41b9={};var _0x1b9d26;var _0x395295;return db[_0xa40c('0x3c')]['findOne']({'where':{'id':_0x5bd6b7[_0xa40c('0x53')]['id']}})[_0xa40c('0x22')](handleEntityNotFound(_0xbc0b2c,null))['then'](function(_0xca6fc0){if(_0xca6fc0){_0x1b9d26=_0xca6fc0;_0x1d41b9[_0xa40c('0x41')]=_[_0xa40c('0x5b')](db['Dynamics365Field'][_0xa40c('0x3d')]);_0x1d41b9[_0xa40c('0x42')]=_[_0xa40c('0x5b')](_0x5bd6b7['query']);_0x1d41b9[_0xa40c('0x4a')]=_[_0xa40c('0x44')](_0x1d41b9[_0xa40c('0x41')],_0x1d41b9['query']);_0x3c8271[_0xa40c('0x43')]=_['intersection'](_0x1d41b9[_0xa40c('0x41')],qs[_0xa40c('0x45')](_0x5bd6b7[_0xa40c('0x42')][_0xa40c('0x45')]));_0x3c8271[_0xa40c('0x43')]=_0x3c8271[_0xa40c('0x43')][_0xa40c('0x54')]?_0x3c8271['attributes']:_0x1d41b9[_0xa40c('0x41')];_0x3c8271['order']=qs['sort'](_0x5bd6b7[_0xa40c('0x42')][_0xa40c('0x49')]);_0x3c8271['where']=qs['filters'](_[_0xa40c('0x4b')](_0x5bd6b7['query'],_0x1d41b9[_0xa40c('0x4a')]));if(_0x5bd6b7['query'][_0xa40c('0x4c')]){_0x3c8271[_0xa40c('0x4d')]=_[_0xa40c('0x4e')](_0x3c8271['where'],{'$or':_[_0xa40c('0x3b')](_0x3c8271['attributes'],function(_0x443c60){var _0x441581={};_0x441581[_0x443c60]={'$like':'%'+_0x5bd6b7[_0xa40c('0x42')]['filter']+'%'};return _0x441581;})});}_0x3c8271=_[_0xa40c('0x4e')]({},_0x3c8271,_0x5bd6b7[_0xa40c('0x50')]);return _0x1b9d26[_0xa40c('0x5a')](_0x3c8271);}})[_0xa40c('0x22')](function(_0xfd5c97){if(_0xfd5c97){_0x395295=_0xfd5c97['length'];if(!_0x5bd6b7['query']['hasOwnProperty'](_0xa40c('0x47'))){_0x3c8271[_0xa40c('0x32')]=qs['limit'](_0x5bd6b7[_0xa40c('0x42')][_0xa40c('0x32')]);_0x3c8271[_0xa40c('0x31')]=qs[_0xa40c('0x31')](_0x5bd6b7['query'][_0xa40c('0x31')]);}return _0x1b9d26[_0xa40c('0x5a')](_0x3c8271);}})['then'](function(_0xf6fc9d){if(_0xf6fc9d){return _0xf6fc9d?{'count':_0x395295,'rows':_0xf6fc9d}:null;}})[_0xa40c('0x22')](respondWithResult(_0xbc0b2c,null))[_0xa40c('0x2c')](handleError(_0xbc0b2c,null));};exports['getSubjects']=function(_0x2bca3a,_0x268944,_0x33cb8b){var _0x3971f7={};var _0x15d40c={};var _0x56d6f1;var _0x5b90bf;return db[_0xa40c('0x3c')]['findOne']({'where':{'id':_0x2bca3a[_0xa40c('0x53')]['id']}})[_0xa40c('0x22')](handleEntityNotFound(_0x268944,null))[_0xa40c('0x22')](function(_0x45ce25){if(_0x45ce25){_0x56d6f1=_0x45ce25;_0x15d40c[_0xa40c('0x41')]=_[_0xa40c('0x5b')](db[_0xa40c('0x5c')][_0xa40c('0x3d')]);_0x15d40c[_0xa40c('0x42')]=_[_0xa40c('0x5b')](_0x2bca3a[_0xa40c('0x42')]);_0x15d40c[_0xa40c('0x4a')]=_[_0xa40c('0x44')](_0x15d40c[_0xa40c('0x41')],_0x15d40c[_0xa40c('0x42')]);_0x3971f7[_0xa40c('0x43')]=_['intersection'](_0x15d40c[_0xa40c('0x41')],qs[_0xa40c('0x45')](_0x2bca3a[_0xa40c('0x42')][_0xa40c('0x45')]));_0x3971f7['attributes']=_0x3971f7[_0xa40c('0x43')][_0xa40c('0x54')]?_0x3971f7['attributes']:_0x15d40c[_0xa40c('0x41')];_0x3971f7[_0xa40c('0x48')]=qs['sort'](_0x2bca3a[_0xa40c('0x42')][_0xa40c('0x49')]);_0x3971f7[_0xa40c('0x4d')]=qs['filters'](_[_0xa40c('0x4b')](_0x2bca3a[_0xa40c('0x42')],_0x15d40c[_0xa40c('0x4a')]));if(_0x2bca3a[_0xa40c('0x42')][_0xa40c('0x4c')]){_0x3971f7[_0xa40c('0x4d')]=_[_0xa40c('0x4e')](_0x3971f7['where'],{'$or':_['map'](_0x3971f7[_0xa40c('0x43')],function(_0x2997b3){var _0x3fec77={};_0x3fec77[_0x2997b3]={'$like':'%'+_0x2bca3a[_0xa40c('0x42')][_0xa40c('0x4c')]+'%'};return _0x3fec77;})});}_0x3971f7=_[_0xa40c('0x4e')]({},_0x3971f7,_0x2bca3a[_0xa40c('0x50')]);return _0x56d6f1[_0xa40c('0x5d')](_0x3971f7);}})['then'](function(_0xb19189){if(_0xb19189){_0x5b90bf=_0xb19189['length'];if(!_0x2bca3a[_0xa40c('0x42')][_0xa40c('0x46')]('nolimit')){_0x3971f7['limit']=qs[_0xa40c('0x32')](_0x2bca3a[_0xa40c('0x42')][_0xa40c('0x32')]);_0x3971f7[_0xa40c('0x31')]=qs[_0xa40c('0x31')](_0x2bca3a[_0xa40c('0x42')]['offset']);}return _0x56d6f1[_0xa40c('0x5d')](_0x3971f7);}})['then'](function(_0x13fac7){if(_0x13fac7){return _0x13fac7?{'count':_0x5b90bf,'rows':_0x13fac7}:null;}})[_0xa40c('0x22')](respondWithResult(_0x268944,null))[_0xa40c('0x2c')](handleError(_0x268944,null));};exports[_0xa40c('0x5e')]=function(_0x16640d,_0x3a48a6,_0x3b0a5b){var _0x49c8de={};var _0x4e9147={};var _0x332eda;var _0x35837e;return db[_0xa40c('0x3c')][_0xa40c('0x5f')]({'where':{'id':_0x16640d[_0xa40c('0x53')]['id']}})[_0xa40c('0x22')](handleEntityNotFound(_0x3a48a6,null))['then'](function(_0x1fd26d){if(_0x1fd26d){_0x332eda=_0x1fd26d;_0x4e9147['model']=_[_0xa40c('0x5b')](db['Dynamics365Field'][_0xa40c('0x3d')]);_0x4e9147[_0xa40c('0x42')]=_['keys'](_0x16640d[_0xa40c('0x42')]);_0x4e9147[_0xa40c('0x4a')]=_['intersection'](_0x4e9147[_0xa40c('0x41')],_0x4e9147[_0xa40c('0x42')]);_0x49c8de[_0xa40c('0x43')]=_[_0xa40c('0x44')](_0x4e9147['model'],qs['fields'](_0x16640d['query'][_0xa40c('0x45')]));_0x49c8de[_0xa40c('0x43')]=_0x49c8de[_0xa40c('0x43')][_0xa40c('0x54')]?_0x49c8de[_0xa40c('0x43')]:_0x4e9147[_0xa40c('0x41')];_0x49c8de[_0xa40c('0x48')]=qs['sort'](_0x16640d[_0xa40c('0x42')][_0xa40c('0x49')]);_0x49c8de[_0xa40c('0x4d')]=qs[_0xa40c('0x4a')](_[_0xa40c('0x4b')](_0x16640d[_0xa40c('0x42')],_0x4e9147[_0xa40c('0x4a')]));if(_0x16640d[_0xa40c('0x42')][_0xa40c('0x4c')]){_0x49c8de[_0xa40c('0x4d')]=_[_0xa40c('0x4e')](_0x49c8de[_0xa40c('0x4d')],{'$or':_['map'](_0x49c8de['attributes'],function(_0x511da0){var _0x234c34={};_0x234c34[_0x511da0]={'$like':'%'+_0x16640d[_0xa40c('0x42')][_0xa40c('0x4c')]+'%'};return _0x234c34;})});}_0x49c8de=_[_0xa40c('0x4e')]({},_0x49c8de,_0x16640d[_0xa40c('0x50')]);return _0x332eda[_0xa40c('0x5e')](_0x49c8de);}})[_0xa40c('0x22')](function(_0x4876ee){if(_0x4876ee){_0x35837e=_0x4876ee[_0xa40c('0x54')];if(!_0x16640d['query'][_0xa40c('0x46')](_0xa40c('0x47'))){_0x49c8de[_0xa40c('0x32')]=qs[_0xa40c('0x32')](_0x16640d[_0xa40c('0x42')][_0xa40c('0x32')]);_0x49c8de[_0xa40c('0x31')]=qs[_0xa40c('0x31')](_0x16640d[_0xa40c('0x42')][_0xa40c('0x31')]);}return _0x332eda['getDescriptions'](_0x49c8de);}})[_0xa40c('0x22')](function(_0x55ee2f){if(_0x55ee2f){return _0x55ee2f?{'count':_0x35837e,'rows':_0x55ee2f}:null;}})[_0xa40c('0x22')](respondWithResult(_0x3a48a6,null))[_0xa40c('0x2c')](handleError(_0x3a48a6,null));}; \ No newline at end of file +var _0xe6c6=['ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','findAll','then','rows','catch','show','params','includeAll','include','create','update','body','find','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xe6c6,0x104));var _0x6e6c=function(_0xcc14d4,_0x1f7db0){_0xcc14d4=_0xcc14d4-0x0;var _0xfc94d6=_0xe6c6[_0xcc14d4];return _0xfc94d6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6e6c('0x0'));var rimraf=require(_0x6e6c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e6c('0x2'));var rp=require(_0x6e6c('0x3'));var moment=require('moment');var BPromise=require(_0x6e6c('0x4'));var Mustache=require('mustache');var util=require(_0x6e6c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6e6c('0x6'));var ejs=require(_0x6e6c('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6e6c('0x8'));var crypto=require(_0x6e6c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6e6c('0xa'));var toCsv=require(_0x6e6c('0x6'));var querystring=require(_0x6e6c('0xb'));var Papa=require(_0x6e6c('0xc'));var Redis=require('ioredis');var authService=require(_0x6e6c('0xd'));var qs=require(_0x6e6c('0xe'));var as=require(_0x6e6c('0xf'));var hardwareService=require(_0x6e6c('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x6e6c('0x11'));var config=require(_0x6e6c('0x12'));var db=require(_0x6e6c('0x13'))['db'];var jayson=require(_0x6e6c('0x14'));var client=jayson[_0x6e6c('0x15')][_0x6e6c('0x16')]({'port':0x232a});function checkPasswordPattern(_0x174fc6,_0x4b8c7c,_0x595da2){if(_0x595da2){var _0x2bc5b8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2bc5b8[_0x6e6c('0x17')](_0x4b8c7c)){return _0x174fc6;}else{throw new db['Sequelize'][(_0x6e6c('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x174fc6;}}function respondWithRpcPromise(_0x33bb59,_0x2cc834,_0x2e8393,_0x1fad7b){return new BPromise(function(_0x33a4fd,_0x510027){var _0x42b625=_0x1fad7b||client;return _0x42b625[_0x6e6c('0x19')](_0x33bb59,_0x2e8393)['then'](function(_0x28ee02){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2cc834,'request\x20sent');logger['debug'](_0x6e6c('0x1a'),_0x2cc834,'request\x20sent',JSON[_0x6e6c('0x1b')](_0x28ee02));if(_0x28ee02[_0x6e6c('0x1c')]){if(_0x28ee02[_0x6e6c('0x1c')][_0x6e6c('0x1d')]===0x1f4){logger[_0x6e6c('0x1c')](_0x6e6c('0x1e'),_0x2cc834,_0x28ee02[_0x6e6c('0x1c')][_0x6e6c('0x1f')]);return _0x510027(_0x28ee02['error'][_0x6e6c('0x1f')]);}logger[_0x6e6c('0x1c')](_0x6e6c('0x1e'),_0x2cc834,_0x28ee02[_0x6e6c('0x1c')][_0x6e6c('0x1f')]);return _0x33a4fd(_0x28ee02[_0x6e6c('0x1c')]['message']);}else{logger[_0x6e6c('0x20')](_0x6e6c('0x1e'),_0x2cc834,'request\x20sent');_0x33a4fd(_0x28ee02[_0x6e6c('0x21')][_0x6e6c('0x1f')]);}})['catch'](function(_0x2e0c37){logger[_0x6e6c('0x1c')](_0x6e6c('0x1e'),_0x2cc834,_0x2e0c37);_0x510027(_0x2e0c37);});});}function respondWithStatusCode(_0x4320bb,_0x8fe2dd){_0x8fe2dd=_0x8fe2dd||0xcc;return function(_0x224dc8){if(_0x224dc8){return _0x4320bb[_0x6e6c('0x22')](_0x8fe2dd);}return _0x4320bb[_0x6e6c('0x23')](_0x8fe2dd)[_0x6e6c('0x24')]();};}function respondWithResult(_0x19c027,_0x30ec0e){_0x30ec0e=_0x30ec0e||0xc8;return function(_0x46589c){if(_0x46589c){return _0x19c027[_0x6e6c('0x23')](_0x30ec0e)['json'](_0x46589c);}};}function respondWithFilteredResult(_0x4868a3,_0x45a8f9){return function(_0x177eea){if(_0x177eea){var _0x588b0e=_0x177eea[_0x6e6c('0x25')],_0x39b48a=_0x45a8f9[_0x6e6c('0x26')],_0xd9b73a=_0x45a8f9[_0x6e6c('0x26')]+_0x45a8f9[_0x6e6c('0x27')],_0x130a32;if(_0xd9b73a>=_0x588b0e){_0xd9b73a=_0x588b0e;_0x130a32=0xc8;}else{_0x130a32=0xce;}_0x4868a3[_0x6e6c('0x23')](_0x130a32);return _0x4868a3[_0x6e6c('0x28')](_0x6e6c('0x29'),_0x39b48a+'-'+_0xd9b73a+'/'+_0x588b0e)[_0x6e6c('0x2a')](_0x177eea);}return null;};}function patchUpdates(_0x32f247){return function(_0x5770dc){try{jsonpatch[_0x6e6c('0x2b')](_0x5770dc,_0x32f247,!![]);}catch(_0x118f23){return BPromise[_0x6e6c('0x2c')](_0x118f23);}return _0x5770dc['save']();};}function saveUpdates(_0x2e3884,_0x2cc1a8){return function(_0x317dbb){if(_0x317dbb){return _0x317dbb['update'](_0x2e3884)['then'](function(_0x2e55d8){return _0x2e55d8;});}return null;};}function removeEntity(_0x3e61e4,_0x51e2b2){return function(_0x2af94a){if(_0x2af94a){return _0x2af94a['destroy']()['then'](function(){_0x3e61e4[_0x6e6c('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdf9a31,_0x5bf5b3){return function(_0x2b944a){if(!_0x2b944a){_0xdf9a31[_0x6e6c('0x22')](0x194);}return _0x2b944a;};}function handleError(_0x5e12da,_0x1b5820){_0x1b5820=_0x1b5820||0x1f4;return function(_0x3c4836){logger[_0x6e6c('0x1c')](_0x3c4836[_0x6e6c('0x2d')]);if(_0x3c4836[_0x6e6c('0x2e')]){delete _0x3c4836[_0x6e6c('0x2e')];}_0x5e12da['status'](_0x1b5820)[_0x6e6c('0x2f')](_0x3c4836);};}exports[_0x6e6c('0x30')]=function(_0x38413e,_0x4c4604){var _0x4c2047={},_0xac2ef6={},_0x291cc0={'count':0x0,'rows':[]};var _0x287b50=_[_0x6e6c('0x31')](db['Dynamics365Configuration'][_0x6e6c('0x32')],function(_0x1b401e){return{'name':_0x1b401e[_0x6e6c('0x33')],'type':_0x1b401e[_0x6e6c('0x34')]['key']};});_0xac2ef6[_0x6e6c('0x35')]=_[_0x6e6c('0x31')](_0x287b50,_0x6e6c('0x2e'));_0xac2ef6[_0x6e6c('0x36')]=_[_0x6e6c('0x37')](_0x38413e[_0x6e6c('0x36')]);_0xac2ef6[_0x6e6c('0x38')]=_[_0x6e6c('0x39')](_0xac2ef6[_0x6e6c('0x35')],_0xac2ef6[_0x6e6c('0x36')]);_0x4c2047[_0x6e6c('0x3a')]=_[_0x6e6c('0x39')](_0xac2ef6[_0x6e6c('0x35')],qs[_0x6e6c('0x3b')](_0x38413e[_0x6e6c('0x36')]['fields']));_0x4c2047[_0x6e6c('0x3a')]=_0x4c2047[_0x6e6c('0x3a')][_0x6e6c('0x3c')]?_0x4c2047['attributes']:_0xac2ef6['model'];if(!_0x38413e[_0x6e6c('0x36')][_0x6e6c('0x3d')](_0x6e6c('0x3e'))){_0x4c2047[_0x6e6c('0x27')]=qs['limit'](_0x38413e[_0x6e6c('0x36')][_0x6e6c('0x27')]);_0x4c2047[_0x6e6c('0x26')]=qs[_0x6e6c('0x26')](_0x38413e['query'][_0x6e6c('0x26')]);}_0x4c2047['order']=qs[_0x6e6c('0x3f')](_0x38413e[_0x6e6c('0x36')][_0x6e6c('0x3f')]);_0x4c2047[_0x6e6c('0x40')]=qs[_0x6e6c('0x38')](_[_0x6e6c('0x41')](_0x38413e[_0x6e6c('0x36')],_0xac2ef6['filters']),_0x287b50);if(_0x38413e[_0x6e6c('0x36')][_0x6e6c('0x42')]){_0x4c2047['where']=_[_0x6e6c('0x43')](_0x4c2047['where'],{'$or':_[_0x6e6c('0x31')](_0x287b50,function(_0x4a3df1){if(_0x4a3df1[_0x6e6c('0x34')]!==_0x6e6c('0x44')){var _0x4eff28={};_0x4eff28[_0x4a3df1[_0x6e6c('0x2e')]]={'$like':'%'+_0x38413e[_0x6e6c('0x36')][_0x6e6c('0x42')]+'%'};return _0x4eff28;}})});}_0x4c2047=_[_0x6e6c('0x43')]({},_0x4c2047,_0x38413e[_0x6e6c('0x45')]);var _0x36905c={'where':_0x4c2047['where']};return db[_0x6e6c('0x46')]['count'](_0x36905c)['then'](function(_0x349aa0){_0x291cc0[_0x6e6c('0x25')]=_0x349aa0;if(_0x38413e[_0x6e6c('0x36')]['includeAll']){_0x4c2047['include']=[{'all':!![]}];}return db[_0x6e6c('0x46')][_0x6e6c('0x47')](_0x4c2047);})[_0x6e6c('0x48')](function(_0x50a094){_0x291cc0[_0x6e6c('0x49')]=_0x50a094;return _0x291cc0;})['then'](respondWithFilteredResult(_0x4c4604,_0x4c2047))[_0x6e6c('0x4a')](handleError(_0x4c4604,null));};exports[_0x6e6c('0x4b')]=function(_0x46f95a,_0xb9d2c0){var _0x44be3a={'raw':![],'where':{'id':_0x46f95a[_0x6e6c('0x4c')]['id']}},_0xfb7b56={};_0xfb7b56[_0x6e6c('0x35')]=_[_0x6e6c('0x37')](db[_0x6e6c('0x46')][_0x6e6c('0x32')]);_0xfb7b56[_0x6e6c('0x36')]=_[_0x6e6c('0x37')](_0x46f95a[_0x6e6c('0x36')]);_0xfb7b56[_0x6e6c('0x38')]=_['intersection'](_0xfb7b56[_0x6e6c('0x35')],_0xfb7b56[_0x6e6c('0x36')]);_0x44be3a[_0x6e6c('0x3a')]=_[_0x6e6c('0x39')](_0xfb7b56['model'],qs['fields'](_0x46f95a[_0x6e6c('0x36')][_0x6e6c('0x3b')]));_0x44be3a['attributes']=_0x44be3a['attributes'][_0x6e6c('0x3c')]?_0x44be3a[_0x6e6c('0x3a')]:_0xfb7b56['model'];if(_0x46f95a['query'][_0x6e6c('0x4d')]){_0x44be3a[_0x6e6c('0x4e')]=[{'all':!![]}];}_0x44be3a=_[_0x6e6c('0x43')]({},_0x44be3a,_0x46f95a[_0x6e6c('0x45')]);return db[_0x6e6c('0x46')]['find'](_0x44be3a)[_0x6e6c('0x48')](handleEntityNotFound(_0xb9d2c0,null))[_0x6e6c('0x48')](respondWithResult(_0xb9d2c0,null))[_0x6e6c('0x4a')](handleError(_0xb9d2c0,null));};exports['create']=function(_0xd6f2ed,_0x554d1c){return db[_0x6e6c('0x46')][_0x6e6c('0x4f')](_0xd6f2ed['body'],{})[_0x6e6c('0x48')](respondWithResult(_0x554d1c,0xc9))['catch'](handleError(_0x554d1c,null));};exports[_0x6e6c('0x50')]=function(_0x21dc26,_0x387943){if(_0x21dc26['body']['id']){delete _0x21dc26[_0x6e6c('0x51')]['id'];}return db[_0x6e6c('0x46')][_0x6e6c('0x52')]({'where':{'id':_0x21dc26[_0x6e6c('0x4c')]['id']}})[_0x6e6c('0x48')](handleEntityNotFound(_0x387943,null))[_0x6e6c('0x48')](saveUpdates(_0x21dc26[_0x6e6c('0x51')],null))[_0x6e6c('0x48')](respondWithResult(_0x387943,null))[_0x6e6c('0x4a')](handleError(_0x387943,null));};exports['destroy']=function(_0xa5d19,_0x17741d){return db[_0x6e6c('0x46')][_0x6e6c('0x52')]({'where':{'id':_0xa5d19[_0x6e6c('0x4c')]['id']}})[_0x6e6c('0x48')](handleEntityNotFound(_0x17741d,null))['then'](removeEntity(_0x17741d,null))[_0x6e6c('0x4a')](handleError(_0x17741d,null));};exports[_0x6e6c('0x53')]=function(_0x30fe6d,_0x38f39c,_0x3d4032){var _0x43608d={};var _0x49b12e={};var _0x22d0de;var _0x28cecf;return db[_0x6e6c('0x46')][_0x6e6c('0x54')]({'where':{'id':_0x30fe6d[_0x6e6c('0x4c')]['id']}})[_0x6e6c('0x48')](handleEntityNotFound(_0x38f39c,null))[_0x6e6c('0x48')](function(_0xaf1093){if(_0xaf1093){_0x22d0de=_0xaf1093;_0x49b12e[_0x6e6c('0x35')]=_[_0x6e6c('0x37')](db[_0x6e6c('0x55')][_0x6e6c('0x32')]);_0x49b12e[_0x6e6c('0x36')]=_[_0x6e6c('0x37')](_0x30fe6d[_0x6e6c('0x36')]);_0x49b12e[_0x6e6c('0x38')]=_['intersection'](_0x49b12e[_0x6e6c('0x35')],_0x49b12e['query']);_0x43608d[_0x6e6c('0x3a')]=_[_0x6e6c('0x39')](_0x49b12e[_0x6e6c('0x35')],qs[_0x6e6c('0x3b')](_0x30fe6d[_0x6e6c('0x36')]['fields']));_0x43608d[_0x6e6c('0x3a')]=_0x43608d[_0x6e6c('0x3a')][_0x6e6c('0x3c')]?_0x43608d['attributes']:_0x49b12e[_0x6e6c('0x35')];_0x43608d[_0x6e6c('0x56')]=qs[_0x6e6c('0x3f')](_0x30fe6d[_0x6e6c('0x36')]['sort']);_0x43608d[_0x6e6c('0x40')]=qs[_0x6e6c('0x38')](_[_0x6e6c('0x41')](_0x30fe6d['query'],_0x49b12e[_0x6e6c('0x38')]));if(_0x30fe6d[_0x6e6c('0x36')][_0x6e6c('0x42')]){_0x43608d[_0x6e6c('0x40')]=_[_0x6e6c('0x43')](_0x43608d[_0x6e6c('0x40')],{'$or':_[_0x6e6c('0x31')](_0x43608d['attributes'],function(_0x242f49){var _0x285eeb={};_0x285eeb[_0x242f49]={'$like':'%'+_0x30fe6d[_0x6e6c('0x36')][_0x6e6c('0x42')]+'%'};return _0x285eeb;})});}_0x43608d=_['merge']({},_0x43608d,_0x30fe6d[_0x6e6c('0x45')]);return _0x22d0de[_0x6e6c('0x53')](_0x43608d);}})[_0x6e6c('0x48')](function(_0x892686){if(_0x892686){_0x28cecf=_0x892686[_0x6e6c('0x3c')];if(!_0x30fe6d['query']['hasOwnProperty'](_0x6e6c('0x3e'))){_0x43608d['limit']=qs[_0x6e6c('0x27')](_0x30fe6d[_0x6e6c('0x36')][_0x6e6c('0x27')]);_0x43608d[_0x6e6c('0x26')]=qs[_0x6e6c('0x26')](_0x30fe6d['query'][_0x6e6c('0x26')]);}return _0x22d0de[_0x6e6c('0x53')](_0x43608d);}})[_0x6e6c('0x48')](function(_0x583b8a){if(_0x583b8a){return _0x583b8a?{'count':_0x28cecf,'rows':_0x583b8a}:null;}})[_0x6e6c('0x48')](respondWithResult(_0x38f39c,null))['catch'](handleError(_0x38f39c,null));};exports[_0x6e6c('0x57')]=function(_0x5c02c1,_0x3a1beb,_0x59d49f){var _0x3f73e2={};var _0x26e49d={};var _0x2c029f;var _0x2e4272;return db[_0x6e6c('0x46')][_0x6e6c('0x54')]({'where':{'id':_0x5c02c1[_0x6e6c('0x4c')]['id']}})[_0x6e6c('0x48')](handleEntityNotFound(_0x3a1beb,null))['then'](function(_0x5ddefd){if(_0x5ddefd){_0x2c029f=_0x5ddefd;_0x26e49d['model']=_[_0x6e6c('0x37')](db[_0x6e6c('0x55')]['rawAttributes']);_0x26e49d['query']=_[_0x6e6c('0x37')](_0x5c02c1[_0x6e6c('0x36')]);_0x26e49d[_0x6e6c('0x38')]=_[_0x6e6c('0x39')](_0x26e49d[_0x6e6c('0x35')],_0x26e49d[_0x6e6c('0x36')]);_0x3f73e2[_0x6e6c('0x3a')]=_['intersection'](_0x26e49d['model'],qs[_0x6e6c('0x3b')](_0x5c02c1[_0x6e6c('0x36')][_0x6e6c('0x3b')]));_0x3f73e2['attributes']=_0x3f73e2[_0x6e6c('0x3a')][_0x6e6c('0x3c')]?_0x3f73e2[_0x6e6c('0x3a')]:_0x26e49d[_0x6e6c('0x35')];_0x3f73e2[_0x6e6c('0x56')]=qs[_0x6e6c('0x3f')](_0x5c02c1[_0x6e6c('0x36')][_0x6e6c('0x3f')]);_0x3f73e2['where']=qs[_0x6e6c('0x38')](_[_0x6e6c('0x41')](_0x5c02c1[_0x6e6c('0x36')],_0x26e49d[_0x6e6c('0x38')]));if(_0x5c02c1[_0x6e6c('0x36')][_0x6e6c('0x42')]){_0x3f73e2[_0x6e6c('0x40')]=_['merge'](_0x3f73e2['where'],{'$or':_[_0x6e6c('0x31')](_0x3f73e2[_0x6e6c('0x3a')],function(_0x4a094){var _0x4d592c={};_0x4d592c[_0x4a094]={'$like':'%'+_0x5c02c1['query'][_0x6e6c('0x42')]+'%'};return _0x4d592c;})});}_0x3f73e2=_['merge']({},_0x3f73e2,_0x5c02c1[_0x6e6c('0x45')]);return _0x2c029f[_0x6e6c('0x57')](_0x3f73e2);}})[_0x6e6c('0x48')](function(_0x5f20da){if(_0x5f20da){_0x2e4272=_0x5f20da[_0x6e6c('0x3c')];if(!_0x5c02c1[_0x6e6c('0x36')][_0x6e6c('0x3d')](_0x6e6c('0x3e'))){_0x3f73e2[_0x6e6c('0x27')]=qs[_0x6e6c('0x27')](_0x5c02c1[_0x6e6c('0x36')][_0x6e6c('0x27')]);_0x3f73e2[_0x6e6c('0x26')]=qs[_0x6e6c('0x26')](_0x5c02c1['query'][_0x6e6c('0x26')]);}return _0x2c029f[_0x6e6c('0x57')](_0x3f73e2);}})[_0x6e6c('0x48')](function(_0x2391a8){if(_0x2391a8){return _0x2391a8?{'count':_0x2e4272,'rows':_0x2391a8}:null;}})[_0x6e6c('0x48')](respondWithResult(_0x3a1beb,null))['catch'](handleError(_0x3a1beb,null));};exports['getDescriptions']=function(_0x5d352a,_0xa5f375,_0x4be3fe){var _0x2ed113={};var _0x4762ee={};var _0x247be0;var _0x9f56de;return db[_0x6e6c('0x46')]['findOne']({'where':{'id':_0x5d352a[_0x6e6c('0x4c')]['id']}})['then'](handleEntityNotFound(_0xa5f375,null))['then'](function(_0xee092e){if(_0xee092e){_0x247be0=_0xee092e;_0x4762ee[_0x6e6c('0x35')]=_[_0x6e6c('0x37')](db['Dynamics365Field'][_0x6e6c('0x32')]);_0x4762ee['query']=_[_0x6e6c('0x37')](_0x5d352a[_0x6e6c('0x36')]);_0x4762ee['filters']=_[_0x6e6c('0x39')](_0x4762ee[_0x6e6c('0x35')],_0x4762ee['query']);_0x2ed113[_0x6e6c('0x3a')]=_[_0x6e6c('0x39')](_0x4762ee['model'],qs['fields'](_0x5d352a[_0x6e6c('0x36')][_0x6e6c('0x3b')]));_0x2ed113[_0x6e6c('0x3a')]=_0x2ed113[_0x6e6c('0x3a')][_0x6e6c('0x3c')]?_0x2ed113[_0x6e6c('0x3a')]:_0x4762ee['model'];_0x2ed113['order']=qs[_0x6e6c('0x3f')](_0x5d352a[_0x6e6c('0x36')][_0x6e6c('0x3f')]);_0x2ed113[_0x6e6c('0x40')]=qs[_0x6e6c('0x38')](_[_0x6e6c('0x41')](_0x5d352a[_0x6e6c('0x36')],_0x4762ee[_0x6e6c('0x38')]));if(_0x5d352a[_0x6e6c('0x36')]['filter']){_0x2ed113['where']=_[_0x6e6c('0x43')](_0x2ed113[_0x6e6c('0x40')],{'$or':_['map'](_0x2ed113[_0x6e6c('0x3a')],function(_0x1d7363){var _0x1b2174={};_0x1b2174[_0x1d7363]={'$like':'%'+_0x5d352a['query'][_0x6e6c('0x42')]+'%'};return _0x1b2174;})});}_0x2ed113=_[_0x6e6c('0x43')]({},_0x2ed113,_0x5d352a[_0x6e6c('0x45')]);return _0x247be0['getDescriptions'](_0x2ed113);}})['then'](function(_0x1380a7){if(_0x1380a7){_0x9f56de=_0x1380a7[_0x6e6c('0x3c')];if(!_0x5d352a[_0x6e6c('0x36')]['hasOwnProperty'](_0x6e6c('0x3e'))){_0x2ed113[_0x6e6c('0x27')]=qs[_0x6e6c('0x27')](_0x5d352a[_0x6e6c('0x36')]['limit']);_0x2ed113[_0x6e6c('0x26')]=qs['offset'](_0x5d352a[_0x6e6c('0x36')][_0x6e6c('0x26')]);}return _0x247be0[_0x6e6c('0x58')](_0x2ed113);}})['then'](function(_0x3446e5){if(_0x3446e5){return _0x3446e5?{'count':_0x9f56de,'rows':_0x3446e5}:null;}})[_0x6e6c('0x48')](respondWithResult(_0xa5f375,null))['catch'](handleError(_0xa5f375,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5b81dcb..c5906d8 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 _0xf71d=['moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api'];(function(_0xa5da3f,_0x5b2b0a){var _0x3b4916=function(_0x86ba90){while(--_0x86ba90){_0xa5da3f['push'](_0xa5da3f['shift']());}};_0x3b4916(++_0x5b2b0a);}(_0xf71d,0xda));var _0xdf71=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xf71d[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0xdf71('0x0'));var util=require('util');var logger=require(_0xdf71('0x1'))(_0xdf71('0x2'));var moment=require(_0xdf71('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf71('0x4'));var fs=require('fs');var path=require(_0xdf71('0x5'));var rimraf=require(_0xdf71('0x6'));var config=require(_0xdf71('0x7'));var attributes=require(_0xdf71('0x8'));module[_0xdf71('0x9')]=function(_0x707335,_0x40fadf){return _0x707335[_0xdf71('0xa')](_0xdf71('0xb'),attributes,{'tableName':_0xdf71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb619=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0xb619,0x12a));var _0x9b61=function(_0x53734e,_0x17f2a7){_0x53734e=_0x53734e-0x0;var _0x1042cb=_0xb619[_0x53734e];return _0x1042cb;};'use strict';var _=require(_0x9b61('0x0'));var util=require(_0x9b61('0x1'));var logger=require(_0x9b61('0x2'))(_0x9b61('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9b61('0x4'));var fs=require('fs');var path=require(_0x9b61('0x5'));var rimraf=require(_0x9b61('0x6'));var config=require(_0x9b61('0x7'));var attributes=require(_0x9b61('0x8'));module['exports']=function(_0x2efc64,_0x4c2553){return _0x2efc64[_0x9b61('0x9')](_0x9b61('0xa'),attributes,{'tableName':_0x9b61('0xb'),'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 5110b89..ea70c76 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 _0x41a8=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch'];(function(_0x221f37,_0x17904c){var _0x237985=function(_0x28f064){while(--_0x28f064){_0x221f37['push'](_0x221f37['shift']());}};_0x237985(++_0x17904c);}(_0x41a8,0xe7));var _0x841a=function(_0x251c39,_0x39bc13){_0x251c39=_0x251c39-0x0;var _0x261318=_0x41a8[_0x251c39];return _0x261318;};'use strict';var _=require(_0x841a('0x0'));var util=require(_0x841a('0x1'));var moment=require(_0x841a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x841a('0x3'));var db=require(_0x841a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x841a('0x5'))('rpc');var config=require(_0x841a('0x6'));var jayson=require(_0x841a('0x7'));var client=jayson[_0x841a('0x8')][_0x841a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5bd4ff,_0x223549,_0x1beee5){return new BPromise(function(_0x3e46bc,_0xb90142){return client[_0x841a('0xa')](_0x5bd4ff,_0x1beee5)[_0x841a('0xb')](function(_0x27fb9f){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x223549,'request\x20sent');logger[_0x841a('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x223549,_0x841a('0xd'),JSON[_0x841a('0xe')](_0x27fb9f));if(_0x27fb9f[_0x841a('0xf')]){if(_0x27fb9f['error'][_0x841a('0x10')]===0x1f4){logger['error'](_0x841a('0x11'),_0x223549,_0x27fb9f[_0x841a('0xf')][_0x841a('0x12')]);return _0xb90142(_0x27fb9f[_0x841a('0xf')][_0x841a('0x12')]);}logger['error'](_0x841a('0x11'),_0x223549,_0x27fb9f[_0x841a('0xf')]['message']);return _0x3e46bc(_0x27fb9f[_0x841a('0xf')][_0x841a('0x12')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x223549,_0x841a('0xd'));_0x3e46bc(_0x27fb9f[_0x841a('0x13')][_0x841a('0x12')]);}})[_0x841a('0x14')](function(_0x59e432){logger[_0x841a('0xf')](_0x841a('0x11'),_0x223549,_0x59e432);_0xb90142(_0x59e432);});});} \ No newline at end of file +var _0x1edd=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1b2625,_0xfe3be3){var _0x20d892=function(_0x208a6d){while(--_0x208a6d){_0x1b2625['push'](_0x1b2625['shift']());}};_0x20d892(++_0xfe3be3);}(_0x1edd,0x1c5));var _0xd1ed=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x1edd[_0x5d72da];return _0x43ebe7;};'use strict';var _=require(_0xd1ed('0x0'));var util=require(_0xd1ed('0x1'));var moment=require(_0xd1ed('0x2'));var BPromise=require(_0xd1ed('0x3'));var rs=require(_0xd1ed('0x4'));var fs=require('fs');var Redis=require(_0xd1ed('0x5'));var db=require(_0xd1ed('0x6'))['db'];var utils=require(_0xd1ed('0x7'));var logger=require(_0xd1ed('0x8'))(_0xd1ed('0x9'));var config=require(_0xd1ed('0xa'));var jayson=require(_0xd1ed('0xb'));var client=jayson[_0xd1ed('0xc')][_0xd1ed('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x59399c,_0x51ed46,_0x501902){return new BPromise(function(_0x2b2eb3,_0x3dabb5){return client['request'](_0x59399c,_0x501902)['then'](function(_0x290939){logger[_0xd1ed('0xe')](_0xd1ed('0xf'),_0x51ed46,'request\x20sent');logger[_0xd1ed('0x10')](_0xd1ed('0x11'),_0x51ed46,_0xd1ed('0x12'),JSON['stringify'](_0x290939));if(_0x290939[_0xd1ed('0x13')]){if(_0x290939[_0xd1ed('0x13')][_0xd1ed('0x14')]===0x1f4){logger[_0xd1ed('0x13')](_0xd1ed('0xf'),_0x51ed46,_0x290939['error'][_0xd1ed('0x15')]);return _0x3dabb5(_0x290939[_0xd1ed('0x13')][_0xd1ed('0x15')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x51ed46,_0x290939[_0xd1ed('0x13')][_0xd1ed('0x15')]);return _0x2b2eb3(_0x290939[_0xd1ed('0x13')][_0xd1ed('0x15')]);}else{logger[_0xd1ed('0xe')](_0xd1ed('0xf'),_0x51ed46,_0xd1ed('0x12'));_0x2b2eb3(_0x290939[_0xd1ed('0x16')][_0xd1ed('0x15')]);}})['catch'](function(_0xd1e9c8){logger['error'](_0xd1ed('0xf'),_0x51ed46,_0xd1e9c8);_0x3dabb5(_0xd1e9c8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 21f2cb7..d4bc935 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 _0x55ea=['update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x4a883f,_0x159e6a){var _0x3886ff=function(_0x4c166a){while(--_0x4c166a){_0x4a883f['push'](_0x4a883f['shift']());}};_0x3886ff(++_0x159e6a);}(_0x55ea,0xc9));var _0xa55e=function(_0x6f86f9,_0x37028e){_0x6f86f9=_0x6f86f9-0x0;var _0x2d1cae=_0x55ea[_0x6f86f9];return _0x2d1cae;};'use strict';var multer=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var path=require(_0xa55e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa55e('0x3'));var router=express[_0xa55e('0x4')]();var auth=require(_0xa55e('0x5'));var interaction=require(_0xa55e('0x6'));var config=require(_0xa55e('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xa55e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xa55e('0x9')](),controller[_0xa55e('0xa')]);router[_0xa55e('0xb')]('/',auth[_0xa55e('0x9')](),controller[_0xa55e('0xc')]);router[_0xa55e('0xd')](_0xa55e('0xe'),auth[_0xa55e('0x9')](),controller[_0xa55e('0xf')]);router['delete']('/:id',auth[_0xa55e('0x9')](),controller[_0xa55e('0x10')]);module[_0xa55e('0x11')]=router; \ No newline at end of file +var _0xf3cd=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','delete','destroy','exports','multer'];(function(_0x1774cf,_0x1a466b){var _0x10011=function(_0x145452){while(--_0x145452){_0x1774cf['push'](_0x1774cf['shift']());}};_0x10011(++_0x1a466b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x362d6a,_0x253e0d){_0x362d6a=_0x362d6a-0x0;var _0x2af49e=_0xf3cd[_0x362d6a];return _0x2af49e;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['post']('/',auth[_0xdf3c('0x9')](),controller['create']);router['put'](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller['update']);router[_0xdf3c('0xe')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xf')]);module[_0xdf3c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index fc937ec..d28b9bb 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 _0x2b84=['variable','customVariable','STRING','sequelize','ENUM','string'];(function(_0x18fd21,_0x4af3d1){var _0x113f67=function(_0x45b480){while(--_0x45b480){_0x18fd21['push'](_0x18fd21['shift']());}};_0x113f67(++_0x4af3d1);}(_0x2b84,0x105));var _0x42b8=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x2b84[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x42b8('0x0'));module['exports']={'type':{'type':Sequelize[_0x42b8('0x1')](_0x42b8('0x2'),_0x42b8('0x3'),_0x42b8('0x4'),'keyValue'),'defaultValue':_0x42b8('0x2')},'content':{'type':Sequelize[_0x42b8('0x5')]},'key':{'type':Sequelize[_0x42b8('0x5')]},'keyType':{'type':Sequelize[_0x42b8('0x1')](_0x42b8('0x2'),_0x42b8('0x3'),_0x42b8('0x4'))},'keyContent':{'type':Sequelize[_0x42b8('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x42b8('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x42b8('0x5')]}}; \ No newline at end of file +var _0xfcbf=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x24082d,_0x2081c2){var _0x42317d=function(_0x14d406){while(--_0x14d406){_0x24082d['push'](_0x24082d['shift']());}};_0x42317d(++_0x2081c2);}(_0xfcbf,0x1d1));var _0xffcb=function(_0x4998a6,_0x2d533e){_0x4998a6=_0x4998a6-0x0;var _0x24e2e4=_0xfcbf[_0x4998a6];return _0x24e2e4;};'use strict';var Sequelize=require(_0xffcb('0x0'));module[_0xffcb('0x1')]={'type':{'type':Sequelize[_0xffcb('0x2')](_0xffcb('0x3'),_0xffcb('0x4'),_0xffcb('0x5'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xffcb('0x6')]},'key':{'type':Sequelize[_0xffcb('0x6')]},'keyType':{'type':Sequelize[_0xffcb('0x2')](_0xffcb('0x3'),_0xffcb('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xffcb('0x6')]},'idField':{'type':Sequelize[_0xffcb('0x6')]},'nameField':{'type':Sequelize[_0xffcb('0x6')]},'customField':{'type':Sequelize[_0xffcb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xffcb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 560bb44..46f9bbe 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 _0x33a1=['html-pdf','eml-format','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','count','offset','limit','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','Dynamics365Field','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','params','find','create','body'];(function(_0x57a6ce,_0x3d7316){var _0x38de7e=function(_0x18499b){while(--_0x18499b){_0x57a6ce['push'](_0x57a6ce['shift']());}};_0x38de7e(++_0x3d7316);}(_0x33a1,0x7c));var _0x133a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x33a1[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x133a('0x0'));var emlformat=require(_0x133a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x133a('0x2'));var BPromise=require(_0x133a('0x3'));var Mustache=require(_0x133a('0x4'));var util=require('util');var path=require(_0x133a('0x5'));var sox=require(_0x133a('0x6'));var csv=require(_0x133a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x133a('0x8'));var squel=require(_0x133a('0x9'));var crypto=require(_0x133a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x133a('0xb'));var toCsv=require(_0x133a('0x7'));var querystring=require(_0x133a('0xc'));var Papa=require(_0x133a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x133a('0xe'));var hardwareService=require(_0x133a('0xf'));var logger=require(_0x133a('0x10'))(_0x133a('0x11'));var utils=require(_0x133a('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3445b8,_0x5acdb0){_0x5acdb0=_0x5acdb0||0xcc;return function(_0x56ccca){if(_0x56ccca){return _0x3445b8[_0x133a('0x13')](_0x5acdb0);}return _0x3445b8[_0x133a('0x14')](_0x5acdb0)['end']();};}function respondWithResult(_0x6e17,_0x13f390){_0x13f390=_0x13f390||0xc8;return function(_0x3ed1b1){if(_0x3ed1b1){return _0x6e17['status'](_0x13f390)['json'](_0x3ed1b1);}};}function respondWithFilteredResult(_0xf90f84,_0x116448){return function(_0x587863){if(_0x587863){var _0x1221bc=_0x587863[_0x133a('0x15')],_0x49066a=_0x116448['offset'],_0x4c95ea=_0x116448[_0x133a('0x16')]+_0x116448[_0x133a('0x17')],_0x505389;if(_0x4c95ea>=_0x1221bc){_0x4c95ea=_0x1221bc;_0x505389=0xc8;}else{_0x505389=0xce;}_0xf90f84['status'](_0x505389);return _0xf90f84[_0x133a('0x18')](_0x133a('0x19'),_0x49066a+'-'+_0x4c95ea+'/'+_0x1221bc)['json'](_0x587863);}return null;};}function patchUpdates(_0x4843c0){return function(_0x67b4d5){try{jsonpatch['apply'](_0x67b4d5,_0x4843c0,!![]);}catch(_0x3084b5){return BPromise[_0x133a('0x1a')](_0x3084b5);}return _0x67b4d5[_0x133a('0x1b')]();};}function saveUpdates(_0x30d49d,_0x86ba96){return function(_0x5dcdd0){if(_0x5dcdd0){return _0x5dcdd0['update'](_0x30d49d)[_0x133a('0x1c')](function(_0x3a4cba){return _0x3a4cba;});}return null;};}function removeEntity(_0x9a89b0,_0x1bcf30){return function(_0x122405){if(_0x122405){return _0x122405[_0x133a('0x1d')]()['then'](function(){_0x9a89b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a137c,_0xa50e62){return function(_0x63f401){if(!_0x63f401){_0x4a137c[_0x133a('0x13')](0x194);}return _0x63f401;};}function handleError(_0x49097d,_0x33c486){_0x33c486=_0x33c486||0x1f4;return function(_0x181ab3){logger['error'](_0x181ab3[_0x133a('0x1e')]);if(_0x181ab3[_0x133a('0x1f')]){delete _0x181ab3['name'];}_0x49097d[_0x133a('0x14')](_0x33c486)[_0x133a('0x20')](_0x181ab3);};}exports[_0x133a('0x21')]=function(_0x3d4ef7,_0x2040fe){var _0xca55d3={},_0x16369f={},_0x24919d={'count':0x0,'rows':[]};var _0x1f2607=_[_0x133a('0x22')](db[_0x133a('0x23')]['rawAttributes'],function(_0x294885){return{'name':_0x294885['fieldName'],'type':_0x294885[_0x133a('0x24')]['key']};});_0x16369f[_0x133a('0x25')]=_['map'](_0x1f2607,_0x133a('0x1f'));_0x16369f[_0x133a('0x26')]=_[_0x133a('0x27')](_0x3d4ef7[_0x133a('0x26')]);_0x16369f[_0x133a('0x28')]=_[_0x133a('0x29')](_0x16369f[_0x133a('0x25')],_0x16369f[_0x133a('0x26')]);_0xca55d3[_0x133a('0x2a')]=_[_0x133a('0x29')](_0x16369f[_0x133a('0x25')],qs[_0x133a('0x2b')](_0x3d4ef7[_0x133a('0x26')][_0x133a('0x2b')]));_0xca55d3[_0x133a('0x2a')]=_0xca55d3[_0x133a('0x2a')][_0x133a('0x2c')]?_0xca55d3[_0x133a('0x2a')]:_0x16369f[_0x133a('0x25')];if(!_0x3d4ef7[_0x133a('0x26')]['hasOwnProperty'](_0x133a('0x2d'))){_0xca55d3[_0x133a('0x17')]=qs[_0x133a('0x17')](_0x3d4ef7[_0x133a('0x26')]['limit']);_0xca55d3[_0x133a('0x16')]=qs[_0x133a('0x16')](_0x3d4ef7[_0x133a('0x26')]['offset']);}_0xca55d3[_0x133a('0x2e')]=qs[_0x133a('0x2f')](_0x3d4ef7[_0x133a('0x26')][_0x133a('0x2f')]);_0xca55d3[_0x133a('0x30')]=qs[_0x133a('0x28')](_[_0x133a('0x31')](_0x3d4ef7[_0x133a('0x26')],_0x16369f[_0x133a('0x28')]),_0x1f2607);if(_0x3d4ef7[_0x133a('0x26')]['filter']){_0xca55d3[_0x133a('0x30')]=_[_0x133a('0x32')](_0xca55d3[_0x133a('0x30')],{'$or':_[_0x133a('0x22')](_0x1f2607,function(_0x2881a0){if(_0x2881a0['type']!==_0x133a('0x33')){var _0x10b2be={};_0x10b2be[_0x2881a0['name']]={'$like':'%'+_0x3d4ef7[_0x133a('0x26')][_0x133a('0x34')]+'%'};return _0x10b2be;}})});}_0xca55d3=_['merge']({},_0xca55d3,_0x3d4ef7[_0x133a('0x35')]);var _0x4301dd={'where':_0xca55d3[_0x133a('0x30')]};return db['Dynamics365Field'][_0x133a('0x15')](_0x4301dd)[_0x133a('0x1c')](function(_0x44ba22){_0x24919d[_0x133a('0x15')]=_0x44ba22;if(_0x3d4ef7['query']['includeAll']){_0xca55d3[_0x133a('0x36')]=[{'all':!![]}];}return db[_0x133a('0x23')][_0x133a('0x37')](_0xca55d3);})['then'](function(_0x14d76a){_0x24919d['rows']=_0x14d76a;return _0x24919d;})['then'](respondWithFilteredResult(_0x2040fe,_0xca55d3))[_0x133a('0x38')](handleError(_0x2040fe,null));};exports[_0x133a('0x39')]=function(_0x41f2d3,_0x358733){var _0x5ec597={'raw':!![],'where':{'id':_0x41f2d3[_0x133a('0x3a')]['id']}},_0x3dd5a5={};_0x3dd5a5[_0x133a('0x25')]=_[_0x133a('0x27')](db['Dynamics365Field']['rawAttributes']);_0x3dd5a5['query']=_[_0x133a('0x27')](_0x41f2d3[_0x133a('0x26')]);_0x3dd5a5[_0x133a('0x28')]=_[_0x133a('0x29')](_0x3dd5a5[_0x133a('0x25')],_0x3dd5a5[_0x133a('0x26')]);_0x5ec597[_0x133a('0x2a')]=_['intersection'](_0x3dd5a5[_0x133a('0x25')],qs[_0x133a('0x2b')](_0x41f2d3[_0x133a('0x26')]['fields']));_0x5ec597['attributes']=_0x5ec597[_0x133a('0x2a')]['length']?_0x5ec597[_0x133a('0x2a')]:_0x3dd5a5[_0x133a('0x25')];if(_0x41f2d3[_0x133a('0x26')]['includeAll']){_0x5ec597['include']=[{'all':!![]}];}_0x5ec597=_[_0x133a('0x32')]({},_0x5ec597,_0x41f2d3[_0x133a('0x35')]);return db['Dynamics365Field'][_0x133a('0x3b')](_0x5ec597)[_0x133a('0x1c')](handleEntityNotFound(_0x358733,null))['then'](respondWithResult(_0x358733,null))['catch'](handleError(_0x358733,null));};exports['create']=function(_0x3751eb,_0x27ebdb){return db[_0x133a('0x23')][_0x133a('0x3c')](_0x3751eb[_0x133a('0x3d')],{})[_0x133a('0x1c')](respondWithResult(_0x27ebdb,0xc9))[_0x133a('0x38')](handleError(_0x27ebdb,null));};exports['update']=function(_0x3d35d3,_0x2c9992){if(_0x3d35d3['body']['id']){delete _0x3d35d3[_0x133a('0x3d')]['id'];}return db[_0x133a('0x23')][_0x133a('0x3b')]({'where':{'id':_0x3d35d3['params']['id']}})['then'](handleEntityNotFound(_0x2c9992,null))[_0x133a('0x1c')](saveUpdates(_0x3d35d3[_0x133a('0x3d')],null))['then'](respondWithResult(_0x2c9992,null))[_0x133a('0x38')](handleError(_0x2c9992,null));};exports[_0x133a('0x1d')]=function(_0x217387,_0x2b1a7d){return db[_0x133a('0x23')][_0x133a('0x3b')]({'where':{'id':_0x217387[_0x133a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2b1a7d,null))[_0x133a('0x1c')](removeEntity(_0x2b1a7d,null))[_0x133a('0x38')](handleError(_0x2b1a7d,null));}; \ No newline at end of file +var _0x4e1d=['params','find','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','options','includeAll','findAll','rows','catch','show'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x4e1d,0xe5));var _0xd4e1=function(_0x49781a,_0x2ed3b7){_0x49781a=_0x49781a-0x0;var _0x48a000=_0x4e1d[_0x49781a];return _0x48a000;};'use strict';var pdf=require(_0xd4e1('0x0'));var emlformat=require(_0xd4e1('0x1'));var rimraf=require(_0xd4e1('0x2'));var zipdir=require(_0xd4e1('0x3'));var jsonpatch=require(_0xd4e1('0x4'));var rp=require(_0xd4e1('0x5'));var moment=require(_0xd4e1('0x6'));var BPromise=require(_0xd4e1('0x7'));var Mustache=require(_0xd4e1('0x8'));var util=require(_0xd4e1('0x9'));var path=require(_0xd4e1('0xa'));var sox=require(_0xd4e1('0xb'));var csv=require('to-csv');var ejs=require(_0xd4e1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd4e1('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4e1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd4e1('0xf'));var querystring=require(_0xd4e1('0x10'));var Papa=require(_0xd4e1('0x11'));var Redis=require(_0xd4e1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd4e1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4e1('0x14'));var logger=require(_0xd4e1('0x15'))(_0xd4e1('0x16'));var utils=require(_0xd4e1('0x17'));var config=require(_0xd4e1('0x18'));var db=require(_0xd4e1('0x19'))['db'];function respondWithStatusCode(_0x3fad69,_0x235438){_0x235438=_0x235438||0xcc;return function(_0x337d48){if(_0x337d48){return _0x3fad69[_0xd4e1('0x1a')](_0x235438);}return _0x3fad69[_0xd4e1('0x1b')](_0x235438)[_0xd4e1('0x1c')]();};}function respondWithResult(_0x1446a8,_0x533db1){_0x533db1=_0x533db1||0xc8;return function(_0x5595e3){if(_0x5595e3){return _0x1446a8['status'](_0x533db1)[_0xd4e1('0x1d')](_0x5595e3);}};}function respondWithFilteredResult(_0x4dee94,_0x3f7a88){return function(_0x99d493){if(_0x99d493){var _0x25498b=_0x99d493[_0xd4e1('0x1e')],_0x854ff3=_0x3f7a88[_0xd4e1('0x1f')],_0x35ea5f=_0x3f7a88[_0xd4e1('0x1f')]+_0x3f7a88[_0xd4e1('0x20')],_0x20508a;if(_0x35ea5f>=_0x25498b){_0x35ea5f=_0x25498b;_0x20508a=0xc8;}else{_0x20508a=0xce;}_0x4dee94['status'](_0x20508a);return _0x4dee94['set'](_0xd4e1('0x21'),_0x854ff3+'-'+_0x35ea5f+'/'+_0x25498b)['json'](_0x99d493);}return null;};}function patchUpdates(_0x182691){return function(_0x1eaa3d){try{jsonpatch[_0xd4e1('0x22')](_0x1eaa3d,_0x182691,!![]);}catch(_0xe7175a){return BPromise[_0xd4e1('0x23')](_0xe7175a);}return _0x1eaa3d[_0xd4e1('0x24')]();};}function saveUpdates(_0x546b94,_0x10cac6){return function(_0x1a231e){if(_0x1a231e){return _0x1a231e['update'](_0x546b94)[_0xd4e1('0x25')](function(_0x29dac6){return _0x29dac6;});}return null;};}function removeEntity(_0x142a82,_0x1e5eb1){return function(_0x31b80f){if(_0x31b80f){return _0x31b80f[_0xd4e1('0x26')]()[_0xd4e1('0x25')](function(){_0x142a82[_0xd4e1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3868d5,_0x49e0dc){return function(_0xbf4c28){if(!_0xbf4c28){_0x3868d5['sendStatus'](0x194);}return _0xbf4c28;};}function handleError(_0x40bbc6,_0x32d1a8){_0x32d1a8=_0x32d1a8||0x1f4;return function(_0x55a739){logger[_0xd4e1('0x27')](_0x55a739[_0xd4e1('0x28')]);if(_0x55a739['name']){delete _0x55a739[_0xd4e1('0x29')];}_0x40bbc6[_0xd4e1('0x1b')](_0x32d1a8)[_0xd4e1('0x2a')](_0x55a739);};}exports[_0xd4e1('0x2b')]=function(_0x3add63,_0x18c8b2){var _0x56984b={},_0x25db51={},_0x48f3a7={'count':0x0,'rows':[]};var _0x38f6a=_[_0xd4e1('0x2c')](db[_0xd4e1('0x2d')][_0xd4e1('0x2e')],function(_0x534293){return{'name':_0x534293[_0xd4e1('0x2f')],'type':_0x534293['type'][_0xd4e1('0x30')]};});_0x25db51['model']=_[_0xd4e1('0x2c')](_0x38f6a,'name');_0x25db51[_0xd4e1('0x31')]=_[_0xd4e1('0x32')](_0x3add63[_0xd4e1('0x31')]);_0x25db51[_0xd4e1('0x33')]=_[_0xd4e1('0x34')](_0x25db51['model'],_0x25db51['query']);_0x56984b['attributes']=_['intersection'](_0x25db51[_0xd4e1('0x35')],qs[_0xd4e1('0x36')](_0x3add63[_0xd4e1('0x31')]['fields']));_0x56984b[_0xd4e1('0x37')]=_0x56984b[_0xd4e1('0x37')][_0xd4e1('0x38')]?_0x56984b[_0xd4e1('0x37')]:_0x25db51[_0xd4e1('0x35')];if(!_0x3add63[_0xd4e1('0x31')][_0xd4e1('0x39')](_0xd4e1('0x3a'))){_0x56984b[_0xd4e1('0x20')]=qs[_0xd4e1('0x20')](_0x3add63['query'][_0xd4e1('0x20')]);_0x56984b['offset']=qs[_0xd4e1('0x1f')](_0x3add63['query']['offset']);}_0x56984b['order']=qs[_0xd4e1('0x3b')](_0x3add63['query'][_0xd4e1('0x3b')]);_0x56984b[_0xd4e1('0x3c')]=qs[_0xd4e1('0x33')](_[_0xd4e1('0x3d')](_0x3add63[_0xd4e1('0x31')],_0x25db51[_0xd4e1('0x33')]),_0x38f6a);if(_0x3add63[_0xd4e1('0x31')]['filter']){_0x56984b[_0xd4e1('0x3c')]=_[_0xd4e1('0x3e')](_0x56984b['where'],{'$or':_[_0xd4e1('0x2c')](_0x38f6a,function(_0x3e7bb0){if(_0x3e7bb0[_0xd4e1('0x3f')]!=='VIRTUAL'){var _0x326461={};_0x326461[_0x3e7bb0[_0xd4e1('0x29')]]={'$like':'%'+_0x3add63[_0xd4e1('0x31')][_0xd4e1('0x40')]+'%'};return _0x326461;}})});}_0x56984b=_[_0xd4e1('0x3e')]({},_0x56984b,_0x3add63[_0xd4e1('0x41')]);var _0x4cb863={'where':_0x56984b['where']};return db['Dynamics365Field']['count'](_0x4cb863)[_0xd4e1('0x25')](function(_0x1d987b){_0x48f3a7['count']=_0x1d987b;if(_0x3add63['query'][_0xd4e1('0x42')]){_0x56984b['include']=[{'all':!![]}];}return db[_0xd4e1('0x2d')][_0xd4e1('0x43')](_0x56984b);})[_0xd4e1('0x25')](function(_0x3a7770){_0x48f3a7[_0xd4e1('0x44')]=_0x3a7770;return _0x48f3a7;})[_0xd4e1('0x25')](respondWithFilteredResult(_0x18c8b2,_0x56984b))[_0xd4e1('0x45')](handleError(_0x18c8b2,null));};exports[_0xd4e1('0x46')]=function(_0x1eb1e0,_0x588ce0){var _0x1e4c4e={'raw':!![],'where':{'id':_0x1eb1e0[_0xd4e1('0x47')]['id']}},_0x11e9a3={};_0x11e9a3['model']=_[_0xd4e1('0x32')](db[_0xd4e1('0x2d')]['rawAttributes']);_0x11e9a3[_0xd4e1('0x31')]=_['keys'](_0x1eb1e0[_0xd4e1('0x31')]);_0x11e9a3[_0xd4e1('0x33')]=_[_0xd4e1('0x34')](_0x11e9a3[_0xd4e1('0x35')],_0x11e9a3[_0xd4e1('0x31')]);_0x1e4c4e[_0xd4e1('0x37')]=_[_0xd4e1('0x34')](_0x11e9a3['model'],qs[_0xd4e1('0x36')](_0x1eb1e0[_0xd4e1('0x31')][_0xd4e1('0x36')]));_0x1e4c4e[_0xd4e1('0x37')]=_0x1e4c4e[_0xd4e1('0x37')][_0xd4e1('0x38')]?_0x1e4c4e[_0xd4e1('0x37')]:_0x11e9a3[_0xd4e1('0x35')];if(_0x1eb1e0['query']['includeAll']){_0x1e4c4e['include']=[{'all':!![]}];}_0x1e4c4e=_[_0xd4e1('0x3e')]({},_0x1e4c4e,_0x1eb1e0['options']);return db[_0xd4e1('0x2d')][_0xd4e1('0x48')](_0x1e4c4e)[_0xd4e1('0x25')](handleEntityNotFound(_0x588ce0,null))[_0xd4e1('0x25')](respondWithResult(_0x588ce0,null))[_0xd4e1('0x45')](handleError(_0x588ce0,null));};exports['create']=function(_0x2a0fef,_0x247283){return db['Dynamics365Field']['create'](_0x2a0fef[_0xd4e1('0x49')],{})['then'](respondWithResult(_0x247283,0xc9))[_0xd4e1('0x45')](handleError(_0x247283,null));};exports[_0xd4e1('0x4a')]=function(_0x28c3a3,_0x1690b8){if(_0x28c3a3[_0xd4e1('0x49')]['id']){delete _0x28c3a3[_0xd4e1('0x49')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x28c3a3[_0xd4e1('0x47')]['id']}})[_0xd4e1('0x25')](handleEntityNotFound(_0x1690b8,null))['then'](saveUpdates(_0x28c3a3[_0xd4e1('0x49')],null))[_0xd4e1('0x25')](respondWithResult(_0x1690b8,null))[_0xd4e1('0x45')](handleError(_0x1690b8,null));};exports[_0xd4e1('0x26')]=function(_0x3479a9,_0x26fb99){return db[_0xd4e1('0x2d')]['find']({'where':{'id':_0x3479a9[_0xd4e1('0x47')]['id']}})[_0xd4e1('0x25')](handleEntityNotFound(_0x26fb99,null))[_0xd4e1('0x25')](removeEntity(_0x26fb99,null))[_0xd4e1('0x45')](handleError(_0x26fb99,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 50f49e3..a73f5a9 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 _0x51d0=['../../config/environment','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x51d0,0x104));var _0x051d=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x51d0[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x051d('0x0'))(_0x051d('0x1'));var moment=require(_0x051d('0x2'));var BPromise=require(_0x051d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x051d('0x4'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x1566c4,_0x58449d){return _0x1566c4[_0x051d('0x5')](_0x051d('0x6'),attributes,{'tableName':_0x051d('0x7'),'paranoid':![],'indexes':[{'name':_0x051d('0x8'),'fields':[_0x051d('0x9'),_0x051d('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x173a=['path','./intDynamics365Field.attributes','exports','define','dynamics365_unique_index','FieldId','lodash','../../config/logger','api','bluebird'];(function(_0x200827,_0x4af951){var _0x120047=function(_0x4431de){while(--_0x4431de){_0x200827['push'](_0x200827['shift']());}};_0x120047(++_0x4af951);}(_0x173a,0x1d2));var _0xa173=function(_0x341377,_0x96bff6){_0x341377=_0x341377-0x0;var _0x442a5a=_0x173a[_0x341377];return _0x442a5a;};'use strict';var _=require(_0xa173('0x0'));var util=require('util');var logger=require(_0xa173('0x1'))(_0xa173('0x2'));var moment=require('moment');var BPromise=require(_0xa173('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa173('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa173('0x5'));module[_0xa173('0x6')]=function(_0x41e7e6,_0x1b7b41){return _0x41e7e6[_0xa173('0x7')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xa173('0x8'),'fields':['idField',_0xa173('0x9')],'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 7e567bc..a08e2e1 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 _0x6eec=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch'];(function(_0x846e4d,_0x237f32){var _0x59a2c8=function(_0x469a76){while(--_0x469a76){_0x846e4d['push'](_0x846e4d['shift']());}};_0x59a2c8(++_0x237f32);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var moment=require(_0xc6ee('0x2'));var BPromise=require(_0xc6ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6ee('0x4'));var db=require(_0xc6ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6ee('0x6'))(_0xc6ee('0x7'));var config=require(_0xc6ee('0x8'));var jayson=require(_0xc6ee('0x9'));var client=jayson[_0xc6ee('0xa')][_0xc6ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa820be,_0x3325b5,_0x476339){return new BPromise(function(_0x59bd32,_0x5d1421){return client[_0xc6ee('0xc')](_0xa820be,_0x476339)[_0xc6ee('0xd')](function(_0x4d6c8b){logger[_0xc6ee('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3325b5,_0xc6ee('0xf'));logger[_0xc6ee('0x10')](_0xc6ee('0x11'),_0x3325b5,_0xc6ee('0xf'),JSON['stringify'](_0x4d6c8b));if(_0x4d6c8b[_0xc6ee('0x12')]){if(_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x13')]===0x1f4){logger['error'](_0xc6ee('0x14'),_0x3325b5,_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x15')]);return _0x5d1421(_0x4d6c8b['error'][_0xc6ee('0x15')]);}logger[_0xc6ee('0x12')](_0xc6ee('0x14'),_0x3325b5,_0x4d6c8b['error'][_0xc6ee('0x15')]);return _0x59bd32(_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x15')]);}else{logger['info'](_0xc6ee('0x14'),_0x3325b5,_0xc6ee('0xf'));_0x59bd32(_0x4d6c8b[_0xc6ee('0x16')][_0xc6ee('0x15')]);}})[_0xc6ee('0x17')](function(_0x18fea5){logger[_0xc6ee('0x12')](_0xc6ee('0x14'),_0x3325b5,_0x18fea5);_0x5d1421(_0x18fea5);});});} \ No newline at end of file +var _0x2e65=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x390500,_0x1ab713){var _0x132cbf=function(_0x1e6f15){while(--_0x1e6f15){_0x390500['push'](_0x390500['shift']());}};_0x132cbf(++_0x1ab713);}(_0x2e65,0x193));var _0x52e6=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x2e65[_0x4fdcc0];return _0xc0ce94;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var moment=require(_0x52e6('0x2'));var BPromise=require(_0x52e6('0x3'));var rs=require(_0x52e6('0x4'));var fs=require('fs');var Redis=require(_0x52e6('0x5'));var db=require(_0x52e6('0x6'))['db'];var utils=require(_0x52e6('0x7'));var logger=require('../../config/logger')(_0x52e6('0x8'));var config=require(_0x52e6('0x9'));var jayson=require(_0x52e6('0xa'));var client=jayson[_0x52e6('0xb')][_0x52e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x116651,_0x15e4af,_0x1401a3){return new BPromise(function(_0x27f270,_0x2ab17e){return client['request'](_0x116651,_0x1401a3)[_0x52e6('0xd')](function(_0x1db169){logger['info'](_0x52e6('0xe'),_0x15e4af,'request\x20sent');logger['debug'](_0x52e6('0xf'),_0x15e4af,_0x52e6('0x10'),JSON[_0x52e6('0x11')](_0x1db169));if(_0x1db169[_0x52e6('0x12')]){if(_0x1db169[_0x52e6('0x12')][_0x52e6('0x13')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x2ab17e(_0x1db169['error'][_0x52e6('0x14')]);}logger[_0x52e6('0x12')](_0x52e6('0xe'),_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x27f270(_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);}else{logger[_0x52e6('0x15')](_0x52e6('0xe'),_0x15e4af,_0x52e6('0x10'));_0x27f270(_0x1db169[_0x52e6('0x16')][_0x52e6('0x14')]);}})[_0x52e6('0x17')](function(_0x5c275c){logger['error'](_0x52e6('0xe'),_0x15e4af,_0x5c275c);_0x2ab17e(_0x5c275c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index eb6ff6f..609a124 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 _0x0c4c=['getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations'];(function(_0x529f1e,_0x5978b9){var _0x35d179=function(_0x145d1b){while(--_0x145d1b){_0x529f1e['push'](_0x529f1e['shift']());}};_0x35d179(++_0x5978b9);}(_0x0c4c,0xb9));var _0xc0c4=function(_0x5d76d8,_0x11b24d){_0x5d76d8=_0x5d76d8-0x0;var _0x40f687=_0x0c4c[_0x5d76d8];return _0x40f687;};'use strict';var multer=require(_0xc0c4('0x0'));var util=require(_0xc0c4('0x1'));var path=require(_0xc0c4('0x2'));var timeout=require(_0xc0c4('0x3'));var express=require(_0xc0c4('0x4'));var router=express[_0xc0c4('0x5')]();var auth=require(_0xc0c4('0x6'));var interaction=require(_0xc0c4('0x7'));var config=require(_0xc0c4('0x8'));var controller=require(_0xc0c4('0x9'));router[_0xc0c4('0xa')]('/',auth[_0xc0c4('0xb')](),controller[_0xc0c4('0xc')]);router[_0xc0c4('0xa')](_0xc0c4('0xd'),auth[_0xc0c4('0xb')](),controller['show']);router['get'](_0xc0c4('0xe'),auth[_0xc0c4('0xb')](),controller[_0xc0c4('0xf')]);router[_0xc0c4('0xa')](_0xc0c4('0x10'),auth['isAuthenticated'](),controller[_0xc0c4('0x11')]);router['post']('/',auth[_0xc0c4('0xb')](),controller[_0xc0c4('0x12')]);router[_0xc0c4('0x13')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc0c4('0x14')](_0xc0c4('0xd'),auth['isAuthenticated'](),controller[_0xc0c4('0x15')]);router[_0xc0c4('0x16')](_0xc0c4('0xd'),auth['isAuthenticated'](),controller[_0xc0c4('0x17')]);module[_0xc0c4('0x18')]=router; \ No newline at end of file +var _0xdffe=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdffe,0x1d1));var _0xedff=function(_0x322743,_0x3903b9){_0x322743=_0x322743-0x0;var _0x13de4d=_0xdffe[_0x322743];return _0x13de4d;};'use strict';var multer=require(_0xedff('0x0'));var util=require('util');var path=require(_0xedff('0x1'));var timeout=require(_0xedff('0x2'));var express=require(_0xedff('0x3'));var router=express['Router']();var auth=require(_0xedff('0x4'));var interaction=require(_0xedff('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xedff('0x6')]('/',auth[_0xedff('0x7')](),controller['index']);router[_0xedff('0x6')](_0xedff('0x8'),auth[_0xedff('0x7')](),controller[_0xedff('0x9')]);router['get'](_0xedff('0xa'),auth[_0xedff('0x7')](),controller[_0xedff('0xb')]);router[_0xedff('0x6')](_0xedff('0xc'),auth['isAuthenticated'](),controller[_0xedff('0xd')]);router[_0xedff('0xe')]('/',auth[_0xedff('0x7')](),controller[_0xedff('0xf')]);router['post'](_0xedff('0xa'),auth[_0xedff('0x7')](),controller[_0xedff('0x10')]);router['put'](_0xedff('0x8'),auth['isAuthenticated'](),controller[_0xedff('0x11')]);router[_0xedff('0x12')](_0xedff('0x8'),auth[_0xedff('0x7')](),controller[_0xedff('0x13')]);module[_0xedff('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index fd4fd0d..9dd7240 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 _0x25d4=['username','remoteUri','sequelize','exports','STRING'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x25d4,0xb1));var _0x425d=function(_0x4a3b38,_0x2f9164){_0x4a3b38=_0x4a3b38-0x0;var _0x5badda=_0x25d4[_0x4a3b38];return _0x5badda;};'use strict';var Sequelize=require(_0x425d('0x0'));module[_0x425d('0x1')]={'name':{'type':Sequelize[_0x425d('0x2')]},'description':{'type':Sequelize[_0x425d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x425d('0x3')},'apiKey':{'type':Sequelize[_0x425d('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x425d('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeba2=['remoteUri','STRING','username'];(function(_0x7dd1ad,_0x591860){var _0x172e5f=function(_0x58e403){while(--_0x58e403){_0x7dd1ad['push'](_0x7dd1ad['shift']());}};_0x172e5f(++_0x591860);}(_0xeba2,0x70));var _0x2eba=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xeba2[_0x1ee0a1];return _0x1d2d5b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2eba('0x0')]},'description':{'type':Sequelize[_0x2eba('0x0')]},'username':{'type':Sequelize[_0x2eba('0x0')],'unique':_0x2eba('0x1')},'apiKey':{'type':Sequelize[_0x2eba('0x0')]},'remoteUri':{'type':Sequelize[_0x2eba('0x0')],'unique':_0x2eba('0x2')},'serverUrl':{'type':Sequelize[_0x2eba('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 2e48451..54993f0 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 _0x7fbe=['../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','findAll','rows','params','includeAll','create','body','catch','find','findOne','merge','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','GET','format','%s/%s','%s:X','apiKey','toString','base64','requester','agent','description','priority','group','source','ticket_type','company','remove','custom_dropdown','label','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3246b6,_0x1da0f1){var _0x1c61db=function(_0x6b72e2){while(--_0x6b72e2){_0x3246b6['push'](_0x3246b6['shift']());}};_0x1c61db(++_0x1da0f1);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0x7fbe[_0x65d12e];return _0x4274e0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var db=require(_0xe7fb('0x19'))['db'];var integrations=require(_0xe7fb('0x1a'));var jayson=require(_0xe7fb('0x1b'));var client=jayson[_0xe7fb('0x1c')][_0xe7fb('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x45fe75,_0x7fe4d3,_0x598729){if(_0x598729){var _0x278b75=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x278b75[_0xe7fb('0x1e')](_0x7fe4d3)){return _0x45fe75;}else{throw new db['Sequelize'][(_0xe7fb('0x1f'))](_0xe7fb('0x20'));}}else{return _0x45fe75;}}function respondWithRpcPromise(_0x482f7d,_0xa76acf,_0x559129,_0x12fff6){return new BPromise(function(_0x18d23c,_0x12603d){var _0x17e8a8=_0x12fff6||client;return _0x17e8a8['request'](_0x482f7d,_0x559129)[_0xe7fb('0x21')](function(_0x5ebc87){logger[_0xe7fb('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0xa76acf,_0xe7fb('0x23'));logger[_0xe7fb('0x24')](_0xe7fb('0x25'),_0xa76acf,_0xe7fb('0x23'),JSON['stringify'](_0x5ebc87));if(_0x5ebc87[_0xe7fb('0x26')]){if(_0x5ebc87['error'][_0xe7fb('0x27')]===0x1f4){logger['error'](_0xe7fb('0x28'),_0xa76acf,_0x5ebc87['error'][_0xe7fb('0x29')]);return _0x12603d(_0x5ebc87[_0xe7fb('0x26')]['message']);}logger[_0xe7fb('0x26')](_0xe7fb('0x28'),_0xa76acf,_0x5ebc87[_0xe7fb('0x26')]['message']);return _0x18d23c(_0x5ebc87[_0xe7fb('0x26')][_0xe7fb('0x29')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xa76acf,'request\x20sent');_0x18d23c(_0x5ebc87[_0xe7fb('0x2a')]['message']);}})['catch'](function(_0x4026b1){logger[_0xe7fb('0x26')](_0xe7fb('0x28'),_0xa76acf,_0x4026b1);_0x12603d(_0x4026b1);});});}function respondWithStatusCode(_0x4f6c73,_0x6c930){_0x6c930=_0x6c930||0xcc;return function(_0x2b69c4){if(_0x2b69c4){return _0x4f6c73[_0xe7fb('0x2b')](_0x6c930);}return _0x4f6c73[_0xe7fb('0x2c')](_0x6c930)[_0xe7fb('0x2d')]();};}function respondWithResult(_0x16237a,_0x380130){_0x380130=_0x380130||0xc8;return function(_0x59e015){if(_0x59e015){return _0x16237a['status'](_0x380130)[_0xe7fb('0x2e')](_0x59e015);}};}function respondWithFilteredResult(_0x3bdee9,_0xead63){return function(_0x4fd290){if(_0x4fd290){var _0xb1f2f4=_0x4fd290[_0xe7fb('0x2f')],_0x251807=_0xead63[_0xe7fb('0x30')],_0xd3fffe=_0xead63[_0xe7fb('0x30')]+_0xead63[_0xe7fb('0x31')],_0x5f265f;if(_0xd3fffe>=_0xb1f2f4){_0xd3fffe=_0xb1f2f4;_0x5f265f=0xc8;}else{_0x5f265f=0xce;}_0x3bdee9['status'](_0x5f265f);return _0x3bdee9[_0xe7fb('0x32')](_0xe7fb('0x33'),_0x251807+'-'+_0xd3fffe+'/'+_0xb1f2f4)[_0xe7fb('0x2e')](_0x4fd290);}return null;};}function patchUpdates(_0x547a04){return function(_0x517d70){try{jsonpatch[_0xe7fb('0x34')](_0x517d70,_0x547a04,!![]);}catch(_0x4a9fea){return BPromise[_0xe7fb('0x35')](_0x4a9fea);}return _0x517d70[_0xe7fb('0x36')]();};}function saveUpdates(_0xe49053,_0x2a4745){return function(_0x556368){if(_0x556368){return _0x556368[_0xe7fb('0x37')](_0xe49053)[_0xe7fb('0x21')](function(_0x18ed83){return _0x18ed83;});}return null;};}function removeEntity(_0x2f8818,_0x2d650d){return function(_0x480819){if(_0x480819){return _0x480819[_0xe7fb('0x38')]()[_0xe7fb('0x21')](function(){_0x2f8818[_0xe7fb('0x2c')](0xcc)[_0xe7fb('0x2d')]();});}};}function handleEntityNotFound(_0x46f430,_0x25e925){return function(_0x1bc72d){if(!_0x1bc72d){_0x46f430[_0xe7fb('0x2b')](0x194);}return _0x1bc72d;};}function handleError(_0x389903,_0x59f9df){_0x59f9df=_0x59f9df||0x1f4;return function(_0x44d8cf){logger[_0xe7fb('0x26')](_0x44d8cf[_0xe7fb('0x39')]);if(_0x44d8cf['name']){delete _0x44d8cf[_0xe7fb('0x3a')];}_0x389903[_0xe7fb('0x2c')](_0x59f9df)[_0xe7fb('0x3b')](_0x44d8cf);};}exports[_0xe7fb('0x3c')]=function(_0x402ca3,_0x35b828){var _0xfeefb1={},_0xc4e271={},_0x195c35={'count':0x0,'rows':[]};var _0xebfe1d=_[_0xe7fb('0x3d')](db[_0xe7fb('0x3e')][_0xe7fb('0x3f')],function(_0x1c81fe){return{'name':_0x1c81fe[_0xe7fb('0x40')],'type':_0x1c81fe[_0xe7fb('0x41')][_0xe7fb('0x42')]};});_0xc4e271[_0xe7fb('0x43')]=_[_0xe7fb('0x3d')](_0xebfe1d,'name');_0xc4e271[_0xe7fb('0x44')]=_[_0xe7fb('0x45')](_0x402ca3[_0xe7fb('0x44')]);_0xc4e271[_0xe7fb('0x46')]=_['intersection'](_0xc4e271[_0xe7fb('0x43')],_0xc4e271[_0xe7fb('0x44')]);_0xfeefb1[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0xc4e271['model'],qs[_0xe7fb('0x49')](_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x49')]));_0xfeefb1[_0xe7fb('0x47')]=_0xfeefb1[_0xe7fb('0x47')][_0xe7fb('0x4a')]?_0xfeefb1['attributes']:_0xc4e271[_0xe7fb('0x43')];if(!_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4b')]('nolimit')){_0xfeefb1[_0xe7fb('0x31')]=qs[_0xe7fb('0x31')](_0x402ca3['query']['limit']);_0xfeefb1['offset']=qs['offset'](_0x402ca3['query'][_0xe7fb('0x30')]);}_0xfeefb1[_0xe7fb('0x4c')]=qs[_0xe7fb('0x4d')](_0x402ca3['query'][_0xe7fb('0x4d')]);_0xfeefb1['where']=qs[_0xe7fb('0x46')](_[_0xe7fb('0x4e')](_0x402ca3['query'],_0xc4e271[_0xe7fb('0x46')]),_0xebfe1d);if(_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4f')]){_0xfeefb1[_0xe7fb('0x50')]=_['merge'](_0xfeefb1[_0xe7fb('0x50')],{'$or':_[_0xe7fb('0x3d')](_0xebfe1d,function(_0x1b8a34){if(_0x1b8a34['type']!==_0xe7fb('0x51')){var _0x6eb1ab={};_0x6eb1ab[_0x1b8a34[_0xe7fb('0x3a')]]={'$like':'%'+_0x402ca3[_0xe7fb('0x44')][_0xe7fb('0x4f')]+'%'};return _0x6eb1ab;}})});}_0xfeefb1=_['merge']({},_0xfeefb1,_0x402ca3[_0xe7fb('0x52')]);var _0x4df4aa={'where':_0xfeefb1[_0xe7fb('0x50')]};return db[_0xe7fb('0x3e')][_0xe7fb('0x2f')](_0x4df4aa)[_0xe7fb('0x21')](function(_0x15cec3){_0x195c35['count']=_0x15cec3;if(_0x402ca3[_0xe7fb('0x44')]['includeAll']){_0xfeefb1['include']=[{'all':!![]}];}return db[_0xe7fb('0x3e')][_0xe7fb('0x53')](_0xfeefb1);})[_0xe7fb('0x21')](function(_0x589555){_0x195c35[_0xe7fb('0x54')]=_0x589555;return _0x195c35;})[_0xe7fb('0x21')](respondWithFilteredResult(_0x35b828,_0xfeefb1))['catch'](handleError(_0x35b828,null));};exports['show']=function(_0x284bcb,_0x42270b){var _0x1cbf34={'raw':![],'where':{'id':_0x284bcb[_0xe7fb('0x55')]['id']}},_0x3dd6bf={};_0x3dd6bf[_0xe7fb('0x43')]=_[_0xe7fb('0x45')](db[_0xe7fb('0x3e')]['rawAttributes']);_0x3dd6bf[_0xe7fb('0x44')]=_['keys'](_0x284bcb[_0xe7fb('0x44')]);_0x3dd6bf[_0xe7fb('0x46')]=_['intersection'](_0x3dd6bf[_0xe7fb('0x43')],_0x3dd6bf['query']);_0x1cbf34[_0xe7fb('0x47')]=_['intersection'](_0x3dd6bf[_0xe7fb('0x43')],qs['fields'](_0x284bcb[_0xe7fb('0x44')]['fields']));_0x1cbf34[_0xe7fb('0x47')]=_0x1cbf34[_0xe7fb('0x47')][_0xe7fb('0x4a')]?_0x1cbf34[_0xe7fb('0x47')]:_0x3dd6bf[_0xe7fb('0x43')];if(_0x284bcb[_0xe7fb('0x44')][_0xe7fb('0x56')]){_0x1cbf34['include']=[{'all':!![]}];}_0x1cbf34=_['merge']({},_0x1cbf34,_0x284bcb[_0xe7fb('0x52')]);return db['FreshdeskAccount']['find'](_0x1cbf34)['then'](handleEntityNotFound(_0x42270b,null))['then'](respondWithResult(_0x42270b,null))['catch'](handleError(_0x42270b,null));};exports[_0xe7fb('0x57')]=function(_0x34dd69,_0xd2fd76){return db[_0xe7fb('0x3e')]['create'](_0x34dd69[_0xe7fb('0x58')],{})[_0xe7fb('0x21')](respondWithResult(_0xd2fd76,0xc9))[_0xe7fb('0x59')](handleError(_0xd2fd76,null));};exports['update']=function(_0x56c512,_0x2f3b72){if(_0x56c512[_0xe7fb('0x58')]['id']){delete _0x56c512[_0xe7fb('0x58')]['id'];}return db['FreshdeskAccount'][_0xe7fb('0x5a')]({'where':{'id':_0x56c512[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x2f3b72,null))[_0xe7fb('0x21')](saveUpdates(_0x56c512['body'],null))['then'](respondWithResult(_0x2f3b72,null))[_0xe7fb('0x59')](handleError(_0x2f3b72,null));};exports[_0xe7fb('0x38')]=function(_0x1f16b2,_0x2f61b1){return db[_0xe7fb('0x3e')]['find']({'where':{'id':_0x1f16b2[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x2f61b1,null))[_0xe7fb('0x21')](removeEntity(_0x2f61b1,null))['catch'](handleError(_0x2f61b1,null));};exports['getConfigurations']=function(_0x425bee,_0x3b69f7,_0x14fe1b){var _0x1c4035={};var _0x40f546={};var _0x3385e2;var _0x585b7c;return db[_0xe7fb('0x3e')][_0xe7fb('0x5b')]({'where':{'id':_0x425bee[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x3b69f7,null))[_0xe7fb('0x21')](function(_0x1e0d69){if(_0x1e0d69){_0x3385e2=_0x1e0d69;_0x40f546['model']=_[_0xe7fb('0x45')](db['FreshdeskConfiguration'][_0xe7fb('0x3f')]);_0x40f546[_0xe7fb('0x44')]=_[_0xe7fb('0x45')](_0x425bee[_0xe7fb('0x44')]);_0x40f546['filters']=_['intersection'](_0x40f546[_0xe7fb('0x43')],_0x40f546[_0xe7fb('0x44')]);_0x1c4035[_0xe7fb('0x47')]=_[_0xe7fb('0x48')](_0x40f546[_0xe7fb('0x43')],qs['fields'](_0x425bee[_0xe7fb('0x44')]['fields']));_0x1c4035[_0xe7fb('0x47')]=_0x1c4035['attributes']['length']?_0x1c4035[_0xe7fb('0x47')]:_0x40f546[_0xe7fb('0x43')];_0x1c4035[_0xe7fb('0x4c')]=qs['sort'](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x4d')]);_0x1c4035[_0xe7fb('0x50')]=qs[_0xe7fb('0x46')](_[_0xe7fb('0x4e')](_0x425bee['query'],_0x40f546[_0xe7fb('0x46')]));if(_0x425bee[_0xe7fb('0x44')]['filter']){_0x1c4035[_0xe7fb('0x50')]=_[_0xe7fb('0x5c')](_0x1c4035['where'],{'$or':_[_0xe7fb('0x3d')](_0x1c4035['attributes'],function(_0x2705ef){var _0x1dc9c1={};_0x1dc9c1[_0x2705ef]={'$like':'%'+_0x425bee[_0xe7fb('0x44')]['filter']+'%'};return _0x1dc9c1;})});}_0x1c4035=_[_0xe7fb('0x5c')]({},_0x1c4035,_0x425bee[_0xe7fb('0x52')]);return _0x3385e2[_0xe7fb('0x5d')](_0x1c4035);}})[_0xe7fb('0x21')](function(_0x35487f){if(_0x35487f){_0x585b7c=_0x35487f[_0xe7fb('0x4a')];if(!_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x4b')]('nolimit')){_0x1c4035['limit']=qs[_0xe7fb('0x31')](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x31')]);_0x1c4035['offset']=qs['offset'](_0x425bee[_0xe7fb('0x44')][_0xe7fb('0x30')]);}return _0x3385e2[_0xe7fb('0x5d')](_0x1c4035);}})[_0xe7fb('0x21')](function(_0x2d558c){if(_0x2d558c){return _0x2d558c?{'count':_0x585b7c,'rows':_0x2d558c}:null;}})[_0xe7fb('0x21')](respondWithResult(_0x3b69f7,null))[_0xe7fb('0x59')](handleError(_0x3b69f7,null));};exports[_0xe7fb('0x5e')]=function(_0xb06693,_0x3691a6,_0x1ff5e7){if(_0xb06693[_0xe7fb('0x58')]['id']){delete _0xb06693[_0xe7fb('0x58')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0xb06693[_0xe7fb('0x55')]['id']}})[_0xe7fb('0x21')](handleEntityNotFound(_0x3691a6,null))[_0xe7fb('0x21')](function(_0x16cd8f){if(_0x16cd8f){_0xb06693[_0xe7fb('0x58')]['AccountId']=_0x16cd8f['id'];_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x5f')]=integrations[_0xe7fb('0x60')](_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x61')],_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x41')]);_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x62')]=integrations['getDescriptions'](_0xb06693[_0xe7fb('0x58')]['channel'],_0xb06693[_0xe7fb('0x58')][_0xe7fb('0x41')]);return db[_0xe7fb('0x63')][_0xe7fb('0x57')](_0xb06693[_0xe7fb('0x58')],{'include':[{'model':db['FreshdeskField'],'as':_0xe7fb('0x5f')},{'model':db[_0xe7fb('0x64')],'as':_0xe7fb('0x62')}]});}return null;})[_0xe7fb('0x21')](respondWithResult(_0x3691a6,null))[_0xe7fb('0x59')](handleError(_0x3691a6,null));};exports[_0xe7fb('0x65')]=function(_0x10a6e8,_0x17e640,_0x3d139f){var _0x59731e='';return db[_0xe7fb('0x3e')][_0xe7fb('0x5b')]({'where':{'id':_0x10a6e8[_0xe7fb('0x55')]['id']},'attributes':['id',_0xe7fb('0x66'),'apiKey']})['then'](handleEntityNotFound(_0x17e640,null))['then'](function(_0x13265b){if(_0x13265b){_0x59731e=_0x13265b[_0xe7fb('0x66')];var _0x25e4d9=_0x59731e[_0xe7fb('0x67')](-0x1);if(_0x25e4d9==='/'){_0x59731e=_0x59731e['substring'](0x0,_0x59731e[_0xe7fb('0x68')](_0x25e4d9));}return rp({'method':_0xe7fb('0x69'),'uri':util[_0xe7fb('0x6a')](_0xe7fb('0x6b'),_0x59731e,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xe7fb('0x6a')]('Basic\x20%s',new Buffer(util[_0xe7fb('0x6a')](_0xe7fb('0x6c'),_0x13265b[_0xe7fb('0x6d')]))[_0xe7fb('0x6e')](_0xe7fb('0x6f')))},'json':!![]});}})['then'](function(_0x3ffd6c){if(_0x3ffd6c){var _0x5b8f3e=[_0xe7fb('0x70'),'subject',_0xe7fb('0x71'),_0xe7fb('0x72'),'status',_0xe7fb('0x73'),_0xe7fb('0x74'),_0xe7fb('0x75'),_0xe7fb('0x76'),'group',_0xe7fb('0x77')];_[_0xe7fb('0x78')](_0x3ffd6c,function(_0x1412e2){return _0x5b8f3e['includes'](_0x1412e2[_0xe7fb('0x3a')])||!_0x1412e2['default']&&_0x1412e2['type']!=='custom_text'&&_0x1412e2[_0xe7fb('0x41')]!==_0xe7fb('0x79');});return{'count':_0x3ffd6c['length'],'rows':_[_0xe7fb('0x3d')](_0x3ffd6c,function(_0x266bba){return{'id':_0x266bba[_0xe7fb('0x3a')],'name':_0x266bba[_0xe7fb('0x7a')],'custom':!_0x266bba[_0xe7fb('0x7b')],'options':_0x266bba[_0xe7fb('0x7c')]?_[_0xe7fb('0x3d')](_0x266bba[_0xe7fb('0x7c')],function(_0x42190e){return{'name':_[_0xe7fb('0x7d')](_0x42190e),'value':_0x42190e};}):[]};})};}})[_0xe7fb('0x21')](respondWithResult(_0x17e640,null))[_0xe7fb('0x59')](function(_0x3d1f34){var _0x27c97a=_0x10a6e8[_0xe7fb('0x44')][_0xe7fb('0x1e')]?0x1f4:_0x3d1f34[_0xe7fb('0x7e')]||0x1f4;logger[_0xe7fb('0x26')](_0xe7fb('0x7f'),_0xe7fb('0x65'),_0x27c97a,JSON['stringify'](_0x3d1f34));delete _0x3d1f34[_0xe7fb('0x3a')];if(_0x27c97a===0x191){_0x27c97a=0x190;}_0x17e640[_0xe7fb('0x2c')](_0x27c97a)[_0xe7fb('0x3b')](_0x10a6e8[_0xe7fb('0x44')][_0xe7fb('0x1e')]?{'message':_0xe7fb('0x80'),'statusCode':_0x3d1f34[_0xe7fb('0x7e')]}:_0x3d1f34);});}; \ No newline at end of file +var _0x1cb9=['reject','save','update','destroy','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','keys','include','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Descriptions','channel','FreshdeskConfiguration','Subjects','FreshdeskField','getFields','remoteUri','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','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','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply'];(function(_0x49b098,_0x467730){var _0xf6dce6=function(_0x5827e8){while(--_0x5827e8){_0x49b098['push'](_0x49b098['shift']());}};_0xf6dce6(++_0x467730);}(_0x1cb9,0x14e));var _0x91cb=function(_0x43fe06,_0x5cdf93){_0x43fe06=_0x43fe06-0x0;var _0x9b363d=_0x1cb9[_0x43fe06];return _0x9b363d;};'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 db=require('../../mysqldb')['db'];var integrations=require(_0x91cb('0x18'));var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ea707,_0x44f2e9,_0x2c7d40){if(_0x2c7d40){var _0x4a7d45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a7d45['test'](_0x44f2e9)){return _0x3ea707;}else{throw new db[(_0x91cb('0x1b'))][(_0x91cb('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3ea707;}}function respondWithRpcPromise(_0x528f73,_0x576369,_0xc3629e,_0x347980){return new BPromise(function(_0x5ea796,_0x238f11){var _0x135890=_0x347980||client;return _0x135890['request'](_0x528f73,_0xc3629e)[_0x91cb('0x1d')](function(_0x139f4b){logger[_0x91cb('0x1e')](_0x91cb('0x1f'),_0x576369,'request\x20sent');logger[_0x91cb('0x20')](_0x91cb('0x21'),_0x576369,'request\x20sent',JSON[_0x91cb('0x22')](_0x139f4b));if(_0x139f4b['error']){if(_0x139f4b['error'][_0x91cb('0x23')]===0x1f4){logger[_0x91cb('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x576369,_0x139f4b['error']['message']);return _0x238f11(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x139f4b['error'][_0x91cb('0x25')]);return _0x5ea796(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}else{logger['info'](_0x91cb('0x1f'),_0x576369,_0x91cb('0x26'));_0x5ea796(_0x139f4b[_0x91cb('0x27')][_0x91cb('0x25')]);}})[_0x91cb('0x28')](function(_0x7ad361){logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x7ad361);_0x238f11(_0x7ad361);});});}function respondWithStatusCode(_0x264e9b,_0x4c8438){_0x4c8438=_0x4c8438||0xcc;return function(_0x59bf3a){if(_0x59bf3a){return _0x264e9b[_0x91cb('0x29')](_0x4c8438);}return _0x264e9b['status'](_0x4c8438)[_0x91cb('0x2a')]();};}function respondWithResult(_0x34d372,_0x318031){_0x318031=_0x318031||0xc8;return function(_0x5595c5){if(_0x5595c5){return _0x34d372[_0x91cb('0x2b')](_0x318031)['json'](_0x5595c5);}};}function respondWithFilteredResult(_0x4572f6,_0x308e8c){return function(_0x3b3ee6){if(_0x3b3ee6){var _0x2fb473=_0x3b3ee6['count'],_0x468908=_0x308e8c[_0x91cb('0x2c')],_0x504275=_0x308e8c[_0x91cb('0x2c')]+_0x308e8c[_0x91cb('0x2d')],_0x2f04a3;if(_0x504275>=_0x2fb473){_0x504275=_0x2fb473;_0x2f04a3=0xc8;}else{_0x2f04a3=0xce;}_0x4572f6['status'](_0x2f04a3);return _0x4572f6[_0x91cb('0x2e')](_0x91cb('0x2f'),_0x468908+'-'+_0x504275+'/'+_0x2fb473)[_0x91cb('0x30')](_0x3b3ee6);}return null;};}function patchUpdates(_0x361e4c){return function(_0xf296bc){try{jsonpatch[_0x91cb('0x31')](_0xf296bc,_0x361e4c,!![]);}catch(_0x1e5bf1){return BPromise[_0x91cb('0x32')](_0x1e5bf1);}return _0xf296bc[_0x91cb('0x33')]();};}function saveUpdates(_0x5e6ed3,_0x2ccf6e){return function(_0x474a15){if(_0x474a15){return _0x474a15[_0x91cb('0x34')](_0x5e6ed3)[_0x91cb('0x1d')](function(_0x440060){return _0x440060;});}return null;};}function removeEntity(_0x4e70cd,_0x2409d3){return function(_0x74b443){if(_0x74b443){return _0x74b443[_0x91cb('0x35')]()[_0x91cb('0x1d')](function(){_0x4e70cd[_0x91cb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121c37,_0x5927cb){return function(_0x47fc17){if(!_0x47fc17){_0x121c37['sendStatus'](0x194);}return _0x47fc17;};}function handleError(_0x2011fc,_0x4bba88){_0x4bba88=_0x4bba88||0x1f4;return function(_0x341ebe){logger['error'](_0x341ebe['stack']);if(_0x341ebe[_0x91cb('0x36')]){delete _0x341ebe[_0x91cb('0x36')];}_0x2011fc[_0x91cb('0x2b')](_0x4bba88)[_0x91cb('0x37')](_0x341ebe);};}exports[_0x91cb('0x38')]=function(_0x4b0ca6,_0x8beb3a){var _0x3ddc0b={},_0x13a5ea={},_0x8496a3={'count':0x0,'rows':[]};var _0x486a89=_['map'](db[_0x91cb('0x39')][_0x91cb('0x3a')],function(_0x56d614){return{'name':_0x56d614[_0x91cb('0x3b')],'type':_0x56d614[_0x91cb('0x3c')]['key']};});_0x13a5ea[_0x91cb('0x3d')]=_[_0x91cb('0x3e')](_0x486a89,'name');_0x13a5ea[_0x91cb('0x3f')]=_['keys'](_0x4b0ca6[_0x91cb('0x3f')]);_0x13a5ea[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x13a5ea[_0x91cb('0x3d')],_0x13a5ea[_0x91cb('0x3f')]);_0x3ddc0b[_0x91cb('0x42')]=_['intersection'](_0x13a5ea[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x4b0ca6['query'][_0x91cb('0x43')]));_0x3ddc0b['attributes']=_0x3ddc0b[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3ddc0b[_0x91cb('0x42')]:_0x13a5ea[_0x91cb('0x3d')];if(!_0x4b0ca6['query'][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3ddc0b[_0x91cb('0x2d')]=qs[_0x91cb('0x2d')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3ddc0b[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2c')]);}_0x3ddc0b['order']=qs[_0x91cb('0x47')](_0x4b0ca6['query'][_0x91cb('0x47')]);_0x3ddc0b['where']=qs[_0x91cb('0x40')](_['pick'](_0x4b0ca6[_0x91cb('0x3f')],_0x13a5ea[_0x91cb('0x40')]),_0x486a89);if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3ddc0b['where']=_[_0x91cb('0x49')](_0x3ddc0b[_0x91cb('0x4a')],{'$or':_['map'](_0x486a89,function(_0x461e1e){if(_0x461e1e[_0x91cb('0x3c')]!==_0x91cb('0x4b')){var _0x32517d={};_0x32517d[_0x461e1e[_0x91cb('0x36')]]={'$like':'%'+_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x32517d;}})});}_0x3ddc0b=_[_0x91cb('0x49')]({},_0x3ddc0b,_0x4b0ca6[_0x91cb('0x4c')]);var _0x4b26f6={'where':_0x3ddc0b[_0x91cb('0x4a')]};return db[_0x91cb('0x39')][_0x91cb('0x4d')](_0x4b26f6)[_0x91cb('0x1d')](function(_0x3314cc){_0x8496a3[_0x91cb('0x4d')]=_0x3314cc;if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x3ddc0b['include']=[{'all':!![]}];}return db[_0x91cb('0x39')][_0x91cb('0x4f')](_0x3ddc0b);})[_0x91cb('0x1d')](function(_0x3b8cfd){_0x8496a3['rows']=_0x3b8cfd;return _0x8496a3;})[_0x91cb('0x1d')](respondWithFilteredResult(_0x8beb3a,_0x3ddc0b))[_0x91cb('0x28')](handleError(_0x8beb3a,null));};exports['show']=function(_0x212473,_0x47cdb7){var _0x2c419b={'raw':![],'where':{'id':_0x212473['params']['id']}},_0x4c0acd={};_0x4c0acd['model']=_[_0x91cb('0x50')](db[_0x91cb('0x39')][_0x91cb('0x3a')]);_0x4c0acd[_0x91cb('0x3f')]=_[_0x91cb('0x50')](_0x212473['query']);_0x4c0acd['filters']=_[_0x91cb('0x41')](_0x4c0acd[_0x91cb('0x3d')],_0x4c0acd[_0x91cb('0x3f')]);_0x2c419b[_0x91cb('0x42')]=_['intersection'](_0x4c0acd['model'],qs['fields'](_0x212473[_0x91cb('0x3f')]['fields']));_0x2c419b[_0x91cb('0x42')]=_0x2c419b['attributes'][_0x91cb('0x44')]?_0x2c419b[_0x91cb('0x42')]:_0x4c0acd[_0x91cb('0x3d')];if(_0x212473[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x2c419b[_0x91cb('0x51')]=[{'all':!![]}];}_0x2c419b=_[_0x91cb('0x49')]({},_0x2c419b,_0x212473[_0x91cb('0x4c')]);return db[_0x91cb('0x39')][_0x91cb('0x52')](_0x2c419b)[_0x91cb('0x1d')](handleEntityNotFound(_0x47cdb7,null))['then'](respondWithResult(_0x47cdb7,null))[_0x91cb('0x28')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x53')]=function(_0x4d7a34,_0x3f719b){return db[_0x91cb('0x39')]['create'](_0x4d7a34[_0x91cb('0x54')],{})[_0x91cb('0x1d')](respondWithResult(_0x3f719b,0xc9))[_0x91cb('0x28')](handleError(_0x3f719b,null));};exports[_0x91cb('0x34')]=function(_0x43ddee,_0x42a9ef){if(_0x43ddee[_0x91cb('0x54')]['id']){delete _0x43ddee[_0x91cb('0x54')]['id'];}return db[_0x91cb('0x39')][_0x91cb('0x52')]({'where':{'id':_0x43ddee[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a9ef,null))[_0x91cb('0x1d')](saveUpdates(_0x43ddee['body'],null))[_0x91cb('0x1d')](respondWithResult(_0x42a9ef,null))['catch'](handleError(_0x42a9ef,null));};exports[_0x91cb('0x35')]=function(_0x1b2fec,_0x1986d7){return db['FreshdeskAccount'][_0x91cb('0x52')]({'where':{'id':_0x1b2fec[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1986d7,null))[_0x91cb('0x1d')](removeEntity(_0x1986d7,null))[_0x91cb('0x28')](handleError(_0x1986d7,null));};exports[_0x91cb('0x56')]=function(_0x25548b,_0x48e825,_0x2f5658){var _0x3854e9={};var _0x4250c2={};var _0x373076;var _0x55a0e3;return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x25548b['params']['id']}})['then'](handleEntityNotFound(_0x48e825,null))[_0x91cb('0x1d')](function(_0x525021){if(_0x525021){_0x373076=_0x525021;_0x4250c2[_0x91cb('0x3d')]=_[_0x91cb('0x50')](db['FreshdeskConfiguration']['rawAttributes']);_0x4250c2[_0x91cb('0x3f')]=_['keys'](_0x25548b[_0x91cb('0x3f')]);_0x4250c2[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x4250c2['model'],_0x4250c2[_0x91cb('0x3f')]);_0x3854e9['attributes']=_[_0x91cb('0x41')](_0x4250c2[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x25548b[_0x91cb('0x3f')]['fields']));_0x3854e9[_0x91cb('0x42')]=_0x3854e9[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3854e9[_0x91cb('0x42')]:_0x4250c2[_0x91cb('0x3d')];_0x3854e9[_0x91cb('0x58')]=qs[_0x91cb('0x47')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x47')]);_0x3854e9[_0x91cb('0x4a')]=qs[_0x91cb('0x40')](_[_0x91cb('0x59')](_0x25548b['query'],_0x4250c2[_0x91cb('0x40')]));if(_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3854e9[_0x91cb('0x4a')]=_[_0x91cb('0x49')](_0x3854e9[_0x91cb('0x4a')],{'$or':_[_0x91cb('0x3e')](_0x3854e9['attributes'],function(_0x325b2d){var _0x5a3c7d={};_0x5a3c7d[_0x325b2d]={'$like':'%'+_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x5a3c7d;})});}_0x3854e9=_[_0x91cb('0x49')]({},_0x3854e9,_0x25548b[_0x91cb('0x4c')]);return _0x373076['getConfigurations'](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x22ab40){if(_0x22ab40){_0x55a0e3=_0x22ab40[_0x91cb('0x44')];if(!_0x25548b[_0x91cb('0x3f')][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3854e9['limit']=qs[_0x91cb('0x2d')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3854e9[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2c')]);}return _0x373076[_0x91cb('0x56')](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x457f81){if(_0x457f81){return _0x457f81?{'count':_0x55a0e3,'rows':_0x457f81}:null;}})[_0x91cb('0x1d')](respondWithResult(_0x48e825,null))[_0x91cb('0x28')](handleError(_0x48e825,null));};exports[_0x91cb('0x5a')]=function(_0x3eead5,_0x2d2613,_0x2605c3){if(_0x3eead5[_0x91cb('0x54')]['id']){delete _0x3eead5['body']['id'];}return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x3eead5['params']['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x2d2613,null))[_0x91cb('0x1d')](function(_0x1c3e0a){if(_0x1c3e0a){_0x3eead5['body'][_0x91cb('0x5b')]=_0x1c3e0a['id'];_0x3eead5[_0x91cb('0x54')]['Subjects']=integrations['getSubjects'](_0x3eead5[_0x91cb('0x54')]['channel'],_0x3eead5[_0x91cb('0x54')][_0x91cb('0x3c')]);_0x3eead5['body'][_0x91cb('0x5c')]=integrations['getDescriptions'](_0x3eead5[_0x91cb('0x54')][_0x91cb('0x5d')],_0x3eead5['body']['type']);return db[_0x91cb('0x5e')][_0x91cb('0x53')](_0x3eead5[_0x91cb('0x54')],{'include':[{'model':db['FreshdeskField'],'as':_0x91cb('0x5f')},{'model':db[_0x91cb('0x60')],'as':_0x91cb('0x5c')}]});}return null;})[_0x91cb('0x1d')](respondWithResult(_0x2d2613,null))['catch'](handleError(_0x2d2613,null));};exports[_0x91cb('0x61')]=function(_0x4ee1e3,_0x342587,_0x4118eb){var _0x30c607='';return db[_0x91cb('0x39')]['findOne']({'where':{'id':_0x4ee1e3['params']['id']},'attributes':['id',_0x91cb('0x62'),'apiKey']})[_0x91cb('0x1d')](handleEntityNotFound(_0x342587,null))[_0x91cb('0x1d')](function(_0x2ede77){if(_0x2ede77){_0x30c607=_0x2ede77[_0x91cb('0x62')];var _0x33d4ab=_0x30c607[_0x91cb('0x63')](-0x1);if(_0x33d4ab==='/'){_0x30c607=_0x30c607[_0x91cb('0x64')](0x0,_0x30c607['lastIndexOf'](_0x33d4ab));}return rp({'method':_0x91cb('0x65'),'uri':util[_0x91cb('0x66')]('%s/%s',_0x30c607,_0x91cb('0x67')),'headers':{'Authorization':util['format'](_0x91cb('0x68'),new Buffer(util[_0x91cb('0x66')](_0x91cb('0x69'),_0x2ede77[_0x91cb('0x6a')]))[_0x91cb('0x6b')](_0x91cb('0x6c')))},'json':!![]});}})[_0x91cb('0x1d')](function(_0x30259d){if(_0x30259d){var _0x23380a=[_0x91cb('0x6d'),_0x91cb('0x6e'),_0x91cb('0x6f'),_0x91cb('0x70'),_0x91cb('0x2b'),_0x91cb('0x71'),_0x91cb('0x72'),'source',_0x91cb('0x73'),'group',_0x91cb('0x74')];_[_0x91cb('0x75')](_0x30259d,function(_0x13f358){return _0x23380a[_0x91cb('0x76')](_0x13f358[_0x91cb('0x36')])||!_0x13f358[_0x91cb('0x77')]&&_0x13f358[_0x91cb('0x3c')]!==_0x91cb('0x78')&&_0x13f358['type']!==_0x91cb('0x79');});return{'count':_0x30259d[_0x91cb('0x44')],'rows':_['map'](_0x30259d,function(_0x4fb3c0){return{'id':_0x4fb3c0[_0x91cb('0x36')],'name':_0x4fb3c0['label'],'custom':!_0x4fb3c0['default'],'options':_0x4fb3c0[_0x91cb('0x7a')]?_['map'](_0x4fb3c0[_0x91cb('0x7a')],function(_0x498382){return{'name':_[_0x91cb('0x7b')](_0x498382),'value':_0x498382};}):[]};})};}})[_0x91cb('0x1d')](respondWithResult(_0x342587,null))[_0x91cb('0x28')](function(_0x443c01){var _0x4e899c=_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?0x1f4:_0x443c01[_0x91cb('0x7d')]||0x1f4;logger[_0x91cb('0x24')](_0x91cb('0x7e'),_0x91cb('0x61'),_0x4e899c,JSON[_0x91cb('0x22')](_0x443c01));delete _0x443c01[_0x91cb('0x36')];if(_0x4e899c===0x191){_0x4e899c=0x190;}_0x342587[_0x91cb('0x2b')](_0x4e899c)[_0x91cb('0x37')](_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?{'message':_0x91cb('0x7f'),'statusCode':_0x443c01[_0x91cb('0x7d')]}:_0x443c01);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 8edde2a..b1e949e 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 _0xfbcc=['api','bluebird','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util'];(function(_0x1f8b39,_0x17e04f){var _0x1fcee6=function(_0x5817d5){while(--_0x5817d5){_0x1f8b39['push'](_0x1f8b39['shift']());}};_0x1fcee6(++_0x17e04f);}(_0xfbcc,0xb2));var _0xcfbc=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xfbcc[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xcfbc('0x0'));var util=require(_0xcfbc('0x1'));var logger=require('../../config/logger')(_0xcfbc('0x2'));var moment=require('moment');var BPromise=require(_0xcfbc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfbc('0x4'));var rimraf=require(_0xcfbc('0x5'));var config=require(_0xcfbc('0x6'));var attributes=require(_0xcfbc('0x7'));var integrations=require(_0xcfbc('0x8'));module[_0xcfbc('0x9')]=function(_0x4d232e,_0x44afd2){return _0x4d232e[_0xcfbc('0xa')](_0xcfbc('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3146=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x42e825,_0x32eef9){var _0xde642b=function(_0x211be2){while(--_0x211be2){_0x42e825['push'](_0x42e825['shift']());}};_0xde642b(++_0x32eef9);}(_0x3146,0x19f));var _0x6314=function(_0xfab285,_0x14474){_0xfab285=_0xfab285-0x0;var _0x1a2ba7=_0x3146[_0xfab285];return _0x1a2ba7;};'use strict';var _=require(_0x6314('0x0'));var util=require(_0x6314('0x1'));var logger=require(_0x6314('0x2'))(_0x6314('0x3'));var moment=require(_0x6314('0x4'));var BPromise=require(_0x6314('0x5'));var rp=require(_0x6314('0x6'));var fs=require('fs');var path=require(_0x6314('0x7'));var rimraf=require(_0x6314('0x8'));var config=require(_0x6314('0x9'));var attributes=require(_0x6314('0xa'));var integrations=require(_0x6314('0xb'));module['exports']=function(_0x694c08,_0x611a09){return _0x694c08[_0x6314('0xc')](_0x6314('0xd'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 0ace5f4..5ef3156 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 _0x9983=['http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','FreshdeskAccount','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x116105,_0x57e394){var _0x47e252=function(_0x4fc5d4){while(--_0x4fc5d4){_0x116105['push'](_0x116105['shift']());}};_0x47e252(++_0x57e394);}(_0x9983,0x180));var _0x3998=function(_0x4443aa,_0x34f101){_0x4443aa=_0x4443aa-0x0;var _0x8d2d82=_0x9983[_0x4443aa];return _0x8d2d82;};'use strict';var _=require(_0x3998('0x0'));var util=require('util');var moment=require(_0x3998('0x1'));var BPromise=require(_0x3998('0x2'));var rs=require(_0x3998('0x3'));var fs=require('fs');var Redis=require(_0x3998('0x4'));var db=require(_0x3998('0x5'))['db'];var utils=require(_0x3998('0x6'));var logger=require(_0x3998('0x7'))(_0x3998('0x8'));var config=require(_0x3998('0x9'));var jayson=require(_0x3998('0xa'));var client=jayson[_0x3998('0xb')][_0x3998('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3134b3,_0x4267bd,_0x57066e){return new BPromise(function(_0x39238c,_0x3525eb){return client[_0x3998('0xd')](_0x3134b3,_0x57066e)[_0x3998('0xe')](function(_0x58c118){logger[_0x3998('0xf')](_0x3998('0x10'),_0x4267bd,_0x3998('0x11'));logger[_0x3998('0x12')](_0x3998('0x13'),_0x4267bd,_0x3998('0x11'),JSON[_0x3998('0x14')](_0x58c118));if(_0x58c118[_0x3998('0x15')]){if(_0x58c118['error']['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4267bd,_0x58c118[_0x3998('0x15')]['message']);return _0x3525eb(_0x58c118[_0x3998('0x15')][_0x3998('0x16')]);}logger[_0x3998('0x15')]('FreshdeskAccount,\x20%s,\x20%s',_0x4267bd,_0x58c118[_0x3998('0x15')]['message']);return _0x39238c(_0x58c118[_0x3998('0x15')]['message']);}else{logger[_0x3998('0xf')](_0x3998('0x10'),_0x4267bd,_0x3998('0x11'));_0x39238c(_0x58c118[_0x3998('0x17')]['message']);}})[_0x3998('0x18')](function(_0x1d88a6){logger['error'](_0x3998('0x10'),_0x4267bd,_0x1d88a6);_0x3525eb(_0x1d88a6);});});}exports['GetFreshdeskAccount']=function(_0x292106){var _0x3e4e4f=this;return new Promise(function(_0xf5f433,_0x5c4369){return db['FreshdeskAccount']['findAll']({'raw':_0x292106['options']?_0x292106[_0x3998('0x19')][_0x3998('0x1a')]===undefined?!![]:![]:!![],'where':_0x292106[_0x3998('0x19')]?_0x292106[_0x3998('0x19')][_0x3998('0x1b')]||null:null,'attributes':_0x292106[_0x3998('0x19')]?_0x292106[_0x3998('0x19')][_0x3998('0x1c')]||null:null,'limit':_0x292106['options']?_0x292106[_0x3998('0x19')][_0x3998('0x1d')]||null:null,'include':_0x292106[_0x3998('0x19')]?_0x292106[_0x3998('0x19')]['include']?_[_0x3998('0x1e')](_0x292106[_0x3998('0x19')][_0x3998('0x1f')],function(_0x37945a){return{'model':db[_0x37945a[_0x3998('0x20')]],'as':_0x37945a['as'],'attributes':_0x37945a[_0x3998('0x1c')],'include':_0x37945a[_0x3998('0x1f')]?_['map'](_0x37945a['include'],function(_0x434316){return{'model':db[_0x434316[_0x3998('0x20')]],'as':_0x434316['as'],'attributes':_0x434316[_0x3998('0x1c')],'include':_0x434316[_0x3998('0x1f')]?_['map'](_0x434316[_0x3998('0x1f')],function(_0x5dc7e3){return{'model':db[_0x5dc7e3[_0x3998('0x20')]],'as':_0x5dc7e3['as'],'attributes':_0x5dc7e3[_0x3998('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3998('0xe')](function(_0x5486f3){logger[_0x3998('0xf')](_0x3998('0x21'),_0x292106);logger['debug'](_0x3998('0x21'),_0x292106,JSON[_0x3998('0x14')](_0x5486f3));_0xf5f433(_0x5486f3);})[_0x3998('0x18')](function(_0x4e1462){logger[_0x3998('0x15')](_0x3998('0x21'),_0x4e1462[_0x3998('0x16')],_0x292106);_0x5c4369(_0x3e4e4f[_0x3998('0x15')](0x1f4,_0x4e1462[_0x3998('0x16')]));});});};exports['ShowFreshdeskAccount']=function(_0x255722){var _0x47c8b6=this;return new Promise(function(_0x15f2da,_0x4032d4){return db[_0x3998('0x22')]['find']({'raw':_0x255722[_0x3998('0x19')]?_0x255722[_0x3998('0x19')][_0x3998('0x1a')]===undefined?!![]:![]:!![],'where':_0x255722[_0x3998('0x19')]?_0x255722[_0x3998('0x19')][_0x3998('0x1b')]||null:null,'attributes':_0x255722['options']?_0x255722[_0x3998('0x19')][_0x3998('0x1c')]||null:null,'include':_0x255722[_0x3998('0x19')]?_0x255722[_0x3998('0x19')]['include']?_[_0x3998('0x1e')](_0x255722['options'][_0x3998('0x1f')],function(_0x1e5742){return{'model':db[_0x1e5742['model']],'as':_0x1e5742['as'],'attributes':_0x1e5742[_0x3998('0x1c')],'include':_0x1e5742[_0x3998('0x1f')]?_[_0x3998('0x1e')](_0x1e5742[_0x3998('0x1f')],function(_0x48922d){return{'model':db[_0x48922d['model']],'as':_0x48922d['as'],'attributes':_0x48922d[_0x3998('0x1c')],'include':_0x48922d['include']?_[_0x3998('0x1e')](_0x48922d[_0x3998('0x1f')],function(_0x5aabf1){return{'model':db[_0x5aabf1[_0x3998('0x20')]],'as':_0x5aabf1['as'],'attributes':_0x5aabf1[_0x3998('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3998('0xe')](function(_0x3317b6){logger[_0x3998('0xf')]('ShowFreshdeskAccount',_0x255722);logger[_0x3998('0x12')](_0x3998('0x23'),_0x255722,JSON['stringify'](_0x3317b6));_0x15f2da(_0x3317b6);})[_0x3998('0x18')](function(_0x3774c6){logger[_0x3998('0x15')]('ShowFreshdeskAccount',_0x3774c6[_0x3998('0x16')],_0x255722);_0x4032d4(_0x47c8b6['error'](0x1f4,_0x3774c6[_0x3998('0x16')]));});});}; \ No newline at end of file +var _0x0908=['then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','options','where','attributes','map','include','model','ShowFreshdeskAccount','FreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x19f727,_0x28224e){var _0x412836=function(_0x40634f){while(--_0x40634f){_0x19f727['push'](_0x19f727['shift']());}};_0x412836(++_0x28224e);}(_0x0908,0x146));var _0x8090=function(_0x30f8f2,_0x1f73c1){_0x30f8f2=_0x30f8f2-0x0;var _0x148016=_0x0908[_0x30f8f2];return _0x148016;};'use strict';var _=require(_0x8090('0x0'));var util=require(_0x8090('0x1'));var moment=require(_0x8090('0x2'));var BPromise=require(_0x8090('0x3'));var rs=require(_0x8090('0x4'));var fs=require('fs');var Redis=require(_0x8090('0x5'));var db=require(_0x8090('0x6'))['db'];var utils=require(_0x8090('0x7'));var logger=require(_0x8090('0x8'))(_0x8090('0x9'));var config=require(_0x8090('0xa'));var jayson=require(_0x8090('0xb'));var client=jayson[_0x8090('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4de08b,_0x2e261f,_0x45ed50){return new BPromise(function(_0x1b2463,_0x5380db){return client[_0x8090('0xd')](_0x4de08b,_0x45ed50)[_0x8090('0xe')](function(_0xc8bf60){logger[_0x8090('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x2e261f,_0x8090('0x10'));logger[_0x8090('0x11')](_0x8090('0x12'),_0x2e261f,_0x8090('0x10'),JSON[_0x8090('0x13')](_0xc8bf60));if(_0xc8bf60[_0x8090('0x14')]){if(_0xc8bf60['error'][_0x8090('0x15')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2e261f,_0xc8bf60[_0x8090('0x14')]['message']);return _0x5380db(_0xc8bf60[_0x8090('0x14')]['message']);}logger['error'](_0x8090('0x16'),_0x2e261f,_0xc8bf60[_0x8090('0x14')][_0x8090('0x17')]);return _0x1b2463(_0xc8bf60[_0x8090('0x14')]['message']);}else{logger[_0x8090('0xf')](_0x8090('0x16'),_0x2e261f,'request\x20sent');_0x1b2463(_0xc8bf60[_0x8090('0x18')][_0x8090('0x17')]);}})[_0x8090('0x19')](function(_0x3b3562){logger[_0x8090('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x2e261f,_0x3b3562);_0x5380db(_0x3b3562);});});}exports['GetFreshdeskAccount']=function(_0x57a5b2){var _0x371f0f=this;return new Promise(function(_0x31fde9,_0x285702){return db['FreshdeskAccount']['findAll']({'raw':_0x57a5b2['options']?_0x57a5b2[_0x8090('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x57a5b2['options']?_0x57a5b2[_0x8090('0x1a')][_0x8090('0x1b')]||null:null,'attributes':_0x57a5b2['options']?_0x57a5b2[_0x8090('0x1a')][_0x8090('0x1c')]||null:null,'limit':_0x57a5b2[_0x8090('0x1a')]?_0x57a5b2[_0x8090('0x1a')]['limit']||null:null,'include':_0x57a5b2['options']?_0x57a5b2['options']['include']?_[_0x8090('0x1d')](_0x57a5b2['options'][_0x8090('0x1e')],function(_0x191644){return{'model':db[_0x191644['model']],'as':_0x191644['as'],'attributes':_0x191644[_0x8090('0x1c')],'include':_0x191644[_0x8090('0x1e')]?_[_0x8090('0x1d')](_0x191644[_0x8090('0x1e')],function(_0x3932e4){return{'model':db[_0x3932e4[_0x8090('0x1f')]],'as':_0x3932e4['as'],'attributes':_0x3932e4[_0x8090('0x1c')],'include':_0x3932e4[_0x8090('0x1e')]?_[_0x8090('0x1d')](_0x3932e4['include'],function(_0x333c7a){return{'model':db[_0x333c7a['model']],'as':_0x333c7a['as'],'attributes':_0x333c7a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8090('0xe')](function(_0x28790f){logger[_0x8090('0xf')]('GetFreshdeskAccount',_0x57a5b2);logger[_0x8090('0x11')]('GetFreshdeskAccount',_0x57a5b2,JSON[_0x8090('0x13')](_0x28790f));_0x31fde9(_0x28790f);})['catch'](function(_0x550ff2){logger[_0x8090('0x14')]('GetFreshdeskAccount',_0x550ff2[_0x8090('0x17')],_0x57a5b2);_0x285702(_0x371f0f['error'](0x1f4,_0x550ff2[_0x8090('0x17')]));});});};exports[_0x8090('0x20')]=function(_0x372f29){var _0x3e65cf=this;return new Promise(function(_0x22cf8e,_0x4ac4af){return db[_0x8090('0x21')]['find']({'raw':_0x372f29['options']?_0x372f29['options']['raw']===undefined?!![]:![]:!![],'where':_0x372f29['options']?_0x372f29[_0x8090('0x1a')][_0x8090('0x1b')]||null:null,'attributes':_0x372f29[_0x8090('0x1a')]?_0x372f29[_0x8090('0x1a')][_0x8090('0x1c')]||null:null,'include':_0x372f29['options']?_0x372f29['options'][_0x8090('0x1e')]?_[_0x8090('0x1d')](_0x372f29['options'][_0x8090('0x1e')],function(_0x10fb2a){return{'model':db[_0x10fb2a[_0x8090('0x1f')]],'as':_0x10fb2a['as'],'attributes':_0x10fb2a[_0x8090('0x1c')],'include':_0x10fb2a[_0x8090('0x1e')]?_[_0x8090('0x1d')](_0x10fb2a[_0x8090('0x1e')],function(_0x49509e){return{'model':db[_0x49509e[_0x8090('0x1f')]],'as':_0x49509e['as'],'attributes':_0x49509e['attributes'],'include':_0x49509e[_0x8090('0x1e')]?_[_0x8090('0x1d')](_0x49509e[_0x8090('0x1e')],function(_0x103ffc){return{'model':db[_0x103ffc[_0x8090('0x1f')]],'as':_0x103ffc['as'],'attributes':_0x103ffc['attributes']};}):[]};}):[]};}):[]:[]})[_0x8090('0xe')](function(_0x431b03){logger['info'](_0x8090('0x20'),_0x372f29);logger['debug'](_0x8090('0x20'),_0x372f29,JSON[_0x8090('0x13')](_0x431b03));_0x22cf8e(_0x431b03);})[_0x8090('0x19')](function(_0x26256a){logger[_0x8090('0x14')](_0x8090('0x20'),_0x26256a['message'],_0x372f29);_0x4ac4af(_0x3e65cf[_0x8090('0x14')](0x1f4,_0x26256a[_0x8090('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index d65c0ae..de3d9a8 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 _0x9b49=['/:id/tags','getTags','post','create','update','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5b088e,_0x2bbd0f){var _0x40d0d9=function(_0x74770){while(--_0x74770){_0x5b088e['push'](_0x5b088e['shift']());}};_0x40d0d9(++_0x2bbd0f);}(_0x9b49,0x1e6));var _0x99b4=function(_0x5f2098,_0x47308b){_0x5f2098=_0x5f2098-0x0;var _0x18af32=_0x9b49[_0x5f2098];return _0x18af32;};'use strict';var multer=require(_0x99b4('0x0'));var util=require(_0x99b4('0x1'));var path=require(_0x99b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x99b4('0x3'));var router=express[_0x99b4('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x99b4('0x5'));var config=require(_0x99b4('0x6'));var controller=require(_0x99b4('0x7'));router['get']('/',auth[_0x99b4('0x8')](),controller[_0x99b4('0x9')]);router[_0x99b4('0xa')](_0x99b4('0xb'),auth['isAuthenticated'](),controller[_0x99b4('0xc')]);router['get'](_0x99b4('0xd'),auth[_0x99b4('0x8')](),controller['getFields']);router['get'](_0x99b4('0xe'),auth[_0x99b4('0x8')](),controller[_0x99b4('0xf')]);router[_0x99b4('0xa')](_0x99b4('0x10'),auth[_0x99b4('0x8')](),controller[_0x99b4('0x11')]);router[_0x99b4('0xa')](_0x99b4('0x12'),auth[_0x99b4('0x8')](),controller[_0x99b4('0x13')]);router[_0x99b4('0x14')]('/',auth[_0x99b4('0x8')](),controller[_0x99b4('0x15')]);router['post'](_0x99b4('0x12'),auth[_0x99b4('0x8')](),controller['setTags']);router['put'](_0x99b4('0xb'),auth['isAuthenticated'](),controller[_0x99b4('0x16')]);router['delete']('/:id',auth[_0x99b4('0x8')](),controller['destroy']);module[_0x99b4('0x17')]=router; \ No newline at end of file +var _0xe037=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','create','setTags','put','destroy','multer','util','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show'];(function(_0x274eda,_0x2cffc3){var _0x27f71b=function(_0x5ddddc){while(--_0x5ddddc){_0x274eda['push'](_0x274eda['shift']());}};_0x27f71b(++_0x2cffc3);}(_0xe037,0x1ab));var _0x7e03=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0xe037[_0x2aa48b];return _0x48caf8;};'use strict';var multer=require(_0x7e03('0x0'));var util=require(_0x7e03('0x1'));var path=require('path');var timeout=require(_0x7e03('0x2'));var express=require('express');var router=express[_0x7e03('0x3')]();var auth=require(_0x7e03('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x7e03('0x5')]('/',auth[_0x7e03('0x6')](),controller[_0x7e03('0x7')]);router['get'](_0x7e03('0x8'),auth[_0x7e03('0x6')](),controller[_0x7e03('0x9')]);router[_0x7e03('0x5')](_0x7e03('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x7e03('0x5')](_0x7e03('0xb'),auth[_0x7e03('0x6')](),controller[_0x7e03('0xc')]);router[_0x7e03('0x5')](_0x7e03('0xd'),auth[_0x7e03('0x6')](),controller['getDescriptions']);router['get'](_0x7e03('0xe'),auth[_0x7e03('0x6')](),controller['getTags']);router['post']('/',auth[_0x7e03('0x6')](),controller[_0x7e03('0xf')]);router['post'](_0x7e03('0xe'),auth[_0x7e03('0x6')](),controller[_0x7e03('0x10')]);router[_0x7e03('0x11')](_0x7e03('0x8'),auth[_0x7e03('0x6')](),controller['update']);router['delete'](_0x7e03('0x8'),auth['isAuthenticated'](),controller[_0x7e03('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 90462bf..a74f119 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 _0x1206=['sequelize','exports','STRING'];(function(_0x16a37b,_0x25f395){var _0x975d43=function(_0x3e680a){while(--_0x3e680a){_0x16a37b['push'](_0x16a37b['shift']());}};_0x975d43(++_0x25f395);}(_0x1206,0x180));var _0x6120=function(_0x306402,_0x513d78){_0x306402=_0x306402-0x0;var _0x575ad7=_0x1206[_0x306402];return _0x575ad7;};'use strict';var Sequelize=require(_0x6120('0x0'));module[_0x6120('0x1')]={'name':{'type':Sequelize[_0x6120('0x2')]},'description':{'type':Sequelize[_0x6120('0x2')]}}; \ No newline at end of file +var _0x737a=['sequelize','exports','STRING'];(function(_0x37485b,_0x33ed0d){var _0x3f141c=function(_0x4e4f53){while(--_0x4e4f53){_0x37485b['push'](_0x37485b['shift']());}};_0x3f141c(++_0x33ed0d);}(_0x737a,0x78));var _0xa737=function(_0x6ebfe9,_0x4e7fd6){_0x6ebfe9=_0x6ebfe9-0x0;var _0x1d0829=_0x737a[_0x6ebfe9];return _0x1d0829;};'use strict';var Sequelize=require(_0xa737('0x0'));module[_0xa737('0x1')]={'name':{'type':Sequelize[_0xa737('0x2')]},'description':{'type':Sequelize[_0xa737('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 3057f77..ea3447c 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 _0xaa19=['nolimit','limit','sort','filters','pick','filter','where','merge','options','include','findAll','rows','show','length','includeAll','create','body','find','params','getFields','FreshdeskField','order','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','update','destroy','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x223337,_0x38e39f){var _0x1386d5=function(_0x551a3e){while(--_0x551a3e){_0x223337['push'](_0x223337['shift']());}};_0x1386d5(++_0x38e39f);}(_0xaa19,0x79));var _0x9aa1=function(_0x2c822e,_0x1fd697){_0x2c822e=_0x2c822e-0x0;var _0x5115f2=_0xaa19[_0x2c822e];return _0x5115f2;};'use strict';var pdf=require(_0x9aa1('0x0'));var emlformat=require(_0x9aa1('0x1'));var rimraf=require(_0x9aa1('0x2'));var zipdir=require(_0x9aa1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9aa1('0x4'));var moment=require('moment');var BPromise=require(_0x9aa1('0x5'));var Mustache=require('mustache');var util=require(_0x9aa1('0x6'));var path=require(_0x9aa1('0x7'));var sox=require(_0x9aa1('0x8'));var csv=require('to-csv');var ejs=require(_0x9aa1('0x9'));var fs=require('fs');var _=require(_0x9aa1('0xa'));var squel=require(_0x9aa1('0xb'));var crypto=require('crypto');var jsforce=require(_0x9aa1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9aa1('0xd'));var Papa=require(_0x9aa1('0xe'));var Redis=require(_0x9aa1('0xf'));var authService=require(_0x9aa1('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9aa1('0x11'));var logger=require('../../config/logger')(_0x9aa1('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x9aa1('0x13'));var client=jayson[_0x9aa1('0x14')]['http']({'port':0x232a});function checkPasswordPattern(_0x38dd8e,_0x31fe04,_0x2d5d74){if(_0x2d5d74){var _0x48eba0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x48eba0['test'](_0x31fe04)){return _0x38dd8e;}else{throw new db[(_0x9aa1('0x15'))]['ValidationError'](_0x9aa1('0x16'));}}else{return _0x38dd8e;}}function respondWithRpcPromise(_0x5005a4,_0x1abab9,_0x137a79,_0x1ade95){return new BPromise(function(_0x345e78,_0x591a7e){var _0x5c8c92=_0x1ade95||client;return _0x5c8c92[_0x9aa1('0x17')](_0x5005a4,_0x137a79)[_0x9aa1('0x18')](function(_0x30b187){logger[_0x9aa1('0x19')](_0x9aa1('0x1a'),_0x1abab9,_0x9aa1('0x1b'));logger[_0x9aa1('0x1c')](_0x9aa1('0x1d'),_0x1abab9,_0x9aa1('0x1b'),JSON[_0x9aa1('0x1e')](_0x30b187));if(_0x30b187[_0x9aa1('0x1f')]){if(_0x30b187['error']['code']===0x1f4){logger['error'](_0x9aa1('0x1a'),_0x1abab9,_0x30b187[_0x9aa1('0x1f')]['message']);return _0x591a7e(_0x30b187[_0x9aa1('0x1f')][_0x9aa1('0x20')]);}logger[_0x9aa1('0x1f')](_0x9aa1('0x1a'),_0x1abab9,_0x30b187['error']['message']);return _0x345e78(_0x30b187['error'][_0x9aa1('0x20')]);}else{logger['info'](_0x9aa1('0x1a'),_0x1abab9,_0x9aa1('0x1b'));_0x345e78(_0x30b187[_0x9aa1('0x21')]['message']);}})[_0x9aa1('0x22')](function(_0x174812){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1abab9,_0x174812);_0x591a7e(_0x174812);});});}function respondWithStatusCode(_0x1ccdc9,_0x3d810e){_0x3d810e=_0x3d810e||0xcc;return function(_0x53b291){if(_0x53b291){return _0x1ccdc9[_0x9aa1('0x23')](_0x3d810e);}return _0x1ccdc9[_0x9aa1('0x24')](_0x3d810e)[_0x9aa1('0x25')]();};}function respondWithResult(_0x51c105,_0x52c1f1){_0x52c1f1=_0x52c1f1||0xc8;return function(_0x569fed){if(_0x569fed){return _0x51c105[_0x9aa1('0x24')](_0x52c1f1)['json'](_0x569fed);}};}function respondWithFilteredResult(_0x20f9ff,_0x5c52b2){return function(_0x115bb8){if(_0x115bb8){var _0x23d7cb=_0x115bb8[_0x9aa1('0x26')],_0x5e65ea=_0x5c52b2[_0x9aa1('0x27')],_0x482ce0=_0x5c52b2['offset']+_0x5c52b2['limit'],_0x479644;if(_0x482ce0>=_0x23d7cb){_0x482ce0=_0x23d7cb;_0x479644=0xc8;}else{_0x479644=0xce;}_0x20f9ff[_0x9aa1('0x24')](_0x479644);return _0x20f9ff[_0x9aa1('0x28')](_0x9aa1('0x29'),_0x5e65ea+'-'+_0x482ce0+'/'+_0x23d7cb)[_0x9aa1('0x2a')](_0x115bb8);}return null;};}function patchUpdates(_0x125c41){return function(_0x345962){try{jsonpatch[_0x9aa1('0x2b')](_0x345962,_0x125c41,!![]);}catch(_0x122b73){return BPromise['reject'](_0x122b73);}return _0x345962[_0x9aa1('0x2c')]();};}function saveUpdates(_0xc29f58,_0x3f7038){return function(_0x4c563d){if(_0x4c563d){return _0x4c563d[_0x9aa1('0x2d')](_0xc29f58)['then'](function(_0x860c34){return _0x860c34;});}return null;};}function removeEntity(_0xdd941b,_0xf757ac){return function(_0xd1529f){if(_0xd1529f){return _0xd1529f[_0x9aa1('0x2e')]()[_0x9aa1('0x18')](function(){_0xdd941b['status'](0xcc)[_0x9aa1('0x25')]();});}};}function handleEntityNotFound(_0x61659b,_0x49bedd){return function(_0x937598){if(!_0x937598){_0x61659b[_0x9aa1('0x23')](0x194);}return _0x937598;};}function handleError(_0xe732c9,_0x1f60da){_0x1f60da=_0x1f60da||0x1f4;return function(_0x357207){logger[_0x9aa1('0x1f')](_0x357207[_0x9aa1('0x2f')]);if(_0x357207['name']){delete _0x357207[_0x9aa1('0x30')];}_0xe732c9[_0x9aa1('0x24')](_0x1f60da)['send'](_0x357207);};}exports[_0x9aa1('0x31')]=function(_0x352952,_0x249630){var _0x5e3164={},_0x304654={},_0x488f9c={'count':0x0,'rows':[]};var _0x54200f=_[_0x9aa1('0x32')](db[_0x9aa1('0x33')][_0x9aa1('0x34')],function(_0x2e7b69){return{'name':_0x2e7b69[_0x9aa1('0x35')],'type':_0x2e7b69[_0x9aa1('0x36')][_0x9aa1('0x37')]};});_0x304654[_0x9aa1('0x38')]=_['map'](_0x54200f,_0x9aa1('0x30'));_0x304654[_0x9aa1('0x39')]=_[_0x9aa1('0x3a')](_0x352952[_0x9aa1('0x39')]);_0x304654['filters']=_[_0x9aa1('0x3b')](_0x304654[_0x9aa1('0x38')],_0x304654[_0x9aa1('0x39')]);_0x5e3164[_0x9aa1('0x3c')]=_['intersection'](_0x304654[_0x9aa1('0x38')],qs[_0x9aa1('0x3d')](_0x352952[_0x9aa1('0x39')][_0x9aa1('0x3d')]));_0x5e3164[_0x9aa1('0x3c')]=_0x5e3164['attributes']['length']?_0x5e3164[_0x9aa1('0x3c')]:_0x304654[_0x9aa1('0x38')];if(!_0x352952['query'][_0x9aa1('0x3e')](_0x9aa1('0x3f'))){_0x5e3164['limit']=qs[_0x9aa1('0x40')](_0x352952[_0x9aa1('0x39')][_0x9aa1('0x40')]);_0x5e3164[_0x9aa1('0x27')]=qs['offset'](_0x352952[_0x9aa1('0x39')][_0x9aa1('0x27')]);}_0x5e3164['order']=qs['sort'](_0x352952['query'][_0x9aa1('0x41')]);_0x5e3164['where']=qs[_0x9aa1('0x42')](_[_0x9aa1('0x43')](_0x352952[_0x9aa1('0x39')],_0x304654['filters']),_0x54200f);if(_0x352952[_0x9aa1('0x39')][_0x9aa1('0x44')]){_0x5e3164[_0x9aa1('0x45')]=_['merge'](_0x5e3164[_0x9aa1('0x45')],{'$or':_['map'](_0x54200f,function(_0x145b77){if(_0x145b77[_0x9aa1('0x36')]!=='VIRTUAL'){var _0x19274f={};_0x19274f[_0x145b77['name']]={'$like':'%'+_0x352952[_0x9aa1('0x39')][_0x9aa1('0x44')]+'%'};return _0x19274f;}})});}_0x5e3164=_[_0x9aa1('0x46')]({},_0x5e3164,_0x352952[_0x9aa1('0x47')]);var _0x1ced75={'where':_0x5e3164[_0x9aa1('0x45')]};return db[_0x9aa1('0x33')]['count'](_0x1ced75)[_0x9aa1('0x18')](function(_0xc5ec97){_0x488f9c['count']=_0xc5ec97;if(_0x352952[_0x9aa1('0x39')]['includeAll']){_0x5e3164[_0x9aa1('0x48')]=[{'all':!![]}];}return db[_0x9aa1('0x33')][_0x9aa1('0x49')](_0x5e3164);})[_0x9aa1('0x18')](function(_0x2be7b7){_0x488f9c[_0x9aa1('0x4a')]=_0x2be7b7;return _0x488f9c;})[_0x9aa1('0x18')](respondWithFilteredResult(_0x249630,_0x5e3164))[_0x9aa1('0x22')](handleError(_0x249630,null));};exports[_0x9aa1('0x4b')]=function(_0x140ab8,_0x17cf7b){var _0x41ae77={'raw':![],'where':{'id':_0x140ab8['params']['id']}},_0x475413={};_0x475413[_0x9aa1('0x38')]=_[_0x9aa1('0x3a')](db[_0x9aa1('0x33')]['rawAttributes']);_0x475413[_0x9aa1('0x39')]=_[_0x9aa1('0x3a')](_0x140ab8[_0x9aa1('0x39')]);_0x475413[_0x9aa1('0x42')]=_[_0x9aa1('0x3b')](_0x475413[_0x9aa1('0x38')],_0x475413[_0x9aa1('0x39')]);_0x41ae77['attributes']=_[_0x9aa1('0x3b')](_0x475413[_0x9aa1('0x38')],qs[_0x9aa1('0x3d')](_0x140ab8[_0x9aa1('0x39')]['fields']));_0x41ae77[_0x9aa1('0x3c')]=_0x41ae77[_0x9aa1('0x3c')][_0x9aa1('0x4c')]?_0x41ae77['attributes']:_0x475413[_0x9aa1('0x38')];if(_0x140ab8[_0x9aa1('0x39')][_0x9aa1('0x4d')]){_0x41ae77['include']=[{'all':!![]}];}_0x41ae77=_[_0x9aa1('0x46')]({},_0x41ae77,_0x140ab8[_0x9aa1('0x47')]);return db['FreshdeskConfiguration']['find'](_0x41ae77)[_0x9aa1('0x18')](handleEntityNotFound(_0x17cf7b,null))[_0x9aa1('0x18')](respondWithResult(_0x17cf7b,null))['catch'](handleError(_0x17cf7b,null));};exports[_0x9aa1('0x4e')]=function(_0x31a0c1,_0x2bfec2){return db['FreshdeskConfiguration']['create'](_0x31a0c1['body'],{})[_0x9aa1('0x18')](respondWithResult(_0x2bfec2,0xc9))[_0x9aa1('0x22')](handleError(_0x2bfec2,null));};exports[_0x9aa1('0x2d')]=function(_0x22658f,_0x216237){if(_0x22658f[_0x9aa1('0x4f')]['id']){delete _0x22658f[_0x9aa1('0x4f')]['id'];}return db[_0x9aa1('0x33')][_0x9aa1('0x50')]({'where':{'id':_0x22658f[_0x9aa1('0x51')]['id']}})[_0x9aa1('0x18')](handleEntityNotFound(_0x216237,null))[_0x9aa1('0x18')](saveUpdates(_0x22658f[_0x9aa1('0x4f')],null))[_0x9aa1('0x18')](respondWithResult(_0x216237,null))['catch'](handleError(_0x216237,null));};exports[_0x9aa1('0x2e')]=function(_0x403c6f,_0x494048){return db[_0x9aa1('0x33')]['find']({'where':{'id':_0x403c6f['params']['id']}})[_0x9aa1('0x18')](handleEntityNotFound(_0x494048,null))['then'](removeEntity(_0x494048,null))[_0x9aa1('0x22')](handleError(_0x494048,null));};exports[_0x9aa1('0x52')]=function(_0x2ca2d6,_0x1b52e3,_0x55d0c6){var _0x23404b={};var _0x2879ea={};var _0x2b7a72;var _0x1879da;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2ca2d6[_0x9aa1('0x51')]['id']}})[_0x9aa1('0x18')](handleEntityNotFound(_0x1b52e3,null))['then'](function(_0x5f883a){if(_0x5f883a){_0x2b7a72=_0x5f883a;_0x2879ea[_0x9aa1('0x38')]=_[_0x9aa1('0x3a')](db[_0x9aa1('0x53')][_0x9aa1('0x34')]);_0x2879ea['query']=_[_0x9aa1('0x3a')](_0x2ca2d6['query']);_0x2879ea[_0x9aa1('0x42')]=_[_0x9aa1('0x3b')](_0x2879ea[_0x9aa1('0x38')],_0x2879ea[_0x9aa1('0x39')]);_0x23404b[_0x9aa1('0x3c')]=_[_0x9aa1('0x3b')](_0x2879ea[_0x9aa1('0x38')],qs[_0x9aa1('0x3d')](_0x2ca2d6[_0x9aa1('0x39')][_0x9aa1('0x3d')]));_0x23404b[_0x9aa1('0x3c')]=_0x23404b[_0x9aa1('0x3c')][_0x9aa1('0x4c')]?_0x23404b[_0x9aa1('0x3c')]:_0x2879ea[_0x9aa1('0x38')];_0x23404b[_0x9aa1('0x54')]=qs['sort'](_0x2ca2d6[_0x9aa1('0x39')][_0x9aa1('0x41')]);_0x23404b[_0x9aa1('0x45')]=qs[_0x9aa1('0x42')](_['pick'](_0x2ca2d6[_0x9aa1('0x39')],_0x2879ea[_0x9aa1('0x42')]));if(_0x2ca2d6[_0x9aa1('0x39')][_0x9aa1('0x44')]){_0x23404b[_0x9aa1('0x45')]=_[_0x9aa1('0x46')](_0x23404b[_0x9aa1('0x45')],{'$or':_[_0x9aa1('0x32')](_0x23404b[_0x9aa1('0x3c')],function(_0x16a7da){var _0x1f6875={};_0x1f6875[_0x16a7da]={'$like':'%'+_0x2ca2d6['query'][_0x9aa1('0x44')]+'%'};return _0x1f6875;})});}_0x23404b=_[_0x9aa1('0x46')]({},_0x23404b,_0x2ca2d6['options']);return _0x2b7a72[_0x9aa1('0x52')](_0x23404b);}})[_0x9aa1('0x18')](function(_0x406a37){if(_0x406a37){_0x1879da=_0x406a37[_0x9aa1('0x4c')];if(!_0x2ca2d6[_0x9aa1('0x39')]['hasOwnProperty'](_0x9aa1('0x3f'))){_0x23404b['limit']=qs[_0x9aa1('0x40')](_0x2ca2d6[_0x9aa1('0x39')][_0x9aa1('0x40')]);_0x23404b[_0x9aa1('0x27')]=qs[_0x9aa1('0x27')](_0x2ca2d6['query'][_0x9aa1('0x27')]);}return _0x2b7a72[_0x9aa1('0x52')](_0x23404b);}})[_0x9aa1('0x18')](function(_0x3e445e){if(_0x3e445e){return _0x3e445e?{'count':_0x1879da,'rows':_0x3e445e}:null;}})[_0x9aa1('0x18')](respondWithResult(_0x1b52e3,null))[_0x9aa1('0x22')](handleError(_0x1b52e3,null));};exports[_0x9aa1('0x55')]=function(_0x51183f,_0x1536f4,_0x2d2dab){var _0x4decf5={};var _0x467141={};var _0x3ae265;var _0x1fb62f;return db[_0x9aa1('0x33')][_0x9aa1('0x56')]({'where':{'id':_0x51183f[_0x9aa1('0x51')]['id']}})[_0x9aa1('0x18')](handleEntityNotFound(_0x1536f4,null))[_0x9aa1('0x18')](function(_0x5484c7){if(_0x5484c7){_0x3ae265=_0x5484c7;_0x467141[_0x9aa1('0x38')]=_[_0x9aa1('0x3a')](db['FreshdeskField'][_0x9aa1('0x34')]);_0x467141['query']=_[_0x9aa1('0x3a')](_0x51183f[_0x9aa1('0x39')]);_0x467141['filters']=_[_0x9aa1('0x3b')](_0x467141[_0x9aa1('0x38')],_0x467141['query']);_0x4decf5[_0x9aa1('0x3c')]=_[_0x9aa1('0x3b')](_0x467141[_0x9aa1('0x38')],qs[_0x9aa1('0x3d')](_0x51183f[_0x9aa1('0x39')][_0x9aa1('0x3d')]));_0x4decf5['attributes']=_0x4decf5[_0x9aa1('0x3c')][_0x9aa1('0x4c')]?_0x4decf5[_0x9aa1('0x3c')]:_0x467141[_0x9aa1('0x38')];_0x4decf5[_0x9aa1('0x54')]=qs[_0x9aa1('0x41')](_0x51183f[_0x9aa1('0x39')][_0x9aa1('0x41')]);_0x4decf5['where']=qs[_0x9aa1('0x42')](_['pick'](_0x51183f[_0x9aa1('0x39')],_0x467141[_0x9aa1('0x42')]));if(_0x51183f[_0x9aa1('0x39')][_0x9aa1('0x44')]){_0x4decf5[_0x9aa1('0x45')]=_[_0x9aa1('0x46')](_0x4decf5['where'],{'$or':_[_0x9aa1('0x32')](_0x4decf5[_0x9aa1('0x3c')],function(_0x210019){var _0x4bf6d9={};_0x4bf6d9[_0x210019]={'$like':'%'+_0x51183f[_0x9aa1('0x39')]['filter']+'%'};return _0x4bf6d9;})});}_0x4decf5=_['merge']({},_0x4decf5,_0x51183f[_0x9aa1('0x47')]);return _0x3ae265[_0x9aa1('0x55')](_0x4decf5);}})[_0x9aa1('0x18')](function(_0x3699d7){if(_0x3699d7){_0x1fb62f=_0x3699d7['length'];if(!_0x51183f['query'][_0x9aa1('0x3e')]('nolimit')){_0x4decf5[_0x9aa1('0x40')]=qs[_0x9aa1('0x40')](_0x51183f[_0x9aa1('0x39')][_0x9aa1('0x40')]);_0x4decf5['offset']=qs['offset'](_0x51183f[_0x9aa1('0x39')]['offset']);}return _0x3ae265[_0x9aa1('0x55')](_0x4decf5);}})['then'](function(_0x5585f9){if(_0x5585f9){return _0x5585f9?{'count':_0x1fb62f,'rows':_0x5585f9}:null;}})[_0x9aa1('0x18')](respondWithResult(_0x1536f4,null))['catch'](handleError(_0x1536f4,null));};exports[_0x9aa1('0x57')]=function(_0x1a5837,_0x111118,_0x11548c){var _0xd03c9c={};var _0x2ead75={};var _0x3a947a;var _0x230489;return db[_0x9aa1('0x33')][_0x9aa1('0x56')]({'where':{'id':_0x1a5837[_0x9aa1('0x51')]['id']}})[_0x9aa1('0x18')](handleEntityNotFound(_0x111118,null))[_0x9aa1('0x18')](function(_0x2f0e1b){if(_0x2f0e1b){_0x3a947a=_0x2f0e1b;_0x2ead75[_0x9aa1('0x38')]=_[_0x9aa1('0x3a')](db['FreshdeskField'][_0x9aa1('0x34')]);_0x2ead75[_0x9aa1('0x39')]=_['keys'](_0x1a5837[_0x9aa1('0x39')]);_0x2ead75[_0x9aa1('0x42')]=_[_0x9aa1('0x3b')](_0x2ead75['model'],_0x2ead75[_0x9aa1('0x39')]);_0xd03c9c[_0x9aa1('0x3c')]=_['intersection'](_0x2ead75[_0x9aa1('0x38')],qs[_0x9aa1('0x3d')](_0x1a5837[_0x9aa1('0x39')][_0x9aa1('0x3d')]));_0xd03c9c['attributes']=_0xd03c9c[_0x9aa1('0x3c')]['length']?_0xd03c9c['attributes']:_0x2ead75[_0x9aa1('0x38')];_0xd03c9c['order']=qs[_0x9aa1('0x41')](_0x1a5837['query'][_0x9aa1('0x41')]);_0xd03c9c[_0x9aa1('0x45')]=qs[_0x9aa1('0x42')](_['pick'](_0x1a5837[_0x9aa1('0x39')],_0x2ead75['filters']));if(_0x1a5837[_0x9aa1('0x39')][_0x9aa1('0x44')]){_0xd03c9c['where']=_[_0x9aa1('0x46')](_0xd03c9c[_0x9aa1('0x45')],{'$or':_[_0x9aa1('0x32')](_0xd03c9c[_0x9aa1('0x3c')],function(_0x5d5394){var _0x44145f={};_0x44145f[_0x5d5394]={'$like':'%'+_0x1a5837[_0x9aa1('0x39')][_0x9aa1('0x44')]+'%'};return _0x44145f;})});}_0xd03c9c=_[_0x9aa1('0x46')]({},_0xd03c9c,_0x1a5837[_0x9aa1('0x47')]);return _0x3a947a[_0x9aa1('0x57')](_0xd03c9c);}})[_0x9aa1('0x18')](function(_0x1f8664){if(_0x1f8664){_0x230489=_0x1f8664['length'];if(!_0x1a5837['query'][_0x9aa1('0x3e')]('nolimit')){_0xd03c9c[_0x9aa1('0x40')]=qs[_0x9aa1('0x40')](_0x1a5837[_0x9aa1('0x39')][_0x9aa1('0x40')]);_0xd03c9c[_0x9aa1('0x27')]=qs['offset'](_0x1a5837[_0x9aa1('0x39')][_0x9aa1('0x27')]);}return _0x3a947a['getDescriptions'](_0xd03c9c);}})[_0x9aa1('0x18')](function(_0x1189be){if(_0x1189be){return _0x1189be?{'count':_0x230489,'rows':_0x1189be}:null;}})['then'](respondWithResult(_0x111118,null))[_0x9aa1('0x22')](handleError(_0x111118,null));};exports['getTags']=function(_0x374626,_0x591c7f,_0x3cc02c){var _0x2947a4={};var _0x2e8d9c={};var _0x37015e;var _0x1c5450;return db[_0x9aa1('0x33')][_0x9aa1('0x56')]({'where':{'id':_0x374626['params']['id']}})[_0x9aa1('0x18')](handleEntityNotFound(_0x591c7f,null))['then'](function(_0x3b3652){if(_0x3b3652){_0x37015e=_0x3b3652;_0x2e8d9c[_0x9aa1('0x38')]=_[_0x9aa1('0x3a')](db[_0x9aa1('0x58')][_0x9aa1('0x34')]);_0x2e8d9c['query']=_[_0x9aa1('0x3a')](_0x374626[_0x9aa1('0x39')]);_0x2e8d9c[_0x9aa1('0x42')]=_['intersection'](_0x2e8d9c[_0x9aa1('0x38')],_0x2e8d9c[_0x9aa1('0x39')]);_0x2947a4['attributes']=_[_0x9aa1('0x3b')](_0x2e8d9c[_0x9aa1('0x38')],qs[_0x9aa1('0x3d')](_0x374626[_0x9aa1('0x39')][_0x9aa1('0x3d')]));_0x2947a4[_0x9aa1('0x3c')]=_0x2947a4[_0x9aa1('0x3c')]['length']?_0x2947a4['attributes']:_0x2e8d9c[_0x9aa1('0x38')];_0x2947a4[_0x9aa1('0x54')]=qs['sort'](_0x374626[_0x9aa1('0x39')][_0x9aa1('0x41')]);_0x2947a4[_0x9aa1('0x45')]=qs['filters'](_[_0x9aa1('0x43')](_0x374626[_0x9aa1('0x39')],_0x2e8d9c[_0x9aa1('0x42')]));if(_0x374626[_0x9aa1('0x39')][_0x9aa1('0x44')]){_0x2947a4['where']=_['merge'](_0x2947a4[_0x9aa1('0x45')],{'$or':_[_0x9aa1('0x32')](_0x2947a4[_0x9aa1('0x3c')],function(_0x1bc64f){var _0x24997a={};_0x24997a[_0x1bc64f]={'$like':'%'+_0x374626[_0x9aa1('0x39')][_0x9aa1('0x44')]+'%'};return _0x24997a;})});}_0x2947a4=_['merge']({},_0x2947a4,_0x374626['options']);return _0x37015e['getTags'](_0x2947a4);}})[_0x9aa1('0x18')](function(_0x2e6163){if(_0x2e6163){_0x1c5450=_0x2e6163[_0x9aa1('0x4c')];if(!_0x374626[_0x9aa1('0x39')][_0x9aa1('0x3e')](_0x9aa1('0x3f'))){_0x2947a4['limit']=qs[_0x9aa1('0x40')](_0x374626[_0x9aa1('0x39')][_0x9aa1('0x40')]);_0x2947a4[_0x9aa1('0x27')]=qs['offset'](_0x374626[_0x9aa1('0x39')][_0x9aa1('0x27')]);}return _0x37015e[_0x9aa1('0x59')](_0x2947a4);}})[_0x9aa1('0x18')](function(_0xaea98){if(_0xaea98){return _0xaea98?{'count':_0x1c5450,'rows':_0xaea98}:null;}})[_0x9aa1('0x18')](respondWithResult(_0x591c7f,null))[_0x9aa1('0x22')](handleError(_0x591c7f,null));};exports[_0x9aa1('0x5a')]=function(_0x3d2df0,_0x828324,_0x4e0274){if(_0x3d2df0[_0x9aa1('0x4f')]['id']){delete _0x3d2df0['body']['id'];}return db[_0x9aa1('0x33')][_0x9aa1('0x56')]({'where':{'id':_0x3d2df0[_0x9aa1('0x51')]['id']}})['then'](handleEntityNotFound(_0x828324,null))[_0x9aa1('0x18')](function(_0x3ce59c){if(_0x3ce59c){return _0x3ce59c['setTags'](_0x3d2df0[_0x9aa1('0x4f')][_0x9aa1('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x828324,null))[_0x9aa1('0x22')](handleError(_0x828324,null));}; \ No newline at end of file +var _0x89b2=['FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','jayson/promise','http','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~!@#$%^&-_=+[{]}.','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskConfiguration','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','getFields','findOne'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0x89b2,0xc6));var _0x289b=function(_0x159424,_0x401a52){_0x159424=_0x159424-0x0;var _0x1eabe4=_0x89b2[_0x159424];return _0x1eabe4;};'use strict';var pdf=require(_0x289b('0x0'));var emlformat=require(_0x289b('0x1'));var rimraf=require(_0x289b('0x2'));var zipdir=require(_0x289b('0x3'));var jsonpatch=require(_0x289b('0x4'));var rp=require(_0x289b('0x5'));var moment=require(_0x289b('0x6'));var BPromise=require(_0x289b('0x7'));var Mustache=require(_0x289b('0x8'));var util=require(_0x289b('0x9'));var path=require(_0x289b('0xa'));var sox=require(_0x289b('0xb'));var csv=require('to-csv');var ejs=require(_0x289b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x289b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x289b('0xe'));var Papa=require(_0x289b('0xf'));var Redis=require(_0x289b('0x10'));var authService=require(_0x289b('0x11'));var qs=require(_0x289b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x289b('0x13'));var logger=require('../../config/logger')(_0x289b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x289b('0x15'))['db'];var jayson=require(_0x289b('0x16'));var client=jayson['client'][_0x289b('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4d2bca,_0x2a0933,_0x390c96){if(_0x390c96){var _0x9d7326=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9d7326[_0x289b('0x18')](_0x2a0933)){return _0x4d2bca;}else{throw new db[(_0x289b('0x19'))][(_0x289b('0x1a'))](_0x289b('0x1b'));}}else{return _0x4d2bca;}}function respondWithRpcPromise(_0x1a562b,_0x7d4247,_0x3c1489,_0x1a6807){return new BPromise(function(_0x345a5f,_0x405a2c){var _0x3a7c07=_0x1a6807||client;return _0x3a7c07['request'](_0x1a562b,_0x3c1489)[_0x289b('0x1c')](function(_0x1d36dd){logger[_0x289b('0x1d')](_0x289b('0x1e'),_0x7d4247,_0x289b('0x1f'));logger['debug'](_0x289b('0x20'),_0x7d4247,_0x289b('0x1f'),JSON['stringify'](_0x1d36dd));if(_0x1d36dd[_0x289b('0x21')]){if(_0x1d36dd[_0x289b('0x21')][_0x289b('0x22')]===0x1f4){logger[_0x289b('0x21')](_0x289b('0x1e'),_0x7d4247,_0x1d36dd[_0x289b('0x21')][_0x289b('0x23')]);return _0x405a2c(_0x1d36dd[_0x289b('0x21')][_0x289b('0x23')]);}logger[_0x289b('0x21')](_0x289b('0x1e'),_0x7d4247,_0x1d36dd[_0x289b('0x21')][_0x289b('0x23')]);return _0x345a5f(_0x1d36dd[_0x289b('0x21')]['message']);}else{logger[_0x289b('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x7d4247,'request\x20sent');_0x345a5f(_0x1d36dd[_0x289b('0x24')][_0x289b('0x23')]);}})[_0x289b('0x25')](function(_0x59e59a){logger[_0x289b('0x21')](_0x289b('0x1e'),_0x7d4247,_0x59e59a);_0x405a2c(_0x59e59a);});});}function respondWithStatusCode(_0x51c0c0,_0x115ae9){_0x115ae9=_0x115ae9||0xcc;return function(_0x1578c7){if(_0x1578c7){return _0x51c0c0['sendStatus'](_0x115ae9);}return _0x51c0c0['status'](_0x115ae9)[_0x289b('0x26')]();};}function respondWithResult(_0x1f9f8a,_0x1d8853){_0x1d8853=_0x1d8853||0xc8;return function(_0x368a17){if(_0x368a17){return _0x1f9f8a[_0x289b('0x27')](_0x1d8853)[_0x289b('0x28')](_0x368a17);}};}function respondWithFilteredResult(_0x2fdaeb,_0x7220e){return function(_0x10243c){if(_0x10243c){var _0x5958da=_0x10243c['count'],_0x7b8fd0=_0x7220e[_0x289b('0x29')],_0x4ceaec=_0x7220e[_0x289b('0x29')]+_0x7220e[_0x289b('0x2a')],_0x598002;if(_0x4ceaec>=_0x5958da){_0x4ceaec=_0x5958da;_0x598002=0xc8;}else{_0x598002=0xce;}_0x2fdaeb[_0x289b('0x27')](_0x598002);return _0x2fdaeb[_0x289b('0x2b')](_0x289b('0x2c'),_0x7b8fd0+'-'+_0x4ceaec+'/'+_0x5958da)[_0x289b('0x28')](_0x10243c);}return null;};}function patchUpdates(_0xca1604){return function(_0x213359){try{jsonpatch[_0x289b('0x2d')](_0x213359,_0xca1604,!![]);}catch(_0x5608af){return BPromise[_0x289b('0x2e')](_0x5608af);}return _0x213359[_0x289b('0x2f')]();};}function saveUpdates(_0x2a1ca9,_0x47fbc9){return function(_0x357c99){if(_0x357c99){return _0x357c99[_0x289b('0x30')](_0x2a1ca9)[_0x289b('0x1c')](function(_0x31606b){return _0x31606b;});}return null;};}function removeEntity(_0x4e7d64,_0x22b199){return function(_0x342fcf){if(_0x342fcf){return _0x342fcf[_0x289b('0x31')]()[_0x289b('0x1c')](function(){_0x4e7d64[_0x289b('0x27')](0xcc)[_0x289b('0x26')]();});}};}function handleEntityNotFound(_0x40add5,_0x173ec3){return function(_0x3c031e){if(!_0x3c031e){_0x40add5['sendStatus'](0x194);}return _0x3c031e;};}function handleError(_0x1dcd42,_0x1e7c0d){_0x1e7c0d=_0x1e7c0d||0x1f4;return function(_0x4ad05a){logger['error'](_0x4ad05a[_0x289b('0x32')]);if(_0x4ad05a[_0x289b('0x33')]){delete _0x4ad05a['name'];}_0x1dcd42[_0x289b('0x27')](_0x1e7c0d)[_0x289b('0x34')](_0x4ad05a);};}exports[_0x289b('0x35')]=function(_0x4bcc27,_0x50ff60){var _0x235e3f={},_0xcf9121={},_0x27c9bf={'count':0x0,'rows':[]};var _0x428d11=_[_0x289b('0x36')](db['FreshdeskConfiguration'][_0x289b('0x37')],function(_0x3a76e5){return{'name':_0x3a76e5[_0x289b('0x38')],'type':_0x3a76e5[_0x289b('0x39')][_0x289b('0x3a')]};});_0xcf9121[_0x289b('0x3b')]=_[_0x289b('0x36')](_0x428d11,'name');_0xcf9121['query']=_['keys'](_0x4bcc27[_0x289b('0x3c')]);_0xcf9121[_0x289b('0x3d')]=_[_0x289b('0x3e')](_0xcf9121[_0x289b('0x3b')],_0xcf9121[_0x289b('0x3c')]);_0x235e3f[_0x289b('0x3f')]=_[_0x289b('0x3e')](_0xcf9121['model'],qs['fields'](_0x4bcc27[_0x289b('0x3c')][_0x289b('0x40')]));_0x235e3f[_0x289b('0x3f')]=_0x235e3f[_0x289b('0x3f')][_0x289b('0x41')]?_0x235e3f[_0x289b('0x3f')]:_0xcf9121['model'];if(!_0x4bcc27[_0x289b('0x3c')][_0x289b('0x42')](_0x289b('0x43'))){_0x235e3f[_0x289b('0x2a')]=qs['limit'](_0x4bcc27[_0x289b('0x3c')]['limit']);_0x235e3f[_0x289b('0x29')]=qs[_0x289b('0x29')](_0x4bcc27['query'][_0x289b('0x29')]);}_0x235e3f[_0x289b('0x44')]=qs['sort'](_0x4bcc27[_0x289b('0x3c')][_0x289b('0x45')]);_0x235e3f[_0x289b('0x46')]=qs['filters'](_[_0x289b('0x47')](_0x4bcc27[_0x289b('0x3c')],_0xcf9121[_0x289b('0x3d')]),_0x428d11);if(_0x4bcc27[_0x289b('0x3c')]['filter']){_0x235e3f[_0x289b('0x46')]=_[_0x289b('0x48')](_0x235e3f['where'],{'$or':_[_0x289b('0x36')](_0x428d11,function(_0x5b530f){if(_0x5b530f[_0x289b('0x39')]!==_0x289b('0x49')){var _0x5ecd2b={};_0x5ecd2b[_0x5b530f[_0x289b('0x33')]]={'$like':'%'+_0x4bcc27['query'][_0x289b('0x4a')]+'%'};return _0x5ecd2b;}})});}_0x235e3f=_[_0x289b('0x48')]({},_0x235e3f,_0x4bcc27[_0x289b('0x4b')]);var _0x484bdd={'where':_0x235e3f[_0x289b('0x46')]};return db[_0x289b('0x4c')][_0x289b('0x4d')](_0x484bdd)[_0x289b('0x1c')](function(_0x233052){_0x27c9bf[_0x289b('0x4d')]=_0x233052;if(_0x4bcc27[_0x289b('0x3c')][_0x289b('0x4e')]){_0x235e3f[_0x289b('0x4f')]=[{'all':!![]}];}return db[_0x289b('0x4c')][_0x289b('0x50')](_0x235e3f);})[_0x289b('0x1c')](function(_0x141abe){_0x27c9bf[_0x289b('0x51')]=_0x141abe;return _0x27c9bf;})['then'](respondWithFilteredResult(_0x50ff60,_0x235e3f))[_0x289b('0x25')](handleError(_0x50ff60,null));};exports[_0x289b('0x52')]=function(_0x5f2045,_0x1f5086){var _0x1c097f={'raw':![],'where':{'id':_0x5f2045[_0x289b('0x53')]['id']}},_0x41e083={};_0x41e083['model']=_[_0x289b('0x54')](db[_0x289b('0x4c')][_0x289b('0x37')]);_0x41e083[_0x289b('0x3c')]=_[_0x289b('0x54')](_0x5f2045[_0x289b('0x3c')]);_0x41e083['filters']=_['intersection'](_0x41e083[_0x289b('0x3b')],_0x41e083[_0x289b('0x3c')]);_0x1c097f[_0x289b('0x3f')]=_[_0x289b('0x3e')](_0x41e083[_0x289b('0x3b')],qs[_0x289b('0x40')](_0x5f2045[_0x289b('0x3c')][_0x289b('0x40')]));_0x1c097f[_0x289b('0x3f')]=_0x1c097f[_0x289b('0x3f')][_0x289b('0x41')]?_0x1c097f[_0x289b('0x3f')]:_0x41e083[_0x289b('0x3b')];if(_0x5f2045[_0x289b('0x3c')][_0x289b('0x4e')]){_0x1c097f['include']=[{'all':!![]}];}_0x1c097f=_[_0x289b('0x48')]({},_0x1c097f,_0x5f2045[_0x289b('0x4b')]);return db[_0x289b('0x4c')][_0x289b('0x55')](_0x1c097f)[_0x289b('0x1c')](handleEntityNotFound(_0x1f5086,null))[_0x289b('0x1c')](respondWithResult(_0x1f5086,null))['catch'](handleError(_0x1f5086,null));};exports[_0x289b('0x56')]=function(_0x5aceb5,_0x52fd61){return db['FreshdeskConfiguration'][_0x289b('0x56')](_0x5aceb5['body'],{})['then'](respondWithResult(_0x52fd61,0xc9))[_0x289b('0x25')](handleError(_0x52fd61,null));};exports[_0x289b('0x30')]=function(_0x4bd17a,_0x8c1ddf){if(_0x4bd17a['body']['id']){delete _0x4bd17a[_0x289b('0x57')]['id'];}return db[_0x289b('0x4c')][_0x289b('0x55')]({'where':{'id':_0x4bd17a[_0x289b('0x53')]['id']}})[_0x289b('0x1c')](handleEntityNotFound(_0x8c1ddf,null))[_0x289b('0x1c')](saveUpdates(_0x4bd17a[_0x289b('0x57')],null))[_0x289b('0x1c')](respondWithResult(_0x8c1ddf,null))[_0x289b('0x25')](handleError(_0x8c1ddf,null));};exports['destroy']=function(_0x1db13c,_0x3a3a3b){return db[_0x289b('0x4c')][_0x289b('0x55')]({'where':{'id':_0x1db13c['params']['id']}})[_0x289b('0x1c')](handleEntityNotFound(_0x3a3a3b,null))[_0x289b('0x1c')](removeEntity(_0x3a3a3b,null))[_0x289b('0x25')](handleError(_0x3a3a3b,null));};exports[_0x289b('0x58')]=function(_0x213e43,_0x5cc2bd,_0x3e2ff6){var _0x2a5717={};var _0x322c7d={};var _0x308afb;var _0x5a1a8e;return db['FreshdeskConfiguration'][_0x289b('0x59')]({'where':{'id':_0x213e43['params']['id']}})[_0x289b('0x1c')](handleEntityNotFound(_0x5cc2bd,null))[_0x289b('0x1c')](function(_0x45498e){if(_0x45498e){_0x308afb=_0x45498e;_0x322c7d[_0x289b('0x3b')]=_['keys'](db[_0x289b('0x5a')][_0x289b('0x37')]);_0x322c7d[_0x289b('0x3c')]=_[_0x289b('0x54')](_0x213e43[_0x289b('0x3c')]);_0x322c7d[_0x289b('0x3d')]=_[_0x289b('0x3e')](_0x322c7d[_0x289b('0x3b')],_0x322c7d[_0x289b('0x3c')]);_0x2a5717['attributes']=_[_0x289b('0x3e')](_0x322c7d['model'],qs[_0x289b('0x40')](_0x213e43[_0x289b('0x3c')][_0x289b('0x40')]));_0x2a5717[_0x289b('0x3f')]=_0x2a5717[_0x289b('0x3f')][_0x289b('0x41')]?_0x2a5717[_0x289b('0x3f')]:_0x322c7d[_0x289b('0x3b')];_0x2a5717[_0x289b('0x44')]=qs[_0x289b('0x45')](_0x213e43['query'][_0x289b('0x45')]);_0x2a5717[_0x289b('0x46')]=qs['filters'](_[_0x289b('0x47')](_0x213e43[_0x289b('0x3c')],_0x322c7d[_0x289b('0x3d')]));if(_0x213e43[_0x289b('0x3c')]['filter']){_0x2a5717['where']=_[_0x289b('0x48')](_0x2a5717[_0x289b('0x46')],{'$or':_[_0x289b('0x36')](_0x2a5717[_0x289b('0x3f')],function(_0x3ca4b0){var _0x577c84={};_0x577c84[_0x3ca4b0]={'$like':'%'+_0x213e43[_0x289b('0x3c')][_0x289b('0x4a')]+'%'};return _0x577c84;})});}_0x2a5717=_[_0x289b('0x48')]({},_0x2a5717,_0x213e43[_0x289b('0x4b')]);return _0x308afb[_0x289b('0x58')](_0x2a5717);}})['then'](function(_0x51110a){if(_0x51110a){_0x5a1a8e=_0x51110a['length'];if(!_0x213e43[_0x289b('0x3c')][_0x289b('0x42')](_0x289b('0x43'))){_0x2a5717[_0x289b('0x2a')]=qs[_0x289b('0x2a')](_0x213e43['query'][_0x289b('0x2a')]);_0x2a5717[_0x289b('0x29')]=qs[_0x289b('0x29')](_0x213e43[_0x289b('0x3c')][_0x289b('0x29')]);}return _0x308afb['getFields'](_0x2a5717);}})['then'](function(_0x3f3e0f){if(_0x3f3e0f){return _0x3f3e0f?{'count':_0x5a1a8e,'rows':_0x3f3e0f}:null;}})[_0x289b('0x1c')](respondWithResult(_0x5cc2bd,null))[_0x289b('0x25')](handleError(_0x5cc2bd,null));};exports[_0x289b('0x5b')]=function(_0x332ebb,_0x50dcdb,_0x5234f6){var _0x2551f8={};var _0x2d7f04={};var _0x2dfe1e;var _0x3768d6;return db[_0x289b('0x4c')][_0x289b('0x59')]({'where':{'id':_0x332ebb['params']['id']}})[_0x289b('0x1c')](handleEntityNotFound(_0x50dcdb,null))[_0x289b('0x1c')](function(_0x224125){if(_0x224125){_0x2dfe1e=_0x224125;_0x2d7f04['model']=_[_0x289b('0x54')](db['FreshdeskField'][_0x289b('0x37')]);_0x2d7f04[_0x289b('0x3c')]=_[_0x289b('0x54')](_0x332ebb[_0x289b('0x3c')]);_0x2d7f04[_0x289b('0x3d')]=_[_0x289b('0x3e')](_0x2d7f04['model'],_0x2d7f04[_0x289b('0x3c')]);_0x2551f8[_0x289b('0x3f')]=_[_0x289b('0x3e')](_0x2d7f04['model'],qs[_0x289b('0x40')](_0x332ebb[_0x289b('0x3c')][_0x289b('0x40')]));_0x2551f8['attributes']=_0x2551f8[_0x289b('0x3f')][_0x289b('0x41')]?_0x2551f8[_0x289b('0x3f')]:_0x2d7f04['model'];_0x2551f8[_0x289b('0x44')]=qs[_0x289b('0x45')](_0x332ebb[_0x289b('0x3c')][_0x289b('0x45')]);_0x2551f8[_0x289b('0x46')]=qs['filters'](_[_0x289b('0x47')](_0x332ebb[_0x289b('0x3c')],_0x2d7f04[_0x289b('0x3d')]));if(_0x332ebb[_0x289b('0x3c')][_0x289b('0x4a')]){_0x2551f8[_0x289b('0x46')]=_['merge'](_0x2551f8[_0x289b('0x46')],{'$or':_[_0x289b('0x36')](_0x2551f8['attributes'],function(_0x3b4b74){var _0x33c60d={};_0x33c60d[_0x3b4b74]={'$like':'%'+_0x332ebb[_0x289b('0x3c')][_0x289b('0x4a')]+'%'};return _0x33c60d;})});}_0x2551f8=_['merge']({},_0x2551f8,_0x332ebb[_0x289b('0x4b')]);return _0x2dfe1e[_0x289b('0x5b')](_0x2551f8);}})['then'](function(_0x2ae4c2){if(_0x2ae4c2){_0x3768d6=_0x2ae4c2[_0x289b('0x41')];if(!_0x332ebb['query']['hasOwnProperty']('nolimit')){_0x2551f8[_0x289b('0x2a')]=qs[_0x289b('0x2a')](_0x332ebb[_0x289b('0x3c')][_0x289b('0x2a')]);_0x2551f8['offset']=qs[_0x289b('0x29')](_0x332ebb[_0x289b('0x3c')][_0x289b('0x29')]);}return _0x2dfe1e[_0x289b('0x5b')](_0x2551f8);}})[_0x289b('0x1c')](function(_0x102e50){if(_0x102e50){return _0x102e50?{'count':_0x3768d6,'rows':_0x102e50}:null;}})['then'](respondWithResult(_0x50dcdb,null))[_0x289b('0x25')](handleError(_0x50dcdb,null));};exports[_0x289b('0x5c')]=function(_0x2b2492,_0x1fa0ec,_0x264396){var _0x3ec13e={};var _0x51b1fc={};var _0x4de5c8;var _0x5afc98;return db[_0x289b('0x4c')]['findOne']({'where':{'id':_0x2b2492[_0x289b('0x53')]['id']}})[_0x289b('0x1c')](handleEntityNotFound(_0x1fa0ec,null))['then'](function(_0x1f62c5){if(_0x1f62c5){_0x4de5c8=_0x1f62c5;_0x51b1fc['model']=_[_0x289b('0x54')](db[_0x289b('0x5a')][_0x289b('0x37')]);_0x51b1fc[_0x289b('0x3c')]=_['keys'](_0x2b2492[_0x289b('0x3c')]);_0x51b1fc['filters']=_[_0x289b('0x3e')](_0x51b1fc[_0x289b('0x3b')],_0x51b1fc['query']);_0x3ec13e['attributes']=_[_0x289b('0x3e')](_0x51b1fc[_0x289b('0x3b')],qs['fields'](_0x2b2492[_0x289b('0x3c')][_0x289b('0x40')]));_0x3ec13e['attributes']=_0x3ec13e['attributes'][_0x289b('0x41')]?_0x3ec13e[_0x289b('0x3f')]:_0x51b1fc[_0x289b('0x3b')];_0x3ec13e[_0x289b('0x44')]=qs[_0x289b('0x45')](_0x2b2492[_0x289b('0x3c')][_0x289b('0x45')]);_0x3ec13e['where']=qs[_0x289b('0x3d')](_[_0x289b('0x47')](_0x2b2492[_0x289b('0x3c')],_0x51b1fc[_0x289b('0x3d')]));if(_0x2b2492[_0x289b('0x3c')]['filter']){_0x3ec13e[_0x289b('0x46')]=_[_0x289b('0x48')](_0x3ec13e['where'],{'$or':_[_0x289b('0x36')](_0x3ec13e[_0x289b('0x3f')],function(_0x524e8c){var _0x5a09a3={};_0x5a09a3[_0x524e8c]={'$like':'%'+_0x2b2492[_0x289b('0x3c')][_0x289b('0x4a')]+'%'};return _0x5a09a3;})});}_0x3ec13e=_[_0x289b('0x48')]({},_0x3ec13e,_0x2b2492['options']);return _0x4de5c8[_0x289b('0x5c')](_0x3ec13e);}})[_0x289b('0x1c')](function(_0x523e4e){if(_0x523e4e){_0x5afc98=_0x523e4e[_0x289b('0x41')];if(!_0x2b2492[_0x289b('0x3c')][_0x289b('0x42')](_0x289b('0x43'))){_0x3ec13e[_0x289b('0x2a')]=qs[_0x289b('0x2a')](_0x2b2492['query']['limit']);_0x3ec13e[_0x289b('0x29')]=qs[_0x289b('0x29')](_0x2b2492[_0x289b('0x3c')][_0x289b('0x29')]);}return _0x4de5c8[_0x289b('0x5c')](_0x3ec13e);}})['then'](function(_0x856a76){if(_0x856a76){return _0x856a76?{'count':_0x5afc98,'rows':_0x856a76}:null;}})['then'](respondWithResult(_0x1fa0ec,null))[_0x289b('0x25')](handleError(_0x1fa0ec,null));};exports['getTags']=function(_0x3626a1,_0x1784df,_0x6bdff9){var _0x571024={};var _0x5209ee={};var _0x17de79;var _0x282a1e;return db[_0x289b('0x4c')]['findOne']({'where':{'id':_0x3626a1[_0x289b('0x53')]['id']}})[_0x289b('0x1c')](handleEntityNotFound(_0x1784df,null))[_0x289b('0x1c')](function(_0x2755f2){if(_0x2755f2){_0x17de79=_0x2755f2;_0x5209ee['model']=_['keys'](db['Tag'][_0x289b('0x37')]);_0x5209ee[_0x289b('0x3c')]=_[_0x289b('0x54')](_0x3626a1[_0x289b('0x3c')]);_0x5209ee['filters']=_['intersection'](_0x5209ee[_0x289b('0x3b')],_0x5209ee['query']);_0x571024[_0x289b('0x3f')]=_[_0x289b('0x3e')](_0x5209ee['model'],qs['fields'](_0x3626a1[_0x289b('0x3c')][_0x289b('0x40')]));_0x571024[_0x289b('0x3f')]=_0x571024[_0x289b('0x3f')][_0x289b('0x41')]?_0x571024[_0x289b('0x3f')]:_0x5209ee['model'];_0x571024[_0x289b('0x44')]=qs['sort'](_0x3626a1['query']['sort']);_0x571024['where']=qs['filters'](_[_0x289b('0x47')](_0x3626a1[_0x289b('0x3c')],_0x5209ee[_0x289b('0x3d')]));if(_0x3626a1[_0x289b('0x3c')][_0x289b('0x4a')]){_0x571024[_0x289b('0x46')]=_['merge'](_0x571024[_0x289b('0x46')],{'$or':_['map'](_0x571024[_0x289b('0x3f')],function(_0x23b4b3){var _0x1bc411={};_0x1bc411[_0x23b4b3]={'$like':'%'+_0x3626a1[_0x289b('0x3c')][_0x289b('0x4a')]+'%'};return _0x1bc411;})});}_0x571024=_[_0x289b('0x48')]({},_0x571024,_0x3626a1[_0x289b('0x4b')]);return _0x17de79[_0x289b('0x5d')](_0x571024);}})[_0x289b('0x1c')](function(_0x2e08e2){if(_0x2e08e2){_0x282a1e=_0x2e08e2[_0x289b('0x41')];if(!_0x3626a1['query'][_0x289b('0x42')](_0x289b('0x43'))){_0x571024[_0x289b('0x2a')]=qs[_0x289b('0x2a')](_0x3626a1[_0x289b('0x3c')]['limit']);_0x571024[_0x289b('0x29')]=qs[_0x289b('0x29')](_0x3626a1[_0x289b('0x3c')][_0x289b('0x29')]);}return _0x17de79['getTags'](_0x571024);}})[_0x289b('0x1c')](function(_0xcdb422){if(_0xcdb422){return _0xcdb422?{'count':_0x282a1e,'rows':_0xcdb422}:null;}})['then'](respondWithResult(_0x1784df,null))[_0x289b('0x25')](handleError(_0x1784df,null));};exports[_0x289b('0x5e')]=function(_0x3fe297,_0x52ad3d,_0x3f8e4d){if(_0x3fe297[_0x289b('0x57')]['id']){delete _0x3fe297[_0x289b('0x57')]['id'];}return db['FreshdeskConfiguration'][_0x289b('0x59')]({'where':{'id':_0x3fe297[_0x289b('0x53')]['id']}})['then'](handleEntityNotFound(_0x52ad3d,null))['then'](function(_0x231a07){if(_0x231a07){return _0x231a07[_0x289b('0x5e')](_0x3fe297[_0x289b('0x57')][_0x289b('0x5f')]||[]);}return null;})[_0x289b('0x1c')](respondWithResult(_0x52ad3d,null))['catch'](handleError(_0x52ad3d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 224612a..9f71c56 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 _0x39bd=['rimraf','../../config/environment','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','moment','bluebird','path'];(function(_0x5806f7,_0x415618){var _0x2ef419=function(_0x252424){while(--_0x252424){_0x5806f7['push'](_0x5806f7['shift']());}};_0x2ef419(++_0x415618);}(_0x39bd,0x15b));var _0xd39b=function(_0x1313c1,_0x2e6c13){_0x1313c1=_0x1313c1-0x0;var _0x53bed9=_0x39bd[_0x1313c1];return _0x53bed9;};'use strict';var _=require('lodash');var util=require(_0xd39b('0x0'));var logger=require(_0xd39b('0x1'))('api');var moment=require(_0xd39b('0x2'));var BPromise=require(_0xd39b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd39b('0x4'));var rimraf=require(_0xd39b('0x5'));var config=require(_0xd39b('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd39b('0x7')]=function(_0x240ebd,_0xa1e611){return _0x240ebd[_0xd39b('0x8')](_0xd39b('0x9'),attributes,{'tableName':_0xd39b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x299e=['api','moment','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger'];(function(_0x2ca4d1,_0x148124){var _0x45589a=function(_0x476f60){while(--_0x476f60){_0x2ca4d1['push'](_0x2ca4d1['shift']());}};_0x45589a(++_0x148124);}(_0x299e,0x1e2));var _0xe299=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x299e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe299('0x0'));var util=require('util');var logger=require(_0xe299('0x1'))(_0xe299('0x2'));var moment=require(_0xe299('0x3'));var BPromise=require('bluebird');var rp=require(_0xe299('0x4'));var fs=require('fs');var path=require(_0xe299('0x5'));var rimraf=require(_0xe299('0x6'));var config=require('../../config/environment');var attributes=require(_0xe299('0x7'));module['exports']=function(_0x2a1426,_0x371f94){return _0x2a1426[_0xe299('0x8')](_0xe299('0x9'),attributes,{'tableName':_0xe299('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 10c81ea..bdac714 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 _0x4565=['request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0x4565,0x163));var _0x5456=function(_0x56a7b3,_0x20c6e6){_0x56a7b3=_0x56a7b3-0x0;var _0x4c1ce6=_0x4565[_0x56a7b3];return _0x4c1ce6;};'use strict';var _=require(_0x5456('0x0'));var util=require(_0x5456('0x1'));var moment=require(_0x5456('0x2'));var BPromise=require(_0x5456('0x3'));var rs=require(_0x5456('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5456('0x5'));var logger=require(_0x5456('0x6'))(_0x5456('0x7'));var config=require('../../config/environment');var jayson=require(_0x5456('0x8'));var client=jayson['client'][_0x5456('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87532e,_0x414703,_0x2c9343){return new BPromise(function(_0x1c25b9,_0x6a58a5){return client[_0x5456('0xa')](_0x87532e,_0x2c9343)[_0x5456('0xb')](function(_0x3ae59b){logger['info'](_0x5456('0xc'),_0x414703,_0x5456('0xd'));logger[_0x5456('0xe')](_0x5456('0xf'),_0x414703,_0x5456('0xd'),JSON[_0x5456('0x10')](_0x3ae59b));if(_0x3ae59b[_0x5456('0x11')]){if(_0x3ae59b[_0x5456('0x11')][_0x5456('0x12')]===0x1f4){logger[_0x5456('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x414703,_0x3ae59b[_0x5456('0x11')][_0x5456('0x13')]);return _0x6a58a5(_0x3ae59b[_0x5456('0x11')][_0x5456('0x13')]);}logger['error'](_0x5456('0xc'),_0x414703,_0x3ae59b[_0x5456('0x11')][_0x5456('0x13')]);return _0x1c25b9(_0x3ae59b[_0x5456('0x11')]['message']);}else{logger[_0x5456('0x14')](_0x5456('0xc'),_0x414703,_0x5456('0xd'));_0x1c25b9(_0x3ae59b[_0x5456('0x15')]['message']);}})[_0x5456('0x16')](function(_0x3a883f){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x414703,_0x3a883f);_0x6a58a5(_0x3a883f);});});} \ No newline at end of file +var _0x1399=['client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x16de6a,_0x1de32f){var _0x4868d7=function(_0x5c3478){while(--_0x5c3478){_0x16de6a['push'](_0x16de6a['shift']());}};_0x4868d7(++_0x1de32f);}(_0x1399,0xa4));var _0x9139=function(_0x430469,_0x20e783){_0x430469=_0x430469-0x0;var _0x1ca55e=_0x1399[_0x430469];return _0x1ca55e;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9139('0x4'))(_0x9139('0x5'));var config=require(_0x9139('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9139('0x7')][_0x9139('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x121f87,_0x21e3e6,_0x4fe6e6){return new BPromise(function(_0x755e14,_0x266599){return client['request'](_0x121f87,_0x4fe6e6)[_0x9139('0x9')](function(_0x5b45cf){logger[_0x9139('0xa')](_0x9139('0xb'),_0x21e3e6,_0x9139('0xc'));logger['debug'](_0x9139('0xd'),_0x21e3e6,'request\x20sent',JSON[_0x9139('0xe')](_0x5b45cf));if(_0x5b45cf[_0x9139('0xf')]){if(_0x5b45cf[_0x9139('0xf')][_0x9139('0x10')]===0x1f4){logger[_0x9139('0xf')](_0x9139('0xb'),_0x21e3e6,_0x5b45cf[_0x9139('0xf')]['message']);return _0x266599(_0x5b45cf['error'][_0x9139('0x11')]);}logger[_0x9139('0xf')](_0x9139('0xb'),_0x21e3e6,_0x5b45cf[_0x9139('0xf')][_0x9139('0x11')]);return _0x755e14(_0x5b45cf[_0x9139('0xf')][_0x9139('0x11')]);}else{logger[_0x9139('0xa')](_0x9139('0xb'),_0x21e3e6,_0x9139('0xc'));_0x755e14(_0x5b45cf[_0x9139('0x12')][_0x9139('0x11')]);}})['catch'](function(_0x794e82){logger['error'](_0x9139('0xb'),_0x21e3e6,_0x794e82);_0x266599(_0x794e82);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0b2bbb3..d2b44d2 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x98502e,_0x2d3c91){var _0x2da88c=function(_0x200673){while(--_0x200673){_0x98502e['push'](_0x98502e['shift']());}};_0x2da88c(++_0x2d3c91);}(_0x008c,0x188));var _0xc008=function(_0x3ef6bb,_0x1bb97f){_0x3ef6bb=_0x3ef6bb-0x0;var _0xa5f12a=_0x008c[_0x3ef6bb];return _0xa5f12a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0xc5abc9,_0x383bc8){var _0x5a14f4=function(_0x4b0ae5){while(--_0x4b0ae5){_0xc5abc9['push'](_0xc5abc9['shift']());}};_0x5a14f4(++_0x383bc8);}(_0x008c,0x188));var _0xc008=function(_0x3b06f1,_0x2c2f9a){_0x3b06f1=_0x3b06f1-0x0;var _0x1ab7fd=_0x008c[_0x3b06f1];return _0x1ab7fd;};'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 50a30df..1e78eba 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 _0xabed=['STRING','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','string','ENUM'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xabed,0xa4));var _0xdabe=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xabed[_0x2a0738];return _0x159679;};'use strict';var Sequelize=require(_0xdabe('0x0'));module[_0xdabe('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xdabe('0x2'),_0xdabe('0x3'),_0xdabe('0x4')),'defaultValue':_0xdabe('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdabe('0x6')](_0xdabe('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xdabe('0x7')]},'idField':{'type':Sequelize[_0xdabe('0x7')]},'nameField':{'type':Sequelize[_0xdabe('0x7')]},'customField':{'type':Sequelize[_0xdabe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdabe('0x7')]}}; \ No newline at end of file +var _0xacc8=['STRING','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x3f0858,_0x345b6c){var _0x184bd3=function(_0x216a77){while(--_0x216a77){_0x3f0858['push'](_0x3f0858['shift']());}};_0x184bd3(++_0x345b6c);}(_0xacc8,0xc5));var _0x8acc=function(_0x3b330e,_0x350e11){_0x3b330e=_0x3b330e-0x0;var _0xa61a79=_0xacc8[_0x3b330e];return _0xa61a79;};'use strict';var Sequelize=require(_0x8acc('0x0'));module['exports']={'type':{'type':Sequelize[_0x8acc('0x1')](_0x8acc('0x2'),_0x8acc('0x3'),_0x8acc('0x4'),_0x8acc('0x5')),'defaultValue':_0x8acc('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8acc('0x6')]},'keyType':{'type':Sequelize[_0x8acc('0x1')](_0x8acc('0x2'),'variable',_0x8acc('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8acc('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8acc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 86fbbe5..beb1d7d 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 _0xab83=['nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','sox','ejs','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FreshdeskField','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab83,0x9e));var _0x3ab8=function(_0x12c972,_0x231e53){_0x12c972=_0x12c972-0x0;var _0x141a92=_0xab83[_0x12c972];return _0x141a92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3ab8('0x0'));var rimraf=require(_0x3ab8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3ab8('0x2'));var BPromise=require(_0x3ab8('0x3'));var Mustache=require(_0x3ab8('0x4'));var util=require(_0x3ab8('0x5'));var path=require('path');var sox=require(_0x3ab8('0x6'));var csv=require('to-csv');var ejs=require(_0x3ab8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3ab8('0x8'));var crypto=require(_0x3ab8('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3ab8('0xa'));var querystring=require(_0x3ab8('0xb'));var Papa=require(_0x3ab8('0xc'));var Redis=require('ioredis');var authService=require(_0x3ab8('0xd'));var qs=require(_0x3ab8('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ab8('0xf'));var logger=require(_0x3ab8('0x10'))(_0x3ab8('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3ab8('0x12'))['db'];function respondWithStatusCode(_0x2be9e2,_0x13fc1f){_0x13fc1f=_0x13fc1f||0xcc;return function(_0x5cbff5){if(_0x5cbff5){return _0x2be9e2[_0x3ab8('0x13')](_0x13fc1f);}return _0x2be9e2[_0x3ab8('0x14')](_0x13fc1f)[_0x3ab8('0x15')]();};}function respondWithResult(_0x9424c2,_0x3ffef3){_0x3ffef3=_0x3ffef3||0xc8;return function(_0x1db893){if(_0x1db893){return _0x9424c2['status'](_0x3ffef3)[_0x3ab8('0x16')](_0x1db893);}};}function respondWithFilteredResult(_0xc4492,_0x4b11bc){return function(_0x1097a1){if(_0x1097a1){var _0x6cbb23=_0x1097a1[_0x3ab8('0x17')],_0x309a35=_0x4b11bc[_0x3ab8('0x18')],_0x12891c=_0x4b11bc[_0x3ab8('0x18')]+_0x4b11bc['limit'],_0x5d3f47;if(_0x12891c>=_0x6cbb23){_0x12891c=_0x6cbb23;_0x5d3f47=0xc8;}else{_0x5d3f47=0xce;}_0xc4492[_0x3ab8('0x14')](_0x5d3f47);return _0xc4492[_0x3ab8('0x19')](_0x3ab8('0x1a'),_0x309a35+'-'+_0x12891c+'/'+_0x6cbb23)[_0x3ab8('0x16')](_0x1097a1);}return null;};}function patchUpdates(_0x45f5f3){return function(_0x566c00){try{jsonpatch[_0x3ab8('0x1b')](_0x566c00,_0x45f5f3,!![]);}catch(_0x27df73){return BPromise[_0x3ab8('0x1c')](_0x27df73);}return _0x566c00['save']();};}function saveUpdates(_0x5eb509,_0x24fbfe){return function(_0x363c3b){if(_0x363c3b){return _0x363c3b[_0x3ab8('0x1d')](_0x5eb509)[_0x3ab8('0x1e')](function(_0x21aa7c){return _0x21aa7c;});}return null;};}function removeEntity(_0x58e58e,_0x1ea000){return function(_0x1abfd3){if(_0x1abfd3){return _0x1abfd3[_0x3ab8('0x1f')]()[_0x3ab8('0x1e')](function(){_0x58e58e[_0x3ab8('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d425e,_0x44b6bc){return function(_0x59c517){if(!_0x59c517){_0x5d425e[_0x3ab8('0x13')](0x194);}return _0x59c517;};}function handleError(_0xf4b9bf,_0x509fea){_0x509fea=_0x509fea||0x1f4;return function(_0xdafb98){logger[_0x3ab8('0x20')](_0xdafb98[_0x3ab8('0x21')]);if(_0xdafb98[_0x3ab8('0x22')]){delete _0xdafb98[_0x3ab8('0x22')];}_0xf4b9bf[_0x3ab8('0x14')](_0x509fea)['send'](_0xdafb98);};}exports[_0x3ab8('0x23')]=function(_0xfc2ef9,_0x2cd954){var _0x12d493={},_0x1b615b={},_0x25a911={'count':0x0,'rows':[]};var _0xb8398e=_[_0x3ab8('0x24')](db[_0x3ab8('0x25')]['rawAttributes'],function(_0x252915){return{'name':_0x252915['fieldName'],'type':_0x252915[_0x3ab8('0x26')][_0x3ab8('0x27')]};});_0x1b615b[_0x3ab8('0x28')]=_[_0x3ab8('0x24')](_0xb8398e,'name');_0x1b615b['query']=_[_0x3ab8('0x29')](_0xfc2ef9[_0x3ab8('0x2a')]);_0x1b615b[_0x3ab8('0x2b')]=_[_0x3ab8('0x2c')](_0x1b615b[_0x3ab8('0x28')],_0x1b615b['query']);_0x12d493[_0x3ab8('0x2d')]=_['intersection'](_0x1b615b[_0x3ab8('0x28')],qs[_0x3ab8('0x2e')](_0xfc2ef9[_0x3ab8('0x2a')][_0x3ab8('0x2e')]));_0x12d493[_0x3ab8('0x2d')]=_0x12d493[_0x3ab8('0x2d')][_0x3ab8('0x2f')]?_0x12d493[_0x3ab8('0x2d')]:_0x1b615b[_0x3ab8('0x28')];if(!_0xfc2ef9[_0x3ab8('0x2a')][_0x3ab8('0x30')](_0x3ab8('0x31'))){_0x12d493[_0x3ab8('0x32')]=qs[_0x3ab8('0x32')](_0xfc2ef9[_0x3ab8('0x2a')][_0x3ab8('0x32')]);_0x12d493[_0x3ab8('0x18')]=qs['offset'](_0xfc2ef9['query'][_0x3ab8('0x18')]);}_0x12d493[_0x3ab8('0x33')]=qs['sort'](_0xfc2ef9['query'][_0x3ab8('0x34')]);_0x12d493[_0x3ab8('0x35')]=qs['filters'](_[_0x3ab8('0x36')](_0xfc2ef9['query'],_0x1b615b['filters']),_0xb8398e);if(_0xfc2ef9['query'][_0x3ab8('0x37')]){_0x12d493[_0x3ab8('0x35')]=_[_0x3ab8('0x38')](_0x12d493[_0x3ab8('0x35')],{'$or':_['map'](_0xb8398e,function(_0x4d7ddd){if(_0x4d7ddd['type']!==_0x3ab8('0x39')){var _0xbbe28b={};_0xbbe28b[_0x4d7ddd[_0x3ab8('0x22')]]={'$like':'%'+_0xfc2ef9[_0x3ab8('0x2a')]['filter']+'%'};return _0xbbe28b;}})});}_0x12d493=_[_0x3ab8('0x38')]({},_0x12d493,_0xfc2ef9[_0x3ab8('0x3a')]);var _0x3d50e5={'where':_0x12d493[_0x3ab8('0x35')]};return db['FreshdeskField'][_0x3ab8('0x17')](_0x3d50e5)[_0x3ab8('0x1e')](function(_0x2bc70b){_0x25a911['count']=_0x2bc70b;if(_0xfc2ef9[_0x3ab8('0x2a')][_0x3ab8('0x3b')]){_0x12d493[_0x3ab8('0x3c')]=[{'all':!![]}];}return db['FreshdeskField'][_0x3ab8('0x3d')](_0x12d493);})['then'](function(_0x577af5){_0x25a911['rows']=_0x577af5;return _0x25a911;})[_0x3ab8('0x1e')](respondWithFilteredResult(_0x2cd954,_0x12d493))['catch'](handleError(_0x2cd954,null));};exports[_0x3ab8('0x3e')]=function(_0x2311e2,_0x55c642){var _0x5a6ece={'raw':!![],'where':{'id':_0x2311e2['params']['id']}},_0x59a613={};_0x59a613[_0x3ab8('0x28')]=_[_0x3ab8('0x29')](db[_0x3ab8('0x25')][_0x3ab8('0x3f')]);_0x59a613[_0x3ab8('0x2a')]=_[_0x3ab8('0x29')](_0x2311e2[_0x3ab8('0x2a')]);_0x59a613[_0x3ab8('0x2b')]=_[_0x3ab8('0x2c')](_0x59a613[_0x3ab8('0x28')],_0x59a613[_0x3ab8('0x2a')]);_0x5a6ece['attributes']=_[_0x3ab8('0x2c')](_0x59a613[_0x3ab8('0x28')],qs[_0x3ab8('0x2e')](_0x2311e2[_0x3ab8('0x2a')][_0x3ab8('0x2e')]));_0x5a6ece[_0x3ab8('0x2d')]=_0x5a6ece[_0x3ab8('0x2d')][_0x3ab8('0x2f')]?_0x5a6ece[_0x3ab8('0x2d')]:_0x59a613[_0x3ab8('0x28')];if(_0x2311e2[_0x3ab8('0x2a')]['includeAll']){_0x5a6ece['include']=[{'all':!![]}];}_0x5a6ece=_['merge']({},_0x5a6ece,_0x2311e2[_0x3ab8('0x3a')]);return db[_0x3ab8('0x25')][_0x3ab8('0x40')](_0x5a6ece)['then'](handleEntityNotFound(_0x55c642,null))['then'](respondWithResult(_0x55c642,null))[_0x3ab8('0x41')](handleError(_0x55c642,null));};exports[_0x3ab8('0x42')]=function(_0x2aa764,_0x2a1171){return db[_0x3ab8('0x25')]['create'](_0x2aa764[_0x3ab8('0x43')],{})[_0x3ab8('0x1e')](respondWithResult(_0x2a1171,0xc9))[_0x3ab8('0x41')](handleError(_0x2a1171,null));};exports[_0x3ab8('0x1d')]=function(_0x3d1827,_0x189331){if(_0x3d1827['body']['id']){delete _0x3d1827[_0x3ab8('0x43')]['id'];}return db[_0x3ab8('0x25')][_0x3ab8('0x40')]({'where':{'id':_0x3d1827[_0x3ab8('0x44')]['id']}})[_0x3ab8('0x1e')](handleEntityNotFound(_0x189331,null))[_0x3ab8('0x1e')](saveUpdates(_0x3d1827[_0x3ab8('0x43')],null))[_0x3ab8('0x1e')](respondWithResult(_0x189331,null))[_0x3ab8('0x41')](handleError(_0x189331,null));};exports[_0x3ab8('0x1f')]=function(_0x6d1f43,_0x925f8c){return db[_0x3ab8('0x25')]['find']({'where':{'id':_0x6d1f43[_0x3ab8('0x44')]['id']}})[_0x3ab8('0x1e')](handleEntityNotFound(_0x925f8c,null))[_0x3ab8('0x1e')](removeEntity(_0x925f8c,null))[_0x3ab8('0x41')](handleError(_0x925f8c,null));}; \ No newline at end of file +var _0x32b9=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','FreshdeskField','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x32b9,0x136));var _0x932b=function(_0xae0644,_0x5adf55){_0xae0644=_0xae0644-0x0;var _0x4d7215=_0x32b9[_0xae0644];return _0x4d7215;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x932b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x932b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x932b('0x2'));var BPromise=require(_0x932b('0x3'));var Mustache=require(_0x932b('0x4'));var util=require(_0x932b('0x5'));var path=require('path');var sox=require(_0x932b('0x6'));var csv=require(_0x932b('0x7'));var ejs=require(_0x932b('0x8'));var fs=require('fs');var _=require(_0x932b('0x9'));var squel=require(_0x932b('0xa'));var crypto=require(_0x932b('0xb'));var jsforce=require(_0x932b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x932b('0x7'));var querystring=require('querystring');var Papa=require(_0x932b('0xd'));var Redis=require('ioredis');var authService=require(_0x932b('0xe'));var qs=require(_0x932b('0xf'));var as=require(_0x932b('0x10'));var hardwareService=require(_0x932b('0x11'));var logger=require(_0x932b('0x12'))(_0x932b('0x13'));var utils=require(_0x932b('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2b7d,_0x4fb6b8){_0x4fb6b8=_0x4fb6b8||0xcc;return function(_0x39b745){if(_0x39b745){return _0x2b2b7d['sendStatus'](_0x4fb6b8);}return _0x2b2b7d[_0x932b('0x15')](_0x4fb6b8)[_0x932b('0x16')]();};}function respondWithResult(_0x323192,_0x21e231){_0x21e231=_0x21e231||0xc8;return function(_0x20f327){if(_0x20f327){return _0x323192[_0x932b('0x15')](_0x21e231)[_0x932b('0x17')](_0x20f327);}};}function respondWithFilteredResult(_0x59ccb5,_0x29513e){return function(_0xb39939){if(_0xb39939){var _0x2c6dd8=_0xb39939[_0x932b('0x18')],_0x8cec05=_0x29513e[_0x932b('0x19')],_0x3505d7=_0x29513e['offset']+_0x29513e['limit'],_0x419f34;if(_0x3505d7>=_0x2c6dd8){_0x3505d7=_0x2c6dd8;_0x419f34=0xc8;}else{_0x419f34=0xce;}_0x59ccb5[_0x932b('0x15')](_0x419f34);return _0x59ccb5[_0x932b('0x1a')](_0x932b('0x1b'),_0x8cec05+'-'+_0x3505d7+'/'+_0x2c6dd8)[_0x932b('0x17')](_0xb39939);}return null;};}function patchUpdates(_0xf9dc65){return function(_0x455bac){try{jsonpatch[_0x932b('0x1c')](_0x455bac,_0xf9dc65,!![]);}catch(_0x5b7431){return BPromise['reject'](_0x5b7431);}return _0x455bac[_0x932b('0x1d')]();};}function saveUpdates(_0xea9844,_0x363246){return function(_0x37b936){if(_0x37b936){return _0x37b936[_0x932b('0x1e')](_0xea9844)['then'](function(_0x5692ea){return _0x5692ea;});}return null;};}function removeEntity(_0x18d4f7,_0x555733){return function(_0x10ac58){if(_0x10ac58){return _0x10ac58[_0x932b('0x1f')]()[_0x932b('0x20')](function(){_0x18d4f7[_0x932b('0x15')](0xcc)[_0x932b('0x16')]();});}};}function handleEntityNotFound(_0x4f784e,_0x678a8b){return function(_0x5d35f2){if(!_0x5d35f2){_0x4f784e[_0x932b('0x21')](0x194);}return _0x5d35f2;};}function handleError(_0x27e5f9,_0x500f16){_0x500f16=_0x500f16||0x1f4;return function(_0x539907){logger['error'](_0x539907[_0x932b('0x22')]);if(_0x539907[_0x932b('0x23')]){delete _0x539907[_0x932b('0x23')];}_0x27e5f9[_0x932b('0x15')](_0x500f16)['send'](_0x539907);};}exports[_0x932b('0x24')]=function(_0x45c9b9,_0x60c031){var _0x5a8780={},_0x2763ca={},_0x4ae068={'count':0x0,'rows':[]};var _0xc7e771=_[_0x932b('0x25')](db['FreshdeskField'][_0x932b('0x26')],function(_0x272684){return{'name':_0x272684[_0x932b('0x27')],'type':_0x272684[_0x932b('0x28')][_0x932b('0x29')]};});_0x2763ca[_0x932b('0x2a')]=_['map'](_0xc7e771,_0x932b('0x23'));_0x2763ca[_0x932b('0x2b')]=_[_0x932b('0x2c')](_0x45c9b9['query']);_0x2763ca[_0x932b('0x2d')]=_['intersection'](_0x2763ca[_0x932b('0x2a')],_0x2763ca[_0x932b('0x2b')]);_0x5a8780[_0x932b('0x2e')]=_[_0x932b('0x2f')](_0x2763ca[_0x932b('0x2a')],qs['fields'](_0x45c9b9[_0x932b('0x2b')][_0x932b('0x30')]));_0x5a8780[_0x932b('0x2e')]=_0x5a8780['attributes'][_0x932b('0x31')]?_0x5a8780[_0x932b('0x2e')]:_0x2763ca[_0x932b('0x2a')];if(!_0x45c9b9[_0x932b('0x2b')][_0x932b('0x32')](_0x932b('0x33'))){_0x5a8780[_0x932b('0x34')]=qs[_0x932b('0x34')](_0x45c9b9[_0x932b('0x2b')]['limit']);_0x5a8780[_0x932b('0x19')]=qs[_0x932b('0x19')](_0x45c9b9[_0x932b('0x2b')][_0x932b('0x19')]);}_0x5a8780[_0x932b('0x35')]=qs[_0x932b('0x36')](_0x45c9b9['query'][_0x932b('0x36')]);_0x5a8780['where']=qs[_0x932b('0x2d')](_[_0x932b('0x37')](_0x45c9b9[_0x932b('0x2b')],_0x2763ca[_0x932b('0x2d')]),_0xc7e771);if(_0x45c9b9['query'][_0x932b('0x38')]){_0x5a8780[_0x932b('0x39')]=_[_0x932b('0x3a')](_0x5a8780[_0x932b('0x39')],{'$or':_[_0x932b('0x25')](_0xc7e771,function(_0x50da03){if(_0x50da03[_0x932b('0x28')]!==_0x932b('0x3b')){var _0x2adb04={};_0x2adb04[_0x50da03[_0x932b('0x23')]]={'$like':'%'+_0x45c9b9[_0x932b('0x2b')][_0x932b('0x38')]+'%'};return _0x2adb04;}})});}_0x5a8780=_[_0x932b('0x3a')]({},_0x5a8780,_0x45c9b9[_0x932b('0x3c')]);var _0x58c3c1={'where':_0x5a8780[_0x932b('0x39')]};return db['FreshdeskField'][_0x932b('0x18')](_0x58c3c1)[_0x932b('0x20')](function(_0x1d15a5){_0x4ae068[_0x932b('0x18')]=_0x1d15a5;if(_0x45c9b9['query'][_0x932b('0x3d')]){_0x5a8780[_0x932b('0x3e')]=[{'all':!![]}];}return db[_0x932b('0x3f')][_0x932b('0x40')](_0x5a8780);})[_0x932b('0x20')](function(_0x7cdf31){_0x4ae068[_0x932b('0x41')]=_0x7cdf31;return _0x4ae068;})[_0x932b('0x20')](respondWithFilteredResult(_0x60c031,_0x5a8780))[_0x932b('0x42')](handleError(_0x60c031,null));};exports['show']=function(_0xf0f907,_0x47922f){var _0x508c7b={'raw':!![],'where':{'id':_0xf0f907[_0x932b('0x43')]['id']}},_0x1b3bf3={};_0x1b3bf3[_0x932b('0x2a')]=_[_0x932b('0x2c')](db[_0x932b('0x3f')][_0x932b('0x26')]);_0x1b3bf3[_0x932b('0x2b')]=_[_0x932b('0x2c')](_0xf0f907[_0x932b('0x2b')]);_0x1b3bf3[_0x932b('0x2d')]=_[_0x932b('0x2f')](_0x1b3bf3[_0x932b('0x2a')],_0x1b3bf3[_0x932b('0x2b')]);_0x508c7b[_0x932b('0x2e')]=_[_0x932b('0x2f')](_0x1b3bf3[_0x932b('0x2a')],qs['fields'](_0xf0f907['query'][_0x932b('0x30')]));_0x508c7b[_0x932b('0x2e')]=_0x508c7b['attributes'][_0x932b('0x31')]?_0x508c7b[_0x932b('0x2e')]:_0x1b3bf3[_0x932b('0x2a')];if(_0xf0f907[_0x932b('0x2b')][_0x932b('0x3d')]){_0x508c7b['include']=[{'all':!![]}];}_0x508c7b=_[_0x932b('0x3a')]({},_0x508c7b,_0xf0f907[_0x932b('0x3c')]);return db[_0x932b('0x3f')][_0x932b('0x44')](_0x508c7b)[_0x932b('0x20')](handleEntityNotFound(_0x47922f,null))['then'](respondWithResult(_0x47922f,null))[_0x932b('0x42')](handleError(_0x47922f,null));};exports['create']=function(_0x541518,_0x5d46ce){return db[_0x932b('0x3f')][_0x932b('0x45')](_0x541518['body'],{})[_0x932b('0x20')](respondWithResult(_0x5d46ce,0xc9))[_0x932b('0x42')](handleError(_0x5d46ce,null));};exports[_0x932b('0x1e')]=function(_0x136f12,_0xa7f8aa){if(_0x136f12[_0x932b('0x46')]['id']){delete _0x136f12[_0x932b('0x46')]['id'];}return db['FreshdeskField'][_0x932b('0x44')]({'where':{'id':_0x136f12[_0x932b('0x43')]['id']}})[_0x932b('0x20')](handleEntityNotFound(_0xa7f8aa,null))[_0x932b('0x20')](saveUpdates(_0x136f12[_0x932b('0x46')],null))[_0x932b('0x20')](respondWithResult(_0xa7f8aa,null))[_0x932b('0x42')](handleError(_0xa7f8aa,null));};exports[_0x932b('0x1f')]=function(_0x475fba,_0xace5cb){return db[_0x932b('0x3f')][_0x932b('0x44')]({'where':{'id':_0x475fba['params']['id']}})['then'](handleEntityNotFound(_0xace5cb,null))['then'](removeEntity(_0xace5cb,null))['catch'](handleError(_0xace5cb,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c06ac0e..88530b1 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 _0x67ab=['path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5365c5,_0x49c2ba){var _0x561173=function(_0x5e5116){while(--_0x5e5116){_0x5365c5['push'](_0x5365c5['shift']());}};_0x561173(++_0x49c2ba);}(_0x67ab,0x117));var _0xb67a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x67ab[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xb67a('0x0'));var util=require(_0xb67a('0x1'));var logger=require(_0xb67a('0x2'))(_0xb67a('0x3'));var moment=require('moment');var BPromise=require(_0xb67a('0x4'));var rp=require(_0xb67a('0x5'));var fs=require('fs');var path=require(_0xb67a('0x6'));var rimraf=require('rimraf');var config=require(_0xb67a('0x7'));var attributes=require(_0xb67a('0x8'));module[_0xb67a('0x9')]=function(_0x4e86a8,_0x2dc239){return _0x4e86a8[_0xb67a('0xa')](_0xb67a('0xb'),attributes,{'tableName':_0xb67a('0xc'),'paranoid':![],'indexes':[{'name':_0xb67a('0xd'),'fields':['idField',_0xb67a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f38=['../../config/logger','moment','request-promise','path','rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util'];(function(_0xbb1a22,_0x24bc64){var _0x2d8dbe=function(_0x5b8239){while(--_0x5b8239){_0xbb1a22['push'](_0xbb1a22['shift']());}};_0x2d8dbe(++_0x24bc64);}(_0x9f38,0x81));var _0x89f3=function(_0x5574b6,_0x3775e8){_0x5574b6=_0x5574b6-0x0;var _0x3e3892=_0x9f38[_0x5574b6];return _0x3e3892;};'use strict';var _=require('lodash');var util=require(_0x89f3('0x0'));var logger=require(_0x89f3('0x1'))('api');var moment=require(_0x89f3('0x2'));var BPromise=require('bluebird');var rp=require(_0x89f3('0x3'));var fs=require('fs');var path=require(_0x89f3('0x4'));var rimraf=require(_0x89f3('0x5'));var config=require('../../config/environment');var attributes=require(_0x89f3('0x6'));module['exports']=function(_0x4efc74,_0x19e230){return _0x4efc74[_0x89f3('0x7')](_0x89f3('0x8'),attributes,{'tableName':_0x89f3('0x9'),'paranoid':![],'indexes':[{'name':_0x89f3('0xa'),'fields':[_0x89f3('0xb'),_0x89f3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 9904b2c..471eec1 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(_0x449352,_0x55a2d7){var _0x3f3f21=function(_0x2539db){while(--_0x2539db){_0x449352['push'](_0x449352['shift']());}};_0x3f3f21(++_0x55a2d7);}(_0xb10b,0x12a));var _0xbb10=function(_0x159f8e,_0x258d08){_0x159f8e=_0x159f8e-0x0;var _0x458e17=_0xb10b[_0x159f8e];return _0x458e17;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x2d7f9c,_0x3e39de){_0x2d7f9c=_0x2d7f9c-0x0;var _0x7a9d8c=_0x7a54[_0x2d7f9c];return _0x7a9d8c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index b1aa106..6081d86 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 _0x2086=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','/:id/fields','post','create','/:id/configurations','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x208ca0,_0xf46ead){var _0x313645=function(_0x10ab1a){while(--_0x10ab1a){_0x208ca0['push'](_0x208ca0['shift']());}};_0x313645(++_0xf46ead);}(_0x2086,0x120));var _0x6208=function(_0x44a5a6,_0x1bf9a0){_0x44a5a6=_0x44a5a6-0x0;var _0x1955f2=_0x2086[_0x44a5a6];return _0x1955f2;};'use strict';var multer=require(_0x6208('0x0'));var util=require(_0x6208('0x1'));var path=require(_0x6208('0x2'));var timeout=require(_0x6208('0x3'));var express=require(_0x6208('0x4'));var router=express['Router']();var auth=require(_0x6208('0x5'));var interaction=require(_0x6208('0x6'));var config=require(_0x6208('0x7'));var controller=require(_0x6208('0x8'));router[_0x6208('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6208('0xa'),auth[_0x6208('0xb')](),controller[_0x6208('0xc')]);router[_0x6208('0x9')]('/:id/configurations',auth[_0x6208('0xb')](),controller['getConfigurations']);router[_0x6208('0x9')](_0x6208('0xd'),auth[_0x6208('0xb')](),controller['getFields']);router[_0x6208('0xe')]('/',auth[_0x6208('0xb')](),controller[_0x6208('0xf')]);router[_0x6208('0xe')](_0x6208('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x6208('0xa'),auth[_0x6208('0xb')](),controller[_0x6208('0x11')]);router[_0x6208('0x12')]('/:id',auth[_0x6208('0xb')](),controller[_0x6208('0x13')]);module[_0x6208('0x14')]=router; \ No newline at end of file +var _0xe907=['post','/:id/configurations','addConfiguration','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','create'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe907,0x102));var _0x7e90=function(_0x25a4c3,_0x47a662){_0x25a4c3=_0x25a4c3-0x0;var _0x3f7c43=_0xe907[_0x25a4c3];return _0x3f7c43;};'use strict';var multer=require(_0x7e90('0x0'));var util=require(_0x7e90('0x1'));var path=require(_0x7e90('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e90('0x3'));var router=express[_0x7e90('0x4')]();var auth=require(_0x7e90('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7e90('0x6'));router[_0x7e90('0x7')]('/',auth[_0x7e90('0x8')](),controller[_0x7e90('0x9')]);router[_0x7e90('0x7')](_0x7e90('0xa'),auth[_0x7e90('0x8')](),controller['show']);router[_0x7e90('0x7')]('/:id/configurations',auth[_0x7e90('0x8')](),controller[_0x7e90('0xb')]);router[_0x7e90('0x7')](_0x7e90('0xc'),auth['isAuthenticated'](),controller[_0x7e90('0xd')]);router['post']('/',auth[_0x7e90('0x8')](),controller[_0x7e90('0xe')]);router[_0x7e90('0xf')](_0x7e90('0x10'),auth['isAuthenticated'](),controller[_0x7e90('0x11')]);router['put'](_0x7e90('0xa'),auth[_0x7e90('0x8')](),controller[_0x7e90('0x12')]);router[_0x7e90('0x13')](_0x7e90('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7e90('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 0d8c8d7..d88f482 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 _0x7292=['STRING','username','remoteUri','sequelize','exports'];(function(_0x21d2db,_0x54f820){var _0x46dfa3=function(_0x191a92){while(--_0x191a92){_0x21d2db['push'](_0x21d2db['shift']());}};_0x46dfa3(++_0x54f820);}(_0x7292,0x107));var _0x2729=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x7292[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x2729('0x0'));module[_0x2729('0x1')]={'name':{'type':Sequelize[_0x2729('0x2')]},'description':{'type':Sequelize[_0x2729('0x2')]},'username':{'type':Sequelize[_0x2729('0x2')],'unique':_0x2729('0x3')},'apiKey':{'type':Sequelize[_0x2729('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2729('0x4')},'serverUrl':{'type':Sequelize[_0x2729('0x2')]}}; \ No newline at end of file +var _0x9512=['username','remoteUri','sequelize','exports','STRING'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x9512,0x75));var _0x2951=function(_0x741334,_0x4dadd8){_0x741334=_0x741334-0x0;var _0x11f9e0=_0x9512[_0x741334];return _0x11f9e0;};'use strict';var Sequelize=require(_0x2951('0x0'));module[_0x2951('0x1')]={'name':{'type':Sequelize[_0x2951('0x2')]},'description':{'type':Sequelize[_0x2951('0x2')]},'username':{'type':Sequelize[_0x2951('0x2')],'unique':_0x2951('0x3')},'apiKey':{'type':Sequelize[_0x2951('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x2951('0x4')},'serverUrl':{'type':Sequelize[_0x2951('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 05d5d39..e1c0f50 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 _0x3466=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','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~!@#$%^&-_=+[{]}.','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','FreshsalesAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','apiKey','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials'];(function(_0x28b0f0,_0x28c940){var _0x4efe24=function(_0xb2b348){while(--_0xb2b348){_0x28b0f0['push'](_0x28b0f0['shift']());}};_0x4efe24(++_0x28c940);}(_0x3466,0x74));var _0x6346=function(_0x406cbe,_0x3cf075){_0x406cbe=_0x406cbe-0x0;var _0x1fb54a=_0x3466[_0x406cbe];return _0x1fb54a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6346('0x0'));var rimraf=require(_0x6346('0x1'));var zipdir=require(_0x6346('0x2'));var jsonpatch=require(_0x6346('0x3'));var rp=require(_0x6346('0x4'));var moment=require(_0x6346('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6346('0x6'));var util=require(_0x6346('0x7'));var path=require(_0x6346('0x8'));var sox=require(_0x6346('0x9'));var csv=require(_0x6346('0xa'));var ejs=require(_0x6346('0xb'));var fs=require('fs');var _=require(_0x6346('0xc'));var squel=require(_0x6346('0xd'));var crypto=require(_0x6346('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6346('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6346('0x10'));var Redis=require('ioredis');var authService=require(_0x6346('0x11'));var qs=require(_0x6346('0x12'));var as=require(_0x6346('0x13'));var hardwareService=require(_0x6346('0x14'));var logger=require(_0x6346('0x15'))(_0x6346('0x16'));var utils=require(_0x6346('0x17'));var config=require(_0x6346('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6346('0x19'));var jayson=require(_0x6346('0x1a'));var client=jayson[_0x6346('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x406a15,_0x5d968c,_0x24dfca){if(_0x24dfca){var _0x292b08=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x292b08['test'](_0x5d968c)){return _0x406a15;}else{throw new db['Sequelize'][(_0x6346('0x1c'))](_0x6346('0x1d'));}}else{return _0x406a15;}}function respondWithRpcPromise(_0x1685c5,_0x3381a9,_0x4c5b58,_0x678e7d){return new BPromise(function(_0x1d033e,_0x417099){var _0x41b34e=_0x678e7d||client;return _0x41b34e['request'](_0x1685c5,_0x4c5b58)[_0x6346('0x1e')](function(_0xe9ba48){logger[_0x6346('0x1f')](_0x6346('0x20'),_0x3381a9,_0x6346('0x21'));logger[_0x6346('0x22')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3381a9,_0x6346('0x21'),JSON['stringify'](_0xe9ba48));if(_0xe9ba48[_0x6346('0x23')]){if(_0xe9ba48[_0x6346('0x23')][_0x6346('0x24')]===0x1f4){logger['error'](_0x6346('0x20'),_0x3381a9,_0xe9ba48[_0x6346('0x23')][_0x6346('0x25')]);return _0x417099(_0xe9ba48[_0x6346('0x23')][_0x6346('0x25')]);}logger[_0x6346('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x3381a9,_0xe9ba48[_0x6346('0x23')]['message']);return _0x1d033e(_0xe9ba48[_0x6346('0x23')][_0x6346('0x25')]);}else{logger[_0x6346('0x1f')](_0x6346('0x20'),_0x3381a9,'request\x20sent');_0x1d033e(_0xe9ba48['result'][_0x6346('0x25')]);}})['catch'](function(_0x46208b){logger[_0x6346('0x23')](_0x6346('0x20'),_0x3381a9,_0x46208b);_0x417099(_0x46208b);});});}function respondWithStatusCode(_0xb3284e,_0x286385){_0x286385=_0x286385||0xcc;return function(_0x186274){if(_0x186274){return _0xb3284e[_0x6346('0x26')](_0x286385);}return _0xb3284e[_0x6346('0x27')](_0x286385)[_0x6346('0x28')]();};}function respondWithResult(_0x52b17a,_0x31d5d2){_0x31d5d2=_0x31d5d2||0xc8;return function(_0x7306da){if(_0x7306da){return _0x52b17a[_0x6346('0x27')](_0x31d5d2)[_0x6346('0x29')](_0x7306da);}};}function respondWithFilteredResult(_0x47dd3b,_0x589626){return function(_0x3f588b){if(_0x3f588b){var _0x30894b=_0x3f588b['count'],_0x39926a=_0x589626[_0x6346('0x2a')],_0x50a4fd=_0x589626[_0x6346('0x2a')]+_0x589626['limit'],_0x4e9d74;if(_0x50a4fd>=_0x30894b){_0x50a4fd=_0x30894b;_0x4e9d74=0xc8;}else{_0x4e9d74=0xce;}_0x47dd3b[_0x6346('0x27')](_0x4e9d74);return _0x47dd3b[_0x6346('0x2b')](_0x6346('0x2c'),_0x39926a+'-'+_0x50a4fd+'/'+_0x30894b)[_0x6346('0x29')](_0x3f588b);}return null;};}function patchUpdates(_0xb2b37a){return function(_0x55e7b2){try{jsonpatch[_0x6346('0x2d')](_0x55e7b2,_0xb2b37a,!![]);}catch(_0x5672c8){return BPromise[_0x6346('0x2e')](_0x5672c8);}return _0x55e7b2[_0x6346('0x2f')]();};}function saveUpdates(_0x29a8d3,_0x4c9bb5){return function(_0x4c72c3){if(_0x4c72c3){return _0x4c72c3[_0x6346('0x30')](_0x29a8d3)[_0x6346('0x1e')](function(_0x2edda1){return _0x2edda1;});}return null;};}function removeEntity(_0x2ad1f3,_0x551ff3){return function(_0x45e361){if(_0x45e361){return _0x45e361[_0x6346('0x31')]()[_0x6346('0x1e')](function(){_0x2ad1f3[_0x6346('0x27')](0xcc)[_0x6346('0x28')]();});}};}function handleEntityNotFound(_0x568462,_0x2ec3ba){return function(_0x432604){if(!_0x432604){_0x568462[_0x6346('0x26')](0x194);}return _0x432604;};}function handleError(_0x2c4e25,_0x2c5cad){_0x2c5cad=_0x2c5cad||0x1f4;return function(_0x1aa810){logger['error'](_0x1aa810[_0x6346('0x32')]);if(_0x1aa810[_0x6346('0x33')]){delete _0x1aa810['name'];}_0x2c4e25[_0x6346('0x27')](_0x2c5cad)['send'](_0x1aa810);};}exports[_0x6346('0x34')]=function(_0x42e79d,_0x455e5b){var _0x526452={},_0x9af1c={},_0x17c098={'count':0x0,'rows':[]};var _0x3ecd9f=_[_0x6346('0x35')](db[_0x6346('0x36')][_0x6346('0x37')],function(_0x4c97f7){return{'name':_0x4c97f7['fieldName'],'type':_0x4c97f7[_0x6346('0x38')]['key']};});_0x9af1c[_0x6346('0x39')]=_[_0x6346('0x35')](_0x3ecd9f,_0x6346('0x33'));_0x9af1c[_0x6346('0x3a')]=_[_0x6346('0x3b')](_0x42e79d[_0x6346('0x3a')]);_0x9af1c[_0x6346('0x3c')]=_[_0x6346('0x3d')](_0x9af1c[_0x6346('0x39')],_0x9af1c[_0x6346('0x3a')]);_0x526452['attributes']=_[_0x6346('0x3d')](_0x9af1c[_0x6346('0x39')],qs[_0x6346('0x3e')](_0x42e79d[_0x6346('0x3a')]['fields']));_0x526452['attributes']=_0x526452['attributes'][_0x6346('0x3f')]?_0x526452[_0x6346('0x40')]:_0x9af1c[_0x6346('0x39')];if(!_0x42e79d[_0x6346('0x3a')][_0x6346('0x41')](_0x6346('0x42'))){_0x526452[_0x6346('0x43')]=qs[_0x6346('0x43')](_0x42e79d[_0x6346('0x3a')][_0x6346('0x43')]);_0x526452['offset']=qs[_0x6346('0x2a')](_0x42e79d[_0x6346('0x3a')]['offset']);}_0x526452[_0x6346('0x44')]=qs[_0x6346('0x45')](_0x42e79d[_0x6346('0x3a')]['sort']);_0x526452['where']=qs[_0x6346('0x3c')](_['pick'](_0x42e79d[_0x6346('0x3a')],_0x9af1c[_0x6346('0x3c')]),_0x3ecd9f);if(_0x42e79d[_0x6346('0x3a')][_0x6346('0x46')]){_0x526452[_0x6346('0x47')]=_[_0x6346('0x48')](_0x526452['where'],{'$or':_[_0x6346('0x35')](_0x3ecd9f,function(_0x3bdbd2){if(_0x3bdbd2[_0x6346('0x38')]!==_0x6346('0x49')){var _0x3ebdec={};_0x3ebdec[_0x3bdbd2['name']]={'$like':'%'+_0x42e79d[_0x6346('0x3a')][_0x6346('0x46')]+'%'};return _0x3ebdec;}})});}_0x526452=_[_0x6346('0x48')]({},_0x526452,_0x42e79d[_0x6346('0x4a')]);var _0x3f671f={'where':_0x526452[_0x6346('0x47')]};return db['FreshsalesAccount'][_0x6346('0x4b')](_0x3f671f)['then'](function(_0x364d2d){_0x17c098['count']=_0x364d2d;if(_0x42e79d[_0x6346('0x3a')][_0x6346('0x4c')]){_0x526452[_0x6346('0x4d')]=[{'all':!![]}];}return db[_0x6346('0x36')][_0x6346('0x4e')](_0x526452);})['then'](function(_0x5be169){_0x17c098[_0x6346('0x4f')]=_0x5be169;return _0x17c098;})[_0x6346('0x1e')](respondWithFilteredResult(_0x455e5b,_0x526452))[_0x6346('0x50')](handleError(_0x455e5b,null));};exports[_0x6346('0x51')]=function(_0x45a945,_0x3ad6c6){var _0x2a5ed0={'raw':![],'where':{'id':_0x45a945[_0x6346('0x52')]['id']}},_0x5009c4={};_0x5009c4['model']=_['keys'](db[_0x6346('0x36')]['rawAttributes']);_0x5009c4[_0x6346('0x3a')]=_[_0x6346('0x3b')](_0x45a945[_0x6346('0x3a')]);_0x5009c4[_0x6346('0x3c')]=_['intersection'](_0x5009c4[_0x6346('0x39')],_0x5009c4[_0x6346('0x3a')]);_0x2a5ed0[_0x6346('0x40')]=_['intersection'](_0x5009c4['model'],qs[_0x6346('0x3e')](_0x45a945[_0x6346('0x3a')][_0x6346('0x3e')]));_0x2a5ed0[_0x6346('0x40')]=_0x2a5ed0['attributes'][_0x6346('0x3f')]?_0x2a5ed0['attributes']:_0x5009c4[_0x6346('0x39')];if(_0x45a945[_0x6346('0x3a')]['includeAll']){_0x2a5ed0['include']=[{'all':!![]}];}_0x2a5ed0=_[_0x6346('0x48')]({},_0x2a5ed0,_0x45a945[_0x6346('0x4a')]);return db['FreshsalesAccount'][_0x6346('0x53')](_0x2a5ed0)['then'](handleEntityNotFound(_0x3ad6c6,null))[_0x6346('0x1e')](respondWithResult(_0x3ad6c6,null))['catch'](handleError(_0x3ad6c6,null));};exports[_0x6346('0x54')]=function(_0x34938e,_0x450a20){return db[_0x6346('0x36')]['create'](_0x34938e[_0x6346('0x55')],{})[_0x6346('0x1e')](respondWithResult(_0x450a20,0xc9))['catch'](handleError(_0x450a20,null));};exports[_0x6346('0x30')]=function(_0xf5d57c,_0x5564aa){if(_0xf5d57c[_0x6346('0x55')]['id']){delete _0xf5d57c[_0x6346('0x55')]['id'];}return db[_0x6346('0x36')][_0x6346('0x53')]({'where':{'id':_0xf5d57c[_0x6346('0x52')]['id']}})['then'](handleEntityNotFound(_0x5564aa,null))[_0x6346('0x1e')](saveUpdates(_0xf5d57c[_0x6346('0x55')],null))[_0x6346('0x1e')](respondWithResult(_0x5564aa,null))[_0x6346('0x50')](handleError(_0x5564aa,null));};exports['destroy']=function(_0x5f2b2d,_0x5e2f35){return db['FreshsalesAccount']['find']({'where':{'id':_0x5f2b2d[_0x6346('0x52')]['id']}})[_0x6346('0x1e')](handleEntityNotFound(_0x5e2f35,null))[_0x6346('0x1e')](removeEntity(_0x5e2f35,null))[_0x6346('0x50')](handleError(_0x5e2f35,null));};exports[_0x6346('0x56')]=function(_0x408d66,_0x286cf4,_0x431fb4){var _0x4a3e9a={};var _0x3f2d95={};var _0x15daa2;var _0x3cd747;return db[_0x6346('0x36')][_0x6346('0x57')]({'where':{'id':_0x408d66[_0x6346('0x52')]['id']}})[_0x6346('0x1e')](handleEntityNotFound(_0x286cf4,null))[_0x6346('0x1e')](function(_0x3a7216){if(_0x3a7216){_0x15daa2=_0x3a7216;_0x3f2d95[_0x6346('0x39')]=_[_0x6346('0x3b')](db[_0x6346('0x58')][_0x6346('0x37')]);_0x3f2d95[_0x6346('0x3a')]=_[_0x6346('0x3b')](_0x408d66[_0x6346('0x3a')]);_0x3f2d95['filters']=_[_0x6346('0x3d')](_0x3f2d95[_0x6346('0x39')],_0x3f2d95['query']);_0x4a3e9a[_0x6346('0x40')]=_[_0x6346('0x3d')](_0x3f2d95[_0x6346('0x39')],qs[_0x6346('0x3e')](_0x408d66[_0x6346('0x3a')][_0x6346('0x3e')]));_0x4a3e9a[_0x6346('0x40')]=_0x4a3e9a[_0x6346('0x40')][_0x6346('0x3f')]?_0x4a3e9a[_0x6346('0x40')]:_0x3f2d95[_0x6346('0x39')];_0x4a3e9a[_0x6346('0x44')]=qs['sort'](_0x408d66[_0x6346('0x3a')][_0x6346('0x45')]);_0x4a3e9a['where']=qs['filters'](_['pick'](_0x408d66[_0x6346('0x3a')],_0x3f2d95[_0x6346('0x3c')]));if(_0x408d66[_0x6346('0x3a')][_0x6346('0x46')]){_0x4a3e9a['where']=_[_0x6346('0x48')](_0x4a3e9a['where'],{'$or':_[_0x6346('0x35')](_0x4a3e9a[_0x6346('0x40')],function(_0x47d6ab){var _0x2049ac={};_0x2049ac[_0x47d6ab]={'$like':'%'+_0x408d66[_0x6346('0x3a')][_0x6346('0x46')]+'%'};return _0x2049ac;})});}_0x4a3e9a=_[_0x6346('0x48')]({},_0x4a3e9a,_0x408d66[_0x6346('0x4a')]);return _0x15daa2[_0x6346('0x56')](_0x4a3e9a);}})[_0x6346('0x1e')](function(_0x28134c){if(_0x28134c){_0x3cd747=_0x28134c[_0x6346('0x3f')];if(!_0x408d66[_0x6346('0x3a')][_0x6346('0x41')](_0x6346('0x42'))){_0x4a3e9a[_0x6346('0x43')]=qs[_0x6346('0x43')](_0x408d66['query'][_0x6346('0x43')]);_0x4a3e9a['offset']=qs[_0x6346('0x2a')](_0x408d66[_0x6346('0x3a')]['offset']);}return _0x15daa2[_0x6346('0x56')](_0x4a3e9a);}})[_0x6346('0x1e')](function(_0x2b7c8e){if(_0x2b7c8e){return _0x2b7c8e?{'count':_0x3cd747,'rows':_0x2b7c8e}:null;}})[_0x6346('0x1e')](respondWithResult(_0x286cf4,null))[_0x6346('0x50')](handleError(_0x286cf4,null));};exports[_0x6346('0x59')]=function(_0x586075,_0x441709,_0x103b01){if(_0x586075['body']['id']){delete _0x586075[_0x6346('0x55')]['id'];}return db[_0x6346('0x36')]['findOne']({'where':{'id':_0x586075['params']['id']}})[_0x6346('0x1e')](handleEntityNotFound(_0x441709,null))[_0x6346('0x1e')](function(_0x524b76){if(_0x524b76){_0x586075['body'][_0x6346('0x5a')]=_0x524b76['id'];_0x586075[_0x6346('0x55')][_0x6346('0x5b')]=integrations[_0x6346('0x5c')](_0x586075['body']['channel'],_0x586075[_0x6346('0x55')]['type']);_0x586075[_0x6346('0x55')][_0x6346('0x5d')]=integrations[_0x6346('0x5e')](_0x586075['body'][_0x6346('0x5f')],_0x586075[_0x6346('0x55')][_0x6346('0x38')]);return db[_0x6346('0x58')][_0x6346('0x54')](_0x586075[_0x6346('0x55')],{'include':[{'model':db[_0x6346('0x60')],'as':_0x6346('0x5b')},{'model':db[_0x6346('0x60')],'as':'Descriptions'}]});}return null;})[_0x6346('0x1e')](respondWithResult(_0x441709,null))[_0x6346('0x50')](handleError(_0x441709,null));};exports[_0x6346('0x61')]=function(_0x1be0a0,_0x15bb4f,_0x30ebba){var _0x4d58ff='';var _0x242c11='';return db[_0x6346('0x36')][_0x6346('0x57')]({'where':{'id':_0x1be0a0[_0x6346('0x52')]['id']},'attributes':['id',_0x6346('0x62'),'remoteUri',_0x6346('0x63')]})[_0x6346('0x1e')](handleEntityNotFound(_0x15bb4f,null))[_0x6346('0x1e')](function(_0x3b63c6){if(_0x3b63c6){_0x242c11=_0x3b63c6[_0x6346('0x62')];_0x4d58ff=_0x3b63c6[_0x6346('0x64')];var _0x54f6bb=_0x3b63c6[_0x6346('0x64')]['slice'](-0x1);if(_0x54f6bb==='/'){_0x4d58ff=_0x4d58ff[_0x6346('0x65')](0x0,_0x4d58ff[_0x6346('0x66')](_0x54f6bb));}return rp({'method':_0x6346('0x67'),'uri':util[_0x6346('0x68')](_0x6346('0x69'),_0x4d58ff,_0x6346('0x6a')),'headers':{'Authorization':_0x6346('0x6b')+_0x3b63c6[_0x6346('0x63')]},'json':!![]});}})[_0x6346('0x1e')](function(_0x21b633){if(_0x21b633){var _0x37084b=_0x21b633[_0x6346('0x6c')];var _0x25e3e5=![];var _0x18ce25=null;for(_0x18ce25=0x0;_0x18ce25<_0x37084b[_0x6346('0x3f')];_0x18ce25++){if(_0x37084b[_0x18ce25][_0x6346('0x6d')]===_0x242c11){_0x25e3e5=!![];}}if(_0x25e3e5){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x6346('0x1e')](respondWithResult(_0x15bb4f,null))[_0x6346('0x50')](function(_0x1a12fb){var _0x1d29da=_0x1be0a0[_0x6346('0x3a')][_0x6346('0x6e')]?0x1f4:_0x1a12fb[_0x6346('0x6f')]||0x1f4;logger[_0x6346('0x23')](_0x6346('0x70'),_0x6346('0x61'),_0x1d29da,JSON[_0x6346('0x71')](_0x1a12fb));delete _0x1a12fb[_0x6346('0x33')];if(_0x1d29da===0x191){_0x1d29da=0x190;}_0x15bb4f[_0x6346('0x27')](_0x1d29da)[_0x6346('0x72')](_0x1be0a0[_0x6346('0x3a')]['test']?{'message':_0x6346('0x73'),'statusCode':_0x1a12fb[_0x6346('0x6f')]}:_0x1a12fb);});}; \ No newline at end of file +var _0x50e3=['../../config/environment','../../mysqldb','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','end','status','json','count','offset','limit','apply','reject','save','update','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','params','length','include','find','create','body','destroy','getConfigurations','FreshsalesConfiguration','pick','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','apiKey','remoteUri','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x461939,_0x1c936a){var _0x224004=function(_0x419960){while(--_0x419960){_0x461939['push'](_0x461939['shift']());}};_0x224004(++_0x1c936a);}(_0x50e3,0x130));var _0x350e=function(_0x24c334,_0x345665){_0x24c334=_0x24c334-0x0;var _0x549102=_0x50e3[_0x24c334];return _0x549102;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x350e('0x0'));var rimraf=require(_0x350e('0x1'));var zipdir=require(_0x350e('0x2'));var jsonpatch=require(_0x350e('0x3'));var rp=require(_0x350e('0x4'));var moment=require(_0x350e('0x5'));var BPromise=require(_0x350e('0x6'));var Mustache=require(_0x350e('0x7'));var util=require(_0x350e('0x8'));var path=require('path');var sox=require(_0x350e('0x9'));var csv=require(_0x350e('0xa'));var ejs=require(_0x350e('0xb'));var fs=require('fs');var _=require(_0x350e('0xc'));var squel=require(_0x350e('0xd'));var crypto=require('crypto');var jsforce=require(_0x350e('0xe'));var deskjs=require(_0x350e('0xf'));var toCsv=require(_0x350e('0xa'));var querystring=require(_0x350e('0x10'));var Papa=require(_0x350e('0x11'));var Redis=require('ioredis');var authService=require(_0x350e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x350e('0x13'));var logger=require(_0x350e('0x14'))(_0x350e('0x15'));var utils=require(_0x350e('0x16'));var config=require(_0x350e('0x17'));var db=require(_0x350e('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x350e('0x19'));var client=jayson[_0x350e('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x402741,_0x485788,_0x5da67c){if(_0x5da67c){var _0x283ab5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x283ab5[_0x350e('0x1b')](_0x485788)){return _0x402741;}else{throw new db['Sequelize']['ValidationError'](_0x350e('0x1c'));}}else{return _0x402741;}}function respondWithRpcPromise(_0x4d981a,_0x3cfa71,_0x3ee7e7,_0x2a71ec){return new BPromise(function(_0x56aaed,_0x364bd3){var _0x2cf4c6=_0x2a71ec||client;return _0x2cf4c6['request'](_0x4d981a,_0x3ee7e7)[_0x350e('0x1d')](function(_0x5edcee){logger[_0x350e('0x1e')](_0x350e('0x1f'),_0x3cfa71,_0x350e('0x20'));logger[_0x350e('0x21')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3cfa71,_0x350e('0x20'),JSON[_0x350e('0x22')](_0x5edcee));if(_0x5edcee[_0x350e('0x23')]){if(_0x5edcee[_0x350e('0x23')][_0x350e('0x24')]===0x1f4){logger[_0x350e('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x3cfa71,_0x5edcee[_0x350e('0x23')][_0x350e('0x25')]);return _0x364bd3(_0x5edcee[_0x350e('0x23')][_0x350e('0x25')]);}logger[_0x350e('0x23')](_0x350e('0x1f'),_0x3cfa71,_0x5edcee[_0x350e('0x23')]['message']);return _0x56aaed(_0x5edcee[_0x350e('0x23')][_0x350e('0x25')]);}else{logger['info'](_0x350e('0x1f'),_0x3cfa71,'request\x20sent');_0x56aaed(_0x5edcee['result'][_0x350e('0x25')]);}})[_0x350e('0x26')](function(_0x398633){logger['error'](_0x350e('0x1f'),_0x3cfa71,_0x398633);_0x364bd3(_0x398633);});});}function respondWithStatusCode(_0x17c85d,_0x1622b4){_0x1622b4=_0x1622b4||0xcc;return function(_0x4534f5){if(_0x4534f5){return _0x17c85d['sendStatus'](_0x1622b4);}return _0x17c85d['status'](_0x1622b4)[_0x350e('0x27')]();};}function respondWithResult(_0x4c20c0,_0x3be0d0){_0x3be0d0=_0x3be0d0||0xc8;return function(_0x22718d){if(_0x22718d){return _0x4c20c0[_0x350e('0x28')](_0x3be0d0)[_0x350e('0x29')](_0x22718d);}};}function respondWithFilteredResult(_0xfe7fc2,_0x2d90a6){return function(_0x186fc5){if(_0x186fc5){var _0x5a41c5=_0x186fc5[_0x350e('0x2a')],_0x3568fe=_0x2d90a6[_0x350e('0x2b')],_0x473e5d=_0x2d90a6['offset']+_0x2d90a6[_0x350e('0x2c')],_0x595269;if(_0x473e5d>=_0x5a41c5){_0x473e5d=_0x5a41c5;_0x595269=0xc8;}else{_0x595269=0xce;}_0xfe7fc2[_0x350e('0x28')](_0x595269);return _0xfe7fc2['set']('Content-Range',_0x3568fe+'-'+_0x473e5d+'/'+_0x5a41c5)[_0x350e('0x29')](_0x186fc5);}return null;};}function patchUpdates(_0x4ed4df){return function(_0x901d20){try{jsonpatch[_0x350e('0x2d')](_0x901d20,_0x4ed4df,!![]);}catch(_0x5116fa){return BPromise[_0x350e('0x2e')](_0x5116fa);}return _0x901d20[_0x350e('0x2f')]();};}function saveUpdates(_0x1a21ac,_0x320a16){return function(_0xc262d7){if(_0xc262d7){return _0xc262d7[_0x350e('0x30')](_0x1a21ac)[_0x350e('0x1d')](function(_0x52e54d){return _0x52e54d;});}return null;};}function removeEntity(_0x43b621,_0xb6192d){return function(_0x5c44fb){if(_0x5c44fb){return _0x5c44fb['destroy']()['then'](function(){_0x43b621['status'](0xcc)[_0x350e('0x27')]();});}};}function handleEntityNotFound(_0x5ef0dd,_0x11ac1e){return function(_0x1cc179){if(!_0x1cc179){_0x5ef0dd[_0x350e('0x31')](0x194);}return _0x1cc179;};}function handleError(_0x4468c0,_0x5c49f2){_0x5c49f2=_0x5c49f2||0x1f4;return function(_0x382485){logger[_0x350e('0x23')](_0x382485[_0x350e('0x32')]);if(_0x382485['name']){delete _0x382485[_0x350e('0x33')];}_0x4468c0[_0x350e('0x28')](_0x5c49f2)[_0x350e('0x34')](_0x382485);};}exports[_0x350e('0x35')]=function(_0x225b3c,_0x300dca){var _0x1690bc={},_0x44dd23={},_0x20ab41={'count':0x0,'rows':[]};var _0x329237=_[_0x350e('0x36')](db[_0x350e('0x37')][_0x350e('0x38')],function(_0x1adc4f){return{'name':_0x1adc4f[_0x350e('0x39')],'type':_0x1adc4f[_0x350e('0x3a')][_0x350e('0x3b')]};});_0x44dd23[_0x350e('0x3c')]=_[_0x350e('0x36')](_0x329237,_0x350e('0x33'));_0x44dd23['query']=_[_0x350e('0x3d')](_0x225b3c[_0x350e('0x3e')]);_0x44dd23['filters']=_['intersection'](_0x44dd23[_0x350e('0x3c')],_0x44dd23['query']);_0x1690bc[_0x350e('0x3f')]=_[_0x350e('0x40')](_0x44dd23[_0x350e('0x3c')],qs['fields'](_0x225b3c[_0x350e('0x3e')][_0x350e('0x41')]));_0x1690bc[_0x350e('0x3f')]=_0x1690bc[_0x350e('0x3f')]['length']?_0x1690bc[_0x350e('0x3f')]:_0x44dd23['model'];if(!_0x225b3c['query'][_0x350e('0x42')](_0x350e('0x43'))){_0x1690bc[_0x350e('0x2c')]=qs[_0x350e('0x2c')](_0x225b3c['query'][_0x350e('0x2c')]);_0x1690bc[_0x350e('0x2b')]=qs['offset'](_0x225b3c[_0x350e('0x3e')]['offset']);}_0x1690bc[_0x350e('0x44')]=qs[_0x350e('0x45')](_0x225b3c[_0x350e('0x3e')][_0x350e('0x45')]);_0x1690bc[_0x350e('0x46')]=qs[_0x350e('0x47')](_['pick'](_0x225b3c[_0x350e('0x3e')],_0x44dd23[_0x350e('0x47')]),_0x329237);if(_0x225b3c[_0x350e('0x3e')][_0x350e('0x48')]){_0x1690bc[_0x350e('0x46')]=_[_0x350e('0x49')](_0x1690bc['where'],{'$or':_[_0x350e('0x36')](_0x329237,function(_0xad715a){if(_0xad715a[_0x350e('0x3a')]!==_0x350e('0x4a')){var _0x3f897c={};_0x3f897c[_0xad715a[_0x350e('0x33')]]={'$like':'%'+_0x225b3c['query'][_0x350e('0x48')]+'%'};return _0x3f897c;}})});}_0x1690bc=_[_0x350e('0x49')]({},_0x1690bc,_0x225b3c[_0x350e('0x4b')]);var _0x7e6327={'where':_0x1690bc[_0x350e('0x46')]};return db[_0x350e('0x37')]['count'](_0x7e6327)['then'](function(_0x1a8dfb){_0x20ab41[_0x350e('0x2a')]=_0x1a8dfb;if(_0x225b3c[_0x350e('0x3e')][_0x350e('0x4c')]){_0x1690bc['include']=[{'all':!![]}];}return db[_0x350e('0x37')]['findAll'](_0x1690bc);})[_0x350e('0x1d')](function(_0x5e19a8){_0x20ab41[_0x350e('0x4d')]=_0x5e19a8;return _0x20ab41;})[_0x350e('0x1d')](respondWithFilteredResult(_0x300dca,_0x1690bc))['catch'](handleError(_0x300dca,null));};exports['show']=function(_0x175c23,_0x2685ad){var _0x2cfac0={'raw':![],'where':{'id':_0x175c23[_0x350e('0x4e')]['id']}},_0x619008={};_0x619008[_0x350e('0x3c')]=_[_0x350e('0x3d')](db[_0x350e('0x37')][_0x350e('0x38')]);_0x619008[_0x350e('0x3e')]=_[_0x350e('0x3d')](_0x175c23[_0x350e('0x3e')]);_0x619008[_0x350e('0x47')]=_[_0x350e('0x40')](_0x619008[_0x350e('0x3c')],_0x619008[_0x350e('0x3e')]);_0x2cfac0['attributes']=_[_0x350e('0x40')](_0x619008[_0x350e('0x3c')],qs[_0x350e('0x41')](_0x175c23[_0x350e('0x3e')][_0x350e('0x41')]));_0x2cfac0[_0x350e('0x3f')]=_0x2cfac0[_0x350e('0x3f')][_0x350e('0x4f')]?_0x2cfac0[_0x350e('0x3f')]:_0x619008[_0x350e('0x3c')];if(_0x175c23['query'][_0x350e('0x4c')]){_0x2cfac0[_0x350e('0x50')]=[{'all':!![]}];}_0x2cfac0=_[_0x350e('0x49')]({},_0x2cfac0,_0x175c23['options']);return db[_0x350e('0x37')][_0x350e('0x51')](_0x2cfac0)[_0x350e('0x1d')](handleEntityNotFound(_0x2685ad,null))[_0x350e('0x1d')](respondWithResult(_0x2685ad,null))['catch'](handleError(_0x2685ad,null));};exports[_0x350e('0x52')]=function(_0x100030,_0x416b3a){return db[_0x350e('0x37')][_0x350e('0x52')](_0x100030['body'],{})['then'](respondWithResult(_0x416b3a,0xc9))[_0x350e('0x26')](handleError(_0x416b3a,null));};exports['update']=function(_0xe7ce3f,_0x53a28b){if(_0xe7ce3f['body']['id']){delete _0xe7ce3f[_0x350e('0x53')]['id'];}return db[_0x350e('0x37')][_0x350e('0x51')]({'where':{'id':_0xe7ce3f[_0x350e('0x4e')]['id']}})[_0x350e('0x1d')](handleEntityNotFound(_0x53a28b,null))['then'](saveUpdates(_0xe7ce3f[_0x350e('0x53')],null))[_0x350e('0x1d')](respondWithResult(_0x53a28b,null))['catch'](handleError(_0x53a28b,null));};exports[_0x350e('0x54')]=function(_0x598de5,_0x5984f4){return db['FreshsalesAccount'][_0x350e('0x51')]({'where':{'id':_0x598de5[_0x350e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5984f4,null))[_0x350e('0x1d')](removeEntity(_0x5984f4,null))[_0x350e('0x26')](handleError(_0x5984f4,null));};exports[_0x350e('0x55')]=function(_0x59ae53,_0x4aeb5e,_0x530d33){var _0x25ef06={};var _0x38901f={};var _0x35ec4c;var _0xca60fa;return db[_0x350e('0x37')]['findOne']({'where':{'id':_0x59ae53[_0x350e('0x4e')]['id']}})[_0x350e('0x1d')](handleEntityNotFound(_0x4aeb5e,null))[_0x350e('0x1d')](function(_0x69dc0b){if(_0x69dc0b){_0x35ec4c=_0x69dc0b;_0x38901f['model']=_[_0x350e('0x3d')](db[_0x350e('0x56')]['rawAttributes']);_0x38901f[_0x350e('0x3e')]=_[_0x350e('0x3d')](_0x59ae53[_0x350e('0x3e')]);_0x38901f[_0x350e('0x47')]=_[_0x350e('0x40')](_0x38901f[_0x350e('0x3c')],_0x38901f[_0x350e('0x3e')]);_0x25ef06[_0x350e('0x3f')]=_[_0x350e('0x40')](_0x38901f[_0x350e('0x3c')],qs[_0x350e('0x41')](_0x59ae53[_0x350e('0x3e')]['fields']));_0x25ef06['attributes']=_0x25ef06[_0x350e('0x3f')][_0x350e('0x4f')]?_0x25ef06['attributes']:_0x38901f[_0x350e('0x3c')];_0x25ef06[_0x350e('0x44')]=qs[_0x350e('0x45')](_0x59ae53[_0x350e('0x3e')][_0x350e('0x45')]);_0x25ef06['where']=qs[_0x350e('0x47')](_[_0x350e('0x57')](_0x59ae53[_0x350e('0x3e')],_0x38901f[_0x350e('0x47')]));if(_0x59ae53['query']['filter']){_0x25ef06[_0x350e('0x46')]=_[_0x350e('0x49')](_0x25ef06[_0x350e('0x46')],{'$or':_[_0x350e('0x36')](_0x25ef06[_0x350e('0x3f')],function(_0x589ab2){var _0x226e94={};_0x226e94[_0x589ab2]={'$like':'%'+_0x59ae53[_0x350e('0x3e')][_0x350e('0x48')]+'%'};return _0x226e94;})});}_0x25ef06=_[_0x350e('0x49')]({},_0x25ef06,_0x59ae53[_0x350e('0x4b')]);return _0x35ec4c[_0x350e('0x55')](_0x25ef06);}})[_0x350e('0x1d')](function(_0x493416){if(_0x493416){_0xca60fa=_0x493416['length'];if(!_0x59ae53[_0x350e('0x3e')][_0x350e('0x42')]('nolimit')){_0x25ef06[_0x350e('0x2c')]=qs[_0x350e('0x2c')](_0x59ae53['query'][_0x350e('0x2c')]);_0x25ef06[_0x350e('0x2b')]=qs[_0x350e('0x2b')](_0x59ae53[_0x350e('0x3e')][_0x350e('0x2b')]);}return _0x35ec4c[_0x350e('0x55')](_0x25ef06);}})['then'](function(_0x2ae576){if(_0x2ae576){return _0x2ae576?{'count':_0xca60fa,'rows':_0x2ae576}:null;}})[_0x350e('0x1d')](respondWithResult(_0x4aeb5e,null))[_0x350e('0x26')](handleError(_0x4aeb5e,null));};exports['addConfiguration']=function(_0x1fe0f1,_0x558b7d,_0x52659a){if(_0x1fe0f1[_0x350e('0x53')]['id']){delete _0x1fe0f1[_0x350e('0x53')]['id'];}return db[_0x350e('0x37')][_0x350e('0x58')]({'where':{'id':_0x1fe0f1[_0x350e('0x4e')]['id']}})[_0x350e('0x1d')](handleEntityNotFound(_0x558b7d,null))[_0x350e('0x1d')](function(_0x5439db){if(_0x5439db){_0x1fe0f1[_0x350e('0x53')]['AccountId']=_0x5439db['id'];_0x1fe0f1[_0x350e('0x53')][_0x350e('0x59')]=integrations[_0x350e('0x5a')](_0x1fe0f1['body'][_0x350e('0x5b')],_0x1fe0f1[_0x350e('0x53')][_0x350e('0x3a')]);_0x1fe0f1[_0x350e('0x53')][_0x350e('0x5c')]=integrations[_0x350e('0x5d')](_0x1fe0f1[_0x350e('0x53')]['channel'],_0x1fe0f1[_0x350e('0x53')][_0x350e('0x3a')]);return db[_0x350e('0x56')]['create'](_0x1fe0f1['body'],{'include':[{'model':db[_0x350e('0x5e')],'as':_0x350e('0x59')},{'model':db[_0x350e('0x5e')],'as':_0x350e('0x5c')}]});}return null;})[_0x350e('0x1d')](respondWithResult(_0x558b7d,null))[_0x350e('0x26')](handleError(_0x558b7d,null));};exports['getFields']=function(_0x11fac7,_0x130f95,_0x34ae25){var _0xd0011d='';var _0x3fff6b='';return db[_0x350e('0x37')][_0x350e('0x58')]({'where':{'id':_0x11fac7['params']['id']},'attributes':['id','username','remoteUri',_0x350e('0x5f')]})[_0x350e('0x1d')](handleEntityNotFound(_0x130f95,null))[_0x350e('0x1d')](function(_0x428fdd){if(_0x428fdd){_0x3fff6b=_0x428fdd['username'];_0xd0011d=_0x428fdd[_0x350e('0x60')];var _0x503116=_0x428fdd[_0x350e('0x60')][_0x350e('0x61')](-0x1);if(_0x503116==='/'){_0xd0011d=_0xd0011d[_0x350e('0x62')](0x0,_0xd0011d[_0x350e('0x63')](_0x503116));}return rp({'method':_0x350e('0x64'),'uri':util['format'](_0x350e('0x65'),_0xd0011d,_0x350e('0x66')),'headers':{'Authorization':_0x350e('0x67')+_0x428fdd[_0x350e('0x5f')]},'json':!![]});}})['then'](function(_0x154fe4){if(_0x154fe4){var _0x396fa8=_0x154fe4[_0x350e('0x68')];var _0x31c536=![];var _0x4eef2f=null;for(_0x4eef2f=0x0;_0x4eef2f<_0x396fa8[_0x350e('0x4f')];_0x4eef2f++){if(_0x396fa8[_0x4eef2f]['email']===_0x3fff6b){_0x31c536=!![];}}if(_0x31c536){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x130f95,null))[_0x350e('0x26')](function(_0x1e927a){var _0x362b80=_0x11fac7[_0x350e('0x3e')][_0x350e('0x1b')]?0x1f4:_0x1e927a[_0x350e('0x69')]||0x1f4;logger[_0x350e('0x23')](_0x350e('0x6a'),_0x350e('0x6b'),_0x362b80,JSON[_0x350e('0x22')](_0x1e927a));delete _0x1e927a[_0x350e('0x33')];if(_0x362b80===0x191){_0x362b80=0x190;}_0x130f95['status'](_0x362b80)['send'](_0x11fac7[_0x350e('0x3e')][_0x350e('0x1b')]?{'message':_0x350e('0x6c'),'statusCode':_0x1e927a[_0x350e('0x69')]}:_0x1e927a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c00fe58..985a455 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 _0x9ef6=['exports','define','int_freshsales_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x32238b,_0x378a44){var _0x18dd50=function(_0x4acab0){while(--_0x4acab0){_0x32238b['push'](_0x32238b['shift']());}};_0x18dd50(++_0x378a44);}(_0x9ef6,0x1ca));var _0x69ef=function(_0x3a5da5,_0x58eaa0){_0x3a5da5=_0x3a5da5-0x0;var _0x2de0e5=_0x9ef6[_0x3a5da5];return _0x2de0e5;};'use strict';var _=require(_0x69ef('0x0'));var util=require(_0x69ef('0x1'));var logger=require('../../config/logger')(_0x69ef('0x2'));var moment=require(_0x69ef('0x3'));var BPromise=require(_0x69ef('0x4'));var rp=require(_0x69ef('0x5'));var fs=require('fs');var path=require(_0x69ef('0x6'));var rimraf=require(_0x69ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x69ef('0x8'));var integrations=require(_0x69ef('0x9'));module[_0x69ef('0xa')]=function(_0x390df5,_0x597c24){return _0x390df5[_0x69ef('0xb')]('FreshsalesAccount',attributes,{'tableName':_0x69ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45c2=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x4c0791,_0xbd52a0){var _0x1746e9=function(_0x5dc318){while(--_0x5dc318){_0x4c0791['push'](_0x4c0791['shift']());}};_0x1746e9(++_0xbd52a0);}(_0x45c2,0x68));var _0x245c=function(_0x4f67a2,_0x273325){_0x4f67a2=_0x4f67a2-0x0;var _0x42beb3=_0x45c2[_0x4f67a2];return _0x42beb3;};'use strict';var _=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var logger=require(_0x245c('0x2'))(_0x245c('0x3'));var moment=require('moment');var BPromise=require(_0x245c('0x4'));var rp=require(_0x245c('0x5'));var fs=require('fs');var path=require(_0x245c('0x6'));var rimraf=require('rimraf');var config=require(_0x245c('0x7'));var attributes=require(_0x245c('0x8'));var integrations=require(_0x245c('0x9'));module[_0x245c('0xa')]=function(_0x11a37e,_0x2e1860){return _0x11a37e[_0x245c('0xb')](_0x245c('0xc'),attributes,{'tableName':_0x245c('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 2ea239d..398d06e 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 _0x7753=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','findAll','options','raw','where','limit','map','include','attributes','model','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x19cf66,_0x463e32){var _0x123c8a=function(_0x5256fe){while(--_0x5256fe){_0x19cf66['push'](_0x19cf66['shift']());}};_0x123c8a(++_0x463e32);}(_0x7753,0xfd));var _0x3775=function(_0x1b5a5a,_0x1c3b75){_0x1b5a5a=_0x1b5a5a-0x0;var _0x42b32d=_0x7753[_0x1b5a5a];return _0x42b32d;};'use strict';var _=require(_0x3775('0x0'));var util=require(_0x3775('0x1'));var moment=require(_0x3775('0x2'));var BPromise=require(_0x3775('0x3'));var rs=require(_0x3775('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3775('0x5'))['db'];var utils=require(_0x3775('0x6'));var logger=require(_0x3775('0x7'))('rpc');var config=require(_0x3775('0x8'));var jayson=require(_0x3775('0x9'));var client=jayson['client'][_0x3775('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1daf10,_0x515eec,_0x55077d){return new BPromise(function(_0x3b6f9a,_0x1a90fe){return client[_0x3775('0xb')](_0x1daf10,_0x55077d)[_0x3775('0xc')](function(_0x33223e){logger['info'](_0x3775('0xd'),_0x515eec,_0x3775('0xe'));logger[_0x3775('0xf')](_0x3775('0x10'),_0x515eec,_0x3775('0xe'),JSON[_0x3775('0x11')](_0x33223e));if(_0x33223e['error']){if(_0x33223e[_0x3775('0x12')][_0x3775('0x13')]===0x1f4){logger[_0x3775('0x12')](_0x3775('0xd'),_0x515eec,_0x33223e['error'][_0x3775('0x14')]);return _0x1a90fe(_0x33223e['error'][_0x3775('0x14')]);}logger[_0x3775('0x12')](_0x3775('0xd'),_0x515eec,_0x33223e['error'][_0x3775('0x14')]);return _0x3b6f9a(_0x33223e['error']['message']);}else{logger[_0x3775('0x15')](_0x3775('0xd'),_0x515eec,_0x3775('0xe'));_0x3b6f9a(_0x33223e[_0x3775('0x16')][_0x3775('0x14')]);}})[_0x3775('0x17')](function(_0x40f44b){logger[_0x3775('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x515eec,_0x40f44b);_0x1a90fe(_0x40f44b);});});}exports[_0x3775('0x18')]=function(_0x4a149d){var _0x352cfd=this;return new Promise(function(_0x307a80,_0x3d94b3){return db['FreshsalesAccount'][_0x3775('0x19')]({'raw':_0x4a149d[_0x3775('0x1a')]?_0x4a149d[_0x3775('0x1a')][_0x3775('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a149d[_0x3775('0x1a')]?_0x4a149d[_0x3775('0x1a')][_0x3775('0x1c')]||null:null,'attributes':_0x4a149d[_0x3775('0x1a')]?_0x4a149d[_0x3775('0x1a')]['attributes']||null:null,'limit':_0x4a149d[_0x3775('0x1a')]?_0x4a149d[_0x3775('0x1a')][_0x3775('0x1d')]||null:null,'include':_0x4a149d[_0x3775('0x1a')]?_0x4a149d['options']['include']?_[_0x3775('0x1e')](_0x4a149d[_0x3775('0x1a')][_0x3775('0x1f')],function(_0x57dbb1){return{'model':db[_0x57dbb1['model']],'as':_0x57dbb1['as'],'attributes':_0x57dbb1[_0x3775('0x20')],'include':_0x57dbb1[_0x3775('0x1f')]?_[_0x3775('0x1e')](_0x57dbb1['include'],function(_0xd6e1e3){return{'model':db[_0xd6e1e3[_0x3775('0x21')]],'as':_0xd6e1e3['as'],'attributes':_0xd6e1e3[_0x3775('0x20')],'include':_0xd6e1e3['include']?_[_0x3775('0x1e')](_0xd6e1e3['include'],function(_0x3bb405){return{'model':db[_0x3bb405['model']],'as':_0x3bb405['as'],'attributes':_0x3bb405[_0x3775('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x431629){logger[_0x3775('0x15')](_0x3775('0x18'),_0x4a149d);logger[_0x3775('0xf')]('GetFreshsalesAccount',_0x4a149d,JSON[_0x3775('0x11')](_0x431629));_0x307a80(_0x431629);})[_0x3775('0x17')](function(_0x1361b0){logger[_0x3775('0x12')](_0x3775('0x18'),_0x1361b0[_0x3775('0x14')],_0x4a149d);_0x3d94b3(_0x352cfd[_0x3775('0x12')](0x1f4,_0x1361b0[_0x3775('0x14')]));});});};exports[_0x3775('0x22')]=function(_0x53b002){var _0x4904b6=this;return new Promise(function(_0x3f39d2,_0x331b81){return db[_0x3775('0x23')][_0x3775('0x24')]({'raw':_0x53b002[_0x3775('0x1a')]?_0x53b002[_0x3775('0x1a')][_0x3775('0x1b')]===undefined?!![]:![]:!![],'where':_0x53b002['options']?_0x53b002[_0x3775('0x1a')]['where']||null:null,'attributes':_0x53b002[_0x3775('0x1a')]?_0x53b002[_0x3775('0x1a')][_0x3775('0x20')]||null:null,'include':_0x53b002[_0x3775('0x1a')]?_0x53b002['options'][_0x3775('0x1f')]?_[_0x3775('0x1e')](_0x53b002[_0x3775('0x1a')][_0x3775('0x1f')],function(_0x53b88b){return{'model':db[_0x53b88b[_0x3775('0x21')]],'as':_0x53b88b['as'],'attributes':_0x53b88b[_0x3775('0x20')],'include':_0x53b88b[_0x3775('0x1f')]?_[_0x3775('0x1e')](_0x53b88b['include'],function(_0x411c13){return{'model':db[_0x411c13[_0x3775('0x21')]],'as':_0x411c13['as'],'attributes':_0x411c13[_0x3775('0x20')],'include':_0x411c13['include']?_[_0x3775('0x1e')](_0x411c13[_0x3775('0x1f')],function(_0x5a7f81){return{'model':db[_0x5a7f81[_0x3775('0x21')]],'as':_0x5a7f81['as'],'attributes':_0x5a7f81[_0x3775('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3775('0xc')](function(_0x259ff1){logger[_0x3775('0x15')](_0x3775('0x22'),_0x53b002);logger[_0x3775('0xf')](_0x3775('0x22'),_0x53b002,JSON[_0x3775('0x11')](_0x259ff1));_0x3f39d2(_0x259ff1);})[_0x3775('0x17')](function(_0x4bf1c7){logger[_0x3775('0x12')](_0x3775('0x22'),_0x4bf1c7[_0x3775('0x14')],_0x53b002);_0x331b81(_0x4904b6['error'](0x1f4,_0x4bf1c7[_0x3775('0x14')]));});});}; \ No newline at end of file +var _0x955f=['ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetFreshsalesAccount','debug','FreshsalesAccount','find'];(function(_0x2929f0,_0x8bb756){var _0x599e5d=function(_0x3ed884){while(--_0x3ed884){_0x2929f0['push'](_0x2929f0['shift']());}};_0x599e5d(++_0x8bb756);}(_0x955f,0x1eb));var _0xf955=function(_0x1a4880,_0x509dd9){_0x1a4880=_0x1a4880-0x0;var _0x3e221a=_0x955f[_0x1a4880];return _0x3e221a;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['GetFreshsalesAccount']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['FreshsalesAccount'][_0xf955('0x15')]({'raw':_0x5ac6cb[_0xf955('0x16')]?_0x5ac6cb[_0xf955('0x16')][_0xf955('0x17')]===undefined?!![]:![]:!![],'where':_0x5ac6cb[_0xf955('0x16')]?_0x5ac6cb['options'][_0xf955('0x18')]||null:null,'attributes':_0x5ac6cb[_0xf955('0x16')]?_0x5ac6cb[_0xf955('0x16')]['attributes']||null:null,'limit':_0x5ac6cb[_0xf955('0x16')]?_0x5ac6cb['options'][_0xf955('0x19')]||null:null,'include':_0x5ac6cb[_0xf955('0x16')]?_0x5ac6cb[_0xf955('0x16')][_0xf955('0x1a')]?_[_0xf955('0x1b')](_0x5ac6cb['options'][_0xf955('0x1a')],function(_0x5fab1c){return{'model':db[_0x5fab1c[_0xf955('0x1c')]],'as':_0x5fab1c['as'],'attributes':_0x5fab1c[_0xf955('0x1d')],'include':_0x5fab1c[_0xf955('0x1a')]?_[_0xf955('0x1b')](_0x5fab1c[_0xf955('0x1a')],function(_0x552cf3){return{'model':db[_0x552cf3[_0xf955('0x1c')]],'as':_0x552cf3['as'],'attributes':_0x552cf3[_0xf955('0x1d')],'include':_0x552cf3[_0xf955('0x1a')]?_[_0xf955('0x1b')](_0x552cf3[_0xf955('0x1a')],function(_0x13a86d){return{'model':db[_0x13a86d[_0xf955('0x1c')]],'as':_0x13a86d['as'],'attributes':_0x13a86d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf955('0xb')](function(_0x145098){logger[_0xf955('0xc')](_0xf955('0x1e'),_0x5ac6cb);logger[_0xf955('0x1f')](_0xf955('0x1e'),_0x5ac6cb,JSON['stringify'](_0x145098));_0xe6de5c(_0x145098);})[_0xf955('0x14')](function(_0x1e5d37){logger['error'](_0xf955('0x1e'),_0x1e5d37[_0xf955('0x12')],_0x5ac6cb);_0x3c49c0(_0x1e20d1[_0xf955('0x11')](0x1f4,_0x1e5d37[_0xf955('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x3a951c){var _0x518fb3=this;return new Promise(function(_0x227104,_0x2c222a){return db[_0xf955('0x20')][_0xf955('0x21')]({'raw':_0x3a951c[_0xf955('0x16')]?_0x3a951c[_0xf955('0x16')][_0xf955('0x17')]===undefined?!![]:![]:!![],'where':_0x3a951c[_0xf955('0x16')]?_0x3a951c['options'][_0xf955('0x18')]||null:null,'attributes':_0x3a951c[_0xf955('0x16')]?_0x3a951c[_0xf955('0x16')][_0xf955('0x1d')]||null:null,'include':_0x3a951c['options']?_0x3a951c[_0xf955('0x16')][_0xf955('0x1a')]?_[_0xf955('0x1b')](_0x3a951c[_0xf955('0x16')][_0xf955('0x1a')],function(_0x4eb2c3){return{'model':db[_0x4eb2c3['model']],'as':_0x4eb2c3['as'],'attributes':_0x4eb2c3['attributes'],'include':_0x4eb2c3[_0xf955('0x1a')]?_[_0xf955('0x1b')](_0x4eb2c3[_0xf955('0x1a')],function(_0x6d564c){return{'model':db[_0x6d564c[_0xf955('0x1c')]],'as':_0x6d564c['as'],'attributes':_0x6d564c[_0xf955('0x1d')],'include':_0x6d564c['include']?_[_0xf955('0x1b')](_0x6d564c['include'],function(_0x8f842f){return{'model':db[_0x8f842f[_0xf955('0x1c')]],'as':_0x8f842f['as'],'attributes':_0x8f842f[_0xf955('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x60a421){logger['info'](_0xf955('0x22'),_0x3a951c);logger[_0xf955('0x1f')](_0xf955('0x22'),_0x3a951c,JSON[_0xf955('0x10')](_0x60a421));_0x227104(_0x60a421);})['catch'](function(_0xf35170){logger[_0xf955('0x11')]('ShowFreshsalesAccount',_0xf35170[_0xf955('0x12')],_0x3a951c);_0x2c222a(_0x518fb3[_0xf955('0x11')](0x1f4,_0xf35170[_0xf955('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a6e7df3..08847d0 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 _0x2fe2=['destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','put'];(function(_0x6b2214,_0x2ee8a2){var _0x994db4=function(_0xed6741){while(--_0xed6741){_0x6b2214['push'](_0x6b2214['shift']());}};_0x994db4(++_0x2ee8a2);}(_0x2fe2,0x101));var _0x22fe=function(_0x51b199,_0x356dbd){_0x51b199=_0x51b199-0x0;var _0x5aa723=_0x2fe2[_0x51b199];return _0x5aa723;};'use strict';var multer=require(_0x22fe('0x0'));var util=require('util');var path=require(_0x22fe('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x22fe('0x2'));var interaction=require(_0x22fe('0x3'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x22fe('0x4')](_0x22fe('0x5'),auth[_0x22fe('0x6')](),controller[_0x22fe('0x7')]);router['get'](_0x22fe('0x8'),auth[_0x22fe('0x6')](),controller[_0x22fe('0x9')]);router[_0x22fe('0x4')](_0x22fe('0xa'),auth[_0x22fe('0x6')](),controller[_0x22fe('0xb')]);router[_0x22fe('0x4')](_0x22fe('0xc'),auth['isAuthenticated'](),controller[_0x22fe('0xd')]);router['post']('/',auth[_0x22fe('0x6')](),controller['create']);router[_0x22fe('0xe')](_0x22fe('0x5'),auth[_0x22fe('0x6')](),controller['update']);router['delete']('/:id',auth[_0x22fe('0x6')](),controller[_0x22fe('0xf')]);module[_0x22fe('0x10')]=router; \ No newline at end of file +var _0xb384=['express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x8e3d03,_0x19dd82){var _0x11019d=function(_0xdf56c){while(--_0xdf56c){_0x8e3d03['push'](_0x8e3d03['shift']());}};_0x11019d(++_0x19dd82);}(_0xb384,0x16d));var _0x4b38=function(_0x48868b,_0x1e40e9){_0x48868b=_0x48868b-0x0;var _0x5dadd5=_0xb384[_0x48868b];return _0x5dadd5;};'use strict';var multer=require(_0x4b38('0x0'));var util=require('util');var path=require(_0x4b38('0x1'));var timeout=require(_0x4b38('0x2'));var express=require(_0x4b38('0x3'));var router=express[_0x4b38('0x4')]();var auth=require(_0x4b38('0x5'));var interaction=require(_0x4b38('0x6'));var config=require('../../config/environment');var controller=require(_0x4b38('0x7'));router[_0x4b38('0x8')]('/',auth['isAuthenticated'](),controller[_0x4b38('0x9')]);router[_0x4b38('0x8')]('/:id',auth[_0x4b38('0xa')](),controller['show']);router[_0x4b38('0x8')](_0x4b38('0xb'),auth[_0x4b38('0xa')](),controller[_0x4b38('0xc')]);router[_0x4b38('0x8')](_0x4b38('0xd'),auth[_0x4b38('0xa')](),controller[_0x4b38('0xe')]);router[_0x4b38('0x8')](_0x4b38('0xf'),auth[_0x4b38('0xa')](),controller['getFields']);router[_0x4b38('0x10')]('/',auth[_0x4b38('0xa')](),controller[_0x4b38('0x11')]);router[_0x4b38('0x12')](_0x4b38('0x13'),auth[_0x4b38('0xa')](),controller['update']);router[_0x4b38('0x14')](_0x4b38('0x13'),auth[_0x4b38('0xa')](),controller[_0x4b38('0x15')]);module[_0x4b38('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 2b0a668..3315ecd 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 _0x9766=['STRING','sequelize','exports'];(function(_0x437f06,_0x3e4545){var _0x15cef1=function(_0x40fb75){while(--_0x40fb75){_0x437f06['push'](_0x437f06['shift']());}};_0x15cef1(++_0x3e4545);}(_0x9766,0x193));var _0x6976=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x9766[_0x5d72da];return _0x43ebe7;};'use strict';var Sequelize=require(_0x6976('0x0'));module[_0x6976('0x1')]={'name':{'type':Sequelize[_0x6976('0x2')]},'description':{'type':Sequelize[_0x6976('0x2')]}}; \ No newline at end of file +var _0x9376=['STRING','sequelize','exports'];(function(_0x3b3ea9,_0x3a1d0d){var _0x4f413e=function(_0x14aea8){while(--_0x14aea8){_0x3b3ea9['push'](_0x3b3ea9['shift']());}};_0x4f413e(++_0x3a1d0d);}(_0x9376,0x1b1));var _0x6937=function(_0x299665,_0x27352a){_0x299665=_0x299665-0x0;var _0x21e07c=_0x9376[_0x299665];return _0x21e07c;};'use strict';var Sequelize=require(_0x6937('0x0'));module[_0x6937('0x1')]={'name':{'type':Sequelize[_0x6937('0x2')]},'description':{'type':Sequelize[_0x6937('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 27ca2e5..f2fbfe4 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 _0x323a=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','create','body','find','params','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x323a,0x149));var _0xa323=function(_0x5ea22a,_0x3c69a7){_0x5ea22a=_0x5ea22a-0x0;var _0x4e6ebc=_0x323a[_0x5ea22a];return _0x4e6ebc;};'use strict';var pdf=require(_0xa323('0x0'));var emlformat=require(_0xa323('0x1'));var rimraf=require(_0xa323('0x2'));var zipdir=require(_0xa323('0x3'));var jsonpatch=require(_0xa323('0x4'));var rp=require(_0xa323('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa323('0x6'));var path=require(_0xa323('0x7'));var sox=require('sox');var csv=require(_0xa323('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa323('0x9'));var squel=require('squel');var crypto=require(_0xa323('0xa'));var jsforce=require(_0xa323('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa323('0x8'));var querystring=require(_0xa323('0xc'));var Papa=require(_0xa323('0xd'));var Redis=require(_0xa323('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa323('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa323('0x10'));var logger=require(_0xa323('0x11'))(_0xa323('0x12'));var utils=require(_0xa323('0x13'));var config=require('../../config/environment');var db=require(_0xa323('0x14'))['db'];var jayson=require(_0xa323('0x15'));var client=jayson['client'][_0xa323('0x16')]({'port':0x232a});function checkPasswordPattern(_0x560b8b,_0x1fb9a4,_0x2399ff){if(_0x2399ff){var _0x380ff0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x380ff0['test'](_0x1fb9a4)){return _0x560b8b;}else{throw new db[(_0xa323('0x17'))]['ValidationError'](_0xa323('0x18'));}}else{return _0x560b8b;}}function respondWithRpcPromise(_0x36bc36,_0x5542fd,_0x5e152d,_0x2a05c2){return new BPromise(function(_0x3b70f5,_0x5d9710){var _0x15299b=_0x2a05c2||client;return _0x15299b[_0xa323('0x19')](_0x36bc36,_0x5e152d)[_0xa323('0x1a')](function(_0x52a885){logger[_0xa323('0x1b')](_0xa323('0x1c'),_0x5542fd,'request\x20sent');logger[_0xa323('0x1d')](_0xa323('0x1e'),_0x5542fd,_0xa323('0x1f'),JSON[_0xa323('0x20')](_0x52a885));if(_0x52a885['error']){if(_0x52a885[_0xa323('0x21')][_0xa323('0x22')]===0x1f4){logger[_0xa323('0x21')](_0xa323('0x1c'),_0x5542fd,_0x52a885[_0xa323('0x21')][_0xa323('0x23')]);return _0x5d9710(_0x52a885['error']['message']);}logger[_0xa323('0x21')](_0xa323('0x1c'),_0x5542fd,_0x52a885[_0xa323('0x21')]['message']);return _0x3b70f5(_0x52a885[_0xa323('0x21')][_0xa323('0x23')]);}else{logger[_0xa323('0x1b')](_0xa323('0x1c'),_0x5542fd,'request\x20sent');_0x3b70f5(_0x52a885[_0xa323('0x24')][_0xa323('0x23')]);}})[_0xa323('0x25')](function(_0x36f87c){logger['error'](_0xa323('0x1c'),_0x5542fd,_0x36f87c);_0x5d9710(_0x36f87c);});});}function respondWithStatusCode(_0x1f4380,_0x3ab75d){_0x3ab75d=_0x3ab75d||0xcc;return function(_0x248faf){if(_0x248faf){return _0x1f4380[_0xa323('0x26')](_0x3ab75d);}return _0x1f4380[_0xa323('0x27')](_0x3ab75d)[_0xa323('0x28')]();};}function respondWithResult(_0x552d6a,_0x243d44){_0x243d44=_0x243d44||0xc8;return function(_0x425dbd){if(_0x425dbd){return _0x552d6a[_0xa323('0x27')](_0x243d44)[_0xa323('0x29')](_0x425dbd);}};}function respondWithFilteredResult(_0x5be63b,_0x4f6b7a){return function(_0x49e837){if(_0x49e837){var _0x4ad2a3=_0x49e837[_0xa323('0x2a')],_0x545115=_0x4f6b7a[_0xa323('0x2b')],_0x1e5f19=_0x4f6b7a[_0xa323('0x2b')]+_0x4f6b7a[_0xa323('0x2c')],_0x49185e;if(_0x1e5f19>=_0x4ad2a3){_0x1e5f19=_0x4ad2a3;_0x49185e=0xc8;}else{_0x49185e=0xce;}_0x5be63b['status'](_0x49185e);return _0x5be63b[_0xa323('0x2d')](_0xa323('0x2e'),_0x545115+'-'+_0x1e5f19+'/'+_0x4ad2a3)[_0xa323('0x29')](_0x49e837);}return null;};}function patchUpdates(_0x342f50){return function(_0x3c046b){try{jsonpatch[_0xa323('0x2f')](_0x3c046b,_0x342f50,!![]);}catch(_0x1fccc2){return BPromise[_0xa323('0x30')](_0x1fccc2);}return _0x3c046b[_0xa323('0x31')]();};}function saveUpdates(_0x1103e1,_0x7b4b17){return function(_0x1179d8){if(_0x1179d8){return _0x1179d8[_0xa323('0x32')](_0x1103e1)[_0xa323('0x1a')](function(_0x308630){return _0x308630;});}return null;};}function removeEntity(_0x4f6b62,_0x5a2a47){return function(_0x4707fc){if(_0x4707fc){return _0x4707fc[_0xa323('0x33')]()['then'](function(){_0x4f6b62['status'](0xcc)[_0xa323('0x28')]();});}};}function handleEntityNotFound(_0x8684a2,_0x303b96){return function(_0x1d20a5){if(!_0x1d20a5){_0x8684a2[_0xa323('0x26')](0x194);}return _0x1d20a5;};}function handleError(_0x14c9fa,_0x3d5dde){_0x3d5dde=_0x3d5dde||0x1f4;return function(_0x41874c){logger[_0xa323('0x21')](_0x41874c[_0xa323('0x34')]);if(_0x41874c[_0xa323('0x35')]){delete _0x41874c[_0xa323('0x35')];}_0x14c9fa[_0xa323('0x27')](_0x3d5dde)['send'](_0x41874c);};}exports[_0xa323('0x36')]=function(_0x3f1be3,_0x116d7f){var _0x4c6038={},_0x3346a9={},_0x24f9ae={'count':0x0,'rows':[]};var _0x5981ef=_[_0xa323('0x37')](db[_0xa323('0x38')][_0xa323('0x39')],function(_0x322f5a){return{'name':_0x322f5a[_0xa323('0x3a')],'type':_0x322f5a[_0xa323('0x3b')][_0xa323('0x3c')]};});_0x3346a9[_0xa323('0x3d')]=_[_0xa323('0x37')](_0x5981ef,'name');_0x3346a9[_0xa323('0x3e')]=_[_0xa323('0x3f')](_0x3f1be3['query']);_0x3346a9[_0xa323('0x40')]=_[_0xa323('0x41')](_0x3346a9[_0xa323('0x3d')],_0x3346a9[_0xa323('0x3e')]);_0x4c6038[_0xa323('0x42')]=_[_0xa323('0x41')](_0x3346a9[_0xa323('0x3d')],qs[_0xa323('0x43')](_0x3f1be3[_0xa323('0x3e')][_0xa323('0x43')]));_0x4c6038[_0xa323('0x42')]=_0x4c6038[_0xa323('0x42')][_0xa323('0x44')]?_0x4c6038['attributes']:_0x3346a9[_0xa323('0x3d')];if(!_0x3f1be3['query'][_0xa323('0x45')](_0xa323('0x46'))){_0x4c6038[_0xa323('0x2c')]=qs[_0xa323('0x2c')](_0x3f1be3['query']['limit']);_0x4c6038[_0xa323('0x2b')]=qs[_0xa323('0x2b')](_0x3f1be3[_0xa323('0x3e')]['offset']);}_0x4c6038[_0xa323('0x47')]=qs[_0xa323('0x48')](_0x3f1be3['query'][_0xa323('0x48')]);_0x4c6038['where']=qs['filters'](_[_0xa323('0x49')](_0x3f1be3[_0xa323('0x3e')],_0x3346a9[_0xa323('0x40')]),_0x5981ef);if(_0x3f1be3[_0xa323('0x3e')][_0xa323('0x4a')]){_0x4c6038['where']=_[_0xa323('0x4b')](_0x4c6038[_0xa323('0x4c')],{'$or':_[_0xa323('0x37')](_0x5981ef,function(_0x278c5a){if(_0x278c5a[_0xa323('0x3b')]!=='VIRTUAL'){var _0xb358a7={};_0xb358a7[_0x278c5a[_0xa323('0x35')]]={'$like':'%'+_0x3f1be3[_0xa323('0x3e')][_0xa323('0x4a')]+'%'};return _0xb358a7;}})});}_0x4c6038=_['merge']({},_0x4c6038,_0x3f1be3[_0xa323('0x4d')]);var _0x55b287={'where':_0x4c6038[_0xa323('0x4c')]};return db[_0xa323('0x38')][_0xa323('0x2a')](_0x55b287)[_0xa323('0x1a')](function(_0x4d25d0){_0x24f9ae[_0xa323('0x2a')]=_0x4d25d0;if(_0x3f1be3[_0xa323('0x3e')][_0xa323('0x4e')]){_0x4c6038[_0xa323('0x4f')]=[{'all':!![]}];}return db[_0xa323('0x38')][_0xa323('0x50')](_0x4c6038);})[_0xa323('0x1a')](function(_0x36033c){_0x24f9ae[_0xa323('0x51')]=_0x36033c;return _0x24f9ae;})[_0xa323('0x1a')](respondWithFilteredResult(_0x116d7f,_0x4c6038))[_0xa323('0x25')](handleError(_0x116d7f,null));};exports[_0xa323('0x52')]=function(_0x409c1e,_0x43ea7c){var _0x4e1ead={'raw':![],'where':{'id':_0x409c1e['params']['id']}},_0x28165a={};_0x28165a[_0xa323('0x3d')]=_[_0xa323('0x3f')](db[_0xa323('0x38')][_0xa323('0x39')]);_0x28165a[_0xa323('0x3e')]=_[_0xa323('0x3f')](_0x409c1e[_0xa323('0x3e')]);_0x28165a[_0xa323('0x40')]=_[_0xa323('0x41')](_0x28165a[_0xa323('0x3d')],_0x28165a[_0xa323('0x3e')]);_0x4e1ead[_0xa323('0x42')]=_[_0xa323('0x41')](_0x28165a[_0xa323('0x3d')],qs[_0xa323('0x43')](_0x409c1e[_0xa323('0x3e')][_0xa323('0x43')]));_0x4e1ead[_0xa323('0x42')]=_0x4e1ead[_0xa323('0x42')][_0xa323('0x44')]?_0x4e1ead[_0xa323('0x42')]:_0x28165a['model'];if(_0x409c1e[_0xa323('0x3e')][_0xa323('0x4e')]){_0x4e1ead[_0xa323('0x4f')]=[{'all':!![]}];}_0x4e1ead=_['merge']({},_0x4e1ead,_0x409c1e[_0xa323('0x4d')]);return db[_0xa323('0x38')]['find'](_0x4e1ead)[_0xa323('0x1a')](handleEntityNotFound(_0x43ea7c,null))[_0xa323('0x1a')](respondWithResult(_0x43ea7c,null))[_0xa323('0x25')](handleError(_0x43ea7c,null));};exports[_0xa323('0x53')]=function(_0x56cb06,_0x440a7d){return db['FreshsalesConfiguration']['create'](_0x56cb06[_0xa323('0x54')],{})[_0xa323('0x1a')](respondWithResult(_0x440a7d,0xc9))['catch'](handleError(_0x440a7d,null));};exports['update']=function(_0x3460c3,_0x53f179){if(_0x3460c3[_0xa323('0x54')]['id']){delete _0x3460c3[_0xa323('0x54')]['id'];}return db[_0xa323('0x38')][_0xa323('0x55')]({'where':{'id':_0x3460c3[_0xa323('0x56')]['id']}})[_0xa323('0x1a')](handleEntityNotFound(_0x53f179,null))['then'](saveUpdates(_0x3460c3[_0xa323('0x54')],null))[_0xa323('0x1a')](respondWithResult(_0x53f179,null))[_0xa323('0x25')](handleError(_0x53f179,null));};exports[_0xa323('0x33')]=function(_0x36d367,_0x6f93e2){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x36d367['params']['id']}})['then'](handleEntityNotFound(_0x6f93e2,null))[_0xa323('0x1a')](removeEntity(_0x6f93e2,null))[_0xa323('0x25')](handleError(_0x6f93e2,null));};exports[_0xa323('0x57')]=function(_0x50e2e6,_0x5a5f94,_0x21b2a2){var _0x21884f={};var _0x5e3e9c={};var _0x226339;var _0x5af87c;return db[_0xa323('0x38')][_0xa323('0x58')]({'where':{'id':_0x50e2e6[_0xa323('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a5f94,null))[_0xa323('0x1a')](function(_0x398fbd){if(_0x398fbd){_0x226339=_0x398fbd;_0x5e3e9c['model']=_[_0xa323('0x3f')](db[_0xa323('0x59')][_0xa323('0x39')]);_0x5e3e9c['query']=_['keys'](_0x50e2e6[_0xa323('0x3e')]);_0x5e3e9c[_0xa323('0x40')]=_[_0xa323('0x41')](_0x5e3e9c[_0xa323('0x3d')],_0x5e3e9c['query']);_0x21884f['attributes']=_[_0xa323('0x41')](_0x5e3e9c[_0xa323('0x3d')],qs[_0xa323('0x43')](_0x50e2e6[_0xa323('0x3e')][_0xa323('0x43')]));_0x21884f[_0xa323('0x42')]=_0x21884f[_0xa323('0x42')][_0xa323('0x44')]?_0x21884f['attributes']:_0x5e3e9c['model'];_0x21884f[_0xa323('0x47')]=qs[_0xa323('0x48')](_0x50e2e6['query'][_0xa323('0x48')]);_0x21884f[_0xa323('0x4c')]=qs[_0xa323('0x40')](_[_0xa323('0x49')](_0x50e2e6[_0xa323('0x3e')],_0x5e3e9c[_0xa323('0x40')]));if(_0x50e2e6[_0xa323('0x3e')][_0xa323('0x4a')]){_0x21884f[_0xa323('0x4c')]=_[_0xa323('0x4b')](_0x21884f['where'],{'$or':_[_0xa323('0x37')](_0x21884f[_0xa323('0x42')],function(_0x30e86b){var _0xc5760d={};_0xc5760d[_0x30e86b]={'$like':'%'+_0x50e2e6[_0xa323('0x3e')]['filter']+'%'};return _0xc5760d;})});}_0x21884f=_['merge']({},_0x21884f,_0x50e2e6[_0xa323('0x4d')]);return _0x226339[_0xa323('0x57')](_0x21884f);}})[_0xa323('0x1a')](function(_0x5413db){if(_0x5413db){_0x5af87c=_0x5413db[_0xa323('0x44')];if(!_0x50e2e6[_0xa323('0x3e')]['hasOwnProperty'](_0xa323('0x46'))){_0x21884f[_0xa323('0x2c')]=qs[_0xa323('0x2c')](_0x50e2e6['query'][_0xa323('0x2c')]);_0x21884f[_0xa323('0x2b')]=qs[_0xa323('0x2b')](_0x50e2e6[_0xa323('0x3e')][_0xa323('0x2b')]);}return _0x226339[_0xa323('0x57')](_0x21884f);}})[_0xa323('0x1a')](function(_0x450ad2){if(_0x450ad2){return _0x450ad2?{'count':_0x5af87c,'rows':_0x450ad2}:null;}})[_0xa323('0x1a')](respondWithResult(_0x5a5f94,null))[_0xa323('0x25')](handleError(_0x5a5f94,null));};exports[_0xa323('0x5a')]=function(_0x2591bf,_0x5c0286,_0x5e0894){var _0x28b3a1={};var _0x256937={};var _0x384be5;var _0x44cca1;return db[_0xa323('0x38')]['findOne']({'where':{'id':_0x2591bf['params']['id']}})[_0xa323('0x1a')](handleEntityNotFound(_0x5c0286,null))[_0xa323('0x1a')](function(_0x40bda5){if(_0x40bda5){_0x384be5=_0x40bda5;_0x256937['model']=_[_0xa323('0x3f')](db[_0xa323('0x59')][_0xa323('0x39')]);_0x256937[_0xa323('0x3e')]=_[_0xa323('0x3f')](_0x2591bf[_0xa323('0x3e')]);_0x256937[_0xa323('0x40')]=_[_0xa323('0x41')](_0x256937[_0xa323('0x3d')],_0x256937[_0xa323('0x3e')]);_0x28b3a1['attributes']=_[_0xa323('0x41')](_0x256937[_0xa323('0x3d')],qs[_0xa323('0x43')](_0x2591bf[_0xa323('0x3e')][_0xa323('0x43')]));_0x28b3a1[_0xa323('0x42')]=_0x28b3a1[_0xa323('0x42')][_0xa323('0x44')]?_0x28b3a1[_0xa323('0x42')]:_0x256937[_0xa323('0x3d')];_0x28b3a1[_0xa323('0x47')]=qs[_0xa323('0x48')](_0x2591bf[_0xa323('0x3e')][_0xa323('0x48')]);_0x28b3a1['where']=qs[_0xa323('0x40')](_[_0xa323('0x49')](_0x2591bf['query'],_0x256937[_0xa323('0x40')]));if(_0x2591bf[_0xa323('0x3e')][_0xa323('0x4a')]){_0x28b3a1['where']=_[_0xa323('0x4b')](_0x28b3a1[_0xa323('0x4c')],{'$or':_[_0xa323('0x37')](_0x28b3a1[_0xa323('0x42')],function(_0x539f2){var _0x57de7c={};_0x57de7c[_0x539f2]={'$like':'%'+_0x2591bf[_0xa323('0x3e')]['filter']+'%'};return _0x57de7c;})});}_0x28b3a1=_[_0xa323('0x4b')]({},_0x28b3a1,_0x2591bf[_0xa323('0x4d')]);return _0x384be5['getDescriptions'](_0x28b3a1);}})[_0xa323('0x1a')](function(_0x412ede){if(_0x412ede){_0x44cca1=_0x412ede[_0xa323('0x44')];if(!_0x2591bf[_0xa323('0x3e')][_0xa323('0x45')](_0xa323('0x46'))){_0x28b3a1[_0xa323('0x2c')]=qs[_0xa323('0x2c')](_0x2591bf[_0xa323('0x3e')]['limit']);_0x28b3a1['offset']=qs[_0xa323('0x2b')](_0x2591bf[_0xa323('0x3e')][_0xa323('0x2b')]);}return _0x384be5[_0xa323('0x5a')](_0x28b3a1);}})[_0xa323('0x1a')](function(_0x3f1fcc){if(_0x3f1fcc){return _0x3f1fcc?{'count':_0x44cca1,'rows':_0x3f1fcc}:null;}})['then'](respondWithResult(_0x5c0286,null))[_0xa323('0x25')](handleError(_0x5c0286,null));};exports[_0xa323('0x5b')]=function(_0x401cd0,_0x3dc85d,_0x595078){var _0x52c520={};var _0x130a3a={};var _0xc3ce1;var _0x4be7bb;return db['FreshsalesConfiguration'][_0xa323('0x58')]({'where':{'id':_0x401cd0[_0xa323('0x56')]['id']}})[_0xa323('0x1a')](handleEntityNotFound(_0x3dc85d,null))['then'](function(_0x308f1a){if(_0x308f1a){_0xc3ce1=_0x308f1a;_0x130a3a[_0xa323('0x3d')]=_[_0xa323('0x3f')](db['FreshsalesField']['rawAttributes']);_0x130a3a[_0xa323('0x3e')]=_[_0xa323('0x3f')](_0x401cd0['query']);_0x130a3a[_0xa323('0x40')]=_[_0xa323('0x41')](_0x130a3a[_0xa323('0x3d')],_0x130a3a['query']);_0x52c520[_0xa323('0x42')]=_[_0xa323('0x41')](_0x130a3a[_0xa323('0x3d')],qs[_0xa323('0x43')](_0x401cd0[_0xa323('0x3e')][_0xa323('0x43')]));_0x52c520[_0xa323('0x42')]=_0x52c520[_0xa323('0x42')]['length']?_0x52c520[_0xa323('0x42')]:_0x130a3a[_0xa323('0x3d')];_0x52c520['order']=qs[_0xa323('0x48')](_0x401cd0[_0xa323('0x3e')][_0xa323('0x48')]);_0x52c520['where']=qs[_0xa323('0x40')](_['pick'](_0x401cd0[_0xa323('0x3e')],_0x130a3a[_0xa323('0x40')]));if(_0x401cd0[_0xa323('0x3e')][_0xa323('0x4a')]){_0x52c520[_0xa323('0x4c')]=_[_0xa323('0x4b')](_0x52c520[_0xa323('0x4c')],{'$or':_[_0xa323('0x37')](_0x52c520['attributes'],function(_0x4b2fa7){var _0x4b3ca8={};_0x4b3ca8[_0x4b2fa7]={'$like':'%'+_0x401cd0[_0xa323('0x3e')]['filter']+'%'};return _0x4b3ca8;})});}_0x52c520=_[_0xa323('0x4b')]({},_0x52c520,_0x401cd0[_0xa323('0x4d')]);return _0xc3ce1['getFields'](_0x52c520);}})[_0xa323('0x1a')](function(_0x89328b){if(_0x89328b){_0x4be7bb=_0x89328b[_0xa323('0x44')];if(!_0x401cd0[_0xa323('0x3e')][_0xa323('0x45')](_0xa323('0x46'))){_0x52c520[_0xa323('0x2c')]=qs['limit'](_0x401cd0['query']['limit']);_0x52c520[_0xa323('0x2b')]=qs[_0xa323('0x2b')](_0x401cd0[_0xa323('0x3e')][_0xa323('0x2b')]);}return _0xc3ce1['getFields'](_0x52c520);}})[_0xa323('0x1a')](function(_0x55f3ac){if(_0x55f3ac){return _0x55f3ac?{'count':_0x4be7bb,'rows':_0x55f3ac}:null;}})[_0xa323('0x1a')](respondWithResult(_0x3dc85d,null))[_0xa323('0x25')](handleError(_0x3dc85d,null));}; \ No newline at end of file +var _0xe0f5=['filter','merge','options','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','update','params','FreshsalesField','getSubjects','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','destroy','stack','name','index','map','FreshsalesConfiguration','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type'];(function(_0x367ede,_0x834347){var _0x3d0da0=function(_0x2655ff){while(--_0x2655ff){_0x367ede['push'](_0x367ede['shift']());}};_0x3d0da0(++_0x834347);}(_0xe0f5,0x16f));var _0x5e0f=function(_0x2f5105,_0x55607e){_0x2f5105=_0x2f5105-0x0;var _0x47c791=_0xe0f5[_0x2f5105];return _0x47c791;};'use strict';var pdf=require(_0x5e0f('0x0'));var emlformat=require(_0x5e0f('0x1'));var rimraf=require(_0x5e0f('0x2'));var zipdir=require(_0x5e0f('0x3'));var jsonpatch=require(_0x5e0f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5e0f('0x5'));var sox=require(_0x5e0f('0x6'));var csv=require(_0x5e0f('0x7'));var ejs=require(_0x5e0f('0x8'));var fs=require('fs');var _=require(_0x5e0f('0x9'));var squel=require(_0x5e0f('0xa'));var crypto=require(_0x5e0f('0xb'));var jsforce=require(_0x5e0f('0xc'));var deskjs=require(_0x5e0f('0xd'));var toCsv=require(_0x5e0f('0x7'));var querystring=require('querystring');var Papa=require(_0x5e0f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5e0f('0xf'));var as=require(_0x5e0f('0x10'));var hardwareService=require(_0x5e0f('0x11'));var logger=require(_0x5e0f('0x12'))(_0x5e0f('0x13'));var utils=require(_0x5e0f('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x5e0f('0x15'));var client=jayson[_0x5e0f('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x5e171f,_0xdb3a26,_0x5c0458){if(_0x5c0458){var _0x474846=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x474846['test'](_0xdb3a26)){return _0x5e171f;}else{throw new db[(_0x5e0f('0x17'))][(_0x5e0f('0x18'))](_0x5e0f('0x19'));}}else{return _0x5e171f;}}function respondWithRpcPromise(_0x316f41,_0x212fe2,_0x2c7e83,_0x2e47a2){return new BPromise(function(_0x1fd14b,_0xb29575){var _0x266e9d=_0x2e47a2||client;return _0x266e9d[_0x5e0f('0x1a')](_0x316f41,_0x2c7e83)[_0x5e0f('0x1b')](function(_0x4b8050){logger[_0x5e0f('0x1c')](_0x5e0f('0x1d'),_0x212fe2,_0x5e0f('0x1e'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x212fe2,_0x5e0f('0x1e'),JSON[_0x5e0f('0x1f')](_0x4b8050));if(_0x4b8050['error']){if(_0x4b8050['error']['code']===0x1f4){logger[_0x5e0f('0x20')](_0x5e0f('0x1d'),_0x212fe2,_0x4b8050[_0x5e0f('0x20')][_0x5e0f('0x21')]);return _0xb29575(_0x4b8050[_0x5e0f('0x20')][_0x5e0f('0x21')]);}logger[_0x5e0f('0x20')](_0x5e0f('0x1d'),_0x212fe2,_0x4b8050[_0x5e0f('0x20')][_0x5e0f('0x21')]);return _0x1fd14b(_0x4b8050[_0x5e0f('0x20')]['message']);}else{logger[_0x5e0f('0x1c')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x212fe2,_0x5e0f('0x1e'));_0x1fd14b(_0x4b8050[_0x5e0f('0x22')][_0x5e0f('0x21')]);}})['catch'](function(_0x266ed4){logger[_0x5e0f('0x20')](_0x5e0f('0x1d'),_0x212fe2,_0x266ed4);_0xb29575(_0x266ed4);});});}function respondWithStatusCode(_0x1b7dde,_0x405981){_0x405981=_0x405981||0xcc;return function(_0x2bdd5f){if(_0x2bdd5f){return _0x1b7dde[_0x5e0f('0x23')](_0x405981);}return _0x1b7dde[_0x5e0f('0x24')](_0x405981)[_0x5e0f('0x25')]();};}function respondWithResult(_0x524c54,_0x719867){_0x719867=_0x719867||0xc8;return function(_0x6c6095){if(_0x6c6095){return _0x524c54['status'](_0x719867)[_0x5e0f('0x26')](_0x6c6095);}};}function respondWithFilteredResult(_0x567359,_0x241394){return function(_0x57b01b){if(_0x57b01b){var _0x215766=_0x57b01b[_0x5e0f('0x27')],_0x12250c=_0x241394[_0x5e0f('0x28')],_0x398403=_0x241394[_0x5e0f('0x28')]+_0x241394[_0x5e0f('0x29')],_0x48b03b;if(_0x398403>=_0x215766){_0x398403=_0x215766;_0x48b03b=0xc8;}else{_0x48b03b=0xce;}_0x567359['status'](_0x48b03b);return _0x567359[_0x5e0f('0x2a')]('Content-Range',_0x12250c+'-'+_0x398403+'/'+_0x215766)[_0x5e0f('0x26')](_0x57b01b);}return null;};}function patchUpdates(_0x5d8731){return function(_0x4d0eb7){try{jsonpatch[_0x5e0f('0x2b')](_0x4d0eb7,_0x5d8731,!![]);}catch(_0x2f2bc9){return BPromise[_0x5e0f('0x2c')](_0x2f2bc9);}return _0x4d0eb7['save']();};}function saveUpdates(_0x10f424,_0x1d36de){return function(_0x59d19d){if(_0x59d19d){return _0x59d19d['update'](_0x10f424)[_0x5e0f('0x1b')](function(_0x1e07d3){return _0x1e07d3;});}return null;};}function removeEntity(_0x2194e6,_0x4c7e83){return function(_0x1896d0){if(_0x1896d0){return _0x1896d0[_0x5e0f('0x2d')]()[_0x5e0f('0x1b')](function(){_0x2194e6[_0x5e0f('0x24')](0xcc)[_0x5e0f('0x25')]();});}};}function handleEntityNotFound(_0x494334,_0x3e3ef9){return function(_0x30d0ed){if(!_0x30d0ed){_0x494334[_0x5e0f('0x23')](0x194);}return _0x30d0ed;};}function handleError(_0x5d866d,_0x3a990a){_0x3a990a=_0x3a990a||0x1f4;return function(_0x555092){logger[_0x5e0f('0x20')](_0x555092[_0x5e0f('0x2e')]);if(_0x555092['name']){delete _0x555092[_0x5e0f('0x2f')];}_0x5d866d[_0x5e0f('0x24')](_0x3a990a)['send'](_0x555092);};}exports[_0x5e0f('0x30')]=function(_0x342708,_0x40df79){var _0x344ed6={},_0x4135ac={},_0x4b1a55={'count':0x0,'rows':[]};var _0x3a0d53=_[_0x5e0f('0x31')](db[_0x5e0f('0x32')]['rawAttributes'],function(_0x39681a){return{'name':_0x39681a[_0x5e0f('0x33')],'type':_0x39681a['type'][_0x5e0f('0x34')]};});_0x4135ac['model']=_[_0x5e0f('0x31')](_0x3a0d53,_0x5e0f('0x2f'));_0x4135ac[_0x5e0f('0x35')]=_[_0x5e0f('0x36')](_0x342708[_0x5e0f('0x35')]);_0x4135ac[_0x5e0f('0x37')]=_[_0x5e0f('0x38')](_0x4135ac[_0x5e0f('0x39')],_0x4135ac[_0x5e0f('0x35')]);_0x344ed6[_0x5e0f('0x3a')]=_[_0x5e0f('0x38')](_0x4135ac['model'],qs[_0x5e0f('0x3b')](_0x342708['query'][_0x5e0f('0x3b')]));_0x344ed6[_0x5e0f('0x3a')]=_0x344ed6[_0x5e0f('0x3a')][_0x5e0f('0x3c')]?_0x344ed6[_0x5e0f('0x3a')]:_0x4135ac[_0x5e0f('0x39')];if(!_0x342708['query'][_0x5e0f('0x3d')](_0x5e0f('0x3e'))){_0x344ed6[_0x5e0f('0x29')]=qs[_0x5e0f('0x29')](_0x342708[_0x5e0f('0x35')][_0x5e0f('0x29')]);_0x344ed6[_0x5e0f('0x28')]=qs[_0x5e0f('0x28')](_0x342708[_0x5e0f('0x35')]['offset']);}_0x344ed6[_0x5e0f('0x3f')]=qs['sort'](_0x342708[_0x5e0f('0x35')][_0x5e0f('0x40')]);_0x344ed6[_0x5e0f('0x41')]=qs[_0x5e0f('0x37')](_[_0x5e0f('0x42')](_0x342708['query'],_0x4135ac[_0x5e0f('0x37')]),_0x3a0d53);if(_0x342708[_0x5e0f('0x35')]['filter']){_0x344ed6[_0x5e0f('0x41')]=_['merge'](_0x344ed6[_0x5e0f('0x41')],{'$or':_[_0x5e0f('0x31')](_0x3a0d53,function(_0x5afc61){if(_0x5afc61[_0x5e0f('0x43')]!=='VIRTUAL'){var _0x528fb6={};_0x528fb6[_0x5afc61[_0x5e0f('0x2f')]]={'$like':'%'+_0x342708['query'][_0x5e0f('0x44')]+'%'};return _0x528fb6;}})});}_0x344ed6=_[_0x5e0f('0x45')]({},_0x344ed6,_0x342708[_0x5e0f('0x46')]);var _0xbfbb3f={'where':_0x344ed6[_0x5e0f('0x41')]};return db[_0x5e0f('0x32')][_0x5e0f('0x27')](_0xbfbb3f)[_0x5e0f('0x1b')](function(_0x4367fd){_0x4b1a55[_0x5e0f('0x27')]=_0x4367fd;if(_0x342708[_0x5e0f('0x35')][_0x5e0f('0x47')]){_0x344ed6['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x5e0f('0x48')](_0x344ed6);})[_0x5e0f('0x1b')](function(_0x1e4170){_0x4b1a55['rows']=_0x1e4170;return _0x4b1a55;})[_0x5e0f('0x1b')](respondWithFilteredResult(_0x40df79,_0x344ed6))[_0x5e0f('0x49')](handleError(_0x40df79,null));};exports[_0x5e0f('0x4a')]=function(_0x30c954,_0x557a1c){var _0x5830af={'raw':![],'where':{'id':_0x30c954['params']['id']}},_0x4ba3ba={};_0x4ba3ba[_0x5e0f('0x39')]=_['keys'](db[_0x5e0f('0x32')][_0x5e0f('0x4b')]);_0x4ba3ba['query']=_['keys'](_0x30c954['query']);_0x4ba3ba[_0x5e0f('0x37')]=_['intersection'](_0x4ba3ba[_0x5e0f('0x39')],_0x4ba3ba[_0x5e0f('0x35')]);_0x5830af[_0x5e0f('0x3a')]=_[_0x5e0f('0x38')](_0x4ba3ba[_0x5e0f('0x39')],qs[_0x5e0f('0x3b')](_0x30c954[_0x5e0f('0x35')][_0x5e0f('0x3b')]));_0x5830af['attributes']=_0x5830af['attributes'][_0x5e0f('0x3c')]?_0x5830af[_0x5e0f('0x3a')]:_0x4ba3ba[_0x5e0f('0x39')];if(_0x30c954[_0x5e0f('0x35')][_0x5e0f('0x47')]){_0x5830af[_0x5e0f('0x4c')]=[{'all':!![]}];}_0x5830af=_[_0x5e0f('0x45')]({},_0x5830af,_0x30c954['options']);return db[_0x5e0f('0x32')][_0x5e0f('0x4d')](_0x5830af)['then'](handleEntityNotFound(_0x557a1c,null))['then'](respondWithResult(_0x557a1c,null))[_0x5e0f('0x49')](handleError(_0x557a1c,null));};exports[_0x5e0f('0x4e')]=function(_0x4f6441,_0x3351f4){return db[_0x5e0f('0x32')][_0x5e0f('0x4e')](_0x4f6441[_0x5e0f('0x4f')],{})[_0x5e0f('0x1b')](respondWithResult(_0x3351f4,0xc9))[_0x5e0f('0x49')](handleError(_0x3351f4,null));};exports[_0x5e0f('0x50')]=function(_0x32f636,_0x242870){if(_0x32f636['body']['id']){delete _0x32f636[_0x5e0f('0x4f')]['id'];}return db[_0x5e0f('0x32')][_0x5e0f('0x4d')]({'where':{'id':_0x32f636[_0x5e0f('0x51')]['id']}})[_0x5e0f('0x1b')](handleEntityNotFound(_0x242870,null))[_0x5e0f('0x1b')](saveUpdates(_0x32f636[_0x5e0f('0x4f')],null))[_0x5e0f('0x1b')](respondWithResult(_0x242870,null))[_0x5e0f('0x49')](handleError(_0x242870,null));};exports[_0x5e0f('0x2d')]=function(_0x2eefaf,_0x1ef5b2){return db[_0x5e0f('0x32')]['find']({'where':{'id':_0x2eefaf[_0x5e0f('0x51')]['id']}})[_0x5e0f('0x1b')](handleEntityNotFound(_0x1ef5b2,null))['then'](removeEntity(_0x1ef5b2,null))[_0x5e0f('0x49')](handleError(_0x1ef5b2,null));};exports['getSubjects']=function(_0x1e3a7e,_0x54a651,_0x2bcb7d){var _0x502b8e={};var _0x4b0ae7={};var _0x56bf37;var _0x16789c;return db[_0x5e0f('0x32')]['findOne']({'where':{'id':_0x1e3a7e[_0x5e0f('0x51')]['id']}})['then'](handleEntityNotFound(_0x54a651,null))[_0x5e0f('0x1b')](function(_0x32f468){if(_0x32f468){_0x56bf37=_0x32f468;_0x4b0ae7[_0x5e0f('0x39')]=_[_0x5e0f('0x36')](db[_0x5e0f('0x52')][_0x5e0f('0x4b')]);_0x4b0ae7[_0x5e0f('0x35')]=_[_0x5e0f('0x36')](_0x1e3a7e[_0x5e0f('0x35')]);_0x4b0ae7[_0x5e0f('0x37')]=_[_0x5e0f('0x38')](_0x4b0ae7[_0x5e0f('0x39')],_0x4b0ae7[_0x5e0f('0x35')]);_0x502b8e['attributes']=_['intersection'](_0x4b0ae7[_0x5e0f('0x39')],qs['fields'](_0x1e3a7e[_0x5e0f('0x35')]['fields']));_0x502b8e[_0x5e0f('0x3a')]=_0x502b8e[_0x5e0f('0x3a')][_0x5e0f('0x3c')]?_0x502b8e[_0x5e0f('0x3a')]:_0x4b0ae7[_0x5e0f('0x39')];_0x502b8e[_0x5e0f('0x3f')]=qs[_0x5e0f('0x40')](_0x1e3a7e['query'][_0x5e0f('0x40')]);_0x502b8e[_0x5e0f('0x41')]=qs[_0x5e0f('0x37')](_[_0x5e0f('0x42')](_0x1e3a7e[_0x5e0f('0x35')],_0x4b0ae7[_0x5e0f('0x37')]));if(_0x1e3a7e[_0x5e0f('0x35')][_0x5e0f('0x44')]){_0x502b8e['where']=_['merge'](_0x502b8e['where'],{'$or':_[_0x5e0f('0x31')](_0x502b8e['attributes'],function(_0x2e7121){var _0x263cac={};_0x263cac[_0x2e7121]={'$like':'%'+_0x1e3a7e[_0x5e0f('0x35')][_0x5e0f('0x44')]+'%'};return _0x263cac;})});}_0x502b8e=_[_0x5e0f('0x45')]({},_0x502b8e,_0x1e3a7e[_0x5e0f('0x46')]);return _0x56bf37[_0x5e0f('0x53')](_0x502b8e);}})[_0x5e0f('0x1b')](function(_0x91b8fa){if(_0x91b8fa){_0x16789c=_0x91b8fa[_0x5e0f('0x3c')];if(!_0x1e3a7e[_0x5e0f('0x35')][_0x5e0f('0x3d')]('nolimit')){_0x502b8e[_0x5e0f('0x29')]=qs[_0x5e0f('0x29')](_0x1e3a7e[_0x5e0f('0x35')]['limit']);_0x502b8e[_0x5e0f('0x28')]=qs[_0x5e0f('0x28')](_0x1e3a7e[_0x5e0f('0x35')][_0x5e0f('0x28')]);}return _0x56bf37['getSubjects'](_0x502b8e);}})['then'](function(_0x3fc679){if(_0x3fc679){return _0x3fc679?{'count':_0x16789c,'rows':_0x3fc679}:null;}})[_0x5e0f('0x1b')](respondWithResult(_0x54a651,null))['catch'](handleError(_0x54a651,null));};exports[_0x5e0f('0x54')]=function(_0x5b486d,_0x4bece9,_0x3df589){var _0x467c35={};var _0x26eab9={};var _0x50f2bc;var _0x36efb5;return db[_0x5e0f('0x32')][_0x5e0f('0x55')]({'where':{'id':_0x5b486d[_0x5e0f('0x51')]['id']}})[_0x5e0f('0x1b')](handleEntityNotFound(_0x4bece9,null))[_0x5e0f('0x1b')](function(_0x2a6260){if(_0x2a6260){_0x50f2bc=_0x2a6260;_0x26eab9[_0x5e0f('0x39')]=_[_0x5e0f('0x36')](db['FreshsalesField'][_0x5e0f('0x4b')]);_0x26eab9[_0x5e0f('0x35')]=_['keys'](_0x5b486d['query']);_0x26eab9[_0x5e0f('0x37')]=_['intersection'](_0x26eab9['model'],_0x26eab9[_0x5e0f('0x35')]);_0x467c35[_0x5e0f('0x3a')]=_['intersection'](_0x26eab9[_0x5e0f('0x39')],qs[_0x5e0f('0x3b')](_0x5b486d[_0x5e0f('0x35')][_0x5e0f('0x3b')]));_0x467c35[_0x5e0f('0x3a')]=_0x467c35[_0x5e0f('0x3a')][_0x5e0f('0x3c')]?_0x467c35[_0x5e0f('0x3a')]:_0x26eab9[_0x5e0f('0x39')];_0x467c35[_0x5e0f('0x3f')]=qs[_0x5e0f('0x40')](_0x5b486d[_0x5e0f('0x35')]['sort']);_0x467c35[_0x5e0f('0x41')]=qs[_0x5e0f('0x37')](_[_0x5e0f('0x42')](_0x5b486d[_0x5e0f('0x35')],_0x26eab9[_0x5e0f('0x37')]));if(_0x5b486d[_0x5e0f('0x35')]['filter']){_0x467c35[_0x5e0f('0x41')]=_[_0x5e0f('0x45')](_0x467c35['where'],{'$or':_[_0x5e0f('0x31')](_0x467c35[_0x5e0f('0x3a')],function(_0xa88a20){var _0x34516e={};_0x34516e[_0xa88a20]={'$like':'%'+_0x5b486d['query']['filter']+'%'};return _0x34516e;})});}_0x467c35=_[_0x5e0f('0x45')]({},_0x467c35,_0x5b486d[_0x5e0f('0x46')]);return _0x50f2bc['getDescriptions'](_0x467c35);}})[_0x5e0f('0x1b')](function(_0x1ae6ae){if(_0x1ae6ae){_0x36efb5=_0x1ae6ae[_0x5e0f('0x3c')];if(!_0x5b486d['query']['hasOwnProperty']('nolimit')){_0x467c35['limit']=qs[_0x5e0f('0x29')](_0x5b486d[_0x5e0f('0x35')]['limit']);_0x467c35['offset']=qs['offset'](_0x5b486d[_0x5e0f('0x35')][_0x5e0f('0x28')]);}return _0x50f2bc[_0x5e0f('0x54')](_0x467c35);}})[_0x5e0f('0x1b')](function(_0x5835e5){if(_0x5835e5){return _0x5835e5?{'count':_0x36efb5,'rows':_0x5835e5}:null;}})[_0x5e0f('0x1b')](respondWithResult(_0x4bece9,null))[_0x5e0f('0x49')](handleError(_0x4bece9,null));};exports[_0x5e0f('0x56')]=function(_0x47c526,_0x5a1de5,_0x213992){var _0x2d6c94={};var _0x38a0cc={};var _0x4e5194;var _0x4d9f4d;return db[_0x5e0f('0x32')][_0x5e0f('0x55')]({'where':{'id':_0x47c526['params']['id']}})[_0x5e0f('0x1b')](handleEntityNotFound(_0x5a1de5,null))[_0x5e0f('0x1b')](function(_0x5055ea){if(_0x5055ea){_0x4e5194=_0x5055ea;_0x38a0cc['model']=_['keys'](db[_0x5e0f('0x52')][_0x5e0f('0x4b')]);_0x38a0cc[_0x5e0f('0x35')]=_[_0x5e0f('0x36')](_0x47c526[_0x5e0f('0x35')]);_0x38a0cc[_0x5e0f('0x37')]=_[_0x5e0f('0x38')](_0x38a0cc[_0x5e0f('0x39')],_0x38a0cc[_0x5e0f('0x35')]);_0x2d6c94[_0x5e0f('0x3a')]=_[_0x5e0f('0x38')](_0x38a0cc[_0x5e0f('0x39')],qs[_0x5e0f('0x3b')](_0x47c526['query'][_0x5e0f('0x3b')]));_0x2d6c94[_0x5e0f('0x3a')]=_0x2d6c94[_0x5e0f('0x3a')]['length']?_0x2d6c94[_0x5e0f('0x3a')]:_0x38a0cc[_0x5e0f('0x39')];_0x2d6c94[_0x5e0f('0x3f')]=qs[_0x5e0f('0x40')](_0x47c526[_0x5e0f('0x35')]['sort']);_0x2d6c94[_0x5e0f('0x41')]=qs['filters'](_[_0x5e0f('0x42')](_0x47c526['query'],_0x38a0cc[_0x5e0f('0x37')]));if(_0x47c526[_0x5e0f('0x35')][_0x5e0f('0x44')]){_0x2d6c94[_0x5e0f('0x41')]=_[_0x5e0f('0x45')](_0x2d6c94['where'],{'$or':_[_0x5e0f('0x31')](_0x2d6c94[_0x5e0f('0x3a')],function(_0x49e7dd){var _0x382d5f={};_0x382d5f[_0x49e7dd]={'$like':'%'+_0x47c526['query'][_0x5e0f('0x44')]+'%'};return _0x382d5f;})});}_0x2d6c94=_['merge']({},_0x2d6c94,_0x47c526[_0x5e0f('0x46')]);return _0x4e5194[_0x5e0f('0x56')](_0x2d6c94);}})[_0x5e0f('0x1b')](function(_0x5ad619){if(_0x5ad619){_0x4d9f4d=_0x5ad619[_0x5e0f('0x3c')];if(!_0x47c526['query']['hasOwnProperty'](_0x5e0f('0x3e'))){_0x2d6c94[_0x5e0f('0x29')]=qs[_0x5e0f('0x29')](_0x47c526[_0x5e0f('0x35')][_0x5e0f('0x29')]);_0x2d6c94[_0x5e0f('0x28')]=qs[_0x5e0f('0x28')](_0x47c526[_0x5e0f('0x35')][_0x5e0f('0x28')]);}return _0x4e5194[_0x5e0f('0x56')](_0x2d6c94);}})['then'](function(_0x16192d){if(_0x16192d){return _0x16192d?{'count':_0x4d9f4d,'rows':_0x16192d}:null;}})[_0x5e0f('0x1b')](respondWithResult(_0x5a1de5,null))['catch'](handleError(_0x5a1de5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 2c23bbd..0620004 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 _0xabc7=['util','../../config/logger','moment','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash'];(function(_0x36edb8,_0x1926e9){var _0x2a8990=function(_0x40b7c4){while(--_0x40b7c4){_0x36edb8['push'](_0x36edb8['shift']());}};_0x2a8990(++_0x1926e9);}(_0xabc7,0xc7));var _0x7abc=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xabc7[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var logger=require(_0x7abc('0x2'))('api');var moment=require(_0x7abc('0x3'));var BPromise=require(_0x7abc('0x4'));var rp=require(_0x7abc('0x5'));var fs=require('fs');var path=require(_0x7abc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7abc('0x7'));module[_0x7abc('0x8')]=function(_0x542c09,_0x226476){return _0x542c09['define']('FreshsalesConfiguration',attributes,{'tableName':_0x7abc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xa9e5,0x8a));var _0x5a9e=function(_0x885c87,_0x48cce8){_0x885c87=_0x885c87-0x0;var _0x2ffda4=_0xa9e5[_0x885c87];return _0x2ffda4;};'use strict';var _=require(_0x5a9e('0x0'));var util=require(_0x5a9e('0x1'));var logger=require('../../config/logger')(_0x5a9e('0x2'));var moment=require(_0x5a9e('0x3'));var BPromise=require(_0x5a9e('0x4'));var rp=require(_0x5a9e('0x5'));var fs=require('fs');var path=require(_0x5a9e('0x6'));var rimraf=require(_0x5a9e('0x7'));var config=require(_0x5a9e('0x8'));var attributes=require(_0x5a9e('0x9'));module[_0x5a9e('0xa')]=function(_0x34a9ed,_0x1fb122){return _0x34a9ed[_0x5a9e('0xb')](_0x5a9e('0xc'),attributes,{'tableName':_0x5a9e('0xd'),'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 2e34235..5980f8e 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 _0x0cee=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5177a7,_0x490fd4){var _0x1a0fcd=function(_0x35d63d){while(--_0x35d63d){_0x5177a7['push'](_0x5177a7['shift']());}};_0x1a0fcd(++_0x490fd4);}(_0x0cee,0x12f));var _0xe0ce=function(_0x3d7e4b,_0x1af44f){_0x3d7e4b=_0x3d7e4b-0x0;var _0x32512e=_0x0cee[_0x3d7e4b];return _0x32512e;};'use strict';var _=require(_0xe0ce('0x0'));var util=require(_0xe0ce('0x1'));var moment=require(_0xe0ce('0x2'));var BPromise=require(_0xe0ce('0x3'));var rs=require(_0xe0ce('0x4'));var fs=require('fs');var Redis=require(_0xe0ce('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe0ce('0x6'))(_0xe0ce('0x7'));var config=require(_0xe0ce('0x8'));var jayson=require(_0xe0ce('0x9'));var client=jayson[_0xe0ce('0xa')][_0xe0ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x64f82c,_0x415f34,_0x494eca){return new BPromise(function(_0x27eea3,_0x2fa936){return client['request'](_0x64f82c,_0x494eca)[_0xe0ce('0xc')](function(_0x94afeb){logger[_0xe0ce('0xd')](_0xe0ce('0xe'),_0x415f34,'request\x20sent');logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x415f34,_0xe0ce('0xf'),JSON[_0xe0ce('0x10')](_0x94afeb));if(_0x94afeb[_0xe0ce('0x11')]){if(_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x12')]===0x1f4){logger[_0xe0ce('0x11')](_0xe0ce('0xe'),_0x415f34,_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x13')]);return _0x2fa936(_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x13')]);}logger[_0xe0ce('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x415f34,_0x94afeb['error'][_0xe0ce('0x13')]);return _0x27eea3(_0x94afeb[_0xe0ce('0x11')]['message']);}else{logger['info'](_0xe0ce('0xe'),_0x415f34,_0xe0ce('0xf'));_0x27eea3(_0x94afeb[_0xe0ce('0x14')][_0xe0ce('0x13')]);}})[_0xe0ce('0x15')](function(_0x4e82bc){logger[_0xe0ce('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x415f34,_0x4e82bc);_0x2fa936(_0x4e82bc);});});} \ No newline at end of file +var _0xae60=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x458260,_0x26b6e8){var _0x1657a3=function(_0x529e08){while(--_0x529e08){_0x458260['push'](_0x458260['shift']());}};_0x1657a3(++_0x26b6e8);}(_0xae60,0x1c7));var _0x0ae6=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xae60[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7df2d4b..37d4df5 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 _0x80d2=['post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5c7a3d,_0xd33d74){var _0x573dbb=function(_0x1f3ccc){while(--_0x1f3ccc){_0x5c7a3d['push'](_0x5c7a3d['shift']());}};_0x573dbb(++_0xd33d74);}(_0x80d2,0x194));var _0x280d=function(_0x4bc3f7,_0x3f9c98){_0x4bc3f7=_0x4bc3f7-0x0;var _0x21e138=_0x80d2[_0x4bc3f7];return _0x21e138;};'use strict';var multer=require(_0x280d('0x0'));var util=require(_0x280d('0x1'));var path=require(_0x280d('0x2'));var timeout=require('connect-timeout');var express=require(_0x280d('0x3'));var router=express[_0x280d('0x4')]();var auth=require(_0x280d('0x5'));var interaction=require(_0x280d('0x6'));var config=require(_0x280d('0x7'));var controller=require(_0x280d('0x8'));router[_0x280d('0x9')]('/',auth[_0x280d('0xa')](),controller[_0x280d('0xb')]);router[_0x280d('0x9')](_0x280d('0xc'),auth[_0x280d('0xa')](),controller[_0x280d('0xd')]);router[_0x280d('0xe')]('/',auth[_0x280d('0xa')](),controller[_0x280d('0xf')]);router[_0x280d('0x10')](_0x280d('0xc'),auth[_0x280d('0xa')](),controller[_0x280d('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x280d('0x12')]=router; \ No newline at end of file +var _0x4d38=['../../components/interaction/service','./intFreshsalesField.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','express','../../components/auth/service'];(function(_0x13a4bf,_0x56cb27){var _0x2933d6=function(_0x4a966f){while(--_0x4a966f){_0x13a4bf['push'](_0x13a4bf['shift']());}};_0x2933d6(++_0x56cb27);}(_0x4d38,0xc7));var _0x84d3=function(_0x276e0a,_0xfa4f3f){_0x276e0a=_0x276e0a-0x0;var _0x1f2970=_0x4d38[_0x276e0a];return _0x1f2970;};'use strict';var multer=require(_0x84d3('0x0'));var util=require(_0x84d3('0x1'));var path=require(_0x84d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x84d3('0x3'));var router=express['Router']();var auth=require(_0x84d3('0x4'));var interaction=require(_0x84d3('0x5'));var config=require('../../config/environment');var controller=require(_0x84d3('0x6'));router[_0x84d3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x84d3('0x8'),auth[_0x84d3('0x9')](),controller[_0x84d3('0xa')]);router[_0x84d3('0xb')]('/',auth[_0x84d3('0x9')](),controller[_0x84d3('0xc')]);router[_0x84d3('0xd')](_0x84d3('0x8'),auth[_0x84d3('0x9')](),controller[_0x84d3('0xe')]);router[_0x84d3('0xf')](_0x84d3('0x8'),auth[_0x84d3('0x9')](),controller[_0x84d3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0e93b36..76476c6 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 _0x8db9=['customVariable','keyValue','STRING','sequelize','exports','ENUM','variable'];(function(_0x15771e,_0x10835a){var _0x5e95ec=function(_0x4524a4){while(--_0x4524a4){_0x15771e['push'](_0x15771e['shift']());}};_0x5e95ec(++_0x10835a);}(_0x8db9,0x1a0));var _0x98db=function(_0x3b71f1,_0x2b3133){_0x3b71f1=_0x3b71f1-0x0;var _0x4fb5e8=_0x8db9[_0x3b71f1];return _0x4fb5e8;};'use strict';var Sequelize=require(_0x98db('0x0'));module[_0x98db('0x1')]={'type':{'type':Sequelize[_0x98db('0x2')]('string',_0x98db('0x3'),_0x98db('0x4'),_0x98db('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x98db('0x2')]('string',_0x98db('0x3'),_0x98db('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x98db('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x98db('0x6')]}}; \ No newline at end of file +var _0x5b8a=['sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x41b471,_0x1267fa){var _0x213b35=function(_0x14e4de){while(--_0x14e4de){_0x41b471['push'](_0x41b471['shift']());}};_0x213b35(++_0x1267fa);}(_0x5b8a,0x14d));var _0xa5b8=function(_0x5da7e0,_0x58d53b){_0x5da7e0=_0x5da7e0-0x0;var _0x240849=_0x5b8a[_0x5da7e0];return _0x240849;};'use strict';var Sequelize=require(_0xa5b8('0x0'));module[_0xa5b8('0x1')]={'type':{'type':Sequelize[_0xa5b8('0x2')]('string',_0xa5b8('0x3'),_0xa5b8('0x4'),_0xa5b8('0x5')),'defaultValue':_0xa5b8('0x6')},'content':{'type':Sequelize[_0xa5b8('0x7')]},'key':{'type':Sequelize[_0xa5b8('0x7')]},'keyType':{'type':Sequelize[_0xa5b8('0x2')]('string',_0xa5b8('0x3'),_0xa5b8('0x4'))},'keyContent':{'type':Sequelize[_0xa5b8('0x7')]},'idField':{'type':Sequelize[_0xa5b8('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa5b8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa5b8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 50c1103..5e5a1f5 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 _0x6e2d=['then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','FreshsalesField','includeAll','include','rows','catch','show','params','length','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','update'];(function(_0x25ed12,_0x219e17){var _0x5c3856=function(_0x111f23){while(--_0x111f23){_0x25ed12['push'](_0x25ed12['shift']());}};_0x5c3856(++_0x219e17);}(_0x6e2d,0xf4));var _0xd6e2=function(_0x218a4d,_0x10a963){_0x218a4d=_0x218a4d-0x0;var _0x594420=_0x6e2d[_0x218a4d];return _0x594420;};'use strict';var pdf=require(_0xd6e2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd6e2('0x1'));var zipdir=require(_0xd6e2('0x2'));var jsonpatch=require(_0xd6e2('0x3'));var rp=require(_0xd6e2('0x4'));var moment=require('moment');var BPromise=require(_0xd6e2('0x5'));var Mustache=require(_0xd6e2('0x6'));var util=require(_0xd6e2('0x7'));var path=require(_0xd6e2('0x8'));var sox=require(_0xd6e2('0x9'));var csv=require(_0xd6e2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd6e2('0xb'));var crypto=require(_0xd6e2('0xc'));var jsforce=require(_0xd6e2('0xd'));var deskjs=require(_0xd6e2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6e2('0xf'));var Redis=require(_0xd6e2('0x10'));var authService=require(_0xd6e2('0x11'));var qs=require(_0xd6e2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd6e2('0x13'));var utils=require(_0xd6e2('0x14'));var config=require(_0xd6e2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa43d1b,_0xdb8ca9){_0xdb8ca9=_0xdb8ca9||0xcc;return function(_0x384df8){if(_0x384df8){return _0xa43d1b[_0xd6e2('0x16')](_0xdb8ca9);}return _0xa43d1b['status'](_0xdb8ca9)[_0xd6e2('0x17')]();};}function respondWithResult(_0xc824da,_0x33e32c){_0x33e32c=_0x33e32c||0xc8;return function(_0x12d2a6){if(_0x12d2a6){return _0xc824da[_0xd6e2('0x18')](_0x33e32c)[_0xd6e2('0x19')](_0x12d2a6);}};}function respondWithFilteredResult(_0x423591,_0x159e75){return function(_0x45fb18){if(_0x45fb18){var _0x14d912=_0x45fb18[_0xd6e2('0x1a')],_0x3de988=_0x159e75[_0xd6e2('0x1b')],_0x2a546d=_0x159e75[_0xd6e2('0x1b')]+_0x159e75[_0xd6e2('0x1c')],_0x343d10;if(_0x2a546d>=_0x14d912){_0x2a546d=_0x14d912;_0x343d10=0xc8;}else{_0x343d10=0xce;}_0x423591[_0xd6e2('0x18')](_0x343d10);return _0x423591[_0xd6e2('0x1d')](_0xd6e2('0x1e'),_0x3de988+'-'+_0x2a546d+'/'+_0x14d912)[_0xd6e2('0x19')](_0x45fb18);}return null;};}function patchUpdates(_0x1d78e8){return function(_0x1b209b){try{jsonpatch['apply'](_0x1b209b,_0x1d78e8,!![]);}catch(_0x155c07){return BPromise['reject'](_0x155c07);}return _0x1b209b['save']();};}function saveUpdates(_0x18dd40,_0x3d9388){return function(_0x157315){if(_0x157315){return _0x157315[_0xd6e2('0x1f')](_0x18dd40)[_0xd6e2('0x20')](function(_0x1cddc9){return _0x1cddc9;});}return null;};}function removeEntity(_0x1f5e13,_0x2206c6){return function(_0x21b0ff){if(_0x21b0ff){return _0x21b0ff[_0xd6e2('0x21')]()[_0xd6e2('0x20')](function(){_0x1f5e13[_0xd6e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a267a,_0xdc0411){return function(_0xb264b8){if(!_0xb264b8){_0x2a267a[_0xd6e2('0x16')](0x194);}return _0xb264b8;};}function handleError(_0x5d38a4,_0x18c661){_0x18c661=_0x18c661||0x1f4;return function(_0x1860d6){logger[_0xd6e2('0x22')](_0x1860d6[_0xd6e2('0x23')]);if(_0x1860d6[_0xd6e2('0x24')]){delete _0x1860d6[_0xd6e2('0x24')];}_0x5d38a4[_0xd6e2('0x18')](_0x18c661)['send'](_0x1860d6);};}exports[_0xd6e2('0x25')]=function(_0x486837,_0x3fdf2b){var _0x503925={},_0x4dec85={},_0x12603c={'count':0x0,'rows':[]};var _0x36ec7f=_[_0xd6e2('0x26')](db['FreshsalesField'][_0xd6e2('0x27')],function(_0x37295b){return{'name':_0x37295b[_0xd6e2('0x28')],'type':_0x37295b['type'][_0xd6e2('0x29')]};});_0x4dec85['model']=_[_0xd6e2('0x26')](_0x36ec7f,_0xd6e2('0x24'));_0x4dec85['query']=_[_0xd6e2('0x2a')](_0x486837[_0xd6e2('0x2b')]);_0x4dec85[_0xd6e2('0x2c')]=_['intersection'](_0x4dec85[_0xd6e2('0x2d')],_0x4dec85[_0xd6e2('0x2b')]);_0x503925[_0xd6e2('0x2e')]=_[_0xd6e2('0x2f')](_0x4dec85[_0xd6e2('0x2d')],qs[_0xd6e2('0x30')](_0x486837[_0xd6e2('0x2b')][_0xd6e2('0x30')]));_0x503925[_0xd6e2('0x2e')]=_0x503925[_0xd6e2('0x2e')]['length']?_0x503925[_0xd6e2('0x2e')]:_0x4dec85['model'];if(!_0x486837['query'][_0xd6e2('0x31')]('nolimit')){_0x503925[_0xd6e2('0x1c')]=qs['limit'](_0x486837[_0xd6e2('0x2b')][_0xd6e2('0x1c')]);_0x503925['offset']=qs['offset'](_0x486837[_0xd6e2('0x2b')][_0xd6e2('0x1b')]);}_0x503925[_0xd6e2('0x32')]=qs['sort'](_0x486837[_0xd6e2('0x2b')][_0xd6e2('0x33')]);_0x503925[_0xd6e2('0x34')]=qs[_0xd6e2('0x2c')](_['pick'](_0x486837[_0xd6e2('0x2b')],_0x4dec85['filters']),_0x36ec7f);if(_0x486837[_0xd6e2('0x2b')]['filter']){_0x503925[_0xd6e2('0x34')]=_[_0xd6e2('0x35')](_0x503925[_0xd6e2('0x34')],{'$or':_[_0xd6e2('0x26')](_0x36ec7f,function(_0x50aa22){if(_0x50aa22[_0xd6e2('0x36')]!==_0xd6e2('0x37')){var _0x8eb5c6={};_0x8eb5c6[_0x50aa22[_0xd6e2('0x24')]]={'$like':'%'+_0x486837['query'][_0xd6e2('0x38')]+'%'};return _0x8eb5c6;}})});}_0x503925=_[_0xd6e2('0x35')]({},_0x503925,_0x486837[_0xd6e2('0x39')]);var _0x3323c4={'where':_0x503925[_0xd6e2('0x34')]};return db[_0xd6e2('0x3a')][_0xd6e2('0x1a')](_0x3323c4)[_0xd6e2('0x20')](function(_0x3d4b54){_0x12603c[_0xd6e2('0x1a')]=_0x3d4b54;if(_0x486837[_0xd6e2('0x2b')][_0xd6e2('0x3b')]){_0x503925[_0xd6e2('0x3c')]=[{'all':!![]}];}return db[_0xd6e2('0x3a')]['findAll'](_0x503925);})[_0xd6e2('0x20')](function(_0x558c86){_0x12603c[_0xd6e2('0x3d')]=_0x558c86;return _0x12603c;})[_0xd6e2('0x20')](respondWithFilteredResult(_0x3fdf2b,_0x503925))[_0xd6e2('0x3e')](handleError(_0x3fdf2b,null));};exports[_0xd6e2('0x3f')]=function(_0x1d5dca,_0x813047){var _0x7b9309={'raw':!![],'where':{'id':_0x1d5dca[_0xd6e2('0x40')]['id']}},_0x5ac493={};_0x5ac493['model']=_[_0xd6e2('0x2a')](db[_0xd6e2('0x3a')]['rawAttributes']);_0x5ac493[_0xd6e2('0x2b')]=_[_0xd6e2('0x2a')](_0x1d5dca[_0xd6e2('0x2b')]);_0x5ac493[_0xd6e2('0x2c')]=_[_0xd6e2('0x2f')](_0x5ac493[_0xd6e2('0x2d')],_0x5ac493[_0xd6e2('0x2b')]);_0x7b9309['attributes']=_[_0xd6e2('0x2f')](_0x5ac493[_0xd6e2('0x2d')],qs[_0xd6e2('0x30')](_0x1d5dca['query']['fields']));_0x7b9309[_0xd6e2('0x2e')]=_0x7b9309['attributes'][_0xd6e2('0x41')]?_0x7b9309[_0xd6e2('0x2e')]:_0x5ac493[_0xd6e2('0x2d')];if(_0x1d5dca[_0xd6e2('0x2b')][_0xd6e2('0x3b')]){_0x7b9309[_0xd6e2('0x3c')]=[{'all':!![]}];}_0x7b9309=_[_0xd6e2('0x35')]({},_0x7b9309,_0x1d5dca[_0xd6e2('0x39')]);return db[_0xd6e2('0x3a')][_0xd6e2('0x42')](_0x7b9309)[_0xd6e2('0x20')](handleEntityNotFound(_0x813047,null))[_0xd6e2('0x20')](respondWithResult(_0x813047,null))[_0xd6e2('0x3e')](handleError(_0x813047,null));};exports[_0xd6e2('0x43')]=function(_0x47e25d,_0x4051fd){return db[_0xd6e2('0x3a')][_0xd6e2('0x43')](_0x47e25d[_0xd6e2('0x44')],{})[_0xd6e2('0x20')](respondWithResult(_0x4051fd,0xc9))['catch'](handleError(_0x4051fd,null));};exports[_0xd6e2('0x1f')]=function(_0x4fa659,_0x5da274){if(_0x4fa659['body']['id']){delete _0x4fa659[_0xd6e2('0x44')]['id'];}return db[_0xd6e2('0x3a')][_0xd6e2('0x42')]({'where':{'id':_0x4fa659[_0xd6e2('0x40')]['id']}})[_0xd6e2('0x20')](handleEntityNotFound(_0x5da274,null))[_0xd6e2('0x20')](saveUpdates(_0x4fa659[_0xd6e2('0x44')],null))['then'](respondWithResult(_0x5da274,null))[_0xd6e2('0x3e')](handleError(_0x5da274,null));};exports[_0xd6e2('0x21')]=function(_0x484c4f,_0x2020d7){return db[_0xd6e2('0x3a')][_0xd6e2('0x42')]({'where':{'id':_0x484c4f[_0xd6e2('0x40')]['id']}})[_0xd6e2('0x20')](handleEntityNotFound(_0x2020d7,null))[_0xd6e2('0x20')](removeEntity(_0x2020d7,null))[_0xd6e2('0x3e')](handleError(_0x2020d7,null));}; \ No newline at end of file +var _0xf47b=['attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','VIRTUAL','merge','options','FreshsalesField','then','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','save','update','error','stack','name','index','type','key','model','map','query','keys','filters','intersection'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0xf47b,0xa2));var _0xbf47=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xf47b[_0x1a36a5];return _0x746243;};'use strict';var pdf=require(_0xbf47('0x0'));var emlformat=require(_0xbf47('0x1'));var rimraf=require(_0xbf47('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf47('0x3'));var rp=require(_0xbf47('0x4'));var moment=require(_0xbf47('0x5'));var BPromise=require(_0xbf47('0x6'));var Mustache=require(_0xbf47('0x7'));var util=require(_0xbf47('0x8'));var path=require('path');var sox=require(_0xbf47('0x9'));var csv=require(_0xbf47('0xa'));var ejs=require(_0xbf47('0xb'));var fs=require('fs');var _=require(_0xbf47('0xc'));var squel=require(_0xbf47('0xd'));var crypto=require(_0xbf47('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbf47('0xf'));var toCsv=require(_0xbf47('0xa'));var querystring=require('querystring');var Papa=require(_0xbf47('0x10'));var Redis=require(_0xbf47('0x11'));var authService=require(_0xbf47('0x12'));var qs=require(_0xbf47('0x13'));var as=require(_0xbf47('0x14'));var hardwareService=require(_0xbf47('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xbf47('0x16'));var config=require(_0xbf47('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x148cb9,_0x43041d){_0x43041d=_0x43041d||0xcc;return function(_0x483467){if(_0x483467){return _0x148cb9[_0xbf47('0x18')](_0x43041d);}return _0x148cb9['status'](_0x43041d)['end']();};}function respondWithResult(_0x3a954d,_0x18d0ad){_0x18d0ad=_0x18d0ad||0xc8;return function(_0x5e3d07){if(_0x5e3d07){return _0x3a954d[_0xbf47('0x19')](_0x18d0ad)[_0xbf47('0x1a')](_0x5e3d07);}};}function respondWithFilteredResult(_0x86cbc6,_0x27e4d5){return function(_0x3745d2){if(_0x3745d2){var _0x43c0cb=_0x3745d2[_0xbf47('0x1b')],_0x16d730=_0x27e4d5[_0xbf47('0x1c')],_0x5de6b1=_0x27e4d5[_0xbf47('0x1c')]+_0x27e4d5['limit'],_0x59a645;if(_0x5de6b1>=_0x43c0cb){_0x5de6b1=_0x43c0cb;_0x59a645=0xc8;}else{_0x59a645=0xce;}_0x86cbc6['status'](_0x59a645);return _0x86cbc6[_0xbf47('0x1d')](_0xbf47('0x1e'),_0x16d730+'-'+_0x5de6b1+'/'+_0x43c0cb)[_0xbf47('0x1a')](_0x3745d2);}return null;};}function patchUpdates(_0x15b46d){return function(_0x6c1d08){try{jsonpatch['apply'](_0x6c1d08,_0x15b46d,!![]);}catch(_0x3eb755){return BPromise['reject'](_0x3eb755);}return _0x6c1d08[_0xbf47('0x1f')]();};}function saveUpdates(_0x3e0566,_0x5444f9){return function(_0x2e3334){if(_0x2e3334){return _0x2e3334[_0xbf47('0x20')](_0x3e0566)['then'](function(_0xcab747){return _0xcab747;});}return null;};}function removeEntity(_0x58416c,_0xdcd548){return function(_0x5c0eb1){if(_0x5c0eb1){return _0x5c0eb1['destroy']()['then'](function(){_0x58416c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0379f,_0x4d64f3){return function(_0x1b971f){if(!_0x1b971f){_0xe0379f['sendStatus'](0x194);}return _0x1b971f;};}function handleError(_0x536276,_0xa14e08){_0xa14e08=_0xa14e08||0x1f4;return function(_0x59b35a){logger[_0xbf47('0x21')](_0x59b35a[_0xbf47('0x22')]);if(_0x59b35a[_0xbf47('0x23')]){delete _0x59b35a[_0xbf47('0x23')];}_0x536276[_0xbf47('0x19')](_0xa14e08)['send'](_0x59b35a);};}exports[_0xbf47('0x24')]=function(_0x94b891,_0x403381){var _0x539f27={},_0xe5b5d1={},_0x280f3e={'count':0x0,'rows':[]};var _0x586e96=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x2be49c){return{'name':_0x2be49c['fieldName'],'type':_0x2be49c[_0xbf47('0x25')][_0xbf47('0x26')]};});_0xe5b5d1[_0xbf47('0x27')]=_[_0xbf47('0x28')](_0x586e96,_0xbf47('0x23'));_0xe5b5d1[_0xbf47('0x29')]=_[_0xbf47('0x2a')](_0x94b891[_0xbf47('0x29')]);_0xe5b5d1[_0xbf47('0x2b')]=_[_0xbf47('0x2c')](_0xe5b5d1[_0xbf47('0x27')],_0xe5b5d1[_0xbf47('0x29')]);_0x539f27[_0xbf47('0x2d')]=_[_0xbf47('0x2c')](_0xe5b5d1[_0xbf47('0x27')],qs[_0xbf47('0x2e')](_0x94b891['query'][_0xbf47('0x2e')]));_0x539f27[_0xbf47('0x2d')]=_0x539f27[_0xbf47('0x2d')][_0xbf47('0x2f')]?_0x539f27[_0xbf47('0x2d')]:_0xe5b5d1[_0xbf47('0x27')];if(!_0x94b891['query'][_0xbf47('0x30')](_0xbf47('0x31'))){_0x539f27['limit']=qs[_0xbf47('0x32')](_0x94b891[_0xbf47('0x29')][_0xbf47('0x32')]);_0x539f27[_0xbf47('0x1c')]=qs[_0xbf47('0x1c')](_0x94b891[_0xbf47('0x29')]['offset']);}_0x539f27['order']=qs[_0xbf47('0x33')](_0x94b891['query'][_0xbf47('0x33')]);_0x539f27[_0xbf47('0x34')]=qs[_0xbf47('0x2b')](_['pick'](_0x94b891['query'],_0xe5b5d1['filters']),_0x586e96);if(_0x94b891[_0xbf47('0x29')]['filter']){_0x539f27['where']=_['merge'](_0x539f27['where'],{'$or':_[_0xbf47('0x28')](_0x586e96,function(_0x44edc8){if(_0x44edc8[_0xbf47('0x25')]!==_0xbf47('0x35')){var _0x100b24={};_0x100b24[_0x44edc8[_0xbf47('0x23')]]={'$like':'%'+_0x94b891[_0xbf47('0x29')]['filter']+'%'};return _0x100b24;}})});}_0x539f27=_[_0xbf47('0x36')]({},_0x539f27,_0x94b891[_0xbf47('0x37')]);var _0x4c009d={'where':_0x539f27[_0xbf47('0x34')]};return db[_0xbf47('0x38')][_0xbf47('0x1b')](_0x4c009d)[_0xbf47('0x39')](function(_0x16de48){_0x280f3e[_0xbf47('0x1b')]=_0x16de48;if(_0x94b891[_0xbf47('0x29')][_0xbf47('0x3a')]){_0x539f27[_0xbf47('0x3b')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x539f27);})[_0xbf47('0x39')](function(_0x27dc35){_0x280f3e[_0xbf47('0x3c')]=_0x27dc35;return _0x280f3e;})['then'](respondWithFilteredResult(_0x403381,_0x539f27))[_0xbf47('0x3d')](handleError(_0x403381,null));};exports[_0xbf47('0x3e')]=function(_0x2e25c4,_0x547d98){var _0x4234da={'raw':!![],'where':{'id':_0x2e25c4[_0xbf47('0x3f')]['id']}},_0xcae633={};_0xcae633[_0xbf47('0x27')]=_[_0xbf47('0x2a')](db[_0xbf47('0x38')][_0xbf47('0x40')]);_0xcae633[_0xbf47('0x29')]=_[_0xbf47('0x2a')](_0x2e25c4[_0xbf47('0x29')]);_0xcae633['filters']=_[_0xbf47('0x2c')](_0xcae633['model'],_0xcae633[_0xbf47('0x29')]);_0x4234da['attributes']=_['intersection'](_0xcae633[_0xbf47('0x27')],qs['fields'](_0x2e25c4['query'][_0xbf47('0x2e')]));_0x4234da[_0xbf47('0x2d')]=_0x4234da[_0xbf47('0x2d')][_0xbf47('0x2f')]?_0x4234da[_0xbf47('0x2d')]:_0xcae633[_0xbf47('0x27')];if(_0x2e25c4[_0xbf47('0x29')][_0xbf47('0x3a')]){_0x4234da[_0xbf47('0x3b')]=[{'all':!![]}];}_0x4234da=_[_0xbf47('0x36')]({},_0x4234da,_0x2e25c4[_0xbf47('0x37')]);return db[_0xbf47('0x38')]['find'](_0x4234da)[_0xbf47('0x39')](handleEntityNotFound(_0x547d98,null))[_0xbf47('0x39')](respondWithResult(_0x547d98,null))[_0xbf47('0x3d')](handleError(_0x547d98,null));};exports[_0xbf47('0x41')]=function(_0x828d3a,_0x44aa8f){return db[_0xbf47('0x38')]['create'](_0x828d3a[_0xbf47('0x42')],{})[_0xbf47('0x39')](respondWithResult(_0x44aa8f,0xc9))['catch'](handleError(_0x44aa8f,null));};exports[_0xbf47('0x20')]=function(_0x39902d,_0x4f28a2){if(_0x39902d[_0xbf47('0x42')]['id']){delete _0x39902d[_0xbf47('0x42')]['id'];}return db['FreshsalesField'][_0xbf47('0x43')]({'where':{'id':_0x39902d['params']['id']}})['then'](handleEntityNotFound(_0x4f28a2,null))[_0xbf47('0x39')](saveUpdates(_0x39902d[_0xbf47('0x42')],null))[_0xbf47('0x39')](respondWithResult(_0x4f28a2,null))[_0xbf47('0x3d')](handleError(_0x4f28a2,null));};exports[_0xbf47('0x44')]=function(_0x35418f,_0x56fbe6){return db['FreshsalesField'][_0xbf47('0x43')]({'where':{'id':_0x35418f[_0xbf47('0x3f')]['id']}})[_0xbf47('0x39')](handleEntityNotFound(_0x56fbe6,null))['then'](removeEntity(_0x56fbe6,null))['catch'](handleError(_0x56fbe6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 622ad11..c3557c4 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 _0xafd0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xafd0,0x18e));var _0x0afd=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xafd0[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x0afd('0x0'));var util=require(_0x0afd('0x1'));var logger=require(_0x0afd('0x2'))(_0x0afd('0x3'));var moment=require(_0x0afd('0x4'));var BPromise=require(_0x0afd('0x5'));var rp=require(_0x0afd('0x6'));var fs=require('fs');var path=require(_0x0afd('0x7'));var rimraf=require(_0x0afd('0x8'));var config=require(_0x0afd('0x9'));var attributes=require('./intFreshsalesField.attributes');module[_0x0afd('0xa')]=function(_0x12ba31,_0x58ee9b){return _0x12ba31[_0x0afd('0xb')](_0x0afd('0xc'),attributes,{'tableName':_0x0afd('0xd'),'paranoid':![],'indexes':[{'name':_0x0afd('0xe'),'fields':[_0x0afd('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd346=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash'];(function(_0x2f2a31,_0x3e6651){var _0x538b4e=function(_0x117cef){while(--_0x117cef){_0x2f2a31['push'](_0x2f2a31['shift']());}};_0x538b4e(++_0x3e6651);}(_0xd346,0x133));var _0x6d34=function(_0x4cdb55,_0x1e657f){_0x4cdb55=_0x4cdb55-0x0;var _0x17064d=_0xd346[_0x4cdb55];return _0x17064d;};'use strict';var _=require(_0x6d34('0x0'));var util=require(_0x6d34('0x1'));var logger=require(_0x6d34('0x2'))(_0x6d34('0x3'));var moment=require('moment');var BPromise=require(_0x6d34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d34('0x5'));var rimraf=require(_0x6d34('0x6'));var config=require(_0x6d34('0x7'));var attributes=require(_0x6d34('0x8'));module['exports']=function(_0x22e8d1,_0x14520b){return _0x22e8d1[_0x6d34('0x9')]('FreshsalesField',attributes,{'tableName':_0x6d34('0xa'),'paranoid':![],'indexes':[{'name':_0x6d34('0xb'),'fields':[_0x6d34('0xc'),_0x6d34('0xd')],'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 d36dd2a..e7364c4 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 _0xad3e=['FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesField,\x20%s,\x20%s'];(function(_0x42dc4e,_0x9e04ff){var _0x2a5f48=function(_0x401195){while(--_0x401195){_0x42dc4e['push'](_0x42dc4e['shift']());}};_0x2a5f48(++_0x9e04ff);}(_0xad3e,0xa9));var _0xead3=function(_0x1cf775,_0x3d9f15){_0x1cf775=_0x1cf775-0x0;var _0x223e11=_0xad3e[_0x1cf775];return _0x223e11;};'use strict';var _=require(_0xead3('0x0'));var util=require(_0xead3('0x1'));var moment=require(_0xead3('0x2'));var BPromise=require(_0xead3('0x3'));var rs=require(_0xead3('0x4'));var fs=require('fs');var Redis=require(_0xead3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xead3('0x6'));var logger=require(_0xead3('0x7'))(_0xead3('0x8'));var config=require(_0xead3('0x9'));var jayson=require(_0xead3('0xa'));var client=jayson[_0xead3('0xb')][_0xead3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5be21c,_0x53de5d,_0x2402a5){return new BPromise(function(_0x26c061,_0x496060){return client[_0xead3('0xd')](_0x5be21c,_0x2402a5)['then'](function(_0x484ada){logger['info'](_0xead3('0xe'),_0x53de5d,'request\x20sent');logger['debug'](_0xead3('0xf'),_0x53de5d,_0xead3('0x10'),JSON[_0xead3('0x11')](_0x484ada));if(_0x484ada[_0xead3('0x12')]){if(_0x484ada[_0xead3('0x12')][_0xead3('0x13')]===0x1f4){logger[_0xead3('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x53de5d,_0x484ada[_0xead3('0x12')]['message']);return _0x496060(_0x484ada[_0xead3('0x12')]['message']);}logger[_0xead3('0x12')](_0xead3('0xe'),_0x53de5d,_0x484ada[_0xead3('0x12')]['message']);return _0x26c061(_0x484ada['error'][_0xead3('0x14')]);}else{logger[_0xead3('0x15')](_0xead3('0xe'),_0x53de5d,'request\x20sent');_0x26c061(_0x484ada['result'][_0xead3('0x14')]);}})[_0xead3('0x16')](function(_0x1ff637){logger[_0xead3('0x12')](_0xead3('0xe'),_0x53de5d,_0x1ff637);_0x496060(_0x1ff637);});});} \ No newline at end of file +var _0xb4cf=['stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x3b6a6d,_0x3ba7df){var _0x13268d=function(_0x3f94f1){while(--_0x3f94f1){_0x3b6a6d['push'](_0x3b6a6d['shift']());}};_0x13268d(++_0x3ba7df);}(_0xb4cf,0x65));var _0xfb4c=function(_0x34923a,_0x4d47ac){_0x34923a=_0x34923a-0x0;var _0x3ab3f2=_0xb4cf[_0x34923a];return _0x3ab3f2;};'use strict';var _=require(_0xfb4c('0x0'));var util=require(_0xfb4c('0x1'));var moment=require(_0xfb4c('0x2'));var BPromise=require(_0xfb4c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb4c('0x4'));var db=require(_0xfb4c('0x5'))['db'];var utils=require(_0xfb4c('0x6'));var logger=require(_0xfb4c('0x7'))(_0xfb4c('0x8'));var config=require(_0xfb4c('0x9'));var jayson=require(_0xfb4c('0xa'));var client=jayson[_0xfb4c('0xb')][_0xfb4c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xaeec67,_0x2e14a0,_0x2be434){return new BPromise(function(_0x325e10,_0x2d86fe){return client[_0xfb4c('0xd')](_0xaeec67,_0x2be434)['then'](function(_0x293c11){logger[_0xfb4c('0xe')](_0xfb4c('0xf'),_0x2e14a0,_0xfb4c('0x10'));logger[_0xfb4c('0x11')](_0xfb4c('0x12'),_0x2e14a0,'request\x20sent',JSON[_0xfb4c('0x13')](_0x293c11));if(_0x293c11[_0xfb4c('0x14')]){if(_0x293c11[_0xfb4c('0x14')][_0xfb4c('0x15')]===0x1f4){logger[_0xfb4c('0x14')](_0xfb4c('0xf'),_0x2e14a0,_0x293c11[_0xfb4c('0x14')][_0xfb4c('0x16')]);return _0x2d86fe(_0x293c11[_0xfb4c('0x14')][_0xfb4c('0x16')]);}logger[_0xfb4c('0x14')](_0xfb4c('0xf'),_0x2e14a0,_0x293c11[_0xfb4c('0x14')][_0xfb4c('0x16')]);return _0x325e10(_0x293c11[_0xfb4c('0x14')][_0xfb4c('0x16')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e14a0,_0xfb4c('0x10'));_0x325e10(_0x293c11[_0xfb4c('0x17')][_0xfb4c('0x16')]);}})['catch'](function(_0x355d1a){logger[_0xfb4c('0x14')](_0xfb4c('0xf'),_0x2e14a0,_0x355d1a);_0x2d86fe(_0x355d1a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5b4ce66..61958ca 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 _0x20ec=['../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','exports','multer','util','path','connect-timeout','../../components/auth/service'];(function(_0x1f36b5,_0x42c383){var _0x5760e9=function(_0x2931bc){while(--_0x2931bc){_0x1f36b5['push'](_0x1f36b5['shift']());}};_0x5760e9(++_0x42c383);}(_0x20ec,0x12f));var _0xc20e=function(_0x353471,_0x19f123){_0x353471=_0x353471-0x0;var _0x584806=_0x20ec[_0x353471];return _0x584806;};'use strict';var multer=require(_0xc20e('0x0'));var util=require(_0xc20e('0x1'));var path=require(_0xc20e('0x2'));var timeout=require(_0xc20e('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc20e('0x4'));var interaction=require(_0xc20e('0x5'));var config=require(_0xc20e('0x6'));var controller=require(_0xc20e('0x7'));router[_0xc20e('0x8')]('/',auth[_0xc20e('0x9')](),controller[_0xc20e('0xa')]);router[_0xc20e('0x8')](_0xc20e('0xb'),auth[_0xc20e('0x9')](),controller[_0xc20e('0xc')]);router[_0xc20e('0x8')](_0xc20e('0xd'),auth['isAuthenticated'](),controller[_0xc20e('0xe')]);router[_0xc20e('0x8')](_0xc20e('0xf'),auth[_0xc20e('0x9')](),controller[_0xc20e('0x10')]);router[_0xc20e('0x11')]('/',auth['isAuthenticated'](),controller[_0xc20e('0x12')]);router[_0xc20e('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0xc20e('0x13')](_0xc20e('0xb'),auth[_0xc20e('0x9')](),controller[_0xc20e('0x14')]);router['delete']('/:id',auth[_0xc20e('0x9')](),controller['destroy']);module[_0xc20e('0x15')]=router; \ No newline at end of file +var _0xc9b4=['../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x2118ad,_0xe8e3fd){var _0x4b5715=function(_0x399f72){while(--_0x399f72){_0x2118ad['push'](_0x2118ad['shift']());}};_0x4b5715(++_0xe8e3fd);}(_0xc9b4,0xa2));var _0x4c9b=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0xc9b4[_0x1f44e4];return _0x591989;};'use strict';var multer=require(_0x4c9b('0x0'));var util=require(_0x4c9b('0x1'));var path=require(_0x4c9b('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c9b('0x3'));var router=express[_0x4c9b('0x4')]();var auth=require(_0x4c9b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4c9b('0x6'));var controller=require(_0x4c9b('0x7'));router[_0x4c9b('0x8')]('/',auth[_0x4c9b('0x9')](),controller[_0x4c9b('0xa')]);router[_0x4c9b('0x8')](_0x4c9b('0xb'),auth[_0x4c9b('0x9')](),controller[_0x4c9b('0xc')]);router[_0x4c9b('0x8')](_0x4c9b('0xd'),auth[_0x4c9b('0x9')](),controller[_0x4c9b('0xe')]);router[_0x4c9b('0x8')](_0x4c9b('0xf'),auth[_0x4c9b('0x9')](),controller[_0x4c9b('0x10')]);router[_0x4c9b('0x11')]('/',auth[_0x4c9b('0x9')](),controller[_0x4c9b('0x12')]);router[_0x4c9b('0x11')]('/:id/configurations',auth[_0x4c9b('0x9')](),controller[_0x4c9b('0x13')]);router[_0x4c9b('0x14')](_0x4c9b('0xb'),auth[_0x4c9b('0x9')](),controller[_0x4c9b('0x15')]);router[_0x4c9b('0x16')](_0x4c9b('0xb'),auth[_0x4c9b('0x9')](),controller['destroy']);module[_0x4c9b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 0a1f6f0..8a0a29e 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 _0xc4aa=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xc4aa[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xac4a('0x2')]},'securityToken':{'type':Sequelize[_0xac4a('0x2')]},'serverUrl':{'type':Sequelize[_0xac4a('0x2')]},'type':{'type':Sequelize[_0xac4a('0x4')](_0xac4a('0x5'),_0xac4a('0x6')),'defaultValue':_0xac4a('0x5')}}; \ No newline at end of file +var _0xe14b=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x1972a0,_0x2383c8){_0x1972a0=_0x1972a0-0x0;var _0xe3401a=_0xe14b[_0x1972a0];return _0xe3401a;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbe14('0x2')],'unique':_0xbe14('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbe14('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xbe14('0x2')]},'serverUrl':{'type':Sequelize[_0xbe14('0x2')]},'type':{'type':Sequelize[_0xbe14('0x4')](_0xbe14('0x5'),_0xbe14('0x6')),'defaultValue':_0xbe14('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 94c456c..1d3c702 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 _0xce06=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','stack','name','map','SalesforceAccount','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','substring','Connection','login','username','concat','ticketType','sobject','describe','CallDisposition','CallObject','Priority','Status','Type','isNil','Case','Origin','Reason','IsEscalated','SuppliedName','SuppliedCompany','remove','includes','label','custom','picklistValues','value','boolean','True','true','False','false','statusCode','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0xce06,0x111));var _0x6ce0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xce06[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x6ce0('0x0'));var emlformat=require(_0x6ce0('0x1'));var rimraf=require(_0x6ce0('0x2'));var zipdir=require(_0x6ce0('0x3'));var jsonpatch=require(_0x6ce0('0x4'));var rp=require(_0x6ce0('0x5'));var moment=require(_0x6ce0('0x6'));var BPromise=require(_0x6ce0('0x7'));var Mustache=require('mustache');var util=require(_0x6ce0('0x8'));var path=require(_0x6ce0('0x9'));var sox=require(_0x6ce0('0xa'));var csv=require(_0x6ce0('0xb'));var ejs=require(_0x6ce0('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ce0('0xd'));var crypto=require(_0x6ce0('0xe'));var jsforce=require(_0x6ce0('0xf'));var deskjs=require(_0x6ce0('0x10'));var toCsv=require(_0x6ce0('0xb'));var querystring=require('querystring');var Papa=require(_0x6ce0('0x11'));var Redis=require(_0x6ce0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6ce0('0x13'));var as=require(_0x6ce0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ce0('0x15'))(_0x6ce0('0x16'));var utils=require('../../config/utils');var config=require(_0x6ce0('0x17'));var db=require(_0x6ce0('0x18'))['db'];var integrations=require(_0x6ce0('0x19'));var jayson=require(_0x6ce0('0x1a'));var client=jayson[_0x6ce0('0x1b')][_0x6ce0('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3b5006,_0x7198a3,_0x2a449a){if(_0x2a449a){var _0x54af99=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54af99[_0x6ce0('0x1d')](_0x7198a3)){return _0x3b5006;}else{throw new db['Sequelize'][(_0x6ce0('0x1e'))](_0x6ce0('0x1f'));}}else{return _0x3b5006;}}function respondWithRpcPromise(_0x38934b,_0x4f12d8,_0x5e8b63,_0xe681c1){return new BPromise(function(_0x4dac30,_0xebcd5b){var _0x5ed068=_0xe681c1||client;return _0x5ed068['request'](_0x38934b,_0x5e8b63)[_0x6ce0('0x20')](function(_0x38d23a){logger[_0x6ce0('0x21')](_0x6ce0('0x22'),_0x4f12d8,_0x6ce0('0x23'));logger[_0x6ce0('0x24')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x4f12d8,'request\x20sent',JSON['stringify'](_0x38d23a));if(_0x38d23a[_0x6ce0('0x25')]){if(_0x38d23a['error']['code']===0x1f4){logger[_0x6ce0('0x25')](_0x6ce0('0x22'),_0x4f12d8,_0x38d23a['error'][_0x6ce0('0x26')]);return _0xebcd5b(_0x38d23a['error']['message']);}logger[_0x6ce0('0x25')](_0x6ce0('0x22'),_0x4f12d8,_0x38d23a[_0x6ce0('0x25')][_0x6ce0('0x26')]);return _0x4dac30(_0x38d23a['error'][_0x6ce0('0x26')]);}else{logger['info'](_0x6ce0('0x22'),_0x4f12d8,'request\x20sent');_0x4dac30(_0x38d23a[_0x6ce0('0x27')][_0x6ce0('0x26')]);}})['catch'](function(_0x18833c){logger[_0x6ce0('0x25')](_0x6ce0('0x22'),_0x4f12d8,_0x18833c);_0xebcd5b(_0x18833c);});});}function respondWithStatusCode(_0x25c48e,_0x213280){_0x213280=_0x213280||0xcc;return function(_0x53c74d){if(_0x53c74d){return _0x25c48e[_0x6ce0('0x28')](_0x213280);}return _0x25c48e[_0x6ce0('0x29')](_0x213280)[_0x6ce0('0x2a')]();};}function respondWithResult(_0x59994b,_0x1d9bcc){_0x1d9bcc=_0x1d9bcc||0xc8;return function(_0x48a79d){if(_0x48a79d){return _0x59994b[_0x6ce0('0x29')](_0x1d9bcc)[_0x6ce0('0x2b')](_0x48a79d);}};}function respondWithFilteredResult(_0x10db32,_0x583040){return function(_0x5a9fc6){if(_0x5a9fc6){var _0x4e0a5b=_0x5a9fc6[_0x6ce0('0x2c')],_0x1cf791=_0x583040[_0x6ce0('0x2d')],_0x2ee184=_0x583040[_0x6ce0('0x2d')]+_0x583040[_0x6ce0('0x2e')],_0x465de4;if(_0x2ee184>=_0x4e0a5b){_0x2ee184=_0x4e0a5b;_0x465de4=0xc8;}else{_0x465de4=0xce;}_0x10db32[_0x6ce0('0x29')](_0x465de4);return _0x10db32[_0x6ce0('0x2f')](_0x6ce0('0x30'),_0x1cf791+'-'+_0x2ee184+'/'+_0x4e0a5b)[_0x6ce0('0x2b')](_0x5a9fc6);}return null;};}function patchUpdates(_0x5f1804){return function(_0x5fc43f){try{jsonpatch[_0x6ce0('0x31')](_0x5fc43f,_0x5f1804,!![]);}catch(_0xfd80df){return BPromise['reject'](_0xfd80df);}return _0x5fc43f['save']();};}function saveUpdates(_0x3479db,_0x190ced){return function(_0xc2312b){if(_0xc2312b){return _0xc2312b['update'](_0x3479db)[_0x6ce0('0x20')](function(_0x431e76){return _0x431e76;});}return null;};}function removeEntity(_0x2c727a,_0x414c1b){return function(_0x11b956){if(_0x11b956){return _0x11b956['destroy']()['then'](function(){_0x2c727a[_0x6ce0('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557492,_0x7dc5fe){return function(_0xf395a0){if(!_0xf395a0){_0x557492[_0x6ce0('0x28')](0x194);}return _0xf395a0;};}function handleError(_0x1f6882,_0x34cead){_0x34cead=_0x34cead||0x1f4;return function(_0x402757){logger[_0x6ce0('0x25')](_0x402757[_0x6ce0('0x32')]);if(_0x402757[_0x6ce0('0x33')]){delete _0x402757['name'];}_0x1f6882['status'](_0x34cead)['send'](_0x402757);};}exports['index']=function(_0x15d12e,_0x1a1133){var _0x5b2908={},_0x2b14af={},_0x269b8e={'count':0x0,'rows':[]};var _0x2b9a99=_[_0x6ce0('0x34')](db[_0x6ce0('0x35')]['rawAttributes'],function(_0xc7f347){return{'name':_0xc7f347[_0x6ce0('0x36')],'type':_0xc7f347[_0x6ce0('0x37')][_0x6ce0('0x38')]};});_0x2b14af[_0x6ce0('0x39')]=_['map'](_0x2b9a99,_0x6ce0('0x33'));_0x2b14af[_0x6ce0('0x3a')]=_[_0x6ce0('0x3b')](_0x15d12e[_0x6ce0('0x3a')]);_0x2b14af['filters']=_['intersection'](_0x2b14af[_0x6ce0('0x39')],_0x2b14af[_0x6ce0('0x3a')]);_0x5b2908[_0x6ce0('0x3c')]=_[_0x6ce0('0x3d')](_0x2b14af['model'],qs[_0x6ce0('0x3e')](_0x15d12e['query'][_0x6ce0('0x3e')]));_0x5b2908[_0x6ce0('0x3c')]=_0x5b2908[_0x6ce0('0x3c')][_0x6ce0('0x3f')]?_0x5b2908['attributes']:_0x2b14af[_0x6ce0('0x39')];if(!_0x15d12e[_0x6ce0('0x3a')][_0x6ce0('0x40')]('nolimit')){_0x5b2908[_0x6ce0('0x2e')]=qs['limit'](_0x15d12e[_0x6ce0('0x3a')][_0x6ce0('0x2e')]);_0x5b2908['offset']=qs['offset'](_0x15d12e[_0x6ce0('0x3a')][_0x6ce0('0x2d')]);}_0x5b2908[_0x6ce0('0x41')]=qs[_0x6ce0('0x42')](_0x15d12e[_0x6ce0('0x3a')][_0x6ce0('0x42')]);_0x5b2908[_0x6ce0('0x43')]=qs[_0x6ce0('0x44')](_[_0x6ce0('0x45')](_0x15d12e[_0x6ce0('0x3a')],_0x2b14af[_0x6ce0('0x44')]),_0x2b9a99);if(_0x15d12e[_0x6ce0('0x3a')][_0x6ce0('0x46')]){_0x5b2908[_0x6ce0('0x43')]=_['merge'](_0x5b2908['where'],{'$or':_[_0x6ce0('0x34')](_0x2b9a99,function(_0x46e298){if(_0x46e298[_0x6ce0('0x37')]!==_0x6ce0('0x47')){var _0x49a431={};_0x49a431[_0x46e298[_0x6ce0('0x33')]]={'$like':'%'+_0x15d12e[_0x6ce0('0x3a')][_0x6ce0('0x46')]+'%'};return _0x49a431;}})});}_0x5b2908=_[_0x6ce0('0x48')]({},_0x5b2908,_0x15d12e['options']);var _0x34ee16={'where':_0x5b2908[_0x6ce0('0x43')]};return db[_0x6ce0('0x35')][_0x6ce0('0x2c')](_0x34ee16)[_0x6ce0('0x20')](function(_0x1639d2){_0x269b8e[_0x6ce0('0x2c')]=_0x1639d2;if(_0x15d12e[_0x6ce0('0x3a')][_0x6ce0('0x49')]){_0x5b2908[_0x6ce0('0x4a')]=[{'all':!![]}];}return db[_0x6ce0('0x35')][_0x6ce0('0x4b')](_0x5b2908);})[_0x6ce0('0x20')](function(_0x3cac48){_0x269b8e[_0x6ce0('0x4c')]=_0x3cac48;return _0x269b8e;})[_0x6ce0('0x20')](respondWithFilteredResult(_0x1a1133,_0x5b2908))[_0x6ce0('0x4d')](handleError(_0x1a1133,null));};exports[_0x6ce0('0x4e')]=function(_0xd19eb6,_0x72e484){var _0x342c88={'raw':![],'where':{'id':_0xd19eb6[_0x6ce0('0x4f')]['id']}},_0x543396={};_0x543396[_0x6ce0('0x39')]=_['keys'](db['SalesforceAccount'][_0x6ce0('0x50')]);_0x543396[_0x6ce0('0x3a')]=_[_0x6ce0('0x3b')](_0xd19eb6[_0x6ce0('0x3a')]);_0x543396['filters']=_[_0x6ce0('0x3d')](_0x543396[_0x6ce0('0x39')],_0x543396[_0x6ce0('0x3a')]);_0x342c88[_0x6ce0('0x3c')]=_[_0x6ce0('0x3d')](_0x543396['model'],qs[_0x6ce0('0x3e')](_0xd19eb6[_0x6ce0('0x3a')]['fields']));_0x342c88[_0x6ce0('0x3c')]=_0x342c88[_0x6ce0('0x3c')]['length']?_0x342c88[_0x6ce0('0x3c')]:_0x543396[_0x6ce0('0x39')];if(_0xd19eb6[_0x6ce0('0x3a')][_0x6ce0('0x49')]){_0x342c88[_0x6ce0('0x4a')]=[{'all':!![]}];}_0x342c88=_[_0x6ce0('0x48')]({},_0x342c88,_0xd19eb6['options']);return db['SalesforceAccount'][_0x6ce0('0x51')](_0x342c88)[_0x6ce0('0x20')](handleEntityNotFound(_0x72e484,null))['then'](respondWithResult(_0x72e484,null))['catch'](handleError(_0x72e484,null));};exports[_0x6ce0('0x52')]=function(_0x333a3e,_0x47a341){return db['SalesforceAccount'][_0x6ce0('0x52')](_0x333a3e[_0x6ce0('0x53')],{})['then'](respondWithResult(_0x47a341,0xc9))[_0x6ce0('0x4d')](handleError(_0x47a341,null));};exports[_0x6ce0('0x54')]=function(_0x3180e0,_0x149472){if(_0x3180e0[_0x6ce0('0x53')]['id']){delete _0x3180e0[_0x6ce0('0x53')]['id'];}return db[_0x6ce0('0x35')]['find']({'where':{'id':_0x3180e0[_0x6ce0('0x4f')]['id']}})[_0x6ce0('0x20')](handleEntityNotFound(_0x149472,null))[_0x6ce0('0x20')](saveUpdates(_0x3180e0['body'],null))[_0x6ce0('0x20')](respondWithResult(_0x149472,null))[_0x6ce0('0x4d')](handleError(_0x149472,null));};exports[_0x6ce0('0x55')]=function(_0x1de5f5,_0x3237c8){return db[_0x6ce0('0x35')][_0x6ce0('0x51')]({'where':{'id':_0x1de5f5['params']['id']}})[_0x6ce0('0x20')](handleEntityNotFound(_0x3237c8,null))[_0x6ce0('0x20')](removeEntity(_0x3237c8,null))[_0x6ce0('0x4d')](handleError(_0x3237c8,null));};exports[_0x6ce0('0x56')]=function(_0x44492d,_0x2edf32,_0x11151c){var _0x437f5e={};var _0x3c22cb={};var _0x402b76;var _0x1f7fad;return db[_0x6ce0('0x35')][_0x6ce0('0x57')]({'where':{'id':_0x44492d[_0x6ce0('0x4f')]['id']}})[_0x6ce0('0x20')](handleEntityNotFound(_0x2edf32,null))[_0x6ce0('0x20')](function(_0x57c3ba){if(_0x57c3ba){_0x402b76=_0x57c3ba;_0x3c22cb[_0x6ce0('0x39')]=_['keys'](db[_0x6ce0('0x58')][_0x6ce0('0x50')]);_0x3c22cb['query']=_['keys'](_0x44492d[_0x6ce0('0x3a')]);_0x3c22cb[_0x6ce0('0x44')]=_[_0x6ce0('0x3d')](_0x3c22cb[_0x6ce0('0x39')],_0x3c22cb[_0x6ce0('0x3a')]);_0x437f5e[_0x6ce0('0x3c')]=_['intersection'](_0x3c22cb[_0x6ce0('0x39')],qs[_0x6ce0('0x3e')](_0x44492d[_0x6ce0('0x3a')]['fields']));_0x437f5e[_0x6ce0('0x3c')]=_0x437f5e[_0x6ce0('0x3c')]['length']?_0x437f5e[_0x6ce0('0x3c')]:_0x3c22cb[_0x6ce0('0x39')];_0x437f5e[_0x6ce0('0x41')]=qs[_0x6ce0('0x42')](_0x44492d['query'][_0x6ce0('0x42')]);_0x437f5e[_0x6ce0('0x43')]=qs[_0x6ce0('0x44')](_[_0x6ce0('0x45')](_0x44492d[_0x6ce0('0x3a')],_0x3c22cb['filters']));if(_0x44492d[_0x6ce0('0x3a')][_0x6ce0('0x46')]){_0x437f5e[_0x6ce0('0x43')]=_['merge'](_0x437f5e[_0x6ce0('0x43')],{'$or':_['map'](_0x437f5e[_0x6ce0('0x3c')],function(_0x23dfca){var _0xa4ba43={};_0xa4ba43[_0x23dfca]={'$like':'%'+_0x44492d['query'][_0x6ce0('0x46')]+'%'};return _0xa4ba43;})});}_0x437f5e=_[_0x6ce0('0x48')]({},_0x437f5e,_0x44492d['options']);return _0x402b76['getConfigurations'](_0x437f5e);}})[_0x6ce0('0x20')](function(_0x246086){if(_0x246086){_0x1f7fad=_0x246086[_0x6ce0('0x3f')];if(!_0x44492d[_0x6ce0('0x3a')]['hasOwnProperty'](_0x6ce0('0x59'))){_0x437f5e[_0x6ce0('0x2e')]=qs[_0x6ce0('0x2e')](_0x44492d[_0x6ce0('0x3a')][_0x6ce0('0x2e')]);_0x437f5e[_0x6ce0('0x2d')]=qs[_0x6ce0('0x2d')](_0x44492d[_0x6ce0('0x3a')][_0x6ce0('0x2d')]);}return _0x402b76[_0x6ce0('0x56')](_0x437f5e);}})[_0x6ce0('0x20')](function(_0x124093){if(_0x124093){return _0x124093?{'count':_0x1f7fad,'rows':_0x124093}:null;}})[_0x6ce0('0x20')](respondWithResult(_0x2edf32,null))[_0x6ce0('0x4d')](handleError(_0x2edf32,null));};exports[_0x6ce0('0x5a')]=function(_0x42961e,_0x2cb36b,_0xce5cfe){if(_0x42961e['body']['id']){delete _0x42961e[_0x6ce0('0x53')]['id'];}return db[_0x6ce0('0x35')][_0x6ce0('0x57')]({'where':{'id':_0x42961e[_0x6ce0('0x4f')]['id']}})[_0x6ce0('0x20')](handleEntityNotFound(_0x2cb36b,null))[_0x6ce0('0x20')](function(_0x144fae){if(_0x144fae){_0x42961e[_0x6ce0('0x53')]['AccountId']=_0x144fae['id'];_0x42961e['body'][_0x6ce0('0x5b')]=integrations['getSubjects'](_0x42961e[_0x6ce0('0x53')][_0x6ce0('0x5c')],_0x42961e['body']['type']);_0x42961e[_0x6ce0('0x53')][_0x6ce0('0x5d')]=integrations[_0x6ce0('0x5e')](_0x42961e[_0x6ce0('0x53')]['channel'],_0x42961e[_0x6ce0('0x53')][_0x6ce0('0x37')]);return db[_0x6ce0('0x58')][_0x6ce0('0x52')](_0x42961e['body'],{'include':[{'model':db[_0x6ce0('0x5f')],'as':_0x6ce0('0x5b')},{'model':db[_0x6ce0('0x5f')],'as':_0x6ce0('0x5d')}]});}return null;})[_0x6ce0('0x20')](respondWithResult(_0x2cb36b,null))[_0x6ce0('0x4d')](handleError(_0x2cb36b,null));};exports[_0x6ce0('0x60')]=function(_0x2a6894,_0x506414,_0x1f23e9){var _0x1c6861;var _0x4588b7='';var _0x2dece7=_0x6ce0('0x61');return db[_0x6ce0('0x35')]['findOne']({'where':{'id':_0x2a6894['params']['id']},'attributes':['id',_0x6ce0('0x62'),_0x6ce0('0x63'),_0x6ce0('0x64'),'username',_0x6ce0('0x65'),_0x6ce0('0x66')]})[_0x6ce0('0x20')](handleEntityNotFound(_0x506414,null))[_0x6ce0('0x20')](function(_0x2eb319){if(_0x2eb319){_0x4588b7=_0x2eb319['remoteUri'];var _0x29281a=_0x4588b7[_0x6ce0('0x67')](-0x1);if(_0x29281a==='/'){_0x4588b7=_0x4588b7[_0x6ce0('0x68')](0x0,_0x4588b7['lastIndexOf'](_0x29281a));}_0x1c6861=new jsforce[(_0x6ce0('0x69'))]({'oauth2':{'loginUrl':_0x4588b7,'clientId':_0x2eb319[_0x6ce0('0x63')],'clientSecret':_0x2eb319[_0x6ce0('0x64')]}});return _0x1c6861[_0x6ce0('0x6a')](_0x2eb319[_0x6ce0('0x6b')],_0x2eb319[_0x6ce0('0x65')][_0x6ce0('0x6c')](_0x2eb319[_0x6ce0('0x66')]));}})[_0x6ce0('0x20')](function(_0x391e63){if(_0x391e63){if(!_['isNil'](_0x2a6894[_0x6ce0('0x3a')][_0x6ce0('0x6d')])){_0x2dece7=_0x2a6894[_0x6ce0('0x3a')]['ticketType'];}return _0x1c6861[_0x6ce0('0x6e')](_0x2dece7)[_0x6ce0('0x6f')]();}})['then'](function(_0x179b24){var _0x48a730=[_0x6ce0('0x70'),'CallDurationInSeconds',_0x6ce0('0x71'),'CallType','IsArchived',_0x6ce0('0x72'),_0x6ce0('0x73'),_0x6ce0('0x74')];if(!_[_0x6ce0('0x75')](_0x2a6894[_0x6ce0('0x3a')][_0x6ce0('0x6d')])&&_0x2a6894[_0x6ce0('0x3a')][_0x6ce0('0x6d')]===_0x6ce0('0x76')){_0x48a730=[_0x6ce0('0x74'),_0x6ce0('0x77'),_0x6ce0('0x78'),_0x6ce0('0x73'),'Priority',_0x6ce0('0x79'),_0x6ce0('0x7a'),_0x6ce0('0x7b')];}if(_0x179b24){_[_0x6ce0('0x7c')](_0x179b24['fields'],function(_0x2be0e9){return _0x2be0e9['custom']===![]&&!_0x48a730[_0x6ce0('0x7d')](_0x2be0e9['name']);});return{'count':_0x179b24[_0x6ce0('0x3e')][_0x6ce0('0x3f')],'rows':_[_0x6ce0('0x34')](_0x179b24[_0x6ce0('0x3e')],function(_0x275c54){return{'id':_0x275c54[_0x6ce0('0x33')],'name':_0x275c54[_0x6ce0('0x7e')],'custom':_0x275c54[_0x6ce0('0x7f')],'options':_0x275c54[_0x6ce0('0x80')][_0x6ce0('0x3f')]>0x0?_[_0x6ce0('0x34')](_0x275c54[_0x6ce0('0x80')],function(_0x35dbdf){return{'name':_0x35dbdf[_0x6ce0('0x7e')],'value':_0x35dbdf[_0x6ce0('0x81')]};}):_0x275c54[_0x6ce0('0x37')]==_0x6ce0('0x82')?[{'name':_0x6ce0('0x83'),'value':_0x6ce0('0x84')},{'name':_0x6ce0('0x85'),'value':_0x6ce0('0x86')}]:[]};})};}})['then'](respondWithResult(_0x506414,null))[_0x6ce0('0x4d')](function(_0x1976a2){var _0x4e7e7c=_0x2a6894['query'][_0x6ce0('0x1d')]?0x1f4:_0x1976a2[_0x6ce0('0x87')]||0x1f4;logger[_0x6ce0('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x6ce0('0x60'),_0x4e7e7c,JSON[_0x6ce0('0x88')](_0x1976a2));delete _0x1976a2['name'];if(_0x4e7e7c===0x191){_0x4e7e7c=0x190;}_0x506414[_0x6ce0('0x29')](_0x4e7e7c)['send'](_0x2a6894['query'][_0x6ce0('0x1d')]?{'message':_0x6ce0('0x89'),'statusCode':_0x1976a2[_0x6ce0('0x87')]}:_0x1976a2);});}; \ No newline at end of file +var _0x8115=['getConfigurations','SalesforceConfiguration','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','Task','findOne','clientId','username','substring','Connection','clientSecret','login','password','concat','securityToken','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Origin','IsEscalated','SuppliedCompany','remove','custom','includes','picklistValues','label','value','boolean','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','jayson/promise','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','name','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','params'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8115,0x1c0));var _0x5811=function(_0x40ec50,_0x3a26b0){_0x40ec50=_0x40ec50-0x0;var _0x5be6ac=_0x8115[_0x40ec50];return _0x5be6ac;};'use strict';var pdf=require(_0x5811('0x0'));var emlformat=require(_0x5811('0x1'));var rimraf=require(_0x5811('0x2'));var zipdir=require(_0x5811('0x3'));var jsonpatch=require(_0x5811('0x4'));var rp=require('request-promise');var moment=require(_0x5811('0x5'));var BPromise=require(_0x5811('0x6'));var Mustache=require(_0x5811('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5811('0x8'));var csv=require(_0x5811('0x9'));var ejs=require(_0x5811('0xa'));var fs=require('fs');var _=require(_0x5811('0xb'));var squel=require(_0x5811('0xc'));var crypto=require(_0x5811('0xd'));var jsforce=require(_0x5811('0xe'));var deskjs=require(_0x5811('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5811('0x10'));var Redis=require(_0x5811('0x11'));var authService=require(_0x5811('0x12'));var qs=require(_0x5811('0x13'));var as=require(_0x5811('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5811('0x15'));var utils=require(_0x5811('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5811('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x137b5f,_0x56ec5f,_0x1e7de4){if(_0x1e7de4){var _0x268a30=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x268a30['test'](_0x56ec5f)){return _0x137b5f;}else{throw new db[(_0x5811('0x18'))]['ValidationError'](_0x5811('0x19'));}}else{return _0x137b5f;}}function respondWithRpcPromise(_0x640fb8,_0x540e5a,_0x55bcbe,_0x1f79b1){return new BPromise(function(_0x5a6245,_0x5819a6){var _0x4bfa28=_0x1f79b1||client;return _0x4bfa28['request'](_0x640fb8,_0x55bcbe)[_0x5811('0x1a')](function(_0x4a5fc5){logger[_0x5811('0x1b')]('SalesforceAccount,\x20%s,\x20%s',_0x540e5a,_0x5811('0x1c'));logger[_0x5811('0x1d')](_0x5811('0x1e'),_0x540e5a,_0x5811('0x1c'),JSON[_0x5811('0x1f')](_0x4a5fc5));if(_0x4a5fc5[_0x5811('0x20')]){if(_0x4a5fc5[_0x5811('0x20')][_0x5811('0x21')]===0x1f4){logger[_0x5811('0x20')](_0x5811('0x22'),_0x540e5a,_0x4a5fc5['error'][_0x5811('0x23')]);return _0x5819a6(_0x4a5fc5[_0x5811('0x20')][_0x5811('0x23')]);}logger['error'](_0x5811('0x22'),_0x540e5a,_0x4a5fc5[_0x5811('0x20')][_0x5811('0x23')]);return _0x5a6245(_0x4a5fc5['error'][_0x5811('0x23')]);}else{logger[_0x5811('0x1b')](_0x5811('0x22'),_0x540e5a,'request\x20sent');_0x5a6245(_0x4a5fc5['result']['message']);}})['catch'](function(_0x5bd2ec){logger[_0x5811('0x20')](_0x5811('0x22'),_0x540e5a,_0x5bd2ec);_0x5819a6(_0x5bd2ec);});});}function respondWithStatusCode(_0x44ddb8,_0x296d8d){_0x296d8d=_0x296d8d||0xcc;return function(_0x5b3204){if(_0x5b3204){return _0x44ddb8[_0x5811('0x24')](_0x296d8d);}return _0x44ddb8['status'](_0x296d8d)[_0x5811('0x25')]();};}function respondWithResult(_0x332386,_0x21bfe7){_0x21bfe7=_0x21bfe7||0xc8;return function(_0x342c11){if(_0x342c11){return _0x332386[_0x5811('0x26')](_0x21bfe7)[_0x5811('0x27')](_0x342c11);}};}function respondWithFilteredResult(_0x57dbf6,_0x5b5ff4){return function(_0x5ae625){if(_0x5ae625){var _0x2906fe=_0x5ae625[_0x5811('0x28')],_0x58a9e8=_0x5b5ff4[_0x5811('0x29')],_0x2e6333=_0x5b5ff4['offset']+_0x5b5ff4[_0x5811('0x2a')],_0x9cf977;if(_0x2e6333>=_0x2906fe){_0x2e6333=_0x2906fe;_0x9cf977=0xc8;}else{_0x9cf977=0xce;}_0x57dbf6['status'](_0x9cf977);return _0x57dbf6[_0x5811('0x2b')](_0x5811('0x2c'),_0x58a9e8+'-'+_0x2e6333+'/'+_0x2906fe)[_0x5811('0x27')](_0x5ae625);}return null;};}function patchUpdates(_0x3d8223){return function(_0x191b6c){try{jsonpatch[_0x5811('0x2d')](_0x191b6c,_0x3d8223,!![]);}catch(_0x770db0){return BPromise[_0x5811('0x2e')](_0x770db0);}return _0x191b6c['save']();};}function saveUpdates(_0x421170,_0x5142a1){return function(_0x24f788){if(_0x24f788){return _0x24f788[_0x5811('0x2f')](_0x421170)[_0x5811('0x1a')](function(_0x12456c){return _0x12456c;});}return null;};}function removeEntity(_0x32de2b,_0x170f2a){return function(_0x3a06b4){if(_0x3a06b4){return _0x3a06b4['destroy']()[_0x5811('0x1a')](function(){_0x32de2b['status'](0xcc)[_0x5811('0x25')]();});}};}function handleEntityNotFound(_0x4eef50,_0x5f5613){return function(_0x4870a5){if(!_0x4870a5){_0x4eef50[_0x5811('0x24')](0x194);}return _0x4870a5;};}function handleError(_0x44eb76,_0x15a39b){_0x15a39b=_0x15a39b||0x1f4;return function(_0xe0d00f){logger['error'](_0xe0d00f['stack']);if(_0xe0d00f['name']){delete _0xe0d00f[_0x5811('0x30')];}_0x44eb76[_0x5811('0x26')](_0x15a39b)['send'](_0xe0d00f);};}exports['index']=function(_0x197fd0,_0x356447){var _0x53bc21={},_0x1e5626={},_0x54292f={'count':0x0,'rows':[]};var _0x380955=_['map'](db[_0x5811('0x31')][_0x5811('0x32')],function(_0x2de826){return{'name':_0x2de826[_0x5811('0x33')],'type':_0x2de826[_0x5811('0x34')][_0x5811('0x35')]};});_0x1e5626[_0x5811('0x36')]=_[_0x5811('0x37')](_0x380955,'name');_0x1e5626[_0x5811('0x38')]=_[_0x5811('0x39')](_0x197fd0[_0x5811('0x38')]);_0x1e5626[_0x5811('0x3a')]=_[_0x5811('0x3b')](_0x1e5626['model'],_0x1e5626[_0x5811('0x38')]);_0x53bc21['attributes']=_['intersection'](_0x1e5626['model'],qs['fields'](_0x197fd0[_0x5811('0x38')][_0x5811('0x3c')]));_0x53bc21['attributes']=_0x53bc21[_0x5811('0x3d')][_0x5811('0x3e')]?_0x53bc21['attributes']:_0x1e5626[_0x5811('0x36')];if(!_0x197fd0[_0x5811('0x38')]['hasOwnProperty'](_0x5811('0x3f'))){_0x53bc21['limit']=qs['limit'](_0x197fd0[_0x5811('0x38')][_0x5811('0x2a')]);_0x53bc21[_0x5811('0x29')]=qs[_0x5811('0x29')](_0x197fd0[_0x5811('0x38')][_0x5811('0x29')]);}_0x53bc21[_0x5811('0x40')]=qs['sort'](_0x197fd0['query']['sort']);_0x53bc21['where']=qs[_0x5811('0x3a')](_[_0x5811('0x41')](_0x197fd0[_0x5811('0x38')],_0x1e5626[_0x5811('0x3a')]),_0x380955);if(_0x197fd0[_0x5811('0x38')][_0x5811('0x42')]){_0x53bc21[_0x5811('0x43')]=_[_0x5811('0x44')](_0x53bc21[_0x5811('0x43')],{'$or':_['map'](_0x380955,function(_0x37a138){if(_0x37a138[_0x5811('0x34')]!==_0x5811('0x45')){var _0x5220ae={};_0x5220ae[_0x37a138['name']]={'$like':'%'+_0x197fd0[_0x5811('0x38')][_0x5811('0x42')]+'%'};return _0x5220ae;}})});}_0x53bc21=_[_0x5811('0x44')]({},_0x53bc21,_0x197fd0[_0x5811('0x46')]);var _0x116c3d={'where':_0x53bc21['where']};return db[_0x5811('0x31')][_0x5811('0x28')](_0x116c3d)['then'](function(_0xc48ab8){_0x54292f[_0x5811('0x28')]=_0xc48ab8;if(_0x197fd0[_0x5811('0x38')][_0x5811('0x47')]){_0x53bc21[_0x5811('0x48')]=[{'all':!![]}];}return db[_0x5811('0x31')][_0x5811('0x49')](_0x53bc21);})[_0x5811('0x1a')](function(_0x16cfda){_0x54292f[_0x5811('0x4a')]=_0x16cfda;return _0x54292f;})['then'](respondWithFilteredResult(_0x356447,_0x53bc21))['catch'](handleError(_0x356447,null));};exports['show']=function(_0xf340f2,_0x1bb20b){var _0x1432ed={'raw':![],'where':{'id':_0xf340f2['params']['id']}},_0x20120c={};_0x20120c[_0x5811('0x36')]=_[_0x5811('0x39')](db[_0x5811('0x31')][_0x5811('0x32')]);_0x20120c['query']=_['keys'](_0xf340f2[_0x5811('0x38')]);_0x20120c[_0x5811('0x3a')]=_[_0x5811('0x3b')](_0x20120c[_0x5811('0x36')],_0x20120c[_0x5811('0x38')]);_0x1432ed['attributes']=_[_0x5811('0x3b')](_0x20120c[_0x5811('0x36')],qs[_0x5811('0x3c')](_0xf340f2[_0x5811('0x38')][_0x5811('0x3c')]));_0x1432ed[_0x5811('0x3d')]=_0x1432ed['attributes'][_0x5811('0x3e')]?_0x1432ed[_0x5811('0x3d')]:_0x20120c[_0x5811('0x36')];if(_0xf340f2['query'][_0x5811('0x47')]){_0x1432ed[_0x5811('0x48')]=[{'all':!![]}];}_0x1432ed=_['merge']({},_0x1432ed,_0xf340f2[_0x5811('0x46')]);return db[_0x5811('0x31')][_0x5811('0x4b')](_0x1432ed)[_0x5811('0x1a')](handleEntityNotFound(_0x1bb20b,null))[_0x5811('0x1a')](respondWithResult(_0x1bb20b,null))[_0x5811('0x4c')](handleError(_0x1bb20b,null));};exports[_0x5811('0x4d')]=function(_0x190f93,_0x4cb3c4){return db[_0x5811('0x31')][_0x5811('0x4d')](_0x190f93['body'],{})[_0x5811('0x1a')](respondWithResult(_0x4cb3c4,0xc9))[_0x5811('0x4c')](handleError(_0x4cb3c4,null));};exports[_0x5811('0x2f')]=function(_0x5a4e8c,_0x273dd1){if(_0x5a4e8c[_0x5811('0x4e')]['id']){delete _0x5a4e8c[_0x5811('0x4e')]['id'];}return db['SalesforceAccount'][_0x5811('0x4b')]({'where':{'id':_0x5a4e8c[_0x5811('0x4f')]['id']}})[_0x5811('0x1a')](handleEntityNotFound(_0x273dd1,null))[_0x5811('0x1a')](saveUpdates(_0x5a4e8c[_0x5811('0x4e')],null))[_0x5811('0x1a')](respondWithResult(_0x273dd1,null))[_0x5811('0x4c')](handleError(_0x273dd1,null));};exports['destroy']=function(_0x2290a9,_0x4b007e){return db[_0x5811('0x31')][_0x5811('0x4b')]({'where':{'id':_0x2290a9[_0x5811('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4b007e,null))[_0x5811('0x1a')](removeEntity(_0x4b007e,null))['catch'](handleError(_0x4b007e,null));};exports[_0x5811('0x50')]=function(_0x1a4924,_0xc57169,_0x2fd978){var _0x17e1f7={};var _0x2d99e6={};var _0xca35b9;var _0xcc0408;return db[_0x5811('0x31')]['findOne']({'where':{'id':_0x1a4924['params']['id']}})[_0x5811('0x1a')](handleEntityNotFound(_0xc57169,null))[_0x5811('0x1a')](function(_0x433134){if(_0x433134){_0xca35b9=_0x433134;_0x2d99e6['model']=_[_0x5811('0x39')](db[_0x5811('0x51')]['rawAttributes']);_0x2d99e6[_0x5811('0x38')]=_[_0x5811('0x39')](_0x1a4924[_0x5811('0x38')]);_0x2d99e6[_0x5811('0x3a')]=_[_0x5811('0x3b')](_0x2d99e6['model'],_0x2d99e6[_0x5811('0x38')]);_0x17e1f7[_0x5811('0x3d')]=_[_0x5811('0x3b')](_0x2d99e6['model'],qs['fields'](_0x1a4924[_0x5811('0x38')]['fields']));_0x17e1f7[_0x5811('0x3d')]=_0x17e1f7['attributes']['length']?_0x17e1f7[_0x5811('0x3d')]:_0x2d99e6[_0x5811('0x36')];_0x17e1f7[_0x5811('0x40')]=qs[_0x5811('0x52')](_0x1a4924[_0x5811('0x38')][_0x5811('0x52')]);_0x17e1f7[_0x5811('0x43')]=qs['filters'](_['pick'](_0x1a4924[_0x5811('0x38')],_0x2d99e6[_0x5811('0x3a')]));if(_0x1a4924[_0x5811('0x38')]['filter']){_0x17e1f7['where']=_[_0x5811('0x44')](_0x17e1f7[_0x5811('0x43')],{'$or':_['map'](_0x17e1f7['attributes'],function(_0x1279f4){var _0x7bb3f1={};_0x7bb3f1[_0x1279f4]={'$like':'%'+_0x1a4924[_0x5811('0x38')][_0x5811('0x42')]+'%'};return _0x7bb3f1;})});}_0x17e1f7=_[_0x5811('0x44')]({},_0x17e1f7,_0x1a4924[_0x5811('0x46')]);return _0xca35b9['getConfigurations'](_0x17e1f7);}})['then'](function(_0x5881ab){if(_0x5881ab){_0xcc0408=_0x5881ab[_0x5811('0x3e')];if(!_0x1a4924[_0x5811('0x38')]['hasOwnProperty'](_0x5811('0x3f'))){_0x17e1f7[_0x5811('0x2a')]=qs['limit'](_0x1a4924[_0x5811('0x38')][_0x5811('0x2a')]);_0x17e1f7['offset']=qs[_0x5811('0x29')](_0x1a4924['query'][_0x5811('0x29')]);}return _0xca35b9[_0x5811('0x50')](_0x17e1f7);}})['then'](function(_0x3981c8){if(_0x3981c8){return _0x3981c8?{'count':_0xcc0408,'rows':_0x3981c8}:null;}})[_0x5811('0x1a')](respondWithResult(_0xc57169,null))[_0x5811('0x4c')](handleError(_0xc57169,null));};exports[_0x5811('0x53')]=function(_0x3bf9e9,_0x5a3e0a,_0x1f9e14){if(_0x3bf9e9[_0x5811('0x4e')]['id']){delete _0x3bf9e9[_0x5811('0x4e')]['id'];}return db[_0x5811('0x31')]['findOne']({'where':{'id':_0x3bf9e9[_0x5811('0x4f')]['id']}})[_0x5811('0x1a')](handleEntityNotFound(_0x5a3e0a,null))[_0x5811('0x1a')](function(_0x1e36b6){if(_0x1e36b6){_0x3bf9e9['body'][_0x5811('0x54')]=_0x1e36b6['id'];_0x3bf9e9['body'][_0x5811('0x55')]=integrations[_0x5811('0x56')](_0x3bf9e9[_0x5811('0x4e')][_0x5811('0x57')],_0x3bf9e9[_0x5811('0x4e')][_0x5811('0x34')]);_0x3bf9e9[_0x5811('0x4e')][_0x5811('0x58')]=integrations[_0x5811('0x59')](_0x3bf9e9[_0x5811('0x4e')][_0x5811('0x57')],_0x3bf9e9[_0x5811('0x4e')][_0x5811('0x34')]);return db[_0x5811('0x51')]['create'](_0x3bf9e9[_0x5811('0x4e')],{'include':[{'model':db['SalesforceField'],'as':_0x5811('0x55')},{'model':db['SalesforceField'],'as':_0x5811('0x58')}]});}return null;})[_0x5811('0x1a')](respondWithResult(_0x5a3e0a,null))[_0x5811('0x4c')](handleError(_0x5a3e0a,null));};exports[_0x5811('0x5a')]=function(_0xa5b293,_0x22a836,_0x480b96){var _0x23fd74;var _0x7b1251='';var _0x6969d5=_0x5811('0x5b');return db[_0x5811('0x31')][_0x5811('0x5c')]({'where':{'id':_0xa5b293[_0x5811('0x4f')]['id']},'attributes':['id','remoteUri',_0x5811('0x5d'),'clientSecret',_0x5811('0x5e'),'password','securityToken']})['then'](handleEntityNotFound(_0x22a836,null))[_0x5811('0x1a')](function(_0x115765){if(_0x115765){_0x7b1251=_0x115765['remoteUri'];var _0x352cb7=_0x7b1251['slice'](-0x1);if(_0x352cb7==='/'){_0x7b1251=_0x7b1251[_0x5811('0x5f')](0x0,_0x7b1251['lastIndexOf'](_0x352cb7));}_0x23fd74=new jsforce[(_0x5811('0x60'))]({'oauth2':{'loginUrl':_0x7b1251,'clientId':_0x115765[_0x5811('0x5d')],'clientSecret':_0x115765[_0x5811('0x61')]}});return _0x23fd74[_0x5811('0x62')](_0x115765[_0x5811('0x5e')],_0x115765[_0x5811('0x63')][_0x5811('0x64')](_0x115765[_0x5811('0x65')]));}})['then'](function(_0x4d7fd2){if(_0x4d7fd2){if(!_[_0x5811('0x66')](_0xa5b293['query'][_0x5811('0x67')])){_0x6969d5=_0xa5b293['query'][_0x5811('0x67')];}return _0x23fd74[_0x5811('0x68')](_0x6969d5)[_0x5811('0x69')]();}})['then'](function(_0x5ae99a){var _0x38a7a6=[_0x5811('0x6a'),_0x5811('0x6b'),_0x5811('0x6c'),_0x5811('0x6d'),_0x5811('0x6e'),_0x5811('0x6f'),_0x5811('0x70'),_0x5811('0x71')];if(!_[_0x5811('0x66')](_0xa5b293[_0x5811('0x38')][_0x5811('0x67')])&&_0xa5b293[_0x5811('0x38')][_0x5811('0x67')]===_0x5811('0x72')){_0x38a7a6=['Type',_0x5811('0x73'),'Reason',_0x5811('0x70'),'Priority',_0x5811('0x74'),'SuppliedName',_0x5811('0x75')];}if(_0x5ae99a){_[_0x5811('0x76')](_0x5ae99a[_0x5811('0x3c')],function(_0x4be59f){return _0x4be59f[_0x5811('0x77')]===![]&&!_0x38a7a6[_0x5811('0x78')](_0x4be59f[_0x5811('0x30')]);});return{'count':_0x5ae99a[_0x5811('0x3c')][_0x5811('0x3e')],'rows':_[_0x5811('0x37')](_0x5ae99a['fields'],function(_0x4a5a67){return{'id':_0x4a5a67[_0x5811('0x30')],'name':_0x4a5a67['label'],'custom':_0x4a5a67[_0x5811('0x77')],'options':_0x4a5a67[_0x5811('0x79')][_0x5811('0x3e')]>0x0?_['map'](_0x4a5a67[_0x5811('0x79')],function(_0x57577e){return{'name':_0x57577e[_0x5811('0x7a')],'value':_0x57577e[_0x5811('0x7b')]};}):_0x4a5a67[_0x5811('0x34')]==_0x5811('0x7c')?[{'name':_0x5811('0x7d'),'value':_0x5811('0x7e')},{'name':_0x5811('0x7f'),'value':'false'}]:[]};})};}})[_0x5811('0x1a')](respondWithResult(_0x22a836,null))[_0x5811('0x4c')](function(_0x3defa2){var _0xaea9b1=_0xa5b293['query']['test']?0x1f4:_0x3defa2[_0x5811('0x80')]||0x1f4;logger[_0x5811('0x20')](_0x5811('0x81'),_0x5811('0x5a'),_0xaea9b1,JSON[_0x5811('0x1f')](_0x3defa2));delete _0x3defa2[_0x5811('0x30')];if(_0xaea9b1===0x191){_0xaea9b1=0x190;}_0x22a836[_0x5811('0x26')](_0xaea9b1)[_0x5811('0x82')](_0xa5b293[_0x5811('0x38')]['test']?{'message':_0x5811('0x83'),'statusCode':_0x3defa2['statusCode']}:_0x3defa2);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 48fd3d7..6862890 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 _0x116b=['exports','define','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes'];(function(_0x5a285e,_0x30532a){var _0x4920e1=function(_0x2e7a37){while(--_0x2e7a37){_0x5a285e['push'](_0x5a285e['shift']());}};_0x4920e1(++_0x30532a);}(_0x116b,0x177));var _0xb116=function(_0x341999,_0x353c42){_0x341999=_0x341999-0x0;var _0x5deca8=_0x116b[_0x341999];return _0x5deca8;};'use strict';var _=require('lodash');var util=require(_0xb116('0x0'));var logger=require(_0xb116('0x1'))(_0xb116('0x2'));var moment=require(_0xb116('0x3'));var BPromise=require(_0xb116('0x4'));var rp=require(_0xb116('0x5'));var fs=require('fs');var path=require(_0xb116('0x6'));var rimraf=require(_0xb116('0x7'));var config=require('../../config/environment');var attributes=require(_0xb116('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xb116('0x9')]=function(_0x45cc00,_0x554109){return _0x45cc00[_0xb116('0xa')]('SalesforceAccount',attributes,{'tableName':_0xb116('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0c6=['SalesforceAccount','int_salesforce_accounts','lodash','util','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xf0c6,0x141));var _0x6f0c=function(_0x273f60,_0x5b6d19){_0x273f60=_0x273f60-0x0;var _0x51bce3=_0xf0c6[_0x273f60];return _0x51bce3;};'use strict';var _=require(_0x6f0c('0x0'));var util=require(_0x6f0c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6f0c('0x2'));var fs=require('fs');var path=require(_0x6f0c('0x3'));var rimraf=require(_0x6f0c('0x4'));var config=require(_0x6f0c('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x6f0c('0x6'));module[_0x6f0c('0x7')]=function(_0xc8886,_0x17f774){return _0xc8886[_0x6f0c('0x8')](_0x6f0c('0x9'),attributes,{'tableName':_0x6f0c('0xa'),'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 a4950f4..301a0cb 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 _0x4c4e=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','SalesforceAccount','ShowSalesforceAccount','stringify','lodash','moment'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x4c4e,0x152));var _0xe4c4=function(_0x523f62,_0x1c3b02){_0x523f62=_0x523f62-0x0;var _0x380f3a=_0x4c4e[_0x523f62];return _0x380f3a;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});}exports[_0xe4c4('0x15')]=function(_0x42242c){var _0x3820c7=this;return new Promise(function(_0x43a9ce,_0x376585){return db['SalesforceAccount'][_0xe4c4('0x16')]({'raw':_0x42242c[_0xe4c4('0x17')]?_0x42242c[_0xe4c4('0x17')][_0xe4c4('0x18')]===undefined?!![]:![]:!![],'where':_0x42242c['options']?_0x42242c[_0xe4c4('0x17')][_0xe4c4('0x19')]||null:null,'attributes':_0x42242c[_0xe4c4('0x17')]?_0x42242c[_0xe4c4('0x17')][_0xe4c4('0x1a')]||null:null,'limit':_0x42242c[_0xe4c4('0x17')]?_0x42242c[_0xe4c4('0x17')][_0xe4c4('0x1b')]||null:null,'include':_0x42242c[_0xe4c4('0x17')]?_0x42242c[_0xe4c4('0x17')][_0xe4c4('0x1c')]?_[_0xe4c4('0x1d')](_0x42242c[_0xe4c4('0x17')][_0xe4c4('0x1c')],function(_0x15873e){return{'model':db[_0x15873e['model']],'as':_0x15873e['as'],'attributes':_0x15873e['attributes'],'include':_0x15873e[_0xe4c4('0x1c')]?_['map'](_0x15873e[_0xe4c4('0x1c')],function(_0x5374fd){return{'model':db[_0x5374fd[_0xe4c4('0x1e')]],'as':_0x5374fd['as'],'attributes':_0x5374fd['attributes'],'include':_0x5374fd[_0xe4c4('0x1c')]?_['map'](_0x5374fd[_0xe4c4('0x1c')],function(_0x4a0199){return{'model':db[_0x4a0199['model']],'as':_0x4a0199['as'],'attributes':_0x4a0199['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3221cd){logger['info']('GetSalesforceAccount',_0x42242c);logger[_0xe4c4('0xe')](_0xe4c4('0x15'),_0x42242c,JSON['stringify'](_0x3221cd));_0x43a9ce(_0x3221cd);})['catch'](function(_0x7428ad){logger[_0xe4c4('0x10')]('GetSalesforceAccount',_0x7428ad[_0xe4c4('0x12')],_0x42242c);_0x376585(_0x3820c7[_0xe4c4('0x10')](0x1f4,_0x7428ad[_0xe4c4('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x5d49fd){var _0x46db7e=this;return new Promise(function(_0x2c5652,_0x12bde8){return db[_0xe4c4('0x1f')]['find']({'raw':_0x5d49fd['options']?_0x5d49fd[_0xe4c4('0x17')][_0xe4c4('0x18')]===undefined?!![]:![]:!![],'where':_0x5d49fd['options']?_0x5d49fd[_0xe4c4('0x17')][_0xe4c4('0x19')]||null:null,'attributes':_0x5d49fd[_0xe4c4('0x17')]?_0x5d49fd['options'][_0xe4c4('0x1a')]||null:null,'include':_0x5d49fd['options']?_0x5d49fd[_0xe4c4('0x17')][_0xe4c4('0x1c')]?_[_0xe4c4('0x1d')](_0x5d49fd[_0xe4c4('0x17')][_0xe4c4('0x1c')],function(_0x43c1ec){return{'model':db[_0x43c1ec[_0xe4c4('0x1e')]],'as':_0x43c1ec['as'],'attributes':_0x43c1ec[_0xe4c4('0x1a')],'include':_0x43c1ec[_0xe4c4('0x1c')]?_[_0xe4c4('0x1d')](_0x43c1ec[_0xe4c4('0x1c')],function(_0x2f8192){return{'model':db[_0x2f8192['model']],'as':_0x2f8192['as'],'attributes':_0x2f8192[_0xe4c4('0x1a')],'include':_0x2f8192[_0xe4c4('0x1c')]?_[_0xe4c4('0x1d')](_0x2f8192['include'],function(_0xac6cb4){return{'model':db[_0xac6cb4[_0xe4c4('0x1e')]],'as':_0xac6cb4['as'],'attributes':_0xac6cb4[_0xe4c4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4622cc){logger[_0xe4c4('0xb')](_0xe4c4('0x20'),_0x5d49fd);logger[_0xe4c4('0xe')](_0xe4c4('0x20'),_0x5d49fd,JSON[_0xe4c4('0x21')](_0x4622cc));_0x2c5652(_0x4622cc);})[_0xe4c4('0x14')](function(_0x44f4eb){logger[_0xe4c4('0x10')](_0xe4c4('0x20'),_0x44f4eb['message'],_0x5d49fd);_0x12bde8(_0x46db7e[_0xe4c4('0x10')](0x1f4,_0x44f4eb[_0xe4c4('0x12')]));});});}; \ No newline at end of file +var _0x222f=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','debug','find','where','ShowSalesforceAccount'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x222f,0x1a4));var _0xf222=function(_0x516510,_0x48f18a){_0x516510=_0x516510-0x0;var _0x5c5246=_0x222f[_0x516510];return _0x5c5246;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});}exports[_0xf222('0x16')]=function(_0x8783ab){var _0xfb4ddf=this;return new Promise(function(_0x12a2e4,_0x1e57ee){return db[_0xf222('0x17')]['findAll']({'raw':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x8783ab[_0xf222('0x18')]?_0x8783ab['options']['where']||null:null,'attributes':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'limit':_0x8783ab[_0xf222('0x18')]?_0x8783ab[_0xf222('0x18')][_0xf222('0x1b')]||null:null,'include':_0x8783ab['options']?_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x8783ab[_0xf222('0x18')][_0xf222('0x1c')],function(_0x2d18ab){return{'model':db[_0x2d18ab[_0xf222('0x1e')]],'as':_0x2d18ab['as'],'attributes':_0x2d18ab[_0xf222('0x1a')],'include':_0x2d18ab['include']?_[_0xf222('0x1d')](_0x2d18ab[_0xf222('0x1c')],function(_0x1883c1){return{'model':db[_0x1883c1[_0xf222('0x1e')]],'as':_0x1883c1['as'],'attributes':_0x1883c1[_0xf222('0x1a')],'include':_0x1883c1[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x1883c1[_0xf222('0x1c')],function(_0x15bf4e){return{'model':db[_0x15bf4e[_0xf222('0x1e')]],'as':_0x15bf4e['as'],'attributes':_0x15bf4e[_0xf222('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b2b1){logger[_0xf222('0xc')](_0xf222('0x16'),_0x8783ab);logger[_0xf222('0x1f')](_0xf222('0x16'),_0x8783ab,JSON[_0xf222('0x10')](_0x14b2b1));_0x12a2e4(_0x14b2b1);})[_0xf222('0x15')](function(_0x1b928b){logger[_0xf222('0x11')]('GetSalesforceAccount',_0x1b928b[_0xf222('0x13')],_0x8783ab);_0x1e57ee(_0xfb4ddf[_0xf222('0x11')](0x1f4,_0x1b928b[_0xf222('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x3ccc9e){var _0x5d5963=this;return new Promise(function(_0x40c7e7,_0x27a8cc){return db[_0xf222('0x17')][_0xf222('0x20')]({'raw':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x19')]===undefined?!![]:![]:!![],'where':_0x3ccc9e['options']?_0x3ccc9e['options'][_0xf222('0x21')]||null:null,'attributes':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1a')]||null:null,'include':_0x3ccc9e[_0xf222('0x18')]?_0x3ccc9e[_0xf222('0x18')]['include']?_[_0xf222('0x1d')](_0x3ccc9e[_0xf222('0x18')][_0xf222('0x1c')],function(_0x57c862){return{'model':db[_0x57c862[_0xf222('0x1e')]],'as':_0x57c862['as'],'attributes':_0x57c862[_0xf222('0x1a')],'include':_0x57c862[_0xf222('0x1c')]?_['map'](_0x57c862[_0xf222('0x1c')],function(_0x21e20a){return{'model':db[_0x21e20a[_0xf222('0x1e')]],'as':_0x21e20a['as'],'attributes':_0x21e20a['attributes'],'include':_0x21e20a[_0xf222('0x1c')]?_[_0xf222('0x1d')](_0x21e20a[_0xf222('0x1c')],function(_0x2b838c){return{'model':db[_0x2b838c[_0xf222('0x1e')]],'as':_0x2b838c['as'],'attributes':_0x2b838c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf222('0xb')](function(_0x542123){logger[_0xf222('0xc')](_0xf222('0x22'),_0x3ccc9e);logger[_0xf222('0x1f')]('ShowSalesforceAccount',_0x3ccc9e,JSON[_0xf222('0x10')](_0x542123));_0x40c7e7(_0x542123);})[_0xf222('0x15')](function(_0x54a10d){logger[_0xf222('0x11')]('ShowSalesforceAccount',_0x54a10d[_0xf222('0x13')],_0x3ccc9e);_0x27a8cc(_0x5d5963[_0xf222('0x11')](0x1f4,_0x54a10d[_0xf222('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index afb0567..2697ac9 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 _0x8181=['create','update','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x2d0006,_0x35b148){var _0x4fafb7=function(_0x3e847c){while(--_0x3e847c){_0x2d0006['push'](_0x2d0006['shift']());}};_0x4fafb7(++_0x35b148);}(_0x8181,0x146));var _0x1818=function(_0x46843f,_0x49ba64){_0x46843f=_0x46843f-0x0;var _0x472cf0=_0x8181[_0x46843f];return _0x472cf0;};'use strict';var multer=require('multer');var util=require(_0x1818('0x0'));var path=require(_0x1818('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x1818('0x2'));var interaction=require(_0x1818('0x3'));var config=require(_0x1818('0x4'));var controller=require(_0x1818('0x5'));router[_0x1818('0x6')]('/',auth[_0x1818('0x7')](),controller[_0x1818('0x8')]);router[_0x1818('0x6')](_0x1818('0x9'),auth['isAuthenticated'](),controller[_0x1818('0xa')]);router[_0x1818('0x6')](_0x1818('0xb'),auth[_0x1818('0x7')](),controller[_0x1818('0xc')]);router['get'](_0x1818('0xd'),auth[_0x1818('0x7')](),controller[_0x1818('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x1818('0xf')]);router['post']('/',auth[_0x1818('0x7')](),controller[_0x1818('0x10')]);router['put']('/:id',auth[_0x1818('0x7')](),controller[_0x1818('0x11')]);router['delete'](_0x1818('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x1818('0x12')]=router; \ No newline at end of file +var _0x2e81=['put','/:id','update','destroy','exports','multer','../../components/auth/service','../../config/environment','index','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x439b96,_0x563e72){var _0x321cac=function(_0x37320d){while(--_0x37320d){_0x439b96['push'](_0x439b96['shift']());}};_0x321cac(++_0x563e72);}(_0x2e81,0x1d1));var _0x12e8=function(_0x411511,_0x13b21a){_0x411511=_0x411511-0x0;var _0xda7b33=_0x2e81[_0x411511];return _0xda7b33;};'use strict';var multer=require(_0x12e8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x12e8('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x12e8('0x2'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x12e8('0x3')]);router[_0x12e8('0x4')]('/:id',auth[_0x12e8('0x5')](),controller[_0x12e8('0x6')]);router[_0x12e8('0x4')](_0x12e8('0x7'),auth[_0x12e8('0x5')](),controller[_0x12e8('0x8')]);router[_0x12e8('0x4')](_0x12e8('0x9'),auth[_0x12e8('0x5')](),controller[_0x12e8('0xa')]);router[_0x12e8('0x4')](_0x12e8('0xb'),auth[_0x12e8('0x5')](),controller[_0x12e8('0xc')]);router[_0x12e8('0xd')]('/',auth['isAuthenticated'](),controller[_0x12e8('0xe')]);router[_0x12e8('0xf')](_0x12e8('0x10'),auth[_0x12e8('0x5')](),controller[_0x12e8('0x11')]);router['delete'](_0x12e8('0x10'),auth[_0x12e8('0x5')](),controller[_0x12e8('0x12')]);module[_0x12e8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b72fd31..739e248 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 _0x0770=['contact','lead','nothing','sequelize','STRING','Task','Case','contact_lead'];(function(_0x36bbd3,_0x51ffcc){var _0x2d5142=function(_0x874213){while(--_0x874213){_0x36bbd3['push'](_0x36bbd3['shift']());}};_0x2d5142(++_0x51ffcc);}(_0x0770,0x173));var _0x0077=function(_0x1bf301,_0xda5c4c){_0x1bf301=_0x1bf301-0x0;var _0x51c947=_0x0770[_0x1bf301];return _0x51c947;};'use strict';var Sequelize=require(_0x0077('0x0'));module['exports']={'name':{'type':Sequelize[_0x0077('0x1')]},'description':{'type':Sequelize[_0x0077('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x0077('0x2'),_0x0077('0x3')),'defaultValue':_0x0077('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0x0077('0x4'),_0x0077('0x5'),_0x0077('0x6')),'defaultValue':_0x0077('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x0077('0x7'),'contact',_0x0077('0x6')),'defaultValue':_0x0077('0x6')}}; \ No newline at end of file +var _0x2ae5=['Task','ENUM','contact_lead','contact','lead','nothing','sequelize','exports','STRING'];(function(_0x5cbd39,_0x1bceaf){var _0x2e1f8f=function(_0x3c017f){while(--_0x3c017f){_0x5cbd39['push'](_0x5cbd39['shift']());}};_0x2e1f8f(++_0x1bceaf);}(_0x2ae5,0x16e));var _0x52ae=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x2ae5[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x52ae('0x0'));module[_0x52ae('0x1')]={'name':{'type':Sequelize[_0x52ae('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x52ae('0x3'),'Case'),'defaultValue':_0x52ae('0x3')},'moduleSearch':{'type':Sequelize[_0x52ae('0x4')](_0x52ae('0x5'),_0x52ae('0x6'),_0x52ae('0x7')),'defaultValue':_0x52ae('0x5')},'moduleCreate':{'type':Sequelize[_0x52ae('0x4')](_0x52ae('0x8'),_0x52ae('0x6'),_0x52ae('0x7')),'defaultValue':_0x52ae('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 364bd08..030b0da 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 _0xaeef=['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~!@#$%^&-_=+[{]}.','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','include','findAll','rows','keys','attributes','find','create','body','params','getFields','findOne','SalesforceField','pick','filter','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','test','Sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaeef,0x14a));var _0xfaee=function(_0x588030,_0x53ac03){_0x588030=_0x588030-0x0;var _0x3e8915=_0xaeef[_0x588030];return _0x3e8915;};'use strict';var pdf=require(_0xfaee('0x0'));var emlformat=require(_0xfaee('0x1'));var rimraf=require(_0xfaee('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfaee('0x3'));var rp=require(_0xfaee('0x4'));var moment=require(_0xfaee('0x5'));var BPromise=require(_0xfaee('0x6'));var Mustache=require(_0xfaee('0x7'));var util=require('util');var path=require(_0xfaee('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfaee('0x9'));var fs=require('fs');var _=require(_0xfaee('0xa'));var squel=require('squel');var crypto=require(_0xfaee('0xb'));var jsforce=require(_0xfaee('0xc'));var deskjs=require(_0xfaee('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfaee('0xe'));var Redis=require(_0xfaee('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfaee('0x10'));var as=require(_0xfaee('0x11'));var hardwareService=require(_0xfaee('0x12'));var logger=require(_0xfaee('0x13'))(_0xfaee('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfaee('0x15'))['db'];var jayson=require(_0xfaee('0x16'));var client=jayson[_0xfaee('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x4db935,_0x2b7915,_0x33d374){if(_0x33d374){var _0x298db5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x298db5[_0xfaee('0x18')](_0x2b7915)){return _0x4db935;}else{throw new db[(_0xfaee('0x19'))][(_0xfaee('0x1a'))](_0xfaee('0x1b'));}}else{return _0x4db935;}}function respondWithRpcPromise(_0x19da9f,_0x5f0280,_0x2a1907,_0x334867){return new BPromise(function(_0x154bb2,_0x47e383){var _0x2d24ae=_0x334867||client;return _0x2d24ae['request'](_0x19da9f,_0x2a1907)[_0xfaee('0x1c')](function(_0x145e12){logger['info'](_0xfaee('0x1d'),_0x5f0280,_0xfaee('0x1e'));logger['debug'](_0xfaee('0x1f'),_0x5f0280,'request\x20sent',JSON['stringify'](_0x145e12));if(_0x145e12[_0xfaee('0x20')]){if(_0x145e12['error'][_0xfaee('0x21')]===0x1f4){logger[_0xfaee('0x20')](_0xfaee('0x1d'),_0x5f0280,_0x145e12[_0xfaee('0x20')]['message']);return _0x47e383(_0x145e12[_0xfaee('0x20')][_0xfaee('0x22')]);}logger[_0xfaee('0x20')](_0xfaee('0x1d'),_0x5f0280,_0x145e12[_0xfaee('0x20')][_0xfaee('0x22')]);return _0x154bb2(_0x145e12['error'][_0xfaee('0x22')]);}else{logger[_0xfaee('0x23')](_0xfaee('0x1d'),_0x5f0280,_0xfaee('0x1e'));_0x154bb2(_0x145e12[_0xfaee('0x24')][_0xfaee('0x22')]);}})[_0xfaee('0x25')](function(_0x392a12){logger[_0xfaee('0x20')](_0xfaee('0x1d'),_0x5f0280,_0x392a12);_0x47e383(_0x392a12);});});}function respondWithStatusCode(_0x49c651,_0x1563b8){_0x1563b8=_0x1563b8||0xcc;return function(_0x5c980a){if(_0x5c980a){return _0x49c651[_0xfaee('0x26')](_0x1563b8);}return _0x49c651['status'](_0x1563b8)[_0xfaee('0x27')]();};}function respondWithResult(_0x5b617b,_0x31c5f4){_0x31c5f4=_0x31c5f4||0xc8;return function(_0x214186){if(_0x214186){return _0x5b617b['status'](_0x31c5f4)[_0xfaee('0x28')](_0x214186);}};}function respondWithFilteredResult(_0x11587b,_0x36d71e){return function(_0x4bbd1b){if(_0x4bbd1b){var _0x58009e=_0x4bbd1b[_0xfaee('0x29')],_0x25b1ae=_0x36d71e['offset'],_0x266f5e=_0x36d71e[_0xfaee('0x2a')]+_0x36d71e[_0xfaee('0x2b')],_0x185eb4;if(_0x266f5e>=_0x58009e){_0x266f5e=_0x58009e;_0x185eb4=0xc8;}else{_0x185eb4=0xce;}_0x11587b[_0xfaee('0x2c')](_0x185eb4);return _0x11587b[_0xfaee('0x2d')](_0xfaee('0x2e'),_0x25b1ae+'-'+_0x266f5e+'/'+_0x58009e)[_0xfaee('0x28')](_0x4bbd1b);}return null;};}function patchUpdates(_0x1e8f4a){return function(_0x12bd80){try{jsonpatch['apply'](_0x12bd80,_0x1e8f4a,!![]);}catch(_0x23fdaa){return BPromise['reject'](_0x23fdaa);}return _0x12bd80[_0xfaee('0x2f')]();};}function saveUpdates(_0x29c551,_0x2e65de){return function(_0x2d9b2b){if(_0x2d9b2b){return _0x2d9b2b[_0xfaee('0x30')](_0x29c551)['then'](function(_0x514ea1){return _0x514ea1;});}return null;};}function removeEntity(_0x41a704,_0x4eb023){return function(_0x40e73e){if(_0x40e73e){return _0x40e73e[_0xfaee('0x31')]()[_0xfaee('0x1c')](function(){_0x41a704[_0xfaee('0x2c')](0xcc)[_0xfaee('0x27')]();});}};}function handleEntityNotFound(_0x5966af,_0x5da9af){return function(_0x5e28f8){if(!_0x5e28f8){_0x5966af[_0xfaee('0x26')](0x194);}return _0x5e28f8;};}function handleError(_0x7611bf,_0x989b8){_0x989b8=_0x989b8||0x1f4;return function(_0x17bdc0){logger[_0xfaee('0x20')](_0x17bdc0[_0xfaee('0x32')]);if(_0x17bdc0[_0xfaee('0x33')]){delete _0x17bdc0[_0xfaee('0x33')];}_0x7611bf['status'](_0x989b8)[_0xfaee('0x34')](_0x17bdc0);};}exports[_0xfaee('0x35')]=function(_0x4e92b3,_0x2098a5){var _0x4335d0={},_0x221a55={},_0x10177c={'count':0x0,'rows':[]};var _0x3c62f8=_[_0xfaee('0x36')](db[_0xfaee('0x37')][_0xfaee('0x38')],function(_0x513075){return{'name':_0x513075[_0xfaee('0x39')],'type':_0x513075[_0xfaee('0x3a')][_0xfaee('0x3b')]};});_0x221a55[_0xfaee('0x3c')]=_['map'](_0x3c62f8,_0xfaee('0x33'));_0x221a55[_0xfaee('0x3d')]=_['keys'](_0x4e92b3[_0xfaee('0x3d')]);_0x221a55[_0xfaee('0x3e')]=_[_0xfaee('0x3f')](_0x221a55['model'],_0x221a55['query']);_0x4335d0['attributes']=_[_0xfaee('0x3f')](_0x221a55['model'],qs[_0xfaee('0x40')](_0x4e92b3[_0xfaee('0x3d')][_0xfaee('0x40')]));_0x4335d0['attributes']=_0x4335d0['attributes'][_0xfaee('0x41')]?_0x4335d0['attributes']:_0x221a55[_0xfaee('0x3c')];if(!_0x4e92b3['query'][_0xfaee('0x42')](_0xfaee('0x43'))){_0x4335d0[_0xfaee('0x2b')]=qs[_0xfaee('0x2b')](_0x4e92b3['query'][_0xfaee('0x2b')]);_0x4335d0[_0xfaee('0x2a')]=qs['offset'](_0x4e92b3[_0xfaee('0x3d')]['offset']);}_0x4335d0[_0xfaee('0x44')]=qs['sort'](_0x4e92b3[_0xfaee('0x3d')][_0xfaee('0x45')]);_0x4335d0[_0xfaee('0x46')]=qs[_0xfaee('0x3e')](_['pick'](_0x4e92b3[_0xfaee('0x3d')],_0x221a55[_0xfaee('0x3e')]),_0x3c62f8);if(_0x4e92b3[_0xfaee('0x3d')]['filter']){_0x4335d0['where']=_[_0xfaee('0x47')](_0x4335d0[_0xfaee('0x46')],{'$or':_[_0xfaee('0x36')](_0x3c62f8,function(_0x3fdfc6){if(_0x3fdfc6[_0xfaee('0x3a')]!=='VIRTUAL'){var _0xd30b3c={};_0xd30b3c[_0x3fdfc6['name']]={'$like':'%'+_0x4e92b3[_0xfaee('0x3d')]['filter']+'%'};return _0xd30b3c;}})});}_0x4335d0=_[_0xfaee('0x47')]({},_0x4335d0,_0x4e92b3[_0xfaee('0x48')]);var _0x585d8c={'where':_0x4335d0[_0xfaee('0x46')]};return db[_0xfaee('0x37')][_0xfaee('0x29')](_0x585d8c)[_0xfaee('0x1c')](function(_0x5d701){_0x10177c[_0xfaee('0x29')]=_0x5d701;if(_0x4e92b3[_0xfaee('0x3d')]['includeAll']){_0x4335d0[_0xfaee('0x49')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xfaee('0x4a')](_0x4335d0);})['then'](function(_0x4a59f6){_0x10177c[_0xfaee('0x4b')]=_0x4a59f6;return _0x10177c;})['then'](respondWithFilteredResult(_0x2098a5,_0x4335d0))[_0xfaee('0x25')](handleError(_0x2098a5,null));};exports['show']=function(_0x148151,_0x4c600b){var _0xd898b0={'raw':![],'where':{'id':_0x148151['params']['id']}},_0x3e4b35={};_0x3e4b35['model']=_['keys'](db[_0xfaee('0x37')]['rawAttributes']);_0x3e4b35[_0xfaee('0x3d')]=_[_0xfaee('0x4c')](_0x148151['query']);_0x3e4b35[_0xfaee('0x3e')]=_[_0xfaee('0x3f')](_0x3e4b35[_0xfaee('0x3c')],_0x3e4b35[_0xfaee('0x3d')]);_0xd898b0['attributes']=_[_0xfaee('0x3f')](_0x3e4b35[_0xfaee('0x3c')],qs[_0xfaee('0x40')](_0x148151[_0xfaee('0x3d')][_0xfaee('0x40')]));_0xd898b0[_0xfaee('0x4d')]=_0xd898b0[_0xfaee('0x4d')][_0xfaee('0x41')]?_0xd898b0[_0xfaee('0x4d')]:_0x3e4b35[_0xfaee('0x3c')];if(_0x148151[_0xfaee('0x3d')]['includeAll']){_0xd898b0[_0xfaee('0x49')]=[{'all':!![]}];}_0xd898b0=_[_0xfaee('0x47')]({},_0xd898b0,_0x148151[_0xfaee('0x48')]);return db[_0xfaee('0x37')][_0xfaee('0x4e')](_0xd898b0)[_0xfaee('0x1c')](handleEntityNotFound(_0x4c600b,null))[_0xfaee('0x1c')](respondWithResult(_0x4c600b,null))['catch'](handleError(_0x4c600b,null));};exports[_0xfaee('0x4f')]=function(_0x1aee1e,_0x3d70c4){return db[_0xfaee('0x37')][_0xfaee('0x4f')](_0x1aee1e[_0xfaee('0x50')],{})[_0xfaee('0x1c')](respondWithResult(_0x3d70c4,0xc9))['catch'](handleError(_0x3d70c4,null));};exports['update']=function(_0x512373,_0x1ca431){if(_0x512373[_0xfaee('0x50')]['id']){delete _0x512373[_0xfaee('0x50')]['id'];}return db['SalesforceConfiguration'][_0xfaee('0x4e')]({'where':{'id':_0x512373[_0xfaee('0x51')]['id']}})['then'](handleEntityNotFound(_0x1ca431,null))[_0xfaee('0x1c')](saveUpdates(_0x512373['body'],null))['then'](respondWithResult(_0x1ca431,null))[_0xfaee('0x25')](handleError(_0x1ca431,null));};exports[_0xfaee('0x31')]=function(_0x1b4d51,_0x132c5d){return db[_0xfaee('0x37')][_0xfaee('0x4e')]({'where':{'id':_0x1b4d51[_0xfaee('0x51')]['id']}})[_0xfaee('0x1c')](handleEntityNotFound(_0x132c5d,null))['then'](removeEntity(_0x132c5d,null))[_0xfaee('0x25')](handleError(_0x132c5d,null));};exports[_0xfaee('0x52')]=function(_0x304763,_0x28ad48,_0x3ee55f){var _0x24b50a={};var _0x3b7e71={};var _0x4a530d;var _0x473ba6;return db[_0xfaee('0x37')][_0xfaee('0x53')]({'where':{'id':_0x304763[_0xfaee('0x51')]['id']}})[_0xfaee('0x1c')](handleEntityNotFound(_0x28ad48,null))[_0xfaee('0x1c')](function(_0xf5fc26){if(_0xf5fc26){_0x4a530d=_0xf5fc26;_0x3b7e71['model']=_['keys'](db[_0xfaee('0x54')][_0xfaee('0x38')]);_0x3b7e71[_0xfaee('0x3d')]=_[_0xfaee('0x4c')](_0x304763[_0xfaee('0x3d')]);_0x3b7e71['filters']=_['intersection'](_0x3b7e71[_0xfaee('0x3c')],_0x3b7e71[_0xfaee('0x3d')]);_0x24b50a['attributes']=_[_0xfaee('0x3f')](_0x3b7e71[_0xfaee('0x3c')],qs['fields'](_0x304763['query'][_0xfaee('0x40')]));_0x24b50a[_0xfaee('0x4d')]=_0x24b50a[_0xfaee('0x4d')][_0xfaee('0x41')]?_0x24b50a['attributes']:_0x3b7e71[_0xfaee('0x3c')];_0x24b50a[_0xfaee('0x44')]=qs[_0xfaee('0x45')](_0x304763['query'][_0xfaee('0x45')]);_0x24b50a[_0xfaee('0x46')]=qs['filters'](_[_0xfaee('0x55')](_0x304763[_0xfaee('0x3d')],_0x3b7e71['filters']));if(_0x304763[_0xfaee('0x3d')][_0xfaee('0x56')]){_0x24b50a[_0xfaee('0x46')]=_[_0xfaee('0x47')](_0x24b50a['where'],{'$or':_[_0xfaee('0x36')](_0x24b50a[_0xfaee('0x4d')],function(_0x1d1e67){var _0x19eed5={};_0x19eed5[_0x1d1e67]={'$like':'%'+_0x304763[_0xfaee('0x3d')][_0xfaee('0x56')]+'%'};return _0x19eed5;})});}_0x24b50a=_[_0xfaee('0x47')]({},_0x24b50a,_0x304763['options']);return _0x4a530d['getFields'](_0x24b50a);}})[_0xfaee('0x1c')](function(_0x4b5e5f){if(_0x4b5e5f){_0x473ba6=_0x4b5e5f[_0xfaee('0x41')];if(!_0x304763[_0xfaee('0x3d')]['hasOwnProperty'](_0xfaee('0x43'))){_0x24b50a['limit']=qs[_0xfaee('0x2b')](_0x304763[_0xfaee('0x3d')][_0xfaee('0x2b')]);_0x24b50a[_0xfaee('0x2a')]=qs[_0xfaee('0x2a')](_0x304763[_0xfaee('0x3d')][_0xfaee('0x2a')]);}return _0x4a530d[_0xfaee('0x52')](_0x24b50a);}})['then'](function(_0x4aaebe){if(_0x4aaebe){return _0x4aaebe?{'count':_0x473ba6,'rows':_0x4aaebe}:null;}})['then'](respondWithResult(_0x28ad48,null))['catch'](handleError(_0x28ad48,null));};exports[_0xfaee('0x57')]=function(_0x130e16,_0x4c2974,_0x3c6c7e){var _0x5007fd={};var _0x4ea46a={};var _0x5ea0cc;var _0x376d80;return db[_0xfaee('0x37')][_0xfaee('0x53')]({'where':{'id':_0x130e16[_0xfaee('0x51')]['id']}})[_0xfaee('0x1c')](handleEntityNotFound(_0x4c2974,null))[_0xfaee('0x1c')](function(_0x3a19b3){if(_0x3a19b3){_0x5ea0cc=_0x3a19b3;_0x4ea46a[_0xfaee('0x3c')]=_['keys'](db[_0xfaee('0x54')][_0xfaee('0x38')]);_0x4ea46a[_0xfaee('0x3d')]=_[_0xfaee('0x4c')](_0x130e16['query']);_0x4ea46a[_0xfaee('0x3e')]=_[_0xfaee('0x3f')](_0x4ea46a[_0xfaee('0x3c')],_0x4ea46a[_0xfaee('0x3d')]);_0x5007fd[_0xfaee('0x4d')]=_[_0xfaee('0x3f')](_0x4ea46a[_0xfaee('0x3c')],qs[_0xfaee('0x40')](_0x130e16[_0xfaee('0x3d')]['fields']));_0x5007fd['attributes']=_0x5007fd[_0xfaee('0x4d')][_0xfaee('0x41')]?_0x5007fd[_0xfaee('0x4d')]:_0x4ea46a[_0xfaee('0x3c')];_0x5007fd[_0xfaee('0x44')]=qs[_0xfaee('0x45')](_0x130e16[_0xfaee('0x3d')]['sort']);_0x5007fd[_0xfaee('0x46')]=qs[_0xfaee('0x3e')](_[_0xfaee('0x55')](_0x130e16[_0xfaee('0x3d')],_0x4ea46a[_0xfaee('0x3e')]));if(_0x130e16[_0xfaee('0x3d')][_0xfaee('0x56')]){_0x5007fd['where']=_['merge'](_0x5007fd[_0xfaee('0x46')],{'$or':_['map'](_0x5007fd[_0xfaee('0x4d')],function(_0x1cdac8){var _0x25f5d0={};_0x25f5d0[_0x1cdac8]={'$like':'%'+_0x130e16[_0xfaee('0x3d')][_0xfaee('0x56')]+'%'};return _0x25f5d0;})});}_0x5007fd=_[_0xfaee('0x47')]({},_0x5007fd,_0x130e16[_0xfaee('0x48')]);return _0x5ea0cc['getSubjects'](_0x5007fd);}})[_0xfaee('0x1c')](function(_0x353869){if(_0x353869){_0x376d80=_0x353869[_0xfaee('0x41')];if(!_0x130e16[_0xfaee('0x3d')][_0xfaee('0x42')](_0xfaee('0x43'))){_0x5007fd[_0xfaee('0x2b')]=qs[_0xfaee('0x2b')](_0x130e16[_0xfaee('0x3d')][_0xfaee('0x2b')]);_0x5007fd[_0xfaee('0x2a')]=qs[_0xfaee('0x2a')](_0x130e16[_0xfaee('0x3d')][_0xfaee('0x2a')]);}return _0x5ea0cc['getSubjects'](_0x5007fd);}})['then'](function(_0x2b3326){if(_0x2b3326){return _0x2b3326?{'count':_0x376d80,'rows':_0x2b3326}:null;}})[_0xfaee('0x1c')](respondWithResult(_0x4c2974,null))[_0xfaee('0x25')](handleError(_0x4c2974,null));};exports[_0xfaee('0x58')]=function(_0x1cfc11,_0x54fc19,_0x46f8bb){var _0x1fc8e6={};var _0x32701e={};var _0x390928;var _0x330b9b;return db[_0xfaee('0x37')][_0xfaee('0x53')]({'where':{'id':_0x1cfc11[_0xfaee('0x51')]['id']}})[_0xfaee('0x1c')](handleEntityNotFound(_0x54fc19,null))['then'](function(_0x35b2c5){if(_0x35b2c5){_0x390928=_0x35b2c5;_0x32701e[_0xfaee('0x3c')]=_['keys'](db[_0xfaee('0x54')]['rawAttributes']);_0x32701e[_0xfaee('0x3d')]=_[_0xfaee('0x4c')](_0x1cfc11[_0xfaee('0x3d')]);_0x32701e[_0xfaee('0x3e')]=_['intersection'](_0x32701e[_0xfaee('0x3c')],_0x32701e['query']);_0x1fc8e6[_0xfaee('0x4d')]=_[_0xfaee('0x3f')](_0x32701e[_0xfaee('0x3c')],qs['fields'](_0x1cfc11['query'][_0xfaee('0x40')]));_0x1fc8e6[_0xfaee('0x4d')]=_0x1fc8e6[_0xfaee('0x4d')]['length']?_0x1fc8e6['attributes']:_0x32701e['model'];_0x1fc8e6[_0xfaee('0x44')]=qs['sort'](_0x1cfc11[_0xfaee('0x3d')][_0xfaee('0x45')]);_0x1fc8e6['where']=qs[_0xfaee('0x3e')](_[_0xfaee('0x55')](_0x1cfc11['query'],_0x32701e[_0xfaee('0x3e')]));if(_0x1cfc11['query']['filter']){_0x1fc8e6[_0xfaee('0x46')]=_[_0xfaee('0x47')](_0x1fc8e6[_0xfaee('0x46')],{'$or':_[_0xfaee('0x36')](_0x1fc8e6['attributes'],function(_0x158a44){var _0x16feb7={};_0x16feb7[_0x158a44]={'$like':'%'+_0x1cfc11['query'][_0xfaee('0x56')]+'%'};return _0x16feb7;})});}_0x1fc8e6=_['merge']({},_0x1fc8e6,_0x1cfc11[_0xfaee('0x48')]);return _0x390928[_0xfaee('0x58')](_0x1fc8e6);}})[_0xfaee('0x1c')](function(_0x5f01ca){if(_0x5f01ca){_0x330b9b=_0x5f01ca[_0xfaee('0x41')];if(!_0x1cfc11[_0xfaee('0x3d')]['hasOwnProperty'](_0xfaee('0x43'))){_0x1fc8e6[_0xfaee('0x2b')]=qs['limit'](_0x1cfc11[_0xfaee('0x3d')]['limit']);_0x1fc8e6[_0xfaee('0x2a')]=qs['offset'](_0x1cfc11[_0xfaee('0x3d')][_0xfaee('0x2a')]);}return _0x390928['getDescriptions'](_0x1fc8e6);}})['then'](function(_0x64c9b5){if(_0x64c9b5){return _0x64c9b5?{'count':_0x330b9b,'rows':_0x64c9b5}:null;}})[_0xfaee('0x1c')](respondWithResult(_0x54fc19,null))[_0xfaee('0x25')](handleError(_0x54fc19,null));}; \ No newline at end of file +var _0x64c4=['stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','test','Sequelize','ValidationError','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus'];(function(_0x5d4408,_0x19aa01){var _0x2166bf=function(_0x4f3761){while(--_0x4f3761){_0x5d4408['push'](_0x5d4408['shift']());}};_0x2166bf(++_0x19aa01);}(_0x64c4,0x13a));var _0x464c=function(_0x4302e8,_0x185038){_0x4302e8=_0x4302e8-0x0;var _0xc04909=_0x64c4[_0x4302e8];return _0xc04909;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x464c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x464c('0x1'));var jsonpatch=require(_0x464c('0x2'));var rp=require('request-promise');var moment=require(_0x464c('0x3'));var BPromise=require(_0x464c('0x4'));var Mustache=require(_0x464c('0x5'));var util=require('util');var path=require(_0x464c('0x6'));var sox=require(_0x464c('0x7'));var csv=require(_0x464c('0x8'));var ejs=require(_0x464c('0x9'));var fs=require('fs');var _=require(_0x464c('0xa'));var squel=require('squel');var crypto=require(_0x464c('0xb'));var jsforce=require(_0x464c('0xc'));var deskjs=require(_0x464c('0xd'));var toCsv=require(_0x464c('0x8'));var querystring=require('querystring');var Papa=require(_0x464c('0xe'));var Redis=require(_0x464c('0xf'));var authService=require(_0x464c('0x10'));var qs=require(_0x464c('0x11'));var as=require(_0x464c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x464c('0x13'))('api');var utils=require(_0x464c('0x14'));var config=require(_0x464c('0x15'));var db=require(_0x464c('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x20a055,_0x36a119,_0x55be3c){if(_0x55be3c){var _0x3b6499=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b6499[_0x464c('0x17')](_0x36a119)){return _0x20a055;}else{throw new db[(_0x464c('0x18'))][(_0x464c('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x20a055;}}function respondWithRpcPromise(_0x4dbaf0,_0x2e6fd2,_0x172662,_0x2d8414){return new BPromise(function(_0x4c9951,_0x4b2f55){var _0x11c437=_0x2d8414||client;return _0x11c437[_0x464c('0x1a')](_0x4dbaf0,_0x172662)[_0x464c('0x1b')](function(_0x377089){logger[_0x464c('0x1c')](_0x464c('0x1d'),_0x2e6fd2,_0x464c('0x1e'));logger[_0x464c('0x1f')](_0x464c('0x20'),_0x2e6fd2,_0x464c('0x1e'),JSON['stringify'](_0x377089));if(_0x377089[_0x464c('0x21')]){if(_0x377089[_0x464c('0x21')][_0x464c('0x22')]===0x1f4){logger[_0x464c('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2e6fd2,_0x377089[_0x464c('0x21')][_0x464c('0x23')]);return _0x4b2f55(_0x377089[_0x464c('0x21')][_0x464c('0x23')]);}logger[_0x464c('0x21')](_0x464c('0x1d'),_0x2e6fd2,_0x377089[_0x464c('0x21')]['message']);return _0x4c9951(_0x377089[_0x464c('0x21')][_0x464c('0x23')]);}else{logger['info'](_0x464c('0x1d'),_0x2e6fd2,_0x464c('0x1e'));_0x4c9951(_0x377089[_0x464c('0x24')]['message']);}})[_0x464c('0x25')](function(_0x17810f){logger['error'](_0x464c('0x1d'),_0x2e6fd2,_0x17810f);_0x4b2f55(_0x17810f);});});}function respondWithStatusCode(_0x1edfdf,_0x446bd2){_0x446bd2=_0x446bd2||0xcc;return function(_0x4e9fe6){if(_0x4e9fe6){return _0x1edfdf['sendStatus'](_0x446bd2);}return _0x1edfdf['status'](_0x446bd2)['end']();};}function respondWithResult(_0x110c64,_0x5929a5){_0x5929a5=_0x5929a5||0xc8;return function(_0x1aec9a){if(_0x1aec9a){return _0x110c64[_0x464c('0x26')](_0x5929a5)[_0x464c('0x27')](_0x1aec9a);}};}function respondWithFilteredResult(_0x4feba7,_0x2caffd){return function(_0x329e62){if(_0x329e62){var _0x3340a9=_0x329e62[_0x464c('0x28')],_0x55baa7=_0x2caffd['offset'],_0x4f4064=_0x2caffd[_0x464c('0x29')]+_0x2caffd[_0x464c('0x2a')],_0x245110;if(_0x4f4064>=_0x3340a9){_0x4f4064=_0x3340a9;_0x245110=0xc8;}else{_0x245110=0xce;}_0x4feba7['status'](_0x245110);return _0x4feba7[_0x464c('0x2b')](_0x464c('0x2c'),_0x55baa7+'-'+_0x4f4064+'/'+_0x3340a9)['json'](_0x329e62);}return null;};}function patchUpdates(_0x28ae37){return function(_0x176008){try{jsonpatch[_0x464c('0x2d')](_0x176008,_0x28ae37,!![]);}catch(_0xa6181e){return BPromise['reject'](_0xa6181e);}return _0x176008[_0x464c('0x2e')]();};}function saveUpdates(_0x4dc35e,_0x30a520){return function(_0x50b0fd){if(_0x50b0fd){return _0x50b0fd[_0x464c('0x2f')](_0x4dc35e)[_0x464c('0x1b')](function(_0x2ca42f){return _0x2ca42f;});}return null;};}function removeEntity(_0x3a7332,_0x41f2fe){return function(_0xd25b78){if(_0xd25b78){return _0xd25b78[_0x464c('0x30')]()['then'](function(){_0x3a7332['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13015b,_0x3f0f07){return function(_0xa9efb6){if(!_0xa9efb6){_0x13015b[_0x464c('0x31')](0x194);}return _0xa9efb6;};}function handleError(_0x1c5c12,_0x2bba99){_0x2bba99=_0x2bba99||0x1f4;return function(_0x1097b6){logger[_0x464c('0x21')](_0x1097b6[_0x464c('0x32')]);if(_0x1097b6[_0x464c('0x33')]){delete _0x1097b6[_0x464c('0x33')];}_0x1c5c12['status'](_0x2bba99)['send'](_0x1097b6);};}exports[_0x464c('0x34')]=function(_0x48b930,_0x6bb968){var _0x5347a8={},_0x240c1={},_0x1461d4={'count':0x0,'rows':[]};var _0xe53e01=_[_0x464c('0x35')](db[_0x464c('0x36')][_0x464c('0x37')],function(_0x190c99){return{'name':_0x190c99[_0x464c('0x38')],'type':_0x190c99[_0x464c('0x39')][_0x464c('0x3a')]};});_0x240c1[_0x464c('0x3b')]=_[_0x464c('0x35')](_0xe53e01,_0x464c('0x33'));_0x240c1[_0x464c('0x3c')]=_[_0x464c('0x3d')](_0x48b930[_0x464c('0x3c')]);_0x240c1[_0x464c('0x3e')]=_['intersection'](_0x240c1[_0x464c('0x3b')],_0x240c1['query']);_0x5347a8[_0x464c('0x3f')]=_[_0x464c('0x40')](_0x240c1[_0x464c('0x3b')],qs['fields'](_0x48b930['query'][_0x464c('0x41')]));_0x5347a8['attributes']=_0x5347a8[_0x464c('0x3f')][_0x464c('0x42')]?_0x5347a8['attributes']:_0x240c1[_0x464c('0x3b')];if(!_0x48b930[_0x464c('0x3c')][_0x464c('0x43')](_0x464c('0x44'))){_0x5347a8[_0x464c('0x2a')]=qs['limit'](_0x48b930['query'][_0x464c('0x2a')]);_0x5347a8[_0x464c('0x29')]=qs['offset'](_0x48b930[_0x464c('0x3c')]['offset']);}_0x5347a8[_0x464c('0x45')]=qs['sort'](_0x48b930['query'][_0x464c('0x46')]);_0x5347a8[_0x464c('0x47')]=qs[_0x464c('0x3e')](_[_0x464c('0x48')](_0x48b930[_0x464c('0x3c')],_0x240c1[_0x464c('0x3e')]),_0xe53e01);if(_0x48b930['query'][_0x464c('0x49')]){_0x5347a8['where']=_[_0x464c('0x4a')](_0x5347a8['where'],{'$or':_[_0x464c('0x35')](_0xe53e01,function(_0x100cf0){if(_0x100cf0['type']!==_0x464c('0x4b')){var _0x382f4a={};_0x382f4a[_0x100cf0[_0x464c('0x33')]]={'$like':'%'+_0x48b930['query'][_0x464c('0x49')]+'%'};return _0x382f4a;}})});}_0x5347a8=_[_0x464c('0x4a')]({},_0x5347a8,_0x48b930[_0x464c('0x4c')]);var _0x1b721e={'where':_0x5347a8['where']};return db[_0x464c('0x36')][_0x464c('0x28')](_0x1b721e)['then'](function(_0x153d8b){_0x1461d4['count']=_0x153d8b;if(_0x48b930[_0x464c('0x3c')][_0x464c('0x4d')]){_0x5347a8[_0x464c('0x4e')]=[{'all':!![]}];}return db[_0x464c('0x36')][_0x464c('0x4f')](_0x5347a8);})[_0x464c('0x1b')](function(_0x237ae1){_0x1461d4[_0x464c('0x50')]=_0x237ae1;return _0x1461d4;})[_0x464c('0x1b')](respondWithFilteredResult(_0x6bb968,_0x5347a8))[_0x464c('0x25')](handleError(_0x6bb968,null));};exports[_0x464c('0x51')]=function(_0x2c6444,_0x5e99d2){var _0x3a9662={'raw':![],'where':{'id':_0x2c6444[_0x464c('0x52')]['id']}},_0x2c8a68={};_0x2c8a68[_0x464c('0x3b')]=_['keys'](db[_0x464c('0x36')][_0x464c('0x37')]);_0x2c8a68[_0x464c('0x3c')]=_['keys'](_0x2c6444[_0x464c('0x3c')]);_0x2c8a68[_0x464c('0x3e')]=_[_0x464c('0x40')](_0x2c8a68[_0x464c('0x3b')],_0x2c8a68[_0x464c('0x3c')]);_0x3a9662[_0x464c('0x3f')]=_[_0x464c('0x40')](_0x2c8a68['model'],qs[_0x464c('0x41')](_0x2c6444[_0x464c('0x3c')]['fields']));_0x3a9662[_0x464c('0x3f')]=_0x3a9662['attributes']['length']?_0x3a9662[_0x464c('0x3f')]:_0x2c8a68['model'];if(_0x2c6444['query']['includeAll']){_0x3a9662[_0x464c('0x4e')]=[{'all':!![]}];}_0x3a9662=_[_0x464c('0x4a')]({},_0x3a9662,_0x2c6444['options']);return db[_0x464c('0x36')][_0x464c('0x53')](_0x3a9662)['then'](handleEntityNotFound(_0x5e99d2,null))[_0x464c('0x1b')](respondWithResult(_0x5e99d2,null))[_0x464c('0x25')](handleError(_0x5e99d2,null));};exports[_0x464c('0x54')]=function(_0x4c87f4,_0x3d6951){return db['SalesforceConfiguration'][_0x464c('0x54')](_0x4c87f4['body'],{})[_0x464c('0x1b')](respondWithResult(_0x3d6951,0xc9))[_0x464c('0x25')](handleError(_0x3d6951,null));};exports['update']=function(_0x1fa071,_0x474dd4){if(_0x1fa071[_0x464c('0x55')]['id']){delete _0x1fa071[_0x464c('0x55')]['id'];}return db[_0x464c('0x36')]['find']({'where':{'id':_0x1fa071[_0x464c('0x52')]['id']}})[_0x464c('0x1b')](handleEntityNotFound(_0x474dd4,null))[_0x464c('0x1b')](saveUpdates(_0x1fa071[_0x464c('0x55')],null))[_0x464c('0x1b')](respondWithResult(_0x474dd4,null))['catch'](handleError(_0x474dd4,null));};exports[_0x464c('0x30')]=function(_0x13c920,_0x2a3956){return db[_0x464c('0x36')][_0x464c('0x53')]({'where':{'id':_0x13c920[_0x464c('0x52')]['id']}})[_0x464c('0x1b')](handleEntityNotFound(_0x2a3956,null))[_0x464c('0x1b')](removeEntity(_0x2a3956,null))[_0x464c('0x25')](handleError(_0x2a3956,null));};exports[_0x464c('0x56')]=function(_0x5a571e,_0xc0da2b,_0x5d50fc){var _0x29f7e9={};var _0x1297ea={};var _0x42ea32;var _0x263bc6;return db[_0x464c('0x36')][_0x464c('0x57')]({'where':{'id':_0x5a571e['params']['id']}})[_0x464c('0x1b')](handleEntityNotFound(_0xc0da2b,null))[_0x464c('0x1b')](function(_0x5e8c33){if(_0x5e8c33){_0x42ea32=_0x5e8c33;_0x1297ea[_0x464c('0x3b')]=_[_0x464c('0x3d')](db[_0x464c('0x58')][_0x464c('0x37')]);_0x1297ea[_0x464c('0x3c')]=_['keys'](_0x5a571e['query']);_0x1297ea[_0x464c('0x3e')]=_['intersection'](_0x1297ea[_0x464c('0x3b')],_0x1297ea[_0x464c('0x3c')]);_0x29f7e9[_0x464c('0x3f')]=_['intersection'](_0x1297ea['model'],qs[_0x464c('0x41')](_0x5a571e[_0x464c('0x3c')][_0x464c('0x41')]));_0x29f7e9[_0x464c('0x3f')]=_0x29f7e9[_0x464c('0x3f')][_0x464c('0x42')]?_0x29f7e9[_0x464c('0x3f')]:_0x1297ea['model'];_0x29f7e9[_0x464c('0x45')]=qs['sort'](_0x5a571e['query'][_0x464c('0x46')]);_0x29f7e9['where']=qs[_0x464c('0x3e')](_[_0x464c('0x48')](_0x5a571e[_0x464c('0x3c')],_0x1297ea['filters']));if(_0x5a571e[_0x464c('0x3c')][_0x464c('0x49')]){_0x29f7e9[_0x464c('0x47')]=_[_0x464c('0x4a')](_0x29f7e9[_0x464c('0x47')],{'$or':_[_0x464c('0x35')](_0x29f7e9[_0x464c('0x3f')],function(_0x484039){var _0x19c684={};_0x19c684[_0x484039]={'$like':'%'+_0x5a571e[_0x464c('0x3c')]['filter']+'%'};return _0x19c684;})});}_0x29f7e9=_[_0x464c('0x4a')]({},_0x29f7e9,_0x5a571e[_0x464c('0x4c')]);return _0x42ea32['getFields'](_0x29f7e9);}})[_0x464c('0x1b')](function(_0x1b1818){if(_0x1b1818){_0x263bc6=_0x1b1818[_0x464c('0x42')];if(!_0x5a571e[_0x464c('0x3c')][_0x464c('0x43')]('nolimit')){_0x29f7e9[_0x464c('0x2a')]=qs[_0x464c('0x2a')](_0x5a571e[_0x464c('0x3c')][_0x464c('0x2a')]);_0x29f7e9['offset']=qs[_0x464c('0x29')](_0x5a571e[_0x464c('0x3c')][_0x464c('0x29')]);}return _0x42ea32[_0x464c('0x56')](_0x29f7e9);}})[_0x464c('0x1b')](function(_0xbe5417){if(_0xbe5417){return _0xbe5417?{'count':_0x263bc6,'rows':_0xbe5417}:null;}})[_0x464c('0x1b')](respondWithResult(_0xc0da2b,null))[_0x464c('0x25')](handleError(_0xc0da2b,null));};exports[_0x464c('0x59')]=function(_0x2dc8a9,_0x36bafd,_0x5c49c4){var _0x3a283c={};var _0x516419={};var _0x33233e;var _0x41957e;return db[_0x464c('0x36')]['findOne']({'where':{'id':_0x2dc8a9['params']['id']}})['then'](handleEntityNotFound(_0x36bafd,null))[_0x464c('0x1b')](function(_0xa1f25f){if(_0xa1f25f){_0x33233e=_0xa1f25f;_0x516419[_0x464c('0x3b')]=_[_0x464c('0x3d')](db['SalesforceField'][_0x464c('0x37')]);_0x516419[_0x464c('0x3c')]=_[_0x464c('0x3d')](_0x2dc8a9['query']);_0x516419[_0x464c('0x3e')]=_[_0x464c('0x40')](_0x516419[_0x464c('0x3b')],_0x516419[_0x464c('0x3c')]);_0x3a283c[_0x464c('0x3f')]=_[_0x464c('0x40')](_0x516419[_0x464c('0x3b')],qs[_0x464c('0x41')](_0x2dc8a9[_0x464c('0x3c')][_0x464c('0x41')]));_0x3a283c['attributes']=_0x3a283c[_0x464c('0x3f')][_0x464c('0x42')]?_0x3a283c[_0x464c('0x3f')]:_0x516419['model'];_0x3a283c[_0x464c('0x45')]=qs['sort'](_0x2dc8a9[_0x464c('0x3c')][_0x464c('0x46')]);_0x3a283c[_0x464c('0x47')]=qs[_0x464c('0x3e')](_[_0x464c('0x48')](_0x2dc8a9[_0x464c('0x3c')],_0x516419[_0x464c('0x3e')]));if(_0x2dc8a9[_0x464c('0x3c')]['filter']){_0x3a283c[_0x464c('0x47')]=_[_0x464c('0x4a')](_0x3a283c['where'],{'$or':_[_0x464c('0x35')](_0x3a283c[_0x464c('0x3f')],function(_0x4ca69b){var _0x197893={};_0x197893[_0x4ca69b]={'$like':'%'+_0x2dc8a9[_0x464c('0x3c')][_0x464c('0x49')]+'%'};return _0x197893;})});}_0x3a283c=_[_0x464c('0x4a')]({},_0x3a283c,_0x2dc8a9[_0x464c('0x4c')]);return _0x33233e['getSubjects'](_0x3a283c);}})[_0x464c('0x1b')](function(_0x298c9b){if(_0x298c9b){_0x41957e=_0x298c9b[_0x464c('0x42')];if(!_0x2dc8a9[_0x464c('0x3c')][_0x464c('0x43')](_0x464c('0x44'))){_0x3a283c['limit']=qs['limit'](_0x2dc8a9[_0x464c('0x3c')][_0x464c('0x2a')]);_0x3a283c[_0x464c('0x29')]=qs[_0x464c('0x29')](_0x2dc8a9[_0x464c('0x3c')]['offset']);}return _0x33233e['getSubjects'](_0x3a283c);}})[_0x464c('0x1b')](function(_0x1c1bd4){if(_0x1c1bd4){return _0x1c1bd4?{'count':_0x41957e,'rows':_0x1c1bd4}:null;}})[_0x464c('0x1b')](respondWithResult(_0x36bafd,null))[_0x464c('0x25')](handleError(_0x36bafd,null));};exports[_0x464c('0x5a')]=function(_0x56827a,_0x3d6201,_0x3a872f){var _0x1eda00={};var _0xae9d34={};var _0x4f63dc;var _0x4a8613;return db['SalesforceConfiguration'][_0x464c('0x57')]({'where':{'id':_0x56827a[_0x464c('0x52')]['id']}})[_0x464c('0x1b')](handleEntityNotFound(_0x3d6201,null))['then'](function(_0x25ee40){if(_0x25ee40){_0x4f63dc=_0x25ee40;_0xae9d34['model']=_[_0x464c('0x3d')](db['SalesforceField'][_0x464c('0x37')]);_0xae9d34[_0x464c('0x3c')]=_['keys'](_0x56827a[_0x464c('0x3c')]);_0xae9d34[_0x464c('0x3e')]=_[_0x464c('0x40')](_0xae9d34[_0x464c('0x3b')],_0xae9d34['query']);_0x1eda00['attributes']=_[_0x464c('0x40')](_0xae9d34[_0x464c('0x3b')],qs[_0x464c('0x41')](_0x56827a[_0x464c('0x3c')][_0x464c('0x41')]));_0x1eda00['attributes']=_0x1eda00[_0x464c('0x3f')][_0x464c('0x42')]?_0x1eda00['attributes']:_0xae9d34[_0x464c('0x3b')];_0x1eda00[_0x464c('0x45')]=qs[_0x464c('0x46')](_0x56827a[_0x464c('0x3c')][_0x464c('0x46')]);_0x1eda00[_0x464c('0x47')]=qs[_0x464c('0x3e')](_[_0x464c('0x48')](_0x56827a[_0x464c('0x3c')],_0xae9d34[_0x464c('0x3e')]));if(_0x56827a[_0x464c('0x3c')]['filter']){_0x1eda00[_0x464c('0x47')]=_[_0x464c('0x4a')](_0x1eda00['where'],{'$or':_['map'](_0x1eda00[_0x464c('0x3f')],function(_0x4199f3){var _0x3d2542={};_0x3d2542[_0x4199f3]={'$like':'%'+_0x56827a['query'][_0x464c('0x49')]+'%'};return _0x3d2542;})});}_0x1eda00=_[_0x464c('0x4a')]({},_0x1eda00,_0x56827a[_0x464c('0x4c')]);return _0x4f63dc['getDescriptions'](_0x1eda00);}})['then'](function(_0x3831bd){if(_0x3831bd){_0x4a8613=_0x3831bd[_0x464c('0x42')];if(!_0x56827a[_0x464c('0x3c')]['hasOwnProperty'](_0x464c('0x44'))){_0x1eda00[_0x464c('0x2a')]=qs[_0x464c('0x2a')](_0x56827a[_0x464c('0x3c')][_0x464c('0x2a')]);_0x1eda00[_0x464c('0x29')]=qs[_0x464c('0x29')](_0x56827a[_0x464c('0x3c')][_0x464c('0x29')]);}return _0x4f63dc['getDescriptions'](_0x1eda00);}})[_0x464c('0x1b')](function(_0x3e46f4){if(_0x3e46f4){return _0x3e46f4?{'count':_0x4a8613,'rows':_0x3e46f4}:null;}})['then'](respondWithResult(_0x3d6201,null))[_0x464c('0x25')](handleError(_0x3d6201,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index dd8a040..375b1c1 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 _0xccc2=['bluebird','request-promise','path','rimraf','exports','SalesforceConfiguration','lodash','util','../../config/logger','moment'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0xccc2,0x15a));var _0x2ccc=function(_0x32e33c,_0x2c4cf7){_0x32e33c=_0x32e33c-0x0;var _0x1805a2=_0xccc2[_0x32e33c];return _0x1805a2;};'use strict';var _=require(_0x2ccc('0x0'));var util=require(_0x2ccc('0x1'));var logger=require(_0x2ccc('0x2'))('api');var moment=require(_0x2ccc('0x3'));var BPromise=require(_0x2ccc('0x4'));var rp=require(_0x2ccc('0x5'));var fs=require('fs');var path=require(_0x2ccc('0x6'));var rimraf=require(_0x2ccc('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0x2ccc('0x8')]=function(_0x3438d3,_0x3285af){return _0x3438d3['define'](_0x2ccc('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59fc=['../../config/logger','api','bluebird','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util'];(function(_0x3d309f,_0x36f85d){var _0x69d0b7=function(_0x585d40){while(--_0x585d40){_0x3d309f['push'](_0x3d309f['shift']());}};_0x69d0b7(++_0x36f85d);}(_0x59fc,0xc4));var _0xc59f=function(_0x329582,_0x3beae6){_0x329582=_0x329582-0x0;var _0x53ad22=_0x59fc[_0x329582];return _0x53ad22;};'use strict';var _=require(_0xc59f('0x0'));var util=require(_0xc59f('0x1'));var logger=require(_0xc59f('0x2'))(_0xc59f('0x3'));var moment=require('moment');var BPromise=require(_0xc59f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc59f('0x5'));var rimraf=require('rimraf');var config=require(_0xc59f('0x6'));var attributes=require(_0xc59f('0x7'));module[_0xc59f('0x8')]=function(_0xca73d7,_0x15c1a9){return _0xca73d7[_0xc59f('0x9')](_0xc59f('0xa'),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 0173020..d46e6f2 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 _0xc257=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0xc257,0x139));var _0x7c25=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xc257[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7c25('0x0'));var util=require(_0x7c25('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7c25('0x2'));var fs=require('fs');var Redis=require(_0x7c25('0x3'));var db=require(_0x7c25('0x4'))['db'];var utils=require(_0x7c25('0x5'));var logger=require(_0x7c25('0x6'))(_0x7c25('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c25('0x8'));var client=jayson[_0x7c25('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1118e9,_0x53fdfd,_0x3d6def){return new BPromise(function(_0x5e9bc2,_0x53042e){return client[_0x7c25('0xa')](_0x1118e9,_0x3d6def)['then'](function(_0x1d7742){logger[_0x7c25('0xb')](_0x7c25('0xc'),_0x53fdfd,_0x7c25('0xd'));logger[_0x7c25('0xe')](_0x7c25('0xf'),_0x53fdfd,_0x7c25('0xd'),JSON[_0x7c25('0x10')](_0x1d7742));if(_0x1d7742[_0x7c25('0x11')]){if(_0x1d7742[_0x7c25('0x11')][_0x7c25('0x12')]===0x1f4){logger[_0x7c25('0x11')](_0x7c25('0xc'),_0x53fdfd,_0x1d7742[_0x7c25('0x11')][_0x7c25('0x13')]);return _0x53042e(_0x1d7742['error'][_0x7c25('0x13')]);}logger[_0x7c25('0x11')](_0x7c25('0xc'),_0x53fdfd,_0x1d7742['error'][_0x7c25('0x13')]);return _0x5e9bc2(_0x1d7742[_0x7c25('0x11')][_0x7c25('0x13')]);}else{logger[_0x7c25('0xb')](_0x7c25('0xc'),_0x53fdfd,_0x7c25('0xd'));_0x5e9bc2(_0x1d7742['result'][_0x7c25('0x13')]);}})[_0x7c25('0x14')](function(_0x4cb192){logger[_0x7c25('0x11')](_0x7c25('0xc'),_0x53fdfd,_0x4cb192);_0x53042e(_0x4cb192);});});} \ No newline at end of file +var _0x944c=['../../config/utils','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','lodash','util','bluebird','ioredis'];(function(_0x16cfae,_0x3c3596){var _0x5a04cf=function(_0x578063){while(--_0x578063){_0x16cfae['push'](_0x16cfae['shift']());}};_0x5a04cf(++_0x3c3596);}(_0x944c,0x165));var _0xc944=function(_0x1c4279,_0x794462){_0x1c4279=_0x1c4279-0x0;var _0x180a5f=_0x944c[_0x1c4279];return _0x180a5f;};'use strict';var _=require(_0xc944('0x0'));var util=require(_0xc944('0x1'));var moment=require('moment');var BPromise=require(_0xc944('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc944('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc944('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc944('0x5')][_0xc944('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x535dc7,_0x447ee7,_0x4def1b){return new BPromise(function(_0x357356,_0x19e293){return client[_0xc944('0x7')](_0x535dc7,_0x4def1b)[_0xc944('0x8')](function(_0x4a53d1){logger[_0xc944('0x9')](_0xc944('0xa'),_0x447ee7,_0xc944('0xb'));logger[_0xc944('0xc')](_0xc944('0xd'),_0x447ee7,_0xc944('0xb'),JSON['stringify'](_0x4a53d1));if(_0x4a53d1['error']){if(_0x4a53d1[_0xc944('0xe')][_0xc944('0xf')]===0x1f4){logger[_0xc944('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x447ee7,_0x4a53d1[_0xc944('0xe')][_0xc944('0x10')]);return _0x19e293(_0x4a53d1[_0xc944('0xe')]['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x447ee7,_0x4a53d1[_0xc944('0xe')][_0xc944('0x10')]);return _0x357356(_0x4a53d1[_0xc944('0xe')]['message']);}else{logger['info'](_0xc944('0xa'),_0x447ee7,'request\x20sent');_0x357356(_0x4a53d1[_0xc944('0x11')][_0xc944('0x10')]);}})[_0xc944('0x12')](function(_0x3c92ee){logger[_0xc944('0xe')](_0xc944('0xa'),_0x447ee7,_0x3c92ee);_0x19e293(_0x3c92ee);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 5f431c6..e3e4944 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 _0x1db9=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','post','put','update','delete','multer'];(function(_0x13377d,_0x11ee44){var _0x3efbbb=function(_0x2492db){while(--_0x2492db){_0x13377d['push'](_0x13377d['shift']());}};_0x3efbbb(++_0x11ee44);}(_0x1db9,0x176));var _0x91db=function(_0x168aa9,_0x52310a){_0x168aa9=_0x168aa9-0x0;var _0x1c0f17=_0x1db9[_0x168aa9];return _0x1c0f17;};'use strict';var multer=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var path=require(_0x91db('0x2'));var timeout=require(_0x91db('0x3'));var express=require(_0x91db('0x4'));var router=express[_0x91db('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x91db('0x6'));var config=require(_0x91db('0x7'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x91db('0x8')](),controller['index']);router['get'](_0x91db('0x9'),auth[_0x91db('0x8')](),controller[_0x91db('0xa')]);router[_0x91db('0xb')]('/',auth[_0x91db('0x8')](),controller['create']);router[_0x91db('0xc')]('/:id',auth[_0x91db('0x8')](),controller[_0x91db('0xd')]);router[_0x91db('0xe')]('/:id',auth[_0x91db('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2675=['post','put','update','delete','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x52b590,_0x4f1e7b){var _0x534d90=function(_0x3ae5ad){while(--_0x3ae5ad){_0x52b590['push'](_0x52b590['shift']());}};_0x534d90(++_0x4f1e7b);}(_0x2675,0x75));var _0x5267=function(_0x1ea239,_0x37ea0b){_0x1ea239=_0x1ea239-0x0;var _0x41567c=_0x2675[_0x1ea239];return _0x41567c;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./intSalesforceField.controller');router[_0x5267('0x5')]('/',auth[_0x5267('0x6')](),controller[_0x5267('0x7')]);router[_0x5267('0x5')](_0x5267('0x8'),auth[_0x5267('0x6')](),controller['show']);router[_0x5267('0x9')]('/',auth[_0x5267('0x6')](),controller['create']);router[_0x5267('0xa')]('/:id',auth[_0x5267('0x6')](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x6')](),controller['destroy']);module[_0x5267('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 753fb14..37ef287 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 _0xfc1a=['exports','string','variable','customVariable','keyValue','STRING','ENUM','sequelize'];(function(_0x24a25e,_0xf4baa7){var _0x40b82e=function(_0x47d222){while(--_0x47d222){_0x24a25e['push'](_0x24a25e['shift']());}};_0x40b82e(++_0xf4baa7);}(_0xfc1a,0x1c7));var _0xafc1=function(_0x17a42c,_0x4caf6){_0x17a42c=_0x17a42c-0x0;var _0x55add4=_0xfc1a[_0x17a42c];return _0x55add4;};'use strict';var Sequelize=require(_0xafc1('0x0'));module[_0xafc1('0x1')]={'type':{'type':Sequelize['ENUM'](_0xafc1('0x2'),_0xafc1('0x3'),_0xafc1('0x4'),_0xafc1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xafc1('0x6')]},'keyType':{'type':Sequelize[_0xafc1('0x7')](_0xafc1('0x2'),'variable',_0xafc1('0x4'))},'keyContent':{'type':Sequelize[_0xafc1('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xafc1('0x6')]}}; \ No newline at end of file +var _0x00de=['STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x359df1,_0x2d8360){var _0x47cba8=function(_0x484697){while(--_0x484697){_0x359df1['push'](_0x359df1['shift']());}};_0x47cba8(++_0x2d8360);}(_0x00de,0x14a));var _0xe00d=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x00de[_0x2605dc];return _0x4568c9;};'use strict';var Sequelize=require(_0xe00d('0x0'));module[_0xe00d('0x1')]={'type':{'type':Sequelize[_0xe00d('0x2')](_0xe00d('0x3'),_0xe00d('0x4'),_0xe00d('0x5'),'keyValue'),'defaultValue':_0xe00d('0x3')},'content':{'type':Sequelize[_0xe00d('0x6')]},'key':{'type':Sequelize[_0xe00d('0x6')]},'keyType':{'type':Sequelize[_0xe00d('0x2')](_0xe00d('0x3'),'variable',_0xe00d('0x5'))},'keyContent':{'type':Sequelize[_0xe00d('0x6')]},'idField':{'type':Sequelize[_0xe00d('0x6')]},'variableName':{'type':Sequelize[_0xe00d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index c70fb91..56b0f48 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 _0x0cc7=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filters','pick','where','merge','map','VIRTUAL','options','SalesforceField','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3a3651,_0x49d43b){var _0x491909=function(_0x4a2635){while(--_0x4a2635){_0x3a3651['push'](_0x3a3651['shift']());}};_0x491909(++_0x49d43b);}(_0x0cc7,0x1f1));var _0x70cc=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x0cc7[_0x455c6c];return _0x488242;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70cc('0x0'));var rimraf=require(_0x70cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70cc('0x2'));var rp=require(_0x70cc('0x3'));var moment=require(_0x70cc('0x4'));var BPromise=require(_0x70cc('0x5'));var Mustache=require(_0x70cc('0x6'));var util=require(_0x70cc('0x7'));var path=require('path');var sox=require(_0x70cc('0x8'));var csv=require(_0x70cc('0x9'));var ejs=require(_0x70cc('0xa'));var fs=require('fs');var _=require(_0x70cc('0xb'));var squel=require(_0x70cc('0xc'));var crypto=require(_0x70cc('0xd'));var jsforce=require(_0x70cc('0xe'));var deskjs=require(_0x70cc('0xf'));var toCsv=require(_0x70cc('0x9'));var querystring=require(_0x70cc('0x10'));var Papa=require(_0x70cc('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x70cc('0x12'));var as=require(_0x70cc('0x13'));var hardwareService=require(_0x70cc('0x14'));var logger=require(_0x70cc('0x15'))(_0x70cc('0x16'));var utils=require(_0x70cc('0x17'));var config=require('../../config/environment');var db=require(_0x70cc('0x18'))['db'];function respondWithStatusCode(_0xb90fb4,_0x4cb708){_0x4cb708=_0x4cb708||0xcc;return function(_0x5e2437){if(_0x5e2437){return _0xb90fb4['sendStatus'](_0x4cb708);}return _0xb90fb4[_0x70cc('0x19')](_0x4cb708)['end']();};}function respondWithResult(_0x20dfd3,_0x530d5b){_0x530d5b=_0x530d5b||0xc8;return function(_0x591f1e){if(_0x591f1e){return _0x20dfd3[_0x70cc('0x19')](_0x530d5b)[_0x70cc('0x1a')](_0x591f1e);}};}function respondWithFilteredResult(_0x2f6100,_0x52cd09){return function(_0x4c47c7){if(_0x4c47c7){var _0x4273e9=_0x4c47c7[_0x70cc('0x1b')],_0x265c64=_0x52cd09[_0x70cc('0x1c')],_0x1244c0=_0x52cd09[_0x70cc('0x1c')]+_0x52cd09['limit'],_0xddf746;if(_0x1244c0>=_0x4273e9){_0x1244c0=_0x4273e9;_0xddf746=0xc8;}else{_0xddf746=0xce;}_0x2f6100[_0x70cc('0x19')](_0xddf746);return _0x2f6100[_0x70cc('0x1d')](_0x70cc('0x1e'),_0x265c64+'-'+_0x1244c0+'/'+_0x4273e9)['json'](_0x4c47c7);}return null;};}function patchUpdates(_0x4134b1){return function(_0x2c6d64){try{jsonpatch[_0x70cc('0x1f')](_0x2c6d64,_0x4134b1,!![]);}catch(_0x3cadc9){return BPromise[_0x70cc('0x20')](_0x3cadc9);}return _0x2c6d64[_0x70cc('0x21')]();};}function saveUpdates(_0x30ecaa,_0x165cee){return function(_0x57a34e){if(_0x57a34e){return _0x57a34e[_0x70cc('0x22')](_0x30ecaa)[_0x70cc('0x23')](function(_0x542bd8){return _0x542bd8;});}return null;};}function removeEntity(_0x41ad02,_0x2c6fad){return function(_0x1f9444){if(_0x1f9444){return _0x1f9444[_0x70cc('0x24')]()[_0x70cc('0x23')](function(){_0x41ad02[_0x70cc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b4b92,_0x4454e7){return function(_0x316676){if(!_0x316676){_0x5b4b92[_0x70cc('0x25')](0x194);}return _0x316676;};}function handleError(_0x522f92,_0x4e6279){_0x4e6279=_0x4e6279||0x1f4;return function(_0x4de093){logger['error'](_0x4de093[_0x70cc('0x26')]);if(_0x4de093[_0x70cc('0x27')]){delete _0x4de093[_0x70cc('0x27')];}_0x522f92[_0x70cc('0x19')](_0x4e6279)[_0x70cc('0x28')](_0x4de093);};}exports['index']=function(_0x2881ec,_0x2e4171){var _0x18262a={},_0x2f39f0={},_0x52483a={'count':0x0,'rows':[]};var _0x5f0707=_['map'](db['SalesforceField'][_0x70cc('0x29')],function(_0x1348ed){return{'name':_0x1348ed['fieldName'],'type':_0x1348ed[_0x70cc('0x2a')][_0x70cc('0x2b')]};});_0x2f39f0[_0x70cc('0x2c')]=_['map'](_0x5f0707,_0x70cc('0x27'));_0x2f39f0[_0x70cc('0x2d')]=_[_0x70cc('0x2e')](_0x2881ec[_0x70cc('0x2d')]);_0x2f39f0['filters']=_['intersection'](_0x2f39f0['model'],_0x2f39f0[_0x70cc('0x2d')]);_0x18262a[_0x70cc('0x2f')]=_[_0x70cc('0x30')](_0x2f39f0[_0x70cc('0x2c')],qs[_0x70cc('0x31')](_0x2881ec[_0x70cc('0x2d')][_0x70cc('0x31')]));_0x18262a[_0x70cc('0x2f')]=_0x18262a[_0x70cc('0x2f')][_0x70cc('0x32')]?_0x18262a[_0x70cc('0x2f')]:_0x2f39f0[_0x70cc('0x2c')];if(!_0x2881ec[_0x70cc('0x2d')][_0x70cc('0x33')]('nolimit')){_0x18262a[_0x70cc('0x34')]=qs[_0x70cc('0x34')](_0x2881ec[_0x70cc('0x2d')][_0x70cc('0x34')]);_0x18262a['offset']=qs[_0x70cc('0x1c')](_0x2881ec[_0x70cc('0x2d')]['offset']);}_0x18262a[_0x70cc('0x35')]=qs['sort'](_0x2881ec[_0x70cc('0x2d')][_0x70cc('0x36')]);_0x18262a['where']=qs[_0x70cc('0x37')](_[_0x70cc('0x38')](_0x2881ec[_0x70cc('0x2d')],_0x2f39f0[_0x70cc('0x37')]),_0x5f0707);if(_0x2881ec['query']['filter']){_0x18262a[_0x70cc('0x39')]=_[_0x70cc('0x3a')](_0x18262a[_0x70cc('0x39')],{'$or':_[_0x70cc('0x3b')](_0x5f0707,function(_0x2a4296){if(_0x2a4296[_0x70cc('0x2a')]!==_0x70cc('0x3c')){var _0x4cdb07={};_0x4cdb07[_0x2a4296[_0x70cc('0x27')]]={'$like':'%'+_0x2881ec['query']['filter']+'%'};return _0x4cdb07;}})});}_0x18262a=_[_0x70cc('0x3a')]({},_0x18262a,_0x2881ec[_0x70cc('0x3d')]);var _0x5f952b={'where':_0x18262a[_0x70cc('0x39')]};return db[_0x70cc('0x3e')][_0x70cc('0x1b')](_0x5f952b)[_0x70cc('0x23')](function(_0xd0f397){_0x52483a['count']=_0xd0f397;if(_0x2881ec[_0x70cc('0x2d')]['includeAll']){_0x18262a[_0x70cc('0x3f')]=[{'all':!![]}];}return db[_0x70cc('0x3e')][_0x70cc('0x40')](_0x18262a);})[_0x70cc('0x23')](function(_0x44b563){_0x52483a[_0x70cc('0x41')]=_0x44b563;return _0x52483a;})[_0x70cc('0x23')](respondWithFilteredResult(_0x2e4171,_0x18262a))[_0x70cc('0x42')](handleError(_0x2e4171,null));};exports['show']=function(_0x4d34eb,_0x27d434){var _0x51584d={'raw':!![],'where':{'id':_0x4d34eb[_0x70cc('0x43')]['id']}},_0x45c021={};_0x45c021[_0x70cc('0x2c')]=_['keys'](db[_0x70cc('0x3e')][_0x70cc('0x29')]);_0x45c021[_0x70cc('0x2d')]=_[_0x70cc('0x2e')](_0x4d34eb[_0x70cc('0x2d')]);_0x45c021['filters']=_[_0x70cc('0x30')](_0x45c021[_0x70cc('0x2c')],_0x45c021[_0x70cc('0x2d')]);_0x51584d[_0x70cc('0x2f')]=_[_0x70cc('0x30')](_0x45c021[_0x70cc('0x2c')],qs['fields'](_0x4d34eb['query']['fields']));_0x51584d['attributes']=_0x51584d[_0x70cc('0x2f')]['length']?_0x51584d[_0x70cc('0x2f')]:_0x45c021[_0x70cc('0x2c')];if(_0x4d34eb[_0x70cc('0x2d')][_0x70cc('0x44')]){_0x51584d[_0x70cc('0x3f')]=[{'all':!![]}];}_0x51584d=_['merge']({},_0x51584d,_0x4d34eb[_0x70cc('0x3d')]);return db[_0x70cc('0x3e')][_0x70cc('0x45')](_0x51584d)['then'](handleEntityNotFound(_0x27d434,null))['then'](respondWithResult(_0x27d434,null))['catch'](handleError(_0x27d434,null));};exports[_0x70cc('0x46')]=function(_0x3639ba,_0x4d40d5){return db[_0x70cc('0x3e')][_0x70cc('0x46')](_0x3639ba[_0x70cc('0x47')],{})[_0x70cc('0x23')](respondWithResult(_0x4d40d5,0xc9))['catch'](handleError(_0x4d40d5,null));};exports['update']=function(_0x6e2c28,_0x560cb4){if(_0x6e2c28[_0x70cc('0x47')]['id']){delete _0x6e2c28[_0x70cc('0x47')]['id'];}return db['SalesforceField'][_0x70cc('0x45')]({'where':{'id':_0x6e2c28[_0x70cc('0x43')]['id']}})[_0x70cc('0x23')](handleEntityNotFound(_0x560cb4,null))[_0x70cc('0x23')](saveUpdates(_0x6e2c28[_0x70cc('0x47')],null))[_0x70cc('0x23')](respondWithResult(_0x560cb4,null))[_0x70cc('0x42')](handleError(_0x560cb4,null));};exports['destroy']=function(_0x489f5a,_0x551bbe){return db[_0x70cc('0x3e')]['find']({'where':{'id':_0x489f5a[_0x70cc('0x43')]['id']}})['then'](handleEntityNotFound(_0x551bbe,null))[_0x70cc('0x23')](removeEntity(_0x551bbe,null))[_0x70cc('0x42')](handleError(_0x551bbe,null));}; \ No newline at end of file +var _0xa9ef=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','end','sendStatus','error','stack','name','send','map','SalesforceField','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4092f7,_0xeeac3c){var _0x1e3948=function(_0x2c8fcb){while(--_0x2c8fcb){_0x4092f7['push'](_0x4092f7['shift']());}};_0x1e3948(++_0xeeac3c);}(_0xa9ef,0x115));var _0xfa9e=function(_0xc36b34,_0x3b83db){_0xc36b34=_0xc36b34-0x0;var _0x38cdea=_0xa9ef[_0xc36b34];return _0x38cdea;};'use strict';var pdf=require(_0xfa9e('0x0'));var emlformat=require(_0xfa9e('0x1'));var rimraf=require(_0xfa9e('0x2'));var zipdir=require(_0xfa9e('0x3'));var jsonpatch=require(_0xfa9e('0x4'));var rp=require(_0xfa9e('0x5'));var moment=require('moment');var BPromise=require(_0xfa9e('0x6'));var Mustache=require(_0xfa9e('0x7'));var util=require('util');var path=require(_0xfa9e('0x8'));var sox=require('sox');var csv=require(_0xfa9e('0x9'));var ejs=require(_0xfa9e('0xa'));var fs=require('fs');var _=require(_0xfa9e('0xb'));var squel=require(_0xfa9e('0xc'));var crypto=require(_0xfa9e('0xd'));var jsforce=require(_0xfa9e('0xe'));var deskjs=require(_0xfa9e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfa9e('0x10'));var Papa=require(_0xfa9e('0x11'));var Redis=require(_0xfa9e('0x12'));var authService=require(_0xfa9e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfa9e('0x14'));var hardwareService=require(_0xfa9e('0x15'));var logger=require(_0xfa9e('0x16'))(_0xfa9e('0x17'));var utils=require(_0xfa9e('0x18'));var config=require(_0xfa9e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e9ffd,_0xcf5876){_0xcf5876=_0xcf5876||0xcc;return function(_0x3770b1){if(_0x3770b1){return _0x4e9ffd['sendStatus'](_0xcf5876);}return _0x4e9ffd[_0xfa9e('0x1a')](_0xcf5876)['end']();};}function respondWithResult(_0x3a56c9,_0x4d0943){_0x4d0943=_0x4d0943||0xc8;return function(_0xeafdaa){if(_0xeafdaa){return _0x3a56c9[_0xfa9e('0x1a')](_0x4d0943)['json'](_0xeafdaa);}};}function respondWithFilteredResult(_0x3281a5,_0xac4650){return function(_0x20ec00){if(_0x20ec00){var _0x3472ea=_0x20ec00[_0xfa9e('0x1b')],_0x30f942=_0xac4650['offset'],_0x38f5d9=_0xac4650[_0xfa9e('0x1c')]+_0xac4650[_0xfa9e('0x1d')],_0x24be1d;if(_0x38f5d9>=_0x3472ea){_0x38f5d9=_0x3472ea;_0x24be1d=0xc8;}else{_0x24be1d=0xce;}_0x3281a5[_0xfa9e('0x1a')](_0x24be1d);return _0x3281a5[_0xfa9e('0x1e')](_0xfa9e('0x1f'),_0x30f942+'-'+_0x38f5d9+'/'+_0x3472ea)[_0xfa9e('0x20')](_0x20ec00);}return null;};}function patchUpdates(_0x560c09){return function(_0x38e4d4){try{jsonpatch[_0xfa9e('0x21')](_0x38e4d4,_0x560c09,!![]);}catch(_0x52c7ce){return BPromise[_0xfa9e('0x22')](_0x52c7ce);}return _0x38e4d4['save']();};}function saveUpdates(_0x29e522,_0x5b5878){return function(_0x37284d){if(_0x37284d){return _0x37284d[_0xfa9e('0x23')](_0x29e522)[_0xfa9e('0x24')](function(_0x51d730){return _0x51d730;});}return null;};}function removeEntity(_0x30bd31,_0x4b479c){return function(_0x72b053){if(_0x72b053){return _0x72b053['destroy']()[_0xfa9e('0x24')](function(){_0x30bd31[_0xfa9e('0x1a')](0xcc)[_0xfa9e('0x25')]();});}};}function handleEntityNotFound(_0xfde205,_0x18068e){return function(_0x490d28){if(!_0x490d28){_0xfde205[_0xfa9e('0x26')](0x194);}return _0x490d28;};}function handleError(_0x565c14,_0x12c64e){_0x12c64e=_0x12c64e||0x1f4;return function(_0x3620b0){logger[_0xfa9e('0x27')](_0x3620b0[_0xfa9e('0x28')]);if(_0x3620b0[_0xfa9e('0x29')]){delete _0x3620b0[_0xfa9e('0x29')];}_0x565c14[_0xfa9e('0x1a')](_0x12c64e)[_0xfa9e('0x2a')](_0x3620b0);};}exports['index']=function(_0x361d6e,_0x1d1c38){var _0xf898e={},_0x5e1b88={},_0x567a29={'count':0x0,'rows':[]};var _0x5dc4a7=_[_0xfa9e('0x2b')](db[_0xfa9e('0x2c')]['rawAttributes'],function(_0x30a2f3){return{'name':_0x30a2f3['fieldName'],'type':_0x30a2f3[_0xfa9e('0x2d')][_0xfa9e('0x2e')]};});_0x5e1b88[_0xfa9e('0x2f')]=_[_0xfa9e('0x2b')](_0x5dc4a7,'name');_0x5e1b88[_0xfa9e('0x30')]=_[_0xfa9e('0x31')](_0x361d6e[_0xfa9e('0x30')]);_0x5e1b88[_0xfa9e('0x32')]=_[_0xfa9e('0x33')](_0x5e1b88['model'],_0x5e1b88['query']);_0xf898e['attributes']=_['intersection'](_0x5e1b88[_0xfa9e('0x2f')],qs[_0xfa9e('0x34')](_0x361d6e[_0xfa9e('0x30')][_0xfa9e('0x34')]));_0xf898e[_0xfa9e('0x35')]=_0xf898e[_0xfa9e('0x35')][_0xfa9e('0x36')]?_0xf898e['attributes']:_0x5e1b88['model'];if(!_0x361d6e[_0xfa9e('0x30')][_0xfa9e('0x37')]('nolimit')){_0xf898e['limit']=qs[_0xfa9e('0x1d')](_0x361d6e[_0xfa9e('0x30')][_0xfa9e('0x1d')]);_0xf898e['offset']=qs[_0xfa9e('0x1c')](_0x361d6e[_0xfa9e('0x30')][_0xfa9e('0x1c')]);}_0xf898e['order']=qs[_0xfa9e('0x38')](_0x361d6e[_0xfa9e('0x30')][_0xfa9e('0x38')]);_0xf898e[_0xfa9e('0x39')]=qs[_0xfa9e('0x32')](_[_0xfa9e('0x3a')](_0x361d6e['query'],_0x5e1b88[_0xfa9e('0x32')]),_0x5dc4a7);if(_0x361d6e['query']['filter']){_0xf898e[_0xfa9e('0x39')]=_[_0xfa9e('0x3b')](_0xf898e['where'],{'$or':_[_0xfa9e('0x2b')](_0x5dc4a7,function(_0x3399aa){if(_0x3399aa[_0xfa9e('0x2d')]!==_0xfa9e('0x3c')){var _0x4b86c1={};_0x4b86c1[_0x3399aa['name']]={'$like':'%'+_0x361d6e[_0xfa9e('0x30')][_0xfa9e('0x3d')]+'%'};return _0x4b86c1;}})});}_0xf898e=_[_0xfa9e('0x3b')]({},_0xf898e,_0x361d6e[_0xfa9e('0x3e')]);var _0x25088c={'where':_0xf898e[_0xfa9e('0x39')]};return db['SalesforceField']['count'](_0x25088c)['then'](function(_0x164f62){_0x567a29[_0xfa9e('0x1b')]=_0x164f62;if(_0x361d6e[_0xfa9e('0x30')]['includeAll']){_0xf898e[_0xfa9e('0x3f')]=[{'all':!![]}];}return db[_0xfa9e('0x2c')][_0xfa9e('0x40')](_0xf898e);})['then'](function(_0x49892a){_0x567a29[_0xfa9e('0x41')]=_0x49892a;return _0x567a29;})[_0xfa9e('0x24')](respondWithFilteredResult(_0x1d1c38,_0xf898e))['catch'](handleError(_0x1d1c38,null));};exports[_0xfa9e('0x42')]=function(_0x58f1ab,_0x4a6019){var _0x1cf9b9={'raw':!![],'where':{'id':_0x58f1ab['params']['id']}},_0x21946c={};_0x21946c[_0xfa9e('0x2f')]=_[_0xfa9e('0x31')](db['SalesforceField'][_0xfa9e('0x43')]);_0x21946c[_0xfa9e('0x30')]=_[_0xfa9e('0x31')](_0x58f1ab[_0xfa9e('0x30')]);_0x21946c[_0xfa9e('0x32')]=_['intersection'](_0x21946c['model'],_0x21946c[_0xfa9e('0x30')]);_0x1cf9b9[_0xfa9e('0x35')]=_[_0xfa9e('0x33')](_0x21946c[_0xfa9e('0x2f')],qs[_0xfa9e('0x34')](_0x58f1ab[_0xfa9e('0x30')]['fields']));_0x1cf9b9[_0xfa9e('0x35')]=_0x1cf9b9[_0xfa9e('0x35')][_0xfa9e('0x36')]?_0x1cf9b9['attributes']:_0x21946c['model'];if(_0x58f1ab[_0xfa9e('0x30')]['includeAll']){_0x1cf9b9['include']=[{'all':!![]}];}_0x1cf9b9=_[_0xfa9e('0x3b')]({},_0x1cf9b9,_0x58f1ab['options']);return db[_0xfa9e('0x2c')][_0xfa9e('0x44')](_0x1cf9b9)[_0xfa9e('0x24')](handleEntityNotFound(_0x4a6019,null))[_0xfa9e('0x24')](respondWithResult(_0x4a6019,null))[_0xfa9e('0x45')](handleError(_0x4a6019,null));};exports[_0xfa9e('0x46')]=function(_0x5e5a1c,_0x2bfa9a){return db[_0xfa9e('0x2c')][_0xfa9e('0x46')](_0x5e5a1c[_0xfa9e('0x47')],{})[_0xfa9e('0x24')](respondWithResult(_0x2bfa9a,0xc9))['catch'](handleError(_0x2bfa9a,null));};exports[_0xfa9e('0x23')]=function(_0x386109,_0x2a08a1){if(_0x386109['body']['id']){delete _0x386109['body']['id'];}return db[_0xfa9e('0x2c')][_0xfa9e('0x44')]({'where':{'id':_0x386109[_0xfa9e('0x48')]['id']}})[_0xfa9e('0x24')](handleEntityNotFound(_0x2a08a1,null))[_0xfa9e('0x24')](saveUpdates(_0x386109['body'],null))[_0xfa9e('0x24')](respondWithResult(_0x2a08a1,null))[_0xfa9e('0x45')](handleError(_0x2a08a1,null));};exports[_0xfa9e('0x49')]=function(_0x30abae,_0x211dbb){return db['SalesforceField']['find']({'where':{'id':_0x30abae[_0xfa9e('0x48')]['id']}})[_0xfa9e('0x24')](handleEntityNotFound(_0x211dbb,null))['then'](removeEntity(_0x211dbb,null))[_0xfa9e('0x45')](handleError(_0x211dbb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index eb6e853..9b46bb4 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 _0x809d=['int_salesforce_fields','salesforce_unique_index','FieldId','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x5b3f70,_0x55e4ae){var _0x5debe0=function(_0x45a565){while(--_0x45a565){_0x5b3f70['push'](_0x5b3f70['shift']());}};_0x5debe0(++_0x55e4ae);}(_0x809d,0xc1));var _0xd809=function(_0x4d5ce2,_0x1fb600){_0x4d5ce2=_0x4d5ce2-0x0;var _0xacdd51=_0x809d[_0x4d5ce2];return _0xacdd51;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd809('0x0'));var moment=require(_0xd809('0x1'));var BPromise=require(_0xd809('0x2'));var rp=require(_0xd809('0x3'));var fs=require('fs');var path=require(_0xd809('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xd809('0x5')]=function(_0x1ea87e,_0x18809f){return _0x1ea87e[_0xd809('0x6')]('SalesforceField',attributes,{'tableName':_0xd809('0x7'),'paranoid':![],'indexes':[{'name':_0xd809('0x8'),'fields':['idField',_0xd809('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c0a=['rimraf','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5e410d,_0x4eaf38){var _0xa97676=function(_0x18d8c8){while(--_0x18d8c8){_0x5e410d['push'](_0x5e410d['shift']());}};_0xa97676(++_0x4eaf38);}(_0x1c0a,0x14a));var _0xa1c0=function(_0x33b360,_0x267689){_0x33b360=_0x33b360-0x0;var _0x4efb04=_0x1c0a[_0x33b360];return _0x4efb04;};'use strict';var _=require('lodash');var util=require(_0xa1c0('0x0'));var logger=require(_0xa1c0('0x1'))(_0xa1c0('0x2'));var moment=require(_0xa1c0('0x3'));var BPromise=require('bluebird');var rp=require(_0xa1c0('0x4'));var fs=require('fs');var path=require(_0xa1c0('0x5'));var rimraf=require(_0xa1c0('0x6'));var config=require('../../config/environment');var attributes=require(_0xa1c0('0x7'));module[_0xa1c0('0x8')]=function(_0x175a0b,_0x16010c){return _0x175a0b['define'](_0xa1c0('0x9'),attributes,{'tableName':_0xa1c0('0xa'),'paranoid':![],'indexes':[{'name':_0xa1c0('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index f34fe39..d690a8f 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x315a9f,_0x544301){var _0x2fbf6b=function(_0x25f776){while(--_0x25f776){_0x315a9f['push'](_0x315a9f['shift']());}};_0x2fbf6b(++_0x544301);}(_0xb43b,0x1b2));var _0xbb43=function(_0x314677,_0x597fc4){_0x314677=_0x314677-0x0;var _0x4bd44f=_0xb43b[_0x314677];return _0x4bd44f;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xa9e0=['http','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\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(_0x53cb3d,_0x294d42){var _0x59d93d=function(_0x26fea2){while(--_0x26fea2){_0x53cb3d['push'](_0x53cb3d['shift']());}};_0x59d93d(++_0x294d42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2586cea..3072f64 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 _0x9901=['/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9901,0x15e));var _0x1990=function(_0x5533b1,_0x7f4a9a){_0x5533b1=_0x5533b1-0x0;var _0x1009f3=_0x9901[_0x5533b1];return _0x1009f3;};'use strict';var multer=require('multer');var util=require(_0x1990('0x0'));var path=require('path');var timeout=require(_0x1990('0x1'));var express=require(_0x1990('0x2'));var router=express[_0x1990('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1990('0x4'));var config=require(_0x1990('0x5'));var controller=require(_0x1990('0x6'));router[_0x1990('0x7')]('/',auth[_0x1990('0x8')](),controller[_0x1990('0x9')]);router[_0x1990('0x7')](_0x1990('0xa'),auth[_0x1990('0x8')](),controller[_0x1990('0xb')]);router[_0x1990('0x7')]('/:id/configurations',auth[_0x1990('0x8')](),controller[_0x1990('0xc')]);router[_0x1990('0x7')](_0x1990('0xd'),auth[_0x1990('0x8')](),controller[_0x1990('0xe')]);router[_0x1990('0xf')]('/',auth[_0x1990('0x8')](),controller[_0x1990('0x10')]);router[_0x1990('0xf')](_0x1990('0x11'),auth[_0x1990('0x8')](),controller['addConfiguration']);router[_0x1990('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1990('0x13')]);router['delete'](_0x1990('0xa'),auth[_0x1990('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbf07=['/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','get'];(function(_0xd930de,_0x54758f){var _0x7c3f92=function(_0x1e02f1){while(--_0x1e02f1){_0xd930de['push'](_0xd930de['shift']());}};_0x7c3f92(++_0x54758f);}(_0xbf07,0x77));var _0x7bf0=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0xbf07[_0xa45395];return _0x3c83d2;};'use strict';var multer=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var path=require(_0x7bf0('0x2'));var timeout=require(_0x7bf0('0x3'));var express=require('express');var router=express[_0x7bf0('0x4')]();var auth=require(_0x7bf0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0x7bf0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7bf0('0x7'),auth['isAuthenticated'](),controller[_0x7bf0('0x8')]);router['get'](_0x7bf0('0x9'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0xb')]);router[_0x7bf0('0x6')](_0x7bf0('0xc'),auth[_0x7bf0('0xa')](),controller['getFields']);router[_0x7bf0('0xd')]('/',auth['isAuthenticated'](),controller[_0x7bf0('0xe')]);router[_0x7bf0('0xd')](_0x7bf0('0x9'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0xf')]);router[_0x7bf0('0x10')](_0x7bf0('0x7'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x11')]);router[_0x7bf0('0x12')](_0x7bf0('0x7'),auth[_0x7bf0('0xa')](),controller[_0x7bf0('0x13')]);module[_0x7bf0('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 f9979e8..d54adf6 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 _0xbfdc=['exports','STRING','username','remoteUri','sequelize'];(function(_0x13f70f,_0x50d0d5){var _0x1d7ba6=function(_0x58ab6c){while(--_0x58ab6c){_0x13f70f['push'](_0x13f70f['shift']());}};_0x1d7ba6(++_0x50d0d5);}(_0xbfdc,0x8b));var _0xcbfd=function(_0x503faf,_0x563c4c){_0x503faf=_0x503faf-0x0;var _0x3ea0a8=_0xbfdc[_0x503faf];return _0x3ea0a8;};'use strict';var Sequelize=require(_0xcbfd('0x0'));module[_0xcbfd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcbfd('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xcbfd('0x3')},'password':{'type':Sequelize[_0xcbfd('0x2')]},'email':{'type':Sequelize[_0xcbfd('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcbfd('0x4')},'serverUrl':{'type':Sequelize[_0xcbfd('0x2')]}}; \ No newline at end of file +var _0x6af8=['username','exports','STRING'];(function(_0x24cad0,_0x57372c){var _0x2fb1d5=function(_0x55d743){while(--_0x55d743){_0x24cad0['push'](_0x24cad0['shift']());}};_0x2fb1d5(++_0x57372c);}(_0x6af8,0x148));var _0x86af=function(_0x32c0bd,_0x5c5557){_0x32c0bd=_0x32c0bd-0x0;var _0x30fed4=_0x6af8[_0x32c0bd];return _0x30fed4;};'use strict';var Sequelize=require('sequelize');module[_0x86af('0x0')]={'name':{'type':Sequelize[_0x86af('0x1')]},'description':{'type':Sequelize[_0x86af('0x1')]},'username':{'type':Sequelize[_0x86af('0x1')],'unique':_0x86af('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x86af('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index cdce096..82438b9 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 _0xb8b3=['../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','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~!@#$%^&-_=+[{]}.','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','count','offset','limit','apply','reject','update','destroy','then','sendStatus','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','keys','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','merge','options','create','body','find','params','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','parent','made_sla','watch_list','upon_reject','sys_updated_on','child_incidents','number','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','notify','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','send','Wrong\x20credentials','boolean','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc64699,_0x1b3076){var _0x40732e=function(_0x23d369){while(--_0x23d369){_0xc64699['push'](_0xc64699['shift']());}};_0x40732e(++_0x1b3076);}(_0xb8b3,0xb3));var _0x3b8b=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0xb8b3[_0x459b74];return _0x46cb16;};'use strict';var pdf=require(_0x3b8b('0x0'));var emlformat=require(_0x3b8b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3b8b('0x2'));var jsonpatch=require(_0x3b8b('0x3'));var rp=require(_0x3b8b('0x4'));var moment=require(_0x3b8b('0x5'));var BPromise=require(_0x3b8b('0x6'));var Mustache=require(_0x3b8b('0x7'));var util=require(_0x3b8b('0x8'));var path=require(_0x3b8b('0x9'));var sox=require(_0x3b8b('0xa'));var csv=require(_0x3b8b('0xb'));var ejs=require(_0x3b8b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b8b('0xd'));var jsforce=require(_0x3b8b('0xe'));var deskjs=require(_0x3b8b('0xf'));var toCsv=require(_0x3b8b('0xb'));var querystring=require('querystring');var Papa=require(_0x3b8b('0x10'));var Redis=require(_0x3b8b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3b8b('0x12'));var as=require(_0x3b8b('0x13'));var hardwareService=require(_0x3b8b('0x14'));var logger=require(_0x3b8b('0x15'))(_0x3b8b('0x16'));var utils=require(_0x3b8b('0x17'));var config=require('../../config/environment');var db=require(_0x3b8b('0x18'))['db'];var integrations=require(_0x3b8b('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x3b8b('0x1a')][_0x3b8b('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x30adfe,_0x2a0fd2,_0x33f5d1){if(_0x33f5d1){var _0x4ee313=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ee313[_0x3b8b('0x1c')](_0x2a0fd2)){return _0x30adfe;}else{throw new db[(_0x3b8b('0x1d'))][(_0x3b8b('0x1e'))](_0x3b8b('0x1f'));}}else{return _0x30adfe;}}function respondWithRpcPromise(_0x144ad9,_0x20516d,_0x573e69,_0x442560){return new BPromise(function(_0x2fc3e9,_0x280fb3){var _0x3d26b9=_0x442560||client;return _0x3d26b9[_0x3b8b('0x20')](_0x144ad9,_0x573e69)['then'](function(_0x2c1710){logger[_0x3b8b('0x21')](_0x3b8b('0x22'),_0x20516d,_0x3b8b('0x23'));logger['debug'](_0x3b8b('0x24'),_0x20516d,_0x3b8b('0x23'),JSON[_0x3b8b('0x25')](_0x2c1710));if(_0x2c1710[_0x3b8b('0x26')]){if(_0x2c1710[_0x3b8b('0x26')][_0x3b8b('0x27')]===0x1f4){logger[_0x3b8b('0x26')](_0x3b8b('0x22'),_0x20516d,_0x2c1710['error'][_0x3b8b('0x28')]);return _0x280fb3(_0x2c1710['error'][_0x3b8b('0x28')]);}logger[_0x3b8b('0x26')](_0x3b8b('0x22'),_0x20516d,_0x2c1710[_0x3b8b('0x26')][_0x3b8b('0x28')]);return _0x2fc3e9(_0x2c1710[_0x3b8b('0x26')]['message']);}else{logger[_0x3b8b('0x21')](_0x3b8b('0x22'),_0x20516d,_0x3b8b('0x23'));_0x2fc3e9(_0x2c1710['result'][_0x3b8b('0x28')]);}})[_0x3b8b('0x29')](function(_0x576f29){logger[_0x3b8b('0x26')](_0x3b8b('0x22'),_0x20516d,_0x576f29);_0x280fb3(_0x576f29);});});}function respondWithStatusCode(_0x560793,_0x47af60){_0x47af60=_0x47af60||0xcc;return function(_0xe37b7c){if(_0xe37b7c){return _0x560793['sendStatus'](_0x47af60);}return _0x560793['status'](_0x47af60)[_0x3b8b('0x2a')]();};}function respondWithResult(_0x6f940,_0x11afa6){_0x11afa6=_0x11afa6||0xc8;return function(_0x1384da){if(_0x1384da){return _0x6f940[_0x3b8b('0x2b')](_0x11afa6)[_0x3b8b('0x2c')](_0x1384da);}};}function respondWithFilteredResult(_0x25caa4,_0x114b2b){return function(_0x195598){if(_0x195598){var _0x1a9e36=_0x195598[_0x3b8b('0x2d')],_0x2fe1f4=_0x114b2b[_0x3b8b('0x2e')],_0x28f6f6=_0x114b2b[_0x3b8b('0x2e')]+_0x114b2b[_0x3b8b('0x2f')],_0xab27e1;if(_0x28f6f6>=_0x1a9e36){_0x28f6f6=_0x1a9e36;_0xab27e1=0xc8;}else{_0xab27e1=0xce;}_0x25caa4[_0x3b8b('0x2b')](_0xab27e1);return _0x25caa4['set']('Content-Range',_0x2fe1f4+'-'+_0x28f6f6+'/'+_0x1a9e36)[_0x3b8b('0x2c')](_0x195598);}return null;};}function patchUpdates(_0x34c771){return function(_0x42744b){try{jsonpatch[_0x3b8b('0x30')](_0x42744b,_0x34c771,!![]);}catch(_0x3cc351){return BPromise[_0x3b8b('0x31')](_0x3cc351);}return _0x42744b['save']();};}function saveUpdates(_0x457141,_0x3900fd){return function(_0x1d18f3){if(_0x1d18f3){return _0x1d18f3[_0x3b8b('0x32')](_0x457141)['then'](function(_0x327dc9){return _0x327dc9;});}return null;};}function removeEntity(_0x527bf6,_0x3bca24){return function(_0x21791a){if(_0x21791a){return _0x21791a[_0x3b8b('0x33')]()[_0x3b8b('0x34')](function(){_0x527bf6['status'](0xcc)[_0x3b8b('0x2a')]();});}};}function handleEntityNotFound(_0x14242f,_0x4a573e){return function(_0x20c638){if(!_0x20c638){_0x14242f[_0x3b8b('0x35')](0x194);}return _0x20c638;};}function handleError(_0x4f7026,_0x45936e){_0x45936e=_0x45936e||0x1f4;return function(_0x4f789f){logger[_0x3b8b('0x26')](_0x4f789f[_0x3b8b('0x36')]);if(_0x4f789f['name']){delete _0x4f789f[_0x3b8b('0x37')];}_0x4f7026[_0x3b8b('0x2b')](_0x45936e)['send'](_0x4f789f);};}exports[_0x3b8b('0x38')]=function(_0x49c035,_0x2ae50f){var _0x15cb60={},_0x57b25b={},_0x1c9998={'count':0x0,'rows':[]};var _0x5878cb=_[_0x3b8b('0x39')](db[_0x3b8b('0x3a')][_0x3b8b('0x3b')],function(_0x22afe3){return{'name':_0x22afe3[_0x3b8b('0x3c')],'type':_0x22afe3[_0x3b8b('0x3d')][_0x3b8b('0x3e')]};});_0x57b25b['model']=_[_0x3b8b('0x39')](_0x5878cb,'name');_0x57b25b['query']=_[_0x3b8b('0x3f')](_0x49c035['query']);_0x57b25b['filters']=_[_0x3b8b('0x40')](_0x57b25b[_0x3b8b('0x41')],_0x57b25b['query']);_0x15cb60['attributes']=_['intersection'](_0x57b25b[_0x3b8b('0x41')],qs[_0x3b8b('0x42')](_0x49c035[_0x3b8b('0x43')][_0x3b8b('0x42')]));_0x15cb60[_0x3b8b('0x44')]=_0x15cb60['attributes'][_0x3b8b('0x45')]?_0x15cb60[_0x3b8b('0x44')]:_0x57b25b[_0x3b8b('0x41')];if(!_0x49c035[_0x3b8b('0x43')][_0x3b8b('0x46')](_0x3b8b('0x47'))){_0x15cb60[_0x3b8b('0x2f')]=qs[_0x3b8b('0x2f')](_0x49c035[_0x3b8b('0x43')][_0x3b8b('0x2f')]);_0x15cb60[_0x3b8b('0x2e')]=qs[_0x3b8b('0x2e')](_0x49c035[_0x3b8b('0x43')][_0x3b8b('0x2e')]);}_0x15cb60[_0x3b8b('0x48')]=qs[_0x3b8b('0x49')](_0x49c035['query'][_0x3b8b('0x49')]);_0x15cb60[_0x3b8b('0x4a')]=qs[_0x3b8b('0x4b')](_[_0x3b8b('0x4c')](_0x49c035['query'],_0x57b25b[_0x3b8b('0x4b')]),_0x5878cb);if(_0x49c035[_0x3b8b('0x43')][_0x3b8b('0x4d')]){_0x15cb60[_0x3b8b('0x4a')]=_['merge'](_0x15cb60[_0x3b8b('0x4a')],{'$or':_['map'](_0x5878cb,function(_0x1c8324){if(_0x1c8324[_0x3b8b('0x3d')]!==_0x3b8b('0x4e')){var _0xea3d86={};_0xea3d86[_0x1c8324[_0x3b8b('0x37')]]={'$like':'%'+_0x49c035['query']['filter']+'%'};return _0xea3d86;}})});}_0x15cb60=_['merge']({},_0x15cb60,_0x49c035['options']);var _0x1bbc2a={'where':_0x15cb60[_0x3b8b('0x4a')]};return db[_0x3b8b('0x3a')]['count'](_0x1bbc2a)[_0x3b8b('0x34')](function(_0x3ef383){_0x1c9998[_0x3b8b('0x2d')]=_0x3ef383;if(_0x49c035[_0x3b8b('0x43')][_0x3b8b('0x4f')]){_0x15cb60[_0x3b8b('0x50')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x3b8b('0x51')](_0x15cb60);})['then'](function(_0x32c28b){_0x1c9998['rows']=_0x32c28b;return _0x1c9998;})['then'](respondWithFilteredResult(_0x2ae50f,_0x15cb60))[_0x3b8b('0x29')](handleError(_0x2ae50f,null));};exports['show']=function(_0x143690,_0x3632a0){var _0x776328={'raw':![],'where':{'id':_0x143690['params']['id']}},_0x475e10={};_0x475e10['model']=_['keys'](db[_0x3b8b('0x3a')]['rawAttributes']);_0x475e10[_0x3b8b('0x43')]=_[_0x3b8b('0x3f')](_0x143690['query']);_0x475e10[_0x3b8b('0x4b')]=_[_0x3b8b('0x40')](_0x475e10[_0x3b8b('0x41')],_0x475e10['query']);_0x776328['attributes']=_[_0x3b8b('0x40')](_0x475e10[_0x3b8b('0x41')],qs['fields'](_0x143690[_0x3b8b('0x43')][_0x3b8b('0x42')]));_0x776328[_0x3b8b('0x44')]=_0x776328[_0x3b8b('0x44')]['length']?_0x776328[_0x3b8b('0x44')]:_0x475e10[_0x3b8b('0x41')];if(_0x143690['query'][_0x3b8b('0x4f')]){_0x776328[_0x3b8b('0x50')]=[{'all':!![]}];}_0x776328=_[_0x3b8b('0x52')]({},_0x776328,_0x143690[_0x3b8b('0x53')]);return db[_0x3b8b('0x3a')]['find'](_0x776328)[_0x3b8b('0x34')](handleEntityNotFound(_0x3632a0,null))[_0x3b8b('0x34')](respondWithResult(_0x3632a0,null))[_0x3b8b('0x29')](handleError(_0x3632a0,null));};exports[_0x3b8b('0x54')]=function(_0x134ae2,_0x8d9661){return db[_0x3b8b('0x3a')][_0x3b8b('0x54')](_0x134ae2[_0x3b8b('0x55')],{})[_0x3b8b('0x34')](respondWithResult(_0x8d9661,0xc9))[_0x3b8b('0x29')](handleError(_0x8d9661,null));};exports[_0x3b8b('0x32')]=function(_0x1c50f3,_0x202c79){if(_0x1c50f3[_0x3b8b('0x55')]['id']){delete _0x1c50f3[_0x3b8b('0x55')]['id'];}return db[_0x3b8b('0x3a')][_0x3b8b('0x56')]({'where':{'id':_0x1c50f3[_0x3b8b('0x57')]['id']}})['then'](handleEntityNotFound(_0x202c79,null))[_0x3b8b('0x34')](saveUpdates(_0x1c50f3[_0x3b8b('0x55')],null))['then'](respondWithResult(_0x202c79,null))[_0x3b8b('0x29')](handleError(_0x202c79,null));};exports[_0x3b8b('0x33')]=function(_0x53b555,_0x16c25a){return db['ServicenowAccount'][_0x3b8b('0x56')]({'where':{'id':_0x53b555[_0x3b8b('0x57')]['id']}})['then'](handleEntityNotFound(_0x16c25a,null))[_0x3b8b('0x34')](removeEntity(_0x16c25a,null))[_0x3b8b('0x29')](handleError(_0x16c25a,null));};exports[_0x3b8b('0x58')]=function(_0x584c0f,_0x40be45,_0x42fdb9){var _0x2c1d45={};var _0xcfd824={};var _0x918742;var _0x141225;return db[_0x3b8b('0x3a')][_0x3b8b('0x59')]({'where':{'id':_0x584c0f['params']['id']}})['then'](handleEntityNotFound(_0x40be45,null))[_0x3b8b('0x34')](function(_0x211bc9){if(_0x211bc9){_0x918742=_0x211bc9;_0xcfd824[_0x3b8b('0x41')]=_[_0x3b8b('0x3f')](db[_0x3b8b('0x5a')][_0x3b8b('0x3b')]);_0xcfd824[_0x3b8b('0x43')]=_[_0x3b8b('0x3f')](_0x584c0f['query']);_0xcfd824[_0x3b8b('0x4b')]=_[_0x3b8b('0x40')](_0xcfd824['model'],_0xcfd824[_0x3b8b('0x43')]);_0x2c1d45[_0x3b8b('0x44')]=_['intersection'](_0xcfd824['model'],qs[_0x3b8b('0x42')](_0x584c0f['query'][_0x3b8b('0x42')]));_0x2c1d45[_0x3b8b('0x44')]=_0x2c1d45[_0x3b8b('0x44')]['length']?_0x2c1d45[_0x3b8b('0x44')]:_0xcfd824[_0x3b8b('0x41')];_0x2c1d45[_0x3b8b('0x48')]=qs[_0x3b8b('0x49')](_0x584c0f[_0x3b8b('0x43')][_0x3b8b('0x49')]);_0x2c1d45[_0x3b8b('0x4a')]=qs[_0x3b8b('0x4b')](_['pick'](_0x584c0f[_0x3b8b('0x43')],_0xcfd824['filters']));if(_0x584c0f[_0x3b8b('0x43')][_0x3b8b('0x4d')]){_0x2c1d45[_0x3b8b('0x4a')]=_['merge'](_0x2c1d45[_0x3b8b('0x4a')],{'$or':_[_0x3b8b('0x39')](_0x2c1d45['attributes'],function(_0x210588){var _0xd7cfe4={};_0xd7cfe4[_0x210588]={'$like':'%'+_0x584c0f[_0x3b8b('0x43')][_0x3b8b('0x4d')]+'%'};return _0xd7cfe4;})});}_0x2c1d45=_[_0x3b8b('0x52')]({},_0x2c1d45,_0x584c0f['options']);return _0x918742[_0x3b8b('0x58')](_0x2c1d45);}})[_0x3b8b('0x34')](function(_0x5b5a5b){if(_0x5b5a5b){_0x141225=_0x5b5a5b[_0x3b8b('0x45')];if(!_0x584c0f['query'][_0x3b8b('0x46')](_0x3b8b('0x47'))){_0x2c1d45['limit']=qs[_0x3b8b('0x2f')](_0x584c0f['query'][_0x3b8b('0x2f')]);_0x2c1d45['offset']=qs[_0x3b8b('0x2e')](_0x584c0f['query']['offset']);}return _0x918742[_0x3b8b('0x58')](_0x2c1d45);}})[_0x3b8b('0x34')](function(_0x567178){if(_0x567178){return _0x567178?{'count':_0x141225,'rows':_0x567178}:null;}})[_0x3b8b('0x34')](respondWithResult(_0x40be45,null))[_0x3b8b('0x29')](handleError(_0x40be45,null));};exports[_0x3b8b('0x5b')]=function(_0x5e7c28,_0x4410d2,_0xf0a8dd){if(_0x5e7c28[_0x3b8b('0x55')]['id']){delete _0x5e7c28[_0x3b8b('0x55')]['id'];}return db[_0x3b8b('0x3a')][_0x3b8b('0x59')]({'where':{'id':_0x5e7c28[_0x3b8b('0x57')]['id']}})[_0x3b8b('0x34')](handleEntityNotFound(_0x4410d2,null))[_0x3b8b('0x34')](function(_0x2a77da){if(_0x2a77da){_0x5e7c28[_0x3b8b('0x55')][_0x3b8b('0x5c')]=_0x2a77da['id'];_0x5e7c28['body'][_0x3b8b('0x5d')]=integrations[_0x3b8b('0x5e')](_0x5e7c28[_0x3b8b('0x55')][_0x3b8b('0x5f')],_0x5e7c28[_0x3b8b('0x55')][_0x3b8b('0x3d')]);_0x5e7c28['body'][_0x3b8b('0x60')]=integrations['getDescriptions'](_0x5e7c28[_0x3b8b('0x55')]['channel'],_0x5e7c28[_0x3b8b('0x55')][_0x3b8b('0x3d')]);return db[_0x3b8b('0x5a')][_0x3b8b('0x54')](_0x5e7c28['body'],{'include':[{'model':db[_0x3b8b('0x61')],'as':'Subjects'},{'model':db[_0x3b8b('0x61')],'as':_0x3b8b('0x60')}]});}return null;})[_0x3b8b('0x34')](respondWithResult(_0x4410d2,null))[_0x3b8b('0x29')](handleError(_0x4410d2,null));};exports[_0x3b8b('0x62')]=function(_0x5e9f49,_0x31d591,_0x2286bd){var _0x545371=['made_sla',_0x3b8b('0x63'),_0x3b8b('0x64'),_0x3b8b('0x65'),_0x3b8b('0x66'),'notify',_0x3b8b('0x67'),_0x3b8b('0x68'),_0x3b8b('0x69')];var _0x72632a=[_0x3b8b('0x6a'),_0x3b8b('0x6b'),'caused_by',_0x3b8b('0x6c'),_0x3b8b('0x6d'),_0x3b8b('0x6e'),_0x3b8b('0x6f'),_0x3b8b('0x63'),'approval_history',_0x3b8b('0x70'),'resolved_by',_0x3b8b('0x71'),'opened_by',_0x3b8b('0x72'),_0x3b8b('0x73'),_0x3b8b('0x74'),_0x3b8b('0x75'),_0x3b8b('0x76'),'knowledge',_0x3b8b('0x48'),_0x3b8b('0x77'),_0x3b8b('0x78'),_0x3b8b('0x79'),_0x3b8b('0x7a'),_0x3b8b('0x7b'),'active',_0x3b8b('0x7c'),_0x3b8b('0x7d'),'priority',_0x3b8b('0x7e'),_0x3b8b('0x7f'),_0x3b8b('0x80'),'expected_start',_0x3b8b('0x81'),_0x3b8b('0x82'),_0x3b8b('0x83'),_0x3b8b('0x84'),_0x3b8b('0x85'),'resolved_at',_0x3b8b('0x86'),'approval_set',_0x3b8b('0x65'),_0x3b8b('0x87'),_0x3b8b('0x88'),_0x3b8b('0x66'),_0x3b8b('0x89'),_0x3b8b('0x8a'),'work_start','assignment_group',_0x3b8b('0x8b'),_0x3b8b('0x8c'),_0x3b8b('0x8d'),_0x3b8b('0x8e'),_0x3b8b('0x8f'),'sys_class_name','close_notes',_0x3b8b('0x90'),'follow_up',_0x3b8b('0x91'),_0x3b8b('0x92'),_0x3b8b('0x93'),_0x3b8b('0x94'),_0x3b8b('0x67'),_0x3b8b('0x95'),_0x3b8b('0x96'),_0x3b8b('0x97'),'reassignment_count',_0x3b8b('0x98'),_0x3b8b('0x99'),'severity','comments',_0x3b8b('0x9a'),_0x3b8b('0x9b'),_0x3b8b('0x9c'),_0x3b8b('0x9d'),_0x3b8b('0x9e'),_0x3b8b('0x9f'),_0x3b8b('0xa0'),'escalation',_0x3b8b('0xa1'),_0x3b8b('0xa2'),_0x3b8b('0xa3'),_0x3b8b('0x69')];var _0x4a5a85='';var _0x117b6f='';var _0x37e09b=[];var _0x53052f='';var _0x15f57a='';var _0x242ebd=[];var _0x4e80ce='';var _0x28aaef='';var _0x6ddfac={};var _0xe16363='';return db[_0x3b8b('0x3a')]['findOne']({'where':{'id':_0x5e9f49[_0x3b8b('0x57')]['id']},'attributes':['id',_0x3b8b('0xa4'),_0x3b8b('0xa5'),_0x3b8b('0xa6'),_0x3b8b('0xa7'),'serverUrl']})[_0x3b8b('0x34')](handleEntityNotFound(_0x31d591,null))['then'](function(_0x3d843f){if(_0x3d843f){_0xe16363=_0x3d843f[_0x3b8b('0xa7')];var _0x33b80e=_0xe16363[_0x3b8b('0xa8')](-0x1);if(_0x33b80e==='/'){_0xe16363=_0xe16363[_0x3b8b('0xa9')](0x0,_0xe16363[_0x3b8b('0xaa')](_0x33b80e));}_0x28aaef=util[_0x3b8b('0xab')](_0x3b8b('0xac'),_0xe16363);_0x4e80ce=util[_0x3b8b('0xab')](_0x3b8b('0xad'),_0xe16363);_0x6ddfac={'user':_0x3d843f['username'],'pass':_0x3d843f[_0x3b8b('0xa5')]};var _0x9efece={'method':'GET','uri':_0x28aaef+_0x3b8b('0xae'),'auth':_0x6ddfac,'json':!![]};return rp(_0x9efece);}})[_0x3b8b('0x34')](function(_0x4afb23){if(_0x4afb23[_0x3b8b('0xaf')][_0x3b8b('0x45')]>0x0){_0x4a5a85=_0x4afb23[_0x3b8b('0xaf')];}console[_0x3b8b('0xb0')](_0x3b8b('0xb1'),_0x4a5a85);_0x242ebd=[];_0x117b6f=Object[_0x3b8b('0xb2')]([],_0x4a5a85);_['remove'](_0x117b6f,function(_0x397d92){return!_0x545371[_0x3b8b('0xb3')](_0x397d92['name']);});_0x117b6f[_0x3b8b('0xb4')](function(_0x470720){var _0x2791fd=createFieldObject(_0x4e80ce,_0x6ddfac,_0x470720[_0x3b8b('0xb5')],_0x470720[_0x3b8b('0x37')],_0x470720[_0x3b8b('0xb6')],![]);_0x242ebd[_0x3b8b('0xb7')](_0x2791fd);});return Promise[_0x3b8b('0xb8')](_0x242ebd);})[_0x3b8b('0x34')](function(_0x584f5c){_0x37e09b=_0x584f5c;_0x53052f=Object[_0x3b8b('0xb2')]([],_0x4a5a85);console[_0x3b8b('0xb0')](_0x3b8b('0xb9'),_0x4a5a85);_[_0x3b8b('0xba')](_0x53052f,function(_0x1d6dab){return _0x72632a[_0x3b8b('0xb3')](_0x1d6dab['name']);});console[_0x3b8b('0xb0')](_0x3b8b('0xbb'),_0x53052f);_0x242ebd=[];_0x53052f[_0x3b8b('0xb4')](function(_0xd43aa1){var _0x30b537=createFieldObject(_0x4e80ce,_0x6ddfac,_0xd43aa1[_0x3b8b('0xb5')],_0xd43aa1[_0x3b8b('0x37')],_0xd43aa1[_0x3b8b('0xb6')],!![]);_0x242ebd[_0x3b8b('0xb7')](_0x30b537);});return Promise['all'](_0x242ebd);})['then'](function(_0x35f4e9){_0x15f57a=_0x35f4e9;var _0x2ef9cd=_0x37e09b[_0x3b8b('0xbc')](_0x15f57a);return{'count':_0x2ef9cd['length'],'rows':_0x2ef9cd};})['then'](respondWithResult(_0x31d591,null))['catch'](function(_0x339400){console[_0x3b8b('0xb0')](_0x3b8b('0xbd')+_0x339400);var _0x956bcd=_0x5e9f49[_0x3b8b('0x43')][_0x3b8b('0x1c')]?0x1f4:_0x339400[_0x3b8b('0xbe')]||0x1f4;logger[_0x3b8b('0x26')](_0x339400['stack']);delete _0x339400[_0x3b8b('0x37')];if(_0x956bcd===0x191){_0x956bcd=0x190;}_0x31d591[_0x3b8b('0x2b')](_0x956bcd)[_0x3b8b('0xbf')](_0x5e9f49[_0x3b8b('0x43')]['test']?{'message':_0x3b8b('0xc0'),'statusCode':_0x339400[_0x3b8b('0xbe')]}:_0x339400);});};function createFieldObject(_0x54f7a2,_0x2888f8,_0x182af2,_0x544ba6,_0xa52fc3,_0x4524df){return new Promise(function(_0x3b3f97,_0x45597f){var _0x3ab0ea={'id':_0x544ba6,'name':_0xa52fc3,'custom':_0x4524df};if(_0x182af2===_0x3b8b('0xc1')){_0x3ab0ea[_0x3b8b('0x53')]=[{'name':'True','value':'true'},{'name':_0x3b8b('0xc2'),'value':_0x3b8b('0xc3')}];_0x3b3f97(_0x3ab0ea);}else{var _0x329102={'method':_0x3b8b('0xc4'),'uri':_0x54f7a2+_0x3b8b('0xc5')+_0x544ba6,'auth':_0x2888f8,'json':!![]};return rp(_0x329102)[_0x3b8b('0x34')](function(_0x31d970){var _0x2195e7=[];if(_0x31d970[_0x3b8b('0xaf')][_0x3b8b('0x45')]>0x0){_0x31d970['result'][_0x3b8b('0xb4')](function(_0x43b3c2){if(_0x43b3c2[_0x3b8b('0xc6')]===_0x3b8b('0xc3')){var _0x40a5d8={'name':_0x43b3c2['label'],'value':_0x43b3c2[_0x3b8b('0xc7')]};_0x2195e7[_0x3b8b('0xb7')](_0x40a5d8);}});}_0x3ab0ea['options']=_0x2195e7;if(_0x3ab0ea[_0x3b8b('0x53')]['length']>0x0){_0x3b3f97(_0x3ab0ea);}else{if(_0x4524df==![]){_0x3b3f97();}else{_0x3b3f97(_0x3ab0ea);}}});}});} \ No newline at end of file +var _0x5915=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','index','ServicenowAccount','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','show','params','keys','length','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','channel','ServicenowField','Subjects','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','caused_by','watch_list','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','user_input','sys_created_on','state','sys_created_by','cmdb_ci','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','opened_at','group_list','reopened_time','caller_id','work_notes','short_description','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','problem_id','reassignment_count','activity_due','assigned_to','severity','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','correlation_id','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','result','log','incident\x20table\x20objects','remove','includes','label','push','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','client','http','Sequelize','ValidationError','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x5915,0x14a));var _0x5591=function(_0x59e54c,_0xe62289){_0x59e54c=_0x59e54c-0x0;var _0x2d5aca=_0x5915[_0x59e54c];return _0x2d5aca;};'use strict';var pdf=require(_0x5591('0x0'));var emlformat=require(_0x5591('0x1'));var rimraf=require(_0x5591('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5591('0x3'));var moment=require(_0x5591('0x4'));var BPromise=require(_0x5591('0x5'));var Mustache=require('mustache');var util=require(_0x5591('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5591('0x7'));var ejs=require(_0x5591('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5591('0x9'));var crypto=require(_0x5591('0xa'));var jsforce=require(_0x5591('0xb'));var deskjs=require(_0x5591('0xc'));var toCsv=require(_0x5591('0x7'));var querystring=require('querystring');var Papa=require(_0x5591('0xd'));var Redis=require(_0x5591('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5591('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5591('0x10'));var logger=require(_0x5591('0x11'))('api');var utils=require(_0x5591('0x12'));var config=require('../../config/environment');var db=require(_0x5591('0x13'))['db'];var integrations=require(_0x5591('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x5591('0x15')][_0x5591('0x16')]({'port':0x232a});function checkPasswordPattern(_0x1830b2,_0x17a0e3,_0x7ab73e){if(_0x7ab73e){var _0x142de1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x142de1['test'](_0x17a0e3)){return _0x1830b2;}else{throw new db[(_0x5591('0x17'))][(_0x5591('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1830b2;}}function respondWithRpcPromise(_0x8f329d,_0x450e87,_0x4527fa,_0x2fd54e){return new BPromise(function(_0x59501f,_0x1e61a3){var _0x3c8eda=_0x2fd54e||client;return _0x3c8eda[_0x5591('0x19')](_0x8f329d,_0x4527fa)[_0x5591('0x1a')](function(_0x4a2c5){logger[_0x5591('0x1b')](_0x5591('0x1c'),_0x450e87,_0x5591('0x1d'));logger[_0x5591('0x1e')](_0x5591('0x1f'),_0x450e87,_0x5591('0x1d'),JSON[_0x5591('0x20')](_0x4a2c5));if(_0x4a2c5[_0x5591('0x21')]){if(_0x4a2c5[_0x5591('0x21')][_0x5591('0x22')]===0x1f4){logger['error'](_0x5591('0x1c'),_0x450e87,_0x4a2c5[_0x5591('0x21')]['message']);return _0x1e61a3(_0x4a2c5['error']['message']);}logger['error'](_0x5591('0x1c'),_0x450e87,_0x4a2c5[_0x5591('0x21')][_0x5591('0x23')]);return _0x59501f(_0x4a2c5[_0x5591('0x21')][_0x5591('0x23')]);}else{logger[_0x5591('0x1b')](_0x5591('0x1c'),_0x450e87,'request\x20sent');_0x59501f(_0x4a2c5['result'][_0x5591('0x23')]);}})[_0x5591('0x24')](function(_0x7623ea){logger[_0x5591('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0x450e87,_0x7623ea);_0x1e61a3(_0x7623ea);});});}function respondWithStatusCode(_0x38dc60,_0x65e133){_0x65e133=_0x65e133||0xcc;return function(_0x42a3d9){if(_0x42a3d9){return _0x38dc60[_0x5591('0x25')](_0x65e133);}return _0x38dc60[_0x5591('0x26')](_0x65e133)[_0x5591('0x27')]();};}function respondWithResult(_0x412125,_0x4e0aa9){_0x4e0aa9=_0x4e0aa9||0xc8;return function(_0x366ae2){if(_0x366ae2){return _0x412125[_0x5591('0x26')](_0x4e0aa9)[_0x5591('0x28')](_0x366ae2);}};}function respondWithFilteredResult(_0x1506e4,_0x1bcbf0){return function(_0x28c9f6){if(_0x28c9f6){var _0x59df24=_0x28c9f6[_0x5591('0x29')],_0x244222=_0x1bcbf0[_0x5591('0x2a')],_0x367d06=_0x1bcbf0['offset']+_0x1bcbf0[_0x5591('0x2b')],_0x17e0c6;if(_0x367d06>=_0x59df24){_0x367d06=_0x59df24;_0x17e0c6=0xc8;}else{_0x17e0c6=0xce;}_0x1506e4['status'](_0x17e0c6);return _0x1506e4[_0x5591('0x2c')](_0x5591('0x2d'),_0x244222+'-'+_0x367d06+'/'+_0x59df24)[_0x5591('0x28')](_0x28c9f6);}return null;};}function patchUpdates(_0x3351a0){return function(_0x46c2b7){try{jsonpatch[_0x5591('0x2e')](_0x46c2b7,_0x3351a0,!![]);}catch(_0x38da5b){return BPromise[_0x5591('0x2f')](_0x38da5b);}return _0x46c2b7[_0x5591('0x30')]();};}function saveUpdates(_0x39b8e6,_0x52ef2a){return function(_0x597f0b){if(_0x597f0b){return _0x597f0b[_0x5591('0x31')](_0x39b8e6)[_0x5591('0x1a')](function(_0x3a926a){return _0x3a926a;});}return null;};}function removeEntity(_0x500745,_0xe79a44){return function(_0x51c331){if(_0x51c331){return _0x51c331['destroy']()['then'](function(){_0x500745['status'](0xcc)[_0x5591('0x27')]();});}};}function handleEntityNotFound(_0x33ead4,_0x428f34){return function(_0x12ba4d){if(!_0x12ba4d){_0x33ead4[_0x5591('0x25')](0x194);}return _0x12ba4d;};}function handleError(_0x3ca86e,_0x47fc91){_0x47fc91=_0x47fc91||0x1f4;return function(_0x333665){logger[_0x5591('0x21')](_0x333665[_0x5591('0x32')]);if(_0x333665[_0x5591('0x33')]){delete _0x333665[_0x5591('0x33')];}_0x3ca86e['status'](_0x47fc91)['send'](_0x333665);};}exports[_0x5591('0x34')]=function(_0x8e939d,_0x36a355){var _0x1ab13f={},_0x496952={},_0x3b3ef6={'count':0x0,'rows':[]};var _0x475eb7=_['map'](db[_0x5591('0x35')][_0x5591('0x36')],function(_0x3b37e2){return{'name':_0x3b37e2[_0x5591('0x37')],'type':_0x3b37e2['type']['key']};});_0x496952[_0x5591('0x38')]=_[_0x5591('0x39')](_0x475eb7,_0x5591('0x33'));_0x496952[_0x5591('0x3a')]=_['keys'](_0x8e939d[_0x5591('0x3a')]);_0x496952[_0x5591('0x3b')]=_[_0x5591('0x3c')](_0x496952[_0x5591('0x38')],_0x496952[_0x5591('0x3a')]);_0x1ab13f[_0x5591('0x3d')]=_[_0x5591('0x3c')](_0x496952['model'],qs['fields'](_0x8e939d[_0x5591('0x3a')][_0x5591('0x3e')]));_0x1ab13f['attributes']=_0x1ab13f[_0x5591('0x3d')]['length']?_0x1ab13f[_0x5591('0x3d')]:_0x496952[_0x5591('0x38')];if(!_0x8e939d[_0x5591('0x3a')][_0x5591('0x3f')](_0x5591('0x40'))){_0x1ab13f['limit']=qs[_0x5591('0x2b')](_0x8e939d[_0x5591('0x3a')][_0x5591('0x2b')]);_0x1ab13f[_0x5591('0x2a')]=qs[_0x5591('0x2a')](_0x8e939d[_0x5591('0x3a')][_0x5591('0x2a')]);}_0x1ab13f[_0x5591('0x41')]=qs[_0x5591('0x42')](_0x8e939d[_0x5591('0x3a')][_0x5591('0x42')]);_0x1ab13f['where']=qs[_0x5591('0x3b')](_[_0x5591('0x43')](_0x8e939d[_0x5591('0x3a')],_0x496952['filters']),_0x475eb7);if(_0x8e939d[_0x5591('0x3a')][_0x5591('0x44')]){_0x1ab13f[_0x5591('0x45')]=_['merge'](_0x1ab13f[_0x5591('0x45')],{'$or':_[_0x5591('0x39')](_0x475eb7,function(_0x157696){if(_0x157696[_0x5591('0x46')]!==_0x5591('0x47')){var _0x5882c1={};_0x5882c1[_0x157696[_0x5591('0x33')]]={'$like':'%'+_0x8e939d['query']['filter']+'%'};return _0x5882c1;}})});}_0x1ab13f=_[_0x5591('0x48')]({},_0x1ab13f,_0x8e939d[_0x5591('0x49')]);var _0x534682={'where':_0x1ab13f[_0x5591('0x45')]};return db['ServicenowAccount'][_0x5591('0x29')](_0x534682)[_0x5591('0x1a')](function(_0x222fca){_0x3b3ef6[_0x5591('0x29')]=_0x222fca;if(_0x8e939d['query'][_0x5591('0x4a')]){_0x1ab13f['include']=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x1ab13f);})[_0x5591('0x1a')](function(_0x3c4459){_0x3b3ef6['rows']=_0x3c4459;return _0x3b3ef6;})['then'](respondWithFilteredResult(_0x36a355,_0x1ab13f))[_0x5591('0x24')](handleError(_0x36a355,null));};exports[_0x5591('0x4b')]=function(_0x10d41e,_0x4b4414){var _0x2dcb0d={'raw':![],'where':{'id':_0x10d41e[_0x5591('0x4c')]['id']}},_0x5bba87={};_0x5bba87[_0x5591('0x38')]=_[_0x5591('0x4d')](db[_0x5591('0x35')][_0x5591('0x36')]);_0x5bba87[_0x5591('0x3a')]=_[_0x5591('0x4d')](_0x10d41e[_0x5591('0x3a')]);_0x5bba87[_0x5591('0x3b')]=_[_0x5591('0x3c')](_0x5bba87[_0x5591('0x38')],_0x5bba87[_0x5591('0x3a')]);_0x2dcb0d[_0x5591('0x3d')]=_['intersection'](_0x5bba87[_0x5591('0x38')],qs[_0x5591('0x3e')](_0x10d41e['query']['fields']));_0x2dcb0d[_0x5591('0x3d')]=_0x2dcb0d['attributes'][_0x5591('0x4e')]?_0x2dcb0d[_0x5591('0x3d')]:_0x5bba87[_0x5591('0x38')];if(_0x10d41e[_0x5591('0x3a')]['includeAll']){_0x2dcb0d[_0x5591('0x4f')]=[{'all':!![]}];}_0x2dcb0d=_[_0x5591('0x48')]({},_0x2dcb0d,_0x10d41e[_0x5591('0x49')]);return db[_0x5591('0x35')][_0x5591('0x50')](_0x2dcb0d)[_0x5591('0x1a')](handleEntityNotFound(_0x4b4414,null))[_0x5591('0x1a')](respondWithResult(_0x4b4414,null))[_0x5591('0x24')](handleError(_0x4b4414,null));};exports[_0x5591('0x51')]=function(_0x331547,_0x1c74cd){return db[_0x5591('0x35')][_0x5591('0x51')](_0x331547[_0x5591('0x52')],{})[_0x5591('0x1a')](respondWithResult(_0x1c74cd,0xc9))[_0x5591('0x24')](handleError(_0x1c74cd,null));};exports['update']=function(_0x42f9e2,_0x27b6b1){if(_0x42f9e2['body']['id']){delete _0x42f9e2[_0x5591('0x52')]['id'];}return db[_0x5591('0x35')][_0x5591('0x50')]({'where':{'id':_0x42f9e2[_0x5591('0x4c')]['id']}})['then'](handleEntityNotFound(_0x27b6b1,null))[_0x5591('0x1a')](saveUpdates(_0x42f9e2[_0x5591('0x52')],null))[_0x5591('0x1a')](respondWithResult(_0x27b6b1,null))[_0x5591('0x24')](handleError(_0x27b6b1,null));};exports['destroy']=function(_0x477811,_0xc60311){return db[_0x5591('0x35')][_0x5591('0x50')]({'where':{'id':_0x477811[_0x5591('0x4c')]['id']}})[_0x5591('0x1a')](handleEntityNotFound(_0xc60311,null))['then'](removeEntity(_0xc60311,null))[_0x5591('0x24')](handleError(_0xc60311,null));};exports[_0x5591('0x53')]=function(_0x33f6ca,_0x6301d4,_0x48486d){var _0x21493d={};var _0x167591={};var _0x2098d9;var _0x4fc98a;return db[_0x5591('0x35')][_0x5591('0x54')]({'where':{'id':_0x33f6ca['params']['id']}})[_0x5591('0x1a')](handleEntityNotFound(_0x6301d4,null))['then'](function(_0xe8b4de){if(_0xe8b4de){_0x2098d9=_0xe8b4de;_0x167591[_0x5591('0x38')]=_['keys'](db[_0x5591('0x55')][_0x5591('0x36')]);_0x167591[_0x5591('0x3a')]=_['keys'](_0x33f6ca[_0x5591('0x3a')]);_0x167591[_0x5591('0x3b')]=_[_0x5591('0x3c')](_0x167591[_0x5591('0x38')],_0x167591[_0x5591('0x3a')]);_0x21493d[_0x5591('0x3d')]=_[_0x5591('0x3c')](_0x167591['model'],qs[_0x5591('0x3e')](_0x33f6ca[_0x5591('0x3a')]['fields']));_0x21493d[_0x5591('0x3d')]=_0x21493d[_0x5591('0x3d')][_0x5591('0x4e')]?_0x21493d['attributes']:_0x167591[_0x5591('0x38')];_0x21493d[_0x5591('0x41')]=qs[_0x5591('0x42')](_0x33f6ca[_0x5591('0x3a')][_0x5591('0x42')]);_0x21493d[_0x5591('0x45')]=qs[_0x5591('0x3b')](_['pick'](_0x33f6ca[_0x5591('0x3a')],_0x167591[_0x5591('0x3b')]));if(_0x33f6ca['query']['filter']){_0x21493d['where']=_[_0x5591('0x48')](_0x21493d[_0x5591('0x45')],{'$or':_[_0x5591('0x39')](_0x21493d[_0x5591('0x3d')],function(_0x7d3560){var _0x191078={};_0x191078[_0x7d3560]={'$like':'%'+_0x33f6ca['query']['filter']+'%'};return _0x191078;})});}_0x21493d=_[_0x5591('0x48')]({},_0x21493d,_0x33f6ca[_0x5591('0x49')]);return _0x2098d9[_0x5591('0x53')](_0x21493d);}})[_0x5591('0x1a')](function(_0x8ebcc1){if(_0x8ebcc1){_0x4fc98a=_0x8ebcc1[_0x5591('0x4e')];if(!_0x33f6ca[_0x5591('0x3a')][_0x5591('0x3f')](_0x5591('0x40'))){_0x21493d[_0x5591('0x2b')]=qs[_0x5591('0x2b')](_0x33f6ca[_0x5591('0x3a')][_0x5591('0x2b')]);_0x21493d['offset']=qs['offset'](_0x33f6ca['query']['offset']);}return _0x2098d9['getConfigurations'](_0x21493d);}})[_0x5591('0x1a')](function(_0x3336c8){if(_0x3336c8){return _0x3336c8?{'count':_0x4fc98a,'rows':_0x3336c8}:null;}})[_0x5591('0x1a')](respondWithResult(_0x6301d4,null))[_0x5591('0x24')](handleError(_0x6301d4,null));};exports[_0x5591('0x56')]=function(_0x4bf7b6,_0x262b2b,_0x1b309b){if(_0x4bf7b6['body']['id']){delete _0x4bf7b6[_0x5591('0x52')]['id'];}return db[_0x5591('0x35')][_0x5591('0x54')]({'where':{'id':_0x4bf7b6[_0x5591('0x4c')]['id']}})[_0x5591('0x1a')](handleEntityNotFound(_0x262b2b,null))['then'](function(_0x57980e){if(_0x57980e){_0x4bf7b6[_0x5591('0x52')][_0x5591('0x57')]=_0x57980e['id'];_0x4bf7b6[_0x5591('0x52')]['Subjects']=integrations['getSubjects'](_0x4bf7b6[_0x5591('0x52')][_0x5591('0x58')],_0x4bf7b6[_0x5591('0x52')][_0x5591('0x46')]);_0x4bf7b6['body']['Descriptions']=integrations['getDescriptions'](_0x4bf7b6['body'][_0x5591('0x58')],_0x4bf7b6['body'][_0x5591('0x46')]);return db['ServicenowConfiguration']['create'](_0x4bf7b6[_0x5591('0x52')],{'include':[{'model':db[_0x5591('0x59')],'as':_0x5591('0x5a')},{'model':db[_0x5591('0x59')],'as':_0x5591('0x5b')}]});}return null;})['then'](respondWithResult(_0x262b2b,null))[_0x5591('0x24')](handleError(_0x262b2b,null));};exports[_0x5591('0x5c')]=function(_0x43f6ce,_0x184252,_0x1b2348){var _0x3ef57d=[_0x5591('0x5d'),_0x5591('0x5e'),_0x5591('0x5f'),_0x5591('0x60'),_0x5591('0x61'),_0x5591('0x62'),_0x5591('0x63'),'severity',_0x5591('0x64')];var _0x259e98=['parent',_0x5591('0x5d'),_0x5591('0x65'),_0x5591('0x66'),'upon_reject',_0x5591('0x67'),'child_incidents','hold_reason',_0x5591('0x68'),_0x5591('0x69'),_0x5591('0x6a'),_0x5591('0x6b'),'opened_by',_0x5591('0x6c'),_0x5591('0x6d'),'sys_domain',_0x5591('0x6e'),_0x5591('0x6f'),_0x5591('0x5f'),'order','calendar_stc','closed_at',_0x5591('0x70'),_0x5591('0x71'),_0x5591('0x72'),_0x5591('0x73'),_0x5591('0x74'),'business_service','priority',_0x5591('0x75'),_0x5591('0x76'),_0x5591('0x77'),'expected_start',_0x5591('0x78'),'business_duration',_0x5591('0x79'),'work_end',_0x5591('0x7a'),'resolved_at',_0x5591('0x7b'),'approval_set',_0x5591('0x60'),_0x5591('0x7c'),_0x5591('0x7d'),_0x5591('0x61'),'correlation_display','delivery_task',_0x5591('0x7e'),_0x5591('0x7f'),_0x5591('0x80'),_0x5591('0x81'),_0x5591('0x82'),_0x5591('0x83'),_0x5591('0x62'),_0x5591('0x84'),_0x5591('0x85'),_0x5591('0x86'),_0x5591('0x87'),_0x5591('0x88'),'sys_id',_0x5591('0x89'),_0x5591('0x8a'),_0x5591('0x63'),'urgency',_0x5591('0x8b'),'company',_0x5591('0x8c'),_0x5591('0x8d'),_0x5591('0x8e'),_0x5591('0x8f'),'comments',_0x5591('0x90'),_0x5591('0x91'),_0x5591('0x92'),_0x5591('0x93'),_0x5591('0x94'),_0x5591('0x95'),'sys_tags',_0x5591('0x96'),'upon_approval',_0x5591('0x97'),_0x5591('0x98'),_0x5591('0x64')];var _0x2e09d0='';var _0x1222d7='';var _0x15773c=[];var _0x2a277f='';var _0x912d05='';var _0x4cd3f0=[];var _0x3adaea='';var _0x34d812='';var _0x24e7cb={};var _0x11fde5='';return db[_0x5591('0x35')][_0x5591('0x54')]({'where':{'id':_0x43f6ce[_0x5591('0x4c')]['id']},'attributes':['id',_0x5591('0x99'),_0x5591('0x9a'),_0x5591('0x9b'),_0x5591('0x9c'),_0x5591('0x9d')]})[_0x5591('0x1a')](handleEntityNotFound(_0x184252,null))[_0x5591('0x1a')](function(_0x4b2cc4){if(_0x4b2cc4){_0x11fde5=_0x4b2cc4['remoteUri'];var _0x3d074b=_0x11fde5['slice'](-0x1);if(_0x3d074b==='/'){_0x11fde5=_0x11fde5[_0x5591('0x9e')](0x0,_0x11fde5[_0x5591('0x9f')](_0x3d074b));}_0x34d812=util[_0x5591('0xa0')](_0x5591('0xa1'),_0x11fde5);_0x3adaea=util[_0x5591('0xa0')](_0x5591('0xa2'),_0x11fde5);_0x24e7cb={'user':_0x4b2cc4[_0x5591('0x99')],'pass':_0x4b2cc4['password']};var _0x33dc34={'method':_0x5591('0xa3'),'uri':_0x34d812+_0x5591('0xa4'),'auth':_0x24e7cb,'json':!![]};return rp(_0x33dc34);}})[_0x5591('0x1a')](function(_0x28a672){if(_0x28a672[_0x5591('0xa5')]['length']>0x0){_0x2e09d0=_0x28a672[_0x5591('0xa5')];}console[_0x5591('0xa6')](_0x5591('0xa7'),_0x2e09d0);_0x4cd3f0=[];_0x1222d7=Object['assign']([],_0x2e09d0);_[_0x5591('0xa8')](_0x1222d7,function(_0x55a759){return!_0x3ef57d[_0x5591('0xa9')](_0x55a759[_0x5591('0x33')]);});_0x1222d7['forEach'](function(_0x52a2b5){var _0x328853=createFieldObject(_0x3adaea,_0x24e7cb,_0x52a2b5['internalType'],_0x52a2b5[_0x5591('0x33')],_0x52a2b5[_0x5591('0xaa')],![]);_0x4cd3f0[_0x5591('0xab')](_0x328853);});return Promise['all'](_0x4cd3f0);})[_0x5591('0x1a')](function(_0xb58866){_0x15773c=_0xb58866;_0x2a277f=Object['assign']([],_0x2e09d0);console[_0x5591('0xa6')]('TCL:\x20_object',_0x2e09d0);_['remove'](_0x2a277f,function(_0xb2fc7c){return _0x259e98[_0x5591('0xa9')](_0xb2fc7c[_0x5591('0x33')]);});console[_0x5591('0xa6')](_0x5591('0xac'),_0x2a277f);_0x4cd3f0=[];_0x2a277f[_0x5591('0xad')](function(_0x3372cf){var _0x701d71=createFieldObject(_0x3adaea,_0x24e7cb,_0x3372cf['internalType'],_0x3372cf[_0x5591('0x33')],_0x3372cf['label'],!![]);_0x4cd3f0[_0x5591('0xab')](_0x701d71);});return Promise[_0x5591('0xae')](_0x4cd3f0);})['then'](function(_0x25c883){_0x912d05=_0x25c883;var _0x342fff=_0x15773c[_0x5591('0xaf')](_0x912d05);return{'count':_0x342fff['length'],'rows':_0x342fff};})['then'](respondWithResult(_0x184252,null))[_0x5591('0x24')](function(_0xf81892){console[_0x5591('0xa6')](_0x5591('0xb0')+_0xf81892);var _0x42e9fc=_0x43f6ce['query'][_0x5591('0xb1')]?0x1f4:_0xf81892[_0x5591('0xb2')]||0x1f4;logger[_0x5591('0x21')](_0xf81892[_0x5591('0x32')]);delete _0xf81892[_0x5591('0x33')];if(_0x42e9fc===0x191){_0x42e9fc=0x190;}_0x184252[_0x5591('0x26')](_0x42e9fc)['send'](_0x43f6ce[_0x5591('0x3a')][_0x5591('0xb1')]?{'message':_0x5591('0xb3'),'statusCode':_0xf81892[_0x5591('0xb2')]}:_0xf81892);});};function createFieldObject(_0x5a5796,_0x451be1,_0x39161a,_0x5155e0,_0x52579e,_0x136740){return new Promise(function(_0x477c42,_0x3b9018){var _0x9af50a={'id':_0x5155e0,'name':_0x52579e,'custom':_0x136740};if(_0x39161a==='boolean'){_0x9af50a[_0x5591('0x49')]=[{'name':'True','value':_0x5591('0xb4')},{'name':_0x5591('0xb5'),'value':_0x5591('0xb6')}];_0x477c42(_0x9af50a);}else{var _0x52848a={'method':_0x5591('0xa3'),'uri':_0x5a5796+_0x5591('0xb7')+_0x5155e0,'auth':_0x451be1,'json':!![]};return rp(_0x52848a)[_0x5591('0x1a')](function(_0x14851d){var _0x40d76b=[];if(_0x14851d[_0x5591('0xa5')]['length']>0x0){_0x14851d['result'][_0x5591('0xad')](function(_0x3f9831){if(_0x3f9831[_0x5591('0xb8')]===_0x5591('0xb6')){var _0x4c60e1={'name':_0x3f9831['label'],'value':_0x3f9831['value']};_0x40d76b[_0x5591('0xab')](_0x4c60e1);}});}_0x9af50a[_0x5591('0x49')]=_0x40d76b;if(_0x9af50a[_0x5591('0x49')]['length']>0x0){_0x477c42(_0x9af50a);}else{if(_0x136740==![]){_0x477c42();}else{_0x477c42(_0x9af50a);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 0be7cb3..2692f04 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 _0x425d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash'];(function(_0x3644cf,_0x5dc641){var _0x4aec0e=function(_0x360a24){while(--_0x360a24){_0x3644cf['push'](_0x3644cf['shift']());}};_0x4aec0e(++_0x5dc641);}(_0x425d,0x1e0));var _0xd425=function(_0xd75b98,_0x15ad99){_0xd75b98=_0xd75b98-0x0;var _0xdd720e=_0x425d[_0xd75b98];return _0xdd720e;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var fs=require('fs');var path=require(_0xd425('0x6'));var rimraf=require(_0xd425('0x7'));var config=require('../../config/environment');var attributes=require(_0xd425('0x8'));var integrations=require(_0xd425('0x9'));module[_0xd425('0xa')]=function(_0x36866e,_0x1d97d9){return _0x36866e[_0xd425('0xb')]('ServicenowAccount',attributes,{'tableName':_0xd425('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes'];(function(_0x301583,_0x48e684){var _0x43add0=function(_0x3efc38){while(--_0x3efc38){_0x301583['push'](_0x301583['shift']());}};_0x43add0(++_0x48e684);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2e7d09,_0x1809c3){_0x2e7d09=_0x2e7d09-0x0;var _0x185411=_0x8d0e[_0x2e7d09];return _0x185411;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2e2985,_0x92483d){return _0x2e2985[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 01e895f..245be31 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 _0x3c24=['message','result','GetServicenowAccount','findAll','raw','options','where','limit','include','map','model','attributes','ShowServicenowAccount','ServicenowAccount','find','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error'];(function(_0x4366cc,_0x4984e9){var _0x302a61=function(_0x52dcb5){while(--_0x52dcb5){_0x4366cc['push'](_0x4366cc['shift']());}};_0x302a61(++_0x4984e9);}(_0x3c24,0x1ec));var _0x43c2=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x3c24[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require(_0x43c2('0x0'));var moment=require('moment');var BPromise=require(_0x43c2('0x1'));var rs=require(_0x43c2('0x2'));var fs=require('fs');var Redis=require(_0x43c2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x43c2('0x4'));var logger=require(_0x43c2('0x5'))('rpc');var config=require(_0x43c2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x43c2('0x7')][_0x43c2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3227c5,_0x4df736,_0x21ed77){return new BPromise(function(_0x3b00e9,_0x3bbcaa){return client[_0x43c2('0x9')](_0x3227c5,_0x21ed77)[_0x43c2('0xa')](function(_0x443eb9){logger[_0x43c2('0xb')](_0x43c2('0xc'),_0x4df736,'request\x20sent');logger[_0x43c2('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x4df736,_0x43c2('0xe'),JSON[_0x43c2('0xf')](_0x443eb9));if(_0x443eb9['error']){if(_0x443eb9['error'][_0x43c2('0x10')]===0x1f4){logger[_0x43c2('0x11')](_0x43c2('0xc'),_0x4df736,_0x443eb9['error'][_0x43c2('0x12')]);return _0x3bbcaa(_0x443eb9[_0x43c2('0x11')][_0x43c2('0x12')]);}logger[_0x43c2('0x11')](_0x43c2('0xc'),_0x4df736,_0x443eb9[_0x43c2('0x11')]['message']);return _0x3b00e9(_0x443eb9['error'][_0x43c2('0x12')]);}else{logger[_0x43c2('0xb')](_0x43c2('0xc'),_0x4df736,_0x43c2('0xe'));_0x3b00e9(_0x443eb9[_0x43c2('0x13')][_0x43c2('0x12')]);}})['catch'](function(_0x3e835b){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x4df736,_0x3e835b);_0x3bbcaa(_0x3e835b);});});}exports[_0x43c2('0x14')]=function(_0x2c4500){var _0x258cef=this;return new Promise(function(_0x2b7803,_0x188c54){return db['ServicenowAccount'][_0x43c2('0x15')]({'raw':_0x2c4500['options']?_0x2c4500['options'][_0x43c2('0x16')]===undefined?!![]:![]:!![],'where':_0x2c4500[_0x43c2('0x17')]?_0x2c4500['options'][_0x43c2('0x18')]||null:null,'attributes':_0x2c4500[_0x43c2('0x17')]?_0x2c4500[_0x43c2('0x17')]['attributes']||null:null,'limit':_0x2c4500[_0x43c2('0x17')]?_0x2c4500[_0x43c2('0x17')][_0x43c2('0x19')]||null:null,'include':_0x2c4500[_0x43c2('0x17')]?_0x2c4500['options'][_0x43c2('0x1a')]?_[_0x43c2('0x1b')](_0x2c4500['options'][_0x43c2('0x1a')],function(_0x369537){return{'model':db[_0x369537[_0x43c2('0x1c')]],'as':_0x369537['as'],'attributes':_0x369537[_0x43c2('0x1d')],'include':_0x369537['include']?_[_0x43c2('0x1b')](_0x369537[_0x43c2('0x1a')],function(_0x57ab5d){return{'model':db[_0x57ab5d['model']],'as':_0x57ab5d['as'],'attributes':_0x57ab5d[_0x43c2('0x1d')],'include':_0x57ab5d[_0x43c2('0x1a')]?_[_0x43c2('0x1b')](_0x57ab5d[_0x43c2('0x1a')],function(_0x4a6630){return{'model':db[_0x4a6630['model']],'as':_0x4a6630['as'],'attributes':_0x4a6630[_0x43c2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x43c2('0xa')](function(_0x5c7bb4){logger['info'](_0x43c2('0x14'),_0x2c4500);logger['debug']('GetServicenowAccount',_0x2c4500,JSON[_0x43c2('0xf')](_0x5c7bb4));_0x2b7803(_0x5c7bb4);})['catch'](function(_0x4d4f64){logger['error'](_0x43c2('0x14'),_0x4d4f64[_0x43c2('0x12')],_0x2c4500);_0x188c54(_0x258cef[_0x43c2('0x11')](0x1f4,_0x4d4f64['message']));});});};exports[_0x43c2('0x1e')]=function(_0x5d1ec2){var _0x2565c6=this;return new Promise(function(_0x8bc49d,_0x42b9fc){return db[_0x43c2('0x1f')][_0x43c2('0x20')]({'raw':_0x5d1ec2[_0x43c2('0x17')]?_0x5d1ec2[_0x43c2('0x17')][_0x43c2('0x16')]===undefined?!![]:![]:!![],'where':_0x5d1ec2['options']?_0x5d1ec2[_0x43c2('0x17')][_0x43c2('0x18')]||null:null,'attributes':_0x5d1ec2[_0x43c2('0x17')]?_0x5d1ec2[_0x43c2('0x17')][_0x43c2('0x1d')]||null:null,'include':_0x5d1ec2['options']?_0x5d1ec2['options'][_0x43c2('0x1a')]?_['map'](_0x5d1ec2[_0x43c2('0x17')][_0x43c2('0x1a')],function(_0x2910ac){return{'model':db[_0x2910ac['model']],'as':_0x2910ac['as'],'attributes':_0x2910ac[_0x43c2('0x1d')],'include':_0x2910ac[_0x43c2('0x1a')]?_[_0x43c2('0x1b')](_0x2910ac[_0x43c2('0x1a')],function(_0xfedf25){return{'model':db[_0xfedf25['model']],'as':_0xfedf25['as'],'attributes':_0xfedf25[_0x43c2('0x1d')],'include':_0xfedf25[_0x43c2('0x1a')]?_['map'](_0xfedf25[_0x43c2('0x1a')],function(_0x2fb1fb){return{'model':db[_0x2fb1fb[_0x43c2('0x1c')]],'as':_0x2fb1fb['as'],'attributes':_0x2fb1fb[_0x43c2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13b019){logger[_0x43c2('0xb')](_0x43c2('0x1e'),_0x5d1ec2);logger['debug'](_0x43c2('0x1e'),_0x5d1ec2,JSON[_0x43c2('0xf')](_0x13b019));_0x8bc49d(_0x13b019);})[_0x43c2('0x21')](function(_0x172671){logger[_0x43c2('0x11')](_0x43c2('0x1e'),_0x172671['message'],_0x5d1ec2);_0x42b9fc(_0x2565c6['error'](0x1f4,_0x172671[_0x43c2('0x12')]));});});}; \ No newline at end of file +var _0x7f45=['map','model','attributes','ShowServicenowAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetServicenowAccount','raw','options','where','limit','include'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7f45,0x14e));var _0x57f4=function(_0x313895,_0x2f7ad8){_0x313895=_0x313895-0x0;var _0x2df377=_0x7f45[_0x313895];return _0x2df377;};'use strict';var _=require(_0x57f4('0x0'));var util=require('util');var moment=require(_0x57f4('0x1'));var BPromise=require(_0x57f4('0x2'));var rs=require(_0x57f4('0x3'));var fs=require('fs');var Redis=require(_0x57f4('0x4'));var db=require(_0x57f4('0x5'))['db'];var utils=require(_0x57f4('0x6'));var logger=require('../../config/logger')(_0x57f4('0x7'));var config=require('../../config/environment');var jayson=require(_0x57f4('0x8'));var client=jayson['client'][_0x57f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ce186,_0x34bf20,_0x3d61f5){return new BPromise(function(_0x5907b4,_0x4dcc58){return client[_0x57f4('0xa')](_0x2ce186,_0x3d61f5)[_0x57f4('0xb')](function(_0xbb0eac){logger['info'](_0x57f4('0xc'),_0x34bf20,_0x57f4('0xd'));logger[_0x57f4('0xe')](_0x57f4('0xf'),_0x34bf20,_0x57f4('0xd'),JSON[_0x57f4('0x10')](_0xbb0eac));if(_0xbb0eac[_0x57f4('0x11')]){if(_0xbb0eac[_0x57f4('0x11')][_0x57f4('0x12')]===0x1f4){logger[_0x57f4('0x11')](_0x57f4('0xc'),_0x34bf20,_0xbb0eac[_0x57f4('0x11')]['message']);return _0x4dcc58(_0xbb0eac[_0x57f4('0x11')]['message']);}logger['error'](_0x57f4('0xc'),_0x34bf20,_0xbb0eac[_0x57f4('0x11')]['message']);return _0x5907b4(_0xbb0eac[_0x57f4('0x11')][_0x57f4('0x13')]);}else{logger[_0x57f4('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x34bf20,_0x57f4('0xd'));_0x5907b4(_0xbb0eac[_0x57f4('0x15')][_0x57f4('0x13')]);}})[_0x57f4('0x16')](function(_0x2b10ad){logger['error'](_0x57f4('0xc'),_0x34bf20,_0x2b10ad);_0x4dcc58(_0x2b10ad);});});}exports[_0x57f4('0x17')]=function(_0x3e9d5d){var _0x31b6f5=this;return new Promise(function(_0xa79e2c,_0x346090){return db['ServicenowAccount']['findAll']({'raw':_0x3e9d5d['options']?_0x3e9d5d['options'][_0x57f4('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9d5d[_0x57f4('0x19')]?_0x3e9d5d[_0x57f4('0x19')][_0x57f4('0x1a')]||null:null,'attributes':_0x3e9d5d['options']?_0x3e9d5d[_0x57f4('0x19')]['attributes']||null:null,'limit':_0x3e9d5d[_0x57f4('0x19')]?_0x3e9d5d[_0x57f4('0x19')][_0x57f4('0x1b')]||null:null,'include':_0x3e9d5d[_0x57f4('0x19')]?_0x3e9d5d['options'][_0x57f4('0x1c')]?_[_0x57f4('0x1d')](_0x3e9d5d[_0x57f4('0x19')][_0x57f4('0x1c')],function(_0x50d076){return{'model':db[_0x50d076[_0x57f4('0x1e')]],'as':_0x50d076['as'],'attributes':_0x50d076[_0x57f4('0x1f')],'include':_0x50d076[_0x57f4('0x1c')]?_['map'](_0x50d076[_0x57f4('0x1c')],function(_0x13485f){return{'model':db[_0x13485f['model']],'as':_0x13485f['as'],'attributes':_0x13485f[_0x57f4('0x1f')],'include':_0x13485f[_0x57f4('0x1c')]?_[_0x57f4('0x1d')](_0x13485f['include'],function(_0x54bcce){return{'model':db[_0x54bcce[_0x57f4('0x1e')]],'as':_0x54bcce['as'],'attributes':_0x54bcce[_0x57f4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fbb9f){logger['info'](_0x57f4('0x17'),_0x3e9d5d);logger[_0x57f4('0xe')]('GetServicenowAccount',_0x3e9d5d,JSON[_0x57f4('0x10')](_0x3fbb9f));_0xa79e2c(_0x3fbb9f);})[_0x57f4('0x16')](function(_0x45f7e1){logger['error'](_0x57f4('0x17'),_0x45f7e1[_0x57f4('0x13')],_0x3e9d5d);_0x346090(_0x31b6f5[_0x57f4('0x11')](0x1f4,_0x45f7e1[_0x57f4('0x13')]));});});};exports[_0x57f4('0x20')]=function(_0x281b1b){var _0x5aa93a=this;return new Promise(function(_0x47cebc,_0x3c51ba){return db['ServicenowAccount']['find']({'raw':_0x281b1b['options']?_0x281b1b[_0x57f4('0x19')][_0x57f4('0x18')]===undefined?!![]:![]:!![],'where':_0x281b1b[_0x57f4('0x19')]?_0x281b1b[_0x57f4('0x19')][_0x57f4('0x1a')]||null:null,'attributes':_0x281b1b[_0x57f4('0x19')]?_0x281b1b[_0x57f4('0x19')]['attributes']||null:null,'include':_0x281b1b[_0x57f4('0x19')]?_0x281b1b['options'][_0x57f4('0x1c')]?_['map'](_0x281b1b[_0x57f4('0x19')][_0x57f4('0x1c')],function(_0x522eb1){return{'model':db[_0x522eb1[_0x57f4('0x1e')]],'as':_0x522eb1['as'],'attributes':_0x522eb1[_0x57f4('0x1f')],'include':_0x522eb1[_0x57f4('0x1c')]?_['map'](_0x522eb1[_0x57f4('0x1c')],function(_0x339307){return{'model':db[_0x339307[_0x57f4('0x1e')]],'as':_0x339307['as'],'attributes':_0x339307[_0x57f4('0x1f')],'include':_0x339307[_0x57f4('0x1c')]?_[_0x57f4('0x1d')](_0x339307['include'],function(_0x345619){return{'model':db[_0x345619['model']],'as':_0x345619['as'],'attributes':_0x345619['attributes']};}):[]};}):[]};}):[]:[]})[_0x57f4('0xb')](function(_0x33b3b6){logger[_0x57f4('0x14')](_0x57f4('0x20'),_0x281b1b);logger[_0x57f4('0xe')]('ShowServicenowAccount',_0x281b1b,JSON[_0x57f4('0x10')](_0x33b3b6));_0x47cebc(_0x33b3b6);})[_0x57f4('0x16')](function(_0x9c8a70){logger[_0x57f4('0x11')]('ShowServicenowAccount',_0x9c8a70[_0x57f4('0x13')],_0x281b1b);_0x3c51ba(_0x5aa93a[_0x57f4('0x11')](0x1f4,_0x9c8a70[_0x57f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e3f058c..718ce3d 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 _0xc599=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update'];(function(_0x42611d,_0x83e9c9){var _0xae917a=function(_0x1ffc9c){while(--_0x1ffc9c){_0x42611d['push'](_0x42611d['shift']());}};_0xae917a(++_0x83e9c9);}(_0xc599,0xe4));var _0x9c59=function(_0x35ccde,_0xbe027){_0x35ccde=_0x35ccde-0x0;var _0xbd6110=_0xc599[_0x35ccde];return _0xbd6110;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9c59('0x0'));var timeout=require(_0x9c59('0x1'));var express=require(_0x9c59('0x2'));var router=express[_0x9c59('0x3')]();var auth=require(_0x9c59('0x4'));var interaction=require(_0x9c59('0x5'));var config=require(_0x9c59('0x6'));var controller=require(_0x9c59('0x7'));router[_0x9c59('0x8')]('/',auth[_0x9c59('0x9')](),controller[_0x9c59('0xa')]);router[_0x9c59('0x8')](_0x9c59('0xb'),auth[_0x9c59('0x9')](),controller[_0x9c59('0xc')]);router[_0x9c59('0x8')](_0x9c59('0xd'),auth[_0x9c59('0x9')](),controller[_0x9c59('0xe')]);router['get'](_0x9c59('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9c59('0x8')](_0x9c59('0x10'),auth['isAuthenticated'](),controller[_0x9c59('0x11')]);router[_0x9c59('0x12')]('/',auth['isAuthenticated'](),controller[_0x9c59('0x13')]);router[_0x9c59('0x14')](_0x9c59('0xb'),auth[_0x9c59('0x9')](),controller[_0x9c59('0x15')]);router[_0x9c59('0x16')](_0x9c59('0xb'),auth[_0x9c59('0x9')](),controller[_0x9c59('0x17')]);module[_0x9c59('0x18')]=router; \ No newline at end of file +var _0x3e01=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service'];(function(_0xec4d0c,_0x19dae1){var _0x340744=function(_0x3a3a23){while(--_0x3a3a23){_0xec4d0c['push'](_0xec4d0c['shift']());}};_0x340744(++_0x19dae1);}(_0x3e01,0x17a));var _0x13e0=function(_0x52960b,_0x14d144){_0x52960b=_0x52960b-0x0;var _0x544b2b=_0x3e01[_0x52960b];return _0x544b2b;};'use strict';var multer=require(_0x13e0('0x0'));var util=require(_0x13e0('0x1'));var path=require(_0x13e0('0x2'));var timeout=require('connect-timeout');var express=require(_0x13e0('0x3'));var router=express[_0x13e0('0x4')]();var auth=require(_0x13e0('0x5'));var interaction=require(_0x13e0('0x6'));var config=require(_0x13e0('0x7'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0x13e0('0x8')](),controller[_0x13e0('0x9')]);router[_0x13e0('0xa')](_0x13e0('0xb'),auth[_0x13e0('0x8')](),controller[_0x13e0('0xc')]);router[_0x13e0('0xa')](_0x13e0('0xd'),auth['isAuthenticated'](),controller[_0x13e0('0xe')]);router[_0x13e0('0xa')](_0x13e0('0xf'),auth[_0x13e0('0x8')](),controller[_0x13e0('0x10')]);router[_0x13e0('0xa')](_0x13e0('0x11'),auth['isAuthenticated'](),controller[_0x13e0('0x12')]);router[_0x13e0('0x13')]('/',auth['isAuthenticated'](),controller[_0x13e0('0x14')]);router[_0x13e0('0x15')](_0x13e0('0xb'),auth[_0x13e0('0x8')](),controller['update']);router[_0x13e0('0x16')](_0x13e0('0xb'),auth['isAuthenticated'](),controller[_0x13e0('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index fd9f234..a300b20 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 _0x81bd=['STRING','sequelize','exports'];(function(_0x5992b9,_0x1fc4ba){var _0xd15bb2=function(_0x54fb27){while(--_0x54fb27){_0x5992b9['push'](_0x5992b9['shift']());}};_0xd15bb2(++_0x1fc4ba);}(_0x81bd,0x10f));var _0xd81b=function(_0x55738f,_0x595b6f){_0x55738f=_0x55738f-0x0;var _0x5f40b8=_0x81bd[_0x55738f];return _0x5f40b8;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd81b('0x2')]}}; \ No newline at end of file +var _0xce00=['STRING','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xce00,0x127));var _0x0ce0=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0xce00[_0x35ef6b];return _0x3ad145;};'use strict';var Sequelize=require('sequelize');module[_0x0ce0('0x0')]={'name':{'type':Sequelize[_0x0ce0('0x1')]},'description':{'type':Sequelize[_0x0ce0('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 56f5368..cde5259 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 _0xed3c=['offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ServicenowConfiguration','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','includeAll','include','rows','show','params','rawAttributes','find','create','body','getFields','ServicenowField','options','pick','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','end','count'];(function(_0x39cad6,_0x1edf41){var _0x5a82f2=function(_0x416563){while(--_0x416563){_0x39cad6['push'](_0x39cad6['shift']());}};_0x5a82f2(++_0x1edf41);}(_0xed3c,0x1a6));var _0xced3=function(_0x5c8811,_0x4f77d5){_0x5c8811=_0x5c8811-0x0;var _0x2c0941=_0xed3c[_0x5c8811];return _0x2c0941;};'use strict';var pdf=require(_0xced3('0x0'));var emlformat=require(_0xced3('0x1'));var rimraf=require(_0xced3('0x2'));var zipdir=require(_0xced3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xced3('0x4'));var moment=require(_0xced3('0x5'));var BPromise=require(_0xced3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xced3('0x7'));var sox=require(_0xced3('0x8'));var csv=require(_0xced3('0x9'));var ejs=require(_0xced3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var db=require(_0xced3('0x14'))['db'];var jayson=require(_0xced3('0x15'));var client=jayson[_0xced3('0x16')][_0xced3('0x17')]({'port':0x232a});function checkPasswordPattern(_0x457caf,_0x45d9fc,_0x1869d5){if(_0x1869d5){var _0x5aadb6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5aadb6[_0xced3('0x18')](_0x45d9fc)){return _0x457caf;}else{throw new db['Sequelize'][(_0xced3('0x19'))](_0xced3('0x1a'));}}else{return _0x457caf;}}function respondWithRpcPromise(_0x20d099,_0x39e4aa,_0x4dd4c3,_0x146a21){return new BPromise(function(_0x322c2d,_0x4acae6){var _0x3b5962=_0x146a21||client;return _0x3b5962[_0xced3('0x1b')](_0x20d099,_0x4dd4c3)[_0xced3('0x1c')](function(_0x17f611){logger['info'](_0xced3('0x1d'),_0x39e4aa,'request\x20sent');logger[_0xced3('0x1e')](_0xced3('0x1f'),_0x39e4aa,_0xced3('0x20'),JSON[_0xced3('0x21')](_0x17f611));if(_0x17f611[_0xced3('0x22')]){if(_0x17f611[_0xced3('0x22')][_0xced3('0x23')]===0x1f4){logger[_0xced3('0x22')](_0xced3('0x1d'),_0x39e4aa,_0x17f611[_0xced3('0x22')][_0xced3('0x24')]);return _0x4acae6(_0x17f611['error']['message']);}logger['error'](_0xced3('0x1d'),_0x39e4aa,_0x17f611[_0xced3('0x22')][_0xced3('0x24')]);return _0x322c2d(_0x17f611['error'][_0xced3('0x24')]);}else{logger[_0xced3('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x39e4aa,'request\x20sent');_0x322c2d(_0x17f611[_0xced3('0x26')][_0xced3('0x24')]);}})[_0xced3('0x27')](function(_0x15c6c5){logger['error'](_0xced3('0x1d'),_0x39e4aa,_0x15c6c5);_0x4acae6(_0x15c6c5);});});}function respondWithStatusCode(_0x23f92b,_0x4fc285){_0x4fc285=_0x4fc285||0xcc;return function(_0x3fb4f9){if(_0x3fb4f9){return _0x23f92b['sendStatus'](_0x4fc285);}return _0x23f92b[_0xced3('0x28')](_0x4fc285)[_0xced3('0x29')]();};}function respondWithResult(_0x3b728d,_0x23a570){_0x23a570=_0x23a570||0xc8;return function(_0x2ec2c4){if(_0x2ec2c4){return _0x3b728d['status'](_0x23a570)['json'](_0x2ec2c4);}};}function respondWithFilteredResult(_0x36b1fe,_0x5bb425){return function(_0x2ab8a8){if(_0x2ab8a8){var _0x1e6923=_0x2ab8a8[_0xced3('0x2a')],_0x4a8e85=_0x5bb425[_0xced3('0x2b')],_0x3db664=_0x5bb425[_0xced3('0x2b')]+_0x5bb425[_0xced3('0x2c')],_0x4024fa;if(_0x3db664>=_0x1e6923){_0x3db664=_0x1e6923;_0x4024fa=0xc8;}else{_0x4024fa=0xce;}_0x36b1fe[_0xced3('0x28')](_0x4024fa);return _0x36b1fe[_0xced3('0x2d')](_0xced3('0x2e'),_0x4a8e85+'-'+_0x3db664+'/'+_0x1e6923)['json'](_0x2ab8a8);}return null;};}function patchUpdates(_0xa78899){return function(_0x1b8baa){try{jsonpatch[_0xced3('0x2f')](_0x1b8baa,_0xa78899,!![]);}catch(_0x5867af){return BPromise[_0xced3('0x30')](_0x5867af);}return _0x1b8baa[_0xced3('0x31')]();};}function saveUpdates(_0x41ce44,_0x4f2439){return function(_0xc8e557){if(_0xc8e557){return _0xc8e557[_0xced3('0x32')](_0x41ce44)[_0xced3('0x1c')](function(_0x2aa88b){return _0x2aa88b;});}return null;};}function removeEntity(_0x12d4a5,_0x407a24){return function(_0x3048d0){if(_0x3048d0){return _0x3048d0[_0xced3('0x33')]()[_0xced3('0x1c')](function(){_0x12d4a5[_0xced3('0x28')](0xcc)[_0xced3('0x29')]();});}};}function handleEntityNotFound(_0xcd0fe3,_0x29a172){return function(_0x565e70){if(!_0x565e70){_0xcd0fe3[_0xced3('0x34')](0x194);}return _0x565e70;};}function handleError(_0x55e3ac,_0x457d38){_0x457d38=_0x457d38||0x1f4;return function(_0x28f674){logger[_0xced3('0x22')](_0x28f674[_0xced3('0x35')]);if(_0x28f674[_0xced3('0x36')]){delete _0x28f674[_0xced3('0x36')];}_0x55e3ac[_0xced3('0x28')](_0x457d38)[_0xced3('0x37')](_0x28f674);};}exports[_0xced3('0x38')]=function(_0x310e10,_0x5c290d){var _0x342c11={},_0x26a435={},_0x53e401={'count':0x0,'rows':[]};var _0x468c21=_[_0xced3('0x39')](db[_0xced3('0x3a')]['rawAttributes'],function(_0x59c3aa){return{'name':_0x59c3aa[_0xced3('0x3b')],'type':_0x59c3aa['type'][_0xced3('0x3c')]};});_0x26a435[_0xced3('0x3d')]=_['map'](_0x468c21,_0xced3('0x36'));_0x26a435[_0xced3('0x3e')]=_[_0xced3('0x3f')](_0x310e10['query']);_0x26a435[_0xced3('0x40')]=_['intersection'](_0x26a435['model'],_0x26a435[_0xced3('0x3e')]);_0x342c11[_0xced3('0x41')]=_[_0xced3('0x42')](_0x26a435['model'],qs[_0xced3('0x43')](_0x310e10[_0xced3('0x3e')][_0xced3('0x43')]));_0x342c11[_0xced3('0x41')]=_0x342c11[_0xced3('0x41')][_0xced3('0x44')]?_0x342c11[_0xced3('0x41')]:_0x26a435[_0xced3('0x3d')];if(!_0x310e10[_0xced3('0x3e')][_0xced3('0x45')](_0xced3('0x46'))){_0x342c11[_0xced3('0x2c')]=qs[_0xced3('0x2c')](_0x310e10[_0xced3('0x3e')][_0xced3('0x2c')]);_0x342c11['offset']=qs[_0xced3('0x2b')](_0x310e10[_0xced3('0x3e')][_0xced3('0x2b')]);}_0x342c11[_0xced3('0x47')]=qs[_0xced3('0x48')](_0x310e10[_0xced3('0x3e')][_0xced3('0x48')]);_0x342c11[_0xced3('0x49')]=qs[_0xced3('0x40')](_['pick'](_0x310e10[_0xced3('0x3e')],_0x26a435['filters']),_0x468c21);if(_0x310e10[_0xced3('0x3e')][_0xced3('0x4a')]){_0x342c11[_0xced3('0x49')]=_['merge'](_0x342c11[_0xced3('0x49')],{'$or':_[_0xced3('0x39')](_0x468c21,function(_0x3569f3){if(_0x3569f3[_0xced3('0x4b')]!=='VIRTUAL'){var _0x102b21={};_0x102b21[_0x3569f3[_0xced3('0x36')]]={'$like':'%'+_0x310e10[_0xced3('0x3e')][_0xced3('0x4a')]+'%'};return _0x102b21;}})});}_0x342c11=_[_0xced3('0x4c')]({},_0x342c11,_0x310e10['options']);var _0x12e085={'where':_0x342c11[_0xced3('0x49')]};return db[_0xced3('0x3a')][_0xced3('0x2a')](_0x12e085)[_0xced3('0x1c')](function(_0x740743){_0x53e401[_0xced3('0x2a')]=_0x740743;if(_0x310e10['query'][_0xced3('0x4d')]){_0x342c11[_0xced3('0x4e')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x342c11);})[_0xced3('0x1c')](function(_0x59b586){_0x53e401[_0xced3('0x4f')]=_0x59b586;return _0x53e401;})[_0xced3('0x1c')](respondWithFilteredResult(_0x5c290d,_0x342c11))[_0xced3('0x27')](handleError(_0x5c290d,null));};exports[_0xced3('0x50')]=function(_0x2c70e3,_0x1b3396){var _0x3700ed={'raw':![],'where':{'id':_0x2c70e3[_0xced3('0x51')]['id']}},_0x10cc6c={};_0x10cc6c['model']=_[_0xced3('0x3f')](db[_0xced3('0x3a')][_0xced3('0x52')]);_0x10cc6c[_0xced3('0x3e')]=_[_0xced3('0x3f')](_0x2c70e3[_0xced3('0x3e')]);_0x10cc6c['filters']=_[_0xced3('0x42')](_0x10cc6c[_0xced3('0x3d')],_0x10cc6c[_0xced3('0x3e')]);_0x3700ed[_0xced3('0x41')]=_[_0xced3('0x42')](_0x10cc6c[_0xced3('0x3d')],qs[_0xced3('0x43')](_0x2c70e3[_0xced3('0x3e')][_0xced3('0x43')]));_0x3700ed[_0xced3('0x41')]=_0x3700ed[_0xced3('0x41')][_0xced3('0x44')]?_0x3700ed['attributes']:_0x10cc6c[_0xced3('0x3d')];if(_0x2c70e3['query'][_0xced3('0x4d')]){_0x3700ed[_0xced3('0x4e')]=[{'all':!![]}];}_0x3700ed=_[_0xced3('0x4c')]({},_0x3700ed,_0x2c70e3['options']);return db['ServicenowConfiguration'][_0xced3('0x53')](_0x3700ed)[_0xced3('0x1c')](handleEntityNotFound(_0x1b3396,null))['then'](respondWithResult(_0x1b3396,null))[_0xced3('0x27')](handleError(_0x1b3396,null));};exports['create']=function(_0x3dba69,_0x3f9582){return db['ServicenowConfiguration'][_0xced3('0x54')](_0x3dba69[_0xced3('0x55')],{})[_0xced3('0x1c')](respondWithResult(_0x3f9582,0xc9))['catch'](handleError(_0x3f9582,null));};exports[_0xced3('0x32')]=function(_0x4cfd9a,_0x1cd21f){if(_0x4cfd9a[_0xced3('0x55')]['id']){delete _0x4cfd9a[_0xced3('0x55')]['id'];}return db[_0xced3('0x3a')][_0xced3('0x53')]({'where':{'id':_0x4cfd9a[_0xced3('0x51')]['id']}})[_0xced3('0x1c')](handleEntityNotFound(_0x1cd21f,null))[_0xced3('0x1c')](saveUpdates(_0x4cfd9a[_0xced3('0x55')],null))[_0xced3('0x1c')](respondWithResult(_0x1cd21f,null))[_0xced3('0x27')](handleError(_0x1cd21f,null));};exports['destroy']=function(_0x3859e8,_0x3de35d){return db[_0xced3('0x3a')][_0xced3('0x53')]({'where':{'id':_0x3859e8[_0xced3('0x51')]['id']}})[_0xced3('0x1c')](handleEntityNotFound(_0x3de35d,null))['then'](removeEntity(_0x3de35d,null))[_0xced3('0x27')](handleError(_0x3de35d,null));};exports[_0xced3('0x56')]=function(_0x21ea6a,_0x440a0f,_0x443469){var _0x1537ca={};var _0x56b18e={};var _0x995e70;var _0x53844d;return db[_0xced3('0x3a')]['findOne']({'where':{'id':_0x21ea6a[_0xced3('0x51')]['id']}})[_0xced3('0x1c')](handleEntityNotFound(_0x440a0f,null))['then'](function(_0x31bf5f){if(_0x31bf5f){_0x995e70=_0x31bf5f;_0x56b18e[_0xced3('0x3d')]=_[_0xced3('0x3f')](db[_0xced3('0x57')][_0xced3('0x52')]);_0x56b18e[_0xced3('0x3e')]=_[_0xced3('0x3f')](_0x21ea6a[_0xced3('0x3e')]);_0x56b18e[_0xced3('0x40')]=_[_0xced3('0x42')](_0x56b18e[_0xced3('0x3d')],_0x56b18e[_0xced3('0x3e')]);_0x1537ca[_0xced3('0x41')]=_['intersection'](_0x56b18e[_0xced3('0x3d')],qs[_0xced3('0x43')](_0x21ea6a[_0xced3('0x3e')][_0xced3('0x43')]));_0x1537ca['attributes']=_0x1537ca[_0xced3('0x41')][_0xced3('0x44')]?_0x1537ca[_0xced3('0x41')]:_0x56b18e[_0xced3('0x3d')];_0x1537ca[_0xced3('0x47')]=qs[_0xced3('0x48')](_0x21ea6a[_0xced3('0x3e')]['sort']);_0x1537ca[_0xced3('0x49')]=qs[_0xced3('0x40')](_['pick'](_0x21ea6a[_0xced3('0x3e')],_0x56b18e[_0xced3('0x40')]));if(_0x21ea6a[_0xced3('0x3e')][_0xced3('0x4a')]){_0x1537ca['where']=_[_0xced3('0x4c')](_0x1537ca[_0xced3('0x49')],{'$or':_[_0xced3('0x39')](_0x1537ca[_0xced3('0x41')],function(_0x3992d2){var _0x385d45={};_0x385d45[_0x3992d2]={'$like':'%'+_0x21ea6a[_0xced3('0x3e')][_0xced3('0x4a')]+'%'};return _0x385d45;})});}_0x1537ca=_[_0xced3('0x4c')]({},_0x1537ca,_0x21ea6a[_0xced3('0x58')]);return _0x995e70['getFields'](_0x1537ca);}})[_0xced3('0x1c')](function(_0x34e345){if(_0x34e345){_0x53844d=_0x34e345['length'];if(!_0x21ea6a['query'][_0xced3('0x45')]('nolimit')){_0x1537ca[_0xced3('0x2c')]=qs[_0xced3('0x2c')](_0x21ea6a['query'][_0xced3('0x2c')]);_0x1537ca[_0xced3('0x2b')]=qs['offset'](_0x21ea6a[_0xced3('0x3e')]['offset']);}return _0x995e70[_0xced3('0x56')](_0x1537ca);}})['then'](function(_0xf8ccc6){if(_0xf8ccc6){return _0xf8ccc6?{'count':_0x53844d,'rows':_0xf8ccc6}:null;}})[_0xced3('0x1c')](respondWithResult(_0x440a0f,null))[_0xced3('0x27')](handleError(_0x440a0f,null));};exports['getSubjects']=function(_0x189da2,_0xdacc2c,_0x21288d){var _0x4f29b6={};var _0x3f8d6f={};var _0x1abe1a;var _0x31edd3;return db[_0xced3('0x3a')]['findOne']({'where':{'id':_0x189da2['params']['id']}})[_0xced3('0x1c')](handleEntityNotFound(_0xdacc2c,null))[_0xced3('0x1c')](function(_0x1d5a4c){if(_0x1d5a4c){_0x1abe1a=_0x1d5a4c;_0x3f8d6f[_0xced3('0x3d')]=_[_0xced3('0x3f')](db[_0xced3('0x57')]['rawAttributes']);_0x3f8d6f[_0xced3('0x3e')]=_['keys'](_0x189da2[_0xced3('0x3e')]);_0x3f8d6f[_0xced3('0x40')]=_[_0xced3('0x42')](_0x3f8d6f[_0xced3('0x3d')],_0x3f8d6f['query']);_0x4f29b6[_0xced3('0x41')]=_[_0xced3('0x42')](_0x3f8d6f['model'],qs['fields'](_0x189da2[_0xced3('0x3e')][_0xced3('0x43')]));_0x4f29b6[_0xced3('0x41')]=_0x4f29b6[_0xced3('0x41')][_0xced3('0x44')]?_0x4f29b6['attributes']:_0x3f8d6f[_0xced3('0x3d')];_0x4f29b6[_0xced3('0x47')]=qs[_0xced3('0x48')](_0x189da2[_0xced3('0x3e')]['sort']);_0x4f29b6[_0xced3('0x49')]=qs[_0xced3('0x40')](_[_0xced3('0x59')](_0x189da2[_0xced3('0x3e')],_0x3f8d6f[_0xced3('0x40')]));if(_0x189da2[_0xced3('0x3e')][_0xced3('0x4a')]){_0x4f29b6[_0xced3('0x49')]=_[_0xced3('0x4c')](_0x4f29b6[_0xced3('0x49')],{'$or':_['map'](_0x4f29b6[_0xced3('0x41')],function(_0x1e7ff1){var _0x498ea9={};_0x498ea9[_0x1e7ff1]={'$like':'%'+_0x189da2[_0xced3('0x3e')][_0xced3('0x4a')]+'%'};return _0x498ea9;})});}_0x4f29b6=_[_0xced3('0x4c')]({},_0x4f29b6,_0x189da2[_0xced3('0x58')]);return _0x1abe1a[_0xced3('0x5a')](_0x4f29b6);}})['then'](function(_0x165271){if(_0x165271){_0x31edd3=_0x165271[_0xced3('0x44')];if(!_0x189da2['query'][_0xced3('0x45')](_0xced3('0x46'))){_0x4f29b6[_0xced3('0x2c')]=qs[_0xced3('0x2c')](_0x189da2[_0xced3('0x3e')][_0xced3('0x2c')]);_0x4f29b6['offset']=qs[_0xced3('0x2b')](_0x189da2[_0xced3('0x3e')][_0xced3('0x2b')]);}return _0x1abe1a[_0xced3('0x5a')](_0x4f29b6);}})[_0xced3('0x1c')](function(_0xde525f){if(_0xde525f){return _0xde525f?{'count':_0x31edd3,'rows':_0xde525f}:null;}})['then'](respondWithResult(_0xdacc2c,null))['catch'](handleError(_0xdacc2c,null));};exports[_0xced3('0x5b')]=function(_0xb6530d,_0x32d7c2,_0x131658){var _0x86551={};var _0x19316c={};var _0x6037a8;var _0x54ce0d;return db[_0xced3('0x3a')][_0xced3('0x5c')]({'where':{'id':_0xb6530d['params']['id']}})['then'](handleEntityNotFound(_0x32d7c2,null))[_0xced3('0x1c')](function(_0x29f8b5){if(_0x29f8b5){_0x6037a8=_0x29f8b5;_0x19316c[_0xced3('0x3d')]=_[_0xced3('0x3f')](db[_0xced3('0x57')]['rawAttributes']);_0x19316c[_0xced3('0x3e')]=_['keys'](_0xb6530d[_0xced3('0x3e')]);_0x19316c[_0xced3('0x40')]=_[_0xced3('0x42')](_0x19316c[_0xced3('0x3d')],_0x19316c[_0xced3('0x3e')]);_0x86551['attributes']=_[_0xced3('0x42')](_0x19316c[_0xced3('0x3d')],qs[_0xced3('0x43')](_0xb6530d[_0xced3('0x3e')]['fields']));_0x86551['attributes']=_0x86551[_0xced3('0x41')][_0xced3('0x44')]?_0x86551[_0xced3('0x41')]:_0x19316c[_0xced3('0x3d')];_0x86551[_0xced3('0x47')]=qs[_0xced3('0x48')](_0xb6530d[_0xced3('0x3e')][_0xced3('0x48')]);_0x86551['where']=qs['filters'](_[_0xced3('0x59')](_0xb6530d[_0xced3('0x3e')],_0x19316c[_0xced3('0x40')]));if(_0xb6530d[_0xced3('0x3e')][_0xced3('0x4a')]){_0x86551[_0xced3('0x49')]=_[_0xced3('0x4c')](_0x86551[_0xced3('0x49')],{'$or':_[_0xced3('0x39')](_0x86551[_0xced3('0x41')],function(_0xf65324){var _0x4da239={};_0x4da239[_0xf65324]={'$like':'%'+_0xb6530d[_0xced3('0x3e')]['filter']+'%'};return _0x4da239;})});}_0x86551=_[_0xced3('0x4c')]({},_0x86551,_0xb6530d[_0xced3('0x58')]);return _0x6037a8[_0xced3('0x5b')](_0x86551);}})[_0xced3('0x1c')](function(_0x1df2d1){if(_0x1df2d1){_0x54ce0d=_0x1df2d1[_0xced3('0x44')];if(!_0xb6530d[_0xced3('0x3e')][_0xced3('0x45')](_0xced3('0x46'))){_0x86551[_0xced3('0x2c')]=qs[_0xced3('0x2c')](_0xb6530d[_0xced3('0x3e')][_0xced3('0x2c')]);_0x86551[_0xced3('0x2b')]=qs[_0xced3('0x2b')](_0xb6530d[_0xced3('0x3e')][_0xced3('0x2b')]);}return _0x6037a8['getDescriptions'](_0x86551);}})['then'](function(_0x4e3bcf){if(_0x4e3bcf){return _0x4e3bcf?{'count':_0x54ce0d,'rows':_0x4e3bcf}:null;}})[_0xced3('0x1c')](respondWithResult(_0x32d7c2,null))[_0xced3('0x27')](handleError(_0x32d7c2,null));}; \ No newline at end of file +var _0x087b=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','name','index','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','count','includeAll','ServicenowConfiguration','rows','catch','params','rawAttributes','include','create','body','find','getFields','sort','pick','getSubjects','findOne','ServicenowField','getDescriptions','html-pdf','eml-format','fast-json-patch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x087b,0x11a));var _0xb087=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x087b[_0x87b0ff];return _0x3bc0b2;};'use strict';var pdf=require(_0xb087('0x0'));var emlformat=require(_0xb087('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb087('0x2'));var rp=require('request-promise');var moment=require(_0xb087('0x3'));var BPromise=require(_0xb087('0x4'));var Mustache=require(_0xb087('0x5'));var util=require(_0xb087('0x6'));var path=require(_0xb087('0x7'));var sox=require(_0xb087('0x8'));var csv=require(_0xb087('0x9'));var ejs=require(_0xb087('0xa'));var fs=require('fs');var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x9'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb087('0x1a'));var client=jayson[_0xb087('0x1b')][_0xb087('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x51ceaa,_0x3001e3,_0x3f145e){if(_0x3f145e){var _0x43f136=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43f136[_0xb087('0x1d')](_0x3001e3)){return _0x51ceaa;}else{throw new db[(_0xb087('0x1e'))][(_0xb087('0x1f'))](_0xb087('0x20'));}}else{return _0x51ceaa;}}function respondWithRpcPromise(_0x5147e3,_0x24e1a3,_0x16d0b7,_0x5193a4){return new BPromise(function(_0x43e576,_0x412b48){var _0x597478=_0x5193a4||client;return _0x597478[_0xb087('0x21')](_0x5147e3,_0x16d0b7)[_0xb087('0x22')](function(_0x2e9e74){logger['info'](_0xb087('0x23'),_0x24e1a3,_0xb087('0x24'));logger[_0xb087('0x25')](_0xb087('0x26'),_0x24e1a3,'request\x20sent',JSON[_0xb087('0x27')](_0x2e9e74));if(_0x2e9e74[_0xb087('0x28')]){if(_0x2e9e74[_0xb087('0x28')][_0xb087('0x29')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x24e1a3,_0x2e9e74['error']['message']);return _0x412b48(_0x2e9e74[_0xb087('0x28')][_0xb087('0x2a')]);}logger[_0xb087('0x28')](_0xb087('0x23'),_0x24e1a3,_0x2e9e74[_0xb087('0x28')][_0xb087('0x2a')]);return _0x43e576(_0x2e9e74[_0xb087('0x28')]['message']);}else{logger[_0xb087('0x2b')](_0xb087('0x23'),_0x24e1a3,_0xb087('0x24'));_0x43e576(_0x2e9e74[_0xb087('0x2c')][_0xb087('0x2a')]);}})['catch'](function(_0x183eab){logger[_0xb087('0x28')]('ServicenowConfiguration,\x20%s,\x20%s',_0x24e1a3,_0x183eab);_0x412b48(_0x183eab);});});}function respondWithStatusCode(_0x5a2dc6,_0x50745a){_0x50745a=_0x50745a||0xcc;return function(_0x598b99){if(_0x598b99){return _0x5a2dc6['sendStatus'](_0x50745a);}return _0x5a2dc6[_0xb087('0x2d')](_0x50745a)[_0xb087('0x2e')]();};}function respondWithResult(_0x1d124f,_0x3ca2df){_0x3ca2df=_0x3ca2df||0xc8;return function(_0xd9ec66){if(_0xd9ec66){return _0x1d124f[_0xb087('0x2d')](_0x3ca2df)[_0xb087('0x2f')](_0xd9ec66);}};}function respondWithFilteredResult(_0x35a52c,_0x6cfb22){return function(_0x1551c3){if(_0x1551c3){var _0x18058c=_0x1551c3['count'],_0x31e3e6=_0x6cfb22[_0xb087('0x30')],_0xb0baf6=_0x6cfb22[_0xb087('0x30')]+_0x6cfb22[_0xb087('0x31')],_0x263259;if(_0xb0baf6>=_0x18058c){_0xb0baf6=_0x18058c;_0x263259=0xc8;}else{_0x263259=0xce;}_0x35a52c[_0xb087('0x2d')](_0x263259);return _0x35a52c[_0xb087('0x32')](_0xb087('0x33'),_0x31e3e6+'-'+_0xb0baf6+'/'+_0x18058c)[_0xb087('0x2f')](_0x1551c3);}return null;};}function patchUpdates(_0x13fb2f){return function(_0x53a535){try{jsonpatch['apply'](_0x53a535,_0x13fb2f,!![]);}catch(_0x3f9311){return BPromise[_0xb087('0x34')](_0x3f9311);}return _0x53a535['save']();};}function saveUpdates(_0x60bfe2,_0x7d3776){return function(_0x2a48d3){if(_0x2a48d3){return _0x2a48d3[_0xb087('0x35')](_0x60bfe2)[_0xb087('0x22')](function(_0x427905){return _0x427905;});}return null;};}function removeEntity(_0xa2ac06,_0x3b7ace){return function(_0x8f4f02){if(_0x8f4f02){return _0x8f4f02[_0xb087('0x36')]()[_0xb087('0x22')](function(){_0xa2ac06[_0xb087('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bec03,_0x501ebe){return function(_0x906987){if(!_0x906987){_0x3bec03[_0xb087('0x37')](0x194);}return _0x906987;};}function handleError(_0x738e68,_0xd0659e){_0xd0659e=_0xd0659e||0x1f4;return function(_0x13cb5d){logger[_0xb087('0x28')](_0x13cb5d[_0xb087('0x38')]);if(_0x13cb5d[_0xb087('0x39')]){delete _0x13cb5d[_0xb087('0x39')];}_0x738e68['status'](_0xd0659e)['send'](_0x13cb5d);};}exports[_0xb087('0x3a')]=function(_0x3c4f33,_0x1ce1ef){var _0x2d2902={},_0x1982a8={},_0x5ca9b6={'count':0x0,'rows':[]};var _0x1f24f4=_[_0xb087('0x3b')](db['ServicenowConfiguration']['rawAttributes'],function(_0x1726c2){return{'name':_0x1726c2[_0xb087('0x3c')],'type':_0x1726c2[_0xb087('0x3d')]['key']};});_0x1982a8[_0xb087('0x3e')]=_[_0xb087('0x3b')](_0x1f24f4,_0xb087('0x39'));_0x1982a8[_0xb087('0x3f')]=_[_0xb087('0x40')](_0x3c4f33['query']);_0x1982a8[_0xb087('0x41')]=_['intersection'](_0x1982a8[_0xb087('0x3e')],_0x1982a8['query']);_0x2d2902[_0xb087('0x42')]=_[_0xb087('0x43')](_0x1982a8['model'],qs[_0xb087('0x44')](_0x3c4f33['query'][_0xb087('0x44')]));_0x2d2902['attributes']=_0x2d2902[_0xb087('0x42')][_0xb087('0x45')]?_0x2d2902[_0xb087('0x42')]:_0x1982a8[_0xb087('0x3e')];if(!_0x3c4f33[_0xb087('0x3f')][_0xb087('0x46')](_0xb087('0x47'))){_0x2d2902['limit']=qs[_0xb087('0x31')](_0x3c4f33['query'][_0xb087('0x31')]);_0x2d2902[_0xb087('0x30')]=qs['offset'](_0x3c4f33[_0xb087('0x3f')][_0xb087('0x30')]);}_0x2d2902[_0xb087('0x48')]=qs['sort'](_0x3c4f33[_0xb087('0x3f')]['sort']);_0x2d2902[_0xb087('0x49')]=qs[_0xb087('0x41')](_['pick'](_0x3c4f33[_0xb087('0x3f')],_0x1982a8[_0xb087('0x41')]),_0x1f24f4);if(_0x3c4f33['query'][_0xb087('0x4a')]){_0x2d2902[_0xb087('0x49')]=_['merge'](_0x2d2902[_0xb087('0x49')],{'$or':_[_0xb087('0x3b')](_0x1f24f4,function(_0x1d7f80){if(_0x1d7f80[_0xb087('0x3d')]!=='VIRTUAL'){var _0x47902e={};_0x47902e[_0x1d7f80[_0xb087('0x39')]]={'$like':'%'+_0x3c4f33[_0xb087('0x3f')][_0xb087('0x4a')]+'%'};return _0x47902e;}})});}_0x2d2902=_[_0xb087('0x4b')]({},_0x2d2902,_0x3c4f33[_0xb087('0x4c')]);var _0x16a7b4={'where':_0x2d2902['where']};return db['ServicenowConfiguration'][_0xb087('0x4d')](_0x16a7b4)['then'](function(_0x3a405b){_0x5ca9b6[_0xb087('0x4d')]=_0x3a405b;if(_0x3c4f33[_0xb087('0x3f')][_0xb087('0x4e')]){_0x2d2902['include']=[{'all':!![]}];}return db[_0xb087('0x4f')]['findAll'](_0x2d2902);})[_0xb087('0x22')](function(_0x73413b){_0x5ca9b6[_0xb087('0x50')]=_0x73413b;return _0x5ca9b6;})[_0xb087('0x22')](respondWithFilteredResult(_0x1ce1ef,_0x2d2902))[_0xb087('0x51')](handleError(_0x1ce1ef,null));};exports['show']=function(_0x21506f,_0xb15e28){var _0x588d96={'raw':![],'where':{'id':_0x21506f[_0xb087('0x52')]['id']}},_0x4fba31={};_0x4fba31['model']=_['keys'](db[_0xb087('0x4f')][_0xb087('0x53')]);_0x4fba31['query']=_[_0xb087('0x40')](_0x21506f[_0xb087('0x3f')]);_0x4fba31[_0xb087('0x41')]=_['intersection'](_0x4fba31['model'],_0x4fba31[_0xb087('0x3f')]);_0x588d96['attributes']=_['intersection'](_0x4fba31[_0xb087('0x3e')],qs[_0xb087('0x44')](_0x21506f[_0xb087('0x3f')][_0xb087('0x44')]));_0x588d96[_0xb087('0x42')]=_0x588d96[_0xb087('0x42')][_0xb087('0x45')]?_0x588d96[_0xb087('0x42')]:_0x4fba31[_0xb087('0x3e')];if(_0x21506f[_0xb087('0x3f')][_0xb087('0x4e')]){_0x588d96[_0xb087('0x54')]=[{'all':!![]}];}_0x588d96=_['merge']({},_0x588d96,_0x21506f[_0xb087('0x4c')]);return db[_0xb087('0x4f')]['find'](_0x588d96)[_0xb087('0x22')](handleEntityNotFound(_0xb15e28,null))[_0xb087('0x22')](respondWithResult(_0xb15e28,null))[_0xb087('0x51')](handleError(_0xb15e28,null));};exports[_0xb087('0x55')]=function(_0x401901,_0x3c85d1){return db[_0xb087('0x4f')][_0xb087('0x55')](_0x401901[_0xb087('0x56')],{})[_0xb087('0x22')](respondWithResult(_0x3c85d1,0xc9))[_0xb087('0x51')](handleError(_0x3c85d1,null));};exports['update']=function(_0x269eda,_0x56410e){if(_0x269eda[_0xb087('0x56')]['id']){delete _0x269eda['body']['id'];}return db[_0xb087('0x4f')][_0xb087('0x57')]({'where':{'id':_0x269eda[_0xb087('0x52')]['id']}})[_0xb087('0x22')](handleEntityNotFound(_0x56410e,null))[_0xb087('0x22')](saveUpdates(_0x269eda[_0xb087('0x56')],null))[_0xb087('0x22')](respondWithResult(_0x56410e,null))[_0xb087('0x51')](handleError(_0x56410e,null));};exports[_0xb087('0x36')]=function(_0x323e0a,_0x300e9b){return db[_0xb087('0x4f')][_0xb087('0x57')]({'where':{'id':_0x323e0a[_0xb087('0x52')]['id']}})[_0xb087('0x22')](handleEntityNotFound(_0x300e9b,null))[_0xb087('0x22')](removeEntity(_0x300e9b,null))[_0xb087('0x51')](handleError(_0x300e9b,null));};exports[_0xb087('0x58')]=function(_0x40ff74,_0xe3cb2,_0x4053c8){var _0x459c5b={};var _0x551274={};var _0x43be69;var _0x1f893a;return db[_0xb087('0x4f')]['findOne']({'where':{'id':_0x40ff74[_0xb087('0x52')]['id']}})[_0xb087('0x22')](handleEntityNotFound(_0xe3cb2,null))['then'](function(_0x24d821){if(_0x24d821){_0x43be69=_0x24d821;_0x551274[_0xb087('0x3e')]=_[_0xb087('0x40')](db['ServicenowField'][_0xb087('0x53')]);_0x551274[_0xb087('0x3f')]=_[_0xb087('0x40')](_0x40ff74[_0xb087('0x3f')]);_0x551274[_0xb087('0x41')]=_[_0xb087('0x43')](_0x551274[_0xb087('0x3e')],_0x551274[_0xb087('0x3f')]);_0x459c5b['attributes']=_[_0xb087('0x43')](_0x551274[_0xb087('0x3e')],qs[_0xb087('0x44')](_0x40ff74['query'][_0xb087('0x44')]));_0x459c5b['attributes']=_0x459c5b['attributes'][_0xb087('0x45')]?_0x459c5b[_0xb087('0x42')]:_0x551274['model'];_0x459c5b[_0xb087('0x48')]=qs['sort'](_0x40ff74[_0xb087('0x3f')][_0xb087('0x59')]);_0x459c5b['where']=qs['filters'](_[_0xb087('0x5a')](_0x40ff74['query'],_0x551274['filters']));if(_0x40ff74[_0xb087('0x3f')]['filter']){_0x459c5b[_0xb087('0x49')]=_['merge'](_0x459c5b[_0xb087('0x49')],{'$or':_[_0xb087('0x3b')](_0x459c5b[_0xb087('0x42')],function(_0x2a6b2e){var _0x4e1683={};_0x4e1683[_0x2a6b2e]={'$like':'%'+_0x40ff74[_0xb087('0x3f')]['filter']+'%'};return _0x4e1683;})});}_0x459c5b=_[_0xb087('0x4b')]({},_0x459c5b,_0x40ff74['options']);return _0x43be69[_0xb087('0x58')](_0x459c5b);}})[_0xb087('0x22')](function(_0x1060e1){if(_0x1060e1){_0x1f893a=_0x1060e1['length'];if(!_0x40ff74[_0xb087('0x3f')]['hasOwnProperty'](_0xb087('0x47'))){_0x459c5b[_0xb087('0x31')]=qs[_0xb087('0x31')](_0x40ff74[_0xb087('0x3f')][_0xb087('0x31')]);_0x459c5b[_0xb087('0x30')]=qs['offset'](_0x40ff74[_0xb087('0x3f')][_0xb087('0x30')]);}return _0x43be69['getFields'](_0x459c5b);}})[_0xb087('0x22')](function(_0x58de88){if(_0x58de88){return _0x58de88?{'count':_0x1f893a,'rows':_0x58de88}:null;}})[_0xb087('0x22')](respondWithResult(_0xe3cb2,null))[_0xb087('0x51')](handleError(_0xe3cb2,null));};exports[_0xb087('0x5b')]=function(_0xce221c,_0x35091b,_0x3c260b){var _0x280ab4={};var _0x186b40={};var _0x509ee7;var _0x55ab5d;return db['ServicenowConfiguration'][_0xb087('0x5c')]({'where':{'id':_0xce221c['params']['id']}})[_0xb087('0x22')](handleEntityNotFound(_0x35091b,null))['then'](function(_0x11c4b0){if(_0x11c4b0){_0x509ee7=_0x11c4b0;_0x186b40[_0xb087('0x3e')]=_[_0xb087('0x40')](db[_0xb087('0x5d')]['rawAttributes']);_0x186b40[_0xb087('0x3f')]=_['keys'](_0xce221c[_0xb087('0x3f')]);_0x186b40[_0xb087('0x41')]=_[_0xb087('0x43')](_0x186b40[_0xb087('0x3e')],_0x186b40['query']);_0x280ab4['attributes']=_[_0xb087('0x43')](_0x186b40['model'],qs[_0xb087('0x44')](_0xce221c[_0xb087('0x3f')][_0xb087('0x44')]));_0x280ab4[_0xb087('0x42')]=_0x280ab4['attributes']['length']?_0x280ab4[_0xb087('0x42')]:_0x186b40['model'];_0x280ab4[_0xb087('0x48')]=qs[_0xb087('0x59')](_0xce221c[_0xb087('0x3f')][_0xb087('0x59')]);_0x280ab4[_0xb087('0x49')]=qs['filters'](_[_0xb087('0x5a')](_0xce221c[_0xb087('0x3f')],_0x186b40['filters']));if(_0xce221c['query']['filter']){_0x280ab4[_0xb087('0x49')]=_[_0xb087('0x4b')](_0x280ab4[_0xb087('0x49')],{'$or':_[_0xb087('0x3b')](_0x280ab4[_0xb087('0x42')],function(_0x19d7ae){var _0x47ea48={};_0x47ea48[_0x19d7ae]={'$like':'%'+_0xce221c[_0xb087('0x3f')][_0xb087('0x4a')]+'%'};return _0x47ea48;})});}_0x280ab4=_[_0xb087('0x4b')]({},_0x280ab4,_0xce221c[_0xb087('0x4c')]);return _0x509ee7[_0xb087('0x5b')](_0x280ab4);}})[_0xb087('0x22')](function(_0x33ab61){if(_0x33ab61){_0x55ab5d=_0x33ab61['length'];if(!_0xce221c[_0xb087('0x3f')][_0xb087('0x46')](_0xb087('0x47'))){_0x280ab4['limit']=qs[_0xb087('0x31')](_0xce221c['query'][_0xb087('0x31')]);_0x280ab4[_0xb087('0x30')]=qs[_0xb087('0x30')](_0xce221c[_0xb087('0x3f')][_0xb087('0x30')]);}return _0x509ee7[_0xb087('0x5b')](_0x280ab4);}})['then'](function(_0x4ae3bb){if(_0x4ae3bb){return _0x4ae3bb?{'count':_0x55ab5d,'rows':_0x4ae3bb}:null;}})[_0xb087('0x22')](respondWithResult(_0x35091b,null))[_0xb087('0x51')](handleError(_0x35091b,null));};exports['getDescriptions']=function(_0x1e91a1,_0xc9b209,_0x256015){var _0x2618d6={};var _0x308683={};var _0x631bc7;var _0x4d34e2;return db[_0xb087('0x4f')][_0xb087('0x5c')]({'where':{'id':_0x1e91a1[_0xb087('0x52')]['id']}})[_0xb087('0x22')](handleEntityNotFound(_0xc9b209,null))[_0xb087('0x22')](function(_0x3d6d1a){if(_0x3d6d1a){_0x631bc7=_0x3d6d1a;_0x308683[_0xb087('0x3e')]=_[_0xb087('0x40')](db[_0xb087('0x5d')]['rawAttributes']);_0x308683[_0xb087('0x3f')]=_['keys'](_0x1e91a1[_0xb087('0x3f')]);_0x308683[_0xb087('0x41')]=_['intersection'](_0x308683[_0xb087('0x3e')],_0x308683[_0xb087('0x3f')]);_0x2618d6[_0xb087('0x42')]=_[_0xb087('0x43')](_0x308683[_0xb087('0x3e')],qs[_0xb087('0x44')](_0x1e91a1['query'][_0xb087('0x44')]));_0x2618d6[_0xb087('0x42')]=_0x2618d6[_0xb087('0x42')][_0xb087('0x45')]?_0x2618d6[_0xb087('0x42')]:_0x308683['model'];_0x2618d6[_0xb087('0x48')]=qs[_0xb087('0x59')](_0x1e91a1[_0xb087('0x3f')][_0xb087('0x59')]);_0x2618d6[_0xb087('0x49')]=qs[_0xb087('0x41')](_[_0xb087('0x5a')](_0x1e91a1[_0xb087('0x3f')],_0x308683[_0xb087('0x41')]));if(_0x1e91a1[_0xb087('0x3f')][_0xb087('0x4a')]){_0x2618d6['where']=_['merge'](_0x2618d6[_0xb087('0x49')],{'$or':_[_0xb087('0x3b')](_0x2618d6[_0xb087('0x42')],function(_0x28e3a3){var _0x2f49df={};_0x2f49df[_0x28e3a3]={'$like':'%'+_0x1e91a1['query'][_0xb087('0x4a')]+'%'};return _0x2f49df;})});}_0x2618d6=_[_0xb087('0x4b')]({},_0x2618d6,_0x1e91a1[_0xb087('0x4c')]);return _0x631bc7[_0xb087('0x5e')](_0x2618d6);}})[_0xb087('0x22')](function(_0xbe2a4c){if(_0xbe2a4c){_0x4d34e2=_0xbe2a4c['length'];if(!_0x1e91a1[_0xb087('0x3f')]['hasOwnProperty']('nolimit')){_0x2618d6[_0xb087('0x31')]=qs[_0xb087('0x31')](_0x1e91a1[_0xb087('0x3f')][_0xb087('0x31')]);_0x2618d6['offset']=qs[_0xb087('0x30')](_0x1e91a1[_0xb087('0x3f')]['offset']);}return _0x631bc7[_0xb087('0x5e')](_0x2618d6);}})['then'](function(_0x53af09){if(_0x53af09){return _0x53af09?{'count':_0x4d34e2,'rows':_0x53af09}:null;}})[_0xb087('0x22')](respondWithResult(_0xc9b209,null))[_0xb087('0x51')](handleError(_0xc9b209,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b8f3dae..1831521 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 _0x9d1d=['int_servicenow_configurations','util','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0x384691,_0x1f4e03){var _0x28b395=function(_0x541706){while(--_0x541706){_0x384691['push'](_0x384691['shift']());}};_0x28b395(++_0x1f4e03);}(_0x9d1d,0x1d5));var _0xd9d1=function(_0x59cea2,_0x2c4be0){_0x59cea2=_0x59cea2-0x0;var _0x3658c0=_0x9d1d[_0x59cea2];return _0x3658c0;};'use strict';var _=require('lodash');var util=require(_0xd9d1('0x0'));var logger=require('../../config/logger')(_0xd9d1('0x1'));var moment=require(_0xd9d1('0x2'));var BPromise=require(_0xd9d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9d1('0x4'));var rimraf=require(_0xd9d1('0x5'));var config=require(_0xd9d1('0x6'));var attributes=require(_0xd9d1('0x7'));module[_0xd9d1('0x8')]=function(_0x109136,_0x3f129f){return _0x109136[_0xd9d1('0x9')](_0xd9d1('0xa'),attributes,{'tableName':_0xd9d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05e2=['path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','request-promise'];(function(_0x5538cf,_0x38ba3e){var _0x449668=function(_0x178116){while(--_0x178116){_0x5538cf['push'](_0x5538cf['shift']());}};_0x449668(++_0x38ba3e);}(_0x05e2,0xb0));var _0x205e=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x05e2[_0x85d5a8];return _0x20479b;};'use strict';var _=require(_0x205e('0x0'));var util=require(_0x205e('0x1'));var logger=require(_0x205e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x205e('0x3'));var fs=require('fs');var path=require(_0x205e('0x4'));var rimraf=require('rimraf');var config=require(_0x205e('0x5'));var attributes=require(_0x205e('0x6'));module[_0x205e('0x7')]=function(_0x13439c,_0x42037d){return _0x13439c[_0x205e('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x205e('0x9'),'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 96c3d92..15f4371 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 _0xabce=['code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x517eac,_0x1de93c){var _0x1a5fbf=function(_0x5b0e93){while(--_0x5b0e93){_0x517eac['push'](_0x517eac['shift']());}};_0x1a5fbf(++_0x1de93c);}(_0xabce,0x71));var _0xeabc=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xabce[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0xeabc('0x0'));var util=require('util');var moment=require(_0xeabc('0x1'));var BPromise=require(_0xeabc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeabc('0x3'));var db=require(_0xeabc('0x4'))['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require(_0xeabc('0x8'));var jayson=require(_0xeabc('0x9'));var client=jayson[_0xeabc('0xa')][_0xeabc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xec47d0,_0x4086ce,_0x59afff){return new BPromise(function(_0x3af4e6,_0x196d91){return client[_0xeabc('0xc')](_0xec47d0,_0x59afff)['then'](function(_0x2eaaa6){logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x4086ce,_0xeabc('0xf'));logger[_0xeabc('0x10')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4086ce,_0xeabc('0xf'),JSON[_0xeabc('0x11')](_0x2eaaa6));if(_0x2eaaa6['error']){if(_0x2eaaa6[_0xeabc('0x12')][_0xeabc('0x13')]===0x1f4){logger[_0xeabc('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4086ce,_0x2eaaa6[_0xeabc('0x12')][_0xeabc('0x14')]);return _0x196d91(_0x2eaaa6[_0xeabc('0x12')][_0xeabc('0x14')]);}logger[_0xeabc('0x12')](_0xeabc('0xe'),_0x4086ce,_0x2eaaa6[_0xeabc('0x12')][_0xeabc('0x14')]);return _0x3af4e6(_0x2eaaa6[_0xeabc('0x12')][_0xeabc('0x14')]);}else{logger[_0xeabc('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4086ce,_0xeabc('0xf'));_0x3af4e6(_0x2eaaa6[_0xeabc('0x15')][_0xeabc('0x14')]);}})['catch'](function(_0x3ef67b){logger[_0xeabc('0x12')](_0xeabc('0xe'),_0x4086ce,_0x3ef67b);_0x196d91(_0x3ef67b);});});} \ No newline at end of file +var _0x8c73=['../../config/environment','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x392213,_0x471e97){var _0x5b9b9f=function(_0x18a6ea){while(--_0x18a6ea){_0x392213['push'](_0x392213['shift']());}};_0x5b9b9f(++_0x471e97);}(_0x8c73,0xd5));var _0x38c7=function(_0x168ec3,_0x41697a){_0x168ec3=_0x168ec3-0x0;var _0x3351ee=_0x8c73[_0x168ec3];return _0x3351ee;};'use strict';var _=require(_0x38c7('0x0'));var util=require(_0x38c7('0x1'));var moment=require(_0x38c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x38c7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x38c7('0x4'));var logger=require(_0x38c7('0x5'))(_0x38c7('0x6'));var config=require(_0x38c7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x38c7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x649b5c,_0x3e9120,_0x1fc718){return new BPromise(function(_0x9745fa,_0x473656){return client[_0x38c7('0x9')](_0x649b5c,_0x1fc718)[_0x38c7('0xa')](function(_0x9c7edf){logger[_0x38c7('0xb')](_0x38c7('0xc'),_0x3e9120,_0x38c7('0xd'));logger[_0x38c7('0xe')](_0x38c7('0xf'),_0x3e9120,_0x38c7('0xd'),JSON['stringify'](_0x9c7edf));if(_0x9c7edf['error']){if(_0x9c7edf['error'][_0x38c7('0x10')]===0x1f4){logger[_0x38c7('0x11')](_0x38c7('0xc'),_0x3e9120,_0x9c7edf[_0x38c7('0x11')][_0x38c7('0x12')]);return _0x473656(_0x9c7edf[_0x38c7('0x11')]['message']);}logger[_0x38c7('0x11')](_0x38c7('0xc'),_0x3e9120,_0x9c7edf[_0x38c7('0x11')][_0x38c7('0x12')]);return _0x9745fa(_0x9c7edf[_0x38c7('0x11')]['message']);}else{logger[_0x38c7('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3e9120,'request\x20sent');_0x9745fa(_0x9c7edf['result'][_0x38c7('0x12')]);}})[_0x38c7('0x13')](function(_0x2a1406){logger[_0x38c7('0x11')](_0x38c7('0xc'),_0x3e9120,_0x2a1406);_0x473656(_0x2a1406);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index affceae..3f733d7 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 _0xb504=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb504,0xe2));var _0x4b50=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb504[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x4b50('0x0'));var path=require(_0x4b50('0x1'));var timeout=require(_0x4b50('0x2'));var express=require(_0x4b50('0x3'));var router=express['Router']();var auth=require(_0x4b50('0x4'));var interaction=require(_0x4b50('0x5'));var config=require(_0x4b50('0x6'));var controller=require(_0x4b50('0x7'));router[_0x4b50('0x8')]('/',auth[_0x4b50('0x9')](),controller[_0x4b50('0xa')]);router[_0x4b50('0x8')](_0x4b50('0xb'),auth[_0x4b50('0x9')](),controller[_0x4b50('0xc')]);router[_0x4b50('0xd')]('/',auth[_0x4b50('0x9')](),controller[_0x4b50('0xe')]);router[_0x4b50('0xf')](_0x4b50('0xb'),auth[_0x4b50('0x9')](),controller[_0x4b50('0x10')]);router[_0x4b50('0x11')](_0x4b50('0xb'),auth[_0x4b50('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x98c8=['../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','create','/:id','delete','destroy','multer','util','express','Router','../../components/auth/service'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0x98c8,0xd8));var _0x898c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x98c8[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x898c('0x0'));var util=require(_0x898c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x898c('0x2'));var router=express[_0x898c('0x3')]();var auth=require(_0x898c('0x4'));var interaction=require(_0x898c('0x5'));var config=require('../../config/environment');var controller=require(_0x898c('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x898c('0x7')]('/:id',auth[_0x898c('0x8')](),controller['show']);router['post']('/',auth[_0x898c('0x8')](),controller[_0x898c('0x9')]);router['put'](_0x898c('0xa'),auth[_0x898c('0x8')](),controller['update']);router[_0x898c('0xb')](_0x898c('0xa'),auth['isAuthenticated'](),controller[_0x898c('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f64886e..04d73ce 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 _0x6f1e=['sequelize','exports','string','STRING','ENUM','customVariable'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x6f1e,0x1e0));var _0xe6f1=function(_0xd8b029,_0x19a82f){_0xd8b029=_0xd8b029-0x0;var _0x34e23a=_0x6f1e[_0xd8b029];return _0x34e23a;};'use strict';var Sequelize=require(_0xe6f1('0x0'));module[_0xe6f1('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe6f1('0x2'),'variable','customVariable','keyValue'),'defaultValue':_0xe6f1('0x2')},'content':{'type':Sequelize[_0xe6f1('0x3')]},'key':{'type':Sequelize[_0xe6f1('0x3')]},'keyType':{'type':Sequelize[_0xe6f1('0x4')]('string','variable',_0xe6f1('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe6f1('0x3')]},'nameField':{'type':Sequelize[_0xe6f1('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe6f1('0x3')]}}; \ No newline at end of file +var _0x078a=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x3ba58c,_0x11e7e8){var _0x34b9ff=function(_0x5be0ee){while(--_0x5be0ee){_0x3ba58c['push'](_0x3ba58c['shift']());}};_0x34b9ff(++_0x11e7e8);}(_0x078a,0x1c1));var _0xa078=function(_0x43fd01,_0x421112){_0x43fd01=_0x43fd01-0x0;var _0x12e24a=_0x078a[_0x43fd01];return _0x12e24a;};'use strict';var Sequelize=require(_0xa078('0x0'));module[_0xa078('0x1')]={'type':{'type':Sequelize[_0xa078('0x2')]('string',_0xa078('0x3'),_0xa078('0x4'),_0xa078('0x5')),'defaultValue':_0xa078('0x6')},'content':{'type':Sequelize[_0xa078('0x7')]},'key':{'type':Sequelize[_0xa078('0x7')]},'keyType':{'type':Sequelize[_0xa078('0x2')](_0xa078('0x6'),_0xa078('0x3'),_0xa078('0x4'))},'keyContent':{'type':Sequelize[_0xa078('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa078('0x7')]},'customField':{'type':Sequelize[_0xa078('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa078('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 2e450c7..07fef54 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0xdafc10,_0x2828e2){var _0x3cf329=function(_0x1f2e2f){while(--_0x1f2e2f){_0xdafc10['push'](_0xdafc10['shift']());}};_0x3cf329(++_0x2828e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x245f3c,_0x4cca75){var _0x110dbd=function(_0x3bf1a8){while(--_0x3bf1a8){_0x245f3c['push'](_0x245f3c['shift']());}};_0x110dbd(++_0x4cca75);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 52f967c..311c1cf 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 _0xe171=['lodash','util','moment','bluebird','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId'];(function(_0x475bf1,_0x5235b6){var _0x4095d1=function(_0x30fe72){while(--_0x30fe72){_0x475bf1['push'](_0x475bf1['shift']());}};_0x4095d1(++_0x5235b6);}(_0xe171,0xd0));var _0x1e17=function(_0x200a0e,_0x5387b3){_0x200a0e=_0x200a0e-0x0;var _0x2a8795=_0xe171[_0x200a0e];return _0x2a8795;};'use strict';var _=require(_0x1e17('0x0'));var util=require(_0x1e17('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1e17('0x2'));var BPromise=require(_0x1e17('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e17('0x4'));var rimraf=require(_0x1e17('0x5'));var config=require('../../config/environment');var attributes=require(_0x1e17('0x6'));module[_0x1e17('0x7')]=function(_0x4ad19e,_0x1a182c){return _0x4ad19e[_0x1e17('0x8')](_0x1e17('0x9'),attributes,{'tableName':_0x1e17('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x1e17('0xb'),_0x1e17('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f4d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','int_servicenow_fields','servicenow_unique_index','idField','lodash'];(function(_0x150c80,_0x3122e5){var _0x185eee=function(_0x3fd9da){while(--_0x3fd9da){_0x150c80['push'](_0x150c80['shift']());}};_0x185eee(++_0x3122e5);}(_0x1f4d,0x144));var _0xd1f4=function(_0x20f0b4,_0x2fd7a4){_0x20f0b4=_0x20f0b4-0x0;var _0x1a5eed=_0x1f4d[_0x20f0b4];return _0x1a5eed;};'use strict';var _=require(_0xd1f4('0x0'));var util=require(_0xd1f4('0x1'));var logger=require(_0xd1f4('0x2'))(_0xd1f4('0x3'));var moment=require(_0xd1f4('0x4'));var BPromise=require(_0xd1f4('0x5'));var rp=require(_0xd1f4('0x6'));var fs=require('fs');var path=require(_0xd1f4('0x7'));var rimraf=require(_0xd1f4('0x8'));var config=require(_0xd1f4('0x9'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x32ed3d,_0xf952a5){return _0x32ed3d['define']('ServicenowField',attributes,{'tableName':_0xd1f4('0xa'),'paranoid':![],'indexes':[{'name':_0xd1f4('0xb'),'fields':[_0xd1f4('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index f744230..0c0428b 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 _0x4522=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ServicenowField,\x20%s,\x20%s','ServicenowField,\x20%s,\x20%s,\x20%s','error','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4c902f,_0x50b8a5){var _0x4ba147=function(_0xa89aa4){while(--_0xa89aa4){_0x4c902f['push'](_0x4c902f['shift']());}};_0x4ba147(++_0x50b8a5);}(_0x4522,0xc0));var _0x2452=function(_0x3fbe87,_0x56c42e){_0x3fbe87=_0x3fbe87-0x0;var _0x219501=_0x4522[_0x3fbe87];return _0x219501;};'use strict';var _=require(_0x2452('0x0'));var util=require(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require(_0x2452('0x3'));var rs=require(_0x2452('0x4'));var fs=require('fs');var Redis=require(_0x2452('0x5'));var db=require(_0x2452('0x6'))['db'];var utils=require(_0x2452('0x7'));var logger=require(_0x2452('0x8'))(_0x2452('0x9'));var config=require(_0x2452('0xa'));var jayson=require(_0x2452('0xb'));var client=jayson[_0x2452('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2582,_0x1e1b9c,_0x12256c){return new BPromise(function(_0x1c00c2,_0x389ddc){return client['request'](_0x5b2582,_0x12256c)['then'](function(_0xb13823){logger[_0x2452('0xd')](_0x2452('0xe'),_0x1e1b9c,'request\x20sent');logger['debug'](_0x2452('0xf'),_0x1e1b9c,'request\x20sent',JSON['stringify'](_0xb13823));if(_0xb13823[_0x2452('0x10')]){if(_0xb13823['error']['code']===0x1f4){logger['error'](_0x2452('0xe'),_0x1e1b9c,_0xb13823['error'][_0x2452('0x11')]);return _0x389ddc(_0xb13823[_0x2452('0x10')][_0x2452('0x11')]);}logger[_0x2452('0x10')](_0x2452('0xe'),_0x1e1b9c,_0xb13823['error'][_0x2452('0x11')]);return _0x1c00c2(_0xb13823[_0x2452('0x10')][_0x2452('0x11')]);}else{logger[_0x2452('0xd')](_0x2452('0xe'),_0x1e1b9c,'request\x20sent');_0x1c00c2(_0xb13823['result'][_0x2452('0x11')]);}})['catch'](function(_0x25a1ae){logger['error']('ServicenowField,\x20%s,\x20%s',_0x1e1b9c,_0x25a1ae);_0x389ddc(_0x25a1ae);});});} \ No newline at end of file +var _0xea1f=['bluebird','ioredis','../../config/utils','rpc','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x3ad0bb,_0x2a7098){var _0x4359c6=function(_0x12b22a){while(--_0x12b22a){_0x3ad0bb['push'](_0x3ad0bb['shift']());}};_0x4359c6(++_0x2a7098);}(_0xea1f,0x7c));var _0xfea1=function(_0x149a21,_0x1db5c0){_0x149a21=_0x149a21-0x0;var _0x3f60d6=_0xea1f[_0x149a21];return _0x3f60d6;};'use strict';var _=require(_0xfea1('0x0'));var util=require('util');var moment=require(_0xfea1('0x1'));var BPromise=require(_0xfea1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfea1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfea1('0x4'));var logger=require('../../config/logger')(_0xfea1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b2eb7,_0x3d7ee8,_0x48e379){return new BPromise(function(_0x2cd858,_0xb863f1){return client['request'](_0x5b2eb7,_0x48e379)[_0xfea1('0x6')](function(_0x243d02){logger[_0xfea1('0x7')](_0xfea1('0x8'),_0x3d7ee8,_0xfea1('0x9'));logger[_0xfea1('0xa')](_0xfea1('0xb'),_0x3d7ee8,'request\x20sent',JSON[_0xfea1('0xc')](_0x243d02));if(_0x243d02[_0xfea1('0xd')]){if(_0x243d02[_0xfea1('0xd')][_0xfea1('0xe')]===0x1f4){logger[_0xfea1('0xd')](_0xfea1('0x8'),_0x3d7ee8,_0x243d02[_0xfea1('0xd')][_0xfea1('0xf')]);return _0xb863f1(_0x243d02[_0xfea1('0xd')][_0xfea1('0xf')]);}logger[_0xfea1('0xd')](_0xfea1('0x8'),_0x3d7ee8,_0x243d02[_0xfea1('0xd')][_0xfea1('0xf')]);return _0x2cd858(_0x243d02[_0xfea1('0xd')][_0xfea1('0xf')]);}else{logger[_0xfea1('0x7')](_0xfea1('0x8'),_0x3d7ee8,_0xfea1('0x9'));_0x2cd858(_0x243d02[_0xfea1('0x10')][_0xfea1('0xf')]);}})[_0xfea1('0x11')](function(_0x4a2b45){logger[_0xfea1('0xd')](_0xfea1('0x8'),_0x3d7ee8,_0x4a2b45);_0xb863f1(_0x4a2b45);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 52a86b9..2f37043 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 _0x15ca=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','post','addConfiguration','put'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x15ca,0x169));var _0xa15c=function(_0xf6366d,_0x318b2c){_0xf6366d=_0xf6366d-0x0;var _0x27f3c5=_0x15ca[_0xf6366d];return _0x27f3c5;};'use strict';var multer=require(_0xa15c('0x0'));var util=require('util');var path=require(_0xa15c('0x1'));var timeout=require(_0xa15c('0x2'));var express=require(_0xa15c('0x3'));var router=express[_0xa15c('0x4')]();var auth=require(_0xa15c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa15c('0x6'));var controller=require(_0xa15c('0x7'));router[_0xa15c('0x8')]('/',auth[_0xa15c('0x9')](),controller[_0xa15c('0xa')]);router[_0xa15c('0x8')](_0xa15c('0xb'),auth[_0xa15c('0x9')](),controller['show']);router['get'](_0xa15c('0xc'),auth['isAuthenticated'](),controller[_0xa15c('0xd')]);router[_0xa15c('0x8')]('/:id/fields',auth[_0xa15c('0x9')](),controller['getFields']);router[_0xa15c('0xe')]('/',auth[_0xa15c('0x9')](),controller['create']);router[_0xa15c('0xe')](_0xa15c('0xc'),auth[_0xa15c('0x9')](),controller[_0xa15c('0xf')]);router[_0xa15c('0x10')](_0xa15c('0xb'),auth[_0xa15c('0x9')](),controller[_0xa15c('0x11')]);router[_0xa15c('0x12')](_0xa15c('0xb'),auth[_0xa15c('0x9')](),controller[_0xa15c('0x13')]);module[_0xa15c('0x14')]=router; \ No newline at end of file +var _0x1ebe=['./intSugarcrmAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1ebe,0x1ae));var _0xe1eb=function(_0x4e88ed,_0x57cf08){_0x4e88ed=_0x4e88ed-0x0;var _0x2dc40e=_0x1ebe[_0x4e88ed];return _0x2dc40e;};'use strict';var multer=require(_0xe1eb('0x0'));var util=require(_0xe1eb('0x1'));var path=require(_0xe1eb('0x2'));var timeout=require(_0xe1eb('0x3'));var express=require(_0xe1eb('0x4'));var router=express[_0xe1eb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe1eb('0x6'));var config=require('../../config/environment');var controller=require(_0xe1eb('0x7'));router[_0xe1eb('0x8')]('/',auth[_0xe1eb('0x9')](),controller['index']);router[_0xe1eb('0x8')](_0xe1eb('0xa'),auth[_0xe1eb('0x9')](),controller[_0xe1eb('0xb')]);router[_0xe1eb('0x8')](_0xe1eb('0xc'),auth['isAuthenticated'](),controller[_0xe1eb('0xd')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xe1eb('0xe')]);router[_0xe1eb('0xf')]('/',auth[_0xe1eb('0x9')](),controller[_0xe1eb('0x10')]);router[_0xe1eb('0xf')](_0xe1eb('0xc'),auth['isAuthenticated'](),controller[_0xe1eb('0x11')]);router[_0xe1eb('0x12')](_0xe1eb('0xa'),auth[_0xe1eb('0x9')](),controller[_0xe1eb('0x13')]);router[_0xe1eb('0x14')](_0xe1eb('0xa'),auth[_0xe1eb('0x9')](),controller[_0xe1eb('0x15')]);module[_0xe1eb('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 3c73fc7..ed38e1c 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 _0x145a=['sequelize','exports','STRING','remoteUri'];(function(_0x4b2471,_0xedb897){var _0x7a8c13=function(_0xbf3b7e){while(--_0xbf3b7e){_0x4b2471['push'](_0x4b2471['shift']());}};_0x7a8c13(++_0xedb897);}(_0x145a,0x100));var _0xa145=function(_0xd183f6,_0x34a556){_0xd183f6=_0xd183f6-0x0;var _0x3ab76e=_0x145a[_0xd183f6];return _0x3ab76e;};'use strict';var Sequelize=require(_0xa145('0x0'));module[_0xa145('0x1')]={'name':{'type':Sequelize[_0xa145('0x2')]},'description':{'type':Sequelize[_0xa145('0x2')]},'username':{'type':Sequelize[_0xa145('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa145('0x2')]},'remoteUri':{'type':Sequelize[_0xa145('0x2')],'unique':_0xa145('0x3')},'serverUrl':{'type':Sequelize[_0xa145('0x2')]}}; \ No newline at end of file +var _0x2c7b=['exports','STRING','remoteUri','sequelize'];(function(_0x31106b,_0x199b46){var _0x1a8e53=function(_0x529964){while(--_0x529964){_0x31106b['push'](_0x31106b['shift']());}};_0x1a8e53(++_0x199b46);}(_0x2c7b,0x1af));var _0xb2c7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x2c7b[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xb2c7('0x0'));module[_0xb2c7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb2c7('0x2')]},'username':{'type':Sequelize[_0xb2c7('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb2c7('0x2')],'unique':_0xb2c7('0x3')},'serverUrl':{'type':Sequelize[_0xb2c7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index ff4434e..b7e78e6 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 _0x7a05=['%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','json','apply','reject','save','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','key','query','keys','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','show','params','rawAttributes','intersection','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','slice','substring','lastIndexOf','POST','format'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x7a05,0x19d));var _0x57a0=function(_0x42ae8b,_0x3abcfc){_0x42ae8b=_0x42ae8b-0x0;var _0x359d92=_0x7a05[_0x42ae8b];return _0x359d92;};'use strict';var pdf=require(_0x57a0('0x0'));var emlformat=require(_0x57a0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x57a0('0x2'));var rp=require(_0x57a0('0x3'));var moment=require(_0x57a0('0x4'));var BPromise=require(_0x57a0('0x5'));var Mustache=require(_0x57a0('0x6'));var util=require(_0x57a0('0x7'));var path=require('path');var sox=require(_0x57a0('0x8'));var csv=require(_0x57a0('0x9'));var ejs=require(_0x57a0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57a0('0xb'));var crypto=require(_0x57a0('0xc'));var jsforce=require(_0x57a0('0xd'));var deskjs=require(_0x57a0('0xe'));var toCsv=require(_0x57a0('0x9'));var querystring=require('querystring');var Papa=require(_0x57a0('0xf'));var Redis=require(_0x57a0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x57a0('0x11'));var as=require(_0x57a0('0x12'));var hardwareService=require(_0x57a0('0x13'));var logger=require(_0x57a0('0x14'))(_0x57a0('0x15'));var utils=require(_0x57a0('0x16'));var config=require(_0x57a0('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x57a0('0x18'));var jayson=require(_0x57a0('0x19'));var client=jayson[_0x57a0('0x1a')][_0x57a0('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5eb8c4,_0x45e1f8,_0x5cbea1){if(_0x5cbea1){var _0x348ceb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x348ceb[_0x57a0('0x1c')](_0x45e1f8)){return _0x5eb8c4;}else{throw new db[(_0x57a0('0x1d'))][(_0x57a0('0x1e'))](_0x57a0('0x1f'));}}else{return _0x5eb8c4;}}function respondWithRpcPromise(_0x2e80b6,_0x2b607e,_0x30ddcb,_0xa17239){return new BPromise(function(_0x4e518e,_0x57759e){var _0x257f5b=_0xa17239||client;return _0x257f5b[_0x57a0('0x20')](_0x2e80b6,_0x30ddcb)[_0x57a0('0x21')](function(_0x346c29){logger['info'](_0x57a0('0x22'),_0x2b607e,_0x57a0('0x23'));logger['debug'](_0x57a0('0x24'),_0x2b607e,_0x57a0('0x23'),JSON['stringify'](_0x346c29));if(_0x346c29[_0x57a0('0x25')]){if(_0x346c29['error'][_0x57a0('0x26')]===0x1f4){logger['error'](_0x57a0('0x22'),_0x2b607e,_0x346c29['error'][_0x57a0('0x27')]);return _0x57759e(_0x346c29[_0x57a0('0x25')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x2b607e,_0x346c29[_0x57a0('0x25')]['message']);return _0x4e518e(_0x346c29['error'][_0x57a0('0x27')]);}else{logger['info'](_0x57a0('0x22'),_0x2b607e,_0x57a0('0x23'));_0x4e518e(_0x346c29[_0x57a0('0x28')]['message']);}})[_0x57a0('0x29')](function(_0x1a10dd){logger[_0x57a0('0x25')](_0x57a0('0x22'),_0x2b607e,_0x1a10dd);_0x57759e(_0x1a10dd);});});}function respondWithStatusCode(_0x30cd28,_0x259429){_0x259429=_0x259429||0xcc;return function(_0xad004f){if(_0xad004f){return _0x30cd28[_0x57a0('0x2a')](_0x259429);}return _0x30cd28[_0x57a0('0x2b')](_0x259429)[_0x57a0('0x2c')]();};}function respondWithResult(_0x29fe62,_0x399131){_0x399131=_0x399131||0xc8;return function(_0x131445){if(_0x131445){return _0x29fe62[_0x57a0('0x2b')](_0x399131)['json'](_0x131445);}};}function respondWithFilteredResult(_0x15000b,_0x10b9b0){return function(_0x4b9450){if(_0x4b9450){var _0x5a477c=_0x4b9450['count'],_0x12264e=_0x10b9b0[_0x57a0('0x2d')],_0x4e5a5c=_0x10b9b0[_0x57a0('0x2d')]+_0x10b9b0[_0x57a0('0x2e')],_0x3dae6e;if(_0x4e5a5c>=_0x5a477c){_0x4e5a5c=_0x5a477c;_0x3dae6e=0xc8;}else{_0x3dae6e=0xce;}_0x15000b[_0x57a0('0x2b')](_0x3dae6e);return _0x15000b['set']('Content-Range',_0x12264e+'-'+_0x4e5a5c+'/'+_0x5a477c)[_0x57a0('0x2f')](_0x4b9450);}return null;};}function patchUpdates(_0x1c454c){return function(_0x394f86){try{jsonpatch[_0x57a0('0x30')](_0x394f86,_0x1c454c,!![]);}catch(_0x4d3a03){return BPromise[_0x57a0('0x31')](_0x4d3a03);}return _0x394f86[_0x57a0('0x32')]();};}function saveUpdates(_0x334ffc,_0x124a69){return function(_0x48ad76){if(_0x48ad76){return _0x48ad76['update'](_0x334ffc)[_0x57a0('0x21')](function(_0x1cbcf5){return _0x1cbcf5;});}return null;};}function removeEntity(_0x1fffa1,_0x2481a0){return function(_0x3bd370){if(_0x3bd370){return _0x3bd370[_0x57a0('0x33')]()['then'](function(){_0x1fffa1[_0x57a0('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2221c9,_0x4f1d1d){return function(_0x13ae72){if(!_0x13ae72){_0x2221c9['sendStatus'](0x194);}return _0x13ae72;};}function handleError(_0x30f685,_0x1d4254){_0x1d4254=_0x1d4254||0x1f4;return function(_0x27b0b5){logger[_0x57a0('0x25')](_0x27b0b5[_0x57a0('0x34')]);if(_0x27b0b5[_0x57a0('0x35')]){delete _0x27b0b5[_0x57a0('0x35')];}_0x30f685[_0x57a0('0x2b')](_0x1d4254)[_0x57a0('0x36')](_0x27b0b5);};}exports[_0x57a0('0x37')]=function(_0x262c1e,_0x2a868e){var _0x562827={},_0x291e83={},_0x5811ed={'count':0x0,'rows':[]};var _0xa7085f=_[_0x57a0('0x38')](db[_0x57a0('0x39')]['rawAttributes'],function(_0x4a7c16){return{'name':_0x4a7c16[_0x57a0('0x3a')],'type':_0x4a7c16['type'][_0x57a0('0x3b')]};});_0x291e83['model']=_[_0x57a0('0x38')](_0xa7085f,_0x57a0('0x35'));_0x291e83[_0x57a0('0x3c')]=_[_0x57a0('0x3d')](_0x262c1e['query']);_0x291e83['filters']=_['intersection'](_0x291e83['model'],_0x291e83['query']);_0x562827[_0x57a0('0x3e')]=_['intersection'](_0x291e83[_0x57a0('0x3f')],qs[_0x57a0('0x40')](_0x262c1e[_0x57a0('0x3c')]['fields']));_0x562827[_0x57a0('0x3e')]=_0x562827[_0x57a0('0x3e')][_0x57a0('0x41')]?_0x562827['attributes']:_0x291e83[_0x57a0('0x3f')];if(!_0x262c1e[_0x57a0('0x3c')][_0x57a0('0x42')]('nolimit')){_0x562827[_0x57a0('0x2e')]=qs[_0x57a0('0x2e')](_0x262c1e[_0x57a0('0x3c')][_0x57a0('0x2e')]);_0x562827['offset']=qs[_0x57a0('0x2d')](_0x262c1e[_0x57a0('0x3c')][_0x57a0('0x2d')]);}_0x562827[_0x57a0('0x43')]=qs[_0x57a0('0x44')](_0x262c1e[_0x57a0('0x3c')]['sort']);_0x562827[_0x57a0('0x45')]=qs[_0x57a0('0x46')](_[_0x57a0('0x47')](_0x262c1e[_0x57a0('0x3c')],_0x291e83[_0x57a0('0x46')]),_0xa7085f);if(_0x262c1e['query'][_0x57a0('0x48')]){_0x562827['where']=_[_0x57a0('0x49')](_0x562827['where'],{'$or':_[_0x57a0('0x38')](_0xa7085f,function(_0x84adfe){if(_0x84adfe[_0x57a0('0x4a')]!==_0x57a0('0x4b')){var _0x1132b6={};_0x1132b6[_0x84adfe[_0x57a0('0x35')]]={'$like':'%'+_0x262c1e[_0x57a0('0x3c')][_0x57a0('0x48')]+'%'};return _0x1132b6;}})});}_0x562827=_['merge']({},_0x562827,_0x262c1e[_0x57a0('0x4c')]);var _0x27cb24={'where':_0x562827['where']};return db[_0x57a0('0x39')][_0x57a0('0x4d')](_0x27cb24)[_0x57a0('0x21')](function(_0x4bdde0){_0x5811ed[_0x57a0('0x4d')]=_0x4bdde0;if(_0x262c1e['query'][_0x57a0('0x4e')]){_0x562827[_0x57a0('0x4f')]=[{'all':!![]}];}return db[_0x57a0('0x39')]['findAll'](_0x562827);})['then'](function(_0x2b7022){_0x5811ed[_0x57a0('0x50')]=_0x2b7022;return _0x5811ed;})[_0x57a0('0x21')](respondWithFilteredResult(_0x2a868e,_0x562827))[_0x57a0('0x29')](handleError(_0x2a868e,null));};exports[_0x57a0('0x51')]=function(_0x561e48,_0x62f3e0){var _0x1ea94b={'raw':![],'where':{'id':_0x561e48[_0x57a0('0x52')]['id']}},_0xf94058={};_0xf94058[_0x57a0('0x3f')]=_[_0x57a0('0x3d')](db[_0x57a0('0x39')][_0x57a0('0x53')]);_0xf94058['query']=_['keys'](_0x561e48[_0x57a0('0x3c')]);_0xf94058[_0x57a0('0x46')]=_['intersection'](_0xf94058['model'],_0xf94058[_0x57a0('0x3c')]);_0x1ea94b[_0x57a0('0x3e')]=_[_0x57a0('0x54')](_0xf94058[_0x57a0('0x3f')],qs[_0x57a0('0x40')](_0x561e48[_0x57a0('0x3c')][_0x57a0('0x40')]));_0x1ea94b[_0x57a0('0x3e')]=_0x1ea94b[_0x57a0('0x3e')][_0x57a0('0x41')]?_0x1ea94b[_0x57a0('0x3e')]:_0xf94058[_0x57a0('0x3f')];if(_0x561e48[_0x57a0('0x3c')][_0x57a0('0x4e')]){_0x1ea94b[_0x57a0('0x4f')]=[{'all':!![]}];}_0x1ea94b=_[_0x57a0('0x49')]({},_0x1ea94b,_0x561e48[_0x57a0('0x4c')]);return db[_0x57a0('0x39')][_0x57a0('0x55')](_0x1ea94b)[_0x57a0('0x21')](handleEntityNotFound(_0x62f3e0,null))[_0x57a0('0x21')](respondWithResult(_0x62f3e0,null))[_0x57a0('0x29')](handleError(_0x62f3e0,null));};exports[_0x57a0('0x56')]=function(_0x135683,_0x3b26b7){return db[_0x57a0('0x39')][_0x57a0('0x56')](_0x135683[_0x57a0('0x57')],{})[_0x57a0('0x21')](respondWithResult(_0x3b26b7,0xc9))[_0x57a0('0x29')](handleError(_0x3b26b7,null));};exports['update']=function(_0x165e44,_0x589124){if(_0x165e44[_0x57a0('0x57')]['id']){delete _0x165e44['body']['id'];}return db[_0x57a0('0x39')][_0x57a0('0x55')]({'where':{'id':_0x165e44[_0x57a0('0x52')]['id']}})[_0x57a0('0x21')](handleEntityNotFound(_0x589124,null))[_0x57a0('0x21')](saveUpdates(_0x165e44[_0x57a0('0x57')],null))[_0x57a0('0x21')](respondWithResult(_0x589124,null))[_0x57a0('0x29')](handleError(_0x589124,null));};exports['destroy']=function(_0x384afc,_0x15c640){return db[_0x57a0('0x39')][_0x57a0('0x55')]({'where':{'id':_0x384afc[_0x57a0('0x52')]['id']}})[_0x57a0('0x21')](handleEntityNotFound(_0x15c640,null))[_0x57a0('0x21')](removeEntity(_0x15c640,null))[_0x57a0('0x29')](handleError(_0x15c640,null));};exports[_0x57a0('0x58')]=function(_0x857830,_0x151836,_0x2dc1b8){var _0x2f6645={};var _0x575f1f={};var _0x393302;var _0x1985c5;return db[_0x57a0('0x39')][_0x57a0('0x59')]({'where':{'id':_0x857830[_0x57a0('0x52')]['id']}})[_0x57a0('0x21')](handleEntityNotFound(_0x151836,null))[_0x57a0('0x21')](function(_0x3d9f3c){if(_0x3d9f3c){_0x393302=_0x3d9f3c;_0x575f1f['model']=_[_0x57a0('0x3d')](db[_0x57a0('0x5a')][_0x57a0('0x53')]);_0x575f1f[_0x57a0('0x3c')]=_[_0x57a0('0x3d')](_0x857830[_0x57a0('0x3c')]);_0x575f1f[_0x57a0('0x46')]=_[_0x57a0('0x54')](_0x575f1f['model'],_0x575f1f['query']);_0x2f6645[_0x57a0('0x3e')]=_[_0x57a0('0x54')](_0x575f1f['model'],qs[_0x57a0('0x40')](_0x857830[_0x57a0('0x3c')][_0x57a0('0x40')]));_0x2f6645[_0x57a0('0x3e')]=_0x2f6645[_0x57a0('0x3e')]['length']?_0x2f6645['attributes']:_0x575f1f[_0x57a0('0x3f')];_0x2f6645[_0x57a0('0x43')]=qs[_0x57a0('0x44')](_0x857830[_0x57a0('0x3c')][_0x57a0('0x44')]);_0x2f6645[_0x57a0('0x45')]=qs[_0x57a0('0x46')](_[_0x57a0('0x47')](_0x857830[_0x57a0('0x3c')],_0x575f1f[_0x57a0('0x46')]));if(_0x857830[_0x57a0('0x3c')]['filter']){_0x2f6645[_0x57a0('0x45')]=_[_0x57a0('0x49')](_0x2f6645['where'],{'$or':_[_0x57a0('0x38')](_0x2f6645['attributes'],function(_0x273ad0){var _0x1ead38={};_0x1ead38[_0x273ad0]={'$like':'%'+_0x857830[_0x57a0('0x3c')][_0x57a0('0x48')]+'%'};return _0x1ead38;})});}_0x2f6645=_['merge']({},_0x2f6645,_0x857830[_0x57a0('0x4c')]);return _0x393302[_0x57a0('0x58')](_0x2f6645);}})[_0x57a0('0x21')](function(_0x376724){if(_0x376724){_0x1985c5=_0x376724[_0x57a0('0x41')];if(!_0x857830['query'][_0x57a0('0x42')](_0x57a0('0x5b'))){_0x2f6645['limit']=qs[_0x57a0('0x2e')](_0x857830[_0x57a0('0x3c')][_0x57a0('0x2e')]);_0x2f6645[_0x57a0('0x2d')]=qs['offset'](_0x857830['query'][_0x57a0('0x2d')]);}return _0x393302['getConfigurations'](_0x2f6645);}})[_0x57a0('0x21')](function(_0x2570e8){if(_0x2570e8){return _0x2570e8?{'count':_0x1985c5,'rows':_0x2570e8}:null;}})[_0x57a0('0x21')](respondWithResult(_0x151836,null))[_0x57a0('0x29')](handleError(_0x151836,null));};exports[_0x57a0('0x5c')]=function(_0x57849b,_0x29681c,_0x40035e){if(_0x57849b[_0x57a0('0x57')]['id']){delete _0x57849b['body']['id'];}return db[_0x57a0('0x39')][_0x57a0('0x59')]({'where':{'id':_0x57849b['params']['id']}})[_0x57a0('0x21')](handleEntityNotFound(_0x29681c,null))[_0x57a0('0x21')](function(_0x21ca47){if(_0x21ca47){_0x57849b[_0x57a0('0x57')][_0x57a0('0x5d')]=_0x21ca47['id'];_0x57849b[_0x57a0('0x57')][_0x57a0('0x5e')]=integrations[_0x57a0('0x5f')](_0x57849b['body']['channel'],_0x57849b['body'][_0x57a0('0x4a')]);_0x57849b[_0x57a0('0x57')][_0x57a0('0x60')]=integrations[_0x57a0('0x61')](_0x57849b[_0x57a0('0x57')][_0x57a0('0x62')],_0x57849b[_0x57a0('0x57')][_0x57a0('0x4a')]);return db[_0x57a0('0x5a')][_0x57a0('0x56')](_0x57849b[_0x57a0('0x57')],{'include':[{'model':db[_0x57a0('0x63')],'as':_0x57a0('0x5e')},{'model':db['SugarcrmField'],'as':_0x57a0('0x60')}]});}return null;})['then'](respondWithResult(_0x29681c,null))[_0x57a0('0x29')](handleError(_0x29681c,null));};exports[_0x57a0('0x64')]=function(_0x58c702,_0x2ac14c,_0x1d61fc){var _0x21b20='';var _0x1d58e7=['id',_0x57a0('0x35'),_0x57a0('0x65'),'created_by','description',_0x57a0('0x66'),_0x57a0('0x67'),_0x57a0('0x68'),'parent_id',_0x57a0('0x69'),_0x57a0('0x6a'),_0x57a0('0x6b')];return db[_0x57a0('0x39')][_0x57a0('0x59')]({'where':{'id':_0x58c702[_0x57a0('0x52')]['id']},'attributes':['id',_0x57a0('0x6c'),_0x57a0('0x6d'),'remoteUri']})[_0x57a0('0x21')](handleEntityNotFound(_0x2ac14c,null))[_0x57a0('0x21')](function(_0x5894ee){if(_0x5894ee){_0x21b20=_0x5894ee['remoteUri'];var _0x2361fc=_0x21b20[_0x57a0('0x6e')](-0x1);if(_0x2361fc==='/'){_0x21b20=_0x21b20[_0x57a0('0x6f')](0x0,_0x21b20[_0x57a0('0x70')](_0x2361fc));}return rp({'method':_0x57a0('0x71'),'uri':util[_0x57a0('0x72')](_0x57a0('0x73'),_0x21b20,_0x57a0('0x74')),'json':!![],'form':{'method':'login','input_type':_0x57a0('0x75'),'response_type':_0x57a0('0x75'),'rest_data':JSON[_0x57a0('0x76')]({'user_auth':{'user_name':_0x5894ee['username'],'password':_0x5894ee[_0x57a0('0x6d')],'encryption':_0x57a0('0x77')},'application':_0x57a0('0x78')})}});}})['then'](function(_0x3bcc2f){if(_0x3bcc2f&&_0x3bcc2f[_0x57a0('0x35')]!=='Invalid\x20Login'&&_0x3bcc2f[_0x57a0('0x35')]!==_0x57a0('0x79')){return rp({'method':_0x57a0('0x71'),'uri':util['format']('%s%s',_0x21b20,_0x57a0('0x74')),'json':!![],'form':{'method':_0x57a0('0x7a'),'input_type':'JSON','response_type':_0x57a0('0x75'),'rest_data':JSON['stringify']({'session':_0x3bcc2f['id'],'module_name':_0x57a0('0x7b')})}})[_0x57a0('0x21')](function(_0x1ded92){if(_0x1ded92){var _0x21b7df=_[_0x57a0('0x7c')](_0x1ded92[_0x57a0('0x7d')]);_[_0x57a0('0x7e')](_0x21b7df,function(_0x3fd581){return _0x1d58e7[_0x57a0('0x7f')](_0x3fd581[_0x57a0('0x35')]);});return{'count':_0x21b7df[_0x57a0('0x41')],'rows':_[_0x57a0('0x38')](_0x21b7df,function(_0x42e915){return{'id':_0x42e915['name'],'name':_0x42e915[_0x57a0('0x80')],'custom':_['endsWith'](_0x42e915[_0x57a0('0x35')],'_c')?!![]:![],'options':_0x42e915['options']?_[_0x57a0('0x38')](_[_0x57a0('0x7c')](_0x42e915[_0x57a0('0x4c')]),function(_0x5f540e){return{'name':_0x5f540e['value'],'value':_0x5f540e['name']};}):[]};})};}})[_0x57a0('0x21')](respondWithResult(_0x2ac14c,null))[_0x57a0('0x29')](function(_0x36de4f){var _0x7aec08=_0x58c702[_0x57a0('0x3c')][_0x57a0('0x1c')]?0x1f4:_0x36de4f[_0x57a0('0x81')]||0x1f4;logger['error'](_0x57a0('0x82'),'getFields',_0x7aec08,JSON[_0x57a0('0x76')](_0x36de4f));delete _0x36de4f[_0x57a0('0x35')];if(_0x7aec08===0x191){_0x7aec08=0x190;}_0x2ac14c['status'](_0x7aec08)['send'](_0x58c702[_0x57a0('0x3c')]['test']?{'message':_0x57a0('0x83'),'statusCode':_0x36de4f[_0x57a0('0x81')]}:_0x36de4f);});}else{var _0x327f0e=0x1f4;_0x2ac14c[_0x57a0('0x2b')](_0x327f0e)['send']({'message':_0x57a0('0x83'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6dcb=['end','count','limit','reject','save','update','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','addConfiguration','AccountId','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_name','direction','username','slice','substring','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','Calls','values','remove','includes','endsWith','options','value','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status'];(function(_0x503118,_0x207c0d){var _0x111531=function(_0x35bfbc){while(--_0x35bfbc){_0x503118['push'](_0x503118['shift']());}};_0x111531(++_0x207c0d);}(_0x6dcb,0xcf));var _0xb6dc=function(_0xa85862,_0x12dbc5){_0xa85862=_0xa85862-0x0;var _0x59da37=_0x6dcb[_0xa85862];return _0x59da37;};'use strict';var pdf=require(_0xb6dc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb6dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb6dc('0x2'));var util=require('util');var path=require(_0xb6dc('0x3'));var sox=require(_0xb6dc('0x4'));var csv=require(_0xb6dc('0x5'));var ejs=require(_0xb6dc('0x6'));var fs=require('fs');var _=require(_0xb6dc('0x7'));var squel=require('squel');var crypto=require(_0xb6dc('0x8'));var jsforce=require(_0xb6dc('0x9'));var deskjs=require(_0xb6dc('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb6dc('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb6dc('0xc'));var qs=require(_0xb6dc('0xd'));var as=require(_0xb6dc('0xe'));var hardwareService=require(_0xb6dc('0xf'));var logger=require(_0xb6dc('0x10'))(_0xb6dc('0x11'));var utils=require(_0xb6dc('0x12'));var config=require(_0xb6dc('0x13'));var db=require(_0xb6dc('0x14'))['db'];var integrations=require(_0xb6dc('0x15'));var jayson=require('jayson/promise');var client=jayson[_0xb6dc('0x16')][_0xb6dc('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3ae365,_0x210223,_0x355f91){if(_0x355f91){var _0x1c0b67=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c0b67[_0xb6dc('0x18')](_0x210223)){return _0x3ae365;}else{throw new db['Sequelize'][(_0xb6dc('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3ae365;}}function respondWithRpcPromise(_0x3c1b30,_0x50b961,_0x3c4cee,_0x238f2a){return new BPromise(function(_0x1406d8,_0x4ad26a){var _0x39c8f6=_0x238f2a||client;return _0x39c8f6[_0xb6dc('0x1a')](_0x3c1b30,_0x3c4cee)[_0xb6dc('0x1b')](function(_0x35aa16){logger[_0xb6dc('0x1c')](_0xb6dc('0x1d'),_0x50b961,_0xb6dc('0x1e'));logger[_0xb6dc('0x1f')](_0xb6dc('0x20'),_0x50b961,'request\x20sent',JSON[_0xb6dc('0x21')](_0x35aa16));if(_0x35aa16[_0xb6dc('0x22')]){if(_0x35aa16[_0xb6dc('0x22')][_0xb6dc('0x23')]===0x1f4){logger[_0xb6dc('0x22')](_0xb6dc('0x1d'),_0x50b961,_0x35aa16[_0xb6dc('0x22')][_0xb6dc('0x24')]);return _0x4ad26a(_0x35aa16[_0xb6dc('0x22')]['message']);}logger[_0xb6dc('0x22')](_0xb6dc('0x1d'),_0x50b961,_0x35aa16['error'][_0xb6dc('0x24')]);return _0x1406d8(_0x35aa16[_0xb6dc('0x22')][_0xb6dc('0x24')]);}else{logger[_0xb6dc('0x1c')](_0xb6dc('0x1d'),_0x50b961,_0xb6dc('0x1e'));_0x1406d8(_0x35aa16[_0xb6dc('0x25')][_0xb6dc('0x24')]);}})[_0xb6dc('0x26')](function(_0x55d8df){logger['error'](_0xb6dc('0x1d'),_0x50b961,_0x55d8df);_0x4ad26a(_0x55d8df);});});}function respondWithStatusCode(_0x2e6a4f,_0x4bf491){_0x4bf491=_0x4bf491||0xcc;return function(_0x8a3384){if(_0x8a3384){return _0x2e6a4f[_0xb6dc('0x27')](_0x4bf491);}return _0x2e6a4f[_0xb6dc('0x28')](_0x4bf491)[_0xb6dc('0x29')]();};}function respondWithResult(_0x5be88c,_0x581a68){_0x581a68=_0x581a68||0xc8;return function(_0x4992f6){if(_0x4992f6){return _0x5be88c[_0xb6dc('0x28')](_0x581a68)['json'](_0x4992f6);}};}function respondWithFilteredResult(_0x570521,_0x1331c8){return function(_0x412b6b){if(_0x412b6b){var _0x580f68=_0x412b6b[_0xb6dc('0x2a')],_0x5f43aa=_0x1331c8['offset'],_0x3600e7=_0x1331c8['offset']+_0x1331c8[_0xb6dc('0x2b')],_0x23df8b;if(_0x3600e7>=_0x580f68){_0x3600e7=_0x580f68;_0x23df8b=0xc8;}else{_0x23df8b=0xce;}_0x570521[_0xb6dc('0x28')](_0x23df8b);return _0x570521['set']('Content-Range',_0x5f43aa+'-'+_0x3600e7+'/'+_0x580f68)['json'](_0x412b6b);}return null;};}function patchUpdates(_0x9b9d25){return function(_0x2bb387){try{jsonpatch['apply'](_0x2bb387,_0x9b9d25,!![]);}catch(_0x31e2c9){return BPromise[_0xb6dc('0x2c')](_0x31e2c9);}return _0x2bb387[_0xb6dc('0x2d')]();};}function saveUpdates(_0x5e587a,_0x4a9bcd){return function(_0x52eb50){if(_0x52eb50){return _0x52eb50[_0xb6dc('0x2e')](_0x5e587a)[_0xb6dc('0x1b')](function(_0x2b4fdd){return _0x2b4fdd;});}return null;};}function removeEntity(_0x4161f1,_0x164c29){return function(_0x292a44){if(_0x292a44){return _0x292a44[_0xb6dc('0x2f')]()['then'](function(){_0x4161f1[_0xb6dc('0x28')](0xcc)[_0xb6dc('0x29')]();});}};}function handleEntityNotFound(_0x37d8e8,_0xa574e6){return function(_0x29769e){if(!_0x29769e){_0x37d8e8['sendStatus'](0x194);}return _0x29769e;};}function handleError(_0x393b4e,_0x142822){_0x142822=_0x142822||0x1f4;return function(_0x28e693){logger[_0xb6dc('0x22')](_0x28e693['stack']);if(_0x28e693[_0xb6dc('0x30')]){delete _0x28e693[_0xb6dc('0x30')];}_0x393b4e['status'](_0x142822)[_0xb6dc('0x31')](_0x28e693);};}exports[_0xb6dc('0x32')]=function(_0x173178,_0x5a0e6a){var _0x481c98={},_0xf05332={},_0x1a8c6a={'count':0x0,'rows':[]};var _0x56c80e=_[_0xb6dc('0x33')](db[_0xb6dc('0x34')][_0xb6dc('0x35')],function(_0x43e142){return{'name':_0x43e142[_0xb6dc('0x36')],'type':_0x43e142[_0xb6dc('0x37')][_0xb6dc('0x38')]};});_0xf05332[_0xb6dc('0x39')]=_[_0xb6dc('0x33')](_0x56c80e,_0xb6dc('0x30'));_0xf05332['query']=_[_0xb6dc('0x3a')](_0x173178['query']);_0xf05332[_0xb6dc('0x3b')]=_[_0xb6dc('0x3c')](_0xf05332[_0xb6dc('0x39')],_0xf05332[_0xb6dc('0x3d')]);_0x481c98[_0xb6dc('0x3e')]=_[_0xb6dc('0x3c')](_0xf05332[_0xb6dc('0x39')],qs['fields'](_0x173178[_0xb6dc('0x3d')][_0xb6dc('0x3f')]));_0x481c98[_0xb6dc('0x3e')]=_0x481c98[_0xb6dc('0x3e')][_0xb6dc('0x40')]?_0x481c98[_0xb6dc('0x3e')]:_0xf05332[_0xb6dc('0x39')];if(!_0x173178[_0xb6dc('0x3d')][_0xb6dc('0x41')](_0xb6dc('0x42'))){_0x481c98[_0xb6dc('0x2b')]=qs['limit'](_0x173178[_0xb6dc('0x3d')]['limit']);_0x481c98[_0xb6dc('0x43')]=qs['offset'](_0x173178[_0xb6dc('0x3d')][_0xb6dc('0x43')]);}_0x481c98['order']=qs[_0xb6dc('0x44')](_0x173178[_0xb6dc('0x3d')][_0xb6dc('0x44')]);_0x481c98['where']=qs[_0xb6dc('0x3b')](_[_0xb6dc('0x45')](_0x173178[_0xb6dc('0x3d')],_0xf05332['filters']),_0x56c80e);if(_0x173178[_0xb6dc('0x3d')]['filter']){_0x481c98[_0xb6dc('0x46')]=_[_0xb6dc('0x47')](_0x481c98['where'],{'$or':_['map'](_0x56c80e,function(_0x250bb2){if(_0x250bb2['type']!==_0xb6dc('0x48')){var _0x46a231={};_0x46a231[_0x250bb2[_0xb6dc('0x30')]]={'$like':'%'+_0x173178[_0xb6dc('0x3d')][_0xb6dc('0x49')]+'%'};return _0x46a231;}})});}_0x481c98=_[_0xb6dc('0x47')]({},_0x481c98,_0x173178['options']);var _0x1ffb9b={'where':_0x481c98[_0xb6dc('0x46')]};return db['SugarcrmAccount'][_0xb6dc('0x2a')](_0x1ffb9b)[_0xb6dc('0x1b')](function(_0xda52f7){_0x1a8c6a['count']=_0xda52f7;if(_0x173178[_0xb6dc('0x3d')][_0xb6dc('0x4a')]){_0x481c98[_0xb6dc('0x4b')]=[{'all':!![]}];}return db[_0xb6dc('0x34')][_0xb6dc('0x4c')](_0x481c98);})[_0xb6dc('0x1b')](function(_0x2394a1){_0x1a8c6a[_0xb6dc('0x4d')]=_0x2394a1;return _0x1a8c6a;})[_0xb6dc('0x1b')](respondWithFilteredResult(_0x5a0e6a,_0x481c98))[_0xb6dc('0x26')](handleError(_0x5a0e6a,null));};exports[_0xb6dc('0x4e')]=function(_0x4f6286,_0x32fed7){var _0x10ef1d={'raw':![],'where':{'id':_0x4f6286[_0xb6dc('0x4f')]['id']}},_0x3f7222={};_0x3f7222[_0xb6dc('0x39')]=_['keys'](db[_0xb6dc('0x34')]['rawAttributes']);_0x3f7222[_0xb6dc('0x3d')]=_['keys'](_0x4f6286[_0xb6dc('0x3d')]);_0x3f7222[_0xb6dc('0x3b')]=_['intersection'](_0x3f7222[_0xb6dc('0x39')],_0x3f7222[_0xb6dc('0x3d')]);_0x10ef1d['attributes']=_[_0xb6dc('0x3c')](_0x3f7222[_0xb6dc('0x39')],qs['fields'](_0x4f6286['query'][_0xb6dc('0x3f')]));_0x10ef1d['attributes']=_0x10ef1d[_0xb6dc('0x3e')][_0xb6dc('0x40')]?_0x10ef1d['attributes']:_0x3f7222[_0xb6dc('0x39')];if(_0x4f6286[_0xb6dc('0x3d')]['includeAll']){_0x10ef1d[_0xb6dc('0x4b')]=[{'all':!![]}];}_0x10ef1d=_[_0xb6dc('0x47')]({},_0x10ef1d,_0x4f6286['options']);return db[_0xb6dc('0x34')][_0xb6dc('0x50')](_0x10ef1d)[_0xb6dc('0x1b')](handleEntityNotFound(_0x32fed7,null))[_0xb6dc('0x1b')](respondWithResult(_0x32fed7,null))['catch'](handleError(_0x32fed7,null));};exports[_0xb6dc('0x51')]=function(_0x592827,_0x262889){return db[_0xb6dc('0x34')][_0xb6dc('0x51')](_0x592827[_0xb6dc('0x52')],{})[_0xb6dc('0x1b')](respondWithResult(_0x262889,0xc9))[_0xb6dc('0x26')](handleError(_0x262889,null));};exports[_0xb6dc('0x2e')]=function(_0x3e7e8a,_0x3e9776){if(_0x3e7e8a[_0xb6dc('0x52')]['id']){delete _0x3e7e8a[_0xb6dc('0x52')]['id'];}return db[_0xb6dc('0x34')][_0xb6dc('0x50')]({'where':{'id':_0x3e7e8a[_0xb6dc('0x4f')]['id']}})[_0xb6dc('0x1b')](handleEntityNotFound(_0x3e9776,null))[_0xb6dc('0x1b')](saveUpdates(_0x3e7e8a['body'],null))['then'](respondWithResult(_0x3e9776,null))[_0xb6dc('0x26')](handleError(_0x3e9776,null));};exports[_0xb6dc('0x2f')]=function(_0x196a8d,_0xc26a58){return db['SugarcrmAccount'][_0xb6dc('0x50')]({'where':{'id':_0x196a8d[_0xb6dc('0x4f')]['id']}})[_0xb6dc('0x1b')](handleEntityNotFound(_0xc26a58,null))[_0xb6dc('0x1b')](removeEntity(_0xc26a58,null))[_0xb6dc('0x26')](handleError(_0xc26a58,null));};exports[_0xb6dc('0x53')]=function(_0x583619,_0x4cc67a,_0x3f887c){var _0x4a78b6={};var _0x35ff41={};var _0x561099;var _0x4bcaca;return db[_0xb6dc('0x34')][_0xb6dc('0x54')]({'where':{'id':_0x583619[_0xb6dc('0x4f')]['id']}})[_0xb6dc('0x1b')](handleEntityNotFound(_0x4cc67a,null))[_0xb6dc('0x1b')](function(_0xabd34b){if(_0xabd34b){_0x561099=_0xabd34b;_0x35ff41[_0xb6dc('0x39')]=_[_0xb6dc('0x3a')](db[_0xb6dc('0x55')][_0xb6dc('0x35')]);_0x35ff41[_0xb6dc('0x3d')]=_[_0xb6dc('0x3a')](_0x583619['query']);_0x35ff41[_0xb6dc('0x3b')]=_['intersection'](_0x35ff41[_0xb6dc('0x39')],_0x35ff41[_0xb6dc('0x3d')]);_0x4a78b6[_0xb6dc('0x3e')]=_['intersection'](_0x35ff41[_0xb6dc('0x39')],qs[_0xb6dc('0x3f')](_0x583619[_0xb6dc('0x3d')][_0xb6dc('0x3f')]));_0x4a78b6[_0xb6dc('0x3e')]=_0x4a78b6['attributes'][_0xb6dc('0x40')]?_0x4a78b6[_0xb6dc('0x3e')]:_0x35ff41[_0xb6dc('0x39')];_0x4a78b6[_0xb6dc('0x56')]=qs[_0xb6dc('0x44')](_0x583619[_0xb6dc('0x3d')][_0xb6dc('0x44')]);_0x4a78b6['where']=qs[_0xb6dc('0x3b')](_[_0xb6dc('0x45')](_0x583619[_0xb6dc('0x3d')],_0x35ff41[_0xb6dc('0x3b')]));if(_0x583619['query'][_0xb6dc('0x49')]){_0x4a78b6[_0xb6dc('0x46')]=_[_0xb6dc('0x47')](_0x4a78b6[_0xb6dc('0x46')],{'$or':_[_0xb6dc('0x33')](_0x4a78b6[_0xb6dc('0x3e')],function(_0x34fadf){var _0x1b8fa3={};_0x1b8fa3[_0x34fadf]={'$like':'%'+_0x583619[_0xb6dc('0x3d')]['filter']+'%'};return _0x1b8fa3;})});}_0x4a78b6=_[_0xb6dc('0x47')]({},_0x4a78b6,_0x583619['options']);return _0x561099[_0xb6dc('0x53')](_0x4a78b6);}})[_0xb6dc('0x1b')](function(_0xd47572){if(_0xd47572){_0x4bcaca=_0xd47572[_0xb6dc('0x40')];if(!_0x583619[_0xb6dc('0x3d')]['hasOwnProperty']('nolimit')){_0x4a78b6[_0xb6dc('0x2b')]=qs[_0xb6dc('0x2b')](_0x583619[_0xb6dc('0x3d')]['limit']);_0x4a78b6[_0xb6dc('0x43')]=qs[_0xb6dc('0x43')](_0x583619[_0xb6dc('0x3d')][_0xb6dc('0x43')]);}return _0x561099[_0xb6dc('0x53')](_0x4a78b6);}})[_0xb6dc('0x1b')](function(_0x16a132){if(_0x16a132){return _0x16a132?{'count':_0x4bcaca,'rows':_0x16a132}:null;}})[_0xb6dc('0x1b')](respondWithResult(_0x4cc67a,null))[_0xb6dc('0x26')](handleError(_0x4cc67a,null));};exports[_0xb6dc('0x57')]=function(_0x5ab9a6,_0xd64f2a,_0x1d173a){if(_0x5ab9a6['body']['id']){delete _0x5ab9a6[_0xb6dc('0x52')]['id'];}return db['SugarcrmAccount'][_0xb6dc('0x54')]({'where':{'id':_0x5ab9a6['params']['id']}})[_0xb6dc('0x1b')](handleEntityNotFound(_0xd64f2a,null))[_0xb6dc('0x1b')](function(_0x37d416){if(_0x37d416){_0x5ab9a6[_0xb6dc('0x52')][_0xb6dc('0x58')]=_0x37d416['id'];_0x5ab9a6[_0xb6dc('0x52')]['Subjects']=integrations[_0xb6dc('0x59')](_0x5ab9a6[_0xb6dc('0x52')][_0xb6dc('0x5a')],_0x5ab9a6[_0xb6dc('0x52')][_0xb6dc('0x37')]);_0x5ab9a6['body']['Descriptions']=integrations[_0xb6dc('0x5b')](_0x5ab9a6[_0xb6dc('0x52')][_0xb6dc('0x5a')],_0x5ab9a6[_0xb6dc('0x52')][_0xb6dc('0x37')]);return db[_0xb6dc('0x55')]['create'](_0x5ab9a6[_0xb6dc('0x52')],{'include':[{'model':db[_0xb6dc('0x5c')],'as':'Subjects'},{'model':db[_0xb6dc('0x5c')],'as':_0xb6dc('0x5d')}]});}return null;})['then'](respondWithResult(_0xd64f2a,null))['catch'](handleError(_0xd64f2a,null));};exports[_0xb6dc('0x5e')]=function(_0x79be9d,_0x1a0237,_0x45cfb5){var _0x40f967='';var _0x49a21f=['id',_0xb6dc('0x30'),_0xb6dc('0x5f'),_0xb6dc('0x60'),_0xb6dc('0x61'),_0xb6dc('0x62'),_0xb6dc('0x63'),'duration_minutes',_0xb6dc('0x64'),'parent_type',_0xb6dc('0x65'),_0xb6dc('0x66')];return db[_0xb6dc('0x34')][_0xb6dc('0x54')]({'where':{'id':_0x79be9d[_0xb6dc('0x4f')]['id']},'attributes':['id',_0xb6dc('0x67'),'password','remoteUri']})[_0xb6dc('0x1b')](handleEntityNotFound(_0x1a0237,null))[_0xb6dc('0x1b')](function(_0x4c97fc){if(_0x4c97fc){_0x40f967=_0x4c97fc['remoteUri'];var _0xc47c5=_0x40f967[_0xb6dc('0x68')](-0x1);if(_0xc47c5==='/'){_0x40f967=_0x40f967[_0xb6dc('0x69')](0x0,_0x40f967['lastIndexOf'](_0xc47c5));}return rp({'method':'POST','uri':util[_0xb6dc('0x6a')]('%s%s',_0x40f967,_0xb6dc('0x6b')),'json':!![],'form':{'method':_0xb6dc('0x6c'),'input_type':_0xb6dc('0x6d'),'response_type':_0xb6dc('0x6d'),'rest_data':JSON[_0xb6dc('0x21')]({'user_auth':{'user_name':_0x4c97fc[_0xb6dc('0x67')],'password':_0x4c97fc['password'],'encryption':_0xb6dc('0x6e')},'application':_0xb6dc('0x6f')})}});}})[_0xb6dc('0x1b')](function(_0x35a5c0){if(_0x35a5c0&&_0x35a5c0[_0xb6dc('0x30')]!==_0xb6dc('0x70')&&_0x35a5c0[_0xb6dc('0x30')]!==_0xb6dc('0x71')){return rp({'method':_0xb6dc('0x72'),'uri':util[_0xb6dc('0x6a')]('%s%s',_0x40f967,_0xb6dc('0x6b')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xb6dc('0x6d'),'rest_data':JSON[_0xb6dc('0x21')]({'session':_0x35a5c0['id'],'module_name':_0xb6dc('0x73')})}})[_0xb6dc('0x1b')](function(_0x5eb333){if(_0x5eb333){var _0x8b362c=_[_0xb6dc('0x74')](_0x5eb333['module_fields']);_[_0xb6dc('0x75')](_0x8b362c,function(_0x30ccb0){return _0x49a21f[_0xb6dc('0x76')](_0x30ccb0['name']);});return{'count':_0x8b362c[_0xb6dc('0x40')],'rows':_[_0xb6dc('0x33')](_0x8b362c,function(_0x1f6237){return{'id':_0x1f6237[_0xb6dc('0x30')],'name':_0x1f6237['label'],'custom':_[_0xb6dc('0x77')](_0x1f6237[_0xb6dc('0x30')],'_c')?!![]:![],'options':_0x1f6237[_0xb6dc('0x78')]?_[_0xb6dc('0x33')](_[_0xb6dc('0x74')](_0x1f6237[_0xb6dc('0x78')]),function(_0x590fd4){return{'name':_0x590fd4[_0xb6dc('0x79')],'value':_0x590fd4[_0xb6dc('0x30')]};}):[]};})};}})[_0xb6dc('0x1b')](respondWithResult(_0x1a0237,null))[_0xb6dc('0x26')](function(_0x54012b){var _0xbef971=_0x79be9d[_0xb6dc('0x3d')][_0xb6dc('0x18')]?0x1f4:_0x54012b['statusCode']||0x1f4;logger['error'](_0xb6dc('0x7a'),_0xb6dc('0x5e'),_0xbef971,JSON[_0xb6dc('0x21')](_0x54012b));delete _0x54012b['name'];if(_0xbef971===0x191){_0xbef971=0x190;}_0x1a0237[_0xb6dc('0x28')](_0xbef971)[_0xb6dc('0x31')](_0x79be9d['query'][_0xb6dc('0x18')]?{'message':_0xb6dc('0x7b'),'statusCode':_0x54012b['statusCode']}:_0x54012b);});}else{var _0x1f340a=0x1f4;_0x1a0237[_0xb6dc('0x28')](_0x1f340a)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 4db2ebf..4c0100f 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 _0x5e21=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x4c9191,_0xe10c76){var _0x593642=function(_0x11e43b){while(--_0x11e43b){_0x4c9191['push'](_0x4c9191['shift']());}};_0x593642(++_0xe10c76);}(_0x5e21,0x1b3));var _0x15e2=function(_0x1a27e9,_0x7ffe14){_0x1a27e9=_0x1a27e9-0x0;var _0x41a929=_0x5e21[_0x1a27e9];return _0x41a929;};'use strict';var _=require(_0x15e2('0x0'));var util=require(_0x15e2('0x1'));var logger=require('../../config/logger')(_0x15e2('0x2'));var moment=require('moment');var BPromise=require(_0x15e2('0x3'));var rp=require(_0x15e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15e2('0x5'));var config=require(_0x15e2('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x15e2('0x7'));module[_0x15e2('0x8')]=function(_0x67c55e,_0x4aa891){return _0x67c55e[_0x15e2('0x9')](_0x15e2('0xa'),attributes,{'tableName':_0x15e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d7c=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','lodash'];(function(_0x310c99,_0x1b5bcd){var _0x362afe=function(_0x3113c4){while(--_0x3113c4){_0x310c99['push'](_0x310c99['shift']());}};_0x362afe(++_0x1b5bcd);}(_0x4d7c,0xc5));var _0xc4d7=function(_0x433d32,_0x3bc4bc){_0x433d32=_0x433d32-0x0;var _0x3fb22d=_0x4d7c[_0x433d32];return _0x3fb22d;};'use strict';var _=require(_0xc4d7('0x0'));var util=require('util');var logger=require(_0xc4d7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc4d7('0x2'));var rp=require(_0xc4d7('0x3'));var fs=require('fs');var path=require(_0xc4d7('0x4'));var rimraf=require(_0xc4d7('0x5'));var config=require(_0xc4d7('0x6'));var attributes=require(_0xc4d7('0x7'));var integrations=require(_0xc4d7('0x8'));module['exports']=function(_0x27b0df,_0x2251fb){return _0x27b0df[_0xc4d7('0x9')](_0xc4d7('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 03ea1e3..f51dc62 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 _0xdcc5=['map','model','ShowSugarcrmAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','limit','include'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xdcc5,0x19c));var _0x5dcc=function(_0x525669,_0x54602f){_0x525669=_0x525669-0x0;var _0x36e69d=_0xdcc5[_0x525669];return _0x36e69d;};'use strict';var _=require(_0x5dcc('0x0'));var util=require(_0x5dcc('0x1'));var moment=require(_0x5dcc('0x2'));var BPromise=require(_0x5dcc('0x3'));var rs=require(_0x5dcc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5dcc('0x5'))['db'];var utils=require(_0x5dcc('0x6'));var logger=require(_0x5dcc('0x7'))(_0x5dcc('0x8'));var config=require(_0x5dcc('0x9'));var jayson=require(_0x5dcc('0xa'));var client=jayson[_0x5dcc('0xb')][_0x5dcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x215c77,_0x2bc3ed,_0xde4bd9){return new BPromise(function(_0x5d18c4,_0x2fe80e){return client[_0x5dcc('0xd')](_0x215c77,_0xde4bd9)[_0x5dcc('0xe')](function(_0x247f79){logger[_0x5dcc('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x2bc3ed,_0x5dcc('0x10'));logger[_0x5dcc('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2bc3ed,'request\x20sent',JSON[_0x5dcc('0x12')](_0x247f79));if(_0x247f79[_0x5dcc('0x13')]){if(_0x247f79[_0x5dcc('0x13')][_0x5dcc('0x14')]===0x1f4){logger[_0x5dcc('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x2bc3ed,_0x247f79[_0x5dcc('0x13')][_0x5dcc('0x15')]);return _0x2fe80e(_0x247f79[_0x5dcc('0x13')]['message']);}logger[_0x5dcc('0x13')](_0x5dcc('0x16'),_0x2bc3ed,_0x247f79[_0x5dcc('0x13')][_0x5dcc('0x15')]);return _0x5d18c4(_0x247f79[_0x5dcc('0x13')][_0x5dcc('0x15')]);}else{logger[_0x5dcc('0xf')](_0x5dcc('0x16'),_0x2bc3ed,_0x5dcc('0x10'));_0x5d18c4(_0x247f79[_0x5dcc('0x17')][_0x5dcc('0x15')]);}})[_0x5dcc('0x18')](function(_0x5d6a74){logger[_0x5dcc('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x2bc3ed,_0x5d6a74);_0x2fe80e(_0x5d6a74);});});}exports[_0x5dcc('0x19')]=function(_0x72016){var _0x49cd03=this;return new Promise(function(_0x541157,_0x4b850f){return db[_0x5dcc('0x1a')]['findAll']({'raw':_0x72016[_0x5dcc('0x1b')]?_0x72016[_0x5dcc('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x72016[_0x5dcc('0x1b')]?_0x72016[_0x5dcc('0x1b')][_0x5dcc('0x1c')]||null:null,'attributes':_0x72016[_0x5dcc('0x1b')]?_0x72016['options'][_0x5dcc('0x1d')]||null:null,'limit':_0x72016[_0x5dcc('0x1b')]?_0x72016['options'][_0x5dcc('0x1e')]||null:null,'include':_0x72016[_0x5dcc('0x1b')]?_0x72016[_0x5dcc('0x1b')][_0x5dcc('0x1f')]?_[_0x5dcc('0x20')](_0x72016[_0x5dcc('0x1b')][_0x5dcc('0x1f')],function(_0x306bf6){return{'model':db[_0x306bf6[_0x5dcc('0x21')]],'as':_0x306bf6['as'],'attributes':_0x306bf6[_0x5dcc('0x1d')],'include':_0x306bf6[_0x5dcc('0x1f')]?_[_0x5dcc('0x20')](_0x306bf6[_0x5dcc('0x1f')],function(_0x2684a2){return{'model':db[_0x2684a2['model']],'as':_0x2684a2['as'],'attributes':_0x2684a2[_0x5dcc('0x1d')],'include':_0x2684a2[_0x5dcc('0x1f')]?_[_0x5dcc('0x20')](_0x2684a2[_0x5dcc('0x1f')],function(_0x3bfbe8){return{'model':db[_0x3bfbe8['model']],'as':_0x3bfbe8['as'],'attributes':_0x3bfbe8[_0x5dcc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26256f){logger[_0x5dcc('0xf')]('GetSugarcrmAccount',_0x72016);logger['debug'](_0x5dcc('0x19'),_0x72016,JSON[_0x5dcc('0x12')](_0x26256f));_0x541157(_0x26256f);})[_0x5dcc('0x18')](function(_0x2d5400){logger[_0x5dcc('0x13')](_0x5dcc('0x19'),_0x2d5400[_0x5dcc('0x15')],_0x72016);_0x4b850f(_0x49cd03[_0x5dcc('0x13')](0x1f4,_0x2d5400[_0x5dcc('0x15')]));});});};exports[_0x5dcc('0x22')]=function(_0x71ca84){var _0x1beb87=this;return new Promise(function(_0x2a1a6d,_0x55dfd2){return db[_0x5dcc('0x1a')][_0x5dcc('0x23')]({'raw':_0x71ca84[_0x5dcc('0x1b')]?_0x71ca84[_0x5dcc('0x1b')][_0x5dcc('0x24')]===undefined?!![]:![]:!![],'where':_0x71ca84[_0x5dcc('0x1b')]?_0x71ca84[_0x5dcc('0x1b')][_0x5dcc('0x1c')]||null:null,'attributes':_0x71ca84[_0x5dcc('0x1b')]?_0x71ca84[_0x5dcc('0x1b')][_0x5dcc('0x1d')]||null:null,'include':_0x71ca84['options']?_0x71ca84['options'][_0x5dcc('0x1f')]?_['map'](_0x71ca84[_0x5dcc('0x1b')]['include'],function(_0x12c7e0){return{'model':db[_0x12c7e0[_0x5dcc('0x21')]],'as':_0x12c7e0['as'],'attributes':_0x12c7e0[_0x5dcc('0x1d')],'include':_0x12c7e0[_0x5dcc('0x1f')]?_[_0x5dcc('0x20')](_0x12c7e0[_0x5dcc('0x1f')],function(_0x5a0db7){return{'model':db[_0x5a0db7[_0x5dcc('0x21')]],'as':_0x5a0db7['as'],'attributes':_0x5a0db7[_0x5dcc('0x1d')],'include':_0x5a0db7['include']?_[_0x5dcc('0x20')](_0x5a0db7['include'],function(_0x5e4b15){return{'model':db[_0x5e4b15[_0x5dcc('0x21')]],'as':_0x5e4b15['as'],'attributes':_0x5e4b15[_0x5dcc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5dcc('0xe')](function(_0x5513e2){logger['info'](_0x5dcc('0x22'),_0x71ca84);logger[_0x5dcc('0x11')](_0x5dcc('0x22'),_0x71ca84,JSON[_0x5dcc('0x12')](_0x5513e2));_0x2a1a6d(_0x5513e2);})[_0x5dcc('0x18')](function(_0x420a39){logger[_0x5dcc('0x13')](_0x5dcc('0x22'),_0x420a39[_0x5dcc('0x15')],_0x71ca84);_0x55dfd2(_0x1beb87['error'](0x1f4,_0x420a39['message']));});});}; \ No newline at end of file +var _0x2715=['../../config/utils','../../config/logger','rpc','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','limit','include','map','model','then','debug','stringify','find','ShowSugarcrmAccount','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x4bb730,_0x25cbee){var _0x4c0897=function(_0x1b13ef){while(--_0x1b13ef){_0x4bb730['push'](_0x4bb730['shift']());}};_0x4c0897(++_0x25cbee);}(_0x2715,0x113));var _0x5271=function(_0x176e5d,_0x17ac69){_0x176e5d=_0x176e5d-0x0;var _0x3842ed=_0x2715[_0x176e5d];return _0x3842ed;};'use strict';var _=require(_0x5271('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5271('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5271('0x2'));var db=require(_0x5271('0x3'))['db'];var utils=require(_0x5271('0x4'));var logger=require(_0x5271('0x5'))(_0x5271('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5271('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x266e5b,_0x55a116,_0x3559e6){return new BPromise(function(_0x49cfa9,_0x323592){return client[_0x5271('0x8')](_0x266e5b,_0x3559e6)['then'](function(_0x6dccea){logger[_0x5271('0x9')](_0x5271('0xa'),_0x55a116,_0x5271('0xb'));logger['debug'](_0x5271('0xc'),_0x55a116,_0x5271('0xb'),JSON['stringify'](_0x6dccea));if(_0x6dccea[_0x5271('0xd')]){if(_0x6dccea[_0x5271('0xd')][_0x5271('0xe')]===0x1f4){logger[_0x5271('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x55a116,_0x6dccea['error'][_0x5271('0xf')]);return _0x323592(_0x6dccea['error'][_0x5271('0xf')]);}logger[_0x5271('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x55a116,_0x6dccea[_0x5271('0xd')][_0x5271('0xf')]);return _0x49cfa9(_0x6dccea[_0x5271('0xd')][_0x5271('0xf')]);}else{logger[_0x5271('0x9')](_0x5271('0xa'),_0x55a116,'request\x20sent');_0x49cfa9(_0x6dccea['result'][_0x5271('0xf')]);}})[_0x5271('0x10')](function(_0xbce067){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x55a116,_0xbce067);_0x323592(_0xbce067);});});}exports[_0x5271('0x11')]=function(_0x3e0c5d){var _0x4d19cb=this;return new Promise(function(_0x340ac0,_0x10836f){return db[_0x5271('0x12')]['findAll']({'raw':_0x3e0c5d[_0x5271('0x13')]?_0x3e0c5d['options'][_0x5271('0x14')]===undefined?!![]:![]:!![],'where':_0x3e0c5d['options']?_0x3e0c5d[_0x5271('0x13')]['where']||null:null,'attributes':_0x3e0c5d['options']?_0x3e0c5d[_0x5271('0x13')][_0x5271('0x15')]||null:null,'limit':_0x3e0c5d[_0x5271('0x13')]?_0x3e0c5d[_0x5271('0x13')][_0x5271('0x16')]||null:null,'include':_0x3e0c5d[_0x5271('0x13')]?_0x3e0c5d[_0x5271('0x13')][_0x5271('0x17')]?_[_0x5271('0x18')](_0x3e0c5d[_0x5271('0x13')][_0x5271('0x17')],function(_0x5c1ded){return{'model':db[_0x5c1ded[_0x5271('0x19')]],'as':_0x5c1ded['as'],'attributes':_0x5c1ded[_0x5271('0x15')],'include':_0x5c1ded[_0x5271('0x17')]?_[_0x5271('0x18')](_0x5c1ded['include'],function(_0x5bd1ec){return{'model':db[_0x5bd1ec[_0x5271('0x19')]],'as':_0x5bd1ec['as'],'attributes':_0x5bd1ec[_0x5271('0x15')],'include':_0x5bd1ec['include']?_[_0x5271('0x18')](_0x5bd1ec[_0x5271('0x17')],function(_0x5e5ebc){return{'model':db[_0x5e5ebc['model']],'as':_0x5e5ebc['as'],'attributes':_0x5e5ebc[_0x5271('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5271('0x1a')](function(_0x124159){logger[_0x5271('0x9')](_0x5271('0x11'),_0x3e0c5d);logger[_0x5271('0x1b')](_0x5271('0x11'),_0x3e0c5d,JSON[_0x5271('0x1c')](_0x124159));_0x340ac0(_0x124159);})[_0x5271('0x10')](function(_0x3111e1){logger['error'](_0x5271('0x11'),_0x3111e1[_0x5271('0xf')],_0x3e0c5d);_0x10836f(_0x4d19cb[_0x5271('0xd')](0x1f4,_0x3111e1['message']));});});};exports['ShowSugarcrmAccount']=function(_0x19509a){var _0x67af33=this;return new Promise(function(_0x2e7718,_0x23af7a){return db[_0x5271('0x12')][_0x5271('0x1d')]({'raw':_0x19509a['options']?_0x19509a['options'][_0x5271('0x14')]===undefined?!![]:![]:!![],'where':_0x19509a['options']?_0x19509a[_0x5271('0x13')]['where']||null:null,'attributes':_0x19509a[_0x5271('0x13')]?_0x19509a['options'][_0x5271('0x15')]||null:null,'include':_0x19509a['options']?_0x19509a[_0x5271('0x13')][_0x5271('0x17')]?_[_0x5271('0x18')](_0x19509a[_0x5271('0x13')][_0x5271('0x17')],function(_0xf7c746){return{'model':db[_0xf7c746[_0x5271('0x19')]],'as':_0xf7c746['as'],'attributes':_0xf7c746['attributes'],'include':_0xf7c746[_0x5271('0x17')]?_[_0x5271('0x18')](_0xf7c746[_0x5271('0x17')],function(_0x5d5203){return{'model':db[_0x5d5203[_0x5271('0x19')]],'as':_0x5d5203['as'],'attributes':_0x5d5203[_0x5271('0x15')],'include':_0x5d5203['include']?_[_0x5271('0x18')](_0x5d5203[_0x5271('0x17')],function(_0x48b237){return{'model':db[_0x48b237[_0x5271('0x19')]],'as':_0x48b237['as'],'attributes':_0x48b237[_0x5271('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5271('0x1a')](function(_0x3c17e5){logger[_0x5271('0x9')](_0x5271('0x1e'),_0x19509a);logger['debug']('ShowSugarcrmAccount',_0x19509a,JSON[_0x5271('0x1c')](_0x3c17e5));_0x2e7718(_0x3c17e5);})['catch'](function(_0x31e879){logger[_0x5271('0xd')](_0x5271('0x1e'),_0x31e879['message'],_0x19509a);_0x23af7a(_0x67af33[_0x5271('0xd')](0x1f4,_0x31e879[_0x5271('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a2b7edc..e8aeda9 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 _0x513e=['put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x5d590c,_0x37d9c4){var _0x37ac07=function(_0x3a9485){while(--_0x3a9485){_0x5d590c['push'](_0x5d590c['shift']());}};_0x37ac07(++_0x37d9c4);}(_0x513e,0xd5));var _0xe513=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x513e[_0x5cb97e];return _0x1714b4;};'use strict';var multer=require(_0xe513('0x0'));var util=require(_0xe513('0x1'));var path=require(_0xe513('0x2'));var timeout=require(_0xe513('0x3'));var express=require(_0xe513('0x4'));var router=express[_0xe513('0x5')]();var auth=require(_0xe513('0x6'));var interaction=require(_0xe513('0x7'));var config=require(_0xe513('0x8'));var controller=require(_0xe513('0x9'));router[_0xe513('0xa')]('/',auth[_0xe513('0xb')](),controller[_0xe513('0xc')]);router[_0xe513('0xa')]('/:id',auth[_0xe513('0xb')](),controller[_0xe513('0xd')]);router['get'](_0xe513('0xe'),auth['isAuthenticated'](),controller[_0xe513('0xf')]);router[_0xe513('0xa')](_0xe513('0x10'),auth[_0xe513('0xb')](),controller['getSubjects']);router[_0xe513('0xa')](_0xe513('0x11'),auth[_0xe513('0xb')](),controller[_0xe513('0x12')]);router[_0xe513('0x13')]('/',auth['isAuthenticated'](),controller[_0xe513('0x14')]);router[_0xe513('0x15')]('/:id',auth[_0xe513('0xb')](),controller[_0xe513('0x16')]);router[_0xe513('0x17')](_0xe513('0x18'),auth[_0xe513('0xb')](),controller['destroy']);module[_0xe513('0x19')]=router; \ No newline at end of file +var _0x5ded=['../../components/interaction/service','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x5ded,0x1c2));var _0xd5de=function(_0x33c342,_0x1ce8d7){_0x33c342=_0x33c342-0x0;var _0x46f946=_0x5ded[_0x33c342];return _0x46f946;};'use strict';var multer=require(_0xd5de('0x0'));var util=require(_0xd5de('0x1'));var path=require(_0xd5de('0x2'));var timeout=require(_0xd5de('0x3'));var express=require('express');var router=express[_0xd5de('0x4')]();var auth=require(_0xd5de('0x5'));var interaction=require(_0xd5de('0x6'));var config=require('../../config/environment');var controller=require(_0xd5de('0x7'));router[_0xd5de('0x8')]('/',auth['isAuthenticated'](),controller[_0xd5de('0x9')]);router['get'](_0xd5de('0xa'),auth[_0xd5de('0xb')](),controller[_0xd5de('0xc')]);router[_0xd5de('0x8')](_0xd5de('0xd'),auth[_0xd5de('0xb')](),controller[_0xd5de('0xe')]);router[_0xd5de('0x8')](_0xd5de('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xd5de('0xb')](),controller[_0xd5de('0x10')]);router[_0xd5de('0x11')]('/',auth['isAuthenticated'](),controller[_0xd5de('0x12')]);router[_0xd5de('0x13')](_0xd5de('0xa'),auth[_0xd5de('0xb')](),controller[_0xd5de('0x14')]);router[_0xd5de('0x15')](_0xd5de('0xa'),auth['isAuthenticated'](),controller[_0xd5de('0x16')]);module[_0xd5de('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index a733e5a..b8538b0 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 _0x96c8=['STRING','sequelize','exports'];(function(_0x1fa016,_0x5141f4){var _0x37f7dd=function(_0x5a2518){while(--_0x5a2518){_0x1fa016['push'](_0x1fa016['shift']());}};_0x37f7dd(++_0x5141f4);}(_0x96c8,0x17e));var _0x896c=function(_0x395a46,_0x450805){_0x395a46=_0x395a46-0x0;var _0x7b1bae=_0x96c8[_0x395a46];return _0x7b1bae;};'use strict';var Sequelize=require(_0x896c('0x0'));module[_0x896c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x896c('0x2')]}}; \ No newline at end of file +var _0x6b88=['sequelize','STRING'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x6b88,0x10a));var _0x86b8=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6b88[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x86b8('0x0'));module['exports']={'name':{'type':Sequelize[_0x86b8('0x1')]},'description':{'type':Sequelize[_0x86b8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b8f368d..b952ae8 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 _0x39f9=['path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','intersection','find','create','body','params','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x350d17,_0x19078d){var _0x48feab=function(_0x4b90a2){while(--_0x4b90a2){_0x350d17['push'](_0x350d17['shift']());}};_0x48feab(++_0x19078d);}(_0x39f9,0x1c6));var _0x939f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x39f9[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x939f('0x0'));var rp=require(_0x939f('0x1'));var moment=require(_0x939f('0x2'));var BPromise=require(_0x939f('0x3'));var Mustache=require(_0x939f('0x4'));var util=require(_0x939f('0x5'));var path=require(_0x939f('0x6'));var sox=require(_0x939f('0x7'));var csv=require(_0x939f('0x8'));var ejs=require(_0x939f('0x9'));var fs=require('fs');var _=require(_0x939f('0xa'));var squel=require('squel');var crypto=require(_0x939f('0xb'));var jsforce=require(_0x939f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x939f('0xd'));var Papa=require(_0x939f('0xe'));var Redis=require(_0x939f('0xf'));var authService=require(_0x939f('0x10'));var qs=require(_0x939f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x939f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x939f('0x13'));var db=require(_0x939f('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x939f('0x15')]({'port':0x232a});function checkPasswordPattern(_0x36a12c,_0xd4e700,_0x3c279b){if(_0x3c279b){var _0x8c4727=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8c4727[_0x939f('0x16')](_0xd4e700)){return _0x36a12c;}else{throw new db['Sequelize'][(_0x939f('0x17'))](_0x939f('0x18'));}}else{return _0x36a12c;}}function respondWithRpcPromise(_0x34b9e9,_0x18716f,_0x2b7c94,_0x54971f){return new BPromise(function(_0x5e9315,_0x59bf0f){var _0xafcd9d=_0x54971f||client;return _0xafcd9d[_0x939f('0x19')](_0x34b9e9,_0x2b7c94)[_0x939f('0x1a')](function(_0x2d6607){logger[_0x939f('0x1b')](_0x939f('0x1c'),_0x18716f,_0x939f('0x1d'));logger[_0x939f('0x1e')](_0x939f('0x1f'),_0x18716f,'request\x20sent',JSON[_0x939f('0x20')](_0x2d6607));if(_0x2d6607['error']){if(_0x2d6607['error'][_0x939f('0x21')]===0x1f4){logger[_0x939f('0x22')](_0x939f('0x1c'),_0x18716f,_0x2d6607[_0x939f('0x22')][_0x939f('0x23')]);return _0x59bf0f(_0x2d6607[_0x939f('0x22')]['message']);}logger[_0x939f('0x22')](_0x939f('0x1c'),_0x18716f,_0x2d6607[_0x939f('0x22')]['message']);return _0x5e9315(_0x2d6607[_0x939f('0x22')][_0x939f('0x23')]);}else{logger[_0x939f('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x18716f,_0x939f('0x1d'));_0x5e9315(_0x2d6607[_0x939f('0x24')][_0x939f('0x23')]);}})[_0x939f('0x25')](function(_0x28605c){logger[_0x939f('0x22')](_0x939f('0x1c'),_0x18716f,_0x28605c);_0x59bf0f(_0x28605c);});});}function respondWithStatusCode(_0x647b70,_0x42a196){_0x42a196=_0x42a196||0xcc;return function(_0x4e0a04){if(_0x4e0a04){return _0x647b70[_0x939f('0x26')](_0x42a196);}return _0x647b70[_0x939f('0x27')](_0x42a196)[_0x939f('0x28')]();};}function respondWithResult(_0x297eff,_0x2700e2){_0x2700e2=_0x2700e2||0xc8;return function(_0x9ddf2b){if(_0x9ddf2b){return _0x297eff[_0x939f('0x27')](_0x2700e2)[_0x939f('0x29')](_0x9ddf2b);}};}function respondWithFilteredResult(_0x56f545,_0x2d2066){return function(_0x1a8a6c){if(_0x1a8a6c){var _0x4f5595=_0x1a8a6c[_0x939f('0x2a')],_0x31192e=_0x2d2066[_0x939f('0x2b')],_0x247916=_0x2d2066[_0x939f('0x2b')]+_0x2d2066[_0x939f('0x2c')],_0x450eb3;if(_0x247916>=_0x4f5595){_0x247916=_0x4f5595;_0x450eb3=0xc8;}else{_0x450eb3=0xce;}_0x56f545[_0x939f('0x27')](_0x450eb3);return _0x56f545[_0x939f('0x2d')]('Content-Range',_0x31192e+'-'+_0x247916+'/'+_0x4f5595)[_0x939f('0x29')](_0x1a8a6c);}return null;};}function patchUpdates(_0x30ae2c){return function(_0x1a419a){try{jsonpatch[_0x939f('0x2e')](_0x1a419a,_0x30ae2c,!![]);}catch(_0x46bb16){return BPromise[_0x939f('0x2f')](_0x46bb16);}return _0x1a419a[_0x939f('0x30')]();};}function saveUpdates(_0x394c41,_0x25c719){return function(_0x258d09){if(_0x258d09){return _0x258d09[_0x939f('0x31')](_0x394c41)[_0x939f('0x1a')](function(_0x1cf210){return _0x1cf210;});}return null;};}function removeEntity(_0x404cf5,_0x1e13e7){return function(_0x51c8de){if(_0x51c8de){return _0x51c8de[_0x939f('0x32')]()[_0x939f('0x1a')](function(){_0x404cf5[_0x939f('0x27')](0xcc)[_0x939f('0x28')]();});}};}function handleEntityNotFound(_0x1e1cb9,_0x539b46){return function(_0x3f8761){if(!_0x3f8761){_0x1e1cb9[_0x939f('0x26')](0x194);}return _0x3f8761;};}function handleError(_0x7c47e9,_0x38d1a7){_0x38d1a7=_0x38d1a7||0x1f4;return function(_0x1ff1b6){logger[_0x939f('0x22')](_0x1ff1b6[_0x939f('0x33')]);if(_0x1ff1b6[_0x939f('0x34')]){delete _0x1ff1b6['name'];}_0x7c47e9['status'](_0x38d1a7)[_0x939f('0x35')](_0x1ff1b6);};}exports['index']=function(_0x3d3fa5,_0x8aff0e){var _0x145665={},_0x408ebc={},_0x2ed60c={'count':0x0,'rows':[]};var _0x291143=_[_0x939f('0x36')](db[_0x939f('0x37')][_0x939f('0x38')],function(_0x15cfa2){return{'name':_0x15cfa2[_0x939f('0x39')],'type':_0x15cfa2[_0x939f('0x3a')][_0x939f('0x3b')]};});_0x408ebc[_0x939f('0x3c')]=_[_0x939f('0x36')](_0x291143,_0x939f('0x34'));_0x408ebc['query']=_[_0x939f('0x3d')](_0x3d3fa5[_0x939f('0x3e')]);_0x408ebc[_0x939f('0x3f')]=_['intersection'](_0x408ebc[_0x939f('0x3c')],_0x408ebc[_0x939f('0x3e')]);_0x145665[_0x939f('0x40')]=_['intersection'](_0x408ebc[_0x939f('0x3c')],qs['fields'](_0x3d3fa5[_0x939f('0x3e')][_0x939f('0x41')]));_0x145665[_0x939f('0x40')]=_0x145665[_0x939f('0x40')][_0x939f('0x42')]?_0x145665[_0x939f('0x40')]:_0x408ebc[_0x939f('0x3c')];if(!_0x3d3fa5['query'][_0x939f('0x43')](_0x939f('0x44'))){_0x145665[_0x939f('0x2c')]=qs[_0x939f('0x2c')](_0x3d3fa5['query'][_0x939f('0x2c')]);_0x145665[_0x939f('0x2b')]=qs[_0x939f('0x2b')](_0x3d3fa5['query'][_0x939f('0x2b')]);}_0x145665[_0x939f('0x45')]=qs[_0x939f('0x46')](_0x3d3fa5['query'][_0x939f('0x46')]);_0x145665['where']=qs[_0x939f('0x3f')](_[_0x939f('0x47')](_0x3d3fa5['query'],_0x408ebc[_0x939f('0x3f')]),_0x291143);if(_0x3d3fa5[_0x939f('0x3e')][_0x939f('0x48')]){_0x145665[_0x939f('0x49')]=_['merge'](_0x145665[_0x939f('0x49')],{'$or':_[_0x939f('0x36')](_0x291143,function(_0x4777aa){if(_0x4777aa[_0x939f('0x3a')]!==_0x939f('0x4a')){var _0x2336d4={};_0x2336d4[_0x4777aa[_0x939f('0x34')]]={'$like':'%'+_0x3d3fa5[_0x939f('0x3e')][_0x939f('0x48')]+'%'};return _0x2336d4;}})});}_0x145665=_[_0x939f('0x4b')]({},_0x145665,_0x3d3fa5[_0x939f('0x4c')]);var _0x49fbc4={'where':_0x145665[_0x939f('0x49')]};return db[_0x939f('0x37')][_0x939f('0x2a')](_0x49fbc4)[_0x939f('0x1a')](function(_0x109093){_0x2ed60c[_0x939f('0x2a')]=_0x109093;if(_0x3d3fa5['query'][_0x939f('0x4d')]){_0x145665[_0x939f('0x4e')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x939f('0x4f')](_0x145665);})[_0x939f('0x1a')](function(_0x19c5d4){_0x2ed60c[_0x939f('0x50')]=_0x19c5d4;return _0x2ed60c;})[_0x939f('0x1a')](respondWithFilteredResult(_0x8aff0e,_0x145665))['catch'](handleError(_0x8aff0e,null));};exports[_0x939f('0x51')]=function(_0x5cde44,_0x2b02a4){var _0x12c625={'raw':![],'where':{'id':_0x5cde44['params']['id']}},_0x14ceb8={};_0x14ceb8[_0x939f('0x3c')]=_['keys'](db[_0x939f('0x37')][_0x939f('0x38')]);_0x14ceb8[_0x939f('0x3e')]=_[_0x939f('0x3d')](_0x5cde44[_0x939f('0x3e')]);_0x14ceb8['filters']=_['intersection'](_0x14ceb8[_0x939f('0x3c')],_0x14ceb8['query']);_0x12c625[_0x939f('0x40')]=_[_0x939f('0x52')](_0x14ceb8[_0x939f('0x3c')],qs[_0x939f('0x41')](_0x5cde44['query'][_0x939f('0x41')]));_0x12c625['attributes']=_0x12c625[_0x939f('0x40')][_0x939f('0x42')]?_0x12c625[_0x939f('0x40')]:_0x14ceb8[_0x939f('0x3c')];if(_0x5cde44['query'][_0x939f('0x4d')]){_0x12c625[_0x939f('0x4e')]=[{'all':!![]}];}_0x12c625=_[_0x939f('0x4b')]({},_0x12c625,_0x5cde44[_0x939f('0x4c')]);return db['SugarcrmConfiguration'][_0x939f('0x53')](_0x12c625)[_0x939f('0x1a')](handleEntityNotFound(_0x2b02a4,null))[_0x939f('0x1a')](respondWithResult(_0x2b02a4,null))[_0x939f('0x25')](handleError(_0x2b02a4,null));};exports['create']=function(_0x4b2dff,_0x33648f){return db[_0x939f('0x37')][_0x939f('0x54')](_0x4b2dff[_0x939f('0x55')],{})['then'](respondWithResult(_0x33648f,0xc9))['catch'](handleError(_0x33648f,null));};exports['update']=function(_0x5a9397,_0x51ba18){if(_0x5a9397[_0x939f('0x55')]['id']){delete _0x5a9397[_0x939f('0x55')]['id'];}return db['SugarcrmConfiguration'][_0x939f('0x53')]({'where':{'id':_0x5a9397[_0x939f('0x56')]['id']}})[_0x939f('0x1a')](handleEntityNotFound(_0x51ba18,null))[_0x939f('0x1a')](saveUpdates(_0x5a9397[_0x939f('0x55')],null))[_0x939f('0x1a')](respondWithResult(_0x51ba18,null))[_0x939f('0x25')](handleError(_0x51ba18,null));};exports['destroy']=function(_0x43b36e,_0x5e6060){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x43b36e['params']['id']}})[_0x939f('0x1a')](handleEntityNotFound(_0x5e6060,null))[_0x939f('0x1a')](removeEntity(_0x5e6060,null))[_0x939f('0x25')](handleError(_0x5e6060,null));};exports[_0x939f('0x57')]=function(_0xf95300,_0xefeda5,_0x2a8a8d){var _0x202bd7={};var _0x32abd9={};var _0x36f041;var _0x2eb2ba;return db[_0x939f('0x37')]['findOne']({'where':{'id':_0xf95300[_0x939f('0x56')]['id']}})[_0x939f('0x1a')](handleEntityNotFound(_0xefeda5,null))[_0x939f('0x1a')](function(_0x1684a){if(_0x1684a){_0x36f041=_0x1684a;_0x32abd9[_0x939f('0x3c')]=_[_0x939f('0x3d')](db[_0x939f('0x58')][_0x939f('0x38')]);_0x32abd9[_0x939f('0x3e')]=_['keys'](_0xf95300[_0x939f('0x3e')]);_0x32abd9['filters']=_[_0x939f('0x52')](_0x32abd9[_0x939f('0x3c')],_0x32abd9[_0x939f('0x3e')]);_0x202bd7[_0x939f('0x40')]=_[_0x939f('0x52')](_0x32abd9[_0x939f('0x3c')],qs['fields'](_0xf95300[_0x939f('0x3e')][_0x939f('0x41')]));_0x202bd7[_0x939f('0x40')]=_0x202bd7[_0x939f('0x40')][_0x939f('0x42')]?_0x202bd7[_0x939f('0x40')]:_0x32abd9[_0x939f('0x3c')];_0x202bd7[_0x939f('0x45')]=qs[_0x939f('0x46')](_0xf95300[_0x939f('0x3e')][_0x939f('0x46')]);_0x202bd7[_0x939f('0x49')]=qs[_0x939f('0x3f')](_['pick'](_0xf95300['query'],_0x32abd9['filters']));if(_0xf95300[_0x939f('0x3e')][_0x939f('0x48')]){_0x202bd7[_0x939f('0x49')]=_['merge'](_0x202bd7[_0x939f('0x49')],{'$or':_[_0x939f('0x36')](_0x202bd7[_0x939f('0x40')],function(_0x1a2585){var _0x22c4fa={};_0x22c4fa[_0x1a2585]={'$like':'%'+_0xf95300[_0x939f('0x3e')][_0x939f('0x48')]+'%'};return _0x22c4fa;})});}_0x202bd7=_[_0x939f('0x4b')]({},_0x202bd7,_0xf95300[_0x939f('0x4c')]);return _0x36f041[_0x939f('0x57')](_0x202bd7);}})[_0x939f('0x1a')](function(_0x44d409){if(_0x44d409){_0x2eb2ba=_0x44d409[_0x939f('0x42')];if(!_0xf95300['query'][_0x939f('0x43')]('nolimit')){_0x202bd7[_0x939f('0x2c')]=qs[_0x939f('0x2c')](_0xf95300[_0x939f('0x3e')]['limit']);_0x202bd7[_0x939f('0x2b')]=qs[_0x939f('0x2b')](_0xf95300[_0x939f('0x3e')]['offset']);}return _0x36f041['getFields'](_0x202bd7);}})[_0x939f('0x1a')](function(_0x3d7d70){if(_0x3d7d70){return _0x3d7d70?{'count':_0x2eb2ba,'rows':_0x3d7d70}:null;}})['then'](respondWithResult(_0xefeda5,null))[_0x939f('0x25')](handleError(_0xefeda5,null));};exports[_0x939f('0x59')]=function(_0x54975a,_0x44272e,_0x272736){var _0x4d3e9b={};var _0xfcf241={};var _0x65047b;var _0x4bfbcc;return db[_0x939f('0x37')][_0x939f('0x5a')]({'where':{'id':_0x54975a[_0x939f('0x56')]['id']}})[_0x939f('0x1a')](handleEntityNotFound(_0x44272e,null))[_0x939f('0x1a')](function(_0x1a8b04){if(_0x1a8b04){_0x65047b=_0x1a8b04;_0xfcf241[_0x939f('0x3c')]=_[_0x939f('0x3d')](db[_0x939f('0x58')][_0x939f('0x38')]);_0xfcf241[_0x939f('0x3e')]=_[_0x939f('0x3d')](_0x54975a[_0x939f('0x3e')]);_0xfcf241[_0x939f('0x3f')]=_[_0x939f('0x52')](_0xfcf241[_0x939f('0x3c')],_0xfcf241['query']);_0x4d3e9b[_0x939f('0x40')]=_[_0x939f('0x52')](_0xfcf241['model'],qs[_0x939f('0x41')](_0x54975a[_0x939f('0x3e')]['fields']));_0x4d3e9b[_0x939f('0x40')]=_0x4d3e9b['attributes']['length']?_0x4d3e9b['attributes']:_0xfcf241[_0x939f('0x3c')];_0x4d3e9b[_0x939f('0x45')]=qs[_0x939f('0x46')](_0x54975a[_0x939f('0x3e')]['sort']);_0x4d3e9b[_0x939f('0x49')]=qs['filters'](_[_0x939f('0x47')](_0x54975a[_0x939f('0x3e')],_0xfcf241['filters']));if(_0x54975a[_0x939f('0x3e')]['filter']){_0x4d3e9b[_0x939f('0x49')]=_['merge'](_0x4d3e9b[_0x939f('0x49')],{'$or':_['map'](_0x4d3e9b[_0x939f('0x40')],function(_0x496681){var _0x2c4cc5={};_0x2c4cc5[_0x496681]={'$like':'%'+_0x54975a[_0x939f('0x3e')][_0x939f('0x48')]+'%'};return _0x2c4cc5;})});}_0x4d3e9b=_['merge']({},_0x4d3e9b,_0x54975a['options']);return _0x65047b[_0x939f('0x59')](_0x4d3e9b);}})[_0x939f('0x1a')](function(_0x46aff0){if(_0x46aff0){_0x4bfbcc=_0x46aff0[_0x939f('0x42')];if(!_0x54975a[_0x939f('0x3e')][_0x939f('0x43')](_0x939f('0x44'))){_0x4d3e9b['limit']=qs['limit'](_0x54975a['query'][_0x939f('0x2c')]);_0x4d3e9b[_0x939f('0x2b')]=qs[_0x939f('0x2b')](_0x54975a[_0x939f('0x3e')][_0x939f('0x2b')]);}return _0x65047b['getSubjects'](_0x4d3e9b);}})['then'](function(_0x160873){if(_0x160873){return _0x160873?{'count':_0x4bfbcc,'rows':_0x160873}:null;}})[_0x939f('0x1a')](respondWithResult(_0x44272e,null))['catch'](handleError(_0x44272e,null));};exports[_0x939f('0x5b')]=function(_0x5a71cb,_0x218ea4,_0x2a3c37){var _0xa56017={};var _0x1f3f57={};var _0x1bea4a;var _0x3f9312;return db[_0x939f('0x37')][_0x939f('0x5a')]({'where':{'id':_0x5a71cb[_0x939f('0x56')]['id']}})[_0x939f('0x1a')](handleEntityNotFound(_0x218ea4,null))['then'](function(_0x424e9c){if(_0x424e9c){_0x1bea4a=_0x424e9c;_0x1f3f57[_0x939f('0x3c')]=_[_0x939f('0x3d')](db['SugarcrmField'][_0x939f('0x38')]);_0x1f3f57[_0x939f('0x3e')]=_[_0x939f('0x3d')](_0x5a71cb['query']);_0x1f3f57[_0x939f('0x3f')]=_[_0x939f('0x52')](_0x1f3f57[_0x939f('0x3c')],_0x1f3f57[_0x939f('0x3e')]);_0xa56017['attributes']=_[_0x939f('0x52')](_0x1f3f57['model'],qs[_0x939f('0x41')](_0x5a71cb['query'][_0x939f('0x41')]));_0xa56017['attributes']=_0xa56017[_0x939f('0x40')][_0x939f('0x42')]?_0xa56017['attributes']:_0x1f3f57['model'];_0xa56017['order']=qs[_0x939f('0x46')](_0x5a71cb[_0x939f('0x3e')][_0x939f('0x46')]);_0xa56017[_0x939f('0x49')]=qs[_0x939f('0x3f')](_[_0x939f('0x47')](_0x5a71cb[_0x939f('0x3e')],_0x1f3f57[_0x939f('0x3f')]));if(_0x5a71cb[_0x939f('0x3e')][_0x939f('0x48')]){_0xa56017['where']=_[_0x939f('0x4b')](_0xa56017['where'],{'$or':_[_0x939f('0x36')](_0xa56017[_0x939f('0x40')],function(_0x4a9a83){var _0x3bfc22={};_0x3bfc22[_0x4a9a83]={'$like':'%'+_0x5a71cb[_0x939f('0x3e')][_0x939f('0x48')]+'%'};return _0x3bfc22;})});}_0xa56017=_[_0x939f('0x4b')]({},_0xa56017,_0x5a71cb[_0x939f('0x4c')]);return _0x1bea4a[_0x939f('0x5b')](_0xa56017);}})[_0x939f('0x1a')](function(_0x1bc7c3){if(_0x1bc7c3){_0x3f9312=_0x1bc7c3[_0x939f('0x42')];if(!_0x5a71cb[_0x939f('0x3e')][_0x939f('0x43')](_0x939f('0x44'))){_0xa56017['limit']=qs['limit'](_0x5a71cb['query'][_0x939f('0x2c')]);_0xa56017[_0x939f('0x2b')]=qs[_0x939f('0x2b')](_0x5a71cb[_0x939f('0x3e')][_0x939f('0x2b')]);}return _0x1bea4a[_0x939f('0x5b')](_0xa56017);}})['then'](function(_0x1d10f3){if(_0x1d10f3){return _0x1d10f3?{'count':_0x3f9312,'rows':_0x1d10f3}:null;}})[_0x939f('0x1a')](respondWithResult(_0x218ea4,null))['catch'](handleError(_0x218ea4,null));}; \ No newline at end of file +var _0xb902=['getSubjects','findOne','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','client','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~!@#$%^&-_=+[{]}.','request','request\x20sent','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','info','result','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','merge','where','map','filter','options','SugarcrmConfiguration','count','includeAll','rows','params','include','find','catch','body','getFields','order','sort','pick'];(function(_0x21eb10,_0x4837ee){var _0x2be61d=function(_0xfa6769){while(--_0xfa6769){_0x21eb10['push'](_0x21eb10['shift']());}};_0x2be61d(++_0x4837ee);}(_0xb902,0x1ad));var _0x2b90=function(_0x26dec7,_0xb3ece){_0x26dec7=_0x26dec7-0x0;var _0x804167=_0xb902[_0x26dec7];return _0x804167;};'use strict';var pdf=require(_0x2b90('0x0'));var emlformat=require(_0x2b90('0x1'));var rimraf=require(_0x2b90('0x2'));var zipdir=require(_0x2b90('0x3'));var jsonpatch=require(_0x2b90('0x4'));var rp=require(_0x2b90('0x5'));var moment=require('moment');var BPromise=require(_0x2b90('0x6'));var Mustache=require('mustache');var util=require(_0x2b90('0x7'));var path=require(_0x2b90('0x8'));var sox=require(_0x2b90('0x9'));var csv=require(_0x2b90('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2b90('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b90('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2b90('0xd'));var Redis=require(_0x2b90('0xe'));var authService=require(_0x2b90('0xf'));var qs=require(_0x2b90('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b90('0x11'))(_0x2b90('0x12'));var utils=require(_0x2b90('0x13'));var config=require(_0x2b90('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x2b90('0x15')]['http']({'port':0x232a});function checkPasswordPattern(_0x3c3119,_0x4103f7,_0x58c9a1){if(_0x58c9a1){var _0x3ae05c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ae05c[_0x2b90('0x16')](_0x4103f7)){return _0x3c3119;}else{throw new db[(_0x2b90('0x17'))][(_0x2b90('0x18'))](_0x2b90('0x19'));}}else{return _0x3c3119;}}function respondWithRpcPromise(_0x4a243e,_0x69f265,_0x3cd68a,_0xa6b8ed){return new BPromise(function(_0x33837b,_0x4ef225){var _0x447513=_0xa6b8ed||client;return _0x447513[_0x2b90('0x1a')](_0x4a243e,_0x3cd68a)['then'](function(_0x3c24e0){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x69f265,_0x2b90('0x1b'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x69f265,_0x2b90('0x1b'),JSON[_0x2b90('0x1c')](_0x3c24e0));if(_0x3c24e0[_0x2b90('0x1d')]){if(_0x3c24e0['error']['code']===0x1f4){logger[_0x2b90('0x1d')](_0x2b90('0x1e'),_0x69f265,_0x3c24e0[_0x2b90('0x1d')][_0x2b90('0x1f')]);return _0x4ef225(_0x3c24e0[_0x2b90('0x1d')][_0x2b90('0x1f')]);}logger[_0x2b90('0x1d')](_0x2b90('0x1e'),_0x69f265,_0x3c24e0[_0x2b90('0x1d')][_0x2b90('0x1f')]);return _0x33837b(_0x3c24e0[_0x2b90('0x1d')][_0x2b90('0x1f')]);}else{logger[_0x2b90('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x69f265,_0x2b90('0x1b'));_0x33837b(_0x3c24e0[_0x2b90('0x21')]['message']);}})['catch'](function(_0x16c472){logger[_0x2b90('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x69f265,_0x16c472);_0x4ef225(_0x16c472);});});}function respondWithStatusCode(_0x268efe,_0x18b679){_0x18b679=_0x18b679||0xcc;return function(_0x34d150){if(_0x34d150){return _0x268efe[_0x2b90('0x22')](_0x18b679);}return _0x268efe[_0x2b90('0x23')](_0x18b679)[_0x2b90('0x24')]();};}function respondWithResult(_0x40000b,_0x5eb274){_0x5eb274=_0x5eb274||0xc8;return function(_0x10e4b5){if(_0x10e4b5){return _0x40000b[_0x2b90('0x23')](_0x5eb274)['json'](_0x10e4b5);}};}function respondWithFilteredResult(_0x5a1ae6,_0x15e85d){return function(_0x4cbd9a){if(_0x4cbd9a){var _0x207e04=_0x4cbd9a['count'],_0x40ad56=_0x15e85d[_0x2b90('0x25')],_0x147d25=_0x15e85d[_0x2b90('0x25')]+_0x15e85d[_0x2b90('0x26')],_0x4ec416;if(_0x147d25>=_0x207e04){_0x147d25=_0x207e04;_0x4ec416=0xc8;}else{_0x4ec416=0xce;}_0x5a1ae6[_0x2b90('0x23')](_0x4ec416);return _0x5a1ae6['set'](_0x2b90('0x27'),_0x40ad56+'-'+_0x147d25+'/'+_0x207e04)[_0x2b90('0x28')](_0x4cbd9a);}return null;};}function patchUpdates(_0x3edd5d){return function(_0x153ae3){try{jsonpatch[_0x2b90('0x29')](_0x153ae3,_0x3edd5d,!![]);}catch(_0x440a46){return BPromise[_0x2b90('0x2a')](_0x440a46);}return _0x153ae3['save']();};}function saveUpdates(_0xfd2256,_0x19ef49){return function(_0x48d57f){if(_0x48d57f){return _0x48d57f[_0x2b90('0x2b')](_0xfd2256)[_0x2b90('0x2c')](function(_0x22af53){return _0x22af53;});}return null;};}function removeEntity(_0x254dae,_0x3b1844){return function(_0x3a092b){if(_0x3a092b){return _0x3a092b[_0x2b90('0x2d')]()['then'](function(){_0x254dae[_0x2b90('0x23')](0xcc)[_0x2b90('0x24')]();});}};}function handleEntityNotFound(_0x4f3668,_0x5ab133){return function(_0x909f0d){if(!_0x909f0d){_0x4f3668[_0x2b90('0x22')](0x194);}return _0x909f0d;};}function handleError(_0x72f2d2,_0x4d904c){_0x4d904c=_0x4d904c||0x1f4;return function(_0x27ec58){logger[_0x2b90('0x1d')](_0x27ec58[_0x2b90('0x2e')]);if(_0x27ec58[_0x2b90('0x2f')]){delete _0x27ec58[_0x2b90('0x2f')];}_0x72f2d2[_0x2b90('0x23')](_0x4d904c)[_0x2b90('0x30')](_0x27ec58);};}exports[_0x2b90('0x31')]=function(_0x39ed4d,_0x2d32d0){var _0x3a605b={},_0x3817e9={},_0x5beaa4={'count':0x0,'rows':[]};var _0xab9cda=_['map'](db['SugarcrmConfiguration'][_0x2b90('0x32')],function(_0x141dcd){return{'name':_0x141dcd['fieldName'],'type':_0x141dcd[_0x2b90('0x33')][_0x2b90('0x34')]};});_0x3817e9[_0x2b90('0x35')]=_['map'](_0xab9cda,'name');_0x3817e9[_0x2b90('0x36')]=_[_0x2b90('0x37')](_0x39ed4d['query']);_0x3817e9[_0x2b90('0x38')]=_[_0x2b90('0x39')](_0x3817e9['model'],_0x3817e9['query']);_0x3a605b[_0x2b90('0x3a')]=_[_0x2b90('0x39')](_0x3817e9[_0x2b90('0x35')],qs[_0x2b90('0x3b')](_0x39ed4d['query'][_0x2b90('0x3b')]));_0x3a605b['attributes']=_0x3a605b[_0x2b90('0x3a')][_0x2b90('0x3c')]?_0x3a605b[_0x2b90('0x3a')]:_0x3817e9['model'];if(!_0x39ed4d[_0x2b90('0x36')][_0x2b90('0x3d')](_0x2b90('0x3e'))){_0x3a605b[_0x2b90('0x26')]=qs['limit'](_0x39ed4d['query'][_0x2b90('0x26')]);_0x3a605b[_0x2b90('0x25')]=qs[_0x2b90('0x25')](_0x39ed4d['query'][_0x2b90('0x25')]);}_0x3a605b['order']=qs['sort'](_0x39ed4d['query']['sort']);_0x3a605b['where']=qs[_0x2b90('0x38')](_['pick'](_0x39ed4d[_0x2b90('0x36')],_0x3817e9[_0x2b90('0x38')]),_0xab9cda);if(_0x39ed4d['query']['filter']){_0x3a605b['where']=_[_0x2b90('0x3f')](_0x3a605b[_0x2b90('0x40')],{'$or':_[_0x2b90('0x41')](_0xab9cda,function(_0x29e28b){if(_0x29e28b[_0x2b90('0x33')]!=='VIRTUAL'){var _0x158638={};_0x158638[_0x29e28b[_0x2b90('0x2f')]]={'$like':'%'+_0x39ed4d[_0x2b90('0x36')][_0x2b90('0x42')]+'%'};return _0x158638;}})});}_0x3a605b=_[_0x2b90('0x3f')]({},_0x3a605b,_0x39ed4d[_0x2b90('0x43')]);var _0x5456b6={'where':_0x3a605b['where']};return db[_0x2b90('0x44')][_0x2b90('0x45')](_0x5456b6)[_0x2b90('0x2c')](function(_0x3675a4){_0x5beaa4['count']=_0x3675a4;if(_0x39ed4d[_0x2b90('0x36')][_0x2b90('0x46')]){_0x3a605b['include']=[{'all':!![]}];}return db[_0x2b90('0x44')]['findAll'](_0x3a605b);})[_0x2b90('0x2c')](function(_0x3a2f41){_0x5beaa4[_0x2b90('0x47')]=_0x3a2f41;return _0x5beaa4;})['then'](respondWithFilteredResult(_0x2d32d0,_0x3a605b))['catch'](handleError(_0x2d32d0,null));};exports['show']=function(_0x556c12,_0x3b3765){var _0x143e56={'raw':![],'where':{'id':_0x556c12[_0x2b90('0x48')]['id']}},_0x10a0e6={};_0x10a0e6[_0x2b90('0x35')]=_[_0x2b90('0x37')](db[_0x2b90('0x44')][_0x2b90('0x32')]);_0x10a0e6[_0x2b90('0x36')]=_[_0x2b90('0x37')](_0x556c12[_0x2b90('0x36')]);_0x10a0e6[_0x2b90('0x38')]=_[_0x2b90('0x39')](_0x10a0e6[_0x2b90('0x35')],_0x10a0e6[_0x2b90('0x36')]);_0x143e56[_0x2b90('0x3a')]=_['intersection'](_0x10a0e6[_0x2b90('0x35')],qs[_0x2b90('0x3b')](_0x556c12['query'][_0x2b90('0x3b')]));_0x143e56[_0x2b90('0x3a')]=_0x143e56[_0x2b90('0x3a')]['length']?_0x143e56[_0x2b90('0x3a')]:_0x10a0e6[_0x2b90('0x35')];if(_0x556c12[_0x2b90('0x36')][_0x2b90('0x46')]){_0x143e56[_0x2b90('0x49')]=[{'all':!![]}];}_0x143e56=_[_0x2b90('0x3f')]({},_0x143e56,_0x556c12[_0x2b90('0x43')]);return db[_0x2b90('0x44')][_0x2b90('0x4a')](_0x143e56)[_0x2b90('0x2c')](handleEntityNotFound(_0x3b3765,null))[_0x2b90('0x2c')](respondWithResult(_0x3b3765,null))[_0x2b90('0x4b')](handleError(_0x3b3765,null));};exports['create']=function(_0x450338,_0xadacd6){return db['SugarcrmConfiguration']['create'](_0x450338[_0x2b90('0x4c')],{})[_0x2b90('0x2c')](respondWithResult(_0xadacd6,0xc9))[_0x2b90('0x4b')](handleError(_0xadacd6,null));};exports['update']=function(_0x407bac,_0x2fa4c4){if(_0x407bac[_0x2b90('0x4c')]['id']){delete _0x407bac[_0x2b90('0x4c')]['id'];}return db[_0x2b90('0x44')]['find']({'where':{'id':_0x407bac[_0x2b90('0x48')]['id']}})[_0x2b90('0x2c')](handleEntityNotFound(_0x2fa4c4,null))[_0x2b90('0x2c')](saveUpdates(_0x407bac[_0x2b90('0x4c')],null))[_0x2b90('0x2c')](respondWithResult(_0x2fa4c4,null))[_0x2b90('0x4b')](handleError(_0x2fa4c4,null));};exports[_0x2b90('0x2d')]=function(_0xda2cb4,_0x507c02){return db[_0x2b90('0x44')][_0x2b90('0x4a')]({'where':{'id':_0xda2cb4[_0x2b90('0x48')]['id']}})[_0x2b90('0x2c')](handleEntityNotFound(_0x507c02,null))['then'](removeEntity(_0x507c02,null))[_0x2b90('0x4b')](handleError(_0x507c02,null));};exports[_0x2b90('0x4d')]=function(_0x460e13,_0x22f7c4,_0x5ce1f1){var _0x883cfc={};var _0x4d159f={};var _0x55b8a4;var _0x44f8b8;return db[_0x2b90('0x44')]['findOne']({'where':{'id':_0x460e13[_0x2b90('0x48')]['id']}})[_0x2b90('0x2c')](handleEntityNotFound(_0x22f7c4,null))[_0x2b90('0x2c')](function(_0x2a2a2e){if(_0x2a2a2e){_0x55b8a4=_0x2a2a2e;_0x4d159f[_0x2b90('0x35')]=_[_0x2b90('0x37')](db['SugarcrmField'][_0x2b90('0x32')]);_0x4d159f[_0x2b90('0x36')]=_[_0x2b90('0x37')](_0x460e13[_0x2b90('0x36')]);_0x4d159f[_0x2b90('0x38')]=_['intersection'](_0x4d159f[_0x2b90('0x35')],_0x4d159f[_0x2b90('0x36')]);_0x883cfc[_0x2b90('0x3a')]=_[_0x2b90('0x39')](_0x4d159f[_0x2b90('0x35')],qs[_0x2b90('0x3b')](_0x460e13[_0x2b90('0x36')][_0x2b90('0x3b')]));_0x883cfc[_0x2b90('0x3a')]=_0x883cfc[_0x2b90('0x3a')]['length']?_0x883cfc[_0x2b90('0x3a')]:_0x4d159f[_0x2b90('0x35')];_0x883cfc[_0x2b90('0x4e')]=qs[_0x2b90('0x4f')](_0x460e13[_0x2b90('0x36')]['sort']);_0x883cfc[_0x2b90('0x40')]=qs[_0x2b90('0x38')](_[_0x2b90('0x50')](_0x460e13[_0x2b90('0x36')],_0x4d159f[_0x2b90('0x38')]));if(_0x460e13[_0x2b90('0x36')][_0x2b90('0x42')]){_0x883cfc[_0x2b90('0x40')]=_['merge'](_0x883cfc['where'],{'$or':_[_0x2b90('0x41')](_0x883cfc[_0x2b90('0x3a')],function(_0x29200d){var _0x5c7027={};_0x5c7027[_0x29200d]={'$like':'%'+_0x460e13[_0x2b90('0x36')][_0x2b90('0x42')]+'%'};return _0x5c7027;})});}_0x883cfc=_[_0x2b90('0x3f')]({},_0x883cfc,_0x460e13['options']);return _0x55b8a4[_0x2b90('0x4d')](_0x883cfc);}})[_0x2b90('0x2c')](function(_0x26b845){if(_0x26b845){_0x44f8b8=_0x26b845[_0x2b90('0x3c')];if(!_0x460e13[_0x2b90('0x36')]['hasOwnProperty'](_0x2b90('0x3e'))){_0x883cfc['limit']=qs[_0x2b90('0x26')](_0x460e13['query'][_0x2b90('0x26')]);_0x883cfc[_0x2b90('0x25')]=qs[_0x2b90('0x25')](_0x460e13[_0x2b90('0x36')][_0x2b90('0x25')]);}return _0x55b8a4[_0x2b90('0x4d')](_0x883cfc);}})['then'](function(_0x5d3a90){if(_0x5d3a90){return _0x5d3a90?{'count':_0x44f8b8,'rows':_0x5d3a90}:null;}})['then'](respondWithResult(_0x22f7c4,null))[_0x2b90('0x4b')](handleError(_0x22f7c4,null));};exports[_0x2b90('0x51')]=function(_0x407ca2,_0x38f977,_0x33aabf){var _0x1a7158={};var _0x2007ad={};var _0x3383f5;var _0xdbc322;return db['SugarcrmConfiguration'][_0x2b90('0x52')]({'where':{'id':_0x407ca2[_0x2b90('0x48')]['id']}})[_0x2b90('0x2c')](handleEntityNotFound(_0x38f977,null))[_0x2b90('0x2c')](function(_0x1e8351){if(_0x1e8351){_0x3383f5=_0x1e8351;_0x2007ad[_0x2b90('0x35')]=_[_0x2b90('0x37')](db['SugarcrmField'][_0x2b90('0x32')]);_0x2007ad['query']=_[_0x2b90('0x37')](_0x407ca2[_0x2b90('0x36')]);_0x2007ad[_0x2b90('0x38')]=_[_0x2b90('0x39')](_0x2007ad[_0x2b90('0x35')],_0x2007ad['query']);_0x1a7158[_0x2b90('0x3a')]=_[_0x2b90('0x39')](_0x2007ad[_0x2b90('0x35')],qs['fields'](_0x407ca2[_0x2b90('0x36')][_0x2b90('0x3b')]));_0x1a7158[_0x2b90('0x3a')]=_0x1a7158[_0x2b90('0x3a')][_0x2b90('0x3c')]?_0x1a7158[_0x2b90('0x3a')]:_0x2007ad[_0x2b90('0x35')];_0x1a7158[_0x2b90('0x4e')]=qs[_0x2b90('0x4f')](_0x407ca2['query'][_0x2b90('0x4f')]);_0x1a7158[_0x2b90('0x40')]=qs[_0x2b90('0x38')](_[_0x2b90('0x50')](_0x407ca2[_0x2b90('0x36')],_0x2007ad['filters']));if(_0x407ca2[_0x2b90('0x36')][_0x2b90('0x42')]){_0x1a7158[_0x2b90('0x40')]=_['merge'](_0x1a7158['where'],{'$or':_[_0x2b90('0x41')](_0x1a7158['attributes'],function(_0x2e25a1){var _0x2e3eb2={};_0x2e3eb2[_0x2e25a1]={'$like':'%'+_0x407ca2['query'][_0x2b90('0x42')]+'%'};return _0x2e3eb2;})});}_0x1a7158=_['merge']({},_0x1a7158,_0x407ca2['options']);return _0x3383f5[_0x2b90('0x51')](_0x1a7158);}})[_0x2b90('0x2c')](function(_0x5383a8){if(_0x5383a8){_0xdbc322=_0x5383a8['length'];if(!_0x407ca2[_0x2b90('0x36')][_0x2b90('0x3d')]('nolimit')){_0x1a7158[_0x2b90('0x26')]=qs[_0x2b90('0x26')](_0x407ca2[_0x2b90('0x36')]['limit']);_0x1a7158[_0x2b90('0x25')]=qs[_0x2b90('0x25')](_0x407ca2['query'][_0x2b90('0x25')]);}return _0x3383f5[_0x2b90('0x51')](_0x1a7158);}})[_0x2b90('0x2c')](function(_0x5a0b62){if(_0x5a0b62){return _0x5a0b62?{'count':_0xdbc322,'rows':_0x5a0b62}:null;}})[_0x2b90('0x2c')](respondWithResult(_0x38f977,null))[_0x2b90('0x4b')](handleError(_0x38f977,null));};exports['getDescriptions']=function(_0x47cca0,_0x49e736,_0x2ffee7){var _0x56f280={};var _0x4b3ca2={};var _0x1152bd;var _0x524efe;return db['SugarcrmConfiguration'][_0x2b90('0x52')]({'where':{'id':_0x47cca0[_0x2b90('0x48')]['id']}})[_0x2b90('0x2c')](handleEntityNotFound(_0x49e736,null))[_0x2b90('0x2c')](function(_0x126d55){if(_0x126d55){_0x1152bd=_0x126d55;_0x4b3ca2[_0x2b90('0x35')]=_[_0x2b90('0x37')](db[_0x2b90('0x53')][_0x2b90('0x32')]);_0x4b3ca2[_0x2b90('0x36')]=_[_0x2b90('0x37')](_0x47cca0[_0x2b90('0x36')]);_0x4b3ca2[_0x2b90('0x38')]=_[_0x2b90('0x39')](_0x4b3ca2[_0x2b90('0x35')],_0x4b3ca2['query']);_0x56f280[_0x2b90('0x3a')]=_[_0x2b90('0x39')](_0x4b3ca2[_0x2b90('0x35')],qs['fields'](_0x47cca0[_0x2b90('0x36')]['fields']));_0x56f280[_0x2b90('0x3a')]=_0x56f280['attributes'][_0x2b90('0x3c')]?_0x56f280['attributes']:_0x4b3ca2[_0x2b90('0x35')];_0x56f280[_0x2b90('0x4e')]=qs['sort'](_0x47cca0[_0x2b90('0x36')][_0x2b90('0x4f')]);_0x56f280[_0x2b90('0x40')]=qs[_0x2b90('0x38')](_[_0x2b90('0x50')](_0x47cca0[_0x2b90('0x36')],_0x4b3ca2[_0x2b90('0x38')]));if(_0x47cca0[_0x2b90('0x36')][_0x2b90('0x42')]){_0x56f280[_0x2b90('0x40')]=_['merge'](_0x56f280['where'],{'$or':_['map'](_0x56f280[_0x2b90('0x3a')],function(_0x3847b6){var _0x38fa0d={};_0x38fa0d[_0x3847b6]={'$like':'%'+_0x47cca0[_0x2b90('0x36')][_0x2b90('0x42')]+'%'};return _0x38fa0d;})});}_0x56f280=_['merge']({},_0x56f280,_0x47cca0['options']);return _0x1152bd[_0x2b90('0x54')](_0x56f280);}})[_0x2b90('0x2c')](function(_0x40132c){if(_0x40132c){_0x524efe=_0x40132c[_0x2b90('0x3c')];if(!_0x47cca0[_0x2b90('0x36')][_0x2b90('0x3d')](_0x2b90('0x3e'))){_0x56f280[_0x2b90('0x26')]=qs[_0x2b90('0x26')](_0x47cca0[_0x2b90('0x36')][_0x2b90('0x26')]);_0x56f280[_0x2b90('0x25')]=qs[_0x2b90('0x25')](_0x47cca0[_0x2b90('0x36')]['offset']);}return _0x1152bd[_0x2b90('0x54')](_0x56f280);}})[_0x2b90('0x2c')](function(_0x4d6e2){if(_0x4d6e2){return _0x4d6e2?{'count':_0x524efe,'rows':_0x4d6e2}:null;}})[_0x2b90('0x2c')](respondWithResult(_0x49e736,null))[_0x2b90('0x4b')](handleError(_0x49e736,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a288e1e..be811e2 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 _0x153e=['define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x1b87fb,_0x3e6870){var _0xc7de31=function(_0x4eaded){while(--_0x4eaded){_0x1b87fb['push'](_0x1b87fb['shift']());}};_0xc7de31(++_0x3e6870);}(_0x153e,0x12c));var _0xe153=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0x153e[_0x4996d5];return _0x4793f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe153('0x0'))(_0xe153('0x1'));var moment=require(_0xe153('0x2'));var BPromise=require(_0xe153('0x3'));var rp=require(_0xe153('0x4'));var fs=require('fs');var path=require(_0xe153('0x5'));var rimraf=require('rimraf');var config=require(_0xe153('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xe153('0x7')]=function(_0x5957cc,_0x3030f3){return _0x5957cc[_0xe153('0x8')](_0xe153('0x9'),attributes,{'tableName':_0xe153('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf888=['api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','../../config/logger'];(function(_0x516cc2,_0x284189){var _0x5eaecc=function(_0x3f277b){while(--_0x3f277b){_0x516cc2['push'](_0x516cc2['shift']());}};_0x5eaecc(++_0x284189);}(_0xf888,0x166));var _0x8f88=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xf888[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0x8f88('0x0'));var util=require('util');var logger=require(_0x8f88('0x1'))(_0x8f88('0x2'));var moment=require(_0x8f88('0x3'));var BPromise=require(_0x8f88('0x4'));var rp=require(_0x8f88('0x5'));var fs=require('fs');var path=require(_0x8f88('0x6'));var rimraf=require(_0x8f88('0x7'));var config=require('../../config/environment');var attributes=require(_0x8f88('0x8'));module[_0x8f88('0x9')]=function(_0x23fddf,_0x5e2847){return _0x23fddf[_0x8f88('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x8f88('0xb'),'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 5497037..d02b676 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 _0x8372=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x8372,0xb1));var _0x2837=function(_0x24fa5a,_0x5cc9f7){_0x24fa5a=_0x24fa5a-0x0;var _0x2e040a=_0x8372[_0x24fa5a];return _0x2e040a;};'use strict';var _=require(_0x2837('0x0'));var util=require('util');var moment=require(_0x2837('0x1'));var BPromise=require(_0x2837('0x2'));var rs=require(_0x2837('0x3'));var fs=require('fs');var Redis=require(_0x2837('0x4'));var db=require(_0x2837('0x5'))['db'];var utils=require(_0x2837('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2837('0x7'));var jayson=require(_0x2837('0x8'));var client=jayson['client'][_0x2837('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46f156,_0x253a35,_0x2f4032){return new BPromise(function(_0x54d545,_0x21bbc9){return client[_0x2837('0xa')](_0x46f156,_0x2f4032)[_0x2837('0xb')](function(_0x4ef45b){logger[_0x2837('0xc')](_0x2837('0xd'),_0x253a35,_0x2837('0xe'));logger[_0x2837('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x253a35,_0x2837('0xe'),JSON[_0x2837('0x10')](_0x4ef45b));if(_0x4ef45b['error']){if(_0x4ef45b['error'][_0x2837('0x11')]===0x1f4){logger[_0x2837('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x253a35,_0x4ef45b[_0x2837('0x12')][_0x2837('0x13')]);return _0x21bbc9(_0x4ef45b[_0x2837('0x12')][_0x2837('0x13')]);}logger[_0x2837('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x253a35,_0x4ef45b[_0x2837('0x12')][_0x2837('0x13')]);return _0x54d545(_0x4ef45b[_0x2837('0x12')][_0x2837('0x13')]);}else{logger['info'](_0x2837('0xd'),_0x253a35,_0x2837('0xe'));_0x54d545(_0x4ef45b[_0x2837('0x14')][_0x2837('0x13')]);}})['catch'](function(_0x5ca5e3){logger[_0x2837('0x12')](_0x2837('0xd'),_0x253a35,_0x5ca5e3);_0x21bbc9(_0x5ca5e3);});});} \ No newline at end of file +var _0x0131=['error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x0131,0x1a7));var _0x1013=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x0131[_0xd2d54];return _0x78b113;};'use strict';var _=require(_0x1013('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1013('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1013('0x2'));var db=require(_0x1013('0x3'))['db'];var utils=require(_0x1013('0x4'));var logger=require(_0x1013('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1013('0x6')][_0x1013('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4c3d90,_0xe78157,_0x52ef14){return new BPromise(function(_0x522b73,_0x23ca5f){return client[_0x1013('0x8')](_0x4c3d90,_0x52ef14)['then'](function(_0x159837){logger[_0x1013('0x9')](_0x1013('0xa'),_0xe78157,_0x1013('0xb'));logger[_0x1013('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xe78157,_0x1013('0xb'),JSON[_0x1013('0xd')](_0x159837));if(_0x159837[_0x1013('0xe')]){if(_0x159837[_0x1013('0xe')][_0x1013('0xf')]===0x1f4){logger[_0x1013('0xe')](_0x1013('0xa'),_0xe78157,_0x159837['error'][_0x1013('0x10')]);return _0x23ca5f(_0x159837[_0x1013('0xe')][_0x1013('0x10')]);}logger[_0x1013('0xe')](_0x1013('0xa'),_0xe78157,_0x159837[_0x1013('0xe')][_0x1013('0x10')]);return _0x522b73(_0x159837['error'][_0x1013('0x10')]);}else{logger['info'](_0x1013('0xa'),_0xe78157,_0x1013('0xb'));_0x522b73(_0x159837[_0x1013('0x11')][_0x1013('0x10')]);}})[_0x1013('0x12')](function(_0x404b8f){logger['error'](_0x1013('0xa'),_0xe78157,_0x404b8f);_0x23ca5f(_0x404b8f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5a06b4e..582fe3b 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 _0xb46f=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','delete','destroy','exports'];(function(_0xf104db,_0x3bb494){var _0xab56c5=function(_0x53083c){while(--_0x53083c){_0xf104db['push'](_0xf104db['shift']());}};_0xab56c5(++_0x3bb494);}(_0xb46f,0x1dc));var _0xfb46=function(_0x526467,_0x41c0f8){_0x526467=_0x526467-0x0;var _0x316d34=_0xb46f[_0x526467];return _0x316d34;};'use strict';var multer=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var path=require(_0xfb46('0x2'));var timeout=require(_0xfb46('0x3'));var express=require(_0xfb46('0x4'));var router=express[_0xfb46('0x5')]();var auth=require(_0xfb46('0x6'));var interaction=require(_0xfb46('0x7'));var config=require(_0xfb46('0x8'));var controller=require(_0xfb46('0x9'));router[_0xfb46('0xa')]('/',auth[_0xfb46('0xb')](),controller[_0xfb46('0xc')]);router['get'](_0xfb46('0xd'),auth[_0xfb46('0xb')](),controller['show']);router['post']('/',auth[_0xfb46('0xb')](),controller['create']);router['put'](_0xfb46('0xd'),auth[_0xfb46('0xb')](),controller['update']);router[_0xfb46('0xe')]('/:id',auth[_0xfb46('0xb')](),controller[_0xfb46('0xf')]);module[_0xfb46('0x10')]=router; \ No newline at end of file +var _0xe71b=['index','get','/:id','post','create','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe71b,0xd5));var _0xbe71=function(_0x158ab3,_0x4b5908){_0x158ab3=_0x158ab3-0x0;var _0x302830=_0xe71b[_0x158ab3];return _0x302830;};'use strict';var multer=require(_0xbe71('0x0'));var util=require('util');var path=require(_0xbe71('0x1'));var timeout=require('connect-timeout');var express=require(_0xbe71('0x2'));var router=express[_0xbe71('0x3')]();var auth=require(_0xbe71('0x4'));var interaction=require(_0xbe71('0x5'));var config=require('../../config/environment');var controller=require(_0xbe71('0x6'));router['get']('/',auth[_0xbe71('0x7')](),controller[_0xbe71('0x8')]);router[_0xbe71('0x9')](_0xbe71('0xa'),auth[_0xbe71('0x7')](),controller['show']);router[_0xbe71('0xb')]('/',auth[_0xbe71('0x7')](),controller[_0xbe71('0xc')]);router['put'](_0xbe71('0xa'),auth[_0xbe71('0x7')](),controller[_0xbe71('0xd')]);router[_0xbe71('0xe')]('/:id',auth[_0xbe71('0x7')](),controller[_0xbe71('0xf')]);module[_0xbe71('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 742f380..509a39a 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 _0x9ed1=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9ed1,0x107));var _0x19ed=function(_0x2e8e2d,_0x66ad11){_0x2e8e2d=_0x2e8e2d-0x0;var _0x4cc0de=_0x9ed1[_0x2e8e2d];return _0x4cc0de;};'use strict';var Sequelize=require(_0x19ed('0x0'));module[_0x19ed('0x1')]={'type':{'type':Sequelize[_0x19ed('0x2')](_0x19ed('0x3'),_0x19ed('0x4'),'customVariable',_0x19ed('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x19ed('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x19ed('0x2')]('string',_0x19ed('0x4'),_0x19ed('0x7'))},'keyContent':{'type':Sequelize[_0x19ed('0x6')]},'idField':{'type':Sequelize[_0x19ed('0x6')]},'nameField':{'type':Sequelize[_0x19ed('0x6')]},'customField':{'type':Sequelize[_0x19ed('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x19ed('0x6')]}}; \ No newline at end of file +var _0x7722=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x3cc04d,_0x42f7a5){var _0x2665f6=function(_0x3617a2){while(--_0x3617a2){_0x3cc04d['push'](_0x3cc04d['shift']());}};_0x2665f6(++_0x42f7a5);}(_0x7722,0x14e));var _0x2772=function(_0x16327d,_0x225096){_0x16327d=_0x16327d-0x0;var _0x1851c0=_0x7722[_0x16327d];return _0x1851c0;};'use strict';var Sequelize=require(_0x2772('0x0'));module[_0x2772('0x1')]={'type':{'type':Sequelize[_0x2772('0x2')](_0x2772('0x3'),_0x2772('0x4'),_0x2772('0x5'),_0x2772('0x6')),'defaultValue':_0x2772('0x3')},'content':{'type':Sequelize[_0x2772('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2772('0x2')]('string',_0x2772('0x4'),_0x2772('0x5'))},'keyContent':{'type':Sequelize[_0x2772('0x7')]},'idField':{'type':Sequelize[_0x2772('0x7')]},'nameField':{'type':Sequelize[_0x2772('0x7')]},'customField':{'type':Sequelize[_0x2772('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2772('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 0ff104f..9ad2290 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 _0x26f5=['save','update','then','error','stack','name','send','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SugarcrmField','findAll','rows','catch','params','rawAttributes','includeAll','include','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject'];(function(_0x77b41c,_0x688c2e){var _0x1457a6=function(_0x8eb257){while(--_0x8eb257){_0x77b41c['push'](_0x77b41c['shift']());}};_0x1457a6(++_0x688c2e);}(_0x26f5,0x6e));var _0x526f=function(_0x3f7411,_0x277ea0){_0x3f7411=_0x3f7411-0x0;var _0x2cb749=_0x26f5[_0x3f7411];return _0x2cb749;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x526f('0x0'));var rimraf=require(_0x526f('0x1'));var zipdir=require(_0x526f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x526f('0x3'));var moment=require(_0x526f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x526f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x526f('0x6'));var csv=require('to-csv');var ejs=require(_0x526f('0x7'));var fs=require('fs');var _=require(_0x526f('0x8'));var squel=require(_0x526f('0x9'));var crypto=require(_0x526f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x526f('0xb'));var Redis=require(_0x526f('0xc'));var authService=require(_0x526f('0xd'));var qs=require(_0x526f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x526f('0xf'));var logger=require('../../config/logger')(_0x526f('0x10'));var utils=require(_0x526f('0x11'));var config=require(_0x526f('0x12'));var db=require(_0x526f('0x13'))['db'];function respondWithStatusCode(_0x2eebb0,_0x5f3e6b){_0x5f3e6b=_0x5f3e6b||0xcc;return function(_0x2c3472){if(_0x2c3472){return _0x2eebb0[_0x526f('0x14')](_0x5f3e6b);}return _0x2eebb0[_0x526f('0x15')](_0x5f3e6b)[_0x526f('0x16')]();};}function respondWithResult(_0x54c6e7,_0x24d6d4){_0x24d6d4=_0x24d6d4||0xc8;return function(_0x15e6bf){if(_0x15e6bf){return _0x54c6e7[_0x526f('0x15')](_0x24d6d4)[_0x526f('0x17')](_0x15e6bf);}};}function respondWithFilteredResult(_0x50e122,_0x2c0001){return function(_0x111975){if(_0x111975){var _0x4b2345=_0x111975[_0x526f('0x18')],_0x2f0ba7=_0x2c0001[_0x526f('0x19')],_0x2fad2a=_0x2c0001[_0x526f('0x19')]+_0x2c0001[_0x526f('0x1a')],_0x2706cb;if(_0x2fad2a>=_0x4b2345){_0x2fad2a=_0x4b2345;_0x2706cb=0xc8;}else{_0x2706cb=0xce;}_0x50e122['status'](_0x2706cb);return _0x50e122[_0x526f('0x1b')](_0x526f('0x1c'),_0x2f0ba7+'-'+_0x2fad2a+'/'+_0x4b2345)[_0x526f('0x17')](_0x111975);}return null;};}function patchUpdates(_0x4001f8){return function(_0x585b8f){try{jsonpatch['apply'](_0x585b8f,_0x4001f8,!![]);}catch(_0xc4e4d7){return BPromise[_0x526f('0x1d')](_0xc4e4d7);}return _0x585b8f[_0x526f('0x1e')]();};}function saveUpdates(_0x3eb934,_0x8b3283){return function(_0x1b4023){if(_0x1b4023){return _0x1b4023[_0x526f('0x1f')](_0x3eb934)['then'](function(_0x573b5f){return _0x573b5f;});}return null;};}function removeEntity(_0x9419d1,_0x518b58){return function(_0x4c74d5){if(_0x4c74d5){return _0x4c74d5['destroy']()[_0x526f('0x20')](function(){_0x9419d1['status'](0xcc)[_0x526f('0x16')]();});}};}function handleEntityNotFound(_0x19f9aa,_0x3f10b3){return function(_0x361127){if(!_0x361127){_0x19f9aa[_0x526f('0x14')](0x194);}return _0x361127;};}function handleError(_0x87032c,_0x5cfec6){_0x5cfec6=_0x5cfec6||0x1f4;return function(_0x33b7c5){logger[_0x526f('0x21')](_0x33b7c5[_0x526f('0x22')]);if(_0x33b7c5[_0x526f('0x23')]){delete _0x33b7c5['name'];}_0x87032c[_0x526f('0x15')](_0x5cfec6)[_0x526f('0x24')](_0x33b7c5);};}exports['index']=function(_0x569f31,_0x156cb1){var _0x253a5e={},_0x38838b={},_0x15f017={'count':0x0,'rows':[]};var _0x513cb0=_[_0x526f('0x25')](db['SugarcrmField']['rawAttributes'],function(_0x3064b8){return{'name':_0x3064b8[_0x526f('0x26')],'type':_0x3064b8[_0x526f('0x27')][_0x526f('0x28')]};});_0x38838b[_0x526f('0x29')]=_[_0x526f('0x25')](_0x513cb0,_0x526f('0x23'));_0x38838b[_0x526f('0x2a')]=_[_0x526f('0x2b')](_0x569f31['query']);_0x38838b['filters']=_['intersection'](_0x38838b[_0x526f('0x29')],_0x38838b['query']);_0x253a5e[_0x526f('0x2c')]=_[_0x526f('0x2d')](_0x38838b[_0x526f('0x29')],qs[_0x526f('0x2e')](_0x569f31['query']['fields']));_0x253a5e[_0x526f('0x2c')]=_0x253a5e[_0x526f('0x2c')][_0x526f('0x2f')]?_0x253a5e['attributes']:_0x38838b[_0x526f('0x29')];if(!_0x569f31['query']['hasOwnProperty'](_0x526f('0x30'))){_0x253a5e[_0x526f('0x1a')]=qs[_0x526f('0x1a')](_0x569f31[_0x526f('0x2a')][_0x526f('0x1a')]);_0x253a5e['offset']=qs['offset'](_0x569f31[_0x526f('0x2a')][_0x526f('0x19')]);}_0x253a5e[_0x526f('0x31')]=qs[_0x526f('0x32')](_0x569f31[_0x526f('0x2a')][_0x526f('0x32')]);_0x253a5e[_0x526f('0x33')]=qs[_0x526f('0x34')](_[_0x526f('0x35')](_0x569f31[_0x526f('0x2a')],_0x38838b['filters']),_0x513cb0);if(_0x569f31['query'][_0x526f('0x36')]){_0x253a5e['where']=_[_0x526f('0x37')](_0x253a5e['where'],{'$or':_[_0x526f('0x25')](_0x513cb0,function(_0xd608ed){if(_0xd608ed[_0x526f('0x27')]!==_0x526f('0x38')){var _0x35d2ee={};_0x35d2ee[_0xd608ed[_0x526f('0x23')]]={'$like':'%'+_0x569f31['query']['filter']+'%'};return _0x35d2ee;}})});}_0x253a5e=_[_0x526f('0x37')]({},_0x253a5e,_0x569f31[_0x526f('0x39')]);var _0x335c85={'where':_0x253a5e['where']};return db[_0x526f('0x3a')][_0x526f('0x18')](_0x335c85)[_0x526f('0x20')](function(_0x3cf5d3){_0x15f017[_0x526f('0x18')]=_0x3cf5d3;if(_0x569f31[_0x526f('0x2a')]['includeAll']){_0x253a5e['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x526f('0x3b')](_0x253a5e);})[_0x526f('0x20')](function(_0x5204f3){_0x15f017[_0x526f('0x3c')]=_0x5204f3;return _0x15f017;})[_0x526f('0x20')](respondWithFilteredResult(_0x156cb1,_0x253a5e))[_0x526f('0x3d')](handleError(_0x156cb1,null));};exports['show']=function(_0x3b2534,_0x380e06){var _0xca98c0={'raw':!![],'where':{'id':_0x3b2534[_0x526f('0x3e')]['id']}},_0x442fda={};_0x442fda[_0x526f('0x29')]=_[_0x526f('0x2b')](db[_0x526f('0x3a')][_0x526f('0x3f')]);_0x442fda[_0x526f('0x2a')]=_[_0x526f('0x2b')](_0x3b2534['query']);_0x442fda[_0x526f('0x34')]=_[_0x526f('0x2d')](_0x442fda[_0x526f('0x29')],_0x442fda[_0x526f('0x2a')]);_0xca98c0[_0x526f('0x2c')]=_['intersection'](_0x442fda[_0x526f('0x29')],qs[_0x526f('0x2e')](_0x3b2534[_0x526f('0x2a')][_0x526f('0x2e')]));_0xca98c0[_0x526f('0x2c')]=_0xca98c0[_0x526f('0x2c')][_0x526f('0x2f')]?_0xca98c0[_0x526f('0x2c')]:_0x442fda['model'];if(_0x3b2534[_0x526f('0x2a')][_0x526f('0x40')]){_0xca98c0[_0x526f('0x41')]=[{'all':!![]}];}_0xca98c0=_['merge']({},_0xca98c0,_0x3b2534[_0x526f('0x39')]);return db[_0x526f('0x3a')][_0x526f('0x42')](_0xca98c0)['then'](handleEntityNotFound(_0x380e06,null))[_0x526f('0x20')](respondWithResult(_0x380e06,null))[_0x526f('0x3d')](handleError(_0x380e06,null));};exports[_0x526f('0x43')]=function(_0x3905ff,_0x2c744e){return db[_0x526f('0x3a')]['create'](_0x3905ff[_0x526f('0x44')],{})[_0x526f('0x20')](respondWithResult(_0x2c744e,0xc9))['catch'](handleError(_0x2c744e,null));};exports[_0x526f('0x1f')]=function(_0x5afb5d,_0x52cfeb){if(_0x5afb5d['body']['id']){delete _0x5afb5d['body']['id'];}return db[_0x526f('0x3a')]['find']({'where':{'id':_0x5afb5d['params']['id']}})[_0x526f('0x20')](handleEntityNotFound(_0x52cfeb,null))[_0x526f('0x20')](saveUpdates(_0x5afb5d[_0x526f('0x44')],null))[_0x526f('0x20')](respondWithResult(_0x52cfeb,null))[_0x526f('0x3d')](handleError(_0x52cfeb,null));};exports[_0x526f('0x45')]=function(_0x30c81e,_0x166d3f){return db['SugarcrmField'][_0x526f('0x42')]({'where':{'id':_0x30c81e[_0x526f('0x3e')]['id']}})[_0x526f('0x20')](handleEntityNotFound(_0x166d3f,null))[_0x526f('0x20')](removeEntity(_0x166d3f,null))[_0x526f('0x3d')](handleError(_0x166d3f,null));}; \ No newline at end of file +var _0x2c89=['show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','count','includeAll','include','findAll','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c89,0x98));var _0x92c8=function(_0x2f69d4,_0x1bf133){_0x2f69d4=_0x2f69d4-0x0;var _0x4def92=_0x2c89[_0x2f69d4];return _0x4def92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x92c8('0x0'));var rimraf=require(_0x92c8('0x1'));var zipdir=require(_0x92c8('0x2'));var jsonpatch=require(_0x92c8('0x3'));var rp=require(_0x92c8('0x4'));var moment=require(_0x92c8('0x5'));var BPromise=require(_0x92c8('0x6'));var Mustache=require(_0x92c8('0x7'));var util=require(_0x92c8('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x92c8('0x9'));var ejs=require(_0x92c8('0xa'));var fs=require('fs');var _=require(_0x92c8('0xb'));var squel=require(_0x92c8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x92c8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x92c8('0xe'));var Redis=require('ioredis');var authService=require(_0x92c8('0xf'));var qs=require(_0x92c8('0x10'));var as=require(_0x92c8('0x11'));var hardwareService=require(_0x92c8('0x12'));var logger=require(_0x92c8('0x13'))(_0x92c8('0x14'));var utils=require('../../config/utils');var config=require(_0x92c8('0x15'));var db=require(_0x92c8('0x16'))['db'];function respondWithStatusCode(_0x400f75,_0x5413de){_0x5413de=_0x5413de||0xcc;return function(_0xbd158){if(_0xbd158){return _0x400f75[_0x92c8('0x17')](_0x5413de);}return _0x400f75[_0x92c8('0x18')](_0x5413de)[_0x92c8('0x19')]();};}function respondWithResult(_0x18d076,_0x33418){_0x33418=_0x33418||0xc8;return function(_0x4e0b10){if(_0x4e0b10){return _0x18d076[_0x92c8('0x18')](_0x33418)[_0x92c8('0x1a')](_0x4e0b10);}};}function respondWithFilteredResult(_0xf606d4,_0x7f6488){return function(_0x49d2df){if(_0x49d2df){var _0x469bea=_0x49d2df['count'],_0x1afa84=_0x7f6488['offset'],_0x2924fc=_0x7f6488[_0x92c8('0x1b')]+_0x7f6488[_0x92c8('0x1c')],_0x21bc79;if(_0x2924fc>=_0x469bea){_0x2924fc=_0x469bea;_0x21bc79=0xc8;}else{_0x21bc79=0xce;}_0xf606d4['status'](_0x21bc79);return _0xf606d4[_0x92c8('0x1d')](_0x92c8('0x1e'),_0x1afa84+'-'+_0x2924fc+'/'+_0x469bea)[_0x92c8('0x1a')](_0x49d2df);}return null;};}function patchUpdates(_0x1e606d){return function(_0x140ae7){try{jsonpatch[_0x92c8('0x1f')](_0x140ae7,_0x1e606d,!![]);}catch(_0x56fdd4){return BPromise[_0x92c8('0x20')](_0x56fdd4);}return _0x140ae7[_0x92c8('0x21')]();};}function saveUpdates(_0x262386,_0xfe9853){return function(_0x1a863e){if(_0x1a863e){return _0x1a863e[_0x92c8('0x22')](_0x262386)[_0x92c8('0x23')](function(_0x334f01){return _0x334f01;});}return null;};}function removeEntity(_0x2baa2e,_0x5e8d76){return function(_0x9f239b){if(_0x9f239b){return _0x9f239b[_0x92c8('0x24')]()['then'](function(){_0x2baa2e[_0x92c8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fd1b4,_0x4cdb51){return function(_0x208aae){if(!_0x208aae){_0x1fd1b4[_0x92c8('0x17')](0x194);}return _0x208aae;};}function handleError(_0x4ede78,_0x3ed4c2){_0x3ed4c2=_0x3ed4c2||0x1f4;return function(_0x3c184a){logger[_0x92c8('0x25')](_0x3c184a['stack']);if(_0x3c184a[_0x92c8('0x26')]){delete _0x3c184a[_0x92c8('0x26')];}_0x4ede78[_0x92c8('0x18')](_0x3ed4c2)[_0x92c8('0x27')](_0x3c184a);};}exports['index']=function(_0x62ea59,_0x38af4c){var _0x1f5b1e={},_0x44979c={},_0x441b17={'count':0x0,'rows':[]};var _0x3ef3e3=_['map'](db[_0x92c8('0x28')][_0x92c8('0x29')],function(_0x3a5cce){return{'name':_0x3a5cce[_0x92c8('0x2a')],'type':_0x3a5cce[_0x92c8('0x2b')][_0x92c8('0x2c')]};});_0x44979c[_0x92c8('0x2d')]=_[_0x92c8('0x2e')](_0x3ef3e3,_0x92c8('0x26'));_0x44979c[_0x92c8('0x2f')]=_[_0x92c8('0x30')](_0x62ea59['query']);_0x44979c[_0x92c8('0x31')]=_[_0x92c8('0x32')](_0x44979c[_0x92c8('0x2d')],_0x44979c[_0x92c8('0x2f')]);_0x1f5b1e[_0x92c8('0x33')]=_[_0x92c8('0x32')](_0x44979c['model'],qs[_0x92c8('0x34')](_0x62ea59[_0x92c8('0x2f')][_0x92c8('0x34')]));_0x1f5b1e[_0x92c8('0x33')]=_0x1f5b1e[_0x92c8('0x33')][_0x92c8('0x35')]?_0x1f5b1e[_0x92c8('0x33')]:_0x44979c[_0x92c8('0x2d')];if(!_0x62ea59[_0x92c8('0x2f')][_0x92c8('0x36')]('nolimit')){_0x1f5b1e[_0x92c8('0x1c')]=qs[_0x92c8('0x1c')](_0x62ea59[_0x92c8('0x2f')]['limit']);_0x1f5b1e[_0x92c8('0x1b')]=qs[_0x92c8('0x1b')](_0x62ea59[_0x92c8('0x2f')]['offset']);}_0x1f5b1e[_0x92c8('0x37')]=qs[_0x92c8('0x38')](_0x62ea59[_0x92c8('0x2f')]['sort']);_0x1f5b1e['where']=qs[_0x92c8('0x31')](_[_0x92c8('0x39')](_0x62ea59['query'],_0x44979c[_0x92c8('0x31')]),_0x3ef3e3);if(_0x62ea59[_0x92c8('0x2f')]['filter']){_0x1f5b1e['where']=_[_0x92c8('0x3a')](_0x1f5b1e[_0x92c8('0x3b')],{'$or':_[_0x92c8('0x2e')](_0x3ef3e3,function(_0x3f98e6){if(_0x3f98e6[_0x92c8('0x2b')]!==_0x92c8('0x3c')){var _0xdfbd66={};_0xdfbd66[_0x3f98e6['name']]={'$like':'%'+_0x62ea59[_0x92c8('0x2f')][_0x92c8('0x3d')]+'%'};return _0xdfbd66;}})});}_0x1f5b1e=_[_0x92c8('0x3a')]({},_0x1f5b1e,_0x62ea59['options']);var _0x2f5b84={'where':_0x1f5b1e[_0x92c8('0x3b')]};return db[_0x92c8('0x28')][_0x92c8('0x3e')](_0x2f5b84)[_0x92c8('0x23')](function(_0x6a4ac4){_0x441b17[_0x92c8('0x3e')]=_0x6a4ac4;if(_0x62ea59[_0x92c8('0x2f')][_0x92c8('0x3f')]){_0x1f5b1e[_0x92c8('0x40')]=[{'all':!![]}];}return db[_0x92c8('0x28')][_0x92c8('0x41')](_0x1f5b1e);})[_0x92c8('0x23')](function(_0x18418b){_0x441b17['rows']=_0x18418b;return _0x441b17;})[_0x92c8('0x23')](respondWithFilteredResult(_0x38af4c,_0x1f5b1e))[_0x92c8('0x42')](handleError(_0x38af4c,null));};exports[_0x92c8('0x43')]=function(_0x58adfb,_0x4e23ff){var _0x57a9dd={'raw':!![],'where':{'id':_0x58adfb['params']['id']}},_0x5877a8={};_0x5877a8[_0x92c8('0x2d')]=_[_0x92c8('0x30')](db[_0x92c8('0x28')]['rawAttributes']);_0x5877a8[_0x92c8('0x2f')]=_[_0x92c8('0x30')](_0x58adfb[_0x92c8('0x2f')]);_0x5877a8[_0x92c8('0x31')]=_[_0x92c8('0x32')](_0x5877a8[_0x92c8('0x2d')],_0x5877a8[_0x92c8('0x2f')]);_0x57a9dd['attributes']=_[_0x92c8('0x32')](_0x5877a8[_0x92c8('0x2d')],qs[_0x92c8('0x34')](_0x58adfb['query']['fields']));_0x57a9dd['attributes']=_0x57a9dd[_0x92c8('0x33')][_0x92c8('0x35')]?_0x57a9dd[_0x92c8('0x33')]:_0x5877a8[_0x92c8('0x2d')];if(_0x58adfb[_0x92c8('0x2f')][_0x92c8('0x3f')]){_0x57a9dd[_0x92c8('0x40')]=[{'all':!![]}];}_0x57a9dd=_[_0x92c8('0x3a')]({},_0x57a9dd,_0x58adfb[_0x92c8('0x44')]);return db['SugarcrmField'][_0x92c8('0x45')](_0x57a9dd)[_0x92c8('0x23')](handleEntityNotFound(_0x4e23ff,null))[_0x92c8('0x23')](respondWithResult(_0x4e23ff,null))[_0x92c8('0x42')](handleError(_0x4e23ff,null));};exports[_0x92c8('0x46')]=function(_0x4eeafd,_0x420d69){return db[_0x92c8('0x28')][_0x92c8('0x46')](_0x4eeafd[_0x92c8('0x47')],{})[_0x92c8('0x23')](respondWithResult(_0x420d69,0xc9))[_0x92c8('0x42')](handleError(_0x420d69,null));};exports[_0x92c8('0x22')]=function(_0x66f5db,_0x22ab01){if(_0x66f5db[_0x92c8('0x47')]['id']){delete _0x66f5db[_0x92c8('0x47')]['id'];}return db[_0x92c8('0x28')]['find']({'where':{'id':_0x66f5db[_0x92c8('0x48')]['id']}})[_0x92c8('0x23')](handleEntityNotFound(_0x22ab01,null))[_0x92c8('0x23')](saveUpdates(_0x66f5db[_0x92c8('0x47')],null))[_0x92c8('0x23')](respondWithResult(_0x22ab01,null))[_0x92c8('0x42')](handleError(_0x22ab01,null));};exports[_0x92c8('0x24')]=function(_0x42a120,_0x380d5a){return db[_0x92c8('0x28')][_0x92c8('0x45')]({'where':{'id':_0x42a120[_0x92c8('0x48')]['id']}})[_0x92c8('0x23')](handleEntityNotFound(_0x380d5a,null))['then'](removeEntity(_0x380d5a,null))[_0x92c8('0x42')](handleError(_0x380d5a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index e93675d..ef07d73 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 _0xe5a8=['request-promise','../../config/environment','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1e47ad,_0x231b11){var _0x2858aa=function(_0x973e06){while(--_0x973e06){_0x1e47ad['push'](_0x1e47ad['shift']());}};_0x2858aa(++_0x231b11);}(_0xe5a8,0xd7));var _0x8e5a=function(_0x291ffe,_0x4f201b){_0x291ffe=_0x291ffe-0x0;var _0x482819=_0xe5a8[_0x291ffe];return _0x482819;};'use strict';var _=require(_0x8e5a('0x0'));var util=require('util');var logger=require(_0x8e5a('0x1'))(_0x8e5a('0x2'));var moment=require(_0x8e5a('0x3'));var BPromise=require(_0x8e5a('0x4'));var rp=require(_0x8e5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e5a('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x8e5a('0x7')]=function(_0x501662,_0x3fb025){return _0x501662[_0x8e5a('0x8')]('SugarcrmField',attributes,{'tableName':_0x8e5a('0x9'),'paranoid':![],'indexes':[{'name':_0x8e5a('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb215=['int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x16c72b,_0xf9594a){var _0x58b8bf=function(_0x506e5c){while(--_0x506e5c){_0x16c72b['push'](_0x16c72b['shift']());}};_0x58b8bf(++_0xf9594a);}(_0xb215,0xed));var _0x5b21=function(_0x1742d5,_0x58fdd0){_0x1742d5=_0x1742d5-0x0;var _0x1a2f69=_0xb215[_0x1742d5];return _0x1a2f69;};'use strict';var _=require(_0x5b21('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b21('0x1'));var BPromise=require(_0x5b21('0x2'));var rp=require(_0x5b21('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b21('0x4'));var config=require(_0x5b21('0x5'));var attributes=require(_0x5b21('0x6'));module[_0x5b21('0x7')]=function(_0x2747c7,_0x62cfca){return _0x2747c7[_0x5b21('0x8')](_0x5b21('0x9'),attributes,{'tableName':_0x5b21('0xa'),'paranoid':![],'indexes':[{'name':_0x5b21('0xb'),'fields':[_0x5b21('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 4d12539..378b7d4 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x385222,_0x35bd03){var _0x191867=function(_0x4ffdb6){while(--_0x4ffdb6){_0x385222['push'](_0x385222['shift']());}};_0x191867(++_0x35bd03);}(_0x1a85,0x178));var _0x51a8=function(_0x445b7e,_0x3ea85f){_0x445b7e=_0x445b7e-0x0;var _0x17d997=_0x1a85[_0x445b7e];return _0x17d997;};'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')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x22bb1a,_0x1c11b4){var _0x50f86c=function(_0x4e00a7){while(--_0x4e00a7){_0x22bb1a['push'](_0x22bb1a['shift']());}};_0x50f86c(++_0x1c11b4);}(_0x2032,0xd9));var _0x2203=function(_0x325844,_0x5e5ad2){_0x325844=_0x325844-0x0;var _0xca9e7f=_0x2032[_0x325844];return _0xca9e7f;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6758ef7..ecfd753 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 _0x3068=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x1d6a02,_0x5b6595){var _0x1175b6=function(_0x777fc){while(--_0x777fc){_0x1d6a02['push'](_0x1d6a02['shift']());}};_0x1175b6(++_0x5b6595);}(_0x3068,0x11f));var _0x8306=function(_0x1de708,_0x4051c3){_0x1de708=_0x1de708-0x0;var _0x200141=_0x3068[_0x1de708];return _0x200141;};'use strict';var multer=require('multer');var util=require(_0x8306('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8306('0x1'));var router=express[_0x8306('0x2')]();var auth=require(_0x8306('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8306('0x4'));var controller=require(_0x8306('0x5'));router[_0x8306('0x6')]('/',auth[_0x8306('0x7')](),controller[_0x8306('0x8')]);router[_0x8306('0x6')](_0x8306('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8306('0xa'),auth['isAuthenticated'](),controller[_0x8306('0xb')]);router['get'](_0x8306('0xc'),auth[_0x8306('0x7')](),controller[_0x8306('0xd')]);router['post']('/',auth[_0x8306('0x7')](),controller[_0x8306('0xe')]);router[_0x8306('0xf')](_0x8306('0xa'),auth[_0x8306('0x7')](),controller['addConfiguration']);router[_0x8306('0x10')](_0x8306('0x9'),auth['isAuthenticated'](),controller[_0x8306('0x11')]);router[_0x8306('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8306('0x13')]);module[_0x8306('0x14')]=router; \ No newline at end of file +var _0x8952=['isAuthenticated','show','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','path','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id'];(function(_0x15bc2f,_0x25e563){var _0x574008=function(_0x220bee){while(--_0x220bee){_0x15bc2f['push'](_0x15bc2f['shift']());}};_0x574008(++_0x25e563);}(_0x8952,0x115));var _0x2895=function(_0x392408,_0x34212b){_0x392408=_0x392408-0x0;var _0xae494a=_0x8952[_0x392408];return _0xae494a;};'use strict';var multer=require(_0x2895('0x0'));var util=require('util');var path=require(_0x2895('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2895('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2895('0x3'));var controller=require(_0x2895('0x4'));router[_0x2895('0x5')]('/',auth['isAuthenticated'](),controller[_0x2895('0x6')]);router[_0x2895('0x5')](_0x2895('0x7'),auth[_0x2895('0x8')](),controller[_0x2895('0x9')]);router['get']('/:id/configurations',auth[_0x2895('0x8')](),controller['getConfigurations']);router[_0x2895('0x5')](_0x2895('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x2895('0xb')]('/',auth[_0x2895('0x8')](),controller[_0x2895('0xc')]);router[_0x2895('0xb')](_0x2895('0xd'),auth[_0x2895('0x8')](),controller[_0x2895('0xe')]);router[_0x2895('0xf')](_0x2895('0x7'),auth['isAuthenticated'](),controller[_0x2895('0x10')]);router[_0x2895('0x11')](_0x2895('0x7'),auth[_0x2895('0x8')](),controller['destroy']);module[_0x2895('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e42ef41..8da3757 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 _0x7eae=['STRING','HelpDesk','sequelize','exports'];(function(_0xc66583,_0x404ee3){var _0x580314=function(_0x5e2849){while(--_0x5e2849){_0xc66583['push'](_0xc66583['shift']());}};_0x580314(++_0x404ee3);}(_0x7eae,0x6a));var _0xe7ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7eae[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xe7ea('0x0'));module[_0xe7ea('0x1')]={'name':{'type':Sequelize[_0xe7ea('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe7ea('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe7ea('0x2')],'allowNull':![],'defaultValue':_0xe7ea('0x3')},'remoteUri':{'type':Sequelize[_0xe7ea('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0xe7ea('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3140=['exports','STRING','HelpDesk','sequelize'];(function(_0x48c97d,_0x51e712){var _0x511efd=function(_0x1059b9){while(--_0x1059b9){_0x48c97d['push'](_0x48c97d['shift']());}};_0x511efd(++_0x51e712);}(_0x3140,0xdb));var _0x0314=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x3140[_0x470bfb];return _0x2f5d97;};'use strict';var Sequelize=require(_0x0314('0x0'));module[_0x0314('0x1')]={'name':{'type':Sequelize[_0x0314('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0314('0x2')]},'username':{'type':Sequelize[_0x0314('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x0314('0x2')],'allowNull':![],'defaultValue':_0x0314('0x3')},'remoteUri':{'type':Sequelize[_0x0314('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x0314('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 4e2522d..e8d022f 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 _0x0413=['key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','keys','filters','include','create','body','find','params','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','username','accessKey','slice','substring','format','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','sessionName','autogenerated','reference','includes','editable','label','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','destroy','name','send','VtigerAccount','rawAttributes','fieldName','type'];(function(_0x59c7a9,_0x16047d){var _0x326129=function(_0x18d7c2){while(--_0x18d7c2){_0x59c7a9['push'](_0x59c7a9['shift']());}};_0x326129(++_0x16047d);}(_0x0413,0xc3));var _0x3041=function(_0x2dff2f,_0x1ca51a){_0x2dff2f=_0x2dff2f-0x0;var _0x2bd2fb=_0x0413[_0x2dff2f];return _0x2bd2fb;};'use strict';var pdf=require(_0x3041('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3041('0x1'));var zipdir=require(_0x3041('0x2'));var jsonpatch=require(_0x3041('0x3'));var rp=require(_0x3041('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3041('0x5'));var util=require(_0x3041('0x6'));var path=require(_0x3041('0x7'));var sox=require(_0x3041('0x8'));var csv=require(_0x3041('0x9'));var ejs=require(_0x3041('0xa'));var fs=require('fs');var _=require(_0x3041('0xb'));var squel=require(_0x3041('0xc'));var crypto=require('crypto');var jsforce=require(_0x3041('0xd'));var deskjs=require(_0x3041('0xe'));var toCsv=require(_0x3041('0x9'));var querystring=require(_0x3041('0xf'));var Papa=require(_0x3041('0x10'));var Redis=require(_0x3041('0x11'));var authService=require(_0x3041('0x12'));var qs=require(_0x3041('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3041('0x14'));var logger=require('../../config/logger')(_0x3041('0x15'));var utils=require(_0x3041('0x16'));var config=require(_0x3041('0x17'));var db=require(_0x3041('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3041('0x19'));var client=jayson[_0x3041('0x1a')][_0x3041('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x11c463,_0x10a5aa,_0x5570ae){if(_0x5570ae){var _0x4ea6a2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ea6a2['test'](_0x10a5aa)){return _0x11c463;}else{throw new db[(_0x3041('0x1c'))][(_0x3041('0x1d'))](_0x3041('0x1e'));}}else{return _0x11c463;}}function respondWithRpcPromise(_0x4d2421,_0x1035b3,_0x27fffd,_0x3c6f93){return new BPromise(function(_0x477e54,_0xa5501a){var _0x46668d=_0x3c6f93||client;return _0x46668d[_0x3041('0x1f')](_0x4d2421,_0x27fffd)['then'](function(_0x5498b7){logger[_0x3041('0x20')](_0x3041('0x21'),_0x1035b3,'request\x20sent');logger[_0x3041('0x22')](_0x3041('0x23'),_0x1035b3,_0x3041('0x24'),JSON[_0x3041('0x25')](_0x5498b7));if(_0x5498b7['error']){if(_0x5498b7[_0x3041('0x26')]['code']===0x1f4){logger['error'](_0x3041('0x21'),_0x1035b3,_0x5498b7[_0x3041('0x26')][_0x3041('0x27')]);return _0xa5501a(_0x5498b7[_0x3041('0x26')][_0x3041('0x27')]);}logger[_0x3041('0x26')](_0x3041('0x21'),_0x1035b3,_0x5498b7['error']['message']);return _0x477e54(_0x5498b7[_0x3041('0x26')][_0x3041('0x27')]);}else{logger[_0x3041('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x1035b3,'request\x20sent');_0x477e54(_0x5498b7[_0x3041('0x28')][_0x3041('0x27')]);}})[_0x3041('0x29')](function(_0x4ff626){logger[_0x3041('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x1035b3,_0x4ff626);_0xa5501a(_0x4ff626);});});}function respondWithStatusCode(_0x36d793,_0xdb76f1){_0xdb76f1=_0xdb76f1||0xcc;return function(_0x1044d9){if(_0x1044d9){return _0x36d793[_0x3041('0x2a')](_0xdb76f1);}return _0x36d793[_0x3041('0x2b')](_0xdb76f1)[_0x3041('0x2c')]();};}function respondWithResult(_0x237fb8,_0x464f58){_0x464f58=_0x464f58||0xc8;return function(_0x3031ff){if(_0x3031ff){return _0x237fb8[_0x3041('0x2b')](_0x464f58)['json'](_0x3031ff);}};}function respondWithFilteredResult(_0x54cb6d,_0x27f185){return function(_0x38c322){if(_0x38c322){var _0x1a7bf6=_0x38c322[_0x3041('0x2d')],_0xfc688d=_0x27f185[_0x3041('0x2e')],_0x582a6d=_0x27f185[_0x3041('0x2e')]+_0x27f185[_0x3041('0x2f')],_0xe5f30f;if(_0x582a6d>=_0x1a7bf6){_0x582a6d=_0x1a7bf6;_0xe5f30f=0xc8;}else{_0xe5f30f=0xce;}_0x54cb6d[_0x3041('0x2b')](_0xe5f30f);return _0x54cb6d['set'](_0x3041('0x30'),_0xfc688d+'-'+_0x582a6d+'/'+_0x1a7bf6)[_0x3041('0x31')](_0x38c322);}return null;};}function patchUpdates(_0x242364){return function(_0x5d97aa){try{jsonpatch[_0x3041('0x32')](_0x5d97aa,_0x242364,!![]);}catch(_0x5d3a04){return BPromise['reject'](_0x5d3a04);}return _0x5d97aa[_0x3041('0x33')]();};}function saveUpdates(_0x4a9403,_0x58cb4b){return function(_0x490e57){if(_0x490e57){return _0x490e57[_0x3041('0x34')](_0x4a9403)[_0x3041('0x35')](function(_0x3e0c95){return _0x3e0c95;});}return null;};}function removeEntity(_0x45464d,_0x373a25){return function(_0x4aee2a){if(_0x4aee2a){return _0x4aee2a[_0x3041('0x36')]()[_0x3041('0x35')](function(){_0x45464d[_0x3041('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fbc1a,_0x1e10ea){return function(_0x28c6ab){if(!_0x28c6ab){_0x4fbc1a[_0x3041('0x2a')](0x194);}return _0x28c6ab;};}function handleError(_0x3b3d3b,_0x22e91b){_0x22e91b=_0x22e91b||0x1f4;return function(_0x34fd30){logger['error'](_0x34fd30['stack']);if(_0x34fd30[_0x3041('0x37')]){delete _0x34fd30[_0x3041('0x37')];}_0x3b3d3b[_0x3041('0x2b')](_0x22e91b)[_0x3041('0x38')](_0x34fd30);};}exports['index']=function(_0x45ce46,_0x840cf2){var _0x5474fc={},_0x33c123={},_0x307a53={'count':0x0,'rows':[]};var _0x393d2f=_['map'](db[_0x3041('0x39')][_0x3041('0x3a')],function(_0x405ff3){return{'name':_0x405ff3[_0x3041('0x3b')],'type':_0x405ff3[_0x3041('0x3c')][_0x3041('0x3d')]};});_0x33c123[_0x3041('0x3e')]=_[_0x3041('0x3f')](_0x393d2f,_0x3041('0x37'));_0x33c123[_0x3041('0x40')]=_['keys'](_0x45ce46['query']);_0x33c123['filters']=_[_0x3041('0x41')](_0x33c123[_0x3041('0x3e')],_0x33c123[_0x3041('0x40')]);_0x5474fc[_0x3041('0x42')]=_['intersection'](_0x33c123[_0x3041('0x3e')],qs[_0x3041('0x43')](_0x45ce46[_0x3041('0x40')]['fields']));_0x5474fc['attributes']=_0x5474fc[_0x3041('0x42')][_0x3041('0x44')]?_0x5474fc[_0x3041('0x42')]:_0x33c123[_0x3041('0x3e')];if(!_0x45ce46[_0x3041('0x40')][_0x3041('0x45')]('nolimit')){_0x5474fc['limit']=qs[_0x3041('0x2f')](_0x45ce46[_0x3041('0x40')][_0x3041('0x2f')]);_0x5474fc[_0x3041('0x2e')]=qs[_0x3041('0x2e')](_0x45ce46[_0x3041('0x40')][_0x3041('0x2e')]);}_0x5474fc[_0x3041('0x46')]=qs[_0x3041('0x47')](_0x45ce46['query']['sort']);_0x5474fc['where']=qs['filters'](_['pick'](_0x45ce46['query'],_0x33c123['filters']),_0x393d2f);if(_0x45ce46[_0x3041('0x40')][_0x3041('0x48')]){_0x5474fc[_0x3041('0x49')]=_[_0x3041('0x4a')](_0x5474fc['where'],{'$or':_[_0x3041('0x3f')](_0x393d2f,function(_0x1e2da7){if(_0x1e2da7[_0x3041('0x3c')]!==_0x3041('0x4b')){var _0x5a32e0={};_0x5a32e0[_0x1e2da7[_0x3041('0x37')]]={'$like':'%'+_0x45ce46[_0x3041('0x40')][_0x3041('0x48')]+'%'};return _0x5a32e0;}})});}_0x5474fc=_[_0x3041('0x4a')]({},_0x5474fc,_0x45ce46[_0x3041('0x4c')]);var _0x518a33={'where':_0x5474fc[_0x3041('0x49')]};return db[_0x3041('0x39')][_0x3041('0x2d')](_0x518a33)[_0x3041('0x35')](function(_0x3d5f34){_0x307a53['count']=_0x3d5f34;if(_0x45ce46['query'][_0x3041('0x4d')]){_0x5474fc['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x3041('0x4e')](_0x5474fc);})[_0x3041('0x35')](function(_0x128a06){_0x307a53[_0x3041('0x4f')]=_0x128a06;return _0x307a53;})['then'](respondWithFilteredResult(_0x840cf2,_0x5474fc))[_0x3041('0x29')](handleError(_0x840cf2,null));};exports['show']=function(_0x18584e,_0x184caa){var _0x21a017={'raw':![],'where':{'id':_0x18584e['params']['id']}},_0x3a50a4={};_0x3a50a4[_0x3041('0x3e')]=_[_0x3041('0x50')](db[_0x3041('0x39')][_0x3041('0x3a')]);_0x3a50a4[_0x3041('0x40')]=_[_0x3041('0x50')](_0x18584e[_0x3041('0x40')]);_0x3a50a4[_0x3041('0x51')]=_['intersection'](_0x3a50a4[_0x3041('0x3e')],_0x3a50a4['query']);_0x21a017[_0x3041('0x42')]=_[_0x3041('0x41')](_0x3a50a4[_0x3041('0x3e')],qs[_0x3041('0x43')](_0x18584e[_0x3041('0x40')][_0x3041('0x43')]));_0x21a017[_0x3041('0x42')]=_0x21a017[_0x3041('0x42')][_0x3041('0x44')]?_0x21a017[_0x3041('0x42')]:_0x3a50a4[_0x3041('0x3e')];if(_0x18584e[_0x3041('0x40')]['includeAll']){_0x21a017[_0x3041('0x52')]=[{'all':!![]}];}_0x21a017=_[_0x3041('0x4a')]({},_0x21a017,_0x18584e['options']);return db[_0x3041('0x39')]['find'](_0x21a017)['then'](handleEntityNotFound(_0x184caa,null))[_0x3041('0x35')](respondWithResult(_0x184caa,null))[_0x3041('0x29')](handleError(_0x184caa,null));};exports[_0x3041('0x53')]=function(_0x3f67eb,_0x1269a3){return db[_0x3041('0x39')]['create'](_0x3f67eb['body'],{})[_0x3041('0x35')](respondWithResult(_0x1269a3,0xc9))[_0x3041('0x29')](handleError(_0x1269a3,null));};exports[_0x3041('0x34')]=function(_0x20a8c2,_0x370d0a){if(_0x20a8c2['body']['id']){delete _0x20a8c2[_0x3041('0x54')]['id'];}return db[_0x3041('0x39')][_0x3041('0x55')]({'where':{'id':_0x20a8c2[_0x3041('0x56')]['id']}})['then'](handleEntityNotFound(_0x370d0a,null))[_0x3041('0x35')](saveUpdates(_0x20a8c2[_0x3041('0x54')],null))['then'](respondWithResult(_0x370d0a,null))[_0x3041('0x29')](handleError(_0x370d0a,null));};exports['destroy']=function(_0x902850,_0x2981d4){return db[_0x3041('0x39')][_0x3041('0x55')]({'where':{'id':_0x902850[_0x3041('0x56')]['id']}})[_0x3041('0x35')](handleEntityNotFound(_0x2981d4,null))[_0x3041('0x35')](removeEntity(_0x2981d4,null))[_0x3041('0x29')](handleError(_0x2981d4,null));};exports[_0x3041('0x57')]=function(_0x3abf12,_0x3880ba,_0x4a7ba6){var _0x45386e={};var _0x4bc1f3={};var _0x4d6394;var _0x5bb2e7;return db[_0x3041('0x39')][_0x3041('0x58')]({'where':{'id':_0x3abf12['params']['id']}})['then'](handleEntityNotFound(_0x3880ba,null))[_0x3041('0x35')](function(_0x58a12d){if(_0x58a12d){_0x4d6394=_0x58a12d;_0x4bc1f3[_0x3041('0x3e')]=_['keys'](db[_0x3041('0x59')][_0x3041('0x3a')]);_0x4bc1f3[_0x3041('0x40')]=_[_0x3041('0x50')](_0x3abf12['query']);_0x4bc1f3[_0x3041('0x51')]=_[_0x3041('0x41')](_0x4bc1f3[_0x3041('0x3e')],_0x4bc1f3[_0x3041('0x40')]);_0x45386e[_0x3041('0x42')]=_[_0x3041('0x41')](_0x4bc1f3['model'],qs[_0x3041('0x43')](_0x3abf12[_0x3041('0x40')][_0x3041('0x43')]));_0x45386e[_0x3041('0x42')]=_0x45386e[_0x3041('0x42')]['length']?_0x45386e[_0x3041('0x42')]:_0x4bc1f3[_0x3041('0x3e')];_0x45386e[_0x3041('0x46')]=qs[_0x3041('0x47')](_0x3abf12[_0x3041('0x40')]['sort']);_0x45386e[_0x3041('0x49')]=qs[_0x3041('0x51')](_[_0x3041('0x5a')](_0x3abf12[_0x3041('0x40')],_0x4bc1f3['filters']));if(_0x3abf12['query'][_0x3041('0x48')]){_0x45386e['where']=_[_0x3041('0x4a')](_0x45386e[_0x3041('0x49')],{'$or':_['map'](_0x45386e['attributes'],function(_0xb8efb4){var _0x65543c={};_0x65543c[_0xb8efb4]={'$like':'%'+_0x3abf12[_0x3041('0x40')][_0x3041('0x48')]+'%'};return _0x65543c;})});}_0x45386e=_[_0x3041('0x4a')]({},_0x45386e,_0x3abf12[_0x3041('0x4c')]);return _0x4d6394[_0x3041('0x57')](_0x45386e);}})[_0x3041('0x35')](function(_0x190459){if(_0x190459){_0x5bb2e7=_0x190459[_0x3041('0x44')];if(!_0x3abf12[_0x3041('0x40')][_0x3041('0x45')]('nolimit')){_0x45386e[_0x3041('0x2f')]=qs[_0x3041('0x2f')](_0x3abf12[_0x3041('0x40')]['limit']);_0x45386e[_0x3041('0x2e')]=qs['offset'](_0x3abf12[_0x3041('0x40')][_0x3041('0x2e')]);}return _0x4d6394[_0x3041('0x57')](_0x45386e);}})[_0x3041('0x35')](function(_0x151e1f){if(_0x151e1f){return _0x151e1f?{'count':_0x5bb2e7,'rows':_0x151e1f}:null;}})[_0x3041('0x35')](respondWithResult(_0x3880ba,null))['catch'](handleError(_0x3880ba,null));};exports[_0x3041('0x5b')]=function(_0x186d6e,_0x375a98,_0x512bc6){if(_0x186d6e['body']['id']){delete _0x186d6e[_0x3041('0x54')]['id'];}return db[_0x3041('0x39')][_0x3041('0x58')]({'where':{'id':_0x186d6e[_0x3041('0x56')]['id']}})[_0x3041('0x35')](handleEntityNotFound(_0x375a98,null))['then'](function(_0x161ce1){if(_0x161ce1){_0x186d6e[_0x3041('0x54')][_0x3041('0x5c')]=_0x161ce1['id'];_0x186d6e[_0x3041('0x54')][_0x3041('0x5d')]=integrations['getSubjects'](_0x186d6e[_0x3041('0x54')][_0x3041('0x5e')],_0x186d6e[_0x3041('0x54')][_0x3041('0x3c')]);_0x186d6e[_0x3041('0x54')][_0x3041('0x5f')]=integrations['getDescriptions'](_0x186d6e[_0x3041('0x54')][_0x3041('0x5e')],_0x186d6e[_0x3041('0x54')]['type']);return db['VtigerConfiguration'][_0x3041('0x53')](_0x186d6e[_0x3041('0x54')],{'include':[{'model':db['VtigerField'],'as':_0x3041('0x5d')},{'model':db[_0x3041('0x60')],'as':_0x3041('0x5f')}]});}return null;})[_0x3041('0x35')](respondWithResult(_0x375a98,null))['catch'](handleError(_0x375a98,null));};var md5=require(_0x3041('0x61'));exports[_0x3041('0x62')]=function(_0x2bc9d9,_0x4162f8,_0x14b7fc){var _0x29f898=null;var _0x4918ca=null;var _0x1ee1a4=null;var _0x30cf3e=null;var _0x3c3b90='';return db[_0x3041('0x39')]['findOne']({'where':{'id':_0x2bc9d9['params']['id']},'attributes':['id',_0x3041('0x37'),'username',_0x3041('0x63'),_0x3041('0x64'),_0x3041('0x65'),'serverUrl','accessKey']})[_0x3041('0x35')](handleEntityNotFound(_0x4162f8,null))[_0x3041('0x35')](function(_0xfa2fbd){if(_0xfa2fbd){_0x29f898=_0xfa2fbd[_0x3041('0x66')];_0x4918ca=_0xfa2fbd[_0x3041('0x67')];_0x1ee1a4=_0xfa2fbd[_0x3041('0x64')];_0x3c3b90=_0xfa2fbd[_0x3041('0x65')];var _0x3dc032=_0x3c3b90[_0x3041('0x68')](-0x1);if(_0x3dc032==='/'){_0x3c3b90=_0x3c3b90[_0x3041('0x69')](0x0,_0x3c3b90['lastIndexOf'](_0x3dc032));}_0x30cf3e=util[_0x3041('0x6a')](_0x3041('0x6b'),_0x3c3b90);var _0x66900c={'method':'GET','uri':_0x30cf3e,'qs':{'operation':_0x3041('0x6c'),'username':_0xfa2fbd[_0x3041('0x66')]},'json':!![]};return rp(_0x66900c);}})[_0x3041('0x35')](function(_0x5259f7){if(_0x5259f7[_0x3041('0x6d')]){var _0x56e4d1={'method':_0x3041('0x6e'),'uri':_0x30cf3e,'form':{'operation':_0x3041('0x6f'),'username':_0x29f898,'accessKey':md5(_0x5259f7[_0x3041('0x28')][_0x3041('0x70')]+_0x4918ca)},'json':!![]};return rp(_0x56e4d1);}})['then'](function(_0x56f291){if(_0x56f291[_0x3041('0x6d')]){var _0x4867df={'method':_0x3041('0x71'),'uri':_0x30cf3e,'qs':{'operation':_0x3041('0x72'),'username':_0x29f898,'sessionName':_0x56f291[_0x3041('0x28')][_0x3041('0x73')],'elementType':_0x1ee1a4},'json':!![]};return rp(_0x4867df);}})[_0x3041('0x35')](function(_0x591c07){if(_0x591c07[_0x3041('0x6d')]){var _0xa2fd5c=[_0x3041('0x74'),_0x3041('0x75'),'owner'];_['remove'](_0x591c07[_0x3041('0x28')][_0x3041('0x43')],function(_0x282ffd){return _0xa2fd5c[_0x3041('0x76')](_0x282ffd[_0x3041('0x3c')][_0x3041('0x37')]);});_['remove'](_0x591c07[_0x3041('0x28')][_0x3041('0x43')],function(_0x21306a){return _0x21306a[_0x3041('0x77')]==='false';});return{'count':_0x591c07[_0x3041('0x28')][_0x3041('0x43')][_0x3041('0x44')],'rows':_['map'](_0x591c07['result'][_0x3041('0x43')],function(_0x28a6cd){return{'id':_0x28a6cd[_0x3041('0x37')],'name':_0x28a6cd[_0x3041('0x78')],'custom':_['startsWith'](_0x28a6cd['name'],'cf_')?!![]:![],'options':_0x28a6cd[_0x3041('0x3c')][_0x3041('0x37')]==='picklist'&&_0x28a6cd[_0x3041('0x3c')]['picklistValues'][_0x3041('0x44')]>0x0?_[_0x3041('0x3f')](_0x28a6cd['type'][_0x3041('0x79')],function(_0x3853f2){return{'name':_0x3853f2[_0x3041('0x78')],'value':_0x3853f2[_0x3041('0x7a')]};}):[]};})};}})[_0x3041('0x35')](respondWithResult(_0x4162f8,null))['catch'](function(_0x384765){console[_0x3041('0x7b')]('vTiger\x20error:\x20'+_0x384765);var _0x5abb98=_0x2bc9d9[_0x3041('0x40')][_0x3041('0x7c')]?0x1f4:_0x384765['statusCode']||0x1f4;logger['error'](_0x3041('0x7d'),_0x3041('0x62'),_0x5abb98,JSON['stringify'](_0x384765));delete _0x384765['name'];if(_0x5abb98===0x191){_0x5abb98=0x190;}_0x4162f8[_0x3041('0x2b')](_0x5abb98)[_0x3041('0x38')](_0x2bc9d9['query'][_0x3041('0x7c')]?{'message':_0x3041('0x7e'),'statusCode':_0x384765[_0x3041('0x7f')]}:_0x384765);});}; \ No newline at end of file +var _0x5d23=['body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','description','moduleName','remoteUri','serverUrl','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','token','describe','sessionName','autogenerated','reference','includes','remove','editable','false','label','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','options','VtigerAccount','count','rows','params','includeAll','find','create'];(function(_0x4163f6,_0x49aa93){var _0x29bbc8=function(_0x98b1e9){while(--_0x98b1e9){_0x4163f6['push'](_0x4163f6['shift']());}};_0x29bbc8(++_0x49aa93);}(_0x5d23,0xa8));var _0x35d2=function(_0x1e2db8,_0xec07cd){_0x1e2db8=_0x1e2db8-0x0;var _0x5d32c5=_0x5d23[_0x1e2db8];return _0x5d32c5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x35d2('0x0'));var rimraf=require(_0x35d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35d2('0x2'));var rp=require(_0x35d2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x35d2('0x4'));var util=require(_0x35d2('0x5'));var path=require(_0x35d2('0x6'));var sox=require('sox');var csv=require(_0x35d2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x35d2('0x8'));var jsforce=require(_0x35d2('0x9'));var deskjs=require(_0x35d2('0xa'));var toCsv=require(_0x35d2('0x7'));var querystring=require(_0x35d2('0xb'));var Papa=require(_0x35d2('0xc'));var Redis=require(_0x35d2('0xd'));var authService=require(_0x35d2('0xe'));var qs=require(_0x35d2('0xf'));var as=require(_0x35d2('0x10'));var hardwareService=require(_0x35d2('0x11'));var logger=require('../../config/logger')(_0x35d2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x35d2('0x13'))['db'];var integrations=require(_0x35d2('0x14'));var jayson=require(_0x35d2('0x15'));var client=jayson[_0x35d2('0x16')][_0x35d2('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3f9ca2,_0x1d06e2,_0x237415){if(_0x237415){var _0x347a60=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x347a60[_0x35d2('0x18')](_0x1d06e2)){return _0x3f9ca2;}else{throw new db['Sequelize']['ValidationError'](_0x35d2('0x19'));}}else{return _0x3f9ca2;}}function respondWithRpcPromise(_0x49ea0b,_0x27153c,_0xc73f9e,_0x3db545){return new BPromise(function(_0x3b1ca9,_0x20ea34){var _0x41baa2=_0x3db545||client;return _0x41baa2[_0x35d2('0x1a')](_0x49ea0b,_0xc73f9e)[_0x35d2('0x1b')](function(_0x543c00){logger[_0x35d2('0x1c')](_0x35d2('0x1d'),_0x27153c,_0x35d2('0x1e'));logger[_0x35d2('0x1f')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x27153c,_0x35d2('0x1e'),JSON['stringify'](_0x543c00));if(_0x543c00[_0x35d2('0x20')]){if(_0x543c00[_0x35d2('0x20')][_0x35d2('0x21')]===0x1f4){logger[_0x35d2('0x20')](_0x35d2('0x1d'),_0x27153c,_0x543c00[_0x35d2('0x20')][_0x35d2('0x22')]);return _0x20ea34(_0x543c00[_0x35d2('0x20')][_0x35d2('0x22')]);}logger[_0x35d2('0x20')](_0x35d2('0x1d'),_0x27153c,_0x543c00[_0x35d2('0x20')][_0x35d2('0x22')]);return _0x3b1ca9(_0x543c00[_0x35d2('0x20')][_0x35d2('0x22')]);}else{logger[_0x35d2('0x1c')](_0x35d2('0x1d'),_0x27153c,_0x35d2('0x1e'));_0x3b1ca9(_0x543c00[_0x35d2('0x23')][_0x35d2('0x22')]);}})[_0x35d2('0x24')](function(_0x493949){logger[_0x35d2('0x20')](_0x35d2('0x1d'),_0x27153c,_0x493949);_0x20ea34(_0x493949);});});}function respondWithStatusCode(_0x37f2d1,_0x545013){_0x545013=_0x545013||0xcc;return function(_0x4820c7){if(_0x4820c7){return _0x37f2d1[_0x35d2('0x25')](_0x545013);}return _0x37f2d1[_0x35d2('0x26')](_0x545013)[_0x35d2('0x27')]();};}function respondWithResult(_0x1d4236,_0x433e0f){_0x433e0f=_0x433e0f||0xc8;return function(_0x192f64){if(_0x192f64){return _0x1d4236[_0x35d2('0x26')](_0x433e0f)['json'](_0x192f64);}};}function respondWithFilteredResult(_0x4b868c,_0xe4e721){return function(_0x1c8365){if(_0x1c8365){var _0x3c999d=_0x1c8365['count'],_0x46f88e=_0xe4e721[_0x35d2('0x28')],_0x34ef90=_0xe4e721[_0x35d2('0x28')]+_0xe4e721['limit'],_0x519d1d;if(_0x34ef90>=_0x3c999d){_0x34ef90=_0x3c999d;_0x519d1d=0xc8;}else{_0x519d1d=0xce;}_0x4b868c[_0x35d2('0x26')](_0x519d1d);return _0x4b868c[_0x35d2('0x29')](_0x35d2('0x2a'),_0x46f88e+'-'+_0x34ef90+'/'+_0x3c999d)[_0x35d2('0x2b')](_0x1c8365);}return null;};}function patchUpdates(_0x52077b){return function(_0x35ddf0){try{jsonpatch[_0x35d2('0x2c')](_0x35ddf0,_0x52077b,!![]);}catch(_0x3ec4b9){return BPromise['reject'](_0x3ec4b9);}return _0x35ddf0['save']();};}function saveUpdates(_0x266e99,_0x26a606){return function(_0x431f47){if(_0x431f47){return _0x431f47[_0x35d2('0x2d')](_0x266e99)[_0x35d2('0x1b')](function(_0xec9f4){return _0xec9f4;});}return null;};}function removeEntity(_0x16ffb7,_0x9507b1){return function(_0x14d5f9){if(_0x14d5f9){return _0x14d5f9[_0x35d2('0x2e')]()[_0x35d2('0x1b')](function(){_0x16ffb7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f37d,_0x3ab205){return function(_0x3a564b){if(!_0x3a564b){_0x13f37d[_0x35d2('0x25')](0x194);}return _0x3a564b;};}function handleError(_0x5d0bca,_0x18c2ab){_0x18c2ab=_0x18c2ab||0x1f4;return function(_0x7724ab){logger[_0x35d2('0x20')](_0x7724ab[_0x35d2('0x2f')]);if(_0x7724ab['name']){delete _0x7724ab[_0x35d2('0x30')];}_0x5d0bca[_0x35d2('0x26')](_0x18c2ab)[_0x35d2('0x31')](_0x7724ab);};}exports[_0x35d2('0x32')]=function(_0xd1d7b8,_0x567aa2){var _0xa68bc6={},_0x585619={},_0x5cfd94={'count':0x0,'rows':[]};var _0x564ba7=_[_0x35d2('0x33')](db['VtigerAccount'][_0x35d2('0x34')],function(_0x278aa0){return{'name':_0x278aa0['fieldName'],'type':_0x278aa0[_0x35d2('0x35')][_0x35d2('0x36')]};});_0x585619[_0x35d2('0x37')]=_[_0x35d2('0x33')](_0x564ba7,'name');_0x585619[_0x35d2('0x38')]=_[_0x35d2('0x39')](_0xd1d7b8['query']);_0x585619[_0x35d2('0x3a')]=_[_0x35d2('0x3b')](_0x585619['model'],_0x585619[_0x35d2('0x38')]);_0xa68bc6[_0x35d2('0x3c')]=_[_0x35d2('0x3b')](_0x585619['model'],qs['fields'](_0xd1d7b8[_0x35d2('0x38')][_0x35d2('0x3d')]));_0xa68bc6[_0x35d2('0x3c')]=_0xa68bc6[_0x35d2('0x3c')][_0x35d2('0x3e')]?_0xa68bc6[_0x35d2('0x3c')]:_0x585619[_0x35d2('0x37')];if(!_0xd1d7b8[_0x35d2('0x38')][_0x35d2('0x3f')](_0x35d2('0x40'))){_0xa68bc6['limit']=qs[_0x35d2('0x41')](_0xd1d7b8[_0x35d2('0x38')][_0x35d2('0x41')]);_0xa68bc6[_0x35d2('0x28')]=qs[_0x35d2('0x28')](_0xd1d7b8[_0x35d2('0x38')]['offset']);}_0xa68bc6[_0x35d2('0x42')]=qs['sort'](_0xd1d7b8['query'][_0x35d2('0x43')]);_0xa68bc6['where']=qs['filters'](_[_0x35d2('0x44')](_0xd1d7b8['query'],_0x585619[_0x35d2('0x3a')]),_0x564ba7);if(_0xd1d7b8[_0x35d2('0x38')][_0x35d2('0x45')]){_0xa68bc6['where']=_[_0x35d2('0x46')](_0xa68bc6[_0x35d2('0x47')],{'$or':_[_0x35d2('0x33')](_0x564ba7,function(_0x3c0044){if(_0x3c0044['type']!=='VIRTUAL'){var _0x4be271={};_0x4be271[_0x3c0044[_0x35d2('0x30')]]={'$like':'%'+_0xd1d7b8[_0x35d2('0x38')][_0x35d2('0x45')]+'%'};return _0x4be271;}})});}_0xa68bc6=_[_0x35d2('0x46')]({},_0xa68bc6,_0xd1d7b8[_0x35d2('0x48')]);var _0x589d3={'where':_0xa68bc6['where']};return db[_0x35d2('0x49')][_0x35d2('0x4a')](_0x589d3)['then'](function(_0x36b59e){_0x5cfd94[_0x35d2('0x4a')]=_0x36b59e;if(_0xd1d7b8[_0x35d2('0x38')]['includeAll']){_0xa68bc6['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0xa68bc6);})['then'](function(_0x481cfe){_0x5cfd94[_0x35d2('0x4b')]=_0x481cfe;return _0x5cfd94;})['then'](respondWithFilteredResult(_0x567aa2,_0xa68bc6))[_0x35d2('0x24')](handleError(_0x567aa2,null));};exports['show']=function(_0xc4b245,_0x4ed090){var _0x5f310b={'raw':![],'where':{'id':_0xc4b245[_0x35d2('0x4c')]['id']}},_0xabda0e={};_0xabda0e[_0x35d2('0x37')]=_[_0x35d2('0x39')](db[_0x35d2('0x49')][_0x35d2('0x34')]);_0xabda0e[_0x35d2('0x38')]=_[_0x35d2('0x39')](_0xc4b245[_0x35d2('0x38')]);_0xabda0e[_0x35d2('0x3a')]=_[_0x35d2('0x3b')](_0xabda0e[_0x35d2('0x37')],_0xabda0e[_0x35d2('0x38')]);_0x5f310b[_0x35d2('0x3c')]=_[_0x35d2('0x3b')](_0xabda0e[_0x35d2('0x37')],qs[_0x35d2('0x3d')](_0xc4b245[_0x35d2('0x38')][_0x35d2('0x3d')]));_0x5f310b['attributes']=_0x5f310b['attributes'][_0x35d2('0x3e')]?_0x5f310b[_0x35d2('0x3c')]:_0xabda0e[_0x35d2('0x37')];if(_0xc4b245[_0x35d2('0x38')][_0x35d2('0x4d')]){_0x5f310b['include']=[{'all':!![]}];}_0x5f310b=_['merge']({},_0x5f310b,_0xc4b245[_0x35d2('0x48')]);return db[_0x35d2('0x49')][_0x35d2('0x4e')](_0x5f310b)['then'](handleEntityNotFound(_0x4ed090,null))[_0x35d2('0x1b')](respondWithResult(_0x4ed090,null))['catch'](handleError(_0x4ed090,null));};exports[_0x35d2('0x4f')]=function(_0x4fc780,_0x7e27c3){return db[_0x35d2('0x49')][_0x35d2('0x4f')](_0x4fc780[_0x35d2('0x50')],{})[_0x35d2('0x1b')](respondWithResult(_0x7e27c3,0xc9))[_0x35d2('0x24')](handleError(_0x7e27c3,null));};exports['update']=function(_0x556042,_0x1b0e5a){if(_0x556042['body']['id']){delete _0x556042[_0x35d2('0x50')]['id'];}return db[_0x35d2('0x49')][_0x35d2('0x4e')]({'where':{'id':_0x556042[_0x35d2('0x4c')]['id']}})[_0x35d2('0x1b')](handleEntityNotFound(_0x1b0e5a,null))[_0x35d2('0x1b')](saveUpdates(_0x556042[_0x35d2('0x50')],null))['then'](respondWithResult(_0x1b0e5a,null))[_0x35d2('0x24')](handleError(_0x1b0e5a,null));};exports[_0x35d2('0x2e')]=function(_0x157539,_0x18c030){return db[_0x35d2('0x49')]['find']({'where':{'id':_0x157539[_0x35d2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x18c030,null))[_0x35d2('0x1b')](removeEntity(_0x18c030,null))[_0x35d2('0x24')](handleError(_0x18c030,null));};exports[_0x35d2('0x51')]=function(_0x5dba4a,_0x1455a7,_0x2414f5){var _0x2d1497={};var _0x11b10b={};var _0x1de155;var _0xc97941;return db[_0x35d2('0x49')][_0x35d2('0x52')]({'where':{'id':_0x5dba4a[_0x35d2('0x4c')]['id']}})[_0x35d2('0x1b')](handleEntityNotFound(_0x1455a7,null))[_0x35d2('0x1b')](function(_0x41a343){if(_0x41a343){_0x1de155=_0x41a343;_0x11b10b['model']=_[_0x35d2('0x39')](db[_0x35d2('0x53')][_0x35d2('0x34')]);_0x11b10b[_0x35d2('0x38')]=_[_0x35d2('0x39')](_0x5dba4a[_0x35d2('0x38')]);_0x11b10b[_0x35d2('0x3a')]=_['intersection'](_0x11b10b['model'],_0x11b10b[_0x35d2('0x38')]);_0x2d1497[_0x35d2('0x3c')]=_[_0x35d2('0x3b')](_0x11b10b[_0x35d2('0x37')],qs[_0x35d2('0x3d')](_0x5dba4a[_0x35d2('0x38')][_0x35d2('0x3d')]));_0x2d1497[_0x35d2('0x3c')]=_0x2d1497['attributes'][_0x35d2('0x3e')]?_0x2d1497['attributes']:_0x11b10b[_0x35d2('0x37')];_0x2d1497[_0x35d2('0x42')]=qs[_0x35d2('0x43')](_0x5dba4a[_0x35d2('0x38')][_0x35d2('0x43')]);_0x2d1497['where']=qs[_0x35d2('0x3a')](_[_0x35d2('0x44')](_0x5dba4a[_0x35d2('0x38')],_0x11b10b[_0x35d2('0x3a')]));if(_0x5dba4a[_0x35d2('0x38')]['filter']){_0x2d1497[_0x35d2('0x47')]=_['merge'](_0x2d1497[_0x35d2('0x47')],{'$or':_[_0x35d2('0x33')](_0x2d1497[_0x35d2('0x3c')],function(_0x349ddc){var _0x16ede5={};_0x16ede5[_0x349ddc]={'$like':'%'+_0x5dba4a[_0x35d2('0x38')][_0x35d2('0x45')]+'%'};return _0x16ede5;})});}_0x2d1497=_[_0x35d2('0x46')]({},_0x2d1497,_0x5dba4a[_0x35d2('0x48')]);return _0x1de155[_0x35d2('0x51')](_0x2d1497);}})[_0x35d2('0x1b')](function(_0x20bc71){if(_0x20bc71){_0xc97941=_0x20bc71[_0x35d2('0x3e')];if(!_0x5dba4a[_0x35d2('0x38')][_0x35d2('0x3f')]('nolimit')){_0x2d1497[_0x35d2('0x41')]=qs['limit'](_0x5dba4a[_0x35d2('0x38')][_0x35d2('0x41')]);_0x2d1497[_0x35d2('0x28')]=qs[_0x35d2('0x28')](_0x5dba4a[_0x35d2('0x38')][_0x35d2('0x28')]);}return _0x1de155['getConfigurations'](_0x2d1497);}})[_0x35d2('0x1b')](function(_0x39e4dd){if(_0x39e4dd){return _0x39e4dd?{'count':_0xc97941,'rows':_0x39e4dd}:null;}})['then'](respondWithResult(_0x1455a7,null))[_0x35d2('0x24')](handleError(_0x1455a7,null));};exports[_0x35d2('0x54')]=function(_0x542653,_0x422b76,_0x215b62){if(_0x542653[_0x35d2('0x50')]['id']){delete _0x542653[_0x35d2('0x50')]['id'];}return db[_0x35d2('0x49')][_0x35d2('0x52')]({'where':{'id':_0x542653[_0x35d2('0x4c')]['id']}})[_0x35d2('0x1b')](handleEntityNotFound(_0x422b76,null))[_0x35d2('0x1b')](function(_0x38e5ea){if(_0x38e5ea){_0x542653['body']['AccountId']=_0x38e5ea['id'];_0x542653[_0x35d2('0x50')][_0x35d2('0x55')]=integrations[_0x35d2('0x56')](_0x542653[_0x35d2('0x50')][_0x35d2('0x57')],_0x542653[_0x35d2('0x50')][_0x35d2('0x35')]);_0x542653[_0x35d2('0x50')][_0x35d2('0x58')]=integrations[_0x35d2('0x59')](_0x542653[_0x35d2('0x50')][_0x35d2('0x57')],_0x542653['body'][_0x35d2('0x35')]);return db[_0x35d2('0x53')][_0x35d2('0x4f')](_0x542653[_0x35d2('0x50')],{'include':[{'model':db[_0x35d2('0x5a')],'as':_0x35d2('0x55')},{'model':db[_0x35d2('0x5a')],'as':_0x35d2('0x58')}]});}return null;})[_0x35d2('0x1b')](respondWithResult(_0x422b76,null))['catch'](handleError(_0x422b76,null));};var md5=require(_0x35d2('0x5b'));exports['getFields']=function(_0x150e42,_0x15d218,_0x1b18cd){var _0x3f6497=null;var _0x5e9a6e=null;var _0xb5c6da=null;var _0x40e8cf=null;var _0x49db98='';return db[_0x35d2('0x49')]['findOne']({'where':{'id':_0x150e42[_0x35d2('0x4c')]['id']},'attributes':['id','name','username',_0x35d2('0x5c'),_0x35d2('0x5d'),_0x35d2('0x5e'),_0x35d2('0x5f'),'accessKey']})[_0x35d2('0x1b')](handleEntityNotFound(_0x15d218,null))[_0x35d2('0x1b')](function(_0x3b6a28){if(_0x3b6a28){_0x3f6497=_0x3b6a28[_0x35d2('0x60')];_0x5e9a6e=_0x3b6a28['accessKey'];_0xb5c6da=_0x3b6a28[_0x35d2('0x5d')];_0x49db98=_0x3b6a28[_0x35d2('0x5e')];var _0x2a7f8a=_0x49db98[_0x35d2('0x61')](-0x1);if(_0x2a7f8a==='/'){_0x49db98=_0x49db98[_0x35d2('0x62')](0x0,_0x49db98[_0x35d2('0x63')](_0x2a7f8a));}_0x40e8cf=util[_0x35d2('0x64')](_0x35d2('0x65'),_0x49db98);var _0x4e46ec={'method':_0x35d2('0x66'),'uri':_0x40e8cf,'qs':{'operation':_0x35d2('0x67'),'username':_0x3b6a28[_0x35d2('0x60')]},'json':!![]};return rp(_0x4e46ec);}})['then'](function(_0x12c42b){if(_0x12c42b[_0x35d2('0x68')]){var _0x38da90={'method':'POST','uri':_0x40e8cf,'form':{'operation':_0x35d2('0x69'),'username':_0x3f6497,'accessKey':md5(_0x12c42b[_0x35d2('0x23')][_0x35d2('0x6a')]+_0x5e9a6e)},'json':!![]};return rp(_0x38da90);}})[_0x35d2('0x1b')](function(_0xaffde2){if(_0xaffde2[_0x35d2('0x68')]){var _0x1fcbab={'method':_0x35d2('0x66'),'uri':_0x40e8cf,'qs':{'operation':_0x35d2('0x6b'),'username':_0x3f6497,'sessionName':_0xaffde2[_0x35d2('0x23')][_0x35d2('0x6c')],'elementType':_0xb5c6da},'json':!![]};return rp(_0x1fcbab);}})[_0x35d2('0x1b')](function(_0x2f9cff){if(_0x2f9cff[_0x35d2('0x68')]){var _0xdf993=[_0x35d2('0x6d'),_0x35d2('0x6e'),'owner'];_['remove'](_0x2f9cff[_0x35d2('0x23')][_0x35d2('0x3d')],function(_0x530bc3){return _0xdf993[_0x35d2('0x6f')](_0x530bc3[_0x35d2('0x35')][_0x35d2('0x30')]);});_[_0x35d2('0x70')](_0x2f9cff[_0x35d2('0x23')][_0x35d2('0x3d')],function(_0x43812b){return _0x43812b[_0x35d2('0x71')]===_0x35d2('0x72');});return{'count':_0x2f9cff[_0x35d2('0x23')][_0x35d2('0x3d')][_0x35d2('0x3e')],'rows':_['map'](_0x2f9cff[_0x35d2('0x23')][_0x35d2('0x3d')],function(_0x36769e){return{'id':_0x36769e[_0x35d2('0x30')],'name':_0x36769e[_0x35d2('0x73')],'custom':_[_0x35d2('0x74')](_0x36769e[_0x35d2('0x30')],_0x35d2('0x75'))?!![]:![],'options':_0x36769e[_0x35d2('0x35')][_0x35d2('0x30')]==='picklist'&&_0x36769e[_0x35d2('0x35')][_0x35d2('0x76')][_0x35d2('0x3e')]>0x0?_[_0x35d2('0x33')](_0x36769e[_0x35d2('0x35')]['picklistValues'],function(_0xa197ec){return{'name':_0xa197ec[_0x35d2('0x73')],'value':_0xa197ec[_0x35d2('0x77')]};}):[]};})};}})['then'](respondWithResult(_0x15d218,null))[_0x35d2('0x24')](function(_0x283ecb){console[_0x35d2('0x78')](_0x35d2('0x79')+_0x283ecb);var _0x2e7935=_0x150e42[_0x35d2('0x38')][_0x35d2('0x18')]?0x1f4:_0x283ecb[_0x35d2('0x7a')]||0x1f4;logger[_0x35d2('0x20')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2e7935,JSON['stringify'](_0x283ecb));delete _0x283ecb[_0x35d2('0x30')];if(_0x2e7935===0x191){_0x2e7935=0x190;}_0x15d218[_0x35d2('0x26')](_0x2e7935)[_0x35d2('0x31')](_0x150e42['query'][_0x35d2('0x18')]?{'message':_0x35d2('0x7b'),'statusCode':_0x283ecb[_0x35d2('0x7a')]}:_0x283ecb);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 92acca2..79e622e 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 _0x4459=['./intVtigerAccount.attributes','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x173e65,_0x24a8bf){var _0x37d496=function(_0x34b441){while(--_0x34b441){_0x173e65['push'](_0x173e65['shift']());}};_0x37d496(++_0x24a8bf);}(_0x4459,0x1cb));var _0x9445=function(_0xf6a3ba,_0x3c70b3){_0xf6a3ba=_0xf6a3ba-0x0;var _0x3fde18=_0x4459[_0xf6a3ba];return _0x3fde18;};'use strict';var _=require(_0x9445('0x0'));var util=require(_0x9445('0x1'));var logger=require(_0x9445('0x2'))('api');var moment=require(_0x9445('0x3'));var BPromise=require(_0x9445('0x4'));var rp=require(_0x9445('0x5'));var fs=require('fs');var path=require(_0x9445('0x6'));var rimraf=require(_0x9445('0x7'));var config=require(_0x9445('0x8'));var attributes=require(_0x9445('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x36b833,_0x1f14fa){return _0x36b833[_0x9445('0xa')](_0x9445('0xb'),attributes,{'tableName':_0x9445('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe943=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xe943,0xa2));var _0x3e94=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0xe943[_0x7a3247];return _0x1bfde5;};'use strict';var _=require(_0x3e94('0x0'));var util=require('util');var logger=require(_0x3e94('0x1'))(_0x3e94('0x2'));var moment=require('moment');var BPromise=require(_0x3e94('0x3'));var rp=require(_0x3e94('0x4'));var fs=require('fs');var path=require(_0x3e94('0x5'));var rimraf=require(_0x3e94('0x6'));var config=require('../../config/environment');var attributes=require(_0x3e94('0x7'));var integrations=require(_0x3e94('0x8'));module[_0x3e94('0x9')]=function(_0x466182,_0x185497){return _0x466182[_0x3e94('0xa')](_0x3e94('0xb'),attributes,{'tableName':_0x3e94('0xc'),'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 50b0e7f..35ed7b2 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 _0xdd2f=['where','attributes','limit','map','include','model','find','ShowVtigerAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw'];(function(_0x551961,_0x2d1deb){var _0x45039d=function(_0x5d41b2){while(--_0x5d41b2){_0x551961['push'](_0x551961['shift']());}};_0x45039d(++_0x2d1deb);}(_0xdd2f,0x170));var _0xfdd2=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xdd2f[_0x28947d];return _0x12d2ee;};'use strict';var _=require('lodash');var util=require(_0xfdd2('0x0'));var moment=require(_0xfdd2('0x1'));var BPromise=require(_0xfdd2('0x2'));var rs=require(_0xfdd2('0x3'));var fs=require('fs');var Redis=require(_0xfdd2('0x4'));var db=require(_0xfdd2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfdd2('0x6'))(_0xfdd2('0x7'));var config=require(_0xfdd2('0x8'));var jayson=require(_0xfdd2('0x9'));var client=jayson['client'][_0xfdd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ae5dc,_0x2d55e5,_0x21b301){return new BPromise(function(_0x27b921,_0x66f09e){return client[_0xfdd2('0xb')](_0x1ae5dc,_0x21b301)[_0xfdd2('0xc')](function(_0x1753c7){logger[_0xfdd2('0xd')](_0xfdd2('0xe'),_0x2d55e5,'request\x20sent');logger[_0xfdd2('0xf')](_0xfdd2('0x10'),_0x2d55e5,_0xfdd2('0x11'),JSON[_0xfdd2('0x12')](_0x1753c7));if(_0x1753c7[_0xfdd2('0x13')]){if(_0x1753c7[_0xfdd2('0x13')]['code']===0x1f4){logger['error'](_0xfdd2('0xe'),_0x2d55e5,_0x1753c7['error'][_0xfdd2('0x14')]);return _0x66f09e(_0x1753c7[_0xfdd2('0x13')][_0xfdd2('0x14')]);}logger[_0xfdd2('0x13')](_0xfdd2('0xe'),_0x2d55e5,_0x1753c7['error'][_0xfdd2('0x14')]);return _0x27b921(_0x1753c7[_0xfdd2('0x13')]['message']);}else{logger['info'](_0xfdd2('0xe'),_0x2d55e5,_0xfdd2('0x11'));_0x27b921(_0x1753c7[_0xfdd2('0x15')][_0xfdd2('0x14')]);}})[_0xfdd2('0x16')](function(_0x27711c){logger['error'](_0xfdd2('0xe'),_0x2d55e5,_0x27711c);_0x66f09e(_0x27711c);});});}exports[_0xfdd2('0x17')]=function(_0x5d3b6e){var _0x42d100=this;return new Promise(function(_0x5314ee,_0x251fbf){return db[_0xfdd2('0x18')][_0xfdd2('0x19')]({'raw':_0x5d3b6e[_0xfdd2('0x1a')]?_0x5d3b6e[_0xfdd2('0x1a')][_0xfdd2('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d3b6e[_0xfdd2('0x1a')]?_0x5d3b6e[_0xfdd2('0x1a')][_0xfdd2('0x1c')]||null:null,'attributes':_0x5d3b6e[_0xfdd2('0x1a')]?_0x5d3b6e[_0xfdd2('0x1a')][_0xfdd2('0x1d')]||null:null,'limit':_0x5d3b6e[_0xfdd2('0x1a')]?_0x5d3b6e[_0xfdd2('0x1a')][_0xfdd2('0x1e')]||null:null,'include':_0x5d3b6e[_0xfdd2('0x1a')]?_0x5d3b6e[_0xfdd2('0x1a')]['include']?_[_0xfdd2('0x1f')](_0x5d3b6e[_0xfdd2('0x1a')][_0xfdd2('0x20')],function(_0x1f4123){return{'model':db[_0x1f4123[_0xfdd2('0x21')]],'as':_0x1f4123['as'],'attributes':_0x1f4123[_0xfdd2('0x1d')],'include':_0x1f4123['include']?_[_0xfdd2('0x1f')](_0x1f4123[_0xfdd2('0x20')],function(_0x38fd26){return{'model':db[_0x38fd26[_0xfdd2('0x21')]],'as':_0x38fd26['as'],'attributes':_0x38fd26[_0xfdd2('0x1d')],'include':_0x38fd26['include']?_[_0xfdd2('0x1f')](_0x38fd26[_0xfdd2('0x20')],function(_0xcf9e2f){return{'model':db[_0xcf9e2f[_0xfdd2('0x21')]],'as':_0xcf9e2f['as'],'attributes':_0xcf9e2f[_0xfdd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfdd2('0xc')](function(_0x1a0999){logger[_0xfdd2('0xd')](_0xfdd2('0x17'),_0x5d3b6e);logger['debug']('GetVtigerAccount',_0x5d3b6e,JSON['stringify'](_0x1a0999));_0x5314ee(_0x1a0999);})[_0xfdd2('0x16')](function(_0x1b4f3e){logger['error']('GetVtigerAccount',_0x1b4f3e[_0xfdd2('0x14')],_0x5d3b6e);_0x251fbf(_0x42d100[_0xfdd2('0x13')](0x1f4,_0x1b4f3e[_0xfdd2('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x3ce2f7){var _0x11329e=this;return new Promise(function(_0x275103,_0x31f704){return db[_0xfdd2('0x18')][_0xfdd2('0x22')]({'raw':_0x3ce2f7['options']?_0x3ce2f7[_0xfdd2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3ce2f7[_0xfdd2('0x1a')]?_0x3ce2f7[_0xfdd2('0x1a')][_0xfdd2('0x1c')]||null:null,'attributes':_0x3ce2f7[_0xfdd2('0x1a')]?_0x3ce2f7[_0xfdd2('0x1a')][_0xfdd2('0x1d')]||null:null,'include':_0x3ce2f7['options']?_0x3ce2f7['options'][_0xfdd2('0x20')]?_[_0xfdd2('0x1f')](_0x3ce2f7['options'][_0xfdd2('0x20')],function(_0x59462d){return{'model':db[_0x59462d['model']],'as':_0x59462d['as'],'attributes':_0x59462d[_0xfdd2('0x1d')],'include':_0x59462d[_0xfdd2('0x20')]?_[_0xfdd2('0x1f')](_0x59462d[_0xfdd2('0x20')],function(_0x71df54){return{'model':db[_0x71df54['model']],'as':_0x71df54['as'],'attributes':_0x71df54[_0xfdd2('0x1d')],'include':_0x71df54[_0xfdd2('0x20')]?_['map'](_0x71df54[_0xfdd2('0x20')],function(_0x5ad69a){return{'model':db[_0x5ad69a['model']],'as':_0x5ad69a['as'],'attributes':_0x5ad69a[_0xfdd2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfdd2('0xc')](function(_0x43b1e0){logger[_0xfdd2('0xd')]('ShowVtigerAccount',_0x3ce2f7);logger[_0xfdd2('0xf')](_0xfdd2('0x23'),_0x3ce2f7,JSON[_0xfdd2('0x12')](_0x43b1e0));_0x275103(_0x43b1e0);})['catch'](function(_0x1dcbec){logger[_0xfdd2('0x13')](_0xfdd2('0x23'),_0x1dcbec[_0xfdd2('0x14')],_0x3ce2f7);_0x31f704(_0x11329e[_0xfdd2('0x13')](0x1f4,_0x1dcbec[_0xfdd2('0x14')]));});});}; \ No newline at end of file +var _0xa25c=['limit','include','attributes','map','model','then','ShowVtigerAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where'];(function(_0x2087f2,_0x51594b){var _0x3a9f94=function(_0x7132d9){while(--_0x7132d9){_0x2087f2['push'](_0x2087f2['shift']());}};_0x3a9f94(++_0x51594b);}(_0xa25c,0x74));var _0xca25=function(_0x4d7707,_0x9784ca){_0x4d7707=_0x4d7707-0x0;var _0x5d3421=_0xa25c[_0x4d7707];return _0x5d3421;};'use strict';var _=require(_0xca25('0x0'));var util=require(_0xca25('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca25('0x2'));var fs=require('fs');var Redis=require(_0xca25('0x3'));var db=require(_0xca25('0x4'))['db'];var utils=require(_0xca25('0x5'));var logger=require(_0xca25('0x6'))(_0xca25('0x7'));var config=require('../../config/environment');var jayson=require(_0xca25('0x8'));var client=jayson[_0xca25('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24e323,_0x4c90cf,_0x3f6eac){return new BPromise(function(_0x1fef20,_0x1ff979){return client[_0xca25('0xa')](_0x24e323,_0x3f6eac)['then'](function(_0x52a838){logger[_0xca25('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x4c90cf,'request\x20sent');logger[_0xca25('0xc')](_0xca25('0xd'),_0x4c90cf,_0xca25('0xe'),JSON[_0xca25('0xf')](_0x52a838));if(_0x52a838['error']){if(_0x52a838[_0xca25('0x10')][_0xca25('0x11')]===0x1f4){logger[_0xca25('0x10')](_0xca25('0x12'),_0x4c90cf,_0x52a838[_0xca25('0x10')][_0xca25('0x13')]);return _0x1ff979(_0x52a838[_0xca25('0x10')][_0xca25('0x13')]);}logger[_0xca25('0x10')](_0xca25('0x12'),_0x4c90cf,_0x52a838['error'][_0xca25('0x13')]);return _0x1fef20(_0x52a838[_0xca25('0x10')][_0xca25('0x13')]);}else{logger[_0xca25('0xb')](_0xca25('0x12'),_0x4c90cf,'request\x20sent');_0x1fef20(_0x52a838[_0xca25('0x14')][_0xca25('0x13')]);}})[_0xca25('0x15')](function(_0x174dd3){logger[_0xca25('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x4c90cf,_0x174dd3);_0x1ff979(_0x174dd3);});});}exports[_0xca25('0x16')]=function(_0xfb433c){var _0x386fed=this;return new Promise(function(_0x27c09b,_0x5d19ea){return db[_0xca25('0x17')][_0xca25('0x18')]({'raw':_0xfb433c[_0xca25('0x19')]?_0xfb433c[_0xca25('0x19')][_0xca25('0x1a')]===undefined?!![]:![]:!![],'where':_0xfb433c[_0xca25('0x19')]?_0xfb433c[_0xca25('0x19')][_0xca25('0x1b')]||null:null,'attributes':_0xfb433c['options']?_0xfb433c[_0xca25('0x19')]['attributes']||null:null,'limit':_0xfb433c[_0xca25('0x19')]?_0xfb433c[_0xca25('0x19')][_0xca25('0x1c')]||null:null,'include':_0xfb433c['options']?_0xfb433c[_0xca25('0x19')][_0xca25('0x1d')]?_['map'](_0xfb433c[_0xca25('0x19')][_0xca25('0x1d')],function(_0x375dd3){return{'model':db[_0x375dd3['model']],'as':_0x375dd3['as'],'attributes':_0x375dd3[_0xca25('0x1e')],'include':_0x375dd3[_0xca25('0x1d')]?_[_0xca25('0x1f')](_0x375dd3[_0xca25('0x1d')],function(_0x508fab){return{'model':db[_0x508fab[_0xca25('0x20')]],'as':_0x508fab['as'],'attributes':_0x508fab[_0xca25('0x1e')],'include':_0x508fab[_0xca25('0x1d')]?_[_0xca25('0x1f')](_0x508fab[_0xca25('0x1d')],function(_0xcd2d77){return{'model':db[_0xcd2d77['model']],'as':_0xcd2d77['as'],'attributes':_0xcd2d77[_0xca25('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xca25('0x21')](function(_0x1d724e){logger[_0xca25('0xb')](_0xca25('0x16'),_0xfb433c);logger[_0xca25('0xc')](_0xca25('0x16'),_0xfb433c,JSON[_0xca25('0xf')](_0x1d724e));_0x27c09b(_0x1d724e);})[_0xca25('0x15')](function(_0x41fde6){logger[_0xca25('0x10')](_0xca25('0x16'),_0x41fde6[_0xca25('0x13')],_0xfb433c);_0x5d19ea(_0x386fed[_0xca25('0x10')](0x1f4,_0x41fde6[_0xca25('0x13')]));});});};exports[_0xca25('0x22')]=function(_0x2778f9){var _0x4bbd5a=this;return new Promise(function(_0x179272,_0x42d2ab){return db[_0xca25('0x17')][_0xca25('0x23')]({'raw':_0x2778f9['options']?_0x2778f9['options'][_0xca25('0x1a')]===undefined?!![]:![]:!![],'where':_0x2778f9[_0xca25('0x19')]?_0x2778f9['options'][_0xca25('0x1b')]||null:null,'attributes':_0x2778f9[_0xca25('0x19')]?_0x2778f9[_0xca25('0x19')]['attributes']||null:null,'include':_0x2778f9[_0xca25('0x19')]?_0x2778f9['options'][_0xca25('0x1d')]?_[_0xca25('0x1f')](_0x2778f9[_0xca25('0x19')][_0xca25('0x1d')],function(_0x1eea9a){return{'model':db[_0x1eea9a[_0xca25('0x20')]],'as':_0x1eea9a['as'],'attributes':_0x1eea9a[_0xca25('0x1e')],'include':_0x1eea9a[_0xca25('0x1d')]?_[_0xca25('0x1f')](_0x1eea9a[_0xca25('0x1d')],function(_0x1f7f73){return{'model':db[_0x1f7f73[_0xca25('0x20')]],'as':_0x1f7f73['as'],'attributes':_0x1f7f73['attributes'],'include':_0x1f7f73[_0xca25('0x1d')]?_['map'](_0x1f7f73[_0xca25('0x1d')],function(_0x2f9a69){return{'model':db[_0x2f9a69['model']],'as':_0x2f9a69['as'],'attributes':_0x2f9a69['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x349e31){logger[_0xca25('0xb')]('ShowVtigerAccount',_0x2778f9);logger[_0xca25('0xc')](_0xca25('0x22'),_0x2778f9,JSON[_0xca25('0xf')](_0x349e31));_0x179272(_0x349e31);})['catch'](function(_0x5dfcfb){logger[_0xca25('0x10')]('ShowVtigerAccount',_0x5dfcfb[_0xca25('0x13')],_0x2778f9);_0x42d2ab(_0x4bbd5a[_0xca25('0x10')](0x1f4,_0x5dfcfb[_0xca25('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0859a42..ba9e1d0 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(_0x5c7206,_0x28e441){var _0x5def43=function(_0x183963){while(--_0x183963){_0x5c7206['push'](_0x5c7206['shift']());}};_0x5def43(++_0x28e441);}(_0xb10b,0x12a));var _0xbb10=function(_0x381cd5,_0x1f66dd){_0x381cd5=_0x381cd5-0x0;var _0x14b162=_0xb10b[_0x381cd5];return _0x14b162;};'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(_0x22a83d,_0x2638c9){var _0xf01ef7=function(_0x50f0b){while(--_0x50f0b){_0x22a83d['push'](_0x22a83d['shift']());}};_0xf01ef7(++_0x2638c9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x19f9b4,_0x1798c5){_0x19f9b4=_0x19f9b4-0x0;var _0x2c535b=_0x5f2f[_0x19f9b4];return _0x2c535b;};'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 d045f92..c58b900 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 _0x5d9f=['exports','STRING'];(function(_0x531a96,_0xe17bf4){var _0x180978=function(_0x52fbc7){while(--_0x52fbc7){_0x531a96['push'](_0x531a96['shift']());}};_0x180978(++_0xe17bf4);}(_0x5d9f,0x152));var _0xf5d9=function(_0x3855aa,_0x800a2f){_0x3855aa=_0x3855aa-0x0;var _0xffac73=_0x5d9f[_0x3855aa];return _0xffac73;};'use strict';var Sequelize=require('sequelize');module[_0xf5d9('0x0')]={'name':{'type':Sequelize[_0xf5d9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a45=['exports','STRING','sequelize'];(function(_0xb7aa6a,_0x459c91){var _0x4c4060=function(_0x13411b){while(--_0x13411b){_0xb7aa6a['push'](_0xb7aa6a['shift']());}};_0x4c4060(++_0x459c91);}(_0x9a45,0x68));var _0x59a4=function(_0x57d5b7,_0x41f875){_0x57d5b7=_0x57d5b7-0x0;var _0x2ffda2=_0x9a45[_0x57d5b7];return _0x2ffda2;};'use strict';var Sequelize=require(_0x59a4('0x0'));module[_0x59a4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x59a4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index f5bfaf8..9428ed6 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 _0xfc82=['message','result','catch','status','end','json','count','offset','limit','set','reject','destroy','sendStatus','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','include','rows','params','find','create','body','update','getFields','findOne','VtigerField','options','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x221cba,_0x5ba454){var _0x6d925d=function(_0xc05240){while(--_0xc05240){_0x221cba['push'](_0x221cba['shift']());}};_0x6d925d(++_0x5ba454);}(_0xfc82,0xe9));var _0x2fc8=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xfc82[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x2fc8('0x0'));var emlformat=require(_0x2fc8('0x1'));var rimraf=require(_0x2fc8('0x2'));var zipdir=require(_0x2fc8('0x3'));var jsonpatch=require(_0x2fc8('0x4'));var rp=require(_0x2fc8('0x5'));var moment=require(_0x2fc8('0x6'));var BPromise=require(_0x2fc8('0x7'));var Mustache=require(_0x2fc8('0x8'));var util=require('util');var path=require(_0x2fc8('0x9'));var sox=require('sox');var csv=require(_0x2fc8('0xa'));var ejs=require(_0x2fc8('0xb'));var fs=require('fs');var _=require(_0x2fc8('0xc'));var squel=require(_0x2fc8('0xd'));var crypto=require(_0x2fc8('0xe'));var jsforce=require(_0x2fc8('0xf'));var deskjs=require(_0x2fc8('0x10'));var toCsv=require(_0x2fc8('0xa'));var querystring=require(_0x2fc8('0x11'));var Papa=require('papaparse');var Redis=require(_0x2fc8('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2fc8('0x13'));var hardwareService=require(_0x2fc8('0x14'));var logger=require(_0x2fc8('0x15'))(_0x2fc8('0x16'));var utils=require(_0x2fc8('0x17'));var config=require(_0x2fc8('0x18'));var db=require(_0x2fc8('0x19'))['db'];var jayson=require(_0x2fc8('0x1a'));var client=jayson['client'][_0x2fc8('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x2cacee,_0x47d58f,_0x1ba325){if(_0x1ba325){var _0x306bb0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x306bb0[_0x2fc8('0x1c')](_0x47d58f)){return _0x2cacee;}else{throw new db[(_0x2fc8('0x1d'))][(_0x2fc8('0x1e'))](_0x2fc8('0x1f'));}}else{return _0x2cacee;}}function respondWithRpcPromise(_0x219d83,_0x262a9a,_0x22f359,_0x2a46a1){return new BPromise(function(_0x9c5b87,_0x12b342){var _0x17c9fa=_0x2a46a1||client;return _0x17c9fa[_0x2fc8('0x20')](_0x219d83,_0x22f359)[_0x2fc8('0x21')](function(_0x44ab64){logger[_0x2fc8('0x22')](_0x2fc8('0x23'),_0x262a9a,_0x2fc8('0x24'));logger['debug']('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x262a9a,'request\x20sent',JSON[_0x2fc8('0x25')](_0x44ab64));if(_0x44ab64[_0x2fc8('0x26')]){if(_0x44ab64[_0x2fc8('0x26')][_0x2fc8('0x27')]===0x1f4){logger['error'](_0x2fc8('0x23'),_0x262a9a,_0x44ab64[_0x2fc8('0x26')][_0x2fc8('0x28')]);return _0x12b342(_0x44ab64[_0x2fc8('0x26')][_0x2fc8('0x28')]);}logger['error'](_0x2fc8('0x23'),_0x262a9a,_0x44ab64[_0x2fc8('0x26')]['message']);return _0x9c5b87(_0x44ab64[_0x2fc8('0x26')][_0x2fc8('0x28')]);}else{logger['info'](_0x2fc8('0x23'),_0x262a9a,_0x2fc8('0x24'));_0x9c5b87(_0x44ab64[_0x2fc8('0x29')][_0x2fc8('0x28')]);}})[_0x2fc8('0x2a')](function(_0x356876){logger[_0x2fc8('0x26')](_0x2fc8('0x23'),_0x262a9a,_0x356876);_0x12b342(_0x356876);});});}function respondWithStatusCode(_0x5c5d2e,_0x1f8773){_0x1f8773=_0x1f8773||0xcc;return function(_0x5f0fd9){if(_0x5f0fd9){return _0x5c5d2e['sendStatus'](_0x1f8773);}return _0x5c5d2e[_0x2fc8('0x2b')](_0x1f8773)[_0x2fc8('0x2c')]();};}function respondWithResult(_0x33b6c3,_0x4aa1cd){_0x4aa1cd=_0x4aa1cd||0xc8;return function(_0x1cbbf8){if(_0x1cbbf8){return _0x33b6c3['status'](_0x4aa1cd)[_0x2fc8('0x2d')](_0x1cbbf8);}};}function respondWithFilteredResult(_0x5863a6,_0x144876){return function(_0x4aa224){if(_0x4aa224){var _0x14e347=_0x4aa224[_0x2fc8('0x2e')],_0x28a116=_0x144876[_0x2fc8('0x2f')],_0x53a404=_0x144876[_0x2fc8('0x2f')]+_0x144876[_0x2fc8('0x30')],_0x300068;if(_0x53a404>=_0x14e347){_0x53a404=_0x14e347;_0x300068=0xc8;}else{_0x300068=0xce;}_0x5863a6['status'](_0x300068);return _0x5863a6[_0x2fc8('0x31')]('Content-Range',_0x28a116+'-'+_0x53a404+'/'+_0x14e347)[_0x2fc8('0x2d')](_0x4aa224);}return null;};}function patchUpdates(_0x1eb703){return function(_0x23d8f7){try{jsonpatch['apply'](_0x23d8f7,_0x1eb703,!![]);}catch(_0x127815){return BPromise[_0x2fc8('0x32')](_0x127815);}return _0x23d8f7['save']();};}function saveUpdates(_0x35749d,_0x43bfc3){return function(_0x52f7ac){if(_0x52f7ac){return _0x52f7ac['update'](_0x35749d)[_0x2fc8('0x21')](function(_0x25b6ba){return _0x25b6ba;});}return null;};}function removeEntity(_0x3bb795,_0x34a417){return function(_0x9e3bbb){if(_0x9e3bbb){return _0x9e3bbb[_0x2fc8('0x33')]()['then'](function(){_0x3bb795[_0x2fc8('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2921cd,_0x2fc254){return function(_0x4c5479){if(!_0x4c5479){_0x2921cd[_0x2fc8('0x34')](0x194);}return _0x4c5479;};}function handleError(_0x96d8d,_0x58d426){_0x58d426=_0x58d426||0x1f4;return function(_0x1339a5){logger['error'](_0x1339a5[_0x2fc8('0x35')]);if(_0x1339a5[_0x2fc8('0x36')]){delete _0x1339a5[_0x2fc8('0x36')];}_0x96d8d[_0x2fc8('0x2b')](_0x58d426)[_0x2fc8('0x37')](_0x1339a5);};}exports['index']=function(_0x37c96b,_0x35500a){var _0x3e6a05={},_0x68bd7a={},_0x340725={'count':0x0,'rows':[]};var _0x2d2101=_['map'](db[_0x2fc8('0x38')][_0x2fc8('0x39')],function(_0x33972d){return{'name':_0x33972d[_0x2fc8('0x3a')],'type':_0x33972d[_0x2fc8('0x3b')][_0x2fc8('0x3c')]};});_0x68bd7a[_0x2fc8('0x3d')]=_['map'](_0x2d2101,_0x2fc8('0x36'));_0x68bd7a['query']=_[_0x2fc8('0x3e')](_0x37c96b['query']);_0x68bd7a[_0x2fc8('0x3f')]=_[_0x2fc8('0x40')](_0x68bd7a[_0x2fc8('0x3d')],_0x68bd7a[_0x2fc8('0x41')]);_0x3e6a05[_0x2fc8('0x42')]=_[_0x2fc8('0x40')](_0x68bd7a[_0x2fc8('0x3d')],qs[_0x2fc8('0x43')](_0x37c96b[_0x2fc8('0x41')][_0x2fc8('0x43')]));_0x3e6a05[_0x2fc8('0x42')]=_0x3e6a05[_0x2fc8('0x42')][_0x2fc8('0x44')]?_0x3e6a05['attributes']:_0x68bd7a['model'];if(!_0x37c96b[_0x2fc8('0x41')]['hasOwnProperty'](_0x2fc8('0x45'))){_0x3e6a05[_0x2fc8('0x30')]=qs[_0x2fc8('0x30')](_0x37c96b[_0x2fc8('0x41')]['limit']);_0x3e6a05[_0x2fc8('0x2f')]=qs['offset'](_0x37c96b['query'][_0x2fc8('0x2f')]);}_0x3e6a05[_0x2fc8('0x46')]=qs[_0x2fc8('0x47')](_0x37c96b[_0x2fc8('0x41')][_0x2fc8('0x47')]);_0x3e6a05[_0x2fc8('0x48')]=qs[_0x2fc8('0x3f')](_[_0x2fc8('0x49')](_0x37c96b[_0x2fc8('0x41')],_0x68bd7a[_0x2fc8('0x3f')]),_0x2d2101);if(_0x37c96b[_0x2fc8('0x41')][_0x2fc8('0x4a')]){_0x3e6a05[_0x2fc8('0x48')]=_[_0x2fc8('0x4b')](_0x3e6a05[_0x2fc8('0x48')],{'$or':_[_0x2fc8('0x4c')](_0x2d2101,function(_0x4e3f04){if(_0x4e3f04[_0x2fc8('0x3b')]!=='VIRTUAL'){var _0xce88fd={};_0xce88fd[_0x4e3f04[_0x2fc8('0x36')]]={'$like':'%'+_0x37c96b['query'][_0x2fc8('0x4a')]+'%'};return _0xce88fd;}})});}_0x3e6a05=_[_0x2fc8('0x4b')]({},_0x3e6a05,_0x37c96b['options']);var _0x3605a3={'where':_0x3e6a05[_0x2fc8('0x48')]};return db[_0x2fc8('0x38')][_0x2fc8('0x2e')](_0x3605a3)[_0x2fc8('0x21')](function(_0x27b38c){_0x340725[_0x2fc8('0x2e')]=_0x27b38c;if(_0x37c96b['query']['includeAll']){_0x3e6a05[_0x2fc8('0x4d')]=[{'all':!![]}];}return db[_0x2fc8('0x38')]['findAll'](_0x3e6a05);})[_0x2fc8('0x21')](function(_0x27e415){_0x340725[_0x2fc8('0x4e')]=_0x27e415;return _0x340725;})[_0x2fc8('0x21')](respondWithFilteredResult(_0x35500a,_0x3e6a05))[_0x2fc8('0x2a')](handleError(_0x35500a,null));};exports['show']=function(_0x347f79,_0x45d1be){var _0x4847ad={'raw':![],'where':{'id':_0x347f79[_0x2fc8('0x4f')]['id']}},_0x4375f9={};_0x4375f9[_0x2fc8('0x3d')]=_['keys'](db[_0x2fc8('0x38')][_0x2fc8('0x39')]);_0x4375f9[_0x2fc8('0x41')]=_[_0x2fc8('0x3e')](_0x347f79[_0x2fc8('0x41')]);_0x4375f9[_0x2fc8('0x3f')]=_['intersection'](_0x4375f9[_0x2fc8('0x3d')],_0x4375f9[_0x2fc8('0x41')]);_0x4847ad[_0x2fc8('0x42')]=_[_0x2fc8('0x40')](_0x4375f9['model'],qs[_0x2fc8('0x43')](_0x347f79[_0x2fc8('0x41')][_0x2fc8('0x43')]));_0x4847ad[_0x2fc8('0x42')]=_0x4847ad[_0x2fc8('0x42')][_0x2fc8('0x44')]?_0x4847ad['attributes']:_0x4375f9[_0x2fc8('0x3d')];if(_0x347f79[_0x2fc8('0x41')]['includeAll']){_0x4847ad[_0x2fc8('0x4d')]=[{'all':!![]}];}_0x4847ad=_[_0x2fc8('0x4b')]({},_0x4847ad,_0x347f79['options']);return db[_0x2fc8('0x38')][_0x2fc8('0x50')](_0x4847ad)[_0x2fc8('0x21')](handleEntityNotFound(_0x45d1be,null))[_0x2fc8('0x21')](respondWithResult(_0x45d1be,null))[_0x2fc8('0x2a')](handleError(_0x45d1be,null));};exports[_0x2fc8('0x51')]=function(_0x53e83c,_0x252c51){return db[_0x2fc8('0x38')][_0x2fc8('0x51')](_0x53e83c[_0x2fc8('0x52')],{})['then'](respondWithResult(_0x252c51,0xc9))[_0x2fc8('0x2a')](handleError(_0x252c51,null));};exports[_0x2fc8('0x53')]=function(_0x50114f,_0x2b6b3b){if(_0x50114f[_0x2fc8('0x52')]['id']){delete _0x50114f[_0x2fc8('0x52')]['id'];}return db[_0x2fc8('0x38')][_0x2fc8('0x50')]({'where':{'id':_0x50114f['params']['id']}})[_0x2fc8('0x21')](handleEntityNotFound(_0x2b6b3b,null))[_0x2fc8('0x21')](saveUpdates(_0x50114f['body'],null))[_0x2fc8('0x21')](respondWithResult(_0x2b6b3b,null))[_0x2fc8('0x2a')](handleError(_0x2b6b3b,null));};exports['destroy']=function(_0x12a9c3,_0x387e08){return db['VtigerConfiguration'][_0x2fc8('0x50')]({'where':{'id':_0x12a9c3[_0x2fc8('0x4f')]['id']}})[_0x2fc8('0x21')](handleEntityNotFound(_0x387e08,null))[_0x2fc8('0x21')](removeEntity(_0x387e08,null))[_0x2fc8('0x2a')](handleError(_0x387e08,null));};exports[_0x2fc8('0x54')]=function(_0x3fffa3,_0x1c7f1c,_0x1a052d){var _0x3b275f={};var _0xedf58f={};var _0x5288d8;var _0x3c6a01;return db['VtigerConfiguration'][_0x2fc8('0x55')]({'where':{'id':_0x3fffa3[_0x2fc8('0x4f')]['id']}})[_0x2fc8('0x21')](handleEntityNotFound(_0x1c7f1c,null))[_0x2fc8('0x21')](function(_0x4f9bcd){if(_0x4f9bcd){_0x5288d8=_0x4f9bcd;_0xedf58f['model']=_[_0x2fc8('0x3e')](db[_0x2fc8('0x56')][_0x2fc8('0x39')]);_0xedf58f[_0x2fc8('0x41')]=_['keys'](_0x3fffa3[_0x2fc8('0x41')]);_0xedf58f[_0x2fc8('0x3f')]=_['intersection'](_0xedf58f[_0x2fc8('0x3d')],_0xedf58f[_0x2fc8('0x41')]);_0x3b275f['attributes']=_[_0x2fc8('0x40')](_0xedf58f[_0x2fc8('0x3d')],qs[_0x2fc8('0x43')](_0x3fffa3[_0x2fc8('0x41')][_0x2fc8('0x43')]));_0x3b275f[_0x2fc8('0x42')]=_0x3b275f[_0x2fc8('0x42')]['length']?_0x3b275f[_0x2fc8('0x42')]:_0xedf58f['model'];_0x3b275f[_0x2fc8('0x46')]=qs[_0x2fc8('0x47')](_0x3fffa3[_0x2fc8('0x41')][_0x2fc8('0x47')]);_0x3b275f[_0x2fc8('0x48')]=qs[_0x2fc8('0x3f')](_[_0x2fc8('0x49')](_0x3fffa3[_0x2fc8('0x41')],_0xedf58f[_0x2fc8('0x3f')]));if(_0x3fffa3[_0x2fc8('0x41')]['filter']){_0x3b275f[_0x2fc8('0x48')]=_['merge'](_0x3b275f[_0x2fc8('0x48')],{'$or':_[_0x2fc8('0x4c')](_0x3b275f[_0x2fc8('0x42')],function(_0x4cfdf4){var _0x436f1d={};_0x436f1d[_0x4cfdf4]={'$like':'%'+_0x3fffa3[_0x2fc8('0x41')][_0x2fc8('0x4a')]+'%'};return _0x436f1d;})});}_0x3b275f=_['merge']({},_0x3b275f,_0x3fffa3[_0x2fc8('0x57')]);return _0x5288d8[_0x2fc8('0x54')](_0x3b275f);}})['then'](function(_0x4f4b8e){if(_0x4f4b8e){_0x3c6a01=_0x4f4b8e['length'];if(!_0x3fffa3[_0x2fc8('0x41')][_0x2fc8('0x58')](_0x2fc8('0x45'))){_0x3b275f[_0x2fc8('0x30')]=qs[_0x2fc8('0x30')](_0x3fffa3[_0x2fc8('0x41')][_0x2fc8('0x30')]);_0x3b275f[_0x2fc8('0x2f')]=qs['offset'](_0x3fffa3[_0x2fc8('0x41')][_0x2fc8('0x2f')]);}return _0x5288d8[_0x2fc8('0x54')](_0x3b275f);}})['then'](function(_0x3070d2){if(_0x3070d2){return _0x3070d2?{'count':_0x3c6a01,'rows':_0x3070d2}:null;}})['then'](respondWithResult(_0x1c7f1c,null))[_0x2fc8('0x2a')](handleError(_0x1c7f1c,null));};exports[_0x2fc8('0x59')]=function(_0x12e680,_0x2633ef,_0x2b07ad){var _0x10bb5c={};var _0x1e517d={};var _0x4b9bfe;var _0x39ad0b;return db[_0x2fc8('0x38')][_0x2fc8('0x55')]({'where':{'id':_0x12e680[_0x2fc8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2633ef,null))['then'](function(_0x4fd976){if(_0x4fd976){_0x4b9bfe=_0x4fd976;_0x1e517d['model']=_[_0x2fc8('0x3e')](db[_0x2fc8('0x56')][_0x2fc8('0x39')]);_0x1e517d['query']=_[_0x2fc8('0x3e')](_0x12e680['query']);_0x1e517d[_0x2fc8('0x3f')]=_['intersection'](_0x1e517d[_0x2fc8('0x3d')],_0x1e517d[_0x2fc8('0x41')]);_0x10bb5c[_0x2fc8('0x42')]=_[_0x2fc8('0x40')](_0x1e517d[_0x2fc8('0x3d')],qs[_0x2fc8('0x43')](_0x12e680['query'][_0x2fc8('0x43')]));_0x10bb5c['attributes']=_0x10bb5c[_0x2fc8('0x42')]['length']?_0x10bb5c[_0x2fc8('0x42')]:_0x1e517d['model'];_0x10bb5c[_0x2fc8('0x46')]=qs[_0x2fc8('0x47')](_0x12e680[_0x2fc8('0x41')][_0x2fc8('0x47')]);_0x10bb5c[_0x2fc8('0x48')]=qs[_0x2fc8('0x3f')](_[_0x2fc8('0x49')](_0x12e680['query'],_0x1e517d['filters']));if(_0x12e680['query'][_0x2fc8('0x4a')]){_0x10bb5c[_0x2fc8('0x48')]=_['merge'](_0x10bb5c[_0x2fc8('0x48')],{'$or':_[_0x2fc8('0x4c')](_0x10bb5c[_0x2fc8('0x42')],function(_0x2de33b){var _0x623265={};_0x623265[_0x2de33b]={'$like':'%'+_0x12e680[_0x2fc8('0x41')]['filter']+'%'};return _0x623265;})});}_0x10bb5c=_[_0x2fc8('0x4b')]({},_0x10bb5c,_0x12e680[_0x2fc8('0x57')]);return _0x4b9bfe[_0x2fc8('0x59')](_0x10bb5c);}})['then'](function(_0x26bc12){if(_0x26bc12){_0x39ad0b=_0x26bc12[_0x2fc8('0x44')];if(!_0x12e680['query'][_0x2fc8('0x58')](_0x2fc8('0x45'))){_0x10bb5c[_0x2fc8('0x30')]=qs[_0x2fc8('0x30')](_0x12e680['query'][_0x2fc8('0x30')]);_0x10bb5c[_0x2fc8('0x2f')]=qs['offset'](_0x12e680[_0x2fc8('0x41')][_0x2fc8('0x2f')]);}return _0x4b9bfe[_0x2fc8('0x59')](_0x10bb5c);}})[_0x2fc8('0x21')](function(_0x40dd43){if(_0x40dd43){return _0x40dd43?{'count':_0x39ad0b,'rows':_0x40dd43}:null;}})[_0x2fc8('0x21')](respondWithResult(_0x2633ef,null))[_0x2fc8('0x2a')](handleError(_0x2633ef,null));};exports['getDescriptions']=function(_0x3e26de,_0x946190,_0x30e5f5){var _0x2c3a95={};var _0x54bd62={};var _0xa7661b;var _0x4e12e0;return db[_0x2fc8('0x38')][_0x2fc8('0x55')]({'where':{'id':_0x3e26de[_0x2fc8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x946190,null))['then'](function(_0x5ec3ef){if(_0x5ec3ef){_0xa7661b=_0x5ec3ef;_0x54bd62[_0x2fc8('0x3d')]=_[_0x2fc8('0x3e')](db[_0x2fc8('0x56')][_0x2fc8('0x39')]);_0x54bd62[_0x2fc8('0x41')]=_[_0x2fc8('0x3e')](_0x3e26de[_0x2fc8('0x41')]);_0x54bd62[_0x2fc8('0x3f')]=_[_0x2fc8('0x40')](_0x54bd62[_0x2fc8('0x3d')],_0x54bd62[_0x2fc8('0x41')]);_0x2c3a95[_0x2fc8('0x42')]=_[_0x2fc8('0x40')](_0x54bd62[_0x2fc8('0x3d')],qs['fields'](_0x3e26de['query'][_0x2fc8('0x43')]));_0x2c3a95[_0x2fc8('0x42')]=_0x2c3a95['attributes'][_0x2fc8('0x44')]?_0x2c3a95[_0x2fc8('0x42')]:_0x54bd62[_0x2fc8('0x3d')];_0x2c3a95['order']=qs[_0x2fc8('0x47')](_0x3e26de[_0x2fc8('0x41')][_0x2fc8('0x47')]);_0x2c3a95['where']=qs[_0x2fc8('0x3f')](_['pick'](_0x3e26de[_0x2fc8('0x41')],_0x54bd62['filters']));if(_0x3e26de[_0x2fc8('0x41')][_0x2fc8('0x4a')]){_0x2c3a95[_0x2fc8('0x48')]=_['merge'](_0x2c3a95[_0x2fc8('0x48')],{'$or':_['map'](_0x2c3a95[_0x2fc8('0x42')],function(_0x2a7b73){var _0x460ea3={};_0x460ea3[_0x2a7b73]={'$like':'%'+_0x3e26de[_0x2fc8('0x41')]['filter']+'%'};return _0x460ea3;})});}_0x2c3a95=_[_0x2fc8('0x4b')]({},_0x2c3a95,_0x3e26de[_0x2fc8('0x57')]);return _0xa7661b[_0x2fc8('0x5a')](_0x2c3a95);}})[_0x2fc8('0x21')](function(_0x3f2c7a){if(_0x3f2c7a){_0x4e12e0=_0x3f2c7a['length'];if(!_0x3e26de[_0x2fc8('0x41')][_0x2fc8('0x58')]('nolimit')){_0x2c3a95['limit']=qs[_0x2fc8('0x30')](_0x3e26de['query'][_0x2fc8('0x30')]);_0x2c3a95[_0x2fc8('0x2f')]=qs[_0x2fc8('0x2f')](_0x3e26de['query'][_0x2fc8('0x2f')]);}return _0xa7661b[_0x2fc8('0x5a')](_0x2c3a95);}})[_0x2fc8('0x21')](function(_0x290632){if(_0x290632){return _0x290632?{'count':_0x4e12e0,'rows':_0x290632}:null;}})[_0x2fc8('0x21')](respondWithResult(_0x946190,null))[_0x2fc8('0x2a')](handleError(_0x946190,null));}; \ No newline at end of file +var _0x39b8=['include','options','create','body','update','getFields','findOne','getSubjects','VtigerField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','findAll','rows','show','params','keys','includeAll'];(function(_0x1872f1,_0x4138a4){var _0x191d55=function(_0x3fbc83){while(--_0x3fbc83){_0x1872f1['push'](_0x1872f1['shift']());}};_0x191d55(++_0x4138a4);}(_0x39b8,0x65));var _0x839b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x39b8[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x839b('0x0'));var emlformat=require(_0x839b('0x1'));var rimraf=require(_0x839b('0x2'));var zipdir=require(_0x839b('0x3'));var jsonpatch=require(_0x839b('0x4'));var rp=require(_0x839b('0x5'));var moment=require(_0x839b('0x6'));var BPromise=require(_0x839b('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x839b('0x8'));var sox=require('sox');var csv=require(_0x839b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x839b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x839b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x839b('0x9'));var querystring=require(_0x839b('0xc'));var Papa=require('papaparse');var Redis=require(_0x839b('0xd'));var authService=require(_0x839b('0xe'));var qs=require(_0x839b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x839b('0x10'));var logger=require(_0x839b('0x11'))(_0x839b('0x12'));var utils=require('../../config/utils');var config=require(_0x839b('0x13'));var db=require(_0x839b('0x14'))['db'];var jayson=require(_0x839b('0x15'));var client=jayson[_0x839b('0x16')][_0x839b('0x17')]({'port':0x232a});function checkPasswordPattern(_0x283f7b,_0x40d4cf,_0x291f3a){if(_0x291f3a){var _0x1ca9cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ca9cc[_0x839b('0x18')](_0x40d4cf)){return _0x283f7b;}else{throw new db['Sequelize']['ValidationError'](_0x839b('0x19'));}}else{return _0x283f7b;}}function respondWithRpcPromise(_0x3560ec,_0x4e7a3a,_0x4df8c6,_0x2e2ff5){return new BPromise(function(_0x3e8cdf,_0x17cf0c){var _0x1893fe=_0x2e2ff5||client;return _0x1893fe[_0x839b('0x1a')](_0x3560ec,_0x4df8c6)[_0x839b('0x1b')](function(_0x4caca3){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x4e7a3a,_0x839b('0x1c'));logger['debug'](_0x839b('0x1d'),_0x4e7a3a,'request\x20sent',JSON[_0x839b('0x1e')](_0x4caca3));if(_0x4caca3[_0x839b('0x1f')]){if(_0x4caca3[_0x839b('0x1f')][_0x839b('0x20')]===0x1f4){logger['error'](_0x839b('0x21'),_0x4e7a3a,_0x4caca3[_0x839b('0x1f')]['message']);return _0x17cf0c(_0x4caca3['error'][_0x839b('0x22')]);}logger['error'](_0x839b('0x21'),_0x4e7a3a,_0x4caca3[_0x839b('0x1f')][_0x839b('0x22')]);return _0x3e8cdf(_0x4caca3['error']['message']);}else{logger[_0x839b('0x23')](_0x839b('0x21'),_0x4e7a3a,_0x839b('0x1c'));_0x3e8cdf(_0x4caca3[_0x839b('0x24')]['message']);}})[_0x839b('0x25')](function(_0x399eb5){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4e7a3a,_0x399eb5);_0x17cf0c(_0x399eb5);});});}function respondWithStatusCode(_0x5273b2,_0x25d3ac){_0x25d3ac=_0x25d3ac||0xcc;return function(_0x363a2e){if(_0x363a2e){return _0x5273b2[_0x839b('0x26')](_0x25d3ac);}return _0x5273b2[_0x839b('0x27')](_0x25d3ac)[_0x839b('0x28')]();};}function respondWithResult(_0x3543b2,_0x470f6e){_0x470f6e=_0x470f6e||0xc8;return function(_0x4c6d09){if(_0x4c6d09){return _0x3543b2[_0x839b('0x27')](_0x470f6e)[_0x839b('0x29')](_0x4c6d09);}};}function respondWithFilteredResult(_0xee51d5,_0x2de51d){return function(_0x76eb47){if(_0x76eb47){var _0x2357d6=_0x76eb47['count'],_0x27bf48=_0x2de51d[_0x839b('0x2a')],_0x5c9890=_0x2de51d[_0x839b('0x2a')]+_0x2de51d[_0x839b('0x2b')],_0x4b6c69;if(_0x5c9890>=_0x2357d6){_0x5c9890=_0x2357d6;_0x4b6c69=0xc8;}else{_0x4b6c69=0xce;}_0xee51d5[_0x839b('0x27')](_0x4b6c69);return _0xee51d5[_0x839b('0x2c')](_0x839b('0x2d'),_0x27bf48+'-'+_0x5c9890+'/'+_0x2357d6)[_0x839b('0x29')](_0x76eb47);}return null;};}function patchUpdates(_0x5cfffa){return function(_0x2510bb){try{jsonpatch[_0x839b('0x2e')](_0x2510bb,_0x5cfffa,!![]);}catch(_0x3acacb){return BPromise[_0x839b('0x2f')](_0x3acacb);}return _0x2510bb['save']();};}function saveUpdates(_0x16c294,_0x5bf412){return function(_0x360956){if(_0x360956){return _0x360956['update'](_0x16c294)['then'](function(_0x568451){return _0x568451;});}return null;};}function removeEntity(_0x318357,_0x524321){return function(_0x309263){if(_0x309263){return _0x309263[_0x839b('0x30')]()[_0x839b('0x1b')](function(){_0x318357[_0x839b('0x27')](0xcc)[_0x839b('0x28')]();});}};}function handleEntityNotFound(_0x51ee8e,_0x272df9){return function(_0x1080e2){if(!_0x1080e2){_0x51ee8e[_0x839b('0x26')](0x194);}return _0x1080e2;};}function handleError(_0x5379de,_0x45124a){_0x45124a=_0x45124a||0x1f4;return function(_0x44a22a){logger[_0x839b('0x1f')](_0x44a22a[_0x839b('0x31')]);if(_0x44a22a['name']){delete _0x44a22a[_0x839b('0x32')];}_0x5379de['status'](_0x45124a)[_0x839b('0x33')](_0x44a22a);};}exports[_0x839b('0x34')]=function(_0x425089,_0x204a5a){var _0x5e33c0={},_0x51ca4f={},_0x5c4da7={'count':0x0,'rows':[]};var _0x2dbf67=_[_0x839b('0x35')](db[_0x839b('0x36')][_0x839b('0x37')],function(_0x5d375d){return{'name':_0x5d375d[_0x839b('0x38')],'type':_0x5d375d['type']['key']};});_0x51ca4f[_0x839b('0x39')]=_[_0x839b('0x35')](_0x2dbf67,_0x839b('0x32'));_0x51ca4f[_0x839b('0x3a')]=_['keys'](_0x425089[_0x839b('0x3a')]);_0x51ca4f[_0x839b('0x3b')]=_[_0x839b('0x3c')](_0x51ca4f[_0x839b('0x39')],_0x51ca4f['query']);_0x5e33c0[_0x839b('0x3d')]=_[_0x839b('0x3c')](_0x51ca4f[_0x839b('0x39')],qs['fields'](_0x425089['query'][_0x839b('0x3e')]));_0x5e33c0[_0x839b('0x3d')]=_0x5e33c0[_0x839b('0x3d')][_0x839b('0x3f')]?_0x5e33c0['attributes']:_0x51ca4f[_0x839b('0x39')];if(!_0x425089['query'][_0x839b('0x40')](_0x839b('0x41'))){_0x5e33c0[_0x839b('0x2b')]=qs[_0x839b('0x2b')](_0x425089['query'][_0x839b('0x2b')]);_0x5e33c0[_0x839b('0x2a')]=qs[_0x839b('0x2a')](_0x425089['query'][_0x839b('0x2a')]);}_0x5e33c0[_0x839b('0x42')]=qs['sort'](_0x425089[_0x839b('0x3a')][_0x839b('0x43')]);_0x5e33c0[_0x839b('0x44')]=qs[_0x839b('0x3b')](_[_0x839b('0x45')](_0x425089['query'],_0x51ca4f['filters']),_0x2dbf67);if(_0x425089['query'][_0x839b('0x46')]){_0x5e33c0[_0x839b('0x44')]=_[_0x839b('0x47')](_0x5e33c0['where'],{'$or':_[_0x839b('0x35')](_0x2dbf67,function(_0x3d87eb){if(_0x3d87eb[_0x839b('0x48')]!==_0x839b('0x49')){var _0x17ae3e={};_0x17ae3e[_0x3d87eb[_0x839b('0x32')]]={'$like':'%'+_0x425089[_0x839b('0x3a')][_0x839b('0x46')]+'%'};return _0x17ae3e;}})});}_0x5e33c0=_['merge']({},_0x5e33c0,_0x425089['options']);var _0x2a3ef8={'where':_0x5e33c0['where']};return db[_0x839b('0x36')][_0x839b('0x4a')](_0x2a3ef8)[_0x839b('0x1b')](function(_0xa83cd9){_0x5c4da7[_0x839b('0x4a')]=_0xa83cd9;if(_0x425089['query']['includeAll']){_0x5e33c0['include']=[{'all':!![]}];}return db[_0x839b('0x36')][_0x839b('0x4b')](_0x5e33c0);})[_0x839b('0x1b')](function(_0xce03b5){_0x5c4da7[_0x839b('0x4c')]=_0xce03b5;return _0x5c4da7;})[_0x839b('0x1b')](respondWithFilteredResult(_0x204a5a,_0x5e33c0))['catch'](handleError(_0x204a5a,null));};exports[_0x839b('0x4d')]=function(_0x2e7d3a,_0x177aa5){var _0x4e171f={'raw':![],'where':{'id':_0x2e7d3a[_0x839b('0x4e')]['id']}},_0x40d89b={};_0x40d89b['model']=_[_0x839b('0x4f')](db[_0x839b('0x36')][_0x839b('0x37')]);_0x40d89b['query']=_[_0x839b('0x4f')](_0x2e7d3a[_0x839b('0x3a')]);_0x40d89b[_0x839b('0x3b')]=_[_0x839b('0x3c')](_0x40d89b[_0x839b('0x39')],_0x40d89b['query']);_0x4e171f[_0x839b('0x3d')]=_[_0x839b('0x3c')](_0x40d89b[_0x839b('0x39')],qs[_0x839b('0x3e')](_0x2e7d3a[_0x839b('0x3a')][_0x839b('0x3e')]));_0x4e171f[_0x839b('0x3d')]=_0x4e171f[_0x839b('0x3d')]['length']?_0x4e171f[_0x839b('0x3d')]:_0x40d89b[_0x839b('0x39')];if(_0x2e7d3a[_0x839b('0x3a')][_0x839b('0x50')]){_0x4e171f[_0x839b('0x51')]=[{'all':!![]}];}_0x4e171f=_[_0x839b('0x47')]({},_0x4e171f,_0x2e7d3a[_0x839b('0x52')]);return db['VtigerConfiguration']['find'](_0x4e171f)[_0x839b('0x1b')](handleEntityNotFound(_0x177aa5,null))[_0x839b('0x1b')](respondWithResult(_0x177aa5,null))[_0x839b('0x25')](handleError(_0x177aa5,null));};exports[_0x839b('0x53')]=function(_0x29fe08,_0x2fef98){return db['VtigerConfiguration'][_0x839b('0x53')](_0x29fe08[_0x839b('0x54')],{})['then'](respondWithResult(_0x2fef98,0xc9))[_0x839b('0x25')](handleError(_0x2fef98,null));};exports[_0x839b('0x55')]=function(_0x247ab3,_0x3b9b8b){if(_0x247ab3[_0x839b('0x54')]['id']){delete _0x247ab3[_0x839b('0x54')]['id'];}return db[_0x839b('0x36')]['find']({'where':{'id':_0x247ab3['params']['id']}})['then'](handleEntityNotFound(_0x3b9b8b,null))[_0x839b('0x1b')](saveUpdates(_0x247ab3[_0x839b('0x54')],null))[_0x839b('0x1b')](respondWithResult(_0x3b9b8b,null))[_0x839b('0x25')](handleError(_0x3b9b8b,null));};exports[_0x839b('0x30')]=function(_0x4142a4,_0x59f729){return db[_0x839b('0x36')]['find']({'where':{'id':_0x4142a4[_0x839b('0x4e')]['id']}})[_0x839b('0x1b')](handleEntityNotFound(_0x59f729,null))[_0x839b('0x1b')](removeEntity(_0x59f729,null))[_0x839b('0x25')](handleError(_0x59f729,null));};exports[_0x839b('0x56')]=function(_0xd7889c,_0x6601da,_0x174134){var _0x3b563b={};var _0x366b7c={};var _0xa04b07;var _0x14bbad;return db['VtigerConfiguration'][_0x839b('0x57')]({'where':{'id':_0xd7889c['params']['id']}})[_0x839b('0x1b')](handleEntityNotFound(_0x6601da,null))[_0x839b('0x1b')](function(_0x38c403){if(_0x38c403){_0xa04b07=_0x38c403;_0x366b7c['model']=_[_0x839b('0x4f')](db['VtigerField'][_0x839b('0x37')]);_0x366b7c[_0x839b('0x3a')]=_[_0x839b('0x4f')](_0xd7889c[_0x839b('0x3a')]);_0x366b7c[_0x839b('0x3b')]=_[_0x839b('0x3c')](_0x366b7c[_0x839b('0x39')],_0x366b7c[_0x839b('0x3a')]);_0x3b563b['attributes']=_[_0x839b('0x3c')](_0x366b7c[_0x839b('0x39')],qs['fields'](_0xd7889c[_0x839b('0x3a')][_0x839b('0x3e')]));_0x3b563b[_0x839b('0x3d')]=_0x3b563b['attributes'][_0x839b('0x3f')]?_0x3b563b[_0x839b('0x3d')]:_0x366b7c['model'];_0x3b563b[_0x839b('0x42')]=qs['sort'](_0xd7889c[_0x839b('0x3a')]['sort']);_0x3b563b['where']=qs[_0x839b('0x3b')](_[_0x839b('0x45')](_0xd7889c[_0x839b('0x3a')],_0x366b7c['filters']));if(_0xd7889c['query'][_0x839b('0x46')]){_0x3b563b['where']=_[_0x839b('0x47')](_0x3b563b[_0x839b('0x44')],{'$or':_[_0x839b('0x35')](_0x3b563b[_0x839b('0x3d')],function(_0x2eff7e){var _0x33c32e={};_0x33c32e[_0x2eff7e]={'$like':'%'+_0xd7889c['query']['filter']+'%'};return _0x33c32e;})});}_0x3b563b=_[_0x839b('0x47')]({},_0x3b563b,_0xd7889c[_0x839b('0x52')]);return _0xa04b07['getFields'](_0x3b563b);}})[_0x839b('0x1b')](function(_0x50d126){if(_0x50d126){_0x14bbad=_0x50d126[_0x839b('0x3f')];if(!_0xd7889c['query'][_0x839b('0x40')](_0x839b('0x41'))){_0x3b563b['limit']=qs[_0x839b('0x2b')](_0xd7889c[_0x839b('0x3a')][_0x839b('0x2b')]);_0x3b563b[_0x839b('0x2a')]=qs['offset'](_0xd7889c[_0x839b('0x3a')]['offset']);}return _0xa04b07[_0x839b('0x56')](_0x3b563b);}})[_0x839b('0x1b')](function(_0x1473e9){if(_0x1473e9){return _0x1473e9?{'count':_0x14bbad,'rows':_0x1473e9}:null;}})[_0x839b('0x1b')](respondWithResult(_0x6601da,null))['catch'](handleError(_0x6601da,null));};exports[_0x839b('0x58')]=function(_0x50ac8a,_0x3c70fc,_0x3c74a8){var _0x168009={};var _0x43b420={};var _0x471447;var _0x46eb3d;return db['VtigerConfiguration'][_0x839b('0x57')]({'where':{'id':_0x50ac8a[_0x839b('0x4e')]['id']}})[_0x839b('0x1b')](handleEntityNotFound(_0x3c70fc,null))['then'](function(_0x164583){if(_0x164583){_0x471447=_0x164583;_0x43b420[_0x839b('0x39')]=_['keys'](db[_0x839b('0x59')][_0x839b('0x37')]);_0x43b420[_0x839b('0x3a')]=_['keys'](_0x50ac8a[_0x839b('0x3a')]);_0x43b420['filters']=_[_0x839b('0x3c')](_0x43b420['model'],_0x43b420[_0x839b('0x3a')]);_0x168009[_0x839b('0x3d')]=_[_0x839b('0x3c')](_0x43b420[_0x839b('0x39')],qs[_0x839b('0x3e')](_0x50ac8a[_0x839b('0x3a')]['fields']));_0x168009[_0x839b('0x3d')]=_0x168009['attributes'][_0x839b('0x3f')]?_0x168009['attributes']:_0x43b420[_0x839b('0x39')];_0x168009['order']=qs[_0x839b('0x43')](_0x50ac8a[_0x839b('0x3a')][_0x839b('0x43')]);_0x168009[_0x839b('0x44')]=qs[_0x839b('0x3b')](_[_0x839b('0x45')](_0x50ac8a['query'],_0x43b420[_0x839b('0x3b')]));if(_0x50ac8a['query']['filter']){_0x168009['where']=_[_0x839b('0x47')](_0x168009[_0x839b('0x44')],{'$or':_[_0x839b('0x35')](_0x168009[_0x839b('0x3d')],function(_0x582e0e){var _0x90211d={};_0x90211d[_0x582e0e]={'$like':'%'+_0x50ac8a[_0x839b('0x3a')][_0x839b('0x46')]+'%'};return _0x90211d;})});}_0x168009=_[_0x839b('0x47')]({},_0x168009,_0x50ac8a[_0x839b('0x52')]);return _0x471447[_0x839b('0x58')](_0x168009);}})[_0x839b('0x1b')](function(_0x1cde54){if(_0x1cde54){_0x46eb3d=_0x1cde54[_0x839b('0x3f')];if(!_0x50ac8a['query'][_0x839b('0x40')](_0x839b('0x41'))){_0x168009[_0x839b('0x2b')]=qs[_0x839b('0x2b')](_0x50ac8a[_0x839b('0x3a')][_0x839b('0x2b')]);_0x168009[_0x839b('0x2a')]=qs['offset'](_0x50ac8a[_0x839b('0x3a')][_0x839b('0x2a')]);}return _0x471447[_0x839b('0x58')](_0x168009);}})[_0x839b('0x1b')](function(_0x4b6c7a){if(_0x4b6c7a){return _0x4b6c7a?{'count':_0x46eb3d,'rows':_0x4b6c7a}:null;}})[_0x839b('0x1b')](respondWithResult(_0x3c70fc,null))[_0x839b('0x25')](handleError(_0x3c70fc,null));};exports['getDescriptions']=function(_0x2d4289,_0x51c995,_0x16a937){var _0x39d872={};var _0x1e026e={};var _0x3baa1b;var _0x32495f;return db['VtigerConfiguration'][_0x839b('0x57')]({'where':{'id':_0x2d4289['params']['id']}})[_0x839b('0x1b')](handleEntityNotFound(_0x51c995,null))[_0x839b('0x1b')](function(_0x23b9e6){if(_0x23b9e6){_0x3baa1b=_0x23b9e6;_0x1e026e[_0x839b('0x39')]=_[_0x839b('0x4f')](db[_0x839b('0x59')][_0x839b('0x37')]);_0x1e026e[_0x839b('0x3a')]=_[_0x839b('0x4f')](_0x2d4289['query']);_0x1e026e[_0x839b('0x3b')]=_['intersection'](_0x1e026e[_0x839b('0x39')],_0x1e026e[_0x839b('0x3a')]);_0x39d872[_0x839b('0x3d')]=_['intersection'](_0x1e026e[_0x839b('0x39')],qs[_0x839b('0x3e')](_0x2d4289[_0x839b('0x3a')]['fields']));_0x39d872[_0x839b('0x3d')]=_0x39d872[_0x839b('0x3d')]['length']?_0x39d872[_0x839b('0x3d')]:_0x1e026e[_0x839b('0x39')];_0x39d872[_0x839b('0x42')]=qs[_0x839b('0x43')](_0x2d4289[_0x839b('0x3a')][_0x839b('0x43')]);_0x39d872[_0x839b('0x44')]=qs[_0x839b('0x3b')](_[_0x839b('0x45')](_0x2d4289[_0x839b('0x3a')],_0x1e026e['filters']));if(_0x2d4289[_0x839b('0x3a')][_0x839b('0x46')]){_0x39d872[_0x839b('0x44')]=_[_0x839b('0x47')](_0x39d872[_0x839b('0x44')],{'$or':_[_0x839b('0x35')](_0x39d872[_0x839b('0x3d')],function(_0x56b0a3){var _0x257e67={};_0x257e67[_0x56b0a3]={'$like':'%'+_0x2d4289[_0x839b('0x3a')][_0x839b('0x46')]+'%'};return _0x257e67;})});}_0x39d872=_['merge']({},_0x39d872,_0x2d4289[_0x839b('0x52')]);return _0x3baa1b[_0x839b('0x5a')](_0x39d872);}})[_0x839b('0x1b')](function(_0x1d6d2a){if(_0x1d6d2a){_0x32495f=_0x1d6d2a['length'];if(!_0x2d4289[_0x839b('0x3a')][_0x839b('0x40')](_0x839b('0x41'))){_0x39d872[_0x839b('0x2b')]=qs[_0x839b('0x2b')](_0x2d4289[_0x839b('0x3a')][_0x839b('0x2b')]);_0x39d872['offset']=qs[_0x839b('0x2a')](_0x2d4289[_0x839b('0x3a')][_0x839b('0x2a')]);}return _0x3baa1b[_0x839b('0x5a')](_0x39d872);}})['then'](function(_0x13074b){if(_0x13074b){return _0x13074b?{'count':_0x32495f,'rows':_0x13074b}:null;}})[_0x839b('0x1b')](respondWithResult(_0x51c995,null))[_0x839b('0x25')](handleError(_0x51c995,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b9c42b5..93997c2 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 _0x9262=['./intVtigerConfiguration.attributes','define','lodash','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x9262,0xe2));var _0x2926=function(_0x475dc9,_0x249f08){_0x475dc9=_0x475dc9-0x0;var _0x23c884=_0x9262[_0x475dc9];return _0x23c884;};'use strict';var _=require(_0x2926('0x0'));var util=require('util');var logger=require(_0x2926('0x1'))('api');var moment=require(_0x2926('0x2'));var BPromise=require('bluebird');var rp=require(_0x2926('0x3'));var fs=require('fs');var path=require(_0x2926('0x4'));var rimraf=require('rimraf');var config=require(_0x2926('0x5'));var attributes=require(_0x2926('0x6'));module['exports']=function(_0x5e244b,_0x4a6ffd){return _0x5e244b[_0x2926('0x7')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ec1=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0x2dc2bf,_0x445916){var _0x5d1be8=function(_0x9577bd){while(--_0x9577bd){_0x2dc2bf['push'](_0x2dc2bf['shift']());}};_0x5d1be8(++_0x445916);}(_0x5ec1,0x7d));var _0x15ec=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x5ec1[_0x210d7f];return _0x42d687;};'use strict';var _=require(_0x15ec('0x0'));var util=require(_0x15ec('0x1'));var logger=require(_0x15ec('0x2'))(_0x15ec('0x3'));var moment=require(_0x15ec('0x4'));var BPromise=require(_0x15ec('0x5'));var rp=require(_0x15ec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15ec('0x7'));var config=require(_0x15ec('0x8'));var attributes=require(_0x15ec('0x9'));module[_0x15ec('0xa')]=function(_0x3751e7,_0x4c4e5d){return _0x3751e7[_0x15ec('0xb')](_0x15ec('0xc'),attributes,{'tableName':_0x15ec('0xd'),'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 87fc543..6714ebf 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 _0x5df3=['result','lodash','util','randomstring','../../config/logger','rpc','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4e8584,_0x4c934b){var _0x430f61=function(_0x254e6d){while(--_0x254e6d){_0x4e8584['push'](_0x4e8584['shift']());}};_0x430f61(++_0x4c934b);}(_0x5df3,0x9a));var _0x35df=function(_0x2a6efc,_0x2f5a3d){_0x2a6efc=_0x2a6efc-0x0;var _0x1a7813=_0x5df3[_0x2a6efc];return _0x1a7813;};'use strict';var _=require(_0x35df('0x0'));var util=require(_0x35df('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x35df('0x3'))(_0x35df('0x4'));var config=require('../../config/environment');var jayson=require(_0x35df('0x5'));var client=jayson[_0x35df('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587292,_0x3eb139,_0x1f440c){return new BPromise(function(_0x5f2012,_0x288570){return client[_0x35df('0x7')](_0x587292,_0x1f440c)[_0x35df('0x8')](function(_0x374a6c){logger[_0x35df('0x9')](_0x35df('0xa'),_0x3eb139,_0x35df('0xb'));logger[_0x35df('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3eb139,_0x35df('0xb'),JSON[_0x35df('0xd')](_0x374a6c));if(_0x374a6c[_0x35df('0xe')]){if(_0x374a6c['error']['code']===0x1f4){logger[_0x35df('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x3eb139,_0x374a6c[_0x35df('0xe')][_0x35df('0xf')]);return _0x288570(_0x374a6c[_0x35df('0xe')][_0x35df('0xf')]);}logger['error'](_0x35df('0xa'),_0x3eb139,_0x374a6c[_0x35df('0xe')][_0x35df('0xf')]);return _0x5f2012(_0x374a6c[_0x35df('0xe')][_0x35df('0xf')]);}else{logger[_0x35df('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x3eb139,_0x35df('0xb'));_0x5f2012(_0x374a6c[_0x35df('0x10')][_0x35df('0xf')]);}})['catch'](function(_0x3d52be){logger[_0x35df('0xe')](_0x35df('0xa'),_0x3eb139,_0x3d52be);_0x288570(_0x3d52be);});});} \ No newline at end of file +var _0x3727=['stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5e2659,_0x2b61aa){var _0x26f049=function(_0x4dd99f){while(--_0x4dd99f){_0x5e2659['push'](_0x5e2659['shift']());}};_0x26f049(++_0x2b61aa);}(_0x3727,0xf6));var _0x7372=function(_0xe347ee,_0x1577be){_0xe347ee=_0xe347ee-0x0;var _0x299982=_0x3727[_0xe347ee];return _0x299982;};'use strict';var _=require('lodash');var util=require(_0x7372('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7372('0x1'));var db=require(_0x7372('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7372('0x3'))(_0x7372('0x4'));var config=require(_0x7372('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7372('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x56f197,_0x6840e1,_0xbecceb){return new BPromise(function(_0x4f01f7,_0x6695ad){return client[_0x7372('0x7')](_0x56f197,_0xbecceb)[_0x7372('0x8')](function(_0x22a012){logger[_0x7372('0x9')](_0x7372('0xa'),_0x6840e1,'request\x20sent');logger[_0x7372('0xb')](_0x7372('0xc'),_0x6840e1,_0x7372('0xd'),JSON[_0x7372('0xe')](_0x22a012));if(_0x22a012[_0x7372('0xf')]){if(_0x22a012['error'][_0x7372('0x10')]===0x1f4){logger[_0x7372('0xf')](_0x7372('0xa'),_0x6840e1,_0x22a012[_0x7372('0xf')]['message']);return _0x6695ad(_0x22a012['error'][_0x7372('0x11')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x6840e1,_0x22a012[_0x7372('0xf')][_0x7372('0x11')]);return _0x4f01f7(_0x22a012['error'][_0x7372('0x11')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x6840e1,_0x7372('0xd'));_0x4f01f7(_0x22a012[_0x7372('0x12')][_0x7372('0x11')]);}})[_0x7372('0x13')](function(_0x5cb6ef){logger[_0x7372('0xf')](_0x7372('0xa'),_0x6840e1,_0x5cb6ef);_0x6695ad(_0x5cb6ef);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index afc9ec3..5cc4d7b 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 _0xd6e0=['/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index'];(function(_0x2fcf6c,_0xc0a522){var _0x1d7c8e=function(_0xd37614){while(--_0xd37614){_0x2fcf6c['push'](_0x2fcf6c['shift']());}};_0x1d7c8e(++_0xc0a522);}(_0xd6e0,0x6c));var _0x0d6e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xd6e0[_0x1abb09];return _0xea1c07;};'use strict';var multer=require('multer');var util=require(_0x0d6e('0x0'));var path=require(_0x0d6e('0x1'));var timeout=require(_0x0d6e('0x2'));var express=require(_0x0d6e('0x3'));var router=express[_0x0d6e('0x4')]();var auth=require(_0x0d6e('0x5'));var interaction=require(_0x0d6e('0x6'));var config=require(_0x0d6e('0x7'));var controller=require(_0x0d6e('0x8'));router[_0x0d6e('0x9')]('/',auth[_0x0d6e('0xa')](),controller[_0x0d6e('0xb')]);router[_0x0d6e('0x9')](_0x0d6e('0xc'),auth['isAuthenticated'](),controller[_0x0d6e('0xd')]);router[_0x0d6e('0xe')]('/',auth[_0x0d6e('0xa')](),controller['create']);router[_0x0d6e('0xf')](_0x0d6e('0xc'),auth['isAuthenticated'](),controller[_0x0d6e('0x10')]);router[_0x0d6e('0x11')](_0x0d6e('0xc'),auth['isAuthenticated'](),controller[_0x0d6e('0x12')]);module[_0x0d6e('0x13')]=router; \ No newline at end of file +var _0x00b8=['/:id','post','create','put','update','destroy','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get'];(function(_0xc3f3bd,_0x20b7f5){var _0x27d0bd=function(_0x2d0977){while(--_0x2d0977){_0xc3f3bd['push'](_0xc3f3bd['shift']());}};_0x27d0bd(++_0x20b7f5);}(_0x00b8,0x67));var _0x800b=function(_0x576dbc,_0x25f434){_0x576dbc=_0x576dbc-0x0;var _0x2d9c90=_0x00b8[_0x576dbc];return _0x2d9c90;};'use strict';var multer=require(_0x800b('0x0'));var util=require(_0x800b('0x1'));var path=require('path');var timeout=require(_0x800b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x800b('0x3'));var config=require(_0x800b('0x4'));var controller=require(_0x800b('0x5'));router['get']('/',auth[_0x800b('0x6')](),controller[_0x800b('0x7')]);router[_0x800b('0x8')](_0x800b('0x9'),auth[_0x800b('0x6')](),controller['show']);router[_0x800b('0xa')]('/',auth[_0x800b('0x6')](),controller[_0x800b('0xb')]);router[_0x800b('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x800b('0xd')]);router['delete'](_0x800b('0x9'),auth['isAuthenticated'](),controller[_0x800b('0xe')]);module[_0x800b('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 59aa957..deed693 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 _0xa4c2=['customVariable','STRING','string','BOOLEAN','sequelize','ENUM','variable'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa4c2,0xc1));var _0x2a4c=function(_0xa09402,_0x382b2a){_0xa09402=_0xa09402-0x0;var _0x355517=_0xa4c2[_0xa09402];return _0x355517;};'use strict';var Sequelize=require(_0x2a4c('0x0'));module['exports']={'type':{'type':Sequelize[_0x2a4c('0x1')]('string',_0x2a4c('0x2'),_0x2a4c('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2a4c('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2a4c('0x1')](_0x2a4c('0x5'),'variable',_0x2a4c('0x3'))},'keyContent':{'type':Sequelize[_0x2a4c('0x4')]},'idField':{'type':Sequelize[_0x2a4c('0x4')]},'nameField':{'type':Sequelize[_0x2a4c('0x4')]},'customField':{'type':Sequelize[_0x2a4c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a4c('0x4')]}}; \ No newline at end of file +var _0xe799=['customVariable','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x9148e8,_0x4704f7){var _0x428c44=function(_0x52800b){while(--_0x52800b){_0x9148e8['push'](_0x9148e8['shift']());}};_0x428c44(++_0x4704f7);}(_0xe799,0x170));var _0x9e79=function(_0x14e039,_0x2ea7c1){_0x14e039=_0x14e039-0x0;var _0x578d3d=_0xe799[_0x14e039];return _0x578d3d;};'use strict';var Sequelize=require(_0x9e79('0x0'));module['exports']={'type':{'type':Sequelize[_0x9e79('0x1')]('string',_0x9e79('0x2'),_0x9e79('0x3'),'keyValue'),'defaultValue':_0x9e79('0x4')},'content':{'type':Sequelize[_0x9e79('0x5')]},'key':{'type':Sequelize[_0x9e79('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x9e79('0x4'),'variable',_0x9e79('0x3'))},'keyContent':{'type':Sequelize[_0x9e79('0x5')]},'idField':{'type':Sequelize[_0x9e79('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9e79('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e79('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f36b367..4fd6d00 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 _0x404b=['update','then','error','stack','name','send','map','VtigerField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','length','find','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set'];(function(_0x3c9464,_0x5eeba6){var _0x51a41a=function(_0x5d7f60){while(--_0x5d7f60){_0x3c9464['push'](_0x3c9464['shift']());}};_0x51a41a(++_0x5eeba6);}(_0x404b,0x68));var _0xb404=function(_0x1ff8a4,_0xd418f9){_0x1ff8a4=_0x1ff8a4-0x0;var _0x499e81=_0x404b[_0x1ff8a4];return _0x499e81;};'use strict';var pdf=require(_0xb404('0x0'));var emlformat=require(_0xb404('0x1'));var rimraf=require(_0xb404('0x2'));var zipdir=require(_0xb404('0x3'));var jsonpatch=require(_0xb404('0x4'));var rp=require(_0xb404('0x5'));var moment=require(_0xb404('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb404('0x7'));var util=require(_0xb404('0x8'));var path=require(_0xb404('0x9'));var sox=require(_0xb404('0xa'));var csv=require(_0xb404('0xb'));var ejs=require(_0xb404('0xc'));var fs=require('fs');var _=require(_0xb404('0xd'));var squel=require(_0xb404('0xe'));var crypto=require(_0xb404('0xf'));var jsforce=require(_0xb404('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb404('0xb'));var querystring=require(_0xb404('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb404('0x12'));var hardwareService=require(_0xb404('0x13'));var logger=require(_0xb404('0x14'))('api');var utils=require(_0xb404('0x15'));var config=require(_0xb404('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2007f9,_0xda7fff){_0xda7fff=_0xda7fff||0xcc;return function(_0x137c97){if(_0x137c97){return _0x2007f9[_0xb404('0x17')](_0xda7fff);}return _0x2007f9['status'](_0xda7fff)[_0xb404('0x18')]();};}function respondWithResult(_0x11d64b,_0x105cb4){_0x105cb4=_0x105cb4||0xc8;return function(_0x3c1f2c){if(_0x3c1f2c){return _0x11d64b[_0xb404('0x19')](_0x105cb4)['json'](_0x3c1f2c);}};}function respondWithFilteredResult(_0x3f53ee,_0x2cffb4){return function(_0x443e4d){if(_0x443e4d){var _0x1f25fb=_0x443e4d[_0xb404('0x1a')],_0x16db73=_0x2cffb4[_0xb404('0x1b')],_0x1413c2=_0x2cffb4[_0xb404('0x1b')]+_0x2cffb4[_0xb404('0x1c')],_0x26ece8;if(_0x1413c2>=_0x1f25fb){_0x1413c2=_0x1f25fb;_0x26ece8=0xc8;}else{_0x26ece8=0xce;}_0x3f53ee[_0xb404('0x19')](_0x26ece8);return _0x3f53ee[_0xb404('0x1d')]('Content-Range',_0x16db73+'-'+_0x1413c2+'/'+_0x1f25fb)['json'](_0x443e4d);}return null;};}function patchUpdates(_0x3d4716){return function(_0x5b9545){try{jsonpatch['apply'](_0x5b9545,_0x3d4716,!![]);}catch(_0x5d2779){return BPromise['reject'](_0x5d2779);}return _0x5b9545['save']();};}function saveUpdates(_0x2c48c5,_0x48f319){return function(_0x42321e){if(_0x42321e){return _0x42321e[_0xb404('0x1e')](_0x2c48c5)[_0xb404('0x1f')](function(_0x4f693a){return _0x4f693a;});}return null;};}function removeEntity(_0x51602d,_0x13f8a5){return function(_0x2814e5){if(_0x2814e5){return _0x2814e5['destroy']()[_0xb404('0x1f')](function(){_0x51602d['status'](0xcc)[_0xb404('0x18')]();});}};}function handleEntityNotFound(_0x58bd7f,_0xd0e5c){return function(_0x238e1a){if(!_0x238e1a){_0x58bd7f[_0xb404('0x17')](0x194);}return _0x238e1a;};}function handleError(_0x27ea46,_0x1ed00e){_0x1ed00e=_0x1ed00e||0x1f4;return function(_0x3ea9e8){logger[_0xb404('0x20')](_0x3ea9e8[_0xb404('0x21')]);if(_0x3ea9e8[_0xb404('0x22')]){delete _0x3ea9e8['name'];}_0x27ea46['status'](_0x1ed00e)[_0xb404('0x23')](_0x3ea9e8);};}exports['index']=function(_0x35d43c,_0x1b4a09){var _0x3d5fe3={},_0x1ef6f4={},_0x1b405a={'count':0x0,'rows':[]};var _0x22a153=_[_0xb404('0x24')](db[_0xb404('0x25')][_0xb404('0x26')],function(_0x22b5f6){return{'name':_0x22b5f6[_0xb404('0x27')],'type':_0x22b5f6[_0xb404('0x28')]['key']};});_0x1ef6f4[_0xb404('0x29')]=_['map'](_0x22a153,_0xb404('0x22'));_0x1ef6f4[_0xb404('0x2a')]=_['keys'](_0x35d43c['query']);_0x1ef6f4[_0xb404('0x2b')]=_[_0xb404('0x2c')](_0x1ef6f4[_0xb404('0x29')],_0x1ef6f4[_0xb404('0x2a')]);_0x3d5fe3[_0xb404('0x2d')]=_[_0xb404('0x2c')](_0x1ef6f4[_0xb404('0x29')],qs[_0xb404('0x2e')](_0x35d43c['query'][_0xb404('0x2e')]));_0x3d5fe3[_0xb404('0x2d')]=_0x3d5fe3['attributes']['length']?_0x3d5fe3['attributes']:_0x1ef6f4['model'];if(!_0x35d43c[_0xb404('0x2a')][_0xb404('0x2f')]('nolimit')){_0x3d5fe3['limit']=qs[_0xb404('0x1c')](_0x35d43c['query'][_0xb404('0x1c')]);_0x3d5fe3['offset']=qs[_0xb404('0x1b')](_0x35d43c[_0xb404('0x2a')]['offset']);}_0x3d5fe3[_0xb404('0x30')]=qs[_0xb404('0x31')](_0x35d43c[_0xb404('0x2a')][_0xb404('0x31')]);_0x3d5fe3[_0xb404('0x32')]=qs[_0xb404('0x2b')](_[_0xb404('0x33')](_0x35d43c['query'],_0x1ef6f4[_0xb404('0x2b')]),_0x22a153);if(_0x35d43c[_0xb404('0x2a')]['filter']){_0x3d5fe3[_0xb404('0x32')]=_[_0xb404('0x34')](_0x3d5fe3['where'],{'$or':_['map'](_0x22a153,function(_0x1ef41c){if(_0x1ef41c[_0xb404('0x28')]!==_0xb404('0x35')){var _0x4e9376={};_0x4e9376[_0x1ef41c[_0xb404('0x22')]]={'$like':'%'+_0x35d43c[_0xb404('0x2a')]['filter']+'%'};return _0x4e9376;}})});}_0x3d5fe3=_[_0xb404('0x34')]({},_0x3d5fe3,_0x35d43c[_0xb404('0x36')]);var _0x1f34c6={'where':_0x3d5fe3[_0xb404('0x32')]};return db[_0xb404('0x25')][_0xb404('0x1a')](_0x1f34c6)[_0xb404('0x1f')](function(_0x3a8f37){_0x1b405a[_0xb404('0x1a')]=_0x3a8f37;if(_0x35d43c[_0xb404('0x2a')][_0xb404('0x37')]){_0x3d5fe3[_0xb404('0x38')]=[{'all':!![]}];}return db[_0xb404('0x25')][_0xb404('0x39')](_0x3d5fe3);})[_0xb404('0x1f')](function(_0x1fac27){_0x1b405a['rows']=_0x1fac27;return _0x1b405a;})[_0xb404('0x1f')](respondWithFilteredResult(_0x1b4a09,_0x3d5fe3))[_0xb404('0x3a')](handleError(_0x1b4a09,null));};exports[_0xb404('0x3b')]=function(_0x1b4afb,_0x377f51){var _0x13cef1={'raw':!![],'where':{'id':_0x1b4afb['params']['id']}},_0x2e6e20={};_0x2e6e20[_0xb404('0x29')]=_[_0xb404('0x3c')](db['VtigerField']['rawAttributes']);_0x2e6e20[_0xb404('0x2a')]=_[_0xb404('0x3c')](_0x1b4afb[_0xb404('0x2a')]);_0x2e6e20[_0xb404('0x2b')]=_[_0xb404('0x2c')](_0x2e6e20[_0xb404('0x29')],_0x2e6e20[_0xb404('0x2a')]);_0x13cef1[_0xb404('0x2d')]=_[_0xb404('0x2c')](_0x2e6e20[_0xb404('0x29')],qs[_0xb404('0x2e')](_0x1b4afb['query'][_0xb404('0x2e')]));_0x13cef1[_0xb404('0x2d')]=_0x13cef1[_0xb404('0x2d')][_0xb404('0x3d')]?_0x13cef1[_0xb404('0x2d')]:_0x2e6e20[_0xb404('0x29')];if(_0x1b4afb[_0xb404('0x2a')][_0xb404('0x37')]){_0x13cef1[_0xb404('0x38')]=[{'all':!![]}];}_0x13cef1=_[_0xb404('0x34')]({},_0x13cef1,_0x1b4afb[_0xb404('0x36')]);return db[_0xb404('0x25')][_0xb404('0x3e')](_0x13cef1)[_0xb404('0x1f')](handleEntityNotFound(_0x377f51,null))[_0xb404('0x1f')](respondWithResult(_0x377f51,null))[_0xb404('0x3a')](handleError(_0x377f51,null));};exports[_0xb404('0x3f')]=function(_0x5c304e,_0x31e458){return db[_0xb404('0x25')]['create'](_0x5c304e['body'],{})[_0xb404('0x1f')](respondWithResult(_0x31e458,0xc9))[_0xb404('0x3a')](handleError(_0x31e458,null));};exports[_0xb404('0x1e')]=function(_0x1090cd,_0x4937da){if(_0x1090cd[_0xb404('0x40')]['id']){delete _0x1090cd[_0xb404('0x40')]['id'];}return db['VtigerField'][_0xb404('0x3e')]({'where':{'id':_0x1090cd[_0xb404('0x41')]['id']}})[_0xb404('0x1f')](handleEntityNotFound(_0x4937da,null))['then'](saveUpdates(_0x1090cd[_0xb404('0x40')],null))[_0xb404('0x1f')](respondWithResult(_0x4937da,null))[_0xb404('0x3a')](handleError(_0x4937da,null));};exports[_0xb404('0x42')]=function(_0x4555b0,_0x3c7dea){return db[_0xb404('0x25')][_0xb404('0x3e')]({'where':{'id':_0x4555b0[_0xb404('0x41')]['id']}})[_0xb404('0x1f')](handleEntityNotFound(_0x3c7dea,null))[_0xb404('0x1f')](removeEntity(_0x3c7dea,null))[_0xb404('0x3a')](handleError(_0x3c7dea,null));}; \ No newline at end of file +var _0x8098=['save','then','destroy','error','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','VtigerField','count','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','Content-Range','apply','reject'];(function(_0x330d89,_0x519d4a){var _0x5e1bf7=function(_0x53182b){while(--_0x53182b){_0x330d89['push'](_0x330d89['shift']());}};_0x5e1bf7(++_0x519d4a);}(_0x8098,0x6e));var _0x8809=function(_0x35c1f9,_0x1104a7){_0x35c1f9=_0x35c1f9-0x0;var _0x4a84cc=_0x8098[_0x35c1f9];return _0x4a84cc;};'use strict';var pdf=require(_0x8809('0x0'));var emlformat=require(_0x8809('0x1'));var rimraf=require(_0x8809('0x2'));var zipdir=require(_0x8809('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8809('0x4'));var moment=require('moment');var BPromise=require(_0x8809('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8809('0x6'));var csv=require(_0x8809('0x7'));var ejs=require(_0x8809('0x8'));var fs=require('fs');var _=require(_0x8809('0x9'));var squel=require(_0x8809('0xa'));var crypto=require(_0x8809('0xb'));var jsforce=require(_0x8809('0xc'));var deskjs=require(_0x8809('0xd'));var toCsv=require(_0x8809('0x7'));var querystring=require(_0x8809('0xe'));var Papa=require('papaparse');var Redis=require(_0x8809('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8809('0x10'));var as=require(_0x8809('0x11'));var hardwareService=require(_0x8809('0x12'));var logger=require(_0x8809('0x13'))('api');var utils=require(_0x8809('0x14'));var config=require(_0x8809('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32a279,_0x58d54b){_0x58d54b=_0x58d54b||0xcc;return function(_0x7441ae){if(_0x7441ae){return _0x32a279['sendStatus'](_0x58d54b);}return _0x32a279[_0x8809('0x16')](_0x58d54b)[_0x8809('0x17')]();};}function respondWithResult(_0x34a699,_0x16d6eb){_0x16d6eb=_0x16d6eb||0xc8;return function(_0x162aec){if(_0x162aec){return _0x34a699[_0x8809('0x16')](_0x16d6eb)['json'](_0x162aec);}};}function respondWithFilteredResult(_0x427dd6,_0x16a501){return function(_0x377641){if(_0x377641){var _0x36f20b=_0x377641['count'],_0x2a70ca=_0x16a501[_0x8809('0x18')],_0x32827d=_0x16a501[_0x8809('0x18')]+_0x16a501['limit'],_0xe9af17;if(_0x32827d>=_0x36f20b){_0x32827d=_0x36f20b;_0xe9af17=0xc8;}else{_0xe9af17=0xce;}_0x427dd6[_0x8809('0x16')](_0xe9af17);return _0x427dd6['set'](_0x8809('0x19'),_0x2a70ca+'-'+_0x32827d+'/'+_0x36f20b)['json'](_0x377641);}return null;};}function patchUpdates(_0x15c438){return function(_0x4ad27c){try{jsonpatch[_0x8809('0x1a')](_0x4ad27c,_0x15c438,!![]);}catch(_0x36b908){return BPromise[_0x8809('0x1b')](_0x36b908);}return _0x4ad27c[_0x8809('0x1c')]();};}function saveUpdates(_0x1237d2,_0x149dfb){return function(_0x542ac5){if(_0x542ac5){return _0x542ac5['update'](_0x1237d2)[_0x8809('0x1d')](function(_0x575f92){return _0x575f92;});}return null;};}function removeEntity(_0x38d4c3,_0x3ea0da){return function(_0x4dea3d){if(_0x4dea3d){return _0x4dea3d[_0x8809('0x1e')]()[_0x8809('0x1d')](function(){_0x38d4c3['status'](0xcc)[_0x8809('0x17')]();});}};}function handleEntityNotFound(_0x2778f3,_0x414ad9){return function(_0x5a1656){if(!_0x5a1656){_0x2778f3['sendStatus'](0x194);}return _0x5a1656;};}function handleError(_0x60eadb,_0x4acac8){_0x4acac8=_0x4acac8||0x1f4;return function(_0x15e326){logger[_0x8809('0x1f')](_0x15e326[_0x8809('0x20')]);if(_0x15e326[_0x8809('0x21')]){delete _0x15e326[_0x8809('0x21')];}_0x60eadb[_0x8809('0x16')](_0x4acac8)[_0x8809('0x22')](_0x15e326);};}exports[_0x8809('0x23')]=function(_0xa2b015,_0x3968fa){var _0x2b8d90={},_0x522bdc={},_0x1bdb53={'count':0x0,'rows':[]};var _0x6fb4e3=_['map'](db['VtigerField']['rawAttributes'],function(_0x44c51d){return{'name':_0x44c51d['fieldName'],'type':_0x44c51d[_0x8809('0x24')][_0x8809('0x25')]};});_0x522bdc[_0x8809('0x26')]=_[_0x8809('0x27')](_0x6fb4e3,_0x8809('0x21'));_0x522bdc[_0x8809('0x28')]=_[_0x8809('0x29')](_0xa2b015[_0x8809('0x28')]);_0x522bdc[_0x8809('0x2a')]=_[_0x8809('0x2b')](_0x522bdc[_0x8809('0x26')],_0x522bdc[_0x8809('0x28')]);_0x2b8d90[_0x8809('0x2c')]=_['intersection'](_0x522bdc[_0x8809('0x26')],qs[_0x8809('0x2d')](_0xa2b015[_0x8809('0x28')][_0x8809('0x2d')]));_0x2b8d90[_0x8809('0x2c')]=_0x2b8d90[_0x8809('0x2c')]['length']?_0x2b8d90[_0x8809('0x2c')]:_0x522bdc[_0x8809('0x26')];if(!_0xa2b015[_0x8809('0x28')]['hasOwnProperty'](_0x8809('0x2e'))){_0x2b8d90[_0x8809('0x2f')]=qs[_0x8809('0x2f')](_0xa2b015['query'][_0x8809('0x2f')]);_0x2b8d90[_0x8809('0x18')]=qs[_0x8809('0x18')](_0xa2b015[_0x8809('0x28')][_0x8809('0x18')]);}_0x2b8d90['order']=qs['sort'](_0xa2b015[_0x8809('0x28')][_0x8809('0x30')]);_0x2b8d90[_0x8809('0x31')]=qs[_0x8809('0x2a')](_[_0x8809('0x32')](_0xa2b015[_0x8809('0x28')],_0x522bdc[_0x8809('0x2a')]),_0x6fb4e3);if(_0xa2b015['query'][_0x8809('0x33')]){_0x2b8d90[_0x8809('0x31')]=_[_0x8809('0x34')](_0x2b8d90[_0x8809('0x31')],{'$or':_['map'](_0x6fb4e3,function(_0x3016cf){if(_0x3016cf[_0x8809('0x24')]!==_0x8809('0x35')){var _0x586a31={};_0x586a31[_0x3016cf[_0x8809('0x21')]]={'$like':'%'+_0xa2b015['query'][_0x8809('0x33')]+'%'};return _0x586a31;}})});}_0x2b8d90=_[_0x8809('0x34')]({},_0x2b8d90,_0xa2b015[_0x8809('0x36')]);var _0x57eb81={'where':_0x2b8d90['where']};return db[_0x8809('0x37')][_0x8809('0x38')](_0x57eb81)[_0x8809('0x1d')](function(_0xe9263b){_0x1bdb53[_0x8809('0x38')]=_0xe9263b;if(_0xa2b015[_0x8809('0x28')]['includeAll']){_0x2b8d90['include']=[{'all':!![]}];}return db[_0x8809('0x37')][_0x8809('0x39')](_0x2b8d90);})[_0x8809('0x1d')](function(_0x31a25b){_0x1bdb53[_0x8809('0x3a')]=_0x31a25b;return _0x1bdb53;})[_0x8809('0x1d')](respondWithFilteredResult(_0x3968fa,_0x2b8d90))[_0x8809('0x3b')](handleError(_0x3968fa,null));};exports[_0x8809('0x3c')]=function(_0x510ac1,_0x4d462f){var _0x26c0c5={'raw':!![],'where':{'id':_0x510ac1[_0x8809('0x3d')]['id']}},_0x288a3e={};_0x288a3e[_0x8809('0x26')]=_[_0x8809('0x29')](db[_0x8809('0x37')][_0x8809('0x3e')]);_0x288a3e[_0x8809('0x28')]=_['keys'](_0x510ac1[_0x8809('0x28')]);_0x288a3e[_0x8809('0x2a')]=_[_0x8809('0x2b')](_0x288a3e[_0x8809('0x26')],_0x288a3e[_0x8809('0x28')]);_0x26c0c5[_0x8809('0x2c')]=_[_0x8809('0x2b')](_0x288a3e[_0x8809('0x26')],qs[_0x8809('0x2d')](_0x510ac1[_0x8809('0x28')][_0x8809('0x2d')]));_0x26c0c5['attributes']=_0x26c0c5[_0x8809('0x2c')][_0x8809('0x3f')]?_0x26c0c5[_0x8809('0x2c')]:_0x288a3e['model'];if(_0x510ac1[_0x8809('0x28')][_0x8809('0x40')]){_0x26c0c5['include']=[{'all':!![]}];}_0x26c0c5=_[_0x8809('0x34')]({},_0x26c0c5,_0x510ac1[_0x8809('0x36')]);return db[_0x8809('0x37')][_0x8809('0x41')](_0x26c0c5)['then'](handleEntityNotFound(_0x4d462f,null))[_0x8809('0x1d')](respondWithResult(_0x4d462f,null))[_0x8809('0x3b')](handleError(_0x4d462f,null));};exports[_0x8809('0x42')]=function(_0x43b667,_0x21ab4a){return db[_0x8809('0x37')]['create'](_0x43b667[_0x8809('0x43')],{})[_0x8809('0x1d')](respondWithResult(_0x21ab4a,0xc9))[_0x8809('0x3b')](handleError(_0x21ab4a,null));};exports[_0x8809('0x44')]=function(_0x4a6ceb,_0x1313ae){if(_0x4a6ceb[_0x8809('0x43')]['id']){delete _0x4a6ceb[_0x8809('0x43')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x4a6ceb['params']['id']}})[_0x8809('0x1d')](handleEntityNotFound(_0x1313ae,null))['then'](saveUpdates(_0x4a6ceb[_0x8809('0x43')],null))[_0x8809('0x1d')](respondWithResult(_0x1313ae,null))[_0x8809('0x3b')](handleError(_0x1313ae,null));};exports[_0x8809('0x1e')]=function(_0xa9cd51,_0x1adc0d){return db[_0x8809('0x37')][_0x8809('0x41')]({'where':{'id':_0xa9cd51[_0x8809('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1adc0d,null))[_0x8809('0x1d')](removeEntity(_0x1adc0d,null))['catch'](handleError(_0x1adc0d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d178d23..f236685 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x5e13dd,_0x440adf){var _0x3d65ce=function(_0x2e9884){while(--_0x2e9884){_0x5e13dd['push'](_0x5e13dd['shift']());}};_0x3d65ce(++_0x440adf);}(_0x7a54,0x106));var _0x47a5=function(_0x292b5e,_0x1e2a03){_0x292b5e=_0x292b5e-0x0;var _0x15a941=_0x7a54[_0x292b5e];return _0x15a941;};'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 517f95d..02d12dc 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 _0xb875=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x1644f2,_0x1b22a6){var _0x26c6f8=function(_0x3b4ca3){while(--_0x3b4ca3){_0x1644f2['push'](_0x1644f2['shift']());}};_0x26c6f8(++_0x1b22a6);}(_0xb875,0x167));var _0x5b87=function(_0x4b550e,_0x2fba9d){_0x4b550e=_0x4b550e-0x0;var _0x266a5d=_0xb875[_0x4b550e];return _0x266a5d;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b87('0x2'))['db'];var utils=require(_0x5b87('0x3'));var logger=require('../../config/logger')(_0x5b87('0x4'));var config=require(_0x5b87('0x5'));var jayson=require(_0x5b87('0x6'));var client=jayson[_0x5b87('0x7')][_0x5b87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b27af,_0x1fc1a8,_0x46b1bf){return new BPromise(function(_0x1fb944,_0xb2888){return client['request'](_0x5b27af,_0x46b1bf)[_0x5b87('0x9')](function(_0x537f81){logger[_0x5b87('0xa')](_0x5b87('0xb'),_0x1fc1a8,_0x5b87('0xc'));logger[_0x5b87('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent',JSON[_0x5b87('0xe')](_0x537f81));if(_0x537f81[_0x5b87('0xf')]){if(_0x537f81['error'][_0x5b87('0x10')]===0x1f4){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);return _0xb2888(_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);}logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81['error'][_0x5b87('0x11')]);return _0x1fb944(_0x537f81['error'][_0x5b87('0x11')]);}else{logger[_0x5b87('0xa')]('VtigerField,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent');_0x1fb944(_0x537f81[_0x5b87('0x12')]['message']);}})[_0x5b87('0x13')](function(_0x175452){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x175452);_0xb2888(_0x175452);});});} \ No newline at end of file +var _0x4123=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0xd80897,_0x41f97b){var _0x5a3b54=function(_0xb65694){while(--_0xb65694){_0xd80897['push'](_0xd80897['shift']());}};_0x5a3b54(++_0x41f97b);}(_0x4123,0x87));var _0x3412=function(_0x2f922f,_0x34a14f){_0x2f922f=_0x2f922f-0x0;var _0x4a63d4=_0x4123[_0x2f922f];return _0x4a63d4;};'use strict';var _=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var moment=require(_0x3412('0x2'));var BPromise=require(_0x3412('0x3'));var rs=require(_0x3412('0x4'));var fs=require('fs');var Redis=require(_0x3412('0x5'));var db=require(_0x3412('0x6'))['db'];var utils=require(_0x3412('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3412('0x8'));var jayson=require(_0x3412('0x9'));var client=jayson['client'][_0x3412('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6b42,_0x30d18b,_0x43f43c){return new BPromise(function(_0x40c825,_0x2617a6){return client['request'](_0x2c6b42,_0x43f43c)[_0x3412('0xb')](function(_0x2517b0){logger[_0x3412('0xc')](_0x3412('0xd'),_0x30d18b,_0x3412('0xe'));logger[_0x3412('0xf')](_0x3412('0x10'),_0x30d18b,_0x3412('0xe'),JSON[_0x3412('0x11')](_0x2517b0));if(_0x2517b0['error']){if(_0x2517b0['error'][_0x3412('0x12')]===0x1f4){logger[_0x3412('0x13')](_0x3412('0xd'),_0x30d18b,_0x2517b0['error']['message']);return _0x2617a6(_0x2517b0['error'][_0x3412('0x14')]);}logger[_0x3412('0x13')](_0x3412('0xd'),_0x30d18b,_0x2517b0[_0x3412('0x13')][_0x3412('0x14')]);return _0x40c825(_0x2517b0[_0x3412('0x13')][_0x3412('0x14')]);}else{logger[_0x3412('0xc')](_0x3412('0xd'),_0x30d18b,_0x3412('0xe'));_0x40c825(_0x2517b0[_0x3412('0x15')][_0x3412('0x14')]);}})[_0x3412('0x16')](function(_0x854010){logger['error'](_0x3412('0xd'),_0x30d18b,_0x854010);_0x2617a6(_0x854010);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index c0649fb..bf30401 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 _0x435a=['create','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x5c0d22,_0x181735){var _0x2371aa=function(_0x2a410a){while(--_0x2a410a){_0x5c0d22['push'](_0x5c0d22['shift']());}};_0x2371aa(++_0x181735);}(_0x435a,0x1e8));var _0xa435=function(_0xb63fce,_0x195630){_0xb63fce=_0xb63fce-0x0;var _0x42c1ed=_0x435a[_0xb63fce];return _0x42c1ed;};'use strict';var multer=require('multer');var util=require(_0xa435('0x0'));var path=require(_0xa435('0x1'));var timeout=require(_0xa435('0x2'));var express=require('express');var router=express[_0xa435('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa435('0x4'));var config=require(_0xa435('0x5'));var controller=require(_0xa435('0x6'));router[_0xa435('0x7')]('/',auth[_0xa435('0x8')](),controller[_0xa435('0x9')]);router['get'](_0xa435('0xa'),auth['isAuthenticated'](),controller[_0xa435('0xb')]);router[_0xa435('0x7')](_0xa435('0xc'),auth['isAuthenticated'](),controller[_0xa435('0xd')]);router[_0xa435('0x7')]('/:id/fields',auth[_0xa435('0x8')](),controller[_0xa435('0xe')]);router[_0xa435('0xf')]('/',auth[_0xa435('0x8')](),controller[_0xa435('0x10')]);router[_0xa435('0xf')](_0xa435('0xc'),auth[_0xa435('0x8')](),controller['addConfiguration']);router['put'](_0xa435('0xa'),auth[_0xa435('0x8')](),controller[_0xa435('0x11')]);router[_0xa435('0x12')](_0xa435('0xa'),auth[_0xa435('0x8')](),controller[_0xa435('0x13')]);module[_0xa435('0x14')]=router; \ No newline at end of file +var _0x3492=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intZendeskAccount.controller','get'];(function(_0x171ca9,_0x2bb32d){var _0x31668f=function(_0x437a37){while(--_0x437a37){_0x171ca9['push'](_0x171ca9['shift']());}};_0x31668f(++_0x2bb32d);}(_0x3492,0x171));var _0x2349=function(_0x504944,_0x2c750a){_0x504944=_0x504944-0x0;var _0x3f6688=_0x3492[_0x504944];return _0x3f6688;};'use strict';var multer=require(_0x2349('0x0'));var util=require(_0x2349('0x1'));var path=require(_0x2349('0x2'));var timeout=require(_0x2349('0x3'));var express=require(_0x2349('0x4'));var router=express[_0x2349('0x5')]();var auth=require(_0x2349('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2349('0x7'));router[_0x2349('0x8')]('/',auth[_0x2349('0x9')](),controller[_0x2349('0xa')]);router['get'](_0x2349('0xb'),auth[_0x2349('0x9')](),controller[_0x2349('0xc')]);router['get'](_0x2349('0xd'),auth[_0x2349('0x9')](),controller[_0x2349('0xe')]);router[_0x2349('0x8')]('/:id/fields',auth[_0x2349('0x9')](),controller[_0x2349('0xf')]);router[_0x2349('0x10')]('/',auth[_0x2349('0x9')](),controller['create']);router['post'](_0x2349('0xd'),auth[_0x2349('0x9')](),controller[_0x2349('0x11')]);router['put']('/:id',auth[_0x2349('0x9')](),controller[_0x2349('0x12')]);router['delete'](_0x2349('0xb'),auth['isAuthenticated'](),controller[_0x2349('0x13')]);module[_0x2349('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 3b8ba26..dc59369 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 _0xf1ff=['username','ENUM','password','token','integrationTab','newTab','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1ff,0x156));var _0xff1f=function(_0x52fd3d,_0x3af718){_0x52fd3d=_0x52fd3d-0x0;var _0x49b06d=_0xf1ff[_0x52fd3d];return _0x49b06d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xff1f('0x0')]},'description':{'type':Sequelize[_0xff1f('0x0')]},'username':{'type':Sequelize[_0xff1f('0x0')],'unique':_0xff1f('0x1')},'password':{'type':Sequelize[_0xff1f('0x0')]},'token':{'type':Sequelize[_0xff1f('0x0')]},'remoteUri':{'type':Sequelize[_0xff1f('0x0')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xff1f('0x2')](_0xff1f('0x3'),_0xff1f('0x4')),'defaultValue':_0xff1f('0x3')},'serverUrl':{'type':Sequelize[_0xff1f('0x0')]},'type':{'type':Sequelize[_0xff1f('0x2')](_0xff1f('0x5'),_0xff1f('0x6')),'defaultValue':_0xff1f('0x5')}}; \ No newline at end of file +var _0xa86c=['STRING','remoteUri','password','ENUM','integrationTab','exports'];(function(_0x11a1b1,_0xfa25b5){var _0x5df54a=function(_0x543fc0){while(--_0x543fc0){_0x11a1b1['push'](_0x11a1b1['shift']());}};_0x5df54a(++_0xfa25b5);}(_0xa86c,0x19d));var _0xca86=function(_0x69d88,_0x290f5c){_0x69d88=_0x69d88-0x0;var _0x321cc4=_0xa86c[_0x69d88];return _0x321cc4;};'use strict';var Sequelize=require('sequelize');module[_0xca86('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xca86('0x1')]},'username':{'type':Sequelize[_0xca86('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xca86('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xca86('0x2')},'authType':{'type':Sequelize['ENUM'](_0xca86('0x3'),'token'),'defaultValue':_0xca86('0x3')},'serverUrl':{'type':Sequelize[_0xca86('0x1')]},'type':{'type':Sequelize[_0xca86('0x4')]('integrationTab','newTab'),'defaultValue':_0xca86('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 09ac7ad..6934a60 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 _0xebb2=['../../components/integrations/configuration','client','http','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~!@#$%^&-_=+[{]}.','request','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','set','apply','save','update','destroy','then','stack','name','send','index','map','ZendeskAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','headers','%s:%s','username','toString','base64','Basic\x20%s','Unknown\x20authentication\x20type','subject','description','group','remove','ticket_fields','type','position','title','system_field_options','custom_field_options','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xebb2,0x6a));var _0x2ebb=function(_0x57567f,_0x5d097d){_0x57567f=_0x57567f-0x0;var _0x393ea0=_0xebb2[_0x57567f];return _0x393ea0;};'use strict';var pdf=require(_0x2ebb('0x0'));var emlformat=require(_0x2ebb('0x1'));var rimraf=require(_0x2ebb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2ebb('0x3'));var BPromise=require(_0x2ebb('0x4'));var Mustache=require(_0x2ebb('0x5'));var util=require(_0x2ebb('0x6'));var path=require(_0x2ebb('0x7'));var sox=require('sox');var csv=require(_0x2ebb('0x8'));var ejs=require(_0x2ebb('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2ebb('0xa'));var crypto=require(_0x2ebb('0xb'));var jsforce=require(_0x2ebb('0xc'));var deskjs=require(_0x2ebb('0xd'));var toCsv=require(_0x2ebb('0x8'));var querystring=require(_0x2ebb('0xe'));var Papa=require(_0x2ebb('0xf'));var Redis=require(_0x2ebb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2ebb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ebb('0x12'))('api');var utils=require(_0x2ebb('0x13'));var config=require(_0x2ebb('0x14'));var db=require(_0x2ebb('0x15'))['db'];var integrations=require(_0x2ebb('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x2ebb('0x17')][_0x2ebb('0x18')]({'port':0x232a});function checkPasswordPattern(_0xb15d5c,_0x5dcbe4,_0xe4a696){if(_0xe4a696){var _0x2ba1e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ba1e2[_0x2ebb('0x19')](_0x5dcbe4)){return _0xb15d5c;}else{throw new db[(_0x2ebb('0x1a'))][(_0x2ebb('0x1b'))](_0x2ebb('0x1c'));}}else{return _0xb15d5c;}}function respondWithRpcPromise(_0x5dea25,_0x4b9fed,_0x3fa400,_0x2c4cec){return new BPromise(function(_0x11f43c,_0x30a643){var _0x48c7c1=_0x2c4cec||client;return _0x48c7c1[_0x2ebb('0x1d')](_0x5dea25,_0x3fa400)['then'](function(_0x5d0155){logger[_0x2ebb('0x1e')](_0x2ebb('0x1f'),_0x4b9fed,'request\x20sent');logger[_0x2ebb('0x20')](_0x2ebb('0x21'),_0x4b9fed,_0x2ebb('0x22'),JSON[_0x2ebb('0x23')](_0x5d0155));if(_0x5d0155[_0x2ebb('0x24')]){if(_0x5d0155[_0x2ebb('0x24')][_0x2ebb('0x25')]===0x1f4){logger[_0x2ebb('0x24')](_0x2ebb('0x1f'),_0x4b9fed,_0x5d0155['error']['message']);return _0x30a643(_0x5d0155[_0x2ebb('0x24')][_0x2ebb('0x26')]);}logger[_0x2ebb('0x24')](_0x2ebb('0x1f'),_0x4b9fed,_0x5d0155[_0x2ebb('0x24')][_0x2ebb('0x26')]);return _0x11f43c(_0x5d0155[_0x2ebb('0x24')][_0x2ebb('0x26')]);}else{logger[_0x2ebb('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x4b9fed,_0x2ebb('0x22'));_0x11f43c(_0x5d0155[_0x2ebb('0x27')]['message']);}})['catch'](function(_0x39cb91){logger[_0x2ebb('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x4b9fed,_0x39cb91);_0x30a643(_0x39cb91);});});}function respondWithStatusCode(_0x3dea2f,_0x51dea7){_0x51dea7=_0x51dea7||0xcc;return function(_0x489afa){if(_0x489afa){return _0x3dea2f[_0x2ebb('0x28')](_0x51dea7);}return _0x3dea2f[_0x2ebb('0x29')](_0x51dea7)[_0x2ebb('0x2a')]();};}function respondWithResult(_0x1699c6,_0x2f10f3){_0x2f10f3=_0x2f10f3||0xc8;return function(_0x3d08e7){if(_0x3d08e7){return _0x1699c6[_0x2ebb('0x29')](_0x2f10f3)[_0x2ebb('0x2b')](_0x3d08e7);}};}function respondWithFilteredResult(_0xa8f9a1,_0x33c8a0){return function(_0x578693){if(_0x578693){var _0x15a31e=_0x578693[_0x2ebb('0x2c')],_0x55ff27=_0x33c8a0[_0x2ebb('0x2d')],_0x4786a0=_0x33c8a0[_0x2ebb('0x2d')]+_0x33c8a0['limit'],_0x45ab1f;if(_0x4786a0>=_0x15a31e){_0x4786a0=_0x15a31e;_0x45ab1f=0xc8;}else{_0x45ab1f=0xce;}_0xa8f9a1[_0x2ebb('0x29')](_0x45ab1f);return _0xa8f9a1[_0x2ebb('0x2e')]('Content-Range',_0x55ff27+'-'+_0x4786a0+'/'+_0x15a31e)[_0x2ebb('0x2b')](_0x578693);}return null;};}function patchUpdates(_0x529553){return function(_0x26a1fb){try{jsonpatch[_0x2ebb('0x2f')](_0x26a1fb,_0x529553,!![]);}catch(_0x30b2da){return BPromise['reject'](_0x30b2da);}return _0x26a1fb[_0x2ebb('0x30')]();};}function saveUpdates(_0x35e4c8,_0x1fb01b){return function(_0xc5c904){if(_0xc5c904){return _0xc5c904[_0x2ebb('0x31')](_0x35e4c8)['then'](function(_0x44c4d5){return _0x44c4d5;});}return null;};}function removeEntity(_0x121f5d,_0x1dd863){return function(_0x2a2df9){if(_0x2a2df9){return _0x2a2df9[_0x2ebb('0x32')]()[_0x2ebb('0x33')](function(){_0x121f5d['status'](0xcc)[_0x2ebb('0x2a')]();});}};}function handleEntityNotFound(_0x4cbc34,_0x448060){return function(_0x3182db){if(!_0x3182db){_0x4cbc34[_0x2ebb('0x28')](0x194);}return _0x3182db;};}function handleError(_0x24814d,_0x469ab2){_0x469ab2=_0x469ab2||0x1f4;return function(_0xe73304){logger[_0x2ebb('0x24')](_0xe73304[_0x2ebb('0x34')]);if(_0xe73304[_0x2ebb('0x35')]){delete _0xe73304[_0x2ebb('0x35')];}_0x24814d[_0x2ebb('0x29')](_0x469ab2)[_0x2ebb('0x36')](_0xe73304);};}exports[_0x2ebb('0x37')]=function(_0x36c558,_0x42f34e){var _0x4b96d2={},_0x590017={},_0x58baa2={'count':0x0,'rows':[]};var _0x37e0a1=_[_0x2ebb('0x38')](db[_0x2ebb('0x39')]['rawAttributes'],function(_0x590899){return{'name':_0x590899[_0x2ebb('0x3a')],'type':_0x590899['type'][_0x2ebb('0x3b')]};});_0x590017[_0x2ebb('0x3c')]=_['map'](_0x37e0a1,_0x2ebb('0x35'));_0x590017[_0x2ebb('0x3d')]=_[_0x2ebb('0x3e')](_0x36c558['query']);_0x590017[_0x2ebb('0x3f')]=_[_0x2ebb('0x40')](_0x590017['model'],_0x590017[_0x2ebb('0x3d')]);_0x4b96d2[_0x2ebb('0x41')]=_['intersection'](_0x590017[_0x2ebb('0x3c')],qs[_0x2ebb('0x42')](_0x36c558[_0x2ebb('0x3d')][_0x2ebb('0x42')]));_0x4b96d2[_0x2ebb('0x41')]=_0x4b96d2[_0x2ebb('0x41')][_0x2ebb('0x43')]?_0x4b96d2[_0x2ebb('0x41')]:_0x590017[_0x2ebb('0x3c')];if(!_0x36c558[_0x2ebb('0x3d')][_0x2ebb('0x44')](_0x2ebb('0x45'))){_0x4b96d2[_0x2ebb('0x46')]=qs[_0x2ebb('0x46')](_0x36c558[_0x2ebb('0x3d')][_0x2ebb('0x46')]);_0x4b96d2[_0x2ebb('0x2d')]=qs[_0x2ebb('0x2d')](_0x36c558[_0x2ebb('0x3d')][_0x2ebb('0x2d')]);}_0x4b96d2[_0x2ebb('0x47')]=qs[_0x2ebb('0x48')](_0x36c558[_0x2ebb('0x3d')][_0x2ebb('0x48')]);_0x4b96d2[_0x2ebb('0x49')]=qs[_0x2ebb('0x3f')](_[_0x2ebb('0x4a')](_0x36c558[_0x2ebb('0x3d')],_0x590017[_0x2ebb('0x3f')]),_0x37e0a1);if(_0x36c558[_0x2ebb('0x3d')][_0x2ebb('0x4b')]){_0x4b96d2[_0x2ebb('0x49')]=_['merge'](_0x4b96d2['where'],{'$or':_[_0x2ebb('0x38')](_0x37e0a1,function(_0x651696){if(_0x651696['type']!==_0x2ebb('0x4c')){var _0x2bb709={};_0x2bb709[_0x651696[_0x2ebb('0x35')]]={'$like':'%'+_0x36c558[_0x2ebb('0x3d')][_0x2ebb('0x4b')]+'%'};return _0x2bb709;}})});}_0x4b96d2=_['merge']({},_0x4b96d2,_0x36c558[_0x2ebb('0x4d')]);var _0x2be828={'where':_0x4b96d2['where']};return db[_0x2ebb('0x39')]['count'](_0x2be828)[_0x2ebb('0x33')](function(_0x4e2d66){_0x58baa2[_0x2ebb('0x2c')]=_0x4e2d66;if(_0x36c558[_0x2ebb('0x3d')][_0x2ebb('0x4e')]){_0x4b96d2[_0x2ebb('0x4f')]=[{'all':!![]}];}return db[_0x2ebb('0x39')][_0x2ebb('0x50')](_0x4b96d2);})[_0x2ebb('0x33')](function(_0x4586e2){_0x58baa2[_0x2ebb('0x51')]=_0x4586e2;return _0x58baa2;})[_0x2ebb('0x33')](respondWithFilteredResult(_0x42f34e,_0x4b96d2))[_0x2ebb('0x52')](handleError(_0x42f34e,null));};exports['show']=function(_0x412c5a,_0x1cebbe){var _0x465baf={'raw':![],'where':{'id':_0x412c5a[_0x2ebb('0x53')]['id']}},_0x511ca5={};_0x511ca5[_0x2ebb('0x3c')]=_['keys'](db[_0x2ebb('0x39')][_0x2ebb('0x54')]);_0x511ca5[_0x2ebb('0x3d')]=_[_0x2ebb('0x3e')](_0x412c5a[_0x2ebb('0x3d')]);_0x511ca5[_0x2ebb('0x3f')]=_[_0x2ebb('0x40')](_0x511ca5[_0x2ebb('0x3c')],_0x511ca5[_0x2ebb('0x3d')]);_0x465baf[_0x2ebb('0x41')]=_[_0x2ebb('0x40')](_0x511ca5[_0x2ebb('0x3c')],qs['fields'](_0x412c5a[_0x2ebb('0x3d')][_0x2ebb('0x42')]));_0x465baf[_0x2ebb('0x41')]=_0x465baf[_0x2ebb('0x41')]['length']?_0x465baf[_0x2ebb('0x41')]:_0x511ca5[_0x2ebb('0x3c')];if(_0x412c5a[_0x2ebb('0x3d')][_0x2ebb('0x4e')]){_0x465baf[_0x2ebb('0x4f')]=[{'all':!![]}];}_0x465baf=_[_0x2ebb('0x55')]({},_0x465baf,_0x412c5a[_0x2ebb('0x4d')]);return db['ZendeskAccount'][_0x2ebb('0x56')](_0x465baf)['then'](handleEntityNotFound(_0x1cebbe,null))[_0x2ebb('0x33')](respondWithResult(_0x1cebbe,null))['catch'](handleError(_0x1cebbe,null));};exports[_0x2ebb('0x57')]=function(_0x33b06a,_0x300011){return db[_0x2ebb('0x39')][_0x2ebb('0x57')](_0x33b06a[_0x2ebb('0x58')],{})['then'](respondWithResult(_0x300011,0xc9))[_0x2ebb('0x52')](handleError(_0x300011,null));};exports['update']=function(_0x370378,_0x34a718){if(_0x370378['body']['id']){delete _0x370378[_0x2ebb('0x58')]['id'];}return db[_0x2ebb('0x39')][_0x2ebb('0x56')]({'where':{'id':_0x370378['params']['id']}})[_0x2ebb('0x33')](handleEntityNotFound(_0x34a718,null))[_0x2ebb('0x33')](saveUpdates(_0x370378[_0x2ebb('0x58')],null))[_0x2ebb('0x33')](respondWithResult(_0x34a718,null))[_0x2ebb('0x52')](handleError(_0x34a718,null));};exports[_0x2ebb('0x32')]=function(_0x45c13b,_0x359a13){return db[_0x2ebb('0x39')][_0x2ebb('0x56')]({'where':{'id':_0x45c13b[_0x2ebb('0x53')]['id']}})['then'](handleEntityNotFound(_0x359a13,null))[_0x2ebb('0x33')](removeEntity(_0x359a13,null))[_0x2ebb('0x52')](handleError(_0x359a13,null));};exports[_0x2ebb('0x59')]=function(_0x1b4935,_0x6cc1d9,_0x274ea1){var _0x40bae7={};var _0x249758={};var _0x521a25;var _0x5b1c6c;return db[_0x2ebb('0x39')][_0x2ebb('0x5a')]({'where':{'id':_0x1b4935['params']['id']}})[_0x2ebb('0x33')](handleEntityNotFound(_0x6cc1d9,null))[_0x2ebb('0x33')](function(_0x23d696){if(_0x23d696){_0x521a25=_0x23d696;_0x249758[_0x2ebb('0x3c')]=_[_0x2ebb('0x3e')](db['ZendeskConfiguration'][_0x2ebb('0x54')]);_0x249758[_0x2ebb('0x3d')]=_[_0x2ebb('0x3e')](_0x1b4935['query']);_0x249758['filters']=_[_0x2ebb('0x40')](_0x249758[_0x2ebb('0x3c')],_0x249758[_0x2ebb('0x3d')]);_0x40bae7[_0x2ebb('0x41')]=_[_0x2ebb('0x40')](_0x249758['model'],qs['fields'](_0x1b4935[_0x2ebb('0x3d')][_0x2ebb('0x42')]));_0x40bae7[_0x2ebb('0x41')]=_0x40bae7['attributes'][_0x2ebb('0x43')]?_0x40bae7[_0x2ebb('0x41')]:_0x249758[_0x2ebb('0x3c')];_0x40bae7[_0x2ebb('0x47')]=qs[_0x2ebb('0x48')](_0x1b4935[_0x2ebb('0x3d')][_0x2ebb('0x48')]);_0x40bae7[_0x2ebb('0x49')]=qs[_0x2ebb('0x3f')](_['pick'](_0x1b4935[_0x2ebb('0x3d')],_0x249758['filters']));if(_0x1b4935[_0x2ebb('0x3d')][_0x2ebb('0x4b')]){_0x40bae7[_0x2ebb('0x49')]=_[_0x2ebb('0x55')](_0x40bae7[_0x2ebb('0x49')],{'$or':_[_0x2ebb('0x38')](_0x40bae7[_0x2ebb('0x41')],function(_0xa87879){var _0x560124={};_0x560124[_0xa87879]={'$like':'%'+_0x1b4935['query'][_0x2ebb('0x4b')]+'%'};return _0x560124;})});}_0x40bae7=_[_0x2ebb('0x55')]({},_0x40bae7,_0x1b4935[_0x2ebb('0x4d')]);return _0x521a25[_0x2ebb('0x59')](_0x40bae7);}})[_0x2ebb('0x33')](function(_0x2dddc9){if(_0x2dddc9){_0x5b1c6c=_0x2dddc9[_0x2ebb('0x43')];if(!_0x1b4935['query'][_0x2ebb('0x44')](_0x2ebb('0x45'))){_0x40bae7[_0x2ebb('0x46')]=qs[_0x2ebb('0x46')](_0x1b4935[_0x2ebb('0x3d')][_0x2ebb('0x46')]);_0x40bae7[_0x2ebb('0x2d')]=qs[_0x2ebb('0x2d')](_0x1b4935[_0x2ebb('0x3d')][_0x2ebb('0x2d')]);}return _0x521a25[_0x2ebb('0x59')](_0x40bae7);}})[_0x2ebb('0x33')](function(_0x2fba5a){if(_0x2fba5a){return _0x2fba5a?{'count':_0x5b1c6c,'rows':_0x2fba5a}:null;}})[_0x2ebb('0x33')](respondWithResult(_0x6cc1d9,null))[_0x2ebb('0x52')](handleError(_0x6cc1d9,null));};exports[_0x2ebb('0x5b')]=function(_0xe7c895,_0x128499,_0xef5eb){if(_0xe7c895[_0x2ebb('0x58')]['id']){delete _0xe7c895[_0x2ebb('0x58')]['id'];}return db[_0x2ebb('0x39')][_0x2ebb('0x5a')]({'where':{'id':_0xe7c895['params']['id']}})['then'](handleEntityNotFound(_0x128499,null))['then'](function(_0x1ae700){if(_0x1ae700){_0xe7c895[_0x2ebb('0x58')][_0x2ebb('0x5c')]=_0x1ae700['id'];_0xe7c895[_0x2ebb('0x58')][_0x2ebb('0x5d')]=integrations[_0x2ebb('0x5e')](_0xe7c895[_0x2ebb('0x58')][_0x2ebb('0x5f')],_0xe7c895[_0x2ebb('0x58')]['type']);_0xe7c895[_0x2ebb('0x58')][_0x2ebb('0x60')]=integrations['getDescriptions'](_0xe7c895[_0x2ebb('0x58')]['channel'],_0xe7c895[_0x2ebb('0x58')]['type']);return db[_0x2ebb('0x61')][_0x2ebb('0x57')](_0xe7c895[_0x2ebb('0x58')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x2ebb('0x62')],'as':_0x2ebb('0x60')}]});}return null;})[_0x2ebb('0x33')](respondWithResult(_0x128499,null))[_0x2ebb('0x52')](handleError(_0x128499,null));};exports[_0x2ebb('0x63')]=function(_0x84c9bb,_0x1eb208,_0x231789){var _0x48b4d1='';return db[_0x2ebb('0x39')][_0x2ebb('0x5a')]({'where':{'id':_0x84c9bb['params']['id']},'attributes':['id','username',_0x2ebb('0x64'),_0x2ebb('0x65'),_0x2ebb('0x66'),_0x2ebb('0x67')]})[_0x2ebb('0x33')](handleEntityNotFound(_0x1eb208,null))[_0x2ebb('0x33')](function(_0x57f02f){if(_0x57f02f){_0x48b4d1=_0x57f02f[_0x2ebb('0x67')];var _0x16203f=_0x48b4d1[_0x2ebb('0x68')](-0x1);if(_0x16203f==='/'){_0x48b4d1=_0x48b4d1[_0x2ebb('0x69')](0x0,_0x48b4d1[_0x2ebb('0x6a')](_0x16203f));}var _0x59fd37={'method':'GET','uri':util[_0x2ebb('0x6b')](_0x2ebb('0x6c'),_0x48b4d1,'ticket_fields'),'json':!![]};switch(_0x57f02f[_0x2ebb('0x66')]){case _0x2ebb('0x64'):_0x59fd37[_0x2ebb('0x6d')]={'Authorization':util[_0x2ebb('0x6b')]('Basic\x20%s',new Buffer(util[_0x2ebb('0x6b')](_0x2ebb('0x6e'),_0x57f02f[_0x2ebb('0x6f')],_0x57f02f[_0x2ebb('0x64')]))[_0x2ebb('0x70')](_0x2ebb('0x71')))};break;case _0x2ebb('0x65'):_0x59fd37[_0x2ebb('0x6d')]={'Authorization':util[_0x2ebb('0x6b')](_0x2ebb('0x72'),new Buffer(util[_0x2ebb('0x6b')]('%s/token:%s',_0x57f02f[_0x2ebb('0x6f')],_0x57f02f[_0x2ebb('0x65')]))[_0x2ebb('0x70')](_0x2ebb('0x71')))};break;default:throw new db[(_0x2ebb('0x1a'))][(_0x2ebb('0x1b'))](_0x2ebb('0x73'));}return rp(_0x59fd37);}})[_0x2ebb('0x33')](function(_0x5a29bd){if(_0x5a29bd){var _0x3d931b=[_0x2ebb('0x74'),_0x2ebb('0x75'),_0x2ebb('0x76'),'assignee'];_[_0x2ebb('0x77')](_0x5a29bd[_0x2ebb('0x78')],function(_0x38f38d){return _0x3d931b['includes'](_0x38f38d[_0x2ebb('0x79')]);});return{'count':_0x5a29bd[_0x2ebb('0x78')][_0x2ebb('0x43')],'rows':_[_0x2ebb('0x38')](_0x5a29bd[_0x2ebb('0x78')],function(_0x2ab175){return{'id':_0x2ab175['id'],'name':_0x2ab175[_0x2ebb('0x7a')]>0x7?_0x2ab175[_0x2ebb('0x7b')]:_0x2ab175[_0x2ebb('0x79')],'custom':_0x2ab175[_0x2ebb('0x7a')]>0x7?!![]:![],'options':_0x2ab175[_0x2ebb('0x7c')]?_0x2ab175[_0x2ebb('0x7c')]:_0x2ab175[_0x2ebb('0x7d')]?_0x2ab175['custom_field_options']:[]};})};}})[_0x2ebb('0x33')](respondWithResult(_0x1eb208,null))[_0x2ebb('0x52')](function(_0x2fd3c2){var _0x46a9ad=_0x84c9bb[_0x2ebb('0x3d')][_0x2ebb('0x19')]?0x1f4:_0x2fd3c2['statusCode']||0x1f4;logger[_0x2ebb('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x2ebb('0x63'),_0x46a9ad,JSON['stringify'](_0x2fd3c2));delete _0x2fd3c2['name'];if(_0x46a9ad===0x191){_0x46a9ad=0x190;}_0x1eb208['status'](_0x46a9ad)['send'](_0x84c9bb[_0x2ebb('0x3d')]['test']?{'message':_0x2ebb('0x7e'),'statusCode':_0x2fd3c2[_0x2ebb('0x7f')]}:_0x2fd3c2);});}; \ No newline at end of file +var _0x3795=['../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','length','includeAll','find','create','body','params','getConfigurations','ZendeskConfiguration','sort','pick','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','substring','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','username','%s/token:%s','toString','base64','Sequelize','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5a2c7c,_0x1933ae){var _0x1481b3=function(_0x126836){while(--_0x126836){_0x5a2c7c['push'](_0x5a2c7c['shift']());}};_0x1481b3(++_0x1933ae);}(_0x3795,0xf0));var _0x5379=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3795[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x5379('0x0'));var emlformat=require(_0x5379('0x1'));var rimraf=require(_0x5379('0x2'));var zipdir=require(_0x5379('0x3'));var jsonpatch=require(_0x5379('0x4'));var rp=require(_0x5379('0x5'));var moment=require('moment');var BPromise=require(_0x5379('0x6'));var Mustache=require('mustache');var util=require(_0x5379('0x7'));var path=require(_0x5379('0x8'));var sox=require(_0x5379('0x9'));var csv=require(_0x5379('0xa'));var ejs=require(_0x5379('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5379('0xc'));var crypto=require(_0x5379('0xd'));var jsforce=require(_0x5379('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5379('0xf'));var Papa=require(_0x5379('0x10'));var Redis=require(_0x5379('0x11'));var authService=require(_0x5379('0x12'));var qs=require(_0x5379('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5379('0x14'));var logger=require(_0x5379('0x15'))('api');var utils=require(_0x5379('0x16'));var config=require('../../config/environment');var db=require(_0x5379('0x17'))['db'];var integrations=require(_0x5379('0x18'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5379('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4af31b,_0x56d0bb,_0x15d573){if(_0x15d573){var _0x303d47=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x303d47[_0x5379('0x1a')](_0x56d0bb)){return _0x4af31b;}else{throw new db['Sequelize'][(_0x5379('0x1b'))](_0x5379('0x1c'));}}else{return _0x4af31b;}}function respondWithRpcPromise(_0xbaf6f4,_0x2faf46,_0x511e43,_0x5209ad){return new BPromise(function(_0x2620a7,_0x854bea){var _0x323743=_0x5209ad||client;return _0x323743['request'](_0xbaf6f4,_0x511e43)[_0x5379('0x1d')](function(_0x163ad6){logger[_0x5379('0x1e')](_0x5379('0x1f'),_0x2faf46,'request\x20sent');logger[_0x5379('0x20')](_0x5379('0x21'),_0x2faf46,_0x5379('0x22'),JSON[_0x5379('0x23')](_0x163ad6));if(_0x163ad6['error']){if(_0x163ad6[_0x5379('0x24')][_0x5379('0x25')]===0x1f4){logger[_0x5379('0x24')](_0x5379('0x1f'),_0x2faf46,_0x163ad6['error'][_0x5379('0x26')]);return _0x854bea(_0x163ad6[_0x5379('0x24')][_0x5379('0x26')]);}logger[_0x5379('0x24')](_0x5379('0x1f'),_0x2faf46,_0x163ad6[_0x5379('0x24')][_0x5379('0x26')]);return _0x2620a7(_0x163ad6[_0x5379('0x24')]['message']);}else{logger['info'](_0x5379('0x1f'),_0x2faf46,'request\x20sent');_0x2620a7(_0x163ad6[_0x5379('0x27')][_0x5379('0x26')]);}})['catch'](function(_0x4cb572){logger['error'](_0x5379('0x1f'),_0x2faf46,_0x4cb572);_0x854bea(_0x4cb572);});});}function respondWithStatusCode(_0x295471,_0x14e8e5){_0x14e8e5=_0x14e8e5||0xcc;return function(_0x2119ef){if(_0x2119ef){return _0x295471[_0x5379('0x28')](_0x14e8e5);}return _0x295471[_0x5379('0x29')](_0x14e8e5)['end']();};}function respondWithResult(_0x2cef31,_0xffa52){_0xffa52=_0xffa52||0xc8;return function(_0x9bf8e3){if(_0x9bf8e3){return _0x2cef31['status'](_0xffa52)['json'](_0x9bf8e3);}};}function respondWithFilteredResult(_0x340ade,_0x12eb3d){return function(_0x13e481){if(_0x13e481){var _0x4dc57e=_0x13e481[_0x5379('0x2a')],_0x46b663=_0x12eb3d[_0x5379('0x2b')],_0x31df71=_0x12eb3d[_0x5379('0x2b')]+_0x12eb3d[_0x5379('0x2c')],_0x4c4807;if(_0x31df71>=_0x4dc57e){_0x31df71=_0x4dc57e;_0x4c4807=0xc8;}else{_0x4c4807=0xce;}_0x340ade[_0x5379('0x29')](_0x4c4807);return _0x340ade[_0x5379('0x2d')](_0x5379('0x2e'),_0x46b663+'-'+_0x31df71+'/'+_0x4dc57e)[_0x5379('0x2f')](_0x13e481);}return null;};}function patchUpdates(_0x5d16aa){return function(_0x5a97e7){try{jsonpatch[_0x5379('0x30')](_0x5a97e7,_0x5d16aa,!![]);}catch(_0x480633){return BPromise[_0x5379('0x31')](_0x480633);}return _0x5a97e7[_0x5379('0x32')]();};}function saveUpdates(_0x1ae29f,_0x5d14c7){return function(_0x37af93){if(_0x37af93){return _0x37af93[_0x5379('0x33')](_0x1ae29f)[_0x5379('0x1d')](function(_0x6e0e79){return _0x6e0e79;});}return null;};}function removeEntity(_0x5904d8,_0x325305){return function(_0x49fe2c){if(_0x49fe2c){return _0x49fe2c[_0x5379('0x34')]()[_0x5379('0x1d')](function(){_0x5904d8[_0x5379('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5442ed,_0x3505f0){return function(_0x4a293e){if(!_0x4a293e){_0x5442ed[_0x5379('0x28')](0x194);}return _0x4a293e;};}function handleError(_0x48b319,_0x1f1b08){_0x1f1b08=_0x1f1b08||0x1f4;return function(_0x5a961e){logger[_0x5379('0x24')](_0x5a961e[_0x5379('0x35')]);if(_0x5a961e['name']){delete _0x5a961e['name'];}_0x48b319[_0x5379('0x29')](_0x1f1b08)['send'](_0x5a961e);};}exports[_0x5379('0x36')]=function(_0x5f56c7,_0x596454){var _0x2bee55={},_0x527236={},_0x3c7445={'count':0x0,'rows':[]};var _0x34003d=_[_0x5379('0x37')](db[_0x5379('0x38')][_0x5379('0x39')],function(_0x109c5e){return{'name':_0x109c5e[_0x5379('0x3a')],'type':_0x109c5e[_0x5379('0x3b')][_0x5379('0x3c')]};});_0x527236[_0x5379('0x3d')]=_[_0x5379('0x37')](_0x34003d,_0x5379('0x3e'));_0x527236[_0x5379('0x3f')]=_[_0x5379('0x40')](_0x5f56c7[_0x5379('0x3f')]);_0x527236[_0x5379('0x41')]=_['intersection'](_0x527236[_0x5379('0x3d')],_0x527236[_0x5379('0x3f')]);_0x2bee55[_0x5379('0x42')]=_[_0x5379('0x43')](_0x527236[_0x5379('0x3d')],qs[_0x5379('0x44')](_0x5f56c7[_0x5379('0x3f')]['fields']));_0x2bee55[_0x5379('0x42')]=_0x2bee55[_0x5379('0x42')]['length']?_0x2bee55['attributes']:_0x527236[_0x5379('0x3d')];if(!_0x5f56c7['query'][_0x5379('0x45')](_0x5379('0x46'))){_0x2bee55[_0x5379('0x2c')]=qs[_0x5379('0x2c')](_0x5f56c7[_0x5379('0x3f')][_0x5379('0x2c')]);_0x2bee55['offset']=qs[_0x5379('0x2b')](_0x5f56c7[_0x5379('0x3f')][_0x5379('0x2b')]);}_0x2bee55[_0x5379('0x47')]=qs['sort'](_0x5f56c7[_0x5379('0x3f')]['sort']);_0x2bee55[_0x5379('0x48')]=qs[_0x5379('0x41')](_['pick'](_0x5f56c7[_0x5379('0x3f')],_0x527236[_0x5379('0x41')]),_0x34003d);if(_0x5f56c7['query']['filter']){_0x2bee55[_0x5379('0x48')]=_[_0x5379('0x49')](_0x2bee55[_0x5379('0x48')],{'$or':_['map'](_0x34003d,function(_0x225c6a){if(_0x225c6a[_0x5379('0x3b')]!==_0x5379('0x4a')){var _0x3d39db={};_0x3d39db[_0x225c6a[_0x5379('0x3e')]]={'$like':'%'+_0x5f56c7[_0x5379('0x3f')][_0x5379('0x4b')]+'%'};return _0x3d39db;}})});}_0x2bee55=_[_0x5379('0x49')]({},_0x2bee55,_0x5f56c7[_0x5379('0x4c')]);var _0x346dc6={'where':_0x2bee55[_0x5379('0x48')]};return db[_0x5379('0x38')][_0x5379('0x2a')](_0x346dc6)[_0x5379('0x1d')](function(_0x1ba3bc){_0x3c7445[_0x5379('0x2a')]=_0x1ba3bc;if(_0x5f56c7[_0x5379('0x3f')]['includeAll']){_0x2bee55['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x5379('0x4d')](_0x2bee55);})['then'](function(_0x4db587){_0x3c7445[_0x5379('0x4e')]=_0x4db587;return _0x3c7445;})[_0x5379('0x1d')](respondWithFilteredResult(_0x596454,_0x2bee55))[_0x5379('0x4f')](handleError(_0x596454,null));};exports[_0x5379('0x50')]=function(_0x4c629f,_0x3659d1){var _0x1290ad={'raw':![],'where':{'id':_0x4c629f['params']['id']}},_0x19be79={};_0x19be79[_0x5379('0x3d')]=_[_0x5379('0x40')](db['ZendeskAccount'][_0x5379('0x39')]);_0x19be79[_0x5379('0x3f')]=_[_0x5379('0x40')](_0x4c629f[_0x5379('0x3f')]);_0x19be79[_0x5379('0x41')]=_[_0x5379('0x43')](_0x19be79[_0x5379('0x3d')],_0x19be79[_0x5379('0x3f')]);_0x1290ad[_0x5379('0x42')]=_[_0x5379('0x43')](_0x19be79[_0x5379('0x3d')],qs[_0x5379('0x44')](_0x4c629f[_0x5379('0x3f')][_0x5379('0x44')]));_0x1290ad[_0x5379('0x42')]=_0x1290ad[_0x5379('0x42')][_0x5379('0x51')]?_0x1290ad[_0x5379('0x42')]:_0x19be79[_0x5379('0x3d')];if(_0x4c629f['query'][_0x5379('0x52')]){_0x1290ad['include']=[{'all':!![]}];}_0x1290ad=_[_0x5379('0x49')]({},_0x1290ad,_0x4c629f[_0x5379('0x4c')]);return db['ZendeskAccount'][_0x5379('0x53')](_0x1290ad)[_0x5379('0x1d')](handleEntityNotFound(_0x3659d1,null))[_0x5379('0x1d')](respondWithResult(_0x3659d1,null))[_0x5379('0x4f')](handleError(_0x3659d1,null));};exports[_0x5379('0x54')]=function(_0x99271f,_0x5eb20e){return db['ZendeskAccount']['create'](_0x99271f['body'],{})[_0x5379('0x1d')](respondWithResult(_0x5eb20e,0xc9))[_0x5379('0x4f')](handleError(_0x5eb20e,null));};exports['update']=function(_0x789fb1,_0x4af600){if(_0x789fb1['body']['id']){delete _0x789fb1[_0x5379('0x55')]['id'];}return db[_0x5379('0x38')][_0x5379('0x53')]({'where':{'id':_0x789fb1[_0x5379('0x56')]['id']}})[_0x5379('0x1d')](handleEntityNotFound(_0x4af600,null))['then'](saveUpdates(_0x789fb1[_0x5379('0x55')],null))[_0x5379('0x1d')](respondWithResult(_0x4af600,null))[_0x5379('0x4f')](handleError(_0x4af600,null));};exports[_0x5379('0x34')]=function(_0x1a64a7,_0x3870b6){return db[_0x5379('0x38')][_0x5379('0x53')]({'where':{'id':_0x1a64a7[_0x5379('0x56')]['id']}})['then'](handleEntityNotFound(_0x3870b6,null))[_0x5379('0x1d')](removeEntity(_0x3870b6,null))[_0x5379('0x4f')](handleError(_0x3870b6,null));};exports[_0x5379('0x57')]=function(_0x238091,_0x114d0b,_0x245e65){var _0x236422={};var _0x2d9005={};var _0x31ea3e;var _0x28d64d;return db[_0x5379('0x38')]['findOne']({'where':{'id':_0x238091['params']['id']}})[_0x5379('0x1d')](handleEntityNotFound(_0x114d0b,null))[_0x5379('0x1d')](function(_0x352c85){if(_0x352c85){_0x31ea3e=_0x352c85;_0x2d9005[_0x5379('0x3d')]=_[_0x5379('0x40')](db[_0x5379('0x58')][_0x5379('0x39')]);_0x2d9005['query']=_['keys'](_0x238091['query']);_0x2d9005[_0x5379('0x41')]=_[_0x5379('0x43')](_0x2d9005[_0x5379('0x3d')],_0x2d9005[_0x5379('0x3f')]);_0x236422[_0x5379('0x42')]=_[_0x5379('0x43')](_0x2d9005['model'],qs[_0x5379('0x44')](_0x238091['query'][_0x5379('0x44')]));_0x236422[_0x5379('0x42')]=_0x236422['attributes'][_0x5379('0x51')]?_0x236422[_0x5379('0x42')]:_0x2d9005[_0x5379('0x3d')];_0x236422['order']=qs[_0x5379('0x59')](_0x238091[_0x5379('0x3f')][_0x5379('0x59')]);_0x236422[_0x5379('0x48')]=qs[_0x5379('0x41')](_[_0x5379('0x5a')](_0x238091[_0x5379('0x3f')],_0x2d9005[_0x5379('0x41')]));if(_0x238091[_0x5379('0x3f')][_0x5379('0x4b')]){_0x236422[_0x5379('0x48')]=_[_0x5379('0x49')](_0x236422[_0x5379('0x48')],{'$or':_[_0x5379('0x37')](_0x236422[_0x5379('0x42')],function(_0x29c1f4){var _0x5e6bac={};_0x5e6bac[_0x29c1f4]={'$like':'%'+_0x238091[_0x5379('0x3f')]['filter']+'%'};return _0x5e6bac;})});}_0x236422=_['merge']({},_0x236422,_0x238091[_0x5379('0x4c')]);return _0x31ea3e[_0x5379('0x57')](_0x236422);}})['then'](function(_0x8ddedc){if(_0x8ddedc){_0x28d64d=_0x8ddedc[_0x5379('0x51')];if(!_0x238091[_0x5379('0x3f')][_0x5379('0x45')]('nolimit')){_0x236422['limit']=qs[_0x5379('0x2c')](_0x238091['query'][_0x5379('0x2c')]);_0x236422[_0x5379('0x2b')]=qs[_0x5379('0x2b')](_0x238091[_0x5379('0x3f')][_0x5379('0x2b')]);}return _0x31ea3e['getConfigurations'](_0x236422);}})['then'](function(_0xb3fc8f){if(_0xb3fc8f){return _0xb3fc8f?{'count':_0x28d64d,'rows':_0xb3fc8f}:null;}})[_0x5379('0x1d')](respondWithResult(_0x114d0b,null))[_0x5379('0x4f')](handleError(_0x114d0b,null));};exports[_0x5379('0x5b')]=function(_0x621b90,_0x463484,_0x2df491){if(_0x621b90[_0x5379('0x55')]['id']){delete _0x621b90[_0x5379('0x55')]['id'];}return db[_0x5379('0x38')][_0x5379('0x5c')]({'where':{'id':_0x621b90[_0x5379('0x56')]['id']}})['then'](handleEntityNotFound(_0x463484,null))[_0x5379('0x1d')](function(_0x2b43eb){if(_0x2b43eb){_0x621b90[_0x5379('0x55')][_0x5379('0x5d')]=_0x2b43eb['id'];_0x621b90['body']['Subjects']=integrations[_0x5379('0x5e')](_0x621b90[_0x5379('0x55')][_0x5379('0x5f')],_0x621b90[_0x5379('0x55')][_0x5379('0x3b')]);_0x621b90['body'][_0x5379('0x60')]=integrations[_0x5379('0x61')](_0x621b90['body']['channel'],_0x621b90[_0x5379('0x55')][_0x5379('0x3b')]);return db[_0x5379('0x58')][_0x5379('0x54')](_0x621b90['body'],{'include':[{'model':db[_0x5379('0x62')],'as':'Subjects'},{'model':db[_0x5379('0x62')],'as':_0x5379('0x60')}]});}return null;})[_0x5379('0x1d')](respondWithResult(_0x463484,null))[_0x5379('0x4f')](handleError(_0x463484,null));};exports[_0x5379('0x63')]=function(_0x4e973b,_0x1f1844,_0x16b526){var _0x413093='';return db[_0x5379('0x38')][_0x5379('0x5c')]({'where':{'id':_0x4e973b[_0x5379('0x56')]['id']},'attributes':['id','username',_0x5379('0x64'),_0x5379('0x65'),_0x5379('0x66'),_0x5379('0x67')]})[_0x5379('0x1d')](handleEntityNotFound(_0x1f1844,null))['then'](function(_0x4af180){if(_0x4af180){_0x413093=_0x4af180['remoteUri'];var _0x47a97a=_0x413093[_0x5379('0x68')](-0x1);if(_0x47a97a==='/'){_0x413093=_0x413093[_0x5379('0x69')](0x0,_0x413093['lastIndexOf'](_0x47a97a));}var _0x3f202e={'method':_0x5379('0x6a'),'uri':util[_0x5379('0x6b')]('%s/%s',_0x413093,_0x5379('0x6c')),'json':!![]};switch(_0x4af180[_0x5379('0x66')]){case _0x5379('0x64'):_0x3f202e[_0x5379('0x6d')]={'Authorization':util['format'](_0x5379('0x6e'),new Buffer(util['format'](_0x5379('0x6f'),_0x4af180[_0x5379('0x70')],_0x4af180[_0x5379('0x64')]))['toString']('base64'))};break;case'token':_0x3f202e[_0x5379('0x6d')]={'Authorization':util[_0x5379('0x6b')]('Basic\x20%s',new Buffer(util[_0x5379('0x6b')](_0x5379('0x71'),_0x4af180[_0x5379('0x70')],_0x4af180['token']))[_0x5379('0x72')](_0x5379('0x73')))};break;default:throw new db[(_0x5379('0x74'))][(_0x5379('0x1b'))](_0x5379('0x75'));}return rp(_0x3f202e);}})[_0x5379('0x1d')](function(_0x4eb62b){if(_0x4eb62b){var _0x2fbb74=[_0x5379('0x76'),'description',_0x5379('0x77'),_0x5379('0x78')];_[_0x5379('0x79')](_0x4eb62b[_0x5379('0x6c')],function(_0x37bbca){return _0x2fbb74[_0x5379('0x7a')](_0x37bbca['type']);});return{'count':_0x4eb62b[_0x5379('0x6c')][_0x5379('0x51')],'rows':_[_0x5379('0x37')](_0x4eb62b[_0x5379('0x6c')],function(_0x34d114){return{'id':_0x34d114['id'],'name':_0x34d114[_0x5379('0x7b')]>0x7?_0x34d114[_0x5379('0x7c')]:_0x34d114[_0x5379('0x3b')],'custom':_0x34d114[_0x5379('0x7b')]>0x7?!![]:![],'options':_0x34d114[_0x5379('0x7d')]?_0x34d114['system_field_options']:_0x34d114['custom_field_options']?_0x34d114[_0x5379('0x7e')]:[]};})};}})['then'](respondWithResult(_0x1f1844,null))[_0x5379('0x4f')](function(_0x27223a){var _0x451950=_0x4e973b[_0x5379('0x3f')][_0x5379('0x1a')]?0x1f4:_0x27223a[_0x5379('0x7f')]||0x1f4;logger[_0x5379('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x5379('0x63'),_0x451950,JSON[_0x5379('0x23')](_0x27223a));delete _0x27223a[_0x5379('0x3e')];if(_0x451950===0x191){_0x451950=0x190;}_0x1f1844['status'](_0x451950)[_0x5379('0x80')](_0x4e973b[_0x5379('0x3f')]['test']?{'message':_0x5379('0x81'),'statusCode':_0x27223a[_0x5379('0x7f')]}:_0x27223a);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 18c707f..78fabf1 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 _0xaf97=['../../components/integrations/configuration','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes'];(function(_0x563b4b,_0x3aaf11){var _0x1ea1a4=function(_0x4cd62a){while(--_0x4cd62a){_0x563b4b['push'](_0x563b4b['shift']());}};_0x1ea1a4(++_0x3aaf11);}(_0xaf97,0xd3));var _0x7af9=function(_0x2a1c87,_0xc8d07e){_0x2a1c87=_0x2a1c87-0x0;var _0x3439a1=_0xaf97[_0x2a1c87];return _0x3439a1;};'use strict';var _=require(_0x7af9('0x0'));var util=require(_0x7af9('0x1'));var logger=require(_0x7af9('0x2'))(_0x7af9('0x3'));var moment=require(_0x7af9('0x4'));var BPromise=require(_0x7af9('0x5'));var rp=require(_0x7af9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7af9('0x7'));var config=require('../../config/environment');var attributes=require(_0x7af9('0x8'));var integrations=require(_0x7af9('0x9'));module['exports']=function(_0x472012,_0x202b00){return _0x472012[_0x7af9('0xa')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffed=['lodash','api','moment','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts'];(function(_0x38bdd1,_0x513da3){var _0x263b9c=function(_0x4df541){while(--_0x4df541){_0x38bdd1['push'](_0x38bdd1['shift']());}};_0x263b9c(++_0x513da3);}(_0xffed,0x108));var _0xdffe=function(_0x5cf6e0,_0x43f9de){_0x5cf6e0=_0x5cf6e0-0x0;var _0x3dacdb=_0xffed[_0x5cf6e0];return _0x3dacdb;};'use strict';var _=require(_0xdffe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdffe('0x1'));var moment=require(_0xdffe('0x2'));var BPromise=require(_0xdffe('0x3'));var rp=require(_0xdffe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdffe('0x5'));var config=require('../../config/environment');var attributes=require(_0xdffe('0x6'));var integrations=require(_0xdffe('0x7'));module[_0xdffe('0x8')]=function(_0xaaebf1,_0x19587a){return _0xaaebf1[_0xdffe('0x9')]('ZendeskAccount',attributes,{'tableName':_0xdffe('0xa'),'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 85f5af0..117a261 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 _0xb7e7=['request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x24c2f6,_0x1cfdd1){var _0x4aaeaa=function(_0x51af29){while(--_0x51af29){_0x24c2f6['push'](_0x24c2f6['shift']());}};_0x4aaeaa(++_0x1cfdd1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'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')]('ZendeskAccount,\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);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetZendeskAccount',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['ZendeskAccount'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowZendeskAccount',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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['GetZendeskAccount']=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')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 753792e..76b7b55 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 _0x786f=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','destroy','multer'];(function(_0x512c6d,_0x5009ff){var _0x2ae871=function(_0x2bc9d0){while(--_0x2bc9d0){_0x512c6d['push'](_0x512c6d['shift']());}};_0x2ae871(++_0x5009ff);}(_0x786f,0x16b));var _0xf786=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x786f[_0x476b00];return _0x44ec8e;};'use strict';var multer=require(_0xf786('0x0'));var util=require(_0xf786('0x1'));var path=require(_0xf786('0x2'));var timeout=require(_0xf786('0x3'));var express=require('express');var router=express[_0xf786('0x4')]();var auth=require(_0xf786('0x5'));var interaction=require(_0xf786('0x6'));var config=require(_0xf786('0x7'));var controller=require(_0xf786('0x8'));router[_0xf786('0x9')]('/',auth[_0xf786('0xa')](),controller[_0xf786('0xb')]);router['get'](_0xf786('0xc'),auth[_0xf786('0xa')](),controller[_0xf786('0xd')]);router[_0xf786('0x9')](_0xf786('0xe'),auth[_0xf786('0xa')](),controller[_0xf786('0xf')]);router[_0xf786('0x9')]('/:id/subjects',auth[_0xf786('0xa')](),controller[_0xf786('0x10')]);router[_0xf786('0x9')](_0xf786('0x11'),auth['isAuthenticated'](),controller[_0xf786('0x12')]);router[_0xf786('0x9')](_0xf786('0x13'),auth[_0xf786('0xa')](),controller[_0xf786('0x14')]);router[_0xf786('0x15')]('/',auth[_0xf786('0xa')](),controller['create']);router['post'](_0xf786('0x13'),auth[_0xf786('0xa')](),controller[_0xf786('0x16')]);router[_0xf786('0x17')](_0xf786('0xc'),auth[_0xf786('0xa')](),controller[_0xf786('0x18')]);router['delete']('/:id',auth[_0xf786('0xa')](),controller[_0xf786('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc99d=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','destroy','exports','multer','util'];(function(_0x5aadc1,_0x13af65){var _0x36eb9b=function(_0x4d89c5){while(--_0x4d89c5){_0x5aadc1['push'](_0x5aadc1['shift']());}};_0x36eb9b(++_0x13af65);}(_0xc99d,0xd6));var _0xdc99=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xc99d[_0x186376];return _0x2dbdd9;};'use strict';var multer=require(_0xdc99('0x0'));var util=require(_0xdc99('0x1'));var path=require(_0xdc99('0x2'));var timeout=require(_0xdc99('0x3'));var express=require(_0xdc99('0x4'));var router=express[_0xdc99('0x5')]();var auth=require(_0xdc99('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc99('0x7'));var controller=require(_0xdc99('0x8'));router['get']('/',auth[_0xdc99('0x9')](),controller['index']);router[_0xdc99('0xa')]('/:id',auth[_0xdc99('0x9')](),controller[_0xdc99('0xb')]);router[_0xdc99('0xa')](_0xdc99('0xc'),auth[_0xdc99('0x9')](),controller[_0xdc99('0xd')]);router[_0xdc99('0xa')]('/:id/subjects',auth[_0xdc99('0x9')](),controller[_0xdc99('0xe')]);router[_0xdc99('0xa')](_0xdc99('0xf'),auth[_0xdc99('0x9')](),controller[_0xdc99('0x10')]);router[_0xdc99('0xa')](_0xdc99('0x11'),auth['isAuthenticated'](),controller[_0xdc99('0x12')]);router['post']('/',auth[_0xdc99('0x9')](),controller[_0xdc99('0x13')]);router[_0xdc99('0x14')](_0xdc99('0x11'),auth[_0xdc99('0x9')](),controller[_0xdc99('0x15')]);router[_0xdc99('0x16')](_0xdc99('0x17'),auth[_0xdc99('0x9')](),controller[_0xdc99('0x18')]);router['delete']('/:id',auth[_0xdc99('0x9')](),controller[_0xdc99('0x19')]);module[_0xdc99('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 38a3a63..8f6d9be 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 _0x5be6=['exports','STRING','sequelize'];(function(_0x2bcb75,_0x5789a7){var _0x175345=function(_0x3a7d41){while(--_0x3a7d41){_0x2bcb75['push'](_0x2bcb75['shift']());}};_0x175345(++_0x5789a7);}(_0x5be6,0x149));var _0x65be=function(_0x18bbe1,_0x165954){_0x18bbe1=_0x18bbe1-0x0;var _0xf67fba=_0x5be6[_0x18bbe1];return _0xf67fba;};'use strict';var Sequelize=require(_0x65be('0x0'));module[_0x65be('0x1')]={'name':{'type':Sequelize[_0x65be('0x2')]},'description':{'type':Sequelize[_0x65be('0x2')]}}; \ No newline at end of file +var _0x747b=['STRING','sequelize','exports'];(function(_0x4c5d4e,_0x5bf774){var _0x1c3529=function(_0x11d997){while(--_0x11d997){_0x4c5d4e['push'](_0x4c5d4e['shift']());}};_0x1c3529(++_0x5bf774);}(_0x747b,0x1f0));var _0xb747=function(_0xefd1a8,_0x546820){_0xefd1a8=_0xefd1a8-0x0;var _0x2de35f=_0x747b[_0xefd1a8];return _0x2de35f;};'use strict';var Sequelize=require(_0xb747('0x0'));module[_0xb747('0x1')]={'name':{'type':Sequelize[_0xb747('0x2')]},'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 75b4793..7dd1997 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 _0xfc61=['pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','create','body','find','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','end','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x2df7f2,_0x5cda50){var _0x477d6a=function(_0x1b60da){while(--_0x1b60da){_0x2df7f2['push'](_0x2df7f2['shift']());}};_0x477d6a(++_0x5cda50);}(_0xfc61,0x135));var _0x1fc6=function(_0x9e9ead,_0x1a7ff3){_0x9e9ead=_0x9e9ead-0x0;var _0x31ff57=_0xfc61[_0x9e9ead];return _0x31ff57;};'use strict';var pdf=require(_0x1fc6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1fc6('0x1'));var jsonpatch=require(_0x1fc6('0x2'));var rp=require(_0x1fc6('0x3'));var moment=require(_0x1fc6('0x4'));var BPromise=require(_0x1fc6('0x5'));var Mustache=require('mustache');var util=require(_0x1fc6('0x6'));var path=require('path');var sox=require(_0x1fc6('0x7'));var csv=require(_0x1fc6('0x8'));var ejs=require(_0x1fc6('0x9'));var fs=require('fs');var _=require(_0x1fc6('0xa'));var squel=require(_0x1fc6('0xb'));var crypto=require(_0x1fc6('0xc'));var jsforce=require(_0x1fc6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1fc6('0x8'));var querystring=require(_0x1fc6('0xe'));var Papa=require(_0x1fc6('0xf'));var Redis=require(_0x1fc6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1fc6('0x11'));var as=require(_0x1fc6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1fc6('0x13'));var utils=require('../../config/utils');var config=require(_0x1fc6('0x14'));var db=require(_0x1fc6('0x15'))['db'];var jayson=require(_0x1fc6('0x16'));var client=jayson['client'][_0x1fc6('0x17')]({'port':0x232a});function checkPasswordPattern(_0x97ffaa,_0x1bcc43,_0x37a210){if(_0x37a210){var _0x5be60a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5be60a[_0x1fc6('0x18')](_0x1bcc43)){return _0x97ffaa;}else{throw new db[(_0x1fc6('0x19'))][(_0x1fc6('0x1a'))](_0x1fc6('0x1b'));}}else{return _0x97ffaa;}}function respondWithRpcPromise(_0xa9e8d3,_0x1dfc1b,_0x3d77e9,_0x6213d7){return new BPromise(function(_0x11ae4a,_0x5b93a5){var _0x5b8cf9=_0x6213d7||client;return _0x5b8cf9[_0x1fc6('0x1c')](_0xa9e8d3,_0x3d77e9)[_0x1fc6('0x1d')](function(_0x18feb5){logger[_0x1fc6('0x1e')](_0x1fc6('0x1f'),_0x1dfc1b,_0x1fc6('0x20'));logger[_0x1fc6('0x21')](_0x1fc6('0x22'),_0x1dfc1b,_0x1fc6('0x20'),JSON[_0x1fc6('0x23')](_0x18feb5));if(_0x18feb5['error']){if(_0x18feb5[_0x1fc6('0x24')][_0x1fc6('0x25')]===0x1f4){logger[_0x1fc6('0x24')](_0x1fc6('0x1f'),_0x1dfc1b,_0x18feb5['error'][_0x1fc6('0x26')]);return _0x5b93a5(_0x18feb5['error'][_0x1fc6('0x26')]);}logger['error'](_0x1fc6('0x1f'),_0x1dfc1b,_0x18feb5[_0x1fc6('0x24')]['message']);return _0x11ae4a(_0x18feb5[_0x1fc6('0x24')]['message']);}else{logger[_0x1fc6('0x1e')](_0x1fc6('0x1f'),_0x1dfc1b,'request\x20sent');_0x11ae4a(_0x18feb5[_0x1fc6('0x27')][_0x1fc6('0x26')]);}})[_0x1fc6('0x28')](function(_0x3cbee6){logger[_0x1fc6('0x24')](_0x1fc6('0x1f'),_0x1dfc1b,_0x3cbee6);_0x5b93a5(_0x3cbee6);});});}function respondWithStatusCode(_0x2b9525,_0x3bf1e5){_0x3bf1e5=_0x3bf1e5||0xcc;return function(_0x245bd4){if(_0x245bd4){return _0x2b9525[_0x1fc6('0x29')](_0x3bf1e5);}return _0x2b9525[_0x1fc6('0x2a')](_0x3bf1e5)['end']();};}function respondWithResult(_0x54f755,_0x38e623){_0x38e623=_0x38e623||0xc8;return function(_0x13fd1b){if(_0x13fd1b){return _0x54f755[_0x1fc6('0x2a')](_0x38e623)[_0x1fc6('0x2b')](_0x13fd1b);}};}function respondWithFilteredResult(_0x193594,_0x7851d1){return function(_0x1fec2b){if(_0x1fec2b){var _0x28e8b4=_0x1fec2b[_0x1fc6('0x2c')],_0x46eb40=_0x7851d1[_0x1fc6('0x2d')],_0x3e4284=_0x7851d1['offset']+_0x7851d1['limit'],_0x369bb0;if(_0x3e4284>=_0x28e8b4){_0x3e4284=_0x28e8b4;_0x369bb0=0xc8;}else{_0x369bb0=0xce;}_0x193594['status'](_0x369bb0);return _0x193594[_0x1fc6('0x2e')](_0x1fc6('0x2f'),_0x46eb40+'-'+_0x3e4284+'/'+_0x28e8b4)['json'](_0x1fec2b);}return null;};}function patchUpdates(_0x5f6480){return function(_0x3c2c02){try{jsonpatch[_0x1fc6('0x30')](_0x3c2c02,_0x5f6480,!![]);}catch(_0x4d0191){return BPromise[_0x1fc6('0x31')](_0x4d0191);}return _0x3c2c02['save']();};}function saveUpdates(_0x3bf311,_0x30f937){return function(_0x8a0ee7){if(_0x8a0ee7){return _0x8a0ee7[_0x1fc6('0x32')](_0x3bf311)[_0x1fc6('0x1d')](function(_0x2a5139){return _0x2a5139;});}return null;};}function removeEntity(_0x3945d2,_0x53bbc5){return function(_0x393836){if(_0x393836){return _0x393836[_0x1fc6('0x33')]()['then'](function(){_0x3945d2[_0x1fc6('0x2a')](0xcc)[_0x1fc6('0x34')]();});}};}function handleEntityNotFound(_0x452bd7,_0x554a33){return function(_0xbf8b6d){if(!_0xbf8b6d){_0x452bd7[_0x1fc6('0x29')](0x194);}return _0xbf8b6d;};}function handleError(_0x919b44,_0x22144a){_0x22144a=_0x22144a||0x1f4;return function(_0x1faef5){logger[_0x1fc6('0x24')](_0x1faef5['stack']);if(_0x1faef5[_0x1fc6('0x35')]){delete _0x1faef5[_0x1fc6('0x35')];}_0x919b44[_0x1fc6('0x2a')](_0x22144a)[_0x1fc6('0x36')](_0x1faef5);};}exports[_0x1fc6('0x37')]=function(_0x4ca71a,_0x5cd8a5){var _0x4139d8={},_0x4669ee={},_0x518738={'count':0x0,'rows':[]};var _0x227649=_[_0x1fc6('0x38')](db[_0x1fc6('0x39')][_0x1fc6('0x3a')],function(_0x419acd){return{'name':_0x419acd[_0x1fc6('0x3b')],'type':_0x419acd[_0x1fc6('0x3c')][_0x1fc6('0x3d')]};});_0x4669ee[_0x1fc6('0x3e')]=_[_0x1fc6('0x38')](_0x227649,'name');_0x4669ee[_0x1fc6('0x3f')]=_[_0x1fc6('0x40')](_0x4ca71a[_0x1fc6('0x3f')]);_0x4669ee[_0x1fc6('0x41')]=_[_0x1fc6('0x42')](_0x4669ee[_0x1fc6('0x3e')],_0x4669ee['query']);_0x4139d8['attributes']=_[_0x1fc6('0x42')](_0x4669ee['model'],qs[_0x1fc6('0x43')](_0x4ca71a[_0x1fc6('0x3f')][_0x1fc6('0x43')]));_0x4139d8['attributes']=_0x4139d8[_0x1fc6('0x44')][_0x1fc6('0x45')]?_0x4139d8[_0x1fc6('0x44')]:_0x4669ee[_0x1fc6('0x3e')];if(!_0x4ca71a['query'][_0x1fc6('0x46')](_0x1fc6('0x47'))){_0x4139d8[_0x1fc6('0x48')]=qs[_0x1fc6('0x48')](_0x4ca71a[_0x1fc6('0x3f')][_0x1fc6('0x48')]);_0x4139d8[_0x1fc6('0x2d')]=qs[_0x1fc6('0x2d')](_0x4ca71a[_0x1fc6('0x3f')][_0x1fc6('0x2d')]);}_0x4139d8['order']=qs[_0x1fc6('0x49')](_0x4ca71a[_0x1fc6('0x3f')][_0x1fc6('0x49')]);_0x4139d8[_0x1fc6('0x4a')]=qs[_0x1fc6('0x41')](_[_0x1fc6('0x4b')](_0x4ca71a['query'],_0x4669ee[_0x1fc6('0x41')]),_0x227649);if(_0x4ca71a[_0x1fc6('0x3f')][_0x1fc6('0x4c')]){_0x4139d8['where']=_['merge'](_0x4139d8[_0x1fc6('0x4a')],{'$or':_[_0x1fc6('0x38')](_0x227649,function(_0x18612b){if(_0x18612b[_0x1fc6('0x3c')]!==_0x1fc6('0x4d')){var _0x110d32={};_0x110d32[_0x18612b[_0x1fc6('0x35')]]={'$like':'%'+_0x4ca71a['query'][_0x1fc6('0x4c')]+'%'};return _0x110d32;}})});}_0x4139d8=_[_0x1fc6('0x4e')]({},_0x4139d8,_0x4ca71a[_0x1fc6('0x4f')]);var _0x491c37={'where':_0x4139d8[_0x1fc6('0x4a')]};return db[_0x1fc6('0x39')][_0x1fc6('0x2c')](_0x491c37)[_0x1fc6('0x1d')](function(_0x1b9e32){_0x518738['count']=_0x1b9e32;if(_0x4ca71a[_0x1fc6('0x3f')][_0x1fc6('0x50')]){_0x4139d8[_0x1fc6('0x51')]=[{'all':!![]}];}return db[_0x1fc6('0x39')][_0x1fc6('0x52')](_0x4139d8);})['then'](function(_0x4f6e65){_0x518738['rows']=_0x4f6e65;return _0x518738;})[_0x1fc6('0x1d')](respondWithFilteredResult(_0x5cd8a5,_0x4139d8))[_0x1fc6('0x28')](handleError(_0x5cd8a5,null));};exports[_0x1fc6('0x53')]=function(_0x459ec2,_0x4eff24){var _0xb0afd5={'raw':![],'where':{'id':_0x459ec2[_0x1fc6('0x54')]['id']}},_0x5a2336={};_0x5a2336[_0x1fc6('0x3e')]=_[_0x1fc6('0x40')](db[_0x1fc6('0x39')][_0x1fc6('0x3a')]);_0x5a2336[_0x1fc6('0x3f')]=_[_0x1fc6('0x40')](_0x459ec2[_0x1fc6('0x3f')]);_0x5a2336[_0x1fc6('0x41')]=_[_0x1fc6('0x42')](_0x5a2336['model'],_0x5a2336[_0x1fc6('0x3f')]);_0xb0afd5[_0x1fc6('0x44')]=_[_0x1fc6('0x42')](_0x5a2336['model'],qs[_0x1fc6('0x43')](_0x459ec2['query'][_0x1fc6('0x43')]));_0xb0afd5[_0x1fc6('0x44')]=_0xb0afd5[_0x1fc6('0x44')][_0x1fc6('0x45')]?_0xb0afd5[_0x1fc6('0x44')]:_0x5a2336[_0x1fc6('0x3e')];if(_0x459ec2[_0x1fc6('0x3f')][_0x1fc6('0x50')]){_0xb0afd5[_0x1fc6('0x51')]=[{'all':!![]}];}_0xb0afd5=_[_0x1fc6('0x4e')]({},_0xb0afd5,_0x459ec2[_0x1fc6('0x4f')]);return db[_0x1fc6('0x39')]['find'](_0xb0afd5)[_0x1fc6('0x1d')](handleEntityNotFound(_0x4eff24,null))[_0x1fc6('0x1d')](respondWithResult(_0x4eff24,null))[_0x1fc6('0x28')](handleError(_0x4eff24,null));};exports['create']=function(_0x4b6b37,_0x3623ff){return db[_0x1fc6('0x39')][_0x1fc6('0x55')](_0x4b6b37['body'],{})[_0x1fc6('0x1d')](respondWithResult(_0x3623ff,0xc9))['catch'](handleError(_0x3623ff,null));};exports[_0x1fc6('0x32')]=function(_0x13962b,_0x547cde){if(_0x13962b[_0x1fc6('0x56')]['id']){delete _0x13962b['body']['id'];}return db[_0x1fc6('0x39')][_0x1fc6('0x57')]({'where':{'id':_0x13962b[_0x1fc6('0x54')]['id']}})[_0x1fc6('0x1d')](handleEntityNotFound(_0x547cde,null))[_0x1fc6('0x1d')](saveUpdates(_0x13962b[_0x1fc6('0x56')],null))[_0x1fc6('0x1d')](respondWithResult(_0x547cde,null))[_0x1fc6('0x28')](handleError(_0x547cde,null));};exports[_0x1fc6('0x33')]=function(_0x4d4800,_0x45fd15){return db[_0x1fc6('0x39')][_0x1fc6('0x57')]({'where':{'id':_0x4d4800[_0x1fc6('0x54')]['id']}})[_0x1fc6('0x1d')](handleEntityNotFound(_0x45fd15,null))['then'](removeEntity(_0x45fd15,null))[_0x1fc6('0x28')](handleError(_0x45fd15,null));};exports[_0x1fc6('0x58')]=function(_0x4cd093,_0x50b462,_0x2a7d39){var _0x4ccb61={};var _0x3ac605={};var _0x316a2f;var _0x1de29f;return db[_0x1fc6('0x39')][_0x1fc6('0x59')]({'where':{'id':_0x4cd093[_0x1fc6('0x54')]['id']}})[_0x1fc6('0x1d')](handleEntityNotFound(_0x50b462,null))['then'](function(_0x225d2c){if(_0x225d2c){_0x316a2f=_0x225d2c;_0x3ac605[_0x1fc6('0x3e')]=_[_0x1fc6('0x40')](db[_0x1fc6('0x5a')][_0x1fc6('0x3a')]);_0x3ac605[_0x1fc6('0x3f')]=_[_0x1fc6('0x40')](_0x4cd093[_0x1fc6('0x3f')]);_0x3ac605[_0x1fc6('0x41')]=_[_0x1fc6('0x42')](_0x3ac605[_0x1fc6('0x3e')],_0x3ac605[_0x1fc6('0x3f')]);_0x4ccb61[_0x1fc6('0x44')]=_[_0x1fc6('0x42')](_0x3ac605[_0x1fc6('0x3e')],qs[_0x1fc6('0x43')](_0x4cd093[_0x1fc6('0x3f')][_0x1fc6('0x43')]));_0x4ccb61[_0x1fc6('0x44')]=_0x4ccb61[_0x1fc6('0x44')][_0x1fc6('0x45')]?_0x4ccb61[_0x1fc6('0x44')]:_0x3ac605[_0x1fc6('0x3e')];_0x4ccb61['order']=qs[_0x1fc6('0x49')](_0x4cd093[_0x1fc6('0x3f')]['sort']);_0x4ccb61[_0x1fc6('0x4a')]=qs[_0x1fc6('0x41')](_[_0x1fc6('0x4b')](_0x4cd093[_0x1fc6('0x3f')],_0x3ac605['filters']));if(_0x4cd093[_0x1fc6('0x3f')]['filter']){_0x4ccb61[_0x1fc6('0x4a')]=_['merge'](_0x4ccb61[_0x1fc6('0x4a')],{'$or':_[_0x1fc6('0x38')](_0x4ccb61['attributes'],function(_0x13a4b7){var _0xd81500={};_0xd81500[_0x13a4b7]={'$like':'%'+_0x4cd093[_0x1fc6('0x3f')][_0x1fc6('0x4c')]+'%'};return _0xd81500;})});}_0x4ccb61=_[_0x1fc6('0x4e')]({},_0x4ccb61,_0x4cd093[_0x1fc6('0x4f')]);return _0x316a2f['getFields'](_0x4ccb61);}})[_0x1fc6('0x1d')](function(_0x354a39){if(_0x354a39){_0x1de29f=_0x354a39[_0x1fc6('0x45')];if(!_0x4cd093[_0x1fc6('0x3f')][_0x1fc6('0x46')](_0x1fc6('0x47'))){_0x4ccb61[_0x1fc6('0x48')]=qs[_0x1fc6('0x48')](_0x4cd093[_0x1fc6('0x3f')][_0x1fc6('0x48')]);_0x4ccb61['offset']=qs[_0x1fc6('0x2d')](_0x4cd093[_0x1fc6('0x3f')]['offset']);}return _0x316a2f['getFields'](_0x4ccb61);}})['then'](function(_0x40e518){if(_0x40e518){return _0x40e518?{'count':_0x1de29f,'rows':_0x40e518}:null;}})['then'](respondWithResult(_0x50b462,null))['catch'](handleError(_0x50b462,null));};exports['getSubjects']=function(_0xc41958,_0x1a5cac,_0xcca81f){var _0xce57aa={};var _0x3af637={};var _0x4636ee;var _0x2826be;return db['ZendeskConfiguration'][_0x1fc6('0x59')]({'where':{'id':_0xc41958['params']['id']}})[_0x1fc6('0x1d')](handleEntityNotFound(_0x1a5cac,null))[_0x1fc6('0x1d')](function(_0x57a2f6){if(_0x57a2f6){_0x4636ee=_0x57a2f6;_0x3af637['model']=_[_0x1fc6('0x40')](db[_0x1fc6('0x5a')]['rawAttributes']);_0x3af637[_0x1fc6('0x3f')]=_[_0x1fc6('0x40')](_0xc41958['query']);_0x3af637[_0x1fc6('0x41')]=_[_0x1fc6('0x42')](_0x3af637['model'],_0x3af637[_0x1fc6('0x3f')]);_0xce57aa[_0x1fc6('0x44')]=_[_0x1fc6('0x42')](_0x3af637[_0x1fc6('0x3e')],qs['fields'](_0xc41958['query'][_0x1fc6('0x43')]));_0xce57aa[_0x1fc6('0x44')]=_0xce57aa[_0x1fc6('0x44')][_0x1fc6('0x45')]?_0xce57aa[_0x1fc6('0x44')]:_0x3af637[_0x1fc6('0x3e')];_0xce57aa['order']=qs[_0x1fc6('0x49')](_0xc41958[_0x1fc6('0x3f')]['sort']);_0xce57aa[_0x1fc6('0x4a')]=qs[_0x1fc6('0x41')](_['pick'](_0xc41958[_0x1fc6('0x3f')],_0x3af637['filters']));if(_0xc41958[_0x1fc6('0x3f')][_0x1fc6('0x4c')]){_0xce57aa[_0x1fc6('0x4a')]=_[_0x1fc6('0x4e')](_0xce57aa[_0x1fc6('0x4a')],{'$or':_[_0x1fc6('0x38')](_0xce57aa['attributes'],function(_0x4607d0){var _0x1312db={};_0x1312db[_0x4607d0]={'$like':'%'+_0xc41958[_0x1fc6('0x3f')][_0x1fc6('0x4c')]+'%'};return _0x1312db;})});}_0xce57aa=_[_0x1fc6('0x4e')]({},_0xce57aa,_0xc41958['options']);return _0x4636ee['getSubjects'](_0xce57aa);}})[_0x1fc6('0x1d')](function(_0x23ed78){if(_0x23ed78){_0x2826be=_0x23ed78[_0x1fc6('0x45')];if(!_0xc41958[_0x1fc6('0x3f')][_0x1fc6('0x46')]('nolimit')){_0xce57aa['limit']=qs['limit'](_0xc41958['query'][_0x1fc6('0x48')]);_0xce57aa[_0x1fc6('0x2d')]=qs['offset'](_0xc41958[_0x1fc6('0x3f')][_0x1fc6('0x2d')]);}return _0x4636ee[_0x1fc6('0x5b')](_0xce57aa);}})[_0x1fc6('0x1d')](function(_0x51651e){if(_0x51651e){return _0x51651e?{'count':_0x2826be,'rows':_0x51651e}:null;}})[_0x1fc6('0x1d')](respondWithResult(_0x1a5cac,null))[_0x1fc6('0x28')](handleError(_0x1a5cac,null));};exports['getDescriptions']=function(_0x5f2d8c,_0x478042,_0x2963d6){var _0x49b4ff={};var _0x325a80={};var _0x565b52;var _0x53f52b;return db[_0x1fc6('0x39')][_0x1fc6('0x59')]({'where':{'id':_0x5f2d8c[_0x1fc6('0x54')]['id']}})[_0x1fc6('0x1d')](handleEntityNotFound(_0x478042,null))[_0x1fc6('0x1d')](function(_0xd261e1){if(_0xd261e1){_0x565b52=_0xd261e1;_0x325a80[_0x1fc6('0x3e')]=_[_0x1fc6('0x40')](db['ZendeskField'][_0x1fc6('0x3a')]);_0x325a80[_0x1fc6('0x3f')]=_['keys'](_0x5f2d8c['query']);_0x325a80['filters']=_['intersection'](_0x325a80[_0x1fc6('0x3e')],_0x325a80[_0x1fc6('0x3f')]);_0x49b4ff['attributes']=_[_0x1fc6('0x42')](_0x325a80[_0x1fc6('0x3e')],qs[_0x1fc6('0x43')](_0x5f2d8c[_0x1fc6('0x3f')][_0x1fc6('0x43')]));_0x49b4ff[_0x1fc6('0x44')]=_0x49b4ff[_0x1fc6('0x44')][_0x1fc6('0x45')]?_0x49b4ff['attributes']:_0x325a80['model'];_0x49b4ff['order']=qs[_0x1fc6('0x49')](_0x5f2d8c[_0x1fc6('0x3f')]['sort']);_0x49b4ff[_0x1fc6('0x4a')]=qs['filters'](_['pick'](_0x5f2d8c[_0x1fc6('0x3f')],_0x325a80[_0x1fc6('0x41')]));if(_0x5f2d8c[_0x1fc6('0x3f')][_0x1fc6('0x4c')]){_0x49b4ff[_0x1fc6('0x4a')]=_[_0x1fc6('0x4e')](_0x49b4ff[_0x1fc6('0x4a')],{'$or':_['map'](_0x49b4ff[_0x1fc6('0x44')],function(_0x4cef73){var _0x12122f={};_0x12122f[_0x4cef73]={'$like':'%'+_0x5f2d8c['query'][_0x1fc6('0x4c')]+'%'};return _0x12122f;})});}_0x49b4ff=_[_0x1fc6('0x4e')]({},_0x49b4ff,_0x5f2d8c[_0x1fc6('0x4f')]);return _0x565b52[_0x1fc6('0x5c')](_0x49b4ff);}})[_0x1fc6('0x1d')](function(_0x4c6b85){if(_0x4c6b85){_0x53f52b=_0x4c6b85[_0x1fc6('0x45')];if(!_0x5f2d8c[_0x1fc6('0x3f')][_0x1fc6('0x46')](_0x1fc6('0x47'))){_0x49b4ff[_0x1fc6('0x48')]=qs[_0x1fc6('0x48')](_0x5f2d8c[_0x1fc6('0x3f')][_0x1fc6('0x48')]);_0x49b4ff[_0x1fc6('0x2d')]=qs[_0x1fc6('0x2d')](_0x5f2d8c[_0x1fc6('0x3f')][_0x1fc6('0x2d')]);}return _0x565b52['getDescriptions'](_0x49b4ff);}})[_0x1fc6('0x1d')](function(_0x3de9d7){if(_0x3de9d7){return _0x3de9d7?{'count':_0x53f52b,'rows':_0x3de9d7}:null;}})[_0x1fc6('0x1d')](respondWithResult(_0x478042,null))[_0x1fc6('0x28')](handleError(_0x478042,null));};exports['getTags']=function(_0x57bdde,_0x4f7125,_0x461a6a){var _0x1b4ed6={};var _0x34afbc={};var _0xe5bc40;var _0x2a44bb;return db[_0x1fc6('0x39')]['findOne']({'where':{'id':_0x57bdde['params']['id']}})[_0x1fc6('0x1d')](handleEntityNotFound(_0x4f7125,null))[_0x1fc6('0x1d')](function(_0x10e5fa){if(_0x10e5fa){_0xe5bc40=_0x10e5fa;_0x34afbc[_0x1fc6('0x3e')]=_['keys'](db['Tag'][_0x1fc6('0x3a')]);_0x34afbc[_0x1fc6('0x3f')]=_['keys'](_0x57bdde[_0x1fc6('0x3f')]);_0x34afbc[_0x1fc6('0x41')]=_[_0x1fc6('0x42')](_0x34afbc[_0x1fc6('0x3e')],_0x34afbc[_0x1fc6('0x3f')]);_0x1b4ed6[_0x1fc6('0x44')]=_[_0x1fc6('0x42')](_0x34afbc[_0x1fc6('0x3e')],qs['fields'](_0x57bdde['query'][_0x1fc6('0x43')]));_0x1b4ed6[_0x1fc6('0x44')]=_0x1b4ed6['attributes'][_0x1fc6('0x45')]?_0x1b4ed6[_0x1fc6('0x44')]:_0x34afbc[_0x1fc6('0x3e')];_0x1b4ed6['order']=qs[_0x1fc6('0x49')](_0x57bdde[_0x1fc6('0x3f')][_0x1fc6('0x49')]);_0x1b4ed6[_0x1fc6('0x4a')]=qs[_0x1fc6('0x41')](_['pick'](_0x57bdde[_0x1fc6('0x3f')],_0x34afbc[_0x1fc6('0x41')]));if(_0x57bdde[_0x1fc6('0x3f')][_0x1fc6('0x4c')]){_0x1b4ed6[_0x1fc6('0x4a')]=_['merge'](_0x1b4ed6[_0x1fc6('0x4a')],{'$or':_[_0x1fc6('0x38')](_0x1b4ed6[_0x1fc6('0x44')],function(_0x1f034d){var _0x51beb9={};_0x51beb9[_0x1f034d]={'$like':'%'+_0x57bdde[_0x1fc6('0x3f')][_0x1fc6('0x4c')]+'%'};return _0x51beb9;})});}_0x1b4ed6=_[_0x1fc6('0x4e')]({},_0x1b4ed6,_0x57bdde['options']);return _0xe5bc40[_0x1fc6('0x5d')](_0x1b4ed6);}})['then'](function(_0x1e3ebd){if(_0x1e3ebd){_0x2a44bb=_0x1e3ebd[_0x1fc6('0x45')];if(!_0x57bdde[_0x1fc6('0x3f')][_0x1fc6('0x46')](_0x1fc6('0x47'))){_0x1b4ed6[_0x1fc6('0x48')]=qs[_0x1fc6('0x48')](_0x57bdde['query'][_0x1fc6('0x48')]);_0x1b4ed6[_0x1fc6('0x2d')]=qs[_0x1fc6('0x2d')](_0x57bdde[_0x1fc6('0x3f')][_0x1fc6('0x2d')]);}return _0xe5bc40['getTags'](_0x1b4ed6);}})[_0x1fc6('0x1d')](function(_0x4636fd){if(_0x4636fd){return _0x4636fd?{'count':_0x2a44bb,'rows':_0x4636fd}:null;}})['then'](respondWithResult(_0x4f7125,null))['catch'](handleError(_0x4f7125,null));};exports[_0x1fc6('0x5e')]=function(_0x585859,_0x2b0cb0,_0x34ce2d){if(_0x585859[_0x1fc6('0x56')]['id']){delete _0x585859[_0x1fc6('0x56')]['id'];}return db[_0x1fc6('0x39')][_0x1fc6('0x59')]({'where':{'id':_0x585859[_0x1fc6('0x54')]['id']}})[_0x1fc6('0x1d')](handleEntityNotFound(_0x2b0cb0,null))[_0x1fc6('0x1d')](function(_0x8a848f){if(_0x8a848f){return _0x8a848f[_0x1fc6('0x5e')](_0x585859[_0x1fc6('0x56')][_0x1fc6('0x5f')]||[]);}return null;})[_0x1fc6('0x1d')](respondWithResult(_0x2b0cb0,null))[_0x1fc6('0x28')](handleError(_0x2b0cb0,null));}; \ No newline at end of file +var _0x8aea=['getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','debug','stringify','code','ZendeskConfiguration,\x20%s,\x20%s','error','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','stack','index','map','ZendeskConfiguration','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','create','body','find','destroy','getFields','findOne','hasOwnProperty','getSubjects','ZendeskField'];(function(_0x40e8bf,_0x2b96f6){var _0x41f683=function(_0x5baef1){while(--_0x5baef1){_0x40e8bf['push'](_0x40e8bf['shift']());}};_0x41f683(++_0x2b96f6);}(_0x8aea,0x181));var _0xa8ae=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8aea[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa8ae('0x0'));var rimraf=require(_0xa8ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8ae('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa8ae('0x3'));var Mustache=require(_0xa8ae('0x4'));var util=require(_0xa8ae('0x5'));var path=require(_0xa8ae('0x6'));var sox=require(_0xa8ae('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa8ae('0x8'));var squel=require(_0xa8ae('0x9'));var crypto=require(_0xa8ae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa8ae('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa8ae('0xc'));var Redis=require(_0xa8ae('0xd'));var authService=require(_0xa8ae('0xe'));var qs=require(_0xa8ae('0xf'));var as=require(_0xa8ae('0x10'));var hardwareService=require(_0xa8ae('0x11'));var logger=require(_0xa8ae('0x12'))(_0xa8ae('0x13'));var utils=require(_0xa8ae('0x14'));var config=require(_0xa8ae('0x15'));var db=require(_0xa8ae('0x16'))['db'];var jayson=require(_0xa8ae('0x17'));var client=jayson[_0xa8ae('0x18')][_0xa8ae('0x19')]({'port':0x232a});function checkPasswordPattern(_0x19ada5,_0x2d314f,_0x5e7d8c){if(_0x5e7d8c){var _0x5cc3bd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5cc3bd[_0xa8ae('0x1a')](_0x2d314f)){return _0x19ada5;}else{throw new db['Sequelize']['ValidationError'](_0xa8ae('0x1b'));}}else{return _0x19ada5;}}function respondWithRpcPromise(_0x498e07,_0x492e19,_0x2ae462,_0x2338bc){return new BPromise(function(_0xa8fc14,_0xcdc9dd){var _0x4272a0=_0x2338bc||client;return _0x4272a0['request'](_0x498e07,_0x2ae462)['then'](function(_0x23c515){logger[_0xa8ae('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x492e19,'request\x20sent');logger[_0xa8ae('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x492e19,'request\x20sent',JSON[_0xa8ae('0x1e')](_0x23c515));if(_0x23c515['error']){if(_0x23c515['error'][_0xa8ae('0x1f')]===0x1f4){logger['error'](_0xa8ae('0x20'),_0x492e19,_0x23c515[_0xa8ae('0x21')][_0xa8ae('0x22')]);return _0xcdc9dd(_0x23c515['error'][_0xa8ae('0x22')]);}logger['error'](_0xa8ae('0x20'),_0x492e19,_0x23c515['error'][_0xa8ae('0x22')]);return _0xa8fc14(_0x23c515['error'][_0xa8ae('0x22')]);}else{logger[_0xa8ae('0x1c')](_0xa8ae('0x20'),_0x492e19,_0xa8ae('0x23'));_0xa8fc14(_0x23c515[_0xa8ae('0x24')][_0xa8ae('0x22')]);}})[_0xa8ae('0x25')](function(_0x4f880f){logger[_0xa8ae('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x492e19,_0x4f880f);_0xcdc9dd(_0x4f880f);});});}function respondWithStatusCode(_0x1e4957,_0x2d283b){_0x2d283b=_0x2d283b||0xcc;return function(_0x242939){if(_0x242939){return _0x1e4957[_0xa8ae('0x26')](_0x2d283b);}return _0x1e4957[_0xa8ae('0x27')](_0x2d283b)['end']();};}function respondWithResult(_0x509c1e,_0xdf4128){_0xdf4128=_0xdf4128||0xc8;return function(_0x54ddee){if(_0x54ddee){return _0x509c1e['status'](_0xdf4128)[_0xa8ae('0x28')](_0x54ddee);}};}function respondWithFilteredResult(_0x47fb79,_0xe18d0c){return function(_0x14d0c1){if(_0x14d0c1){var _0x22ca7d=_0x14d0c1[_0xa8ae('0x29')],_0x413145=_0xe18d0c['offset'],_0x12fc70=_0xe18d0c[_0xa8ae('0x2a')]+_0xe18d0c[_0xa8ae('0x2b')],_0x1e5f52;if(_0x12fc70>=_0x22ca7d){_0x12fc70=_0x22ca7d;_0x1e5f52=0xc8;}else{_0x1e5f52=0xce;}_0x47fb79[_0xa8ae('0x27')](_0x1e5f52);return _0x47fb79[_0xa8ae('0x2c')](_0xa8ae('0x2d'),_0x413145+'-'+_0x12fc70+'/'+_0x22ca7d)[_0xa8ae('0x28')](_0x14d0c1);}return null;};}function patchUpdates(_0x38c01a){return function(_0xe8f9dc){try{jsonpatch[_0xa8ae('0x2e')](_0xe8f9dc,_0x38c01a,!![]);}catch(_0x4067f6){return BPromise['reject'](_0x4067f6);}return _0xe8f9dc[_0xa8ae('0x2f')]();};}function saveUpdates(_0x5580e3,_0x40820a){return function(_0x553907){if(_0x553907){return _0x553907[_0xa8ae('0x30')](_0x5580e3)['then'](function(_0x13b245){return _0x13b245;});}return null;};}function removeEntity(_0x1f3957,_0x4e64f1){return function(_0x345606){if(_0x345606){return _0x345606['destroy']()[_0xa8ae('0x31')](function(){_0x1f3957[_0xa8ae('0x27')](0xcc)[_0xa8ae('0x32')]();});}};}function handleEntityNotFound(_0xbc527c,_0x2551a7){return function(_0x5031f0){if(!_0x5031f0){_0xbc527c['sendStatus'](0x194);}return _0x5031f0;};}function handleError(_0x2efbb1,_0x172762){_0x172762=_0x172762||0x1f4;return function(_0x26246c){logger[_0xa8ae('0x21')](_0x26246c[_0xa8ae('0x33')]);if(_0x26246c['name']){delete _0x26246c['name'];}_0x2efbb1[_0xa8ae('0x27')](_0x172762)['send'](_0x26246c);};}exports[_0xa8ae('0x34')]=function(_0x3675b6,_0x416ac1){var _0x25307d={},_0xe83b2f={},_0x1fdf2f={'count':0x0,'rows':[]};var _0x11ec33=_[_0xa8ae('0x35')](db[_0xa8ae('0x36')][_0xa8ae('0x37')],function(_0x388f50){return{'name':_0x388f50['fieldName'],'type':_0x388f50[_0xa8ae('0x38')][_0xa8ae('0x39')]};});_0xe83b2f['model']=_[_0xa8ae('0x35')](_0x11ec33,_0xa8ae('0x3a'));_0xe83b2f[_0xa8ae('0x3b')]=_[_0xa8ae('0x3c')](_0x3675b6[_0xa8ae('0x3b')]);_0xe83b2f[_0xa8ae('0x3d')]=_[_0xa8ae('0x3e')](_0xe83b2f[_0xa8ae('0x3f')],_0xe83b2f['query']);_0x25307d[_0xa8ae('0x40')]=_[_0xa8ae('0x3e')](_0xe83b2f[_0xa8ae('0x3f')],qs['fields'](_0x3675b6['query'][_0xa8ae('0x41')]));_0x25307d[_0xa8ae('0x40')]=_0x25307d[_0xa8ae('0x40')][_0xa8ae('0x42')]?_0x25307d['attributes']:_0xe83b2f['model'];if(!_0x3675b6['query']['hasOwnProperty'](_0xa8ae('0x43'))){_0x25307d[_0xa8ae('0x2b')]=qs[_0xa8ae('0x2b')](_0x3675b6[_0xa8ae('0x3b')][_0xa8ae('0x2b')]);_0x25307d[_0xa8ae('0x2a')]=qs[_0xa8ae('0x2a')](_0x3675b6['query']['offset']);}_0x25307d[_0xa8ae('0x44')]=qs[_0xa8ae('0x45')](_0x3675b6[_0xa8ae('0x3b')][_0xa8ae('0x45')]);_0x25307d[_0xa8ae('0x46')]=qs[_0xa8ae('0x3d')](_[_0xa8ae('0x47')](_0x3675b6[_0xa8ae('0x3b')],_0xe83b2f['filters']),_0x11ec33);if(_0x3675b6['query'][_0xa8ae('0x48')]){_0x25307d[_0xa8ae('0x46')]=_[_0xa8ae('0x49')](_0x25307d['where'],{'$or':_[_0xa8ae('0x35')](_0x11ec33,function(_0x2fc4b3){if(_0x2fc4b3['type']!==_0xa8ae('0x4a')){var _0x2e6fe7={};_0x2e6fe7[_0x2fc4b3[_0xa8ae('0x3a')]]={'$like':'%'+_0x3675b6[_0xa8ae('0x3b')][_0xa8ae('0x48')]+'%'};return _0x2e6fe7;}})});}_0x25307d=_[_0xa8ae('0x49')]({},_0x25307d,_0x3675b6[_0xa8ae('0x4b')]);var _0x4b9259={'where':_0x25307d[_0xa8ae('0x46')]};return db['ZendeskConfiguration'][_0xa8ae('0x29')](_0x4b9259)[_0xa8ae('0x31')](function(_0x355416){_0x1fdf2f[_0xa8ae('0x29')]=_0x355416;if(_0x3675b6[_0xa8ae('0x3b')][_0xa8ae('0x4c')]){_0x25307d['include']=[{'all':!![]}];}return db[_0xa8ae('0x36')][_0xa8ae('0x4d')](_0x25307d);})['then'](function(_0x3a1b6f){_0x1fdf2f[_0xa8ae('0x4e')]=_0x3a1b6f;return _0x1fdf2f;})[_0xa8ae('0x31')](respondWithFilteredResult(_0x416ac1,_0x25307d))[_0xa8ae('0x25')](handleError(_0x416ac1,null));};exports['show']=function(_0x4078c9,_0x1330bb){var _0x3e5377={'raw':![],'where':{'id':_0x4078c9[_0xa8ae('0x4f')]['id']}},_0x39f8b0={};_0x39f8b0['model']=_[_0xa8ae('0x3c')](db[_0xa8ae('0x36')]['rawAttributes']);_0x39f8b0[_0xa8ae('0x3b')]=_[_0xa8ae('0x3c')](_0x4078c9[_0xa8ae('0x3b')]);_0x39f8b0[_0xa8ae('0x3d')]=_[_0xa8ae('0x3e')](_0x39f8b0[_0xa8ae('0x3f')],_0x39f8b0[_0xa8ae('0x3b')]);_0x3e5377['attributes']=_[_0xa8ae('0x3e')](_0x39f8b0[_0xa8ae('0x3f')],qs[_0xa8ae('0x41')](_0x4078c9[_0xa8ae('0x3b')]['fields']));_0x3e5377[_0xa8ae('0x40')]=_0x3e5377[_0xa8ae('0x40')][_0xa8ae('0x42')]?_0x3e5377[_0xa8ae('0x40')]:_0x39f8b0[_0xa8ae('0x3f')];if(_0x4078c9[_0xa8ae('0x3b')][_0xa8ae('0x4c')]){_0x3e5377[_0xa8ae('0x50')]=[{'all':!![]}];}_0x3e5377=_['merge']({},_0x3e5377,_0x4078c9[_0xa8ae('0x4b')]);return db[_0xa8ae('0x36')]['find'](_0x3e5377)[_0xa8ae('0x31')](handleEntityNotFound(_0x1330bb,null))[_0xa8ae('0x31')](respondWithResult(_0x1330bb,null))[_0xa8ae('0x25')](handleError(_0x1330bb,null));};exports[_0xa8ae('0x51')]=function(_0x17f330,_0x53085f){return db['ZendeskConfiguration'][_0xa8ae('0x51')](_0x17f330['body'],{})[_0xa8ae('0x31')](respondWithResult(_0x53085f,0xc9))[_0xa8ae('0x25')](handleError(_0x53085f,null));};exports[_0xa8ae('0x30')]=function(_0x4b9729,_0x4664ae){if(_0x4b9729[_0xa8ae('0x52')]['id']){delete _0x4b9729['body']['id'];}return db[_0xa8ae('0x36')][_0xa8ae('0x53')]({'where':{'id':_0x4b9729['params']['id']}})[_0xa8ae('0x31')](handleEntityNotFound(_0x4664ae,null))['then'](saveUpdates(_0x4b9729['body'],null))[_0xa8ae('0x31')](respondWithResult(_0x4664ae,null))[_0xa8ae('0x25')](handleError(_0x4664ae,null));};exports[_0xa8ae('0x54')]=function(_0x2ffd47,_0x3a74ea){return db['ZendeskConfiguration'][_0xa8ae('0x53')]({'where':{'id':_0x2ffd47[_0xa8ae('0x4f')]['id']}})[_0xa8ae('0x31')](handleEntityNotFound(_0x3a74ea,null))[_0xa8ae('0x31')](removeEntity(_0x3a74ea,null))[_0xa8ae('0x25')](handleError(_0x3a74ea,null));};exports[_0xa8ae('0x55')]=function(_0x597117,_0x5e17c7,_0x422e30){var _0x2679a5={};var _0x166f38={};var _0x4ec0bf;var _0x10c875;return db[_0xa8ae('0x36')][_0xa8ae('0x56')]({'where':{'id':_0x597117['params']['id']}})[_0xa8ae('0x31')](handleEntityNotFound(_0x5e17c7,null))[_0xa8ae('0x31')](function(_0x5b313){if(_0x5b313){_0x4ec0bf=_0x5b313;_0x166f38[_0xa8ae('0x3f')]=_[_0xa8ae('0x3c')](db['ZendeskField']['rawAttributes']);_0x166f38[_0xa8ae('0x3b')]=_[_0xa8ae('0x3c')](_0x597117[_0xa8ae('0x3b')]);_0x166f38[_0xa8ae('0x3d')]=_[_0xa8ae('0x3e')](_0x166f38['model'],_0x166f38[_0xa8ae('0x3b')]);_0x2679a5[_0xa8ae('0x40')]=_['intersection'](_0x166f38[_0xa8ae('0x3f')],qs[_0xa8ae('0x41')](_0x597117[_0xa8ae('0x3b')][_0xa8ae('0x41')]));_0x2679a5[_0xa8ae('0x40')]=_0x2679a5[_0xa8ae('0x40')]['length']?_0x2679a5[_0xa8ae('0x40')]:_0x166f38[_0xa8ae('0x3f')];_0x2679a5[_0xa8ae('0x44')]=qs[_0xa8ae('0x45')](_0x597117['query'][_0xa8ae('0x45')]);_0x2679a5[_0xa8ae('0x46')]=qs[_0xa8ae('0x3d')](_[_0xa8ae('0x47')](_0x597117[_0xa8ae('0x3b')],_0x166f38['filters']));if(_0x597117[_0xa8ae('0x3b')][_0xa8ae('0x48')]){_0x2679a5[_0xa8ae('0x46')]=_[_0xa8ae('0x49')](_0x2679a5[_0xa8ae('0x46')],{'$or':_[_0xa8ae('0x35')](_0x2679a5['attributes'],function(_0x2218ed){var _0x4a4f51={};_0x4a4f51[_0x2218ed]={'$like':'%'+_0x597117[_0xa8ae('0x3b')][_0xa8ae('0x48')]+'%'};return _0x4a4f51;})});}_0x2679a5=_[_0xa8ae('0x49')]({},_0x2679a5,_0x597117['options']);return _0x4ec0bf['getFields'](_0x2679a5);}})[_0xa8ae('0x31')](function(_0x45ad69){if(_0x45ad69){_0x10c875=_0x45ad69[_0xa8ae('0x42')];if(!_0x597117[_0xa8ae('0x3b')][_0xa8ae('0x57')](_0xa8ae('0x43'))){_0x2679a5[_0xa8ae('0x2b')]=qs['limit'](_0x597117[_0xa8ae('0x3b')]['limit']);_0x2679a5['offset']=qs[_0xa8ae('0x2a')](_0x597117[_0xa8ae('0x3b')][_0xa8ae('0x2a')]);}return _0x4ec0bf[_0xa8ae('0x55')](_0x2679a5);}})['then'](function(_0x24aec7){if(_0x24aec7){return _0x24aec7?{'count':_0x10c875,'rows':_0x24aec7}:null;}})[_0xa8ae('0x31')](respondWithResult(_0x5e17c7,null))[_0xa8ae('0x25')](handleError(_0x5e17c7,null));};exports[_0xa8ae('0x58')]=function(_0x2cebcb,_0x4b4691,_0x43521a){var _0xa04ed4={};var _0x99bf21={};var _0x37327c;var _0x43fe28;return db[_0xa8ae('0x36')][_0xa8ae('0x56')]({'where':{'id':_0x2cebcb['params']['id']}})[_0xa8ae('0x31')](handleEntityNotFound(_0x4b4691,null))[_0xa8ae('0x31')](function(_0xe76046){if(_0xe76046){_0x37327c=_0xe76046;_0x99bf21[_0xa8ae('0x3f')]=_[_0xa8ae('0x3c')](db[_0xa8ae('0x59')][_0xa8ae('0x37')]);_0x99bf21['query']=_[_0xa8ae('0x3c')](_0x2cebcb[_0xa8ae('0x3b')]);_0x99bf21['filters']=_['intersection'](_0x99bf21[_0xa8ae('0x3f')],_0x99bf21[_0xa8ae('0x3b')]);_0xa04ed4[_0xa8ae('0x40')]=_[_0xa8ae('0x3e')](_0x99bf21[_0xa8ae('0x3f')],qs['fields'](_0x2cebcb[_0xa8ae('0x3b')][_0xa8ae('0x41')]));_0xa04ed4[_0xa8ae('0x40')]=_0xa04ed4[_0xa8ae('0x40')]['length']?_0xa04ed4['attributes']:_0x99bf21[_0xa8ae('0x3f')];_0xa04ed4[_0xa8ae('0x44')]=qs[_0xa8ae('0x45')](_0x2cebcb['query'][_0xa8ae('0x45')]);_0xa04ed4[_0xa8ae('0x46')]=qs[_0xa8ae('0x3d')](_[_0xa8ae('0x47')](_0x2cebcb[_0xa8ae('0x3b')],_0x99bf21['filters']));if(_0x2cebcb[_0xa8ae('0x3b')][_0xa8ae('0x48')]){_0xa04ed4[_0xa8ae('0x46')]=_[_0xa8ae('0x49')](_0xa04ed4[_0xa8ae('0x46')],{'$or':_['map'](_0xa04ed4[_0xa8ae('0x40')],function(_0x45543a){var _0x3c0148={};_0x3c0148[_0x45543a]={'$like':'%'+_0x2cebcb['query'][_0xa8ae('0x48')]+'%'};return _0x3c0148;})});}_0xa04ed4=_[_0xa8ae('0x49')]({},_0xa04ed4,_0x2cebcb[_0xa8ae('0x4b')]);return _0x37327c[_0xa8ae('0x58')](_0xa04ed4);}})[_0xa8ae('0x31')](function(_0x402e8d){if(_0x402e8d){_0x43fe28=_0x402e8d[_0xa8ae('0x42')];if(!_0x2cebcb[_0xa8ae('0x3b')][_0xa8ae('0x57')](_0xa8ae('0x43'))){_0xa04ed4[_0xa8ae('0x2b')]=qs[_0xa8ae('0x2b')](_0x2cebcb[_0xa8ae('0x3b')][_0xa8ae('0x2b')]);_0xa04ed4['offset']=qs[_0xa8ae('0x2a')](_0x2cebcb[_0xa8ae('0x3b')][_0xa8ae('0x2a')]);}return _0x37327c[_0xa8ae('0x58')](_0xa04ed4);}})['then'](function(_0x37c423){if(_0x37c423){return _0x37c423?{'count':_0x43fe28,'rows':_0x37c423}:null;}})['then'](respondWithResult(_0x4b4691,null))[_0xa8ae('0x25')](handleError(_0x4b4691,null));};exports[_0xa8ae('0x5a')]=function(_0x486eb9,_0x45f150,_0x1008f2){var _0xe1c2e4={};var _0x467e5e={};var _0x57d341;var _0x2ff3fe;return db[_0xa8ae('0x36')][_0xa8ae('0x56')]({'where':{'id':_0x486eb9['params']['id']}})[_0xa8ae('0x31')](handleEntityNotFound(_0x45f150,null))['then'](function(_0x5c1aa4){if(_0x5c1aa4){_0x57d341=_0x5c1aa4;_0x467e5e[_0xa8ae('0x3f')]=_[_0xa8ae('0x3c')](db[_0xa8ae('0x59')][_0xa8ae('0x37')]);_0x467e5e[_0xa8ae('0x3b')]=_[_0xa8ae('0x3c')](_0x486eb9['query']);_0x467e5e[_0xa8ae('0x3d')]=_[_0xa8ae('0x3e')](_0x467e5e[_0xa8ae('0x3f')],_0x467e5e[_0xa8ae('0x3b')]);_0xe1c2e4['attributes']=_['intersection'](_0x467e5e[_0xa8ae('0x3f')],qs[_0xa8ae('0x41')](_0x486eb9[_0xa8ae('0x3b')][_0xa8ae('0x41')]));_0xe1c2e4['attributes']=_0xe1c2e4[_0xa8ae('0x40')][_0xa8ae('0x42')]?_0xe1c2e4['attributes']:_0x467e5e[_0xa8ae('0x3f')];_0xe1c2e4[_0xa8ae('0x44')]=qs[_0xa8ae('0x45')](_0x486eb9['query'][_0xa8ae('0x45')]);_0xe1c2e4[_0xa8ae('0x46')]=qs[_0xa8ae('0x3d')](_['pick'](_0x486eb9[_0xa8ae('0x3b')],_0x467e5e[_0xa8ae('0x3d')]));if(_0x486eb9[_0xa8ae('0x3b')][_0xa8ae('0x48')]){_0xe1c2e4[_0xa8ae('0x46')]=_['merge'](_0xe1c2e4[_0xa8ae('0x46')],{'$or':_[_0xa8ae('0x35')](_0xe1c2e4[_0xa8ae('0x40')],function(_0x56f911){var _0x46a7b7={};_0x46a7b7[_0x56f911]={'$like':'%'+_0x486eb9[_0xa8ae('0x3b')][_0xa8ae('0x48')]+'%'};return _0x46a7b7;})});}_0xe1c2e4=_[_0xa8ae('0x49')]({},_0xe1c2e4,_0x486eb9[_0xa8ae('0x4b')]);return _0x57d341[_0xa8ae('0x5a')](_0xe1c2e4);}})[_0xa8ae('0x31')](function(_0x5b6daa){if(_0x5b6daa){_0x2ff3fe=_0x5b6daa['length'];if(!_0x486eb9['query'][_0xa8ae('0x57')]('nolimit')){_0xe1c2e4[_0xa8ae('0x2b')]=qs[_0xa8ae('0x2b')](_0x486eb9[_0xa8ae('0x3b')][_0xa8ae('0x2b')]);_0xe1c2e4[_0xa8ae('0x2a')]=qs['offset'](_0x486eb9[_0xa8ae('0x3b')]['offset']);}return _0x57d341[_0xa8ae('0x5a')](_0xe1c2e4);}})[_0xa8ae('0x31')](function(_0x18c319){if(_0x18c319){return _0x18c319?{'count':_0x2ff3fe,'rows':_0x18c319}:null;}})[_0xa8ae('0x31')](respondWithResult(_0x45f150,null))[_0xa8ae('0x25')](handleError(_0x45f150,null));};exports[_0xa8ae('0x5b')]=function(_0xeb21c4,_0x3f559f,_0x2017d7){var _0x5c0565={};var _0x462ac8={};var _0x419aac;var _0x5eda90;return db[_0xa8ae('0x36')][_0xa8ae('0x56')]({'where':{'id':_0xeb21c4[_0xa8ae('0x4f')]['id']}})[_0xa8ae('0x31')](handleEntityNotFound(_0x3f559f,null))[_0xa8ae('0x31')](function(_0x475dfc){if(_0x475dfc){_0x419aac=_0x475dfc;_0x462ac8[_0xa8ae('0x3f')]=_['keys'](db[_0xa8ae('0x5c')]['rawAttributes']);_0x462ac8[_0xa8ae('0x3b')]=_[_0xa8ae('0x3c')](_0xeb21c4[_0xa8ae('0x3b')]);_0x462ac8[_0xa8ae('0x3d')]=_[_0xa8ae('0x3e')](_0x462ac8[_0xa8ae('0x3f')],_0x462ac8[_0xa8ae('0x3b')]);_0x5c0565[_0xa8ae('0x40')]=_[_0xa8ae('0x3e')](_0x462ac8['model'],qs[_0xa8ae('0x41')](_0xeb21c4['query'][_0xa8ae('0x41')]));_0x5c0565[_0xa8ae('0x40')]=_0x5c0565['attributes'][_0xa8ae('0x42')]?_0x5c0565[_0xa8ae('0x40')]:_0x462ac8[_0xa8ae('0x3f')];_0x5c0565[_0xa8ae('0x44')]=qs['sort'](_0xeb21c4['query']['sort']);_0x5c0565[_0xa8ae('0x46')]=qs['filters'](_['pick'](_0xeb21c4[_0xa8ae('0x3b')],_0x462ac8['filters']));if(_0xeb21c4[_0xa8ae('0x3b')][_0xa8ae('0x48')]){_0x5c0565[_0xa8ae('0x46')]=_[_0xa8ae('0x49')](_0x5c0565[_0xa8ae('0x46')],{'$or':_[_0xa8ae('0x35')](_0x5c0565['attributes'],function(_0x43bccc){var _0x33d36f={};_0x33d36f[_0x43bccc]={'$like':'%'+_0xeb21c4[_0xa8ae('0x3b')][_0xa8ae('0x48')]+'%'};return _0x33d36f;})});}_0x5c0565=_['merge']({},_0x5c0565,_0xeb21c4[_0xa8ae('0x4b')]);return _0x419aac[_0xa8ae('0x5b')](_0x5c0565);}})['then'](function(_0x3775b1){if(_0x3775b1){_0x5eda90=_0x3775b1['length'];if(!_0xeb21c4[_0xa8ae('0x3b')]['hasOwnProperty'](_0xa8ae('0x43'))){_0x5c0565[_0xa8ae('0x2b')]=qs['limit'](_0xeb21c4[_0xa8ae('0x3b')][_0xa8ae('0x2b')]);_0x5c0565[_0xa8ae('0x2a')]=qs[_0xa8ae('0x2a')](_0xeb21c4[_0xa8ae('0x3b')][_0xa8ae('0x2a')]);}return _0x419aac['getTags'](_0x5c0565);}})[_0xa8ae('0x31')](function(_0x166deb){if(_0x166deb){return _0x166deb?{'count':_0x5eda90,'rows':_0x166deb}:null;}})[_0xa8ae('0x31')](respondWithResult(_0x3f559f,null))['catch'](handleError(_0x3f559f,null));};exports[_0xa8ae('0x5d')]=function(_0x50fc86,_0x288f38,_0x51d511){if(_0x50fc86[_0xa8ae('0x52')]['id']){delete _0x50fc86[_0xa8ae('0x52')]['id'];}return db[_0xa8ae('0x36')][_0xa8ae('0x56')]({'where':{'id':_0x50fc86[_0xa8ae('0x4f')]['id']}})[_0xa8ae('0x31')](handleEntityNotFound(_0x288f38,null))[_0xa8ae('0x31')](function(_0x1a23a9){if(_0x1a23a9){return _0x1a23a9[_0xa8ae('0x5d')](_0x50fc86[_0xa8ae('0x52')][_0xa8ae('0x5e')]||[]);}return null;})[_0xa8ae('0x31')](respondWithResult(_0x288f38,null))[_0xa8ae('0x25')](handleError(_0x288f38,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 1384e6b..ec34ce2 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 _0x8b9c=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x8b9c,0x185));var _0xc8b9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8b9c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc8b9('0x0'));var util=require(_0xc8b9('0x1'));var logger=require(_0xc8b9('0x2'))(_0xc8b9('0x3'));var moment=require(_0xc8b9('0x4'));var BPromise=require(_0xc8b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8b9('0x6'));var rimraf=require('rimraf');var config=require(_0xc8b9('0x7'));var attributes=require(_0xc8b9('0x8'));module[_0xc8b9('0x9')]=function(_0x2218f8,_0x59f042){return _0x2218f8[_0xc8b9('0xa')](_0xc8b9('0xb'),attributes,{'tableName':_0xc8b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3762=['path','rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','util','moment'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x3762,0x6e));var _0x2376=function(_0x15fa61,_0x1d5990){_0x15fa61=_0x15fa61-0x0;var _0x3b4e40=_0x3762[_0x15fa61];return _0x3b4e40;};'use strict';var _=require('lodash');var util=require(_0x2376('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2376('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2376('0x2'));var rimraf=require(_0x2376('0x3'));var config=require(_0x2376('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x3711a4,_0x20ff44){return _0x3711a4[_0x2376('0x5')](_0x2376('0x6'),attributes,{'tableName':_0x2376('0x7'),'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 4ad10f5..baaf1b2 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 _0x18ee=['code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x57dec8,_0x130871){var _0x2d35ba=function(_0x1b248f){while(--_0x1b248f){_0x57dec8['push'](_0x57dec8['shift']());}};_0x2d35ba(++_0x130871);}(_0x18ee,0x168));var _0xe18e=function(_0x197398,_0x16f638){_0x197398=_0x197398-0x0;var _0x5a0c77=_0x18ee[_0x197398];return _0x5a0c77;};'use strict';var _=require(_0xe18e('0x0'));var util=require(_0xe18e('0x1'));var moment=require('moment');var BPromise=require(_0xe18e('0x2'));var rs=require(_0xe18e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe18e('0x4'))['db'];var utils=require(_0xe18e('0x5'));var logger=require(_0xe18e('0x6'))(_0xe18e('0x7'));var config=require('../../config/environment');var jayson=require(_0xe18e('0x8'));var client=jayson['client'][_0xe18e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cb5b2,_0x5246f8,_0x1ee462){return new BPromise(function(_0x24f217,_0x228c8e){return client[_0xe18e('0xa')](_0x4cb5b2,_0x1ee462)[_0xe18e('0xb')](function(_0x130ae7){logger[_0xe18e('0xc')](_0xe18e('0xd'),_0x5246f8,'request\x20sent');logger[_0xe18e('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5246f8,_0xe18e('0xf'),JSON[_0xe18e('0x10')](_0x130ae7));if(_0x130ae7[_0xe18e('0x11')]){if(_0x130ae7[_0xe18e('0x11')][_0xe18e('0x12')]===0x1f4){logger[_0xe18e('0x11')](_0xe18e('0xd'),_0x5246f8,_0x130ae7['error'][_0xe18e('0x13')]);return _0x228c8e(_0x130ae7[_0xe18e('0x11')][_0xe18e('0x13')]);}logger[_0xe18e('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5246f8,_0x130ae7['error'][_0xe18e('0x13')]);return _0x24f217(_0x130ae7[_0xe18e('0x11')][_0xe18e('0x13')]);}else{logger[_0xe18e('0xc')](_0xe18e('0xd'),_0x5246f8,'request\x20sent');_0x24f217(_0x130ae7[_0xe18e('0x14')]['message']);}})['catch'](function(_0x251c07){logger[_0xe18e('0x11')](_0xe18e('0xd'),_0x5246f8,_0x251c07);_0x228c8e(_0x251c07);});});} \ No newline at end of file +var _0x1808=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x6678b6,_0x492b83){var _0x484384=function(_0x1cea52){while(--_0x1cea52){_0x6678b6['push'](_0x6678b6['shift']());}};_0x484384(++_0x492b83);}(_0x1808,0x1d1));var _0x8180=function(_0xed8833,_0x2a801e){_0xed8833=_0xed8833-0x0;var _0x42a79d=_0x1808[_0xed8833];return _0x42a79d;};'use strict';var _=require(_0x8180('0x0'));var util=require(_0x8180('0x1'));var moment=require(_0x8180('0x2'));var BPromise=require('bluebird');var rs=require(_0x8180('0x3'));var fs=require('fs');var Redis=require(_0x8180('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8180('0x5'));var logger=require(_0x8180('0x6'))(_0x8180('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8180('0x8')][_0x8180('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46a5d1,_0x3ddb58,_0x2ca1c5){return new BPromise(function(_0x2a356d,_0x373dcb){return client[_0x8180('0xa')](_0x46a5d1,_0x2ca1c5)['then'](function(_0x1a6a11){logger['info'](_0x8180('0xb'),_0x3ddb58,'request\x20sent');logger[_0x8180('0xc')](_0x8180('0xd'),_0x3ddb58,_0x8180('0xe'),JSON['stringify'](_0x1a6a11));if(_0x1a6a11['error']){if(_0x1a6a11[_0x8180('0xf')][_0x8180('0x10')]===0x1f4){logger[_0x8180('0xf')](_0x8180('0xb'),_0x3ddb58,_0x1a6a11['error'][_0x8180('0x11')]);return _0x373dcb(_0x1a6a11['error'][_0x8180('0x11')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3ddb58,_0x1a6a11[_0x8180('0xf')][_0x8180('0x11')]);return _0x2a356d(_0x1a6a11[_0x8180('0xf')][_0x8180('0x11')]);}else{logger[_0x8180('0x12')](_0x8180('0xb'),_0x3ddb58,_0x8180('0xe'));_0x2a356d(_0x1a6a11[_0x8180('0x13')]['message']);}})[_0x8180('0x14')](function(_0x3c6840){logger[_0x8180('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3ddb58,_0x3c6840);_0x373dcb(_0x3c6840);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1c75427..a1e5c19 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 _0x7c5d=['./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56d43a,_0x34d326){var _0x54b5be=function(_0x36db28){while(--_0x36db28){_0x56d43a['push'](_0x56d43a['shift']());}};_0x54b5be(++_0x34d326);}(_0x7c5d,0x1aa));var _0xd7c5=function(_0x47fbb6,_0x4ce852){_0x47fbb6=_0x47fbb6-0x0;var _0x27c31e=_0x7c5d[_0x47fbb6];return _0x27c31e;};'use strict';var multer=require(_0xd7c5('0x0'));var util=require('util');var path=require(_0xd7c5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd7c5('0x2')]();var auth=require(_0xd7c5('0x3'));var interaction=require(_0xd7c5('0x4'));var config=require(_0xd7c5('0x5'));var controller=require(_0xd7c5('0x6'));router['get']('/',auth[_0xd7c5('0x7')](),controller[_0xd7c5('0x8')]);router[_0xd7c5('0x9')](_0xd7c5('0xa'),auth['isAuthenticated'](),controller[_0xd7c5('0xb')]);router[_0xd7c5('0xc')]('/',auth[_0xd7c5('0x7')](),controller[_0xd7c5('0xd')]);router[_0xd7c5('0xe')](_0xd7c5('0xa'),auth[_0xd7c5('0x7')](),controller[_0xd7c5('0xf')]);router['delete'](_0xd7c5('0xa'),auth['isAuthenticated'](),controller[_0xd7c5('0x10')]);module[_0xd7c5('0x11')]=router; \ No newline at end of file +var _0xdf48=['/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','isAuthenticated','create','put'];(function(_0x4922ee,_0x52a172){var _0x394a28=function(_0x75d9f0){while(--_0x75d9f0){_0x4922ee['push'](_0x4922ee['shift']());}};_0x394a28(++_0x52a172);}(_0xdf48,0x113));var _0x8df4=function(_0x5022aa,_0x389afd){_0x5022aa=_0x5022aa-0x0;var _0xd9a32b=_0xdf48[_0x5022aa];return _0xd9a32b;};'use strict';var multer=require('multer');var util=require(_0x8df4('0x0'));var path=require('path');var timeout=require(_0x8df4('0x1'));var express=require(_0x8df4('0x2'));var router=express[_0x8df4('0x3')]();var auth=require(_0x8df4('0x4'));var interaction=require(_0x8df4('0x5'));var config=require(_0x8df4('0x6'));var controller=require(_0x8df4('0x7'));router[_0x8df4('0x8')]('/',auth['isAuthenticated'](),controller[_0x8df4('0x9')]);router['get']('/:id',auth[_0x8df4('0xa')](),controller['show']);router['post']('/',auth[_0x8df4('0xa')](),controller[_0x8df4('0xb')]);router[_0x8df4('0xc')](_0x8df4('0xd'),auth[_0x8df4('0xa')](),controller[_0x8df4('0xe')]);router[_0x8df4('0xf')](_0x8df4('0xd'),auth['isAuthenticated'](),controller[_0x8df4('0x10')]);module[_0x8df4('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6cd77c3..faa26c5 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 _0xc0c2=['ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc0c2,0x1b7));var _0x2c0c=function(_0xb7368b,_0xf11033){_0xb7368b=_0xb7368b-0x0;var _0x37d43b=_0xc0c2[_0xb7368b];return _0x37d43b;};'use strict';var Sequelize=require('sequelize');module[_0x2c0c('0x0')]={'type':{'type':Sequelize[_0x2c0c('0x1')](_0x2c0c('0x2'),_0x2c0c('0x3'),'customVariable',_0x2c0c('0x4')),'defaultValue':_0x2c0c('0x2')},'content':{'type':Sequelize[_0x2c0c('0x5')]},'key':{'type':Sequelize[_0x2c0c('0x5')]},'keyType':{'type':Sequelize[_0x2c0c('0x1')](_0x2c0c('0x2'),_0x2c0c('0x3'),_0x2c0c('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2c0c('0x5')]},'customField':{'type':Sequelize[_0x2c0c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2c0c('0x5')]}}; \ No newline at end of file +var _0x102b=['variable','customVariable','keyValue','STRING','ENUM','exports','string'];(function(_0x5cc63b,_0xffb17a){var _0x30507c=function(_0x2447e4){while(--_0x2447e4){_0x5cc63b['push'](_0x5cc63b['shift']());}};_0x30507c(++_0xffb17a);}(_0x102b,0x1be));var _0xb102=function(_0x215356,_0x5d60c9){_0x215356=_0x215356-0x0;var _0x2c224b=_0x102b[_0x215356];return _0x2c224b;};'use strict';var Sequelize=require('sequelize');module[_0xb102('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb102('0x1'),_0xb102('0x2'),_0xb102('0x3'),_0xb102('0x4')),'defaultValue':_0xb102('0x1')},'content':{'type':Sequelize[_0xb102('0x5')]},'key':{'type':Sequelize[_0xb102('0x5')]},'keyType':{'type':Sequelize[_0xb102('0x6')]('string',_0xb102('0x2'),_0xb102('0x3'))},'keyContent':{'type':Sequelize[_0xb102('0x5')]},'idField':{'type':Sequelize[_0xb102('0x5')]},'nameField':{'type':Sequelize[_0xb102('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb102('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index ad59dbf..8f1fecb 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 _0x7504=['jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','lodash','squel'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7504,0x119));var _0x4750=function(_0x1e7ef9,_0x56000e){_0x1e7ef9=_0x1e7ef9-0x0;var _0x24f24d=_0x7504[_0x1e7ef9];return _0x24f24d;};'use strict';var pdf=require(_0x4750('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4750('0x1'));var zipdir=require(_0x4750('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4750('0x3'));var moment=require(_0x4750('0x4'));var BPromise=require(_0x4750('0x5'));var Mustache=require('mustache');var util=require(_0x4750('0x6'));var path=require(_0x4750('0x7'));var sox=require(_0x4750('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4750('0x9'));var squel=require(_0x4750('0xa'));var crypto=require('crypto');var jsforce=require(_0x4750('0xb'));var deskjs=require(_0x4750('0xc'));var toCsv=require(_0x4750('0xd'));var querystring=require(_0x4750('0xe'));var Papa=require(_0x4750('0xf'));var Redis=require('ioredis');var authService=require(_0x4750('0x10'));var qs=require(_0x4750('0x11'));var as=require(_0x4750('0x12'));var hardwareService=require(_0x4750('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4750('0x14'));var config=require(_0x4750('0x15'));var db=require(_0x4750('0x16'))['db'];function respondWithStatusCode(_0x58c9d5,_0x5365a6){_0x5365a6=_0x5365a6||0xcc;return function(_0x4b6e3d){if(_0x4b6e3d){return _0x58c9d5[_0x4750('0x17')](_0x5365a6);}return _0x58c9d5[_0x4750('0x18')](_0x5365a6)['end']();};}function respondWithResult(_0x141cf6,_0x518ee5){_0x518ee5=_0x518ee5||0xc8;return function(_0x10bbfc){if(_0x10bbfc){return _0x141cf6[_0x4750('0x18')](_0x518ee5)[_0x4750('0x19')](_0x10bbfc);}};}function respondWithFilteredResult(_0x3cd118,_0x5de194){return function(_0x2b7146){if(_0x2b7146){var _0x220a9a=_0x2b7146[_0x4750('0x1a')],_0x4ef48c=_0x5de194[_0x4750('0x1b')],_0x1a58f5=_0x5de194[_0x4750('0x1b')]+_0x5de194[_0x4750('0x1c')],_0x2eb3c8;if(_0x1a58f5>=_0x220a9a){_0x1a58f5=_0x220a9a;_0x2eb3c8=0xc8;}else{_0x2eb3c8=0xce;}_0x3cd118[_0x4750('0x18')](_0x2eb3c8);return _0x3cd118[_0x4750('0x1d')](_0x4750('0x1e'),_0x4ef48c+'-'+_0x1a58f5+'/'+_0x220a9a)[_0x4750('0x19')](_0x2b7146);}return null;};}function patchUpdates(_0x4750dd){return function(_0x1bede6){try{jsonpatch['apply'](_0x1bede6,_0x4750dd,!![]);}catch(_0xed56ad){return BPromise[_0x4750('0x1f')](_0xed56ad);}return _0x1bede6[_0x4750('0x20')]();};}function saveUpdates(_0x23a605,_0x9112db){return function(_0x1d4551){if(_0x1d4551){return _0x1d4551[_0x4750('0x21')](_0x23a605)[_0x4750('0x22')](function(_0x1e5fc0){return _0x1e5fc0;});}return null;};}function removeEntity(_0x3161ba,_0xf6f8c){return function(_0x2cc093){if(_0x2cc093){return _0x2cc093[_0x4750('0x23')]()[_0x4750('0x22')](function(){_0x3161ba[_0x4750('0x18')](0xcc)[_0x4750('0x24')]();});}};}function handleEntityNotFound(_0xc0b54b,_0x3c4625){return function(_0x50234b){if(!_0x50234b){_0xc0b54b[_0x4750('0x17')](0x194);}return _0x50234b;};}function handleError(_0x1b41db,_0x34c4cc){_0x34c4cc=_0x34c4cc||0x1f4;return function(_0x2f775d){logger[_0x4750('0x25')](_0x2f775d[_0x4750('0x26')]);if(_0x2f775d[_0x4750('0x27')]){delete _0x2f775d['name'];}_0x1b41db['status'](_0x34c4cc)['send'](_0x2f775d);};}exports[_0x4750('0x28')]=function(_0x4d6b15,_0x2a0921){var _0x3da720={},_0xab8e91={},_0xcc25e8={'count':0x0,'rows':[]};var _0x2f5565=_[_0x4750('0x29')](db[_0x4750('0x2a')][_0x4750('0x2b')],function(_0x3e0134){return{'name':_0x3e0134[_0x4750('0x2c')],'type':_0x3e0134[_0x4750('0x2d')][_0x4750('0x2e')]};});_0xab8e91[_0x4750('0x2f')]=_[_0x4750('0x29')](_0x2f5565,_0x4750('0x27'));_0xab8e91[_0x4750('0x30')]=_[_0x4750('0x31')](_0x4d6b15['query']);_0xab8e91[_0x4750('0x32')]=_[_0x4750('0x33')](_0xab8e91[_0x4750('0x2f')],_0xab8e91[_0x4750('0x30')]);_0x3da720[_0x4750('0x34')]=_[_0x4750('0x33')](_0xab8e91[_0x4750('0x2f')],qs[_0x4750('0x35')](_0x4d6b15[_0x4750('0x30')][_0x4750('0x35')]));_0x3da720['attributes']=_0x3da720['attributes'][_0x4750('0x36')]?_0x3da720[_0x4750('0x34')]:_0xab8e91['model'];if(!_0x4d6b15[_0x4750('0x30')][_0x4750('0x37')](_0x4750('0x38'))){_0x3da720['limit']=qs[_0x4750('0x1c')](_0x4d6b15[_0x4750('0x30')][_0x4750('0x1c')]);_0x3da720[_0x4750('0x1b')]=qs['offset'](_0x4d6b15[_0x4750('0x30')][_0x4750('0x1b')]);}_0x3da720[_0x4750('0x39')]=qs[_0x4750('0x3a')](_0x4d6b15[_0x4750('0x30')][_0x4750('0x3a')]);_0x3da720[_0x4750('0x3b')]=qs['filters'](_[_0x4750('0x3c')](_0x4d6b15[_0x4750('0x30')],_0xab8e91[_0x4750('0x32')]),_0x2f5565);if(_0x4d6b15[_0x4750('0x30')][_0x4750('0x3d')]){_0x3da720[_0x4750('0x3b')]=_[_0x4750('0x3e')](_0x3da720[_0x4750('0x3b')],{'$or':_['map'](_0x2f5565,function(_0x2aba3e){if(_0x2aba3e['type']!=='VIRTUAL'){var _0x4e78fb={};_0x4e78fb[_0x2aba3e[_0x4750('0x27')]]={'$like':'%'+_0x4d6b15[_0x4750('0x30')][_0x4750('0x3d')]+'%'};return _0x4e78fb;}})});}_0x3da720=_['merge']({},_0x3da720,_0x4d6b15[_0x4750('0x3f')]);var _0x2d8ac7={'where':_0x3da720[_0x4750('0x3b')]};return db[_0x4750('0x2a')]['count'](_0x2d8ac7)[_0x4750('0x22')](function(_0x28a7ef){_0xcc25e8['count']=_0x28a7ef;if(_0x4d6b15[_0x4750('0x30')][_0x4750('0x40')]){_0x3da720[_0x4750('0x41')]=[{'all':!![]}];}return db[_0x4750('0x2a')][_0x4750('0x42')](_0x3da720);})[_0x4750('0x22')](function(_0x1f0b90){_0xcc25e8[_0x4750('0x43')]=_0x1f0b90;return _0xcc25e8;})['then'](respondWithFilteredResult(_0x2a0921,_0x3da720))[_0x4750('0x44')](handleError(_0x2a0921,null));};exports['show']=function(_0x2832bf,_0x4f87e0){var _0xe2cd1c={'raw':!![],'where':{'id':_0x2832bf[_0x4750('0x45')]['id']}},_0x1e42c7={};_0x1e42c7[_0x4750('0x2f')]=_[_0x4750('0x31')](db[_0x4750('0x2a')][_0x4750('0x2b')]);_0x1e42c7['query']=_[_0x4750('0x31')](_0x2832bf[_0x4750('0x30')]);_0x1e42c7[_0x4750('0x32')]=_[_0x4750('0x33')](_0x1e42c7['model'],_0x1e42c7['query']);_0xe2cd1c[_0x4750('0x34')]=_['intersection'](_0x1e42c7[_0x4750('0x2f')],qs[_0x4750('0x35')](_0x2832bf['query'][_0x4750('0x35')]));_0xe2cd1c[_0x4750('0x34')]=_0xe2cd1c[_0x4750('0x34')]['length']?_0xe2cd1c[_0x4750('0x34')]:_0x1e42c7[_0x4750('0x2f')];if(_0x2832bf[_0x4750('0x30')][_0x4750('0x40')]){_0xe2cd1c[_0x4750('0x41')]=[{'all':!![]}];}_0xe2cd1c=_['merge']({},_0xe2cd1c,_0x2832bf['options']);return db['ZendeskField'][_0x4750('0x46')](_0xe2cd1c)['then'](handleEntityNotFound(_0x4f87e0,null))[_0x4750('0x22')](respondWithResult(_0x4f87e0,null))['catch'](handleError(_0x4f87e0,null));};exports[_0x4750('0x47')]=function(_0x5d7e84,_0x214264){return db[_0x4750('0x2a')][_0x4750('0x47')](_0x5d7e84['body'],{})['then'](respondWithResult(_0x214264,0xc9))[_0x4750('0x44')](handleError(_0x214264,null));};exports['update']=function(_0x51b8f6,_0x8471e){if(_0x51b8f6['body']['id']){delete _0x51b8f6[_0x4750('0x48')]['id'];}return db[_0x4750('0x2a')][_0x4750('0x46')]({'where':{'id':_0x51b8f6[_0x4750('0x45')]['id']}})[_0x4750('0x22')](handleEntityNotFound(_0x8471e,null))[_0x4750('0x22')](saveUpdates(_0x51b8f6['body'],null))[_0x4750('0x22')](respondWithResult(_0x8471e,null))[_0x4750('0x44')](handleError(_0x8471e,null));};exports[_0x4750('0x23')]=function(_0x53ce76,_0x37ec7a){return db[_0x4750('0x2a')][_0x4750('0x46')]({'where':{'id':_0x53ce76['params']['id']}})[_0x4750('0x22')](handleEntityNotFound(_0x37ec7a,null))[_0x4750('0x22')](removeEntity(_0x37ec7a,null))[_0x4750('0x44')](handleError(_0x37ec7a,null));}; \ No newline at end of file +var _0xe223=['index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','include','rows','catch','show','length','includeAll','find','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','count','offset','status','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x18a311,_0x4401d5){var _0xf085cc=function(_0x3f4370){while(--_0x3f4370){_0x18a311['push'](_0x18a311['shift']());}};_0xf085cc(++_0x4401d5);}(_0xe223,0x13b));var _0x3e22=function(_0x341ced,_0x5774ad){_0x341ced=_0x341ced-0x0;var _0x5726b5=_0xe223[_0x341ced];return _0x5726b5;};'use strict';var pdf=require(_0x3e22('0x0'));var emlformat=require(_0x3e22('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3e22('0x2'));var jsonpatch=require(_0x3e22('0x3'));var rp=require('request-promise');var moment=require(_0x3e22('0x4'));var BPromise=require(_0x3e22('0x5'));var Mustache=require(_0x3e22('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3e22('0x7'));var csv=require(_0x3e22('0x8'));var ejs=require(_0x3e22('0x9'));var fs=require('fs');var _=require(_0x3e22('0xa'));var squel=require(_0x3e22('0xb'));var crypto=require(_0x3e22('0xc'));var jsforce=require(_0x3e22('0xd'));var deskjs=require(_0x3e22('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3e22('0xf'));var Papa=require(_0x3e22('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e22('0x11'));var as=require(_0x3e22('0x12'));var hardwareService=require(_0x3e22('0x13'));var logger=require(_0x3e22('0x14'))(_0x3e22('0x15'));var utils=require(_0x3e22('0x16'));var config=require(_0x3e22('0x17'));var db=require(_0x3e22('0x18'))['db'];function respondWithStatusCode(_0x44e785,_0x4819d1){_0x4819d1=_0x4819d1||0xcc;return function(_0x17f7a1){if(_0x17f7a1){return _0x44e785['sendStatus'](_0x4819d1);}return _0x44e785['status'](_0x4819d1)[_0x3e22('0x19')]();};}function respondWithResult(_0x4cccaf,_0x53e487){_0x53e487=_0x53e487||0xc8;return function(_0x3d183){if(_0x3d183){return _0x4cccaf['status'](_0x53e487)['json'](_0x3d183);}};}function respondWithFilteredResult(_0x2ca00,_0xcf73c4){return function(_0x4ef9a0){if(_0x4ef9a0){var _0x24af6a=_0x4ef9a0[_0x3e22('0x1a')],_0x58d396=_0xcf73c4['offset'],_0x19c9b1=_0xcf73c4[_0x3e22('0x1b')]+_0xcf73c4['limit'],_0x43c176;if(_0x19c9b1>=_0x24af6a){_0x19c9b1=_0x24af6a;_0x43c176=0xc8;}else{_0x43c176=0xce;}_0x2ca00[_0x3e22('0x1c')](_0x43c176);return _0x2ca00['set']('Content-Range',_0x58d396+'-'+_0x19c9b1+'/'+_0x24af6a)[_0x3e22('0x1d')](_0x4ef9a0);}return null;};}function patchUpdates(_0x163761){return function(_0x19bb85){try{jsonpatch[_0x3e22('0x1e')](_0x19bb85,_0x163761,!![]);}catch(_0x1b2f73){return BPromise['reject'](_0x1b2f73);}return _0x19bb85[_0x3e22('0x1f')]();};}function saveUpdates(_0x379c3a,_0x999c5a){return function(_0x43587a){if(_0x43587a){return _0x43587a[_0x3e22('0x20')](_0x379c3a)[_0x3e22('0x21')](function(_0x21ca85){return _0x21ca85;});}return null;};}function removeEntity(_0x2f551e,_0x3bac51){return function(_0x4c55e6){if(_0x4c55e6){return _0x4c55e6[_0x3e22('0x22')]()[_0x3e22('0x21')](function(){_0x2f551e[_0x3e22('0x1c')](0xcc)[_0x3e22('0x19')]();});}};}function handleEntityNotFound(_0xc649f1,_0x51d4b7){return function(_0x578211){if(!_0x578211){_0xc649f1[_0x3e22('0x23')](0x194);}return _0x578211;};}function handleError(_0x553775,_0x271267){_0x271267=_0x271267||0x1f4;return function(_0x204751){logger[_0x3e22('0x24')](_0x204751[_0x3e22('0x25')]);if(_0x204751['name']){delete _0x204751[_0x3e22('0x26')];}_0x553775[_0x3e22('0x1c')](_0x271267)[_0x3e22('0x27')](_0x204751);};}exports[_0x3e22('0x28')]=function(_0x5228bc,_0x42e900){var _0x3db56f={},_0x5af7b8={},_0x20c48d={'count':0x0,'rows':[]};var _0x309e68=_[_0x3e22('0x29')](db[_0x3e22('0x2a')][_0x3e22('0x2b')],function(_0x3bc997){return{'name':_0x3bc997[_0x3e22('0x2c')],'type':_0x3bc997['type'][_0x3e22('0x2d')]};});_0x5af7b8[_0x3e22('0x2e')]=_[_0x3e22('0x29')](_0x309e68,_0x3e22('0x26'));_0x5af7b8[_0x3e22('0x2f')]=_[_0x3e22('0x30')](_0x5228bc['query']);_0x5af7b8[_0x3e22('0x31')]=_[_0x3e22('0x32')](_0x5af7b8[_0x3e22('0x2e')],_0x5af7b8[_0x3e22('0x2f')]);_0x3db56f[_0x3e22('0x33')]=_[_0x3e22('0x32')](_0x5af7b8[_0x3e22('0x2e')],qs['fields'](_0x5228bc[_0x3e22('0x2f')][_0x3e22('0x34')]));_0x3db56f[_0x3e22('0x33')]=_0x3db56f[_0x3e22('0x33')]['length']?_0x3db56f[_0x3e22('0x33')]:_0x5af7b8[_0x3e22('0x2e')];if(!_0x5228bc[_0x3e22('0x2f')][_0x3e22('0x35')]('nolimit')){_0x3db56f['limit']=qs[_0x3e22('0x36')](_0x5228bc[_0x3e22('0x2f')][_0x3e22('0x36')]);_0x3db56f[_0x3e22('0x1b')]=qs[_0x3e22('0x1b')](_0x5228bc['query']['offset']);}_0x3db56f[_0x3e22('0x37')]=qs[_0x3e22('0x38')](_0x5228bc[_0x3e22('0x2f')][_0x3e22('0x38')]);_0x3db56f['where']=qs[_0x3e22('0x31')](_[_0x3e22('0x39')](_0x5228bc['query'],_0x5af7b8[_0x3e22('0x31')]),_0x309e68);if(_0x5228bc[_0x3e22('0x2f')][_0x3e22('0x3a')]){_0x3db56f[_0x3e22('0x3b')]=_[_0x3e22('0x3c')](_0x3db56f[_0x3e22('0x3b')],{'$or':_['map'](_0x309e68,function(_0x20e973){if(_0x20e973['type']!=='VIRTUAL'){var _0x26491e={};_0x26491e[_0x20e973[_0x3e22('0x26')]]={'$like':'%'+_0x5228bc[_0x3e22('0x2f')][_0x3e22('0x3a')]+'%'};return _0x26491e;}})});}_0x3db56f=_['merge']({},_0x3db56f,_0x5228bc['options']);var _0x2b5d2e={'where':_0x3db56f[_0x3e22('0x3b')]};return db[_0x3e22('0x2a')][_0x3e22('0x1a')](_0x2b5d2e)['then'](function(_0x5a038b){_0x20c48d[_0x3e22('0x1a')]=_0x5a038b;if(_0x5228bc[_0x3e22('0x2f')]['includeAll']){_0x3db56f[_0x3e22('0x3d')]=[{'all':!![]}];}return db[_0x3e22('0x2a')]['findAll'](_0x3db56f);})[_0x3e22('0x21')](function(_0x114040){_0x20c48d[_0x3e22('0x3e')]=_0x114040;return _0x20c48d;})[_0x3e22('0x21')](respondWithFilteredResult(_0x42e900,_0x3db56f))[_0x3e22('0x3f')](handleError(_0x42e900,null));};exports[_0x3e22('0x40')]=function(_0x32ef39,_0x284a35){var _0x295d18={'raw':!![],'where':{'id':_0x32ef39['params']['id']}},_0x12712b={};_0x12712b[_0x3e22('0x2e')]=_['keys'](db[_0x3e22('0x2a')][_0x3e22('0x2b')]);_0x12712b[_0x3e22('0x2f')]=_[_0x3e22('0x30')](_0x32ef39['query']);_0x12712b['filters']=_[_0x3e22('0x32')](_0x12712b['model'],_0x12712b[_0x3e22('0x2f')]);_0x295d18[_0x3e22('0x33')]=_['intersection'](_0x12712b['model'],qs['fields'](_0x32ef39[_0x3e22('0x2f')][_0x3e22('0x34')]));_0x295d18['attributes']=_0x295d18[_0x3e22('0x33')][_0x3e22('0x41')]?_0x295d18[_0x3e22('0x33')]:_0x12712b['model'];if(_0x32ef39[_0x3e22('0x2f')][_0x3e22('0x42')]){_0x295d18[_0x3e22('0x3d')]=[{'all':!![]}];}_0x295d18=_[_0x3e22('0x3c')]({},_0x295d18,_0x32ef39['options']);return db[_0x3e22('0x2a')][_0x3e22('0x43')](_0x295d18)[_0x3e22('0x21')](handleEntityNotFound(_0x284a35,null))[_0x3e22('0x21')](respondWithResult(_0x284a35,null))[_0x3e22('0x3f')](handleError(_0x284a35,null));};exports[_0x3e22('0x44')]=function(_0x5a534c,_0x3152cd){return db['ZendeskField'][_0x3e22('0x44')](_0x5a534c[_0x3e22('0x45')],{})[_0x3e22('0x21')](respondWithResult(_0x3152cd,0xc9))[_0x3e22('0x3f')](handleError(_0x3152cd,null));};exports[_0x3e22('0x20')]=function(_0x928250,_0x198ad9){if(_0x928250[_0x3e22('0x45')]['id']){delete _0x928250['body']['id'];}return db[_0x3e22('0x2a')]['find']({'where':{'id':_0x928250[_0x3e22('0x46')]['id']}})[_0x3e22('0x21')](handleEntityNotFound(_0x198ad9,null))[_0x3e22('0x21')](saveUpdates(_0x928250[_0x3e22('0x45')],null))[_0x3e22('0x21')](respondWithResult(_0x198ad9,null))[_0x3e22('0x3f')](handleError(_0x198ad9,null));};exports[_0x3e22('0x22')]=function(_0x4ef3dc,_0x4d74db){return db[_0x3e22('0x2a')][_0x3e22('0x43')]({'where':{'id':_0x4ef3dc[_0x3e22('0x46')]['id']}})['then'](handleEntityNotFound(_0x4d74db,null))[_0x3e22('0x21')](removeEntity(_0x4d74db,null))['catch'](handleError(_0x4d74db,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 8fe08aa..f9640fa 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 _0x3f9b=['./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','../../config/logger','moment','bluebird','../../config/environment'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x38f821,_0x186f35){_0x38f821=_0x38f821-0x0;var _0x508a69=_0x3f9b[_0x38f821];return _0x508a69;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb3f9('0x0'))('api');var moment=require(_0xb3f9('0x1'));var BPromise=require(_0xb3f9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3f9('0x3'));var attributes=require(_0xb3f9('0x4'));module[_0xb3f9('0x5')]=function(_0x57c82f,_0x26b29c){return _0x57c82f[_0xb3f9('0x6')](_0xb3f9('0x7'),attributes,{'tableName':_0xb3f9('0x8'),'paranoid':![],'indexes':[{'name':_0xb3f9('0x9'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb248=['int_zendesk_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./intZendeskField.attributes','exports','define'];(function(_0x40d078,_0x541e13){var _0x52c06b=function(_0x151fb5){while(--_0x151fb5){_0x40d078['push'](_0x40d078['shift']());}};_0x52c06b(++_0x541e13);}(_0xb248,0xc6));var _0x8b24=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xb248[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x8b24('0x0'));var util=require('util');var logger=require(_0x8b24('0x1'))(_0x8b24('0x2'));var moment=require(_0x8b24('0x3'));var BPromise=require(_0x8b24('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b24('0x5'));var rimraf=require(_0x8b24('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b24('0x7'));module[_0x8b24('0x8')]=function(_0x4cc3c4,_0x6da5b7){return _0x4cc3c4[_0x8b24('0x9')]('ZendeskField',attributes,{'tableName':_0x8b24('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x8b24('0xb'),_0x8b24('0xc')],'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 cc95634..67610b6 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 _0x8085=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x22bf8c,_0x178fe7){var _0xc4b8c6=function(_0x1ea32f){while(--_0x1ea32f){_0x22bf8c['push'](_0x22bf8c['shift']());}};_0xc4b8c6(++_0x178fe7);}(_0x8085,0xe7));var _0x5808=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x8085[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0x5808('0x0'));var moment=require(_0x5808('0x1'));var BPromise=require(_0x5808('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5808('0x3'));var db=require(_0x5808('0x4'))['db'];var utils=require(_0x5808('0x5'));var logger=require(_0x5808('0x6'))(_0x5808('0x7'));var config=require(_0x5808('0x8'));var jayson=require(_0x5808('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46e1c2,_0x3ee01d,_0x29a41c){return new BPromise(function(_0x56e590,_0x4b6dc8){return client[_0x5808('0xa')](_0x46e1c2,_0x29a41c)['then'](function(_0x5ce3e9){logger[_0x5808('0xb')]('ZendeskField,\x20%s,\x20%s',_0x3ee01d,'request\x20sent');logger[_0x5808('0xc')](_0x5808('0xd'),_0x3ee01d,'request\x20sent',JSON[_0x5808('0xe')](_0x5ce3e9));if(_0x5ce3e9[_0x5808('0xf')]){if(_0x5ce3e9[_0x5808('0xf')][_0x5808('0x10')]===0x1f4){logger[_0x5808('0xf')](_0x5808('0x11'),_0x3ee01d,_0x5ce3e9[_0x5808('0xf')][_0x5808('0x12')]);return _0x4b6dc8(_0x5ce3e9[_0x5808('0xf')]['message']);}logger['error'](_0x5808('0x11'),_0x3ee01d,_0x5ce3e9[_0x5808('0xf')]['message']);return _0x56e590(_0x5ce3e9['error'][_0x5808('0x12')]);}else{logger['info'](_0x5808('0x11'),_0x3ee01d,_0x5808('0x13'));_0x56e590(_0x5ce3e9[_0x5808('0x14')][_0x5808('0x12')]);}})['catch'](function(_0x13b821){logger[_0x5808('0xf')](_0x5808('0x11'),_0x3ee01d,_0x13b821);_0x4b6dc8(_0x13b821);});});} \ No newline at end of file +var _0x03f3=['ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../config/logger','jayson/promise','client','http','info','ZendeskField,\x20%s,\x20%s'];(function(_0x1c2989,_0x14ee75){var _0xec293a=function(_0x3719bd){while(--_0x3719bd){_0x1c2989['push'](_0x1c2989['shift']());}};_0xec293a(++_0x14ee75);}(_0x03f3,0x76));var _0x303f=function(_0x43f4c8,_0x22a037){_0x43f4c8=_0x43f4c8-0x0;var _0x3a2e0c=_0x03f3[_0x43f4c8];return _0x3a2e0c;};'use strict';var _=require('lodash');var util=require(_0x303f('0x0'));var moment=require(_0x303f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x303f('0x2'))('rpc');var config=require('../../config/environment');var jayson=require(_0x303f('0x3'));var client=jayson[_0x303f('0x4')][_0x303f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5c2998,_0x14bd1a,_0x343ec1){return new BPromise(function(_0x19b6cb,_0x35e2a2){return client['request'](_0x5c2998,_0x343ec1)['then'](function(_0x3c8bf0){logger[_0x303f('0x6')](_0x303f('0x7'),_0x14bd1a,'request\x20sent');logger['debug'](_0x303f('0x8'),_0x14bd1a,'request\x20sent',JSON[_0x303f('0x9')](_0x3c8bf0));if(_0x3c8bf0[_0x303f('0xa')]){if(_0x3c8bf0[_0x303f('0xa')]['code']===0x1f4){logger[_0x303f('0xa')](_0x303f('0x7'),_0x14bd1a,_0x3c8bf0[_0x303f('0xa')]['message']);return _0x35e2a2(_0x3c8bf0[_0x303f('0xa')]['message']);}logger['error'](_0x303f('0x7'),_0x14bd1a,_0x3c8bf0[_0x303f('0xa')][_0x303f('0xb')]);return _0x19b6cb(_0x3c8bf0[_0x303f('0xa')][_0x303f('0xb')]);}else{logger[_0x303f('0x6')](_0x303f('0x7'),_0x14bd1a,'request\x20sent');_0x19b6cb(_0x3c8bf0[_0x303f('0xc')][_0x303f('0xb')]);}})[_0x303f('0xd')](function(_0x5105cc){logger['error'](_0x303f('0x7'),_0x14bd1a,_0x5105cc);_0x35e2a2(_0x5105cc);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 01606a7..2498c58 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 _0x4597=['destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','delete'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0x4597,0xbe));var _0x7459=function(_0x26746a,_0x50f7b7){_0x26746a=_0x26746a-0x0;var _0x3c6bb4=_0x4597[_0x26746a];return _0x3c6bb4;};'use strict';var multer=require(_0x7459('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7459('0x1'));var express=require(_0x7459('0x2'));var router=express[_0x7459('0x3')]();var auth=require(_0x7459('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7459('0x5'));var controller=require(_0x7459('0x6'));router[_0x7459('0x7')]('/',auth[_0x7459('0x8')](),controller['index']);router[_0x7459('0x7')]('/:id',auth[_0x7459('0x8')](),controller[_0x7459('0x9')]);router[_0x7459('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7459('0xa')]);router[_0x7459('0x7')](_0x7459('0xb'),auth[_0x7459('0x8')](),controller[_0x7459('0xc')]);router[_0x7459('0xd')]('/',auth['isAuthenticated'](),controller[_0x7459('0xe')]);router['post'](_0x7459('0xf'),auth[_0x7459('0x8')](),controller[_0x7459('0x10')]);router[_0x7459('0x11')](_0x7459('0x12'),auth[_0x7459('0x8')](),controller['update']);router[_0x7459('0x13')](_0x7459('0x12'),auth['isAuthenticated'](),controller[_0x7459('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9760=['put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x5e05be,_0x4dd828){var _0x5a0d61=function(_0x2b3e23){while(--_0x2b3e23){_0x5e05be['push'](_0x5e05be['shift']());}};_0x5a0d61(++_0x4dd828);}(_0x9760,0xcb));var _0x0976=function(_0xb2cd75,_0x574ae8){_0xb2cd75=_0xb2cd75-0x0;var _0x54366f=_0x9760[_0xb2cd75];return _0x54366f;};'use strict';var multer=require(_0x0976('0x0'));var util=require(_0x0976('0x1'));var path=require(_0x0976('0x2'));var timeout=require(_0x0976('0x3'));var express=require('express');var router=express[_0x0976('0x4')]();var auth=require(_0x0976('0x5'));var interaction=require(_0x0976('0x6'));var config=require(_0x0976('0x7'));var controller=require('./intZohoAccount.controller');router[_0x0976('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0976('0x8')]('/:id',auth[_0x0976('0x9')](),controller[_0x0976('0xa')]);router['get'](_0x0976('0xb'),auth[_0x0976('0x9')](),controller['getConfigurations']);router[_0x0976('0x8')](_0x0976('0xc'),auth[_0x0976('0x9')](),controller[_0x0976('0xd')]);router[_0x0976('0xe')]('/',auth[_0x0976('0x9')](),controller[_0x0976('0xf')]);router[_0x0976('0xe')](_0x0976('0xb'),auth[_0x0976('0x9')](),controller[_0x0976('0x10')]);router[_0x0976('0x11')]('/:id',auth[_0x0976('0x9')](),controller['update']);router[_0x0976('0x12')](_0x0976('0x13'),auth['isAuthenticated'](),controller[_0x0976('0x14')]);module[_0x0976('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ec52e66..09af7ae 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 _0xc1e1=['sequelize','exports','STRING'];(function(_0x50153c,_0x197b8d){var _0x4cdeb9=function(_0x560648){while(--_0x560648){_0x50153c['push'](_0x50153c['shift']());}};_0x4cdeb9(++_0x197b8d);}(_0xc1e1,0xbd));var _0x1c1e=function(_0x4bba31,_0x1fcd42){_0x4bba31=_0x4bba31-0x0;var _0x153f05=_0xc1e1[_0x4bba31];return _0x153f05;};'use strict';var Sequelize=require(_0x1c1e('0x0'));module[_0x1c1e('0x1')]={'name':{'type':Sequelize[_0x1c1e('0x2')]},'description':{'type':Sequelize[_0x1c1e('0x2')]},'host':{'type':Sequelize[_0x1c1e('0x2')]},'zone':{'type':Sequelize[_0x1c1e('0x2')]},'clientId':{'type':Sequelize[_0x1c1e('0x2')]},'clientSecret':{'type':Sequelize[_0x1c1e('0x2')]},'serverUrl':{'type':Sequelize[_0x1c1e('0x2')]},'code':{'type':Sequelize[_0x1c1e('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3971=['exports','STRING','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3971,0xad));var _0x1397=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x3971[_0x506d2f];return _0x101255;};'use strict';var Sequelize=require(_0x1397('0x0'));module[_0x1397('0x1')]={'name':{'type':Sequelize[_0x1397('0x2')]},'description':{'type':Sequelize[_0x1397('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1397('0x2')]},'clientSecret':{'type':Sequelize[_0x1397('0x2')]},'serverUrl':{'type':Sequelize[_0x1397('0x2')]},'code':{'type':Sequelize[_0x1397('0x2')]},'refreshToken':{'type':Sequelize[_0x1397('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 73bb4af..4a2bd91 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 _0xb850=['request','then','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','type','query','keys','intersection','model','fields','attributes','length','nolimit','order','where','filters','pick','merge','VIRTUAL','filter','options','count','include','catch','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','sort','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','code','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.'];(function(_0x3cccb8,_0x4f405c){var _0x48d575=function(_0xc5a8d6){while(--_0xc5a8d6){_0x3cccb8['push'](_0x3cccb8['shift']());}};_0x48d575(++_0x4f405c);}(_0xb850,0x181));var _0x0b85=function(_0x549d57,_0x6b8598){_0x549d57=_0x549d57-0x0;var _0x330291=_0xb850[_0x549d57];return _0x330291;};'use strict';var pdf=require(_0x0b85('0x0'));var emlformat=require(_0x0b85('0x1'));var rimraf=require(_0x0b85('0x2'));var zipdir=require(_0x0b85('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b85('0x4'));var moment=require(_0x0b85('0x5'));var BPromise=require(_0x0b85('0x6'));var Mustache=require(_0x0b85('0x7'));var util=require(_0x0b85('0x8'));var path=require(_0x0b85('0x9'));var sox=require(_0x0b85('0xa'));var csv=require(_0x0b85('0xb'));var ejs=require(_0x0b85('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0b85('0xd'));var crypto=require('crypto');var jsforce=require(_0x0b85('0xe'));var deskjs=require(_0x0b85('0xf'));var toCsv=require(_0x0b85('0xb'));var querystring=require(_0x0b85('0x10'));var Papa=require(_0x0b85('0x11'));var Redis=require(_0x0b85('0x12'));var authService=require(_0x0b85('0x13'));var qs=require(_0x0b85('0x14'));var as=require(_0x0b85('0x15'));var hardwareService=require(_0x0b85('0x16'));var logger=require(_0x0b85('0x17'))('api');var utils=require(_0x0b85('0x18'));var config=require(_0x0b85('0x19'));var db=require(_0x0b85('0x1a'))['db'];var integrations=require(_0x0b85('0x1b'));var jayson=require(_0x0b85('0x1c'));var client=jayson[_0x0b85('0x1d')][_0x0b85('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x427744,_0x5a82bf,_0x3caf52){if(_0x3caf52){var _0x59ef92=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59ef92[_0x0b85('0x1f')](_0x5a82bf)){return _0x427744;}else{throw new db[(_0x0b85('0x20'))][(_0x0b85('0x21'))](_0x0b85('0x22'));}}else{return _0x427744;}}function respondWithRpcPromise(_0x474eec,_0x177831,_0x4ce5e8,_0x541409){return new BPromise(function(_0x1173de,_0x4f2aa0){var _0x4f5598=_0x541409||client;return _0x4f5598[_0x0b85('0x23')](_0x474eec,_0x4ce5e8)[_0x0b85('0x24')](function(_0x1dbf9e){logger[_0x0b85('0x25')](_0x0b85('0x26'),_0x177831,'request\x20sent');logger['debug'](_0x0b85('0x27'),_0x177831,'request\x20sent',JSON[_0x0b85('0x28')](_0x1dbf9e));if(_0x1dbf9e[_0x0b85('0x29')]){if(_0x1dbf9e['error']['code']===0x1f4){logger['error'](_0x0b85('0x26'),_0x177831,_0x1dbf9e[_0x0b85('0x29')][_0x0b85('0x2a')]);return _0x4f2aa0(_0x1dbf9e[_0x0b85('0x29')][_0x0b85('0x2a')]);}logger[_0x0b85('0x29')](_0x0b85('0x26'),_0x177831,_0x1dbf9e[_0x0b85('0x29')][_0x0b85('0x2a')]);return _0x1173de(_0x1dbf9e['error'][_0x0b85('0x2a')]);}else{logger['info'](_0x0b85('0x26'),_0x177831,'request\x20sent');_0x1173de(_0x1dbf9e[_0x0b85('0x2b')][_0x0b85('0x2a')]);}})['catch'](function(_0x21170c){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x177831,_0x21170c);_0x4f2aa0(_0x21170c);});});}function respondWithStatusCode(_0x60184b,_0x21ebd1){_0x21ebd1=_0x21ebd1||0xcc;return function(_0x821198){if(_0x821198){return _0x60184b[_0x0b85('0x2c')](_0x21ebd1);}return _0x60184b[_0x0b85('0x2d')](_0x21ebd1)[_0x0b85('0x2e')]();};}function respondWithResult(_0x241f83,_0x45ea63){_0x45ea63=_0x45ea63||0xc8;return function(_0x4e8d9c){if(_0x4e8d9c){return _0x241f83[_0x0b85('0x2d')](_0x45ea63)['json'](_0x4e8d9c);}};}function respondWithFilteredResult(_0x1431ca,_0x154e20){return function(_0xbd17bf){if(_0xbd17bf){var _0x45c693=_0xbd17bf['count'],_0x2ceaa0=_0x154e20[_0x0b85('0x2f')],_0xf8acc9=_0x154e20[_0x0b85('0x2f')]+_0x154e20[_0x0b85('0x30')],_0x5d52c7;if(_0xf8acc9>=_0x45c693){_0xf8acc9=_0x45c693;_0x5d52c7=0xc8;}else{_0x5d52c7=0xce;}_0x1431ca['status'](_0x5d52c7);return _0x1431ca[_0x0b85('0x31')](_0x0b85('0x32'),_0x2ceaa0+'-'+_0xf8acc9+'/'+_0x45c693)[_0x0b85('0x33')](_0xbd17bf);}return null;};}function patchUpdates(_0x5e41b6){return function(_0x632f19){try{jsonpatch[_0x0b85('0x34')](_0x632f19,_0x5e41b6,!![]);}catch(_0x31b314){return BPromise['reject'](_0x31b314);}return _0x632f19[_0x0b85('0x35')]();};}function saveUpdates(_0x4c205d,_0x8835f2){return function(_0xf3a79){if(_0xf3a79){return _0xf3a79[_0x0b85('0x36')](_0x4c205d)[_0x0b85('0x24')](function(_0x2bca3f){return _0x2bca3f;});}return null;};}function removeEntity(_0x5dddcc,_0x3777d8){return function(_0x22928d){if(_0x22928d){return _0x22928d[_0x0b85('0x37')]()['then'](function(){_0x5dddcc[_0x0b85('0x2d')](0xcc)[_0x0b85('0x2e')]();});}};}function handleEntityNotFound(_0x3e2d88,_0x329f3b){return function(_0xc90543){if(!_0xc90543){_0x3e2d88[_0x0b85('0x2c')](0x194);}return _0xc90543;};}function handleError(_0x2208b0,_0x7b082d){_0x7b082d=_0x7b082d||0x1f4;return function(_0x23cf3f){logger['error'](_0x23cf3f[_0x0b85('0x38')]);if(_0x23cf3f[_0x0b85('0x39')]){delete _0x23cf3f['name'];}_0x2208b0[_0x0b85('0x2d')](_0x7b082d)[_0x0b85('0x3a')](_0x23cf3f);};}exports[_0x0b85('0x3b')]=function(_0x336769,_0x24e397){var _0x342f4b={},_0x4104ee={},_0x22c483={'count':0x0,'rows':[]};var _0x32aca1=_[_0x0b85('0x3c')](db[_0x0b85('0x3d')][_0x0b85('0x3e')],function(_0x5f45f2){return{'name':_0x5f45f2['fieldName'],'type':_0x5f45f2[_0x0b85('0x3f')]['key']};});_0x4104ee['model']=_['map'](_0x32aca1,_0x0b85('0x39'));_0x4104ee[_0x0b85('0x40')]=_[_0x0b85('0x41')](_0x336769['query']);_0x4104ee['filters']=_[_0x0b85('0x42')](_0x4104ee['model'],_0x4104ee['query']);_0x342f4b['attributes']=_['intersection'](_0x4104ee[_0x0b85('0x43')],qs[_0x0b85('0x44')](_0x336769[_0x0b85('0x40')][_0x0b85('0x44')]));_0x342f4b[_0x0b85('0x45')]=_0x342f4b[_0x0b85('0x45')][_0x0b85('0x46')]?_0x342f4b[_0x0b85('0x45')]:_0x4104ee['model'];if(!_0x336769[_0x0b85('0x40')]['hasOwnProperty'](_0x0b85('0x47'))){_0x342f4b[_0x0b85('0x30')]=qs['limit'](_0x336769['query']['limit']);_0x342f4b['offset']=qs[_0x0b85('0x2f')](_0x336769[_0x0b85('0x40')]['offset']);}_0x342f4b[_0x0b85('0x48')]=qs['sort'](_0x336769[_0x0b85('0x40')]['sort']);_0x342f4b[_0x0b85('0x49')]=qs[_0x0b85('0x4a')](_[_0x0b85('0x4b')](_0x336769[_0x0b85('0x40')],_0x4104ee[_0x0b85('0x4a')]),_0x32aca1);if(_0x336769[_0x0b85('0x40')]['filter']){_0x342f4b[_0x0b85('0x49')]=_[_0x0b85('0x4c')](_0x342f4b[_0x0b85('0x49')],{'$or':_[_0x0b85('0x3c')](_0x32aca1,function(_0x2a1127){if(_0x2a1127[_0x0b85('0x3f')]!==_0x0b85('0x4d')){var _0x395a8b={};_0x395a8b[_0x2a1127[_0x0b85('0x39')]]={'$like':'%'+_0x336769[_0x0b85('0x40')][_0x0b85('0x4e')]+'%'};return _0x395a8b;}})});}_0x342f4b=_[_0x0b85('0x4c')]({},_0x342f4b,_0x336769[_0x0b85('0x4f')]);var _0x38f188={'where':_0x342f4b[_0x0b85('0x49')]};return db[_0x0b85('0x3d')][_0x0b85('0x50')](_0x38f188)[_0x0b85('0x24')](function(_0x46e209){_0x22c483[_0x0b85('0x50')]=_0x46e209;if(_0x336769[_0x0b85('0x40')]['includeAll']){_0x342f4b[_0x0b85('0x51')]=[{'all':!![]}];}return db[_0x0b85('0x3d')]['findAll'](_0x342f4b);})[_0x0b85('0x24')](function(_0x2c00eb){_0x22c483['rows']=_0x2c00eb;return _0x22c483;})['then'](respondWithFilteredResult(_0x24e397,_0x342f4b))[_0x0b85('0x52')](handleError(_0x24e397,null));};exports['show']=function(_0x3f2466,_0x330f73){var _0x393bee={'raw':![],'where':{'id':_0x3f2466[_0x0b85('0x53')]['id']}},_0x1cca91={};_0x1cca91[_0x0b85('0x43')]=_[_0x0b85('0x41')](db['ZohoAccount'][_0x0b85('0x3e')]);_0x1cca91[_0x0b85('0x40')]=_[_0x0b85('0x41')](_0x3f2466[_0x0b85('0x40')]);_0x1cca91[_0x0b85('0x4a')]=_[_0x0b85('0x42')](_0x1cca91[_0x0b85('0x43')],_0x1cca91[_0x0b85('0x40')]);_0x393bee[_0x0b85('0x45')]=_['intersection'](_0x1cca91[_0x0b85('0x43')],qs[_0x0b85('0x44')](_0x3f2466[_0x0b85('0x40')]['fields']));_0x393bee['attributes']=_0x393bee[_0x0b85('0x45')][_0x0b85('0x46')]?_0x393bee[_0x0b85('0x45')]:_0x1cca91[_0x0b85('0x43')];if(_0x3f2466[_0x0b85('0x40')]['includeAll']){_0x393bee[_0x0b85('0x51')]=[{'all':!![]}];}_0x393bee=_[_0x0b85('0x4c')]({},_0x393bee,_0x3f2466[_0x0b85('0x4f')]);return db[_0x0b85('0x3d')][_0x0b85('0x54')](_0x393bee)[_0x0b85('0x24')](handleEntityNotFound(_0x330f73,null))['then'](respondWithResult(_0x330f73,null))['catch'](handleError(_0x330f73,null));};exports['create']=function(_0x4cf32e,_0x24da63){return db[_0x0b85('0x3d')][_0x0b85('0x55')](_0x4cf32e[_0x0b85('0x56')],{})[_0x0b85('0x24')](respondWithResult(_0x24da63,0xc9))[_0x0b85('0x52')](handleError(_0x24da63,null));};exports['update']=function(_0x578454,_0x8e25cf){if(_0x578454['body']['id']){delete _0x578454[_0x0b85('0x56')]['id'];}return db[_0x0b85('0x3d')][_0x0b85('0x54')]({'where':{'id':_0x578454['params']['id']}})[_0x0b85('0x24')](handleEntityNotFound(_0x8e25cf,null))[_0x0b85('0x24')](saveUpdates(_0x578454['body'],null))[_0x0b85('0x24')](respondWithResult(_0x8e25cf,null))[_0x0b85('0x52')](handleError(_0x8e25cf,null));};exports[_0x0b85('0x37')]=function(_0xe1385c,_0xfb9e1f){return db['ZohoAccount'][_0x0b85('0x54')]({'where':{'id':_0xe1385c[_0x0b85('0x53')]['id']}})['then'](handleEntityNotFound(_0xfb9e1f,null))[_0x0b85('0x24')](removeEntity(_0xfb9e1f,null))['catch'](handleError(_0xfb9e1f,null));};exports[_0x0b85('0x57')]=function(_0x4ad09b,_0x593574,_0x3c606d){var _0x25166a={};var _0x13d656={};var _0x1e8dcc;var _0x4ca52c;return db[_0x0b85('0x3d')][_0x0b85('0x58')]({'where':{'id':_0x4ad09b[_0x0b85('0x53')]['id']}})[_0x0b85('0x24')](handleEntityNotFound(_0x593574,null))[_0x0b85('0x24')](function(_0x47f05b){if(_0x47f05b){_0x1e8dcc=_0x47f05b;_0x13d656[_0x0b85('0x43')]=_[_0x0b85('0x41')](db[_0x0b85('0x59')][_0x0b85('0x3e')]);_0x13d656[_0x0b85('0x40')]=_[_0x0b85('0x41')](_0x4ad09b[_0x0b85('0x40')]);_0x13d656['filters']=_[_0x0b85('0x42')](_0x13d656['model'],_0x13d656[_0x0b85('0x40')]);_0x25166a[_0x0b85('0x45')]=_['intersection'](_0x13d656[_0x0b85('0x43')],qs[_0x0b85('0x44')](_0x4ad09b[_0x0b85('0x40')][_0x0b85('0x44')]));_0x25166a['attributes']=_0x25166a['attributes'][_0x0b85('0x46')]?_0x25166a[_0x0b85('0x45')]:_0x13d656['model'];_0x25166a['order']=qs[_0x0b85('0x5a')](_0x4ad09b['query']['sort']);_0x25166a[_0x0b85('0x49')]=qs['filters'](_['pick'](_0x4ad09b[_0x0b85('0x40')],_0x13d656[_0x0b85('0x4a')]));if(_0x4ad09b[_0x0b85('0x40')][_0x0b85('0x4e')]){_0x25166a[_0x0b85('0x49')]=_['merge'](_0x25166a[_0x0b85('0x49')],{'$or':_[_0x0b85('0x3c')](_0x25166a[_0x0b85('0x45')],function(_0x10ae45){var _0x422f49={};_0x422f49[_0x10ae45]={'$like':'%'+_0x4ad09b['query'][_0x0b85('0x4e')]+'%'};return _0x422f49;})});}_0x25166a=_[_0x0b85('0x4c')]({},_0x25166a,_0x4ad09b[_0x0b85('0x4f')]);return _0x1e8dcc[_0x0b85('0x57')](_0x25166a);}})[_0x0b85('0x24')](function(_0x8f1f84){if(_0x8f1f84){_0x4ca52c=_0x8f1f84[_0x0b85('0x46')];if(!_0x4ad09b[_0x0b85('0x40')][_0x0b85('0x5b')](_0x0b85('0x47'))){_0x25166a[_0x0b85('0x30')]=qs[_0x0b85('0x30')](_0x4ad09b[_0x0b85('0x40')][_0x0b85('0x30')]);_0x25166a[_0x0b85('0x2f')]=qs['offset'](_0x4ad09b[_0x0b85('0x40')]['offset']);}return _0x1e8dcc[_0x0b85('0x57')](_0x25166a);}})[_0x0b85('0x24')](function(_0x5e93f4){if(_0x5e93f4){return _0x5e93f4?{'count':_0x4ca52c,'rows':_0x5e93f4}:null;}})[_0x0b85('0x24')](respondWithResult(_0x593574,null))[_0x0b85('0x52')](handleError(_0x593574,null));};exports['addConfiguration']=function(_0x29365c,_0x469490,_0xe0e5d){if(_0x29365c[_0x0b85('0x56')]['id']){delete _0x29365c[_0x0b85('0x56')]['id'];}return db[_0x0b85('0x3d')]['findOne']({'where':{'id':_0x29365c[_0x0b85('0x53')]['id']}})[_0x0b85('0x24')](handleEntityNotFound(_0x469490,null))[_0x0b85('0x24')](function(_0x45dcbf){if(_0x45dcbf){_0x29365c[_0x0b85('0x56')][_0x0b85('0x5c')]=_0x45dcbf['id'];_0x29365c[_0x0b85('0x56')][_0x0b85('0x5d')]=integrations[_0x0b85('0x5e')](_0x29365c[_0x0b85('0x56')][_0x0b85('0x5f')],_0x29365c['body'][_0x0b85('0x3f')]);_0x29365c[_0x0b85('0x56')][_0x0b85('0x60')]=integrations[_0x0b85('0x61')](_0x29365c[_0x0b85('0x56')]['channel'],_0x29365c[_0x0b85('0x56')][_0x0b85('0x3f')]);return db['ZohoConfiguration'][_0x0b85('0x55')](_0x29365c[_0x0b85('0x56')],{'include':[{'model':db[_0x0b85('0x62')],'as':_0x0b85('0x5d')},{'model':db[_0x0b85('0x62')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x469490,null))[_0x0b85('0x52')](handleError(_0x469490,null));};function getAccessToken(_0x515ea0){return new Promise(function(_0x329c7a,_0x59d1e5){var _0x1ff9bd;switch(_0x515ea0[_0x0b85('0x63')]){case'US':_0x1ff9bd='https://accounts.zoho.com';break;case'AU':_0x1ff9bd=_0x0b85('0x64');break;case'EU':_0x1ff9bd=_0x0b85('0x65');break;case'IN':_0x1ff9bd=_0x0b85('0x66');break;case'CN':_0x1ff9bd=_0x0b85('0x67');break;default:_0x1ff9bd=_0x0b85('0x65');break;}var _0x24e41d={'method':'POST','uri':_0x1ff9bd+_0x0b85('0x68'),'qs':{'refresh_token':_0x515ea0[_0x0b85('0x69')],'client_id':_0x515ea0['clientId'],'client_secret':_0x515ea0[_0x0b85('0x6a')],'grant_type':_0x0b85('0x6b')},'json':!![]};return rp(_0x24e41d)[_0x0b85('0x24')](function(_0x4b5585){if(_0x4b5585[_0x0b85('0x6c')]){_0x329c7a(_0x4b5585[_0x0b85('0x6c')]);}else{_0x59d1e5(_0x0b85('0x6d'));}})['catch'](function(_0x3ab260){_0x59d1e5(_0x3ab260);});});}exports[_0x0b85('0x6e')]=function(_0x53ef23,_0x47cd26,_0x1033de){var _0x4d372b,_0x2bb031,_0x306524,_0x282e4d,_0x505eea;return db['ZohoAccount'][_0x0b85('0x58')]({'where':{'id':_0x53ef23['params']['id']},'attributes':['id',_0x0b85('0x6f'),_0x0b85('0x63'),_0x0b85('0x70'),_0x0b85('0x6a'),_0x0b85('0x71'),_0x0b85('0x72'),_0x0b85('0x69')]})[_0x0b85('0x24')](handleEntityNotFound(_0x47cd26,null))[_0x0b85('0x24')](function(_0x5ea300){_0x505eea=_0x5ea300;_0x4d372b=_0x505eea[_0x0b85('0x6f')];_0x2bb031=_0x4d372b===_0x0b85('0x73')?'eu':_0x0b85('0x74');_0x306524=_0x505eea[_0x0b85('0x71')];var _0x146607=_0x306524[_0x0b85('0x75')](-0x1);if(_0x146607==='/'||_0x146607==='\x5c'||_0x146607===':'){_0x306524=_0x306524['substring'](0x0,_0x306524['lastIndexOf'](_0x146607));}if(!_0x505eea['refreshToken']){throw new Error(_0x0b85('0x76'));}return getAccessToken(_0x505eea);})['then'](function(_0x43030a){if(_0x43030a){return rp({'method':_0x0b85('0x77'),'uri':util['format'](_0x0b85('0x78'),_0x2bb031),'qs':{'module':_0x0b85('0x79')},'headers':{'Authorization':_0x0b85('0x7a')+_0x43030a},'json':!![]});}})[_0x0b85('0x24')](function(_0x1668ba){if(_0x1668ba){if(_0x1668ba['response']&&_0x1668ba[_0x0b85('0x7b')][_0x0b85('0x29')]){throw new Error(_0x1668ba[_0x0b85('0x7b')][_0x0b85('0x29')][_0x0b85('0x2a')]);}var _0x59bbb0=[];var _0x513bed=[];var _0x5c6c9a=[_0x0b85('0x7c'),'Subject',_0x0b85('0x7d'),'WhoId',_0x0b85('0x7e'),_0x0b85('0x7f'),_0x0b85('0x80'),_0x0b85('0x81')];_0x513bed=_['remove'](_0x1668ba[_0x0b85('0x44')],function(_0x21075a){return _0x5c6c9a[_0x0b85('0x82')](_0x21075a[_0x0b85('0x83')]);});for(var _0x5e84f3=0x0;_0x5e84f3<_0x513bed[_0x0b85('0x46')];_0x5e84f3++){if(_0x513bed[_0x5e84f3][_0x0b85('0x84')]===![]){_0x59bbb0[_0x0b85('0x85')]({'id':_0x513bed[_0x5e84f3]['id'],'name':_0x513bed[_0x5e84f3][_0x0b85('0x86')],'custom':_0x513bed[_0x5e84f3]['custom_field'],'options':_0x513bed[_0x5e84f3]['data_type']===_0x0b85('0x87')&&_0x513bed[_0x5e84f3][_0x0b85('0x88')][_0x0b85('0x46')]>-0x1?_['map'](_0x513bed[_0x5e84f3][_0x0b85('0x88')],function(_0xcb3053){return{'name':_0xcb3053,'value':_0xcb3053};}):[]});}}return{'count':_0x59bbb0['length'],'rows':_0x59bbb0};}else{return{'count':0x0,'rows':[]};}})[_0x0b85('0x24')](respondWithResult(_0x47cd26,null))[_0x0b85('0x52')](function(_0x57de8f){var _0x50d897=_0x53ef23[_0x0b85('0x40')][_0x0b85('0x1f')]?0x1f4:_0x57de8f[_0x0b85('0x89')]||0x1f4;logger[_0x0b85('0x29')](_0x0b85('0x8a'),_0x0b85('0x6e'),_0x50d897,JSON['stringify'](_0x57de8f));delete _0x57de8f[_0x0b85('0x39')];if(_0x50d897===0x191){_0x50d897=0x190;}_0x47cd26[_0x0b85('0x2d')](_0x50d897)['send'](_0x53ef23[_0x0b85('0x40')][_0x0b85('0x1f')]?{'message':_0x0b85('0x8b'),'statusCode':_0x57de8f['statusCode']}:_0x57de8f);});}; \ No newline at end of file +var _0x4120=['Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','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~!@#$%^&-_=+[{]}.','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','ZohoAccount','include','findAll','rows','params','includeAll','find','create','body','destroy','findOne','ZohoConfiguration','length','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','zoho.eu','com','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x4120,0xa5));var _0x0412=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4120[_0x2d7f0e];return _0x110b07;};'use strict';var pdf=require(_0x0412('0x0'));var emlformat=require(_0x0412('0x1'));var rimraf=require(_0x0412('0x2'));var zipdir=require(_0x0412('0x3'));var jsonpatch=require(_0x0412('0x4'));var rp=require(_0x0412('0x5'));var moment=require(_0x0412('0x6'));var BPromise=require(_0x0412('0x7'));var Mustache=require('mustache');var util=require(_0x0412('0x8'));var path=require(_0x0412('0x9'));var sox=require(_0x0412('0xa'));var csv=require('to-csv');var ejs=require(_0x0412('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0412('0xc'));var crypto=require('crypto');var jsforce=require(_0x0412('0xd'));var deskjs=require(_0x0412('0xe'));var toCsv=require(_0x0412('0xf'));var querystring=require(_0x0412('0x10'));var Papa=require(_0x0412('0x11'));var Redis=require(_0x0412('0x12'));var authService=require(_0x0412('0x13'));var qs=require(_0x0412('0x14'));var as=require(_0x0412('0x15'));var hardwareService=require(_0x0412('0x16'));var logger=require(_0x0412('0x17'))(_0x0412('0x18'));var utils=require('../../config/utils');var config=require(_0x0412('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0412('0x1a'));var jayson=require(_0x0412('0x1b'));var client=jayson[_0x0412('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x14d560,_0x45c6e2,_0x69248a){if(_0x69248a){var _0x15192a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15192a[_0x0412('0x1d')](_0x45c6e2)){return _0x14d560;}else{throw new db[(_0x0412('0x1e'))][(_0x0412('0x1f'))](_0x0412('0x20'));}}else{return _0x14d560;}}function respondWithRpcPromise(_0x40e1c9,_0x53d2b2,_0x18b314,_0x575c50){return new BPromise(function(_0x515e94,_0x7b2227){var _0x57cfc0=_0x575c50||client;return _0x57cfc0[_0x0412('0x21')](_0x40e1c9,_0x18b314)['then'](function(_0x1b75e1){logger[_0x0412('0x22')](_0x0412('0x23'),_0x53d2b2,_0x0412('0x24'));logger[_0x0412('0x25')](_0x0412('0x26'),_0x53d2b2,_0x0412('0x24'),JSON[_0x0412('0x27')](_0x1b75e1));if(_0x1b75e1[_0x0412('0x28')]){if(_0x1b75e1[_0x0412('0x28')][_0x0412('0x29')]===0x1f4){logger['error'](_0x0412('0x23'),_0x53d2b2,_0x1b75e1[_0x0412('0x28')]['message']);return _0x7b2227(_0x1b75e1[_0x0412('0x28')]['message']);}logger[_0x0412('0x28')](_0x0412('0x23'),_0x53d2b2,_0x1b75e1[_0x0412('0x28')][_0x0412('0x2a')]);return _0x515e94(_0x1b75e1[_0x0412('0x28')][_0x0412('0x2a')]);}else{logger['info'](_0x0412('0x23'),_0x53d2b2,_0x0412('0x24'));_0x515e94(_0x1b75e1[_0x0412('0x2b')][_0x0412('0x2a')]);}})[_0x0412('0x2c')](function(_0x14e8ca){logger[_0x0412('0x28')](_0x0412('0x23'),_0x53d2b2,_0x14e8ca);_0x7b2227(_0x14e8ca);});});}function respondWithStatusCode(_0x2e84c9,_0x419998){_0x419998=_0x419998||0xcc;return function(_0x1c0afb){if(_0x1c0afb){return _0x2e84c9[_0x0412('0x2d')](_0x419998);}return _0x2e84c9[_0x0412('0x2e')](_0x419998)['end']();};}function respondWithResult(_0xce725f,_0x395e52){_0x395e52=_0x395e52||0xc8;return function(_0x4f5d33){if(_0x4f5d33){return _0xce725f['status'](_0x395e52)[_0x0412('0x2f')](_0x4f5d33);}};}function respondWithFilteredResult(_0xb16e61,_0xff3556){return function(_0x382daa){if(_0x382daa){var _0x2d07e5=_0x382daa[_0x0412('0x30')],_0x20fe56=_0xff3556[_0x0412('0x31')],_0x4ba8c2=_0xff3556['offset']+_0xff3556[_0x0412('0x32')],_0x515de2;if(_0x4ba8c2>=_0x2d07e5){_0x4ba8c2=_0x2d07e5;_0x515de2=0xc8;}else{_0x515de2=0xce;}_0xb16e61[_0x0412('0x2e')](_0x515de2);return _0xb16e61[_0x0412('0x33')]('Content-Range',_0x20fe56+'-'+_0x4ba8c2+'/'+_0x2d07e5)[_0x0412('0x2f')](_0x382daa);}return null;};}function patchUpdates(_0x7c1f01){return function(_0xcaa5cf){try{jsonpatch[_0x0412('0x34')](_0xcaa5cf,_0x7c1f01,!![]);}catch(_0x151aeb){return BPromise[_0x0412('0x35')](_0x151aeb);}return _0xcaa5cf['save']();};}function saveUpdates(_0x966209,_0x54de68){return function(_0x855fa5){if(_0x855fa5){return _0x855fa5[_0x0412('0x36')](_0x966209)[_0x0412('0x37')](function(_0x52227b){return _0x52227b;});}return null;};}function removeEntity(_0x1dbf12,_0x5e053f){return function(_0x3ed2cf){if(_0x3ed2cf){return _0x3ed2cf['destroy']()[_0x0412('0x37')](function(){_0x1dbf12[_0x0412('0x2e')](0xcc)[_0x0412('0x38')]();});}};}function handleEntityNotFound(_0x30c3bb,_0x4560ac){return function(_0x53abac){if(!_0x53abac){_0x30c3bb[_0x0412('0x2d')](0x194);}return _0x53abac;};}function handleError(_0x1249f7,_0x4b679d){_0x4b679d=_0x4b679d||0x1f4;return function(_0x2b67c4){logger[_0x0412('0x28')](_0x2b67c4[_0x0412('0x39')]);if(_0x2b67c4[_0x0412('0x3a')]){delete _0x2b67c4[_0x0412('0x3a')];}_0x1249f7[_0x0412('0x2e')](_0x4b679d)[_0x0412('0x3b')](_0x2b67c4);};}exports[_0x0412('0x3c')]=function(_0x595779,_0x519ccc){var _0x4fd339={},_0x25884d={},_0x2e4d07={'count':0x0,'rows':[]};var _0x429670=_[_0x0412('0x3d')](db['ZohoAccount'][_0x0412('0x3e')],function(_0x4ea9c8){return{'name':_0x4ea9c8['fieldName'],'type':_0x4ea9c8[_0x0412('0x3f')][_0x0412('0x40')]};});_0x25884d[_0x0412('0x41')]=_[_0x0412('0x3d')](_0x429670,_0x0412('0x3a'));_0x25884d[_0x0412('0x42')]=_[_0x0412('0x43')](_0x595779[_0x0412('0x42')]);_0x25884d['filters']=_[_0x0412('0x44')](_0x25884d[_0x0412('0x41')],_0x25884d['query']);_0x4fd339[_0x0412('0x45')]=_['intersection'](_0x25884d[_0x0412('0x41')],qs[_0x0412('0x46')](_0x595779['query'][_0x0412('0x46')]));_0x4fd339['attributes']=_0x4fd339[_0x0412('0x45')]['length']?_0x4fd339['attributes']:_0x25884d[_0x0412('0x41')];if(!_0x595779[_0x0412('0x42')][_0x0412('0x47')](_0x0412('0x48'))){_0x4fd339[_0x0412('0x32')]=qs[_0x0412('0x32')](_0x595779[_0x0412('0x42')][_0x0412('0x32')]);_0x4fd339['offset']=qs[_0x0412('0x31')](_0x595779['query'][_0x0412('0x31')]);}_0x4fd339[_0x0412('0x49')]=qs[_0x0412('0x4a')](_0x595779[_0x0412('0x42')]['sort']);_0x4fd339['where']=qs[_0x0412('0x4b')](_[_0x0412('0x4c')](_0x595779[_0x0412('0x42')],_0x25884d[_0x0412('0x4b')]),_0x429670);if(_0x595779[_0x0412('0x42')][_0x0412('0x4d')]){_0x4fd339[_0x0412('0x4e')]=_[_0x0412('0x4f')](_0x4fd339[_0x0412('0x4e')],{'$or':_[_0x0412('0x3d')](_0x429670,function(_0x2a30ef){if(_0x2a30ef[_0x0412('0x3f')]!=='VIRTUAL'){var _0x4fc50f={};_0x4fc50f[_0x2a30ef[_0x0412('0x3a')]]={'$like':'%'+_0x595779[_0x0412('0x42')]['filter']+'%'};return _0x4fc50f;}})});}_0x4fd339=_[_0x0412('0x4f')]({},_0x4fd339,_0x595779[_0x0412('0x50')]);var _0x82154={'where':_0x4fd339[_0x0412('0x4e')]};return db[_0x0412('0x51')][_0x0412('0x30')](_0x82154)['then'](function(_0x5098cb){_0x2e4d07['count']=_0x5098cb;if(_0x595779['query']['includeAll']){_0x4fd339[_0x0412('0x52')]=[{'all':!![]}];}return db[_0x0412('0x51')][_0x0412('0x53')](_0x4fd339);})[_0x0412('0x37')](function(_0x56dd5f){_0x2e4d07[_0x0412('0x54')]=_0x56dd5f;return _0x2e4d07;})[_0x0412('0x37')](respondWithFilteredResult(_0x519ccc,_0x4fd339))[_0x0412('0x2c')](handleError(_0x519ccc,null));};exports['show']=function(_0x1d1e4a,_0x5f2e33){var _0x19c887={'raw':![],'where':{'id':_0x1d1e4a[_0x0412('0x55')]['id']}},_0x36229={};_0x36229[_0x0412('0x41')]=_[_0x0412('0x43')](db[_0x0412('0x51')][_0x0412('0x3e')]);_0x36229[_0x0412('0x42')]=_[_0x0412('0x43')](_0x1d1e4a[_0x0412('0x42')]);_0x36229[_0x0412('0x4b')]=_['intersection'](_0x36229[_0x0412('0x41')],_0x36229[_0x0412('0x42')]);_0x19c887[_0x0412('0x45')]=_[_0x0412('0x44')](_0x36229['model'],qs['fields'](_0x1d1e4a[_0x0412('0x42')][_0x0412('0x46')]));_0x19c887['attributes']=_0x19c887[_0x0412('0x45')]['length']?_0x19c887[_0x0412('0x45')]:_0x36229['model'];if(_0x1d1e4a[_0x0412('0x42')][_0x0412('0x56')]){_0x19c887[_0x0412('0x52')]=[{'all':!![]}];}_0x19c887=_[_0x0412('0x4f')]({},_0x19c887,_0x1d1e4a['options']);return db[_0x0412('0x51')][_0x0412('0x57')](_0x19c887)['then'](handleEntityNotFound(_0x5f2e33,null))['then'](respondWithResult(_0x5f2e33,null))[_0x0412('0x2c')](handleError(_0x5f2e33,null));};exports['create']=function(_0x53af2f,_0x57c458){return db['ZohoAccount'][_0x0412('0x58')](_0x53af2f[_0x0412('0x59')],{})[_0x0412('0x37')](respondWithResult(_0x57c458,0xc9))[_0x0412('0x2c')](handleError(_0x57c458,null));};exports['update']=function(_0x2365b5,_0x2ba8c2){if(_0x2365b5[_0x0412('0x59')]['id']){delete _0x2365b5[_0x0412('0x59')]['id'];}return db[_0x0412('0x51')]['find']({'where':{'id':_0x2365b5[_0x0412('0x55')]['id']}})[_0x0412('0x37')](handleEntityNotFound(_0x2ba8c2,null))[_0x0412('0x37')](saveUpdates(_0x2365b5[_0x0412('0x59')],null))[_0x0412('0x37')](respondWithResult(_0x2ba8c2,null))[_0x0412('0x2c')](handleError(_0x2ba8c2,null));};exports[_0x0412('0x5a')]=function(_0x488cf4,_0x413537){return db[_0x0412('0x51')][_0x0412('0x57')]({'where':{'id':_0x488cf4[_0x0412('0x55')]['id']}})[_0x0412('0x37')](handleEntityNotFound(_0x413537,null))[_0x0412('0x37')](removeEntity(_0x413537,null))[_0x0412('0x2c')](handleError(_0x413537,null));};exports['getConfigurations']=function(_0x41024d,_0x49621b,_0x5e8540){var _0x3f36f2={};var _0x3dcf07={};var _0x5cb05d;var _0x3cceb2;return db[_0x0412('0x51')][_0x0412('0x5b')]({'where':{'id':_0x41024d['params']['id']}})[_0x0412('0x37')](handleEntityNotFound(_0x49621b,null))[_0x0412('0x37')](function(_0x2a0e90){if(_0x2a0e90){_0x5cb05d=_0x2a0e90;_0x3dcf07[_0x0412('0x41')]=_[_0x0412('0x43')](db[_0x0412('0x5c')][_0x0412('0x3e')]);_0x3dcf07[_0x0412('0x42')]=_[_0x0412('0x43')](_0x41024d[_0x0412('0x42')]);_0x3dcf07['filters']=_[_0x0412('0x44')](_0x3dcf07[_0x0412('0x41')],_0x3dcf07[_0x0412('0x42')]);_0x3f36f2['attributes']=_['intersection'](_0x3dcf07[_0x0412('0x41')],qs[_0x0412('0x46')](_0x41024d[_0x0412('0x42')][_0x0412('0x46')]));_0x3f36f2[_0x0412('0x45')]=_0x3f36f2[_0x0412('0x45')][_0x0412('0x5d')]?_0x3f36f2[_0x0412('0x45')]:_0x3dcf07[_0x0412('0x41')];_0x3f36f2[_0x0412('0x49')]=qs['sort'](_0x41024d[_0x0412('0x42')][_0x0412('0x4a')]);_0x3f36f2[_0x0412('0x4e')]=qs[_0x0412('0x4b')](_[_0x0412('0x4c')](_0x41024d[_0x0412('0x42')],_0x3dcf07[_0x0412('0x4b')]));if(_0x41024d[_0x0412('0x42')][_0x0412('0x4d')]){_0x3f36f2['where']=_[_0x0412('0x4f')](_0x3f36f2[_0x0412('0x4e')],{'$or':_['map'](_0x3f36f2[_0x0412('0x45')],function(_0x392064){var _0x476e51={};_0x476e51[_0x392064]={'$like':'%'+_0x41024d['query'][_0x0412('0x4d')]+'%'};return _0x476e51;})});}_0x3f36f2=_[_0x0412('0x4f')]({},_0x3f36f2,_0x41024d[_0x0412('0x50')]);return _0x5cb05d[_0x0412('0x5e')](_0x3f36f2);}})[_0x0412('0x37')](function(_0x13fe52){if(_0x13fe52){_0x3cceb2=_0x13fe52[_0x0412('0x5d')];if(!_0x41024d[_0x0412('0x42')]['hasOwnProperty'](_0x0412('0x48'))){_0x3f36f2['limit']=qs[_0x0412('0x32')](_0x41024d[_0x0412('0x42')][_0x0412('0x32')]);_0x3f36f2[_0x0412('0x31')]=qs[_0x0412('0x31')](_0x41024d[_0x0412('0x42')][_0x0412('0x31')]);}return _0x5cb05d[_0x0412('0x5e')](_0x3f36f2);}})['then'](function(_0x152ca5){if(_0x152ca5){return _0x152ca5?{'count':_0x3cceb2,'rows':_0x152ca5}:null;}})[_0x0412('0x37')](respondWithResult(_0x49621b,null))[_0x0412('0x2c')](handleError(_0x49621b,null));};exports[_0x0412('0x5f')]=function(_0x57e3f4,_0x59d433,_0x5c245d){if(_0x57e3f4[_0x0412('0x59')]['id']){delete _0x57e3f4[_0x0412('0x59')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x57e3f4[_0x0412('0x55')]['id']}})[_0x0412('0x37')](handleEntityNotFound(_0x59d433,null))[_0x0412('0x37')](function(_0x296834){if(_0x296834){_0x57e3f4[_0x0412('0x59')][_0x0412('0x60')]=_0x296834['id'];_0x57e3f4[_0x0412('0x59')]['Subjects']=integrations[_0x0412('0x61')](_0x57e3f4['body'][_0x0412('0x62')],_0x57e3f4['body'][_0x0412('0x3f')]);_0x57e3f4[_0x0412('0x59')][_0x0412('0x63')]=integrations['getDescriptions'](_0x57e3f4[_0x0412('0x59')][_0x0412('0x62')],_0x57e3f4[_0x0412('0x59')][_0x0412('0x3f')]);return db[_0x0412('0x5c')][_0x0412('0x58')](_0x57e3f4['body'],{'include':[{'model':db[_0x0412('0x64')],'as':'Subjects'},{'model':db[_0x0412('0x64')],'as':_0x0412('0x63')}]});}return null;})['then'](respondWithResult(_0x59d433,null))[_0x0412('0x2c')](handleError(_0x59d433,null));};function getAccessToken(_0xb2c02){return new Promise(function(_0x7df166,_0x40551c){var _0x22cd9a;switch(_0xb2c02[_0x0412('0x65')]){case'US':_0x22cd9a=_0x0412('0x66');break;case'AU':_0x22cd9a='https://accounts.zoho.com.au';break;case'EU':_0x22cd9a=_0x0412('0x67');break;case'IN':_0x22cd9a=_0x0412('0x68');break;case'CN':_0x22cd9a=_0x0412('0x69');break;default:_0x22cd9a=_0x0412('0x67');break;}var _0x22ff36={'method':'POST','uri':_0x22cd9a+'/oauth/v2/token','qs':{'refresh_token':_0xb2c02[_0x0412('0x6a')],'client_id':_0xb2c02[_0x0412('0x6b')],'client_secret':_0xb2c02['clientSecret'],'grant_type':_0x0412('0x6c')},'json':!![]};return rp(_0x22ff36)[_0x0412('0x37')](function(_0x7ae7c0){if(_0x7ae7c0[_0x0412('0x6d')]){_0x7df166(_0x7ae7c0[_0x0412('0x6d')]);}else{_0x40551c(_0x0412('0x6e'));}})[_0x0412('0x2c')](function(_0x1249b9){_0x40551c(_0x1249b9);});});}exports[_0x0412('0x6f')]=function(_0x316060,_0x106234,_0x43dd8e){var _0x3327c4,_0x1054ce,_0x1251de,_0x42fb50,_0x20f7b5;return db[_0x0412('0x51')][_0x0412('0x5b')]({'where':{'id':_0x316060[_0x0412('0x55')]['id']},'attributes':['id',_0x0412('0x70'),_0x0412('0x65'),_0x0412('0x6b'),_0x0412('0x71'),_0x0412('0x72'),_0x0412('0x29'),_0x0412('0x6a')]})[_0x0412('0x37')](handleEntityNotFound(_0x106234,null))[_0x0412('0x37')](function(_0x2515e2){_0x20f7b5=_0x2515e2;_0x3327c4=_0x20f7b5[_0x0412('0x70')];_0x1054ce=_0x3327c4===_0x0412('0x73')?'eu':_0x0412('0x74');_0x1251de=_0x20f7b5[_0x0412('0x72')];var _0x2a848c=_0x1251de['slice'](-0x1);if(_0x2a848c==='/'||_0x2a848c==='\x5c'||_0x2a848c===':'){_0x1251de=_0x1251de[_0x0412('0x75')](0x0,_0x1251de[_0x0412('0x76')](_0x2a848c));}if(!_0x20f7b5['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x20f7b5);})[_0x0412('0x37')](function(_0x515006){if(_0x515006){return rp({'method':_0x0412('0x77'),'uri':util[_0x0412('0x78')](_0x0412('0x79'),_0x1054ce),'qs':{'module':_0x0412('0x7a')},'headers':{'Authorization':_0x0412('0x7b')+_0x515006},'json':!![]});}})[_0x0412('0x37')](function(_0x104955){if(_0x104955){if(_0x104955[_0x0412('0x7c')]&&_0x104955[_0x0412('0x7c')][_0x0412('0x28')]){throw new Error(_0x104955[_0x0412('0x7c')][_0x0412('0x28')]['message']);}var _0x488b5e=[];var _0xfbb4e2=[];var _0x1c94cd=[_0x0412('0x7d'),_0x0412('0x7e'),_0x0412('0x7f'),_0x0412('0x80'),_0x0412('0x81'),_0x0412('0x82'),_0x0412('0x83'),_0x0412('0x84')];_0xfbb4e2=_[_0x0412('0x85')](_0x104955['fields'],function(_0x418018){return _0x1c94cd[_0x0412('0x86')](_0x418018[_0x0412('0x87')]);});for(var _0x166a59=0x0;_0x166a59<_0xfbb4e2[_0x0412('0x5d')];_0x166a59++){if(_0xfbb4e2[_0x166a59][_0x0412('0x88')]===![]){_0x488b5e['push']({'id':_0xfbb4e2[_0x166a59]['id'],'name':_0xfbb4e2[_0x166a59][_0x0412('0x89')],'custom':_0xfbb4e2[_0x166a59][_0x0412('0x8a')],'options':_0xfbb4e2[_0x166a59][_0x0412('0x8b')]==='picklist'&&_0xfbb4e2[_0x166a59][_0x0412('0x8c')]['length']>-0x1?_['map'](_0xfbb4e2[_0x166a59][_0x0412('0x8c')],function(_0x43ad5a){return{'name':_0x43ad5a,'value':_0x43ad5a};}):[]});}}return{'count':_0x488b5e[_0x0412('0x5d')],'rows':_0x488b5e};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x106234,null))['catch'](function(_0x3af48b){var _0x3d6093=_0x316060['query'][_0x0412('0x1d')]?0x1f4:_0x3af48b[_0x0412('0x8d')]||0x1f4;logger[_0x0412('0x28')](_0x0412('0x8e'),_0x0412('0x6f'),_0x3d6093,JSON[_0x0412('0x27')](_0x3af48b));delete _0x3af48b[_0x0412('0x3a')];if(_0x3d6093===0x191){_0x3d6093=0x190;}_0x106234[_0x0412('0x2e')](_0x3d6093)[_0x0412('0x3b')](_0x316060['query']['test']?{'message':_0x0412('0x8f'),'statusCode':_0x3af48b[_0x0412('0x8d')]}:_0x3af48b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2da05bf..634667e 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 _0xbc13=['substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','refresh_token','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','catch','inspect','slice','parse','util','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host'];(function(_0x424f23,_0x4fb5f3){var _0x35fa76=function(_0x4eb1dd){while(--_0x4eb1dd){_0x424f23['push'](_0x424f23['shift']());}};_0x35fa76(++_0x4fb5f3);}(_0xbc13,0x1ba));var _0x3bc1=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0xbc13[_0x545b71];return _0x26e587;};'use strict';var _=require('lodash');var util=require(_0x3bc1('0x0'));var logger=require('../../config/logger')(_0x3bc1('0x1'));var moment=require(_0x3bc1('0x2'));var BPromise=require(_0x3bc1('0x3'));var rp=require(_0x3bc1('0x4'));var fs=require('fs');var path=require(_0x3bc1('0x5'));var rimraf=require(_0x3bc1('0x6'));var config=require('../../config/environment');var attributes=require(_0x3bc1('0x7'));var integrations=require(_0x3bc1('0x8'));module[_0x3bc1('0x9')]=function(_0x366da1,_0x5d012f){return _0x366da1[_0x3bc1('0xa')](_0x3bc1('0xb'),attributes,{'tableName':_0x3bc1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23b0f5,_0x4bbbda,_0x53c14e){if(_0x23b0f5[_0x3bc1('0xd')](_0x3bc1('0xe'))||_0x23b0f5['changed'](_0x3bc1('0xf'))||_0x23b0f5[_0x3bc1('0xd')](_0x3bc1('0x10'))||_0x23b0f5['changed'](_0x3bc1('0x11'))||_0x23b0f5[_0x3bc1('0xd')](_0x3bc1('0x12'))||_0x23b0f5[_0x3bc1('0xd')](_0x3bc1('0x13'))){var _0x3635fa,_0x36ecf9;_0x3635fa=_0x23b0f5[_0x3bc1('0xf')];var _0x451071=_0x3635fa['slice'](-0x1);if(_0x451071==='/'||_0x451071==='\x5c'||_0x451071===':'){_0x3635fa=_0x3635fa[_0x3bc1('0x14')](0x0,_0x3635fa[_0x3bc1('0x15')](_0x451071));}switch(_0x23b0f5[_0x3bc1('0xe')]){case'US':_0x36ecf9=_0x3bc1('0x16');break;case'AU':_0x36ecf9=_0x3bc1('0x17');break;case'IN':_0x36ecf9=_0x3bc1('0x18');break;case'CN':_0x36ecf9=_0x3bc1('0x19');break;default:_0x36ecf9=_0x3bc1('0x1a');break;}var _0x5042b2={'method':_0x3bc1('0x1b'),'uri':_0x36ecf9+_0x3bc1('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x23b0f5['clientId'],'client_secret':_0x23b0f5[_0x3bc1('0x11')],'redirect_uri':_0x23b0f5['serverUrl'],'code':_0x23b0f5[_0x3bc1('0x12')]},'headers':{'Content-Type':_0x3bc1('0x1d')}};return rp(_0x5042b2)[_0x3bc1('0x1e')](function(_0x5bc463){var _0x2a0638=JSON['parse'](_0x5bc463);if(_0x2a0638['refresh_token']){_0x23b0f5['refreshToken']=_0x2a0638[_0x3bc1('0x1f')];logger[_0x3bc1('0x20')](util[_0x3bc1('0x21')](_0x3bc1('0x22'),_0x23b0f5[_0x3bc1('0x23')],_0x23b0f5['id']));}else{logger[_0x3bc1('0x24')](util[_0x3bc1('0x21')](_0x3bc1('0x25'),_0x23b0f5[_0x3bc1('0x23')],_0x23b0f5['id']),util['inspect'](_0x2a0638,{'showHidden':![],'depth':null}));}return _0x53c14e(null,_0x4bbbda);})[_0x3bc1('0x26')](function(_0x306b82){logger[_0x3bc1('0x24')](util['format'](_0x3bc1('0x25'),_0x23b0f5[_0x3bc1('0x23')],_0x23b0f5['id']),util[_0x3bc1('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x53c14e(_0x306b82);});}else{return _0x53c14e(null,_0x4bbbda);}},'beforeUpdate':function(_0x21cbf,_0x1a383c,_0x4e83ac){if(_0x21cbf[_0x3bc1('0xd')](_0x3bc1('0xe'))||_0x21cbf[_0x3bc1('0xd')](_0x3bc1('0xf'))||_0x21cbf[_0x3bc1('0xd')](_0x3bc1('0x10'))||_0x21cbf[_0x3bc1('0xd')]('clientSecret')||_0x21cbf[_0x3bc1('0xd')](_0x3bc1('0x12'))||_0x21cbf[_0x3bc1('0xd')](_0x3bc1('0x13'))){var _0x484505,_0x3e5bfe;_0x484505=_0x21cbf[_0x3bc1('0xf')];var _0x4c9faa=_0x484505[_0x3bc1('0x28')](-0x1);if(_0x4c9faa==='/'||_0x4c9faa==='\x5c'||_0x4c9faa===':'){_0x484505=_0x484505[_0x3bc1('0x14')](0x0,_0x484505['lastIndexOf'](_0x4c9faa));}switch(_0x21cbf[_0x3bc1('0xe')]){case'US':_0x3e5bfe='https://accounts.zoho.com';break;case'AU':_0x3e5bfe=_0x3bc1('0x17');break;case'IN':_0x3e5bfe=_0x3bc1('0x18');break;case'CN':_0x3e5bfe='https://accounts.zoho.com.cn';break;default:_0x3e5bfe=_0x3bc1('0x1a');break;}var _0x4752cb={'method':_0x3bc1('0x1b'),'uri':_0x3e5bfe+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x21cbf['clientId'],'client_secret':_0x21cbf[_0x3bc1('0x11')],'redirect_uri':_0x21cbf[_0x3bc1('0xf')],'code':_0x21cbf[_0x3bc1('0x12')]},'headers':{'Content-Type':_0x3bc1('0x1d')}};return rp(_0x4752cb)[_0x3bc1('0x1e')](function(_0xc8e713){var _0x44aea8=JSON[_0x3bc1('0x29')](_0xc8e713);if(_0x44aea8['refresh_token']){_0x21cbf['refreshToken']=_0x44aea8['refresh_token'];logger['info'](util[_0x3bc1('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x21cbf[_0x3bc1('0x23')],_0x21cbf['id']));}else{logger[_0x3bc1('0x24')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x21cbf[_0x3bc1('0x23')],_0x21cbf['id']),util['inspect'](_0x44aea8,{'showHidden':![],'depth':null}));}return _0x4e83ac(null,_0x1a383c);})[_0x3bc1('0x26')](function(_0xfaa309){logger[_0x3bc1('0x24')](util[_0x3bc1('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x21cbf['name'],_0x21cbf['id']),util[_0x3bc1('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x4e83ac(_0xfaa309);});}else{return _0x4e83ac(null,_0x1a383c);}}}});}; \ No newline at end of file +var _0x178a=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','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','lodash'];(function(_0x1f639d,_0xaeb2d1){var _0x2bb109=function(_0x15b527){while(--_0x15b527){_0x1f639d['push'](_0x1f639d['shift']());}};_0x2bb109(++_0xaeb2d1);}(_0x178a,0x179));var _0xa178=function(_0x38fbc6,_0x360875){_0x38fbc6=_0x38fbc6-0x0;var _0x47197e=_0x178a[_0x38fbc6];return _0x47197e;};'use strict';var _=require(_0xa178('0x0'));var util=require(_0xa178('0x1'));var logger=require(_0xa178('0x2'))(_0xa178('0x3'));var moment=require(_0xa178('0x4'));var BPromise=require(_0xa178('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa178('0x6'));var rimraf=require(_0xa178('0x7'));var config=require(_0xa178('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xa178('0x9'));module['exports']=function(_0x30428d,_0x2182cb){return _0x30428d[_0xa178('0xa')](_0xa178('0xb'),attributes,{'tableName':_0xa178('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29482a,_0x2a63a9,_0x2d2fe7){if(_0x29482a[_0xa178('0xd')](_0xa178('0xe'))||_0x29482a[_0xa178('0xd')](_0xa178('0xf'))||_0x29482a[_0xa178('0xd')](_0xa178('0x10'))||_0x29482a['changed'](_0xa178('0x11'))||_0x29482a[_0xa178('0xd')](_0xa178('0x12'))||_0x29482a[_0xa178('0xd')](_0xa178('0x13'))){var _0x20d336,_0x2aad08;_0x20d336=_0x29482a['serverUrl'];var _0x347066=_0x20d336['slice'](-0x1);if(_0x347066==='/'||_0x347066==='\x5c'||_0x347066===':'){_0x20d336=_0x20d336[_0xa178('0x14')](0x0,_0x20d336[_0xa178('0x15')](_0x347066));}switch(_0x29482a['zone']){case'US':_0x2aad08=_0xa178('0x16');break;case'AU':_0x2aad08=_0xa178('0x17');break;case'IN':_0x2aad08=_0xa178('0x18');break;case'CN':_0x2aad08='https://accounts.zoho.com.cn';break;default:_0x2aad08=_0xa178('0x19');break;}var _0xf859d6={'method':_0xa178('0x1a'),'uri':_0x2aad08+_0xa178('0x1b'),'form':{'grant_type':_0xa178('0x1c'),'client_id':_0x29482a[_0xa178('0x10')],'client_secret':_0x29482a[_0xa178('0x11')],'redirect_uri':_0x29482a['serverUrl'],'code':_0x29482a[_0xa178('0x12')]},'headers':{'Content-Type':_0xa178('0x1d')}};return rp(_0xf859d6)[_0xa178('0x1e')](function(_0x5ea0ec){var _0x57d39c=JSON[_0xa178('0x1f')](_0x5ea0ec);if(_0x57d39c['refresh_token']){_0x29482a[_0xa178('0x20')]=_0x57d39c[_0xa178('0x21')];logger[_0xa178('0x22')](util[_0xa178('0x23')](_0xa178('0x24'),_0x29482a[_0xa178('0x25')],_0x29482a['id']));}else{logger[_0xa178('0x26')](util[_0xa178('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29482a[_0xa178('0x25')],_0x29482a['id']),util[_0xa178('0x27')](_0x57d39c,{'showHidden':![],'depth':null}));}return _0x2d2fe7(null,_0x2a63a9);})['catch'](function(_0x3072d2){logger[_0xa178('0x26')](util[_0xa178('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x29482a[_0xa178('0x25')],_0x29482a['id']),util[_0xa178('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x2d2fe7(_0x3072d2);});}else{return _0x2d2fe7(null,_0x2a63a9);}},'beforeUpdate':function(_0x31a985,_0x823a06,_0x41d00e){if(_0x31a985['changed'](_0xa178('0xe'))||_0x31a985['changed']('serverUrl')||_0x31a985[_0xa178('0xd')](_0xa178('0x10'))||_0x31a985[_0xa178('0xd')](_0xa178('0x11'))||_0x31a985[_0xa178('0xd')](_0xa178('0x12'))||_0x31a985[_0xa178('0xd')](_0xa178('0x13'))){var _0x3436bb,_0x2f4ed3;_0x3436bb=_0x31a985[_0xa178('0xf')];var _0x21d555=_0x3436bb['slice'](-0x1);if(_0x21d555==='/'||_0x21d555==='\x5c'||_0x21d555===':'){_0x3436bb=_0x3436bb[_0xa178('0x14')](0x0,_0x3436bb[_0xa178('0x15')](_0x21d555));}switch(_0x31a985['zone']){case'US':_0x2f4ed3=_0xa178('0x16');break;case'AU':_0x2f4ed3='https://accounts.zoho.com.au';break;case'IN':_0x2f4ed3=_0xa178('0x18');break;case'CN':_0x2f4ed3='https://accounts.zoho.com.cn';break;default:_0x2f4ed3=_0xa178('0x19');break;}var _0x11f19c={'method':'POST','uri':_0x2f4ed3+_0xa178('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x31a985[_0xa178('0x10')],'client_secret':_0x31a985[_0xa178('0x11')],'redirect_uri':_0x31a985[_0xa178('0xf')],'code':_0x31a985['code']},'headers':{'Content-Type':_0xa178('0x1d')}};return rp(_0x11f19c)[_0xa178('0x1e')](function(_0x25cfbd){var _0x5b5281=JSON[_0xa178('0x1f')](_0x25cfbd);if(_0x5b5281[_0xa178('0x21')]){_0x31a985[_0xa178('0x20')]=_0x5b5281[_0xa178('0x21')];logger[_0xa178('0x22')](util[_0xa178('0x23')](_0xa178('0x24'),_0x31a985['name'],_0x31a985['id']));}else{logger[_0xa178('0x26')](util[_0xa178('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31a985[_0xa178('0x25')],_0x31a985['id']),util[_0xa178('0x27')](_0x5b5281,{'showHidden':![],'depth':null}));}return _0x41d00e(null,_0x823a06);})[_0xa178('0x28')](function(_0x5678df){logger[_0xa178('0x26')](util['format'](_0xa178('0x29'),_0x31a985[_0xa178('0x25')],_0x31a985['id']),util[_0xa178('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x41d00e(_0x5678df);});}else{return _0x41d00e(null,_0x823a06);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4c979d2..76217e8 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 _0x1134=['attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ZohoAccount','findAll','options','raw','where'];(function(_0x5c8a04,_0x7b7bfa){var _0x419366=function(_0x57a718){while(--_0x57a718){_0x5c8a04['push'](_0x5c8a04['shift']());}};_0x419366(++_0x7b7bfa);}(_0x1134,0x1c4));var _0x4113=function(_0x39cd9d,_0x58f4ea){_0x39cd9d=_0x39cd9d-0x0;var _0x335e42=_0x1134[_0x39cd9d];return _0x335e42;};'use strict';var _=require(_0x4113('0x0'));var util=require(_0x4113('0x1'));var moment=require(_0x4113('0x2'));var BPromise=require(_0x4113('0x3'));var rs=require(_0x4113('0x4'));var fs=require('fs');var Redis=require(_0x4113('0x5'));var db=require(_0x4113('0x6'))['db'];var utils=require(_0x4113('0x7'));var logger=require('../../config/logger')(_0x4113('0x8'));var config=require('../../config/environment');var jayson=require(_0x4113('0x9'));var client=jayson[_0x4113('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d42e2,_0x10dcb8,_0xb63508){return new BPromise(function(_0x29917d,_0x161bf2){return client[_0x4113('0xb')](_0x3d42e2,_0xb63508)[_0x4113('0xc')](function(_0x34af62){logger[_0x4113('0xd')](_0x4113('0xe'),_0x10dcb8,_0x4113('0xf'));logger[_0x4113('0x10')](_0x4113('0x11'),_0x10dcb8,_0x4113('0xf'),JSON[_0x4113('0x12')](_0x34af62));if(_0x34af62[_0x4113('0x13')]){if(_0x34af62[_0x4113('0x13')][_0x4113('0x14')]===0x1f4){logger[_0x4113('0x13')](_0x4113('0xe'),_0x10dcb8,_0x34af62[_0x4113('0x13')]['message']);return _0x161bf2(_0x34af62[_0x4113('0x13')][_0x4113('0x15')]);}logger['error'](_0x4113('0xe'),_0x10dcb8,_0x34af62[_0x4113('0x13')][_0x4113('0x15')]);return _0x29917d(_0x34af62[_0x4113('0x13')]['message']);}else{logger[_0x4113('0xd')](_0x4113('0xe'),_0x10dcb8,'request\x20sent');_0x29917d(_0x34af62[_0x4113('0x16')][_0x4113('0x15')]);}})[_0x4113('0x17')](function(_0x4bd00d){logger[_0x4113('0x13')](_0x4113('0xe'),_0x10dcb8,_0x4bd00d);_0x161bf2(_0x4bd00d);});});}exports['GetZohoAccount']=function(_0x472bfa){var _0x251ed6=this;return new Promise(function(_0x364456,_0x541ad3){return db[_0x4113('0x18')][_0x4113('0x19')]({'raw':_0x472bfa['options']?_0x472bfa[_0x4113('0x1a')][_0x4113('0x1b')]===undefined?!![]:![]:!![],'where':_0x472bfa[_0x4113('0x1a')]?_0x472bfa[_0x4113('0x1a')][_0x4113('0x1c')]||null:null,'attributes':_0x472bfa[_0x4113('0x1a')]?_0x472bfa[_0x4113('0x1a')][_0x4113('0x1d')]||null:null,'limit':_0x472bfa[_0x4113('0x1a')]?_0x472bfa[_0x4113('0x1a')][_0x4113('0x1e')]||null:null,'include':_0x472bfa[_0x4113('0x1a')]?_0x472bfa[_0x4113('0x1a')][_0x4113('0x1f')]?_[_0x4113('0x20')](_0x472bfa[_0x4113('0x1a')][_0x4113('0x1f')],function(_0x155d96){return{'model':db[_0x155d96[_0x4113('0x21')]],'as':_0x155d96['as'],'attributes':_0x155d96[_0x4113('0x1d')],'include':_0x155d96[_0x4113('0x1f')]?_[_0x4113('0x20')](_0x155d96[_0x4113('0x1f')],function(_0x56b107){return{'model':db[_0x56b107[_0x4113('0x21')]],'as':_0x56b107['as'],'attributes':_0x56b107[_0x4113('0x1d')],'include':_0x56b107[_0x4113('0x1f')]?_[_0x4113('0x20')](_0x56b107['include'],function(_0x5a6bc7){return{'model':db[_0x5a6bc7[_0x4113('0x21')]],'as':_0x5a6bc7['as'],'attributes':_0x5a6bc7[_0x4113('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4113('0xc')](function(_0x42241f){logger[_0x4113('0xd')]('GetZohoAccount',_0x472bfa);logger[_0x4113('0x10')](_0x4113('0x22'),_0x472bfa,JSON[_0x4113('0x12')](_0x42241f));_0x364456(_0x42241f);})['catch'](function(_0x3d6ec2){logger[_0x4113('0x13')]('GetZohoAccount',_0x3d6ec2[_0x4113('0x15')],_0x472bfa);_0x541ad3(_0x251ed6['error'](0x1f4,_0x3d6ec2['message']));});});};exports[_0x4113('0x23')]=function(_0x3530f6){var _0x5adf05=this;return new Promise(function(_0x52ffb1,_0x36278a){return db[_0x4113('0x18')][_0x4113('0x24')]({'raw':_0x3530f6[_0x4113('0x1a')]?_0x3530f6[_0x4113('0x1a')][_0x4113('0x1b')]===undefined?!![]:![]:!![],'where':_0x3530f6['options']?_0x3530f6[_0x4113('0x1a')][_0x4113('0x1c')]||null:null,'attributes':_0x3530f6[_0x4113('0x1a')]?_0x3530f6[_0x4113('0x1a')][_0x4113('0x1d')]||null:null,'include':_0x3530f6[_0x4113('0x1a')]?_0x3530f6[_0x4113('0x1a')][_0x4113('0x1f')]?_[_0x4113('0x20')](_0x3530f6[_0x4113('0x1a')][_0x4113('0x1f')],function(_0x1f41fa){return{'model':db[_0x1f41fa[_0x4113('0x21')]],'as':_0x1f41fa['as'],'attributes':_0x1f41fa[_0x4113('0x1d')],'include':_0x1f41fa[_0x4113('0x1f')]?_['map'](_0x1f41fa['include'],function(_0x54a05b){return{'model':db[_0x54a05b[_0x4113('0x21')]],'as':_0x54a05b['as'],'attributes':_0x54a05b[_0x4113('0x1d')],'include':_0x54a05b[_0x4113('0x1f')]?_[_0x4113('0x20')](_0x54a05b[_0x4113('0x1f')],function(_0x581716){return{'model':db[_0x581716[_0x4113('0x21')]],'as':_0x581716['as'],'attributes':_0x581716[_0x4113('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4113('0xc')](function(_0xe08585){logger[_0x4113('0xd')](_0x4113('0x23'),_0x3530f6);logger[_0x4113('0x10')](_0x4113('0x23'),_0x3530f6,JSON[_0x4113('0x12')](_0xe08585));_0x52ffb1(_0xe08585);})[_0x4113('0x17')](function(_0xe3f713){logger['error'](_0x4113('0x23'),_0xe3f713[_0x4113('0x15')],_0x3530f6);_0x36278a(_0x5adf05['error'](0x1f4,_0xe3f713[_0x4113('0x15')]));});});}; \ No newline at end of file +var _0x7d31=['find','where','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','limit','include','attributes','map','model','ShowZohoAccount'];(function(_0xf0c02d,_0x409c69){var _0x124e61=function(_0x3e8f69){while(--_0x3e8f69){_0xf0c02d['push'](_0xf0c02d['shift']());}};_0x124e61(++_0x409c69);}(_0x7d31,0x1e4));var _0x17d3=function(_0x3922bf,_0xc3d306){_0x3922bf=_0x3922bf-0x0;var _0x56ba39=_0x7d31[_0x3922bf];return _0x56ba39;};'use strict';var _=require(_0x17d3('0x0'));var util=require('util');var moment=require(_0x17d3('0x1'));var BPromise=require(_0x17d3('0x2'));var rs=require(_0x17d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17d3('0x4'))['db'];var utils=require(_0x17d3('0x5'));var logger=require(_0x17d3('0x6'))(_0x17d3('0x7'));var config=require(_0x17d3('0x8'));var jayson=require(_0x17d3('0x9'));var client=jayson[_0x17d3('0xa')][_0x17d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14c515,_0x7e7376,_0x59589f){return new BPromise(function(_0x3d7936,_0x359c2e){return client['request'](_0x14c515,_0x59589f)[_0x17d3('0xc')](function(_0x250c4b){logger[_0x17d3('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x7e7376,'request\x20sent');logger[_0x17d3('0xe')](_0x17d3('0xf'),_0x7e7376,_0x17d3('0x10'),JSON[_0x17d3('0x11')](_0x250c4b));if(_0x250c4b[_0x17d3('0x12')]){if(_0x250c4b[_0x17d3('0x12')][_0x17d3('0x13')]===0x1f4){logger[_0x17d3('0x12')](_0x17d3('0x14'),_0x7e7376,_0x250c4b[_0x17d3('0x12')][_0x17d3('0x15')]);return _0x359c2e(_0x250c4b[_0x17d3('0x12')][_0x17d3('0x15')]);}logger[_0x17d3('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x7e7376,_0x250c4b[_0x17d3('0x12')]['message']);return _0x3d7936(_0x250c4b['error']['message']);}else{logger[_0x17d3('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x7e7376,_0x17d3('0x10'));_0x3d7936(_0x250c4b[_0x17d3('0x16')]['message']);}})['catch'](function(_0x5d7f4e){logger[_0x17d3('0x12')](_0x17d3('0x14'),_0x7e7376,_0x5d7f4e);_0x359c2e(_0x5d7f4e);});});}exports[_0x17d3('0x17')]=function(_0x430e3e){var _0x10f45f=this;return new Promise(function(_0x41d1d9,_0x127f65){return db[_0x17d3('0x18')][_0x17d3('0x19')]({'raw':_0x430e3e[_0x17d3('0x1a')]?_0x430e3e['options'][_0x17d3('0x1b')]===undefined?!![]:![]:!![],'where':_0x430e3e['options']?_0x430e3e[_0x17d3('0x1a')]['where']||null:null,'attributes':_0x430e3e['options']?_0x430e3e[_0x17d3('0x1a')]['attributes']||null:null,'limit':_0x430e3e[_0x17d3('0x1a')]?_0x430e3e[_0x17d3('0x1a')][_0x17d3('0x1c')]||null:null,'include':_0x430e3e[_0x17d3('0x1a')]?_0x430e3e[_0x17d3('0x1a')][_0x17d3('0x1d')]?_['map'](_0x430e3e[_0x17d3('0x1a')][_0x17d3('0x1d')],function(_0x22064a){return{'model':db[_0x22064a['model']],'as':_0x22064a['as'],'attributes':_0x22064a[_0x17d3('0x1e')],'include':_0x22064a[_0x17d3('0x1d')]?_[_0x17d3('0x1f')](_0x22064a[_0x17d3('0x1d')],function(_0x2ac50b){return{'model':db[_0x2ac50b[_0x17d3('0x20')]],'as':_0x2ac50b['as'],'attributes':_0x2ac50b[_0x17d3('0x1e')],'include':_0x2ac50b[_0x17d3('0x1d')]?_[_0x17d3('0x1f')](_0x2ac50b[_0x17d3('0x1d')],function(_0x3c95d7){return{'model':db[_0x3c95d7[_0x17d3('0x20')]],'as':_0x3c95d7['as'],'attributes':_0x3c95d7[_0x17d3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x17d3('0xc')](function(_0x3297b5){logger['info']('GetZohoAccount',_0x430e3e);logger[_0x17d3('0xe')](_0x17d3('0x17'),_0x430e3e,JSON[_0x17d3('0x11')](_0x3297b5));_0x41d1d9(_0x3297b5);})['catch'](function(_0x418535){logger[_0x17d3('0x12')](_0x17d3('0x17'),_0x418535[_0x17d3('0x15')],_0x430e3e);_0x127f65(_0x10f45f[_0x17d3('0x12')](0x1f4,_0x418535[_0x17d3('0x15')]));});});};exports[_0x17d3('0x21')]=function(_0x1d7c12){var _0x66e375=this;return new Promise(function(_0x3dc6a4,_0x34c38f){return db[_0x17d3('0x18')][_0x17d3('0x22')]({'raw':_0x1d7c12[_0x17d3('0x1a')]?_0x1d7c12['options'][_0x17d3('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d7c12[_0x17d3('0x1a')]?_0x1d7c12['options'][_0x17d3('0x23')]||null:null,'attributes':_0x1d7c12[_0x17d3('0x1a')]?_0x1d7c12[_0x17d3('0x1a')][_0x17d3('0x1e')]||null:null,'include':_0x1d7c12[_0x17d3('0x1a')]?_0x1d7c12[_0x17d3('0x1a')]['include']?_[_0x17d3('0x1f')](_0x1d7c12[_0x17d3('0x1a')]['include'],function(_0x1e7060){return{'model':db[_0x1e7060[_0x17d3('0x20')]],'as':_0x1e7060['as'],'attributes':_0x1e7060[_0x17d3('0x1e')],'include':_0x1e7060['include']?_[_0x17d3('0x1f')](_0x1e7060['include'],function(_0x38401e){return{'model':db[_0x38401e[_0x17d3('0x20')]],'as':_0x38401e['as'],'attributes':_0x38401e[_0x17d3('0x1e')],'include':_0x38401e[_0x17d3('0x1d')]?_[_0x17d3('0x1f')](_0x38401e[_0x17d3('0x1d')],function(_0x1c2104){return{'model':db[_0x1c2104[_0x17d3('0x20')]],'as':_0x1c2104['as'],'attributes':_0x1c2104[_0x17d3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x17d3('0xc')](function(_0x4bbc15){logger[_0x17d3('0xd')](_0x17d3('0x21'),_0x1d7c12);logger[_0x17d3('0xe')](_0x17d3('0x21'),_0x1d7c12,JSON['stringify'](_0x4bbc15));_0x3dc6a4(_0x4bbc15);})[_0x17d3('0x24')](function(_0x1b89bf){logger[_0x17d3('0x12')](_0x17d3('0x21'),_0x1b89bf[_0x17d3('0x15')],_0x1d7c12);_0x34c38f(_0x66e375[_0x17d3('0x12')](0x1f4,_0x1b89bf[_0x17d3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 3c7a333..c964f83 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 _0x58d6=['getDescriptions','post','create','put','delete','destroy','exports','util','path','express','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xc5caf7,_0xc6d31b){var _0x509351=function(_0x531902){while(--_0x531902){_0xc5caf7['push'](_0xc5caf7['shift']());}};_0x509351(++_0xc6d31b);}(_0x58d6,0x1d3));var _0x658d=function(_0x41c66d,_0x512755){_0x41c66d=_0x41c66d-0x0;var _0x4b3302=_0x58d6[_0x41c66d];return _0x4b3302;};'use strict';var multer=require('multer');var util=require(_0x658d('0x0'));var path=require(_0x658d('0x1'));var timeout=require('connect-timeout');var express=require(_0x658d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x658d('0x3'));var config=require(_0x658d('0x4'));var controller=require(_0x658d('0x5'));router[_0x658d('0x6')]('/',auth['isAuthenticated'](),controller[_0x658d('0x7')]);router['get'](_0x658d('0x8'),auth[_0x658d('0x9')](),controller[_0x658d('0xa')]);router['get'](_0x658d('0xb'),auth[_0x658d('0x9')](),controller[_0x658d('0xc')]);router['get'](_0x658d('0xd'),auth['isAuthenticated'](),controller[_0x658d('0xe')]);router[_0x658d('0x6')](_0x658d('0xf'),auth['isAuthenticated'](),controller[_0x658d('0x10')]);router[_0x658d('0x11')]('/',auth[_0x658d('0x9')](),controller[_0x658d('0x12')]);router[_0x658d('0x13')](_0x658d('0x8'),auth[_0x658d('0x9')](),controller['update']);router[_0x658d('0x14')](_0x658d('0x8'),auth[_0x658d('0x9')](),controller[_0x658d('0x15')]);module[_0x658d('0x16')]=router; \ No newline at end of file +var _0x80df=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','multer','util'];(function(_0x1a1267,_0x57cc80){var _0x5f528c=function(_0x93c485){while(--_0x93c485){_0x1a1267['push'](_0x1a1267['shift']());}};_0x5f528c(++_0x57cc80);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var path=require(_0xf80d('0x2'));var timeout=require(_0xf80d('0x3'));var express=require('express');var router=express[_0xf80d('0x4')]();var auth=require(_0xf80d('0x5'));var interaction=require(_0xf80d('0x6'));var config=require(_0xf80d('0x7'));var controller=require(_0xf80d('0x8'));router[_0xf80d('0x9')]('/',auth[_0xf80d('0xa')](),controller[_0xf80d('0xb')]);router[_0xf80d('0x9')](_0xf80d('0xc'),auth['isAuthenticated'](),controller[_0xf80d('0xd')]);router[_0xf80d('0x9')](_0xf80d('0xe'),auth[_0xf80d('0xa')](),controller[_0xf80d('0xf')]);router[_0xf80d('0x9')](_0xf80d('0x10'),auth[_0xf80d('0xa')](),controller[_0xf80d('0x11')]);router[_0xf80d('0x9')](_0xf80d('0x12'),auth[_0xf80d('0xa')](),controller[_0xf80d('0x13')]);router[_0xf80d('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf80d('0x15')](_0xf80d('0xc'),auth['isAuthenticated'](),controller[_0xf80d('0x16')]);router['delete'](_0xf80d('0xc'),auth['isAuthenticated'](),controller[_0xf80d('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 150fcf8..502c9a8 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 _0xd64a=['contact','nothing','exports','STRING','ENUM','lead'];(function(_0x48e1a0,_0x1334bb){var _0xe09307=function(_0x32eeae){while(--_0x32eeae){_0x48e1a0['push'](_0x48e1a0['shift']());}};_0xe09307(++_0x1334bb);}(_0xd64a,0x1a6));var _0xad64=function(_0x202f9b,_0x2b37f6){_0x202f9b=_0x202f9b-0x0;var _0x395d01=_0xd64a[_0x202f9b];return _0x395d01;};'use strict';var Sequelize=require('sequelize');module[_0xad64('0x0')]={'name':{'type':Sequelize[_0xad64('0x1')]},'moduleCreate':{'type':Sequelize[_0xad64('0x2')](_0xad64('0x3'),_0xad64('0x4'),_0xad64('0x5')),'defaultValue':_0xad64('0x3')},'moduleSearch':{'type':Sequelize[_0xad64('0x2')]('contact_lead','contact','lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xad64('0x1')]}}; \ No newline at end of file +var _0x386d=['exports','STRING','ENUM','nothing','lead','contact_lead','contact','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x386d,0x1af));var _0xd386=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x386d[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xd386('0x0'));module[_0xd386('0x1')]={'name':{'type':Sequelize[_0xd386('0x2')]},'moduleCreate':{'type':Sequelize[_0xd386('0x3')]('lead','contact',_0xd386('0x4')),'defaultValue':_0xd386('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0xd386('0x6'),_0xd386('0x7'),_0xd386('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xd386('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5842b36..7166214 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 _0xee18=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','include','options','create','body','find','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xee18,0x7d));var _0x8ee1=function(_0x4e5d67,_0x54dffc){_0x4e5d67=_0x4e5d67-0x0;var _0x4acdf3=_0xee18[_0x4e5d67];return _0x4acdf3;};'use strict';var pdf=require(_0x8ee1('0x0'));var emlformat=require(_0x8ee1('0x1'));var rimraf=require(_0x8ee1('0x2'));var zipdir=require(_0x8ee1('0x3'));var jsonpatch=require(_0x8ee1('0x4'));var rp=require(_0x8ee1('0x5'));var moment=require('moment');var BPromise=require(_0x8ee1('0x6'));var Mustache=require(_0x8ee1('0x7'));var util=require(_0x8ee1('0x8'));var path=require(_0x8ee1('0x9'));var sox=require(_0x8ee1('0xa'));var csv=require(_0x8ee1('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8ee1('0xc'));var squel=require(_0x8ee1('0xd'));var crypto=require('crypto');var jsforce=require(_0x8ee1('0xe'));var deskjs=require(_0x8ee1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ee1('0x10'));var Redis=require(_0x8ee1('0x11'));var authService=require(_0x8ee1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8ee1('0x13'));var hardwareService=require(_0x8ee1('0x14'));var logger=require('../../config/logger')(_0x8ee1('0x15'));var utils=require(_0x8ee1('0x16'));var config=require(_0x8ee1('0x17'));var db=require(_0x8ee1('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x8ee1('0x19')][_0x8ee1('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4d3d66,_0xbe0601,_0x1b9454){if(_0x1b9454){var _0x216a06=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x216a06[_0x8ee1('0x1b')](_0xbe0601)){return _0x4d3d66;}else{throw new db['Sequelize'][(_0x8ee1('0x1c'))](_0x8ee1('0x1d'));}}else{return _0x4d3d66;}}function respondWithRpcPromise(_0x1ce5b1,_0x45385e,_0x325736,_0xd43c01){return new BPromise(function(_0x14828a,_0x36aef6){var _0x28a50b=_0xd43c01||client;return _0x28a50b['request'](_0x1ce5b1,_0x325736)[_0x8ee1('0x1e')](function(_0xbacfa7){logger['info'](_0x8ee1('0x1f'),_0x45385e,'request\x20sent');logger[_0x8ee1('0x20')](_0x8ee1('0x21'),_0x45385e,'request\x20sent',JSON[_0x8ee1('0x22')](_0xbacfa7));if(_0xbacfa7[_0x8ee1('0x23')]){if(_0xbacfa7[_0x8ee1('0x23')]['code']===0x1f4){logger[_0x8ee1('0x23')](_0x8ee1('0x1f'),_0x45385e,_0xbacfa7[_0x8ee1('0x23')]['message']);return _0x36aef6(_0xbacfa7[_0x8ee1('0x23')][_0x8ee1('0x24')]);}logger[_0x8ee1('0x23')](_0x8ee1('0x1f'),_0x45385e,_0xbacfa7[_0x8ee1('0x23')][_0x8ee1('0x24')]);return _0x14828a(_0xbacfa7['error'][_0x8ee1('0x24')]);}else{logger[_0x8ee1('0x25')](_0x8ee1('0x1f'),_0x45385e,_0x8ee1('0x26'));_0x14828a(_0xbacfa7[_0x8ee1('0x27')][_0x8ee1('0x24')]);}})[_0x8ee1('0x28')](function(_0x1fa2a8){logger['error'](_0x8ee1('0x1f'),_0x45385e,_0x1fa2a8);_0x36aef6(_0x1fa2a8);});});}function respondWithStatusCode(_0x5a1f3b,_0x1b59ce){_0x1b59ce=_0x1b59ce||0xcc;return function(_0x567b00){if(_0x567b00){return _0x5a1f3b[_0x8ee1('0x29')](_0x1b59ce);}return _0x5a1f3b[_0x8ee1('0x2a')](_0x1b59ce)[_0x8ee1('0x2b')]();};}function respondWithResult(_0x298485,_0x561c3a){_0x561c3a=_0x561c3a||0xc8;return function(_0x53ad0b){if(_0x53ad0b){return _0x298485['status'](_0x561c3a)['json'](_0x53ad0b);}};}function respondWithFilteredResult(_0x281ed5,_0x412036){return function(_0x5619aa){if(_0x5619aa){var _0x1bd5ec=_0x5619aa[_0x8ee1('0x2c')],_0x288770=_0x412036[_0x8ee1('0x2d')],_0xdf9eef=_0x412036[_0x8ee1('0x2d')]+_0x412036[_0x8ee1('0x2e')],_0x51059f;if(_0xdf9eef>=_0x1bd5ec){_0xdf9eef=_0x1bd5ec;_0x51059f=0xc8;}else{_0x51059f=0xce;}_0x281ed5[_0x8ee1('0x2a')](_0x51059f);return _0x281ed5[_0x8ee1('0x2f')](_0x8ee1('0x30'),_0x288770+'-'+_0xdf9eef+'/'+_0x1bd5ec)[_0x8ee1('0x31')](_0x5619aa);}return null;};}function patchUpdates(_0x45a268){return function(_0x58bb53){try{jsonpatch[_0x8ee1('0x32')](_0x58bb53,_0x45a268,!![]);}catch(_0x217587){return BPromise[_0x8ee1('0x33')](_0x217587);}return _0x58bb53[_0x8ee1('0x34')]();};}function saveUpdates(_0x5b869c,_0x3e196a){return function(_0xe058ed){if(_0xe058ed){return _0xe058ed[_0x8ee1('0x35')](_0x5b869c)[_0x8ee1('0x1e')](function(_0x2e13d8){return _0x2e13d8;});}return null;};}function removeEntity(_0x59c716,_0x4d3274){return function(_0x52cc6e){if(_0x52cc6e){return _0x52cc6e[_0x8ee1('0x36')]()[_0x8ee1('0x1e')](function(){_0x59c716[_0x8ee1('0x2a')](0xcc)[_0x8ee1('0x2b')]();});}};}function handleEntityNotFound(_0x1aaf39,_0x3319c5){return function(_0x328d78){if(!_0x328d78){_0x1aaf39[_0x8ee1('0x29')](0x194);}return _0x328d78;};}function handleError(_0x1a00a4,_0x1069ba){_0x1069ba=_0x1069ba||0x1f4;return function(_0x35c049){logger[_0x8ee1('0x23')](_0x35c049[_0x8ee1('0x37')]);if(_0x35c049[_0x8ee1('0x38')]){delete _0x35c049[_0x8ee1('0x38')];}_0x1a00a4[_0x8ee1('0x2a')](_0x1069ba)[_0x8ee1('0x39')](_0x35c049);};}exports['index']=function(_0x29a6bb,_0xc8f18c){var _0x28dcda={},_0x3cd1fc={},_0x4ff19d={'count':0x0,'rows':[]};var _0x3e46da=_[_0x8ee1('0x3a')](db[_0x8ee1('0x3b')][_0x8ee1('0x3c')],function(_0x1dd386){return{'name':_0x1dd386[_0x8ee1('0x3d')],'type':_0x1dd386[_0x8ee1('0x3e')][_0x8ee1('0x3f')]};});_0x3cd1fc[_0x8ee1('0x40')]=_[_0x8ee1('0x3a')](_0x3e46da,_0x8ee1('0x38'));_0x3cd1fc[_0x8ee1('0x41')]=_[_0x8ee1('0x42')](_0x29a6bb[_0x8ee1('0x41')]);_0x3cd1fc[_0x8ee1('0x43')]=_['intersection'](_0x3cd1fc['model'],_0x3cd1fc[_0x8ee1('0x41')]);_0x28dcda[_0x8ee1('0x44')]=_[_0x8ee1('0x45')](_0x3cd1fc[_0x8ee1('0x40')],qs[_0x8ee1('0x46')](_0x29a6bb[_0x8ee1('0x41')]['fields']));_0x28dcda[_0x8ee1('0x44')]=_0x28dcda[_0x8ee1('0x44')][_0x8ee1('0x47')]?_0x28dcda[_0x8ee1('0x44')]:_0x3cd1fc[_0x8ee1('0x40')];if(!_0x29a6bb[_0x8ee1('0x41')][_0x8ee1('0x48')](_0x8ee1('0x49'))){_0x28dcda['limit']=qs[_0x8ee1('0x2e')](_0x29a6bb['query'][_0x8ee1('0x2e')]);_0x28dcda[_0x8ee1('0x2d')]=qs['offset'](_0x29a6bb['query'][_0x8ee1('0x2d')]);}_0x28dcda['order']=qs[_0x8ee1('0x4a')](_0x29a6bb[_0x8ee1('0x41')][_0x8ee1('0x4a')]);_0x28dcda[_0x8ee1('0x4b')]=qs['filters'](_['pick'](_0x29a6bb[_0x8ee1('0x41')],_0x3cd1fc[_0x8ee1('0x43')]),_0x3e46da);if(_0x29a6bb[_0x8ee1('0x41')]['filter']){_0x28dcda[_0x8ee1('0x4b')]=_['merge'](_0x28dcda[_0x8ee1('0x4b')],{'$or':_['map'](_0x3e46da,function(_0x226fa0){if(_0x226fa0[_0x8ee1('0x3e')]!==_0x8ee1('0x4c')){var _0x158e54={};_0x158e54[_0x226fa0[_0x8ee1('0x38')]]={'$like':'%'+_0x29a6bb[_0x8ee1('0x41')][_0x8ee1('0x4d')]+'%'};return _0x158e54;}})});}_0x28dcda=_[_0x8ee1('0x4e')]({},_0x28dcda,_0x29a6bb['options']);var _0x4a4c8c={'where':_0x28dcda[_0x8ee1('0x4b')]};return db[_0x8ee1('0x3b')][_0x8ee1('0x2c')](_0x4a4c8c)[_0x8ee1('0x1e')](function(_0x2433f0){_0x4ff19d['count']=_0x2433f0;if(_0x29a6bb['query'][_0x8ee1('0x4f')]){_0x28dcda['include']=[{'all':!![]}];}return db['ZohoConfiguration'][_0x8ee1('0x50')](_0x28dcda);})[_0x8ee1('0x1e')](function(_0x1acc0d){_0x4ff19d[_0x8ee1('0x51')]=_0x1acc0d;return _0x4ff19d;})[_0x8ee1('0x1e')](respondWithFilteredResult(_0xc8f18c,_0x28dcda))[_0x8ee1('0x28')](handleError(_0xc8f18c,null));};exports[_0x8ee1('0x52')]=function(_0x3614c0,_0x5ab4e3){var _0x6f5d62={'raw':![],'where':{'id':_0x3614c0[_0x8ee1('0x53')]['id']}},_0x552e13={};_0x552e13[_0x8ee1('0x40')]=_['keys'](db[_0x8ee1('0x3b')][_0x8ee1('0x3c')]);_0x552e13[_0x8ee1('0x41')]=_[_0x8ee1('0x42')](_0x3614c0[_0x8ee1('0x41')]);_0x552e13[_0x8ee1('0x43')]=_[_0x8ee1('0x45')](_0x552e13[_0x8ee1('0x40')],_0x552e13[_0x8ee1('0x41')]);_0x6f5d62[_0x8ee1('0x44')]=_['intersection'](_0x552e13[_0x8ee1('0x40')],qs['fields'](_0x3614c0[_0x8ee1('0x41')][_0x8ee1('0x46')]));_0x6f5d62['attributes']=_0x6f5d62[_0x8ee1('0x44')][_0x8ee1('0x47')]?_0x6f5d62[_0x8ee1('0x44')]:_0x552e13[_0x8ee1('0x40')];if(_0x3614c0[_0x8ee1('0x41')][_0x8ee1('0x4f')]){_0x6f5d62[_0x8ee1('0x54')]=[{'all':!![]}];}_0x6f5d62=_[_0x8ee1('0x4e')]({},_0x6f5d62,_0x3614c0[_0x8ee1('0x55')]);return db[_0x8ee1('0x3b')]['find'](_0x6f5d62)[_0x8ee1('0x1e')](handleEntityNotFound(_0x5ab4e3,null))[_0x8ee1('0x1e')](respondWithResult(_0x5ab4e3,null))[_0x8ee1('0x28')](handleError(_0x5ab4e3,null));};exports[_0x8ee1('0x56')]=function(_0xb4a0a9,_0x103f22){return db[_0x8ee1('0x3b')][_0x8ee1('0x56')](_0xb4a0a9[_0x8ee1('0x57')],{})[_0x8ee1('0x1e')](respondWithResult(_0x103f22,0xc9))['catch'](handleError(_0x103f22,null));};exports[_0x8ee1('0x35')]=function(_0x1b0181,_0x5866d9){if(_0x1b0181['body']['id']){delete _0x1b0181[_0x8ee1('0x57')]['id'];}return db[_0x8ee1('0x3b')][_0x8ee1('0x58')]({'where':{'id':_0x1b0181[_0x8ee1('0x53')]['id']}})[_0x8ee1('0x1e')](handleEntityNotFound(_0x5866d9,null))[_0x8ee1('0x1e')](saveUpdates(_0x1b0181[_0x8ee1('0x57')],null))[_0x8ee1('0x1e')](respondWithResult(_0x5866d9,null))[_0x8ee1('0x28')](handleError(_0x5866d9,null));};exports[_0x8ee1('0x36')]=function(_0x35f69c,_0x867b5f){return db[_0x8ee1('0x3b')][_0x8ee1('0x58')]({'where':{'id':_0x35f69c[_0x8ee1('0x53')]['id']}})[_0x8ee1('0x1e')](handleEntityNotFound(_0x867b5f,null))[_0x8ee1('0x1e')](removeEntity(_0x867b5f,null))[_0x8ee1('0x28')](handleError(_0x867b5f,null));};exports[_0x8ee1('0x59')]=function(_0x3999d0,_0x2fe649,_0x2dd7c1){var _0x579b11={};var _0x70de56={};var _0x36cf46;var _0x3c987f;return db['ZohoConfiguration'][_0x8ee1('0x5a')]({'where':{'id':_0x3999d0[_0x8ee1('0x53')]['id']}})[_0x8ee1('0x1e')](handleEntityNotFound(_0x2fe649,null))[_0x8ee1('0x1e')](function(_0x5ad8a9){if(_0x5ad8a9){_0x36cf46=_0x5ad8a9;_0x70de56[_0x8ee1('0x40')]=_['keys'](db[_0x8ee1('0x5b')][_0x8ee1('0x3c')]);_0x70de56[_0x8ee1('0x41')]=_[_0x8ee1('0x42')](_0x3999d0[_0x8ee1('0x41')]);_0x70de56[_0x8ee1('0x43')]=_['intersection'](_0x70de56['model'],_0x70de56[_0x8ee1('0x41')]);_0x579b11[_0x8ee1('0x44')]=_[_0x8ee1('0x45')](_0x70de56['model'],qs['fields'](_0x3999d0[_0x8ee1('0x41')][_0x8ee1('0x46')]));_0x579b11[_0x8ee1('0x44')]=_0x579b11[_0x8ee1('0x44')]['length']?_0x579b11['attributes']:_0x70de56[_0x8ee1('0x40')];_0x579b11['order']=qs[_0x8ee1('0x4a')](_0x3999d0[_0x8ee1('0x41')]['sort']);_0x579b11[_0x8ee1('0x4b')]=qs['filters'](_['pick'](_0x3999d0[_0x8ee1('0x41')],_0x70de56[_0x8ee1('0x43')]));if(_0x3999d0['query'][_0x8ee1('0x4d')]){_0x579b11['where']=_['merge'](_0x579b11['where'],{'$or':_[_0x8ee1('0x3a')](_0x579b11[_0x8ee1('0x44')],function(_0xb81c6f){var _0x47037d={};_0x47037d[_0xb81c6f]={'$like':'%'+_0x3999d0['query']['filter']+'%'};return _0x47037d;})});}_0x579b11=_[_0x8ee1('0x4e')]({},_0x579b11,_0x3999d0[_0x8ee1('0x55')]);return _0x36cf46[_0x8ee1('0x59')](_0x579b11);}})[_0x8ee1('0x1e')](function(_0x3cd574){if(_0x3cd574){_0x3c987f=_0x3cd574[_0x8ee1('0x47')];if(!_0x3999d0[_0x8ee1('0x41')][_0x8ee1('0x48')](_0x8ee1('0x49'))){_0x579b11[_0x8ee1('0x2e')]=qs[_0x8ee1('0x2e')](_0x3999d0[_0x8ee1('0x41')][_0x8ee1('0x2e')]);_0x579b11[_0x8ee1('0x2d')]=qs[_0x8ee1('0x2d')](_0x3999d0['query'][_0x8ee1('0x2d')]);}return _0x36cf46[_0x8ee1('0x59')](_0x579b11);}})[_0x8ee1('0x1e')](function(_0x290c87){if(_0x290c87){return _0x290c87?{'count':_0x3c987f,'rows':_0x290c87}:null;}})[_0x8ee1('0x1e')](respondWithResult(_0x2fe649,null))['catch'](handleError(_0x2fe649,null));};exports['getSubjects']=function(_0x44a5d3,_0x4213b0,_0xeee0a5){var _0x2fed94={};var _0x51d760={};var _0x18f923;var _0x5de530;return db[_0x8ee1('0x3b')][_0x8ee1('0x5a')]({'where':{'id':_0x44a5d3['params']['id']}})[_0x8ee1('0x1e')](handleEntityNotFound(_0x4213b0,null))[_0x8ee1('0x1e')](function(_0x56cd45){if(_0x56cd45){_0x18f923=_0x56cd45;_0x51d760[_0x8ee1('0x40')]=_[_0x8ee1('0x42')](db['ZohoField'][_0x8ee1('0x3c')]);_0x51d760['query']=_[_0x8ee1('0x42')](_0x44a5d3[_0x8ee1('0x41')]);_0x51d760['filters']=_[_0x8ee1('0x45')](_0x51d760[_0x8ee1('0x40')],_0x51d760[_0x8ee1('0x41')]);_0x2fed94[_0x8ee1('0x44')]=_['intersection'](_0x51d760[_0x8ee1('0x40')],qs[_0x8ee1('0x46')](_0x44a5d3[_0x8ee1('0x41')][_0x8ee1('0x46')]));_0x2fed94['attributes']=_0x2fed94[_0x8ee1('0x44')][_0x8ee1('0x47')]?_0x2fed94['attributes']:_0x51d760['model'];_0x2fed94['order']=qs[_0x8ee1('0x4a')](_0x44a5d3[_0x8ee1('0x41')][_0x8ee1('0x4a')]);_0x2fed94[_0x8ee1('0x4b')]=qs[_0x8ee1('0x43')](_[_0x8ee1('0x5c')](_0x44a5d3[_0x8ee1('0x41')],_0x51d760[_0x8ee1('0x43')]));if(_0x44a5d3['query'][_0x8ee1('0x4d')]){_0x2fed94[_0x8ee1('0x4b')]=_[_0x8ee1('0x4e')](_0x2fed94['where'],{'$or':_['map'](_0x2fed94[_0x8ee1('0x44')],function(_0x3c1d6f){var _0x2c0520={};_0x2c0520[_0x3c1d6f]={'$like':'%'+_0x44a5d3[_0x8ee1('0x41')][_0x8ee1('0x4d')]+'%'};return _0x2c0520;})});}_0x2fed94=_[_0x8ee1('0x4e')]({},_0x2fed94,_0x44a5d3[_0x8ee1('0x55')]);return _0x18f923['getSubjects'](_0x2fed94);}})[_0x8ee1('0x1e')](function(_0x1091bd){if(_0x1091bd){_0x5de530=_0x1091bd['length'];if(!_0x44a5d3[_0x8ee1('0x41')]['hasOwnProperty'](_0x8ee1('0x49'))){_0x2fed94[_0x8ee1('0x2e')]=qs[_0x8ee1('0x2e')](_0x44a5d3[_0x8ee1('0x41')]['limit']);_0x2fed94[_0x8ee1('0x2d')]=qs[_0x8ee1('0x2d')](_0x44a5d3[_0x8ee1('0x41')][_0x8ee1('0x2d')]);}return _0x18f923[_0x8ee1('0x5d')](_0x2fed94);}})['then'](function(_0x68f1ee){if(_0x68f1ee){return _0x68f1ee?{'count':_0x5de530,'rows':_0x68f1ee}:null;}})[_0x8ee1('0x1e')](respondWithResult(_0x4213b0,null))[_0x8ee1('0x28')](handleError(_0x4213b0,null));};exports[_0x8ee1('0x5e')]=function(_0x175ea0,_0x44e95c,_0x1f62cc){var _0x17a751={};var _0x1ddf55={};var _0x5dd9cb;var _0xff0e8e;return db[_0x8ee1('0x3b')][_0x8ee1('0x5a')]({'where':{'id':_0x175ea0[_0x8ee1('0x53')]['id']}})[_0x8ee1('0x1e')](handleEntityNotFound(_0x44e95c,null))[_0x8ee1('0x1e')](function(_0x2bfbf){if(_0x2bfbf){_0x5dd9cb=_0x2bfbf;_0x1ddf55['model']=_[_0x8ee1('0x42')](db[_0x8ee1('0x5b')][_0x8ee1('0x3c')]);_0x1ddf55['query']=_['keys'](_0x175ea0[_0x8ee1('0x41')]);_0x1ddf55['filters']=_[_0x8ee1('0x45')](_0x1ddf55[_0x8ee1('0x40')],_0x1ddf55[_0x8ee1('0x41')]);_0x17a751['attributes']=_[_0x8ee1('0x45')](_0x1ddf55[_0x8ee1('0x40')],qs[_0x8ee1('0x46')](_0x175ea0[_0x8ee1('0x41')][_0x8ee1('0x46')]));_0x17a751[_0x8ee1('0x44')]=_0x17a751['attributes']['length']?_0x17a751[_0x8ee1('0x44')]:_0x1ddf55[_0x8ee1('0x40')];_0x17a751[_0x8ee1('0x5f')]=qs[_0x8ee1('0x4a')](_0x175ea0[_0x8ee1('0x41')][_0x8ee1('0x4a')]);_0x17a751[_0x8ee1('0x4b')]=qs[_0x8ee1('0x43')](_['pick'](_0x175ea0['query'],_0x1ddf55['filters']));if(_0x175ea0[_0x8ee1('0x41')][_0x8ee1('0x4d')]){_0x17a751[_0x8ee1('0x4b')]=_['merge'](_0x17a751[_0x8ee1('0x4b')],{'$or':_[_0x8ee1('0x3a')](_0x17a751['attributes'],function(_0x4cc1ca){var _0x2ad4bf={};_0x2ad4bf[_0x4cc1ca]={'$like':'%'+_0x175ea0[_0x8ee1('0x41')][_0x8ee1('0x4d')]+'%'};return _0x2ad4bf;})});}_0x17a751=_[_0x8ee1('0x4e')]({},_0x17a751,_0x175ea0[_0x8ee1('0x55')]);return _0x5dd9cb[_0x8ee1('0x5e')](_0x17a751);}})['then'](function(_0x424558){if(_0x424558){_0xff0e8e=_0x424558[_0x8ee1('0x47')];if(!_0x175ea0['query'][_0x8ee1('0x48')](_0x8ee1('0x49'))){_0x17a751[_0x8ee1('0x2e')]=qs[_0x8ee1('0x2e')](_0x175ea0[_0x8ee1('0x41')][_0x8ee1('0x2e')]);_0x17a751[_0x8ee1('0x2d')]=qs[_0x8ee1('0x2d')](_0x175ea0[_0x8ee1('0x41')][_0x8ee1('0x2d')]);}return _0x5dd9cb[_0x8ee1('0x5e')](_0x17a751);}})[_0x8ee1('0x1e')](function(_0x1a0fee){if(_0x1a0fee){return _0x1a0fee?{'count':_0xff0e8e,'rows':_0x1a0fee}:null;}})[_0x8ee1('0x1e')](respondWithResult(_0x44e95c,null))[_0x8ee1('0x28')](handleError(_0x44e95c,null));}; \ No newline at end of file +var _0x74fe=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','apply','reject','update','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','count','include','findAll','rows','show','params','length','options','find','create','body','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','request','then'];(function(_0xdeaa57,_0x2c1594){var _0x3202c7=function(_0x4c9bef){while(--_0x4c9bef){_0xdeaa57['push'](_0xdeaa57['shift']());}};_0x3202c7(++_0x2c1594);}(_0x74fe,0x1a0));var _0xe74f=function(_0x455f9f,_0x358fc2){_0x455f9f=_0x455f9f-0x0;var _0x295279=_0x74fe[_0x455f9f];return _0x295279;};'use strict';var pdf=require(_0xe74f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe74f('0x1'));var zipdir=require(_0xe74f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe74f('0x3'));var Mustache=require(_0xe74f('0x4'));var util=require(_0xe74f('0x5'));var path=require(_0xe74f('0x6'));var sox=require(_0xe74f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe74f('0x8'));var squel=require(_0xe74f('0x9'));var crypto=require(_0xe74f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe74f('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe74f('0xc'));var Papa=require(_0xe74f('0xd'));var Redis=require(_0xe74f('0xe'));var authService=require(_0xe74f('0xf'));var qs=require(_0xe74f('0x10'));var as=require(_0xe74f('0x11'));var hardwareService=require(_0xe74f('0x12'));var logger=require(_0xe74f('0x13'))('api');var utils=require(_0xe74f('0x14'));var config=require(_0xe74f('0x15'));var db=require(_0xe74f('0x16'))['db'];var jayson=require(_0xe74f('0x17'));var client=jayson['client'][_0xe74f('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4f5b61,_0x4afbd8,_0x4d9faf){if(_0x4d9faf){var _0x2de685=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2de685[_0xe74f('0x19')](_0x4afbd8)){return _0x4f5b61;}else{throw new db['Sequelize'][(_0xe74f('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4f5b61;}}function respondWithRpcPromise(_0x5a0ecf,_0x56723b,_0x45c789,_0x1cd07e){return new BPromise(function(_0x425681,_0xff8656){var _0x2c88d8=_0x1cd07e||client;return _0x2c88d8[_0xe74f('0x1b')](_0x5a0ecf,_0x45c789)[_0xe74f('0x1c')](function(_0x71b14a){logger[_0xe74f('0x1d')](_0xe74f('0x1e'),_0x56723b,_0xe74f('0x1f'));logger['debug'](_0xe74f('0x20'),_0x56723b,_0xe74f('0x1f'),JSON[_0xe74f('0x21')](_0x71b14a));if(_0x71b14a[_0xe74f('0x22')]){if(_0x71b14a[_0xe74f('0x22')][_0xe74f('0x23')]===0x1f4){logger[_0xe74f('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x56723b,_0x71b14a['error']['message']);return _0xff8656(_0x71b14a['error'][_0xe74f('0x24')]);}logger[_0xe74f('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x56723b,_0x71b14a[_0xe74f('0x22')][_0xe74f('0x24')]);return _0x425681(_0x71b14a[_0xe74f('0x22')]['message']);}else{logger[_0xe74f('0x1d')](_0xe74f('0x1e'),_0x56723b,'request\x20sent');_0x425681(_0x71b14a[_0xe74f('0x25')][_0xe74f('0x24')]);}})[_0xe74f('0x26')](function(_0x2a4df7){logger[_0xe74f('0x22')]('ZohoConfiguration,\x20%s,\x20%s',_0x56723b,_0x2a4df7);_0xff8656(_0x2a4df7);});});}function respondWithStatusCode(_0x42a224,_0x10d6f8){_0x10d6f8=_0x10d6f8||0xcc;return function(_0x4e32eb){if(_0x4e32eb){return _0x42a224[_0xe74f('0x27')](_0x10d6f8);}return _0x42a224[_0xe74f('0x28')](_0x10d6f8)[_0xe74f('0x29')]();};}function respondWithResult(_0x9420eb,_0x2b9573){_0x2b9573=_0x2b9573||0xc8;return function(_0x2bd8a1){if(_0x2bd8a1){return _0x9420eb[_0xe74f('0x28')](_0x2b9573)[_0xe74f('0x2a')](_0x2bd8a1);}};}function respondWithFilteredResult(_0x583ce0,_0x53ec37){return function(_0x181814){if(_0x181814){var _0x4632af=_0x181814['count'],_0x10b31b=_0x53ec37[_0xe74f('0x2b')],_0x57f733=_0x53ec37[_0xe74f('0x2b')]+_0x53ec37['limit'],_0x394a1f;if(_0x57f733>=_0x4632af){_0x57f733=_0x4632af;_0x394a1f=0xc8;}else{_0x394a1f=0xce;}_0x583ce0[_0xe74f('0x28')](_0x394a1f);return _0x583ce0['set']('Content-Range',_0x10b31b+'-'+_0x57f733+'/'+_0x4632af)[_0xe74f('0x2a')](_0x181814);}return null;};}function patchUpdates(_0x5a19ad){return function(_0x297f1f){try{jsonpatch[_0xe74f('0x2c')](_0x297f1f,_0x5a19ad,!![]);}catch(_0x577032){return BPromise[_0xe74f('0x2d')](_0x577032);}return _0x297f1f['save']();};}function saveUpdates(_0x435951,_0x48cc6e){return function(_0x2c027f){if(_0x2c027f){return _0x2c027f[_0xe74f('0x2e')](_0x435951)['then'](function(_0xa6fd05){return _0xa6fd05;});}return null;};}function removeEntity(_0x2b918c,_0x37ab4b){return function(_0x3afe8e){if(_0x3afe8e){return _0x3afe8e[_0xe74f('0x2f')]()[_0xe74f('0x1c')](function(){_0x2b918c[_0xe74f('0x28')](0xcc)[_0xe74f('0x29')]();});}};}function handleEntityNotFound(_0x2cacd1,_0x12b996){return function(_0x18675d){if(!_0x18675d){_0x2cacd1[_0xe74f('0x27')](0x194);}return _0x18675d;};}function handleError(_0x24a2ba,_0x181cad){_0x181cad=_0x181cad||0x1f4;return function(_0x214ab5){logger[_0xe74f('0x22')](_0x214ab5[_0xe74f('0x30')]);if(_0x214ab5[_0xe74f('0x31')]){delete _0x214ab5[_0xe74f('0x31')];}_0x24a2ba['status'](_0x181cad)[_0xe74f('0x32')](_0x214ab5);};}exports['index']=function(_0x31f2ad,_0x501f2f){var _0x3a888f={},_0x5a1b86={},_0x21c92a={'count':0x0,'rows':[]};var _0x26e6d7=_[_0xe74f('0x33')](db[_0xe74f('0x34')][_0xe74f('0x35')],function(_0x2fbe00){return{'name':_0x2fbe00[_0xe74f('0x36')],'type':_0x2fbe00['type'][_0xe74f('0x37')]};});_0x5a1b86['model']=_[_0xe74f('0x33')](_0x26e6d7,'name');_0x5a1b86[_0xe74f('0x38')]=_[_0xe74f('0x39')](_0x31f2ad[_0xe74f('0x38')]);_0x5a1b86[_0xe74f('0x3a')]=_[_0xe74f('0x3b')](_0x5a1b86[_0xe74f('0x3c')],_0x5a1b86[_0xe74f('0x38')]);_0x3a888f[_0xe74f('0x3d')]=_[_0xe74f('0x3b')](_0x5a1b86['model'],qs[_0xe74f('0x3e')](_0x31f2ad['query']['fields']));_0x3a888f[_0xe74f('0x3d')]=_0x3a888f[_0xe74f('0x3d')]['length']?_0x3a888f[_0xe74f('0x3d')]:_0x5a1b86[_0xe74f('0x3c')];if(!_0x31f2ad[_0xe74f('0x38')][_0xe74f('0x3f')](_0xe74f('0x40'))){_0x3a888f[_0xe74f('0x41')]=qs[_0xe74f('0x41')](_0x31f2ad[_0xe74f('0x38')][_0xe74f('0x41')]);_0x3a888f[_0xe74f('0x2b')]=qs[_0xe74f('0x2b')](_0x31f2ad[_0xe74f('0x38')]['offset']);}_0x3a888f[_0xe74f('0x42')]=qs['sort'](_0x31f2ad[_0xe74f('0x38')][_0xe74f('0x43')]);_0x3a888f[_0xe74f('0x44')]=qs[_0xe74f('0x3a')](_['pick'](_0x31f2ad[_0xe74f('0x38')],_0x5a1b86[_0xe74f('0x3a')]),_0x26e6d7);if(_0x31f2ad['query'][_0xe74f('0x45')]){_0x3a888f[_0xe74f('0x44')]=_[_0xe74f('0x46')](_0x3a888f[_0xe74f('0x44')],{'$or':_[_0xe74f('0x33')](_0x26e6d7,function(_0x20aa6a){if(_0x20aa6a[_0xe74f('0x47')]!=='VIRTUAL'){var _0x20b87e={};_0x20b87e[_0x20aa6a[_0xe74f('0x31')]]={'$like':'%'+_0x31f2ad[_0xe74f('0x38')]['filter']+'%'};return _0x20b87e;}})});}_0x3a888f=_[_0xe74f('0x46')]({},_0x3a888f,_0x31f2ad['options']);var _0x3c27ba={'where':_0x3a888f['where']};return db[_0xe74f('0x34')][_0xe74f('0x48')](_0x3c27ba)['then'](function(_0x59638f){_0x21c92a[_0xe74f('0x48')]=_0x59638f;if(_0x31f2ad['query']['includeAll']){_0x3a888f[_0xe74f('0x49')]=[{'all':!![]}];}return db[_0xe74f('0x34')][_0xe74f('0x4a')](_0x3a888f);})[_0xe74f('0x1c')](function(_0x4a195b){_0x21c92a[_0xe74f('0x4b')]=_0x4a195b;return _0x21c92a;})['then'](respondWithFilteredResult(_0x501f2f,_0x3a888f))['catch'](handleError(_0x501f2f,null));};exports[_0xe74f('0x4c')]=function(_0x58c212,_0xfccbfd){var _0x3163f2={'raw':![],'where':{'id':_0x58c212[_0xe74f('0x4d')]['id']}},_0x26966b={};_0x26966b['model']=_[_0xe74f('0x39')](db[_0xe74f('0x34')]['rawAttributes']);_0x26966b[_0xe74f('0x38')]=_['keys'](_0x58c212[_0xe74f('0x38')]);_0x26966b['filters']=_[_0xe74f('0x3b')](_0x26966b[_0xe74f('0x3c')],_0x26966b[_0xe74f('0x38')]);_0x3163f2[_0xe74f('0x3d')]=_[_0xe74f('0x3b')](_0x26966b[_0xe74f('0x3c')],qs[_0xe74f('0x3e')](_0x58c212['query'][_0xe74f('0x3e')]));_0x3163f2[_0xe74f('0x3d')]=_0x3163f2[_0xe74f('0x3d')][_0xe74f('0x4e')]?_0x3163f2[_0xe74f('0x3d')]:_0x26966b[_0xe74f('0x3c')];if(_0x58c212['query']['includeAll']){_0x3163f2['include']=[{'all':!![]}];}_0x3163f2=_['merge']({},_0x3163f2,_0x58c212[_0xe74f('0x4f')]);return db[_0xe74f('0x34')][_0xe74f('0x50')](_0x3163f2)['then'](handleEntityNotFound(_0xfccbfd,null))[_0xe74f('0x1c')](respondWithResult(_0xfccbfd,null))[_0xe74f('0x26')](handleError(_0xfccbfd,null));};exports['create']=function(_0x20887f,_0x4fc438){return db[_0xe74f('0x34')][_0xe74f('0x51')](_0x20887f[_0xe74f('0x52')],{})['then'](respondWithResult(_0x4fc438,0xc9))[_0xe74f('0x26')](handleError(_0x4fc438,null));};exports[_0xe74f('0x2e')]=function(_0x301d62,_0x340199){if(_0x301d62[_0xe74f('0x52')]['id']){delete _0x301d62['body']['id'];}return db[_0xe74f('0x34')][_0xe74f('0x50')]({'where':{'id':_0x301d62['params']['id']}})[_0xe74f('0x1c')](handleEntityNotFound(_0x340199,null))['then'](saveUpdates(_0x301d62[_0xe74f('0x52')],null))['then'](respondWithResult(_0x340199,null))[_0xe74f('0x26')](handleError(_0x340199,null));};exports[_0xe74f('0x2f')]=function(_0x5e08be,_0x2e0a0e){return db[_0xe74f('0x34')][_0xe74f('0x50')]({'where':{'id':_0x5e08be[_0xe74f('0x4d')]['id']}})[_0xe74f('0x1c')](handleEntityNotFound(_0x2e0a0e,null))[_0xe74f('0x1c')](removeEntity(_0x2e0a0e,null))[_0xe74f('0x26')](handleError(_0x2e0a0e,null));};exports[_0xe74f('0x53')]=function(_0x40c9ca,_0x55599f,_0x284d92){var _0xf9dfb4={};var _0x4d7d00={};var _0x36b859;var _0xbdd813;return db[_0xe74f('0x34')][_0xe74f('0x54')]({'where':{'id':_0x40c9ca['params']['id']}})[_0xe74f('0x1c')](handleEntityNotFound(_0x55599f,null))['then'](function(_0x331b3a){if(_0x331b3a){_0x36b859=_0x331b3a;_0x4d7d00[_0xe74f('0x3c')]=_[_0xe74f('0x39')](db[_0xe74f('0x55')][_0xe74f('0x35')]);_0x4d7d00[_0xe74f('0x38')]=_['keys'](_0x40c9ca[_0xe74f('0x38')]);_0x4d7d00[_0xe74f('0x3a')]=_[_0xe74f('0x3b')](_0x4d7d00['model'],_0x4d7d00[_0xe74f('0x38')]);_0xf9dfb4[_0xe74f('0x3d')]=_[_0xe74f('0x3b')](_0x4d7d00['model'],qs[_0xe74f('0x3e')](_0x40c9ca[_0xe74f('0x38')][_0xe74f('0x3e')]));_0xf9dfb4[_0xe74f('0x3d')]=_0xf9dfb4[_0xe74f('0x3d')][_0xe74f('0x4e')]?_0xf9dfb4[_0xe74f('0x3d')]:_0x4d7d00[_0xe74f('0x3c')];_0xf9dfb4[_0xe74f('0x42')]=qs[_0xe74f('0x43')](_0x40c9ca[_0xe74f('0x38')][_0xe74f('0x43')]);_0xf9dfb4[_0xe74f('0x44')]=qs[_0xe74f('0x3a')](_[_0xe74f('0x56')](_0x40c9ca['query'],_0x4d7d00[_0xe74f('0x3a')]));if(_0x40c9ca[_0xe74f('0x38')][_0xe74f('0x45')]){_0xf9dfb4[_0xe74f('0x44')]=_[_0xe74f('0x46')](_0xf9dfb4[_0xe74f('0x44')],{'$or':_[_0xe74f('0x33')](_0xf9dfb4[_0xe74f('0x3d')],function(_0x3719fb){var _0x524d3f={};_0x524d3f[_0x3719fb]={'$like':'%'+_0x40c9ca['query'][_0xe74f('0x45')]+'%'};return _0x524d3f;})});}_0xf9dfb4=_[_0xe74f('0x46')]({},_0xf9dfb4,_0x40c9ca[_0xe74f('0x4f')]);return _0x36b859[_0xe74f('0x53')](_0xf9dfb4);}})[_0xe74f('0x1c')](function(_0x194b58){if(_0x194b58){_0xbdd813=_0x194b58[_0xe74f('0x4e')];if(!_0x40c9ca[_0xe74f('0x38')][_0xe74f('0x3f')](_0xe74f('0x40'))){_0xf9dfb4[_0xe74f('0x41')]=qs['limit'](_0x40c9ca[_0xe74f('0x38')][_0xe74f('0x41')]);_0xf9dfb4[_0xe74f('0x2b')]=qs[_0xe74f('0x2b')](_0x40c9ca[_0xe74f('0x38')][_0xe74f('0x2b')]);}return _0x36b859['getFields'](_0xf9dfb4);}})['then'](function(_0xcceff3){if(_0xcceff3){return _0xcceff3?{'count':_0xbdd813,'rows':_0xcceff3}:null;}})[_0xe74f('0x1c')](respondWithResult(_0x55599f,null))[_0xe74f('0x26')](handleError(_0x55599f,null));};exports[_0xe74f('0x57')]=function(_0x200fc8,_0x463f18,_0x508048){var _0xa17a55={};var _0x13cecb={};var _0x4371a1;var _0x5d3259;return db[_0xe74f('0x34')][_0xe74f('0x54')]({'where':{'id':_0x200fc8[_0xe74f('0x4d')]['id']}})[_0xe74f('0x1c')](handleEntityNotFound(_0x463f18,null))['then'](function(_0x40cd01){if(_0x40cd01){_0x4371a1=_0x40cd01;_0x13cecb[_0xe74f('0x3c')]=_['keys'](db['ZohoField'][_0xe74f('0x35')]);_0x13cecb[_0xe74f('0x38')]=_[_0xe74f('0x39')](_0x200fc8[_0xe74f('0x38')]);_0x13cecb[_0xe74f('0x3a')]=_[_0xe74f('0x3b')](_0x13cecb[_0xe74f('0x3c')],_0x13cecb[_0xe74f('0x38')]);_0xa17a55[_0xe74f('0x3d')]=_[_0xe74f('0x3b')](_0x13cecb['model'],qs['fields'](_0x200fc8[_0xe74f('0x38')][_0xe74f('0x3e')]));_0xa17a55[_0xe74f('0x3d')]=_0xa17a55[_0xe74f('0x3d')][_0xe74f('0x4e')]?_0xa17a55[_0xe74f('0x3d')]:_0x13cecb[_0xe74f('0x3c')];_0xa17a55[_0xe74f('0x42')]=qs['sort'](_0x200fc8[_0xe74f('0x38')][_0xe74f('0x43')]);_0xa17a55['where']=qs[_0xe74f('0x3a')](_[_0xe74f('0x56')](_0x200fc8[_0xe74f('0x38')],_0x13cecb['filters']));if(_0x200fc8[_0xe74f('0x38')][_0xe74f('0x45')]){_0xa17a55[_0xe74f('0x44')]=_[_0xe74f('0x46')](_0xa17a55[_0xe74f('0x44')],{'$or':_[_0xe74f('0x33')](_0xa17a55[_0xe74f('0x3d')],function(_0x3f83ac){var _0x5782a5={};_0x5782a5[_0x3f83ac]={'$like':'%'+_0x200fc8[_0xe74f('0x38')][_0xe74f('0x45')]+'%'};return _0x5782a5;})});}_0xa17a55=_[_0xe74f('0x46')]({},_0xa17a55,_0x200fc8[_0xe74f('0x4f')]);return _0x4371a1[_0xe74f('0x57')](_0xa17a55);}})[_0xe74f('0x1c')](function(_0x328aa4){if(_0x328aa4){_0x5d3259=_0x328aa4[_0xe74f('0x4e')];if(!_0x200fc8['query'][_0xe74f('0x3f')]('nolimit')){_0xa17a55[_0xe74f('0x41')]=qs[_0xe74f('0x41')](_0x200fc8['query']['limit']);_0xa17a55[_0xe74f('0x2b')]=qs[_0xe74f('0x2b')](_0x200fc8[_0xe74f('0x38')][_0xe74f('0x2b')]);}return _0x4371a1[_0xe74f('0x57')](_0xa17a55);}})[_0xe74f('0x1c')](function(_0x5ead8f){if(_0x5ead8f){return _0x5ead8f?{'count':_0x5d3259,'rows':_0x5ead8f}:null;}})[_0xe74f('0x1c')](respondWithResult(_0x463f18,null))[_0xe74f('0x26')](handleError(_0x463f18,null));};exports[_0xe74f('0x58')]=function(_0x3177f7,_0x4557c0,_0x507792){var _0x3653e6={};var _0x2cc120={};var _0x24a986;var _0x1b1185;return db[_0xe74f('0x34')][_0xe74f('0x54')]({'where':{'id':_0x3177f7[_0xe74f('0x4d')]['id']}})[_0xe74f('0x1c')](handleEntityNotFound(_0x4557c0,null))['then'](function(_0x2870ec){if(_0x2870ec){_0x24a986=_0x2870ec;_0x2cc120[_0xe74f('0x3c')]=_['keys'](db[_0xe74f('0x55')][_0xe74f('0x35')]);_0x2cc120['query']=_[_0xe74f('0x39')](_0x3177f7[_0xe74f('0x38')]);_0x2cc120[_0xe74f('0x3a')]=_[_0xe74f('0x3b')](_0x2cc120['model'],_0x2cc120[_0xe74f('0x38')]);_0x3653e6['attributes']=_[_0xe74f('0x3b')](_0x2cc120[_0xe74f('0x3c')],qs[_0xe74f('0x3e')](_0x3177f7[_0xe74f('0x38')]['fields']));_0x3653e6['attributes']=_0x3653e6[_0xe74f('0x3d')][_0xe74f('0x4e')]?_0x3653e6[_0xe74f('0x3d')]:_0x2cc120[_0xe74f('0x3c')];_0x3653e6[_0xe74f('0x42')]=qs['sort'](_0x3177f7['query']['sort']);_0x3653e6[_0xe74f('0x44')]=qs['filters'](_[_0xe74f('0x56')](_0x3177f7[_0xe74f('0x38')],_0x2cc120[_0xe74f('0x3a')]));if(_0x3177f7[_0xe74f('0x38')][_0xe74f('0x45')]){_0x3653e6[_0xe74f('0x44')]=_['merge'](_0x3653e6[_0xe74f('0x44')],{'$or':_[_0xe74f('0x33')](_0x3653e6[_0xe74f('0x3d')],function(_0x8bfd6a){var _0x56ac88={};_0x56ac88[_0x8bfd6a]={'$like':'%'+_0x3177f7[_0xe74f('0x38')][_0xe74f('0x45')]+'%'};return _0x56ac88;})});}_0x3653e6=_[_0xe74f('0x46')]({},_0x3653e6,_0x3177f7[_0xe74f('0x4f')]);return _0x24a986['getDescriptions'](_0x3653e6);}})[_0xe74f('0x1c')](function(_0x575764){if(_0x575764){_0x1b1185=_0x575764[_0xe74f('0x4e')];if(!_0x3177f7[_0xe74f('0x38')][_0xe74f('0x3f')](_0xe74f('0x40'))){_0x3653e6[_0xe74f('0x41')]=qs[_0xe74f('0x41')](_0x3177f7['query'][_0xe74f('0x41')]);_0x3653e6['offset']=qs[_0xe74f('0x2b')](_0x3177f7[_0xe74f('0x38')][_0xe74f('0x2b')]);}return _0x24a986['getDescriptions'](_0x3653e6);}})[_0xe74f('0x1c')](function(_0xa04acc){if(_0xa04acc){return _0xa04acc?{'count':_0x1b1185,'rows':_0xa04acc}:null;}})[_0xe74f('0x1c')](respondWithResult(_0x4557c0,null))['catch'](handleError(_0x4557c0,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index e30170c..5d13de9 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 _0x2b7c=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration'];(function(_0x45cf89,_0x212234){var _0x8bbd64=function(_0x22c18e){while(--_0x22c18e){_0x45cf89['push'](_0x45cf89['shift']());}};_0x8bbd64(++_0x212234);}(_0x2b7c,0x1c9));var _0xc2b7=function(_0x14cd17,_0x4c3ed1){_0x14cd17=_0x14cd17-0x0;var _0x5eb8b7=_0x2b7c[_0x14cd17];return _0x5eb8b7;};'use strict';var _=require(_0xc2b7('0x0'));var util=require(_0xc2b7('0x1'));var logger=require(_0xc2b7('0x2'))(_0xc2b7('0x3'));var moment=require(_0xc2b7('0x4'));var BPromise=require('bluebird');var rp=require(_0xc2b7('0x5'));var fs=require('fs');var path=require(_0xc2b7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc2b7('0x7'));module[_0xc2b7('0x8')]=function(_0x30b54c,_0x4ab7b4){return _0x30b54c[_0xc2b7('0x9')](_0xc2b7('0xa'),attributes,{'tableName':_0xc2b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x078d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x59ef3d,_0x5c7aee){var _0x585558=function(_0x1f0f81){while(--_0x1f0f81){_0x59ef3d['push'](_0x59ef3d['shift']());}};_0x585558(++_0x5c7aee);}(_0x078d,0x78));var _0xd078=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x078d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd078('0x0'));var util=require(_0xd078('0x1'));var logger=require(_0xd078('0x2'))(_0xd078('0x3'));var moment=require('moment');var BPromise=require(_0xd078('0x4'));var rp=require(_0xd078('0x5'));var fs=require('fs');var path=require(_0xd078('0x6'));var rimraf=require('rimraf');var config=require(_0xd078('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0xd078('0x8')]=function(_0xe04872,_0x4ec194){return _0xe04872[_0xd078('0x9')](_0xd078('0xa'),attributes,{'tableName':_0xd078('0xb'),'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 2509665..dd7640e 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 _0xd09b=['rpc','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34f1c8,_0x12ae31){var _0x17cbb4=function(_0x65ba3d){while(--_0x65ba3d){_0x34f1c8['push'](_0x34f1c8['shift']());}};_0x17cbb4(++_0x12ae31);}(_0xd09b,0x14e));var _0xbd09=function(_0xf86116,_0x213832){_0xf86116=_0xf86116-0x0;var _0x3f6c8e=_0xd09b[_0xf86116];return _0x3f6c8e;};'use strict';var _=require(_0xbd09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbd09('0x1'));var fs=require('fs');var Redis=require(_0xbd09('0x2'));var db=require(_0xbd09('0x3'))['db'];var utils=require(_0xbd09('0x4'));var logger=require(_0xbd09('0x5'))(_0xbd09('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd09('0x7')][_0xbd09('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11a9cb,_0x411314,_0x542452){return new BPromise(function(_0x56225c,_0x117367){return client[_0xbd09('0x9')](_0x11a9cb,_0x542452)['then'](function(_0x5f4024){logger[_0xbd09('0xa')](_0xbd09('0xb'),_0x411314,_0xbd09('0xc'));logger[_0xbd09('0xd')](_0xbd09('0xe'),_0x411314,'request\x20sent',JSON['stringify'](_0x5f4024));if(_0x5f4024['error']){if(_0x5f4024[_0xbd09('0xf')][_0xbd09('0x10')]===0x1f4){logger[_0xbd09('0xf')](_0xbd09('0xb'),_0x411314,_0x5f4024[_0xbd09('0xf')][_0xbd09('0x11')]);return _0x117367(_0x5f4024[_0xbd09('0xf')]['message']);}logger[_0xbd09('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x411314,_0x5f4024[_0xbd09('0xf')][_0xbd09('0x11')]);return _0x56225c(_0x5f4024[_0xbd09('0xf')][_0xbd09('0x11')]);}else{logger[_0xbd09('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x411314,_0xbd09('0xc'));_0x56225c(_0x5f4024[_0xbd09('0x12')][_0xbd09('0x11')]);}})[_0xbd09('0x13')](function(_0x5ccf30){logger[_0xbd09('0xf')](_0xbd09('0xb'),_0x411314,_0x5ccf30);_0x117367(_0x5ccf30);});});} \ No newline at end of file +var _0x9f73=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird'];(function(_0x1090a2,_0x5b9597){var _0x17cc71=function(_0x36ee09){while(--_0x36ee09){_0x1090a2['push'](_0x1090a2['shift']());}};_0x17cc71(++_0x5b9597);}(_0x9f73,0xfa));var _0x39f7=function(_0xd452f4,_0x25ff77){_0xd452f4=_0xd452f4-0x0;var _0x4ad215=_0x9f73[_0xd452f4];return _0x4ad215;};'use strict';var _=require(_0x39f7('0x0'));var util=require('util');var moment=require(_0x39f7('0x1'));var BPromise=require(_0x39f7('0x2'));var rs=require(_0x39f7('0x3'));var fs=require('fs');var Redis=require(_0x39f7('0x4'));var db=require(_0x39f7('0x5'))['db'];var utils=require(_0x39f7('0x6'));var logger=require('../../config/logger')(_0x39f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x39f7('0x8'));var client=jayson['client'][_0x39f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12feab,_0x42f3b9,_0x1c60f3){return new BPromise(function(_0x5c330c,_0x20b488){return client[_0x39f7('0xa')](_0x12feab,_0x1c60f3)[_0x39f7('0xb')](function(_0x200d00){logger[_0x39f7('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x42f3b9,_0x39f7('0xd'));logger[_0x39f7('0xe')](_0x39f7('0xf'),_0x42f3b9,_0x39f7('0xd'),JSON[_0x39f7('0x10')](_0x200d00));if(_0x200d00[_0x39f7('0x11')]){if(_0x200d00[_0x39f7('0x11')][_0x39f7('0x12')]===0x1f4){logger[_0x39f7('0x11')](_0x39f7('0x13'),_0x42f3b9,_0x200d00[_0x39f7('0x11')]['message']);return _0x20b488(_0x200d00[_0x39f7('0x11')][_0x39f7('0x14')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x42f3b9,_0x200d00[_0x39f7('0x11')][_0x39f7('0x14')]);return _0x5c330c(_0x200d00[_0x39f7('0x11')][_0x39f7('0x14')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x42f3b9,_0x39f7('0xd'));_0x5c330c(_0x200d00[_0x39f7('0x15')][_0x39f7('0x14')]);}})[_0x39f7('0x16')](function(_0x485dd8){logger[_0x39f7('0x11')](_0x39f7('0x13'),_0x42f3b9,_0x485dd8);_0x20b488(_0x485dd8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index edf93c8..bc75760 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 _0x25e7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','index','isAuthenticated','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x5df870,_0x2612fd){var _0x1236b4=function(_0x4fc5d9){while(--_0x4fc5d9){_0x5df870['push'](_0x5df870['shift']());}};_0x1236b4(++_0x2612fd);}(_0x25e7,0x1d6));var _0x725e=function(_0x2a74a6,_0x10592f){_0x2a74a6=_0x2a74a6-0x0;var _0xc2e34a=_0x25e7[_0x2a74a6];return _0xc2e34a;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var auth=require(_0x725e('0x6'));var interaction=require(_0x725e('0x7'));var config=require(_0x725e('0x8'));var controller=require(_0x725e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x725e('0xa')]);router['get']('/:id',auth[_0x725e('0xb')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')]('/',auth[_0x725e('0xb')](),controller[_0x725e('0xe')]);router[_0x725e('0xf')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller[_0x725e('0x11')]);router[_0x725e('0x12')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8952=['index','get','show','post','create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated'];(function(_0x3b8e26,_0x54caec){var _0x593600=function(_0x2f6f39){while(--_0x2f6f39){_0x3b8e26['push'](_0x3b8e26['shift']());}};_0x593600(++_0x54caec);}(_0x8952,0x17e));var _0x2895=function(_0x1de6b8,_0x18359a){_0x1de6b8=_0x1de6b8-0x0;var _0x232bcf=_0x8952[_0x1de6b8];return _0x232bcf;};'use strict';var multer=require('multer');var util=require(_0x2895('0x0'));var path=require(_0x2895('0x1'));var timeout=require(_0x2895('0x2'));var express=require(_0x2895('0x3'));var router=express[_0x2895('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2895('0x5'));var config=require(_0x2895('0x6'));var controller=require(_0x2895('0x7'));router['get']('/',auth[_0x2895('0x8')](),controller[_0x2895('0x9')]);router[_0x2895('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2895('0xb')]);router[_0x2895('0xc')]('/',auth[_0x2895('0x8')](),controller[_0x2895('0xd')]);router[_0x2895('0xe')]('/:id',auth[_0x2895('0x8')](),controller['update']);router[_0x2895('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2895('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 2a7d684..c509714 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 _0x032a=['STRING','ENUM','exports','string','variable','customVariable','keyValue'];(function(_0x581ba9,_0x3835cd){var _0x4018bf=function(_0x212fdb){while(--_0x212fdb){_0x581ba9['push'](_0x581ba9['shift']());}};_0x4018bf(++_0x3835cd);}(_0x032a,0xf0));var _0xa032=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x032a[_0x3e478c];return _0x29ef89;};'use strict';var Sequelize=require('sequelize');module[_0xa032('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa032('0x1'),_0xa032('0x2'),_0xa032('0x3'),_0xa032('0x4')),'defaultValue':_0xa032('0x1')},'content':{'type':Sequelize[_0xa032('0x5')]},'key':{'type':Sequelize[_0xa032('0x5')]},'keyType':{'type':Sequelize[_0xa032('0x6')](_0xa032('0x1'),_0xa032('0x2'),_0xa032('0x3'))},'keyContent':{'type':Sequelize[_0xa032('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa032('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdedc=['sequelize','exports','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0x2b92ff,_0xe0792){var _0x3f50d8=function(_0x47edc2){while(--_0x47edc2){_0x2b92ff['push'](_0x2b92ff['shift']());}};_0x3f50d8(++_0xe0792);}(_0xdedc,0xb8));var _0xcded=function(_0x158b98,_0x42454b){_0x158b98=_0x158b98-0x0;var _0x4d9542=_0xdedc[_0x158b98];return _0x4d9542;};'use strict';var Sequelize=require(_0xcded('0x0'));module[_0xcded('0x1')]={'type':{'type':Sequelize[_0xcded('0x2')](_0xcded('0x3'),_0xcded('0x4'),'customVariable',_0xcded('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcded('0x6')]},'key':{'type':Sequelize[_0xcded('0x6')]},'keyType':{'type':Sequelize[_0xcded('0x2')](_0xcded('0x3'),'variable',_0xcded('0x7'))},'keyContent':{'type':Sequelize[_0xcded('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcded('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2809bca..f288a2b 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x300d13,_0x412659){var _0x39541d=function(_0x4dd523){while(--_0x4dd523){_0x300d13['push'](_0x300d13['shift']());}};_0x39541d(++_0x412659);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x310215,_0x541b20){var _0x1e9d59=function(_0xa3b3f9){while(--_0xa3b3f9){_0x310215['push'](_0x310215['shift']());}};_0x1e9d59(++_0x541b20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 319c72b..0174fea 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 _0xd51a=['request-promise','path','rimraf','../../config/environment','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment'];(function(_0x2a603c,_0x5112a7){var _0x359107=function(_0x40a2a4){while(--_0x40a2a4){_0x2a603c['push'](_0x2a603c['shift']());}};_0x359107(++_0x5112a7);}(_0xd51a,0x176));var _0xad51=function(_0x81174,_0x11fd08){_0x81174=_0x81174-0x0;var _0x3e0e8d=_0xd51a[_0x81174];return _0x3e0e8d;};'use strict';var _=require('lodash');var util=require(_0xad51('0x0'));var logger=require(_0xad51('0x1'))(_0xad51('0x2'));var moment=require(_0xad51('0x3'));var BPromise=require('bluebird');var rp=require(_0xad51('0x4'));var fs=require('fs');var path=require(_0xad51('0x5'));var rimraf=require(_0xad51('0x6'));var config=require(_0xad51('0x7'));var attributes=require('./intZohoField.attributes');module[_0xad51('0x8')]=function(_0x5cf86b,_0x5af767){return _0x5cf86b['define'](_0xad51('0x9'),attributes,{'tableName':_0xad51('0xa'),'paranoid':![],'indexes':[{'name':_0xad51('0xb'),'fields':[_0xad51('0xc'),_0xad51('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c7d=['ZohoField','int_zoho_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4e9e5e,_0x16eadb){var _0x18ea21=function(_0x42b8a2){while(--_0x42b8a2){_0x4e9e5e['push'](_0x4e9e5e['shift']());}};_0x18ea21(++_0x16eadb);}(_0x2c7d,0x198));var _0xd2c7=function(_0x1fe6b1,_0x10d0eb){_0x1fe6b1=_0x1fe6b1-0x0;var _0x1048c0=_0x2c7d[_0x1fe6b1];return _0x1048c0;};'use strict';var _=require(_0xd2c7('0x0'));var util=require(_0xd2c7('0x1'));var logger=require(_0xd2c7('0x2'))(_0xd2c7('0x3'));var moment=require(_0xd2c7('0x4'));var BPromise=require(_0xd2c7('0x5'));var rp=require(_0xd2c7('0x6'));var fs=require('fs');var path=require(_0xd2c7('0x7'));var rimraf=require(_0xd2c7('0x8'));var config=require(_0xd2c7('0x9'));var attributes=require('./intZohoField.attributes');module[_0xd2c7('0xa')]=function(_0x245983,_0x234014){return _0x245983[_0xd2c7('0xb')](_0xd2c7('0xc'),attributes,{'tableName':_0xd2c7('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xd2c7('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 5a25063..206a6c2 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 _0xd2ea=['../../config/environment','jayson/promise','client','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5b48b3,_0x41fe9a){var _0x3651d4=function(_0x4f6e53){while(--_0x4f6e53){_0x5b48b3['push'](_0x5b48b3['shift']());}};_0x3651d4(++_0x41fe9a);}(_0xd2ea,0x15f));var _0xad2e=function(_0x212270,_0xf0ebd7){_0x212270=_0x212270-0x0;var _0x2e20bf=_0xd2ea[_0x212270];return _0x2e20bf;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ 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(_0x17a09c,_0x535c8b){var _0xff4872=function(_0x4f1ca6){while(--_0x4f1ca6){_0x17a09c['push'](_0x17a09c['shift']());}};_0xff4872(++_0x535c8b);}(_0xa630,0xbe));var _0x0a63=function(_0x190c51,_0x59802b){_0x190c51=_0x190c51-0x0;var _0x398c74=_0xa630[_0x190c51];return _0x398c74;};'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 6807248..fec65ee 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 _0xe3f7=['exports','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xe3f7,0x133));var _0x7e3f=function(_0x1ea50c,_0xe9e6bf){_0x1ea50c=_0x1ea50c-0x0;var _0x559e33=_0xe3f7[_0x1ea50c];return _0x559e33;};'use strict';var multer=require('multer');var util=require(_0x7e3f('0x0'));var path=require(_0x7e3f('0x1'));var timeout=require(_0x7e3f('0x2'));var express=require('express');var router=express[_0x7e3f('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7e3f('0x4'));var config=require('../../config/environment');module[_0x7e3f('0x5')]=router; \ No newline at end of file +var _0x0916=['../../components/auth/service','../../config/environment','exports','multer','util','path','connect-timeout','Router'];(function(_0x16916f,_0x1655ee){var _0x536d2a=function(_0x8cdc62){while(--_0x8cdc62){_0x16916f['push'](_0x16916f['shift']());}};_0x536d2a(++_0x1655ee);}(_0x0916,0xb3));var _0x6091=function(_0x4326da,_0x1a7287){_0x4326da=_0x4326da-0x0;var _0x5879b6=_0x0916[_0x4326da];return _0x5879b6;};'use strict';var multer=require(_0x6091('0x0'));var util=require(_0x6091('0x1'));var path=require(_0x6091('0x2'));var timeout=require(_0x6091('0x3'));var express=require('express');var router=express[_0x6091('0x4')]();var auth=require(_0x6091('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6091('0x6'));module[_0x6091('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 01d0757..946f510 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 _0x693f=['BOOLEAN','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x3e81cf,_0x215b7f){var _0xc7a690=function(_0x1833f1){while(--_0x1833f1){_0x3e81cf['push'](_0x3e81cf['shift']());}};_0xc7a690(++_0x215b7f);}(_0x693f,0x109));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xf693('0x0'));module[_0xf693('0x1')]={'name':{'type':Sequelize[_0xf693('0x2')],'allowNull':![],'unique':_0xf693('0x3')},'version':{'type':Sequelize[_0xf693('0x2')],'allowNull':![],'unique':_0xf693('0x3')},'main':{'type':Sequelize[_0xf693('0x2')],'defaultValue':_0xf693('0x4')},'filename':{'type':Sequelize[_0xf693('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf693('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xf693('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xf693('0x2')]},'logo':{'type':Sequelize[_0xf693('0x2')]},'state':{'type':Sequelize[_0xf693('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xf693('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf693('0x2')]},'link':{'type':Sequelize[_0xf693('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x54a6=['unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x45d89e,_0x24664d){var _0x473b7e=function(_0x5351f6){while(--_0x5351f6){_0x45d89e['push'](_0x45d89e['shift']());}};_0x473b7e(++_0x24664d);}(_0x54a6,0x1a8));var _0x654a=function(_0xfc02e2,_0x4ca3ce){_0xfc02e2=_0xfc02e2-0x0;var _0x2d3b07=_0x54a6[_0xfc02e2];return _0x2d3b07;};'use strict';var Sequelize=require(_0x654a('0x0'));module[_0x654a('0x1')]={'name':{'type':Sequelize[_0x654a('0x2')],'allowNull':![],'unique':_0x654a('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x654a('0x3')},'main':{'type':Sequelize[_0x654a('0x2')],'defaultValue':_0x654a('0x4')},'filename':{'type':Sequelize[_0x654a('0x2')]},'path':{'type':Sequelize[_0x654a('0x2')]},'type':{'type':Sequelize[_0x654a('0x2')]},'size':{'type':Sequelize[_0x654a('0x5')]},'active':{'type':Sequelize[_0x654a('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x654a('0x2')]},'logo':{'type':Sequelize[_0x654a('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x654a('0x2')]},'title':{'type':Sequelize[_0x654a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x654a('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 59a2873..aeb49f1 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 _0x1e76=['moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Integration','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','where','merge','filter','options','count','includeAll','include','findAll','show','params','keys','find','catch','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x4e3344,_0x577542){var _0x1b8cb1=function(_0x419e1f){while(--_0x419e1f){_0x4e3344['push'](_0x4e3344['shift']());}};_0x1b8cb1(++_0x577542);}(_0x1e76,0x11f));var _0x61e7=function(_0x3f0a04,_0x152526){_0x3f0a04=_0x3f0a04-0x0;var _0x27598d=_0x1e76[_0x3f0a04];return _0x27598d;};'use strict';var pdf=require(_0x61e7('0x0'));var emlformat=require(_0x61e7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x61e7('0x2'));var jsonpatch=require(_0x61e7('0x3'));var rp=require(_0x61e7('0x4'));var moment=require(_0x61e7('0x5'));var BPromise=require(_0x61e7('0x6'));var Mustache=require(_0x61e7('0x7'));var util=require(_0x61e7('0x8'));var path=require(_0x61e7('0x9'));var sox=require('sox');var csv=require(_0x61e7('0xa'));var ejs=require(_0x61e7('0xb'));var fs=require('fs');var _=require(_0x61e7('0xc'));var squel=require('squel');var crypto=require(_0x61e7('0xd'));var jsforce=require(_0x61e7('0xe'));var deskjs=require(_0x61e7('0xf'));var toCsv=require(_0x61e7('0xa'));var querystring=require(_0x61e7('0x10'));var Papa=require(_0x61e7('0x11'));var Redis=require(_0x61e7('0x12'));var authService=require(_0x61e7('0x13'));var qs=require(_0x61e7('0x14'));var as=require(_0x61e7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61e7('0x16'))(_0x61e7('0x17'));var utils=require(_0x61e7('0x18'));var config=require(_0x61e7('0x19'));var db=require(_0x61e7('0x1a'))['db'];function respondWithStatusCode(_0x330311,_0x38e78b){_0x38e78b=_0x38e78b||0xcc;return function(_0x1123b7){if(_0x1123b7){return _0x330311[_0x61e7('0x1b')](_0x38e78b);}return _0x330311[_0x61e7('0x1c')](_0x38e78b)[_0x61e7('0x1d')]();};}function respondWithResult(_0x48d660,_0x411a9d){_0x411a9d=_0x411a9d||0xc8;return function(_0x502916){if(_0x502916){return _0x48d660['status'](_0x411a9d)['json'](_0x502916);}};}function respondWithFilteredResult(_0x43f657,_0x67b279){return function(_0x92eee5){if(_0x92eee5){var _0x175a08=_0x92eee5['count'],_0x283ef4=_0x67b279['offset'],_0x5c51bd=_0x67b279[_0x61e7('0x1e')]+_0x67b279['limit'],_0xc079df;if(_0x5c51bd>=_0x175a08){_0x5c51bd=_0x175a08;_0xc079df=0xc8;}else{_0xc079df=0xce;}_0x43f657[_0x61e7('0x1c')](_0xc079df);return _0x43f657[_0x61e7('0x1f')](_0x61e7('0x20'),_0x283ef4+'-'+_0x5c51bd+'/'+_0x175a08)['json'](_0x92eee5);}return null;};}function patchUpdates(_0x10576c){return function(_0x585bd3){try{jsonpatch[_0x61e7('0x21')](_0x585bd3,_0x10576c,!![]);}catch(_0xe25c64){return BPromise['reject'](_0xe25c64);}return _0x585bd3[_0x61e7('0x22')]();};}function saveUpdates(_0x10bd0b,_0xa8932d){return function(_0x11b85e){if(_0x11b85e){return _0x11b85e[_0x61e7('0x23')](_0x10bd0b)['then'](function(_0x2b7ec2){return _0x2b7ec2;});}return null;};}function removeEntity(_0x540b1a,_0x9dbf7f){return function(_0x174de9){if(_0x174de9){return _0x174de9['destroy']()[_0x61e7('0x24')](function(){_0x540b1a[_0x61e7('0x1c')](0xcc)[_0x61e7('0x1d')]();});}};}function handleEntityNotFound(_0x1b8ba2,_0x1b5e95){return function(_0x29a774){if(!_0x29a774){_0x1b8ba2[_0x61e7('0x1b')](0x194);}return _0x29a774;};}function handleError(_0x6eabc6,_0x235408){_0x235408=_0x235408||0x1f4;return function(_0xe7e14c){logger[_0x61e7('0x25')](_0xe7e14c[_0x61e7('0x26')]);if(_0xe7e14c[_0x61e7('0x27')]){delete _0xe7e14c['name'];}_0x6eabc6[_0x61e7('0x1c')](_0x235408)[_0x61e7('0x28')](_0xe7e14c);};}exports[_0x61e7('0x29')]=function(_0x241cdb,_0x240c2c){var _0x316154={},_0x16ee3a={},_0x553545={'count':0x0,'rows':[]};var _0x4b0ebe=_[_0x61e7('0x2a')](db[_0x61e7('0x2b')][_0x61e7('0x2c')],function(_0xe18b9a){return{'name':_0xe18b9a['fieldName'],'type':_0xe18b9a[_0x61e7('0x2d')]['key']};});_0x16ee3a[_0x61e7('0x2e')]=_['map'](_0x4b0ebe,_0x61e7('0x27'));_0x16ee3a[_0x61e7('0x2f')]=_['keys'](_0x241cdb[_0x61e7('0x2f')]);_0x16ee3a['filters']=_[_0x61e7('0x30')](_0x16ee3a[_0x61e7('0x2e')],_0x16ee3a['query']);_0x316154[_0x61e7('0x31')]=_[_0x61e7('0x30')](_0x16ee3a[_0x61e7('0x2e')],qs[_0x61e7('0x32')](_0x241cdb[_0x61e7('0x2f')][_0x61e7('0x32')]));_0x316154[_0x61e7('0x31')]=_0x316154[_0x61e7('0x31')][_0x61e7('0x33')]?_0x316154[_0x61e7('0x31')]:_0x16ee3a[_0x61e7('0x2e')];if(!_0x241cdb[_0x61e7('0x2f')][_0x61e7('0x34')]('nolimit')){_0x316154[_0x61e7('0x35')]=qs[_0x61e7('0x35')](_0x241cdb[_0x61e7('0x2f')][_0x61e7('0x35')]);_0x316154[_0x61e7('0x1e')]=qs['offset'](_0x241cdb[_0x61e7('0x2f')][_0x61e7('0x1e')]);}_0x316154[_0x61e7('0x36')]=qs[_0x61e7('0x37')](_0x241cdb[_0x61e7('0x2f')][_0x61e7('0x37')]);_0x316154['where']=qs[_0x61e7('0x38')](_[_0x61e7('0x39')](_0x241cdb[_0x61e7('0x2f')],_0x16ee3a[_0x61e7('0x38')]),_0x4b0ebe);if(_0x241cdb[_0x61e7('0x2f')]['filter']){_0x316154[_0x61e7('0x3a')]=_[_0x61e7('0x3b')](_0x316154[_0x61e7('0x3a')],{'$or':_[_0x61e7('0x2a')](_0x4b0ebe,function(_0x489651){if(_0x489651['type']!=='VIRTUAL'){var _0x5d645e={};_0x5d645e[_0x489651[_0x61e7('0x27')]]={'$like':'%'+_0x241cdb[_0x61e7('0x2f')][_0x61e7('0x3c')]+'%'};return _0x5d645e;}})});}_0x316154=_[_0x61e7('0x3b')]({},_0x316154,_0x241cdb[_0x61e7('0x3d')]);var _0x575bac={'where':_0x316154[_0x61e7('0x3a')]};return db[_0x61e7('0x2b')]['count'](_0x575bac)[_0x61e7('0x24')](function(_0x16f49e){_0x553545[_0x61e7('0x3e')]=_0x16f49e;if(_0x241cdb['query'][_0x61e7('0x3f')]){_0x316154[_0x61e7('0x40')]=[{'all':!![]}];}return db['Integration'][_0x61e7('0x41')](_0x316154);})[_0x61e7('0x24')](function(_0x2e69fa){_0x553545['rows']=_0x2e69fa;return _0x553545;})[_0x61e7('0x24')](respondWithFilteredResult(_0x240c2c,_0x316154))['catch'](handleError(_0x240c2c,null));};exports[_0x61e7('0x42')]=function(_0x508b1,_0x36706d){var _0x575152={'raw':![],'where':{'id':_0x508b1[_0x61e7('0x43')]['id']}},_0x4d9927={};_0x4d9927[_0x61e7('0x2e')]=_[_0x61e7('0x44')](db[_0x61e7('0x2b')][_0x61e7('0x2c')]);_0x4d9927[_0x61e7('0x2f')]=_[_0x61e7('0x44')](_0x508b1['query']);_0x4d9927[_0x61e7('0x38')]=_['intersection'](_0x4d9927[_0x61e7('0x2e')],_0x4d9927['query']);_0x575152[_0x61e7('0x31')]=_['intersection'](_0x4d9927[_0x61e7('0x2e')],qs[_0x61e7('0x32')](_0x508b1[_0x61e7('0x2f')][_0x61e7('0x32')]));_0x575152[_0x61e7('0x31')]=_0x575152[_0x61e7('0x31')][_0x61e7('0x33')]?_0x575152[_0x61e7('0x31')]:_0x4d9927[_0x61e7('0x2e')];if(_0x508b1[_0x61e7('0x2f')][_0x61e7('0x3f')]){_0x575152[_0x61e7('0x40')]=[{'all':!![]}];}_0x575152=_['merge']({},_0x575152,_0x508b1['options']);return db[_0x61e7('0x2b')][_0x61e7('0x45')](_0x575152)['then'](handleEntityNotFound(_0x36706d,null))[_0x61e7('0x24')](respondWithResult(_0x36706d,null))[_0x61e7('0x46')](handleError(_0x36706d,null));};exports[_0x61e7('0x47')]=function(_0x84eb33,_0x44450e){return db[_0x61e7('0x2b')]['create'](_0x84eb33[_0x61e7('0x48')],{})['then'](respondWithResult(_0x44450e,0xc9))[_0x61e7('0x46')](handleError(_0x44450e,null));};exports[_0x61e7('0x23')]=function(_0x19a026,_0x545d1f){if(_0x19a026[_0x61e7('0x48')]['id']){delete _0x19a026[_0x61e7('0x48')]['id'];}return db[_0x61e7('0x2b')][_0x61e7('0x45')]({'where':{'id':_0x19a026[_0x61e7('0x43')]['id']}})[_0x61e7('0x24')](handleEntityNotFound(_0x545d1f,null))[_0x61e7('0x24')](saveUpdates(_0x19a026[_0x61e7('0x48')],null))[_0x61e7('0x24')](respondWithResult(_0x545d1f,null))[_0x61e7('0x46')](handleError(_0x545d1f,null));};exports['destroy']=function(_0x1c4e95,_0x47699d){return db[_0x61e7('0x2b')][_0x61e7('0x45')]({'where':{'id':_0x1c4e95[_0x61e7('0x43')]['id']}})[_0x61e7('0x24')](handleEntityNotFound(_0x47699d,null))[_0x61e7('0x24')](removeEntity(_0x47699d,null))[_0x61e7('0x46')](handleError(_0x47699d,null));}; \ No newline at end of file +var _0xfe0f=['params','include','merge','create','body','find','html-pdf','eml-format','rimraf','moment','bluebird','util','path','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','Integration','includeAll','findAll','rows','catch','show'];(function(_0x18f80b,_0x46368a){var _0x54a62d=function(_0x5870c3){while(--_0x5870c3){_0x18f80b['push'](_0x18f80b['shift']());}};_0x54a62d(++_0x46368a);}(_0xfe0f,0x122));var _0xffe0=function(_0x3e348d,_0x300aa0){_0x3e348d=_0x3e348d-0x0;var _0x5a3e10=_0xfe0f[_0x3e348d];return _0x5a3e10;};'use strict';var pdf=require(_0xffe0('0x0'));var emlformat=require(_0xffe0('0x1'));var rimraf=require(_0xffe0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xffe0('0x3'));var BPromise=require(_0xffe0('0x4'));var Mustache=require('mustache');var util=require(_0xffe0('0x5'));var path=require(_0xffe0('0x6'));var sox=require(_0xffe0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xffe0('0x8'));var squel=require(_0xffe0('0x9'));var crypto=require('crypto');var jsforce=require(_0xffe0('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xffe0('0xb'));var querystring=require(_0xffe0('0xc'));var Papa=require(_0xffe0('0xd'));var Redis=require(_0xffe0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xffe0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffe0('0x10'));var logger=require(_0xffe0('0x11'))(_0xffe0('0x12'));var utils=require(_0xffe0('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a7a95,_0x20780e){_0x20780e=_0x20780e||0xcc;return function(_0x399a95){if(_0x399a95){return _0x4a7a95[_0xffe0('0x14')](_0x20780e);}return _0x4a7a95['status'](_0x20780e)[_0xffe0('0x15')]();};}function respondWithResult(_0x197051,_0x2898c0){_0x2898c0=_0x2898c0||0xc8;return function(_0x4df829){if(_0x4df829){return _0x197051[_0xffe0('0x16')](_0x2898c0)['json'](_0x4df829);}};}function respondWithFilteredResult(_0x320114,_0x519254){return function(_0x1baca0){if(_0x1baca0){var _0x1155ca=_0x1baca0[_0xffe0('0x17')],_0x1c0ff4=_0x519254[_0xffe0('0x18')],_0x31e864=_0x519254[_0xffe0('0x18')]+_0x519254[_0xffe0('0x19')],_0x4609ed;if(_0x31e864>=_0x1155ca){_0x31e864=_0x1155ca;_0x4609ed=0xc8;}else{_0x4609ed=0xce;}_0x320114[_0xffe0('0x16')](_0x4609ed);return _0x320114[_0xffe0('0x1a')](_0xffe0('0x1b'),_0x1c0ff4+'-'+_0x31e864+'/'+_0x1155ca)[_0xffe0('0x1c')](_0x1baca0);}return null;};}function patchUpdates(_0x1543b2){return function(_0x27f9b1){try{jsonpatch[_0xffe0('0x1d')](_0x27f9b1,_0x1543b2,!![]);}catch(_0x2fedef){return BPromise['reject'](_0x2fedef);}return _0x27f9b1[_0xffe0('0x1e')]();};}function saveUpdates(_0x590952,_0x46ee36){return function(_0x1b41c9){if(_0x1b41c9){return _0x1b41c9[_0xffe0('0x1f')](_0x590952)['then'](function(_0x1b281b){return _0x1b281b;});}return null;};}function removeEntity(_0x1b684a,_0x22da27){return function(_0x3394b0){if(_0x3394b0){return _0x3394b0[_0xffe0('0x20')]()[_0xffe0('0x21')](function(){_0x1b684a[_0xffe0('0x16')](0xcc)[_0xffe0('0x15')]();});}};}function handleEntityNotFound(_0x277ae9,_0x2022e9){return function(_0x1db59b){if(!_0x1db59b){_0x277ae9[_0xffe0('0x14')](0x194);}return _0x1db59b;};}function handleError(_0x38ef8b,_0x2efb15){_0x2efb15=_0x2efb15||0x1f4;return function(_0x43d5c9){logger[_0xffe0('0x22')](_0x43d5c9[_0xffe0('0x23')]);if(_0x43d5c9[_0xffe0('0x24')]){delete _0x43d5c9[_0xffe0('0x24')];}_0x38ef8b[_0xffe0('0x16')](_0x2efb15)['send'](_0x43d5c9);};}exports[_0xffe0('0x25')]=function(_0x1d732f,_0x25483b){var _0x2f92b3={},_0x4a0bf0={},_0xf0ce30={'count':0x0,'rows':[]};var _0xa7fa06=_[_0xffe0('0x26')](db['Integration'][_0xffe0('0x27')],function(_0x3342c2){return{'name':_0x3342c2[_0xffe0('0x28')],'type':_0x3342c2['type'][_0xffe0('0x29')]};});_0x4a0bf0['model']=_[_0xffe0('0x26')](_0xa7fa06,_0xffe0('0x24'));_0x4a0bf0[_0xffe0('0x2a')]=_[_0xffe0('0x2b')](_0x1d732f[_0xffe0('0x2a')]);_0x4a0bf0[_0xffe0('0x2c')]=_['intersection'](_0x4a0bf0['model'],_0x4a0bf0['query']);_0x2f92b3['attributes']=_[_0xffe0('0x2d')](_0x4a0bf0[_0xffe0('0x2e')],qs['fields'](_0x1d732f[_0xffe0('0x2a')][_0xffe0('0x2f')]));_0x2f92b3[_0xffe0('0x30')]=_0x2f92b3[_0xffe0('0x30')][_0xffe0('0x31')]?_0x2f92b3[_0xffe0('0x30')]:_0x4a0bf0[_0xffe0('0x2e')];if(!_0x1d732f[_0xffe0('0x2a')][_0xffe0('0x32')](_0xffe0('0x33'))){_0x2f92b3[_0xffe0('0x19')]=qs[_0xffe0('0x19')](_0x1d732f['query'][_0xffe0('0x19')]);_0x2f92b3['offset']=qs['offset'](_0x1d732f[_0xffe0('0x2a')]['offset']);}_0x2f92b3['order']=qs[_0xffe0('0x34')](_0x1d732f['query'][_0xffe0('0x34')]);_0x2f92b3[_0xffe0('0x35')]=qs[_0xffe0('0x2c')](_[_0xffe0('0x36')](_0x1d732f[_0xffe0('0x2a')],_0x4a0bf0['filters']),_0xa7fa06);if(_0x1d732f[_0xffe0('0x2a')][_0xffe0('0x37')]){_0x2f92b3['where']=_['merge'](_0x2f92b3[_0xffe0('0x35')],{'$or':_['map'](_0xa7fa06,function(_0x57b75b){if(_0x57b75b[_0xffe0('0x38')]!==_0xffe0('0x39')){var _0x4dc70a={};_0x4dc70a[_0x57b75b[_0xffe0('0x24')]]={'$like':'%'+_0x1d732f[_0xffe0('0x2a')][_0xffe0('0x37')]+'%'};return _0x4dc70a;}})});}_0x2f92b3=_['merge']({},_0x2f92b3,_0x1d732f[_0xffe0('0x3a')]);var _0x29b292={'where':_0x2f92b3[_0xffe0('0x35')]};return db[_0xffe0('0x3b')][_0xffe0('0x17')](_0x29b292)[_0xffe0('0x21')](function(_0x31a0ec){_0xf0ce30[_0xffe0('0x17')]=_0x31a0ec;if(_0x1d732f['query'][_0xffe0('0x3c')]){_0x2f92b3['include']=[{'all':!![]}];}return db[_0xffe0('0x3b')][_0xffe0('0x3d')](_0x2f92b3);})[_0xffe0('0x21')](function(_0xf118b3){_0xf0ce30[_0xffe0('0x3e')]=_0xf118b3;return _0xf0ce30;})[_0xffe0('0x21')](respondWithFilteredResult(_0x25483b,_0x2f92b3))[_0xffe0('0x3f')](handleError(_0x25483b,null));};exports[_0xffe0('0x40')]=function(_0x3923f5,_0x5a827a){var _0x3e15e1={'raw':![],'where':{'id':_0x3923f5[_0xffe0('0x41')]['id']}},_0xbe1390={};_0xbe1390[_0xffe0('0x2e')]=_['keys'](db[_0xffe0('0x3b')][_0xffe0('0x27')]);_0xbe1390[_0xffe0('0x2a')]=_[_0xffe0('0x2b')](_0x3923f5['query']);_0xbe1390['filters']=_['intersection'](_0xbe1390[_0xffe0('0x2e')],_0xbe1390['query']);_0x3e15e1[_0xffe0('0x30')]=_['intersection'](_0xbe1390[_0xffe0('0x2e')],qs[_0xffe0('0x2f')](_0x3923f5['query'][_0xffe0('0x2f')]));_0x3e15e1[_0xffe0('0x30')]=_0x3e15e1[_0xffe0('0x30')][_0xffe0('0x31')]?_0x3e15e1['attributes']:_0xbe1390[_0xffe0('0x2e')];if(_0x3923f5[_0xffe0('0x2a')][_0xffe0('0x3c')]){_0x3e15e1[_0xffe0('0x42')]=[{'all':!![]}];}_0x3e15e1=_[_0xffe0('0x43')]({},_0x3e15e1,_0x3923f5[_0xffe0('0x3a')]);return db[_0xffe0('0x3b')]['find'](_0x3e15e1)[_0xffe0('0x21')](handleEntityNotFound(_0x5a827a,null))[_0xffe0('0x21')](respondWithResult(_0x5a827a,null))[_0xffe0('0x3f')](handleError(_0x5a827a,null));};exports[_0xffe0('0x44')]=function(_0x2dba25,_0x10346f){return db[_0xffe0('0x3b')][_0xffe0('0x44')](_0x2dba25[_0xffe0('0x45')],{})[_0xffe0('0x21')](respondWithResult(_0x10346f,0xc9))['catch'](handleError(_0x10346f,null));};exports[_0xffe0('0x1f')]=function(_0x18c636,_0x386d35){if(_0x18c636['body']['id']){delete _0x18c636[_0xffe0('0x45')]['id'];}return db[_0xffe0('0x3b')]['find']({'where':{'id':_0x18c636[_0xffe0('0x41')]['id']}})[_0xffe0('0x21')](handleEntityNotFound(_0x386d35,null))[_0xffe0('0x21')](saveUpdates(_0x18c636[_0xffe0('0x45')],null))['then'](respondWithResult(_0x386d35,null))[_0xffe0('0x3f')](handleError(_0x386d35,null));};exports[_0xffe0('0x20')]=function(_0x54033f,_0x2090df){return db[_0xffe0('0x3b')][_0xffe0('0x46')]({'where':{'id':_0x54033f['params']['id']}})['then'](handleEntityNotFound(_0x2090df,null))[_0xffe0('0x21')](removeEntity(_0x2090df,null))[_0xffe0('0x3f')](handleError(_0x2090df,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2e878bb..1d65e34 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 _0x2188=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x89d9d8,_0xd6f98d){var _0x55de68=function(_0x10bc4f){while(--_0x10bc4f){_0x89d9d8['push'](_0x89d9d8['shift']());}};_0x55de68(++_0xd6f98d);}(_0x2188,0xd0));var _0x8218=function(_0x34d42f,_0x55194d){_0x34d42f=_0x34d42f-0x0;var _0x3f1202=_0x2188[_0x34d42f];return _0x3f1202;};'use strict';var _=require(_0x8218('0x0'));var util=require(_0x8218('0x1'));var logger=require(_0x8218('0x2'))('api');var moment=require(_0x8218('0x3'));var BPromise=require(_0x8218('0x4'));var rp=require(_0x8218('0x5'));var fs=require('fs');var path=require(_0x8218('0x6'));var rimraf=require(_0x8218('0x7'));var config=require(_0x8218('0x8'));var attributes=require(_0x8218('0x9'));module[_0x8218('0xa')]=function(_0x46ed98,_0x37a8be){return _0x46ed98[_0x8218('0xb')](_0x8218('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadbd=['../../config/environment','./integration.attributes','define','Integration','integrations','lodash','api','moment','bluebird','path','rimraf'];(function(_0x4199ff,_0x46fffe){var _0x294eb3=function(_0x898d95){while(--_0x898d95){_0x4199ff['push'](_0x4199ff['shift']());}};_0x294eb3(++_0x46fffe);}(_0xadbd,0xe1));var _0xdadb=function(_0xb4b09d,_0x515dad){_0xb4b09d=_0xb4b09d-0x0;var _0x464cc1=_0xadbd[_0xb4b09d];return _0x464cc1;};'use strict';var _=require(_0xdadb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdadb('0x1'));var moment=require(_0xdadb('0x2'));var BPromise=require(_0xdadb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdadb('0x4'));var rimraf=require(_0xdadb('0x5'));var config=require(_0xdadb('0x6'));var attributes=require(_0xdadb('0x7'));module['exports']=function(_0x570a55,_0x5178aa){return _0x570a55[_0xdadb('0x8')](_0xdadb('0x9'),attributes,{'tableName':_0xdadb('0xa'),'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 a01fbea..7f14f6b 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 _0xe181=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x340756,_0xad31ae){var _0x2ef745=function(_0x59ffde){while(--_0x59ffde){_0x340756['push'](_0x340756['shift']());}};_0x2ef745(++_0xad31ae);}(_0xe181,0x68));var _0x1e18=function(_0x1e11c2,_0x1bcbca){_0x1e11c2=_0x1e11c2-0x0;var _0x4faa44=_0xe181[_0x1e11c2];return _0x4faa44;};'use strict';var _=require(_0x1e18('0x0'));var util=require('util');var moment=require(_0x1e18('0x1'));var BPromise=require(_0x1e18('0x2'));var rs=require(_0x1e18('0x3'));var fs=require('fs');var Redis=require(_0x1e18('0x4'));var db=require(_0x1e18('0x5'))['db'];var utils=require(_0x1e18('0x6'));var logger=require(_0x1e18('0x7'))('rpc');var config=require(_0x1e18('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1e18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x182c98,_0x46ba95,_0x25b786){return new BPromise(function(_0x9f9541,_0x398f77){return client['request'](_0x182c98,_0x25b786)[_0x1e18('0xa')](function(_0x40fda9){logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));logger[_0x1e18('0xe')]('Integration,\x20%s,\x20%s,\x20%s',_0x46ba95,_0x1e18('0xd'),JSON[_0x1e18('0xf')](_0x40fda9));if(_0x40fda9[_0x1e18('0x10')]){if(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x11')]===0x1f4){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x40fda9[_0x1e18('0x10')]['message']);return _0x398f77(_0x40fda9[_0x1e18('0x10')]['message']);}logger[_0x1e18('0x10')]('Integration,\x20%s,\x20%s',_0x46ba95,_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);return _0x9f9541(_0x40fda9[_0x1e18('0x10')][_0x1e18('0x12')]);}else{logger[_0x1e18('0xb')](_0x1e18('0xc'),_0x46ba95,_0x1e18('0xd'));_0x9f9541(_0x40fda9[_0x1e18('0x13')][_0x1e18('0x12')]);}})[_0x1e18('0x14')](function(_0x12ef98){logger[_0x1e18('0x10')](_0x1e18('0xc'),_0x46ba95,_0x12ef98);_0x398f77(_0x12ef98);});});} \ No newline at end of file +var _0x5127=['client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x5127,0x64));var _0x7512=function(_0x35cabc,_0xc0f89a){_0x35cabc=_0x35cabc-0x0;var _0x2af2b9=_0x5127[_0x35cabc];return _0x2af2b9;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var moment=require(_0x7512('0x2'));var BPromise=require(_0x7512('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7512('0x4'));var db=require(_0x7512('0x5'))['db'];var utils=require(_0x7512('0x6'));var logger=require('../../config/logger')(_0x7512('0x7'));var config=require(_0x7512('0x8'));var jayson=require(_0x7512('0x9'));var client=jayson[_0x7512('0xa')][_0x7512('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d08ae,_0x40eee2,_0x208711){return new BPromise(function(_0x1be9e3,_0x4c3df7){return client[_0x7512('0xc')](_0x5d08ae,_0x208711)[_0x7512('0xd')](function(_0x16d3d0){logger['info'](_0x7512('0xe'),_0x40eee2,_0x7512('0xf'));logger[_0x7512('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x40eee2,'request\x20sent',JSON[_0x7512('0x11')](_0x16d3d0));if(_0x16d3d0[_0x7512('0x12')]){if(_0x16d3d0[_0x7512('0x12')]['code']===0x1f4){logger[_0x7512('0x12')]('Integration,\x20%s,\x20%s',_0x40eee2,_0x16d3d0[_0x7512('0x12')]['message']);return _0x4c3df7(_0x16d3d0[_0x7512('0x12')][_0x7512('0x13')]);}logger[_0x7512('0x12')](_0x7512('0xe'),_0x40eee2,_0x16d3d0[_0x7512('0x12')][_0x7512('0x13')]);return _0x1be9e3(_0x16d3d0[_0x7512('0x12')]['message']);}else{logger[_0x7512('0x14')](_0x7512('0xe'),_0x40eee2,_0x7512('0xf'));_0x1be9e3(_0x16d3d0[_0x7512('0x15')][_0x7512('0x13')]);}})['catch'](function(_0x523fa0){logger['error'](_0x7512('0xe'),_0x40eee2,_0x523fa0);_0x4c3df7(_0x523fa0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index d2790aa..04d9a94 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 _0x2afc=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','index','isAuthenticated','show','create','/:id','update','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2afc,0x87));var _0xc2af=function(_0x356127,_0x4873ac){_0x356127=_0x356127-0x0;var _0x5d4c75=_0x2afc[_0x356127];return _0x5d4c75;};'use strict';var multer=require(_0xc2af('0x0'));var util=require(_0xc2af('0x1'));var path=require(_0xc2af('0x2'));var timeout=require('connect-timeout');var express=require(_0xc2af('0x3'));var router=express[_0xc2af('0x4')]();var auth=require(_0xc2af('0x5'));var interaction=require(_0xc2af('0x6'));var config=require('../../config/environment');var controller=require(_0xc2af('0x7'));router[_0xc2af('0x8')]('/',auth['isAuthenticated'](),controller[_0xc2af('0x9')]);router[_0xc2af('0x8')]('/describe',auth[_0xc2af('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc2af('0xb')]);router['post']('/',auth[_0xc2af('0xa')](),controller[_0xc2af('0xc')]);router['put'](_0xc2af('0xd'),auth[_0xc2af('0xa')](),controller[_0xc2af('0xe')]);router['delete'](_0xc2af('0xd'),auth['isAuthenticated'](),controller[_0xc2af('0xf')]);module[_0xc2af('0x10')]=router; \ No newline at end of file +var _0x11b7=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x3801a0,_0x12ddfd){var _0x228725=function(_0x3a9543){while(--_0x3a9543){_0x3801a0['push'](_0x3801a0['shift']());}};_0x228725(++_0x12ddfd);}(_0x11b7,0x132));var _0x711b=function(_0x4df4d2,_0x31dd52){_0x4df4d2=_0x4df4d2-0x0;var _0x3b9f52=_0x11b7[_0x4df4d2];return _0x3b9f52;};'use strict';var multer=require(_0x711b('0x0'));var util=require(_0x711b('0x1'));var path=require(_0x711b('0x2'));var timeout=require(_0x711b('0x3'));var express=require(_0x711b('0x4'));var router=express[_0x711b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x711b('0x6'));var config=require(_0x711b('0x7'));var controller=require(_0x711b('0x8'));router['get']('/',auth[_0x711b('0x9')](),controller[_0x711b('0xa')]);router[_0x711b('0xb')](_0x711b('0xc'),auth[_0x711b('0x9')](),controller[_0x711b('0xd')]);router[_0x711b('0xb')](_0x711b('0xe'),auth[_0x711b('0x9')](),controller[_0x711b('0xf')]);router[_0x711b('0x10')]('/',auth[_0x711b('0x9')](),controller[_0x711b('0x11')]);router[_0x711b('0x12')](_0x711b('0xe'),auth['isAuthenticated'](),controller[_0x711b('0x13')]);router[_0x711b('0x14')]('/:id',auth[_0x711b('0x9')](),controller[_0x711b('0x15')]);module[_0x711b('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index a48bd55..5e35641 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 _0xbfe6=['SENT','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xbfe6,0xeb));var _0x6bfe=function(_0x2cca6e,_0x5c4d19){_0x2cca6e=_0x2cca6e-0x0;var _0x3ddfb5=_0xbfe6[_0x2cca6e];return _0x3ddfb5;};'use strict';var Sequelize=require(_0x6bfe('0x0'));module[_0x6bfe('0x1')]={'integration':{'type':Sequelize[_0x6bfe('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x6bfe('0x2')]},'ticketId':{'type':Sequelize[_0x6bfe('0x2')]},'integrationId':{'type':Sequelize[_0x6bfe('0x3')]},'contacts':{'type':Sequelize[_0x6bfe('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6bfe('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6bfe('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6bfe('0x2')]},'agentcalledAt':{'type':Sequelize[_0x6bfe('0x4')]},'agentconnectAt':{'type':Sequelize[_0x6bfe('0x4')]},'holdtime':{'type':Sequelize[_0x6bfe('0x3')]},'agentcomplete':{'type':Sequelize[_0x6bfe('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x6bfe('0x4')]},'talktime':{'type':Sequelize[_0x6bfe('0x3')]},'agentacw':{'type':Sequelize[_0x6bfe('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6bfe('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6bfe('0x4')]},'agentdump':{'type':Sequelize[_0x6bfe('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6bfe('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6bfe('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6bfe('0x2')]},'connectedlinename':{'type':Sequelize[_0x6bfe('0x2')]},'language':{'type':Sequelize[_0x6bfe('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6bfe('0x2')]},'exten':{'type':Sequelize[_0x6bfe('0x2')]},'priority':{'type':Sequelize[_0x6bfe('0x2')]},'destchannel':{'type':Sequelize[_0x6bfe('0x2')]},'destchannelstate':{'type':Sequelize[_0x6bfe('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6bfe('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6bfe('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x6bfe('0x2')]},'destlanguage':{'type':Sequelize[_0x6bfe('0x2')]},'destaccountcode':{'type':Sequelize[_0x6bfe('0x2')]},'destcontext':{'type':Sequelize[_0x6bfe('0x2')]},'destexten':{'type':Sequelize[_0x6bfe('0x2')]},'destpriority':{'type':Sequelize[_0x6bfe('0x2')]},'destuniqueid':{'type':Sequelize[_0x6bfe('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6bfe('0x2')]},'subject':{'type':Sequelize[_0x6bfe('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x6bfe('0x2')]},'cc':{'type':Sequelize[_0x6bfe('0x2')]},'attachment':{'type':Sequelize[_0x6bfe('0x6')]},'html':{'type':Sequelize[_0x6bfe('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x6bfe('0x7')](_0x6bfe('0x8'),'SENDING','RECEIVED','FAILED')},'url':{'type':Sequelize[_0x6bfe('0x2')]},'app':{'type':Sequelize[_0x6bfe('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x6bfe('0x3')]}}; \ No newline at end of file +var _0xecc0=['SENT','SENDING','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xecc0,0x14d));var _0x0ecc=function(_0x117ecd,_0x56bc82){_0x117ecd=_0x117ecd-0x0;var _0xee901b=_0xecc0[_0x117ecd];return _0xee901b;};'use strict';var Sequelize=require(_0x0ecc('0x0'));module['exports']={'integration':{'type':Sequelize[_0x0ecc('0x1')]},'eventChannel':{'type':Sequelize[_0x0ecc('0x1')]},'exitStatus':{'type':Sequelize[_0x0ecc('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x0ecc('0x2')]},'contacts':{'type':Sequelize[_0x0ecc('0x1')]},'uniqueid':{'type':Sequelize[_0x0ecc('0x1')]},'calleridnum':{'type':Sequelize[_0x0ecc('0x1')]},'calleridname':{'type':Sequelize[_0x0ecc('0x1')]},'queue':{'type':Sequelize[_0x0ecc('0x1')]},'interface':{'type':Sequelize[_0x0ecc('0x1')]},'membername':{'type':Sequelize[_0x0ecc('0x1')]},'agentcalledAt':{'type':Sequelize[_0x0ecc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0ecc('0x3')]},'holdtime':{'type':Sequelize[_0x0ecc('0x2')]},'agentcomplete':{'type':Sequelize[_0x0ecc('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0ecc('0x3')]},'talktime':{'type':Sequelize[_0x0ecc('0x2')]},'agentacw':{'type':Sequelize[_0x0ecc('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0ecc('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0ecc('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0ecc('0x3')]},'agentdump':{'type':Sequelize[_0x0ecc('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0ecc('0x3')]},'lastevent':{'type':Sequelize[_0x0ecc('0x1')]},'channel':{'type':Sequelize[_0x0ecc('0x1')]},'channelstate':{'type':Sequelize[_0x0ecc('0x2')]},'channelstatedesc':{'type':Sequelize[_0x0ecc('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0ecc('0x1')]},'connectedlinename':{'type':Sequelize[_0x0ecc('0x1')]},'language':{'type':Sequelize[_0x0ecc('0x1')]},'accountcode':{'type':Sequelize[_0x0ecc('0x1')]},'context':{'type':Sequelize[_0x0ecc('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x0ecc('0x1')]},'destchannel':{'type':Sequelize[_0x0ecc('0x1')]},'destchannelstate':{'type':Sequelize[_0x0ecc('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x0ecc('0x1')]},'destcalleridnum':{'type':Sequelize[_0x0ecc('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0ecc('0x1')]},'destcontext':{'type':Sequelize[_0x0ecc('0x1')]},'destexten':{'type':Sequelize[_0x0ecc('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x0ecc('0x1')]},'messageId':{'type':Sequelize[_0x0ecc('0x1')]},'inReplyTo':{'type':Sequelize[_0x0ecc('0x1')]},'subject':{'type':Sequelize[_0x0ecc('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x0ecc('0x1')]},'cc':{'type':Sequelize[_0x0ecc('0x1')]},'attachment':{'type':Sequelize[_0x0ecc('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x0ecc('0x5')]},'status':{'type':Sequelize[_0x0ecc('0x6')](_0x0ecc('0x7'),_0x0ecc('0x8'),'RECEIVED',_0x0ecc('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x0ecc('0x1')]},'projectId':{'type':Sequelize[_0x0ecc('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9c978e9..af9853c 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 _0xed07=['create','body','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','index','IntegrationReport','rawAttributes','key','model','map','keys','filters','intersection','fields','query','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','catch'];(function(_0x4eff81,_0x4533b6){var _0x39b405=function(_0x25eb5d){while(--_0x25eb5d){_0x4eff81['push'](_0x4eff81['shift']());}};_0x39b405(++_0x4533b6);}(_0xed07,0xe1));var _0x7ed0=function(_0x1e06f5,_0x1a2373){_0x1e06f5=_0x1e06f5-0x0;var _0x50ba17=_0xed07[_0x1e06f5];return _0x50ba17;};'use strict';var pdf=require(_0x7ed0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7ed0('0x1'));var jsonpatch=require(_0x7ed0('0x2'));var rp=require('request-promise');var moment=require(_0x7ed0('0x3'));var BPromise=require(_0x7ed0('0x4'));var Mustache=require(_0x7ed0('0x5'));var util=require(_0x7ed0('0x6'));var path=require(_0x7ed0('0x7'));var sox=require(_0x7ed0('0x8'));var csv=require('to-csv');var ejs=require(_0x7ed0('0x9'));var fs=require('fs');var _=require(_0x7ed0('0xa'));var squel=require(_0x7ed0('0xb'));var crypto=require('crypto');var jsforce=require(_0x7ed0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7ed0('0xd'));var querystring=require(_0x7ed0('0xe'));var Papa=require(_0x7ed0('0xf'));var Redis=require(_0x7ed0('0x10'));var authService=require(_0x7ed0('0x11'));var qs=require(_0x7ed0('0x12'));var as=require(_0x7ed0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7ed0('0x14'));var config=require(_0x7ed0('0x15'));var db=require(_0x7ed0('0x16'))['db'];function respondWithStatusCode(_0xcac048,_0x77f81a){_0x77f81a=_0x77f81a||0xcc;return function(_0x574306){if(_0x574306){return _0xcac048[_0x7ed0('0x17')](_0x77f81a);}return _0xcac048[_0x7ed0('0x18')](_0x77f81a)[_0x7ed0('0x19')]();};}function respondWithResult(_0x2cc873,_0x3fe11f){_0x3fe11f=_0x3fe11f||0xc8;return function(_0x1b378c){if(_0x1b378c){return _0x2cc873[_0x7ed0('0x18')](_0x3fe11f)[_0x7ed0('0x1a')](_0x1b378c);}};}function respondWithFilteredResult(_0x16616f,_0x9f0dcd){return function(_0x8f987e){if(_0x8f987e){var _0x532d20=_0x8f987e['count'],_0x3f8b71=_0x9f0dcd[_0x7ed0('0x1b')],_0x528d24=_0x9f0dcd['offset']+_0x9f0dcd[_0x7ed0('0x1c')],_0x545bfc;if(_0x528d24>=_0x532d20){_0x528d24=_0x532d20;_0x545bfc=0xc8;}else{_0x545bfc=0xce;}_0x16616f[_0x7ed0('0x18')](_0x545bfc);return _0x16616f[_0x7ed0('0x1d')]('Content-Range',_0x3f8b71+'-'+_0x528d24+'/'+_0x532d20)[_0x7ed0('0x1a')](_0x8f987e);}return null;};}function patchUpdates(_0x5ed288){return function(_0x2af559){try{jsonpatch[_0x7ed0('0x1e')](_0x2af559,_0x5ed288,!![]);}catch(_0x58a138){return BPromise[_0x7ed0('0x1f')](_0x58a138);}return _0x2af559['save']();};}function saveUpdates(_0x43f885,_0x416631){return function(_0x358a13){if(_0x358a13){return _0x358a13[_0x7ed0('0x20')](_0x43f885)[_0x7ed0('0x21')](function(_0xb743a1){return _0xb743a1;});}return null;};}function removeEntity(_0x46ff71,_0x33e498){return function(_0x3fa8cf){if(_0x3fa8cf){return _0x3fa8cf[_0x7ed0('0x22')]()[_0x7ed0('0x21')](function(){_0x46ff71['status'](0xcc)[_0x7ed0('0x19')]();});}};}function handleEntityNotFound(_0x2f1732,_0x4c99e1){return function(_0x4d091a){if(!_0x4d091a){_0x2f1732[_0x7ed0('0x17')](0x194);}return _0x4d091a;};}function handleError(_0x46a5fb,_0x1ede9b){_0x1ede9b=_0x1ede9b||0x1f4;return function(_0xb532df){logger[_0x7ed0('0x23')](_0xb532df[_0x7ed0('0x24')]);if(_0xb532df[_0x7ed0('0x25')]){delete _0xb532df[_0x7ed0('0x25')];}_0x46a5fb['status'](_0x1ede9b)[_0x7ed0('0x26')](_0xb532df);};}exports[_0x7ed0('0x27')]=function(_0x37a416,_0x4f5ad2){var _0x3fd9f1={},_0x573c1c={},_0x34a031={'count':0x0,'rows':[]};var _0x1d7515=_['map'](db[_0x7ed0('0x28')][_0x7ed0('0x29')],function(_0x3b6725){return{'name':_0x3b6725['fieldName'],'type':_0x3b6725['type'][_0x7ed0('0x2a')]};});_0x573c1c[_0x7ed0('0x2b')]=_[_0x7ed0('0x2c')](_0x1d7515,_0x7ed0('0x25'));_0x573c1c['query']=_[_0x7ed0('0x2d')](_0x37a416['query']);_0x573c1c[_0x7ed0('0x2e')]=_[_0x7ed0('0x2f')](_0x573c1c[_0x7ed0('0x2b')],_0x573c1c['query']);_0x3fd9f1['attributes']=_[_0x7ed0('0x2f')](_0x573c1c[_0x7ed0('0x2b')],qs[_0x7ed0('0x30')](_0x37a416[_0x7ed0('0x31')][_0x7ed0('0x30')]));_0x3fd9f1[_0x7ed0('0x32')]=_0x3fd9f1[_0x7ed0('0x32')][_0x7ed0('0x33')]?_0x3fd9f1[_0x7ed0('0x32')]:_0x573c1c['model'];if(!_0x37a416[_0x7ed0('0x31')]['hasOwnProperty'](_0x7ed0('0x34'))){_0x3fd9f1[_0x7ed0('0x1c')]=qs[_0x7ed0('0x1c')](_0x37a416[_0x7ed0('0x31')][_0x7ed0('0x1c')]);_0x3fd9f1[_0x7ed0('0x1b')]=qs['offset'](_0x37a416[_0x7ed0('0x31')][_0x7ed0('0x1b')]);}_0x3fd9f1[_0x7ed0('0x35')]=qs[_0x7ed0('0x36')](_0x37a416[_0x7ed0('0x31')][_0x7ed0('0x36')]);_0x3fd9f1[_0x7ed0('0x37')]=qs[_0x7ed0('0x2e')](_[_0x7ed0('0x38')](_0x37a416['query'],_0x573c1c[_0x7ed0('0x2e')]),_0x1d7515);if(_0x37a416[_0x7ed0('0x31')][_0x7ed0('0x39')]){_0x3fd9f1['where']=_[_0x7ed0('0x3a')](_0x3fd9f1[_0x7ed0('0x37')],{'$or':_[_0x7ed0('0x2c')](_0x1d7515,function(_0x1fddd4){if(_0x1fddd4[_0x7ed0('0x3b')]!==_0x7ed0('0x3c')){var _0x3bc35e={};_0x3bc35e[_0x1fddd4[_0x7ed0('0x25')]]={'$like':'%'+_0x37a416['query'][_0x7ed0('0x39')]+'%'};return _0x3bc35e;}})});}_0x3fd9f1=_[_0x7ed0('0x3a')]({},_0x3fd9f1,_0x37a416[_0x7ed0('0x3d')]);var _0xd92c89={'where':_0x3fd9f1[_0x7ed0('0x37')]};return db['IntegrationReport'][_0x7ed0('0x3e')](_0xd92c89)[_0x7ed0('0x21')](function(_0x79188e){_0x34a031[_0x7ed0('0x3e')]=_0x79188e;if(_0x37a416[_0x7ed0('0x31')][_0x7ed0('0x3f')]){_0x3fd9f1[_0x7ed0('0x40')]=[{'all':!![]}];}return db[_0x7ed0('0x28')][_0x7ed0('0x41')](_0x3fd9f1);})[_0x7ed0('0x21')](function(_0x4e3cbe){_0x34a031[_0x7ed0('0x42')]=_0x4e3cbe;return _0x34a031;})[_0x7ed0('0x21')](respondWithFilteredResult(_0x4f5ad2,_0x3fd9f1))['catch'](handleError(_0x4f5ad2,null));};exports[_0x7ed0('0x43')]=function(_0x40a948,_0x1fe6f6){var _0x1123b7={'raw':![],'where':{'id':_0x40a948[_0x7ed0('0x44')]['id']}},_0x57514c={};_0x57514c[_0x7ed0('0x2b')]=_[_0x7ed0('0x2d')](db[_0x7ed0('0x28')][_0x7ed0('0x29')]);_0x57514c[_0x7ed0('0x31')]=_[_0x7ed0('0x2d')](_0x40a948[_0x7ed0('0x31')]);_0x57514c['filters']=_['intersection'](_0x57514c['model'],_0x57514c[_0x7ed0('0x31')]);_0x1123b7[_0x7ed0('0x32')]=_[_0x7ed0('0x2f')](_0x57514c[_0x7ed0('0x2b')],qs[_0x7ed0('0x30')](_0x40a948['query']['fields']));_0x1123b7[_0x7ed0('0x32')]=_0x1123b7[_0x7ed0('0x32')][_0x7ed0('0x33')]?_0x1123b7[_0x7ed0('0x32')]:_0x57514c[_0x7ed0('0x2b')];if(_0x40a948[_0x7ed0('0x31')]['includeAll']){_0x1123b7[_0x7ed0('0x40')]=[{'all':!![]}];}_0x1123b7=_[_0x7ed0('0x3a')]({},_0x1123b7,_0x40a948[_0x7ed0('0x3d')]);return db[_0x7ed0('0x28')][_0x7ed0('0x45')](_0x1123b7)[_0x7ed0('0x21')](handleEntityNotFound(_0x1fe6f6,null))['then'](respondWithResult(_0x1fe6f6,null))[_0x7ed0('0x46')](handleError(_0x1fe6f6,null));};exports[_0x7ed0('0x47')]=function(_0x4bbfbe,_0x405f54){return db[_0x7ed0('0x28')][_0x7ed0('0x47')](_0x4bbfbe[_0x7ed0('0x48')],{})[_0x7ed0('0x21')](respondWithResult(_0x405f54,0xc9))[_0x7ed0('0x46')](handleError(_0x405f54,null));};exports[_0x7ed0('0x20')]=function(_0x21d9d0,_0x2c79b4){if(_0x21d9d0['body']['id']){delete _0x21d9d0['body']['id'];}return db[_0x7ed0('0x28')][_0x7ed0('0x45')]({'where':{'id':_0x21d9d0[_0x7ed0('0x44')]['id']}})[_0x7ed0('0x21')](handleEntityNotFound(_0x2c79b4,null))['then'](saveUpdates(_0x21d9d0[_0x7ed0('0x48')],null))[_0x7ed0('0x21')](respondWithResult(_0x2c79b4,null))['catch'](handleError(_0x2c79b4,null));};exports[_0x7ed0('0x22')]=function(_0x9aedfc,_0x21ef00){return db[_0x7ed0('0x28')]['find']({'where':{'id':_0x9aedfc[_0x7ed0('0x44')]['id']}})['then'](handleEntityNotFound(_0x21ef00,null))[_0x7ed0('0x21')](removeEntity(_0x21ef00,null))['catch'](handleError(_0x21ef00,null));};exports[_0x7ed0('0x49')]=function(_0x4ce310,_0x4b985b){return db[_0x7ed0('0x28')]['describe']()[_0x7ed0('0x21')](respondWithResult(_0x4b985b,null))[_0x7ed0('0x46')](handleError(_0x4b985b,null));}; \ No newline at end of file +var _0x6861=['create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','include','find'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x6861,0x1c6));var _0x1686=function(_0x103fae,_0x2d2f75){_0x103fae=_0x103fae-0x0;var _0x38d0b0=_0x6861[_0x103fae];return _0x38d0b0;};'use strict';var pdf=require(_0x1686('0x0'));var emlformat=require(_0x1686('0x1'));var rimraf=require(_0x1686('0x2'));var zipdir=require(_0x1686('0x3'));var jsonpatch=require(_0x1686('0x4'));var rp=require('request-promise');var moment=require(_0x1686('0x5'));var BPromise=require(_0x1686('0x6'));var Mustache=require('mustache');var util=require(_0x1686('0x7'));var path=require(_0x1686('0x8'));var sox=require(_0x1686('0x9'));var csv=require(_0x1686('0xa'));var ejs=require(_0x1686('0xb'));var fs=require('fs');var _=require(_0x1686('0xc'));var squel=require(_0x1686('0xd'));var crypto=require(_0x1686('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1686('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1686('0x10'));var Papa=require(_0x1686('0x11'));var Redis=require(_0x1686('0x12'));var authService=require(_0x1686('0x13'));var qs=require(_0x1686('0x14'));var as=require(_0x1686('0x15'));var hardwareService=require(_0x1686('0x16'));var logger=require(_0x1686('0x17'))(_0x1686('0x18'));var utils=require('../../config/utils');var config=require(_0x1686('0x19'));var db=require(_0x1686('0x1a'))['db'];function respondWithStatusCode(_0x1ae32c,_0x159eef){_0x159eef=_0x159eef||0xcc;return function(_0xda4b7b){if(_0xda4b7b){return _0x1ae32c[_0x1686('0x1b')](_0x159eef);}return _0x1ae32c[_0x1686('0x1c')](_0x159eef)[_0x1686('0x1d')]();};}function respondWithResult(_0x1b6f34,_0x4862db){_0x4862db=_0x4862db||0xc8;return function(_0x500c26){if(_0x500c26){return _0x1b6f34[_0x1686('0x1c')](_0x4862db)[_0x1686('0x1e')](_0x500c26);}};}function respondWithFilteredResult(_0x1a2759,_0x4abffe){return function(_0x29cd1a){if(_0x29cd1a){var _0x43264d=_0x29cd1a[_0x1686('0x1f')],_0x474618=_0x4abffe['offset'],_0x384e3c=_0x4abffe['offset']+_0x4abffe[_0x1686('0x20')],_0x46d347;if(_0x384e3c>=_0x43264d){_0x384e3c=_0x43264d;_0x46d347=0xc8;}else{_0x46d347=0xce;}_0x1a2759['status'](_0x46d347);return _0x1a2759[_0x1686('0x21')](_0x1686('0x22'),_0x474618+'-'+_0x384e3c+'/'+_0x43264d)[_0x1686('0x1e')](_0x29cd1a);}return null;};}function patchUpdates(_0x3c374b){return function(_0x4b5970){try{jsonpatch['apply'](_0x4b5970,_0x3c374b,!![]);}catch(_0x468f4f){return BPromise[_0x1686('0x23')](_0x468f4f);}return _0x4b5970[_0x1686('0x24')]();};}function saveUpdates(_0x3542ad,_0x39f5dd){return function(_0x3aaaa2){if(_0x3aaaa2){return _0x3aaaa2['update'](_0x3542ad)[_0x1686('0x25')](function(_0x3193f0){return _0x3193f0;});}return null;};}function removeEntity(_0x1dbbfe,_0x580877){return function(_0x479a71){if(_0x479a71){return _0x479a71[_0x1686('0x26')]()['then'](function(){_0x1dbbfe[_0x1686('0x1c')](0xcc)[_0x1686('0x1d')]();});}};}function handleEntityNotFound(_0x18815d,_0x487538){return function(_0x33a615){if(!_0x33a615){_0x18815d[_0x1686('0x1b')](0x194);}return _0x33a615;};}function handleError(_0x2cfc48,_0x1d1b5){_0x1d1b5=_0x1d1b5||0x1f4;return function(_0x39fcee){logger[_0x1686('0x27')](_0x39fcee['stack']);if(_0x39fcee['name']){delete _0x39fcee[_0x1686('0x28')];}_0x2cfc48['status'](_0x1d1b5)[_0x1686('0x29')](_0x39fcee);};}exports[_0x1686('0x2a')]=function(_0x1edeeb,_0x3c7717){var _0x1a6955={},_0x1f2d22={},_0x207c03={'count':0x0,'rows':[]};var _0x18aa18=_[_0x1686('0x2b')](db[_0x1686('0x2c')][_0x1686('0x2d')],function(_0xd568b8){return{'name':_0xd568b8[_0x1686('0x2e')],'type':_0xd568b8['type'][_0x1686('0x2f')]};});_0x1f2d22[_0x1686('0x30')]=_['map'](_0x18aa18,_0x1686('0x28'));_0x1f2d22['query']=_[_0x1686('0x31')](_0x1edeeb[_0x1686('0x32')]);_0x1f2d22[_0x1686('0x33')]=_['intersection'](_0x1f2d22[_0x1686('0x30')],_0x1f2d22[_0x1686('0x32')]);_0x1a6955[_0x1686('0x34')]=_[_0x1686('0x35')](_0x1f2d22[_0x1686('0x30')],qs['fields'](_0x1edeeb['query'][_0x1686('0x36')]));_0x1a6955[_0x1686('0x34')]=_0x1a6955['attributes'][_0x1686('0x37')]?_0x1a6955['attributes']:_0x1f2d22['model'];if(!_0x1edeeb[_0x1686('0x32')][_0x1686('0x38')](_0x1686('0x39'))){_0x1a6955[_0x1686('0x20')]=qs[_0x1686('0x20')](_0x1edeeb[_0x1686('0x32')][_0x1686('0x20')]);_0x1a6955[_0x1686('0x3a')]=qs[_0x1686('0x3a')](_0x1edeeb[_0x1686('0x32')]['offset']);}_0x1a6955[_0x1686('0x3b')]=qs[_0x1686('0x3c')](_0x1edeeb[_0x1686('0x32')]['sort']);_0x1a6955[_0x1686('0x3d')]=qs[_0x1686('0x33')](_[_0x1686('0x3e')](_0x1edeeb[_0x1686('0x32')],_0x1f2d22['filters']),_0x18aa18);if(_0x1edeeb[_0x1686('0x32')][_0x1686('0x3f')]){_0x1a6955[_0x1686('0x3d')]=_[_0x1686('0x40')](_0x1a6955['where'],{'$or':_['map'](_0x18aa18,function(_0x58b0fb){if(_0x58b0fb['type']!==_0x1686('0x41')){var _0x5a612b={};_0x5a612b[_0x58b0fb[_0x1686('0x28')]]={'$like':'%'+_0x1edeeb[_0x1686('0x32')][_0x1686('0x3f')]+'%'};return _0x5a612b;}})});}_0x1a6955=_[_0x1686('0x40')]({},_0x1a6955,_0x1edeeb[_0x1686('0x42')]);var _0x51d15d={'where':_0x1a6955[_0x1686('0x3d')]};return db['IntegrationReport'][_0x1686('0x1f')](_0x51d15d)[_0x1686('0x25')](function(_0x40e1a0){_0x207c03['count']=_0x40e1a0;if(_0x1edeeb['query']['includeAll']){_0x1a6955['include']=[{'all':!![]}];}return db[_0x1686('0x2c')]['findAll'](_0x1a6955);})[_0x1686('0x25')](function(_0x3dce43){_0x207c03[_0x1686('0x43')]=_0x3dce43;return _0x207c03;})[_0x1686('0x25')](respondWithFilteredResult(_0x3c7717,_0x1a6955))[_0x1686('0x44')](handleError(_0x3c7717,null));};exports['show']=function(_0x32c7a6,_0x26988b){var _0x2e15ab={'raw':![],'where':{'id':_0x32c7a6['params']['id']}},_0x25419d={};_0x25419d[_0x1686('0x30')]=_[_0x1686('0x31')](db[_0x1686('0x2c')][_0x1686('0x2d')]);_0x25419d['query']=_[_0x1686('0x31')](_0x32c7a6[_0x1686('0x32')]);_0x25419d[_0x1686('0x33')]=_[_0x1686('0x35')](_0x25419d[_0x1686('0x30')],_0x25419d['query']);_0x2e15ab[_0x1686('0x34')]=_[_0x1686('0x35')](_0x25419d[_0x1686('0x30')],qs[_0x1686('0x36')](_0x32c7a6[_0x1686('0x32')][_0x1686('0x36')]));_0x2e15ab['attributes']=_0x2e15ab[_0x1686('0x34')][_0x1686('0x37')]?_0x2e15ab['attributes']:_0x25419d[_0x1686('0x30')];if(_0x32c7a6[_0x1686('0x32')]['includeAll']){_0x2e15ab[_0x1686('0x45')]=[{'all':!![]}];}_0x2e15ab=_['merge']({},_0x2e15ab,_0x32c7a6[_0x1686('0x42')]);return db[_0x1686('0x2c')][_0x1686('0x46')](_0x2e15ab)[_0x1686('0x25')](handleEntityNotFound(_0x26988b,null))[_0x1686('0x25')](respondWithResult(_0x26988b,null))[_0x1686('0x44')](handleError(_0x26988b,null));};exports[_0x1686('0x47')]=function(_0x184199,_0x35c5c5){return db['IntegrationReport']['create'](_0x184199[_0x1686('0x48')],{})[_0x1686('0x25')](respondWithResult(_0x35c5c5,0xc9))[_0x1686('0x44')](handleError(_0x35c5c5,null));};exports['update']=function(_0x1db244,_0x3d246f){if(_0x1db244[_0x1686('0x48')]['id']){delete _0x1db244[_0x1686('0x48')]['id'];}return db[_0x1686('0x2c')]['find']({'where':{'id':_0x1db244[_0x1686('0x49')]['id']}})[_0x1686('0x25')](handleEntityNotFound(_0x3d246f,null))['then'](saveUpdates(_0x1db244[_0x1686('0x48')],null))[_0x1686('0x25')](respondWithResult(_0x3d246f,null))[_0x1686('0x44')](handleError(_0x3d246f,null));};exports[_0x1686('0x26')]=function(_0x2a5297,_0x14a231){return db[_0x1686('0x2c')][_0x1686('0x46')]({'where':{'id':_0x2a5297[_0x1686('0x49')]['id']}})[_0x1686('0x25')](handleEntityNotFound(_0x14a231,null))[_0x1686('0x25')](removeEntity(_0x14a231,null))[_0x1686('0x44')](handleError(_0x14a231,null));};exports[_0x1686('0x4a')]=function(_0x24c3f0,_0x131136){return db[_0x1686('0x2c')][_0x1686('0x4a')]()[_0x1686('0x25')](respondWithResult(_0x131136,null))['catch'](handleError(_0x131136,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index fd6ba24..49579eb 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 _0x4a24=['moment','bluebird','request-promise','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','../../config/logger'];(function(_0x5efcb0,_0x1cce28){var _0x2a986c=function(_0x2c4242){while(--_0x2c4242){_0x5efcb0['push'](_0x5efcb0['shift']());}};_0x2a986c(++_0x1cce28);}(_0x4a24,0x1e2));var _0x44a2=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x4a24[_0x45c981];return _0x4f62c8;};'use strict';var _=require('lodash');var util=require(_0x44a2('0x0'));var logger=require(_0x44a2('0x1'))('api');var moment=require(_0x44a2('0x2'));var BPromise=require(_0x44a2('0x3'));var rp=require(_0x44a2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44a2('0x5'));var config=require('../../config/environment');var attributes=require(_0x44a2('0x6'));module[_0x44a2('0x7')]=function(_0x1a5595,_0x434e3a){return _0x1a5595[_0x44a2('0x8')](_0x44a2('0x9'),attributes,{'tableName':_0x44a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x058c=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util'];(function(_0x2c736b,_0x389495){var _0x4a2474=function(_0x247b56){while(--_0x247b56){_0x2c736b['push'](_0x2c736b['shift']());}};_0x4a2474(++_0x389495);}(_0x058c,0xcb));var _0xc058=function(_0x4ddc09,_0x23c3f2){_0x4ddc09=_0x4ddc09-0x0;var _0x254749=_0x058c[_0x4ddc09];return _0x254749;};'use strict';var _=require('lodash');var util=require(_0xc058('0x0'));var logger=require(_0xc058('0x1'))(_0xc058('0x2'));var moment=require(_0xc058('0x3'));var BPromise=require('bluebird');var rp=require(_0xc058('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc058('0x5'));var config=require(_0xc058('0x6'));var attributes=require(_0xc058('0x7'));module[_0xc058('0x8')]=function(_0x292af7,_0xde10f1){return _0x292af7[_0xc058('0x9')](_0xc058('0xa'),attributes,{'tableName':_0xc058('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 e519e42..a017362 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 _0xbaf0=['client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_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 moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x549278,_0x450754){var _0x1ea9a1=function(_0x2e559d){while(--_0x2e559d){_0x549278['push'](_0x549278['shift']());}};_0x1ea9a1(++_0x450754);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 38d5142..de18c8f 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 _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x55ca,0x126));var _0xa55c=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x55ca[_0x52e68e];return _0x3211a4;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ef74b,_0x3c96dc){var _0x54e32e=function(_0xb8e456){while(--_0xb8e456){_0x2ef74b['push'](_0x2ef74b['shift']());}};_0x54e32e(++_0x3c96dc);}(_0x34e8,0x12c));var _0x834e=function(_0x21e3bc,_0x35b63b){_0x21e3bc=_0x21e3bc-0x0;var _0x3834bd=_0x34e8[_0x21e3bc];return _0x3834bd;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 53eaba3..b7a26aa 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 _0xaea0=['sequelize','STRING'];(function(_0x45b6d8,_0x21e5b3){var _0x12ac61=function(_0x5af51e){while(--_0x5af51e){_0x45b6d8['push'](_0x45b6d8['shift']());}};_0x12ac61(++_0x21e5b3);}(_0xaea0,0x114));var _0x0aea=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xaea0[_0x269ee8];return _0x4d98bd;};'use strict';var Sequelize=require(_0x0aea('0x0'));module['exports']={'name':{'type':Sequelize[_0x0aea('0x1')]},'description':{'type':Sequelize[_0x0aea('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xe437=['STRING','sequelize','exports'];(function(_0x2555da,_0x36a18b){var _0x33207c=function(_0x176c1a){while(--_0x176c1a){_0x2555da['push'](_0x2555da['shift']());}};_0x33207c(++_0x36a18b);}(_0xe437,0x88));var _0x7e43=function(_0x134c44,_0x3775fb){_0x134c44=_0x134c44-0x0;var _0xb2964f=_0xe437[_0x134c44];return _0xb2964f;};'use strict';var Sequelize=require(_0x7e43('0x0'));module[_0x7e43('0x1')]={'name':{'type':Sequelize[_0x7e43('0x2')]},'description':{'type':Sequelize[_0x7e43('0x2')]},'interval':{'type':Sequelize[_0x7e43('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 1e16d5f..3d82e3f 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 _0xa327=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','Intervals','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','Interval','findAll','rows','show','params','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','transaction','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa327,0x9e));var _0x7a32=function(_0x241551,_0x3aae2d){_0x241551=_0x241551-0x0;var _0x4315af=_0xa327[_0x241551];return _0x4315af;};'use strict';var pdf=require(_0x7a32('0x0'));var emlformat=require(_0x7a32('0x1'));var rimraf=require(_0x7a32('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a32('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7a32('0x4'));var Mustache=require(_0x7a32('0x5'));var util=require(_0x7a32('0x6'));var path=require('path');var sox=require(_0x7a32('0x7'));var csv=require(_0x7a32('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a32('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a32('0xa'));var deskjs=require(_0x7a32('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7a32('0xc'));var Redis=require(_0x7a32('0xd'));var authService=require(_0x7a32('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7a32('0xf'));var hardwareService=require(_0x7a32('0x10'));var logger=require(_0x7a32('0x11'))(_0x7a32('0x12'));var utils=require(_0x7a32('0x13'));var config=require(_0x7a32('0x14'));var db=require(_0x7a32('0x15'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xdc7764,_0x34a9df){_0x34a9df=_0x34a9df||0xcc;return function(_0x59a3b9){if(_0x59a3b9){return _0xdc7764['sendStatus'](_0x34a9df);}return _0xdc7764[_0x7a32('0x16')](_0x34a9df)[_0x7a32('0x17')]();};}function respondWithResult(_0x580bfd,_0x5e16f3){_0x5e16f3=_0x5e16f3||0xc8;return function(_0x5e4b7a){if(_0x5e4b7a){return _0x580bfd['status'](_0x5e16f3)['json'](_0x5e4b7a);}};}function respondWithFilteredResult(_0x3f20fa,_0x45146d){return function(_0x1ec9b6){if(_0x1ec9b6){var _0x1a5fa8=_0x1ec9b6[_0x7a32('0x18')],_0x5ab660=_0x45146d[_0x7a32('0x19')],_0x2afb16=_0x45146d['offset']+_0x45146d[_0x7a32('0x1a')],_0x1c09db;if(_0x2afb16>=_0x1a5fa8){_0x2afb16=_0x1a5fa8;_0x1c09db=0xc8;}else{_0x1c09db=0xce;}_0x3f20fa[_0x7a32('0x16')](_0x1c09db);return _0x3f20fa[_0x7a32('0x1b')](_0x7a32('0x1c'),_0x5ab660+'-'+_0x2afb16+'/'+_0x1a5fa8)[_0x7a32('0x1d')](_0x1ec9b6);}return null;};}function patchUpdates(_0x31ab84){return function(_0x4ff562){try{jsonpatch['apply'](_0x4ff562,_0x31ab84,!![]);}catch(_0x2eaab1){return BPromise[_0x7a32('0x1e')](_0x2eaab1);}return _0x4ff562[_0x7a32('0x1f')]();};}function saveUpdates(_0x369b48,_0x56d814){return function(_0x4d62e2){if(_0x4d62e2){return _0x4d62e2[_0x7a32('0x20')](_0x369b48)[_0x7a32('0x21')](function(_0x3f3378){return _0x3f3378;});}return null;};}function removeEntity(_0x59a267,_0x485b58){return function(_0x118514){if(_0x118514){return _0x118514['destroy']()[_0x7a32('0x21')](function(){var _0x5c9d9d=_0x118514['get']({'plain':!![]});var _0x4d801b=_0x7a32('0x22');return db['UserProfileResource'][_0x7a32('0x23')]({'where':{'type':_0x4d801b,'resourceId':_0x5c9d9d['id']}})[_0x7a32('0x21')](function(){return _0x118514;});})[_0x7a32('0x21')](function(){_0x59a267[_0x7a32('0x16')](0xcc)[_0x7a32('0x17')]();});}};}function handleEntityNotFound(_0xc1e3bf,_0x3aec2b){return function(_0x6c0547){if(!_0x6c0547){_0xc1e3bf[_0x7a32('0x24')](0x194);}return _0x6c0547;};}function handleError(_0x46c1b8,_0x2b15fb){_0x2b15fb=_0x2b15fb||0x1f4;return function(_0x30734f){logger[_0x7a32('0x25')](_0x30734f['stack']);if(_0x30734f[_0x7a32('0x26')]){delete _0x30734f[_0x7a32('0x26')];}_0x46c1b8[_0x7a32('0x16')](_0x2b15fb)[_0x7a32('0x27')](_0x30734f);};}exports[_0x7a32('0x28')]=function(_0x484e80,_0xde187){var _0x55d82c={},_0x57dc84={},_0x181349={'count':0x0,'rows':[]};var _0x5856b4=_[_0x7a32('0x29')](db['Interval'][_0x7a32('0x2a')],function(_0x585b07){return{'name':_0x585b07[_0x7a32('0x2b')],'type':_0x585b07[_0x7a32('0x2c')][_0x7a32('0x2d')]};});_0x57dc84['model']=_[_0x7a32('0x29')](_0x5856b4,_0x7a32('0x26'));_0x57dc84[_0x7a32('0x2e')]=_[_0x7a32('0x2f')](_0x484e80[_0x7a32('0x2e')]);_0x57dc84['filters']=_[_0x7a32('0x30')](_0x57dc84[_0x7a32('0x31')],_0x57dc84[_0x7a32('0x2e')]);_0x55d82c['attributes']=_[_0x7a32('0x30')](_0x57dc84[_0x7a32('0x31')],qs[_0x7a32('0x32')](_0x484e80[_0x7a32('0x2e')]['fields']));_0x55d82c[_0x7a32('0x33')]=_0x55d82c[_0x7a32('0x33')][_0x7a32('0x34')]?_0x55d82c[_0x7a32('0x33')]:_0x57dc84[_0x7a32('0x31')];if(!_0x484e80[_0x7a32('0x2e')][_0x7a32('0x35')]('nolimit')){_0x55d82c[_0x7a32('0x1a')]=qs[_0x7a32('0x1a')](_0x484e80[_0x7a32('0x2e')][_0x7a32('0x1a')]);_0x55d82c['offset']=qs['offset'](_0x484e80[_0x7a32('0x2e')][_0x7a32('0x19')]);}_0x55d82c[_0x7a32('0x36')]=qs[_0x7a32('0x37')](_0x484e80[_0x7a32('0x2e')][_0x7a32('0x37')]);_0x55d82c[_0x7a32('0x38')]=qs[_0x7a32('0x39')](_[_0x7a32('0x3a')](_0x484e80[_0x7a32('0x2e')],_0x57dc84[_0x7a32('0x39')]),_0x5856b4);if(_0x484e80[_0x7a32('0x2e')]['filter']){_0x55d82c['where']=_['merge'](_0x55d82c[_0x7a32('0x38')],{'$or':_['map'](_0x5856b4,function(_0x513318){if(_0x513318[_0x7a32('0x2c')]!==_0x7a32('0x3b')){var _0x20cec7={};_0x20cec7[_0x513318[_0x7a32('0x26')]]={'$like':'%'+_0x484e80[_0x7a32('0x2e')][_0x7a32('0x3c')]+'%'};return _0x20cec7;}})});}_0x55d82c=_[_0x7a32('0x3d')]({},_0x55d82c,_0x484e80[_0x7a32('0x3e')]);var _0x276828={'where':_0x55d82c[_0x7a32('0x38')]};return db['Interval'][_0x7a32('0x18')](_0x276828)[_0x7a32('0x21')](function(_0x2a499e){_0x181349[_0x7a32('0x18')]=_0x2a499e;if(_0x484e80[_0x7a32('0x2e')]['includeAll']){_0x55d82c[_0x7a32('0x3f')]=[{'all':!![]}];}return db[_0x7a32('0x40')][_0x7a32('0x41')](_0x55d82c);})[_0x7a32('0x21')](function(_0x4d1242){_0x181349[_0x7a32('0x42')]=_0x4d1242;return _0x181349;})[_0x7a32('0x21')](respondWithFilteredResult(_0xde187,_0x55d82c))['catch'](handleError(_0xde187,null));};exports[_0x7a32('0x43')]=function(_0x532bee,_0x4de133){var _0x3dc108={'raw':!![],'where':{'id':_0x532bee[_0x7a32('0x44')]['id']}},_0x258630={};_0x258630[_0x7a32('0x31')]=_[_0x7a32('0x2f')](db['Interval'][_0x7a32('0x2a')]);_0x258630[_0x7a32('0x2e')]=_[_0x7a32('0x2f')](_0x532bee[_0x7a32('0x2e')]);_0x258630['filters']=_['intersection'](_0x258630[_0x7a32('0x31')],_0x258630['query']);_0x3dc108[_0x7a32('0x33')]=_[_0x7a32('0x30')](_0x258630['model'],qs[_0x7a32('0x32')](_0x532bee['query']['fields']));_0x3dc108[_0x7a32('0x33')]=_0x3dc108[_0x7a32('0x33')]['length']?_0x3dc108[_0x7a32('0x33')]:_0x258630[_0x7a32('0x31')];if(_0x532bee[_0x7a32('0x2e')]['includeAll']){_0x3dc108[_0x7a32('0x3f')]=[{'all':!![]}];}_0x3dc108=_[_0x7a32('0x3d')]({},_0x3dc108,_0x532bee[_0x7a32('0x3e')]);return db[_0x7a32('0x40')]['find'](_0x3dc108)['then'](handleEntityNotFound(_0x4de133,null))[_0x7a32('0x21')](respondWithResult(_0x4de133,null))[_0x7a32('0x45')](handleError(_0x4de133,null));};exports[_0x7a32('0x46')]=function(_0x11f8f5,_0xf508e4){return db[_0x7a32('0x40')][_0x7a32('0x46')](_0x11f8f5[_0x7a32('0x47')],{})[_0x7a32('0x21')](function(_0xd3f9ff){var _0x4ef38c=_0x11f8f5[_0x7a32('0x48')][_0x7a32('0x49')]({'plain':!![]});if(!_0x4ef38c)throw new Error(_0x7a32('0x4a'));if(_0x4ef38c['role']===_0x7a32('0x48')){var _0x56326e=_0xd3f9ff[_0x7a32('0x49')]({'plain':!![]});var _0x2a5a30=_0x7a32('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x2a5a30,'userProfileId':_0x4ef38c['userProfileId']},'raw':!![]})[_0x7a32('0x21')](function(_0x3e69ac){if(_0x3e69ac&&_0x3e69ac[_0x7a32('0x4b')]===0x0){return db[_0x7a32('0x4c')]['create']({'name':_0x56326e[_0x7a32('0x26')],'resourceId':_0x56326e['id'],'type':_0x3e69ac[_0x7a32('0x26')],'sectionId':_0x3e69ac['id']},{})[_0x7a32('0x21')](function(){return _0xd3f9ff;});}else{return _0xd3f9ff;}})[_0x7a32('0x45')](function(_0xe594bf){logger['error'](_0x7a32('0x4d'),_0xe594bf);throw _0xe594bf;});}return _0xd3f9ff;})['then'](respondWithResult(_0xf508e4,0xc9))[_0x7a32('0x45')](handleError(_0xf508e4,null));};exports[_0x7a32('0x20')]=function(_0x2aa870,_0x5275fd){if(_0x2aa870[_0x7a32('0x47')]['id']){delete _0x2aa870[_0x7a32('0x47')]['id'];}return db['Interval'][_0x7a32('0x4e')]({'where':{'id':_0x2aa870[_0x7a32('0x44')]['id']}})[_0x7a32('0x21')](handleEntityNotFound(_0x5275fd,null))[_0x7a32('0x21')](saveUpdates(_0x2aa870[_0x7a32('0x47')],null))[_0x7a32('0x21')](respondWithResult(_0x5275fd,null))[_0x7a32('0x45')](handleError(_0x5275fd,null));};exports[_0x7a32('0x23')]=function(_0x1e5a89,_0x1c4b05){return db[_0x7a32('0x40')][_0x7a32('0x4e')]({'where':{'id':_0x1e5a89[_0x7a32('0x44')]['id']}})[_0x7a32('0x21')](handleEntityNotFound(_0x1c4b05,null))['then'](removeEntity(_0x1c4b05,null))[_0x7a32('0x45')](handleError(_0x1c4b05,null));};exports[_0x7a32('0x4f')]=function(_0x1a4c81,_0x2fa5de,_0x287fc3){if(_0x1a4c81[_0x7a32('0x47')]['id']){delete _0x1a4c81[_0x7a32('0x47')]['id'];}return db[_0x7a32('0x40')][_0x7a32('0x4e')]({'where':{'id':_0x1a4c81[_0x7a32('0x44')]['id']}})[_0x7a32('0x21')](handleEntityNotFound(_0x2fa5de,null))['then'](function(_0x4176e8){if(_0x4176e8){_0x1a4c81[_0x7a32('0x47')][_0x7a32('0x50')]=_0x4176e8['id'];return db[_0x7a32('0x40')][_0x7a32('0x46')](_0x1a4c81[_0x7a32('0x47')]);}})[_0x7a32('0x21')](respondWithResult(_0x2fa5de,null))[_0x7a32('0x45')](handleError(_0x2fa5de,null));};exports[_0x7a32('0x51')]=function(_0xbc60d8,_0x2829d3,_0x3cd182){var _0x251ccd={};var _0x337315={};var _0x30eeb4;var _0x263265;return db['Interval'][_0x7a32('0x52')]({'where':{'id':_0xbc60d8[_0x7a32('0x44')]['id']}})[_0x7a32('0x21')](handleEntityNotFound(_0x2829d3,null))[_0x7a32('0x21')](function(_0x50d619){if(_0x50d619){_0x30eeb4=_0x50d619;_0x337315['model']=_['keys'](db['Interval'][_0x7a32('0x2a')]);_0x337315['query']=_[_0x7a32('0x2f')](_0xbc60d8[_0x7a32('0x2e')]);_0x337315[_0x7a32('0x39')]=_[_0x7a32('0x30')](_0x337315[_0x7a32('0x31')],_0x337315['query']);_0x251ccd[_0x7a32('0x33')]=_[_0x7a32('0x30')](_0x337315[_0x7a32('0x31')],qs[_0x7a32('0x32')](_0xbc60d8[_0x7a32('0x2e')][_0x7a32('0x32')]));_0x251ccd[_0x7a32('0x33')]=_0x251ccd[_0x7a32('0x33')][_0x7a32('0x34')]?_0x251ccd[_0x7a32('0x33')]:_0x337315['model'];_0x251ccd[_0x7a32('0x36')]=qs['sort'](_0xbc60d8['query'][_0x7a32('0x37')]);_0x251ccd[_0x7a32('0x38')]=qs[_0x7a32('0x39')](_[_0x7a32('0x3a')](_0xbc60d8[_0x7a32('0x2e')],_0x337315[_0x7a32('0x39')]));if(_0xbc60d8['query']['filter']){_0x251ccd[_0x7a32('0x38')]=_[_0x7a32('0x3d')](_0x251ccd[_0x7a32('0x38')],{'$or':_[_0x7a32('0x29')](_0x251ccd[_0x7a32('0x33')],function(_0x58934b){var _0x202478={};_0x202478[_0x58934b]={'$like':'%'+_0xbc60d8[_0x7a32('0x2e')][_0x7a32('0x3c')]+'%'};return _0x202478;})});}_0x251ccd=_['merge']({},_0x251ccd,_0xbc60d8[_0x7a32('0x3e')]);return _0x30eeb4[_0x7a32('0x51')](_0x251ccd);}})['then'](function(_0x4af235){if(_0x4af235){_0x263265=_0x4af235[_0x7a32('0x34')];if(!_0xbc60d8[_0x7a32('0x2e')][_0x7a32('0x35')](_0x7a32('0x53'))){_0x251ccd['limit']=qs['limit'](_0xbc60d8[_0x7a32('0x2e')][_0x7a32('0x1a')]);_0x251ccd[_0x7a32('0x19')]=qs[_0x7a32('0x19')](_0xbc60d8[_0x7a32('0x2e')][_0x7a32('0x19')]);}return _0x30eeb4[_0x7a32('0x51')](_0x251ccd);}})[_0x7a32('0x21')](function(_0x2129ab){if(_0x2129ab){return _0x2129ab?{'count':_0x263265,'rows':_0x2129ab}:null;}})['then'](respondWithResult(_0x2829d3,null))[_0x7a32('0x45')](handleError(_0x2829d3,null));};exports[_0x7a32('0x54')]=function(_0x506312,_0x410c94,_0x1a5dac){return db[_0x7a32('0x40')][_0x7a32('0x52')]({'where':{'id':_0x506312[_0x7a32('0x44')]['id']}})['then'](handleEntityNotFound(_0x410c94,null))[_0x7a32('0x21')](function(_0x4ce35e){if(_0x4ce35e){return db['sequelize'][_0x7a32('0x55')](function(_0xe312af){return db[_0x7a32('0x40')][_0x7a32('0x23')]({'where':{'IntervalId':_0x506312[_0x7a32('0x44')]['id']},'transaction':_0xe312af})[_0x7a32('0x21')](function(_0xabf141){var _0x593de9=_['map'](_0x506312[_0x7a32('0x47')],function(_0x27ece8){delete _0x27ece8['id'];_0x27ece8[_0x7a32('0x50')]=_0x506312['params']['id'];return _0x27ece8;});return db[_0x7a32('0x40')][_0x7a32('0x56')](_0x593de9,{'transaction':_0xe312af});});})['then'](function(){return db[_0x7a32('0x40')][_0x7a32('0x41')]({'where':{'IntervalId':_0x506312[_0x7a32('0x44')]['id']}});});}})['then'](respondWithResult(_0x410c94,null))[_0x7a32('0x45')](handleError(_0x410c94,null));}; \ No newline at end of file +var _0x2e43=['IntervalId','getIntervals','addIntervals','findOne','transaction','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','UserProfileResource','end','error','name','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x2e43,0x15e));var _0x32e4=function(_0x5ee955,_0x554f71){_0x5ee955=_0x5ee955-0x0;var _0x54a8da=_0x2e43[_0x5ee955];return _0x54a8da;};'use strict';var pdf=require(_0x32e4('0x0'));var emlformat=require(_0x32e4('0x1'));var rimraf=require(_0x32e4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x32e4('0x3'));var rp=require('request-promise');var moment=require(_0x32e4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x32e4('0x5'));var util=require(_0x32e4('0x6'));var path=require(_0x32e4('0x7'));var sox=require(_0x32e4('0x8'));var csv=require(_0x32e4('0x9'));var ejs=require(_0x32e4('0xa'));var fs=require('fs');var _=require(_0x32e4('0xb'));var squel=require('squel');var crypto=require(_0x32e4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x32e4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x32e4('0xe'));var Papa=require(_0x32e4('0xf'));var Redis=require(_0x32e4('0x10'));var authService=require(_0x32e4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32e4('0x12'));var logger=require(_0x32e4('0x13'))(_0x32e4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x32e4('0x15'))['db'];var extensions=require(_0x32e4('0x16'));function respondWithStatusCode(_0x2179fa,_0x341d13){_0x341d13=_0x341d13||0xcc;return function(_0x27bca){if(_0x27bca){return _0x2179fa[_0x32e4('0x17')](_0x341d13);}return _0x2179fa[_0x32e4('0x18')](_0x341d13)['end']();};}function respondWithResult(_0x1f5616,_0x413605){_0x413605=_0x413605||0xc8;return function(_0x22dfe0){if(_0x22dfe0){return _0x1f5616[_0x32e4('0x18')](_0x413605)[_0x32e4('0x19')](_0x22dfe0);}};}function respondWithFilteredResult(_0x30d569,_0x5c7759){return function(_0x11a6f3){if(_0x11a6f3){var _0x3158e2=_0x11a6f3[_0x32e4('0x1a')],_0x551285=_0x5c7759[_0x32e4('0x1b')],_0x4a9e17=_0x5c7759['offset']+_0x5c7759[_0x32e4('0x1c')],_0x50e4f2;if(_0x4a9e17>=_0x3158e2){_0x4a9e17=_0x3158e2;_0x50e4f2=0xc8;}else{_0x50e4f2=0xce;}_0x30d569['status'](_0x50e4f2);return _0x30d569[_0x32e4('0x1d')]('Content-Range',_0x551285+'-'+_0x4a9e17+'/'+_0x3158e2)[_0x32e4('0x19')](_0x11a6f3);}return null;};}function patchUpdates(_0x6713a2){return function(_0x30d880){try{jsonpatch[_0x32e4('0x1e')](_0x30d880,_0x6713a2,!![]);}catch(_0xf34c69){return BPromise[_0x32e4('0x1f')](_0xf34c69);}return _0x30d880[_0x32e4('0x20')]();};}function saveUpdates(_0xead2b5,_0x19ad1b){return function(_0x4fa3a5){if(_0x4fa3a5){return _0x4fa3a5[_0x32e4('0x21')](_0xead2b5)['then'](function(_0x582aba){return _0x582aba;});}return null;};}function removeEntity(_0x393ebd,_0x2070e6){return function(_0x154fd0){if(_0x154fd0){return _0x154fd0[_0x32e4('0x22')]()[_0x32e4('0x23')](function(){var _0x2ba7a0=_0x154fd0['get']({'plain':!![]});var _0x3f5e24='Intervals';return db[_0x32e4('0x24')]['destroy']({'where':{'type':_0x3f5e24,'resourceId':_0x2ba7a0['id']}})[_0x32e4('0x23')](function(){return _0x154fd0;});})[_0x32e4('0x23')](function(){_0x393ebd[_0x32e4('0x18')](0xcc)[_0x32e4('0x25')]();});}};}function handleEntityNotFound(_0x4ffd88,_0x15fe20){return function(_0x17cf0f){if(!_0x17cf0f){_0x4ffd88['sendStatus'](0x194);}return _0x17cf0f;};}function handleError(_0x173b7e,_0x52b963){_0x52b963=_0x52b963||0x1f4;return function(_0x4342fa){logger[_0x32e4('0x26')](_0x4342fa['stack']);if(_0x4342fa[_0x32e4('0x27')]){delete _0x4342fa[_0x32e4('0x27')];}_0x173b7e['status'](_0x52b963)['send'](_0x4342fa);};}exports[_0x32e4('0x28')]=function(_0xfda6da,_0xf99b66){var _0x589108={},_0x3d1412={},_0x4a4a96={'count':0x0,'rows':[]};var _0x379857=_[_0x32e4('0x29')](db[_0x32e4('0x2a')][_0x32e4('0x2b')],function(_0x38fc7c){return{'name':_0x38fc7c[_0x32e4('0x2c')],'type':_0x38fc7c[_0x32e4('0x2d')]['key']};});_0x3d1412[_0x32e4('0x2e')]=_[_0x32e4('0x29')](_0x379857,_0x32e4('0x27'));_0x3d1412[_0x32e4('0x2f')]=_[_0x32e4('0x30')](_0xfda6da[_0x32e4('0x2f')]);_0x3d1412[_0x32e4('0x31')]=_[_0x32e4('0x32')](_0x3d1412[_0x32e4('0x2e')],_0x3d1412['query']);_0x589108['attributes']=_[_0x32e4('0x32')](_0x3d1412[_0x32e4('0x2e')],qs[_0x32e4('0x33')](_0xfda6da[_0x32e4('0x2f')][_0x32e4('0x33')]));_0x589108[_0x32e4('0x34')]=_0x589108[_0x32e4('0x34')][_0x32e4('0x35')]?_0x589108['attributes']:_0x3d1412[_0x32e4('0x2e')];if(!_0xfda6da['query'][_0x32e4('0x36')](_0x32e4('0x37'))){_0x589108[_0x32e4('0x1c')]=qs['limit'](_0xfda6da[_0x32e4('0x2f')]['limit']);_0x589108['offset']=qs['offset'](_0xfda6da[_0x32e4('0x2f')][_0x32e4('0x1b')]);}_0x589108[_0x32e4('0x38')]=qs[_0x32e4('0x39')](_0xfda6da[_0x32e4('0x2f')]['sort']);_0x589108[_0x32e4('0x3a')]=qs['filters'](_[_0x32e4('0x3b')](_0xfda6da[_0x32e4('0x2f')],_0x3d1412[_0x32e4('0x31')]),_0x379857);if(_0xfda6da[_0x32e4('0x2f')][_0x32e4('0x3c')]){_0x589108[_0x32e4('0x3a')]=_['merge'](_0x589108[_0x32e4('0x3a')],{'$or':_['map'](_0x379857,function(_0x58a3da){if(_0x58a3da['type']!==_0x32e4('0x3d')){var _0x51abc7={};_0x51abc7[_0x58a3da['name']]={'$like':'%'+_0xfda6da[_0x32e4('0x2f')][_0x32e4('0x3c')]+'%'};return _0x51abc7;}})});}_0x589108=_['merge']({},_0x589108,_0xfda6da[_0x32e4('0x3e')]);var _0xeda73e={'where':_0x589108['where']};return db[_0x32e4('0x2a')]['count'](_0xeda73e)['then'](function(_0x5a4eba){_0x4a4a96[_0x32e4('0x1a')]=_0x5a4eba;if(_0xfda6da[_0x32e4('0x2f')][_0x32e4('0x3f')]){_0x589108[_0x32e4('0x40')]=[{'all':!![]}];}return db[_0x32e4('0x2a')][_0x32e4('0x41')](_0x589108);})[_0x32e4('0x23')](function(_0x415faf){_0x4a4a96['rows']=_0x415faf;return _0x4a4a96;})['then'](respondWithFilteredResult(_0xf99b66,_0x589108))[_0x32e4('0x42')](handleError(_0xf99b66,null));};exports[_0x32e4('0x43')]=function(_0x40134e,_0x4ad1e7){var _0x291816={'raw':!![],'where':{'id':_0x40134e[_0x32e4('0x44')]['id']}},_0x169b68={};_0x169b68['model']=_['keys'](db[_0x32e4('0x2a')][_0x32e4('0x2b')]);_0x169b68[_0x32e4('0x2f')]=_[_0x32e4('0x30')](_0x40134e[_0x32e4('0x2f')]);_0x169b68[_0x32e4('0x31')]=_['intersection'](_0x169b68[_0x32e4('0x2e')],_0x169b68[_0x32e4('0x2f')]);_0x291816[_0x32e4('0x34')]=_[_0x32e4('0x32')](_0x169b68[_0x32e4('0x2e')],qs[_0x32e4('0x33')](_0x40134e[_0x32e4('0x2f')][_0x32e4('0x33')]));_0x291816[_0x32e4('0x34')]=_0x291816['attributes'][_0x32e4('0x35')]?_0x291816[_0x32e4('0x34')]:_0x169b68['model'];if(_0x40134e[_0x32e4('0x2f')][_0x32e4('0x3f')]){_0x291816['include']=[{'all':!![]}];}_0x291816=_[_0x32e4('0x45')]({},_0x291816,_0x40134e[_0x32e4('0x3e')]);return db['Interval']['find'](_0x291816)[_0x32e4('0x23')](handleEntityNotFound(_0x4ad1e7,null))['then'](respondWithResult(_0x4ad1e7,null))[_0x32e4('0x42')](handleError(_0x4ad1e7,null));};exports[_0x32e4('0x46')]=function(_0x591e81,_0x5a50a3){return db['Interval']['create'](_0x591e81[_0x32e4('0x47')],{})[_0x32e4('0x23')](function(_0x5a26bb){var _0x3f9d28=_0x591e81[_0x32e4('0x48')][_0x32e4('0x49')]({'plain':!![]});if(!_0x3f9d28)throw new Error(_0x32e4('0x4a'));if(_0x3f9d28[_0x32e4('0x4b')]===_0x32e4('0x48')){var _0x4b8a11=_0x5a26bb[_0x32e4('0x49')]({'plain':!![]});var _0x213852=_0x32e4('0x4c');return db[_0x32e4('0x4d')][_0x32e4('0x4e')]({'where':{'name':_0x213852,'userProfileId':_0x3f9d28['userProfileId']},'raw':!![]})[_0x32e4('0x23')](function(_0x2aa859){if(_0x2aa859&&_0x2aa859['autoAssociation']===0x0){return db[_0x32e4('0x24')][_0x32e4('0x46')]({'name':_0x4b8a11['name'],'resourceId':_0x4b8a11['id'],'type':_0x2aa859[_0x32e4('0x27')],'sectionId':_0x2aa859['id']},{})[_0x32e4('0x23')](function(){return _0x5a26bb;});}else{return _0x5a26bb;}})[_0x32e4('0x42')](function(_0x1a493d){logger[_0x32e4('0x26')](_0x32e4('0x4f'),_0x1a493d);throw _0x1a493d;});}return _0x5a26bb;})[_0x32e4('0x23')](respondWithResult(_0x5a50a3,0xc9))['catch'](handleError(_0x5a50a3,null));};exports[_0x32e4('0x21')]=function(_0x646e4c,_0x5dd2bb){if(_0x646e4c[_0x32e4('0x47')]['id']){delete _0x646e4c['body']['id'];}return db['Interval'][_0x32e4('0x4e')]({'where':{'id':_0x646e4c[_0x32e4('0x44')]['id']}})['then'](handleEntityNotFound(_0x5dd2bb,null))[_0x32e4('0x23')](saveUpdates(_0x646e4c[_0x32e4('0x47')],null))[_0x32e4('0x23')](respondWithResult(_0x5dd2bb,null))[_0x32e4('0x42')](handleError(_0x5dd2bb,null));};exports[_0x32e4('0x22')]=function(_0x40404f,_0x4c9f1b){return db['Interval'][_0x32e4('0x4e')]({'where':{'id':_0x40404f[_0x32e4('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c9f1b,null))[_0x32e4('0x23')](removeEntity(_0x4c9f1b,null))['catch'](handleError(_0x4c9f1b,null));};exports['addInterval']=function(_0x95cda8,_0xe62676,_0x2896ab){if(_0x95cda8[_0x32e4('0x47')]['id']){delete _0x95cda8[_0x32e4('0x47')]['id'];}return db[_0x32e4('0x2a')]['find']({'where':{'id':_0x95cda8[_0x32e4('0x44')]['id']}})[_0x32e4('0x23')](handleEntityNotFound(_0xe62676,null))[_0x32e4('0x23')](function(_0x2cefbc){if(_0x2cefbc){_0x95cda8[_0x32e4('0x47')][_0x32e4('0x50')]=_0x2cefbc['id'];return db[_0x32e4('0x2a')][_0x32e4('0x46')](_0x95cda8['body']);}})[_0x32e4('0x23')](respondWithResult(_0xe62676,null))[_0x32e4('0x42')](handleError(_0xe62676,null));};exports[_0x32e4('0x51')]=function(_0x1cce27,_0x3b8862,_0x1d4f7f){var _0x458fce={};var _0x4c8dfa={};var _0x1fa102;var _0x4e93c9;return db[_0x32e4('0x2a')]['findOne']({'where':{'id':_0x1cce27[_0x32e4('0x44')]['id']}})[_0x32e4('0x23')](handleEntityNotFound(_0x3b8862,null))[_0x32e4('0x23')](function(_0x34f628){if(_0x34f628){_0x1fa102=_0x34f628;_0x4c8dfa[_0x32e4('0x2e')]=_[_0x32e4('0x30')](db[_0x32e4('0x2a')][_0x32e4('0x2b')]);_0x4c8dfa[_0x32e4('0x2f')]=_[_0x32e4('0x30')](_0x1cce27[_0x32e4('0x2f')]);_0x4c8dfa[_0x32e4('0x31')]=_[_0x32e4('0x32')](_0x4c8dfa[_0x32e4('0x2e')],_0x4c8dfa['query']);_0x458fce['attributes']=_['intersection'](_0x4c8dfa['model'],qs[_0x32e4('0x33')](_0x1cce27[_0x32e4('0x2f')]['fields']));_0x458fce[_0x32e4('0x34')]=_0x458fce[_0x32e4('0x34')][_0x32e4('0x35')]?_0x458fce[_0x32e4('0x34')]:_0x4c8dfa[_0x32e4('0x2e')];_0x458fce[_0x32e4('0x38')]=qs['sort'](_0x1cce27[_0x32e4('0x2f')][_0x32e4('0x39')]);_0x458fce['where']=qs[_0x32e4('0x31')](_[_0x32e4('0x3b')](_0x1cce27[_0x32e4('0x2f')],_0x4c8dfa[_0x32e4('0x31')]));if(_0x1cce27[_0x32e4('0x2f')]['filter']){_0x458fce['where']=_[_0x32e4('0x45')](_0x458fce['where'],{'$or':_[_0x32e4('0x29')](_0x458fce['attributes'],function(_0x421ca6){var _0x268047={};_0x268047[_0x421ca6]={'$like':'%'+_0x1cce27[_0x32e4('0x2f')][_0x32e4('0x3c')]+'%'};return _0x268047;})});}_0x458fce=_['merge']({},_0x458fce,_0x1cce27['options']);return _0x1fa102[_0x32e4('0x51')](_0x458fce);}})['then'](function(_0x470792){if(_0x470792){_0x4e93c9=_0x470792['length'];if(!_0x1cce27['query']['hasOwnProperty'](_0x32e4('0x37'))){_0x458fce[_0x32e4('0x1c')]=qs[_0x32e4('0x1c')](_0x1cce27[_0x32e4('0x2f')]['limit']);_0x458fce[_0x32e4('0x1b')]=qs[_0x32e4('0x1b')](_0x1cce27[_0x32e4('0x2f')][_0x32e4('0x1b')]);}return _0x1fa102[_0x32e4('0x51')](_0x458fce);}})[_0x32e4('0x23')](function(_0x5518ad){if(_0x5518ad){return _0x5518ad?{'count':_0x4e93c9,'rows':_0x5518ad}:null;}})[_0x32e4('0x23')](respondWithResult(_0x3b8862,null))[_0x32e4('0x42')](handleError(_0x3b8862,null));};exports[_0x32e4('0x52')]=function(_0x3d5f91,_0x5ab7e9,_0x53a581){return db[_0x32e4('0x2a')][_0x32e4('0x53')]({'where':{'id':_0x3d5f91[_0x32e4('0x44')]['id']}})[_0x32e4('0x23')](handleEntityNotFound(_0x5ab7e9,null))['then'](function(_0x1dabd1){if(_0x1dabd1){return db['sequelize'][_0x32e4('0x54')](function(_0x16d522){return db[_0x32e4('0x2a')]['destroy']({'where':{'IntervalId':_0x3d5f91[_0x32e4('0x44')]['id']},'transaction':_0x16d522})[_0x32e4('0x23')](function(_0x97695a){var _0x58a904=_['map'](_0x3d5f91[_0x32e4('0x47')],function(_0x55b505){delete _0x55b505['id'];_0x55b505[_0x32e4('0x50')]=_0x3d5f91[_0x32e4('0x44')]['id'];return _0x55b505;});return db[_0x32e4('0x2a')][_0x32e4('0x55')](_0x58a904,{'transaction':_0x16d522});});})[_0x32e4('0x23')](function(){return db[_0x32e4('0x2a')][_0x32e4('0x41')]({'where':{'IntervalId':_0x3d5f91[_0x32e4('0x44')]['id']}});});}})[_0x32e4('0x23')](respondWithResult(_0x5ab7e9,null))[_0x32e4('0x42')](handleError(_0x5ab7e9,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index a9b0880..916941b 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 _0x35ba=['exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x4173db,_0x537262){var _0x468b7c=function(_0x44b42c){while(--_0x44b42c){_0x4173db['push'](_0x4173db['shift']());}};_0x468b7c(++_0x537262);}(_0x35ba,0x8c));var _0xa35b=function(_0x4743f8,_0x291e9c){_0x4743f8=_0x4743f8-0x0;var _0x5e9976=_0x35ba[_0x4743f8];return _0x5e9976;};'use strict';var _=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var logger=require(_0xa35b('0x2'))(_0xa35b('0x3'));var moment=require('moment');var BPromise=require(_0xa35b('0x4'));var rp=require(_0xa35b('0x5'));var fs=require('fs');var path=require(_0xa35b('0x6'));var rimraf=require(_0xa35b('0x7'));var config=require(_0xa35b('0x8'));var attributes=require(_0xa35b('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0xa35b('0xa')]=function(_0x5e6bf7,_0x7f0063){return _0x5e6bf7[_0xa35b('0xb')](_0xa35b('0xc'),attributes,{'tableName':_0xa35b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ceb59,_0x5cc20a){extensions[_0xa35b('0xe')](_0x5e6bf7,_0x3ceb59);},'afterBulkCreate':function(_0x24a4cf,_0x15702c,_0x41da0c){_0x41da0c();extensions[_0xa35b('0xe')](_0x5e6bf7,_0x24a4cf[0x0]);},'afterUpdate':function(_0x2a66bc,_0x27f49a){extensions[_0xa35b('0xe')](_0x5e6bf7,_0x2a66bc);},'afterDestroy':function(_0x2065e3,_0x55270b){extensions[_0xa35b('0xe')](_0x5e6bf7,_0x2065e3);}}});}; \ No newline at end of file +var _0x7884=['../../config/environment','../../components/extensions/rewrite','exports','Interval','rewrite','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x362bd4,_0x4550b8){var _0x27585e=function(_0x260fd0){while(--_0x260fd0){_0x362bd4['push'](_0x362bd4['shift']());}};_0x27585e(++_0x4550b8);}(_0x7884,0x10d));var _0x4788=function(_0x332a69,_0x53893){_0x332a69=_0x332a69-0x0;var _0x394cae=_0x7884[_0x332a69];return _0x394cae;};'use strict';var _=require(_0x4788('0x0'));var util=require(_0x4788('0x1'));var logger=require(_0x4788('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4788('0x3'));var rp=require(_0x4788('0x4'));var fs=require('fs');var path=require(_0x4788('0x5'));var rimraf=require(_0x4788('0x6'));var config=require(_0x4788('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0x4788('0x8'));module[_0x4788('0x9')]=function(_0xaf9370,_0x37c182){return _0xaf9370['define'](_0x4788('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xfdc0fc,_0x16df7a){extensions['rewrite'](_0xaf9370,_0xfdc0fc);},'afterBulkCreate':function(_0x1564a0,_0x542e9c,_0x102c4b){_0x102c4b();extensions['rewrite'](_0xaf9370,_0x1564a0[0x0]);},'afterUpdate':function(_0x24ff8b,_0x39da2e){extensions['rewrite'](_0xaf9370,_0x24ff8b);},'afterDestroy':function(_0x5275a1,_0x14b6b2){extensions[_0x4788('0xb')](_0xaf9370,_0x5275a1);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1b6f7d5..8d2e7d1 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 _0x9a21=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Interval,\x20%s,\x20%s','message','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','then','ShowInterval','find','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9a21,0x19c));var _0x19a2=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x9a21[_0x35d3a8];return _0x182378;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x19a2('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19a2('0x1'));var db=require(_0x19a2('0x2'))['db'];var utils=require(_0x19a2('0x3'));var logger=require(_0x19a2('0x4'))(_0x19a2('0x5'));var config=require(_0x19a2('0x6'));var jayson=require(_0x19a2('0x7'));var client=jayson['client'][_0x19a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3461df,_0x98a38,_0x5607dd){return new BPromise(function(_0x3283b9,_0x45e135){return client['request'](_0x3461df,_0x5607dd)['then'](function(_0x6a96e3){logger[_0x19a2('0x9')]('Interval,\x20%s,\x20%s',_0x98a38,'request\x20sent');logger[_0x19a2('0xa')](_0x19a2('0xb'),_0x98a38,_0x19a2('0xc'),JSON[_0x19a2('0xd')](_0x6a96e3));if(_0x6a96e3[_0x19a2('0xe')]){if(_0x6a96e3[_0x19a2('0xe')]['code']===0x1f4){logger['error'](_0x19a2('0xf'),_0x98a38,_0x6a96e3[_0x19a2('0xe')][_0x19a2('0x10')]);return _0x45e135(_0x6a96e3[_0x19a2('0xe')]['message']);}logger[_0x19a2('0xe')]('Interval,\x20%s,\x20%s',_0x98a38,_0x6a96e3['error']['message']);return _0x3283b9(_0x6a96e3[_0x19a2('0xe')][_0x19a2('0x10')]);}else{logger[_0x19a2('0x9')](_0x19a2('0xf'),_0x98a38,_0x19a2('0xc'));_0x3283b9(_0x6a96e3[_0x19a2('0x11')]['message']);}})[_0x19a2('0x12')](function(_0x5f03ba){logger[_0x19a2('0xe')](_0x19a2('0xf'),_0x98a38,_0x5f03ba);_0x45e135(_0x5f03ba);});});}exports[_0x19a2('0x13')]=function(_0x55dd61){var _0x398c3f=this;return new Promise(function(_0x1366b3,_0x2983e3){return db[_0x19a2('0x14')][_0x19a2('0x15')]({'raw':_0x55dd61[_0x19a2('0x16')]?_0x55dd61['options'][_0x19a2('0x17')]===undefined?!![]:![]:!![],'where':_0x55dd61[_0x19a2('0x16')]?_0x55dd61[_0x19a2('0x16')][_0x19a2('0x18')]||null:null,'attributes':_0x55dd61[_0x19a2('0x16')]?_0x55dd61[_0x19a2('0x16')][_0x19a2('0x19')]||null:null,'limit':_0x55dd61[_0x19a2('0x16')]?_0x55dd61[_0x19a2('0x16')]['limit']||null:null,'include':_0x55dd61[_0x19a2('0x16')]?_0x55dd61[_0x19a2('0x16')][_0x19a2('0x1a')]?_[_0x19a2('0x1b')](_0x55dd61[_0x19a2('0x16')][_0x19a2('0x1a')],function(_0x1acdab){return{'model':db[_0x1acdab[_0x19a2('0x1c')]],'as':_0x1acdab['as'],'attributes':_0x1acdab[_0x19a2('0x19')],'include':_0x1acdab[_0x19a2('0x1a')]?_[_0x19a2('0x1b')](_0x1acdab[_0x19a2('0x1a')],function(_0x297040){return{'model':db[_0x297040['model']],'as':_0x297040['as'],'attributes':_0x297040[_0x19a2('0x19')],'include':_0x297040[_0x19a2('0x1a')]?_['map'](_0x297040['include'],function(_0x378cfb){return{'model':db[_0x378cfb['model']],'as':_0x378cfb['as'],'attributes':_0x378cfb['attributes']};}):[]};}):[]};}):[]:[]})[_0x19a2('0x1d')](function(_0x3afb9e){logger[_0x19a2('0x9')]('GetInterval',_0x55dd61);logger[_0x19a2('0xa')](_0x19a2('0x13'),_0x55dd61,JSON[_0x19a2('0xd')](_0x3afb9e));_0x1366b3(_0x3afb9e);})[_0x19a2('0x12')](function(_0x52c618){logger[_0x19a2('0xe')](_0x19a2('0x13'),_0x52c618[_0x19a2('0x10')],_0x55dd61);_0x2983e3(_0x398c3f[_0x19a2('0xe')](0x1f4,_0x52c618['message']));});});};exports[_0x19a2('0x1e')]=function(_0x297549){var _0x49f6ac=this;return new Promise(function(_0x2a80f0,_0x7035f5){return db[_0x19a2('0x14')][_0x19a2('0x1f')]({'raw':_0x297549['options']?_0x297549[_0x19a2('0x16')][_0x19a2('0x17')]===undefined?!![]:![]:!![],'where':_0x297549[_0x19a2('0x16')]?_0x297549[_0x19a2('0x16')][_0x19a2('0x18')]||null:null,'attributes':_0x297549[_0x19a2('0x16')]?_0x297549[_0x19a2('0x16')][_0x19a2('0x19')]||null:null,'include':_0x297549[_0x19a2('0x16')]?_0x297549[_0x19a2('0x16')]['include']?_['map'](_0x297549['options'][_0x19a2('0x1a')],function(_0x33d37c){return{'model':db[_0x33d37c[_0x19a2('0x1c')]],'as':_0x33d37c['as'],'attributes':_0x33d37c['attributes'],'include':_0x33d37c[_0x19a2('0x1a')]?_[_0x19a2('0x1b')](_0x33d37c['include'],function(_0x573d6f){return{'model':db[_0x573d6f['model']],'as':_0x573d6f['as'],'attributes':_0x573d6f['attributes'],'include':_0x573d6f[_0x19a2('0x1a')]?_[_0x19a2('0x1b')](_0x573d6f['include'],function(_0x5a9fd1){return{'model':db[_0x5a9fd1['model']],'as':_0x5a9fd1['as'],'attributes':_0x5a9fd1['attributes']};}):[]};}):[]};}):[]:[]})[_0x19a2('0x1d')](function(_0x26d5d5){logger['info'](_0x19a2('0x1e'),_0x297549);logger[_0x19a2('0xa')](_0x19a2('0x1e'),_0x297549,JSON[_0x19a2('0xd')](_0x26d5d5));_0x2a80f0(_0x26d5d5);})['catch'](function(_0x3d8fe8){logger['error'](_0x19a2('0x1e'),_0x3d8fe8[_0x19a2('0x10')],_0x297549);_0x7035f5(_0x49f6ac['error'](0x1f4,_0x3d8fe8[_0x19a2('0x10')]));});});}; \ No newline at end of file +var _0x8136=['find','where','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Interval,\x20%s,\x20%s','result','GetInterval','findAll','options','raw','limit','map','include','model','attributes','catch','ShowInterval'];(function(_0x3dbd9b,_0x119443){var _0x149d01=function(_0x475fe6){while(--_0x475fe6){_0x3dbd9b['push'](_0x3dbd9b['shift']());}};_0x149d01(++_0x119443);}(_0x8136,0x14c));var _0x6813=function(_0x178b49,_0x528f66){_0x178b49=_0x178b49-0x0;var _0x4f1fe9=_0x8136[_0x178b49];return _0x4f1fe9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6813('0x0'));var BPromise=require(_0x6813('0x1'));var rs=require(_0x6813('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6813('0x3'));var logger=require(_0x6813('0x4'))(_0x6813('0x5'));var config=require(_0x6813('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6813('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x145f52,_0x1dcc8b,_0x2d9041){return new BPromise(function(_0x4a8e5d,_0x3d5438){return client[_0x6813('0x8')](_0x145f52,_0x2d9041)[_0x6813('0x9')](function(_0xf85a92){logger[_0x6813('0xa')]('Interval,\x20%s,\x20%s',_0x1dcc8b,_0x6813('0xb'));logger[_0x6813('0xc')](_0x6813('0xd'),_0x1dcc8b,_0x6813('0xb'),JSON[_0x6813('0xe')](_0xf85a92));if(_0xf85a92['error']){if(_0xf85a92[_0x6813('0xf')][_0x6813('0x10')]===0x1f4){logger[_0x6813('0xf')]('Interval,\x20%s,\x20%s',_0x1dcc8b,_0xf85a92[_0x6813('0xf')]['message']);return _0x3d5438(_0xf85a92['error'][_0x6813('0x11')]);}logger['error'](_0x6813('0x12'),_0x1dcc8b,_0xf85a92[_0x6813('0xf')][_0x6813('0x11')]);return _0x4a8e5d(_0xf85a92[_0x6813('0xf')][_0x6813('0x11')]);}else{logger[_0x6813('0xa')](_0x6813('0x12'),_0x1dcc8b,_0x6813('0xb'));_0x4a8e5d(_0xf85a92[_0x6813('0x13')][_0x6813('0x11')]);}})['catch'](function(_0xc78fbc){logger['error']('Interval,\x20%s,\x20%s',_0x1dcc8b,_0xc78fbc);_0x3d5438(_0xc78fbc);});});}exports[_0x6813('0x14')]=function(_0x5cbfbb){var _0xb0b240=this;return new Promise(function(_0x3b17e9,_0x11d909){return db['Interval'][_0x6813('0x15')]({'raw':_0x5cbfbb[_0x6813('0x16')]?_0x5cbfbb[_0x6813('0x16')][_0x6813('0x17')]===undefined?!![]:![]:!![],'where':_0x5cbfbb['options']?_0x5cbfbb['options']['where']||null:null,'attributes':_0x5cbfbb[_0x6813('0x16')]?_0x5cbfbb[_0x6813('0x16')]['attributes']||null:null,'limit':_0x5cbfbb[_0x6813('0x16')]?_0x5cbfbb[_0x6813('0x16')][_0x6813('0x18')]||null:null,'include':_0x5cbfbb[_0x6813('0x16')]?_0x5cbfbb[_0x6813('0x16')]['include']?_[_0x6813('0x19')](_0x5cbfbb['options'][_0x6813('0x1a')],function(_0x505a46){return{'model':db[_0x505a46[_0x6813('0x1b')]],'as':_0x505a46['as'],'attributes':_0x505a46['attributes'],'include':_0x505a46[_0x6813('0x1a')]?_['map'](_0x505a46['include'],function(_0x2282ac){return{'model':db[_0x2282ac[_0x6813('0x1b')]],'as':_0x2282ac['as'],'attributes':_0x2282ac[_0x6813('0x1c')],'include':_0x2282ac['include']?_['map'](_0x2282ac[_0x6813('0x1a')],function(_0x48db68){return{'model':db[_0x48db68[_0x6813('0x1b')]],'as':_0x48db68['as'],'attributes':_0x48db68[_0x6813('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6813('0x9')](function(_0x550876){logger[_0x6813('0xa')](_0x6813('0x14'),_0x5cbfbb);logger['debug'](_0x6813('0x14'),_0x5cbfbb,JSON['stringify'](_0x550876));_0x3b17e9(_0x550876);})[_0x6813('0x1d')](function(_0x57fa20){logger[_0x6813('0xf')](_0x6813('0x14'),_0x57fa20['message'],_0x5cbfbb);_0x11d909(_0xb0b240['error'](0x1f4,_0x57fa20[_0x6813('0x11')]));});});};exports[_0x6813('0x1e')]=function(_0x220210){var _0x40452=this;return new Promise(function(_0x22eca4,_0x35f394){return db['Interval'][_0x6813('0x1f')]({'raw':_0x220210[_0x6813('0x16')]?_0x220210[_0x6813('0x16')][_0x6813('0x17')]===undefined?!![]:![]:!![],'where':_0x220210[_0x6813('0x16')]?_0x220210[_0x6813('0x16')][_0x6813('0x20')]||null:null,'attributes':_0x220210[_0x6813('0x16')]?_0x220210[_0x6813('0x16')][_0x6813('0x1c')]||null:null,'include':_0x220210[_0x6813('0x16')]?_0x220210[_0x6813('0x16')][_0x6813('0x1a')]?_['map'](_0x220210[_0x6813('0x16')][_0x6813('0x1a')],function(_0x1e4d8b){return{'model':db[_0x1e4d8b[_0x6813('0x1b')]],'as':_0x1e4d8b['as'],'attributes':_0x1e4d8b['attributes'],'include':_0x1e4d8b['include']?_[_0x6813('0x19')](_0x1e4d8b[_0x6813('0x1a')],function(_0x2e36ee){return{'model':db[_0x2e36ee['model']],'as':_0x2e36ee['as'],'attributes':_0x2e36ee[_0x6813('0x1c')],'include':_0x2e36ee[_0x6813('0x1a')]?_[_0x6813('0x19')](_0x2e36ee[_0x6813('0x1a')],function(_0x1f3989){return{'model':db[_0x1f3989[_0x6813('0x1b')]],'as':_0x1f3989['as'],'attributes':_0x1f3989[_0x6813('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6813('0x9')](function(_0xfb9920){logger['info'](_0x6813('0x1e'),_0x220210);logger[_0x6813('0xc')](_0x6813('0x1e'),_0x220210,JSON[_0x6813('0xe')](_0xfb9920));_0x22eca4(_0xfb9920);})[_0x6813('0x1d')](function(_0x1599e8){logger[_0x6813('0xf')](_0x6813('0x1e'),_0x1599e8[_0x6813('0x11')],_0x220210);_0x35f394(_0x40452[_0x6813('0xf')](0x1f4,_0x1599e8['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6c21f1d..6181256 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 _0x83b1=['express','Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x83b1,0x128));var _0x183b=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x83b1[_0x5447fd];return _0x15b28a;};'use strict';var express=require(_0x183b('0x0'));var router=express[_0x183b('0x1')]();var auth=require(_0x183b('0x2'));var controller=require(_0x183b('0x3'));router[_0x183b('0x4')]('/',auth[_0x183b('0x5')](),controller[_0x183b('0x6')]);module[_0x183b('0x7')]=router; \ No newline at end of file +var _0x2865=['./jira.controller','post','isAuthenticated','send','exports','Router','../../components/auth/service'];(function(_0x4c91fc,_0xd4e116){var _0x10c795=function(_0x4d210e){while(--_0x4d210e){_0x4c91fc['push'](_0x4c91fc['shift']());}};_0x10c795(++_0xd4e116);}(_0x2865,0x1b0));var _0x5286=function(_0x14a13e,_0x43c73f){_0x14a13e=_0x14a13e-0x0;var _0x1aa18b=_0x2865[_0x14a13e];return _0x1aa18b;};'use strict';var express=require('express');var router=express[_0x5286('0x0')]();var auth=require(_0x5286('0x1'));var controller=require(_0x5286('0x2'));router[_0x5286('0x3')]('/',auth[_0x5286('0x4')](),controller[_0x5286('0x5')]);module[_0x5286('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 0e22a50..035a8a4 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 _0xf6cc=['setEncoding','utf8','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','body','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64'];(function(_0x2a0034,_0x51c1a1){var _0x55c1b0=function(_0x349508){while(--_0x349508){_0x2a0034['push'](_0x2a0034['shift']());}};_0x55c1b0(++_0x51c1a1);}(_0xf6cc,0x91));var _0xcf6c=function(_0x55a2c7,_0x3b2ecb){_0x55a2c7=_0x55a2c7-0x0;var _0x5b54c1=_0xf6cc[_0x55a2c7];return _0x5b54c1;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xcf6c('0x0'))(_0xcf6c('0x1'));var USERNAME='support';var PASSWORD=_0xcf6c('0x2');function openIssue(_0x415f04,_0x38321d){var _0x562636={'fields':{'project':{'key':_0x415f04[_0xcf6c('0x3')]||_0xcf6c('0x4')},'summary':(_0x415f04[_0xcf6c('0x5')]||_0xcf6c('0x6'))+_0xcf6c('0x7')+_0x415f04['ip'],'description':_0x415f04[_0xcf6c('0x8')]||JSON[_0xcf6c('0x9')](_0x415f04),'issuetype':{'name':_0x415f04[_0xcf6c('0xa')]||_0xcf6c('0xb')}}};_0x562636[_0xcf6c('0xc')][_0xcf6c('0xd')]=_0x415f04[_0xcf6c('0xe')];_0x562636[_0xcf6c('0xc')][_0xcf6c('0xf')]=_0x415f04['oldToken'];_0x562636['fields'][_0xcf6c('0x10')]=_0x415f04['newToken'];_0x562636['fields'][_0xcf6c('0x11')]=_0x415f04[_0xcf6c('0x12')];_0x562636['fields'][_0xcf6c('0x13')]=_0x415f04[_0xcf6c('0x14')];_0x562636[_0xcf6c('0xc')]['customfield_10102']=_0x415f04['ip'];var _0x3f09e0={'host':_0xcf6c('0x15'),'port':0x1bb,'path':_0xcf6c('0x16'),'method':_0xcf6c('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xcf6c('0x18'),'Authorization':_0xcf6c('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xcf6c('0x1a'))}};var _0x25623b=JSON[_0xcf6c('0x9')](_0x562636);var _0x2d7c61=https['request'](_0x3f09e0,function(_0x1f8827){_0x1f8827[_0xcf6c('0x1b')](_0xcf6c('0x1c'));var _0x2b1ad4='';_0x1f8827['on']('data',function(_0x7e70d4){_0x2b1ad4+=_0x7e70d4;});_0x1f8827['on']('end',function(){if(_0x38321d){return _0x38321d[_0xcf6c('0x1d')](_0x1f8827[_0xcf6c('0x1e')])[_0xcf6c('0x1f')](JSON['parse'](_0x2b1ad4));}});});_0x2d7c61['on'](_0xcf6c('0x20'),function(_0x5ba50d){if(_0x38321d){return _0x38321d[_0xcf6c('0x1d')](0x1f4)[_0xcf6c('0x1f')]({'errors':[{'message':_0xcf6c('0x21'),'type':'api.jira'}]});}});_0x2d7c61[_0xcf6c('0x22')](_0x25623b);_0x2d7c61[_0xcf6c('0x23')]();}exports[_0xcf6c('0x24')]=openIssue;exports['send']=function(_0x4c6368,_0x2e66ed){_0x4c6368['body']['ip']=_0x4c6368[_0xcf6c('0x25')][_0xcf6c('0x26')]||_0x4c6368[_0xcf6c('0x27')][_0xcf6c('0x28')]||_0x4c6368[_0xcf6c('0x29')]['remoteAddress']||_0x4c6368['connection'][_0xcf6c('0x29')]['remoteAddress'];return openIssue(_0x4c6368[_0xcf6c('0x2a')],_0x2e66ed);}; \ No newline at end of file +var _0x28bb=['send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','stringify','issuetype','Bug','fields','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue'];(function(_0x1b0796,_0xa61bc){var _0xa09b04=function(_0x17cefc){while(--_0x17cefc){_0x1b0796['push'](_0x1b0796['shift']());}};_0xa09b04(++_0xa61bc);}(_0x28bb,0x1d3));var _0xb28b=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x28bb[_0x5416db];return _0x243e35;};'use strict';var BPromise=require('bluebird');var https=require(_0xb28b('0x0'));var logger=require(_0xb28b('0x1'))(_0xb28b('0x2'));var USERNAME=_0xb28b('0x3');var PASSWORD=_0xb28b('0x4');function openIssue(_0x4e6d64,_0x5820aa){var _0x1eda20={'fields':{'project':{'key':_0x4e6d64[_0xb28b('0x5')]||_0xb28b('0x6')},'summary':(_0x4e6d64[_0xb28b('0x7')]||_0xb28b('0x8'))+'\x20from\x20'+_0x4e6d64['ip'],'description':_0x4e6d64['description']||JSON[_0xb28b('0x9')](_0x4e6d64),'issuetype':{'name':_0x4e6d64[_0xb28b('0xa')]||_0xb28b('0xb')}}};_0x1eda20[_0xb28b('0xc')]['customfield_11500']=_0x4e6d64['email'];_0x1eda20['fields']['customfield_11501']=_0x4e6d64[_0xb28b('0xd')];_0x1eda20[_0xb28b('0xc')][_0xb28b('0xe')]=_0x4e6d64[_0xb28b('0xf')];_0x1eda20[_0xb28b('0xc')][_0xb28b('0x10')]=_0x4e6d64[_0xb28b('0x11')];_0x1eda20[_0xb28b('0xc')][_0xb28b('0x12')]=_0x4e6d64[_0xb28b('0x13')];_0x1eda20[_0xb28b('0xc')][_0xb28b('0x14')]=_0x4e6d64['ip'];var _0x17e250={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xb28b('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xb28b('0x16'),'Authorization':_0xb28b('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xb28b('0x18')](_0xb28b('0x19'))}};var _0x256402=JSON['stringify'](_0x1eda20);var _0x3ef7c4=https[_0xb28b('0x1a')](_0x17e250,function(_0xab0272){_0xab0272['setEncoding'](_0xb28b('0x1b'));var _0x1471c4='';_0xab0272['on'](_0xb28b('0x1c'),function(_0x1a3ba9){_0x1471c4+=_0x1a3ba9;});_0xab0272['on']('end',function(){if(_0x5820aa){return _0x5820aa[_0xb28b('0x1d')](_0xab0272[_0xb28b('0x1e')])[_0xb28b('0x1f')](JSON[_0xb28b('0x20')](_0x1471c4));}});});_0x3ef7c4['on'](_0xb28b('0x21'),function(_0x3c9047){if(_0x5820aa){return _0x5820aa[_0xb28b('0x1d')](0x1f4)[_0xb28b('0x1f')]({'errors':[{'message':_0xb28b('0x22'),'type':_0xb28b('0x23')}]});}});_0x3ef7c4[_0xb28b('0x24')](_0x256402);_0x3ef7c4[_0xb28b('0x25')]();}exports[_0xb28b('0x26')]=openIssue;exports[_0xb28b('0x27')]=function(_0x4df974,_0x159de1){_0x4df974[_0xb28b('0x28')]['ip']=_0x4df974[_0xb28b('0x29')][_0xb28b('0x2a')]||_0x4df974[_0xb28b('0x2b')][_0xb28b('0x2c')]||_0x4df974[_0xb28b('0x2d')][_0xb28b('0x2c')]||_0x4df974[_0xb28b('0x2b')][_0xb28b('0x2d')]['remoteAddress'];return openIssue(_0x4df974[_0xb28b('0x28')],_0x159de1);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 27155f8..cde7354 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 _0xdc48=['multer','util','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xdc48,0x165));var _0x8dc4=function(_0x2820f8,_0x2bdbdc){_0x2820f8=_0x2820f8-0x0;var _0x1e1413=_0xdc48[_0x2820f8];return _0x1e1413;};'use strict';var multer=require(_0x8dc4('0x0'));var util=require(_0x8dc4('0x1'));var path=require('path');var timeout=require(_0x8dc4('0x2'));var express=require('express');var router=express[_0x8dc4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8dc4('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0x8dc4('0x5')]('/',auth[_0x8dc4('0x6')](),controller[_0x8dc4('0x7')]);router[_0x8dc4('0x5')](_0x8dc4('0x8'),auth[_0x8dc4('0x6')](),controller['describe']);router['get'](_0x8dc4('0x9'),auth[_0x8dc4('0x6')](),controller[_0x8dc4('0xa')]);router[_0x8dc4('0xb')]('/',auth['isAuthenticated'](),controller[_0x8dc4('0xc')]);router[_0x8dc4('0xd')](_0x8dc4('0x9'),auth[_0x8dc4('0x6')](),controller['update']);router[_0x8dc4('0xe')](_0x8dc4('0x9'),auth[_0x8dc4('0x6')](),controller[_0x8dc4('0xf')]);module[_0x8dc4('0x10')]=router; \ No newline at end of file +var _0xb35d=['get','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x5d4db6,_0x4311b4){var _0x41b1df=function(_0xc7a07c){while(--_0xc7a07c){_0x5d4db6['push'](_0x5d4db6['shift']());}};_0x41b1df(++_0x4311b4);}(_0xb35d,0x1ae));var _0xdb35=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0xb35d[_0x4b6804];return _0x11b4f1;};'use strict';var multer=require(_0xdb35('0x0'));var util=require(_0xdb35('0x1'));var path=require(_0xdb35('0x2'));var timeout=require(_0xdb35('0x3'));var express=require(_0xdb35('0x4'));var router=express[_0xdb35('0x5')]();var auth=require(_0xdb35('0x6'));var interaction=require(_0xdb35('0x7'));var config=require(_0xdb35('0x8'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0xdb35('0x9')](),controller[_0xdb35('0xa')]);router[_0xdb35('0xb')](_0xdb35('0xc'),auth[_0xdb35('0x9')](),controller[_0xdb35('0xd')]);router[_0xdb35('0xb')](_0xdb35('0xe'),auth[_0xdb35('0x9')](),controller[_0xdb35('0xf')]);router[_0xdb35('0x10')]('/',auth[_0xdb35('0x9')](),controller['create']);router[_0xdb35('0x11')]('/:id',auth[_0xdb35('0x9')](),controller['update']);router[_0xdb35('0x12')](_0xdb35('0xe'),auth['isAuthenticated'](),controller[_0xdb35('0x13')]);module[_0xdb35('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5b1896a..1b7f228 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 _0x7867=['long','sequelize','exports','STRING','TEXT'];(function(_0x57b953,_0x295f3b){var _0x5b15f0=function(_0x1e5b5b){while(--_0x1e5b5b){_0x57b953['push'](_0x57b953['shift']());}};_0x5b15f0(++_0x295f3b);}(_0x7867,0x173));var _0x7786=function(_0x40797a,_0x331801){_0x40797a=_0x40797a-0x0;var _0x37d57a=_0x7867[_0x40797a];return _0x37d57a;};'use strict';var Sequelize=require(_0x7786('0x0'));module[_0x7786('0x1')]={'question':{'type':Sequelize[_0x7786('0x2')]},'answer':{'type':Sequelize[_0x7786('0x3')](_0x7786('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x7786('0x2')]},'queue':{'type':Sequelize[_0x7786('0x2')]},'uniqueid':{'type':Sequelize[_0x7786('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7786('0x2')]},'questionId':{'type':Sequelize[_0x7786('0x2')]}}; \ No newline at end of file +var _0xc182=['STRING','long'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xc182,0x11c));var _0x2c18=function(_0x166d7a,_0x23dac8){_0x166d7a=_0x166d7a-0x0;var _0x3d5aa6=_0xc182[_0x166d7a];return _0x3d5aa6;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x2c18('0x0')]},'answer':{'type':Sequelize['TEXT'](_0x2c18('0x1'))},'membername':{'type':Sequelize[_0x2c18('0x0')]},'projectname':{'type':Sequelize[_0x2c18('0x0')]},'queue':{'type':Sequelize[_0x2c18('0x0')]},'uniqueid':{'type':Sequelize[_0x2c18('0x0')]},'calleridname':{'type':Sequelize[_0x2c18('0x0')]},'calleridnum':{'type':Sequelize[_0x2c18('0x0')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 85e7751..64bd66d 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 _0x8363=['attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','catch','rawAttributes','includeAll','create','body','find','params','describe','html-pdf','eml-format','rimraf','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','stack','name','index','JscriptyAnswerReport','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x11f7fc,_0x1545da){var _0x445244=function(_0x4ef0a5){while(--_0x4ef0a5){_0x11f7fc['push'](_0x11f7fc['shift']());}};_0x445244(++_0x1545da);}(_0x8363,0x176));var _0x3836=function(_0x2de59e,_0x24b766){_0x2de59e=_0x2de59e-0x0;var _0x534d4b=_0x8363[_0x2de59e];return _0x534d4b;};'use strict';var pdf=require(_0x3836('0x0'));var emlformat=require(_0x3836('0x1'));var rimraf=require(_0x3836('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3836('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3836('0x4'));var util=require(_0x3836('0x5'));var path=require('path');var sox=require(_0x3836('0x6'));var csv=require(_0x3836('0x7'));var ejs=require(_0x3836('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3836('0x9'));var crypto=require(_0x3836('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3836('0xb'));var toCsv=require(_0x3836('0x7'));var querystring=require('querystring');var Papa=require(_0x3836('0xc'));var Redis=require('ioredis');var authService=require(_0x3836('0xd'));var qs=require(_0x3836('0xe'));var as=require(_0x3836('0xf'));var hardwareService=require(_0x3836('0x10'));var logger=require(_0x3836('0x11'))('api');var utils=require(_0x3836('0x12'));var config=require(_0x3836('0x13'));var db=require(_0x3836('0x14'))['db'];function respondWithStatusCode(_0x5807d4,_0x537c17){_0x537c17=_0x537c17||0xcc;return function(_0x1ef08a){if(_0x1ef08a){return _0x5807d4[_0x3836('0x15')](_0x537c17);}return _0x5807d4[_0x3836('0x16')](_0x537c17)[_0x3836('0x17')]();};}function respondWithResult(_0x28f5c3,_0xbcb0e6){_0xbcb0e6=_0xbcb0e6||0xc8;return function(_0x38de51){if(_0x38de51){return _0x28f5c3['status'](_0xbcb0e6)[_0x3836('0x18')](_0x38de51);}};}function respondWithFilteredResult(_0x19f0ab,_0x14ee63){return function(_0x467593){if(_0x467593){var _0x8cca0e=_0x467593[_0x3836('0x19')],_0x494425=_0x14ee63[_0x3836('0x1a')],_0x1be4cb=_0x14ee63[_0x3836('0x1a')]+_0x14ee63[_0x3836('0x1b')],_0x2c4026;if(_0x1be4cb>=_0x8cca0e){_0x1be4cb=_0x8cca0e;_0x2c4026=0xc8;}else{_0x2c4026=0xce;}_0x19f0ab[_0x3836('0x16')](_0x2c4026);return _0x19f0ab['set'](_0x3836('0x1c'),_0x494425+'-'+_0x1be4cb+'/'+_0x8cca0e)[_0x3836('0x18')](_0x467593);}return null;};}function patchUpdates(_0x1385b5){return function(_0x8bfe65){try{jsonpatch[_0x3836('0x1d')](_0x8bfe65,_0x1385b5,!![]);}catch(_0x64bed6){return BPromise[_0x3836('0x1e')](_0x64bed6);}return _0x8bfe65[_0x3836('0x1f')]();};}function saveUpdates(_0x2f4c31,_0x312bf8){return function(_0x4682f8){if(_0x4682f8){return _0x4682f8['update'](_0x2f4c31)['then'](function(_0x55b133){return _0x55b133;});}return null;};}function removeEntity(_0x5ef2ff,_0x533a9d){return function(_0x4c70bc){if(_0x4c70bc){return _0x4c70bc[_0x3836('0x20')]()[_0x3836('0x21')](function(){_0x5ef2ff['status'](0xcc)[_0x3836('0x17')]();});}};}function handleEntityNotFound(_0x2ff6ec,_0x5de93a){return function(_0x3df0c0){if(!_0x3df0c0){_0x2ff6ec[_0x3836('0x15')](0x194);}return _0x3df0c0;};}function handleError(_0x5188c8,_0x559f34){_0x559f34=_0x559f34||0x1f4;return function(_0x39372b){logger['error'](_0x39372b[_0x3836('0x22')]);if(_0x39372b[_0x3836('0x23')]){delete _0x39372b['name'];}_0x5188c8[_0x3836('0x16')](_0x559f34)['send'](_0x39372b);};}exports[_0x3836('0x24')]=function(_0xb1b0be,_0x1904ad){var _0x2b6a23={},_0xda2877={},_0x1cdd40={'count':0x0,'rows':[]};var _0x42b335=_['map'](db[_0x3836('0x25')]['rawAttributes'],function(_0x54f8f6){return{'name':_0x54f8f6[_0x3836('0x26')],'type':_0x54f8f6[_0x3836('0x27')][_0x3836('0x28')]};});_0xda2877[_0x3836('0x29')]=_[_0x3836('0x2a')](_0x42b335,_0x3836('0x23'));_0xda2877[_0x3836('0x2b')]=_[_0x3836('0x2c')](_0xb1b0be[_0x3836('0x2b')]);_0xda2877['filters']=_[_0x3836('0x2d')](_0xda2877[_0x3836('0x29')],_0xda2877[_0x3836('0x2b')]);_0x2b6a23[_0x3836('0x2e')]=_[_0x3836('0x2d')](_0xda2877[_0x3836('0x29')],qs[_0x3836('0x2f')](_0xb1b0be['query'][_0x3836('0x2f')]));_0x2b6a23[_0x3836('0x2e')]=_0x2b6a23[_0x3836('0x2e')][_0x3836('0x30')]?_0x2b6a23[_0x3836('0x2e')]:_0xda2877[_0x3836('0x29')];if(!_0xb1b0be[_0x3836('0x2b')][_0x3836('0x31')](_0x3836('0x32'))){_0x2b6a23[_0x3836('0x1b')]=qs[_0x3836('0x1b')](_0xb1b0be[_0x3836('0x2b')][_0x3836('0x1b')]);_0x2b6a23['offset']=qs[_0x3836('0x1a')](_0xb1b0be[_0x3836('0x2b')]['offset']);}_0x2b6a23[_0x3836('0x33')]=qs['sort'](_0xb1b0be[_0x3836('0x2b')]['sort']);_0x2b6a23['where']=qs[_0x3836('0x34')](_[_0x3836('0x35')](_0xb1b0be[_0x3836('0x2b')],_0xda2877[_0x3836('0x34')]),_0x42b335);if(_0xb1b0be['query']['filter']){_0x2b6a23['where']=_[_0x3836('0x36')](_0x2b6a23[_0x3836('0x37')],{'$or':_[_0x3836('0x2a')](_0x42b335,function(_0x3d55e2){if(_0x3d55e2[_0x3836('0x27')]!==_0x3836('0x38')){var _0x1fe600={};_0x1fe600[_0x3d55e2[_0x3836('0x23')]]={'$like':'%'+_0xb1b0be[_0x3836('0x2b')][_0x3836('0x39')]+'%'};return _0x1fe600;}})});}_0x2b6a23=_[_0x3836('0x36')]({},_0x2b6a23,_0xb1b0be[_0x3836('0x3a')]);var _0x5d0454={'where':_0x2b6a23['where']};return db[_0x3836('0x25')][_0x3836('0x19')](_0x5d0454)[_0x3836('0x21')](function(_0x20e4e5){_0x1cdd40[_0x3836('0x19')]=_0x20e4e5;if(_0xb1b0be[_0x3836('0x2b')]['includeAll']){_0x2b6a23[_0x3836('0x3b')]=[{'all':!![]}];}return db[_0x3836('0x25')][_0x3836('0x3c')](_0x2b6a23);})[_0x3836('0x21')](function(_0x39231c){_0x1cdd40[_0x3836('0x3d')]=_0x39231c;return _0x1cdd40;})[_0x3836('0x21')](respondWithFilteredResult(_0x1904ad,_0x2b6a23))[_0x3836('0x3e')](handleError(_0x1904ad,null));};exports['show']=function(_0x49bffe,_0x247f4a){var _0x3c0546={'raw':!![],'where':{'id':_0x49bffe['params']['id']}},_0x45de23={};_0x45de23[_0x3836('0x29')]=_[_0x3836('0x2c')](db['JscriptyAnswerReport'][_0x3836('0x3f')]);_0x45de23[_0x3836('0x2b')]=_['keys'](_0x49bffe['query']);_0x45de23[_0x3836('0x34')]=_['intersection'](_0x45de23[_0x3836('0x29')],_0x45de23[_0x3836('0x2b')]);_0x3c0546[_0x3836('0x2e')]=_['intersection'](_0x45de23[_0x3836('0x29')],qs[_0x3836('0x2f')](_0x49bffe[_0x3836('0x2b')]['fields']));_0x3c0546[_0x3836('0x2e')]=_0x3c0546[_0x3836('0x2e')][_0x3836('0x30')]?_0x3c0546[_0x3836('0x2e')]:_0x45de23[_0x3836('0x29')];if(_0x49bffe[_0x3836('0x2b')][_0x3836('0x40')]){_0x3c0546['include']=[{'all':!![]}];}_0x3c0546=_[_0x3836('0x36')]({},_0x3c0546,_0x49bffe['options']);return db[_0x3836('0x25')]['find'](_0x3c0546)[_0x3836('0x21')](handleEntityNotFound(_0x247f4a,null))[_0x3836('0x21')](respondWithResult(_0x247f4a,null))[_0x3836('0x3e')](handleError(_0x247f4a,null));};exports[_0x3836('0x41')]=function(_0x47b67f,_0x4b4136){return db['JscriptyAnswerReport']['create'](_0x47b67f['body'],{})['then'](respondWithResult(_0x4b4136,0xc9))[_0x3836('0x3e')](handleError(_0x4b4136,null));};exports['update']=function(_0x6e858e,_0x1dd4ae){if(_0x6e858e['body']['id']){delete _0x6e858e[_0x3836('0x42')]['id'];}return db['JscriptyAnswerReport'][_0x3836('0x43')]({'where':{'id':_0x6e858e[_0x3836('0x44')]['id']}})[_0x3836('0x21')](handleEntityNotFound(_0x1dd4ae,null))['then'](saveUpdates(_0x6e858e[_0x3836('0x42')],null))[_0x3836('0x21')](respondWithResult(_0x1dd4ae,null))[_0x3836('0x3e')](handleError(_0x1dd4ae,null));};exports[_0x3836('0x20')]=function(_0x3fc979,_0x4a54e1){return db[_0x3836('0x25')][_0x3836('0x43')]({'where':{'id':_0x3fc979[_0x3836('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a54e1,null))['then'](removeEntity(_0x4a54e1,null))['catch'](handleError(_0x4a54e1,null));};exports[_0x3836('0x45')]=function(_0x3fc72a,_0x3751fc){return db[_0x3836('0x25')][_0x3836('0x45')]()[_0x3836('0x21')](respondWithResult(_0x3751fc,null))['catch'](handleError(_0x3751fc,null));}; \ No newline at end of file +var _0x2963=['set','json','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset'];(function(_0x35ffd3,_0x5c9a73){var _0x491d67=function(_0x541590){while(--_0x541590){_0x35ffd3['push'](_0x35ffd3['shift']());}};_0x491d67(++_0x5c9a73);}(_0x2963,0x73));var _0x3296=function(_0x560ecd,_0x18dd57){_0x560ecd=_0x560ecd-0x0;var _0x1e7888=_0x2963[_0x560ecd];return _0x1e7888;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3296('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3296('0x1'));var rp=require(_0x3296('0x2'));var moment=require(_0x3296('0x3'));var BPromise=require(_0x3296('0x4'));var Mustache=require(_0x3296('0x5'));var util=require(_0x3296('0x6'));var path=require('path');var sox=require(_0x3296('0x7'));var csv=require(_0x3296('0x8'));var ejs=require(_0x3296('0x9'));var fs=require('fs');var _=require(_0x3296('0xa'));var squel=require(_0x3296('0xb'));var crypto=require(_0x3296('0xc'));var jsforce=require(_0x3296('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3296('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3296('0xf'));var qs=require(_0x3296('0x10'));var as=require(_0x3296('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3296('0x12'))(_0x3296('0x13'));var utils=require(_0x3296('0x14'));var config=require(_0x3296('0x15'));var db=require(_0x3296('0x16'))['db'];function respondWithStatusCode(_0x36c772,_0x403de3){_0x403de3=_0x403de3||0xcc;return function(_0x478bfe){if(_0x478bfe){return _0x36c772['sendStatus'](_0x403de3);}return _0x36c772[_0x3296('0x17')](_0x403de3)[_0x3296('0x18')]();};}function respondWithResult(_0x225a42,_0x39779e){_0x39779e=_0x39779e||0xc8;return function(_0x213dee){if(_0x213dee){return _0x225a42[_0x3296('0x17')](_0x39779e)['json'](_0x213dee);}};}function respondWithFilteredResult(_0x1714cd,_0x20b785){return function(_0x4555ad){if(_0x4555ad){var _0x50edf4=_0x4555ad[_0x3296('0x19')],_0x31542e=_0x20b785[_0x3296('0x1a')],_0x5f24f9=_0x20b785[_0x3296('0x1a')]+_0x20b785['limit'],_0x3a8be4;if(_0x5f24f9>=_0x50edf4){_0x5f24f9=_0x50edf4;_0x3a8be4=0xc8;}else{_0x3a8be4=0xce;}_0x1714cd[_0x3296('0x17')](_0x3a8be4);return _0x1714cd[_0x3296('0x1b')]('Content-Range',_0x31542e+'-'+_0x5f24f9+'/'+_0x50edf4)[_0x3296('0x1c')](_0x4555ad);}return null;};}function patchUpdates(_0x1fe3b8){return function(_0x94a586){try{jsonpatch[_0x3296('0x1d')](_0x94a586,_0x1fe3b8,!![]);}catch(_0x47447e){return BPromise[_0x3296('0x1e')](_0x47447e);}return _0x94a586[_0x3296('0x1f')]();};}function saveUpdates(_0xcbd3c0,_0x3f481f){return function(_0x30a3c2){if(_0x30a3c2){return _0x30a3c2['update'](_0xcbd3c0)['then'](function(_0x33af75){return _0x33af75;});}return null;};}function removeEntity(_0x54e65f,_0x464313){return function(_0x4ae275){if(_0x4ae275){return _0x4ae275[_0x3296('0x20')]()[_0x3296('0x21')](function(){_0x54e65f[_0x3296('0x17')](0xcc)[_0x3296('0x18')]();});}};}function handleEntityNotFound(_0x575a11,_0x49192b){return function(_0x481607){if(!_0x481607){_0x575a11[_0x3296('0x22')](0x194);}return _0x481607;};}function handleError(_0x30a2ae,_0x116ca7){_0x116ca7=_0x116ca7||0x1f4;return function(_0x37ecfc){logger[_0x3296('0x23')](_0x37ecfc[_0x3296('0x24')]);if(_0x37ecfc['name']){delete _0x37ecfc[_0x3296('0x25')];}_0x30a2ae['status'](_0x116ca7)[_0x3296('0x26')](_0x37ecfc);};}exports['index']=function(_0x26fad1,_0x4f325b){var _0x34e469={},_0x75fb0e={},_0x2a77b5={'count':0x0,'rows':[]};var _0x5df55b=_[_0x3296('0x27')](db[_0x3296('0x28')][_0x3296('0x29')],function(_0x4acd52){return{'name':_0x4acd52['fieldName'],'type':_0x4acd52[_0x3296('0x2a')][_0x3296('0x2b')]};});_0x75fb0e[_0x3296('0x2c')]=_[_0x3296('0x27')](_0x5df55b,_0x3296('0x25'));_0x75fb0e[_0x3296('0x2d')]=_[_0x3296('0x2e')](_0x26fad1[_0x3296('0x2d')]);_0x75fb0e[_0x3296('0x2f')]=_[_0x3296('0x30')](_0x75fb0e['model'],_0x75fb0e[_0x3296('0x2d')]);_0x34e469[_0x3296('0x31')]=_[_0x3296('0x30')](_0x75fb0e[_0x3296('0x2c')],qs[_0x3296('0x32')](_0x26fad1[_0x3296('0x2d')]['fields']));_0x34e469[_0x3296('0x31')]=_0x34e469['attributes'][_0x3296('0x33')]?_0x34e469[_0x3296('0x31')]:_0x75fb0e[_0x3296('0x2c')];if(!_0x26fad1[_0x3296('0x2d')][_0x3296('0x34')](_0x3296('0x35'))){_0x34e469[_0x3296('0x36')]=qs[_0x3296('0x36')](_0x26fad1[_0x3296('0x2d')]['limit']);_0x34e469[_0x3296('0x1a')]=qs[_0x3296('0x1a')](_0x26fad1['query'][_0x3296('0x1a')]);}_0x34e469['order']=qs[_0x3296('0x37')](_0x26fad1['query'][_0x3296('0x37')]);_0x34e469['where']=qs[_0x3296('0x2f')](_[_0x3296('0x38')](_0x26fad1[_0x3296('0x2d')],_0x75fb0e[_0x3296('0x2f')]),_0x5df55b);if(_0x26fad1['query'][_0x3296('0x39')]){_0x34e469[_0x3296('0x3a')]=_[_0x3296('0x3b')](_0x34e469[_0x3296('0x3a')],{'$or':_['map'](_0x5df55b,function(_0x201db7){if(_0x201db7[_0x3296('0x2a')]!==_0x3296('0x3c')){var _0x37d8ed={};_0x37d8ed[_0x201db7[_0x3296('0x25')]]={'$like':'%'+_0x26fad1[_0x3296('0x2d')][_0x3296('0x39')]+'%'};return _0x37d8ed;}})});}_0x34e469=_[_0x3296('0x3b')]({},_0x34e469,_0x26fad1[_0x3296('0x3d')]);var _0x313858={'where':_0x34e469['where']};return db['JscriptyAnswerReport'][_0x3296('0x19')](_0x313858)[_0x3296('0x21')](function(_0x3e8358){_0x2a77b5['count']=_0x3e8358;if(_0x26fad1[_0x3296('0x2d')]['includeAll']){_0x34e469[_0x3296('0x3e')]=[{'all':!![]}];}return db[_0x3296('0x28')]['findAll'](_0x34e469);})[_0x3296('0x21')](function(_0x2e950f){_0x2a77b5['rows']=_0x2e950f;return _0x2a77b5;})[_0x3296('0x21')](respondWithFilteredResult(_0x4f325b,_0x34e469))[_0x3296('0x3f')](handleError(_0x4f325b,null));};exports[_0x3296('0x40')]=function(_0x5b7146,_0x5006e6){var _0x123a72={'raw':!![],'where':{'id':_0x5b7146[_0x3296('0x41')]['id']}},_0x492b20={};_0x492b20[_0x3296('0x2c')]=_['keys'](db[_0x3296('0x28')][_0x3296('0x29')]);_0x492b20[_0x3296('0x2d')]=_[_0x3296('0x2e')](_0x5b7146[_0x3296('0x2d')]);_0x492b20[_0x3296('0x2f')]=_[_0x3296('0x30')](_0x492b20[_0x3296('0x2c')],_0x492b20[_0x3296('0x2d')]);_0x123a72[_0x3296('0x31')]=_[_0x3296('0x30')](_0x492b20['model'],qs[_0x3296('0x32')](_0x5b7146[_0x3296('0x2d')][_0x3296('0x32')]));_0x123a72[_0x3296('0x31')]=_0x123a72[_0x3296('0x31')]['length']?_0x123a72[_0x3296('0x31')]:_0x492b20['model'];if(_0x5b7146[_0x3296('0x2d')][_0x3296('0x42')]){_0x123a72[_0x3296('0x3e')]=[{'all':!![]}];}_0x123a72=_[_0x3296('0x3b')]({},_0x123a72,_0x5b7146[_0x3296('0x3d')]);return db[_0x3296('0x28')][_0x3296('0x43')](_0x123a72)[_0x3296('0x21')](handleEntityNotFound(_0x5006e6,null))[_0x3296('0x21')](respondWithResult(_0x5006e6,null))[_0x3296('0x3f')](handleError(_0x5006e6,null));};exports[_0x3296('0x44')]=function(_0x388bff,_0xb7b8c){return db['JscriptyAnswerReport'][_0x3296('0x44')](_0x388bff[_0x3296('0x45')],{})['then'](respondWithResult(_0xb7b8c,0xc9))[_0x3296('0x3f')](handleError(_0xb7b8c,null));};exports['update']=function(_0x4f9467,_0x4f3e07){if(_0x4f9467[_0x3296('0x45')]['id']){delete _0x4f9467[_0x3296('0x45')]['id'];}return db[_0x3296('0x28')][_0x3296('0x43')]({'where':{'id':_0x4f9467[_0x3296('0x41')]['id']}})[_0x3296('0x21')](handleEntityNotFound(_0x4f3e07,null))['then'](saveUpdates(_0x4f9467['body'],null))[_0x3296('0x21')](respondWithResult(_0x4f3e07,null))[_0x3296('0x3f')](handleError(_0x4f3e07,null));};exports[_0x3296('0x20')]=function(_0x596bc4,_0x753d74){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x596bc4[_0x3296('0x41')]['id']}})[_0x3296('0x21')](handleEntityNotFound(_0x753d74,null))[_0x3296('0x21')](removeEntity(_0x753d74,null))['catch'](handleError(_0x753d74,null));};exports[_0x3296('0x46')]=function(_0x1b60a0,_0xae2401){return db['JscriptyAnswerReport'][_0x3296('0x46')]()[_0x3296('0x21')](respondWithResult(_0xae2401,null))[_0x3296('0x3f')](handleError(_0xae2401,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 99f27c3..1cd380e 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 _0x09bf=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','../../config/logger','api','moment','rimraf'];(function(_0x11f3c9,_0x2e0a77){var _0x1b360d=function(_0x50abe3){while(--_0x50abe3){_0x11f3c9['push'](_0x11f3c9['shift']());}};_0x1b360d(++_0x2e0a77);}(_0x09bf,0xa5));var _0xf09b=function(_0x1e4751,_0x1051ac){_0x1e4751=_0x1e4751-0x0;var _0x16312b=_0x09bf[_0x1e4751];return _0x16312b;};'use strict';var _=require(_0xf09b('0x0'));var util=require('util');var logger=require(_0xf09b('0x1'))(_0xf09b('0x2'));var moment=require(_0xf09b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf09b('0x4'));var config=require(_0xf09b('0x5'));var attributes=require(_0xf09b('0x6'));module[_0xf09b('0x7')]=function(_0xc2e1df,_0xdcbbcb){return _0xc2e1df[_0xf09b('0x8')](_0xf09b('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc00=['lodash','util','api','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x4270b8,_0x395e36){var _0x457075=function(_0x10100a){while(--_0x10100a){_0x4270b8['push'](_0x4270b8['shift']());}};_0x457075(++_0x395e36);}(_0xdc00,0x120));var _0x0dc0=function(_0x2e96a0,_0x5b5513){_0x2e96a0=_0x2e96a0-0x0;var _0x769425=_0xdc00[_0x2e96a0];return _0x769425;};'use strict';var _=require(_0x0dc0('0x0'));var util=require(_0x0dc0('0x1'));var logger=require('../../config/logger')(_0x0dc0('0x2'));var moment=require('moment');var BPromise=require(_0x0dc0('0x3'));var rp=require(_0x0dc0('0x4'));var fs=require('fs');var path=require(_0x0dc0('0x5'));var rimraf=require(_0x0dc0('0x6'));var config=require('../../config/environment');var attributes=require(_0x0dc0('0x7'));module[_0x0dc0('0x8')]=function(_0x475350,_0x111b76){return _0x475350[_0x0dc0('0x9')](_0x0dc0('0xa'),attributes,{'tableName':_0x0dc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 57b7062..57e56ad 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 _0x3a20=['info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x363fd8,_0x13cdc5){var _0x43c6d2=function(_0x56fc9f){while(--_0x56fc9f){_0x363fd8['push'](_0x363fd8['shift']());}};_0x43c6d2(++_0x13cdc5);}(_0x3a20,0x180));var _0x03a2=function(_0x283848,_0x3ddaf9){_0x283848=_0x283848-0x0;var _0x63a2f2=_0x3a20[_0x283848];return _0x63a2f2;};'use strict';var _=require(_0x03a2('0x0'));var util=require('util');var moment=require(_0x03a2('0x1'));var BPromise=require(_0x03a2('0x2'));var rs=require(_0x03a2('0x3'));var fs=require('fs');var Redis=require(_0x03a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x03a2('0x5'));var logger=require(_0x03a2('0x6'))('rpc');var config=require(_0x03a2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x03a2('0x8')][_0x03a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e7029,_0x57e64d,_0x1219a6){return new BPromise(function(_0x509a6d,_0x678093){return client[_0x03a2('0xa')](_0x5e7029,_0x1219a6)[_0x03a2('0xb')](function(_0x257950){logger[_0x03a2('0xc')](_0x03a2('0xd'),_0x57e64d,_0x03a2('0xe'));logger[_0x03a2('0xf')](_0x03a2('0x10'),_0x57e64d,_0x03a2('0xe'),JSON[_0x03a2('0x11')](_0x257950));if(_0x257950['error']){if(_0x257950[_0x03a2('0x12')][_0x03a2('0x13')]===0x1f4){logger[_0x03a2('0x12')](_0x03a2('0xd'),_0x57e64d,_0x257950[_0x03a2('0x12')][_0x03a2('0x14')]);return _0x678093(_0x257950['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x57e64d,_0x257950['error'][_0x03a2('0x14')]);return _0x509a6d(_0x257950[_0x03a2('0x12')][_0x03a2('0x14')]);}else{logger[_0x03a2('0xc')](_0x03a2('0xd'),_0x57e64d,_0x03a2('0xe'));_0x509a6d(_0x257950[_0x03a2('0x15')][_0x03a2('0x14')]);}})['catch'](function(_0x5c87ba){logger[_0x03a2('0x12')](_0x03a2('0xd'),_0x57e64d,_0x5c87ba);_0x678093(_0x5c87ba);});});} \ No newline at end of file +var _0x8592=['JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code'];(function(_0x55fc87,_0x13caf0){var _0x3199c4=function(_0xfe2cf0){while(--_0xfe2cf0){_0x55fc87['push'](_0x55fc87['shift']());}};_0x3199c4(++_0x13caf0);}(_0x8592,0x101));var _0x2859=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x8592[_0x3de7e0];return _0x11d0b3;};'use strict';var _=require(_0x2859('0x0'));var util=require(_0x2859('0x1'));var moment=require(_0x2859('0x2'));var BPromise=require(_0x2859('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2859('0x4'));var db=require(_0x2859('0x5'))['db'];var utils=require(_0x2859('0x6'));var logger=require(_0x2859('0x7'))(_0x2859('0x8'));var config=require(_0x2859('0x9'));var jayson=require(_0x2859('0xa'));var client=jayson[_0x2859('0xb')][_0x2859('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15bf99,_0xf8d7fc,_0x414cde){return new BPromise(function(_0x43834e,_0x4bee4e){return client['request'](_0x15bf99,_0x414cde)[_0x2859('0xd')](function(_0x4420f6){logger[_0x2859('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xf8d7fc,_0x2859('0xf'));logger[_0x2859('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xf8d7fc,_0x2859('0xf'),JSON['stringify'](_0x4420f6));if(_0x4420f6[_0x2859('0x11')]){if(_0x4420f6[_0x2859('0x11')][_0x2859('0x12')]===0x1f4){logger[_0x2859('0x11')](_0x2859('0x13'),_0xf8d7fc,_0x4420f6['error']['message']);return _0x4bee4e(_0x4420f6[_0x2859('0x11')]['message']);}logger[_0x2859('0x11')](_0x2859('0x13'),_0xf8d7fc,_0x4420f6[_0x2859('0x11')][_0x2859('0x14')]);return _0x43834e(_0x4420f6[_0x2859('0x11')][_0x2859('0x14')]);}else{logger[_0x2859('0xe')](_0x2859('0x13'),_0xf8d7fc,_0x2859('0xf'));_0x43834e(_0x4420f6[_0x2859('0x15')]['message']);}})[_0x2859('0x16')](function(_0x57bf99){logger[_0x2859('0x11')](_0x2859('0x13'),_0xf8d7fc,_0x57bf99);_0x4bee4e(_0x57bf99);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 857e816..c0068c8 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 _0x7aa6=['/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','/:id/answers'];(function(_0x3b5264,_0x1d1b8e){var _0x24f49b=function(_0xba3019){while(--_0xba3019){_0x3b5264['push'](_0x3b5264['shift']());}};_0x24f49b(++_0x1d1b8e);}(_0x7aa6,0x74));var _0x67aa=function(_0x5485b9,_0x3e3deb){_0x5485b9=_0x5485b9-0x0;var _0x3def88=_0x7aa6[_0x5485b9];return _0x3def88;};'use strict';var multer=require(_0x67aa('0x0'));var util=require('util');var path=require(_0x67aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x67aa('0x2'));var router=express['Router']();var auth=require(_0x67aa('0x3'));var interaction=require(_0x67aa('0x4'));var config=require(_0x67aa('0x5'));var controller=require(_0x67aa('0x6'));router['get']('/',auth[_0x67aa('0x7')](),controller[_0x67aa('0x8')]);router[_0x67aa('0x9')](_0x67aa('0xa'),auth[_0x67aa('0x7')](),controller[_0x67aa('0xb')]);router[_0x67aa('0x9')](_0x67aa('0xc'),auth[_0x67aa('0x7')](),controller['getSessions']);router[_0x67aa('0x9')](_0x67aa('0xd'),auth[_0x67aa('0x7')](),controller['getAnswers']);router['get'](_0x67aa('0xe'),auth['isAuthenticated'](),timeout(_0x67aa('0xf')),controller[_0x67aa('0x10')]);router[_0x67aa('0x11')]('/',auth['isAuthenticated'](),controller[_0x67aa('0x12')]);router['post'](_0x67aa('0x13'),auth[_0x67aa('0x7')](),controller[_0x67aa('0x14')]);router[_0x67aa('0x15')]('/:id',auth[_0x67aa('0x7')](),controller[_0x67aa('0x16')]);router[_0x67aa('0x17')]('/:id',auth[_0x67aa('0x7')](),controller[_0x67aa('0x18')]);module[_0x67aa('0x19')]=router; \ No newline at end of file +var _0xb89f=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util'];(function(_0x41e0b5,_0x5ff982){var _0x17a942=function(_0xc93163){while(--_0xc93163){_0x41e0b5['push'](_0x41e0b5['shift']());}};_0x17a942(++_0x5ff982);}(_0xb89f,0x16a));var _0xfb89=function(_0x5e18fc,_0x1f4cab){_0x5e18fc=_0x5e18fc-0x0;var _0x563582=_0xb89f[_0x5e18fc];return _0x563582;};'use strict';var multer=require(_0xfb89('0x0'));var util=require(_0xfb89('0x1'));var path=require(_0xfb89('0x2'));var timeout=require(_0xfb89('0x3'));var express=require('express');var router=express[_0xfb89('0x4')]();var auth=require(_0xfb89('0x5'));var interaction=require(_0xfb89('0x6'));var config=require(_0xfb89('0x7'));var controller=require(_0xfb89('0x8'));router[_0xfb89('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb89('0xa')]);router['get'](_0xfb89('0xb'),auth[_0xfb89('0xc')](),controller['show']);router[_0xfb89('0x9')]('/:id/sessions',auth[_0xfb89('0xc')](),controller[_0xfb89('0xd')]);router[_0xfb89('0x9')](_0xfb89('0xe'),auth[_0xfb89('0xc')](),controller[_0xfb89('0xf')]);router[_0xfb89('0x9')](_0xfb89('0x10'),auth[_0xfb89('0xc')](),timeout(_0xfb89('0x11')),controller[_0xfb89('0x12')]);router['post']('/',auth[_0xfb89('0xc')](),controller[_0xfb89('0x13')]);router[_0xfb89('0x14')](_0xfb89('0x15'),auth[_0xfb89('0xc')](),controller[_0xfb89('0x16')]);router[_0xfb89('0x17')](_0xfb89('0xb'),auth[_0xfb89('0xc')](),controller[_0xfb89('0x18')]);router[_0xfb89('0x19')](_0xfb89('0xb'),auth[_0xfb89('0xc')](),controller[_0xfb89('0x1a')]);module[_0xfb89('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1a6b1ca..50eeecb 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 _0xc7be=['format','getDataValue','name','BOOLEAN','lodash','exports','STRING','TEXT','long','setDataValue','formData'];(function(_0xfd0f2a,_0x53ca7c){var _0x1705b7=function(_0x2fdecd){while(--_0x2fdecd){_0xfd0f2a['push'](_0xfd0f2a['shift']());}};_0x1705b7(++_0x53ca7c);}(_0xc7be,0xf6));var _0xec7b=function(_0x384033,_0x5421ea){_0x384033=_0x384033-0x0;var _0x101e0f=_0xc7be[_0x384033];return _0x101e0f;};'use strict';var Sequelize=require('sequelize');var _=require(_0xec7b('0x0'));var util=require('util');module[_0xec7b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xec7b('0x2')]},'formData':{'type':Sequelize[_0xec7b('0x3')](_0xec7b('0x4')),'set':function(_0x9a6e0d){if(_['isObjectLike'](_0x9a6e0d)){this[_0xec7b('0x5')](_0xec7b('0x6'),JSON['stringify'](_0x9a6e0d));}else if(_['isString'](_0x9a6e0d)){this[_0xec7b('0x5')](_0xec7b('0x6'),_0x9a6e0d);}else{this[_0xec7b('0x5')](_0xec7b('0x6'),util[_0xec7b('0x7')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xec7b('0x8')](_0xec7b('0x9'))||'',this[_0xec7b('0x8')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xec7b('0xa')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xec7b('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xdecb=['description','BOOLEAN','sequelize','util','exports','name','long','isObjectLike','stringify','isString','setDataValue','getDataValue'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xdecb,0xe6));var _0xbdec=function(_0x1a1fcb,_0x54fe77){_0x1a1fcb=_0x1a1fcb-0x0;var _0x1b1b80=_0xdecb[_0x1a1fcb];return _0x1b1b80;};'use strict';var Sequelize=require(_0xbdec('0x0'));var _=require('lodash');var util=require(_0xbdec('0x1'));module[_0xbdec('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xbdec('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xbdec('0x4')),'set':function(_0x424f4a){if(_[_0xbdec('0x5')](_0x424f4a)){this['setDataValue']('formData',JSON[_0xbdec('0x6')](_0x424f4a));}else if(_[_0xbdec('0x7')](_0x424f4a)){this[_0xbdec('0x8')]('formData',_0x424f4a);}else{this[_0xbdec('0x8')]('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xbdec('0x9')]('name')||'',this[_0xbdec('0x9')](_0xbdec('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xbdec('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index b67b712..c96afc4 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 _0xb399=['toString','indexOf','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','Projects','UserProfileResource','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','get','omit','updatedAt','userProfileId','autoAssociation','update','getSessions','findOne','JscriptySessionReport','pick','ProjectId','findAll','getAnswers','number','fromCharCode'];(function(_0x15e179,_0x447b5a){var _0x1da9a=function(_0x5c8af6){while(--_0x5c8af6){_0x15e179['push'](_0x15e179['shift']());}};_0x1da9a(++_0x447b5a);}(_0xb399,0x8c));var _0x9b39=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xb399[_0x3b19ea];return _0x40ece9;};'use strict';var pdf=require(_0x9b39('0x0'));var emlformat=require(_0x9b39('0x1'));var rimraf=require(_0x9b39('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b39('0x3'));var rp=require(_0x9b39('0x4'));var moment=require(_0x9b39('0x5'));var BPromise=require(_0x9b39('0x6'));var Mustache=require('mustache');var util=require(_0x9b39('0x7'));var path=require(_0x9b39('0x8'));var sox=require('sox');var csv=require(_0x9b39('0x9'));var ejs=require(_0x9b39('0xa'));var fs=require('fs');var _=require(_0x9b39('0xb'));var squel=require('squel');var crypto=require(_0x9b39('0xc'));var jsforce=require(_0x9b39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9b39('0x9'));var querystring=require(_0x9b39('0xe'));var Papa=require(_0x9b39('0xf'));var Redis=require(_0x9b39('0x10'));var authService=require(_0x9b39('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9b39('0x12'));var hardwareService=require(_0x9b39('0x13'));var logger=require(_0x9b39('0x14'))('api');var utils=require(_0x9b39('0x15'));var config=require(_0x9b39('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53c551,_0x5ee7df){_0x5ee7df=_0x5ee7df||0xcc;return function(_0x1d96d4){if(_0x1d96d4){return _0x53c551[_0x9b39('0x17')](_0x5ee7df);}return _0x53c551[_0x9b39('0x18')](_0x5ee7df)[_0x9b39('0x19')]();};}function respondWithResult(_0x226fff,_0x2e811c){_0x2e811c=_0x2e811c||0xc8;return function(_0x2d4b18){if(_0x2d4b18){return _0x226fff['status'](_0x2e811c)[_0x9b39('0x1a')](_0x2d4b18);}};}function respondWithFilteredResult(_0x391c4f,_0x4aab56){return function(_0x33f8f8){if(_0x33f8f8){var _0x22653b=_0x33f8f8[_0x9b39('0x1b')],_0x2771ec=_0x4aab56[_0x9b39('0x1c')],_0x3089b7=_0x4aab56['offset']+_0x4aab56[_0x9b39('0x1d')],_0x507f22;if(_0x3089b7>=_0x22653b){_0x3089b7=_0x22653b;_0x507f22=0xc8;}else{_0x507f22=0xce;}_0x391c4f[_0x9b39('0x18')](_0x507f22);return _0x391c4f[_0x9b39('0x1e')]('Content-Range',_0x2771ec+'-'+_0x3089b7+'/'+_0x22653b)[_0x9b39('0x1a')](_0x33f8f8);}return null;};}function patchUpdates(_0x2df004){return function(_0x391e56){try{jsonpatch[_0x9b39('0x1f')](_0x391e56,_0x2df004,!![]);}catch(_0x4265be){return BPromise[_0x9b39('0x20')](_0x4265be);}return _0x391e56['save']();};}function saveUpdates(_0x261dd7,_0x292065){return function(_0xedaad){if(_0xedaad){return _0xedaad['update'](_0x261dd7)[_0x9b39('0x21')](function(_0xb3b10c){return _0xb3b10c;});}return null;};}function removeEntity(_0x2240ba,_0x399762){return function(_0x454e46){if(_0x454e46){return _0x454e46[_0x9b39('0x22')]()['then'](function(){var _0x3fa6a8=_0x454e46['get']({'plain':!![]});var _0x2b75a3=_0x9b39('0x23');return db[_0x9b39('0x24')][_0x9b39('0x22')]({'where':{'type':_0x2b75a3,'resourceId':_0x3fa6a8['id']}})[_0x9b39('0x21')](function(){return _0x454e46;});})[_0x9b39('0x21')](function(){_0x2240ba[_0x9b39('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461020,_0x1741fe){return function(_0x1e6a26){if(!_0x1e6a26){_0x461020[_0x9b39('0x17')](0x194);}return _0x1e6a26;};}function handleError(_0x70f25a,_0x4d9626){_0x4d9626=_0x4d9626||0x1f4;return function(_0x22a0eb){logger[_0x9b39('0x25')](_0x22a0eb[_0x9b39('0x26')]);if(_0x22a0eb[_0x9b39('0x27')]){delete _0x22a0eb[_0x9b39('0x27')];}_0x70f25a[_0x9b39('0x18')](_0x4d9626)[_0x9b39('0x28')](_0x22a0eb);};}exports['index']=function(_0x2e9533,_0x1b3133){var _0x14c177={},_0x4d4937={},_0x1db663={'count':0x0,'rows':[]};var _0x2775fa=_[_0x9b39('0x29')](db[_0x9b39('0x2a')][_0x9b39('0x2b')],function(_0x54a135){return{'name':_0x54a135[_0x9b39('0x2c')],'type':_0x54a135['type'][_0x9b39('0x2d')]};});_0x4d4937['model']=_[_0x9b39('0x29')](_0x2775fa,_0x9b39('0x27'));_0x4d4937[_0x9b39('0x2e')]=_[_0x9b39('0x2f')](_0x2e9533[_0x9b39('0x2e')]);_0x4d4937[_0x9b39('0x30')]=_[_0x9b39('0x31')](_0x4d4937[_0x9b39('0x32')],_0x4d4937[_0x9b39('0x2e')]);_0x14c177[_0x9b39('0x33')]=_[_0x9b39('0x31')](_0x4d4937[_0x9b39('0x32')],qs[_0x9b39('0x34')](_0x2e9533[_0x9b39('0x2e')][_0x9b39('0x34')]));_0x14c177['attributes']=_0x14c177['attributes'][_0x9b39('0x35')]?_0x14c177[_0x9b39('0x33')]:_0x4d4937[_0x9b39('0x32')];if(!_0x2e9533[_0x9b39('0x2e')][_0x9b39('0x36')](_0x9b39('0x37'))){_0x14c177[_0x9b39('0x1d')]=qs['limit'](_0x2e9533['query'][_0x9b39('0x1d')]);_0x14c177[_0x9b39('0x1c')]=qs[_0x9b39('0x1c')](_0x2e9533['query'][_0x9b39('0x1c')]);}_0x14c177[_0x9b39('0x38')]=qs[_0x9b39('0x39')](_0x2e9533[_0x9b39('0x2e')]['sort']);_0x14c177[_0x9b39('0x3a')]=qs[_0x9b39('0x30')](_['pick'](_0x2e9533[_0x9b39('0x2e')],_0x4d4937[_0x9b39('0x30')]),_0x2775fa);if(_0x2e9533[_0x9b39('0x2e')]['filter']){_0x14c177[_0x9b39('0x3a')]=_['merge'](_0x14c177['where'],{'$or':_[_0x9b39('0x29')](_0x2775fa,function(_0x1d8805){if(_0x1d8805[_0x9b39('0x3b')]!==_0x9b39('0x3c')){var _0x4510a8={};_0x4510a8[_0x1d8805[_0x9b39('0x27')]]={'$like':'%'+_0x2e9533[_0x9b39('0x2e')][_0x9b39('0x3d')]+'%'};return _0x4510a8;}})});}_0x14c177=_[_0x9b39('0x3e')]({},_0x14c177,_0x2e9533['options']);var _0x18ecf9={'where':_0x14c177[_0x9b39('0x3a')]};return db[_0x9b39('0x2a')][_0x9b39('0x1b')](_0x18ecf9)[_0x9b39('0x21')](function(_0xe71ac6){_0x1db663[_0x9b39('0x1b')]=_0xe71ac6;if(_0x2e9533['query'][_0x9b39('0x3f')]){_0x14c177[_0x9b39('0x40')]=[{'all':!![]}];}return db[_0x9b39('0x2a')]['findAll'](_0x14c177);})[_0x9b39('0x21')](function(_0x7dcadd){_0x1db663[_0x9b39('0x41')]=_0x7dcadd;return _0x1db663;})[_0x9b39('0x21')](respondWithFilteredResult(_0x1b3133,_0x14c177))['catch'](handleError(_0x1b3133,null));};exports[_0x9b39('0x42')]=function(_0xfb83cc,_0x56020d){var _0x3fb509={'raw':![],'where':{'id':_0xfb83cc[_0x9b39('0x43')]['id']}},_0x42b3bf={};_0x42b3bf[_0x9b39('0x32')]=_[_0x9b39('0x2f')](db[_0x9b39('0x2a')]['rawAttributes']);_0x42b3bf[_0x9b39('0x2e')]=_[_0x9b39('0x2f')](_0xfb83cc[_0x9b39('0x2e')]);_0x42b3bf['filters']=_[_0x9b39('0x31')](_0x42b3bf[_0x9b39('0x32')],_0x42b3bf[_0x9b39('0x2e')]);_0x3fb509[_0x9b39('0x33')]=_[_0x9b39('0x31')](_0x42b3bf[_0x9b39('0x32')],qs[_0x9b39('0x34')](_0xfb83cc['query'][_0x9b39('0x34')]));_0x3fb509[_0x9b39('0x33')]=_0x3fb509[_0x9b39('0x33')][_0x9b39('0x35')]?_0x3fb509[_0x9b39('0x33')]:_0x42b3bf[_0x9b39('0x32')];if(_0xfb83cc[_0x9b39('0x2e')][_0x9b39('0x3f')]){_0x3fb509[_0x9b39('0x40')]=[{'all':!![]}];}_0x3fb509=_[_0x9b39('0x3e')]({},_0x3fb509,_0xfb83cc['options']);return db['JscriptyProject'][_0x9b39('0x44')](_0x3fb509)['then'](handleEntityNotFound(_0x56020d,null))['then'](respondWithResult(_0x56020d,null))[_0x9b39('0x45')](handleError(_0x56020d,null));};exports[_0x9b39('0x46')]=function(_0x5f2dd9,_0x8d6c24){return db['JscriptyProject'][_0x9b39('0x46')](_0x5f2dd9[_0x9b39('0x47')],{})[_0x9b39('0x21')](function(_0x14435d){var _0x25c430=_0x5f2dd9[_0x9b39('0x48')]['get']({'plain':!![]});if(!_0x25c430)throw new Error(_0x9b39('0x49'));if(_0x25c430[_0x9b39('0x4a')]==='user'){var _0xf9a292=_0x14435d['get']({'plain':!![]});var _0x29c8e4=_0x9b39('0x23');return db[_0x9b39('0x4b')][_0x9b39('0x44')]({'where':{'name':_0x29c8e4,'userProfileId':_0x25c430['userProfileId']},'raw':!![]})[_0x9b39('0x21')](function(_0x324e77){if(_0x324e77&&_0x324e77['autoAssociation']===0x0){return db[_0x9b39('0x24')][_0x9b39('0x46')]({'name':_0xf9a292[_0x9b39('0x27')],'resourceId':_0xf9a292['id'],'type':_0x324e77[_0x9b39('0x27')],'sectionId':_0x324e77['id']},{})[_0x9b39('0x21')](function(){return _0x14435d;});}else{return _0x14435d;}})[_0x9b39('0x45')](function(_0x3fe5d1){logger[_0x9b39('0x25')](_0x9b39('0x4c'),_0x3fe5d1);throw _0x3fe5d1;});}return _0x14435d;})[_0x9b39('0x21')](respondWithResult(_0x8d6c24,0xc9))[_0x9b39('0x45')](handleError(_0x8d6c24,null));};exports[_0x9b39('0x4d')]=function(_0x25f888,_0x3ef9d1){var _0x2d656f={'where':{'id':_0x25f888[_0x9b39('0x43')]['id']}},_0x269429={};_0x269429[_0x9b39('0x32')]=_[_0x9b39('0x2f')](db['JscriptyProject']['rawAttributes']);_0x2d656f[_0x9b39('0x33')]=_[_0x9b39('0x31')](_0x269429[_0x9b39('0x32')],qs['fields'](_0x25f888[_0x9b39('0x2e')]['fields']));_0x2d656f[_0x9b39('0x33')]=_0x2d656f['attributes']['length']?_0x2d656f[_0x9b39('0x33')]:_0x269429[_0x9b39('0x32')];if(_0x25f888['query'][_0x9b39('0x3f')]){_0x2d656f[_0x9b39('0x40')]=[{'all':!![]}];}_0x2d656f=_[_0x9b39('0x3e')]({},_0x2d656f,_0x25f888[_0x9b39('0x4e')]);return db[_0x9b39('0x2a')][_0x9b39('0x44')](_0x2d656f)['then'](handleEntityNotFound(_0x3ef9d1,null))[_0x9b39('0x21')](function(_0x277a7c){if(_0x277a7c){var _0x3f89ce=_0x277a7c[_0x9b39('0x4f')]({'plain':!![]});_0x3f89ce=qs[_0x9b39('0x50')](_0x3f89ce,['id','createdAt',_0x9b39('0x51')]);_0x25f888['body']=_['omit'](_0x25f888[_0x9b39('0x47')],['id','createdAt',_0x9b39('0x51')]);return db[_0x9b39('0x2a')][_0x9b39('0x46')](_[_0x9b39('0x3e')](_0x3f89ce,_0x25f888[_0x9b39('0x47')]),{'include':_0x25f888['query'][_0x9b39('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x14a6f0){var _0x52564c=_0x25f888[_0x9b39('0x48')][_0x9b39('0x4f')]({'plain':!![]});if(!_0x52564c)throw new Error(_0x9b39('0x49'));if(_0x52564c[_0x9b39('0x4a')]===_0x9b39('0x48')){var _0x396e46=_0x14a6f0[_0x9b39('0x4f')]({'plain':!![]});var _0x28f80a=_0x9b39('0x23');return db[_0x9b39('0x4b')][_0x9b39('0x44')]({'where':{'name':_0x28f80a,'userProfileId':_0x52564c[_0x9b39('0x52')]},'raw':!![]})['then'](function(_0x501c61){if(_0x501c61&&_0x501c61[_0x9b39('0x53')]===0x0){return db['UserProfileResource'][_0x9b39('0x46')]({'name':_0x396e46[_0x9b39('0x27')],'resourceId':_0x396e46['id'],'type':_0x501c61['name'],'sectionId':_0x501c61['id']},{})[_0x9b39('0x21')](function(){return _0x14a6f0;});}else{return _0x14a6f0;}})['catch'](function(_0x4c8b7a){logger[_0x9b39('0x25')](_0x9b39('0x4c'),_0x4c8b7a);throw _0x4c8b7a;});}return _0x14a6f0;});}})['then'](respondWithResult(_0x3ef9d1,0xc9))[_0x9b39('0x45')](handleError(_0x3ef9d1,null));};exports[_0x9b39('0x54')]=function(_0x4791d8,_0xdeee83){if(_0x4791d8['body']['id']){delete _0x4791d8[_0x9b39('0x47')]['id'];}return db[_0x9b39('0x2a')][_0x9b39('0x44')]({'where':{'id':_0x4791d8[_0x9b39('0x43')]['id']}})[_0x9b39('0x21')](handleEntityNotFound(_0xdeee83,null))['then'](saveUpdates(_0x4791d8[_0x9b39('0x47')],null))[_0x9b39('0x21')](respondWithResult(_0xdeee83,null))['catch'](handleError(_0xdeee83,null));};exports[_0x9b39('0x22')]=function(_0x5605d1,_0x35c08d){return db[_0x9b39('0x2a')][_0x9b39('0x44')]({'where':{'id':_0x5605d1[_0x9b39('0x43')]['id']}})['then'](handleEntityNotFound(_0x35c08d,null))['then'](removeEntity(_0x35c08d,null))[_0x9b39('0x45')](handleError(_0x35c08d,null));};exports[_0x9b39('0x55')]=function(_0x2914e5,_0x41d211,_0x5ca54a){var _0x22022e={'raw':!![],'where':{}};var _0x1d9755={};var _0x499240={'count':0x0,'rows':[]};return db[_0x9b39('0x2a')][_0x9b39('0x56')]({'where':{'id':_0x2914e5[_0x9b39('0x43')]['id']}})[_0x9b39('0x21')](handleEntityNotFound(_0x41d211,null))[_0x9b39('0x21')](function(_0x2bf881){if(_0x2bf881){_0x1d9755[_0x9b39('0x32')]=_[_0x9b39('0x2f')](db[_0x9b39('0x57')][_0x9b39('0x2b')]);_0x1d9755[_0x9b39('0x2e')]=_['keys'](_0x2914e5['query']);_0x1d9755[_0x9b39('0x30')]=_['intersection'](_0x1d9755[_0x9b39('0x32')],_0x1d9755[_0x9b39('0x2e')]);_0x22022e['attributes']=_[_0x9b39('0x31')](_0x1d9755[_0x9b39('0x32')],qs[_0x9b39('0x34')](_0x2914e5[_0x9b39('0x2e')][_0x9b39('0x34')]));_0x22022e[_0x9b39('0x33')]=_0x22022e['attributes']['length']?_0x22022e['attributes']:_0x1d9755[_0x9b39('0x32')];if(!_0x2914e5[_0x9b39('0x2e')][_0x9b39('0x36')](_0x9b39('0x37'))){_0x22022e[_0x9b39('0x1d')]=qs[_0x9b39('0x1d')](_0x2914e5[_0x9b39('0x2e')]['limit']);_0x22022e['offset']=qs[_0x9b39('0x1c')](_0x2914e5[_0x9b39('0x2e')][_0x9b39('0x1c')]);}_0x22022e[_0x9b39('0x38')]=qs['sort'](_0x2914e5['query'][_0x9b39('0x39')]);_0x22022e[_0x9b39('0x3a')]=qs[_0x9b39('0x30')](_[_0x9b39('0x58')](_0x2914e5[_0x9b39('0x2e')],_0x1d9755['filters']));_0x22022e[_0x9b39('0x3a')][_0x9b39('0x59')]=_0x2bf881['id'];if(_0x2914e5[_0x9b39('0x2e')]['filter']){_0x22022e[_0x9b39('0x3a')]=_[_0x9b39('0x3e')](_0x22022e[_0x9b39('0x3a')],{'$or':_[_0x9b39('0x29')](_0x22022e[_0x9b39('0x33')],function(_0x41b05a){var _0x746347={};_0x746347[_0x41b05a]={'$like':'%'+_0x2914e5['query']['filter']+'%'};return _0x746347;})});}_0x22022e=_[_0x9b39('0x3e')]({},_0x22022e,_0x2914e5['options']);return db['JscriptySessionReport'][_0x9b39('0x1b')]({'where':_0x22022e[_0x9b39('0x3a')]})[_0x9b39('0x21')](function(_0x16d869){_0x499240[_0x9b39('0x1b')]=_0x16d869;if(_0x2914e5['query'][_0x9b39('0x3f')]){_0x22022e['include']=[{'all':!![]}];}return db[_0x9b39('0x57')][_0x9b39('0x5a')](_0x22022e);})['then'](function(_0x578deb){_0x499240['rows']=_0x578deb;return _0x499240;});}})[_0x9b39('0x21')](respondWithFilteredResult(_0x41d211,_0x22022e))[_0x9b39('0x45')](handleError(_0x41d211,null));};exports[_0x9b39('0x5b')]=function(_0x5149ef,_0x36e534,_0x22c64e){var _0x3e3112={'raw':!![],'where':{}};var _0x271fd8={};var _0x24992f={'count':0x0,'rows':[]};return db[_0x9b39('0x2a')]['findOne']({'where':{'id':_0x5149ef[_0x9b39('0x43')]['id']}})['then'](handleEntityNotFound(_0x36e534,null))[_0x9b39('0x21')](function(_0x3c5628){if(_0x3c5628){_0x271fd8['model']=_[_0x9b39('0x2f')](db['JscriptyAnswerReport'][_0x9b39('0x2b')]);_0x271fd8[_0x9b39('0x2e')]=_[_0x9b39('0x2f')](_0x5149ef[_0x9b39('0x2e')]);_0x271fd8[_0x9b39('0x30')]=_['intersection'](_0x271fd8[_0x9b39('0x32')],_0x271fd8['query']);_0x3e3112['attributes']=_[_0x9b39('0x31')](_0x271fd8[_0x9b39('0x32')],qs[_0x9b39('0x34')](_0x5149ef[_0x9b39('0x2e')]['fields']));_0x3e3112['attributes']=_0x3e3112[_0x9b39('0x33')][_0x9b39('0x35')]?_0x3e3112[_0x9b39('0x33')]:_0x271fd8[_0x9b39('0x32')];if(!_0x5149ef[_0x9b39('0x2e')]['hasOwnProperty'](_0x9b39('0x37'))){_0x3e3112['limit']=qs['limit'](_0x5149ef[_0x9b39('0x2e')][_0x9b39('0x1d')]);_0x3e3112['offset']=qs[_0x9b39('0x1c')](_0x5149ef[_0x9b39('0x2e')][_0x9b39('0x1c')]);}_0x3e3112['order']=qs[_0x9b39('0x39')](_0x5149ef[_0x9b39('0x2e')][_0x9b39('0x39')]);_0x3e3112[_0x9b39('0x3a')]=qs[_0x9b39('0x30')](_['pick'](_0x5149ef['query'],_0x271fd8[_0x9b39('0x30')]));_0x3e3112[_0x9b39('0x3a')][_0x9b39('0x59')]=_0x3c5628['id'];if(_0x5149ef['query']['filter']){_0x3e3112[_0x9b39('0x3a')]=_['merge'](_0x3e3112[_0x9b39('0x3a')],{'$or':_[_0x9b39('0x29')](_0x3e3112['attributes'],function(_0x4087d8){var _0x14c91f={};_0x14c91f[_0x4087d8]={'$like':'%'+_0x5149ef[_0x9b39('0x2e')][_0x9b39('0x3d')]+'%'};return _0x14c91f;})});}_0x3e3112=_['merge']({},_0x3e3112,_0x5149ef[_0x9b39('0x4e')]);return db['JscriptyAnswerReport']['count']({'where':_0x3e3112[_0x9b39('0x3a')]})['then'](function(_0x33037a){_0x24992f[_0x9b39('0x1b')]=_0x33037a;if(_0x5149ef[_0x9b39('0x2e')][_0x9b39('0x3f')]){_0x3e3112[_0x9b39('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x9b39('0x5a')](_0x3e3112);})[_0x9b39('0x21')](function(_0x27171b){_0x24992f[_0x9b39('0x41')]=_0x27171b;return _0x24992f;});}})[_0x9b39('0x21')](respondWithFilteredResult(_0x36e534,_0x3e3112))[_0x9b39('0x45')](handleError(_0x36e534,null));};function char(_0x188fd8){return _0x9b39('0x5c')===typeof _0x188fd8?String[_0x9b39('0x5d')][_0x9b39('0x1f')](null,arguments):_0x188fd8;}function needsEncapsulation(_0xdbd773){return!!_0xdbd773&&(_0xdbd773[_0x9b39('0x5e')]()[_0x9b39('0x5f')](char(0xd))>=0x0||_0xdbd773[_0x9b39('0x5e')]()['indexOf'](char(0xa))>=0x0||_0xdbd773[_0x9b39('0x5e')]()[_0x9b39('0x5f')](char(0x2c))>=0x0||_0xdbd773[_0x9b39('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1775aa){var _0x273373=char(0x22),_0x590718='\x5c'+char(0x22),_0x1f7ce1=_0x1775aa[_0x9b39('0x5e')]()['replace'](new RegExp(_0x273373,'g'),_0x590718);return _0x273373+_0x1f7ce1+_0x273373;}exports[_0x9b39('0x60')]=function(_0x5d047d,_0xd77f02,_0x1922ca){var _0x2f8747,_0x91d2c4;var _0x6442f0={'where':{'ProjectId':_0x5d047d[_0x9b39('0x43')]['id']}};if(_0x5d047d['query'][_0x9b39('0x61')]){_0x6442f0['where']['starttime']=JSON[_0x9b39('0x62')](_0x5d047d[_0x9b39('0x2e')][_0x9b39('0x61')]);}return db[_0x9b39('0x57')]['findAll'](_0x6442f0)[_0x9b39('0x21')](handleEntityNotFound(_0xd77f02,null))[_0x9b39('0x21')](function(_0x512668){if(_0x512668){_0x2f8747=_0x512668;return db[_0x9b39('0x63')][_0x9b39('0x5a')]({'where':{'SessionId':{'$in':_[_0x9b39('0x29')](_0x2f8747,'id')},'ProjectId':_0x5d047d['params']['id']},'order':_0x9b39('0x64')});}})[_0x9b39('0x21')](handleEntityNotFound(_0xd77f02,null))[_0x9b39('0x21')](function(_0x17495b){if(_0x17495b){_0x91d2c4=_0x17495b;var _0x2c1482={};for(var _0x217d7a=0x0,_0x436421=_0x91d2c4[_0x9b39('0x35')];_0x217d7a<_0x436421;_0x217d7a++){if(!_0x2c1482[_0x9b39('0x36')](_0x91d2c4[_0x217d7a][_0x9b39('0x65')])){_0x2c1482[_0x91d2c4[_0x217d7a]['questionId']]=needsEncapsulation(_0x91d2c4[_0x217d7a][_0x9b39('0x66')])?encapsulate(_0x91d2c4[_0x217d7a][_0x9b39('0x66')]):_0x91d2c4[_0x217d7a][_0x9b39('0x66')];}}var _0x49c781=[],_0x3d0c44={};for(var _0x4c9752=0x0,_0x39a377=_0x2f8747[_0x9b39('0x35')];_0x4c9752<_0x39a377;_0x4c9752++){_0x3d0c44={'ProjectId':_0x5d047d[_0x9b39('0x43')]['id'],'SessionId':_0x2f8747[_0x4c9752]['id'],'StartTime':moment(_0x2f8747[_0x4c9752][_0x9b39('0x67')])[_0x9b39('0x68')](_0x9b39('0x69'))};for(var _0x3106e7=0x0,_0x1fd4e7=_0x91d2c4[_0x9b39('0x35')];_0x3106e7<_0x1fd4e7;_0x3106e7++){if(_0x91d2c4[_0x3106e7][_0x9b39('0x6a')]==_0x2f8747[_0x4c9752]['id']&&_0x2c1482[_0x9b39('0x36')](_0x91d2c4[_0x3106e7][_0x9b39('0x65')])){_0x3d0c44[_0x2c1482[_0x91d2c4[_0x3106e7][_0x9b39('0x65')]]]=_0x91d2c4[_0x3106e7][_0x9b39('0x6b')];}}for(var _0x12e87a in _0x2c1482){if(!_0x3d0c44[_0x9b39('0x36')](_0x2c1482[_0x12e87a])){_0x3d0c44[_0x2c1482[_0x12e87a]]=null;}}_0x49c781['push'](_0x3d0c44);}return _0x49c781;}})[_0x9b39('0x21')](function(_0x117111){if(!_[_0x9b39('0x6c')](_0x117111)){var _0x2cffde=toCsv(_0x117111);var _0x54a4fe=Date[_0x9b39('0x6d')]();fs[_0x9b39('0x6e')](util['format'](_0x9b39('0x6f'),_0x5d047d[_0x9b39('0x43')]['id'],_0x54a4fe),_0x2cffde);_0xd77f02[_0x9b39('0x70')](_0x9b39('0x71'),_0x9b39('0x72')+util[_0x9b39('0x68')]('Jscripty_Project_%d_Summary_%s.csv',_0x5d047d[_0x9b39('0x43')]['id'],_0x54a4fe));_0xd77f02['setHeader']('Content-type',_0x9b39('0x73'));return _0xd77f02[_0x9b39('0x74')](util[_0x9b39('0x68')](_0x9b39('0x6f'),_0x5d047d[_0x9b39('0x43')]['id'],_0x54a4fe));}else{return _0xd77f02['sendStatus'](0xcc);}})[_0x9b39('0x45')](handleError(_0xd77f02,null));}; \ No newline at end of file +var _0x4074=['userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','autoAssociation','error','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','moment','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','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','then','get','Projects','destroy','name','send','index','map','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','JscriptyProject','count','includeAll','include','rows','show','params','find','create','body','user','role','UserProfileSection'];(function(_0x4c1385,_0x320dca){var _0x3ac45a=function(_0x26c664){while(--_0x26c664){_0x4c1385['push'](_0x4c1385['shift']());}};_0x3ac45a(++_0x320dca);}(_0x4074,0x18a));var _0x4407=function(_0x20b37f,_0x211c17){_0x20b37f=_0x20b37f-0x0;var _0x4e70fa=_0x4074[_0x20b37f];return _0x4e70fa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4407('0x0'));var rimraf=require(_0x4407('0x1'));var zipdir=require(_0x4407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4407('0x3'));var moment=require(_0x4407('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4407('0x5'));var util=require(_0x4407('0x6'));var path=require('path');var sox=require(_0x4407('0x7'));var csv=require(_0x4407('0x8'));var ejs=require(_0x4407('0x9'));var fs=require('fs');var _=require(_0x4407('0xa'));var squel=require(_0x4407('0xb'));var crypto=require(_0x4407('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4407('0xd'));var toCsv=require(_0x4407('0x8'));var querystring=require(_0x4407('0xe'));var Papa=require(_0x4407('0xf'));var Redis=require(_0x4407('0x10'));var authService=require(_0x4407('0x11'));var qs=require(_0x4407('0x12'));var as=require(_0x4407('0x13'));var hardwareService=require(_0x4407('0x14'));var logger=require(_0x4407('0x15'))('api');var utils=require(_0x4407('0x16'));var config=require(_0x4407('0x17'));var db=require(_0x4407('0x18'))['db'];function respondWithStatusCode(_0x355a43,_0x454008){_0x454008=_0x454008||0xcc;return function(_0x519c4a){if(_0x519c4a){return _0x355a43[_0x4407('0x19')](_0x454008);}return _0x355a43[_0x4407('0x1a')](_0x454008)[_0x4407('0x1b')]();};}function respondWithResult(_0x35edbb,_0x174c81){_0x174c81=_0x174c81||0xc8;return function(_0x139f7e){if(_0x139f7e){return _0x35edbb['status'](_0x174c81)[_0x4407('0x1c')](_0x139f7e);}};}function respondWithFilteredResult(_0x49fa21,_0x436569){return function(_0x3bd7b8){if(_0x3bd7b8){var _0x1049ff=_0x3bd7b8['count'],_0x4d82ba=_0x436569['offset'],_0xaac3e7=_0x436569[_0x4407('0x1d')]+_0x436569[_0x4407('0x1e')],_0x57d778;if(_0xaac3e7>=_0x1049ff){_0xaac3e7=_0x1049ff;_0x57d778=0xc8;}else{_0x57d778=0xce;}_0x49fa21['status'](_0x57d778);return _0x49fa21['set'](_0x4407('0x1f'),_0x4d82ba+'-'+_0xaac3e7+'/'+_0x1049ff)[_0x4407('0x1c')](_0x3bd7b8);}return null;};}function patchUpdates(_0x463901){return function(_0x588936){try{jsonpatch['apply'](_0x588936,_0x463901,!![]);}catch(_0xc10bbd){return BPromise[_0x4407('0x20')](_0xc10bbd);}return _0x588936[_0x4407('0x21')]();};}function saveUpdates(_0x5672fd,_0x80270d){return function(_0xb0d91b){if(_0xb0d91b){return _0xb0d91b[_0x4407('0x22')](_0x5672fd)[_0x4407('0x23')](function(_0x322701){return _0x322701;});}return null;};}function removeEntity(_0x242d27,_0x5eaa29){return function(_0x3c8012){if(_0x3c8012){return _0x3c8012['destroy']()['then'](function(){var _0x519fdf=_0x3c8012[_0x4407('0x24')]({'plain':!![]});var _0x9962ba=_0x4407('0x25');return db['UserProfileResource'][_0x4407('0x26')]({'where':{'type':_0x9962ba,'resourceId':_0x519fdf['id']}})[_0x4407('0x23')](function(){return _0x3c8012;});})['then'](function(){_0x242d27[_0x4407('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x496975,_0x54b979){return function(_0x11acae){if(!_0x11acae){_0x496975[_0x4407('0x19')](0x194);}return _0x11acae;};}function handleError(_0x287a6c,_0x11128b){_0x11128b=_0x11128b||0x1f4;return function(_0x1067aa){logger['error'](_0x1067aa['stack']);if(_0x1067aa[_0x4407('0x27')]){delete _0x1067aa[_0x4407('0x27')];}_0x287a6c['status'](_0x11128b)[_0x4407('0x28')](_0x1067aa);};}exports[_0x4407('0x29')]=function(_0x23ce02,_0x1559eb){var _0x45c7a0={},_0x30839c={},_0x5cf5ff={'count':0x0,'rows':[]};var _0x247f3c=_[_0x4407('0x2a')](db['JscriptyProject'][_0x4407('0x2b')],function(_0x24e478){return{'name':_0x24e478['fieldName'],'type':_0x24e478['type']['key']};});_0x30839c['model']=_[_0x4407('0x2a')](_0x247f3c,_0x4407('0x27'));_0x30839c[_0x4407('0x2c')]=_[_0x4407('0x2d')](_0x23ce02[_0x4407('0x2c')]);_0x30839c[_0x4407('0x2e')]=_[_0x4407('0x2f')](_0x30839c[_0x4407('0x30')],_0x30839c[_0x4407('0x2c')]);_0x45c7a0[_0x4407('0x31')]=_['intersection'](_0x30839c[_0x4407('0x30')],qs[_0x4407('0x32')](_0x23ce02[_0x4407('0x2c')]['fields']));_0x45c7a0['attributes']=_0x45c7a0[_0x4407('0x31')][_0x4407('0x33')]?_0x45c7a0[_0x4407('0x31')]:_0x30839c[_0x4407('0x30')];if(!_0x23ce02[_0x4407('0x2c')][_0x4407('0x34')](_0x4407('0x35'))){_0x45c7a0[_0x4407('0x1e')]=qs[_0x4407('0x1e')](_0x23ce02['query'][_0x4407('0x1e')]);_0x45c7a0[_0x4407('0x1d')]=qs[_0x4407('0x1d')](_0x23ce02['query'][_0x4407('0x1d')]);}_0x45c7a0[_0x4407('0x36')]=qs[_0x4407('0x37')](_0x23ce02['query'][_0x4407('0x37')]);_0x45c7a0[_0x4407('0x38')]=qs[_0x4407('0x2e')](_[_0x4407('0x39')](_0x23ce02[_0x4407('0x2c')],_0x30839c[_0x4407('0x2e')]),_0x247f3c);if(_0x23ce02[_0x4407('0x2c')][_0x4407('0x3a')]){_0x45c7a0[_0x4407('0x38')]=_[_0x4407('0x3b')](_0x45c7a0[_0x4407('0x38')],{'$or':_['map'](_0x247f3c,function(_0x1a1193){if(_0x1a1193['type']!=='VIRTUAL'){var _0x6e9f51={};_0x6e9f51[_0x1a1193[_0x4407('0x27')]]={'$like':'%'+_0x23ce02[_0x4407('0x2c')][_0x4407('0x3a')]+'%'};return _0x6e9f51;}})});}_0x45c7a0=_['merge']({},_0x45c7a0,_0x23ce02[_0x4407('0x3c')]);var _0x2d76d9={'where':_0x45c7a0[_0x4407('0x38')]};return db[_0x4407('0x3d')][_0x4407('0x3e')](_0x2d76d9)['then'](function(_0x5127ff){_0x5cf5ff[_0x4407('0x3e')]=_0x5127ff;if(_0x23ce02[_0x4407('0x2c')][_0x4407('0x3f')]){_0x45c7a0[_0x4407('0x40')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x45c7a0);})[_0x4407('0x23')](function(_0x138fab){_0x5cf5ff[_0x4407('0x41')]=_0x138fab;return _0x5cf5ff;})[_0x4407('0x23')](respondWithFilteredResult(_0x1559eb,_0x45c7a0))['catch'](handleError(_0x1559eb,null));};exports[_0x4407('0x42')]=function(_0xea28bb,_0x3a755e){var _0x5ecf2f={'raw':![],'where':{'id':_0xea28bb[_0x4407('0x43')]['id']}},_0x4e54ce={};_0x4e54ce['model']=_[_0x4407('0x2d')](db[_0x4407('0x3d')][_0x4407('0x2b')]);_0x4e54ce[_0x4407('0x2c')]=_[_0x4407('0x2d')](_0xea28bb[_0x4407('0x2c')]);_0x4e54ce['filters']=_[_0x4407('0x2f')](_0x4e54ce[_0x4407('0x30')],_0x4e54ce[_0x4407('0x2c')]);_0x5ecf2f[_0x4407('0x31')]=_['intersection'](_0x4e54ce[_0x4407('0x30')],qs[_0x4407('0x32')](_0xea28bb[_0x4407('0x2c')][_0x4407('0x32')]));_0x5ecf2f[_0x4407('0x31')]=_0x5ecf2f[_0x4407('0x31')][_0x4407('0x33')]?_0x5ecf2f[_0x4407('0x31')]:_0x4e54ce[_0x4407('0x30')];if(_0xea28bb['query'][_0x4407('0x3f')]){_0x5ecf2f[_0x4407('0x40')]=[{'all':!![]}];}_0x5ecf2f=_[_0x4407('0x3b')]({},_0x5ecf2f,_0xea28bb[_0x4407('0x3c')]);return db[_0x4407('0x3d')][_0x4407('0x44')](_0x5ecf2f)['then'](handleEntityNotFound(_0x3a755e,null))[_0x4407('0x23')](respondWithResult(_0x3a755e,null))['catch'](handleError(_0x3a755e,null));};exports[_0x4407('0x45')]=function(_0x28a26d,_0x20d472){return db[_0x4407('0x3d')][_0x4407('0x45')](_0x28a26d[_0x4407('0x46')],{})['then'](function(_0xe15dea){var _0x41c7b4=_0x28a26d[_0x4407('0x47')]['get']({'plain':!![]});if(!_0x41c7b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41c7b4[_0x4407('0x48')]===_0x4407('0x47')){var _0x364cf1=_0xe15dea['get']({'plain':!![]});var _0x198595=_0x4407('0x25');return db[_0x4407('0x49')][_0x4407('0x44')]({'where':{'name':_0x198595,'userProfileId':_0x41c7b4[_0x4407('0x4a')]},'raw':!![]})['then'](function(_0x522cb3){if(_0x522cb3&&_0x522cb3['autoAssociation']===0x0){return db[_0x4407('0x4b')][_0x4407('0x45')]({'name':_0x364cf1[_0x4407('0x27')],'resourceId':_0x364cf1['id'],'type':_0x522cb3[_0x4407('0x27')],'sectionId':_0x522cb3['id']},{})[_0x4407('0x23')](function(){return _0xe15dea;});}else{return _0xe15dea;}})[_0x4407('0x4c')](function(_0x1194e6){logger['error'](_0x4407('0x4d'),_0x1194e6);throw _0x1194e6;});}return _0xe15dea;})[_0x4407('0x23')](respondWithResult(_0x20d472,0xc9))[_0x4407('0x4c')](handleError(_0x20d472,null));};exports['clone']=function(_0x372153,_0x4503b7){var _0x491f35={'where':{'id':_0x372153[_0x4407('0x43')]['id']}},_0x1c5068={};_0x1c5068[_0x4407('0x30')]=_[_0x4407('0x2d')](db['JscriptyProject']['rawAttributes']);_0x491f35[_0x4407('0x31')]=_[_0x4407('0x2f')](_0x1c5068['model'],qs[_0x4407('0x32')](_0x372153[_0x4407('0x2c')]['fields']));_0x491f35[_0x4407('0x31')]=_0x491f35[_0x4407('0x31')]['length']?_0x491f35[_0x4407('0x31')]:_0x1c5068[_0x4407('0x30')];if(_0x372153[_0x4407('0x2c')][_0x4407('0x3f')]){_0x491f35[_0x4407('0x40')]=[{'all':!![]}];}_0x491f35=_['merge']({},_0x491f35,_0x372153[_0x4407('0x3c')]);return db[_0x4407('0x3d')][_0x4407('0x44')](_0x491f35)[_0x4407('0x23')](handleEntityNotFound(_0x4503b7,null))[_0x4407('0x23')](function(_0x3040e3){if(_0x3040e3){var _0x4d0974=_0x3040e3[_0x4407('0x24')]({'plain':!![]});_0x4d0974=qs[_0x4407('0x4e')](_0x4d0974,['id',_0x4407('0x4f'),_0x4407('0x50')]);_0x372153[_0x4407('0x46')]=_[_0x4407('0x4e')](_0x372153[_0x4407('0x46')],['id','createdAt',_0x4407('0x50')]);return db[_0x4407('0x3d')][_0x4407('0x45')](_[_0x4407('0x3b')](_0x4d0974,_0x372153['body']),{'include':_0x372153[_0x4407('0x2c')][_0x4407('0x3f')]?[{'all':!![]}]:undefined})[_0x4407('0x23')](function(_0x516160){var _0x840f78=_0x372153[_0x4407('0x47')][_0x4407('0x24')]({'plain':!![]});if(!_0x840f78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x840f78[_0x4407('0x48')]===_0x4407('0x47')){var _0x35ea1e=_0x516160[_0x4407('0x24')]({'plain':!![]});var _0x2282ca=_0x4407('0x25');return db['UserProfileSection'][_0x4407('0x44')]({'where':{'name':_0x2282ca,'userProfileId':_0x840f78['userProfileId']},'raw':!![]})[_0x4407('0x23')](function(_0x26830f){if(_0x26830f&&_0x26830f[_0x4407('0x51')]===0x0){return db[_0x4407('0x4b')][_0x4407('0x45')]({'name':_0x35ea1e['name'],'resourceId':_0x35ea1e['id'],'type':_0x26830f[_0x4407('0x27')],'sectionId':_0x26830f['id']},{})[_0x4407('0x23')](function(){return _0x516160;});}else{return _0x516160;}})['catch'](function(_0x3424c9){logger[_0x4407('0x52')](_0x4407('0x4d'),_0x3424c9);throw _0x3424c9;});}return _0x516160;});}})[_0x4407('0x23')](respondWithResult(_0x4503b7,0xc9))['catch'](handleError(_0x4503b7,null));};exports[_0x4407('0x22')]=function(_0x47bd41,_0x5bf17d){if(_0x47bd41[_0x4407('0x46')]['id']){delete _0x47bd41[_0x4407('0x46')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x47bd41[_0x4407('0x43')]['id']}})['then'](handleEntityNotFound(_0x5bf17d,null))['then'](saveUpdates(_0x47bd41[_0x4407('0x46')],null))[_0x4407('0x23')](respondWithResult(_0x5bf17d,null))[_0x4407('0x4c')](handleError(_0x5bf17d,null));};exports[_0x4407('0x26')]=function(_0x3d5360,_0xc4078a){return db['JscriptyProject'][_0x4407('0x44')]({'where':{'id':_0x3d5360[_0x4407('0x43')]['id']}})[_0x4407('0x23')](handleEntityNotFound(_0xc4078a,null))[_0x4407('0x23')](removeEntity(_0xc4078a,null))[_0x4407('0x4c')](handleError(_0xc4078a,null));};exports[_0x4407('0x53')]=function(_0x100e7a,_0x361e73,_0x563175){var _0x120ce0={'raw':!![],'where':{}};var _0x4846dd={};var _0x16b2fc={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x4407('0x54')]({'where':{'id':_0x100e7a['params']['id']}})[_0x4407('0x23')](handleEntityNotFound(_0x361e73,null))['then'](function(_0x4f9fb5){if(_0x4f9fb5){_0x4846dd[_0x4407('0x30')]=_['keys'](db[_0x4407('0x55')][_0x4407('0x2b')]);_0x4846dd[_0x4407('0x2c')]=_[_0x4407('0x2d')](_0x100e7a[_0x4407('0x2c')]);_0x4846dd[_0x4407('0x2e')]=_[_0x4407('0x2f')](_0x4846dd['model'],_0x4846dd[_0x4407('0x2c')]);_0x120ce0[_0x4407('0x31')]=_[_0x4407('0x2f')](_0x4846dd[_0x4407('0x30')],qs[_0x4407('0x32')](_0x100e7a['query'][_0x4407('0x32')]));_0x120ce0[_0x4407('0x31')]=_0x120ce0[_0x4407('0x31')]['length']?_0x120ce0[_0x4407('0x31')]:_0x4846dd[_0x4407('0x30')];if(!_0x100e7a[_0x4407('0x2c')]['hasOwnProperty'](_0x4407('0x35'))){_0x120ce0[_0x4407('0x1e')]=qs[_0x4407('0x1e')](_0x100e7a[_0x4407('0x2c')][_0x4407('0x1e')]);_0x120ce0[_0x4407('0x1d')]=qs[_0x4407('0x1d')](_0x100e7a[_0x4407('0x2c')][_0x4407('0x1d')]);}_0x120ce0['order']=qs[_0x4407('0x37')](_0x100e7a['query'][_0x4407('0x37')]);_0x120ce0[_0x4407('0x38')]=qs['filters'](_[_0x4407('0x39')](_0x100e7a[_0x4407('0x2c')],_0x4846dd[_0x4407('0x2e')]));_0x120ce0['where'][_0x4407('0x56')]=_0x4f9fb5['id'];if(_0x100e7a['query'][_0x4407('0x3a')]){_0x120ce0[_0x4407('0x38')]=_[_0x4407('0x3b')](_0x120ce0[_0x4407('0x38')],{'$or':_['map'](_0x120ce0[_0x4407('0x31')],function(_0x511136){var _0xb5993={};_0xb5993[_0x511136]={'$like':'%'+_0x100e7a[_0x4407('0x2c')][_0x4407('0x3a')]+'%'};return _0xb5993;})});}_0x120ce0=_[_0x4407('0x3b')]({},_0x120ce0,_0x100e7a[_0x4407('0x3c')]);return db['JscriptySessionReport'][_0x4407('0x3e')]({'where':_0x120ce0['where']})[_0x4407('0x23')](function(_0x20bf49){_0x16b2fc[_0x4407('0x3e')]=_0x20bf49;if(_0x100e7a[_0x4407('0x2c')][_0x4407('0x3f')]){_0x120ce0['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4407('0x57')](_0x120ce0);})['then'](function(_0x3cc1f4){_0x16b2fc[_0x4407('0x41')]=_0x3cc1f4;return _0x16b2fc;});}})[_0x4407('0x23')](respondWithFilteredResult(_0x361e73,_0x120ce0))[_0x4407('0x4c')](handleError(_0x361e73,null));};exports[_0x4407('0x58')]=function(_0x2d7c97,_0x4eec07,_0x289e29){var _0x5b295e={'raw':!![],'where':{}};var _0x23c6b2={};var _0xd906d4={'count':0x0,'rows':[]};return db[_0x4407('0x3d')]['findOne']({'where':{'id':_0x2d7c97[_0x4407('0x43')]['id']}})[_0x4407('0x23')](handleEntityNotFound(_0x4eec07,null))[_0x4407('0x23')](function(_0x3a1413){if(_0x3a1413){_0x23c6b2['model']=_[_0x4407('0x2d')](db['JscriptyAnswerReport'][_0x4407('0x2b')]);_0x23c6b2[_0x4407('0x2c')]=_[_0x4407('0x2d')](_0x2d7c97[_0x4407('0x2c')]);_0x23c6b2[_0x4407('0x2e')]=_['intersection'](_0x23c6b2['model'],_0x23c6b2[_0x4407('0x2c')]);_0x5b295e['attributes']=_[_0x4407('0x2f')](_0x23c6b2[_0x4407('0x30')],qs['fields'](_0x2d7c97['query'][_0x4407('0x32')]));_0x5b295e[_0x4407('0x31')]=_0x5b295e[_0x4407('0x31')][_0x4407('0x33')]?_0x5b295e[_0x4407('0x31')]:_0x23c6b2[_0x4407('0x30')];if(!_0x2d7c97[_0x4407('0x2c')][_0x4407('0x34')]('nolimit')){_0x5b295e[_0x4407('0x1e')]=qs[_0x4407('0x1e')](_0x2d7c97[_0x4407('0x2c')]['limit']);_0x5b295e[_0x4407('0x1d')]=qs[_0x4407('0x1d')](_0x2d7c97[_0x4407('0x2c')][_0x4407('0x1d')]);}_0x5b295e['order']=qs[_0x4407('0x37')](_0x2d7c97[_0x4407('0x2c')][_0x4407('0x37')]);_0x5b295e[_0x4407('0x38')]=qs[_0x4407('0x2e')](_[_0x4407('0x39')](_0x2d7c97[_0x4407('0x2c')],_0x23c6b2[_0x4407('0x2e')]));_0x5b295e[_0x4407('0x38')][_0x4407('0x56')]=_0x3a1413['id'];if(_0x2d7c97[_0x4407('0x2c')][_0x4407('0x3a')]){_0x5b295e['where']=_[_0x4407('0x3b')](_0x5b295e['where'],{'$or':_['map'](_0x5b295e[_0x4407('0x31')],function(_0x1c97a7){var _0x2203c7={};_0x2203c7[_0x1c97a7]={'$like':'%'+_0x2d7c97['query'][_0x4407('0x3a')]+'%'};return _0x2203c7;})});}_0x5b295e=_[_0x4407('0x3b')]({},_0x5b295e,_0x2d7c97[_0x4407('0x3c')]);return db[_0x4407('0x59')]['count']({'where':_0x5b295e['where']})[_0x4407('0x23')](function(_0x2a2728){_0xd906d4[_0x4407('0x3e')]=_0x2a2728;if(_0x2d7c97[_0x4407('0x2c')]['includeAll']){_0x5b295e[_0x4407('0x40')]=[{'all':!![]}];}return db[_0x4407('0x59')][_0x4407('0x57')](_0x5b295e);})[_0x4407('0x23')](function(_0x361b5d){_0xd906d4[_0x4407('0x41')]=_0x361b5d;return _0xd906d4;});}})['then'](respondWithFilteredResult(_0x4eec07,_0x5b295e))['catch'](handleError(_0x4eec07,null));};function char(_0x5b44f1){return _0x4407('0x5a')===typeof _0x5b44f1?String[_0x4407('0x5b')]['apply'](null,arguments):_0x5b44f1;}function needsEncapsulation(_0x421880){return!!_0x421880&&(_0x421880[_0x4407('0x5c')]()[_0x4407('0x5d')](char(0xd))>=0x0||_0x421880[_0x4407('0x5c')]()[_0x4407('0x5d')](char(0xa))>=0x0||_0x421880[_0x4407('0x5c')]()[_0x4407('0x5d')](char(0x2c))>=0x0||_0x421880['toString']()[_0x4407('0x5d')](char(0x22))>=0x0);}function encapsulate(_0xe2e0fa){var _0x26a982=char(0x22),_0x3091d6='\x5c'+char(0x22),_0x24f7bd=_0xe2e0fa[_0x4407('0x5c')]()['replace'](new RegExp(_0x26a982,'g'),_0x3091d6);return _0x26a982+_0x24f7bd+_0x26a982;}exports[_0x4407('0x5e')]=function(_0x24d279,_0x2a5423,_0x43575f){var _0x16d9f9,_0x3fd0c3;var _0x3400c7={'where':{'ProjectId':_0x24d279[_0x4407('0x43')]['id']}};if(_0x24d279[_0x4407('0x2c')][_0x4407('0x5f')]){_0x3400c7[_0x4407('0x38')][_0x4407('0x60')]=JSON[_0x4407('0x61')](_0x24d279['query'][_0x4407('0x5f')]);}return db['JscriptySessionReport'][_0x4407('0x57')](_0x3400c7)[_0x4407('0x23')](handleEntityNotFound(_0x2a5423,null))[_0x4407('0x23')](function(_0x28e79b){if(_0x28e79b){_0x16d9f9=_0x28e79b;return db[_0x4407('0x62')][_0x4407('0x57')]({'where':{'SessionId':{'$in':_[_0x4407('0x2a')](_0x16d9f9,'id')},'ProjectId':_0x24d279['params']['id']},'order':_0x4407('0x63')});}})['then'](handleEntityNotFound(_0x2a5423,null))[_0x4407('0x23')](function(_0x7d8bfc){if(_0x7d8bfc){_0x3fd0c3=_0x7d8bfc;var _0x243630={};for(var _0x26f725=0x0,_0x2d7b2b=_0x3fd0c3[_0x4407('0x33')];_0x26f725<_0x2d7b2b;_0x26f725++){if(!_0x243630[_0x4407('0x34')](_0x3fd0c3[_0x26f725][_0x4407('0x64')])){_0x243630[_0x3fd0c3[_0x26f725][_0x4407('0x64')]]=needsEncapsulation(_0x3fd0c3[_0x26f725][_0x4407('0x65')])?encapsulate(_0x3fd0c3[_0x26f725][_0x4407('0x65')]):_0x3fd0c3[_0x26f725][_0x4407('0x65')];}}var _0x4ba286=[],_0x594384={};for(var _0x2f0dff=0x0,_0x226c75=_0x16d9f9[_0x4407('0x33')];_0x2f0dff<_0x226c75;_0x2f0dff++){_0x594384={'ProjectId':_0x24d279['params']['id'],'SessionId':_0x16d9f9[_0x2f0dff]['id'],'StartTime':moment(_0x16d9f9[_0x2f0dff][_0x4407('0x60')])['format'](_0x4407('0x66'))};for(var _0x22ff3e=0x0,_0x2c658d=_0x3fd0c3[_0x4407('0x33')];_0x22ff3e<_0x2c658d;_0x22ff3e++){if(_0x3fd0c3[_0x22ff3e][_0x4407('0x67')]==_0x16d9f9[_0x2f0dff]['id']&&_0x243630[_0x4407('0x34')](_0x3fd0c3[_0x22ff3e][_0x4407('0x64')])){_0x594384[_0x243630[_0x3fd0c3[_0x22ff3e][_0x4407('0x64')]]]=_0x3fd0c3[_0x22ff3e][_0x4407('0x68')];}}for(var _0x5967ce in _0x243630){if(!_0x594384[_0x4407('0x34')](_0x243630[_0x5967ce])){_0x594384[_0x243630[_0x5967ce]]=null;}}_0x4ba286[_0x4407('0x69')](_0x594384);}return _0x4ba286;}})[_0x4407('0x23')](function(_0x2e31d4){if(!_['isEmpty'](_0x2e31d4)){var _0x5ea0f2=toCsv(_0x2e31d4);var _0x4210b7=Date[_0x4407('0x6a')]();fs[_0x4407('0x6b')](util['format'](_0x4407('0x6c'),_0x24d279[_0x4407('0x43')]['id'],_0x4210b7),_0x5ea0f2);_0x2a5423['setHeader'](_0x4407('0x6d'),_0x4407('0x6e')+util[_0x4407('0x6f')](_0x4407('0x70'),_0x24d279[_0x4407('0x43')]['id'],_0x4210b7));_0x2a5423[_0x4407('0x71')](_0x4407('0x72'),_0x4407('0x73'));return _0x2a5423[_0x4407('0x74')](util[_0x4407('0x6f')](_0x4407('0x6c'),_0x24d279[_0x4407('0x43')]['id'],_0x4210b7));}else{return _0x2a5423[_0x4407('0x19')](0xcc);}})['catch'](handleError(_0x2a5423,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 1742f68..714dd7d 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 _0x19ff=['../../config/environment','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x19ff,0xd0));var _0xf19f=function(_0x19ba19,_0x52203b){_0x19ba19=_0x19ba19-0x0;var _0x3bf5bc=_0x19ff[_0x19ba19];return _0x3bf5bc;};'use strict';var _=require(_0xf19f('0x0'));var util=require(_0xf19f('0x1'));var logger=require(_0xf19f('0x2'))('api');var moment=require(_0xf19f('0x3'));var BPromise=require(_0xf19f('0x4'));var rp=require(_0xf19f('0x5'));var fs=require('fs');var path=require(_0xf19f('0x6'));var rimraf=require(_0xf19f('0x7'));var config=require(_0xf19f('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x245108,_0x216d80){return _0x245108[_0xf19f('0x9')](_0xf19f('0xa'),attributes,{'tableName':_0xf19f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ce2=['rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ce2,0xc4));var _0x23ce=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x3ce2[_0x26b80e];return _0x84a8a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x23ce('0x0'))(_0x23ce('0x1'));var moment=require('moment');var BPromise=require(_0x23ce('0x2'));var rp=require(_0x23ce('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23ce('0x4'));var config=require(_0x23ce('0x5'));var attributes=require(_0x23ce('0x6'));module['exports']=function(_0x5e7710,_0x1466f2){return _0x5e7710[_0x23ce('0x7')](_0x23ce('0x8'),attributes,{'tableName':_0x23ce('0x9'),'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 9397f35..f99df94 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 _0xfecd=['request\x20sent','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfecd,0x193));var _0xdfec=function(_0x21a5bb,_0x248527){_0x21a5bb=_0x21a5bb-0x0;var _0x4891c8=_0xfecd[_0x21a5bb];return _0x4891c8;};'use strict';var _=require(_0xdfec('0x0'));var util=require(_0xdfec('0x1'));var moment=require('moment');var BPromise=require(_0xdfec('0x2'));var rs=require(_0xdfec('0x3'));var fs=require('fs');var Redis=require(_0xdfec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfec('0x5'));var logger=require(_0xdfec('0x6'))(_0xdfec('0x7'));var config=require(_0xdfec('0x8'));var jayson=require(_0xdfec('0x9'));var client=jayson[_0xdfec('0xa')][_0xdfec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x361aa2,_0x5ce8e4,_0x4783f7){return new BPromise(function(_0x10d420,_0x4f86c3){return client['request'](_0x361aa2,_0x4783f7)['then'](function(_0x4abe7b){logger[_0xdfec('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x5ce8e4,'request\x20sent');logger[_0xdfec('0xd')](_0xdfec('0xe'),_0x5ce8e4,_0xdfec('0xf'),JSON[_0xdfec('0x10')](_0x4abe7b));if(_0x4abe7b[_0xdfec('0x11')]){if(_0x4abe7b[_0xdfec('0x11')][_0xdfec('0x12')]===0x1f4){logger['error'](_0xdfec('0x13'),_0x5ce8e4,_0x4abe7b[_0xdfec('0x11')][_0xdfec('0x14')]);return _0x4f86c3(_0x4abe7b[_0xdfec('0x11')][_0xdfec('0x14')]);}logger[_0xdfec('0x11')](_0xdfec('0x13'),_0x5ce8e4,_0x4abe7b[_0xdfec('0x11')][_0xdfec('0x14')]);return _0x10d420(_0x4abe7b[_0xdfec('0x11')][_0xdfec('0x14')]);}else{logger[_0xdfec('0xc')](_0xdfec('0x13'),_0x5ce8e4,_0xdfec('0xf'));_0x10d420(_0x4abe7b['result'][_0xdfec('0x14')]);}})[_0xdfec('0x15')](function(_0x2584e4){logger[_0xdfec('0x11')](_0xdfec('0x13'),_0x5ce8e4,_0x2584e4);_0x4f86c3(_0x2584e4);});});} \ No newline at end of file +var _0x711b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x27b541,_0x3bbbf5){var _0x18c8ee=function(_0x1f5e39){while(--_0x1f5e39){_0x27b541['push'](_0x27b541['shift']());}};_0x18c8ee(++_0x3bbbf5);}(_0x711b,0x190));var _0xb711=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x711b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb711('0x0'));var util=require(_0xb711('0x1'));var moment=require(_0xb711('0x2'));var BPromise=require(_0xb711('0x3'));var rs=require(_0xb711('0x4'));var fs=require('fs');var Redis=require(_0xb711('0x5'));var db=require(_0xb711('0x6'))['db'];var utils=require(_0xb711('0x7'));var logger=require(_0xb711('0x8'))(_0xb711('0x9'));var config=require(_0xb711('0xa'));var jayson=require(_0xb711('0xb'));var client=jayson[_0xb711('0xc')][_0xb711('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1cb891,_0x4384c8,_0x2a75a0){return new BPromise(function(_0x578eb6,_0x5cdb05){return client[_0xb711('0xe')](_0x1cb891,_0x2a75a0)[_0xb711('0xf')](function(_0x97a389){logger[_0xb711('0x10')](_0xb711('0x11'),_0x4384c8,_0xb711('0x12'));logger[_0xb711('0x13')](_0xb711('0x14'),_0x4384c8,_0xb711('0x12'),JSON[_0xb711('0x15')](_0x97a389));if(_0x97a389[_0xb711('0x16')]){if(_0x97a389[_0xb711('0x16')][_0xb711('0x17')]===0x1f4){logger[_0xb711('0x16')](_0xb711('0x11'),_0x4384c8,_0x97a389[_0xb711('0x16')][_0xb711('0x18')]);return _0x5cdb05(_0x97a389['error'][_0xb711('0x18')]);}logger[_0xb711('0x16')]('JscriptyProject,\x20%s,\x20%s',_0x4384c8,_0x97a389[_0xb711('0x16')][_0xb711('0x18')]);return _0x578eb6(_0x97a389['error'][_0xb711('0x18')]);}else{logger[_0xb711('0x10')](_0xb711('0x11'),_0x4384c8,'request\x20sent');_0x578eb6(_0x97a389[_0xb711('0x19')][_0xb711('0x18')]);}})[_0xb711('0x1a')](function(_0x1cab79){logger[_0xb711('0x16')](_0xb711('0x11'),_0x4384c8,_0x1cab79);_0x5cdb05(_0x1cab79);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 08482be..27f402d 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 _0x6c4f=['./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x91afbb,_0xeadecf){var _0x34e3e0=function(_0x58c68e){while(--_0x58c68e){_0x91afbb['push'](_0x91afbb['shift']());}};_0x34e3e0(++_0xeadecf);}(_0x6c4f,0x7e));var _0xf6c4=function(_0x6031b0,_0x393f9e){_0x6031b0=_0x6031b0-0x0;var _0x23565a=_0x6c4f[_0x6031b0];return _0x23565a;};'use strict';var multer=require('multer');var util=require(_0xf6c4('0x0'));var path=require(_0xf6c4('0x1'));var timeout=require(_0xf6c4('0x2'));var express=require(_0xf6c4('0x3'));var router=express['Router']();var auth=require(_0xf6c4('0x4'));var interaction=require(_0xf6c4('0x5'));var config=require(_0xf6c4('0x6'));var controller=require(_0xf6c4('0x7'));router['get']('/',auth[_0xf6c4('0x8')](),controller[_0xf6c4('0x9')]);router[_0xf6c4('0xa')](_0xf6c4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xf6c4('0xa')](_0xf6c4('0xc'),auth['isAuthenticated'](),controller[_0xf6c4('0xd')]);router['post']('/',auth[_0xf6c4('0x8')](),controller[_0xf6c4('0xe')]);router[_0xf6c4('0xf')](_0xf6c4('0xc'),auth[_0xf6c4('0x8')](),controller['update']);router[_0xf6c4('0x10')](_0xf6c4('0xc'),auth[_0xf6c4('0x8')](),controller[_0xf6c4('0x11')]);module[_0xf6c4('0x12')]=router; \ No newline at end of file +var _0x8f12=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x65a0db,_0x55c5a0){var _0x987620=function(_0x23d53f){while(--_0x23d53f){_0x65a0db['push'](_0x65a0db['shift']());}};_0x987620(++_0x55c5a0);}(_0x8f12,0xdf));var _0x28f1=function(_0x2cbd58,_0x278e75){_0x2cbd58=_0x2cbd58-0x0;var _0x42ef2a=_0x8f12[_0x2cbd58];return _0x42ef2a;};'use strict';var multer=require(_0x28f1('0x0'));var util=require(_0x28f1('0x1'));var path=require(_0x28f1('0x2'));var timeout=require(_0x28f1('0x3'));var express=require(_0x28f1('0x4'));var router=express[_0x28f1('0x5')]();var auth=require(_0x28f1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x28f1('0x7'));var controller=require(_0x28f1('0x8'));router[_0x28f1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x28f1('0xa'),auth[_0x28f1('0xb')](),controller[_0x28f1('0xc')]);router[_0x28f1('0x9')](_0x28f1('0xd'),auth[_0x28f1('0xb')](),controller[_0x28f1('0xe')]);router[_0x28f1('0xf')]('/',auth[_0x28f1('0xb')](),controller[_0x28f1('0x10')]);router[_0x28f1('0x11')]('/:id',auth[_0x28f1('0xb')](),controller[_0x28f1('0x12')]);router[_0x28f1('0x13')](_0x28f1('0xd'),auth[_0x28f1('0xb')](),controller[_0x28f1('0x14')]);module[_0x28f1('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 2ad302e..db543dd 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 _0x92c8=['STRING','long','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x92c8,0x1b8));var _0x892c=function(_0x5bb8d8,_0x21a57f){_0x5bb8d8=_0x5bb8d8-0x0;var _0x34adbb=_0x92c8[_0x5bb8d8];return _0x34adbb;};'use strict';var Sequelize=require('sequelize');module[_0x892c('0x0')]={'question':{'type':Sequelize[_0x892c('0x1')]},'answer':{'type':Sequelize['TEXT'](_0x892c('0x2'))},'membername':{'type':Sequelize[_0x892c('0x1')]},'projectname':{'type':Sequelize[_0x892c('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x892c('0x1')]},'calleridname':{'type':Sequelize[_0x892c('0x1')]},'calleridnum':{'type':Sequelize[_0x892c('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d75=['long','STRING','TEXT'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0x5d75,0xe8));var _0x55d7=function(_0x12c8b5,_0x51283f){_0x12c8b5=_0x12c8b5-0x0;var _0x347026=_0x5d75[_0x12c8b5];return _0x347026;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x55d7('0x0')]},'answer':{'type':Sequelize[_0x55d7('0x1')](_0x55d7('0x2'))},'membername':{'type':Sequelize[_0x55d7('0x0')]},'projectname':{'type':Sequelize[_0x55d7('0x0')]},'queue':{'type':Sequelize[_0x55d7('0x0')]},'uniqueid':{'type':Sequelize[_0x55d7('0x0')]},'calleridname':{'type':Sequelize[_0x55d7('0x0')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x55d7('0x0')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index c703a0e..3099448 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 _0xc377=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','keys','include','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x3d441b,_0x22ff05){var _0xfc6c=function(_0x33c214){while(--_0x33c214){_0x3d441b['push'](_0x3d441b['shift']());}};_0xfc6c(++_0x22ff05);}(_0xc377,0x1e9));var _0x7c37=function(_0x2761aa,_0xc64f1c){_0x2761aa=_0x2761aa-0x0;var _0x2f9392=_0xc377[_0x2761aa];return _0x2f9392;};'use strict';var pdf=require(_0x7c37('0x0'));var emlformat=require(_0x7c37('0x1'));var rimraf=require(_0x7c37('0x2'));var zipdir=require(_0x7c37('0x3'));var jsonpatch=require(_0x7c37('0x4'));var rp=require(_0x7c37('0x5'));var moment=require(_0x7c37('0x6'));var BPromise=require(_0x7c37('0x7'));var Mustache=require('mustache');var util=require(_0x7c37('0x8'));var path=require(_0x7c37('0x9'));var sox=require(_0x7c37('0xa'));var csv=require(_0x7c37('0xb'));var ejs=require(_0x7c37('0xc'));var fs=require('fs');var _=require(_0x7c37('0xd'));var squel=require('squel');var crypto=require(_0x7c37('0xe'));var jsforce=require(_0x7c37('0xf'));var deskjs=require(_0x7c37('0x10'));var toCsv=require(_0x7c37('0xb'));var querystring=require('querystring');var Papa=require(_0x7c37('0x11'));var Redis=require('ioredis');var authService=require(_0x7c37('0x12'));var qs=require(_0x7c37('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c37('0x14'))('api');var utils=require(_0x7c37('0x15'));var config=require(_0x7c37('0x16'));var db=require(_0x7c37('0x17'))['db'];function respondWithStatusCode(_0x1dd997,_0x479ac0){_0x479ac0=_0x479ac0||0xcc;return function(_0x2fcce0){if(_0x2fcce0){return _0x1dd997[_0x7c37('0x18')](_0x479ac0);}return _0x1dd997[_0x7c37('0x19')](_0x479ac0)[_0x7c37('0x1a')]();};}function respondWithResult(_0x589795,_0x4c4957){_0x4c4957=_0x4c4957||0xc8;return function(_0xfaf465){if(_0xfaf465){return _0x589795[_0x7c37('0x19')](_0x4c4957)['json'](_0xfaf465);}};}function respondWithFilteredResult(_0x3eec39,_0x586986){return function(_0x470023){if(_0x470023){var _0x1d789f=_0x470023[_0x7c37('0x1b')],_0x1b300d=_0x586986[_0x7c37('0x1c')],_0x4f967d=_0x586986[_0x7c37('0x1c')]+_0x586986[_0x7c37('0x1d')],_0x30fefb;if(_0x4f967d>=_0x1d789f){_0x4f967d=_0x1d789f;_0x30fefb=0xc8;}else{_0x30fefb=0xce;}_0x3eec39['status'](_0x30fefb);return _0x3eec39[_0x7c37('0x1e')](_0x7c37('0x1f'),_0x1b300d+'-'+_0x4f967d+'/'+_0x1d789f)['json'](_0x470023);}return null;};}function patchUpdates(_0x15279f){return function(_0x504082){try{jsonpatch['apply'](_0x504082,_0x15279f,!![]);}catch(_0x80229b){return BPromise[_0x7c37('0x20')](_0x80229b);}return _0x504082['save']();};}function saveUpdates(_0x42c13d,_0xe1581d){return function(_0x1feee7){if(_0x1feee7){return _0x1feee7[_0x7c37('0x21')](_0x42c13d)[_0x7c37('0x22')](function(_0x520abe){return _0x520abe;});}return null;};}function removeEntity(_0x46455c,_0x21c779){return function(_0xd52571){if(_0xd52571){return _0xd52571[_0x7c37('0x23')]()[_0x7c37('0x22')](function(){_0x46455c[_0x7c37('0x19')](0xcc)[_0x7c37('0x1a')]();});}};}function handleEntityNotFound(_0x3f0260,_0x4afe9e){return function(_0x4c1ace){if(!_0x4c1ace){_0x3f0260[_0x7c37('0x18')](0x194);}return _0x4c1ace;};}function handleError(_0x1d11a7,_0x133be3){_0x133be3=_0x133be3||0x1f4;return function(_0x102db1){logger[_0x7c37('0x24')](_0x102db1[_0x7c37('0x25')]);if(_0x102db1['name']){delete _0x102db1[_0x7c37('0x26')];}_0x1d11a7[_0x7c37('0x19')](_0x133be3)[_0x7c37('0x27')](_0x102db1);};}exports['index']=function(_0x17eb6f,_0x3235f2){var _0x511c82={},_0x8e7bd4={},_0x2ea576={'count':0x0,'rows':[]};var _0x5afe78=_[_0x7c37('0x28')](db[_0x7c37('0x29')]['rawAttributes'],function(_0x333482){return{'name':_0x333482[_0x7c37('0x2a')],'type':_0x333482[_0x7c37('0x2b')][_0x7c37('0x2c')]};});_0x8e7bd4[_0x7c37('0x2d')]=_[_0x7c37('0x28')](_0x5afe78,'name');_0x8e7bd4['query']=_['keys'](_0x17eb6f['query']);_0x8e7bd4[_0x7c37('0x2e')]=_[_0x7c37('0x2f')](_0x8e7bd4[_0x7c37('0x2d')],_0x8e7bd4[_0x7c37('0x30')]);_0x511c82[_0x7c37('0x31')]=_[_0x7c37('0x2f')](_0x8e7bd4[_0x7c37('0x2d')],qs[_0x7c37('0x32')](_0x17eb6f['query'][_0x7c37('0x32')]));_0x511c82[_0x7c37('0x31')]=_0x511c82[_0x7c37('0x31')][_0x7c37('0x33')]?_0x511c82[_0x7c37('0x31')]:_0x8e7bd4['model'];if(!_0x17eb6f['query'][_0x7c37('0x34')]('nolimit')){_0x511c82[_0x7c37('0x1d')]=qs[_0x7c37('0x1d')](_0x17eb6f[_0x7c37('0x30')][_0x7c37('0x1d')]);_0x511c82['offset']=qs['offset'](_0x17eb6f[_0x7c37('0x30')]['offset']);}_0x511c82['order']=qs[_0x7c37('0x35')](_0x17eb6f['query']['sort']);_0x511c82[_0x7c37('0x36')]=qs[_0x7c37('0x2e')](_[_0x7c37('0x37')](_0x17eb6f[_0x7c37('0x30')],_0x8e7bd4['filters']),_0x5afe78);if(_0x17eb6f[_0x7c37('0x30')][_0x7c37('0x38')]){_0x511c82[_0x7c37('0x36')]=_[_0x7c37('0x39')](_0x511c82[_0x7c37('0x36')],{'$or':_['map'](_0x5afe78,function(_0xbe43c){if(_0xbe43c[_0x7c37('0x2b')]!=='VIRTUAL'){var _0x295dca={};_0x295dca[_0xbe43c[_0x7c37('0x26')]]={'$like':'%'+_0x17eb6f[_0x7c37('0x30')][_0x7c37('0x38')]+'%'};return _0x295dca;}})});}_0x511c82=_[_0x7c37('0x39')]({},_0x511c82,_0x17eb6f[_0x7c37('0x3a')]);var _0x5c65b0={'where':_0x511c82[_0x7c37('0x36')]};return db[_0x7c37('0x29')][_0x7c37('0x1b')](_0x5c65b0)[_0x7c37('0x22')](function(_0x1d0690){_0x2ea576[_0x7c37('0x1b')]=_0x1d0690;if(_0x17eb6f[_0x7c37('0x30')][_0x7c37('0x3b')]){_0x511c82['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7c37('0x3c')](_0x511c82);})[_0x7c37('0x22')](function(_0x4a4980){_0x2ea576[_0x7c37('0x3d')]=_0x4a4980;return _0x2ea576;})['then'](respondWithFilteredResult(_0x3235f2,_0x511c82))['catch'](handleError(_0x3235f2,null));};exports[_0x7c37('0x3e')]=function(_0x4aadb9,_0x514b82){var _0x984511={'raw':!![],'where':{'id':_0x4aadb9[_0x7c37('0x3f')]['id']}},_0x5c4a95={};_0x5c4a95[_0x7c37('0x2d')]=_['keys'](db['JscriptyQuestionReport'][_0x7c37('0x40')]);_0x5c4a95[_0x7c37('0x30')]=_[_0x7c37('0x41')](_0x4aadb9['query']);_0x5c4a95[_0x7c37('0x2e')]=_[_0x7c37('0x2f')](_0x5c4a95['model'],_0x5c4a95[_0x7c37('0x30')]);_0x984511[_0x7c37('0x31')]=_[_0x7c37('0x2f')](_0x5c4a95[_0x7c37('0x2d')],qs['fields'](_0x4aadb9[_0x7c37('0x30')][_0x7c37('0x32')]));_0x984511['attributes']=_0x984511['attributes']['length']?_0x984511[_0x7c37('0x31')]:_0x5c4a95[_0x7c37('0x2d')];if(_0x4aadb9[_0x7c37('0x30')][_0x7c37('0x3b')]){_0x984511[_0x7c37('0x42')]=[{'all':!![]}];}_0x984511=_[_0x7c37('0x39')]({},_0x984511,_0x4aadb9[_0x7c37('0x3a')]);return db['JscriptyQuestionReport'][_0x7c37('0x43')](_0x984511)[_0x7c37('0x22')](handleEntityNotFound(_0x514b82,null))[_0x7c37('0x22')](respondWithResult(_0x514b82,null))[_0x7c37('0x44')](handleError(_0x514b82,null));};exports[_0x7c37('0x45')]=function(_0x48294f,_0x4b19ea){return db[_0x7c37('0x29')][_0x7c37('0x45')](_0x48294f['body'],{})[_0x7c37('0x22')](respondWithResult(_0x4b19ea,0xc9))[_0x7c37('0x44')](handleError(_0x4b19ea,null));};exports[_0x7c37('0x21')]=function(_0x30cd2f,_0x18df88){if(_0x30cd2f['body']['id']){delete _0x30cd2f[_0x7c37('0x46')]['id'];}return db[_0x7c37('0x29')][_0x7c37('0x43')]({'where':{'id':_0x30cd2f['params']['id']}})['then'](handleEntityNotFound(_0x18df88,null))[_0x7c37('0x22')](saveUpdates(_0x30cd2f[_0x7c37('0x46')],null))[_0x7c37('0x22')](respondWithResult(_0x18df88,null))[_0x7c37('0x44')](handleError(_0x18df88,null));};exports[_0x7c37('0x23')]=function(_0x4355de,_0x39654e){return db[_0x7c37('0x29')][_0x7c37('0x43')]({'where':{'id':_0x4355de[_0x7c37('0x3f')]['id']}})[_0x7c37('0x22')](handleEntityNotFound(_0x39654e,null))[_0x7c37('0x22')](removeEntity(_0x39654e,null))[_0x7c37('0x44')](handleError(_0x39654e,null));};exports[_0x7c37('0x47')]=function(_0x390b04,_0x4f91ec){return db[_0x7c37('0x29')]['describe']()['then'](respondWithResult(_0x4f91ec,null))['catch'](handleError(_0x4f91ec,null));}; \ No newline at end of file +var _0xa35a=['fields','length','order','sort','filter','where','merge','options','JscriptyQuestionReport','count','includeAll','include','catch','show','params','rawAttributes','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','json','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x27236b,_0x14c47){var _0x2a82c1=function(_0x5f0470){while(--_0x5f0470){_0x27236b['push'](_0x27236b['shift']());}};_0x2a82c1(++_0x14c47);}(_0xa35a,0x1d5));var _0xaa35=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa35a[_0x178e48];return _0x440d7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa35('0x0'));var rimraf=require(_0xaa35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa35('0x2'));var rp=require(_0xaa35('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaa35('0x4'));var sox=require(_0xaa35('0x5'));var csv=require(_0xaa35('0x6'));var ejs=require(_0xaa35('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa35('0x8'));var jsforce=require(_0xaa35('0x9'));var deskjs=require(_0xaa35('0xa'));var toCsv=require(_0xaa35('0x6'));var querystring=require(_0xaa35('0xb'));var Papa=require('papaparse');var Redis=require(_0xaa35('0xc'));var authService=require(_0xaa35('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa35('0xe'));var logger=require(_0xaa35('0xf'))('api');var utils=require(_0xaa35('0x10'));var config=require('../../config/environment');var db=require(_0xaa35('0x11'))['db'];function respondWithStatusCode(_0x55a9d9,_0x3bb943){_0x3bb943=_0x3bb943||0xcc;return function(_0x326115){if(_0x326115){return _0x55a9d9['sendStatus'](_0x3bb943);}return _0x55a9d9['status'](_0x3bb943)['end']();};}function respondWithResult(_0x5c34da,_0x2fe995){_0x2fe995=_0x2fe995||0xc8;return function(_0x12ffb7){if(_0x12ffb7){return _0x5c34da[_0xaa35('0x12')](_0x2fe995)[_0xaa35('0x13')](_0x12ffb7);}};}function respondWithFilteredResult(_0x465699,_0xf096cb){return function(_0x14aecc){if(_0x14aecc){var _0x3ada8e=_0x14aecc['count'],_0x451fff=_0xf096cb['offset'],_0x3feb44=_0xf096cb[_0xaa35('0x14')]+_0xf096cb[_0xaa35('0x15')],_0x1b6f90;if(_0x3feb44>=_0x3ada8e){_0x3feb44=_0x3ada8e;_0x1b6f90=0xc8;}else{_0x1b6f90=0xce;}_0x465699[_0xaa35('0x12')](_0x1b6f90);return _0x465699['set'](_0xaa35('0x16'),_0x451fff+'-'+_0x3feb44+'/'+_0x3ada8e)['json'](_0x14aecc);}return null;};}function patchUpdates(_0x3c9f8e){return function(_0x526b48){try{jsonpatch[_0xaa35('0x17')](_0x526b48,_0x3c9f8e,!![]);}catch(_0x4f8496){return BPromise[_0xaa35('0x18')](_0x4f8496);}return _0x526b48[_0xaa35('0x19')]();};}function saveUpdates(_0xc334cf,_0x36e894){return function(_0x2d1cb4){if(_0x2d1cb4){return _0x2d1cb4[_0xaa35('0x1a')](_0xc334cf)['then'](function(_0x125842){return _0x125842;});}return null;};}function removeEntity(_0x31756a,_0x1faf09){return function(_0x5bf915){if(_0x5bf915){return _0x5bf915['destroy']()[_0xaa35('0x1b')](function(){_0x31756a[_0xaa35('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d380a,_0x3429fe){return function(_0x486529){if(!_0x486529){_0x1d380a[_0xaa35('0x1c')](0x194);}return _0x486529;};}function handleError(_0x187eca,_0x13a2a7){_0x13a2a7=_0x13a2a7||0x1f4;return function(_0x1d7147){logger[_0xaa35('0x1d')](_0x1d7147[_0xaa35('0x1e')]);if(_0x1d7147['name']){delete _0x1d7147[_0xaa35('0x1f')];}_0x187eca[_0xaa35('0x12')](_0x13a2a7)['send'](_0x1d7147);};}exports[_0xaa35('0x20')]=function(_0x19aa6b,_0x12437c){var _0x721f7c={},_0x6c4f36={},_0x4581b8={'count':0x0,'rows':[]};var _0x3e2c9b=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0xda2a0){return{'name':_0xda2a0[_0xaa35('0x21')],'type':_0xda2a0[_0xaa35('0x22')][_0xaa35('0x23')]};});_0x6c4f36[_0xaa35('0x24')]=_[_0xaa35('0x25')](_0x3e2c9b,_0xaa35('0x1f'));_0x6c4f36[_0xaa35('0x26')]=_[_0xaa35('0x27')](_0x19aa6b['query']);_0x6c4f36[_0xaa35('0x28')]=_[_0xaa35('0x29')](_0x6c4f36[_0xaa35('0x24')],_0x6c4f36[_0xaa35('0x26')]);_0x721f7c[_0xaa35('0x2a')]=_['intersection'](_0x6c4f36[_0xaa35('0x24')],qs[_0xaa35('0x2b')](_0x19aa6b[_0xaa35('0x26')]['fields']));_0x721f7c['attributes']=_0x721f7c[_0xaa35('0x2a')][_0xaa35('0x2c')]?_0x721f7c[_0xaa35('0x2a')]:_0x6c4f36[_0xaa35('0x24')];if(!_0x19aa6b[_0xaa35('0x26')]['hasOwnProperty']('nolimit')){_0x721f7c[_0xaa35('0x15')]=qs['limit'](_0x19aa6b[_0xaa35('0x26')]['limit']);_0x721f7c[_0xaa35('0x14')]=qs['offset'](_0x19aa6b['query']['offset']);}_0x721f7c[_0xaa35('0x2d')]=qs[_0xaa35('0x2e')](_0x19aa6b[_0xaa35('0x26')][_0xaa35('0x2e')]);_0x721f7c['where']=qs[_0xaa35('0x28')](_['pick'](_0x19aa6b[_0xaa35('0x26')],_0x6c4f36[_0xaa35('0x28')]),_0x3e2c9b);if(_0x19aa6b[_0xaa35('0x26')][_0xaa35('0x2f')]){_0x721f7c[_0xaa35('0x30')]=_['merge'](_0x721f7c[_0xaa35('0x30')],{'$or':_[_0xaa35('0x25')](_0x3e2c9b,function(_0x3dd266){if(_0x3dd266['type']!=='VIRTUAL'){var _0x16fee4={};_0x16fee4[_0x3dd266['name']]={'$like':'%'+_0x19aa6b[_0xaa35('0x26')][_0xaa35('0x2f')]+'%'};return _0x16fee4;}})});}_0x721f7c=_[_0xaa35('0x31')]({},_0x721f7c,_0x19aa6b[_0xaa35('0x32')]);var _0x474bcc={'where':_0x721f7c[_0xaa35('0x30')]};return db[_0xaa35('0x33')][_0xaa35('0x34')](_0x474bcc)['then'](function(_0xb01526){_0x4581b8['count']=_0xb01526;if(_0x19aa6b[_0xaa35('0x26')][_0xaa35('0x35')]){_0x721f7c[_0xaa35('0x36')]=[{'all':!![]}];}return db[_0xaa35('0x33')]['findAll'](_0x721f7c);})['then'](function(_0x37499f){_0x4581b8['rows']=_0x37499f;return _0x4581b8;})[_0xaa35('0x1b')](respondWithFilteredResult(_0x12437c,_0x721f7c))[_0xaa35('0x37')](handleError(_0x12437c,null));};exports[_0xaa35('0x38')]=function(_0x2b399d,_0x39decd){var _0x4f952a={'raw':!![],'where':{'id':_0x2b399d[_0xaa35('0x39')]['id']}},_0x121447={};_0x121447['model']=_[_0xaa35('0x27')](db[_0xaa35('0x33')][_0xaa35('0x3a')]);_0x121447[_0xaa35('0x26')]=_[_0xaa35('0x27')](_0x2b399d[_0xaa35('0x26')]);_0x121447['filters']=_[_0xaa35('0x29')](_0x121447[_0xaa35('0x24')],_0x121447[_0xaa35('0x26')]);_0x4f952a[_0xaa35('0x2a')]=_[_0xaa35('0x29')](_0x121447[_0xaa35('0x24')],qs[_0xaa35('0x2b')](_0x2b399d[_0xaa35('0x26')][_0xaa35('0x2b')]));_0x4f952a['attributes']=_0x4f952a[_0xaa35('0x2a')][_0xaa35('0x2c')]?_0x4f952a['attributes']:_0x121447[_0xaa35('0x24')];if(_0x2b399d[_0xaa35('0x26')][_0xaa35('0x35')]){_0x4f952a[_0xaa35('0x36')]=[{'all':!![]}];}_0x4f952a=_[_0xaa35('0x31')]({},_0x4f952a,_0x2b399d[_0xaa35('0x32')]);return db[_0xaa35('0x33')]['find'](_0x4f952a)[_0xaa35('0x1b')](handleEntityNotFound(_0x39decd,null))[_0xaa35('0x1b')](respondWithResult(_0x39decd,null))['catch'](handleError(_0x39decd,null));};exports[_0xaa35('0x3b')]=function(_0x5101e7,_0x2da8c9){return db[_0xaa35('0x33')][_0xaa35('0x3b')](_0x5101e7[_0xaa35('0x3c')],{})[_0xaa35('0x1b')](respondWithResult(_0x2da8c9,0xc9))[_0xaa35('0x37')](handleError(_0x2da8c9,null));};exports[_0xaa35('0x1a')]=function(_0x46782f,_0x44a4dd){if(_0x46782f[_0xaa35('0x3c')]['id']){delete _0x46782f[_0xaa35('0x3c')]['id'];}return db['JscriptyQuestionReport'][_0xaa35('0x3d')]({'where':{'id':_0x46782f['params']['id']}})[_0xaa35('0x1b')](handleEntityNotFound(_0x44a4dd,null))[_0xaa35('0x1b')](saveUpdates(_0x46782f[_0xaa35('0x3c')],null))[_0xaa35('0x1b')](respondWithResult(_0x44a4dd,null))[_0xaa35('0x37')](handleError(_0x44a4dd,null));};exports[_0xaa35('0x3e')]=function(_0xf19b29,_0x569399){return db[_0xaa35('0x33')][_0xaa35('0x3d')]({'where':{'id':_0xf19b29[_0xaa35('0x39')]['id']}})['then'](handleEntityNotFound(_0x569399,null))['then'](removeEntity(_0x569399,null))[_0xaa35('0x37')](handleError(_0x569399,null));};exports[_0xaa35('0x3f')]=function(_0x197fb9,_0x113fbc){return db[_0xaa35('0x33')][_0xaa35('0x3f')]()[_0xaa35('0x1b')](respondWithResult(_0x113fbc,null))[_0xaa35('0x37')](handleError(_0x113fbc,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c44d8d5..0a182b9 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 _0x6c2e=['bluebird','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','lodash','util','../../config/logger','api'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x6c2e,0x10a));var _0xe6c2=function(_0x3b8147,_0x4ac5e8){_0x3b8147=_0x3b8147-0x0;var _0x99d9f2=_0x6c2e[_0x3b8147];return _0x99d9f2;};'use strict';var _=require(_0xe6c2('0x0'));var util=require(_0xe6c2('0x1'));var logger=require(_0xe6c2('0x2'))(_0xe6c2('0x3'));var moment=require('moment');var BPromise=require(_0xe6c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe6c2('0x5'));var config=require(_0xe6c2('0x6'));var attributes=require(_0xe6c2('0x7'));module[_0xe6c2('0x8')]=function(_0xc10ca7,_0x4a2655){return _0xc10ca7['define'](_0xe6c2('0x9'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56a3=['JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','rimraf','./jscriptyQuestionReport.attributes'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x56a3,0x16a));var _0x356a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56a3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x356a('0x0'));var util=require('util');var logger=require(_0x356a('0x1'))(_0x356a('0x2'));var moment=require(_0x356a('0x3'));var BPromise=require(_0x356a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x356a('0x5'));var config=require('../../config/environment');var attributes=require(_0x356a('0x6'));module['exports']=function(_0x30d9bd,_0x30dd59){return _0x30d9bd['define'](_0x356a('0x7'),attributes,{'tableName':_0x356a('0x8'),'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 042516a..fb2ba4b 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 _0x39f8=['message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xf19bcf,_0x2c8a7e){var _0xbdab38=function(_0x428932){while(--_0x428932){_0xf19bcf['push'](_0xf19bcf['shift']());}};_0xbdab38(++_0x2c8a7e);}(_0x39f8,0x70));var _0x839f=function(_0x1c571e,_0x3eee04){_0x1c571e=_0x1c571e-0x0;var _0x370434=_0x39f8[_0x1c571e];return _0x370434;};'use strict';var _=require(_0x839f('0x0'));var util=require(_0x839f('0x1'));var moment=require('moment');var BPromise=require(_0x839f('0x2'));var rs=require(_0x839f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x839f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x839f('0x5'))(_0x839f('0x6'));var config=require(_0x839f('0x7'));var jayson=require(_0x839f('0x8'));var client=jayson['client'][_0x839f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45ce2c,_0x17f2cd,_0x375e78){return new BPromise(function(_0x5752e0,_0x10e010){return client[_0x839f('0xa')](_0x45ce2c,_0x375e78)[_0x839f('0xb')](function(_0x150320){logger[_0x839f('0xc')](_0x839f('0xd'),_0x17f2cd,_0x839f('0xe'));logger[_0x839f('0xf')](_0x839f('0x10'),_0x17f2cd,_0x839f('0xe'),JSON[_0x839f('0x11')](_0x150320));if(_0x150320[_0x839f('0x12')]){if(_0x150320['error'][_0x839f('0x13')]===0x1f4){logger[_0x839f('0x12')](_0x839f('0xd'),_0x17f2cd,_0x150320[_0x839f('0x12')][_0x839f('0x14')]);return _0x10e010(_0x150320[_0x839f('0x12')][_0x839f('0x14')]);}logger[_0x839f('0x12')](_0x839f('0xd'),_0x17f2cd,_0x150320[_0x839f('0x12')][_0x839f('0x14')]);return _0x5752e0(_0x150320['error']['message']);}else{logger[_0x839f('0xc')](_0x839f('0xd'),_0x17f2cd,_0x839f('0xe'));_0x5752e0(_0x150320[_0x839f('0x15')][_0x839f('0x14')]);}})['catch'](function(_0x1e453a){logger[_0x839f('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x17f2cd,_0x1e453a);_0x10e010(_0x1e453a);});});} \ No newline at end of file +var _0x748f=['error','message','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x31e012,_0xcd4e24){var _0x11832d=function(_0x4cce6c){while(--_0x4cce6c){_0x31e012['push'](_0x31e012['shift']());}};_0x11832d(++_0xcd4e24);}(_0x748f,0x120));var _0xf748=function(_0x62d7a2,_0x55bbd5){_0x62d7a2=_0x62d7a2-0x0;var _0x309e50=_0x748f[_0x62d7a2];return _0x309e50;};'use strict';var _=require(_0xf748('0x0'));var util=require(_0xf748('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf748('0x2'));var fs=require('fs');var Redis=require(_0xf748('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf748('0x4'));var logger=require('../../config/logger')(_0xf748('0x5'));var config=require(_0xf748('0x6'));var jayson=require(_0xf748('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7fd284,_0x4115be,_0x1e99e6){return new BPromise(function(_0x1b3748,_0x1a8d6c){return client[_0xf748('0x8')](_0x7fd284,_0x1e99e6)[_0xf748('0x9')](function(_0x771ac3){logger[_0xf748('0xa')](_0xf748('0xb'),_0x4115be,_0xf748('0xc'));logger[_0xf748('0xd')](_0xf748('0xe'),_0x4115be,_0xf748('0xc'),JSON[_0xf748('0xf')](_0x771ac3));if(_0x771ac3['error']){if(_0x771ac3[_0xf748('0x10')]['code']===0x1f4){logger[_0xf748('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4115be,_0x771ac3[_0xf748('0x10')]['message']);return _0x1a8d6c(_0x771ac3['error'][_0xf748('0x11')]);}logger['error'](_0xf748('0xb'),_0x4115be,_0x771ac3[_0xf748('0x10')][_0xf748('0x11')]);return _0x1b3748(_0x771ac3[_0xf748('0x10')]['message']);}else{logger['info'](_0xf748('0xb'),_0x4115be,'request\x20sent');_0x1b3748(_0x771ac3['result'][_0xf748('0x11')]);}})[_0xf748('0x12')](function(_0x48ed66){logger[_0xf748('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4115be,_0x48ed66);_0x1a8d6c(_0x48ed66);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4cea3bf..818291e 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 _0x31af=['./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/questions','getQuestions','post','put','update','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0x393525,_0x258412){var _0x5e8282=function(_0x24a496){while(--_0x24a496){_0x393525['push'](_0x393525['shift']());}};_0x5e8282(++_0x258412);}(_0x31af,0xde));var _0xf31a=function(_0x6c0869,_0x1f5bcc){_0x6c0869=_0x6c0869-0x0;var _0x45781=_0x31af[_0x6c0869];return _0x45781;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf31a('0x4'));var config=require(_0xf31a('0x5'));var controller=require(_0xf31a('0x6'));router[_0xf31a('0x7')]('/',auth['isAuthenticated'](),controller[_0xf31a('0x8')]);router[_0xf31a('0x7')](_0xf31a('0x9'),auth[_0xf31a('0xa')](),controller['describe']);router[_0xf31a('0x7')](_0xf31a('0xb'),auth[_0xf31a('0xa')](),controller[_0xf31a('0xc')]);router['get'](_0xf31a('0xd'),auth[_0xf31a('0xa')](),controller[_0xf31a('0xe')]);router[_0xf31a('0xf')]('/',auth[_0xf31a('0xa')](),controller['create']);router[_0xf31a('0x10')](_0xf31a('0xb'),auth[_0xf31a('0xa')](),controller[_0xf31a('0x11')]);router['delete'](_0xf31a('0xb'),auth[_0xf31a('0xa')](),controller['destroy']);module[_0xf31a('0x12')]=router; \ No newline at end of file +var _0x6658=['../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x6658,0x198));var _0x8665=function(_0x10bba6,_0x4cf697){_0x10bba6=_0x10bba6-0x0;var _0x21fe5a=_0x6658[_0x10bba6];return _0x21fe5a;};'use strict';var multer=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var path=require(_0x8665('0x2'));var timeout=require(_0x8665('0x3'));var express=require(_0x8665('0x4'));var router=express[_0x8665('0x5')]();var auth=require(_0x8665('0x6'));var interaction=require(_0x8665('0x7'));var config=require('../../config/environment');var controller=require(_0x8665('0x8'));router[_0x8665('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8665('0x9')](_0x8665('0xa'),auth[_0x8665('0xb')](),controller[_0x8665('0xc')]);router[_0x8665('0x9')](_0x8665('0xd'),auth[_0x8665('0xb')](),controller[_0x8665('0xe')]);router['get'](_0x8665('0xf'),auth[_0x8665('0xb')](),controller[_0x8665('0x10')]);router[_0x8665('0x11')]('/',auth[_0x8665('0xb')](),controller[_0x8665('0x12')]);router[_0x8665('0x13')](_0x8665('0xd'),auth[_0x8665('0xb')](),controller[_0x8665('0x14')]);router[_0x8665('0x15')](_0x8665('0xd'),auth[_0x8665('0xb')](),controller[_0x8665('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 921dd33..78781ea 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 _0x9510=['sequelize','exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x2912ef,_0x33faee){var _0x42b455=function(_0x3c1498){while(--_0x3c1498){_0x2912ef['push'](_0x2912ef['shift']());}};_0x42b455(++_0x33faee);}(_0x9510,0xef));var _0x0951=function(_0x5000aa,_0x5df552){_0x5000aa=_0x5000aa-0x0;var _0x5b8fc2=_0x9510[_0x5000aa];return _0x5b8fc2;};'use strict';var moment=require(_0x0951('0x0'));var Sequelize=require(_0x0951('0x1'));module[_0x0951('0x2')]={'starttime':{'type':Sequelize[_0x0951('0x3')],'set':function(_0x3d0140){this[_0x0951('0x4')](_0x0951('0x5'),_0x3d0140);this['setDataValue'](_0x0951('0x6'),moment()['format'](_0x0951('0x7')));}},'endtime':{'type':Sequelize[_0x0951('0x3')]},'membername':{'type':Sequelize[_0x0951('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0951('0x8')]},'uniqueid':{'type':Sequelize[_0x0951('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0951('0x8')]},'completed':{'type':Sequelize[_0x0951('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xf802=['STRING','sequelize','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5a49fb,_0x1a4a07){var _0x23a04d=function(_0x3c9600){while(--_0x3c9600){_0x5a49fb['push'](_0x5a49fb['shift']());}};_0x23a04d(++_0x1a4a07);}(_0xf802,0x101));var _0x2f80=function(_0x19599e,_0x411ef5){_0x19599e=_0x19599e-0x0;var _0x355431=_0xf802[_0x19599e];return _0x355431;};'use strict';var moment=require('moment');var Sequelize=require(_0x2f80('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x2f80('0x1')],'set':function(_0x35d24a){this[_0x2f80('0x2')](_0x2f80('0x3'),_0x35d24a);this[_0x2f80('0x2')](_0x2f80('0x4'),moment()[_0x2f80('0x5')](_0x2f80('0x6')));}},'endtime':{'type':Sequelize[_0x2f80('0x1')]},'membername':{'type':Sequelize[_0x2f80('0x7')]},'projectname':{'type':Sequelize[_0x2f80('0x7')]},'queue':{'type':Sequelize[_0x2f80('0x7')]},'uniqueid':{'type':Sequelize[_0x2f80('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2f80('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index e722193..16a180b 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 _0x8aa6=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','update','then','destroy','end','stack','name','index','map','JscriptySessionReport','fieldName','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','pick','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2a3b23,_0x3a8f4a){var _0x13581d=function(_0x2a0349){while(--_0x2a0349){_0x2a3b23['push'](_0x2a3b23['shift']());}};_0x13581d(++_0x3a8f4a);}(_0x8aa6,0xc7));var _0x68aa=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x8aa6[_0xd0cd0b];return _0x59cced;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x68aa('0x0'));var rimraf=require(_0x68aa('0x1'));var zipdir=require(_0x68aa('0x2'));var jsonpatch=require(_0x68aa('0x3'));var rp=require(_0x68aa('0x4'));var moment=require(_0x68aa('0x5'));var BPromise=require(_0x68aa('0x6'));var Mustache=require(_0x68aa('0x7'));var util=require(_0x68aa('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x68aa('0x9'));var ejs=require(_0x68aa('0xa'));var fs=require('fs');var _=require(_0x68aa('0xb'));var squel=require(_0x68aa('0xc'));var crypto=require(_0x68aa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x68aa('0x9'));var querystring=require('querystring');var Papa=require(_0x68aa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x68aa('0xf'));var hardwareService=require(_0x68aa('0x10'));var logger=require(_0x68aa('0x11'))(_0x68aa('0x12'));var utils=require(_0x68aa('0x13'));var config=require(_0x68aa('0x14'));var db=require(_0x68aa('0x15'))['db'];function respondWithStatusCode(_0x1538c2,_0x399e05){_0x399e05=_0x399e05||0xcc;return function(_0x27b652){if(_0x27b652){return _0x1538c2[_0x68aa('0x16')](_0x399e05);}return _0x1538c2[_0x68aa('0x17')](_0x399e05)['end']();};}function respondWithResult(_0x3d5d7f,_0xea16ed){_0xea16ed=_0xea16ed||0xc8;return function(_0xc4ab17){if(_0xc4ab17){return _0x3d5d7f[_0x68aa('0x17')](_0xea16ed)[_0x68aa('0x18')](_0xc4ab17);}};}function respondWithFilteredResult(_0x2d8032,_0x1108c9){return function(_0x1ad14f){if(_0x1ad14f){var _0xb6892c=_0x1ad14f[_0x68aa('0x19')],_0x4d8fb9=_0x1108c9[_0x68aa('0x1a')],_0x50c8ea=_0x1108c9['offset']+_0x1108c9[_0x68aa('0x1b')],_0x1e4fd0;if(_0x50c8ea>=_0xb6892c){_0x50c8ea=_0xb6892c;_0x1e4fd0=0xc8;}else{_0x1e4fd0=0xce;}_0x2d8032[_0x68aa('0x17')](_0x1e4fd0);return _0x2d8032[_0x68aa('0x1c')]('Content-Range',_0x4d8fb9+'-'+_0x50c8ea+'/'+_0xb6892c)['json'](_0x1ad14f);}return null;};}function patchUpdates(_0x125f9b){return function(_0x216138){try{jsonpatch[_0x68aa('0x1d')](_0x216138,_0x125f9b,!![]);}catch(_0x5a40b5){return BPromise['reject'](_0x5a40b5);}return _0x216138['save']();};}function saveUpdates(_0x32c18c,_0x3bb972){return function(_0x2ca79d){if(_0x2ca79d){return _0x2ca79d[_0x68aa('0x1e')](_0x32c18c)[_0x68aa('0x1f')](function(_0x386b2b){return _0x386b2b;});}return null;};}function removeEntity(_0x16379f,_0x32c973){return function(_0x5b190c){if(_0x5b190c){return _0x5b190c[_0x68aa('0x20')]()['then'](function(){_0x16379f['status'](0xcc)[_0x68aa('0x21')]();});}};}function handleEntityNotFound(_0x5dcbba,_0x405e08){return function(_0x27552f){if(!_0x27552f){_0x5dcbba[_0x68aa('0x16')](0x194);}return _0x27552f;};}function handleError(_0x3dc3cd,_0x114932){_0x114932=_0x114932||0x1f4;return function(_0x1c84b3){logger['error'](_0x1c84b3[_0x68aa('0x22')]);if(_0x1c84b3['name']){delete _0x1c84b3[_0x68aa('0x23')];}_0x3dc3cd[_0x68aa('0x17')](_0x114932)['send'](_0x1c84b3);};}exports[_0x68aa('0x24')]=function(_0x21dc27,_0x554997){var _0x3ce226={},_0x18d77d={},_0x5bca31={'count':0x0,'rows':[]};var _0x455c0f=_[_0x68aa('0x25')](db[_0x68aa('0x26')]['rawAttributes'],function(_0x10a68e){return{'name':_0x10a68e[_0x68aa('0x27')],'type':_0x10a68e['type']['key']};});_0x18d77d['model']=_[_0x68aa('0x25')](_0x455c0f,_0x68aa('0x23'));_0x18d77d[_0x68aa('0x28')]=_[_0x68aa('0x29')](_0x21dc27['query']);_0x18d77d[_0x68aa('0x2a')]=_[_0x68aa('0x2b')](_0x18d77d[_0x68aa('0x2c')],_0x18d77d[_0x68aa('0x28')]);_0x3ce226[_0x68aa('0x2d')]=_[_0x68aa('0x2b')](_0x18d77d[_0x68aa('0x2c')],qs['fields'](_0x21dc27['query'][_0x68aa('0x2e')]));_0x3ce226['attributes']=_0x3ce226[_0x68aa('0x2d')][_0x68aa('0x2f')]?_0x3ce226[_0x68aa('0x2d')]:_0x18d77d['model'];if(!_0x21dc27[_0x68aa('0x28')]['hasOwnProperty'](_0x68aa('0x30'))){_0x3ce226['limit']=qs[_0x68aa('0x1b')](_0x21dc27[_0x68aa('0x28')][_0x68aa('0x1b')]);_0x3ce226[_0x68aa('0x1a')]=qs[_0x68aa('0x1a')](_0x21dc27['query'][_0x68aa('0x1a')]);}_0x3ce226[_0x68aa('0x31')]=qs[_0x68aa('0x32')](_0x21dc27[_0x68aa('0x28')]['sort']);_0x3ce226['where']=qs[_0x68aa('0x2a')](_['pick'](_0x21dc27[_0x68aa('0x28')],_0x18d77d['filters']),_0x455c0f);if(_0x21dc27['query'][_0x68aa('0x33')]){_0x3ce226[_0x68aa('0x34')]=_[_0x68aa('0x35')](_0x3ce226[_0x68aa('0x34')],{'$or':_[_0x68aa('0x25')](_0x455c0f,function(_0x4d5fa3){if(_0x4d5fa3[_0x68aa('0x36')]!=='VIRTUAL'){var _0x5e5d9a={};_0x5e5d9a[_0x4d5fa3[_0x68aa('0x23')]]={'$like':'%'+_0x21dc27[_0x68aa('0x28')]['filter']+'%'};return _0x5e5d9a;}})});}_0x3ce226=_[_0x68aa('0x35')]({},_0x3ce226,_0x21dc27[_0x68aa('0x37')]);var _0x5b7f70={'where':_0x3ce226[_0x68aa('0x34')]};return db[_0x68aa('0x26')][_0x68aa('0x19')](_0x5b7f70)[_0x68aa('0x1f')](function(_0x1af408){_0x5bca31[_0x68aa('0x19')]=_0x1af408;if(_0x21dc27[_0x68aa('0x28')][_0x68aa('0x38')]){_0x3ce226[_0x68aa('0x39')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x68aa('0x3a')](_0x3ce226);})[_0x68aa('0x1f')](function(_0x591fff){_0x5bca31[_0x68aa('0x3b')]=_0x591fff;return _0x5bca31;})[_0x68aa('0x1f')](respondWithFilteredResult(_0x554997,_0x3ce226))[_0x68aa('0x3c')](handleError(_0x554997,null));};exports['show']=function(_0x49ce90,_0x30a49a){var _0x16e126={'raw':!![],'where':{'id':_0x49ce90[_0x68aa('0x3d')]['id']}},_0x14144c={};_0x14144c[_0x68aa('0x2c')]=_['keys'](db[_0x68aa('0x26')][_0x68aa('0x3e')]);_0x14144c[_0x68aa('0x28')]=_[_0x68aa('0x29')](_0x49ce90[_0x68aa('0x28')]);_0x14144c[_0x68aa('0x2a')]=_[_0x68aa('0x2b')](_0x14144c['model'],_0x14144c[_0x68aa('0x28')]);_0x16e126[_0x68aa('0x2d')]=_['intersection'](_0x14144c[_0x68aa('0x2c')],qs[_0x68aa('0x2e')](_0x49ce90[_0x68aa('0x28')]['fields']));_0x16e126[_0x68aa('0x2d')]=_0x16e126[_0x68aa('0x2d')][_0x68aa('0x2f')]?_0x16e126[_0x68aa('0x2d')]:_0x14144c['model'];if(_0x49ce90[_0x68aa('0x28')][_0x68aa('0x38')]){_0x16e126[_0x68aa('0x39')]=[{'all':!![]}];}_0x16e126=_['merge']({},_0x16e126,_0x49ce90[_0x68aa('0x37')]);return db[_0x68aa('0x26')][_0x68aa('0x3f')](_0x16e126)[_0x68aa('0x1f')](handleEntityNotFound(_0x30a49a,null))[_0x68aa('0x1f')](respondWithResult(_0x30a49a,null))[_0x68aa('0x3c')](handleError(_0x30a49a,null));};exports[_0x68aa('0x40')]=function(_0x31090b,_0x527855){return db['JscriptySessionReport'][_0x68aa('0x40')](_0x31090b['body'],{})[_0x68aa('0x1f')](respondWithResult(_0x527855,0xc9))[_0x68aa('0x3c')](handleError(_0x527855,null));};exports[_0x68aa('0x1e')]=function(_0x3ad591,_0x3497fd){if(_0x3ad591['body']['id']){delete _0x3ad591[_0x68aa('0x41')]['id'];}return db[_0x68aa('0x26')]['find']({'where':{'id':_0x3ad591[_0x68aa('0x3d')]['id']}})[_0x68aa('0x1f')](handleEntityNotFound(_0x3497fd,null))['then'](saveUpdates(_0x3ad591[_0x68aa('0x41')],null))[_0x68aa('0x1f')](respondWithResult(_0x3497fd,null))[_0x68aa('0x3c')](handleError(_0x3497fd,null));};exports['destroy']=function(_0x487c1f,_0x30c633){return db[_0x68aa('0x26')]['find']({'where':{'id':_0x487c1f[_0x68aa('0x3d')]['id']}})['then'](handleEntityNotFound(_0x30c633,null))[_0x68aa('0x1f')](removeEntity(_0x30c633,null))[_0x68aa('0x3c')](handleError(_0x30c633,null));};exports[_0x68aa('0x42')]=function(_0x40baff,_0x4a323e){return db[_0x68aa('0x26')][_0x68aa('0x42')]()['then'](respondWithResult(_0x4a323e,null))['catch'](handleError(_0x4a323e,null));};exports[_0x68aa('0x43')]=function(_0x9249f,_0x22f549,_0x3b0cf5){var _0x2562f4={'raw':!![],'where':{}};var _0x7da462={};var _0x5e0c98={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x68aa('0x44')]({'where':{'id':_0x9249f[_0x68aa('0x3d')]['id']}})['then'](handleEntityNotFound(_0x22f549,null))[_0x68aa('0x1f')](function(_0x4c7415){if(_0x4c7415){_0x7da462[_0x68aa('0x2c')]=_[_0x68aa('0x29')](db[_0x68aa('0x45')][_0x68aa('0x3e')]);_0x7da462[_0x68aa('0x28')]=_[_0x68aa('0x29')](_0x9249f[_0x68aa('0x28')]);_0x7da462[_0x68aa('0x2a')]=_['intersection'](_0x7da462[_0x68aa('0x2c')],_0x7da462['query']);_0x2562f4[_0x68aa('0x2d')]=_['intersection'](_0x7da462[_0x68aa('0x2c')],qs[_0x68aa('0x2e')](_0x9249f['query'][_0x68aa('0x2e')]));_0x2562f4[_0x68aa('0x2d')]=_0x2562f4[_0x68aa('0x2d')][_0x68aa('0x2f')]?_0x2562f4['attributes']:_0x7da462[_0x68aa('0x2c')];if(!_0x9249f[_0x68aa('0x28')][_0x68aa('0x46')](_0x68aa('0x30'))){_0x2562f4[_0x68aa('0x1b')]=qs[_0x68aa('0x1b')](_0x9249f[_0x68aa('0x28')]['limit']);_0x2562f4[_0x68aa('0x1a')]=qs[_0x68aa('0x1a')](_0x9249f[_0x68aa('0x28')][_0x68aa('0x1a')]);}_0x2562f4['order']=qs[_0x68aa('0x32')](_0x9249f['query'][_0x68aa('0x32')]);_0x2562f4[_0x68aa('0x34')]=qs[_0x68aa('0x2a')](_[_0x68aa('0x47')](_0x9249f[_0x68aa('0x28')],_0x7da462['filters']));_0x2562f4[_0x68aa('0x34')][_0x68aa('0x48')]=_0x4c7415['id'];if(_0x9249f[_0x68aa('0x28')][_0x68aa('0x33')]){_0x2562f4['where']=_[_0x68aa('0x35')](_0x2562f4[_0x68aa('0x34')],{'$or':_['map'](_0x2562f4['attributes'],function(_0x5eb079){var _0x1e3e74={};_0x1e3e74[_0x5eb079]={'$like':'%'+_0x9249f[_0x68aa('0x28')]['filter']+'%'};return _0x1e3e74;})});}_0x2562f4=_['merge']({},_0x2562f4,_0x9249f['options']);return db[_0x68aa('0x45')][_0x68aa('0x19')]({'where':_0x2562f4[_0x68aa('0x34')]})[_0x68aa('0x1f')](function(_0x2b5c98){_0x5e0c98[_0x68aa('0x19')]=_0x2b5c98;if(_0x9249f['query'][_0x68aa('0x38')]){_0x2562f4[_0x68aa('0x39')]=[{'all':!![]}];}return db[_0x68aa('0x45')][_0x68aa('0x3a')](_0x2562f4);})['then'](function(_0x5a90ab){_0x5e0c98[_0x68aa('0x3b')]=_0x5a90ab;return _0x5e0c98;});}})['then'](respondWithFilteredResult(_0x22f549,_0x2562f4))[_0x68aa('0x3c')](handleError(_0x22f549,null));}; \ No newline at end of file +var _0xd3cc=['rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','catch','show','include','find','create','body','destroy','params','getQuestions','findOne','length','hasOwnProperty','SessionId','JscriptyQuestionReport','findAll','rows','eml-format','zip-dir','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','error','stack','name','send','map','JscriptySessionReport'];(function(_0x10142a,_0x2aee84){var _0x26cda0=function(_0x2e1b54){while(--_0x2e1b54){_0x10142a['push'](_0x10142a['shift']());}};_0x26cda0(++_0x2aee84);}(_0xd3cc,0x106));var _0xcd3c=function(_0x4f8bb0,_0x18a91){_0x4f8bb0=_0x4f8bb0-0x0;var _0x4bb5bc=_0xd3cc[_0x4f8bb0];return _0x4bb5bc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcd3c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd3c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd3c('0x2'));var moment=require(_0xcd3c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcd3c('0x4'));var path=require(_0xcd3c('0x5'));var sox=require(_0xcd3c('0x6'));var csv=require('to-csv');var ejs=require(_0xcd3c('0x7'));var fs=require('fs');var _=require(_0xcd3c('0x8'));var squel=require(_0xcd3c('0x9'));var crypto=require(_0xcd3c('0xa'));var jsforce=require(_0xcd3c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcd3c('0xc'));var Redis=require(_0xcd3c('0xd'));var authService=require(_0xcd3c('0xe'));var qs=require(_0xcd3c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd3c('0x10'));var logger=require(_0xcd3c('0x11'))(_0xcd3c('0x12'));var utils=require('../../config/utils');var config=require(_0xcd3c('0x13'));var db=require(_0xcd3c('0x14'))['db'];function respondWithStatusCode(_0x4d28d4,_0x500718){_0x500718=_0x500718||0xcc;return function(_0x3a43f0){if(_0x3a43f0){return _0x4d28d4['sendStatus'](_0x500718);}return _0x4d28d4[_0xcd3c('0x15')](_0x500718)[_0xcd3c('0x16')]();};}function respondWithResult(_0x2282c4,_0x13d4ab){_0x13d4ab=_0x13d4ab||0xc8;return function(_0x1e2566){if(_0x1e2566){return _0x2282c4[_0xcd3c('0x15')](_0x13d4ab)['json'](_0x1e2566);}};}function respondWithFilteredResult(_0x466567,_0x31a496){return function(_0x3484c6){if(_0x3484c6){var _0x2cc670=_0x3484c6[_0xcd3c('0x17')],_0x59a01c=_0x31a496[_0xcd3c('0x18')],_0x4ae2a5=_0x31a496[_0xcd3c('0x18')]+_0x31a496[_0xcd3c('0x19')],_0x201f66;if(_0x4ae2a5>=_0x2cc670){_0x4ae2a5=_0x2cc670;_0x201f66=0xc8;}else{_0x201f66=0xce;}_0x466567[_0xcd3c('0x15')](_0x201f66);return _0x466567[_0xcd3c('0x1a')](_0xcd3c('0x1b'),_0x59a01c+'-'+_0x4ae2a5+'/'+_0x2cc670)[_0xcd3c('0x1c')](_0x3484c6);}return null;};}function patchUpdates(_0x1a4e4f){return function(_0x252bea){try{jsonpatch['apply'](_0x252bea,_0x1a4e4f,!![]);}catch(_0x3f813b){return BPromise[_0xcd3c('0x1d')](_0x3f813b);}return _0x252bea[_0xcd3c('0x1e')]();};}function saveUpdates(_0x48641a,_0x2ea652){return function(_0x67653b){if(_0x67653b){return _0x67653b[_0xcd3c('0x1f')](_0x48641a)['then'](function(_0x4ac3aa){return _0x4ac3aa;});}return null;};}function removeEntity(_0x5dc1a1,_0x1d1eb8){return function(_0x5d7222){if(_0x5d7222){return _0x5d7222['destroy']()['then'](function(){_0x5dc1a1[_0xcd3c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x414e8f,_0x130c71){return function(_0x26659c){if(!_0x26659c){_0x414e8f['sendStatus'](0x194);}return _0x26659c;};}function handleError(_0x366546,_0x2261c4){_0x2261c4=_0x2261c4||0x1f4;return function(_0x42c9c4){logger[_0xcd3c('0x20')](_0x42c9c4[_0xcd3c('0x21')]);if(_0x42c9c4[_0xcd3c('0x22')]){delete _0x42c9c4[_0xcd3c('0x22')];}_0x366546['status'](_0x2261c4)[_0xcd3c('0x23')](_0x42c9c4);};}exports['index']=function(_0x5a4511,_0x5a02fb){var _0x27b70e={},_0x1c5c42={},_0x5cf2ed={'count':0x0,'rows':[]};var _0x2cb58d=_[_0xcd3c('0x24')](db[_0xcd3c('0x25')][_0xcd3c('0x26')],function(_0x521504){return{'name':_0x521504[_0xcd3c('0x27')],'type':_0x521504[_0xcd3c('0x28')][_0xcd3c('0x29')]};});_0x1c5c42[_0xcd3c('0x2a')]=_['map'](_0x2cb58d,_0xcd3c('0x22'));_0x1c5c42['query']=_[_0xcd3c('0x2b')](_0x5a4511['query']);_0x1c5c42[_0xcd3c('0x2c')]=_[_0xcd3c('0x2d')](_0x1c5c42[_0xcd3c('0x2a')],_0x1c5c42[_0xcd3c('0x2e')]);_0x27b70e[_0xcd3c('0x2f')]=_[_0xcd3c('0x2d')](_0x1c5c42[_0xcd3c('0x2a')],qs['fields'](_0x5a4511['query'][_0xcd3c('0x30')]));_0x27b70e[_0xcd3c('0x2f')]=_0x27b70e[_0xcd3c('0x2f')]['length']?_0x27b70e[_0xcd3c('0x2f')]:_0x1c5c42[_0xcd3c('0x2a')];if(!_0x5a4511['query']['hasOwnProperty'](_0xcd3c('0x31'))){_0x27b70e['limit']=qs[_0xcd3c('0x19')](_0x5a4511[_0xcd3c('0x2e')][_0xcd3c('0x19')]);_0x27b70e[_0xcd3c('0x18')]=qs['offset'](_0x5a4511[_0xcd3c('0x2e')][_0xcd3c('0x18')]);}_0x27b70e[_0xcd3c('0x32')]=qs[_0xcd3c('0x33')](_0x5a4511[_0xcd3c('0x2e')][_0xcd3c('0x33')]);_0x27b70e[_0xcd3c('0x34')]=qs[_0xcd3c('0x2c')](_[_0xcd3c('0x35')](_0x5a4511[_0xcd3c('0x2e')],_0x1c5c42[_0xcd3c('0x2c')]),_0x2cb58d);if(_0x5a4511[_0xcd3c('0x2e')][_0xcd3c('0x36')]){_0x27b70e[_0xcd3c('0x34')]=_[_0xcd3c('0x37')](_0x27b70e[_0xcd3c('0x34')],{'$or':_[_0xcd3c('0x24')](_0x2cb58d,function(_0x35ab61){if(_0x35ab61['type']!=='VIRTUAL'){var _0xf3e7bf={};_0xf3e7bf[_0x35ab61[_0xcd3c('0x22')]]={'$like':'%'+_0x5a4511['query'][_0xcd3c('0x36')]+'%'};return _0xf3e7bf;}})});}_0x27b70e=_['merge']({},_0x27b70e,_0x5a4511[_0xcd3c('0x38')]);var _0x5a1a5f={'where':_0x27b70e[_0xcd3c('0x34')]};return db[_0xcd3c('0x25')]['count'](_0x5a1a5f)[_0xcd3c('0x39')](function(_0xcda43c){_0x5cf2ed[_0xcd3c('0x17')]=_0xcda43c;if(_0x5a4511['query'][_0xcd3c('0x3a')]){_0x27b70e['include']=[{'all':!![]}];}return db[_0xcd3c('0x25')]['findAll'](_0x27b70e);})[_0xcd3c('0x39')](function(_0x10d24f){_0x5cf2ed['rows']=_0x10d24f;return _0x5cf2ed;})[_0xcd3c('0x39')](respondWithFilteredResult(_0x5a02fb,_0x27b70e))[_0xcd3c('0x3b')](handleError(_0x5a02fb,null));};exports[_0xcd3c('0x3c')]=function(_0x3cbff3,_0x5bca28){var _0x31b032={'raw':!![],'where':{'id':_0x3cbff3['params']['id']}},_0x2828e4={};_0x2828e4[_0xcd3c('0x2a')]=_[_0xcd3c('0x2b')](db['JscriptySessionReport'][_0xcd3c('0x26')]);_0x2828e4['query']=_[_0xcd3c('0x2b')](_0x3cbff3['query']);_0x2828e4[_0xcd3c('0x2c')]=_[_0xcd3c('0x2d')](_0x2828e4['model'],_0x2828e4['query']);_0x31b032['attributes']=_[_0xcd3c('0x2d')](_0x2828e4[_0xcd3c('0x2a')],qs['fields'](_0x3cbff3[_0xcd3c('0x2e')][_0xcd3c('0x30')]));_0x31b032[_0xcd3c('0x2f')]=_0x31b032['attributes']['length']?_0x31b032['attributes']:_0x2828e4[_0xcd3c('0x2a')];if(_0x3cbff3[_0xcd3c('0x2e')][_0xcd3c('0x3a')]){_0x31b032[_0xcd3c('0x3d')]=[{'all':!![]}];}_0x31b032=_['merge']({},_0x31b032,_0x3cbff3[_0xcd3c('0x38')]);return db[_0xcd3c('0x25')][_0xcd3c('0x3e')](_0x31b032)['then'](handleEntityNotFound(_0x5bca28,null))[_0xcd3c('0x39')](respondWithResult(_0x5bca28,null))[_0xcd3c('0x3b')](handleError(_0x5bca28,null));};exports[_0xcd3c('0x3f')]=function(_0xf9776d,_0x47ea9b){return db[_0xcd3c('0x25')][_0xcd3c('0x3f')](_0xf9776d['body'],{})[_0xcd3c('0x39')](respondWithResult(_0x47ea9b,0xc9))[_0xcd3c('0x3b')](handleError(_0x47ea9b,null));};exports[_0xcd3c('0x1f')]=function(_0x2b5786,_0x44248b){if(_0x2b5786['body']['id']){delete _0x2b5786[_0xcd3c('0x40')]['id'];}return db[_0xcd3c('0x25')][_0xcd3c('0x3e')]({'where':{'id':_0x2b5786['params']['id']}})[_0xcd3c('0x39')](handleEntityNotFound(_0x44248b,null))['then'](saveUpdates(_0x2b5786[_0xcd3c('0x40')],null))[_0xcd3c('0x39')](respondWithResult(_0x44248b,null))[_0xcd3c('0x3b')](handleError(_0x44248b,null));};exports[_0xcd3c('0x41')]=function(_0x2fe703,_0x3de3b3){return db[_0xcd3c('0x25')][_0xcd3c('0x3e')]({'where':{'id':_0x2fe703[_0xcd3c('0x42')]['id']}})[_0xcd3c('0x39')](handleEntityNotFound(_0x3de3b3,null))[_0xcd3c('0x39')](removeEntity(_0x3de3b3,null))['catch'](handleError(_0x3de3b3,null));};exports['describe']=function(_0x2073c2,_0x553b69){return db[_0xcd3c('0x25')]['describe']()[_0xcd3c('0x39')](respondWithResult(_0x553b69,null))[_0xcd3c('0x3b')](handleError(_0x553b69,null));};exports[_0xcd3c('0x43')]=function(_0x1049de,_0x2f4a70,_0x8224bc){var _0x1e0fa7={'raw':!![],'where':{}};var _0x1ee3b7={};var _0x479bff={'count':0x0,'rows':[]};return db[_0xcd3c('0x25')][_0xcd3c('0x44')]({'where':{'id':_0x1049de[_0xcd3c('0x42')]['id']}})[_0xcd3c('0x39')](handleEntityNotFound(_0x2f4a70,null))[_0xcd3c('0x39')](function(_0xdc4260){if(_0xdc4260){_0x1ee3b7[_0xcd3c('0x2a')]=_[_0xcd3c('0x2b')](db['JscriptyQuestionReport'][_0xcd3c('0x26')]);_0x1ee3b7[_0xcd3c('0x2e')]=_[_0xcd3c('0x2b')](_0x1049de['query']);_0x1ee3b7[_0xcd3c('0x2c')]=_[_0xcd3c('0x2d')](_0x1ee3b7[_0xcd3c('0x2a')],_0x1ee3b7[_0xcd3c('0x2e')]);_0x1e0fa7[_0xcd3c('0x2f')]=_[_0xcd3c('0x2d')](_0x1ee3b7[_0xcd3c('0x2a')],qs['fields'](_0x1049de['query']['fields']));_0x1e0fa7['attributes']=_0x1e0fa7[_0xcd3c('0x2f')][_0xcd3c('0x45')]?_0x1e0fa7[_0xcd3c('0x2f')]:_0x1ee3b7['model'];if(!_0x1049de['query'][_0xcd3c('0x46')](_0xcd3c('0x31'))){_0x1e0fa7[_0xcd3c('0x19')]=qs[_0xcd3c('0x19')](_0x1049de['query'][_0xcd3c('0x19')]);_0x1e0fa7[_0xcd3c('0x18')]=qs[_0xcd3c('0x18')](_0x1049de[_0xcd3c('0x2e')]['offset']);}_0x1e0fa7[_0xcd3c('0x32')]=qs[_0xcd3c('0x33')](_0x1049de[_0xcd3c('0x2e')][_0xcd3c('0x33')]);_0x1e0fa7[_0xcd3c('0x34')]=qs[_0xcd3c('0x2c')](_['pick'](_0x1049de[_0xcd3c('0x2e')],_0x1ee3b7[_0xcd3c('0x2c')]));_0x1e0fa7[_0xcd3c('0x34')][_0xcd3c('0x47')]=_0xdc4260['id'];if(_0x1049de[_0xcd3c('0x2e')][_0xcd3c('0x36')]){_0x1e0fa7['where']=_[_0xcd3c('0x37')](_0x1e0fa7[_0xcd3c('0x34')],{'$or':_['map'](_0x1e0fa7[_0xcd3c('0x2f')],function(_0x1a6ad5){var _0x7dac58={};_0x7dac58[_0x1a6ad5]={'$like':'%'+_0x1049de['query'][_0xcd3c('0x36')]+'%'};return _0x7dac58;})});}_0x1e0fa7=_[_0xcd3c('0x37')]({},_0x1e0fa7,_0x1049de[_0xcd3c('0x38')]);return db[_0xcd3c('0x48')][_0xcd3c('0x17')]({'where':_0x1e0fa7['where']})[_0xcd3c('0x39')](function(_0x57b594){_0x479bff['count']=_0x57b594;if(_0x1049de['query']['includeAll']){_0x1e0fa7[_0xcd3c('0x3d')]=[{'all':!![]}];}return db[_0xcd3c('0x48')][_0xcd3c('0x49')](_0x1e0fa7);})['then'](function(_0x3388ee){_0x479bff[_0xcd3c('0x4a')]=_0x3388ee;return _0x479bff;});}})[_0xcd3c('0x39')](respondWithFilteredResult(_0x2f4a70,_0x1e0fa7))['catch'](handleError(_0x2f4a70,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c3a78e6..87c6d29 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 _0x8ab4=['path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','lodash','util','api','moment','bluebird','request-promise'];(function(_0x578d3f,_0x303642){var _0xe7eed9=function(_0x1198f1){while(--_0x1198f1){_0x578d3f['push'](_0x578d3f['shift']());}};_0xe7eed9(++_0x303642);}(_0x8ab4,0xc6));var _0x48ab=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x8ab4[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x48ab('0x0'));var util=require(_0x48ab('0x1'));var logger=require('../../config/logger')(_0x48ab('0x2'));var moment=require(_0x48ab('0x3'));var BPromise=require(_0x48ab('0x4'));var rp=require(_0x48ab('0x5'));var fs=require('fs');var path=require(_0x48ab('0x6'));var rimraf=require(_0x48ab('0x7'));var config=require(_0x48ab('0x8'));var attributes=require(_0x48ab('0x9'));module['exports']=function(_0x3430bd,_0x1f81fd){return _0x3430bd[_0x48ab('0xa')](_0x48ab('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdc5=['exports','JscriptySessionReport','report_jscripty_sessions','util','bluebird','request-promise','rimraf','./jscriptySessionReport.attributes'];(function(_0x4cefca,_0x2d2393){var _0x1b3d9b=function(_0x2210a7){while(--_0x2210a7){_0x4cefca['push'](_0x4cefca['shift']());}};_0x1b3d9b(++_0x2d2393);}(_0xbdc5,0xb3));var _0x5bdc=function(_0x56e072,_0x31b690){_0x56e072=_0x56e072-0x0;var _0x378a1c=_0xbdc5[_0x56e072];return _0x378a1c;};'use strict';var _=require('lodash');var util=require(_0x5bdc('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5bdc('0x1'));var rp=require(_0x5bdc('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bdc('0x3'));var config=require('../../config/environment');var attributes=require(_0x5bdc('0x4'));module[_0x5bdc('0x5')]=function(_0x22bb84,_0x16d10b){return _0x22bb84['define'](_0x5bdc('0x6'),attributes,{'tableName':_0x5bdc('0x7'),'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 cc7eeec..b338dac 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 _0x7615=['stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x747024,_0x41d27d){var _0x4fa005=function(_0x2c1c2a){while(--_0x2c1c2a){_0x747024['push'](_0x747024['shift']());}};_0x4fa005(++_0x41d27d);}(_0x7615,0xec));var _0x5761=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7615[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x5761('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5761('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5761('0x2'));var db=require(_0x5761('0x3'))['db'];var utils=require(_0x5761('0x4'));var logger=require(_0x5761('0x5'))('rpc');var config=require(_0x5761('0x6'));var jayson=require(_0x5761('0x7'));var client=jayson[_0x5761('0x8')][_0x5761('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13c008,_0x230f37,_0x5b1534){return new BPromise(function(_0x1505ab,_0x72c1f1){return client[_0x5761('0xa')](_0x13c008,_0x5b1534)[_0x5761('0xb')](function(_0x39f06a){logger[_0x5761('0xc')](_0x5761('0xd'),_0x230f37,_0x5761('0xe'));logger[_0x5761('0xf')](_0x5761('0x10'),_0x230f37,_0x5761('0xe'),JSON[_0x5761('0x11')](_0x39f06a));if(_0x39f06a['error']){if(_0x39f06a[_0x5761('0x12')][_0x5761('0x13')]===0x1f4){logger[_0x5761('0x12')](_0x5761('0xd'),_0x230f37,_0x39f06a['error']['message']);return _0x72c1f1(_0x39f06a[_0x5761('0x12')][_0x5761('0x14')]);}logger[_0x5761('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x230f37,_0x39f06a['error'][_0x5761('0x14')]);return _0x1505ab(_0x39f06a[_0x5761('0x12')]['message']);}else{logger[_0x5761('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x230f37,_0x5761('0xe'));_0x1505ab(_0x39f06a[_0x5761('0x15')][_0x5761('0x14')]);}})[_0x5761('0x16')](function(_0xfcd5ef){logger[_0x5761('0x12')](_0x5761('0xd'),_0x230f37,_0xfcd5ef);_0x72c1f1(_0xfcd5ef);});});} \ No newline at end of file +var _0xc2e9=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xc2e9,0xce));var _0x9c2e=function(_0x2cc9e1,_0x5cf834){_0x2cc9e1=_0x2cc9e1-0x0;var _0x31a711=_0xc2e9[_0x2cc9e1];return _0x31a711;};'use strict';var _=require(_0x9c2e('0x0'));var util=require(_0x9c2e('0x1'));var moment=require(_0x9c2e('0x2'));var BPromise=require(_0x9c2e('0x3'));var rs=require(_0x9c2e('0x4'));var fs=require('fs');var Redis=require(_0x9c2e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c2e('0x6'));var logger=require(_0x9c2e('0x7'))('rpc');var config=require(_0x9c2e('0x8'));var jayson=require(_0x9c2e('0x9'));var client=jayson[_0x9c2e('0xa')][_0x9c2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b3425,_0x4ae4d9,_0x19d0c3){return new BPromise(function(_0x1ef014,_0xc7f2c5){return client['request'](_0x3b3425,_0x19d0c3)['then'](function(_0xe4e95c){logger[_0x9c2e('0xc')](_0x9c2e('0xd'),_0x4ae4d9,_0x9c2e('0xe'));logger[_0x9c2e('0xf')](_0x9c2e('0x10'),_0x4ae4d9,_0x9c2e('0xe'),JSON[_0x9c2e('0x11')](_0xe4e95c));if(_0xe4e95c[_0x9c2e('0x12')]){if(_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x13')]===0x1f4){logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4ae4d9,_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x14')]);return _0xc7f2c5(_0xe4e95c[_0x9c2e('0x12')]['message']);}logger[_0x9c2e('0x12')](_0x9c2e('0xd'),_0x4ae4d9,_0xe4e95c[_0x9c2e('0x12')]['message']);return _0x1ef014(_0xe4e95c[_0x9c2e('0x12')][_0x9c2e('0x14')]);}else{logger['info'](_0x9c2e('0xd'),_0x4ae4d9,_0x9c2e('0xe'));_0x1ef014(_0xe4e95c[_0x9c2e('0x15')][_0x9c2e('0x14')]);}})[_0x9c2e('0x16')](function(_0x9a64ca){logger[_0x9c2e('0x12')](_0x9c2e('0xd'),_0x4ae4d9,_0x9a64ca);_0xc7f2c5(_0x9a64ca);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7a84437..b0e3ea1 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 _0x0fc7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','util','path','connect-timeout','express'];(function(_0x3f8aa5,_0x3a131e){var _0x55e368=function(_0x25fc96){while(--_0x25fc96){_0x3f8aa5['push'](_0x3f8aa5['shift']());}};_0x55e368(++_0x3a131e);}(_0x0fc7,0xcc));var _0x70fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0fc7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x70fc('0x0'));var path=require(_0x70fc('0x1'));var timeout=require(_0x70fc('0x2'));var express=require(_0x70fc('0x3'));var router=express[_0x70fc('0x4')]();var auth=require(_0x70fc('0x5'));var interaction=require(_0x70fc('0x6'));var config=require(_0x70fc('0x7'));var controller=require(_0x70fc('0x8'));router[_0x70fc('0x9')]('/',controller[_0x70fc('0xa')]);router[_0x70fc('0xb')](_0x70fc('0xc'),auth[_0x70fc('0xd')](),controller[_0x70fc('0xe')]);module[_0x70fc('0xf')]=router; \ No newline at end of file +var _0xdf79=['Router','../../components/auth/service','../../components/interaction/service','./license.controller','index','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout'];(function(_0x3f1673,_0x85a8e){var _0x18a77c=function(_0x19acc9){while(--_0x19acc9){_0x3f1673['push'](_0x3f1673['shift']());}};_0x18a77c(++_0x85a8e);}(_0xdf79,0x106));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9df7('0x0'));var util=require(_0x9df7('0x1'));var path=require(_0x9df7('0x2'));var timeout=require(_0x9df7('0x3'));var express=require('express');var router=express[_0x9df7('0x4')]();var auth=require(_0x9df7('0x5'));var interaction=require(_0x9df7('0x6'));var config=require('../../config/environment');var controller=require(_0x9df7('0x7'));router['get']('/',controller[_0x9df7('0x8')]);router[_0x9df7('0x9')](_0x9df7('0xa'),auth[_0x9df7('0xb')](),controller[_0x9df7('0xc')]);module[_0x9df7('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 ef55c28..80c5714 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 _0xdc97=['exports','TEXT','STRING','sequelize'];(function(_0x2b36f5,_0x5732dc){var _0x5f06b6=function(_0x5def4f){while(--_0x5def4f){_0x2b36f5['push'](_0x2b36f5['shift']());}};_0x5f06b6(++_0x5732dc);}(_0xdc97,0x13b));var _0x7dc9=function(_0x25673f,_0x303ca8){_0x25673f=_0x25673f-0x0;var _0x52882f=_0xdc97[_0x25673f];return _0x52882f;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'license':{'type':Sequelize[_0x7dc9('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7dc9('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x687b=['TEXT','STRING','sequelize','exports'];(function(_0x311fdd,_0x1d3fcd){var _0x2a34ed=function(_0xefc465){while(--_0xefc465){_0x311fdd['push'](_0x311fdd['shift']());}};_0x2a34ed(++_0x1d3fcd);}(_0x687b,0x14a));var _0xb687=function(_0x5534b7,_0xbe6ba4){_0x5534b7=_0x5534b7-0x0;var _0x34af05=_0x687b[_0x5534b7];return _0x34af05;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'license':{'type':Sequelize[_0xb687('0x2')]},'data1':{'type':Sequelize[_0xb687('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 39067bb..ecd2e7f 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 _0x1d77=['name','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','merge','getLicense','catch','body','find','params','get','key','demo','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','then','destroy','error'];(function(_0x1478a5,_0x1c795f){var _0xa41acc=function(_0x20b7cd){while(--_0x20b7cd){_0x1478a5['push'](_0x1478a5['shift']());}};_0xa41acc(++_0x1c795f);}(_0x1d77,0xc4));var _0x71d7=function(_0x20714a,_0x7de591){_0x20714a=_0x20714a-0x0;var _0x15e877=_0x1d77[_0x20714a];return _0x15e877;};'use strict';var pdf=require(_0x71d7('0x0'));var emlformat=require(_0x71d7('0x1'));var rimraf=require(_0x71d7('0x2'));var zipdir=require(_0x71d7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x71d7('0x4'));var moment=require(_0x71d7('0x5'));var BPromise=require(_0x71d7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x71d7('0x7'));var sox=require(_0x71d7('0x8'));var csv=require(_0x71d7('0x9'));var ejs=require(_0x71d7('0xa'));var fs=require('fs');var _=require(_0x71d7('0xb'));var squel=require(_0x71d7('0xc'));var crypto=require('crypto');var jsforce=require(_0x71d7('0xd'));var deskjs=require(_0x71d7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71d7('0xf'));var Redis=require(_0x71d7('0x10'));var authService=require(_0x71d7('0x11'));var qs=require(_0x71d7('0x12'));var as=require(_0x71d7('0x13'));var hardwareService=require(_0x71d7('0x14'));var logger=require(_0x71d7('0x15'))(_0x71d7('0x16'));var utils=require('../../config/utils');var config=require(_0x71d7('0x17'));var db=require(_0x71d7('0x18'))['db'];function respondWithStatusCode(_0x94250e,_0x560153){_0x560153=_0x560153||0xcc;return function(_0x635129){if(_0x635129){return _0x94250e[_0x71d7('0x19')](_0x560153);}return _0x94250e['status'](_0x560153)[_0x71d7('0x1a')]();};}function respondWithResult(_0x1fa82b,_0x3f74b8){_0x3f74b8=_0x3f74b8||0xc8;return function(_0x1d249d){if(_0x1d249d){return _0x1fa82b[_0x71d7('0x1b')](_0x3f74b8)[_0x71d7('0x1c')](_0x1d249d);}};}function respondWithFilteredResult(_0x1a9e1c,_0x2a5cc1){return function(_0x1744bc){if(_0x1744bc){var _0x3571c8=_0x1744bc['count'],_0x3f27e7=_0x2a5cc1['offset'],_0x363afc=_0x2a5cc1[_0x71d7('0x1d')]+_0x2a5cc1[_0x71d7('0x1e')],_0x5ae76b;if(_0x363afc>=_0x3571c8){_0x363afc=_0x3571c8;_0x5ae76b=0xc8;}else{_0x5ae76b=0xce;}_0x1a9e1c['status'](_0x5ae76b);return _0x1a9e1c[_0x71d7('0x1f')]('Content-Range',_0x3f27e7+'-'+_0x363afc+'/'+_0x3571c8)[_0x71d7('0x1c')](_0x1744bc);}return null;};}function patchUpdates(_0x118fd0){return function(_0x5e382b){try{jsonpatch['apply'](_0x5e382b,_0x118fd0,!![]);}catch(_0xc98f6c){return BPromise[_0x71d7('0x20')](_0xc98f6c);}return _0x5e382b['save']();};}function saveUpdates(_0x544d82,_0x887c80){return function(_0x4da470){if(_0x4da470){return _0x4da470['update'](_0x544d82)[_0x71d7('0x21')](function(_0x1c8b98){return _0x1c8b98;});}return null;};}function removeEntity(_0x382f61,_0x46e0c0){return function(_0x459371){if(_0x459371){return _0x459371[_0x71d7('0x22')]()['then'](function(){_0x382f61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2643c1,_0x2fa1c9){return function(_0x3fc7f6){if(!_0x3fc7f6){_0x2643c1[_0x71d7('0x19')](0x194);}return _0x3fc7f6;};}function handleError(_0x512068,_0x514add){_0x514add=_0x514add||0x1f4;return function(_0x36cc60){logger[_0x71d7('0x23')](_0x36cc60['stack']);if(_0x36cc60[_0x71d7('0x24')]){delete _0x36cc60[_0x71d7('0x24')];}_0x512068['status'](_0x514add)['send'](_0x36cc60);};}var utilLicense=require(_0x71d7('0x25'));exports[_0x71d7('0x26')]=function(_0x10233d,_0x1a7242){var _0x23407a={'raw':!![],'where':{'id':0x1}},_0x2f5a5f={};_0x2f5a5f[_0x71d7('0x27')]=_[_0x71d7('0x28')](db[_0x71d7('0x29')][_0x71d7('0x2a')]);_0x2f5a5f['query']=_[_0x71d7('0x28')](_0x10233d[_0x71d7('0x2b')]);_0x2f5a5f[_0x71d7('0x2c')]=_[_0x71d7('0x2d')](_0x2f5a5f['model'],_0x2f5a5f[_0x71d7('0x2b')]);_0x23407a['attributes']=_[_0x71d7('0x2d')](_0x2f5a5f[_0x71d7('0x27')],qs['fields'](_0x10233d[_0x71d7('0x2b')][_0x71d7('0x2e')]));_0x23407a[_0x71d7('0x2f')]=_0x23407a[_0x71d7('0x2f')][_0x71d7('0x30')]?_0x23407a[_0x71d7('0x2f')]:_0x2f5a5f[_0x71d7('0x27')];_0x23407a=_[_0x71d7('0x31')]({},_0x23407a,_0x10233d['options']);return utilLicense[_0x71d7('0x32')](_0x23407a)[_0x71d7('0x21')](respondWithResult(_0x1a7242,null))[_0x71d7('0x33')](handleError(_0x1a7242,null));};exports['update']=function(_0x57b5e8,_0x12e078){if(_0x57b5e8['body']['id']){delete _0x57b5e8[_0x71d7('0x34')]['id'];}return db['License'][_0x71d7('0x35')]({'where':{'id':_0x57b5e8[_0x71d7('0x36')]['id']}})[_0x71d7('0x21')](handleEntityNotFound(_0x12e078,null))['then'](function(_0x4c3f44){var _0x5866ca=_0x4c3f44[_0x71d7('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x5866ca,_0x57b5e8[_0x71d7('0x34')][_0x71d7('0x38')]);})[_0x71d7('0x21')](function(_0x11e329){if(!_0x11e329[_0x71d7('0x39')]){return saveUpdates(_0x57b5e8[_0x71d7('0x34')],null);}return _0x11e329;})['then'](respondWithResult(_0x12e078,null))[_0x71d7('0x33')](handleError(_0x12e078,null));}; \ No newline at end of file +var _0x4740=['destroy','error','stack','name','send','index','model','License','rawAttributes','query','keys','filters','attributes','intersection','fields','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','then'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x4740,0xca));var _0x0474=function(_0x5c7ed8,_0xc5e5f8){_0x5c7ed8=_0x5c7ed8-0x0;var _0x2d0148=_0x4740[_0x5c7ed8];return _0x2d0148;};'use strict';var pdf=require(_0x0474('0x0'));var emlformat=require(_0x0474('0x1'));var rimraf=require(_0x0474('0x2'));var zipdir=require(_0x0474('0x3'));var jsonpatch=require(_0x0474('0x4'));var rp=require('request-promise');var moment=require(_0x0474('0x5'));var BPromise=require(_0x0474('0x6'));var Mustache=require(_0x0474('0x7'));var util=require(_0x0474('0x8'));var path=require(_0x0474('0x9'));var sox=require('sox');var csv=require(_0x0474('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0474('0xb'));var crypto=require(_0x0474('0xc'));var jsforce=require(_0x0474('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0474('0xa'));var querystring=require(_0x0474('0xe'));var Papa=require(_0x0474('0xf'));var Redis=require(_0x0474('0x10'));var authService=require(_0x0474('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0474('0x12'));var logger=require(_0x0474('0x13'))(_0x0474('0x14'));var utils=require(_0x0474('0x15'));var config=require('../../config/environment');var db=require(_0x0474('0x16'))['db'];function respondWithStatusCode(_0x660c90,_0x34c4ba){_0x34c4ba=_0x34c4ba||0xcc;return function(_0x3e310d){if(_0x3e310d){return _0x660c90[_0x0474('0x17')](_0x34c4ba);}return _0x660c90[_0x0474('0x18')](_0x34c4ba)[_0x0474('0x19')]();};}function respondWithResult(_0x202dbf,_0x4298d2){_0x4298d2=_0x4298d2||0xc8;return function(_0x31939a){if(_0x31939a){return _0x202dbf[_0x0474('0x18')](_0x4298d2)['json'](_0x31939a);}};}function respondWithFilteredResult(_0x53121e,_0x458aac){return function(_0x5b0e7e){if(_0x5b0e7e){var _0xd8b3e=_0x5b0e7e[_0x0474('0x1a')],_0x2bece4=_0x458aac[_0x0474('0x1b')],_0x261454=_0x458aac['offset']+_0x458aac['limit'],_0x57a6fe;if(_0x261454>=_0xd8b3e){_0x261454=_0xd8b3e;_0x57a6fe=0xc8;}else{_0x57a6fe=0xce;}_0x53121e[_0x0474('0x18')](_0x57a6fe);return _0x53121e[_0x0474('0x1c')](_0x0474('0x1d'),_0x2bece4+'-'+_0x261454+'/'+_0xd8b3e)[_0x0474('0x1e')](_0x5b0e7e);}return null;};}function patchUpdates(_0x38e7e1){return function(_0x4fc1a3){try{jsonpatch[_0x0474('0x1f')](_0x4fc1a3,_0x38e7e1,!![]);}catch(_0x4855be){return BPromise['reject'](_0x4855be);}return _0x4fc1a3[_0x0474('0x20')]();};}function saveUpdates(_0x194980,_0x2a3b44){return function(_0x128743){if(_0x128743){return _0x128743['update'](_0x194980)[_0x0474('0x21')](function(_0x4fdfb6){return _0x4fdfb6;});}return null;};}function removeEntity(_0x41b70b,_0x5c24db){return function(_0x5a27fa){if(_0x5a27fa){return _0x5a27fa[_0x0474('0x22')]()[_0x0474('0x21')](function(){_0x41b70b[_0x0474('0x18')](0xcc)[_0x0474('0x19')]();});}};}function handleEntityNotFound(_0x19214c,_0x2c0114){return function(_0x230aaf){if(!_0x230aaf){_0x19214c[_0x0474('0x17')](0x194);}return _0x230aaf;};}function handleError(_0x1db02a,_0x5497e4){_0x5497e4=_0x5497e4||0x1f4;return function(_0x3b224e){logger[_0x0474('0x23')](_0x3b224e[_0x0474('0x24')]);if(_0x3b224e[_0x0474('0x25')]){delete _0x3b224e['name'];}_0x1db02a[_0x0474('0x18')](_0x5497e4)[_0x0474('0x26')](_0x3b224e);};}var utilLicense=require('../../config/license/util');exports[_0x0474('0x27')]=function(_0xe54e4,_0x28c3b3){var _0x25a3c0={'raw':!![],'where':{'id':0x1}},_0x172921={};_0x172921[_0x0474('0x28')]=_['keys'](db[_0x0474('0x29')][_0x0474('0x2a')]);_0x172921[_0x0474('0x2b')]=_[_0x0474('0x2c')](_0xe54e4[_0x0474('0x2b')]);_0x172921[_0x0474('0x2d')]=_['intersection'](_0x172921['model'],_0x172921[_0x0474('0x2b')]);_0x25a3c0[_0x0474('0x2e')]=_[_0x0474('0x2f')](_0x172921[_0x0474('0x28')],qs[_0x0474('0x30')](_0xe54e4[_0x0474('0x2b')][_0x0474('0x30')]));_0x25a3c0[_0x0474('0x2e')]=_0x25a3c0[_0x0474('0x2e')]['length']?_0x25a3c0['attributes']:_0x172921[_0x0474('0x28')];_0x25a3c0=_[_0x0474('0x31')]({},_0x25a3c0,_0xe54e4[_0x0474('0x32')]);return utilLicense[_0x0474('0x33')](_0x25a3c0)[_0x0474('0x21')](respondWithResult(_0x28c3b3,null))[_0x0474('0x34')](handleError(_0x28c3b3,null));};exports['update']=function(_0x18f2cb,_0x213e02){if(_0x18f2cb[_0x0474('0x35')]['id']){delete _0x18f2cb[_0x0474('0x35')]['id'];}return db[_0x0474('0x29')][_0x0474('0x36')]({'where':{'id':_0x18f2cb[_0x0474('0x37')]['id']}})[_0x0474('0x21')](handleEntityNotFound(_0x213e02,null))['then'](function(_0x5546f3){var _0x3dd686=_0x5546f3[_0x0474('0x38')]({'plain':!![]});return utilLicense[_0x0474('0x39')](_0x3dd686,_0x18f2cb[_0x0474('0x35')][_0x0474('0x3a')]);})[_0x0474('0x21')](function(_0x27d048){if(!_0x27d048['demo']){return saveUpdates(_0x18f2cb[_0x0474('0x35')],null);}return _0x27d048;})['then'](respondWithResult(_0x213e02,null))['catch'](handleError(_0x213e02,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index b381623..16bacfd 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 _0xc7ac=['request-promise','rimraf','../../config/environment','./license.attributes','define','License','license','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc7ac,0xc2));var _0xcc7a=function(_0x122b96,_0x32b176){_0x122b96=_0x122b96-0x0;var _0x4e96a5=_0xc7ac[_0x122b96];return _0x4e96a5;};'use strict';var _=require(_0xcc7a('0x0'));var util=require(_0xcc7a('0x1'));var logger=require('../../config/logger')(_0xcc7a('0x2'));var moment=require(_0xcc7a('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc7a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc7a('0x5'));var config=require(_0xcc7a('0x6'));var attributes=require(_0xcc7a('0x7'));module['exports']=function(_0x3e910d,_0x32bb05){return _0x3e910d[_0xcc7a('0x8')](_0xcc7a('0x9'),attributes,{'tableName':_0xcc7a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96fa=['../../config/environment','exports','License','license','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x96fa,0xc4));var _0xa96f=function(_0x25684e,_0x1d9bd7){_0x25684e=_0x25684e-0x0;var _0x3eaa08=_0x96fa[_0x25684e];return _0x3eaa08;};'use strict';var _=require(_0xa96f('0x0'));var util=require(_0xa96f('0x1'));var logger=require(_0xa96f('0x2'))(_0xa96f('0x3'));var moment=require(_0xa96f('0x4'));var BPromise=require(_0xa96f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa96f('0x6'));var rimraf=require(_0xa96f('0x7'));var config=require(_0xa96f('0x8'));var attributes=require('./license.attributes');module[_0xa96f('0x9')]=function(_0xc1a373,_0x1cc2d7){return _0xc1a373['define'](_0xa96f('0xa'),attributes,{'tableName':_0xa96f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index a5e2877..6e464c7 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 _0x847d=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','License,\x20%s,\x20%s','message','info','result','catch'];(function(_0x28636d,_0x3ee072){var _0x1a095d=function(_0xf62f0b){while(--_0xf62f0b){_0x28636d['push'](_0x28636d['shift']());}};_0x1a095d(++_0x3ee072);}(_0x847d,0x14a));var _0xd847=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x847d[_0x3074f3];return _0x53f112;};'use strict';var _=require('lodash');var util=require(_0xd847('0x0'));var moment=require(_0xd847('0x1'));var BPromise=require(_0xd847('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd847('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd847('0x4'));var logger=require(_0xd847('0x5'))('rpc');var config=require(_0xd847('0x6'));var jayson=require(_0xd847('0x7'));var client=jayson[_0xd847('0x8')][_0xd847('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3349,_0x20dbfd,_0x19fdb5){return new BPromise(function(_0x2bb22b,_0x235e82){return client[_0xd847('0xa')](_0x5f3349,_0x19fdb5)[_0xd847('0xb')](function(_0x17cb36){logger['info']('License,\x20%s,\x20%s',_0x20dbfd,'request\x20sent');logger['debug'](_0xd847('0xc'),_0x20dbfd,_0xd847('0xd'),JSON[_0xd847('0xe')](_0x17cb36));if(_0x17cb36['error']){if(_0x17cb36['error'][_0xd847('0xf')]===0x1f4){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x235e82(_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);}logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x2bb22b(_0x17cb36['error'][_0xd847('0x12')]);}else{logger[_0xd847('0x13')](_0xd847('0x11'),_0x20dbfd,_0xd847('0xd'));_0x2bb22b(_0x17cb36[_0xd847('0x14')]['message']);}})[_0xd847('0x15')](function(_0x3e1e1c){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x3e1e1c);_0x235e82(_0x3e1e1c);});});} \ No newline at end of file +var _0x8369=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8369,0x10b));var _0x9836=function(_0x16318f,_0x49219d){_0x16318f=_0x16318f-0x0;var _0x46fe2c=_0x8369[_0x16318f];return _0x46fe2c;};'use strict';var _=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var moment=require(_0x9836('0x2'));var BPromise=require(_0x9836('0x3'));var rs=require(_0x9836('0x4'));var fs=require('fs');var Redis=require(_0x9836('0x5'));var db=require(_0x9836('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9836('0x7'))('rpc');var config=require(_0x9836('0x8'));var jayson=require(_0x9836('0x9'));var client=jayson['client'][_0x9836('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e4979,_0x52ae78,_0x37214e){return new BPromise(function(_0x3007ed,_0x16db95){return client[_0x9836('0xb')](_0x2e4979,_0x37214e)['then'](function(_0x30bc66){logger[_0x9836('0xc')](_0x9836('0xd'),_0x52ae78,_0x9836('0xe'));logger['debug'](_0x9836('0xf'),_0x52ae78,_0x9836('0xe'),JSON[_0x9836('0x10')](_0x30bc66));if(_0x30bc66[_0x9836('0x11')]){if(_0x30bc66[_0x9836('0x11')]['code']===0x1f4){logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);return _0x16db95(_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);}logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x30bc66['error'][_0x9836('0x12')]);return _0x3007ed(_0x30bc66[_0x9836('0x11')][_0x9836('0x12')]);}else{logger['info'](_0x9836('0xd'),_0x52ae78,'request\x20sent');_0x3007ed(_0x30bc66[_0x9836('0x13')]['message']);}})[_0x9836('0x14')](function(_0x22f9b5){logger[_0x9836('0x11')](_0x9836('0xd'),_0x52ae78,_0x22f9b5);_0x16db95(_0x22f9b5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 26e88f2..e316b46 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 _0x66d8=['isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','addImap','addSmtp','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get'];(function(_0x371a87,_0x3e3b35){var _0x28bd03=function(_0x1236ad){while(--_0x1236ad){_0x371a87['push'](_0x371a87['shift']());}};_0x28bd03(++_0x3e3b35);}(_0x66d8,0x18d));var _0x866d=function(_0x112a3e,_0x23f15c){_0x112a3e=_0x112a3e-0x0;var _0x577bfc=_0x66d8[_0x112a3e];return _0x577bfc;};'use strict';var multer=require('multer');var util=require(_0x866d('0x0'));var path=require(_0x866d('0x1'));var timeout=require(_0x866d('0x2'));var express=require(_0x866d('0x3'));var router=express['Router']();var auth=require(_0x866d('0x4'));var interaction=require(_0x866d('0x5'));var config=require('../../config/environment');var controller=require(_0x866d('0x6'));router[_0x866d('0x7')]('/',auth[_0x866d('0x8')](),controller[_0x866d('0x9')]);router['get']('/describe',auth[_0x866d('0x8')](),controller[_0x866d('0xa')]);router[_0x866d('0x7')](_0x866d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x866d('0x7')](_0x866d('0xc'),auth[_0x866d('0x8')](),controller[_0x866d('0xd')]);router['get']('/:id/canned_answers',auth[_0x866d('0x8')](),controller['getAnswers']);router['get'](_0x866d('0xe'),auth[_0x866d('0x8')](),controller[_0x866d('0xf')]);router[_0x866d('0x7')](_0x866d('0x10'),auth[_0x866d('0x8')](),controller[_0x866d('0x11')]);router[_0x866d('0x7')](_0x866d('0x12'),auth[_0x866d('0x8')](),controller[_0x866d('0x13')]);router[_0x866d('0x7')](_0x866d('0x14'),auth['isAuthenticated'](),controller['getApplications']);router[_0x866d('0x7')](_0x866d('0x15'),auth[_0x866d('0x8')](),controller[_0x866d('0x16')]);router[_0x866d('0x7')](_0x866d('0x17'),auth[_0x866d('0x8')](),controller['verifySmtp']);router['get'](_0x866d('0x18'),auth[_0x866d('0x8')](),controller[_0x866d('0x19')]);router['post'](_0x866d('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x866d('0x1a')](_0x866d('0x1b'),auth[_0x866d('0x8')](),controller[_0x866d('0x1c')]);router['post']('/',auth['isAuthenticated'](),controller[_0x866d('0x1d')]);router[_0x866d('0x1a')](_0x866d('0xe'),auth[_0x866d('0x8')](),controller[_0x866d('0x1e')]);router[_0x866d('0x1a')]('/:id/out_servers',auth[_0x866d('0x8')](),controller[_0x866d('0x1f')]);router[_0x866d('0x1a')](_0x866d('0x12'),auth[_0x866d('0x8')](),controller['addInteraction']);router[_0x866d('0x1a')]('/:id/applications',auth[_0x866d('0x8')](),controller['addApplications']);router[_0x866d('0x1a')](_0x866d('0x20'),auth['isAuthenticated'](),controller[_0x866d('0x21')]);router[_0x866d('0x1a')](_0x866d('0x18'),auth[_0x866d('0x8')](),controller[_0x866d('0x22')]);router[_0x866d('0x23')](_0x866d('0xb'),auth[_0x866d('0x8')](),controller[_0x866d('0x24')]);router['delete'](_0x866d('0xc'),auth[_0x866d('0x8')](),controller[_0x866d('0x25')]);router[_0x866d('0x26')](_0x866d('0x1b'),auth[_0x866d('0x8')](),controller[_0x866d('0x27')]);router[_0x866d('0x26')]('/:id/in_servers',auth[_0x866d('0x8')](),controller[_0x866d('0x28')]);router[_0x866d('0x26')](_0x866d('0x10'),auth[_0x866d('0x8')](),controller[_0x866d('0x29')]);router[_0x866d('0x26')](_0x866d('0xb'),auth[_0x866d('0x8')](),controller[_0x866d('0x2a')]);router[_0x866d('0x26')](_0x866d('0x18'),auth[_0x866d('0x8')](),controller[_0x866d('0x2b')]);module[_0x866d('0x2c')]=router; \ No newline at end of file +var _0x62a5=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getApplications','getMessages','/:id/verify','verifySmtp','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','addImap','addSmtp','/:id/applications','send','/:id/users','addAgents','update','delete','removeDispositions','removeImap','destroy','removeAgents','exports','util'];(function(_0x4e250d,_0x3646fa){var _0x2b819e=function(_0x39a967){while(--_0x39a967){_0x4e250d['push'](_0x4e250d['shift']());}};_0x2b819e(++_0x3646fa);}(_0x62a5,0x1ee));var _0x562a=function(_0x4c7f66,_0x268f78){_0x4c7f66=_0x4c7f66-0x0;var _0x4046bc=_0x62a5[_0x4c7f66];return _0x4046bc;};'use strict';var multer=require('multer');var util=require(_0x562a('0x0'));var path=require(_0x562a('0x1'));var timeout=require(_0x562a('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x562a('0x3'));var interaction=require(_0x562a('0x4'));var config=require(_0x562a('0x5'));var controller=require(_0x562a('0x6'));router['get']('/',auth[_0x562a('0x7')](),controller[_0x562a('0x8')]);router['get'](_0x562a('0x9'),auth[_0x562a('0x7')](),controller[_0x562a('0xa')]);router[_0x562a('0xb')](_0x562a('0xc'),auth[_0x562a('0x7')](),controller[_0x562a('0xd')]);router[_0x562a('0xb')]('/:id/dispositions',auth[_0x562a('0x7')](),controller[_0x562a('0xe')]);router[_0x562a('0xb')](_0x562a('0xf'),auth['isAuthenticated'](),controller[_0x562a('0x10')]);router[_0x562a('0xb')](_0x562a('0x11'),auth[_0x562a('0x7')](),controller[_0x562a('0x12')]);router[_0x562a('0xb')](_0x562a('0x13'),auth[_0x562a('0x7')](),controller[_0x562a('0x14')]);router['get'](_0x562a('0x15'),auth[_0x562a('0x7')](),controller['getInteractions']);router[_0x562a('0xb')]('/:id/applications',auth['isAuthenticated'](),controller[_0x562a('0x16')]);router[_0x562a('0xb')]('/:id/messages',auth[_0x562a('0x7')](),controller[_0x562a('0x17')]);router[_0x562a('0xb')](_0x562a('0x18'),auth[_0x562a('0x7')](),controller[_0x562a('0x19')]);router['get']('/:id/users',auth[_0x562a('0x7')](),controller[_0x562a('0x1a')]);router['post'](_0x562a('0x1b'),auth[_0x562a('0x7')](),controller[_0x562a('0x1c')]);router[_0x562a('0x1d')]('/:id/canned_answers',auth[_0x562a('0x7')](),controller[_0x562a('0x1e')]);router[_0x562a('0x1d')]('/',auth[_0x562a('0x7')](),controller[_0x562a('0x1f')]);router[_0x562a('0x1d')](_0x562a('0x11'),auth['isAuthenticated'](),controller[_0x562a('0x20')]);router['post'](_0x562a('0x13'),auth[_0x562a('0x7')](),controller[_0x562a('0x21')]);router[_0x562a('0x1d')](_0x562a('0x15'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x562a('0x1d')](_0x562a('0x22'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x562a('0x23')]);router[_0x562a('0x1d')](_0x562a('0x24'),auth[_0x562a('0x7')](),controller[_0x562a('0x25')]);router['put'](_0x562a('0xc'),auth[_0x562a('0x7')](),controller[_0x562a('0x26')]);router[_0x562a('0x27')](_0x562a('0x1b'),auth[_0x562a('0x7')](),controller[_0x562a('0x28')]);router[_0x562a('0x27')](_0x562a('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x562a('0x27')](_0x562a('0x11'),auth[_0x562a('0x7')](),controller[_0x562a('0x29')]);router[_0x562a('0x27')](_0x562a('0x13'),auth[_0x562a('0x7')](),controller['removeSmtp']);router[_0x562a('0x27')]('/:id',auth[_0x562a('0x7')](),controller[_0x562a('0x2a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x562a('0x2b')]);module[_0x562a('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e5a4a05..1b5683f 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 _0x7a52=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x7a52,0x118));var _0x27a5=function(_0x1ce537,_0x4d0032){_0x1ce537=_0x1ce537-0x0;var _0x3220f1=_0x7a52[_0x1ce537];return _0x3220f1;};'use strict';var Sequelize=require(_0x27a5('0x0'));module[_0x27a5('0x1')]={'description':{'type':Sequelize[_0x27a5('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x27a5('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x27a5('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x27a5('0x4')]},'markAsUnread':{'type':Sequelize[_0x27a5('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x27a5('0x2')],'allowNull':![],'defaultValue':_0x27a5('0x5')},'fontSize':{'type':Sequelize[_0x27a5('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x27a5('0x4')],'defaultValue':function(){return _0x27a5('0x7');}},'notificationSound':{'type':Sequelize[_0x27a5('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x27a5('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x27a5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x27a5('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x27a5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x27a5('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x27a5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x27a5('0x3')],'defaultValue':![],'comment':_0x27a5('0x9'),'set':function(_0x3fcef5){if(!_0x3fcef5)this[_0x27a5('0xa')](_0x27a5('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x3fcef5);}}}; \ No newline at end of file +var _0xa5ab=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0xa5ab,0x13b));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xba5a('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0xba5a('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xba5a('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xba5a('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0xba5a('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0xba5a('0x2')]},'markAsUnread':{'type':Sequelize[_0xba5a('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xba5a('0x0')],'allowNull':![],'defaultValue':_0xba5a('0x3')},'fontSize':{'type':Sequelize[_0xba5a('0x4')](0x2)[_0xba5a('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xba5a('0x2')],'defaultValue':function(){return _0xba5a('0x6');}},'notificationSound':{'type':Sequelize[_0xba5a('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba5a('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xba5a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xba5a('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba5a('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba5a('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xba5a('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xba5a('0x1')],'defaultValue':![],'comment':_0xba5a('0x8'),'set':function(_0x2a7f3a){if(!_0x2a7f3a)this['setDataValue'](_0xba5a('0x9'),null);this[_0xba5a('0xa')](_0xba5a('0xb'),_0x2a7f3a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 1bd1daa..d8a5f3b 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 _0x7395=['getApplications','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','split','CmList','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','List','Contacts','defaults','ListId','messageId','subject','attach','Interaction','secure','VerifySmtp','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','register','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','body','find','describe','addDisposition','Disposition','create','getDispositions','findOne','MailAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','rows','ids','key','email','active','isNil','cservice','user','password','pass','cpassword','authentication','host','port','service','cuser','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tags','color','tag','transaction','MailApplication','bulkCreate','findAndCountAll'];(function(_0xf42ecf,_0x25b798){var _0x3fa664=function(_0x3dde23){while(--_0x3dde23){_0xf42ecf['push'](_0xf42ecf['shift']());}};_0x3fa664(++_0x25b798);}(_0x7395,0x19e));var _0x5739=function(_0x1d282a,_0x2746ef){_0x1d282a=_0x1d282a-0x0;var _0x458250=_0x7395[_0x1d282a];return _0x458250;};'use strict';var pdf=require(_0x5739('0x0'));var emlformat=require(_0x5739('0x1'));var rimraf=require(_0x5739('0x2'));var zipdir=require(_0x5739('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5739('0x4'));var moment=require(_0x5739('0x5'));var BPromise=require(_0x5739('0x6'));var Mustache=require(_0x5739('0x7'));var util=require(_0x5739('0x8'));var path=require('path');var sox=require(_0x5739('0x9'));var csv=require(_0x5739('0xa'));var ejs=require(_0x5739('0xb'));var fs=require('fs');var _=require(_0x5739('0xc'));var squel=require(_0x5739('0xd'));var crypto=require(_0x5739('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5739('0xf'));var toCsv=require(_0x5739('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5739('0x10'));var authService=require(_0x5739('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5739('0x12'));var logger=require(_0x5739('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5739('0x14'));var db=require(_0x5739('0x15'))['db'];config[_0x5739('0x16')]=_['defaults'](config[_0x5739('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5739('0x16')]));require('./mailAccount.socket')[_0x5739('0x17')](socket);var jayson=require(_0x5739('0x18'));var client=jayson[_0x5739('0x19')][_0x5739('0x1a')]({'port':0x232b});function checkPasswordPattern(_0x56b191,_0x41e58e,_0x3b5c1e){if(_0x3b5c1e){var _0x1da97c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1da97c[_0x5739('0x1b')](_0x41e58e)){return _0x56b191;}else{throw new db[(_0x5739('0x1c'))][(_0x5739('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x56b191;}}function respondWithRpcPromise(_0x2a0e6a,_0x3f8f57,_0x1c7b78,_0x40708f){return new BPromise(function(_0x14f556,_0x12c2be){var _0x33144e=_0x40708f||client;return _0x33144e['request'](_0x2a0e6a,_0x1c7b78)[_0x5739('0x1e')](function(_0x2fd14a){logger[_0x5739('0x1f')](_0x5739('0x20'),_0x3f8f57,_0x5739('0x21'));logger[_0x5739('0x22')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3f8f57,_0x5739('0x21'),JSON[_0x5739('0x23')](_0x2fd14a));if(_0x2fd14a[_0x5739('0x24')]){if(_0x2fd14a[_0x5739('0x24')][_0x5739('0x25')]===0x1f4){logger[_0x5739('0x24')](_0x5739('0x20'),_0x3f8f57,_0x2fd14a[_0x5739('0x24')]['message']);return _0x12c2be(_0x2fd14a[_0x5739('0x24')][_0x5739('0x26')]);}logger[_0x5739('0x24')](_0x5739('0x20'),_0x3f8f57,_0x2fd14a[_0x5739('0x24')][_0x5739('0x26')]);return _0x14f556(_0x2fd14a[_0x5739('0x24')][_0x5739('0x26')]);}else{logger[_0x5739('0x1f')](_0x5739('0x20'),_0x3f8f57,_0x5739('0x21'));_0x14f556(_0x2fd14a[_0x5739('0x27')][_0x5739('0x26')]);}})[_0x5739('0x28')](function(_0x689baf){logger[_0x5739('0x24')](_0x5739('0x20'),_0x3f8f57,_0x689baf);_0x12c2be(_0x689baf);});});}function respondWithStatusCode(_0x40315c,_0x57065c){_0x57065c=_0x57065c||0xcc;return function(_0x4b472e){if(_0x4b472e){return _0x40315c[_0x5739('0x29')](_0x57065c);}return _0x40315c['status'](_0x57065c)[_0x5739('0x2a')]();};}function respondWithResult(_0x3ee25a,_0x30e46e){_0x30e46e=_0x30e46e||0xc8;return function(_0x24fb1f){if(_0x24fb1f){return _0x3ee25a[_0x5739('0x2b')](_0x30e46e)[_0x5739('0x2c')](_0x24fb1f);}};}function respondWithFilteredResult(_0x1bb1da,_0x18c086){return function(_0x56fa24){if(_0x56fa24){var _0x13a9ab=_0x56fa24[_0x5739('0x2d')],_0x39b3d5=_0x18c086[_0x5739('0x2e')],_0x28b31f=_0x18c086[_0x5739('0x2e')]+_0x18c086[_0x5739('0x2f')],_0x3b5439;if(_0x28b31f>=_0x13a9ab){_0x28b31f=_0x13a9ab;_0x3b5439=0xc8;}else{_0x3b5439=0xce;}_0x1bb1da['status'](_0x3b5439);return _0x1bb1da['set'](_0x5739('0x30'),_0x39b3d5+'-'+_0x28b31f+'/'+_0x13a9ab)['json'](_0x56fa24);}return null;};}function patchUpdates(_0xd0ca6e){return function(_0xaae929){try{jsonpatch['apply'](_0xaae929,_0xd0ca6e,!![]);}catch(_0x51597c){return BPromise[_0x5739('0x31')](_0x51597c);}return _0xaae929[_0x5739('0x32')]();};}function saveUpdates(_0x20129f,_0x5a7056){return function(_0x1aa3b5){if(_0x1aa3b5){return _0x1aa3b5[_0x5739('0x33')](_0x20129f)['then'](function(_0x1a8fb6){return _0x1a8fb6;});}return null;};}function removeEntity(_0x4dc821,_0x2a2410){return function(_0x1a4d1d){if(_0x1a4d1d){return _0x1a4d1d[_0x5739('0x34')]()[_0x5739('0x1e')](function(){var _0x55ec0a=_0x1a4d1d[_0x5739('0x35')]({'plain':!![]});var _0x4ce433=_0x5739('0x36');return db[_0x5739('0x37')]['destroy']({'where':{'type':_0x4ce433,'resourceId':_0x55ec0a['id']}})[_0x5739('0x1e')](function(){return _0x1a4d1d;});})['then'](function(){_0x4dc821['status'](0xcc)[_0x5739('0x2a')]();});}};}function handleEntityNotFound(_0x299176,_0x3d192d){return function(_0x318665){if(!_0x318665){_0x299176['sendStatus'](0x194);}return _0x318665;};}function handleError(_0x6addf2,_0x569252){_0x569252=_0x569252||0x1f4;return function(_0x29316d){logger[_0x5739('0x24')](_0x29316d[_0x5739('0x38')]);if(_0x29316d[_0x5739('0x39')]){delete _0x29316d['name'];}_0x6addf2[_0x5739('0x2b')](_0x569252)[_0x5739('0x3a')](_0x29316d);};}exports[_0x5739('0x3b')]=function(_0x47d584,_0x41fd68){var _0x3b870a={'include':[{'model':db[_0x5739('0x3c')],'as':_0x5739('0x3d')},{'model':db[_0x5739('0x3e')],'as':_0x5739('0x3f')},{'model':db[_0x5739('0x40')],'as':_0x5739('0x41')}]},_0x13c6ae={},_0x29f347={'count':0x0,'rows':[]};var _0x526989=_['map'](db[_0x5739('0x42')][_0x5739('0x43')],function(_0x56c178){return{'name':_0x56c178[_0x5739('0x44')],'type':_0x56c178[_0x5739('0x45')]['key']};});_0x13c6ae[_0x5739('0x46')]=_[_0x5739('0x47')](_0x526989,_0x5739('0x39'));_0x13c6ae[_0x5739('0x48')]=_[_0x5739('0x49')](_0x47d584[_0x5739('0x48')]);_0x13c6ae[_0x5739('0x4a')]=_[_0x5739('0x4b')](_0x13c6ae['model'],_0x13c6ae['query']);_0x3b870a[_0x5739('0x4c')]=_['intersection'](_0x13c6ae[_0x5739('0x46')],qs[_0x5739('0x4d')](_0x47d584[_0x5739('0x48')][_0x5739('0x4d')]));_0x3b870a['attributes']=_0x3b870a[_0x5739('0x4c')][_0x5739('0x4e')]?_0x3b870a[_0x5739('0x4c')]:_0x13c6ae[_0x5739('0x46')];if(!_0x47d584[_0x5739('0x48')][_0x5739('0x4f')](_0x5739('0x50'))){_0x3b870a['limit']=qs[_0x5739('0x2f')](_0x47d584[_0x5739('0x48')][_0x5739('0x2f')]);_0x3b870a[_0x5739('0x2e')]=qs[_0x5739('0x2e')](_0x47d584[_0x5739('0x48')][_0x5739('0x2e')]);}_0x3b870a[_0x5739('0x51')]=qs['sort'](_0x47d584[_0x5739('0x48')][_0x5739('0x52')]);_0x3b870a[_0x5739('0x53')]=qs[_0x5739('0x4a')](_[_0x5739('0x54')](_0x47d584['query'],_0x13c6ae['filters']),_0x526989);if(_0x47d584[_0x5739('0x48')][_0x5739('0x55')]){_0x3b870a[_0x5739('0x53')]=_[_0x5739('0x56')](_0x3b870a['where'],{'$or':_[_0x5739('0x47')](_0x526989,function(_0x2a60c9){if(_0x2a60c9['type']!==_0x5739('0x57')){var _0x2da806={};_0x2da806[_0x2a60c9[_0x5739('0x39')]]={'$like':'%'+_0x47d584[_0x5739('0x48')]['filter']+'%'};return _0x2da806;}})});}_0x3b870a=_['merge']({},_0x3b870a,_0x47d584[_0x5739('0x58')]);var _0x1d0898={'where':_0x3b870a[_0x5739('0x53')]};return db[_0x5739('0x42')][_0x5739('0x2d')](_0x1d0898)[_0x5739('0x1e')](function(_0x1d68ed){_0x29f347[_0x5739('0x2d')]=_0x1d68ed;if(_0x47d584[_0x5739('0x48')][_0x5739('0x59')]){_0x3b870a[_0x5739('0x5a')]=[{'all':!![]}];}return db[_0x5739('0x42')][_0x5739('0x5b')](_0x3b870a);})[_0x5739('0x1e')](function(_0x490ba6){_0x29f347['rows']=_0x490ba6;return _0x29f347;})[_0x5739('0x1e')](respondWithFilteredResult(_0x41fd68,_0x3b870a))[_0x5739('0x28')](handleError(_0x41fd68,null));};exports[_0x5739('0x5c')]=function(_0x3f62fc,_0x185083){var _0x4ee34b={'raw':![],'where':{'id':_0x3f62fc[_0x5739('0x5d')]['id']},'include':[{'model':db[_0x5739('0x3c')],'as':_0x5739('0x3d')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x5739('0x40')],'as':_0x5739('0x41')}]},_0x5c8d41={};_0x5c8d41[_0x5739('0x46')]=_[_0x5739('0x49')](db[_0x5739('0x42')][_0x5739('0x43')]);_0x5c8d41[_0x5739('0x48')]=_[_0x5739('0x49')](_0x3f62fc[_0x5739('0x48')]);_0x5c8d41['filters']=_[_0x5739('0x4b')](_0x5c8d41['model'],_0x5c8d41[_0x5739('0x48')]);_0x4ee34b[_0x5739('0x4c')]=_[_0x5739('0x4b')](_0x5c8d41[_0x5739('0x46')],qs[_0x5739('0x4d')](_0x3f62fc[_0x5739('0x48')]['fields']));_0x4ee34b['attributes']=_0x4ee34b[_0x5739('0x4c')][_0x5739('0x4e')]?_0x4ee34b['attributes']:_0x5c8d41['model'];if(_0x3f62fc['query']['includeAll']){_0x4ee34b[_0x5739('0x5a')]=[{'all':!![]}];}_0x4ee34b=_[_0x5739('0x56')]({},_0x4ee34b,_0x3f62fc['options']);return db[_0x5739('0x42')]['find'](_0x4ee34b)[_0x5739('0x1e')](handleEntityNotFound(_0x185083,null))['then'](respondWithResult(_0x185083,null))[_0x5739('0x28')](handleError(_0x185083,null));};exports['update']=function(_0x1c6258,_0x5b1467){if(_0x1c6258[_0x5739('0x5e')]['id']){delete _0x1c6258[_0x5739('0x5e')]['id'];}return db[_0x5739('0x42')][_0x5739('0x5f')]({'where':{'id':_0x1c6258[_0x5739('0x5d')]['id']},'include':[{'model':db[_0x5739('0x3c')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x5739('0x3f')},{'model':db[_0x5739('0x40')],'as':_0x5739('0x41')}]})['then'](handleEntityNotFound(_0x5b1467,null))[_0x5739('0x1e')](saveUpdates(_0x1c6258[_0x5739('0x5e')],null))[_0x5739('0x1e')](function(_0x23d1f2){if(_0x23d1f2&&_0x1c6258[_0x5739('0x5e')][_0x5739('0x3d')]){return db[_0x5739('0x3c')]['update'](_0x1c6258[_0x5739('0x5e')]['Imap'],{'where':{'MailAccountId':_0x23d1f2['id']}})['then'](function(){return _0x23d1f2;});}return _0x23d1f2;})[_0x5739('0x1e')](function(_0x796779){if(_0x796779&&_0x1c6258[_0x5739('0x5e')][_0x5739('0x3f')]){return db[_0x5739('0x3e')][_0x5739('0x33')](_0x1c6258[_0x5739('0x5e')][_0x5739('0x3f')],{'where':{'MailAccountId':_0x796779['id']}})[_0x5739('0x1e')](function(){return _0x796779;});}return _0x796779;})[_0x5739('0x1e')](respondWithResult(_0x5b1467,null))[_0x5739('0x28')](handleError(_0x5b1467,null));};exports[_0x5739('0x60')]=function(_0x54d230,_0x4a92c1){return db[_0x5739('0x42')][_0x5739('0x60')]()[_0x5739('0x1e')](respondWithResult(_0x4a92c1,null))[_0x5739('0x28')](handleError(_0x4a92c1,null));};exports[_0x5739('0x61')]=function(_0x5294ba,_0x95227f,_0x592bd8){if(_0x5294ba[_0x5739('0x5e')]['id']){delete _0x5294ba[_0x5739('0x5e')]['id'];}return db['MailAccount'][_0x5739('0x5f')]({'where':{'id':_0x5294ba['params']['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x95227f,null))[_0x5739('0x1e')](function(_0x220bd7){if(_0x220bd7){_0x5294ba[_0x5739('0x5e')]['MailAccountId']=_0x220bd7['id'];return db[_0x5739('0x62')][_0x5739('0x63')](_0x5294ba[_0x5739('0x5e')]);}})[_0x5739('0x1e')](respondWithResult(_0x95227f,null))[_0x5739('0x28')](handleError(_0x95227f,null));};exports[_0x5739('0x64')]=function(_0x5b403e,_0x7fb332,_0x2a2cbd){var _0x492065={'raw':![],'where':{}};var _0x293b30={};var _0x2d62dc={'count':0x0,'rows':[]};return db[_0x5739('0x42')][_0x5739('0x65')]({'where':{'id':_0x5b403e[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x7fb332,null))[_0x5739('0x1e')](function(_0x3ffbcd){if(_0x3ffbcd){_0x293b30[_0x5739('0x46')]=_[_0x5739('0x49')](db[_0x5739('0x62')]['rawAttributes']);_0x293b30['query']=_[_0x5739('0x49')](_0x5b403e[_0x5739('0x48')]);_0x293b30['filters']=_[_0x5739('0x4b')](_0x293b30[_0x5739('0x46')],_0x293b30[_0x5739('0x48')]);_0x492065[_0x5739('0x4c')]=_[_0x5739('0x4b')](_0x293b30[_0x5739('0x46')],qs[_0x5739('0x4d')](_0x5b403e['query'][_0x5739('0x4d')]));_0x492065[_0x5739('0x4c')]=_0x492065['attributes'][_0x5739('0x4e')]?_0x492065['attributes']:_0x293b30['model'];if(!_0x5b403e[_0x5739('0x48')][_0x5739('0x4f')](_0x5739('0x50'))){_0x492065['limit']=qs['limit'](_0x5b403e['query']['limit']);_0x492065[_0x5739('0x2e')]=qs[_0x5739('0x2e')](_0x5b403e[_0x5739('0x48')][_0x5739('0x2e')]);}_0x492065[_0x5739('0x51')]=qs[_0x5739('0x52')](_0x5b403e[_0x5739('0x48')][_0x5739('0x52')]);_0x492065[_0x5739('0x53')]=qs['filters'](_[_0x5739('0x54')](_0x5b403e['query'],_0x293b30[_0x5739('0x4a')]));_0x492065[_0x5739('0x53')][_0x5739('0x66')]=_0x3ffbcd['id'];if(_0x5b403e[_0x5739('0x48')][_0x5739('0x55')]){_0x492065[_0x5739('0x53')]=_[_0x5739('0x56')](_0x492065[_0x5739('0x53')],{'$or':_[_0x5739('0x47')](_0x492065[_0x5739('0x4c')],function(_0x39ad8a){var _0x3bc1fd={};_0x3bc1fd[_0x39ad8a]={'$like':'%'+_0x5b403e[_0x5739('0x48')][_0x5739('0x55')]+'%'};return _0x3bc1fd;})});}_0x492065=_['merge']({},_0x492065,_0x5b403e[_0x5739('0x58')]);return db[_0x5739('0x62')][_0x5739('0x2d')]({'where':_0x492065[_0x5739('0x53')]})[_0x5739('0x1e')](function(_0x101744){_0x2d62dc[_0x5739('0x2d')]=_0x101744;if(_0x5b403e[_0x5739('0x48')]['includeAll']){_0x492065[_0x5739('0x5a')]=[{'all':!![]}];}return db[_0x5739('0x62')]['findAll'](_0x492065);})[_0x5739('0x1e')](function(_0x37ae2f){_0x2d62dc['rows']=_0x37ae2f;return _0x2d62dc;});}})[_0x5739('0x1e')](respondWithFilteredResult(_0x7fb332,_0x492065))[_0x5739('0x28')](handleError(_0x7fb332,null));};exports[_0x5739('0x67')]=function(_0x1701c6,_0xb36d9c,_0x2d5a72){return db[_0x5739('0x42')][_0x5739('0x5f')]({'where':{'id':_0x1701c6[_0x5739('0x5d')]['id']}})['then'](handleEntityNotFound(_0xb36d9c,null))[_0x5739('0x1e')](function(_0x529291){if(_0x529291){return _0x529291[_0x5739('0x67')](_0x1701c6['query']['ids']);}})[_0x5739('0x1e')](respondWithStatusCode(_0xb36d9c,null))[_0x5739('0x28')](handleError(_0xb36d9c,null));};exports[_0x5739('0x68')]=function(_0x47755c,_0x9b43db,_0x44b9a1){if(_0x47755c[_0x5739('0x5e')]['id']){delete _0x47755c[_0x5739('0x5e')]['id'];}return db['MailAccount'][_0x5739('0x5f')]({'where':{'id':_0x47755c[_0x5739('0x5d')]['id']}})['then'](handleEntityNotFound(_0x9b43db,null))[_0x5739('0x1e')](function(_0x1c1238){if(_0x1c1238){_0x47755c[_0x5739('0x5e')]['MailAccountId']=_0x1c1238['id'];return db[_0x5739('0x69')][_0x5739('0x63')](_0x47755c['body']);}})[_0x5739('0x1e')](respondWithResult(_0x9b43db,null))[_0x5739('0x28')](handleError(_0x9b43db,null));};exports[_0x5739('0x6a')]=function(_0x3a7cfb,_0x3f3c84,_0x593e0e){var _0x14a69e={'raw':![],'where':{}};var _0x32fb6a={};var _0x16437f={'count':0x0,'rows':[]};return db[_0x5739('0x42')]['findOne']({'where':{'id':_0x3a7cfb[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x3f3c84,null))[_0x5739('0x1e')](function(_0x3d2e82){if(_0x3d2e82){_0x32fb6a[_0x5739('0x46')]=_[_0x5739('0x49')](db['CannedAnswer']['rawAttributes']);_0x32fb6a[_0x5739('0x48')]=_[_0x5739('0x49')](_0x3a7cfb[_0x5739('0x48')]);_0x32fb6a[_0x5739('0x4a')]=_[_0x5739('0x4b')](_0x32fb6a['model'],_0x32fb6a[_0x5739('0x48')]);_0x14a69e[_0x5739('0x4c')]=_[_0x5739('0x4b')](_0x32fb6a[_0x5739('0x46')],qs['fields'](_0x3a7cfb['query'][_0x5739('0x4d')]));_0x14a69e[_0x5739('0x4c')]=_0x14a69e['attributes'][_0x5739('0x4e')]?_0x14a69e[_0x5739('0x4c')]:_0x32fb6a[_0x5739('0x46')];if(!_0x3a7cfb[_0x5739('0x48')][_0x5739('0x4f')](_0x5739('0x50'))){_0x14a69e['limit']=qs['limit'](_0x3a7cfb['query'][_0x5739('0x2f')]);_0x14a69e[_0x5739('0x2e')]=qs[_0x5739('0x2e')](_0x3a7cfb[_0x5739('0x48')][_0x5739('0x2e')]);}_0x14a69e[_0x5739('0x51')]=qs['sort'](_0x3a7cfb[_0x5739('0x48')][_0x5739('0x52')]);_0x14a69e[_0x5739('0x53')]=qs['filters'](_[_0x5739('0x54')](_0x3a7cfb[_0x5739('0x48')],_0x32fb6a[_0x5739('0x4a')]));_0x14a69e['where'][_0x5739('0x66')]=_0x3d2e82['id'];if(_0x3a7cfb[_0x5739('0x48')]['filter']){_0x14a69e[_0x5739('0x53')]=_[_0x5739('0x56')](_0x14a69e[_0x5739('0x53')],{'$or':_['map'](_0x14a69e[_0x5739('0x4c')],function(_0x5c0a0f){var _0xe03fa7={};_0xe03fa7[_0x5c0a0f]={'$like':'%'+_0x3a7cfb['query']['filter']+'%'};return _0xe03fa7;})});}_0x14a69e=_['merge']({},_0x14a69e,_0x3a7cfb[_0x5739('0x58')]);return db[_0x5739('0x69')][_0x5739('0x2d')]({'where':_0x14a69e[_0x5739('0x53')]})[_0x5739('0x1e')](function(_0x384339){_0x16437f[_0x5739('0x2d')]=_0x384339;if(_0x3a7cfb[_0x5739('0x48')][_0x5739('0x59')]){_0x14a69e[_0x5739('0x5a')]=[{'all':!![]}];}return db[_0x5739('0x69')][_0x5739('0x5b')](_0x14a69e);})[_0x5739('0x1e')](function(_0x4854d5){_0x16437f[_0x5739('0x6b')]=_0x4854d5;return _0x16437f;});}})[_0x5739('0x1e')](respondWithFilteredResult(_0x3f3c84,_0x14a69e))[_0x5739('0x28')](handleError(_0x3f3c84,null));};exports['removeAnswers']=function(_0x3d6634,_0x1fc82b,_0x15c2c4){return db[_0x5739('0x42')][_0x5739('0x5f')]({'where':{'id':_0x3d6634[_0x5739('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1fc82b,null))[_0x5739('0x1e')](function(_0xaa8713){if(_0xaa8713){return _0xaa8713['removeAnswers'](_0x3d6634[_0x5739('0x48')][_0x5739('0x6c')]);}})[_0x5739('0x1e')](respondWithStatusCode(_0x1fc82b,null))[_0x5739('0x28')](handleError(_0x1fc82b,null));};exports[_0x5739('0x63')]=function(_0x17a379,_0x4aa693){var _0x29d857={'name':_0x17a379['body'][_0x5739('0x39')],'key':_0x17a379['body'][_0x5739('0x6d')],'email':_0x17a379['body'][_0x5739('0x6e')],'ListId':_0x17a379[_0x5739('0x5e')]['ListId'],'active':!_['isNil'](_0x17a379[_0x5739('0x5e')][_0x5739('0x6f')])?_0x17a379[_0x5739('0x5e')][_0x5739('0x6f')]:!![],'description':_0x17a379[_0x5739('0x5e')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x5739('0x70')](_0x17a379[_0x5739('0x5e')][_0x5739('0x71')])){if(_0x17a379[_0x5739('0x5e')]['cauthentication']){_0x29d857[_0x5739('0x3d')][_0x5739('0x72')]=_0x29d857[_0x5739('0x3f')]['user']=_0x17a379[_0x5739('0x5e')]['cuser'];_0x29d857[_0x5739('0x3d')][_0x5739('0x73')]=_0x29d857[_0x5739('0x3f')][_0x5739('0x74')]=_0x17a379['body'][_0x5739('0x75')];}else{_0x29d857[_0x5739('0x3d')][_0x5739('0x76')]=_0x29d857[_0x5739('0x3f')][_0x5739('0x76')]=![];}_0x29d857[_0x5739('0x3d')][_0x5739('0x77')]=_0x17a379[_0x5739('0x5e')][_0x5739('0x3d')]['host'];_0x29d857[_0x5739('0x3d')]['port']=_0x17a379[_0x5739('0x5e')][_0x5739('0x3d')][_0x5739('0x78')];_0x29d857[_0x5739('0x3f')][_0x5739('0x77')]=_0x17a379[_0x5739('0x5e')][_0x5739('0x3f')][_0x5739('0x77')];_0x29d857[_0x5739('0x3f')][_0x5739('0x78')]=_0x17a379[_0x5739('0x5e')][_0x5739('0x3f')][_0x5739('0x78')];}else{_0x29d857['Imap'][_0x5739('0x79')]=_0x29d857[_0x5739('0x3f')][_0x5739('0x79')]=_0x17a379[_0x5739('0x5e')][_0x5739('0x71')];_0x29d857[_0x5739('0x3d')][_0x5739('0x72')]=_0x29d857['Smtp'][_0x5739('0x72')]=_0x17a379[_0x5739('0x5e')][_0x5739('0x7a')];_0x29d857[_0x5739('0x3d')]['password']=_0x29d857['Smtp'][_0x5739('0x74')]=_0x17a379['body']['cpassword'];}return db[_0x5739('0x42')][_0x5739('0x63')](_0x29d857,{'include':[{'model':db[_0x5739('0x3e')],'as':'Smtp'},{'model':db[_0x5739('0x3c')],'as':_0x5739('0x3d')}]})[_0x5739('0x1e')](function(_0x509b93){var _0x7d4464=_0x17a379[_0x5739('0x72')]['get']({'plain':!![]});if(!_0x7d4464)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7d4464['role']===_0x5739('0x72')){var _0x1c1ac4=_0x509b93[_0x5739('0x35')]({'plain':!![]});return db[_0x5739('0x7b')][_0x5739('0x5f')]({'where':{'name':'MailAccounts','userProfileId':_0x7d4464[_0x5739('0x7c')]},'raw':!![]})['then'](function(_0x5c982c){if(_0x5c982c&&_0x5c982c['autoAssociation']===0x0){return db[_0x5739('0x37')][_0x5739('0x63')]({'name':_0x1c1ac4[_0x5739('0x39')],'resourceId':_0x1c1ac4['id'],'type':_0x5c982c[_0x5739('0x39')],'sectionId':_0x5c982c['id']},{})[_0x5739('0x1e')](function(){return _0x509b93;});}else{return _0x509b93;}})[_0x5739('0x28')](function(_0x51eaae){logger[_0x5739('0x24')](_0x5739('0x7d'),_0x51eaae);throw _0x51eaae;});}return _0x509b93;})[_0x5739('0x1e')](respondWithResult(_0x4aa693,0xc9))['catch'](handleError(_0x4aa693,null));};exports[_0x5739('0x7e')]=function(_0x50fbec,_0x5bb21f,_0x3d6a7b){return db[_0x5739('0x42')][_0x5739('0x65')]({'where':{'id':_0x50fbec[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x5bb21f,null))[_0x5739('0x1e')](function(_0x3df2a6){if(_0x3df2a6){return _0x3df2a6[_0x5739('0x7e')]();}return null;})[_0x5739('0x1e')](respondWithResult(_0x5bb21f,null))[_0x5739('0x28')](handleError(_0x5bb21f,null));};exports[_0x5739('0x7f')]=function(_0x48103f,_0x386967,_0x23fd14){if(_0x48103f[_0x5739('0x5e')]['id']){delete _0x48103f[_0x5739('0x5e')]['id'];}return db[_0x5739('0x42')][_0x5739('0x5f')]({'where':{'id':_0x48103f[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x386967,null))[_0x5739('0x1e')](function(_0x2cdc71){if(_0x2cdc71){_0x48103f[_0x5739('0x5e')][_0x5739('0x66')]=_0x2cdc71['id'];return db['MailServerIn'][_0x5739('0x63')](_0x48103f[_0x5739('0x5e')]);}})[_0x5739('0x1e')](respondWithResult(_0x386967,null))[_0x5739('0x28')](handleError(_0x386967,null));};exports[_0x5739('0x80')]=function(_0x48de84,_0x193f67,_0x30a346){return db['MailAccount'][_0x5739('0x65')]({'where':{'id':_0x48de84['params']['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x193f67,null))[_0x5739('0x1e')](function(_0x327fb2){if(_0x327fb2){return _0x327fb2[_0x5739('0x81')](null);}return null;})[_0x5739('0x1e')](respondWithStatusCode(_0x193f67,null))[_0x5739('0x28')](handleError(_0x193f67,null));};exports[_0x5739('0x82')]=function(_0x2c19c5,_0x4b19bd,_0x1b9503){return db['MailAccount'][_0x5739('0x65')]({'where':{'id':_0x2c19c5['params']['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x4b19bd,null))[_0x5739('0x1e')](function(_0x50fa9f){if(_0x50fa9f){return _0x50fa9f['getSmtp']();}return null;})[_0x5739('0x1e')](respondWithResult(_0x4b19bd,null))[_0x5739('0x28')](handleError(_0x4b19bd,null));};exports[_0x5739('0x83')]=function(_0x13db88,_0x321b82,_0x19c7a6){if(_0x13db88[_0x5739('0x5e')]['id']){delete _0x13db88[_0x5739('0x5e')]['id'];}return db['MailAccount'][_0x5739('0x5f')]({'where':{'id':_0x13db88[_0x5739('0x5d')]['id']}})['then'](handleEntityNotFound(_0x321b82,null))[_0x5739('0x1e')](function(_0x2d07ff){if(_0x2d07ff){_0x13db88['body'][_0x5739('0x66')]=_0x2d07ff['id'];return db['MailServerOut'][_0x5739('0x63')](_0x13db88[_0x5739('0x5e')]);}})['then'](respondWithResult(_0x321b82,null))[_0x5739('0x28')](handleError(_0x321b82,null));};exports[_0x5739('0x84')]=function(_0x1b9705,_0x1445b4,_0x2b896c){return db['MailAccount'][_0x5739('0x65')]({'where':{'id':_0x1b9705[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x1445b4,null))[_0x5739('0x1e')](function(_0x5db1ca){if(_0x5db1ca){return _0x5db1ca[_0x5739('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x1445b4,null))[_0x5739('0x28')](handleError(_0x1445b4,null));};exports['addInteraction']=function(_0x13a315,_0x3ee79d,_0x3adc1f){return db[_0x5739('0x86')][_0x5739('0x5f')]({'where':{'id':_0x13a315['params']['id']}})['then'](handleEntityNotFound(_0x3ee79d,null))['then'](function(_0x8be33d){if(_0x8be33d){return _0x8be33d[_0x5739('0x87')](_0x13a315[_0x5739('0x5e')][_0x5739('0x6c')],_[_0x5739('0x88')](_0x13a315[_0x5739('0x5e')],['ids','id'])||{});}})['then'](respondWithResult(_0x3ee79d,null))[_0x5739('0x28')](handleError(_0x3ee79d,null));};exports['getInteractions']=function(_0x54c360,_0x38e36f,_0x2f6796){var _0x2c8e5f={'raw':![],'where':{}};var _0x1e23b1={};var _0xeea63e={'count':0x0,'rows':[]};return db[_0x5739('0x42')][_0x5739('0x65')]({'where':{'id':_0x54c360[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x38e36f,null))[_0x5739('0x1e')](function(_0x22d3e3){if(_0x22d3e3){_0x1e23b1[_0x5739('0x46')]=_['keys'](db[_0x5739('0x86')]['rawAttributes']);_0x1e23b1[_0x5739('0x48')]=_[_0x5739('0x49')](_0x54c360[_0x5739('0x48')]);_0x1e23b1[_0x5739('0x4a')]=_[_0x5739('0x4b')](_0x1e23b1['model'],_0x1e23b1[_0x5739('0x48')]);_0x2c8e5f['attributes']=_[_0x5739('0x4b')](_0x1e23b1[_0x5739('0x46')],qs[_0x5739('0x4d')](_0x54c360[_0x5739('0x48')][_0x5739('0x4d')]));_0x2c8e5f[_0x5739('0x4c')]=_0x2c8e5f['attributes']['length']?_0x2c8e5f[_0x5739('0x4c')]:_0x1e23b1[_0x5739('0x46')];if(!_0x54c360['query'][_0x5739('0x4f')](_0x5739('0x50'))){_0x2c8e5f[_0x5739('0x2f')]=qs[_0x5739('0x2f')](_0x54c360[_0x5739('0x48')][_0x5739('0x2f')]);_0x2c8e5f[_0x5739('0x2e')]=qs[_0x5739('0x2e')](_0x54c360[_0x5739('0x48')][_0x5739('0x2e')]);}_0x2c8e5f['order']=qs['sort'](_0x54c360[_0x5739('0x48')][_0x5739('0x52')]);_0x2c8e5f['where']=qs[_0x5739('0x4a')](_[_0x5739('0x54')](_0x54c360[_0x5739('0x48')],_0x1e23b1[_0x5739('0x4a')]));_0x2c8e5f[_0x5739('0x53')][_0x5739('0x66')]=_0x22d3e3['id'];if(_0x54c360['query'][_0x5739('0x55')]){_0x2c8e5f['where']=_[_0x5739('0x56')](_0x2c8e5f[_0x5739('0x53')],{'$or':_[_0x5739('0x47')](_0x2c8e5f[_0x5739('0x4c')],function(_0x4d5b1c){var _0x26529f={};_0x26529f[_0x4d5b1c]={'$like':'%'+_0x54c360['query'][_0x5739('0x55')]+'%'};return _0x26529f;})});}_0x2c8e5f=_[_0x5739('0x56')]({},_0x2c8e5f,_0x54c360['options']);return db[_0x5739('0x86')][_0x5739('0x2d')]({'where':_0x2c8e5f[_0x5739('0x53')]})[_0x5739('0x1e')](function(_0x4ef5ca){_0xeea63e[_0x5739('0x2d')]=_0x4ef5ca;if(_0x54c360['query'][_0x5739('0x59')]){_0x2c8e5f['include']=[{'model':db[_0x5739('0x89')],'as':_0x5739('0x8a'),'required':![]},{'model':db[_0x5739('0x8b')],'as':_0x5739('0x8c'),'attributes':['name',_0x5739('0x8d'),_0x5739('0x8e')],'required':![]},{'model':db['Tag'],'as':_0x5739('0x8f'),'attributes':['id',_0x5739('0x39'),_0x5739('0x90')],'where':_0x54c360[_0x5739('0x48')][_0x5739('0x91')]?{'id':_0x54c360[_0x5739('0x48')][_0x5739('0x91')]}:undefined,'required':_0x54c360['query']['tag']?!![]:![]}];}return db[_0x5739('0x86')]['findAll'](_0x2c8e5f);})[_0x5739('0x1e')](function(_0x475658){_0xeea63e['rows']=_0x475658;return _0xeea63e;});}})['then'](respondWithFilteredResult(_0x38e36f,_0x2c8e5f))[_0x5739('0x28')](handleError(_0x38e36f,null));};exports['addApplications']=function(_0x2549a3,_0x156cae,_0x28f231){return db['MailAccount'][_0x5739('0x65')]({'where':{'id':_0x2549a3[_0x5739('0x5d')]['id']}})['then'](handleEntityNotFound(_0x156cae,null))[_0x5739('0x1e')](function(_0x510a39){if(_0x510a39){return db['sequelize'][_0x5739('0x92')](function(_0x5093f2){return db['MailApplication'][_0x5739('0x34')]({'where':{'MailAccountId':_0x2549a3[_0x5739('0x5d')]['id']},'transaction':_0x5093f2})[_0x5739('0x1e')](function(_0x4c589d){var _0x58626e=_['map'](_0x2549a3[_0x5739('0x5e')],function(_0x20a5d1){_0x20a5d1[_0x5739('0x66')]=_0x2549a3[_0x5739('0x5d')]['id'];return _0x20a5d1;});return db[_0x5739('0x93')][_0x5739('0x94')](_0x58626e,{'transaction':_0x5093f2});});})['then'](function(){return db[_0x5739('0x93')][_0x5739('0x95')]({'where':{'MailAccountId':_0x2549a3[_0x5739('0x5d')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x156cae,null))[_0x5739('0x28')](handleError(_0x156cae,null));};exports[_0x5739('0x96')]=function(_0xcfecb2,_0x4f712b,_0x2896a0){var _0x4f4585={};var _0x170b88={};var _0x10d249;var _0x27faf0;return db['MailAccount'][_0x5739('0x65')]({'where':{'id':_0xcfecb2[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x4f712b,null))[_0x5739('0x1e')](function(_0x55b89e){if(_0x55b89e){_0x10d249=_0x55b89e;_0x170b88['model']=_[_0x5739('0x49')](db[_0x5739('0x93')][_0x5739('0x43')]);_0x170b88[_0x5739('0x48')]=_['keys'](_0xcfecb2['query']);_0x170b88[_0x5739('0x4a')]=_['intersection'](_0x170b88['model'],_0x170b88[_0x5739('0x48')]);_0x4f4585[_0x5739('0x4c')]=_['intersection'](_0x170b88[_0x5739('0x46')],qs[_0x5739('0x4d')](_0xcfecb2[_0x5739('0x48')][_0x5739('0x4d')]));_0x4f4585[_0x5739('0x4c')]=_0x4f4585[_0x5739('0x4c')][_0x5739('0x4e')]?_0x4f4585[_0x5739('0x4c')]:_0x170b88[_0x5739('0x46')];_0x4f4585[_0x5739('0x51')]=qs[_0x5739('0x52')](_0xcfecb2[_0x5739('0x48')][_0x5739('0x52')]);_0x4f4585[_0x5739('0x53')]=qs[_0x5739('0x4a')](_[_0x5739('0x54')](_0xcfecb2[_0x5739('0x48')],_0x170b88[_0x5739('0x4a')]));if(_0xcfecb2[_0x5739('0x48')]['filter']){_0x4f4585[_0x5739('0x53')]=_[_0x5739('0x56')](_0x4f4585['where'],{'$or':_[_0x5739('0x47')](_0x4f4585['attributes'],function(_0x2f72ea){var _0x274687={};_0x274687[_0x2f72ea]={'$like':'%'+_0xcfecb2[_0x5739('0x48')][_0x5739('0x55')]+'%'};return _0x274687;})});}_0x4f4585=_[_0x5739('0x56')]({},_0x4f4585,_0xcfecb2[_0x5739('0x58')]);return _0x10d249[_0x5739('0x96')](_0x4f4585);}})[_0x5739('0x1e')](function(_0x36f72f){if(_0x36f72f){_0x27faf0=_0x36f72f['length'];if(!_0xcfecb2[_0x5739('0x48')][_0x5739('0x4f')]('nolimit')){_0x4f4585['limit']=qs[_0x5739('0x2f')](_0xcfecb2[_0x5739('0x48')][_0x5739('0x2f')]);_0x4f4585[_0x5739('0x2e')]=qs[_0x5739('0x2e')](_0xcfecb2['query']['offset']);}return _0x10d249[_0x5739('0x96')](_0x4f4585);}})[_0x5739('0x1e')](function(_0x394233){if(_0x394233){return _0x394233?{'count':_0x27faf0,'rows':_0x394233}:null;}})['then'](respondWithResult(_0x4f712b,null))[_0x5739('0x28')](handleError(_0x4f712b,null));};exports['getMessages']=function(_0x465005,_0x463f01,_0x104b84){var _0x411373={'raw':!![],'where':{}};var _0x2a4a8b={};var _0x3e714b={'count':0x0,'rows':[]};return db[_0x5739('0x42')][_0x5739('0x65')]({'where':{'id':_0x465005[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x463f01,null))['then'](function(_0x1f57c0){if(_0x1f57c0){_0x2a4a8b[_0x5739('0x46')]=_[_0x5739('0x49')](db['MailMessage']['rawAttributes']);_0x2a4a8b['query']=_[_0x5739('0x49')](_0x465005['query']);_0x2a4a8b[_0x5739('0x4a')]=_[_0x5739('0x4b')](_0x2a4a8b[_0x5739('0x46')],_0x2a4a8b[_0x5739('0x48')]);_0x411373[_0x5739('0x4c')]=_[_0x5739('0x4b')](_0x2a4a8b['model'],qs[_0x5739('0x4d')](_0x465005[_0x5739('0x48')][_0x5739('0x4d')]));_0x411373[_0x5739('0x4c')]=_0x411373[_0x5739('0x4c')][_0x5739('0x4e')]?_0x411373[_0x5739('0x4c')]:_0x2a4a8b[_0x5739('0x46')];if(!_0x465005[_0x5739('0x48')][_0x5739('0x4f')](_0x5739('0x50'))){_0x411373[_0x5739('0x2f')]=qs[_0x5739('0x2f')](_0x465005[_0x5739('0x48')][_0x5739('0x2f')]);_0x411373[_0x5739('0x2e')]=qs['offset'](_0x465005['query']['offset']);}_0x411373[_0x5739('0x51')]=qs[_0x5739('0x52')](_0x465005[_0x5739('0x48')][_0x5739('0x52')]);_0x411373[_0x5739('0x53')]=qs['filters'](_[_0x5739('0x54')](_0x465005[_0x5739('0x48')],_0x2a4a8b['filters']));_0x411373['where'][_0x5739('0x66')]=_0x1f57c0['id'];if(_0x465005[_0x5739('0x48')][_0x5739('0x55')]){_0x411373['where']=_[_0x5739('0x56')](_0x411373['where'],{'$or':_[_0x5739('0x47')](_0x411373[_0x5739('0x4c')],function(_0x299943){var _0x47e123={};_0x47e123[_0x299943]={'$like':'%'+_0x465005[_0x5739('0x48')]['filter']+'%'};return _0x47e123;})});}if(_0x465005[_0x5739('0x48')][_0x5739('0x97')]){var _0x5e1572=_0x465005['query'][_0x5739('0x97')]['split'](',');var _0x3bc069={};_0x3bc069[_0x5e1572[0x0]]={'$gte':moment(_0x5e1572[0x1])[_0x5739('0x98')](_0x5739('0x99'))};_0x411373[_0x5739('0x53')]=_[_0x5739('0x56')](_0x411373[_0x5739('0x53')],_0x3bc069);}_0x411373=_[_0x5739('0x56')]({},_0x411373,_0x465005[_0x5739('0x58')]);return db[_0x5739('0x9a')][_0x5739('0x2d')]({'where':_0x411373['where']})['then'](function(_0xdb9bfa){_0x3e714b[_0x5739('0x2d')]=_0xdb9bfa;if(_0x465005[_0x5739('0x48')][_0x5739('0x59')]){_0x411373[_0x5739('0x5a')]=[{'all':!![]}];}return db[_0x5739('0x9a')][_0x5739('0x5b')](_0x411373);})['then'](function(_0x4acfa0){_0x3e714b['rows']=_0x4acfa0;return _0x3e714b;});}})[_0x5739('0x1e')](respondWithFilteredResult(_0x463f01,_0x411373))[_0x5739('0x28')](handleError(_0x463f01,null));};exports[_0x5739('0x3a')]=function(_0x55ac71,_0x2f8250,_0x5011f4){var _0x40c042,_0xde949d={},_0x242e93;if(_0x55ac71[_0x5739('0x5e')]['to']){_0x242e93=_0x55ac71[_0x5739('0x5e')]['to'][_0x5739('0x9b')](',')[0x0];}return db['MailAccount'][_0x5739('0x5f')]({'where':{'id':_0x55ac71[_0x5739('0x5d')]['id']},'include':[{'model':db[_0x5739('0x9c')],'as':'List','include':[{'model':db[_0x5739('0x89')],'as':'Contacts','where':{'email':_0x242e93},'limit':0x1,'order':[[_0x5739('0x9d'),'DESC']]}]},{'model':db[_0x5739('0x3e')],'as':_0x5739('0x3f'),'raw':!![]}]})[_0x5739('0x1e')](handleEntityNotFound(_0x2f8250,null))[_0x5739('0x1e')](function(_0xbe3d69){if(_0xbe3d69){_0x40c042=_0xbe3d69;if(_0xbe3d69[_0x5739('0x3f')]){if(_[_0x5739('0x70')](_0x55ac71['body'][_0x5739('0x9e')])){_0x55ac71[_0x5739('0x5e')][_0x5739('0x9e')]=util[_0x5739('0x98')](_0x5739('0x9f'),_0xbe3d69[_0x5739('0x39')],_0xbe3d69[_0x5739('0x6e')]||_0xbe3d69[_0x5739('0x3f')]['user']);}if(_0x55ac71[_0x5739('0x5e')][_0x5739('0xa0')]&&_0x55ac71[_0x5739('0x5e')][_0x5739('0xa0')][_0x5739('0x4e')]){for(var _0x3acb52=0x0;_0x3acb52<_0x55ac71[_0x5739('0x5e')]['attachments']['length'];_0x3acb52+=0x1){_0x55ac71[_0x5739('0x5e')][_0x5739('0xa0')][_0x3acb52]={'filename':_0x55ac71[_0x5739('0x5e')][_0x5739('0xa0')][_0x3acb52]['name'],'path':path[_0x5739('0xa1')](config[_0x5739('0xa2')],_0x5739('0xa3'),_0x55ac71[_0x5739('0x5e')][_0x5739('0xa0')][_0x3acb52][_0x5739('0xa4')])};}}var _0x1e67d7={'tls':{'rejectUnauthorized':![]}};if(_[_0x5739('0x70')](_0xbe3d69['Smtp']['service'])){if(_0xbe3d69[_0x5739('0x3f')][_0x5739('0x76')]){_0x1e67d7[_0x5739('0xa5')]={'user':_0xbe3d69[_0x5739('0x3f')]['user'],'pass':_0xbe3d69[_0x5739('0x3f')][_0x5739('0x74')]};}_0x1e67d7[_0x5739('0x77')]=_0xbe3d69[_0x5739('0x3f')][_0x5739('0x77')];_0x1e67d7[_0x5739('0x78')]=_0xbe3d69[_0x5739('0x3f')][_0x5739('0x78')];_0x1e67d7['secure']=_0xbe3d69[_0x5739('0x3f')]['secure'];}else{_0x1e67d7[_0x5739('0x79')]=_0xbe3d69[_0x5739('0x3f')]['service'];_0x1e67d7[_0x5739('0xa5')]={'user':_0xbe3d69['Smtp'][_0x5739('0x72')],'pass':_0xbe3d69[_0x5739('0x3f')][_0x5739('0x74')]};}return respondWithRpcPromise(_0x5739('0xa6'),_0x5739('0xa7'),{'account':_0x1e67d7,'message':_0x55ac71['body']});}else{throw new Error(_0x5739('0xa8'));}}})[_0x5739('0x1e')](function(_0x5bb1f5){if(_0x5bb1f5){_0xde949d=_0x5bb1f5;if(_0x40c042[_0x5739('0xa9')]){if(_0x40c042[_0x5739('0xa9')][_0x5739('0xaa')]['length']){return _0x40c042[_0x5739('0xa9')][_0x5739('0xaa')][0x0];}else{return db[_0x5739('0x89')][_0x5739('0x63')](_[_0x5739('0xab')](_0x55ac71[_0x5739('0x5e')],{'firstName':_0x55ac71[_0x5739('0x5e')]['to'],'email':_0x55ac71[_0x5739('0x5e')]['to'],'phone':_0x55ac71['body']['to'],'ListId':_0x40c042[_0x5739('0xac')]}));}}else{throw new Error(_0x5739('0xa8'));}}})['then'](function(_0x43d396){if(_0x43d396){var _0x2c5ece={'UserId':_0x55ac71[_0x5739('0x72')]['id'],'ContactId':_0x43d396['id'],'MailAccountId':_0x40c042['id'],'inReplyTo':_0xde949d[_0x5739('0xad')],'to':_0x55ac71[_0x5739('0x5e')][_0x5739('0x9e')],'cc':_0x55ac71[_0x5739('0x5e')]['cc'],'subject':_0x55ac71[_0x5739('0x5e')][_0x5739('0xae')],'attach':_0x55ac71[_0x5739('0x5e')][_0x5739('0xaf')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x5739('0x98')](_0x5739('0x99')),'lastMsgDirection':'out','lastMsgBody':_0x55ac71['body'][_0x5739('0x5e')],'Messages':[_[_0x5739('0x56')](_0x55ac71[_0x5739('0x5e')],{'messageId':_0xde949d[_0x5739('0xad')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x40c042['id'],'UserId':_0x55ac71[_0x5739('0x72')]['id'],'ContactId':_0x43d396['id']})]};if(_0x55ac71[_0x5739('0x5e')][_0x5739('0xb0')]){_0x2c5ece=_[_0x5739('0x56')](_0x2c5ece,_0x55ac71[_0x5739('0x5e')][_0x5739('0xb0')]);}return db['MailInteraction'][_0x5739('0x63')](_0x2c5ece,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x5739('0x1e')](respondWithResult(_0x2f8250,null))[_0x5739('0x28')](handleError(_0x2f8250,null));};exports['verifySmtp']=function(_0x3fc841,_0x190ec4,_0x2d4feb){return db[_0x5739('0x42')]['find']({'where':{'id':_0x3fc841[_0x5739('0x5d')]['id']},'include':[{'model':db[_0x5739('0x3e')],'as':'Smtp','raw':!![]}]})[_0x5739('0x1e')](handleEntityNotFound(_0x190ec4,null))[_0x5739('0x1e')](function(_0x3c278c){if(_0x3c278c&&_0x3c278c[_0x5739('0x3f')]){var _0x1ac400={'id':_0x3c278c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3c278c['Smtp']['service']){_0x1ac400[_0x5739('0x79')]=_0x3c278c['Smtp'][_0x5739('0x79')];}else{_0x1ac400[_0x5739('0x77')]=_0x3c278c[_0x5739('0x3f')]['host'];_0x1ac400[_0x5739('0x78')]=_0x3c278c[_0x5739('0x3f')][_0x5739('0x78')];_0x1ac400[_0x5739('0xb1')]=_0x3c278c['Smtp'][_0x5739('0xb1')];}if(_0x3c278c[_0x5739('0x3f')][_0x5739('0x76')]){_0x1ac400[_0x5739('0xa5')]={'user':_0x3c278c[_0x5739('0x3f')][_0x5739('0x72')],'pass':_0x3c278c[_0x5739('0x3f')][_0x5739('0x74')]};}return respondWithRpcPromise(_0x5739('0xb2'),_0x5739('0xb3'),{'account':_0x1ac400});}})['then'](respondWithResult(_0x190ec4,null))[_0x5739('0x28')](handleError(_0x190ec4,null));};exports[_0x5739('0x34')]=function(_0xa44950,_0x1b7d1b){return db[_0x5739('0x42')][_0x5739('0x5f')]({'where':{'id':_0xa44950[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x1b7d1b,null))[_0x5739('0x1e')](function(_0xee3bff){if(_0xee3bff&&_0xee3bff[_0x5739('0x79')]){throw new db[(_0x5739('0x1c'))][(_0x5739('0x1d'))](_0x5739('0xb4'));}return _0xee3bff;})[_0x5739('0x1e')](removeEntity(_0x1b7d1b,null))[_0x5739('0x28')](handleError(_0x1b7d1b,null));};exports[_0x5739('0xb5')]=function(_0x451175,_0x5903f9,_0x122fb6){return db[_0x5739('0x42')]['find']({'where':{'id':_0x451175['params']['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x5903f9,null))[_0x5739('0x1e')](function(_0x3b13e7){if(_0x3b13e7){return _0x3b13e7[_0x5739('0xb5')](_0x451175['body'][_0x5739('0x6c')],_[_0x5739('0x88')](_0x451175['body'],[_0x5739('0x6c'),'id'])||{})[_0x5739('0xb6')](function(_0x20f18d){for(var _0x13b385=0x0;_0x13b385<_0x451175[_0x5739('0x5e')]['ids'][_0x5739('0x4e')];_0x13b385+=0x1){socket['emit'](_0x5739('0xb7'),{'UserId':_0x451175[_0x5739('0x5e')]['ids'][_0x13b385],'MailAccountId':_0x451175[_0x5739('0x5d')]['id']});}return _0x20f18d;});}})[_0x5739('0x1e')](respondWithResult(_0x5903f9,null))[_0x5739('0x28')](handleError(_0x5903f9,null));};exports[_0x5739('0xb8')]=function(_0x3d0f7a,_0x2f6ccb,_0x599640){return db['MailAccount'][_0x5739('0x5f')]({'where':{'id':_0x3d0f7a[_0x5739('0x5d')]['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x2f6ccb,null))['then'](function(_0x46a42a){if(_0x46a42a){return _0x46a42a[_0x5739('0xb8')](_0x3d0f7a[_0x5739('0x48')][_0x5739('0x6c')])[_0x5739('0x1e')](function(){if(_[_0x5739('0xb9')](_0x3d0f7a[_0x5739('0x48')][_0x5739('0x6c')])){for(var _0xd748d6=0x0;_0xd748d6<_0x3d0f7a['query'][_0x5739('0x6c')][_0x5739('0x4e')];_0xd748d6+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x3d0f7a[_0x5739('0x48')][_0x5739('0x6c')][_0xd748d6]),'MailAccountId':Number(_0x3d0f7a[_0x5739('0x5d')]['id'])});}}else{socket['emit'](_0x5739('0xba'),{'UserId':Number(_0x3d0f7a[_0x5739('0x48')][_0x5739('0x6c')]),'MailAccountId':Number(_0x3d0f7a[_0x5739('0x5d')]['id'])});}});}})[_0x5739('0x1e')](respondWithStatusCode(_0x2f6ccb,null))['catch'](handleError(_0x2f6ccb,null));};exports[_0x5739('0xbb')]=function(_0x6b4c7d,_0x108e05,_0x24a216){var _0x235ea2={};var _0x160ca={};var _0x2e8e8c;var _0x3ef48f;return db[_0x5739('0x42')]['findOne']({'where':{'id':_0x6b4c7d['params']['id']}})[_0x5739('0x1e')](handleEntityNotFound(_0x108e05,null))['then'](function(_0x7f9255){if(_0x7f9255){_0x2e8e8c=_0x7f9255;_0x160ca[_0x5739('0x46')]=_[_0x5739('0x49')](db['User'][_0x5739('0x43')]);_0x160ca[_0x5739('0x48')]=_[_0x5739('0x49')](_0x6b4c7d[_0x5739('0x48')]);_0x160ca[_0x5739('0x4a')]=_[_0x5739('0x4b')](_0x160ca[_0x5739('0x46')],_0x160ca[_0x5739('0x48')]);_0x235ea2['attributes']=_[_0x5739('0x4b')](_0x160ca[_0x5739('0x46')],qs[_0x5739('0x4d')](_0x6b4c7d[_0x5739('0x48')][_0x5739('0x4d')]));_0x235ea2[_0x5739('0x4c')]=_0x235ea2[_0x5739('0x4c')][_0x5739('0x4e')]?_0x235ea2[_0x5739('0x4c')]:_0x160ca[_0x5739('0x46')];_0x235ea2[_0x5739('0x51')]=qs[_0x5739('0x52')](_0x6b4c7d[_0x5739('0x48')][_0x5739('0x52')]);_0x235ea2[_0x5739('0x53')]=qs[_0x5739('0x4a')](_[_0x5739('0x54')](_0x6b4c7d[_0x5739('0x48')],_0x160ca[_0x5739('0x4a')]));if(_0x6b4c7d[_0x5739('0x48')][_0x5739('0x55')]){_0x235ea2[_0x5739('0x53')]=_[_0x5739('0x56')](_0x235ea2[_0x5739('0x53')],{'$or':_[_0x5739('0x47')](_0x235ea2['attributes'],function(_0x59d036){var _0x4fd6d6={};_0x4fd6d6[_0x59d036]={'$like':'%'+_0x6b4c7d[_0x5739('0x48')]['filter']+'%'};return _0x4fd6d6;})});}_0x235ea2=_[_0x5739('0x56')]({},_0x235ea2,_0x6b4c7d[_0x5739('0x58')]);return _0x2e8e8c[_0x5739('0xbb')](_0x235ea2);}})[_0x5739('0x1e')](function(_0x4d87b9){if(_0x4d87b9){_0x3ef48f=_0x4d87b9[_0x5739('0x4e')];if(!_0x6b4c7d[_0x5739('0x48')]['hasOwnProperty']('nolimit')){_0x235ea2[_0x5739('0x2f')]=qs[_0x5739('0x2f')](_0x6b4c7d[_0x5739('0x48')]['limit']);_0x235ea2[_0x5739('0x2e')]=qs['offset'](_0x6b4c7d[_0x5739('0x48')][_0x5739('0x2e')]);}return _0x2e8e8c['getAgents'](_0x235ea2);}})[_0x5739('0x1e')](function(_0xfc423f){if(_0xfc423f){return _0xfc423f?{'count':_0x3ef48f,'rows':_0xfc423f}:null;}})[_0x5739('0x1e')](respondWithResult(_0x108e05,null))['catch'](handleError(_0x108e05,null));}; \ No newline at end of file +var _0xd4ae=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','http','Sequelize','ValidationError','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','offset','limit','set','Content-Range','json','reject','update','destroy','get','UserProfileResource','end','name','send','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','sort','where','pick','filters','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','Imap','keys','length','body','find','describe','addDisposition','Disposition','create','getDispositions','hasOwnProperty','nolimit','order','rows','removeDispositions','ids','MailAccountId','CannedAnswer','findOne','removeAnswers','email','ListId','active','description','isNil','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','CmContact','messageId','attach','out','Interaction','Messages','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x59ce31,_0x1e25e3){var _0x4d8828=function(_0x4a6b92){while(--_0x4a6b92){_0x59ce31['push'](_0x59ce31['shift']());}};_0x4d8828(++_0x1e25e3);}(_0xd4ae,0x16a));var _0xed4a=function(_0x43b616,_0xb842c){_0x43b616=_0x43b616-0x0;var _0xc188db=_0xd4ae[_0x43b616];return _0xc188db;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xed4a('0x0'));var rimraf=require(_0xed4a('0x1'));var zipdir=require(_0xed4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xed4a('0x3'));var BPromise=require(_0xed4a('0x4'));var Mustache=require(_0xed4a('0x5'));var util=require(_0xed4a('0x6'));var path=require('path');var sox=require(_0xed4a('0x7'));var csv=require(_0xed4a('0x8'));var ejs=require(_0xed4a('0x9'));var fs=require('fs');var _=require(_0xed4a('0xa'));var squel=require(_0xed4a('0xb'));var crypto=require(_0xed4a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xed4a('0xd'));var toCsv=require(_0xed4a('0x8'));var querystring=require(_0xed4a('0xe'));var Papa=require('papaparse');var Redis=require(_0xed4a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xed4a('0x10'));var as=require(_0xed4a('0x11'));var hardwareService=require(_0xed4a('0x12'));var logger=require(_0xed4a('0x13'))(_0xed4a('0x14'));var utils=require(_0xed4a('0x15'));var config=require(_0xed4a('0x16'));var db=require(_0xed4a('0x17'))['db'];config[_0xed4a('0x18')]=_[_0xed4a('0x19')](config[_0xed4a('0x18')],{'host':_0xed4a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed4a('0x18')]));require('./mailAccount.socket')[_0xed4a('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xed4a('0x1c')][_0xed4a('0x1d')]({'port':0x232b});function checkPasswordPattern(_0xbc6517,_0x1f84bb,_0x4cd803){if(_0x4cd803){var _0x32b718=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32b718['test'](_0x1f84bb)){return _0xbc6517;}else{throw new db[(_0xed4a('0x1e'))][(_0xed4a('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xbc6517;}}function respondWithRpcPromise(_0x376246,_0x219952,_0x2678cf,_0x328e8c){return new BPromise(function(_0x2d57f5,_0x327b75){var _0x2798fe=_0x328e8c||client;return _0x2798fe[_0xed4a('0x20')](_0x376246,_0x2678cf)[_0xed4a('0x21')](function(_0x377ce6){logger[_0xed4a('0x22')](_0xed4a('0x23'),_0x219952,_0xed4a('0x24'));logger['debug'](_0xed4a('0x25'),_0x219952,_0xed4a('0x24'),JSON[_0xed4a('0x26')](_0x377ce6));if(_0x377ce6[_0xed4a('0x27')]){if(_0x377ce6[_0xed4a('0x27')][_0xed4a('0x28')]===0x1f4){logger[_0xed4a('0x27')](_0xed4a('0x23'),_0x219952,_0x377ce6[_0xed4a('0x27')][_0xed4a('0x29')]);return _0x327b75(_0x377ce6['error'][_0xed4a('0x29')]);}logger[_0xed4a('0x27')](_0xed4a('0x23'),_0x219952,_0x377ce6[_0xed4a('0x27')][_0xed4a('0x29')]);return _0x2d57f5(_0x377ce6[_0xed4a('0x27')]['message']);}else{logger[_0xed4a('0x22')](_0xed4a('0x23'),_0x219952,'request\x20sent');_0x2d57f5(_0x377ce6['result']['message']);}})[_0xed4a('0x2a')](function(_0x3ea848){logger[_0xed4a('0x27')](_0xed4a('0x23'),_0x219952,_0x3ea848);_0x327b75(_0x3ea848);});});}function respondWithStatusCode(_0x3eb48e,_0x59e14c){_0x59e14c=_0x59e14c||0xcc;return function(_0x4fdc6b){if(_0x4fdc6b){return _0x3eb48e[_0xed4a('0x2b')](_0x59e14c);}return _0x3eb48e[_0xed4a('0x2c')](_0x59e14c)['end']();};}function respondWithResult(_0xd0dcca,_0x5638dc){_0x5638dc=_0x5638dc||0xc8;return function(_0x5d8853){if(_0x5d8853){return _0xd0dcca[_0xed4a('0x2c')](_0x5638dc)['json'](_0x5d8853);}};}function respondWithFilteredResult(_0x24afb9,_0x3844c9){return function(_0xed5fe1){if(_0xed5fe1){var _0x410533=_0xed5fe1['count'],_0x74a35d=_0x3844c9[_0xed4a('0x2d')],_0x1334dc=_0x3844c9[_0xed4a('0x2d')]+_0x3844c9[_0xed4a('0x2e')],_0x144ba0;if(_0x1334dc>=_0x410533){_0x1334dc=_0x410533;_0x144ba0=0xc8;}else{_0x144ba0=0xce;}_0x24afb9['status'](_0x144ba0);return _0x24afb9[_0xed4a('0x2f')](_0xed4a('0x30'),_0x74a35d+'-'+_0x1334dc+'/'+_0x410533)[_0xed4a('0x31')](_0xed5fe1);}return null;};}function patchUpdates(_0x47e5ef){return function(_0x3048fd){try{jsonpatch['apply'](_0x3048fd,_0x47e5ef,!![]);}catch(_0x473952){return BPromise[_0xed4a('0x32')](_0x473952);}return _0x3048fd['save']();};}function saveUpdates(_0x47efbc,_0x5b4eef){return function(_0x392553){if(_0x392553){return _0x392553[_0xed4a('0x33')](_0x47efbc)[_0xed4a('0x21')](function(_0x2cc021){return _0x2cc021;});}return null;};}function removeEntity(_0x23397a,_0x4fb3b0){return function(_0x1787af){if(_0x1787af){return _0x1787af[_0xed4a('0x34')]()['then'](function(){var _0x33260e=_0x1787af[_0xed4a('0x35')]({'plain':!![]});var _0x346819='MailAccounts';return db[_0xed4a('0x36')][_0xed4a('0x34')]({'where':{'type':_0x346819,'resourceId':_0x33260e['id']}})[_0xed4a('0x21')](function(){return _0x1787af;});})[_0xed4a('0x21')](function(){_0x23397a['status'](0xcc)[_0xed4a('0x37')]();});}};}function handleEntityNotFound(_0x39818e,_0x29af5b){return function(_0x19e4ac){if(!_0x19e4ac){_0x39818e[_0xed4a('0x2b')](0x194);}return _0x19e4ac;};}function handleError(_0x5c0f23,_0x1018b4){_0x1018b4=_0x1018b4||0x1f4;return function(_0x47feb8){logger['error'](_0x47feb8['stack']);if(_0x47feb8[_0xed4a('0x38')]){delete _0x47feb8[_0xed4a('0x38')];}_0x5c0f23['status'](_0x1018b4)[_0xed4a('0x39')](_0x47feb8);};}exports['index']=function(_0x58bd44,_0xa52e8e){var _0x543214={'include':[{'model':db[_0xed4a('0x3a')],'as':'Imap'},{'model':db[_0xed4a('0x3b')],'as':_0xed4a('0x3c')},{'model':db[_0xed4a('0x3d')],'as':_0xed4a('0x3e')}]},_0x1d4aa9={},_0x52bc6d={'count':0x0,'rows':[]};var _0x11bd46=_[_0xed4a('0x3f')](db[_0xed4a('0x40')][_0xed4a('0x41')],function(_0x58b080){return{'name':_0x58b080['fieldName'],'type':_0x58b080[_0xed4a('0x42')][_0xed4a('0x43')]};});_0x1d4aa9[_0xed4a('0x44')]=_[_0xed4a('0x3f')](_0x11bd46,_0xed4a('0x38'));_0x1d4aa9['query']=_['keys'](_0x58bd44[_0xed4a('0x45')]);_0x1d4aa9['filters']=_[_0xed4a('0x46')](_0x1d4aa9['model'],_0x1d4aa9[_0xed4a('0x45')]);_0x543214[_0xed4a('0x47')]=_[_0xed4a('0x46')](_0x1d4aa9[_0xed4a('0x44')],qs['fields'](_0x58bd44[_0xed4a('0x45')][_0xed4a('0x48')]));_0x543214[_0xed4a('0x47')]=_0x543214[_0xed4a('0x47')]['length']?_0x543214['attributes']:_0x1d4aa9[_0xed4a('0x44')];if(!_0x58bd44['query']['hasOwnProperty']('nolimit')){_0x543214['limit']=qs[_0xed4a('0x2e')](_0x58bd44[_0xed4a('0x45')][_0xed4a('0x2e')]);_0x543214[_0xed4a('0x2d')]=qs['offset'](_0x58bd44[_0xed4a('0x45')][_0xed4a('0x2d')]);}_0x543214['order']=qs[_0xed4a('0x49')](_0x58bd44[_0xed4a('0x45')][_0xed4a('0x49')]);_0x543214[_0xed4a('0x4a')]=qs['filters'](_[_0xed4a('0x4b')](_0x58bd44[_0xed4a('0x45')],_0x1d4aa9[_0xed4a('0x4c')]),_0x11bd46);if(_0x58bd44[_0xed4a('0x45')][_0xed4a('0x4d')]){_0x543214[_0xed4a('0x4a')]=_['merge'](_0x543214[_0xed4a('0x4a')],{'$or':_[_0xed4a('0x3f')](_0x11bd46,function(_0x383ffa){if(_0x383ffa[_0xed4a('0x42')]!==_0xed4a('0x4e')){var _0x187790={};_0x187790[_0x383ffa[_0xed4a('0x38')]]={'$like':'%'+_0x58bd44[_0xed4a('0x45')][_0xed4a('0x4d')]+'%'};return _0x187790;}})});}_0x543214=_[_0xed4a('0x4f')]({},_0x543214,_0x58bd44[_0xed4a('0x50')]);var _0x286f20={'where':_0x543214[_0xed4a('0x4a')]};return db[_0xed4a('0x40')]['count'](_0x286f20)[_0xed4a('0x21')](function(_0x4f190a){_0x52bc6d[_0xed4a('0x51')]=_0x4f190a;if(_0x58bd44[_0xed4a('0x45')][_0xed4a('0x52')]){_0x543214[_0xed4a('0x53')]=[{'all':!![]}];}return db['MailAccount'][_0xed4a('0x54')](_0x543214);})[_0xed4a('0x21')](function(_0xaf1e0b){_0x52bc6d['rows']=_0xaf1e0b;return _0x52bc6d;})[_0xed4a('0x21')](respondWithFilteredResult(_0xa52e8e,_0x543214))['catch'](handleError(_0xa52e8e,null));};exports[_0xed4a('0x55')]=function(_0x4caea1,_0xcd91a5){var _0x30b5f5={'raw':![],'where':{'id':_0x4caea1[_0xed4a('0x56')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xed4a('0x57')},{'model':db[_0xed4a('0x3b')],'as':_0xed4a('0x3c')},{'model':db[_0xed4a('0x3d')],'as':'mandatoryDispositionPause'}]},_0x93c84={};_0x93c84[_0xed4a('0x44')]=_[_0xed4a('0x58')](db[_0xed4a('0x40')]['rawAttributes']);_0x93c84[_0xed4a('0x45')]=_[_0xed4a('0x58')](_0x4caea1[_0xed4a('0x45')]);_0x93c84[_0xed4a('0x4c')]=_[_0xed4a('0x46')](_0x93c84[_0xed4a('0x44')],_0x93c84[_0xed4a('0x45')]);_0x30b5f5[_0xed4a('0x47')]=_[_0xed4a('0x46')](_0x93c84['model'],qs[_0xed4a('0x48')](_0x4caea1[_0xed4a('0x45')][_0xed4a('0x48')]));_0x30b5f5['attributes']=_0x30b5f5[_0xed4a('0x47')][_0xed4a('0x59')]?_0x30b5f5['attributes']:_0x93c84[_0xed4a('0x44')];if(_0x4caea1[_0xed4a('0x45')][_0xed4a('0x52')]){_0x30b5f5[_0xed4a('0x53')]=[{'all':!![]}];}_0x30b5f5=_[_0xed4a('0x4f')]({},_0x30b5f5,_0x4caea1[_0xed4a('0x50')]);return db[_0xed4a('0x40')]['find'](_0x30b5f5)[_0xed4a('0x21')](handleEntityNotFound(_0xcd91a5,null))[_0xed4a('0x21')](respondWithResult(_0xcd91a5,null))['catch'](handleError(_0xcd91a5,null));};exports[_0xed4a('0x33')]=function(_0x5786d6,_0x580f8f){if(_0x5786d6[_0xed4a('0x5a')]['id']){delete _0x5786d6['body']['id'];}return db['MailAccount'][_0xed4a('0x5b')]({'where':{'id':_0x5786d6[_0xed4a('0x56')]['id']},'include':[{'model':db[_0xed4a('0x3a')],'as':'Imap'},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0xed4a('0x3e')}]})[_0xed4a('0x21')](handleEntityNotFound(_0x580f8f,null))[_0xed4a('0x21')](saveUpdates(_0x5786d6[_0xed4a('0x5a')],null))['then'](function(_0xe116d8){if(_0xe116d8&&_0x5786d6[_0xed4a('0x5a')][_0xed4a('0x57')]){return db[_0xed4a('0x3a')][_0xed4a('0x33')](_0x5786d6['body'][_0xed4a('0x57')],{'where':{'MailAccountId':_0xe116d8['id']}})[_0xed4a('0x21')](function(){return _0xe116d8;});}return _0xe116d8;})[_0xed4a('0x21')](function(_0x567aa4){if(_0x567aa4&&_0x5786d6[_0xed4a('0x5a')][_0xed4a('0x3c')]){return db['MailServerOut'][_0xed4a('0x33')](_0x5786d6[_0xed4a('0x5a')][_0xed4a('0x3c')],{'where':{'MailAccountId':_0x567aa4['id']}})[_0xed4a('0x21')](function(){return _0x567aa4;});}return _0x567aa4;})[_0xed4a('0x21')](respondWithResult(_0x580f8f,null))['catch'](handleError(_0x580f8f,null));};exports['describe']=function(_0x25260f,_0x353055){return db[_0xed4a('0x40')][_0xed4a('0x5c')]()['then'](respondWithResult(_0x353055,null))['catch'](handleError(_0x353055,null));};exports[_0xed4a('0x5d')]=function(_0x5502c2,_0x318271,_0x50253b){if(_0x5502c2[_0xed4a('0x5a')]['id']){delete _0x5502c2[_0xed4a('0x5a')]['id'];}return db[_0xed4a('0x40')][_0xed4a('0x5b')]({'where':{'id':_0x5502c2[_0xed4a('0x56')]['id']}})['then'](handleEntityNotFound(_0x318271,null))[_0xed4a('0x21')](function(_0x256771){if(_0x256771){_0x5502c2[_0xed4a('0x5a')]['MailAccountId']=_0x256771['id'];return db[_0xed4a('0x5e')][_0xed4a('0x5f')](_0x5502c2[_0xed4a('0x5a')]);}})['then'](respondWithResult(_0x318271,null))[_0xed4a('0x2a')](handleError(_0x318271,null));};exports[_0xed4a('0x60')]=function(_0x133426,_0x712bff,_0x416d16){var _0x73e631={'raw':![],'where':{}};var _0x59ca9a={};var _0x2a8f57={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x133426[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x712bff,null))[_0xed4a('0x21')](function(_0x203ac8){if(_0x203ac8){_0x59ca9a['model']=_[_0xed4a('0x58')](db[_0xed4a('0x5e')][_0xed4a('0x41')]);_0x59ca9a[_0xed4a('0x45')]=_[_0xed4a('0x58')](_0x133426[_0xed4a('0x45')]);_0x59ca9a[_0xed4a('0x4c')]=_[_0xed4a('0x46')](_0x59ca9a['model'],_0x59ca9a['query']);_0x73e631['attributes']=_[_0xed4a('0x46')](_0x59ca9a[_0xed4a('0x44')],qs['fields'](_0x133426[_0xed4a('0x45')][_0xed4a('0x48')]));_0x73e631[_0xed4a('0x47')]=_0x73e631[_0xed4a('0x47')][_0xed4a('0x59')]?_0x73e631['attributes']:_0x59ca9a[_0xed4a('0x44')];if(!_0x133426[_0xed4a('0x45')][_0xed4a('0x61')](_0xed4a('0x62'))){_0x73e631[_0xed4a('0x2e')]=qs[_0xed4a('0x2e')](_0x133426[_0xed4a('0x45')][_0xed4a('0x2e')]);_0x73e631[_0xed4a('0x2d')]=qs['offset'](_0x133426[_0xed4a('0x45')][_0xed4a('0x2d')]);}_0x73e631[_0xed4a('0x63')]=qs[_0xed4a('0x49')](_0x133426[_0xed4a('0x45')][_0xed4a('0x49')]);_0x73e631['where']=qs['filters'](_[_0xed4a('0x4b')](_0x133426[_0xed4a('0x45')],_0x59ca9a[_0xed4a('0x4c')]));_0x73e631[_0xed4a('0x4a')]['MailAccountId']=_0x203ac8['id'];if(_0x133426[_0xed4a('0x45')][_0xed4a('0x4d')]){_0x73e631[_0xed4a('0x4a')]=_['merge'](_0x73e631[_0xed4a('0x4a')],{'$or':_['map'](_0x73e631[_0xed4a('0x47')],function(_0x4870da){var _0x14f036={};_0x14f036[_0x4870da]={'$like':'%'+_0x133426['query'][_0xed4a('0x4d')]+'%'};return _0x14f036;})});}_0x73e631=_[_0xed4a('0x4f')]({},_0x73e631,_0x133426[_0xed4a('0x50')]);return db[_0xed4a('0x5e')][_0xed4a('0x51')]({'where':_0x73e631[_0xed4a('0x4a')]})[_0xed4a('0x21')](function(_0x2f4ef8){_0x2a8f57[_0xed4a('0x51')]=_0x2f4ef8;if(_0x133426[_0xed4a('0x45')][_0xed4a('0x52')]){_0x73e631['include']=[{'all':!![]}];}return db[_0xed4a('0x5e')][_0xed4a('0x54')](_0x73e631);})[_0xed4a('0x21')](function(_0x4e824b){_0x2a8f57[_0xed4a('0x64')]=_0x4e824b;return _0x2a8f57;});}})[_0xed4a('0x21')](respondWithFilteredResult(_0x712bff,_0x73e631))[_0xed4a('0x2a')](handleError(_0x712bff,null));};exports[_0xed4a('0x65')]=function(_0xc022be,_0x347913,_0x3b5962){return db[_0xed4a('0x40')]['find']({'where':{'id':_0xc022be[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x347913,null))['then'](function(_0x2bb090){if(_0x2bb090){return _0x2bb090[_0xed4a('0x65')](_0xc022be[_0xed4a('0x45')][_0xed4a('0x66')]);}})[_0xed4a('0x21')](respondWithStatusCode(_0x347913,null))[_0xed4a('0x2a')](handleError(_0x347913,null));};exports['addAnswer']=function(_0x56f7f2,_0x1b26ee,_0x4689d6){if(_0x56f7f2[_0xed4a('0x5a')]['id']){delete _0x56f7f2[_0xed4a('0x5a')]['id'];}return db[_0xed4a('0x40')][_0xed4a('0x5b')]({'where':{'id':_0x56f7f2[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x1b26ee,null))[_0xed4a('0x21')](function(_0x5f3428){if(_0x5f3428){_0x56f7f2[_0xed4a('0x5a')][_0xed4a('0x67')]=_0x5f3428['id'];return db[_0xed4a('0x68')]['create'](_0x56f7f2[_0xed4a('0x5a')]);}})[_0xed4a('0x21')](respondWithResult(_0x1b26ee,null))[_0xed4a('0x2a')](handleError(_0x1b26ee,null));};exports['getAnswers']=function(_0x5e34d3,_0x76d862,_0x3e597a){var _0x16e8b6={'raw':![],'where':{}};var _0x161939={};var _0x558f3e={'count':0x0,'rows':[]};return db[_0xed4a('0x40')][_0xed4a('0x69')]({'where':{'id':_0x5e34d3['params']['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x76d862,null))[_0xed4a('0x21')](function(_0x10b09b){if(_0x10b09b){_0x161939[_0xed4a('0x44')]=_['keys'](db[_0xed4a('0x68')]['rawAttributes']);_0x161939[_0xed4a('0x45')]=_[_0xed4a('0x58')](_0x5e34d3['query']);_0x161939[_0xed4a('0x4c')]=_[_0xed4a('0x46')](_0x161939[_0xed4a('0x44')],_0x161939[_0xed4a('0x45')]);_0x16e8b6['attributes']=_[_0xed4a('0x46')](_0x161939[_0xed4a('0x44')],qs['fields'](_0x5e34d3[_0xed4a('0x45')]['fields']));_0x16e8b6['attributes']=_0x16e8b6[_0xed4a('0x47')][_0xed4a('0x59')]?_0x16e8b6[_0xed4a('0x47')]:_0x161939[_0xed4a('0x44')];if(!_0x5e34d3[_0xed4a('0x45')][_0xed4a('0x61')](_0xed4a('0x62'))){_0x16e8b6['limit']=qs[_0xed4a('0x2e')](_0x5e34d3['query'][_0xed4a('0x2e')]);_0x16e8b6[_0xed4a('0x2d')]=qs['offset'](_0x5e34d3[_0xed4a('0x45')][_0xed4a('0x2d')]);}_0x16e8b6['order']=qs[_0xed4a('0x49')](_0x5e34d3[_0xed4a('0x45')]['sort']);_0x16e8b6[_0xed4a('0x4a')]=qs[_0xed4a('0x4c')](_['pick'](_0x5e34d3[_0xed4a('0x45')],_0x161939[_0xed4a('0x4c')]));_0x16e8b6[_0xed4a('0x4a')][_0xed4a('0x67')]=_0x10b09b['id'];if(_0x5e34d3[_0xed4a('0x45')][_0xed4a('0x4d')]){_0x16e8b6[_0xed4a('0x4a')]=_[_0xed4a('0x4f')](_0x16e8b6['where'],{'$or':_[_0xed4a('0x3f')](_0x16e8b6[_0xed4a('0x47')],function(_0x50b872){var _0x499ddb={};_0x499ddb[_0x50b872]={'$like':'%'+_0x5e34d3[_0xed4a('0x45')][_0xed4a('0x4d')]+'%'};return _0x499ddb;})});}_0x16e8b6=_[_0xed4a('0x4f')]({},_0x16e8b6,_0x5e34d3[_0xed4a('0x50')]);return db['CannedAnswer']['count']({'where':_0x16e8b6['where']})[_0xed4a('0x21')](function(_0x5d48d5){_0x558f3e[_0xed4a('0x51')]=_0x5d48d5;if(_0x5e34d3['query']['includeAll']){_0x16e8b6['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xed4a('0x54')](_0x16e8b6);})[_0xed4a('0x21')](function(_0x9513ad){_0x558f3e[_0xed4a('0x64')]=_0x9513ad;return _0x558f3e;});}})[_0xed4a('0x21')](respondWithFilteredResult(_0x76d862,_0x16e8b6))['catch'](handleError(_0x76d862,null));};exports[_0xed4a('0x6a')]=function(_0x429007,_0x5eeaac,_0x20864a){return db[_0xed4a('0x40')][_0xed4a('0x5b')]({'where':{'id':_0x429007[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x5eeaac,null))[_0xed4a('0x21')](function(_0x3cc16b){if(_0x3cc16b){return _0x3cc16b[_0xed4a('0x6a')](_0x429007[_0xed4a('0x45')][_0xed4a('0x66')]);}})[_0xed4a('0x21')](respondWithStatusCode(_0x5eeaac,null))['catch'](handleError(_0x5eeaac,null));};exports[_0xed4a('0x5f')]=function(_0x1d6cad,_0x27dcf4){var _0x3a145b={'name':_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x38')],'key':_0x1d6cad['body']['key'],'email':_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x6b')],'ListId':_0x1d6cad['body'][_0xed4a('0x6c')],'active':!_['isNil'](_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x6d')])?_0x1d6cad[_0xed4a('0x5a')]['active']:!![],'description':_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x6e')]||null,'Imap':{},'Smtp':{}};if(_[_0xed4a('0x6f')](_0x1d6cad['body'][_0xed4a('0x70')])){if(_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x71')]){_0x3a145b[_0xed4a('0x57')][_0xed4a('0x72')]=_0x3a145b[_0xed4a('0x3c')][_0xed4a('0x72')]=_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x73')];_0x3a145b[_0xed4a('0x57')][_0xed4a('0x74')]=_0x3a145b['Smtp'][_0xed4a('0x75')]=_0x1d6cad[_0xed4a('0x5a')]['cpassword'];}else{_0x3a145b[_0xed4a('0x57')][_0xed4a('0x76')]=_0x3a145b[_0xed4a('0x3c')][_0xed4a('0x76')]=![];}_0x3a145b[_0xed4a('0x57')][_0xed4a('0x77')]=_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x57')][_0xed4a('0x77')];_0x3a145b[_0xed4a('0x57')][_0xed4a('0x78')]=_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x57')][_0xed4a('0x78')];_0x3a145b[_0xed4a('0x3c')][_0xed4a('0x77')]=_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x3c')]['host'];_0x3a145b[_0xed4a('0x3c')][_0xed4a('0x78')]=_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x3c')][_0xed4a('0x78')];}else{_0x3a145b[_0xed4a('0x57')][_0xed4a('0x79')]=_0x3a145b[_0xed4a('0x3c')][_0xed4a('0x79')]=_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x70')];_0x3a145b[_0xed4a('0x57')][_0xed4a('0x72')]=_0x3a145b[_0xed4a('0x3c')][_0xed4a('0x72')]=_0x1d6cad[_0xed4a('0x5a')]['cuser'];_0x3a145b[_0xed4a('0x57')][_0xed4a('0x74')]=_0x3a145b[_0xed4a('0x3c')][_0xed4a('0x75')]=_0x1d6cad[_0xed4a('0x5a')][_0xed4a('0x7a')];}return db['MailAccount']['create'](_0x3a145b,{'include':[{'model':db[_0xed4a('0x3b')],'as':'Smtp'},{'model':db[_0xed4a('0x3a')],'as':_0xed4a('0x57')}]})['then'](function(_0x3f006a){var _0x1b7d08=_0x1d6cad[_0xed4a('0x72')][_0xed4a('0x35')]({'plain':!![]});if(!_0x1b7d08)throw new Error(_0xed4a('0x7b'));if(_0x1b7d08[_0xed4a('0x7c')]===_0xed4a('0x72')){var _0x12fae6=_0x3f006a[_0xed4a('0x35')]({'plain':!![]});return db[_0xed4a('0x7d')][_0xed4a('0x5b')]({'where':{'name':_0xed4a('0x7e'),'userProfileId':_0x1b7d08[_0xed4a('0x7f')]},'raw':!![]})['then'](function(_0x36fe64){if(_0x36fe64&&_0x36fe64['autoAssociation']===0x0){return db[_0xed4a('0x36')][_0xed4a('0x5f')]({'name':_0x12fae6[_0xed4a('0x38')],'resourceId':_0x12fae6['id'],'type':_0x36fe64[_0xed4a('0x38')],'sectionId':_0x36fe64['id']},{})[_0xed4a('0x21')](function(){return _0x3f006a;});}else{return _0x3f006a;}})['catch'](function(_0x4c45db){logger[_0xed4a('0x27')](_0xed4a('0x80'),_0x4c45db);throw _0x4c45db;});}return _0x3f006a;})[_0xed4a('0x21')](respondWithResult(_0x27dcf4,0xc9))[_0xed4a('0x2a')](handleError(_0x27dcf4,null));};exports[_0xed4a('0x81')]=function(_0x3eadf9,_0x368489,_0x2e1fd1){return db['MailAccount'][_0xed4a('0x69')]({'where':{'id':_0x3eadf9['params']['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x368489,null))[_0xed4a('0x21')](function(_0x2f1fc4){if(_0x2f1fc4){return _0x2f1fc4[_0xed4a('0x81')]();}return null;})[_0xed4a('0x21')](respondWithResult(_0x368489,null))[_0xed4a('0x2a')](handleError(_0x368489,null));};exports[_0xed4a('0x82')]=function(_0x1520fb,_0x276665,_0x8e94a4){if(_0x1520fb[_0xed4a('0x5a')]['id']){delete _0x1520fb[_0xed4a('0x5a')]['id'];}return db['MailAccount'][_0xed4a('0x5b')]({'where':{'id':_0x1520fb[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x276665,null))[_0xed4a('0x21')](function(_0x48f23d){if(_0x48f23d){_0x1520fb[_0xed4a('0x5a')][_0xed4a('0x67')]=_0x48f23d['id'];return db[_0xed4a('0x3a')][_0xed4a('0x5f')](_0x1520fb[_0xed4a('0x5a')]);}})['then'](respondWithResult(_0x276665,null))[_0xed4a('0x2a')](handleError(_0x276665,null));};exports[_0xed4a('0x83')]=function(_0x5a8569,_0x373505,_0x1675c5){return db[_0xed4a('0x40')][_0xed4a('0x69')]({'where':{'id':_0x5a8569[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x373505,null))[_0xed4a('0x21')](function(_0xfc5114){if(_0xfc5114){return _0xfc5114['setImap'](null);}return null;})[_0xed4a('0x21')](respondWithStatusCode(_0x373505,null))['catch'](handleError(_0x373505,null));};exports[_0xed4a('0x84')]=function(_0x5d912d,_0x42e222,_0x25c610){return db[_0xed4a('0x40')]['findOne']({'where':{'id':_0x5d912d[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x42e222,null))[_0xed4a('0x21')](function(_0x22043e){if(_0x22043e){return _0x22043e['getSmtp']();}return null;})[_0xed4a('0x21')](respondWithResult(_0x42e222,null))['catch'](handleError(_0x42e222,null));};exports[_0xed4a('0x85')]=function(_0x307ad5,_0x3b0f24,_0x315950){if(_0x307ad5[_0xed4a('0x5a')]['id']){delete _0x307ad5[_0xed4a('0x5a')]['id'];}return db[_0xed4a('0x40')][_0xed4a('0x5b')]({'where':{'id':_0x307ad5[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x3b0f24,null))[_0xed4a('0x21')](function(_0x5c4d20){if(_0x5c4d20){_0x307ad5[_0xed4a('0x5a')][_0xed4a('0x67')]=_0x5c4d20['id'];return db[_0xed4a('0x3b')]['create'](_0x307ad5[_0xed4a('0x5a')]);}})['then'](respondWithResult(_0x3b0f24,null))[_0xed4a('0x2a')](handleError(_0x3b0f24,null));};exports[_0xed4a('0x86')]=function(_0x49e5ab,_0x29f3ba,_0x219785){return db[_0xed4a('0x40')][_0xed4a('0x69')]({'where':{'id':_0x49e5ab[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x29f3ba,null))[_0xed4a('0x21')](function(_0x63228a){if(_0x63228a){return _0x63228a[_0xed4a('0x87')](null);}return null;})[_0xed4a('0x21')](respondWithStatusCode(_0x29f3ba,null))['catch'](handleError(_0x29f3ba,null));};exports[_0xed4a('0x88')]=function(_0x211f3d,_0x58dcf8,_0x5e8e76){return db[_0xed4a('0x89')][_0xed4a('0x5b')]({'where':{'id':_0x211f3d[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x58dcf8,null))[_0xed4a('0x21')](function(_0x410f1c){if(_0x410f1c){return _0x410f1c[_0xed4a('0x88')](_0x211f3d[_0xed4a('0x5a')][_0xed4a('0x66')],_[_0xed4a('0x8a')](_0x211f3d['body'],[_0xed4a('0x66'),'id'])||{});}})[_0xed4a('0x21')](respondWithResult(_0x58dcf8,null))[_0xed4a('0x2a')](handleError(_0x58dcf8,null));};exports[_0xed4a('0x8b')]=function(_0x3061d9,_0x19a21b,_0x57773f){var _0x4c6d74={'raw':![],'where':{}};var _0x509fce={};var _0x24f827={'count':0x0,'rows':[]};return db[_0xed4a('0x40')]['findOne']({'where':{'id':_0x3061d9[_0xed4a('0x56')]['id']}})['then'](handleEntityNotFound(_0x19a21b,null))[_0xed4a('0x21')](function(_0xf0b624){if(_0xf0b624){_0x509fce[_0xed4a('0x44')]=_[_0xed4a('0x58')](db['MailInteraction'][_0xed4a('0x41')]);_0x509fce[_0xed4a('0x45')]=_['keys'](_0x3061d9['query']);_0x509fce[_0xed4a('0x4c')]=_[_0xed4a('0x46')](_0x509fce[_0xed4a('0x44')],_0x509fce[_0xed4a('0x45')]);_0x4c6d74[_0xed4a('0x47')]=_[_0xed4a('0x46')](_0x509fce[_0xed4a('0x44')],qs[_0xed4a('0x48')](_0x3061d9[_0xed4a('0x45')][_0xed4a('0x48')]));_0x4c6d74['attributes']=_0x4c6d74[_0xed4a('0x47')][_0xed4a('0x59')]?_0x4c6d74[_0xed4a('0x47')]:_0x509fce['model'];if(!_0x3061d9[_0xed4a('0x45')][_0xed4a('0x61')]('nolimit')){_0x4c6d74['limit']=qs[_0xed4a('0x2e')](_0x3061d9[_0xed4a('0x45')][_0xed4a('0x2e')]);_0x4c6d74[_0xed4a('0x2d')]=qs['offset'](_0x3061d9['query'][_0xed4a('0x2d')]);}_0x4c6d74[_0xed4a('0x63')]=qs[_0xed4a('0x49')](_0x3061d9[_0xed4a('0x45')]['sort']);_0x4c6d74[_0xed4a('0x4a')]=qs[_0xed4a('0x4c')](_[_0xed4a('0x4b')](_0x3061d9[_0xed4a('0x45')],_0x509fce[_0xed4a('0x4c')]));_0x4c6d74['where'][_0xed4a('0x67')]=_0xf0b624['id'];if(_0x3061d9['query'][_0xed4a('0x4d')]){_0x4c6d74[_0xed4a('0x4a')]=_[_0xed4a('0x4f')](_0x4c6d74[_0xed4a('0x4a')],{'$or':_[_0xed4a('0x3f')](_0x4c6d74[_0xed4a('0x47')],function(_0x4bf6c5){var _0x135690={};_0x135690[_0x4bf6c5]={'$like':'%'+_0x3061d9['query']['filter']+'%'};return _0x135690;})});}_0x4c6d74=_[_0xed4a('0x4f')]({},_0x4c6d74,_0x3061d9[_0xed4a('0x50')]);return db['MailInteraction'][_0xed4a('0x51')]({'where':_0x4c6d74[_0xed4a('0x4a')]})[_0xed4a('0x21')](function(_0x5535c2){_0x24f827[_0xed4a('0x51')]=_0x5535c2;if(_0x3061d9[_0xed4a('0x45')][_0xed4a('0x52')]){_0x4c6d74[_0xed4a('0x53')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xed4a('0x8c')],'as':_0xed4a('0x8d'),'attributes':['name',_0xed4a('0x8e'),_0xed4a('0x8f')],'required':![]},{'model':db[_0xed4a('0x90')],'as':'Tags','attributes':['id',_0xed4a('0x38'),_0xed4a('0x91')],'where':_0x3061d9[_0xed4a('0x45')][_0xed4a('0x92')]?{'id':_0x3061d9[_0xed4a('0x45')][_0xed4a('0x92')]}:undefined,'required':_0x3061d9[_0xed4a('0x45')]['tag']?!![]:![]}];}return db[_0xed4a('0x89')][_0xed4a('0x54')](_0x4c6d74);})[_0xed4a('0x21')](function(_0x143a1d){_0x24f827['rows']=_0x143a1d;return _0x24f827;});}})['then'](respondWithFilteredResult(_0x19a21b,_0x4c6d74))[_0xed4a('0x2a')](handleError(_0x19a21b,null));};exports[_0xed4a('0x93')]=function(_0x1b19f5,_0x950469,_0x482a51){return db['MailAccount'][_0xed4a('0x69')]({'where':{'id':_0x1b19f5['params']['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x950469,null))[_0xed4a('0x21')](function(_0x3d9500){if(_0x3d9500){return db[_0xed4a('0x94')]['transaction'](function(_0x4c7c90){return db[_0xed4a('0x95')][_0xed4a('0x34')]({'where':{'MailAccountId':_0x1b19f5[_0xed4a('0x56')]['id']},'transaction':_0x4c7c90})['then'](function(_0x3b1087){var _0x5abb16=_[_0xed4a('0x3f')](_0x1b19f5[_0xed4a('0x5a')],function(_0x142dca){_0x142dca['MailAccountId']=_0x1b19f5[_0xed4a('0x56')]['id'];return _0x142dca;});return db['MailApplication'][_0xed4a('0x96')](_0x5abb16,{'transaction':_0x4c7c90});});})[_0xed4a('0x21')](function(){return db['MailApplication'][_0xed4a('0x97')]({'where':{'MailAccountId':_0x1b19f5['params']['id']},'order':_0xed4a('0x98')});});}})[_0xed4a('0x21')](respondWithResult(_0x950469,null))['catch'](handleError(_0x950469,null));};exports[_0xed4a('0x99')]=function(_0x13446d,_0x43e78f,_0x29d441){var _0x12eeec={};var _0x4cfec6={};var _0x3e45cc;var _0x3cd026;return db[_0xed4a('0x40')][_0xed4a('0x69')]({'where':{'id':_0x13446d[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x43e78f,null))[_0xed4a('0x21')](function(_0x1227e7){if(_0x1227e7){_0x3e45cc=_0x1227e7;_0x4cfec6[_0xed4a('0x44')]=_[_0xed4a('0x58')](db[_0xed4a('0x95')][_0xed4a('0x41')]);_0x4cfec6['query']=_[_0xed4a('0x58')](_0x13446d[_0xed4a('0x45')]);_0x4cfec6[_0xed4a('0x4c')]=_[_0xed4a('0x46')](_0x4cfec6[_0xed4a('0x44')],_0x4cfec6[_0xed4a('0x45')]);_0x12eeec[_0xed4a('0x47')]=_[_0xed4a('0x46')](_0x4cfec6[_0xed4a('0x44')],qs[_0xed4a('0x48')](_0x13446d['query'][_0xed4a('0x48')]));_0x12eeec[_0xed4a('0x47')]=_0x12eeec[_0xed4a('0x47')][_0xed4a('0x59')]?_0x12eeec['attributes']:_0x4cfec6[_0xed4a('0x44')];_0x12eeec['order']=qs['sort'](_0x13446d[_0xed4a('0x45')][_0xed4a('0x49')]);_0x12eeec[_0xed4a('0x4a')]=qs[_0xed4a('0x4c')](_[_0xed4a('0x4b')](_0x13446d['query'],_0x4cfec6[_0xed4a('0x4c')]));if(_0x13446d['query']['filter']){_0x12eeec['where']=_[_0xed4a('0x4f')](_0x12eeec[_0xed4a('0x4a')],{'$or':_['map'](_0x12eeec['attributes'],function(_0x1ca862){var _0x48557c={};_0x48557c[_0x1ca862]={'$like':'%'+_0x13446d[_0xed4a('0x45')][_0xed4a('0x4d')]+'%'};return _0x48557c;})});}_0x12eeec=_[_0xed4a('0x4f')]({},_0x12eeec,_0x13446d[_0xed4a('0x50')]);return _0x3e45cc[_0xed4a('0x99')](_0x12eeec);}})[_0xed4a('0x21')](function(_0x53d69d){if(_0x53d69d){_0x3cd026=_0x53d69d[_0xed4a('0x59')];if(!_0x13446d[_0xed4a('0x45')]['hasOwnProperty']('nolimit')){_0x12eeec[_0xed4a('0x2e')]=qs[_0xed4a('0x2e')](_0x13446d['query']['limit']);_0x12eeec[_0xed4a('0x2d')]=qs[_0xed4a('0x2d')](_0x13446d[_0xed4a('0x45')][_0xed4a('0x2d')]);}return _0x3e45cc[_0xed4a('0x99')](_0x12eeec);}})[_0xed4a('0x21')](function(_0x1a9650){if(_0x1a9650){return _0x1a9650?{'count':_0x3cd026,'rows':_0x1a9650}:null;}})[_0xed4a('0x21')](respondWithResult(_0x43e78f,null))[_0xed4a('0x2a')](handleError(_0x43e78f,null));};exports['getMessages']=function(_0x4bd93b,_0x3aa706,_0x150609){var _0x47116b={'raw':!![],'where':{}};var _0x4c4c32={};var _0x12f670={'count':0x0,'rows':[]};return db[_0xed4a('0x40')][_0xed4a('0x69')]({'where':{'id':_0x4bd93b[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x3aa706,null))[_0xed4a('0x21')](function(_0x2c5da0){if(_0x2c5da0){_0x4c4c32[_0xed4a('0x44')]=_[_0xed4a('0x58')](db[_0xed4a('0x9a')][_0xed4a('0x41')]);_0x4c4c32[_0xed4a('0x45')]=_[_0xed4a('0x58')](_0x4bd93b[_0xed4a('0x45')]);_0x4c4c32[_0xed4a('0x4c')]=_['intersection'](_0x4c4c32[_0xed4a('0x44')],_0x4c4c32[_0xed4a('0x45')]);_0x47116b[_0xed4a('0x47')]=_[_0xed4a('0x46')](_0x4c4c32[_0xed4a('0x44')],qs[_0xed4a('0x48')](_0x4bd93b['query'][_0xed4a('0x48')]));_0x47116b[_0xed4a('0x47')]=_0x47116b[_0xed4a('0x47')]['length']?_0x47116b[_0xed4a('0x47')]:_0x4c4c32[_0xed4a('0x44')];if(!_0x4bd93b[_0xed4a('0x45')]['hasOwnProperty']('nolimit')){_0x47116b[_0xed4a('0x2e')]=qs[_0xed4a('0x2e')](_0x4bd93b[_0xed4a('0x45')][_0xed4a('0x2e')]);_0x47116b[_0xed4a('0x2d')]=qs[_0xed4a('0x2d')](_0x4bd93b[_0xed4a('0x45')][_0xed4a('0x2d')]);}_0x47116b[_0xed4a('0x63')]=qs['sort'](_0x4bd93b['query'][_0xed4a('0x49')]);_0x47116b[_0xed4a('0x4a')]=qs[_0xed4a('0x4c')](_[_0xed4a('0x4b')](_0x4bd93b[_0xed4a('0x45')],_0x4c4c32[_0xed4a('0x4c')]));_0x47116b[_0xed4a('0x4a')][_0xed4a('0x67')]=_0x2c5da0['id'];if(_0x4bd93b[_0xed4a('0x45')][_0xed4a('0x4d')]){_0x47116b[_0xed4a('0x4a')]=_[_0xed4a('0x4f')](_0x47116b[_0xed4a('0x4a')],{'$or':_[_0xed4a('0x3f')](_0x47116b[_0xed4a('0x47')],function(_0xae81af){var _0x51e4dc={};_0x51e4dc[_0xae81af]={'$like':'%'+_0x4bd93b['query'][_0xed4a('0x4d')]+'%'};return _0x51e4dc;})});}if(_0x4bd93b['query'][_0xed4a('0x9b')]){var _0x3cac01=_0x4bd93b[_0xed4a('0x45')][_0xed4a('0x9b')][_0xed4a('0x9c')](',');var _0x600ba1={};_0x600ba1[_0x3cac01[0x0]]={'$gte':moment(_0x3cac01[0x1])[_0xed4a('0x9d')](_0xed4a('0x9e'))};_0x47116b[_0xed4a('0x4a')]=_['merge'](_0x47116b[_0xed4a('0x4a')],_0x600ba1);}_0x47116b=_[_0xed4a('0x4f')]({},_0x47116b,_0x4bd93b[_0xed4a('0x50')]);return db['MailMessage'][_0xed4a('0x51')]({'where':_0x47116b[_0xed4a('0x4a')]})[_0xed4a('0x21')](function(_0x533909){_0x12f670[_0xed4a('0x51')]=_0x533909;if(_0x4bd93b['query'][_0xed4a('0x52')]){_0x47116b[_0xed4a('0x53')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x47116b);})[_0xed4a('0x21')](function(_0xf14da5){_0x12f670[_0xed4a('0x64')]=_0xf14da5;return _0x12f670;});}})[_0xed4a('0x21')](respondWithFilteredResult(_0x3aa706,_0x47116b))['catch'](handleError(_0x3aa706,null));};exports[_0xed4a('0x39')]=function(_0x365c1d,_0x4ca4bc,_0x4fe2e2){var _0x130fa3,_0xd81f04={},_0x3e49b9;if(_0x365c1d[_0xed4a('0x5a')]['to']){_0x3e49b9=_0x365c1d[_0xed4a('0x5a')]['to'][_0xed4a('0x9c')](',')[0x0];}return db['MailAccount'][_0xed4a('0x5b')]({'where':{'id':_0x365c1d[_0xed4a('0x56')]['id']},'include':[{'model':db[_0xed4a('0x9f')],'as':_0xed4a('0xa0'),'include':[{'model':db['CmContact'],'as':_0xed4a('0xa1'),'where':{'email':_0x3e49b9},'limit':0x1,'order':[[_0xed4a('0xa2'),_0xed4a('0xa3')]]}]},{'model':db[_0xed4a('0x3b')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x4ca4bc,null))[_0xed4a('0x21')](function(_0x50fce1){if(_0x50fce1){_0x130fa3=_0x50fce1;if(_0x50fce1[_0xed4a('0x3c')]){if(_[_0xed4a('0x6f')](_0x365c1d[_0xed4a('0x5a')]['from'])){_0x365c1d['body'][_0xed4a('0xa4')]=util[_0xed4a('0x9d')](_0xed4a('0xa5'),_0x50fce1[_0xed4a('0x38')],_0x50fce1['email']||_0x50fce1[_0xed4a('0x3c')][_0xed4a('0x72')]);}if(_0x365c1d['body'][_0xed4a('0xa6')]&&_0x365c1d['body']['attachments'][_0xed4a('0x59')]){for(var _0x1baa74=0x0;_0x1baa74<_0x365c1d[_0xed4a('0x5a')][_0xed4a('0xa6')][_0xed4a('0x59')];_0x1baa74+=0x1){_0x365c1d['body'][_0xed4a('0xa6')][_0x1baa74]={'filename':_0x365c1d['body'][_0xed4a('0xa6')][_0x1baa74][_0xed4a('0x38')],'path':path['join'](config[_0xed4a('0xa7')],'server/files/attachments',_0x365c1d['body'][_0xed4a('0xa6')][_0x1baa74][_0xed4a('0xa8')])};}}var _0x401f54={'tls':{'rejectUnauthorized':![]}};if(_[_0xed4a('0x6f')](_0x50fce1[_0xed4a('0x3c')][_0xed4a('0x79')])){if(_0x50fce1[_0xed4a('0x3c')][_0xed4a('0x76')]){_0x401f54[_0xed4a('0xa9')]={'user':_0x50fce1[_0xed4a('0x3c')][_0xed4a('0x72')],'pass':_0x50fce1[_0xed4a('0x3c')][_0xed4a('0x75')]};}_0x401f54['host']=_0x50fce1[_0xed4a('0x3c')][_0xed4a('0x77')];_0x401f54[_0xed4a('0x78')]=_0x50fce1[_0xed4a('0x3c')][_0xed4a('0x78')];_0x401f54['secure']=_0x50fce1[_0xed4a('0x3c')][_0xed4a('0xaa')];}else{_0x401f54[_0xed4a('0x79')]=_0x50fce1['Smtp']['service'];_0x401f54[_0xed4a('0xa9')]={'user':_0x50fce1[_0xed4a('0x3c')]['user'],'pass':_0x50fce1[_0xed4a('0x3c')]['pass']};}return respondWithRpcPromise(_0xed4a('0xab'),_0xed4a('0xac'),{'account':_0x401f54,'message':_0x365c1d['body']});}else{throw new Error(_0xed4a('0xad'));}}})['then'](function(_0x35168b){if(_0x35168b){_0xd81f04=_0x35168b;if(_0x130fa3[_0xed4a('0xa0')]){if(_0x130fa3[_0xed4a('0xa0')]['Contacts'][_0xed4a('0x59')]){return _0x130fa3[_0xed4a('0xa0')][_0xed4a('0xa1')][0x0];}else{return db[_0xed4a('0xae')][_0xed4a('0x5f')](_['defaults'](_0x365c1d[_0xed4a('0x5a')],{'firstName':_0x365c1d[_0xed4a('0x5a')]['to'],'email':_0x365c1d[_0xed4a('0x5a')]['to'],'phone':_0x365c1d['body']['to'],'ListId':_0x130fa3['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0xed4a('0x21')](function(_0x55093b){if(_0x55093b){var _0x3328f1={'UserId':_0x365c1d[_0xed4a('0x72')]['id'],'ContactId':_0x55093b['id'],'MailAccountId':_0x130fa3['id'],'inReplyTo':_0xd81f04[_0xed4a('0xaf')],'to':_0x365c1d[_0xed4a('0x5a')][_0xed4a('0xa4')],'cc':_0x365c1d[_0xed4a('0x5a')]['cc'],'subject':_0x365c1d[_0xed4a('0x5a')]['subject'],'attach':_0x365c1d[_0xed4a('0x5a')][_0xed4a('0xb0')],'firstMsgDirection':_0xed4a('0xb1'),'lastMsgAt':moment()[_0xed4a('0x9d')](_0xed4a('0x9e')),'lastMsgDirection':'out','lastMsgBody':_0x365c1d[_0xed4a('0x5a')][_0xed4a('0x5a')],'Messages':[_[_0xed4a('0x4f')](_0x365c1d[_0xed4a('0x5a')],{'messageId':_0xd81f04['messageId'],'sentAt':moment()[_0xed4a('0x9d')](_0xed4a('0x9e')),'read':!![],'MailAccountId':_0x130fa3['id'],'UserId':_0x365c1d['user']['id'],'ContactId':_0x55093b['id']})]};if(_0x365c1d['body'][_0xed4a('0xb2')]){_0x3328f1=_[_0xed4a('0x4f')](_0x3328f1,_0x365c1d[_0xed4a('0x5a')][_0xed4a('0xb2')]);}return db[_0xed4a('0x89')][_0xed4a('0x5f')](_0x3328f1,{'include':[{'model':db[_0xed4a('0x9a')],'as':_0xed4a('0xb3')}]});}})[_0xed4a('0x21')](respondWithResult(_0x4ca4bc,null))[_0xed4a('0x2a')](handleError(_0x4ca4bc,null));};exports['verifySmtp']=function(_0x488604,_0x3defed,_0x3be947){return db[_0xed4a('0x40')][_0xed4a('0x5b')]({'where':{'id':_0x488604[_0xed4a('0x56')]['id']},'include':[{'model':db[_0xed4a('0x3b')],'as':_0xed4a('0x3c'),'raw':!![]}]})[_0xed4a('0x21')](handleEntityNotFound(_0x3defed,null))[_0xed4a('0x21')](function(_0x19d9aa){if(_0x19d9aa&&_0x19d9aa[_0xed4a('0x3c')]){var _0x2fc441={'id':_0x19d9aa['id'],'tls':{'rejectUnauthorized':![]}};if(_0x19d9aa['Smtp'][_0xed4a('0x79')]){_0x2fc441[_0xed4a('0x79')]=_0x19d9aa['Smtp'][_0xed4a('0x79')];}else{_0x2fc441[_0xed4a('0x77')]=_0x19d9aa['Smtp'][_0xed4a('0x77')];_0x2fc441[_0xed4a('0x78')]=_0x19d9aa[_0xed4a('0x3c')][_0xed4a('0x78')];_0x2fc441['secure']=_0x19d9aa[_0xed4a('0x3c')][_0xed4a('0xaa')];}if(_0x19d9aa['Smtp'][_0xed4a('0x76')]){_0x2fc441[_0xed4a('0xa9')]={'user':_0x19d9aa[_0xed4a('0x3c')][_0xed4a('0x72')],'pass':_0x19d9aa['Smtp'][_0xed4a('0x75')]};}return respondWithRpcPromise(_0xed4a('0xb4'),'verifySmtp',{'account':_0x2fc441});}})[_0xed4a('0x21')](respondWithResult(_0x3defed,null))[_0xed4a('0x2a')](handleError(_0x3defed,null));};exports[_0xed4a('0x34')]=function(_0x4733df,_0x32c9a3){return db[_0xed4a('0x40')]['find']({'where':{'id':_0x4733df[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x32c9a3,null))[_0xed4a('0x21')](function(_0x53ceff){if(_0x53ceff&&_0x53ceff['service']){throw new db['Sequelize'][(_0xed4a('0x1f'))](_0xed4a('0xb5'));}return _0x53ceff;})[_0xed4a('0x21')](removeEntity(_0x32c9a3,null))[_0xed4a('0x2a')](handleError(_0x32c9a3,null));};exports['addAgents']=function(_0x13a54b,_0x2050bf,_0x1073f1){return db[_0xed4a('0x40')][_0xed4a('0x5b')]({'where':{'id':_0x13a54b[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x2050bf,null))[_0xed4a('0x21')](function(_0x2791cc){if(_0x2791cc){return _0x2791cc[_0xed4a('0xb6')](_0x13a54b[_0xed4a('0x5a')][_0xed4a('0x66')],_[_0xed4a('0x8a')](_0x13a54b['body'],[_0xed4a('0x66'),'id'])||{})[_0xed4a('0xb7')](function(_0x3da6bf){for(var _0x4ff0f7=0x0;_0x4ff0f7<_0x13a54b[_0xed4a('0x5a')][_0xed4a('0x66')][_0xed4a('0x59')];_0x4ff0f7+=0x1){socket['emit'](_0xed4a('0xb8'),{'UserId':_0x13a54b[_0xed4a('0x5a')][_0xed4a('0x66')][_0x4ff0f7],'MailAccountId':_0x13a54b['params']['id']});}return _0x3da6bf;});}})[_0xed4a('0x21')](respondWithResult(_0x2050bf,null))[_0xed4a('0x2a')](handleError(_0x2050bf,null));};exports['removeAgents']=function(_0x214a9f,_0x4d0dc1,_0x21a854){return db[_0xed4a('0x40')]['find']({'where':{'id':_0x214a9f[_0xed4a('0x56')]['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x4d0dc1,null))['then'](function(_0x3c201d){if(_0x3c201d){return _0x3c201d[_0xed4a('0xb9')](_0x214a9f[_0xed4a('0x45')][_0xed4a('0x66')])['then'](function(){if(_[_0xed4a('0xba')](_0x214a9f[_0xed4a('0x45')][_0xed4a('0x66')])){for(var _0x25abab=0x0;_0x25abab<_0x214a9f[_0xed4a('0x45')][_0xed4a('0x66')][_0xed4a('0x59')];_0x25abab+=0x1){socket['emit'](_0xed4a('0xbb'),{'UserId':Number(_0x214a9f[_0xed4a('0x45')][_0xed4a('0x66')][_0x25abab]),'MailAccountId':Number(_0x214a9f[_0xed4a('0x56')]['id'])});}}else{socket[_0xed4a('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x214a9f[_0xed4a('0x45')]['ids']),'MailAccountId':Number(_0x214a9f[_0xed4a('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d0dc1,null))['catch'](handleError(_0x4d0dc1,null));};exports[_0xed4a('0xbd')]=function(_0x515665,_0x2bc9e2,_0x4445f7){var _0x74054d={};var _0x1be871={};var _0x15fbc7;var _0x10f96d;return db[_0xed4a('0x40')][_0xed4a('0x69')]({'where':{'id':_0x515665['params']['id']}})[_0xed4a('0x21')](handleEntityNotFound(_0x2bc9e2,null))['then'](function(_0x4f81df){if(_0x4f81df){_0x15fbc7=_0x4f81df;_0x1be871['model']=_[_0xed4a('0x58')](db[_0xed4a('0x8c')][_0xed4a('0x41')]);_0x1be871[_0xed4a('0x45')]=_['keys'](_0x515665['query']);_0x1be871[_0xed4a('0x4c')]=_[_0xed4a('0x46')](_0x1be871[_0xed4a('0x44')],_0x1be871[_0xed4a('0x45')]);_0x74054d[_0xed4a('0x47')]=_[_0xed4a('0x46')](_0x1be871[_0xed4a('0x44')],qs[_0xed4a('0x48')](_0x515665[_0xed4a('0x45')][_0xed4a('0x48')]));_0x74054d['attributes']=_0x74054d[_0xed4a('0x47')][_0xed4a('0x59')]?_0x74054d['attributes']:_0x1be871[_0xed4a('0x44')];_0x74054d['order']=qs[_0xed4a('0x49')](_0x515665[_0xed4a('0x45')][_0xed4a('0x49')]);_0x74054d[_0xed4a('0x4a')]=qs[_0xed4a('0x4c')](_[_0xed4a('0x4b')](_0x515665[_0xed4a('0x45')],_0x1be871['filters']));if(_0x515665[_0xed4a('0x45')]['filter']){_0x74054d[_0xed4a('0x4a')]=_[_0xed4a('0x4f')](_0x74054d[_0xed4a('0x4a')],{'$or':_[_0xed4a('0x3f')](_0x74054d[_0xed4a('0x47')],function(_0x618759){var _0x51c1df={};_0x51c1df[_0x618759]={'$like':'%'+_0x515665[_0xed4a('0x45')]['filter']+'%'};return _0x51c1df;})});}_0x74054d=_[_0xed4a('0x4f')]({},_0x74054d,_0x515665[_0xed4a('0x50')]);return _0x15fbc7[_0xed4a('0xbd')](_0x74054d);}})[_0xed4a('0x21')](function(_0x332fa3){if(_0x332fa3){_0x10f96d=_0x332fa3[_0xed4a('0x59')];if(!_0x515665['query'][_0xed4a('0x61')]('nolimit')){_0x74054d[_0xed4a('0x2e')]=qs['limit'](_0x515665[_0xed4a('0x45')][_0xed4a('0x2e')]);_0x74054d['offset']=qs[_0xed4a('0x2d')](_0x515665[_0xed4a('0x45')][_0xed4a('0x2d')]);}return _0x15fbc7[_0xed4a('0xbd')](_0x74054d);}})[_0xed4a('0x21')](function(_0x4c79e7){if(_0x4c79e7){return _0x4c79e7?{'count':_0x10f96d,'rows':_0x4c79e7}:null;}})['then'](respondWithResult(_0x2bc9e2,null))[_0xed4a('0x2a')](handleError(_0x2bc9e2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6175f60..f481265 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 _0xd774=['setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailAccount'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0xd774,0x19b));var _0x4d77=function(_0x40292d,_0x53934d){_0x40292d=_0x40292d-0x0;var _0xa83cb4=_0xd774[_0x40292d];return _0xa83cb4;};'use strict';var EventEmitter=require(_0x4d77('0x0'));var MailAccount=require(_0x4d77('0x1'))['db'][_0x4d77('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4d77('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d77('0x4'),'afterDestroy':_0x4d77('0x5')};function emitEvent(_0x4604e7){return function(_0x120bac,_0x5481ee,_0x3543cb){MailAccountEvents[_0x4d77('0x6')](_0x4604e7+':'+_0x120bac['id'],_0x120bac);MailAccountEvents[_0x4d77('0x6')](_0x4604e7,_0x120bac);_0x3543cb(null);};}for(var e in events){if(events[_0x4d77('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x4d77('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x7801=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x31a296,_0xfc5c04){var _0x1f262b=function(_0x95ceed){while(--_0x95ceed){_0x31a296['push'](_0x31a296['shift']());}};_0x1f262b(++_0xfc5c04);}(_0x7801,0xa6));var _0x1780=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7801[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require(_0x1780('0x0'));var MailAccount=require(_0x1780('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1780('0x2')](0x0);var events={'afterCreate':_0x1780('0x3'),'afterUpdate':_0x1780('0x4'),'afterDestroy':_0x1780('0x5')};function emitEvent(_0x18c687){return function(_0x5b5652,_0xe8ee4,_0x153dc7){MailAccountEvents[_0x1780('0x6')](_0x18c687+':'+_0x5b5652['id'],_0x5b5652);MailAccountEvents[_0x1780('0x6')](_0x18c687,_0x5b5652);_0x153dc7(null);};}for(var e in events){if(events[_0x1780('0x7')](e)){var event=events[e];MailAccount[_0x1780('0x8')](e,emitEvent(event));}}module[_0x1780('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 0726acb..d10e7c2 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 _0x767e=['path','rimraf','../../config/environment','define','MailAccount','mail_accounts','lodash','util','api','request-promise'];(function(_0x4a3a87,_0x4f2e56){var _0x578976=function(_0x4e919f){while(--_0x4e919f){_0x4a3a87['push'](_0x4a3a87['shift']());}};_0x578976(++_0x4f2e56);}(_0x767e,0x9c));var _0xe767=function(_0x2438f9,_0x23e944){_0x2438f9=_0x2438f9-0x0;var _0x8152a1=_0x767e[_0x2438f9];return _0x8152a1;};'use strict';var _=require(_0xe767('0x0'));var util=require(_0xe767('0x1'));var logger=require('../../config/logger')(_0xe767('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe767('0x3'));var fs=require('fs');var path=require(_0xe767('0x4'));var rimraf=require(_0xe767('0x5'));var config=require(_0xe767('0x6'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x244403,_0x28228e){return _0x244403[_0xe767('0x7')](_0xe767('0x8'),attributes,{'tableName':_0xe767('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa53=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','./mailAccount.attributes','exports','define','MailAccount','mail_accounts'];(function(_0x198369,_0x2b6ee2){var _0x572169=function(_0x2ebf38){while(--_0x2ebf38){_0x198369['push'](_0x198369['shift']());}};_0x572169(++_0x2b6ee2);}(_0xaa53,0xb0));var _0x3aa5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaa53[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x3aa5('0x0'));var util=require(_0x3aa5('0x1'));var logger=require(_0x3aa5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3aa5('0x3'));var rp=require(_0x3aa5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3aa5('0x5'));var config=require('../../config/environment');var attributes=require(_0x3aa5('0x6'));module[_0x3aa5('0x7')]=function(_0x2c0962,_0xe00d41){return _0x2c0962[_0x3aa5('0x8')](_0x3aa5('0x9'),attributes,{'tableName':_0x3aa5('0xa'),'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 cdf9047..d20677c 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 _0xd64b=['startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','where','include','map','model','attributes','ShowMailAccount','body','mail','difference','rawAttributes','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','Smtp','omit','list','applications','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','interaction','get','created','attachments','originCc','Attachment','Attachments','UserId','name','waitForTheAssignedAgent','Start'];(function(_0x1497b4,_0x429cde){var _0x3db13d=function(_0x1a407c){while(--_0x1a407c){_0x1497b4['push'](_0x1497b4['shift']());}};_0x3db13d(++_0x429cde);}(_0xd64b,0xc1));var _0xbd64=function(_0x266703,_0x120c3b){_0x266703=_0x266703-0x0;var _0x37d275=_0xd64b[_0x266703];return _0x37d275;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var moment=require(_0xbd64('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd64('0x2'));var fs=require('fs');var Redis=require(_0xbd64('0x3'));var db=require(_0xbd64('0x4'))['db'];var utils=require(_0xbd64('0x5'));var logger=require(_0xbd64('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbd64('0x7')]({'port':0x232c});config[_0xbd64('0x8')]=_[_0xbd64('0x9')](config[_0xbd64('0x8')],{'host':_0xbd64('0xa'),'port':0x18eb});var socket=require(_0xbd64('0xb'))(new Redis(config[_0xbd64('0x8')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x40919e,_0xde7cc8,_0x1250be){return new BPromise(function(_0x4e1adb,_0xc80599){return client[_0xbd64('0xc')](_0x40919e,_0x1250be)[_0xbd64('0xd')](function(_0x18bde8){logger['info'](_0xbd64('0xe'),_0xde7cc8,'request\x20sent');logger[_0xbd64('0xf')](_0xbd64('0x10'),_0xde7cc8,_0xbd64('0x11'),JSON[_0xbd64('0x12')](_0x18bde8));if(_0x18bde8[_0xbd64('0x13')]){if(_0x18bde8[_0xbd64('0x13')][_0xbd64('0x14')]===0x1f4){logger[_0xbd64('0x13')](_0xbd64('0xe'),_0xde7cc8,_0x18bde8['error'][_0xbd64('0x15')]);return _0xc80599(_0x18bde8[_0xbd64('0x13')][_0xbd64('0x15')]);}logger[_0xbd64('0x13')](_0xbd64('0xe'),_0xde7cc8,_0x18bde8['error'][_0xbd64('0x15')]);return _0x4e1adb(_0x18bde8['error'][_0xbd64('0x15')]);}else{logger[_0xbd64('0x16')](_0xbd64('0xe'),_0xde7cc8,_0xbd64('0x11'));_0x4e1adb(_0x18bde8[_0xbd64('0x17')][_0xbd64('0x15')]);}})[_0xbd64('0x18')](function(_0x32c4c7){logger['error'](_0xbd64('0xe'),_0xde7cc8,_0x32c4c7);_0xc80599(_0x32c4c7);});});}exports[_0xbd64('0x19')]=function(_0x575b14){var _0x516158=this;return new Promise(function(_0xa4647f,_0x42b328){return db[_0xbd64('0x1a')][_0xbd64('0x1b')]({'raw':_0x575b14[_0xbd64('0x1c')]?_0x575b14[_0xbd64('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x575b14['options']?_0x575b14[_0xbd64('0x1c')][_0xbd64('0x1d')]||null:null,'attributes':_0x575b14[_0xbd64('0x1c')]?_0x575b14[_0xbd64('0x1c')]['attributes']||null:null,'limit':_0x575b14['options']?_0x575b14[_0xbd64('0x1c')]['limit']||null:null,'include':_0x575b14[_0xbd64('0x1c')]?_0x575b14['options'][_0xbd64('0x1e')]?_[_0xbd64('0x1f')](_0x575b14[_0xbd64('0x1c')][_0xbd64('0x1e')],function(_0x5ae417){return{'model':db[_0x5ae417[_0xbd64('0x20')]],'as':_0x5ae417['as'],'attributes':_0x5ae417[_0xbd64('0x21')],'include':_0x5ae417[_0xbd64('0x1e')]?_[_0xbd64('0x1f')](_0x5ae417['include'],function(_0x4e8719){return{'model':db[_0x4e8719[_0xbd64('0x20')]],'as':_0x4e8719['as'],'attributes':_0x4e8719['attributes'],'include':_0x4e8719['include']?_[_0xbd64('0x1f')](_0x4e8719['include'],function(_0x3cf5b7){return{'model':db[_0x3cf5b7['model']],'as':_0x3cf5b7['as'],'attributes':_0x3cf5b7[_0xbd64('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1db9f3){logger[_0xbd64('0x16')](_0xbd64('0x19'),_0x575b14);logger[_0xbd64('0xf')](_0xbd64('0x19'),_0x575b14,JSON[_0xbd64('0x12')](_0x1db9f3));_0xa4647f(_0x1db9f3);})['catch'](function(_0x35bdd5){logger[_0xbd64('0x13')](_0xbd64('0x19'),_0x35bdd5[_0xbd64('0x15')],_0x575b14);_0x42b328(_0x516158[_0xbd64('0x13')](0x1f4,_0x35bdd5[_0xbd64('0x15')]));});});};exports['ShowMailAccount']=function(_0x4c5961){var _0x1e4593=this;return new Promise(function(_0x576604,_0xebed78){return db[_0xbd64('0x1a')]['find']({'raw':_0x4c5961['options']?_0x4c5961[_0xbd64('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4c5961['options']?_0x4c5961[_0xbd64('0x1c')][_0xbd64('0x1d')]||null:null,'attributes':_0x4c5961[_0xbd64('0x1c')]?_0x4c5961['options'][_0xbd64('0x21')]||null:null,'include':_0x4c5961['options']?_0x4c5961[_0xbd64('0x1c')][_0xbd64('0x1e')]?_[_0xbd64('0x1f')](_0x4c5961[_0xbd64('0x1c')][_0xbd64('0x1e')],function(_0x429aec){return{'model':db[_0x429aec['model']],'as':_0x429aec['as'],'attributes':_0x429aec['attributes'],'include':_0x429aec[_0xbd64('0x1e')]?_[_0xbd64('0x1f')](_0x429aec[_0xbd64('0x1e')],function(_0xc5d971){return{'model':db[_0xc5d971[_0xbd64('0x20')]],'as':_0xc5d971['as'],'attributes':_0xc5d971[_0xbd64('0x21')],'include':_0xc5d971['include']?_['map'](_0xc5d971[_0xbd64('0x1e')],function(_0x1bcd4c){return{'model':db[_0x1bcd4c[_0xbd64('0x20')]],'as':_0x1bcd4c['as'],'attributes':_0x1bcd4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x300458){logger['info'](_0xbd64('0x22'),_0x4c5961);logger['debug'](_0xbd64('0x22'),_0x4c5961,JSON[_0xbd64('0x12')](_0x300458));_0x576604(_0x300458);})['catch'](function(_0x107da1){logger['error']('ShowMailAccount',_0x107da1[_0xbd64('0x15')],_0x4c5961);_0xebed78(_0x1e4593[_0xbd64('0x13')](0x1f4,_0x107da1[_0xbd64('0x15')]));});});};exports['NotifyMailAccount']=function(_0x540e2a){var _0x5d6bcf=this;return new Promise(function(_0x344d46,_0xbfd402){var _0x51d54b={'body':_0x540e2a[_0xbd64('0x23')],'channel':_0xbd64('0x24')};var _0x19832c=_[_0xbd64('0x25')](_['keys'](db['CmContact'][_0xbd64('0x26')]),['createdAt','updatedAt',_0xbd64('0x27'),_0xbd64('0x28')]);var _0x18c836=![];if(_0x540e2a[_0xbd64('0x23')]['id']){delete _0x540e2a[_0xbd64('0x23')]['id'];}if(_[_0xbd64('0x29')](_0x540e2a[_0xbd64('0x23')][_0xbd64('0x2a')])){return _0xbfd402(_0x5d6bcf['error'](0x1f4,_0xbd64('0x2b')));}if(_[_0xbd64('0x29')](_0x540e2a['body'][_0xbd64('0x23')])||_0x540e2a[_0xbd64('0x23')][_0xbd64('0x23')]===''){return _0xbfd402(_0x5d6bcf[_0xbd64('0x13')](0x1f4,_0xbd64('0x2c')));}if(_[_0xbd64('0x29')](_0x540e2a[_0xbd64('0x23')]['mapKey'])){return _0xbfd402(_0x5d6bcf[_0xbd64('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x19832c));}if(!_[_0xbd64('0x2d')](_0x19832c,_0x540e2a['body'][_0xbd64('0x2e')])){return _0xbfd402(_0x5d6bcf[_0xbd64('0x13')](0x1f4,_0xbd64('0x2f')+_0x19832c));}var _0x583860={};_0x583860[_0x540e2a[_0xbd64('0x23')]['mapKey']]=_0x540e2a['body']['from'];return db[_0xbd64('0x1a')][_0xbd64('0x30')]({'where':{'id':_0x540e2a[_0xbd64('0x31')]['id']},'include':[{'model':db[_0xbd64('0x32')],'as':_0xbd64('0x33'),'include':[{'model':db[_0xbd64('0x34')],'as':_0xbd64('0x35'),'where':_0x583860,'limit':0x1,'order':[['updatedAt',_0xbd64('0x36')]]}]},{'model':db[_0xbd64('0x37')],'as':_0xbd64('0x38')},{'model':db['MailServerOut'],'as':_0xbd64('0x39')}]})[_0xbd64('0xd')](function(_0x11cdd4){if(_0x11cdd4&&_0x11cdd4[_0xbd64('0x33')]){var _0x40f1bd=_0x11cdd4['get']({'plain':!![]});_0x51d54b[_0xbd64('0x31')]=_[_0xbd64('0x3a')](_0x40f1bd,[_0xbd64('0x38'),_0xbd64('0x33')]);_0x51d54b['applications']=_0x40f1bd['Applications'];_0x51d54b[_0xbd64('0x3b')]=_0x40f1bd[_0xbd64('0x33')];_0x51d54b[_0xbd64('0x3c')]=_[_0xbd64('0x3d')](_0x51d54b[_0xbd64('0x3c')],[_0xbd64('0x3e')],[_0xbd64('0x3f')]);if(_0x51d54b[_0xbd64('0x31')]&&_0x51d54b[_0xbd64('0x31')][_0xbd64('0x40')]){_0x51d54b[_0xbd64('0x3c')][_0xbd64('0x41')]({'id':0x0,'priority':_0x51d54b[_0xbd64('0x3c')][_0xbd64('0x42')]+0x1,'app':_0xbd64('0x43'),'appdata':'autoclose','interval':_0xbd64('0x44')});}if(_0x51d54b['account']['Applications']){delete _0x51d54b['account']['Applications'];}if(_0x51d54b[_0xbd64('0x31')][_0xbd64('0x33')]){delete _0x51d54b['account'][_0xbd64('0x33')];}if(_0x40f1bd[_0xbd64('0x33')][_0xbd64('0x35')]['length']){return _0x40f1bd[_0xbd64('0x33')][_0xbd64('0x35')][0x0];}var _0x44cd4f=_[_0xbd64('0x9')](_0x540e2a[_0xbd64('0x23')],{'firstName':_0x540e2a[_0xbd64('0x23')]['from'],'ListId':_0x40f1bd['ListId']});_0x44cd4f[_0x540e2a['body'][_0xbd64('0x2e')]]=_0x540e2a[_0xbd64('0x23')][_0xbd64('0x2a')];return db[_0xbd64('0x34')]['create'](_0x44cd4f);}else{throw new Error(_0xbd64('0x45'));}})[_0xbd64('0xd')](function(_0x28a433){_0x51d54b[_0xbd64('0x46')]=_0x28a433;if(_0x28a433){if(!_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')]['messageId']){_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x47')]=rs[_0xbd64('0x48')]()+'\x20'+_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x2a')];}var _0x3e0f82={'ContactId':_0x28a433['id'],'MailAccountId':_0x540e2a[_0xbd64('0x31')]['id'],'inReplyTo':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x47')],'to':_0x540e2a['body']['message'][_0xbd64('0x2a')],'cc':_0x540e2a[_0xbd64('0x23')]['message']['cc'],'subject':_0x540e2a['body'][_0xbd64('0x15')][_0xbd64('0x49')],'attach':_0x540e2a['body'][_0xbd64('0x15')][_0xbd64('0x4a')],'lastMsgAt':moment()[_0xbd64('0x4b')](_0xbd64('0x4c')),'lastMsgDirection':'in','lastMsgBody':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x23')]};return db[_0xbd64('0x4d')][_0xbd64('0x30')]({'where':{'closed':![],'MailAccountId':_0x540e2a[_0xbd64('0x31')]['id']},'include':[{'model':db['MailMessage'],'as':_0xbd64('0x4e'),'attributes':[_0xbd64('0x47')],'where':{'messageId':_0x540e2a[_0xbd64('0x23')]['message'][_0xbd64('0x4f')]}}]})[_0xbd64('0xd')](function(_0x4aa83e){if(_0x4aa83e){return[_0x4aa83e,![]];}return db[_0xbd64('0x4d')][_0xbd64('0x50')](_0x3e0f82)[_0xbd64('0xd')](function(_0x220603){return[_0x220603,!![]];});});}else{throw new Error(_0xbd64('0x51'));}})[_0xbd64('0x52')](function(_0x51ca88,_0x2c24c1){if(_0x51ca88){_0x18c836=_0x2c24c1;if(!_0x2c24c1){return _0x51ca88[_0xbd64('0x53')]({'inReplyTo':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')]['messageId'],'to':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')]['from'],'cc':_0x540e2a[_0xbd64('0x23')]['message']['cc'],'subject':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x49')],'attach':_0x51ca88[_0xbd64('0x4a')]?_0x51ca88['attach']:_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x4a')],'substatus':null,'substatusAt':moment()[_0xbd64('0x4b')](_0xbd64('0x4c')),'lastMsgAt':moment()[_0xbd64('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x540e2a['body']['body']});}else{return _0x51ca88;}}})[_0xbd64('0xd')](function(_0xd1b21f){_0x51d54b[_0xbd64('0x54')]=_0xd1b21f[_0xbd64('0x55')]({'plain':!![]});_0x51d54b[_0xbd64('0x54')][_0xbd64('0x56')]=_0x18c836;return db['MailMessage'][_0xbd64('0x50')]({'body':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x23')],'MailAccountId':_0x540e2a[_0xbd64('0x31')]['id'],'MailInteractionId':_0xd1b21f['id'],'direction':'in','ContactId':_0x51d54b[_0xbd64('0x46')]['id'],'messageId':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x47')],'from':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x2a')],'to':_0x540e2a[_0xbd64('0x23')]['message']['to'],'cc':_0x540e2a['body'][_0xbd64('0x15')]['cc'],'subject':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')]['subject'],'attach':_0x540e2a[_0xbd64('0x23')]['message'][_0xbd64('0x4a')],'Attachments':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x57')],'originTo':_0x540e2a['body'][_0xbd64('0x15')]['originTo'],'originCc':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')][_0xbd64('0x58')],'bcc':_0x540e2a[_0xbd64('0x23')][_0xbd64('0x15')]['bcc']},{'include':[{'model':db[_0xbd64('0x59')],'as':_0xbd64('0x5a')}]});})['then'](function(_0x2b95a0){_0x51d54b[_0xbd64('0x15')]=_0x2b95a0;if(_0x51d54b[_0xbd64('0x54')][_0xbd64('0x5b')]){return db['User'][_0xbd64('0x30')]({'attributes':['id','name'],'where':{'id':_0x51d54b[_0xbd64('0x54')][_0xbd64('0x5b')]}})[_0xbd64('0xd')](function(_0x4cb5bb){if(_0x4cb5bb){_0x51d54b['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4cb5bb[_0xbd64('0x5c')]+','+(_0x51d54b[_0xbd64('0x31')][_0xbd64('0x5d')]||0xa),'interval':_0xbd64('0x44')});}return respondWithRpcPromise(_0xbd64('0x5e'),'startRouting',_0x51d54b);});}return respondWithRpcPromise(_0xbd64('0x5e'),_0xbd64('0x5f'),_0x51d54b);})[_0xbd64('0xd')](function(_0x186946){_0x344d46(_0x186946);})[_0xbd64('0x18')](function(_0x524bf4){_0xbfd402(_0x5d6bcf[_0xbd64('0x13')](0x1f4,_0x524bf4[_0xbd64('0x15')]));});});}; \ No newline at end of file +var _0x342e=['create','spread','update','format','get','interaction','created','attachments','originCc','Attachment','Attachments','User','UserId','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailAccount.socket','register','request','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount,\x20%s,\x20%s','catch','GetMailAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','MailAccount','find','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','account','CmList','List','MailApplication','Smtp','Applications','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','Contacts','defaults','CmContact','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0x342e,0xde));var _0xe342=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x342e[_0x1b8b95];return _0x3657ae;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var moment=require(_0xe342('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe342('0x3'));var db=require(_0xe342('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe342('0x5'));var config=require(_0xe342('0x6'));var jayson=require(_0xe342('0x7'));var client=jayson[_0xe342('0x8')][_0xe342('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0xe342('0xa')],{'host':_0xe342('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe342('0xc'))[_0xe342('0xd')](socket);function respondWithRpcPromise(_0x29e365,_0x14dd6a,_0x1548a0){return new BPromise(function(_0x3748c5,_0x5d2918){return client[_0xe342('0xe')](_0x29e365,_0x1548a0)[_0xe342('0xf')](function(_0x3753b5){logger[_0xe342('0x10')]('MailAccount,\x20%s,\x20%s',_0x14dd6a,_0xe342('0x11'));logger['debug'](_0xe342('0x12'),_0x14dd6a,_0xe342('0x11'),JSON[_0xe342('0x13')](_0x3753b5));if(_0x3753b5[_0xe342('0x14')]){if(_0x3753b5['error'][_0xe342('0x15')]===0x1f4){logger[_0xe342('0x14')]('MailAccount,\x20%s,\x20%s',_0x14dd6a,_0x3753b5[_0xe342('0x14')][_0xe342('0x16')]);return _0x5d2918(_0x3753b5[_0xe342('0x14')][_0xe342('0x16')]);}logger[_0xe342('0x14')](_0xe342('0x17'),_0x14dd6a,_0x3753b5[_0xe342('0x14')][_0xe342('0x16')]);return _0x3748c5(_0x3753b5[_0xe342('0x14')][_0xe342('0x16')]);}else{logger[_0xe342('0x10')]('MailAccount,\x20%s,\x20%s',_0x14dd6a,_0xe342('0x11'));_0x3748c5(_0x3753b5['result']['message']);}})[_0xe342('0x18')](function(_0x46ccc7){logger[_0xe342('0x14')](_0xe342('0x17'),_0x14dd6a,_0x46ccc7);_0x5d2918(_0x46ccc7);});});}exports[_0xe342('0x19')]=function(_0x27adc8){var _0x113c4d=this;return new Promise(function(_0x10d53c,_0x420036){return db['MailAccount'][_0xe342('0x1a')]({'raw':_0x27adc8[_0xe342('0x1b')]?_0x27adc8['options'][_0xe342('0x1c')]===undefined?!![]:![]:!![],'where':_0x27adc8['options']?_0x27adc8[_0xe342('0x1b')][_0xe342('0x1d')]||null:null,'attributes':_0x27adc8[_0xe342('0x1b')]?_0x27adc8[_0xe342('0x1b')]['attributes']||null:null,'limit':_0x27adc8[_0xe342('0x1b')]?_0x27adc8[_0xe342('0x1b')][_0xe342('0x1e')]||null:null,'include':_0x27adc8['options']?_0x27adc8['options'][_0xe342('0x1f')]?_[_0xe342('0x20')](_0x27adc8['options'][_0xe342('0x1f')],function(_0x1a79ad){return{'model':db[_0x1a79ad[_0xe342('0x21')]],'as':_0x1a79ad['as'],'attributes':_0x1a79ad[_0xe342('0x22')],'include':_0x1a79ad[_0xe342('0x1f')]?_[_0xe342('0x20')](_0x1a79ad['include'],function(_0x36e28a){return{'model':db[_0x36e28a['model']],'as':_0x36e28a['as'],'attributes':_0x36e28a[_0xe342('0x22')],'include':_0x36e28a[_0xe342('0x1f')]?_['map'](_0x36e28a['include'],function(_0x1c7c97){return{'model':db[_0x1c7c97[_0xe342('0x21')]],'as':_0x1c7c97['as'],'attributes':_0x1c7c97[_0xe342('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe342('0xf')](function(_0xe98f71){logger[_0xe342('0x10')](_0xe342('0x19'),_0x27adc8);logger[_0xe342('0x23')](_0xe342('0x19'),_0x27adc8,JSON[_0xe342('0x13')](_0xe98f71));_0x10d53c(_0xe98f71);})['catch'](function(_0x368e45){logger[_0xe342('0x14')](_0xe342('0x19'),_0x368e45['message'],_0x27adc8);_0x420036(_0x113c4d['error'](0x1f4,_0x368e45[_0xe342('0x16')]));});});};exports['ShowMailAccount']=function(_0x25b958){var _0x25ae01=this;return new Promise(function(_0x42088a,_0x1c49f8){return db[_0xe342('0x24')][_0xe342('0x25')]({'raw':_0x25b958[_0xe342('0x1b')]?_0x25b958[_0xe342('0x1b')][_0xe342('0x1c')]===undefined?!![]:![]:!![],'where':_0x25b958[_0xe342('0x1b')]?_0x25b958[_0xe342('0x1b')][_0xe342('0x1d')]||null:null,'attributes':_0x25b958['options']?_0x25b958[_0xe342('0x1b')][_0xe342('0x22')]||null:null,'include':_0x25b958[_0xe342('0x1b')]?_0x25b958['options']['include']?_[_0xe342('0x20')](_0x25b958[_0xe342('0x1b')]['include'],function(_0xa002ca){return{'model':db[_0xa002ca[_0xe342('0x21')]],'as':_0xa002ca['as'],'attributes':_0xa002ca[_0xe342('0x22')],'include':_0xa002ca[_0xe342('0x1f')]?_[_0xe342('0x20')](_0xa002ca[_0xe342('0x1f')],function(_0x5e479f){return{'model':db[_0x5e479f[_0xe342('0x21')]],'as':_0x5e479f['as'],'attributes':_0x5e479f[_0xe342('0x22')],'include':_0x5e479f['include']?_[_0xe342('0x20')](_0x5e479f['include'],function(_0x2000b5){return{'model':db[_0x2000b5[_0xe342('0x21')]],'as':_0x2000b5['as'],'attributes':_0x2000b5[_0xe342('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe342('0xf')](function(_0x3a68a7){logger[_0xe342('0x10')](_0xe342('0x26'),_0x25b958);logger['debug'](_0xe342('0x26'),_0x25b958,JSON[_0xe342('0x13')](_0x3a68a7));_0x42088a(_0x3a68a7);})[_0xe342('0x18')](function(_0x969c5){logger[_0xe342('0x14')]('ShowMailAccount',_0x969c5['message'],_0x25b958);_0x1c49f8(_0x25ae01[_0xe342('0x14')](0x1f4,_0x969c5[_0xe342('0x16')]));});});};exports[_0xe342('0x27')]=function(_0x511868){var _0xf126f0=this;return new Promise(function(_0x41efbb,_0x520a51){var _0x597707={'body':_0x511868[_0xe342('0x28')],'channel':_0xe342('0x29')};var _0x4e43a0=_[_0xe342('0x2a')](_[_0xe342('0x2b')](db['CmContact'][_0xe342('0x2c')]),[_0xe342('0x2d'),_0xe342('0x2e'),_0xe342('0x2f'),_0xe342('0x30')]);var _0x54a53b=![];if(_0x511868['body']['id']){delete _0x511868[_0xe342('0x28')]['id'];}if(_['isNil'](_0x511868['body'][_0xe342('0x31')])){return _0x520a51(_0xf126f0['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe342('0x32')](_0x511868[_0xe342('0x28')][_0xe342('0x28')])||_0x511868['body'][_0xe342('0x28')]===''){return _0x520a51(_0xf126f0['error'](0x1f4,_0xe342('0x33')));}if(_['isNil'](_0x511868[_0xe342('0x28')]['mapKey'])){return _0x520a51(_0xf126f0[_0xe342('0x14')](0x1f4,_0xe342('0x34')+_0x4e43a0));}if(!_[_0xe342('0x35')](_0x4e43a0,_0x511868[_0xe342('0x28')][_0xe342('0x36')])){return _0x520a51(_0xf126f0[_0xe342('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e43a0));}var _0x12bf3a={};_0x12bf3a[_0x511868['body']['mapKey']]=_0x511868[_0xe342('0x28')]['from'];return db[_0xe342('0x24')][_0xe342('0x25')]({'where':{'id':_0x511868[_0xe342('0x37')]['id']},'include':[{'model':db[_0xe342('0x38')],'as':_0xe342('0x39'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x12bf3a,'limit':0x1,'order':[[_0xe342('0x2e'),'DESC']]}]},{'model':db[_0xe342('0x3a')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xe342('0x3b')}]})[_0xe342('0xf')](function(_0x375134){if(_0x375134&&_0x375134[_0xe342('0x39')]){var _0x4ade30=_0x375134['get']({'plain':!![]});_0x597707['account']=_['omit'](_0x4ade30,[_0xe342('0x3c'),'List']);_0x597707[_0xe342('0x3d')]=_0x4ade30[_0xe342('0x3c')];_0x597707[_0xe342('0x3e')]=_0x4ade30[_0xe342('0x39')];_0x597707[_0xe342('0x3d')]=_[_0xe342('0x3f')](_0x597707['applications'],[_0xe342('0x40')],['asc']);if(_0x597707[_0xe342('0x37')]&&_0x597707[_0xe342('0x37')][_0xe342('0x41')]){_0x597707[_0xe342('0x3d')][_0xe342('0x42')]({'id':0x0,'priority':_0x597707['applications'][_0xe342('0x43')]+0x1,'app':_0xe342('0x44'),'appdata':_0xe342('0x41'),'interval':_0xe342('0x45')});}if(_0x597707[_0xe342('0x37')][_0xe342('0x3c')]){delete _0x597707['account']['Applications'];}if(_0x597707[_0xe342('0x37')][_0xe342('0x39')]){delete _0x597707[_0xe342('0x37')][_0xe342('0x39')];}if(_0x4ade30[_0xe342('0x39')]['Contacts'][_0xe342('0x43')]){return _0x4ade30[_0xe342('0x39')][_0xe342('0x46')][0x0];}var _0x505574=_[_0xe342('0x47')](_0x511868[_0xe342('0x28')],{'firstName':_0x511868[_0xe342('0x28')]['from'],'ListId':_0x4ade30[_0xe342('0x30')]});_0x505574[_0x511868['body']['mapKey']]=_0x511868[_0xe342('0x28')]['from'];return db[_0xe342('0x48')]['create'](_0x505574);}else{throw new Error(_0xe342('0x49'));}})[_0xe342('0xf')](function(_0x327f97){_0x597707[_0xe342('0x4a')]=_0x327f97;if(_0x327f97){if(!_0x511868['body'][_0xe342('0x16')][_0xe342('0x4b')]){_0x511868['body'][_0xe342('0x16')]['messageId']=rs[_0xe342('0x4c')]()+'\x20'+_0x511868['body'][_0xe342('0x16')]['from'];}var _0x1ff1c6={'ContactId':_0x327f97['id'],'MailAccountId':_0x511868[_0xe342('0x37')]['id'],'inReplyTo':_0x511868[_0xe342('0x28')]['message'][_0xe342('0x4b')],'to':_0x511868[_0xe342('0x28')][_0xe342('0x16')][_0xe342('0x31')],'cc':_0x511868[_0xe342('0x28')]['message']['cc'],'subject':_0x511868[_0xe342('0x28')][_0xe342('0x16')][_0xe342('0x4d')],'attach':_0x511868['body'][_0xe342('0x16')][_0xe342('0x4e')],'lastMsgAt':moment()['format'](_0xe342('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x511868[_0xe342('0x28')][_0xe342('0x28')]};return db[_0xe342('0x50')][_0xe342('0x25')]({'where':{'closed':![],'MailAccountId':_0x511868[_0xe342('0x37')]['id']},'include':[{'model':db[_0xe342('0x51')],'as':_0xe342('0x52'),'attributes':[_0xe342('0x4b')],'where':{'messageId':_0x511868[_0xe342('0x28')][_0xe342('0x16')][_0xe342('0x53')]}}]})['then'](function(_0x5a4471){if(_0x5a4471){return[_0x5a4471,![]];}return db[_0xe342('0x50')][_0xe342('0x54')](_0x1ff1c6)[_0xe342('0xf')](function(_0x49c643){return[_0x49c643,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xe342('0x55')](function(_0x42a0cc,_0x51ac64){if(_0x42a0cc){_0x54a53b=_0x51ac64;if(!_0x51ac64){return _0x42a0cc[_0xe342('0x56')]({'inReplyTo':_0x511868[_0xe342('0x28')]['message'][_0xe342('0x4b')],'to':_0x511868[_0xe342('0x28')][_0xe342('0x16')][_0xe342('0x31')],'cc':_0x511868[_0xe342('0x28')]['message']['cc'],'subject':_0x511868[_0xe342('0x28')][_0xe342('0x16')][_0xe342('0x4d')],'attach':_0x42a0cc[_0xe342('0x4e')]?_0x42a0cc[_0xe342('0x4e')]:_0x511868['body'][_0xe342('0x16')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0xe342('0x4f')),'lastMsgAt':moment()[_0xe342('0x57')](_0xe342('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x511868['body'][_0xe342('0x28')]});}else{return _0x42a0cc;}}})[_0xe342('0xf')](function(_0x43cc18){_0x597707['interaction']=_0x43cc18[_0xe342('0x58')]({'plain':!![]});_0x597707[_0xe342('0x59')][_0xe342('0x5a')]=_0x54a53b;return db['MailMessage'][_0xe342('0x54')]({'body':_0x511868['body'][_0xe342('0x28')],'MailAccountId':_0x511868['account']['id'],'MailInteractionId':_0x43cc18['id'],'direction':'in','ContactId':_0x597707['contact']['id'],'messageId':_0x511868[_0xe342('0x28')][_0xe342('0x16')][_0xe342('0x4b')],'from':_0x511868[_0xe342('0x28')][_0xe342('0x16')]['from'],'to':_0x511868[_0xe342('0x28')]['message']['to'],'cc':_0x511868['body'][_0xe342('0x16')]['cc'],'subject':_0x511868[_0xe342('0x28')][_0xe342('0x16')][_0xe342('0x4d')],'attach':_0x511868['body'][_0xe342('0x16')][_0xe342('0x4e')],'Attachments':_0x511868[_0xe342('0x28')][_0xe342('0x16')][_0xe342('0x5b')],'originTo':_0x511868[_0xe342('0x28')]['message']['originTo'],'originCc':_0x511868[_0xe342('0x28')]['message'][_0xe342('0x5c')],'bcc':_0x511868[_0xe342('0x28')]['message']['bcc']},{'include':[{'model':db[_0xe342('0x5d')],'as':_0xe342('0x5e')}]});})[_0xe342('0xf')](function(_0x115747){_0x597707[_0xe342('0x16')]=_0x115747;if(_0x597707[_0xe342('0x59')]['UserId']){return db[_0xe342('0x5f')][_0xe342('0x25')]({'attributes':['id','name'],'where':{'id':_0x597707['interaction'][_0xe342('0x60')]}})['then'](function(_0x53a213){if(_0x53a213){_0x597707[_0xe342('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe342('0x61'),'appdata':_0x53a213[_0xe342('0x62')]+','+(_0x597707['account'][_0xe342('0x63')]||0xa),'interval':_0xe342('0x45')});}return respondWithRpcPromise(_0xe342('0x64'),'startRouting',_0x597707);});}return respondWithRpcPromise('Start',_0xe342('0x65'),_0x597707);})[_0xe342('0xf')](function(_0x49db0b){_0x41efbb(_0x49db0b);})[_0xe342('0x18')](function(_0x3f4e0c){_0x520a51(_0xf126f0[_0xe342('0x14')](0x1f4,_0x3f4e0c[_0xe342('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5ad744f..c00a1cc 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 _0x0f4d=['update','emit','removeListener','register','length','mailAccount:'];(function(_0x3da295,_0xf4760b){var _0x280ab1=function(_0x3304f3){while(--_0x3304f3){_0x3da295['push'](_0x3da295['shift']());}};_0x280ab1(++_0xf4760b);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x211132,_0x44d523){_0x211132=_0x211132-0x0;var _0x3b3dd3=_0x0f4d[_0x211132];return _0x3b3dd3;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save','remove',_0xd0f4('0x0')];function createListener(_0x5c8510,_0x20e395){return function(_0x2c06de){_0x20e395[_0xd0f4('0x1')](_0x5c8510,_0x2c06de);};}function removeListener(_0x347170,_0x1a9ba5){return function(){MailAccountEvents[_0xd0f4('0x2')](_0x347170,_0x1a9ba5);};}exports[_0xd0f4('0x3')]=function(_0x1d9a9d){for(var _0x531f85=0x0,_0x1164da=events[_0xd0f4('0x4')];_0x531f85<_0x1164da;_0x531f85++){var _0x4d0ab0=events[_0x531f85];var _0x3992be=createListener(_0xd0f4('0x5')+_0x4d0ab0,_0x1d9a9d);MailAccountEvents['on'](_0x4d0ab0,_0x3992be);}}; \ No newline at end of file +var _0x960c=['remove','mailAccount:','./mailAccount.events'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x960c,0x113));var _0xc960=function(_0x15dbb9,_0x5823ea){_0x15dbb9=_0x15dbb9-0x0;var _0x387cb3=_0x960c[_0x15dbb9];return _0x387cb3;};'use strict';var MailAccountEvents=require(_0xc960('0x0'));var events=['save',_0xc960('0x1'),'update'];function createListener(_0x39a88a,_0x3334e7){return function(_0x265faf){_0x3334e7['emit'](_0x39a88a,_0x265faf);};}function removeListener(_0x1b54d7,_0x3ff69d){return function(){MailAccountEvents['removeListener'](_0x1b54d7,_0x3ff69d);};}exports['register']=function(_0x2bb9df){for(var _0x2beb88=0x0,_0x2cd4c9=events['length'];_0x2beb88<_0x2cd4c9;_0x2beb88++){var _0x513f9c=events[_0x2beb88];var _0x2934b2=createListener(_0xc960('0x2')+_0x513f9c,_0x2bb9df);MailAccountEvents['on'](_0x513f9c,_0x2934b2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f504bf8..033e03c 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 _0x0102=['isAuthenticated','show','update','delete','destroy','exports','util','path','connect-timeout','express','get','/:id'];(function(_0x478bad,_0x350f03){var _0x2e8c4a=function(_0x2b054f){while(--_0x2b054f){_0x478bad['push'](_0x478bad['shift']());}};_0x2e8c4a(++_0x350f03);}(_0x0102,0x186));var _0x2010=function(_0x4e3292,_0x20f8ad){_0x4e3292=_0x4e3292-0x0;var _0x44e622=_0x0102[_0x4e3292];return _0x44e622;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x2010('0x4')](_0x2010('0x5'),auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['put'](_0x2010('0x5'),auth['isAuthenticated'](),controller[_0x2010('0x8')]);router[_0x2010('0x9')]('/:id',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);module[_0x2010('0xb')]=router; \ No newline at end of file +var _0xb9be=['show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb9be,0xc5));var _0xeb9b=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0xb9be[_0x4eafed];return _0x159c85;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var auth=require(_0xeb9b('0x6'));var interaction=require(_0xeb9b('0x7'));var config=require(_0xeb9b('0x8'));var controller=require('./mailApplication.controller');router['get'](_0xeb9b('0x9'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xb')]);router['put'](_0xeb9b('0x9'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xc')]);router[_0xeb9b('0xd')](_0xeb9b('0x9'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xe')]);module[_0xeb9b('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index d6dc765..bf2b9b3 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 _0xa25d=['STRING','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x1d178c,_0x51f561){var _0x42539c=function(_0x272ed6){while(--_0x272ed6){_0x1d178c['push'](_0x1d178c['shift']());}};_0x42539c(++_0x51f561);}(_0xa25d,0x18d));var _0xda25=function(_0xa37892,_0x40cf01){_0xa37892=_0xa37892-0x0;var _0x45e007=_0xa25d[_0xa37892];return _0x45e007;};'use strict';var Sequelize=require(_0xda25('0x0'));module[_0xda25('0x1')]={'priority':{'type':Sequelize[_0xda25('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xda25('0x3')},'appdata':{'type':Sequelize[_0xda25('0x4')]()},'description':{'type':Sequelize[_0xda25('0x5')]},'interval':{'type':Sequelize[_0xda25('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4d20=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1a86d9,_0x4c0010){var _0x21e407=function(_0x55f9ca){while(--_0x55f9ca){_0x1a86d9['push'](_0x1a86d9['shift']());}};_0x21e407(++_0x4c0010);}(_0x4d20,0x168));var _0x04d2=function(_0x368fd4,_0x81573a){_0x368fd4=_0x368fd4-0x0;var _0x231abc=_0x4d20[_0x368fd4];return _0x231abc;};'use strict';var Sequelize=require(_0x04d2('0x0'));module[_0x04d2('0x1')]={'priority':{'type':Sequelize[_0x04d2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x04d2('0x3')],'allowNull':![],'defaultValue':_0x04d2('0x4')},'appdata':{'type':Sequelize[_0x04d2('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x04d2('0x3')],'defaultValue':_0x04d2('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 16083f4..4ebcd28 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 _0x3079=['model','attributes','intersection','fields','query','length','includeAll','include','find','catch','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','reject','save','then','destroy','end','error','name','send','show','params','keys','MailApplication','rawAttributes'];(function(_0x4b94fb,_0x128173){var _0x460242=function(_0x3fa5de){while(--_0x3fa5de){_0x4b94fb['push'](_0x4b94fb['shift']());}};_0x460242(++_0x128173);}(_0x3079,0x110));var _0x9307=function(_0x33155a,_0x5407f7){_0x33155a=_0x33155a-0x0;var _0x4e3365=_0x3079[_0x33155a];return _0x4e3365;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9307('0x0'));var rimraf=require(_0x9307('0x1'));var zipdir=require(_0x9307('0x2'));var jsonpatch=require(_0x9307('0x3'));var rp=require('request-promise');var moment=require(_0x9307('0x4'));var BPromise=require(_0x9307('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9307('0x6'));var sox=require(_0x9307('0x7'));var csv=require(_0x9307('0x8'));var ejs=require(_0x9307('0x9'));var fs=require('fs');var _=require(_0x9307('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9307('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9307('0x8'));var querystring=require(_0x9307('0xc'));var Papa=require('papaparse');var Redis=require(_0x9307('0xd'));var authService=require(_0x9307('0xe'));var qs=require(_0x9307('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9307('0x10'))(_0x9307('0x11'));var utils=require(_0x9307('0x12'));var config=require(_0x9307('0x13'));var db=require(_0x9307('0x14'))['db'];function respondWithStatusCode(_0x27eb49,_0x4bc72d){_0x4bc72d=_0x4bc72d||0xcc;return function(_0x2bab66){if(_0x2bab66){return _0x27eb49[_0x9307('0x15')](_0x4bc72d);}return _0x27eb49['status'](_0x4bc72d)['end']();};}function respondWithResult(_0x13936d,_0x3d3671){_0x3d3671=_0x3d3671||0xc8;return function(_0x4a7e80){if(_0x4a7e80){return _0x13936d[_0x9307('0x16')](_0x3d3671)[_0x9307('0x17')](_0x4a7e80);}};}function respondWithFilteredResult(_0x545b0a,_0x108830){return function(_0x231bba){if(_0x231bba){var _0x4e79f7=_0x231bba['count'],_0x3fc6fd=_0x108830[_0x9307('0x18')],_0x4296e9=_0x108830[_0x9307('0x18')]+_0x108830['limit'],_0x100f15;if(_0x4296e9>=_0x4e79f7){_0x4296e9=_0x4e79f7;_0x100f15=0xc8;}else{_0x100f15=0xce;}_0x545b0a[_0x9307('0x16')](_0x100f15);return _0x545b0a[_0x9307('0x19')](_0x9307('0x1a'),_0x3fc6fd+'-'+_0x4296e9+'/'+_0x4e79f7)[_0x9307('0x17')](_0x231bba);}return null;};}function patchUpdates(_0x16a061){return function(_0x336e35){try{jsonpatch['apply'](_0x336e35,_0x16a061,!![]);}catch(_0x22c2f){return BPromise[_0x9307('0x1b')](_0x22c2f);}return _0x336e35[_0x9307('0x1c')]();};}function saveUpdates(_0x58574e,_0x2f35c7){return function(_0x3a139e){if(_0x3a139e){return _0x3a139e['update'](_0x58574e)[_0x9307('0x1d')](function(_0x4c7f62){return _0x4c7f62;});}return null;};}function removeEntity(_0x256e8c,_0x39bbcc){return function(_0x15e7c4){if(_0x15e7c4){return _0x15e7c4[_0x9307('0x1e')]()[_0x9307('0x1d')](function(){_0x256e8c[_0x9307('0x16')](0xcc)[_0x9307('0x1f')]();});}};}function handleEntityNotFound(_0x29b0c2,_0x3241d9){return function(_0x5d42a0){if(!_0x5d42a0){_0x29b0c2[_0x9307('0x15')](0x194);}return _0x5d42a0;};}function handleError(_0x593f27,_0x8f25b){_0x8f25b=_0x8f25b||0x1f4;return function(_0x56225a){logger[_0x9307('0x20')](_0x56225a['stack']);if(_0x56225a['name']){delete _0x56225a[_0x9307('0x21')];}_0x593f27[_0x9307('0x16')](_0x8f25b)[_0x9307('0x22')](_0x56225a);};}exports[_0x9307('0x23')]=function(_0x3b184b,_0xd89e2f){var _0x15145d={'raw':!![],'where':{'id':_0x3b184b[_0x9307('0x24')]['id']}},_0x5927ce={};_0x5927ce['model']=_[_0x9307('0x25')](db[_0x9307('0x26')][_0x9307('0x27')]);_0x5927ce['query']=_[_0x9307('0x25')](_0x3b184b['query']);_0x5927ce['filters']=_['intersection'](_0x5927ce[_0x9307('0x28')],_0x5927ce['query']);_0x15145d[_0x9307('0x29')]=_[_0x9307('0x2a')](_0x5927ce[_0x9307('0x28')],qs[_0x9307('0x2b')](_0x3b184b[_0x9307('0x2c')][_0x9307('0x2b')]));_0x15145d['attributes']=_0x15145d[_0x9307('0x29')][_0x9307('0x2d')]?_0x15145d[_0x9307('0x29')]:_0x5927ce[_0x9307('0x28')];if(_0x3b184b[_0x9307('0x2c')][_0x9307('0x2e')]){_0x15145d[_0x9307('0x2f')]=[{'all':!![]}];}_0x15145d=_['merge']({},_0x15145d,_0x3b184b['options']);return db[_0x9307('0x26')][_0x9307('0x30')](_0x15145d)[_0x9307('0x1d')](handleEntityNotFound(_0xd89e2f,null))[_0x9307('0x1d')](respondWithResult(_0xd89e2f,null))[_0x9307('0x31')](handleError(_0xd89e2f,null));};exports[_0x9307('0x32')]=function(_0x409733,_0x139c45){if(_0x409733[_0x9307('0x33')]['id']){delete _0x409733[_0x9307('0x33')]['id'];}return db['MailApplication'][_0x9307('0x30')]({'where':{'id':_0x409733[_0x9307('0x24')]['id']}})[_0x9307('0x1d')](handleEntityNotFound(_0x139c45,null))[_0x9307('0x1d')](saveUpdates(_0x409733[_0x9307('0x33')],null))[_0x9307('0x1d')](respondWithResult(_0x139c45,null))[_0x9307('0x31')](handleError(_0x139c45,null));};exports[_0x9307('0x1e')]=function(_0x304983,_0x461350){return db[_0x9307('0x26')][_0x9307('0x30')]({'where':{'id':_0x304983[_0x9307('0x24')]['id']}})[_0x9307('0x1d')](handleEntityNotFound(_0x461350,null))['then'](removeEntity(_0x461350,null))[_0x9307('0x31')](handleError(_0x461350,null));}; \ No newline at end of file +var _0x6568=['params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6568,0x1e2));var _0x8656=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x6568[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require(_0x8656('0x0'));var emlformat=require(_0x8656('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8656('0x2'));var jsonpatch=require(_0x8656('0x3'));var rp=require('request-promise');var moment=require(_0x8656('0x4'));var BPromise=require(_0x8656('0x5'));var Mustache=require(_0x8656('0x6'));var util=require(_0x8656('0x7'));var path=require('path');var sox=require(_0x8656('0x8'));var csv=require(_0x8656('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8656('0xa'));var squel=require(_0x8656('0xb'));var crypto=require(_0x8656('0xc'));var jsforce=require(_0x8656('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8656('0xe'));var Papa=require(_0x8656('0xf'));var Redis=require(_0x8656('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8656('0x11'));var as=require(_0x8656('0x12'));var hardwareService=require(_0x8656('0x13'));var logger=require('../../config/logger')(_0x8656('0x14'));var utils=require('../../config/utils');var config=require(_0x8656('0x15'));var db=require(_0x8656('0x16'))['db'];function respondWithStatusCode(_0x2c3aa9,_0x576470){_0x576470=_0x576470||0xcc;return function(_0x1d3550){if(_0x1d3550){return _0x2c3aa9[_0x8656('0x17')](_0x576470);}return _0x2c3aa9[_0x8656('0x18')](_0x576470)['end']();};}function respondWithResult(_0x180fd3,_0x4a8560){_0x4a8560=_0x4a8560||0xc8;return function(_0x3df47d){if(_0x3df47d){return _0x180fd3[_0x8656('0x18')](_0x4a8560)[_0x8656('0x19')](_0x3df47d);}};}function respondWithFilteredResult(_0x17c49a,_0x344e91){return function(_0x2c9d48){if(_0x2c9d48){var _0x3dfe57=_0x2c9d48[_0x8656('0x1a')],_0x5ce2ce=_0x344e91[_0x8656('0x1b')],_0x182ee2=_0x344e91[_0x8656('0x1b')]+_0x344e91['limit'],_0x1dc7d4;if(_0x182ee2>=_0x3dfe57){_0x182ee2=_0x3dfe57;_0x1dc7d4=0xc8;}else{_0x1dc7d4=0xce;}_0x17c49a[_0x8656('0x18')](_0x1dc7d4);return _0x17c49a[_0x8656('0x1c')](_0x8656('0x1d'),_0x5ce2ce+'-'+_0x182ee2+'/'+_0x3dfe57)[_0x8656('0x19')](_0x2c9d48);}return null;};}function patchUpdates(_0x297dc9){return function(_0x38223e){try{jsonpatch[_0x8656('0x1e')](_0x38223e,_0x297dc9,!![]);}catch(_0x1a065f){return BPromise[_0x8656('0x1f')](_0x1a065f);}return _0x38223e[_0x8656('0x20')]();};}function saveUpdates(_0x3d1234,_0x26095c){return function(_0xbe4776){if(_0xbe4776){return _0xbe4776[_0x8656('0x21')](_0x3d1234)['then'](function(_0x31d351){return _0x31d351;});}return null;};}function removeEntity(_0x5acb5a,_0x3dc898){return function(_0x3c8573){if(_0x3c8573){return _0x3c8573[_0x8656('0x22')]()[_0x8656('0x23')](function(){_0x5acb5a[_0x8656('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d9642,_0x402ced){return function(_0x40fd00){if(!_0x40fd00){_0x7d9642[_0x8656('0x17')](0x194);}return _0x40fd00;};}function handleError(_0x43d2a0,_0x489223){_0x489223=_0x489223||0x1f4;return function(_0x4977e2){logger[_0x8656('0x24')](_0x4977e2[_0x8656('0x25')]);if(_0x4977e2[_0x8656('0x26')]){delete _0x4977e2[_0x8656('0x26')];}_0x43d2a0['status'](_0x489223)['send'](_0x4977e2);};}exports[_0x8656('0x27')]=function(_0x3fdedf,_0x31fe77){var _0x2ebd4d={'raw':!![],'where':{'id':_0x3fdedf[_0x8656('0x28')]['id']}},_0x4f9525={};_0x4f9525[_0x8656('0x29')]=_['keys'](db[_0x8656('0x2a')][_0x8656('0x2b')]);_0x4f9525[_0x8656('0x2c')]=_[_0x8656('0x2d')](_0x3fdedf[_0x8656('0x2c')]);_0x4f9525[_0x8656('0x2e')]=_[_0x8656('0x2f')](_0x4f9525[_0x8656('0x29')],_0x4f9525[_0x8656('0x2c')]);_0x2ebd4d[_0x8656('0x30')]=_[_0x8656('0x2f')](_0x4f9525[_0x8656('0x29')],qs[_0x8656('0x31')](_0x3fdedf[_0x8656('0x2c')]['fields']));_0x2ebd4d[_0x8656('0x30')]=_0x2ebd4d[_0x8656('0x30')][_0x8656('0x32')]?_0x2ebd4d[_0x8656('0x30')]:_0x4f9525['model'];if(_0x3fdedf['query'][_0x8656('0x33')]){_0x2ebd4d[_0x8656('0x34')]=[{'all':!![]}];}_0x2ebd4d=_[_0x8656('0x35')]({},_0x2ebd4d,_0x3fdedf[_0x8656('0x36')]);return db[_0x8656('0x2a')][_0x8656('0x37')](_0x2ebd4d)[_0x8656('0x23')](handleEntityNotFound(_0x31fe77,null))['then'](respondWithResult(_0x31fe77,null))[_0x8656('0x38')](handleError(_0x31fe77,null));};exports[_0x8656('0x21')]=function(_0xf093d0,_0x38512b){if(_0xf093d0['body']['id']){delete _0xf093d0[_0x8656('0x39')]['id'];}return db['MailApplication'][_0x8656('0x37')]({'where':{'id':_0xf093d0['params']['id']}})[_0x8656('0x23')](handleEntityNotFound(_0x38512b,null))[_0x8656('0x23')](saveUpdates(_0xf093d0[_0x8656('0x39')],null))['then'](respondWithResult(_0x38512b,null))[_0x8656('0x38')](handleError(_0x38512b,null));};exports['destroy']=function(_0x3aa819,_0x2ead3b){return db[_0x8656('0x2a')][_0x8656('0x37')]({'where':{'id':_0x3aa819[_0x8656('0x28')]['id']}})[_0x8656('0x23')](handleEntityNotFound(_0x2ead3b,null))[_0x8656('0x23')](removeEntity(_0x2ead3b,null))[_0x8656('0x38')](handleError(_0x2ead3b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f34ab24..410ec40 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 _0x20de=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x20de,0x134));var _0xe20d=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x20de[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xe20d('0x0'));var util=require('util');var logger=require(_0xe20d('0x1'))(_0xe20d('0x2'));var moment=require(_0xe20d('0x3'));var BPromise=require(_0xe20d('0x4'));var rp=require(_0xe20d('0x5'));var fs=require('fs');var path=require(_0xe20d('0x6'));var rimraf=require(_0xe20d('0x7'));var config=require(_0xe20d('0x8'));var attributes=require(_0xe20d('0x9'));module[_0xe20d('0xa')]=function(_0x53f711,_0x5a8622){return _0x53f711[_0xe20d('0xb')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe20d('0xc')});}; \ No newline at end of file +var _0xc5df=['rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','../../config/logger','api','request-promise','path'];(function(_0x5a6a1c,_0xb802eb){var _0x132a0e=function(_0x4c3280){while(--_0x4c3280){_0x5a6a1c['push'](_0x5a6a1c['shift']());}};_0x132a0e(++_0xb802eb);}(_0xc5df,0x80));var _0xfc5d=function(_0x59bdfb,_0xcbf640){_0x59bdfb=_0x59bdfb-0x0;var _0xddaa8b=_0xc5df[_0x59bdfb];return _0xddaa8b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc5d('0x0'))(_0xfc5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc5d('0x2'));var fs=require('fs');var path=require(_0xfc5d('0x3'));var rimraf=require(_0xfc5d('0x4'));var config=require(_0xfc5d('0x5'));var attributes=require(_0xfc5d('0x6'));module['exports']=function(_0x1c8057,_0x2df24e){return _0x1c8057[_0xfc5d('0x7')](_0xfc5d('0x8'),attributes,{'tableName':_0xfc5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfc5d('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 508c182..f7f05df 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 _0xea32=['body','options','where','attributes','limit','UpdateMailApplication','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailApplication','update'];(function(_0x45ce19,_0x29b17d){var _0xb01551=function(_0x4ae7a0){while(--_0x4ae7a0){_0x45ce19['push'](_0x45ce19['shift']());}};_0xb01551(++_0x29b17d);}(_0xea32,0xb5));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2ea3('0x0'));var util=require(_0x2ea3('0x1'));var moment=require('moment');var BPromise=require(_0x2ea3('0x2'));var rs=require(_0x2ea3('0x3'));var fs=require('fs');var Redis=require(_0x2ea3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2ea3('0x5'))('rpc');var config=require(_0x2ea3('0x6'));var jayson=require(_0x2ea3('0x7'));var client=jayson['client'][_0x2ea3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c9f61,_0x3c7223,_0xec8e0f){return new BPromise(function(_0x9cde7f,_0x3f4250){return client[_0x2ea3('0x9')](_0x3c9f61,_0xec8e0f)[_0x2ea3('0xa')](function(_0x46d7ac){logger['info'](_0x2ea3('0xb'),_0x3c7223,_0x2ea3('0xc'));logger[_0x2ea3('0xd')](_0x2ea3('0xe'),_0x3c7223,_0x2ea3('0xc'),JSON[_0x2ea3('0xf')](_0x46d7ac));if(_0x46d7ac[_0x2ea3('0x10')]){if(_0x46d7ac[_0x2ea3('0x10')][_0x2ea3('0x11')]===0x1f4){logger['error'](_0x2ea3('0xb'),_0x3c7223,_0x46d7ac['error'][_0x2ea3('0x12')]);return _0x3f4250(_0x46d7ac[_0x2ea3('0x10')][_0x2ea3('0x12')]);}logger['error'](_0x2ea3('0xb'),_0x3c7223,_0x46d7ac[_0x2ea3('0x10')][_0x2ea3('0x12')]);return _0x9cde7f(_0x46d7ac[_0x2ea3('0x10')][_0x2ea3('0x12')]);}else{logger[_0x2ea3('0x13')](_0x2ea3('0xb'),_0x3c7223,_0x2ea3('0xc'));_0x9cde7f(_0x46d7ac['result'][_0x2ea3('0x12')]);}})['catch'](function(_0x1254a4){logger[_0x2ea3('0x10')](_0x2ea3('0xb'),_0x3c7223,_0x1254a4);_0x3f4250(_0x1254a4);});});}exports['UpdateMailApplication']=function(_0xda7ca8){var _0x3fa718=this;return new Promise(function(_0x296342,_0x15bd51){return db[_0x2ea3('0x14')][_0x2ea3('0x15')](_0xda7ca8[_0x2ea3('0x16')],{'raw':_0xda7ca8[_0x2ea3('0x17')]?_0xda7ca8[_0x2ea3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xda7ca8[_0x2ea3('0x17')]?_0xda7ca8[_0x2ea3('0x17')][_0x2ea3('0x18')]||null:null,'attributes':_0xda7ca8['options']?_0xda7ca8[_0x2ea3('0x17')][_0x2ea3('0x19')]||null:null,'limit':_0xda7ca8[_0x2ea3('0x17')]?_0xda7ca8[_0x2ea3('0x17')][_0x2ea3('0x1a')]||null:null})[_0x2ea3('0xa')](function(_0x6d3431){logger[_0x2ea3('0x13')](_0x2ea3('0x1b'),_0xda7ca8);logger[_0x2ea3('0xd')](_0x2ea3('0x1b'),_0xda7ca8,JSON[_0x2ea3('0xf')](_0x6d3431));_0x296342(_0x6d3431);})[_0x2ea3('0x1c')](function(_0x1ca421){logger[_0x2ea3('0x10')]('UpdateMailApplication',_0x1ca421[_0x2ea3('0x12')],_0xda7ca8);_0x15bd51(_0x3fa718[_0x2ea3('0x10')](0x1f4,_0x1ca421[_0x2ea3('0x12')]));});});}; \ No newline at end of file +var _0xf075=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','debug','lodash','moment'];(function(_0x6c625c,_0x3c6a94){var _0x3f6753=function(_0x435e48){while(--_0x435e48){_0x6c625c['push'](_0x6c625c['shift']());}};_0x3f6753(++_0x3c6a94);}(_0xf075,0x18a));var _0x5f07=function(_0x82f2b6,_0x3bc52e){_0x82f2b6=_0x82f2b6-0x0;var _0x39bca3=_0xf075[_0x82f2b6];return _0x39bca3;};'use strict';var _=require(_0x5f07('0x0'));var util=require('util');var moment=require(_0x5f07('0x1'));var BPromise=require(_0x5f07('0x2'));var rs=require(_0x5f07('0x3'));var fs=require('fs');var Redis=require(_0x5f07('0x4'));var db=require(_0x5f07('0x5'))['db'];var utils=require(_0x5f07('0x6'));var logger=require(_0x5f07('0x7'))(_0x5f07('0x8'));var config=require(_0x5f07('0x9'));var jayson=require(_0x5f07('0xa'));var client=jayson[_0x5f07('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d30b,_0x33101c,_0x4edf65){return new BPromise(function(_0x4bfcfe,_0x448d3a){return client[_0x5f07('0xc')](_0x40d30b,_0x4edf65)[_0x5f07('0xd')](function(_0x10922f){logger[_0x5f07('0xe')](_0x5f07('0xf'),_0x33101c,'request\x20sent');logger['debug'](_0x5f07('0x10'),_0x33101c,_0x5f07('0x11'),JSON[_0x5f07('0x12')](_0x10922f));if(_0x10922f['error']){if(_0x10922f['error'][_0x5f07('0x13')]===0x1f4){logger[_0x5f07('0x14')](_0x5f07('0xf'),_0x33101c,_0x10922f['error']['message']);return _0x448d3a(_0x10922f[_0x5f07('0x14')][_0x5f07('0x15')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x33101c,_0x10922f[_0x5f07('0x14')]['message']);return _0x4bfcfe(_0x10922f[_0x5f07('0x14')][_0x5f07('0x15')]);}else{logger[_0x5f07('0xe')](_0x5f07('0xf'),_0x33101c,'request\x20sent');_0x4bfcfe(_0x10922f[_0x5f07('0x16')][_0x5f07('0x15')]);}})[_0x5f07('0x17')](function(_0x49d23){logger[_0x5f07('0x14')](_0x5f07('0xf'),_0x33101c,_0x49d23);_0x448d3a(_0x49d23);});});}exports[_0x5f07('0x18')]=function(_0x485686){var _0x36f620=this;return new Promise(function(_0x39a6a3,_0x5685bf){return db['MailApplication'][_0x5f07('0x19')](_0x485686[_0x5f07('0x1a')],{'raw':_0x485686[_0x5f07('0x1b')]?_0x485686[_0x5f07('0x1b')][_0x5f07('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485686['options']?_0x485686[_0x5f07('0x1b')][_0x5f07('0x1d')]||null:null,'attributes':_0x485686[_0x5f07('0x1b')]?_0x485686['options'][_0x5f07('0x1e')]||null:null,'limit':_0x485686[_0x5f07('0x1b')]?_0x485686[_0x5f07('0x1b')][_0x5f07('0x1f')]||null:null})[_0x5f07('0xd')](function(_0x436303){logger[_0x5f07('0xe')](_0x5f07('0x18'),_0x485686);logger[_0x5f07('0x20')](_0x5f07('0x18'),_0x485686,JSON[_0x5f07('0x12')](_0x436303));_0x39a6a3(_0x436303);})[_0x5f07('0x17')](function(_0x578f48){logger[_0x5f07('0x14')](_0x5f07('0x18'),_0x578f48[_0x5f07('0x15')],_0x485686);_0x5685bf(_0x36f620['error'](0x1f4,_0x578f48[_0x5f07('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ca27b41..a673d82 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 _0x2171=['path','connect-timeout','../../components/auth/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','addTags','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','util'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0x2171,0x143));var _0x1217=function(_0x287957,_0x5909af){_0x287957=_0x287957-0x0;var _0x53b245=_0x2171[_0x287957];return _0x53b245;};'use strict';var multer=require('multer');var util=require(_0x1217('0x0'));var path=require(_0x1217('0x1'));var timeout=require(_0x1217('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x1217('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1217('0x4'));var controller=require(_0x1217('0x5'));router[_0x1217('0x6')]('/',auth[_0x1217('0x7')](),controller['index']);router[_0x1217('0x6')](_0x1217('0x8'),auth[_0x1217('0x7')](),controller['describe']);router[_0x1217('0x6')](_0x1217('0x9'),auth[_0x1217('0x7')](),controller[_0x1217('0xa')]);router[_0x1217('0x6')](_0x1217('0xb'),auth['isAuthenticated'](),controller[_0x1217('0xc')]);router['get'](_0x1217('0xd'),auth[_0x1217('0x7')](),controller[_0x1217('0xe')]);router[_0x1217('0xf')]('/',auth[_0x1217('0x7')](),controller['create']);router[_0x1217('0xf')](_0x1217('0xb'),auth[_0x1217('0x7')](),controller[_0x1217('0x10')]);router[_0x1217('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x1217('0x11')]('mail','mailinteraction:addtags'),controller[_0x1217('0x12')]);router['put']('/:id',auth[_0x1217('0x7')](),interaction[_0x1217('0x11')](_0x1217('0x13'),_0x1217('0x14')),controller['update']);router[_0x1217('0x15')](_0x1217('0x9'),auth[_0x1217('0x7')](),interaction[_0x1217('0x11')]('mail',_0x1217('0x16')),controller[_0x1217('0x17')]);router[_0x1217('0x15')](_0x1217('0x18'),auth[_0x1217('0x7')](),controller[_0x1217('0x19')]);module[_0x1217('0x1a')]=router; \ No newline at end of file +var _0x724d=['mailinteraction:update','update','delete','mailinteraction:destroy','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x724d,0xe5));var _0xd724=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x724d[_0x1a89ca];return _0x29cbb2;};'use strict';var multer=require(_0xd724('0x0'));var util=require(_0xd724('0x1'));var path=require(_0xd724('0x2'));var timeout=require('connect-timeout');var express=require(_0xd724('0x3'));var router=express[_0xd724('0x4')]();var auth=require(_0xd724('0x5'));var interaction=require(_0xd724('0x6'));var config=require(_0xd724('0x7'));var controller=require(_0xd724('0x8'));router[_0xd724('0x9')]('/',auth[_0xd724('0xa')](),controller[_0xd724('0xb')]);router[_0xd724('0x9')](_0xd724('0xc'),auth[_0xd724('0xa')](),controller[_0xd724('0xd')]);router['get'](_0xd724('0xe'),auth[_0xd724('0xa')](),controller[_0xd724('0xf')]);router[_0xd724('0x9')](_0xd724('0x10'),auth[_0xd724('0xa')](),controller['getMessages']);router[_0xd724('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xd724('0x11')]);router[_0xd724('0x12')]('/',auth[_0xd724('0xa')](),controller[_0xd724('0x13')]);router[_0xd724('0x12')](_0xd724('0x10'),auth[_0xd724('0xa')](),controller[_0xd724('0x14')]);router[_0xd724('0x12')](_0xd724('0x15'),auth[_0xd724('0xa')](),interaction[_0xd724('0x16')](_0xd724('0x17'),_0xd724('0x18')),controller[_0xd724('0x19')]);router[_0xd724('0x1a')]('/:id',auth[_0xd724('0xa')](),interaction[_0xd724('0x16')](_0xd724('0x17'),_0xd724('0x1b')),controller[_0xd724('0x1c')]);router[_0xd724('0x1d')](_0xd724('0xe'),auth[_0xd724('0xa')](),interaction[_0xd724('0x16')](_0xd724('0x17'),_0xd724('0x1e')),controller[_0xd724('0x1f')]);router[_0xd724('0x1d')](_0xd724('0x15'),auth[_0xd724('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index aecd104..168539a 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 _0x07d9=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','sequelize'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x07d9,0xa1));var _0x907d=function(_0xad0d4a,_0x36d226){_0xad0d4a=_0xad0d4a-0x0;var _0x3a9b3c=_0x07d9[_0xad0d4a];return _0x3a9b3c;};'use strict';var Sequelize=require(_0x907d('0x0'));var iconv=require(_0x907d('0x1'));module[_0x907d('0x2')]={'closed':{'type':Sequelize[_0x907d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x907d('0x4')]},'disposition':{'type':Sequelize[_0x907d('0x5')]},'note':{'type':Sequelize[_0x907d('0x5')]},'inReplyTo':{'type':Sequelize[_0x907d('0x5')](0x1fe)},'to':{'type':Sequelize[_0x907d('0x5')]},'cc':{'type':Sequelize[_0x907d('0x6')](_0x907d('0x7'))},'subject':{'type':Sequelize[_0x907d('0x6')]()},'attach':{'type':Sequelize[_0x907d('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x907d('0x4')]},'substatus':{'type':Sequelize[_0x907d('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x907d('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x907d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x907d('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x907d('0x6')](_0x907d('0x7'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x907d('0x7'))}}; \ No newline at end of file +var _0x5dc4=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out'];(function(_0x512550,_0x6a8b6f){var _0x19f661=function(_0x5ded2a){while(--_0x5ded2a){_0x512550['push'](_0x512550['shift']());}};_0x19f661(++_0x6a8b6f);}(_0x5dc4,0x154));var _0x45dc=function(_0x5ed3ad,_0x5ceb58){_0x5ed3ad=_0x5ed3ad-0x0;var _0x5a6b22=_0x5dc4[_0x5ed3ad];return _0x5a6b22;};'use strict';var Sequelize=require(_0x45dc('0x0'));var iconv=require(_0x45dc('0x1'));module[_0x45dc('0x2')]={'closed':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x45dc('0x4')]},'disposition':{'type':Sequelize[_0x45dc('0x5')]},'note':{'type':Sequelize[_0x45dc('0x5')]},'inReplyTo':{'type':Sequelize[_0x45dc('0x5')](0x1fe)},'to':{'type':Sequelize[_0x45dc('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x45dc('0x6'))},'subject':{'type':Sequelize[_0x45dc('0x7')]()},'attach':{'type':Sequelize[_0x45dc('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x45dc('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x45dc('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x45dc('0x8')]('in',_0x45dc('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x45dc('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x45dc('0x6'))},'lastMsgText':{'type':Sequelize[_0x45dc('0x7')](_0x45dc('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a56ea29..b1e2d5c 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 _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x14fb49,_0x5e8001){var _0x3b98a1=function(_0x347d0e){while(--_0x347d0e){_0x14fb49['push'](_0x14fb49['shift']());}};_0x3b98a1(++_0x5e8001);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x1325e9,_0x1c5b2a){var _0x5722fc=function(_0x547af0){while(--_0x547af0){_0x1325e9['push'](_0x1325e9['shift']());}};_0x5722fc(++_0x1c5b2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 02aa1d3..f1ab818 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 _0xcba6=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcba6,0xc7));var _0x6cba=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xcba6[_0x4e9d3c];return _0x2d0825;};'use strict';var EventEmitter=require(_0x6cba('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x6cba('0x1'))['db'][_0x6cba('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6cba('0x3')](0x0);var events={'afterCreate':_0x6cba('0x4'),'afterUpdate':_0x6cba('0x5'),'afterDestroy':_0x6cba('0x6')};function emitEvent(_0x2f8ea4){return function(_0x30e8f6,_0x58b694,_0x5ef1ac){_0x30e8f6[_0x6cba('0x7')]({'attributes':['id'],'raw':!![]})[_0x6cba('0x8')](function(_0x1bef49){_0x30e8f6[_0x6cba('0x9')](_0x6cba('0xa'),_0x1bef49['map'](function(_0x1f5859){return{'id':_0x1f5859['id']};}));return MailMessage[_0x6cba('0xb')]({'where':{'MailInteractionId':_0x30e8f6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6cba('0x8')](function(_0x3ab00a){_0x30e8f6['setDataValue'](_0x6cba('0xc'),_0x3ab00a[_0x6cba('0xd')]);MailInteractionEvents[_0x6cba('0xe')](_0x2f8ea4+':'+_0x30e8f6['id'],_0x30e8f6);MailInteractionEvents[_0x6cba('0xe')](_0x2f8ea4,_0x30e8f6);_0x5ef1ac(null);})['catch'](_0x5ef1ac(null));};}for(var e in events){if(events[_0x6cba('0xf')](e)){var event=events[e];MailInteraction[_0x6cba('0x10')](e,emitEvent(event));}}module[_0x6cba('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x89e9=['setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x20255b,_0x52aa07){var _0x81fe0a=function(_0x161c2d){while(--_0x161c2d){_0x20255b['push'](_0x20255b['shift']());}};_0x81fe0a(++_0x52aa07);}(_0x89e9,0x1d2));var _0x989e=function(_0x2ce644,_0x2cf474){_0x2ce644=_0x2ce644-0x0;var _0x587cd7=_0x89e9[_0x2ce644];return _0x587cd7;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x989e('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x989e('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x989e('0x1')](0x0);var events={'afterCreate':_0x989e('0x2'),'afterUpdate':_0x989e('0x3'),'afterDestroy':_0x989e('0x4')};function emitEvent(_0x5e4d50){return function(_0x56a2f3,_0x48e1ed,_0x2dc7d5){_0x56a2f3[_0x989e('0x5')]({'attributes':['id'],'raw':!![]})[_0x989e('0x6')](function(_0x1c98b8){_0x56a2f3['setDataValue'](_0x989e('0x7'),_0x1c98b8[_0x989e('0x8')](function(_0x58bd97){return{'id':_0x58bd97['id']};}));return MailMessage[_0x989e('0x9')]({'where':{'MailInteractionId':_0x56a2f3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x989e('0x6')](function(_0xa284ec){_0x56a2f3[_0x989e('0xa')](_0x989e('0xb'),_0xa284ec[_0x989e('0xc')]);MailInteractionEvents['emit'](_0x5e4d50+':'+_0x56a2f3['id'],_0x56a2f3);MailInteractionEvents['emit'](_0x5e4d50,_0x56a2f3);_0x2dc7d5(null);})[_0x989e('0xd')](_0x2dc7d5(null));};}for(var e in events){if(events[_0x989e('0xe')](e)){var event=events[e];MailInteraction[_0x989e('0xf')](e,emitEvent(event));}}module[_0x989e('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1588d65..bc1ebe4 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 _0x9990=['FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9990,0xf6));var _0x0999=function(_0x28320d,_0xc2975d){_0x28320d=_0x28320d-0x0;var _0x189ee3=_0x9990[_0x28320d];return _0x189ee3;};'use strict';var _=require('lodash');var util=require(_0x0999('0x0'));var logger=require(_0x0999('0x1'))(_0x0999('0x2'));var moment=require(_0x0999('0x3'));var BPromise=require(_0x0999('0x4'));var rp=require(_0x0999('0x5'));var fs=require('fs');var path=require(_0x0999('0x6'));var rimraf=require(_0x0999('0x7'));var config=require('../../config/environment');var attributes=require(_0x0999('0x8'));module[_0x0999('0x9')]=function(_0x45d3e0,_0x4c606f){return _0x45d3e0[_0x0999('0xa')](_0x0999('0xb'),attributes,{'tableName':_0x0999('0xc'),'paranoid':![],'indexes':[{'name':_0x0999('0xd'),'fields':[_0x0999('0xe'),'to'],'type':_0x0999('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x385774,_0x52d196,_0xf6a77f){if(_0x385774[_0x0999('0x10')]){_0x385774[_0x0999('0x11')]=moment()['format'](_0x0999('0x12'));}if(_0x385774[_0x0999('0x13')]){_0x385774[_0x0999('0x14')]=moment()['format'](_0x0999('0x12'));}_0xf6a77f(null,_0x52d196);},'beforeUpdate':function(_0x5ea360,_0x2a2755,_0x36133e){if(_0x5ea360[_0x0999('0x15')](_0x0999('0x10'))){_0x5ea360[_0x0999('0x11')]=_0x5ea360['substatus']?moment()[_0x0999('0x16')](_0x0999('0x12')):null;}if(_0x5ea360[_0x0999('0x15')](_0x0999('0x13'))){_0x5ea360[_0x0999('0x14')]=moment()['format'](_0x0999('0x12'));_0x5ea360[_0x0999('0x10')]=null;_0x5ea360[_0x0999('0x11')]=null;}_0x36133e(null,_0x5ea360);},'afterUpdate':function(_0x4e4e53,_0x2d0ca2,_0xf680e){var _0x2fa43e=_0x45d3e0['models'];var _0xa82828=_0x4e4e53[_0x0999('0x17')]({'plain':!![]});if(_0xa82828['closed']){return _0x2fa43e[_0x0999('0x18')][_0x0999('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0xa82828['id']}})['then'](function(){_0xf680e();})[_0x0999('0x1a')](function(_0x3aa7bf){_0xf680e(_0x3aa7bf);});}else{_0xf680e();}}},'charset':_0x0999('0x1b'),'collate':_0x0999('0x1c')});}; \ No newline at end of file +var _0x5825=['format','YYYY-MM-DD\x20HH:mm:ss','closedAt','substatus','closed','models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatusAt'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x5825,0x78));var _0x5582=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5825[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5582('0x0'));var util=require(_0x5582('0x1'));var logger=require(_0x5582('0x2'))(_0x5582('0x3'));var moment=require('moment');var BPromise=require(_0x5582('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5582('0x5'));var rimraf=require(_0x5582('0x6'));var config=require(_0x5582('0x7'));var attributes=require(_0x5582('0x8'));module[_0x5582('0x9')]=function(_0x11eb87,_0x17a897){return _0x11eb87['define'](_0x5582('0xa'),attributes,{'tableName':_0x5582('0xb'),'paranoid':![],'indexes':[{'name':_0x5582('0xc'),'fields':[_0x5582('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2904ad,_0x3aa455,_0x24413f){if(_0x2904ad['substatus']){_0x2904ad[_0x5582('0xe')]=moment()[_0x5582('0xf')](_0x5582('0x10'));}if(_0x2904ad['closed']){_0x2904ad[_0x5582('0x11')]=moment()[_0x5582('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x24413f(null,_0x3aa455);},'beforeUpdate':function(_0x421f72,_0xac1c6b,_0x4798d6){if(_0x421f72['changed'](_0x5582('0x12'))){_0x421f72['substatusAt']=_0x421f72['substatus']?moment()[_0x5582('0xf')](_0x5582('0x10')):null;}if(_0x421f72['changed'](_0x5582('0x13'))){_0x421f72[_0x5582('0x11')]=moment()['format'](_0x5582('0x10'));_0x421f72[_0x5582('0x12')]=null;_0x421f72['substatusAt']=null;}_0x4798d6(null,_0x421f72);},'afterUpdate':function(_0x511268,_0xf38ed6,_0x5bb7a4){var _0x378fa8=_0x11eb87[_0x5582('0x14')];var _0x181bd7=_0x511268[_0x5582('0x15')]({'plain':!![]});if(_0x181bd7[_0x5582('0x13')]){return _0x378fa8[_0x5582('0x16')][_0x5582('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x181bd7['id']}})[_0x5582('0x18')](function(){_0x5bb7a4();})['catch'](function(_0x907cab){_0x5bb7a4(_0x907cab);});}else{_0x5bb7a4();}}},'charset':_0x5582('0x19'),'collate':_0x5582('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ab99ba0..3489338 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 _0x45c8=['addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','MailInteraction','body','options','where','attributes','limit','UpdateMailInteraction','catch','AddTagsToMailInteraction','find'];(function(_0xe1aa2b,_0x151508){var _0xf54c6b=function(_0x43f893){while(--_0x43f893){_0xe1aa2b['push'](_0xe1aa2b['shift']());}};_0xf54c6b(++_0x151508);}(_0x45c8,0xef));var _0x845c=function(_0x20889c,_0x1c1852){_0x20889c=_0x20889c-0x0;var _0x5899da=_0x45c8[_0x20889c];return _0x5899da;};'use strict';var _=require(_0x845c('0x0'));var util=require('util');var moment=require(_0x845c('0x1'));var BPromise=require(_0x845c('0x2'));var rs=require(_0x845c('0x3'));var fs=require('fs');var Redis=require(_0x845c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x845c('0x5'));var jayson=require(_0x845c('0x6'));var client=jayson[_0x845c('0x7')]['http']({'port':0x232a});config[_0x845c('0x8')]=_['defaults'](config[_0x845c('0x8')],{'host':_0x845c('0x9'),'port':0x18eb});var socket=require(_0x845c('0xa'))(new Redis(config[_0x845c('0x8')]));require(_0x845c('0xb'))[_0x845c('0xc')](socket);function respondWithRpcPromise(_0x14ea26,_0x344b75,_0xa729e6){return new BPromise(function(_0x1e6a03,_0x5f452d){return client['request'](_0x14ea26,_0xa729e6)[_0x845c('0xd')](function(_0xaf3d64){logger['info'](_0x845c('0xe'),_0x344b75,_0x845c('0xf'));logger[_0x845c('0x10')](_0x845c('0x11'),_0x344b75,_0x845c('0xf'),JSON[_0x845c('0x12')](_0xaf3d64));if(_0xaf3d64['error']){if(_0xaf3d64[_0x845c('0x13')][_0x845c('0x14')]===0x1f4){logger['error'](_0x845c('0xe'),_0x344b75,_0xaf3d64[_0x845c('0x13')][_0x845c('0x15')]);return _0x5f452d(_0xaf3d64[_0x845c('0x13')][_0x845c('0x15')]);}logger[_0x845c('0x13')](_0x845c('0xe'),_0x344b75,_0xaf3d64['error']['message']);return _0x1e6a03(_0xaf3d64[_0x845c('0x13')][_0x845c('0x15')]);}else{logger[_0x845c('0x16')]('MailInteraction,\x20%s,\x20%s',_0x344b75,_0x845c('0xf'));_0x1e6a03(_0xaf3d64[_0x845c('0x17')][_0x845c('0x15')]);}})['catch'](function(_0x47cdd5){logger['error'](_0x845c('0xe'),_0x344b75,_0x47cdd5);_0x5f452d(_0x47cdd5);});});}exports['UpdateMailInteraction']=function(_0x3a7f66){var _0x1c803f=this;return new Promise(function(_0x41e97d,_0x3a8f19){return db[_0x845c('0x18')]['update'](_0x3a7f66[_0x845c('0x19')],{'raw':_0x3a7f66['options']?_0x3a7f66[_0x845c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a7f66[_0x845c('0x1a')]?_0x3a7f66['options'][_0x845c('0x1b')]||null:null,'attributes':_0x3a7f66['options']?_0x3a7f66[_0x845c('0x1a')][_0x845c('0x1c')]||null:null,'limit':_0x3a7f66[_0x845c('0x1a')]?_0x3a7f66[_0x845c('0x1a')][_0x845c('0x1d')]||null:null})[_0x845c('0xd')](function(_0x4efe76){logger[_0x845c('0x16')]('UpdateMailInteraction',_0x3a7f66);logger[_0x845c('0x10')](_0x845c('0x1e'),_0x3a7f66,JSON['stringify'](_0x4efe76));_0x41e97d(_0x4efe76);})[_0x845c('0x1f')](function(_0x236529){logger[_0x845c('0x13')]('UpdateMailInteraction',_0x236529['message'],_0x3a7f66);_0x3a8f19(_0x1c803f[_0x845c('0x13')](0x1f4,_0x236529[_0x845c('0x15')]));});});};exports[_0x845c('0x20')]=function(_0x5e1f3a){return new Promise(function(_0x46bdc9,_0x4509f6){return db[_0x845c('0x18')][_0x845c('0x21')]({'where':_0x5e1f3a['options']?_0x5e1f3a[_0x845c('0x1a')][_0x845c('0x1b')]||null:null})[_0x845c('0xd')](function(_0x509bfd){if(_0x509bfd){return _0x509bfd[_0x845c('0x22')](_0x5e1f3a[_0x845c('0x19')]['ids'],_[_0x845c('0x23')](_0x5e1f3a[_0x845c('0x19')],[_0x845c('0x24'),'id'])||{});}})[_0x845c('0x25')](function(_0x4d2a42){logger['info'](_0x845c('0x26'),_0x5e1f3a);logger[_0x845c('0x10')](_0x845c('0x26'),_0x5e1f3a,JSON[_0x845c('0x12')](_0x4d2a42));_0x46bdc9(_0x4d2a42);})[_0x845c('0x1f')](function(_0x13c610){logger[_0x845c('0x13')](_0x845c('0x26'),_0x13c610[_0x845c('0x15')],_0x5e1f3a);_0x4509f6(_this[_0x845c('0x13')](0x1f4,_0x13c610[_0x845c('0x15')]));});});}; \ No newline at end of file +var _0x6be1=['spread','AddTags','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateMailInteraction','update','body','raw','options','where','attributes','limit','debug','catch','AddTagsToMailInteraction','MailInteraction','find','ids','omit'];(function(_0x4c71a3,_0x158410){var _0xb34e6f=function(_0x515be9){while(--_0x515be9){_0x4c71a3['push'](_0x4c71a3['shift']());}};_0xb34e6f(++_0x158410);}(_0x6be1,0x12f));var _0x16be=function(_0x1820ed,_0x2c6616){_0x1820ed=_0x1820ed-0x0;var _0x47f934=_0x6be1[_0x1820ed];return _0x47f934;};'use strict';var _=require(_0x16be('0x0'));var util=require(_0x16be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16be('0x2'))['db'];var utils=require(_0x16be('0x3'));var logger=require(_0x16be('0x4'))(_0x16be('0x5'));var config=require(_0x16be('0x6'));var jayson=require(_0x16be('0x7'));var client=jayson[_0x16be('0x8')][_0x16be('0x9')]({'port':0x232a});config[_0x16be('0xa')]=_[_0x16be('0xb')](config['redis'],{'host':_0x16be('0xc'),'port':0x18eb});var socket=require(_0x16be('0xd'))(new Redis(config[_0x16be('0xa')]));require(_0x16be('0xe'))[_0x16be('0xf')](socket);function respondWithRpcPromise(_0x3227ca,_0xbace4f,_0x2a5ab3){return new BPromise(function(_0x1a1a06,_0x34dfe8){return client[_0x16be('0x10')](_0x3227ca,_0x2a5ab3)[_0x16be('0x11')](function(_0x1ee9f3){logger[_0x16be('0x12')](_0x16be('0x13'),_0xbace4f,_0x16be('0x14'));logger['debug'](_0x16be('0x15'),_0xbace4f,_0x16be('0x14'),JSON[_0x16be('0x16')](_0x1ee9f3));if(_0x1ee9f3[_0x16be('0x17')]){if(_0x1ee9f3[_0x16be('0x17')]['code']===0x1f4){logger[_0x16be('0x17')](_0x16be('0x13'),_0xbace4f,_0x1ee9f3['error'][_0x16be('0x18')]);return _0x34dfe8(_0x1ee9f3['error']['message']);}logger['error'](_0x16be('0x13'),_0xbace4f,_0x1ee9f3[_0x16be('0x17')][_0x16be('0x18')]);return _0x1a1a06(_0x1ee9f3['error'][_0x16be('0x18')]);}else{logger['info'](_0x16be('0x13'),_0xbace4f,_0x16be('0x14'));_0x1a1a06(_0x1ee9f3[_0x16be('0x19')][_0x16be('0x18')]);}})['catch'](function(_0x2e1055){logger[_0x16be('0x17')]('MailInteraction,\x20%s,\x20%s',_0xbace4f,_0x2e1055);_0x34dfe8(_0x2e1055);});});}exports[_0x16be('0x1a')]=function(_0x3d4e0c){var _0x5dbca0=this;return new Promise(function(_0x13018c,_0xac15db){return db['MailInteraction'][_0x16be('0x1b')](_0x3d4e0c[_0x16be('0x1c')],{'raw':_0x3d4e0c['options']?_0x3d4e0c['options'][_0x16be('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d4e0c[_0x16be('0x1e')]?_0x3d4e0c['options'][_0x16be('0x1f')]||null:null,'attributes':_0x3d4e0c[_0x16be('0x1e')]?_0x3d4e0c[_0x16be('0x1e')][_0x16be('0x20')]||null:null,'limit':_0x3d4e0c['options']?_0x3d4e0c[_0x16be('0x1e')][_0x16be('0x21')]||null:null})['then'](function(_0x14ba98){logger['info']('UpdateMailInteraction',_0x3d4e0c);logger[_0x16be('0x22')](_0x16be('0x1a'),_0x3d4e0c,JSON['stringify'](_0x14ba98));_0x13018c(_0x14ba98);})[_0x16be('0x23')](function(_0x334bc6){logger[_0x16be('0x17')](_0x16be('0x1a'),_0x334bc6[_0x16be('0x18')],_0x3d4e0c);_0xac15db(_0x5dbca0[_0x16be('0x17')](0x1f4,_0x334bc6[_0x16be('0x18')]));});});};exports[_0x16be('0x24')]=function(_0x4ebe10){return new Promise(function(_0x38fb00,_0x5b0921){return db[_0x16be('0x25')][_0x16be('0x26')]({'where':_0x4ebe10[_0x16be('0x1e')]?_0x4ebe10[_0x16be('0x1e')][_0x16be('0x1f')]||null:null})[_0x16be('0x11')](function(_0x4f5c39){if(_0x4f5c39){return _0x4f5c39['addTags'](_0x4ebe10[_0x16be('0x1c')][_0x16be('0x27')],_[_0x16be('0x28')](_0x4ebe10[_0x16be('0x1c')],['ids','id'])||{});}})[_0x16be('0x29')](function(_0x52f895){logger[_0x16be('0x12')](_0x16be('0x2a'),_0x4ebe10);logger[_0x16be('0x22')](_0x16be('0x2a'),_0x4ebe10,JSON[_0x16be('0x16')](_0x52f895));_0x38fb00(_0x52f895);})[_0x16be('0x23')](function(_0x5630e1){logger[_0x16be('0x17')](_0x16be('0x2a'),_0x5630e1[_0x16be('0x18')],_0x4ebe10);_0x5b0921(_this['error'](0x1f4,_0x5630e1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 502b83d..973b349 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 _0x97f8=['remove','emit','removeListener','register'];(function(_0x43f1df,_0x115fba){var _0x38f72d=function(_0x35d8d8){while(--_0x35d8d8){_0x43f1df['push'](_0x43f1df['shift']());}};_0x38f72d(++_0x115fba);}(_0x97f8,0xbc));var _0x897f=function(_0x284b56,_0x3c6605){_0x284b56=_0x284b56-0x0;var _0xd3a1f6=_0x97f8[_0x284b56];return _0xd3a1f6;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x897f('0x0'),'update'];function createListener(_0x188cb5,_0x48b1b3){return function(_0x5a90f9){_0x48b1b3[_0x897f('0x1')](_0x188cb5,_0x5a90f9);};}function removeListener(_0x3e26d2,_0x1635f1){return function(){MailInteractionEvents[_0x897f('0x2')](_0x3e26d2,_0x1635f1);};}exports[_0x897f('0x3')]=function(_0x532372){for(var _0x3da5be=0x0,_0x179e52=events['length'];_0x3da5be<_0x179e52;_0x3da5be++){var _0x5eb3bf=events[_0x3da5be];var _0x5b0d8d=createListener('mailInteraction:'+_0x5eb3bf,_0x532372);MailInteractionEvents['on'](_0x5eb3bf,_0x5b0d8d);}}; \ No newline at end of file +var _0x5336=['save','remove','emit','removeListener','register','./mailInteraction.events'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x5336,0x155));var _0x6533=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x5336[_0x56916d];return _0x2b7f1f;};'use strict';var MailInteractionEvents=require(_0x6533('0x0'));var events=[_0x6533('0x1'),_0x6533('0x2'),'update'];function createListener(_0x350c2a,_0x5a645d){return function(_0x192df4){_0x5a645d[_0x6533('0x3')](_0x350c2a,_0x192df4);};}function removeListener(_0x1b61ff,_0x30bf2a){return function(){MailInteractionEvents[_0x6533('0x4')](_0x1b61ff,_0x30bf2a);};}exports[_0x6533('0x5')]=function(_0x12537a){for(var _0x46a9bb=0x0,_0x301d16=events['length'];_0x46a9bb<_0x301d16;_0x46a9bb++){var _0x968214=events[_0x46a9bb];var _0x1bc957=createListener('mailInteraction:'+_0x968214,_0x12537a);MailInteractionEvents['on'](_0x968214,_0x1bc957);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4864aac..8612b80 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 _0x9957=['download','post','mail','mailmessage:create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/download'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./mailMessage.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),interaction['tracked'](_0x7995('0x11'),_0x7995('0x12')),controller['create']);router[_0x7995('0x13')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x13')](_0x7995('0x15'),auth[_0x7995('0x9')](),controller['accept']);router['put'](_0x7995('0x16'),auth[_0x7995('0x9')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x19')]);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x84ab=['reject','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x43c7a5,_0x553343){var _0x213f13=function(_0x23d67b){while(--_0x23d67b){_0x43c7a5['push'](_0x43c7a5['shift']());}};_0x213f13(++_0x553343);}(_0x84ab,0x12f));var _0xb84a=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0x84ab[_0x2e2681];return _0x368a64;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var auth=require(_0xb84a('0x5'));var interaction=require(_0xb84a('0x6'));var config=require('../../config/environment');var controller=require(_0xb84a('0x7'));router[_0xb84a('0x8')]('/',auth[_0xb84a('0x9')](),controller['index']);router['get']('/describe',auth[_0xb84a('0x9')](),controller['describe']);router[_0xb84a('0x8')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router['get'](_0xb84a('0xc'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xb84a('0xe'),_0xb84a('0xf')),controller[_0xb84a('0x10')]);router[_0xb84a('0x11')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0x12')]);router[_0xb84a('0x11')](_0xb84a('0x13'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x14')]);router[_0xb84a('0x11')](_0xb84a('0x15'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x16')]);router[_0xb84a('0x17')](_0xb84a('0xa'),auth[_0xb84a('0x9')](),controller['destroy']);module[_0xb84a('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 30552c8..6f1b94a 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 _0x202a=['lodash','exports','TEXT','out','long','DATE'];(function(_0x207177,_0x5d450c){var _0x1ed60c=function(_0x27df9e){while(--_0x27df9e){_0x207177['push'](_0x207177['shift']());}};_0x1ed60c(++_0x5d450c);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa202('0x0'));module[_0xa202('0x1')]={'body':{'type':Sequelize[_0xa202('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa202('0x2')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa202('0x3')),'defaultValue':_0xa202('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa202('0x2')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0xa202('0x2')](_0xa202('0x4'))},'subject':{'type':Sequelize[_0xa202('0x2')]},'sentAt':{'type':Sequelize[_0xa202('0x5')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa202('0x5')]},'originTo':{'type':Sequelize[_0xa202('0x2')](_0xa202('0x4'))},'originCc':{'type':Sequelize[_0xa202('0x2')]('long')}}; \ No newline at end of file +var _0x5454=['long','DATE','INTEGER','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5454,0x15b));var _0x4545=function(_0x1475cf,_0xca2f6){_0x1475cf=_0x1475cf-0x0;var _0x6114a0=_0x5454[_0x1475cf];return _0x6114a0;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0x4545('0x0')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x4545('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4545('0x2')]('in',_0x4545('0x3')),'defaultValue':_0x4545('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x4545('0x4')]},'to':{'type':Sequelize[_0x4545('0x0')](_0x4545('0x5'))},'cc':{'type':Sequelize[_0x4545('0x0')](_0x4545('0x5'))},'bcc':{'type':Sequelize[_0x4545('0x0')](_0x4545('0x5'))},'subject':{'type':Sequelize[_0x4545('0x0')]},'sentAt':{'type':Sequelize[_0x4545('0x6')]},'attach':{'type':Sequelize[_0x4545('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4545('0x1')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4545('0x6')]},'originTo':{'type':Sequelize[_0x4545('0x0')]('long')},'originCc':{'type':Sequelize[_0x4545('0x0')](_0x4545('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 8626afc..af9933a 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 _0xcb81=['path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../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','./mailMessage.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','MailMessage','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','Smtp','isNil','host','port','secure','authentication','auth','pass','service','user','attachments','length','join','root','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','download','unix','server','files','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','headers','Bcc','basename','push','build','writeFileSync','log','unlinkSync','html-pdf','eml-format','zip-dir','bluebird','mustache','util'];(function(_0x20a6bd,_0xe6d3){var _0x3a414e=function(_0x58ede4){while(--_0x58ede4){_0x20a6bd['push'](_0x20a6bd['shift']());}};_0x3a414e(++_0xe6d3);}(_0xcb81,0x154));var _0x1cb8=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xcb81[_0x13594e];return _0x1a4f42;};'use strict';var pdf=require(_0x1cb8('0x0'));var emlformat=require(_0x1cb8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1cb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cb8('0x3'));var Mustache=require(_0x1cb8('0x4'));var util=require(_0x1cb8('0x5'));var path=require(_0x1cb8('0x6'));var sox=require(_0x1cb8('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb8('0x8'));var fs=require('fs');var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var db=require('../../mysqldb')['db'];config[_0x1cb8('0x16')]=_[_0x1cb8('0x17')](config[_0x1cb8('0x16')],{'host':_0x1cb8('0x18'),'port':0x18eb});var socket=require(_0x1cb8('0x19'))(new Redis(config['redis']));require(_0x1cb8('0x1a'))[_0x1cb8('0x1b')](socket);var jayson=require(_0x1cb8('0x1c'));var client=jayson[_0x1cb8('0x1d')][_0x1cb8('0x1e')]({'port':0x232c});var client9003=jayson[_0x1cb8('0x1d')][_0x1cb8('0x1e')]({'port':0x232b});var client9002=jayson[_0x1cb8('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x17a95d,_0x4b4917,_0xf6b347){if(_0xf6b347){var _0x28b8ff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28b8ff[_0x1cb8('0x1f')](_0x4b4917)){return _0x17a95d;}else{throw new db[(_0x1cb8('0x20'))][(_0x1cb8('0x21'))](_0x1cb8('0x22'));}}else{return _0x17a95d;}}function respondWithRpcPromise(_0x3bfbcf,_0x9f0adb,_0x2631db,_0x1f9fd7){return new BPromise(function(_0x11d9f4,_0x3cda27){var _0x5c403c=_0x1f9fd7||client;return _0x5c403c[_0x1cb8('0x23')](_0x3bfbcf,_0x2631db)[_0x1cb8('0x24')](function(_0x170f34){logger[_0x1cb8('0x25')]('MailMessage,\x20%s,\x20%s',_0x9f0adb,_0x1cb8('0x26'));logger['debug'](_0x1cb8('0x27'),_0x9f0adb,_0x1cb8('0x26'),JSON[_0x1cb8('0x28')](_0x170f34));if(_0x170f34[_0x1cb8('0x29')]){if(_0x170f34['error']['code']===0x1f4){logger[_0x1cb8('0x29')](_0x1cb8('0x2a'),_0x9f0adb,_0x170f34[_0x1cb8('0x29')][_0x1cb8('0x2b')]);return _0x3cda27(_0x170f34[_0x1cb8('0x29')][_0x1cb8('0x2b')]);}logger[_0x1cb8('0x29')]('MailMessage,\x20%s,\x20%s',_0x9f0adb,_0x170f34[_0x1cb8('0x29')][_0x1cb8('0x2b')]);return _0x11d9f4(_0x170f34[_0x1cb8('0x29')][_0x1cb8('0x2b')]);}else{logger[_0x1cb8('0x25')](_0x1cb8('0x2a'),_0x9f0adb,'request\x20sent');_0x11d9f4(_0x170f34[_0x1cb8('0x2c')][_0x1cb8('0x2b')]);}})[_0x1cb8('0x2d')](function(_0x3c1905){logger[_0x1cb8('0x29')]('MailMessage,\x20%s,\x20%s',_0x9f0adb,_0x3c1905);_0x3cda27(_0x3c1905);});});}function respondWithStatusCode(_0xed576b,_0x2e3adf){_0x2e3adf=_0x2e3adf||0xcc;return function(_0x3a8b53){if(_0x3a8b53){return _0xed576b[_0x1cb8('0x2e')](_0x2e3adf);}return _0xed576b['status'](_0x2e3adf)[_0x1cb8('0x2f')]();};}function respondWithResult(_0x2ba8c8,_0x3a6a67){_0x3a6a67=_0x3a6a67||0xc8;return function(_0x5bf630){if(_0x5bf630){return _0x2ba8c8[_0x1cb8('0x30')](_0x3a6a67)[_0x1cb8('0x31')](_0x5bf630);}};}function respondWithFilteredResult(_0x17abe1,_0x5558fe){return function(_0x73be67){if(_0x73be67){var _0x3e2af4=_0x73be67['count'],_0x239c62=_0x5558fe[_0x1cb8('0x32')],_0xca35f2=_0x5558fe[_0x1cb8('0x32')]+_0x5558fe[_0x1cb8('0x33')],_0x36f63d;if(_0xca35f2>=_0x3e2af4){_0xca35f2=_0x3e2af4;_0x36f63d=0xc8;}else{_0x36f63d=0xce;}_0x17abe1[_0x1cb8('0x30')](_0x36f63d);return _0x17abe1[_0x1cb8('0x34')](_0x1cb8('0x35'),_0x239c62+'-'+_0xca35f2+'/'+_0x3e2af4)[_0x1cb8('0x31')](_0x73be67);}return null;};}function patchUpdates(_0x18cc99){return function(_0x1aaae4){try{jsonpatch['apply'](_0x1aaae4,_0x18cc99,!![]);}catch(_0x5cd6bd){return BPromise[_0x1cb8('0x36')](_0x5cd6bd);}return _0x1aaae4[_0x1cb8('0x37')]();};}function saveUpdates(_0x18a003,_0x5be4b7){return function(_0x5f04e3){if(_0x5f04e3){return _0x5f04e3[_0x1cb8('0x38')](_0x18a003)[_0x1cb8('0x24')](function(_0x9cdbed){return _0x9cdbed;});}return null;};}function removeEntity(_0xb21715,_0x198848){return function(_0x63ee4e){if(_0x63ee4e){return _0x63ee4e[_0x1cb8('0x39')]()[_0x1cb8('0x24')](function(){_0xb21715['status'](0xcc)[_0x1cb8('0x2f')]();});}};}function handleEntityNotFound(_0x1a6518,_0x1f888e){return function(_0x328b7c){if(!_0x328b7c){_0x1a6518[_0x1cb8('0x2e')](0x194);}return _0x328b7c;};}function handleError(_0x421ce7,_0xb5bc3c){_0xb5bc3c=_0xb5bc3c||0x1f4;return function(_0x2ad7f6){logger[_0x1cb8('0x29')](_0x2ad7f6['stack']);if(_0x2ad7f6[_0x1cb8('0x3a')]){delete _0x2ad7f6[_0x1cb8('0x3a')];}_0x421ce7['status'](_0xb5bc3c)[_0x1cb8('0x3b')](_0x2ad7f6);};}exports[_0x1cb8('0x3c')]=function(_0x15d6fa,_0x28a016){var _0xedbbda={},_0x5dc4c0={},_0x385b4d={'count':0x0,'rows':[]};var _0x4666bc=_[_0x1cb8('0x3d')](db['MailMessage']['rawAttributes'],function(_0x532af0){return{'name':_0x532af0[_0x1cb8('0x3e')],'type':_0x532af0[_0x1cb8('0x3f')][_0x1cb8('0x40')]};});_0x5dc4c0[_0x1cb8('0x41')]=_['map'](_0x4666bc,'name');_0x5dc4c0[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0x15d6fa[_0x1cb8('0x42')]);_0x5dc4c0[_0x1cb8('0x44')]=_[_0x1cb8('0x45')](_0x5dc4c0[_0x1cb8('0x41')],_0x5dc4c0[_0x1cb8('0x42')]);_0xedbbda[_0x1cb8('0x46')]=_['intersection'](_0x5dc4c0[_0x1cb8('0x41')],qs[_0x1cb8('0x47')](_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x47')]));_0xedbbda['attributes']=_0xedbbda[_0x1cb8('0x46')]['length']?_0xedbbda[_0x1cb8('0x46')]:_0x5dc4c0[_0x1cb8('0x41')];if(!_0x15d6fa['query'][_0x1cb8('0x48')](_0x1cb8('0x49'))){_0xedbbda[_0x1cb8('0x33')]=qs['limit'](_0x15d6fa['query'][_0x1cb8('0x33')]);_0xedbbda['offset']=qs[_0x1cb8('0x32')](_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x32')]);}_0xedbbda[_0x1cb8('0x4a')]=qs[_0x1cb8('0x4b')](_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x4b')]);_0xedbbda['where']=qs[_0x1cb8('0x44')](_[_0x1cb8('0x4c')](_0x15d6fa[_0x1cb8('0x42')],_0x5dc4c0[_0x1cb8('0x44')]),_0x4666bc);if(_0x15d6fa['query'][_0x1cb8('0x4d')]){_0xedbbda[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0xedbbda[_0x1cb8('0x4e')],{'$or':_[_0x1cb8('0x3d')](_0x4666bc,function(_0x4efbe2){if(_0x4efbe2[_0x1cb8('0x3f')]!==_0x1cb8('0x50')){var _0x3ae2d2={};_0x3ae2d2[_0x4efbe2[_0x1cb8('0x3a')]]={'$like':'%'+_0x15d6fa[_0x1cb8('0x42')]['filter']+'%'};return _0x3ae2d2;}})});}_0xedbbda=_[_0x1cb8('0x4f')]({},_0xedbbda,_0x15d6fa[_0x1cb8('0x51')]);var _0x5598b1={'where':_0xedbbda[_0x1cb8('0x4e')]};return db[_0x1cb8('0x52')][_0x1cb8('0x53')](_0x5598b1)[_0x1cb8('0x24')](function(_0xe8c8c7){_0x385b4d[_0x1cb8('0x53')]=_0xe8c8c7;if(_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x54')]){_0xedbbda[_0x1cb8('0x55')]=[{'all':!![]}];}return db[_0x1cb8('0x52')][_0x1cb8('0x56')](_0xedbbda);})[_0x1cb8('0x24')](function(_0x3c9076){_0x385b4d[_0x1cb8('0x57')]=_0x3c9076;return _0x385b4d;})['then'](respondWithFilteredResult(_0x28a016,_0xedbbda))[_0x1cb8('0x2d')](handleError(_0x28a016,null));};exports[_0x1cb8('0x58')]=function(_0x366628,_0x41a57e){var _0x21aba7={'raw':!![],'where':{'id':_0x366628[_0x1cb8('0x59')]['id']}},_0x15f0ba={};_0x15f0ba['model']=_[_0x1cb8('0x43')](db[_0x1cb8('0x52')][_0x1cb8('0x5a')]);_0x15f0ba['query']=_['keys'](_0x366628[_0x1cb8('0x42')]);_0x15f0ba[_0x1cb8('0x44')]=_[_0x1cb8('0x45')](_0x15f0ba[_0x1cb8('0x41')],_0x15f0ba[_0x1cb8('0x42')]);_0x21aba7['attributes']=_[_0x1cb8('0x45')](_0x15f0ba[_0x1cb8('0x41')],qs[_0x1cb8('0x47')](_0x366628['query']['fields']));_0x21aba7['attributes']=_0x21aba7[_0x1cb8('0x46')]['length']?_0x21aba7[_0x1cb8('0x46')]:_0x15f0ba[_0x1cb8('0x41')];if(_0x366628[_0x1cb8('0x42')][_0x1cb8('0x54')]){_0x21aba7[_0x1cb8('0x55')]=[{'all':!![]}];}_0x21aba7=_['merge']({},_0x21aba7,_0x366628[_0x1cb8('0x51')]);return db[_0x1cb8('0x52')][_0x1cb8('0x5b')](_0x21aba7)[_0x1cb8('0x24')](handleEntityNotFound(_0x41a57e,null))[_0x1cb8('0x24')](respondWithResult(_0x41a57e,null))[_0x1cb8('0x2d')](handleError(_0x41a57e,null));};exports[_0x1cb8('0x38')]=function(_0x53e09e,_0x1f0dea){if(_0x53e09e[_0x1cb8('0x5c')]['id']){delete _0x53e09e[_0x1cb8('0x5c')]['id'];}return db[_0x1cb8('0x52')][_0x1cb8('0x5b')]({'where':{'id':_0x53e09e[_0x1cb8('0x59')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x1f0dea,null))['then'](saveUpdates(_0x53e09e['body'],null))['then'](respondWithResult(_0x1f0dea,null))[_0x1cb8('0x2d')](handleError(_0x1f0dea,null));};exports['destroy']=function(_0x2f3daa,_0x23cea0){return db[_0x1cb8('0x52')][_0x1cb8('0x5b')]({'where':{'id':_0x2f3daa[_0x1cb8('0x59')]['id']}})['then'](handleEntityNotFound(_0x23cea0,null))['then'](removeEntity(_0x23cea0,null))['catch'](handleError(_0x23cea0,null));};exports[_0x1cb8('0x5d')]=function(_0x3f8cba,_0x482d4f){return db[_0x1cb8('0x52')]['describe']()[_0x1cb8('0x24')](respondWithResult(_0x482d4f,null))[_0x1cb8('0x2d')](handleError(_0x482d4f,null));};exports['create']=function(_0x340e8e,_0x19f3f0){return db[_0x1cb8('0x52')][_0x1cb8('0x5e')](_0x340e8e[_0x1cb8('0x5c')])[_0x1cb8('0x24')](function(_0x416817){if(_0x416817){if(_0x416817[_0x1cb8('0x5f')]===_0x1cb8('0x60')&&!_0x416817[_0x1cb8('0x61')]){var _0x2fb1a7,_0x46c27d,_0x379169;if(_0x340e8e['body']['to']){_0x46c27d=_0x340e8e[_0x1cb8('0x5c')]['to'][_0x1cb8('0x62')](',')[0x0];}return db[_0x1cb8('0x63')]['findOne']({'where':{'id':_0x416817[_0x1cb8('0x64')]},'include':[{'model':db[_0x1cb8('0x65')],'as':_0x1cb8('0x66'),'include':[{'model':db[_0x1cb8('0x67')],'as':'Contacts','where':{'email':_0x46c27d},'limit':0x1,'order':[[_0x1cb8('0x68'),_0x1cb8('0x69')]]}]},{'model':db['MailServerOut'],'as':_0x1cb8('0x6a'),'raw':!![]}]})[_0x1cb8('0x24')](function(_0x5db6d0){_0x2fb1a7=_0x5db6d0;if(_0x2fb1a7&&_0x2fb1a7[_0x1cb8('0x6a')]){var _0x46ed52={'tls':{'rejectUnauthorized':![]}};if(_[_0x1cb8('0x6b')](_0x2fb1a7[_0x1cb8('0x6a')]['service'])){_0x46ed52['host']=_0x2fb1a7['Smtp'][_0x1cb8('0x6c')];_0x46ed52[_0x1cb8('0x6d')]=_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x6d')];_0x46ed52[_0x1cb8('0x6e')]=_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x6e')];if(_0x2fb1a7['Smtp'][_0x1cb8('0x6f')]){_0x46ed52[_0x1cb8('0x70')]={'user':_0x2fb1a7[_0x1cb8('0x6a')]['user'],'pass':_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x71')]};}}else{_0x46ed52[_0x1cb8('0x72')]=_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x72')];_0x46ed52['auth']={'user':_0x2fb1a7[_0x1cb8('0x6a')][_0x1cb8('0x73')],'pass':_0x2fb1a7[_0x1cb8('0x6a')]['pass']};_0x46ed52[_0x1cb8('0x6e')]=_0x2fb1a7[_0x1cb8('0x6a')]['secure'];}if(_0x340e8e[_0x1cb8('0x5c')]['attachments']&&_0x340e8e['body'][_0x1cb8('0x74')][_0x1cb8('0x75')]){for(var _0x1b8b40=0x0;_0x1b8b40<_0x340e8e['body']['attachments']['length'];_0x1b8b40+=0x1){_0x340e8e[_0x1cb8('0x5c')][_0x1cb8('0x74')][_0x1b8b40]={'filename':_0x340e8e[_0x1cb8('0x5c')][_0x1cb8('0x74')][_0x1b8b40][_0x1cb8('0x3a')],'path':path[_0x1cb8('0x76')](config[_0x1cb8('0x77')],'server/files/attachments',_0x340e8e['body']['attachments'][_0x1b8b40]['basename'])};}}_0x379169={'account':_0x46ed52,'message':_0x340e8e[_0x1cb8('0x5c')]};return;}})['then'](function(){if(_0x2fb1a7[_0x1cb8('0x66')]){if(_0x2fb1a7['List']['Contacts']['length']){return _0x2fb1a7[_0x1cb8('0x66')][_0x1cb8('0x78')][0x0];}else{return db[_0x1cb8('0x67')][_0x1cb8('0x5e')](_[_0x1cb8('0x17')](_0x340e8e[_0x1cb8('0x5c')],{'firstName':_0x340e8e[_0x1cb8('0x5c')]['to'],'email':_0x340e8e[_0x1cb8('0x5c')]['to'],'phone':_0x340e8e[_0x1cb8('0x5c')]['to'],'ListId':_0x2fb1a7[_0x1cb8('0x79')]}));}}else{throw new Error(_0x1cb8('0x7a'));}})[_0x1cb8('0x24')](function(){if(_0x379169){return respondWithRpcPromise(_0x1cb8('0x7b'),_0x1cb8('0x7c'),_0x379169,client9003)[_0x1cb8('0x24')](function(_0x38aa03){return _0x416817['update']({'read':!![],'messageId':_0x38aa03[_0x1cb8('0x7d')],'sentAt':moment()[_0x1cb8('0x7e')](_0x1cb8('0x7f'))});})[_0x1cb8('0x2d')](function(_0x24a298){logger[_0x1cb8('0x29')]('%s',JSON['stringify'](_0x24a298));return _0x416817;});}return _0x416817;});}return _0x416817;}})[_0x1cb8('0x24')](respondWithResult(_0x19f3f0,0xc9))[_0x1cb8('0x2d')](handleError(_0x19f3f0,null));};var interaction_log=require(_0x1cb8('0x12'))(_0x1cb8('0x80'));exports[_0x1cb8('0x81')]=function(_0x48e593,_0x7e9918,_0x34094c){var _0x5bfe0c={'channel':_0x1cb8('0x82')};if(_0x48e593['body']['id']){delete _0x48e593[_0x1cb8('0x5c')]['id'];}_0x48e593[_0x1cb8('0x5c')][_0x1cb8('0x83')]=!![];_0x48e593['body'][_0x1cb8('0x84')]=moment()[_0x1cb8('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x48e593['body'][_0x1cb8('0x85')]=_0x48e593[_0x1cb8('0x5c')]['UserId']||_0x48e593[_0x1cb8('0x73')]['id'];return db[_0x1cb8('0x52')][_0x1cb8('0x5b')]({'where':{'id':_0x48e593[_0x1cb8('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x1cb8('0x67')],'as':_0x1cb8('0x86')}]})[_0x1cb8('0x24')](handleEntityNotFound(_0x7e9918,null))['then'](saveUpdates(_0x48e593[_0x1cb8('0x5c')],null))['then'](function(_0x5334c1){if(_0x5334c1){_0x5bfe0c['message']=_0x5334c1[_0x1cb8('0x87')]({'plain':!![]});return db[_0x1cb8('0x88')][_0x1cb8('0x5b')]({'where':{'id':_0x5334c1[_0x1cb8('0x89')]}});}return null;})[_0x1cb8('0x24')](handleEntityNotFound(_0x7e9918,null))[_0x1cb8('0x24')](function(_0x4822cc){if(_0x4822cc){return _0x4822cc['update']({'UserId':_0x48e593[_0x1cb8('0x5c')]['UserId'],'read1stAt':_[_0x1cb8('0x6b')](_0x4822cc[_0x1cb8('0x8a')])?moment()[_0x1cb8('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x7afd8f){if(_0x7afd8f){_0x5bfe0c['interaction']=_0x7afd8f[_0x1cb8('0x87')]({'plain':!![]});interaction_log[_0x1cb8('0x25')](_0x1cb8('0x8b'),_0x48e593[_0x1cb8('0x73')]['id'],_0x48e593[_0x1cb8('0x73')][_0x1cb8('0x3a')],_0x48e593[_0x1cb8('0x73')][_0x1cb8('0x8c')],_0x5bfe0c[_0x1cb8('0x8d')]['id'],_0x48e593[_0x1cb8('0x5c')]?JSON[_0x1cb8('0x28')](_0x48e593[_0x1cb8('0x5c')]):_0x1cb8('0x8e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5bfe0c);}return null;})[_0x1cb8('0x24')](function(_0xf1a4cc){if(_0xf1a4cc){if(_0x48e593[_0x1cb8('0x5c')][_0x1cb8('0x8f')]){_0x5bfe0c['message'][_0x1cb8('0x90')]=util[_0x1cb8('0x7e')](_0x1cb8('0x91'),_0x48e593[_0x1cb8('0x73')][_0x1cb8('0x3a')]);_0x5bfe0c['message'][_0x1cb8('0x92')]=_0x5bfe0c[_0x1cb8('0x92')];_0x5bfe0c[_0x1cb8('0x2b')][_0x1cb8('0x93')]=_0x1cb8('0x81');return respondWithRpcPromise(_0x1cb8('0x94'),_0x1cb8('0x94'),{'event':_0x1cb8('0x95'),'message':_0x5bfe0c[_0x1cb8('0x2b')]},client9002)[_0x1cb8('0x24')](function(){return _0x5bfe0c;});}return _0x5bfe0c;}return null;})['then'](respondWithResult(_0x7e9918,null))[_0x1cb8('0x2d')](handleError(_0x7e9918,null));};var interaction_log=require(_0x1cb8('0x12'))('mail-interactions');exports['reject']=function(_0x1d03e1,_0x5bbb90,_0x55161c){var _0x3a786a={'agent':{},'channel':_0x1cb8('0x82')};if(_0x1d03e1['body']['id']){delete _0x1d03e1['body']['id'];}_0x1d03e1[_0x1cb8('0x5c')]['UserId']=_0x1d03e1[_0x1cb8('0x5c')]['UserId']||_0x1d03e1[_0x1cb8('0x73')]['id'];_0x3a786a[_0x1cb8('0x96')]['id']=_0x1d03e1['body'][_0x1cb8('0x85')];return db[_0x1cb8('0x52')][_0x1cb8('0x5b')]({'where':{'id':_0x1d03e1[_0x1cb8('0x59')]['id'],'UserId':null}})[_0x1cb8('0x24')](handleEntityNotFound(_0x5bbb90,null))[_0x1cb8('0x24')](function(_0xeea4ce){if(_0xeea4ce){_0x3a786a[_0x1cb8('0x2b')]=_0xeea4ce['get']({'plain':!![]});return db[_0x1cb8('0x88')]['find']({'where':{'id':_0xeea4ce[_0x1cb8('0x89')]}});}return null;})[_0x1cb8('0x24')](handleEntityNotFound(_0x5bbb90,null))[_0x1cb8('0x24')](function(_0x5bb08c){if(_0x5bb08c){_0x3a786a['interaction']=_0x5bb08c[_0x1cb8('0x87')]({'plain':!![]});interaction_log[_0x1cb8('0x25')](_0x1cb8('0x97'),_0x1d03e1['user']['id'],_0x1d03e1['user']['name'],_0x1d03e1['user'][_0x1cb8('0x8c')],_0x3a786a[_0x1cb8('0x8d')]['id'],_0x1d03e1[_0x1cb8('0x5c')]?JSON[_0x1cb8('0x28')](_0x1d03e1[_0x1cb8('0x5c')]):_0x1cb8('0x8e'));return respondWithRpcPromise('RejectMessage',_0x1cb8('0x98'),_0x3a786a);}return null;})[_0x1cb8('0x24')](function(_0x359a7d){if(_0x359a7d){_0x359a7d[_0x1cb8('0x2b')][_0x1cb8('0x90')]=util['format'](_0x1cb8('0x91'),_0x1d03e1[_0x1cb8('0x73')][_0x1cb8('0x3a')]);_0x359a7d[_0x1cb8('0x2b')][_0x1cb8('0x92')]=_0x3a786a[_0x1cb8('0x92')];_0x359a7d[_0x1cb8('0x2b')]['event']='reject';respondWithRpcPromise('EventManager',_0x1cb8('0x94'),{'event':_0x1cb8('0x99'),'message':_0x359a7d[_0x1cb8('0x2b')]},client9002);return _0x3a786a;}return null;})[_0x1cb8('0x24')](respondWithResult(_0x5bbb90,null))['catch'](handleError(_0x5bbb90,null));};exports[_0x1cb8('0x9a')]=function(_0x5829f3,_0xebe8da){var _0x107833=moment()[_0x1cb8('0x9b')]()['toString']();var _0x5e6b36=path[_0x1cb8('0x76')](config[_0x1cb8('0x77')],_0x1cb8('0x9c'),_0x1cb8('0x9d'),'tmp');var _0x457386=path[_0x1cb8('0x76')](config[_0x1cb8('0x77')],'server',_0x1cb8('0x9d'),_0x1cb8('0x74'));var _0x276126=util[_0x1cb8('0x7e')](_0x1cb8('0x9e'),_0x107833);return db['MailMessage']['find']({'where':{'id':_0x5829f3[_0x1cb8('0x59')]['id']},'attributes':['id','body',_0x1cb8('0x9f'),'to','cc',_0x1cb8('0xa0'),'subject',_0x1cb8('0xa1')],'include':_0x5829f3[_0x1cb8('0x42')][_0x1cb8('0x74')]?[{'model':db[_0x1cb8('0xa2')],'as':_0x1cb8('0xa3')}]:undefined})['then'](handleEntityNotFound(_0xebe8da,null))[_0x1cb8('0x24')](function(_0x1a700d){if(_0x1a700d){var _0x3c07b5=_0x1a700d;var _0xd6451e={'from':_0x3c07b5['from'],'to':_0x3c07b5['to'],'subject':_0x3c07b5[_0x1cb8('0xa4')],'html':_0x3c07b5[_0x1cb8('0x5c')],'headers':{'Date':moment(_0x3c07b5[_0x1cb8('0xa1')])[_0x1cb8('0x7e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1a700d['cc']){_0xd6451e['headers']['Cc']=_0x1a700d['cc'];}if(_0x1a700d['bcc']){_0xd6451e[_0x1cb8('0xa5')][_0x1cb8('0xa6')]=_0x1a700d[_0x1cb8('0xa0')];}return new BPromise(function(_0x24ac20,_0x37ca01){if(_0x1a700d[_0x1cb8('0xa3')]){for(var _0x53bb05=0x0;_0x53bb05<_0x1a700d[_0x1cb8('0xa3')][_0x1cb8('0x75')];_0x53bb05++){var _0x9141ed=_0x1a700d[_0x1cb8('0xa3')][_0x53bb05];var _0x43c39c=path[_0x1cb8('0x76')](_0x457386,_0x9141ed[_0x1cb8('0xa7')]);if(fs['existsSync'](_0x43c39c)){_0xd6451e[_0x1cb8('0x74')][_0x1cb8('0xa8')]({'name':_0x9141ed[_0x1cb8('0x3a')],'contentType':_0x9141ed[_0x1cb8('0x3f')],'data':fs['readFileSync'](_0x43c39c)});}}}emlformat[_0x1cb8('0xa9')](_0xd6451e,function(_0x483c87,_0x3b4a20){if(_0x483c87)return _0x37ca01(_0x483c87);fs[_0x1cb8('0xaa')](path['join'](_0x5e6b36,_0x276126),_0x3b4a20);return _0x24ac20(_0x3b4a20);});});}})[_0x1cb8('0x24')](function(_0x2ecd2e){if(_0x2ecd2e){return _0xebe8da[_0x1cb8('0x9a')](path[_0x1cb8('0x76')](_0x5e6b36,_0x276126),_0x276126,function(_0x4b16d4){if(_0x4b16d4){console[_0x1cb8('0xab')]('err',_0x4b16d4);}else{fs[_0x1cb8('0xac')](path['join'](_0x5e6b36,_0x276126));}});}})[_0x1cb8('0x2d')](handleError(_0xebe8da,null));}; \ No newline at end of file +var _0x45d1=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','MailMessage','count','includeAll','params','keys','find','catch','describe','create','body','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','Contacts','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','stringify','mail-interactions','accept','read','readAt','format','MailInteraction','UserId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','agent','MailInteractionId','rejectMessage','rejectmessage','download','toString','server','files','tmp','root','message-%s.eml','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','push','readFileSync','build','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then'];(function(_0x377a6e,_0x4b2b70){var _0x2527ac=function(_0xd4c6b5){while(--_0xd4c6b5){_0x377a6e['push'](_0x377a6e['shift']());}};_0x2527ac(++_0x4b2b70);}(_0x45d1,0x1cb));var _0x145d=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x45d1[_0x3074f3];return _0x53f112;};'use strict';var pdf=require(_0x145d('0x0'));var emlformat=require(_0x145d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x145d('0x2'));var jsonpatch=require(_0x145d('0x3'));var rp=require('request-promise');var moment=require(_0x145d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x145d('0x5'));var util=require(_0x145d('0x6'));var path=require(_0x145d('0x7'));var sox=require(_0x145d('0x8'));var csv=require(_0x145d('0x9'));var ejs=require(_0x145d('0xa'));var fs=require('fs');var _=require(_0x145d('0xb'));var squel=require(_0x145d('0xc'));var crypto=require(_0x145d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x145d('0xe'));var Papa=require(_0x145d('0xf'));var Redis=require(_0x145d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x145d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x145d('0x12'));var logger=require(_0x145d('0x13'))(_0x145d('0x14'));var utils=require(_0x145d('0x15'));var config=require('../../config/environment');var db=require(_0x145d('0x16'))['db'];config[_0x145d('0x17')]=_['defaults'](config[_0x145d('0x17')],{'host':_0x145d('0x18'),'port':0x18eb});var socket=require(_0x145d('0x19'))(new Redis(config[_0x145d('0x17')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x145d('0x1a'));var client=jayson[_0x145d('0x1b')][_0x145d('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x145d('0x1c')]({'port':0x232b});var client9002=jayson[_0x145d('0x1b')][_0x145d('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x32f6eb,_0xf4ff35,_0x49af68){if(_0x49af68){var _0x1c9ee2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c9ee2[_0x145d('0x1d')](_0xf4ff35)){return _0x32f6eb;}else{throw new db[(_0x145d('0x1e'))]['ValidationError'](_0x145d('0x1f'));}}else{return _0x32f6eb;}}function respondWithRpcPromise(_0x32960c,_0x197b53,_0x29f913,_0x49d27b){return new BPromise(function(_0x3f18ce,_0x295918){var _0x411683=_0x49d27b||client;return _0x411683['request'](_0x32960c,_0x29f913)[_0x145d('0x20')](function(_0x46fbd8){logger['info'](_0x145d('0x21'),_0x197b53,_0x145d('0x22'));logger[_0x145d('0x23')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x197b53,'request\x20sent',JSON['stringify'](_0x46fbd8));if(_0x46fbd8[_0x145d('0x24')]){if(_0x46fbd8[_0x145d('0x24')][_0x145d('0x25')]===0x1f4){logger[_0x145d('0x24')]('MailMessage,\x20%s,\x20%s',_0x197b53,_0x46fbd8[_0x145d('0x24')][_0x145d('0x26')]);return _0x295918(_0x46fbd8['error'][_0x145d('0x26')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x197b53,_0x46fbd8[_0x145d('0x24')]['message']);return _0x3f18ce(_0x46fbd8[_0x145d('0x24')][_0x145d('0x26')]);}else{logger[_0x145d('0x27')](_0x145d('0x21'),_0x197b53,_0x145d('0x22'));_0x3f18ce(_0x46fbd8[_0x145d('0x28')][_0x145d('0x26')]);}})['catch'](function(_0x2e5b89){logger['error'](_0x145d('0x21'),_0x197b53,_0x2e5b89);_0x295918(_0x2e5b89);});});}function respondWithStatusCode(_0x5c97d0,_0x12b2a8){_0x12b2a8=_0x12b2a8||0xcc;return function(_0x571909){if(_0x571909){return _0x5c97d0[_0x145d('0x29')](_0x12b2a8);}return _0x5c97d0[_0x145d('0x2a')](_0x12b2a8)[_0x145d('0x2b')]();};}function respondWithResult(_0x3a8a50,_0x19757f){_0x19757f=_0x19757f||0xc8;return function(_0x2a22f9){if(_0x2a22f9){return _0x3a8a50['status'](_0x19757f)['json'](_0x2a22f9);}};}function respondWithFilteredResult(_0x493d9e,_0x2a73b7){return function(_0x1148e0){if(_0x1148e0){var _0x22ebaa=_0x1148e0['count'],_0xac4fd4=_0x2a73b7['offset'],_0x1d67fe=_0x2a73b7[_0x145d('0x2c')]+_0x2a73b7[_0x145d('0x2d')],_0x579996;if(_0x1d67fe>=_0x22ebaa){_0x1d67fe=_0x22ebaa;_0x579996=0xc8;}else{_0x579996=0xce;}_0x493d9e[_0x145d('0x2a')](_0x579996);return _0x493d9e[_0x145d('0x2e')](_0x145d('0x2f'),_0xac4fd4+'-'+_0x1d67fe+'/'+_0x22ebaa)[_0x145d('0x30')](_0x1148e0);}return null;};}function patchUpdates(_0x4546e4){return function(_0x3eed82){try{jsonpatch[_0x145d('0x31')](_0x3eed82,_0x4546e4,!![]);}catch(_0x3ed4eb){return BPromise[_0x145d('0x32')](_0x3ed4eb);}return _0x3eed82[_0x145d('0x33')]();};}function saveUpdates(_0x2dbd80,_0x1ac4a8){return function(_0x5bbd45){if(_0x5bbd45){return _0x5bbd45[_0x145d('0x34')](_0x2dbd80)[_0x145d('0x20')](function(_0x3a1e5d){return _0x3a1e5d;});}return null;};}function removeEntity(_0x354e28,_0x1f7622){return function(_0x1a3782){if(_0x1a3782){return _0x1a3782[_0x145d('0x35')]()[_0x145d('0x20')](function(){_0x354e28[_0x145d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c8f7,_0x320ea5){return function(_0x2ff2eb){if(!_0x2ff2eb){_0x48c8f7[_0x145d('0x29')](0x194);}return _0x2ff2eb;};}function handleError(_0x432283,_0x324407){_0x324407=_0x324407||0x1f4;return function(_0x5504e9){logger['error'](_0x5504e9[_0x145d('0x36')]);if(_0x5504e9[_0x145d('0x37')]){delete _0x5504e9[_0x145d('0x37')];}_0x432283[_0x145d('0x2a')](_0x324407)[_0x145d('0x38')](_0x5504e9);};}exports[_0x145d('0x39')]=function(_0x58d551,_0x3bb195){var _0x52e88f={},_0xdc819={},_0x34fe78={'count':0x0,'rows':[]};var _0x17fda5=_[_0x145d('0x3a')](db['MailMessage']['rawAttributes'],function(_0xe429b9){return{'name':_0xe429b9[_0x145d('0x3b')],'type':_0xe429b9[_0x145d('0x3c')]['key']};});_0xdc819['model']=_[_0x145d('0x3a')](_0x17fda5,_0x145d('0x37'));_0xdc819[_0x145d('0x3d')]=_['keys'](_0x58d551[_0x145d('0x3d')]);_0xdc819['filters']=_[_0x145d('0x3e')](_0xdc819[_0x145d('0x3f')],_0xdc819[_0x145d('0x3d')]);_0x52e88f[_0x145d('0x40')]=_['intersection'](_0xdc819[_0x145d('0x3f')],qs[_0x145d('0x41')](_0x58d551[_0x145d('0x3d')][_0x145d('0x41')]));_0x52e88f[_0x145d('0x40')]=_0x52e88f[_0x145d('0x40')][_0x145d('0x42')]?_0x52e88f[_0x145d('0x40')]:_0xdc819[_0x145d('0x3f')];if(!_0x58d551['query']['hasOwnProperty'](_0x145d('0x43'))){_0x52e88f[_0x145d('0x2d')]=qs['limit'](_0x58d551[_0x145d('0x3d')][_0x145d('0x2d')]);_0x52e88f[_0x145d('0x2c')]=qs[_0x145d('0x2c')](_0x58d551[_0x145d('0x3d')]['offset']);}_0x52e88f['order']=qs[_0x145d('0x44')](_0x58d551['query'][_0x145d('0x44')]);_0x52e88f[_0x145d('0x45')]=qs[_0x145d('0x46')](_[_0x145d('0x47')](_0x58d551['query'],_0xdc819['filters']),_0x17fda5);if(_0x58d551[_0x145d('0x3d')][_0x145d('0x48')]){_0x52e88f[_0x145d('0x45')]=_[_0x145d('0x49')](_0x52e88f[_0x145d('0x45')],{'$or':_[_0x145d('0x3a')](_0x17fda5,function(_0x2339ec){if(_0x2339ec[_0x145d('0x3c')]!=='VIRTUAL'){var _0x14d8e6={};_0x14d8e6[_0x2339ec[_0x145d('0x37')]]={'$like':'%'+_0x58d551[_0x145d('0x3d')][_0x145d('0x48')]+'%'};return _0x14d8e6;}})});}_0x52e88f=_[_0x145d('0x49')]({},_0x52e88f,_0x58d551[_0x145d('0x4a')]);var _0x1e16b={'where':_0x52e88f[_0x145d('0x45')]};return db[_0x145d('0x4b')][_0x145d('0x4c')](_0x1e16b)[_0x145d('0x20')](function(_0xbccffc){_0x34fe78[_0x145d('0x4c')]=_0xbccffc;if(_0x58d551['query'][_0x145d('0x4d')]){_0x52e88f['include']=[{'all':!![]}];}return db[_0x145d('0x4b')]['findAll'](_0x52e88f);})['then'](function(_0x33f5f9){_0x34fe78['rows']=_0x33f5f9;return _0x34fe78;})[_0x145d('0x20')](respondWithFilteredResult(_0x3bb195,_0x52e88f))['catch'](handleError(_0x3bb195,null));};exports['show']=function(_0xd18ea0,_0x6631aa){var _0x516e45={'raw':!![],'where':{'id':_0xd18ea0[_0x145d('0x4e')]['id']}},_0x5df67f={};_0x5df67f['model']=_[_0x145d('0x4f')](db[_0x145d('0x4b')]['rawAttributes']);_0x5df67f[_0x145d('0x3d')]=_[_0x145d('0x4f')](_0xd18ea0[_0x145d('0x3d')]);_0x5df67f[_0x145d('0x46')]=_[_0x145d('0x3e')](_0x5df67f[_0x145d('0x3f')],_0x5df67f[_0x145d('0x3d')]);_0x516e45['attributes']=_[_0x145d('0x3e')](_0x5df67f[_0x145d('0x3f')],qs[_0x145d('0x41')](_0xd18ea0[_0x145d('0x3d')]['fields']));_0x516e45['attributes']=_0x516e45['attributes'][_0x145d('0x42')]?_0x516e45[_0x145d('0x40')]:_0x5df67f[_0x145d('0x3f')];if(_0xd18ea0['query'][_0x145d('0x4d')]){_0x516e45['include']=[{'all':!![]}];}_0x516e45=_['merge']({},_0x516e45,_0xd18ea0['options']);return db[_0x145d('0x4b')][_0x145d('0x50')](_0x516e45)['then'](handleEntityNotFound(_0x6631aa,null))[_0x145d('0x20')](respondWithResult(_0x6631aa,null))[_0x145d('0x51')](handleError(_0x6631aa,null));};exports['update']=function(_0x44c882,_0x269643){if(_0x44c882['body']['id']){delete _0x44c882['body']['id'];}return db[_0x145d('0x4b')][_0x145d('0x50')]({'where':{'id':_0x44c882[_0x145d('0x4e')]['id']}})[_0x145d('0x20')](handleEntityNotFound(_0x269643,null))[_0x145d('0x20')](saveUpdates(_0x44c882['body'],null))['then'](respondWithResult(_0x269643,null))[_0x145d('0x51')](handleError(_0x269643,null));};exports[_0x145d('0x35')]=function(_0x2a83ee,_0x12cc21){return db[_0x145d('0x4b')][_0x145d('0x50')]({'where':{'id':_0x2a83ee[_0x145d('0x4e')]['id']}})[_0x145d('0x20')](handleEntityNotFound(_0x12cc21,null))[_0x145d('0x20')](removeEntity(_0x12cc21,null))[_0x145d('0x51')](handleError(_0x12cc21,null));};exports[_0x145d('0x52')]=function(_0x216363,_0x27c4de){return db[_0x145d('0x4b')][_0x145d('0x52')]()[_0x145d('0x20')](respondWithResult(_0x27c4de,null))['catch'](handleError(_0x27c4de,null));};exports[_0x145d('0x53')]=function(_0x309c97,_0x4fec9b){return db['MailMessage'][_0x145d('0x53')](_0x309c97[_0x145d('0x54')])[_0x145d('0x20')](function(_0x1f50fe){if(_0x1f50fe){if(_0x1f50fe['direction']===_0x145d('0x55')&&!_0x1f50fe[_0x145d('0x56')]){var _0xb02978,_0x34de10,_0x42b5e2;if(_0x309c97[_0x145d('0x54')]['to']){_0x34de10=_0x309c97[_0x145d('0x54')]['to'][_0x145d('0x57')](',')[0x0];}return db[_0x145d('0x58')][_0x145d('0x59')]({'where':{'id':_0x1f50fe[_0x145d('0x5a')]},'include':[{'model':db['CmList'],'as':_0x145d('0x5b'),'include':[{'model':db[_0x145d('0x5c')],'as':'Contacts','where':{'email':_0x34de10},'limit':0x1,'order':[['updatedAt',_0x145d('0x5d')]]}]},{'model':db[_0x145d('0x5e')],'as':_0x145d('0x5f'),'raw':!![]}]})[_0x145d('0x20')](function(_0x4df1aa){_0xb02978=_0x4df1aa;if(_0xb02978&&_0xb02978['Smtp']){var _0x1bfec0={'tls':{'rejectUnauthorized':![]}};if(_[_0x145d('0x60')](_0xb02978[_0x145d('0x5f')][_0x145d('0x61')])){_0x1bfec0['host']=_0xb02978[_0x145d('0x5f')][_0x145d('0x62')];_0x1bfec0[_0x145d('0x63')]=_0xb02978[_0x145d('0x5f')]['port'];_0x1bfec0[_0x145d('0x64')]=_0xb02978[_0x145d('0x5f')][_0x145d('0x64')];if(_0xb02978[_0x145d('0x5f')][_0x145d('0x65')]){_0x1bfec0[_0x145d('0x66')]={'user':_0xb02978[_0x145d('0x5f')][_0x145d('0x67')],'pass':_0xb02978[_0x145d('0x5f')][_0x145d('0x68')]};}}else{_0x1bfec0['service']=_0xb02978[_0x145d('0x5f')][_0x145d('0x61')];_0x1bfec0['auth']={'user':_0xb02978['Smtp'][_0x145d('0x67')],'pass':_0xb02978[_0x145d('0x5f')]['pass']};_0x1bfec0[_0x145d('0x64')]=_0xb02978[_0x145d('0x5f')][_0x145d('0x64')];}if(_0x309c97[_0x145d('0x54')][_0x145d('0x69')]&&_0x309c97[_0x145d('0x54')][_0x145d('0x69')][_0x145d('0x42')]){for(var _0xb3027c=0x0;_0xb3027c<_0x309c97['body'][_0x145d('0x69')][_0x145d('0x42')];_0xb3027c+=0x1){_0x309c97[_0x145d('0x54')]['attachments'][_0xb3027c]={'filename':_0x309c97[_0x145d('0x54')][_0x145d('0x69')][_0xb3027c][_0x145d('0x37')],'path':path[_0x145d('0x6a')](config['root'],_0x145d('0x6b'),_0x309c97[_0x145d('0x54')][_0x145d('0x69')][_0xb3027c][_0x145d('0x6c')])};}}_0x42b5e2={'account':_0x1bfec0,'message':_0x309c97['body']};return;}})['then'](function(){if(_0xb02978['List']){if(_0xb02978[_0x145d('0x5b')][_0x145d('0x6d')][_0x145d('0x42')]){return _0xb02978[_0x145d('0x5b')][_0x145d('0x6d')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x309c97['body'],{'firstName':_0x309c97['body']['to'],'email':_0x309c97['body']['to'],'phone':_0x309c97['body']['to'],'ListId':_0xb02978['ListId']}));}}else{throw new Error(_0x145d('0x6e'));}})[_0x145d('0x20')](function(){if(_0x42b5e2){return respondWithRpcPromise(_0x145d('0x6f'),_0x145d('0x70'),_0x42b5e2,client9003)[_0x145d('0x20')](function(_0x24138a){return _0x1f50fe[_0x145d('0x34')]({'read':!![],'messageId':_0x24138a[_0x145d('0x71')],'sentAt':moment()['format'](_0x145d('0x72'))});})[_0x145d('0x51')](function(_0x3e71c9){logger[_0x145d('0x24')]('%s',JSON[_0x145d('0x73')](_0x3e71c9));return _0x1f50fe;});}return _0x1f50fe;});}return _0x1f50fe;}})[_0x145d('0x20')](respondWithResult(_0x4fec9b,0xc9))[_0x145d('0x51')](handleError(_0x4fec9b,null));};var interaction_log=require(_0x145d('0x13'))(_0x145d('0x74'));exports[_0x145d('0x75')]=function(_0x2c0d4e,_0x3731fe,_0xbe0969){var _0x10aacd={'channel':'mail'};if(_0x2c0d4e[_0x145d('0x54')]['id']){delete _0x2c0d4e[_0x145d('0x54')]['id'];}_0x2c0d4e[_0x145d('0x54')][_0x145d('0x76')]=!![];_0x2c0d4e[_0x145d('0x54')][_0x145d('0x77')]=moment()[_0x145d('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c0d4e[_0x145d('0x54')]['UserId']=_0x2c0d4e['body']['UserId']||_0x2c0d4e[_0x145d('0x67')]['id'];return db[_0x145d('0x4b')][_0x145d('0x50')]({'where':{'id':_0x2c0d4e[_0x145d('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0x145d('0x5c')],'as':'Contact'}]})[_0x145d('0x20')](handleEntityNotFound(_0x3731fe,null))[_0x145d('0x20')](saveUpdates(_0x2c0d4e[_0x145d('0x54')],null))[_0x145d('0x20')](function(_0x19fc9b){if(_0x19fc9b){_0x10aacd['message']=_0x19fc9b['get']({'plain':!![]});return db[_0x145d('0x79')][_0x145d('0x50')]({'where':{'id':_0x19fc9b['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3731fe,null))[_0x145d('0x20')](function(_0x1b2a0e){if(_0x1b2a0e){return _0x1b2a0e[_0x145d('0x34')]({'UserId':_0x2c0d4e[_0x145d('0x54')][_0x145d('0x7a')],'read1stAt':_['isNil'](_0x1b2a0e[_0x145d('0x7b')])?moment()['format'](_0x145d('0x72')):undefined});}return null;})[_0x145d('0x20')](function(_0x4f1ef2){if(_0x4f1ef2){_0x10aacd[_0x145d('0x7c')]=_0x4f1ef2[_0x145d('0x7d')]({'plain':!![]});interaction_log[_0x145d('0x27')](_0x145d('0x7e'),_0x2c0d4e[_0x145d('0x67')]['id'],_0x2c0d4e[_0x145d('0x67')][_0x145d('0x37')],_0x2c0d4e[_0x145d('0x67')][_0x145d('0x7f')],_0x10aacd['interaction']['id'],_0x2c0d4e['body']?JSON[_0x145d('0x73')](_0x2c0d4e[_0x145d('0x54')]):_0x145d('0x80'));return respondWithRpcPromise(_0x145d('0x81'),_0x145d('0x82'),_0x10aacd);}return null;})[_0x145d('0x20')](function(_0x2f470d){if(_0x2f470d){if(_0x2c0d4e[_0x145d('0x54')][_0x145d('0x83')]){_0x10aacd[_0x145d('0x26')][_0x145d('0x84')]=util[_0x145d('0x78')](_0x145d('0x85'),_0x2c0d4e['user'][_0x145d('0x37')]);_0x10aacd['message'][_0x145d('0x86')]=_0x10aacd[_0x145d('0x86')];_0x10aacd['message'][_0x145d('0x87')]='accept';return respondWithRpcPromise(_0x145d('0x88'),'EventManager',{'event':_0x145d('0x89'),'message':_0x10aacd['message']},client9002)['then'](function(){return _0x10aacd;});}return _0x10aacd;}return null;})[_0x145d('0x20')](respondWithResult(_0x3731fe,null))[_0x145d('0x51')](handleError(_0x3731fe,null));};var interaction_log=require(_0x145d('0x13'))('mail-interactions');exports['reject']=function(_0x2beded,_0x232701,_0x167818){var _0x1cd935={'agent':{},'channel':_0x145d('0x8a')};if(_0x2beded[_0x145d('0x54')]['id']){delete _0x2beded[_0x145d('0x54')]['id'];}_0x2beded[_0x145d('0x54')]['UserId']=_0x2beded[_0x145d('0x54')][_0x145d('0x7a')]||_0x2beded[_0x145d('0x67')]['id'];_0x1cd935[_0x145d('0x8b')]['id']=_0x2beded[_0x145d('0x54')][_0x145d('0x7a')];return db[_0x145d('0x4b')][_0x145d('0x50')]({'where':{'id':_0x2beded['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x232701,null))['then'](function(_0x867052){if(_0x867052){_0x1cd935[_0x145d('0x26')]=_0x867052['get']({'plain':!![]});return db['MailInteraction'][_0x145d('0x50')]({'where':{'id':_0x867052[_0x145d('0x8c')]}});}return null;})[_0x145d('0x20')](handleEntityNotFound(_0x232701,null))[_0x145d('0x20')](function(_0x273cf5){if(_0x273cf5){_0x1cd935[_0x145d('0x7c')]=_0x273cf5[_0x145d('0x7d')]({'plain':!![]});interaction_log[_0x145d('0x27')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2beded[_0x145d('0x67')]['id'],_0x2beded[_0x145d('0x67')][_0x145d('0x37')],_0x2beded[_0x145d('0x67')][_0x145d('0x7f')],_0x1cd935['interaction']['id'],_0x2beded[_0x145d('0x54')]?JSON[_0x145d('0x73')](_0x2beded[_0x145d('0x54')]):_0x145d('0x80'));return respondWithRpcPromise('RejectMessage',_0x145d('0x8d'),_0x1cd935);}return null;})['then'](function(_0x444912){if(_0x444912){_0x444912['message'][_0x145d('0x84')]=util[_0x145d('0x78')](_0x145d('0x85'),_0x2beded[_0x145d('0x67')][_0x145d('0x37')]);_0x444912[_0x145d('0x26')][_0x145d('0x86')]=_0x1cd935[_0x145d('0x86')];_0x444912[_0x145d('0x26')][_0x145d('0x87')]=_0x145d('0x32');respondWithRpcPromise(_0x145d('0x88'),_0x145d('0x88'),{'event':_0x145d('0x8e'),'message':_0x444912[_0x145d('0x26')]},client9002);return _0x1cd935;}return null;})[_0x145d('0x20')](respondWithResult(_0x232701,null))[_0x145d('0x51')](handleError(_0x232701,null));};exports[_0x145d('0x8f')]=function(_0x53ebbb,_0x10b6f2){var _0x28cbe4=moment()['unix']()[_0x145d('0x90')]();var _0x17acdd=path[_0x145d('0x6a')](config['root'],_0x145d('0x91'),_0x145d('0x92'),_0x145d('0x93'));var _0x5d8617=path[_0x145d('0x6a')](config[_0x145d('0x94')],'server',_0x145d('0x92'),'attachments');var _0x59d432=util['format'](_0x145d('0x95'),_0x28cbe4);return db[_0x145d('0x4b')][_0x145d('0x50')]({'where':{'id':_0x53ebbb[_0x145d('0x4e')]['id']},'attributes':['id',_0x145d('0x54'),'from','to','cc','bcc',_0x145d('0x96'),_0x145d('0x97')],'include':_0x53ebbb[_0x145d('0x3d')]['attachments']?[{'model':db[_0x145d('0x98')],'as':_0x145d('0x99')}]:undefined})[_0x145d('0x20')](handleEntityNotFound(_0x10b6f2,null))[_0x145d('0x20')](function(_0x547554){if(_0x547554){var _0xfd5cb1=_0x547554;var _0x5616be={'from':_0xfd5cb1[_0x145d('0x9a')],'to':_0xfd5cb1['to'],'subject':_0xfd5cb1[_0x145d('0x96')],'html':_0xfd5cb1[_0x145d('0x54')],'headers':{'Date':moment(_0xfd5cb1['createdAt'])[_0x145d('0x78')](_0x145d('0x9b'))},'attachments':[]};if(_0x547554['cc']){_0x5616be[_0x145d('0x9c')]['Cc']=_0x547554['cc'];}if(_0x547554[_0x145d('0x9d')]){_0x5616be[_0x145d('0x9c')][_0x145d('0x9e')]=_0x547554[_0x145d('0x9d')];}return new BPromise(function(_0x4c70fc,_0x84eb96){if(_0x547554[_0x145d('0x99')]){for(var _0x4c2930=0x0;_0x4c2930<_0x547554[_0x145d('0x99')][_0x145d('0x42')];_0x4c2930++){var _0x39cfbc=_0x547554[_0x145d('0x99')][_0x4c2930];var _0x5e13aa=path[_0x145d('0x6a')](_0x5d8617,_0x39cfbc[_0x145d('0x6c')]);if(fs['existsSync'](_0x5e13aa)){_0x5616be[_0x145d('0x69')][_0x145d('0x9f')]({'name':_0x39cfbc[_0x145d('0x37')],'contentType':_0x39cfbc[_0x145d('0x3c')],'data':fs[_0x145d('0xa0')](_0x5e13aa)});}}}emlformat[_0x145d('0xa1')](_0x5616be,function(_0xab64c1,_0x48af90){if(_0xab64c1)return _0x84eb96(_0xab64c1);fs['writeFileSync'](path['join'](_0x17acdd,_0x59d432),_0x48af90);return _0x4c70fc(_0x48af90);});});}})[_0x145d('0x20')](function(_0x3d09f3){if(_0x3d09f3){return _0x10b6f2[_0x145d('0x8f')](path[_0x145d('0x6a')](_0x17acdd,_0x59d432),_0x59d432,function(_0x350a69){if(_0x350a69){console[_0x145d('0xa2')](_0x145d('0xa3'),_0x350a69);}else{fs['unlinkSync'](path[_0x145d('0x6a')](_0x17acdd,_0x59d432));}});}})[_0x145d('0x51')](handleError(_0x10b6f2,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 4eeea70..bc641cd 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 _0x85c6=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x1bb93d,_0x5e3287){var _0x498558=function(_0x34a3a0){while(--_0x34a3a0){_0x1bb93d['push'](_0x1bb93d['shift']());}};_0x498558(++_0x5e3287);}(_0x85c6,0xc5));var _0x685c=function(_0x210821,_0x55dc0e){_0x210821=_0x210821-0x0;var _0x22e04c=_0x85c6[_0x210821];return _0x22e04c;};'use strict';var EventEmitter=require(_0x685c('0x0'));var MailMessage=require(_0x685c('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x685c('0x2')](0x0);var events={'afterCreate':_0x685c('0x3'),'afterUpdate':_0x685c('0x4'),'afterDestroy':_0x685c('0x5')};function emitEvent(_0x23f0d5){return function(_0x3c8365,_0x29a0d4,_0x302a23){MailMessageEvents[_0x685c('0x6')](_0x23f0d5+':'+_0x3c8365['id'],_0x3c8365);MailMessageEvents[_0x685c('0x6')](_0x23f0d5,_0x3c8365);_0x302a23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x685c('0x7')](e,emitEvent(event));}}module[_0x685c('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xa8b1=['update','emit','hook','events','setMaxListeners','save'];(function(_0x5f175c,_0x36de13){var _0x3dde95=function(_0x4f20a0){while(--_0x4f20a0){_0x5f175c['push'](_0x5f175c['shift']());}};_0x3dde95(++_0x36de13);}(_0xa8b1,0xb1));var _0x1a8b=function(_0x323624,_0x5dd487){_0x323624=_0x323624-0x0;var _0x98c1f0=_0xa8b1[_0x323624];return _0x98c1f0;};'use strict';var EventEmitter=require(_0x1a8b('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1a8b('0x1')](0x0);var events={'afterCreate':_0x1a8b('0x2'),'afterUpdate':_0x1a8b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b2955){return function(_0x232f2f,_0x49a729,_0x5a4b49){MailMessageEvents[_0x1a8b('0x4')](_0x2b2955+':'+_0x232f2f['id'],_0x232f2f);MailMessageEvents[_0x1a8b('0x4')](_0x2b2955,_0x232f2f);_0x5a4b49(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x1a8b('0x5')](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 97c3fc9..3ffbcf7 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 _0xb7da=['fromString','body','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT'];(function(_0x24806e,_0x44e30f){var _0x1015c6=function(_0x3a3804){while(--_0x3a3804){_0x24806e['push'](_0x24806e['shift']());}};_0x1015c6(++_0x44e30f);}(_0xb7da,0xf2));var _0xab7d=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xb7da[_0x470f63];return _0x4f09e2;};'use strict';var _=require(_0xab7d('0x0'));var util=require(_0xab7d('0x1'));var logger=require('../../config/logger')(_0xab7d('0x2'));var moment=require(_0xab7d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xab7d('0x4'));var rimraf=require(_0xab7d('0x5'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module['exports']=function(_0x2dda99,_0x83a04a){return _0x2dda99[_0xab7d('0x6')](_0xab7d('0x7'),attributes,{'tableName':_0xab7d('0x8'),'paranoid':![],'indexes':[{'name':_0xab7d('0x9'),'fields':[_0xab7d('0x9')]},{'name':_0xab7d('0xa'),'fields':[_0xab7d('0xb'),_0xab7d('0xc')],'type':_0xab7d('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x96d0c3,_0x19c6a2,_0x4bcab5){if(_0x96d0c3['body']){_0x96d0c3[_0xab7d('0xb')]=htmlToText[_0xab7d('0xe')](_0x96d0c3[_0xab7d('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4bcab5(null,_0x19c6a2);},'afterCreate':function(_0x4dc38f,_0x4fe3da,_0x3f710c){var _0x2c8993=_0x2dda99['models'];var _0x540abc=_0x4dc38f[_0xab7d('0x10')]({'plain':!![]});if(_0x540abc['direction']['toLowerCase']()==='in'||_0x540abc[_0xab7d('0x11')][_0xab7d('0x12')]()===_0xab7d('0x13')&&!_0x540abc[_0xab7d('0x14')]&&!_[_0xab7d('0x15')](_0x540abc['UserId'])){_0x2c8993[_0xab7d('0x16')][_0xab7d('0x17')]({'where':{'id':_0x540abc[_0xab7d('0x18')]}})[_0xab7d('0x19')](function(_0x8cefe1){if(_0x8cefe1){_0x8cefe1[_0xab7d('0x1a')]({'lastMsgAt':_0x540abc[_0xab7d('0x1b')],'lastMsgDirection':_0x540abc[_0xab7d('0x11')]['toLowerCase'](),'lastMsgBody':_0x540abc[_0xab7d('0xf')]});}})[_0xab7d('0x1c')](function(_0x41399e){console[_0xab7d('0x1d')](_0x41399e);});}_0x3f710c();}},'charset':_0xab7d('0x1e'),'collate':_0xab7d('0x1f')});}; \ No newline at end of file +var _0x466e=['MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','isNil','MailInteraction','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','html-to-text','rimraf','exports','define'];(function(_0x3c08b8,_0x1e629e){var _0x511b74=function(_0x53a5d4){while(--_0x53a5d4){_0x3c08b8['push'](_0x3c08b8['shift']());}};_0x511b74(++_0x1e629e);}(_0x466e,0x1d7));var _0xe466=function(_0x55d824,_0x2ff52e){_0x55d824=_0x55d824-0x0;var _0xe427ba=_0x466e[_0x55d824];return _0xe427ba;};'use strict';var _=require('lodash');var util=require(_0xe466('0x0'));var logger=require(_0xe466('0x1'))(_0xe466('0x2'));var moment=require('moment');var BPromise=require(_0xe466('0x3'));var rp=require(_0xe466('0x4'));var htmlToText=require(_0xe466('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe466('0x6'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0xe466('0x7')]=function(_0x2fa620,_0x34bb82){return _0x2fa620[_0xe466('0x8')](_0xe466('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xe466('0xa'),'fields':[_0xe466('0xa')]},{'name':_0xe466('0xb'),'fields':[_0xe466('0xc'),_0xe466('0xd')],'type':_0xe466('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29738a,_0x4cd902,_0x565c39){if(_0x29738a[_0xe466('0xf')]){_0x29738a[_0xe466('0xc')]=htmlToText[_0xe466('0x10')](_0x29738a['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x565c39(null,_0x4cd902);},'afterCreate':function(_0x1aaeab,_0x18e7b2,_0x59a988){var _0x9cc6ea=_0x2fa620[_0xe466('0x11')];var _0x4fce03=_0x1aaeab['get']({'plain':!![]});if(_0x4fce03[_0xe466('0x12')][_0xe466('0x13')]()==='in'||_0x4fce03['direction'][_0xe466('0x13')]()===_0xe466('0x14')&&!_0x4fce03['secret']&&!_[_0xe466('0x15')](_0x4fce03['UserId'])){_0x9cc6ea[_0xe466('0x16')]['findOne']({'where':{'id':_0x4fce03[_0xe466('0x17')]}})[_0xe466('0x18')](function(_0x4a0657){if(_0x4a0657){_0x4a0657[_0xe466('0x19')]({'lastMsgAt':_0x4fce03[_0xe466('0x1a')],'lastMsgDirection':_0x4fce03[_0xe466('0x12')][_0xe466('0x13')](),'lastMsgBody':_0x4fce03[_0xe466('0xf')]});}})['catch'](function(_0x500d39){console[_0xe466('0x1b')](_0x500d39);});}_0x59a988();}},'charset':_0xe466('0x1c'),'collate':_0xe466('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b2234d6..3a9b5cd 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 _0xe225=['MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','debug','util','moment','../../mysqldb','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x28e286,_0x10abcd){var _0xfc8d38=function(_0x1cf7ca){while(--_0x1cf7ca){_0x28e286['push'](_0x28e286['shift']());}};_0xfc8d38(++_0x10abcd);}(_0xe225,0x1bd));var _0x5e22=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xe225[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require(_0x5e22('0x0'));var moment=require(_0x5e22('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e22('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e22('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e22('0x4')][_0x5e22('0x5')]({'port':0x232a});config[_0x5e22('0x6')]=_[_0x5e22('0x7')](config[_0x5e22('0x6')],{'host':_0x5e22('0x8'),'port':0x18eb});var socket=require(_0x5e22('0x9'))(new Redis(config[_0x5e22('0x6')]));require(_0x5e22('0xa'))[_0x5e22('0xb')](socket);function respondWithRpcPromise(_0x422de4,_0x1fa72a,_0x4da7b3){return new BPromise(function(_0x239a18,_0x58b12c){return client[_0x5e22('0xc')](_0x422de4,_0x4da7b3)[_0x5e22('0xd')](function(_0x2f9b03){logger[_0x5e22('0xe')]('MailMessage,\x20%s,\x20%s',_0x1fa72a,_0x5e22('0xf'));logger['debug'](_0x5e22('0x10'),_0x1fa72a,_0x5e22('0xf'),JSON[_0x5e22('0x11')](_0x2f9b03));if(_0x2f9b03[_0x5e22('0x12')]){if(_0x2f9b03[_0x5e22('0x12')]['code']===0x1f4){logger[_0x5e22('0x12')](_0x5e22('0x13'),_0x1fa72a,_0x2f9b03[_0x5e22('0x12')][_0x5e22('0x14')]);return _0x58b12c(_0x2f9b03[_0x5e22('0x12')][_0x5e22('0x14')]);}logger[_0x5e22('0x12')](_0x5e22('0x13'),_0x1fa72a,_0x2f9b03[_0x5e22('0x12')][_0x5e22('0x14')]);return _0x239a18(_0x2f9b03[_0x5e22('0x12')][_0x5e22('0x14')]);}else{logger[_0x5e22('0xe')]('MailMessage,\x20%s,\x20%s',_0x1fa72a,'request\x20sent');_0x239a18(_0x2f9b03[_0x5e22('0x15')]['message']);}})[_0x5e22('0x16')](function(_0x3096ee){logger[_0x5e22('0x12')](_0x5e22('0x13'),_0x1fa72a,_0x3096ee);_0x58b12c(_0x3096ee);});});}exports[_0x5e22('0x17')]=function(_0x1de5a2){var _0x3857ef=this;return new Promise(function(_0x32c4ec,_0x280988){return db[_0x5e22('0x18')]['create'](_0x1de5a2[_0x5e22('0x19')],{'raw':_0x1de5a2[_0x5e22('0x1a')]?_0x1de5a2[_0x5e22('0x1a')][_0x5e22('0x1b')]===undefined?!![]:![]:!![]})[_0x5e22('0xd')](function(_0x310978){logger[_0x5e22('0xe')](_0x5e22('0x17'),_0x1de5a2);logger[_0x5e22('0x1c')]('CreateMailMessage',_0x1de5a2,JSON[_0x5e22('0x11')](_0x310978));_0x32c4ec(_0x310978);})['catch'](function(_0x3b4cac){logger[_0x5e22('0x12')](_0x5e22('0x17'),_0x3b4cac[_0x5e22('0x14')],_0x1de5a2);_0x280988(_0x3857ef[_0x5e22('0x12')](0x1f4,_0x3b4cac[_0x5e22('0x14')]));});});}; \ No newline at end of file +var _0xfcf0=['then','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','catch','create','body','options','raw','CreateMailMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x5df6db,_0xe1fb79){var _0xf43e9c=function(_0x2c14ff){while(--_0x2c14ff){_0x5df6db['push'](_0x5df6db['shift']());}};_0xf43e9c(++_0xe1fb79);}(_0xfcf0,0x138));var _0x0fcf=function(_0x5d61b4,_0x4f7b91){_0x5d61b4=_0x5d61b4-0x0;var _0x183fc5=_0xfcf0[_0x5d61b4];return _0x183fc5;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});config[_0x0fcf('0xc')]=_[_0x0fcf('0xd')](config['redis'],{'host':_0x0fcf('0xe'),'port':0x18eb});var socket=require(_0x0fcf('0xf'))(new Redis(config[_0x0fcf('0xc')]));require('./mailMessage.socket')[_0x0fcf('0x10')](socket);function respondWithRpcPromise(_0x7ac7bd,_0x239e5d,_0x4b3923){return new BPromise(function(_0x369959,_0x5c29ed){return client[_0x0fcf('0x11')](_0x7ac7bd,_0x4b3923)[_0x0fcf('0x12')](function(_0x201a58){logger['info']('MailMessage,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'));logger[_0x0fcf('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x239e5d,_0x0fcf('0x13'),JSON[_0x0fcf('0x15')](_0x201a58));if(_0x201a58[_0x0fcf('0x16')]){if(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x17')]===0x1f4){logger['error'](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);return _0x5c29ed(_0x201a58['error'][_0x0fcf('0x19')]);}logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x201a58[_0x0fcf('0x16')]['message']);return _0x369959(_0x201a58[_0x0fcf('0x16')][_0x0fcf('0x19')]);}else{logger[_0x0fcf('0x1a')](_0x0fcf('0x18'),_0x239e5d,_0x0fcf('0x13'));_0x369959(_0x201a58['result'][_0x0fcf('0x19')]);}})[_0x0fcf('0x1b')](function(_0x5dad87){logger[_0x0fcf('0x16')](_0x0fcf('0x18'),_0x239e5d,_0x5dad87);_0x5c29ed(_0x5dad87);});});}exports['CreateMailMessage']=function(_0x2022e1){var _0x50ac4a=this;return new Promise(function(_0x3fc9e6,_0x13454e){return db['MailMessage'][_0x0fcf('0x1c')](_0x2022e1[_0x0fcf('0x1d')],{'raw':_0x2022e1[_0x0fcf('0x1e')]?_0x2022e1['options'][_0x0fcf('0x1f')]===undefined?!![]:![]:!![]})[_0x0fcf('0x12')](function(_0x196d30){logger[_0x0fcf('0x1a')](_0x0fcf('0x20'),_0x2022e1);logger[_0x0fcf('0x14')]('CreateMailMessage',_0x2022e1,JSON[_0x0fcf('0x15')](_0x196d30));_0x3fc9e6(_0x196d30);})[_0x0fcf('0x1b')](function(_0x6021b4){logger[_0x0fcf('0x16')](_0x0fcf('0x20'),_0x6021b4[_0x0fcf('0x19')],_0x2022e1);_0x13454e(_0x50ac4a[_0x0fcf('0x16')](0x1f4,_0x6021b4[_0x0fcf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 429e590..584e76e 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 _0x3604=['save','remove','removeListener','register','length','mailMessage:'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x3604,0x174));var _0x4360=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3604[_0x160c73];return _0xd9302;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x4360('0x0'),_0x4360('0x1'),'update'];function createListener(_0xf349b0,_0x34c2f5){return function(_0x81da3e){_0x34c2f5['emit'](_0xf349b0,_0x81da3e);};}function removeListener(_0xca6c43,_0x4221af){return function(){MailMessageEvents[_0x4360('0x2')](_0xca6c43,_0x4221af);};}exports[_0x4360('0x3')]=function(_0x4d0529){for(var _0x45b4db=0x0,_0x23d6c5=events[_0x4360('0x4')];_0x45b4db<_0x23d6c5;_0x45b4db++){var _0x7badab=events[_0x45b4db];var _0x555d99=createListener(_0x4360('0x5')+_0x7badab,_0x4d0529);MailMessageEvents['on'](_0x7badab,_0x555d99);}}; \ No newline at end of file +var _0x1996=['./mailMessage.events','remove','update','removeListener','register'];(function(_0x7616f0,_0x225ab3){var _0xf58de5=function(_0x1b0ab3){while(--_0x1b0ab3){_0x7616f0['push'](_0x7616f0['shift']());}};_0xf58de5(++_0x225ab3);}(_0x1996,0x1e5));var _0x6199=function(_0x2ec80b,_0x568c34){_0x2ec80b=_0x2ec80b-0x0;var _0x4d6093=_0x1996[_0x2ec80b];return _0x4d6093;};'use strict';var MailMessageEvents=require(_0x6199('0x0'));var events=['save',_0x6199('0x1'),_0x6199('0x2')];function createListener(_0x2f04ed,_0x17df0d){return function(_0x5714d8){_0x17df0d['emit'](_0x2f04ed,_0x5714d8);};}function removeListener(_0x393061,_0x5dfffc){return function(){MailMessageEvents[_0x6199('0x3')](_0x393061,_0x5dfffc);};}exports[_0x6199('0x4')]=function(_0x519595){for(var _0x54ad2c=0x0,_0x33a0f0=events['length'];_0x54ad2c<_0x33a0f0;_0x54ad2c++){var _0x5ddab0=events[_0x54ad2c];var _0x1c4e3b=createListener('mailMessage:'+_0x5ddab0,_0x519595);MailMessageEvents['on'](_0x5ddab0,_0x1c4e3b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b6be3fd..56b25e1 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 _0x5885=['removeAgents','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x572178,_0x44fcaa){var _0x12c377=function(_0x44b2dd){while(--_0x44b2dd){_0x572178['push'](_0x572178['shift']());}};_0x12c377(++_0x44fcaa);}(_0x5885,0x66));var _0x5588=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5885[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x5588('0x0'));var util=require('util');var path=require(_0x5588('0x1'));var timeout=require(_0x5588('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5588('0x3'));var interaction=require(_0x5588('0x4'));var config=require(_0x5588('0x5'));var controller=require('./mailQueue.controller');router[_0x5588('0x6')]('/',auth[_0x5588('0x7')](),controller[_0x5588('0x8')]);router[_0x5588('0x6')]('/describe',auth[_0x5588('0x7')](),controller[_0x5588('0x9')]);router[_0x5588('0x6')](_0x5588('0xa'),auth[_0x5588('0x7')](),controller['show']);router['get']('/:id/members',auth[_0x5588('0x7')](),controller[_0x5588('0xb')]);router['get'](_0x5588('0xc'),auth[_0x5588('0x7')](),controller[_0x5588('0xd')]);router['get'](_0x5588('0xe'),auth[_0x5588('0x7')](),controller['getAgents']);router[_0x5588('0xf')]('/',auth['isAuthenticated'](),controller[_0x5588('0x10')]);router[_0x5588('0xf')](_0x5588('0xc'),auth['isAuthenticated'](),controller['addTeams']);router[_0x5588('0xf')]('/:id/users',auth[_0x5588('0x7')](),controller[_0x5588('0x11')]);router[_0x5588('0x12')]('/:id',auth[_0x5588('0x7')](),controller[_0x5588('0x13')]);router[_0x5588('0x14')](_0x5588('0xa'),auth[_0x5588('0x7')](),controller[_0x5588('0x15')]);router[_0x5588('0x14')](_0x5588('0xc'),auth['isAuthenticated'](),controller[_0x5588('0x16')]);router[_0x5588('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x5588('0x17')]);module[_0x5588('0x18')]=router; \ No newline at end of file +var _0xfdf7=['/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','destroy','delete','removeTeams','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers'];(function(_0x5b826e,_0x517e6a){var _0x2ef6eb=function(_0x5a8895){while(--_0x5a8895){_0x5b826e['push'](_0x5b826e['shift']());}};_0x2ef6eb(++_0x517e6a);}(_0xfdf7,0xe0));var _0x7fdf=function(_0x15e9c0,_0x1bd22e){_0x15e9c0=_0x15e9c0-0x0;var _0x2a3ec3=_0xfdf7[_0x15e9c0];return _0x2a3ec3;};'use strict';var multer=require(_0x7fdf('0x0'));var util=require(_0x7fdf('0x1'));var path=require(_0x7fdf('0x2'));var timeout=require('connect-timeout');var express=require(_0x7fdf('0x3'));var router=express[_0x7fdf('0x4')]();var auth=require(_0x7fdf('0x5'));var interaction=require(_0x7fdf('0x6'));var config=require(_0x7fdf('0x7'));var controller=require(_0x7fdf('0x8'));router[_0x7fdf('0x9')]('/',auth[_0x7fdf('0xa')](),controller[_0x7fdf('0xb')]);router[_0x7fdf('0x9')](_0x7fdf('0xc'),auth[_0x7fdf('0xa')](),controller[_0x7fdf('0xd')]);router[_0x7fdf('0x9')]('/:id',auth[_0x7fdf('0xa')](),controller['show']);router[_0x7fdf('0x9')](_0x7fdf('0xe'),auth[_0x7fdf('0xa')](),controller[_0x7fdf('0xf')]);router[_0x7fdf('0x9')](_0x7fdf('0x10'),auth[_0x7fdf('0xa')](),controller['getTeams']);router[_0x7fdf('0x9')](_0x7fdf('0x11'),auth[_0x7fdf('0xa')](),controller[_0x7fdf('0x12')]);router[_0x7fdf('0x13')]('/',auth[_0x7fdf('0xa')](),controller[_0x7fdf('0x14')]);router[_0x7fdf('0x13')]('/:id/teams',auth[_0x7fdf('0xa')](),controller[_0x7fdf('0x15')]);router[_0x7fdf('0x13')](_0x7fdf('0x11'),auth[_0x7fdf('0xa')](),controller[_0x7fdf('0x16')]);router[_0x7fdf('0x17')](_0x7fdf('0x18'),auth[_0x7fdf('0xa')](),controller[_0x7fdf('0x19')]);router['delete'](_0x7fdf('0x18'),auth[_0x7fdf('0xa')](),controller[_0x7fdf('0x1a')]);router[_0x7fdf('0x1b')](_0x7fdf('0x10'),auth[_0x7fdf('0xa')](),controller[_0x7fdf('0x1c')]);router[_0x7fdf('0x1b')]('/:id/users',auth[_0x7fdf('0xa')](),controller[_0x7fdf('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 17228c9..d61b728 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 _0x8cda=['STRING','name','INTEGER','ENUM','beepall','roundrobin','exports'];(function(_0xb98530,_0x2fdf00){var _0x288edb=function(_0x4b37cb){while(--_0x4b37cb){_0xb98530['push'](_0xb98530['shift']());}};_0x288edb(++_0x2fdf00);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xa8cd('0x0')]={'name':{'type':Sequelize[_0xa8cd('0x1')],'unique':_0xa8cd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa8cd('0x1')]},'timeout':{'type':Sequelize[_0xa8cd('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa8cd('0x4')]('rrmemory',_0xa8cd('0x5'),_0xa8cd('0x6'))}}; \ No newline at end of file +var _0x9962=['name','ENUM','beepall','roundrobin','sequelize','STRING'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0x9962,0xb8));var _0x2996=function(_0x1f3841,_0x552ecb){_0x1f3841=_0x1f3841-0x0;var _0x5adaa2=_0x9962[_0x1f3841];return _0x5adaa2;};'use strict';var Sequelize=require(_0x2996('0x0'));module['exports']={'name':{'type':Sequelize[_0x2996('0x1')],'unique':_0x2996('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2996('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2996('0x3')]('rrmemory',_0x2996('0x4'),_0x2996('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 1f1729f..bb87ce3 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 _0xd94c=['fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','get','UserProfileSection','autoAssociation','UserProfileResource','update','describe','getMembers','UserMailQueue','User','findAndCountAll','UserId','mailPause','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','compact','removeAgents','forEach','userMailQueue:remove','omit','spread','userMailQueue:save','isArray','findOne','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','MailQueues','destroy','end','sendStatus','error','stack','name','index','MailQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection'];(function(_0x163042,_0x13c54a){var _0x26d32f=function(_0xb29161){while(--_0xb29161){_0x163042['push'](_0x163042['shift']());}};_0x26d32f(++_0x13c54a);}(_0xd94c,0x163));var _0xcd94=function(_0x2a08f7,_0x129d69){_0x2a08f7=_0x2a08f7-0x0;var _0x292142=_0xd94c[_0x2a08f7];return _0x292142;};'use strict';var pdf=require(_0xcd94('0x0'));var emlformat=require(_0xcd94('0x1'));var rimraf=require(_0xcd94('0x2'));var zipdir=require(_0xcd94('0x3'));var jsonpatch=require(_0xcd94('0x4'));var rp=require(_0xcd94('0x5'));var moment=require(_0xcd94('0x6'));var BPromise=require(_0xcd94('0x7'));var Mustache=require(_0xcd94('0x8'));var util=require('util');var path=require(_0xcd94('0x9'));var sox=require(_0xcd94('0xa'));var csv=require(_0xcd94('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd94('0xc'));var squel=require(_0xcd94('0xd'));var crypto=require(_0xcd94('0xe'));var jsforce=require(_0xcd94('0xf'));var deskjs=require(_0xcd94('0x10'));var toCsv=require(_0xcd94('0xb'));var querystring=require(_0xcd94('0x11'));var Papa=require(_0xcd94('0x12'));var Redis=require(_0xcd94('0x13'));var authService=require(_0xcd94('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcd94('0x15'));var hardwareService=require(_0xcd94('0x16'));var logger=require('../../config/logger')(_0xcd94('0x17'));var utils=require(_0xcd94('0x18'));var config=require(_0xcd94('0x19'));var db=require(_0xcd94('0x1a'))['db'];config[_0xcd94('0x1b')]=_[_0xcd94('0x1c')](config['redis'],{'host':_0xcd94('0x1d'),'port':0x18eb});var socket=require(_0xcd94('0x1e'))(new Redis(config[_0xcd94('0x1b')]));require(_0xcd94('0x1f'))[_0xcd94('0x20')](socket);function respondWithStatusCode(_0x19a371,_0xe2f3c6){_0xe2f3c6=_0xe2f3c6||0xcc;return function(_0x2f4cbd){if(_0x2f4cbd){return _0x19a371['sendStatus'](_0xe2f3c6);}return _0x19a371['status'](_0xe2f3c6)['end']();};}function respondWithResult(_0x374a02,_0x32db73){_0x32db73=_0x32db73||0xc8;return function(_0x3b5555){if(_0x3b5555){return _0x374a02['status'](_0x32db73)[_0xcd94('0x21')](_0x3b5555);}};}function respondWithFilteredResult(_0x42b9d8,_0x355558){return function(_0x37d7a0){if(_0x37d7a0){var _0x4e1acd=_0x37d7a0[_0xcd94('0x22')],_0x292055=_0x355558[_0xcd94('0x23')],_0x30daa4=_0x355558[_0xcd94('0x23')]+_0x355558[_0xcd94('0x24')],_0x50a112;if(_0x30daa4>=_0x4e1acd){_0x30daa4=_0x4e1acd;_0x50a112=0xc8;}else{_0x50a112=0xce;}_0x42b9d8[_0xcd94('0x25')](_0x50a112);return _0x42b9d8[_0xcd94('0x26')](_0xcd94('0x27'),_0x292055+'-'+_0x30daa4+'/'+_0x4e1acd)['json'](_0x37d7a0);}return null;};}function patchUpdates(_0x53d4a6){return function(_0x15a72e){try{jsonpatch[_0xcd94('0x28')](_0x15a72e,_0x53d4a6,!![]);}catch(_0xccc43e){return BPromise[_0xcd94('0x29')](_0xccc43e);}return _0x15a72e[_0xcd94('0x2a')]();};}function saveUpdates(_0x1ace5c,_0x4dfbbc){return function(_0x1db5d3){if(_0x1db5d3){return _0x1db5d3['update'](_0x1ace5c)[_0xcd94('0x2b')](function(_0x41af75){return _0x41af75;});}return null;};}function removeEntity(_0xa61e97,_0x3f8c63){return function(_0x2cd70c){if(_0x2cd70c){return _0x2cd70c['destroy']()[_0xcd94('0x2b')](function(){var _0x26589f=_0x2cd70c['get']({'plain':!![]});var _0xea18ae=_0xcd94('0x2c');return db['UserProfileResource'][_0xcd94('0x2d')]({'where':{'type':_0xea18ae,'resourceId':_0x26589f['id']}})[_0xcd94('0x2b')](function(){return _0x2cd70c;});})['then'](function(){_0xa61e97['status'](0xcc)[_0xcd94('0x2e')]();});}};}function handleEntityNotFound(_0x4892fc,_0x2de3af){return function(_0x4e8d1d){if(!_0x4e8d1d){_0x4892fc[_0xcd94('0x2f')](0x194);}return _0x4e8d1d;};}function handleError(_0x5e0bcd,_0x681e38){_0x681e38=_0x681e38||0x1f4;return function(_0x151f71){logger[_0xcd94('0x30')](_0x151f71[_0xcd94('0x31')]);if(_0x151f71[_0xcd94('0x32')]){delete _0x151f71[_0xcd94('0x32')];}_0x5e0bcd[_0xcd94('0x25')](_0x681e38)['send'](_0x151f71);};}exports[_0xcd94('0x33')]=function(_0x4bc0a4,_0x2bd383){var _0x1fd409={},_0x1134d3={},_0x3f5b53={'count':0x0,'rows':[]};var _0x191533=_['map'](db[_0xcd94('0x34')][_0xcd94('0x35')],function(_0x3658c1){return{'name':_0x3658c1[_0xcd94('0x36')],'type':_0x3658c1[_0xcd94('0x37')]['key']};});_0x1134d3[_0xcd94('0x38')]=_[_0xcd94('0x39')](_0x191533,_0xcd94('0x32'));_0x1134d3[_0xcd94('0x3a')]=_[_0xcd94('0x3b')](_0x4bc0a4[_0xcd94('0x3a')]);_0x1134d3[_0xcd94('0x3c')]=_[_0xcd94('0x3d')](_0x1134d3[_0xcd94('0x38')],_0x1134d3[_0xcd94('0x3a')]);_0x1fd409['attributes']=_[_0xcd94('0x3d')](_0x1134d3[_0xcd94('0x38')],qs[_0xcd94('0x3e')](_0x4bc0a4[_0xcd94('0x3a')][_0xcd94('0x3e')]));_0x1fd409['attributes']=_0x1fd409['attributes'][_0xcd94('0x3f')]?_0x1fd409[_0xcd94('0x40')]:_0x1134d3[_0xcd94('0x38')];if(!_0x4bc0a4[_0xcd94('0x3a')][_0xcd94('0x41')](_0xcd94('0x42'))){_0x1fd409[_0xcd94('0x24')]=qs[_0xcd94('0x24')](_0x4bc0a4[_0xcd94('0x3a')]['limit']);_0x1fd409[_0xcd94('0x23')]=qs['offset'](_0x4bc0a4[_0xcd94('0x3a')][_0xcd94('0x23')]);}_0x1fd409[_0xcd94('0x43')]=qs['sort'](_0x4bc0a4[_0xcd94('0x3a')][_0xcd94('0x44')]);_0x1fd409['where']=qs['filters'](_[_0xcd94('0x45')](_0x4bc0a4['query'],_0x1134d3['filters']),_0x191533);if(_0x4bc0a4[_0xcd94('0x3a')][_0xcd94('0x46')]){_0x1fd409[_0xcd94('0x47')]=_[_0xcd94('0x48')](_0x1fd409[_0xcd94('0x47')],{'$or':_['map'](_0x191533,function(_0x3e5e66){if(_0x3e5e66[_0xcd94('0x37')]!==_0xcd94('0x49')){var _0x148f6={};_0x148f6[_0x3e5e66['name']]={'$like':'%'+_0x4bc0a4['query']['filter']+'%'};return _0x148f6;}})});}_0x1fd409=_['merge']({},_0x1fd409,_0x4bc0a4[_0xcd94('0x4a')]);var _0x286a34={'where':_0x1fd409['where']};return db[_0xcd94('0x34')][_0xcd94('0x22')](_0x286a34)[_0xcd94('0x2b')](function(_0x3a058b){_0x3f5b53[_0xcd94('0x22')]=_0x3a058b;if(_0x4bc0a4[_0xcd94('0x3a')][_0xcd94('0x4b')]){_0x1fd409[_0xcd94('0x4c')]=[{'all':!![]}];}return db['MailQueue'][_0xcd94('0x4d')](_0x1fd409);})[_0xcd94('0x2b')](function(_0x4dcc93){_0x3f5b53['rows']=_0x4dcc93;return _0x3f5b53;})[_0xcd94('0x2b')](respondWithFilteredResult(_0x2bd383,_0x1fd409))['catch'](handleError(_0x2bd383,null));};exports[_0xcd94('0x4e')]=function(_0x27544c,_0x5a7ad6){var _0x29a2ae={'raw':!![],'where':{'id':_0x27544c[_0xcd94('0x4f')]['id']}},_0x263c60={};_0x263c60[_0xcd94('0x38')]=_['keys'](db[_0xcd94('0x34')]['rawAttributes']);_0x263c60[_0xcd94('0x3a')]=_[_0xcd94('0x3b')](_0x27544c[_0xcd94('0x3a')]);_0x263c60[_0xcd94('0x3c')]=_[_0xcd94('0x3d')](_0x263c60[_0xcd94('0x38')],_0x263c60[_0xcd94('0x3a')]);_0x29a2ae['attributes']=_['intersection'](_0x263c60[_0xcd94('0x38')],qs['fields'](_0x27544c[_0xcd94('0x3a')][_0xcd94('0x3e')]));_0x29a2ae['attributes']=_0x29a2ae[_0xcd94('0x40')][_0xcd94('0x3f')]?_0x29a2ae[_0xcd94('0x40')]:_0x263c60['model'];if(_0x27544c[_0xcd94('0x3a')][_0xcd94('0x4b')]){_0x29a2ae['include']=[{'all':!![]}];}_0x29a2ae=_['merge']({},_0x29a2ae,_0x27544c[_0xcd94('0x4a')]);return db[_0xcd94('0x34')][_0xcd94('0x50')](_0x29a2ae)[_0xcd94('0x2b')](handleEntityNotFound(_0x5a7ad6,null))[_0xcd94('0x2b')](respondWithResult(_0x5a7ad6,null))[_0xcd94('0x51')](handleError(_0x5a7ad6,null));};exports[_0xcd94('0x52')]=function(_0x419b9d,_0x26db60){return db[_0xcd94('0x34')][_0xcd94('0x52')](_0x419b9d[_0xcd94('0x53')],{})[_0xcd94('0x2b')](function(_0x610229){var _0x5549b3=_0x419b9d['user'][_0xcd94('0x54')]({'plain':!![]});if(!_0x5549b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5549b3['role']==='user'){var _0xff9af7=_0x610229[_0xcd94('0x54')]({'plain':!![]});var _0x4390f7='MailQueues';return db[_0xcd94('0x55')][_0xcd94('0x50')]({'where':{'name':_0x4390f7,'userProfileId':_0x5549b3['userProfileId']},'raw':!![]})[_0xcd94('0x2b')](function(_0x1f6692){if(_0x1f6692&&_0x1f6692[_0xcd94('0x56')]===0x0){return db[_0xcd94('0x57')][_0xcd94('0x52')]({'name':_0xff9af7[_0xcd94('0x32')],'resourceId':_0xff9af7['id'],'type':_0x1f6692[_0xcd94('0x32')],'sectionId':_0x1f6692['id']},{})['then'](function(){return _0x610229;});}else{return _0x610229;}})[_0xcd94('0x51')](function(_0xe378c9){logger[_0xcd94('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe378c9);throw _0xe378c9;});}return _0x610229;})[_0xcd94('0x2b')](respondWithResult(_0x26db60,0xc9))[_0xcd94('0x51')](handleError(_0x26db60,null));};exports[_0xcd94('0x58')]=function(_0x117f3f,_0x401994){if(_0x117f3f[_0xcd94('0x53')]['id']){delete _0x117f3f['body']['id'];}return db[_0xcd94('0x34')][_0xcd94('0x50')]({'where':{'id':_0x117f3f[_0xcd94('0x4f')]['id']}})['then'](handleEntityNotFound(_0x401994,null))[_0xcd94('0x2b')](saveUpdates(_0x117f3f[_0xcd94('0x53')],null))[_0xcd94('0x2b')](respondWithResult(_0x401994,null))[_0xcd94('0x51')](handleError(_0x401994,null));};exports['destroy']=function(_0x462941,_0x1c4685){return db[_0xcd94('0x34')][_0xcd94('0x50')]({'where':{'id':_0x462941[_0xcd94('0x4f')]['id']}})[_0xcd94('0x2b')](handleEntityNotFound(_0x1c4685,null))[_0xcd94('0x2b')](removeEntity(_0x1c4685,null))[_0xcd94('0x51')](handleError(_0x1c4685,null));};exports[_0xcd94('0x59')]=function(_0x27fc1c,_0x5e060e){return db[_0xcd94('0x34')]['describe']()[_0xcd94('0x2b')](respondWithResult(_0x5e060e,null))[_0xcd94('0x51')](handleError(_0x5e060e,null));};exports[_0xcd94('0x5a')]=function(_0x252408,_0x21bd54,_0x1d05c0){var _0x272e5e={'raw':!![],'where':{}},_0x138d3a={},_0x57afc2;return db[_0xcd94('0x34')]['findOne']({'where':{'id':_0x252408[_0xcd94('0x4f')]['id']}})['then'](handleEntityNotFound(_0x21bd54,null))['then'](function(_0x86a46a){if(_0x86a46a){_0x57afc2=_0x86a46a['get']({'plain':!![]});_0x138d3a[_0xcd94('0x38')]=_[_0xcd94('0x3b')](db[_0xcd94('0x5b')][_0xcd94('0x35')]);_0x138d3a[_0xcd94('0x3a')]=_[_0xcd94('0x3b')](_0x252408[_0xcd94('0x3a')]);_0x138d3a['filters']=_[_0xcd94('0x3d')](_0x138d3a[_0xcd94('0x38')],_0x138d3a[_0xcd94('0x3a')]);_0x272e5e[_0xcd94('0x40')]=_['intersection'](_0x138d3a[_0xcd94('0x38')],qs[_0xcd94('0x3e')](_0x252408[_0xcd94('0x3a')][_0xcd94('0x3e')]));_0x272e5e[_0xcd94('0x40')]=_0x272e5e[_0xcd94('0x40')][_0xcd94('0x3f')]?_0x272e5e[_0xcd94('0x40')]:_0x138d3a[_0xcd94('0x38')];if(!_0x252408['query'][_0xcd94('0x41')](_0xcd94('0x42'))){_0x272e5e[_0xcd94('0x24')]=qs['limit'](_0x252408[_0xcd94('0x3a')]['limit']);_0x272e5e['offset']=qs[_0xcd94('0x23')](_0x252408[_0xcd94('0x3a')][_0xcd94('0x23')]);}_0x272e5e[_0xcd94('0x43')]=qs['sort'](_0x252408[_0xcd94('0x3a')][_0xcd94('0x44')]);_0x272e5e[_0xcd94('0x47')]=qs['filters'](_[_0xcd94('0x45')](_0x252408[_0xcd94('0x3a')],_0x138d3a[_0xcd94('0x3c')]));_0x272e5e[_0xcd94('0x47')]['MailQueueId']=_0x86a46a['id'];if(_0x252408['query'][_0xcd94('0x46')]){_0x272e5e[_0xcd94('0x47')]=_[_0xcd94('0x48')](_0x272e5e[_0xcd94('0x47')],{'$or':_[_0xcd94('0x39')](_0x272e5e[_0xcd94('0x40')],function(_0x2e779f){var _0x199510={};_0x199510[_0x2e779f]={'$like':'%'+_0x252408[_0xcd94('0x3a')][_0xcd94('0x46')]+'%'};return _0x199510;})});}_0x272e5e=_[_0xcd94('0x48')]({},_0x272e5e,_0x252408[_0xcd94('0x4a')]);return db[_0xcd94('0x5b')][_0xcd94('0x4d')](_0x272e5e);}})[_0xcd94('0x2b')](function(_0x2f74ed){if(_0x2f74ed){return db[_0xcd94('0x5c')][_0xcd94('0x5d')]({'where':{'id':_[_0xcd94('0x39')](_0x2f74ed,_0xcd94('0x5e')),'role':'agent'},'attributes':['id',_0xcd94('0x32'),_0xcd94('0x5f'),'updatedAt','createdAt']});}})['then'](function(_0x121054){if(_0x121054){return{'count':_0x121054[_0xcd94('0x22')],'rows':_[_0xcd94('0x39')](_0x121054['rows'],function(_0x49057c){return{'membername':_0x49057c[_0xcd94('0x32')],'UserId':_0x49057c['id'],'queue_name':_0x57afc2[_0xcd94('0x32')],'MailQueueId':_0x57afc2['id'],'interface':util[_0xcd94('0x60')](_0xcd94('0x61'),_0xcd94('0x62'),_0x49057c['name']),'penalty':0x0,'paused':_0x49057c[_0xcd94('0x5f')],'createdAt':_0x49057c['createdAt'],'updatedAt':_0x49057c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xcd94('0x2b')](respondWithFilteredResult(_0x21bd54,_0x272e5e))[_0xcd94('0x51')](handleError(_0x21bd54,null));};exports['getTeams']=function(_0x3f16d6,_0x2284b5,_0x331c47){var _0x46c4e0={};var _0x27e2db={};var _0x696ebc;var _0x4194ec;return db[_0xcd94('0x34')]['findOne']({'where':{'id':_0x3f16d6['params']['id']}})['then'](handleEntityNotFound(_0x2284b5,null))['then'](function(_0x334c0f){if(_0x334c0f){_0x696ebc=_0x334c0f;_0x27e2db[_0xcd94('0x38')]=_['keys'](db[_0xcd94('0x63')][_0xcd94('0x35')]);_0x27e2db['query']=_[_0xcd94('0x3b')](_0x3f16d6[_0xcd94('0x3a')]);_0x27e2db[_0xcd94('0x3c')]=_[_0xcd94('0x3d')](_0x27e2db[_0xcd94('0x38')],_0x27e2db[_0xcd94('0x3a')]);_0x46c4e0[_0xcd94('0x40')]=_[_0xcd94('0x3d')](_0x27e2db['model'],qs['fields'](_0x3f16d6[_0xcd94('0x3a')]['fields']));_0x46c4e0['attributes']=_0x46c4e0[_0xcd94('0x40')]['length']?_0x46c4e0[_0xcd94('0x40')]:_0x27e2db[_0xcd94('0x38')];_0x46c4e0['order']=qs[_0xcd94('0x44')](_0x3f16d6[_0xcd94('0x3a')][_0xcd94('0x44')]);_0x46c4e0[_0xcd94('0x47')]=qs[_0xcd94('0x3c')](_[_0xcd94('0x45')](_0x3f16d6[_0xcd94('0x3a')],_0x27e2db[_0xcd94('0x3c')]));if(_0x3f16d6[_0xcd94('0x3a')][_0xcd94('0x46')]){_0x46c4e0[_0xcd94('0x47')]=_[_0xcd94('0x48')](_0x46c4e0['where'],{'$or':_['map'](_0x46c4e0[_0xcd94('0x40')],function(_0x441093){var _0x4848ff={};_0x4848ff[_0x441093]={'$like':'%'+_0x3f16d6[_0xcd94('0x3a')]['filter']+'%'};return _0x4848ff;})});}_0x46c4e0=_[_0xcd94('0x48')]({},_0x46c4e0,_0x3f16d6[_0xcd94('0x4a')]);return _0x696ebc['getTeams'](_0x46c4e0);}})[_0xcd94('0x2b')](function(_0x552f6c){if(_0x552f6c){_0x4194ec=_0x552f6c[_0xcd94('0x3f')];if(!_0x3f16d6['query']['hasOwnProperty'](_0xcd94('0x42'))){_0x46c4e0[_0xcd94('0x24')]=qs['limit'](_0x3f16d6[_0xcd94('0x3a')][_0xcd94('0x24')]);_0x46c4e0[_0xcd94('0x23')]=qs['offset'](_0x3f16d6[_0xcd94('0x3a')]['offset']);}return _0x696ebc[_0xcd94('0x64')](_0x46c4e0);}})[_0xcd94('0x2b')](function(_0x585757){if(_0x585757){return _0x585757?{'count':_0x4194ec,'rows':_0x585757}:null;}})[_0xcd94('0x2b')](respondWithResult(_0x2284b5,null))[_0xcd94('0x51')](handleError(_0x2284b5,null));};exports[_0xcd94('0x65')]=function(_0x146b69,_0x284d89,_0x59f777){var _0x3f5a0b=_0x146b69[_0xcd94('0x53')][_0xcd94('0x66')];return db[_0xcd94('0x63')][_0xcd94('0x4d')]({'where':{'id':_0x3f5a0b},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcd94('0x67'),'attributes':['id',_0xcd94('0x32'),_0xcd94('0x68'),_0xcd94('0x69'),_0xcd94('0x6a')],'raw':!![]}]})[_0xcd94('0x2b')](function(_0x2efed5){if(_0x2efed5){var _0x56bb28=_['flatMap'](_0x2efed5,function(_0x58189f){var _0x3d3638=_0x58189f[_0xcd94('0x54')]({'plain':!![]});return _0x3d3638[_0xcd94('0x67')];});return db[_0xcd94('0x34')][_0xcd94('0x50')]({'where':{'id':_0x146b69['params']['id']}})[_0xcd94('0x2b')](function(_0x19f4ef){return db[_0xcd94('0x6b')][_0xcd94('0x6c')](function(_0x2fef64){return _0x19f4ef[_0xcd94('0x65')](_0x3f5a0b,{'transaction':_0x2fef64})['then'](function(){return BPromise[_0xcd94('0x6d')](_0x56bb28,function(_0x36abc6){return db['UserMailQueue'][_0xcd94('0x6e')]({'where':{'UserId':_0x36abc6['id'],'MailQueueId':_0x146b69['params']['id']},'transaction':_0x2fef64});});})[_0xcd94('0x2b')](function(){_0x56bb28['forEach'](function(_0x1589a2){socket[_0xcd94('0x6f')]('userMailQueue:save',{'UserId':_0x1589a2['id'],'MailQueueId':_0x19f4ef['id']});});});});});}})[_0xcd94('0x2b')](respondWithStatusCode(_0x284d89,null))[_0xcd94('0x51')](handleError(_0x284d89,null));};exports[_0xcd94('0x70')]=function(_0x575529,_0x240c16,_0x549b2b){return db[_0xcd94('0x63')]['findAll']({'where':{'id':_0x575529[_0xcd94('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcd94('0x67'),'attributes':['id'],'raw':!![]}]})[_0xcd94('0x2b')](handleEntityNotFound(_0x240c16,null))['then'](function(_0x54ae97){var _0x419dff=_['map'](_0x54ae97,'id');var _0x168b30=[];var _0x4ea1ef=[];var _0x24486f=squel[_0xcd94('0x71')]();_0x24486f[_0xcd94('0x72')](_0xcd94('0x73'))[_0xcd94('0x74')](_0xcd94('0x75'),'tq')[_0xcd94('0x76')](_0xcd94('0x77'),'ut',_0xcd94('0x78'))[_0xcd94('0x47')]('MailQueueId\x20=\x20?',_0x575529['params']['id']);for(var _0x59085c=0x0;_0x59085c<_0x54ae97[_0xcd94('0x3f')];_0x59085c+=0x1){let _0x1031c8=_0x54ae97[_0x59085c];for(var _0x62e833=0x0;_0x62e833<_0x1031c8[_0xcd94('0x67')]['length'];_0x62e833+=0x1){let _0x56f454=_0x1031c8[_0xcd94('0x67')][_0x62e833];var _0x11f462=_0x24486f[_0xcd94('0x79')]();_0x11f462[_0xcd94('0x47')](_0xcd94('0x7a'),_0x56f454['id']);_0x4ea1ef[_0xcd94('0x7b')](db['sequelize'][_0xcd94('0x3a')](_0x11f462[_0xcd94('0x7c')](),{'type':db[_0xcd94('0x6b')]['QueryTypes']['SELECT']})[_0xcd94('0x2b')](function(_0x23e4ab){if(_0x23e4ab[_0xcd94('0x3f')]===0x1){return _0x56f454['id'];}else{var _0x2f5d67=_[_0xcd94('0x7d')](_[_0xcd94('0x39')](_0x23e4ab,_0xcd94('0x7e')),function(_0x151b32){return _[_0xcd94('0x7f')](_0x419dff,_0x151b32);});if(_0x2f5d67){return _0x56f454['id'];}}}));}}return BPromise[_0xcd94('0x80')](_0x4ea1ef)[_0xcd94('0x2b')](function(_0x14f0fc){_0x168b30=_(_0x168b30)['union'](_0x14f0fc)[_0xcd94('0x81')]()['value']();return db['MailQueue'][_0xcd94('0x50')]({'where':{'id':_0x575529[_0xcd94('0x4f')]['id']}})[_0xcd94('0x2b')](function(_0x1647a6){return db[_0xcd94('0x6b')][_0xcd94('0x6c')](function(_0x13cf7f){return _0x1647a6['removeTeams'](_0x575529[_0xcd94('0x3a')]['ids'],{'transaction':_0x13cf7f})[_0xcd94('0x2b')](function(){if(!_['isEmpty'](_0x168b30)){return _0x1647a6[_0xcd94('0x82')](_0x168b30,{'transaction':_0x13cf7f});}})[_0xcd94('0x2b')](function(){_0x168b30[_0xcd94('0x83')](function(_0x2717ac){socket[_0xcd94('0x6f')](_0xcd94('0x84'),{'UserId':_0x2717ac,'MailQueueId':_0x1647a6['id']});});});});});});})[_0xcd94('0x2b')](respondWithStatusCode(_0x240c16,null))[_0xcd94('0x51')](handleError(_0x240c16,null));};exports['addAgents']=function(_0x3ec4a7,_0x12de1d,_0xf50520){return db[_0xcd94('0x34')][_0xcd94('0x50')]({'where':{'id':_0x3ec4a7[_0xcd94('0x4f')]['id']}})[_0xcd94('0x2b')](handleEntityNotFound(_0x12de1d,null))['then'](function(_0x4cf273){if(_0x4cf273){return _0x4cf273['addAgents'](_0x3ec4a7[_0xcd94('0x53')]['ids'],_[_0xcd94('0x85')](_0x3ec4a7['body'],['ids','id'])||{})[_0xcd94('0x86')](function(_0x14075d){for(var _0x3b2a11=0x0;_0x3b2a11<_0x3ec4a7['body'][_0xcd94('0x66')][_0xcd94('0x3f')];_0x3b2a11+=0x1){socket[_0xcd94('0x6f')](_0xcd94('0x87'),{'UserId':_0x3ec4a7[_0xcd94('0x53')][_0xcd94('0x66')][_0x3b2a11],'MailQueueId':_0x3ec4a7['params']['id']});}return _0x14075d;});}})[_0xcd94('0x2b')](respondWithResult(_0x12de1d,null))[_0xcd94('0x51')](handleError(_0x12de1d,null));};exports[_0xcd94('0x82')]=function(_0x473fe3,_0x333967,_0x1e9577){return db[_0xcd94('0x34')]['find']({'where':{'id':_0x473fe3['params']['id']}})[_0xcd94('0x2b')](handleEntityNotFound(_0x333967,null))[_0xcd94('0x2b')](function(_0x51a5ff){if(_0x51a5ff){return _0x51a5ff[_0xcd94('0x82')](_0x473fe3[_0xcd94('0x3a')]['ids'])['then'](function(){if(_[_0xcd94('0x88')](_0x473fe3[_0xcd94('0x3a')][_0xcd94('0x66')])){for(var _0x129db7=0x0;_0x129db7<_0x473fe3[_0xcd94('0x3a')][_0xcd94('0x66')][_0xcd94('0x3f')];_0x129db7+=0x1){socket[_0xcd94('0x6f')]('userMailQueue:remove',{'UserId':Number(_0x473fe3[_0xcd94('0x3a')][_0xcd94('0x66')][_0x129db7]),'MailQueueId':Number(_0x473fe3[_0xcd94('0x4f')]['id'])});}}else{socket['emit'](_0xcd94('0x84'),{'UserId':Number(_0x473fe3[_0xcd94('0x3a')]['ids']),'MailQueueId':Number(_0x473fe3[_0xcd94('0x4f')]['id'])});}});}})[_0xcd94('0x2b')](respondWithStatusCode(_0x333967,null))[_0xcd94('0x51')](handleError(_0x333967,null));};exports['getAgents']=function(_0x2f5b77,_0x5c07d7,_0x52f1c9){var _0x1b74e6={};var _0x6e9a34={};var _0x561dda;var _0x35f44c;return db[_0xcd94('0x34')][_0xcd94('0x89')]({'where':{'id':_0x2f5b77[_0xcd94('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c07d7,null))[_0xcd94('0x2b')](function(_0x510497){if(_0x510497){_0x561dda=_0x510497;_0x6e9a34[_0xcd94('0x38')]=_[_0xcd94('0x3b')](db[_0xcd94('0x5c')][_0xcd94('0x35')]);_0x6e9a34['query']=_[_0xcd94('0x3b')](_0x2f5b77[_0xcd94('0x3a')]);_0x6e9a34['filters']=_['intersection'](_0x6e9a34['model'],_0x6e9a34['query']);_0x1b74e6[_0xcd94('0x40')]=_['intersection'](_0x6e9a34[_0xcd94('0x38')],qs[_0xcd94('0x3e')](_0x2f5b77[_0xcd94('0x3a')]['fields']));_0x1b74e6[_0xcd94('0x40')]=_0x1b74e6[_0xcd94('0x40')]['length']?_0x1b74e6['attributes']:_0x6e9a34[_0xcd94('0x38')];_0x1b74e6[_0xcd94('0x43')]=qs[_0xcd94('0x44')](_0x2f5b77[_0xcd94('0x3a')][_0xcd94('0x44')]);_0x1b74e6[_0xcd94('0x47')]=qs[_0xcd94('0x3c')](_[_0xcd94('0x45')](_0x2f5b77[_0xcd94('0x3a')],_0x6e9a34['filters']));if(_0x2f5b77[_0xcd94('0x3a')]['filter']){_0x1b74e6[_0xcd94('0x47')]=_[_0xcd94('0x48')](_0x1b74e6[_0xcd94('0x47')],{'$or':_['map'](_0x1b74e6[_0xcd94('0x40')],function(_0x3054d9){var _0x3ad0d9={};_0x3ad0d9[_0x3054d9]={'$like':'%'+_0x2f5b77['query']['filter']+'%'};return _0x3ad0d9;})});}_0x1b74e6=_[_0xcd94('0x48')]({},_0x1b74e6,_0x2f5b77[_0xcd94('0x4a')]);return _0x561dda[_0xcd94('0x8a')](_0x1b74e6);}})[_0xcd94('0x2b')](function(_0x11fa96){if(_0x11fa96){_0x35f44c=_0x11fa96[_0xcd94('0x3f')];if(!_0x2f5b77[_0xcd94('0x3a')][_0xcd94('0x41')](_0xcd94('0x42'))){_0x1b74e6[_0xcd94('0x24')]=qs['limit'](_0x2f5b77[_0xcd94('0x3a')][_0xcd94('0x24')]);_0x1b74e6[_0xcd94('0x23')]=qs[_0xcd94('0x23')](_0x2f5b77[_0xcd94('0x3a')][_0xcd94('0x23')]);}return _0x561dda[_0xcd94('0x8a')](_0x1b74e6);}})[_0xcd94('0x2b')](function(_0x39e6fc){if(_0x39e6fc){return _0x39e6fc?{'count':_0x35f44c,'rows':_0x39e6fc}:null;}})[_0xcd94('0x2b')](respondWithResult(_0x5c07d7,null))[_0xcd94('0x51')](handleError(_0x5c07d7,null));}; \ No newline at end of file +var _0x65d7=['findAndCountAll','UserId','mailPause','createdAt','format','%s/%s','updatedAt','length','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','MailQueue','includeAll','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','destroy','describe','getMembers','findOne','UserMailQueue','nolimit','pick','User'];(function(_0xd206ce,_0x3031d2){var _0x5b3ec6=function(_0x526993){while(--_0x526993){_0xd206ce['push'](_0xd206ce['shift']());}};_0x5b3ec6(++_0x3031d2);}(_0x65d7,0xc2));var _0x765d=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0x65d7[_0xa4928c];return _0x27cc29;};'use strict';var pdf=require(_0x765d('0x0'));var emlformat=require(_0x765d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x765d('0x2'));var rp=require(_0x765d('0x3'));var moment=require(_0x765d('0x4'));var BPromise=require(_0x765d('0x5'));var Mustache=require('mustache');var util=require(_0x765d('0x6'));var path=require(_0x765d('0x7'));var sox=require(_0x765d('0x8'));var csv=require(_0x765d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x765d('0xa'));var crypto=require(_0x765d('0xb'));var jsforce=require(_0x765d('0xc'));var deskjs=require(_0x765d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x765d('0xe'));var Papa=require(_0x765d('0xf'));var Redis=require(_0x765d('0x10'));var authService=require(_0x765d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x765d('0x12'));var hardwareService=require(_0x765d('0x13'));var logger=require(_0x765d('0x14'))(_0x765d('0x15'));var utils=require(_0x765d('0x16'));var config=require(_0x765d('0x17'));var db=require(_0x765d('0x18'))['db'];config[_0x765d('0x19')]=_[_0x765d('0x1a')](config[_0x765d('0x19')],{'host':_0x765d('0x1b'),'port':0x18eb});var socket=require(_0x765d('0x1c'))(new Redis(config[_0x765d('0x19')]));require('./mailQueue.socket')[_0x765d('0x1d')](socket);function respondWithStatusCode(_0x11c89e,_0x38193b){_0x38193b=_0x38193b||0xcc;return function(_0x2bdbd0){if(_0x2bdbd0){return _0x11c89e[_0x765d('0x1e')](_0x38193b);}return _0x11c89e[_0x765d('0x1f')](_0x38193b)[_0x765d('0x20')]();};}function respondWithResult(_0x488425,_0x14fc5a){_0x14fc5a=_0x14fc5a||0xc8;return function(_0x85f152){if(_0x85f152){return _0x488425[_0x765d('0x1f')](_0x14fc5a)['json'](_0x85f152);}};}function respondWithFilteredResult(_0x3e7646,_0x3a71a8){return function(_0x1aeb47){if(_0x1aeb47){var _0x8269b7=_0x1aeb47[_0x765d('0x21')],_0x57cb58=_0x3a71a8[_0x765d('0x22')],_0x1143b8=_0x3a71a8['offset']+_0x3a71a8[_0x765d('0x23')],_0x1371c6;if(_0x1143b8>=_0x8269b7){_0x1143b8=_0x8269b7;_0x1371c6=0xc8;}else{_0x1371c6=0xce;}_0x3e7646[_0x765d('0x1f')](_0x1371c6);return _0x3e7646[_0x765d('0x24')](_0x765d('0x25'),_0x57cb58+'-'+_0x1143b8+'/'+_0x8269b7)['json'](_0x1aeb47);}return null;};}function patchUpdates(_0x1517a8){return function(_0x3f0092){try{jsonpatch[_0x765d('0x26')](_0x3f0092,_0x1517a8,!![]);}catch(_0x41daac){return BPromise[_0x765d('0x27')](_0x41daac);}return _0x3f0092[_0x765d('0x28')]();};}function saveUpdates(_0x4f4d9a,_0x396ac4){return function(_0x42ed00){if(_0x42ed00){return _0x42ed00['update'](_0x4f4d9a)[_0x765d('0x29')](function(_0x20dec3){return _0x20dec3;});}return null;};}function removeEntity(_0x32bb77,_0x21fcb1){return function(_0x2bd1c8){if(_0x2bd1c8){return _0x2bd1c8['destroy']()[_0x765d('0x29')](function(){var _0x2d0f53=_0x2bd1c8[_0x765d('0x2a')]({'plain':!![]});var _0x730593=_0x765d('0x2b');return db[_0x765d('0x2c')]['destroy']({'where':{'type':_0x730593,'resourceId':_0x2d0f53['id']}})['then'](function(){return _0x2bd1c8;});})['then'](function(){_0x32bb77['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41d798,_0x319ab9){return function(_0x31173f){if(!_0x31173f){_0x41d798[_0x765d('0x1e')](0x194);}return _0x31173f;};}function handleError(_0x5a81e6,_0x41b65d){_0x41b65d=_0x41b65d||0x1f4;return function(_0x531357){logger[_0x765d('0x2d')](_0x531357[_0x765d('0x2e')]);if(_0x531357[_0x765d('0x2f')]){delete _0x531357['name'];}_0x5a81e6[_0x765d('0x1f')](_0x41b65d)[_0x765d('0x30')](_0x531357);};}exports[_0x765d('0x31')]=function(_0x2dff0e,_0x55b2cf){var _0x550e79={},_0xdb0b67={},_0x2d2f3d={'count':0x0,'rows':[]};var _0x2b3787=_[_0x765d('0x32')](db['MailQueue'][_0x765d('0x33')],function(_0x4f9cab){return{'name':_0x4f9cab[_0x765d('0x34')],'type':_0x4f9cab[_0x765d('0x35')][_0x765d('0x36')]};});_0xdb0b67[_0x765d('0x37')]=_[_0x765d('0x32')](_0x2b3787,_0x765d('0x2f'));_0xdb0b67[_0x765d('0x38')]=_['keys'](_0x2dff0e[_0x765d('0x38')]);_0xdb0b67[_0x765d('0x39')]=_[_0x765d('0x3a')](_0xdb0b67[_0x765d('0x37')],_0xdb0b67['query']);_0x550e79[_0x765d('0x3b')]=_[_0x765d('0x3a')](_0xdb0b67[_0x765d('0x37')],qs[_0x765d('0x3c')](_0x2dff0e[_0x765d('0x38')][_0x765d('0x3c')]));_0x550e79[_0x765d('0x3b')]=_0x550e79['attributes']['length']?_0x550e79[_0x765d('0x3b')]:_0xdb0b67[_0x765d('0x37')];if(!_0x2dff0e[_0x765d('0x38')][_0x765d('0x3d')]('nolimit')){_0x550e79[_0x765d('0x23')]=qs[_0x765d('0x23')](_0x2dff0e[_0x765d('0x38')][_0x765d('0x23')]);_0x550e79[_0x765d('0x22')]=qs['offset'](_0x2dff0e[_0x765d('0x38')][_0x765d('0x22')]);}_0x550e79[_0x765d('0x3e')]=qs[_0x765d('0x3f')](_0x2dff0e[_0x765d('0x38')][_0x765d('0x3f')]);_0x550e79['where']=qs[_0x765d('0x39')](_['pick'](_0x2dff0e['query'],_0xdb0b67[_0x765d('0x39')]),_0x2b3787);if(_0x2dff0e['query'][_0x765d('0x40')]){_0x550e79[_0x765d('0x41')]=_['merge'](_0x550e79[_0x765d('0x41')],{'$or':_[_0x765d('0x32')](_0x2b3787,function(_0x704a34){if(_0x704a34['type']!==_0x765d('0x42')){var _0x47ab86={};_0x47ab86[_0x704a34['name']]={'$like':'%'+_0x2dff0e['query'][_0x765d('0x40')]+'%'};return _0x47ab86;}})});}_0x550e79=_[_0x765d('0x43')]({},_0x550e79,_0x2dff0e[_0x765d('0x44')]);var _0x1c056={'where':_0x550e79[_0x765d('0x41')]};return db[_0x765d('0x45')]['count'](_0x1c056)['then'](function(_0x5d84df){_0x2d2f3d[_0x765d('0x21')]=_0x5d84df;if(_0x2dff0e[_0x765d('0x38')][_0x765d('0x46')]){_0x550e79['include']=[{'all':!![]}];}return db[_0x765d('0x45')][_0x765d('0x47')](_0x550e79);})[_0x765d('0x29')](function(_0x342f31){_0x2d2f3d[_0x765d('0x48')]=_0x342f31;return _0x2d2f3d;})['then'](respondWithFilteredResult(_0x55b2cf,_0x550e79))[_0x765d('0x49')](handleError(_0x55b2cf,null));};exports[_0x765d('0x4a')]=function(_0x2ccdc8,_0x4706a9){var _0x1576ac={'raw':!![],'where':{'id':_0x2ccdc8[_0x765d('0x4b')]['id']}},_0xadfe8a={};_0xadfe8a[_0x765d('0x37')]=_['keys'](db[_0x765d('0x45')][_0x765d('0x33')]);_0xadfe8a['query']=_[_0x765d('0x4c')](_0x2ccdc8[_0x765d('0x38')]);_0xadfe8a[_0x765d('0x39')]=_[_0x765d('0x3a')](_0xadfe8a[_0x765d('0x37')],_0xadfe8a['query']);_0x1576ac[_0x765d('0x3b')]=_[_0x765d('0x3a')](_0xadfe8a[_0x765d('0x37')],qs['fields'](_0x2ccdc8[_0x765d('0x38')][_0x765d('0x3c')]));_0x1576ac[_0x765d('0x3b')]=_0x1576ac[_0x765d('0x3b')]['length']?_0x1576ac[_0x765d('0x3b')]:_0xadfe8a[_0x765d('0x37')];if(_0x2ccdc8['query'][_0x765d('0x46')]){_0x1576ac['include']=[{'all':!![]}];}_0x1576ac=_[_0x765d('0x43')]({},_0x1576ac,_0x2ccdc8[_0x765d('0x44')]);return db[_0x765d('0x45')]['find'](_0x1576ac)[_0x765d('0x29')](handleEntityNotFound(_0x4706a9,null))[_0x765d('0x29')](respondWithResult(_0x4706a9,null))[_0x765d('0x49')](handleError(_0x4706a9,null));};exports[_0x765d('0x4d')]=function(_0x451e89,_0x4fe4df){return db[_0x765d('0x45')][_0x765d('0x4d')](_0x451e89[_0x765d('0x4e')],{})[_0x765d('0x29')](function(_0x5e9320){var _0x450f74=_0x451e89[_0x765d('0x4f')]['get']({'plain':!![]});if(!_0x450f74)throw new Error(_0x765d('0x50'));if(_0x450f74[_0x765d('0x51')]===_0x765d('0x4f')){var _0xa9d7b6=_0x5e9320[_0x765d('0x2a')]({'plain':!![]});var _0x51d408=_0x765d('0x2b');return db[_0x765d('0x52')]['find']({'where':{'name':_0x51d408,'userProfileId':_0x450f74[_0x765d('0x53')]},'raw':!![]})[_0x765d('0x29')](function(_0x4deb6b){if(_0x4deb6b&&_0x4deb6b['autoAssociation']===0x0){return db[_0x765d('0x2c')][_0x765d('0x4d')]({'name':_0xa9d7b6[_0x765d('0x2f')],'resourceId':_0xa9d7b6['id'],'type':_0x4deb6b[_0x765d('0x2f')],'sectionId':_0x4deb6b['id']},{})['then'](function(){return _0x5e9320;});}else{return _0x5e9320;}})[_0x765d('0x49')](function(_0x44879f){logger[_0x765d('0x2d')](_0x765d('0x54'),_0x44879f);throw _0x44879f;});}return _0x5e9320;})[_0x765d('0x29')](respondWithResult(_0x4fe4df,0xc9))['catch'](handleError(_0x4fe4df,null));};exports['update']=function(_0x215e60,_0x266ade){if(_0x215e60['body']['id']){delete _0x215e60[_0x765d('0x4e')]['id'];}return db[_0x765d('0x45')][_0x765d('0x55')]({'where':{'id':_0x215e60['params']['id']}})[_0x765d('0x29')](handleEntityNotFound(_0x266ade,null))['then'](saveUpdates(_0x215e60[_0x765d('0x4e')],null))[_0x765d('0x29')](respondWithResult(_0x266ade,null))[_0x765d('0x49')](handleError(_0x266ade,null));};exports[_0x765d('0x56')]=function(_0x56cba5,_0xe00d2e){return db['MailQueue']['find']({'where':{'id':_0x56cba5[_0x765d('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe00d2e,null))['then'](removeEntity(_0xe00d2e,null))['catch'](handleError(_0xe00d2e,null));};exports[_0x765d('0x57')]=function(_0x109296,_0x2e06f3){return db[_0x765d('0x45')]['describe']()['then'](respondWithResult(_0x2e06f3,null))[_0x765d('0x49')](handleError(_0x2e06f3,null));};exports[_0x765d('0x58')]=function(_0x2bad2b,_0x1fcc0c,_0x45b5da){var _0x326f9b={'raw':!![],'where':{}},_0x174e46={},_0x2603d9;return db[_0x765d('0x45')][_0x765d('0x59')]({'where':{'id':_0x2bad2b[_0x765d('0x4b')]['id']}})[_0x765d('0x29')](handleEntityNotFound(_0x1fcc0c,null))[_0x765d('0x29')](function(_0x4e79ef){if(_0x4e79ef){_0x2603d9=_0x4e79ef[_0x765d('0x2a')]({'plain':!![]});_0x174e46[_0x765d('0x37')]=_[_0x765d('0x4c')](db[_0x765d('0x5a')]['rawAttributes']);_0x174e46[_0x765d('0x38')]=_[_0x765d('0x4c')](_0x2bad2b['query']);_0x174e46[_0x765d('0x39')]=_[_0x765d('0x3a')](_0x174e46['model'],_0x174e46['query']);_0x326f9b['attributes']=_[_0x765d('0x3a')](_0x174e46[_0x765d('0x37')],qs[_0x765d('0x3c')](_0x2bad2b['query'][_0x765d('0x3c')]));_0x326f9b[_0x765d('0x3b')]=_0x326f9b['attributes']['length']?_0x326f9b[_0x765d('0x3b')]:_0x174e46[_0x765d('0x37')];if(!_0x2bad2b[_0x765d('0x38')][_0x765d('0x3d')](_0x765d('0x5b'))){_0x326f9b['limit']=qs[_0x765d('0x23')](_0x2bad2b[_0x765d('0x38')][_0x765d('0x23')]);_0x326f9b['offset']=qs[_0x765d('0x22')](_0x2bad2b[_0x765d('0x38')][_0x765d('0x22')]);}_0x326f9b[_0x765d('0x3e')]=qs[_0x765d('0x3f')](_0x2bad2b['query'][_0x765d('0x3f')]);_0x326f9b[_0x765d('0x41')]=qs[_0x765d('0x39')](_[_0x765d('0x5c')](_0x2bad2b[_0x765d('0x38')],_0x174e46[_0x765d('0x39')]));_0x326f9b[_0x765d('0x41')]['MailQueueId']=_0x4e79ef['id'];if(_0x2bad2b[_0x765d('0x38')]['filter']){_0x326f9b[_0x765d('0x41')]=_[_0x765d('0x43')](_0x326f9b[_0x765d('0x41')],{'$or':_['map'](_0x326f9b[_0x765d('0x3b')],function(_0x55a644){var _0x2d9fe6={};_0x2d9fe6[_0x55a644]={'$like':'%'+_0x2bad2b['query'][_0x765d('0x40')]+'%'};return _0x2d9fe6;})});}_0x326f9b=_[_0x765d('0x43')]({},_0x326f9b,_0x2bad2b[_0x765d('0x44')]);return db[_0x765d('0x5a')][_0x765d('0x47')](_0x326f9b);}})[_0x765d('0x29')](function(_0x442d10){if(_0x442d10){return db[_0x765d('0x5d')][_0x765d('0x5e')]({'where':{'id':_['map'](_0x442d10,_0x765d('0x5f')),'role':'agent'},'attributes':['id',_0x765d('0x2f'),_0x765d('0x60'),'updatedAt',_0x765d('0x61')]});}})['then'](function(_0x4a4b3b){if(_0x4a4b3b){return{'count':_0x4a4b3b['count'],'rows':_['map'](_0x4a4b3b[_0x765d('0x48')],function(_0x4bed48){return{'membername':_0x4bed48[_0x765d('0x2f')],'UserId':_0x4bed48['id'],'queue_name':_0x2603d9[_0x765d('0x2f')],'MailQueueId':_0x2603d9['id'],'interface':util[_0x765d('0x62')](_0x765d('0x63'),'SIP',_0x4bed48[_0x765d('0x2f')]),'penalty':0x0,'paused':_0x4bed48['mailPause'],'createdAt':_0x4bed48[_0x765d('0x61')],'updatedAt':_0x4bed48[_0x765d('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1fcc0c,_0x326f9b))[_0x765d('0x49')](handleError(_0x1fcc0c,null));};exports['getTeams']=function(_0x51f026,_0x2ebb38,_0xae86f9){var _0x20b8b7={};var _0x18b125={};var _0x483f93;var _0x7daa29;return db[_0x765d('0x45')][_0x765d('0x59')]({'where':{'id':_0x51f026[_0x765d('0x4b')]['id']}})[_0x765d('0x29')](handleEntityNotFound(_0x2ebb38,null))[_0x765d('0x29')](function(_0x3abe3f){if(_0x3abe3f){_0x483f93=_0x3abe3f;_0x18b125[_0x765d('0x37')]=_[_0x765d('0x4c')](db['Team'][_0x765d('0x33')]);_0x18b125[_0x765d('0x38')]=_[_0x765d('0x4c')](_0x51f026[_0x765d('0x38')]);_0x18b125[_0x765d('0x39')]=_[_0x765d('0x3a')](_0x18b125[_0x765d('0x37')],_0x18b125[_0x765d('0x38')]);_0x20b8b7[_0x765d('0x3b')]=_[_0x765d('0x3a')](_0x18b125[_0x765d('0x37')],qs[_0x765d('0x3c')](_0x51f026[_0x765d('0x38')]['fields']));_0x20b8b7['attributes']=_0x20b8b7['attributes'][_0x765d('0x65')]?_0x20b8b7[_0x765d('0x3b')]:_0x18b125['model'];_0x20b8b7[_0x765d('0x3e')]=qs[_0x765d('0x3f')](_0x51f026[_0x765d('0x38')][_0x765d('0x3f')]);_0x20b8b7[_0x765d('0x41')]=qs[_0x765d('0x39')](_[_0x765d('0x5c')](_0x51f026[_0x765d('0x38')],_0x18b125[_0x765d('0x39')]));if(_0x51f026[_0x765d('0x38')][_0x765d('0x40')]){_0x20b8b7['where']=_[_0x765d('0x43')](_0x20b8b7['where'],{'$or':_[_0x765d('0x32')](_0x20b8b7[_0x765d('0x3b')],function(_0x478f68){var _0x234651={};_0x234651[_0x478f68]={'$like':'%'+_0x51f026[_0x765d('0x38')][_0x765d('0x40')]+'%'};return _0x234651;})});}_0x20b8b7=_['merge']({},_0x20b8b7,_0x51f026[_0x765d('0x44')]);return _0x483f93[_0x765d('0x66')](_0x20b8b7);}})[_0x765d('0x29')](function(_0x420cd6){if(_0x420cd6){_0x7daa29=_0x420cd6[_0x765d('0x65')];if(!_0x51f026['query'][_0x765d('0x3d')]('nolimit')){_0x20b8b7[_0x765d('0x23')]=qs['limit'](_0x51f026[_0x765d('0x38')][_0x765d('0x23')]);_0x20b8b7[_0x765d('0x22')]=qs[_0x765d('0x22')](_0x51f026['query'][_0x765d('0x22')]);}return _0x483f93[_0x765d('0x66')](_0x20b8b7);}})['then'](function(_0x301b7f){if(_0x301b7f){return _0x301b7f?{'count':_0x7daa29,'rows':_0x301b7f}:null;}})[_0x765d('0x29')](respondWithResult(_0x2ebb38,null))[_0x765d('0x49')](handleError(_0x2ebb38,null));};exports[_0x765d('0x67')]=function(_0x555d6d,_0x2c148c,_0x2c888f){var _0x46aeb5=_0x555d6d['body'][_0x765d('0x68')];return db[_0x765d('0x69')]['findAll']({'where':{'id':_0x46aeb5},'attributes':['id'],'include':[{'model':db[_0x765d('0x5d')],'as':_0x765d('0x6a'),'attributes':['id',_0x765d('0x2f'),_0x765d('0x6b'),'voicePause',_0x765d('0x6c')],'raw':!![]}]})[_0x765d('0x29')](function(_0x444249){if(_0x444249){var _0x376309=_[_0x765d('0x6d')](_0x444249,function(_0x32f2b9){var _0x364b8a=_0x32f2b9[_0x765d('0x2a')]({'plain':!![]});return _0x364b8a['Agents'];});return db[_0x765d('0x45')][_0x765d('0x55')]({'where':{'id':_0x555d6d[_0x765d('0x4b')]['id']}})[_0x765d('0x29')](function(_0x582121){return db[_0x765d('0x6e')][_0x765d('0x6f')](function(_0x551673){return _0x582121['addTeams'](_0x46aeb5,{'transaction':_0x551673})[_0x765d('0x29')](function(){return BPromise[_0x765d('0x70')](_0x376309,function(_0xb93be0){return db[_0x765d('0x5a')][_0x765d('0x71')]({'where':{'UserId':_0xb93be0['id'],'MailQueueId':_0x555d6d[_0x765d('0x4b')]['id']},'transaction':_0x551673});});})[_0x765d('0x29')](function(){_0x376309[_0x765d('0x72')](function(_0x1c3c72){socket[_0x765d('0x73')](_0x765d('0x74'),{'UserId':_0x1c3c72['id'],'MailQueueId':_0x582121['id']});});});});});}})[_0x765d('0x29')](respondWithStatusCode(_0x2c148c,null))['catch'](handleError(_0x2c148c,null));};exports[_0x765d('0x75')]=function(_0x3e2ace,_0x4593c6,_0x596f78){return db[_0x765d('0x69')]['findAll']({'where':{'id':_0x3e2ace['query'][_0x765d('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x765d('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4593c6,null))[_0x765d('0x29')](function(_0x142c25){var _0x51c02d=_[_0x765d('0x32')](_0x142c25,'id');var _0x14344f=[];var _0x105c57=[];var _0x2e9174=squel[_0x765d('0x76')]();_0x2e9174[_0x765d('0x77')](_0x765d('0x78'))[_0x765d('0x79')](_0x765d('0x7a'),'tq')[_0x765d('0x7b')](_0x765d('0x7c'),'ut',_0x765d('0x7d'))[_0x765d('0x41')](_0x765d('0x7e'),_0x3e2ace[_0x765d('0x4b')]['id']);for(var _0x2c9af5=0x0;_0x2c9af5<_0x142c25[_0x765d('0x65')];_0x2c9af5+=0x1){let _0xee6f0=_0x142c25[_0x2c9af5];for(var _0x162f1b=0x0;_0x162f1b<_0xee6f0[_0x765d('0x6a')][_0x765d('0x65')];_0x162f1b+=0x1){let _0x44dfba=_0xee6f0[_0x765d('0x6a')][_0x162f1b];var _0xf14b78=_0x2e9174['clone']();_0xf14b78[_0x765d('0x41')](_0x765d('0x7f'),_0x44dfba['id']);_0x105c57[_0x765d('0x80')](db[_0x765d('0x6e')]['query'](_0xf14b78[_0x765d('0x81')](),{'type':db[_0x765d('0x6e')][_0x765d('0x82')][_0x765d('0x83')]})[_0x765d('0x29')](function(_0x358967){if(_0x358967[_0x765d('0x65')]===0x1){return _0x44dfba['id'];}else{var _0x25c77d=_[_0x765d('0x84')](_['map'](_0x358967,_0x765d('0x85')),function(_0x4da6fc){return _['includes'](_0x51c02d,_0x4da6fc);});if(_0x25c77d){return _0x44dfba['id'];}}}));}}return BPromise[_0x765d('0x86')](_0x105c57)[_0x765d('0x29')](function(_0x4def98){_0x14344f=_(_0x14344f)[_0x765d('0x87')](_0x4def98)[_0x765d('0x88')]()[_0x765d('0x89')]();return db[_0x765d('0x45')]['find']({'where':{'id':_0x3e2ace[_0x765d('0x4b')]['id']}})[_0x765d('0x29')](function(_0x102bd6){return db[_0x765d('0x6e')][_0x765d('0x6f')](function(_0x5e605a){return _0x102bd6[_0x765d('0x75')](_0x3e2ace[_0x765d('0x38')]['ids'],{'transaction':_0x5e605a})[_0x765d('0x29')](function(){if(!_[_0x765d('0x8a')](_0x14344f)){return _0x102bd6[_0x765d('0x8b')](_0x14344f,{'transaction':_0x5e605a});}})[_0x765d('0x29')](function(){_0x14344f[_0x765d('0x72')](function(_0x1ea50a){socket[_0x765d('0x73')]('userMailQueue:remove',{'UserId':_0x1ea50a,'MailQueueId':_0x102bd6['id']});});});});});});})[_0x765d('0x29')](respondWithStatusCode(_0x4593c6,null))[_0x765d('0x49')](handleError(_0x4593c6,null));};exports[_0x765d('0x8c')]=function(_0xf4875c,_0xf795b0,_0x1a9a04){return db['MailQueue'][_0x765d('0x55')]({'where':{'id':_0xf4875c[_0x765d('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf795b0,null))[_0x765d('0x29')](function(_0x207e31){if(_0x207e31){return _0x207e31[_0x765d('0x8c')](_0xf4875c['body'][_0x765d('0x68')],_['omit'](_0xf4875c[_0x765d('0x4e')],[_0x765d('0x68'),'id'])||{})['spread'](function(_0x550604){for(var _0x5b9bee=0x0;_0x5b9bee<_0xf4875c[_0x765d('0x4e')][_0x765d('0x68')][_0x765d('0x65')];_0x5b9bee+=0x1){socket[_0x765d('0x73')](_0x765d('0x74'),{'UserId':_0xf4875c[_0x765d('0x4e')]['ids'][_0x5b9bee],'MailQueueId':_0xf4875c['params']['id']});}return _0x550604;});}})[_0x765d('0x29')](respondWithResult(_0xf795b0,null))[_0x765d('0x49')](handleError(_0xf795b0,null));};exports['removeAgents']=function(_0x5045bb,_0x3840de,_0x1383e6){return db[_0x765d('0x45')][_0x765d('0x55')]({'where':{'id':_0x5045bb[_0x765d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3840de,null))[_0x765d('0x29')](function(_0x5b9c21){if(_0x5b9c21){return _0x5b9c21[_0x765d('0x8b')](_0x5045bb['query'][_0x765d('0x68')])[_0x765d('0x29')](function(){if(_[_0x765d('0x8d')](_0x5045bb[_0x765d('0x38')][_0x765d('0x68')])){for(var _0x210030=0x0;_0x210030<_0x5045bb['query'][_0x765d('0x68')][_0x765d('0x65')];_0x210030+=0x1){socket[_0x765d('0x73')](_0x765d('0x8e'),{'UserId':Number(_0x5045bb['query'][_0x765d('0x68')][_0x210030]),'MailQueueId':Number(_0x5045bb[_0x765d('0x4b')]['id'])});}}else{socket[_0x765d('0x73')](_0x765d('0x8e'),{'UserId':Number(_0x5045bb[_0x765d('0x38')][_0x765d('0x68')]),'MailQueueId':Number(_0x5045bb[_0x765d('0x4b')]['id'])});}});}})[_0x765d('0x29')](respondWithStatusCode(_0x3840de,null))[_0x765d('0x49')](handleError(_0x3840de,null));};exports[_0x765d('0x8f')]=function(_0x3fb743,_0xda6252,_0x28789d){var _0x440dad={};var _0x18c2bb={};var _0x1e424e;var _0x44d536;return db[_0x765d('0x45')][_0x765d('0x59')]({'where':{'id':_0x3fb743['params']['id']}})[_0x765d('0x29')](handleEntityNotFound(_0xda6252,null))[_0x765d('0x29')](function(_0xd5b285){if(_0xd5b285){_0x1e424e=_0xd5b285;_0x18c2bb['model']=_['keys'](db[_0x765d('0x5d')]['rawAttributes']);_0x18c2bb[_0x765d('0x38')]=_[_0x765d('0x4c')](_0x3fb743[_0x765d('0x38')]);_0x18c2bb[_0x765d('0x39')]=_[_0x765d('0x3a')](_0x18c2bb[_0x765d('0x37')],_0x18c2bb[_0x765d('0x38')]);_0x440dad[_0x765d('0x3b')]=_[_0x765d('0x3a')](_0x18c2bb[_0x765d('0x37')],qs[_0x765d('0x3c')](_0x3fb743[_0x765d('0x38')][_0x765d('0x3c')]));_0x440dad[_0x765d('0x3b')]=_0x440dad[_0x765d('0x3b')]['length']?_0x440dad[_0x765d('0x3b')]:_0x18c2bb[_0x765d('0x37')];_0x440dad['order']=qs['sort'](_0x3fb743['query'][_0x765d('0x3f')]);_0x440dad[_0x765d('0x41')]=qs[_0x765d('0x39')](_[_0x765d('0x5c')](_0x3fb743[_0x765d('0x38')],_0x18c2bb['filters']));if(_0x3fb743['query']['filter']){_0x440dad[_0x765d('0x41')]=_[_0x765d('0x43')](_0x440dad[_0x765d('0x41')],{'$or':_[_0x765d('0x32')](_0x440dad[_0x765d('0x3b')],function(_0x2ebec6){var _0x2f6601={};_0x2f6601[_0x2ebec6]={'$like':'%'+_0x3fb743['query'][_0x765d('0x40')]+'%'};return _0x2f6601;})});}_0x440dad=_[_0x765d('0x43')]({},_0x440dad,_0x3fb743[_0x765d('0x44')]);return _0x1e424e[_0x765d('0x8f')](_0x440dad);}})[_0x765d('0x29')](function(_0x31054f){if(_0x31054f){_0x44d536=_0x31054f[_0x765d('0x65')];if(!_0x3fb743[_0x765d('0x38')]['hasOwnProperty'](_0x765d('0x5b'))){_0x440dad[_0x765d('0x23')]=qs[_0x765d('0x23')](_0x3fb743[_0x765d('0x38')][_0x765d('0x23')]);_0x440dad[_0x765d('0x22')]=qs['offset'](_0x3fb743['query'][_0x765d('0x22')]);}return _0x1e424e[_0x765d('0x8f')](_0x440dad);}})[_0x765d('0x29')](function(_0x46bc0e){if(_0x46bc0e){return _0x46bc0e?{'count':_0x44d536,'rows':_0x46bc0e}:null;}})[_0x765d('0x29')](respondWithResult(_0xda6252,null))[_0x765d('0x49')](handleError(_0xda6252,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7805923..581f0c2 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 _0xb2cc=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0xcaa27c,_0x9a556e){var _0x4a00df=function(_0x2ff7f8){while(--_0x2ff7f8){_0xcaa27c['push'](_0xcaa27c['shift']());}};_0x4a00df(++_0x9a556e);}(_0xb2cc,0xd8));var _0xcb2c=function(_0x2d58e6,_0x55cb14){_0x2d58e6=_0x2d58e6-0x0;var _0x5bcd81=_0xb2cc[_0x2d58e6];return _0x5bcd81;};'use strict';var EventEmitter=require(_0xcb2c('0x0'));var MailQueue=require(_0xcb2c('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xcb2c('0x2')](0x0);var events={'afterCreate':_0xcb2c('0x3'),'afterUpdate':_0xcb2c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2fdc10){return function(_0x301f40,_0x12e4c9,_0xdd411f){MailQueueEvents['emit'](_0x2fdc10+':'+_0x301f40['id'],_0x301f40);MailQueueEvents[_0xcb2c('0x5')](_0x2fdc10,_0x301f40);_0xdd411f(null);};}for(var e in events){if(events[_0xcb2c('0x6')](e)){var event=events[e];MailQueue[_0xcb2c('0x7')](e,emitEvent(event));}}module[_0xcb2c('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xf7d1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','MailQueue'];(function(_0x1fb671,_0x418586){var _0xdea0f5=function(_0x2e2cb0){while(--_0x2e2cb0){_0x1fb671['push'](_0x1fb671['shift']());}};_0xdea0f5(++_0x418586);}(_0xf7d1,0x154));var _0x1f7d=function(_0x53f35d,_0x1339d1){_0x53f35d=_0x53f35d-0x0;var _0x551f60=_0xf7d1[_0x53f35d];return _0x551f60;};'use strict';var EventEmitter=require(_0x1f7d('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x1f7d('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1f7d('0x2')](0x0);var events={'afterCreate':_0x1f7d('0x3'),'afterUpdate':_0x1f7d('0x4'),'afterDestroy':_0x1f7d('0x5')};function emitEvent(_0x5c653c){return function(_0x2a2838,_0x3ab7bc,_0x5d7ea1){MailQueueEvents[_0x1f7d('0x6')](_0x5c653c+':'+_0x2a2838['id'],_0x2a2838);MailQueueEvents[_0x1f7d('0x6')](_0x5c653c,_0x2a2838);_0x5d7ea1(null);};}for(var e in events){if(events[_0x1f7d('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x1f7d('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 87a49c8..9235073 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 _0x887e=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x887e,0x171));var _0xe887=function(_0x5bb0fe,_0x58fec8){_0x5bb0fe=_0x5bb0fe-0x0;var _0x31fb1b=_0x887e[_0x5bb0fe];return _0x31fb1b;};'use strict';var _=require(_0xe887('0x0'));var util=require('util');var logger=require(_0xe887('0x1'))(_0xe887('0x2'));var moment=require('moment');var BPromise=require(_0xe887('0x3'));var rp=require(_0xe887('0x4'));var fs=require('fs');var path=require(_0xe887('0x5'));var rimraf=require(_0xe887('0x6'));var config=require(_0xe887('0x7'));var attributes=require(_0xe887('0x8'));module[_0xe887('0x9')]=function(_0x4a4f43,_0x1304bd){return _0x4a4f43['define'](_0xe887('0xa'),attributes,{'tableName':_0xe887('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0x216176,_0x5699f0){var _0x410bb0=function(_0x313cd5){while(--_0x313cd5){_0x216176['push'](_0x216176['shift']());}};_0x410bb0(++_0x5699f0);}(_0xcdd5,0x6d));var _0x5cdd=function(_0x1b06ae,_0x3db6f1){_0x1b06ae=_0x1b06ae-0x0;var _0x5f4972=_0xcdd5[_0x1b06ae];return _0x5f4972;};'use strict';var _=require(_0x5cdd('0x0'));var util=require(_0x5cdd('0x1'));var logger=require(_0x5cdd('0x2'))(_0x5cdd('0x3'));var moment=require(_0x5cdd('0x4'));var BPromise=require(_0x5cdd('0x5'));var rp=require(_0x5cdd('0x6'));var fs=require('fs');var path=require(_0x5cdd('0x7'));var rimraf=require(_0x5cdd('0x8'));var config=require(_0x5cdd('0x9'));var attributes=require('./mailQueue.attributes');module[_0x5cdd('0xa')]=function(_0x5e82bc,_0x3b7a54){return _0x5e82bc[_0x5cdd('0xb')](_0x5cdd('0xc'),attributes,{'tableName':_0x5cdd('0xd'),'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 0e2b20b..d3cf250 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 _0x9c4c=['redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','MailQueue','options','raw','where','limit','include','map','model','attributes','info','GetMailQueue','ShowMailQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','http'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9c4c,0x1e2));var _0xc9c4=function(_0x4a4ec8,_0x4f26cb){_0x4a4ec8=_0x4a4ec8-0x0;var _0x3d1253=_0x9c4c[_0x4a4ec8];return _0x3d1253;};'use strict';var _=require('lodash');var util=require(_0xc9c4('0x0'));var moment=require(_0xc9c4('0x1'));var BPromise=require(_0xc9c4('0x2'));var rs=require(_0xc9c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9c4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc9c4('0x6')][_0xc9c4('0x7')]({'port':0x232a});config[_0xc9c4('0x8')]=_[_0xc9c4('0x9')](config['redis'],{'host':_0xc9c4('0xa'),'port':0x18eb});var socket=require(_0xc9c4('0xb'))(new Redis(config['redis']));require(_0xc9c4('0xc'))[_0xc9c4('0xd')](socket);function respondWithRpcPromise(_0x48b674,_0x59054c,_0x159ef0){return new BPromise(function(_0x87e057,_0x5c686b){return client['request'](_0x48b674,_0x159ef0)[_0xc9c4('0xe')](function(_0x3bef1f){logger['info'](_0xc9c4('0xf'),_0x59054c,_0xc9c4('0x10'));logger[_0xc9c4('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x59054c,_0xc9c4('0x10'),JSON[_0xc9c4('0x12')](_0x3bef1f));if(_0x3bef1f[_0xc9c4('0x13')]){if(_0x3bef1f[_0xc9c4('0x13')][_0xc9c4('0x14')]===0x1f4){logger[_0xc9c4('0x13')](_0xc9c4('0xf'),_0x59054c,_0x3bef1f[_0xc9c4('0x13')]['message']);return _0x5c686b(_0x3bef1f[_0xc9c4('0x13')][_0xc9c4('0x15')]);}logger['error'](_0xc9c4('0xf'),_0x59054c,_0x3bef1f['error'][_0xc9c4('0x15')]);return _0x87e057(_0x3bef1f[_0xc9c4('0x13')][_0xc9c4('0x15')]);}else{logger['info'](_0xc9c4('0xf'),_0x59054c,_0xc9c4('0x10'));_0x87e057(_0x3bef1f['result']['message']);}})[_0xc9c4('0x16')](function(_0x3a926a){logger[_0xc9c4('0x13')](_0xc9c4('0xf'),_0x59054c,_0x3a926a);_0x5c686b(_0x3a926a);});});}exports['GetMailQueue']=function(_0xed44f0){var _0x264a29=this;return new Promise(function(_0x545796,_0x55792e){return db[_0xc9c4('0x17')]['findAll']({'raw':_0xed44f0[_0xc9c4('0x18')]?_0xed44f0[_0xc9c4('0x18')][_0xc9c4('0x19')]===undefined?!![]:![]:!![],'where':_0xed44f0[_0xc9c4('0x18')]?_0xed44f0['options'][_0xc9c4('0x1a')]||null:null,'attributes':_0xed44f0[_0xc9c4('0x18')]?_0xed44f0[_0xc9c4('0x18')]['attributes']||null:null,'limit':_0xed44f0[_0xc9c4('0x18')]?_0xed44f0[_0xc9c4('0x18')][_0xc9c4('0x1b')]||null:null,'include':_0xed44f0[_0xc9c4('0x18')]?_0xed44f0[_0xc9c4('0x18')][_0xc9c4('0x1c')]?_[_0xc9c4('0x1d')](_0xed44f0['options'][_0xc9c4('0x1c')],function(_0x1c7560){return{'model':db[_0x1c7560[_0xc9c4('0x1e')]],'as':_0x1c7560['as'],'attributes':_0x1c7560[_0xc9c4('0x1f')],'include':_0x1c7560[_0xc9c4('0x1c')]?_['map'](_0x1c7560[_0xc9c4('0x1c')],function(_0x1061b5){return{'model':db[_0x1061b5[_0xc9c4('0x1e')]],'as':_0x1061b5['as'],'attributes':_0x1061b5[_0xc9c4('0x1f')],'include':_0x1061b5[_0xc9c4('0x1c')]?_[_0xc9c4('0x1d')](_0x1061b5[_0xc9c4('0x1c')],function(_0x36b39a){return{'model':db[_0x36b39a[_0xc9c4('0x1e')]],'as':_0x36b39a['as'],'attributes':_0x36b39a[_0xc9c4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc9c4('0xe')](function(_0x40b6db){logger[_0xc9c4('0x20')]('GetMailQueue',_0xed44f0);logger['debug'](_0xc9c4('0x21'),_0xed44f0,JSON['stringify'](_0x40b6db));_0x545796(_0x40b6db);})[_0xc9c4('0x16')](function(_0x1c32e2){logger['error'](_0xc9c4('0x21'),_0x1c32e2[_0xc9c4('0x15')],_0xed44f0);_0x55792e(_0x264a29[_0xc9c4('0x13')](0x1f4,_0x1c32e2['message']));});});};exports['ShowMailQueue']=function(_0xb6b4aa){var _0x330417=this;return new Promise(function(_0x981b93,_0x11de3f){return db[_0xc9c4('0x17')]['find']({'raw':_0xb6b4aa[_0xc9c4('0x18')]?_0xb6b4aa[_0xc9c4('0x18')][_0xc9c4('0x19')]===undefined?!![]:![]:!![],'where':_0xb6b4aa[_0xc9c4('0x18')]?_0xb6b4aa[_0xc9c4('0x18')][_0xc9c4('0x1a')]||null:null,'attributes':_0xb6b4aa[_0xc9c4('0x18')]?_0xb6b4aa['options'][_0xc9c4('0x1f')]||null:null,'include':_0xb6b4aa[_0xc9c4('0x18')]?_0xb6b4aa[_0xc9c4('0x18')][_0xc9c4('0x1c')]?_[_0xc9c4('0x1d')](_0xb6b4aa[_0xc9c4('0x18')][_0xc9c4('0x1c')],function(_0x279ab2){return{'model':db[_0x279ab2[_0xc9c4('0x1e')]],'as':_0x279ab2['as'],'attributes':_0x279ab2[_0xc9c4('0x1f')],'include':_0x279ab2[_0xc9c4('0x1c')]?_[_0xc9c4('0x1d')](_0x279ab2[_0xc9c4('0x1c')],function(_0x3426ee){return{'model':db[_0x3426ee[_0xc9c4('0x1e')]],'as':_0x3426ee['as'],'attributes':_0x3426ee[_0xc9c4('0x1f')],'include':_0x3426ee[_0xc9c4('0x1c')]?_[_0xc9c4('0x1d')](_0x3426ee[_0xc9c4('0x1c')],function(_0x1bc95a){return{'model':db[_0x1bc95a[_0xc9c4('0x1e')]],'as':_0x1bc95a['as'],'attributes':_0x1bc95a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9c4('0xe')](function(_0x353b8b){logger[_0xc9c4('0x20')](_0xc9c4('0x22'),_0xb6b4aa);logger[_0xc9c4('0x11')]('ShowMailQueue',_0xb6b4aa,JSON[_0xc9c4('0x12')](_0x353b8b));_0x981b93(_0x353b8b);})[_0xc9c4('0x16')](function(_0x25e698){logger[_0xc9c4('0x13')](_0xc9c4('0x22'),_0x25e698[_0xc9c4('0x15')],_0xb6b4aa);_0x11de3f(_0x330417[_0xc9c4('0x13')](0x1f4,_0x25e698['message']));});});}; \ No newline at end of file +var _0x909b=['MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetMailQueue','ShowMailQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x909b,0xdc));var _0xb909=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x909b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb909('0x0'));var util=require('util');var moment=require(_0xb909('0x1'));var BPromise=require(_0xb909('0x2'));var rs=require(_0xb909('0x3'));var fs=require('fs');var Redis=require(_0xb909('0x4'));var db=require(_0xb909('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb909('0x6')][_0xb909('0x7')]({'port':0x232a});config[_0xb909('0x8')]=_[_0xb909('0x9')](config[_0xb909('0x8')],{'host':_0xb909('0xa'),'port':0x18eb});var socket=require(_0xb909('0xb'))(new Redis(config[_0xb909('0x8')]));require(_0xb909('0xc'))[_0xb909('0xd')](socket);function respondWithRpcPromise(_0x445efe,_0x4fb750,_0x24ded1){return new BPromise(function(_0x54ece7,_0x2d610d){return client[_0xb909('0xe')](_0x445efe,_0x24ded1)[_0xb909('0xf')](function(_0x697eae){logger[_0xb909('0x10')](_0xb909('0x11'),_0x4fb750,_0xb909('0x12'));logger[_0xb909('0x13')](_0xb909('0x14'),_0x4fb750,_0xb909('0x12'),JSON[_0xb909('0x15')](_0x697eae));if(_0x697eae[_0xb909('0x16')]){if(_0x697eae[_0xb909('0x16')][_0xb909('0x17')]===0x1f4){logger[_0xb909('0x16')]('MailQueue,\x20%s,\x20%s',_0x4fb750,_0x697eae['error'][_0xb909('0x18')]);return _0x2d610d(_0x697eae[_0xb909('0x16')][_0xb909('0x18')]);}logger[_0xb909('0x16')]('MailQueue,\x20%s,\x20%s',_0x4fb750,_0x697eae[_0xb909('0x16')]['message']);return _0x54ece7(_0x697eae['error']['message']);}else{logger[_0xb909('0x10')](_0xb909('0x11'),_0x4fb750,'request\x20sent');_0x54ece7(_0x697eae[_0xb909('0x19')][_0xb909('0x18')]);}})[_0xb909('0x1a')](function(_0x296e19){logger['error'](_0xb909('0x11'),_0x4fb750,_0x296e19);_0x2d610d(_0x296e19);});});}exports['GetMailQueue']=function(_0x3682fa){var _0x92fab=this;return new Promise(function(_0x18f149,_0x580b46){return db[_0xb909('0x1b')][_0xb909('0x1c')]({'raw':_0x3682fa[_0xb909('0x1d')]?_0x3682fa[_0xb909('0x1d')][_0xb909('0x1e')]===undefined?!![]:![]:!![],'where':_0x3682fa[_0xb909('0x1d')]?_0x3682fa[_0xb909('0x1d')][_0xb909('0x1f')]||null:null,'attributes':_0x3682fa[_0xb909('0x1d')]?_0x3682fa[_0xb909('0x1d')][_0xb909('0x20')]||null:null,'limit':_0x3682fa['options']?_0x3682fa[_0xb909('0x1d')][_0xb909('0x21')]||null:null,'include':_0x3682fa[_0xb909('0x1d')]?_0x3682fa[_0xb909('0x1d')][_0xb909('0x22')]?_[_0xb909('0x23')](_0x3682fa[_0xb909('0x1d')]['include'],function(_0x5cd2ad){return{'model':db[_0x5cd2ad[_0xb909('0x24')]],'as':_0x5cd2ad['as'],'attributes':_0x5cd2ad[_0xb909('0x20')],'include':_0x5cd2ad[_0xb909('0x22')]?_[_0xb909('0x23')](_0x5cd2ad['include'],function(_0x2eb3bc){return{'model':db[_0x2eb3bc[_0xb909('0x24')]],'as':_0x2eb3bc['as'],'attributes':_0x2eb3bc['attributes'],'include':_0x2eb3bc[_0xb909('0x22')]?_[_0xb909('0x23')](_0x2eb3bc[_0xb909('0x22')],function(_0xd7cb82){return{'model':db[_0xd7cb82['model']],'as':_0xd7cb82['as'],'attributes':_0xd7cb82[_0xb909('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb909('0xf')](function(_0x43ec33){logger['info'](_0xb909('0x25'),_0x3682fa);logger[_0xb909('0x13')](_0xb909('0x25'),_0x3682fa,JSON[_0xb909('0x15')](_0x43ec33));_0x18f149(_0x43ec33);})[_0xb909('0x1a')](function(_0xd5ba3a){logger['error'](_0xb909('0x25'),_0xd5ba3a[_0xb909('0x18')],_0x3682fa);_0x580b46(_0x92fab[_0xb909('0x16')](0x1f4,_0xd5ba3a[_0xb909('0x18')]));});});};exports[_0xb909('0x26')]=function(_0x1f6fbb){var _0x50278c=this;return new Promise(function(_0x49029d,_0x29b428){return db[_0xb909('0x1b')][_0xb909('0x27')]({'raw':_0x1f6fbb[_0xb909('0x1d')]?_0x1f6fbb[_0xb909('0x1d')][_0xb909('0x1e')]===undefined?!![]:![]:!![],'where':_0x1f6fbb[_0xb909('0x1d')]?_0x1f6fbb[_0xb909('0x1d')][_0xb909('0x1f')]||null:null,'attributes':_0x1f6fbb[_0xb909('0x1d')]?_0x1f6fbb['options'][_0xb909('0x20')]||null:null,'include':_0x1f6fbb[_0xb909('0x1d')]?_0x1f6fbb[_0xb909('0x1d')][_0xb909('0x22')]?_[_0xb909('0x23')](_0x1f6fbb[_0xb909('0x1d')][_0xb909('0x22')],function(_0x19fc5d){return{'model':db[_0x19fc5d['model']],'as':_0x19fc5d['as'],'attributes':_0x19fc5d[_0xb909('0x20')],'include':_0x19fc5d['include']?_[_0xb909('0x23')](_0x19fc5d[_0xb909('0x22')],function(_0x3a0fa6){return{'model':db[_0x3a0fa6[_0xb909('0x24')]],'as':_0x3a0fa6['as'],'attributes':_0x3a0fa6[_0xb909('0x20')],'include':_0x3a0fa6[_0xb909('0x22')]?_[_0xb909('0x23')](_0x3a0fa6['include'],function(_0x5873cf){return{'model':db[_0x5873cf[_0xb909('0x24')]],'as':_0x5873cf['as'],'attributes':_0x5873cf[_0xb909('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb909('0xf')](function(_0x1616c6){logger['info'](_0xb909('0x26'),_0x1f6fbb);logger['debug']('ShowMailQueue',_0x1f6fbb,JSON[_0xb909('0x15')](_0x1616c6));_0x49029d(_0x1616c6);})[_0xb909('0x1a')](function(_0x4471e7){logger['error'](_0xb909('0x26'),_0x4471e7[_0xb909('0x18')],_0x1f6fbb);_0x29b428(_0x50278c[_0xb909('0x16')](0x1f4,_0x4471e7[_0xb909('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 4d4201c..a5d3a8b 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 _0xab1a=['./mailQueue.events','save','update','emit','removeListener','length','mailQueue:'];(function(_0x228c13,_0x527e14){var _0x29ed27=function(_0xd5136d){while(--_0xd5136d){_0x228c13['push'](_0x228c13['shift']());}};_0x29ed27(++_0x527e14);}(_0xab1a,0x77));var _0xaab1=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xab1a[_0x4a599b];return _0x2d53d3;};'use strict';var MailQueueEvents=require(_0xaab1('0x0'));var events=[_0xaab1('0x1'),'remove',_0xaab1('0x2')];function createListener(_0x52400b,_0x1f69c9){return function(_0x47a3c2){_0x1f69c9[_0xaab1('0x3')](_0x52400b,_0x47a3c2);};}function removeListener(_0xb99664,_0x14da13){return function(){MailQueueEvents[_0xaab1('0x4')](_0xb99664,_0x14da13);};}exports['register']=function(_0x1074c7){for(var _0x2f8106=0x0,_0x135a9a=events[_0xaab1('0x5')];_0x2f8106<_0x135a9a;_0x2f8106++){var _0x2c1c87=events[_0x2f8106];var _0x120779=createListener(_0xaab1('0x6')+_0x2c1c87,_0x1074c7);MailQueueEvents['on'](_0x2c1c87,_0x120779);}}; \ No newline at end of file +var _0x42f2=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x42f2,0xa4));var _0x242f=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x42f2[_0x1d1963];return _0x3f58bb;};'use strict';var MailQueueEvents=require(_0x242f('0x0'));var events=[_0x242f('0x1'),_0x242f('0x2'),_0x242f('0x3')];function createListener(_0x31d362,_0x29a8){return function(_0x5c0bb0){_0x29a8['emit'](_0x31d362,_0x5c0bb0);};}function removeListener(_0x2c2b14,_0x31df3b){return function(){MailQueueEvents[_0x242f('0x4')](_0x2c2b14,_0x31df3b);};}exports[_0x242f('0x5')]=function(_0x23c28f){for(var _0x1b8380=0x0,_0x50ca14=events[_0x242f('0x6')];_0x1b8380<_0x50ca14;_0x1b8380++){var _0x2e7448=events[_0x1b8380];var _0xba47ab=createListener(_0x242f('0x7')+_0x2e7448,_0x23c28f);MailQueueEvents['on'](_0x2e7448,_0xba47ab);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8e2ebd6..8832947 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 _0xf341=['update','delete','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x1809e9,_0x51f283){var _0x4b584f=function(_0x422270){while(--_0x422270){_0x1809e9['push'](_0x1809e9['shift']());}};_0x4b584f(++_0x51f283);}(_0xf341,0x10e));var _0x1f34=function(_0x53686f,_0x10fc56){_0x53686f=_0x53686f-0x0;var _0x15158c=_0xf341[_0x53686f];return _0x15158c;};'use strict';var multer=require(_0x1f34('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1f34('0x1'));var express=require(_0x1f34('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1f34('0x3'));var config=require(_0x1f34('0x4'));var controller=require(_0x1f34('0x5'));router[_0x1f34('0x6')]('/',auth[_0x1f34('0x7')](),controller[_0x1f34('0x8')]);router[_0x1f34('0x6')](_0x1f34('0x9'),auth['isAuthenticated'](),controller[_0x1f34('0xa')]);router['get'](_0x1f34('0xb'),auth['isAuthenticated'](),controller[_0x1f34('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1f34('0xd')]);router[_0x1f34('0xe')](_0x1f34('0xb'),auth[_0x1f34('0x7')](),controller[_0x1f34('0xf')]);router[_0x1f34('0x10')](_0x1f34('0xb'),auth[_0x1f34('0x7')](),controller[_0x1f34('0x11')]);module[_0x1f34('0x12')]=router; \ No newline at end of file +var _0x333c=['delete','exports','multer','util','connect-timeout','Router','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','create','update'];(function(_0x4d2b3f,_0x408d7e){var _0x47bef1=function(_0x42dc60){while(--_0x42dc60){_0x4d2b3f['push'](_0x4d2b3f['shift']());}};_0x47bef1(++_0x408d7e);}(_0x333c,0x112));var _0xc333=function(_0x593d22,_0x575b43){_0x593d22=_0x593d22-0x0;var _0x53ba5e=_0x333c[_0x593d22];return _0x53ba5e;};'use strict';var multer=require(_0xc333('0x0'));var util=require(_0xc333('0x1'));var path=require('path');var timeout=require(_0xc333('0x2'));var express=require('express');var router=express[_0xc333('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc333('0x4'));var controller=require(_0xc333('0x5'));router['get']('/',auth[_0xc333('0x6')](),controller[_0xc333('0x7')]);router['get'](_0xc333('0x8'),auth[_0xc333('0x6')](),controller[_0xc333('0x9')]);router[_0xc333('0xa')](_0xc333('0xb'),auth[_0xc333('0x6')](),controller[_0xc333('0xc')]);router['post']('/',auth[_0xc333('0x6')](),controller[_0xc333('0xd')]);router['put'](_0xc333('0xb'),auth[_0xc333('0x6')](),controller[_0xc333('0xe')]);router[_0xc333('0xf')](_0xc333('0xb'),auth[_0xc333('0x6')](),controller['destroy']);module[_0xc333('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 592df35..1cd6ee1 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 _0x9a79=['DATE','STRING'];(function(_0x369ccb,_0x30a38f){var _0x4cd36b=function(_0x5e7b2e){while(--_0x5e7b2e){_0x369ccb['push'](_0x369ccb['shift']());}};_0x4cd36b(++_0x30a38f);}(_0x9a79,0x15d));var _0x99a7=function(_0x105045,_0x2e471e){_0x105045=_0x105045-0x0;var _0x2487d0=_0x9a79[_0x105045];return _0x2487d0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x99a7('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x99a7('0x0')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x99a7('0x1')]},'acceptAt':{'type':Sequelize[_0x99a7('0x1')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x99a7('0x0')]}}; \ No newline at end of file +var _0xcd85=['STRING','DATE','moment','sequelize','exports'];(function(_0x5e8d28,_0x472d15){var _0x325d9e=function(_0x52f428){while(--_0x52f428){_0x5e8d28['push'](_0x5e8d28['shift']());}};_0x325d9e(++_0x472d15);}(_0xcd85,0x14c));var _0x5cd8=function(_0x1d606d,_0x376e51){_0x1d606d=_0x1d606d-0x0;var _0x3c38bd=_0xcd85[_0x1d606d];return _0x3c38bd;};'use strict';var moment=require(_0x5cd8('0x0'));var Sequelize=require(_0x5cd8('0x1'));module[_0x5cd8('0x2')]={'uniqueid':{'type':Sequelize[_0x5cd8('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5cd8('0x4')]},'exitAt':{'type':Sequelize[_0x5cd8('0x4')]},'reason':{'type':Sequelize[_0x5cd8('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 57b636a..cf5bede 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 _0xbb93=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','MailQueueReport','count','includeAll','findAll','show','params','length','options','find','catch','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2ac71a,_0x1d2a02){var _0x3ee904=function(_0x5c902a){while(--_0x5c902a){_0x2ac71a['push'](_0x2ac71a['shift']());}};_0x3ee904(++_0x1d2a02);}(_0xbb93,0x120));var _0x3bb9=function(_0x5c6244,_0x227af4){_0x5c6244=_0x5c6244-0x0;var _0x317fd9=_0xbb93[_0x5c6244];return _0x317fd9;};'use strict';var pdf=require(_0x3bb9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3bb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bb9('0x2'));var rp=require(_0x3bb9('0x3'));var moment=require(_0x3bb9('0x4'));var BPromise=require(_0x3bb9('0x5'));var Mustache=require(_0x3bb9('0x6'));var util=require(_0x3bb9('0x7'));var path=require('path');var sox=require(_0x3bb9('0x8'));var csv=require(_0x3bb9('0x9'));var ejs=require(_0x3bb9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3bb9('0xb'));var crypto=require('crypto');var jsforce=require(_0x3bb9('0xc'));var deskjs=require(_0x3bb9('0xd'));var toCsv=require(_0x3bb9('0x9'));var querystring=require(_0x3bb9('0xe'));var Papa=require(_0x3bb9('0xf'));var Redis=require(_0x3bb9('0x10'));var authService=require(_0x3bb9('0x11'));var qs=require(_0x3bb9('0x12'));var as=require(_0x3bb9('0x13'));var hardwareService=require(_0x3bb9('0x14'));var logger=require(_0x3bb9('0x15'))(_0x3bb9('0x16'));var utils=require(_0x3bb9('0x17'));var config=require('../../config/environment');var db=require(_0x3bb9('0x18'))['db'];function respondWithStatusCode(_0x3559f5,_0x3e2383){_0x3e2383=_0x3e2383||0xcc;return function(_0x3ad0ea){if(_0x3ad0ea){return _0x3559f5[_0x3bb9('0x19')](_0x3e2383);}return _0x3559f5[_0x3bb9('0x1a')](_0x3e2383)[_0x3bb9('0x1b')]();};}function respondWithResult(_0x10e912,_0x21dfdb){_0x21dfdb=_0x21dfdb||0xc8;return function(_0x2587d9){if(_0x2587d9){return _0x10e912[_0x3bb9('0x1a')](_0x21dfdb)[_0x3bb9('0x1c')](_0x2587d9);}};}function respondWithFilteredResult(_0x372719,_0x337ffd){return function(_0x394412){if(_0x394412){var _0xa4ded4=_0x394412['count'],_0x251296=_0x337ffd[_0x3bb9('0x1d')],_0x4049e5=_0x337ffd[_0x3bb9('0x1d')]+_0x337ffd['limit'],_0x1eb493;if(_0x4049e5>=_0xa4ded4){_0x4049e5=_0xa4ded4;_0x1eb493=0xc8;}else{_0x1eb493=0xce;}_0x372719['status'](_0x1eb493);return _0x372719[_0x3bb9('0x1e')](_0x3bb9('0x1f'),_0x251296+'-'+_0x4049e5+'/'+_0xa4ded4)['json'](_0x394412);}return null;};}function patchUpdates(_0x3e0849){return function(_0x26f75c){try{jsonpatch[_0x3bb9('0x20')](_0x26f75c,_0x3e0849,!![]);}catch(_0x8c455){return BPromise[_0x3bb9('0x21')](_0x8c455);}return _0x26f75c[_0x3bb9('0x22')]();};}function saveUpdates(_0xaabfe1,_0x2e5e4d){return function(_0x31eaa1){if(_0x31eaa1){return _0x31eaa1['update'](_0xaabfe1)['then'](function(_0x5e4266){return _0x5e4266;});}return null;};}function removeEntity(_0x3bc7d2,_0x3d843b){return function(_0x5cc963){if(_0x5cc963){return _0x5cc963[_0x3bb9('0x23')]()[_0x3bb9('0x24')](function(){_0x3bc7d2['status'](0xcc)[_0x3bb9('0x1b')]();});}};}function handleEntityNotFound(_0x3e9218,_0x172cb0){return function(_0x3b6381){if(!_0x3b6381){_0x3e9218['sendStatus'](0x194);}return _0x3b6381;};}function handleError(_0x24ec97,_0x681148){_0x681148=_0x681148||0x1f4;return function(_0x5a77f6){logger[_0x3bb9('0x25')](_0x5a77f6[_0x3bb9('0x26')]);if(_0x5a77f6[_0x3bb9('0x27')]){delete _0x5a77f6[_0x3bb9('0x27')];}_0x24ec97[_0x3bb9('0x1a')](_0x681148)[_0x3bb9('0x28')](_0x5a77f6);};}exports[_0x3bb9('0x29')]=function(_0x2cb5f8,_0x48f904){var _0x504f2e={},_0x1122a6={},_0x1ede03={'count':0x0,'rows':[]};var _0x30953=_[_0x3bb9('0x2a')](db['MailQueueReport'][_0x3bb9('0x2b')],function(_0x3dadb1){return{'name':_0x3dadb1[_0x3bb9('0x2c')],'type':_0x3dadb1['type'][_0x3bb9('0x2d')]};});_0x1122a6[_0x3bb9('0x2e')]=_[_0x3bb9('0x2a')](_0x30953,'name');_0x1122a6[_0x3bb9('0x2f')]=_[_0x3bb9('0x30')](_0x2cb5f8[_0x3bb9('0x2f')]);_0x1122a6[_0x3bb9('0x31')]=_[_0x3bb9('0x32')](_0x1122a6[_0x3bb9('0x2e')],_0x1122a6['query']);_0x504f2e[_0x3bb9('0x33')]=_[_0x3bb9('0x32')](_0x1122a6[_0x3bb9('0x2e')],qs[_0x3bb9('0x34')](_0x2cb5f8[_0x3bb9('0x2f')][_0x3bb9('0x34')]));_0x504f2e[_0x3bb9('0x33')]=_0x504f2e[_0x3bb9('0x33')]['length']?_0x504f2e[_0x3bb9('0x33')]:_0x1122a6['model'];if(!_0x2cb5f8[_0x3bb9('0x2f')][_0x3bb9('0x35')](_0x3bb9('0x36'))){_0x504f2e[_0x3bb9('0x37')]=qs[_0x3bb9('0x37')](_0x2cb5f8[_0x3bb9('0x2f')][_0x3bb9('0x37')]);_0x504f2e[_0x3bb9('0x1d')]=qs['offset'](_0x2cb5f8[_0x3bb9('0x2f')]['offset']);}_0x504f2e[_0x3bb9('0x38')]=qs[_0x3bb9('0x39')](_0x2cb5f8[_0x3bb9('0x2f')]['sort']);_0x504f2e[_0x3bb9('0x3a')]=qs[_0x3bb9('0x31')](_[_0x3bb9('0x3b')](_0x2cb5f8['query'],_0x1122a6[_0x3bb9('0x31')]),_0x30953);if(_0x2cb5f8[_0x3bb9('0x2f')][_0x3bb9('0x3c')]){_0x504f2e[_0x3bb9('0x3a')]=_[_0x3bb9('0x3d')](_0x504f2e[_0x3bb9('0x3a')],{'$or':_[_0x3bb9('0x2a')](_0x30953,function(_0x346fae){if(_0x346fae[_0x3bb9('0x3e')]!==_0x3bb9('0x3f')){var _0x48c0be={};_0x48c0be[_0x346fae[_0x3bb9('0x27')]]={'$like':'%'+_0x2cb5f8[_0x3bb9('0x2f')][_0x3bb9('0x3c')]+'%'};return _0x48c0be;}})});}_0x504f2e=_[_0x3bb9('0x3d')]({},_0x504f2e,_0x2cb5f8['options']);var _0x1ca868={'where':_0x504f2e[_0x3bb9('0x3a')]};return db[_0x3bb9('0x40')][_0x3bb9('0x41')](_0x1ca868)[_0x3bb9('0x24')](function(_0x4b4d1c){_0x1ede03[_0x3bb9('0x41')]=_0x4b4d1c;if(_0x2cb5f8[_0x3bb9('0x2f')][_0x3bb9('0x42')]){_0x504f2e['include']=[{'all':!![]}];}return db[_0x3bb9('0x40')][_0x3bb9('0x43')](_0x504f2e);})[_0x3bb9('0x24')](function(_0x302041){_0x1ede03['rows']=_0x302041;return _0x1ede03;})['then'](respondWithFilteredResult(_0x48f904,_0x504f2e))['catch'](handleError(_0x48f904,null));};exports[_0x3bb9('0x44')]=function(_0x46fc8c,_0x39b36f){var _0x3116c2={'raw':!![],'where':{'id':_0x46fc8c[_0x3bb9('0x45')]['id']}},_0x945501={};_0x945501[_0x3bb9('0x2e')]=_[_0x3bb9('0x30')](db['MailQueueReport'][_0x3bb9('0x2b')]);_0x945501[_0x3bb9('0x2f')]=_[_0x3bb9('0x30')](_0x46fc8c[_0x3bb9('0x2f')]);_0x945501[_0x3bb9('0x31')]=_[_0x3bb9('0x32')](_0x945501['model'],_0x945501[_0x3bb9('0x2f')]);_0x3116c2[_0x3bb9('0x33')]=_['intersection'](_0x945501['model'],qs[_0x3bb9('0x34')](_0x46fc8c[_0x3bb9('0x2f')][_0x3bb9('0x34')]));_0x3116c2[_0x3bb9('0x33')]=_0x3116c2[_0x3bb9('0x33')][_0x3bb9('0x46')]?_0x3116c2[_0x3bb9('0x33')]:_0x945501[_0x3bb9('0x2e')];if(_0x46fc8c[_0x3bb9('0x2f')][_0x3bb9('0x42')]){_0x3116c2['include']=[{'all':!![]}];}_0x3116c2=_['merge']({},_0x3116c2,_0x46fc8c[_0x3bb9('0x47')]);return db[_0x3bb9('0x40')][_0x3bb9('0x48')](_0x3116c2)[_0x3bb9('0x24')](handleEntityNotFound(_0x39b36f,null))['then'](respondWithResult(_0x39b36f,null))[_0x3bb9('0x49')](handleError(_0x39b36f,null));};exports[_0x3bb9('0x4a')]=function(_0x1f9112,_0x1fa56d){return db[_0x3bb9('0x40')]['create'](_0x1f9112[_0x3bb9('0x4b')],{})['then'](respondWithResult(_0x1fa56d,0xc9))[_0x3bb9('0x49')](handleError(_0x1fa56d,null));};exports['update']=function(_0x2ae6fd,_0x430a4c){if(_0x2ae6fd[_0x3bb9('0x4b')]['id']){delete _0x2ae6fd['body']['id'];}return db[_0x3bb9('0x40')][_0x3bb9('0x48')]({'where':{'id':_0x2ae6fd['params']['id']}})[_0x3bb9('0x24')](handleEntityNotFound(_0x430a4c,null))[_0x3bb9('0x24')](saveUpdates(_0x2ae6fd[_0x3bb9('0x4b')],null))[_0x3bb9('0x24')](respondWithResult(_0x430a4c,null))[_0x3bb9('0x49')](handleError(_0x430a4c,null));};exports[_0x3bb9('0x23')]=function(_0x4ea192,_0x1d52e8){return db[_0x3bb9('0x40')]['find']({'where':{'id':_0x4ea192[_0x3bb9('0x45')]['id']}})[_0x3bb9('0x24')](handleEntityNotFound(_0x1d52e8,null))[_0x3bb9('0x24')](removeEntity(_0x1d52e8,null))['catch'](handleError(_0x1d52e8,null));};exports[_0x3bb9('0x4c')]=function(_0x5011d1,_0x4a6249){return db[_0x3bb9('0x40')][_0x3bb9('0x4c')]()[_0x3bb9('0x24')](respondWithResult(_0x4a6249,null))[_0x3bb9('0x49')](handleError(_0x4a6249,null));}; \ No newline at end of file +var _0xe747=['nolimit','sort','where','filter','VIRTUAL','options','include','findAll','rows','length','includeAll','merge','find','catch','create','body','params','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x559900,_0x52e4cc){var _0x3fbfd8=function(_0x546c36){while(--_0x546c36){_0x559900['push'](_0x559900['shift']());}};_0x3fbfd8(++_0x52e4cc);}(_0xe747,0x13d));var _0x7e74=function(_0x82d81f,_0x27d780){_0x82d81f=_0x82d81f-0x0;var _0xb2cc43=_0xe747[_0x82d81f];return _0xb2cc43;};'use strict';var pdf=require(_0x7e74('0x0'));var emlformat=require(_0x7e74('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7e74('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7e74('0x3'));var BPromise=require(_0x7e74('0x4'));var Mustache=require(_0x7e74('0x5'));var util=require(_0x7e74('0x6'));var path=require(_0x7e74('0x7'));var sox=require('sox');var csv=require(_0x7e74('0x8'));var ejs=require(_0x7e74('0x9'));var fs=require('fs');var _=require(_0x7e74('0xa'));var squel=require(_0x7e74('0xb'));var crypto=require('crypto');var jsforce=require(_0x7e74('0xc'));var deskjs=require(_0x7e74('0xd'));var toCsv=require(_0x7e74('0x8'));var querystring=require(_0x7e74('0xe'));var Papa=require(_0x7e74('0xf'));var Redis=require(_0x7e74('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7e74('0x11'));var as=require(_0x7e74('0x12'));var hardwareService=require(_0x7e74('0x13'));var logger=require(_0x7e74('0x14'))(_0x7e74('0x15'));var utils=require(_0x7e74('0x16'));var config=require('../../config/environment');var db=require(_0x7e74('0x17'))['db'];function respondWithStatusCode(_0xa23daf,_0x4adb6d){_0x4adb6d=_0x4adb6d||0xcc;return function(_0x1e5ab1){if(_0x1e5ab1){return _0xa23daf[_0x7e74('0x18')](_0x4adb6d);}return _0xa23daf[_0x7e74('0x19')](_0x4adb6d)[_0x7e74('0x1a')]();};}function respondWithResult(_0x5c1abb,_0x17a95a){_0x17a95a=_0x17a95a||0xc8;return function(_0x4addfe){if(_0x4addfe){return _0x5c1abb[_0x7e74('0x19')](_0x17a95a)[_0x7e74('0x1b')](_0x4addfe);}};}function respondWithFilteredResult(_0x382de5,_0x15dee9){return function(_0x33c3e7){if(_0x33c3e7){var _0x475f0a=_0x33c3e7[_0x7e74('0x1c')],_0xc6453e=_0x15dee9[_0x7e74('0x1d')],_0x1e5bc7=_0x15dee9[_0x7e74('0x1d')]+_0x15dee9[_0x7e74('0x1e')],_0x306f68;if(_0x1e5bc7>=_0x475f0a){_0x1e5bc7=_0x475f0a;_0x306f68=0xc8;}else{_0x306f68=0xce;}_0x382de5[_0x7e74('0x19')](_0x306f68);return _0x382de5[_0x7e74('0x1f')](_0x7e74('0x20'),_0xc6453e+'-'+_0x1e5bc7+'/'+_0x475f0a)[_0x7e74('0x1b')](_0x33c3e7);}return null;};}function patchUpdates(_0x264a88){return function(_0x139908){try{jsonpatch[_0x7e74('0x21')](_0x139908,_0x264a88,!![]);}catch(_0x2b7edc){return BPromise[_0x7e74('0x22')](_0x2b7edc);}return _0x139908[_0x7e74('0x23')]();};}function saveUpdates(_0x234741,_0xc8f564){return function(_0xcda269){if(_0xcda269){return _0xcda269[_0x7e74('0x24')](_0x234741)[_0x7e74('0x25')](function(_0x579414){return _0x579414;});}return null;};}function removeEntity(_0x33c009,_0x253e8d){return function(_0x23c36b){if(_0x23c36b){return _0x23c36b[_0x7e74('0x26')]()[_0x7e74('0x25')](function(){_0x33c009[_0x7e74('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x474d60,_0x11b56f){return function(_0x2c5eb7){if(!_0x2c5eb7){_0x474d60[_0x7e74('0x18')](0x194);}return _0x2c5eb7;};}function handleError(_0x2e9e7f,_0x176d11){_0x176d11=_0x176d11||0x1f4;return function(_0x4697db){logger[_0x7e74('0x27')](_0x4697db[_0x7e74('0x28')]);if(_0x4697db[_0x7e74('0x29')]){delete _0x4697db[_0x7e74('0x29')];}_0x2e9e7f[_0x7e74('0x19')](_0x176d11)[_0x7e74('0x2a')](_0x4697db);};}exports[_0x7e74('0x2b')]=function(_0x49025d,_0xd389de){var _0xb95580={},_0x34aafb={},_0x2d62c0={'count':0x0,'rows':[]};var _0x444935=_[_0x7e74('0x2c')](db[_0x7e74('0x2d')][_0x7e74('0x2e')],function(_0x56aacc){return{'name':_0x56aacc[_0x7e74('0x2f')],'type':_0x56aacc[_0x7e74('0x30')][_0x7e74('0x31')]};});_0x34aafb[_0x7e74('0x32')]=_['map'](_0x444935,_0x7e74('0x29'));_0x34aafb[_0x7e74('0x33')]=_[_0x7e74('0x34')](_0x49025d[_0x7e74('0x33')]);_0x34aafb[_0x7e74('0x35')]=_[_0x7e74('0x36')](_0x34aafb[_0x7e74('0x32')],_0x34aafb[_0x7e74('0x33')]);_0xb95580[_0x7e74('0x37')]=_[_0x7e74('0x36')](_0x34aafb[_0x7e74('0x32')],qs[_0x7e74('0x38')](_0x49025d[_0x7e74('0x33')]['fields']));_0xb95580['attributes']=_0xb95580['attributes']['length']?_0xb95580[_0x7e74('0x37')]:_0x34aafb['model'];if(!_0x49025d['query'][_0x7e74('0x39')](_0x7e74('0x3a'))){_0xb95580['limit']=qs[_0x7e74('0x1e')](_0x49025d[_0x7e74('0x33')][_0x7e74('0x1e')]);_0xb95580[_0x7e74('0x1d')]=qs[_0x7e74('0x1d')](_0x49025d[_0x7e74('0x33')][_0x7e74('0x1d')]);}_0xb95580['order']=qs[_0x7e74('0x3b')](_0x49025d[_0x7e74('0x33')][_0x7e74('0x3b')]);_0xb95580[_0x7e74('0x3c')]=qs[_0x7e74('0x35')](_['pick'](_0x49025d[_0x7e74('0x33')],_0x34aafb[_0x7e74('0x35')]),_0x444935);if(_0x49025d[_0x7e74('0x33')][_0x7e74('0x3d')]){_0xb95580[_0x7e74('0x3c')]=_['merge'](_0xb95580[_0x7e74('0x3c')],{'$or':_['map'](_0x444935,function(_0x238354){if(_0x238354[_0x7e74('0x30')]!==_0x7e74('0x3e')){var _0x56acc6={};_0x56acc6[_0x238354['name']]={'$like':'%'+_0x49025d[_0x7e74('0x33')][_0x7e74('0x3d')]+'%'};return _0x56acc6;}})});}_0xb95580=_['merge']({},_0xb95580,_0x49025d[_0x7e74('0x3f')]);var _0x1a365a={'where':_0xb95580[_0x7e74('0x3c')]};return db['MailQueueReport'][_0x7e74('0x1c')](_0x1a365a)[_0x7e74('0x25')](function(_0x1535ad){_0x2d62c0[_0x7e74('0x1c')]=_0x1535ad;if(_0x49025d['query']['includeAll']){_0xb95580[_0x7e74('0x40')]=[{'all':!![]}];}return db[_0x7e74('0x2d')][_0x7e74('0x41')](_0xb95580);})[_0x7e74('0x25')](function(_0x3cbfc3){_0x2d62c0[_0x7e74('0x42')]=_0x3cbfc3;return _0x2d62c0;})['then'](respondWithFilteredResult(_0xd389de,_0xb95580))['catch'](handleError(_0xd389de,null));};exports['show']=function(_0x24f29c,_0x2c242a){var _0x37be17={'raw':!![],'where':{'id':_0x24f29c['params']['id']}},_0x54ea60={};_0x54ea60[_0x7e74('0x32')]=_['keys'](db[_0x7e74('0x2d')][_0x7e74('0x2e')]);_0x54ea60['query']=_[_0x7e74('0x34')](_0x24f29c[_0x7e74('0x33')]);_0x54ea60[_0x7e74('0x35')]=_[_0x7e74('0x36')](_0x54ea60[_0x7e74('0x32')],_0x54ea60[_0x7e74('0x33')]);_0x37be17[_0x7e74('0x37')]=_['intersection'](_0x54ea60[_0x7e74('0x32')],qs[_0x7e74('0x38')](_0x24f29c[_0x7e74('0x33')]['fields']));_0x37be17[_0x7e74('0x37')]=_0x37be17['attributes'][_0x7e74('0x43')]?_0x37be17[_0x7e74('0x37')]:_0x54ea60[_0x7e74('0x32')];if(_0x24f29c[_0x7e74('0x33')][_0x7e74('0x44')]){_0x37be17[_0x7e74('0x40')]=[{'all':!![]}];}_0x37be17=_[_0x7e74('0x45')]({},_0x37be17,_0x24f29c[_0x7e74('0x3f')]);return db[_0x7e74('0x2d')][_0x7e74('0x46')](_0x37be17)[_0x7e74('0x25')](handleEntityNotFound(_0x2c242a,null))[_0x7e74('0x25')](respondWithResult(_0x2c242a,null))[_0x7e74('0x47')](handleError(_0x2c242a,null));};exports[_0x7e74('0x48')]=function(_0x1d3136,_0x44a9dd){return db[_0x7e74('0x2d')][_0x7e74('0x48')](_0x1d3136[_0x7e74('0x49')],{})['then'](respondWithResult(_0x44a9dd,0xc9))[_0x7e74('0x47')](handleError(_0x44a9dd,null));};exports['update']=function(_0x4a5a5e,_0x2f7049){if(_0x4a5a5e[_0x7e74('0x49')]['id']){delete _0x4a5a5e[_0x7e74('0x49')]['id'];}return db[_0x7e74('0x2d')][_0x7e74('0x46')]({'where':{'id':_0x4a5a5e[_0x7e74('0x4a')]['id']}})[_0x7e74('0x25')](handleEntityNotFound(_0x2f7049,null))[_0x7e74('0x25')](saveUpdates(_0x4a5a5e[_0x7e74('0x49')],null))[_0x7e74('0x25')](respondWithResult(_0x2f7049,null))['catch'](handleError(_0x2f7049,null));};exports['destroy']=function(_0x47128f,_0x5d197c){return db['MailQueueReport']['find']({'where':{'id':_0x47128f[_0x7e74('0x4a')]['id']}})[_0x7e74('0x25')](handleEntityNotFound(_0x5d197c,null))[_0x7e74('0x25')](removeEntity(_0x5d197c,null))['catch'](handleError(_0x5d197c,null));};exports['describe']=function(_0x3c10b4,_0x25d5f1){return db[_0x7e74('0x2d')]['describe']()[_0x7e74('0x25')](respondWithResult(_0x25d5f1,null))[_0x7e74('0x47')](handleError(_0x25d5f1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 699216f..2f927c4 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 _0xa6d1=['request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x440722,_0x11cc6b){var _0x149e15=function(_0x4128f7){while(--_0x4128f7){_0x440722['push'](_0x440722['shift']());}};_0x149e15(++_0x11cc6b);}(_0xa6d1,0xcc));var _0x1a6d=function(_0x35c5c4,_0x29a383){_0x35c5c4=_0x35c5c4-0x0;var _0x3d49a5=_0xa6d1[_0x35c5c4];return _0x3d49a5;};'use strict';var _=require(_0x1a6d('0x0'));var util=require(_0x1a6d('0x1'));var logger=require(_0x1a6d('0x2'))(_0x1a6d('0x3'));var moment=require(_0x1a6d('0x4'));var BPromise=require(_0x1a6d('0x5'));var rp=require(_0x1a6d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1a6d('0x7'));var config=require(_0x1a6d('0x8'));var attributes=require(_0x1a6d('0x9'));module['exports']=function(_0x1ab915,_0x53bf45){return _0x1ab915[_0x1a6d('0xa')](_0x1a6d('0xb'),attributes,{'tableName':_0x1a6d('0xc'),'paranoid':![],'indexes':[{'name':_0x1a6d('0xd'),'fields':[_0x1a6d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ea3=['path','rimraf','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4fd682,_0x4929ec){var _0x54f654=function(_0x39f41c){while(--_0x39f41c){_0x4fd682['push'](_0x4fd682['shift']());}};_0x54f654(++_0x4929ec);}(_0x8ea3,0x192));var _0x38ea=function(_0x253eb6,_0x256e1d){_0x253eb6=_0x253eb6-0x0;var _0x365e86=_0x8ea3[_0x253eb6];return _0x365e86;};'use strict';var _=require(_0x38ea('0x0'));var util=require(_0x38ea('0x1'));var logger=require(_0x38ea('0x2'))('api');var moment=require(_0x38ea('0x3'));var BPromise=require(_0x38ea('0x4'));var rp=require(_0x38ea('0x5'));var fs=require('fs');var path=require(_0x38ea('0x6'));var rimraf=require(_0x38ea('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x3e60f7,_0x4749ef){return _0x3e60f7[_0x38ea('0x8')](_0x38ea('0x9'),attributes,{'tableName':_0x38ea('0xa'),'paranoid':![],'indexes':[{'name':_0x38ea('0xb'),'fields':[_0x38ea('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3d34d38..31ce713 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 _0x01d9=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','options','stringify','UpdateMailQueueReport','update','body','raw'];(function(_0x489deb,_0xa9ffd){var _0x3d841f=function(_0x35b987){while(--_0x35b987){_0x489deb['push'](_0x489deb['shift']());}};_0x3d841f(++_0xa9ffd);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});}exports[_0x901d('0x17')]=function(_0x285353){var _0x403db9=this;return new Promise(function(_0x38f42b,_0x414171){return db[_0x901d('0x18')][_0x901d('0x19')](_0x285353['body'],{'raw':_0x285353[_0x901d('0x1a')]?_0x285353[_0x901d('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x496a06){logger['info'](_0x901d('0x17'),_0x285353);logger[_0x901d('0x11')]('CreateMailQueueReport',_0x285353,JSON[_0x901d('0x1b')](_0x496a06));_0x38f42b(_0x496a06);})[_0x901d('0x16')](function(_0x488e24){logger[_0x901d('0x12')](_0x901d('0x17'),_0x488e24[_0x901d('0x14')],_0x285353);_0x414171(_0x403db9[_0x901d('0x12')](0x1f4,_0x488e24[_0x901d('0x14')]));});});};exports[_0x901d('0x1c')]=function(_0x46e5c6){var _0x45b6a8=this;return new Promise(function(_0x4c1318,_0x196a76){return db[_0x901d('0x18')][_0x901d('0x1d')](_0x46e5c6[_0x901d('0x1e')],{'raw':_0x46e5c6['options']?_0x46e5c6[_0x901d('0x1a')][_0x901d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46e5c6[_0x901d('0x1a')]?_0x46e5c6[_0x901d('0x1a')][_0x901d('0x20')]||null:null,'attributes':_0x46e5c6['options']?_0x46e5c6[_0x901d('0x1a')][_0x901d('0x21')]||null:null,'limit':_0x46e5c6[_0x901d('0x1a')]?_0x46e5c6[_0x901d('0x1a')][_0x901d('0x22')]||null:null})[_0x901d('0xd')](function(_0x48e86e){logger[_0x901d('0xe')]('UpdateMailQueueReport',_0x46e5c6);logger[_0x901d('0x11')](_0x901d('0x1c'),_0x46e5c6,JSON[_0x901d('0x1b')](_0x48e86e));_0x4c1318(_0x48e86e);})[_0x901d('0x16')](function(_0x1b1c17){logger[_0x901d('0x12')](_0x901d('0x1c'),_0x1b1c17[_0x901d('0x14')],_0x46e5c6);_0x196a76(_0x45b6a8[_0x901d('0x12')](0x1f4,_0x1b1c17[_0x901d('0x14')]));});});}; \ No newline at end of file +var _0xb016=['jayson/promise','client','http','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','debug','update','where','attributes','limit','UpdateMailQueueReport','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5b6cf3,_0x540aec){var _0x1ee57e=function(_0x89dbed){while(--_0x89dbed){_0x5b6cf3['push'](_0x5b6cf3['shift']());}};_0x1ee57e(++_0x540aec);}(_0xb016,0x159));var _0x6b01=function(_0x2628e8,_0x13027e){_0x2628e8=_0x2628e8-0x0;var _0x5b1415=_0xb016[_0x2628e8];return _0x5b1415;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')](_0x9c6571[_0x6b01('0x17')],{'raw':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x19')]===undefined?!![]:![]:!![]})[_0x6b01('0xa')](function(_0x3c0573){logger['info'](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1a')](_0x6b01('0x14'),_0x9c6571,JSON[_0x6b01('0xe')](_0x3c0573));_0x18f336(_0x3c0573);})[_0x6b01('0x13')](function(_0x181b09){logger[_0x6b01('0xf')]('CreateMailQueueReport',_0x181b09[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x181b09[_0x6b01('0x11')]));});});};exports['UpdateMailQueueReport']=function(_0x399808){var _0x70a1c0=this;return new Promise(function(_0x304393,_0x2ae85e){return db[_0x6b01('0x15')][_0x6b01('0x1b')](_0x399808[_0x6b01('0x17')],{'raw':_0x399808[_0x6b01('0x18')]?_0x399808[_0x6b01('0x18')][_0x6b01('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399808[_0x6b01('0x18')]?_0x399808[_0x6b01('0x18')][_0x6b01('0x1c')]||null:null,'attributes':_0x399808['options']?_0x399808[_0x6b01('0x18')][_0x6b01('0x1d')]||null:null,'limit':_0x399808[_0x6b01('0x18')]?_0x399808[_0x6b01('0x18')][_0x6b01('0x1e')]||null:null})['then'](function(_0x54f030){logger[_0x6b01('0xb')](_0x6b01('0x1f'),_0x399808);logger[_0x6b01('0x1a')](_0x6b01('0x1f'),_0x399808,JSON[_0x6b01('0xe')](_0x54f030));_0x304393(_0x54f030);})[_0x6b01('0x13')](function(_0x542ca0){logger[_0x6b01('0xf')]('UpdateMailQueueReport',_0x542ca0[_0x6b01('0x11')],_0x399808);_0x2ae85e(_0x70a1c0['error'](0x1f4,_0x542ca0[_0x6b01('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 854bdaf..c657269 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 _0x2188=['multer','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x2188,0x1b6));var _0x8218=function(_0x44b393,_0x237be7){_0x44b393=_0x44b393-0x0;var _0x906db2=_0x2188[_0x44b393];return _0x906db2;};'use strict';var multer=require(_0x8218('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8218('0x1'));var router=express[_0x8218('0x2')]();var auth=require(_0x8218('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8218('0x4'));module[_0x8218('0x5')]=router; \ No newline at end of file +var _0x5da0=['../../components/interaction/service','../../config/environment','multer','util','express','Router','../../components/auth/service'];(function(_0x16690d,_0x9b746c){var _0x246add=function(_0x5b9d58){while(--_0x5b9d58){_0x16690d['push'](_0x16690d['shift']());}};_0x246add(++_0x9b746c);}(_0x5da0,0x9c));var _0x05da=function(_0x4e2a9f,_0x4fa9b5){_0x4e2a9f=_0x4e2a9f-0x0;var _0xd250e4=_0x5da0[_0x4e2a9f];return _0xd250e4;};'use strict';var multer=require(_0x05da('0x0'));var util=require(_0x05da('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x05da('0x2'));var router=express[_0x05da('0x3')]();var auth=require(_0x05da('0x4'));var interaction=require(_0x05da('0x5'));var config=require(_0x05da('0x6'));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 cac8034..4d94e54 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 _0x92e6=['STRING','username','INTEGER','BOOLEAN','sequelize'];(function(_0x1ecb3a,_0x477e92){var _0x2fe14d=function(_0x2abf42){while(--_0x2abf42){_0x1ecb3a['push'](_0x1ecb3a['shift']());}};_0x2fe14d(++_0x477e92);}(_0x92e6,0x117));var _0x692e=function(_0x26b9cb,_0x12bc4c){_0x26b9cb=_0x26b9cb-0x0;var _0x3f44e6=_0x92e6[_0x26b9cb];return _0x3f44e6;};'use strict';var Sequelize=require(_0x692e('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x692e('0x1')],'unique':_0x692e('0x2')},'password':{'type':Sequelize[_0x692e('0x1')]},'port':{'type':Sequelize[_0x692e('0x3')]},'tls':{'type':Sequelize[_0x692e('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x692e('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x692e('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x692e('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x692e('0x1')]}}; \ No newline at end of file +var _0x32a5=['STRING','BOOLEAN','username','INTEGER','INBOX','sequelize'];(function(_0x8b69e9,_0x1407f9){var _0x485d2d=function(_0x3b9ce1){while(--_0x3b9ce1){_0x8b69e9['push'](_0x8b69e9['shift']());}};_0x485d2d(++_0x1407f9);}(_0x32a5,0x131));var _0x532a=function(_0x3e4ee4,_0x332ba1){_0x3e4ee4=_0x3e4ee4-0x0;var _0x399ccd=_0x32a5[_0x3e4ee4];return _0x399ccd;};'use strict';var Sequelize=require(_0x532a('0x0'));module['exports']={'description':{'type':Sequelize[_0x532a('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x532a('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x532a('0x1')],'unique':_0x532a('0x3')},'password':{'type':Sequelize[_0x532a('0x1')]},'port':{'type':Sequelize[_0x532a('0x4')]},'tls':{'type':Sequelize[_0x532a('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x532a('0x1')],'defaultValue':_0x532a('0x5')},'connTimeout':{'type':Sequelize[_0x532a('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x532a('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x532a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 3cac40b..a5878b2 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 _0xd7d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5853d8,_0x3c0829){_0x5853d8=_0x5853d8-0x0;var _0x4fec7d=_0xd7d1[_0x5853d8];return _0x4fec7d;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcbb=['rimraf','../../config/environment','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x47950f,_0xa0fc99){var _0x4f7a4f=function(_0x270857){while(--_0x270857){_0x47950f['push'](_0x47950f['shift']());}};_0x4f7a4f(++_0xa0fc99);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x18a902,_0x2ae257){_0x18a902=_0x18a902-0x0;var _0x18194d=_0xfcbb[_0x18a902];return _0x18194d;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var fs=require('fs');var path=require(_0xbfcb('0x5'));var rimraf=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x32c2aa,_0x4990c){return _0x32c2aa[_0xbfcb('0x8')](_0xbfcb('0x9'),attributes,{'tableName':_0xbfcb('0xa'),'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 cadf635..d53c7d2 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 _0xacc7=['options','raw','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetMailServerIn','MailServerIn','findAll'];(function(_0xdf23a,_0x3fd8e4){var _0x6d2e60=function(_0x26fcbd){while(--_0x26fcbd){_0xdf23a['push'](_0xdf23a['shift']());}};_0x6d2e60(++_0x3fd8e4);}(_0xacc7,0x90));var _0x7acc=function(_0x245d40,_0x455ece){_0x245d40=_0x245d40-0x0;var _0x245534=_0xacc7[_0x245d40];return _0x245534;};'use strict';var _=require(_0x7acc('0x0'));var util=require(_0x7acc('0x1'));var moment=require(_0x7acc('0x2'));var BPromise=require(_0x7acc('0x3'));var rs=require(_0x7acc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7acc('0x5'))['db'];var utils=require(_0x7acc('0x6'));var logger=require(_0x7acc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7acc('0x8'));var client=jayson[_0x7acc('0x9')][_0x7acc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cd695,_0x5c6350,_0x13a398){return new BPromise(function(_0x44561c,_0x533034){return client[_0x7acc('0xb')](_0x2cd695,_0x13a398)['then'](function(_0x54d961){logger[_0x7acc('0xc')](_0x7acc('0xd'),_0x5c6350,'request\x20sent');logger[_0x7acc('0xe')](_0x7acc('0xf'),_0x5c6350,'request\x20sent',JSON[_0x7acc('0x10')](_0x54d961));if(_0x54d961[_0x7acc('0x11')]){if(_0x54d961['error'][_0x7acc('0x12')]===0x1f4){logger[_0x7acc('0x11')](_0x7acc('0xd'),_0x5c6350,_0x54d961['error'][_0x7acc('0x13')]);return _0x533034(_0x54d961['error']['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x5c6350,_0x54d961[_0x7acc('0x11')][_0x7acc('0x13')]);return _0x44561c(_0x54d961[_0x7acc('0x11')][_0x7acc('0x13')]);}else{logger[_0x7acc('0xc')](_0x7acc('0xd'),_0x5c6350,_0x7acc('0x14'));_0x44561c(_0x54d961[_0x7acc('0x15')]['message']);}})[_0x7acc('0x16')](function(_0x1f8b32){logger[_0x7acc('0x11')](_0x7acc('0xd'),_0x5c6350,_0x1f8b32);_0x533034(_0x1f8b32);});});}exports[_0x7acc('0x17')]=function(_0xa87a14){var _0x2678f1=this;return new Promise(function(_0xbd3f0d,_0x163a63){return db[_0x7acc('0x18')][_0x7acc('0x19')]({'raw':_0xa87a14[_0x7acc('0x1a')]?_0xa87a14[_0x7acc('0x1a')][_0x7acc('0x1b')]===undefined?!![]:![]:!![],'where':_0xa87a14['options']?_0xa87a14[_0x7acc('0x1a')]['where']||null:null,'attributes':_0xa87a14[_0x7acc('0x1a')]?_0xa87a14[_0x7acc('0x1a')][_0x7acc('0x1c')]||null:null,'limit':_0xa87a14[_0x7acc('0x1a')]?_0xa87a14[_0x7acc('0x1a')][_0x7acc('0x1d')]||null:null,'include':_0xa87a14[_0x7acc('0x1a')]?_0xa87a14[_0x7acc('0x1a')][_0x7acc('0x1e')]?_[_0x7acc('0x1f')](_0xa87a14[_0x7acc('0x1a')][_0x7acc('0x1e')],function(_0x5d98a7){return{'model':db[_0x5d98a7['model']],'as':_0x5d98a7['as'],'attributes':_0x5d98a7['attributes'],'include':_0x5d98a7[_0x7acc('0x1e')]?_[_0x7acc('0x1f')](_0x5d98a7[_0x7acc('0x1e')],function(_0x4d9a4f){return{'model':db[_0x4d9a4f['model']],'as':_0x4d9a4f['as'],'attributes':_0x4d9a4f['attributes'],'include':_0x4d9a4f[_0x7acc('0x1e')]?_[_0x7acc('0x1f')](_0x4d9a4f['include'],function(_0xa8cd55){return{'model':db[_0xa8cd55[_0x7acc('0x20')]],'as':_0xa8cd55['as'],'attributes':_0xa8cd55[_0x7acc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7acc('0x21')](function(_0xb7d819){logger[_0x7acc('0xc')](_0x7acc('0x17'),_0xa87a14);logger[_0x7acc('0xe')](_0x7acc('0x17'),_0xa87a14,JSON[_0x7acc('0x10')](_0xb7d819));_0xbd3f0d(_0xb7d819);})[_0x7acc('0x16')](function(_0x28aca8){logger[_0x7acc('0x11')]('GetMailServerIn',_0x28aca8['message'],_0xa87a14);_0x163a63(_0x2678f1[_0x7acc('0x11')](0x1f4,_0x28aca8[_0x7acc('0x13')]));});});}; \ No newline at end of file +var _0xc9fc=['../../config/utils','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','findAll','options','attributes','include','model','map','GetMailServerIn','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x69c0c2,_0x2af0bf){var _0x3422f6=function(_0x283e41){while(--_0x283e41){_0x69c0c2['push'](_0x69c0c2['shift']());}};_0x3422f6(++_0x2af0bf);}(_0xc9fc,0x1bd));var _0xcc9f=function(_0x5a9896,_0x29fb94){_0x5a9896=_0x5a9896-0x0;var _0x4c5295=_0xc9fc[_0x5a9896];return _0x4c5295;};'use strict';var _=require(_0xcc9f('0x0'));var util=require(_0xcc9f('0x1'));var moment=require('moment');var BPromise=require(_0xcc9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc9f('0x3'));var db=require(_0xcc9f('0x4'))['db'];var utils=require(_0xcc9f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcc9f('0x6'));var jayson=require(_0xcc9f('0x7'));var client=jayson[_0xcc9f('0x8')][_0xcc9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30346c,_0x311300,_0x3ed33e){return new BPromise(function(_0x568787,_0x253782){return client['request'](_0x30346c,_0x3ed33e)[_0xcc9f('0xa')](function(_0x359a2e){logger[_0xcc9f('0xb')](_0xcc9f('0xc'),_0x311300,_0xcc9f('0xd'));logger[_0xcc9f('0xe')](_0xcc9f('0xf'),_0x311300,_0xcc9f('0xd'),JSON[_0xcc9f('0x10')](_0x359a2e));if(_0x359a2e[_0xcc9f('0x11')]){if(_0x359a2e[_0xcc9f('0x11')][_0xcc9f('0x12')]===0x1f4){logger['error'](_0xcc9f('0xc'),_0x311300,_0x359a2e[_0xcc9f('0x11')][_0xcc9f('0x13')]);return _0x253782(_0x359a2e[_0xcc9f('0x11')]['message']);}logger['error'](_0xcc9f('0xc'),_0x311300,_0x359a2e['error'][_0xcc9f('0x13')]);return _0x568787(_0x359a2e[_0xcc9f('0x11')][_0xcc9f('0x13')]);}else{logger[_0xcc9f('0xb')]('MailServerIn,\x20%s,\x20%s',_0x311300,_0xcc9f('0xd'));_0x568787(_0x359a2e[_0xcc9f('0x14')]['message']);}})[_0xcc9f('0x15')](function(_0x2548a1){logger[_0xcc9f('0x11')]('MailServerIn,\x20%s,\x20%s',_0x311300,_0x2548a1);_0x253782(_0x2548a1);});});}exports['GetMailServerIn']=function(_0x14c172){var _0x369e1f=this;return new Promise(function(_0x2730a1,_0x39e7c3){return db[_0xcc9f('0x16')][_0xcc9f('0x17')]({'raw':_0x14c172[_0xcc9f('0x18')]?_0x14c172['options']['raw']===undefined?!![]:![]:!![],'where':_0x14c172['options']?_0x14c172[_0xcc9f('0x18')]['where']||null:null,'attributes':_0x14c172[_0xcc9f('0x18')]?_0x14c172[_0xcc9f('0x18')][_0xcc9f('0x19')]||null:null,'limit':_0x14c172[_0xcc9f('0x18')]?_0x14c172[_0xcc9f('0x18')]['limit']||null:null,'include':_0x14c172[_0xcc9f('0x18')]?_0x14c172['options'][_0xcc9f('0x1a')]?_['map'](_0x14c172[_0xcc9f('0x18')][_0xcc9f('0x1a')],function(_0x5f1864){return{'model':db[_0x5f1864[_0xcc9f('0x1b')]],'as':_0x5f1864['as'],'attributes':_0x5f1864[_0xcc9f('0x19')],'include':_0x5f1864[_0xcc9f('0x1a')]?_[_0xcc9f('0x1c')](_0x5f1864['include'],function(_0x710907){return{'model':db[_0x710907['model']],'as':_0x710907['as'],'attributes':_0x710907[_0xcc9f('0x19')],'include':_0x710907[_0xcc9f('0x1a')]?_[_0xcc9f('0x1c')](_0x710907[_0xcc9f('0x1a')],function(_0x3e1349){return{'model':db[_0x3e1349[_0xcc9f('0x1b')]],'as':_0x3e1349['as'],'attributes':_0x3e1349[_0xcc9f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcc9f('0xa')](function(_0x138532){logger[_0xcc9f('0xb')](_0xcc9f('0x1d'),_0x14c172);logger['debug'](_0xcc9f('0x1d'),_0x14c172,JSON[_0xcc9f('0x10')](_0x138532));_0x2730a1(_0x138532);})[_0xcc9f('0x15')](function(_0x164d22){logger[_0xcc9f('0x11')](_0xcc9f('0x1d'),_0x164d22['message'],_0x14c172);_0x39e7c3(_0x369e1f[_0xcc9f('0x11')](0x1f4,_0x164d22[_0xcc9f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index cbf65cc..29b3334 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 _0xb87e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','/:id','show','create','put','update','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x4ca8f8,_0x2955f0){var _0x2fc4f0=function(_0x1a707e){while(--_0x1a707e){_0x4ca8f8['push'](_0x4ca8f8['shift']());}};_0x2fc4f0(++_0x2955f0);}(_0xb87e,0x11b));var _0xeb87=function(_0x1ae554,_0x26f9a6){_0x1ae554=_0x1ae554-0x0;var _0x4ac713=_0xb87e[_0x1ae554];return _0x4ac713;};'use strict';var multer=require('multer');var util=require(_0xeb87('0x0'));var path=require(_0xeb87('0x1'));var timeout=require(_0xeb87('0x2'));var express=require(_0xeb87('0x3'));var router=express[_0xeb87('0x4')]();var auth=require(_0xeb87('0x5'));var interaction=require(_0xeb87('0x6'));var config=require(_0xeb87('0x7'));var controller=require(_0xeb87('0x8'));router[_0xeb87('0x9')]('/',auth[_0xeb87('0xa')](),controller['index']);router['get'](_0xeb87('0xb'),auth['isAuthenticated'](),controller[_0xeb87('0xc')]);router['post']('/',auth[_0xeb87('0xa')](),controller[_0xeb87('0xd')]);router[_0xeb87('0xe')](_0xeb87('0xb'),auth['isAuthenticated'](),controller[_0xeb87('0xf')]);router['delete'](_0xeb87('0xb'),auth[_0xeb87('0xa')](),controller[_0xeb87('0x10')]);module[_0xeb87('0x11')]=router; \ No newline at end of file +var _0x060b=['update','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x060b,0x98));var _0xb060=function(_0x2f864a,_0x342edf){_0x2f864a=_0x2f864a-0x0;var _0x29b1c=_0x060b[_0x2f864a];return _0x29b1c;};'use strict';var multer=require(_0xb060('0x0'));var util=require(_0xb060('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb060('0x2'));var router=express['Router']();var auth=require(_0xb060('0x3'));var interaction=require(_0xb060('0x4'));var config=require(_0xb060('0x5'));var controller=require('./mailServerOut.controller');router[_0xb060('0x6')]('/',auth[_0xb060('0x7')](),controller['index']);router['get'](_0xb060('0x8'),auth[_0xb060('0x7')](),controller[_0xb060('0x9')]);router[_0xb060('0xa')]('/',auth[_0xb060('0x7')](),controller[_0xb060('0xb')]);router[_0xb060('0xc')](_0xb060('0x8'),auth[_0xb060('0x7')](),controller[_0xb060('0xd')]);router['delete'](_0xb060('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xb060('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index ec3df84..cb4b757 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 _0x1419=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2fd8c8,_0x14aaf3){var _0x2a9d00=function(_0x21bb31){while(--_0x21bb31){_0x2fd8c8['push'](_0x2fd8c8['shift']());}};_0x2a9d00(++_0x14aaf3);}(_0x1419,0x127));var _0x9141=function(_0x4e6ab2,_0x3b1bbf){_0x4e6ab2=_0x4e6ab2-0x0;var _0x2123dc=_0x1419[_0x4e6ab2];return _0x2123dc;};'use strict';var Sequelize=require(_0x9141('0x0'));module[_0x9141('0x1')]={'description':{'type':Sequelize[_0x9141('0x2')]},'host':{'type':Sequelize[_0x9141('0x2')]},'user':{'type':Sequelize[_0x9141('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x9141('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x9141('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xbd0e=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x479c7d,_0x4fc723){var _0x245e6f=function(_0x3ed35c){while(--_0x3ed35c){_0x479c7d['push'](_0x479c7d['shift']());}};_0x245e6f(++_0x4fc723);}(_0xbd0e,0x187));var _0xebd0=function(_0x3c9159,_0x58f463){_0x3c9159=_0x3c9159-0x0;var _0x3a6f26=_0xbd0e[_0x3c9159];return _0x3a6f26;};'use strict';var Sequelize=require('sequelize');module[_0xebd0('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xebd0('0x1')]},'user':{'type':Sequelize[_0xebd0('0x1')]},'pass':{'type':Sequelize[_0xebd0('0x1')]},'port':{'type':Sequelize[_0xebd0('0x2')]},'secure':{'type':Sequelize[_0xebd0('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xebd0('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index c3a2cf6..22b8b16 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 _0xbcfc=['bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x3b803c,_0x29e2f8){var _0x4e6b19=function(_0x13c8da){while(--_0x13c8da){_0x3b803c['push'](_0x3b803c['shift']());}};_0x4e6b19(++_0x29e2f8);}(_0xbcfc,0x162));var _0xcbcf=function(_0x4fa76d,_0x41fae0){_0x4fa76d=_0x4fa76d-0x0;var _0xfab718=_0xbcfc[_0x4fa76d];return _0xfab718;};'use strict';var pdf=require(_0xcbcf('0x0'));var emlformat=require(_0xcbcf('0x1'));var rimraf=require(_0xcbcf('0x2'));var zipdir=require(_0xcbcf('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbcf('0x4'));var moment=require(_0xcbcf('0x5'));var BPromise=require(_0xcbcf('0x6'));var Mustache=require(_0xcbcf('0x7'));var util=require(_0xcbcf('0x8'));var path=require('path');var sox=require(_0xcbcf('0x9'));var csv=require(_0xcbcf('0xa'));var ejs=require(_0xcbcf('0xb'));var fs=require('fs');var _=require(_0xcbcf('0xc'));var squel=require('squel');var crypto=require(_0xcbcf('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcbcf('0xa'));var querystring=require(_0xcbcf('0xe'));var Papa=require(_0xcbcf('0xf'));var Redis=require(_0xcbcf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcbcf('0x11'));var as=require(_0xcbcf('0x12'));var hardwareService=require(_0xcbcf('0x13'));var logger=require('../../config/logger')(_0xcbcf('0x14'));var utils=require(_0xcbcf('0x15'));var config=require(_0xcbcf('0x16'));var db=require(_0xcbcf('0x17'))['db'];function respondWithStatusCode(_0x4dbfc8,_0x263bee){_0x263bee=_0x263bee||0xcc;return function(_0x4aad26){if(_0x4aad26){return _0x4dbfc8[_0xcbcf('0x18')](_0x263bee);}return _0x4dbfc8[_0xcbcf('0x19')](_0x263bee)[_0xcbcf('0x1a')]();};}function respondWithResult(_0x170b12,_0x1b084e){_0x1b084e=_0x1b084e||0xc8;return function(_0x5a9bfc){if(_0x5a9bfc){return _0x170b12[_0xcbcf('0x19')](_0x1b084e)[_0xcbcf('0x1b')](_0x5a9bfc);}};}function respondWithFilteredResult(_0x3a9bd3,_0xd506a8){return function(_0x50f601){if(_0x50f601){var _0x2d7ca5=_0x50f601[_0xcbcf('0x1c')],_0x9bef50=_0xd506a8[_0xcbcf('0x1d')],_0xc2a7e9=_0xd506a8['offset']+_0xd506a8[_0xcbcf('0x1e')],_0x4a6a15;if(_0xc2a7e9>=_0x2d7ca5){_0xc2a7e9=_0x2d7ca5;_0x4a6a15=0xc8;}else{_0x4a6a15=0xce;}_0x3a9bd3[_0xcbcf('0x19')](_0x4a6a15);return _0x3a9bd3[_0xcbcf('0x1f')]('Content-Range',_0x9bef50+'-'+_0xc2a7e9+'/'+_0x2d7ca5)[_0xcbcf('0x1b')](_0x50f601);}return null;};}function patchUpdates(_0x283292){return function(_0x558a38){try{jsonpatch[_0xcbcf('0x20')](_0x558a38,_0x283292,!![]);}catch(_0x492dc3){return BPromise['reject'](_0x492dc3);}return _0x558a38['save']();};}function saveUpdates(_0x5bcbcf,_0x3600af){return function(_0x304d7f){if(_0x304d7f){return _0x304d7f[_0xcbcf('0x21')](_0x5bcbcf)[_0xcbcf('0x22')](function(_0x2c1906){return _0x2c1906;});}return null;};}function removeEntity(_0xb8511e,_0x5c6fd0){return function(_0x434502){if(_0x434502){return _0x434502['destroy']()[_0xcbcf('0x22')](function(){_0xb8511e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51da75,_0x3c371f){return function(_0x14372b){if(!_0x14372b){_0x51da75[_0xcbcf('0x18')](0x194);}return _0x14372b;};}function handleError(_0x148eec,_0x4e8e6b){_0x4e8e6b=_0x4e8e6b||0x1f4;return function(_0x541579){logger[_0xcbcf('0x23')](_0x541579[_0xcbcf('0x24')]);if(_0x541579[_0xcbcf('0x25')]){delete _0x541579['name'];}_0x148eec[_0xcbcf('0x19')](_0x4e8e6b)[_0xcbcf('0x26')](_0x541579);};}exports[_0xcbcf('0x27')]=function(_0x48740c,_0x54f0b7){var _0x10c028={},_0x1c251f={},_0x171655={'count':0x0,'rows':[]};var _0x4818aa=_[_0xcbcf('0x28')](db[_0xcbcf('0x29')][_0xcbcf('0x2a')],function(_0x92a7b4){return{'name':_0x92a7b4[_0xcbcf('0x2b')],'type':_0x92a7b4[_0xcbcf('0x2c')][_0xcbcf('0x2d')]};});_0x1c251f[_0xcbcf('0x2e')]=_[_0xcbcf('0x28')](_0x4818aa,_0xcbcf('0x25'));_0x1c251f['query']=_[_0xcbcf('0x2f')](_0x48740c[_0xcbcf('0x30')]);_0x1c251f[_0xcbcf('0x31')]=_[_0xcbcf('0x32')](_0x1c251f[_0xcbcf('0x2e')],_0x1c251f[_0xcbcf('0x30')]);_0x10c028['attributes']=_[_0xcbcf('0x32')](_0x1c251f[_0xcbcf('0x2e')],qs[_0xcbcf('0x33')](_0x48740c[_0xcbcf('0x30')][_0xcbcf('0x33')]));_0x10c028[_0xcbcf('0x34')]=_0x10c028['attributes'][_0xcbcf('0x35')]?_0x10c028[_0xcbcf('0x34')]:_0x1c251f['model'];if(!_0x48740c['query'][_0xcbcf('0x36')]('nolimit')){_0x10c028[_0xcbcf('0x1e')]=qs[_0xcbcf('0x1e')](_0x48740c[_0xcbcf('0x30')][_0xcbcf('0x1e')]);_0x10c028['offset']=qs[_0xcbcf('0x1d')](_0x48740c['query'][_0xcbcf('0x1d')]);}_0x10c028[_0xcbcf('0x37')]=qs[_0xcbcf('0x38')](_0x48740c[_0xcbcf('0x30')][_0xcbcf('0x38')]);_0x10c028[_0xcbcf('0x39')]=qs[_0xcbcf('0x31')](_[_0xcbcf('0x3a')](_0x48740c['query'],_0x1c251f['filters']),_0x4818aa);if(_0x48740c['query'][_0xcbcf('0x3b')]){_0x10c028['where']=_[_0xcbcf('0x3c')](_0x10c028['where'],{'$or':_[_0xcbcf('0x28')](_0x4818aa,function(_0x2266a5){if(_0x2266a5['type']!==_0xcbcf('0x3d')){var _0x5caa0f={};_0x5caa0f[_0x2266a5[_0xcbcf('0x25')]]={'$like':'%'+_0x48740c['query'][_0xcbcf('0x3b')]+'%'};return _0x5caa0f;}})});}_0x10c028=_[_0xcbcf('0x3c')]({},_0x10c028,_0x48740c[_0xcbcf('0x3e')]);var _0x1603f4={'where':_0x10c028[_0xcbcf('0x39')]};return db[_0xcbcf('0x29')][_0xcbcf('0x1c')](_0x1603f4)[_0xcbcf('0x22')](function(_0x38dfdf){_0x171655['count']=_0x38dfdf;if(_0x48740c[_0xcbcf('0x30')][_0xcbcf('0x3f')]){_0x10c028['include']=[{'all':!![]}];}return db['MailServerOut'][_0xcbcf('0x40')](_0x10c028);})[_0xcbcf('0x22')](function(_0x2171bb){_0x171655[_0xcbcf('0x41')]=_0x2171bb;return _0x171655;})[_0xcbcf('0x22')](respondWithFilteredResult(_0x54f0b7,_0x10c028))[_0xcbcf('0x42')](handleError(_0x54f0b7,null));};exports['show']=function(_0x1a8667,_0x53618f){var _0x26f39e={'raw':!![],'where':{'id':_0x1a8667[_0xcbcf('0x43')]['id']}},_0x54d18d={};_0x54d18d[_0xcbcf('0x2e')]=_[_0xcbcf('0x2f')](db['MailServerOut'][_0xcbcf('0x2a')]);_0x54d18d[_0xcbcf('0x30')]=_[_0xcbcf('0x2f')](_0x1a8667[_0xcbcf('0x30')]);_0x54d18d[_0xcbcf('0x31')]=_['intersection'](_0x54d18d[_0xcbcf('0x2e')],_0x54d18d[_0xcbcf('0x30')]);_0x26f39e[_0xcbcf('0x34')]=_[_0xcbcf('0x32')](_0x54d18d[_0xcbcf('0x2e')],qs[_0xcbcf('0x33')](_0x1a8667[_0xcbcf('0x30')][_0xcbcf('0x33')]));_0x26f39e['attributes']=_0x26f39e[_0xcbcf('0x34')]['length']?_0x26f39e[_0xcbcf('0x34')]:_0x54d18d[_0xcbcf('0x2e')];if(_0x1a8667[_0xcbcf('0x30')][_0xcbcf('0x3f')]){_0x26f39e[_0xcbcf('0x44')]=[{'all':!![]}];}_0x26f39e=_[_0xcbcf('0x3c')]({},_0x26f39e,_0x1a8667[_0xcbcf('0x3e')]);return db['MailServerOut']['find'](_0x26f39e)[_0xcbcf('0x22')](handleEntityNotFound(_0x53618f,null))[_0xcbcf('0x22')](respondWithResult(_0x53618f,null))[_0xcbcf('0x42')](handleError(_0x53618f,null));};exports[_0xcbcf('0x45')]=function(_0x22d7d8,_0x130f1d){return db['MailServerOut'][_0xcbcf('0x45')](_0x22d7d8[_0xcbcf('0x46')],{})[_0xcbcf('0x22')](respondWithResult(_0x130f1d,0xc9))[_0xcbcf('0x42')](handleError(_0x130f1d,null));};exports[_0xcbcf('0x21')]=function(_0x1f4672,_0x4bd1ca){if(_0x1f4672[_0xcbcf('0x46')]['id']){delete _0x1f4672['body']['id'];}return db['MailServerOut'][_0xcbcf('0x47')]({'where':{'id':_0x1f4672[_0xcbcf('0x43')]['id']}})[_0xcbcf('0x22')](handleEntityNotFound(_0x4bd1ca,null))[_0xcbcf('0x22')](saveUpdates(_0x1f4672[_0xcbcf('0x46')],null))[_0xcbcf('0x22')](respondWithResult(_0x4bd1ca,null))[_0xcbcf('0x42')](handleError(_0x4bd1ca,null));};exports['destroy']=function(_0x2a06d9,_0x2c08bd){return db[_0xcbcf('0x29')][_0xcbcf('0x47')]({'where':{'id':_0x2a06d9[_0xcbcf('0x43')]['id']}})[_0xcbcf('0x22')](handleEntityNotFound(_0x2c08bd,null))[_0xcbcf('0x22')](removeEntity(_0x2c08bd,null))[_0xcbcf('0x42')](handleError(_0x2c08bd,null));}; \ No newline at end of file +var _0x75f3=['body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','MailServerOut','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','findAll','catch','show','params','keys','rawAttributes','includeAll','include','find','create','update'];(function(_0x1932b1,_0xd936fe){var _0x5236b5=function(_0x133c12){while(--_0x133c12){_0x1932b1['push'](_0x1932b1['shift']());}};_0x5236b5(++_0xd936fe);}(_0x75f3,0x125));var _0x375f=function(_0x3913bd,_0x319252){_0x3913bd=_0x3913bd-0x0;var _0x110995=_0x75f3[_0x3913bd];return _0x110995;};'use strict';var pdf=require(_0x375f('0x0'));var emlformat=require(_0x375f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x375f('0x2'));var jsonpatch=require(_0x375f('0x3'));var rp=require(_0x375f('0x4'));var moment=require(_0x375f('0x5'));var BPromise=require(_0x375f('0x6'));var Mustache=require(_0x375f('0x7'));var util=require(_0x375f('0x8'));var path=require('path');var sox=require(_0x375f('0x9'));var csv=require('to-csv');var ejs=require(_0x375f('0xa'));var fs=require('fs');var _=require(_0x375f('0xb'));var squel=require('squel');var crypto=require(_0x375f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x375f('0xd'));var toCsv=require(_0x375f('0xe'));var querystring=require(_0x375f('0xf'));var Papa=require('papaparse');var Redis=require(_0x375f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x375f('0x11'));var hardwareService=require(_0x375f('0x12'));var logger=require(_0x375f('0x13'))(_0x375f('0x14'));var utils=require('../../config/utils');var config=require(_0x375f('0x15'));var db=require(_0x375f('0x16'))['db'];function respondWithStatusCode(_0x164470,_0x5e025c){_0x5e025c=_0x5e025c||0xcc;return function(_0x2a81d0){if(_0x2a81d0){return _0x164470[_0x375f('0x17')](_0x5e025c);}return _0x164470[_0x375f('0x18')](_0x5e025c)[_0x375f('0x19')]();};}function respondWithResult(_0x43c5f0,_0x43f4a1){_0x43f4a1=_0x43f4a1||0xc8;return function(_0x2edd4c){if(_0x2edd4c){return _0x43c5f0[_0x375f('0x18')](_0x43f4a1)[_0x375f('0x1a')](_0x2edd4c);}};}function respondWithFilteredResult(_0x2fa612,_0xe11e65){return function(_0x57c6ba){if(_0x57c6ba){var _0x56f9a8=_0x57c6ba[_0x375f('0x1b')],_0x3b073f=_0xe11e65[_0x375f('0x1c')],_0x4a7c6d=_0xe11e65[_0x375f('0x1c')]+_0xe11e65['limit'],_0x209cbd;if(_0x4a7c6d>=_0x56f9a8){_0x4a7c6d=_0x56f9a8;_0x209cbd=0xc8;}else{_0x209cbd=0xce;}_0x2fa612['status'](_0x209cbd);return _0x2fa612[_0x375f('0x1d')](_0x375f('0x1e'),_0x3b073f+'-'+_0x4a7c6d+'/'+_0x56f9a8)[_0x375f('0x1a')](_0x57c6ba);}return null;};}function patchUpdates(_0x40a75d){return function(_0xb906c1){try{jsonpatch[_0x375f('0x1f')](_0xb906c1,_0x40a75d,!![]);}catch(_0x8e8df6){return BPromise[_0x375f('0x20')](_0x8e8df6);}return _0xb906c1[_0x375f('0x21')]();};}function saveUpdates(_0x3ecf3a,_0x21260c){return function(_0x302138){if(_0x302138){return _0x302138['update'](_0x3ecf3a)[_0x375f('0x22')](function(_0x36f5c5){return _0x36f5c5;});}return null;};}function removeEntity(_0x5393e9,_0x3e0512){return function(_0x48dd51){if(_0x48dd51){return _0x48dd51[_0x375f('0x23')]()[_0x375f('0x22')](function(){_0x5393e9['status'](0xcc)[_0x375f('0x19')]();});}};}function handleEntityNotFound(_0x5266a5,_0x4c3e8b){return function(_0x44df99){if(!_0x44df99){_0x5266a5[_0x375f('0x17')](0x194);}return _0x44df99;};}function handleError(_0x1daf05,_0x46a9b1){_0x46a9b1=_0x46a9b1||0x1f4;return function(_0x133954){logger['error'](_0x133954[_0x375f('0x24')]);if(_0x133954[_0x375f('0x25')]){delete _0x133954['name'];}_0x1daf05[_0x375f('0x18')](_0x46a9b1)[_0x375f('0x26')](_0x133954);};}exports[_0x375f('0x27')]=function(_0x31c714,_0x5d773b){var _0x5e49c3={},_0x1be491={},_0x275072={'count':0x0,'rows':[]};var _0x29b7f0=_[_0x375f('0x28')](db[_0x375f('0x29')]['rawAttributes'],function(_0x4b760d){return{'name':_0x4b760d[_0x375f('0x2a')],'type':_0x4b760d[_0x375f('0x2b')][_0x375f('0x2c')]};});_0x1be491['model']=_[_0x375f('0x28')](_0x29b7f0,_0x375f('0x25'));_0x1be491[_0x375f('0x2d')]=_['keys'](_0x31c714[_0x375f('0x2d')]);_0x1be491[_0x375f('0x2e')]=_[_0x375f('0x2f')](_0x1be491[_0x375f('0x30')],_0x1be491[_0x375f('0x2d')]);_0x5e49c3['attributes']=_[_0x375f('0x2f')](_0x1be491[_0x375f('0x30')],qs['fields'](_0x31c714[_0x375f('0x2d')][_0x375f('0x31')]));_0x5e49c3['attributes']=_0x5e49c3[_0x375f('0x32')][_0x375f('0x33')]?_0x5e49c3[_0x375f('0x32')]:_0x1be491[_0x375f('0x30')];if(!_0x31c714['query'][_0x375f('0x34')](_0x375f('0x35'))){_0x5e49c3[_0x375f('0x36')]=qs[_0x375f('0x36')](_0x31c714[_0x375f('0x2d')][_0x375f('0x36')]);_0x5e49c3[_0x375f('0x1c')]=qs[_0x375f('0x1c')](_0x31c714['query']['offset']);}_0x5e49c3[_0x375f('0x37')]=qs[_0x375f('0x38')](_0x31c714[_0x375f('0x2d')][_0x375f('0x38')]);_0x5e49c3[_0x375f('0x39')]=qs[_0x375f('0x2e')](_[_0x375f('0x3a')](_0x31c714[_0x375f('0x2d')],_0x1be491['filters']),_0x29b7f0);if(_0x31c714[_0x375f('0x2d')]['filter']){_0x5e49c3[_0x375f('0x39')]=_[_0x375f('0x3b')](_0x5e49c3[_0x375f('0x39')],{'$or':_['map'](_0x29b7f0,function(_0xeabb6){if(_0xeabb6[_0x375f('0x2b')]!=='VIRTUAL'){var _0x485fb9={};_0x485fb9[_0xeabb6['name']]={'$like':'%'+_0x31c714[_0x375f('0x2d')]['filter']+'%'};return _0x485fb9;}})});}_0x5e49c3=_[_0x375f('0x3b')]({},_0x5e49c3,_0x31c714[_0x375f('0x3c')]);var _0x24949c={'where':_0x5e49c3['where']};return db['MailServerOut'][_0x375f('0x1b')](_0x24949c)[_0x375f('0x22')](function(_0x1c3d12){_0x275072['count']=_0x1c3d12;if(_0x31c714[_0x375f('0x2d')]['includeAll']){_0x5e49c3['include']=[{'all':!![]}];}return db[_0x375f('0x29')][_0x375f('0x3d')](_0x5e49c3);})[_0x375f('0x22')](function(_0xeb55c3){_0x275072['rows']=_0xeb55c3;return _0x275072;})[_0x375f('0x22')](respondWithFilteredResult(_0x5d773b,_0x5e49c3))[_0x375f('0x3e')](handleError(_0x5d773b,null));};exports[_0x375f('0x3f')]=function(_0x32e89c,_0x4c3991){var _0x363267={'raw':!![],'where':{'id':_0x32e89c[_0x375f('0x40')]['id']}},_0x52b470={};_0x52b470[_0x375f('0x30')]=_[_0x375f('0x41')](db[_0x375f('0x29')][_0x375f('0x42')]);_0x52b470[_0x375f('0x2d')]=_[_0x375f('0x41')](_0x32e89c['query']);_0x52b470[_0x375f('0x2e')]=_[_0x375f('0x2f')](_0x52b470[_0x375f('0x30')],_0x52b470[_0x375f('0x2d')]);_0x363267[_0x375f('0x32')]=_[_0x375f('0x2f')](_0x52b470[_0x375f('0x30')],qs[_0x375f('0x31')](_0x32e89c[_0x375f('0x2d')][_0x375f('0x31')]));_0x363267[_0x375f('0x32')]=_0x363267[_0x375f('0x32')][_0x375f('0x33')]?_0x363267[_0x375f('0x32')]:_0x52b470[_0x375f('0x30')];if(_0x32e89c['query'][_0x375f('0x43')]){_0x363267[_0x375f('0x44')]=[{'all':!![]}];}_0x363267=_['merge']({},_0x363267,_0x32e89c[_0x375f('0x3c')]);return db['MailServerOut'][_0x375f('0x45')](_0x363267)[_0x375f('0x22')](handleEntityNotFound(_0x4c3991,null))[_0x375f('0x22')](respondWithResult(_0x4c3991,null))[_0x375f('0x3e')](handleError(_0x4c3991,null));};exports['create']=function(_0x23a46b,_0x3d6d23){return db[_0x375f('0x29')][_0x375f('0x46')](_0x23a46b['body'],{})[_0x375f('0x22')](respondWithResult(_0x3d6d23,0xc9))[_0x375f('0x3e')](handleError(_0x3d6d23,null));};exports[_0x375f('0x47')]=function(_0x1cabbc,_0x24cff4){if(_0x1cabbc[_0x375f('0x48')]['id']){delete _0x1cabbc[_0x375f('0x48')]['id'];}return db[_0x375f('0x29')][_0x375f('0x45')]({'where':{'id':_0x1cabbc['params']['id']}})[_0x375f('0x22')](handleEntityNotFound(_0x24cff4,null))[_0x375f('0x22')](saveUpdates(_0x1cabbc[_0x375f('0x48')],null))['then'](respondWithResult(_0x24cff4,null))[_0x375f('0x3e')](handleError(_0x24cff4,null));};exports[_0x375f('0x23')]=function(_0x43e797,_0x59443e){return db['MailServerOut'][_0x375f('0x45')]({'where':{'id':_0x43e797[_0x375f('0x40')]['id']}})['then'](handleEntityNotFound(_0x59443e,null))[_0x375f('0x22')](removeEntity(_0x59443e,null))['catch'](handleError(_0x59443e,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 5414266..b8d7c01 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4a450a,_0x54d42f){_0x4a450a=_0x4a450a-0x0;var _0x28baf9=_0x7fbe[_0x4a450a];return _0x28baf9;};'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':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./mailServerOut.attributes','exports','define','MailServerOut','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x30299b,_0x9c2c67){var _0x2efb37=function(_0x28adbd){while(--_0x28adbd){_0x30299b['push'](_0x30299b['shift']());}};_0x2efb37(++_0x9c2c67);}(_0x1cb9,0x14e));var _0x91cb=function(_0x386a3b,_0x2c8cc4){_0x386a3b=_0x386a3b-0x0;var _0x527a19=_0x1cb9[_0x386a3b];return _0x527a19;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),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 70b48ee..aa10f61 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 _0xda38=['http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x98ee7c,_0x499bff){var _0xe4d709=function(_0x12791a){while(--_0x12791a){_0x98ee7c['push'](_0x98ee7c['shift']());}};_0xe4d709(++_0x499bff);}(_0xda38,0xa5));var _0x8da3=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xda38[_0x5a26f5];return _0x2e9ef7;};'use strict';var _=require(_0x8da3('0x0'));var util=require(_0x8da3('0x1'));var moment=require(_0x8da3('0x2'));var BPromise=require(_0x8da3('0x3'));var rs=require(_0x8da3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8da3('0x5'))['db'];var utils=require(_0x8da3('0x6'));var logger=require(_0x8da3('0x7'))(_0x8da3('0x8'));var config=require('../../config/environment');var jayson=require(_0x8da3('0x9'));var client=jayson[_0x8da3('0xa')][_0x8da3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x283099,_0x4de131,_0x1d4dba){return new BPromise(function(_0x2447e1,_0x5d1dfc){return client[_0x8da3('0xc')](_0x283099,_0x1d4dba)[_0x8da3('0xd')](function(_0x1928ca){logger[_0x8da3('0xe')](_0x8da3('0xf'),_0x4de131,_0x8da3('0x10'));logger['debug'](_0x8da3('0x11'),_0x4de131,_0x8da3('0x10'),JSON['stringify'](_0x1928ca));if(_0x1928ca[_0x8da3('0x12')]){if(_0x1928ca['error'][_0x8da3('0x13')]===0x1f4){logger[_0x8da3('0x12')](_0x8da3('0xf'),_0x4de131,_0x1928ca['error']['message']);return _0x5d1dfc(_0x1928ca[_0x8da3('0x12')][_0x8da3('0x14')]);}logger[_0x8da3('0x12')](_0x8da3('0xf'),_0x4de131,_0x1928ca['error'][_0x8da3('0x14')]);return _0x2447e1(_0x1928ca['error'][_0x8da3('0x14')]);}else{logger[_0x8da3('0xe')](_0x8da3('0xf'),_0x4de131,_0x8da3('0x10'));_0x2447e1(_0x1928ca['result'][_0x8da3('0x14')]);}})[_0x8da3('0x15')](function(_0xfc55b){logger[_0x8da3('0x12')](_0x8da3('0xf'),_0x4de131,_0xfc55b);_0x5d1dfc(_0xfc55b);});});} \ No newline at end of file +var _0x2f22=['client','http','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x11ea64,_0x59f7a2){var _0x30590a=function(_0xdf3f4d){while(--_0xdf3f4d){_0x11ea64['push'](_0x11ea64['shift']());}};_0x30590a(++_0x59f7a2);}(_0x2f22,0x187));var _0x22f2=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2f22[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x22f2('0x0'));var BPromise=require('bluebird');var rs=require(_0x22f2('0x1'));var fs=require('fs');var Redis=require(_0x22f2('0x2'));var db=require(_0x22f2('0x3'))['db'];var utils=require(_0x22f2('0x4'));var logger=require(_0x22f2('0x5'))(_0x22f2('0x6'));var config=require(_0x22f2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x22f2('0x8')][_0x22f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2deefb,_0x4dbe8e,_0x5bbfbd){return new BPromise(function(_0x1d29e9,_0x2875e6){return client['request'](_0x2deefb,_0x5bbfbd)[_0x22f2('0xa')](function(_0x3732a6){logger[_0x22f2('0xb')](_0x22f2('0xc'),_0x4dbe8e,_0x22f2('0xd'));logger[_0x22f2('0xe')](_0x22f2('0xf'),_0x4dbe8e,_0x22f2('0xd'),JSON['stringify'](_0x3732a6));if(_0x3732a6['error']){if(_0x3732a6[_0x22f2('0x10')][_0x22f2('0x11')]===0x1f4){logger[_0x22f2('0x10')](_0x22f2('0xc'),_0x4dbe8e,_0x3732a6['error'][_0x22f2('0x12')]);return _0x2875e6(_0x3732a6['error'][_0x22f2('0x12')]);}logger[_0x22f2('0x10')](_0x22f2('0xc'),_0x4dbe8e,_0x3732a6['error'][_0x22f2('0x12')]);return _0x1d29e9(_0x3732a6[_0x22f2('0x10')][_0x22f2('0x12')]);}else{logger['info'](_0x22f2('0xc'),_0x4dbe8e,'request\x20sent');_0x1d29e9(_0x3732a6[_0x22f2('0x13')][_0x22f2('0x12')]);}})[_0x22f2('0x14')](function(_0x781b28){logger[_0x22f2('0x10')](_0x22f2('0xc'),_0x4dbe8e,_0x781b28);_0x2875e6(_0x781b28);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 4cadb86..34e1271 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 _0x4f5c=['show','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x4f5c,0xff));var _0xc4f5=function(_0x4a9f24,_0x43c422){_0x4a9f24=_0x4a9f24-0x0;var _0x13199b=_0x4f5c[_0x4a9f24];return _0x13199b;};'use strict';var multer=require(_0xc4f5('0x0'));var util=require(_0xc4f5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc4f5('0x2'));var router=express[_0xc4f5('0x3')]();var auth=require(_0xc4f5('0x4'));var interaction=require(_0xc4f5('0x5'));var config=require(_0xc4f5('0x6'));var controller=require(_0xc4f5('0x7'));router[_0xc4f5('0x8')]('/',auth[_0xc4f5('0x9')](),controller[_0xc4f5('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc4f5('0x8')]('/:id',auth[_0xc4f5('0x9')](),controller[_0xc4f5('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc4f5('0xc')]);router[_0xc4f5('0xd')](_0xc4f5('0xe'),auth['isAuthenticated'](),controller[_0xc4f5('0xf')]);router[_0xc4f5('0x10')](_0xc4f5('0xe'),auth[_0xc4f5('0x9')](),controller[_0xc4f5('0x11')]);module[_0xc4f5('0x12')]=router; \ No newline at end of file +var _0xacbe=['isAuthenticated','index','/describe','describe','get','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0x19e172,_0x31e605){var _0x1c5e89=function(_0x14bcee){while(--_0x14bcee){_0x19e172['push'](_0x19e172['shift']());}};_0x1c5e89(++_0x31e605);}(_0xacbe,0x187));var _0xeacb=function(_0xe73498,_0x3d8943){_0xe73498=_0xe73498-0x0;var _0x4debca=_0xacbe[_0xe73498];return _0x4debca;};'use strict';var multer=require(_0xeacb('0x0'));var util=require('util');var path=require(_0xeacb('0x1'));var timeout=require(_0xeacb('0x2'));var express=require('express');var router=express[_0xeacb('0x3')]();var auth=require(_0xeacb('0x4'));var interaction=require(_0xeacb('0x5'));var config=require(_0xeacb('0x6'));var controller=require(_0xeacb('0x7'));router['get']('/',auth[_0xeacb('0x8')](),controller[_0xeacb('0x9')]);router['get'](_0xeacb('0xa'),auth['isAuthenticated'](),controller[_0xeacb('0xb')]);router[_0xeacb('0xc')]('/:id',auth[_0xeacb('0x8')](),controller[_0xeacb('0xd')]);router[_0xeacb('0xe')]('/',auth['isAuthenticated'](),controller[_0xeacb('0xf')]);router[_0xeacb('0x10')](_0xeacb('0x11'),auth[_0xeacb('0x8')](),controller[_0xeacb('0x12')]);router[_0xeacb('0x13')](_0xeacb('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xeacb('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 41bf76e..7bd205d 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 _0x553a=['exports','name','STRING'];(function(_0x351181,_0x20dd99){var _0x431045=function(_0x4f13ba){while(--_0x4f13ba){_0x351181['push'](_0x351181['shift']());}};_0x431045(++_0x20dd99);}(_0x553a,0x192));var _0xa553=function(_0x86c6cb,_0x30bb53){_0x86c6cb=_0x86c6cb-0x0;var _0x1b1592=_0x553a[_0x86c6cb];return _0x1b1592;};'use strict';var Sequelize=require('sequelize');module[_0xa553('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa553('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa553('0x2')]}}; \ No newline at end of file +var _0xd9eb=['STRING','name','sequelize','exports'];(function(_0x1794f6,_0x2f9ced){var _0x3aad81=function(_0x480dc7){while(--_0x480dc7){_0x1794f6['push'](_0x1794f6['shift']());}};_0x3aad81(++_0x2f9ced);}(_0xd9eb,0xca));var _0xbd9e=function(_0x4d26f3,_0x3e1615){_0x4d26f3=_0x4d26f3-0x0;var _0x3accb7=_0xd9eb[_0x4d26f3];return _0x3accb7;};'use strict';var Sequelize=require(_0xbd9e('0x0'));module[_0xbd9e('0x1')]={'name':{'type':Sequelize[_0xbd9e('0x2')],'unique':_0xbd9e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbd9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index b5adb48..8f4a0be 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 _0x9efa=['create','update','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','find'];(function(_0x2822c9,_0x5df2b1){var _0x521919=function(_0x21faa9){while(--_0x21faa9){_0x2822c9['push'](_0x2822c9['shift']());}};_0x521919(++_0x5df2b1);}(_0x9efa,0xdd));var _0xa9ef=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x9efa[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0xa9ef('0x0'));var emlformat=require(_0xa9ef('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9ef('0x2'));var jsonpatch=require(_0xa9ef('0x3'));var rp=require(_0xa9ef('0x4'));var moment=require(_0xa9ef('0x5'));var BPromise=require(_0xa9ef('0x6'));var Mustache=require(_0xa9ef('0x7'));var util=require('util');var path=require(_0xa9ef('0x8'));var sox=require(_0xa9ef('0x9'));var csv=require(_0xa9ef('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa9ef('0xb'));var squel=require(_0xa9ef('0xc'));var crypto=require(_0xa9ef('0xd'));var jsforce=require(_0xa9ef('0xe'));var deskjs=require(_0xa9ef('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa9ef('0x10'));var Redis=require('ioredis');var authService=require(_0xa9ef('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa9ef('0x12'));var hardwareService=require(_0xa9ef('0x13'));var logger=require(_0xa9ef('0x14'))('api');var utils=require(_0xa9ef('0x15'));var config=require('../../config/environment');var db=require(_0xa9ef('0x16'))['db'];function respondWithStatusCode(_0x286c73,_0x10c859){_0x10c859=_0x10c859||0xcc;return function(_0x33f45d){if(_0x33f45d){return _0x286c73[_0xa9ef('0x17')](_0x10c859);}return _0x286c73['status'](_0x10c859)[_0xa9ef('0x18')]();};}function respondWithResult(_0x21bc38,_0x5dea9b){_0x5dea9b=_0x5dea9b||0xc8;return function(_0x142475){if(_0x142475){return _0x21bc38['status'](_0x5dea9b)[_0xa9ef('0x19')](_0x142475);}};}function respondWithFilteredResult(_0x2a8434,_0x7251e5){return function(_0x241689){if(_0x241689){var _0x1fd00e=_0x241689[_0xa9ef('0x1a')],_0x4ebfba=_0x7251e5[_0xa9ef('0x1b')],_0x2143bd=_0x7251e5['offset']+_0x7251e5[_0xa9ef('0x1c')],_0x18a4cd;if(_0x2143bd>=_0x1fd00e){_0x2143bd=_0x1fd00e;_0x18a4cd=0xc8;}else{_0x18a4cd=0xce;}_0x2a8434[_0xa9ef('0x1d')](_0x18a4cd);return _0x2a8434[_0xa9ef('0x1e')](_0xa9ef('0x1f'),_0x4ebfba+'-'+_0x2143bd+'/'+_0x1fd00e)[_0xa9ef('0x19')](_0x241689);}return null;};}function patchUpdates(_0x3a12e2){return function(_0x4bf5f4){try{jsonpatch[_0xa9ef('0x20')](_0x4bf5f4,_0x3a12e2,!![]);}catch(_0x1a50f1){return BPromise[_0xa9ef('0x21')](_0x1a50f1);}return _0x4bf5f4[_0xa9ef('0x22')]();};}function saveUpdates(_0x377e46,_0x324a37){return function(_0x361abd){if(_0x361abd){return _0x361abd['update'](_0x377e46)['then'](function(_0x4217b9){return _0x4217b9;});}return null;};}function removeEntity(_0x59f7ce,_0x4ff316){return function(_0x46e4a9){if(_0x46e4a9){return _0x46e4a9['destroy']()[_0xa9ef('0x23')](function(){_0x59f7ce[_0xa9ef('0x1d')](0xcc)[_0xa9ef('0x18')]();});}};}function handleEntityNotFound(_0xd8c131,_0x40699a){return function(_0xb7bbb7){if(!_0xb7bbb7){_0xd8c131[_0xa9ef('0x17')](0x194);}return _0xb7bbb7;};}function handleError(_0x3cf803,_0x4d759c){_0x4d759c=_0x4d759c||0x1f4;return function(_0x3e5b20){logger['error'](_0x3e5b20[_0xa9ef('0x24')]);if(_0x3e5b20[_0xa9ef('0x25')]){delete _0x3e5b20['name'];}_0x3cf803['status'](_0x4d759c)['send'](_0x3e5b20);};}exports[_0xa9ef('0x26')]=function(_0x4472f0,_0x540bae){var _0x6f7a20={},_0x11e906={},_0x1efa52={'count':0x0,'rows':[]};var _0x34472c=_[_0xa9ef('0x27')](db[_0xa9ef('0x28')][_0xa9ef('0x29')],function(_0x38a3f9){return{'name':_0x38a3f9[_0xa9ef('0x2a')],'type':_0x38a3f9[_0xa9ef('0x2b')][_0xa9ef('0x2c')]};});_0x11e906[_0xa9ef('0x2d')]=_[_0xa9ef('0x27')](_0x34472c,_0xa9ef('0x25'));_0x11e906[_0xa9ef('0x2e')]=_[_0xa9ef('0x2f')](_0x4472f0[_0xa9ef('0x2e')]);_0x11e906['filters']=_['intersection'](_0x11e906['model'],_0x11e906['query']);_0x6f7a20[_0xa9ef('0x30')]=_[_0xa9ef('0x31')](_0x11e906[_0xa9ef('0x2d')],qs[_0xa9ef('0x32')](_0x4472f0[_0xa9ef('0x2e')][_0xa9ef('0x32')]));_0x6f7a20[_0xa9ef('0x30')]=_0x6f7a20[_0xa9ef('0x30')][_0xa9ef('0x33')]?_0x6f7a20[_0xa9ef('0x30')]:_0x11e906[_0xa9ef('0x2d')];if(!_0x4472f0[_0xa9ef('0x2e')][_0xa9ef('0x34')](_0xa9ef('0x35'))){_0x6f7a20[_0xa9ef('0x1c')]=qs[_0xa9ef('0x1c')](_0x4472f0['query']['limit']);_0x6f7a20[_0xa9ef('0x1b')]=qs[_0xa9ef('0x1b')](_0x4472f0['query']['offset']);}_0x6f7a20['order']=qs[_0xa9ef('0x36')](_0x4472f0[_0xa9ef('0x2e')][_0xa9ef('0x36')]);_0x6f7a20[_0xa9ef('0x37')]=qs[_0xa9ef('0x38')](_['pick'](_0x4472f0[_0xa9ef('0x2e')],_0x11e906[_0xa9ef('0x38')]),_0x34472c);if(_0x4472f0['query']['filter']){_0x6f7a20['where']=_['merge'](_0x6f7a20[_0xa9ef('0x37')],{'$or':_[_0xa9ef('0x27')](_0x34472c,function(_0x54a702){if(_0x54a702['type']!==_0xa9ef('0x39')){var _0x1d6970={};_0x1d6970[_0x54a702[_0xa9ef('0x25')]]={'$like':'%'+_0x4472f0[_0xa9ef('0x2e')]['filter']+'%'};return _0x1d6970;}})});}_0x6f7a20=_[_0xa9ef('0x3a')]({},_0x6f7a20,_0x4472f0[_0xa9ef('0x3b')]);var _0x509ab8={'where':_0x6f7a20['where']};return db[_0xa9ef('0x28')][_0xa9ef('0x1a')](_0x509ab8)[_0xa9ef('0x23')](function(_0x5ec712){_0x1efa52['count']=_0x5ec712;if(_0x4472f0['query']['includeAll']){_0x6f7a20[_0xa9ef('0x3c')]=[{'all':!![]}];}return db[_0xa9ef('0x28')][_0xa9ef('0x3d')](_0x6f7a20);})[_0xa9ef('0x23')](function(_0x418902){_0x1efa52[_0xa9ef('0x3e')]=_0x418902;return _0x1efa52;})['then'](respondWithFilteredResult(_0x540bae,_0x6f7a20))[_0xa9ef('0x3f')](handleError(_0x540bae,null));};exports[_0xa9ef('0x40')]=function(_0x4f7b03,_0xb60b77){var _0x4cb488={'raw':!![],'where':{'id':_0x4f7b03[_0xa9ef('0x41')]['id']}},_0x1d3fcd={};_0x1d3fcd['model']=_[_0xa9ef('0x2f')](db[_0xa9ef('0x28')]['rawAttributes']);_0x1d3fcd[_0xa9ef('0x2e')]=_['keys'](_0x4f7b03['query']);_0x1d3fcd['filters']=_['intersection'](_0x1d3fcd[_0xa9ef('0x2d')],_0x1d3fcd[_0xa9ef('0x2e')]);_0x4cb488[_0xa9ef('0x30')]=_['intersection'](_0x1d3fcd['model'],qs[_0xa9ef('0x32')](_0x4f7b03[_0xa9ef('0x2e')][_0xa9ef('0x32')]));_0x4cb488[_0xa9ef('0x30')]=_0x4cb488[_0xa9ef('0x30')][_0xa9ef('0x33')]?_0x4cb488[_0xa9ef('0x30')]:_0x1d3fcd[_0xa9ef('0x2d')];if(_0x4f7b03[_0xa9ef('0x2e')]['includeAll']){_0x4cb488[_0xa9ef('0x3c')]=[{'all':!![]}];}_0x4cb488=_[_0xa9ef('0x3a')]({},_0x4cb488,_0x4f7b03[_0xa9ef('0x3b')]);return db[_0xa9ef('0x28')][_0xa9ef('0x42')](_0x4cb488)[_0xa9ef('0x23')](handleEntityNotFound(_0xb60b77,null))[_0xa9ef('0x23')](respondWithResult(_0xb60b77,null))[_0xa9ef('0x3f')](handleError(_0xb60b77,null));};exports['create']=function(_0x2d4f55,_0x465da9){return db['MailSubstatus'][_0xa9ef('0x43')](_0x2d4f55['body'],{})[_0xa9ef('0x23')](respondWithResult(_0x465da9,0xc9))[_0xa9ef('0x3f')](handleError(_0x465da9,null));};exports[_0xa9ef('0x44')]=function(_0xc3c295,_0x2d8fba){if(_0xc3c295[_0xa9ef('0x45')]['id']){delete _0xc3c295[_0xa9ef('0x45')]['id'];}return db['MailSubstatus'][_0xa9ef('0x42')]({'where':{'id':_0xc3c295[_0xa9ef('0x41')]['id']}})[_0xa9ef('0x23')](handleEntityNotFound(_0x2d8fba,null))[_0xa9ef('0x23')](saveUpdates(_0xc3c295[_0xa9ef('0x45')],null))['then'](respondWithResult(_0x2d8fba,null))[_0xa9ef('0x3f')](handleError(_0x2d8fba,null));};exports[_0xa9ef('0x46')]=function(_0x32ce4b,_0x1da68b){return db[_0xa9ef('0x28')][_0xa9ef('0x42')]({'where':{'id':_0x32ce4b['params']['id']}})[_0xa9ef('0x23')](handleEntityNotFound(_0x1da68b,null))[_0xa9ef('0x23')](removeEntity(_0x1da68b,null))[_0xa9ef('0x3f')](handleError(_0x1da68b,null));};exports['describe']=function(_0x62fff5,_0x26e710){return db[_0xa9ef('0x28')][_0xa9ef('0x47')]()['then'](respondWithResult(_0x26e710,null))[_0xa9ef('0x3f')](handleError(_0x26e710,null));}; \ No newline at end of file +var _0xfa6c=['request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','then','destroy','error','name','map','MailSubstatus','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x16950f,_0x2bfa09){var _0x3b0c66=function(_0x4c2009){while(--_0x4c2009){_0x16950f['push'](_0x16950f['shift']());}};_0x3b0c66(++_0x2bfa09);}(_0xfa6c,0x155));var _0xcfa6=function(_0x372117,_0x6a70c8){_0x372117=_0x372117-0x0;var _0x5375ca=_0xfa6c[_0x372117];return _0x5375ca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcfa6('0x0'));var rimraf=require(_0xcfa6('0x1'));var zipdir=require(_0xcfa6('0x2'));var jsonpatch=require(_0xcfa6('0x3'));var rp=require(_0xcfa6('0x4'));var moment=require('moment');var BPromise=require(_0xcfa6('0x5'));var Mustache=require('mustache');var util=require(_0xcfa6('0x6'));var path=require('path');var sox=require(_0xcfa6('0x7'));var csv=require(_0xcfa6('0x8'));var ejs=require(_0xcfa6('0x9'));var fs=require('fs');var _=require(_0xcfa6('0xa'));var squel=require(_0xcfa6('0xb'));var crypto=require(_0xcfa6('0xc'));var jsforce=require(_0xcfa6('0xd'));var deskjs=require(_0xcfa6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcfa6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcfa6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfa6('0x11'));var logger=require(_0xcfa6('0x12'))(_0xcfa6('0x13'));var utils=require(_0xcfa6('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x320be5,_0x3ba7b0){_0x3ba7b0=_0x3ba7b0||0xcc;return function(_0x1c5b04){if(_0x1c5b04){return _0x320be5[_0xcfa6('0x15')](_0x3ba7b0);}return _0x320be5['status'](_0x3ba7b0)[_0xcfa6('0x16')]();};}function respondWithResult(_0x2b6340,_0x15d1fb){_0x15d1fb=_0x15d1fb||0xc8;return function(_0x4d0871){if(_0x4d0871){return _0x2b6340[_0xcfa6('0x17')](_0x15d1fb)[_0xcfa6('0x18')](_0x4d0871);}};}function respondWithFilteredResult(_0x36d19c,_0x6384c4){return function(_0x1810b9){if(_0x1810b9){var _0x2b2a0a=_0x1810b9[_0xcfa6('0x19')],_0x1d2377=_0x6384c4[_0xcfa6('0x1a')],_0x3d12ab=_0x6384c4['offset']+_0x6384c4[_0xcfa6('0x1b')],_0xea4fc4;if(_0x3d12ab>=_0x2b2a0a){_0x3d12ab=_0x2b2a0a;_0xea4fc4=0xc8;}else{_0xea4fc4=0xce;}_0x36d19c[_0xcfa6('0x17')](_0xea4fc4);return _0x36d19c['set']('Content-Range',_0x1d2377+'-'+_0x3d12ab+'/'+_0x2b2a0a)['json'](_0x1810b9);}return null;};}function patchUpdates(_0x199609){return function(_0x110731){try{jsonpatch[_0xcfa6('0x1c')](_0x110731,_0x199609,!![]);}catch(_0x3838a3){return BPromise[_0xcfa6('0x1d')](_0x3838a3);}return _0x110731[_0xcfa6('0x1e')]();};}function saveUpdates(_0x2773f7,_0x370840){return function(_0x18a10d){if(_0x18a10d){return _0x18a10d[_0xcfa6('0x1f')](_0x2773f7)[_0xcfa6('0x20')](function(_0x1baa7c){return _0x1baa7c;});}return null;};}function removeEntity(_0x2f2a08,_0x5f1b87){return function(_0x58085c){if(_0x58085c){return _0x58085c[_0xcfa6('0x21')]()[_0xcfa6('0x20')](function(){_0x2f2a08['status'](0xcc)[_0xcfa6('0x16')]();});}};}function handleEntityNotFound(_0xdf5e81,_0x2e703d){return function(_0x2f5e88){if(!_0x2f5e88){_0xdf5e81[_0xcfa6('0x15')](0x194);}return _0x2f5e88;};}function handleError(_0x319a0d,_0x2426aa){_0x2426aa=_0x2426aa||0x1f4;return function(_0xee627f){logger[_0xcfa6('0x22')](_0xee627f['stack']);if(_0xee627f['name']){delete _0xee627f[_0xcfa6('0x23')];}_0x319a0d[_0xcfa6('0x17')](_0x2426aa)['send'](_0xee627f);};}exports['index']=function(_0x45df9f,_0x37e01d){var _0x3e6db1={},_0x299698={},_0x466610={'count':0x0,'rows':[]};var _0x24dca9=_[_0xcfa6('0x24')](db[_0xcfa6('0x25')][_0xcfa6('0x26')],function(_0x51a1f1){return{'name':_0x51a1f1[_0xcfa6('0x27')],'type':_0x51a1f1['type'][_0xcfa6('0x28')]};});_0x299698[_0xcfa6('0x29')]=_[_0xcfa6('0x24')](_0x24dca9,_0xcfa6('0x23'));_0x299698['query']=_[_0xcfa6('0x2a')](_0x45df9f[_0xcfa6('0x2b')]);_0x299698[_0xcfa6('0x2c')]=_[_0xcfa6('0x2d')](_0x299698[_0xcfa6('0x29')],_0x299698['query']);_0x3e6db1[_0xcfa6('0x2e')]=_[_0xcfa6('0x2d')](_0x299698['model'],qs[_0xcfa6('0x2f')](_0x45df9f[_0xcfa6('0x2b')]['fields']));_0x3e6db1[_0xcfa6('0x2e')]=_0x3e6db1[_0xcfa6('0x2e')]['length']?_0x3e6db1[_0xcfa6('0x2e')]:_0x299698[_0xcfa6('0x29')];if(!_0x45df9f[_0xcfa6('0x2b')][_0xcfa6('0x30')](_0xcfa6('0x31'))){_0x3e6db1[_0xcfa6('0x1b')]=qs[_0xcfa6('0x1b')](_0x45df9f[_0xcfa6('0x2b')]['limit']);_0x3e6db1[_0xcfa6('0x1a')]=qs[_0xcfa6('0x1a')](_0x45df9f[_0xcfa6('0x2b')]['offset']);}_0x3e6db1[_0xcfa6('0x32')]=qs[_0xcfa6('0x33')](_0x45df9f[_0xcfa6('0x2b')][_0xcfa6('0x33')]);_0x3e6db1[_0xcfa6('0x34')]=qs[_0xcfa6('0x2c')](_['pick'](_0x45df9f[_0xcfa6('0x2b')],_0x299698[_0xcfa6('0x2c')]),_0x24dca9);if(_0x45df9f[_0xcfa6('0x2b')][_0xcfa6('0x35')]){_0x3e6db1[_0xcfa6('0x34')]=_[_0xcfa6('0x36')](_0x3e6db1[_0xcfa6('0x34')],{'$or':_['map'](_0x24dca9,function(_0x538e0d){if(_0x538e0d[_0xcfa6('0x37')]!==_0xcfa6('0x38')){var _0x46c80d={};_0x46c80d[_0x538e0d[_0xcfa6('0x23')]]={'$like':'%'+_0x45df9f['query'][_0xcfa6('0x35')]+'%'};return _0x46c80d;}})});}_0x3e6db1=_['merge']({},_0x3e6db1,_0x45df9f[_0xcfa6('0x39')]);var _0x46c01={'where':_0x3e6db1['where']};return db[_0xcfa6('0x25')][_0xcfa6('0x19')](_0x46c01)[_0xcfa6('0x20')](function(_0x5d4ad5){_0x466610[_0xcfa6('0x19')]=_0x5d4ad5;if(_0x45df9f[_0xcfa6('0x2b')][_0xcfa6('0x3a')]){_0x3e6db1[_0xcfa6('0x3b')]=[{'all':!![]}];}return db['MailSubstatus'][_0xcfa6('0x3c')](_0x3e6db1);})[_0xcfa6('0x20')](function(_0x19b555){_0x466610[_0xcfa6('0x3d')]=_0x19b555;return _0x466610;})['then'](respondWithFilteredResult(_0x37e01d,_0x3e6db1))[_0xcfa6('0x3e')](handleError(_0x37e01d,null));};exports[_0xcfa6('0x3f')]=function(_0x426e20,_0x261fb9){var _0x255e98={'raw':!![],'where':{'id':_0x426e20[_0xcfa6('0x40')]['id']}},_0x194694={};_0x194694[_0xcfa6('0x29')]=_[_0xcfa6('0x2a')](db[_0xcfa6('0x25')][_0xcfa6('0x26')]);_0x194694[_0xcfa6('0x2b')]=_[_0xcfa6('0x2a')](_0x426e20[_0xcfa6('0x2b')]);_0x194694['filters']=_[_0xcfa6('0x2d')](_0x194694[_0xcfa6('0x29')],_0x194694[_0xcfa6('0x2b')]);_0x255e98[_0xcfa6('0x2e')]=_[_0xcfa6('0x2d')](_0x194694[_0xcfa6('0x29')],qs['fields'](_0x426e20[_0xcfa6('0x2b')]['fields']));_0x255e98[_0xcfa6('0x2e')]=_0x255e98[_0xcfa6('0x2e')][_0xcfa6('0x41')]?_0x255e98[_0xcfa6('0x2e')]:_0x194694['model'];if(_0x426e20[_0xcfa6('0x2b')]['includeAll']){_0x255e98[_0xcfa6('0x3b')]=[{'all':!![]}];}_0x255e98=_[_0xcfa6('0x36')]({},_0x255e98,_0x426e20[_0xcfa6('0x39')]);return db[_0xcfa6('0x25')][_0xcfa6('0x42')](_0x255e98)[_0xcfa6('0x20')](handleEntityNotFound(_0x261fb9,null))[_0xcfa6('0x20')](respondWithResult(_0x261fb9,null))[_0xcfa6('0x3e')](handleError(_0x261fb9,null));};exports['create']=function(_0x3ce8cf,_0x393326){return db[_0xcfa6('0x25')]['create'](_0x3ce8cf[_0xcfa6('0x43')],{})['then'](respondWithResult(_0x393326,0xc9))[_0xcfa6('0x3e')](handleError(_0x393326,null));};exports[_0xcfa6('0x1f')]=function(_0x1b2e11,_0x2d0388){if(_0x1b2e11[_0xcfa6('0x43')]['id']){delete _0x1b2e11[_0xcfa6('0x43')]['id'];}return db['MailSubstatus'][_0xcfa6('0x42')]({'where':{'id':_0x1b2e11[_0xcfa6('0x40')]['id']}})[_0xcfa6('0x20')](handleEntityNotFound(_0x2d0388,null))[_0xcfa6('0x20')](saveUpdates(_0x1b2e11[_0xcfa6('0x43')],null))['then'](respondWithResult(_0x2d0388,null))[_0xcfa6('0x3e')](handleError(_0x2d0388,null));};exports[_0xcfa6('0x21')]=function(_0x11fb40,_0x40aa0f){return db['MailSubstatus'][_0xcfa6('0x42')]({'where':{'id':_0x11fb40[_0xcfa6('0x40')]['id']}})[_0xcfa6('0x20')](handleEntityNotFound(_0x40aa0f,null))[_0xcfa6('0x20')](removeEntity(_0x40aa0f,null))[_0xcfa6('0x3e')](handleError(_0x40aa0f,null));};exports['describe']=function(_0x2d9282,_0x229e66){return db[_0xcfa6('0x25')][_0xcfa6('0x44')]()[_0xcfa6('0x20')](respondWithResult(_0x229e66,null))['catch'](handleError(_0x229e66,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 43776e4..615529a 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 _0x578c=['../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x578c,0x158));var _0xc578=function(_0x334760,_0x419ab8){_0x334760=_0x334760-0x0;var _0x1d4334=_0x578c[_0x334760];return _0x1d4334;};'use strict';var _=require(_0xc578('0x0'));var util=require(_0xc578('0x1'));var logger=require(_0xc578('0x2'))('api');var moment=require(_0xc578('0x3'));var BPromise=require(_0xc578('0x4'));var rp=require(_0xc578('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc578('0x6'));var config=require(_0xc578('0x7'));var attributes=require(_0xc578('0x8'));module[_0xc578('0x9')]=function(_0x178786,_0x3305c9){return _0x178786[_0xc578('0xa')](_0xc578('0xb'),attributes,{'tableName':_0xc578('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa24d=['request-promise','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x15ac45,_0x2ef019){var _0x3eb56f=function(_0x527e58){while(--_0x527e58){_0x15ac45['push'](_0x15ac45['shift']());}};_0x3eb56f(++_0x2ef019);}(_0xa24d,0x1c1));var _0xda24=function(_0x129534,_0x560a44){_0x129534=_0x129534-0x0;var _0x430eb4=_0xa24d[_0x129534];return _0x430eb4;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var logger=require(_0xda24('0x2'))(_0xda24('0x3'));var moment=require(_0xda24('0x4'));var BPromise=require(_0xda24('0x5'));var rp=require(_0xda24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda24('0x7'));var config=require(_0xda24('0x8'));var attributes=require(_0xda24('0x9'));module[_0xda24('0xa')]=function(_0x561d74,_0x3557cb){return _0x561d74[_0xda24('0xb')]('MailSubstatus',attributes,{'tableName':_0xda24('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 2301fb8..e22c9cd 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 _0xa9e0=['http','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\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(_0x40eea1,_0x28569a){var _0x17953c=function(_0x3a94c1){while(--_0x3a94c1){_0x40eea1['push'](_0x40eea1['shift']());}};_0x17953c(++_0x28569a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result'];(function(_0x25df55,_0x57ea51){var _0x4863e7=function(_0x3f5780){while(--_0x3f5780){_0x25df55['push'](_0x25df55['shift']());}};_0x4863e7(++_0x57ea51);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1f047e,_0x23b312){_0x1f047e=_0x1f047e-0x0;var _0x206db5=_0xf3cd[_0x1f047e];return _0x206db5;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 9ac2446..6e2ea82 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 _0x86ae=['put','update','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x86ae,0x9c));var _0xe86a=function(_0x56d879,_0x143071){_0x56d879=_0x56d879-0x0;var _0x3ac07d=_0x86ae[_0x56d879];return _0x3ac07d;};'use strict';var multer=require(_0xe86a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe86a('0x1'));var express=require('express');var router=express[_0xe86a('0x2')]();var auth=require(_0xe86a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe86a('0x4'));var controller=require(_0xe86a('0x5'));router[_0xe86a('0x6')]('/',auth[_0xe86a('0x7')](),controller[_0xe86a('0x8')]);router[_0xe86a('0x6')]('/describe',auth[_0xe86a('0x7')](),controller[_0xe86a('0x9')]);router['get'](_0xe86a('0xa'),auth[_0xe86a('0x7')](),controller[_0xe86a('0xb')]);router[_0xe86a('0xc')]('/',auth[_0xe86a('0x7')](),controller[_0xe86a('0xd')]);router[_0xe86a('0xe')](_0xe86a('0xa'),auth[_0xe86a('0x7')](),controller[_0xe86a('0xf')]);router['delete'](_0xe86a('0xa'),auth[_0xe86a('0x7')](),controller['destroy']);module[_0xe86a('0x10')]=router; \ No newline at end of file +var _0xfe2b=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','exports','util','path'];(function(_0x469852,_0x532e8c){var _0xa844b9=function(_0x511046){while(--_0x511046){_0x469852['push'](_0x469852['shift']());}};_0xa844b9(++_0x532e8c);}(_0xfe2b,0x6a));var _0xbfe2=function(_0x2bf680,_0x3baa21){_0x2bf680=_0x2bf680-0x0;var _0x4f4391=_0xfe2b[_0x2bf680];return _0x4f4391;};'use strict';var multer=require('multer');var util=require(_0xbfe2('0x0'));var path=require(_0xbfe2('0x1'));var timeout=require('connect-timeout');var express=require(_0xbfe2('0x2'));var router=express['Router']();var auth=require(_0xbfe2('0x3'));var interaction=require(_0xbfe2('0x4'));var config=require(_0xbfe2('0x5'));var controller=require('./mailTransferReport.controller');router[_0xbfe2('0x6')]('/',auth[_0xbfe2('0x7')](),controller[_0xbfe2('0x8')]);router['get'](_0xbfe2('0x9'),auth[_0xbfe2('0x7')](),controller[_0xbfe2('0xa')]);router['get']('/:id',auth[_0xbfe2('0x7')](),controller[_0xbfe2('0xb')]);router[_0xbfe2('0xc')]('/',auth['isAuthenticated'](),controller[_0xbfe2('0xd')]);router[_0xbfe2('0xe')](_0xbfe2('0xf'),auth[_0xbfe2('0x7')](),controller[_0xbfe2('0x10')]);router['delete'](_0xbfe2('0xf'),auth[_0xbfe2('0x7')](),controller['destroy']);module[_0xbfe2('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index f685298..a1288b5 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 _0xf99c=['NOW','moment','sequelize','exports','ENUM','account','queue','DATE'];(function(_0x423340,_0x4609e4){var _0x280674=function(_0x41cb67){while(--_0x41cb67){_0x423340['push'](_0x423340['shift']());}};_0x280674(++_0x4609e4);}(_0xf99c,0x79));var _0xcf99=function(_0xd8402f,_0x265fa1){_0xd8402f=_0xd8402f-0x0;var _0x114507=_0xf99c[_0xd8402f];return _0x114507;};'use strict';var moment=require(_0xcf99('0x0'));var Sequelize=require(_0xcf99('0x1'));module[_0xcf99('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcf99('0x3')](_0xcf99('0x4'),'agent',_0xcf99('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xcf99('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xcf99('0x7')]}}; \ No newline at end of file +var _0xc295=['moment','sequelize','exports','ENUM','agent','queue','NOW'];(function(_0x329c88,_0x1f774c){var _0x4b92b8=function(_0x2b5e44){while(--_0x2b5e44){_0x329c88['push'](_0x329c88['shift']());}};_0x4b92b8(++_0x1f774c);}(_0xc295,0x1a4));var _0x5c29=function(_0x37c789,_0x5007db){_0x37c789=_0x37c789-0x0;var _0x3f80d6=_0xc295[_0x37c789];return _0x3f80d6;};'use strict';var moment=require(_0x5c29('0x0'));var Sequelize=require(_0x5c29('0x1'));module[_0x5c29('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5c29('0x3')]('account',_0x5c29('0x4'),_0x5c29('0x5')),'allowNull':![],'defaultValue':_0x5c29('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5c29('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 2eaf6fd..fc276d3 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 _0x93e8=['rows','catch','show','keys','rawAttributes','include','find','create','body','update','params','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','then','destroy','end','error','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','MailTransferReport','includeAll'];(function(_0x44736b,_0x34378f){var _0x1a5a33=function(_0x199d7a){while(--_0x199d7a){_0x44736b['push'](_0x44736b['shift']());}};_0x1a5a33(++_0x34378f);}(_0x93e8,0x98));var _0x893e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x93e8[_0x342700];return _0x53406f;};'use strict';var pdf=require(_0x893e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x893e('0x1'));var jsonpatch=require(_0x893e('0x2'));var rp=require(_0x893e('0x3'));var moment=require(_0x893e('0x4'));var BPromise=require(_0x893e('0x5'));var Mustache=require(_0x893e('0x6'));var util=require(_0x893e('0x7'));var path=require(_0x893e('0x8'));var sox=require('sox');var csv=require(_0x893e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x893e('0xa'));var squel=require(_0x893e('0xb'));var crypto=require('crypto');var jsforce=require(_0x893e('0xc'));var deskjs=require(_0x893e('0xd'));var toCsv=require(_0x893e('0x9'));var querystring=require(_0x893e('0xe'));var Papa=require(_0x893e('0xf'));var Redis=require(_0x893e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x893e('0x11'));var logger=require(_0x893e('0x12'))(_0x893e('0x13'));var utils=require('../../config/utils');var config=require(_0x893e('0x14'));var db=require(_0x893e('0x15'))['db'];function respondWithStatusCode(_0x18c36e,_0x3a7adc){_0x3a7adc=_0x3a7adc||0xcc;return function(_0x56a5cc){if(_0x56a5cc){return _0x18c36e[_0x893e('0x16')](_0x3a7adc);}return _0x18c36e[_0x893e('0x17')](_0x3a7adc)['end']();};}function respondWithResult(_0x26a252,_0x335ae2){_0x335ae2=_0x335ae2||0xc8;return function(_0x16ab1a){if(_0x16ab1a){return _0x26a252[_0x893e('0x17')](_0x335ae2)[_0x893e('0x18')](_0x16ab1a);}};}function respondWithFilteredResult(_0x4d9f06,_0x14069b){return function(_0x15aaa6){if(_0x15aaa6){var _0x2fe576=_0x15aaa6[_0x893e('0x19')],_0x504812=_0x14069b['offset'],_0x53a49a=_0x14069b[_0x893e('0x1a')]+_0x14069b[_0x893e('0x1b')],_0x58bf1f;if(_0x53a49a>=_0x2fe576){_0x53a49a=_0x2fe576;_0x58bf1f=0xc8;}else{_0x58bf1f=0xce;}_0x4d9f06[_0x893e('0x17')](_0x58bf1f);return _0x4d9f06[_0x893e('0x1c')]('Content-Range',_0x504812+'-'+_0x53a49a+'/'+_0x2fe576)['json'](_0x15aaa6);}return null;};}function patchUpdates(_0x3a5eb8){return function(_0x22d94e){try{jsonpatch['apply'](_0x22d94e,_0x3a5eb8,!![]);}catch(_0x4944fb){return BPromise[_0x893e('0x1d')](_0x4944fb);}return _0x22d94e[_0x893e('0x1e')]();};}function saveUpdates(_0x4601c4,_0x570407){return function(_0x3168cf){if(_0x3168cf){return _0x3168cf['update'](_0x4601c4)[_0x893e('0x1f')](function(_0x4182b5){return _0x4182b5;});}return null;};}function removeEntity(_0x1aca94,_0x472dda){return function(_0x453427){if(_0x453427){return _0x453427[_0x893e('0x20')]()[_0x893e('0x1f')](function(){_0x1aca94[_0x893e('0x17')](0xcc)[_0x893e('0x21')]();});}};}function handleEntityNotFound(_0x1acda7,_0x3323ab){return function(_0x4141ed){if(!_0x4141ed){_0x1acda7['sendStatus'](0x194);}return _0x4141ed;};}function handleError(_0x5f1a32,_0x5bf404){_0x5bf404=_0x5bf404||0x1f4;return function(_0x41cd14){logger[_0x893e('0x22')](_0x41cd14[_0x893e('0x23')]);if(_0x41cd14[_0x893e('0x24')]){delete _0x41cd14['name'];}_0x5f1a32[_0x893e('0x17')](_0x5bf404)[_0x893e('0x25')](_0x41cd14);};}exports[_0x893e('0x26')]=function(_0x294e5d,_0x175500){var _0x269375={},_0x817a74={},_0x18e475={'count':0x0,'rows':[]};var _0x3ec625=_[_0x893e('0x27')](db['MailTransferReport']['rawAttributes'],function(_0x15d744){return{'name':_0x15d744[_0x893e('0x28')],'type':_0x15d744['type'][_0x893e('0x29')]};});_0x817a74[_0x893e('0x2a')]=_[_0x893e('0x27')](_0x3ec625,_0x893e('0x24'));_0x817a74[_0x893e('0x2b')]=_['keys'](_0x294e5d['query']);_0x817a74[_0x893e('0x2c')]=_[_0x893e('0x2d')](_0x817a74[_0x893e('0x2a')],_0x817a74[_0x893e('0x2b')]);_0x269375[_0x893e('0x2e')]=_[_0x893e('0x2d')](_0x817a74['model'],qs[_0x893e('0x2f')](_0x294e5d['query'][_0x893e('0x2f')]));_0x269375[_0x893e('0x2e')]=_0x269375[_0x893e('0x2e')][_0x893e('0x30')]?_0x269375[_0x893e('0x2e')]:_0x817a74[_0x893e('0x2a')];if(!_0x294e5d[_0x893e('0x2b')]['hasOwnProperty'](_0x893e('0x31'))){_0x269375['limit']=qs[_0x893e('0x1b')](_0x294e5d['query'][_0x893e('0x1b')]);_0x269375[_0x893e('0x1a')]=qs[_0x893e('0x1a')](_0x294e5d[_0x893e('0x2b')]['offset']);}_0x269375[_0x893e('0x32')]=qs[_0x893e('0x33')](_0x294e5d[_0x893e('0x2b')]['sort']);_0x269375[_0x893e('0x34')]=qs['filters'](_['pick'](_0x294e5d[_0x893e('0x2b')],_0x817a74[_0x893e('0x2c')]),_0x3ec625);if(_0x294e5d['query'][_0x893e('0x35')]){_0x269375[_0x893e('0x34')]=_[_0x893e('0x36')](_0x269375['where'],{'$or':_[_0x893e('0x27')](_0x3ec625,function(_0xcae039){if(_0xcae039['type']!=='VIRTUAL'){var _0x4fe7cd={};_0x4fe7cd[_0xcae039[_0x893e('0x24')]]={'$like':'%'+_0x294e5d[_0x893e('0x2b')][_0x893e('0x35')]+'%'};return _0x4fe7cd;}})});}_0x269375=_['merge']({},_0x269375,_0x294e5d[_0x893e('0x37')]);var _0x4d0ac1={'where':_0x269375[_0x893e('0x34')]};return db[_0x893e('0x38')][_0x893e('0x19')](_0x4d0ac1)[_0x893e('0x1f')](function(_0x176cc2){_0x18e475[_0x893e('0x19')]=_0x176cc2;if(_0x294e5d['query'][_0x893e('0x39')]){_0x269375['include']=[{'all':!![]}];}return db[_0x893e('0x38')]['findAll'](_0x269375);})[_0x893e('0x1f')](function(_0x2f05a5){_0x18e475[_0x893e('0x3a')]=_0x2f05a5;return _0x18e475;})['then'](respondWithFilteredResult(_0x175500,_0x269375))[_0x893e('0x3b')](handleError(_0x175500,null));};exports[_0x893e('0x3c')]=function(_0x5f31bd,_0x3ac929){var _0x4f047c={'raw':!![],'where':{'id':_0x5f31bd['params']['id']}},_0x990588={};_0x990588[_0x893e('0x2a')]=_[_0x893e('0x3d')](db[_0x893e('0x38')][_0x893e('0x3e')]);_0x990588[_0x893e('0x2b')]=_[_0x893e('0x3d')](_0x5f31bd[_0x893e('0x2b')]);_0x990588[_0x893e('0x2c')]=_[_0x893e('0x2d')](_0x990588[_0x893e('0x2a')],_0x990588['query']);_0x4f047c['attributes']=_['intersection'](_0x990588[_0x893e('0x2a')],qs[_0x893e('0x2f')](_0x5f31bd['query']['fields']));_0x4f047c[_0x893e('0x2e')]=_0x4f047c[_0x893e('0x2e')][_0x893e('0x30')]?_0x4f047c[_0x893e('0x2e')]:_0x990588[_0x893e('0x2a')];if(_0x5f31bd[_0x893e('0x2b')][_0x893e('0x39')]){_0x4f047c[_0x893e('0x3f')]=[{'all':!![]}];}_0x4f047c=_[_0x893e('0x36')]({},_0x4f047c,_0x5f31bd[_0x893e('0x37')]);return db['MailTransferReport'][_0x893e('0x40')](_0x4f047c)[_0x893e('0x1f')](handleEntityNotFound(_0x3ac929,null))['then'](respondWithResult(_0x3ac929,null))[_0x893e('0x3b')](handleError(_0x3ac929,null));};exports[_0x893e('0x41')]=function(_0xd5ac3f,_0x44e4a9){return db['MailTransferReport']['create'](_0xd5ac3f[_0x893e('0x42')],{})[_0x893e('0x1f')](respondWithResult(_0x44e4a9,0xc9))[_0x893e('0x3b')](handleError(_0x44e4a9,null));};exports[_0x893e('0x43')]=function(_0x430380,_0x26df5f){if(_0x430380['body']['id']){delete _0x430380['body']['id'];}return db[_0x893e('0x38')][_0x893e('0x40')]({'where':{'id':_0x430380[_0x893e('0x44')]['id']}})[_0x893e('0x1f')](handleEntityNotFound(_0x26df5f,null))[_0x893e('0x1f')](saveUpdates(_0x430380['body'],null))[_0x893e('0x1f')](respondWithResult(_0x26df5f,null))['catch'](handleError(_0x26df5f,null));};exports['destroy']=function(_0x578aba,_0x36cf42){return db[_0x893e('0x38')][_0x893e('0x40')]({'where':{'id':_0x578aba[_0x893e('0x44')]['id']}})['then'](handleEntityNotFound(_0x36cf42,null))[_0x893e('0x1f')](removeEntity(_0x36cf42,null))[_0x893e('0x3b')](handleError(_0x36cf42,null));};exports[_0x893e('0x45')]=function(_0x523682,_0x1f42bf){return db[_0x893e('0x38')]['describe']()[_0x893e('0x1f')](respondWithResult(_0x1f42bf,null))[_0x893e('0x3b')](handleError(_0x1f42bf,null));}; \ No newline at end of file +var _0x810f=['intersection','model','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','MailTransferReport','includeAll','include','findAll','rows','catch','show','rawAttributes','length','options','create','body','find','destroy','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','fieldName','type','key','query','keys'];(function(_0x8c279b,_0x531e66){var _0x585bb7=function(_0x1f142c){while(--_0x1f142c){_0x8c279b['push'](_0x8c279b['shift']());}};_0x585bb7(++_0x531e66);}(_0x810f,0x183));var _0xf810=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x810f[_0x494d1f];return _0x457b6e;};'use strict';var pdf=require(_0xf810('0x0'));var emlformat=require(_0xf810('0x1'));var rimraf=require(_0xf810('0x2'));var zipdir=require(_0xf810('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf810('0x4'));var moment=require(_0xf810('0x5'));var BPromise=require(_0xf810('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf810('0x7'));var csv=require(_0xf810('0x8'));var ejs=require(_0xf810('0x9'));var fs=require('fs');var _=require(_0xf810('0xa'));var squel=require(_0xf810('0xb'));var crypto=require('crypto');var jsforce=require(_0xf810('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf810('0x8'));var querystring=require('querystring');var Papa=require(_0xf810('0xd'));var Redis=require('ioredis');var authService=require(_0xf810('0xe'));var qs=require(_0xf810('0xf'));var as=require(_0xf810('0x10'));var hardwareService=require(_0xf810('0x11'));var logger=require(_0xf810('0x12'))(_0xf810('0x13'));var utils=require(_0xf810('0x14'));var config=require(_0xf810('0x15'));var db=require(_0xf810('0x16'))['db'];function respondWithStatusCode(_0x10168c,_0x574fde){_0x574fde=_0x574fde||0xcc;return function(_0x4d39da){if(_0x4d39da){return _0x10168c[_0xf810('0x17')](_0x574fde);}return _0x10168c['status'](_0x574fde)['end']();};}function respondWithResult(_0x47021b,_0x1f3274){_0x1f3274=_0x1f3274||0xc8;return function(_0x32961c){if(_0x32961c){return _0x47021b[_0xf810('0x18')](_0x1f3274)[_0xf810('0x19')](_0x32961c);}};}function respondWithFilteredResult(_0x24ab8f,_0x45ab61){return function(_0x518a83){if(_0x518a83){var _0x576253=_0x518a83[_0xf810('0x1a')],_0x52a683=_0x45ab61['offset'],_0x420d1a=_0x45ab61[_0xf810('0x1b')]+_0x45ab61[_0xf810('0x1c')],_0x57d50c;if(_0x420d1a>=_0x576253){_0x420d1a=_0x576253;_0x57d50c=0xc8;}else{_0x57d50c=0xce;}_0x24ab8f['status'](_0x57d50c);return _0x24ab8f[_0xf810('0x1d')](_0xf810('0x1e'),_0x52a683+'-'+_0x420d1a+'/'+_0x576253)[_0xf810('0x19')](_0x518a83);}return null;};}function patchUpdates(_0x5cf426){return function(_0x3fc8b8){try{jsonpatch[_0xf810('0x1f')](_0x3fc8b8,_0x5cf426,!![]);}catch(_0x50dc40){return BPromise[_0xf810('0x20')](_0x50dc40);}return _0x3fc8b8[_0xf810('0x21')]();};}function saveUpdates(_0x1aa024,_0x1e9983){return function(_0x3ebd8e){if(_0x3ebd8e){return _0x3ebd8e[_0xf810('0x22')](_0x1aa024)['then'](function(_0x5d6d5c){return _0x5d6d5c;});}return null;};}function removeEntity(_0x4a8044,_0x99136a){return function(_0x3e3d74){if(_0x3e3d74){return _0x3e3d74['destroy']()[_0xf810('0x23')](function(){_0x4a8044[_0xf810('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ffd61,_0x462be7){return function(_0x5b74cc){if(!_0x5b74cc){_0x2ffd61[_0xf810('0x17')](0x194);}return _0x5b74cc;};}function handleError(_0x5ebfff,_0x30bf1c){_0x30bf1c=_0x30bf1c||0x1f4;return function(_0x5d47d3){logger['error'](_0x5d47d3[_0xf810('0x24')]);if(_0x5d47d3['name']){delete _0x5d47d3[_0xf810('0x25')];}_0x5ebfff[_0xf810('0x18')](_0x30bf1c)['send'](_0x5d47d3);};}exports[_0xf810('0x26')]=function(_0x2cc597,_0x335113){var _0x282490={},_0x1b876b={},_0x307a8a={'count':0x0,'rows':[]};var _0x4fce20=_[_0xf810('0x27')](db['MailTransferReport']['rawAttributes'],function(_0x5b5609){return{'name':_0x5b5609[_0xf810('0x28')],'type':_0x5b5609[_0xf810('0x29')][_0xf810('0x2a')]};});_0x1b876b['model']=_['map'](_0x4fce20,'name');_0x1b876b[_0xf810('0x2b')]=_[_0xf810('0x2c')](_0x2cc597[_0xf810('0x2b')]);_0x1b876b['filters']=_[_0xf810('0x2d')](_0x1b876b[_0xf810('0x2e')],_0x1b876b[_0xf810('0x2b')]);_0x282490[_0xf810('0x2f')]=_[_0xf810('0x2d')](_0x1b876b[_0xf810('0x2e')],qs[_0xf810('0x30')](_0x2cc597[_0xf810('0x2b')][_0xf810('0x30')]));_0x282490[_0xf810('0x2f')]=_0x282490[_0xf810('0x2f')]['length']?_0x282490[_0xf810('0x2f')]:_0x1b876b[_0xf810('0x2e')];if(!_0x2cc597[_0xf810('0x2b')]['hasOwnProperty'](_0xf810('0x31'))){_0x282490['limit']=qs[_0xf810('0x1c')](_0x2cc597[_0xf810('0x2b')][_0xf810('0x1c')]);_0x282490['offset']=qs['offset'](_0x2cc597[_0xf810('0x2b')][_0xf810('0x1b')]);}_0x282490[_0xf810('0x32')]=qs[_0xf810('0x33')](_0x2cc597[_0xf810('0x2b')][_0xf810('0x33')]);_0x282490[_0xf810('0x34')]=qs[_0xf810('0x35')](_[_0xf810('0x36')](_0x2cc597[_0xf810('0x2b')],_0x1b876b[_0xf810('0x35')]),_0x4fce20);if(_0x2cc597[_0xf810('0x2b')][_0xf810('0x37')]){_0x282490['where']=_['merge'](_0x282490[_0xf810('0x34')],{'$or':_[_0xf810('0x27')](_0x4fce20,function(_0x1c6299){if(_0x1c6299[_0xf810('0x29')]!=='VIRTUAL'){var _0x4ef8a6={};_0x4ef8a6[_0x1c6299[_0xf810('0x25')]]={'$like':'%'+_0x2cc597[_0xf810('0x2b')][_0xf810('0x37')]+'%'};return _0x4ef8a6;}})});}_0x282490=_[_0xf810('0x38')]({},_0x282490,_0x2cc597['options']);var _0x471c31={'where':_0x282490[_0xf810('0x34')]};return db[_0xf810('0x39')]['count'](_0x471c31)[_0xf810('0x23')](function(_0x9be27a){_0x307a8a[_0xf810('0x1a')]=_0x9be27a;if(_0x2cc597[_0xf810('0x2b')][_0xf810('0x3a')]){_0x282490[_0xf810('0x3b')]=[{'all':!![]}];}return db[_0xf810('0x39')][_0xf810('0x3c')](_0x282490);})[_0xf810('0x23')](function(_0x1b9e16){_0x307a8a[_0xf810('0x3d')]=_0x1b9e16;return _0x307a8a;})[_0xf810('0x23')](respondWithFilteredResult(_0x335113,_0x282490))[_0xf810('0x3e')](handleError(_0x335113,null));};exports[_0xf810('0x3f')]=function(_0x56b70a,_0x40212d){var _0xbe490b={'raw':!![],'where':{'id':_0x56b70a['params']['id']}},_0x355105={};_0x355105[_0xf810('0x2e')]=_[_0xf810('0x2c')](db['MailTransferReport'][_0xf810('0x40')]);_0x355105['query']=_[_0xf810('0x2c')](_0x56b70a[_0xf810('0x2b')]);_0x355105[_0xf810('0x35')]=_['intersection'](_0x355105[_0xf810('0x2e')],_0x355105[_0xf810('0x2b')]);_0xbe490b[_0xf810('0x2f')]=_[_0xf810('0x2d')](_0x355105[_0xf810('0x2e')],qs[_0xf810('0x30')](_0x56b70a[_0xf810('0x2b')]['fields']));_0xbe490b[_0xf810('0x2f')]=_0xbe490b[_0xf810('0x2f')][_0xf810('0x41')]?_0xbe490b[_0xf810('0x2f')]:_0x355105[_0xf810('0x2e')];if(_0x56b70a[_0xf810('0x2b')][_0xf810('0x3a')]){_0xbe490b['include']=[{'all':!![]}];}_0xbe490b=_[_0xf810('0x38')]({},_0xbe490b,_0x56b70a[_0xf810('0x42')]);return db[_0xf810('0x39')]['find'](_0xbe490b)[_0xf810('0x23')](handleEntityNotFound(_0x40212d,null))[_0xf810('0x23')](respondWithResult(_0x40212d,null))['catch'](handleError(_0x40212d,null));};exports['create']=function(_0x34f97c,_0xb404a6){return db[_0xf810('0x39')][_0xf810('0x43')](_0x34f97c[_0xf810('0x44')],{})['then'](respondWithResult(_0xb404a6,0xc9))[_0xf810('0x3e')](handleError(_0xb404a6,null));};exports[_0xf810('0x22')]=function(_0x9783b0,_0x282b56){if(_0x9783b0['body']['id']){delete _0x9783b0[_0xf810('0x44')]['id'];}return db[_0xf810('0x39')][_0xf810('0x45')]({'where':{'id':_0x9783b0['params']['id']}})[_0xf810('0x23')](handleEntityNotFound(_0x282b56,null))[_0xf810('0x23')](saveUpdates(_0x9783b0[_0xf810('0x44')],null))[_0xf810('0x23')](respondWithResult(_0x282b56,null))[_0xf810('0x3e')](handleError(_0x282b56,null));};exports[_0xf810('0x46')]=function(_0x48cb30,_0xbc6f01){return db[_0xf810('0x39')][_0xf810('0x45')]({'where':{'id':_0x48cb30[_0xf810('0x47')]['id']}})[_0xf810('0x23')](handleEntityNotFound(_0xbc6f01,null))[_0xf810('0x23')](removeEntity(_0xbc6f01,null))[_0xf810('0x3e')](handleError(_0xbc6f01,null));};exports['describe']=function(_0x269284,_0x292da6){return db[_0xf810('0x39')]['describe']()['then'](respondWithResult(_0x292da6,null))[_0xf810('0x3e')](handleError(_0x292da6,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 0dfd37a..b029e29 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 _0x26f2=['api','moment','bluebird','request-promise','rimraf','../../config/environment','MailTransferReport','util','../../config/logger'];(function(_0x18679d,_0x32dedb){var _0x30afaf=function(_0x4c2994){while(--_0x4c2994){_0x18679d['push'](_0x18679d['shift']());}};_0x30afaf(++_0x32dedb);}(_0x26f2,0x19c));var _0x226f=function(_0x3277ba,_0x417d9c){_0x3277ba=_0x3277ba-0x0;var _0xd4ceb5=_0x26f2[_0x3277ba];return _0xd4ceb5;};'use strict';var _=require('lodash');var util=require(_0x226f('0x0'));var logger=require(_0x226f('0x1'))(_0x226f('0x2'));var moment=require(_0x226f('0x3'));var BPromise=require(_0x226f('0x4'));var rp=require(_0x226f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x226f('0x6'));var config=require(_0x226f('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xdbce04,_0x40cb88){return _0xdbce04['define'](_0x226f('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd37d=['./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','util','api','path','rimraf','../../config/environment'];(function(_0x59d471,_0x2b1e92){var _0x5e23b1=function(_0x55c456){while(--_0x55c456){_0x59d471['push'](_0x59d471['shift']());}};_0x5e23b1(++_0x2b1e92);}(_0xd37d,0xe1));var _0xdd37=function(_0x4e346a,_0x1ba060){_0x4e346a=_0x4e346a-0x0;var _0x12ac3a=_0xd37d[_0x4e346a];return _0x12ac3a;};'use strict';var _=require('lodash');var util=require(_0xdd37('0x0'));var logger=require('../../config/logger')(_0xdd37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd37('0x2'));var rimraf=require(_0xdd37('0x3'));var config=require(_0xdd37('0x4'));var attributes=require(_0xdd37('0x5'));module[_0xdd37('0x6')]=function(_0x1961e4,_0x93c330){return _0x1961e4[_0xdd37('0x7')]('MailTransferReport',attributes,{'tableName':_0xdd37('0x8'),'paranoid':![],'indexes':[{'name':_0xdd37('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 42c9e47..3c05884 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 _0x9b86=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','debug','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','request\x20sent','result'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9b86,0x168));var _0x69b8=function(_0x257f2e,_0x43b8ee){_0x257f2e=_0x257f2e-0x0;var _0x1b8af0=_0x9b86[_0x257f2e];return _0x1b8af0;};'use strict';var _=require(_0x69b8('0x0'));var util=require(_0x69b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x69b8('0x2'));var fs=require('fs');var Redis=require(_0x69b8('0x3'));var db=require(_0x69b8('0x4'))['db'];var utils=require(_0x69b8('0x5'));var logger=require(_0x69b8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x69b8('0x7'));var client=jayson['client'][_0x69b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b5095,_0x12505f,_0x1068df){return new BPromise(function(_0x43c346,_0x1c0c22){return client[_0x69b8('0x9')](_0x1b5095,_0x1068df)[_0x69b8('0xa')](function(_0x5bd20e){logger[_0x69b8('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x12505f,'request\x20sent');logger[_0x69b8('0xc')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x12505f,'request\x20sent',JSON[_0x69b8('0xd')](_0x5bd20e));if(_0x5bd20e[_0x69b8('0xe')]){if(_0x5bd20e[_0x69b8('0xe')][_0x69b8('0xf')]===0x1f4){logger['error'](_0x69b8('0x10'),_0x12505f,_0x5bd20e[_0x69b8('0xe')]['message']);return _0x1c0c22(_0x5bd20e[_0x69b8('0xe')][_0x69b8('0x11')]);}logger[_0x69b8('0xe')](_0x69b8('0x10'),_0x12505f,_0x5bd20e[_0x69b8('0xe')][_0x69b8('0x11')]);return _0x43c346(_0x5bd20e[_0x69b8('0xe')][_0x69b8('0x11')]);}else{logger['info'](_0x69b8('0x10'),_0x12505f,_0x69b8('0x12'));_0x43c346(_0x5bd20e[_0x69b8('0x13')]['message']);}})['catch'](function(_0x1ba2b7){logger[_0x69b8('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x12505f,_0x1ba2b7);_0x1c0c22(_0x1ba2b7);});});} \ No newline at end of file +var _0x84da=['jayson/promise','http','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2c0466,_0x1f64db){var _0x42d5eb=function(_0x4fc5e5){while(--_0x4fc5e5){_0x2c0466['push'](_0x2c0466['shift']());}};_0x42d5eb(++_0x1f64db);}(_0x84da,0x98));var _0xa84d=function(_0x2042e0,_0x5e2b6a){_0x2042e0=_0x2042e0-0x0;var _0x3fda09=_0x84da[_0x2042e0];return _0x3fda09;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa84d('0x0'));var BPromise=require(_0xa84d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa84d('0x2'));var db=require(_0xa84d('0x3'))['db'];var utils=require(_0xa84d('0x4'));var logger=require(_0xa84d('0x5'))(_0xa84d('0x6'));var config=require(_0xa84d('0x7'));var jayson=require(_0xa84d('0x8'));var client=jayson['client'][_0xa84d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14c9b1,_0x2a4cf6,_0x23209d){return new BPromise(function(_0x569972,_0x51ae87){return client[_0xa84d('0xa')](_0x14c9b1,_0x23209d)[_0xa84d('0xb')](function(_0x1ef5f8){logger['info'](_0xa84d('0xc'),_0x2a4cf6,_0xa84d('0xd'));logger['debug'](_0xa84d('0xe'),_0x2a4cf6,_0xa84d('0xd'),JSON[_0xa84d('0xf')](_0x1ef5f8));if(_0x1ef5f8['error']){if(_0x1ef5f8['error'][_0xa84d('0x10')]===0x1f4){logger['error'](_0xa84d('0xc'),_0x2a4cf6,_0x1ef5f8[_0xa84d('0x11')]['message']);return _0x51ae87(_0x1ef5f8['error'][_0xa84d('0x12')]);}logger[_0xa84d('0x11')](_0xa84d('0xc'),_0x2a4cf6,_0x1ef5f8[_0xa84d('0x11')][_0xa84d('0x12')]);return _0x569972(_0x1ef5f8[_0xa84d('0x11')]['message']);}else{logger['info'](_0xa84d('0xc'),_0x2a4cf6,_0xa84d('0xd'));_0x569972(_0x1ef5f8[_0xa84d('0x13')][_0xa84d('0x12')]);}})['catch'](function(_0x3629a3){logger[_0xa84d('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x2a4cf6,_0x3629a3);_0x51ae87(_0x3629a3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 86e56fc..77b73e9 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 _0x57e8=['Router','../../config/environment','./memberReport.controller','index','/describe','isAuthenticated','describe','get','/:id','post','put','update','destroy','multer','util','path','express'];(function(_0x4a7843,_0x24f6d1){var _0x2c57fe=function(_0x37fbc9){while(--_0x37fbc9){_0x4a7843['push'](_0x4a7843['shift']());}};_0x2c57fe(++_0x24f6d1);}(_0x57e8,0x73));var _0x857e=function(_0x2ea893,_0x51d165){_0x2ea893=_0x2ea893-0x0;var _0x21171a=_0x57e8[_0x2ea893];return _0x21171a;};'use strict';var multer=require(_0x857e('0x0'));var util=require(_0x857e('0x1'));var path=require(_0x857e('0x2'));var timeout=require('connect-timeout');var express=require(_0x857e('0x3'));var router=express[_0x857e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x857e('0x5'));var controller=require(_0x857e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x857e('0x7')]);router['get'](_0x857e('0x8'),auth[_0x857e('0x9')](),controller[_0x857e('0xa')]);router[_0x857e('0xb')](_0x857e('0xc'),auth[_0x857e('0x9')](),controller['show']);router[_0x857e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x857e('0xe')]('/:id',auth[_0x857e('0x9')](),controller[_0x857e('0xf')]);router['delete'](_0x857e('0xc'),auth[_0x857e('0x9')](),controller[_0x857e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa866=['exports','multer','util','path','express','Router','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy'];(function(_0x5cd9f0,_0x2d07cc){var _0x4e1b71=function(_0x3ebc38){while(--_0x3ebc38){_0x5cd9f0['push'](_0x5cd9f0['shift']());}};_0x4e1b71(++_0x2d07cc);}(_0xa866,0x199));var _0x6a86=function(_0x466c95,_0x237f8e){_0x466c95=_0x466c95-0x0;var _0x1fbc00=_0xa866[_0x466c95];return _0x1fbc00;};'use strict';var multer=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var path=require(_0x6a86('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a86('0x3'));var router=express[_0x6a86('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6a86('0x5'));var controller=require(_0x6a86('0x6'));router[_0x6a86('0x7')]('/',auth[_0x6a86('0x8')](),controller['index']);router[_0x6a86('0x7')](_0x6a86('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x6a86('0xa'),auth[_0x6a86('0x8')](),controller[_0x6a86('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6a86('0xc')]);router[_0x6a86('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6a86('0xe')]);router['delete'](_0x6a86('0xa'),auth['isAuthenticated'](),controller[_0x6a86('0xf')]);module[_0x6a86('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8e443c4..57a6f59 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 _0xcf7e=['exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[queue]','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcf7e,0x179));var _0xecf7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcf7e[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xecf7('0x0'));module[_0xecf7('0x1')]={'channel':{'type':Sequelize[_0xecf7('0x2')]},'membername':{'type':Sequelize[_0xecf7('0x2')]},'interface':{'type':Sequelize[_0xecf7('0x2')]},'type':{'type':Sequelize[_0xecf7('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xecf7('0x3')},'duration':{'type':Sequelize[_0xecf7('0x4')]},'enterAt':{'type':Sequelize[_0xecf7('0x5')]},'exitAt':{'type':Sequelize[_0xecf7('0x5')],'set':function(_0x568384){var _0x4f53fb=moment(_0x568384);var _0x36d867=moment(this[_0xecf7('0x6')](_0xecf7('0x7')));var _0x22ce3e=_0x4f53fb[_0xecf7('0x8')](_0x36d867,_0xecf7('0x9'));this[_0xecf7('0xa')]('exitAt',_0x568384);this['setDataValue']('duration',_0x22ce3e||null);}},'data1':{'type':Sequelize[_0xecf7('0x2')],'comment':_0xecf7('0xb')},'data2':{'type':Sequelize[_0xecf7('0x2')],'comment':_0xecf7('0xc')},'data3':{'type':Sequelize[_0xecf7('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xecf7('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xecf7('0x2')],'comment':_0xecf7('0xd')},'role':{'type':Sequelize[_0xecf7('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xecf7('0x2')]}}; \ No newline at end of file +var _0xac31=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xac31,0x15a));var _0x1ac3=function(_0x4111d4,_0x53cef9){_0x4111d4=_0x4111d4-0x0;var _0x2c2efb=_0xac31[_0x4111d4];return _0x2c2efb;};'use strict';var Sequelize=require(_0x1ac3('0x0'));var moment=require('moment');module[_0x1ac3('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1ac3('0x2')]},'type':{'type':Sequelize[_0x1ac3('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x1ac3('0x3')},'duration':{'type':Sequelize[_0x1ac3('0x4')]},'enterAt':{'type':Sequelize[_0x1ac3('0x5')]},'exitAt':{'type':Sequelize[_0x1ac3('0x5')],'set':function(_0x2aca55){var _0x2e4e4b=moment(_0x2aca55);var _0x45ff1f=moment(this[_0x1ac3('0x6')]('enterAt'));var _0x55e3a2=_0x2e4e4b[_0x1ac3('0x7')](_0x45ff1f,_0x1ac3('0x8'));this[_0x1ac3('0x9')](_0x1ac3('0xa'),_0x2aca55);this['setDataValue'](_0x1ac3('0xb'),_0x55e3a2||null);}},'data1':{'type':Sequelize[_0x1ac3('0x2')],'comment':_0x1ac3('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x1ac3('0xd')},'data3':{'type':Sequelize[_0x1ac3('0x2')],'comment':_0x1ac3('0xe')},'data4':{'type':Sequelize[_0x1ac3('0x2')],'comment':_0x1ac3('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x1ac3('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x1ac3('0x4')]},'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 52483d5..426dc4f 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 _0x5782=['MemberReport','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','then','destroy','end','error','name','send','index','map'];(function(_0x2473d4,_0x48fb83){var _0x400e05=function(_0x409d14){while(--_0x409d14){_0x2473d4['push'](_0x2473d4['shift']());}};_0x400e05(++_0x48fb83);}(_0x5782,0x104));var _0x2578=function(_0x5a596f,_0x776d83){_0x5a596f=_0x5a596f-0x0;var _0x23a0e9=_0x5782[_0x5a596f];return _0x23a0e9;};'use strict';var pdf=require(_0x2578('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2578('0x1'));var jsonpatch=require(_0x2578('0x2'));var rp=require('request-promise');var moment=require(_0x2578('0x3'));var BPromise=require(_0x2578('0x4'));var Mustache=require(_0x2578('0x5'));var util=require('util');var path=require(_0x2578('0x6'));var sox=require(_0x2578('0x7'));var csv=require(_0x2578('0x8'));var ejs=require(_0x2578('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2578('0xa'));var crypto=require(_0x2578('0xb'));var jsforce=require(_0x2578('0xc'));var deskjs=require(_0x2578('0xd'));var toCsv=require(_0x2578('0x8'));var querystring=require('querystring');var Papa=require(_0x2578('0xe'));var Redis=require(_0x2578('0xf'));var authService=require(_0x2578('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2578('0x11'));var hardwareService=require(_0x2578('0x12'));var logger=require(_0x2578('0x13'))(_0x2578('0x14'));var utils=require(_0x2578('0x15'));var config=require('../../config/environment');var db=require(_0x2578('0x16'))['db'];function respondWithStatusCode(_0x59131d,_0x1c5da9){_0x1c5da9=_0x1c5da9||0xcc;return function(_0x1934f6){if(_0x1934f6){return _0x59131d[_0x2578('0x17')](_0x1c5da9);}return _0x59131d['status'](_0x1c5da9)['end']();};}function respondWithResult(_0x1cc945,_0x43064a){_0x43064a=_0x43064a||0xc8;return function(_0x252775){if(_0x252775){return _0x1cc945[_0x2578('0x18')](_0x43064a)[_0x2578('0x19')](_0x252775);}};}function respondWithFilteredResult(_0x1701df,_0x3a7892){return function(_0x300114){if(_0x300114){var _0x34eefa=_0x300114['count'],_0x414b88=_0x3a7892[_0x2578('0x1a')],_0x5d388f=_0x3a7892[_0x2578('0x1a')]+_0x3a7892['limit'],_0x4a59ca;if(_0x5d388f>=_0x34eefa){_0x5d388f=_0x34eefa;_0x4a59ca=0xc8;}else{_0x4a59ca=0xce;}_0x1701df['status'](_0x4a59ca);return _0x1701df[_0x2578('0x1b')]('Content-Range',_0x414b88+'-'+_0x5d388f+'/'+_0x34eefa)[_0x2578('0x19')](_0x300114);}return null;};}function patchUpdates(_0x166dcf){return function(_0x354374){try{jsonpatch[_0x2578('0x1c')](_0x354374,_0x166dcf,!![]);}catch(_0x3225b6){return BPromise[_0x2578('0x1d')](_0x3225b6);}return _0x354374[_0x2578('0x1e')]();};}function saveUpdates(_0x170cb3,_0x52bd0f){return function(_0x527738){if(_0x527738){return _0x527738[_0x2578('0x1f')](_0x170cb3)[_0x2578('0x20')](function(_0x513b56){return _0x513b56;});}return null;};}function removeEntity(_0x463346,_0x844fd1){return function(_0x2d48ce){if(_0x2d48ce){return _0x2d48ce[_0x2578('0x21')]()[_0x2578('0x20')](function(){_0x463346[_0x2578('0x18')](0xcc)[_0x2578('0x22')]();});}};}function handleEntityNotFound(_0x54da8c,_0x157d82){return function(_0x1f275d){if(!_0x1f275d){_0x54da8c[_0x2578('0x17')](0x194);}return _0x1f275d;};}function handleError(_0x5a2d72,_0xb3b91){_0xb3b91=_0xb3b91||0x1f4;return function(_0x2a4fa4){logger[_0x2578('0x23')](_0x2a4fa4['stack']);if(_0x2a4fa4['name']){delete _0x2a4fa4[_0x2578('0x24')];}_0x5a2d72[_0x2578('0x18')](_0xb3b91)[_0x2578('0x25')](_0x2a4fa4);};}exports[_0x2578('0x26')]=function(_0x22fb56,_0x386ffc){var _0x3c67c0={},_0x84c49a={},_0x3ff8cf={'count':0x0,'rows':[]};var _0x2da673=_[_0x2578('0x27')](db[_0x2578('0x28')]['rawAttributes'],function(_0x10830b){return{'name':_0x10830b[_0x2578('0x29')],'type':_0x10830b[_0x2578('0x2a')][_0x2578('0x2b')]};});_0x84c49a[_0x2578('0x2c')]=_[_0x2578('0x27')](_0x2da673,_0x2578('0x24'));_0x84c49a[_0x2578('0x2d')]=_[_0x2578('0x2e')](_0x22fb56[_0x2578('0x2d')]);_0x84c49a[_0x2578('0x2f')]=_['intersection'](_0x84c49a[_0x2578('0x2c')],_0x84c49a[_0x2578('0x2d')]);_0x3c67c0['attributes']=_['intersection'](_0x84c49a[_0x2578('0x2c')],qs['fields'](_0x22fb56[_0x2578('0x2d')][_0x2578('0x30')]));_0x3c67c0[_0x2578('0x31')]=_0x3c67c0[_0x2578('0x31')][_0x2578('0x32')]?_0x3c67c0['attributes']:_0x84c49a[_0x2578('0x2c')];if(!_0x22fb56[_0x2578('0x2d')][_0x2578('0x33')](_0x2578('0x34'))){_0x3c67c0[_0x2578('0x35')]=qs['limit'](_0x22fb56[_0x2578('0x2d')][_0x2578('0x35')]);_0x3c67c0[_0x2578('0x1a')]=qs[_0x2578('0x1a')](_0x22fb56[_0x2578('0x2d')][_0x2578('0x1a')]);}_0x3c67c0[_0x2578('0x36')]=qs[_0x2578('0x37')](_0x22fb56[_0x2578('0x2d')][_0x2578('0x37')]);_0x3c67c0['where']=qs[_0x2578('0x2f')](_[_0x2578('0x38')](_0x22fb56['query'],_0x84c49a[_0x2578('0x2f')]),_0x2da673);if(_0x22fb56[_0x2578('0x2d')][_0x2578('0x39')]){_0x3c67c0[_0x2578('0x3a')]=_[_0x2578('0x3b')](_0x3c67c0[_0x2578('0x3a')],{'$or':_[_0x2578('0x27')](_0x2da673,function(_0x552fb9){if(_0x552fb9[_0x2578('0x2a')]!==_0x2578('0x3c')){var _0x10c493={};_0x10c493[_0x552fb9[_0x2578('0x24')]]={'$like':'%'+_0x22fb56[_0x2578('0x2d')][_0x2578('0x39')]+'%'};return _0x10c493;}})});}_0x3c67c0=_[_0x2578('0x3b')]({},_0x3c67c0,_0x22fb56[_0x2578('0x3d')]);var _0x457dac={'where':_0x3c67c0[_0x2578('0x3a')]};return db['MemberReport'][_0x2578('0x3e')](_0x457dac)['then'](function(_0x58fcd0){_0x3ff8cf[_0x2578('0x3e')]=_0x58fcd0;if(_0x22fb56[_0x2578('0x2d')][_0x2578('0x3f')]){_0x3c67c0[_0x2578('0x40')]=[{'all':!![]}];}return db[_0x2578('0x28')][_0x2578('0x41')](_0x3c67c0);})['then'](function(_0x39da3a){_0x3ff8cf[_0x2578('0x42')]=_0x39da3a;return _0x3ff8cf;})['then'](respondWithFilteredResult(_0x386ffc,_0x3c67c0))[_0x2578('0x43')](handleError(_0x386ffc,null));};exports[_0x2578('0x44')]=function(_0x5a0ebc,_0x78a0f){var _0x4fcc12={'raw':!![],'where':{'id':_0x5a0ebc[_0x2578('0x45')]['id']}},_0x4ec84a={};_0x4ec84a['model']=_['keys'](db['MemberReport']['rawAttributes']);_0x4ec84a[_0x2578('0x2d')]=_[_0x2578('0x2e')](_0x5a0ebc[_0x2578('0x2d')]);_0x4ec84a['filters']=_[_0x2578('0x46')](_0x4ec84a[_0x2578('0x2c')],_0x4ec84a['query']);_0x4fcc12['attributes']=_[_0x2578('0x46')](_0x4ec84a[_0x2578('0x2c')],qs[_0x2578('0x30')](_0x5a0ebc['query']['fields']));_0x4fcc12[_0x2578('0x31')]=_0x4fcc12[_0x2578('0x31')][_0x2578('0x32')]?_0x4fcc12[_0x2578('0x31')]:_0x4ec84a[_0x2578('0x2c')];if(_0x5a0ebc[_0x2578('0x2d')][_0x2578('0x3f')]){_0x4fcc12[_0x2578('0x40')]=[{'all':!![]}];}_0x4fcc12=_[_0x2578('0x3b')]({},_0x4fcc12,_0x5a0ebc[_0x2578('0x3d')]);return db['MemberReport'][_0x2578('0x47')](_0x4fcc12)[_0x2578('0x20')](handleEntityNotFound(_0x78a0f,null))[_0x2578('0x20')](respondWithResult(_0x78a0f,null))[_0x2578('0x43')](handleError(_0x78a0f,null));};exports[_0x2578('0x48')]=function(_0x1abd01,_0x515f24){return db[_0x2578('0x28')]['create'](_0x1abd01['body'],{})[_0x2578('0x20')](respondWithResult(_0x515f24,0xc9))[_0x2578('0x43')](handleError(_0x515f24,null));};exports['update']=function(_0x472905,_0xc98513){if(_0x472905[_0x2578('0x49')]['id']){delete _0x472905['body']['id'];}return db[_0x2578('0x28')][_0x2578('0x47')]({'where':{'id':_0x472905['params']['id']}})[_0x2578('0x20')](handleEntityNotFound(_0xc98513,null))['then'](saveUpdates(_0x472905['body'],null))[_0x2578('0x20')](respondWithResult(_0xc98513,null))[_0x2578('0x43')](handleError(_0xc98513,null));};exports[_0x2578('0x21')]=function(_0x339bc8,_0x4eea47){return db[_0x2578('0x28')]['find']({'where':{'id':_0x339bc8[_0x2578('0x45')]['id']}})[_0x2578('0x20')](handleEntityNotFound(_0x4eea47,null))[_0x2578('0x20')](removeEntity(_0x4eea47,null))[_0x2578('0x43')](handleError(_0x4eea47,null));};exports[_0x2578('0x4a')]=function(_0x496c5a,_0xcd477f){return db['MemberReport'][_0x2578('0x4a')]()[_0x2578('0x20')](respondWithResult(_0xcd477f,null))[_0x2578('0x43')](handleError(_0xcd477f,null));}; \ No newline at end of file +var _0x631b=['catch','params','intersection','length','includeAll','find','body','html-pdf','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','then','error','stack','name','send','map','MemberReport','rawAttributes','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows'];(function(_0x47c882,_0x8a92aa){var _0x205ede=function(_0x2bf8ae){while(--_0x2bf8ae){_0x47c882['push'](_0x47c882['shift']());}};_0x205ede(++_0x8a92aa);}(_0x631b,0x8d));var _0xb631=function(_0x16d411,_0x5e0970){_0x16d411=_0x16d411-0x0;var _0x20336d=_0x631b[_0x16d411];return _0x20336d;};'use strict';var pdf=require(_0xb631('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb631('0x1'));var zipdir=require(_0xb631('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb631('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb631('0x4'));var path=require(_0xb631('0x5'));var sox=require(_0xb631('0x6'));var csv=require(_0xb631('0x7'));var ejs=require(_0xb631('0x8'));var fs=require('fs');var _=require(_0xb631('0x9'));var squel=require(_0xb631('0xa'));var crypto=require(_0xb631('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb631('0x7'));var querystring=require(_0xb631('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb631('0xd'));var qs=require(_0xb631('0xe'));var as=require(_0xb631('0xf'));var hardwareService=require(_0xb631('0x10'));var logger=require(_0xb631('0x11'))(_0xb631('0x12'));var utils=require(_0xb631('0x13'));var config=require('../../config/environment');var db=require(_0xb631('0x14'))['db'];function respondWithStatusCode(_0x355cd2,_0x58b1c2){_0x58b1c2=_0x58b1c2||0xcc;return function(_0x239d15){if(_0x239d15){return _0x355cd2[_0xb631('0x15')](_0x58b1c2);}return _0x355cd2[_0xb631('0x16')](_0x58b1c2)[_0xb631('0x17')]();};}function respondWithResult(_0x1bab06,_0x17529f){_0x17529f=_0x17529f||0xc8;return function(_0x22c5e4){if(_0x22c5e4){return _0x1bab06['status'](_0x17529f)['json'](_0x22c5e4);}};}function respondWithFilteredResult(_0x742cc2,_0x458143){return function(_0x514805){if(_0x514805){var _0x4b9038=_0x514805[_0xb631('0x18')],_0x26ed39=_0x458143['offset'],_0x3412d4=_0x458143[_0xb631('0x19')]+_0x458143[_0xb631('0x1a')],_0x213410;if(_0x3412d4>=_0x4b9038){_0x3412d4=_0x4b9038;_0x213410=0xc8;}else{_0x213410=0xce;}_0x742cc2[_0xb631('0x16')](_0x213410);return _0x742cc2[_0xb631('0x1b')](_0xb631('0x1c'),_0x26ed39+'-'+_0x3412d4+'/'+_0x4b9038)[_0xb631('0x1d')](_0x514805);}return null;};}function patchUpdates(_0x42c2ab){return function(_0x192675){try{jsonpatch['apply'](_0x192675,_0x42c2ab,!![]);}catch(_0x4a63d5){return BPromise[_0xb631('0x1e')](_0x4a63d5);}return _0x192675['save']();};}function saveUpdates(_0x257b2d,_0x47861d){return function(_0x4f80ca){if(_0x4f80ca){return _0x4f80ca[_0xb631('0x1f')](_0x257b2d)['then'](function(_0x1b21b2){return _0x1b21b2;});}return null;};}function removeEntity(_0x1d2a8a,_0x179ee5){return function(_0x3035fe){if(_0x3035fe){return _0x3035fe[_0xb631('0x20')]()[_0xb631('0x21')](function(){_0x1d2a8a['status'](0xcc)[_0xb631('0x17')]();});}};}function handleEntityNotFound(_0x5f54e0,_0x2885e9){return function(_0x5377ff){if(!_0x5377ff){_0x5f54e0['sendStatus'](0x194);}return _0x5377ff;};}function handleError(_0x7cae4,_0x1b75c2){_0x1b75c2=_0x1b75c2||0x1f4;return function(_0x3c07f8){logger[_0xb631('0x22')](_0x3c07f8[_0xb631('0x23')]);if(_0x3c07f8[_0xb631('0x24')]){delete _0x3c07f8[_0xb631('0x24')];}_0x7cae4[_0xb631('0x16')](_0x1b75c2)[_0xb631('0x25')](_0x3c07f8);};}exports['index']=function(_0x1f73e4,_0x3bc637){var _0x217bc4={},_0x4be0d0={},_0x6852e0={'count':0x0,'rows':[]};var _0x4ef9aa=_[_0xb631('0x26')](db[_0xb631('0x27')][_0xb631('0x28')],function(_0x32f528){return{'name':_0x32f528['fieldName'],'type':_0x32f528[_0xb631('0x29')][_0xb631('0x2a')]};});_0x4be0d0[_0xb631('0x2b')]=_[_0xb631('0x26')](_0x4ef9aa,_0xb631('0x24'));_0x4be0d0[_0xb631('0x2c')]=_[_0xb631('0x2d')](_0x1f73e4[_0xb631('0x2c')]);_0x4be0d0[_0xb631('0x2e')]=_['intersection'](_0x4be0d0[_0xb631('0x2b')],_0x4be0d0[_0xb631('0x2c')]);_0x217bc4['attributes']=_['intersection'](_0x4be0d0['model'],qs[_0xb631('0x2f')](_0x1f73e4['query']['fields']));_0x217bc4[_0xb631('0x30')]=_0x217bc4[_0xb631('0x30')]['length']?_0x217bc4[_0xb631('0x30')]:_0x4be0d0[_0xb631('0x2b')];if(!_0x1f73e4[_0xb631('0x2c')][_0xb631('0x31')]('nolimit')){_0x217bc4[_0xb631('0x1a')]=qs[_0xb631('0x1a')](_0x1f73e4[_0xb631('0x2c')]['limit']);_0x217bc4[_0xb631('0x19')]=qs[_0xb631('0x19')](_0x1f73e4[_0xb631('0x2c')]['offset']);}_0x217bc4[_0xb631('0x32')]=qs[_0xb631('0x33')](_0x1f73e4[_0xb631('0x2c')][_0xb631('0x33')]);_0x217bc4[_0xb631('0x34')]=qs['filters'](_[_0xb631('0x35')](_0x1f73e4[_0xb631('0x2c')],_0x4be0d0[_0xb631('0x2e')]),_0x4ef9aa);if(_0x1f73e4[_0xb631('0x2c')][_0xb631('0x36')]){_0x217bc4[_0xb631('0x34')]=_[_0xb631('0x37')](_0x217bc4[_0xb631('0x34')],{'$or':_[_0xb631('0x26')](_0x4ef9aa,function(_0x91ee33){if(_0x91ee33[_0xb631('0x29')]!=='VIRTUAL'){var _0x261fb6={};_0x261fb6[_0x91ee33['name']]={'$like':'%'+_0x1f73e4['query']['filter']+'%'};return _0x261fb6;}})});}_0x217bc4=_[_0xb631('0x37')]({},_0x217bc4,_0x1f73e4[_0xb631('0x38')]);var _0x219128={'where':_0x217bc4['where']};return db[_0xb631('0x27')][_0xb631('0x18')](_0x219128)[_0xb631('0x21')](function(_0x45aee0){_0x6852e0['count']=_0x45aee0;if(_0x1f73e4['query']['includeAll']){_0x217bc4[_0xb631('0x39')]=[{'all':!![]}];}return db[_0xb631('0x27')][_0xb631('0x3a')](_0x217bc4);})[_0xb631('0x21')](function(_0xa077e6){_0x6852e0[_0xb631('0x3b')]=_0xa077e6;return _0x6852e0;})[_0xb631('0x21')](respondWithFilteredResult(_0x3bc637,_0x217bc4))[_0xb631('0x3c')](handleError(_0x3bc637,null));};exports['show']=function(_0x16c78c,_0x19be07){var _0x193b6d={'raw':!![],'where':{'id':_0x16c78c[_0xb631('0x3d')]['id']}},_0x2faa66={};_0x2faa66[_0xb631('0x2b')]=_[_0xb631('0x2d')](db[_0xb631('0x27')]['rawAttributes']);_0x2faa66['query']=_[_0xb631('0x2d')](_0x16c78c[_0xb631('0x2c')]);_0x2faa66['filters']=_[_0xb631('0x3e')](_0x2faa66[_0xb631('0x2b')],_0x2faa66[_0xb631('0x2c')]);_0x193b6d['attributes']=_['intersection'](_0x2faa66['model'],qs[_0xb631('0x2f')](_0x16c78c[_0xb631('0x2c')][_0xb631('0x2f')]));_0x193b6d['attributes']=_0x193b6d[_0xb631('0x30')][_0xb631('0x3f')]?_0x193b6d[_0xb631('0x30')]:_0x2faa66[_0xb631('0x2b')];if(_0x16c78c[_0xb631('0x2c')][_0xb631('0x40')]){_0x193b6d['include']=[{'all':!![]}];}_0x193b6d=_[_0xb631('0x37')]({},_0x193b6d,_0x16c78c[_0xb631('0x38')]);return db[_0xb631('0x27')][_0xb631('0x41')](_0x193b6d)[_0xb631('0x21')](handleEntityNotFound(_0x19be07,null))[_0xb631('0x21')](respondWithResult(_0x19be07,null))['catch'](handleError(_0x19be07,null));};exports['create']=function(_0x3d82ee,_0x428f9c){return db[_0xb631('0x27')]['create'](_0x3d82ee['body'],{})[_0xb631('0x21')](respondWithResult(_0x428f9c,0xc9))[_0xb631('0x3c')](handleError(_0x428f9c,null));};exports[_0xb631('0x1f')]=function(_0x291042,_0x410f96){if(_0x291042[_0xb631('0x42')]['id']){delete _0x291042[_0xb631('0x42')]['id'];}return db[_0xb631('0x27')][_0xb631('0x41')]({'where':{'id':_0x291042['params']['id']}})['then'](handleEntityNotFound(_0x410f96,null))[_0xb631('0x21')](saveUpdates(_0x291042[_0xb631('0x42')],null))[_0xb631('0x21')](respondWithResult(_0x410f96,null))[_0xb631('0x3c')](handleError(_0x410f96,null));};exports[_0xb631('0x20')]=function(_0x6d433c,_0x19d9d5){return db[_0xb631('0x27')][_0xb631('0x41')]({'where':{'id':_0x6d433c['params']['id']}})[_0xb631('0x21')](handleEntityNotFound(_0x19d9d5,null))[_0xb631('0x21')](removeEntity(_0x19d9d5,null))[_0xb631('0x3c')](handleError(_0x19d9d5,null));};exports['describe']=function(_0x30c7bf,_0x437814){return db['MemberReport']['describe']()[_0xb631('0x21')](respondWithResult(_0x437814,null))[_0xb631('0x3c')](handleError(_0x437814,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6d2829a..6f513aa 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 _0xecbc=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash'];(function(_0x42b45e,_0x4c81f3){var _0x4a5de=function(_0x2ef81c){while(--_0x2ef81c){_0x42b45e['push'](_0x42b45e['shift']());}};_0x4a5de(++_0x4c81f3);}(_0xecbc,0x19f));var _0xcecb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xecbc[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xcecb('0x0'));var util=require(_0xcecb('0x1'));var logger=require(_0xcecb('0x2'))(_0xcecb('0x3'));var moment=require(_0xcecb('0x4'));var BPromise=require(_0xcecb('0x5'));var rp=require(_0xcecb('0x6'));var fs=require('fs');var path=require(_0xcecb('0x7'));var rimraf=require('rimraf');var config=require(_0xcecb('0x8'));var attributes=require(_0xcecb('0x9'));module[_0xcecb('0xa')]=function(_0x5dfd1f,_0x283967){return _0x5dfd1f[_0xcecb('0xb')]('MemberReport',attributes,{'tableName':_0xcecb('0xc'),'paranoid':![],'indexes':[{'name':_0xcecb('0xd'),'fields':[_0xcecb('0xe'),_0xcecb('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57dd=['exports','define','MemberReport','membername','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x525b7a,_0x12724a){var _0xc8534e=function(_0x1a4854){while(--_0x1a4854){_0x525b7a['push'](_0x525b7a['shift']());}};_0xc8534e(++_0x12724a);}(_0x57dd,0xad));var _0xd57d=function(_0x5dadce,_0x43fef9){_0x5dadce=_0x5dadce-0x0;var _0x9f2975=_0x57dd[_0x5dadce];return _0x9f2975;};'use strict';var _=require(_0xd57d('0x0'));var util=require(_0xd57d('0x1'));var logger=require(_0xd57d('0x2'))(_0xd57d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd57d('0x4'));var fs=require('fs');var path=require(_0xd57d('0x5'));var rimraf=require(_0xd57d('0x6'));var config=require(_0xd57d('0x7'));var attributes=require(_0xd57d('0x8'));module[_0xd57d('0x9')]=function(_0x5e589a,_0x240649){return _0x5e589a[_0xd57d('0xa')](_0xd57d('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xd57d('0xc'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 98c31b2..47f57e6 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 _0xf5e9=['attributes','limit','include','model','map','stringify','create','body','CreateMemberReport','UpdateMemberReport','update','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0x313532,_0x33e75f){var _0x44bc16=function(_0x31ab32){while(--_0x31ab32){_0x313532['push'](_0x313532['shift']());}};_0x44bc16(++_0x33e75f);}(_0xf5e9,0x1b9));var _0x9f5e=function(_0x408762,_0x1e2f39){_0x408762=_0x408762-0x0;var _0x5e9e3e=_0xf5e9[_0x408762];return _0x5e9e3e;};'use strict';var _=require(_0x9f5e('0x0'));var util=require(_0x9f5e('0x1'));var moment=require(_0x9f5e('0x2'));var BPromise=require(_0x9f5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f5e('0x4'));var db=require(_0x9f5e('0x5'))['db'];var utils=require(_0x9f5e('0x6'));var logger=require(_0x9f5e('0x7'))(_0x9f5e('0x8'));var config=require(_0x9f5e('0x9'));var jayson=require(_0x9f5e('0xa'));var client=jayson['client'][_0x9f5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369088,_0x286a3f,_0x390d17){return new BPromise(function(_0x1cfabd,_0x3f5115){return client[_0x9f5e('0xc')](_0x369088,_0x390d17)[_0x9f5e('0xd')](function(_0x264b5d){logger[_0x9f5e('0xe')](_0x9f5e('0xf'),_0x286a3f,_0x9f5e('0x10'));logger[_0x9f5e('0x11')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x286a3f,_0x9f5e('0x10'),JSON['stringify'](_0x264b5d));if(_0x264b5d[_0x9f5e('0x12')]){if(_0x264b5d[_0x9f5e('0x12')]['code']===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x286a3f,_0x264b5d[_0x9f5e('0x12')][_0x9f5e('0x13')]);return _0x3f5115(_0x264b5d['error']['message']);}logger['error'](_0x9f5e('0xf'),_0x286a3f,_0x264b5d['error'][_0x9f5e('0x13')]);return _0x1cfabd(_0x264b5d['error']['message']);}else{logger[_0x9f5e('0xe')](_0x9f5e('0xf'),_0x286a3f,_0x9f5e('0x10'));_0x1cfabd(_0x264b5d[_0x9f5e('0x14')][_0x9f5e('0x13')]);}})[_0x9f5e('0x15')](function(_0x4b1657){logger[_0x9f5e('0x12')](_0x9f5e('0xf'),_0x286a3f,_0x4b1657);_0x3f5115(_0x4b1657);});});}exports[_0x9f5e('0x16')]=function(_0x418a95){var _0x25e485=this;return new Promise(function(_0x112f7f,_0x4db835){return db[_0x9f5e('0x17')][_0x9f5e('0x18')]({'raw':_0x418a95[_0x9f5e('0x19')]?_0x418a95[_0x9f5e('0x19')][_0x9f5e('0x1a')]===undefined?!![]:![]:!![],'where':_0x418a95[_0x9f5e('0x19')]?_0x418a95[_0x9f5e('0x19')]['where']||null:null,'attributes':_0x418a95['options']?_0x418a95[_0x9f5e('0x19')][_0x9f5e('0x1b')]||null:null,'limit':_0x418a95[_0x9f5e('0x19')]?_0x418a95[_0x9f5e('0x19')][_0x9f5e('0x1c')]||null:null,'include':_0x418a95[_0x9f5e('0x19')]?_0x418a95[_0x9f5e('0x19')][_0x9f5e('0x1d')]?_['map'](_0x418a95[_0x9f5e('0x19')]['include'],function(_0x35b587){return{'model':db[_0x35b587[_0x9f5e('0x1e')]],'as':_0x35b587['as'],'attributes':_0x35b587[_0x9f5e('0x1b')],'include':_0x35b587['include']?_['map'](_0x35b587[_0x9f5e('0x1d')],function(_0x31d9a0){return{'model':db[_0x31d9a0[_0x9f5e('0x1e')]],'as':_0x31d9a0['as'],'attributes':_0x31d9a0['attributes'],'include':_0x31d9a0['include']?_[_0x9f5e('0x1f')](_0x31d9a0['include'],function(_0x5daabd){return{'model':db[_0x5daabd['model']],'as':_0x5daabd['as'],'attributes':_0x5daabd[_0x9f5e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9f5e('0xd')](function(_0x37a3f6){logger[_0x9f5e('0xe')](_0x9f5e('0x16'),_0x418a95);logger[_0x9f5e('0x11')](_0x9f5e('0x16'),_0x418a95,JSON[_0x9f5e('0x20')](_0x37a3f6));_0x112f7f(_0x37a3f6);})[_0x9f5e('0x15')](function(_0x1832b1){logger[_0x9f5e('0x12')](_0x9f5e('0x16'),_0x1832b1[_0x9f5e('0x13')],_0x418a95);_0x4db835(_0x25e485[_0x9f5e('0x12')](0x1f4,_0x1832b1[_0x9f5e('0x13')]));});});};exports['CreateMemberReport']=function(_0x258f7c){var _0x509685=this;return new Promise(function(_0x15686a,_0x263989){return db[_0x9f5e('0x17')][_0x9f5e('0x21')](_0x258f7c[_0x9f5e('0x22')],{'raw':_0x258f7c[_0x9f5e('0x19')]?_0x258f7c['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57c236){logger[_0x9f5e('0xe')](_0x9f5e('0x23'),_0x258f7c);logger['debug']('CreateMemberReport',_0x258f7c,JSON[_0x9f5e('0x20')](_0x57c236));_0x15686a(_0x57c236);})['catch'](function(_0x32cd10){logger[_0x9f5e('0x12')]('CreateMemberReport',_0x32cd10[_0x9f5e('0x13')],_0x258f7c);_0x263989(_0x509685[_0x9f5e('0x12')](0x1f4,_0x32cd10[_0x9f5e('0x13')]));});});};exports[_0x9f5e('0x24')]=function(_0x411ad4){var _0x5c0647=this;return new Promise(function(_0x5994a4,_0x357929){return db[_0x9f5e('0x17')][_0x9f5e('0x25')](_0x411ad4['body'],{'raw':_0x411ad4[_0x9f5e('0x19')]?_0x411ad4[_0x9f5e('0x19')][_0x9f5e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x411ad4[_0x9f5e('0x19')]?_0x411ad4[_0x9f5e('0x19')][_0x9f5e('0x26')]||null:null,'attributes':_0x411ad4[_0x9f5e('0x19')]?_0x411ad4[_0x9f5e('0x19')][_0x9f5e('0x1b')]||null:null,'limit':_0x411ad4[_0x9f5e('0x19')]?_0x411ad4[_0x9f5e('0x19')][_0x9f5e('0x1c')]||null:null})[_0x9f5e('0xd')](function(_0x3bd16a){logger['info'](_0x9f5e('0x24'),_0x411ad4);logger[_0x9f5e('0x11')](_0x9f5e('0x24'),_0x411ad4,JSON[_0x9f5e('0x20')](_0x3bd16a));_0x5994a4(_0x3bd16a);})[_0x9f5e('0x15')](function(_0x30b700){logger[_0x9f5e('0x12')]('UpdateMemberReport',_0x30b700[_0x9f5e('0x13')],_0x411ad4);_0x357929(_0x5c0647['error'](0x1f4,_0x30b700[_0x9f5e('0x13')]));});});}; \ No newline at end of file +var _0xfcf2=['where','attributes','limit','include','map','GetMemberReport','CreateMemberReport','body','raw','then','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','MemberReport','findAll','options'];(function(_0x3a89a6,_0x5b1278){var _0x4fc5d4=function(_0x2f1dcf){while(--_0x2f1dcf){_0x3a89a6['push'](_0x3a89a6['shift']());}};_0x4fc5d4(++_0x5b1278);}(_0xfcf2,0x1ae));var _0x2fcf=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xfcf2[_0x25e7cb];return _0x375d92;};'use strict';var _=require('lodash');var util=require(_0x2fcf('0x0'));var moment=require(_0x2fcf('0x1'));var BPromise=require(_0x2fcf('0x2'));var rs=require(_0x2fcf('0x3'));var fs=require('fs');var Redis=require(_0x2fcf('0x4'));var db=require(_0x2fcf('0x5'))['db'];var utils=require(_0x2fcf('0x6'));var logger=require(_0x2fcf('0x7'))(_0x2fcf('0x8'));var config=require(_0x2fcf('0x9'));var jayson=require(_0x2fcf('0xa'));var client=jayson['client'][_0x2fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e13d6,_0x3fb9d0,_0x2a475d){return new BPromise(function(_0x2321a6,_0x482a6c){return client[_0x2fcf('0xc')](_0x5e13d6,_0x2a475d)['then'](function(_0x2050b1){logger[_0x2fcf('0xd')](_0x2fcf('0xe'),_0x3fb9d0,'request\x20sent');logger[_0x2fcf('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x3fb9d0,_0x2fcf('0x10'),JSON[_0x2fcf('0x11')](_0x2050b1));if(_0x2050b1[_0x2fcf('0x12')]){if(_0x2050b1[_0x2fcf('0x12')][_0x2fcf('0x13')]===0x1f4){logger[_0x2fcf('0x12')](_0x2fcf('0xe'),_0x3fb9d0,_0x2050b1[_0x2fcf('0x12')]['message']);return _0x482a6c(_0x2050b1[_0x2fcf('0x12')][_0x2fcf('0x14')]);}logger[_0x2fcf('0x12')]('MemberReport,\x20%s,\x20%s',_0x3fb9d0,_0x2050b1[_0x2fcf('0x12')][_0x2fcf('0x14')]);return _0x2321a6(_0x2050b1[_0x2fcf('0x12')][_0x2fcf('0x14')]);}else{logger[_0x2fcf('0xd')]('MemberReport,\x20%s,\x20%s',_0x3fb9d0,_0x2fcf('0x10'));_0x2321a6(_0x2050b1[_0x2fcf('0x15')]['message']);}})[_0x2fcf('0x16')](function(_0x26ce17){logger[_0x2fcf('0x12')](_0x2fcf('0xe'),_0x3fb9d0,_0x26ce17);_0x482a6c(_0x26ce17);});});}exports['GetMemberReport']=function(_0x1d8dcf){var _0x449035=this;return new Promise(function(_0x5047c9,_0x475995){return db[_0x2fcf('0x17')][_0x2fcf('0x18')]({'raw':_0x1d8dcf['options']?_0x1d8dcf[_0x2fcf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d8dcf['options']?_0x1d8dcf[_0x2fcf('0x19')][_0x2fcf('0x1a')]||null:null,'attributes':_0x1d8dcf[_0x2fcf('0x19')]?_0x1d8dcf[_0x2fcf('0x19')][_0x2fcf('0x1b')]||null:null,'limit':_0x1d8dcf[_0x2fcf('0x19')]?_0x1d8dcf['options'][_0x2fcf('0x1c')]||null:null,'include':_0x1d8dcf[_0x2fcf('0x19')]?_0x1d8dcf[_0x2fcf('0x19')][_0x2fcf('0x1d')]?_[_0x2fcf('0x1e')](_0x1d8dcf[_0x2fcf('0x19')]['include'],function(_0x17cf70){return{'model':db[_0x17cf70['model']],'as':_0x17cf70['as'],'attributes':_0x17cf70[_0x2fcf('0x1b')],'include':_0x17cf70[_0x2fcf('0x1d')]?_['map'](_0x17cf70[_0x2fcf('0x1d')],function(_0x1f404c){return{'model':db[_0x1f404c['model']],'as':_0x1f404c['as'],'attributes':_0x1f404c[_0x2fcf('0x1b')],'include':_0x1f404c[_0x2fcf('0x1d')]?_[_0x2fcf('0x1e')](_0x1f404c[_0x2fcf('0x1d')],function(_0x3e1b61){return{'model':db[_0x3e1b61['model']],'as':_0x3e1b61['as'],'attributes':_0x3e1b61[_0x2fcf('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3077f7){logger[_0x2fcf('0xd')](_0x2fcf('0x1f'),_0x1d8dcf);logger['debug'](_0x2fcf('0x1f'),_0x1d8dcf,JSON[_0x2fcf('0x11')](_0x3077f7));_0x5047c9(_0x3077f7);})['catch'](function(_0x4fbaee){logger[_0x2fcf('0x12')]('GetMemberReport',_0x4fbaee[_0x2fcf('0x14')],_0x1d8dcf);_0x475995(_0x449035[_0x2fcf('0x12')](0x1f4,_0x4fbaee[_0x2fcf('0x14')]));});});};exports[_0x2fcf('0x20')]=function(_0x310ec8){var _0x5ed5be=this;return new Promise(function(_0x1e0da3,_0x11b339){return db[_0x2fcf('0x17')]['create'](_0x310ec8[_0x2fcf('0x21')],{'raw':_0x310ec8[_0x2fcf('0x19')]?_0x310ec8[_0x2fcf('0x19')][_0x2fcf('0x22')]===undefined?!![]:![]:!![]})[_0x2fcf('0x23')](function(_0x198582){logger[_0x2fcf('0xd')](_0x2fcf('0x20'),_0x310ec8);logger[_0x2fcf('0xf')](_0x2fcf('0x20'),_0x310ec8,JSON[_0x2fcf('0x11')](_0x198582));_0x1e0da3(_0x198582);})[_0x2fcf('0x16')](function(_0x3a8994){logger['error']('CreateMemberReport',_0x3a8994[_0x2fcf('0x14')],_0x310ec8);_0x11b339(_0x5ed5be[_0x2fcf('0x12')](0x1f4,_0x3a8994[_0x2fcf('0x14')]));});});};exports[_0x2fcf('0x24')]=function(_0x53eb50){var _0x903605=this;return new Promise(function(_0x1b67c9,_0x38ee2b){return db[_0x2fcf('0x17')][_0x2fcf('0x25')](_0x53eb50[_0x2fcf('0x21')],{'raw':_0x53eb50[_0x2fcf('0x19')]?_0x53eb50[_0x2fcf('0x19')][_0x2fcf('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53eb50['options']?_0x53eb50[_0x2fcf('0x19')][_0x2fcf('0x1a')]||null:null,'attributes':_0x53eb50[_0x2fcf('0x19')]?_0x53eb50[_0x2fcf('0x19')][_0x2fcf('0x1b')]||null:null,'limit':_0x53eb50['options']?_0x53eb50[_0x2fcf('0x19')][_0x2fcf('0x1c')]||null:null})[_0x2fcf('0x23')](function(_0x16a328){logger[_0x2fcf('0xd')]('UpdateMemberReport',_0x53eb50);logger[_0x2fcf('0xf')]('UpdateMemberReport',_0x53eb50,JSON[_0x2fcf('0x11')](_0x16a328));_0x1b67c9(_0x16a328);})[_0x2fcf('0x16')](function(_0x6094e9){logger[_0x2fcf('0x12')](_0x2fcf('0x24'),_0x6094e9[_0x2fcf('0x14')],_0x53eb50);_0x38ee2b(_0x903605['error'](0x1f4,_0x6094e9[_0x2fcf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 00f4c99..f41a624 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 _0xea28=['Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','multer','util','path','connect-timeout','express'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xea28,0x13a));var _0x8ea2=function(_0xf501fc,_0x41dc95){_0xf501fc=_0xf501fc-0x0;var _0x2800a4=_0xea28[_0xf501fc];return _0x2800a4;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var auth=require(_0x8ea2('0x6'));var interaction=require(_0x8ea2('0x7'));var config=require('../../config/environment');var controller=require(_0x8ea2('0x8'));router[_0x8ea2('0x9')]('/',controller[_0x8ea2('0xa')]);module['exports']=router; \ No newline at end of file +var _0x84a0=['./migration.controller','get','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x84a0,0x66));var _0x084a=function(_0xf13d92,_0x61142c){_0xf13d92=_0xf13d92-0x0;var _0x56ef0f=_0x84a0[_0xf13d92];return _0x56ef0f;};'use strict';var multer=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var path=require(_0x084a('0x2'));var timeout=require(_0x084a('0x3'));var express=require('express');var router=express[_0x084a('0x4')]();var auth=require(_0x084a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x084a('0x6'));router[_0x084a('0x7')]('/',controller['index']);module[_0x084a('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 07bedf8..a2e9995 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 _0xf4b6=['version','sequelize'];(function(_0x87fdeb,_0x3f8d78){var _0x500d47=function(_0x5cd693){while(--_0x5cd693){_0x87fdeb['push'](_0x87fdeb['shift']());}};_0x500d47(++_0x3f8d78);}(_0xf4b6,0x10f));var _0x6f4b=function(_0x238dda,_0x2bf349){_0x238dda=_0x238dda-0x0;var _0x2a5d9a=_0xf4b6[_0x238dda];return _0x2a5d9a;};'use strict';var Sequelize=require(_0x6f4b('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x6f4b('0x1')}}; \ No newline at end of file +var _0x4c2b=['version','sequelize','exports','STRING'];(function(_0x5eb39f,_0x3e5f0d){var _0x420182=function(_0x41f6af){while(--_0x41f6af){_0x5eb39f['push'](_0x5eb39f['shift']());}};_0x420182(++_0x3e5f0d);}(_0x4c2b,0xed));var _0xb4c2=function(_0x5ecda3,_0x958008){_0x5ecda3=_0x5ecda3-0x0;var _0x11506b=_0x4c2b[_0x5ecda3];return _0x11506b;};'use strict';var Sequelize=require(_0xb4c2('0x0'));module[_0xb4c2('0x1')]={'version':{'type':Sequelize[_0xb4c2('0x2')],'unique':_0xb4c2('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d879da6..9c8eb35 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 _0x9bde=['index','map','Migration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','includeAll','include','findAll','rows','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x4b851c,_0x469e01){var _0x1de3be=function(_0x6c0e35){while(--_0x6c0e35){_0x4b851c['push'](_0x4b851c['shift']());}};_0x1de3be(++_0x469e01);}(_0x9bde,0xe1));var _0xe9bd=function(_0x47401e,_0x1f9124){_0x47401e=_0x47401e-0x0;var _0x2062e8=_0x9bde[_0x47401e];return _0x2062e8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(!_0x5bc4bf){_0x36f8c0[_0xe9bd('0x27')](0x194);}return _0x5bc4bf;};}function handleError(_0x1e3cbb,_0x2c9a57){_0x2c9a57=_0x2c9a57||0x1f4;return function(_0x39b206){logger[_0xe9bd('0x28')](_0x39b206[_0xe9bd('0x29')]);if(_0x39b206[_0xe9bd('0x2a')]){delete _0x39b206[_0xe9bd('0x2a')];}_0x1e3cbb[_0xe9bd('0x19')](_0x2c9a57)['send'](_0x39b206);};}exports[_0xe9bd('0x2b')]=function(_0x38fdfa,_0x5ba1d6){var _0x3b13b7={},_0xc25248={},_0x119672={'count':0x0,'rows':[]};var _0x429055=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')]['rawAttributes'],function(_0x5b7f1d){return{'name':_0x5b7f1d[_0xe9bd('0x2e')],'type':_0x5b7f1d['type'][_0xe9bd('0x2f')]};});_0xc25248[_0xe9bd('0x30')]=_[_0xe9bd('0x2c')](_0x429055,_0xe9bd('0x2a'));_0xc25248[_0xe9bd('0x31')]=_['keys'](_0x38fdfa['query']);_0xc25248[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],_0xc25248[_0xe9bd('0x31')]);_0x3b13b7[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],qs[_0xe9bd('0x35')](_0x38fdfa[_0xe9bd('0x31')]['fields']));_0x3b13b7[_0xe9bd('0x34')]=_0x3b13b7[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x3b13b7['attributes']:_0xc25248['model'];if(!_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x3b13b7[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1e')]);_0x3b13b7[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1d')]);}_0x3b13b7[_0xe9bd('0x39')]=qs[_0xe9bd('0x3a')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3a')]);_0x3b13b7[_0xe9bd('0x3b')]=qs[_0xe9bd('0x32')](_[_0xe9bd('0x3c')](_0x38fdfa['query'],_0xc25248[_0xe9bd('0x32')]),_0x429055);if(_0x38fdfa[_0xe9bd('0x31')]['filter']){_0x3b13b7[_0xe9bd('0x3b')]=_[_0xe9bd('0x3d')](_0x3b13b7['where'],{'$or':_['map'](_0x429055,function(_0x2785e6){if(_0x2785e6[_0xe9bd('0x3e')]!=='VIRTUAL'){var _0x2d1289={};_0x2d1289[_0x2785e6[_0xe9bd('0x2a')]]={'$like':'%'+_0x38fdfa[_0xe9bd('0x31')]['filter']+'%'};return _0x2d1289;}})});}_0x3b13b7=_[_0xe9bd('0x3d')]({},_0x3b13b7,_0x38fdfa['options']);var _0x3c8f7e={'where':_0x3b13b7[_0xe9bd('0x3b')]};return db[_0xe9bd('0x2d')][_0xe9bd('0x1c')](_0x3c8f7e)['then'](function(_0x41f2d4){_0x119672[_0xe9bd('0x1c')]=_0x41f2d4;if(_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3f')]){_0x3b13b7[_0xe9bd('0x40')]=[{'all':!![]}];}return db[_0xe9bd('0x2d')][_0xe9bd('0x41')](_0x3b13b7);})[_0xe9bd('0x25')](function(_0x2b5a71){_0x119672[_0xe9bd('0x42')]=_0x2b5a71;return _0x119672;})['then'](respondWithFilteredResult(_0x5ba1d6,_0x3b13b7))['catch'](handleError(_0x5ba1d6,null));}; \ No newline at end of file +var _0x9bde=['index','map','Migration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','includeAll','include','findAll','rows','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x262dbc,_0x4ef94f){var _0x5e3e22=function(_0x4f9772){while(--_0x4f9772){_0x262dbc['push'](_0x262dbc['shift']());}};_0x5e3e22(++_0x4ef94f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x59ec6c,_0x1bb0cb){_0x59ec6c=_0x59ec6c-0x0;var _0x413986=_0x9bde[_0x59ec6c];return _0x413986;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(!_0x5bc4bf){_0x36f8c0[_0xe9bd('0x27')](0x194);}return _0x5bc4bf;};}function handleError(_0x1e3cbb,_0x2c9a57){_0x2c9a57=_0x2c9a57||0x1f4;return function(_0x39b206){logger[_0xe9bd('0x28')](_0x39b206[_0xe9bd('0x29')]);if(_0x39b206[_0xe9bd('0x2a')]){delete _0x39b206[_0xe9bd('0x2a')];}_0x1e3cbb[_0xe9bd('0x19')](_0x2c9a57)['send'](_0x39b206);};}exports[_0xe9bd('0x2b')]=function(_0x38fdfa,_0x5ba1d6){var _0x3b13b7={},_0xc25248={},_0x119672={'count':0x0,'rows':[]};var _0x429055=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')]['rawAttributes'],function(_0x5b7f1d){return{'name':_0x5b7f1d[_0xe9bd('0x2e')],'type':_0x5b7f1d['type'][_0xe9bd('0x2f')]};});_0xc25248[_0xe9bd('0x30')]=_[_0xe9bd('0x2c')](_0x429055,_0xe9bd('0x2a'));_0xc25248[_0xe9bd('0x31')]=_['keys'](_0x38fdfa['query']);_0xc25248[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],_0xc25248[_0xe9bd('0x31')]);_0x3b13b7[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0xc25248[_0xe9bd('0x30')],qs[_0xe9bd('0x35')](_0x38fdfa[_0xe9bd('0x31')]['fields']));_0x3b13b7[_0xe9bd('0x34')]=_0x3b13b7[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x3b13b7['attributes']:_0xc25248['model'];if(!_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x3b13b7[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1e')]);_0x3b13b7[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x1d')]);}_0x3b13b7[_0xe9bd('0x39')]=qs[_0xe9bd('0x3a')](_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3a')]);_0x3b13b7[_0xe9bd('0x3b')]=qs[_0xe9bd('0x32')](_[_0xe9bd('0x3c')](_0x38fdfa['query'],_0xc25248[_0xe9bd('0x32')]),_0x429055);if(_0x38fdfa[_0xe9bd('0x31')]['filter']){_0x3b13b7[_0xe9bd('0x3b')]=_[_0xe9bd('0x3d')](_0x3b13b7['where'],{'$or':_['map'](_0x429055,function(_0x2785e6){if(_0x2785e6[_0xe9bd('0x3e')]!=='VIRTUAL'){var _0x2d1289={};_0x2d1289[_0x2785e6[_0xe9bd('0x2a')]]={'$like':'%'+_0x38fdfa[_0xe9bd('0x31')]['filter']+'%'};return _0x2d1289;}})});}_0x3b13b7=_[_0xe9bd('0x3d')]({},_0x3b13b7,_0x38fdfa['options']);var _0x3c8f7e={'where':_0x3b13b7[_0xe9bd('0x3b')]};return db[_0xe9bd('0x2d')][_0xe9bd('0x1c')](_0x3c8f7e)['then'](function(_0x41f2d4){_0x119672[_0xe9bd('0x1c')]=_0x41f2d4;if(_0x38fdfa[_0xe9bd('0x31')][_0xe9bd('0x3f')]){_0x3b13b7[_0xe9bd('0x40')]=[{'all':!![]}];}return db[_0xe9bd('0x2d')][_0xe9bd('0x41')](_0x3b13b7);})[_0xe9bd('0x25')](function(_0x2b5a71){_0x119672[_0xe9bd('0x42')]=_0x2b5a71;return _0x119672;})['then'](respondWithFilteredResult(_0x5ba1d6,_0x3b13b7))['catch'](handleError(_0x5ba1d6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3396a2f..a804491 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 _0xb0c8=['bluebird','path','../../config/environment','./migration.attributes','Migration','lodash','util','../../config/logger','api','moment'];(function(_0x315926,_0x14e1da){var _0x16c1b4=function(_0x3ee2eb){while(--_0x3ee2eb){_0x315926['push'](_0x315926['shift']());}};_0x16c1b4(++_0x14e1da);}(_0xb0c8,0xcd));var _0x8b0c=function(_0x57bfe4,_0x7bf22b){_0x57bfe4=_0x57bfe4-0x0;var _0xdfe3a3=_0xb0c8[_0x57bfe4];return _0xdfe3a3;};'use strict';var _=require(_0x8b0c('0x0'));var util=require(_0x8b0c('0x1'));var logger=require(_0x8b0c('0x2'))(_0x8b0c('0x3'));var moment=require(_0x8b0c('0x4'));var BPromise=require(_0x8b0c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b0c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b0c('0x7'));var attributes=require(_0x8b0c('0x8'));module['exports']=function(_0x302579,_0x4b7278){return _0x302579['define'](_0x8b0c('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6853=['request-promise','path','rimraf','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','api','bluebird'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x6853,0x16f));var _0x3685=function(_0x2868a5,_0x51b7e1){_0x2868a5=_0x2868a5-0x0;var _0x33737d=_0x6853[_0x2868a5];return _0x33737d;};'use strict';var _=require(_0x3685('0x0'));var util=require(_0x3685('0x1'));var logger=require(_0x3685('0x2'))(_0x3685('0x3'));var moment=require('moment');var BPromise=require(_0x3685('0x4'));var rp=require(_0x3685('0x5'));var fs=require('fs');var path=require(_0x3685('0x6'));var rimraf=require(_0x3685('0x7'));var config=require('../../config/environment');var attributes=require(_0x3685('0x8'));module[_0x3685('0x9')]=function(_0x5bd230,_0x76b943){return _0x5bd230[_0x3685('0xa')]('Migration',attributes,{'tableName':_0x3685('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 76e3342..1c363f4 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 _0x3ecc=['info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x6f9dbb,_0x31fbb9){var _0x5708a3=function(_0x42aad6){while(--_0x42aad6){_0x6f9dbb['push'](_0x6f9dbb['shift']());}};_0x5708a3(++_0x31fbb9);}(_0x3ecc,0x12f));var _0xc3ec=function(_0x29f9fc,_0xe19878){_0x29f9fc=_0x29f9fc-0x0;var _0x53df10=_0x3ecc[_0x29f9fc];return _0x53df10;};'use strict';var _=require('lodash');var util=require(_0xc3ec('0x0'));var moment=require(_0xc3ec('0x1'));var BPromise=require('bluebird');var rs=require(_0xc3ec('0x2'));var fs=require('fs');var Redis=require(_0xc3ec('0x3'));var db=require(_0xc3ec('0x4'))['db'];var utils=require(_0xc3ec('0x5'));var logger=require(_0xc3ec('0x6'))(_0xc3ec('0x7'));var config=require(_0xc3ec('0x8'));var jayson=require(_0xc3ec('0x9'));var client=jayson['client'][_0xc3ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eb205,_0x223a1b,_0x33815d){return new BPromise(function(_0x2e5f7c,_0x41f29f){return client['request'](_0x2eb205,_0x33815d)[_0xc3ec('0xb')](function(_0xe5a6e){logger['info'](_0xc3ec('0xc'),_0x223a1b,'request\x20sent');logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x223a1b,_0xc3ec('0xd'),JSON[_0xc3ec('0xe')](_0xe5a6e));if(_0xe5a6e[_0xc3ec('0xf')]){if(_0xe5a6e[_0xc3ec('0xf')]['code']===0x1f4){logger[_0xc3ec('0xf')](_0xc3ec('0xc'),_0x223a1b,_0xe5a6e[_0xc3ec('0xf')]['message']);return _0x41f29f(_0xe5a6e[_0xc3ec('0xf')]['message']);}logger[_0xc3ec('0xf')](_0xc3ec('0xc'),_0x223a1b,_0xe5a6e[_0xc3ec('0xf')][_0xc3ec('0x10')]);return _0x2e5f7c(_0xe5a6e[_0xc3ec('0xf')][_0xc3ec('0x10')]);}else{logger[_0xc3ec('0x11')](_0xc3ec('0xc'),_0x223a1b,_0xc3ec('0xd'));_0x2e5f7c(_0xe5a6e[_0xc3ec('0x12')][_0xc3ec('0x10')]);}})[_0xc3ec('0x13')](function(_0x3dff86){logger[_0xc3ec('0xf')](_0xc3ec('0xc'),_0x223a1b,_0x3dff86);_0x41f29f(_0x3dff86);});});} \ No newline at end of file +var _0xdaa8=['client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../config/environment','jayson/promise'];(function(_0x348547,_0x32a2fb){var _0xceed34=function(_0x283d89){while(--_0x283d89){_0x348547['push'](_0x348547['shift']());}};_0xceed34(++_0x32a2fb);}(_0xdaa8,0xe4));var _0x8daa=function(_0x2ef980,_0x2bcd62){_0x2ef980=_0x2ef980-0x0;var _0x46cd44=_0xdaa8[_0x2ef980];return _0x46cd44;};'use strict';var _=require(_0x8daa('0x0'));var util=require(_0x8daa('0x1'));var moment=require(_0x8daa('0x2'));var BPromise=require(_0x8daa('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('../../config/logger')('rpc');var config=require(_0x8daa('0x4'));var jayson=require(_0x8daa('0x5'));var client=jayson[_0x8daa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e8116,_0x1f5a97,_0x48bf41){return new BPromise(function(_0x41de3e,_0x2df1a0){return client[_0x8daa('0x7')](_0x4e8116,_0x48bf41)[_0x8daa('0x8')](function(_0x207291){logger['info'](_0x8daa('0x9'),_0x1f5a97,_0x8daa('0xa'));logger[_0x8daa('0xb')](_0x8daa('0xc'),_0x1f5a97,_0x8daa('0xa'),JSON[_0x8daa('0xd')](_0x207291));if(_0x207291[_0x8daa('0xe')]){if(_0x207291[_0x8daa('0xe')][_0x8daa('0xf')]===0x1f4){logger[_0x8daa('0xe')](_0x8daa('0x9'),_0x1f5a97,_0x207291['error'][_0x8daa('0x10')]);return _0x2df1a0(_0x207291[_0x8daa('0xe')][_0x8daa('0x10')]);}logger['error'](_0x8daa('0x9'),_0x1f5a97,_0x207291['error'][_0x8daa('0x10')]);return _0x41de3e(_0x207291[_0x8daa('0xe')][_0x8daa('0x10')]);}else{logger['info'](_0x8daa('0x9'),_0x1f5a97,_0x8daa('0xa'));_0x41de3e(_0x207291['result']['message']);}})[_0x8daa('0x11')](function(_0x2fc822){logger[_0x8daa('0xe')](_0x8daa('0x9'),_0x1f5a97,_0x2fc822);_0x2df1a0(_0x2fc822);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index bd6846c..3e4985d 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 _0x5ee2=['isAuthenticated','index','get','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2851a1,_0x179142){var _0x36e78c=function(_0x5f25a8){while(--_0x5f25a8){_0x2851a1['push'](_0x2851a1['shift']());}};_0x36e78c(++_0x179142);}(_0x5ee2,0x1b3));var _0x25ee=function(_0x476cd,_0xc69a19){_0x476cd=_0x476cd-0x0;var _0x3c5bd9=_0x5ee2[_0x476cd];return _0x3c5bd9;};'use strict';var multer=require('multer');var util=require(_0x25ee('0x0'));var path=require(_0x25ee('0x1'));var timeout=require(_0x25ee('0x2'));var express=require(_0x25ee('0x3'));var router=express[_0x25ee('0x4')]();var auth=require(_0x25ee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x25ee('0x6'));var controller=require('./network.controller');router['get']('/',auth[_0x25ee('0x7')](),controller[_0x25ee('0x8')]);router[_0x25ee('0x9')](_0x25ee('0xa'),auth[_0x25ee('0x7')](),controller[_0x25ee('0xb')]);router['post']('/',auth[_0x25ee('0x7')](),controller[_0x25ee('0xc')]);router[_0x25ee('0xd')](_0x25ee('0xa'),auth[_0x25ee('0x7')](),controller['update']);router[_0x25ee('0xe')](_0x25ee('0xa'),auth['isAuthenticated'](),controller[_0x25ee('0xf')]);module[_0x25ee('0x10')]=router; \ No newline at end of file +var _0xc1bd=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x464624,_0x1f0808){var _0x1f0cf3=function(_0x598d28){while(--_0x598d28){_0x464624['push'](_0x464624['shift']());}};_0x1f0cf3(++_0x1f0808);}(_0xc1bd,0x1d0));var _0xdc1b=function(_0x417182,_0x353daf){_0x417182=_0x417182-0x0;var _0x2045f9=_0xc1bd[_0x417182];return _0x2045f9;};'use strict';var multer=require(_0xdc1b('0x0'));var util=require(_0xdc1b('0x1'));var path=require(_0xdc1b('0x2'));var timeout=require(_0xdc1b('0x3'));var express=require(_0xdc1b('0x4'));var router=express[_0xdc1b('0x5')]();var auth=require(_0xdc1b('0x6'));var interaction=require(_0xdc1b('0x7'));var config=require(_0xdc1b('0x8'));var controller=require(_0xdc1b('0x9'));router[_0xdc1b('0xa')]('/',auth['isAuthenticated'](),controller[_0xdc1b('0xb')]);router['get'](_0xdc1b('0xc'),auth['isAuthenticated'](),controller[_0xdc1b('0xd')]);router[_0xdc1b('0xe')]('/',auth[_0xdc1b('0xf')](),controller[_0xdc1b('0x10')]);router[_0xdc1b('0x11')](_0xdc1b('0xc'),auth['isAuthenticated'](),controller[_0xdc1b('0x12')]);router[_0xdc1b('0x13')]('/:id',auth[_0xdc1b('0xf')](),controller[_0xdc1b('0x14')]);module[_0xdc1b('0x15')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index cec819a..7681a1a 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(_0x577c8d,_0x242979){var _0x38494f=function(_0x36ac16){while(--_0x36ac16){_0x577c8d['push'](_0x577c8d['shift']());}};_0x38494f(++_0x242979);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x363f8e,_0x1c49f4){var _0x4e20b7=function(_0xf39a77){while(--_0xf39a77){_0x363f8e['push'](_0x363f8e['shift']());}};_0x4e20b7(++_0x1c49f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 28a498e..0df10f5 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 _0x33d0=['info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','Network','includeAll','findAll','rows','show','params','include','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','root','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','Reload','TURN','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','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~!@#$%^&-_=+[{]}.'];(function(_0xb2c2b4,_0x4800b2){var _0x362374=function(_0x72ccae){while(--_0x72ccae){_0xb2c2b4['push'](_0xb2c2b4['shift']());}};_0x362374(++_0x4800b2);}(_0x33d0,0x12d));var _0x033d=function(_0x3e7cf6,_0x37798d){_0x3e7cf6=_0x3e7cf6-0x0;var _0xbecd5e=_0x33d0[_0x3e7cf6];return _0xbecd5e;};'use strict';var pdf=require(_0x033d('0x0'));var emlformat=require(_0x033d('0x1'));var rimraf=require(_0x033d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x033d('0x3'));var rp=require(_0x033d('0x4'));var moment=require('moment');var BPromise=require(_0x033d('0x5'));var Mustache=require(_0x033d('0x6'));var util=require('util');var path=require(_0x033d('0x7'));var sox=require(_0x033d('0x8'));var csv=require(_0x033d('0x9'));var ejs=require(_0x033d('0xa'));var fs=require('fs');var _=require(_0x033d('0xb'));var squel=require(_0x033d('0xc'));var crypto=require(_0x033d('0xd'));var jsforce=require(_0x033d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x033d('0x9'));var querystring=require(_0x033d('0xf'));var Papa=require(_0x033d('0x10'));var Redis=require(_0x033d('0x11'));var authService=require(_0x033d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x033d('0x13'));var hardwareService=require(_0x033d('0x14'));var logger=require(_0x033d('0x15'))(_0x033d('0x16'));var utils=require(_0x033d('0x17'));var config=require(_0x033d('0x18'));var db=require(_0x033d('0x19'))['db'];var jayson=require(_0x033d('0x1a'));var client=jayson['client'][_0x033d('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x4f3424,_0x5d464d,_0x5a9028){if(_0x5a9028){var _0x3e98e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e98e2[_0x033d('0x1c')](_0x5d464d)){return _0x4f3424;}else{throw new db[(_0x033d('0x1d'))][(_0x033d('0x1e'))](_0x033d('0x1f'));}}else{return _0x4f3424;}}function respondWithRpcPromise(_0x44923d,_0x20fb53,_0x3e0975,_0xa549dc){return new BPromise(function(_0x15fe0c,_0x375188){var _0x143047=_0xa549dc||client;return _0x143047['request'](_0x44923d,_0x3e0975)['then'](function(_0x580117){logger[_0x033d('0x20')](_0x033d('0x21'),_0x20fb53,_0x033d('0x22'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x20fb53,'request\x20sent',JSON[_0x033d('0x23')](_0x580117));if(_0x580117['error']){if(_0x580117[_0x033d('0x24')]['code']===0x1f4){logger['error'](_0x033d('0x21'),_0x20fb53,_0x580117[_0x033d('0x24')][_0x033d('0x25')]);return _0x375188(_0x580117[_0x033d('0x24')][_0x033d('0x25')]);}logger[_0x033d('0x24')](_0x033d('0x21'),_0x20fb53,_0x580117[_0x033d('0x24')][_0x033d('0x25')]);return _0x15fe0c(_0x580117[_0x033d('0x24')][_0x033d('0x25')]);}else{logger['info'](_0x033d('0x21'),_0x20fb53,'request\x20sent');_0x15fe0c(_0x580117[_0x033d('0x26')][_0x033d('0x25')]);}})[_0x033d('0x27')](function(_0x1edb56){logger[_0x033d('0x24')](_0x033d('0x21'),_0x20fb53,_0x1edb56);_0x375188(_0x1edb56);});});}function respondWithStatusCode(_0xc5951a,_0x3110c7){_0x3110c7=_0x3110c7||0xcc;return function(_0x2ce66b){if(_0x2ce66b){return _0xc5951a[_0x033d('0x28')](_0x3110c7);}return _0xc5951a['status'](_0x3110c7)[_0x033d('0x29')]();};}function respondWithResult(_0x1222dc,_0x274e13){_0x274e13=_0x274e13||0xc8;return function(_0x3b0594){if(_0x3b0594){return _0x1222dc[_0x033d('0x2a')](_0x274e13)[_0x033d('0x2b')](_0x3b0594);}};}function respondWithFilteredResult(_0x2a8d49,_0x3bc4cc){return function(_0x121bc9){if(_0x121bc9){var _0x20e8df=_0x121bc9[_0x033d('0x2c')],_0x507fc4=_0x3bc4cc[_0x033d('0x2d')],_0x74f692=_0x3bc4cc[_0x033d('0x2d')]+_0x3bc4cc[_0x033d('0x2e')],_0x278332;if(_0x74f692>=_0x20e8df){_0x74f692=_0x20e8df;_0x278332=0xc8;}else{_0x278332=0xce;}_0x2a8d49[_0x033d('0x2a')](_0x278332);return _0x2a8d49[_0x033d('0x2f')](_0x033d('0x30'),_0x507fc4+'-'+_0x74f692+'/'+_0x20e8df)[_0x033d('0x2b')](_0x121bc9);}return null;};}function patchUpdates(_0x198718){return function(_0x4205bc){try{jsonpatch[_0x033d('0x31')](_0x4205bc,_0x198718,!![]);}catch(_0x1fdeb9){return BPromise['reject'](_0x1fdeb9);}return _0x4205bc[_0x033d('0x32')]();};}function saveUpdates(_0x17d057,_0x44c615){return function(_0x54ee1e){if(_0x54ee1e){return _0x54ee1e[_0x033d('0x33')](_0x17d057)[_0x033d('0x34')](function(_0xc68582){return _0xc68582;});}return null;};}function removeEntity(_0x104049,_0x19c702){return function(_0x40cb98){if(_0x40cb98){return _0x40cb98[_0x033d('0x35')]()[_0x033d('0x34')](function(){_0x104049['status'](0xcc)[_0x033d('0x29')]();});}};}function handleEntityNotFound(_0x48f2e5,_0x287a64){return function(_0x6858b0){if(!_0x6858b0){_0x48f2e5[_0x033d('0x28')](0x194);}return _0x6858b0;};}function handleError(_0x5a6c50,_0x2934ed){_0x2934ed=_0x2934ed||0x1f4;return function(_0x2ff11a){logger[_0x033d('0x24')](_0x2ff11a[_0x033d('0x36')]);if(_0x2ff11a[_0x033d('0x37')]){delete _0x2ff11a[_0x033d('0x37')];}_0x5a6c50[_0x033d('0x2a')](_0x2934ed)[_0x033d('0x38')](_0x2ff11a);};}exports['index']=function(_0x3817a4,_0x3f63df){var _0x44ff34={},_0x3707b1={},_0x3f79f0={'count':0x0,'rows':[]};var _0x400d77=_[_0x033d('0x39')](db['Network'][_0x033d('0x3a')],function(_0x3a5eea){return{'name':_0x3a5eea[_0x033d('0x3b')],'type':_0x3a5eea[_0x033d('0x3c')][_0x033d('0x3d')]};});_0x3707b1[_0x033d('0x3e')]=_[_0x033d('0x39')](_0x400d77,_0x033d('0x37'));_0x3707b1['query']=_[_0x033d('0x3f')](_0x3817a4['query']);_0x3707b1['filters']=_[_0x033d('0x40')](_0x3707b1[_0x033d('0x3e')],_0x3707b1['query']);_0x44ff34[_0x033d('0x41')]=_[_0x033d('0x40')](_0x3707b1[_0x033d('0x3e')],qs[_0x033d('0x42')](_0x3817a4[_0x033d('0x43')][_0x033d('0x42')]));_0x44ff34[_0x033d('0x41')]=_0x44ff34[_0x033d('0x41')][_0x033d('0x44')]?_0x44ff34['attributes']:_0x3707b1['model'];if(!_0x3817a4[_0x033d('0x43')][_0x033d('0x45')](_0x033d('0x46'))){_0x44ff34[_0x033d('0x2e')]=qs[_0x033d('0x2e')](_0x3817a4[_0x033d('0x43')][_0x033d('0x2e')]);_0x44ff34[_0x033d('0x2d')]=qs['offset'](_0x3817a4['query']['offset']);}_0x44ff34[_0x033d('0x47')]=qs['sort'](_0x3817a4[_0x033d('0x43')][_0x033d('0x48')]);_0x44ff34[_0x033d('0x49')]=qs[_0x033d('0x4a')](_['pick'](_0x3817a4[_0x033d('0x43')],_0x3707b1[_0x033d('0x4a')]),_0x400d77);if(_0x3817a4[_0x033d('0x43')][_0x033d('0x4b')]){_0x44ff34['where']=_['merge'](_0x44ff34['where'],{'$or':_['map'](_0x400d77,function(_0x300dd0){if(_0x300dd0[_0x033d('0x3c')]!==_0x033d('0x4c')){var _0xb2dbf9={};_0xb2dbf9[_0x300dd0[_0x033d('0x37')]]={'$like':'%'+_0x3817a4[_0x033d('0x43')][_0x033d('0x4b')]+'%'};return _0xb2dbf9;}})});}_0x44ff34=_[_0x033d('0x4d')]({},_0x44ff34,_0x3817a4[_0x033d('0x4e')]);var _0x3adcfa={'where':_0x44ff34[_0x033d('0x49')]};return db[_0x033d('0x4f')][_0x033d('0x2c')](_0x3adcfa)[_0x033d('0x34')](function(_0xb3e09b){_0x3f79f0['count']=_0xb3e09b;if(_0x3817a4['query'][_0x033d('0x50')]){_0x44ff34['include']=[{'all':!![]}];}return db['Network'][_0x033d('0x51')](_0x44ff34);})[_0x033d('0x34')](function(_0x4f2c13){_0x3f79f0[_0x033d('0x52')]=_0x4f2c13;return _0x3f79f0;})[_0x033d('0x34')](respondWithFilteredResult(_0x3f63df,_0x44ff34))[_0x033d('0x27')](handleError(_0x3f63df,null));};exports[_0x033d('0x53')]=function(_0x3ef6f8,_0x1c5821){var _0x38a348={'raw':!![],'where':{'id':_0x3ef6f8[_0x033d('0x54')]['id']}},_0x5c9d39={};_0x5c9d39['model']=_[_0x033d('0x3f')](db[_0x033d('0x4f')][_0x033d('0x3a')]);_0x5c9d39[_0x033d('0x43')]=_['keys'](_0x3ef6f8[_0x033d('0x43')]);_0x5c9d39[_0x033d('0x4a')]=_[_0x033d('0x40')](_0x5c9d39[_0x033d('0x3e')],_0x5c9d39[_0x033d('0x43')]);_0x38a348[_0x033d('0x41')]=_['intersection'](_0x5c9d39['model'],qs['fields'](_0x3ef6f8[_0x033d('0x43')]['fields']));_0x38a348[_0x033d('0x41')]=_0x38a348['attributes']['length']?_0x38a348['attributes']:_0x5c9d39['model'];if(_0x3ef6f8[_0x033d('0x43')]['includeAll']){_0x38a348[_0x033d('0x55')]=[{'all':!![]}];}_0x38a348=_[_0x033d('0x4d')]({},_0x38a348,_0x3ef6f8[_0x033d('0x4e')]);return db['Network'][_0x033d('0x56')](_0x38a348)[_0x033d('0x34')](handleEntityNotFound(_0x1c5821,null))['then'](respondWithResult(_0x1c5821,null))['catch'](handleError(_0x1c5821,null));};exports[_0x033d('0x57')]=function(_0x43d3e2,_0x396005,_0x214f5d){var _0x4663ee;return db[_0x033d('0x58')][_0x033d('0x59')](function(_0x59cfa6){return db['Network'][_0x033d('0x57')](_0x43d3e2[_0x033d('0x5a')],{'raw':!![]})[_0x033d('0x34')](function(_0x405abd){_0x4663ee=_0x405abd;return db['Network'][_0x033d('0x51')]({'where':{'type':_0x43d3e2['body'][_0x033d('0x3c')]},'raw':!![]});})[_0x033d('0x34')](function(_0x25b97a){if(_0x4663ee[_0x033d('0x3c')][_0x033d('0x5b')]()==_0x033d('0x5c')){var _0x5411c4=fs[_0x033d('0x5d')](path['join'](config['root'],_0x033d('0x5e')),_0x033d('0x5f'));var _0x16c812=ejs['render'](_0x5411c4,{'networks':_0x25b97a||[]});fs[_0x033d('0x60')](_0x033d('0x61'),_0x16c812);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0x4663ee[_0x033d('0x3c')][_0x033d('0x5b')]()=='TURN'){var _0x43e0d7=fs[_0x033d('0x5d')](path['join'](config[_0x033d('0x62')],_0x033d('0x63')),_0x033d('0x5f'));var _0x3cbaea=ejs[_0x033d('0x64')](_0x43e0d7,{'networks':_0x25b97a||[]});fs['writeFileSync'](_0x033d('0x65'),_0x3cbaea);return respondWithRpcPromise('Reload',_0x033d('0x57'),{'module':_0x033d('0x66')});}else{var _0x3fbc79=fs[_0x033d('0x5d')](path[_0x033d('0x67')](config['root'],_0x033d('0x68')),_0x033d('0x5f'));var _0x2be662=ejs[_0x033d('0x64')](_0x3fbc79,{'networks':_0x25b97a||[]});fs[_0x033d('0x60')](util[_0x033d('0x69')](_0x033d('0x6a'),_0x43d3e2[_0x033d('0x5a')][_0x033d('0x3c')][_0x033d('0x6b')]()),_0x2be662);return respondWithRpcPromise('Reload','create',{'module':_0x033d('0x6c')});}return null;})['then'](function(){return _0x4663ee;});})[_0x033d('0x34')](respondWithResult(_0x396005,0xc9))[_0x033d('0x27')](handleError(_0x396005,null));};exports[_0x033d('0x33')]=function(_0x585f72,_0x206e84,_0x4225d6){var _0x651cf5;return db[_0x033d('0x58')][_0x033d('0x59')](function(_0x5cac02){return db[_0x033d('0x4f')][_0x033d('0x56')]({'where':{'id':_0x585f72[_0x033d('0x54')]['id']}})[_0x033d('0x34')](handleEntityNotFound(_0x206e84,null))[_0x033d('0x34')](saveUpdates(_0x585f72[_0x033d('0x5a')],null))[_0x033d('0x34')](function(_0x474851){if(_0x474851){_0x651cf5=_0x474851;return db[_0x033d('0x4f')][_0x033d('0x51')]({'where':{'type':_0x651cf5['type']},'raw':!![]});}return null;})['then'](function(_0x166be8){if(_0x651cf5[_0x033d('0x3c')]['toUpperCase']()==_0x033d('0x5c')){var _0x183ae8=fs['readFileSync'](path[_0x033d('0x67')](config[_0x033d('0x62')],_0x033d('0x5e')),_0x033d('0x5f'));var _0x4608df=ejs[_0x033d('0x64')](_0x183ae8,{'networks':_0x166be8||[]});fs[_0x033d('0x60')](_0x033d('0x61'),_0x4608df);return respondWithRpcPromise(_0x033d('0x6d'),_0x033d('0x33'),{'module':_0x033d('0x66')});}else if(_0x651cf5[_0x033d('0x3c')][_0x033d('0x5b')]()==_0x033d('0x6e')){var _0x30f044=fs['readFileSync'](path['join'](config[_0x033d('0x62')],_0x033d('0x63')),_0x033d('0x5f'));var _0x5160e7=ejs[_0x033d('0x64')](_0x30f044,{'networks':_0x166be8||[]});fs[_0x033d('0x60')]('/etc/asterisk/turn_xcally.conf',_0x5160e7);return respondWithRpcPromise(_0x033d('0x6d'),_0x033d('0x33'),{'module':_0x033d('0x66')});}else{var _0x490312=fs[_0x033d('0x5d')](path['join'](config[_0x033d('0x62')],_0x033d('0x68')),_0x033d('0x5f'));var _0x10bdb3=ejs[_0x033d('0x64')](_0x490312,{'networks':_0x166be8||[]});fs[_0x033d('0x60')](util['format'](_0x033d('0x6a'),_0x585f72['body'][_0x033d('0x3c')][_0x033d('0x6b')]()),_0x10bdb3);return respondWithRpcPromise(_0x033d('0x6d'),_0x033d('0x33'),{'module':_0x033d('0x6c')});}return null;})[_0x033d('0x34')](function(_0x1c1a6c){if(_0x1c1a6c){return _0x651cf5;}return null;});})[_0x033d('0x34')](respondWithResult(_0x206e84,null))['catch'](handleError(_0x206e84,null));};exports[_0x033d('0x35')]=function(_0x4af8a2,_0x1a21cb,_0x29fc3a){var _0x36207b;return db[_0x033d('0x4f')][_0x033d('0x56')]({'where':{'id':_0x4af8a2[_0x033d('0x54')]['id']}})[_0x033d('0x34')](function(_0x41a237){_0x36207b=_0x41a237;return _0x41a237;})['then'](handleEntityNotFound(_0x1a21cb,null))[_0x033d('0x34')](removeEntity(_0x1a21cb,null))[_0x033d('0x34')](function(){if(_0x36207b){return db[_0x033d('0x4f')][_0x033d('0x51')]({'where':{'type':_0x36207b[_0x033d('0x3c')]},'raw':!![]});}})[_0x033d('0x34')](function(_0x4af4bd){if(_0x36207b[_0x033d('0x3c')][_0x033d('0x5b')]()==_0x033d('0x5c')){var _0x4fb4d2=fs[_0x033d('0x5d')](path[_0x033d('0x67')](config[_0x033d('0x62')],'server/files/templates/stun_multiple.ejs'),_0x033d('0x5f'));var _0x4a8da1=ejs[_0x033d('0x64')](_0x4fb4d2,{'networks':_0x4af4bd||[]});fs['writeFileSync'](_0x033d('0x61'),_0x4a8da1);return respondWithRpcPromise(_0x033d('0x6d'),_0x033d('0x35'),{'module':_0x033d('0x66')});}else if(_0x36207b['type']['toUpperCase']()==_0x033d('0x6e')){var _0x456866=fs[_0x033d('0x5d')](path[_0x033d('0x67')](config[_0x033d('0x62')],_0x033d('0x63')),_0x033d('0x5f'));var _0x579afb=ejs[_0x033d('0x64')](_0x456866,{'networks':_0x4af4bd||[]});fs[_0x033d('0x60')]('/etc/asterisk/turn_xcally.conf',_0x579afb);return respondWithRpcPromise('Reload',_0x033d('0x35'),{'module':_0x033d('0x66')});}else{var _0x47c9c1=fs['readFileSync'](path['join'](config[_0x033d('0x62')],_0x033d('0x68')),_0x033d('0x5f'));var _0x836b83=ejs[_0x033d('0x64')](_0x47c9c1,{'networks':_0x4af4bd||[]});fs['writeFileSync'](util[_0x033d('0x69')](_0x033d('0x6a'),_0x4af8a2['body'][_0x033d('0x3c')][_0x033d('0x6b')]()),_0x836b83);return respondWithRpcPromise(_0x033d('0x6d'),_0x033d('0x35'),{'module':_0x033d('0x6c')});}return null;})['catch'](handleError(_0x1a21cb,null));}; \ No newline at end of file +var _0x73b3=['include','findAll','rows','show','params','create','sequelize','transaction','body','toUpperCase','root','server/files/templates/stun_multiple.ejs','render','Reload','res_stun_monitor.so','readFileSync','join','utf8','server/files/templates/network.ejs','writeFileSync','format','toLowerCase','find','STUN','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','TURN','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','Network','count','includeAll'];(function(_0x2ca443,_0x33175d){var _0x3a1964=function(_0x33a117){while(--_0x33a117){_0x2ca443['push'](_0x2ca443['shift']());}};_0x3a1964(++_0x33175d);}(_0x73b3,0x183));var _0x373b=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x73b3[_0x4dcc2d];return _0x1bbd79;};'use strict';var pdf=require(_0x373b('0x0'));var emlformat=require(_0x373b('0x1'));var rimraf=require(_0x373b('0x2'));var zipdir=require(_0x373b('0x3'));var jsonpatch=require(_0x373b('0x4'));var rp=require(_0x373b('0x5'));var moment=require(_0x373b('0x6'));var BPromise=require(_0x373b('0x7'));var Mustache=require(_0x373b('0x8'));var util=require(_0x373b('0x9'));var path=require(_0x373b('0xa'));var sox=require(_0x373b('0xb'));var csv=require('to-csv');var ejs=require(_0x373b('0xc'));var fs=require('fs');var _=require(_0x373b('0xd'));var squel=require(_0x373b('0xe'));var crypto=require(_0x373b('0xf'));var jsforce=require(_0x373b('0x10'));var deskjs=require(_0x373b('0x11'));var toCsv=require(_0x373b('0x12'));var querystring=require(_0x373b('0x13'));var Papa=require(_0x373b('0x14'));var Redis=require(_0x373b('0x15'));var authService=require(_0x373b('0x16'));var qs=require(_0x373b('0x17'));var as=require(_0x373b('0x18'));var hardwareService=require(_0x373b('0x19'));var logger=require(_0x373b('0x1a'))(_0x373b('0x1b'));var utils=require(_0x373b('0x1c'));var config=require(_0x373b('0x1d'));var db=require(_0x373b('0x1e'))['db'];var jayson=require(_0x373b('0x1f'));var client=jayson[_0x373b('0x20')][_0x373b('0x21')]({'port':0x232a});function checkPasswordPattern(_0x162429,_0x4de9c0,_0x569aee){if(_0x569aee){var _0x41aade=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41aade[_0x373b('0x22')](_0x4de9c0)){return _0x162429;}else{throw new db[(_0x373b('0x23'))][(_0x373b('0x24'))](_0x373b('0x25'));}}else{return _0x162429;}}function respondWithRpcPromise(_0x5b8f04,_0x1dc3d3,_0x12ff2f,_0x6b1781){return new BPromise(function(_0x3d98ec,_0x26b392){var _0x4e1d11=_0x6b1781||client;return _0x4e1d11[_0x373b('0x26')](_0x5b8f04,_0x12ff2f)[_0x373b('0x27')](function(_0x504133){logger[_0x373b('0x28')](_0x373b('0x29'),_0x1dc3d3,_0x373b('0x2a'));logger[_0x373b('0x2b')](_0x373b('0x2c'),_0x1dc3d3,_0x373b('0x2a'),JSON['stringify'](_0x504133));if(_0x504133[_0x373b('0x2d')]){if(_0x504133[_0x373b('0x2d')]['code']===0x1f4){logger[_0x373b('0x2d')](_0x373b('0x29'),_0x1dc3d3,_0x504133['error'][_0x373b('0x2e')]);return _0x26b392(_0x504133['error'][_0x373b('0x2e')]);}logger[_0x373b('0x2d')](_0x373b('0x29'),_0x1dc3d3,_0x504133[_0x373b('0x2d')][_0x373b('0x2e')]);return _0x3d98ec(_0x504133[_0x373b('0x2d')][_0x373b('0x2e')]);}else{logger[_0x373b('0x28')](_0x373b('0x29'),_0x1dc3d3,_0x373b('0x2a'));_0x3d98ec(_0x504133[_0x373b('0x2f')][_0x373b('0x2e')]);}})[_0x373b('0x30')](function(_0x53960b){logger[_0x373b('0x2d')](_0x373b('0x29'),_0x1dc3d3,_0x53960b);_0x26b392(_0x53960b);});});}function respondWithStatusCode(_0x34c5dc,_0xdbb893){_0xdbb893=_0xdbb893||0xcc;return function(_0x364ba1){if(_0x364ba1){return _0x34c5dc[_0x373b('0x31')](_0xdbb893);}return _0x34c5dc[_0x373b('0x32')](_0xdbb893)[_0x373b('0x33')]();};}function respondWithResult(_0x51e0bc,_0x4bacd4){_0x4bacd4=_0x4bacd4||0xc8;return function(_0x12254b){if(_0x12254b){return _0x51e0bc[_0x373b('0x32')](_0x4bacd4)[_0x373b('0x34')](_0x12254b);}};}function respondWithFilteredResult(_0x645d86,_0x5b319c){return function(_0x122784){if(_0x122784){var _0x119dfe=_0x122784['count'],_0x2d0a6e=_0x5b319c[_0x373b('0x35')],_0x4c9970=_0x5b319c['offset']+_0x5b319c[_0x373b('0x36')],_0x3b0dc1;if(_0x4c9970>=_0x119dfe){_0x4c9970=_0x119dfe;_0x3b0dc1=0xc8;}else{_0x3b0dc1=0xce;}_0x645d86['status'](_0x3b0dc1);return _0x645d86[_0x373b('0x37')](_0x373b('0x38'),_0x2d0a6e+'-'+_0x4c9970+'/'+_0x119dfe)[_0x373b('0x34')](_0x122784);}return null;};}function patchUpdates(_0x18c9c3){return function(_0x3789e2){try{jsonpatch['apply'](_0x3789e2,_0x18c9c3,!![]);}catch(_0x248220){return BPromise[_0x373b('0x39')](_0x248220);}return _0x3789e2[_0x373b('0x3a')]();};}function saveUpdates(_0x3fca4d,_0x512b41){return function(_0x25c850){if(_0x25c850){return _0x25c850[_0x373b('0x3b')](_0x3fca4d)['then'](function(_0x5e0a50){return _0x5e0a50;});}return null;};}function removeEntity(_0x1bebff,_0x5a16ac){return function(_0x4c48e4){if(_0x4c48e4){return _0x4c48e4[_0x373b('0x3c')]()[_0x373b('0x27')](function(){_0x1bebff[_0x373b('0x32')](0xcc)[_0x373b('0x33')]();});}};}function handleEntityNotFound(_0x38eddb,_0x2e0f73){return function(_0x789445){if(!_0x789445){_0x38eddb[_0x373b('0x31')](0x194);}return _0x789445;};}function handleError(_0x2490fa,_0x206440){_0x206440=_0x206440||0x1f4;return function(_0x1c47e6){logger['error'](_0x1c47e6[_0x373b('0x3d')]);if(_0x1c47e6[_0x373b('0x3e')]){delete _0x1c47e6[_0x373b('0x3e')];}_0x2490fa[_0x373b('0x32')](_0x206440)[_0x373b('0x3f')](_0x1c47e6);};}exports[_0x373b('0x40')]=function(_0x57c6fa,_0x46ab20){var _0x57176e={},_0x265260={},_0x30c7bd={'count':0x0,'rows':[]};var _0x9f5c01=_[_0x373b('0x41')](db['Network'][_0x373b('0x42')],function(_0x56a1a7){return{'name':_0x56a1a7[_0x373b('0x43')],'type':_0x56a1a7[_0x373b('0x44')][_0x373b('0x45')]};});_0x265260['model']=_[_0x373b('0x41')](_0x9f5c01,'name');_0x265260['query']=_[_0x373b('0x46')](_0x57c6fa[_0x373b('0x47')]);_0x265260[_0x373b('0x48')]=_['intersection'](_0x265260[_0x373b('0x49')],_0x265260['query']);_0x57176e[_0x373b('0x4a')]=_[_0x373b('0x4b')](_0x265260['model'],qs[_0x373b('0x4c')](_0x57c6fa[_0x373b('0x47')][_0x373b('0x4c')]));_0x57176e[_0x373b('0x4a')]=_0x57176e['attributes'][_0x373b('0x4d')]?_0x57176e[_0x373b('0x4a')]:_0x265260[_0x373b('0x49')];if(!_0x57c6fa[_0x373b('0x47')][_0x373b('0x4e')](_0x373b('0x4f'))){_0x57176e['limit']=qs[_0x373b('0x36')](_0x57c6fa[_0x373b('0x47')][_0x373b('0x36')]);_0x57176e[_0x373b('0x35')]=qs['offset'](_0x57c6fa[_0x373b('0x47')]['offset']);}_0x57176e[_0x373b('0x50')]=qs[_0x373b('0x51')](_0x57c6fa[_0x373b('0x47')][_0x373b('0x51')]);_0x57176e[_0x373b('0x52')]=qs[_0x373b('0x48')](_[_0x373b('0x53')](_0x57c6fa[_0x373b('0x47')],_0x265260[_0x373b('0x48')]),_0x9f5c01);if(_0x57c6fa[_0x373b('0x47')]['filter']){_0x57176e[_0x373b('0x52')]=_[_0x373b('0x54')](_0x57176e['where'],{'$or':_[_0x373b('0x41')](_0x9f5c01,function(_0x498db7){if(_0x498db7[_0x373b('0x44')]!=='VIRTUAL'){var _0x231e34={};_0x231e34[_0x498db7[_0x373b('0x3e')]]={'$like':'%'+_0x57c6fa[_0x373b('0x47')]['filter']+'%'};return _0x231e34;}})});}_0x57176e=_[_0x373b('0x54')]({},_0x57176e,_0x57c6fa[_0x373b('0x55')]);var _0x5c3b3a={'where':_0x57176e[_0x373b('0x52')]};return db[_0x373b('0x56')]['count'](_0x5c3b3a)[_0x373b('0x27')](function(_0x33f0ab){_0x30c7bd[_0x373b('0x57')]=_0x33f0ab;if(_0x57c6fa[_0x373b('0x47')][_0x373b('0x58')]){_0x57176e[_0x373b('0x59')]=[{'all':!![]}];}return db[_0x373b('0x56')][_0x373b('0x5a')](_0x57176e);})['then'](function(_0x382706){_0x30c7bd[_0x373b('0x5b')]=_0x382706;return _0x30c7bd;})[_0x373b('0x27')](respondWithFilteredResult(_0x46ab20,_0x57176e))[_0x373b('0x30')](handleError(_0x46ab20,null));};exports[_0x373b('0x5c')]=function(_0x23214f,_0x18c0cf){var _0x17124b={'raw':!![],'where':{'id':_0x23214f[_0x373b('0x5d')]['id']}},_0x23a3e9={};_0x23a3e9[_0x373b('0x49')]=_['keys'](db[_0x373b('0x56')][_0x373b('0x42')]);_0x23a3e9[_0x373b('0x47')]=_[_0x373b('0x46')](_0x23214f['query']);_0x23a3e9[_0x373b('0x48')]=_[_0x373b('0x4b')](_0x23a3e9[_0x373b('0x49')],_0x23a3e9[_0x373b('0x47')]);_0x17124b['attributes']=_[_0x373b('0x4b')](_0x23a3e9[_0x373b('0x49')],qs[_0x373b('0x4c')](_0x23214f[_0x373b('0x47')][_0x373b('0x4c')]));_0x17124b[_0x373b('0x4a')]=_0x17124b[_0x373b('0x4a')]['length']?_0x17124b[_0x373b('0x4a')]:_0x23a3e9['model'];if(_0x23214f[_0x373b('0x47')][_0x373b('0x58')]){_0x17124b[_0x373b('0x59')]=[{'all':!![]}];}_0x17124b=_['merge']({},_0x17124b,_0x23214f[_0x373b('0x55')]);return db[_0x373b('0x56')]['find'](_0x17124b)[_0x373b('0x27')](handleEntityNotFound(_0x18c0cf,null))['then'](respondWithResult(_0x18c0cf,null))[_0x373b('0x30')](handleError(_0x18c0cf,null));};exports[_0x373b('0x5e')]=function(_0x33d9e4,_0x2cfbb6,_0x4f8ed4){var _0x40eb26;return db[_0x373b('0x5f')][_0x373b('0x60')](function(_0x26ff14){return db[_0x373b('0x56')][_0x373b('0x5e')](_0x33d9e4[_0x373b('0x61')],{'raw':!![]})[_0x373b('0x27')](function(_0x39d87e){_0x40eb26=_0x39d87e;return db[_0x373b('0x56')][_0x373b('0x5a')]({'where':{'type':_0x33d9e4[_0x373b('0x61')][_0x373b('0x44')]},'raw':!![]});})[_0x373b('0x27')](function(_0x143366){if(_0x40eb26['type'][_0x373b('0x62')]()=='STUN'){var _0x41cd1c=fs['readFileSync'](path['join'](config[_0x373b('0x63')],_0x373b('0x64')),'utf8');var _0x2edc31=ejs[_0x373b('0x65')](_0x41cd1c,{'networks':_0x143366||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2edc31);return respondWithRpcPromise(_0x373b('0x66'),_0x373b('0x5e'),{'module':_0x373b('0x67')});}else if(_0x40eb26['type'][_0x373b('0x62')]()=='TURN'){var _0x188620=fs[_0x373b('0x68')](path[_0x373b('0x69')](config[_0x373b('0x63')],'server/files/templates/turn_multiple.ejs'),_0x373b('0x6a'));var _0x48a1f5=ejs[_0x373b('0x65')](_0x188620,{'networks':_0x143366||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x48a1f5);return respondWithRpcPromise(_0x373b('0x66'),_0x373b('0x5e'),{'module':_0x373b('0x67')});}else{var _0x49cf1b=fs['readFileSync'](path[_0x373b('0x69')](config[_0x373b('0x63')],_0x373b('0x6b')),_0x373b('0x6a'));var _0x40e1bb=ejs[_0x373b('0x65')](_0x49cf1b,{'networks':_0x143366||[]});fs[_0x373b('0x6c')](util[_0x373b('0x6d')]('/etc/asterisk/sip_xcally_%s.conf',_0x33d9e4[_0x373b('0x61')][_0x373b('0x44')][_0x373b('0x6e')]()),_0x40e1bb);return respondWithRpcPromise(_0x373b('0x66'),'create',{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x40eb26;});})[_0x373b('0x27')](respondWithResult(_0x2cfbb6,0xc9))[_0x373b('0x30')](handleError(_0x2cfbb6,null));};exports[_0x373b('0x3b')]=function(_0xa202e2,_0x503c3e,_0x5f7912){var _0x233de7;return db[_0x373b('0x5f')][_0x373b('0x60')](function(_0x2f0114){return db[_0x373b('0x56')][_0x373b('0x6f')]({'where':{'id':_0xa202e2[_0x373b('0x5d')]['id']}})[_0x373b('0x27')](handleEntityNotFound(_0x503c3e,null))[_0x373b('0x27')](saveUpdates(_0xa202e2[_0x373b('0x61')],null))[_0x373b('0x27')](function(_0x1db188){if(_0x1db188){_0x233de7=_0x1db188;return db['Network'][_0x373b('0x5a')]({'where':{'type':_0x233de7[_0x373b('0x44')]},'raw':!![]});}return null;})[_0x373b('0x27')](function(_0x484f30){if(_0x233de7['type']['toUpperCase']()==_0x373b('0x70')){var _0x1fd073=fs[_0x373b('0x68')](path[_0x373b('0x69')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x373b('0x6a'));var _0x8392a7=ejs[_0x373b('0x65')](_0x1fd073,{'networks':_0x484f30||[]});fs['writeFileSync'](_0x373b('0x71'),_0x8392a7);return respondWithRpcPromise(_0x373b('0x66'),_0x373b('0x3b'),{'module':'res_stun_monitor.so'});}else if(_0x233de7['type'][_0x373b('0x62')]()=='TURN'){var _0x3b96ec=fs[_0x373b('0x68')](path[_0x373b('0x69')](config[_0x373b('0x63')],_0x373b('0x72')),_0x373b('0x6a'));var _0x38845a=ejs['render'](_0x3b96ec,{'networks':_0x484f30||[]});fs[_0x373b('0x6c')](_0x373b('0x73'),_0x38845a);return respondWithRpcPromise('Reload',_0x373b('0x3b'),{'module':_0x373b('0x67')});}else{var _0x23f63b=fs[_0x373b('0x68')](path[_0x373b('0x69')](config[_0x373b('0x63')],_0x373b('0x6b')),'utf8');var _0x5a6df7=ejs['render'](_0x23f63b,{'networks':_0x484f30||[]});fs[_0x373b('0x6c')](util[_0x373b('0x6d')](_0x373b('0x74'),_0xa202e2[_0x373b('0x61')]['type'][_0x373b('0x6e')]()),_0x5a6df7);return respondWithRpcPromise(_0x373b('0x66'),_0x373b('0x3b'),{'module':_0x373b('0x75')});}return null;})[_0x373b('0x27')](function(_0x25f560){if(_0x25f560){return _0x233de7;}return null;});})[_0x373b('0x27')](respondWithResult(_0x503c3e,null))[_0x373b('0x30')](handleError(_0x503c3e,null));};exports[_0x373b('0x3c')]=function(_0x12ac57,_0x4d6cde,_0x2d0d4b){var _0x298051;return db[_0x373b('0x56')]['find']({'where':{'id':_0x12ac57[_0x373b('0x5d')]['id']}})[_0x373b('0x27')](function(_0x404b65){_0x298051=_0x404b65;return _0x404b65;})[_0x373b('0x27')](handleEntityNotFound(_0x4d6cde,null))['then'](removeEntity(_0x4d6cde,null))[_0x373b('0x27')](function(){if(_0x298051){return db['Network'][_0x373b('0x5a')]({'where':{'type':_0x298051[_0x373b('0x44')]},'raw':!![]});}})[_0x373b('0x27')](function(_0x2eee32){if(_0x298051[_0x373b('0x44')][_0x373b('0x62')]()==_0x373b('0x70')){var _0x257e79=fs[_0x373b('0x68')](path[_0x373b('0x69')](config[_0x373b('0x63')],_0x373b('0x64')),'utf8');var _0x2a3a31=ejs[_0x373b('0x65')](_0x257e79,{'networks':_0x2eee32||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2a3a31);return respondWithRpcPromise(_0x373b('0x66'),_0x373b('0x3c'),{'module':_0x373b('0x67')});}else if(_0x298051[_0x373b('0x44')][_0x373b('0x62')]()==_0x373b('0x76')){var _0x55047c=fs[_0x373b('0x68')](path[_0x373b('0x69')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x373b('0x6a'));var _0xf8a2be=ejs['render'](_0x55047c,{'networks':_0x2eee32||[]});fs[_0x373b('0x6c')]('/etc/asterisk/turn_xcally.conf',_0xf8a2be);return respondWithRpcPromise(_0x373b('0x66'),_0x373b('0x3c'),{'module':_0x373b('0x67')});}else{var _0x196090=fs[_0x373b('0x68')](path[_0x373b('0x69')](config[_0x373b('0x63')],_0x373b('0x6b')),'utf8');var _0x4e155b=ejs[_0x373b('0x65')](_0x196090,{'networks':_0x2eee32||[]});fs['writeFileSync'](util['format'](_0x373b('0x74'),_0x12ac57[_0x373b('0x61')][_0x373b('0x44')][_0x373b('0x6e')]()),_0x4e155b);return respondWithRpcPromise('Reload',_0x373b('0x3c'),{'module':_0x373b('0x75')});}return null;})[_0x373b('0x30')](handleError(_0x4d6cde,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 58ca265..94df448 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 _0x29b8=['path','rimraf','../../config/environment','exports','define','Network','network','lodash','../../config/logger','request-promise'];(function(_0x55feb0,_0x4ec101){var _0x1cec9b=function(_0x18bd2c){while(--_0x18bd2c){_0x55feb0['push'](_0x55feb0['shift']());}};_0x1cec9b(++_0x4ec101);}(_0x29b8,0x183));var _0x829b=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x29b8[_0x1b8b95];return _0x3657ae;};'use strict';var _=require(_0x829b('0x0'));var util=require('util');var logger=require(_0x829b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x829b('0x2'));var fs=require('fs');var path=require(_0x829b('0x3'));var rimraf=require(_0x829b('0x4'));var config=require(_0x829b('0x5'));var attributes=require('./network.attributes');module[_0x829b('0x6')]=function(_0x5cffa3,_0x57724f){return _0x5cffa3[_0x829b('0x7')](_0x829b('0x8'),attributes,{'tableName':_0x829b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98e8=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./network.attributes','exports','define','lodash'];(function(_0x2bb91f,_0x2ae15b){var _0x367245=function(_0x1dd15e){while(--_0x1dd15e){_0x2bb91f['push'](_0x2bb91f['shift']());}};_0x367245(++_0x2ae15b);}(_0x98e8,0x154));var _0x898e=function(_0x24308d,_0x166699){_0x24308d=_0x24308d-0x0;var _0x25b1fb=_0x98e8[_0x24308d];return _0x25b1fb;};'use strict';var _=require(_0x898e('0x0'));var util=require(_0x898e('0x1'));var logger=require(_0x898e('0x2'))(_0x898e('0x3'));var moment=require('moment');var BPromise=require(_0x898e('0x4'));var rp=require(_0x898e('0x5'));var fs=require('fs');var path=require(_0x898e('0x6'));var rimraf=require('rimraf');var config=require(_0x898e('0x7'));var attributes=require(_0x898e('0x8'));module[_0x898e('0x9')]=function(_0x4ffc64,_0x8c5c7b){return _0x4ffc64[_0x898e('0xa')]('Network',attributes,{'tableName':'network','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 9a2bd88..1d75895 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 _0x21a2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Network,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x21a2,0x184));var _0x221a=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x21a2[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x221a('0x0'));var util=require(_0x221a('0x1'));var moment=require(_0x221a('0x2'));var BPromise=require(_0x221a('0x3'));var rs=require(_0x221a('0x4'));var fs=require('fs');var Redis=require(_0x221a('0x5'));var db=require(_0x221a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x221a('0x7'))(_0x221a('0x8'));var config=require(_0x221a('0x9'));var jayson=require(_0x221a('0xa'));var client=jayson[_0x221a('0xb')][_0x221a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30f377,_0x382c04,_0x33c6a3){return new BPromise(function(_0x5844fa,_0x27d1f2){return client[_0x221a('0xd')](_0x30f377,_0x33c6a3)[_0x221a('0xe')](function(_0x5db4b9){logger['info']('Network,\x20%s,\x20%s',_0x382c04,'request\x20sent');logger[_0x221a('0xf')](_0x221a('0x10'),_0x382c04,_0x221a('0x11'),JSON['stringify'](_0x5db4b9));if(_0x5db4b9[_0x221a('0x12')]){if(_0x5db4b9[_0x221a('0x12')][_0x221a('0x13')]===0x1f4){logger[_0x221a('0x12')](_0x221a('0x14'),_0x382c04,_0x5db4b9[_0x221a('0x12')][_0x221a('0x15')]);return _0x27d1f2(_0x5db4b9[_0x221a('0x12')]['message']);}logger[_0x221a('0x12')](_0x221a('0x14'),_0x382c04,_0x5db4b9[_0x221a('0x12')][_0x221a('0x15')]);return _0x5844fa(_0x5db4b9[_0x221a('0x12')]['message']);}else{logger['info'](_0x221a('0x14'),_0x382c04,'request\x20sent');_0x5844fa(_0x5db4b9['result']['message']);}})[_0x221a('0x16')](function(_0xe8eb15){logger['error']('Network,\x20%s,\x20%s',_0x382c04,_0xe8eb15);_0x27d1f2(_0xe8eb15);});});} \ No newline at end of file +var _0xc759=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x58bf7c,_0x1ab137){var _0x292f7f=function(_0x20a4d5){while(--_0x20a4d5){_0x58bf7c['push'](_0x58bf7c['shift']());}};_0x292f7f(++_0x1ab137);}(_0xc759,0x1f2));var _0x9c75=function(_0x56a251,_0x23db48){_0x56a251=_0x56a251-0x0;var _0x56b7d9=_0xc759[_0x56a251];return _0x56b7d9;};'use strict';var _=require(_0x9c75('0x0'));var util=require(_0x9c75('0x1'));var moment=require(_0x9c75('0x2'));var BPromise=require(_0x9c75('0x3'));var rs=require(_0x9c75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c75('0x5'))['db'];var utils=require(_0x9c75('0x6'));var logger=require(_0x9c75('0x7'))(_0x9c75('0x8'));var config=require(_0x9c75('0x9'));var jayson=require(_0x9c75('0xa'));var client=jayson[_0x9c75('0xb')][_0x9c75('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ec1f2,_0x418737,_0x3d1eee){return new BPromise(function(_0x2e6259,_0x1e2a22){return client[_0x9c75('0xd')](_0x4ec1f2,_0x3d1eee)[_0x9c75('0xe')](function(_0x4f30c5){logger[_0x9c75('0xf')](_0x9c75('0x10'),_0x418737,_0x9c75('0x11'));logger[_0x9c75('0x12')](_0x9c75('0x13'),_0x418737,_0x9c75('0x11'),JSON['stringify'](_0x4f30c5));if(_0x4f30c5[_0x9c75('0x14')]){if(_0x4f30c5['error'][_0x9c75('0x15')]===0x1f4){logger['error'](_0x9c75('0x10'),_0x418737,_0x4f30c5[_0x9c75('0x14')]['message']);return _0x1e2a22(_0x4f30c5[_0x9c75('0x14')][_0x9c75('0x16')]);}logger[_0x9c75('0x14')](_0x9c75('0x10'),_0x418737,_0x4f30c5['error'][_0x9c75('0x16')]);return _0x2e6259(_0x4f30c5[_0x9c75('0x14')][_0x9c75('0x16')]);}else{logger[_0x9c75('0xf')](_0x9c75('0x10'),_0x418737,_0x9c75('0x11'));_0x2e6259(_0x4f30c5[_0x9c75('0x17')][_0x9c75('0x16')]);}})[_0x9c75('0x18')](function(_0x5f4491){logger[_0x9c75('0x14')]('Network,\x20%s,\x20%s',_0x418737,_0x5f4491);_0x1e2a22(_0x5f4491);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 3b8e502..30c96ab 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 _0x26a2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','isAuthenticated','exports','multer','util','path','express','Router'];(function(_0x1306e9,_0x4fd1ce){var _0x15eafb=function(_0x16ebed){while(--_0x16ebed){_0x1306e9['push'](_0x1306e9['shift']());}};_0x15eafb(++_0x4fd1ce);}(_0x26a2,0x8a));var _0x226a=function(_0x5e3804,_0xd37873){_0x5e3804=_0x5e3804-0x0;var _0x5d70ee=_0x26a2[_0x5e3804];return _0x5d70ee;};'use strict';var multer=require(_0x226a('0x0'));var util=require(_0x226a('0x1'));var path=require(_0x226a('0x2'));var timeout=require('connect-timeout');var express=require(_0x226a('0x3'));var router=express[_0x226a('0x4')]();var auth=require(_0x226a('0x5'));var interaction=require(_0x226a('0x6'));var config=require(_0x226a('0x7'));var controller=require(_0x226a('0x8'));router['post']('/',auth[_0x226a('0x9')](),controller['sendNotification']);module[_0x226a('0xa')]=router; \ No newline at end of file +var _0xe023=['./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path','../../components/interaction/service'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xe023,0x188));var _0x3e02=function(_0x40b0dc,_0x1da61e){_0x40b0dc=_0x40b0dc-0x0;var _0x2bd349=_0xe023[_0x40b0dc];return _0x2bd349;};'use strict';var multer=require(_0x3e02('0x0'));var util=require(_0x3e02('0x1'));var path=require(_0x3e02('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3e02('0x3'));var config=require('../../config/environment');var controller=require(_0x3e02('0x4'));router[_0x3e02('0x5')]('/',auth[_0x3e02('0x6')](),controller[_0x3e02('0x7')]);module[_0x3e02('0x8')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 2aaceba..a07b2f6 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 _0x2a3e=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x15fb0b,_0x44b92d){var _0x423f50=function(_0x32b8c5){while(--_0x32b8c5){_0x15fb0b['push'](_0x15fb0b['shift']());}};_0x423f50(++_0x44b92d);}(_0x2a3e,0xdc));var _0xe2a3=function(_0x11791b,_0x184cf3){_0x11791b=_0x11791b-0x0;var _0x305f4c=_0x2a3e[_0x11791b];return _0x305f4c;};'use strict';var Sequelize=require(_0xe2a3('0x0'));module[_0xe2a3('0x1')]={'body':{'type':Sequelize[_0xe2a3('0x2')]},'senderName':{'type':Sequelize[_0xe2a3('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xe2a3('0x3')]},'beep':{'type':Sequelize[_0xe2a3('0x4')]}}; \ No newline at end of file +var _0x138e=['TEXT','BOOLEAN','sequelize','exports','STRING'];(function(_0x160c2a,_0x3d8c4b){var _0x196dad=function(_0x3cbff9){while(--_0x3cbff9){_0x160c2a['push'](_0x160c2a['shift']());}};_0x196dad(++_0x3d8c4b);}(_0x138e,0x133));var _0xe138=function(_0x190a44,_0x18cc39){_0x190a44=_0x190a44-0x0;var _0x385cf5=_0x138e[_0x190a44];return _0x385cf5;};'use strict';var Sequelize=require(_0xe138('0x0'));module[_0xe138('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xe138('0x2')]},'recipientsId':{'type':Sequelize[_0xe138('0x3')]},'recipientsDescription':{'type':Sequelize[_0xe138('0x2')]},'beep':{'type':Sequelize[_0xe138('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 41316bd..6edd5b1 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 _0x91e6=['push','all','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/utils','redis','localhost','./notification.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','voicequeue','user','some','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','transaction','create','forEach','recipient','emit','notification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','model','toLowerCase','User','includes','queue'];(function(_0x3c8f20,_0x390d52){var _0x406b2d=function(_0x145c51){while(--_0x145c51){_0x3c8f20['push'](_0x3c8f20['shift']());}};_0x406b2d(++_0x390d52);}(_0x91e6,0x117));var _0x691e=function(_0x24f22d,_0x1f6649){_0x24f22d=_0x24f22d-0x0;var _0x321679=_0x91e6[_0x24f22d];return _0x321679;};'use strict';var pdf=require(_0x691e('0x0'));var emlformat=require(_0x691e('0x1'));var rimraf=require(_0x691e('0x2'));var zipdir=require(_0x691e('0x3'));var jsonpatch=require(_0x691e('0x4'));var rp=require('request-promise');var moment=require(_0x691e('0x5'));var BPromise=require(_0x691e('0x6'));var Mustache=require(_0x691e('0x7'));var util=require('util');var path=require(_0x691e('0x8'));var sox=require(_0x691e('0x9'));var csv=require(_0x691e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x691e('0xb'));var squel=require('squel');var crypto=require(_0x691e('0xc'));var jsforce=require(_0x691e('0xd'));var deskjs=require(_0x691e('0xe'));var toCsv=require(_0x691e('0xa'));var querystring=require(_0x691e('0xf'));var Papa=require('papaparse');var Redis=require(_0x691e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x691e('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x691e('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x691e('0x13')]=_['defaults'](config['redis'],{'host':_0x691e('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x691e('0x15'))[_0x691e('0x16')](socket);function respondWithStatusCode(_0x4e3f01,_0x51b627){_0x51b627=_0x51b627||0xcc;return function(_0x55f526){if(_0x55f526){return _0x4e3f01[_0x691e('0x17')](_0x51b627);}return _0x4e3f01[_0x691e('0x18')](_0x51b627)[_0x691e('0x19')]();};}function respondWithResult(_0x419b1e,_0x1562ef){_0x1562ef=_0x1562ef||0xc8;return function(_0x5b4b84){if(_0x5b4b84){return _0x419b1e['status'](_0x1562ef)[_0x691e('0x1a')](_0x5b4b84);}};}function respondWithFilteredResult(_0x4a18ae,_0x2a2a57){return function(_0x551f72){if(_0x551f72){var _0x376d1f=_0x551f72[_0x691e('0x1b')],_0x1b6024=_0x2a2a57[_0x691e('0x1c')],_0x160e85=_0x2a2a57[_0x691e('0x1c')]+_0x2a2a57['limit'],_0x43e81d;if(_0x160e85>=_0x376d1f){_0x160e85=_0x376d1f;_0x43e81d=0xc8;}else{_0x43e81d=0xce;}_0x4a18ae[_0x691e('0x18')](_0x43e81d);return _0x4a18ae[_0x691e('0x1d')](_0x691e('0x1e'),_0x1b6024+'-'+_0x160e85+'/'+_0x376d1f)[_0x691e('0x1a')](_0x551f72);}return null;};}function patchUpdates(_0xa282f7){return function(_0x3c594e){try{jsonpatch[_0x691e('0x1f')](_0x3c594e,_0xa282f7,!![]);}catch(_0x22ceee){return BPromise[_0x691e('0x20')](_0x22ceee);}return _0x3c594e[_0x691e('0x21')]();};}function saveUpdates(_0x5ef704,_0x3cbe34){return function(_0x134c1d){if(_0x134c1d){return _0x134c1d[_0x691e('0x22')](_0x5ef704)['then'](function(_0x12ecbb){return _0x12ecbb;});}return null;};}function removeEntity(_0x2381aa,_0x1aa216){return function(_0x500bd5){if(_0x500bd5){return _0x500bd5[_0x691e('0x23')]()[_0x691e('0x24')](function(){_0x2381aa[_0x691e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5db20e,_0x44758b){return function(_0x1fa189){if(!_0x1fa189){_0x5db20e[_0x691e('0x17')](0x194);}return _0x1fa189;};}function handleError(_0x448c7c,_0x7401b5){_0x7401b5=_0x7401b5||0x1f4;return function(_0x3dd0d7){logger[_0x691e('0x25')](_0x3dd0d7[_0x691e('0x26')]);if(_0x3dd0d7[_0x691e('0x27')]){delete _0x3dd0d7[_0x691e('0x27')];}_0x448c7c[_0x691e('0x18')](_0x7401b5)['send'](_0x3dd0d7);};}exports[_0x691e('0x28')]=function(_0x1b29dd,_0x58dd44,_0x2df19c){if(!_0x1b29dd[_0x691e('0x29')][_0x691e('0x2a')](_0x691e('0x2b'))&&!_0x1b29dd[_0x691e('0x29')][_0x691e('0x2a')](_0x691e('0x2c'))){throw new db[(_0x691e('0x2d'))][(_0x691e('0x2e'))](_0x691e('0x2f'));}else{if(_0x1b29dd[_0x691e('0x29')][_0x691e('0x2a')](_0x691e('0x2c'))&&!_0x1b29dd[_0x691e('0x29')][_0x691e('0x2a')](_0x691e('0x30'))){throw new db[(_0x691e('0x2d'))][(_0x691e('0x2e'))](_0x691e('0x31'));}if(!_0x1b29dd[_0x691e('0x29')][_0x691e('0x2a')](_0x691e('0x32'))){throw new db[(_0x691e('0x2d'))]['ValidationError'](_0x691e('0x33'));}else{try{var _0xcdff0e=JSON[_0x691e('0x34')](_0x1b29dd[_0x691e('0x29')][_0x691e('0x32')]);}catch(_0x1225b9){logger[_0x691e('0x25')](_0x1225b9);throw new db[(_0x691e('0x2d'))]['ValidationError'](_0x691e('0x35'));}var _0x20637a=[_0x691e('0x36'),_0x691e('0x37'),_0x691e('0x38'),'openchannelqueue','smsqueue',_0x691e('0x39'),'whatsappqueue','team',_0x691e('0x3a')];if(_[_0x691e('0x3b')](_0xcdff0e,function(_0x1d4cb0){return!_['includes'](_0x20637a,_0x1d4cb0['model']['toLowerCase']());})){throw new db['Sequelize'][(_0x691e('0x2e'))](_0x691e('0x3c'));}}}var _0x24027f={};_0x24027f['senderName']=_0x1b29dd['body'][_0x691e('0x2a')]('senderName')?_0x1b29dd[_0x691e('0x29')][_0x691e('0x3d')]:_0x1b29dd['user']['fullname'];_0x24027f[_0x691e('0x3e')]=_[_0x691e('0x3f')](_0x1b29dd[_0x691e('0x29')]['recipientsDescription'])?null:_0x1b29dd[_0x691e('0x29')][_0x691e('0x3e')];_0x24027f[_0x691e('0x40')]=_0x1b29dd[_0x691e('0x29')][_0x691e('0x40')]||![];_0x24027f[_0x691e('0x41')]=_0x1b29dd['user']['id'];return getContent(_0x1b29dd['body'])[_0x691e('0x24')](function(_0xfd8a2a){_0x24027f[_0x691e('0x29')]=_0xfd8a2a;return getRecipients(_0xcdff0e);})['then'](function(_0x449668){_0x24027f[_0x691e('0x42')]=_['sortBy'](_0x449668)['join'](',');return db[_0x691e('0x43')][_0x691e('0x44')](function(_0x282f29){return db['Notification'][_0x691e('0x45')](_0x24027f,{'raw':!![],'transaction':_0x282f29})[_0x691e('0x24')](function(_0x5f0ac3){var _0x1c4556={'sender':_0x24027f['senderName'],'description':_0x24027f[_0x691e('0x3e')],'content':_0x24027f['body'],'beep':_0x24027f[_0x691e('0x40')]};_0x449668[_0x691e('0x46')](function(_0x4ef30b){_0x1c4556[_0x691e('0x47')]=_0x4ef30b;socket[_0x691e('0x48')](_0x691e('0x49'),_0x1c4556);});return _0x5f0ac3;});});})[_0x691e('0x24')](respondWithResult(_0x58dd44,0xc9))[_0x691e('0x4a')](handleError(_0x58dd44,null));};function getContent(_0x1dcaa8){return new BPromise(function(_0x207103,_0x4a5429){if(_0x1dcaa8['text']){_0x207103(_0x1dcaa8[_0x691e('0x2b')]);return;}return db['Template'][_0x691e('0x4b')]({'attributes':[_0x691e('0x4c')],'where':{'id':_0x1dcaa8[_0x691e('0x2c')]},'raw':!![]})[_0x691e('0x24')](function(_0x2d585d){if(!_0x2d585d)throw new db[(_0x691e('0x2d'))][(_0x691e('0x2e'))](_0x691e('0x4d'));var _0x153b7c=Mustache[_0x691e('0x4e')](_0x2d585d[_0x691e('0x4c')],_0x1dcaa8['view']);_0x207103(_0x153b7c);})['catch'](function(_0x276af9){_0x4a5429(_0x276af9);});});}function getRecipients(_0x3be16b){return new BPromise(function(_0x24b256,_0x20275f){var _0x3a29a3=[];var _0x1b8425=[];_0x3be16b[_0x691e('0x46')](function(_0x3f0c8c){var _0x2f0cf4=_[_0x691e('0x4f')](_0x3f0c8c[_0x691e('0x50')][_0x691e('0x51')]());if(_0x2f0cf4===_0x691e('0x52')){_0x3a29a3=_['union'](_0x3a29a3,_0x3f0c8c['ids']);}else{if(_[_0x691e('0x53')](_0x2f0cf4,'queue'))_0x2f0cf4=_0x2f0cf4['replace'](_0x691e('0x54'),'Queue');_0x3f0c8c['ids'][_0x691e('0x46')](function(_0x13e8d0){_0x1b8425[_0x691e('0x55')](getAgents(_0x2f0cf4,_0x13e8d0));});}});return BPromise[_0x691e('0x56')](_0x1b8425)[_0x691e('0x24')](function(_0x220c9b){_0x3a29a3=_[_0x691e('0x57')](_0x3a29a3,_[_0x691e('0x58')](_0x220c9b));_0x24b256(_0x3a29a3);})[_0x691e('0x4a')](function(_0x1d8c34){_0x20275f(_0x1d8c34);});});}function getAgents(_0x232189,_0x791ff6){return new BPromise(function(_0x44e49e,_0x5e694c){return db[_0x232189]['findOne']({'where':{'id':_0x791ff6}})['then'](function(_0x327fc4){return _0x327fc4[_0x691e('0x59')]({'attributes':['id'],'raw':!![]})[_0x691e('0x24')](function(_0x523636){var _0x5bf860=_[_0x691e('0x5a')](_0x523636,'id');_0x44e49e(_0x5bf860);});})['catch'](function(_0x4bb42d){_0x5e694c(_0x4bb42d);});});} \ No newline at end of file +var _0xd25f=['includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','recipientsId','sortBy','join','sequelize','transaction','Notification','create','notification:send','catch','Template','findOne','render','html','forEach','toLowerCase','User','ids','queue','replace','Queue','union','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./notification.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','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','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','team','user'];(function(_0x351439,_0x2a0733){var _0x574aed=function(_0x567298){while(--_0x567298){_0x351439['push'](_0x351439['shift']());}};_0x574aed(++_0x2a0733);}(_0xd25f,0x79));var _0xfd25=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0xd25f[_0x1443eb];return _0x2b8810;};'use strict';var pdf=require(_0xfd25('0x0'));var emlformat=require(_0xfd25('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfd25('0x2'));var jsonpatch=require(_0xfd25('0x3'));var rp=require(_0xfd25('0x4'));var moment=require(_0xfd25('0x5'));var BPromise=require(_0xfd25('0x6'));var Mustache=require(_0xfd25('0x7'));var util=require(_0xfd25('0x8'));var path=require(_0xfd25('0x9'));var sox=require(_0xfd25('0xa'));var csv=require(_0xfd25('0xb'));var ejs=require(_0xfd25('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfd25('0xd'));var crypto=require(_0xfd25('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfd25('0xf'));var toCsv=require(_0xfd25('0xb'));var querystring=require(_0xfd25('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfd25('0x11'));var as=require(_0xfd25('0x12'));var hardwareService=require(_0xfd25('0x13'));var logger=require(_0xfd25('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xfd25('0x15'));var db=require(_0xfd25('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xfd25('0x17'),'port':0x18eb});var socket=require(_0xfd25('0x18'))(new Redis(config[_0xfd25('0x19')]));require(_0xfd25('0x1a'))[_0xfd25('0x1b')](socket);function respondWithStatusCode(_0x3dd999,_0x244a4c){_0x244a4c=_0x244a4c||0xcc;return function(_0x55c306){if(_0x55c306){return _0x3dd999[_0xfd25('0x1c')](_0x244a4c);}return _0x3dd999[_0xfd25('0x1d')](_0x244a4c)[_0xfd25('0x1e')]();};}function respondWithResult(_0x480b22,_0x1ac22f){_0x1ac22f=_0x1ac22f||0xc8;return function(_0x359171){if(_0x359171){return _0x480b22[_0xfd25('0x1d')](_0x1ac22f)[_0xfd25('0x1f')](_0x359171);}};}function respondWithFilteredResult(_0x1fe1e9,_0x1454ea){return function(_0x832f74){if(_0x832f74){var _0xabdf9c=_0x832f74[_0xfd25('0x20')],_0x38916c=_0x1454ea[_0xfd25('0x21')],_0x51472c=_0x1454ea[_0xfd25('0x21')]+_0x1454ea['limit'],_0x1e1976;if(_0x51472c>=_0xabdf9c){_0x51472c=_0xabdf9c;_0x1e1976=0xc8;}else{_0x1e1976=0xce;}_0x1fe1e9['status'](_0x1e1976);return _0x1fe1e9[_0xfd25('0x22')](_0xfd25('0x23'),_0x38916c+'-'+_0x51472c+'/'+_0xabdf9c)[_0xfd25('0x1f')](_0x832f74);}return null;};}function patchUpdates(_0x5e26b8){return function(_0x5a1802){try{jsonpatch[_0xfd25('0x24')](_0x5a1802,_0x5e26b8,!![]);}catch(_0x3c023c){return BPromise['reject'](_0x3c023c);}return _0x5a1802[_0xfd25('0x25')]();};}function saveUpdates(_0x78b6ff,_0x1243e6){return function(_0x216628){if(_0x216628){return _0x216628[_0xfd25('0x26')](_0x78b6ff)['then'](function(_0x40cccb){return _0x40cccb;});}return null;};}function removeEntity(_0x114599,_0x3e593f){return function(_0x3969c4){if(_0x3969c4){return _0x3969c4[_0xfd25('0x27')]()[_0xfd25('0x28')](function(){_0x114599['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x68f83,_0x37044f){return function(_0x44f749){if(!_0x44f749){_0x68f83['sendStatus'](0x194);}return _0x44f749;};}function handleError(_0x4a6527,_0xa2a483){_0xa2a483=_0xa2a483||0x1f4;return function(_0x2dcae8){logger[_0xfd25('0x29')](_0x2dcae8[_0xfd25('0x2a')]);if(_0x2dcae8['name']){delete _0x2dcae8['name'];}_0x4a6527[_0xfd25('0x1d')](_0xa2a483)[_0xfd25('0x2b')](_0x2dcae8);};}exports[_0xfd25('0x2c')]=function(_0x5479eb,_0x1ecbf5,_0x54b6f2){if(!_0x5479eb['body'][_0xfd25('0x2d')](_0xfd25('0x2e'))&&!_0x5479eb[_0xfd25('0x2f')]['hasOwnProperty'](_0xfd25('0x30'))){throw new db[(_0xfd25('0x31'))][(_0xfd25('0x32'))](_0xfd25('0x33'));}else{if(_0x5479eb['body'][_0xfd25('0x2d')](_0xfd25('0x30'))&&!_0x5479eb[_0xfd25('0x2f')]['hasOwnProperty'](_0xfd25('0x34'))){throw new db['Sequelize'][(_0xfd25('0x32'))](_0xfd25('0x35'));}if(!_0x5479eb['body'][_0xfd25('0x2d')](_0xfd25('0x36'))){throw new db['Sequelize'][(_0xfd25('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x550f57=JSON[_0xfd25('0x37')](_0x5479eb[_0xfd25('0x2f')][_0xfd25('0x36')]);}catch(_0x574e2c){logger['error'](_0x574e2c);throw new db[(_0xfd25('0x31'))][(_0xfd25('0x32'))](_0xfd25('0x38'));}var _0x1143c5=['chatqueue',_0xfd25('0x39'),_0xfd25('0x3a'),_0xfd25('0x3b'),_0xfd25('0x3c'),'voicequeue','whatsappqueue',_0xfd25('0x3d'),_0xfd25('0x3e')];if(_['some'](_0x550f57,function(_0x3ba7de){return!_[_0xfd25('0x3f')](_0x1143c5,_0x3ba7de[_0xfd25('0x40')]['toLowerCase']());})){throw new db[(_0xfd25('0x31'))][(_0xfd25('0x32'))](_0xfd25('0x41'));}}}var _0x9e8402={};_0x9e8402['senderName']=_0x5479eb[_0xfd25('0x2f')][_0xfd25('0x2d')](_0xfd25('0x42'))?_0x5479eb[_0xfd25('0x2f')][_0xfd25('0x42')]:_0x5479eb[_0xfd25('0x3e')]['fullname'];_0x9e8402[_0xfd25('0x43')]=_[_0xfd25('0x44')](_0x5479eb['body']['recipientsDescription'])?null:_0x5479eb[_0xfd25('0x2f')]['recipientsDescription'];_0x9e8402['beep']=_0x5479eb[_0xfd25('0x2f')][_0xfd25('0x45')]||![];_0x9e8402['SenderId']=_0x5479eb[_0xfd25('0x3e')]['id'];return getContent(_0x5479eb[_0xfd25('0x2f')])[_0xfd25('0x28')](function(_0x386994){_0x9e8402[_0xfd25('0x2f')]=_0x386994;return getRecipients(_0x550f57);})[_0xfd25('0x28')](function(_0x4d8326){_0x9e8402[_0xfd25('0x46')]=_[_0xfd25('0x47')](_0x4d8326)[_0xfd25('0x48')](',');return db[_0xfd25('0x49')][_0xfd25('0x4a')](function(_0x51bcda){return db[_0xfd25('0x4b')][_0xfd25('0x4c')](_0x9e8402,{'raw':!![],'transaction':_0x51bcda})[_0xfd25('0x28')](function(_0x27e141){var _0xa66ea5={'sender':_0x9e8402['senderName'],'description':_0x9e8402[_0xfd25('0x43')],'content':_0x9e8402['body'],'beep':_0x9e8402[_0xfd25('0x45')]};_0x4d8326['forEach'](function(_0x522ffc){_0xa66ea5['recipient']=_0x522ffc;socket['emit'](_0xfd25('0x4d'),_0xa66ea5);});return _0x27e141;});});})[_0xfd25('0x28')](respondWithResult(_0x1ecbf5,0xc9))[_0xfd25('0x4e')](handleError(_0x1ecbf5,null));};function getContent(_0x1b4a90){return new BPromise(function(_0x3a7fc8,_0x278c60){if(_0x1b4a90[_0xfd25('0x2e')]){_0x3a7fc8(_0x1b4a90[_0xfd25('0x2e')]);return;}return db[_0xfd25('0x4f')][_0xfd25('0x50')]({'attributes':['html'],'where':{'id':_0x1b4a90[_0xfd25('0x30')]},'raw':!![]})[_0xfd25('0x28')](function(_0x3a5176){if(!_0x3a5176)throw new db[(_0xfd25('0x31'))][(_0xfd25('0x32'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x5e44d9=Mustache[_0xfd25('0x51')](_0x3a5176[_0xfd25('0x52')],_0x1b4a90[_0xfd25('0x34')]);_0x3a7fc8(_0x5e44d9);})['catch'](function(_0x2344f3){_0x278c60(_0x2344f3);});});}function getRecipients(_0x5b3577){return new BPromise(function(_0x324691,_0x53082b){var _0x1d451a=[];var _0x32984c=[];_0x5b3577[_0xfd25('0x53')](function(_0x446f3b){var _0x3f990=_['startCase'](_0x446f3b[_0xfd25('0x40')][_0xfd25('0x54')]());if(_0x3f990===_0xfd25('0x55')){_0x1d451a=_['union'](_0x1d451a,_0x446f3b[_0xfd25('0x56')]);}else{if(_['includes'](_0x3f990,_0xfd25('0x57')))_0x3f990=_0x3f990[_0xfd25('0x58')](_0xfd25('0x57'),_0xfd25('0x59'));_0x446f3b[_0xfd25('0x56')][_0xfd25('0x53')](function(_0x55e298){_0x32984c['push'](getAgents(_0x3f990,_0x55e298));});}});return BPromise['all'](_0x32984c)[_0xfd25('0x28')](function(_0x40dcc0){_0x1d451a=_[_0xfd25('0x5a')](_0x1d451a,_['flatten'](_0x40dcc0));_0x324691(_0x1d451a);})[_0xfd25('0x4e')](function(_0x49807f){_0x53082b(_0x49807f);});});}function getAgents(_0x4703c2,_0x5a42ca){return new BPromise(function(_0x41a19d,_0x2de7d6){return db[_0x4703c2][_0xfd25('0x50')]({'where':{'id':_0x5a42ca}})[_0xfd25('0x28')](function(_0x35f882){return _0x35f882[_0xfd25('0x5b')]({'attributes':['id'],'raw':!![]})[_0xfd25('0x28')](function(_0x58e95e){var _0x13fc80=_['map'](_0x58e95e,'id');_0x41a19d(_0x13fc80);});})[_0xfd25('0x4e')](function(_0x44ef1a){_0x2de7d6(_0x44ef1a);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 42cdaf6..991d568 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 _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x375a02,_0x4611c8){var _0x414c08=function(_0x47d026){while(--_0x47d026){_0x375a02['push'](_0x375a02['shift']());}};_0x414c08(++_0x4611c8);}(_0xdb28,0x106));var _0x8db2=function(_0x102622,_0x5272e8){_0x102622=_0x102622-0x0;var _0x16672d=_0xdb28[_0x102622];return _0x16672d;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','Notification','setMaxListeners','save','remove','emit'];(function(_0x49bb5a,_0x3bda78){var _0x15dc66=function(_0x51a66b){while(--_0x51a66b){_0x49bb5a['push'](_0x49bb5a['shift']());}};_0x15dc66(++_0x3bda78);}(_0xb10b,0x12a));var _0xbb10=function(_0x4cc1c1,_0x3ad908){_0x4cc1c1=_0x4cc1c1-0x0;var _0x483778=_0xb10b[_0x4cc1c1];return _0x483778;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var Notification=require('../../mysqldb')['db'][_0xbb10('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){NotificationEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);NotificationEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];Notification[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 4fe105e..9181929 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 _0x157a=['./notification.attributes','define','Notification','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','rimraf'];(function(_0x439809,_0x3bc7bf){var _0x48e2ba=function(_0x2bfadd){while(--_0x2bfadd){_0x439809['push'](_0x439809['shift']());}};_0x48e2ba(++_0x3bc7bf);}(_0x157a,0x192));var _0xa157=function(_0x5c7fd9,_0x189d2b){_0x5c7fd9=_0x5c7fd9-0x0;var _0x5a79b3=_0x157a[_0x5c7fd9];return _0x5a79b3;};'use strict';var _=require(_0xa157('0x0'));var util=require(_0xa157('0x1'));var logger=require('../../config/logger')(_0xa157('0x2'));var moment=require('moment');var BPromise=require(_0xa157('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa157('0x4'));var config=require('../../config/environment');var attributes=require(_0xa157('0x5'));module['exports']=function(_0x4f6092,_0x1da710){return _0x4f6092[_0xa157('0x6')](_0xa157('0x7'),attributes,{'tableName':_0xa157('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa157('0x9'),'collate':_0xa157('0xa')});}; \ No newline at end of file +var _0x2131=['define','notifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','rimraf','../../config/environment','./notification.attributes','exports'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x2131,0x88));var _0x1213=function(_0x5be1ac,_0x5ee1f4){_0x5be1ac=_0x5be1ac-0x0;var _0x21b996=_0x2131[_0x5be1ac];return _0x21b996;};'use strict';var _=require(_0x1213('0x0'));var util=require(_0x1213('0x1'));var logger=require('../../config/logger')(_0x1213('0x2'));var moment=require('moment');var BPromise=require(_0x1213('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1213('0x4'));var config=require(_0x1213('0x5'));var attributes=require(_0x1213('0x6'));module[_0x1213('0x7')]=function(_0x488049,_0x2167d9){return _0x488049[_0x1213('0x8')]('Notification',attributes,{'tableName':_0x1213('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1213('0xa'),'collate':_0x1213('0xb')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index f1018eb..d9d6ae0 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 _0x416f=['util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./notification.socket','register','then','request\x20sent','debug','stringify','error','Notification,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x176dd3,_0xc48e33){var _0x120391=function(_0x460627){while(--_0x460627){_0x176dd3['push'](_0x176dd3['shift']());}};_0x120391(++_0xc48e33);}(_0x416f,0x17f));var _0xf416=function(_0x4eb8a0,_0x526747){_0x4eb8a0=_0x4eb8a0-0x0;var _0x33f53a=_0x416f[_0x4eb8a0];return _0x33f53a;};'use strict';var _=require(_0xf416('0x0'));var util=require(_0xf416('0x1'));var moment=require(_0xf416('0x2'));var BPromise=require(_0xf416('0x3'));var rs=require(_0xf416('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf416('0x5'));var logger=require('../../config/logger')(_0xf416('0x6'));var config=require(_0xf416('0x7'));var jayson=require(_0xf416('0x8'));var client=jayson[_0xf416('0x9')][_0xf416('0xa')]({'port':0x232a});config['redis']=_[_0xf416('0xb')](config[_0xf416('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf416('0xc')]));require(_0xf416('0xd'))[_0xf416('0xe')](socket);function respondWithRpcPromise(_0x4e9b2d,_0x5a1f7d,_0x439feb){return new BPromise(function(_0x4dd9b3,_0x4bb27e){return client['request'](_0x4e9b2d,_0x439feb)[_0xf416('0xf')](function(_0x236d6e){logger['info']('Notification,\x20%s,\x20%s',_0x5a1f7d,_0xf416('0x10'));logger[_0xf416('0x11')]('Notification,\x20%s,\x20%s,\x20%s',_0x5a1f7d,_0xf416('0x10'),JSON[_0xf416('0x12')](_0x236d6e));if(_0x236d6e[_0xf416('0x13')]){if(_0x236d6e[_0xf416('0x13')]['code']===0x1f4){logger[_0xf416('0x13')](_0xf416('0x14'),_0x5a1f7d,_0x236d6e[_0xf416('0x13')]['message']);return _0x4bb27e(_0x236d6e[_0xf416('0x13')][_0xf416('0x15')]);}logger[_0xf416('0x13')](_0xf416('0x14'),_0x5a1f7d,_0x236d6e[_0xf416('0x13')][_0xf416('0x15')]);return _0x4dd9b3(_0x236d6e['error'][_0xf416('0x15')]);}else{logger['info'](_0xf416('0x14'),_0x5a1f7d,_0xf416('0x10'));_0x4dd9b3(_0x236d6e[_0xf416('0x16')][_0xf416('0x15')]);}})[_0xf416('0x17')](function(_0x556e79){logger[_0xf416('0x13')](_0xf416('0x14'),_0x5a1f7d,_0x556e79);_0x4bb27e(_0x556e79);});});} \ No newline at end of file +var _0x54dc=['request\x20sent','stringify','code','error','message','Notification,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','./notification.socket','register','request','then','info','debug','Notification,\x20%s,\x20%s,\x20%s'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0x54dc,0x15a));var _0xc54d=function(_0x147f22,_0x3fb477){_0x147f22=_0x147f22-0x0;var _0x480aec=_0x54dc[_0x147f22];return _0x480aec;};'use strict';var _=require(_0xc54d('0x0'));var util=require(_0xc54d('0x1'));var moment=require(_0xc54d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc54d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc54d('0x4'))(_0xc54d('0x5'));var config=require('../../config/environment');var jayson=require(_0xc54d('0x6'));var client=jayson[_0xc54d('0x7')]['http']({'port':0x232a});config['redis']=_[_0xc54d('0x8')](config[_0xc54d('0x9')],{'host':_0xc54d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc54d('0x9')]));require(_0xc54d('0xb'))[_0xc54d('0xc')](socket);function respondWithRpcPromise(_0x831b4f,_0x45c18b,_0x1b0b13){return new BPromise(function(_0x4edccd,_0x36a1f1){return client[_0xc54d('0xd')](_0x831b4f,_0x1b0b13)[_0xc54d('0xe')](function(_0xee7692){logger[_0xc54d('0xf')]('Notification,\x20%s,\x20%s',_0x45c18b,'request\x20sent');logger[_0xc54d('0x10')](_0xc54d('0x11'),_0x45c18b,_0xc54d('0x12'),JSON[_0xc54d('0x13')](_0xee7692));if(_0xee7692['error']){if(_0xee7692['error'][_0xc54d('0x14')]===0x1f4){logger[_0xc54d('0x15')]('Notification,\x20%s,\x20%s',_0x45c18b,_0xee7692[_0xc54d('0x15')]['message']);return _0x36a1f1(_0xee7692[_0xc54d('0x15')][_0xc54d('0x16')]);}logger[_0xc54d('0x15')](_0xc54d('0x17'),_0x45c18b,_0xee7692['error']['message']);return _0x4edccd(_0xee7692[_0xc54d('0x15')][_0xc54d('0x16')]);}else{logger[_0xc54d('0xf')](_0xc54d('0x17'),_0x45c18b,_0xc54d('0x12'));_0x4edccd(_0xee7692[_0xc54d('0x18')][_0xc54d('0x16')]);}})[_0xc54d('0x19')](function(_0x27e7c0){logger['error'](_0xc54d('0x17'),_0x45c18b,_0x27e7c0);_0x36a1f1(_0x27e7c0);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 987c122..c200b88 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 _0x62e3=['length','notification:','./notification.events','save','remove','update','emit','removeListener','register'];(function(_0x33ba78,_0xbcaa2d){var _0x24a8a8=function(_0x2c25f5){while(--_0x2c25f5){_0x33ba78['push'](_0x33ba78['shift']());}};_0x24a8a8(++_0xbcaa2d);}(_0x62e3,0x89));var _0x362e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62e3[_0x3dd15e];return _0x231fd0;};'use strict';var NotificationEvents=require(_0x362e('0x0'));var events=[_0x362e('0x1'),_0x362e('0x2'),_0x362e('0x3')];function createListener(_0x25f68d,_0x4a0909){return function(_0x2bc6ae){_0x4a0909[_0x362e('0x4')](_0x25f68d,_0x2bc6ae);};}function removeListener(_0x5acaa4,_0x4c18d0){return function(){NotificationEvents[_0x362e('0x5')](_0x5acaa4,_0x4c18d0);};}exports[_0x362e('0x6')]=function(_0x5946c3){for(var _0x17f87a=0x0,_0x32adb9=events[_0x362e('0x7')];_0x17f87a<_0x32adb9;_0x17f87a++){var _0x10b21d=events[_0x17f87a];var _0x2299c1=createListener(_0x362e('0x8')+_0x10b21d,_0x5946c3);NotificationEvents['on'](_0x10b21d,_0x2299c1);}}; \ No newline at end of file +var _0x770d=['length','notification:','./notification.events','save','remove','emit','removeListener','register'];(function(_0x2be1ab,_0x2fe1fc){var _0x4c616d=function(_0x16dfc8){while(--_0x16dfc8){_0x2be1ab['push'](_0x2be1ab['shift']());}};_0x4c616d(++_0x2fe1fc);}(_0x770d,0x13a));var _0xd770=function(_0x57a870,_0x351cef){_0x57a870=_0x57a870-0x0;var _0x40662c=_0x770d[_0x57a870];return _0x40662c;};'use strict';var NotificationEvents=require(_0xd770('0x0'));var events=[_0xd770('0x1'),_0xd770('0x2'),'update'];function createListener(_0x59132d,_0xb8c90f){return function(_0xc8ddaa){_0xb8c90f[_0xd770('0x3')](_0x59132d,_0xc8ddaa);};}function removeListener(_0x23a656,_0x331185){return function(){NotificationEvents[_0xd770('0x4')](_0x23a656,_0x331185);};}exports[_0xd770('0x5')]=function(_0x2fcb39){for(var _0x414890=0x0,_0x5f4db3=events[_0xd770('0x6')];_0x414890<_0x5f4db3;_0x414890++){var _0x3dbcdd=events[_0x414890];var _0x48fbbe=createListener(_0xd770('0x7')+_0x3dbcdd,_0x2fcb39);NotificationEvents['on'](_0x3dbcdd,_0x48fbbe);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index e923f6d..ea3605d 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 _0x9cc5=['../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','get','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','/:id/notify','notify','/:id/send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3bbca4,_0x3c3f6f){var _0x480130=function(_0x29332d){while(--_0x29332d){_0x3bbca4['push'](_0x3bbca4['shift']());}};_0x480130(++_0x3c3f6f);}(_0x9cc5,0x91));var _0x59cc=function(_0x3ff30b,_0x5bd2c8){_0x3ff30b=_0x3ff30b-0x0;var _0x3b5be1=_0x9cc5[_0x3ff30b];return _0x3b5be1;};'use strict';var multer=require(_0x59cc('0x0'));var util=require(_0x59cc('0x1'));var path=require(_0x59cc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59cc('0x3')]();var auth=require(_0x59cc('0x4'));var interaction=require(_0x59cc('0x5'));var config=require('../../config/environment');var controller=require(_0x59cc('0x6'));router['get']('/',auth[_0x59cc('0x7')](),controller['index']);router[_0x59cc('0x8')](_0x59cc('0x9'),auth[_0x59cc('0x7')](),controller[_0x59cc('0xa')]);router['get'](_0x59cc('0xb'),auth[_0x59cc('0x7')](),controller['show']);router[_0x59cc('0x8')](_0x59cc('0xc'),auth[_0x59cc('0x7')](),controller['getDispositions']);router[_0x59cc('0x8')](_0x59cc('0xd'),auth[_0x59cc('0x7')](),controller[_0x59cc('0xe')]);router[_0x59cc('0x8')](_0x59cc('0xf'),auth[_0x59cc('0x7')](),controller[_0x59cc('0x10')]);router[_0x59cc('0x8')](_0x59cc('0x11'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x59cc('0x12'),auth[_0x59cc('0x7')](),controller[_0x59cc('0x13')]);router[_0x59cc('0x14')]('/',auth[_0x59cc('0x7')](),controller['create']);router[_0x59cc('0x14')]('/:id/dispositions',auth[_0x59cc('0x7')](),controller['addDisposition']);router[_0x59cc('0x14')](_0x59cc('0xd'),auth[_0x59cc('0x7')](),controller['addAnswer']);router[_0x59cc('0x14')](_0x59cc('0x15'),controller[_0x59cc('0x16')]);router[_0x59cc('0x14')](_0x59cc('0xf'),auth['isAuthenticated'](),controller['addApplications']);router[_0x59cc('0x14')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x59cc('0x14')](_0x59cc('0x17'),auth[_0x59cc('0x7')](),controller['send']);router['put']('/:id',auth[_0x59cc('0x7')](),controller[_0x59cc('0x18')]);router['delete'](_0x59cc('0xb'),auth[_0x59cc('0x7')](),controller['destroy']);router[_0x59cc('0x19')](_0x59cc('0xc'),auth[_0x59cc('0x7')](),controller[_0x59cc('0x1a')]);router['delete'](_0x59cc('0xd'),auth['isAuthenticated'](),controller[_0x59cc('0x1b')]);router[_0x59cc('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x59cc('0x1c')]);module[_0x59cc('0x1d')]=router; \ No newline at end of file +var _0x7e2b=['removeAnswers','removeAgents','multer','path','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions'];(function(_0x1285cd,_0x5f322a){var _0x53f3af=function(_0x55a976){while(--_0x55a976){_0x1285cd['push'](_0x1285cd['shift']());}};_0x53f3af(++_0x5f322a);}(_0x7e2b,0x13a));var _0xb7e2=function(_0x454e59,_0x29181d){_0x454e59=_0x454e59-0x0;var _0x34b913=_0x7e2b[_0x454e59];return _0x34b913;};'use strict';var multer=require(_0xb7e2('0x0'));var util=require('util');var path=require(_0xb7e2('0x1'));var timeout=require('connect-timeout');var express=require(_0xb7e2('0x2'));var router=express[_0xb7e2('0x3')]();var auth=require(_0xb7e2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb7e2('0x5'));var controller=require(_0xb7e2('0x6'));router['get']('/',auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x8')]);router[_0xb7e2('0x9')](_0xb7e2('0xa'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0xb')]);router['get'](_0xb7e2('0xc'),auth[_0xb7e2('0x7')](),controller['show']);router['get'](_0xb7e2('0xd'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0xe')]);router[_0xb7e2('0x9')](_0xb7e2('0xf'),auth[_0xb7e2('0x7')](),controller['getAnswers']);router['get'](_0xb7e2('0x10'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x11')]);router[_0xb7e2('0x9')](_0xb7e2('0x12'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x13')]);router['get']('/:id/users',auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x14')]);router[_0xb7e2('0x15')]('/',auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x16')]);router['post'](_0xb7e2('0xd'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x17')]);router[_0xb7e2('0x15')](_0xb7e2('0xf'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x18')]);router[_0xb7e2('0x15')](_0xb7e2('0x19'),controller[_0xb7e2('0x1a')]);router['post'](_0xb7e2('0x10'),auth['isAuthenticated'](),controller[_0xb7e2('0x1b')]);router[_0xb7e2('0x15')](_0xb7e2('0x1c'),auth['isAuthenticated'](),controller[_0xb7e2('0x1d')]);router[_0xb7e2('0x15')](_0xb7e2('0x1e'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x1f')]);router[_0xb7e2('0x20')](_0xb7e2('0xc'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x21')]);router[_0xb7e2('0x22')](_0xb7e2('0xc'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x23')]);router[_0xb7e2('0x22')](_0xb7e2('0xd'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x24')]);router['delete'](_0xb7e2('0xf'),auth['isAuthenticated'](),controller[_0xb7e2('0x25')]);router[_0xb7e2('0x22')](_0xb7e2('0x1c'),auth[_0xb7e2('0x7')](),controller[_0xb7e2('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 68584f3..e49491a 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 _0x7e44=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','TEXT'];(function(_0x2ff359,_0x173237){var _0x15df72=function(_0x5994fa){while(--_0x5994fa){_0x2ff359['push'](_0x2ff359['shift']());}};_0x15df72(++_0x173237);}(_0x7e44,0xbc));var _0x47e4=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x7e44[_0x1cb18a];return _0x22442e;};'use strict';var Sequelize=require(_0x47e4('0x0'));var rs=require(_0x47e4('0x1'));module[_0x47e4('0x2')]={'name':{'type':Sequelize[_0x47e4('0x3')],'unique':_0x47e4('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x47e4('0x3')]},'token':{'type':Sequelize[_0x47e4('0x3')],'defaultValue':function(){return rs[_0x47e4('0x5')]();}},'replyUri':{'type':Sequelize[_0x47e4('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x47e4('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x47e4('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x47e4('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x47e4('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x47e4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x47e4('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x47e4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x47e4('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x47e4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x47e4('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x47e4('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x47e4('0x7')],'defaultValue':![],'comment':_0x47e4('0xa'),'set':function(_0x2ba4c3){if(!_0x2ba4c3)this[_0x47e4('0xb')](_0x47e4('0xc'),null);this[_0x47e4('0xb')]('mandatoryDisposition',_0x2ba4c3);}}}; \ No newline at end of file +var _0xdb34=['generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x7e3e6d,_0x36e97f){var _0x140b0e=function(_0x32f6a2){while(--_0x32f6a2){_0x7e3e6d['push'](_0x7e3e6d['shift']());}};_0x140b0e(++_0x36e97f);}(_0xdb34,0x1bb));var _0x4db3=function(_0x33523b,_0xaf579f){_0x33523b=_0x33523b-0x0;var _0x36f573=_0xdb34[_0x33523b];return _0x36f573;};'use strict';var Sequelize=require(_0x4db3('0x0'));var rs=require(_0x4db3('0x1'));module[_0x4db3('0x2')]={'name':{'type':Sequelize[_0x4db3('0x3')],'unique':_0x4db3('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x4db3('0x3')]},'token':{'type':Sequelize[_0x4db3('0x3')],'defaultValue':function(){return rs[_0x4db3('0x5')]();}},'replyUri':{'type':Sequelize[_0x4db3('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4db3('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4db3('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x4db3('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4db3('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4db3('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4db3('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x4db3('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x4db3('0x7')],'defaultValue':![],'comment':_0x4db3('0xa'),'set':function(_0x1c33b4){if(!_0x1c33b4)this[_0x4db3('0xb')](_0x4db3('0xc'),null);this['setDataValue'](_0x4db3('0xd'),_0x1c33b4);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3faa362..a4166c5 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 _0x86d1=['fullname','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','offset','limit','status','Content-Range','reject','update','destroy','UserProfileResource','end','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','mandatoryDispositionPause','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','params','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','order','count','ids','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','updatedAt','difference','createdAt','ListId','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','CmList','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','created','interaction','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner'];(function(_0x53e0bc,_0x35dbab){var _0x279e3d=function(_0xc1d2e0){while(--_0xc1d2e0){_0x53e0bc['push'](_0x53e0bc['shift']());}};_0x279e3d(++_0x35dbab);}(_0x86d1,0xcf));var _0x186d=function(_0x5b3e62,_0x2b3776){_0x5b3e62=_0x5b3e62-0x0;var _0x274983=_0x86d1[_0x5b3e62];return _0x274983;};'use strict';var pdf=require(_0x186d('0x0'));var emlformat=require(_0x186d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x186d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x186d('0x3'));var moment=require(_0x186d('0x4'));var BPromise=require(_0x186d('0x5'));var Mustache=require('mustache');var util=require(_0x186d('0x6'));var path=require(_0x186d('0x7'));var sox=require(_0x186d('0x8'));var csv=require(_0x186d('0x9'));var ejs=require(_0x186d('0xa'));var fs=require('fs');var _=require(_0x186d('0xb'));var squel=require(_0x186d('0xc'));var crypto=require(_0x186d('0xd'));var jsforce=require(_0x186d('0xe'));var deskjs=require(_0x186d('0xf'));var toCsv=require(_0x186d('0x9'));var querystring=require('querystring');var Papa=require(_0x186d('0x10'));var Redis=require(_0x186d('0x11'));var authService=require(_0x186d('0x12'));var qs=require(_0x186d('0x13'));var as=require(_0x186d('0x14'));var hardwareService=require(_0x186d('0x15'));var logger=require(_0x186d('0x16'))(_0x186d('0x17'));var utils=require(_0x186d('0x18'));var config=require(_0x186d('0x19'));var db=require(_0x186d('0x1a'))['db'];config['redis']=_[_0x186d('0x1b')](config[_0x186d('0x1c')],{'host':_0x186d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x186d('0x1c')]));require(_0x186d('0x1e'))[_0x186d('0x1f')](socket);var jayson=require(_0x186d('0x20'));var client=jayson[_0x186d('0x21')][_0x186d('0x22')]({'port':0x232c});var client9002=jayson[_0x186d('0x21')]['http']({'port':0x232a});function checkPasswordPattern(_0x2707e9,_0x21e7f7,_0x3e801c){if(_0x3e801c){var _0x2bb15d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2bb15d[_0x186d('0x23')](_0x21e7f7)){return _0x2707e9;}else{throw new db['Sequelize'][(_0x186d('0x24'))](_0x186d('0x25'));}}else{return _0x2707e9;}}function respondWithRpcPromise(_0x59e154,_0x4c66c1,_0x4e0f44,_0x5aa173){return new BPromise(function(_0x48ea30,_0x70bae0){var _0xaa1d58=_0x5aa173||client;return _0xaa1d58[_0x186d('0x26')](_0x59e154,_0x4e0f44)[_0x186d('0x27')](function(_0x58402d){logger[_0x186d('0x28')](_0x186d('0x29'),_0x4c66c1,_0x186d('0x2a'));logger['debug'](_0x186d('0x2b'),_0x4c66c1,_0x186d('0x2a'),JSON['stringify'](_0x58402d));if(_0x58402d[_0x186d('0x2c')]){if(_0x58402d[_0x186d('0x2c')][_0x186d('0x2d')]===0x1f4){logger[_0x186d('0x2c')]('OpenchannelAccount,\x20%s,\x20%s',_0x4c66c1,_0x58402d[_0x186d('0x2c')][_0x186d('0x2e')]);return _0x70bae0(_0x58402d[_0x186d('0x2c')]['message']);}logger[_0x186d('0x2c')](_0x186d('0x29'),_0x4c66c1,_0x58402d[_0x186d('0x2c')][_0x186d('0x2e')]);return _0x48ea30(_0x58402d[_0x186d('0x2c')][_0x186d('0x2e')]);}else{logger[_0x186d('0x28')](_0x186d('0x29'),_0x4c66c1,_0x186d('0x2a'));_0x48ea30(_0x58402d[_0x186d('0x2f')]['message']);}})['catch'](function(_0x562d83){logger[_0x186d('0x2c')](_0x186d('0x29'),_0x4c66c1,_0x562d83);_0x70bae0(_0x562d83);});});}function respondWithStatusCode(_0x147417,_0x148795){_0x148795=_0x148795||0xcc;return function(_0x386d32){if(_0x386d32){return _0x147417[_0x186d('0x30')](_0x148795);}return _0x147417['status'](_0x148795)['end']();};}function respondWithResult(_0x5db47f,_0x1eb4a2){_0x1eb4a2=_0x1eb4a2||0xc8;return function(_0xdc1af0){if(_0xdc1af0){return _0x5db47f['status'](_0x1eb4a2)['json'](_0xdc1af0);}};}function respondWithFilteredResult(_0x179fea,_0x243ea6){return function(_0x141e1c){if(_0x141e1c){var _0x4627b1=_0x141e1c['count'],_0x430485=_0x243ea6['offset'],_0x10e8e2=_0x243ea6[_0x186d('0x31')]+_0x243ea6[_0x186d('0x32')],_0x9aa67c;if(_0x10e8e2>=_0x4627b1){_0x10e8e2=_0x4627b1;_0x9aa67c=0xc8;}else{_0x9aa67c=0xce;}_0x179fea[_0x186d('0x33')](_0x9aa67c);return _0x179fea['set'](_0x186d('0x34'),_0x430485+'-'+_0x10e8e2+'/'+_0x4627b1)['json'](_0x141e1c);}return null;};}function patchUpdates(_0x159893){return function(_0x3ea44c){try{jsonpatch['apply'](_0x3ea44c,_0x159893,!![]);}catch(_0x1f7f1a){return BPromise[_0x186d('0x35')](_0x1f7f1a);}return _0x3ea44c['save']();};}function saveUpdates(_0x1665c3,_0x13e7b2){return function(_0x44507e){if(_0x44507e){return _0x44507e[_0x186d('0x36')](_0x1665c3)[_0x186d('0x27')](function(_0x3b9d37){return _0x3b9d37;});}return null;};}function removeEntity(_0x5b93bf,_0x57f442){return function(_0x5d0709){if(_0x5d0709){return _0x5d0709[_0x186d('0x37')]()['then'](function(){var _0x40fbb4=_0x5d0709['get']({'plain':!![]});var _0x500fd2='OpenchannelAccounts';return db[_0x186d('0x38')]['destroy']({'where':{'type':_0x500fd2,'resourceId':_0x40fbb4['id']}})[_0x186d('0x27')](function(){return _0x5d0709;});})[_0x186d('0x27')](function(){_0x5b93bf['status'](0xcc)[_0x186d('0x39')]();});}};}function handleEntityNotFound(_0x55997,_0x1d922f){return function(_0x4b8faf){if(!_0x4b8faf){_0x55997[_0x186d('0x30')](0x194);}return _0x4b8faf;};}function handleError(_0x1c6d98,_0x1431f2){_0x1431f2=_0x1431f2||0x1f4;return function(_0x2334a0){logger[_0x186d('0x2c')](_0x2334a0[_0x186d('0x3a')]);if(_0x2334a0[_0x186d('0x3b')]){delete _0x2334a0[_0x186d('0x3b')];}_0x1c6d98[_0x186d('0x33')](_0x1431f2)[_0x186d('0x3c')](_0x2334a0);};}exports[_0x186d('0x3d')]=function(_0x2cfaae,_0x484ab4){var _0x5b535f={'include':[{'model':db[_0x186d('0x3e')],'as':'mandatoryDispositionPause'}]},_0x2b6c00={},_0xd98896={'count':0x0,'rows':[]};var _0x6f2eb3=_[_0x186d('0x3f')](db[_0x186d('0x40')][_0x186d('0x41')],function(_0x32957e){return{'name':_0x32957e[_0x186d('0x42')],'type':_0x32957e[_0x186d('0x43')][_0x186d('0x44')]};});_0x2b6c00['model']=_[_0x186d('0x3f')](_0x6f2eb3,_0x186d('0x3b'));_0x2b6c00[_0x186d('0x45')]=_[_0x186d('0x46')](_0x2cfaae[_0x186d('0x45')]);_0x2b6c00[_0x186d('0x47')]=_[_0x186d('0x48')](_0x2b6c00['model'],_0x2b6c00[_0x186d('0x45')]);_0x5b535f['attributes']=_[_0x186d('0x48')](_0x2b6c00[_0x186d('0x49')],qs['fields'](_0x2cfaae[_0x186d('0x45')][_0x186d('0x4a')]));_0x5b535f[_0x186d('0x4b')]=_0x5b535f[_0x186d('0x4b')][_0x186d('0x4c')]?_0x5b535f['attributes']:_0x2b6c00[_0x186d('0x49')];if(!_0x2cfaae[_0x186d('0x45')][_0x186d('0x4d')]('nolimit')){_0x5b535f[_0x186d('0x32')]=qs[_0x186d('0x32')](_0x2cfaae[_0x186d('0x45')][_0x186d('0x32')]);_0x5b535f[_0x186d('0x31')]=qs[_0x186d('0x31')](_0x2cfaae[_0x186d('0x45')][_0x186d('0x31')]);}_0x5b535f['order']=qs[_0x186d('0x4e')](_0x2cfaae[_0x186d('0x45')][_0x186d('0x4e')]);_0x5b535f[_0x186d('0x4f')]=qs['filters'](_[_0x186d('0x50')](_0x2cfaae[_0x186d('0x45')],_0x2b6c00[_0x186d('0x47')]),_0x6f2eb3);if(_0x2cfaae['query'][_0x186d('0x51')]){_0x5b535f[_0x186d('0x4f')]=_[_0x186d('0x52')](_0x5b535f[_0x186d('0x4f')],{'$or':_['map'](_0x6f2eb3,function(_0x2aa387){if(_0x2aa387[_0x186d('0x43')]!=='VIRTUAL'){var _0x405473={};_0x405473[_0x2aa387[_0x186d('0x3b')]]={'$like':'%'+_0x2cfaae[_0x186d('0x45')][_0x186d('0x51')]+'%'};return _0x405473;}})});}_0x5b535f=_['merge']({},_0x5b535f,_0x2cfaae[_0x186d('0x53')]);var _0xf2eca7={'where':_0x5b535f['where']};return db[_0x186d('0x40')]['count'](_0xf2eca7)[_0x186d('0x27')](function(_0x2fdf98){_0xd98896['count']=_0x2fdf98;if(_0x2cfaae[_0x186d('0x45')][_0x186d('0x54')]){_0x5b535f[_0x186d('0x55')]=[{'all':!![]}];}return db[_0x186d('0x40')][_0x186d('0x56')](_0x5b535f);})['then'](function(_0x1c3215){_0xd98896[_0x186d('0x57')]=_0x1c3215;return _0xd98896;})[_0x186d('0x27')](respondWithFilteredResult(_0x484ab4,_0x5b535f))['catch'](handleError(_0x484ab4,null));};exports['show']=function(_0x32e08d,_0x5e9f10){var _0x4ddcde={'raw':![],'where':{'id':_0x32e08d['params']['id']},'include':[{'model':db[_0x186d('0x3e')],'as':_0x186d('0x58')}]},_0x1251e8={};_0x1251e8['model']=_[_0x186d('0x46')](db[_0x186d('0x40')][_0x186d('0x41')]);_0x1251e8['query']=_['keys'](_0x32e08d['query']);_0x1251e8[_0x186d('0x47')]=_['intersection'](_0x1251e8['model'],_0x1251e8[_0x186d('0x45')]);_0x4ddcde[_0x186d('0x4b')]=_[_0x186d('0x48')](_0x1251e8[_0x186d('0x49')],qs['fields'](_0x32e08d[_0x186d('0x45')][_0x186d('0x4a')]));_0x4ddcde[_0x186d('0x4b')]=_0x4ddcde[_0x186d('0x4b')][_0x186d('0x4c')]?_0x4ddcde[_0x186d('0x4b')]:_0x1251e8[_0x186d('0x49')];if(_0x32e08d[_0x186d('0x45')]['includeAll']){_0x4ddcde[_0x186d('0x55')]=[{'all':!![]}];}_0x4ddcde=_[_0x186d('0x52')]({},_0x4ddcde,_0x32e08d[_0x186d('0x53')]);return db[_0x186d('0x40')][_0x186d('0x59')](_0x4ddcde)[_0x186d('0x27')](handleEntityNotFound(_0x5e9f10,null))[_0x186d('0x27')](respondWithResult(_0x5e9f10,null))[_0x186d('0x5a')](handleError(_0x5e9f10,null));};exports[_0x186d('0x5b')]=function(_0x15886d,_0x32a79d){return db[_0x186d('0x40')]['create'](_0x15886d['body'],{})[_0x186d('0x27')](function(_0xfbdb7b){var _0x3bf2aa=_0x15886d[_0x186d('0x5c')][_0x186d('0x5d')]({'plain':!![]});if(!_0x3bf2aa)throw new Error(_0x186d('0x5e'));if(_0x3bf2aa[_0x186d('0x5f')]===_0x186d('0x5c')){var _0x4e9d89=_0xfbdb7b[_0x186d('0x5d')]({'plain':!![]});var _0xaa2127='OpenchannelAccounts';return db[_0x186d('0x60')][_0x186d('0x59')]({'where':{'name':_0xaa2127,'userProfileId':_0x3bf2aa[_0x186d('0x61')]},'raw':!![]})[_0x186d('0x27')](function(_0x268814){if(_0x268814&&_0x268814['autoAssociation']===0x0){return db[_0x186d('0x38')]['create']({'name':_0x4e9d89[_0x186d('0x3b')],'resourceId':_0x4e9d89['id'],'type':_0x268814[_0x186d('0x3b')],'sectionId':_0x268814['id']},{})['then'](function(){return _0xfbdb7b;});}else{return _0xfbdb7b;}})[_0x186d('0x5a')](function(_0xf95325){logger[_0x186d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf95325);throw _0xf95325;});}return _0xfbdb7b;})[_0x186d('0x27')](respondWithResult(_0x32a79d,0xc9))[_0x186d('0x5a')](handleError(_0x32a79d,null));};exports[_0x186d('0x36')]=function(_0x21eca9,_0x3732db){if(_0x21eca9['body']['id']){delete _0x21eca9[_0x186d('0x62')]['id'];}return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0x21eca9[_0x186d('0x63')]['id']},'include':[{'model':db[_0x186d('0x3e')],'as':_0x186d('0x58')}]})[_0x186d('0x27')](handleEntityNotFound(_0x3732db,null))[_0x186d('0x27')](saveUpdates(_0x21eca9[_0x186d('0x62')],null))['then'](respondWithResult(_0x3732db,null))[_0x186d('0x5a')](handleError(_0x3732db,null));};exports[_0x186d('0x37')]=function(_0xc7fcd4,_0x3f19b8){return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0xc7fcd4['params']['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x3f19b8,null))[_0x186d('0x27')](removeEntity(_0x3f19b8,null))[_0x186d('0x5a')](handleError(_0x3f19b8,null));};exports[_0x186d('0x64')]=function(_0x2a6aac,_0x25ae2e){return db[_0x186d('0x40')][_0x186d('0x64')]()[_0x186d('0x27')](respondWithResult(_0x25ae2e,null))[_0x186d('0x5a')](handleError(_0x25ae2e,null));};exports[_0x186d('0x65')]=function(_0x27ffcf,_0x4ff247,_0xb7b2de){if(_0x27ffcf[_0x186d('0x62')]['id']){delete _0x27ffcf['body']['id'];}return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0x27ffcf['params']['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x4ff247,null))[_0x186d('0x27')](function(_0x24455d){if(_0x24455d){_0x27ffcf[_0x186d('0x62')]['OpnechannelAccountId']=_0x24455d['id'];return db[_0x186d('0x66')][_0x186d('0x5b')](_0x27ffcf[_0x186d('0x62')]);}})['then'](respondWithResult(_0x4ff247,null))[_0x186d('0x5a')](handleError(_0x4ff247,null));};exports[_0x186d('0x67')]=function(_0x3ad025,_0x59091c,_0x53c510){var _0x1f4f6a={'raw':![],'where':{}};var _0x3514e3={};var _0x5ad346={'count':0x0,'rows':[]};return db[_0x186d('0x40')][_0x186d('0x68')]({'where':{'id':_0x3ad025[_0x186d('0x63')]['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x59091c,null))['then'](function(_0x1161b9){if(_0x1161b9){_0x3514e3['model']=_[_0x186d('0x46')](db[_0x186d('0x66')][_0x186d('0x41')]);_0x3514e3['query']=_[_0x186d('0x46')](_0x3ad025[_0x186d('0x45')]);_0x3514e3['filters']=_[_0x186d('0x48')](_0x3514e3[_0x186d('0x49')],_0x3514e3[_0x186d('0x45')]);_0x1f4f6a['attributes']=_[_0x186d('0x48')](_0x3514e3[_0x186d('0x49')],qs[_0x186d('0x4a')](_0x3ad025['query']['fields']));_0x1f4f6a[_0x186d('0x4b')]=_0x1f4f6a[_0x186d('0x4b')]['length']?_0x1f4f6a[_0x186d('0x4b')]:_0x3514e3[_0x186d('0x49')];if(!_0x3ad025[_0x186d('0x45')][_0x186d('0x4d')](_0x186d('0x69'))){_0x1f4f6a[_0x186d('0x32')]=qs[_0x186d('0x32')](_0x3ad025[_0x186d('0x45')][_0x186d('0x32')]);_0x1f4f6a['offset']=qs['offset'](_0x3ad025[_0x186d('0x45')][_0x186d('0x31')]);}_0x1f4f6a[_0x186d('0x6a')]=qs[_0x186d('0x4e')](_0x3ad025['query']['sort']);_0x1f4f6a['where']=qs['filters'](_[_0x186d('0x50')](_0x3ad025['query'],_0x3514e3['filters']));_0x1f4f6a[_0x186d('0x4f')]['OpenchannelAccountId']=_0x1161b9['id'];if(_0x3ad025[_0x186d('0x45')][_0x186d('0x51')]){_0x1f4f6a[_0x186d('0x4f')]=_[_0x186d('0x52')](_0x1f4f6a[_0x186d('0x4f')],{'$or':_['map'](_0x1f4f6a[_0x186d('0x4b')],function(_0x469682){var _0x3efaab={};_0x3efaab[_0x469682]={'$like':'%'+_0x3ad025[_0x186d('0x45')][_0x186d('0x51')]+'%'};return _0x3efaab;})});}_0x1f4f6a=_[_0x186d('0x52')]({},_0x1f4f6a,_0x3ad025[_0x186d('0x53')]);return db[_0x186d('0x66')][_0x186d('0x6b')]({'where':_0x1f4f6a[_0x186d('0x4f')]})[_0x186d('0x27')](function(_0x196f34){_0x5ad346['count']=_0x196f34;if(_0x3ad025[_0x186d('0x45')][_0x186d('0x54')]){_0x1f4f6a[_0x186d('0x55')]=[{'all':!![]}];}return db[_0x186d('0x66')][_0x186d('0x56')](_0x1f4f6a);})[_0x186d('0x27')](function(_0x90ff1a){_0x5ad346[_0x186d('0x57')]=_0x90ff1a;return _0x5ad346;});}})[_0x186d('0x27')](respondWithFilteredResult(_0x59091c,_0x1f4f6a))[_0x186d('0x5a')](handleError(_0x59091c,null));};exports['removeDispositions']=function(_0x50321b,_0x1ce21a,_0x29c796){return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0x50321b[_0x186d('0x63')]['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x1ce21a,null))[_0x186d('0x27')](function(_0x2ab254){if(_0x2ab254){return _0x2ab254['removeDispositions'](_0x50321b[_0x186d('0x45')][_0x186d('0x6c')]);}})[_0x186d('0x27')](respondWithStatusCode(_0x1ce21a,null))[_0x186d('0x5a')](handleError(_0x1ce21a,null));};exports['addAnswer']=function(_0x144b48,_0x5178b3,_0x43e808){if(_0x144b48[_0x186d('0x62')]['id']){delete _0x144b48[_0x186d('0x62')]['id'];}return db['OpenchannelAccount'][_0x186d('0x59')]({'where':{'id':_0x144b48[_0x186d('0x63')]['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x5178b3,null))['then'](function(_0x5d241c){if(_0x5d241c){_0x144b48['body'][_0x186d('0x6d')]=_0x5d241c['id'];return db[_0x186d('0x6e')]['create'](_0x144b48[_0x186d('0x62')]);}})[_0x186d('0x27')](respondWithResult(_0x5178b3,null))[_0x186d('0x5a')](handleError(_0x5178b3,null));};exports[_0x186d('0x6f')]=function(_0x69074a,_0x1ca120,_0x3f0736){var _0x36fbf6={'raw':![],'where':{}};var _0x3881f4={};var _0x50fad5={'count':0x0,'rows':[]};return db[_0x186d('0x40')]['findOne']({'where':{'id':_0x69074a['params']['id']}})['then'](handleEntityNotFound(_0x1ca120,null))[_0x186d('0x27')](function(_0x22baad){if(_0x22baad){_0x3881f4[_0x186d('0x49')]=_['keys'](db[_0x186d('0x6e')][_0x186d('0x41')]);_0x3881f4[_0x186d('0x45')]=_['keys'](_0x69074a['query']);_0x3881f4[_0x186d('0x47')]=_[_0x186d('0x48')](_0x3881f4[_0x186d('0x49')],_0x3881f4['query']);_0x36fbf6[_0x186d('0x4b')]=_[_0x186d('0x48')](_0x3881f4[_0x186d('0x49')],qs[_0x186d('0x4a')](_0x69074a[_0x186d('0x45')][_0x186d('0x4a')]));_0x36fbf6['attributes']=_0x36fbf6[_0x186d('0x4b')][_0x186d('0x4c')]?_0x36fbf6['attributes']:_0x3881f4[_0x186d('0x49')];if(!_0x69074a['query']['hasOwnProperty'](_0x186d('0x69'))){_0x36fbf6[_0x186d('0x32')]=qs['limit'](_0x69074a['query']['limit']);_0x36fbf6[_0x186d('0x31')]=qs[_0x186d('0x31')](_0x69074a[_0x186d('0x45')]['offset']);}_0x36fbf6[_0x186d('0x6a')]=qs[_0x186d('0x4e')](_0x69074a[_0x186d('0x45')][_0x186d('0x4e')]);_0x36fbf6[_0x186d('0x4f')]=qs['filters'](_[_0x186d('0x50')](_0x69074a[_0x186d('0x45')],_0x3881f4[_0x186d('0x47')]));_0x36fbf6[_0x186d('0x4f')][_0x186d('0x6d')]=_0x22baad['id'];if(_0x69074a[_0x186d('0x45')][_0x186d('0x51')]){_0x36fbf6[_0x186d('0x4f')]=_[_0x186d('0x52')](_0x36fbf6[_0x186d('0x4f')],{'$or':_[_0x186d('0x3f')](_0x36fbf6[_0x186d('0x4b')],function(_0xbdf76){var _0x58f88e={};_0x58f88e[_0xbdf76]={'$like':'%'+_0x69074a['query'][_0x186d('0x51')]+'%'};return _0x58f88e;})});}_0x36fbf6=_['merge']({},_0x36fbf6,_0x69074a[_0x186d('0x53')]);return db['CannedAnswer'][_0x186d('0x6b')]({'where':_0x36fbf6['where']})[_0x186d('0x27')](function(_0x1e3da3){_0x50fad5[_0x186d('0x6b')]=_0x1e3da3;if(_0x69074a[_0x186d('0x45')][_0x186d('0x54')]){_0x36fbf6[_0x186d('0x55')]=[{'all':!![]}];}return db[_0x186d('0x6e')]['findAll'](_0x36fbf6);})[_0x186d('0x27')](function(_0x5cc2a8){_0x50fad5[_0x186d('0x57')]=_0x5cc2a8;return _0x50fad5;});}})[_0x186d('0x27')](respondWithFilteredResult(_0x1ca120,_0x36fbf6))[_0x186d('0x5a')](handleError(_0x1ca120,null));};exports['removeAnswers']=function(_0x3c3900,_0x14d68a,_0x7ecb94){return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0x3c3900[_0x186d('0x63')]['id']}})['then'](handleEntityNotFound(_0x14d68a,null))[_0x186d('0x27')](function(_0xc47f82){if(_0xc47f82){return _0xc47f82[_0x186d('0x70')](_0x3c3900[_0x186d('0x45')][_0x186d('0x6c')]);}})['then'](respondWithStatusCode(_0x14d68a,null))[_0x186d('0x5a')](handleError(_0x14d68a,null));};exports[_0x186d('0x71')]=function(_0x10a612,_0xce32e,_0xf02fc6){var _0x231054={'body':_0x10a612[_0x186d('0x62')],'channel':_0x186d('0x72')};var _0x4a3efb=[];var _0x5dfc18=[];var _0x3810e4={};var _0x4c58dc=![];return db[_0x186d('0x73')][_0x186d('0x64')]()[_0x186d('0x27')](function(_0x49192c){if(!_0x49192c){throw new db[(_0x186d('0x74'))]['ValidationError']('no\x20available\x20attributes');}_0x4a3efb=_['difference'](_[_0x186d('0x46')](_0x49192c),['createdAt',_0x186d('0x75')]);_0x5dfc18=_[_0x186d('0x76')](_[_0x186d('0x46')](_0x49192c),[_0x186d('0x77'),_0x186d('0x75'),'CompanyId',_0x186d('0x78')]);if(_0x10a612[_0x186d('0x62')]['id']){delete _0x10a612['body']['id'];}if(_[_0x186d('0x79')](_0x10a612[_0x186d('0x62')][_0x186d('0x7a')])){throw new db['Sequelize'][(_0x186d('0x24'))](_0x186d('0x7b'));}if(_['isNil'](_0x10a612[_0x186d('0x62')][_0x186d('0x62')])||_0x10a612[_0x186d('0x62')][_0x186d('0x62')]===''){throw new db[(_0x186d('0x74'))][(_0x186d('0x24'))](_0x186d('0x7c'));}if(_[_0x186d('0x79')](_0x10a612[_0x186d('0x62')][_0x186d('0x7d')])){throw new db[(_0x186d('0x74'))][(_0x186d('0x24'))](_0x186d('0x7e')+_0x5dfc18);}if(!_[_0x186d('0x7f')](_0x5dfc18,_0x10a612[_0x186d('0x62')][_0x186d('0x7d')])){throw new db[(_0x186d('0x74'))][(_0x186d('0x24'))](_0x186d('0x80')+_0x5dfc18);}_0x3810e4[_0x10a612[_0x186d('0x62')][_0x186d('0x7d')]]=_0x10a612[_0x186d('0x62')][_0x186d('0x7a')];})['then'](function(){return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0x10a612[_0x186d('0x63')]['id']},'include':[{'model':db[_0x186d('0x81')],'as':'List','include':[{'model':db[_0x186d('0x73')],'as':'Contacts','where':_0x3810e4,'limit':0x1,'order':[[_0x186d('0x75'),_0x186d('0x82')]]}]},{'model':db[_0x186d('0x83')],'as':_0x186d('0x84')}]});})[_0x186d('0x27')](handleEntityNotFound(_0xce32e,null))[_0x186d('0x27')](function(_0x5aa254){if(_0x5aa254&&_0x5aa254[_0x186d('0x85')]){_0x231054[_0x186d('0x86')]=_0x5aa254;_0x231054[_0x186d('0x87')]=_0x5aa254['Applications'];_0x231054[_0x186d('0x88')]=_0x5aa254['List'];_0x231054[_0x186d('0x87')]=_[_0x186d('0x89')](_0x231054[_0x186d('0x87')],[_0x186d('0x8a')],[_0x186d('0x8b')]);if(_0x231054[_0x186d('0x86')]['Applications']){delete _0x231054[_0x186d('0x86')][_0x186d('0x84')];}if(_0x231054[_0x186d('0x86')][_0x186d('0x85')]&&_0x231054['account'][_0x186d('0x85')][_0x186d('0x8c')][_0x186d('0x4c')]){return _0x231054[_0x186d('0x86')][_0x186d('0x85')][_0x186d('0x8c')][0x0];}var _0x498463=_[_0x186d('0x1b')](_0x10a612[_0x186d('0x62')],{'firstName':_0x10a612['body'][_0x186d('0x7a')],'ListId':_0x5aa254[_0x186d('0x78')]});_0x498463[_0x10a612[_0x186d('0x62')][_0x186d('0x7d')]]=_0x10a612[_0x186d('0x62')]['from'];return db[_0x186d('0x73')][_0x186d('0x5b')](_0x498463,{'fields':_0x4a3efb,'raw':!![]});}})[_0x186d('0x27')](handleEntityNotFound(_0xce32e,null))[_0x186d('0x27')](function(_0x3b553f){_0x231054[_0x186d('0x8d')]=_0x3b553f;if(_0x3b553f){var _0x3b9cea={'ContactId':_0x3b553f['id'],'OpenchannelAccountId':_0x10a612['params']['id'],'from':(_0x3b553f[_0x186d('0x8e')]||'')+'\x20'+(_0x3b553f[_0x186d('0x8f')]||'')};var _0x40e1c2={'OpenchannelAccountId':_0x10a612['params']['id'],'closed':![]};if(_0x10a612['body'][_0x186d('0x90')]){_0x40e1c2[_0x186d('0x90')]=_0x10a612[_0x186d('0x62')][_0x186d('0x90')];return db[_0x186d('0x91')][_0x186d('0x59')]({'where':_0x40e1c2})['then'](function(_0x3a5208){if(_0x3a5208){return[_0x3a5208,![]];}_0x3b9cea['threadId']=_0x10a612[_0x186d('0x62')][_0x186d('0x90')];_0x3b9cea[_0x186d('0x92')]=_0x10a612['body'][_0x186d('0x92')];return db['OpenchannelInteraction'][_0x186d('0x5b')](_0x3b9cea)[_0x186d('0x27')](function(_0x4087e6){return[_0x4087e6,!![]];});});}else{_0x40e1c2[_0x186d('0x90')]=null;}_0x40e1c2[_0x186d('0x93')]=_0x3b553f['id'];return db[_0x186d('0x91')][_0x186d('0x59')]({'where':_0x40e1c2})[_0x186d('0x27')](function(_0x495403){if(_0x495403){return[_0x495403,![]];}return db['OpenchannelInteraction'][_0x186d('0x5b')](_0x3b9cea)[_0x186d('0x27')](function(_0x482586){return[_0x482586,!![]];});});}})[_0x186d('0x94')](function(_0x5e7dee,_0x3cf4ab){if(_0x5e7dee){_0x4c58dc=_0x3cf4ab;if(!_0x3cf4ab){var _0x5c44f0={'from':(_0x231054['contact'][_0x186d('0x8e')]||'')+'\x20'+(_0x231054[_0x186d('0x8d')][_0x186d('0x8f')]||'')};if(_0x10a612['body'][_0x186d('0x90')]&&_0x10a612['body']['messageId']&&_0x10a612[_0x186d('0x62')][_0x186d('0x90')]!=_0x10a612[_0x186d('0x62')][_0x186d('0x95')]){_0x5c44f0[_0x186d('0x90')]=_0x10a612['body'][_0x186d('0x95')];}return _0x5e7dee[_0x186d('0x36')](_0x5c44f0);}else{return _0x5e7dee;}}})['then'](function(_0x19eb31){_0x231054['interaction']=_0x19eb31['get']({'plain':!![]});_0x231054['interaction'][_0x186d('0x96')]=_0x4c58dc;if(_0x231054[_0x186d('0x97')][_0x186d('0x96')]){if(_0x231054[_0x186d('0x86')][_0x186d('0x98')]){_0x231054[_0x186d('0x87')][_0x186d('0x99')]({'id':0x0,'priority':_0x231054[_0x186d('0x87')][_0x186d('0x4c')]+0x1,'app':_0x186d('0x9a'),'appdata':_0x186d('0x9b'),'interval':_0x186d('0x9c')});}}return db[_0x186d('0x9d')][_0x186d('0x5b')]({'body':_0x10a612[_0x186d('0x62')][_0x186d('0x62')],'OpenchannelAccountId':_0x10a612[_0x186d('0x63')]['id'],'OpenchannelInteractionId':_0x19eb31['id'],'direction':'in','ContactId':_0x231054[_0x186d('0x8d')]['id'],'AttachmentId':_0x10a612[_0x186d('0x62')][_0x186d('0x9e')]});})[_0x186d('0x27')](function(_0x3a3b80){_0x231054[_0x186d('0x2e')]=_0x3a3b80;if(_0x231054['interaction'][_0x186d('0x9f')]){return db[_0x186d('0xa0')][_0x186d('0x59')]({'attributes':['id',_0x186d('0x3b')],'where':{'id':_0x231054[_0x186d('0x97')][_0x186d('0x9f')]}})[_0x186d('0x27')](function(_0x16a541){if(_0x16a541){_0x231054[_0x186d('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0x186d('0xa1'),'appdata':_0x16a541[_0x186d('0x3b')]+','+(_0x231054[_0x186d('0x86')][_0x186d('0xa2')]||0xa),'interval':'*,*,*,*'});_0x231054[_0x186d('0xa3')]=![];}return respondWithRpcPromise(_0x186d('0xa4'),'startRouting',_0x231054);});}return respondWithRpcPromise(_0x186d('0xa4'),_0x186d('0xa5'),_0x231054);})[_0x186d('0x27')](function(_0x56d8e0){respondWithRpcPromise(_0x186d('0xa6'),_0x186d('0xa6'),{'event':_0x186d('0x71'),'message':_0x56d8e0},client9002);return _0x56d8e0;})[_0x186d('0x27')](respondWithResult(_0xce32e,null))['catch'](handleError(_0xce32e,null));};exports[_0x186d('0xa7')]=function(_0x25a182,_0x27b97c,_0x33e5cc){return db['OpenchannelAccount'][_0x186d('0x68')]({'where':{'id':_0x25a182['params']['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x27b97c,null))[_0x186d('0x27')](function(_0x29e9aa){if(_0x29e9aa){return db[_0x186d('0xa8')][_0x186d('0xa9')](function(_0x5f0987){return db[_0x186d('0x83')][_0x186d('0x37')]({'where':{'OpenchannelAccountId':_0x25a182[_0x186d('0x63')]['id']},'transaction':_0x5f0987})['then'](function(_0xf0d459){var _0x4758a9=_['map'](_0x25a182[_0x186d('0x62')],function(_0x489d7a){_0x489d7a[_0x186d('0x6d')]=_0x25a182[_0x186d('0x63')]['id'];return _0x489d7a;});return db[_0x186d('0x83')][_0x186d('0xaa')](_0x4758a9,{'transaction':_0x5f0987});});})['then'](function(){return db[_0x186d('0x83')][_0x186d('0xab')]({'where':{'OpenchannelAccountId':_0x25a182[_0x186d('0x63')]['id']},'order':_0x186d('0x8a')});});}})[_0x186d('0x27')](respondWithResult(_0x27b97c,null))[_0x186d('0x5a')](handleError(_0x27b97c,null));};exports['getApplications']=function(_0x363501,_0x2c5521,_0x48319a){var _0x44ef28={};var _0x4dbee2={};var _0x4f006b;var _0x29e4dc;return db[_0x186d('0x40')][_0x186d('0x68')]({'where':{'id':_0x363501[_0x186d('0x63')]['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x2c5521,null))[_0x186d('0x27')](function(_0x309749){if(_0x309749){_0x4f006b=_0x309749;_0x4dbee2[_0x186d('0x49')]=_[_0x186d('0x46')](db[_0x186d('0x83')][_0x186d('0x41')]);_0x4dbee2['query']=_[_0x186d('0x46')](_0x363501[_0x186d('0x45')]);_0x4dbee2['filters']=_['intersection'](_0x4dbee2[_0x186d('0x49')],_0x4dbee2['query']);_0x44ef28[_0x186d('0x4b')]=_['intersection'](_0x4dbee2[_0x186d('0x49')],qs[_0x186d('0x4a')](_0x363501[_0x186d('0x45')][_0x186d('0x4a')]));_0x44ef28['attributes']=_0x44ef28[_0x186d('0x4b')]['length']?_0x44ef28[_0x186d('0x4b')]:_0x4dbee2['model'];_0x44ef28[_0x186d('0x6a')]=qs['sort'](_0x363501[_0x186d('0x45')]['sort']);_0x44ef28['where']=qs[_0x186d('0x47')](_['pick'](_0x363501[_0x186d('0x45')],_0x4dbee2[_0x186d('0x47')]));if(_0x363501[_0x186d('0x45')][_0x186d('0x51')]){_0x44ef28[_0x186d('0x4f')]=_[_0x186d('0x52')](_0x44ef28[_0x186d('0x4f')],{'$or':_[_0x186d('0x3f')](_0x44ef28[_0x186d('0x4b')],function(_0x1725a2){var _0x1265d3={};_0x1265d3[_0x1725a2]={'$like':'%'+_0x363501[_0x186d('0x45')]['filter']+'%'};return _0x1265d3;})});}_0x44ef28=_[_0x186d('0x52')]({},_0x44ef28,_0x363501[_0x186d('0x53')]);return _0x4f006b[_0x186d('0xac')](_0x44ef28);}})[_0x186d('0x27')](function(_0x1ea200){if(_0x1ea200){_0x29e4dc=_0x1ea200[_0x186d('0x4c')];if(!_0x363501['query']['hasOwnProperty']('nolimit')){_0x44ef28[_0x186d('0x32')]=qs[_0x186d('0x32')](_0x363501[_0x186d('0x45')][_0x186d('0x32')]);_0x44ef28['offset']=qs['offset'](_0x363501[_0x186d('0x45')]['offset']);}return _0x4f006b['getApplications'](_0x44ef28);}})[_0x186d('0x27')](function(_0x45bd33){if(_0x45bd33){return _0x45bd33?{'count':_0x29e4dc,'rows':_0x45bd33}:null;}})[_0x186d('0x27')](respondWithResult(_0x2c5521,null))[_0x186d('0x5a')](handleError(_0x2c5521,null));};exports[_0x186d('0xad')]=function(_0x46a2ec,_0x54b6ee,_0xd8c82f){var _0x814982={'raw':![],'where':{}};var _0x3563b1={};var _0x5754c9={'count':0x0,'rows':[]};return db[_0x186d('0x40')]['findOne']({'where':{'id':_0x46a2ec[_0x186d('0x63')]['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x54b6ee,null))[_0x186d('0x27')](function(_0x4aa4ed){if(_0x4aa4ed){_0x3563b1[_0x186d('0x49')]=_[_0x186d('0x46')](db['OpenchannelInteraction'][_0x186d('0x41')]);_0x3563b1[_0x186d('0x45')]=_[_0x186d('0x46')](_0x46a2ec['query']);_0x3563b1[_0x186d('0x47')]=_[_0x186d('0x48')](_0x3563b1[_0x186d('0x49')],_0x3563b1[_0x186d('0x45')]);_0x814982[_0x186d('0x4b')]=_['intersection'](_0x3563b1[_0x186d('0x49')],qs['fields'](_0x46a2ec['query'][_0x186d('0x4a')]));_0x814982[_0x186d('0x4b')]=_0x814982[_0x186d('0x4b')][_0x186d('0x4c')]?_0x814982[_0x186d('0x4b')]:_0x3563b1[_0x186d('0x49')];if(!_0x46a2ec[_0x186d('0x45')][_0x186d('0x4d')](_0x186d('0x69'))){_0x814982['limit']=qs[_0x186d('0x32')](_0x46a2ec[_0x186d('0x45')][_0x186d('0x32')]);_0x814982[_0x186d('0x31')]=qs[_0x186d('0x31')](_0x46a2ec[_0x186d('0x45')][_0x186d('0x31')]);}_0x814982[_0x186d('0x6a')]=qs['sort'](_0x46a2ec[_0x186d('0x45')][_0x186d('0x4e')]);_0x814982[_0x186d('0x4f')]=qs['filters'](_[_0x186d('0x50')](_0x46a2ec[_0x186d('0x45')],_0x3563b1[_0x186d('0x47')]));_0x814982[_0x186d('0x4f')]['OpenchannelAccountId']=_0x4aa4ed['id'];if(_0x46a2ec[_0x186d('0x45')]['filter']){_0x814982[_0x186d('0x4f')]=_[_0x186d('0x52')](_0x814982[_0x186d('0x4f')],{'$or':_[_0x186d('0x3f')](_0x814982[_0x186d('0x4b')],function(_0x2fdfea){var _0x6c6bbc={};_0x6c6bbc[_0x2fdfea]={'$like':'%'+_0x46a2ec[_0x186d('0x45')][_0x186d('0x51')]+'%'};return _0x6c6bbc;})});}_0x814982=_[_0x186d('0x52')]({},_0x814982,_0x46a2ec[_0x186d('0x53')]);return db[_0x186d('0x91')][_0x186d('0x6b')]({'where':_0x814982[_0x186d('0x4f')]})[_0x186d('0x27')](function(_0x3e8a80){_0x5754c9[_0x186d('0x6b')]=_0x3e8a80;if(_0x46a2ec[_0x186d('0x45')][_0x186d('0x54')]){_0x814982[_0x186d('0x55')]=[{'model':db[_0x186d('0x73')],'as':'Contact','required':![]},{'model':db[_0x186d('0xa0')],'as':_0x186d('0xae'),'attributes':[_0x186d('0x3b'),_0x186d('0xaf'),_0x186d('0xb0')],'required':![]},{'model':db['Tag'],'as':_0x186d('0xb1'),'attributes':['id',_0x186d('0x3b'),_0x186d('0xb2')],'where':_0x46a2ec[_0x186d('0x45')][_0x186d('0xb3')]?{'id':_0x46a2ec['query'][_0x186d('0xb3')]}:undefined,'required':_0x46a2ec[_0x186d('0x45')][_0x186d('0xb3')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x814982);})[_0x186d('0x27')](function(_0x4673da){_0x5754c9[_0x186d('0x57')]=_0x4673da;return _0x5754c9;});}})[_0x186d('0x27')](respondWithFilteredResult(_0x54b6ee,_0x814982))[_0x186d('0x5a')](handleError(_0x54b6ee,null));};exports['addAgents']=function(_0x3a844c,_0x290df6,_0x33a562){return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0x3a844c[_0x186d('0x63')]['id']}})['then'](handleEntityNotFound(_0x290df6,null))[_0x186d('0x27')](function(_0x145765){if(_0x145765){return _0x145765[_0x186d('0xb4')](_0x3a844c['body'][_0x186d('0x6c')],_[_0x186d('0xb5')](_0x3a844c[_0x186d('0x62')],['ids','id'])||{})[_0x186d('0x94')](function(_0x258df4){for(var _0x78a9a9=0x0;_0x78a9a9<_0x3a844c['body']['ids']['length'];_0x78a9a9+=0x1){socket['emit'](_0x186d('0xb6'),{'UserId':_0x3a844c['body'][_0x186d('0x6c')][_0x78a9a9],'OpenchannelAccountId':_0x3a844c[_0x186d('0x63')]['id']});}return _0x258df4;});}})['then'](respondWithResult(_0x290df6,null))[_0x186d('0x5a')](handleError(_0x290df6,null));};exports[_0x186d('0xb7')]=function(_0x550a87,_0x47fd17,_0x5e05cb){return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0x550a87['params']['id']}})[_0x186d('0x27')](handleEntityNotFound(_0x47fd17,null))[_0x186d('0x27')](function(_0x5b1b88){if(_0x5b1b88){return _0x5b1b88[_0x186d('0xb7')](_0x550a87[_0x186d('0x45')][_0x186d('0x6c')])[_0x186d('0x27')](function(){if(_[_0x186d('0xb8')](_0x550a87[_0x186d('0x45')]['ids'])){for(var _0x5777df=0x0;_0x5777df<_0x550a87[_0x186d('0x45')][_0x186d('0x6c')][_0x186d('0x4c')];_0x5777df+=0x1){socket[_0x186d('0xb9')](_0x186d('0xba'),{'UserId':Number(_0x550a87['query'][_0x186d('0x6c')][_0x5777df]),'OpenchannelAccountId':Number(_0x550a87[_0x186d('0x63')]['id'])});}}else{socket[_0x186d('0xb9')](_0x186d('0xba'),{'UserId':Number(_0x550a87[_0x186d('0x45')][_0x186d('0x6c')]),'OpenchannelAccountId':Number(_0x550a87[_0x186d('0x63')]['id'])});}});}})[_0x186d('0x27')](respondWithStatusCode(_0x47fd17,null))['catch'](handleError(_0x47fd17,null));};exports['getAgents']=function(_0x10b950,_0x283aeb,_0x4a5b7b){var _0x4ceacb={};var _0x537841={};var _0x2cc01c;var _0x496951;return db[_0x186d('0x40')][_0x186d('0x68')]({'where':{'id':_0x10b950['params']['id']}})['then'](handleEntityNotFound(_0x283aeb,null))['then'](function(_0x221129){if(_0x221129){_0x2cc01c=_0x221129;_0x537841[_0x186d('0x49')]=_[_0x186d('0x46')](db[_0x186d('0xa0')][_0x186d('0x41')]);_0x537841['query']=_['keys'](_0x10b950[_0x186d('0x45')]);_0x537841[_0x186d('0x47')]=_[_0x186d('0x48')](_0x537841[_0x186d('0x49')],_0x537841[_0x186d('0x45')]);_0x4ceacb[_0x186d('0x4b')]=_[_0x186d('0x48')](_0x537841['model'],qs[_0x186d('0x4a')](_0x10b950[_0x186d('0x45')][_0x186d('0x4a')]));_0x4ceacb[_0x186d('0x4b')]=_0x4ceacb[_0x186d('0x4b')]['length']?_0x4ceacb[_0x186d('0x4b')]:_0x537841[_0x186d('0x49')];_0x4ceacb['order']=qs[_0x186d('0x4e')](_0x10b950['query'][_0x186d('0x4e')]);_0x4ceacb[_0x186d('0x4f')]=qs[_0x186d('0x47')](_[_0x186d('0x50')](_0x10b950[_0x186d('0x45')],_0x537841[_0x186d('0x47')]));if(_0x10b950[_0x186d('0x45')][_0x186d('0x51')]){_0x4ceacb['where']=_[_0x186d('0x52')](_0x4ceacb['where'],{'$or':_[_0x186d('0x3f')](_0x4ceacb[_0x186d('0x4b')],function(_0x26ccba){var _0x4ae587={};_0x4ae587[_0x26ccba]={'$like':'%'+_0x10b950[_0x186d('0x45')][_0x186d('0x51')]+'%'};return _0x4ae587;})});}_0x4ceacb=_[_0x186d('0x52')]({},_0x4ceacb,_0x10b950[_0x186d('0x53')]);return _0x2cc01c[_0x186d('0xbb')](_0x4ceacb);}})[_0x186d('0x27')](function(_0x5e4da7){if(_0x5e4da7){_0x496951=_0x5e4da7[_0x186d('0x4c')];if(!_0x10b950[_0x186d('0x45')][_0x186d('0x4d')](_0x186d('0x69'))){_0x4ceacb['limit']=qs['limit'](_0x10b950[_0x186d('0x45')][_0x186d('0x32')]);_0x4ceacb[_0x186d('0x31')]=qs['offset'](_0x10b950[_0x186d('0x45')][_0x186d('0x31')]);}return _0x2cc01c[_0x186d('0xbb')](_0x4ceacb);}})['then'](function(_0x1d0f79){if(_0x1d0f79){return _0x1d0f79?{'count':_0x496951,'rows':_0x1d0f79}:null;}})['then'](respondWithResult(_0x283aeb,null))['catch'](handleError(_0x283aeb,null));};exports[_0x186d('0x3c')]=function(_0x338249,_0x456dc9,_0x318275){var _0x402291,_0x312b6d,_0x38f5dd;if(_[_0x186d('0x79')](_0x338249['body']['body'])||_0x338249[_0x186d('0x62')][_0x186d('0x62')]===''){throw new db['Sequelize'][(_0x186d('0x24'))](_0x186d('0x7c'));}if(_[_0x186d('0x79')](_0x338249[_0x186d('0x62')]['to'])){}_0x402291=_0x338249[_0x186d('0x62')]['to'];return db[_0x186d('0x40')][_0x186d('0x68')]({'where':{'id':_0x338249[_0x186d('0x63')]['id']}})['then'](handleEntityNotFound(_0x456dc9,null))['then'](function(_0x31b5b5){if(_0x31b5b5){return db[_0x186d('0x40')][_0x186d('0x59')]({'where':{'id':_0x31b5b5['id']},'include':[{'model':db[_0x186d('0x81')],'as':_0x186d('0x85'),'include':[{'model':db[_0x186d('0x73')],'as':_0x186d('0x8c'),'where':{[_0x31b5b5[_0x186d('0x7d')]]:_0x402291},'limit':0x1,'order':[[_0x186d('0x75'),_0x186d('0x82')]]}]}]})['then'](handleEntityNotFound(_0x456dc9,null))[_0x186d('0x27')](function(_0x5e4f11){if(_0x5e4f11&&_0x5e4f11[_0x186d('0x85')]){_0x312b6d=_0x5e4f11[_0x186d('0x5d')]({'plain':!![]});if(_0x312b6d['List']&&_0x312b6d[_0x186d('0x85')][_0x186d('0x8c')][_0x186d('0x4c')]){return _0x312b6d[_0x186d('0x85')][_0x186d('0x8c')][0x0];}return db['CmContact'][_0x186d('0x5b')](_[_0x186d('0x1b')](_0x338249['body'],{'firstName':_0x402291,[_0x5e4f11[_0x186d('0x7d')]]:_0x402291,'phone':_0x402291,'ListId':_0x312b6d[_0x186d('0x78')]}));}})['then'](handleEntityNotFound(_0x456dc9,null))[_0x186d('0x27')](function(_0x515631){if(_0x515631){_0x38f5dd=_0x515631;return db[_0x186d('0x91')]['find']({'where':{'ContactId':_0x38f5dd['id'],'closed':![],'OpenchannelAccountId':_0x312b6d['id']}})[_0x186d('0x27')](function(_0xa4e0db){if(_0xa4e0db){return[_0xa4e0db,![]];}return db[_0x186d('0x91')][_0x186d('0x5b')]({'UserId':_0x338249[_0x186d('0x5c')]['id'],'ContactId':_0x38f5dd['id'],'OpenchannelAccountId':_0x312b6d['id'],'lastMsgDirection':_0x186d('0xbc'),'Messages':[_[_0x186d('0x52')](_0x338249['body'],{'read':![],'body':_0x338249['body']['body'],'OpenchannelAccountId':_0x312b6d['id'],'UserId':_0x338249['user']['id'],'ContactId':_0x38f5dd['id']})]},{'include':[{'model':db[_0x186d('0x9d')],'as':_0x186d('0xbd')}]})['then'](function(_0x2f81a9){return[_0x2f81a9,!![]];});});}})[_0x186d('0x94')](function(_0x229794,_0x186d83){if(_0x186d83){return _0x229794;}return db['OpenchannelMessage'][_0x186d('0x5b')](_[_0x186d('0x52')](_0x338249[_0x186d('0x62')],{'read':![],'body':_0x338249[_0x186d('0x62')][_0x186d('0x62')],'OpenchannelAccountId':_0x312b6d['id'],'OpenchannelInteractionId':_0x229794['id'],'UserId':_0x338249[_0x186d('0x5c')]['id'],'ContactId':_0x38f5dd['id']}))[_0x186d('0x27')](function(_0x5aaeb){_0x229794[_0x186d('0xbe')][_0x186d('0xbd')]=[];_0x229794['dataValues'][_0x186d('0xbd')][_0x186d('0x99')](_0x5aaeb[_0x186d('0xbe')]);return _0x229794;});});}})[_0x186d('0x27')](respondWithResult(_0x456dc9,null))[_0x186d('0x5a')](handleError(_0x456dc9,null));}; \ No newline at end of file +var _0x0dfa=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','end','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','user','get','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','pick','OpenchannelAccountId','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','openchannel','difference','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','CmContact','Contacts','DESC','OpenchannelApplication','List','account','applications','Applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','rawAttributes','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x7a2f48,_0x1257df){var _0x126014=function(_0x15991b){while(--_0x15991b){_0x7a2f48['push'](_0x7a2f48['shift']());}};_0x126014(++_0x1257df);}(_0x0dfa,0xad));var _0xa0df=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0dfa[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa0df('0x0'));var rimraf=require(_0xa0df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0df('0x2'));var rp=require('request-promise');var moment=require(_0xa0df('0x3'));var BPromise=require(_0xa0df('0x4'));var Mustache=require(_0xa0df('0x5'));var util=require(_0xa0df('0x6'));var path=require(_0xa0df('0x7'));var sox=require(_0xa0df('0x8'));var csv=require(_0xa0df('0x9'));var ejs=require(_0xa0df('0xa'));var fs=require('fs');var _=require(_0xa0df('0xb'));var squel=require('squel');var crypto=require(_0xa0df('0xc'));var jsforce=require(_0xa0df('0xd'));var deskjs=require(_0xa0df('0xe'));var toCsv=require(_0xa0df('0x9'));var querystring=require(_0xa0df('0xf'));var Papa=require(_0xa0df('0x10'));var Redis=require(_0xa0df('0x11'));var authService=require(_0xa0df('0x12'));var qs=require(_0xa0df('0x13'));var as=require(_0xa0df('0x14'));var hardwareService=require(_0xa0df('0x15'));var logger=require(_0xa0df('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xa0df('0x17'));var db=require(_0xa0df('0x18'))['db'];config['redis']=_[_0xa0df('0x19')](config[_0xa0df('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0df('0x1b'))(new Redis(config[_0xa0df('0x1a')]));require('./openchannelAccount.socket')[_0xa0df('0x1c')](socket);var jayson=require(_0xa0df('0x1d'));var client=jayson[_0xa0df('0x1e')][_0xa0df('0x1f')]({'port':0x232c});var client9002=jayson[_0xa0df('0x1e')][_0xa0df('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x36037e,_0x58be7a,_0x45fb7d){if(_0x45fb7d){var _0x36e575=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36e575[_0xa0df('0x20')](_0x58be7a)){return _0x36037e;}else{throw new db[(_0xa0df('0x21'))][(_0xa0df('0x22'))](_0xa0df('0x23'));}}else{return _0x36037e;}}function respondWithRpcPromise(_0x432136,_0x421090,_0x3e12fd,_0x31f709){return new BPromise(function(_0xad26c5,_0x32a894){var _0xf8a269=_0x31f709||client;return _0xf8a269[_0xa0df('0x24')](_0x432136,_0x3e12fd)[_0xa0df('0x25')](function(_0x4ddd46){logger[_0xa0df('0x26')](_0xa0df('0x27'),_0x421090,_0xa0df('0x28'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x421090,_0xa0df('0x28'),JSON['stringify'](_0x4ddd46));if(_0x4ddd46[_0xa0df('0x29')]){if(_0x4ddd46[_0xa0df('0x29')][_0xa0df('0x2a')]===0x1f4){logger[_0xa0df('0x29')](_0xa0df('0x27'),_0x421090,_0x4ddd46[_0xa0df('0x29')][_0xa0df('0x2b')]);return _0x32a894(_0x4ddd46['error'][_0xa0df('0x2b')]);}logger['error'](_0xa0df('0x27'),_0x421090,_0x4ddd46[_0xa0df('0x29')][_0xa0df('0x2b')]);return _0xad26c5(_0x4ddd46[_0xa0df('0x29')][_0xa0df('0x2b')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x421090,_0xa0df('0x28'));_0xad26c5(_0x4ddd46['result'][_0xa0df('0x2b')]);}})[_0xa0df('0x2c')](function(_0xe9c215){logger[_0xa0df('0x29')](_0xa0df('0x27'),_0x421090,_0xe9c215);_0x32a894(_0xe9c215);});});}function respondWithStatusCode(_0x5977b4,_0x5aee51){_0x5aee51=_0x5aee51||0xcc;return function(_0x44d01e){if(_0x44d01e){return _0x5977b4[_0xa0df('0x2d')](_0x5aee51);}return _0x5977b4[_0xa0df('0x2e')](_0x5aee51)['end']();};}function respondWithResult(_0x463e89,_0x3e1c6d){_0x3e1c6d=_0x3e1c6d||0xc8;return function(_0x1826ce){if(_0x1826ce){return _0x463e89['status'](_0x3e1c6d)[_0xa0df('0x2f')](_0x1826ce);}};}function respondWithFilteredResult(_0x69aa5f,_0x384659){return function(_0x33b45d){if(_0x33b45d){var _0x5028de=_0x33b45d[_0xa0df('0x30')],_0x432bba=_0x384659[_0xa0df('0x31')],_0x3b6149=_0x384659[_0xa0df('0x31')]+_0x384659['limit'],_0x2240d5;if(_0x3b6149>=_0x5028de){_0x3b6149=_0x5028de;_0x2240d5=0xc8;}else{_0x2240d5=0xce;}_0x69aa5f[_0xa0df('0x2e')](_0x2240d5);return _0x69aa5f[_0xa0df('0x32')](_0xa0df('0x33'),_0x432bba+'-'+_0x3b6149+'/'+_0x5028de)[_0xa0df('0x2f')](_0x33b45d);}return null;};}function patchUpdates(_0x1e56e0){return function(_0x47cc8d){try{jsonpatch[_0xa0df('0x34')](_0x47cc8d,_0x1e56e0,!![]);}catch(_0x45ba26){return BPromise[_0xa0df('0x35')](_0x45ba26);}return _0x47cc8d[_0xa0df('0x36')]();};}function saveUpdates(_0x12ed72,_0x2f0adb){return function(_0x1f3639){if(_0x1f3639){return _0x1f3639[_0xa0df('0x37')](_0x12ed72)[_0xa0df('0x25')](function(_0x71f3e2){return _0x71f3e2;});}return null;};}function removeEntity(_0x518ef5,_0x1e0b1f){return function(_0x844ca4){if(_0x844ca4){return _0x844ca4[_0xa0df('0x38')]()[_0xa0df('0x25')](function(){var _0x3902f3=_0x844ca4['get']({'plain':!![]});var _0x213445=_0xa0df('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x213445,'resourceId':_0x3902f3['id']}})[_0xa0df('0x25')](function(){return _0x844ca4;});})[_0xa0df('0x25')](function(){_0x518ef5['status'](0xcc)[_0xa0df('0x3a')]();});}};}function handleEntityNotFound(_0x3552d5,_0x45cb93){return function(_0x32c1f3){if(!_0x32c1f3){_0x3552d5['sendStatus'](0x194);}return _0x32c1f3;};}function handleError(_0x378344,_0x38da4d){_0x38da4d=_0x38da4d||0x1f4;return function(_0x2040a6){logger[_0xa0df('0x29')](_0x2040a6['stack']);if(_0x2040a6[_0xa0df('0x3b')]){delete _0x2040a6[_0xa0df('0x3b')];}_0x378344['status'](_0x38da4d)[_0xa0df('0x3c')](_0x2040a6);};}exports[_0xa0df('0x3d')]=function(_0x9eb820,_0xbf9e23){var _0x487545={'include':[{'model':db[_0xa0df('0x3e')],'as':_0xa0df('0x3f')}]},_0x308869={},_0x2a52f0={'count':0x0,'rows':[]};var _0x1911ba=_[_0xa0df('0x40')](db[_0xa0df('0x41')]['rawAttributes'],function(_0x1b539f){return{'name':_0x1b539f[_0xa0df('0x42')],'type':_0x1b539f['type'][_0xa0df('0x43')]};});_0x308869['model']=_[_0xa0df('0x40')](_0x1911ba,_0xa0df('0x3b'));_0x308869['query']=_['keys'](_0x9eb820[_0xa0df('0x44')]);_0x308869[_0xa0df('0x45')]=_[_0xa0df('0x46')](_0x308869[_0xa0df('0x47')],_0x308869['query']);_0x487545[_0xa0df('0x48')]=_[_0xa0df('0x46')](_0x308869['model'],qs[_0xa0df('0x49')](_0x9eb820[_0xa0df('0x44')]['fields']));_0x487545['attributes']=_0x487545[_0xa0df('0x48')][_0xa0df('0x4a')]?_0x487545[_0xa0df('0x48')]:_0x308869[_0xa0df('0x47')];if(!_0x9eb820[_0xa0df('0x44')]['hasOwnProperty'](_0xa0df('0x4b'))){_0x487545[_0xa0df('0x4c')]=qs[_0xa0df('0x4c')](_0x9eb820[_0xa0df('0x44')][_0xa0df('0x4c')]);_0x487545[_0xa0df('0x31')]=qs[_0xa0df('0x31')](_0x9eb820[_0xa0df('0x44')][_0xa0df('0x31')]);}_0x487545[_0xa0df('0x4d')]=qs[_0xa0df('0x4e')](_0x9eb820[_0xa0df('0x44')][_0xa0df('0x4e')]);_0x487545['where']=qs['filters'](_['pick'](_0x9eb820['query'],_0x308869[_0xa0df('0x45')]),_0x1911ba);if(_0x9eb820[_0xa0df('0x44')]['filter']){_0x487545[_0xa0df('0x4f')]=_[_0xa0df('0x50')](_0x487545[_0xa0df('0x4f')],{'$or':_[_0xa0df('0x40')](_0x1911ba,function(_0x1a7426){if(_0x1a7426['type']!==_0xa0df('0x51')){var _0x21b68d={};_0x21b68d[_0x1a7426[_0xa0df('0x3b')]]={'$like':'%'+_0x9eb820[_0xa0df('0x44')][_0xa0df('0x52')]+'%'};return _0x21b68d;}})});}_0x487545=_[_0xa0df('0x50')]({},_0x487545,_0x9eb820[_0xa0df('0x53')]);var _0x375090={'where':_0x487545[_0xa0df('0x4f')]};return db[_0xa0df('0x41')][_0xa0df('0x30')](_0x375090)[_0xa0df('0x25')](function(_0x16e8a3){_0x2a52f0[_0xa0df('0x30')]=_0x16e8a3;if(_0x9eb820['query'][_0xa0df('0x54')]){_0x487545['include']=[{'all':!![]}];}return db[_0xa0df('0x41')][_0xa0df('0x55')](_0x487545);})['then'](function(_0x2362fd){_0x2a52f0[_0xa0df('0x56')]=_0x2362fd;return _0x2a52f0;})['then'](respondWithFilteredResult(_0xbf9e23,_0x487545))[_0xa0df('0x2c')](handleError(_0xbf9e23,null));};exports[_0xa0df('0x57')]=function(_0x58416c,_0x4615d9){var _0x101a31={'raw':![],'where':{'id':_0x58416c[_0xa0df('0x58')]['id']},'include':[{'model':db[_0xa0df('0x3e')],'as':_0xa0df('0x3f')}]},_0x44aa43={};_0x44aa43[_0xa0df('0x47')]=_[_0xa0df('0x59')](db[_0xa0df('0x41')]['rawAttributes']);_0x44aa43['query']=_['keys'](_0x58416c[_0xa0df('0x44')]);_0x44aa43[_0xa0df('0x45')]=_[_0xa0df('0x46')](_0x44aa43[_0xa0df('0x47')],_0x44aa43[_0xa0df('0x44')]);_0x101a31[_0xa0df('0x48')]=_[_0xa0df('0x46')](_0x44aa43[_0xa0df('0x47')],qs[_0xa0df('0x49')](_0x58416c[_0xa0df('0x44')][_0xa0df('0x49')]));_0x101a31[_0xa0df('0x48')]=_0x101a31[_0xa0df('0x48')]['length']?_0x101a31[_0xa0df('0x48')]:_0x44aa43[_0xa0df('0x47')];if(_0x58416c[_0xa0df('0x44')][_0xa0df('0x54')]){_0x101a31[_0xa0df('0x5a')]=[{'all':!![]}];}_0x101a31=_[_0xa0df('0x50')]({},_0x101a31,_0x58416c[_0xa0df('0x53')]);return db[_0xa0df('0x41')][_0xa0df('0x5b')](_0x101a31)[_0xa0df('0x25')](handleEntityNotFound(_0x4615d9,null))[_0xa0df('0x25')](respondWithResult(_0x4615d9,null))['catch'](handleError(_0x4615d9,null));};exports[_0xa0df('0x5c')]=function(_0x8b96e7,_0x48e2f7){return db[_0xa0df('0x41')][_0xa0df('0x5c')](_0x8b96e7[_0xa0df('0x5d')],{})[_0xa0df('0x25')](function(_0x2b92d7){var _0x223e74=_0x8b96e7[_0xa0df('0x5e')][_0xa0df('0x5f')]({'plain':!![]});if(!_0x223e74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x223e74[_0xa0df('0x60')]===_0xa0df('0x5e')){var _0xae005a=_0x2b92d7[_0xa0df('0x5f')]({'plain':!![]});var _0x4fae59=_0xa0df('0x39');return db[_0xa0df('0x61')][_0xa0df('0x5b')]({'where':{'name':_0x4fae59,'userProfileId':_0x223e74['userProfileId']},'raw':!![]})[_0xa0df('0x25')](function(_0x53dd70){if(_0x53dd70&&_0x53dd70[_0xa0df('0x62')]===0x0){return db[_0xa0df('0x63')][_0xa0df('0x5c')]({'name':_0xae005a['name'],'resourceId':_0xae005a['id'],'type':_0x53dd70[_0xa0df('0x3b')],'sectionId':_0x53dd70['id']},{})[_0xa0df('0x25')](function(){return _0x2b92d7;});}else{return _0x2b92d7;}})[_0xa0df('0x2c')](function(_0x1a323a){logger[_0xa0df('0x29')](_0xa0df('0x64'),_0x1a323a);throw _0x1a323a;});}return _0x2b92d7;})[_0xa0df('0x25')](respondWithResult(_0x48e2f7,0xc9))[_0xa0df('0x2c')](handleError(_0x48e2f7,null));};exports[_0xa0df('0x37')]=function(_0x50f3bf,_0x45a7d7){if(_0x50f3bf['body']['id']){delete _0x50f3bf[_0xa0df('0x5d')]['id'];}return db[_0xa0df('0x41')][_0xa0df('0x5b')]({'where':{'id':_0x50f3bf[_0xa0df('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xa0df('0x3f')}]})['then'](handleEntityNotFound(_0x45a7d7,null))[_0xa0df('0x25')](saveUpdates(_0x50f3bf[_0xa0df('0x5d')],null))[_0xa0df('0x25')](respondWithResult(_0x45a7d7,null))[_0xa0df('0x2c')](handleError(_0x45a7d7,null));};exports[_0xa0df('0x38')]=function(_0x13473a,_0x178c4f){return db['OpenchannelAccount']['find']({'where':{'id':_0x13473a[_0xa0df('0x58')]['id']}})['then'](handleEntityNotFound(_0x178c4f,null))[_0xa0df('0x25')](removeEntity(_0x178c4f,null))[_0xa0df('0x2c')](handleError(_0x178c4f,null));};exports[_0xa0df('0x65')]=function(_0x1e5a6e,_0x3dd454){return db['OpenchannelAccount'][_0xa0df('0x65')]()[_0xa0df('0x25')](respondWithResult(_0x3dd454,null))[_0xa0df('0x2c')](handleError(_0x3dd454,null));};exports[_0xa0df('0x66')]=function(_0x4559c1,_0x5b72ae,_0x1ef6bf){if(_0x4559c1[_0xa0df('0x5d')]['id']){delete _0x4559c1[_0xa0df('0x5d')]['id'];}return db['OpenchannelAccount'][_0xa0df('0x5b')]({'where':{'id':_0x4559c1['params']['id']}})['then'](handleEntityNotFound(_0x5b72ae,null))['then'](function(_0x4bf016){if(_0x4bf016){_0x4559c1[_0xa0df('0x5d')][_0xa0df('0x67')]=_0x4bf016['id'];return db[_0xa0df('0x68')]['create'](_0x4559c1[_0xa0df('0x5d')]);}})[_0xa0df('0x25')](respondWithResult(_0x5b72ae,null))[_0xa0df('0x2c')](handleError(_0x5b72ae,null));};exports[_0xa0df('0x69')]=function(_0x16c5b8,_0x24872f,_0x434fdd){var _0x354721={'raw':![],'where':{}};var _0xc66f67={};var _0x1f84e0={'count':0x0,'rows':[]};return db[_0xa0df('0x41')][_0xa0df('0x6a')]({'where':{'id':_0x16c5b8[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x24872f,null))[_0xa0df('0x25')](function(_0xdfc19e){if(_0xdfc19e){_0xc66f67[_0xa0df('0x47')]=_[_0xa0df('0x59')](db[_0xa0df('0x68')]['rawAttributes']);_0xc66f67[_0xa0df('0x44')]=_['keys'](_0x16c5b8[_0xa0df('0x44')]);_0xc66f67[_0xa0df('0x45')]=_['intersection'](_0xc66f67[_0xa0df('0x47')],_0xc66f67[_0xa0df('0x44')]);_0x354721[_0xa0df('0x48')]=_['intersection'](_0xc66f67['model'],qs[_0xa0df('0x49')](_0x16c5b8['query'][_0xa0df('0x49')]));_0x354721[_0xa0df('0x48')]=_0x354721[_0xa0df('0x48')][_0xa0df('0x4a')]?_0x354721['attributes']:_0xc66f67[_0xa0df('0x47')];if(!_0x16c5b8['query']['hasOwnProperty'](_0xa0df('0x4b'))){_0x354721[_0xa0df('0x4c')]=qs[_0xa0df('0x4c')](_0x16c5b8[_0xa0df('0x44')][_0xa0df('0x4c')]);_0x354721[_0xa0df('0x31')]=qs[_0xa0df('0x31')](_0x16c5b8['query'][_0xa0df('0x31')]);}_0x354721[_0xa0df('0x4d')]=qs[_0xa0df('0x4e')](_0x16c5b8['query'][_0xa0df('0x4e')]);_0x354721['where']=qs[_0xa0df('0x45')](_[_0xa0df('0x6b')](_0x16c5b8[_0xa0df('0x44')],_0xc66f67[_0xa0df('0x45')]));_0x354721[_0xa0df('0x4f')][_0xa0df('0x6c')]=_0xdfc19e['id'];if(_0x16c5b8[_0xa0df('0x44')][_0xa0df('0x52')]){_0x354721['where']=_['merge'](_0x354721[_0xa0df('0x4f')],{'$or':_[_0xa0df('0x40')](_0x354721[_0xa0df('0x48')],function(_0x4f4793){var _0x2567f1={};_0x2567f1[_0x4f4793]={'$like':'%'+_0x16c5b8['query'][_0xa0df('0x52')]+'%'};return _0x2567f1;})});}_0x354721=_[_0xa0df('0x50')]({},_0x354721,_0x16c5b8[_0xa0df('0x53')]);return db[_0xa0df('0x68')][_0xa0df('0x30')]({'where':_0x354721['where']})[_0xa0df('0x25')](function(_0x5a65d1){_0x1f84e0['count']=_0x5a65d1;if(_0x16c5b8[_0xa0df('0x44')][_0xa0df('0x54')]){_0x354721[_0xa0df('0x5a')]=[{'all':!![]}];}return db[_0xa0df('0x68')]['findAll'](_0x354721);})[_0xa0df('0x25')](function(_0x49c560){_0x1f84e0[_0xa0df('0x56')]=_0x49c560;return _0x1f84e0;});}})['then'](respondWithFilteredResult(_0x24872f,_0x354721))[_0xa0df('0x2c')](handleError(_0x24872f,null));};exports[_0xa0df('0x6d')]=function(_0x147e1a,_0x4381a0,_0x3b946f){return db[_0xa0df('0x41')][_0xa0df('0x5b')]({'where':{'id':_0x147e1a[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x4381a0,null))[_0xa0df('0x25')](function(_0x59dce7){if(_0x59dce7){return _0x59dce7[_0xa0df('0x6d')](_0x147e1a[_0xa0df('0x44')][_0xa0df('0x6e')]);}})['then'](respondWithStatusCode(_0x4381a0,null))[_0xa0df('0x2c')](handleError(_0x4381a0,null));};exports['addAnswer']=function(_0x65beb4,_0xb2eaef,_0x337523){if(_0x65beb4[_0xa0df('0x5d')]['id']){delete _0x65beb4[_0xa0df('0x5d')]['id'];}return db[_0xa0df('0x41')][_0xa0df('0x5b')]({'where':{'id':_0x65beb4['params']['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0xb2eaef,null))[_0xa0df('0x25')](function(_0x141ffc){if(_0x141ffc){_0x65beb4[_0xa0df('0x5d')][_0xa0df('0x6c')]=_0x141ffc['id'];return db[_0xa0df('0x6f')][_0xa0df('0x5c')](_0x65beb4[_0xa0df('0x5d')]);}})[_0xa0df('0x25')](respondWithResult(_0xb2eaef,null))[_0xa0df('0x2c')](handleError(_0xb2eaef,null));};exports[_0xa0df('0x70')]=function(_0x17aa2a,_0x22ca19,_0x74209e){var _0x27afb9={'raw':![],'where':{}};var _0x1de6a9={};var _0x32494d={'count':0x0,'rows':[]};return db[_0xa0df('0x41')][_0xa0df('0x6a')]({'where':{'id':_0x17aa2a[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x22ca19,null))[_0xa0df('0x25')](function(_0x43a2c8){if(_0x43a2c8){_0x1de6a9[_0xa0df('0x47')]=_[_0xa0df('0x59')](db[_0xa0df('0x6f')]['rawAttributes']);_0x1de6a9[_0xa0df('0x44')]=_[_0xa0df('0x59')](_0x17aa2a['query']);_0x1de6a9['filters']=_['intersection'](_0x1de6a9[_0xa0df('0x47')],_0x1de6a9[_0xa0df('0x44')]);_0x27afb9[_0xa0df('0x48')]=_['intersection'](_0x1de6a9[_0xa0df('0x47')],qs[_0xa0df('0x49')](_0x17aa2a[_0xa0df('0x44')][_0xa0df('0x49')]));_0x27afb9[_0xa0df('0x48')]=_0x27afb9[_0xa0df('0x48')]['length']?_0x27afb9[_0xa0df('0x48')]:_0x1de6a9['model'];if(!_0x17aa2a['query'][_0xa0df('0x71')](_0xa0df('0x4b'))){_0x27afb9[_0xa0df('0x4c')]=qs[_0xa0df('0x4c')](_0x17aa2a['query'][_0xa0df('0x4c')]);_0x27afb9['offset']=qs[_0xa0df('0x31')](_0x17aa2a[_0xa0df('0x44')][_0xa0df('0x31')]);}_0x27afb9[_0xa0df('0x4d')]=qs[_0xa0df('0x4e')](_0x17aa2a[_0xa0df('0x44')][_0xa0df('0x4e')]);_0x27afb9[_0xa0df('0x4f')]=qs[_0xa0df('0x45')](_['pick'](_0x17aa2a[_0xa0df('0x44')],_0x1de6a9['filters']));_0x27afb9[_0xa0df('0x4f')][_0xa0df('0x6c')]=_0x43a2c8['id'];if(_0x17aa2a['query'][_0xa0df('0x52')]){_0x27afb9['where']=_[_0xa0df('0x50')](_0x27afb9[_0xa0df('0x4f')],{'$or':_[_0xa0df('0x40')](_0x27afb9[_0xa0df('0x48')],function(_0x45941b){var _0x2b4c14={};_0x2b4c14[_0x45941b]={'$like':'%'+_0x17aa2a[_0xa0df('0x44')][_0xa0df('0x52')]+'%'};return _0x2b4c14;})});}_0x27afb9=_[_0xa0df('0x50')]({},_0x27afb9,_0x17aa2a[_0xa0df('0x53')]);return db['CannedAnswer']['count']({'where':_0x27afb9[_0xa0df('0x4f')]})[_0xa0df('0x25')](function(_0x48327b){_0x32494d[_0xa0df('0x30')]=_0x48327b;if(_0x17aa2a[_0xa0df('0x44')][_0xa0df('0x54')]){_0x27afb9['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x27afb9);})[_0xa0df('0x25')](function(_0x3c4db4){_0x32494d[_0xa0df('0x56')]=_0x3c4db4;return _0x32494d;});}})[_0xa0df('0x25')](respondWithFilteredResult(_0x22ca19,_0x27afb9))[_0xa0df('0x2c')](handleError(_0x22ca19,null));};exports[_0xa0df('0x72')]=function(_0x24f8f5,_0x4c64d0,_0x3babf6){return db['OpenchannelAccount'][_0xa0df('0x5b')]({'where':{'id':_0x24f8f5[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x4c64d0,null))[_0xa0df('0x25')](function(_0x1b8b11){if(_0x1b8b11){return _0x1b8b11[_0xa0df('0x72')](_0x24f8f5['query'][_0xa0df('0x6e')]);}})['then'](respondWithStatusCode(_0x4c64d0,null))['catch'](handleError(_0x4c64d0,null));};exports[_0xa0df('0x73')]=function(_0x47038a,_0x1a65d7,_0x9c59a1){var _0x1f1c45={'body':_0x47038a[_0xa0df('0x5d')],'channel':_0xa0df('0x74')};var _0x1c86ba=[];var _0x494d5b=[];var _0x1806f1={};var _0xc32518=![];return db['CmContact']['describe']()[_0xa0df('0x25')](function(_0x79845a){if(!_0x79845a){throw new db[(_0xa0df('0x21'))][(_0xa0df('0x22'))]('no\x20available\x20attributes');}_0x1c86ba=_[_0xa0df('0x75')](_['keys'](_0x79845a),[_0xa0df('0x76'),_0xa0df('0x77')]);_0x494d5b=_[_0xa0df('0x75')](_[_0xa0df('0x59')](_0x79845a),[_0xa0df('0x76'),'updatedAt',_0xa0df('0x78'),_0xa0df('0x79')]);if(_0x47038a['body']['id']){delete _0x47038a['body']['id'];}if(_['isNil'](_0x47038a[_0xa0df('0x5d')]['from'])){throw new db[(_0xa0df('0x21'))]['ValidationError'](_0xa0df('0x7a'));}if(_[_0xa0df('0x7b')](_0x47038a['body'][_0xa0df('0x5d')])||_0x47038a[_0xa0df('0x5d')]['body']===''){throw new db[(_0xa0df('0x21'))][(_0xa0df('0x22'))](_0xa0df('0x7c'));}if(_[_0xa0df('0x7b')](_0x47038a[_0xa0df('0x5d')][_0xa0df('0x7d')])){throw new db['Sequelize']['ValidationError'](_0xa0df('0x7e')+_0x494d5b);}if(!_[_0xa0df('0x7f')](_0x494d5b,_0x47038a[_0xa0df('0x5d')][_0xa0df('0x7d')])){throw new db[(_0xa0df('0x21'))][(_0xa0df('0x22'))](_0xa0df('0x80')+_0x494d5b);}_0x1806f1[_0x47038a[_0xa0df('0x5d')][_0xa0df('0x7d')]]=_0x47038a[_0xa0df('0x5d')][_0xa0df('0x81')];})[_0xa0df('0x25')](function(){return db[_0xa0df('0x41')][_0xa0df('0x5b')]({'where':{'id':_0x47038a[_0xa0df('0x58')]['id']},'include':[{'model':db[_0xa0df('0x82')],'as':'List','include':[{'model':db[_0xa0df('0x83')],'as':_0xa0df('0x84'),'where':_0x1806f1,'limit':0x1,'order':[['updatedAt',_0xa0df('0x85')]]}]},{'model':db[_0xa0df('0x86')],'as':'Applications'}]});})[_0xa0df('0x25')](handleEntityNotFound(_0x1a65d7,null))[_0xa0df('0x25')](function(_0xe709ca){if(_0xe709ca&&_0xe709ca[_0xa0df('0x87')]){_0x1f1c45[_0xa0df('0x88')]=_0xe709ca;_0x1f1c45[_0xa0df('0x89')]=_0xe709ca[_0xa0df('0x8a')];_0x1f1c45[_0xa0df('0x8b')]=_0xe709ca['List'];_0x1f1c45[_0xa0df('0x89')]=_[_0xa0df('0x8c')](_0x1f1c45[_0xa0df('0x89')],[_0xa0df('0x8d')],[_0xa0df('0x8e')]);if(_0x1f1c45['account']['Applications']){delete _0x1f1c45[_0xa0df('0x88')][_0xa0df('0x8a')];}if(_0x1f1c45[_0xa0df('0x88')][_0xa0df('0x87')]&&_0x1f1c45[_0xa0df('0x88')][_0xa0df('0x87')][_0xa0df('0x84')][_0xa0df('0x4a')]){return _0x1f1c45[_0xa0df('0x88')][_0xa0df('0x87')][_0xa0df('0x84')][0x0];}var _0x5855c8=_['defaults'](_0x47038a['body'],{'firstName':_0x47038a[_0xa0df('0x5d')][_0xa0df('0x81')],'ListId':_0xe709ca[_0xa0df('0x79')]});_0x5855c8[_0x47038a[_0xa0df('0x5d')][_0xa0df('0x7d')]]=_0x47038a['body'][_0xa0df('0x81')];return db[_0xa0df('0x83')][_0xa0df('0x5c')](_0x5855c8,{'fields':_0x1c86ba,'raw':!![]});}})[_0xa0df('0x25')](handleEntityNotFound(_0x1a65d7,null))[_0xa0df('0x25')](function(_0x4f4a7d){_0x1f1c45[_0xa0df('0x8f')]=_0x4f4a7d;if(_0x4f4a7d){var _0x1966da={'ContactId':_0x4f4a7d['id'],'OpenchannelAccountId':_0x47038a[_0xa0df('0x58')]['id'],'from':(_0x4f4a7d[_0xa0df('0x90')]||'')+'\x20'+(_0x4f4a7d[_0xa0df('0x91')]||'')};var _0x4e0612={'OpenchannelAccountId':_0x47038a['params']['id'],'closed':![]};if(_0x47038a[_0xa0df('0x5d')][_0xa0df('0x92')]){_0x4e0612[_0xa0df('0x92')]=_0x47038a[_0xa0df('0x5d')][_0xa0df('0x92')];return db[_0xa0df('0x93')][_0xa0df('0x5b')]({'where':_0x4e0612})[_0xa0df('0x25')](function(_0x466b49){if(_0x466b49){return[_0x466b49,![]];}_0x1966da[_0xa0df('0x92')]=_0x47038a['body'][_0xa0df('0x92')];_0x1966da['externalUrl']=_0x47038a[_0xa0df('0x5d')][_0xa0df('0x94')];return db['OpenchannelInteraction'][_0xa0df('0x5c')](_0x1966da)[_0xa0df('0x25')](function(_0x5ea9b4){return[_0x5ea9b4,!![]];});});}else{_0x4e0612[_0xa0df('0x92')]=null;}_0x4e0612[_0xa0df('0x95')]=_0x4f4a7d['id'];return db[_0xa0df('0x93')][_0xa0df('0x5b')]({'where':_0x4e0612})[_0xa0df('0x25')](function(_0xc6325b){if(_0xc6325b){return[_0xc6325b,![]];}return db['OpenchannelInteraction'][_0xa0df('0x5c')](_0x1966da)[_0xa0df('0x25')](function(_0x31741a){return[_0x31741a,!![]];});});}})[_0xa0df('0x96')](function(_0xda5308,_0x26b2ce){if(_0xda5308){_0xc32518=_0x26b2ce;if(!_0x26b2ce){var _0x370b64={'from':(_0x1f1c45[_0xa0df('0x8f')]['firstName']||'')+'\x20'+(_0x1f1c45[_0xa0df('0x8f')][_0xa0df('0x91')]||'')};if(_0x47038a['body'][_0xa0df('0x92')]&&_0x47038a[_0xa0df('0x5d')]['messageId']&&_0x47038a[_0xa0df('0x5d')][_0xa0df('0x92')]!=_0x47038a[_0xa0df('0x5d')][_0xa0df('0x97')]){_0x370b64['threadId']=_0x47038a['body'][_0xa0df('0x97')];}return _0xda5308[_0xa0df('0x37')](_0x370b64);}else{return _0xda5308;}}})[_0xa0df('0x25')](function(_0x2364e6){_0x1f1c45['interaction']=_0x2364e6['get']({'plain':!![]});_0x1f1c45[_0xa0df('0x98')][_0xa0df('0x99')]=_0xc32518;if(_0x1f1c45['interaction'][_0xa0df('0x99')]){if(_0x1f1c45[_0xa0df('0x88')]['autoclose']){_0x1f1c45[_0xa0df('0x89')][_0xa0df('0x9a')]({'id':0x0,'priority':_0x1f1c45[_0xa0df('0x89')][_0xa0df('0x4a')]+0x1,'app':_0xa0df('0x9b'),'appdata':_0xa0df('0x9c'),'interval':_0xa0df('0x9d')});}}return db[_0xa0df('0x9e')][_0xa0df('0x5c')]({'body':_0x47038a[_0xa0df('0x5d')][_0xa0df('0x5d')],'OpenchannelAccountId':_0x47038a[_0xa0df('0x58')]['id'],'OpenchannelInteractionId':_0x2364e6['id'],'direction':'in','ContactId':_0x1f1c45[_0xa0df('0x8f')]['id'],'AttachmentId':_0x47038a[_0xa0df('0x5d')]['AttachmentId']});})[_0xa0df('0x25')](function(_0x533c2d){_0x1f1c45[_0xa0df('0x2b')]=_0x533c2d;if(_0x1f1c45['interaction'][_0xa0df('0x9f')]){return db[_0xa0df('0xa0')][_0xa0df('0x5b')]({'attributes':['id','name'],'where':{'id':_0x1f1c45[_0xa0df('0x98')][_0xa0df('0x9f')]}})[_0xa0df('0x25')](function(_0x3833b4){if(_0x3833b4){_0x1f1c45[_0xa0df('0x89')][_0xa0df('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3833b4[_0xa0df('0x3b')]+','+(_0x1f1c45[_0xa0df('0x88')][_0xa0df('0xa2')]||0xa),'interval':_0xa0df('0x9d')});_0x1f1c45[_0xa0df('0xa3')]=![];}return respondWithRpcPromise('Start',_0xa0df('0xa4'),_0x1f1c45);});}return respondWithRpcPromise(_0xa0df('0xa5'),_0xa0df('0xa4'),_0x1f1c45);})['then'](function(_0x141974){respondWithRpcPromise('EventManager',_0xa0df('0xa6'),{'event':'notify','message':_0x141974},client9002);return _0x141974;})['then'](respondWithResult(_0x1a65d7,null))[_0xa0df('0x2c')](handleError(_0x1a65d7,null));};exports[_0xa0df('0xa7')]=function(_0x2e2102,_0x5da090,_0x1d5c66){return db[_0xa0df('0x41')]['findOne']({'where':{'id':_0x2e2102[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x5da090,null))[_0xa0df('0x25')](function(_0x40f9b2){if(_0x40f9b2){return db[_0xa0df('0xa8')][_0xa0df('0xa9')](function(_0x341b77){return db[_0xa0df('0x86')][_0xa0df('0x38')]({'where':{'OpenchannelAccountId':_0x2e2102[_0xa0df('0x58')]['id']},'transaction':_0x341b77})['then'](function(_0x12a1c3){var _0x2033c5=_[_0xa0df('0x40')](_0x2e2102[_0xa0df('0x5d')],function(_0xab27d0){_0xab27d0[_0xa0df('0x6c')]=_0x2e2102[_0xa0df('0x58')]['id'];return _0xab27d0;});return db[_0xa0df('0x86')][_0xa0df('0xaa')](_0x2033c5,{'transaction':_0x341b77});});})['then'](function(){return db[_0xa0df('0x86')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2e2102['params']['id']},'order':'priority'});});}})[_0xa0df('0x25')](respondWithResult(_0x5da090,null))[_0xa0df('0x2c')](handleError(_0x5da090,null));};exports[_0xa0df('0xab')]=function(_0x4f6cca,_0x954612,_0x4e3d87){var _0x3cd1ac={};var _0x52b2ad={};var _0x6f86b3;var _0x19aa1b;return db[_0xa0df('0x41')][_0xa0df('0x6a')]({'where':{'id':_0x4f6cca[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x954612,null))['then'](function(_0x417082){if(_0x417082){_0x6f86b3=_0x417082;_0x52b2ad['model']=_[_0xa0df('0x59')](db[_0xa0df('0x86')][_0xa0df('0xac')]);_0x52b2ad[_0xa0df('0x44')]=_[_0xa0df('0x59')](_0x4f6cca[_0xa0df('0x44')]);_0x52b2ad[_0xa0df('0x45')]=_[_0xa0df('0x46')](_0x52b2ad[_0xa0df('0x47')],_0x52b2ad['query']);_0x3cd1ac['attributes']=_[_0xa0df('0x46')](_0x52b2ad['model'],qs['fields'](_0x4f6cca[_0xa0df('0x44')][_0xa0df('0x49')]));_0x3cd1ac['attributes']=_0x3cd1ac['attributes'][_0xa0df('0x4a')]?_0x3cd1ac[_0xa0df('0x48')]:_0x52b2ad[_0xa0df('0x47')];_0x3cd1ac[_0xa0df('0x4d')]=qs[_0xa0df('0x4e')](_0x4f6cca[_0xa0df('0x44')]['sort']);_0x3cd1ac['where']=qs[_0xa0df('0x45')](_[_0xa0df('0x6b')](_0x4f6cca[_0xa0df('0x44')],_0x52b2ad[_0xa0df('0x45')]));if(_0x4f6cca[_0xa0df('0x44')][_0xa0df('0x52')]){_0x3cd1ac['where']=_[_0xa0df('0x50')](_0x3cd1ac[_0xa0df('0x4f')],{'$or':_[_0xa0df('0x40')](_0x3cd1ac[_0xa0df('0x48')],function(_0x3b83b1){var _0x1b865a={};_0x1b865a[_0x3b83b1]={'$like':'%'+_0x4f6cca[_0xa0df('0x44')][_0xa0df('0x52')]+'%'};return _0x1b865a;})});}_0x3cd1ac=_['merge']({},_0x3cd1ac,_0x4f6cca[_0xa0df('0x53')]);return _0x6f86b3[_0xa0df('0xab')](_0x3cd1ac);}})[_0xa0df('0x25')](function(_0x26be63){if(_0x26be63){_0x19aa1b=_0x26be63[_0xa0df('0x4a')];if(!_0x4f6cca[_0xa0df('0x44')][_0xa0df('0x71')](_0xa0df('0x4b'))){_0x3cd1ac['limit']=qs[_0xa0df('0x4c')](_0x4f6cca['query'][_0xa0df('0x4c')]);_0x3cd1ac[_0xa0df('0x31')]=qs['offset'](_0x4f6cca[_0xa0df('0x44')][_0xa0df('0x31')]);}return _0x6f86b3[_0xa0df('0xab')](_0x3cd1ac);}})[_0xa0df('0x25')](function(_0x5c6afd){if(_0x5c6afd){return _0x5c6afd?{'count':_0x19aa1b,'rows':_0x5c6afd}:null;}})[_0xa0df('0x25')](respondWithResult(_0x954612,null))[_0xa0df('0x2c')](handleError(_0x954612,null));};exports[_0xa0df('0xad')]=function(_0x4e6297,_0x5e0563,_0x2f28ab){var _0x504666={'raw':![],'where':{}};var _0x1817c5={};var _0x20422b={'count':0x0,'rows':[]};return db[_0xa0df('0x41')][_0xa0df('0x6a')]({'where':{'id':_0x4e6297['params']['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x5e0563,null))[_0xa0df('0x25')](function(_0x3757c8){if(_0x3757c8){_0x1817c5[_0xa0df('0x47')]=_[_0xa0df('0x59')](db['OpenchannelInteraction'][_0xa0df('0xac')]);_0x1817c5[_0xa0df('0x44')]=_[_0xa0df('0x59')](_0x4e6297[_0xa0df('0x44')]);_0x1817c5[_0xa0df('0x45')]=_[_0xa0df('0x46')](_0x1817c5['model'],_0x1817c5[_0xa0df('0x44')]);_0x504666[_0xa0df('0x48')]=_['intersection'](_0x1817c5[_0xa0df('0x47')],qs[_0xa0df('0x49')](_0x4e6297[_0xa0df('0x44')][_0xa0df('0x49')]));_0x504666[_0xa0df('0x48')]=_0x504666[_0xa0df('0x48')][_0xa0df('0x4a')]?_0x504666[_0xa0df('0x48')]:_0x1817c5[_0xa0df('0x47')];if(!_0x4e6297[_0xa0df('0x44')][_0xa0df('0x71')]('nolimit')){_0x504666[_0xa0df('0x4c')]=qs[_0xa0df('0x4c')](_0x4e6297[_0xa0df('0x44')][_0xa0df('0x4c')]);_0x504666['offset']=qs['offset'](_0x4e6297[_0xa0df('0x44')][_0xa0df('0x31')]);}_0x504666[_0xa0df('0x4d')]=qs['sort'](_0x4e6297[_0xa0df('0x44')]['sort']);_0x504666[_0xa0df('0x4f')]=qs[_0xa0df('0x45')](_['pick'](_0x4e6297['query'],_0x1817c5[_0xa0df('0x45')]));_0x504666[_0xa0df('0x4f')][_0xa0df('0x6c')]=_0x3757c8['id'];if(_0x4e6297[_0xa0df('0x44')][_0xa0df('0x52')]){_0x504666[_0xa0df('0x4f')]=_['merge'](_0x504666[_0xa0df('0x4f')],{'$or':_[_0xa0df('0x40')](_0x504666[_0xa0df('0x48')],function(_0x5c483e){var _0x30390d={};_0x30390d[_0x5c483e]={'$like':'%'+_0x4e6297['query']['filter']+'%'};return _0x30390d;})});}_0x504666=_['merge']({},_0x504666,_0x4e6297[_0xa0df('0x53')]);return db['OpenchannelInteraction'][_0xa0df('0x30')]({'where':_0x504666[_0xa0df('0x4f')]})['then'](function(_0x3ae0fe){_0x20422b[_0xa0df('0x30')]=_0x3ae0fe;if(_0x4e6297[_0xa0df('0x44')][_0xa0df('0x54')]){_0x504666['include']=[{'model':db[_0xa0df('0x83')],'as':_0xa0df('0xae'),'required':![]},{'model':db[_0xa0df('0xa0')],'as':_0xa0df('0xaf'),'attributes':[_0xa0df('0x3b'),_0xa0df('0xb0'),'internal'],'required':![]},{'model':db[_0xa0df('0xb1')],'as':_0xa0df('0xb2'),'attributes':['id',_0xa0df('0x3b'),_0xa0df('0xb3')],'where':_0x4e6297[_0xa0df('0x44')][_0xa0df('0xb4')]?{'id':_0x4e6297['query'][_0xa0df('0xb4')]}:undefined,'required':_0x4e6297[_0xa0df('0x44')][_0xa0df('0xb4')]?!![]:![]}];}return db[_0xa0df('0x93')][_0xa0df('0x55')](_0x504666);})[_0xa0df('0x25')](function(_0x2541fc){_0x20422b[_0xa0df('0x56')]=_0x2541fc;return _0x20422b;});}})[_0xa0df('0x25')](respondWithFilteredResult(_0x5e0563,_0x504666))[_0xa0df('0x2c')](handleError(_0x5e0563,null));};exports[_0xa0df('0xb5')]=function(_0x3d5ce1,_0x1356e8,_0x43f2ff){return db[_0xa0df('0x41')][_0xa0df('0x5b')]({'where':{'id':_0x3d5ce1[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x1356e8,null))[_0xa0df('0x25')](function(_0x5cad26){if(_0x5cad26){return _0x5cad26[_0xa0df('0xb5')](_0x3d5ce1[_0xa0df('0x5d')]['ids'],_[_0xa0df('0xb6')](_0x3d5ce1['body'],[_0xa0df('0x6e'),'id'])||{})[_0xa0df('0x96')](function(_0x345a83){for(var _0x376ffe=0x0;_0x376ffe<_0x3d5ce1[_0xa0df('0x5d')][_0xa0df('0x6e')][_0xa0df('0x4a')];_0x376ffe+=0x1){socket[_0xa0df('0xb7')]('userOpenchannelAccount:save',{'UserId':_0x3d5ce1[_0xa0df('0x5d')][_0xa0df('0x6e')][_0x376ffe],'OpenchannelAccountId':_0x3d5ce1[_0xa0df('0x58')]['id']});}return _0x345a83;});}})['then'](respondWithResult(_0x1356e8,null))[_0xa0df('0x2c')](handleError(_0x1356e8,null));};exports['removeAgents']=function(_0x269ea0,_0x58ac3f,_0x161c4f){return db['OpenchannelAccount'][_0xa0df('0x5b')]({'where':{'id':_0x269ea0[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x58ac3f,null))[_0xa0df('0x25')](function(_0x57cd05){if(_0x57cd05){return _0x57cd05[_0xa0df('0xb8')](_0x269ea0[_0xa0df('0x44')]['ids'])[_0xa0df('0x25')](function(){if(_[_0xa0df('0xb9')](_0x269ea0[_0xa0df('0x44')]['ids'])){for(var _0xa35c7c=0x0;_0xa35c7c<_0x269ea0['query'][_0xa0df('0x6e')][_0xa0df('0x4a')];_0xa35c7c+=0x1){socket[_0xa0df('0xb7')]('userOpenchannelAccount:remove',{'UserId':Number(_0x269ea0[_0xa0df('0x44')][_0xa0df('0x6e')][_0xa35c7c]),'OpenchannelAccountId':Number(_0x269ea0['params']['id'])});}}else{socket[_0xa0df('0xb7')](_0xa0df('0xba'),{'UserId':Number(_0x269ea0['query'][_0xa0df('0x6e')]),'OpenchannelAccountId':Number(_0x269ea0[_0xa0df('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x58ac3f,null))[_0xa0df('0x2c')](handleError(_0x58ac3f,null));};exports[_0xa0df('0xbb')]=function(_0x3bf448,_0x196179,_0x193295){var _0x381f2a={};var _0x1b5ded={};var _0x23ab2d;var _0x48598e;return db[_0xa0df('0x41')][_0xa0df('0x6a')]({'where':{'id':_0x3bf448[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x196179,null))['then'](function(_0x2c93e3){if(_0x2c93e3){_0x23ab2d=_0x2c93e3;_0x1b5ded[_0xa0df('0x47')]=_['keys'](db['User'][_0xa0df('0xac')]);_0x1b5ded[_0xa0df('0x44')]=_[_0xa0df('0x59')](_0x3bf448[_0xa0df('0x44')]);_0x1b5ded['filters']=_[_0xa0df('0x46')](_0x1b5ded['model'],_0x1b5ded['query']);_0x381f2a['attributes']=_[_0xa0df('0x46')](_0x1b5ded[_0xa0df('0x47')],qs[_0xa0df('0x49')](_0x3bf448[_0xa0df('0x44')][_0xa0df('0x49')]));_0x381f2a['attributes']=_0x381f2a[_0xa0df('0x48')][_0xa0df('0x4a')]?_0x381f2a[_0xa0df('0x48')]:_0x1b5ded[_0xa0df('0x47')];_0x381f2a[_0xa0df('0x4d')]=qs[_0xa0df('0x4e')](_0x3bf448['query'][_0xa0df('0x4e')]);_0x381f2a[_0xa0df('0x4f')]=qs[_0xa0df('0x45')](_[_0xa0df('0x6b')](_0x3bf448[_0xa0df('0x44')],_0x1b5ded[_0xa0df('0x45')]));if(_0x3bf448[_0xa0df('0x44')][_0xa0df('0x52')]){_0x381f2a['where']=_[_0xa0df('0x50')](_0x381f2a['where'],{'$or':_[_0xa0df('0x40')](_0x381f2a['attributes'],function(_0x38fb45){var _0x278b65={};_0x278b65[_0x38fb45]={'$like':'%'+_0x3bf448[_0xa0df('0x44')][_0xa0df('0x52')]+'%'};return _0x278b65;})});}_0x381f2a=_[_0xa0df('0x50')]({},_0x381f2a,_0x3bf448[_0xa0df('0x53')]);return _0x23ab2d['getAgents'](_0x381f2a);}})['then'](function(_0x50109c){if(_0x50109c){_0x48598e=_0x50109c[_0xa0df('0x4a')];if(!_0x3bf448[_0xa0df('0x44')][_0xa0df('0x71')](_0xa0df('0x4b'))){_0x381f2a[_0xa0df('0x4c')]=qs['limit'](_0x3bf448[_0xa0df('0x44')][_0xa0df('0x4c')]);_0x381f2a[_0xa0df('0x31')]=qs[_0xa0df('0x31')](_0x3bf448['query'][_0xa0df('0x31')]);}return _0x23ab2d[_0xa0df('0xbb')](_0x381f2a);}})[_0xa0df('0x25')](function(_0x232fe4){if(_0x232fe4){return _0x232fe4?{'count':_0x48598e,'rows':_0x232fe4}:null;}})[_0xa0df('0x25')](respondWithResult(_0x196179,null))['catch'](handleError(_0x196179,null));};exports[_0xa0df('0x3c')]=function(_0x298cd7,_0x5dc0bb,_0x501844){var _0x5c6bec,_0x21ffec,_0x2a5163;if(_['isNil'](_0x298cd7['body']['body'])||_0x298cd7[_0xa0df('0x5d')][_0xa0df('0x5d')]===''){throw new db[(_0xa0df('0x21'))][(_0xa0df('0x22'))](_0xa0df('0x7c'));}if(_[_0xa0df('0x7b')](_0x298cd7['body']['to'])){}_0x5c6bec=_0x298cd7[_0xa0df('0x5d')]['to'];return db[_0xa0df('0x41')][_0xa0df('0x6a')]({'where':{'id':_0x298cd7[_0xa0df('0x58')]['id']}})[_0xa0df('0x25')](handleEntityNotFound(_0x5dc0bb,null))[_0xa0df('0x25')](function(_0x36973e){if(_0x36973e){return db[_0xa0df('0x41')]['find']({'where':{'id':_0x36973e['id']},'include':[{'model':db[_0xa0df('0x82')],'as':_0xa0df('0x87'),'include':[{'model':db[_0xa0df('0x83')],'as':_0xa0df('0x84'),'where':{[_0x36973e[_0xa0df('0x7d')]]:_0x5c6bec},'limit':0x1,'order':[[_0xa0df('0x77'),_0xa0df('0x85')]]}]}]})['then'](handleEntityNotFound(_0x5dc0bb,null))[_0xa0df('0x25')](function(_0x350335){if(_0x350335&&_0x350335[_0xa0df('0x87')]){_0x21ffec=_0x350335[_0xa0df('0x5f')]({'plain':!![]});if(_0x21ffec['List']&&_0x21ffec[_0xa0df('0x87')][_0xa0df('0x84')][_0xa0df('0x4a')]){return _0x21ffec[_0xa0df('0x87')][_0xa0df('0x84')][0x0];}return db[_0xa0df('0x83')][_0xa0df('0x5c')](_[_0xa0df('0x19')](_0x298cd7[_0xa0df('0x5d')],{'firstName':_0x5c6bec,[_0x350335[_0xa0df('0x7d')]]:_0x5c6bec,'phone':_0x5c6bec,'ListId':_0x21ffec[_0xa0df('0x79')]}));}})[_0xa0df('0x25')](handleEntityNotFound(_0x5dc0bb,null))['then'](function(_0x34e6b5){if(_0x34e6b5){_0x2a5163=_0x34e6b5;return db['OpenchannelInteraction'][_0xa0df('0x5b')]({'where':{'ContactId':_0x2a5163['id'],'closed':![],'OpenchannelAccountId':_0x21ffec['id']}})[_0xa0df('0x25')](function(_0x58d5a4){if(_0x58d5a4){return[_0x58d5a4,![]];}return db[_0xa0df('0x93')]['create']({'UserId':_0x298cd7[_0xa0df('0x5e')]['id'],'ContactId':_0x2a5163['id'],'OpenchannelAccountId':_0x21ffec['id'],'lastMsgDirection':'out','Messages':[_[_0xa0df('0x50')](_0x298cd7['body'],{'read':![],'body':_0x298cd7[_0xa0df('0x5d')][_0xa0df('0x5d')],'OpenchannelAccountId':_0x21ffec['id'],'UserId':_0x298cd7[_0xa0df('0x5e')]['id'],'ContactId':_0x2a5163['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xa0df('0xbc')}]})['then'](function(_0x1cba90){return[_0x1cba90,!![]];});});}})[_0xa0df('0x96')](function(_0x3ce10c,_0x4839f6){if(_0x4839f6){return _0x3ce10c;}return db['OpenchannelMessage']['create'](_[_0xa0df('0x50')](_0x298cd7['body'],{'read':![],'body':_0x298cd7['body'][_0xa0df('0x5d')],'OpenchannelAccountId':_0x21ffec['id'],'OpenchannelInteractionId':_0x3ce10c['id'],'UserId':_0x298cd7[_0xa0df('0x5e')]['id'],'ContactId':_0x2a5163['id']}))['then'](function(_0x1c551c){_0x3ce10c['dataValues']['Messages']=[];_0x3ce10c[_0xa0df('0xbd')][_0xa0df('0xbc')]['push'](_0x1c551c['dataValues']);return _0x3ce10c;});});}})[_0xa0df('0x25')](respondWithResult(_0x5dc0bb,null))[_0xa0df('0x2c')](handleError(_0x5dc0bb,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 80eec20..36a91bc 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 _0xa4e5=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','OpenchannelAccount'];(function(_0x4fadcc,_0x1b3eea){var _0x3f22d5=function(_0x5c50f5){while(--_0x5c50f5){_0x4fadcc['push'](_0x4fadcc['shift']());}};_0x3f22d5(++_0x1b3eea);}(_0xa4e5,0x126));var _0x5a4e=function(_0xaef6c1,_0x19c435){_0xaef6c1=_0xaef6c1-0x0;var _0x121419=_0xa4e5[_0xaef6c1];return _0x121419;};'use strict';var EventEmitter=require(_0x5a4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x5a4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5a4e('0x2')](0x0);var events={'afterCreate':_0x5a4e('0x3'),'afterUpdate':_0x5a4e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x343026){return function(_0x18f056,_0x20dfe2,_0x25ea81){OpenchannelAccountEvents['emit'](_0x343026+':'+_0x18f056['id'],_0x18f056);OpenchannelAccountEvents[_0x5a4e('0x5')](_0x343026,_0x18f056);_0x25ea81(null);};}for(var e in events){if(events[_0x5a4e('0x6')](e)){var event=events[e];OpenchannelAccount[_0x5a4e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xf601=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update'];(function(_0x3a9d72,_0x1fc5bb){var _0x31d77b=function(_0x260e8a){while(--_0x260e8a){_0x3a9d72['push'](_0x3a9d72['shift']());}};_0x31d77b(++_0x1fc5bb);}(_0xf601,0xca));var _0x1f60=function(_0x14175c,_0x30fce6){_0x14175c=_0x14175c-0x0;var _0x32ddb1=_0xf601[_0x14175c];return _0x32ddb1;};'use strict';var EventEmitter=require(_0x1f60('0x0'));var OpenchannelAccount=require(_0x1f60('0x1'))['db'][_0x1f60('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1f60('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1f60('0x4'),'afterDestroy':_0x1f60('0x5')};function emitEvent(_0x4ad894){return function(_0x17073d,_0x3ee711,_0x2e4d15){OpenchannelAccountEvents[_0x1f60('0x6')](_0x4ad894+':'+_0x17073d['id'],_0x17073d);OpenchannelAccountEvents[_0x1f60('0x6')](_0x4ad894,_0x17073d);_0x2e4d15(null);};}for(var e in events){if(events[_0x1f60('0x7')](e)){var event=events[e];OpenchannelAccount[_0x1f60('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 9298f2e..b74f162 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 _0x31b2=['bluebird','path','../../config/environment','./openchannelAccount.attributes','define','OpenchannelAccount','openchannel_accounts','lodash','../../config/logger','api'];(function(_0x2acb7b,_0x5e2c9f){var _0x35d8dc=function(_0x531189){while(--_0x531189){_0x2acb7b['push'](_0x2acb7b['shift']());}};_0x35d8dc(++_0x5e2c9f);}(_0x31b2,0xc5));var _0x231b=function(_0x5b174b,_0x404869){_0x5b174b=_0x5b174b-0x0;var _0x47ee37=_0x31b2[_0x5b174b];return _0x47ee37;};'use strict';var _=require(_0x231b('0x0'));var util=require('util');var logger=require(_0x231b('0x1'))(_0x231b('0x2'));var moment=require('moment');var BPromise=require(_0x231b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x231b('0x4'));var rimraf=require('rimraf');var config=require(_0x231b('0x5'));var attributes=require(_0x231b('0x6'));module['exports']=function(_0x578450,_0x5d9c12){return _0x578450[_0x231b('0x7')](_0x231b('0x8'),attributes,{'tableName':_0x231b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3518=['request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','api','moment'];(function(_0x5019e0,_0x5b41df){var _0x5c5ada=function(_0x2b6655){while(--_0x2b6655){_0x5019e0['push'](_0x5019e0['shift']());}};_0x5c5ada(++_0x5b41df);}(_0x3518,0xbc));var _0x8351=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x3518[_0x52b7b9];return _0x5b5d30;};'use strict';var _=require(_0x8351('0x0'));var util=require(_0x8351('0x1'));var logger=require('../../config/logger')(_0x8351('0x2'));var moment=require(_0x8351('0x3'));var BPromise=require('bluebird');var rp=require(_0x8351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8351('0x5'));var config=require(_0x8351('0x6'));var attributes=require(_0x8351('0x7'));module[_0x8351('0x8')]=function(_0x155685,_0x66e994){return _0x155685[_0x8351('0x9')](_0x8351('0xa'),attributes,{'tableName':_0x8351('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 22f7c4f..c3fba45 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 _0x5b85=['request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x16cf9e,_0x3d3cfd){var _0x56aefd=function(_0x24d46e){while(--_0x24d46e){_0x16cf9e['push'](_0x16cf9e['shift']());}};_0x56aefd(++_0x3d3cfd);}(_0x5b85,0x1b1));var _0x55b8=function(_0x2e1f4b,_0x50cf40){_0x2e1f4b=_0x2e1f4b-0x0;var _0x39f78e=_0x5b85[_0x2e1f4b];return _0x39f78e;};'use strict';var _=require(_0x55b8('0x0'));var util=require(_0x55b8('0x1'));var moment=require(_0x55b8('0x2'));var BPromise=require('bluebird');var rs=require(_0x55b8('0x3'));var fs=require('fs');var Redis=require(_0x55b8('0x4'));var db=require(_0x55b8('0x5'))['db'];var utils=require(_0x55b8('0x6'));var logger=require(_0x55b8('0x7'))(_0x55b8('0x8'));var config=require(_0x55b8('0x9'));var jayson=require(_0x55b8('0xa'));var client=jayson[_0x55b8('0xb')][_0x55b8('0xc')]({'port':0x232a});config['redis']=_[_0x55b8('0xd')](config[_0x55b8('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55b8('0xe')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5edc4b,_0x551eb7,_0x3bda4b){return new BPromise(function(_0x167ecc,_0x398c89){return client[_0x55b8('0xf')](_0x5edc4b,_0x3bda4b)[_0x55b8('0x10')](function(_0x118b7e){logger[_0x55b8('0x11')](_0x55b8('0x12'),_0x551eb7,'request\x20sent');logger[_0x55b8('0x13')](_0x55b8('0x14'),_0x551eb7,_0x55b8('0x15'),JSON[_0x55b8('0x16')](_0x118b7e));if(_0x118b7e['error']){if(_0x118b7e[_0x55b8('0x17')][_0x55b8('0x18')]===0x1f4){logger[_0x55b8('0x17')](_0x55b8('0x12'),_0x551eb7,_0x118b7e[_0x55b8('0x17')][_0x55b8('0x19')]);return _0x398c89(_0x118b7e[_0x55b8('0x17')]['message']);}logger[_0x55b8('0x17')](_0x55b8('0x12'),_0x551eb7,_0x118b7e[_0x55b8('0x17')]['message']);return _0x167ecc(_0x118b7e[_0x55b8('0x17')][_0x55b8('0x19')]);}else{logger[_0x55b8('0x11')](_0x55b8('0x12'),_0x551eb7,_0x55b8('0x15'));_0x167ecc(_0x118b7e[_0x55b8('0x1a')]['message']);}})[_0x55b8('0x1b')](function(_0x2fe509){logger[_0x55b8('0x17')](_0x55b8('0x12'),_0x551eb7,_0x2fe509);_0x398c89(_0x2fe509);});});} \ No newline at end of file +var _0xd9de=['debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','request\x20sent'];(function(_0x5103a4,_0x4b7f5c){var _0x4f99e0=function(_0x1fb571){while(--_0x1fb571){_0x5103a4['push'](_0x5103a4['shift']());}};_0x4f99e0(++_0x4b7f5c);}(_0xd9de,0xe0));var _0xed9d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd9de[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xed9d('0x0'));var util=require(_0xed9d('0x1'));var moment=require(_0xed9d('0x2'));var BPromise=require(_0xed9d('0x3'));var rs=require(_0xed9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed9d('0x5'))(_0xed9d('0x6'));var config=require(_0xed9d('0x7'));var jayson=require(_0xed9d('0x8'));var client=jayson['client'][_0xed9d('0x9')]({'port':0x232a});config[_0xed9d('0xa')]=_[_0xed9d('0xb')](config[_0xed9d('0xa')],{'host':_0xed9d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xed9d('0xd'))[_0xed9d('0xe')](socket);function respondWithRpcPromise(_0x447910,_0x45c662,_0x1e356f){return new BPromise(function(_0x1db6ba,_0x1f5448){return client[_0xed9d('0xf')](_0x447910,_0x1e356f)[_0xed9d('0x10')](function(_0x15f92c){logger[_0xed9d('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x45c662,_0xed9d('0x12'));logger[_0xed9d('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x45c662,'request\x20sent',JSON[_0xed9d('0x14')](_0x15f92c));if(_0x15f92c[_0xed9d('0x15')]){if(_0x15f92c[_0xed9d('0x15')][_0xed9d('0x16')]===0x1f4){logger[_0xed9d('0x15')](_0xed9d('0x17'),_0x45c662,_0x15f92c[_0xed9d('0x15')][_0xed9d('0x18')]);return _0x1f5448(_0x15f92c['error'][_0xed9d('0x18')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x45c662,_0x15f92c[_0xed9d('0x15')]['message']);return _0x1db6ba(_0x15f92c[_0xed9d('0x15')][_0xed9d('0x18')]);}else{logger[_0xed9d('0x11')](_0xed9d('0x17'),_0x45c662,_0xed9d('0x12'));_0x1db6ba(_0x15f92c[_0xed9d('0x19')][_0xed9d('0x18')]);}})[_0xed9d('0x1a')](function(_0x37db40){logger[_0xed9d('0x15')](_0xed9d('0x17'),_0x45c662,_0x37db40);_0x1f5448(_0x37db40);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ca86fa3..dcf48af 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 _0x7de8=['remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x3a718e,_0x539ce1){var _0x2ae147=function(_0x1c7cee){while(--_0x1c7cee){_0x3a718e['push'](_0x3a718e['shift']());}};_0x2ae147(++_0x539ce1);}(_0x7de8,0x127));var _0x87de=function(_0x2e8218,_0x55f4b5){_0x2e8218=_0x2e8218-0x0;var _0x56379c=_0x7de8[_0x2e8218];return _0x56379c;};'use strict';var OpenchannelAccountEvents=require(_0x87de('0x0'));var events=[_0x87de('0x1'),_0x87de('0x2'),_0x87de('0x3')];function createListener(_0x501a74,_0x301c51){return function(_0x121fb8){_0x301c51[_0x87de('0x4')](_0x501a74,_0x121fb8);};}function removeListener(_0x5e6f04,_0xa9a960){return function(){OpenchannelAccountEvents[_0x87de('0x5')](_0x5e6f04,_0xa9a960);};}exports[_0x87de('0x6')]=function(_0x4f5e78){for(var _0x317fa3=0x0,_0x213880=events[_0x87de('0x7')];_0x317fa3<_0x213880;_0x317fa3++){var _0xd772b6=events[_0x317fa3];var _0x197e2a=createListener(_0x87de('0x8')+_0xd772b6,_0x4f5e78);OpenchannelAccountEvents['on'](_0xd772b6,_0x197e2a);}}; \ No newline at end of file +var _0x569b=['update','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x2a4bc0,_0x4b2c3c){var _0x20f5fc=function(_0x5e93f0){while(--_0x5e93f0){_0x2a4bc0['push'](_0x2a4bc0['shift']());}};_0x20f5fc(++_0x4b2c3c);}(_0x569b,0x1a3));var _0xb569=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x569b[_0x4b2436];return _0x4f5ab2;};'use strict';var OpenchannelAccountEvents=require(_0xb569('0x0'));var events=['save','remove',_0xb569('0x1')];function createListener(_0x417bd5,_0x8e1382){return function(_0x1c9f43){_0x8e1382['emit'](_0x417bd5,_0x1c9f43);};}function removeListener(_0x5389b5,_0x2dccb6){return function(){OpenchannelAccountEvents[_0xb569('0x2')](_0x5389b5,_0x2dccb6);};}exports[_0xb569('0x3')]=function(_0x298c34){for(var _0x77f6ab=0x0,_0xca8700=events[_0xb569('0x4')];_0x77f6ab<_0xca8700;_0x77f6ab++){var _0x4cec30=events[_0x77f6ab];var _0x29edb2=createListener(_0xb569('0x5')+_0x4cec30,_0x298c34);OpenchannelAccountEvents['on'](_0x4cec30,_0x29edb2);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 08afded..dfac7dd 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 _0x2e0a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x56aa66,_0x1ddf52){var _0xeba9ff=function(_0x5467b5){while(--_0x5467b5){_0x56aa66['push'](_0x56aa66['shift']());}};_0xeba9ff(++_0x1ddf52);}(_0x2e0a,0xbb));var _0xa2e0=function(_0x2e793f,_0x60ce6f){_0x2e793f=_0x2e793f-0x0;var _0x39dd44=_0x2e0a[_0x2e793f];return _0x39dd44;};'use strict';var multer=require(_0xa2e0('0x0'));var util=require(_0xa2e0('0x1'));var path=require(_0xa2e0('0x2'));var timeout=require(_0xa2e0('0x3'));var express=require(_0xa2e0('0x4'));var router=express[_0xa2e0('0x5')]();var auth=require(_0xa2e0('0x6'));var interaction=require(_0xa2e0('0x7'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xa2e0('0x8')]('/',auth[_0xa2e0('0x9')](),controller['index']);router[_0xa2e0('0x8')](_0xa2e0('0xa'),auth[_0xa2e0('0x9')](),controller[_0xa2e0('0xb')]);router[_0xa2e0('0xc')]('/',auth[_0xa2e0('0x9')](),controller[_0xa2e0('0xd')]);router[_0xa2e0('0xe')](_0xa2e0('0xa'),auth[_0xa2e0('0x9')](),controller[_0xa2e0('0xf')]);router[_0xa2e0('0x10')](_0xa2e0('0xa'),auth[_0xa2e0('0x9')](),controller[_0xa2e0('0x11')]);module[_0xa2e0('0x12')]=router; \ No newline at end of file +var _0x52ae=['../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x556653,_0x5047a3){var _0x27529a=function(_0x3597ab){while(--_0x3597ab){_0x556653['push'](_0x556653['shift']());}};_0x27529a(++_0x5047a3);}(_0x52ae,0x162));var _0xe52a=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x52ae[_0x4017b0];return _0x5ed4f7;};'use strict';var multer=require(_0xe52a('0x0'));var util=require(_0xe52a('0x1'));var path=require(_0xe52a('0x2'));var timeout=require(_0xe52a('0x3'));var express=require(_0xe52a('0x4'));var router=express[_0xe52a('0x5')]();var auth=require(_0xe52a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe52a('0x7'));var controller=require(_0xe52a('0x8'));router[_0xe52a('0x9')]('/',auth[_0xe52a('0xa')](),controller[_0xe52a('0xb')]);router[_0xe52a('0x9')](_0xe52a('0xc'),auth[_0xe52a('0xa')](),controller[_0xe52a('0xd')]);router[_0xe52a('0xe')]('/',auth[_0xe52a('0xa')](),controller[_0xe52a('0xf')]);router[_0xe52a('0x10')]('/:id',auth[_0xe52a('0xa')](),controller['update']);router[_0xe52a('0x11')](_0xe52a('0xc'),auth[_0xe52a('0xa')](),controller[_0xe52a('0x12')]);module[_0xe52a('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 6b89596..e46d5ec 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 _0x6118=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x59b8c1,_0x4cc897){var _0x16473c=function(_0xd37e02){while(--_0xd37e02){_0x59b8c1['push'](_0x59b8c1['shift']());}};_0x16473c(++_0x4cc897);}(_0x6118,0x1a7));var _0x8611=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0x6118[_0x53ddab];return _0x5819ac;};'use strict';var Sequelize=require(_0x8611('0x0'));module[_0x8611('0x1')]={'priority':{'type':Sequelize[_0x8611('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8611('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8611('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8611('0x3')],'defaultValue':_0x8611('0x5')}}; \ No newline at end of file +var _0x631d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x86801e,_0x349578){var _0x161951=function(_0x59eb55){while(--_0x59eb55){_0x86801e['push'](_0x86801e['shift']());}};_0x161951(++_0x349578);}(_0x631d,0x90));var _0xd631=function(_0x201ab2,_0x19ba32){_0x201ab2=_0x201ab2-0x0;var _0x440db9=_0x631d[_0x201ab2];return _0x440db9;};'use strict';var Sequelize=require(_0xd631('0x0'));module[_0xd631('0x1')]={'priority':{'type':Sequelize[_0xd631('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd631('0x3')],'allowNull':![],'defaultValue':_0xd631('0x4')},'appdata':{'type':Sequelize[_0xd631('0x5')]()},'description':{'type':Sequelize[_0xd631('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd631('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index bdbe58c..d65ddb3 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 _0xfd6a=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1c8eb3,_0x5aecbd){var _0x258d7c=function(_0x20eac1){while(--_0x20eac1){_0x1c8eb3['push'](_0x1c8eb3['shift']());}};_0x258d7c(++_0x5aecbd);}(_0xfd6a,0x1a4));var _0xafd6=function(_0x1007b8,_0xe9ec48){_0x1007b8=_0x1007b8-0x0;var _0x22e865=_0xfd6a[_0x1007b8];return _0x22e865;};'use strict';var pdf=require(_0xafd6('0x0'));var emlformat=require(_0xafd6('0x1'));var rimraf=require(_0xafd6('0x2'));var zipdir=require(_0xafd6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafd6('0x4'));var moment=require('moment');var BPromise=require(_0xafd6('0x5'));var Mustache=require('mustache');var util=require(_0xafd6('0x6'));var path=require(_0xafd6('0x7'));var sox=require(_0xafd6('0x8'));var csv=require(_0xafd6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xafd6('0xa'));var squel=require('squel');var crypto=require(_0xafd6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xafd6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xafd6('0xd'));var Redis=require(_0xafd6('0xe'));var authService=require(_0xafd6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xafd6('0x10'));var hardwareService=require(_0xafd6('0x11'));var logger=require(_0xafd6('0x12'))(_0xafd6('0x13'));var utils=require('../../config/utils');var config=require(_0xafd6('0x14'));var db=require(_0xafd6('0x15'))['db'];function respondWithStatusCode(_0x49efcf,_0x4cedea){_0x4cedea=_0x4cedea||0xcc;return function(_0x541b1f){if(_0x541b1f){return _0x49efcf[_0xafd6('0x16')](_0x4cedea);}return _0x49efcf[_0xafd6('0x17')](_0x4cedea)['end']();};}function respondWithResult(_0x5a3a98,_0x2ad207){_0x2ad207=_0x2ad207||0xc8;return function(_0x591461){if(_0x591461){return _0x5a3a98['status'](_0x2ad207)[_0xafd6('0x18')](_0x591461);}};}function respondWithFilteredResult(_0xb527a4,_0x5242c3){return function(_0x2b7e4d){if(_0x2b7e4d){var _0x39884f=_0x2b7e4d[_0xafd6('0x19')],_0x35d70b=_0x5242c3[_0xafd6('0x1a')],_0x2df65d=_0x5242c3[_0xafd6('0x1a')]+_0x5242c3[_0xafd6('0x1b')],_0x409e31;if(_0x2df65d>=_0x39884f){_0x2df65d=_0x39884f;_0x409e31=0xc8;}else{_0x409e31=0xce;}_0xb527a4[_0xafd6('0x17')](_0x409e31);return _0xb527a4[_0xafd6('0x1c')](_0xafd6('0x1d'),_0x35d70b+'-'+_0x2df65d+'/'+_0x39884f)['json'](_0x2b7e4d);}return null;};}function patchUpdates(_0x28b423){return function(_0x57c02d){try{jsonpatch[_0xafd6('0x1e')](_0x57c02d,_0x28b423,!![]);}catch(_0x1d7d48){return BPromise[_0xafd6('0x1f')](_0x1d7d48);}return _0x57c02d[_0xafd6('0x20')]();};}function saveUpdates(_0x4843b6,_0xe66091){return function(_0x10ab39){if(_0x10ab39){return _0x10ab39[_0xafd6('0x21')](_0x4843b6)[_0xafd6('0x22')](function(_0x2f4af9){return _0x2f4af9;});}return null;};}function removeEntity(_0x8b7d67,_0x4496a2){return function(_0x35471b){if(_0x35471b){return _0x35471b['destroy']()[_0xafd6('0x22')](function(){_0x8b7d67[_0xafd6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270e39,_0x447c58){return function(_0x21f262){if(!_0x21f262){_0x270e39[_0xafd6('0x16')](0x194);}return _0x21f262;};}function handleError(_0x1651f7,_0x4c0d05){_0x4c0d05=_0x4c0d05||0x1f4;return function(_0x2a77a1){logger[_0xafd6('0x23')](_0x2a77a1[_0xafd6('0x24')]);if(_0x2a77a1[_0xafd6('0x25')]){delete _0x2a77a1[_0xafd6('0x25')];}_0x1651f7['status'](_0x4c0d05)[_0xafd6('0x26')](_0x2a77a1);};}exports['index']=function(_0x319065,_0x3ca7a4){var _0x5ca2c1={},_0xa8501c={},_0x3cdd89={'count':0x0,'rows':[]};var _0xcef358=_[_0xafd6('0x27')](db[_0xafd6('0x28')][_0xafd6('0x29')],function(_0x2adaf0){return{'name':_0x2adaf0[_0xafd6('0x2a')],'type':_0x2adaf0['type'][_0xafd6('0x2b')]};});_0xa8501c[_0xafd6('0x2c')]=_['map'](_0xcef358,'name');_0xa8501c[_0xafd6('0x2d')]=_[_0xafd6('0x2e')](_0x319065['query']);_0xa8501c[_0xafd6('0x2f')]=_[_0xafd6('0x30')](_0xa8501c[_0xafd6('0x2c')],_0xa8501c['query']);_0x5ca2c1[_0xafd6('0x31')]=_[_0xafd6('0x30')](_0xa8501c[_0xafd6('0x2c')],qs[_0xafd6('0x32')](_0x319065[_0xafd6('0x2d')][_0xafd6('0x32')]));_0x5ca2c1[_0xafd6('0x31')]=_0x5ca2c1[_0xafd6('0x31')][_0xafd6('0x33')]?_0x5ca2c1['attributes']:_0xa8501c[_0xafd6('0x2c')];if(!_0x319065[_0xafd6('0x2d')]['hasOwnProperty'](_0xafd6('0x34'))){_0x5ca2c1[_0xafd6('0x1b')]=qs[_0xafd6('0x1b')](_0x319065['query']['limit']);_0x5ca2c1[_0xafd6('0x1a')]=qs[_0xafd6('0x1a')](_0x319065[_0xafd6('0x2d')][_0xafd6('0x1a')]);}_0x5ca2c1[_0xafd6('0x35')]=qs[_0xafd6('0x36')](_0x319065['query'][_0xafd6('0x36')]);_0x5ca2c1[_0xafd6('0x37')]=qs[_0xafd6('0x2f')](_[_0xafd6('0x38')](_0x319065[_0xafd6('0x2d')],_0xa8501c['filters']),_0xcef358);if(_0x319065[_0xafd6('0x2d')][_0xafd6('0x39')]){_0x5ca2c1['where']=_[_0xafd6('0x3a')](_0x5ca2c1[_0xafd6('0x37')],{'$or':_[_0xafd6('0x27')](_0xcef358,function(_0x1aea63){if(_0x1aea63[_0xafd6('0x3b')]!==_0xafd6('0x3c')){var _0x16dd63={};_0x16dd63[_0x1aea63[_0xafd6('0x25')]]={'$like':'%'+_0x319065[_0xafd6('0x2d')][_0xafd6('0x39')]+'%'};return _0x16dd63;}})});}_0x5ca2c1=_[_0xafd6('0x3a')]({},_0x5ca2c1,_0x319065[_0xafd6('0x3d')]);var _0x3d1100={'where':_0x5ca2c1[_0xafd6('0x37')]};return db[_0xafd6('0x28')]['count'](_0x3d1100)['then'](function(_0x3530c2){_0x3cdd89[_0xafd6('0x19')]=_0x3530c2;if(_0x319065[_0xafd6('0x2d')][_0xafd6('0x3e')]){_0x5ca2c1[_0xafd6('0x3f')]=[{'all':!![]}];}return db[_0xafd6('0x28')][_0xafd6('0x40')](_0x5ca2c1);})[_0xafd6('0x22')](function(_0x9db733){_0x3cdd89[_0xafd6('0x41')]=_0x9db733;return _0x3cdd89;})[_0xafd6('0x22')](respondWithFilteredResult(_0x3ca7a4,_0x5ca2c1))[_0xafd6('0x42')](handleError(_0x3ca7a4,null));};exports[_0xafd6('0x43')]=function(_0x37a4f9,_0x4f9c05){var _0x56f01b={'raw':!![],'where':{'id':_0x37a4f9['params']['id']}},_0x9c7883={};_0x9c7883[_0xafd6('0x2c')]=_[_0xafd6('0x2e')](db[_0xafd6('0x28')][_0xafd6('0x29')]);_0x9c7883[_0xafd6('0x2d')]=_[_0xafd6('0x2e')](_0x37a4f9[_0xafd6('0x2d')]);_0x9c7883[_0xafd6('0x2f')]=_[_0xafd6('0x30')](_0x9c7883[_0xafd6('0x2c')],_0x9c7883[_0xafd6('0x2d')]);_0x56f01b[_0xafd6('0x31')]=_[_0xafd6('0x30')](_0x9c7883[_0xafd6('0x2c')],qs[_0xafd6('0x32')](_0x37a4f9['query'][_0xafd6('0x32')]));_0x56f01b['attributes']=_0x56f01b[_0xafd6('0x31')][_0xafd6('0x33')]?_0x56f01b[_0xafd6('0x31')]:_0x9c7883[_0xafd6('0x2c')];if(_0x37a4f9[_0xafd6('0x2d')][_0xafd6('0x3e')]){_0x56f01b['include']=[{'all':!![]}];}_0x56f01b=_[_0xafd6('0x3a')]({},_0x56f01b,_0x37a4f9[_0xafd6('0x3d')]);return db[_0xafd6('0x28')][_0xafd6('0x44')](_0x56f01b)[_0xafd6('0x22')](handleEntityNotFound(_0x4f9c05,null))[_0xafd6('0x22')](respondWithResult(_0x4f9c05,null))[_0xafd6('0x42')](handleError(_0x4f9c05,null));};exports['create']=function(_0x4894b8,_0x394d5d){return db[_0xafd6('0x28')][_0xafd6('0x45')](_0x4894b8['body'],{})[_0xafd6('0x22')](respondWithResult(_0x394d5d,0xc9))[_0xafd6('0x42')](handleError(_0x394d5d,null));};exports[_0xafd6('0x21')]=function(_0x68ad9a,_0x5859a8){if(_0x68ad9a['body']['id']){delete _0x68ad9a[_0xafd6('0x46')]['id'];}return db[_0xafd6('0x28')]['find']({'where':{'id':_0x68ad9a[_0xafd6('0x47')]['id']}})[_0xafd6('0x22')](handleEntityNotFound(_0x5859a8,null))[_0xafd6('0x22')](saveUpdates(_0x68ad9a[_0xafd6('0x46')],null))[_0xafd6('0x22')](respondWithResult(_0x5859a8,null))[_0xafd6('0x42')](handleError(_0x5859a8,null));};exports[_0xafd6('0x48')]=function(_0x59d48d,_0x143ccf){return db[_0xafd6('0x28')][_0xafd6('0x44')]({'where':{'id':_0x59d48d[_0xafd6('0x47')]['id']}})[_0xafd6('0x22')](handleEntityNotFound(_0x143ccf,null))[_0xafd6('0x22')](removeEntity(_0x143ccf,null))[_0xafd6('0x42')](handleError(_0x143ccf,null));}; \ No newline at end of file +var _0xb99d=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','OpenchannelApplication','findAll','rows','catch','params','fields','length','includeAll','include','create','body','find','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash'];(function(_0x3c7869,_0x207240){var _0x23bc0b=function(_0x1d5f28){while(--_0x1d5f28){_0x3c7869['push'](_0x3c7869['shift']());}};_0x23bc0b(++_0x207240);}(_0xb99d,0x89));var _0xdb99=function(_0x210b93,_0x133e6d){_0x210b93=_0x210b93-0x0;var _0x2b020f=_0xb99d[_0x210b93];return _0x2b020f;};'use strict';var pdf=require(_0xdb99('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb99('0x1'));var zipdir=require(_0xdb99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb99('0x3'));var moment=require(_0xdb99('0x4'));var BPromise=require(_0xdb99('0x5'));var Mustache=require('mustache');var util=require(_0xdb99('0x6'));var path=require(_0xdb99('0x7'));var sox=require('sox');var csv=require(_0xdb99('0x8'));var ejs=require(_0xdb99('0x9'));var fs=require('fs');var _=require(_0xdb99('0xa'));var squel=require(_0xdb99('0xb'));var crypto=require(_0xdb99('0xc'));var jsforce=require(_0xdb99('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdb99('0x8'));var querystring=require(_0xdb99('0xe'));var Papa=require(_0xdb99('0xf'));var Redis=require(_0xdb99('0x10'));var authService=require(_0xdb99('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb99('0x12'));var hardwareService=require(_0xdb99('0x13'));var logger=require('../../config/logger')(_0xdb99('0x14'));var utils=require(_0xdb99('0x15'));var config=require(_0xdb99('0x16'));var db=require(_0xdb99('0x17'))['db'];function respondWithStatusCode(_0x26fe1d,_0x250b65){_0x250b65=_0x250b65||0xcc;return function(_0x2bf7ba){if(_0x2bf7ba){return _0x26fe1d['sendStatus'](_0x250b65);}return _0x26fe1d[_0xdb99('0x18')](_0x250b65)[_0xdb99('0x19')]();};}function respondWithResult(_0x121be6,_0x351307){_0x351307=_0x351307||0xc8;return function(_0x32ed72){if(_0x32ed72){return _0x121be6['status'](_0x351307)[_0xdb99('0x1a')](_0x32ed72);}};}function respondWithFilteredResult(_0x4cb76d,_0xfa4ba7){return function(_0xc197ff){if(_0xc197ff){var _0x3e3ada=_0xc197ff[_0xdb99('0x1b')],_0x238421=_0xfa4ba7[_0xdb99('0x1c')],_0x3f9d80=_0xfa4ba7[_0xdb99('0x1c')]+_0xfa4ba7[_0xdb99('0x1d')],_0x3bd65c;if(_0x3f9d80>=_0x3e3ada){_0x3f9d80=_0x3e3ada;_0x3bd65c=0xc8;}else{_0x3bd65c=0xce;}_0x4cb76d[_0xdb99('0x18')](_0x3bd65c);return _0x4cb76d[_0xdb99('0x1e')](_0xdb99('0x1f'),_0x238421+'-'+_0x3f9d80+'/'+_0x3e3ada)[_0xdb99('0x1a')](_0xc197ff);}return null;};}function patchUpdates(_0x5d1b19){return function(_0x178cdc){try{jsonpatch[_0xdb99('0x20')](_0x178cdc,_0x5d1b19,!![]);}catch(_0x49da63){return BPromise[_0xdb99('0x21')](_0x49da63);}return _0x178cdc[_0xdb99('0x22')]();};}function saveUpdates(_0x3903d5,_0x383f0d){return function(_0x3591b6){if(_0x3591b6){return _0x3591b6['update'](_0x3903d5)[_0xdb99('0x23')](function(_0x3d4294){return _0x3d4294;});}return null;};}function removeEntity(_0x47a7e2,_0x2313cd){return function(_0x4996c5){if(_0x4996c5){return _0x4996c5[_0xdb99('0x24')]()[_0xdb99('0x23')](function(){_0x47a7e2[_0xdb99('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a198a,_0x13afb6){return function(_0xa03054){if(!_0xa03054){_0x5a198a[_0xdb99('0x25')](0x194);}return _0xa03054;};}function handleError(_0x479e9a,_0x4da64c){_0x4da64c=_0x4da64c||0x1f4;return function(_0x4750d7){logger[_0xdb99('0x26')](_0x4750d7[_0xdb99('0x27')]);if(_0x4750d7[_0xdb99('0x28')]){delete _0x4750d7['name'];}_0x479e9a['status'](_0x4da64c)[_0xdb99('0x29')](_0x4750d7);};}exports[_0xdb99('0x2a')]=function(_0x7e124b,_0x9318f3){var _0x5bd56e={},_0xbadf63={},_0x209391={'count':0x0,'rows':[]};var _0x2fe800=_[_0xdb99('0x2b')](db['OpenchannelApplication'][_0xdb99('0x2c')],function(_0x3891fe){return{'name':_0x3891fe[_0xdb99('0x2d')],'type':_0x3891fe['type'][_0xdb99('0x2e')]};});_0xbadf63['model']=_[_0xdb99('0x2b')](_0x2fe800,_0xdb99('0x28'));_0xbadf63[_0xdb99('0x2f')]=_[_0xdb99('0x30')](_0x7e124b[_0xdb99('0x2f')]);_0xbadf63[_0xdb99('0x31')]=_[_0xdb99('0x32')](_0xbadf63[_0xdb99('0x33')],_0xbadf63[_0xdb99('0x2f')]);_0x5bd56e[_0xdb99('0x34')]=_[_0xdb99('0x32')](_0xbadf63[_0xdb99('0x33')],qs['fields'](_0x7e124b['query']['fields']));_0x5bd56e[_0xdb99('0x34')]=_0x5bd56e['attributes']['length']?_0x5bd56e[_0xdb99('0x34')]:_0xbadf63['model'];if(!_0x7e124b[_0xdb99('0x2f')][_0xdb99('0x35')]('nolimit')){_0x5bd56e['limit']=qs[_0xdb99('0x1d')](_0x7e124b['query']['limit']);_0x5bd56e[_0xdb99('0x1c')]=qs[_0xdb99('0x1c')](_0x7e124b[_0xdb99('0x2f')][_0xdb99('0x1c')]);}_0x5bd56e[_0xdb99('0x36')]=qs[_0xdb99('0x37')](_0x7e124b[_0xdb99('0x2f')]['sort']);_0x5bd56e['where']=qs['filters'](_[_0xdb99('0x38')](_0x7e124b['query'],_0xbadf63[_0xdb99('0x31')]),_0x2fe800);if(_0x7e124b[_0xdb99('0x2f')][_0xdb99('0x39')]){_0x5bd56e['where']=_[_0xdb99('0x3a')](_0x5bd56e[_0xdb99('0x3b')],{'$or':_['map'](_0x2fe800,function(_0x11e356){if(_0x11e356['type']!==_0xdb99('0x3c')){var _0x24b8e2={};_0x24b8e2[_0x11e356['name']]={'$like':'%'+_0x7e124b[_0xdb99('0x2f')][_0xdb99('0x39')]+'%'};return _0x24b8e2;}})});}_0x5bd56e=_[_0xdb99('0x3a')]({},_0x5bd56e,_0x7e124b[_0xdb99('0x3d')]);var _0x5c4394={'where':_0x5bd56e[_0xdb99('0x3b')]};return db[_0xdb99('0x3e')][_0xdb99('0x1b')](_0x5c4394)[_0xdb99('0x23')](function(_0x133b17){_0x209391[_0xdb99('0x1b')]=_0x133b17;if(_0x7e124b['query']['includeAll']){_0x5bd56e['include']=[{'all':!![]}];}return db[_0xdb99('0x3e')][_0xdb99('0x3f')](_0x5bd56e);})[_0xdb99('0x23')](function(_0x46a510){_0x209391[_0xdb99('0x40')]=_0x46a510;return _0x209391;})['then'](respondWithFilteredResult(_0x9318f3,_0x5bd56e))[_0xdb99('0x41')](handleError(_0x9318f3,null));};exports['show']=function(_0x2d3a47,_0x2d947a){var _0x265bf9={'raw':!![],'where':{'id':_0x2d3a47[_0xdb99('0x42')]['id']}},_0x22efac={};_0x22efac[_0xdb99('0x33')]=_['keys'](db[_0xdb99('0x3e')]['rawAttributes']);_0x22efac[_0xdb99('0x2f')]=_['keys'](_0x2d3a47[_0xdb99('0x2f')]);_0x22efac['filters']=_[_0xdb99('0x32')](_0x22efac[_0xdb99('0x33')],_0x22efac[_0xdb99('0x2f')]);_0x265bf9[_0xdb99('0x34')]=_[_0xdb99('0x32')](_0x22efac[_0xdb99('0x33')],qs[_0xdb99('0x43')](_0x2d3a47[_0xdb99('0x2f')]['fields']));_0x265bf9[_0xdb99('0x34')]=_0x265bf9['attributes'][_0xdb99('0x44')]?_0x265bf9['attributes']:_0x22efac[_0xdb99('0x33')];if(_0x2d3a47[_0xdb99('0x2f')][_0xdb99('0x45')]){_0x265bf9[_0xdb99('0x46')]=[{'all':!![]}];}_0x265bf9=_[_0xdb99('0x3a')]({},_0x265bf9,_0x2d3a47[_0xdb99('0x3d')]);return db[_0xdb99('0x3e')]['find'](_0x265bf9)['then'](handleEntityNotFound(_0x2d947a,null))[_0xdb99('0x23')](respondWithResult(_0x2d947a,null))[_0xdb99('0x41')](handleError(_0x2d947a,null));};exports[_0xdb99('0x47')]=function(_0x399955,_0x369495){return db['OpenchannelApplication']['create'](_0x399955[_0xdb99('0x48')],{})[_0xdb99('0x23')](respondWithResult(_0x369495,0xc9))[_0xdb99('0x41')](handleError(_0x369495,null));};exports['update']=function(_0x599a46,_0x191c17){if(_0x599a46[_0xdb99('0x48')]['id']){delete _0x599a46[_0xdb99('0x48')]['id'];}return db[_0xdb99('0x3e')][_0xdb99('0x49')]({'where':{'id':_0x599a46['params']['id']}})['then'](handleEntityNotFound(_0x191c17,null))[_0xdb99('0x23')](saveUpdates(_0x599a46['body'],null))['then'](respondWithResult(_0x191c17,null))[_0xdb99('0x41')](handleError(_0x191c17,null));};exports[_0xdb99('0x24')]=function(_0x14ee68,_0x47e8a1){return db[_0xdb99('0x3e')][_0xdb99('0x49')]({'where':{'id':_0x14ee68[_0xdb99('0x42')]['id']}})[_0xdb99('0x23')](handleEntityNotFound(_0x47e8a1,null))[_0xdb99('0x23')](removeEntity(_0x47e8a1,null))[_0xdb99('0x41')](handleError(_0x47e8a1,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ca236a9..3984a04 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 _0x60bd=['util','api','request-promise','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x60bd,0x1e9));var _0xd60b=function(_0x878ef3,_0x30a4c7){_0x878ef3=_0x878ef3-0x0;var _0xa0aeea=_0x60bd[_0x878ef3];return _0xa0aeea;};'use strict';var _=require(_0xd60b('0x0'));var util=require(_0xd60b('0x1'));var logger=require('../../config/logger')(_0xd60b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd60b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd60b('0x4'));module['exports']=function(_0xf1e1b0,_0x1183a2){return _0xf1e1b0[_0xd60b('0x5')](_0xd60b('0x6'),attributes,{'tableName':_0xd60b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd60b('0x8'),'collate':_0xd60b('0x9')});}; \ No newline at end of file +var _0x0b8a=['moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api'];(function(_0x5b5417,_0x3ec502){var _0x2e26f3=function(_0x4c8143){while(--_0x4c8143){_0x5b5417['push'](_0x5b5417['shift']());}};_0x2e26f3(++_0x3ec502);}(_0x0b8a,0x96));var _0xa0b8=function(_0x4549fb,_0x441e08){_0x4549fb=_0x4549fb-0x0;var _0xaf50b1=_0x0b8a[_0x4549fb];return _0xaf50b1;};'use strict';var _=require(_0xa0b8('0x0'));var util=require(_0xa0b8('0x1'));var logger=require(_0xa0b8('0x2'))(_0xa0b8('0x3'));var moment=require(_0xa0b8('0x4'));var BPromise=require(_0xa0b8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0b8('0x6'));var rimraf=require(_0xa0b8('0x7'));var config=require(_0xa0b8('0x8'));var attributes=require(_0xa0b8('0x9'));module[_0xa0b8('0xa')]=function(_0x371d42,_0x4330ad){return _0x371d42[_0xa0b8('0xb')](_0xa0b8('0xc'),attributes,{'tableName':_0xa0b8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 517768f..2a55c28 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(_0x23d701,_0x27a95d){var _0x404c24=function(_0x498936){while(--_0x498936){_0x23d701['push'](_0x23d701['shift']());}};_0x404c24(++_0x27a95d);}(_0xb10b,0x12a));var _0xbb10=function(_0x27c068,_0x342981){_0x27c068=_0x27c068-0x0;var _0xe5a67f=_0xb10b[_0x27c068];return _0xe5a67f;};'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 _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x309e52,_0x26c91b){var _0x2797c6=function(_0x1f333f){while(--_0x1f333f){_0x309e52['push'](_0x309e52['shift']());}};_0x2797c6(++_0x26c91b);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc176e0,_0x42dbcd){_0xc176e0=_0xc176e0-0x0;var _0x422eb7=_0x5f2f[_0xc176e0];return _0x422eb7;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 2f85960..5b3e76e 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 _0x0183=['path','express','Router','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','update','delete','removeTags','exports','multer','util'];(function(_0x26d728,_0x342033){var _0x582800=function(_0x2bea6a){while(--_0x2bea6a){_0x26d728['push'](_0x26d728['shift']());}};_0x582800(++_0x342033);}(_0x0183,0x8a));var _0x3018=function(_0x310e1b,_0x4e5cfe){_0x310e1b=_0x310e1b-0x0;var _0x29c586=_0x0183[_0x310e1b];return _0x29c586;};'use strict';var multer=require(_0x3018('0x0'));var util=require(_0x3018('0x1'));var path=require(_0x3018('0x2'));var timeout=require('connect-timeout');var express=require(_0x3018('0x3'));var router=express[_0x3018('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3018('0x5'));var controller=require(_0x3018('0x6'));router['get']('/',auth[_0x3018('0x7')](),controller[_0x3018('0x8')]);router[_0x3018('0x9')](_0x3018('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x3018('0x9')](_0x3018('0xb'),auth[_0x3018('0x7')](),controller[_0x3018('0xc')]);router[_0x3018('0x9')](_0x3018('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x3018('0x9')](_0x3018('0xe'),auth[_0x3018('0x7')](),controller[_0x3018('0xf')]);router[_0x3018('0x10')]('/',auth[_0x3018('0x7')](),controller['create']);router[_0x3018('0x10')](_0x3018('0xd'),auth[_0x3018('0x7')](),controller[_0x3018('0x11')]);router[_0x3018('0x10')](_0x3018('0x12'),auth[_0x3018('0x7')](),interaction['tracked'](_0x3018('0x13'),_0x3018('0x14')),controller[_0x3018('0x15')]);router[_0x3018('0x16')]('/:id',auth[_0x3018('0x7')](),interaction[_0x3018('0x17')](_0x3018('0x13'),'openchannelinteraction:update'),controller[_0x3018('0x18')]);router[_0x3018('0x19')](_0x3018('0xb'),auth[_0x3018('0x7')](),interaction[_0x3018('0x17')]('openchannel','openchannelinteraction:destroy'),controller['destroy']);router[_0x3018('0x19')](_0x3018('0x12'),auth['isAuthenticated'](),controller[_0x3018('0x1a')]);module[_0x3018('0x1b')]=router; \ No newline at end of file +var _0x3089=['../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','/:id/download','download','create','post','/:id/tags','addTags','put','/:id','openchannel','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3060e3,_0x14f2c6){var _0x497d2c=function(_0x2a274a){while(--_0x2a274a){_0x3060e3['push'](_0x3060e3['shift']());}};_0x497d2c(++_0x14f2c6);}(_0x3089,0xc5));var _0x9308=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3089[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x9308('0x0'));var util=require(_0x9308('0x1'));var path=require(_0x9308('0x2'));var timeout=require(_0x9308('0x3'));var express=require(_0x9308('0x4'));var router=express[_0x9308('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9308('0x6'));var controller=require(_0x9308('0x7'));router[_0x9308('0x8')]('/',auth[_0x9308('0x9')](),controller[_0x9308('0xa')]);router[_0x9308('0x8')]('/describe',auth[_0x9308('0x9')](),controller[_0x9308('0xb')]);router[_0x9308('0x8')]('/:id',auth[_0x9308('0x9')](),controller[_0x9308('0xc')]);router['get'](_0x9308('0xd'),auth[_0x9308('0x9')](),controller['getMessages']);router[_0x9308('0x8')](_0x9308('0xe'),auth[_0x9308('0x9')](),controller[_0x9308('0xf')]);router['post']('/',auth[_0x9308('0x9')](),controller[_0x9308('0x10')]);router[_0x9308('0x11')](_0x9308('0xd'),auth[_0x9308('0x9')](),controller['addMessage']);router['post'](_0x9308('0x12'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller[_0x9308('0x13')]);router[_0x9308('0x14')](_0x9308('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x9308('0x16'),'openchannelinteraction:update'),controller[_0x9308('0x17')]);router[_0x9308('0x18')](_0x9308('0x15'),auth[_0x9308('0x9')](),interaction['tracked'](_0x9308('0x16'),_0x9308('0x19')),controller[_0x9308('0x1a')]);router[_0x9308('0x18')](_0x9308('0x12'),auth[_0x9308('0x9')](),controller[_0x9308('0x1b')]);module[_0x9308('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 6156b4c..bd0a6e4 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 _0x11ff=['exports','BOOLEAN','STRING','ENUM','out'];(function(_0x12fab1,_0x3169c3){var _0x1b58ff=function(_0x13c2ed){while(--_0x13c2ed){_0x12fab1['push'](_0x12fab1['shift']());}};_0x1b58ff(++_0x3169c3);}(_0x11ff,0x1b8));var _0xf11f=function(_0x3b75b3,_0x2f7505){_0x3b75b3=_0x3b75b3-0x0;var _0x556941=_0x11ff[_0x3b75b3];return _0x556941;};'use strict';var Sequelize=require('sequelize');module[_0xf11f('0x0')]={'closed':{'type':Sequelize[_0xf11f('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf11f('0x2')]},'note':{'type':Sequelize[_0xf11f('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xf11f('0x2')]},'externalUrl':{'type':Sequelize[_0xf11f('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf11f('0x3')]('in',_0xf11f('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf11f('0x2')]}}; \ No newline at end of file +var _0x4612=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x452446,_0x8f8cf4){var _0x281cf5=function(_0x3262a5){while(--_0x3262a5){_0x452446['push'](_0x452446['shift']());}};_0x281cf5(++_0x8f8cf4);}(_0x4612,0x82));var _0x2461=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4612[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x2461('0x0'));module[_0x2461('0x1')]={'closed':{'type':Sequelize[_0x2461('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2461('0x3')]},'note':{'type':Sequelize[_0x2461('0x3')]},'read1stAt':{'type':Sequelize[_0x2461('0x4')]},'threadId':{'type':Sequelize[_0x2461('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x2461('0x5')]('in',_0x2461('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 4c0e7cf..9b2dd9d 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 _0xdbb3=['Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','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','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','a.key','Account.key','i.*','c.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','keys','intersection','include','merge','options','create','update','params','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','Messages','direction','secret','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','YYYY-MM-DD','Openchannel','Account','closed','closedAt','disposition','threadId','Private','basename','existsSync','createReadStream','createWriteStream','out','System','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','end','stack','name','send'];(function(_0x5a47de,_0x57a87c){var _0x400ee6=function(_0x46745b){while(--_0x46745b){_0x5a47de['push'](_0x5a47de['shift']());}};_0x400ee6(++_0x57a87c);}(_0xdbb3,0x1c2));var _0x3dbb=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xdbb3[_0x55e08b];return _0xd1a7ff;};'use strict';var pdf=require(_0x3dbb('0x0'));var emlformat=require(_0x3dbb('0x1'));var rimraf=require(_0x3dbb('0x2'));var zipdir=require(_0x3dbb('0x3'));var jsonpatch=require(_0x3dbb('0x4'));var rp=require('request-promise');var moment=require(_0x3dbb('0x5'));var BPromise=require(_0x3dbb('0x6'));var Mustache=require(_0x3dbb('0x7'));var util=require('util');var path=require(_0x3dbb('0x8'));var sox=require(_0x3dbb('0x9'));var csv=require(_0x3dbb('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3dbb('0xb'));var squel=require(_0x3dbb('0xc'));var crypto=require('crypto');var jsforce=require(_0x3dbb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3dbb('0xa'));var querystring=require(_0x3dbb('0xe'));var Papa=require(_0x3dbb('0xf'));var Redis=require(_0x3dbb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3dbb('0x11'));var as=require(_0x3dbb('0x12'));var hardwareService=require(_0x3dbb('0x13'));var logger=require(_0x3dbb('0x14'))(_0x3dbb('0x15'));var utils=require('../../config/utils');var config=require(_0x3dbb('0x16'));var db=require(_0x3dbb('0x17'))['db'];config['redis']=_[_0x3dbb('0x18')](config['redis'],{'host':_0x3dbb('0x19'),'port':0x18eb});var socket=require(_0x3dbb('0x1a'))(new Redis(config[_0x3dbb('0x1b')]));require(_0x3dbb('0x1c'))[_0x3dbb('0x1d')](socket);function respondWithStatusCode(_0xb0bb4c,_0x1df26b){_0x1df26b=_0x1df26b||0xcc;return function(_0x65908d){if(_0x65908d){return _0xb0bb4c[_0x3dbb('0x1e')](_0x1df26b);}return _0xb0bb4c[_0x3dbb('0x1f')](_0x1df26b)['end']();};}function respondWithResult(_0x3b7b93,_0x171823){_0x171823=_0x171823||0xc8;return function(_0x1c3725){if(_0x1c3725){return _0x3b7b93['status'](_0x171823)[_0x3dbb('0x20')](_0x1c3725);}};}function respondWithFilteredResult(_0x5e56e6,_0x1945f2){return function(_0x290afc){if(_0x290afc){var _0x3a5c81=_0x290afc[_0x3dbb('0x21')],_0x21c12a=_0x1945f2['offset'],_0x3050c1=_0x1945f2[_0x3dbb('0x22')]+_0x1945f2[_0x3dbb('0x23')],_0x313bfd;if(_0x3050c1>=_0x3a5c81){_0x3050c1=_0x3a5c81;_0x313bfd=0xc8;}else{_0x313bfd=0xce;}_0x5e56e6['status'](_0x313bfd);return _0x5e56e6[_0x3dbb('0x24')](_0x3dbb('0x25'),_0x21c12a+'-'+_0x3050c1+'/'+_0x3a5c81)[_0x3dbb('0x20')](_0x290afc);}return null;};}function patchUpdates(_0x5eb635){return function(_0x19e8fc){try{jsonpatch['apply'](_0x19e8fc,_0x5eb635,!![]);}catch(_0x3a8a90){return BPromise[_0x3dbb('0x26')](_0x3a8a90);}return _0x19e8fc[_0x3dbb('0x27')]();};}function saveUpdates(_0x4acdc4,_0x3bfc2a){return function(_0x35911e){if(_0x35911e){return _0x35911e['update'](_0x4acdc4)[_0x3dbb('0x28')](function(_0x444c68){return _0x444c68;});}return null;};}function removeEntity(_0xa5862d,_0x43eb58){return function(_0x2fff10){if(_0x2fff10){return _0x2fff10[_0x3dbb('0x29')]()[_0x3dbb('0x28')](function(){_0xa5862d['status'](0xcc)[_0x3dbb('0x2a')]();});}};}function handleEntityNotFound(_0x4a87e7,_0x158ad4){return function(_0x437021){if(!_0x437021){_0x4a87e7[_0x3dbb('0x1e')](0x194);}return _0x437021;};}function handleError(_0x4aadad,_0x27f38b){_0x27f38b=_0x27f38b||0x1f4;return function(_0x4c3c28){logger['error'](_0x4c3c28[_0x3dbb('0x2b')]);if(_0x4c3c28['name']){delete _0x4c3c28[_0x3dbb('0x2c')];}_0x4aadad['status'](_0x27f38b)[_0x3dbb('0x2d')](_0x4c3c28);};}function getInteractionUsers(_0x218002,_0x24a2de){return new BPromise(function(_0x5df4c3,_0x2e9731){try{if(_0x24a2de[_0x218002['id']]){_0x218002[_0x3dbb('0x2e')]=_[_0x3dbb('0x2f')](_0x24a2de[_0x218002['id']],function(_0x2be0e6){return{'id':_0x2be0e6['id'],'fullname':_0x2be0e6[_0x3dbb('0x30')]};});}}catch(_0x199416){_0x2e9731(_0x199416);}_0x5df4c3(_0x218002);});}function getInteractionTags(_0x9ed4e7,_0xf09e4d){return new BPromise(function(_0x333d0e,_0x166b60){try{if(_0x9ed4e7['TagIds']){_0x9ed4e7[_0x3dbb('0x31')]=[];_0x9ed4e7[_0x3dbb('0x32')][_0x3dbb('0x33')](',')[_0x3dbb('0x34')](function(_0xa45413){_0x9ed4e7[_0x3dbb('0x31')][_0x3dbb('0x35')](_0xf09e4d[_0xa45413]);});}delete _0x9ed4e7[_0x3dbb('0x32')];}catch(_0x599a83){_0x166b60(_0x599a83);}_0x333d0e(_0x9ed4e7);});}function updateOpenchannelInteraction(_0x282380,_0x5574a6,_0x59851c){return new BPromise(function(_0x5a114c,_0x245d52){return getInteractionUsers(_0x282380,_0x59851c)[_0x3dbb('0x28')](function(_0x14a633){return getInteractionTags(_0x14a633,_0x5574a6);})[_0x3dbb('0x28')](function(_0x1672ed){_0x5a114c(_0x1672ed);})[_0x3dbb('0x36')](function(_0x1f9a95){_0x245d52(_0x1f9a95);});});}exports[_0x3dbb('0x37')]=function(_0x1ea00f,_0x3353d5){var _0x4ad106={},_0x3b3a0a={},_0x5debdf={'count':0x0,'rows':[]};var _0x5208ce=_[_0x3dbb('0x2f')](db[_0x3dbb('0x38')][_0x3dbb('0x39')],function(_0x19eb31){return{'name':_0x19eb31['fieldName'],'type':_0x19eb31[_0x3dbb('0x3a')][_0x3dbb('0x3b')]};});_0x3b3a0a[_0x3dbb('0x3c')]=_[_0x3dbb('0x2f')](_0x5208ce,_0x3dbb('0x2c'));_0x3b3a0a[_0x3dbb('0x3d')]=_['keys'](_0x1ea00f[_0x3dbb('0x3d')]);_0x3b3a0a[_0x3dbb('0x3e')]=_['intersection'](_0x3b3a0a[_0x3dbb('0x3c')],_0x3b3a0a[_0x3dbb('0x3d')]);_0x4ad106[_0x3dbb('0x3f')]=_['intersection'](_0x3b3a0a[_0x3dbb('0x3c')],qs[_0x3dbb('0x40')](_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x40')]));_0x4ad106[_0x3dbb('0x3f')]=_0x4ad106[_0x3dbb('0x3f')][_0x3dbb('0x41')]?_0x4ad106[_0x3dbb('0x3f')]:_0x3b3a0a['model'];if(!_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x42')](_0x3dbb('0x43'))){_0x4ad106['limit']=qs['limit'](_0x1ea00f['query'][_0x3dbb('0x23')]);_0x4ad106[_0x3dbb('0x22')]=qs[_0x3dbb('0x22')](_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x22')]);}_0x4ad106[_0x3dbb('0x44')]=qs['sort'](_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x45')]);_0x4ad106[_0x3dbb('0x46')]=qs[_0x3dbb('0x3e')](_[_0x3dbb('0x47')](_0x1ea00f['query'],_0x3b3a0a[_0x3dbb('0x3e')]),_0x5208ce);var _0x448097=[];var _0xad9f27=squel[_0x3dbb('0x48')]()[_0x3dbb('0x49')]('id')['field'](_0x3dbb('0x2c'))[_0x3dbb('0x49')]('color')[_0x3dbb('0x4a')](_0x3dbb('0x4b'));var _0x465a1f=squel['select']()[_0x3dbb('0x49')]('u.id')[_0x3dbb('0x49')]('u.fullname')[_0x3dbb('0x49')](_0x3dbb('0x4c'))[_0x3dbb('0x4a')](_0x3dbb('0x4d'),'ui')[_0x3dbb('0x4e')](_0x3dbb('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x397298=squel[_0x3dbb('0x48')]()[_0x3dbb('0x4a')](_0x3dbb('0x50'),'i')[_0x3dbb('0x4e')](_0x3dbb('0x51'),'c',_0x3dbb('0x52'))[_0x3dbb('0x4e')]('users','o',_0x3dbb('0x53'))[_0x3dbb('0x4e')](_0x3dbb('0x54'),'a',_0x3dbb('0x55'))[_0x3dbb('0x4e')]('openchannel_messages','me',_0x3dbb('0x56'))[_0x3dbb('0x4e')](_0x3dbb('0x57'),'it',_0x3dbb('0x58'))[_0x3dbb('0x4e')]('tools_tags','t',_0x3dbb('0x59'));var _0x35cc7e=squel[_0x3dbb('0x5a')]();var _0x3e0f4e=[];var _0x580913=squel['expr']();var _0x4aa2a9;if(_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x5b')]){_0x4aa2a9=as[_0x3dbb('0x5c')](_0x1ea00f[_0x3dbb('0x3d')]['search']);var _0x433074=_0x4aa2a9[_0x3dbb('0x5d')];for(var _0x5f1315=0x0;_0x5f1315<_0x4aa2a9[_0x3dbb('0x5e')][_0x3dbb('0x41')];_0x5f1315++){var _0x3cda5c=_0x4aa2a9[_0x3dbb('0x5e')][_0x5f1315];var _0x274679='i';var _0x1b0d8c=_[_0x3dbb('0x5f')](_0x5208ce,[_0x3dbb('0x2c'),_0x3cda5c[_0x3dbb('0x49')]]);if(!_0x1b0d8c){switch(_0x3cda5c[_0x3dbb('0x49')]){case _0x3dbb('0x60'):if(_0x3cda5c[_0x3dbb('0x61')]==0x1){_0x397298['having']('`'+_0x3cda5c[_0x3dbb('0x49')]+_0x3dbb('0x62'));}else{_0x397298[_0x3dbb('0x63')]('`'+_0x3cda5c[_0x3dbb('0x49')]+_0x3dbb('0x64'));}break;case'Contact':if(_0x3cda5c['operator']===_0x3dbb('0x65')){if(_0x3cda5c[_0x3dbb('0x61')]['split']('\x20')[_0x3dbb('0x41')]>0x1){_0x35cc7e[_0x433074](_0x3dbb('0x66'),qs[_0x3dbb('0x67')](_0x3cda5c[_0x3dbb('0x61')]),null);}else{var _0x515893='%'+_0x3cda5c[_0x3dbb('0x61')]+'%';_0x35cc7e[_0x433074](_0x3dbb('0x68'),_0x515893,_0x515893,_0x515893);}}else{_0x1b0d8c=_[_0x3dbb('0x5f')](_0x5208ce,['name','ContactId']);_0x3cda5c[_0x3dbb('0x49')]=_0x3dbb('0x69');_0x243b03=as[_0x3dbb('0x6a')](_0x274679,_0x1b0d8c[_0x3dbb('0x3a')],_0x3cda5c);_0x35cc7e[_0x433074](_0x243b03[_0x3dbb('0x6b')],_0x243b03['value'][_0x3dbb('0x6c')],_0x243b03[_0x3dbb('0x61')][_0x3dbb('0x2a')]);}break;case'Tag':var _0xa82ef8=_0x3cda5c[_0x3dbb('0x61')][_0x3dbb('0x33')](',')['map'](function(_0x4114b6){return Number(_0x4114b6);});_0xa82ef8[_0x3dbb('0x34')](function(_0x3dea29){_0x580913['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3dea29+',%');});_0x3e0f4e=_[_0x3dbb('0x6d')](_0x3e0f4e,_0xa82ef8);break;case _0x3dbb('0x6e'):if(_0x3cda5c['operator']===_0x3dbb('0x65')){_0x35cc7e[_0x433074](_0x3dbb('0x6f'),'%'+_0x3cda5c[_0x3dbb('0x61')]+'%',null);}else{_0x1b0d8c=_['find'](_0x5208ce,[_0x3dbb('0x2c'),_0x3dbb('0x70')]);_0x3cda5c[_0x3dbb('0x49')]=_0x3dbb('0x70');_0x243b03=as[_0x3dbb('0x6a')](_0x274679,_0x1b0d8c[_0x3dbb('0x3a')],_0x3cda5c);_0x35cc7e[_0x433074](_0x243b03['text'],_0x243b03[_0x3dbb('0x61')][_0x3dbb('0x6c')],_0x243b03[_0x3dbb('0x61')]['end']);}break;case _0x3dbb('0x71'):_0x243b03=as[_0x3dbb('0x6a')]('me',null,_0x3cda5c);_0x35cc7e[_0x433074](_0x243b03[_0x3dbb('0x6b')],_0x243b03[_0x3dbb('0x61')]['start'],_0x243b03[_0x3dbb('0x61')][_0x3dbb('0x2a')]);break;}}else{var _0x243b03=as[_0x3dbb('0x6a')](_0x274679,_0x1b0d8c[_0x3dbb('0x3a')],_0x3cda5c);_0x35cc7e[_0x433074](_0x243b03[_0x3dbb('0x6b')],_0x243b03[_0x3dbb('0x61')]['start'],_0x243b03[_0x3dbb('0x61')][_0x3dbb('0x2a')]);}}}else{var _0x3a1c6a=_(_0x1ea00f[_0x3dbb('0x3d')])['keys']()[_0x3dbb('0x2f')](function(_0x39efe6){return _[_0x3dbb('0x72')](_0x5208ce,[_0x3dbb('0x2c'),_0x39efe6])?_0x39efe6:undefined;})[_0x3dbb('0x73')]()[_0x3dbb('0x61')]();if(!_[_0x3dbb('0x74')](_0x3a1c6a)){_0x3a1c6a[_0x3dbb('0x34')](function(_0xe6b8bc){if(_0xe6b8bc==='OpenchannelAccountId'){_0x397298['where'](_0x3dbb('0x75'),[][_0x3dbb('0x76')](_0x1ea00f[_0x3dbb('0x3d')][_0xe6b8bc]));}else if(_0xe6b8bc===_0x3dbb('0x77')){var _0x53aefe=JSON[_0x3dbb('0x78')](_0x1ea00f[_0x3dbb('0x3d')][_0xe6b8bc])['$gte'];var _0x163bef=JSON[_0x3dbb('0x78')](_0x1ea00f[_0x3dbb('0x3d')][_0xe6b8bc])[_0x3dbb('0x79')];_0x397298[_0x3dbb('0x46')](_0x3dbb('0x7a'),_0x53aefe,_0x163bef);}else{if(_0x1ea00f[_0x3dbb('0x3d')][_0xe6b8bc]===_0x3dbb('0x7b')){_0x397298[_0x3dbb('0x46')]('i.'+_0xe6b8bc+_0x3dbb('0x7c'));}else{_0x397298['where']('i.'+_0xe6b8bc+'\x20=\x20?',_0x1ea00f['query'][_0xe6b8bc]);}}});}if(_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x7d')]){if(_0x1ea00f[_0x3dbb('0x3d')]['read']==0x1){_0x397298[_0x3dbb('0x63')](_0x3dbb('0x7e'));}else{_0x397298['having'](_0x3dbb('0x7f'));}}if(_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x80')]){_0x3e0f4e=_[_0x3dbb('0x81')](_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x80')])?_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x80')]:new Array(_0x1ea00f['query'][_0x3dbb('0x80')]);_0x3e0f4e[_0x3dbb('0x34')](function(_0x156921){_0x580913['or'](_0x3dbb('0x82'),'%,'+_0x156921+',%');});}if(_0x1ea00f[_0x3dbb('0x3d')]['filter']){var _0x228009=_0x1ea00f[_0x3dbb('0x3d')]['filter']['replace']('\x5c','\x5c\x5c')[_0x3dbb('0x83')]('\x27\x27',_0x3dbb('0x84'));if(qs[_0x3dbb('0x85')](_0x228009)){_0x35cc7e['or'](_0x3dbb('0x86'),_0x228009+'%');}else{_0x35cc7e['or'](_0x3dbb('0x87'),qs[_0x3dbb('0x67')](_0x228009))['or'](_0x3dbb('0x88'),_0x228009+'%')['or'](_0x3dbb('0x89'),_0x228009+'%');}}}_0x397298[_0x3dbb('0x46')](_0x35cc7e);_0x397298[_0x3dbb('0x8a')](_0x3dbb('0x8b'));var _0x41f530={'type':db[_0x3dbb('0x8c')][_0x3dbb('0x8d')][_0x3dbb('0x8e')],'raw':!![]};var _0x1cc75e=_0x397298[_0x3dbb('0x8f')]();_0x1cc75e['field'](_0x3dbb('0x8b'));_0x1cc75e[_0x3dbb('0x49')](_0x3dbb('0x90'),_0x3dbb('0x60'));if(_0x4ad106[_0x3dbb('0x44')]){_0x4ad106[_0x3dbb('0x44')]['forEach'](function(_0x397c98){_0x397298[_0x3dbb('0x44')]('i.'+_0x397c98[0x0],_0x397c98[0x1]===_0x3dbb('0x91')?![]:!![]);});}if(!_[_0x3dbb('0x74')](_0x3e0f4e)){_0x397298[_0x3dbb('0x63')](_0x580913);_0x1cc75e[_0x3dbb('0x46')](_0x3dbb('0x92'),_0x3e0f4e);}BPromise[_0x3dbb('0x93')]()[_0x3dbb('0x28')](function(){if(!_0x4aa2a9){if(_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x94')]||_0x1ea00f[_0x3dbb('0x3d')]['journey'])return;_0x1cc75e[_0x3dbb('0x46')](_0x3dbb('0x95'));_0x397298[_0x3dbb('0x46')](_0x3dbb('0x95'));return;}return _0x1ea00f['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x3dbb('0x28')](function(_0x16df84){if(_['isEmpty'](_0x16df84)){_0x1cc75e[_0x3dbb('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x397298[_0x3dbb('0x46')](_0x3dbb('0x96'));}else{_0x1cc75e[_0x3dbb('0x46')](_0x3dbb('0x75'),_[_0x3dbb('0x2f')](_0x16df84,'id'));_0x397298[_0x3dbb('0x46')](_0x3dbb('0x75'),_['map'](_0x16df84,'id'));}});})[_0x3dbb('0x28')](function(){db['sequelize'][_0x3dbb('0x3d')](_0x1cc75e[_0x3dbb('0x97')](),_0x41f530)[_0x3dbb('0x28')](function(_0x119f2a){_0x5debdf[_0x3dbb('0x21')]=_0x119f2a['length'];if(_0x5debdf[_0x3dbb('0x21')]===0x0)return[];return db[_0x3dbb('0x98')][_0x3dbb('0x3d')](_0xad9f27[_0x3dbb('0x97')](),_0x41f530)[_0x3dbb('0x28')](function(_0x1088f2){_0x448097=_[_0x3dbb('0x99')](_0x1088f2,'id');_0x41f530=_['merge'](_0x41f530,{'model':db[_0x3dbb('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ea00f[_0x3dbb('0x3d')][_0x3dbb('0x40')]){_0x4ad106[_0x3dbb('0x3f')][_0x3dbb('0x34')](function(_0x132cd9){_0x397298[_0x3dbb('0x49')]('i.'+_0x132cd9);});}else{_0x397298[_0x3dbb('0x49')](_0x3dbb('0x90'),_0x3dbb('0x60'));_0x397298['field'](_0x3dbb('0x9a'),_0x3dbb('0x9b'));_0x397298[_0x3dbb('0x49')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x397298[_0x3dbb('0x49')](_0x3dbb('0x9c'));_0x397298[_0x3dbb('0x49')](_0x3dbb('0x9d'),'Contact.firstName');_0x397298[_0x3dbb('0x49')]('c.lastName','Contact.lastName');_0x397298[_0x3dbb('0x49')](_0x3dbb('0x9e'),_0x3dbb('0x9f'));_0x397298['field'](_0x3dbb('0xa0'),_0x3dbb('0xa1'));_0x397298['field'](_0x3dbb('0xa2'),_0x3dbb('0xa3'));_0x397298[_0x3dbb('0x49')](_0x3dbb('0xa4'),_0x3dbb('0xa5'));_0x397298[_0x3dbb('0x49')](_0x3dbb('0xa6'),_0x3dbb('0xa7'));_0x397298['field'](_0x3dbb('0xa8'),'Owner.internal');_0x397298['field'](_0x3dbb('0xa9'),_0x3dbb('0x32'));}if(_0x4ad106[_0x3dbb('0x23')])_0x397298[_0x3dbb('0x23')](_0x4ad106['limit']);if(_0x4ad106['offset'])_0x397298[_0x3dbb('0x22')](_0x4ad106[_0x3dbb('0x22')]);return db[_0x3dbb('0x98')][_0x3dbb('0x3d')](_0x397298[_0x3dbb('0x97')](),_0x41f530);})[_0x3dbb('0x28')](function(_0x5d1e02){_0x465a1f['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x3dbb('0x2f')](_0x5d1e02,'id'));return db['sequelize']['query'](_0x465a1f[_0x3dbb('0x97')](),_0x41f530)[_0x3dbb('0x28')](function(_0x57d007){var _0x357966=_[_0x3dbb('0xaa')](_0x57d007,'OpenchannelInteractionId');var _0x498ae5=[];_0x5d1e02[_0x3dbb('0x34')](function(_0x57128a){_0x498ae5[_0x3dbb('0x35')](updateOpenchannelInteraction(_0x57128a,_0x448097,_0x357966));});return BPromise[_0x3dbb('0xab')](_0x498ae5);});});})[_0x3dbb('0x28')](function(_0x5aa66b){_0x5debdf[_0x3dbb('0xac')]=_0x5aa66b;return _0x5debdf;})[_0x3dbb('0x28')](respondWithFilteredResult(_0x3353d5,_0x4ad106));})[_0x3dbb('0x36')](handleError(_0x3353d5,null));};exports[_0x3dbb('0xad')]=function(_0x5edcfe,_0x329d6b){var _0x3e9cac={'raw':![],'where':{'id':_0x5edcfe['params']['id']}},_0x1322a7={};_0x1322a7[_0x3dbb('0x3c')]=_[_0x3dbb('0xae')](db[_0x3dbb('0x38')][_0x3dbb('0x39')]);_0x1322a7[_0x3dbb('0x3d')]=_[_0x3dbb('0xae')](_0x5edcfe['query']);_0x1322a7['filters']=_[_0x3dbb('0xaf')](_0x1322a7['model'],_0x1322a7[_0x3dbb('0x3d')]);_0x3e9cac[_0x3dbb('0x3f')]=_[_0x3dbb('0xaf')](_0x1322a7[_0x3dbb('0x3c')],qs[_0x3dbb('0x40')](_0x5edcfe[_0x3dbb('0x3d')][_0x3dbb('0x40')]));_0x3e9cac[_0x3dbb('0x3f')]=_0x3e9cac[_0x3dbb('0x3f')][_0x3dbb('0x41')]?_0x3e9cac[_0x3dbb('0x3f')]:_0x1322a7['model'];if(_0x5edcfe[_0x3dbb('0x3d')]['includeAll']){_0x3e9cac[_0x3dbb('0xb0')]=[{'all':!![]}];}_0x3e9cac=_[_0x3dbb('0xb1')]({},_0x3e9cac,_0x5edcfe[_0x3dbb('0xb2')]);return db[_0x3dbb('0x38')][_0x3dbb('0x5f')](_0x3e9cac)[_0x3dbb('0x28')](handleEntityNotFound(_0x329d6b,null))[_0x3dbb('0x28')](respondWithResult(_0x329d6b,null))[_0x3dbb('0x36')](handleError(_0x329d6b,null));};exports[_0x3dbb('0xb3')]=function(_0x258857,_0x28e7e8){return db['OpenchannelInteraction'][_0x3dbb('0xb3')](_0x258857[_0x3dbb('0x71')],{})[_0x3dbb('0x28')](respondWithResult(_0x28e7e8,0xc9))[_0x3dbb('0x36')](handleError(_0x28e7e8,null));};exports[_0x3dbb('0xb4')]=function(_0x23fd67,_0x49005a){if(_0x23fd67[_0x3dbb('0x71')]['id']){delete _0x23fd67[_0x3dbb('0x71')]['id'];}return db['OpenchannelInteraction'][_0x3dbb('0x5f')]({'where':{'id':_0x23fd67[_0x3dbb('0xb5')]['id']}})[_0x3dbb('0x28')](handleEntityNotFound(_0x49005a,null))['then'](saveUpdates(_0x23fd67[_0x3dbb('0x71')],null))[_0x3dbb('0x28')](respondWithResult(_0x49005a,null))[_0x3dbb('0x36')](handleError(_0x49005a,null));};exports[_0x3dbb('0x29')]=function(_0x2a0973,_0x396acf){return db[_0x3dbb('0x38')][_0x3dbb('0x5f')]({'where':{'id':_0x2a0973['params']['id']}})[_0x3dbb('0x28')](handleEntityNotFound(_0x396acf,null))[_0x3dbb('0x28')](removeEntity(_0x396acf,null))[_0x3dbb('0x36')](handleError(_0x396acf,null));};exports[_0x3dbb('0xb6')]=function(_0x290034,_0x177446){return db[_0x3dbb('0x38')][_0x3dbb('0xb6')]()[_0x3dbb('0x28')](respondWithResult(_0x177446,null))[_0x3dbb('0x36')](handleError(_0x177446,null));};exports['addMessage']=function(_0x3b15cb,_0x14c10c,_0x74b46c){return db[_0x3dbb('0xb7')]['find']({'where':{'id':_0x3b15cb[_0x3dbb('0xb5')]['id']}})[_0x3dbb('0x28')](handleEntityNotFound(_0x14c10c,null))['then'](function(_0x480d51){if(_0x480d51){return _0x480d51[_0x3dbb('0xb8')](_0x3b15cb[_0x3dbb('0x71')][_0x3dbb('0xb9')],_[_0x3dbb('0xba')](_0x3b15cb[_0x3dbb('0x71')],[_0x3dbb('0xb9'),'id'])||{});}})[_0x3dbb('0x28')](respondWithResult(_0x14c10c,null))['catch'](handleError(_0x14c10c,null));};exports[_0x3dbb('0xbb')]=function(_0x2e60e6,_0x14d553,_0x3b292d){var _0x2a6343={'raw':![],'where':{}};var _0x385fa0={};var _0x459f79={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x3dbb('0xbc')]({'where':{'id':_0x2e60e6['params']['id']}})['then'](handleEntityNotFound(_0x14d553,null))['then'](function(_0x5bc991){if(_0x5bc991){_0x385fa0[_0x3dbb('0x3c')]=_[_0x3dbb('0xae')](db['OpenchannelMessage'][_0x3dbb('0x39')]);_0x385fa0[_0x3dbb('0x3d')]=_[_0x3dbb('0xae')](_0x2e60e6['query']);_0x385fa0[_0x3dbb('0x3e')]=_[_0x3dbb('0xaf')](_0x385fa0[_0x3dbb('0x3c')],_0x385fa0[_0x3dbb('0x3d')]);_0x2a6343[_0x3dbb('0x3f')]=_[_0x3dbb('0xaf')](_0x385fa0[_0x3dbb('0x3c')],qs[_0x3dbb('0x40')](_0x2e60e6['query'][_0x3dbb('0x40')]));_0x2a6343['attributes']=_0x2a6343[_0x3dbb('0x3f')][_0x3dbb('0x41')]?_0x2a6343['attributes']:_0x385fa0[_0x3dbb('0x3c')];if(!_0x2e60e6[_0x3dbb('0x3d')][_0x3dbb('0x42')](_0x3dbb('0x43'))){_0x2a6343[_0x3dbb('0x23')]=qs['limit'](_0x2e60e6[_0x3dbb('0x3d')][_0x3dbb('0x23')]);_0x2a6343[_0x3dbb('0x22')]=qs[_0x3dbb('0x22')](_0x2e60e6[_0x3dbb('0x3d')]['offset']);}_0x2a6343[_0x3dbb('0x44')]=qs['sort'](_0x2e60e6[_0x3dbb('0x3d')]['sort']);_0x2a6343[_0x3dbb('0x46')]=qs[_0x3dbb('0x3e')](_[_0x3dbb('0x47')](_0x2e60e6[_0x3dbb('0x3d')],_0x385fa0[_0x3dbb('0x3e')]));_0x2a6343[_0x3dbb('0x46')][_0x3dbb('0xbd')]=_0x5bc991['id'];if(_0x2e60e6[_0x3dbb('0x3d')][_0x3dbb('0xbe')]){_0x2a6343[_0x3dbb('0x46')]=_['merge'](_0x2a6343[_0x3dbb('0x46')],{'$or':_[_0x3dbb('0x2f')](_0x2a6343[_0x3dbb('0x3f')],function(_0x185a72){var _0x1eaa6e={};_0x1eaa6e[_0x185a72]={'$like':'%'+_0x2e60e6[_0x3dbb('0x3d')][_0x3dbb('0xbe')]+'%'};return _0x1eaa6e;})});}if(_0x2e60e6[_0x3dbb('0x3d')][_0x3dbb('0xbf')]){var _0x295664=_0x2e60e6[_0x3dbb('0x3d')][_0x3dbb('0xbf')][_0x3dbb('0x33')](',');var _0x1ccd3a={};_0x1ccd3a[_0x295664[0x0]]={'$gte':moment(_0x295664[0x1])['format'](_0x3dbb('0xc0'))};_0x2a6343['where']=_['merge'](_0x2a6343[_0x3dbb('0x46')],_0x1ccd3a);}_0x2a6343=_['merge']({},_0x2a6343,_0x2e60e6[_0x3dbb('0xb2')]);return db[_0x3dbb('0xb7')][_0x3dbb('0x21')]({'where':_0x2a6343[_0x3dbb('0x46')]})[_0x3dbb('0x28')](function(_0x437548){_0x459f79[_0x3dbb('0x21')]=_0x437548;if(_0x2e60e6[_0x3dbb('0x3d')][_0x3dbb('0xc1')]){_0x2a6343[_0x3dbb('0xb0')]=[{'all':!![]}];}return db[_0x3dbb('0xb7')]['findAll'](_0x2a6343);})['then'](function(_0x5ba137){_0x459f79[_0x3dbb('0xac')]=_0x5ba137;return _0x459f79;});}})[_0x3dbb('0x28')](respondWithFilteredResult(_0x14d553,_0x2a6343))['catch'](handleError(_0x14d553,null));};exports[_0x3dbb('0xc2')]=function(_0x5ccbad,_0x5d07db,_0x151029){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5ccbad[_0x3dbb('0xb5')]['id']}})['then'](handleEntityNotFound(_0x5d07db,null))[_0x3dbb('0x28')](function(_0x55745d){if(_0x55745d){return _0x55745d['setTags'](_0x5ccbad[_0x3dbb('0x71')][_0x3dbb('0xb9')],_[_0x3dbb('0xba')](_0x5ccbad[_0x3dbb('0x71')],[_0x3dbb('0xb9'),'id'])||{})[_0x3dbb('0xc3')](function(){return db[_0x3dbb('0xc4')]['findAll']({'attributes':['id',_0x3dbb('0x2c'),_0x3dbb('0xc5')],'where':{'id':_0x5ccbad[_0x3dbb('0x71')][_0x3dbb('0xb9')]}});})['then'](function(_0x17549f){socket[_0x3dbb('0xc6')](_0x3dbb('0xc7'),{'id':Number(_0x5ccbad[_0x3dbb('0xb5')]['id']),'tags':_0x17549f||[]});return{'id':Number(_0x5ccbad[_0x3dbb('0xb5')]['id']),'tags':_0x17549f||[]};});}})[_0x3dbb('0x28')](respondWithResult(_0x5d07db,null))[_0x3dbb('0x36')](handleError(_0x5d07db,null));};exports[_0x3dbb('0xc8')]=function(_0x4a1140,_0x2783e5,_0x4f8a67){return db['OpenchannelInteraction'][_0x3dbb('0x5f')]({'where':{'id':_0x4a1140[_0x3dbb('0xb5')]['id']}})[_0x3dbb('0x28')](handleEntityNotFound(_0x2783e5,null))['then'](function(_0xdbf5fa){if(_0xdbf5fa){return _0xdbf5fa[_0x3dbb('0xc8')](_0x4a1140[_0x3dbb('0x3d')][_0x3dbb('0xb9')]);}})[_0x3dbb('0x28')](respondWithStatusCode(_0x2783e5,null))[_0x3dbb('0x36')](handleError(_0x2783e5,null));};exports[_0x3dbb('0xc9')]=function(_0x5eb2ac,_0x490b39){var _0x50a6a9=moment()[_0x3dbb('0xca')]()[_0x3dbb('0x97')]();var _0x12e5a5=path['join'](config[_0x3dbb('0xcb')],_0x3dbb('0xcc'),_0x3dbb('0xcd'),_0x3dbb('0xce'));var _0xf30483=path[_0x3dbb('0xcf')](config[_0x3dbb('0xcb')],'server',_0x3dbb('0xcd'),_0x3dbb('0xd0'));var _0x1c7982=path[_0x3dbb('0xcf')](_0x12e5a5,_0x50a6a9);var _0x50a018=util[_0x3dbb('0xd1')](_0x3dbb('0xd2'),_0x5eb2ac[_0x3dbb('0xb5')]['id'],_0x50a6a9);var _0x2851a9=path[_0x3dbb('0xcf')](_0x12e5a5,_0x50a018);var _0x1ea03e=[];_0x1ea03e['push']({'model':db[_0x3dbb('0x6e')],'as':_0x3dbb('0x6e'),'attributes':['id',_0x3dbb('0x30')],'raw':!![]});_0x1ea03e[_0x3dbb('0x35')]({'model':db['CmContact'],'as':_0x3dbb('0xd3'),'attributes':['id',_0x3dbb('0xd4'),_0x3dbb('0xd5')],'raw':!![]});if(_0x5eb2ac['query'][_0x3dbb('0xd0')]){_0x1ea03e[_0x3dbb('0x35')]({'model':db[_0x3dbb('0xd6')],'as':_0x3dbb('0xd6'),'raw':!![]});}var _0x2659d9=[{'model':db[_0x3dbb('0xb7')],'as':_0x3dbb('0xd7'),'attributes':['id',_0x3dbb('0x71'),_0x3dbb('0x77'),_0x3dbb('0xd8'),_0x3dbb('0xd9'),_0x3dbb('0x7d')],'include':_0x1ea03e}];_0x2659d9[_0x3dbb('0x35')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0x3dbb('0x2c')]});_0x2659d9[_0x3dbb('0x35')]({'model':db[_0x3dbb('0x6e')],'as':_0x3dbb('0xda'),'attributes':['id',_0x3dbb('0x30')]});return db[_0x3dbb('0x38')][_0x3dbb('0x5f')]({'where':{'id':_0x5eb2ac[_0x3dbb('0xb5')]['id']},'include':_0x2659d9})[_0x3dbb('0x28')](handleEntityNotFound(_0x490b39,null))['then'](function(_0x1ec3d5){if(_0x1ec3d5){var _0x32f749=_0x1ec3d5[_0x3dbb('0xdb')]({'plain':!![]});fs[_0x3dbb('0xdc')](_0x1c7982);var _0x5db9c3={'format':'A4','border':_0x3dbb('0xdd'),'header':{'height':_0x3dbb('0xde'),'contents':{'first':_0x3dbb('0xdf')}},'footer':{'height':_0x3dbb('0xe0'),'contents':{'default':util[_0x3dbb('0xd1')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format']('%s\x20#%d','Openchannel',_0x32f749['id']),moment()['format'](_0x3dbb('0xe1'))['toString']())}}};var _0x192518={'channel':_0x3dbb('0xe2'),'account':_0x32f749[_0x3dbb('0xe3')][_0x3dbb('0x2c')],'agent':_0x32f749[_0x3dbb('0xda')]?_0x32f749['Owner'][_0x3dbb('0x30')]:'N.A.','createdAt':moment(_0x32f749[_0x3dbb('0x77')])['format'](_0x3dbb('0xc0'))[_0x3dbb('0x97')](),'closedAt':_0x32f749[_0x3dbb('0xe4')]?moment(_0x32f749[_0x3dbb('0xe5')])[_0x3dbb('0xd1')](_0x3dbb('0xc0'))[_0x3dbb('0x97')]():'','disposition':_0x32f749[_0x3dbb('0xe6')],'visibility':_0x32f749[_0x3dbb('0xe7')]?'Public':_0x3dbb('0xe8'),'messages':_(_0x32f749['Messages'])[_0x3dbb('0xbe')]({'secret':![]})[_0x3dbb('0x2f')](function(_0x382f76){if(_0x382f76[_0x3dbb('0xd6')]){var _0x101567=path[_0x3dbb('0xcf')](_0xf30483,_0x382f76[_0x3dbb('0xd6')][_0x3dbb('0xe9')]);if(fs[_0x3dbb('0xea')](_0x101567)){fs[_0x3dbb('0xeb')](_0x101567)['pipe'](fs[_0x3dbb('0xec')](path[_0x3dbb('0xcf')](_0x1c7982,_0x382f76[_0x3dbb('0xd6')][_0x3dbb('0xe9')])));}}return{'date':moment(_0x382f76[_0x3dbb('0x77')])[_0x3dbb('0xd1')](_0x3dbb('0xc0'))[_0x3dbb('0x97')](),'sender':_0x382f76[_0x3dbb('0xd8')]===_0x3dbb('0xed')?_0x382f76[_0x3dbb('0x6e')]?_0x382f76[_0x3dbb('0x6e')][_0x3dbb('0x30')]:_0x3dbb('0xee'):_0x382f76[_0x3dbb('0xd3')]['firstName']+(_0x382f76[_0x3dbb('0xd3')]['lastName']?'\x20'+_0x382f76[_0x3dbb('0xd3')][_0x3dbb('0xd5')]:''),'body':_0x382f76[_0x3dbb('0xd6')]?_0x382f76['Attachment']['basename']:_0x382f76[_0x3dbb('0x71')],'direction':_0x382f76[_0x3dbb('0xd8')]===_0x3dbb('0xed')?'A':'C','secret':_0x382f76['secret'],'read':_0x382f76[_0x3dbb('0x7d')],'attachment':_0x382f76[_0x3dbb('0xd6')]};})[_0x3dbb('0x61')]()};return ejs[_0x3dbb('0xef')](path['join'](config[_0x3dbb('0xcb')],_0x3dbb('0xcc'),_0x3dbb('0xf0'),_0x3dbb('0xf1')),{'interaction':_0x192518})[_0x3dbb('0x28')](function(_0x48b077){return new BPromise(function(_0x4a9bdf,_0x143870){pdf['create'](_0x48b077,_0x5db9c3)[_0x3dbb('0xf2')](path[_0x3dbb('0xcf')](_0x1c7982,_0x3dbb('0xf3')+_0x32f749['id']+'-'+_0x50a6a9+_0x3dbb('0xf4')),function(_0x593c04,_0x28df2f){if(_0x593c04)return _0x143870(_0x593c04);_0x4a9bdf(_0x28df2f);});});})[_0x3dbb('0x28')](function(){return new BPromise(function(_0x2c5d39,_0x3f9c08){zipdir(_0x1c7982,{'saveTo':_0x2851a9},function(_0x5bc7ba,_0x507ca6){if(_0x5bc7ba)return _0x3f9c08(_0x5bc7ba);return _0x2c5d39(_0x507ca6);});})[_0x3dbb('0x28')](function(){return new BPromise(function(_0x2ce44d,_0x29e4af){rimraf(_0x1c7982,function(_0x2bee3c){if(_0x2bee3c)_0x29e4af(_0x2bee3c);return _0x2ce44d();});});})[_0x3dbb('0x28')](function(){return _0x490b39[_0x3dbb('0xc9')](_0x2851a9,_0x50a018,function(_0x3a2eb8){if(_0x3a2eb8){console[_0x3dbb('0xf5')](_0x3dbb('0xf6'),_0x3a2eb8);}else{fs[_0x3dbb('0xf7')](_0x2851a9);}});});});}else{return _0x490b39['sendStatus'](0xc8);}})['catch'](handleError(_0x490b39,null));}; \ No newline at end of file +var _0x80ab=['Contact.mobile','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','rawAttributes','includeAll','include','options','create','params','describe','addMessage','ids','omit','getMessages','OpenchannelMessage','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','attachments','User','CmContact','Contact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','format','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','renderFile','views','toFile','transcript-','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','json','count','limit','set','reject','save','update','destroy','then','end','stack','name','send','map','fullname','Tags','TagIds','split','forEach','push','catch','index','OpenchannelInteraction','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','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','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','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','UserId','body','compact','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile'];(function(_0x5d1f92,_0x227820){var _0x33d270=function(_0x3e943f){while(--_0x3e943f){_0x5d1f92['push'](_0x5d1f92['shift']());}};_0x33d270(++_0x227820);}(_0x80ab,0x143));var _0xb80a=function(_0x1305d6,_0x53fe29){_0x1305d6=_0x1305d6-0x0;var _0x1a6c4e=_0x80ab[_0x1305d6];return _0x1a6c4e;};'use strict';var pdf=require(_0xb80a('0x0'));var emlformat=require(_0xb80a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb80a('0x2'));var jsonpatch=require(_0xb80a('0x3'));var rp=require(_0xb80a('0x4'));var moment=require('moment');var BPromise=require(_0xb80a('0x5'));var Mustache=require(_0xb80a('0x6'));var util=require('util');var path=require(_0xb80a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb80a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb80a('0x9'));var jsforce=require(_0xb80a('0xa'));var deskjs=require(_0xb80a('0xb'));var toCsv=require(_0xb80a('0xc'));var querystring=require('querystring');var Papa=require(_0xb80a('0xd'));var Redis=require(_0xb80a('0xe'));var authService=require(_0xb80a('0xf'));var qs=require(_0xb80a('0x10'));var as=require(_0xb80a('0x11'));var hardwareService=require(_0xb80a('0x12'));var logger=require(_0xb80a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb80a('0x14'));var db=require(_0xb80a('0x15'))['db'];config['redis']=_[_0xb80a('0x16')](config[_0xb80a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb80a('0x18'))(new Redis(config[_0xb80a('0x17')]));require(_0xb80a('0x19'))['register'](socket);function respondWithStatusCode(_0x1fbba1,_0x5fe140){_0x5fe140=_0x5fe140||0xcc;return function(_0x278b9b){if(_0x278b9b){return _0x1fbba1[_0xb80a('0x1a')](_0x5fe140);}return _0x1fbba1[_0xb80a('0x1b')](_0x5fe140)['end']();};}function respondWithResult(_0x429ec7,_0x907821){_0x907821=_0x907821||0xc8;return function(_0x2985de){if(_0x2985de){return _0x429ec7['status'](_0x907821)[_0xb80a('0x1c')](_0x2985de);}};}function respondWithFilteredResult(_0x2a0249,_0x2e10ce){return function(_0x3d3f8f){if(_0x3d3f8f){var _0x2007ea=_0x3d3f8f[_0xb80a('0x1d')],_0x472016=_0x2e10ce['offset'],_0x198808=_0x2e10ce['offset']+_0x2e10ce[_0xb80a('0x1e')],_0x220b72;if(_0x198808>=_0x2007ea){_0x198808=_0x2007ea;_0x220b72=0xc8;}else{_0x220b72=0xce;}_0x2a0249[_0xb80a('0x1b')](_0x220b72);return _0x2a0249[_0xb80a('0x1f')]('Content-Range',_0x472016+'-'+_0x198808+'/'+_0x2007ea)[_0xb80a('0x1c')](_0x3d3f8f);}return null;};}function patchUpdates(_0x449d5e){return function(_0x3b9549){try{jsonpatch['apply'](_0x3b9549,_0x449d5e,!![]);}catch(_0x3c497f){return BPromise[_0xb80a('0x20')](_0x3c497f);}return _0x3b9549[_0xb80a('0x21')]();};}function saveUpdates(_0x338350,_0xfe1d5c){return function(_0x10f33d){if(_0x10f33d){return _0x10f33d[_0xb80a('0x22')](_0x338350)['then'](function(_0x4ba212){return _0x4ba212;});}return null;};}function removeEntity(_0x19565e,_0x1b00a0){return function(_0x22f2f4){if(_0x22f2f4){return _0x22f2f4[_0xb80a('0x23')]()[_0xb80a('0x24')](function(){_0x19565e[_0xb80a('0x1b')](0xcc)[_0xb80a('0x25')]();});}};}function handleEntityNotFound(_0x30cd3b,_0x375b2b){return function(_0x1f6a92){if(!_0x1f6a92){_0x30cd3b[_0xb80a('0x1a')](0x194);}return _0x1f6a92;};}function handleError(_0x2fdf8c,_0x1b83b4){_0x1b83b4=_0x1b83b4||0x1f4;return function(_0x447045){logger['error'](_0x447045[_0xb80a('0x26')]);if(_0x447045[_0xb80a('0x27')]){delete _0x447045['name'];}_0x2fdf8c[_0xb80a('0x1b')](_0x1b83b4)[_0xb80a('0x28')](_0x447045);};}function getInteractionUsers(_0x36fa59,_0x363716){return new BPromise(function(_0x2927af,_0x15e56a){try{if(_0x363716[_0x36fa59['id']]){_0x36fa59['Users']=_[_0xb80a('0x29')](_0x363716[_0x36fa59['id']],function(_0x158844){return{'id':_0x158844['id'],'fullname':_0x158844[_0xb80a('0x2a')]};});}}catch(_0x70235a){_0x15e56a(_0x70235a);}_0x2927af(_0x36fa59);});}function getInteractionTags(_0x596a18,_0x3086a0){return new BPromise(function(_0x33e331,_0x1df255){try{if(_0x596a18['TagIds']){_0x596a18[_0xb80a('0x2b')]=[];_0x596a18[_0xb80a('0x2c')][_0xb80a('0x2d')](',')[_0xb80a('0x2e')](function(_0x5e7420){_0x596a18[_0xb80a('0x2b')][_0xb80a('0x2f')](_0x3086a0[_0x5e7420]);});}delete _0x596a18['TagIds'];}catch(_0x42d5b0){_0x1df255(_0x42d5b0);}_0x33e331(_0x596a18);});}function updateOpenchannelInteraction(_0x1f41f0,_0x534b9c,_0x349464){return new BPromise(function(_0x2cefe3,_0x1f6bce){return getInteractionUsers(_0x1f41f0,_0x349464)[_0xb80a('0x24')](function(_0x131774){return getInteractionTags(_0x131774,_0x534b9c);})['then'](function(_0x455352){_0x2cefe3(_0x455352);})[_0xb80a('0x30')](function(_0x54b798){_0x1f6bce(_0x54b798);});});}exports[_0xb80a('0x31')]=function(_0x415e43,_0x1b9b9b){var _0x5032fb={},_0x1e16bf={},_0x3b722f={'count':0x0,'rows':[]};var _0x34d524=_[_0xb80a('0x29')](db[_0xb80a('0x32')]['rawAttributes'],function(_0x10babc){return{'name':_0x10babc[_0xb80a('0x33')],'type':_0x10babc[_0xb80a('0x34')][_0xb80a('0x35')]};});_0x1e16bf[_0xb80a('0x36')]=_[_0xb80a('0x29')](_0x34d524,'name');_0x1e16bf['query']=_[_0xb80a('0x37')](_0x415e43[_0xb80a('0x38')]);_0x1e16bf[_0xb80a('0x39')]=_[_0xb80a('0x3a')](_0x1e16bf['model'],_0x1e16bf['query']);_0x5032fb[_0xb80a('0x3b')]=_[_0xb80a('0x3a')](_0x1e16bf[_0xb80a('0x36')],qs['fields'](_0x415e43['query'][_0xb80a('0x3c')]));_0x5032fb[_0xb80a('0x3b')]=_0x5032fb[_0xb80a('0x3b')]['length']?_0x5032fb[_0xb80a('0x3b')]:_0x1e16bf[_0xb80a('0x36')];if(!_0x415e43[_0xb80a('0x38')][_0xb80a('0x3d')](_0xb80a('0x3e'))){_0x5032fb[_0xb80a('0x1e')]=qs[_0xb80a('0x1e')](_0x415e43['query'][_0xb80a('0x1e')]);_0x5032fb['offset']=qs[_0xb80a('0x3f')](_0x415e43[_0xb80a('0x38')]['offset']);}_0x5032fb[_0xb80a('0x40')]=qs[_0xb80a('0x41')](_0x415e43['query'][_0xb80a('0x41')]);_0x5032fb[_0xb80a('0x42')]=qs[_0xb80a('0x39')](_['pick'](_0x415e43[_0xb80a('0x38')],_0x1e16bf[_0xb80a('0x39')]),_0x34d524);var _0x1cd88=[];var _0x160a59=squel[_0xb80a('0x43')]()[_0xb80a('0x44')]('id')[_0xb80a('0x44')]('name')[_0xb80a('0x44')](_0xb80a('0x45'))[_0xb80a('0x46')](_0xb80a('0x47'));var _0x51433d=squel['select']()[_0xb80a('0x44')](_0xb80a('0x48'))[_0xb80a('0x44')]('u.fullname')[_0xb80a('0x44')](_0xb80a('0x49'))[_0xb80a('0x46')]('user_has_openchannel_interactions','ui')[_0xb80a('0x4a')](_0xb80a('0x4b'),'u',_0xb80a('0x4c'));var _0xc26425=squel[_0xb80a('0x43')]()[_0xb80a('0x46')](_0xb80a('0x4d'),'i')[_0xb80a('0x4a')](_0xb80a('0x4e'),'c',_0xb80a('0x4f'))['left_join'](_0xb80a('0x4b'),'o',_0xb80a('0x50'))[_0xb80a('0x4a')](_0xb80a('0x51'),'a',_0xb80a('0x52'))['left_join']('openchannel_messages','me',_0xb80a('0x53'))['left_join'](_0xb80a('0x54'),'it',_0xb80a('0x55'))[_0xb80a('0x4a')](_0xb80a('0x47'),'t',_0xb80a('0x56'));var _0x434082=squel[_0xb80a('0x57')]();var _0xa9456d=[];var _0x3024d4=squel[_0xb80a('0x57')]();var _0x4853a4;if(_0x415e43[_0xb80a('0x38')][_0xb80a('0x58')]){_0x4853a4=as[_0xb80a('0x59')](_0x415e43[_0xb80a('0x38')][_0xb80a('0x58')]);var _0x310192=_0x4853a4['sqlOperator'];for(var _0x3a0a70=0x0;_0x3a0a70<_0x4853a4['conditions'][_0xb80a('0x5a')];_0x3a0a70++){var _0x3ab6e6=_0x4853a4[_0xb80a('0x5b')][_0x3a0a70];var _0x1d3937='i';var _0x1d8781=_[_0xb80a('0x5c')](_0x34d524,[_0xb80a('0x27'),_0x3ab6e6[_0xb80a('0x44')]]);if(!_0x1d8781){switch(_0x3ab6e6[_0xb80a('0x44')]){case _0xb80a('0x5d'):if(_0x3ab6e6[_0xb80a('0x5e')]==0x1){_0xc26425[_0xb80a('0x5f')]('`'+_0x3ab6e6['field']+_0xb80a('0x60'));}else{_0xc26425[_0xb80a('0x5f')]('`'+_0x3ab6e6[_0xb80a('0x44')]+_0xb80a('0x61'));}break;case'Contact':if(_0x3ab6e6[_0xb80a('0x62')]===_0xb80a('0x63')){if(_0x3ab6e6[_0xb80a('0x5e')][_0xb80a('0x2d')]('\x20')[_0xb80a('0x5a')]>0x1){_0x434082[_0x310192]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb80a('0x64')](_0x3ab6e6['value']),null);}else{var _0x26d28b='%'+_0x3ab6e6[_0xb80a('0x5e')]+'%';_0x434082[_0x310192](_0xb80a('0x65'),_0x26d28b,_0x26d28b,_0x26d28b);}}else{_0x1d8781=_[_0xb80a('0x5c')](_0x34d524,['name','ContactId']);_0x3ab6e6['field']=_0xb80a('0x66');_0x46d324=as[_0xb80a('0x67')](_0x1d3937,_0x1d8781[_0xb80a('0x34')],_0x3ab6e6);_0x434082[_0x310192](_0x46d324[_0xb80a('0x68')],_0x46d324[_0xb80a('0x5e')][_0xb80a('0x69')],_0x46d324[_0xb80a('0x5e')]['end']);}break;case _0xb80a('0x6a'):var _0x150492=_0x3ab6e6[_0xb80a('0x5e')][_0xb80a('0x2d')](',')[_0xb80a('0x29')](function(_0x2e5c94){return Number(_0x2e5c94);});_0x150492[_0xb80a('0x2e')](function(_0x5b7d58){_0x3024d4['or'](_0xb80a('0x6b'),'%,'+_0x5b7d58+',%');});_0xa9456d=_[_0xb80a('0x6c')](_0xa9456d,_0x150492);break;case'User':if(_0x3ab6e6[_0xb80a('0x62')]===_0xb80a('0x63')){_0x434082[_0x310192]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3ab6e6[_0xb80a('0x5e')]+'%',null);}else{_0x1d8781=_[_0xb80a('0x5c')](_0x34d524,[_0xb80a('0x27'),_0xb80a('0x6d')]);_0x3ab6e6[_0xb80a('0x44')]='UserId';_0x46d324=as['buildExpression'](_0x1d3937,_0x1d8781[_0xb80a('0x34')],_0x3ab6e6);_0x434082[_0x310192](_0x46d324[_0xb80a('0x68')],_0x46d324[_0xb80a('0x5e')][_0xb80a('0x69')],_0x46d324[_0xb80a('0x5e')][_0xb80a('0x25')]);}break;case _0xb80a('0x6e'):_0x46d324=as[_0xb80a('0x67')]('me',null,_0x3ab6e6);_0x434082[_0x310192](_0x46d324[_0xb80a('0x68')],_0x46d324[_0xb80a('0x5e')]['start'],_0x46d324['value'][_0xb80a('0x25')]);break;}}else{var _0x46d324=as[_0xb80a('0x67')](_0x1d3937,_0x1d8781[_0xb80a('0x34')],_0x3ab6e6);_0x434082[_0x310192](_0x46d324['text'],_0x46d324[_0xb80a('0x5e')][_0xb80a('0x69')],_0x46d324[_0xb80a('0x5e')]['end']);}}}else{var _0x3cf436=_(_0x415e43[_0xb80a('0x38')])[_0xb80a('0x37')]()[_0xb80a('0x29')](function(_0x3e8b81){return _['some'](_0x34d524,[_0xb80a('0x27'),_0x3e8b81])?_0x3e8b81:undefined;})[_0xb80a('0x6f')]()[_0xb80a('0x5e')]();if(!_['isEmpty'](_0x3cf436)){_0x3cf436[_0xb80a('0x2e')](function(_0x2d0774){if(_0x2d0774==='OpenchannelAccountId'){_0xc26425[_0xb80a('0x42')](_0xb80a('0x70'),[][_0xb80a('0x71')](_0x415e43[_0xb80a('0x38')][_0x2d0774]));}else if(_0x2d0774===_0xb80a('0x72')){var _0x1d645f=JSON[_0xb80a('0x73')](_0x415e43[_0xb80a('0x38')][_0x2d0774])['$gte'];var _0x9e7d51=JSON[_0xb80a('0x73')](_0x415e43[_0xb80a('0x38')][_0x2d0774])['$lte'];_0xc26425[_0xb80a('0x42')](_0xb80a('0x74'),_0x1d645f,_0x9e7d51);}else{if(_0x415e43['query'][_0x2d0774]===_0xb80a('0x75')){_0xc26425[_0xb80a('0x42')]('i.'+_0x2d0774+_0xb80a('0x76'));}else{_0xc26425['where']('i.'+_0x2d0774+_0xb80a('0x77'),_0x415e43[_0xb80a('0x38')][_0x2d0774]);}}});}if(_0x415e43['query']['read']){if(_0x415e43[_0xb80a('0x38')][_0xb80a('0x78')]==0x1){_0xc26425[_0xb80a('0x5f')](_0xb80a('0x79'));}else{_0xc26425['having'](_0xb80a('0x7a'));}}if(_0x415e43[_0xb80a('0x38')][_0xb80a('0x7b')]){_0xa9456d=_[_0xb80a('0x7c')](_0x415e43[_0xb80a('0x38')][_0xb80a('0x7b')])?_0x415e43['query']['tag']:new Array(_0x415e43[_0xb80a('0x38')]['tag']);_0xa9456d['forEach'](function(_0x451d49){_0x3024d4['or'](_0xb80a('0x6b'),'%,'+_0x451d49+',%');});}if(_0x415e43[_0xb80a('0x38')][_0xb80a('0x7d')]){var _0x4caa92=_0x415e43[_0xb80a('0x38')][_0xb80a('0x7d')][_0xb80a('0x7e')]('\x5c','\x5c\x5c')[_0xb80a('0x7e')]('\x27\x27',_0xb80a('0x7f'));if(qs[_0xb80a('0x80')](_0x4caa92)){_0x434082['or'](_0xb80a('0x81'),_0x4caa92+'%');}else{_0x434082['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4caa92))['or'](_0xb80a('0x82'),_0x4caa92+'%')['or'](_0xb80a('0x83'),_0x4caa92+'%');}}}_0xc26425[_0xb80a('0x42')](_0x434082);_0xc26425[_0xb80a('0x84')](_0xb80a('0x85'));var _0x66d6fa={'type':db[_0xb80a('0x86')][_0xb80a('0x87')][_0xb80a('0x88')],'raw':!![]};var _0x5c5de9=_0xc26425[_0xb80a('0x89')]();_0x5c5de9[_0xb80a('0x44')](_0xb80a('0x85'));_0x5c5de9[_0xb80a('0x44')](_0xb80a('0x8a'),_0xb80a('0x5d'));if(_0x5032fb[_0xb80a('0x40')]){_0x5032fb[_0xb80a('0x40')]['forEach'](function(_0x4e80d2){_0xc26425[_0xb80a('0x40')]('i.'+_0x4e80d2[0x0],_0x4e80d2[0x1]===_0xb80a('0x8b')?![]:!![]);});}if(!_[_0xb80a('0x8c')](_0xa9456d)){_0xc26425[_0xb80a('0x5f')](_0x3024d4);_0x5c5de9['where'](_0xb80a('0x8d'),_0xa9456d);}BPromise[_0xb80a('0x8e')]()['then'](function(){if(!_0x4853a4){if(_0x415e43[_0xb80a('0x38')][_0xb80a('0x8f')]||_0x415e43['query'][_0xb80a('0x90')])return;_0x5c5de9[_0xb80a('0x42')](_0xb80a('0x91'));_0xc26425[_0xb80a('0x42')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}return _0x415e43[_0xb80a('0x92')][_0xb80a('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5dd716){if(_['isEmpty'](_0x5dd716)){_0x5c5de9[_0xb80a('0x42')](_0xb80a('0x94'));_0xc26425[_0xb80a('0x42')](_0xb80a('0x94'));}else{_0x5c5de9['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xb80a('0x29')](_0x5dd716,'id'));_0xc26425[_0xb80a('0x42')](_0xb80a('0x70'),_['map'](_0x5dd716,'id'));}});})[_0xb80a('0x24')](function(){db['sequelize']['query'](_0x5c5de9[_0xb80a('0x95')](),_0x66d6fa)[_0xb80a('0x24')](function(_0x467f42){_0x3b722f['count']=_0x467f42[_0xb80a('0x5a')];if(_0x3b722f[_0xb80a('0x1d')]===0x0)return[];return db[_0xb80a('0x96')]['query'](_0x160a59[_0xb80a('0x95')](),_0x66d6fa)[_0xb80a('0x24')](function(_0x2283ba){_0x1cd88=_[_0xb80a('0x97')](_0x2283ba,'id');_0x66d6fa=_[_0xb80a('0x98')](_0x66d6fa,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x415e43['query'][_0xb80a('0x3c')]){_0x5032fb[_0xb80a('0x3b')][_0xb80a('0x2e')](function(_0x43927d){_0xc26425[_0xb80a('0x44')]('i.'+_0x43927d);});}else{_0xc26425[_0xb80a('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xc26425[_0xb80a('0x44')](_0xb80a('0x99'),_0xb80a('0x9a'));_0xc26425[_0xb80a('0x44')](_0xb80a('0x9b'),_0xb80a('0x9c'));_0xc26425['field'](_0xb80a('0x9d'));_0xc26425['field'](_0xb80a('0x9e'),_0xb80a('0x9f'));_0xc26425[_0xb80a('0x44')](_0xb80a('0xa0'),'Contact.lastName');_0xc26425[_0xb80a('0x44')](_0xb80a('0xa1'),'Contact.email');_0xc26425[_0xb80a('0x44')](_0xb80a('0xa2'),_0xb80a('0xa3'));_0xc26425['field'](_0xb80a('0xa4'),_0xb80a('0xa5'));_0xc26425[_0xb80a('0x44')]('c.fax','Contact.fax');_0xc26425['field'](_0xb80a('0xa6'),_0xb80a('0xa7'));_0xc26425['field']('o.internal',_0xb80a('0xa8'));_0xc26425[_0xb80a('0x44')](_0xb80a('0xa9'),_0xb80a('0x2c'));}if(_0x5032fb[_0xb80a('0x1e')])_0xc26425['limit'](_0x5032fb[_0xb80a('0x1e')]);if(_0x5032fb[_0xb80a('0x3f')])_0xc26425[_0xb80a('0x3f')](_0x5032fb[_0xb80a('0x3f')]);return db[_0xb80a('0x96')][_0xb80a('0x38')](_0xc26425[_0xb80a('0x95')](),_0x66d6fa);})[_0xb80a('0x24')](function(_0x4e16d4){_0x51433d[_0xb80a('0x42')](_0xb80a('0xaa'),_['map'](_0x4e16d4,'id'));return db[_0xb80a('0x96')]['query'](_0x51433d[_0xb80a('0x95')](),_0x66d6fa)[_0xb80a('0x24')](function(_0x193ca8){var _0x3eee1f=_[_0xb80a('0xab')](_0x193ca8,_0xb80a('0xac'));var _0x246fe5=[];_0x4e16d4[_0xb80a('0x2e')](function(_0x291bea){_0x246fe5[_0xb80a('0x2f')](updateOpenchannelInteraction(_0x291bea,_0x1cd88,_0x3eee1f));});return BPromise[_0xb80a('0xad')](_0x246fe5);});});})[_0xb80a('0x24')](function(_0x3cfdf8){_0x3b722f[_0xb80a('0xae')]=_0x3cfdf8;return _0x3b722f;})[_0xb80a('0x24')](respondWithFilteredResult(_0x1b9b9b,_0x5032fb));})[_0xb80a('0x30')](handleError(_0x1b9b9b,null));};exports[_0xb80a('0xaf')]=function(_0x1ca85d,_0x3dd4cd){var _0x5ee73f={'raw':![],'where':{'id':_0x1ca85d['params']['id']}},_0x44790d={};_0x44790d[_0xb80a('0x36')]=_[_0xb80a('0x37')](db[_0xb80a('0x32')][_0xb80a('0xb0')]);_0x44790d[_0xb80a('0x38')]=_[_0xb80a('0x37')](_0x1ca85d['query']);_0x44790d[_0xb80a('0x39')]=_[_0xb80a('0x3a')](_0x44790d[_0xb80a('0x36')],_0x44790d[_0xb80a('0x38')]);_0x5ee73f[_0xb80a('0x3b')]=_[_0xb80a('0x3a')](_0x44790d[_0xb80a('0x36')],qs['fields'](_0x1ca85d['query']['fields']));_0x5ee73f[_0xb80a('0x3b')]=_0x5ee73f[_0xb80a('0x3b')][_0xb80a('0x5a')]?_0x5ee73f['attributes']:_0x44790d[_0xb80a('0x36')];if(_0x1ca85d[_0xb80a('0x38')][_0xb80a('0xb1')]){_0x5ee73f[_0xb80a('0xb2')]=[{'all':!![]}];}_0x5ee73f=_[_0xb80a('0x98')]({},_0x5ee73f,_0x1ca85d[_0xb80a('0xb3')]);return db['OpenchannelInteraction'][_0xb80a('0x5c')](_0x5ee73f)[_0xb80a('0x24')](handleEntityNotFound(_0x3dd4cd,null))[_0xb80a('0x24')](respondWithResult(_0x3dd4cd,null))[_0xb80a('0x30')](handleError(_0x3dd4cd,null));};exports[_0xb80a('0xb4')]=function(_0x4b75ac,_0x58c0d5){return db[_0xb80a('0x32')]['create'](_0x4b75ac[_0xb80a('0x6e')],{})['then'](respondWithResult(_0x58c0d5,0xc9))[_0xb80a('0x30')](handleError(_0x58c0d5,null));};exports[_0xb80a('0x22')]=function(_0xba513e,_0x42b1e4){if(_0xba513e['body']['id']){delete _0xba513e['body']['id'];}return db[_0xb80a('0x32')][_0xb80a('0x5c')]({'where':{'id':_0xba513e[_0xb80a('0xb5')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x42b1e4,null))['then'](saveUpdates(_0xba513e[_0xb80a('0x6e')],null))['then'](respondWithResult(_0x42b1e4,null))['catch'](handleError(_0x42b1e4,null));};exports[_0xb80a('0x23')]=function(_0x25c888,_0x97a505){return db['OpenchannelInteraction'][_0xb80a('0x5c')]({'where':{'id':_0x25c888[_0xb80a('0xb5')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x97a505,null))['then'](removeEntity(_0x97a505,null))['catch'](handleError(_0x97a505,null));};exports[_0xb80a('0xb6')]=function(_0x4e0c90,_0x573a33){return db[_0xb80a('0x32')][_0xb80a('0xb6')]()[_0xb80a('0x24')](respondWithResult(_0x573a33,null))[_0xb80a('0x30')](handleError(_0x573a33,null));};exports[_0xb80a('0xb7')]=function(_0x306622,_0x369615,_0x3a1824){return db['OpenchannelMessage'][_0xb80a('0x5c')]({'where':{'id':_0x306622[_0xb80a('0xb5')]['id']}})['then'](handleEntityNotFound(_0x369615,null))[_0xb80a('0x24')](function(_0x258595){if(_0x258595){return _0x258595[_0xb80a('0xb7')](_0x306622[_0xb80a('0x6e')][_0xb80a('0xb8')],_[_0xb80a('0xb9')](_0x306622['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x369615,null))['catch'](handleError(_0x369615,null));};exports[_0xb80a('0xba')]=function(_0x791fcf,_0xf0a02d,_0x3585df){var _0x4c9d41={'raw':![],'where':{}};var _0x2bd7f9={};var _0x500c89={'count':0x0,'rows':[]};return db[_0xb80a('0x32')]['findOne']({'where':{'id':_0x791fcf[_0xb80a('0xb5')]['id']}})['then'](handleEntityNotFound(_0xf0a02d,null))[_0xb80a('0x24')](function(_0x53fca0){if(_0x53fca0){_0x2bd7f9[_0xb80a('0x36')]=_['keys'](db[_0xb80a('0xbb')][_0xb80a('0xb0')]);_0x2bd7f9['query']=_[_0xb80a('0x37')](_0x791fcf[_0xb80a('0x38')]);_0x2bd7f9['filters']=_[_0xb80a('0x3a')](_0x2bd7f9[_0xb80a('0x36')],_0x2bd7f9[_0xb80a('0x38')]);_0x4c9d41['attributes']=_[_0xb80a('0x3a')](_0x2bd7f9['model'],qs[_0xb80a('0x3c')](_0x791fcf['query'][_0xb80a('0x3c')]));_0x4c9d41[_0xb80a('0x3b')]=_0x4c9d41[_0xb80a('0x3b')]['length']?_0x4c9d41[_0xb80a('0x3b')]:_0x2bd7f9[_0xb80a('0x36')];if(!_0x791fcf[_0xb80a('0x38')][_0xb80a('0x3d')](_0xb80a('0x3e'))){_0x4c9d41['limit']=qs[_0xb80a('0x1e')](_0x791fcf[_0xb80a('0x38')][_0xb80a('0x1e')]);_0x4c9d41['offset']=qs['offset'](_0x791fcf[_0xb80a('0x38')][_0xb80a('0x3f')]);}_0x4c9d41[_0xb80a('0x40')]=qs[_0xb80a('0x41')](_0x791fcf[_0xb80a('0x38')][_0xb80a('0x41')]);_0x4c9d41[_0xb80a('0x42')]=qs[_0xb80a('0x39')](_[_0xb80a('0xbc')](_0x791fcf[_0xb80a('0x38')],_0x2bd7f9['filters']));_0x4c9d41[_0xb80a('0x42')][_0xb80a('0xac')]=_0x53fca0['id'];if(_0x791fcf[_0xb80a('0x38')][_0xb80a('0x7d')]){_0x4c9d41[_0xb80a('0x42')]=_[_0xb80a('0x98')](_0x4c9d41['where'],{'$or':_[_0xb80a('0x29')](_0x4c9d41[_0xb80a('0x3b')],function(_0x4ac3c8){var _0x386e7a={};_0x386e7a[_0x4ac3c8]={'$like':'%'+_0x791fcf['query'][_0xb80a('0x7d')]+'%'};return _0x386e7a;})});}if(_0x791fcf['query'][_0xb80a('0xbd')]){var _0x255477=_0x791fcf['query'][_0xb80a('0xbd')][_0xb80a('0x2d')](',');var _0x2f625c={};_0x2f625c[_0x255477[0x0]]={'$gte':moment(_0x255477[0x1])['format'](_0xb80a('0xbe'))};_0x4c9d41['where']=_[_0xb80a('0x98')](_0x4c9d41[_0xb80a('0x42')],_0x2f625c);}_0x4c9d41=_['merge']({},_0x4c9d41,_0x791fcf['options']);return db[_0xb80a('0xbb')][_0xb80a('0x1d')]({'where':_0x4c9d41[_0xb80a('0x42')]})[_0xb80a('0x24')](function(_0x1d51ec){_0x500c89[_0xb80a('0x1d')]=_0x1d51ec;if(_0x791fcf[_0xb80a('0x38')][_0xb80a('0xb1')]){_0x4c9d41['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x4c9d41);})[_0xb80a('0x24')](function(_0x405a10){_0x500c89[_0xb80a('0xae')]=_0x405a10;return _0x500c89;});}})['then'](respondWithFilteredResult(_0xf0a02d,_0x4c9d41))[_0xb80a('0x30')](handleError(_0xf0a02d,null));};exports[_0xb80a('0xbf')]=function(_0x4963eb,_0x5c652e,_0x1bc59b){return db[_0xb80a('0x32')][_0xb80a('0x5c')]({'where':{'id':_0x4963eb[_0xb80a('0xb5')]['id']}})[_0xb80a('0x24')](handleEntityNotFound(_0x5c652e,null))['then'](function(_0x216d32){if(_0x216d32){return _0x216d32[_0xb80a('0xc0')](_0x4963eb['body'][_0xb80a('0xb8')],_[_0xb80a('0xb9')](_0x4963eb[_0xb80a('0x6e')],[_0xb80a('0xb8'),'id'])||{})[_0xb80a('0xc1')](function(){return db[_0xb80a('0x6a')]['findAll']({'attributes':['id','name',_0xb80a('0x45')],'where':{'id':_0x4963eb[_0xb80a('0x6e')]['ids']}});})[_0xb80a('0x24')](function(_0x4c41be){socket[_0xb80a('0xc2')](_0xb80a('0xc3'),{'id':Number(_0x4963eb[_0xb80a('0xb5')]['id']),'tags':_0x4c41be||[]});return{'id':Number(_0x4963eb['params']['id']),'tags':_0x4c41be||[]};});}})[_0xb80a('0x24')](respondWithResult(_0x5c652e,null))['catch'](handleError(_0x5c652e,null));};exports[_0xb80a('0xc4')]=function(_0x244174,_0x2eee42,_0x1827b4){return db[_0xb80a('0x32')][_0xb80a('0x5c')]({'where':{'id':_0x244174[_0xb80a('0xb5')]['id']}})['then'](handleEntityNotFound(_0x2eee42,null))[_0xb80a('0x24')](function(_0x37c9d5){if(_0x37c9d5){return _0x37c9d5[_0xb80a('0xc4')](_0x244174[_0xb80a('0x38')]['ids']);}})[_0xb80a('0x24')](respondWithStatusCode(_0x2eee42,null))[_0xb80a('0x30')](handleError(_0x2eee42,null));};exports[_0xb80a('0xc5')]=function(_0x4ddd0a,_0x2ccc4c){var _0x209e11=moment()[_0xb80a('0xc6')]()[_0xb80a('0x95')]();var _0x2c6f09=path['join'](config['root'],_0xb80a('0xc7'),_0xb80a('0xc8'),_0xb80a('0xc9'));var _0x228d70=path[_0xb80a('0xca')](config[_0xb80a('0xcb')],_0xb80a('0xc7'),_0xb80a('0xc8'),_0xb80a('0xcc'));var _0x5a83a3=path['join'](_0x2c6f09,_0x209e11);var _0x3caa70=util['format']('transcript-%d-%s.zip',_0x4ddd0a['params']['id'],_0x209e11);var _0x265202=path[_0xb80a('0xca')](_0x2c6f09,_0x3caa70);var _0x364173=[];_0x364173[_0xb80a('0x2f')]({'model':db['User'],'as':_0xb80a('0xcd'),'attributes':['id',_0xb80a('0x2a')],'raw':!![]});_0x364173['push']({'model':db[_0xb80a('0xce')],'as':_0xb80a('0xcf'),'attributes':['id',_0xb80a('0xd0'),_0xb80a('0xd1')],'raw':!![]});if(_0x4ddd0a[_0xb80a('0x38')][_0xb80a('0xcc')]){_0x364173[_0xb80a('0x2f')]({'model':db[_0xb80a('0xd2')],'as':_0xb80a('0xd2'),'raw':!![]});}var _0x30c855=[{'model':db[_0xb80a('0xbb')],'as':_0xb80a('0xd3'),'attributes':['id',_0xb80a('0x6e'),_0xb80a('0x72'),'direction',_0xb80a('0xd4'),_0xb80a('0x78')],'include':_0x364173}];_0x30c855[_0xb80a('0x2f')]({'model':db[_0xb80a('0xd5')],'as':'Account','attributes':['id',_0xb80a('0x27')]});_0x30c855[_0xb80a('0x2f')]({'model':db[_0xb80a('0xcd')],'as':_0xb80a('0xd6'),'attributes':['id',_0xb80a('0x2a')]});return db[_0xb80a('0x32')]['find']({'where':{'id':_0x4ddd0a[_0xb80a('0xb5')]['id']},'include':_0x30c855})['then'](handleEntityNotFound(_0x2ccc4c,null))[_0xb80a('0x24')](function(_0x3c41d4){if(_0x3c41d4){var _0x1065a2=_0x3c41d4[_0xb80a('0xd7')]({'plain':!![]});fs[_0xb80a('0xd8')](_0x5a83a3);var _0x2860cc={'format':'A4','border':_0xb80a('0xd9'),'header':{'height':'40px','contents':{'first':_0xb80a('0xda')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xb80a('0xdb'),util[_0xb80a('0xdc')](_0xb80a('0xdd'),_0xb80a('0xde'),_0x1065a2['id']),moment()['format'](_0xb80a('0xdf'))[_0xb80a('0x95')]())}}};var _0xc4b994={'channel':_0xb80a('0xde'),'account':_0x1065a2['Account']['name'],'agent':_0x1065a2[_0xb80a('0xd6')]?_0x1065a2[_0xb80a('0xd6')][_0xb80a('0x2a')]:_0xb80a('0xe0'),'createdAt':moment(_0x1065a2[_0xb80a('0x72')])[_0xb80a('0xdc')](_0xb80a('0xbe'))[_0xb80a('0x95')](),'closedAt':_0x1065a2[_0xb80a('0xe1')]?moment(_0x1065a2['closedAt'])[_0xb80a('0xdc')](_0xb80a('0xbe'))[_0xb80a('0x95')]():'','disposition':_0x1065a2[_0xb80a('0xe2')],'visibility':_0x1065a2[_0xb80a('0xe3')]?_0xb80a('0xe4'):_0xb80a('0xe5'),'messages':_(_0x1065a2[_0xb80a('0xd3')])[_0xb80a('0x7d')]({'secret':![]})[_0xb80a('0x29')](function(_0x1e0be7){if(_0x1e0be7[_0xb80a('0xd2')]){var _0x9cef34=path[_0xb80a('0xca')](_0x228d70,_0x1e0be7['Attachment'][_0xb80a('0xe6')]);if(fs[_0xb80a('0xe7')](_0x9cef34)){fs[_0xb80a('0xe8')](_0x9cef34)[_0xb80a('0xe9')](fs[_0xb80a('0xea')](path[_0xb80a('0xca')](_0x5a83a3,_0x1e0be7['Attachment'][_0xb80a('0xe6')])));}}return{'date':moment(_0x1e0be7['createdAt'])[_0xb80a('0xdc')](_0xb80a('0xbe'))['toString'](),'sender':_0x1e0be7[_0xb80a('0xeb')]===_0xb80a('0xec')?_0x1e0be7[_0xb80a('0xcd')]?_0x1e0be7['User']['fullname']:_0xb80a('0xed'):_0x1e0be7[_0xb80a('0xcf')]['firstName']+(_0x1e0be7[_0xb80a('0xcf')][_0xb80a('0xd1')]?'\x20'+_0x1e0be7['Contact'][_0xb80a('0xd1')]:''),'body':_0x1e0be7[_0xb80a('0xd2')]?_0x1e0be7[_0xb80a('0xd2')][_0xb80a('0xe6')]:_0x1e0be7[_0xb80a('0x6e')],'direction':_0x1e0be7[_0xb80a('0xeb')]===_0xb80a('0xec')?'A':'C','secret':_0x1e0be7['secret'],'read':_0x1e0be7['read'],'attachment':_0x1e0be7[_0xb80a('0xd2')]};})[_0xb80a('0x5e')]()};return ejs[_0xb80a('0xee')](path['join'](config[_0xb80a('0xcb')],_0xb80a('0xc7'),_0xb80a('0xef'),'downloadInteraction.html'),{'interaction':_0xc4b994})['then'](function(_0x1be177){return new BPromise(function(_0x54d72b,_0x5b60fe){pdf[_0xb80a('0xb4')](_0x1be177,_0x2860cc)[_0xb80a('0xf0')](path['join'](_0x5a83a3,_0xb80a('0xf1')+_0x1065a2['id']+'-'+_0x209e11+'.pdf'),function(_0x342c59,_0x1b4d0c){if(_0x342c59)return _0x5b60fe(_0x342c59);_0x54d72b(_0x1b4d0c);});});})[_0xb80a('0x24')](function(){return new BPromise(function(_0x44b24d,_0x553c50){zipdir(_0x5a83a3,{'saveTo':_0x265202},function(_0x5b7aad,_0x1d88f7){if(_0x5b7aad)return _0x553c50(_0x5b7aad);return _0x44b24d(_0x1d88f7);});})['then'](function(){return new BPromise(function(_0x408697,_0x48aeb0){rimraf(_0x5a83a3,function(_0x53e232){if(_0x53e232)_0x48aeb0(_0x53e232);return _0x408697();});});})[_0xb80a('0x24')](function(){return _0x2ccc4c[_0xb80a('0xc5')](_0x265202,_0x3caa70,function(_0x46512f){if(_0x46512f){console['log'](_0xb80a('0xf2'),_0x46512f);}else{fs[_0xb80a('0xf3')](_0x265202);}});});});}else{return _0x2ccc4c[_0xb80a('0x1a')](0xc8);}})[_0xb80a('0x30')](handleError(_0x2ccc4c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 1e9797e..b1619ad 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 _0x61e5=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events'];(function(_0x39f7b0,_0x43577e){var _0x33a836=function(_0x474b78){while(--_0x474b78){_0x39f7b0['push'](_0x39f7b0['shift']());}};_0x33a836(++_0x43577e);}(_0x61e5,0x97));var _0x561e=function(_0x13c34e,_0x2ce6ab){_0x13c34e=_0x13c34e-0x0;var _0x3da80a=_0x61e5[_0x13c34e];return _0x3da80a;};'use strict';var EventEmitter=require(_0x561e('0x0'));var OpenchannelInteraction=require(_0x561e('0x1'))['db'][_0x561e('0x2')];var OpenchannelMessage=require(_0x561e('0x1'))['db'][_0x561e('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x561e('0x4')](0x0);var events={'afterCreate':_0x561e('0x5'),'afterUpdate':_0x561e('0x6'),'afterDestroy':_0x561e('0x7')};function emitEvent(_0x13e171){return function(_0xaf3e49,_0x1fae28,_0x12deda){_0xaf3e49[_0x561e('0x8')]({'attributes':['id'],'raw':!![]})[_0x561e('0x9')](function(_0x20bfea){_0xaf3e49[_0x561e('0xa')]('Users',_0x20bfea[_0x561e('0xb')](function(_0x348177){return{'id':_0x348177['id']};}));return OpenchannelMessage[_0x561e('0xc')]({'where':{'OpenchannelInteractionId':_0xaf3e49['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5d6eba){_0xaf3e49[_0x561e('0xa')](_0x561e('0xd'),_0x5d6eba[_0x561e('0xe')]);OpenchannelInteractionEvents[_0x561e('0xf')](_0x13e171+':'+_0xaf3e49['id'],_0xaf3e49);OpenchannelInteractionEvents[_0x561e('0xf')](_0x13e171,_0xaf3e49);_0x12deda(null);})[_0x561e('0x10')](_0x12deda(null));};}for(var e in events){if(events[_0x561e('0x11')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x561e('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5004=['findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','Users'];(function(_0x4fc80b,_0xfe1b3d){var _0x119dba=function(_0x16ed12){while(--_0x16ed12){_0x4fc80b['push'](_0x4fc80b['shift']());}};_0x119dba(++_0xfe1b3d);}(_0x5004,0x194));var _0x4500=function(_0x53ec73,_0x288200){_0x53ec73=_0x53ec73-0x0;var _0x5b4475=_0x5004[_0x53ec73];return _0x5b4475;};'use strict';var EventEmitter=require(_0x4500('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x4500('0x1')];var OpenchannelMessage=require(_0x4500('0x2'))['db'][_0x4500('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4500('0x4')](0x0);var events={'afterCreate':_0x4500('0x5'),'afterUpdate':_0x4500('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2eec1f){return function(_0x32fa8f,_0x29278a,_0x574981){_0x32fa8f[_0x4500('0x7')]({'attributes':['id'],'raw':!![]})[_0x4500('0x8')](function(_0xa8c0a9){_0x32fa8f['setDataValue'](_0x4500('0x9'),_0xa8c0a9['map'](function(_0x487743){return{'id':_0x487743['id']};}));return OpenchannelMessage[_0x4500('0xa')]({'where':{'OpenchannelInteractionId':_0x32fa8f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4500('0x8')](function(_0x53df56){_0x32fa8f[_0x4500('0xb')](_0x4500('0xc'),_0x53df56['length']);OpenchannelInteractionEvents[_0x4500('0xd')](_0x2eec1f+':'+_0x32fa8f['id'],_0x32fa8f);OpenchannelInteractionEvents['emit'](_0x2eec1f,_0x32fa8f);_0x574981(null);})[_0x4500('0xe')](_0x574981(null));};}for(var e in events){if(events[_0x4500('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x4500('0x10')](e,emitEvent(event));}}module[_0x4500('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 59ef61d..c9e2712 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 _0xbeea=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbeea,0xb1));var _0xabee=function(_0x1bf5f5,_0x4c555c){_0x1bf5f5=_0x1bf5f5-0x0;var _0x24320c=_0xbeea[_0x1bf5f5];return _0x24320c;};'use strict';var _=require(_0xabee('0x0'));var util=require('util');var logger=require(_0xabee('0x1'))(_0xabee('0x2'));var moment=require(_0xabee('0x3'));var BPromise=require('bluebird');var rp=require(_0xabee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var attributes=require(_0xabee('0x7'));module[_0xabee('0x8')]=function(_0x1ea258,_0x58c9ef){return _0x1ea258['define'](_0xabee('0x9'),attributes,{'tableName':_0xabee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a2999,_0x42d01c,_0x507deb){if(_0x4a2999[_0xabee('0xb')](_0xabee('0xc'))){_0x4a2999[_0xabee('0xd')]=moment()[_0xabee('0xe')](_0xabee('0xf'));}_0x507deb(null,_0x4a2999);}}});}; \ No newline at end of file +var _0xe626=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','openchannel_interactions'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xe626,0x9d));var _0x6e62=function(_0x57ffa3,_0x3ec743){_0x57ffa3=_0x57ffa3-0x0;var _0x393b44=_0xe626[_0x57ffa3];return _0x393b44;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var logger=require(_0x6e62('0x2'))(_0x6e62('0x3'));var moment=require('moment');var BPromise=require(_0x6e62('0x4'));var rp=require(_0x6e62('0x5'));var fs=require('fs');var path=require(_0x6e62('0x6'));var rimraf=require(_0x6e62('0x7'));var config=require(_0x6e62('0x8'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x4a778d,_0x2ee927){return _0x4a778d[_0x6e62('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x6e62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dfbaf,_0x16fa52,_0x3317f1){if(_0x1dfbaf['changed'](_0x6e62('0xb'))){_0x1dfbaf[_0x6e62('0xc')]=moment()['format'](_0x6e62('0xd'));}_0x3317f1(null,_0x1dfbaf);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index ae22b42..c283757 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 _0x3923=['options','raw','where','stringify','AddTagsToOpenchannelInteraction','addTags','body','omit','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update'];(function(_0x1b76e6,_0x598520){var _0x333b53=function(_0x106e6a){while(--_0x106e6a){_0x1b76e6['push'](_0x1b76e6['shift']());}};_0x333b53(++_0x598520);}(_0x3923,0xc8));var _0x3392=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3923[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x3392('0x0'));var util=require(_0x3392('0x1'));var moment=require(_0x3392('0x2'));var BPromise=require(_0x3392('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3392('0x4'));var db=require(_0x3392('0x5'))['db'];var utils=require(_0x3392('0x6'));var logger=require('../../config/logger')(_0x3392('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3392('0x8')]({'port':0x232a});config[_0x3392('0x9')]=_[_0x3392('0xa')](config[_0x3392('0x9')],{'host':_0x3392('0xb'),'port':0x18eb});var socket=require(_0x3392('0xc'))(new Redis(config[_0x3392('0x9')]));require('./openchannelInteraction.socket')[_0x3392('0xd')](socket);function respondWithRpcPromise(_0x22cac7,_0x50a1fd,_0xcecd27){return new BPromise(function(_0x41ffd0,_0x1fac99){return client['request'](_0x22cac7,_0xcecd27)[_0x3392('0xe')](function(_0x5aa2bb){logger[_0x3392('0xf')](_0x3392('0x10'),_0x50a1fd,_0x3392('0x11'));logger[_0x3392('0x12')](_0x3392('0x13'),_0x50a1fd,_0x3392('0x11'),JSON['stringify'](_0x5aa2bb));if(_0x5aa2bb['error']){if(_0x5aa2bb[_0x3392('0x14')][_0x3392('0x15')]===0x1f4){logger[_0x3392('0x14')](_0x3392('0x10'),_0x50a1fd,_0x5aa2bb[_0x3392('0x14')][_0x3392('0x16')]);return _0x1fac99(_0x5aa2bb[_0x3392('0x14')][_0x3392('0x16')]);}logger[_0x3392('0x14')](_0x3392('0x10'),_0x50a1fd,_0x5aa2bb[_0x3392('0x14')]['message']);return _0x41ffd0(_0x5aa2bb['error']['message']);}else{logger[_0x3392('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x50a1fd,'request\x20sent');_0x41ffd0(_0x5aa2bb[_0x3392('0x17')]['message']);}})[_0x3392('0x18')](function(_0x379389){logger[_0x3392('0x14')](_0x3392('0x10'),_0x50a1fd,_0x379389);_0x1fac99(_0x379389);});});}exports[_0x3392('0x19')]=function(_0x4bd1ec){var _0x3c56a5=this;return new Promise(function(_0x127578,_0x4e67c3){return db[_0x3392('0x1a')][_0x3392('0x1b')](_0x4bd1ec['body'],{'raw':_0x4bd1ec[_0x3392('0x1c')]?_0x4bd1ec[_0x3392('0x1c')][_0x3392('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bd1ec[_0x3392('0x1c')]?_0x4bd1ec[_0x3392('0x1c')][_0x3392('0x1e')]||null:null,'attributes':_0x4bd1ec['options']?_0x4bd1ec[_0x3392('0x1c')]['attributes']||null:null,'limit':_0x4bd1ec[_0x3392('0x1c')]?_0x4bd1ec[_0x3392('0x1c')]['limit']||null:null})[_0x3392('0xe')](function(_0x4126c3){logger[_0x3392('0xf')]('UpdateOpenchannelInteraction',_0x4bd1ec);logger[_0x3392('0x12')]('UpdateOpenchannelInteraction',_0x4bd1ec,JSON[_0x3392('0x1f')](_0x4126c3));_0x127578(_0x4126c3);})['catch'](function(_0x58ddcc){logger[_0x3392('0x14')](_0x3392('0x19'),_0x58ddcc[_0x3392('0x16')],_0x4bd1ec);_0x4e67c3(_0x3c56a5[_0x3392('0x14')](0x1f4,_0x58ddcc[_0x3392('0x16')]));});});};exports[_0x3392('0x20')]=function(_0x2120f4){return new Promise(function(_0x38b247,_0x1597a2){return db[_0x3392('0x1a')]['find']({'where':_0x2120f4[_0x3392('0x1c')]?_0x2120f4['options'][_0x3392('0x1e')]||null:null})[_0x3392('0xe')](function(_0x3ba042){if(_0x3ba042){return _0x3ba042[_0x3392('0x21')](_0x2120f4[_0x3392('0x22')]['ids'],_[_0x3392('0x23')](_0x2120f4[_0x3392('0x22')],[_0x3392('0x24'),'id'])||{});}})['spread'](function(_0x3e84b3){logger['info']('AddTags',_0x2120f4);logger[_0x3392('0x12')](_0x3392('0x25'),_0x2120f4,JSON[_0x3392('0x1f')](_0x3e84b3));_0x38b247(_0x3e84b3);})['catch'](function(_0x4cd838){logger[_0x3392('0x14')]('AddTags',_0x4cd838[_0x3392('0x16')],_0x2120f4);_0x1597a2(_this['error'](0x1f4,_0x4cd838[_0x3392('0x16')]));});});}; \ No newline at end of file +var _0x3ad2=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./openchannelInteraction.socket','register','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','update','body','options','where','attributes','limit','UpdateOpenchannelInteraction','OpenchannelInteraction','find','then','addTags','omit','ids','AddTags'];(function(_0x1fd37d,_0x32e8d1){var _0x5d49c5=function(_0x587ceb){while(--_0x587ceb){_0x1fd37d['push'](_0x1fd37d['shift']());}};_0x5d49c5(++_0x32e8d1);}(_0x3ad2,0x19a));var _0x23ad=function(_0x528342,_0x17a981){_0x528342=_0x528342-0x0;var _0x27dd91=_0x3ad2[_0x528342];return _0x27dd91;};'use strict';var _=require(_0x23ad('0x0'));var util=require('util');var moment=require(_0x23ad('0x1'));var BPromise=require(_0x23ad('0x2'));var rs=require(_0x23ad('0x3'));var fs=require('fs');var Redis=require(_0x23ad('0x4'));var db=require(_0x23ad('0x5'))['db'];var utils=require(_0x23ad('0x6'));var logger=require(_0x23ad('0x7'))(_0x23ad('0x8'));var config=require(_0x23ad('0x9'));var jayson=require(_0x23ad('0xa'));var client=jayson[_0x23ad('0xb')]['http']({'port':0x232a});config[_0x23ad('0xc')]=_[_0x23ad('0xd')](config[_0x23ad('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23ad('0xc')]));require(_0x23ad('0xe'))[_0x23ad('0xf')](socket);function respondWithRpcPromise(_0x2833dd,_0x4d774c,_0x1ca18c){return new BPromise(function(_0x5417f2,_0xe95002){return client['request'](_0x2833dd,_0x1ca18c)['then'](function(_0x54eed7){logger['info'](_0x23ad('0x10'),_0x4d774c,_0x23ad('0x11'));logger[_0x23ad('0x12')](_0x23ad('0x13'),_0x4d774c,'request\x20sent',JSON[_0x23ad('0x14')](_0x54eed7));if(_0x54eed7['error']){if(_0x54eed7[_0x23ad('0x15')][_0x23ad('0x16')]===0x1f4){logger[_0x23ad('0x15')](_0x23ad('0x10'),_0x4d774c,_0x54eed7[_0x23ad('0x15')][_0x23ad('0x17')]);return _0xe95002(_0x54eed7[_0x23ad('0x15')]['message']);}logger['error'](_0x23ad('0x10'),_0x4d774c,_0x54eed7['error']['message']);return _0x5417f2(_0x54eed7[_0x23ad('0x15')]['message']);}else{logger[_0x23ad('0x18')](_0x23ad('0x10'),_0x4d774c,_0x23ad('0x11'));_0x5417f2(_0x54eed7[_0x23ad('0x19')][_0x23ad('0x17')]);}})[_0x23ad('0x1a')](function(_0x51127){logger['error'](_0x23ad('0x10'),_0x4d774c,_0x51127);_0xe95002(_0x51127);});});}exports['UpdateOpenchannelInteraction']=function(_0x4d54e1){var _0x3270db=this;return new Promise(function(_0x11a2fb,_0x49c1d5){return db['OpenchannelInteraction'][_0x23ad('0x1b')](_0x4d54e1[_0x23ad('0x1c')],{'raw':_0x4d54e1[_0x23ad('0x1d')]?_0x4d54e1[_0x23ad('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d54e1[_0x23ad('0x1d')]?_0x4d54e1[_0x23ad('0x1d')][_0x23ad('0x1e')]||null:null,'attributes':_0x4d54e1[_0x23ad('0x1d')]?_0x4d54e1[_0x23ad('0x1d')][_0x23ad('0x1f')]||null:null,'limit':_0x4d54e1['options']?_0x4d54e1[_0x23ad('0x1d')][_0x23ad('0x20')]||null:null})['then'](function(_0x15008f){logger['info'](_0x23ad('0x21'),_0x4d54e1);logger['debug'](_0x23ad('0x21'),_0x4d54e1,JSON[_0x23ad('0x14')](_0x15008f));_0x11a2fb(_0x15008f);})[_0x23ad('0x1a')](function(_0x329547){logger[_0x23ad('0x15')]('UpdateOpenchannelInteraction',_0x329547['message'],_0x4d54e1);_0x49c1d5(_0x3270db[_0x23ad('0x15')](0x1f4,_0x329547[_0x23ad('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x330283){return new Promise(function(_0x26a5e4,_0x20b11){return db[_0x23ad('0x22')][_0x23ad('0x23')]({'where':_0x330283['options']?_0x330283['options'][_0x23ad('0x1e')]||null:null})[_0x23ad('0x24')](function(_0x79e418){if(_0x79e418){return _0x79e418[_0x23ad('0x25')](_0x330283[_0x23ad('0x1c')]['ids'],_[_0x23ad('0x26')](_0x330283[_0x23ad('0x1c')],[_0x23ad('0x27'),'id'])||{});}})['spread'](function(_0x2682f0){logger[_0x23ad('0x18')](_0x23ad('0x28'),_0x330283);logger['debug'](_0x23ad('0x28'),_0x330283,JSON[_0x23ad('0x14')](_0x2682f0));_0x26a5e4(_0x2682f0);})[_0x23ad('0x1a')](function(_0x41353b){logger[_0x23ad('0x15')](_0x23ad('0x28'),_0x41353b['message'],_0x330283);_0x20b11(_this[_0x23ad('0x15')](0x1f4,_0x41353b[_0x23ad('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 2d5b28d..74bd508 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 _0x91b9=['register','length','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x4ee674,_0x544682){var _0x1a2744=function(_0xa4df27){while(--_0xa4df27){_0x4ee674['push'](_0x4ee674['shift']());}};_0x1a2744(++_0x544682);}(_0x91b9,0x1ea));var _0x991b=function(_0x489c5c,_0x459a76){_0x489c5c=_0x489c5c-0x0;var _0x48d7ca=_0x91b9[_0x489c5c];return _0x48d7ca;};'use strict';var OpenchannelInteractionEvents=require(_0x991b('0x0'));var events=[_0x991b('0x1'),_0x991b('0x2'),_0x991b('0x3')];function createListener(_0x88a0cb,_0x2603a5){return function(_0x4bb2ef){_0x2603a5[_0x991b('0x4')](_0x88a0cb,_0x4bb2ef);};}function removeListener(_0x654bf7,_0x30da44){return function(){OpenchannelInteractionEvents[_0x991b('0x5')](_0x654bf7,_0x30da44);};}exports[_0x991b('0x6')]=function(_0xc207a9){for(var _0x40c50f=0x0,_0x2fe354=events[_0x991b('0x7')];_0x40c50f<_0x2fe354;_0x40c50f++){var _0x4f2864=events[_0x40c50f];var _0x175a9a=createListener('openchannelInteraction:'+_0x4f2864,_0xc207a9);OpenchannelInteractionEvents['on'](_0x4f2864,_0x175a9a);}}; \ No newline at end of file +var _0xbd1f=['openchannelInteraction:','save','remove','update','emit','removeListener','length'];(function(_0x17784a,_0x42fe44){var _0x41aded=function(_0x2e7319){while(--_0x2e7319){_0x17784a['push'](_0x17784a['shift']());}};_0x41aded(++_0x42fe44);}(_0xbd1f,0x127));var _0xfbd1=function(_0x216edc,_0x57df05){_0x216edc=_0x216edc-0x0;var _0x745d3e=_0xbd1f[_0x216edc];return _0x745d3e;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xfbd1('0x0'),_0xfbd1('0x1'),_0xfbd1('0x2')];function createListener(_0x35f66d,_0xe004dc){return function(_0x5b98c5){_0xe004dc[_0xfbd1('0x3')](_0x35f66d,_0x5b98c5);};}function removeListener(_0x52f20d,_0x41511a){return function(){OpenchannelInteractionEvents[_0xfbd1('0x4')](_0x52f20d,_0x41511a);};}exports['register']=function(_0x1181ee){for(var _0x1373b9=0x0,_0x357f03=events[_0xfbd1('0x5')];_0x1373b9<_0x357f03;_0x1373b9++){var _0x42b8d5=events[_0x1373b9];var _0x378f5c=createListener(_0xfbd1('0x6')+_0x42b8d5,_0x1181ee);OpenchannelInteractionEvents['on'](_0x42b8d5,_0x378f5c);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 640a7e1..0a99ce8 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 _0xec52=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','tracked','openchannel','openchannelmessage:create','create','/:id','update','put','accept','delete','destroy','exports','multer'];(function(_0xef8769,_0x4052a5){var _0x2e8686=function(_0x3b168d){while(--_0x3b168d){_0xef8769['push'](_0xef8769['shift']());}};_0x2e8686(++_0x4052a5);}(_0xec52,0x1a8));var _0x2ec5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xec52[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x2ec5('0x0'));var util=require(_0x2ec5('0x1'));var path=require('path');var timeout=require(_0x2ec5('0x2'));var express=require('express');var router=express[_0x2ec5('0x3')]();var auth=require(_0x2ec5('0x4'));var interaction=require(_0x2ec5('0x5'));var config=require(_0x2ec5('0x6'));var controller=require('./openchannelMessage.controller');router[_0x2ec5('0x7')]('/',auth[_0x2ec5('0x8')](),controller[_0x2ec5('0x9')]);router[_0x2ec5('0x7')](_0x2ec5('0xa'),auth[_0x2ec5('0x8')](),controller[_0x2ec5('0xb')]);router[_0x2ec5('0x7')]('/:id',auth[_0x2ec5('0x8')](),controller[_0x2ec5('0xc')]);router[_0x2ec5('0xd')]('/',auth[_0x2ec5('0x8')](),interaction[_0x2ec5('0xe')](_0x2ec5('0xf'),_0x2ec5('0x10')),controller[_0x2ec5('0x11')]);router['put'](_0x2ec5('0x12'),auth['isAuthenticated'](),controller[_0x2ec5('0x13')]);router[_0x2ec5('0x14')]('/:id/accept',auth[_0x2ec5('0x8')](),controller[_0x2ec5('0x15')]);router['put']('/:id/reject',auth[_0x2ec5('0x8')](),controller['reject']);router[_0x2ec5('0x16')](_0x2ec5('0x12'),auth['isAuthenticated'](),controller[_0x2ec5('0x17')]);module[_0x2ec5('0x18')]=router; \ No newline at end of file +var _0xbf53=['../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','tracked','openchannel','openchannelmessage:create','create','put','update','accept','reject','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x696aca,_0xe07394){var _0x148048=function(_0x25b364){while(--_0x25b364){_0x696aca['push'](_0x696aca['shift']());}};_0x148048(++_0xe07394);}(_0xbf53,0x157));var _0x3bf5=function(_0x4954ee,_0x4a228e){_0x4954ee=_0x4954ee-0x0;var _0x2d605c=_0xbf53[_0x4954ee];return _0x2d605c;};'use strict';var multer=require(_0x3bf5('0x0'));var util=require(_0x3bf5('0x1'));var path=require(_0x3bf5('0x2'));var timeout=require(_0x3bf5('0x3'));var express=require(_0x3bf5('0x4'));var router=express[_0x3bf5('0x5')]();var auth=require(_0x3bf5('0x6'));var interaction=require(_0x3bf5('0x7'));var config=require(_0x3bf5('0x8'));var controller=require(_0x3bf5('0x9'));router[_0x3bf5('0xa')]('/',auth[_0x3bf5('0xb')](),controller[_0x3bf5('0xc')]);router['get'](_0x3bf5('0xd'),auth['isAuthenticated'](),controller[_0x3bf5('0xe')]);router[_0x3bf5('0xa')](_0x3bf5('0xf'),auth[_0x3bf5('0xb')](),controller['show']);router['post']('/',auth[_0x3bf5('0xb')](),interaction[_0x3bf5('0x10')](_0x3bf5('0x11'),_0x3bf5('0x12')),controller[_0x3bf5('0x13')]);router[_0x3bf5('0x14')](_0x3bf5('0xf'),auth['isAuthenticated'](),controller[_0x3bf5('0x15')]);router['put']('/:id/accept',auth[_0x3bf5('0xb')](),controller[_0x3bf5('0x16')]);router[_0x3bf5('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x3bf5('0x17')]);router[_0x3bf5('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 06b2d26..3f5bad5 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 _0x1da9=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x33a15c,_0x5b8407){var _0x1d0611=function(_0x2715c6){while(--_0x2715c6){_0x33a15c['push'](_0x33a15c['shift']());}};_0x1d0611(++_0x5b8407);}(_0x1da9,0x1af));var _0x91da=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1da9[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x91da('0x0'));module[_0x91da('0x1')]={'body':{'type':Sequelize[_0x91da('0x2')](_0x91da('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x91da('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x91da('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x91da('0x5')]('in',_0x91da('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x91da('0x7')]}}; \ No newline at end of file +var _0x457a=['DATE','medium','BOOLEAN','ENUM','out'];(function(_0x4297a4,_0x2dcdc2){var _0x331b83=function(_0x3a297f){while(--_0x3a297f){_0x4297a4['push'](_0x4297a4['shift']());}};_0x331b83(++_0x2dcdc2);}(_0x457a,0x97));var _0xa457=function(_0x5cd736,_0x192a2a){_0x5cd736=_0x5cd736-0x0;var _0x37b946=_0x457a[_0x5cd736];return _0x37b946;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xa457('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0xa457('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa457('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa457('0x2')]('in',_0xa457('0x3')),'defaultValue':_0xa457('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa457('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f0f1176..1ca446e 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 _0x5eee=['save','update','destroy','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','defaults','socket.io-emitter','redis','./openchannelMessage.socket','register','http','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x34e485,_0x45a486){var _0x56e7bf=function(_0x1e470e){while(--_0x1e470e){_0x34e485['push'](_0x34e485['shift']());}};_0x56e7bf(++_0x45a486);}(_0x5eee,0xb9));var _0xe5ee=function(_0x44b514,_0x505243){_0x44b514=_0x44b514-0x0;var _0x16ab9b=_0x5eee[_0x44b514];return _0x16ab9b;};'use strict';var pdf=require(_0xe5ee('0x0'));var emlformat=require(_0xe5ee('0x1'));var rimraf=require(_0xe5ee('0x2'));var zipdir=require(_0xe5ee('0x3'));var jsonpatch=require(_0xe5ee('0x4'));var rp=require(_0xe5ee('0x5'));var moment=require(_0xe5ee('0x6'));var BPromise=require(_0xe5ee('0x7'));var Mustache=require(_0xe5ee('0x8'));var util=require(_0xe5ee('0x9'));var path=require('path');var sox=require(_0xe5ee('0xa'));var csv=require(_0xe5ee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe5ee('0xc'));var crypto=require(_0xe5ee('0xd'));var jsforce=require(_0xe5ee('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe5ee('0xf'));var Papa=require(_0xe5ee('0x10'));var Redis=require('ioredis');var authService=require(_0xe5ee('0x11'));var qs=require(_0xe5ee('0x12'));var as=require(_0xe5ee('0x13'));var hardwareService=require(_0xe5ee('0x14'));var logger=require('../../config/logger')(_0xe5ee('0x15'));var utils=require(_0xe5ee('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe5ee('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe5ee('0x18'))(new Redis(config[_0xe5ee('0x19')]));require(_0xe5ee('0x1a'))[_0xe5ee('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xe5ee('0x1c')]({'port':0x232c});var client9002=jayson[_0xe5ee('0x1d')][_0xe5ee('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x32d1ff,_0x11e067,_0x3059f7){if(_0x3059f7){var _0x4c18e2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c18e2[_0xe5ee('0x1e')](_0x11e067)){return _0x32d1ff;}else{throw new db[(_0xe5ee('0x1f'))]['ValidationError'](_0xe5ee('0x20'));}}else{return _0x32d1ff;}}function respondWithRpcPromise(_0x3b51e2,_0x1cba2c,_0x478c1d,_0x5bbf66){return new BPromise(function(_0x4adf95,_0x36a3a2){var _0x5dcd60=_0x5bbf66||client;return _0x5dcd60[_0xe5ee('0x21')](_0x3b51e2,_0x478c1d)[_0xe5ee('0x22')](function(_0x4286cb){logger['info'](_0xe5ee('0x23'),_0x1cba2c,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1cba2c,_0xe5ee('0x24'),JSON[_0xe5ee('0x25')](_0x4286cb));if(_0x4286cb[_0xe5ee('0x26')]){if(_0x4286cb['error'][_0xe5ee('0x27')]===0x1f4){logger['error'](_0xe5ee('0x23'),_0x1cba2c,_0x4286cb[_0xe5ee('0x26')][_0xe5ee('0x28')]);return _0x36a3a2(_0x4286cb[_0xe5ee('0x26')][_0xe5ee('0x28')]);}logger[_0xe5ee('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x1cba2c,_0x4286cb[_0xe5ee('0x26')][_0xe5ee('0x28')]);return _0x4adf95(_0x4286cb[_0xe5ee('0x26')]['message']);}else{logger[_0xe5ee('0x29')](_0xe5ee('0x23'),_0x1cba2c,_0xe5ee('0x24'));_0x4adf95(_0x4286cb[_0xe5ee('0x2a')][_0xe5ee('0x28')]);}})[_0xe5ee('0x2b')](function(_0x5e0479){logger[_0xe5ee('0x26')](_0xe5ee('0x23'),_0x1cba2c,_0x5e0479);_0x36a3a2(_0x5e0479);});});}function respondWithStatusCode(_0x25c988,_0x2b7d07){_0x2b7d07=_0x2b7d07||0xcc;return function(_0x1d29ba){if(_0x1d29ba){return _0x25c988[_0xe5ee('0x2c')](_0x2b7d07);}return _0x25c988[_0xe5ee('0x2d')](_0x2b7d07)[_0xe5ee('0x2e')]();};}function respondWithResult(_0x198a4e,_0x206ab7){_0x206ab7=_0x206ab7||0xc8;return function(_0x3680f6){if(_0x3680f6){return _0x198a4e['status'](_0x206ab7)[_0xe5ee('0x2f')](_0x3680f6);}};}function respondWithFilteredResult(_0x17aeae,_0x5af71c){return function(_0x273815){if(_0x273815){var _0x163eff=_0x273815[_0xe5ee('0x30')],_0x39c147=_0x5af71c['offset'],_0x4d3329=_0x5af71c[_0xe5ee('0x31')]+_0x5af71c[_0xe5ee('0x32')],_0x534933;if(_0x4d3329>=_0x163eff){_0x4d3329=_0x163eff;_0x534933=0xc8;}else{_0x534933=0xce;}_0x17aeae[_0xe5ee('0x2d')](_0x534933);return _0x17aeae[_0xe5ee('0x33')](_0xe5ee('0x34'),_0x39c147+'-'+_0x4d3329+'/'+_0x163eff)['json'](_0x273815);}return null;};}function patchUpdates(_0x94fd3a){return function(_0x1aafff){try{jsonpatch[_0xe5ee('0x35')](_0x1aafff,_0x94fd3a,!![]);}catch(_0xbe0573){return BPromise[_0xe5ee('0x36')](_0xbe0573);}return _0x1aafff[_0xe5ee('0x37')]();};}function saveUpdates(_0xb53f91,_0xa87110){return function(_0x56072d){if(_0x56072d){return _0x56072d[_0xe5ee('0x38')](_0xb53f91)[_0xe5ee('0x22')](function(_0x31b2b5){return _0x31b2b5;});}return null;};}function removeEntity(_0x2ed1fa,_0x2d062d){return function(_0x1fd0a8){if(_0x1fd0a8){return _0x1fd0a8[_0xe5ee('0x39')]()[_0xe5ee('0x22')](function(){_0x2ed1fa[_0xe5ee('0x2d')](0xcc)[_0xe5ee('0x2e')]();});}};}function handleEntityNotFound(_0x4281e3,_0x1b6c26){return function(_0x1129b4){if(!_0x1129b4){_0x4281e3[_0xe5ee('0x2c')](0x194);}return _0x1129b4;};}function handleError(_0x4d4f24,_0x2cfc19){_0x2cfc19=_0x2cfc19||0x1f4;return function(_0x1b19f7){logger[_0xe5ee('0x26')](_0x1b19f7[_0xe5ee('0x3a')]);if(_0x1b19f7[_0xe5ee('0x3b')]){delete _0x1b19f7[_0xe5ee('0x3b')];}_0x4d4f24[_0xe5ee('0x2d')](_0x2cfc19)['send'](_0x1b19f7);};}exports[_0xe5ee('0x3c')]=function(_0x2d7c36,_0x506daf){var _0x13fa57={},_0x2a4feb={},_0x56722a={'count':0x0,'rows':[]};var _0x345b2b=_[_0xe5ee('0x3d')](db[_0xe5ee('0x3e')][_0xe5ee('0x3f')],function(_0x24f140){return{'name':_0x24f140[_0xe5ee('0x40')],'type':_0x24f140[_0xe5ee('0x41')]['key']};});_0x2a4feb['model']=_[_0xe5ee('0x3d')](_0x345b2b,_0xe5ee('0x3b'));_0x2a4feb['query']=_[_0xe5ee('0x42')](_0x2d7c36[_0xe5ee('0x43')]);_0x2a4feb[_0xe5ee('0x44')]=_[_0xe5ee('0x45')](_0x2a4feb[_0xe5ee('0x46')],_0x2a4feb['query']);_0x13fa57[_0xe5ee('0x47')]=_[_0xe5ee('0x45')](_0x2a4feb[_0xe5ee('0x46')],qs[_0xe5ee('0x48')](_0x2d7c36[_0xe5ee('0x43')][_0xe5ee('0x48')]));_0x13fa57['attributes']=_0x13fa57['attributes'][_0xe5ee('0x49')]?_0x13fa57[_0xe5ee('0x47')]:_0x2a4feb[_0xe5ee('0x46')];if(!_0x2d7c36[_0xe5ee('0x43')][_0xe5ee('0x4a')]('nolimit')){_0x13fa57[_0xe5ee('0x32')]=qs[_0xe5ee('0x32')](_0x2d7c36['query']['limit']);_0x13fa57[_0xe5ee('0x31')]=qs[_0xe5ee('0x31')](_0x2d7c36['query'][_0xe5ee('0x31')]);}_0x13fa57[_0xe5ee('0x4b')]=qs[_0xe5ee('0x4c')](_0x2d7c36[_0xe5ee('0x43')][_0xe5ee('0x4c')]);_0x13fa57[_0xe5ee('0x4d')]=qs[_0xe5ee('0x44')](_[_0xe5ee('0x4e')](_0x2d7c36['query'],_0x2a4feb[_0xe5ee('0x44')]),_0x345b2b);if(_0x2d7c36['query'][_0xe5ee('0x4f')]){_0x13fa57[_0xe5ee('0x4d')]=_['merge'](_0x13fa57[_0xe5ee('0x4d')],{'$or':_[_0xe5ee('0x3d')](_0x345b2b,function(_0x45eaff){if(_0x45eaff[_0xe5ee('0x41')]!==_0xe5ee('0x50')){var _0x30b32c={};_0x30b32c[_0x45eaff['name']]={'$like':'%'+_0x2d7c36[_0xe5ee('0x43')]['filter']+'%'};return _0x30b32c;}})});}_0x13fa57=_[_0xe5ee('0x51')]({},_0x13fa57,_0x2d7c36['options']);var _0x1c7d02={'where':_0x13fa57['where']};return db[_0xe5ee('0x3e')][_0xe5ee('0x30')](_0x1c7d02)[_0xe5ee('0x22')](function(_0x24aac2){_0x56722a[_0xe5ee('0x30')]=_0x24aac2;if(_0x2d7c36[_0xe5ee('0x43')][_0xe5ee('0x52')]){_0x13fa57[_0xe5ee('0x53')]=[{'all':!![]}];}return db[_0xe5ee('0x3e')][_0xe5ee('0x54')](_0x13fa57);})['then'](function(_0x3f3af8){_0x56722a[_0xe5ee('0x55')]=_0x3f3af8;return _0x56722a;})[_0xe5ee('0x22')](respondWithFilteredResult(_0x506daf,_0x13fa57))[_0xe5ee('0x2b')](handleError(_0x506daf,null));};exports['show']=function(_0xf5693b,_0x4e4f0c){var _0x38810f={'raw':!![],'where':{'id':_0xf5693b[_0xe5ee('0x56')]['id']}},_0x339874={};_0x339874[_0xe5ee('0x46')]=_[_0xe5ee('0x42')](db[_0xe5ee('0x3e')][_0xe5ee('0x3f')]);_0x339874[_0xe5ee('0x43')]=_[_0xe5ee('0x42')](_0xf5693b[_0xe5ee('0x43')]);_0x339874['filters']=_[_0xe5ee('0x45')](_0x339874['model'],_0x339874[_0xe5ee('0x43')]);_0x38810f[_0xe5ee('0x47')]=_[_0xe5ee('0x45')](_0x339874['model'],qs['fields'](_0xf5693b[_0xe5ee('0x43')][_0xe5ee('0x48')]));_0x38810f[_0xe5ee('0x47')]=_0x38810f[_0xe5ee('0x47')][_0xe5ee('0x49')]?_0x38810f[_0xe5ee('0x47')]:_0x339874['model'];if(_0xf5693b[_0xe5ee('0x43')][_0xe5ee('0x52')]){_0x38810f[_0xe5ee('0x53')]=[{'all':!![]}];}_0x38810f=_[_0xe5ee('0x51')]({},_0x38810f,_0xf5693b['options']);return db[_0xe5ee('0x3e')][_0xe5ee('0x57')](_0x38810f)[_0xe5ee('0x22')](handleEntityNotFound(_0x4e4f0c,null))['then'](respondWithResult(_0x4e4f0c,null))[_0xe5ee('0x2b')](handleError(_0x4e4f0c,null));};exports[_0xe5ee('0x58')]=function(_0x18b3c1,_0x5c2d36){return db[_0xe5ee('0x3e')][_0xe5ee('0x58')](_0x18b3c1[_0xe5ee('0x59')],{})[_0xe5ee('0x22')](respondWithResult(_0x5c2d36,0xc9))['catch'](handleError(_0x5c2d36,null));};exports[_0xe5ee('0x38')]=function(_0x36ea12,_0x3bba15){if(_0x36ea12[_0xe5ee('0x59')]['id']){delete _0x36ea12['body']['id'];}return db[_0xe5ee('0x3e')][_0xe5ee('0x57')]({'where':{'id':_0x36ea12[_0xe5ee('0x56')]['id']}})[_0xe5ee('0x22')](handleEntityNotFound(_0x3bba15,null))['then'](saveUpdates(_0x36ea12[_0xe5ee('0x59')],null))[_0xe5ee('0x22')](respondWithResult(_0x3bba15,null))['catch'](handleError(_0x3bba15,null));};exports[_0xe5ee('0x39')]=function(_0x51fb26,_0x1c7f02){return db[_0xe5ee('0x3e')][_0xe5ee('0x57')]({'where':{'id':_0x51fb26['params']['id']}})['then'](handleEntityNotFound(_0x1c7f02,null))[_0xe5ee('0x22')](removeEntity(_0x1c7f02,null))['catch'](handleError(_0x1c7f02,null));};exports[_0xe5ee('0x5a')]=function(_0x23515d,_0x4709d7){return db[_0xe5ee('0x3e')]['describe']()[_0xe5ee('0x22')](respondWithResult(_0x4709d7,null))[_0xe5ee('0x2b')](handleError(_0x4709d7,null));};var interaction_log=require(_0xe5ee('0x5b'))(_0xe5ee('0x5c'));exports[_0xe5ee('0x5d')]=function(_0x4fc454,_0x231df4,_0x24d471){var _0x2ad05b={'channel':_0xe5ee('0x5e')};if(_0x4fc454[_0xe5ee('0x59')]['id']){delete _0x4fc454[_0xe5ee('0x59')]['id'];}_0x4fc454['body'][_0xe5ee('0x5f')]=!![];_0x4fc454[_0xe5ee('0x59')]['readAt']=moment()[_0xe5ee('0x60')](_0xe5ee('0x61'));_0x4fc454[_0xe5ee('0x59')][_0xe5ee('0x62')]=_0x4fc454[_0xe5ee('0x59')]['UserId']||_0x4fc454[_0xe5ee('0x63')]['id'];return db[_0xe5ee('0x3e')][_0xe5ee('0x57')]({'where':{'id':_0x4fc454[_0xe5ee('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xe5ee('0x64')],'as':_0xe5ee('0x65')}]})[_0xe5ee('0x22')](handleEntityNotFound(_0x231df4,null))[_0xe5ee('0x22')](saveUpdates(_0x4fc454[_0xe5ee('0x59')],null))['then'](function(_0x269a17){if(_0x269a17){_0x2ad05b[_0xe5ee('0x28')]=_0x269a17['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xe5ee('0x57')]({'where':{'id':_0x269a17[_0xe5ee('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x231df4,null))['then'](function(_0x4672ee){if(_0x4672ee){return _0x4672ee[_0xe5ee('0x38')]({'UserId':_0x4fc454[_0xe5ee('0x59')]['UserId'],'read1stAt':_['isNil'](_0x4672ee['read1stAt'])?moment()[_0xe5ee('0x60')](_0xe5ee('0x61')):undefined});}return null;})[_0xe5ee('0x22')](function(_0xa515c8){if(_0xa515c8){_0x2ad05b[_0xe5ee('0x67')]=_0xa515c8[_0xe5ee('0x68')]({'plain':!![]});interaction_log[_0xe5ee('0x29')](_0xe5ee('0x69'),_0x4fc454['user']['id'],_0x4fc454[_0xe5ee('0x63')][_0xe5ee('0x3b')],_0x4fc454[_0xe5ee('0x63')][_0xe5ee('0x6a')],_0x2ad05b['interaction']['id'],_0x4fc454[_0xe5ee('0x59')]?JSON[_0xe5ee('0x25')](_0x4fc454[_0xe5ee('0x59')]):_0xe5ee('0x6b'));return respondWithRpcPromise(_0xe5ee('0x6c'),_0xe5ee('0x6d'),_0x2ad05b);}return null;})['then'](function(_0xe5bed9){if(_0xe5bed9){if(_0x4fc454['body']['manual']){_0x2ad05b[_0xe5ee('0x28')]['interface']=util[_0xe5ee('0x60')](_0xe5ee('0x6e'),_0x4fc454[_0xe5ee('0x63')][_0xe5ee('0x3b')]);_0x2ad05b[_0xe5ee('0x28')][_0xe5ee('0x6f')]=_0x2ad05b['channel'];_0x2ad05b[_0xe5ee('0x28')][_0xe5ee('0x70')]=_0xe5ee('0x5d');return respondWithRpcPromise('EventManager',_0xe5ee('0x71'),{'event':_0xe5ee('0x72'),'message':_0x2ad05b[_0xe5ee('0x28')]},client9002)[_0xe5ee('0x22')](function(){return _0x2ad05b;});}return _0x2ad05b;}return null;})[_0xe5ee('0x22')](respondWithResult(_0x231df4,null))['catch'](handleError(_0x231df4,null));};var interaction_log=require(_0xe5ee('0x5b'))('openchannel-interactions');exports[_0xe5ee('0x36')]=function(_0x5458db,_0x208e60,_0x182e17){var _0x1c6a97={'agent':{},'channel':_0xe5ee('0x5e')};if(_0x5458db['body']['id']){delete _0x5458db[_0xe5ee('0x59')]['id'];}_0x5458db[_0xe5ee('0x59')][_0xe5ee('0x62')]=_0x5458db[_0xe5ee('0x59')][_0xe5ee('0x62')]||_0x5458db[_0xe5ee('0x63')]['id'];_0x1c6a97[_0xe5ee('0x73')]['id']=_0x5458db[_0xe5ee('0x59')]['UserId'];return db[_0xe5ee('0x3e')]['find']({'where':{'id':_0x5458db[_0xe5ee('0x56')]['id'],'UserId':null}})[_0xe5ee('0x22')](handleEntityNotFound(_0x208e60,null))[_0xe5ee('0x22')](function(_0xe73b67){if(_0xe73b67){_0x1c6a97[_0xe5ee('0x28')]=_0xe73b67['get']({'plain':!![]});return db[_0xe5ee('0x74')][_0xe5ee('0x57')]({'where':{'id':_0xe73b67[_0xe5ee('0x66')]}});}return null;})[_0xe5ee('0x22')](handleEntityNotFound(_0x208e60,null))[_0xe5ee('0x22')](function(_0xa54cb7){if(_0xa54cb7){_0x1c6a97[_0xe5ee('0x67')]=_0xa54cb7[_0xe5ee('0x68')]({'plain':!![]});interaction_log[_0xe5ee('0x29')](_0xe5ee('0x75'),_0x5458db[_0xe5ee('0x63')]['id'],_0x5458db['user'][_0xe5ee('0x3b')],_0x5458db['user'][_0xe5ee('0x6a')],_0x1c6a97[_0xe5ee('0x67')]['id'],_0x5458db['body']?JSON['stringify'](_0x5458db[_0xe5ee('0x59')]):_0xe5ee('0x6b'));return respondWithRpcPromise(_0xe5ee('0x76'),'rejectMessage',_0x1c6a97);}return null;})[_0xe5ee('0x22')](function(_0xed1b6e){if(_0xed1b6e){_0xed1b6e[_0xe5ee('0x28')]['interface']=util[_0xe5ee('0x60')]('SIP/%s',_0x5458db[_0xe5ee('0x63')][_0xe5ee('0x3b')]);_0xed1b6e['message'][_0xe5ee('0x6f')]=_0x1c6a97[_0xe5ee('0x6f')];_0xed1b6e[_0xe5ee('0x28')][_0xe5ee('0x70')]=_0xe5ee('0x36');respondWithRpcPromise('EventManager','EventManager',{'event':_0xe5ee('0x77'),'message':_0xed1b6e['message']},client9002);return _0x1c6a97;}return null;})[_0xe5ee('0x22')](respondWithResult(_0x208e60,null))['catch'](handleError(_0x208e60,null));}; \ No newline at end of file +var _0xa1fa=['Content-Range','json','apply','update','destroy','name','send','map','OpenchannelMessage','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','../../config/logger','accept','openchannel','read','format','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','UserId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','openchannel-interactions','agent','RejectMessage','rejectMessage','reject','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','count','offset','limit','set'];(function(_0x14d831,_0x38b288){var _0x377b85=function(_0x5d3da7){while(--_0x5d3da7){_0x14d831['push'](_0x14d831['shift']());}};_0x377b85(++_0x38b288);}(_0xa1fa,0x134));var _0xaa1f=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xa1fa[_0x5e42a7];return _0x36d21b;};'use strict';var pdf=require(_0xaa1f('0x0'));var emlformat=require(_0xaa1f('0x1'));var rimraf=require(_0xaa1f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa1f('0x3'));var rp=require('request-promise');var moment=require(_0xaa1f('0x4'));var BPromise=require(_0xaa1f('0x5'));var Mustache=require(_0xaa1f('0x6'));var util=require(_0xaa1f('0x7'));var path=require(_0xaa1f('0x8'));var sox=require(_0xaa1f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa1f('0xa'));var squel=require(_0xaa1f('0xb'));var crypto=require(_0xaa1f('0xc'));var jsforce=require(_0xaa1f('0xd'));var deskjs=require(_0xaa1f('0xe'));var toCsv=require(_0xaa1f('0xf'));var querystring=require('querystring');var Papa=require(_0xaa1f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaa1f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xaa1f('0x12'));var config=require(_0xaa1f('0x13'));var db=require('../../mysqldb')['db'];config[_0xaa1f('0x14')]=_[_0xaa1f('0x15')](config[_0xaa1f('0x14')],{'host':_0xaa1f('0x16'),'port':0x18eb});var socket=require(_0xaa1f('0x17'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xaa1f('0x18')](socket);var jayson=require(_0xaa1f('0x19'));var client=jayson['client'][_0xaa1f('0x1a')]({'port':0x232c});var client9002=jayson[_0xaa1f('0x1b')][_0xaa1f('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2ccbb0,_0x3065ad,_0x3e129f){if(_0x3e129f){var _0x568e5d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x568e5d['test'](_0x3065ad)){return _0x2ccbb0;}else{throw new db[(_0xaa1f('0x1c'))]['ValidationError'](_0xaa1f('0x1d'));}}else{return _0x2ccbb0;}}function respondWithRpcPromise(_0x4221d7,_0x334d3a,_0x5bb51a,_0x3a13ae){return new BPromise(function(_0x32ed38,_0x4ff202){var _0x1e8573=_0x3a13ae||client;return _0x1e8573[_0xaa1f('0x1e')](_0x4221d7,_0x5bb51a)[_0xaa1f('0x1f')](function(_0x4b00b5){logger[_0xaa1f('0x20')](_0xaa1f('0x21'),_0x334d3a,_0xaa1f('0x22'));logger[_0xaa1f('0x23')](_0xaa1f('0x24'),_0x334d3a,_0xaa1f('0x22'),JSON[_0xaa1f('0x25')](_0x4b00b5));if(_0x4b00b5['error']){if(_0x4b00b5[_0xaa1f('0x26')][_0xaa1f('0x27')]===0x1f4){logger[_0xaa1f('0x26')](_0xaa1f('0x21'),_0x334d3a,_0x4b00b5[_0xaa1f('0x26')]['message']);return _0x4ff202(_0x4b00b5[_0xaa1f('0x26')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x334d3a,_0x4b00b5[_0xaa1f('0x26')][_0xaa1f('0x28')]);return _0x32ed38(_0x4b00b5[_0xaa1f('0x26')]['message']);}else{logger[_0xaa1f('0x20')](_0xaa1f('0x21'),_0x334d3a,_0xaa1f('0x22'));_0x32ed38(_0x4b00b5[_0xaa1f('0x29')]['message']);}})['catch'](function(_0x20b3f3){logger[_0xaa1f('0x26')](_0xaa1f('0x21'),_0x334d3a,_0x20b3f3);_0x4ff202(_0x20b3f3);});});}function respondWithStatusCode(_0x1e24f5,_0x1905c7){_0x1905c7=_0x1905c7||0xcc;return function(_0x4e2843){if(_0x4e2843){return _0x1e24f5[_0xaa1f('0x2a')](_0x1905c7);}return _0x1e24f5['status'](_0x1905c7)[_0xaa1f('0x2b')]();};}function respondWithResult(_0x2b8be9,_0x1247aa){_0x1247aa=_0x1247aa||0xc8;return function(_0x25f97b){if(_0x25f97b){return _0x2b8be9[_0xaa1f('0x2c')](_0x1247aa)['json'](_0x25f97b);}};}function respondWithFilteredResult(_0xc36700,_0x2b514b){return function(_0x1da594){if(_0x1da594){var _0x54ba42=_0x1da594[_0xaa1f('0x2d')],_0x26a09a=_0x2b514b['offset'],_0x764e56=_0x2b514b[_0xaa1f('0x2e')]+_0x2b514b[_0xaa1f('0x2f')],_0x29a707;if(_0x764e56>=_0x54ba42){_0x764e56=_0x54ba42;_0x29a707=0xc8;}else{_0x29a707=0xce;}_0xc36700[_0xaa1f('0x2c')](_0x29a707);return _0xc36700[_0xaa1f('0x30')](_0xaa1f('0x31'),_0x26a09a+'-'+_0x764e56+'/'+_0x54ba42)[_0xaa1f('0x32')](_0x1da594);}return null;};}function patchUpdates(_0x1a5bec){return function(_0x26960b){try{jsonpatch[_0xaa1f('0x33')](_0x26960b,_0x1a5bec,!![]);}catch(_0x4ae9e7){return BPromise['reject'](_0x4ae9e7);}return _0x26960b['save']();};}function saveUpdates(_0x1d641c,_0x6d897f){return function(_0x4d1c2e){if(_0x4d1c2e){return _0x4d1c2e[_0xaa1f('0x34')](_0x1d641c)['then'](function(_0x165566){return _0x165566;});}return null;};}function removeEntity(_0x259797,_0x27412c){return function(_0x12c1bf){if(_0x12c1bf){return _0x12c1bf[_0xaa1f('0x35')]()[_0xaa1f('0x1f')](function(){_0x259797[_0xaa1f('0x2c')](0xcc)[_0xaa1f('0x2b')]();});}};}function handleEntityNotFound(_0x20f84a,_0x4d6c35){return function(_0x54afa3){if(!_0x54afa3){_0x20f84a[_0xaa1f('0x2a')](0x194);}return _0x54afa3;};}function handleError(_0x2da149,_0x3edf22){_0x3edf22=_0x3edf22||0x1f4;return function(_0x2c5fe9){logger[_0xaa1f('0x26')](_0x2c5fe9['stack']);if(_0x2c5fe9[_0xaa1f('0x36')]){delete _0x2c5fe9[_0xaa1f('0x36')];}_0x2da149[_0xaa1f('0x2c')](_0x3edf22)[_0xaa1f('0x37')](_0x2c5fe9);};}exports['index']=function(_0x373b6b,_0x2c8ac5){var _0x321864={},_0x1265c1={},_0x3c6390={'count':0x0,'rows':[]};var _0x216ae6=_[_0xaa1f('0x38')](db[_0xaa1f('0x39')]['rawAttributes'],function(_0x4c00c0){return{'name':_0x4c00c0[_0xaa1f('0x3a')],'type':_0x4c00c0[_0xaa1f('0x3b')]['key']};});_0x1265c1[_0xaa1f('0x3c')]=_[_0xaa1f('0x38')](_0x216ae6,'name');_0x1265c1[_0xaa1f('0x3d')]=_[_0xaa1f('0x3e')](_0x373b6b['query']);_0x1265c1['filters']=_[_0xaa1f('0x3f')](_0x1265c1['model'],_0x1265c1[_0xaa1f('0x3d')]);_0x321864[_0xaa1f('0x40')]=_[_0xaa1f('0x3f')](_0x1265c1['model'],qs[_0xaa1f('0x41')](_0x373b6b[_0xaa1f('0x3d')][_0xaa1f('0x41')]));_0x321864[_0xaa1f('0x40')]=_0x321864[_0xaa1f('0x40')][_0xaa1f('0x42')]?_0x321864[_0xaa1f('0x40')]:_0x1265c1[_0xaa1f('0x3c')];if(!_0x373b6b[_0xaa1f('0x3d')][_0xaa1f('0x43')](_0xaa1f('0x44'))){_0x321864[_0xaa1f('0x2f')]=qs[_0xaa1f('0x2f')](_0x373b6b[_0xaa1f('0x3d')][_0xaa1f('0x2f')]);_0x321864[_0xaa1f('0x2e')]=qs[_0xaa1f('0x2e')](_0x373b6b[_0xaa1f('0x3d')]['offset']);}_0x321864[_0xaa1f('0x45')]=qs[_0xaa1f('0x46')](_0x373b6b['query']['sort']);_0x321864[_0xaa1f('0x47')]=qs[_0xaa1f('0x48')](_[_0xaa1f('0x49')](_0x373b6b[_0xaa1f('0x3d')],_0x1265c1['filters']),_0x216ae6);if(_0x373b6b[_0xaa1f('0x3d')][_0xaa1f('0x4a')]){_0x321864[_0xaa1f('0x47')]=_[_0xaa1f('0x4b')](_0x321864[_0xaa1f('0x47')],{'$or':_[_0xaa1f('0x38')](_0x216ae6,function(_0x44bc3f){if(_0x44bc3f[_0xaa1f('0x3b')]!==_0xaa1f('0x4c')){var _0x2be044={};_0x2be044[_0x44bc3f[_0xaa1f('0x36')]]={'$like':'%'+_0x373b6b['query'][_0xaa1f('0x4a')]+'%'};return _0x2be044;}})});}_0x321864=_[_0xaa1f('0x4b')]({},_0x321864,_0x373b6b[_0xaa1f('0x4d')]);var _0x18c8c4={'where':_0x321864[_0xaa1f('0x47')]};return db[_0xaa1f('0x39')][_0xaa1f('0x2d')](_0x18c8c4)[_0xaa1f('0x1f')](function(_0x1328ba){_0x3c6390['count']=_0x1328ba;if(_0x373b6b[_0xaa1f('0x3d')][_0xaa1f('0x4e')]){_0x321864[_0xaa1f('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x321864);})[_0xaa1f('0x1f')](function(_0xacb5a9){_0x3c6390[_0xaa1f('0x50')]=_0xacb5a9;return _0x3c6390;})[_0xaa1f('0x1f')](respondWithFilteredResult(_0x2c8ac5,_0x321864))[_0xaa1f('0x51')](handleError(_0x2c8ac5,null));};exports[_0xaa1f('0x52')]=function(_0x3eac61,_0x2c7a76){var _0x12f68e={'raw':!![],'where':{'id':_0x3eac61[_0xaa1f('0x53')]['id']}},_0x43a7fd={};_0x43a7fd[_0xaa1f('0x3c')]=_[_0xaa1f('0x3e')](db[_0xaa1f('0x39')][_0xaa1f('0x54')]);_0x43a7fd[_0xaa1f('0x3d')]=_[_0xaa1f('0x3e')](_0x3eac61['query']);_0x43a7fd[_0xaa1f('0x48')]=_[_0xaa1f('0x3f')](_0x43a7fd[_0xaa1f('0x3c')],_0x43a7fd['query']);_0x12f68e[_0xaa1f('0x40')]=_[_0xaa1f('0x3f')](_0x43a7fd[_0xaa1f('0x3c')],qs[_0xaa1f('0x41')](_0x3eac61[_0xaa1f('0x3d')][_0xaa1f('0x41')]));_0x12f68e[_0xaa1f('0x40')]=_0x12f68e['attributes'][_0xaa1f('0x42')]?_0x12f68e['attributes']:_0x43a7fd['model'];if(_0x3eac61[_0xaa1f('0x3d')]['includeAll']){_0x12f68e[_0xaa1f('0x4f')]=[{'all':!![]}];}_0x12f68e=_[_0xaa1f('0x4b')]({},_0x12f68e,_0x3eac61[_0xaa1f('0x4d')]);return db[_0xaa1f('0x39')][_0xaa1f('0x55')](_0x12f68e)[_0xaa1f('0x1f')](handleEntityNotFound(_0x2c7a76,null))[_0xaa1f('0x1f')](respondWithResult(_0x2c7a76,null))['catch'](handleError(_0x2c7a76,null));};exports[_0xaa1f('0x56')]=function(_0xf6b6fc,_0x5b5876){return db[_0xaa1f('0x39')][_0xaa1f('0x56')](_0xf6b6fc[_0xaa1f('0x57')],{})['then'](respondWithResult(_0x5b5876,0xc9))[_0xaa1f('0x51')](handleError(_0x5b5876,null));};exports['update']=function(_0x21a7c6,_0x52c460){if(_0x21a7c6[_0xaa1f('0x57')]['id']){delete _0x21a7c6[_0xaa1f('0x57')]['id'];}return db[_0xaa1f('0x39')][_0xaa1f('0x55')]({'where':{'id':_0x21a7c6[_0xaa1f('0x53')]['id']}})[_0xaa1f('0x1f')](handleEntityNotFound(_0x52c460,null))['then'](saveUpdates(_0x21a7c6[_0xaa1f('0x57')],null))[_0xaa1f('0x1f')](respondWithResult(_0x52c460,null))[_0xaa1f('0x51')](handleError(_0x52c460,null));};exports[_0xaa1f('0x35')]=function(_0x229b5d,_0x2c0e9a){return db['OpenchannelMessage'][_0xaa1f('0x55')]({'where':{'id':_0x229b5d[_0xaa1f('0x53')]['id']}})[_0xaa1f('0x1f')](handleEntityNotFound(_0x2c0e9a,null))[_0xaa1f('0x1f')](removeEntity(_0x2c0e9a,null))[_0xaa1f('0x51')](handleError(_0x2c0e9a,null));};exports['describe']=function(_0x184468,_0x5193f){return db[_0xaa1f('0x39')][_0xaa1f('0x58')]()[_0xaa1f('0x1f')](respondWithResult(_0x5193f,null))[_0xaa1f('0x51')](handleError(_0x5193f,null));};var interaction_log=require(_0xaa1f('0x59'))('openchannel-interactions');exports[_0xaa1f('0x5a')]=function(_0x1f5f33,_0x183ac0,_0x22914f){var _0x507385={'channel':_0xaa1f('0x5b')};if(_0x1f5f33[_0xaa1f('0x57')]['id']){delete _0x1f5f33['body']['id'];}_0x1f5f33[_0xaa1f('0x57')][_0xaa1f('0x5c')]=!![];_0x1f5f33[_0xaa1f('0x57')]['readAt']=moment()[_0xaa1f('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f5f33[_0xaa1f('0x57')]['UserId']=_0x1f5f33[_0xaa1f('0x57')]['UserId']||_0x1f5f33[_0xaa1f('0x5e')]['id'];return db['OpenchannelMessage'][_0xaa1f('0x55')]({'where':{'id':_0x1f5f33['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xaa1f('0x5f')}]})[_0xaa1f('0x1f')](handleEntityNotFound(_0x183ac0,null))[_0xaa1f('0x1f')](saveUpdates(_0x1f5f33['body'],null))[_0xaa1f('0x1f')](function(_0x4e3a57){if(_0x4e3a57){_0x507385[_0xaa1f('0x28')]=_0x4e3a57[_0xaa1f('0x60')]({'plain':!![]});return db[_0xaa1f('0x61')][_0xaa1f('0x55')]({'where':{'id':_0x4e3a57[_0xaa1f('0x62')]}});}return null;})[_0xaa1f('0x1f')](handleEntityNotFound(_0x183ac0,null))[_0xaa1f('0x1f')](function(_0x44ce7d){if(_0x44ce7d){return _0x44ce7d[_0xaa1f('0x34')]({'UserId':_0x1f5f33[_0xaa1f('0x57')][_0xaa1f('0x63')],'read1stAt':_['isNil'](_0x44ce7d[_0xaa1f('0x64')])?moment()[_0xaa1f('0x5d')](_0xaa1f('0x65')):undefined});}return null;})[_0xaa1f('0x1f')](function(_0x1d923c){if(_0x1d923c){_0x507385[_0xaa1f('0x66')]=_0x1d923c[_0xaa1f('0x60')]({'plain':!![]});interaction_log[_0xaa1f('0x20')](_0xaa1f('0x67'),_0x1f5f33['user']['id'],_0x1f5f33['user'][_0xaa1f('0x36')],_0x1f5f33[_0xaa1f('0x5e')][_0xaa1f('0x68')],_0x507385[_0xaa1f('0x66')]['id'],_0x1f5f33[_0xaa1f('0x57')]?JSON[_0xaa1f('0x25')](_0x1f5f33[_0xaa1f('0x57')]):_0xaa1f('0x69'));return respondWithRpcPromise(_0xaa1f('0x6a'),_0xaa1f('0x6b'),_0x507385);}return null;})[_0xaa1f('0x1f')](function(_0x4d32f6){if(_0x4d32f6){if(_0x1f5f33[_0xaa1f('0x57')]['manual']){_0x507385[_0xaa1f('0x28')][_0xaa1f('0x6c')]=util[_0xaa1f('0x5d')](_0xaa1f('0x6d'),_0x1f5f33[_0xaa1f('0x5e')]['name']);_0x507385[_0xaa1f('0x28')][_0xaa1f('0x6e')]=_0x507385['channel'];_0x507385[_0xaa1f('0x28')][_0xaa1f('0x6f')]='accept';return respondWithRpcPromise('EventManager',_0xaa1f('0x70'),{'event':'acceptmessage','message':_0x507385['message']},client9002)['then'](function(){return _0x507385;});}return _0x507385;}return null;})[_0xaa1f('0x1f')](respondWithResult(_0x183ac0,null))[_0xaa1f('0x51')](handleError(_0x183ac0,null));};var interaction_log=require('../../config/logger')(_0xaa1f('0x71'));exports['reject']=function(_0x2c49f4,_0x5f013f,_0x4bcd6d){var _0x3ce705={'agent':{},'channel':_0xaa1f('0x5b')};if(_0x2c49f4[_0xaa1f('0x57')]['id']){delete _0x2c49f4[_0xaa1f('0x57')]['id'];}_0x2c49f4[_0xaa1f('0x57')][_0xaa1f('0x63')]=_0x2c49f4[_0xaa1f('0x57')][_0xaa1f('0x63')]||_0x2c49f4['user']['id'];_0x3ce705[_0xaa1f('0x72')]['id']=_0x2c49f4[_0xaa1f('0x57')][_0xaa1f('0x63')];return db[_0xaa1f('0x39')][_0xaa1f('0x55')]({'where':{'id':_0x2c49f4[_0xaa1f('0x53')]['id'],'UserId':null}})[_0xaa1f('0x1f')](handleEntityNotFound(_0x5f013f,null))[_0xaa1f('0x1f')](function(_0xc3e313){if(_0xc3e313){_0x3ce705['message']=_0xc3e313[_0xaa1f('0x60')]({'plain':!![]});return db[_0xaa1f('0x61')][_0xaa1f('0x55')]({'where':{'id':_0xc3e313['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5f013f,null))[_0xaa1f('0x1f')](function(_0x40fea1){if(_0x40fea1){_0x3ce705['interaction']=_0x40fea1[_0xaa1f('0x60')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c49f4['user']['id'],_0x2c49f4[_0xaa1f('0x5e')][_0xaa1f('0x36')],_0x2c49f4[_0xaa1f('0x5e')]['role'],_0x3ce705[_0xaa1f('0x66')]['id'],_0x2c49f4[_0xaa1f('0x57')]?JSON[_0xaa1f('0x25')](_0x2c49f4[_0xaa1f('0x57')]):_0xaa1f('0x69'));return respondWithRpcPromise(_0xaa1f('0x73'),_0xaa1f('0x74'),_0x3ce705);}return null;})[_0xaa1f('0x1f')](function(_0xf862b){if(_0xf862b){_0xf862b[_0xaa1f('0x28')][_0xaa1f('0x6c')]=util[_0xaa1f('0x5d')](_0xaa1f('0x6d'),_0x2c49f4[_0xaa1f('0x5e')][_0xaa1f('0x36')]);_0xf862b[_0xaa1f('0x28')]['channel']=_0x3ce705[_0xaa1f('0x6e')];_0xf862b[_0xaa1f('0x28')][_0xaa1f('0x6f')]=_0xaa1f('0x75');respondWithRpcPromise(_0xaa1f('0x70'),_0xaa1f('0x70'),{'event':_0xaa1f('0x76'),'message':_0xf862b[_0xaa1f('0x28')]},client9002);return _0x3ce705;}return null;})[_0xaa1f('0x1f')](respondWithResult(_0x5f013f,null))['catch'](handleError(_0x5f013f,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 7438501..6ce7547 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 _0xb4de=['update','remove','emit','hasOwnProperty','hook','events','OpenchannelMessage','save'];(function(_0x265468,_0xcf7439){var _0x37d555=function(_0x47c742){while(--_0x47c742){_0x265468['push'](_0x265468['shift']());}};_0x37d555(++_0xcf7439);}(_0xb4de,0x75));var _0xeb4d=function(_0x40ca81,_0x15ae47){_0x40ca81=_0x40ca81-0x0;var _0x1389a4=_0xb4de[_0x40ca81];return _0x1389a4;};'use strict';var EventEmitter=require(_0xeb4d('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xeb4d('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb4d('0x2'),'afterUpdate':_0xeb4d('0x3'),'afterDestroy':_0xeb4d('0x4')};function emitEvent(_0x49465c){return function(_0x350453,_0x3aa8cc,_0x10f93e){OpenchannelMessageEvents[_0xeb4d('0x5')](_0x49465c+':'+_0x350453['id'],_0x350453);OpenchannelMessageEvents[_0xeb4d('0x5')](_0x49465c,_0x350453);_0x10f93e(null);};}for(var e in events){if(events[_0xeb4d('0x6')](e)){var event=events[e];OpenchannelMessage[_0xeb4d('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x1340=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x4eaa69,_0x2ea276){var _0x455246=function(_0x30c605){while(--_0x30c605){_0x4eaa69['push'](_0x4eaa69['shift']());}};_0x455246(++_0x2ea276);}(_0x1340,0x183));var _0x0134=function(_0x57b060,_0x1d19cf){_0x57b060=_0x57b060-0x0;var _0x3784dd=_0x1340[_0x57b060];return _0x3784dd;};'use strict';var EventEmitter=require(_0x0134('0x0'));var OpenchannelMessage=require(_0x0134('0x1'))['db'][_0x0134('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0134('0x3')](0x0);var events={'afterCreate':_0x0134('0x4'),'afterUpdate':_0x0134('0x5'),'afterDestroy':_0x0134('0x6')};function emitEvent(_0x5bf37b){return function(_0x3bc006,_0x4d6495,_0x22566a){OpenchannelMessageEvents['emit'](_0x5bf37b+':'+_0x3bc006['id'],_0x3bc006);OpenchannelMessageEvents['emit'](_0x5bf37b,_0x3bc006);_0x22566a(null);};}for(var e in events){if(events[_0x0134('0x7')](e)){var event=events[e];OpenchannelMessage[_0x0134('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 466f1a4..8534a57 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 _0x3c8e=['omit','POST','GET','body','replyUri','threadId','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','then','update','catch','error','secret','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0x3c8e,0x19d));var _0xe3c8=function(_0x9ee452,_0x8e2e2c){_0x9ee452=_0x9ee452-0x0;var _0x1a3bcd=_0x3c8e[_0x9ee452];return _0x1a3bcd;};'use strict';var _=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var logger=require(_0xe3c8('0x2'))(_0xe3c8('0x3'));var moment=require(_0xe3c8('0x4'));var BPromise=require('bluebird');var rp=require(_0xe3c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3c8('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x5def5d,_0x486e90){return _0x5def5d[_0xe3c8('0x7')](_0xe3c8('0x8'),attributes,{'tableName':_0xe3c8('0x9'),'paranoid':![],'indexes':[{'name':_0xe3c8('0xa'),'fields':['body'],'type':_0xe3c8('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2cc587,_0xa24410,_0x131447){var _0xab42f5=_0x5def5d['models'];var _0x44f3fb=_0x2cc587[_0xe3c8('0xc')]({'plain':!![]});if(_0x44f3fb[_0xe3c8('0xd')]['toLowerCase']()==='in'||_0x44f3fb[_0xe3c8('0xd')][_0xe3c8('0xe')]()===_0xe3c8('0xf')&&!_0x44f3fb['secret']&&!_[_0xe3c8('0x10')](_0x44f3fb[_0xe3c8('0x11')])){_0xab42f5[_0xe3c8('0x12')]['findOne']({'where':{'id':_0x44f3fb['OpenchannelInteractionId']}})[_0xe3c8('0x13')](function(_0x3da267){if(_0x3da267){_0x3da267[_0xe3c8('0x14')]({'lastMsgAt':_0x44f3fb['createdAt'],'lastMsgDirection':_0x44f3fb['direction'][_0xe3c8('0xe')]()});}})[_0xe3c8('0x15')](function(_0x3dff66){console[_0xe3c8('0x16')](_0x3dff66);});}if(_0x44f3fb['direction']===_0xe3c8('0xf')&&!_0x44f3fb[_0xe3c8('0x17')]){var _0x44cfd9;_0xab42f5[_0xe3c8('0x18')]['describe']()['then'](function(_0x2d12b8){return _0xab42f5[_0xe3c8('0x19')][_0xe3c8('0x1a')]({'where':{'id':_0x44f3fb[_0xe3c8('0x1b')]},'include':[{'model':_0xab42f5['OpenchannelInteraction'],'as':_0xe3c8('0x1c'),'where':{'id':_0x44f3fb[_0xe3c8('0x1d')]},'limit':0x1,'include':[{'model':_0xab42f5[_0xe3c8('0x18')],'as':_0xe3c8('0x1e'),'attributes':_['keys'](_0x2d12b8)}]}]});})[_0xe3c8('0x13')](function(_0x2a94d2){_0x44cfd9=_0x2a94d2[_0xe3c8('0xc')]({'plain':!![]});if(_0x44cfd9&&_0x44cfd9['replyUri']){logger[_0xe3c8('0x1f')](_0xe3c8('0x20'),_0xe3c8('0x21'),util[_0xe3c8('0x22')](_0xe3c8('0x23'),_0x44f3fb['id'],_0x44cfd9['replyUri']));if(_0x44cfd9[_0xe3c8('0x1c')]&&_0x44cfd9[_0xe3c8('0x1c')]['length']){_0x44f3fb[_0xe3c8('0x24')]=_[_0xe3c8('0x25')](_0x44cfd9[_0xe3c8('0x1c')][0x0],_0xe3c8('0x1e'));_0x44f3fb['Contact']=_0x44cfd9[_0xe3c8('0x1c')][0x0][_0xe3c8('0x1e')];}var _0xa24410={'method':_0xe3c8('0x26'),'uri':encodeURI(_0x44cfd9['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xa24410['method']){case _0xe3c8('0x27'):_0xa24410['qs']=_0x44f3fb;break;case _0xe3c8('0x26'):_0xa24410[_0xe3c8('0x28')]=_0x44f3fb;break;}return rp(_0xa24410)[_0xe3c8('0x13')](function(_0xbfef61){logger['info']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xe3c8('0x22')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x44f3fb['id'],_0x44cfd9[_0xe3c8('0x29')]));if(_0xbfef61[_0xe3c8('0x28')][_0xe3c8('0x2a')]&&_0xbfef61[_0xe3c8('0x28')][_0xe3c8('0x2a')]!=_0x44f3fb[_0xe3c8('0x24')][_0xe3c8('0x2a')]){return _0xab42f5[_0xe3c8('0x12')][_0xe3c8('0x14')]({'threadId':_0xbfef61[_0xe3c8('0x28')]['threadId']},{'logging':!![],'where':{'id':_0x44f3fb[_0xe3c8('0x24')]['id']}});}else{return;}})[_0xe3c8('0x13')](function(){return _0x2cc587[_0xe3c8('0x14')]({'read':!![]});})['catch'](function(_0x51e361){logger[_0xe3c8('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0xe3c8('0x21'),util[_0xe3c8('0x2b')](_0x51e361,{'showHidden':![],'depth':null}));_0x131447();});}else{_0x131447();}})['finally'](function(){_0x131447();});}else{_0x131447();}}},'charset':'utf8mb4','collate':_0xe3c8('0x2c')});}; \ No newline at end of file +var _0xec69=['define','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','error','describe','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','replyUri','omit','method','POST','threadId','Interaction','catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','./openchannelMessage.attributes','exports'];(function(_0x4d64c7,_0x229b2c){var _0x2f7f5c=function(_0x25fd66){while(--_0x25fd66){_0x4d64c7['push'](_0x4d64c7['shift']());}};_0x2f7f5c(++_0x229b2c);}(_0xec69,0x84));var _0x9ec6=function(_0x1139d0,_0x41e5f8){_0x1139d0=_0x1139d0-0x0;var _0xcc01a6=_0xec69[_0x1139d0];return _0xcc01a6;};'use strict';var _=require(_0x9ec6('0x0'));var util=require(_0x9ec6('0x1'));var logger=require(_0x9ec6('0x2'))(_0x9ec6('0x3'));var moment=require(_0x9ec6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ec6('0x5'));var rimraf=require(_0x9ec6('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ec6('0x7'));module[_0x9ec6('0x8')]=function(_0x2ce59e,_0x1642f5){return _0x2ce59e[_0x9ec6('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x9ec6('0xa'),'fields':[_0x9ec6('0xb')],'type':_0x9ec6('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d5c86,_0x2b4de5,_0x482d19){var _0xbbe6a2=_0x2ce59e['models'];var _0x4328ab=_0x5d5c86[_0x9ec6('0xd')]({'plain':!![]});if(_0x4328ab[_0x9ec6('0xe')]['toLowerCase']()==='in'||_0x4328ab['direction'][_0x9ec6('0xf')]()===_0x9ec6('0x10')&&!_0x4328ab[_0x9ec6('0x11')]&&!_[_0x9ec6('0x12')](_0x4328ab[_0x9ec6('0x13')])){_0xbbe6a2['OpenchannelInteraction'][_0x9ec6('0x14')]({'where':{'id':_0x4328ab[_0x9ec6('0x15')]}})[_0x9ec6('0x16')](function(_0x4cb72){if(_0x4cb72){_0x4cb72[_0x9ec6('0x17')]({'lastMsgAt':_0x4328ab['createdAt'],'lastMsgDirection':_0x4328ab[_0x9ec6('0xe')]['toLowerCase']()});}})['catch'](function(_0x144d6d){console[_0x9ec6('0x18')](_0x144d6d);});}if(_0x4328ab[_0x9ec6('0xe')]===_0x9ec6('0x10')&&!_0x4328ab[_0x9ec6('0x11')]){var _0x32da3a;_0xbbe6a2['CmContact'][_0x9ec6('0x19')]()[_0x9ec6('0x16')](function(_0xd908a2){return _0xbbe6a2['OpenchannelAccount'][_0x9ec6('0x1a')]({'where':{'id':_0x4328ab[_0x9ec6('0x1b')]},'include':[{'model':_0xbbe6a2[_0x9ec6('0x1c')],'as':_0x9ec6('0x1d'),'where':{'id':_0x4328ab['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0xbbe6a2[_0x9ec6('0x1e')],'as':_0x9ec6('0x1f'),'attributes':_[_0x9ec6('0x20')](_0xd908a2)}]}]});})[_0x9ec6('0x16')](function(_0x13b618){_0x32da3a=_0x13b618[_0x9ec6('0xd')]({'plain':!![]});if(_0x32da3a&&_0x32da3a['replyUri']){logger[_0x9ec6('0x21')](_0x9ec6('0x22'),_0x9ec6('0x23'),util[_0x9ec6('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x4328ab['id'],_0x32da3a[_0x9ec6('0x25')]));if(_0x32da3a[_0x9ec6('0x1d')]&&_0x32da3a[_0x9ec6('0x1d')]['length']){_0x4328ab['Interaction']=_[_0x9ec6('0x26')](_0x32da3a[_0x9ec6('0x1d')][0x0],_0x9ec6('0x1f'));_0x4328ab[_0x9ec6('0x1f')]=_0x32da3a['Interactions'][0x0][_0x9ec6('0x1f')];}var _0x2b4de5={'method':'POST','uri':encodeURI(_0x32da3a[_0x9ec6('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2b4de5[_0x9ec6('0x27')]){case'GET':_0x2b4de5['qs']=_0x4328ab;break;case _0x9ec6('0x28'):_0x2b4de5[_0x9ec6('0xb')]=_0x4328ab;break;}return rp(_0x2b4de5)[_0x9ec6('0x16')](function(_0x5e8cdc){logger[_0x9ec6('0x21')](_0x9ec6('0x22'),'afterCreate',util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x4328ab['id'],_0x32da3a[_0x9ec6('0x25')]));if(_0x5e8cdc['body'][_0x9ec6('0x29')]&&_0x5e8cdc[_0x9ec6('0xb')][_0x9ec6('0x29')]!=_0x4328ab[_0x9ec6('0x2a')][_0x9ec6('0x29')]){return _0xbbe6a2['OpenchannelInteraction'][_0x9ec6('0x17')]({'threadId':_0x5e8cdc['body'][_0x9ec6('0x29')]},{'logging':!![],'where':{'id':_0x4328ab['Interaction']['id']}});}else{return;}})[_0x9ec6('0x16')](function(){return _0x5d5c86['update']({'read':!![]});})[_0x9ec6('0x2b')](function(_0x1ced15){logger['error'](_0x9ec6('0x22'),'afterCreate',util['inspect'](_0x1ced15,{'showHidden':![],'depth':null}));_0x482d19();});}else{_0x482d19();}})[_0x9ec6('0x2c')](function(){_0x482d19();});}else{_0x482d19();}}},'charset':_0x9ec6('0x2d'),'collate':_0x9ec6('0x2e')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 18c04fd..c7a613f 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 _0x6931=['then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelMessage','create','body','options','raw','info','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelMessage.socket','register','request'];(function(_0x18eee6,_0x3b735f){var _0x4ea991=function(_0x904280){while(--_0x904280){_0x18eee6['push'](_0x18eee6['shift']());}};_0x4ea991(++_0x3b735f);}(_0x6931,0x1a9));var _0x1693=function(_0x34ec0c,_0x1b88df){_0x34ec0c=_0x34ec0c-0x0;var _0x29bf2b=_0x6931[_0x34ec0c];return _0x29bf2b;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require(_0x1693('0x2'));var BPromise=require(_0x1693('0x3'));var rs=require(_0x1693('0x4'));var fs=require('fs');var Redis=require(_0x1693('0x5'));var db=require(_0x1693('0x6'))['db'];var utils=require(_0x1693('0x7'));var logger=require('../../config/logger')(_0x1693('0x8'));var config=require(_0x1693('0x9'));var jayson=require(_0x1693('0xa'));var client=jayson[_0x1693('0xb')][_0x1693('0xc')]({'port':0x232a});config['redis']=_[_0x1693('0xd')](config[_0x1693('0xe')],{'host':_0x1693('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1693('0xe')]));require(_0x1693('0x10'))[_0x1693('0x11')](socket);function respondWithRpcPromise(_0x141ea9,_0x2af3d1,_0x181184){return new BPromise(function(_0x26ba4b,_0x3807dd){return client[_0x1693('0x12')](_0x141ea9,_0x181184)[_0x1693('0x13')](function(_0x1ba755){logger['info'](_0x1693('0x14'),_0x2af3d1,_0x1693('0x15'));logger[_0x1693('0x16')](_0x1693('0x17'),_0x2af3d1,_0x1693('0x15'),JSON[_0x1693('0x18')](_0x1ba755));if(_0x1ba755[_0x1693('0x19')]){if(_0x1ba755['error'][_0x1693('0x1a')]===0x1f4){logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error'][_0x1693('0x1b')]);return _0x3807dd(_0x1ba755[_0x1693('0x19')]['message']);}logger['error'](_0x1693('0x14'),_0x2af3d1,_0x1ba755['error']['message']);return _0x26ba4b(_0x1ba755['error'][_0x1693('0x1b')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2af3d1,_0x1693('0x15'));_0x26ba4b(_0x1ba755[_0x1693('0x1c')][_0x1693('0x1b')]);}})[_0x1693('0x1d')](function(_0x28edfe){logger[_0x1693('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x2af3d1,_0x28edfe);_0x3807dd(_0x28edfe);});});}exports['CreateOpenchannelMessage']=function(_0x266bb6){var _0x3d1559=this;return new Promise(function(_0x528995,_0x183183){return db[_0x1693('0x1e')][_0x1693('0x1f')](_0x266bb6[_0x1693('0x20')],{'raw':_0x266bb6[_0x1693('0x21')]?_0x266bb6['options'][_0x1693('0x22')]===undefined?!![]:![]:!![]})[_0x1693('0x13')](function(_0xbe9928){logger[_0x1693('0x23')](_0x1693('0x24'),_0x266bb6);logger[_0x1693('0x16')]('CreateOpenchannelMessage',_0x266bb6,JSON[_0x1693('0x18')](_0xbe9928));_0x528995(_0xbe9928);})['catch'](function(_0x34dda4){logger[_0x1693('0x19')](_0x1693('0x24'),_0x34dda4['message'],_0x266bb6);_0x183183(_0x3d1559[_0x1693('0x19')](0x1f4,_0x34dda4[_0x1693('0x1b')]));});});}; \ No newline at end of file +var _0xfc4f=['create','body','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','OpenchannelMessage'];(function(_0x2f02d7,_0x58dae0){var _0x4f6ebc=function(_0x1a0746){while(--_0x1a0746){_0x2f02d7['push'](_0x2f02d7['shift']());}};_0x4f6ebc(++_0x58dae0);}(_0xfc4f,0x192));var _0xffc4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfc4f[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xffc4('0x0'));var moment=require(_0xffc4('0x1'));var BPromise=require(_0xffc4('0x2'));var rs=require(_0xffc4('0x3'));var fs=require('fs');var Redis=require(_0xffc4('0x4'));var db=require(_0xffc4('0x5'))['db'];var utils=require(_0xffc4('0x6'));var logger=require('../../config/logger')(_0xffc4('0x7'));var config=require(_0xffc4('0x8'));var jayson=require(_0xffc4('0x9'));var client=jayson[_0xffc4('0xa')]['http']({'port':0x232a});config[_0xffc4('0xb')]=_[_0xffc4('0xc')](config['redis'],{'host':_0xffc4('0xd'),'port':0x18eb});var socket=require(_0xffc4('0xe'))(new Redis(config[_0xffc4('0xb')]));require(_0xffc4('0xf'))['register'](socket);function respondWithRpcPromise(_0x22daf5,_0x22d03a,_0x2539cd){return new BPromise(function(_0x1718c3,_0x3705a7){return client[_0xffc4('0x10')](_0x22daf5,_0x2539cd)['then'](function(_0x4136dd){logger[_0xffc4('0x11')](_0xffc4('0x12'),_0x22d03a,_0xffc4('0x13'));logger[_0xffc4('0x14')](_0xffc4('0x15'),_0x22d03a,_0xffc4('0x13'),JSON['stringify'](_0x4136dd));if(_0x4136dd[_0xffc4('0x16')]){if(_0x4136dd[_0xffc4('0x16')]['code']===0x1f4){logger[_0xffc4('0x16')](_0xffc4('0x12'),_0x22d03a,_0x4136dd['error'][_0xffc4('0x17')]);return _0x3705a7(_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);}logger[_0xffc4('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x22d03a,_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);return _0x1718c3(_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);}else{logger[_0xffc4('0x11')](_0xffc4('0x12'),_0x22d03a,_0xffc4('0x13'));_0x1718c3(_0x4136dd[_0xffc4('0x18')][_0xffc4('0x17')]);}})[_0xffc4('0x19')](function(_0x51a9ba){logger[_0xffc4('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x22d03a,_0x51a9ba);_0x3705a7(_0x51a9ba);});});}exports['CreateOpenchannelMessage']=function(_0x6a0096){var _0xd48851=this;return new Promise(function(_0x25b521,_0x5eb1c1){return db[_0xffc4('0x1a')][_0xffc4('0x1b')](_0x6a0096[_0xffc4('0x1c')],{'raw':_0x6a0096[_0xffc4('0x1d')]?_0x6a0096[_0xffc4('0x1d')][_0xffc4('0x1e')]===undefined?!![]:![]:!![]})[_0xffc4('0x1f')](function(_0x5957f2){logger[_0xffc4('0x11')](_0xffc4('0x20'),_0x6a0096);logger[_0xffc4('0x14')](_0xffc4('0x20'),_0x6a0096,JSON['stringify'](_0x5957f2));_0x25b521(_0x5957f2);})['catch'](function(_0x39d808){logger[_0xffc4('0x16')]('CreateOpenchannelMessage',_0x39d808[_0xffc4('0x17')],_0x6a0096);_0x5eb1c1(_0xd48851[_0xffc4('0x16')](0x1f4,_0x39d808[_0xffc4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index e259d3c..45a5dd1 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 _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_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 +var _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x25fb30,_0x276389){var _0x5201bd=function(_0x373454){while(--_0x373454){_0x25fb30['push'](_0x25fb30['shift']());}};_0x5201bd(++_0x276389);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xcb91[_0x254d9f];return _0x1eedb9;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e161fe8..e585852 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 _0x9d5c=['removeTeams','removeAgents','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','delete'];(function(_0x2ae7b4,_0x337421){var _0x5b01c0=function(_0x318227){while(--_0x318227){_0x2ae7b4['push'](_0x2ae7b4['shift']());}};_0x5b01c0(++_0x337421);}(_0x9d5c,0x98));var _0xc9d5=function(_0x1be0ab,_0xc2f02a){_0x1be0ab=_0x1be0ab-0x0;var _0x3d1aa9=_0x9d5c[_0x1be0ab];return _0x3d1aa9;};'use strict';var multer=require(_0xc9d5('0x0'));var util=require('util');var path=require(_0xc9d5('0x1'));var timeout=require(_0xc9d5('0x2'));var express=require('express');var router=express[_0xc9d5('0x3')]();var auth=require(_0xc9d5('0x4'));var interaction=require(_0xc9d5('0x5'));var config=require('../../config/environment');var controller=require(_0xc9d5('0x6'));router[_0xc9d5('0x7')]('/',auth['isAuthenticated'](),controller[_0xc9d5('0x8')]);router[_0xc9d5('0x7')](_0xc9d5('0x9'),auth[_0xc9d5('0xa')](),controller[_0xc9d5('0xb')]);router[_0xc9d5('0x7')](_0xc9d5('0xc'),auth[_0xc9d5('0xa')](),controller[_0xc9d5('0xd')]);router[_0xc9d5('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0xc9d5('0xe')]);router['get'](_0xc9d5('0xf'),auth[_0xc9d5('0xa')](),controller[_0xc9d5('0x10')]);router[_0xc9d5('0x7')](_0xc9d5('0x11'),auth[_0xc9d5('0xa')](),controller[_0xc9d5('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xc9d5('0x13')](_0xc9d5('0xf'),auth[_0xc9d5('0xa')](),controller[_0xc9d5('0x14')]);router['post'](_0xc9d5('0x11'),auth[_0xc9d5('0xa')](),controller['addAgents']);router[_0xc9d5('0x15')](_0xc9d5('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc9d5('0x16')](_0xc9d5('0xc'),auth[_0xc9d5('0xa')](),controller['destroy']);router[_0xc9d5('0x16')]('/:id/teams',auth[_0xc9d5('0xa')](),controller[_0xc9d5('0x17')]);router[_0xc9d5('0x16')](_0xc9d5('0x11'),auth['isAuthenticated'](),controller[_0xc9d5('0x18')]);module['exports']=router; \ No newline at end of file +var _0x00b3=['exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeTeams'];(function(_0x1ead33,_0x91e205){var _0x4faf72=function(_0x1de2cd){while(--_0x1de2cd){_0x1ead33['push'](_0x1ead33['shift']());}};_0x4faf72(++_0x91e205);}(_0x00b3,0x97));var _0x300b=function(_0x15a3fb,_0x267eec){_0x15a3fb=_0x15a3fb-0x0;var _0x2e9a8f=_0x00b3[_0x15a3fb];return _0x2e9a8f;};'use strict';var multer=require(_0x300b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x300b('0x1'));var express=require(_0x300b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x300b('0x3'));var config=require(_0x300b('0x4'));var controller=require(_0x300b('0x5'));router['get']('/',auth[_0x300b('0x6')](),controller[_0x300b('0x7')]);router[_0x300b('0x8')](_0x300b('0x9'),auth[_0x300b('0x6')](),controller[_0x300b('0xa')]);router[_0x300b('0x8')](_0x300b('0xb'),auth[_0x300b('0x6')](),controller[_0x300b('0xc')]);router[_0x300b('0x8')](_0x300b('0xd'),auth[_0x300b('0x6')](),controller['getMembers']);router[_0x300b('0x8')](_0x300b('0xe'),auth[_0x300b('0x6')](),controller['getTeams']);router[_0x300b('0x8')](_0x300b('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x300b('0x10')]('/',auth['isAuthenticated'](),controller[_0x300b('0x11')]);router[_0x300b('0x10')](_0x300b('0xe'),auth[_0x300b('0x6')](),controller[_0x300b('0x12')]);router[_0x300b('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x300b('0x13')]);router[_0x300b('0x14')](_0x300b('0xb'),auth[_0x300b('0x6')](),controller[_0x300b('0x15')]);router[_0x300b('0x16')](_0x300b('0xb'),auth[_0x300b('0x6')](),controller['destroy']);router[_0x300b('0x16')](_0x300b('0xe'),auth['isAuthenticated'](),controller[_0x300b('0x17')]);router[_0x300b('0x16')](_0x300b('0xf'),auth[_0x300b('0x6')](),controller['removeAgents']);module[_0x300b('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 11de07c..47be37b 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 _0x5360=['sequelize','exports','STRING','name','ENUM','beepall','roundrobin'];(function(_0x3657f4,_0x3d0ed4){var _0x27574a=function(_0x55b4e5){while(--_0x55b4e5){_0x3657f4['push'](_0x3657f4['shift']());}};_0x27574a(++_0x3d0ed4);}(_0x5360,0x157));var _0x0536=function(_0x3e22da,_0x5aebbf){_0x3e22da=_0x3e22da-0x0;var _0x34f6d4=_0x5360[_0x3e22da];return _0x34f6d4;};'use strict';var Sequelize=require(_0x0536('0x0'));module[_0x0536('0x1')]={'name':{'type':Sequelize[_0x0536('0x2')],'unique':_0x0536('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0536('0x4')]('rrmemory',_0x0536('0x5'),_0x0536('0x6'))}}; \ No newline at end of file +var _0xc4b3=['name','STRING','INTEGER','ENUM','beepall','sequelize'];(function(_0x256a79,_0x304ae7){var _0x2ef98b=function(_0x7e1406){while(--_0x7e1406){_0x256a79['push'](_0x256a79['shift']());}};_0x2ef98b(++_0x304ae7);}(_0xc4b3,0x179));var _0x3c4b=function(_0x186131,_0x13b5e7){_0x186131=_0x186131-0x0;var _0x17cb3c=_0xc4b3[_0x186131];return _0x17cb3c;};'use strict';var Sequelize=require(_0x3c4b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3c4b('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3c4b('0x2')]},'timeout':{'type':Sequelize[_0x3c4b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3c4b('0x4')]('rrmemory',_0x3c4b('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 25e04b2..da58925 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 _0x56fa=['json','apply','reject','update','then','destroy','OpenchannelQueues','UserProfileResource','end','error','stack','name','send','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','OpenchannelQueue','count','includeAll','include','findAll','catch','show','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','offset','limit','set'];(function(_0xa72e3a,_0x4d3bd1){var _0x41cff3=function(_0x4dd760){while(--_0x4dd760){_0xa72e3a['push'](_0xa72e3a['shift']());}};_0x41cff3(++_0x4d3bd1);}(_0x56fa,0x186));var _0xa56f=function(_0xf3eb31,_0x11cc3c){_0xf3eb31=_0xf3eb31-0x0;var _0x21cc5e=_0x56fa[_0xf3eb31];return _0x21cc5e;};'use strict';var pdf=require(_0xa56f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa56f('0x1'));var zipdir=require(_0xa56f('0x2'));var jsonpatch=require(_0xa56f('0x3'));var rp=require(_0xa56f('0x4'));var moment=require(_0xa56f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa56f('0x6'));var util=require(_0xa56f('0x7'));var path=require(_0xa56f('0x8'));var sox=require(_0xa56f('0x9'));var csv=require(_0xa56f('0xa'));var ejs=require(_0xa56f('0xb'));var fs=require('fs');var _=require(_0xa56f('0xc'));var squel=require(_0xa56f('0xd'));var crypto=require(_0xa56f('0xe'));var jsforce=require(_0xa56f('0xf'));var deskjs=require(_0xa56f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa56f('0x11'));var Papa=require(_0xa56f('0x12'));var Redis=require(_0xa56f('0x13'));var authService=require(_0xa56f('0x14'));var qs=require(_0xa56f('0x15'));var as=require(_0xa56f('0x16'));var hardwareService=require(_0xa56f('0x17'));var logger=require(_0xa56f('0x18'))('api');var utils=require(_0xa56f('0x19'));var config=require(_0xa56f('0x1a'));var db=require('../../mysqldb')['db'];config[_0xa56f('0x1b')]=_[_0xa56f('0x1c')](config[_0xa56f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa56f('0x1d'))(new Redis(config[_0xa56f('0x1b')]));require('./openchannelQueue.socket')[_0xa56f('0x1e')](socket);function respondWithStatusCode(_0x1cf4ba,_0x4d0b47){_0x4d0b47=_0x4d0b47||0xcc;return function(_0x2fb9ba){if(_0x2fb9ba){return _0x1cf4ba[_0xa56f('0x1f')](_0x4d0b47);}return _0x1cf4ba[_0xa56f('0x20')](_0x4d0b47)['end']();};}function respondWithResult(_0x520b64,_0x385e20){_0x385e20=_0x385e20||0xc8;return function(_0x4438f3){if(_0x4438f3){return _0x520b64['status'](_0x385e20)['json'](_0x4438f3);}};}function respondWithFilteredResult(_0x5c6713,_0x34e17e){return function(_0x2d54e1){if(_0x2d54e1){var _0xeaea9e=_0x2d54e1['count'],_0x45bf3e=_0x34e17e[_0xa56f('0x21')],_0xa3f502=_0x34e17e[_0xa56f('0x21')]+_0x34e17e[_0xa56f('0x22')],_0x27ef66;if(_0xa3f502>=_0xeaea9e){_0xa3f502=_0xeaea9e;_0x27ef66=0xc8;}else{_0x27ef66=0xce;}_0x5c6713[_0xa56f('0x20')](_0x27ef66);return _0x5c6713[_0xa56f('0x23')]('Content-Range',_0x45bf3e+'-'+_0xa3f502+'/'+_0xeaea9e)[_0xa56f('0x24')](_0x2d54e1);}return null;};}function patchUpdates(_0xcb2954){return function(_0x30f0a0){try{jsonpatch[_0xa56f('0x25')](_0x30f0a0,_0xcb2954,!![]);}catch(_0x277a1d){return BPromise[_0xa56f('0x26')](_0x277a1d);}return _0x30f0a0['save']();};}function saveUpdates(_0x4b5255,_0x2bc8c5){return function(_0x1c1a6e){if(_0x1c1a6e){return _0x1c1a6e[_0xa56f('0x27')](_0x4b5255)[_0xa56f('0x28')](function(_0x4f246f){return _0x4f246f;});}return null;};}function removeEntity(_0x585736,_0xcfdbec){return function(_0x39753a){if(_0x39753a){return _0x39753a[_0xa56f('0x29')]()[_0xa56f('0x28')](function(){var _0x8451be=_0x39753a['get']({'plain':!![]});var _0x4e3d7b=_0xa56f('0x2a');return db[_0xa56f('0x2b')][_0xa56f('0x29')]({'where':{'type':_0x4e3d7b,'resourceId':_0x8451be['id']}})[_0xa56f('0x28')](function(){return _0x39753a;});})[_0xa56f('0x28')](function(){_0x585736[_0xa56f('0x20')](0xcc)[_0xa56f('0x2c')]();});}};}function handleEntityNotFound(_0x21c49d,_0x6e8a8a){return function(_0x4546ed){if(!_0x4546ed){_0x21c49d[_0xa56f('0x1f')](0x194);}return _0x4546ed;};}function handleError(_0x13551a,_0x5c9747){_0x5c9747=_0x5c9747||0x1f4;return function(_0xa49912){logger[_0xa56f('0x2d')](_0xa49912[_0xa56f('0x2e')]);if(_0xa49912[_0xa56f('0x2f')]){delete _0xa49912[_0xa56f('0x2f')];}_0x13551a['status'](_0x5c9747)[_0xa56f('0x30')](_0xa49912);};}exports['index']=function(_0x4c845d,_0x572136){var _0x266686={},_0x1d6983={},_0x5a0b98={'count':0x0,'rows':[]};var _0x457c4d=_[_0xa56f('0x31')](db['OpenchannelQueue'][_0xa56f('0x32')],function(_0x4e468e){return{'name':_0x4e468e['fieldName'],'type':_0x4e468e['type'][_0xa56f('0x33')]};});_0x1d6983[_0xa56f('0x34')]=_[_0xa56f('0x31')](_0x457c4d,'name');_0x1d6983[_0xa56f('0x35')]=_[_0xa56f('0x36')](_0x4c845d[_0xa56f('0x35')]);_0x1d6983[_0xa56f('0x37')]=_['intersection'](_0x1d6983['model'],_0x1d6983[_0xa56f('0x35')]);_0x266686[_0xa56f('0x38')]=_[_0xa56f('0x39')](_0x1d6983[_0xa56f('0x34')],qs[_0xa56f('0x3a')](_0x4c845d['query'][_0xa56f('0x3a')]));_0x266686[_0xa56f('0x38')]=_0x266686[_0xa56f('0x38')][_0xa56f('0x3b')]?_0x266686[_0xa56f('0x38')]:_0x1d6983[_0xa56f('0x34')];if(!_0x4c845d[_0xa56f('0x35')][_0xa56f('0x3c')](_0xa56f('0x3d'))){_0x266686[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x4c845d[_0xa56f('0x35')][_0xa56f('0x22')]);_0x266686[_0xa56f('0x21')]=qs[_0xa56f('0x21')](_0x4c845d[_0xa56f('0x35')][_0xa56f('0x21')]);}_0x266686[_0xa56f('0x3e')]=qs[_0xa56f('0x3f')](_0x4c845d[_0xa56f('0x35')][_0xa56f('0x3f')]);_0x266686[_0xa56f('0x40')]=qs[_0xa56f('0x37')](_[_0xa56f('0x41')](_0x4c845d[_0xa56f('0x35')],_0x1d6983[_0xa56f('0x37')]),_0x457c4d);if(_0x4c845d[_0xa56f('0x35')][_0xa56f('0x42')]){_0x266686[_0xa56f('0x40')]=_[_0xa56f('0x43')](_0x266686[_0xa56f('0x40')],{'$or':_['map'](_0x457c4d,function(_0x4c5eb2){if(_0x4c5eb2[_0xa56f('0x44')]!==_0xa56f('0x45')){var _0x1b9bd2={};_0x1b9bd2[_0x4c5eb2[_0xa56f('0x2f')]]={'$like':'%'+_0x4c845d[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x1b9bd2;}})});}_0x266686=_[_0xa56f('0x43')]({},_0x266686,_0x4c845d['options']);var _0x36463f={'where':_0x266686[_0xa56f('0x40')]};return db[_0xa56f('0x46')][_0xa56f('0x47')](_0x36463f)[_0xa56f('0x28')](function(_0x51a007){_0x5a0b98[_0xa56f('0x47')]=_0x51a007;if(_0x4c845d[_0xa56f('0x35')][_0xa56f('0x48')]){_0x266686[_0xa56f('0x49')]=[{'all':!![]}];}return db[_0xa56f('0x46')][_0xa56f('0x4a')](_0x266686);})[_0xa56f('0x28')](function(_0x34b379){_0x5a0b98['rows']=_0x34b379;return _0x5a0b98;})[_0xa56f('0x28')](respondWithFilteredResult(_0x572136,_0x266686))[_0xa56f('0x4b')](handleError(_0x572136,null));};exports[_0xa56f('0x4c')]=function(_0x8cb9d3,_0x487a86){var _0x55613a={'raw':!![],'where':{'id':_0x8cb9d3['params']['id']}},_0xc9c23a={};_0xc9c23a[_0xa56f('0x34')]=_[_0xa56f('0x36')](db[_0xa56f('0x46')][_0xa56f('0x32')]);_0xc9c23a[_0xa56f('0x35')]=_['keys'](_0x8cb9d3[_0xa56f('0x35')]);_0xc9c23a[_0xa56f('0x37')]=_['intersection'](_0xc9c23a[_0xa56f('0x34')],_0xc9c23a[_0xa56f('0x35')]);_0x55613a[_0xa56f('0x38')]=_['intersection'](_0xc9c23a[_0xa56f('0x34')],qs[_0xa56f('0x3a')](_0x8cb9d3[_0xa56f('0x35')]['fields']));_0x55613a[_0xa56f('0x38')]=_0x55613a[_0xa56f('0x38')][_0xa56f('0x3b')]?_0x55613a[_0xa56f('0x38')]:_0xc9c23a[_0xa56f('0x34')];if(_0x8cb9d3[_0xa56f('0x35')]['includeAll']){_0x55613a[_0xa56f('0x49')]=[{'all':!![]}];}_0x55613a=_[_0xa56f('0x43')]({},_0x55613a,_0x8cb9d3[_0xa56f('0x4d')]);return db[_0xa56f('0x46')]['find'](_0x55613a)[_0xa56f('0x28')](handleEntityNotFound(_0x487a86,null))[_0xa56f('0x28')](respondWithResult(_0x487a86,null))['catch'](handleError(_0x487a86,null));};exports[_0xa56f('0x4e')]=function(_0x1bf597,_0x5c1f2f){return db[_0xa56f('0x46')][_0xa56f('0x4e')](_0x1bf597[_0xa56f('0x4f')],{})[_0xa56f('0x28')](function(_0x26a0c8){var _0x5a8889=_0x1bf597[_0xa56f('0x50')][_0xa56f('0x51')]({'plain':!![]});if(!_0x5a8889)throw new Error(_0xa56f('0x52'));if(_0x5a8889['role']==='user'){var _0x29f5ca=_0x26a0c8[_0xa56f('0x51')]({'plain':!![]});var _0x2d1f24=_0xa56f('0x2a');return db['UserProfileSection'][_0xa56f('0x53')]({'where':{'name':_0x2d1f24,'userProfileId':_0x5a8889[_0xa56f('0x54')]},'raw':!![]})[_0xa56f('0x28')](function(_0x2e07c2){if(_0x2e07c2&&_0x2e07c2[_0xa56f('0x55')]===0x0){return db[_0xa56f('0x2b')]['create']({'name':_0x29f5ca['name'],'resourceId':_0x29f5ca['id'],'type':_0x2e07c2['name'],'sectionId':_0x2e07c2['id']},{})[_0xa56f('0x28')](function(){return _0x26a0c8;});}else{return _0x26a0c8;}})[_0xa56f('0x4b')](function(_0x29a3bb){logger['error'](_0xa56f('0x56'),_0x29a3bb);throw _0x29a3bb;});}return _0x26a0c8;})['then'](respondWithResult(_0x5c1f2f,0xc9))[_0xa56f('0x4b')](handleError(_0x5c1f2f,null));};exports[_0xa56f('0x27')]=function(_0x1dbfec,_0x409187){if(_0x1dbfec[_0xa56f('0x4f')]['id']){delete _0x1dbfec[_0xa56f('0x4f')]['id'];}return db['OpenchannelQueue'][_0xa56f('0x53')]({'where':{'id':_0x1dbfec[_0xa56f('0x57')]['id']}})[_0xa56f('0x28')](handleEntityNotFound(_0x409187,null))[_0xa56f('0x28')](saveUpdates(_0x1dbfec[_0xa56f('0x4f')],null))[_0xa56f('0x28')](respondWithResult(_0x409187,null))[_0xa56f('0x4b')](handleError(_0x409187,null));};exports[_0xa56f('0x29')]=function(_0x486789,_0x1d2912){return db[_0xa56f('0x46')][_0xa56f('0x53')]({'where':{'id':_0x486789[_0xa56f('0x57')]['id']}})[_0xa56f('0x28')](handleEntityNotFound(_0x1d2912,null))[_0xa56f('0x28')](removeEntity(_0x1d2912,null))[_0xa56f('0x4b')](handleError(_0x1d2912,null));};exports[_0xa56f('0x58')]=function(_0x428371,_0x376643){return db['OpenchannelQueue'][_0xa56f('0x58')]()[_0xa56f('0x28')](respondWithResult(_0x376643,null))['catch'](handleError(_0x376643,null));};exports[_0xa56f('0x59')]=function(_0xfae319,_0x353a7b,_0x1a618f){var _0x1ccbdb={'raw':!![],'where':{}},_0x3a4c49={},_0x369c93;return db[_0xa56f('0x46')][_0xa56f('0x5a')]({'where':{'id':_0xfae319[_0xa56f('0x57')]['id']}})[_0xa56f('0x28')](handleEntityNotFound(_0x353a7b,null))['then'](function(_0x29a570){if(_0x29a570){_0x369c93=_0x29a570[_0xa56f('0x51')]({'plain':!![]});_0x3a4c49['model']=_['keys'](db[_0xa56f('0x5b')][_0xa56f('0x32')]);_0x3a4c49[_0xa56f('0x35')]=_[_0xa56f('0x36')](_0xfae319[_0xa56f('0x35')]);_0x3a4c49[_0xa56f('0x37')]=_[_0xa56f('0x39')](_0x3a4c49[_0xa56f('0x34')],_0x3a4c49[_0xa56f('0x35')]);_0x1ccbdb['attributes']=_[_0xa56f('0x39')](_0x3a4c49[_0xa56f('0x34')],qs[_0xa56f('0x3a')](_0xfae319[_0xa56f('0x35')][_0xa56f('0x3a')]));_0x1ccbdb[_0xa56f('0x38')]=_0x1ccbdb[_0xa56f('0x38')][_0xa56f('0x3b')]?_0x1ccbdb[_0xa56f('0x38')]:_0x3a4c49[_0xa56f('0x34')];if(!_0xfae319[_0xa56f('0x35')]['hasOwnProperty'](_0xa56f('0x3d'))){_0x1ccbdb['limit']=qs[_0xa56f('0x22')](_0xfae319[_0xa56f('0x35')][_0xa56f('0x22')]);_0x1ccbdb[_0xa56f('0x21')]=qs['offset'](_0xfae319[_0xa56f('0x35')][_0xa56f('0x21')]);}_0x1ccbdb[_0xa56f('0x3e')]=qs['sort'](_0xfae319[_0xa56f('0x35')][_0xa56f('0x3f')]);_0x1ccbdb[_0xa56f('0x40')]=qs['filters'](_['pick'](_0xfae319[_0xa56f('0x35')],_0x3a4c49[_0xa56f('0x37')]));_0x1ccbdb[_0xa56f('0x40')][_0xa56f('0x5c')]=_0x29a570['id'];if(_0xfae319[_0xa56f('0x35')]['filter']){_0x1ccbdb[_0xa56f('0x40')]=_[_0xa56f('0x43')](_0x1ccbdb['where'],{'$or':_['map'](_0x1ccbdb['attributes'],function(_0xb24d9e){var _0x1c8b25={};_0x1c8b25[_0xb24d9e]={'$like':'%'+_0xfae319[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x1c8b25;})});}_0x1ccbdb=_[_0xa56f('0x43')]({},_0x1ccbdb,_0xfae319[_0xa56f('0x4d')]);return db[_0xa56f('0x5b')][_0xa56f('0x4a')](_0x1ccbdb);}})[_0xa56f('0x28')](function(_0x4d2d79){if(_0x4d2d79){return db[_0xa56f('0x5d')][_0xa56f('0x5e')]({'where':{'id':_[_0xa56f('0x31')](_0x4d2d79,_0xa56f('0x5f')),'role':_0xa56f('0x60')},'attributes':['id','name',_0xa56f('0x61'),'updatedAt',_0xa56f('0x62')]});}})[_0xa56f('0x28')](function(_0x3781bc){if(_0x3781bc){return{'count':_0x3781bc[_0xa56f('0x47')],'rows':_['map'](_0x3781bc[_0xa56f('0x63')],function(_0xbec1ae){return{'membername':_0xbec1ae[_0xa56f('0x2f')],'UserId':_0xbec1ae['id'],'queue_name':_0x369c93[_0xa56f('0x2f')],'OpenchannelQueueId':_0x369c93['id'],'interface':util[_0xa56f('0x64')](_0xa56f('0x65'),_0xa56f('0x66'),_0xbec1ae['name']),'penalty':0x0,'paused':_0xbec1ae[_0xa56f('0x61')],'createdAt':_0xbec1ae[_0xa56f('0x62')],'updatedAt':_0xbec1ae[_0xa56f('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x353a7b,_0x1ccbdb))[_0xa56f('0x4b')](handleError(_0x353a7b,null));};exports[_0xa56f('0x68')]=function(_0x4ccc8f,_0x435194,_0x19db30){var _0x465547={};var _0x3aa838={};var _0x2adeeb;var _0x218d45;return db['OpenchannelQueue'][_0xa56f('0x5a')]({'where':{'id':_0x4ccc8f[_0xa56f('0x57')]['id']}})[_0xa56f('0x28')](handleEntityNotFound(_0x435194,null))[_0xa56f('0x28')](function(_0x41ac7b){if(_0x41ac7b){_0x2adeeb=_0x41ac7b;_0x3aa838[_0xa56f('0x34')]=_[_0xa56f('0x36')](db[_0xa56f('0x69')][_0xa56f('0x32')]);_0x3aa838[_0xa56f('0x35')]=_['keys'](_0x4ccc8f[_0xa56f('0x35')]);_0x3aa838[_0xa56f('0x37')]=_['intersection'](_0x3aa838[_0xa56f('0x34')],_0x3aa838[_0xa56f('0x35')]);_0x465547['attributes']=_[_0xa56f('0x39')](_0x3aa838[_0xa56f('0x34')],qs[_0xa56f('0x3a')](_0x4ccc8f['query'][_0xa56f('0x3a')]));_0x465547[_0xa56f('0x38')]=_0x465547[_0xa56f('0x38')]['length']?_0x465547[_0xa56f('0x38')]:_0x3aa838[_0xa56f('0x34')];_0x465547[_0xa56f('0x3e')]=qs[_0xa56f('0x3f')](_0x4ccc8f[_0xa56f('0x35')][_0xa56f('0x3f')]);_0x465547[_0xa56f('0x40')]=qs[_0xa56f('0x37')](_[_0xa56f('0x41')](_0x4ccc8f['query'],_0x3aa838[_0xa56f('0x37')]));if(_0x4ccc8f[_0xa56f('0x35')][_0xa56f('0x42')]){_0x465547[_0xa56f('0x40')]=_[_0xa56f('0x43')](_0x465547[_0xa56f('0x40')],{'$or':_['map'](_0x465547[_0xa56f('0x38')],function(_0x49105c){var _0x32984a={};_0x32984a[_0x49105c]={'$like':'%'+_0x4ccc8f[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x32984a;})});}_0x465547=_[_0xa56f('0x43')]({},_0x465547,_0x4ccc8f[_0xa56f('0x4d')]);return _0x2adeeb[_0xa56f('0x68')](_0x465547);}})[_0xa56f('0x28')](function(_0x33a57c){if(_0x33a57c){_0x218d45=_0x33a57c[_0xa56f('0x3b')];if(!_0x4ccc8f[_0xa56f('0x35')][_0xa56f('0x3c')](_0xa56f('0x3d'))){_0x465547[_0xa56f('0x22')]=qs['limit'](_0x4ccc8f[_0xa56f('0x35')][_0xa56f('0x22')]);_0x465547['offset']=qs['offset'](_0x4ccc8f[_0xa56f('0x35')][_0xa56f('0x21')]);}return _0x2adeeb[_0xa56f('0x68')](_0x465547);}})[_0xa56f('0x28')](function(_0x1fcdb3){if(_0x1fcdb3){return _0x1fcdb3?{'count':_0x218d45,'rows':_0x1fcdb3}:null;}})['then'](respondWithResult(_0x435194,null))['catch'](handleError(_0x435194,null));};exports[_0xa56f('0x6a')]=function(_0x2f1cb3,_0x576173,_0x2b66a9){var _0x4367d9=_0x2f1cb3[_0xa56f('0x4f')][_0xa56f('0x6b')];return db[_0xa56f('0x69')][_0xa56f('0x4a')]({'where':{'id':_0x4367d9},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa56f('0x6c'),'attributes':['id','name',_0xa56f('0x6d'),'voicePause',_0xa56f('0x6e')],'raw':!![]}]})['then'](function(_0x455789){if(_0x455789){var _0x3c719c=_[_0xa56f('0x6f')](_0x455789,function(_0x11230e){var _0x14e48a=_0x11230e[_0xa56f('0x51')]({'plain':!![]});return _0x14e48a[_0xa56f('0x6c')];});return db[_0xa56f('0x46')]['find']({'where':{'id':_0x2f1cb3[_0xa56f('0x57')]['id']}})[_0xa56f('0x28')](function(_0x44f1de){return db[_0xa56f('0x70')][_0xa56f('0x71')](function(_0xa0df16){return _0x44f1de[_0xa56f('0x6a')](_0x4367d9,{'transaction':_0xa0df16})['then'](function(){return BPromise['each'](_0x3c719c,function(_0x242ab7){return db[_0xa56f('0x5b')]['findOrCreate']({'where':{'UserId':_0x242ab7['id'],'OpenchannelQueueId':_0x2f1cb3[_0xa56f('0x57')]['id']},'transaction':_0xa0df16});});})[_0xa56f('0x28')](function(){_0x3c719c[_0xa56f('0x72')](function(_0x2ca616){socket[_0xa56f('0x73')](_0xa56f('0x74'),{'UserId':_0x2ca616['id'],'OpenchannelQueueId':_0x44f1de['id']});});});});});}})[_0xa56f('0x28')](respondWithStatusCode(_0x576173,null))[_0xa56f('0x4b')](handleError(_0x576173,null));};exports[_0xa56f('0x75')]=function(_0x4d5a62,_0x1c87ac,_0x543dc1){return db['Team'][_0xa56f('0x4a')]({'where':{'id':_0x4d5a62[_0xa56f('0x35')][_0xa56f('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xa56f('0x5d')],'as':_0xa56f('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1c87ac,null))[_0xa56f('0x28')](function(_0x33cac5){var _0x1ab4ca=_[_0xa56f('0x31')](_0x33cac5,'id');var _0x2130d0=[];var _0x3c789a=[];var _0xd89fbe=squel['select']();_0xd89fbe[_0xa56f('0x76')](_0xa56f('0x77'))['from'](_0xa56f('0x78'),'tq')[_0xa56f('0x79')]('user_has_teams','ut',_0xa56f('0x7a'))[_0xa56f('0x40')](_0xa56f('0x7b'),_0x4d5a62['params']['id']);for(var _0x74f453=0x0;_0x74f453<_0x33cac5[_0xa56f('0x3b')];_0x74f453+=0x1){let _0x126f2d=_0x33cac5[_0x74f453];for(var _0x44fffc=0x0;_0x44fffc<_0x126f2d[_0xa56f('0x6c')][_0xa56f('0x3b')];_0x44fffc+=0x1){let _0x2c039c=_0x126f2d[_0xa56f('0x6c')][_0x44fffc];var _0x2ba596=_0xd89fbe[_0xa56f('0x7c')]();_0x2ba596[_0xa56f('0x40')](_0xa56f('0x7d'),_0x2c039c['id']);_0x3c789a['push'](db['sequelize'][_0xa56f('0x35')](_0x2ba596[_0xa56f('0x7e')](),{'type':db[_0xa56f('0x70')][_0xa56f('0x7f')][_0xa56f('0x80')]})[_0xa56f('0x28')](function(_0x2fb1cb){if(_0x2fb1cb[_0xa56f('0x3b')]===0x1){return _0x2c039c['id'];}else{var _0x3e580b=_[_0xa56f('0x81')](_[_0xa56f('0x31')](_0x2fb1cb,_0xa56f('0x82')),function(_0x3736f8){return _[_0xa56f('0x83')](_0x1ab4ca,_0x3736f8);});if(_0x3e580b){return _0x2c039c['id'];}}}));}}return BPromise[_0xa56f('0x84')](_0x3c789a)[_0xa56f('0x28')](function(_0x3ab204){_0x2130d0=_(_0x2130d0)[_0xa56f('0x85')](_0x3ab204)['compact']()[_0xa56f('0x86')]();return db[_0xa56f('0x46')]['find']({'where':{'id':_0x4d5a62['params']['id']}})[_0xa56f('0x28')](function(_0x50b1ce){return db[_0xa56f('0x70')][_0xa56f('0x71')](function(_0x504439){return _0x50b1ce[_0xa56f('0x75')](_0x4d5a62[_0xa56f('0x35')][_0xa56f('0x6b')],{'transaction':_0x504439})[_0xa56f('0x28')](function(){if(!_[_0xa56f('0x87')](_0x2130d0)){return _0x50b1ce[_0xa56f('0x88')](_0x2130d0,{'transaction':_0x504439});}})[_0xa56f('0x28')](function(){_0x2130d0[_0xa56f('0x72')](function(_0x195db2){socket[_0xa56f('0x73')](_0xa56f('0x89'),{'UserId':_0x195db2,'OpenchannelQueueId':_0x50b1ce['id']});});});});});});})['then'](respondWithStatusCode(_0x1c87ac,null))[_0xa56f('0x4b')](handleError(_0x1c87ac,null));};exports['addAgents']=function(_0x370e71,_0xd13df7,_0x37bf7d){return db['OpenchannelQueue'][_0xa56f('0x53')]({'where':{'id':_0x370e71['params']['id']}})['then'](handleEntityNotFound(_0xd13df7,null))['then'](function(_0x74f3f3){if(_0x74f3f3){return _0x74f3f3[_0xa56f('0x8a')](_0x370e71['body'][_0xa56f('0x6b')],_['omit'](_0x370e71[_0xa56f('0x4f')],['ids','id'])||{})[_0xa56f('0x8b')](function(_0xc3c9e3){for(var _0x218530=0x0;_0x218530<_0x370e71[_0xa56f('0x4f')][_0xa56f('0x6b')]['length'];_0x218530+=0x1){socket[_0xa56f('0x73')](_0xa56f('0x74'),{'UserId':_0x370e71[_0xa56f('0x4f')]['ids'][_0x218530],'OpenchannelQueueId':_0x370e71[_0xa56f('0x57')]['id']});}return _0xc3c9e3;});}})['then'](respondWithResult(_0xd13df7,null))[_0xa56f('0x4b')](handleError(_0xd13df7,null));};exports['removeAgents']=function(_0x4a4078,_0x46f3aa,_0x4e2f6c){return db[_0xa56f('0x46')][_0xa56f('0x53')]({'where':{'id':_0x4a4078[_0xa56f('0x57')]['id']}})[_0xa56f('0x28')](handleEntityNotFound(_0x46f3aa,null))[_0xa56f('0x28')](function(_0x10bf7f){if(_0x10bf7f){return _0x10bf7f['removeAgents'](_0x4a4078[_0xa56f('0x35')]['ids'])[_0xa56f('0x28')](function(){if(_[_0xa56f('0x8c')](_0x4a4078['query'][_0xa56f('0x6b')])){for(var _0x317d1a=0x0;_0x317d1a<_0x4a4078[_0xa56f('0x35')][_0xa56f('0x6b')][_0xa56f('0x3b')];_0x317d1a+=0x1){socket['emit'](_0xa56f('0x89'),{'UserId':Number(_0x4a4078['query'][_0xa56f('0x6b')][_0x317d1a]),'OpenchannelQueueId':Number(_0x4a4078['params']['id'])});}}else{socket[_0xa56f('0x73')](_0xa56f('0x89'),{'UserId':Number(_0x4a4078['query'][_0xa56f('0x6b')]),'OpenchannelQueueId':Number(_0x4a4078['params']['id'])});}});}})[_0xa56f('0x28')](respondWithStatusCode(_0x46f3aa,null))['catch'](handleError(_0x46f3aa,null));};exports[_0xa56f('0x8d')]=function(_0x283871,_0x29ff31,_0xf1139f){var _0x3cc178={};var _0x1d796a={};var _0x4c5267;var _0x1488d8;return db[_0xa56f('0x46')]['findOne']({'where':{'id':_0x283871['params']['id']}})[_0xa56f('0x28')](handleEntityNotFound(_0x29ff31,null))[_0xa56f('0x28')](function(_0x5e9a1c){if(_0x5e9a1c){_0x4c5267=_0x5e9a1c;_0x1d796a['model']=_[_0xa56f('0x36')](db[_0xa56f('0x5d')][_0xa56f('0x32')]);_0x1d796a[_0xa56f('0x35')]=_[_0xa56f('0x36')](_0x283871[_0xa56f('0x35')]);_0x1d796a[_0xa56f('0x37')]=_[_0xa56f('0x39')](_0x1d796a[_0xa56f('0x34')],_0x1d796a['query']);_0x3cc178[_0xa56f('0x38')]=_[_0xa56f('0x39')](_0x1d796a[_0xa56f('0x34')],qs[_0xa56f('0x3a')](_0x283871[_0xa56f('0x35')][_0xa56f('0x3a')]));_0x3cc178[_0xa56f('0x38')]=_0x3cc178[_0xa56f('0x38')][_0xa56f('0x3b')]?_0x3cc178[_0xa56f('0x38')]:_0x1d796a[_0xa56f('0x34')];_0x3cc178[_0xa56f('0x3e')]=qs[_0xa56f('0x3f')](_0x283871['query'][_0xa56f('0x3f')]);_0x3cc178['where']=qs[_0xa56f('0x37')](_['pick'](_0x283871[_0xa56f('0x35')],_0x1d796a[_0xa56f('0x37')]));if(_0x283871[_0xa56f('0x35')]['filter']){_0x3cc178[_0xa56f('0x40')]=_[_0xa56f('0x43')](_0x3cc178[_0xa56f('0x40')],{'$or':_[_0xa56f('0x31')](_0x3cc178[_0xa56f('0x38')],function(_0x2d31e7){var _0x288c61={};_0x288c61[_0x2d31e7]={'$like':'%'+_0x283871[_0xa56f('0x35')][_0xa56f('0x42')]+'%'};return _0x288c61;})});}_0x3cc178=_[_0xa56f('0x43')]({},_0x3cc178,_0x283871[_0xa56f('0x4d')]);return _0x4c5267[_0xa56f('0x8d')](_0x3cc178);}})[_0xa56f('0x28')](function(_0x3d9bf4){if(_0x3d9bf4){_0x1488d8=_0x3d9bf4[_0xa56f('0x3b')];if(!_0x283871[_0xa56f('0x35')][_0xa56f('0x3c')]('nolimit')){_0x3cc178[_0xa56f('0x22')]=qs[_0xa56f('0x22')](_0x283871[_0xa56f('0x35')][_0xa56f('0x22')]);_0x3cc178[_0xa56f('0x21')]=qs[_0xa56f('0x21')](_0x283871['query'][_0xa56f('0x21')]);}return _0x4c5267[_0xa56f('0x8d')](_0x3cc178);}})[_0xa56f('0x28')](function(_0x38f95a){if(_0x38f95a){return _0x38f95a?{'count':_0x1488d8,'rows':_0x38f95a}:null;}})['then'](respondWithResult(_0x29ff31,null))[_0xa56f('0x4b')](handleError(_0x29ff31,null));}; \ No newline at end of file +var _0x8b0f=['push','sequelize','toString','SELECT','every','all','compact','value','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','status','offset','Content-Range','json','apply','save','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','count','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','openchannelPause','createdAt','%s/%s','SIP','length','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','removeTeams','Team','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8b0f,0x121));var _0xf8b0=function(_0x4df649,_0x493d45){_0x4df649=_0x4df649-0x0;var _0x1ea915=_0x8b0f[_0x4df649];return _0x1ea915;};'use strict';var pdf=require(_0xf8b0('0x0'));var emlformat=require(_0xf8b0('0x1'));var rimraf=require(_0xf8b0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8b0('0x3'));var rp=require(_0xf8b0('0x4'));var moment=require(_0xf8b0('0x5'));var BPromise=require(_0xf8b0('0x6'));var Mustache=require(_0xf8b0('0x7'));var util=require(_0xf8b0('0x8'));var path=require(_0xf8b0('0x9'));var sox=require(_0xf8b0('0xa'));var csv=require(_0xf8b0('0xb'));var ejs=require(_0xf8b0('0xc'));var fs=require('fs');var _=require(_0xf8b0('0xd'));var squel=require(_0xf8b0('0xe'));var crypto=require('crypto');var jsforce=require(_0xf8b0('0xf'));var deskjs=require(_0xf8b0('0x10'));var toCsv=require(_0xf8b0('0xb'));var querystring=require('querystring');var Papa=require(_0xf8b0('0x11'));var Redis=require(_0xf8b0('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf8b0('0x13'));var hardwareService=require(_0xf8b0('0x14'));var logger=require(_0xf8b0('0x15'))(_0xf8b0('0x16'));var utils=require(_0xf8b0('0x17'));var config=require(_0xf8b0('0x18'));var db=require('../../mysqldb')['db'];config[_0xf8b0('0x19')]=_['defaults'](config[_0xf8b0('0x19')],{'host':_0xf8b0('0x1a'),'port':0x18eb});var socket=require(_0xf8b0('0x1b'))(new Redis(config[_0xf8b0('0x19')]));require('./openchannelQueue.socket')[_0xf8b0('0x1c')](socket);function respondWithStatusCode(_0x192b58,_0x2a206e){_0x2a206e=_0x2a206e||0xcc;return function(_0x29c2d1){if(_0x29c2d1){return _0x192b58[_0xf8b0('0x1d')](_0x2a206e);}return _0x192b58['status'](_0x2a206e)[_0xf8b0('0x1e')]();};}function respondWithResult(_0x113d66,_0x3156b3){_0x3156b3=_0x3156b3||0xc8;return function(_0xaed5de){if(_0xaed5de){return _0x113d66[_0xf8b0('0x1f')](_0x3156b3)['json'](_0xaed5de);}};}function respondWithFilteredResult(_0x25d51e,_0x4f0878){return function(_0x52ba10){if(_0x52ba10){var _0xa6d738=_0x52ba10['count'],_0x5940ff=_0x4f0878[_0xf8b0('0x20')],_0xb72ab8=_0x4f0878[_0xf8b0('0x20')]+_0x4f0878['limit'],_0xfe3e2f;if(_0xb72ab8>=_0xa6d738){_0xb72ab8=_0xa6d738;_0xfe3e2f=0xc8;}else{_0xfe3e2f=0xce;}_0x25d51e[_0xf8b0('0x1f')](_0xfe3e2f);return _0x25d51e['set'](_0xf8b0('0x21'),_0x5940ff+'-'+_0xb72ab8+'/'+_0xa6d738)[_0xf8b0('0x22')](_0x52ba10);}return null;};}function patchUpdates(_0x5ee298){return function(_0x33c766){try{jsonpatch[_0xf8b0('0x23')](_0x33c766,_0x5ee298,!![]);}catch(_0xc6ef77){return BPromise['reject'](_0xc6ef77);}return _0x33c766[_0xf8b0('0x24')]();};}function saveUpdates(_0x10f9d8,_0x5c9c2b){return function(_0x5ad5d7){if(_0x5ad5d7){return _0x5ad5d7['update'](_0x10f9d8)[_0xf8b0('0x25')](function(_0x405aa0){return _0x405aa0;});}return null;};}function removeEntity(_0x207d9c,_0x659af9){return function(_0x3f4d65){if(_0x3f4d65){return _0x3f4d65[_0xf8b0('0x26')]()['then'](function(){var _0x242bad=_0x3f4d65[_0xf8b0('0x27')]({'plain':!![]});var _0x13a32b=_0xf8b0('0x28');return db[_0xf8b0('0x29')][_0xf8b0('0x26')]({'where':{'type':_0x13a32b,'resourceId':_0x242bad['id']}})['then'](function(){return _0x3f4d65;});})[_0xf8b0('0x25')](function(){_0x207d9c[_0xf8b0('0x1f')](0xcc)[_0xf8b0('0x1e')]();});}};}function handleEntityNotFound(_0x48d249,_0x5d29e0){return function(_0x249b2c){if(!_0x249b2c){_0x48d249[_0xf8b0('0x1d')](0x194);}return _0x249b2c;};}function handleError(_0x57a500,_0x3bd535){_0x3bd535=_0x3bd535||0x1f4;return function(_0x373abf){logger[_0xf8b0('0x2a')](_0x373abf[_0xf8b0('0x2b')]);if(_0x373abf['name']){delete _0x373abf[_0xf8b0('0x2c')];}_0x57a500['status'](_0x3bd535)['send'](_0x373abf);};}exports[_0xf8b0('0x2d')]=function(_0x4982c9,_0x55b496){var _0x4e883c={},_0x3e0eb3={},_0x1598ad={'count':0x0,'rows':[]};var _0x189342=_[_0xf8b0('0x2e')](db[_0xf8b0('0x2f')][_0xf8b0('0x30')],function(_0x126da0){return{'name':_0x126da0[_0xf8b0('0x31')],'type':_0x126da0[_0xf8b0('0x32')]['key']};});_0x3e0eb3[_0xf8b0('0x33')]=_[_0xf8b0('0x2e')](_0x189342,'name');_0x3e0eb3['query']=_[_0xf8b0('0x34')](_0x4982c9[_0xf8b0('0x35')]);_0x3e0eb3[_0xf8b0('0x36')]=_[_0xf8b0('0x37')](_0x3e0eb3[_0xf8b0('0x33')],_0x3e0eb3['query']);_0x4e883c['attributes']=_[_0xf8b0('0x37')](_0x3e0eb3[_0xf8b0('0x33')],qs[_0xf8b0('0x38')](_0x4982c9[_0xf8b0('0x35')][_0xf8b0('0x38')]));_0x4e883c[_0xf8b0('0x39')]=_0x4e883c[_0xf8b0('0x39')]['length']?_0x4e883c[_0xf8b0('0x39')]:_0x3e0eb3[_0xf8b0('0x33')];if(!_0x4982c9[_0xf8b0('0x35')][_0xf8b0('0x3a')](_0xf8b0('0x3b'))){_0x4e883c[_0xf8b0('0x3c')]=qs[_0xf8b0('0x3c')](_0x4982c9['query']['limit']);_0x4e883c['offset']=qs[_0xf8b0('0x20')](_0x4982c9['query']['offset']);}_0x4e883c[_0xf8b0('0x3d')]=qs[_0xf8b0('0x3e')](_0x4982c9[_0xf8b0('0x35')][_0xf8b0('0x3e')]);_0x4e883c[_0xf8b0('0x3f')]=qs[_0xf8b0('0x36')](_[_0xf8b0('0x40')](_0x4982c9[_0xf8b0('0x35')],_0x3e0eb3[_0xf8b0('0x36')]),_0x189342);if(_0x4982c9['query']['filter']){_0x4e883c[_0xf8b0('0x3f')]=_['merge'](_0x4e883c[_0xf8b0('0x3f')],{'$or':_[_0xf8b0('0x2e')](_0x189342,function(_0x37ab4f){if(_0x37ab4f['type']!=='VIRTUAL'){var _0x51c8c9={};_0x51c8c9[_0x37ab4f[_0xf8b0('0x2c')]]={'$like':'%'+_0x4982c9[_0xf8b0('0x35')][_0xf8b0('0x41')]+'%'};return _0x51c8c9;}})});}_0x4e883c=_[_0xf8b0('0x42')]({},_0x4e883c,_0x4982c9['options']);var _0x528cc7={'where':_0x4e883c[_0xf8b0('0x3f')]};return db['OpenchannelQueue']['count'](_0x528cc7)[_0xf8b0('0x25')](function(_0x4f89c4){_0x1598ad[_0xf8b0('0x43')]=_0x4f89c4;if(_0x4982c9['query'][_0xf8b0('0x44')]){_0x4e883c['include']=[{'all':!![]}];}return db[_0xf8b0('0x2f')][_0xf8b0('0x45')](_0x4e883c);})[_0xf8b0('0x25')](function(_0x143c27){_0x1598ad[_0xf8b0('0x46')]=_0x143c27;return _0x1598ad;})['then'](respondWithFilteredResult(_0x55b496,_0x4e883c))['catch'](handleError(_0x55b496,null));};exports[_0xf8b0('0x47')]=function(_0x1fb7c2,_0x511089){var _0xa164e4={'raw':!![],'where':{'id':_0x1fb7c2[_0xf8b0('0x48')]['id']}},_0x5e2dbb={};_0x5e2dbb['model']=_[_0xf8b0('0x34')](db[_0xf8b0('0x2f')][_0xf8b0('0x30')]);_0x5e2dbb[_0xf8b0('0x35')]=_['keys'](_0x1fb7c2['query']);_0x5e2dbb['filters']=_[_0xf8b0('0x37')](_0x5e2dbb['model'],_0x5e2dbb[_0xf8b0('0x35')]);_0xa164e4[_0xf8b0('0x39')]=_[_0xf8b0('0x37')](_0x5e2dbb[_0xf8b0('0x33')],qs[_0xf8b0('0x38')](_0x1fb7c2[_0xf8b0('0x35')][_0xf8b0('0x38')]));_0xa164e4[_0xf8b0('0x39')]=_0xa164e4[_0xf8b0('0x39')]['length']?_0xa164e4['attributes']:_0x5e2dbb['model'];if(_0x1fb7c2[_0xf8b0('0x35')][_0xf8b0('0x44')]){_0xa164e4[_0xf8b0('0x49')]=[{'all':!![]}];}_0xa164e4=_['merge']({},_0xa164e4,_0x1fb7c2[_0xf8b0('0x4a')]);return db[_0xf8b0('0x2f')][_0xf8b0('0x4b')](_0xa164e4)[_0xf8b0('0x25')](handleEntityNotFound(_0x511089,null))[_0xf8b0('0x25')](respondWithResult(_0x511089,null))[_0xf8b0('0x4c')](handleError(_0x511089,null));};exports[_0xf8b0('0x4d')]=function(_0x2a1aeb,_0x5afd19){return db[_0xf8b0('0x2f')][_0xf8b0('0x4d')](_0x2a1aeb[_0xf8b0('0x4e')],{})[_0xf8b0('0x25')](function(_0x1edae2){var _0x2e4e10=_0x2a1aeb[_0xf8b0('0x4f')]['get']({'plain':!![]});if(!_0x2e4e10)throw new Error(_0xf8b0('0x50'));if(_0x2e4e10[_0xf8b0('0x51')]==='user'){var _0x1a8915=_0x1edae2[_0xf8b0('0x27')]({'plain':!![]});var _0x34f99e=_0xf8b0('0x28');return db['UserProfileSection'][_0xf8b0('0x4b')]({'where':{'name':_0x34f99e,'userProfileId':_0x2e4e10[_0xf8b0('0x52')]},'raw':!![]})[_0xf8b0('0x25')](function(_0x23f8e8){if(_0x23f8e8&&_0x23f8e8[_0xf8b0('0x53')]===0x0){return db[_0xf8b0('0x29')][_0xf8b0('0x4d')]({'name':_0x1a8915[_0xf8b0('0x2c')],'resourceId':_0x1a8915['id'],'type':_0x23f8e8[_0xf8b0('0x2c')],'sectionId':_0x23f8e8['id']},{})['then'](function(){return _0x1edae2;});}else{return _0x1edae2;}})[_0xf8b0('0x4c')](function(_0x2ec1c1){logger['error'](_0xf8b0('0x54'),_0x2ec1c1);throw _0x2ec1c1;});}return _0x1edae2;})['then'](respondWithResult(_0x5afd19,0xc9))[_0xf8b0('0x4c')](handleError(_0x5afd19,null));};exports[_0xf8b0('0x55')]=function(_0x58331d,_0xa0b3f4){if(_0x58331d[_0xf8b0('0x4e')]['id']){delete _0x58331d[_0xf8b0('0x4e')]['id'];}return db[_0xf8b0('0x2f')][_0xf8b0('0x4b')]({'where':{'id':_0x58331d['params']['id']}})[_0xf8b0('0x25')](handleEntityNotFound(_0xa0b3f4,null))[_0xf8b0('0x25')](saveUpdates(_0x58331d['body'],null))[_0xf8b0('0x25')](respondWithResult(_0xa0b3f4,null))[_0xf8b0('0x4c')](handleError(_0xa0b3f4,null));};exports[_0xf8b0('0x26')]=function(_0x411ba7,_0x2c6f18){return db['OpenchannelQueue'][_0xf8b0('0x4b')]({'where':{'id':_0x411ba7[_0xf8b0('0x48')]['id']}})[_0xf8b0('0x25')](handleEntityNotFound(_0x2c6f18,null))[_0xf8b0('0x25')](removeEntity(_0x2c6f18,null))[_0xf8b0('0x4c')](handleError(_0x2c6f18,null));};exports[_0xf8b0('0x56')]=function(_0x3733f8,_0x3a4fa0){return db['OpenchannelQueue'][_0xf8b0('0x56')]()[_0xf8b0('0x25')](respondWithResult(_0x3a4fa0,null))[_0xf8b0('0x4c')](handleError(_0x3a4fa0,null));};exports[_0xf8b0('0x57')]=function(_0x27c843,_0x37c532,_0x37dd26){var _0x26b495={'raw':!![],'where':{}},_0x1be71a={},_0x42e941;return db[_0xf8b0('0x2f')][_0xf8b0('0x58')]({'where':{'id':_0x27c843[_0xf8b0('0x48')]['id']}})[_0xf8b0('0x25')](handleEntityNotFound(_0x37c532,null))['then'](function(_0x2c42fe){if(_0x2c42fe){_0x42e941=_0x2c42fe[_0xf8b0('0x27')]({'plain':!![]});_0x1be71a[_0xf8b0('0x33')]=_[_0xf8b0('0x34')](db[_0xf8b0('0x59')]['rawAttributes']);_0x1be71a[_0xf8b0('0x35')]=_['keys'](_0x27c843[_0xf8b0('0x35')]);_0x1be71a['filters']=_[_0xf8b0('0x37')](_0x1be71a['model'],_0x1be71a[_0xf8b0('0x35')]);_0x26b495[_0xf8b0('0x39')]=_['intersection'](_0x1be71a[_0xf8b0('0x33')],qs[_0xf8b0('0x38')](_0x27c843['query'][_0xf8b0('0x38')]));_0x26b495['attributes']=_0x26b495[_0xf8b0('0x39')]['length']?_0x26b495[_0xf8b0('0x39')]:_0x1be71a['model'];if(!_0x27c843[_0xf8b0('0x35')][_0xf8b0('0x3a')](_0xf8b0('0x3b'))){_0x26b495[_0xf8b0('0x3c')]=qs[_0xf8b0('0x3c')](_0x27c843[_0xf8b0('0x35')][_0xf8b0('0x3c')]);_0x26b495[_0xf8b0('0x20')]=qs['offset'](_0x27c843[_0xf8b0('0x35')][_0xf8b0('0x20')]);}_0x26b495['order']=qs[_0xf8b0('0x3e')](_0x27c843[_0xf8b0('0x35')]['sort']);_0x26b495[_0xf8b0('0x3f')]=qs[_0xf8b0('0x36')](_[_0xf8b0('0x40')](_0x27c843[_0xf8b0('0x35')],_0x1be71a['filters']));_0x26b495[_0xf8b0('0x3f')][_0xf8b0('0x5a')]=_0x2c42fe['id'];if(_0x27c843[_0xf8b0('0x35')][_0xf8b0('0x41')]){_0x26b495[_0xf8b0('0x3f')]=_['merge'](_0x26b495[_0xf8b0('0x3f')],{'$or':_[_0xf8b0('0x2e')](_0x26b495[_0xf8b0('0x39')],function(_0x37f25e){var _0x3c6430={};_0x3c6430[_0x37f25e]={'$like':'%'+_0x27c843[_0xf8b0('0x35')][_0xf8b0('0x41')]+'%'};return _0x3c6430;})});}_0x26b495=_[_0xf8b0('0x42')]({},_0x26b495,_0x27c843[_0xf8b0('0x4a')]);return db['UserOpenchannelQueue'][_0xf8b0('0x45')](_0x26b495);}})[_0xf8b0('0x25')](function(_0x478421){if(_0x478421){return db[_0xf8b0('0x5b')]['findAndCountAll']({'where':{'id':_[_0xf8b0('0x2e')](_0x478421,'UserId'),'role':'agent'},'attributes':['id',_0xf8b0('0x2c'),_0xf8b0('0x5c'),'updatedAt',_0xf8b0('0x5d')]});}})[_0xf8b0('0x25')](function(_0xa5a9c0){if(_0xa5a9c0){return{'count':_0xa5a9c0[_0xf8b0('0x43')],'rows':_[_0xf8b0('0x2e')](_0xa5a9c0['rows'],function(_0x3b8872){return{'membername':_0x3b8872[_0xf8b0('0x2c')],'UserId':_0x3b8872['id'],'queue_name':_0x42e941[_0xf8b0('0x2c')],'OpenchannelQueueId':_0x42e941['id'],'interface':util['format'](_0xf8b0('0x5e'),_0xf8b0('0x5f'),_0x3b8872[_0xf8b0('0x2c')]),'penalty':0x0,'paused':_0x3b8872['openchannelPause'],'createdAt':_0x3b8872['createdAt'],'updatedAt':_0x3b8872['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf8b0('0x25')](respondWithFilteredResult(_0x37c532,_0x26b495))['catch'](handleError(_0x37c532,null));};exports['getTeams']=function(_0x46614c,_0xa38fef,_0x43edf7){var _0x2dc900={};var _0x3db9ec={};var _0x3ba604;var _0x46b656;return db[_0xf8b0('0x2f')][_0xf8b0('0x58')]({'where':{'id':_0x46614c[_0xf8b0('0x48')]['id']}})[_0xf8b0('0x25')](handleEntityNotFound(_0xa38fef,null))[_0xf8b0('0x25')](function(_0x35ef35){if(_0x35ef35){_0x3ba604=_0x35ef35;_0x3db9ec['model']=_[_0xf8b0('0x34')](db['Team'][_0xf8b0('0x30')]);_0x3db9ec['query']=_[_0xf8b0('0x34')](_0x46614c[_0xf8b0('0x35')]);_0x3db9ec[_0xf8b0('0x36')]=_[_0xf8b0('0x37')](_0x3db9ec[_0xf8b0('0x33')],_0x3db9ec[_0xf8b0('0x35')]);_0x2dc900[_0xf8b0('0x39')]=_[_0xf8b0('0x37')](_0x3db9ec[_0xf8b0('0x33')],qs[_0xf8b0('0x38')](_0x46614c[_0xf8b0('0x35')]['fields']));_0x2dc900[_0xf8b0('0x39')]=_0x2dc900[_0xf8b0('0x39')][_0xf8b0('0x60')]?_0x2dc900[_0xf8b0('0x39')]:_0x3db9ec[_0xf8b0('0x33')];_0x2dc900[_0xf8b0('0x3d')]=qs['sort'](_0x46614c['query'][_0xf8b0('0x3e')]);_0x2dc900[_0xf8b0('0x3f')]=qs[_0xf8b0('0x36')](_['pick'](_0x46614c[_0xf8b0('0x35')],_0x3db9ec[_0xf8b0('0x36')]));if(_0x46614c[_0xf8b0('0x35')][_0xf8b0('0x41')]){_0x2dc900[_0xf8b0('0x3f')]=_[_0xf8b0('0x42')](_0x2dc900[_0xf8b0('0x3f')],{'$or':_[_0xf8b0('0x2e')](_0x2dc900[_0xf8b0('0x39')],function(_0x224831){var _0x27e5fb={};_0x27e5fb[_0x224831]={'$like':'%'+_0x46614c[_0xf8b0('0x35')][_0xf8b0('0x41')]+'%'};return _0x27e5fb;})});}_0x2dc900=_[_0xf8b0('0x42')]({},_0x2dc900,_0x46614c['options']);return _0x3ba604[_0xf8b0('0x61')](_0x2dc900);}})[_0xf8b0('0x25')](function(_0x314399){if(_0x314399){_0x46b656=_0x314399['length'];if(!_0x46614c[_0xf8b0('0x35')][_0xf8b0('0x3a')](_0xf8b0('0x3b'))){_0x2dc900[_0xf8b0('0x3c')]=qs[_0xf8b0('0x3c')](_0x46614c[_0xf8b0('0x35')][_0xf8b0('0x3c')]);_0x2dc900[_0xf8b0('0x20')]=qs[_0xf8b0('0x20')](_0x46614c[_0xf8b0('0x35')][_0xf8b0('0x20')]);}return _0x3ba604[_0xf8b0('0x61')](_0x2dc900);}})[_0xf8b0('0x25')](function(_0x397655){if(_0x397655){return _0x397655?{'count':_0x46b656,'rows':_0x397655}:null;}})[_0xf8b0('0x25')](respondWithResult(_0xa38fef,null))[_0xf8b0('0x4c')](handleError(_0xa38fef,null));};exports[_0xf8b0('0x62')]=function(_0x38172f,_0xe7924d,_0x1200bb){var _0x2de153=_0x38172f[_0xf8b0('0x4e')][_0xf8b0('0x63')];return db['Team'][_0xf8b0('0x45')]({'where':{'id':_0x2de153},'attributes':['id'],'include':[{'model':db[_0xf8b0('0x5b')],'as':_0xf8b0('0x64'),'attributes':['id',_0xf8b0('0x2c'),'online',_0xf8b0('0x65'),_0xf8b0('0x66')],'raw':!![]}]})[_0xf8b0('0x25')](function(_0x450eac){if(_0x450eac){var _0x45368e=_[_0xf8b0('0x67')](_0x450eac,function(_0x4b4e6b){var _0x4498b4=_0x4b4e6b[_0xf8b0('0x27')]({'plain':!![]});return _0x4498b4[_0xf8b0('0x64')];});return db[_0xf8b0('0x2f')]['find']({'where':{'id':_0x38172f[_0xf8b0('0x48')]['id']}})[_0xf8b0('0x25')](function(_0x50b6d8){return db['sequelize'][_0xf8b0('0x68')](function(_0x1f1acb){return _0x50b6d8[_0xf8b0('0x62')](_0x2de153,{'transaction':_0x1f1acb})['then'](function(){return BPromise[_0xf8b0('0x69')](_0x45368e,function(_0x563a96){return db[_0xf8b0('0x59')][_0xf8b0('0x6a')]({'where':{'UserId':_0x563a96['id'],'OpenchannelQueueId':_0x38172f[_0xf8b0('0x48')]['id']},'transaction':_0x1f1acb});});})[_0xf8b0('0x25')](function(){_0x45368e['forEach'](function(_0x50de8d){socket[_0xf8b0('0x6b')]('userOpenchannelQueue:save',{'UserId':_0x50de8d['id'],'OpenchannelQueueId':_0x50b6d8['id']});});});});});}})[_0xf8b0('0x25')](respondWithStatusCode(_0xe7924d,null))[_0xf8b0('0x4c')](handleError(_0xe7924d,null));};exports[_0xf8b0('0x6c')]=function(_0x1d003,_0x1be044,_0x224a0a){return db[_0xf8b0('0x6d')][_0xf8b0('0x45')]({'where':{'id':_0x1d003['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf8b0('0x5b')],'as':_0xf8b0('0x64'),'attributes':['id'],'raw':!![]}]})[_0xf8b0('0x25')](handleEntityNotFound(_0x1be044,null))['then'](function(_0x208e01){var _0x3687fe=_[_0xf8b0('0x2e')](_0x208e01,'id');var _0x1ab441=[];var _0x33ded3=[];var _0x290ccb=squel[_0xf8b0('0x6e')]();_0x290ccb[_0xf8b0('0x6f')](_0xf8b0('0x70'))[_0xf8b0('0x71')](_0xf8b0('0x72'),'tq')[_0xf8b0('0x73')](_0xf8b0('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf8b0('0x3f')]('OpenchannelQueueId\x20=\x20?',_0x1d003[_0xf8b0('0x48')]['id']);for(var _0x2b29d1=0x0;_0x2b29d1<_0x208e01[_0xf8b0('0x60')];_0x2b29d1+=0x1){let _0x4dbe83=_0x208e01[_0x2b29d1];for(var _0x82ea7d=0x0;_0x82ea7d<_0x4dbe83[_0xf8b0('0x64')][_0xf8b0('0x60')];_0x82ea7d+=0x1){let _0x29cd6e=_0x4dbe83['Agents'][_0x82ea7d];var _0x378271=_0x290ccb[_0xf8b0('0x75')]();_0x378271[_0xf8b0('0x3f')](_0xf8b0('0x76'),_0x29cd6e['id']);_0x33ded3[_0xf8b0('0x77')](db[_0xf8b0('0x78')][_0xf8b0('0x35')](_0x378271[_0xf8b0('0x79')](),{'type':db[_0xf8b0('0x78')]['QueryTypes'][_0xf8b0('0x7a')]})[_0xf8b0('0x25')](function(_0x531809){if(_0x531809[_0xf8b0('0x60')]===0x1){return _0x29cd6e['id'];}else{var _0x42f395=_[_0xf8b0('0x7b')](_['map'](_0x531809,'TeamId'),function(_0x229d1b){return _['includes'](_0x3687fe,_0x229d1b);});if(_0x42f395){return _0x29cd6e['id'];}}}));}}return BPromise[_0xf8b0('0x7c')](_0x33ded3)[_0xf8b0('0x25')](function(_0x163658){_0x1ab441=_(_0x1ab441)['union'](_0x163658)[_0xf8b0('0x7d')]()[_0xf8b0('0x7e')]();return db[_0xf8b0('0x2f')][_0xf8b0('0x4b')]({'where':{'id':_0x1d003[_0xf8b0('0x48')]['id']}})[_0xf8b0('0x25')](function(_0x4a802e){return db[_0xf8b0('0x78')][_0xf8b0('0x68')](function(_0x559b9c){return _0x4a802e[_0xf8b0('0x6c')](_0x1d003[_0xf8b0('0x35')]['ids'],{'transaction':_0x559b9c})[_0xf8b0('0x25')](function(){if(!_[_0xf8b0('0x7f')](_0x1ab441)){return _0x4a802e['removeAgents'](_0x1ab441,{'transaction':_0x559b9c});}})[_0xf8b0('0x25')](function(){_0x1ab441[_0xf8b0('0x80')](function(_0x3d6862){socket[_0xf8b0('0x6b')](_0xf8b0('0x81'),{'UserId':_0x3d6862,'OpenchannelQueueId':_0x4a802e['id']});});});});});});})[_0xf8b0('0x25')](respondWithStatusCode(_0x1be044,null))[_0xf8b0('0x4c')](handleError(_0x1be044,null));};exports[_0xf8b0('0x82')]=function(_0x54826f,_0x219479,_0x45bdb8){return db['OpenchannelQueue'][_0xf8b0('0x4b')]({'where':{'id':_0x54826f[_0xf8b0('0x48')]['id']}})[_0xf8b0('0x25')](handleEntityNotFound(_0x219479,null))[_0xf8b0('0x25')](function(_0x333ab8){if(_0x333ab8){return _0x333ab8[_0xf8b0('0x82')](_0x54826f[_0xf8b0('0x4e')][_0xf8b0('0x63')],_[_0xf8b0('0x83')](_0x54826f['body'],[_0xf8b0('0x63'),'id'])||{})[_0xf8b0('0x84')](function(_0x121ae2){for(var _0x467d00=0x0;_0x467d00<_0x54826f[_0xf8b0('0x4e')]['ids'][_0xf8b0('0x60')];_0x467d00+=0x1){socket[_0xf8b0('0x6b')](_0xf8b0('0x85'),{'UserId':_0x54826f['body'][_0xf8b0('0x63')][_0x467d00],'OpenchannelQueueId':_0x54826f[_0xf8b0('0x48')]['id']});}return _0x121ae2;});}})[_0xf8b0('0x25')](respondWithResult(_0x219479,null))[_0xf8b0('0x4c')](handleError(_0x219479,null));};exports[_0xf8b0('0x86')]=function(_0x40374c,_0x1a2c1d,_0x234c2b){return db[_0xf8b0('0x2f')][_0xf8b0('0x4b')]({'where':{'id':_0x40374c[_0xf8b0('0x48')]['id']}})[_0xf8b0('0x25')](handleEntityNotFound(_0x1a2c1d,null))[_0xf8b0('0x25')](function(_0x2e36eb){if(_0x2e36eb){return _0x2e36eb[_0xf8b0('0x86')](_0x40374c[_0xf8b0('0x35')]['ids'])[_0xf8b0('0x25')](function(){if(_['isArray'](_0x40374c[_0xf8b0('0x35')][_0xf8b0('0x63')])){for(var _0x4c7f35=0x0;_0x4c7f35<_0x40374c['query']['ids']['length'];_0x4c7f35+=0x1){socket[_0xf8b0('0x6b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x40374c[_0xf8b0('0x35')]['ids'][_0x4c7f35]),'OpenchannelQueueId':Number(_0x40374c[_0xf8b0('0x48')]['id'])});}}else{socket[_0xf8b0('0x6b')](_0xf8b0('0x81'),{'UserId':Number(_0x40374c[_0xf8b0('0x35')][_0xf8b0('0x63')]),'OpenchannelQueueId':Number(_0x40374c[_0xf8b0('0x48')]['id'])});}});}})[_0xf8b0('0x25')](respondWithStatusCode(_0x1a2c1d,null))[_0xf8b0('0x4c')](handleError(_0x1a2c1d,null));};exports[_0xf8b0('0x87')]=function(_0x546303,_0x3e0eaa,_0x22b469){var _0x437040={};var _0x4cbcc2={};var _0x2beae9;var _0x28c3a1;return db[_0xf8b0('0x2f')]['findOne']({'where':{'id':_0x546303[_0xf8b0('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e0eaa,null))['then'](function(_0x5d354a){if(_0x5d354a){_0x2beae9=_0x5d354a;_0x4cbcc2[_0xf8b0('0x33')]=_[_0xf8b0('0x34')](db[_0xf8b0('0x5b')][_0xf8b0('0x30')]);_0x4cbcc2[_0xf8b0('0x35')]=_[_0xf8b0('0x34')](_0x546303[_0xf8b0('0x35')]);_0x4cbcc2[_0xf8b0('0x36')]=_[_0xf8b0('0x37')](_0x4cbcc2['model'],_0x4cbcc2[_0xf8b0('0x35')]);_0x437040[_0xf8b0('0x39')]=_[_0xf8b0('0x37')](_0x4cbcc2[_0xf8b0('0x33')],qs['fields'](_0x546303[_0xf8b0('0x35')]['fields']));_0x437040[_0xf8b0('0x39')]=_0x437040['attributes'][_0xf8b0('0x60')]?_0x437040[_0xf8b0('0x39')]:_0x4cbcc2['model'];_0x437040['order']=qs['sort'](_0x546303[_0xf8b0('0x35')][_0xf8b0('0x3e')]);_0x437040[_0xf8b0('0x3f')]=qs[_0xf8b0('0x36')](_[_0xf8b0('0x40')](_0x546303[_0xf8b0('0x35')],_0x4cbcc2['filters']));if(_0x546303['query'][_0xf8b0('0x41')]){_0x437040[_0xf8b0('0x3f')]=_[_0xf8b0('0x42')](_0x437040[_0xf8b0('0x3f')],{'$or':_[_0xf8b0('0x2e')](_0x437040[_0xf8b0('0x39')],function(_0x2990d8){var _0xed6305={};_0xed6305[_0x2990d8]={'$like':'%'+_0x546303[_0xf8b0('0x35')][_0xf8b0('0x41')]+'%'};return _0xed6305;})});}_0x437040=_[_0xf8b0('0x42')]({},_0x437040,_0x546303[_0xf8b0('0x4a')]);return _0x2beae9[_0xf8b0('0x87')](_0x437040);}})[_0xf8b0('0x25')](function(_0x100eb7){if(_0x100eb7){_0x28c3a1=_0x100eb7[_0xf8b0('0x60')];if(!_0x546303['query']['hasOwnProperty'](_0xf8b0('0x3b'))){_0x437040[_0xf8b0('0x3c')]=qs[_0xf8b0('0x3c')](_0x546303['query']['limit']);_0x437040['offset']=qs['offset'](_0x546303['query'][_0xf8b0('0x20')]);}return _0x2beae9['getAgents'](_0x437040);}})['then'](function(_0x377dea){if(_0x377dea){return _0x377dea?{'count':_0x28c3a1,'rows':_0x377dea}:null;}})['then'](respondWithResult(_0x3e0eaa,null))[_0xf8b0('0x4c')](handleError(_0x3e0eaa,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2507951..db620f4 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 _0x5ffd=['hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5ffd,0x1e9));var _0xd5ff=function(_0x1983b0,_0x26aecc){_0x1983b0=_0x1983b0-0x0;var _0x37f5be=_0x5ffd[_0x1983b0];return _0x37f5be;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xd5ff('0x0'))['db'][_0xd5ff('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd5ff('0x2')](0x0);var events={'afterCreate':_0xd5ff('0x3'),'afterUpdate':'update','afterDestroy':_0xd5ff('0x4')};function emitEvent(_0x5394eb){return function(_0x3682d1,_0x1825b2,_0x1ba034){OpenchannelQueueEvents[_0xd5ff('0x5')](_0x5394eb+':'+_0x3682d1['id'],_0x3682d1);OpenchannelQueueEvents[_0xd5ff('0x5')](_0x5394eb,_0x3682d1);_0x1ba034(null);};}for(var e in events){if(events[_0xd5ff('0x6')](e)){var event=events[e];OpenchannelQueue[_0xd5ff('0x7')](e,emitEvent(event));}}module[_0xd5ff('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x97f8=['save','update','remove','hasOwnProperty','hook','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x271785,_0x1d64c6){var _0x1cbd8d=function(_0x120e04){while(--_0x120e04){_0x271785['push'](_0x271785['shift']());}};_0x1cbd8d(++_0x1d64c6);}(_0x97f8,0x12d));var _0x897f=function(_0x1c644,_0x36a347){_0x1c644=_0x1c644-0x0;var _0x3c189e=_0x97f8[_0x1c644];return _0x3c189e;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x897f('0x0'))['db'][_0x897f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x897f('0x2')](0x0);var events={'afterCreate':_0x897f('0x3'),'afterUpdate':_0x897f('0x4'),'afterDestroy':_0x897f('0x5')};function emitEvent(_0x2b53f4){return function(_0x2af3b0,_0xbed0e0,_0x146ea3){OpenchannelQueueEvents['emit'](_0x2b53f4+':'+_0x2af3b0['id'],_0x2af3b0);OpenchannelQueueEvents['emit'](_0x2b53f4,_0x2af3b0);_0x146ea3(null);};}for(var e in events){if(events[_0x897f('0x6')](e)){var event=events[e];OpenchannelQueue[_0x897f('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index fa0739e..b2297ab 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 _0x0729=['request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x0729,0x98));var _0x9072=function(_0x366272,_0x1f11a6){_0x366272=_0x366272-0x0;var _0x3ee038=_0x0729[_0x366272];return _0x3ee038;};'use strict';var _=require('lodash');var util=require(_0x9072('0x0'));var logger=require(_0x9072('0x1'))(_0x9072('0x2'));var moment=require(_0x9072('0x3'));var BPromise=require('bluebird');var rp=require(_0x9072('0x4'));var fs=require('fs');var path=require(_0x9072('0x5'));var rimraf=require(_0x9072('0x6'));var config=require(_0x9072('0x7'));var attributes=require(_0x9072('0x8'));module[_0x9072('0x9')]=function(_0x1d04ac,_0x5d1585){return _0x1d04ac[_0x9072('0xa')](_0x9072('0xb'),attributes,{'tableName':_0x9072('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85eb=['api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x85eb,0x150));var _0xb85e=function(_0x4323dd,_0x2a0a0a){_0x4323dd=_0x4323dd-0x0;var _0x19106b=_0x85eb[_0x4323dd];return _0x19106b;};'use strict';var _=require(_0xb85e('0x0'));var util=require('util');var logger=require(_0xb85e('0x1'))(_0xb85e('0x2'));var moment=require('moment');var BPromise=require(_0xb85e('0x3'));var rp=require(_0xb85e('0x4'));var fs=require('fs');var path=require(_0xb85e('0x5'));var rimraf=require(_0xb85e('0x6'));var config=require(_0xb85e('0x7'));var attributes=require(_0xb85e('0x8'));module[_0xb85e('0x9')]=function(_0x354212,_0x212a1b){return _0x354212[_0xb85e('0xa')](_0xb85e('0xb'),attributes,{'tableName':_0xb85e('0xc'),'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 64fa2eb..57b0ef8 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 _0x684a=['options','raw','attributes','limit','model','include','where','map','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','findAll'];(function(_0x48d315,_0x242860){var _0x44e195=function(_0x32aea1){while(--_0x32aea1){_0x48d315['push'](_0x48d315['shift']());}};_0x44e195(++_0x242860);}(_0x684a,0x1cc));var _0xa684=function(_0x54d17a,_0x20568c){_0x54d17a=_0x54d17a-0x0;var _0x3b16e1=_0x684a[_0x54d17a];return _0x3b16e1;};'use strict';var _=require(_0xa684('0x0'));var util=require(_0xa684('0x1'));var moment=require(_0xa684('0x2'));var BPromise=require(_0xa684('0x3'));var rs=require(_0xa684('0x4'));var fs=require('fs');var Redis=require(_0xa684('0x5'));var db=require(_0xa684('0x6'))['db'];var utils=require(_0xa684('0x7'));var logger=require(_0xa684('0x8'))(_0xa684('0x9'));var config=require(_0xa684('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa684('0xb')][_0xa684('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa684('0xd')],{'host':_0xa684('0xe'),'port':0x18eb});var socket=require(_0xa684('0xf'))(new Redis(config[_0xa684('0xd')]));require('./openchannelQueue.socket')[_0xa684('0x10')](socket);function respondWithRpcPromise(_0x42edda,_0xdda462,_0x4639cb){return new BPromise(function(_0x23847b,_0x49fa4a){return client[_0xa684('0x11')](_0x42edda,_0x4639cb)[_0xa684('0x12')](function(_0xa53967){logger['info'](_0xa684('0x13'),_0xdda462,'request\x20sent');logger[_0xa684('0x14')](_0xa684('0x15'),_0xdda462,_0xa684('0x16'),JSON[_0xa684('0x17')](_0xa53967));if(_0xa53967[_0xa684('0x18')]){if(_0xa53967[_0xa684('0x18')][_0xa684('0x19')]===0x1f4){logger['error'](_0xa684('0x13'),_0xdda462,_0xa53967[_0xa684('0x18')][_0xa684('0x1a')]);return _0x49fa4a(_0xa53967[_0xa684('0x18')][_0xa684('0x1a')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0xdda462,_0xa53967[_0xa684('0x18')][_0xa684('0x1a')]);return _0x23847b(_0xa53967[_0xa684('0x18')]['message']);}else{logger[_0xa684('0x1b')](_0xa684('0x13'),_0xdda462,_0xa684('0x16'));_0x23847b(_0xa53967['result'][_0xa684('0x1a')]);}})[_0xa684('0x1c')](function(_0x5cbcc8){logger[_0xa684('0x18')](_0xa684('0x13'),_0xdda462,_0x5cbcc8);_0x49fa4a(_0x5cbcc8);});});}exports[_0xa684('0x1d')]=function(_0x34cada){var _0x1fe3bd=this;return new Promise(function(_0x17b70e,_0x4501c1){return db[_0xa684('0x1e')][_0xa684('0x1f')]({'raw':_0x34cada[_0xa684('0x20')]?_0x34cada['options'][_0xa684('0x21')]===undefined?!![]:![]:!![],'where':_0x34cada[_0xa684('0x20')]?_0x34cada[_0xa684('0x20')]['where']||null:null,'attributes':_0x34cada[_0xa684('0x20')]?_0x34cada[_0xa684('0x20')][_0xa684('0x22')]||null:null,'limit':_0x34cada[_0xa684('0x20')]?_0x34cada['options'][_0xa684('0x23')]||null:null,'include':_0x34cada[_0xa684('0x20')]?_0x34cada[_0xa684('0x20')]['include']?_['map'](_0x34cada[_0xa684('0x20')]['include'],function(_0x2ade19){return{'model':db[_0x2ade19[_0xa684('0x24')]],'as':_0x2ade19['as'],'attributes':_0x2ade19[_0xa684('0x22')],'include':_0x2ade19['include']?_['map'](_0x2ade19[_0xa684('0x25')],function(_0x46c741){return{'model':db[_0x46c741[_0xa684('0x24')]],'as':_0x46c741['as'],'attributes':_0x46c741['attributes'],'include':_0x46c741[_0xa684('0x25')]?_['map'](_0x46c741[_0xa684('0x25')],function(_0x88b501){return{'model':db[_0x88b501[_0xa684('0x24')]],'as':_0x88b501['as'],'attributes':_0x88b501[_0xa684('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa684('0x12')](function(_0x3350d4){logger['info'](_0xa684('0x1d'),_0x34cada);logger[_0xa684('0x14')](_0xa684('0x1d'),_0x34cada,JSON['stringify'](_0x3350d4));_0x17b70e(_0x3350d4);})[_0xa684('0x1c')](function(_0x225e66){logger[_0xa684('0x18')](_0xa684('0x1d'),_0x225e66[_0xa684('0x1a')],_0x34cada);_0x4501c1(_0x1fe3bd[_0xa684('0x18')](0x1f4,_0x225e66[_0xa684('0x1a')]));});});};exports['ShowOpenchannelQueue']=function(_0x2ab5ed){var _0x1e0749=this;return new Promise(function(_0x36c068,_0x3d58a6){return db[_0xa684('0x1e')]['find']({'raw':_0x2ab5ed[_0xa684('0x20')]?_0x2ab5ed[_0xa684('0x20')][_0xa684('0x21')]===undefined?!![]:![]:!![],'where':_0x2ab5ed[_0xa684('0x20')]?_0x2ab5ed[_0xa684('0x20')][_0xa684('0x26')]||null:null,'attributes':_0x2ab5ed[_0xa684('0x20')]?_0x2ab5ed['options'][_0xa684('0x22')]||null:null,'include':_0x2ab5ed[_0xa684('0x20')]?_0x2ab5ed[_0xa684('0x20')]['include']?_[_0xa684('0x27')](_0x2ab5ed['options'][_0xa684('0x25')],function(_0xa08f6c){return{'model':db[_0xa08f6c[_0xa684('0x24')]],'as':_0xa08f6c['as'],'attributes':_0xa08f6c[_0xa684('0x22')],'include':_0xa08f6c[_0xa684('0x25')]?_['map'](_0xa08f6c[_0xa684('0x25')],function(_0x2c0f69){return{'model':db[_0x2c0f69[_0xa684('0x24')]],'as':_0x2c0f69['as'],'attributes':_0x2c0f69[_0xa684('0x22')],'include':_0x2c0f69['include']?_[_0xa684('0x27')](_0x2c0f69[_0xa684('0x25')],function(_0x588973){return{'model':db[_0x588973[_0xa684('0x24')]],'as':_0x588973['as'],'attributes':_0x588973[_0xa684('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa684('0x12')](function(_0x780a4d){logger['info'](_0xa684('0x28'),_0x2ab5ed);logger['debug'](_0xa684('0x28'),_0x2ab5ed,JSON[_0xa684('0x17')](_0x780a4d));_0x36c068(_0x780a4d);})[_0xa684('0x1c')](function(_0x27fe25){logger[_0xa684('0x18')]('ShowOpenchannelQueue',_0x27fe25['message'],_0x2ab5ed);_0x3d58a6(_0x1e0749[_0xa684('0x18')](0x1f4,_0x27fe25['message']));});});}; \ No newline at end of file +var _0x1d07=['GetOpenchannelQueue','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','OpenchannelQueue','find','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x1d07,0x1ec));var _0x71d0=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x1d07[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var util=require(_0x71d0('0x0'));var moment=require(_0x71d0('0x1'));var BPromise=require(_0x71d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71d0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x71d0('0x4'))(_0x71d0('0x5'));var config=require(_0x71d0('0x6'));var jayson=require(_0x71d0('0x7'));var client=jayson[_0x71d0('0x8')][_0x71d0('0x9')]({'port':0x232a});config[_0x71d0('0xa')]=_[_0x71d0('0xb')](config['redis'],{'host':_0x71d0('0xc'),'port':0x18eb});var socket=require(_0x71d0('0xd'))(new Redis(config[_0x71d0('0xa')]));require(_0x71d0('0xe'))[_0x71d0('0xf')](socket);function respondWithRpcPromise(_0x1c7d22,_0x1249c8,_0x322041){return new BPromise(function(_0x1ac69d,_0x55f377){return client[_0x71d0('0x10')](_0x1c7d22,_0x322041)[_0x71d0('0x11')](function(_0x20cbdf){logger[_0x71d0('0x12')](_0x71d0('0x13'),_0x1249c8,_0x71d0('0x14'));logger[_0x71d0('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1249c8,_0x71d0('0x14'),JSON[_0x71d0('0x16')](_0x20cbdf));if(_0x20cbdf[_0x71d0('0x17')]){if(_0x20cbdf[_0x71d0('0x17')][_0x71d0('0x18')]===0x1f4){logger[_0x71d0('0x17')](_0x71d0('0x13'),_0x1249c8,_0x20cbdf[_0x71d0('0x17')][_0x71d0('0x19')]);return _0x55f377(_0x20cbdf[_0x71d0('0x17')][_0x71d0('0x19')]);}logger[_0x71d0('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x1249c8,_0x20cbdf['error'][_0x71d0('0x19')]);return _0x1ac69d(_0x20cbdf[_0x71d0('0x17')]['message']);}else{logger[_0x71d0('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x1249c8,'request\x20sent');_0x1ac69d(_0x20cbdf[_0x71d0('0x1a')][_0x71d0('0x19')]);}})[_0x71d0('0x1b')](function(_0x483402){logger[_0x71d0('0x17')](_0x71d0('0x13'),_0x1249c8,_0x483402);_0x55f377(_0x483402);});});}exports[_0x71d0('0x1c')]=function(_0x487c0a){var _0x15222d=this;return new Promise(function(_0x3c80c1,_0x1b6254){return db['OpenchannelQueue']['findAll']({'raw':_0x487c0a[_0x71d0('0x1d')]?_0x487c0a['options'][_0x71d0('0x1e')]===undefined?!![]:![]:!![],'where':_0x487c0a['options']?_0x487c0a[_0x71d0('0x1d')][_0x71d0('0x1f')]||null:null,'attributes':_0x487c0a[_0x71d0('0x1d')]?_0x487c0a[_0x71d0('0x1d')][_0x71d0('0x20')]||null:null,'limit':_0x487c0a['options']?_0x487c0a[_0x71d0('0x1d')][_0x71d0('0x21')]||null:null,'include':_0x487c0a[_0x71d0('0x1d')]?_0x487c0a['options'][_0x71d0('0x22')]?_[_0x71d0('0x23')](_0x487c0a[_0x71d0('0x1d')][_0x71d0('0x22')],function(_0x4a6abd){return{'model':db[_0x4a6abd[_0x71d0('0x24')]],'as':_0x4a6abd['as'],'attributes':_0x4a6abd[_0x71d0('0x20')],'include':_0x4a6abd[_0x71d0('0x22')]?_[_0x71d0('0x23')](_0x4a6abd[_0x71d0('0x22')],function(_0x212843){return{'model':db[_0x212843[_0x71d0('0x24')]],'as':_0x212843['as'],'attributes':_0x212843['attributes'],'include':_0x212843[_0x71d0('0x22')]?_['map'](_0x212843[_0x71d0('0x22')],function(_0x4e5c63){return{'model':db[_0x4e5c63[_0x71d0('0x24')]],'as':_0x4e5c63['as'],'attributes':_0x4e5c63['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x265daa){logger['info']('GetOpenchannelQueue',_0x487c0a);logger[_0x71d0('0x15')](_0x71d0('0x1c'),_0x487c0a,JSON[_0x71d0('0x16')](_0x265daa));_0x3c80c1(_0x265daa);})['catch'](function(_0x1f04af){logger[_0x71d0('0x17')]('GetOpenchannelQueue',_0x1f04af[_0x71d0('0x19')],_0x487c0a);_0x1b6254(_0x15222d[_0x71d0('0x17')](0x1f4,_0x1f04af[_0x71d0('0x19')]));});});};exports[_0x71d0('0x25')]=function(_0x4adf26){var _0x14c63e=this;return new Promise(function(_0x122124,_0x308000){return db[_0x71d0('0x26')][_0x71d0('0x27')]({'raw':_0x4adf26[_0x71d0('0x1d')]?_0x4adf26['options'][_0x71d0('0x1e')]===undefined?!![]:![]:!![],'where':_0x4adf26[_0x71d0('0x1d')]?_0x4adf26[_0x71d0('0x1d')][_0x71d0('0x1f')]||null:null,'attributes':_0x4adf26[_0x71d0('0x1d')]?_0x4adf26[_0x71d0('0x1d')][_0x71d0('0x20')]||null:null,'include':_0x4adf26[_0x71d0('0x1d')]?_0x4adf26[_0x71d0('0x1d')]['include']?_['map'](_0x4adf26[_0x71d0('0x1d')][_0x71d0('0x22')],function(_0x264d2d){return{'model':db[_0x264d2d['model']],'as':_0x264d2d['as'],'attributes':_0x264d2d['attributes'],'include':_0x264d2d[_0x71d0('0x22')]?_[_0x71d0('0x23')](_0x264d2d[_0x71d0('0x22')],function(_0x568789){return{'model':db[_0x568789[_0x71d0('0x24')]],'as':_0x568789['as'],'attributes':_0x568789[_0x71d0('0x20')],'include':_0x568789[_0x71d0('0x22')]?_[_0x71d0('0x23')](_0x568789['include'],function(_0x112583){return{'model':db[_0x112583[_0x71d0('0x24')]],'as':_0x112583['as'],'attributes':_0x112583[_0x71d0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x71d0('0x11')](function(_0x4c8605){logger['info'](_0x71d0('0x25'),_0x4adf26);logger[_0x71d0('0x15')]('ShowOpenchannelQueue',_0x4adf26,JSON['stringify'](_0x4c8605));_0x122124(_0x4c8605);})[_0x71d0('0x1b')](function(_0x1ed911){logger['error'](_0x71d0('0x25'),_0x1ed911[_0x71d0('0x19')],_0x4adf26);_0x308000(_0x14c63e[_0x71d0('0x17')](0x1f4,_0x1ed911[_0x71d0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f4e428b..67971c4 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 _0xfe21=['openchannelQueue:','save','removeListener','register','length'];(function(_0x529872,_0x4f6067){var _0x392818=function(_0x5b81bc){while(--_0x5b81bc){_0x529872['push'](_0x529872['shift']());}};_0x392818(++_0x4f6067);}(_0xfe21,0x6a));var _0x1fe2=function(_0x472db3,_0x5ccf4b){_0x472db3=_0x472db3-0x0;var _0x1037bb=_0xfe21[_0x472db3];return _0x1037bb;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x1fe2('0x0'),'remove','update'];function createListener(_0x4176fe,_0x36aefd){return function(_0x2a8d60){_0x36aefd['emit'](_0x4176fe,_0x2a8d60);};}function removeListener(_0x3c7305,_0x3251ac){return function(){OpenchannelQueueEvents[_0x1fe2('0x1')](_0x3c7305,_0x3251ac);};}exports[_0x1fe2('0x2')]=function(_0x54e0e7){for(var _0x29694c=0x0,_0x1dddb2=events[_0x1fe2('0x3')];_0x29694c<_0x1dddb2;_0x29694c++){var _0x309d12=events[_0x29694c];var _0x102e9a=createListener(_0x1fe2('0x4')+_0x309d12,_0x54e0e7);OpenchannelQueueEvents['on'](_0x309d12,_0x102e9a);}}; \ No newline at end of file +var _0xebcb=['save','remove','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x3ef474,_0x5f1402){var _0x3583e4=function(_0x2e67d5){while(--_0x2e67d5){_0x3ef474['push'](_0x3ef474['shift']());}};_0x3583e4(++_0x5f1402);}(_0xebcb,0x88));var _0xbebc=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0xebcb[_0x12bcf7];return _0x2825a;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xbebc('0x0'),_0xbebc('0x1'),_0xbebc('0x2')];function createListener(_0x4a9e2c,_0x3282d7){return function(_0x7764cf){_0x3282d7[_0xbebc('0x3')](_0x4a9e2c,_0x7764cf);};}function removeListener(_0x23e618,_0x263ef9){return function(){OpenchannelQueueEvents[_0xbebc('0x4')](_0x23e618,_0x263ef9);};}exports[_0xbebc('0x5')]=function(_0x5c0549){for(var _0x16e23a=0x0,_0x1b7fde=events[_0xbebc('0x6')];_0x16e23a<_0x1b7fde;_0x16e23a++){var _0x41df45=events[_0x16e23a];var _0x35b3ef=createListener(_0xbebc('0x7')+_0x41df45,_0x5c0549);OpenchannelQueueEvents['on'](_0x41df45,_0x35b3ef);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index cc0f14e..80be80d 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 _0x3d8e=['get','isAuthenticated','index','describe','/:id','show','post','create','put','destroy','exports','multer','express','Router','../../components/interaction/service','./openchannelQueueReport.controller'];(function(_0x293136,_0x21d7b7){var _0x4b3280=function(_0x2ce198){while(--_0x2ce198){_0x293136['push'](_0x293136['shift']());}};_0x4b3280(++_0x21d7b7);}(_0x3d8e,0x1cb));var _0xe3d8=function(_0x5c6acd,_0x475638){_0x5c6acd=_0x5c6acd-0x0;var _0x20bb67=_0x3d8e[_0x5c6acd];return _0x20bb67;};'use strict';var multer=require(_0xe3d8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe3d8('0x1'));var router=express[_0xe3d8('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe3d8('0x3'));var config=require('../../config/environment');var controller=require(_0xe3d8('0x4'));router[_0xe3d8('0x5')]('/',auth[_0xe3d8('0x6')](),controller[_0xe3d8('0x7')]);router['get']('/describe',auth[_0xe3d8('0x6')](),controller[_0xe3d8('0x8')]);router[_0xe3d8('0x5')](_0xe3d8('0x9'),auth['isAuthenticated'](),controller[_0xe3d8('0xa')]);router[_0xe3d8('0xb')]('/',auth[_0xe3d8('0x6')](),controller[_0xe3d8('0xc')]);router[_0xe3d8('0xd')](_0xe3d8('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe3d8('0x9'),auth[_0xe3d8('0x6')](),controller[_0xe3d8('0xe')]);module[_0xe3d8('0xf')]=router; \ No newline at end of file +var _0x0d6d=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','exports'];(function(_0x3aeae6,_0x201d94){var _0xc3594=function(_0x585f54){while(--_0x585f54){_0x3aeae6['push'](_0x3aeae6['shift']());}};_0xc3594(++_0x201d94);}(_0x0d6d,0x1ee));var _0xd0d6=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x0d6d[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require(_0xd0d6('0x0'));var path=require(_0xd0d6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd0d6('0x2')]();var auth=require(_0xd0d6('0x3'));var interaction=require(_0xd0d6('0x4'));var config=require(_0xd0d6('0x5'));var controller=require(_0xd0d6('0x6'));router[_0xd0d6('0x7')]('/',auth[_0xd0d6('0x8')](),controller[_0xd0d6('0x9')]);router[_0xd0d6('0x7')](_0xd0d6('0xa'),auth['isAuthenticated'](),controller[_0xd0d6('0xb')]);router[_0xd0d6('0x7')](_0xd0d6('0xc'),auth[_0xd0d6('0x8')](),controller['show']);router[_0xd0d6('0xd')]('/',auth[_0xd0d6('0x8')](),controller['create']);router[_0xd0d6('0xe')](_0xd0d6('0xc'),auth[_0xd0d6('0x8')](),controller[_0xd0d6('0xf')]);router[_0xd0d6('0x10')](_0xd0d6('0xc'),auth['isAuthenticated'](),controller[_0xd0d6('0x11')]);module[_0xd0d6('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 94d26d3..8bca53e 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 _0x51d1=['STRING','DATE','moment','sequelize','exports'];(function(_0x6f980b,_0x2a6660){var _0x5a6bb7=function(_0x1dc5b0){while(--_0x1dc5b0){_0x6f980b['push'](_0x6f980b['shift']());}};_0x5a6bb7(++_0x2a6660);}(_0x51d1,0xa7));var _0x151d=function(_0x17ebae,_0x7da3){_0x17ebae=_0x17ebae-0x0;var _0x8cbe7d=_0x51d1[_0x17ebae];return _0x8cbe7d;};'use strict';var moment=require(_0x151d('0x0'));var Sequelize=require(_0x151d('0x1'));module[_0x151d('0x2')]={'uniqueid':{'type':Sequelize[_0x151d('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x151d('0x4')]},'leaveAt':{'type':Sequelize[_0x151d('0x4')]},'acceptAt':{'type':Sequelize[_0x151d('0x4')]},'exitAt':{'type':Sequelize[_0x151d('0x4')]},'reason':{'type':Sequelize[_0x151d('0x3')]}}; \ No newline at end of file +var _0xb025=['moment','sequelize','exports','STRING','DATE'];(function(_0x3e42d0,_0x54a170){var _0x5557b0=function(_0x16c7aa){while(--_0x16c7aa){_0x3e42d0['push'](_0x3e42d0['shift']());}};_0x5557b0(++_0x54a170);}(_0xb025,0x64));var _0x5b02=function(_0x20b87d,_0x185ecc){_0x20b87d=_0x20b87d-0x0;var _0x594eaa=_0xb025[_0x20b87d];return _0x594eaa;};'use strict';var moment=require(_0x5b02('0x0'));var Sequelize=require(_0x5b02('0x1'));module[_0x5b02('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5b02('0x3')]},'joinAt':{'type':Sequelize[_0x5b02('0x4')]},'leaveAt':{'type':Sequelize[_0x5b02('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5b02('0x4')]},'reason':{'type':Sequelize[_0x5b02('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 9ab64bf..4cd3bf0 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 _0x8510=['merge','filter','options','include','findAll','rows','show','length','includeAll','catch','create','body','params','find','describe','rimraf','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8510,0xd5));var _0x0851=function(_0x3004a3,_0xffae32){_0x3004a3=_0x3004a3-0x0;var _0x14734d=_0x8510[_0x3004a3];return _0x14734d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0851('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0851('0x1'));var moment=require(_0x0851('0x2'));var BPromise=require(_0x0851('0x3'));var Mustache=require('mustache');var util=require(_0x0851('0x4'));var path=require(_0x0851('0x5'));var sox=require('sox');var csv=require(_0x0851('0x6'));var ejs=require(_0x0851('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0851('0x8'));var crypto=require('crypto');var jsforce=require(_0x0851('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0851('0x6'));var querystring=require(_0x0851('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0851('0xb'));var qs=require(_0x0851('0xc'));var as=require(_0x0851('0xd'));var hardwareService=require(_0x0851('0xe'));var logger=require('../../config/logger')(_0x0851('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0851('0x10'))['db'];function respondWithStatusCode(_0x2604bf,_0x519e5e){_0x519e5e=_0x519e5e||0xcc;return function(_0x7fbea5){if(_0x7fbea5){return _0x2604bf[_0x0851('0x11')](_0x519e5e);}return _0x2604bf[_0x0851('0x12')](_0x519e5e)[_0x0851('0x13')]();};}function respondWithResult(_0x1410ea,_0x4eb35a){_0x4eb35a=_0x4eb35a||0xc8;return function(_0x19d1ab){if(_0x19d1ab){return _0x1410ea['status'](_0x4eb35a)[_0x0851('0x14')](_0x19d1ab);}};}function respondWithFilteredResult(_0x4e7c9b,_0x24c27a){return function(_0x4de9e8){if(_0x4de9e8){var _0xf4a280=_0x4de9e8[_0x0851('0x15')],_0x61e333=_0x24c27a[_0x0851('0x16')],_0x1d761f=_0x24c27a['offset']+_0x24c27a['limit'],_0x23abb8;if(_0x1d761f>=_0xf4a280){_0x1d761f=_0xf4a280;_0x23abb8=0xc8;}else{_0x23abb8=0xce;}_0x4e7c9b[_0x0851('0x12')](_0x23abb8);return _0x4e7c9b[_0x0851('0x17')](_0x0851('0x18'),_0x61e333+'-'+_0x1d761f+'/'+_0xf4a280)[_0x0851('0x14')](_0x4de9e8);}return null;};}function patchUpdates(_0x2f3ab1){return function(_0x440c82){try{jsonpatch[_0x0851('0x19')](_0x440c82,_0x2f3ab1,!![]);}catch(_0x3a7918){return BPromise[_0x0851('0x1a')](_0x3a7918);}return _0x440c82[_0x0851('0x1b')]();};}function saveUpdates(_0x25cb58,_0x1247bd){return function(_0x332b84){if(_0x332b84){return _0x332b84[_0x0851('0x1c')](_0x25cb58)[_0x0851('0x1d')](function(_0xe52704){return _0xe52704;});}return null;};}function removeEntity(_0x51d92d,_0x530eb1){return function(_0x1b1671){if(_0x1b1671){return _0x1b1671[_0x0851('0x1e')]()['then'](function(){_0x51d92d[_0x0851('0x12')](0xcc)[_0x0851('0x13')]();});}};}function handleEntityNotFound(_0x42cc32,_0x305cbc){return function(_0x1553c7){if(!_0x1553c7){_0x42cc32['sendStatus'](0x194);}return _0x1553c7;};}function handleError(_0x226598,_0x4a9e58){_0x4a9e58=_0x4a9e58||0x1f4;return function(_0x3a985c){logger['error'](_0x3a985c['stack']);if(_0x3a985c[_0x0851('0x1f')]){delete _0x3a985c[_0x0851('0x1f')];}_0x226598[_0x0851('0x12')](_0x4a9e58)[_0x0851('0x20')](_0x3a985c);};}exports[_0x0851('0x21')]=function(_0x1f27e8,_0x2eda66){var _0xb9b9d8={},_0x5767da={},_0x274eab={'count':0x0,'rows':[]};var _0x111c6c=_['map'](db[_0x0851('0x22')][_0x0851('0x23')],function(_0x4b98e1){return{'name':_0x4b98e1[_0x0851('0x24')],'type':_0x4b98e1[_0x0851('0x25')]['key']};});_0x5767da[_0x0851('0x26')]=_['map'](_0x111c6c,_0x0851('0x1f'));_0x5767da['query']=_[_0x0851('0x27')](_0x1f27e8[_0x0851('0x28')]);_0x5767da['filters']=_[_0x0851('0x29')](_0x5767da[_0x0851('0x26')],_0x5767da[_0x0851('0x28')]);_0xb9b9d8[_0x0851('0x2a')]=_[_0x0851('0x29')](_0x5767da[_0x0851('0x26')],qs[_0x0851('0x2b')](_0x1f27e8[_0x0851('0x28')][_0x0851('0x2b')]));_0xb9b9d8[_0x0851('0x2a')]=_0xb9b9d8[_0x0851('0x2a')]['length']?_0xb9b9d8[_0x0851('0x2a')]:_0x5767da[_0x0851('0x26')];if(!_0x1f27e8[_0x0851('0x28')][_0x0851('0x2c')]('nolimit')){_0xb9b9d8[_0x0851('0x2d')]=qs[_0x0851('0x2d')](_0x1f27e8[_0x0851('0x28')]['limit']);_0xb9b9d8[_0x0851('0x16')]=qs[_0x0851('0x16')](_0x1f27e8[_0x0851('0x28')]['offset']);}_0xb9b9d8[_0x0851('0x2e')]=qs['sort'](_0x1f27e8['query'][_0x0851('0x2f')]);_0xb9b9d8[_0x0851('0x30')]=qs[_0x0851('0x31')](_[_0x0851('0x32')](_0x1f27e8[_0x0851('0x28')],_0x5767da[_0x0851('0x31')]),_0x111c6c);if(_0x1f27e8[_0x0851('0x28')]['filter']){_0xb9b9d8[_0x0851('0x30')]=_[_0x0851('0x33')](_0xb9b9d8['where'],{'$or':_['map'](_0x111c6c,function(_0x27c022){if(_0x27c022[_0x0851('0x25')]!=='VIRTUAL'){var _0x15c56f={};_0x15c56f[_0x27c022['name']]={'$like':'%'+_0x1f27e8[_0x0851('0x28')][_0x0851('0x34')]+'%'};return _0x15c56f;}})});}_0xb9b9d8=_[_0x0851('0x33')]({},_0xb9b9d8,_0x1f27e8[_0x0851('0x35')]);var _0x13bbf6={'where':_0xb9b9d8[_0x0851('0x30')]};return db[_0x0851('0x22')][_0x0851('0x15')](_0x13bbf6)[_0x0851('0x1d')](function(_0x309201){_0x274eab[_0x0851('0x15')]=_0x309201;if(_0x1f27e8[_0x0851('0x28')]['includeAll']){_0xb9b9d8[_0x0851('0x36')]=[{'all':!![]}];}return db[_0x0851('0x22')][_0x0851('0x37')](_0xb9b9d8);})[_0x0851('0x1d')](function(_0x2aaeac){_0x274eab[_0x0851('0x38')]=_0x2aaeac;return _0x274eab;})[_0x0851('0x1d')](respondWithFilteredResult(_0x2eda66,_0xb9b9d8))['catch'](handleError(_0x2eda66,null));};exports[_0x0851('0x39')]=function(_0x3b5ba5,_0x3b1090){var _0x57d4f0={'raw':!![],'where':{'id':_0x3b5ba5['params']['id']}},_0x5445ca={};_0x5445ca[_0x0851('0x26')]=_[_0x0851('0x27')](db[_0x0851('0x22')]['rawAttributes']);_0x5445ca[_0x0851('0x28')]=_[_0x0851('0x27')](_0x3b5ba5[_0x0851('0x28')]);_0x5445ca['filters']=_[_0x0851('0x29')](_0x5445ca['model'],_0x5445ca[_0x0851('0x28')]);_0x57d4f0[_0x0851('0x2a')]=_['intersection'](_0x5445ca['model'],qs[_0x0851('0x2b')](_0x3b5ba5[_0x0851('0x28')]['fields']));_0x57d4f0[_0x0851('0x2a')]=_0x57d4f0[_0x0851('0x2a')][_0x0851('0x3a')]?_0x57d4f0[_0x0851('0x2a')]:_0x5445ca[_0x0851('0x26')];if(_0x3b5ba5['query'][_0x0851('0x3b')]){_0x57d4f0['include']=[{'all':!![]}];}_0x57d4f0=_[_0x0851('0x33')]({},_0x57d4f0,_0x3b5ba5[_0x0851('0x35')]);return db['OpenchannelQueueReport']['find'](_0x57d4f0)[_0x0851('0x1d')](handleEntityNotFound(_0x3b1090,null))[_0x0851('0x1d')](respondWithResult(_0x3b1090,null))[_0x0851('0x3c')](handleError(_0x3b1090,null));};exports[_0x0851('0x3d')]=function(_0x38eefa,_0x53e4fd){return db[_0x0851('0x22')][_0x0851('0x3d')](_0x38eefa[_0x0851('0x3e')],{})[_0x0851('0x1d')](respondWithResult(_0x53e4fd,0xc9))[_0x0851('0x3c')](handleError(_0x53e4fd,null));};exports['update']=function(_0x5ad243,_0x4181b8){if(_0x5ad243['body']['id']){delete _0x5ad243[_0x0851('0x3e')]['id'];}return db[_0x0851('0x22')]['find']({'where':{'id':_0x5ad243[_0x0851('0x3f')]['id']}})[_0x0851('0x1d')](handleEntityNotFound(_0x4181b8,null))['then'](saveUpdates(_0x5ad243['body'],null))['then'](respondWithResult(_0x4181b8,null))[_0x0851('0x3c')](handleError(_0x4181b8,null));};exports[_0x0851('0x1e')]=function(_0x56dff9,_0x1ef807){return db['OpenchannelQueueReport'][_0x0851('0x40')]({'where':{'id':_0x56dff9[_0x0851('0x3f')]['id']}})[_0x0851('0x1d')](handleEntityNotFound(_0x1ef807,null))['then'](removeEntity(_0x1ef807,null))['catch'](handleError(_0x1ef807,null));};exports[_0x0851('0x41')]=function(_0x20fabc,_0x53c7a4){return db[_0x0851('0x22')][_0x0851('0x41')]()[_0x0851('0x1d')](respondWithResult(_0x53c7a4,null))[_0x0851('0x3c')](handleError(_0x53c7a4,null));}; \ No newline at end of file +var _0x569d=['params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x599a9c,_0x575cf9){var _0x25ffa3=function(_0x426920){while(--_0x426920){_0x599a9c['push'](_0x599a9c['shift']());}};_0x25ffa3(++_0x575cf9);}(_0x569d,0xa3));var _0xd569=function(_0x29e4c0,_0xf8b14d){_0x29e4c0=_0x29e4c0-0x0;var _0x15b64b=_0x569d[_0x29e4c0];return _0x15b64b;};'use strict';var pdf=require(_0xd569('0x0'));var emlformat=require(_0xd569('0x1'));var rimraf=require(_0xd569('0x2'));var zipdir=require(_0xd569('0x3'));var jsonpatch=require(_0xd569('0x4'));var rp=require(_0xd569('0x5'));var moment=require('moment');var BPromise=require(_0xd569('0x6'));var Mustache=require(_0xd569('0x7'));var util=require(_0xd569('0x8'));var path=require(_0xd569('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd569('0xa'));var fs=require('fs');var _=require(_0xd569('0xb'));var squel=require(_0xd569('0xc'));var crypto=require(_0xd569('0xd'));var jsforce=require(_0xd569('0xe'));var deskjs=require(_0xd569('0xf'));var toCsv=require(_0xd569('0x10'));var querystring=require(_0xd569('0x11'));var Papa=require(_0xd569('0x12'));var Redis=require('ioredis');var authService=require(_0xd569('0x13'));var qs=require(_0xd569('0x14'));var as=require(_0xd569('0x15'));var hardwareService=require(_0xd569('0x16'));var logger=require(_0xd569('0x17'))(_0xd569('0x18'));var utils=require(_0xd569('0x19'));var config=require(_0xd569('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56c502,_0x4f1685){_0x4f1685=_0x4f1685||0xcc;return function(_0x15a723){if(_0x15a723){return _0x56c502['sendStatus'](_0x4f1685);}return _0x56c502[_0xd569('0x1b')](_0x4f1685)['end']();};}function respondWithResult(_0x32d8b6,_0x1772df){_0x1772df=_0x1772df||0xc8;return function(_0x2aa045){if(_0x2aa045){return _0x32d8b6['status'](_0x1772df)[_0xd569('0x1c')](_0x2aa045);}};}function respondWithFilteredResult(_0x1f0df8,_0x568294){return function(_0x313bc8){if(_0x313bc8){var _0x2c68ae=_0x313bc8[_0xd569('0x1d')],_0xaabd7c=_0x568294[_0xd569('0x1e')],_0x3c82b8=_0x568294[_0xd569('0x1e')]+_0x568294[_0xd569('0x1f')],_0xe43fe0;if(_0x3c82b8>=_0x2c68ae){_0x3c82b8=_0x2c68ae;_0xe43fe0=0xc8;}else{_0xe43fe0=0xce;}_0x1f0df8['status'](_0xe43fe0);return _0x1f0df8[_0xd569('0x20')](_0xd569('0x21'),_0xaabd7c+'-'+_0x3c82b8+'/'+_0x2c68ae)['json'](_0x313bc8);}return null;};}function patchUpdates(_0x1b723e){return function(_0x5427dc){try{jsonpatch[_0xd569('0x22')](_0x5427dc,_0x1b723e,!![]);}catch(_0x47462c){return BPromise['reject'](_0x47462c);}return _0x5427dc[_0xd569('0x23')]();};}function saveUpdates(_0x2ae92f,_0x40d8da){return function(_0x553ec5){if(_0x553ec5){return _0x553ec5[_0xd569('0x24')](_0x2ae92f)[_0xd569('0x25')](function(_0xd41f63){return _0xd41f63;});}return null;};}function removeEntity(_0x457901,_0x285378){return function(_0x486f31){if(_0x486f31){return _0x486f31[_0xd569('0x26')]()[_0xd569('0x25')](function(){_0x457901[_0xd569('0x1b')](0xcc)[_0xd569('0x27')]();});}};}function handleEntityNotFound(_0x23de46,_0x3bf523){return function(_0x244bef){if(!_0x244bef){_0x23de46[_0xd569('0x28')](0x194);}return _0x244bef;};}function handleError(_0x57d6df,_0x503a60){_0x503a60=_0x503a60||0x1f4;return function(_0x3d35c9){logger[_0xd569('0x29')](_0x3d35c9[_0xd569('0x2a')]);if(_0x3d35c9[_0xd569('0x2b')]){delete _0x3d35c9[_0xd569('0x2b')];}_0x57d6df['status'](_0x503a60)['send'](_0x3d35c9);};}exports[_0xd569('0x2c')]=function(_0x96cd42,_0x495a07){var _0x385d40={},_0x3c57a6={},_0x2f963a={'count':0x0,'rows':[]};var _0x3c36ce=_[_0xd569('0x2d')](db[_0xd569('0x2e')][_0xd569('0x2f')],function(_0x3c7745){return{'name':_0x3c7745[_0xd569('0x30')],'type':_0x3c7745[_0xd569('0x31')][_0xd569('0x32')]};});_0x3c57a6[_0xd569('0x33')]=_['map'](_0x3c36ce,_0xd569('0x2b'));_0x3c57a6[_0xd569('0x34')]=_[_0xd569('0x35')](_0x96cd42[_0xd569('0x34')]);_0x3c57a6['filters']=_[_0xd569('0x36')](_0x3c57a6[_0xd569('0x33')],_0x3c57a6['query']);_0x385d40['attributes']=_[_0xd569('0x36')](_0x3c57a6[_0xd569('0x33')],qs[_0xd569('0x37')](_0x96cd42['query'][_0xd569('0x37')]));_0x385d40[_0xd569('0x38')]=_0x385d40[_0xd569('0x38')][_0xd569('0x39')]?_0x385d40[_0xd569('0x38')]:_0x3c57a6[_0xd569('0x33')];if(!_0x96cd42[_0xd569('0x34')][_0xd569('0x3a')]('nolimit')){_0x385d40['limit']=qs[_0xd569('0x1f')](_0x96cd42[_0xd569('0x34')][_0xd569('0x1f')]);_0x385d40[_0xd569('0x1e')]=qs[_0xd569('0x1e')](_0x96cd42[_0xd569('0x34')][_0xd569('0x1e')]);}_0x385d40[_0xd569('0x3b')]=qs[_0xd569('0x3c')](_0x96cd42[_0xd569('0x34')][_0xd569('0x3c')]);_0x385d40[_0xd569('0x3d')]=qs[_0xd569('0x3e')](_[_0xd569('0x3f')](_0x96cd42['query'],_0x3c57a6[_0xd569('0x3e')]),_0x3c36ce);if(_0x96cd42['query'][_0xd569('0x40')]){_0x385d40[_0xd569('0x3d')]=_[_0xd569('0x41')](_0x385d40[_0xd569('0x3d')],{'$or':_['map'](_0x3c36ce,function(_0xd9eb5b){if(_0xd9eb5b['type']!==_0xd569('0x42')){var _0x2db5d7={};_0x2db5d7[_0xd9eb5b[_0xd569('0x2b')]]={'$like':'%'+_0x96cd42['query'][_0xd569('0x40')]+'%'};return _0x2db5d7;}})});}_0x385d40=_[_0xd569('0x41')]({},_0x385d40,_0x96cd42[_0xd569('0x43')]);var _0x3ade17={'where':_0x385d40[_0xd569('0x3d')]};return db['OpenchannelQueueReport'][_0xd569('0x1d')](_0x3ade17)[_0xd569('0x25')](function(_0x191cb6){_0x2f963a[_0xd569('0x1d')]=_0x191cb6;if(_0x96cd42['query'][_0xd569('0x44')]){_0x385d40[_0xd569('0x45')]=[{'all':!![]}];}return db[_0xd569('0x2e')][_0xd569('0x46')](_0x385d40);})[_0xd569('0x25')](function(_0x510b39){_0x2f963a[_0xd569('0x47')]=_0x510b39;return _0x2f963a;})[_0xd569('0x25')](respondWithFilteredResult(_0x495a07,_0x385d40))[_0xd569('0x48')](handleError(_0x495a07,null));};exports[_0xd569('0x49')]=function(_0x3e2904,_0x1b2914){var _0x595904={'raw':!![],'where':{'id':_0x3e2904[_0xd569('0x4a')]['id']}},_0x324063={};_0x324063[_0xd569('0x33')]=_[_0xd569('0x35')](db[_0xd569('0x2e')][_0xd569('0x2f')]);_0x324063[_0xd569('0x34')]=_[_0xd569('0x35')](_0x3e2904['query']);_0x324063['filters']=_[_0xd569('0x36')](_0x324063[_0xd569('0x33')],_0x324063[_0xd569('0x34')]);_0x595904[_0xd569('0x38')]=_[_0xd569('0x36')](_0x324063[_0xd569('0x33')],qs[_0xd569('0x37')](_0x3e2904[_0xd569('0x34')][_0xd569('0x37')]));_0x595904[_0xd569('0x38')]=_0x595904[_0xd569('0x38')][_0xd569('0x39')]?_0x595904[_0xd569('0x38')]:_0x324063[_0xd569('0x33')];if(_0x3e2904[_0xd569('0x34')][_0xd569('0x44')]){_0x595904[_0xd569('0x45')]=[{'all':!![]}];}_0x595904=_[_0xd569('0x41')]({},_0x595904,_0x3e2904[_0xd569('0x43')]);return db['OpenchannelQueueReport'][_0xd569('0x4b')](_0x595904)[_0xd569('0x25')](handleEntityNotFound(_0x1b2914,null))[_0xd569('0x25')](respondWithResult(_0x1b2914,null))[_0xd569('0x48')](handleError(_0x1b2914,null));};exports[_0xd569('0x4c')]=function(_0x139e16,_0x190846){return db['OpenchannelQueueReport']['create'](_0x139e16['body'],{})[_0xd569('0x25')](respondWithResult(_0x190846,0xc9))[_0xd569('0x48')](handleError(_0x190846,null));};exports[_0xd569('0x24')]=function(_0x5a4a0f,_0x3765d2){if(_0x5a4a0f[_0xd569('0x4d')]['id']){delete _0x5a4a0f[_0xd569('0x4d')]['id'];}return db[_0xd569('0x2e')][_0xd569('0x4b')]({'where':{'id':_0x5a4a0f[_0xd569('0x4a')]['id']}})[_0xd569('0x25')](handleEntityNotFound(_0x3765d2,null))[_0xd569('0x25')](saveUpdates(_0x5a4a0f[_0xd569('0x4d')],null))[_0xd569('0x25')](respondWithResult(_0x3765d2,null))[_0xd569('0x48')](handleError(_0x3765d2,null));};exports[_0xd569('0x26')]=function(_0x30d81d,_0x4020f9){return db[_0xd569('0x2e')]['find']({'where':{'id':_0x30d81d[_0xd569('0x4a')]['id']}})[_0xd569('0x25')](handleEntityNotFound(_0x4020f9,null))[_0xd569('0x25')](removeEntity(_0x4020f9,null))[_0xd569('0x48')](handleError(_0x4020f9,null));};exports[_0xd569('0x4e')]=function(_0x5bade7,_0x6a3c52){return db[_0xd569('0x2e')][_0xd569('0x4e')]()[_0xd569('0x25')](respondWithResult(_0x6a3c52,null))[_0xd569('0x48')](handleError(_0x6a3c52,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 9b1931c..ae2816e 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 _0x661c=['report_openchannel_queue','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x661c,0x122));var _0xc661=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x661c[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0xc661('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc661('0x1'));var moment=require('moment');var BPromise=require(_0xc661('0x2'));var rp=require(_0xc661('0x3'));var fs=require('fs');var path=require(_0xc661('0x4'));var rimraf=require(_0xc661('0x5'));var config=require(_0xc661('0x6'));var attributes=require(_0xc661('0x7'));module[_0xc661('0x8')]=function(_0x502716,_0x4de875){return _0x502716[_0xc661('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0xc661('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc661('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd0a4=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','report_openchannel_queue','lodash'];(function(_0x87bb6f,_0x5ec5d7){var _0x219e10=function(_0x3dd5f3){while(--_0x3dd5f3){_0x87bb6f['push'](_0x87bb6f['shift']());}};_0x219e10(++_0x5ec5d7);}(_0xd0a4,0x13e));var _0x4d0a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd0a4[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4d0a('0x0'));var util=require(_0x4d0a('0x1'));var logger=require(_0x4d0a('0x2'))(_0x4d0a('0x3'));var moment=require(_0x4d0a('0x4'));var BPromise=require(_0x4d0a('0x5'));var rp=require(_0x4d0a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d0a('0x7'));var config=require(_0x4d0a('0x8'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0x4dae1f,_0x44c7a7){return _0x4dae1f[_0x4d0a('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0x4d0a('0xa'),'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 a09b490..2c43ba9 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 _0x6a95=['request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x16159d,_0x3dd071){var _0x1ae468=function(_0x299e75){while(--_0x299e75){_0x16159d['push'](_0x16159d['shift']());}};_0x1ae468(++_0x3dd071);}(_0x6a95,0x1db));var _0x56a9=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x6a95[_0x3ff085];return _0x2b68c3;};'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});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')](_0x576bdf[_0x56a9('0x1b')],{'raw':_0x576bdf[_0x56a9('0x1c')]?_0x576bdf[_0x56a9('0x1c')][_0x56a9('0x1d')]===undefined?!![]:![]:!![]})[_0x56a9('0x1e')](function(_0x5f145f){logger['info'](_0x56a9('0x18'),_0x576bdf);logger[_0x56a9('0x10')](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x5f145f));_0x105fe5(_0x5f145f);})['catch'](function(_0x6100fe){logger[_0x56a9('0x13')](_0x56a9('0x18'),_0x6100fe[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x6100fe[_0x56a9('0x15')]));});});};exports[_0x56a9('0x1f')]=function(_0x21ab38){var _0xd029f7=this;return new Promise(function(_0x497d31,_0x52016c){return db[_0x56a9('0x19')][_0x56a9('0x20')](_0x21ab38[_0x56a9('0x1b')],{'raw':_0x21ab38['options']?_0x21ab38[_0x56a9('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')][_0x56a9('0x21')]||null:null,'attributes':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')][_0x56a9('0x22')]||null:null,'limit':_0x21ab38[_0x56a9('0x1c')]?_0x21ab38[_0x56a9('0x1c')]['limit']||null:null})[_0x56a9('0x1e')](function(_0x2bb1eb){logger['info'](_0x56a9('0x1f'),_0x21ab38);logger['debug']('UpdateOpenchannelQueueReport',_0x21ab38,JSON[_0x56a9('0x12')](_0x2bb1eb));_0x497d31(_0x2bb1eb);})['catch'](function(_0x2f933a){logger[_0x56a9('0x13')](_0x56a9('0x1f'),_0x2f933a[_0x56a9('0x15')],_0x21ab38);_0x52016c(_0xd029f7['error'](0x1f4,_0x2f933a[_0x56a9('0x15')]));});});}; \ No newline at end of file +var _0xdfb1=['request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','OpenchannelQueueReport','body','options','raw','then','catch','UpdateOpenchannelQueueReport','update','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x332be7,_0x2ca3a6){var _0x9d549d=function(_0x399aec){while(--_0x399aec){_0x332be7['push'](_0x332be7['shift']());}};_0x9d549d(++_0x2ca3a6);}(_0xdfb1,0x8c));var _0x1dfb=function(_0xde0887,_0x2707c0){_0xde0887=_0xde0887-0x0;var _0x4be1f2=_0xdfb1[_0xde0887];return _0x4be1f2;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var moment=require(_0x1dfb('0x2'));var BPromise=require(_0x1dfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dfb('0x4'));var db=require(_0x1dfb('0x5'))['db'];var utils=require(_0x1dfb('0x6'));var logger=require(_0x1dfb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1dfb('0x8')][_0x1dfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e10d9,_0x496be7,_0x42d45e){return new BPromise(function(_0x491406,_0x141081){return client[_0x1dfb('0xa')](_0x1e10d9,_0x42d45e)['then'](function(_0x24d8b9){logger[_0x1dfb('0xb')](_0x1dfb('0xc'),_0x496be7,'request\x20sent');logger[_0x1dfb('0xd')](_0x1dfb('0xe'),_0x496be7,_0x1dfb('0xf'),JSON[_0x1dfb('0x10')](_0x24d8b9));if(_0x24d8b9[_0x1dfb('0x11')]){if(_0x24d8b9[_0x1dfb('0x11')][_0x1dfb('0x12')]===0x1f4){logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x24d8b9['error'][_0x1dfb('0x13')]);return _0x141081(_0x24d8b9[_0x1dfb('0x11')]['message']);}logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x24d8b9[_0x1dfb('0x11')]['message']);return _0x491406(_0x24d8b9[_0x1dfb('0x11')][_0x1dfb('0x13')]);}else{logger[_0x1dfb('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x496be7,_0x1dfb('0xf'));_0x491406(_0x24d8b9[_0x1dfb('0x14')][_0x1dfb('0x13')]);}})['catch'](function(_0x1186d1){logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x1186d1);_0x141081(_0x1186d1);});});}exports['CreateOpenchannelQueueReport']=function(_0x51c0fc){var _0x2415fe=this;return new Promise(function(_0x22cfdc,_0x37c3dc){return db[_0x1dfb('0x15')]['create'](_0x51c0fc[_0x1dfb('0x16')],{'raw':_0x51c0fc[_0x1dfb('0x17')]?_0x51c0fc[_0x1dfb('0x17')][_0x1dfb('0x18')]===undefined?!![]:![]:!![]})[_0x1dfb('0x19')](function(_0x4dff46){logger[_0x1dfb('0xb')]('CreateOpenchannelQueueReport',_0x51c0fc);logger['debug']('CreateOpenchannelQueueReport',_0x51c0fc,JSON[_0x1dfb('0x10')](_0x4dff46));_0x22cfdc(_0x4dff46);})[_0x1dfb('0x1a')](function(_0x3cb51e){logger['error']('CreateOpenchannelQueueReport',_0x3cb51e['message'],_0x51c0fc);_0x37c3dc(_0x2415fe[_0x1dfb('0x11')](0x1f4,_0x3cb51e[_0x1dfb('0x13')]));});});};exports[_0x1dfb('0x1b')]=function(_0x1250c4){var _0x128cc6=this;return new Promise(function(_0x55da8b,_0x136a7d){return db[_0x1dfb('0x15')][_0x1dfb('0x1c')](_0x1250c4['body'],{'raw':_0x1250c4['options']?_0x1250c4[_0x1dfb('0x17')][_0x1dfb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1250c4['options']?_0x1250c4['options']['where']||null:null,'attributes':_0x1250c4[_0x1dfb('0x17')]?_0x1250c4[_0x1dfb('0x17')]['attributes']||null:null,'limit':_0x1250c4[_0x1dfb('0x17')]?_0x1250c4['options'][_0x1dfb('0x1d')]||null:null})[_0x1dfb('0x19')](function(_0x51b2e9){logger[_0x1dfb('0xb')](_0x1dfb('0x1b'),_0x1250c4);logger[_0x1dfb('0xd')]('UpdateOpenchannelQueueReport',_0x1250c4,JSON[_0x1dfb('0x10')](_0x51b2e9));_0x55da8b(_0x51b2e9);})[_0x1dfb('0x1a')](function(_0x2dfa60){logger[_0x1dfb('0x11')](_0x1dfb('0x1b'),_0x2dfa60['message'],_0x1250c4);_0x136a7d(_0x128cc6[_0x1dfb('0x11')](0x1f4,_0x2dfa60[_0x1dfb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 16785e3..2299d71 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(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_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('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(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 590cff4..876930b 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 _0x95eb=['exports','account','agent','queue','NOW','moment'];(function(_0x5acf55,_0xb4afa3){var _0x3f083f=function(_0x336713){while(--_0x336713){_0x5acf55['push'](_0x5acf55['shift']());}};_0x3f083f(++_0xb4afa3);}(_0x95eb,0x12b));var _0xb95e=function(_0x115594,_0x44dc8b){_0x115594=_0x115594-0x0;var _0x1c5cc8=_0x95eb[_0x115594];return _0x1c5cc8;};'use strict';var moment=require(_0xb95e('0x0'));var Sequelize=require('sequelize');module[_0xb95e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb95e('0x2'),_0xb95e('0x3'),_0xb95e('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb95e('0x5')]}}; \ No newline at end of file +var _0x5210=['STRING','account','queue','DATE','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5210,0xfa));var _0x0521=function(_0x38c29d,_0xf2b838){_0x38c29d=_0x38c29d-0x0;var _0x3e3bea=_0x5210[_0x38c29d];return _0x3e3bea;};'use strict';var moment=require(_0x0521('0x0'));var Sequelize=require(_0x0521('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0521('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0521('0x3'),'agent',_0x0521('0x4')),'allowNull':![],'defaultValue':_0x0521('0x4')},'transferredAt':{'type':Sequelize[_0x0521('0x5')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 35d7092..c1f9191 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 _0x8885=['index','OpenchannelTransferReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','update','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send'];(function(_0x82b524,_0x53535e){var _0x36c60b=function(_0x1a3658){while(--_0x1a3658){_0x82b524['push'](_0x82b524['shift']());}};_0x36c60b(++_0x53535e);}(_0x8885,0x104));var _0x5888=function(_0x5cd6bd,_0x3ed15d){_0x5cd6bd=_0x5cd6bd-0x0;var _0x431730=_0x8885[_0x5cd6bd];return _0x431730;};'use strict';var pdf=require(_0x5888('0x0'));var emlformat=require(_0x5888('0x1'));var rimraf=require(_0x5888('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5888('0x3'));var rp=require(_0x5888('0x4'));var moment=require(_0x5888('0x5'));var BPromise=require(_0x5888('0x6'));var Mustache=require(_0x5888('0x7'));var util=require(_0x5888('0x8'));var path=require(_0x5888('0x9'));var sox=require(_0x5888('0xa'));var csv=require(_0x5888('0xb'));var ejs=require(_0x5888('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5888('0xd'));var crypto=require(_0x5888('0xe'));var jsforce=require(_0x5888('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5888('0xb'));var querystring=require(_0x5888('0x10'));var Papa=require(_0x5888('0x11'));var Redis=require(_0x5888('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5888('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5888('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5888('0x15'));var config=require(_0x5888('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41df22,_0x35982c){_0x35982c=_0x35982c||0xcc;return function(_0x23277a){if(_0x23277a){return _0x41df22[_0x5888('0x17')](_0x35982c);}return _0x41df22[_0x5888('0x18')](_0x35982c)[_0x5888('0x19')]();};}function respondWithResult(_0x4775c5,_0x3e261c){_0x3e261c=_0x3e261c||0xc8;return function(_0x12edb5){if(_0x12edb5){return _0x4775c5[_0x5888('0x18')](_0x3e261c)['json'](_0x12edb5);}};}function respondWithFilteredResult(_0x250868,_0x501af1){return function(_0x433562){if(_0x433562){var _0x25991f=_0x433562[_0x5888('0x1a')],_0x202c30=_0x501af1[_0x5888('0x1b')],_0x330c54=_0x501af1[_0x5888('0x1b')]+_0x501af1[_0x5888('0x1c')],_0x18615c;if(_0x330c54>=_0x25991f){_0x330c54=_0x25991f;_0x18615c=0xc8;}else{_0x18615c=0xce;}_0x250868[_0x5888('0x18')](_0x18615c);return _0x250868['set'](_0x5888('0x1d'),_0x202c30+'-'+_0x330c54+'/'+_0x25991f)[_0x5888('0x1e')](_0x433562);}return null;};}function patchUpdates(_0x1ded5d){return function(_0x1779a6){try{jsonpatch[_0x5888('0x1f')](_0x1779a6,_0x1ded5d,!![]);}catch(_0x419778){return BPromise[_0x5888('0x20')](_0x419778);}return _0x1779a6[_0x5888('0x21')]();};}function saveUpdates(_0x1ab1ee,_0x1e6e0d){return function(_0x19073b){if(_0x19073b){return _0x19073b['update'](_0x1ab1ee)[_0x5888('0x22')](function(_0x4efd81){return _0x4efd81;});}return null;};}function removeEntity(_0x516f40,_0x5c13c5){return function(_0x2744bb){if(_0x2744bb){return _0x2744bb[_0x5888('0x23')]()[_0x5888('0x22')](function(){_0x516f40[_0x5888('0x18')](0xcc)[_0x5888('0x19')]();});}};}function handleEntityNotFound(_0x250b0a,_0x7fa804){return function(_0x305a0d){if(!_0x305a0d){_0x250b0a[_0x5888('0x17')](0x194);}return _0x305a0d;};}function handleError(_0x42307a,_0x5340d3){_0x5340d3=_0x5340d3||0x1f4;return function(_0x2caa91){logger[_0x5888('0x24')](_0x2caa91[_0x5888('0x25')]);if(_0x2caa91[_0x5888('0x26')]){delete _0x2caa91[_0x5888('0x26')];}_0x42307a[_0x5888('0x18')](_0x5340d3)[_0x5888('0x27')](_0x2caa91);};}exports[_0x5888('0x28')]=function(_0x19d40a,_0x4d4087){var _0x404c42={},_0x124117={},_0x5a5ed2={'count':0x0,'rows':[]};var _0x586473=_['map'](db[_0x5888('0x29')][_0x5888('0x2a')],function(_0x14ce7a){return{'name':_0x14ce7a['fieldName'],'type':_0x14ce7a[_0x5888('0x2b')][_0x5888('0x2c')]};});_0x124117[_0x5888('0x2d')]=_[_0x5888('0x2e')](_0x586473,_0x5888('0x26'));_0x124117[_0x5888('0x2f')]=_[_0x5888('0x30')](_0x19d40a['query']);_0x124117['filters']=_[_0x5888('0x31')](_0x124117['model'],_0x124117['query']);_0x404c42[_0x5888('0x32')]=_[_0x5888('0x31')](_0x124117[_0x5888('0x2d')],qs[_0x5888('0x33')](_0x19d40a[_0x5888('0x2f')][_0x5888('0x33')]));_0x404c42[_0x5888('0x32')]=_0x404c42[_0x5888('0x32')][_0x5888('0x34')]?_0x404c42[_0x5888('0x32')]:_0x124117[_0x5888('0x2d')];if(!_0x19d40a[_0x5888('0x2f')][_0x5888('0x35')](_0x5888('0x36'))){_0x404c42[_0x5888('0x1c')]=qs[_0x5888('0x1c')](_0x19d40a[_0x5888('0x2f')][_0x5888('0x1c')]);_0x404c42[_0x5888('0x1b')]=qs[_0x5888('0x1b')](_0x19d40a['query'][_0x5888('0x1b')]);}_0x404c42['order']=qs[_0x5888('0x37')](_0x19d40a[_0x5888('0x2f')][_0x5888('0x37')]);_0x404c42[_0x5888('0x38')]=qs[_0x5888('0x39')](_[_0x5888('0x3a')](_0x19d40a['query'],_0x124117[_0x5888('0x39')]),_0x586473);if(_0x19d40a[_0x5888('0x2f')][_0x5888('0x3b')]){_0x404c42[_0x5888('0x38')]=_['merge'](_0x404c42[_0x5888('0x38')],{'$or':_[_0x5888('0x2e')](_0x586473,function(_0x3b5e1d){if(_0x3b5e1d['type']!==_0x5888('0x3c')){var _0x145823={};_0x145823[_0x3b5e1d[_0x5888('0x26')]]={'$like':'%'+_0x19d40a[_0x5888('0x2f')][_0x5888('0x3b')]+'%'};return _0x145823;}})});}_0x404c42=_[_0x5888('0x3d')]({},_0x404c42,_0x19d40a[_0x5888('0x3e')]);var _0x112526={'where':_0x404c42[_0x5888('0x38')]};return db[_0x5888('0x29')][_0x5888('0x1a')](_0x112526)[_0x5888('0x22')](function(_0x21ae99){_0x5a5ed2[_0x5888('0x1a')]=_0x21ae99;if(_0x19d40a[_0x5888('0x2f')][_0x5888('0x3f')]){_0x404c42['include']=[{'all':!![]}];}return db[_0x5888('0x29')][_0x5888('0x40')](_0x404c42);})[_0x5888('0x22')](function(_0x2e944c){_0x5a5ed2[_0x5888('0x41')]=_0x2e944c;return _0x5a5ed2;})[_0x5888('0x22')](respondWithFilteredResult(_0x4d4087,_0x404c42))[_0x5888('0x42')](handleError(_0x4d4087,null));};exports[_0x5888('0x43')]=function(_0x3ede73,_0x5a2c80){var _0x45c9ac={'raw':!![],'where':{'id':_0x3ede73[_0x5888('0x44')]['id']}},_0x4f8270={};_0x4f8270[_0x5888('0x2d')]=_['keys'](db[_0x5888('0x29')][_0x5888('0x2a')]);_0x4f8270[_0x5888('0x2f')]=_[_0x5888('0x30')](_0x3ede73['query']);_0x4f8270[_0x5888('0x39')]=_[_0x5888('0x31')](_0x4f8270[_0x5888('0x2d')],_0x4f8270[_0x5888('0x2f')]);_0x45c9ac[_0x5888('0x32')]=_[_0x5888('0x31')](_0x4f8270['model'],qs[_0x5888('0x33')](_0x3ede73['query'][_0x5888('0x33')]));_0x45c9ac[_0x5888('0x32')]=_0x45c9ac[_0x5888('0x32')][_0x5888('0x34')]?_0x45c9ac[_0x5888('0x32')]:_0x4f8270[_0x5888('0x2d')];if(_0x3ede73[_0x5888('0x2f')][_0x5888('0x3f')]){_0x45c9ac[_0x5888('0x45')]=[{'all':!![]}];}_0x45c9ac=_['merge']({},_0x45c9ac,_0x3ede73[_0x5888('0x3e')]);return db[_0x5888('0x29')]['find'](_0x45c9ac)[_0x5888('0x22')](handleEntityNotFound(_0x5a2c80,null))[_0x5888('0x22')](respondWithResult(_0x5a2c80,null))['catch'](handleError(_0x5a2c80,null));};exports[_0x5888('0x46')]=function(_0x2fd404,_0x158b30){return db[_0x5888('0x29')][_0x5888('0x46')](_0x2fd404[_0x5888('0x47')],{})[_0x5888('0x22')](respondWithResult(_0x158b30,0xc9))[_0x5888('0x42')](handleError(_0x158b30,null));};exports[_0x5888('0x48')]=function(_0x43d655,_0x1da189){if(_0x43d655[_0x5888('0x47')]['id']){delete _0x43d655[_0x5888('0x47')]['id'];}return db[_0x5888('0x29')][_0x5888('0x49')]({'where':{'id':_0x43d655[_0x5888('0x44')]['id']}})[_0x5888('0x22')](handleEntityNotFound(_0x1da189,null))['then'](saveUpdates(_0x43d655[_0x5888('0x47')],null))[_0x5888('0x22')](respondWithResult(_0x1da189,null))[_0x5888('0x42')](handleError(_0x1da189,null));};exports[_0x5888('0x23')]=function(_0x1fb662,_0x3a5399){return db[_0x5888('0x29')][_0x5888('0x49')]({'where':{'id':_0x1fb662[_0x5888('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a5399,null))[_0x5888('0x22')](removeEntity(_0x3a5399,null))[_0x5888('0x42')](handleError(_0x3a5399,null));};exports[_0x5888('0x4a')]=function(_0x4d1385,_0x2de935){return db[_0x5888('0x29')][_0x5888('0x4a')]()[_0x5888('0x22')](respondWithResult(_0x2de935,null))[_0x5888('0x42')](handleError(_0x2de935,null));}; \ No newline at end of file +var _0xe632=['keys','rawAttributes','fields','find','catch','create','body','destroy','describe','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','status','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','OpenchannelTransferReport','fieldName','type','query','filters','intersection','model','attributes','length','hasOwnProperty','limit','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','show','params'];(function(_0x10cc0d,_0xf9acc3){var _0x8c113c=function(_0x4b58a7){while(--_0x4b58a7){_0x10cc0d['push'](_0x10cc0d['shift']());}};_0x8c113c(++_0xf9acc3);}(_0xe632,0x1d1));var _0x2e63=function(_0x1f78d9,_0x4048ac){_0x1f78d9=_0x1f78d9-0x0;var _0x21e98a=_0xe632[_0x1f78d9];return _0x21e98a;};'use strict';var pdf=require(_0x2e63('0x0'));var emlformat=require(_0x2e63('0x1'));var rimraf=require(_0x2e63('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e63('0x3'));var rp=require(_0x2e63('0x4'));var moment=require(_0x2e63('0x5'));var BPromise=require(_0x2e63('0x6'));var Mustache=require(_0x2e63('0x7'));var util=require(_0x2e63('0x8'));var path=require('path');var sox=require(_0x2e63('0x9'));var csv=require(_0x2e63('0xa'));var ejs=require(_0x2e63('0xb'));var fs=require('fs');var _=require(_0x2e63('0xc'));var squel=require(_0x2e63('0xd'));var crypto=require(_0x2e63('0xe'));var jsforce=require(_0x2e63('0xf'));var deskjs=require(_0x2e63('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2e63('0x11'));var Papa=require(_0x2e63('0x12'));var Redis=require(_0x2e63('0x13'));var authService=require(_0x2e63('0x14'));var qs=require(_0x2e63('0x15'));var as=require(_0x2e63('0x16'));var hardwareService=require(_0x2e63('0x17'));var logger=require(_0x2e63('0x18'))(_0x2e63('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2e63('0x1a'))['db'];function respondWithStatusCode(_0x312d97,_0x8da08){_0x8da08=_0x8da08||0xcc;return function(_0xcc9530){if(_0xcc9530){return _0x312d97[_0x2e63('0x1b')](_0x8da08);}return _0x312d97['status'](_0x8da08)[_0x2e63('0x1c')]();};}function respondWithResult(_0x23ab4d,_0x22d638){_0x22d638=_0x22d638||0xc8;return function(_0x2dff03){if(_0x2dff03){return _0x23ab4d['status'](_0x22d638)[_0x2e63('0x1d')](_0x2dff03);}};}function respondWithFilteredResult(_0x5eb624,_0x2b61d3){return function(_0x4efb90){if(_0x4efb90){var _0x3744bc=_0x4efb90['count'],_0x16cc6c=_0x2b61d3[_0x2e63('0x1e')],_0x42fbf1=_0x2b61d3['offset']+_0x2b61d3['limit'],_0x378d4a;if(_0x42fbf1>=_0x3744bc){_0x42fbf1=_0x3744bc;_0x378d4a=0xc8;}else{_0x378d4a=0xce;}_0x5eb624[_0x2e63('0x1f')](_0x378d4a);return _0x5eb624[_0x2e63('0x20')](_0x2e63('0x21'),_0x16cc6c+'-'+_0x42fbf1+'/'+_0x3744bc)['json'](_0x4efb90);}return null;};}function patchUpdates(_0x72c25b){return function(_0x4c6f67){try{jsonpatch[_0x2e63('0x22')](_0x4c6f67,_0x72c25b,!![]);}catch(_0x5c92b8){return BPromise[_0x2e63('0x23')](_0x5c92b8);}return _0x4c6f67[_0x2e63('0x24')]();};}function saveUpdates(_0x5003f1,_0x48546c){return function(_0x9e436d){if(_0x9e436d){return _0x9e436d[_0x2e63('0x25')](_0x5003f1)[_0x2e63('0x26')](function(_0x466f81){return _0x466f81;});}return null;};}function removeEntity(_0x4a8b6d,_0xb2a7a3){return function(_0x362968){if(_0x362968){return _0x362968['destroy']()['then'](function(){_0x4a8b6d['status'](0xcc)[_0x2e63('0x1c')]();});}};}function handleEntityNotFound(_0x49f390,_0x35d5b5){return function(_0x29b95b){if(!_0x29b95b){_0x49f390[_0x2e63('0x1b')](0x194);}return _0x29b95b;};}function handleError(_0x26c661,_0x347aa8){_0x347aa8=_0x347aa8||0x1f4;return function(_0x244c9d){logger[_0x2e63('0x27')](_0x244c9d['stack']);if(_0x244c9d[_0x2e63('0x28')]){delete _0x244c9d['name'];}_0x26c661[_0x2e63('0x1f')](_0x347aa8)[_0x2e63('0x29')](_0x244c9d);};}exports[_0x2e63('0x2a')]=function(_0x3077b9,_0x86cf71){var _0x174472={},_0x25cf27={},_0x51de7e={'count':0x0,'rows':[]};var _0x5017ba=_[_0x2e63('0x2b')](db[_0x2e63('0x2c')]['rawAttributes'],function(_0x9157f9){return{'name':_0x9157f9[_0x2e63('0x2d')],'type':_0x9157f9[_0x2e63('0x2e')]['key']};});_0x25cf27['model']=_['map'](_0x5017ba,_0x2e63('0x28'));_0x25cf27[_0x2e63('0x2f')]=_['keys'](_0x3077b9[_0x2e63('0x2f')]);_0x25cf27[_0x2e63('0x30')]=_[_0x2e63('0x31')](_0x25cf27[_0x2e63('0x32')],_0x25cf27[_0x2e63('0x2f')]);_0x174472[_0x2e63('0x33')]=_[_0x2e63('0x31')](_0x25cf27[_0x2e63('0x32')],qs['fields'](_0x3077b9['query']['fields']));_0x174472['attributes']=_0x174472[_0x2e63('0x33')][_0x2e63('0x34')]?_0x174472[_0x2e63('0x33')]:_0x25cf27[_0x2e63('0x32')];if(!_0x3077b9[_0x2e63('0x2f')][_0x2e63('0x35')]('nolimit')){_0x174472[_0x2e63('0x36')]=qs['limit'](_0x3077b9[_0x2e63('0x2f')]['limit']);_0x174472[_0x2e63('0x1e')]=qs[_0x2e63('0x1e')](_0x3077b9[_0x2e63('0x2f')][_0x2e63('0x1e')]);}_0x174472['order']=qs[_0x2e63('0x37')](_0x3077b9[_0x2e63('0x2f')]['sort']);_0x174472['where']=qs[_0x2e63('0x30')](_['pick'](_0x3077b9[_0x2e63('0x2f')],_0x25cf27[_0x2e63('0x30')]),_0x5017ba);if(_0x3077b9['query'][_0x2e63('0x38')]){_0x174472[_0x2e63('0x39')]=_[_0x2e63('0x3a')](_0x174472['where'],{'$or':_[_0x2e63('0x2b')](_0x5017ba,function(_0xff69d1){if(_0xff69d1['type']!==_0x2e63('0x3b')){var _0x32390b={};_0x32390b[_0xff69d1[_0x2e63('0x28')]]={'$like':'%'+_0x3077b9[_0x2e63('0x2f')][_0x2e63('0x38')]+'%'};return _0x32390b;}})});}_0x174472=_[_0x2e63('0x3a')]({},_0x174472,_0x3077b9[_0x2e63('0x3c')]);var _0x177fc0={'where':_0x174472[_0x2e63('0x39')]};return db[_0x2e63('0x2c')][_0x2e63('0x3d')](_0x177fc0)[_0x2e63('0x26')](function(_0x100b56){_0x51de7e[_0x2e63('0x3d')]=_0x100b56;if(_0x3077b9[_0x2e63('0x2f')][_0x2e63('0x3e')]){_0x174472[_0x2e63('0x3f')]=[{'all':!![]}];}return db[_0x2e63('0x2c')]['findAll'](_0x174472);})[_0x2e63('0x26')](function(_0x464ed1){_0x51de7e[_0x2e63('0x40')]=_0x464ed1;return _0x51de7e;})[_0x2e63('0x26')](respondWithFilteredResult(_0x86cf71,_0x174472))['catch'](handleError(_0x86cf71,null));};exports[_0x2e63('0x41')]=function(_0x45915c,_0x13520a){var _0x1d97ef={'raw':!![],'where':{'id':_0x45915c[_0x2e63('0x42')]['id']}},_0xdb116b={};_0xdb116b['model']=_[_0x2e63('0x43')](db['OpenchannelTransferReport'][_0x2e63('0x44')]);_0xdb116b['query']=_['keys'](_0x45915c[_0x2e63('0x2f')]);_0xdb116b[_0x2e63('0x30')]=_[_0x2e63('0x31')](_0xdb116b['model'],_0xdb116b[_0x2e63('0x2f')]);_0x1d97ef[_0x2e63('0x33')]=_['intersection'](_0xdb116b[_0x2e63('0x32')],qs[_0x2e63('0x45')](_0x45915c[_0x2e63('0x2f')]['fields']));_0x1d97ef[_0x2e63('0x33')]=_0x1d97ef[_0x2e63('0x33')][_0x2e63('0x34')]?_0x1d97ef[_0x2e63('0x33')]:_0xdb116b[_0x2e63('0x32')];if(_0x45915c[_0x2e63('0x2f')][_0x2e63('0x3e')]){_0x1d97ef[_0x2e63('0x3f')]=[{'all':!![]}];}_0x1d97ef=_[_0x2e63('0x3a')]({},_0x1d97ef,_0x45915c[_0x2e63('0x3c')]);return db[_0x2e63('0x2c')][_0x2e63('0x46')](_0x1d97ef)[_0x2e63('0x26')](handleEntityNotFound(_0x13520a,null))[_0x2e63('0x26')](respondWithResult(_0x13520a,null))[_0x2e63('0x47')](handleError(_0x13520a,null));};exports[_0x2e63('0x48')]=function(_0x5a741f,_0x1637f9){return db[_0x2e63('0x2c')][_0x2e63('0x48')](_0x5a741f[_0x2e63('0x49')],{})[_0x2e63('0x26')](respondWithResult(_0x1637f9,0xc9))['catch'](handleError(_0x1637f9,null));};exports['update']=function(_0x37dc3c,_0x528501){if(_0x37dc3c[_0x2e63('0x49')]['id']){delete _0x37dc3c[_0x2e63('0x49')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x37dc3c[_0x2e63('0x42')]['id']}})['then'](handleEntityNotFound(_0x528501,null))[_0x2e63('0x26')](saveUpdates(_0x37dc3c[_0x2e63('0x49')],null))[_0x2e63('0x26')](respondWithResult(_0x528501,null))[_0x2e63('0x47')](handleError(_0x528501,null));};exports[_0x2e63('0x4a')]=function(_0x1f6316,_0x9becee){return db[_0x2e63('0x2c')]['find']({'where':{'id':_0x1f6316[_0x2e63('0x42')]['id']}})[_0x2e63('0x26')](handleEntityNotFound(_0x9becee,null))[_0x2e63('0x26')](removeEntity(_0x9becee,null))[_0x2e63('0x47')](handleError(_0x9becee,null));};exports[_0x2e63('0x4b')]=function(_0x2c855e,_0x1144ff){return db[_0x2e63('0x2c')][_0x2e63('0x4b')]()[_0x2e63('0x26')](respondWithResult(_0x1144ff,null))[_0x2e63('0x47')](handleError(_0x1144ff,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ca194a1..f82714a 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 _0x62e3=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','request-promise','path','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x62e3,0x1c7));var _0x362e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x362e('0x0'));var util=require(_0x362e('0x1'));var logger=require(_0x362e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x362e('0x3'));var fs=require('fs');var path=require(_0x362e('0x4'));var rimraf=require('rimraf');var config=require(_0x362e('0x5'));var attributes=require(_0x362e('0x6'));module['exports']=function(_0x5491cf,_0x2ed7cb){return _0x5491cf[_0x362e('0x7')](_0x362e('0x8'),attributes,{'tableName':_0x362e('0x9'),'paranoid':![],'indexes':[{'name':_0x362e('0xa'),'fields':[_0x362e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb81=['exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x48914a,_0x228ee5){var _0x26d9f7=function(_0x455496){while(--_0x455496){_0x48914a['push'](_0x48914a['shift']());}};_0x26d9f7(++_0x228ee5);}(_0xeb81,0xba));var _0x1eb8=function(_0x44bcb6,_0x16e9a3){_0x44bcb6=_0x44bcb6-0x0;var _0x49ac0f=_0xeb81[_0x44bcb6];return _0x49ac0f;};'use strict';var _=require(_0x1eb8('0x0'));var util=require(_0x1eb8('0x1'));var logger=require(_0x1eb8('0x2'))(_0x1eb8('0x3'));var moment=require(_0x1eb8('0x4'));var BPromise=require(_0x1eb8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1eb8('0x6'));var rimraf=require(_0x1eb8('0x7'));var config=require(_0x1eb8('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x1eb8('0x9')]=function(_0x4090d2,_0x2b196f){return _0x4090d2[_0x1eb8('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x1eb8('0xb'),'paranoid':![],'indexes':[{'name':_0x1eb8('0xc'),'fields':[_0x1eb8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 0d6e695..b5fc8ab 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 _0x108e=['../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','randomstring'];(function(_0x3be959,_0x18b8f0){var _0x706dd=function(_0x19a2fe){while(--_0x19a2fe){_0x3be959['push'](_0x3be959['shift']());}};_0x706dd(++_0x18b8f0);}(_0x108e,0x141));var _0xe108=function(_0x5c1e8b,_0x4c7eef){_0x5c1e8b=_0x5c1e8b-0x0;var _0x184136=_0x108e[_0x5c1e8b];return _0x184136;};'use strict';var _=require('lodash');var util=require(_0xe108('0x0'));var moment=require(_0xe108('0x1'));var BPromise=require('bluebird');var rs=require(_0xe108('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe108('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe108('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe108('0x5'));var client=jayson[_0xe108('0x6')][_0xe108('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x280efa,_0x3dc105,_0x31ab24){return new BPromise(function(_0xcdd046,_0x1f0046){return client[_0xe108('0x8')](_0x280efa,_0x31ab24)['then'](function(_0x3c2b24){logger[_0xe108('0x9')](_0xe108('0xa'),_0x3dc105,'request\x20sent');logger['debug'](_0xe108('0xb'),_0x3dc105,_0xe108('0xc'),JSON[_0xe108('0xd')](_0x3c2b24));if(_0x3c2b24['error']){if(_0x3c2b24[_0xe108('0xe')][_0xe108('0xf')]===0x1f4){logger[_0xe108('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3dc105,_0x3c2b24['error']['message']);return _0x1f0046(_0x3c2b24[_0xe108('0xe')][_0xe108('0x10')]);}logger[_0xe108('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3dc105,_0x3c2b24['error']['message']);return _0xcdd046(_0x3c2b24['error'][_0xe108('0x10')]);}else{logger[_0xe108('0x9')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3dc105,'request\x20sent');_0xcdd046(_0x3c2b24[_0xe108('0x11')][_0xe108('0x10')]);}})['catch'](function(_0x209541){logger['error'](_0xe108('0xa'),_0x3dc105,_0x209541);_0x1f0046(_0x209541);});});} \ No newline at end of file +var _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xae5094,_0x537f70){var _0x8ebfb7=function(_0x111e11){while(--_0x111e11){_0xae5094['push'](_0xae5094['shift']());}};_0x8ebfb7(++_0x537f70);}(_0xac9d,0x14d));var _0xdac9=function(_0x258d6e,_0x54387b){_0x258d6e=_0x258d6e-0x0;var _0x1654f2=_0xac9d[_0x258d6e];return _0x1654f2;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 449c87b..c98c619 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 _0xed04=['get','isAuthenticated','/:id','show','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9b16c6,_0x24be9c){var _0x21bbd7=function(_0x4feebb){while(--_0x4feebb){_0x9b16c6['push'](_0x9b16c6['shift']());}};_0x21bbd7(++_0x24be9c);}(_0xed04,0x189));var _0x4ed0=function(_0x216b5d,_0xca3a64){_0x216b5d=_0x216b5d-0x0;var _0x403846=_0xed04[_0x216b5d];return _0x403846;};'use strict';var multer=require('multer');var util=require(_0x4ed0('0x0'));var path=require(_0x4ed0('0x1'));var timeout=require(_0x4ed0('0x2'));var express=require('express');var router=express[_0x4ed0('0x3')]();var auth=require(_0x4ed0('0x4'));var interaction=require(_0x4ed0('0x5'));var config=require(_0x4ed0('0x6'));var controller=require('./pause.controller');router[_0x4ed0('0x7')]('/',auth[_0x4ed0('0x8')](),controller['index']);router[_0x4ed0('0x7')](_0x4ed0('0x9'),auth[_0x4ed0('0x8')](),controller[_0x4ed0('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4ed0('0xb')]);router[_0x4ed0('0xc')](_0x4ed0('0x9'),auth[_0x4ed0('0x8')](),controller[_0x4ed0('0xd')]);router[_0x4ed0('0xe')](_0x4ed0('0x9'),auth[_0x4ed0('0x8')](),controller['destroy']);module[_0x4ed0('0xf')]=router; \ No newline at end of file +var _0xaa4b=['update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0xaa4b,0xc1));var _0xbaa4=function(_0xbf4a79,_0x2ce84b){_0xbf4a79=_0xbf4a79-0x0;var _0x4cd0f7=_0xaa4b[_0xbf4a79];return _0x4cd0f7;};'use strict';var multer=require(_0xbaa4('0x0'));var util=require(_0xbaa4('0x1'));var path=require(_0xbaa4('0x2'));var timeout=require(_0xbaa4('0x3'));var express=require(_0xbaa4('0x4'));var router=express['Router']();var auth=require(_0xbaa4('0x5'));var interaction=require(_0xbaa4('0x6'));var config=require(_0xbaa4('0x7'));var controller=require('./pause.controller');router['get']('/',auth[_0xbaa4('0x8')](),controller[_0xbaa4('0x9')]);router[_0xbaa4('0xa')](_0xbaa4('0xb'),auth[_0xbaa4('0x8')](),controller[_0xbaa4('0xc')]);router[_0xbaa4('0xd')]('/',auth[_0xbaa4('0x8')](),controller[_0xbaa4('0xe')]);router[_0xbaa4('0xf')](_0xbaa4('0xb'),auth[_0xbaa4('0x8')](),controller[_0xbaa4('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbaa4('0x11')]);module[_0xbaa4('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 79c3421..7fad020 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 _0x0331=['sequelize','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0331,0xee));var _0x1033=function(_0x5cc51f,_0x22c480){_0x5cc51f=_0x5cc51f-0x0;var _0x315a2f=_0x0331[_0x5cc51f];return _0x315a2f;};'use strict';var Sequelize=require(_0x1033('0x0'));module['exports']={'name':{'type':Sequelize[_0x1033('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x1033('0x1')]}}; \ No newline at end of file +var _0xf188=['STRING','name','sequelize'];(function(_0x1e324e,_0x30be9b){var _0x1c10ec=function(_0x2ec99b){while(--_0x2ec99b){_0x1e324e['push'](_0x1e324e['shift']());}};_0x1c10ec(++_0x30be9b);}(_0xf188,0x137));var _0x8f18=function(_0x23a663,_0x19f7c1){_0x23a663=_0x23a663-0x0;var _0x2e7dd2=_0xf188[_0x23a663];return _0x2e7dd2;};'use strict';var Sequelize=require(_0x8f18('0x0'));module['exports']={'name':{'type':Sequelize[_0x8f18('0x1')],'unique':_0x8f18('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8f18('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index eab2816..632b7ed 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 _0xff57=['key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','type','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','role','Pauses','UserProfileSection','UserProfileResource','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','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','update','then','destroy','get','end','error','stack','name','Pause','rawAttributes','fieldName'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xff57,0x1a9));var _0x7ff5=function(_0x393857,_0x408bb9){_0x393857=_0x393857-0x0;var _0x5da747=_0xff57[_0x393857];return _0x5da747;};'use strict';var pdf=require(_0x7ff5('0x0'));var emlformat=require(_0x7ff5('0x1'));var rimraf=require(_0x7ff5('0x2'));var zipdir=require(_0x7ff5('0x3'));var jsonpatch=require(_0x7ff5('0x4'));var rp=require(_0x7ff5('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7ff5('0x6'));var path=require(_0x7ff5('0x7'));var sox=require(_0x7ff5('0x8'));var csv=require(_0x7ff5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7ff5('0xa'));var squel=require(_0x7ff5('0xb'));var crypto=require(_0x7ff5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7ff5('0xd'));var Papa=require(_0x7ff5('0xe'));var Redis=require(_0x7ff5('0xf'));var authService=require(_0x7ff5('0x10'));var qs=require(_0x7ff5('0x11'));var as=require(_0x7ff5('0x12'));var hardwareService=require(_0x7ff5('0x13'));var logger=require('../../config/logger')(_0x7ff5('0x14'));var utils=require(_0x7ff5('0x15'));var config=require(_0x7ff5('0x16'));var db=require(_0x7ff5('0x17'))['db'];function respondWithStatusCode(_0x4ff269,_0xc0cd49){_0xc0cd49=_0xc0cd49||0xcc;return function(_0x452cc2){if(_0x452cc2){return _0x4ff269[_0x7ff5('0x18')](_0xc0cd49);}return _0x4ff269[_0x7ff5('0x19')](_0xc0cd49)['end']();};}function respondWithResult(_0x94a723,_0xe71e3a){_0xe71e3a=_0xe71e3a||0xc8;return function(_0x445e63){if(_0x445e63){return _0x94a723[_0x7ff5('0x19')](_0xe71e3a)[_0x7ff5('0x1a')](_0x445e63);}};}function respondWithFilteredResult(_0x24bb75,_0x7dfbdc){return function(_0x4c03f2){if(_0x4c03f2){var _0x237eae=_0x4c03f2[_0x7ff5('0x1b')],_0x1dcc4d=_0x7dfbdc[_0x7ff5('0x1c')],_0x1508a5=_0x7dfbdc[_0x7ff5('0x1c')]+_0x7dfbdc[_0x7ff5('0x1d')],_0x19c248;if(_0x1508a5>=_0x237eae){_0x1508a5=_0x237eae;_0x19c248=0xc8;}else{_0x19c248=0xce;}_0x24bb75[_0x7ff5('0x19')](_0x19c248);return _0x24bb75[_0x7ff5('0x1e')](_0x7ff5('0x1f'),_0x1dcc4d+'-'+_0x1508a5+'/'+_0x237eae)[_0x7ff5('0x1a')](_0x4c03f2);}return null;};}function patchUpdates(_0x56829b){return function(_0xbba417){try{jsonpatch['apply'](_0xbba417,_0x56829b,!![]);}catch(_0x1478e6){return BPromise['reject'](_0x1478e6);}return _0xbba417['save']();};}function saveUpdates(_0x31e1ed,_0x530cae){return function(_0x719039){if(_0x719039){return _0x719039[_0x7ff5('0x20')](_0x31e1ed)[_0x7ff5('0x21')](function(_0x3d351c){return _0x3d351c;});}return null;};}function removeEntity(_0x476512,_0x2c095e){return function(_0x2e6f5c){if(_0x2e6f5c){return _0x2e6f5c[_0x7ff5('0x22')]()['then'](function(){var _0xead7b1=_0x2e6f5c[_0x7ff5('0x23')]({'plain':!![]});var _0x14ba04='Pauses';return db['UserProfileResource'][_0x7ff5('0x22')]({'where':{'type':_0x14ba04,'resourceId':_0xead7b1['id']}})[_0x7ff5('0x21')](function(){return _0x2e6f5c;});})[_0x7ff5('0x21')](function(){_0x476512[_0x7ff5('0x19')](0xcc)[_0x7ff5('0x24')]();});}};}function handleEntityNotFound(_0x30a10d,_0x157bfa){return function(_0x1ab56b){if(!_0x1ab56b){_0x30a10d[_0x7ff5('0x18')](0x194);}return _0x1ab56b;};}function handleError(_0x1d2973,_0x249ee5){_0x249ee5=_0x249ee5||0x1f4;return function(_0x1cdc53){logger[_0x7ff5('0x25')](_0x1cdc53[_0x7ff5('0x26')]);if(_0x1cdc53[_0x7ff5('0x27')]){delete _0x1cdc53[_0x7ff5('0x27')];}_0x1d2973[_0x7ff5('0x19')](_0x249ee5)['send'](_0x1cdc53);};}exports['index']=function(_0x1be8e6,_0x4f4058){var _0x58f19a={},_0x16b97c={},_0x2bac2a={'count':0x0,'rows':[]};var _0x161876=_['map'](db[_0x7ff5('0x28')][_0x7ff5('0x29')],function(_0x28cb5f){return{'name':_0x28cb5f[_0x7ff5('0x2a')],'type':_0x28cb5f['type'][_0x7ff5('0x2b')]};});_0x16b97c['model']=_['map'](_0x161876,_0x7ff5('0x27'));_0x16b97c[_0x7ff5('0x2c')]=_[_0x7ff5('0x2d')](_0x1be8e6['query']);_0x16b97c['filters']=_[_0x7ff5('0x2e')](_0x16b97c[_0x7ff5('0x2f')],_0x16b97c['query']);_0x58f19a['attributes']=_[_0x7ff5('0x2e')](_0x16b97c[_0x7ff5('0x2f')],qs[_0x7ff5('0x30')](_0x1be8e6[_0x7ff5('0x2c')]['fields']));_0x58f19a[_0x7ff5('0x31')]=_0x58f19a[_0x7ff5('0x31')][_0x7ff5('0x32')]?_0x58f19a[_0x7ff5('0x31')]:_0x16b97c['model'];if(!_0x1be8e6[_0x7ff5('0x2c')][_0x7ff5('0x33')]('nolimit')){_0x58f19a[_0x7ff5('0x1d')]=qs['limit'](_0x1be8e6[_0x7ff5('0x2c')]['limit']);_0x58f19a['offset']=qs[_0x7ff5('0x1c')](_0x1be8e6[_0x7ff5('0x2c')][_0x7ff5('0x1c')]);}_0x58f19a[_0x7ff5('0x34')]=qs[_0x7ff5('0x35')](_0x1be8e6[_0x7ff5('0x2c')]['sort']);_0x58f19a[_0x7ff5('0x36')]=qs['filters'](_[_0x7ff5('0x37')](_0x1be8e6[_0x7ff5('0x2c')],_0x16b97c[_0x7ff5('0x38')]),_0x161876);if(_0x1be8e6[_0x7ff5('0x2c')][_0x7ff5('0x39')]){_0x58f19a['where']=_[_0x7ff5('0x3a')](_0x58f19a['where'],{'$or':_[_0x7ff5('0x3b')](_0x161876,function(_0x317185){if(_0x317185[_0x7ff5('0x3c')]!==_0x7ff5('0x3d')){var _0x5a4804={};_0x5a4804[_0x317185[_0x7ff5('0x27')]]={'$like':'%'+_0x1be8e6[_0x7ff5('0x2c')][_0x7ff5('0x39')]+'%'};return _0x5a4804;}})});}_0x58f19a=_[_0x7ff5('0x3a')]({},_0x58f19a,_0x1be8e6[_0x7ff5('0x3e')]);var _0x2cd6ca={'where':_0x58f19a[_0x7ff5('0x36')]};return db[_0x7ff5('0x28')][_0x7ff5('0x1b')](_0x2cd6ca)[_0x7ff5('0x21')](function(_0x334f06){_0x2bac2a[_0x7ff5('0x1b')]=_0x334f06;if(_0x1be8e6[_0x7ff5('0x2c')]['includeAll']){_0x58f19a[_0x7ff5('0x3f')]=[{'all':!![]}];}return db[_0x7ff5('0x28')][_0x7ff5('0x40')](_0x58f19a);})[_0x7ff5('0x21')](function(_0x4bae68){_0x2bac2a['rows']=_0x4bae68;return _0x2bac2a;})[_0x7ff5('0x21')](respondWithFilteredResult(_0x4f4058,_0x58f19a))[_0x7ff5('0x41')](handleError(_0x4f4058,null));};exports[_0x7ff5('0x42')]=function(_0x3af0fa,_0x458dd5){var _0xef7d21={'raw':!![],'where':{'id':_0x3af0fa[_0x7ff5('0x43')]['id']}},_0x4e34bd={};_0x4e34bd[_0x7ff5('0x2f')]=_[_0x7ff5('0x2d')](db[_0x7ff5('0x28')][_0x7ff5('0x29')]);_0x4e34bd[_0x7ff5('0x2c')]=_[_0x7ff5('0x2d')](_0x3af0fa[_0x7ff5('0x2c')]);_0x4e34bd[_0x7ff5('0x38')]=_['intersection'](_0x4e34bd['model'],_0x4e34bd[_0x7ff5('0x2c')]);_0xef7d21[_0x7ff5('0x31')]=_[_0x7ff5('0x2e')](_0x4e34bd[_0x7ff5('0x2f')],qs[_0x7ff5('0x30')](_0x3af0fa['query'][_0x7ff5('0x30')]));_0xef7d21[_0x7ff5('0x31')]=_0xef7d21['attributes'][_0x7ff5('0x32')]?_0xef7d21[_0x7ff5('0x31')]:_0x4e34bd[_0x7ff5('0x2f')];if(_0x3af0fa[_0x7ff5('0x2c')][_0x7ff5('0x44')]){_0xef7d21['include']=[{'all':!![]}];}_0xef7d21=_[_0x7ff5('0x3a')]({},_0xef7d21,_0x3af0fa[_0x7ff5('0x3e')]);return db[_0x7ff5('0x28')][_0x7ff5('0x45')](_0xef7d21)[_0x7ff5('0x21')](handleEntityNotFound(_0x458dd5,null))[_0x7ff5('0x21')](respondWithResult(_0x458dd5,null))['catch'](handleError(_0x458dd5,null));};exports[_0x7ff5('0x46')]=function(_0x23e623,_0x1f17d7){return db['Pause'][_0x7ff5('0x46')](_0x23e623[_0x7ff5('0x47')],{})[_0x7ff5('0x21')](function(_0x5c8940){var _0x36b34e=_0x23e623[_0x7ff5('0x48')][_0x7ff5('0x23')]({'plain':!![]});if(!_0x36b34e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36b34e[_0x7ff5('0x49')]===_0x7ff5('0x48')){var _0x9b33bc=_0x5c8940['get']({'plain':!![]});var _0xb553c1=_0x7ff5('0x4a');return db[_0x7ff5('0x4b')][_0x7ff5('0x45')]({'where':{'name':_0xb553c1,'userProfileId':_0x36b34e['userProfileId']},'raw':!![]})[_0x7ff5('0x21')](function(_0x44fc47){if(_0x44fc47&&_0x44fc47['autoAssociation']===0x0){return db[_0x7ff5('0x4c')]['create']({'name':_0x9b33bc['name'],'resourceId':_0x9b33bc['id'],'type':_0x44fc47[_0x7ff5('0x27')],'sectionId':_0x44fc47['id']},{})[_0x7ff5('0x21')](function(){return _0x5c8940;});}else{return _0x5c8940;}})[_0x7ff5('0x41')](function(_0x10cf3d){logger[_0x7ff5('0x25')](_0x7ff5('0x4d'),_0x10cf3d);throw _0x10cf3d;});}return _0x5c8940;})[_0x7ff5('0x21')](respondWithResult(_0x1f17d7,0xc9))['catch'](handleError(_0x1f17d7,null));};exports['update']=function(_0x405438,_0xa6359){if(_0x405438['body']['id']){delete _0x405438['body']['id'];}return db[_0x7ff5('0x28')][_0x7ff5('0x45')]({'where':{'id':_0x405438[_0x7ff5('0x43')]['id']}})['then'](handleEntityNotFound(_0xa6359,null))[_0x7ff5('0x21')](saveUpdates(_0x405438[_0x7ff5('0x47')],null))[_0x7ff5('0x21')](respondWithResult(_0xa6359,null))[_0x7ff5('0x41')](handleError(_0xa6359,null));};exports[_0x7ff5('0x22')]=function(_0x52d526,_0x204f71){return db['Pause'][_0x7ff5('0x45')]({'where':{'id':_0x52d526[_0x7ff5('0x43')]['id']}})[_0x7ff5('0x21')](handleEntityNotFound(_0x204f71,null))[_0x7ff5('0x21')](removeEntity(_0x204f71,null))[_0x7ff5('0x41')](handleError(_0x204f71,null));}; \ No newline at end of file +var _0x55fd=['map','Pause','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','status','end','sendStatus','error','stack','send','index'];(function(_0x1f5f21,_0x51c1da){var _0x1ca241=function(_0x35a554){while(--_0x35a554){_0x1f5f21['push'](_0x1f5f21['shift']());}};_0x1ca241(++_0x51c1da);}(_0x55fd,0x1d2));var _0xd55f=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x55fd[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0xd55f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd55f('0x1'));var zipdir=require(_0xd55f('0x2'));var jsonpatch=require(_0xd55f('0x3'));var rp=require(_0xd55f('0x4'));var moment=require('moment');var BPromise=require(_0xd55f('0x5'));var Mustache=require(_0xd55f('0x6'));var util=require(_0xd55f('0x7'));var path=require('path');var sox=require(_0xd55f('0x8'));var csv=require('to-csv');var ejs=require(_0xd55f('0x9'));var fs=require('fs');var _=require(_0xd55f('0xa'));var squel=require(_0xd55f('0xb'));var crypto=require('crypto');var jsforce=require(_0xd55f('0xc'));var deskjs=require(_0xd55f('0xd'));var toCsv=require(_0xd55f('0xe'));var querystring=require(_0xd55f('0xf'));var Papa=require('papaparse');var Redis=require(_0xd55f('0x10'));var authService=require(_0xd55f('0x11'));var qs=require(_0xd55f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd55f('0x13'));var utils=require(_0xd55f('0x14'));var config=require(_0xd55f('0x15'));var db=require(_0xd55f('0x16'))['db'];function respondWithStatusCode(_0x3be37e,_0x3e797f){_0x3e797f=_0x3e797f||0xcc;return function(_0x492ddb){if(_0x492ddb){return _0x3be37e['sendStatus'](_0x3e797f);}return _0x3be37e['status'](_0x3e797f)['end']();};}function respondWithResult(_0x234116,_0x160f15){_0x160f15=_0x160f15||0xc8;return function(_0x486c29){if(_0x486c29){return _0x234116['status'](_0x160f15)[_0xd55f('0x17')](_0x486c29);}};}function respondWithFilteredResult(_0x6962c1,_0x53e6ae){return function(_0x3549ae){if(_0x3549ae){var _0x471cbc=_0x3549ae['count'],_0x42fb04=_0x53e6ae[_0xd55f('0x18')],_0x1b5d0c=_0x53e6ae['offset']+_0x53e6ae[_0xd55f('0x19')],_0x405582;if(_0x1b5d0c>=_0x471cbc){_0x1b5d0c=_0x471cbc;_0x405582=0xc8;}else{_0x405582=0xce;}_0x6962c1['status'](_0x405582);return _0x6962c1[_0xd55f('0x1a')](_0xd55f('0x1b'),_0x42fb04+'-'+_0x1b5d0c+'/'+_0x471cbc)[_0xd55f('0x17')](_0x3549ae);}return null;};}function patchUpdates(_0x4f325e){return function(_0x2e84e7){try{jsonpatch[_0xd55f('0x1c')](_0x2e84e7,_0x4f325e,!![]);}catch(_0x511279){return BPromise[_0xd55f('0x1d')](_0x511279);}return _0x2e84e7[_0xd55f('0x1e')]();};}function saveUpdates(_0x30f9fd,_0x250167){return function(_0x1a86ce){if(_0x1a86ce){return _0x1a86ce[_0xd55f('0x1f')](_0x30f9fd)[_0xd55f('0x20')](function(_0x4dd370){return _0x4dd370;});}return null;};}function removeEntity(_0x3a3eb1,_0x240a98){return function(_0x30aaa3){if(_0x30aaa3){return _0x30aaa3[_0xd55f('0x21')]()[_0xd55f('0x20')](function(){var _0x133c7c=_0x30aaa3[_0xd55f('0x22')]({'plain':!![]});var _0x4ed847=_0xd55f('0x23');return db[_0xd55f('0x24')][_0xd55f('0x21')]({'where':{'type':_0x4ed847,'resourceId':_0x133c7c['id']}})[_0xd55f('0x20')](function(){return _0x30aaa3;});})['then'](function(){_0x3a3eb1[_0xd55f('0x25')](0xcc)[_0xd55f('0x26')]();});}};}function handleEntityNotFound(_0x53325f,_0x3292cc){return function(_0x445ade){if(!_0x445ade){_0x53325f[_0xd55f('0x27')](0x194);}return _0x445ade;};}function handleError(_0x4b0c57,_0x403df7){_0x403df7=_0x403df7||0x1f4;return function(_0xd72dc1){logger[_0xd55f('0x28')](_0xd72dc1[_0xd55f('0x29')]);if(_0xd72dc1['name']){delete _0xd72dc1['name'];}_0x4b0c57[_0xd55f('0x25')](_0x403df7)[_0xd55f('0x2a')](_0xd72dc1);};}exports[_0xd55f('0x2b')]=function(_0x18ee14,_0x2fa8ab){var _0x3c1915={},_0x81f0b4={},_0x541a13={'count':0x0,'rows':[]};var _0x117af0=_[_0xd55f('0x2c')](db[_0xd55f('0x2d')][_0xd55f('0x2e')],function(_0x5c1f7e){return{'name':_0x5c1f7e[_0xd55f('0x2f')],'type':_0x5c1f7e[_0xd55f('0x30')][_0xd55f('0x31')]};});_0x81f0b4[_0xd55f('0x32')]=_[_0xd55f('0x2c')](_0x117af0,'name');_0x81f0b4[_0xd55f('0x33')]=_['keys'](_0x18ee14[_0xd55f('0x33')]);_0x81f0b4['filters']=_[_0xd55f('0x34')](_0x81f0b4[_0xd55f('0x32')],_0x81f0b4[_0xd55f('0x33')]);_0x3c1915[_0xd55f('0x35')]=_[_0xd55f('0x34')](_0x81f0b4[_0xd55f('0x32')],qs[_0xd55f('0x36')](_0x18ee14[_0xd55f('0x33')][_0xd55f('0x36')]));_0x3c1915[_0xd55f('0x35')]=_0x3c1915[_0xd55f('0x35')][_0xd55f('0x37')]?_0x3c1915[_0xd55f('0x35')]:_0x81f0b4[_0xd55f('0x32')];if(!_0x18ee14[_0xd55f('0x33')]['hasOwnProperty'](_0xd55f('0x38'))){_0x3c1915[_0xd55f('0x19')]=qs['limit'](_0x18ee14[_0xd55f('0x33')]['limit']);_0x3c1915[_0xd55f('0x18')]=qs[_0xd55f('0x18')](_0x18ee14[_0xd55f('0x33')][_0xd55f('0x18')]);}_0x3c1915['order']=qs[_0xd55f('0x39')](_0x18ee14[_0xd55f('0x33')][_0xd55f('0x39')]);_0x3c1915['where']=qs[_0xd55f('0x3a')](_[_0xd55f('0x3b')](_0x18ee14[_0xd55f('0x33')],_0x81f0b4[_0xd55f('0x3a')]),_0x117af0);if(_0x18ee14['query'][_0xd55f('0x3c')]){_0x3c1915[_0xd55f('0x3d')]=_[_0xd55f('0x3e')](_0x3c1915[_0xd55f('0x3d')],{'$or':_[_0xd55f('0x2c')](_0x117af0,function(_0x3a0ceb){if(_0x3a0ceb['type']!==_0xd55f('0x3f')){var _0x1f787f={};_0x1f787f[_0x3a0ceb['name']]={'$like':'%'+_0x18ee14[_0xd55f('0x33')][_0xd55f('0x3c')]+'%'};return _0x1f787f;}})});}_0x3c1915=_[_0xd55f('0x3e')]({},_0x3c1915,_0x18ee14[_0xd55f('0x40')]);var _0x29ea11={'where':_0x3c1915[_0xd55f('0x3d')]};return db[_0xd55f('0x2d')][_0xd55f('0x41')](_0x29ea11)['then'](function(_0x484922){_0x541a13['count']=_0x484922;if(_0x18ee14[_0xd55f('0x33')][_0xd55f('0x42')]){_0x3c1915[_0xd55f('0x43')]=[{'all':!![]}];}return db[_0xd55f('0x2d')][_0xd55f('0x44')](_0x3c1915);})[_0xd55f('0x20')](function(_0x2f641a){_0x541a13[_0xd55f('0x45')]=_0x2f641a;return _0x541a13;})[_0xd55f('0x20')](respondWithFilteredResult(_0x2fa8ab,_0x3c1915))[_0xd55f('0x46')](handleError(_0x2fa8ab,null));};exports[_0xd55f('0x47')]=function(_0x31feca,_0x565c4b){var _0x441e94={'raw':!![],'where':{'id':_0x31feca[_0xd55f('0x48')]['id']}},_0xb6576d={};_0xb6576d[_0xd55f('0x32')]=_[_0xd55f('0x49')](db['Pause'][_0xd55f('0x2e')]);_0xb6576d[_0xd55f('0x33')]=_[_0xd55f('0x49')](_0x31feca[_0xd55f('0x33')]);_0xb6576d[_0xd55f('0x3a')]=_[_0xd55f('0x34')](_0xb6576d[_0xd55f('0x32')],_0xb6576d[_0xd55f('0x33')]);_0x441e94[_0xd55f('0x35')]=_['intersection'](_0xb6576d[_0xd55f('0x32')],qs[_0xd55f('0x36')](_0x31feca[_0xd55f('0x33')][_0xd55f('0x36')]));_0x441e94[_0xd55f('0x35')]=_0x441e94['attributes']['length']?_0x441e94[_0xd55f('0x35')]:_0xb6576d[_0xd55f('0x32')];if(_0x31feca['query'][_0xd55f('0x42')]){_0x441e94[_0xd55f('0x43')]=[{'all':!![]}];}_0x441e94=_[_0xd55f('0x3e')]({},_0x441e94,_0x31feca[_0xd55f('0x40')]);return db['Pause'][_0xd55f('0x4a')](_0x441e94)['then'](handleEntityNotFound(_0x565c4b,null))['then'](respondWithResult(_0x565c4b,null))[_0xd55f('0x46')](handleError(_0x565c4b,null));};exports[_0xd55f('0x4b')]=function(_0x34d91b,_0x4e3482){return db[_0xd55f('0x2d')]['create'](_0x34d91b[_0xd55f('0x4c')],{})[_0xd55f('0x20')](function(_0x47e546){var _0x2cf82c=_0x34d91b[_0xd55f('0x4d')][_0xd55f('0x22')]({'plain':!![]});if(!_0x2cf82c)throw new Error(_0xd55f('0x4e'));if(_0x2cf82c[_0xd55f('0x4f')]===_0xd55f('0x4d')){var _0x2622e1=_0x47e546['get']({'plain':!![]});var _0x5e1fe5=_0xd55f('0x23');return db[_0xd55f('0x50')][_0xd55f('0x4a')]({'where':{'name':_0x5e1fe5,'userProfileId':_0x2cf82c[_0xd55f('0x51')]},'raw':!![]})[_0xd55f('0x20')](function(_0xa98c51){if(_0xa98c51&&_0xa98c51[_0xd55f('0x52')]===0x0){return db[_0xd55f('0x24')][_0xd55f('0x4b')]({'name':_0x2622e1[_0xd55f('0x53')],'resourceId':_0x2622e1['id'],'type':_0xa98c51[_0xd55f('0x53')],'sectionId':_0xa98c51['id']},{})[_0xd55f('0x20')](function(){return _0x47e546;});}else{return _0x47e546;}})[_0xd55f('0x46')](function(_0x345504){logger[_0xd55f('0x28')](_0xd55f('0x54'),_0x345504);throw _0x345504;});}return _0x47e546;})[_0xd55f('0x20')](respondWithResult(_0x4e3482,0xc9))[_0xd55f('0x46')](handleError(_0x4e3482,null));};exports['update']=function(_0x2b1eb7,_0x725284){if(_0x2b1eb7['body']['id']){delete _0x2b1eb7['body']['id'];}return db['Pause'][_0xd55f('0x4a')]({'where':{'id':_0x2b1eb7[_0xd55f('0x48')]['id']}})[_0xd55f('0x20')](handleEntityNotFound(_0x725284,null))[_0xd55f('0x20')](saveUpdates(_0x2b1eb7[_0xd55f('0x4c')],null))[_0xd55f('0x20')](respondWithResult(_0x725284,null))[_0xd55f('0x46')](handleError(_0x725284,null));};exports[_0xd55f('0x21')]=function(_0x2f955b,_0x52dc06){return db[_0xd55f('0x2d')]['find']({'where':{'id':_0x2f955b[_0xd55f('0x48')]['id']}})['then'](handleEntityNotFound(_0x52dc06,null))[_0xd55f('0x20')](removeEntity(_0x52dc06,null))['catch'](handleError(_0x52dc06,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b8143e4..cf9316b 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 _0x9d5b=['exports','Pause','tools_pauses','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./pause.attributes'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x116a06,_0x5826ee){_0x116a06=_0x116a06-0x0;var _0x3a962a=_0x9d5b[_0x116a06];return _0x3a962a;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var logger=require(_0xb9d5('0x1'))(_0xb9d5('0x2'));var moment=require(_0xb9d5('0x3'));var BPromise=require(_0xb9d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9d5('0x5'));var rimraf=require('rimraf');var config=require(_0xb9d5('0x6'));var attributes=require(_0xb9d5('0x7'));module[_0xb9d5('0x8')]=function(_0x39d8fe,_0x422a92){return _0x39d8fe['define'](_0xb9d5('0x9'),attributes,{'tableName':_0xb9d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0972=['util','api','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x0972,0x64));var _0x2097=function(_0x5c6528,_0x50f5dc){_0x5c6528=_0x5c6528-0x0;var _0x16b3b5=_0x0972[_0x5c6528];return _0x16b3b5;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var logger=require('../../config/logger')(_0x2097('0x1'));var moment=require('moment');var BPromise=require(_0x2097('0x2'));var rp=require(_0x2097('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var attributes=require(_0x2097('0x6'));module[_0x2097('0x7')]=function(_0x2f84d8,_0x11ed13){return _0x2f84d8[_0x2097('0x8')]('Pause',attributes,{'tableName':_0x2097('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 0b3d75a..1e5c0ff 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 _0x2445=['ShowPause','Pause','find','options','where','attributes','map','include','model','catch','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2445,0xfa));var _0x5244=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2445[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5244('0x0'));var util=require(_0x5244('0x1'));var moment=require(_0x5244('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5244('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5244('0x4'));var logger=require('../../config/logger')(_0x5244('0x5'));var config=require('../../config/environment');var jayson=require(_0x5244('0x6'));var client=jayson[_0x5244('0x7')][_0x5244('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4217f3,_0x201a87,_0x8a9863){return new BPromise(function(_0x33ba9a,_0x246e02){return client['request'](_0x4217f3,_0x8a9863)[_0x5244('0x9')](function(_0x25a1c1){logger[_0x5244('0xa')]('Pause,\x20%s,\x20%s',_0x201a87,_0x5244('0xb'));logger[_0x5244('0xc')](_0x5244('0xd'),_0x201a87,_0x5244('0xb'),JSON[_0x5244('0xe')](_0x25a1c1));if(_0x25a1c1[_0x5244('0xf')]){if(_0x25a1c1[_0x5244('0xf')][_0x5244('0x10')]===0x1f4){logger[_0x5244('0xf')](_0x5244('0x11'),_0x201a87,_0x25a1c1['error'][_0x5244('0x12')]);return _0x246e02(_0x25a1c1[_0x5244('0xf')][_0x5244('0x12')]);}logger[_0x5244('0xf')](_0x5244('0x11'),_0x201a87,_0x25a1c1[_0x5244('0xf')][_0x5244('0x12')]);return _0x33ba9a(_0x25a1c1[_0x5244('0xf')]['message']);}else{logger['info'](_0x5244('0x11'),_0x201a87,'request\x20sent');_0x33ba9a(_0x25a1c1[_0x5244('0x13')]['message']);}})['catch'](function(_0x163a55){logger[_0x5244('0xf')](_0x5244('0x11'),_0x201a87,_0x163a55);_0x246e02(_0x163a55);});});}exports[_0x5244('0x14')]=function(_0x46110a){var _0x2fc520=this;return new Promise(function(_0x275ce3,_0x237240){return db[_0x5244('0x15')][_0x5244('0x16')]({'raw':_0x46110a[_0x5244('0x17')]?_0x46110a['options']['raw']===undefined?!![]:![]:!![],'where':_0x46110a[_0x5244('0x17')]?_0x46110a[_0x5244('0x17')][_0x5244('0x18')]||null:null,'attributes':_0x46110a[_0x5244('0x17')]?_0x46110a[_0x5244('0x17')][_0x5244('0x19')]||null:null,'include':_0x46110a[_0x5244('0x17')]?_0x46110a[_0x5244('0x17')]['include']?_[_0x5244('0x1a')](_0x46110a['options'][_0x5244('0x1b')],function(_0x9acdcf){return{'model':db[_0x9acdcf[_0x5244('0x1c')]],'as':_0x9acdcf['as'],'attributes':_0x9acdcf[_0x5244('0x19')],'include':_0x9acdcf[_0x5244('0x1b')]?_[_0x5244('0x1a')](_0x9acdcf[_0x5244('0x1b')],function(_0x3be841){return{'model':db[_0x3be841[_0x5244('0x1c')]],'as':_0x3be841['as'],'attributes':_0x3be841['attributes'],'include':_0x3be841[_0x5244('0x1b')]?_[_0x5244('0x1a')](_0x3be841[_0x5244('0x1b')],function(_0x257cce){return{'model':db[_0x257cce[_0x5244('0x1c')]],'as':_0x257cce['as'],'attributes':_0x257cce[_0x5244('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f497c){logger[_0x5244('0xa')]('ShowPause',_0x46110a);logger[_0x5244('0xc')]('ShowPause',_0x46110a,JSON[_0x5244('0xe')](_0x3f497c));_0x275ce3(_0x3f497c);})[_0x5244('0x1d')](function(_0x295ae8){logger['error'](_0x5244('0x14'),_0x295ae8['message'],_0x46110a);_0x237240(_0x2fc520[_0x5244('0xf')](0x1f4,_0x295ae8[_0x5244('0x12')]));});});}; \ No newline at end of file +var _0xb6ec=['jayson/promise','client','http','request','then','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowPause','Pause','options','where','include','map','model','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0xc63bb1,_0x2ee44d){var _0xf15970=function(_0xc3e556){while(--_0xc3e556){_0xc63bb1['push'](_0xc63bb1['shift']());}};_0xf15970(++_0x2ee44d);}(_0xb6ec,0x74));var _0xcb6e=function(_0x1dbfc3,_0x3d7c5e){_0x1dbfc3=_0x1dbfc3-0x0;var _0x3f71cc=_0xb6ec[_0x1dbfc3];return _0x3f71cc;};'use strict';var _=require(_0xcb6e('0x0'));var util=require(_0xcb6e('0x1'));var moment=require(_0xcb6e('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb6e('0x3'));var fs=require('fs');var Redis=require(_0xcb6e('0x4'));var db=require(_0xcb6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb6e('0x6'))('rpc');var config=require(_0xcb6e('0x7'));var jayson=require(_0xcb6e('0x8'));var client=jayson[_0xcb6e('0x9')][_0xcb6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15f63e,_0x55104c,_0x53f924){return new BPromise(function(_0x565965,_0x1ce8fe){return client[_0xcb6e('0xb')](_0x15f63e,_0x53f924)[_0xcb6e('0xc')](function(_0x1d83d1){logger['info'](_0xcb6e('0xd'),_0x55104c,_0xcb6e('0xe'));logger['debug'](_0xcb6e('0xf'),_0x55104c,'request\x20sent',JSON[_0xcb6e('0x10')](_0x1d83d1));if(_0x1d83d1['error']){if(_0x1d83d1[_0xcb6e('0x11')][_0xcb6e('0x12')]===0x1f4){logger[_0xcb6e('0x11')](_0xcb6e('0xd'),_0x55104c,_0x1d83d1[_0xcb6e('0x11')][_0xcb6e('0x13')]);return _0x1ce8fe(_0x1d83d1[_0xcb6e('0x11')]['message']);}logger['error']('Pause,\x20%s,\x20%s',_0x55104c,_0x1d83d1[_0xcb6e('0x11')]['message']);return _0x565965(_0x1d83d1['error'][_0xcb6e('0x13')]);}else{logger[_0xcb6e('0x14')](_0xcb6e('0xd'),_0x55104c,'request\x20sent');_0x565965(_0x1d83d1[_0xcb6e('0x15')]['message']);}})[_0xcb6e('0x16')](function(_0x45c99e){logger[_0xcb6e('0x11')](_0xcb6e('0xd'),_0x55104c,_0x45c99e);_0x1ce8fe(_0x45c99e);});});}exports[_0xcb6e('0x17')]=function(_0x29718e){var _0x4fb800=this;return new Promise(function(_0xdcae5f,_0x2b6583){return db[_0xcb6e('0x18')]['find']({'raw':_0x29718e[_0xcb6e('0x19')]?_0x29718e[_0xcb6e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x29718e[_0xcb6e('0x19')]?_0x29718e[_0xcb6e('0x19')][_0xcb6e('0x1a')]||null:null,'attributes':_0x29718e[_0xcb6e('0x19')]?_0x29718e[_0xcb6e('0x19')]['attributes']||null:null,'include':_0x29718e[_0xcb6e('0x19')]?_0x29718e[_0xcb6e('0x19')][_0xcb6e('0x1b')]?_[_0xcb6e('0x1c')](_0x29718e[_0xcb6e('0x19')][_0xcb6e('0x1b')],function(_0x3d22fd){return{'model':db[_0x3d22fd[_0xcb6e('0x1d')]],'as':_0x3d22fd['as'],'attributes':_0x3d22fd[_0xcb6e('0x1e')],'include':_0x3d22fd[_0xcb6e('0x1b')]?_[_0xcb6e('0x1c')](_0x3d22fd['include'],function(_0x1d7b01){return{'model':db[_0x1d7b01[_0xcb6e('0x1d')]],'as':_0x1d7b01['as'],'attributes':_0x1d7b01[_0xcb6e('0x1e')],'include':_0x1d7b01[_0xcb6e('0x1b')]?_[_0xcb6e('0x1c')](_0x1d7b01[_0xcb6e('0x1b')],function(_0x4e2310){return{'model':db[_0x4e2310[_0xcb6e('0x1d')]],'as':_0x4e2310['as'],'attributes':_0x4e2310[_0xcb6e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181111){logger[_0xcb6e('0x14')](_0xcb6e('0x17'),_0x29718e);logger['debug'](_0xcb6e('0x17'),_0x29718e,JSON[_0xcb6e('0x10')](_0x181111));_0xdcae5f(_0x181111);})[_0xcb6e('0x16')](function(_0x1a15ec){logger[_0xcb6e('0x11')]('ShowPause',_0x1a15ec[_0xcb6e('0x13')],_0x29718e);_0x2b6583(_0x4fb800[_0xcb6e('0x11')](0x1f4,_0x1a15ec[_0xcb6e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e73863f..4f3c1c2 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 _0x7a93=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','download','diskStorage','root','originalname','replace','format','basename','extname','post','file','upload','webhookPost','put','update','delete','exports','path','connect-timeout','../../components/interaction/service'];(function(_0x655b91,_0x22bc60){var _0x58924a=function(_0x3c5a74){while(--_0x3c5a74){_0x655b91['push'](_0x655b91['shift']());}};_0x58924a(++_0x22bc60);}(_0x7a93,0x10b));var _0x37a9=function(_0x57835c,_0x53398e){_0x57835c=_0x57835c-0x0;var _0x26d259=_0x7a93[_0x57835c];return _0x26d259;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x37a9('0x0'));var timeout=require(_0x37a9('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x37a9('0x2'));var config=require(_0x37a9('0x3'));var controller=require(_0x37a9('0x4'));router[_0x37a9('0x5')]('/',auth[_0x37a9('0x6')](),controller[_0x37a9('0x7')]);router['get'](_0x37a9('0x8'),controller['webhookGet']);router[_0x37a9('0x5')](_0x37a9('0x9'),auth['isAuthenticated'](),controller[_0x37a9('0xa')]);router[_0x37a9('0x5')]('/:id/download',auth[_0x37a9('0x6')](),controller[_0x37a9('0xb')]);var upload=multer({'storage':multer[_0x37a9('0xc')]({'destination':function(_0x189fa6,_0x3baa06,_0x5da3e7){_0x5da3e7(null,path['join'](config[_0x37a9('0xd')],'server/files/plugins'));},'filename':function(_0x568fc9,_0xb691a2,_0x44ad91){_0xb691a2[_0x37a9('0xe')]=_0xb691a2[_0x37a9('0xe')][_0x37a9('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x44ad91(null,util[_0x37a9('0x10')]('%s-%s%s',path[_0x37a9('0x11')](_0xb691a2['originalname'],path[_0x37a9('0x12')](_0xb691a2[_0x37a9('0xe')])),Date['now'](),path[_0x37a9('0x12')](_0xb691a2['originalname'])));}})});router[_0x37a9('0x13')]('/',upload['single'](_0x37a9('0x14')),controller[_0x37a9('0x15')]);router[_0x37a9('0x13')]('/webhook',controller[_0x37a9('0x16')]);router[_0x37a9('0x17')](_0x37a9('0x9'),auth['isAuthenticated'](),controller[_0x37a9('0x18')]);router[_0x37a9('0x19')](_0x37a9('0x9'),auth['isAuthenticated'](),controller[_0x37a9('0x19')]);module[_0x37a9('0x1a')]=router; \ No newline at end of file +var _0xe2fe=['now','post','single','file','webhookPost','update','delete','/:id','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/webhook','show','/:id/download','download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname'];(function(_0x405a85,_0x128e2c){var _0x4a0c4f=function(_0x16cf46){while(--_0x16cf46){_0x405a85['push'](_0x405a85['shift']());}};_0x4a0c4f(++_0x128e2c);}(_0xe2fe,0x19c));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require(_0xee2f('0x1'));var path=require(_0xee2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xee2f('0x3'));var router=express[_0xee2f('0x4')]();var auth=require(_0xee2f('0x5'));var interaction=require(_0xee2f('0x6'));var config=require(_0xee2f('0x7'));var controller=require('./plugin.controller');router['get']('/',auth[_0xee2f('0x8')](),controller[_0xee2f('0x9')]);router['get'](_0xee2f('0xa'),controller['webhookGet']);router['get']('/:id',auth[_0xee2f('0x8')](),controller[_0xee2f('0xb')]);router['get'](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);var upload=multer({'storage':multer[_0xee2f('0xe')]({'destination':function(_0x2d3266,_0x2e7e82,_0x53a826){_0x53a826(null,path['join'](config[_0xee2f('0xf')],'server/files/plugins'));},'filename':function(_0x46c112,_0x3c28bd,_0x38427d){_0x3c28bd['originalname']=_0x3c28bd[_0xee2f('0x10')][_0xee2f('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38427d(null,util[_0xee2f('0x12')](_0xee2f('0x13'),path[_0xee2f('0x14')](_0x3c28bd[_0xee2f('0x10')],path[_0xee2f('0x15')](_0x3c28bd[_0xee2f('0x10')])),Date[_0xee2f('0x16')](),path[_0xee2f('0x15')](_0x3c28bd[_0xee2f('0x10')])));}})});router[_0xee2f('0x17')]('/',upload[_0xee2f('0x18')](_0xee2f('0x19')),controller['upload']);router[_0xee2f('0x17')](_0xee2f('0xa'),controller[_0xee2f('0x1a')]);router['put']('/:id',auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0x1d'),auth['isAuthenticated'](),controller[_0xee2f('0x1c')]);module[_0xee2f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 4226c42..9a25a7b 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 _0x07b7=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x1a6eab,_0x2bd199){var _0x1a7441=function(_0xd73b46){while(--_0xd73b46){_0x1a6eab['push'](_0x1a6eab['shift']());}};_0x1a7441(++_0x2bd199);}(_0x07b7,0x1d9));var _0x707b=function(_0x2deaee,_0x3de6c9){_0x2deaee=_0x2deaee-0x0;var _0x306c4b=_0x07b7[_0x2deaee];return _0x306c4b;};'use strict';var Sequelize=require(_0x707b('0x0'));module[_0x707b('0x1')]={'name':{'type':Sequelize[_0x707b('0x2')]},'type':{'type':Sequelize[_0x707b('0x3')]('html','script')},'description':{'type':Sequelize[_0x707b('0x4')]},'version':{'type':Sequelize[_0x707b('0x4')]},'path':{'type':Sequelize[_0x707b('0x2')],'comment':_0x707b('0x5')},'active':{'type':Sequelize[_0x707b('0x6')],'defaultValue':0x0,'comment':_0x707b('0x7')},'sidebar':{'type':Sequelize[_0x707b('0x3')](_0x707b('0x8'),_0x707b('0x9'),_0x707b('0xa'),_0x707b('0xb')),'defaultValue':_0x707b('0xa'),'comment':_0x707b('0xc')},'icon':{'type':Sequelize[_0x707b('0x2')]},'adminUrl':{'type':Sequelize[_0x707b('0x2')]},'agentUrl':{'type':Sequelize[_0x707b('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x707b('0x2')]}}; \ No newline at end of file +var _0xca1d=['html','TEXT','BOOLEAN','ENUM','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x54a56e,_0x2c330d){var _0x5e08db=function(_0x569ca8){while(--_0x569ca8){_0x54a56e['push'](_0x54a56e['shift']());}};_0x5e08db(++_0x2c330d);}(_0xca1d,0x73));var _0xdca1=function(_0x2b8dac,_0x24e895){_0x2b8dac=_0x2b8dac-0x0;var _0x7efe52=_0xca1d[_0x2b8dac];return _0x7efe52;};'use strict';var Sequelize=require(_0xdca1('0x0'));module['exports']={'name':{'type':Sequelize[_0xdca1('0x1')]},'type':{'type':Sequelize['ENUM'](_0xdca1('0x2'),'script')},'description':{'type':Sequelize[_0xdca1('0x3')]},'version':{'type':Sequelize[_0xdca1('0x3')]},'path':{'type':Sequelize[_0xdca1('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xdca1('0x4')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xdca1('0x5')]('adminOnly',_0xdca1('0x6'),'always',_0xdca1('0x7')),'defaultValue':'always','comment':_0xdca1('0x8')},'icon':{'type':Sequelize[_0xdca1('0x1')]},'adminUrl':{'type':Sequelize[_0xdca1('0x1')]},'agentUrl':{'type':Sequelize[_0xdca1('0x1')]},'scriptName':{'type':Sequelize[_0xdca1('0x1')]},'scriptPath':{'type':Sequelize[_0xdca1('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ad691ec..b794aa5 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 _0x736f=['extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./plugin.socket','register','status','end','json','count','offset','limit','apply','reject','update','then','get','Plugins','destroy','sendStatus','name','map','Plugin','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','filters','find','download','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','finalize','unlinkSync','info','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','error','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x3a7b91,_0x557a6c){var _0x2492e6=function(_0x4dd1d2){while(--_0x4dd1d2){_0x3a7b91['push'](_0x3a7b91['shift']());}};_0x2492e6(++_0x557a6c);}(_0x736f,0x1de));var _0xf736=function(_0x551666,_0x687957){_0x551666=_0x551666-0x0;var _0x4b37ff=_0x736f[_0x551666];return _0x4b37ff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf736('0x0'));var rimraf=require(_0xf736('0x1'));var zipdir=require(_0xf736('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf736('0x3'));var BPromise=require(_0xf736('0x4'));var Mustache=require(_0xf736('0x5'));var util=require(_0xf736('0x6'));var path=require(_0xf736('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf736('0x8'));var fs=require('fs');var _=require(_0xf736('0x9'));var squel=require(_0xf736('0xa'));var crypto=require(_0xf736('0xb'));var jsforce=require(_0xf736('0xc'));var deskjs=require(_0xf736('0xd'));var toCsv=require(_0xf736('0xe'));var querystring=require(_0xf736('0xf'));var Papa=require(_0xf736('0x10'));var extract=require(_0xf736('0x11'));var rimraf=require(_0xf736('0x1'));var archiver=require(_0xf736('0x12'));var Redis=require(_0xf736('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf736('0x14'));var as=require(_0xf736('0x15'));var hardwareService=require(_0xf736('0x16'));var logger=require(_0xf736('0x17'))(_0xf736('0x18'));var utils=require('../../config/utils');var config=require(_0xf736('0x19'));var db=require('../../mysqldb')['db'];config[_0xf736('0x1a')]=_['defaults'](config[_0xf736('0x1a')],{'host':_0xf736('0x1b'),'port':0x18eb});var socket=require(_0xf736('0x1c'))(new Redis(config[_0xf736('0x1a')]));require(_0xf736('0x1d'))[_0xf736('0x1e')](socket);function respondWithStatusCode(_0xd7ff2,_0x188bef){_0x188bef=_0x188bef||0xcc;return function(_0x41ac8e){if(_0x41ac8e){return _0xd7ff2['sendStatus'](_0x188bef);}return _0xd7ff2[_0xf736('0x1f')](_0x188bef)[_0xf736('0x20')]();};}function respondWithResult(_0x402342,_0x8feaa6){_0x8feaa6=_0x8feaa6||0xc8;return function(_0x416e18){if(_0x416e18){return _0x402342['status'](_0x8feaa6)[_0xf736('0x21')](_0x416e18);}};}function respondWithFilteredResult(_0x26a2a5,_0x316324){return function(_0x5225b6){if(_0x5225b6){var _0x2624f1=_0x5225b6[_0xf736('0x22')],_0x166fef=_0x316324[_0xf736('0x23')],_0x3fa8f3=_0x316324[_0xf736('0x23')]+_0x316324[_0xf736('0x24')],_0x50361e;if(_0x3fa8f3>=_0x2624f1){_0x3fa8f3=_0x2624f1;_0x50361e=0xc8;}else{_0x50361e=0xce;}_0x26a2a5[_0xf736('0x1f')](_0x50361e);return _0x26a2a5['set']('Content-Range',_0x166fef+'-'+_0x3fa8f3+'/'+_0x2624f1)[_0xf736('0x21')](_0x5225b6);}return null;};}function patchUpdates(_0x22600f){return function(_0x17c6c0){try{jsonpatch[_0xf736('0x25')](_0x17c6c0,_0x22600f,!![]);}catch(_0x10b660){return BPromise[_0xf736('0x26')](_0x10b660);}return _0x17c6c0['save']();};}function saveUpdates(_0x3c6da9,_0x42dde7){return function(_0x192bc4){if(_0x192bc4){return _0x192bc4[_0xf736('0x27')](_0x3c6da9)[_0xf736('0x28')](function(_0x3f6e81){return _0x3f6e81;});}return null;};}function removeEntity(_0x648872,_0x37aafe){return function(_0x5f272c){if(_0x5f272c){return _0x5f272c['destroy']()[_0xf736('0x28')](function(){var _0x159cbd=_0x5f272c[_0xf736('0x29')]({'plain':!![]});var _0x3a7a7e=_0xf736('0x2a');return db['UserProfileResource'][_0xf736('0x2b')]({'where':{'type':_0x3a7a7e,'resourceId':_0x159cbd['id']}})[_0xf736('0x28')](function(){return _0x5f272c;});})['then'](function(){_0x648872[_0xf736('0x1f')](0xcc)[_0xf736('0x20')]();});}};}function handleEntityNotFound(_0x226102,_0x57e403){return function(_0x9b9fcb){if(!_0x9b9fcb){_0x226102[_0xf736('0x2c')](0x194);}return _0x9b9fcb;};}function handleError(_0x5189d1,_0x3c70de){_0x3c70de=_0x3c70de||0x1f4;return function(_0x5bfe28){logger['error'](_0x5bfe28['stack']);if(_0x5bfe28[_0xf736('0x2d')]){delete _0x5bfe28[_0xf736('0x2d')];}_0x5189d1[_0xf736('0x1f')](_0x3c70de)['send'](_0x5bfe28);};}exports['index']=function(_0x558c92,_0x4bb443){var _0x33fda0={},_0x52a7e7={},_0x460791={'count':0x0,'rows':[]};var _0x28bef9=_[_0xf736('0x2e')](db[_0xf736('0x2f')][_0xf736('0x30')],function(_0x571eb6){return{'name':_0x571eb6['fieldName'],'type':_0x571eb6['type'][_0xf736('0x31')]};});_0x52a7e7[_0xf736('0x32')]=_[_0xf736('0x2e')](_0x28bef9,_0xf736('0x2d'));_0x52a7e7[_0xf736('0x33')]=_[_0xf736('0x34')](_0x558c92[_0xf736('0x33')]);_0x52a7e7['filters']=_[_0xf736('0x35')](_0x52a7e7[_0xf736('0x32')],_0x52a7e7[_0xf736('0x33')]);_0x33fda0[_0xf736('0x36')]=_[_0xf736('0x35')](_0x52a7e7[_0xf736('0x32')],qs[_0xf736('0x37')](_0x558c92['query']['fields']));_0x33fda0[_0xf736('0x36')]=_0x33fda0[_0xf736('0x36')][_0xf736('0x38')]?_0x33fda0['attributes']:_0x52a7e7[_0xf736('0x32')];if(!_0x558c92[_0xf736('0x33')]['hasOwnProperty']('nolimit')){_0x33fda0[_0xf736('0x24')]=qs['limit'](_0x558c92[_0xf736('0x33')][_0xf736('0x24')]);_0x33fda0[_0xf736('0x23')]=qs[_0xf736('0x23')](_0x558c92[_0xf736('0x33')][_0xf736('0x23')]);}_0x33fda0[_0xf736('0x39')]=qs[_0xf736('0x3a')](_0x558c92[_0xf736('0x33')][_0xf736('0x3a')]);_0x33fda0['where']=qs['filters'](_[_0xf736('0x3b')](_0x558c92[_0xf736('0x33')],_0x52a7e7['filters']),_0x28bef9);if(_0x558c92[_0xf736('0x33')][_0xf736('0x3c')]){_0x33fda0[_0xf736('0x3d')]=_[_0xf736('0x3e')](_0x33fda0[_0xf736('0x3d')],{'$or':_['map'](_0x28bef9,function(_0x128fd6){if(_0x128fd6[_0xf736('0x3f')]!==_0xf736('0x40')){var _0x31b2be={};_0x31b2be[_0x128fd6[_0xf736('0x2d')]]={'$like':'%'+_0x558c92[_0xf736('0x33')][_0xf736('0x3c')]+'%'};return _0x31b2be;}})});}_0x33fda0=_[_0xf736('0x3e')]({},_0x33fda0,_0x558c92[_0xf736('0x41')]);var _0x243277={'where':_0x33fda0[_0xf736('0x3d')]};return db[_0xf736('0x2f')][_0xf736('0x22')](_0x243277)['then'](function(_0x2396e4){_0x460791[_0xf736('0x22')]=_0x2396e4;if(_0x558c92[_0xf736('0x33')][_0xf736('0x42')]){_0x33fda0[_0xf736('0x43')]=[{'all':!![]}];}return db['Plugin'][_0xf736('0x44')](_0x33fda0);})[_0xf736('0x28')](function(_0x59567c){_0x460791[_0xf736('0x45')]=_0x59567c;return _0x460791;})['then'](respondWithFilteredResult(_0x4bb443,_0x33fda0))[_0xf736('0x46')](handleError(_0x4bb443,null));};exports[_0xf736('0x47')]=function(_0x886586,_0x22809b){var _0x260537={'raw':!![],'where':{'id':_0x886586['params']['id']}},_0x25f9a0={};_0x25f9a0['model']=_['keys'](db[_0xf736('0x2f')][_0xf736('0x30')]);_0x25f9a0[_0xf736('0x33')]=_[_0xf736('0x34')](_0x886586[_0xf736('0x33')]);_0x25f9a0[_0xf736('0x48')]=_[_0xf736('0x35')](_0x25f9a0[_0xf736('0x32')],_0x25f9a0[_0xf736('0x33')]);_0x260537['attributes']=_['intersection'](_0x25f9a0['model'],qs['fields'](_0x886586['query'][_0xf736('0x37')]));_0x260537[_0xf736('0x36')]=_0x260537[_0xf736('0x36')][_0xf736('0x38')]?_0x260537[_0xf736('0x36')]:_0x25f9a0[_0xf736('0x32')];if(_0x886586[_0xf736('0x33')][_0xf736('0x42')]){_0x260537[_0xf736('0x43')]=[{'all':!![]}];}_0x260537=_[_0xf736('0x3e')]({},_0x260537,_0x886586[_0xf736('0x41')]);return db[_0xf736('0x2f')][_0xf736('0x49')](_0x260537)[_0xf736('0x28')](handleEntityNotFound(_0x22809b,null))[_0xf736('0x28')](respondWithResult(_0x22809b,null))['catch'](handleError(_0x22809b,null));};exports[_0xf736('0x4a')]=function(_0x2c4672,_0x3dd095,_0x43b003){return db[_0xf736('0x2f')][_0xf736('0x49')]({'where':{'id':_0x2c4672['params']['id']},'attributes':['name',_0xf736('0x7')],'raw':!![]})[_0xf736('0x28')](handleEntityNotFound(_0x3dd095,null))['then'](function(_0x45df36){if(_0x45df36){var _0x15b570=path[_0xf736('0x4b')](config[_0xf736('0x4c')],'server/files/plugins',util[_0xf736('0x4d')](_0xf736('0x4e'),path[_0xf736('0x4f')](_0x45df36['path'])));var _0x3e33de=fs[_0xf736('0x50')](_0x15b570);var _0x182739=archiver(_0xf736('0x51'),{'zlib':{'level':0x9}});_0x182739['on'](_0xf736('0x52'),function(_0x29d8c6){if(_0x29d8c6[_0xf736('0x53')]===_0xf736('0x54')){logger['error'](_0x29d8c6);}else{throw new db['Sequelize'][(_0xf736('0x55'))](_0xf736('0x56'));}});_0x182739['on']('error',function(_0x8d9295){throw new db[(_0xf736('0x57'))][(_0xf736('0x55'))](_0xf736('0x56'));});_0x182739[_0xf736('0x58')](_0x3e33de);_0x182739['glob'](_0xf736('0x59'),{'cwd':path['join'](config[_0xf736('0x4c')],_0xf736('0x5a'),path[_0xf736('0x5b')](_0x45df36[_0xf736('0x7')])),'ignore':[path['join'](path['basename'](_0x45df36[_0xf736('0x7')]),_0xf736('0x5c')),path['join'](path['basename'](_0x45df36[_0xf736('0x7')]),_0xf736('0x5d'))],'nodir':!![]})[_0xf736('0x5e')]();_0x3e33de['on']('close',function(){if(!fs['existsSync'](_0x15b570)){throw new db[(_0xf736('0x57'))]['Error']('Plugin\x20not\x20found');}return _0x3dd095[_0xf736('0x4a')](_0x15b570,util[_0xf736('0x4d')](_0xf736('0x4e'),path[_0xf736('0x4f')](_0x45df36[_0xf736('0x7')])),function(_0x201891){if(_0x201891){throw new db[(_0xf736('0x57'))][(_0xf736('0x55'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xf736('0x5f')](_0x15b570);logger[_0xf736('0x60')]('Download\x20completed');logger[_0xf736('0x60')]('Temporary\x20file\x20removed');});});}return null;})[_0xf736('0x46')](handleError(_0x3dd095,null));};exports['upload']=function(_0xc8b101,_0x52235c,_0x2cf085){var _0x37d9c0=path[_0xf736('0x4f')](_0xc8b101[_0xf736('0x61')]['filename'],path[_0xf736('0x62')](_0xc8b101['file'][_0xf736('0x63')]));var _0x31d98c=path[_0xf736('0x4b')](config['root'],_0xf736('0x5a'),_0xc8b101[_0xf736('0x61')][_0xf736('0x63')]);var _0x26badd=path[_0xf736('0x4b')](config[_0xf736('0x4c')],_0xf736('0x5a'),_0x37d9c0);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x31d98c);logger[_0xf736('0x60')](_0xf736('0x64'),_0x26badd);try{fs[_0xf736('0x65')](_0x31d98c,parseInt(_0xf736('0x66'),0x8));extract(_0x31d98c,{'dir':_0x26badd},function(_0x205bd7){if(_0x205bd7){logger[_0xf736('0x67')](_0x205bd7);handleError(_0x205bd7,!![]);};var _0x1b9c28=fs['readdirSync'](_0x26badd);if(_0x1b9c28['length']>0x1){removeReferences(_0x31d98c,_0x26badd);logger['error'](_0xf736('0x68'));return _0x2cf085(new Error(_0xf736('0x68')));}var _0x232cd2=fs[_0xf736('0x69')](path[_0xf736('0x4b')](_0x26badd,_0x1b9c28[0x0]));if(_0x232cd2[_0xf736('0x6a')]()){removeReferences(_0x31d98c,_0x26badd);logger[_0xf736('0x67')](_0xf736('0x68'));return _0x2cf085(new Error(_0xf736('0x68')));}if(_0x232cd2[_0xf736('0x6b')]()){var _0x202cb4=fs[_0xf736('0x6c')](path[_0xf736('0x4b')](_0x26badd,_0x1b9c28[0x0]));if(_0x202cb4[_0xf736('0x38')]===0x0){removeReferences(_0x31d98c,_0x26badd);logger['error'](_0xf736('0x68'));return _0x2cf085(new Error(_0xf736('0x68')));}var _0x1227d8=_0x202cb4['some'](function(_0x1c94ca){return _0x1c94ca===_0xf736('0x6d');});if(!_0x1227d8){return _0x2cf085(new Error(_0xf736('0x6e')));}var _0x3df039=fs[_0xf736('0x6f')](path[_0xf736('0x4b')](_0x26badd,_0x1b9c28[0x0],_0xf736('0x6d')));var _0x58be72=JSON['parse'](_0x3df039);if(_0xf736('0x70')==typeof _0x58be72[_0xf736('0x2d')]){return _0x2cf085(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xf736('0x70')==typeof _0x58be72[_0xf736('0x3f')]){return _0x2cf085(new Error(_0xf736('0x71')));}if('undefined'==typeof _0x58be72[_0xf736('0x72')]){return _0x2cf085(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf736('0x70')==typeof _0x58be72[_0xf736('0x73')]){return _0x2cf085(new Error(_0xf736('0x74')));}if(_0x58be72[_0xf736('0x3f')]===_0xf736('0x75')){if('undefined'==typeof _0x58be72['parameters']['views']){return _0x2cf085(new Error(_0xf736('0x76')));}if(_0xf736('0x70')==typeof _0x58be72['parameters'][_0xf736('0x77')]['admin']&&'undefined'==typeof _0x58be72[_0xf736('0x73')]['views'][_0xf736('0x78')]){return _0x2cf085(new Error(_0xf736('0x79')));}}else if(_0x58be72[_0xf736('0x3f')]===_0xf736('0x7a')){if(_0xf736('0x70')==typeof _0x58be72[_0xf736('0x73')]['scriptName']){return _0x2cf085(new Error(_0xf736('0x7b')));}if(_0xf736('0x70')==typeof _0x58be72['parameters'][_0xf736('0x7c')]){return _0x2cf085(new Error(_0xf736('0x7d')));}}else{return _0x2cf085(new Error(_0xf736('0x7e')));}var _0x444d1d=_0x58be72[_0xf736('0x2d')];var _0x45dec9=_0x58be72['description'];var _0x33d76e=_0x58be72[_0xf736('0x3f')];var _0x141b8f=_0x58be72[_0xf736('0x7f')]?_0x58be72['sidebar']:'always';var _0x19fd8a=_0x58be72[_0xf736('0x80')]?_0x58be72[_0xf736('0x80')]:_0xf736('0x81');var _0x45e708='';var _0x24db13='';var _0x24bc75='';var _0x133c9c='';var _0x4f8f9d=_0x58be72[_0xf736('0x72')];if(_0x33d76e===_0xf736('0x75')){if('undefined'!=typeof _0x58be72[_0xf736('0x73')][_0xf736('0x77')][_0xf736('0x82')]){var _0x1ccc46=_0x58be72[_0xf736('0x73')][_0xf736('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xf736('0x83')](_0x1ccc46)){_0x45e708=path[_0xf736('0x4b')]('plugins',_0x37d9c0,_0x1b9c28[0x0],_0x1ccc46);}else{_0x45e708=_0x1ccc46;}}else{logger['info'](_0xf736('0x84'));}if(_0xf736('0x70')!=typeof _0x58be72['parameters'][_0xf736('0x77')][_0xf736('0x78')]){var _0xb3f51b=_0x58be72['parameters']['views'][_0xf736('0x78')];if(!/^(f|ht)tps?:\/\//i[_0xf736('0x83')](_0xb3f51b)){_0x24db13=path[_0xf736('0x4b')](_0xf736('0x85'),_0x37d9c0,_0x1b9c28[0x0],_0xb3f51b);}else{_0x24db13=_0xb3f51b;}}else{logger[_0xf736('0x60')](_0xf736('0x86'));}}else if(_0x33d76e===_0xf736('0x7a')){_0x24bc75=_0x58be72[_0xf736('0x73')][_0xf736('0x87')];_0x133c9c=_0x58be72[_0xf736('0x73')]['scriptPath'];if(_0xf736('0x70')!=typeof _0x58be72[_0xf736('0x73')][_0xf736('0x77')]){if(_0xf736('0x70')!=typeof _0x58be72[_0xf736('0x73')][_0xf736('0x77')][_0xf736('0x82')]){var _0x1ccc46=_0x58be72[_0xf736('0x73')][_0xf736('0x77')][_0xf736('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xf736('0x83')](_0x1ccc46)){_0x45e708=path[_0xf736('0x4b')]('plugins',_0x37d9c0,_0x1b9c28[0x0],_0x1ccc46);}else{_0x45e708=_0x1ccc46;}}if(_0xf736('0x70')!=typeof _0x58be72[_0xf736('0x73')][_0xf736('0x77')][_0xf736('0x78')]){var _0xb3f51b=_0x58be72[_0xf736('0x73')]['views'][_0xf736('0x78')];if(!/^(f|ht)tps?:\/\//i[_0xf736('0x83')](_0xb3f51b)){_0x24db13=path[_0xf736('0x4b')](_0xf736('0x85'),_0x37d9c0,_0x1b9c28[0x0],_0xb3f51b);}else{_0x24db13=_0xb3f51b;}}}}var _0xd79d5e={'name':_0x444d1d,'description':_0x45dec9,'path':path[_0xf736('0x4b')](_0x37d9c0,_0x1b9c28[0x0]),'type':_0x33d76e,'sidebar':_0x141b8f,'icon':_0x19fd8a,'adminUrl':_0x45e708,'agentUrl':_0x24db13,'scriptName':_0x24bc75,'scriptPath':_0x133c9c,'version':_0x4f8f9d};removeReferences(_0x31d98c,null);return db[_0xf736('0x2f')][_0xf736('0x88')](_0xd79d5e)['then'](function(_0x3ea7ef){var _0x2bdc56={'role':_0xc8b101[_0xf736('0x89')][_0xf736('0x8a')],'userProfileId':_0xc8b101[_0xf736('0x89')]['userProfileId']};if(!_0x2bdc56)throw new Error(_0xf736('0x8b'));if(_0x2bdc56[_0xf736('0x8a')]===_0xf736('0x8c')){var _0x174018=_0x3ea7ef[_0xf736('0x29')]({'plain':!![]});return db[_0xf736('0x8d')][_0xf736('0x49')]({'where':{'name':_0xf736('0x2a'),'userProfileId':_0x2bdc56[_0xf736('0x8e')]},'raw':!![]})[_0xf736('0x28')](function(_0x57b3a4){if(_0x57b3a4&&_0x57b3a4[_0xf736('0x8f')]===0x0){return db[_0xf736('0x90')]['create']({'name':_0x174018[_0xf736('0x2d')],'resourceId':_0x174018['id'],'type':_0x57b3a4[_0xf736('0x2d')],'sectionId':_0x57b3a4['id']},{})['then'](function(){return _0x3ea7ef;});}else{return _0x3ea7ef;}})[_0xf736('0x46')](function(_0x238d45){logger[_0xf736('0x67')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x238d45);throw _0x238d45;});}return _0x3ea7ef;})[_0xf736('0x28')](respondWithResult(_0x52235c,null))[_0xf736('0x46')](handleError(_0x52235c,null));}});}catch(_0x11c258){_0x52235c[_0xf736('0x1f')](0x1f4)[_0xf736('0x91')](_0x11c258);}};function removeReferences(_0x3f8025,_0x890405){try{if(_0x3f8025){fs[_0xf736('0x5f')](_0x3f8025);logger[_0xf736('0x60')](_0xf736('0x92'));}if(_0x890405){rimraf(_0x890405,function(){});logger['info'](_0xf736('0x93'));}}catch(_0x2ca09a){logger[_0xf736('0x67')](_0x2ca09a);}}exports[_0xf736('0x27')]=function(_0x38a7ca,_0x3b6328,_0x5c2f8d){return db[_0xf736('0x2f')][_0xf736('0x49')]({'where':{'id':_0x38a7ca[_0xf736('0x94')]['id']}})['then'](handleEntityNotFound(_0x3b6328,null))[_0xf736('0x28')](saveUpdates(_0x38a7ca[_0xf736('0x89')],null))[_0xf736('0x28')](respondWithResult(_0x3b6328,null))['catch'](handleError(_0x3b6328,null));};exports[_0xf736('0x95')]=function(_0x4a0450,_0x5097e2,_0x213c7e){return db[_0xf736('0x2f')]['find']({'where':{'id':_0x4a0450['params']['id']}})[_0xf736('0x28')](function(_0x53b264){if(_0x53b264){return _0x53b264[_0xf736('0x2b')]();}})[_0xf736('0x28')](function(_0x51fa26){rimraf(path[_0xf736('0x4b')](config[_0xf736('0x4c')],_0xf736('0x5a'),path['dirname'](_0x51fa26[_0xf736('0x7')])),function(){});return _0x51fa26;})['then'](handleEntityNotFound(_0x5097e2,null))[_0xf736('0x28')](respondWithStatusCode(_0x5097e2,null))[_0xf736('0x46')](handleError(_0x5097e2,null));};exports['webhookGet']=function(_0x203c38,_0x70a150,_0x18391b){return BPromise[_0xf736('0x96')]()[_0xf736('0x28')](function(){if(!_0x203c38['query']['path']){throw new Error(_0xf736('0x97'));}if(!_0x203c38[_0xf736('0x33')]['port']){throw new Error(_0xf736('0x98'));}var _0x539297=_0x203c38['query'][_0xf736('0x99')]?_0x203c38[_0xf736('0x33')][_0xf736('0x99')]+':'+_0x203c38[_0xf736('0x33')][_0xf736('0x9a')]:_0xf736('0x9b')+_0x203c38[_0xf736('0x33')][_0xf736('0x9a')];var _0x166a56=_0x203c38[_0xf736('0x33')]['json']?_0x203c38[_0xf736('0x33')][_0xf736('0x21')]:!![];var _0x59b9c9=_0x203c38['query'][_0xf736('0x9c')]?_0x203c38['query']['encoding']:null;var _0x39ffbe={'method':_0x203c38[_0xf736('0x9d')],'uri':util[_0xf736('0x4d')](_0xf736('0x9e'),_0x539297,_0x203c38[_0xf736('0x33')][_0xf736('0x7')]),'json':_0x166a56,'resolveWithFullResponse':!![],'encoding':_0x59b9c9,'qs':_0x203c38[_0xf736('0x33')]};if(_0x203c38[_0xf736('0x9f')]){_0x39ffbe[_0xf736('0x9f')]=_0x203c38[_0xf736('0x9f')];if(_0x39ffbe[_0xf736('0x9f')][_0xf736('0xa0')]){delete _0x39ffbe[_0xf736('0x9f')][_0xf736('0xa0')];}}if(_0x39ffbe[_0xf736('0x9f')][_0xf736('0xa1')]){delete _0x39ffbe[_0xf736('0x9f')]['content-type'];}return rp(_0x39ffbe);})[_0xf736('0x28')](function(_0x11148f){if(_0x11148f){_0x70a150['set'](_0x11148f['headers']);logger[_0xf736('0x60')](_0x11148f['body']);if(_[_0xf736('0xa2')](_0x203c38[_0xf736('0x33')][_0xf736('0x7')],_0xf736('0x4a'))&&_0x11148f[_0xf736('0xa3')]==0x1f4){return _0x70a150[_0xf736('0x2c')](_0x11148f['statusCode']);}else{return _0x70a150['status'](_0x11148f[_0xf736('0xa3')])[_0xf736('0x91')](_0x11148f[_0xf736('0x89')]);}}else{return _0x70a150['sendStatus'](0xc8);}})[_0xf736('0x46')](handleError(_0x70a150,null));};exports[_0xf736('0xa4')]=function(_0x265b54,_0x388533,_0x496045){return BPromise['resolve']()[_0xf736('0x28')](function(){if(!_0x265b54[_0xf736('0x33')][_0xf736('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x265b54[_0xf736('0x33')][_0xf736('0x9a')]){throw new Error(_0xf736('0x98'));}var _0x2465ea=_0x265b54[_0xf736('0x33')][_0xf736('0x99')]?_0x265b54[_0xf736('0x33')][_0xf736('0x99')]+':'+_0x265b54[_0xf736('0x33')][_0xf736('0x9a')]:'http://localhost:'+_0x265b54['query']['port'];var _0x248994=_0x265b54[_0xf736('0x33')][_0xf736('0x21')]?_0x265b54[_0xf736('0x33')][_0xf736('0x21')]:!![];var _0x594023=_0x265b54[_0xf736('0x33')][_0xf736('0x9c')]?_0x265b54[_0xf736('0x33')][_0xf736('0x9c')]:null;var _0x584a34={'method':_0x265b54[_0xf736('0x9d')],'uri':util[_0xf736('0x4d')](_0xf736('0x9e'),_0x2465ea,_0x265b54[_0xf736('0x33')]['path']),'json':_0x248994,'resolveWithFullResponse':!![],'encoding':_0x594023,'body':_0x265b54['body']};if(_0x265b54[_0xf736('0x9f')]){_0x584a34[_0xf736('0x9f')]=_0x265b54[_0xf736('0x9f')];if(_0x584a34[_0xf736('0x9f')][_0xf736('0xa0')]){delete _0x584a34[_0xf736('0x9f')][_0xf736('0xa0')];}}if(_0x584a34['headers'][_0xf736('0xa1')]){delete _0x584a34[_0xf736('0x9f')]['content-type'];}return rp(_0x584a34);})['then'](function(_0x14c6cc){if(_0x14c6cc){_0x388533['set'](_0x14c6cc[_0xf736('0x9f')]);logger[_0xf736('0x60')](_0x14c6cc[_0xf736('0x89')]);return _0x388533[_0xf736('0x1f')](_0x14c6cc[_0xf736('0xa3')])[_0xf736('0x91')](_0x14c6cc[_0xf736('0x89')]);}else{return _0x388533[_0xf736('0x2c')](0xc8);}})[_0xf736('0x46')](handleError(_0x388533,null));}; \ No newline at end of file +var _0xec6e=['server/files/plugins','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','lstatSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','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','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','status','end','json','offset','Content-Range','reject','save','update','destroy','get','Plugins','sendStatus','error','stack','name','send','map','Plugin','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','pick','filter','merge','where','options','then','count','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','download','root'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0xec6e,0x108));var _0xeec6=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0xec6e[_0x189305];return _0xea3406;};'use strict';var pdf=require(_0xeec6('0x0'));var emlformat=require(_0xeec6('0x1'));var rimraf=require(_0xeec6('0x2'));var zipdir=require(_0xeec6('0x3'));var jsonpatch=require(_0xeec6('0x4'));var rp=require(_0xeec6('0x5'));var moment=require(_0xeec6('0x6'));var BPromise=require(_0xeec6('0x7'));var Mustache=require(_0xeec6('0x8'));var util=require('util');var path=require(_0xeec6('0x9'));var sox=require(_0xeec6('0xa'));var csv=require(_0xeec6('0xb'));var ejs=require(_0xeec6('0xc'));var fs=require('fs');var _=require(_0xeec6('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeec6('0xe'));var deskjs=require(_0xeec6('0xf'));var toCsv=require(_0xeec6('0xb'));var querystring=require(_0xeec6('0x10'));var Papa=require(_0xeec6('0x11'));var extract=require(_0xeec6('0x12'));var rimraf=require(_0xeec6('0x2'));var archiver=require('archiver');var Redis=require(_0xeec6('0x13'));var authService=require(_0xeec6('0x14'));var qs=require(_0xeec6('0x15'));var as=require(_0xeec6('0x16'));var hardwareService=require(_0xeec6('0x17'));var logger=require(_0xeec6('0x18'))(_0xeec6('0x19'));var utils=require(_0xeec6('0x1a'));var config=require('../../config/environment');var db=require(_0xeec6('0x1b'))['db'];config[_0xeec6('0x1c')]=_[_0xeec6('0x1d')](config['redis'],{'host':_0xeec6('0x1e'),'port':0x18eb});var socket=require(_0xeec6('0x1f'))(new Redis(config[_0xeec6('0x1c')]));require(_0xeec6('0x20'))['register'](socket);function respondWithStatusCode(_0x2e717a,_0x16ba19){_0x16ba19=_0x16ba19||0xcc;return function(_0x541123){if(_0x541123){return _0x2e717a['sendStatus'](_0x16ba19);}return _0x2e717a[_0xeec6('0x21')](_0x16ba19)[_0xeec6('0x22')]();};}function respondWithResult(_0x30176a,_0x10af5d){_0x10af5d=_0x10af5d||0xc8;return function(_0x53b75d){if(_0x53b75d){return _0x30176a[_0xeec6('0x21')](_0x10af5d)[_0xeec6('0x23')](_0x53b75d);}};}function respondWithFilteredResult(_0x4cf4ae,_0x3b8a2c){return function(_0x302a65){if(_0x302a65){var _0x314d05=_0x302a65['count'],_0x2519a8=_0x3b8a2c[_0xeec6('0x24')],_0x4b8b74=_0x3b8a2c[_0xeec6('0x24')]+_0x3b8a2c['limit'],_0x4cbdf3;if(_0x4b8b74>=_0x314d05){_0x4b8b74=_0x314d05;_0x4cbdf3=0xc8;}else{_0x4cbdf3=0xce;}_0x4cf4ae[_0xeec6('0x21')](_0x4cbdf3);return _0x4cf4ae['set'](_0xeec6('0x25'),_0x2519a8+'-'+_0x4b8b74+'/'+_0x314d05)[_0xeec6('0x23')](_0x302a65);}return null;};}function patchUpdates(_0x54d6ba){return function(_0x4d6324){try{jsonpatch['apply'](_0x4d6324,_0x54d6ba,!![]);}catch(_0x547e34){return BPromise[_0xeec6('0x26')](_0x547e34);}return _0x4d6324[_0xeec6('0x27')]();};}function saveUpdates(_0x5d64fb,_0x401085){return function(_0x5a9fbf){if(_0x5a9fbf){return _0x5a9fbf[_0xeec6('0x28')](_0x5d64fb)['then'](function(_0x273bad){return _0x273bad;});}return null;};}function removeEntity(_0x5bfa16,_0x51f8b9){return function(_0x25c162){if(_0x25c162){return _0x25c162[_0xeec6('0x29')]()['then'](function(){var _0x5f525e=_0x25c162[_0xeec6('0x2a')]({'plain':!![]});var _0x462231=_0xeec6('0x2b');return db['UserProfileResource'][_0xeec6('0x29')]({'where':{'type':_0x462231,'resourceId':_0x5f525e['id']}})['then'](function(){return _0x25c162;});})['then'](function(){_0x5bfa16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e69cc,_0x28ce6b){return function(_0x4c71b6){if(!_0x4c71b6){_0x4e69cc[_0xeec6('0x2c')](0x194);}return _0x4c71b6;};}function handleError(_0x344da1,_0x4b0034){_0x4b0034=_0x4b0034||0x1f4;return function(_0x5ee046){logger[_0xeec6('0x2d')](_0x5ee046[_0xeec6('0x2e')]);if(_0x5ee046['name']){delete _0x5ee046[_0xeec6('0x2f')];}_0x344da1[_0xeec6('0x21')](_0x4b0034)[_0xeec6('0x30')](_0x5ee046);};}exports['index']=function(_0x24d7be,_0x53a772){var _0x17b707={},_0x32457a={},_0x477a86={'count':0x0,'rows':[]};var _0x7e4edd=_[_0xeec6('0x31')](db[_0xeec6('0x32')]['rawAttributes'],function(_0x262831){return{'name':_0x262831[_0xeec6('0x33')],'type':_0x262831[_0xeec6('0x34')]['key']};});_0x32457a[_0xeec6('0x35')]=_[_0xeec6('0x31')](_0x7e4edd,_0xeec6('0x2f'));_0x32457a[_0xeec6('0x36')]=_[_0xeec6('0x37')](_0x24d7be[_0xeec6('0x36')]);_0x32457a[_0xeec6('0x38')]=_['intersection'](_0x32457a['model'],_0x32457a[_0xeec6('0x36')]);_0x17b707[_0xeec6('0x39')]=_[_0xeec6('0x3a')](_0x32457a['model'],qs[_0xeec6('0x3b')](_0x24d7be[_0xeec6('0x36')][_0xeec6('0x3b')]));_0x17b707['attributes']=_0x17b707[_0xeec6('0x39')][_0xeec6('0x3c')]?_0x17b707[_0xeec6('0x39')]:_0x32457a[_0xeec6('0x35')];if(!_0x24d7be[_0xeec6('0x36')][_0xeec6('0x3d')]('nolimit')){_0x17b707['limit']=qs[_0xeec6('0x3e')](_0x24d7be['query']['limit']);_0x17b707['offset']=qs[_0xeec6('0x24')](_0x24d7be[_0xeec6('0x36')][_0xeec6('0x24')]);}_0x17b707['order']=qs[_0xeec6('0x3f')](_0x24d7be[_0xeec6('0x36')][_0xeec6('0x3f')]);_0x17b707['where']=qs[_0xeec6('0x38')](_[_0xeec6('0x40')](_0x24d7be['query'],_0x32457a['filters']),_0x7e4edd);if(_0x24d7be[_0xeec6('0x36')][_0xeec6('0x41')]){_0x17b707['where']=_[_0xeec6('0x42')](_0x17b707[_0xeec6('0x43')],{'$or':_[_0xeec6('0x31')](_0x7e4edd,function(_0x11af8b){if(_0x11af8b[_0xeec6('0x34')]!=='VIRTUAL'){var _0x324ea3={};_0x324ea3[_0x11af8b['name']]={'$like':'%'+_0x24d7be['query'][_0xeec6('0x41')]+'%'};return _0x324ea3;}})});}_0x17b707=_[_0xeec6('0x42')]({},_0x17b707,_0x24d7be[_0xeec6('0x44')]);var _0x5d210c={'where':_0x17b707[_0xeec6('0x43')]};return db[_0xeec6('0x32')]['count'](_0x5d210c)[_0xeec6('0x45')](function(_0x136846){_0x477a86[_0xeec6('0x46')]=_0x136846;if(_0x24d7be[_0xeec6('0x36')]['includeAll']){_0x17b707['include']=[{'all':!![]}];}return db['Plugin'][_0xeec6('0x47')](_0x17b707);})[_0xeec6('0x45')](function(_0x37fcaf){_0x477a86[_0xeec6('0x48')]=_0x37fcaf;return _0x477a86;})[_0xeec6('0x45')](respondWithFilteredResult(_0x53a772,_0x17b707))[_0xeec6('0x49')](handleError(_0x53a772,null));};exports[_0xeec6('0x4a')]=function(_0x5118ca,_0x5c3781){var _0x468851={'raw':!![],'where':{'id':_0x5118ca[_0xeec6('0x4b')]['id']}},_0x5310e8={};_0x5310e8[_0xeec6('0x35')]=_[_0xeec6('0x37')](db['Plugin'][_0xeec6('0x4c')]);_0x5310e8[_0xeec6('0x36')]=_[_0xeec6('0x37')](_0x5118ca[_0xeec6('0x36')]);_0x5310e8[_0xeec6('0x38')]=_[_0xeec6('0x3a')](_0x5310e8['model'],_0x5310e8[_0xeec6('0x36')]);_0x468851[_0xeec6('0x39')]=_[_0xeec6('0x3a')](_0x5310e8[_0xeec6('0x35')],qs[_0xeec6('0x3b')](_0x5118ca[_0xeec6('0x36')]['fields']));_0x468851['attributes']=_0x468851[_0xeec6('0x39')][_0xeec6('0x3c')]?_0x468851['attributes']:_0x5310e8[_0xeec6('0x35')];if(_0x5118ca[_0xeec6('0x36')][_0xeec6('0x4d')]){_0x468851[_0xeec6('0x4e')]=[{'all':!![]}];}_0x468851=_['merge']({},_0x468851,_0x5118ca[_0xeec6('0x44')]);return db['Plugin'][_0xeec6('0x4f')](_0x468851)[_0xeec6('0x45')](handleEntityNotFound(_0x5c3781,null))[_0xeec6('0x45')](respondWithResult(_0x5c3781,null))[_0xeec6('0x49')](handleError(_0x5c3781,null));};exports[_0xeec6('0x50')]=function(_0x1ff788,_0x3af1cc,_0x37e42f){return db[_0xeec6('0x32')]['find']({'where':{'id':_0x1ff788[_0xeec6('0x4b')]['id']},'attributes':[_0xeec6('0x2f'),_0xeec6('0x9')],'raw':!![]})['then'](handleEntityNotFound(_0x3af1cc,null))[_0xeec6('0x45')](function(_0x595621){if(_0x595621){var _0x5df2d9=path['join'](config[_0xeec6('0x51')],_0xeec6('0x52'),util['format']('%s.zip',path[_0xeec6('0x53')](_0x595621[_0xeec6('0x9')])));var _0x5e9127=fs[_0xeec6('0x54')](_0x5df2d9);var _0x461a1b=archiver(_0xeec6('0x55'),{'zlib':{'level':0x9}});_0x461a1b['on'](_0xeec6('0x56'),function(_0x5b86c7){if(_0x5b86c7[_0xeec6('0x57')]===_0xeec6('0x58')){logger[_0xeec6('0x2d')](_0x5b86c7);}else{throw new db['Sequelize'][(_0xeec6('0x59'))](_0xeec6('0x5a'));}});_0x461a1b['on'](_0xeec6('0x2d'),function(_0x47994c){throw new db[(_0xeec6('0x5b'))][(_0xeec6('0x59'))](_0xeec6('0x5a'));});_0x461a1b[_0xeec6('0x5c')](_0x5e9127);_0x461a1b['glob'](_0xeec6('0x5d'),{'cwd':path[_0xeec6('0x5e')](config[_0xeec6('0x51')],_0xeec6('0x52'),path[_0xeec6('0x5f')](_0x595621[_0xeec6('0x9')])),'ignore':[path['join'](path['basename'](_0x595621['path']),_0xeec6('0x60')),path['join'](path[_0xeec6('0x53')](_0x595621[_0xeec6('0x9')]),_0xeec6('0x61'))],'nodir':!![]})[_0xeec6('0x62')]();_0x5e9127['on'](_0xeec6('0x63'),function(){if(!fs[_0xeec6('0x64')](_0x5df2d9)){throw new db[(_0xeec6('0x5b'))]['Error']('Plugin\x20not\x20found');}return _0x3af1cc['download'](_0x5df2d9,util[_0xeec6('0x65')](_0xeec6('0x66'),path[_0xeec6('0x53')](_0x595621[_0xeec6('0x9')])),function(_0x53ceac){if(_0x53ceac){throw new db[(_0xeec6('0x5b'))]['Error'](_0xeec6('0x67'));}fs['unlinkSync'](_0x5df2d9);logger[_0xeec6('0x68')](_0xeec6('0x69'));logger[_0xeec6('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0xeec6('0x49')](handleError(_0x3af1cc,null));};exports[_0xeec6('0x6a')]=function(_0x200fa5,_0x5d67ad,_0x58996e){var _0x174cea=path[_0xeec6('0x53')](_0x200fa5[_0xeec6('0x6b')]['filename'],path[_0xeec6('0x6c')](_0x200fa5['file'][_0xeec6('0x6d')]));var _0xd6349f=path['join'](config[_0xeec6('0x51')],_0xeec6('0x52'),_0x200fa5[_0xeec6('0x6b')]['filename']);var _0x2ed29e=path[_0xeec6('0x5e')](config[_0xeec6('0x51')],_0xeec6('0x52'),_0x174cea);logger[_0xeec6('0x68')](_0xeec6('0x6e'),_0xd6349f);logger[_0xeec6('0x68')](_0xeec6('0x6f'),_0x2ed29e);try{fs['chmodSync'](_0xd6349f,parseInt(_0xeec6('0x70'),0x8));extract(_0xd6349f,{'dir':_0x2ed29e},function(_0x2e3298){if(_0x2e3298){logger[_0xeec6('0x2d')](_0x2e3298);handleError(_0x2e3298,!![]);};var _0xe8d295=fs[_0xeec6('0x71')](_0x2ed29e);if(_0xe8d295[_0xeec6('0x3c')]>0x1){removeReferences(_0xd6349f,_0x2ed29e);logger['error']('Invalid\x20plugin\x20structure');return _0x58996e(new Error('Invalid\x20plugin\x20structure'));}var _0x51ecb0=fs[_0xeec6('0x72')](path[_0xeec6('0x5e')](_0x2ed29e,_0xe8d295[0x0]));if(_0x51ecb0['isFile']()){removeReferences(_0xd6349f,_0x2ed29e);logger[_0xeec6('0x2d')]('Invalid\x20plugin\x20structure');return _0x58996e(new Error(_0xeec6('0x73')));}if(_0x51ecb0[_0xeec6('0x74')]()){var _0x475abd=fs['readdirSync'](path['join'](_0x2ed29e,_0xe8d295[0x0]));if(_0x475abd[_0xeec6('0x3c')]===0x0){removeReferences(_0xd6349f,_0x2ed29e);logger[_0xeec6('0x2d')](_0xeec6('0x73'));return _0x58996e(new Error('Invalid\x20plugin\x20structure'));}var _0x302f20=_0x475abd[_0xeec6('0x75')](function(_0x338c57){return _0x338c57===_0xeec6('0x76');});if(!_0x302f20){return _0x58996e(new Error(_0xeec6('0x77')));}var _0xa9f840=fs[_0xeec6('0x78')](path[_0xeec6('0x5e')](_0x2ed29e,_0xe8d295[0x0],_0xeec6('0x76')));var _0x2d0eb7=JSON['parse'](_0xa9f840);if(_0xeec6('0x79')==typeof _0x2d0eb7[_0xeec6('0x2f')]){return _0x58996e(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xeec6('0x79')==typeof _0x2d0eb7['type']){return _0x58996e(new Error(_0xeec6('0x7a')));}if(_0xeec6('0x79')==typeof _0x2d0eb7[_0xeec6('0x7b')]){return _0x58996e(new Error(_0xeec6('0x7c')));}if(_0xeec6('0x79')==typeof _0x2d0eb7[_0xeec6('0x7d')]){return _0x58996e(new Error(_0xeec6('0x7e')));}if(_0x2d0eb7[_0xeec6('0x34')]===_0xeec6('0x7f')){if(_0xeec6('0x79')==typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x80')]){return _0x58996e(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xeec6('0x79')==typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x80')][_0xeec6('0x81')]&&_0xeec6('0x79')==typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x80')]['agent']){return _0x58996e(new Error(_0xeec6('0x82')));}}else if(_0x2d0eb7[_0xeec6('0x34')]===_0xeec6('0x83')){if(_0xeec6('0x79')==typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x84')]){return _0x58996e(new Error(_0xeec6('0x85')));}if(_0xeec6('0x79')==typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x86')]){return _0x58996e(new Error(_0xeec6('0x87')));}}else{return _0x58996e(new Error(_0xeec6('0x88')));}var _0x2634c8=_0x2d0eb7[_0xeec6('0x2f')];var _0x2f2be4=_0x2d0eb7['description'];var _0xc75ee5=_0x2d0eb7['type'];var _0x1bf4f6=_0x2d0eb7[_0xeec6('0x89')]?_0x2d0eb7[_0xeec6('0x89')]:'always';var _0x487e29=_0x2d0eb7[_0xeec6('0x8a')]?_0x2d0eb7[_0xeec6('0x8a')]:'icon-apps';var _0x14aa7e='';var _0x297c09='';var _0x2c1b1c='';var _0x5216e0='';var _0x1c0655=_0x2d0eb7[_0xeec6('0x7b')];if(_0xc75ee5==='html'){if(_0xeec6('0x79')!=typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x80')][_0xeec6('0x81')]){var _0xe767c0=_0x2d0eb7[_0xeec6('0x7d')]['views'][_0xeec6('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xeec6('0x8b')](_0xe767c0)){_0x14aa7e=path[_0xeec6('0x5e')](_0xeec6('0x8c'),_0x174cea,_0xe8d295[0x0],_0xe767c0);}else{_0x14aa7e=_0xe767c0;}}else{logger[_0xeec6('0x68')](_0xeec6('0x8d'));}if(_0xeec6('0x79')!=typeof _0x2d0eb7['parameters'][_0xeec6('0x80')][_0xeec6('0x8e')]){var _0x165e37=_0x2d0eb7[_0xeec6('0x7d')]['views'][_0xeec6('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0xeec6('0x8b')](_0x165e37)){_0x297c09=path[_0xeec6('0x5e')](_0xeec6('0x8c'),_0x174cea,_0xe8d295[0x0],_0x165e37);}else{_0x297c09=_0x165e37;}}else{logger[_0xeec6('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xc75ee5===_0xeec6('0x83')){_0x2c1b1c=_0x2d0eb7[_0xeec6('0x7d')]['scriptName'];_0x5216e0=_0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x86')];if('undefined'!=typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x80')]){if('undefined'!=typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x80')]['admin']){var _0xe767c0=_0x2d0eb7['parameters']['views'][_0xeec6('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xeec6('0x8b')](_0xe767c0)){_0x14aa7e=path['join'](_0xeec6('0x8c'),_0x174cea,_0xe8d295[0x0],_0xe767c0);}else{_0x14aa7e=_0xe767c0;}}if('undefined'!=typeof _0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x80')]['agent']){var _0x165e37=_0x2d0eb7[_0xeec6('0x7d')][_0xeec6('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xeec6('0x8b')](_0x165e37)){_0x297c09=path[_0xeec6('0x5e')](_0xeec6('0x8c'),_0x174cea,_0xe8d295[0x0],_0x165e37);}else{_0x297c09=_0x165e37;}}}}var _0x3fb9fc={'name':_0x2634c8,'description':_0x2f2be4,'path':path[_0xeec6('0x5e')](_0x174cea,_0xe8d295[0x0]),'type':_0xc75ee5,'sidebar':_0x1bf4f6,'icon':_0x487e29,'adminUrl':_0x14aa7e,'agentUrl':_0x297c09,'scriptName':_0x2c1b1c,'scriptPath':_0x5216e0,'version':_0x1c0655};removeReferences(_0xd6349f,null);return db[_0xeec6('0x32')][_0xeec6('0x8f')](_0x3fb9fc)[_0xeec6('0x45')](function(_0x4eae95){var _0x477d34={'role':_0x200fa5['body'][_0xeec6('0x90')],'userProfileId':_0x200fa5['body'][_0xeec6('0x91')]};if(!_0x477d34)throw new Error(_0xeec6('0x92'));if(_0x477d34[_0xeec6('0x90')]===_0xeec6('0x93')){var _0x4f3273=_0x4eae95['get']({'plain':!![]});return db[_0xeec6('0x94')][_0xeec6('0x4f')]({'where':{'name':_0xeec6('0x2b'),'userProfileId':_0x477d34[_0xeec6('0x91')]},'raw':!![]})['then'](function(_0x385ae6){if(_0x385ae6&&_0x385ae6[_0xeec6('0x95')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f3273[_0xeec6('0x2f')],'resourceId':_0x4f3273['id'],'type':_0x385ae6[_0xeec6('0x2f')],'sectionId':_0x385ae6['id']},{})[_0xeec6('0x45')](function(){return _0x4eae95;});}else{return _0x4eae95;}})[_0xeec6('0x49')](function(_0x175474){logger[_0xeec6('0x2d')](_0xeec6('0x96'),_0x175474);throw _0x175474;});}return _0x4eae95;})[_0xeec6('0x45')](respondWithResult(_0x5d67ad,null))[_0xeec6('0x49')](handleError(_0x5d67ad,null));}});}catch(_0x390c4f){_0x5d67ad[_0xeec6('0x21')](0x1f4)['send'](_0x390c4f);}};function removeReferences(_0x1f1357,_0x41af32){try{if(_0x1f1357){fs[_0xeec6('0x97')](_0x1f1357);logger[_0xeec6('0x68')](_0xeec6('0x98'));}if(_0x41af32){rimraf(_0x41af32,function(){});logger[_0xeec6('0x68')](_0xeec6('0x99'));}}catch(_0x4ab466){logger[_0xeec6('0x2d')](_0x4ab466);}}exports['update']=function(_0x1368a2,_0x1d51f6,_0x50a210){return db['Plugin'][_0xeec6('0x4f')]({'where':{'id':_0x1368a2[_0xeec6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d51f6,null))[_0xeec6('0x45')](saveUpdates(_0x1368a2[_0xeec6('0x9a')],null))[_0xeec6('0x45')](respondWithResult(_0x1d51f6,null))['catch'](handleError(_0x1d51f6,null));};exports[_0xeec6('0x9b')]=function(_0x432308,_0x413565,_0x46827a){return db[_0xeec6('0x32')][_0xeec6('0x4f')]({'where':{'id':_0x432308[_0xeec6('0x4b')]['id']}})[_0xeec6('0x45')](function(_0x21b32c){if(_0x21b32c){return _0x21b32c['destroy']();}})[_0xeec6('0x45')](function(_0x2aef02){rimraf(path[_0xeec6('0x5e')](config[_0xeec6('0x51')],_0xeec6('0x52'),path[_0xeec6('0x5f')](_0x2aef02[_0xeec6('0x9')])),function(){});return _0x2aef02;})[_0xeec6('0x45')](handleEntityNotFound(_0x413565,null))[_0xeec6('0x45')](respondWithStatusCode(_0x413565,null))[_0xeec6('0x49')](handleError(_0x413565,null));};exports[_0xeec6('0x9c')]=function(_0x4e60b3,_0x114145,_0x38da3c){return BPromise[_0xeec6('0x9d')]()[_0xeec6('0x45')](function(){if(!_0x4e60b3[_0xeec6('0x36')][_0xeec6('0x9')]){throw new Error(_0xeec6('0x9e'));}if(!_0x4e60b3[_0xeec6('0x36')][_0xeec6('0x9f')]){throw new Error(_0xeec6('0xa0'));}var _0x3f869a=_0x4e60b3['query'][_0xeec6('0xa1')]?_0x4e60b3[_0xeec6('0x36')][_0xeec6('0xa1')]+':'+_0x4e60b3['query'][_0xeec6('0x9f')]:_0xeec6('0xa2')+_0x4e60b3[_0xeec6('0x36')][_0xeec6('0x9f')];var _0x529e7a=_0x4e60b3[_0xeec6('0x36')][_0xeec6('0x23')]?_0x4e60b3['query'][_0xeec6('0x23')]:!![];var _0x103eeb=_0x4e60b3[_0xeec6('0x36')]['encoding']?_0x4e60b3['query'][_0xeec6('0xa3')]:null;var _0x418a32={'method':_0x4e60b3[_0xeec6('0xa4')],'uri':util[_0xeec6('0x65')](_0xeec6('0xa5'),_0x3f869a,_0x4e60b3['query'][_0xeec6('0x9')]),'json':_0x529e7a,'resolveWithFullResponse':!![],'encoding':_0x103eeb,'qs':_0x4e60b3[_0xeec6('0x36')]};if(_0x4e60b3['headers']){_0x418a32[_0xeec6('0xa6')]=_0x4e60b3[_0xeec6('0xa6')];if(_0x418a32[_0xeec6('0xa6')][_0xeec6('0xa7')]){delete _0x418a32[_0xeec6('0xa6')][_0xeec6('0xa7')];}}if(_0x418a32[_0xeec6('0xa6')][_0xeec6('0xa8')]){delete _0x418a32[_0xeec6('0xa6')][_0xeec6('0xa8')];}return rp(_0x418a32);})[_0xeec6('0x45')](function(_0x1a0616){if(_0x1a0616){_0x114145[_0xeec6('0xa9')](_0x1a0616[_0xeec6('0xa6')]);logger[_0xeec6('0x68')](_0x1a0616[_0xeec6('0x9a')]);if(_[_0xeec6('0xaa')](_0x4e60b3[_0xeec6('0x36')]['path'],_0xeec6('0x50'))&&_0x1a0616[_0xeec6('0xab')]==0x1f4){return _0x114145[_0xeec6('0x2c')](_0x1a0616[_0xeec6('0xab')]);}else{return _0x114145[_0xeec6('0x21')](_0x1a0616['statusCode'])['send'](_0x1a0616['body']);}}else{return _0x114145[_0xeec6('0x2c')](0xc8);}})[_0xeec6('0x49')](handleError(_0x114145,null));};exports[_0xeec6('0xac')]=function(_0x5a2f16,_0x8cfb3a,_0x23642a){return BPromise[_0xeec6('0x9d')]()[_0xeec6('0x45')](function(){if(!_0x5a2f16['query'][_0xeec6('0x9')]){throw new Error(_0xeec6('0x9e'));}if(!_0x5a2f16[_0xeec6('0x36')]['port']){throw new Error(_0xeec6('0xa0'));}var _0x1af0bb=_0x5a2f16[_0xeec6('0x36')][_0xeec6('0xa1')]?_0x5a2f16[_0xeec6('0x36')]['hostname']+':'+_0x5a2f16[_0xeec6('0x36')][_0xeec6('0x9f')]:_0xeec6('0xa2')+_0x5a2f16['query'][_0xeec6('0x9f')];var _0xc67122=_0x5a2f16[_0xeec6('0x36')]['json']?_0x5a2f16[_0xeec6('0x36')][_0xeec6('0x23')]:!![];var _0x4478e7=_0x5a2f16[_0xeec6('0x36')]['encoding']?_0x5a2f16[_0xeec6('0x36')]['encoding']:null;var _0x1e80d9={'method':_0x5a2f16[_0xeec6('0xa4')],'uri':util[_0xeec6('0x65')](_0xeec6('0xa5'),_0x1af0bb,_0x5a2f16[_0xeec6('0x36')]['path']),'json':_0xc67122,'resolveWithFullResponse':!![],'encoding':_0x4478e7,'body':_0x5a2f16[_0xeec6('0x9a')]};if(_0x5a2f16[_0xeec6('0xa6')]){_0x1e80d9['headers']=_0x5a2f16['headers'];if(_0x1e80d9[_0xeec6('0xa6')]['content-length']){delete _0x1e80d9['headers']['content-length'];}}if(_0x1e80d9[_0xeec6('0xa6')][_0xeec6('0xa8')]){delete _0x1e80d9[_0xeec6('0xa6')][_0xeec6('0xa8')];}return rp(_0x1e80d9);})[_0xeec6('0x45')](function(_0x502da7){if(_0x502da7){_0x8cfb3a[_0xeec6('0xa9')](_0x502da7[_0xeec6('0xa6')]);logger['info'](_0x502da7[_0xeec6('0x9a')]);return _0x8cfb3a[_0xeec6('0x21')](_0x502da7['statusCode'])[_0xeec6('0x30')](_0x502da7[_0xeec6('0x9a')]);}else{return _0x8cfb3a[_0xeec6('0x2c')](0xc8);}})[_0xeec6('0x49')](handleError(_0x8cfb3a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 78588db..73471c3 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 _0x68b3=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2c6a9c,_0x244ed9){var _0x21591f=function(_0x481acf){while(--_0x481acf){_0x2c6a9c['push'](_0x2c6a9c['shift']());}};_0x21591f(++_0x244ed9);}(_0x68b3,0x1d8));var _0x368b=function(_0x552331,_0x48a7dc){_0x552331=_0x552331-0x0;var _0x4c5069=_0x68b3[_0x552331];return _0x4c5069;};'use strict';var EventEmitter=require(_0x368b('0x0'));var Plugin=require(_0x368b('0x1'))['db'][_0x368b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x368b('0x3')](0x0);var events={'afterCreate':_0x368b('0x4'),'afterUpdate':'update','afterDestroy':_0x368b('0x5')};function emitEvent(_0x3325ac){return function(_0xc40116,_0x404282,_0x5d68cb){PluginEvents[_0x368b('0x6')](_0x3325ac+':'+_0xc40116['id'],_0xc40116);PluginEvents[_0x368b('0x6')](_0x3325ac,_0xc40116);_0x5d68cb(null);};}for(var e in events){if(events[_0x368b('0x7')](e)){var event=events[e];Plugin[_0x368b('0x8')](e,emitEvent(event));}}module[_0x368b('0x9')]=PluginEvents; \ No newline at end of file +var _0x1a37=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove'];(function(_0x387967,_0xdb4663){var _0x474c67=function(_0x594dd4){while(--_0x594dd4){_0x387967['push'](_0x387967['shift']());}};_0x474c67(++_0xdb4663);}(_0x1a37,0xb4));var _0x71a3=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x1a37[_0x2e4aa2];return _0x5e6092;};'use strict';var EventEmitter=require(_0x71a3('0x0'));var Plugin=require(_0x71a3('0x1'))['db'][_0x71a3('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x71a3('0x3')](0x0);var events={'afterCreate':_0x71a3('0x4'),'afterUpdate':_0x71a3('0x5'),'afterDestroy':_0x71a3('0x6')};function emitEvent(_0xbe3243){return function(_0x29c54f,_0x100181,_0x4af5b4){PluginEvents[_0x71a3('0x7')](_0xbe3243+':'+_0x29c54f['id'],_0x29c54f);PluginEvents['emit'](_0xbe3243,_0x29c54f);_0x4af5b4(null);};}for(var e in events){if(events[_0x71a3('0x8')](e)){var event=events[e];Plugin[_0x71a3('0x9')](e,emitEvent(event));}}module[_0x71a3('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index bc1e9d8..fe861e7 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 _0x8958=['define','Plugin','plugins','util','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x4077fd,_0xec6e7e){var _0x5347e9=function(_0x25fdb2){while(--_0x25fdb2){_0x4077fd['push'](_0x4077fd['shift']());}};_0x5347e9(++_0xec6e7e);}(_0x8958,0x93));var _0x8895=function(_0x396f22,_0x4d87a8){_0x396f22=_0x396f22-0x0;var _0x7aeaa6=_0x8958[_0x396f22];return _0x7aeaa6;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./plugin.attributes','exports','define','plugins','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x55ca,0x126));var _0xa55c=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0x55ca[_0x28407a];return _0x8bd6ef;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Plugin',attributes,{'tableName':_0xa55c('0x9'),'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 7790dfd..5e443e0 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 _0x48fe=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreatePlugin','Plugin','create','body','options','raw','catch','lodash','util','moment','bluebird'];(function(_0x517f06,_0x269cb4){var _0x48b8b8=function(_0x44e445){while(--_0x44e445){_0x517f06['push'](_0x517f06['shift']());}};_0x48b8b8(++_0x269cb4);}(_0x48fe,0x15c));var _0xe48f=function(_0x3e648a,_0x24719f){_0x3e648a=_0x3e648a-0x0;var _0x29daba=_0x48fe[_0x3e648a];return _0x29daba;};'use strict';var _=require(_0xe48f('0x0'));var util=require(_0xe48f('0x1'));var moment=require(_0xe48f('0x2'));var BPromise=require(_0xe48f('0x3'));var rs=require(_0xe48f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe48f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe48f('0x6'))(_0xe48f('0x7'));var config=require(_0xe48f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe48f('0x9')][_0xe48f('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe48f('0xb')],{'host':_0xe48f('0xc'),'port':0x18eb});var socket=require(_0xe48f('0xd'))(new Redis(config['redis']));require(_0xe48f('0xe'))[_0xe48f('0xf')](socket);function respondWithRpcPromise(_0x23ce4c,_0x3759aa,_0x440f8b){return new BPromise(function(_0x49e7c0,_0x250210){return client[_0xe48f('0x10')](_0x23ce4c,_0x440f8b)['then'](function(_0x8ad75e){logger[_0xe48f('0x11')](_0xe48f('0x12'),_0x3759aa,_0xe48f('0x13'));logger['debug'](_0xe48f('0x14'),_0x3759aa,_0xe48f('0x13'),JSON[_0xe48f('0x15')](_0x8ad75e));if(_0x8ad75e[_0xe48f('0x16')]){if(_0x8ad75e['error'][_0xe48f('0x17')]===0x1f4){logger[_0xe48f('0x16')](_0xe48f('0x12'),_0x3759aa,_0x8ad75e[_0xe48f('0x16')][_0xe48f('0x18')]);return _0x250210(_0x8ad75e[_0xe48f('0x16')][_0xe48f('0x18')]);}logger['error'](_0xe48f('0x12'),_0x3759aa,_0x8ad75e[_0xe48f('0x16')][_0xe48f('0x18')]);return _0x49e7c0(_0x8ad75e[_0xe48f('0x16')][_0xe48f('0x18')]);}else{logger[_0xe48f('0x11')](_0xe48f('0x12'),_0x3759aa,'request\x20sent');_0x49e7c0(_0x8ad75e['result'][_0xe48f('0x18')]);}})['catch'](function(_0x35a648){logger['error'](_0xe48f('0x12'),_0x3759aa,_0x35a648);_0x250210(_0x35a648);});});}exports[_0xe48f('0x19')]=function(_0x433463){var _0x3673d5=this;return new Promise(function(_0x402bfe,_0x2dfaea){return db[_0xe48f('0x1a')][_0xe48f('0x1b')](_0x433463[_0xe48f('0x1c')],{'raw':_0x433463[_0xe48f('0x1d')]?_0x433463[_0xe48f('0x1d')][_0xe48f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x34cf63){logger[_0xe48f('0x11')](_0xe48f('0x19'),_0x433463);logger['debug'](_0xe48f('0x19'),_0x433463,JSON[_0xe48f('0x15')](_0x34cf63));_0x402bfe(_0x34cf63);})[_0xe48f('0x1f')](function(_0x19f69){logger['error'](_0xe48f('0x19'),_0x19f69[_0xe48f('0x18')],_0x433463);_0x2dfaea(_0x3673d5['error'](0x1f4,_0x19f69[_0xe48f('0x18')]));});});}; \ No newline at end of file +var _0x20b4=['result','CreatePlugin','create','body','options','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','socket.io-emitter','redis','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0x20b4,0xc6));var _0x420b=function(_0x2b950c,_0x57cc37){_0x2b950c=_0x2b950c-0x0;var _0x592648=_0x20b4[_0x2b950c];return _0x592648;};'use strict';var _=require(_0x420b('0x0'));var util=require('util');var moment=require(_0x420b('0x1'));var BPromise=require('bluebird');var rs=require(_0x420b('0x2'));var fs=require('fs');var Redis=require(_0x420b('0x3'));var db=require(_0x420b('0x4'))['db'];var utils=require(_0x420b('0x5'));var logger=require(_0x420b('0x6'))(_0x420b('0x7'));var config=require(_0x420b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x420b('0x9')][_0x420b('0xa')]({'port':0x232a});config['redis']=_[_0x420b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x420b('0xc'))(new Redis(config[_0x420b('0xd')]));require(_0x420b('0xe'))[_0x420b('0xf')](socket);function respondWithRpcPromise(_0x5daae8,_0x202b15,_0x3d72b6){return new BPromise(function(_0x5c155e,_0x3d1741){return client[_0x420b('0x10')](_0x5daae8,_0x3d72b6)[_0x420b('0x11')](function(_0x555675){logger[_0x420b('0x12')](_0x420b('0x13'),_0x202b15,_0x420b('0x14'));logger[_0x420b('0x15')](_0x420b('0x16'),_0x202b15,_0x420b('0x14'),JSON['stringify'](_0x555675));if(_0x555675['error']){if(_0x555675[_0x420b('0x17')][_0x420b('0x18')]===0x1f4){logger[_0x420b('0x17')](_0x420b('0x13'),_0x202b15,_0x555675[_0x420b('0x17')][_0x420b('0x19')]);return _0x3d1741(_0x555675[_0x420b('0x17')][_0x420b('0x19')]);}logger['error'](_0x420b('0x13'),_0x202b15,_0x555675['error'][_0x420b('0x19')]);return _0x5c155e(_0x555675[_0x420b('0x17')][_0x420b('0x19')]);}else{logger[_0x420b('0x12')](_0x420b('0x13'),_0x202b15,'request\x20sent');_0x5c155e(_0x555675[_0x420b('0x1a')][_0x420b('0x19')]);}})['catch'](function(_0x29a45d){logger[_0x420b('0x17')]('Plugin,\x20%s,\x20%s',_0x202b15,_0x29a45d);_0x3d1741(_0x29a45d);});});}exports[_0x420b('0x1b')]=function(_0x3a24ba){var _0x16482c=this;return new Promise(function(_0x449846,_0x5b19f4){return db['Plugin'][_0x420b('0x1c')](_0x3a24ba[_0x420b('0x1d')],{'raw':_0x3a24ba[_0x420b('0x1e')]?_0x3a24ba[_0x420b('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x420b('0x11')](function(_0x55a936){logger[_0x420b('0x12')](_0x420b('0x1b'),_0x3a24ba);logger[_0x420b('0x15')](_0x420b('0x1b'),_0x3a24ba,JSON[_0x420b('0x1f')](_0x55a936));_0x449846(_0x55a936);})['catch'](function(_0x12a6ad){logger[_0x420b('0x17')](_0x420b('0x1b'),_0x12a6ad[_0x420b('0x19')],_0x3a24ba);_0x5b19f4(_0x16482c['error'](0x1f4,_0x12a6ad['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b499f32..db1a683 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 _0xfa28=['remove','update','emit','removeListener','length','plugin:','./plugin.events','save'];(function(_0x25a823,_0x288e3e){var _0x121418=function(_0x1e7581){while(--_0x1e7581){_0x25a823['push'](_0x25a823['shift']());}};_0x121418(++_0x288e3e);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xfa28[_0x160c73];return _0xd9302;};'use strict';var PluginEvents=require(_0x8fa2('0x0'));var events=[_0x8fa2('0x1'),_0x8fa2('0x2'),_0x8fa2('0x3')];function createListener(_0x677728,_0x41c243){return function(_0x11fb52){_0x41c243[_0x8fa2('0x4')](_0x677728,_0x11fb52);};}function removeListener(_0x5dbd5d,_0x5facce){return function(){PluginEvents[_0x8fa2('0x5')](_0x5dbd5d,_0x5facce);};}exports['register']=function(_0x48263e){for(var _0x4df001=0x0,_0x4f3f6e=events[_0x8fa2('0x6')];_0x4df001<_0x4f3f6e;_0x4df001++){var _0x1035b5=events[_0x4df001];var _0x36c734=createListener(_0x8fa2('0x7')+_0x1035b5,_0x48263e);PluginEvents['on'](_0x1035b5,_0x36c734);}}; \ No newline at end of file +var _0x7dab=['update','emit','removeListener','register','length','./plugin.events','save','remove'];(function(_0x549b3a,_0xa733d8){var _0x497386=function(_0x5c29e4){while(--_0x5c29e4){_0x549b3a['push'](_0x549b3a['shift']());}};_0x497386(++_0xa733d8);}(_0x7dab,0xe5));var _0xb7da=function(_0x177e77,_0x33a2dd){_0x177e77=_0x177e77-0x0;var _0x351db4=_0x7dab[_0x177e77];return _0x351db4;};'use strict';var PluginEvents=require(_0xb7da('0x0'));var events=[_0xb7da('0x1'),_0xb7da('0x2'),_0xb7da('0x3')];function createListener(_0x1e6b3e,_0x4eb83b){return function(_0x46e21c){_0x4eb83b[_0xb7da('0x4')](_0x1e6b3e,_0x46e21c);};}function removeListener(_0xf5b0c3,_0x35a473){return function(){PluginEvents[_0xb7da('0x5')](_0xf5b0c3,_0x35a473);};}exports[_0xb7da('0x6')]=function(_0x453be8){for(var _0x2601db=0x0,_0x4c980f=events[_0xb7da('0x7')];_0x2601db<_0x4c980f;_0x2601db++){var _0x16dd2e=events[_0x2601db];var _0x35b6c4=createListener('plugin:'+_0x16dd2e,_0x453be8);PluginEvents['on'](_0x16dd2e,_0x35b6c4);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 987e0ef..62f4add 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 _0x68b5=['delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x4f3e49,_0x537873){var _0x4e1487=function(_0x8e95d2){while(--_0x8e95d2){_0x4f3e49['push'](_0x4f3e49['shift']());}};_0x4e1487(++_0x537873);}(_0x68b5,0xf3));var _0x568b=function(_0x3988a0,_0x52e291){_0x3988a0=_0x3988a0-0x0;var _0x5912e7=_0x68b5[_0x3988a0];return _0x5912e7;};'use strict';var express=require(_0x568b('0x0'));var router=express[_0x568b('0x1')]();var auth=require(_0x568b('0x2'));var controller=require('./pm2.controller');router[_0x568b('0x3')]('/',auth[_0x568b('0x4')](),controller[_0x568b('0x5')]);router[_0x568b('0x3')](_0x568b('0x6'),auth[_0x568b('0x4')](),controller[_0x568b('0x7')]);router[_0x568b('0x8')]('/',auth['isAuthenticated'](),controller[_0x568b('0x9')]);router[_0x568b('0xa')](_0x568b('0x6'),auth[_0x568b('0x4')](),controller[_0x568b('0xb')]);router[_0x568b('0xc')](_0x568b('0x6'),auth[_0x568b('0x4')](),controller[_0x568b('0xd')]);module[_0x568b('0xe')]=router; \ No newline at end of file +var _0x082a=['destroy','exports','express','Router','./pm2.controller','get','isAuthenticated','/:id','show','post','create','put','delete'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x082a,0xd2));var _0xa082=function(_0x2b222b,_0x4e7ecf){_0x2b222b=_0x2b222b-0x0;var _0x311f14=_0x082a[_0x2b222b];return _0x311f14;};'use strict';var express=require(_0xa082('0x0'));var router=express[_0xa082('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa082('0x2'));router[_0xa082('0x3')]('/',auth[_0xa082('0x4')](),controller['index']);router['get'](_0xa082('0x5'),auth[_0xa082('0x4')](),controller[_0xa082('0x6')]);router[_0xa082('0x7')]('/',auth['isAuthenticated'](),controller[_0xa082('0x8')]);router[_0xa082('0x9')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa082('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa082('0xb')]);module[_0xa082('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 4e7a814..9fecfce 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 _0xbbb6=['hasOwnProperty','Unknown\x20status','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','name','send','npm\x20install','info','error','index','list','reject','motion2','length','then','catch','describe','params','create','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0xbbb6,0xed));var _0x6bbb=function(_0x42e2b6,_0x3e15f6){_0x42e2b6=_0x42e2b6-0x0;var _0x262389=_0xbbb6[_0x42e2b6];return _0x262389;};'use strict';var _=require(_0x6bbb('0x0'));var pm2=require(_0x6bbb('0x1'));var logger=require(_0x6bbb('0x2'))(_0x6bbb('0x3'));var path=require(_0x6bbb('0x4'));var exec=require(_0x6bbb('0x5'))[_0x6bbb('0x6')];var BPromise=require(_0x6bbb('0x7'));function handleEntityNotFound(_0x3a406f,_0x5ad10b){return function(_0x28e133){if(!_0x28e133){_0x3a406f[_0x6bbb('0x8')](0x194);;}return _0x28e133;};}function respondWithResult(_0x2bb5ff,_0x1af341){_0x1af341=_0x1af341||0xc8;return function(_0x393a2e){if(_0x393a2e){return _0x2bb5ff[_0x6bbb('0x9')](_0x1af341)[_0x6bbb('0xa')](_0x393a2e);}return null;};}function handleError(_0x40aa80,_0x349d8a){_0x349d8a=_0x349d8a||0x1f4;return function(_0x483025){logger['error'](_0x483025['stack']);if(_0x483025[_0x6bbb('0xb')]){delete _0x483025['name'];}_0x40aa80[_0x6bbb('0x9')](_0x349d8a)[_0x6bbb('0xc')](_0x483025);};}function execChildProcess(){return new BPromise(function(_0x7f4140,_0x3d4aa8){exec(_0x6bbb('0xd'),function(_0x4b122f,_0x9ab947,_0x15edf5){logger['info'](_0x9ab947);logger[_0x6bbb('0xe')](_0x15edf5);if(_0x4b122f){logger[_0x6bbb('0xf')](_0x4b122f);return _0x3d4aa8(_0x4b122f);}return _0x7f4140(_0x9ab947);});});}exports[_0x6bbb('0x10')]=function(_0x48f98c,_0x635895){return pm2[_0x6bbb('0x11')]()['then'](function(_0x30f34a){if(_0x30f34a){var _0x45f2b3=_[_0x6bbb('0x12')](_0x30f34a,function(_0x37ae8c){return _0x37ae8c[_0x6bbb('0xb')]==='express'||_0x37ae8c['name']===_0x6bbb('0x13');});return{'rows':_0x45f2b3,'count':_0x45f2b3[_0x6bbb('0x14')]};}return null;})[_0x6bbb('0x15')](respondWithResult(_0x635895,null))[_0x6bbb('0x16')](handleError(_0x635895,null));};exports['show']=function(_0x1e7e33,_0x2a3d2b){return pm2[_0x6bbb('0x17')](_0x1e7e33[_0x6bbb('0x18')]['id'])[_0x6bbb('0x15')](respondWithResult(_0x2a3d2b,null))[_0x6bbb('0x15')](handleEntityNotFound(_0x2a3d2b,null))['catch'](handleError(_0x2a3d2b,null));};exports[_0x6bbb('0x19')]=function(_0xe7ea75,_0xdf02a2){if(_0xe7ea75[_0x6bbb('0x1a')][_0x6bbb('0xb')]&&_0xe7ea75[_0x6bbb('0x1a')][_0x6bbb('0x1b')]){var _0x10b3ea=path[_0x6bbb('0x1c')](__dirname,_0x6bbb('0x1d'),_0xe7ea75[_0x6bbb('0x1a')]['script']);var _0x590c86=process['cwd']();process['chdir'](path['dirname'](_0x10b3ea));return execChildProcess()[_0x6bbb('0x15')](function(_0x5a2290){process[_0x6bbb('0x1e')](_0x590c86);return pm2[_0x6bbb('0x1f')]({'name':_0xe7ea75[_0x6bbb('0x1a')][_0x6bbb('0xb')],'script':_0x10b3ea});})[_0x6bbb('0x15')](function(_0x5a2529){pm2[_0x6bbb('0x20')]();return _0x5a2529[0x0];})[_0x6bbb('0x15')](respondWithResult(_0xdf02a2,0xc9))['catch'](handleError(_0xdf02a2,null));}else{return _0xdf02a2[_0x6bbb('0x9')](0x1f4)['send']({'message':_0x6bbb('0x21')});}};exports[_0x6bbb('0x22')]=function(_0x2b33dc,_0x4c4546){if(_0x2b33dc[_0x6bbb('0x1a')]['id']){delete _0x2b33dc[_0x6bbb('0x1a')]['id'];}var _0x29d488={'online':_0x6bbb('0x23'),'stopped':'stop'};if(_0x29d488[_0x6bbb('0x24')](_0x2b33dc[_0x6bbb('0x1a')][_0x6bbb('0x9')])){return pm2[_0x29d488[_0x2b33dc['body'][_0x6bbb('0x9')]]](_0x2b33dc[_0x6bbb('0x18')]['id'])['then'](respondWithResult(_0x4c4546,0xc8))[_0x6bbb('0x16')](handleError(_0x4c4546,null));}else{return _0x4c4546[_0x6bbb('0x9')](0x1f4)[_0x6bbb('0xc')]({'message':_0x6bbb('0x25')});}};exports['destroy']=function(_0x4e67f8,_0x344750){if(_0x4e67f8[_0x6bbb('0x1a')]['id']){delete _0x4e67f8[_0x6bbb('0x1a')]['id'];}if(_0x4e67f8[_0x6bbb('0x18')]['id']){return pm2['delete'](_0x4e67f8[_0x6bbb('0x18')]['id'])[_0x6bbb('0x15')](function(_0x1882e1){pm2[_0x6bbb('0x20')]();return _0x1882e1[0x0];})[_0x6bbb('0x15')](respondWithResult(_0x344750,null))[_0x6bbb('0x16')](handleError(_0x344750,null));}else{return _0x344750['status'](0x1f4)[_0x6bbb('0xc')]({'message':_0x6bbb('0x26')});}}; \ No newline at end of file +var _0xb6ba=['chdir','start','dump','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','reject','motion2','length','catch','params','then','create','body','script','join','../../files/plugins','cwd'];(function(_0x59b3d7,_0x4740d7){var _0x4d53ec=function(_0x32991b){while(--_0x32991b){_0x59b3d7['push'](_0x59b3d7['shift']());}};_0x4d53ec(++_0x4740d7);}(_0xb6ba,0xfb));var _0xab6b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xb6ba[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xab6b('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xab6b('0x1'));var path=require(_0xab6b('0x2'));var exec=require(_0xab6b('0x3'))[_0xab6b('0x4')];var BPromise=require(_0xab6b('0x5'));function handleEntityNotFound(_0x569ec0,_0x21936a){return function(_0x17fe54){if(!_0x17fe54){_0x569ec0[_0xab6b('0x6')](0x194);;}return _0x17fe54;};}function respondWithResult(_0x50a07a,_0x2cbb13){_0x2cbb13=_0x2cbb13||0xc8;return function(_0x31ee57){if(_0x31ee57){return _0x50a07a[_0xab6b('0x7')](_0x2cbb13)[_0xab6b('0x8')](_0x31ee57);}return null;};}function handleError(_0x11ccce,_0x4807d6){_0x4807d6=_0x4807d6||0x1f4;return function(_0x30fb48){logger[_0xab6b('0x9')](_0x30fb48[_0xab6b('0xa')]);if(_0x30fb48[_0xab6b('0xb')]){delete _0x30fb48[_0xab6b('0xb')];}_0x11ccce[_0xab6b('0x7')](_0x4807d6)[_0xab6b('0xc')](_0x30fb48);};}function execChildProcess(){return new BPromise(function(_0x1c1488,_0x416a2b){exec(_0xab6b('0xd'),function(_0x528ded,_0x4cbcac,_0x34d0c8){logger[_0xab6b('0xe')](_0x4cbcac);logger[_0xab6b('0xe')](_0x34d0c8);if(_0x528ded){logger['error'](_0x528ded);return _0x416a2b(_0x528ded);}return _0x1c1488(_0x4cbcac);});});}exports[_0xab6b('0xf')]=function(_0x157329,_0x39b105){return pm2[_0xab6b('0x10')]()['then'](function(_0x402035){if(_0x402035){var _0x2ba0c1=_[_0xab6b('0x11')](_0x402035,function(_0x992717){return _0x992717['name']==='express'||_0x992717[_0xab6b('0xb')]===_0xab6b('0x12');});return{'rows':_0x2ba0c1,'count':_0x2ba0c1[_0xab6b('0x13')]};}return null;})['then'](respondWithResult(_0x39b105,null))[_0xab6b('0x14')](handleError(_0x39b105,null));};exports['show']=function(_0x2ef943,_0x285d14){return pm2['describe'](_0x2ef943[_0xab6b('0x15')]['id'])[_0xab6b('0x16')](respondWithResult(_0x285d14,null))['then'](handleEntityNotFound(_0x285d14,null))['catch'](handleError(_0x285d14,null));};exports[_0xab6b('0x17')]=function(_0x5d1e7c,_0x5685ea){if(_0x5d1e7c[_0xab6b('0x18')][_0xab6b('0xb')]&&_0x5d1e7c[_0xab6b('0x18')][_0xab6b('0x19')]){var _0x1817f4=path[_0xab6b('0x1a')](__dirname,_0xab6b('0x1b'),_0x5d1e7c[_0xab6b('0x18')]['script']);var _0x4e2bca=process[_0xab6b('0x1c')]();process[_0xab6b('0x1d')](path['dirname'](_0x1817f4));return execChildProcess()['then'](function(_0x250256){process[_0xab6b('0x1d')](_0x4e2bca);return pm2[_0xab6b('0x1e')]({'name':_0x5d1e7c[_0xab6b('0x18')][_0xab6b('0xb')],'script':_0x1817f4});})[_0xab6b('0x16')](function(_0x11fd11){pm2[_0xab6b('0x1f')]();return _0x11fd11[0x0];})[_0xab6b('0x16')](respondWithResult(_0x5685ea,0xc9))['catch'](handleError(_0x5685ea,null));}else{return _0x5685ea['status'](0x1f4)[_0xab6b('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xab6b('0x20')]=function(_0x8e8c84,_0x2a3e67){if(_0x8e8c84[_0xab6b('0x18')]['id']){delete _0x8e8c84[_0xab6b('0x18')]['id'];}var _0x2064be={'online':_0xab6b('0x21'),'stopped':_0xab6b('0x22')};if(_0x2064be[_0xab6b('0x23')](_0x8e8c84[_0xab6b('0x18')][_0xab6b('0x7')])){return pm2[_0x2064be[_0x8e8c84[_0xab6b('0x18')][_0xab6b('0x7')]]](_0x8e8c84[_0xab6b('0x15')]['id'])[_0xab6b('0x16')](respondWithResult(_0x2a3e67,0xc8))[_0xab6b('0x14')](handleError(_0x2a3e67,null));}else{return _0x2a3e67[_0xab6b('0x7')](0x1f4)[_0xab6b('0xc')]({'message':_0xab6b('0x24')});}};exports[_0xab6b('0x25')]=function(_0x21de0b,_0x582334){if(_0x21de0b['body']['id']){delete _0x21de0b[_0xab6b('0x18')]['id'];}if(_0x21de0b['params']['id']){return pm2[_0xab6b('0x26')](_0x21de0b[_0xab6b('0x15')]['id'])['then'](function(_0x349c4c){pm2['dump']();return _0x349c4c[0x0];})[_0xab6b('0x16')](respondWithResult(_0x582334,null))['catch'](handleError(_0x582334,null));}else{return _0x582334[_0xab6b('0x7')](0x1f4)[_0xab6b('0xc')]({'message':_0xab6b('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 2fe269f..1d83d7d 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 _0x8aa3=['../../config/environment','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x270d33,_0x91c9f9){var _0xc1cabc=function(_0x3817a5){while(--_0x3817a5){_0x270d33['push'](_0x270d33['shift']());}};_0xc1cabc(++_0x91c9f9);}(_0x8aa3,0xe9));var _0x38aa=function(_0x28fef8,_0x16886b){_0x28fef8=_0x28fef8-0x0;var _0x3790c6=_0x8aa3[_0x28fef8];return _0x3790c6;};'use strict';var multer=require(_0x38aa('0x0'));var util=require(_0x38aa('0x1'));var path=require('path');var timeout=require(_0x38aa('0x2'));var express=require(_0x38aa('0x3'));var router=express[_0x38aa('0x4')]();var auth=require(_0x38aa('0x5'));var interaction=require(_0x38aa('0x6'));var config=require(_0x38aa('0x7'));module['exports']=router; \ No newline at end of file +var _0x1250=['connect-timeout','express','Router','../../components/auth/service','exports','multer','path'];(function(_0x583b8d,_0x4e54e3){var _0x16daab=function(_0x3e4b8f){while(--_0x3e4b8f){_0x583b8d['push'](_0x583b8d['shift']());}};_0x16daab(++_0x4e54e3);}(_0x1250,0xde));var _0x0125=function(_0x2c97a9,_0xd6a400){_0x2c97a9=_0x2c97a9-0x0;var _0x26b5aa=_0x1250[_0x2c97a9];return _0x26b5aa;};'use strict';var multer=require(_0x0125('0x0'));var util=require('util');var path=require(_0x0125('0x1'));var timeout=require(_0x0125('0x2'));var express=require(_0x0125('0x3'));var router=express[_0x0125('0x4')]();var auth=require(_0x0125('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x0125('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 9c13cc7..78b8559 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 _0x8cad=['sequelize','INTEGER','DATE','STRING'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8cad,0xd0));var _0xd8ca=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x8cad[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0xd8ca('0x0'));module['exports']={'state':{'type':Sequelize[_0xd8ca('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd8ca('0x2')]},'uniqueid':{'type':Sequelize[_0xd8ca('0x3')]},'starttime':{'type':Sequelize[_0xd8ca('0x2')]},'responsetime':{'type':Sequelize[_0xd8ca('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xd8ca('0x3')]},'campaigntype':{'type':Sequelize[_0xd8ca('0x3')]},'membername':{'type':Sequelize[_0xd8ca('0x3')]}}; \ No newline at end of file +var _0xed04=['STRING','DATE','exports','INTEGER'];(function(_0x24ac81,_0x269a14){var _0x2e7fea=function(_0x18917b){while(--_0x18917b){_0x24ac81['push'](_0x24ac81['shift']());}};_0x2e7fea(++_0x269a14);}(_0xed04,0x76));var _0x4ed0=function(_0x350ac6,_0x562634){_0x350ac6=_0x350ac6-0x0;var _0xc2a33a=_0xed04[_0x350ac6];return _0xc2a33a;};'use strict';var Sequelize=require('sequelize');module[_0x4ed0('0x0')]={'state':{'type':Sequelize[_0x4ed0('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x4ed0('0x2')]},'starttime':{'type':Sequelize[_0x4ed0('0x3')]},'responsetime':{'type':Sequelize[_0x4ed0('0x3')]},'ringtime':{'type':Sequelize[_0x4ed0('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x4ed0('0x2')]},'membername':{'type':Sequelize[_0x4ed0('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5bd3dc9..37408d9 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 _0x5f51=['ReportAgentPreview','report_agent_preview','../../config/logger','api','moment','bluebird','path','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x2472a6,_0x5f2d82){var _0x5c04b9=function(_0x184f77){while(--_0x184f77){_0x2472a6['push'](_0x2472a6['shift']());}};_0x5c04b9(++_0x5f2d82);}(_0x5f51,0x1f1));var _0x15f5=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f51[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x15f5('0x0'))(_0x15f5('0x1'));var moment=require(_0x15f5('0x2'));var BPromise=require(_0x15f5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15f5('0x4'));var rimraf=require('rimraf');var config=require(_0x15f5('0x5'));var attributes=require(_0x15f5('0x6'));module[_0x15f5('0x7')]=function(_0x276ec8,_0x323ae9){return _0x276ec8[_0x15f5('0x8')](_0x15f5('0x9'),attributes,{'tableName':_0x15f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4549=['exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4d210e,_0xe0ec19){var _0x33011c=function(_0x2e0417){while(--_0x2e0417){_0x4d210e['push'](_0x4d210e['shift']());}};_0x33011c(++_0xe0ec19);}(_0x4549,0xa9));var _0x9454=function(_0x4890db,_0x326fb2){_0x4890db=_0x4890db-0x0;var _0x3b91a2=_0x4549[_0x4890db];return _0x3b91a2;};'use strict';var _=require('lodash');var util=require(_0x9454('0x0'));var logger=require(_0x9454('0x1'))('api');var moment=require(_0x9454('0x2'));var BPromise=require(_0x9454('0x3'));var rp=require(_0x9454('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9454('0x5'));var config=require(_0x9454('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x9454('0x7')]=function(_0x1b00c8,_0x23192a){return _0x1b00c8[_0x9454('0x8')](_0x9454('0x9'),attributes,{'tableName':_0x9454('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 aaa9b00..ea2b146 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 _0x48e1=['client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48e1,0x19a));var _0x148e=function(_0x49ed85,_0x4b256d){_0x49ed85=_0x49ed85-0x0;var _0x2d4ebf=_0x48e1[_0x49ed85];return _0x2d4ebf;};'use strict';var _=require(_0x148e('0x0'));var util=require('util');var moment=require(_0x148e('0x1'));var BPromise=require(_0x148e('0x2'));var rs=require(_0x148e('0x3'));var fs=require('fs');var Redis=require(_0x148e('0x4'));var db=require(_0x148e('0x5'))['db'];var utils=require(_0x148e('0x6'));var logger=require(_0x148e('0x7'))(_0x148e('0x8'));var config=require('../../config/environment');var jayson=require(_0x148e('0x9'));var client=jayson[_0x148e('0xa')][_0x148e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2adaa2,_0x4325f5,_0x3dab6d){return new BPromise(function(_0x32ee10,_0x3e6ad2){return client[_0x148e('0xc')](_0x2adaa2,_0x3dab6d)['then'](function(_0x253546){logger[_0x148e('0xd')](_0x148e('0xe'),_0x4325f5,_0x148e('0xf'));logger[_0x148e('0x10')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x4325f5,_0x148e('0xf'),JSON[_0x148e('0x11')](_0x253546));if(_0x253546[_0x148e('0x12')]){if(_0x253546[_0x148e('0x12')][_0x148e('0x13')]===0x1f4){logger[_0x148e('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x4325f5,_0x253546[_0x148e('0x12')][_0x148e('0x14')]);return _0x3e6ad2(_0x253546[_0x148e('0x12')]['message']);}logger[_0x148e('0x12')](_0x148e('0xe'),_0x4325f5,_0x253546[_0x148e('0x12')][_0x148e('0x14')]);return _0x32ee10(_0x253546[_0x148e('0x12')][_0x148e('0x14')]);}else{logger[_0x148e('0xd')](_0x148e('0xe'),_0x4325f5,_0x148e('0xf'));_0x32ee10(_0x253546[_0x148e('0x15')][_0x148e('0x14')]);}})['catch'](function(_0x850924){logger[_0x148e('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x4325f5,_0x850924);_0x3e6ad2(_0x850924);});});}exports['CreateReportAgentPreview']=function(_0x35d6f3){var _0x1cb6a9=this;return new Promise(function(_0x58947d,_0x16b83d){return db[_0x148e('0x16')]['create'](_0x35d6f3[_0x148e('0x17')],{'raw':_0x35d6f3[_0x148e('0x18')]?_0x35d6f3[_0x148e('0x18')][_0x148e('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xee236e){logger[_0x148e('0xd')](_0x148e('0x1a'),_0x35d6f3);logger[_0x148e('0x10')](_0x148e('0x1a'),_0x35d6f3,JSON[_0x148e('0x11')](_0xee236e));_0x58947d(_0xee236e);})[_0x148e('0x1b')](function(_0x4212b5){logger[_0x148e('0x12')](_0x148e('0x1a'),_0x4212b5[_0x148e('0x14')],_0x35d6f3);_0x16b83d(_0x1cb6a9[_0x148e('0x12')](0x1f4,_0x4212b5[_0x148e('0x14')]));});});}; \ No newline at end of file +var _0x7a97=['../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a97,0x9e));var _0x77a9=function(_0x2f10e9,_0x1adc01){_0x2f10e9=_0x2f10e9-0x0;var _0x28e05d=_0x7a97[_0x2f10e9];return _0x28e05d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x77a9('0x0'));var BPromise=require('bluebird');var rs=require(_0x77a9('0x1'));var fs=require('fs');var Redis=require(_0x77a9('0x2'));var db=require(_0x77a9('0x3'))['db'];var utils=require(_0x77a9('0x4'));var logger=require(_0x77a9('0x5'))(_0x77a9('0x6'));var config=require(_0x77a9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x77a9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cce2b,_0x47ae77,_0x16cfcd){return new BPromise(function(_0x93bcdf,_0x4152aa){return client['request'](_0x1cce2b,_0x16cfcd)[_0x77a9('0x9')](function(_0xd600ed){logger[_0x77a9('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x47ae77,'request\x20sent');logger[_0x77a9('0xb')](_0x77a9('0xc'),_0x47ae77,_0x77a9('0xd'),JSON['stringify'](_0xd600ed));if(_0xd600ed[_0x77a9('0xe')]){if(_0xd600ed[_0x77a9('0xe')][_0x77a9('0xf')]===0x1f4){logger[_0x77a9('0xe')](_0x77a9('0x10'),_0x47ae77,_0xd600ed[_0x77a9('0xe')][_0x77a9('0x11')]);return _0x4152aa(_0xd600ed['error'][_0x77a9('0x11')]);}logger[_0x77a9('0xe')](_0x77a9('0x10'),_0x47ae77,_0xd600ed[_0x77a9('0xe')][_0x77a9('0x11')]);return _0x93bcdf(_0xd600ed[_0x77a9('0xe')][_0x77a9('0x11')]);}else{logger[_0x77a9('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x47ae77,'request\x20sent');_0x93bcdf(_0xd600ed[_0x77a9('0x12')][_0x77a9('0x11')]);}})[_0x77a9('0x13')](function(_0x4d78b5){logger[_0x77a9('0xe')](_0x77a9('0x10'),_0x47ae77,_0x4d78b5);_0x4152aa(_0x4d78b5);});});}exports[_0x77a9('0x14')]=function(_0x50db5d){var _0x30db9e=this;return new Promise(function(_0x30c17b,_0xc8d4b9){return db[_0x77a9('0x15')][_0x77a9('0x16')](_0x50db5d[_0x77a9('0x17')],{'raw':_0x50db5d[_0x77a9('0x18')]?_0x50db5d['options'][_0x77a9('0x19')]===undefined?!![]:![]:!![]})[_0x77a9('0x9')](function(_0x39107f){logger[_0x77a9('0xa')](_0x77a9('0x14'),_0x50db5d);logger[_0x77a9('0xb')]('CreateReportAgentPreview',_0x50db5d,JSON[_0x77a9('0x1a')](_0x39107f));_0x30c17b(_0x39107f);})[_0x77a9('0x13')](function(_0x3c40ad){logger[_0x77a9('0xe')](_0x77a9('0x14'),_0x3c40ad[_0x77a9('0x11')],_0x50db5d);_0xc8d4b9(_0x30db9e[_0x77a9('0xe')](0x1f4,_0x3c40ad['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 735bb19..830567b 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 _0xae10=['/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','agentNotify','multer','util','path','express','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues'];(function(_0x25d5e9,_0x340fda){var _0xa351e2=function(_0x14bc4a){while(--_0x14bc4a){_0x25d5e9['push'](_0x25d5e9['shift']());}};_0xa351e2(++_0x340fda);}(_0xae10,0x8a));var _0x0ae1=function(_0x3870df,_0x378156){_0x3870df=_0x3870df-0x0;var _0x234db9=_0xae10[_0x3870df];return _0x234db9;};'use strict';var multer=require(_0x0ae1('0x0'));var util=require(_0x0ae1('0x1'));var path=require(_0x0ae1('0x2'));var express=require(_0x0ae1('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x0ae1('0x4'));router[_0x0ae1('0x5')](_0x0ae1('0x6'),auth[_0x0ae1('0x7')](),controller['voiceChannels']);router[_0x0ae1('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x0ae1('0x7')](),controller['voiceChannelMixMonitor']);router['get'](_0x0ae1('0x8'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x9')]);router[_0x0ae1('0x5')](_0x0ae1('0xa'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0xb')]);router[_0x0ae1('0x5')](_0x0ae1('0xc'),auth['isAuthenticated'](),controller['chatQueues']);router[_0x0ae1('0x5')](_0x0ae1('0xd'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0xe')]);router[_0x0ae1('0x5')](_0x0ae1('0xf'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x10')]);router[_0x0ae1('0x5')](_0x0ae1('0x11'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x12')]);router['get'](_0x0ae1('0x13'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x14')]);router['get'](_0x0ae1('0x15'),auth[_0x0ae1('0x7')](),controller['whatsappQueues']);router['get'](_0x0ae1('0x16'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x17')]);router[_0x0ae1('0x5')](_0x0ae1('0x18'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x19')]);router[_0x0ae1('0x5')](_0x0ae1('0x1a'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x1b')]);router[_0x0ae1('0x5')](_0x0ae1('0x1c'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x1d')]);router[_0x0ae1('0x5')](_0x0ae1('0x1e'),auth['isAuthenticated'](),controller[_0x0ae1('0x1f')]);router[_0x0ae1('0x5')](_0x0ae1('0x20'),auth[_0x0ae1('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x0ae1('0x5')]('/voice/queues/:id',auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x21')]);router['get'](_0x0ae1('0x22'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x23')]);router[_0x0ae1('0x5')](_0x0ae1('0x24'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x25')]);router[_0x0ae1('0x5')](_0x0ae1('0x26'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x27')]);router[_0x0ae1('0x28')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0x0ae1('0x5')]('/telephones',auth['isAuthenticated'](),controller[_0x0ae1('0x29')]);router[_0x0ae1('0x5')]('/trunks',auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x2a')]);router[_0x0ae1('0x5')](_0x0ae1('0x2b'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x2c')]);router[_0x0ae1('0x5')](_0x0ae1('0x2d'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x2e')]);router[_0x0ae1('0x5')](_0x0ae1('0x2f'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x30')]);router[_0x0ae1('0x5')](_0x0ae1('0x31'),auth['isAuthenticated'](),controller[_0x0ae1('0x32')]);router['get'](_0x0ae1('0x33'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x34')]);router[_0x0ae1('0x5')](_0x0ae1('0x35'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x36')]);router[_0x0ae1('0x5')](_0x0ae1('0x37'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x38')]);router[_0x0ae1('0x5')](_0x0ae1('0x39'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x3a')]);router['post'](_0x0ae1('0x3b'),auth[_0x0ae1('0x7')](),controller['queueNotify'](_0x0ae1('0x3c')));router[_0x0ae1('0x5')](_0x0ae1('0x3d'),auth[_0x0ae1('0x7')](),controller['showMailQueues']);router[_0x0ae1('0x3e')](_0x0ae1('0x3f'),auth['isAuthenticated'](),controller[_0x0ae1('0x40')](_0x0ae1('0x41')));router[_0x0ae1('0x5')](_0x0ae1('0x42'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x43')]);router[_0x0ae1('0x3e')](_0x0ae1('0x44'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x40')]('fax'));router[_0x0ae1('0x5')](_0x0ae1('0x45'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x46')]);router[_0x0ae1('0x3e')]('/openchannel/queues/:id/notify',auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x40')](_0x0ae1('0x47')));router[_0x0ae1('0x5')](_0x0ae1('0x48'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x49')]);router[_0x0ae1('0x3e')](_0x0ae1('0x4a'),auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x40')]('sms'));router[_0x0ae1('0x3e')](_0x0ae1('0x4b'),auth[_0x0ae1('0x7')](),controller['queueNotify'](_0x0ae1('0x4c')));router[_0x0ae1('0x5')](_0x0ae1('0x4d'),auth[_0x0ae1('0x7')](),controller['showSmsQueues']);router[_0x0ae1('0x5')]('/whatsapp/queues/:id',auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x4e')]);router[_0x0ae1('0x3e')]('/agents/:id/notify',auth[_0x0ae1('0x7')](),controller[_0x0ae1('0x4f')]);module['exports']=router; \ No newline at end of file +var _0x1358=['smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','Router','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','outbound','/outbound/channels','outboundChannels','/agents','put','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions'];(function(_0x4f8933,_0x5b2ac6){var _0x3f6550=function(_0x3aa423){while(--_0x3aa423){_0x4f8933['push'](_0x4f8933['shift']());}};_0x3f6550(++_0x5b2ac6);}(_0x1358,0x182));var _0x8135=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x1358[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x8135('0x0'));var util=require(_0x8135('0x1'));var path=require('path');var express=require('express');var router=express[_0x8135('0x2')]();var auth=require(_0x8135('0x3'));var controller=require(_0x8135('0x4'));router['get'](_0x8135('0x5'),auth[_0x8135('0x6')](),controller[_0x8135('0x7')]);router[_0x8135('0x8')](_0x8135('0x9'),auth[_0x8135('0x6')](),controller['voiceChannelMixMonitor']);router[_0x8135('0x8')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x8135('0x6')](),controller[_0x8135('0xa')]);router['get'](_0x8135('0xb'),auth[_0x8135('0x6')](),controller[_0x8135('0xc')]);router[_0x8135('0x8')](_0x8135('0xd'),auth[_0x8135('0x6')](),controller[_0x8135('0xe')]);router[_0x8135('0x8')]('/mail/queues',auth[_0x8135('0x6')](),controller['mailQueues']);router[_0x8135('0x8')](_0x8135('0xf'),auth[_0x8135('0x6')](),controller['mailAccounts']);router[_0x8135('0x8')]('/openchannel/queues',auth[_0x8135('0x6')](),controller[_0x8135('0x10')]);router['get'](_0x8135('0x11'),auth[_0x8135('0x6')](),controller[_0x8135('0x12')]);router[_0x8135('0x8')](_0x8135('0x13'),auth[_0x8135('0x6')](),controller['whatsappQueues']);router[_0x8135('0x8')](_0x8135('0x14'),auth[_0x8135('0x6')](),controller['faxQueues']);router[_0x8135('0x8')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0x8135('0x15')]);router['get'](_0x8135('0x16'),auth[_0x8135('0x6')](),controller[_0x8135('0x17')]);router[_0x8135('0x8')](_0x8135('0x18'),auth[_0x8135('0x6')](),controller[_0x8135('0x19')]);router[_0x8135('0x8')](_0x8135('0x1a'),auth[_0x8135('0x6')](),controller[_0x8135('0x1b')]);router[_0x8135('0x8')](_0x8135('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x8135('0x8')]('/voice/queues/:id',auth[_0x8135('0x6')](),controller[_0x8135('0x1d')]);router[_0x8135('0x8')]('/outbound',auth[_0x8135('0x6')](),controller[_0x8135('0x1e')]);router[_0x8135('0x8')](_0x8135('0x1f'),auth[_0x8135('0x6')](),controller[_0x8135('0x20')]);router[_0x8135('0x8')](_0x8135('0x21'),auth[_0x8135('0x6')](),controller['agents']);router[_0x8135('0x22')](_0x8135('0x23'),auth[_0x8135('0x6')](),controller['agentCapacity']);router[_0x8135('0x8')](_0x8135('0x24'),auth[_0x8135('0x6')](),controller['telephones']);router[_0x8135('0x8')](_0x8135('0x25'),auth[_0x8135('0x6')](),controller[_0x8135('0x26')]);router['get'](_0x8135('0x27'),auth[_0x8135('0x6')](),controller['campaigns']);router[_0x8135('0x8')](_0x8135('0x28'),auth[_0x8135('0x6')](),controller['faxAccounts']);router[_0x8135('0x8')](_0x8135('0x29'),auth[_0x8135('0x6')](),controller[_0x8135('0x2a')]);router[_0x8135('0x8')]('/mail/queues/waitinginteractions',auth[_0x8135('0x6')](),controller[_0x8135('0x2b')]);router[_0x8135('0x8')](_0x8135('0x2c'),auth['isAuthenticated'](),controller[_0x8135('0x2d')]);router[_0x8135('0x8')]('/sms/queues/waitinginteractions',auth[_0x8135('0x6')](),controller[_0x8135('0x2e')]);router[_0x8135('0x8')]('/whatsapp/queues/waitinginteractions',auth[_0x8135('0x6')](),controller[_0x8135('0x2f')]);router['get'](_0x8135('0x30'),auth[_0x8135('0x6')](),controller[_0x8135('0x31')]);router[_0x8135('0x32')](_0x8135('0x33'),auth['isAuthenticated'](),controller[_0x8135('0x34')](_0x8135('0x35')));router[_0x8135('0x8')](_0x8135('0x36'),auth[_0x8135('0x6')](),controller['showMailQueues']);router[_0x8135('0x32')](_0x8135('0x37'),auth['isAuthenticated'](),controller[_0x8135('0x34')](_0x8135('0x38')));router['get'](_0x8135('0x39'),auth[_0x8135('0x6')](),controller['showChatQueues']);router[_0x8135('0x32')](_0x8135('0x3a'),auth['isAuthenticated'](),controller['queueNotify'](_0x8135('0x3b')));router[_0x8135('0x8')](_0x8135('0x3c'),auth[_0x8135('0x6')](),controller['showFaxQueues']);router[_0x8135('0x32')](_0x8135('0x3d'),auth['isAuthenticated'](),controller['queueNotify']('openchannel'));router[_0x8135('0x8')]('/openchannel/queues/:id',auth[_0x8135('0x6')](),controller[_0x8135('0x3e')]);router[_0x8135('0x32')](_0x8135('0x3f'),auth[_0x8135('0x6')](),controller[_0x8135('0x34')](_0x8135('0x40')));router['post']('/whatsapp/queues/:id/notify',auth[_0x8135('0x6')](),controller['queueNotify'](_0x8135('0x41')));router['get'](_0x8135('0x42'),auth['isAuthenticated'](),controller[_0x8135('0x43')]);router[_0x8135('0x8')](_0x8135('0x44'),auth[_0x8135('0x6')](),controller[_0x8135('0x45')]);router[_0x8135('0x32')](_0x8135('0x46'),auth[_0x8135('0x6')](),controller[_0x8135('0x47')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6ec682a..97336b8 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 _0x315b=['Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','channel','Agent\x20not\x20found','From','Start','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','catch','status','sendStatus','stack','name','send','isNil','find','rows','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','body','interaction','user','hasOwnProperty','MemberReport','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','format','SIP/%s','interface','agent','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x315b,0x162));var _0xb315=function(_0x1b7107,_0x2c2e54){_0x1b7107=_0x1b7107-0x0;var _0x2cd462=_0x315b[_0x1b7107];return _0x2cd462;};'use strict';var BPromise=require(_0xb315('0x0'));var moment=require(_0xb315('0x1'));var _=require(_0xb315('0x2'));var util=require(_0xb315('0x3'));var db=require(_0xb315('0x4'))['db'];var logger=require('../../config/logger')(_0xb315('0x5'));var jayson=require(_0xb315('0x6'));var amiClient=jayson[_0xb315('0x7')][_0xb315('0x8')]({'port':0x232a});var mailClient=jayson[_0xb315('0x7')][_0xb315('0x8')]({'port':0x232b});var routingClient=jayson[_0xb315('0x7')][_0xb315('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x583213,_0x1ce01a,_0x17d899){return new BPromise(function(_0x5e8664,_0x84dd3b){var _0x3cae61=_0x17d899?_0x17d899:amiClient;return _0x3cae61[_0xb315('0x9')](_0x583213,_0x1ce01a)[_0xb315('0xa')](function(_0x400191){if(_0x400191[_0xb315('0xb')]){if(_0x400191[_0xb315('0xb')][_0xb315('0xc')]===0x1f4){return _0x84dd3b(_0x400191['error'][_0xb315('0xd')]);}return _0x5e8664(_0x400191[_0xb315('0xb')][_0xb315('0xd')]);}else{_0x5e8664(_0x400191['result']);}})[_0xb315('0xe')](function(_0x33ef07){_0x84dd3b(_0x33ef07);});});}function respondWithResult(_0xed19bb,_0x5448de){_0x5448de=_0x5448de||0xc8;return function(_0x10663f){if(_0x10663f){return _0xed19bb[_0xb315('0xf')](_0x5448de)['json'](_0x10663f);}return _0xed19bb[_0xb315('0x10')](0x194);};}function handleError(_0x1376d6,_0x3e41bd){_0x3e41bd=_0x3e41bd||0x1f4;return function(_0x326d43){logger[_0xb315('0xb')](_0x326d43[_0xb315('0x11')]);if(_0x326d43[_0xb315('0x12')]){delete _0x326d43[_0xb315('0x12')];}_0x1376d6[_0xb315('0xf')](_0x3e41bd)[_0xb315('0x13')](_0x326d43);};}function findById(_0x3e4df2){return function(_0x22788a){if(!_['isNil'](_0x3e4df2)&&!_[_0xb315('0x14')](_0x22788a)&&!_['isNil'](_0x22788a['rows'])){return _[_0xb315('0x15')](_0x22788a[_0xb315('0x16')],function(_0x530e47){return _0x530e47['id']==_0x3e4df2;});}return null;};}exports['voiceChannels']=function(_0x171247,_0x2510ca){return respondWithRpcPromise('VoiceChannels',_0x171247[_0xb315('0x17')])['then'](respondWithResult(_0x2510ca,null))['catch'](handleError(_0x2510ca,null));};exports[_0xb315('0x18')]=function(_0x3fa0c9,_0x36b558){return respondWithRpcPromise(_0xb315('0x19'),_[_0xb315('0x1a')](_0x3fa0c9[_0xb315('0x17')],_0x3fa0c9[_0xb315('0x1b')]))[_0xb315('0xa')](respondWithResult(_0x36b558,null))['catch'](handleError(_0x36b558,null));};exports[_0xb315('0x1c')]=function(_0x35e274,_0x23f05f){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x35e274[_0xb315('0x17')],_0x35e274[_0xb315('0x1b')]))['then'](respondWithResult(_0x23f05f,null))[_0xb315('0xe')](handleError(_0x23f05f,null));};exports[_0xb315('0x1d')]=function(_0x57fbf3,_0x55e20b){return respondWithRpcPromise(_0xb315('0x1e'),_0x57fbf3[_0xb315('0x17')])[_0xb315('0xa')](respondWithResult(_0x55e20b,null))[_0xb315('0xe')](handleError(_0x55e20b,null));};exports[_0xb315('0x1f')]=function(_0x617ff2,_0x28415a){return respondWithRpcPromise('VoiceQueues',_0x617ff2[_0xb315('0x17')])[_0xb315('0xa')](findById(_0x617ff2[_0xb315('0x1b')]['id']))[_0xb315('0xa')](respondWithResult(_0x28415a,null))['catch'](handleError(_0x28415a,null));};exports[_0xb315('0x20')]=function(_0x56c9eb,_0x2626c6){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x56c9eb[_0xb315('0x17')],_0x56c9eb[_0xb315('0x1b')]))[_0xb315('0xa')](respondWithResult(_0x2626c6,null))[_0xb315('0xe')](handleError(_0x2626c6,null));};exports[_0xb315('0x21')]=function(_0x5ba220,_0x10c7b5){return respondWithRpcPromise(_0xb315('0x22'),_0x5ba220[_0xb315('0x17')])[_0xb315('0xa')](respondWithResult(_0x10c7b5,null))[_0xb315('0xe')](handleError(_0x10c7b5,null));};exports[_0xb315('0x23')]=function(_0x3674c3,_0x28f227){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xb315('0x1a')](_0x3674c3['query'],_0x3674c3['params']))['then'](respondWithResult(_0x28f227,null))[_0xb315('0xe')](handleError(_0x28f227,null));};exports[_0xb315('0x24')]=function(_0x5bad83,_0x33051c){return respondWithRpcPromise(_0xb315('0x25'),_[_0xb315('0x1a')](_0x5bad83['query'],_0x5bad83[_0xb315('0x1b')]))[_0xb315('0xa')](respondWithResult(_0x33051c,null))['catch'](handleError(_0x33051c,null));};exports[_0xb315('0x26')]=function(_0x1f5edf,_0x1bab1c){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x1f5edf[_0xb315('0x17')],_0x1f5edf[_0xb315('0x1b')]))[_0xb315('0xa')](respondWithResult(_0x1bab1c,null))[_0xb315('0xe')](handleError(_0x1bab1c,null));};exports[_0xb315('0x27')]=function(_0x2c1b92,_0x4cbf7e){return respondWithRpcPromise(_0xb315('0x28'),_0x2c1b92[_0xb315('0x17')])[_0xb315('0xa')](respondWithResult(_0x4cbf7e,null))[_0xb315('0xe')](handleError(_0x4cbf7e,null));};exports[_0xb315('0x29')]=function(_0x4680b2,_0x52e372){return respondWithRpcPromise(_0xb315('0x2a'),_0x4680b2[_0xb315('0x17')])[_0xb315('0xa')](respondWithResult(_0x52e372,null))['catch'](handleError(_0x52e372,null));};exports[_0xb315('0x2b')]=function(_0x221062,_0x1f07b3){var _0x2f95c5;return respondWithRpcPromise('Agents',_0x221062[_0xb315('0x17')])[_0xb315('0xa')](function(_0x5f4fe3){_0x2f95c5=_0x5f4fe3;return respondWithRpcPromise('Agents',_0x221062['query'],routingClient);})[_0xb315('0xa')](function(_0x26c157){return _['merge']({},_0x26c157,_0x2f95c5);})[_0xb315('0xa')](respondWithResult(_0x1f07b3,null))[_0xb315('0xe')](handleError(_0x1f07b3,null));};exports['agentCapacity']=function(_0x23800a,_0x240db0){if(_0x23800a['body']&&_0x23800a[_0xb315('0x2c')][_0xb315('0x2d')]&&_0x23800a[_0xb315('0x2e')]&&_0x23800a['user'][_0xb315('0x12')]){for(var _0x11f642 in _0x23800a[_0xb315('0x2c')]['interaction']){if(_0x23800a[_0xb315('0x2c')][_0xb315('0x2d')][_0xb315('0x2f')](_0x11f642)){db[_0xb315('0x30')]['findAll']({'where':{'channel':_0x11f642,'membername':_0x23800a[_0xb315('0x2e')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x23800a[_0xb315('0x2c')][_0xb315('0x2d')][_0x11f642]&&_0x23800a[_0xb315('0x2c')][_0xb315('0x2d')][_0x11f642][_0xb315('0x31')]?{'$notIn':_0x23800a[_0xb315('0x2c')][_0xb315('0x2d')][_0x11f642]}:{'$ne':null}}})[_0xb315('0xa')](function(_0x183669){var _0x3ec756=moment()['format'](_0xb315('0x32'));for(var _0x345d43=0x0,_0x210f4b=_0x183669['length'];_0x345d43<_0x210f4b;_0x345d43+=0x1){_0x183669[_0x345d43][_0xb315('0x33')]({'exitAt':_0x3ec756});}});for(var _0x559313=0x0;_0x559313<_0x23800a[_0xb315('0x2c')][_0xb315('0x2d')][_0x11f642][_0xb315('0x31')];_0x559313+=0x1){db[_0xb315('0x30')]['findOrCreate']({'where':{'channel':_0x11f642,'membername':_0x23800a[_0xb315('0x2e')]['name'],'type':_0xb315('0x34'),'uniqueid':_0x23800a['body']['interaction'][_0x11f642][_0x559313],'exitAt':null},'defaults':{'channel':_0x11f642,'membername':_0x23800a[_0xb315('0x2e')][_0xb315('0x12')],'interface':_[_0xb315('0x14')](_0x23800a[_0xb315('0x2e')]['interface'])?util[_0xb315('0x35')](_0xb315('0x36'),_0x23800a[_0xb315('0x2e')][_0xb315('0x12')]):_0x23800a['user'][_0xb315('0x37')],'type':_0xb315('0x34'),'enterAt':moment()[_0xb315('0x35')](_0xb315('0x32')),'role':_0xb315('0x38'),'internal':_0x23800a['user']['internal'],'uniqueid':_0x23800a['body'][_0xb315('0x2d')][_0x11f642][_0x559313]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x23800a[_0xb315('0x1b')]['id'],'capacity':_0x23800a[_0xb315('0x2c')][_0xb315('0x39')]},routingClient)[_0xb315('0xa')](respondWithResult(_0x240db0,null))['catch'](handleError(_0x240db0,null));};exports[_0xb315('0x3a')]=function(_0x4594a5,_0x802875){return respondWithRpcPromise(_0xb315('0x3b'),_0x4594a5[_0xb315('0x17')])[_0xb315('0xa')](respondWithResult(_0x802875,null))['catch'](handleError(_0x802875,null));};exports[_0xb315('0x3c')]=function(_0x4e4078,_0x96f96e){return respondWithRpcPromise('Trunks',_0x4e4078[_0xb315('0x17')])['then'](respondWithResult(_0x96f96e,null))[_0xb315('0xe')](handleError(_0x96f96e,null));};exports['campaigns']=function(_0x18844a,_0x58b6a1){return respondWithRpcPromise(_0xb315('0x3d'),_0x18844a[_0xb315('0x17')])[_0xb315('0xa')](respondWithResult(_0x58b6a1,null))[_0xb315('0xe')](handleError(_0x58b6a1,null));};exports[_0xb315('0x3e')]=function(_0x2cda27,_0x31e6c3){return respondWithRpcPromise(_0xb315('0x3f'),_0x2cda27[_0xb315('0x17')],routingClient)['then'](respondWithResult(_0x31e6c3,null))['catch'](handleError(_0x31e6c3,null));};exports[_0xb315('0x40')]=function(_0x3d80bf,_0x5c7a65){return respondWithRpcPromise(_0xb315('0x3f'),_0x3d80bf[_0xb315('0x17')],routingClient)['then'](findById(_0x3d80bf[_0xb315('0x1b')]['id']))[_0xb315('0xa')](respondWithResult(_0x5c7a65,null))['catch'](handleError(_0x5c7a65,null));};exports[_0xb315('0x41')]=function(_0x5327a8,_0x3ee697){return respondWithRpcPromise(_0xb315('0x42'),_0x5327a8[_0xb315('0x17')],routingClient)[_0xb315('0xa')](respondWithResult(_0x3ee697,null))[_0xb315('0xe')](handleError(_0x3ee697,null));};exports[_0xb315('0x43')]=function(_0x4353be,_0x2bda53){return respondWithRpcPromise(_0xb315('0x42'),_0x4353be[_0xb315('0x17')],routingClient)[_0xb315('0xa')](findById(_0x4353be[_0xb315('0x1b')]['id']))[_0xb315('0xa')](respondWithResult(_0x2bda53,null))['catch'](handleError(_0x2bda53,null));};exports[_0xb315('0x44')]=function(_0xd5019c,_0x9fc419){return respondWithRpcPromise('MailAccounts',_0xd5019c[_0xb315('0x17')],mailClient)[_0xb315('0xa')](respondWithResult(_0x9fc419,null))[_0xb315('0xe')](handleError(_0x9fc419,null));};exports[_0xb315('0x45')]=function(_0x530989,_0x5ab6a0){return respondWithRpcPromise('OpenchannelQueues',_0x530989[_0xb315('0x17')],routingClient)[_0xb315('0xa')](respondWithResult(_0x5ab6a0,null))['catch'](handleError(_0x5ab6a0,null));};exports[_0xb315('0x46')]=function(_0x4b6ce6,_0x2c5267){return respondWithRpcPromise('OpenchannelQueues',_0x4b6ce6[_0xb315('0x17')],routingClient)['then'](findById(_0x4b6ce6[_0xb315('0x1b')]['id']))[_0xb315('0xa')](respondWithResult(_0x2c5267,null))['catch'](handleError(_0x2c5267,null));};exports[_0xb315('0x47')]=function(_0x3db794,_0x1ed738){return respondWithRpcPromise(_0xb315('0x48'),_0x3db794[_0xb315('0x17')],routingClient)[_0xb315('0xa')](respondWithResult(_0x1ed738,null))[_0xb315('0xe')](handleError(_0x1ed738,null));};exports[_0xb315('0x49')]=function(_0x10af68,_0x4e5058){return respondWithRpcPromise(_0xb315('0x48'),_0x10af68['query'],routingClient)[_0xb315('0xa')](findById(_0x10af68[_0xb315('0x1b')]['id']))[_0xb315('0xa')](respondWithResult(_0x4e5058,null))['catch'](handleError(_0x4e5058,null));};exports[_0xb315('0x4a')]=function(_0x17052e,_0x18f9ee){return respondWithRpcPromise('WhatsappQueues',_0x17052e[_0xb315('0x17')],routingClient)['then'](respondWithResult(_0x18f9ee,null))[_0xb315('0xe')](handleError(_0x18f9ee,null));};exports['showWhatsappQueues']=function(_0x27255a,_0x3d1416){return respondWithRpcPromise(_0xb315('0x4b'),_0x27255a[_0xb315('0x17')],routingClient)[_0xb315('0xa')](findById(_0x27255a[_0xb315('0x1b')]['id']))['then'](respondWithResult(_0x3d1416,null))['catch'](handleError(_0x3d1416,null));};exports['faxQueues']=function(_0x1c024a,_0x35c20f){return respondWithRpcPromise(_0xb315('0x4c'),_0x1c024a[_0xb315('0x17')],routingClient)[_0xb315('0xa')](respondWithResult(_0x35c20f,null))[_0xb315('0xe')](handleError(_0x35c20f,null));};exports['showFaxQueues']=function(_0x54011d,_0x522ff7){return respondWithRpcPromise('FaxQueues',_0x54011d[_0xb315('0x17')],routingClient)[_0xb315('0xa')](findById(_0x54011d['params']['id']))[_0xb315('0xa')](respondWithResult(_0x522ff7,null))[_0xb315('0xe')](handleError(_0x522ff7,null));};exports[_0xb315('0x4d')]=function(_0x223176,_0x292cdf){return respondWithRpcPromise(_0xb315('0x4e'),_0x223176[_0xb315('0x17')])[_0xb315('0xa')](respondWithResult(_0x292cdf,null))[_0xb315('0xe')](handleError(_0x292cdf,null));};exports['chatQueuesWaitingInteractions']=function(_0x2c3353,_0x2bbc31){return respondWithRpcPromise(_0xb315('0x4f'),_0x2c3353['query'],routingClient)[_0xb315('0xa')](respondWithResult(_0x2bbc31,null))[_0xb315('0xe')](handleError(_0x2bbc31,null));};exports[_0xb315('0x50')]=function(_0x5448c8,_0x3ea75f){return respondWithRpcPromise(_0xb315('0x51'),_0x5448c8[_0xb315('0x17')],routingClient)[_0xb315('0xa')](respondWithResult(_0x3ea75f,null))[_0xb315('0xe')](handleError(_0x3ea75f,null));};exports[_0xb315('0x52')]=function(_0x29515a,_0x272db7){return respondWithRpcPromise(_0xb315('0x53'),_0x29515a[_0xb315('0x17')],routingClient)[_0xb315('0xa')](respondWithResult(_0x272db7,null))[_0xb315('0xe')](handleError(_0x272db7,null));};exports[_0xb315('0x54')]=function(_0x3566b3,_0x3a20db){return respondWithRpcPromise(_0xb315('0x55'),_0x3566b3[_0xb315('0x17')],routingClient)['then'](respondWithResult(_0x3a20db,null))[_0xb315('0xe')](handleError(_0x3a20db,null));};exports[_0xb315('0x56')]=function(_0x3e5c4f,_0x4779cd){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3e5c4f['query'],routingClient)[_0xb315('0xa')](respondWithResult(_0x4779cd,null))['catch'](handleError(_0x4779cd,null));};exports[_0xb315('0x57')]=function(_0x4d48fa,_0x3bb289){return respondWithRpcPromise(_0xb315('0x58'),_0x4d48fa[_0xb315('0x17')],routingClient)[_0xb315('0xa')](respondWithResult(_0x3bb289,null))[_0xb315('0xe')](handleError(_0x3bb289,null));};exports['queueNotify']=function(_0x38e1d7){return function(_0x4ff7c2,_0x13749a){var _0x3887a1,_0x25a3a5;var _0x1f88b0=_[_0xb315('0x59')](_0x38e1d7);var _0x564f2b=_0x38e1d7===_0xb315('0x5a')?_0xb315('0x5b'):'Account';return db[_0x1f88b0+_0xb315('0x5c')][_0xb315('0x5d')]({'raw':!![],'where':{'id':_0x4ff7c2[_0xb315('0x1b')]['id']}})[_0xb315('0xa')](function(_0x33b52e){if(_[_0xb315('0x14')](_0x33b52e)){throw new Error(_0x1f88b0+_0xb315('0x5e'));}_0x3887a1=_0x33b52e;return db[_0x1f88b0+_0xb315('0x5f')][_0xb315('0x5d')]({'where':{'id':_0x4ff7c2[_0xb315('0x2c')][_0xb315('0x60')]},'include':[{'model':db[_0x1f88b0+_0xb315('0x61')],'as':_0xb315('0x61')},{'model':db[_0x1f88b0+_0x564f2b],'as':_0xb315('0x62')}]});})[_0xb315('0xa')](function(_0x3a7fca){if(_[_0xb315('0x14')](_0x3a7fca)){throw new Error(_0x1f88b0+_0xb315('0x63'));}_0x25a3a5=_0x3a7fca;return _0x3a7fca[_0xb315('0x64')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb315('0xa')](function(){var _0x277f5a={'uniqueid':_0x38e1d7+'.'+_0x25a3a5['id']+'.'+_0x25a3a5[_0xb315('0x61')]['id'],'FromUserId':_0x4ff7c2[_0xb315('0x2e')]['id'],'type':_0xb315('0x65')};_0x277f5a[_0x1f88b0+_0xb315('0x66')]=_0x25a3a5['id'];_0x277f5a[_0x1f88b0+_0xb315('0x67')]=_0x25a3a5[_0xb315('0x61')]['id'];_0x277f5a['From'+_0x1f88b0+_0x564f2b+'Id']=_0x25a3a5[_0xb315('0x62')]['id'];_0x277f5a['To'+_0x1f88b0+_0xb315('0x68')]=_0x3887a1['id'];return db[_0x1f88b0+_0xb315('0x69')][_0xb315('0x6a')](_0x277f5a);})[_0xb315('0xa')](function(){return respondWithRpcPromise('Start',{'channel':_0x38e1d7,'interaction':_0x25a3a5['Interaction'],'message':_0x25a3a5,'account':_0x25a3a5[_0xb315('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb315('0x65'),'appdata':_0x3887a1[_0xb315('0x12')]+','+(_0x25a3a5['Account'][_0xb315('0x6b')]||0x12c),'interval':_0xb315('0x6c')}]},routingClient);})[_0xb315('0xa')](respondWithResult(_0x13749a,null))['catch'](handleError(_0x13749a,null));};};exports['agentNotify']=function(_0x50d68f,_0x3d82f4){var _0x17510c,_0x45c2ab;if(_[_0xb315('0x14')](_0x50d68f[_0xb315('0x2c')][_0xb315('0x6d')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x3040c9=_0x50d68f['body'][_0xb315('0x6d')];var _0x318807=_[_0xb315('0x59')](_0x3040c9);var _0x11ba55=_0x3040c9===_0xb315('0x5a')?'Website':_0xb315('0x62');return db['User']['findOne']({'raw':!![],'where':{'id':_0x50d68f['params']['id'],'role':_0xb315('0x38')}})['then'](function(_0x5d171f){if(_[_0xb315('0x14')](_0x5d171f)){throw new Error(_0xb315('0x6e'));}_0x17510c=_0x5d171f;return db[_0x318807+_0xb315('0x5f')][_0xb315('0x5d')]({'where':{'id':_0x50d68f[_0xb315('0x2c')][_0xb315('0x60')]},'include':[{'model':db[_0x318807+_0xb315('0x61')],'as':'Interaction'},{'model':db[_0x318807+_0x11ba55],'as':_0xb315('0x62')}]});})['then'](function(_0x66136b){if(_[_0xb315('0x14')](_0x66136b)){throw new Error(_0x318807+_0xb315('0x63'));}_0x45c2ab=_0x66136b;return _0x66136b['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xb315('0xa')](function(){var _0x100e52={'uniqueid':_0x3040c9+'.'+_0x45c2ab['id']+'.'+_0x45c2ab[_0xb315('0x61')]['id'],'FromUserId':_0x50d68f[_0xb315('0x2e')]['id'],'type':_0xb315('0x65'),'ToUserId':_0x17510c['id']};_0x100e52[_0x318807+_0xb315('0x66')]=_0x45c2ab['id'];_0x100e52[_0x318807+'InteractionId']=_0x45c2ab[_0xb315('0x61')]['id'];_0x100e52[_0xb315('0x6f')+_0x318807+_0x11ba55+'Id']=_0x45c2ab[_0xb315('0x62')]['id'];return db[_0x318807+_0xb315('0x69')][_0xb315('0x6a')](_0x100e52);})[_0xb315('0xa')](function(){return respondWithRpcPromise(_0xb315('0x70'),{'channel':_0x3040c9,'interaction':_0x45c2ab[_0xb315('0x61')],'message':_0x45c2ab,'account':_0x45c2ab['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x17510c['name']+','+(_0x45c2ab[_0xb315('0x62')]['agentTransferTimeout']||0x12c),'interval':_0xb315('0x6c')}]},routingClient);})[_0xb315('0xa')](respondWithResult(_0x3d82f4,null))[_0xb315('0xe')](handleError(_0x3d82f4,null));}; \ No newline at end of file +var _0x1544=['Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','result','catch','json','sendStatus','name','status','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','queue','MessageId','From','QueueId','TransferReport','create','Start','*,*,*,*','channel'];(function(_0x19b25c,_0x45b77c){var _0x360acc=function(_0x103c8e){while(--_0x103c8e){_0x19b25c['push'](_0x19b25c['shift']());}};_0x360acc(++_0x45b77c);}(_0x1544,0xfb));var _0x4154=function(_0x2f506e,_0x2bef86){_0x2f506e=_0x2f506e-0x0;var _0x1a67b2=_0x1544[_0x2f506e];return _0x1a67b2;};'use strict';var BPromise=require(_0x4154('0x0'));var moment=require(_0x4154('0x1'));var _=require(_0x4154('0x2'));var util=require(_0x4154('0x3'));var db=require(_0x4154('0x4'))['db'];var logger=require(_0x4154('0x5'))(_0x4154('0x6'));var jayson=require(_0x4154('0x7'));var amiClient=jayson[_0x4154('0x8')][_0x4154('0x9')]({'port':0x232a});var mailClient=jayson[_0x4154('0x8')][_0x4154('0x9')]({'port':0x232b});var routingClient=jayson['client'][_0x4154('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x45f4ed,_0x4e80b8,_0x310aed){return new BPromise(function(_0xe72b38,_0x3c636c){var _0x27997e=_0x310aed?_0x310aed:amiClient;return _0x27997e['request'](_0x45f4ed,_0x4e80b8)[_0x4154('0xa')](function(_0x359c5f){if(_0x359c5f['error']){if(_0x359c5f[_0x4154('0xb')][_0x4154('0xc')]===0x1f4){return _0x3c636c(_0x359c5f[_0x4154('0xb')][_0x4154('0xd')]);}return _0xe72b38(_0x359c5f['error'][_0x4154('0xd')]);}else{_0xe72b38(_0x359c5f[_0x4154('0xe')]);}})[_0x4154('0xf')](function(_0x4940fe){_0x3c636c(_0x4940fe);});});}function respondWithResult(_0xbc8b14,_0x517737){_0x517737=_0x517737||0xc8;return function(_0x48e436){if(_0x48e436){return _0xbc8b14['status'](_0x517737)[_0x4154('0x10')](_0x48e436);}return _0xbc8b14[_0x4154('0x11')](0x194);};}function handleError(_0x163288,_0x19c709){_0x19c709=_0x19c709||0x1f4;return function(_0x443413){logger[_0x4154('0xb')](_0x443413['stack']);if(_0x443413[_0x4154('0x12')]){delete _0x443413['name'];}_0x163288[_0x4154('0x13')](_0x19c709)[_0x4154('0x14')](_0x443413);};}function findById(_0xd5f18c){return function(_0x545c9c){if(!_['isNil'](_0xd5f18c)&&!_[_0x4154('0x15')](_0x545c9c)&&!_[_0x4154('0x15')](_0x545c9c[_0x4154('0x16')])){return _[_0x4154('0x17')](_0x545c9c[_0x4154('0x16')],function(_0x182575){return _0x182575['id']==_0xd5f18c;});}return null;};}exports[_0x4154('0x18')]=function(_0x3b6e4a,_0x51acfd){return respondWithRpcPromise(_0x4154('0x19'),_0x3b6e4a[_0x4154('0x1a')])[_0x4154('0xa')](respondWithResult(_0x51acfd,null))['catch'](handleError(_0x51acfd,null));};exports[_0x4154('0x1b')]=function(_0x3b6562,_0x2076f8){return respondWithRpcPromise(_0x4154('0x1c'),_['merge'](_0x3b6562[_0x4154('0x1a')],_0x3b6562['params']))['then'](respondWithResult(_0x2076f8,null))[_0x4154('0xf')](handleError(_0x2076f8,null));};exports[_0x4154('0x1d')]=function(_0x566c34,_0x437f4a){return respondWithRpcPromise(_0x4154('0x1e'),_[_0x4154('0x1f')](_0x566c34[_0x4154('0x1a')],_0x566c34[_0x4154('0x20')]))[_0x4154('0xa')](respondWithResult(_0x437f4a,null))['catch'](handleError(_0x437f4a,null));};exports[_0x4154('0x21')]=function(_0x383827,_0x29c0ad){return respondWithRpcPromise(_0x4154('0x22'),_0x383827[_0x4154('0x1a')])[_0x4154('0xa')](respondWithResult(_0x29c0ad,null))[_0x4154('0xf')](handleError(_0x29c0ad,null));};exports['showVoiceQueues']=function(_0x3f4bd2,_0x544863){return respondWithRpcPromise(_0x4154('0x22'),_0x3f4bd2['query'])[_0x4154('0xa')](findById(_0x3f4bd2['params']['id']))[_0x4154('0xa')](respondWithResult(_0x544863,null))[_0x4154('0xf')](handleError(_0x544863,null));};exports[_0x4154('0x23')]=function(_0x4667de,_0x3ed6fe){return respondWithRpcPromise(_0x4154('0x24'),_[_0x4154('0x1f')](_0x4667de['query'],_0x4667de[_0x4154('0x20')]))['then'](respondWithResult(_0x3ed6fe,null))[_0x4154('0xf')](handleError(_0x3ed6fe,null));};exports['voiceQueuesChannels']=function(_0x347eb7,_0xbb664d){return respondWithRpcPromise('VoiceQueuesChannels',_0x347eb7[_0x4154('0x1a')])['then'](respondWithResult(_0xbb664d,null))[_0x4154('0xf')](handleError(_0xbb664d,null));};exports[_0x4154('0x25')]=function(_0x44a266,_0x2d9af9){return respondWithRpcPromise(_0x4154('0x26'),_['merge'](_0x44a266[_0x4154('0x1a')],_0x44a266[_0x4154('0x20')]))[_0x4154('0xa')](respondWithResult(_0x2d9af9,null))[_0x4154('0xf')](handleError(_0x2d9af9,null));};exports['voiceQueuesChannelHangup']=function(_0x7c33c,_0x5dff84){return respondWithRpcPromise(_0x4154('0x27'),_[_0x4154('0x1f')](_0x7c33c[_0x4154('0x1a')],_0x7c33c[_0x4154('0x20')]))['then'](respondWithResult(_0x5dff84,null))['catch'](handleError(_0x5dff84,null));};exports[_0x4154('0x28')]=function(_0x4b5e1f,_0x4d9f2e){return respondWithRpcPromise(_0x4154('0x29'),_[_0x4154('0x1f')](_0x4b5e1f[_0x4154('0x1a')],_0x4b5e1f['params']))[_0x4154('0xa')](respondWithResult(_0x4d9f2e,null))['catch'](handleError(_0x4d9f2e,null));};exports[_0x4154('0x2a')]=function(_0x384e95,_0x939c26){return respondWithRpcPromise(_0x4154('0x2b'),_0x384e95[_0x4154('0x1a')])[_0x4154('0xa')](respondWithResult(_0x939c26,null))['catch'](handleError(_0x939c26,null));};exports[_0x4154('0x2c')]=function(_0x35081b,_0x446463){return respondWithRpcPromise(_0x4154('0x2d'),_0x35081b['query'])['then'](respondWithResult(_0x446463,null))[_0x4154('0xf')](handleError(_0x446463,null));};exports[_0x4154('0x2e')]=function(_0xaa081f,_0x4394bd){var _0x308be9;return respondWithRpcPromise(_0x4154('0x2f'),_0xaa081f['query'])['then'](function(_0x3ff320){_0x308be9=_0x3ff320;return respondWithRpcPromise('Agents',_0xaa081f[_0x4154('0x1a')],routingClient);})[_0x4154('0xa')](function(_0x403353){return _['merge']({},_0x403353,_0x308be9);})['then'](respondWithResult(_0x4394bd,null))['catch'](handleError(_0x4394bd,null));};exports[_0x4154('0x30')]=function(_0x395df0,_0x228637){if(_0x395df0[_0x4154('0x31')]&&_0x395df0[_0x4154('0x31')][_0x4154('0x32')]&&_0x395df0[_0x4154('0x33')]&&_0x395df0[_0x4154('0x33')][_0x4154('0x12')]){for(var _0x31cfe5 in _0x395df0['body'][_0x4154('0x32')]){if(_0x395df0[_0x4154('0x31')][_0x4154('0x32')][_0x4154('0x34')](_0x31cfe5)){db[_0x4154('0x35')][_0x4154('0x36')]({'where':{'channel':_0x31cfe5,'membername':_0x395df0[_0x4154('0x33')][_0x4154('0x12')],'type':_0x4154('0x37'),'exitAt':null,'uniqueid':_0x395df0[_0x4154('0x31')][_0x4154('0x32')][_0x31cfe5]&&_0x395df0[_0x4154('0x31')][_0x4154('0x32')][_0x31cfe5]['length']?{'$notIn':_0x395df0['body'][_0x4154('0x32')][_0x31cfe5]}:{'$ne':null}}})[_0x4154('0xa')](function(_0x95268e){var _0x12a863=moment()[_0x4154('0x38')](_0x4154('0x39'));for(var _0x12745e=0x0,_0x32e990=_0x95268e[_0x4154('0x3a')];_0x12745e<_0x32e990;_0x12745e+=0x1){_0x95268e[_0x12745e][_0x4154('0x3b')]({'exitAt':_0x12a863});}});for(var _0x23682b=0x0;_0x23682b<_0x395df0['body'][_0x4154('0x32')][_0x31cfe5][_0x4154('0x3a')];_0x23682b+=0x1){db['MemberReport'][_0x4154('0x3c')]({'where':{'channel':_0x31cfe5,'membername':_0x395df0[_0x4154('0x33')][_0x4154('0x12')],'type':'INTERACTION','uniqueid':_0x395df0[_0x4154('0x31')][_0x4154('0x32')][_0x31cfe5][_0x23682b],'exitAt':null},'defaults':{'channel':_0x31cfe5,'membername':_0x395df0['user'][_0x4154('0x12')],'interface':_[_0x4154('0x15')](_0x395df0[_0x4154('0x33')][_0x4154('0x3d')])?util['format'](_0x4154('0x3e'),_0x395df0['user'][_0x4154('0x12')]):_0x395df0['user'][_0x4154('0x3d')],'type':_0x4154('0x37'),'enterAt':moment()[_0x4154('0x38')](_0x4154('0x39')),'role':'agent','internal':_0x395df0[_0x4154('0x33')][_0x4154('0x3f')],'uniqueid':_0x395df0['body']['interaction'][_0x31cfe5][_0x23682b]}});}}}}return respondWithRpcPromise(_0x4154('0x40'),{'id':_0x395df0[_0x4154('0x20')]['id'],'capacity':_0x395df0[_0x4154('0x31')][_0x4154('0x41')]},routingClient)['then'](respondWithResult(_0x228637,null))['catch'](handleError(_0x228637,null));};exports[_0x4154('0x42')]=function(_0x291113,_0x4e0103){return respondWithRpcPromise(_0x4154('0x43'),_0x291113[_0x4154('0x1a')])[_0x4154('0xa')](respondWithResult(_0x4e0103,null))[_0x4154('0xf')](handleError(_0x4e0103,null));};exports['trunks']=function(_0x101cfc,_0x308280){return respondWithRpcPromise(_0x4154('0x44'),_0x101cfc[_0x4154('0x1a')])[_0x4154('0xa')](respondWithResult(_0x308280,null))[_0x4154('0xf')](handleError(_0x308280,null));};exports[_0x4154('0x45')]=function(_0x199d01,_0x4ddddf){return respondWithRpcPromise('Campaigns',_0x199d01[_0x4154('0x1a')])[_0x4154('0xa')](respondWithResult(_0x4ddddf,null))[_0x4154('0xf')](handleError(_0x4ddddf,null));};exports[_0x4154('0x46')]=function(_0x594d76,_0x17ff7f){return respondWithRpcPromise(_0x4154('0x47'),_0x594d76['query'],routingClient)[_0x4154('0xa')](respondWithResult(_0x17ff7f,null))[_0x4154('0xf')](handleError(_0x17ff7f,null));};exports[_0x4154('0x48')]=function(_0x57dfa4,_0x382e67){return respondWithRpcPromise(_0x4154('0x47'),_0x57dfa4['query'],routingClient)[_0x4154('0xa')](findById(_0x57dfa4[_0x4154('0x20')]['id']))[_0x4154('0xa')](respondWithResult(_0x382e67,null))['catch'](handleError(_0x382e67,null));};exports[_0x4154('0x49')]=function(_0x2c5ee5,_0x29075a){return respondWithRpcPromise(_0x4154('0x4a'),_0x2c5ee5[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](respondWithResult(_0x29075a,null))['catch'](handleError(_0x29075a,null));};exports[_0x4154('0x4b')]=function(_0x3ff394,_0x5edede){return respondWithRpcPromise(_0x4154('0x4a'),_0x3ff394[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](findById(_0x3ff394[_0x4154('0x20')]['id']))[_0x4154('0xa')](respondWithResult(_0x5edede,null))[_0x4154('0xf')](handleError(_0x5edede,null));};exports[_0x4154('0x4c')]=function(_0x432af9,_0x32d52a){return respondWithRpcPromise(_0x4154('0x4d'),_0x432af9[_0x4154('0x1a')],mailClient)['then'](respondWithResult(_0x32d52a,null))[_0x4154('0xf')](handleError(_0x32d52a,null));};exports['openchannelQueues']=function(_0x32e8ae,_0x202c73){return respondWithRpcPromise(_0x4154('0x4e'),_0x32e8ae[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](respondWithResult(_0x202c73,null))[_0x4154('0xf')](handleError(_0x202c73,null));};exports['showOpenchannelQueues']=function(_0x499875,_0x2e823c){return respondWithRpcPromise(_0x4154('0x4e'),_0x499875[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](findById(_0x499875[_0x4154('0x20')]['id']))[_0x4154('0xa')](respondWithResult(_0x2e823c,null))['catch'](handleError(_0x2e823c,null));};exports['smsQueues']=function(_0x515741,_0x12fca3){return respondWithRpcPromise('SmsQueues',_0x515741[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](respondWithResult(_0x12fca3,null))[_0x4154('0xf')](handleError(_0x12fca3,null));};exports['showSmsQueues']=function(_0x319e7b,_0x420896){return respondWithRpcPromise(_0x4154('0x4f'),_0x319e7b[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](findById(_0x319e7b[_0x4154('0x20')]['id']))[_0x4154('0xa')](respondWithResult(_0x420896,null))['catch'](handleError(_0x420896,null));};exports[_0x4154('0x50')]=function(_0x108da0,_0x5603b7){return respondWithRpcPromise(_0x4154('0x51'),_0x108da0[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](respondWithResult(_0x5603b7,null))[_0x4154('0xf')](handleError(_0x5603b7,null));};exports[_0x4154('0x52')]=function(_0x34dddd,_0x5f5782){return respondWithRpcPromise('WhatsappQueues',_0x34dddd[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](findById(_0x34dddd[_0x4154('0x20')]['id']))['then'](respondWithResult(_0x5f5782,null))['catch'](handleError(_0x5f5782,null));};exports[_0x4154('0x53')]=function(_0x3ab8fc,_0x551e63){return respondWithRpcPromise(_0x4154('0x54'),_0x3ab8fc[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](respondWithResult(_0x551e63,null))[_0x4154('0xf')](handleError(_0x551e63,null));};exports['showFaxQueues']=function(_0x57b3a9,_0x3cc296){return respondWithRpcPromise('FaxQueues',_0x57b3a9['query'],routingClient)[_0x4154('0xa')](findById(_0x57b3a9[_0x4154('0x20')]['id']))['then'](respondWithResult(_0x3cc296,null))[_0x4154('0xf')](handleError(_0x3cc296,null));};exports[_0x4154('0x55')]=function(_0x45cd98,_0x3423b3){return respondWithRpcPromise('FaxAccounts',_0x45cd98[_0x4154('0x1a')])[_0x4154('0xa')](respondWithResult(_0x3423b3,null))['catch'](handleError(_0x3423b3,null));};exports[_0x4154('0x56')]=function(_0x2e3a83,_0x41aeed){return respondWithRpcPromise(_0x4154('0x57'),_0x2e3a83[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](respondWithResult(_0x41aeed,null))[_0x4154('0xf')](handleError(_0x41aeed,null));};exports[_0x4154('0x58')]=function(_0x335893,_0x11eb99){return respondWithRpcPromise(_0x4154('0x59'),_0x335893['query'],routingClient)['then'](respondWithResult(_0x11eb99,null))[_0x4154('0xf')](handleError(_0x11eb99,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x472c8c,_0x2b3649){return respondWithRpcPromise(_0x4154('0x5a'),_0x472c8c['query'],routingClient)['then'](respondWithResult(_0x2b3649,null))[_0x4154('0xf')](handleError(_0x2b3649,null));};exports[_0x4154('0x5b')]=function(_0x5d4f6e,_0x2687e6){return respondWithRpcPromise(_0x4154('0x5c'),_0x5d4f6e[_0x4154('0x1a')],routingClient)[_0x4154('0xa')](respondWithResult(_0x2687e6,null))[_0x4154('0xf')](handleError(_0x2687e6,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x345d60,_0x20a842){return respondWithRpcPromise(_0x4154('0x5d'),_0x345d60[_0x4154('0x1a')],routingClient)['then'](respondWithResult(_0x20a842,null))[_0x4154('0xf')](handleError(_0x20a842,null));};exports['faxQueuesWaitingInteractions']=function(_0x2b9989,_0x2a8828){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2b9989['query'],routingClient)['then'](respondWithResult(_0x2a8828,null))[_0x4154('0xf')](handleError(_0x2a8828,null));};exports[_0x4154('0x5e')]=function(_0x2cde79){return function(_0x2357b8,_0x5c29ec){var _0x4b61a7,_0x2f91bb;var _0x29397b=_[_0x4154('0x5f')](_0x2cde79);var _0x13ebc2=_0x2cde79===_0x4154('0x60')?_0x4154('0x61'):_0x4154('0x62');return db[_0x29397b+_0x4154('0x63')][_0x4154('0x64')]({'raw':!![],'where':{'id':_0x2357b8[_0x4154('0x20')]['id']}})[_0x4154('0xa')](function(_0x303e25){if(_[_0x4154('0x15')](_0x303e25)){throw new Error(_0x29397b+_0x4154('0x65'));}_0x4b61a7=_0x303e25;return db[_0x29397b+'Message'][_0x4154('0x64')]({'where':{'id':_0x2357b8['body']['messageId']},'include':[{'model':db[_0x29397b+_0x4154('0x66')],'as':_0x4154('0x66')},{'model':db[_0x29397b+_0x13ebc2],'as':_0x4154('0x62')}]});})['then'](function(_0x377fc9){if(_[_0x4154('0x15')](_0x377fc9)){throw new Error(_0x29397b+'\x20Message\x20not\x20found');}_0x2f91bb=_0x377fc9;return _0x377fc9['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x4154('0xa')](function(){var _0x31b8b3={'uniqueid':_0x2cde79+'.'+_0x2f91bb['id']+'.'+_0x2f91bb[_0x4154('0x66')]['id'],'FromUserId':_0x2357b8['user']['id'],'type':_0x4154('0x67')};_0x31b8b3[_0x29397b+_0x4154('0x68')]=_0x2f91bb['id'];_0x31b8b3[_0x29397b+'InteractionId']=_0x2f91bb[_0x4154('0x66')]['id'];_0x31b8b3[_0x4154('0x69')+_0x29397b+_0x13ebc2+'Id']=_0x2f91bb[_0x4154('0x62')]['id'];_0x31b8b3['To'+_0x29397b+_0x4154('0x6a')]=_0x4b61a7['id'];return db[_0x29397b+_0x4154('0x6b')][_0x4154('0x6c')](_0x31b8b3);})['then'](function(){return respondWithRpcPromise(_0x4154('0x6d'),{'channel':_0x2cde79,'interaction':_0x2f91bb[_0x4154('0x66')],'message':_0x2f91bb,'account':_0x2f91bb['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x4154('0x67'),'appdata':_0x4b61a7['name']+','+(_0x2f91bb[_0x4154('0x62')]['queueTransferTimeout']||0x12c),'interval':_0x4154('0x6e')}]},routingClient);})[_0x4154('0xa')](respondWithResult(_0x5c29ec,null))[_0x4154('0xf')](handleError(_0x5c29ec,null));};};exports['agentNotify']=function(_0x53b53d,_0x7f3cd4){var _0x1d4365,_0x464ae4;if(_[_0x4154('0x15')](_0x53b53d['body'][_0x4154('0x6f')])){throw new Error(_0x4154('0x70'));}var _0x1fbec4=_0x53b53d[_0x4154('0x31')][_0x4154('0x6f')];var _0x194ab2=_[_0x4154('0x5f')](_0x1fbec4);var _0x3417b9=_0x1fbec4===_0x4154('0x60')?_0x4154('0x61'):_0x4154('0x62');return db[_0x4154('0x71')][_0x4154('0x64')]({'raw':!![],'where':{'id':_0x53b53d[_0x4154('0x20')]['id'],'role':_0x4154('0x72')}})[_0x4154('0xa')](function(_0x41a3a6){if(_[_0x4154('0x15')](_0x41a3a6)){throw new Error(_0x4154('0x73'));}_0x1d4365=_0x41a3a6;return db[_0x194ab2+_0x4154('0x74')][_0x4154('0x64')]({'where':{'id':_0x53b53d[_0x4154('0x31')][_0x4154('0x75')]},'include':[{'model':db[_0x194ab2+'Interaction'],'as':_0x4154('0x66')},{'model':db[_0x194ab2+_0x3417b9],'as':_0x4154('0x62')}]});})[_0x4154('0xa')](function(_0x47f84){if(_[_0x4154('0x15')](_0x47f84)){throw new Error(_0x194ab2+_0x4154('0x76'));}_0x464ae4=_0x47f84;return _0x47f84['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x4154('0xa')](function(){var _0x48feb9={'uniqueid':_0x1fbec4+'.'+_0x464ae4['id']+'.'+_0x464ae4[_0x4154('0x66')]['id'],'FromUserId':_0x53b53d[_0x4154('0x33')]['id'],'type':_0x4154('0x67'),'ToUserId':_0x1d4365['id']};_0x48feb9[_0x194ab2+_0x4154('0x68')]=_0x464ae4['id'];_0x48feb9[_0x194ab2+_0x4154('0x77')]=_0x464ae4['Interaction']['id'];_0x48feb9[_0x4154('0x69')+_0x194ab2+_0x3417b9+'Id']=_0x464ae4[_0x4154('0x62')]['id'];return db[_0x194ab2+_0x4154('0x6b')]['create'](_0x48feb9);})[_0x4154('0xa')](function(){return respondWithRpcPromise(_0x4154('0x6d'),{'channel':_0x1fbec4,'interaction':_0x464ae4['Interaction'],'message':_0x464ae4,'account':_0x464ae4[_0x4154('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1d4365[_0x4154('0x12')]+','+(_0x464ae4[_0x4154('0x62')][_0x4154('0x78')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x4154('0xa')](respondWithResult(_0x7f3cd4,null))['catch'](handleError(_0x7f3cd4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a8a65f9..c0f5cc8 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 _0xb2d0=['create','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb2d0,0x1e8));var _0x0b2d=function(_0x109efe,_0x49ffe6){_0x109efe=_0x109efe-0x0;var _0x4a5335=_0xb2d0[_0x109efe];return _0x4a5335;};'use strict';var multer=require(_0x0b2d('0x0'));var util=require(_0x0b2d('0x1'));var path=require(_0x0b2d('0x2'));var timeout=require(_0x0b2d('0x3'));var express=require(_0x0b2d('0x4'));var router=express[_0x0b2d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0b2d('0x6'));var config=require(_0x0b2d('0x7'));var controller=require(_0x0b2d('0x8'));router[_0x0b2d('0x9')]('/',auth[_0x0b2d('0xa')](),controller[_0x0b2d('0xb')]);router[_0x0b2d('0x9')](_0x0b2d('0xc'),auth[_0x0b2d('0xa')](),controller[_0x0b2d('0xd')]);router['get'](_0x0b2d('0xe'),auth[_0x0b2d('0xa')](),controller[_0x0b2d('0xf')]);router['post']('/',auth[_0x0b2d('0xa')](),controller[_0x0b2d('0x10')]);router['put'](_0x0b2d('0xc'),auth[_0x0b2d('0xa')](),controller['update']);router['delete']('/:id',auth[_0x0b2d('0xa')](),controller['destroy']);module[_0x0b2d('0x11')]=router; \ No newline at end of file +var _0xc89d=['post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc89d,0x6b));var _0xdc89=function(_0x4d4e8a,_0x162fd7){_0x4d4e8a=_0x4d4e8a-0x0;var _0x2e304d=_0xc89d[_0x4d4e8a];return _0x2e304d;};'use strict';var multer=require('multer');var util=require(_0xdc89('0x0'));var path=require('path');var timeout=require(_0xdc89('0x1'));var express=require('express');var router=express[_0xdc89('0x2')]();var auth=require(_0xdc89('0x3'));var interaction=require(_0xdc89('0x4'));var config=require('../../config/environment');var controller=require(_0xdc89('0x5'));router[_0xdc89('0x6')]('/',auth[_0xdc89('0x7')](),controller[_0xdc89('0x8')]);router[_0xdc89('0x6')](_0xdc89('0x9'),auth['isAuthenticated'](),controller[_0xdc89('0xa')]);router[_0xdc89('0x6')](_0xdc89('0xb'),auth[_0xdc89('0x7')](),controller[_0xdc89('0xc')]);router[_0xdc89('0xd')]('/',auth[_0xdc89('0x7')](),controller[_0xdc89('0xe')]);router[_0xdc89('0xf')](_0xdc89('0x9'),auth[_0xdc89('0x7')](),controller[_0xdc89('0x10')]);router[_0xdc89('0x11')](_0xdc89('0x9'),auth[_0xdc89('0x7')](),controller[_0xdc89('0x12')]);module[_0xdc89('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 8754765..b71aa10 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 _0xbeea=['TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','days','hours','csv','pdf','xlsx','custom'];(function(_0x296771,_0x91d033){var _0x5e2788=function(_0x574669){while(--_0x574669){_0x296771['push'](_0x296771['shift']());}};_0x5e2788(++_0x91d033);}(_0xbeea,0xb1));var _0xabee=function(_0x18b9aa,_0x3aa3ca){_0x18b9aa=_0x18b9aa-0x0;var _0x5a854b=_0xbeea[_0x18b9aa];return _0x5a854b;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'name':{'type':Sequelize[_0xabee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xabee('0x1')]},'active':{'type':Sequelize[_0xabee('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xabee('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xabee('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xabee('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xabee('0x6')](_0xabee('0x7'),_0xabee('0x8'),'months','weeks',_0xabee('0x9'),_0xabee('0xa'),'minutes'),'allowNull':![],'defaultValue':_0xabee('0x9')},'output':{'type':Sequelize['ENUM'](_0xabee('0xb'),_0xabee('0xc'),_0xabee('0xd')),'allowNull':![],'defaultValue':_0xabee('0xb')},'type':{'type':Sequelize[_0xabee('0x6')](_0xabee('0xe'),'default'),'allowNull':![],'defaultValue':_0xabee('0xe')},'sendMail':{'type':Sequelize[_0xabee('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xabee('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xabee('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xabee('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8098=['weeks','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months'];(function(_0x558615,_0x1eb496){var _0x1e032a=function(_0x538f1d){while(--_0x538f1d){_0x558615['push'](_0x558615['shift']());}};_0x1e032a(++_0x1eb496);}(_0x8098,0x1ba));var _0x8809=function(_0xe7483d,_0x845fcc){_0xe7483d=_0xe7483d-0x0;var _0x52cc59=_0x8098[_0xe7483d];return _0x52cc59;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8809('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x8809('0x0')]},'active':{'type':Sequelize[_0x8809('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x8809('0x0')],'allowNull':![],'defaultValue':_0x8809('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x8809('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x8809('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x8809('0x5')](_0x8809('0x6'),'quarters',_0x8809('0x7'),_0x8809('0x8'),'days',_0x8809('0x9'),_0x8809('0xa')),'allowNull':![],'defaultValue':_0x8809('0xb')},'output':{'type':Sequelize[_0x8809('0x5')](_0x8809('0xc'),_0x8809('0xd'),_0x8809('0xe')),'allowNull':![],'defaultValue':_0x8809('0xc')},'type':{'type':Sequelize[_0x8809('0x5')](_0x8809('0xf'),_0x8809('0x10')),'allowNull':![],'defaultValue':_0x8809('0xf')},'sendMail':{'type':Sequelize[_0x8809('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x8809('0x0')]},'cc':{'type':Sequelize[_0x8809('0x11')]},'bcc':{'type':Sequelize[_0x8809('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 4e4892b..7c5faff 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 _0x833b=['moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','Schedule','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0xf16b2f,_0x41d883){var _0x13206e=function(_0x40e2dd){while(--_0x40e2dd){_0xf16b2f['push'](_0xf16b2f['shift']());}};_0x13206e(++_0x41d883);}(_0x833b,0x19b));var _0xb833=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x833b[_0x243b59];return _0x3e1676;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb833('0x0'));var rimraf=require(_0xb833('0x1'));var zipdir=require(_0xb833('0x2'));var jsonpatch=require(_0xb833('0x3'));var rp=require('request-promise');var moment=require(_0xb833('0x4'));var BPromise=require(_0xb833('0x5'));var Mustache=require(_0xb833('0x6'));var util=require(_0xb833('0x7'));var path=require('path');var sox=require(_0xb833('0x8'));var csv=require('to-csv');var ejs=require(_0xb833('0x9'));var fs=require('fs');var _=require(_0xb833('0xa'));var squel=require(_0xb833('0xb'));var crypto=require(_0xb833('0xc'));var jsforce=require(_0xb833('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb833('0xe'));var querystring=require(_0xb833('0xf'));var Papa=require(_0xb833('0x10'));var Redis=require(_0xb833('0x11'));var authService=require(_0xb833('0x12'));var qs=require(_0xb833('0x13'));var as=require(_0xb833('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb833('0x15'));var utils=require(_0xb833('0x16'));var config=require(_0xb833('0x17'));var db=require(_0xb833('0x18'))['db'];function respondWithStatusCode(_0x3f5068,_0x5d77eb){_0x5d77eb=_0x5d77eb||0xcc;return function(_0x4d672e){if(_0x4d672e){return _0x3f5068[_0xb833('0x19')](_0x5d77eb);}return _0x3f5068[_0xb833('0x1a')](_0x5d77eb)[_0xb833('0x1b')]();};}function respondWithResult(_0x5868c8,_0xeb556d){_0xeb556d=_0xeb556d||0xc8;return function(_0x3f5c19){if(_0x3f5c19){return _0x5868c8[_0xb833('0x1a')](_0xeb556d)['json'](_0x3f5c19);}};}function respondWithFilteredResult(_0x2e2d84,_0x3eb4ec){return function(_0x5ac2ff){if(_0x5ac2ff){var _0x169469=_0x5ac2ff[_0xb833('0x1c')],_0x2b3ce3=_0x3eb4ec[_0xb833('0x1d')],_0x4daa7f=_0x3eb4ec[_0xb833('0x1d')]+_0x3eb4ec['limit'],_0xd7a723;if(_0x4daa7f>=_0x169469){_0x4daa7f=_0x169469;_0xd7a723=0xc8;}else{_0xd7a723=0xce;}_0x2e2d84['status'](_0xd7a723);return _0x2e2d84[_0xb833('0x1e')](_0xb833('0x1f'),_0x2b3ce3+'-'+_0x4daa7f+'/'+_0x169469)[_0xb833('0x20')](_0x5ac2ff);}return null;};}function patchUpdates(_0x20f0d3){return function(_0xafbe1a){try{jsonpatch['apply'](_0xafbe1a,_0x20f0d3,!![]);}catch(_0x59a834){return BPromise[_0xb833('0x21')](_0x59a834);}return _0xafbe1a['save']();};}function saveUpdates(_0x1bf4ae,_0x4eb0e3){return function(_0x5440a5){if(_0x5440a5){return _0x5440a5[_0xb833('0x22')](_0x1bf4ae)[_0xb833('0x23')](function(_0x433661){return _0x433661;});}return null;};}function removeEntity(_0x494961,_0x5e2b4b){return function(_0x19a9a0){if(_0x19a9a0){return _0x19a9a0[_0xb833('0x24')]()[_0xb833('0x23')](function(){var _0x124f72=_0x19a9a0[_0xb833('0x25')]({'plain':!![]});var _0x12ffdc=_0xb833('0x26');return db[_0xb833('0x27')][_0xb833('0x24')]({'where':{'type':_0x12ffdc,'resourceId':_0x124f72['id']}})[_0xb833('0x23')](function(){return _0x19a9a0;});})[_0xb833('0x23')](function(){_0x494961[_0xb833('0x1a')](0xcc)[_0xb833('0x1b')]();});}};}function handleEntityNotFound(_0x299aa2,_0x4bd968){return function(_0x16f1e1){if(!_0x16f1e1){_0x299aa2[_0xb833('0x19')](0x194);}return _0x16f1e1;};}function handleError(_0x2909e5,_0x326540){_0x326540=_0x326540||0x1f4;return function(_0x484b3c){logger[_0xb833('0x28')](_0x484b3c[_0xb833('0x29')]);if(_0x484b3c[_0xb833('0x2a')]){delete _0x484b3c[_0xb833('0x2a')];}_0x2909e5['status'](_0x326540)['send'](_0x484b3c);};}exports['index']=function(_0x34fff7,_0x35e046){var _0x156b23={},_0x14fc5e={},_0x7ad9dd={'count':0x0,'rows':[]};var _0x5a0dc6=_['map'](db[_0xb833('0x2b')]['rawAttributes'],function(_0x3fd687){return{'name':_0x3fd687[_0xb833('0x2c')],'type':_0x3fd687[_0xb833('0x2d')][_0xb833('0x2e')]};});_0x14fc5e['model']=_[_0xb833('0x2f')](_0x5a0dc6,'name');_0x14fc5e[_0xb833('0x30')]=_[_0xb833('0x31')](_0x34fff7[_0xb833('0x30')]);_0x14fc5e[_0xb833('0x32')]=_[_0xb833('0x33')](_0x14fc5e[_0xb833('0x34')],_0x14fc5e[_0xb833('0x30')]);_0x156b23[_0xb833('0x35')]=_['intersection'](_0x14fc5e[_0xb833('0x34')],qs[_0xb833('0x36')](_0x34fff7['query'][_0xb833('0x36')]));_0x156b23[_0xb833('0x35')]=_0x156b23[_0xb833('0x35')][_0xb833('0x37')]?_0x156b23[_0xb833('0x35')]:_0x14fc5e[_0xb833('0x34')];if(!_0x34fff7[_0xb833('0x30')][_0xb833('0x38')](_0xb833('0x39'))){_0x156b23[_0xb833('0x3a')]=qs[_0xb833('0x3a')](_0x34fff7[_0xb833('0x30')]['limit']);_0x156b23[_0xb833('0x1d')]=qs[_0xb833('0x1d')](_0x34fff7[_0xb833('0x30')][_0xb833('0x1d')]);}_0x156b23['order']=qs['sort'](_0x34fff7[_0xb833('0x30')]['sort']);_0x156b23[_0xb833('0x3b')]=qs[_0xb833('0x32')](_[_0xb833('0x3c')](_0x34fff7['query'],_0x14fc5e[_0xb833('0x32')]),_0x5a0dc6);if(_0x34fff7[_0xb833('0x30')][_0xb833('0x3d')]){_0x156b23[_0xb833('0x3b')]=_['merge'](_0x156b23['where'],{'$or':_[_0xb833('0x2f')](_0x5a0dc6,function(_0xcab748){if(_0xcab748['type']!==_0xb833('0x3e')){var _0x13c5ce={};_0x13c5ce[_0xcab748['name']]={'$like':'%'+_0x34fff7[_0xb833('0x30')]['filter']+'%'};return _0x13c5ce;}})});}_0x156b23=_[_0xb833('0x3f')]({},_0x156b23,_0x34fff7[_0xb833('0x40')]);var _0x35a3e6={'where':_0x156b23[_0xb833('0x3b')]};return db[_0xb833('0x2b')][_0xb833('0x1c')](_0x35a3e6)['then'](function(_0x3655ca){_0x7ad9dd['count']=_0x3655ca;if(_0x34fff7[_0xb833('0x30')][_0xb833('0x41')]){_0x156b23[_0xb833('0x42')]=[{'all':!![]}];}return db['Schedule'][_0xb833('0x43')](_0x156b23);})[_0xb833('0x23')](function(_0xc30f10){_0x7ad9dd[_0xb833('0x44')]=_0xc30f10;return _0x7ad9dd;})[_0xb833('0x23')](respondWithFilteredResult(_0x35e046,_0x156b23))[_0xb833('0x45')](handleError(_0x35e046,null));};exports[_0xb833('0x46')]=function(_0xfd09bf,_0x5ae4c8){var _0x250678={'raw':![],'where':{'id':_0xfd09bf[_0xb833('0x47')]['id']}},_0x2f9466={};_0x2f9466[_0xb833('0x34')]=_['keys'](db[_0xb833('0x2b')][_0xb833('0x48')]);_0x2f9466[_0xb833('0x30')]=_[_0xb833('0x31')](_0xfd09bf[_0xb833('0x30')]);_0x2f9466[_0xb833('0x32')]=_['intersection'](_0x2f9466[_0xb833('0x34')],_0x2f9466[_0xb833('0x30')]);_0x250678[_0xb833('0x35')]=_['intersection'](_0x2f9466[_0xb833('0x34')],qs['fields'](_0xfd09bf['query']['fields']));_0x250678[_0xb833('0x35')]=_0x250678[_0xb833('0x35')][_0xb833('0x37')]?_0x250678['attributes']:_0x2f9466['model'];if(_0xfd09bf[_0xb833('0x30')]['includeAll']){_0x250678[_0xb833('0x42')]=[{'all':!![]}];}_0x250678=_[_0xb833('0x3f')]({},_0x250678,_0xfd09bf['options']);return db[_0xb833('0x2b')][_0xb833('0x49')](_0x250678)[_0xb833('0x23')](handleEntityNotFound(_0x5ae4c8,null))['then'](respondWithResult(_0x5ae4c8,null))[_0xb833('0x45')](handleError(_0x5ae4c8,null));};exports[_0xb833('0x4a')]=function(_0x5cfd17,_0x4825c7){return db[_0xb833('0x2b')][_0xb833('0x4a')](_0x5cfd17[_0xb833('0x4b')],{})['then'](function(_0x20448e){var _0x411358=_0x5cfd17[_0xb833('0x4c')][_0xb833('0x25')]({'plain':!![]});if(!_0x411358)throw new Error(_0xb833('0x4d'));if(_0x411358[_0xb833('0x4e')]==='user'){var _0x429276=_0x20448e[_0xb833('0x25')]({'plain':!![]});var _0x382c05=_0xb833('0x26');return db[_0xb833('0x4f')]['find']({'where':{'name':_0x382c05,'userProfileId':_0x411358[_0xb833('0x50')]},'raw':!![]})[_0xb833('0x23')](function(_0x2099a3){if(_0x2099a3&&_0x2099a3['autoAssociation']===0x0){return db['UserProfileResource'][_0xb833('0x4a')]({'name':_0x429276[_0xb833('0x2a')],'resourceId':_0x429276['id'],'type':_0x2099a3[_0xb833('0x2a')],'sectionId':_0x2099a3['id']},{})[_0xb833('0x23')](function(){return _0x20448e;});}else{return _0x20448e;}})['catch'](function(_0x2d00fa){logger[_0xb833('0x28')](_0xb833('0x51'),_0x2d00fa);throw _0x2d00fa;});}return _0x20448e;})[_0xb833('0x23')](respondWithResult(_0x4825c7,0xc9))['catch'](handleError(_0x4825c7,null));};exports['update']=function(_0x378747,_0x103d0b){if(_0x378747[_0xb833('0x4b')]['id']){delete _0x378747[_0xb833('0x4b')]['id'];}return db[_0xb833('0x2b')]['find']({'where':{'id':_0x378747[_0xb833('0x47')]['id']}})[_0xb833('0x23')](handleEntityNotFound(_0x103d0b,null))[_0xb833('0x23')](saveUpdates(_0x378747['body'],null))[_0xb833('0x23')](respondWithResult(_0x103d0b,null))['catch'](handleError(_0x103d0b,null));};exports[_0xb833('0x24')]=function(_0x39c2cc,_0x489fcc){return db['Schedule'][_0xb833('0x49')]({'where':{'id':_0x39c2cc[_0xb833('0x47')]['id']}})[_0xb833('0x23')](handleEntityNotFound(_0x489fcc,null))[_0xb833('0x23')](removeEntity(_0x489fcc,null))[_0xb833('0x45')](handleError(_0x489fcc,null));};exports['run']=function(_0x10e019,_0x4ebf4b,_0x1ad2d1){var _0x228e46=require('../../config/schedule');return db[_0xb833('0x2b')]['find']({'where':{'id':_0x10e019[_0xb833('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4ebf4b,null))[_0xb833('0x23')](function(){_0x228e46[_0xb833('0x52')](_0x10e019[_0xb833('0x47')]['id']);})[_0xb833('0x23')](respondWithStatusCode(_0x4ebf4b,null))['catch'](handleError(_0x4ebf4b,null));}; \ No newline at end of file +var _0xacc8=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Schedule','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xacc8,0xf8));var _0x8acc=function(_0x18ea8a,_0x32f09f){_0x18ea8a=_0x18ea8a-0x0;var _0x19c99a=_0xacc8[_0x18ea8a];return _0x19c99a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8acc('0x0'));var rimraf=require(_0x8acc('0x1'));var zipdir=require(_0x8acc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8acc('0x3'));var moment=require(_0x8acc('0x4'));var BPromise=require(_0x8acc('0x5'));var Mustache=require(_0x8acc('0x6'));var util=require(_0x8acc('0x7'));var path=require(_0x8acc('0x8'));var sox=require(_0x8acc('0x9'));var csv=require(_0x8acc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8acc('0xb'));var squel=require('squel');var crypto=require(_0x8acc('0xc'));var jsforce=require(_0x8acc('0xd'));var deskjs=require(_0x8acc('0xe'));var toCsv=require(_0x8acc('0xa'));var querystring=require(_0x8acc('0xf'));var Papa=require(_0x8acc('0x10'));var Redis=require(_0x8acc('0x11'));var authService=require(_0x8acc('0x12'));var qs=require(_0x8acc('0x13'));var as=require(_0x8acc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8acc('0x15'))(_0x8acc('0x16'));var utils=require(_0x8acc('0x17'));var config=require('../../config/environment');var db=require(_0x8acc('0x18'))['db'];function respondWithStatusCode(_0x403865,_0x51958e){_0x51958e=_0x51958e||0xcc;return function(_0x9f7107){if(_0x9f7107){return _0x403865[_0x8acc('0x19')](_0x51958e);}return _0x403865[_0x8acc('0x1a')](_0x51958e)[_0x8acc('0x1b')]();};}function respondWithResult(_0x1e15b6,_0x41be74){_0x41be74=_0x41be74||0xc8;return function(_0x4127b4){if(_0x4127b4){return _0x1e15b6[_0x8acc('0x1a')](_0x41be74)[_0x8acc('0x1c')](_0x4127b4);}};}function respondWithFilteredResult(_0x54e000,_0xfce6a1){return function(_0x722047){if(_0x722047){var _0x4cdb0a=_0x722047['count'],_0xa32619=_0xfce6a1[_0x8acc('0x1d')],_0x273f92=_0xfce6a1[_0x8acc('0x1d')]+_0xfce6a1[_0x8acc('0x1e')],_0x521214;if(_0x273f92>=_0x4cdb0a){_0x273f92=_0x4cdb0a;_0x521214=0xc8;}else{_0x521214=0xce;}_0x54e000['status'](_0x521214);return _0x54e000[_0x8acc('0x1f')](_0x8acc('0x20'),_0xa32619+'-'+_0x273f92+'/'+_0x4cdb0a)[_0x8acc('0x1c')](_0x722047);}return null;};}function patchUpdates(_0x55cf32){return function(_0x58785d){try{jsonpatch[_0x8acc('0x21')](_0x58785d,_0x55cf32,!![]);}catch(_0x1a94f2){return BPromise[_0x8acc('0x22')](_0x1a94f2);}return _0x58785d[_0x8acc('0x23')]();};}function saveUpdates(_0x345de6,_0x4b361c){return function(_0x2bb330){if(_0x2bb330){return _0x2bb330[_0x8acc('0x24')](_0x345de6)[_0x8acc('0x25')](function(_0x55dd9c){return _0x55dd9c;});}return null;};}function removeEntity(_0x13dd50,_0x3945b4){return function(_0x4d84c9){if(_0x4d84c9){return _0x4d84c9[_0x8acc('0x26')]()[_0x8acc('0x25')](function(){var _0x23e003=_0x4d84c9[_0x8acc('0x27')]({'plain':!![]});var _0x409acf='Scheduler';return db[_0x8acc('0x28')][_0x8acc('0x26')]({'where':{'type':_0x409acf,'resourceId':_0x23e003['id']}})['then'](function(){return _0x4d84c9;});})[_0x8acc('0x25')](function(){_0x13dd50[_0x8acc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f2e5,_0x51a7ec){return function(_0xea2847){if(!_0xea2847){_0x29f2e5[_0x8acc('0x19')](0x194);}return _0xea2847;};}function handleError(_0x3c66e1,_0x8b0887){_0x8b0887=_0x8b0887||0x1f4;return function(_0x30317f){logger[_0x8acc('0x29')](_0x30317f[_0x8acc('0x2a')]);if(_0x30317f[_0x8acc('0x2b')]){delete _0x30317f[_0x8acc('0x2b')];}_0x3c66e1['status'](_0x8b0887)[_0x8acc('0x2c')](_0x30317f);};}exports[_0x8acc('0x2d')]=function(_0x5eae68,_0x3aeabb){var _0x384568={},_0x46a130={},_0x1d6cb8={'count':0x0,'rows':[]};var _0x164229=_['map'](db[_0x8acc('0x2e')]['rawAttributes'],function(_0x5c0add){return{'name':_0x5c0add['fieldName'],'type':_0x5c0add[_0x8acc('0x2f')][_0x8acc('0x30')]};});_0x46a130[_0x8acc('0x31')]=_[_0x8acc('0x32')](_0x164229,_0x8acc('0x2b'));_0x46a130[_0x8acc('0x33')]=_[_0x8acc('0x34')](_0x5eae68[_0x8acc('0x33')]);_0x46a130[_0x8acc('0x35')]=_[_0x8acc('0x36')](_0x46a130[_0x8acc('0x31')],_0x46a130[_0x8acc('0x33')]);_0x384568[_0x8acc('0x37')]=_[_0x8acc('0x36')](_0x46a130[_0x8acc('0x31')],qs[_0x8acc('0x38')](_0x5eae68[_0x8acc('0x33')][_0x8acc('0x38')]));_0x384568['attributes']=_0x384568['attributes'][_0x8acc('0x39')]?_0x384568[_0x8acc('0x37')]:_0x46a130[_0x8acc('0x31')];if(!_0x5eae68[_0x8acc('0x33')]['hasOwnProperty'](_0x8acc('0x3a'))){_0x384568[_0x8acc('0x1e')]=qs[_0x8acc('0x1e')](_0x5eae68[_0x8acc('0x33')][_0x8acc('0x1e')]);_0x384568[_0x8acc('0x1d')]=qs['offset'](_0x5eae68[_0x8acc('0x33')][_0x8acc('0x1d')]);}_0x384568[_0x8acc('0x3b')]=qs['sort'](_0x5eae68['query'][_0x8acc('0x3c')]);_0x384568['where']=qs['filters'](_[_0x8acc('0x3d')](_0x5eae68[_0x8acc('0x33')],_0x46a130[_0x8acc('0x35')]),_0x164229);if(_0x5eae68['query'][_0x8acc('0x3e')]){_0x384568[_0x8acc('0x3f')]=_[_0x8acc('0x40')](_0x384568[_0x8acc('0x3f')],{'$or':_[_0x8acc('0x32')](_0x164229,function(_0x419e66){if(_0x419e66['type']!==_0x8acc('0x41')){var _0x41f15a={};_0x41f15a[_0x419e66[_0x8acc('0x2b')]]={'$like':'%'+_0x5eae68[_0x8acc('0x33')][_0x8acc('0x3e')]+'%'};return _0x41f15a;}})});}_0x384568=_[_0x8acc('0x40')]({},_0x384568,_0x5eae68['options']);var _0x1581e0={'where':_0x384568['where']};return db[_0x8acc('0x2e')][_0x8acc('0x42')](_0x1581e0)['then'](function(_0x551dfe){_0x1d6cb8[_0x8acc('0x42')]=_0x551dfe;if(_0x5eae68[_0x8acc('0x33')][_0x8acc('0x43')]){_0x384568[_0x8acc('0x44')]=[{'all':!![]}];}return db[_0x8acc('0x2e')][_0x8acc('0x45')](_0x384568);})[_0x8acc('0x25')](function(_0xb35afb){_0x1d6cb8[_0x8acc('0x46')]=_0xb35afb;return _0x1d6cb8;})[_0x8acc('0x25')](respondWithFilteredResult(_0x3aeabb,_0x384568))[_0x8acc('0x47')](handleError(_0x3aeabb,null));};exports['show']=function(_0x2da16f,_0x4145d0){var _0x4a52a0={'raw':![],'where':{'id':_0x2da16f[_0x8acc('0x48')]['id']}},_0x4314ab={};_0x4314ab['model']=_[_0x8acc('0x34')](db[_0x8acc('0x2e')]['rawAttributes']);_0x4314ab[_0x8acc('0x33')]=_[_0x8acc('0x34')](_0x2da16f[_0x8acc('0x33')]);_0x4314ab['filters']=_[_0x8acc('0x36')](_0x4314ab[_0x8acc('0x31')],_0x4314ab[_0x8acc('0x33')]);_0x4a52a0[_0x8acc('0x37')]=_[_0x8acc('0x36')](_0x4314ab[_0x8acc('0x31')],qs[_0x8acc('0x38')](_0x2da16f[_0x8acc('0x33')][_0x8acc('0x38')]));_0x4a52a0['attributes']=_0x4a52a0[_0x8acc('0x37')][_0x8acc('0x39')]?_0x4a52a0['attributes']:_0x4314ab[_0x8acc('0x31')];if(_0x2da16f['query']['includeAll']){_0x4a52a0[_0x8acc('0x44')]=[{'all':!![]}];}_0x4a52a0=_[_0x8acc('0x40')]({},_0x4a52a0,_0x2da16f[_0x8acc('0x49')]);return db['Schedule'][_0x8acc('0x4a')](_0x4a52a0)['then'](handleEntityNotFound(_0x4145d0,null))['then'](respondWithResult(_0x4145d0,null))[_0x8acc('0x47')](handleError(_0x4145d0,null));};exports[_0x8acc('0x4b')]=function(_0xf94136,_0x1d2168){return db[_0x8acc('0x2e')]['create'](_0xf94136[_0x8acc('0x4c')],{})[_0x8acc('0x25')](function(_0x1a987c){var _0x20f733=_0xf94136[_0x8acc('0x4d')][_0x8acc('0x27')]({'plain':!![]});if(!_0x20f733)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20f733[_0x8acc('0x4e')]===_0x8acc('0x4d')){var _0x55c7d0=_0x1a987c[_0x8acc('0x27')]({'plain':!![]});var _0x340883='Scheduler';return db[_0x8acc('0x4f')][_0x8acc('0x4a')]({'where':{'name':_0x340883,'userProfileId':_0x20f733['userProfileId']},'raw':!![]})[_0x8acc('0x25')](function(_0x46c5b3){if(_0x46c5b3&&_0x46c5b3['autoAssociation']===0x0){return db[_0x8acc('0x28')][_0x8acc('0x4b')]({'name':_0x55c7d0['name'],'resourceId':_0x55c7d0['id'],'type':_0x46c5b3[_0x8acc('0x2b')],'sectionId':_0x46c5b3['id']},{})[_0x8acc('0x25')](function(){return _0x1a987c;});}else{return _0x1a987c;}})['catch'](function(_0x16ab16){logger[_0x8acc('0x29')](_0x8acc('0x50'),_0x16ab16);throw _0x16ab16;});}return _0x1a987c;})[_0x8acc('0x25')](respondWithResult(_0x1d2168,0xc9))['catch'](handleError(_0x1d2168,null));};exports['update']=function(_0x331929,_0x56170d){if(_0x331929['body']['id']){delete _0x331929['body']['id'];}return db[_0x8acc('0x2e')]['find']({'where':{'id':_0x331929['params']['id']}})['then'](handleEntityNotFound(_0x56170d,null))[_0x8acc('0x25')](saveUpdates(_0x331929[_0x8acc('0x4c')],null))[_0x8acc('0x25')](respondWithResult(_0x56170d,null))['catch'](handleError(_0x56170d,null));};exports[_0x8acc('0x26')]=function(_0x15d127,_0x46a9f2){return db[_0x8acc('0x2e')]['find']({'where':{'id':_0x15d127['params']['id']}})['then'](handleEntityNotFound(_0x46a9f2,null))['then'](removeEntity(_0x46a9f2,null))[_0x8acc('0x47')](handleError(_0x46a9f2,null));};exports[_0x8acc('0x51')]=function(_0x46b15,_0x608229,_0x2937fb){var _0x34be5c=require(_0x8acc('0x52'));return db[_0x8acc('0x2e')][_0x8acc('0x4a')]({'where':{'id':_0x46b15[_0x8acc('0x48')]['id']},'raw':!![]})[_0x8acc('0x25')](handleEntityNotFound(_0x608229,null))[_0x8acc('0x25')](function(){_0x34be5c['run'](_0x46b15[_0x8acc('0x48')]['id']);})[_0x8acc('0x25')](respondWithStatusCode(_0x608229,null))['catch'](handleError(_0x608229,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a540c6d..cb3ee18 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 _0x3914=['tools_schedules','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule'];(function(_0x1a1361,_0x56e401){var _0x509577=function(_0x28cc79){while(--_0x28cc79){_0x1a1361['push'](_0x1a1361['shift']());}};_0x509577(++_0x56e401);}(_0x3914,0x12a));var _0x4391=function(_0x1d94d1,_0x347bb8){_0x1d94d1=_0x1d94d1-0x0;var _0x23c397=_0x3914[_0x1d94d1];return _0x23c397;};'use strict';var _=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var logger=require(_0x4391('0x2'))('api');var moment=require(_0x4391('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4391('0x4'));var config=require(_0x4391('0x5'));var attributes=require(_0x4391('0x6'));module[_0x4391('0x7')]=function(_0x299679,_0x200065){return _0x299679[_0x4391('0x8')](_0x4391('0x9'),attributes,{'tableName':_0x4391('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bf3=['exports','tools_schedules','../../config/logger','request-promise','../../config/environment','./schedule.attributes'];(function(_0x56a14b,_0xc8d9ff){var _0x594128=function(_0xe40ec1){while(--_0xe40ec1){_0x56a14b['push'](_0x56a14b['shift']());}};_0x594128(++_0xc8d9ff);}(_0x4bf3,0x6e));var _0x34bf=function(_0x2caa3b,_0x5f2039){_0x2caa3b=_0x2caa3b-0x0;var _0x10952d=_0x4bf3[_0x2caa3b];return _0x10952d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x34bf('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x34bf('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x34bf('0x2'));var attributes=require(_0x34bf('0x3'));module[_0x34bf('0x4')]=function(_0x56b1b9,_0xce772c){return _0x56b1b9['define']('Schedule',attributes,{'tableName':_0x34bf('0x5'),'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 943c81a..711530e 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 _0xc098=['../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','lodash','util','ioredis','../../config/utils','rpc'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0xc098,0xb9));var _0x8c09=function(_0x22faf1,_0x3cb842){_0x22faf1=_0x22faf1-0x0;var _0x2412bd=_0xc098[_0x22faf1];return _0x2412bd;};'use strict';var _=require(_0x8c09('0x0'));var util=require(_0x8c09('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c09('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c09('0x3'));var logger=require('../../config/logger')(_0x8c09('0x4'));var config=require(_0x8c09('0x5'));var jayson=require(_0x8c09('0x6'));var client=jayson['client'][_0x8c09('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23f218,_0x511a6c,_0x15a5bb){return new BPromise(function(_0x4bfbeb,_0x49c039){return client[_0x8c09('0x8')](_0x23f218,_0x15a5bb)[_0x8c09('0x9')](function(_0x24f395){logger[_0x8c09('0xa')](_0x8c09('0xb'),_0x511a6c,'request\x20sent');logger[_0x8c09('0xc')]('Schedule,\x20%s,\x20%s,\x20%s',_0x511a6c,'request\x20sent',JSON[_0x8c09('0xd')](_0x24f395));if(_0x24f395[_0x8c09('0xe')]){if(_0x24f395[_0x8c09('0xe')][_0x8c09('0xf')]===0x1f4){logger[_0x8c09('0xe')](_0x8c09('0xb'),_0x511a6c,_0x24f395[_0x8c09('0xe')][_0x8c09('0x10')]);return _0x49c039(_0x24f395[_0x8c09('0xe')][_0x8c09('0x10')]);}logger[_0x8c09('0xe')](_0x8c09('0xb'),_0x511a6c,_0x24f395['error']['message']);return _0x4bfbeb(_0x24f395['error'][_0x8c09('0x10')]);}else{logger[_0x8c09('0xa')](_0x8c09('0xb'),_0x511a6c,_0x8c09('0x11'));_0x4bfbeb(_0x24f395['result'][_0x8c09('0x10')]);}})[_0x8c09('0x12')](function(_0x2855f4){logger['error'](_0x8c09('0xb'),_0x511a6c,_0x2855f4);_0x49c039(_0x2855f4);});});} \ No newline at end of file +var _0x1c44=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring'];(function(_0x2f77b9,_0x4d8bf5){var _0x35bbf3=function(_0x1bd603){while(--_0x1bd603){_0x2f77b9['push'](_0x2f77b9['shift']());}};_0x35bbf3(++_0x4d8bf5);}(_0x1c44,0xd9));var _0x41c4=function(_0x182a0a,_0x204009){_0x182a0a=_0x182a0a-0x0;var _0x1d8309=_0x1c44[_0x182a0a];return _0x1d8309;};'use strict';var _=require('lodash');var util=require(_0x41c4('0x0'));var moment=require(_0x41c4('0x1'));var BPromise=require('bluebird');var rs=require(_0x41c4('0x2'));var fs=require('fs');var Redis=require(_0x41c4('0x3'));var db=require(_0x41c4('0x4'))['db'];var utils=require(_0x41c4('0x5'));var logger=require(_0x41c4('0x6'))('rpc');var config=require(_0x41c4('0x7'));var jayson=require(_0x41c4('0x8'));var client=jayson[_0x41c4('0x9')][_0x41c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x437cee,_0xe02371,_0x2d8968){return new BPromise(function(_0x1757f9,_0x514dae){return client[_0x41c4('0xb')](_0x437cee,_0x2d8968)[_0x41c4('0xc')](function(_0x2ba171){logger[_0x41c4('0xd')](_0x41c4('0xe'),_0xe02371,_0x41c4('0xf'));logger[_0x41c4('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0xe02371,_0x41c4('0xf'),JSON[_0x41c4('0x11')](_0x2ba171));if(_0x2ba171['error']){if(_0x2ba171[_0x41c4('0x12')][_0x41c4('0x13')]===0x1f4){logger[_0x41c4('0x12')](_0x41c4('0xe'),_0xe02371,_0x2ba171['error'][_0x41c4('0x14')]);return _0x514dae(_0x2ba171[_0x41c4('0x12')][_0x41c4('0x14')]);}logger['error'](_0x41c4('0xe'),_0xe02371,_0x2ba171[_0x41c4('0x12')][_0x41c4('0x14')]);return _0x1757f9(_0x2ba171[_0x41c4('0x12')][_0x41c4('0x14')]);}else{logger[_0x41c4('0xd')]('Schedule,\x20%s,\x20%s',_0xe02371,_0x41c4('0xf'));_0x1757f9(_0x2ba171['result'][_0x41c4('0x14')]);}})[_0x41c4('0x15')](function(_0x1b5ac1){logger['error'](_0x41c4('0xe'),_0xe02371,_0x1b5ac1);_0x514dae(_0x1b5ac1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index ace6ac1..12de77d 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 _0xad94=['express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','describe','get','/:id','show','download','post','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x24dbad,_0x38302c){var _0x8624ac=function(_0x532198){while(--_0x532198){_0x24dbad['push'](_0x24dbad['shift']());}};_0x8624ac(++_0x38302c);}(_0xad94,0x18d));var _0x4ad9=function(_0x2c53a9,_0x5c04ab){_0x2c53a9=_0x2c53a9-0x0;var _0x26e4f7=_0xad94[_0x2c53a9];return _0x26e4f7;};'use strict';var multer=require(_0x4ad9('0x0'));var util=require('util');var path=require(_0x4ad9('0x1'));var timeout=require(_0x4ad9('0x2'));var express=require(_0x4ad9('0x3'));var router=express[_0x4ad9('0x4')]();var auth=require(_0x4ad9('0x5'));var interaction=require(_0x4ad9('0x6'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router['get']('/',auth[_0x4ad9('0x7')](),controller['index']);router['get'](_0x4ad9('0x8'),auth[_0x4ad9('0x7')](),controller[_0x4ad9('0x9')]);router[_0x4ad9('0xa')](_0x4ad9('0xb'),auth[_0x4ad9('0x7')](),controller[_0x4ad9('0xc')]);router[_0x4ad9('0xa')]('/:id/download',auth[_0x4ad9('0x7')](),controller[_0x4ad9('0xd')]);router[_0x4ad9('0xe')]('/',auth[_0x4ad9('0x7')](),controller[_0x4ad9('0xf')]);router[_0x4ad9('0x10')](_0x4ad9('0xb'),auth['isAuthenticated'](),controller[_0x4ad9('0x11')]);router[_0x4ad9('0x12')](_0x4ad9('0xb'),auth[_0x4ad9('0x7')](),controller['destroy']);module[_0x4ad9('0x13')]=router; \ No newline at end of file +var _0xcac3=['/:id','/:id/download','download','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x19675c,_0x45109f){var _0x30eda1=function(_0x79351){while(--_0x79351){_0x19675c['push'](_0x19675c['shift']());}};_0x30eda1(++_0x45109f);}(_0xcac3,0x14a));var _0x3cac=function(_0x215863,_0x44609a){_0x215863=_0x215863-0x0;var _0x4d5f5c=_0xcac3[_0x215863];return _0x4d5f5c;};'use strict';var multer=require(_0x3cac('0x0'));var util=require(_0x3cac('0x1'));var path=require('path');var timeout=require(_0x3cac('0x2'));var express=require(_0x3cac('0x3'));var router=express[_0x3cac('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3cac('0x5'));var config=require(_0x3cac('0x6'));var controller=require(_0x3cac('0x7'));router[_0x3cac('0x8')]('/',auth[_0x3cac('0x9')](),controller[_0x3cac('0xa')]);router[_0x3cac('0x8')](_0x3cac('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3cac('0x8')](_0x3cac('0xc'),auth[_0x3cac('0x9')](),controller['show']);router[_0x3cac('0x8')](_0x3cac('0xd'),auth['isAuthenticated'](),controller[_0x3cac('0xe')]);router['post']('/',auth[_0x3cac('0x9')](),controller['create']);router['put']('/:id',auth[_0x3cac('0x9')](),controller[_0x3cac('0xf')]);router['delete'](_0x3cac('0xc'),auth[_0x3cac('0x9')](),controller[_0x3cac('0x10')]);module[_0x3cac('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d4379d6..51f08e0 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 _0x3e74=['path','../../config/environment','exports','value','getDataValue','STRING','replace','setDataValue','INTEGER','subtract','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize'];(function(_0x347166,_0x383368){var _0x590a78=function(_0x27dec2){while(--_0x27dec2){_0x347166['push'](_0x347166['shift']());}};_0x590a78(++_0x383368);}(_0x3e74,0x175));var _0x43e7=function(_0x46d8c5,_0x4d4557){_0x46d8c5=_0x46d8c5-0x0;var _0x59189c=_0x3e74[_0x46d8c5];return _0x59189c;};'use strict';var Sequelize=require(_0x43e7('0x0'));var moment=require('moment');var path=require(_0x43e7('0x1'));var config=require(_0x43e7('0x2'));module[_0x43e7('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x43e7('0x4'))?path['extname'](this[_0x43e7('0x5')](_0x43e7('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x43e7('0x6')]},'channel':{'type':Sequelize[_0x43e7('0x6')]},'value':{'type':Sequelize[_0x43e7('0x6')],'set':function(_0x503698){var _0x45a0d1=_0x503698[_0x43e7('0x7')](/\\/g,'/');this[_0x43e7('0x8')](_0x43e7('0x4'),_0x45a0d1);}},'rating':{'type':Sequelize[_0x43e7('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x212c6c){this['setDataValue']('startedAt',moment()[_0x43e7('0xa')](_0x212c6c,'ms'));this[_0x43e7('0x8')]('closedAt',moment());this[_0x43e7('0x8')]('duration',_0x212c6c);}},'startedAt':{'type':Sequelize[_0x43e7('0xb')],'get':function(){return moment(this[_0x43e7('0x5')]('startedAt'))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'closedAt':{'type':Sequelize[_0x43e7('0xb')],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x43e7('0xf')))[_0x43e7('0xc')](_0x43e7('0xd'))[_0x43e7('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x43e7('0x10')))[_0x43e7('0xc')](_0x43e7('0xd'))['toString']();}}}; \ No newline at end of file +var _0x2d17=['createdAt','updatedAt','sequelize','moment','../../config/environment','exports','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x380b8f,_0x32271d){var _0x646c69=function(_0x57c77f){while(--_0x57c77f){_0x380b8f['push'](_0x380b8f['shift']());}};_0x646c69(++_0x32271d);}(_0x2d17,0x17e));var _0x72d1=function(_0x5d95a0,_0x54f225){_0x5d95a0=_0x5d95a0-0x0;var _0x5e9495=_0x2d17[_0x5d95a0];return _0x5e9495;};'use strict';var Sequelize=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));var path=require('path');var config=require(_0x72d1('0x2'));module[_0x72d1('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x72d1('0x4')](_0x72d1('0x5'))?path['extname'](this[_0x72d1('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x72d1('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x72d1('0x6')],'set':function(_0x239d1f){var _0x5b40a9=_0x239d1f[_0x72d1('0x7')](/\\/g,'/');this[_0x72d1('0x8')](_0x72d1('0x5'),_0x5b40a9);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x72d1('0x9')],'set':function(_0x288362){this[_0x72d1('0x8')]('startedAt',moment()[_0x72d1('0xa')](_0x288362,'ms'));this[_0x72d1('0x8')](_0x72d1('0xb'),moment());this[_0x72d1('0x8')](_0x72d1('0xc'),_0x288362);}},'startedAt':{'type':Sequelize[_0x72d1('0xd')],'get':function(){return moment(this[_0x72d1('0x4')](_0x72d1('0xe')))[_0x72d1('0xf')](_0x72d1('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x72d1('0xd')],'get':function(){return moment(this[_0x72d1('0x4')](_0x72d1('0xb')))[_0x72d1('0xf')](_0x72d1('0x10'))[_0x72d1('0x11')]();}},'createdAt':{'type':Sequelize[_0x72d1('0xd')],'get':function(){return moment(this[_0x72d1('0x4')](_0x72d1('0x12')))[_0x72d1('0xf')](_0x72d1('0x10'))[_0x72d1('0x11')]();}},'updatedAt':{'type':Sequelize[_0x72d1('0xd')],'get':function(){return moment(this['getDataValue'](_0x72d1('0x13')))['format'](_0x72d1('0x10'))[_0x72d1('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 6724ba3..e5e6e39 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 _0x7266=['where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','body','duration','createdAt','value','find','describe','../../components/encryptor','uniqueid','join','root','existsSync','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x59ac7a,_0x3f8a9f){var _0x2fcb68=function(_0x5cd1cc){while(--_0x5cd1cc){_0x59ac7a['push'](_0x59ac7a['shift']());}};_0x2fcb68(++_0x3f8a9f);}(_0x7266,0xec));var _0x6726=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x7266[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0x6726('0x0'));var emlformat=require(_0x6726('0x1'));var rimraf=require(_0x6726('0x2'));var zipdir=require(_0x6726('0x3'));var jsonpatch=require(_0x6726('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6726('0x5'));var Mustache=require(_0x6726('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6726('0x7'));var csv=require(_0x6726('0x8'));var ejs=require(_0x6726('0x9'));var fs=require('fs');var _=require(_0x6726('0xa'));var squel=require(_0x6726('0xb'));var crypto=require(_0x6726('0xc'));var jsforce=require(_0x6726('0xd'));var deskjs=require(_0x6726('0xe'));var toCsv=require(_0x6726('0x8'));var querystring=require(_0x6726('0xf'));var Papa=require(_0x6726('0x10'));var Redis=require(_0x6726('0x11'));var authService=require(_0x6726('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6726('0x13'));var hardwareService=require(_0x6726('0x14'));var logger=require(_0x6726('0x15'))(_0x6726('0x16'));var utils=require('../../config/utils');var config=require(_0x6726('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x137f29,_0x15640f){_0x15640f=_0x15640f||0xcc;return function(_0x59c044){if(_0x59c044){return _0x137f29[_0x6726('0x18')](_0x15640f);}return _0x137f29[_0x6726('0x19')](_0x15640f)[_0x6726('0x1a')]();};}function respondWithResult(_0x1377f6,_0x587b52){_0x587b52=_0x587b52||0xc8;return function(_0x33b6d7){if(_0x33b6d7){return _0x1377f6[_0x6726('0x19')](_0x587b52)['json'](_0x33b6d7);}};}function respondWithFilteredResult(_0x9467a8,_0x5d3458){return function(_0x12f043){if(_0x12f043){var _0x36361d=_0x12f043[_0x6726('0x1b')],_0xc1fed9=_0x5d3458[_0x6726('0x1c')],_0x3a3b6a=_0x5d3458['offset']+_0x5d3458[_0x6726('0x1d')],_0x5ea0cc;if(_0x3a3b6a>=_0x36361d){_0x3a3b6a=_0x36361d;_0x5ea0cc=0xc8;}else{_0x5ea0cc=0xce;}_0x9467a8['status'](_0x5ea0cc);return _0x9467a8['set']('Content-Range',_0xc1fed9+'-'+_0x3a3b6a+'/'+_0x36361d)[_0x6726('0x1e')](_0x12f043);}return null;};}function patchUpdates(_0x2e9d00){return function(_0x5860c5){try{jsonpatch[_0x6726('0x1f')](_0x5860c5,_0x2e9d00,!![]);}catch(_0x14b37e){return BPromise[_0x6726('0x20')](_0x14b37e);}return _0x5860c5[_0x6726('0x21')]();};}function saveUpdates(_0x472795,_0x37f0ad){return function(_0x4af165){if(_0x4af165){return _0x4af165[_0x6726('0x22')](_0x472795)['then'](function(_0x23c0f0){return _0x23c0f0;});}return null;};}function removeEntity(_0x1efc5b,_0x429a42){return function(_0x1aa422){if(_0x1aa422){return _0x1aa422[_0x6726('0x23')]()[_0x6726('0x24')](function(){_0x1efc5b['status'](0xcc)[_0x6726('0x1a')]();});}};}function handleEntityNotFound(_0x454b4d,_0xf9d466){return function(_0x21618c){if(!_0x21618c){_0x454b4d['sendStatus'](0x194);}return _0x21618c;};}function handleError(_0x21f043,_0x48373b){_0x48373b=_0x48373b||0x1f4;return function(_0x497d49){logger[_0x6726('0x25')](_0x497d49[_0x6726('0x26')]);if(_0x497d49[_0x6726('0x27')]){delete _0x497d49[_0x6726('0x27')];}_0x21f043['status'](_0x48373b)[_0x6726('0x28')](_0x497d49);};}exports[_0x6726('0x29')]=function(_0x14cb1d,_0x4947f2){var _0x2c6d07={},_0x5d25a0={},_0x4fd2fd={'count':0x0,'rows':[]};var _0x50c743=_[_0x6726('0x2a')](db[_0x6726('0x2b')][_0x6726('0x2c')],function(_0x35382d){return{'name':_0x35382d['fieldName'],'type':_0x35382d[_0x6726('0x2d')][_0x6726('0x2e')]};});_0x5d25a0[_0x6726('0x2f')]=_['differenceBy'](_[_0x6726('0x2a')](_0x50c743,_0x6726('0x27')),['format']);_0x5d25a0[_0x6726('0x30')]=_[_0x6726('0x31')](_0x14cb1d[_0x6726('0x30')]);_0x5d25a0[_0x6726('0x32')]=_[_0x6726('0x33')](_0x5d25a0[_0x6726('0x2f')],_0x5d25a0[_0x6726('0x30')]);_0x2c6d07[_0x6726('0x34')]=_['intersection'](_0x5d25a0[_0x6726('0x2f')],qs[_0x6726('0x35')](_0x14cb1d[_0x6726('0x30')][_0x6726('0x35')]));_0x2c6d07[_0x6726('0x34')]=_0x2c6d07[_0x6726('0x34')][_0x6726('0x36')]?_0x2c6d07[_0x6726('0x34')]:_0x5d25a0['model'];if(!_0x14cb1d['query'][_0x6726('0x37')]('nolimit')){_0x2c6d07[_0x6726('0x1d')]=qs[_0x6726('0x1d')](_0x14cb1d['query'][_0x6726('0x1d')]);_0x2c6d07[_0x6726('0x1c')]=qs[_0x6726('0x1c')](_0x14cb1d['query'][_0x6726('0x1c')]);}_0x2c6d07[_0x6726('0x38')]=qs['sort'](_0x14cb1d['query'][_0x6726('0x39')]);_0x2c6d07[_0x6726('0x3a')]=qs[_0x6726('0x32')](_[_0x6726('0x3b')](_0x14cb1d[_0x6726('0x30')],_0x5d25a0[_0x6726('0x32')]),_0x50c743);if(_0x14cb1d['query']['filter']){_0x2c6d07[_0x6726('0x3a')]=_[_0x6726('0x3c')](_0x2c6d07[_0x6726('0x3a')],{'$or':_[_0x6726('0x2a')](_0x50c743,function(_0x104ca2){if(_0x104ca2['type']!==_0x6726('0x3d')){var _0x18f3ef={};_0x18f3ef[_0x104ca2['name']]={'$like':'%'+_0x14cb1d[_0x6726('0x30')][_0x6726('0x3e')]+'%'};return _0x18f3ef;}})});}_0x2c6d07=_[_0x6726('0x3c')]({},_0x2c6d07,_0x14cb1d[_0x6726('0x3f')]);var _0x420086={'where':_0x2c6d07[_0x6726('0x3a')]};return db[_0x6726('0x2b')][_0x6726('0x1b')](_0x420086)[_0x6726('0x24')](function(_0x3a53e5){_0x4fd2fd[_0x6726('0x1b')]=_0x3a53e5;if(_0x14cb1d[_0x6726('0x30')][_0x6726('0x40')]){_0x2c6d07[_0x6726('0x41')]=[{'all':!![]}];}return db[_0x6726('0x2b')][_0x6726('0x42')](_0x2c6d07);})[_0x6726('0x24')](function(_0x427cc4){_0x4fd2fd[_0x6726('0x43')]=_0x427cc4;return _0x4fd2fd;})[_0x6726('0x24')](respondWithFilteredResult(_0x4947f2,_0x2c6d07))['catch'](handleError(_0x4947f2,null));};exports['show']=function(_0x41dc9f,_0x481f3d){var _0x39f51f={'raw':![],'where':{'id':_0x41dc9f[_0x6726('0x44')]['id']}},_0x7fbd38={};_0x7fbd38[_0x6726('0x2f')]=_[_0x6726('0x31')](db[_0x6726('0x2b')]['rawAttributes']);_0x7fbd38[_0x6726('0x30')]=_['keys'](_0x41dc9f[_0x6726('0x30')]);_0x7fbd38['filters']=_['intersection'](_0x7fbd38[_0x6726('0x2f')],_0x7fbd38[_0x6726('0x30')]);_0x39f51f['attributes']=_[_0x6726('0x33')](_0x7fbd38[_0x6726('0x2f')],qs['fields'](_0x41dc9f[_0x6726('0x30')]['fields']));_0x39f51f['attributes']=_0x39f51f['attributes'][_0x6726('0x36')]?_0x39f51f['attributes']:_0x7fbd38['model'];if(_0x41dc9f[_0x6726('0x30')]['includeAll']){_0x39f51f['include']=[{'all':!![]}];}_0x39f51f=_[_0x6726('0x3c')]({},_0x39f51f,_0x41dc9f[_0x6726('0x3f')]);return db['ScreenRecording']['find'](_0x39f51f)[_0x6726('0x24')](handleEntityNotFound(_0x481f3d,null))[_0x6726('0x24')](respondWithResult(_0x481f3d,null))[_0x6726('0x45')](handleError(_0x481f3d,null));};exports[_0x6726('0x46')]=function(_0xcad4e4,_0x28e79e){return db[_0x6726('0x2b')][_0x6726('0x46')](_0xcad4e4[_0x6726('0x47')],{})[_0x6726('0x24')](respondWithResult(_0x28e79e,0xc9))[_0x6726('0x45')](handleError(_0x28e79e,null));};exports[_0x6726('0x22')]=function(_0x5254b0,_0x30a4db){if(_0x5254b0[_0x6726('0x47')]['id']){delete _0x5254b0['body']['id'];}delete _0x5254b0[_0x6726('0x47')][_0x6726('0x48')];delete _0x5254b0[_0x6726('0x47')][_0x6726('0x49')];delete _0x5254b0[_0x6726('0x47')]['closedAt'];delete _0x5254b0[_0x6726('0x47')][_0x6726('0x4a')];return db[_0x6726('0x2b')][_0x6726('0x4b')]({'where':{'id':_0x5254b0[_0x6726('0x44')]['id']}})[_0x6726('0x24')](handleEntityNotFound(_0x30a4db,null))[_0x6726('0x24')](saveUpdates(_0x5254b0[_0x6726('0x47')],null))['then'](respondWithResult(_0x30a4db,null))['catch'](handleError(_0x30a4db,null));};exports[_0x6726('0x4c')]=function(_0x415643,_0x35c310){return db[_0x6726('0x2b')]['describe']()[_0x6726('0x24')](respondWithResult(_0x35c310,null))[_0x6726('0x45')](handleError(_0x35c310,null));};exports['download']=function(_0x26ddec,_0xad875b,_0x3d551e){var _0x5f5678=require(_0x6726('0x4d'));var _0x19189e=![];var _0x10dcf1={};if(_0x26ddec[_0x6726('0x30')][_0x6726('0x2d')]&&_0x26ddec[_0x6726('0x30')][_0x6726('0x2d')]===_0x6726('0x4e')){_0x10dcf1[_0x6726('0x4e')]=_0x26ddec['params']['id'];}else{_0x10dcf1['id']=_0x26ddec[_0x6726('0x44')]['id'];}return db[_0x6726('0x2b')][_0x6726('0x4b')]({'where':_0x10dcf1,'attributes':['id',_0x6726('0x4a')],'raw':!![]})[_0x6726('0x24')](handleEntityNotFound(_0xad875b,null))[_0x6726('0x24')](function(_0x120454){if(_0x120454){var _0x6d3c3d=path[_0x6726('0x4f')](config[_0x6726('0x50')],'server/files/screen_recordings',_0x120454['value']);var _0x4706e0=util['format']('%s.cypher',_0x6d3c3d);if(fs[_0x6726('0x51')](_0x4706e0)){_0x19189e=!![];return _0x5f5678['decryptFile'](_0x4706e0,_0x6d3c3d,config[_0x6726('0x52')][_0x6726('0x53')])[_0x6726('0x24')](function(){return _0x120454;});}return _0x120454;}})[_0x6726('0x24')](function(_0xc8a78d){if(_0xc8a78d){var _0xd05df3=path[_0x6726('0x4f')](config[_0x6726('0x50')],'server/files/screen_recordings',_0xc8a78d[_0x6726('0x4a')]);if(!fs[_0x6726('0x51')](_0xd05df3)){throw new db[(_0x6726('0x54'))][(_0x6726('0x55'))](_0x6726('0x56'));}if(_0xc8a78d[_0x6726('0x57')]){return _0xad875b[_0x6726('0x58')](_0xd05df3,_0xc8a78d['filename']+path[_0x6726('0x59')](_0xd05df3),function(){if(_0x19189e){fs[_0x6726('0x5a')](_0xd05df3);}});}else{return _0xad875b[_0x6726('0x58')](_0xd05df3,function(_0x5d6482){if(_0x19189e){fs['unlink'](_0xd05df3);}});}}})[_0x6726('0x45')](function(_0x1cce85){if(_0x1cce85['message']===_0x6726('0x56')){_0xad875b[_0x6726('0x19')](0x194)['send']('Not\x20found');}else{return handleError(_0xad875b,null);}});};exports['destroy']=function(_0x3e7871,_0x12d0d8){return db[_0x6726('0x2b')][_0x6726('0x4b')]({'where':{'id':_0x3e7871[_0x6726('0x44')]['id']}})['then'](function(_0x35d41b){if(!_0x35d41b)throw new ReferenceError('Entity\x20not\x20found');return _0x35d41b;})[_0x6726('0x24')](function(_0x5dbf1d){var _0xee22a6=path[_0x6726('0x4f')](config[_0x6726('0x50')],_0x6726('0x5b'),_0x5dbf1d[_0x6726('0x4a')]);logger['info'](_0x6726('0x5c'),_0xee22a6);if(!_['isNil'](_0x5dbf1d[_0x6726('0x4a')])&&fs[_0x6726('0x51')](_0xee22a6)){logger[_0x6726('0x5d')](_0x6726('0x5e')+_0xee22a6+_0x6726('0x5f'));fs[_0x6726('0x60')](_0xee22a6);}_0xee22a6=_0xee22a6+_0x6726('0x61');if(!_['isNil'](_0x5dbf1d[_0x6726('0x4a')])&&fs[_0x6726('0x51')](_0xee22a6)){logger['info']('File:\x20\x22'+_0xee22a6+_0x6726('0x5f'));fs[_0x6726('0x60')](_0xee22a6);}return _0x5dbf1d;})[_0x6726('0x24')](function(_0x1145a9){if(!_0x1145a9)throw new InternalError();return _0x1145a9[_0x6726('0x23')]();})[_0x6726('0x24')](function(){_0x12d0d8[_0x6726('0x19')](0xcc)[_0x6726('0x1a')]();})[_0x6726('0x45')](handleError(_0x12d0d8,null));}; \ No newline at end of file +var _0xb550=['index','map','ScreenRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','describe','uniqueid','value','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Entity\x20not\x20found','root','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','end','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x447f89,_0x235bdb){var _0x3cfc26=function(_0x6f61bc){while(--_0x6f61bc){_0x447f89['push'](_0x447f89['shift']());}};_0x3cfc26(++_0x235bdb);}(_0xb550,0x183));var _0x0b55=function(_0x5e23f0,_0x5e6599){_0x5e23f0=_0x5e23f0-0x0;var _0x4b14e3=_0xb550[_0x5e23f0];return _0x4b14e3;};'use strict';var pdf=require(_0x0b55('0x0'));var emlformat=require(_0x0b55('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0b55('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b55('0x3'));var moment=require(_0x0b55('0x4'));var BPromise=require(_0x0b55('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0b55('0x6'));var sox=require(_0x0b55('0x7'));var csv=require(_0x0b55('0x8'));var ejs=require(_0x0b55('0x9'));var fs=require('fs');var _=require(_0x0b55('0xa'));var squel=require(_0x0b55('0xb'));var crypto=require(_0x0b55('0xc'));var jsforce=require(_0x0b55('0xd'));var deskjs=require(_0x0b55('0xe'));var toCsv=require(_0x0b55('0x8'));var querystring=require(_0x0b55('0xf'));var Papa=require(_0x0b55('0x10'));var Redis=require(_0x0b55('0x11'));var authService=require(_0x0b55('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0b55('0x13'));var hardwareService=require(_0x0b55('0x14'));var logger=require(_0x0b55('0x15'))(_0x0b55('0x16'));var utils=require(_0x0b55('0x17'));var config=require(_0x0b55('0x18'));var db=require(_0x0b55('0x19'))['db'];function respondWithStatusCode(_0x51e44c,_0x18272c){_0x18272c=_0x18272c||0xcc;return function(_0x109520){if(_0x109520){return _0x51e44c[_0x0b55('0x1a')](_0x18272c);}return _0x51e44c[_0x0b55('0x1b')](_0x18272c)['end']();};}function respondWithResult(_0x45840c,_0x2779d7){_0x2779d7=_0x2779d7||0xc8;return function(_0x33ebb5){if(_0x33ebb5){return _0x45840c[_0x0b55('0x1b')](_0x2779d7)[_0x0b55('0x1c')](_0x33ebb5);}};}function respondWithFilteredResult(_0x14c2c7,_0x4fb142){return function(_0x21880e){if(_0x21880e){var _0x3d7f5f=_0x21880e[_0x0b55('0x1d')],_0x2f3f3d=_0x4fb142[_0x0b55('0x1e')],_0x1484b0=_0x4fb142[_0x0b55('0x1e')]+_0x4fb142['limit'],_0x56a343;if(_0x1484b0>=_0x3d7f5f){_0x1484b0=_0x3d7f5f;_0x56a343=0xc8;}else{_0x56a343=0xce;}_0x14c2c7[_0x0b55('0x1b')](_0x56a343);return _0x14c2c7[_0x0b55('0x1f')]('Content-Range',_0x2f3f3d+'-'+_0x1484b0+'/'+_0x3d7f5f)[_0x0b55('0x1c')](_0x21880e);}return null;};}function patchUpdates(_0x412eef){return function(_0xc1b6d3){try{jsonpatch[_0x0b55('0x20')](_0xc1b6d3,_0x412eef,!![]);}catch(_0x112da5){return BPromise[_0x0b55('0x21')](_0x112da5);}return _0xc1b6d3['save']();};}function saveUpdates(_0x4cc21b,_0x31885a){return function(_0x582c5e){if(_0x582c5e){return _0x582c5e[_0x0b55('0x22')](_0x4cc21b)[_0x0b55('0x23')](function(_0x507136){return _0x507136;});}return null;};}function removeEntity(_0x4bc2b6,_0x4be09b){return function(_0x32acbf){if(_0x32acbf){return _0x32acbf[_0x0b55('0x24')]()[_0x0b55('0x23')](function(){_0x4bc2b6[_0x0b55('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ccb8e,_0x181dc9){return function(_0x4088df){if(!_0x4088df){_0x4ccb8e[_0x0b55('0x1a')](0x194);}return _0x4088df;};}function handleError(_0x591bb0,_0x18fb05){_0x18fb05=_0x18fb05||0x1f4;return function(_0x5db7a9){logger[_0x0b55('0x25')](_0x5db7a9[_0x0b55('0x26')]);if(_0x5db7a9[_0x0b55('0x27')]){delete _0x5db7a9[_0x0b55('0x27')];}_0x591bb0[_0x0b55('0x1b')](_0x18fb05)[_0x0b55('0x28')](_0x5db7a9);};}exports[_0x0b55('0x29')]=function(_0x123680,_0x2ce6c5){var _0x4f1473={},_0x161e5e={},_0xf9a989={'count':0x0,'rows':[]};var _0x22103b=_[_0x0b55('0x2a')](db[_0x0b55('0x2b')][_0x0b55('0x2c')],function(_0x2c7cdc){return{'name':_0x2c7cdc[_0x0b55('0x2d')],'type':_0x2c7cdc[_0x0b55('0x2e')]['key']};});_0x161e5e[_0x0b55('0x2f')]=_[_0x0b55('0x30')](_[_0x0b55('0x2a')](_0x22103b,_0x0b55('0x27')),[_0x0b55('0x31')]);_0x161e5e[_0x0b55('0x32')]=_[_0x0b55('0x33')](_0x123680[_0x0b55('0x32')]);_0x161e5e[_0x0b55('0x34')]=_[_0x0b55('0x35')](_0x161e5e[_0x0b55('0x2f')],_0x161e5e[_0x0b55('0x32')]);_0x4f1473['attributes']=_['intersection'](_0x161e5e[_0x0b55('0x2f')],qs[_0x0b55('0x36')](_0x123680[_0x0b55('0x32')][_0x0b55('0x36')]));_0x4f1473[_0x0b55('0x37')]=_0x4f1473[_0x0b55('0x37')][_0x0b55('0x38')]?_0x4f1473['attributes']:_0x161e5e['model'];if(!_0x123680[_0x0b55('0x32')][_0x0b55('0x39')](_0x0b55('0x3a'))){_0x4f1473[_0x0b55('0x3b')]=qs[_0x0b55('0x3b')](_0x123680[_0x0b55('0x32')][_0x0b55('0x3b')]);_0x4f1473['offset']=qs[_0x0b55('0x1e')](_0x123680['query']['offset']);}_0x4f1473[_0x0b55('0x3c')]=qs[_0x0b55('0x3d')](_0x123680['query'][_0x0b55('0x3d')]);_0x4f1473['where']=qs[_0x0b55('0x34')](_[_0x0b55('0x3e')](_0x123680[_0x0b55('0x32')],_0x161e5e[_0x0b55('0x34')]),_0x22103b);if(_0x123680[_0x0b55('0x32')][_0x0b55('0x3f')]){_0x4f1473[_0x0b55('0x40')]=_[_0x0b55('0x41')](_0x4f1473[_0x0b55('0x40')],{'$or':_[_0x0b55('0x2a')](_0x22103b,function(_0x23bc7d){if(_0x23bc7d[_0x0b55('0x2e')]!==_0x0b55('0x42')){var _0x300265={};_0x300265[_0x23bc7d[_0x0b55('0x27')]]={'$like':'%'+_0x123680[_0x0b55('0x32')]['filter']+'%'};return _0x300265;}})});}_0x4f1473=_[_0x0b55('0x41')]({},_0x4f1473,_0x123680[_0x0b55('0x43')]);var _0x390cd4={'where':_0x4f1473[_0x0b55('0x40')]};return db[_0x0b55('0x2b')][_0x0b55('0x1d')](_0x390cd4)[_0x0b55('0x23')](function(_0x95f84b){_0xf9a989[_0x0b55('0x1d')]=_0x95f84b;if(_0x123680[_0x0b55('0x32')][_0x0b55('0x44')]){_0x4f1473[_0x0b55('0x45')]=[{'all':!![]}];}return db['ScreenRecording'][_0x0b55('0x46')](_0x4f1473);})['then'](function(_0xd58e2d){_0xf9a989[_0x0b55('0x47')]=_0xd58e2d;return _0xf9a989;})[_0x0b55('0x23')](respondWithFilteredResult(_0x2ce6c5,_0x4f1473))[_0x0b55('0x48')](handleError(_0x2ce6c5,null));};exports[_0x0b55('0x49')]=function(_0xc95bad,_0x1bb1ef){var _0x59a082={'raw':![],'where':{'id':_0xc95bad[_0x0b55('0x4a')]['id']}},_0x9ad02b={};_0x9ad02b[_0x0b55('0x2f')]=_[_0x0b55('0x33')](db['ScreenRecording']['rawAttributes']);_0x9ad02b[_0x0b55('0x32')]=_[_0x0b55('0x33')](_0xc95bad[_0x0b55('0x32')]);_0x9ad02b[_0x0b55('0x34')]=_[_0x0b55('0x35')](_0x9ad02b[_0x0b55('0x2f')],_0x9ad02b[_0x0b55('0x32')]);_0x59a082[_0x0b55('0x37')]=_[_0x0b55('0x35')](_0x9ad02b[_0x0b55('0x2f')],qs[_0x0b55('0x36')](_0xc95bad[_0x0b55('0x32')]['fields']));_0x59a082[_0x0b55('0x37')]=_0x59a082[_0x0b55('0x37')][_0x0b55('0x38')]?_0x59a082[_0x0b55('0x37')]:_0x9ad02b[_0x0b55('0x2f')];if(_0xc95bad[_0x0b55('0x32')][_0x0b55('0x44')]){_0x59a082['include']=[{'all':!![]}];}_0x59a082=_[_0x0b55('0x41')]({},_0x59a082,_0xc95bad[_0x0b55('0x43')]);return db[_0x0b55('0x2b')][_0x0b55('0x4b')](_0x59a082)[_0x0b55('0x23')](handleEntityNotFound(_0x1bb1ef,null))[_0x0b55('0x23')](respondWithResult(_0x1bb1ef,null))[_0x0b55('0x48')](handleError(_0x1bb1ef,null));};exports['create']=function(_0xed3af0,_0x4a8666){return db['ScreenRecording'][_0x0b55('0x4c')](_0xed3af0[_0x0b55('0x4d')],{})[_0x0b55('0x23')](respondWithResult(_0x4a8666,0xc9))[_0x0b55('0x48')](handleError(_0x4a8666,null));};exports[_0x0b55('0x22')]=function(_0x2bea35,_0x4a7ba4){if(_0x2bea35['body']['id']){delete _0x2bea35[_0x0b55('0x4d')]['id'];}delete _0x2bea35[_0x0b55('0x4d')][_0x0b55('0x4e')];delete _0x2bea35[_0x0b55('0x4d')][_0x0b55('0x4f')];delete _0x2bea35['body'][_0x0b55('0x50')];delete _0x2bea35[_0x0b55('0x4d')]['value'];return db['ScreenRecording'][_0x0b55('0x4b')]({'where':{'id':_0x2bea35[_0x0b55('0x4a')]['id']}})[_0x0b55('0x23')](handleEntityNotFound(_0x4a7ba4,null))[_0x0b55('0x23')](saveUpdates(_0x2bea35['body'],null))['then'](respondWithResult(_0x4a7ba4,null))[_0x0b55('0x48')](handleError(_0x4a7ba4,null));};exports[_0x0b55('0x51')]=function(_0x220a6c,_0x213b63){return db['ScreenRecording'][_0x0b55('0x51')]()[_0x0b55('0x23')](respondWithResult(_0x213b63,null))['catch'](handleError(_0x213b63,null));};exports['download']=function(_0x321133,_0x3e75ea,_0x5884af){var _0x3c2132=require('../../components/encryptor');var _0x1608c0=![];var _0x184df6={};if(_0x321133['query'][_0x0b55('0x2e')]&&_0x321133['query'][_0x0b55('0x2e')]===_0x0b55('0x52')){_0x184df6['uniqueid']=_0x321133['params']['id'];}else{_0x184df6['id']=_0x321133[_0x0b55('0x4a')]['id'];}return db[_0x0b55('0x2b')][_0x0b55('0x4b')]({'where':_0x184df6,'attributes':['id',_0x0b55('0x53')],'raw':!![]})[_0x0b55('0x23')](handleEntityNotFound(_0x3e75ea,null))[_0x0b55('0x23')](function(_0x51e55c){if(_0x51e55c){var _0x2c222d=path[_0x0b55('0x54')](config['root'],_0x0b55('0x55'),_0x51e55c['value']);var _0x32a7e1=util[_0x0b55('0x31')](_0x0b55('0x56'),_0x2c222d);if(fs[_0x0b55('0x57')](_0x32a7e1)){_0x1608c0=!![];return _0x3c2132[_0x0b55('0x58')](_0x32a7e1,_0x2c222d,config[_0x0b55('0x59')][_0x0b55('0x5a')])[_0x0b55('0x23')](function(){return _0x51e55c;});}return _0x51e55c;}})['then'](function(_0x57e34f){if(_0x57e34f){var _0x5d95c0=path[_0x0b55('0x54')](config['root'],_0x0b55('0x55'),_0x57e34f[_0x0b55('0x53')]);if(!fs[_0x0b55('0x57')](_0x5d95c0)){throw new db[(_0x0b55('0x5b'))]['ValidationError'](_0x0b55('0x5c'));}if(_0x57e34f[_0x0b55('0x5d')]){return _0x3e75ea['download'](_0x5d95c0,_0x57e34f[_0x0b55('0x5d')]+path[_0x0b55('0x5e')](_0x5d95c0),function(){if(_0x1608c0){fs[_0x0b55('0x5f')](_0x5d95c0);}});}else{return _0x3e75ea['download'](_0x5d95c0,function(_0x5d3046){if(_0x1608c0){fs[_0x0b55('0x5f')](_0x5d95c0);}});}}})[_0x0b55('0x48')](function(_0x432c8e){if(_0x432c8e[_0x0b55('0x60')]===_0x0b55('0x5c')){_0x3e75ea[_0x0b55('0x1b')](0x194)[_0x0b55('0x28')]('Not\x20found');}else{return handleError(_0x3e75ea,null);}});};exports[_0x0b55('0x24')]=function(_0x2fec87,_0x43b660){return db[_0x0b55('0x2b')][_0x0b55('0x4b')]({'where':{'id':_0x2fec87[_0x0b55('0x4a')]['id']}})['then'](function(_0x5c2295){if(!_0x5c2295)throw new ReferenceError(_0x0b55('0x61'));return _0x5c2295;})[_0x0b55('0x23')](function(_0x52466b){var _0x2e0d31=path[_0x0b55('0x54')](config[_0x0b55('0x62')],'server/files/screen_recordings',_0x52466b[_0x0b55('0x53')]);logger[_0x0b55('0x63')](_0x0b55('0x64'),_0x2e0d31);if(!_['isNil'](_0x52466b[_0x0b55('0x53')])&&fs['existsSync'](_0x2e0d31)){logger[_0x0b55('0x63')]('File:\x20\x22'+_0x2e0d31+_0x0b55('0x65'));fs[_0x0b55('0x66')](_0x2e0d31);}_0x2e0d31=_0x2e0d31+_0x0b55('0x67');if(!_[_0x0b55('0x68')](_0x52466b[_0x0b55('0x53')])&&fs[_0x0b55('0x57')](_0x2e0d31)){logger[_0x0b55('0x63')](_0x0b55('0x69')+_0x2e0d31+_0x0b55('0x65'));fs[_0x0b55('0x66')](_0x2e0d31);}return _0x52466b;})[_0x0b55('0x23')](function(_0x5742ea){if(!_0x5742ea)throw new InternalError();return _0x5742ea[_0x0b55('0x24')]();})[_0x0b55('0x23')](function(){_0x43b660[_0x0b55('0x1b')](0xcc)[_0x0b55('0x6a')]();})[_0x0b55('0x48')](handleError(_0x43b660,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 6b0e024..ee4055c 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 _0x47ec=['util','../../config/logger','bluebird','path','rimraf','./screenRecording.attributes','define','screen_recordings','interactionid'];(function(_0x3e9ff6,_0x1a3cc8){var _0x45a27d=function(_0x184c9b){while(--_0x184c9b){_0x3e9ff6['push'](_0x3e9ff6['shift']());}};_0x45a27d(++_0x1a3cc8);}(_0x47ec,0x144));var _0xc47e=function(_0x50ed80,_0x328cd5){_0x50ed80=_0x50ed80-0x0;var _0x265173=_0x47ec[_0x50ed80];return _0x265173;};'use strict';var _=require('lodash');var util=require(_0xc47e('0x0'));var logger=require(_0xc47e('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc47e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc47e('0x3'));var rimraf=require(_0xc47e('0x4'));var config=require('../../config/environment');var attributes=require(_0xc47e('0x5'));module['exports']=function(_0x1d96bf,_0x56a235){return _0x1d96bf[_0xc47e('0x6')]('ScreenRecording',attributes,{'tableName':_0xc47e('0x7'),'paranoid':![],'indexes':[{'name':_0xc47e('0x8'),'fields':[_0xc47e('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9846=['request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','screen_recordings','interactionid','lodash','util','api','bluebird'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x9846,0x1a9));var _0x6984=function(_0x2819e1,_0x5323e6){_0x2819e1=_0x2819e1-0x0;var _0x448e12=_0x9846[_0x2819e1];return _0x448e12;};'use strict';var _=require(_0x6984('0x0'));var util=require(_0x6984('0x1'));var logger=require('../../config/logger')(_0x6984('0x2'));var moment=require('moment');var BPromise=require(_0x6984('0x3'));var rp=require(_0x6984('0x4'));var fs=require('fs');var path=require(_0x6984('0x5'));var rimraf=require(_0x6984('0x6'));var config=require(_0x6984('0x7'));var attributes=require(_0x6984('0x8'));module['exports']=function(_0x997b68,_0x4a5854){return _0x997b68['define']('ScreenRecording',attributes,{'tableName':_0x6984('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x6984('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 7fd1e06..efc9b5e 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(_0x206892,_0x2dcfcb){var _0x39851d=function(_0x2a1588){while(--_0x2a1588){_0x206892['push'](_0x206892['shift']());}};_0x39851d(++_0x2dcfcb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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(_0x51b590,_0x39eba5){var _0x5200ab=function(_0x4d7711){while(--_0x4d7711){_0x51b590['push'](_0x51b590['shift']());}};_0x5200ab(++_0x39eba5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 3fc8ca9..001e6fb 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 _0xdbf4=['addLogo','file','addLogoLogin','addPreferred','server/files/images/logos/','favicon','addFavicon','put','update','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single'];(function(_0x47e372,_0x2cfa02){var _0x6bf337=function(_0x121b7b){while(--_0x121b7b){_0x47e372['push'](_0x47e372['shift']());}};_0x6bf337(++_0x2cfa02);}(_0xdbf4,0x1eb));var _0x4dbf=function(_0x5c8f76,_0x2bce94){_0x5c8f76=_0x5c8f76-0x0;var _0x42ea69=_0xdbf4[_0x5c8f76];return _0x42ea69;};'use strict';var multer=require('multer');var util=require(_0x4dbf('0x0'));var path=require('path');var timeout=require(_0x4dbf('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4dbf('0x2'));var config=require(_0x4dbf('0x3'));var controller=require(_0x4dbf('0x4'));router[_0x4dbf('0x5')]('/',auth[_0x4dbf('0x6')](),controller[_0x4dbf('0x7')]);router[_0x4dbf('0x5')](_0x4dbf('0x8'),controller[_0x4dbf('0x9')]);router[_0x4dbf('0x5')]('/:id/logo',controller[_0x4dbf('0xa')]);router['get'](_0x4dbf('0xb'),controller[_0x4dbf('0xc')]);router['get']('/:id/gdpr',controller[_0x4dbf('0xd')]);router[_0x4dbf('0x5')](_0x4dbf('0xe'),controller['getPreferred']);router['get'](_0x4dbf('0xf'),controller[_0x4dbf('0x10')]);var upload=multer({'storage':multer[_0x4dbf('0x11')]({'destination':function(_0x58bca3,_0x4996e6,_0x291efb){_0x291efb(null,path[_0x4dbf('0x12')](config[_0x4dbf('0x13')],'server/files/images/logos/'));},'filename':function(_0x23b6d6,_0x5c0d60,_0x2c8cdf){_0x2c8cdf(null,util[_0x4dbf('0x14')](_0x4dbf('0x15'),_0x4dbf('0x16'),path[_0x4dbf('0x17')](_0x5c0d60[_0x4dbf('0x18')])));}})});router[_0x4dbf('0x19')]('/:id/logo',upload[_0x4dbf('0x1a')]('file'),controller[_0x4dbf('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x107d1d,_0x58b80a,_0x20b5c3){_0x20b5c3(null,path[_0x4dbf('0x12')](config[_0x4dbf('0x13')],'server/files/images/logos/'));},'filename':function(_0x26dd98,_0x53b152,_0x3fec8e){_0x3fec8e(null,util[_0x4dbf('0x14')](_0x4dbf('0x15'),'logologin',path[_0x4dbf('0x17')](_0x53b152[_0x4dbf('0x18')])));}})});router[_0x4dbf('0x19')]('/:id/logo_login',upload['single'](_0x4dbf('0x1c')),controller[_0x4dbf('0x1d')]);var upload=multer({'storage':multer[_0x4dbf('0x11')]({'destination':function(_0x481ffa,_0x2001e7,_0x3cf3a3){_0x3cf3a3(null,path[_0x4dbf('0x12')](config[_0x4dbf('0x13')],'server/files/images/logos/'));},'filename':function(_0x1bdbba,_0x4e8bf9,_0x3f0e92){_0x3f0e92(null,util[_0x4dbf('0x14')](_0x4dbf('0x15'),'preferred',path[_0x4dbf('0x17')](_0x4e8bf9[_0x4dbf('0x18')])));}})});router['post'](_0x4dbf('0xe'),upload[_0x4dbf('0x1a')](_0x4dbf('0x1c')),controller[_0x4dbf('0x1e')]);var upload=multer({'storage':multer[_0x4dbf('0x11')]({'destination':function(_0x19a7d5,_0x2e4091,_0x99fe34){_0x99fe34(null,path[_0x4dbf('0x12')](config['root'],_0x4dbf('0x1f')));},'filename':function(_0x4c11f2,_0x3be26a,_0x75c303){_0x75c303(null,util[_0x4dbf('0x14')](_0x4dbf('0x15'),_0x4dbf('0x20'),path['extname'](_0x3be26a['originalname'])));}})});router[_0x4dbf('0x19')](_0x4dbf('0xf'),upload[_0x4dbf('0x1a')](_0x4dbf('0x1c')),controller[_0x4dbf('0x21')]);router[_0x4dbf('0x22')](_0x4dbf('0x8'),auth['isAuthenticated'](),controller[_0x4dbf('0x23')]);module[_0x4dbf('0x24')]=router; \ No newline at end of file +var _0x16fd=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','post','single','file','addLogo','logologin','addLogoLogin','preferred','extname','originalname','addPreferred','favicon','addFavicon','exports','multer'];(function(_0x12e3d2,_0x77a0e0){var _0x2e632c=function(_0x52d273){while(--_0x52d273){_0x12e3d2['push'](_0x12e3d2['shift']());}};_0x2e632c(++_0x77a0e0);}(_0x16fd,0xa7));var _0xd16f=function(_0x177346,_0x5e4024){_0x177346=_0x177346-0x0;var _0x155669=_0x16fd[_0x177346];return _0x155669;};'use strict';var multer=require(_0xd16f('0x0'));var util=require(_0xd16f('0x1'));var path=require(_0xd16f('0x2'));var timeout=require(_0xd16f('0x3'));var express=require(_0xd16f('0x4'));var router=express[_0xd16f('0x5')]();var auth=require(_0xd16f('0x6'));var interaction=require(_0xd16f('0x7'));var config=require(_0xd16f('0x8'));var controller=require('./setting.controller');router[_0xd16f('0x9')]('/',auth[_0xd16f('0xa')](),controller[_0xd16f('0xb')]);router[_0xd16f('0x9')](_0xd16f('0xc'),controller[_0xd16f('0xd')]);router['get'](_0xd16f('0xe'),controller[_0xd16f('0xf')]);router['get'](_0xd16f('0x10'),controller[_0xd16f('0x11')]);router[_0xd16f('0x9')](_0xd16f('0x12'),controller['gdpr']);router[_0xd16f('0x9')](_0xd16f('0x13'),controller['getPreferred']);router[_0xd16f('0x9')](_0xd16f('0x14'),controller[_0xd16f('0x15')]);var upload=multer({'storage':multer[_0xd16f('0x16')]({'destination':function(_0x3cbd84,_0x1b1269,_0x43e569){_0x43e569(null,path[_0xd16f('0x17')](config[_0xd16f('0x18')],_0xd16f('0x19')));},'filename':function(_0x5448dc,_0x567b5a,_0xd944f0){_0xd944f0(null,util[_0xd16f('0x1a')](_0xd16f('0x1b'),_0xd16f('0x1c'),path['extname'](_0x567b5a['originalname'])));}})});router[_0xd16f('0x1d')]('/:id/logo',upload[_0xd16f('0x1e')](_0xd16f('0x1f')),controller[_0xd16f('0x20')]);var upload=multer({'storage':multer[_0xd16f('0x16')]({'destination':function(_0x6dd77f,_0x9f76a1,_0x2d3720){_0x2d3720(null,path[_0xd16f('0x17')](config[_0xd16f('0x18')],_0xd16f('0x19')));},'filename':function(_0x5d6390,_0x4f9af8,_0x5eda91){_0x5eda91(null,util[_0xd16f('0x1a')](_0xd16f('0x1b'),_0xd16f('0x21'),path['extname'](_0x4f9af8['originalname'])));}})});router[_0xd16f('0x1d')]('/:id/logo_login',upload[_0xd16f('0x1e')](_0xd16f('0x1f')),controller[_0xd16f('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27ca77,_0x353c64,_0x135ffa){_0x135ffa(null,path['join'](config['root'],_0xd16f('0x19')));},'filename':function(_0x48fa8b,_0x3b40c7,_0x1e4602){_0x1e4602(null,util[_0xd16f('0x1a')](_0xd16f('0x1b'),_0xd16f('0x23'),path[_0xd16f('0x24')](_0x3b40c7[_0xd16f('0x25')])));}})});router['post']('/:id/preferred',upload['single'](_0xd16f('0x1f')),controller[_0xd16f('0x26')]);var upload=multer({'storage':multer[_0xd16f('0x16')]({'destination':function(_0x1d904c,_0x1ddd56,_0x1bae47){_0x1bae47(null,path[_0xd16f('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x399ef8,_0x161ce6,_0x4de1d8){_0x4de1d8(null,util[_0xd16f('0x1a')](_0xd16f('0x1b'),_0xd16f('0x27'),path[_0xd16f('0x24')](_0x161ce6['originalname'])));}})});router['post']('/:id/favicon',upload['single']('file'),controller[_0xd16f('0x28')]);router['put']('/:id',auth[_0xd16f('0xa')](),controller['update']);module[_0xd16f('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 3b96943..3d45200 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 _0x62b7=['min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER'];(function(_0x4ca89c,_0x4de5e3){var _0x4fc799=function(_0x406d5b){while(--_0x406d5b){_0x4ca89c['push'](_0x4ca89c['shift']());}};_0x4fc799(++_0x4de5e3);}(_0x62b7,0x1b6));var _0x762b=function(_0x2236fe,_0x4ef9e1){_0x2236fe=_0x2236fe-0x0;var _0x54ec9b=_0x62b7[_0x2236fe];return _0x54ec9b;};'use strict';var Sequelize=require(_0x762b('0x0'));module[_0x762b('0x1')]={'min_internal':{'type':Sequelize[_0x762b('0x2')](0xb),'unique':_0x762b('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x762b('0x2')](0xb),'unique':_0x762b('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x762b('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x762b('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x762b('0x5')]},'defaultLogo':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x762b('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x762b('0x5')]},'turnaddr':{'type':Sequelize[_0x762b('0x5')]},'turnusername':{'type':Sequelize[_0x762b('0x5')]},'turnpassword':{'type':Sequelize[_0x762b('0x5')]},'pageTitle':{'type':Sequelize[_0x762b('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x762b('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x762b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x762b('0x5')],'defaultValue':_0x762b('0x7')},'enableEmailPreview':{'type':Sequelize[_0x762b('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x762b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x762b('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x762b('0x5')],'defaultValue':_0x762b('0x8')},'chatTimeout':{'type':Sequelize[_0x762b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x762b('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x762b('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x762b('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x762b('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x762b('0x5')]},'defaultFavicon':{'type':Sequelize[_0x762b('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x762b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x762b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x762b('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x762b('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x762b('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x762b('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x762b('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x762b('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x404d=['BOOLEAN','alternate','exports','INTEGER','min_internal','/var/opt/motion2/server/files/sounds/converted','STRING'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x404d,0x198));var _0xd404=function(_0x34e562,_0x12c7d0){_0x34e562=_0x34e562-0x0;var _0x4de4d6=_0x404d[_0x34e562];return _0x4de4d6;};'use strict';var Sequelize=require('sequelize');module[_0xd404('0x0')]={'min_internal':{'type':Sequelize[_0xd404('0x1')](0xb),'unique':_0xd404('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xd404('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd404('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xd404('0x3')},'logo':{'type':Sequelize[_0xd404('0x4')]},'defaultLogo':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xd404('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd404('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xd404('0x4')]},'turnaddr':{'type':Sequelize[_0xd404('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0xd404('0x4')]},'pageTitle':{'type':Sequelize[_0xd404('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xd404('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xd404('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd404('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xd404('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xd404('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xd404('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0xd404('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xd404('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xd404('0x4')]},'defaultFavicon':{'type':Sequelize[_0xd404('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd404('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd404('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xd404('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xd404('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xd404('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xd404('0x1')]},'sentimentRegion':{'type':Sequelize[_0xd404('0x4')]},'language':{'type':Sequelize[_0xd404('0x4')]},'bucket':{'type':Sequelize[_0xd404('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xd404('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 5a87fdb..b76d082 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 _0x009c=['default','upperFirst','custom','Sequelize','\x20not\x20found','getLogoLogin','server/files/images/logos','defaultLogo','defaultPreferred','default_loginLogo.png','download','gdpr','securePassword','../../config/license/util','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','count','offset','set','json','reject','save','update','destroy','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','catch','body','find','addLogo','file','filename','logo','addLogoLogin','getLogo','getLicense','loginLogo','preferred','favicon','defaultLoginLogo','defaultFavicon','existsSync','toLower','join','root','default_logo.png'];(function(_0xd726df,_0x55db15){var _0xbaa464=function(_0x488bae){while(--_0x488bae){_0xd726df['push'](_0xd726df['shift']());}};_0xbaa464(++_0x55db15);}(_0x009c,0x17a));var _0xc009=function(_0xa47d8e,_0x3d5b07){_0xa47d8e=_0xa47d8e-0x0;var _0x535b08=_0x009c[_0xa47d8e];return _0x535b08;};'use strict';var pdf=require(_0xc009('0x0'));var emlformat=require(_0xc009('0x1'));var rimraf=require(_0xc009('0x2'));var zipdir=require(_0xc009('0x3'));var jsonpatch=require(_0xc009('0x4'));var rp=require('request-promise');var moment=require(_0xc009('0x5'));var BPromise=require(_0xc009('0x6'));var Mustache=require(_0xc009('0x7'));var util=require(_0xc009('0x8'));var path=require(_0xc009('0x9'));var sox=require(_0xc009('0xa'));var csv=require('to-csv');var ejs=require(_0xc009('0xb'));var fs=require('fs');var _=require(_0xc009('0xc'));var squel=require(_0xc009('0xd'));var crypto=require('crypto');var jsforce=require(_0xc009('0xe'));var deskjs=require(_0xc009('0xf'));var toCsv=require(_0xc009('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc009('0x11'));var authService=require(_0xc009('0x12'));var qs=require(_0xc009('0x13'));var as=require(_0xc009('0x14'));var hardwareService=require(_0xc009('0x15'));var logger=require(_0xc009('0x16'))('api');var utils=require(_0xc009('0x17'));var config=require(_0xc009('0x18'));var db=require(_0xc009('0x19'))['db'];var jayson=require(_0xc009('0x1a'));var client=jayson[_0xc009('0x1b')][_0xc009('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x4262b9,_0x1cdc5a,_0x24a922){if(_0x24a922){var _0x5e9721=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e9721['test'](_0x1cdc5a)){return _0x4262b9;}else{throw new db['Sequelize'][(_0xc009('0x1d'))](_0xc009('0x1e'));}}else{return _0x4262b9;}}function respondWithRpcPromise(_0x6a1fc1,_0x34d0e4,_0x28ce13,_0x1dcb56){return new BPromise(function(_0x10f627,_0x1cafbf){var _0x2b676a=_0x1dcb56||client;return _0x2b676a[_0xc009('0x1f')](_0x6a1fc1,_0x28ce13)[_0xc009('0x20')](function(_0x59fa27){logger[_0xc009('0x21')](_0xc009('0x22'),_0x34d0e4,_0xc009('0x23'));logger[_0xc009('0x24')](_0xc009('0x25'),_0x34d0e4,_0xc009('0x23'),JSON[_0xc009('0x26')](_0x59fa27));if(_0x59fa27['error']){if(_0x59fa27[_0xc009('0x27')]['code']===0x1f4){logger[_0xc009('0x27')]('Setting,\x20%s,\x20%s',_0x34d0e4,_0x59fa27[_0xc009('0x27')][_0xc009('0x28')]);return _0x1cafbf(_0x59fa27[_0xc009('0x27')]['message']);}logger[_0xc009('0x27')](_0xc009('0x22'),_0x34d0e4,_0x59fa27[_0xc009('0x27')]['message']);return _0x10f627(_0x59fa27[_0xc009('0x27')][_0xc009('0x28')]);}else{logger[_0xc009('0x21')](_0xc009('0x22'),_0x34d0e4,_0xc009('0x23'));_0x10f627(_0x59fa27[_0xc009('0x29')][_0xc009('0x28')]);}})['catch'](function(_0x1dc0ae){logger[_0xc009('0x27')](_0xc009('0x22'),_0x34d0e4,_0x1dc0ae);_0x1cafbf(_0x1dc0ae);});});}function respondWithStatusCode(_0x147b18,_0x383e96){_0x383e96=_0x383e96||0xcc;return function(_0xd8f206){if(_0xd8f206){return _0x147b18[_0xc009('0x2a')](_0x383e96);}return _0x147b18[_0xc009('0x2b')](_0x383e96)[_0xc009('0x2c')]();};}function respondWithResult(_0x457cc0,_0x411b47){_0x411b47=_0x411b47||0xc8;return function(_0xa8f258){if(_0xa8f258){return _0x457cc0[_0xc009('0x2b')](_0x411b47)['json'](_0xa8f258);}};}function respondWithFilteredResult(_0x2210fa,_0x38f1f0){return function(_0x2356bc){if(_0x2356bc){var _0x37b59f=_0x2356bc[_0xc009('0x2d')],_0x1cbd72=_0x38f1f0[_0xc009('0x2e')],_0x45f8ac=_0x38f1f0[_0xc009('0x2e')]+_0x38f1f0['limit'],_0x4f5c01;if(_0x45f8ac>=_0x37b59f){_0x45f8ac=_0x37b59f;_0x4f5c01=0xc8;}else{_0x4f5c01=0xce;}_0x2210fa[_0xc009('0x2b')](_0x4f5c01);return _0x2210fa[_0xc009('0x2f')]('Content-Range',_0x1cbd72+'-'+_0x45f8ac+'/'+_0x37b59f)[_0xc009('0x30')](_0x2356bc);}return null;};}function patchUpdates(_0x84be1e){return function(_0x4648f3){try{jsonpatch['apply'](_0x4648f3,_0x84be1e,!![]);}catch(_0x51ba08){return BPromise[_0xc009('0x31')](_0x51ba08);}return _0x4648f3[_0xc009('0x32')]();};}function saveUpdates(_0x571a3c,_0x2def73){return function(_0x1b84e8){if(_0x1b84e8){return _0x1b84e8[_0xc009('0x33')](_0x571a3c)['then'](function(_0x3d2776){return _0x3d2776;});}return null;};}function removeEntity(_0x55fcb1,_0x2e151e){return function(_0x1a8925){if(_0x1a8925){return _0x1a8925[_0xc009('0x34')]()[_0xc009('0x20')](function(){_0x55fcb1[_0xc009('0x2b')](0xcc)[_0xc009('0x2c')]();});}};}function handleEntityNotFound(_0x474e52,_0x240b87){return function(_0x53116d){if(!_0x53116d){_0x474e52['sendStatus'](0x194);}return _0x53116d;};}function handleError(_0x3f8625,_0x2685e5){_0x2685e5=_0x2685e5||0x1f4;return function(_0x330e9e){logger['error'](_0x330e9e['stack']);if(_0x330e9e['name']){delete _0x330e9e[_0xc009('0x35')];}_0x3f8625['status'](_0x2685e5)[_0xc009('0x36')](_0x330e9e);};}exports[_0xc009('0x37')]=function(_0x13dbac,_0x5362e6){var _0x22e7da={},_0x1aef97={},_0x26ed37={'count':0x0,'rows':[]};var _0x13d73e=_[_0xc009('0x38')](db[_0xc009('0x39')][_0xc009('0x3a')],function(_0x31592d){return{'name':_0x31592d[_0xc009('0x3b')],'type':_0x31592d[_0xc009('0x3c')][_0xc009('0x3d')]};});_0x1aef97[_0xc009('0x3e')]=_[_0xc009('0x38')](_0x13d73e,_0xc009('0x35'));_0x1aef97[_0xc009('0x3f')]=_[_0xc009('0x40')](_0x13dbac['query']);_0x1aef97[_0xc009('0x41')]=_['intersection'](_0x1aef97[_0xc009('0x3e')],_0x1aef97[_0xc009('0x3f')]);_0x22e7da[_0xc009('0x42')]=_[_0xc009('0x43')](_0x1aef97[_0xc009('0x3e')],qs[_0xc009('0x44')](_0x13dbac[_0xc009('0x3f')]['fields']));_0x22e7da[_0xc009('0x42')]=_0x22e7da[_0xc009('0x42')][_0xc009('0x45')]?_0x22e7da[_0xc009('0x42')]:_0x1aef97[_0xc009('0x3e')];if(!_0x13dbac['query']['hasOwnProperty']('nolimit')){_0x22e7da[_0xc009('0x46')]=qs[_0xc009('0x46')](_0x13dbac[_0xc009('0x3f')][_0xc009('0x46')]);_0x22e7da['offset']=qs[_0xc009('0x2e')](_0x13dbac[_0xc009('0x3f')]['offset']);}_0x22e7da[_0xc009('0x47')]=qs[_0xc009('0x48')](_0x13dbac[_0xc009('0x3f')][_0xc009('0x48')]);_0x22e7da[_0xc009('0x49')]=qs[_0xc009('0x41')](_['pick'](_0x13dbac[_0xc009('0x3f')],_0x1aef97[_0xc009('0x41')]),_0x13d73e);if(_0x13dbac['query'][_0xc009('0x4a')]){_0x22e7da['where']=_[_0xc009('0x4b')](_0x22e7da[_0xc009('0x49')],{'$or':_[_0xc009('0x38')](_0x13d73e,function(_0x41b2f0){if(_0x41b2f0[_0xc009('0x3c')]!==_0xc009('0x4c')){var _0x33e98c={};_0x33e98c[_0x41b2f0[_0xc009('0x35')]]={'$like':'%'+_0x13dbac['query']['filter']+'%'};return _0x33e98c;}})});}_0x22e7da=_[_0xc009('0x4b')]({},_0x22e7da,_0x13dbac[_0xc009('0x4d')]);var _0x2fd564={'where':_0x22e7da['where']};return db[_0xc009('0x39')][_0xc009('0x2d')](_0x2fd564)['then'](function(_0x18685e){_0x26ed37[_0xc009('0x2d')]=_0x18685e;if(_0x13dbac['query']['includeAll']){_0x22e7da[_0xc009('0x4e')]=[{'all':!![]}];}return db['Setting'][_0xc009('0x4f')](_0x22e7da);})[_0xc009('0x20')](function(_0x1311c8){_0x26ed37[_0xc009('0x50')]=_0x1311c8;return _0x26ed37;})[_0xc009('0x20')](respondWithFilteredResult(_0x5362e6,_0x22e7da))['catch'](handleError(_0x5362e6,null));};exports['show']=function(_0x5b2b9d,_0x3fefe0){var _0x1a0e4c={'raw':![],'where':{'id':_0x5b2b9d[_0xc009('0x51')]['id']}},_0x54c0d6={};_0x54c0d6[_0xc009('0x3e')]=_[_0xc009('0x40')](db[_0xc009('0x39')][_0xc009('0x3a')]);_0x54c0d6[_0xc009('0x3f')]=_[_0xc009('0x40')](_0x5b2b9d[_0xc009('0x3f')]);_0x54c0d6[_0xc009('0x41')]=_['intersection'](_0x54c0d6[_0xc009('0x3e')],_0x54c0d6['query']);_0x1a0e4c[_0xc009('0x42')]=_[_0xc009('0x43')](_0x54c0d6['model'],qs[_0xc009('0x44')](_0x5b2b9d[_0xc009('0x3f')]['fields']));_0x1a0e4c[_0xc009('0x42')]=_0x1a0e4c[_0xc009('0x42')][_0xc009('0x45')]?_0x1a0e4c[_0xc009('0x42')]:_0x54c0d6[_0xc009('0x3e')];if(_0x5b2b9d[_0xc009('0x3f')]['includeAll']){_0x1a0e4c['include']=[{'all':!![]}];}_0x1a0e4c=_['merge']({},_0x1a0e4c,_0x5b2b9d[_0xc009('0x4d')]);return db[_0xc009('0x39')]['find'](_0x1a0e4c)[_0xc009('0x20')](handleEntityNotFound(_0x3fefe0,null))[_0xc009('0x20')](respondWithResult(_0x3fefe0,null))[_0xc009('0x52')](handleError(_0x3fefe0,null));};exports[_0xc009('0x33')]=function(_0x31e2b4,_0x1dded7){if(_0x31e2b4['body']['id']){delete _0x31e2b4[_0xc009('0x53')]['id'];}return db[_0xc009('0x39')][_0xc009('0x54')]({'where':{'id':_0x31e2b4['params']['id']}})[_0xc009('0x20')](handleEntityNotFound(_0x1dded7,null))[_0xc009('0x20')](saveUpdates(_0x31e2b4[_0xc009('0x53')],null))[_0xc009('0x20')](respondWithResult(_0x1dded7,null))[_0xc009('0x52')](handleError(_0x1dded7,null));};exports[_0xc009('0x55')]=function(_0x1baba5,_0x2430cd,_0x124f74){if(_0x1baba5[_0xc009('0x56')]&&_0x1baba5[_0xc009('0x56')][_0xc009('0x57')]){_0x1baba5['body'][_0xc009('0x58')]=_0x1baba5['file'][_0xc009('0x57')];}return db[_0xc009('0x39')][_0xc009('0x54')]({'where':{'id':_0x1baba5[_0xc009('0x51')]['id']}})[_0xc009('0x20')](handleEntityNotFound(_0x2430cd,null))[_0xc009('0x20')](saveUpdates(_0x1baba5[_0xc009('0x53')],null))[_0xc009('0x20')](respondWithResult(_0x2430cd,null))[_0xc009('0x52')](handleError(_0x2430cd,null));};exports[_0xc009('0x59')]=function(_0x3ac00a,_0x4d6f0d,_0x2968ec){if(_0x3ac00a[_0xc009('0x56')]&&_0x3ac00a[_0xc009('0x56')][_0xc009('0x57')]){_0x3ac00a[_0xc009('0x53')]['loginLogo']=_0x3ac00a['file'][_0xc009('0x57')];}return db['Setting'][_0xc009('0x54')]({'where':{'id':_0x3ac00a['params']['id']}})[_0xc009('0x20')](handleEntityNotFound(_0x4d6f0d,null))[_0xc009('0x20')](saveUpdates(_0x3ac00a['body'],null))[_0xc009('0x20')](respondWithResult(_0x4d6f0d,null))[_0xc009('0x52')](handleError(_0x4d6f0d,null));};var utilLicense=require('../../config/license/util');exports[_0xc009('0x5a')]=function(_0x4c6f99,_0x31189f,_0xb3cbb4){var _0xb50333='server/files/images/logos';var _0x5a50a9={'custom':![]};return utilLicense[_0xc009('0x5b')]()[_0xc009('0x20')](function(_0x4ecd75){if(_0x4ecd75){_0x5a50a9=_0x4ecd75;}return db['Setting'][_0xc009('0x54')]({'where':{'id':_0x4c6f99[_0xc009('0x51')]['id']},'attributes':[_0xc009('0x58'),_0xc009('0x5c'),_0xc009('0x5d'),_0xc009('0x5e'),'defaultLogo',_0xc009('0x5f'),'defaultPreferred',_0xc009('0x60')],'raw':!![]});})[_0xc009('0x20')](handleEntityNotFound(_0x31189f,null))[_0xc009('0x20')](function(_0x3fcc72){if(_0x3fcc72){var _0x19406d=_0x3fcc72[_0xc009('0x58')]&&fs[_0xc009('0x61')](path['join'](config['root'],_0xb50333,_[_0xc009('0x62')](_0x3fcc72['logo'])))?path['join'](config['root'],_0xb50333,_[_0xc009('0x62')](_0x3fcc72[_0xc009('0x58')])):path[_0xc009('0x63')](config[_0xc009('0x64')],_0xb50333,_['toLower'](_0xc009('0x65')));var _0x21cea5=_0xc009('0x66')+_[_0xc009('0x67')](_0xc009('0x58'));if(_0x3fcc72[_0x21cea5]||!_0x5a50a9[_0xc009('0x68')]){_0x19406d=path[_0xc009('0x63')](config['root'],_0xb50333,_[_0xc009('0x62')](_0xc009('0x65')));}if(!fs[_0xc009('0x61')](_0x19406d)){throw new db[(_0xc009('0x69'))]['ValidationError'](_[_0xc009('0x67')](_0xc009('0x58'))+_0xc009('0x6a'));}return _0x31189f['download'](_0x19406d);}})[_0xc009('0x52')](handleError(_0x31189f,null));};var utilLicense=require('../../config/license/util');exports[_0xc009('0x6b')]=function(_0x37b7c5,_0x2c45b2,_0x539bd0){var _0x192ecf=_0xc009('0x6c');var _0x5ed2aa={'custom':![]};return utilLicense[_0xc009('0x5b')]()[_0xc009('0x20')](function(_0x5497d6){if(_0x5497d6){_0x5ed2aa=_0x5497d6;}return db[_0xc009('0x39')][_0xc009('0x54')]({'where':{'id':_0x37b7c5[_0xc009('0x51')]['id']},'attributes':[_0xc009('0x58'),_0xc009('0x5c'),_0xc009('0x5d'),_0xc009('0x5e'),_0xc009('0x6d'),'defaultLoginLogo',_0xc009('0x6e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x2c45b2,null))[_0xc009('0x20')](function(_0x5b0093){if(_0x5b0093){var _0x41fcfc=_0x5b0093['loginLogo']&&fs[_0xc009('0x61')](path[_0xc009('0x63')](config[_0xc009('0x64')],_0x192ecf,_[_0xc009('0x62')](_0x5b0093[_0xc009('0x5c')])))?path[_0xc009('0x63')](config[_0xc009('0x64')],_0x192ecf,_[_0xc009('0x62')](_0x5b0093[_0xc009('0x5c')])):path['join'](config['root'],_0x192ecf,_[_0xc009('0x62')](_0xc009('0x6f')));var _0x34e2f8=_0xc009('0x66')+_[_0xc009('0x67')](_0xc009('0x5c'));if(_0x5b0093[_0x34e2f8]||!_0x5ed2aa[_0xc009('0x68')]){_0x41fcfc=path[_0xc009('0x63')](config[_0xc009('0x64')],_0x192ecf,_['toLower'](_0xc009('0x6f')));}if(!fs[_0xc009('0x61')](_0x41fcfc)){throw new db[(_0xc009('0x69'))][(_0xc009('0x1d'))](_[_0xc009('0x67')](_0xc009('0x5c'))+_0xc009('0x6a'));}return _0x2c45b2[_0xc009('0x70')](_0x41fcfc);}})[_0xc009('0x52')](handleError(_0x2c45b2,null));};exports[_0xc009('0x71')]=function(_0x434c08,_0x578b60){return db[_0xc009('0x39')][_0xc009('0x54')]({'where':{'id':_0x434c08[_0xc009('0x51')]['id']},'attributes':[_0xc009('0x72')]})[_0xc009('0x20')](respondWithResult(_0x578b60,null))[_0xc009('0x52')](handleError(_0x578b60,null));};exports['addPreferred']=function(_0x4df2f1,_0x326fec,_0x18497a){if(_0x4df2f1[_0xc009('0x56')]&&_0x4df2f1[_0xc009('0x56')][_0xc009('0x57')]){_0x4df2f1[_0xc009('0x53')]['preferred']=_0x4df2f1[_0xc009('0x56')][_0xc009('0x57')];}return db['Setting'][_0xc009('0x54')]({'where':{'id':_0x4df2f1[_0xc009('0x51')]['id']}})[_0xc009('0x20')](handleEntityNotFound(_0x326fec,null))[_0xc009('0x20')](saveUpdates(_0x4df2f1[_0xc009('0x53')],null))[_0xc009('0x20')](respondWithResult(_0x326fec,null))[_0xc009('0x52')](handleError(_0x326fec,null));};var utilLicense=require(_0xc009('0x73'));exports['getPreferred']=function(_0x1d946d,_0x4c1412,_0x50bdc6){var _0x318ee5=_0xc009('0x6c');var _0x35072e={'custom':![]};return utilLicense[_0xc009('0x5b')]()['then'](function(_0x10d09f){if(_0x10d09f){_0x35072e=_0x10d09f;}return db[_0xc009('0x39')]['find']({'where':{'id':_0x1d946d[_0xc009('0x51')]['id']},'attributes':[_0xc009('0x58'),_0xc009('0x5c'),_0xc009('0x5d'),_0xc009('0x5e'),_0xc009('0x6d'),'defaultLoginLogo',_0xc009('0x6e'),_0xc009('0x60')],'raw':!![]});})[_0xc009('0x20')](handleEntityNotFound(_0x4c1412,null))[_0xc009('0x20')](function(_0x556f31){if(_0x556f31){var _0xebe73a=_0x556f31[_0xc009('0x5d')]&&fs[_0xc009('0x61')](path[_0xc009('0x63')](config[_0xc009('0x64')],_0x318ee5,_[_0xc009('0x62')](_0x556f31['preferred'])))?path[_0xc009('0x63')](config[_0xc009('0x64')],_0x318ee5,_[_0xc009('0x62')](_0x556f31[_0xc009('0x5d')])):path[_0xc009('0x63')](config[_0xc009('0x64')],_0x318ee5,_['toLower'](_0xc009('0x74')));var _0x35d5ef=_0xc009('0x66')+_[_0xc009('0x67')]('preferred');if(_0x556f31[_0x35d5ef]||!_0x35072e[_0xc009('0x68')]||!_0x35072e['preferred']){_0xebe73a=path[_0xc009('0x63')](config[_0xc009('0x64')],_0x318ee5,_[_0xc009('0x62')](_0xc009('0x74')));}if(!fs['existsSync'](_0xebe73a)){throw new db[(_0xc009('0x69'))]['ValidationError'](_['upperFirst'](_0xc009('0x5d'))+_0xc009('0x6a'));}return _0x4c1412[_0xc009('0x70')](_0xebe73a);}})[_0xc009('0x52')](handleError(_0x4c1412,null));};exports[_0xc009('0x75')]=function(_0x26ff9c,_0x3a185f,_0x296712){if(_0x26ff9c[_0xc009('0x56')]&&_0x26ff9c[_0xc009('0x56')][_0xc009('0x57')]){_0x26ff9c[_0xc009('0x53')][_0xc009('0x5e')]=_0x26ff9c[_0xc009('0x56')][_0xc009('0x57')];}return db['Setting'][_0xc009('0x54')]({'where':{'id':_0x26ff9c[_0xc009('0x51')]['id']}})[_0xc009('0x20')](handleEntityNotFound(_0x3a185f,null))[_0xc009('0x20')](saveUpdates(_0x26ff9c[_0xc009('0x53')],null))[_0xc009('0x20')](respondWithResult(_0x3a185f,null))['catch'](handleError(_0x3a185f,null));};var utilLicense=require('../../config/license/util');exports[_0xc009('0x76')]=function(_0x3cb578,_0x9057ef,_0x421ab9){var _0x5017d3=_0xc009('0x6c');var _0x191b3b={'custom':![]};return utilLicense[_0xc009('0x5b')]()[_0xc009('0x20')](function(_0x515e2d){if(_0x515e2d){_0x191b3b=_0x515e2d;}return db['Setting']['find']({'where':{'id':_0x3cb578[_0xc009('0x51')]['id']},'attributes':['logo',_0xc009('0x5c'),'preferred',_0xc009('0x5e'),_0xc009('0x6d'),_0xc009('0x5f'),_0xc009('0x6e'),_0xc009('0x60')],'raw':!![]});})[_0xc009('0x20')](handleEntityNotFound(_0x9057ef,null))[_0xc009('0x20')](function(_0x44421){if(_0x44421){var _0x590099=_0x44421[_0xc009('0x5e')]&&fs[_0xc009('0x61')](path[_0xc009('0x63')](config[_0xc009('0x64')],_0x5017d3,_[_0xc009('0x62')](_0x44421['favicon'])))?path[_0xc009('0x63')](config[_0xc009('0x64')],_0x5017d3,_[_0xc009('0x62')](_0x44421[_0xc009('0x5e')])):path[_0xc009('0x63')](config[_0xc009('0x64')],_0x5017d3,_[_0xc009('0x62')](_0xc009('0x77')));var _0x1ddb9f=_0xc009('0x66')+_[_0xc009('0x67')](_0xc009('0x5e'));if(_0x44421[_0x1ddb9f]||!_0x191b3b[_0xc009('0x68')]){_0x590099=path[_0xc009('0x63')](config[_0xc009('0x64')],_0x5017d3,_[_0xc009('0x62')]('default_favicon.ico'));}if(!fs[_0xc009('0x61')](_0x590099)){throw new db[(_0xc009('0x69'))][(_0xc009('0x1d'))](_[_0xc009('0x67')]('favicon')+_0xc009('0x6a'));}return _0x9057ef['download'](_0x590099);}})[_0xc009('0x52')](handleError(_0x9057ef,null));}; \ No newline at end of file +var _0xd3b1=['getLicense','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','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~!@#$%^&-_=+[{]}.','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Setting','includeAll','show','params','include','find','body','addLogo','file','filename','../../config/license/util','getLogo','server/files/images/logos','logo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','custom','default_logo.png','\x20not\x20found','download','getLogoLogin','loginLogo','favicon','default_loginLogo.png','upperFirst','addPreferred','getPreferred','default_preferred.png','default','addFavicon','getFavicon'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd3b1,0x7c));var _0x1d3b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd3b1[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x1d3b('0x0'));var emlformat=require(_0x1d3b('0x1'));var rimraf=require(_0x1d3b('0x2'));var zipdir=require(_0x1d3b('0x3'));var jsonpatch=require(_0x1d3b('0x4'));var rp=require('request-promise');var moment=require(_0x1d3b('0x5'));var BPromise=require(_0x1d3b('0x6'));var Mustache=require(_0x1d3b('0x7'));var util=require(_0x1d3b('0x8'));var path=require(_0x1d3b('0x9'));var sox=require(_0x1d3b('0xa'));var csv=require('to-csv');var ejs=require(_0x1d3b('0xb'));var fs=require('fs');var _=require(_0x1d3b('0xc'));var squel=require(_0x1d3b('0xd'));var crypto=require('crypto');var jsforce=require(_0x1d3b('0xe'));var deskjs=require(_0x1d3b('0xf'));var toCsv=require(_0x1d3b('0x10'));var querystring=require('querystring');var Papa=require(_0x1d3b('0x11'));var Redis=require(_0x1d3b('0x12'));var authService=require(_0x1d3b('0x13'));var qs=require(_0x1d3b('0x14'));var as=require(_0x1d3b('0x15'));var hardwareService=require(_0x1d3b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1d3b('0x17'));var config=require(_0x1d3b('0x18'));var db=require(_0x1d3b('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x1d3b('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x11c1b1,_0x52cbb9,_0x1e4b5c){if(_0x1e4b5c){var _0x58d226=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58d226[_0x1d3b('0x1b')](_0x52cbb9)){return _0x11c1b1;}else{throw new db[(_0x1d3b('0x1c'))][(_0x1d3b('0x1d'))](_0x1d3b('0x1e'));}}else{return _0x11c1b1;}}function respondWithRpcPromise(_0xbd079f,_0x5d9946,_0x21918b,_0x27defa){return new BPromise(function(_0x300314,_0x185e3a){var _0x192d84=_0x27defa||client;return _0x192d84['request'](_0xbd079f,_0x21918b)[_0x1d3b('0x1f')](function(_0x43f186){logger[_0x1d3b('0x20')](_0x1d3b('0x21'),_0x5d9946,_0x1d3b('0x22'));logger[_0x1d3b('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x5d9946,_0x1d3b('0x22'),JSON[_0x1d3b('0x24')](_0x43f186));if(_0x43f186[_0x1d3b('0x25')]){if(_0x43f186[_0x1d3b('0x25')][_0x1d3b('0x26')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x5d9946,_0x43f186['error'][_0x1d3b('0x27')]);return _0x185e3a(_0x43f186[_0x1d3b('0x25')]['message']);}logger[_0x1d3b('0x25')](_0x1d3b('0x21'),_0x5d9946,_0x43f186[_0x1d3b('0x25')][_0x1d3b('0x27')]);return _0x300314(_0x43f186[_0x1d3b('0x25')]['message']);}else{logger[_0x1d3b('0x20')](_0x1d3b('0x21'),_0x5d9946,_0x1d3b('0x22'));_0x300314(_0x43f186[_0x1d3b('0x28')][_0x1d3b('0x27')]);}})[_0x1d3b('0x29')](function(_0x5a7474){logger[_0x1d3b('0x25')](_0x1d3b('0x21'),_0x5d9946,_0x5a7474);_0x185e3a(_0x5a7474);});});}function respondWithStatusCode(_0x21e80c,_0x2239e3){_0x2239e3=_0x2239e3||0xcc;return function(_0x490e45){if(_0x490e45){return _0x21e80c[_0x1d3b('0x2a')](_0x2239e3);}return _0x21e80c['status'](_0x2239e3)[_0x1d3b('0x2b')]();};}function respondWithResult(_0x1e8e32,_0x27d0a1){_0x27d0a1=_0x27d0a1||0xc8;return function(_0x1dd3db){if(_0x1dd3db){return _0x1e8e32['status'](_0x27d0a1)[_0x1d3b('0x2c')](_0x1dd3db);}};}function respondWithFilteredResult(_0x45c2f2,_0x4cda53){return function(_0x3b0bed){if(_0x3b0bed){var _0x215932=_0x3b0bed[_0x1d3b('0x2d')],_0x1b2e4d=_0x4cda53[_0x1d3b('0x2e')],_0x1e8215=_0x4cda53['offset']+_0x4cda53[_0x1d3b('0x2f')],_0x54c26f;if(_0x1e8215>=_0x215932){_0x1e8215=_0x215932;_0x54c26f=0xc8;}else{_0x54c26f=0xce;}_0x45c2f2[_0x1d3b('0x30')](_0x54c26f);return _0x45c2f2['set'](_0x1d3b('0x31'),_0x1b2e4d+'-'+_0x1e8215+'/'+_0x215932)[_0x1d3b('0x2c')](_0x3b0bed);}return null;};}function patchUpdates(_0x65d2f7){return function(_0x8537c){try{jsonpatch[_0x1d3b('0x32')](_0x8537c,_0x65d2f7,!![]);}catch(_0x5e45cc){return BPromise[_0x1d3b('0x33')](_0x5e45cc);}return _0x8537c[_0x1d3b('0x34')]();};}function saveUpdates(_0x3c01a3,_0x2a673f){return function(_0x2aaee6){if(_0x2aaee6){return _0x2aaee6[_0x1d3b('0x35')](_0x3c01a3)[_0x1d3b('0x1f')](function(_0x1838d5){return _0x1838d5;});}return null;};}function removeEntity(_0xb35aca,_0x1cac1c){return function(_0x2f3a28){if(_0x2f3a28){return _0x2f3a28[_0x1d3b('0x36')]()[_0x1d3b('0x1f')](function(){_0xb35aca[_0x1d3b('0x30')](0xcc)[_0x1d3b('0x2b')]();});}};}function handleEntityNotFound(_0x553233,_0xd7983a){return function(_0x2d9d3b){if(!_0x2d9d3b){_0x553233[_0x1d3b('0x2a')](0x194);}return _0x2d9d3b;};}function handleError(_0x46267a,_0x37d043){_0x37d043=_0x37d043||0x1f4;return function(_0x47a393){logger[_0x1d3b('0x25')](_0x47a393[_0x1d3b('0x37')]);if(_0x47a393[_0x1d3b('0x38')]){delete _0x47a393[_0x1d3b('0x38')];}_0x46267a[_0x1d3b('0x30')](_0x37d043)[_0x1d3b('0x39')](_0x47a393);};}exports[_0x1d3b('0x3a')]=function(_0x7ffb26,_0x5d0b51){var _0x1c0c23={},_0x285e67={},_0x5714ea={'count':0x0,'rows':[]};var _0x20fe13=_[_0x1d3b('0x3b')](db['Setting'][_0x1d3b('0x3c')],function(_0xf9b5a2){return{'name':_0xf9b5a2[_0x1d3b('0x3d')],'type':_0xf9b5a2[_0x1d3b('0x3e')][_0x1d3b('0x3f')]};});_0x285e67[_0x1d3b('0x40')]=_[_0x1d3b('0x3b')](_0x20fe13,'name');_0x285e67['query']=_[_0x1d3b('0x41')](_0x7ffb26['query']);_0x285e67[_0x1d3b('0x42')]=_['intersection'](_0x285e67[_0x1d3b('0x40')],_0x285e67[_0x1d3b('0x43')]);_0x1c0c23[_0x1d3b('0x44')]=_[_0x1d3b('0x45')](_0x285e67[_0x1d3b('0x40')],qs[_0x1d3b('0x46')](_0x7ffb26[_0x1d3b('0x43')][_0x1d3b('0x46')]));_0x1c0c23['attributes']=_0x1c0c23[_0x1d3b('0x44')][_0x1d3b('0x47')]?_0x1c0c23[_0x1d3b('0x44')]:_0x285e67['model'];if(!_0x7ffb26[_0x1d3b('0x43')][_0x1d3b('0x48')](_0x1d3b('0x49'))){_0x1c0c23[_0x1d3b('0x2f')]=qs[_0x1d3b('0x2f')](_0x7ffb26[_0x1d3b('0x43')][_0x1d3b('0x2f')]);_0x1c0c23[_0x1d3b('0x2e')]=qs[_0x1d3b('0x2e')](_0x7ffb26['query'][_0x1d3b('0x2e')]);}_0x1c0c23[_0x1d3b('0x4a')]=qs[_0x1d3b('0x4b')](_0x7ffb26[_0x1d3b('0x43')]['sort']);_0x1c0c23[_0x1d3b('0x4c')]=qs[_0x1d3b('0x42')](_[_0x1d3b('0x4d')](_0x7ffb26[_0x1d3b('0x43')],_0x285e67[_0x1d3b('0x42')]),_0x20fe13);if(_0x7ffb26[_0x1d3b('0x43')][_0x1d3b('0x4e')]){_0x1c0c23[_0x1d3b('0x4c')]=_['merge'](_0x1c0c23[_0x1d3b('0x4c')],{'$or':_[_0x1d3b('0x3b')](_0x20fe13,function(_0x113b86){if(_0x113b86[_0x1d3b('0x3e')]!==_0x1d3b('0x4f')){var _0x416d6f={};_0x416d6f[_0x113b86[_0x1d3b('0x38')]]={'$like':'%'+_0x7ffb26[_0x1d3b('0x43')][_0x1d3b('0x4e')]+'%'};return _0x416d6f;}})});}_0x1c0c23=_[_0x1d3b('0x50')]({},_0x1c0c23,_0x7ffb26[_0x1d3b('0x51')]);var _0x2601f5={'where':_0x1c0c23[_0x1d3b('0x4c')]};return db[_0x1d3b('0x52')][_0x1d3b('0x2d')](_0x2601f5)[_0x1d3b('0x1f')](function(_0x12782a){_0x5714ea[_0x1d3b('0x2d')]=_0x12782a;if(_0x7ffb26[_0x1d3b('0x43')][_0x1d3b('0x53')]){_0x1c0c23['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x1c0c23);})['then'](function(_0x1ecd50){_0x5714ea['rows']=_0x1ecd50;return _0x5714ea;})['then'](respondWithFilteredResult(_0x5d0b51,_0x1c0c23))[_0x1d3b('0x29')](handleError(_0x5d0b51,null));};exports[_0x1d3b('0x54')]=function(_0x1b5dd7,_0x4b3799){var _0x4b7ffb={'raw':![],'where':{'id':_0x1b5dd7[_0x1d3b('0x55')]['id']}},_0x403edb={};_0x403edb[_0x1d3b('0x40')]=_[_0x1d3b('0x41')](db[_0x1d3b('0x52')][_0x1d3b('0x3c')]);_0x403edb['query']=_[_0x1d3b('0x41')](_0x1b5dd7[_0x1d3b('0x43')]);_0x403edb[_0x1d3b('0x42')]=_['intersection'](_0x403edb[_0x1d3b('0x40')],_0x403edb[_0x1d3b('0x43')]);_0x4b7ffb[_0x1d3b('0x44')]=_[_0x1d3b('0x45')](_0x403edb[_0x1d3b('0x40')],qs['fields'](_0x1b5dd7[_0x1d3b('0x43')][_0x1d3b('0x46')]));_0x4b7ffb[_0x1d3b('0x44')]=_0x4b7ffb['attributes'][_0x1d3b('0x47')]?_0x4b7ffb[_0x1d3b('0x44')]:_0x403edb[_0x1d3b('0x40')];if(_0x1b5dd7['query'][_0x1d3b('0x53')]){_0x4b7ffb[_0x1d3b('0x56')]=[{'all':!![]}];}_0x4b7ffb=_[_0x1d3b('0x50')]({},_0x4b7ffb,_0x1b5dd7[_0x1d3b('0x51')]);return db['Setting'][_0x1d3b('0x57')](_0x4b7ffb)['then'](handleEntityNotFound(_0x4b3799,null))[_0x1d3b('0x1f')](respondWithResult(_0x4b3799,null))[_0x1d3b('0x29')](handleError(_0x4b3799,null));};exports[_0x1d3b('0x35')]=function(_0x4580ca,_0x950257){if(_0x4580ca['body']['id']){delete _0x4580ca[_0x1d3b('0x58')]['id'];}return db[_0x1d3b('0x52')][_0x1d3b('0x57')]({'where':{'id':_0x4580ca[_0x1d3b('0x55')]['id']}})[_0x1d3b('0x1f')](handleEntityNotFound(_0x950257,null))[_0x1d3b('0x1f')](saveUpdates(_0x4580ca[_0x1d3b('0x58')],null))[_0x1d3b('0x1f')](respondWithResult(_0x950257,null))['catch'](handleError(_0x950257,null));};exports[_0x1d3b('0x59')]=function(_0x912311,_0x1d9890,_0x2c9e43){if(_0x912311[_0x1d3b('0x5a')]&&_0x912311[_0x1d3b('0x5a')][_0x1d3b('0x5b')]){_0x912311[_0x1d3b('0x58')]['logo']=_0x912311[_0x1d3b('0x5a')]['filename'];}return db[_0x1d3b('0x52')][_0x1d3b('0x57')]({'where':{'id':_0x912311[_0x1d3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x1d9890,null))['then'](saveUpdates(_0x912311[_0x1d3b('0x58')],null))['then'](respondWithResult(_0x1d9890,null))[_0x1d3b('0x29')](handleError(_0x1d9890,null));};exports['addLogoLogin']=function(_0x2b8ce2,_0x418400,_0x3acb30){if(_0x2b8ce2[_0x1d3b('0x5a')]&&_0x2b8ce2[_0x1d3b('0x5a')][_0x1d3b('0x5b')]){_0x2b8ce2['body']['loginLogo']=_0x2b8ce2[_0x1d3b('0x5a')][_0x1d3b('0x5b')];}return db['Setting'][_0x1d3b('0x57')]({'where':{'id':_0x2b8ce2[_0x1d3b('0x55')]['id']}})[_0x1d3b('0x1f')](handleEntityNotFound(_0x418400,null))['then'](saveUpdates(_0x2b8ce2[_0x1d3b('0x58')],null))[_0x1d3b('0x1f')](respondWithResult(_0x418400,null))[_0x1d3b('0x29')](handleError(_0x418400,null));};var utilLicense=require(_0x1d3b('0x5c'));exports[_0x1d3b('0x5d')]=function(_0x28cfaf,_0x365008,_0x23471d){var _0x3fb9a4=_0x1d3b('0x5e');var _0x4f6da6={'custom':![]};return utilLicense['getLicense']()[_0x1d3b('0x1f')](function(_0x596ed6){if(_0x596ed6){_0x4f6da6=_0x596ed6;}return db[_0x1d3b('0x52')]['find']({'where':{'id':_0x28cfaf[_0x1d3b('0x55')]['id']},'attributes':[_0x1d3b('0x5f'),'loginLogo',_0x1d3b('0x60'),'favicon',_0x1d3b('0x61'),_0x1d3b('0x62'),_0x1d3b('0x63'),_0x1d3b('0x64')],'raw':!![]});})[_0x1d3b('0x1f')](handleEntityNotFound(_0x365008,null))['then'](function(_0x180e6c){if(_0x180e6c){var _0x41dae2=_0x180e6c[_0x1d3b('0x5f')]&&fs[_0x1d3b('0x65')](path[_0x1d3b('0x66')](config[_0x1d3b('0x67')],_0x3fb9a4,_['toLower'](_0x180e6c[_0x1d3b('0x5f')])))?path[_0x1d3b('0x66')](config[_0x1d3b('0x67')],_0x3fb9a4,_[_0x1d3b('0x68')](_0x180e6c['logo'])):path['join'](config[_0x1d3b('0x67')],_0x3fb9a4,_[_0x1d3b('0x68')]('default_logo.png'));var _0x287178='default'+_['upperFirst'](_0x1d3b('0x5f'));if(_0x180e6c[_0x287178]||!_0x4f6da6[_0x1d3b('0x69')]){_0x41dae2=path[_0x1d3b('0x66')](config[_0x1d3b('0x67')],_0x3fb9a4,_[_0x1d3b('0x68')](_0x1d3b('0x6a')));}if(!fs['existsSync'](_0x41dae2)){throw new db[(_0x1d3b('0x1c'))][(_0x1d3b('0x1d'))](_['upperFirst'](_0x1d3b('0x5f'))+_0x1d3b('0x6b'));}return _0x365008[_0x1d3b('0x6c')](_0x41dae2);}})[_0x1d3b('0x29')](handleError(_0x365008,null));};var utilLicense=require(_0x1d3b('0x5c'));exports[_0x1d3b('0x6d')]=function(_0x7b0c2,_0x34ec5f,_0x29145b){var _0x2b6998=_0x1d3b('0x5e');var _0x4a3b5b={'custom':![]};return utilLicense['getLicense']()[_0x1d3b('0x1f')](function(_0x36fd61){if(_0x36fd61){_0x4a3b5b=_0x36fd61;}return db[_0x1d3b('0x52')]['find']({'where':{'id':_0x7b0c2[_0x1d3b('0x55')]['id']},'attributes':[_0x1d3b('0x5f'),_0x1d3b('0x6e'),_0x1d3b('0x60'),_0x1d3b('0x6f'),_0x1d3b('0x61'),_0x1d3b('0x62'),_0x1d3b('0x63'),'defaultFavicon'],'raw':!![]});})[_0x1d3b('0x1f')](handleEntityNotFound(_0x34ec5f,null))[_0x1d3b('0x1f')](function(_0xbee968){if(_0xbee968){var _0x41d081=_0xbee968[_0x1d3b('0x6e')]&&fs['existsSync'](path['join'](config['root'],_0x2b6998,_['toLower'](_0xbee968[_0x1d3b('0x6e')])))?path['join'](config[_0x1d3b('0x67')],_0x2b6998,_[_0x1d3b('0x68')](_0xbee968[_0x1d3b('0x6e')])):path['join'](config['root'],_0x2b6998,_['toLower']('default_loginLogo.png'));var _0x45dbdc='default'+_['upperFirst'](_0x1d3b('0x6e'));if(_0xbee968[_0x45dbdc]||!_0x4a3b5b[_0x1d3b('0x69')]){_0x41d081=path['join'](config['root'],_0x2b6998,_[_0x1d3b('0x68')](_0x1d3b('0x70')));}if(!fs[_0x1d3b('0x65')](_0x41d081)){throw new db[(_0x1d3b('0x1c'))][(_0x1d3b('0x1d'))](_[_0x1d3b('0x71')]('loginLogo')+'\x20not\x20found');}return _0x34ec5f[_0x1d3b('0x6c')](_0x41d081);}})[_0x1d3b('0x29')](handleError(_0x34ec5f,null));};exports['gdpr']=function(_0x48cbf3,_0x4f79c8){return db['Setting'][_0x1d3b('0x57')]({'where':{'id':_0x48cbf3['params']['id']},'attributes':['securePassword']})[_0x1d3b('0x1f')](respondWithResult(_0x4f79c8,null))[_0x1d3b('0x29')](handleError(_0x4f79c8,null));};exports[_0x1d3b('0x72')]=function(_0x1c5678,_0x3ccdce,_0x95fbe3){if(_0x1c5678['file']&&_0x1c5678[_0x1d3b('0x5a')][_0x1d3b('0x5b')]){_0x1c5678[_0x1d3b('0x58')]['preferred']=_0x1c5678[_0x1d3b('0x5a')]['filename'];}return db['Setting'][_0x1d3b('0x57')]({'where':{'id':_0x1c5678[_0x1d3b('0x55')]['id']}})[_0x1d3b('0x1f')](handleEntityNotFound(_0x3ccdce,null))[_0x1d3b('0x1f')](saveUpdates(_0x1c5678['body'],null))[_0x1d3b('0x1f')](respondWithResult(_0x3ccdce,null))[_0x1d3b('0x29')](handleError(_0x3ccdce,null));};var utilLicense=require(_0x1d3b('0x5c'));exports[_0x1d3b('0x73')]=function(_0x3149d7,_0x407dfd,_0x38c04e){var _0x565570=_0x1d3b('0x5e');var _0x452cd6={'custom':![]};return utilLicense['getLicense']()[_0x1d3b('0x1f')](function(_0x58c36b){if(_0x58c36b){_0x452cd6=_0x58c36b;}return db['Setting'][_0x1d3b('0x57')]({'where':{'id':_0x3149d7[_0x1d3b('0x55')]['id']},'attributes':['logo',_0x1d3b('0x6e'),_0x1d3b('0x60'),_0x1d3b('0x6f'),_0x1d3b('0x61'),'defaultLoginLogo',_0x1d3b('0x63'),'defaultFavicon'],'raw':!![]});})[_0x1d3b('0x1f')](handleEntityNotFound(_0x407dfd,null))[_0x1d3b('0x1f')](function(_0xfba392){if(_0xfba392){var _0x20161a=_0xfba392[_0x1d3b('0x60')]&&fs[_0x1d3b('0x65')](path[_0x1d3b('0x66')](config['root'],_0x565570,_[_0x1d3b('0x68')](_0xfba392[_0x1d3b('0x60')])))?path['join'](config['root'],_0x565570,_['toLower'](_0xfba392[_0x1d3b('0x60')])):path[_0x1d3b('0x66')](config[_0x1d3b('0x67')],_0x565570,_['toLower'](_0x1d3b('0x74')));var _0x2325bc=_0x1d3b('0x75')+_[_0x1d3b('0x71')](_0x1d3b('0x60'));if(_0xfba392[_0x2325bc]||!_0x452cd6['custom']||!_0x452cd6[_0x1d3b('0x60')]){_0x20161a=path['join'](config['root'],_0x565570,_['toLower'](_0x1d3b('0x74')));}if(!fs['existsSync'](_0x20161a)){throw new db['Sequelize'][(_0x1d3b('0x1d'))](_['upperFirst']('preferred')+_0x1d3b('0x6b'));}return _0x407dfd[_0x1d3b('0x6c')](_0x20161a);}})[_0x1d3b('0x29')](handleError(_0x407dfd,null));};exports[_0x1d3b('0x76')]=function(_0x15a626,_0x5e9e82,_0x184cd6){if(_0x15a626[_0x1d3b('0x5a')]&&_0x15a626['file'][_0x1d3b('0x5b')]){_0x15a626['body'][_0x1d3b('0x6f')]=_0x15a626[_0x1d3b('0x5a')][_0x1d3b('0x5b')];}return db[_0x1d3b('0x52')][_0x1d3b('0x57')]({'where':{'id':_0x15a626['params']['id']}})[_0x1d3b('0x1f')](handleEntityNotFound(_0x5e9e82,null))[_0x1d3b('0x1f')](saveUpdates(_0x15a626['body'],null))['then'](respondWithResult(_0x5e9e82,null))[_0x1d3b('0x29')](handleError(_0x5e9e82,null));};var utilLicense=require('../../config/license/util');exports[_0x1d3b('0x77')]=function(_0x4a2ec4,_0x44ed82,_0x4ca178){var _0x3ea3e=_0x1d3b('0x5e');var _0x373c1f={'custom':![]};return utilLicense[_0x1d3b('0x78')]()[_0x1d3b('0x1f')](function(_0x47d800){if(_0x47d800){_0x373c1f=_0x47d800;}return db[_0x1d3b('0x52')][_0x1d3b('0x57')]({'where':{'id':_0x4a2ec4[_0x1d3b('0x55')]['id']},'attributes':[_0x1d3b('0x5f'),'loginLogo','preferred','favicon',_0x1d3b('0x61'),'defaultLoginLogo','defaultPreferred',_0x1d3b('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x44ed82,null))[_0x1d3b('0x1f')](function(_0x2903a2){if(_0x2903a2){var _0x418693=_0x2903a2['favicon']&&fs[_0x1d3b('0x65')](path[_0x1d3b('0x66')](config[_0x1d3b('0x67')],_0x3ea3e,_['toLower'](_0x2903a2[_0x1d3b('0x6f')])))?path[_0x1d3b('0x66')](config[_0x1d3b('0x67')],_0x3ea3e,_[_0x1d3b('0x68')](_0x2903a2[_0x1d3b('0x6f')])):path['join'](config[_0x1d3b('0x67')],_0x3ea3e,_['toLower'](_0x1d3b('0x79')));var _0xbe9397=_0x1d3b('0x75')+_[_0x1d3b('0x71')]('favicon');if(_0x2903a2[_0xbe9397]||!_0x373c1f[_0x1d3b('0x69')]){_0x418693=path['join'](config[_0x1d3b('0x67')],_0x3ea3e,_[_0x1d3b('0x68')](_0x1d3b('0x79')));}if(!fs[_0x1d3b('0x65')](_0x418693)){throw new db['Sequelize'][(_0x1d3b('0x1d'))](_[_0x1d3b('0x71')](_0x1d3b('0x6f'))+'\x20not\x20found');}return _0x44ed82[_0x1d3b('0x6c')](_0x418693);}})[_0x1d3b('0x29')](handleError(_0x44ed82,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e9509ba..e3eb591 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 _0x22ea=['./setting.attributes','exports','define','Setting','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1e4e05,_0x32a92f){var _0x4d5f25=function(_0x45d154){while(--_0x45d154){_0x1e4e05['push'](_0x1e4e05['shift']());}};_0x4d5f25(++_0x32a92f);}(_0x22ea,0x117));var _0xa22e=function(_0x3218e9,_0x4f829f){_0x3218e9=_0x3218e9-0x0;var _0x5566a7=_0x22ea[_0x3218e9];return _0x5566a7;};'use strict';var _=require('lodash');var util=require(_0xa22e('0x0'));var logger=require(_0xa22e('0x1'))(_0xa22e('0x2'));var moment=require(_0xa22e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa22e('0x4'));var fs=require('fs');var path=require(_0xa22e('0x5'));var rimraf=require(_0xa22e('0x6'));var config=require('../../config/environment');var attributes=require(_0xa22e('0x7'));module[_0xa22e('0x8')]=function(_0x353005,_0x211b56){return _0x353005[_0xa22e('0x9')](_0xa22e('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7432=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x1e41b4,_0x4d5547){var _0x154e30=function(_0x2d6398){while(--_0x2d6398){_0x1e41b4['push'](_0x1e41b4['shift']());}};_0x154e30(++_0x4d5547);}(_0x7432,0x1cf));var _0x2743=function(_0x18dce7,_0x36c9c){_0x18dce7=_0x18dce7-0x0;var _0x4dbab6=_0x7432[_0x18dce7];return _0x4dbab6;};'use strict';var _=require(_0x2743('0x0'));var util=require(_0x2743('0x1'));var logger=require(_0x2743('0x2'))(_0x2743('0x3'));var moment=require('moment');var BPromise=require(_0x2743('0x4'));var rp=require(_0x2743('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2743('0x6'));var attributes=require(_0x2743('0x7'));module[_0x2743('0x8')]=function(_0x5272be,_0x138e2c){return _0x5272be['define'](_0x2743('0x9'),attributes,{'tableName':_0x2743('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 8524e9b..1e00bef 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 _0xa72c=['Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x33316e,_0x5aae69){var _0x584ea5=function(_0x37ccb4){while(--_0x37ccb4){_0x33316e['push'](_0x33316e['shift']());}};_0x584ea5(++_0x5aae69);}(_0xa72c,0x138));var _0xca72=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xa72c[_0x243217];return _0x478029;};'use strict';var _=require(_0xca72('0x0'));var util=require('util');var moment=require(_0xca72('0x1'));var BPromise=require(_0xca72('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca72('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca72('0x4'))('rpc');var config=require(_0xca72('0x5'));var jayson=require(_0xca72('0x6'));var client=jayson[_0xca72('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a181e,_0x4f7b7d,_0x21c968){return new BPromise(function(_0x305973,_0x29d624){return client['request'](_0x3a181e,_0x21c968)['then'](function(_0x467f42){logger['info'](_0xca72('0x8'),_0x4f7b7d,_0xca72('0x9'));logger[_0xca72('0xa')](_0xca72('0xb'),_0x4f7b7d,_0xca72('0x9'),JSON['stringify'](_0x467f42));if(_0x467f42[_0xca72('0xc')]){if(_0x467f42[_0xca72('0xc')][_0xca72('0xd')]===0x1f4){logger[_0xca72('0xc')](_0xca72('0x8'),_0x4f7b7d,_0x467f42[_0xca72('0xc')][_0xca72('0xe')]);return _0x29d624(_0x467f42[_0xca72('0xc')][_0xca72('0xe')]);}logger['error']('Setting,\x20%s,\x20%s',_0x4f7b7d,_0x467f42[_0xca72('0xc')][_0xca72('0xe')]);return _0x305973(_0x467f42[_0xca72('0xc')]['message']);}else{logger[_0xca72('0xf')](_0xca72('0x8'),_0x4f7b7d,'request\x20sent');_0x305973(_0x467f42['result'][_0xca72('0xe')]);}})[_0xca72('0x10')](function(_0x437f15){logger['error'](_0xca72('0x8'),_0x4f7b7d,_0x437f15);_0x29d624(_0x437f15);});});} \ No newline at end of file +var _0xd386=['request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','Setting,\x20%s,\x20%s','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2a7580,_0x2103d3){var _0x3477fc=function(_0x582e56){while(--_0x582e56){_0x2a7580['push'](_0x2a7580['shift']());}};_0x3477fc(++_0x2103d3);}(_0xd386,0x146));var _0x6d38=function(_0x464d1b,_0x4d4525){_0x464d1b=_0x464d1b-0x0;var _0x1b21c0=_0xd386[_0x464d1b];return _0x1b21c0;};'use strict';var _=require('lodash');var util=require(_0x6d38('0x0'));var moment=require(_0x6d38('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d38('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d38('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d38('0x4'))(_0x6d38('0x5'));var config=require(_0x6d38('0x6'));var jayson=require(_0x6d38('0x7'));var client=jayson[_0x6d38('0x8')][_0x6d38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x589495,_0x231718,_0x3cbc8c){return new BPromise(function(_0x5cf74c,_0x40d182){return client[_0x6d38('0xa')](_0x589495,_0x3cbc8c)[_0x6d38('0xb')](function(_0x53301f){logger['info']('Setting,\x20%s,\x20%s',_0x231718,_0x6d38('0xc'));logger[_0x6d38('0xd')](_0x6d38('0xe'),_0x231718,_0x6d38('0xc'),JSON['stringify'](_0x53301f));if(_0x53301f[_0x6d38('0xf')]){if(_0x53301f['error'][_0x6d38('0x10')]===0x1f4){logger[_0x6d38('0xf')]('Setting,\x20%s,\x20%s',_0x231718,_0x53301f[_0x6d38('0xf')][_0x6d38('0x11')]);return _0x40d182(_0x53301f[_0x6d38('0xf')]['message']);}logger[_0x6d38('0xf')](_0x6d38('0x12'),_0x231718,_0x53301f[_0x6d38('0xf')][_0x6d38('0x11')]);return _0x5cf74c(_0x53301f[_0x6d38('0xf')]['message']);}else{logger['info'](_0x6d38('0x12'),_0x231718,_0x6d38('0xc'));_0x5cf74c(_0x53301f[_0x6d38('0x13')][_0x6d38('0x11')]);}})[_0x6d38('0x14')](function(_0x17baa9){logger[_0x6d38('0xf')](_0x6d38('0x12'),_0x231718,_0x17baa9);_0x40d182(_0x17baa9);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index ca9bad5..eeb5be8 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 _0xb2e6=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','addAgents','put','delete','destroy','exports','multer','util'];(function(_0x4d7e99,_0x41472d){var _0x37411c=function(_0x14afe4){while(--_0x14afe4){_0x4d7e99['push'](_0x4d7e99['shift']());}};_0x37411c(++_0x41472d);}(_0xb2e6,0x1c6));var _0x6b2e=function(_0x1d1881,_0x4528cf){_0x1d1881=_0x1d1881-0x0;var _0x20b5d8=_0xb2e6[_0x1d1881];return _0x20b5d8;};'use strict';var multer=require(_0x6b2e('0x0'));var util=require(_0x6b2e('0x1'));var path=require(_0x6b2e('0x2'));var timeout=require(_0x6b2e('0x3'));var express=require('express');var router=express[_0x6b2e('0x4')]();var auth=require(_0x6b2e('0x5'));var interaction=require(_0x6b2e('0x6'));var config=require('../../config/environment');var controller=require(_0x6b2e('0x7'));router[_0x6b2e('0x8')]('/',auth[_0x6b2e('0x9')](),controller[_0x6b2e('0xa')]);router[_0x6b2e('0x8')](_0x6b2e('0xb'),auth[_0x6b2e('0x9')](),controller['describe']);router[_0x6b2e('0x8')](_0x6b2e('0xc'),auth[_0x6b2e('0x9')](),controller[_0x6b2e('0xd')]);router[_0x6b2e('0x8')](_0x6b2e('0xe'),auth[_0x6b2e('0x9')](),controller[_0x6b2e('0xf')]);router[_0x6b2e('0x8')](_0x6b2e('0x10'),auth['isAuthenticated'](),controller[_0x6b2e('0x11')]);router['get']('/:id/applications',auth[_0x6b2e('0x9')](),controller[_0x6b2e('0x12')]);router['get'](_0x6b2e('0x13'),auth[_0x6b2e('0x9')](),controller[_0x6b2e('0x14')]);router[_0x6b2e('0x8')](_0x6b2e('0x15'),controller[_0x6b2e('0x16')]);router[_0x6b2e('0x8')](_0x6b2e('0x17'),auth[_0x6b2e('0x9')](),controller['getAgents']);router[_0x6b2e('0x18')]('/',auth[_0x6b2e('0x9')](),controller['create']);router['post'](_0x6b2e('0xe'),auth[_0x6b2e('0x9')](),controller[_0x6b2e('0x19')]);router['post'](_0x6b2e('0x10'),auth[_0x6b2e('0x9')](),controller[_0x6b2e('0x1a')]);router[_0x6b2e('0x18')](_0x6b2e('0x1b'),controller[_0x6b2e('0x1c')]);router['post'](_0x6b2e('0x1d'),auth[_0x6b2e('0x9')](),controller[_0x6b2e('0x1e')]);router['post'](_0x6b2e('0x1f'),auth[_0x6b2e('0x9')](),controller[_0x6b2e('0x20')]);router['post'](_0x6b2e('0x15'),controller['status']);router[_0x6b2e('0x18')](_0x6b2e('0x17'),auth[_0x6b2e('0x9')](),controller[_0x6b2e('0x21')]);router[_0x6b2e('0x22')](_0x6b2e('0xc'),auth[_0x6b2e('0x9')](),controller['update']);router[_0x6b2e('0x23')](_0x6b2e('0xc'),auth['isAuthenticated'](),controller[_0x6b2e('0x24')]);router[_0x6b2e('0x23')]('/:id/dispositions',auth[_0x6b2e('0x9')](),controller['removeDispositions']);router[_0x6b2e('0x23')](_0x6b2e('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x6b2e('0x9')](),controller['removeAgents']);module[_0x6b2e('0x25')]=router; \ No newline at end of file +var _0x025f=['send','addAgents','update','delete','removeAnswers','/:id/users','exports','multer','path','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','/:id/send'];(function(_0x37a73f,_0x38b29f){var _0x3c6ed8=function(_0x2dd5a6){while(--_0x2dd5a6){_0x37a73f['push'](_0x37a73f['shift']());}};_0x3c6ed8(++_0x38b29f);}(_0x025f,0x1c1));var _0xf025=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x025f[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xf025('0x0'));var util=require('util');var path=require(_0xf025('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf025('0x2'));var config=require(_0xf025('0x3'));var controller=require(_0xf025('0x4'));router[_0xf025('0x5')]('/',auth[_0xf025('0x6')](),controller[_0xf025('0x7')]);router[_0xf025('0x5')](_0xf025('0x8'),auth[_0xf025('0x6')](),controller['describe']);router[_0xf025('0x5')](_0xf025('0x9'),auth['isAuthenticated'](),controller[_0xf025('0xa')]);router['get'](_0xf025('0xb'),auth[_0xf025('0x6')](),controller[_0xf025('0xc')]);router[_0xf025('0x5')](_0xf025('0xd'),auth[_0xf025('0x6')](),controller['getAnswers']);router[_0xf025('0x5')](_0xf025('0xe'),auth[_0xf025('0x6')](),controller[_0xf025('0xf')]);router[_0xf025('0x5')](_0xf025('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xf025('0x5')](_0xf025('0x11'),controller[_0xf025('0x12')]);router[_0xf025('0x5')]('/:id/users',auth[_0xf025('0x6')](),controller[_0xf025('0x13')]);router[_0xf025('0x14')]('/',auth[_0xf025('0x6')](),controller[_0xf025('0x15')]);router[_0xf025('0x14')](_0xf025('0xb'),auth['isAuthenticated'](),controller[_0xf025('0x16')]);router[_0xf025('0x14')](_0xf025('0xd'),auth[_0xf025('0x6')](),controller[_0xf025('0x17')]);router[_0xf025('0x14')]('/:id/notify',controller[_0xf025('0x18')]);router[_0xf025('0x14')]('/:id/applications',auth['isAuthenticated'](),controller[_0xf025('0x19')]);router[_0xf025('0x14')](_0xf025('0x1a'),auth['isAuthenticated'](),controller[_0xf025('0x1b')]);router['post'](_0xf025('0x11'),controller['status']);router[_0xf025('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xf025('0x1c')]);router['put']('/:id',auth[_0xf025('0x6')](),controller[_0xf025('0x1d')]);router[_0xf025('0x1e')](_0xf025('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0xf025('0x1e')](_0xf025('0xb'),auth[_0xf025('0x6')](),controller['removeDispositions']);router[_0xf025('0x1e')](_0xf025('0xd'),auth['isAuthenticated'](),controller[_0xf025('0x1f')]);router[_0xf025('0x1e')](_0xf025('0x20'),auth[_0xf025('0x6')](),controller['removeAgents']);module[_0xf025('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e6fb671..5441daf 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 _0x6610=['BOOLEAN','TEXT','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','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','csc','infobip','intelepeer'];(function(_0x44755e,_0x1ff0a4){var _0x129bb1=function(_0x304e08){while(--_0x304e08){_0x44755e['push'](_0x44755e['shift']());}};_0x129bb1(++_0x1ff0a4);}(_0x6610,0x161));var _0x0661=function(_0x5ed817,_0x1e1ef3){_0x5ed817=_0x5ed817-0x0;var _0x173a25=_0x6610[_0x5ed817];return _0x173a25;};'use strict';var Sequelize=require(_0x0661('0x0'));var rs=require(_0x0661('0x1'));module[_0x0661('0x2')]={'name':{'type':Sequelize[_0x0661('0x3')],'unique':_0x0661('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x0661('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x0661('0x3')],'defaultValue':function(){return rs[_0x0661('0x5')]();}},'phone':{'type':Sequelize[_0x0661('0x3')]},'type':{'type':Sequelize[_0x0661('0x6')](_0x0661('0x7'),_0x0661('0x8'),_0x0661('0x9'),'clicksend',_0x0661('0xa'),_0x0661('0xb'),_0x0661('0xc'),_0x0661('0xd'),_0x0661('0xe'))},'accountSid':{'type':Sequelize[_0x0661('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x0661('0x3')]},'smsMethod':{'type':Sequelize[_0x0661('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x0661('0x3')]},'senderString':{'type':Sequelize[_0x0661('0x3')]},'deliveryReport':{'type':Sequelize[_0x0661('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x0661('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0661('0x10')],'defaultValue':function(){return _0x0661('0x11');}},'notificationSound':{'type':Sequelize[_0x0661('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0661('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0661('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0661('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0661('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0661('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0661('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0661('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0661('0x14'),'set':function(_0x315755){if(!_0x315755)this[_0x0661('0x15')](_0x0661('0x16'),null);this[_0x0661('0x15')]('mandatoryDisposition',_0x315755);}}}; \ No newline at end of file +var _0x4910=['plivo','clickatell','csc','infobip','BOOLEAN','TEXT','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','setDataValue','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend'];(function(_0x40e054,_0x1c61b4){var _0x1c7b93=function(_0x408285){while(--_0x408285){_0x40e054['push'](_0x40e054['shift']());}};_0x1c7b93(++_0x1c61b4);}(_0x4910,0x171));var _0x0491=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4910[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x0491('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x0491('0x1')],'unique':_0x0491('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x0491('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x0491('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x0491('0x1')],'defaultValue':function(){return rs[_0x0491('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0491('0x4')](_0x0491('0x5'),_0x0491('0x6'),_0x0491('0x7'),_0x0491('0x8'),_0x0491('0x9'),_0x0491('0xa'),_0x0491('0xb'),_0x0491('0xc'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x0491('0x1')]},'authToken':{'type':Sequelize[_0x0491('0x1')]},'smsMethod':{'type':Sequelize[_0x0491('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0491('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x0491('0x1')]},'senderString':{'type':Sequelize[_0x0491('0x1')]},'deliveryReport':{'type':Sequelize[_0x0491('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0491('0xe')],'defaultValue':function(){return _0x0491('0xf');}},'notificationSound':{'type':Sequelize[_0x0491('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0491('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0491('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0491('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0491('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0491('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0491('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0491('0x10')],'comment':_0x0491('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x0491('0xd')],'defaultValue':![],'comment':_0x0491('0x12'),'set':function(_0x21592c){if(!_0x21592c)this[_0x0491('0x13')]('mandatoryDispositionPauseId',null);this[_0x0491('0x13')](_0x0491('0x14'),_0x21592c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 14a107b..bf6a490 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 _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x1bec0d,_0x338db4){var _0x49e3e3=function(_0x372c7a){while(--_0x372c7a){_0x1bec0d['push'](_0x1bec0d['shift']());}};_0x49e3e3(++_0x338db4);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 867495c..f6d8626 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 _0x1274=['save','remove','emit','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1274,0x8c));var _0x4127=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1274[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4127('0x0'));var SmsAccount=require(_0x4127('0x1'))['db'][_0x4127('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4127('0x3')](0x0);var events={'afterCreate':_0x4127('0x4'),'afterUpdate':'update','afterDestroy':_0x4127('0x5')};function emitEvent(_0x5ebe4c){return function(_0x378a2e,_0x5347aa,_0xc4061){SmsAccountEvents[_0x4127('0x6')](_0x5ebe4c+':'+_0x378a2e['id'],_0x378a2e);SmsAccountEvents[_0x4127('0x6')](_0x5ebe4c,_0x378a2e);_0xc4061(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x4127('0x7')](e,emitEvent(event));}}module[_0x4127('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x7334=['remove','emit','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x5b4bc0,_0x485e60){var _0xf17524=function(_0x2d1677){while(--_0x2d1677){_0x5b4bc0['push'](_0x5b4bc0['shift']());}};_0xf17524(++_0x485e60);}(_0x7334,0xd2));var _0x4733=function(_0x5b1563,_0x242ec4){_0x5b1563=_0x5b1563-0x0;var _0x4bc0d0=_0x7334[_0x5b1563];return _0x4bc0d0;};'use strict';var EventEmitter=require(_0x4733('0x0'));var SmsAccount=require(_0x4733('0x1'))['db'][_0x4733('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4733('0x3')](0x0);var events={'afterCreate':_0x4733('0x4'),'afterUpdate':_0x4733('0x5'),'afterDestroy':_0x4733('0x6')};function emitEvent(_0x1b4570){return function(_0x1e288f,_0x5a220b,_0x35816d){SmsAccountEvents[_0x4733('0x7')](_0x1b4570+':'+_0x1e288f['id'],_0x1e288f);SmsAccountEvents[_0x4733('0x7')](_0x1b4570,_0x1e288f);_0x35816d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x4733('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 6558e55..e2ee5f9 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 _0x40b6=['../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','util','api','moment','path'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0x40b6,0x19f));var _0x640b=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0x40b6[_0x5d6c3e];return _0x44ecb7;};'use strict';var _=require(_0x640b('0x0'));var util=require(_0x640b('0x1'));var logger=require('../../config/logger')(_0x640b('0x2'));var moment=require(_0x640b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x640b('0x4'));var rimraf=require('rimraf');var config=require(_0x640b('0x5'));var attributes=require(_0x640b('0x6'));module[_0x640b('0x7')]=function(_0x3464e6,_0x3b895b){return _0x3464e6[_0x640b('0x8')]('SmsAccount',attributes,{'tableName':_0x640b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d22=['sms_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3d22,0x71));var _0x23d2=function(_0x476643,_0x3656fe){_0x476643=_0x476643-0x0;var _0x2b240a=_0x3d22[_0x476643];return _0x2b240a;};'use strict';var _=require('lodash');var util=require(_0x23d2('0x0'));var logger=require(_0x23d2('0x1'))(_0x23d2('0x2'));var moment=require(_0x23d2('0x3'));var BPromise=require(_0x23d2('0x4'));var rp=require(_0x23d2('0x5'));var fs=require('fs');var path=require(_0x23d2('0x6'));var rimraf=require(_0x23d2('0x7'));var config=require(_0x23d2('0x8'));var attributes=require(_0x23d2('0x9'));module[_0x23d2('0xa')]=function(_0x14d567,_0x105956){return _0x14d567[_0x23d2('0xb')](_0x23d2('0xc'),attributes,{'tableName':_0x23d2('0xd'),'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 9c6c961..f35d94a 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 _0x0ccc=['../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','model','lodash','util','bluebird','randomstring','ioredis'];(function(_0x23bf57,_0x5ce226){var _0x9f55a1=function(_0x1ffbf8){while(--_0x1ffbf8){_0x23bf57['push'](_0x23bf57['shift']());}};_0x9f55a1(++_0x5ce226);}(_0x0ccc,0x13f));var _0xc0cc=function(_0x1e4ce1,_0x397312){_0x1e4ce1=_0x1e4ce1-0x0;var _0x30e314=_0x0ccc[_0x1e4ce1];return _0x30e314;};'use strict';var _=require(_0xc0cc('0x0'));var util=require(_0xc0cc('0x1'));var moment=require('moment');var BPromise=require(_0xc0cc('0x2'));var rs=require(_0xc0cc('0x3'));var fs=require('fs');var Redis=require(_0xc0cc('0x4'));var db=require(_0xc0cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0cc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc0cc('0x7'));var client=jayson[_0xc0cc('0x8')][_0xc0cc('0x9')]({'port':0x232a});config[_0xc0cc('0xa')]=_[_0xc0cc('0xb')](config[_0xc0cc('0xa')],{'host':_0xc0cc('0xc'),'port':0x18eb});var socket=require(_0xc0cc('0xd'))(new Redis(config[_0xc0cc('0xa')]));require(_0xc0cc('0xe'))[_0xc0cc('0xf')](socket);function respondWithRpcPromise(_0x39a08d,_0x3cd138,_0x16a669){return new BPromise(function(_0x21e98f,_0x145539){return client[_0xc0cc('0x10')](_0x39a08d,_0x16a669)[_0xc0cc('0x11')](function(_0x483235){logger[_0xc0cc('0x12')](_0xc0cc('0x13'),_0x3cd138,_0xc0cc('0x14'));logger[_0xc0cc('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3cd138,_0xc0cc('0x14'),JSON[_0xc0cc('0x16')](_0x483235));if(_0x483235[_0xc0cc('0x17')]){if(_0x483235['error'][_0xc0cc('0x18')]===0x1f4){logger[_0xc0cc('0x17')](_0xc0cc('0x13'),_0x3cd138,_0x483235[_0xc0cc('0x17')][_0xc0cc('0x19')]);return _0x145539(_0x483235['error'][_0xc0cc('0x19')]);}logger['error'](_0xc0cc('0x13'),_0x3cd138,_0x483235[_0xc0cc('0x17')]['message']);return _0x21e98f(_0x483235[_0xc0cc('0x17')][_0xc0cc('0x19')]);}else{logger['info'](_0xc0cc('0x13'),_0x3cd138,_0xc0cc('0x14'));_0x21e98f(_0x483235[_0xc0cc('0x1a')][_0xc0cc('0x19')]);}})[_0xc0cc('0x1b')](function(_0x2f503b){logger[_0xc0cc('0x17')](_0xc0cc('0x13'),_0x3cd138,_0x2f503b);_0x145539(_0x2f503b);});});}exports[_0xc0cc('0x1c')]=function(_0x26ee75){var _0x3f2b7f=this;return new Promise(function(_0xb7274,_0x45ab05){return db[_0xc0cc('0x1d')][_0xc0cc('0x1e')]({'raw':_0x26ee75['options']?_0x26ee75[_0xc0cc('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x26ee75[_0xc0cc('0x1f')]?_0x26ee75['options'][_0xc0cc('0x20')]||null:null,'attributes':_0x26ee75['options']?_0x26ee75[_0xc0cc('0x1f')][_0xc0cc('0x21')]||null:null,'include':_0x26ee75[_0xc0cc('0x1f')]?_0x26ee75['options']['include']?_['map'](_0x26ee75['options'][_0xc0cc('0x22')],function(_0x33deae){return{'model':db[_0x33deae[_0xc0cc('0x23')]],'as':_0x33deae['as'],'attributes':_0x33deae[_0xc0cc('0x21')],'include':_0x33deae['include']?_['map'](_0x33deae['include'],function(_0x111510){return{'model':db[_0x111510['model']],'as':_0x111510['as'],'attributes':_0x111510[_0xc0cc('0x21')],'include':_0x111510[_0xc0cc('0x22')]?_['map'](_0x111510[_0xc0cc('0x22')],function(_0x41de96){return{'model':db[_0x41de96[_0xc0cc('0x23')]],'as':_0x41de96['as'],'attributes':_0x41de96[_0xc0cc('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc0cc('0x11')](function(_0x3fb877){logger[_0xc0cc('0x12')](_0xc0cc('0x1c'),_0x26ee75);logger[_0xc0cc('0x15')]('ShowSmsAccount',_0x26ee75,JSON[_0xc0cc('0x16')](_0x3fb877));_0xb7274(_0x3fb877);})[_0xc0cc('0x1b')](function(_0x1a164b){logger[_0xc0cc('0x17')](_0xc0cc('0x1c'),_0x1a164b[_0xc0cc('0x19')],_0x26ee75);_0x45ab05(_0x3f2b7f['error'](0x1f4,_0x1a164b[_0xc0cc('0x19')]));});});}; \ No newline at end of file +var _0x16a9=['rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsAccount','find','options','where','attributes','include','model','map','ShowSmsAccount','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c8e1d,_0x28571a){var _0x58184f=function(_0x3fdbf1){while(--_0x3fdbf1){_0x3c8e1d['push'](_0x3c8e1d['shift']());}};_0x58184f(++_0x28571a);}(_0x16a9,0xb3));var _0x916a=function(_0x3c1d53,_0x576ef6){_0x3c1d53=_0x3c1d53-0x0;var _0x3634bd=_0x16a9[_0x3c1d53];return _0x3634bd;};'use strict';var _=require(_0x916a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x916a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x916a('0x2'));var db=require(_0x916a('0x3'))['db'];var utils=require(_0x916a('0x4'));var logger=require(_0x916a('0x5'))(_0x916a('0x6'));var config=require(_0x916a('0x7'));var jayson=require(_0x916a('0x8'));var client=jayson[_0x916a('0x9')][_0x916a('0xa')]({'port':0x232a});config[_0x916a('0xb')]=_['defaults'](config[_0x916a('0xb')],{'host':_0x916a('0xc'),'port':0x18eb});var socket=require(_0x916a('0xd'))(new Redis(config[_0x916a('0xb')]));require(_0x916a('0xe'))['register'](socket);function respondWithRpcPromise(_0x5d37df,_0x4eb603,_0x14ae94){return new BPromise(function(_0x25a713,_0xff4144){return client[_0x916a('0xf')](_0x5d37df,_0x14ae94)[_0x916a('0x10')](function(_0x4b5c3f){logger['info'](_0x916a('0x11'),_0x4eb603,_0x916a('0x12'));logger[_0x916a('0x13')](_0x916a('0x14'),_0x4eb603,_0x916a('0x12'),JSON[_0x916a('0x15')](_0x4b5c3f));if(_0x4b5c3f[_0x916a('0x16')]){if(_0x4b5c3f[_0x916a('0x16')][_0x916a('0x17')]===0x1f4){logger[_0x916a('0x16')](_0x916a('0x11'),_0x4eb603,_0x4b5c3f['error'][_0x916a('0x18')]);return _0xff4144(_0x4b5c3f['error']['message']);}logger['error'](_0x916a('0x11'),_0x4eb603,_0x4b5c3f[_0x916a('0x16')][_0x916a('0x18')]);return _0x25a713(_0x4b5c3f[_0x916a('0x16')][_0x916a('0x18')]);}else{logger[_0x916a('0x19')]('SmsAccount,\x20%s,\x20%s',_0x4eb603,_0x916a('0x12'));_0x25a713(_0x4b5c3f[_0x916a('0x1a')][_0x916a('0x18')]);}})[_0x916a('0x1b')](function(_0x404403){logger['error'](_0x916a('0x11'),_0x4eb603,_0x404403);_0xff4144(_0x404403);});});}exports['ShowSmsAccount']=function(_0x5a0006){var _0x487b0a=this;return new Promise(function(_0x25e7a4,_0x221e1a){return db[_0x916a('0x1c')][_0x916a('0x1d')]({'raw':_0x5a0006['options']?_0x5a0006[_0x916a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5a0006['options']?_0x5a0006[_0x916a('0x1e')][_0x916a('0x1f')]||null:null,'attributes':_0x5a0006[_0x916a('0x1e')]?_0x5a0006[_0x916a('0x1e')][_0x916a('0x20')]||null:null,'include':_0x5a0006[_0x916a('0x1e')]?_0x5a0006['options'][_0x916a('0x21')]?_['map'](_0x5a0006[_0x916a('0x1e')][_0x916a('0x21')],function(_0x201ba1){return{'model':db[_0x201ba1[_0x916a('0x22')]],'as':_0x201ba1['as'],'attributes':_0x201ba1[_0x916a('0x20')],'include':_0x201ba1[_0x916a('0x21')]?_['map'](_0x201ba1[_0x916a('0x21')],function(_0x12c62e){return{'model':db[_0x12c62e[_0x916a('0x22')]],'as':_0x12c62e['as'],'attributes':_0x12c62e[_0x916a('0x20')],'include':_0x12c62e[_0x916a('0x21')]?_[_0x916a('0x23')](_0x12c62e[_0x916a('0x21')],function(_0xe6e48c){return{'model':db[_0xe6e48c[_0x916a('0x22')]],'as':_0xe6e48c['as'],'attributes':_0xe6e48c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xea84fb){logger[_0x916a('0x19')](_0x916a('0x24'),_0x5a0006);logger[_0x916a('0x13')](_0x916a('0x24'),_0x5a0006,JSON['stringify'](_0xea84fb));_0x25e7a4(_0xea84fb);})[_0x916a('0x1b')](function(_0x514359){logger['error'](_0x916a('0x24'),_0x514359['message'],_0x5a0006);_0x221e1a(_0x487b0a[_0x916a('0x16')](0x1f4,_0x514359[_0x916a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b9b900e..725f47e 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 _0xf811=['save','remove','update','emit','removeListener','register','length','./smsAccount.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf811,0x6f));var _0x1f81=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xf811[_0x55e08b];return _0xd1a7ff;};'use strict';var SmsAccountEvents=require(_0x1f81('0x0'));var events=[_0x1f81('0x1'),_0x1f81('0x2'),_0x1f81('0x3')];function createListener(_0x23820c,_0x127e28){return function(_0x3f406e){_0x127e28[_0x1f81('0x4')](_0x23820c,_0x3f406e);};}function removeListener(_0x18f178,_0x4281c3){return function(){SmsAccountEvents[_0x1f81('0x5')](_0x18f178,_0x4281c3);};}exports[_0x1f81('0x6')]=function(_0x3179f4){for(var _0xcf30e8=0x0,_0x57c512=events[_0x1f81('0x7')];_0xcf30e8<_0x57c512;_0xcf30e8++){var _0x42b31b=events[_0xcf30e8];var _0x3635bf=createListener('smsAccount:'+_0x42b31b,_0x3179f4);SmsAccountEvents['on'](_0x42b31b,_0x3635bf);}}; \ No newline at end of file +var _0xcf4a=['emit','removeListener','length','smsAccount:','./smsAccount.events','save','remove','update'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0xcf4a,0x14c));var _0xacf4=function(_0x2e5599,_0x106550){_0x2e5599=_0x2e5599-0x0;var _0x4de1f3=_0xcf4a[_0x2e5599];return _0x4de1f3;};'use strict';var SmsAccountEvents=require(_0xacf4('0x0'));var events=[_0xacf4('0x1'),_0xacf4('0x2'),_0xacf4('0x3')];function createListener(_0x691de3,_0x2b11b4){return function(_0x13ae49){_0x2b11b4[_0xacf4('0x4')](_0x691de3,_0x13ae49);};}function removeListener(_0x5d56d4,_0x40da6c){return function(){SmsAccountEvents[_0xacf4('0x5')](_0x5d56d4,_0x40da6c);};}exports['register']=function(_0x2c4a6d){for(var _0x5792f8=0x0,_0x20d349=events[_0xacf4('0x6')];_0x5792f8<_0x20d349;_0x5792f8++){var _0x53d211=events[_0x5792f8];var _0x485b11=createListener(_0xacf4('0x7')+_0x53d211,_0x2c4a6d);SmsAccountEvents['on'](_0x53d211,_0x485b11);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 4e6a69b..35f5fbc 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 _0xa975=['/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','show','put'];(function(_0x38e8a7,_0x3e9a58){var _0x50f134=function(_0x4ed82f){while(--_0x4ed82f){_0x38e8a7['push'](_0x38e8a7['shift']());}};_0x50f134(++_0x3e9a58);}(_0xa975,0xd1));var _0x5a97=function(_0x3a1345,_0xe8f445){_0x3a1345=_0x3a1345-0x0;var _0x210c66=_0xa975[_0x3a1345];return _0x210c66;};'use strict';var multer=require(_0x5a97('0x0'));var util=require(_0x5a97('0x1'));var path=require('path');var timeout=require(_0x5a97('0x2'));var express=require(_0x5a97('0x3'));var router=express[_0x5a97('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5a97('0x5'));var config=require(_0x5a97('0x6'));var controller=require(_0x5a97('0x7'));router[_0x5a97('0x8')]('/',auth[_0x5a97('0x9')](),controller['index']);router[_0x5a97('0x8')]('/:id',auth[_0x5a97('0x9')](),controller[_0x5a97('0xa')]);router['post']('/',auth[_0x5a97('0x9')](),controller['create']);router[_0x5a97('0xb')](_0x5a97('0xc'),auth['isAuthenticated'](),controller[_0x5a97('0xd')]);router[_0x5a97('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5a97('0xf')]);module[_0x5a97('0x10')]=router; \ No newline at end of file +var _0x8219=['exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy'];(function(_0x3831ef,_0x58fea6){var _0x32c7c6=function(_0x515d93){while(--_0x515d93){_0x3831ef['push'](_0x3831ef['shift']());}};_0x32c7c6(++_0x58fea6);}(_0x8219,0x1b1));var _0x9821=function(_0xc31458,_0x45ee76){_0xc31458=_0xc31458-0x0;var _0x1b4a90=_0x8219[_0xc31458];return _0x1b4a90;};'use strict';var multer=require('multer');var util=require(_0x9821('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9821('0x1'));var router=express[_0x9821('0x2')]();var auth=require(_0x9821('0x3'));var interaction=require(_0x9821('0x4'));var config=require(_0x9821('0x5'));var controller=require('./smsApplication.controller');router['get']('/',auth[_0x9821('0x6')](),controller[_0x9821('0x7')]);router[_0x9821('0x8')]('/:id',auth[_0x9821('0x6')](),controller[_0x9821('0x9')]);router[_0x9821('0xa')]('/',auth[_0x9821('0x6')](),controller[_0x9821('0xb')]);router[_0x9821('0xc')](_0x9821('0xd'),auth[_0x9821('0x6')](),controller[_0x9821('0xe')]);router[_0x9821('0xf')](_0x9821('0xd'),auth[_0x9821('0x6')](),controller[_0x9821('0x10')]);module[_0x9821('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b226359..e256ca4 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 _0x3e06=['sequelize','exports','INTEGER','STRING'];(function(_0x1559be,_0x3d7660){var _0x3936f1=function(_0x50d883){while(--_0x50d883){_0x1559be['push'](_0x1559be['shift']());}};_0x3936f1(++_0x3d7660);}(_0x3e06,0xc8));var _0x63e0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3e06[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x63e0('0x0'));module[_0x63e0('0x1')]={'priority':{'type':Sequelize[_0x63e0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x63e0('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x63e0('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb09a=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x2e2c90,_0x5cbedc){var _0x28b1de=function(_0x2abe1e){while(--_0x2abe1e){_0x2e2c90['push'](_0x2e2c90['shift']());}};_0x28b1de(++_0x5cbedc);}(_0xb09a,0x114));var _0xab09=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0xb09a[_0x1fdb40];return _0x281f93;};'use strict';var Sequelize=require(_0xab09('0x0'));module['exports']={'priority':{'type':Sequelize[_0xab09('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xab09('0x2')},'appdata':{'type':Sequelize[_0xab09('0x3')]()},'description':{'type':Sequelize[_0xab09('0x4')]},'interval':{'type':Sequelize[_0xab09('0x4')],'defaultValue':_0xab09('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 66a50f3..56f5de1 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 _0xfef3=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto'];(function(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0xfef3,0x118));var _0x3fef=function(_0x132399,_0x1c4b0f){_0x132399=_0x132399-0x0;var _0x2a27e9=_0xfef3[_0x132399];return _0x2a27e9;};'use strict';var pdf=require(_0x3fef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3fef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fef('0x2'));var rp=require(_0x3fef('0x3'));var moment=require('moment');var BPromise=require(_0x3fef('0x4'));var Mustache=require(_0x3fef('0x5'));var util=require('util');var path=require(_0x3fef('0x6'));var sox=require(_0x3fef('0x7'));var csv=require('to-csv');var ejs=require(_0x3fef('0x8'));var fs=require('fs');var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0xe'));var querystring=require(_0x3fef('0xf'));var Papa=require(_0x3fef('0x10'));var Redis=require(_0x3fef('0x11'));var authService=require(_0x3fef('0x12'));var qs=require(_0x3fef('0x13'));var as=require(_0x3fef('0x14'));var hardwareService=require(_0x3fef('0x15'));var logger=require('../../config/logger')(_0x3fef('0x16'));var utils=require(_0x3fef('0x17'));var config=require(_0x3fef('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c20b3,_0x4c4a47){_0x4c4a47=_0x4c4a47||0xcc;return function(_0x2c99ff){if(_0x2c99ff){return _0x1c20b3[_0x3fef('0x19')](_0x4c4a47);}return _0x1c20b3[_0x3fef('0x1a')](_0x4c4a47)['end']();};}function respondWithResult(_0x42c3d2,_0x4be62f){_0x4be62f=_0x4be62f||0xc8;return function(_0x15b757){if(_0x15b757){return _0x42c3d2[_0x3fef('0x1a')](_0x4be62f)['json'](_0x15b757);}};}function respondWithFilteredResult(_0x2dec1b,_0x177e28){return function(_0x40b479){if(_0x40b479){var _0x79b617=_0x40b479[_0x3fef('0x1b')],_0x395df0=_0x177e28[_0x3fef('0x1c')],_0x2af1ba=_0x177e28[_0x3fef('0x1c')]+_0x177e28[_0x3fef('0x1d')],_0x5c899f;if(_0x2af1ba>=_0x79b617){_0x2af1ba=_0x79b617;_0x5c899f=0xc8;}else{_0x5c899f=0xce;}_0x2dec1b[_0x3fef('0x1a')](_0x5c899f);return _0x2dec1b[_0x3fef('0x1e')]('Content-Range',_0x395df0+'-'+_0x2af1ba+'/'+_0x79b617)[_0x3fef('0x1f')](_0x40b479);}return null;};}function patchUpdates(_0x3eb287){return function(_0x53d4fd){try{jsonpatch[_0x3fef('0x20')](_0x53d4fd,_0x3eb287,!![]);}catch(_0x51a554){return BPromise[_0x3fef('0x21')](_0x51a554);}return _0x53d4fd[_0x3fef('0x22')]();};}function saveUpdates(_0x245332,_0x2b5226){return function(_0x451d11){if(_0x451d11){return _0x451d11[_0x3fef('0x23')](_0x245332)[_0x3fef('0x24')](function(_0xd64bf4){return _0xd64bf4;});}return null;};}function removeEntity(_0x1f5aaf,_0x3bb110){return function(_0x2eb578){if(_0x2eb578){return _0x2eb578[_0x3fef('0x25')]()[_0x3fef('0x24')](function(){_0x1f5aaf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50025f,_0x378b03){return function(_0x3ba38d){if(!_0x3ba38d){_0x50025f[_0x3fef('0x19')](0x194);}return _0x3ba38d;};}function handleError(_0x5f047c,_0x4d462c){_0x4d462c=_0x4d462c||0x1f4;return function(_0x56c542){logger[_0x3fef('0x26')](_0x56c542[_0x3fef('0x27')]);if(_0x56c542[_0x3fef('0x28')]){delete _0x56c542[_0x3fef('0x28')];}_0x5f047c[_0x3fef('0x1a')](_0x4d462c)['send'](_0x56c542);};}exports['index']=function(_0x563556,_0x121ff0){var _0x3baa52={},_0x4ea2ab={},_0x462ee7={'count':0x0,'rows':[]};var _0x6d08cd=_['map'](db[_0x3fef('0x29')][_0x3fef('0x2a')],function(_0xf892bb){return{'name':_0xf892bb[_0x3fef('0x2b')],'type':_0xf892bb[_0x3fef('0x2c')][_0x3fef('0x2d')]};});_0x4ea2ab[_0x3fef('0x2e')]=_['map'](_0x6d08cd,_0x3fef('0x28'));_0x4ea2ab[_0x3fef('0x2f')]=_[_0x3fef('0x30')](_0x563556[_0x3fef('0x2f')]);_0x4ea2ab['filters']=_[_0x3fef('0x31')](_0x4ea2ab['model'],_0x4ea2ab[_0x3fef('0x2f')]);_0x3baa52[_0x3fef('0x32')]=_[_0x3fef('0x31')](_0x4ea2ab[_0x3fef('0x2e')],qs[_0x3fef('0x33')](_0x563556[_0x3fef('0x2f')][_0x3fef('0x33')]));_0x3baa52[_0x3fef('0x32')]=_0x3baa52[_0x3fef('0x32')][_0x3fef('0x34')]?_0x3baa52['attributes']:_0x4ea2ab['model'];if(!_0x563556[_0x3fef('0x2f')]['hasOwnProperty'](_0x3fef('0x35'))){_0x3baa52[_0x3fef('0x1d')]=qs[_0x3fef('0x1d')](_0x563556[_0x3fef('0x2f')][_0x3fef('0x1d')]);_0x3baa52[_0x3fef('0x1c')]=qs[_0x3fef('0x1c')](_0x563556[_0x3fef('0x2f')][_0x3fef('0x1c')]);}_0x3baa52[_0x3fef('0x36')]=qs[_0x3fef('0x37')](_0x563556[_0x3fef('0x2f')][_0x3fef('0x37')]);_0x3baa52[_0x3fef('0x38')]=qs['filters'](_[_0x3fef('0x39')](_0x563556[_0x3fef('0x2f')],_0x4ea2ab[_0x3fef('0x3a')]),_0x6d08cd);if(_0x563556[_0x3fef('0x2f')][_0x3fef('0x3b')]){_0x3baa52[_0x3fef('0x38')]=_['merge'](_0x3baa52['where'],{'$or':_[_0x3fef('0x3c')](_0x6d08cd,function(_0x163de0){if(_0x163de0[_0x3fef('0x2c')]!==_0x3fef('0x3d')){var _0x69e494={};_0x69e494[_0x163de0[_0x3fef('0x28')]]={'$like':'%'+_0x563556[_0x3fef('0x2f')][_0x3fef('0x3b')]+'%'};return _0x69e494;}})});}_0x3baa52=_[_0x3fef('0x3e')]({},_0x3baa52,_0x563556[_0x3fef('0x3f')]);var _0x391053={'where':_0x3baa52['where']};return db[_0x3fef('0x29')][_0x3fef('0x1b')](_0x391053)['then'](function(_0x54e329){_0x462ee7[_0x3fef('0x1b')]=_0x54e329;if(_0x563556[_0x3fef('0x2f')][_0x3fef('0x40')]){_0x3baa52[_0x3fef('0x41')]=[{'all':!![]}];}return db[_0x3fef('0x29')][_0x3fef('0x42')](_0x3baa52);})[_0x3fef('0x24')](function(_0x42e43d){_0x462ee7['rows']=_0x42e43d;return _0x462ee7;})[_0x3fef('0x24')](respondWithFilteredResult(_0x121ff0,_0x3baa52))[_0x3fef('0x43')](handleError(_0x121ff0,null));};exports[_0x3fef('0x44')]=function(_0x3dceed,_0x1fe9ee){var _0x2143ec={'raw':!![],'where':{'id':_0x3dceed[_0x3fef('0x45')]['id']}},_0x545154={};_0x545154[_0x3fef('0x2e')]=_[_0x3fef('0x30')](db[_0x3fef('0x29')][_0x3fef('0x2a')]);_0x545154[_0x3fef('0x2f')]=_[_0x3fef('0x30')](_0x3dceed[_0x3fef('0x2f')]);_0x545154['filters']=_[_0x3fef('0x31')](_0x545154[_0x3fef('0x2e')],_0x545154[_0x3fef('0x2f')]);_0x2143ec[_0x3fef('0x32')]=_[_0x3fef('0x31')](_0x545154[_0x3fef('0x2e')],qs['fields'](_0x3dceed[_0x3fef('0x2f')]['fields']));_0x2143ec[_0x3fef('0x32')]=_0x2143ec[_0x3fef('0x32')]['length']?_0x2143ec[_0x3fef('0x32')]:_0x545154['model'];if(_0x3dceed[_0x3fef('0x2f')][_0x3fef('0x40')]){_0x2143ec[_0x3fef('0x41')]=[{'all':!![]}];}_0x2143ec=_[_0x3fef('0x3e')]({},_0x2143ec,_0x3dceed[_0x3fef('0x3f')]);return db[_0x3fef('0x29')][_0x3fef('0x46')](_0x2143ec)[_0x3fef('0x24')](handleEntityNotFound(_0x1fe9ee,null))[_0x3fef('0x24')](respondWithResult(_0x1fe9ee,null))[_0x3fef('0x43')](handleError(_0x1fe9ee,null));};exports[_0x3fef('0x47')]=function(_0x3e96c9,_0xce173f){return db['SmsApplication'][_0x3fef('0x47')](_0x3e96c9[_0x3fef('0x48')],{})['then'](respondWithResult(_0xce173f,0xc9))[_0x3fef('0x43')](handleError(_0xce173f,null));};exports[_0x3fef('0x23')]=function(_0x2f00c0,_0x505680){if(_0x2f00c0[_0x3fef('0x48')]['id']){delete _0x2f00c0[_0x3fef('0x48')]['id'];}return db['SmsApplication'][_0x3fef('0x46')]({'where':{'id':_0x2f00c0['params']['id']}})['then'](handleEntityNotFound(_0x505680,null))[_0x3fef('0x24')](saveUpdates(_0x2f00c0['body'],null))[_0x3fef('0x24')](respondWithResult(_0x505680,null))[_0x3fef('0x43')](handleError(_0x505680,null));};exports['destroy']=function(_0x4535e8,_0x2823f4){return db[_0x3fef('0x29')]['find']({'where':{'id':_0x4535e8[_0x3fef('0x45')]['id']}})[_0x3fef('0x24')](handleEntityNotFound(_0x2823f4,null))[_0x3fef('0x24')](removeEntity(_0x2823f4,null))['catch'](handleError(_0x2823f4,null));}; \ No newline at end of file +var _0xb10b=['where','merge','SmsApplication','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x2d6f74,_0xda900){var _0x52838b=function(_0x354a4f){while(--_0x354a4f){_0x2d6f74['push'](_0x2d6f74['shift']());}};_0x52838b(++_0xda900);}(_0xb10b,0x12a));var _0xbb10=function(_0x241207,_0x39a50c){_0x241207=_0x241207-0x0;var _0x26f4ce=_0xb10b[_0x241207];return _0x26f4ce;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['SmsApplication'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 3b6f575..ce647fb 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 _0x56c5=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','../../config/logger'];(function(_0x442f1a,_0x6ba7b1){var _0x187022=function(_0x48869b){while(--_0x48869b){_0x442f1a['push'](_0x442f1a['shift']());}};_0x187022(++_0x6ba7b1);}(_0x56c5,0x167));var _0x556c=function(_0x322d67,_0x3a3c88){_0x322d67=_0x322d67-0x0;var _0x12719a=_0x56c5[_0x322d67];return _0x12719a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x556c('0x0'))('api');var moment=require('moment');var BPromise=require(_0x556c('0x1'));var rp=require(_0x556c('0x2'));var fs=require('fs');var path=require(_0x556c('0x3'));var rimraf=require(_0x556c('0x4'));var config=require(_0x556c('0x5'));var attributes=require(_0x556c('0x6'));module[_0x556c('0x7')]=function(_0x5554b0,_0x5946b6){return _0x5554b0[_0x556c('0x8')](_0x556c('0x9'),attributes,{'tableName':_0x556c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x556c('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x24dc=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x24dc,0x128));var _0xc24d=function(_0x3aae30,_0x43ff63){_0x3aae30=_0x3aae30-0x0;var _0x227d96=_0x24dc[_0x3aae30];return _0x227d96;};'use strict';var _=require(_0xc24d('0x0'));var util=require(_0xc24d('0x1'));var logger=require('../../config/logger')(_0xc24d('0x2'));var moment=require(_0xc24d('0x3'));var BPromise=require(_0xc24d('0x4'));var rp=require(_0xc24d('0x5'));var fs=require('fs');var path=require(_0xc24d('0x6'));var rimraf=require(_0xc24d('0x7'));var config=require(_0xc24d('0x8'));var attributes=require(_0xc24d('0x9'));module['exports']=function(_0x128693,_0x179c1e){return _0x128693[_0xc24d('0xa')](_0xc24d('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc24d('0xc'),'collate':_0xc24d('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index bf791ec..f2506f5 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 _0x6363=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6363,0x13a));var _0x3636=function(_0x334829,_0x69cae9){_0x334829=_0x334829-0x0;var _0xb1037d=_0x6363[_0x334829];return _0xb1037d;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var moment=require(_0x3636('0x1'));var BPromise=require(_0x3636('0x2'));var rs=require(_0x3636('0x3'));var fs=require('fs');var Redis=require(_0x3636('0x4'));var db=require(_0x3636('0x5'))['db'];var utils=require(_0x3636('0x6'));var logger=require(_0x3636('0x7'))(_0x3636('0x8'));var config=require(_0x3636('0x9'));var jayson=require(_0x3636('0xa'));var client=jayson[_0x3636('0xb')][_0x3636('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdc928c,_0x17b2a4,_0x583dec){return new BPromise(function(_0x19f917,_0x47f84e){return client[_0x3636('0xd')](_0xdc928c,_0x583dec)[_0x3636('0xe')](function(_0x23869b){logger[_0x3636('0xf')](_0x3636('0x10'),_0x17b2a4,_0x3636('0x11'));logger[_0x3636('0x12')](_0x3636('0x13'),_0x17b2a4,_0x3636('0x11'),JSON['stringify'](_0x23869b));if(_0x23869b['error']){if(_0x23869b[_0x3636('0x14')]['code']===0x1f4){logger[_0x3636('0x14')](_0x3636('0x10'),_0x17b2a4,_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);return _0x47f84e(_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);}logger[_0x3636('0x14')](_0x3636('0x10'),_0x17b2a4,_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);return _0x19f917(_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);}else{logger[_0x3636('0xf')](_0x3636('0x10'),_0x17b2a4,_0x3636('0x11'));_0x19f917(_0x23869b[_0x3636('0x16')][_0x3636('0x15')]);}})['catch'](function(_0x11b53e){logger[_0x3636('0x14')]('SmsApplication,\x20%s,\x20%s',_0x17b2a4,_0x11b53e);_0x47f84e(_0x11b53e);});});} \ No newline at end of file +var _0xf725=['http','then','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3b2b5b,_0x3cabf3){var _0xd24af6=function(_0x5a6855){while(--_0x5a6855){_0x3b2b5b['push'](_0x3b2b5b['shift']());}};_0xd24af6(++_0x3cabf3);}(_0xf725,0x7e));var _0x5f72=function(_0x511618,_0x178093){_0x511618=_0x511618-0x0;var _0x4d7738=_0xf725[_0x511618];return _0x4d7738;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var moment=require(_0x5f72('0x2'));var BPromise=require(_0x5f72('0x3'));var rs=require(_0x5f72('0x4'));var fs=require('fs');var Redis=require(_0x5f72('0x5'));var db=require(_0x5f72('0x6'))['db'];var utils=require(_0x5f72('0x7'));var logger=require(_0x5f72('0x8'))(_0x5f72('0x9'));var config=require('../../config/environment');var jayson=require(_0x5f72('0xa'));var client=jayson[_0x5f72('0xb')][_0x5f72('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193393,_0x148af8,_0x4961d1){return new BPromise(function(_0x158aa3,_0x523365){return client['request'](_0x193393,_0x4961d1)[_0x5f72('0xd')](function(_0x3f189d){logger['info'](_0x5f72('0xe'),_0x148af8,_0x5f72('0xf'));logger['debug'](_0x5f72('0x10'),_0x148af8,_0x5f72('0xf'),JSON[_0x5f72('0x11')](_0x3f189d));if(_0x3f189d[_0x5f72('0x12')]){if(_0x3f189d[_0x5f72('0x12')][_0x5f72('0x13')]===0x1f4){logger[_0x5f72('0x12')]('SmsApplication,\x20%s,\x20%s',_0x148af8,_0x3f189d[_0x5f72('0x12')][_0x5f72('0x14')]);return _0x523365(_0x3f189d[_0x5f72('0x12')][_0x5f72('0x14')]);}logger[_0x5f72('0x12')]('SmsApplication,\x20%s,\x20%s',_0x148af8,_0x3f189d[_0x5f72('0x12')]['message']);return _0x158aa3(_0x3f189d['error'][_0x5f72('0x14')]);}else{logger['info'](_0x5f72('0xe'),_0x148af8,'request\x20sent');_0x158aa3(_0x3f189d[_0x5f72('0x15')]['message']);}})[_0x5f72('0x16')](function(_0x2c7ac6){logger['error'](_0x5f72('0xe'),_0x148af8,_0x2c7ac6);_0x523365(_0x2c7ac6);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 969f89e..c52e98f 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 _0x7717=['../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','removeTags','exports','multer','util','express','Router','../../components/interaction/service'];(function(_0x1857c6,_0x48840c){var _0x51011c=function(_0x3a4736){while(--_0x3a4736){_0x1857c6['push'](_0x1857c6['shift']());}};_0x51011c(++_0x48840c);}(_0x7717,0x6f));var _0x7771=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7717[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7771('0x0'));var util=require(_0x7771('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7771('0x2'));var router=express[_0x7771('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7771('0x4'));var config=require(_0x7771('0x5'));var controller=require(_0x7771('0x6'));router[_0x7771('0x7')]('/',auth['isAuthenticated'](),controller[_0x7771('0x8')]);router['get'](_0x7771('0x9'),auth[_0x7771('0xa')](),controller['describe']);router[_0x7771('0x7')](_0x7771('0xb'),auth[_0x7771('0xa')](),controller[_0x7771('0xc')]);router[_0x7771('0x7')](_0x7771('0xd'),auth[_0x7771('0xa')](),controller[_0x7771('0xe')]);router[_0x7771('0x7')]('/:id/download',auth[_0x7771('0xa')](),controller[_0x7771('0xf')]);router[_0x7771('0x10')]('/',auth[_0x7771('0xa')](),controller['create']);router['post'](_0x7771('0xd'),auth[_0x7771('0xa')](),controller[_0x7771('0x11')]);router[_0x7771('0x10')](_0x7771('0x12'),auth[_0x7771('0xa')](),interaction[_0x7771('0x13')](_0x7771('0x14'),_0x7771('0x15')),controller[_0x7771('0x16')]);router[_0x7771('0x17')]('/:id',auth[_0x7771('0xa')](),interaction[_0x7771('0x13')]('sms',_0x7771('0x18')),controller['update']);router[_0x7771('0x19')](_0x7771('0xb'),auth[_0x7771('0xa')](),interaction['tracked'](_0x7771('0x14'),_0x7771('0x1a')),controller['destroy']);router[_0x7771('0x19')]('/:id/tags',auth[_0x7771('0xa')](),controller[_0x7771('0x1b')]);module[_0x7771('0x1c')]=router; \ No newline at end of file +var _0x7008=['delete','tracked','smsinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x7008,0x185));var _0x8700=function(_0x161b67,_0x10d89a){_0x161b67=_0x161b67-0x0;var _0x3f76f2=_0x7008[_0x161b67];return _0x3f76f2;};'use strict';var multer=require(_0x8700('0x0'));var util=require(_0x8700('0x1'));var path=require(_0x8700('0x2'));var timeout=require(_0x8700('0x3'));var express=require('express');var router=express[_0x8700('0x4')]();var auth=require(_0x8700('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8700('0x6'));var controller=require(_0x8700('0x7'));router[_0x8700('0x8')]('/',auth[_0x8700('0x9')](),controller[_0x8700('0xa')]);router[_0x8700('0x8')](_0x8700('0xb'),auth['isAuthenticated'](),controller[_0x8700('0xc')]);router[_0x8700('0x8')](_0x8700('0xd'),auth[_0x8700('0x9')](),controller[_0x8700('0xe')]);router[_0x8700('0x8')](_0x8700('0xf'),auth[_0x8700('0x9')](),controller[_0x8700('0x10')]);router[_0x8700('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x8700('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8700('0x12')](_0x8700('0xf'),auth[_0x8700('0x9')](),controller[_0x8700('0x13')]);router[_0x8700('0x12')](_0x8700('0x14'),auth[_0x8700('0x9')](),interaction['tracked'](_0x8700('0x15'),_0x8700('0x16')),controller[_0x8700('0x17')]);router[_0x8700('0x18')](_0x8700('0xd'),auth[_0x8700('0x9')](),interaction['tracked'](_0x8700('0x15'),_0x8700('0x19')),controller[_0x8700('0x1a')]);router[_0x8700('0x1b')](_0x8700('0xd'),auth['isAuthenticated'](),interaction[_0x8700('0x1c')](_0x8700('0x15'),_0x8700('0x1d')),controller['destroy']);router['delete'](_0x8700('0x14'),auth[_0x8700('0x9')](),controller[_0x8700('0x1e')]);module[_0x8700('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 872ce41..051f199 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 _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x3412e0,_0x5c4e4f){var _0x479b68=function(_0x23028d){while(--_0x23028d){_0x3412e0['push'](_0x3412e0['shift']());}};_0x479b68(++_0x5c4e4f);}(_0x757a,0xde));var _0xa757=function(_0x4707ad,_0x47e060){_0x4707ad=_0x4707ad-0x0;var _0x15261c=_0x757a[_0x4707ad];return _0x15261c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb10b=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0xd39f77,_0x4d4c1e){var _0x57d21a=function(_0x6da378){while(--_0x6da378){_0xd39f77['push'](_0xd39f77['shift']());}};_0x57d21a(++_0x4d4c1e);}(_0xb10b,0x12a));var _0xbb10=function(_0xc9b9f3,_0x4b96c4){_0xc9b9f3=_0xc9b9f3-0x0;var _0x2e4a9a=_0xb10b[_0xc9b9f3];return _0x2e4a9a;};'use strict';var Sequelize=require(_0xbb10('0x0'));var moment=require('moment');module[_0xbb10('0x1')]={'closed':{'type':Sequelize[_0xbb10('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbb10('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbb10('0x4')]},'phone':{'type':Sequelize[_0xbb10('0x4')]},'read1stAt':{'type':Sequelize[_0xbb10('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbb10('0x5')]('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbb10('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb10('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index dd6e47b..0ac3368 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 _0x9aea=['sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','fullname','Tags','TagIds','split','forEach','push','catch','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','body','keys','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','options','create','update','describe','addMessage','SmsMessage','ids','omit','findOne','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','spread','smsInteractionTags:save','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','closed','closedAt','out','renderFile','views','downloadInteraction.html','toFile','transcript-','download','log','err','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x425786,_0x59fea8){var _0x2a6d04=function(_0x95aa7f){while(--_0x95aa7f){_0x425786['push'](_0x425786['shift']());}};_0x2a6d04(++_0x59fea8);}(_0x9aea,0xdd));var _0xa9ae=function(_0x2eaf12,_0x39c101){_0x2eaf12=_0x2eaf12-0x0;var _0x4abb26=_0x9aea[_0x2eaf12];return _0x4abb26;};'use strict';var pdf=require(_0xa9ae('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa9ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9ae('0x2'));var rp=require(_0xa9ae('0x3'));var moment=require('moment');var BPromise=require(_0xa9ae('0x4'));var Mustache=require(_0xa9ae('0x5'));var util=require(_0xa9ae('0x6'));var path=require(_0xa9ae('0x7'));var sox=require(_0xa9ae('0x8'));var csv=require('to-csv');var ejs=require(_0xa9ae('0x9'));var fs=require('fs');var _=require(_0xa9ae('0xa'));var squel=require(_0xa9ae('0xb'));var crypto=require('crypto');var jsforce=require(_0xa9ae('0xc'));var deskjs=require(_0xa9ae('0xd'));var toCsv=require(_0xa9ae('0xe'));var querystring=require(_0xa9ae('0xf'));var Papa=require(_0xa9ae('0x10'));var Redis=require(_0xa9ae('0x11'));var authService=require(_0xa9ae('0x12'));var qs=require(_0xa9ae('0x13'));var as=require(_0xa9ae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9ae('0x15'))('api');var utils=require(_0xa9ae('0x16'));var config=require(_0xa9ae('0x17'));var db=require(_0xa9ae('0x18'))['db'];config[_0xa9ae('0x19')]=_[_0xa9ae('0x1a')](config[_0xa9ae('0x19')],{'host':_0xa9ae('0x1b'),'port':0x18eb});var socket=require(_0xa9ae('0x1c'))(new Redis(config['redis']));require(_0xa9ae('0x1d'))[_0xa9ae('0x1e')](socket);function respondWithStatusCode(_0x10882e,_0x3f7f61){_0x3f7f61=_0x3f7f61||0xcc;return function(_0x4d0bd9){if(_0x4d0bd9){return _0x10882e[_0xa9ae('0x1f')](_0x3f7f61);}return _0x10882e[_0xa9ae('0x20')](_0x3f7f61)[_0xa9ae('0x21')]();};}function respondWithResult(_0x40b756,_0x77b0a4){_0x77b0a4=_0x77b0a4||0xc8;return function(_0xddb095){if(_0xddb095){return _0x40b756['status'](_0x77b0a4)[_0xa9ae('0x22')](_0xddb095);}};}function respondWithFilteredResult(_0x42a98c,_0x3e31d9){return function(_0x4ac5a6){if(_0x4ac5a6){var _0x4dbb30=_0x4ac5a6[_0xa9ae('0x23')],_0xb078d2=_0x3e31d9[_0xa9ae('0x24')],_0x581345=_0x3e31d9[_0xa9ae('0x24')]+_0x3e31d9[_0xa9ae('0x25')],_0x59e7dd;if(_0x581345>=_0x4dbb30){_0x581345=_0x4dbb30;_0x59e7dd=0xc8;}else{_0x59e7dd=0xce;}_0x42a98c['status'](_0x59e7dd);return _0x42a98c[_0xa9ae('0x26')](_0xa9ae('0x27'),_0xb078d2+'-'+_0x581345+'/'+_0x4dbb30)[_0xa9ae('0x22')](_0x4ac5a6);}return null;};}function patchUpdates(_0x688153){return function(_0x426317){try{jsonpatch[_0xa9ae('0x28')](_0x426317,_0x688153,!![]);}catch(_0x971ee1){return BPromise['reject'](_0x971ee1);}return _0x426317[_0xa9ae('0x29')]();};}function saveUpdates(_0x4ca9a9,_0x49dca9){return function(_0x597222){if(_0x597222){return _0x597222['update'](_0x4ca9a9)[_0xa9ae('0x2a')](function(_0x4edd55){return _0x4edd55;});}return null;};}function removeEntity(_0x13fb05,_0x5093ad){return function(_0x2ff25c){if(_0x2ff25c){return _0x2ff25c[_0xa9ae('0x2b')]()[_0xa9ae('0x2a')](function(){_0x13fb05[_0xa9ae('0x20')](0xcc)[_0xa9ae('0x21')]();});}};}function handleEntityNotFound(_0x3f3f97,_0x23c1ec){return function(_0x5e82f1){if(!_0x5e82f1){_0x3f3f97[_0xa9ae('0x1f')](0x194);}return _0x5e82f1;};}function handleError(_0x3873aa,_0x2aac9e){_0x2aac9e=_0x2aac9e||0x1f4;return function(_0xfe9ef1){logger[_0xa9ae('0x2c')](_0xfe9ef1[_0xa9ae('0x2d')]);if(_0xfe9ef1[_0xa9ae('0x2e')]){delete _0xfe9ef1['name'];}_0x3873aa['status'](_0x2aac9e)[_0xa9ae('0x2f')](_0xfe9ef1);};}function getInteractionUsers(_0x3c324e,_0x3d1131){return new BPromise(function(_0x3d84d7,_0x74cd94){try{if(_0x3d1131[_0x3c324e['id']]){_0x3c324e['Users']=_['map'](_0x3d1131[_0x3c324e['id']],function(_0x1892b5){return{'id':_0x1892b5['id'],'fullname':_0x1892b5[_0xa9ae('0x30')]};});}}catch(_0x372ec7){_0x74cd94(_0x372ec7);}_0x3d84d7(_0x3c324e);});}function getInteractionTags(_0x3a48b7,_0x314969){return new BPromise(function(_0x36bc28,_0x5d0c84){try{if(_0x3a48b7['TagIds']){_0x3a48b7[_0xa9ae('0x31')]=[];_0x3a48b7[_0xa9ae('0x32')][_0xa9ae('0x33')](',')[_0xa9ae('0x34')](function(_0x36c4d5){_0x3a48b7[_0xa9ae('0x31')][_0xa9ae('0x35')](_0x314969[_0x36c4d5]);});}delete _0x3a48b7[_0xa9ae('0x32')];}catch(_0x5c4f79){_0x5d0c84(_0x5c4f79);}_0x36bc28(_0x3a48b7);});}function updateSmsInteraction(_0x220858,_0x4ea36a,_0x24cc1b){return new BPromise(function(_0x107ef8,_0x3a701b){return getInteractionUsers(_0x220858,_0x24cc1b)['then'](function(_0x45afe6){return getInteractionTags(_0x45afe6,_0x4ea36a);})[_0xa9ae('0x2a')](function(_0x383511){_0x107ef8(_0x383511);})[_0xa9ae('0x36')](function(_0x353227){_0x3a701b(_0x353227);});});}exports['index']=function(_0xeb1639,_0xa0730a){var _0x44053a={},_0x52fdfa={},_0x4e9710={'count':0x0,'rows':[]};var _0x2155c8=_[_0xa9ae('0x37')](db[_0xa9ae('0x38')][_0xa9ae('0x39')],function(_0x484f67){return{'name':_0x484f67[_0xa9ae('0x3a')],'type':_0x484f67[_0xa9ae('0x3b')][_0xa9ae('0x3c')]};});_0x52fdfa[_0xa9ae('0x3d')]=_[_0xa9ae('0x37')](_0x2155c8,'name');_0x52fdfa[_0xa9ae('0x3e')]=_['keys'](_0xeb1639[_0xa9ae('0x3e')]);_0x52fdfa[_0xa9ae('0x3f')]=_[_0xa9ae('0x40')](_0x52fdfa['model'],_0x52fdfa[_0xa9ae('0x3e')]);_0x44053a[_0xa9ae('0x41')]=_[_0xa9ae('0x40')](_0x52fdfa['model'],qs[_0xa9ae('0x42')](_0xeb1639[_0xa9ae('0x3e')]['fields']));_0x44053a[_0xa9ae('0x41')]=_0x44053a['attributes'][_0xa9ae('0x43')]?_0x44053a[_0xa9ae('0x41')]:_0x52fdfa['model'];if(!_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x44')](_0xa9ae('0x45'))){_0x44053a[_0xa9ae('0x25')]=qs[_0xa9ae('0x25')](_0xeb1639[_0xa9ae('0x3e')]['limit']);_0x44053a[_0xa9ae('0x24')]=qs[_0xa9ae('0x24')](_0xeb1639['query']['offset']);}_0x44053a[_0xa9ae('0x46')]=qs[_0xa9ae('0x47')](_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x47')]);_0x44053a['where']=qs[_0xa9ae('0x3f')](_[_0xa9ae('0x48')](_0xeb1639[_0xa9ae('0x3e')],_0x52fdfa[_0xa9ae('0x3f')]),_0x2155c8);var _0x23c91d=[];var _0x2bef06=squel[_0xa9ae('0x49')]()['field']('id')[_0xa9ae('0x4a')](_0xa9ae('0x2e'))['field'](_0xa9ae('0x4b'))['from'](_0xa9ae('0x4c'));var _0x34baa2=squel[_0xa9ae('0x49')]()[_0xa9ae('0x4a')](_0xa9ae('0x4d'))[_0xa9ae('0x4a')](_0xa9ae('0x4e'))['field'](_0xa9ae('0x4f'))[_0xa9ae('0x50')]('user_has_sms_interactions','ui')[_0xa9ae('0x51')](_0xa9ae('0x52'),'u',_0xa9ae('0x53'));var _0x275b3a=squel[_0xa9ae('0x49')]()[_0xa9ae('0x50')]('sms_interactions','i')[_0xa9ae('0x51')]('cm_contacts','c',_0xa9ae('0x54'))[_0xa9ae('0x51')]('users','o','o.id\x20=\x20i.UserId')[_0xa9ae('0x51')](_0xa9ae('0x55'),'a',_0xa9ae('0x56'))[_0xa9ae('0x51')](_0xa9ae('0x57'),'me',_0xa9ae('0x58'))[_0xa9ae('0x51')](_0xa9ae('0x59'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xa9ae('0x4c'),'t',_0xa9ae('0x5a'));var _0x4efe55=squel[_0xa9ae('0x5b')]();var _0x38f24c=[];var _0x70b0a0=squel[_0xa9ae('0x5b')]();var _0x36636f;if(_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x5c')]){_0x36636f=as[_0xa9ae('0x5d')](_0xeb1639['query'][_0xa9ae('0x5c')]);var _0x1713cb=_0x36636f['sqlOperator'];for(var _0x128f88=0x0;_0x128f88<_0x36636f['conditions']['length'];_0x128f88++){var _0x5368bd=_0x36636f[_0xa9ae('0x5e')][_0x128f88];var _0x73e66b='i';var _0x5cf8b2=_['find'](_0x2155c8,['name',_0x5368bd[_0xa9ae('0x4a')]]);if(!_0x5cf8b2){switch(_0x5368bd['field']){case _0xa9ae('0x5f'):if(_0x5368bd[_0xa9ae('0x60')]==0x1){_0x275b3a['having']('`'+_0x5368bd[_0xa9ae('0x4a')]+'`\x20=\x200');}else{_0x275b3a[_0xa9ae('0x61')]('`'+_0x5368bd[_0xa9ae('0x4a')]+_0xa9ae('0x62'));}break;case _0xa9ae('0x63'):if(_0x5368bd[_0xa9ae('0x64')]===_0xa9ae('0x65')){if(_0x5368bd[_0xa9ae('0x60')][_0xa9ae('0x33')]('\x20')[_0xa9ae('0x43')]>0x1){_0x4efe55[_0x1713cb](_0xa9ae('0x66'),qs[_0xa9ae('0x67')](_0x5368bd[_0xa9ae('0x60')]),null);}else{var _0x564eb8='%'+_0x5368bd[_0xa9ae('0x60')]+'%';_0x4efe55[_0x1713cb](_0xa9ae('0x68'),_0x564eb8,_0x564eb8,_0x564eb8);}}else{_0x5cf8b2=_[_0xa9ae('0x69')](_0x2155c8,[_0xa9ae('0x2e'),_0xa9ae('0x6a')]);_0x5368bd['field']='ContactId';_0x5b2f69=as[_0xa9ae('0x6b')](_0x73e66b,_0x5cf8b2[_0xa9ae('0x3b')],_0x5368bd);_0x4efe55[_0x1713cb](_0x5b2f69['text'],_0x5b2f69['value'][_0xa9ae('0x6c')],_0x5b2f69['value'][_0xa9ae('0x21')]);}break;case _0xa9ae('0x6d'):var _0x1a1605=_0x5368bd['value'][_0xa9ae('0x33')](',')['map'](function(_0x167618){return Number(_0x167618);});_0x1a1605['forEach'](function(_0x157628){_0x70b0a0['or'](_0xa9ae('0x6e'),'%,'+_0x157628+',%');});_0x38f24c=_[_0xa9ae('0x6f')](_0x38f24c,_0x1a1605);break;case _0xa9ae('0x70'):if(_0x5368bd[_0xa9ae('0x64')]===_0xa9ae('0x65')){_0x4efe55[_0x1713cb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5368bd[_0xa9ae('0x60')]+'%',null);}else{_0x5cf8b2=_[_0xa9ae('0x69')](_0x2155c8,[_0xa9ae('0x2e'),_0xa9ae('0x71')]);_0x5368bd['field']=_0xa9ae('0x71');_0x5b2f69=as[_0xa9ae('0x6b')](_0x73e66b,_0x5cf8b2[_0xa9ae('0x3b')],_0x5368bd);_0x4efe55[_0x1713cb](_0x5b2f69[_0xa9ae('0x72')],_0x5b2f69[_0xa9ae('0x60')][_0xa9ae('0x6c')],_0x5b2f69[_0xa9ae('0x60')][_0xa9ae('0x21')]);}break;case _0xa9ae('0x73'):_0x5b2f69=as[_0xa9ae('0x6b')]('me',null,_0x5368bd);_0x4efe55[_0x1713cb](_0x5b2f69['text'],_0x5b2f69[_0xa9ae('0x60')][_0xa9ae('0x6c')],_0x5b2f69[_0xa9ae('0x60')][_0xa9ae('0x21')]);break;}}else{var _0x5b2f69=as[_0xa9ae('0x6b')](_0x73e66b,_0x5cf8b2[_0xa9ae('0x3b')],_0x5368bd);_0x4efe55[_0x1713cb](_0x5b2f69['text'],_0x5b2f69[_0xa9ae('0x60')][_0xa9ae('0x6c')],_0x5b2f69[_0xa9ae('0x60')]['end']);}}}else{var _0x532872=_(_0xeb1639[_0xa9ae('0x3e')])[_0xa9ae('0x74')]()['map'](function(_0x51baf7){return _[_0xa9ae('0x75')](_0x2155c8,[_0xa9ae('0x2e'),_0x51baf7])?_0x51baf7:undefined;})[_0xa9ae('0x76')]()['value']();if(!_[_0xa9ae('0x77')](_0x532872)){_0x532872[_0xa9ae('0x34')](function(_0x27ef51){if(_0x27ef51===_0xa9ae('0x78')){_0x275b3a[_0xa9ae('0x79')](_0xa9ae('0x7a'),[][_0xa9ae('0x7b')](_0xeb1639[_0xa9ae('0x3e')][_0x27ef51]));}else if(_0x27ef51===_0xa9ae('0x7c')){var _0x110405=JSON['parse'](_0xeb1639['query'][_0x27ef51])[_0xa9ae('0x7d')];var _0x1a632a=JSON[_0xa9ae('0x7e')](_0xeb1639['query'][_0x27ef51])[_0xa9ae('0x7f')];_0x275b3a[_0xa9ae('0x79')](_0xa9ae('0x80'),_0x110405,_0x1a632a);}else{if(_0xeb1639['query'][_0x27ef51]==='null'){_0x275b3a[_0xa9ae('0x79')]('i.'+_0x27ef51+'\x20IS\x20NULL');}else{_0x275b3a[_0xa9ae('0x79')]('i.'+_0x27ef51+_0xa9ae('0x81'),_0xeb1639[_0xa9ae('0x3e')][_0x27ef51]);}}});}if(_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x82')]){if(_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x82')]==0x1){_0x275b3a[_0xa9ae('0x61')](_0xa9ae('0x83'));}else{_0x275b3a[_0xa9ae('0x61')]('`unreadMessages`\x20>\x200');}}if(_0xeb1639[_0xa9ae('0x3e')]['tag']){_0x38f24c=_[_0xa9ae('0x84')](_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x85')])?_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x85')]:new Array(_0xeb1639['query'][_0xa9ae('0x85')]);_0x38f24c[_0xa9ae('0x34')](function(_0x13b8aa){_0x70b0a0['or'](_0xa9ae('0x6e'),'%,'+_0x13b8aa+',%');});}if(_0xeb1639[_0xa9ae('0x3e')]['filter']){var _0x37b505=_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x86')][_0xa9ae('0x87')]('\x5c','\x5c\x5c')[_0xa9ae('0x87')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x37b505)){_0x4efe55['or'](_0xa9ae('0x88'),_0x37b505+'%')['or'](_0xa9ae('0x89'),_0x37b505+'%');}else{_0x4efe55['or'](_0xa9ae('0x8a'),qs[_0xa9ae('0x67')](_0x37b505))['or'](_0xa9ae('0x8b'),_0x37b505+'%');}}}_0x275b3a['where'](_0x4efe55);_0x275b3a['group'](_0xa9ae('0x8c'));var _0x1a4f51={'type':db['Sequelize']['QueryTypes'][_0xa9ae('0x8d')],'raw':!![]};var _0x322962=_0x275b3a[_0xa9ae('0x8e')]();_0x322962[_0xa9ae('0x4a')]('i.id');_0x322962['field'](_0xa9ae('0x8f'),'unreadMessages');if(_0x44053a['order']){_0x44053a['order']['forEach'](function(_0x23761c){_0x275b3a[_0xa9ae('0x46')]('i.'+_0x23761c[0x0],_0x23761c[0x1]===_0xa9ae('0x90')?![]:!![]);});}if(!_[_0xa9ae('0x77')](_0x38f24c)){_0x275b3a['having'](_0x70b0a0);_0x322962[_0xa9ae('0x79')](_0xa9ae('0x91'),_0x38f24c);}BPromise['resolve']()[_0xa9ae('0x2a')](function(){if(!_0x36636f){if(_0xeb1639['query'][_0xa9ae('0x78')]||_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x92')])return;_0x322962[_0xa9ae('0x79')](_0xa9ae('0x93'));_0x275b3a[_0xa9ae('0x79')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0xeb1639[_0xa9ae('0x94')][_0xa9ae('0x95')]({'attributes':['id'],'raw':!![]})[_0xa9ae('0x2a')](function(_0x11c9a8){if(_[_0xa9ae('0x77')](_0x11c9a8)){_0x322962[_0xa9ae('0x79')](_0xa9ae('0x96'));_0x275b3a[_0xa9ae('0x79')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x322962[_0xa9ae('0x79')](_0xa9ae('0x7a'),_[_0xa9ae('0x37')](_0x11c9a8,'id'));_0x275b3a[_0xa9ae('0x79')](_0xa9ae('0x7a'),_[_0xa9ae('0x37')](_0x11c9a8,'id'));}});})[_0xa9ae('0x2a')](function(){db[_0xa9ae('0x97')][_0xa9ae('0x3e')](_0x322962[_0xa9ae('0x98')](),_0x1a4f51)[_0xa9ae('0x2a')](function(_0x3b92d7){_0x4e9710[_0xa9ae('0x23')]=_0x3b92d7[_0xa9ae('0x43')];if(_0x4e9710[_0xa9ae('0x23')]===0x0)return[];return db[_0xa9ae('0x97')][_0xa9ae('0x3e')](_0x2bef06[_0xa9ae('0x98')](),_0x1a4f51)[_0xa9ae('0x2a')](function(_0x4ac97a){_0x23c91d=_[_0xa9ae('0x99')](_0x4ac97a,'id');_0x1a4f51=_[_0xa9ae('0x9a')](_0x1a4f51,{'model':db[_0xa9ae('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xeb1639[_0xa9ae('0x3e')][_0xa9ae('0x42')]){_0x44053a[_0xa9ae('0x41')][_0xa9ae('0x34')](function(_0x1f2d7e){_0x275b3a[_0xa9ae('0x4a')]('i.'+_0x1f2d7e);});}else{_0x275b3a['field'](_0xa9ae('0x8f'),_0xa9ae('0x5f'));_0x275b3a[_0xa9ae('0x4a')](_0xa9ae('0x9b'),_0xa9ae('0x9c'));_0x275b3a['field']('a.mandatoryDisposition',_0xa9ae('0x9d'));_0x275b3a[_0xa9ae('0x4a')]('i.*');_0x275b3a[_0xa9ae('0x4a')](_0xa9ae('0x9e'),_0xa9ae('0x9f'));_0x275b3a[_0xa9ae('0x4a')](_0xa9ae('0xa0'),_0xa9ae('0xa1'));_0x275b3a['field'](_0xa9ae('0xa2'),_0xa9ae('0xa3'));_0x275b3a[_0xa9ae('0x4a')](_0xa9ae('0xa4'),_0xa9ae('0xa5'));_0x275b3a['field'](_0xa9ae('0xa6'),'Contact.mobile');_0x275b3a[_0xa9ae('0x4a')]('c.fax',_0xa9ae('0xa7'));_0x275b3a[_0xa9ae('0x4a')]('o.fullname','Owner.fullname');_0x275b3a[_0xa9ae('0x4a')](_0xa9ae('0xa8'),_0xa9ae('0xa9'));_0x275b3a[_0xa9ae('0x4a')](_0xa9ae('0xaa'),_0xa9ae('0x32'));}if(_0x44053a[_0xa9ae('0x25')])_0x275b3a['limit'](_0x44053a[_0xa9ae('0x25')]);if(_0x44053a['offset'])_0x275b3a[_0xa9ae('0x24')](_0x44053a[_0xa9ae('0x24')]);return db['sequelize']['query'](_0x275b3a[_0xa9ae('0x98')](),_0x1a4f51);})[_0xa9ae('0x2a')](function(_0x475329){_0x34baa2[_0xa9ae('0x79')](_0xa9ae('0xab'),_[_0xa9ae('0x37')](_0x475329,'id'));return db[_0xa9ae('0x97')]['query'](_0x34baa2[_0xa9ae('0x98')](),_0x1a4f51)[_0xa9ae('0x2a')](function(_0x4a241a){var _0x17ddc7=_[_0xa9ae('0xac')](_0x4a241a,'SmsInteractionId');var _0x21b2ef=[];_0x475329[_0xa9ae('0x34')](function(_0x2660a6){_0x21b2ef['push'](updateSmsInteraction(_0x2660a6,_0x23c91d,_0x17ddc7));});return BPromise[_0xa9ae('0xad')](_0x21b2ef);});});})[_0xa9ae('0x2a')](function(_0x63dd9){_0x4e9710[_0xa9ae('0xae')]=_0x63dd9;return _0x4e9710;})[_0xa9ae('0x2a')](respondWithFilteredResult(_0xa0730a,_0x44053a));})[_0xa9ae('0x36')](handleError(_0xa0730a,null));};exports[_0xa9ae('0xaf')]=function(_0x597b54,_0x49e4d3){var _0x1c4d8c={'raw':![],'where':{'id':_0x597b54[_0xa9ae('0xb0')]['id']}},_0x197561={};_0x197561[_0xa9ae('0x3d')]=_[_0xa9ae('0x74')](db['SmsInteraction']['rawAttributes']);_0x197561[_0xa9ae('0x3e')]=_[_0xa9ae('0x74')](_0x597b54[_0xa9ae('0x3e')]);_0x197561[_0xa9ae('0x3f')]=_[_0xa9ae('0x40')](_0x197561[_0xa9ae('0x3d')],_0x197561[_0xa9ae('0x3e')]);_0x1c4d8c[_0xa9ae('0x41')]=_[_0xa9ae('0x40')](_0x197561['model'],qs[_0xa9ae('0x42')](_0x597b54[_0xa9ae('0x3e')][_0xa9ae('0x42')]));_0x1c4d8c[_0xa9ae('0x41')]=_0x1c4d8c[_0xa9ae('0x41')][_0xa9ae('0x43')]?_0x1c4d8c[_0xa9ae('0x41')]:_0x197561[_0xa9ae('0x3d')];if(_0x597b54['query'][_0xa9ae('0xb1')]){_0x1c4d8c[_0xa9ae('0xb2')]=[{'all':!![]}];}_0x1c4d8c=_['merge']({},_0x1c4d8c,_0x597b54[_0xa9ae('0xb3')]);return db[_0xa9ae('0x38')][_0xa9ae('0x69')](_0x1c4d8c)[_0xa9ae('0x2a')](handleEntityNotFound(_0x49e4d3,null))['then'](respondWithResult(_0x49e4d3,null))[_0xa9ae('0x36')](handleError(_0x49e4d3,null));};exports[_0xa9ae('0xb4')]=function(_0x328c6b,_0x3f7206){return db[_0xa9ae('0x38')][_0xa9ae('0xb4')](_0x328c6b['body'],{})['then'](respondWithResult(_0x3f7206,0xc9))[_0xa9ae('0x36')](handleError(_0x3f7206,null));};exports[_0xa9ae('0xb5')]=function(_0x2d9a34,_0xadad78){if(_0x2d9a34['body']['id']){delete _0x2d9a34[_0xa9ae('0x73')]['id'];}return db[_0xa9ae('0x38')][_0xa9ae('0x69')]({'where':{'id':_0x2d9a34[_0xa9ae('0xb0')]['id']}})[_0xa9ae('0x2a')](handleEntityNotFound(_0xadad78,null))[_0xa9ae('0x2a')](saveUpdates(_0x2d9a34[_0xa9ae('0x73')],null))[_0xa9ae('0x2a')](respondWithResult(_0xadad78,null))[_0xa9ae('0x36')](handleError(_0xadad78,null));};exports[_0xa9ae('0x2b')]=function(_0x2a4ad3,_0x4a029d){return db[_0xa9ae('0x38')][_0xa9ae('0x69')]({'where':{'id':_0x2a4ad3[_0xa9ae('0xb0')]['id']}})[_0xa9ae('0x2a')](handleEntityNotFound(_0x4a029d,null))[_0xa9ae('0x2a')](removeEntity(_0x4a029d,null))[_0xa9ae('0x36')](handleError(_0x4a029d,null));};exports[_0xa9ae('0xb6')]=function(_0x8a8e46,_0x1b0171){return db['SmsInteraction'][_0xa9ae('0xb6')]()[_0xa9ae('0x2a')](respondWithResult(_0x1b0171,null))[_0xa9ae('0x36')](handleError(_0x1b0171,null));};exports[_0xa9ae('0xb7')]=function(_0x10876f,_0x43aab1,_0x3643d0){return db[_0xa9ae('0xb8')][_0xa9ae('0x69')]({'where':{'id':_0x10876f['params']['id']}})[_0xa9ae('0x2a')](handleEntityNotFound(_0x43aab1,null))[_0xa9ae('0x2a')](function(_0x2664ba){if(_0x2664ba){return _0x2664ba[_0xa9ae('0xb7')](_0x10876f['body'][_0xa9ae('0xb9')],_[_0xa9ae('0xba')](_0x10876f[_0xa9ae('0x73')],['ids','id'])||{});}})['then'](respondWithResult(_0x43aab1,null))['catch'](handleError(_0x43aab1,null));};exports['getMessages']=function(_0x5158c0,_0x577399,_0x5a3f96){var _0x317acd={'raw':![],'where':{}};var _0x3daa76={};var _0x39cf2c={'count':0x0,'rows':[]};return db[_0xa9ae('0x38')][_0xa9ae('0xbb')]({'where':{'id':_0x5158c0['params']['id']}})[_0xa9ae('0x2a')](handleEntityNotFound(_0x577399,null))[_0xa9ae('0x2a')](function(_0xb51023){if(_0xb51023){_0x3daa76['model']=_['keys'](db[_0xa9ae('0xb8')][_0xa9ae('0x39')]);_0x3daa76[_0xa9ae('0x3e')]=_[_0xa9ae('0x74')](_0x5158c0['query']);_0x3daa76['filters']=_[_0xa9ae('0x40')](_0x3daa76[_0xa9ae('0x3d')],_0x3daa76['query']);_0x317acd[_0xa9ae('0x41')]=_[_0xa9ae('0x40')](_0x3daa76[_0xa9ae('0x3d')],qs[_0xa9ae('0x42')](_0x5158c0['query'][_0xa9ae('0x42')]));_0x317acd['attributes']=_0x317acd['attributes'][_0xa9ae('0x43')]?_0x317acd[_0xa9ae('0x41')]:_0x3daa76[_0xa9ae('0x3d')];if(!_0x5158c0[_0xa9ae('0x3e')]['hasOwnProperty'](_0xa9ae('0x45'))){_0x317acd[_0xa9ae('0x25')]=qs[_0xa9ae('0x25')](_0x5158c0[_0xa9ae('0x3e')][_0xa9ae('0x25')]);_0x317acd[_0xa9ae('0x24')]=qs['offset'](_0x5158c0[_0xa9ae('0x3e')][_0xa9ae('0x24')]);}_0x317acd['order']=qs[_0xa9ae('0x47')](_0x5158c0[_0xa9ae('0x3e')][_0xa9ae('0x47')]);_0x317acd[_0xa9ae('0x79')]=qs[_0xa9ae('0x3f')](_['pick'](_0x5158c0[_0xa9ae('0x3e')],_0x3daa76['filters']));_0x317acd[_0xa9ae('0x79')][_0xa9ae('0xbc')]=_0xb51023['id'];if(_0x5158c0[_0xa9ae('0x3e')][_0xa9ae('0x86')]){_0x317acd[_0xa9ae('0x79')]=_[_0xa9ae('0x9a')](_0x317acd[_0xa9ae('0x79')],{'$or':_[_0xa9ae('0x37')](_0x317acd[_0xa9ae('0x41')],function(_0x5e425c){var _0x1dc544={};_0x1dc544[_0x5e425c]={'$like':'%'+_0x5158c0[_0xa9ae('0x3e')][_0xa9ae('0x86')]+'%'};return _0x1dc544;})});}if(_0x5158c0[_0xa9ae('0x3e')][_0xa9ae('0x7d')]){var _0x5c1c14=_0x5158c0['query']['$gte'][_0xa9ae('0x33')](',');var _0x2dbd26={};_0x2dbd26[_0x5c1c14[0x0]]={'$gte':moment(_0x5c1c14[0x1])[_0xa9ae('0xbd')](_0xa9ae('0xbe'))};_0x317acd[_0xa9ae('0x79')]=_[_0xa9ae('0x9a')](_0x317acd[_0xa9ae('0x79')],_0x2dbd26);}_0x317acd=_[_0xa9ae('0x9a')]({},_0x317acd,_0x5158c0[_0xa9ae('0xb3')]);return db[_0xa9ae('0xb8')][_0xa9ae('0x23')]({'where':_0x317acd[_0xa9ae('0x79')]})[_0xa9ae('0x2a')](function(_0x2336c7){_0x39cf2c['count']=_0x2336c7;if(_0x5158c0[_0xa9ae('0x3e')][_0xa9ae('0xb1')]){_0x317acd['include']=[{'all':!![]}];}return db[_0xa9ae('0xb8')]['findAll'](_0x317acd);})[_0xa9ae('0x2a')](function(_0x2de17){_0x39cf2c[_0xa9ae('0xae')]=_0x2de17;return _0x39cf2c;});}})[_0xa9ae('0x2a')](respondWithFilteredResult(_0x577399,_0x317acd))[_0xa9ae('0x36')](handleError(_0x577399,null));};exports['addTags']=function(_0xea07ab,_0x50c899,_0x4b22d9){return db[_0xa9ae('0x38')]['find']({'where':{'id':_0xea07ab[_0xa9ae('0xb0')]['id']}})['then'](handleEntityNotFound(_0x50c899,null))[_0xa9ae('0x2a')](function(_0x1c2637){if(_0x1c2637){return _0x1c2637['setTags'](_0xea07ab['body'][_0xa9ae('0xb9')],_[_0xa9ae('0xba')](_0xea07ab[_0xa9ae('0x73')],[_0xa9ae('0xb9'),'id'])||{})[_0xa9ae('0xbf')](function(){return db[_0xa9ae('0x6d')]['findAll']({'attributes':['id','name',_0xa9ae('0x4b')],'where':{'id':_0xea07ab[_0xa9ae('0x73')][_0xa9ae('0xb9')]}});})[_0xa9ae('0x2a')](function(_0x4bbaf3){socket['emit'](_0xa9ae('0xc0'),{'id':Number(_0xea07ab['params']['id']),'tags':_0x4bbaf3||[]});return{'id':Number(_0xea07ab[_0xa9ae('0xb0')]['id']),'tags':_0x4bbaf3||[]};});}})[_0xa9ae('0x2a')](respondWithResult(_0x50c899,null))['catch'](handleError(_0x50c899,null));};exports[_0xa9ae('0xc1')]=function(_0x54e935,_0x2d3108,_0x1107d3){return db[_0xa9ae('0x38')]['find']({'where':{'id':_0x54e935['params']['id']}})[_0xa9ae('0x2a')](handleEntityNotFound(_0x2d3108,null))[_0xa9ae('0x2a')](function(_0x3b49ef){if(_0x3b49ef){return _0x3b49ef[_0xa9ae('0xc1')](_0x54e935[_0xa9ae('0x3e')]['ids']);}})[_0xa9ae('0x2a')](respondWithStatusCode(_0x2d3108,null))[_0xa9ae('0x36')](handleError(_0x2d3108,null));};exports['download']=function(_0x1207ac,_0x996557){var _0x533834=moment()[_0xa9ae('0xc2')]()[_0xa9ae('0x98')]();var _0x3636b1=path[_0xa9ae('0xc3')](config[_0xa9ae('0xc4')],_0xa9ae('0xc5'),_0xa9ae('0xc6'),_0xa9ae('0xc7'));var _0x3e17ce=path[_0xa9ae('0xc3')](config[_0xa9ae('0xc4')],_0xa9ae('0xc5'),_0xa9ae('0xc6'),'attachments');var _0x5ca4f2=path[_0xa9ae('0xc3')](_0x3636b1,_0x533834);var _0x3151c5=util['format'](_0xa9ae('0xc8'),_0x1207ac['params']['id'],_0x533834);var _0x32e396=path[_0xa9ae('0xc3')](_0x3636b1,_0x3151c5);var _0x388ccd=[];_0x388ccd[_0xa9ae('0x35')]({'model':db['User'],'as':_0xa9ae('0x70'),'attributes':['id',_0xa9ae('0x30')],'raw':!![]});_0x388ccd['push']({'model':db[_0xa9ae('0xc9')],'as':_0xa9ae('0x63'),'attributes':['id',_0xa9ae('0xca'),_0xa9ae('0xcb')],'raw':!![]});var _0x441063=[{'model':db['SmsMessage'],'as':_0xa9ae('0xcc'),'attributes':['id',_0xa9ae('0x73'),_0xa9ae('0x7c'),_0xa9ae('0xcd'),_0xa9ae('0xce'),_0xa9ae('0x82')],'include':_0x388ccd}];_0x441063['push']({'model':db[_0xa9ae('0xcf')],'as':_0xa9ae('0xd0'),'attributes':['id',_0xa9ae('0x2e')]});_0x441063[_0xa9ae('0x35')]({'model':db[_0xa9ae('0x70')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xa9ae('0x69')]({'where':{'id':_0x1207ac[_0xa9ae('0xb0')]['id']},'include':_0x441063})[_0xa9ae('0x2a')](handleEntityNotFound(_0x996557,null))[_0xa9ae('0x2a')](function(_0x19a8bf){if(_0x19a8bf){var _0x59ca3a=_0x19a8bf[_0xa9ae('0xd1')]({'plain':!![]});fs[_0xa9ae('0xd2')](_0x5ca4f2);var _0x3b4c59={'format':'A4','border':'10px','header':{'height':_0xa9ae('0xd3'),'contents':{'first':_0xa9ae('0xd4')}},'footer':{'height':_0xa9ae('0xd5'),'contents':{'default':util[_0xa9ae('0xbd')](_0xa9ae('0xd6'),util[_0xa9ae('0xbd')](_0xa9ae('0xd7'),_0xa9ae('0xd8'),_0x59ca3a['id']),moment()[_0xa9ae('0xbd')]('YYYY-MM-DD')[_0xa9ae('0x98')]())}}};var _0x421c19={'channel':_0xa9ae('0xd8'),'account':_0x59ca3a['Account'][_0xa9ae('0x2e')],'agent':_0x59ca3a['Owner']?_0x59ca3a[_0xa9ae('0xd9')][_0xa9ae('0x30')]:'N.A.','createdAt':moment(_0x59ca3a[_0xa9ae('0x7c')])[_0xa9ae('0xbd')](_0xa9ae('0xbe'))[_0xa9ae('0x98')](),'closedAt':_0x59ca3a[_0xa9ae('0xda')]?moment(_0x59ca3a[_0xa9ae('0xdb')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa9ae('0x98')]():'','disposition':_0x59ca3a['disposition'],'messages':_(_0x59ca3a[_0xa9ae('0xcc')])[_0xa9ae('0x86')]({'secret':![]})[_0xa9ae('0x37')](function(_0x190711){return{'date':moment(_0x190711[_0xa9ae('0x7c')])[_0xa9ae('0xbd')](_0xa9ae('0xbe'))['toString'](),'sender':_0x190711[_0xa9ae('0xcd')]===_0xa9ae('0xdc')?_0x190711[_0xa9ae('0x70')]?_0x190711['User'][_0xa9ae('0x30')]:'System':_0x190711[_0xa9ae('0x63')][_0xa9ae('0xca')]+(_0x190711['Contact'][_0xa9ae('0xcb')]?'\x20'+_0x190711[_0xa9ae('0x63')][_0xa9ae('0xcb')]:''),'body':_0x190711[_0xa9ae('0x73')],'direction':_0x190711[_0xa9ae('0xcd')]===_0xa9ae('0xdc')?'A':'C','secret':_0x190711[_0xa9ae('0xce')],'read':_0x190711[_0xa9ae('0x82')]};})[_0xa9ae('0x60')]()};return ejs[_0xa9ae('0xdd')](path[_0xa9ae('0xc3')](config[_0xa9ae('0xc4')],'server',_0xa9ae('0xde'),_0xa9ae('0xdf')),{'interaction':_0x421c19})[_0xa9ae('0x2a')](function(_0x4b33bd){return new BPromise(function(_0x33d940,_0x117ef6){pdf[_0xa9ae('0xb4')](_0x4b33bd,_0x3b4c59)[_0xa9ae('0xe0')](path['join'](_0x5ca4f2,_0xa9ae('0xe1')+_0x59ca3a['id']+'-'+_0x533834+'.pdf'),function(_0x4e9669,_0x284036){if(_0x4e9669)return _0x117ef6(_0x4e9669);_0x33d940(_0x284036);});});})[_0xa9ae('0x2a')](function(){return new BPromise(function(_0x27df70,_0xcb03ba){zipdir(_0x5ca4f2,{'saveTo':_0x32e396},function(_0x1209dc,_0x563d08){if(_0x1209dc)return _0xcb03ba(_0x1209dc);return _0x27df70(_0x563d08);});})['then'](function(){return new BPromise(function(_0x414613,_0x415b8e){rimraf(_0x5ca4f2,function(_0x4cc1ae){if(_0x4cc1ae)_0x415b8e(_0x4cc1ae);return _0x414613();});});})[_0xa9ae('0x2a')](function(){return _0x996557[_0xa9ae('0xe2')](_0x32e396,_0x3151c5,function(_0x3d1553){if(_0x3d1553){console[_0xa9ae('0xe3')](_0xa9ae('0xe4'),_0x3d1553);}else{fs['unlinkSync'](_0x32e396);}});});});}else{return _0x996557[_0xa9ae('0x1f')](0xc8);}})[_0xa9ae('0x36')](handleError(_0x996557,null));}; \ No newline at end of file +var _0x1339=['emit','smsInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','CmContact','lastName','direction','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','%s\x20#%d','Sms','YYYY-MM-DD','Account','Owner','closed','disposition','Messages','System','out','secret','renderFile','toFile','transcript-','download','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','register','sendStatus','status','json','count','offset','limit','set','apply','update','then','end','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.fullname','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','forEach','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','text','body','keys','some','compact','isEmpty','SmsAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','show','params','includeAll','options','create','destroy','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows'];(function(_0x137478,_0x19fac4){var _0xe13b71=function(_0x35c3e1){while(--_0x35c3e1){_0x137478['push'](_0x137478['shift']());}};_0xe13b71(++_0x19fac4);}(_0x1339,0x1ed));var _0x9133=function(_0xaf595f,_0x78aed9){_0xaf595f=_0xaf595f-0x0;var _0x5799f7=_0x1339[_0xaf595f];return _0x5799f7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9133('0x0'));var zipdir=require(_0x9133('0x1'));var jsonpatch=require(_0x9133('0x2'));var rp=require(_0x9133('0x3'));var moment=require(_0x9133('0x4'));var BPromise=require(_0x9133('0x5'));var Mustache=require(_0x9133('0x6'));var util=require(_0x9133('0x7'));var path=require('path');var sox=require(_0x9133('0x8'));var csv=require(_0x9133('0x9'));var ejs=require(_0x9133('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x9'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var db=require(_0x9133('0x19'))['db'];config['redis']=_[_0x9133('0x1a')](config[_0x9133('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9133('0x1b')]));require('./smsInteraction.socket')[_0x9133('0x1c')](socket);function respondWithStatusCode(_0x439e1a,_0x17dfd1){_0x17dfd1=_0x17dfd1||0xcc;return function(_0x464ec5){if(_0x464ec5){return _0x439e1a[_0x9133('0x1d')](_0x17dfd1);}return _0x439e1a[_0x9133('0x1e')](_0x17dfd1)['end']();};}function respondWithResult(_0x13f8fc,_0x1e23ce){_0x1e23ce=_0x1e23ce||0xc8;return function(_0x4f4f14){if(_0x4f4f14){return _0x13f8fc[_0x9133('0x1e')](_0x1e23ce)[_0x9133('0x1f')](_0x4f4f14);}};}function respondWithFilteredResult(_0x3b39ec,_0x427663){return function(_0x4a2c4f){if(_0x4a2c4f){var _0x1f3484=_0x4a2c4f[_0x9133('0x20')],_0x573998=_0x427663[_0x9133('0x21')],_0x3c48ef=_0x427663['offset']+_0x427663[_0x9133('0x22')],_0x5d4a77;if(_0x3c48ef>=_0x1f3484){_0x3c48ef=_0x1f3484;_0x5d4a77=0xc8;}else{_0x5d4a77=0xce;}_0x3b39ec['status'](_0x5d4a77);return _0x3b39ec[_0x9133('0x23')]('Content-Range',_0x573998+'-'+_0x3c48ef+'/'+_0x1f3484)['json'](_0x4a2c4f);}return null;};}function patchUpdates(_0x2f7354){return function(_0x577de4){try{jsonpatch[_0x9133('0x24')](_0x577de4,_0x2f7354,!![]);}catch(_0x4c1088){return BPromise['reject'](_0x4c1088);}return _0x577de4['save']();};}function saveUpdates(_0x2e99a1,_0x2dcfb8){return function(_0x4da09c){if(_0x4da09c){return _0x4da09c[_0x9133('0x25')](_0x2e99a1)[_0x9133('0x26')](function(_0xff08d5){return _0xff08d5;});}return null;};}function removeEntity(_0x26190c,_0x4f26e8){return function(_0xdb7a98){if(_0xdb7a98){return _0xdb7a98['destroy']()[_0x9133('0x26')](function(){_0x26190c[_0x9133('0x1e')](0xcc)[_0x9133('0x27')]();});}};}function handleEntityNotFound(_0x14c1cb,_0x4483ef){return function(_0xe829b){if(!_0xe829b){_0x14c1cb[_0x9133('0x1d')](0x194);}return _0xe829b;};}function handleError(_0x313d43,_0x1b6b3e){_0x1b6b3e=_0x1b6b3e||0x1f4;return function(_0x46050b){logger['error'](_0x46050b['stack']);if(_0x46050b[_0x9133('0x28')]){delete _0x46050b[_0x9133('0x28')];}_0x313d43[_0x9133('0x1e')](_0x1b6b3e)[_0x9133('0x29')](_0x46050b);};}function getInteractionUsers(_0x4de894,_0x4ecd9e){return new BPromise(function(_0x3e2404,_0x45966d){try{if(_0x4ecd9e[_0x4de894['id']]){_0x4de894[_0x9133('0x2a')]=_[_0x9133('0x2b')](_0x4ecd9e[_0x4de894['id']],function(_0x390f50){return{'id':_0x390f50['id'],'fullname':_0x390f50[_0x9133('0x2c')]};});}}catch(_0x48c713){_0x45966d(_0x48c713);}_0x3e2404(_0x4de894);});}function getInteractionTags(_0x58afe0,_0x5a27c1){return new BPromise(function(_0x1ad222,_0x4a4a8e){try{if(_0x58afe0[_0x9133('0x2d')]){_0x58afe0[_0x9133('0x2e')]=[];_0x58afe0['TagIds'][_0x9133('0x2f')](',')['forEach'](function(_0xf0aec4){_0x58afe0[_0x9133('0x2e')][_0x9133('0x30')](_0x5a27c1[_0xf0aec4]);});}delete _0x58afe0['TagIds'];}catch(_0x32e95a){_0x4a4a8e(_0x32e95a);}_0x1ad222(_0x58afe0);});}function updateSmsInteraction(_0x41cfbe,_0x3f189c,_0x5f12b9){return new BPromise(function(_0x10cea6,_0x3393a1){return getInteractionUsers(_0x41cfbe,_0x5f12b9)[_0x9133('0x26')](function(_0x4bb7fa){return getInteractionTags(_0x4bb7fa,_0x3f189c);})[_0x9133('0x26')](function(_0x20da68){_0x10cea6(_0x20da68);})[_0x9133('0x31')](function(_0x1471bb){_0x3393a1(_0x1471bb);});});}exports['index']=function(_0x3ccd89,_0xea26a3){var _0x56719e={},_0x49944={},_0x2d256a={'count':0x0,'rows':[]};var _0x593fbe=_[_0x9133('0x2b')](db[_0x9133('0x32')][_0x9133('0x33')],function(_0x3e02d1){return{'name':_0x3e02d1[_0x9133('0x34')],'type':_0x3e02d1[_0x9133('0x35')][_0x9133('0x36')]};});_0x49944[_0x9133('0x37')]=_['map'](_0x593fbe,_0x9133('0x28'));_0x49944[_0x9133('0x38')]=_['keys'](_0x3ccd89[_0x9133('0x38')]);_0x49944[_0x9133('0x39')]=_[_0x9133('0x3a')](_0x49944[_0x9133('0x37')],_0x49944[_0x9133('0x38')]);_0x56719e[_0x9133('0x3b')]=_['intersection'](_0x49944['model'],qs[_0x9133('0x3c')](_0x3ccd89[_0x9133('0x38')][_0x9133('0x3c')]));_0x56719e[_0x9133('0x3b')]=_0x56719e[_0x9133('0x3b')][_0x9133('0x3d')]?_0x56719e[_0x9133('0x3b')]:_0x49944[_0x9133('0x37')];if(!_0x3ccd89[_0x9133('0x38')]['hasOwnProperty'](_0x9133('0x3e'))){_0x56719e[_0x9133('0x22')]=qs[_0x9133('0x22')](_0x3ccd89[_0x9133('0x38')][_0x9133('0x22')]);_0x56719e['offset']=qs[_0x9133('0x21')](_0x3ccd89[_0x9133('0x38')][_0x9133('0x21')]);}_0x56719e[_0x9133('0x3f')]=qs['sort'](_0x3ccd89[_0x9133('0x38')][_0x9133('0x40')]);_0x56719e[_0x9133('0x41')]=qs[_0x9133('0x39')](_[_0x9133('0x42')](_0x3ccd89[_0x9133('0x38')],_0x49944[_0x9133('0x39')]),_0x593fbe);var _0x4ca1a3=[];var _0x7f6cd9=squel['select']()['field']('id')[_0x9133('0x43')](_0x9133('0x28'))[_0x9133('0x43')](_0x9133('0x44'))[_0x9133('0x45')](_0x9133('0x46'));var _0x344120=squel[_0x9133('0x47')]()[_0x9133('0x43')]('u.id')[_0x9133('0x43')](_0x9133('0x48'))[_0x9133('0x43')]('ui.SmsInteractionId')['from'](_0x9133('0x49'),'ui')[_0x9133('0x4a')]('users','u',_0x9133('0x4b'));var _0x3320d1=squel[_0x9133('0x47')]()[_0x9133('0x45')](_0x9133('0x4c'),'i')['left_join'](_0x9133('0x4d'),'c',_0x9133('0x4e'))[_0x9133('0x4a')]('users','o',_0x9133('0x4f'))[_0x9133('0x4a')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0x9133('0x4a')](_0x9133('0x50'),'me',_0x9133('0x51'))[_0x9133('0x4a')](_0x9133('0x52'),'it',_0x9133('0x53'))[_0x9133('0x4a')](_0x9133('0x46'),'t',_0x9133('0x54'));var _0xf07fbb=squel[_0x9133('0x55')]();var _0x2e4d97=[];var _0x4f3092=squel['expr']();var _0xf2e098;if(_0x3ccd89['query'][_0x9133('0x56')]){_0xf2e098=as[_0x9133('0x57')](_0x3ccd89[_0x9133('0x38')][_0x9133('0x56')]);var _0x4ebc85=_0xf2e098[_0x9133('0x58')];for(var _0x25750f=0x0;_0x25750f<_0xf2e098[_0x9133('0x59')]['length'];_0x25750f++){var _0x2b0413=_0xf2e098[_0x9133('0x59')][_0x25750f];var _0x15f638='i';var _0x4ad8c5=_[_0x9133('0x5a')](_0x593fbe,['name',_0x2b0413[_0x9133('0x43')]]);if(!_0x4ad8c5){switch(_0x2b0413[_0x9133('0x43')]){case _0x9133('0x5b'):if(_0x2b0413[_0x9133('0x5c')]==0x1){_0x3320d1['having']('`'+_0x2b0413['field']+_0x9133('0x5d'));}else{_0x3320d1[_0x9133('0x5e')]('`'+_0x2b0413[_0x9133('0x43')]+_0x9133('0x5f'));}break;case _0x9133('0x60'):if(_0x2b0413['operator']==='$substring'){if(_0x2b0413[_0x9133('0x5c')][_0x9133('0x2f')]('\x20')['length']>0x1){_0xf07fbb[_0x4ebc85](_0x9133('0x61'),qs[_0x9133('0x62')](_0x2b0413['value']),null);}else{var _0x508303='%'+_0x2b0413['value']+'%';_0xf07fbb[_0x4ebc85](_0x9133('0x63'),_0x508303,_0x508303,_0x508303);}}else{_0x4ad8c5=_['find'](_0x593fbe,[_0x9133('0x28'),_0x9133('0x64')]);_0x2b0413[_0x9133('0x43')]=_0x9133('0x64');_0x13d5f4=as['buildExpression'](_0x15f638,_0x4ad8c5[_0x9133('0x35')],_0x2b0413);_0xf07fbb[_0x4ebc85](_0x13d5f4['text'],_0x13d5f4[_0x9133('0x5c')][_0x9133('0x65')],_0x13d5f4[_0x9133('0x5c')][_0x9133('0x27')]);}break;case _0x9133('0x66'):var _0x3534bf=_0x2b0413['value']['split'](',')['map'](function(_0xdb0dfa){return Number(_0xdb0dfa);});_0x3534bf[_0x9133('0x67')](function(_0x177ece){_0x4f3092['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x177ece+',%');});_0x2e4d97=_[_0x9133('0x68')](_0x2e4d97,_0x3534bf);break;case _0x9133('0x69'):if(_0x2b0413[_0x9133('0x6a')]===_0x9133('0x6b')){_0xf07fbb[_0x4ebc85](_0x9133('0x6c'),'%'+_0x2b0413[_0x9133('0x5c')]+'%',null);}else{_0x4ad8c5=_[_0x9133('0x5a')](_0x593fbe,[_0x9133('0x28'),'UserId']);_0x2b0413[_0x9133('0x43')]='UserId';_0x13d5f4=as[_0x9133('0x6d')](_0x15f638,_0x4ad8c5['type'],_0x2b0413);_0xf07fbb[_0x4ebc85](_0x13d5f4[_0x9133('0x6e')],_0x13d5f4[_0x9133('0x5c')]['start'],_0x13d5f4['value'][_0x9133('0x27')]);}break;case _0x9133('0x6f'):_0x13d5f4=as[_0x9133('0x6d')]('me',null,_0x2b0413);_0xf07fbb[_0x4ebc85](_0x13d5f4[_0x9133('0x6e')],_0x13d5f4[_0x9133('0x5c')][_0x9133('0x65')],_0x13d5f4[_0x9133('0x5c')][_0x9133('0x27')]);break;}}else{var _0x13d5f4=as[_0x9133('0x6d')](_0x15f638,_0x4ad8c5[_0x9133('0x35')],_0x2b0413);_0xf07fbb[_0x4ebc85](_0x13d5f4['text'],_0x13d5f4[_0x9133('0x5c')]['start'],_0x13d5f4[_0x9133('0x5c')][_0x9133('0x27')]);}}}else{var _0x7b6dae=_(_0x3ccd89[_0x9133('0x38')])[_0x9133('0x70')]()['map'](function(_0x35bc72){return _[_0x9133('0x71')](_0x593fbe,[_0x9133('0x28'),_0x35bc72])?_0x35bc72:undefined;})[_0x9133('0x72')]()['value']();if(!_[_0x9133('0x73')](_0x7b6dae)){_0x7b6dae[_0x9133('0x67')](function(_0xcfcae2){if(_0xcfcae2===_0x9133('0x74')){_0x3320d1['where']('i.SmsAccountId\x20IN\x20?',[][_0x9133('0x75')](_0x3ccd89[_0x9133('0x38')][_0xcfcae2]));}else if(_0xcfcae2===_0x9133('0x76')){var _0xeecd28=JSON[_0x9133('0x77')](_0x3ccd89[_0x9133('0x38')][_0xcfcae2])['$gte'];var _0x290f81=JSON[_0x9133('0x77')](_0x3ccd89[_0x9133('0x38')][_0xcfcae2])[_0x9133('0x78')];_0x3320d1['where'](_0x9133('0x79'),_0xeecd28,_0x290f81);}else{if(_0x3ccd89['query'][_0xcfcae2]===_0x9133('0x7a')){_0x3320d1[_0x9133('0x41')]('i.'+_0xcfcae2+_0x9133('0x7b'));}else{_0x3320d1[_0x9133('0x41')]('i.'+_0xcfcae2+_0x9133('0x7c'),_0x3ccd89[_0x9133('0x38')][_0xcfcae2]);}}});}if(_0x3ccd89[_0x9133('0x38')][_0x9133('0x7d')]){if(_0x3ccd89['query'][_0x9133('0x7d')]==0x1){_0x3320d1[_0x9133('0x5e')](_0x9133('0x7e'));}else{_0x3320d1[_0x9133('0x5e')](_0x9133('0x7f'));}}if(_0x3ccd89['query']['tag']){_0x2e4d97=_['isArray'](_0x3ccd89[_0x9133('0x38')][_0x9133('0x80')])?_0x3ccd89[_0x9133('0x38')]['tag']:new Array(_0x3ccd89[_0x9133('0x38')][_0x9133('0x80')]);_0x2e4d97[_0x9133('0x67')](function(_0x3e660c){_0x4f3092['or'](_0x9133('0x81'),'%,'+_0x3e660c+',%');});}if(_0x3ccd89[_0x9133('0x38')][_0x9133('0x82')]){var _0x2ccb9b=_0x3ccd89['query'][_0x9133('0x82')][_0x9133('0x83')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x9133('0x84'));if(qs['isNumeric'](_0x2ccb9b)){_0xf07fbb['or'](_0x9133('0x85'),_0x2ccb9b+'%')['or'](_0x9133('0x86'),_0x2ccb9b+'%');}else{_0xf07fbb['or'](_0x9133('0x87'),qs[_0x9133('0x62')](_0x2ccb9b))['or'](_0x9133('0x88'),_0x2ccb9b+'%');}}}_0x3320d1['where'](_0xf07fbb);_0x3320d1[_0x9133('0x89')](_0x9133('0x8a'));var _0x23b4ac={'type':db[_0x9133('0x8b')]['QueryTypes'][_0x9133('0x8c')],'raw':!![]};var _0x24c70d=_0x3320d1[_0x9133('0x8d')]();_0x24c70d[_0x9133('0x43')](_0x9133('0x8a'));_0x24c70d[_0x9133('0x43')](_0x9133('0x8e'),_0x9133('0x5b'));if(_0x56719e[_0x9133('0x3f')]){_0x56719e[_0x9133('0x3f')][_0x9133('0x67')](function(_0x4c3dc7){_0x3320d1[_0x9133('0x3f')]('i.'+_0x4c3dc7[0x0],_0x4c3dc7[0x1]===_0x9133('0x8f')?![]:!![]);});}if(!_[_0x9133('0x73')](_0x2e4d97)){_0x3320d1[_0x9133('0x5e')](_0x4f3092);_0x24c70d['where'](_0x9133('0x90'),_0x2e4d97);}BPromise['resolve']()[_0x9133('0x26')](function(){if(!_0xf2e098){if(_0x3ccd89[_0x9133('0x38')][_0x9133('0x74')]||_0x3ccd89['query'][_0x9133('0x91')])return;_0x24c70d[_0x9133('0x41')](_0x9133('0x92'));_0x3320d1['where'](_0x9133('0x92'));return;}return _0x3ccd89[_0x9133('0x93')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x9133('0x26')](function(_0x12094c){if(_[_0x9133('0x73')](_0x12094c)){_0x24c70d['where'](_0x9133('0x94'));_0x3320d1['where'](_0x9133('0x94'));}else{_0x24c70d[_0x9133('0x41')](_0x9133('0x95'),_['map'](_0x12094c,'id'));_0x3320d1[_0x9133('0x41')]('i.SmsAccountId\x20IN\x20?',_[_0x9133('0x2b')](_0x12094c,'id'));}});})[_0x9133('0x26')](function(){db[_0x9133('0x96')][_0x9133('0x38')](_0x24c70d[_0x9133('0x97')](),_0x23b4ac)[_0x9133('0x26')](function(_0x3dc4ec){_0x2d256a[_0x9133('0x20')]=_0x3dc4ec['length'];if(_0x2d256a[_0x9133('0x20')]===0x0)return[];return db[_0x9133('0x96')][_0x9133('0x38')](_0x7f6cd9[_0x9133('0x97')](),_0x23b4ac)[_0x9133('0x26')](function(_0x57adb9){_0x4ca1a3=_[_0x9133('0x98')](_0x57adb9,'id');_0x23b4ac=_[_0x9133('0x99')](_0x23b4ac,{'model':db[_0x9133('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ccd89[_0x9133('0x38')]['fields']){_0x56719e[_0x9133('0x3b')]['forEach'](function(_0x29a1d9){_0x3320d1[_0x9133('0x43')]('i.'+_0x29a1d9);});}else{_0x3320d1[_0x9133('0x43')](_0x9133('0x8e'),'unreadMessages');_0x3320d1[_0x9133('0x43')](_0x9133('0x9a'),_0x9133('0x9b'));_0x3320d1[_0x9133('0x43')](_0x9133('0x9c'),'Account.mandatoryDisposition');_0x3320d1['field']('i.*');_0x3320d1['field'](_0x9133('0x9d'),_0x9133('0x9e'));_0x3320d1[_0x9133('0x43')]('c.lastName',_0x9133('0x9f'));_0x3320d1[_0x9133('0x43')](_0x9133('0xa0'),_0x9133('0xa1'));_0x3320d1[_0x9133('0x43')]('c.phone',_0x9133('0xa2'));_0x3320d1['field'](_0x9133('0xa3'),_0x9133('0xa4'));_0x3320d1[_0x9133('0x43')](_0x9133('0xa5'),_0x9133('0xa6'));_0x3320d1['field'](_0x9133('0xa7'),_0x9133('0xa8'));_0x3320d1[_0x9133('0x43')]('o.internal',_0x9133('0xa9'));_0x3320d1['field'](_0x9133('0xaa'),_0x9133('0x2d'));}if(_0x56719e[_0x9133('0x22')])_0x3320d1[_0x9133('0x22')](_0x56719e[_0x9133('0x22')]);if(_0x56719e[_0x9133('0x21')])_0x3320d1['offset'](_0x56719e[_0x9133('0x21')]);return db[_0x9133('0x96')][_0x9133('0x38')](_0x3320d1[_0x9133('0x97')](),_0x23b4ac);})[_0x9133('0x26')](function(_0x18e990){_0x344120['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x9133('0x2b')](_0x18e990,'id'));return db[_0x9133('0x96')]['query'](_0x344120[_0x9133('0x97')](),_0x23b4ac)['then'](function(_0x3aaeb2){var _0x4418a8=_['groupBy'](_0x3aaeb2,_0x9133('0xab'));var _0x3fc48f=[];_0x18e990[_0x9133('0x67')](function(_0x554ecb){_0x3fc48f[_0x9133('0x30')](updateSmsInteraction(_0x554ecb,_0x4ca1a3,_0x4418a8));});return BPromise['all'](_0x3fc48f);});});})[_0x9133('0x26')](function(_0x43aba3){_0x2d256a['rows']=_0x43aba3;return _0x2d256a;})[_0x9133('0x26')](respondWithFilteredResult(_0xea26a3,_0x56719e));})[_0x9133('0x31')](handleError(_0xea26a3,null));};exports[_0x9133('0xac')]=function(_0x5332cf,_0x20310c){var _0x5e11fe={'raw':![],'where':{'id':_0x5332cf[_0x9133('0xad')]['id']}},_0x4f1035={};_0x4f1035[_0x9133('0x37')]=_['keys'](db[_0x9133('0x32')][_0x9133('0x33')]);_0x4f1035['query']=_[_0x9133('0x70')](_0x5332cf[_0x9133('0x38')]);_0x4f1035[_0x9133('0x39')]=_[_0x9133('0x3a')](_0x4f1035[_0x9133('0x37')],_0x4f1035[_0x9133('0x38')]);_0x5e11fe[_0x9133('0x3b')]=_[_0x9133('0x3a')](_0x4f1035['model'],qs[_0x9133('0x3c')](_0x5332cf['query']['fields']));_0x5e11fe[_0x9133('0x3b')]=_0x5e11fe[_0x9133('0x3b')][_0x9133('0x3d')]?_0x5e11fe[_0x9133('0x3b')]:_0x4f1035[_0x9133('0x37')];if(_0x5332cf[_0x9133('0x38')][_0x9133('0xae')]){_0x5e11fe['include']=[{'all':!![]}];}_0x5e11fe=_[_0x9133('0x99')]({},_0x5e11fe,_0x5332cf[_0x9133('0xaf')]);return db[_0x9133('0x32')]['find'](_0x5e11fe)[_0x9133('0x26')](handleEntityNotFound(_0x20310c,null))['then'](respondWithResult(_0x20310c,null))[_0x9133('0x31')](handleError(_0x20310c,null));};exports[_0x9133('0xb0')]=function(_0x228612,_0x2bb13d){return db[_0x9133('0x32')][_0x9133('0xb0')](_0x228612[_0x9133('0x6f')],{})[_0x9133('0x26')](respondWithResult(_0x2bb13d,0xc9))[_0x9133('0x31')](handleError(_0x2bb13d,null));};exports['update']=function(_0x3bbb1b,_0x42db98){if(_0x3bbb1b[_0x9133('0x6f')]['id']){delete _0x3bbb1b[_0x9133('0x6f')]['id'];}return db['SmsInteraction'][_0x9133('0x5a')]({'where':{'id':_0x3bbb1b['params']['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x42db98,null))['then'](saveUpdates(_0x3bbb1b['body'],null))[_0x9133('0x26')](respondWithResult(_0x42db98,null))['catch'](handleError(_0x42db98,null));};exports[_0x9133('0xb1')]=function(_0x482b36,_0x5388e7){return db['SmsInteraction'][_0x9133('0x5a')]({'where':{'id':_0x482b36['params']['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x5388e7,null))['then'](removeEntity(_0x5388e7,null))[_0x9133('0x31')](handleError(_0x5388e7,null));};exports[_0x9133('0xb2')]=function(_0x8cad68,_0x212854){return db[_0x9133('0x32')][_0x9133('0xb2')]()[_0x9133('0x26')](respondWithResult(_0x212854,null))[_0x9133('0x31')](handleError(_0x212854,null));};exports[_0x9133('0xb3')]=function(_0xe9a042,_0x40950e,_0x59098c){return db['SmsMessage'][_0x9133('0x5a')]({'where':{'id':_0xe9a042[_0x9133('0xad')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x40950e,null))[_0x9133('0x26')](function(_0x22cd3d){if(_0x22cd3d){return _0x22cd3d[_0x9133('0xb3')](_0xe9a042[_0x9133('0x6f')][_0x9133('0xb4')],_[_0x9133('0xb5')](_0xe9a042[_0x9133('0x6f')],[_0x9133('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x40950e,null))[_0x9133('0x31')](handleError(_0x40950e,null));};exports[_0x9133('0xb6')]=function(_0x26c4ce,_0x3bf91d,_0x3b1aea){var _0xc2b297={'raw':![],'where':{}};var _0xe7936e={};var _0x1cc339={'count':0x0,'rows':[]};return db[_0x9133('0x32')][_0x9133('0xb7')]({'where':{'id':_0x26c4ce[_0x9133('0xad')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x3bf91d,null))[_0x9133('0x26')](function(_0x1aa111){if(_0x1aa111){_0xe7936e['model']=_[_0x9133('0x70')](db[_0x9133('0xb8')][_0x9133('0x33')]);_0xe7936e[_0x9133('0x38')]=_[_0x9133('0x70')](_0x26c4ce['query']);_0xe7936e[_0x9133('0x39')]=_[_0x9133('0x3a')](_0xe7936e[_0x9133('0x37')],_0xe7936e[_0x9133('0x38')]);_0xc2b297[_0x9133('0x3b')]=_[_0x9133('0x3a')](_0xe7936e[_0x9133('0x37')],qs[_0x9133('0x3c')](_0x26c4ce[_0x9133('0x38')]['fields']));_0xc2b297[_0x9133('0x3b')]=_0xc2b297[_0x9133('0x3b')][_0x9133('0x3d')]?_0xc2b297[_0x9133('0x3b')]:_0xe7936e['model'];if(!_0x26c4ce[_0x9133('0x38')][_0x9133('0xb9')](_0x9133('0x3e'))){_0xc2b297[_0x9133('0x22')]=qs['limit'](_0x26c4ce[_0x9133('0x38')]['limit']);_0xc2b297[_0x9133('0x21')]=qs['offset'](_0x26c4ce['query'][_0x9133('0x21')]);}_0xc2b297['order']=qs[_0x9133('0x40')](_0x26c4ce[_0x9133('0x38')][_0x9133('0x40')]);_0xc2b297[_0x9133('0x41')]=qs[_0x9133('0x39')](_[_0x9133('0x42')](_0x26c4ce[_0x9133('0x38')],_0xe7936e['filters']));_0xc2b297[_0x9133('0x41')][_0x9133('0xab')]=_0x1aa111['id'];if(_0x26c4ce[_0x9133('0x38')][_0x9133('0x82')]){_0xc2b297['where']=_[_0x9133('0x99')](_0xc2b297[_0x9133('0x41')],{'$or':_['map'](_0xc2b297[_0x9133('0x3b')],function(_0x360e39){var _0x2ca830={};_0x2ca830[_0x360e39]={'$like':'%'+_0x26c4ce['query']['filter']+'%'};return _0x2ca830;})});}if(_0x26c4ce['query'][_0x9133('0xba')]){var _0x37dacd=_0x26c4ce['query'][_0x9133('0xba')][_0x9133('0x2f')](',');var _0x333c6b={};_0x333c6b[_0x37dacd[0x0]]={'$gte':moment(_0x37dacd[0x1])[_0x9133('0xbb')](_0x9133('0xbc'))};_0xc2b297['where']=_['merge'](_0xc2b297[_0x9133('0x41')],_0x333c6b);}_0xc2b297=_[_0x9133('0x99')]({},_0xc2b297,_0x26c4ce[_0x9133('0xaf')]);return db[_0x9133('0xb8')]['count']({'where':_0xc2b297['where']})[_0x9133('0x26')](function(_0x441e40){_0x1cc339['count']=_0x441e40;if(_0x26c4ce[_0x9133('0x38')][_0x9133('0xae')]){_0xc2b297['include']=[{'all':!![]}];}return db[_0x9133('0xb8')][_0x9133('0xbd')](_0xc2b297);})[_0x9133('0x26')](function(_0x229d46){_0x1cc339[_0x9133('0xbe')]=_0x229d46;return _0x1cc339;});}})[_0x9133('0x26')](respondWithFilteredResult(_0x3bf91d,_0xc2b297))[_0x9133('0x31')](handleError(_0x3bf91d,null));};exports['addTags']=function(_0x3aa73c,_0x5726d2,_0x53540d){return db[_0x9133('0x32')][_0x9133('0x5a')]({'where':{'id':_0x3aa73c[_0x9133('0xad')]['id']}})['then'](handleEntityNotFound(_0x5726d2,null))['then'](function(_0x16c30f){if(_0x16c30f){return _0x16c30f['setTags'](_0x3aa73c[_0x9133('0x6f')]['ids'],_[_0x9133('0xb5')](_0x3aa73c[_0x9133('0x6f')],[_0x9133('0xb4'),'id'])||{})['spread'](function(){return db[_0x9133('0x66')]['findAll']({'attributes':['id','name',_0x9133('0x44')],'where':{'id':_0x3aa73c[_0x9133('0x6f')][_0x9133('0xb4')]}});})['then'](function(_0xa7372e){socket[_0x9133('0xbf')](_0x9133('0xc0'),{'id':Number(_0x3aa73c[_0x9133('0xad')]['id']),'tags':_0xa7372e||[]});return{'id':Number(_0x3aa73c[_0x9133('0xad')]['id']),'tags':_0xa7372e||[]};});}})['then'](respondWithResult(_0x5726d2,null))['catch'](handleError(_0x5726d2,null));};exports['removeTags']=function(_0x88f01d,_0x1b7e2e,_0x31b5fe){return db[_0x9133('0x32')][_0x9133('0x5a')]({'where':{'id':_0x88f01d[_0x9133('0xad')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x1b7e2e,null))[_0x9133('0x26')](function(_0x19c921){if(_0x19c921){return _0x19c921[_0x9133('0xc1')](_0x88f01d['query'][_0x9133('0xb4')]);}})[_0x9133('0x26')](respondWithStatusCode(_0x1b7e2e,null))['catch'](handleError(_0x1b7e2e,null));};exports['download']=function(_0x4740df,_0x17bc67){var _0x7109d0=moment()[_0x9133('0xc2')]()[_0x9133('0x97')]();var _0x4dfcc1=path['join'](config[_0x9133('0xc3')],_0x9133('0xc4'),_0x9133('0xc5'),_0x9133('0xc6'));var _0x700e6c=path[_0x9133('0xc7')](config[_0x9133('0xc3')],_0x9133('0xc4'),_0x9133('0xc5'),_0x9133('0xc8'));var _0x495e29=path[_0x9133('0xc7')](_0x4dfcc1,_0x7109d0);var _0x35a970=util[_0x9133('0xbb')](_0x9133('0xc9'),_0x4740df[_0x9133('0xad')]['id'],_0x7109d0);var _0x1d6fb4=path['join'](_0x4dfcc1,_0x35a970);var _0x338e1f=[];_0x338e1f[_0x9133('0x30')]({'model':db[_0x9133('0x69')],'as':_0x9133('0x69'),'attributes':['id',_0x9133('0x2c')],'raw':!![]});_0x338e1f[_0x9133('0x30')]({'model':db[_0x9133('0xca')],'as':'Contact','attributes':['id','firstName',_0x9133('0xcb')],'raw':!![]});var _0x2be438=[{'model':db[_0x9133('0xb8')],'as':'Messages','attributes':['id',_0x9133('0x6f'),_0x9133('0x76'),_0x9133('0xcc'),'secret',_0x9133('0x7d')],'include':_0x338e1f}];_0x2be438['push']({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x2be438[_0x9133('0x30')]({'model':db[_0x9133('0x69')],'as':'Owner','attributes':['id',_0x9133('0x2c')]});return db['SmsInteraction'][_0x9133('0x5a')]({'where':{'id':_0x4740df['params']['id']},'include':_0x2be438})[_0x9133('0x26')](handleEntityNotFound(_0x17bc67,null))[_0x9133('0x26')](function(_0x3bcd31){if(_0x3bcd31){var _0x3052d3=_0x3bcd31[_0x9133('0xcd')]({'plain':!![]});fs[_0x9133('0xce')](_0x495e29);var _0x3037a9={'format':'A4','border':_0x9133('0xcf'),'header':{'height':_0x9133('0xd0'),'contents':{'first':_0x9133('0xd1')}},'footer':{'height':_0x9133('0xd2'),'contents':{'default':util[_0x9133('0xbb')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x9133('0xbb')](_0x9133('0xd3'),_0x9133('0xd4'),_0x3052d3['id']),moment()[_0x9133('0xbb')](_0x9133('0xd5'))['toString']())}}};var _0x3bb953={'channel':_0x9133('0xd4'),'account':_0x3052d3[_0x9133('0xd6')][_0x9133('0x28')],'agent':_0x3052d3[_0x9133('0xd7')]?_0x3052d3[_0x9133('0xd7')][_0x9133('0x2c')]:'N.A.','createdAt':moment(_0x3052d3[_0x9133('0x76')])[_0x9133('0xbb')](_0x9133('0xbc'))[_0x9133('0x97')](),'closedAt':_0x3052d3[_0x9133('0xd8')]?moment(_0x3052d3['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x9133('0x97')]():'','disposition':_0x3052d3[_0x9133('0xd9')],'messages':_(_0x3052d3[_0x9133('0xda')])[_0x9133('0x82')]({'secret':![]})[_0x9133('0x2b')](function(_0xfb4854){return{'date':moment(_0xfb4854[_0x9133('0x76')])[_0x9133('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x9133('0x97')](),'sender':_0xfb4854[_0x9133('0xcc')]==='out'?_0xfb4854['User']?_0xfb4854[_0x9133('0x69')][_0x9133('0x2c')]:_0x9133('0xdb'):_0xfb4854['Contact']['firstName']+(_0xfb4854['Contact'][_0x9133('0xcb')]?'\x20'+_0xfb4854['Contact']['lastName']:''),'body':_0xfb4854[_0x9133('0x6f')],'direction':_0xfb4854[_0x9133('0xcc')]===_0x9133('0xdc')?'A':'C','secret':_0xfb4854[_0x9133('0xdd')],'read':_0xfb4854[_0x9133('0x7d')]};})[_0x9133('0x5c')]()};return ejs[_0x9133('0xde')](path[_0x9133('0xc7')](config['root'],_0x9133('0xc4'),'views','downloadInteraction.html'),{'interaction':_0x3bb953})[_0x9133('0x26')](function(_0x3f5251){return new BPromise(function(_0x1e6ffa,_0x5b8127){pdf[_0x9133('0xb0')](_0x3f5251,_0x3037a9)[_0x9133('0xdf')](path[_0x9133('0xc7')](_0x495e29,_0x9133('0xe0')+_0x3052d3['id']+'-'+_0x7109d0+'.pdf'),function(_0xf989dd,_0x169f9b){if(_0xf989dd)return _0x5b8127(_0xf989dd);_0x1e6ffa(_0x169f9b);});});})['then'](function(){return new BPromise(function(_0x482b03,_0x47488e){zipdir(_0x495e29,{'saveTo':_0x1d6fb4},function(_0x33cf0a,_0x1b02e5){if(_0x33cf0a)return _0x47488e(_0x33cf0a);return _0x482b03(_0x1b02e5);});})[_0x9133('0x26')](function(){return new BPromise(function(_0x3e80a5,_0x4f2799){rimraf(_0x495e29,function(_0x75e9b4){if(_0x75e9b4)_0x4f2799(_0x75e9b4);return _0x3e80a5();});});})['then'](function(){return _0x17bc67[_0x9133('0xe1')](_0x1d6fb4,_0x35a970,function(_0x5dabc5){if(_0x5dabc5){console['log'](_0x9133('0xe2'),_0x5dabc5);}else{fs[_0x9133('0xe3')](_0x1d6fb4);}});});});}else{return _0x17bc67['sendStatus'](0xc8);}})[_0x9133('0x31')](handleError(_0x17bc67,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 6150276..075dd7e 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 _0xfd0f=['Users','findAll','length','emit','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','getUsers','then','setDataValue'];(function(_0x127815,_0x1971ef){var _0x5646a6=function(_0x296942){while(--_0x296942){_0x127815['push'](_0x127815['shift']());}};_0x5646a6(++_0x1971ef);}(_0xfd0f,0x1b8));var _0xffd0=function(_0xd5fe2f,_0x27727d){_0xd5fe2f=_0xd5fe2f-0x0;var _0xa5770d=_0xfd0f[_0xd5fe2f];return _0xa5770d;};'use strict';var EventEmitter=require(_0xffd0('0x0'));var SmsInteraction=require(_0xffd0('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xffd0('0x1'))['db'][_0xffd0('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xffd0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xffd0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x303f38){return function(_0x45ecf8,_0x3501fc,_0x9e9c1f){_0x45ecf8[_0xffd0('0x5')]({'attributes':['id'],'raw':!![]})[_0xffd0('0x6')](function(_0x2aaee6){_0x45ecf8[_0xffd0('0x7')](_0xffd0('0x8'),_0x2aaee6['map'](function(_0x46129b){return{'id':_0x46129b['id']};}));return SmsMessage[_0xffd0('0x9')]({'where':{'SmsInteractionId':_0x45ecf8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xffd0('0x6')](function(_0xd8f72e){_0x45ecf8['setDataValue']('unreadMessages',_0xd8f72e[_0xffd0('0xa')]);SmsInteractionEvents[_0xffd0('0xb')](_0x303f38+':'+_0x45ecf8['id'],_0x45ecf8);SmsInteractionEvents[_0xffd0('0xb')](_0x303f38,_0x45ecf8);_0x9e9c1f(null);})['catch'](_0x9e9c1f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xffd0('0xc')](e,emitEvent(event));}}module[_0xffd0('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0xe5d5=['length','emit','catch','hasOwnProperty','hook','exports','SmsInteraction','SmsMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x13639d,_0x3c996b){var _0x52ef14=function(_0x3faf51){while(--_0x3faf51){_0x13639d['push'](_0x13639d['shift']());}};_0x52ef14(++_0x3c996b);}(_0xe5d5,0x156));var _0x5e5d=function(_0x363c88,_0x29ead3){_0x363c88=_0x363c88-0x0;var _0x35d879=_0xe5d5[_0x363c88];return _0x35d879;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x5e5d('0x0')];var SmsMessage=require('../../mysqldb')['db'][_0x5e5d('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e5d('0x2'),'afterUpdate':'update','afterDestroy':_0x5e5d('0x3')};function emitEvent(_0x191980){return function(_0x32c471,_0x3d014f,_0x13bcb7){_0x32c471[_0x5e5d('0x4')]({'attributes':['id'],'raw':!![]})[_0x5e5d('0x5')](function(_0xab446c){_0x32c471[_0x5e5d('0x6')](_0x5e5d('0x7'),_0xab446c[_0x5e5d('0x8')](function(_0x1fdb77){return{'id':_0x1fdb77['id']};}));return SmsMessage[_0x5e5d('0x9')]({'where':{'SmsInteractionId':_0x32c471['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5e5d('0x5')](function(_0x59917b){_0x32c471[_0x5e5d('0x6')]('unreadMessages',_0x59917b[_0x5e5d('0xa')]);SmsInteractionEvents[_0x5e5d('0xb')](_0x191980+':'+_0x32c471['id'],_0x32c471);SmsInteractionEvents['emit'](_0x191980,_0x32c471);_0x13bcb7(null);})[_0x5e5d('0xc')](_0x13bcb7(null));};}for(var e in events){if(events[_0x5e5d('0xd')](e)){var event=events[e];SmsInteraction[_0x5e5d('0xe')](e,emitEvent(event));}}module[_0x5e5d('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9d01ebd..c5467c0 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 _0x3413=['request-promise','path','../../config/environment','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','lodash','util','../../config/logger','api'];(function(_0x27ddbc,_0x42ec98){var _0x494cf3=function(_0x5ae254){while(--_0x5ae254){_0x27ddbc['push'](_0x27ddbc['shift']());}};_0x494cf3(++_0x42ec98);}(_0x3413,0x1c3));var _0x3341=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3413[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3341('0x0'));var util=require(_0x3341('0x1'));var logger=require(_0x3341('0x2'))(_0x3341('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3341('0x4'));var fs=require('fs');var path=require(_0x3341('0x5'));var rimraf=require('rimraf');var config=require(_0x3341('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x3341('0x7')]=function(_0x39cb8d,_0x255345){return _0x39cb8d['define'](_0x3341('0x8'),attributes,{'tableName':_0x3341('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e6baa,_0x156441,_0x1eef4c){if(_0x4e6baa[_0x3341('0xa')](_0x3341('0xb'))){_0x4e6baa[_0x3341('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1eef4c(null,_0x4e6baa);}}});}; \ No newline at end of file +var _0xa249=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','exports','define','SmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa249,0x109));var _0x9a24=function(_0x3be20a,_0x223336){_0x3be20a=_0x3be20a-0x0;var _0x7382f6=_0xa249[_0x3be20a];return _0x7382f6;};'use strict';var _=require('lodash');var util=require(_0x9a24('0x0'));var logger=require(_0x9a24('0x1'))(_0x9a24('0x2'));var moment=require('moment');var BPromise=require(_0x9a24('0x3'));var rp=require(_0x9a24('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x9a24('0x5')]=function(_0x20bc1c,_0x388046){return _0x20bc1c[_0x9a24('0x6')](_0x9a24('0x7'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x441de7,_0x560b40,_0x153a76){if(_0x441de7[_0x9a24('0x8')](_0x9a24('0x9'))){_0x441de7[_0x9a24('0xa')]=moment()[_0x9a24('0xb')](_0x9a24('0xc'));}_0x153a76(null,_0x441de7);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0bbf0e2..a3c0178 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 _0x34fb=['SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','AddTagsToSmsInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','info'];(function(_0x43ba2e,_0x167681){var _0x5822fa=function(_0x31a19d){while(--_0x31a19d){_0x43ba2e['push'](_0x43ba2e['shift']());}};_0x5822fa(++_0x167681);}(_0x34fb,0x11e));var _0xb34f=function(_0x2f9345,_0x23aa3c){_0x2f9345=_0x2f9345-0x0;var _0x5b99a4=_0x34fb[_0x2f9345];return _0x5b99a4;};'use strict';var _=require(_0xb34f('0x0'));var util=require(_0xb34f('0x1'));var moment=require(_0xb34f('0x2'));var BPromise=require(_0xb34f('0x3'));var rs=require(_0xb34f('0x4'));var fs=require('fs');var Redis=require(_0xb34f('0x5'));var db=require(_0xb34f('0x6'))['db'];var utils=require(_0xb34f('0x7'));var logger=require(_0xb34f('0x8'))(_0xb34f('0x9'));var config=require(_0xb34f('0xa'));var jayson=require(_0xb34f('0xb'));var client=jayson[_0xb34f('0xc')][_0xb34f('0xd')]({'port':0x232a});config[_0xb34f('0xe')]=_[_0xb34f('0xf')](config[_0xb34f('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xb34f('0x10'))(new Redis(config['redis']));require(_0xb34f('0x11'))[_0xb34f('0x12')](socket);function respondWithRpcPromise(_0x520556,_0x2f1781,_0x1b35e2){return new BPromise(function(_0x157778,_0x246ddf){return client[_0xb34f('0x13')](_0x520556,_0x1b35e2)[_0xb34f('0x14')](function(_0x15b81b){logger[_0xb34f('0x15')](_0xb34f('0x16'),_0x2f1781,_0xb34f('0x17'));logger[_0xb34f('0x18')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2f1781,_0xb34f('0x17'),JSON[_0xb34f('0x19')](_0x15b81b));if(_0x15b81b['error']){if(_0x15b81b['error'][_0xb34f('0x1a')]===0x1f4){logger[_0xb34f('0x1b')](_0xb34f('0x16'),_0x2f1781,_0x15b81b['error'][_0xb34f('0x1c')]);return _0x246ddf(_0x15b81b[_0xb34f('0x1b')][_0xb34f('0x1c')]);}logger[_0xb34f('0x1b')]('SmsInteraction,\x20%s,\x20%s',_0x2f1781,_0x15b81b[_0xb34f('0x1b')][_0xb34f('0x1c')]);return _0x157778(_0x15b81b[_0xb34f('0x1b')]['message']);}else{logger[_0xb34f('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x2f1781,_0xb34f('0x17'));_0x157778(_0x15b81b[_0xb34f('0x1d')]['message']);}})[_0xb34f('0x1e')](function(_0xefab88){logger[_0xb34f('0x1b')]('SmsInteraction,\x20%s,\x20%s',_0x2f1781,_0xefab88);_0x246ddf(_0xefab88);});});}exports[_0xb34f('0x1f')]=function(_0x40747c){var _0x2c7bc4=this;return new Promise(function(_0x146627,_0x46ff42){return db[_0xb34f('0x20')][_0xb34f('0x21')](_0x40747c[_0xb34f('0x22')],{'raw':_0x40747c[_0xb34f('0x23')]?_0x40747c[_0xb34f('0x23')][_0xb34f('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40747c[_0xb34f('0x23')]?_0x40747c[_0xb34f('0x23')][_0xb34f('0x25')]||null:null,'attributes':_0x40747c[_0xb34f('0x23')]?_0x40747c[_0xb34f('0x23')]['attributes']||null:null,'limit':_0x40747c[_0xb34f('0x23')]?_0x40747c[_0xb34f('0x23')][_0xb34f('0x26')]||null:null})[_0xb34f('0x14')](function(_0x3eaae8){logger[_0xb34f('0x15')]('UpdateSmsInteraction',_0x40747c);logger[_0xb34f('0x18')]('UpdateSmsInteraction',_0x40747c,JSON[_0xb34f('0x19')](_0x3eaae8));_0x146627(_0x3eaae8);})[_0xb34f('0x1e')](function(_0x2467f5){logger[_0xb34f('0x1b')](_0xb34f('0x1f'),_0x2467f5[_0xb34f('0x1c')],_0x40747c);_0x46ff42(_0x2c7bc4[_0xb34f('0x1b')](0x1f4,_0x2467f5[_0xb34f('0x1c')]));});});};exports[_0xb34f('0x27')]=function(_0x3093b4){return new Promise(function(_0x16dce2,_0x3d3b99){return db[_0xb34f('0x20')]['find']({'where':_0x3093b4[_0xb34f('0x23')]?_0x3093b4[_0xb34f('0x23')][_0xb34f('0x25')]||null:null})[_0xb34f('0x14')](function(_0x3066f5){if(_0x3066f5){return _0x3066f5[_0xb34f('0x28')](_0x3093b4[_0xb34f('0x22')][_0xb34f('0x29')],_['omit'](_0x3093b4[_0xb34f('0x22')],[_0xb34f('0x29'),'id'])||{});}})[_0xb34f('0x2a')](function(_0x59219d){logger[_0xb34f('0x15')](_0xb34f('0x2b'),_0x3093b4);logger[_0xb34f('0x18')](_0xb34f('0x2b'),_0x3093b4,JSON[_0xb34f('0x19')](_0x59219d));_0x16dce2(_0x59219d);})[_0xb34f('0x1e')](function(_0x4a1bd2){logger[_0xb34f('0x1b')](_0xb34f('0x2b'),_0x4a1bd2[_0xb34f('0x1c')],_0x3093b4);_0x3d3b99(_this[_0xb34f('0x1b')](0x1f4,_0x4a1bd2[_0xb34f('0x1c')]));});});}; \ No newline at end of file +var _0xa962=['catch','AddTagsToSmsInteraction','SmsInteraction','find','where','body','ids','omit','spread','AddTags','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateSmsInteraction','update','options','raw','attributes','then','stringify'];(function(_0x470ce2,_0x4b3815){var _0x739076=function(_0x1f16f3){while(--_0x1f16f3){_0x470ce2['push'](_0x470ce2['shift']());}};_0x739076(++_0x4b3815);}(_0xa962,0x18d));var _0x2a96=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0xa962[_0x3a2e49];return _0x257140;};'use strict';var _=require(_0x2a96('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a96('0x1'));var db=require(_0x2a96('0x2'))['db'];var utils=require(_0x2a96('0x3'));var logger=require(_0x2a96('0x4'))(_0x2a96('0x5'));var config=require(_0x2a96('0x6'));var jayson=require(_0x2a96('0x7'));var client=jayson[_0x2a96('0x8')][_0x2a96('0x9')]({'port':0x232a});config['redis']=_[_0x2a96('0xa')](config[_0x2a96('0xb')],{'host':_0x2a96('0xc'),'port':0x18eb});var socket=require(_0x2a96('0xd'))(new Redis(config[_0x2a96('0xb')]));require(_0x2a96('0xe'))[_0x2a96('0xf')](socket);function respondWithRpcPromise(_0xabfdaa,_0x51b4e0,_0xa30c1a){return new BPromise(function(_0x133413,_0x4a25d2){return client[_0x2a96('0x10')](_0xabfdaa,_0xa30c1a)['then'](function(_0x2e73cd){logger[_0x2a96('0x11')](_0x2a96('0x12'),_0x51b4e0,_0x2a96('0x13'));logger[_0x2a96('0x14')](_0x2a96('0x15'),_0x51b4e0,_0x2a96('0x13'),JSON['stringify'](_0x2e73cd));if(_0x2e73cd[_0x2a96('0x16')]){if(_0x2e73cd[_0x2a96('0x16')][_0x2a96('0x17')]===0x1f4){logger[_0x2a96('0x16')](_0x2a96('0x12'),_0x51b4e0,_0x2e73cd[_0x2a96('0x16')][_0x2a96('0x18')]);return _0x4a25d2(_0x2e73cd['error'][_0x2a96('0x18')]);}logger[_0x2a96('0x16')](_0x2a96('0x12'),_0x51b4e0,_0x2e73cd[_0x2a96('0x16')][_0x2a96('0x18')]);return _0x133413(_0x2e73cd[_0x2a96('0x16')][_0x2a96('0x18')]);}else{logger['info'](_0x2a96('0x12'),_0x51b4e0,_0x2a96('0x13'));_0x133413(_0x2e73cd[_0x2a96('0x19')][_0x2a96('0x18')]);}})['catch'](function(_0x17f01d){logger[_0x2a96('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x51b4e0,_0x17f01d);_0x4a25d2(_0x17f01d);});});}exports[_0x2a96('0x1a')]=function(_0x365f1d){var _0xd8276b=this;return new Promise(function(_0x42416a,_0x1d3507){return db['SmsInteraction'][_0x2a96('0x1b')](_0x365f1d['body'],{'raw':_0x365f1d[_0x2a96('0x1c')]?_0x365f1d[_0x2a96('0x1c')][_0x2a96('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x365f1d[_0x2a96('0x1c')]?_0x365f1d[_0x2a96('0x1c')]['where']||null:null,'attributes':_0x365f1d['options']?_0x365f1d['options'][_0x2a96('0x1e')]||null:null,'limit':_0x365f1d[_0x2a96('0x1c')]?_0x365f1d[_0x2a96('0x1c')]['limit']||null:null})[_0x2a96('0x1f')](function(_0x54e78b){logger['info']('UpdateSmsInteraction',_0x365f1d);logger[_0x2a96('0x14')](_0x2a96('0x1a'),_0x365f1d,JSON[_0x2a96('0x20')](_0x54e78b));_0x42416a(_0x54e78b);})[_0x2a96('0x21')](function(_0x65dfdb){logger['error']('UpdateSmsInteraction',_0x65dfdb[_0x2a96('0x18')],_0x365f1d);_0x1d3507(_0xd8276b['error'](0x1f4,_0x65dfdb[_0x2a96('0x18')]));});});};exports[_0x2a96('0x22')]=function(_0x42cd10){return new Promise(function(_0xd1c605,_0x38fbaf){return db[_0x2a96('0x23')][_0x2a96('0x24')]({'where':_0x42cd10[_0x2a96('0x1c')]?_0x42cd10[_0x2a96('0x1c')][_0x2a96('0x25')]||null:null})[_0x2a96('0x1f')](function(_0x30cdbf){if(_0x30cdbf){return _0x30cdbf['addTags'](_0x42cd10[_0x2a96('0x26')][_0x2a96('0x27')],_[_0x2a96('0x28')](_0x42cd10[_0x2a96('0x26')],['ids','id'])||{});}})[_0x2a96('0x29')](function(_0x215f84){logger[_0x2a96('0x11')]('AddTags',_0x42cd10);logger[_0x2a96('0x14')]('AddTags',_0x42cd10,JSON[_0x2a96('0x20')](_0x215f84));_0xd1c605(_0x215f84);})['catch'](function(_0x31d853){logger[_0x2a96('0x16')](_0x2a96('0x2a'),_0x31d853[_0x2a96('0x18')],_0x42cd10);_0x38fbaf(_this[_0x2a96('0x16')](0x1f4,_0x31d853['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c5fef51..65e3a6e 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 _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x19e91a,_0x52ced9){var _0x563b4a=function(_0x41380a){while(--_0x41380a){_0x19e91a['push'](_0x19e91a['shift']());}};_0x563b4a(++_0x52ced9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file +var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0x2032,0xd9));var _0x2203=function(_0x2cf9c0,_0xcc35f){_0x2cf9c0=_0x2cf9c0-0x0;var _0xd457b3=_0x2032[_0x2cf9c0];return _0xd457b3;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 208568c..acb663e 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 _0xe7c9=['isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','status','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x548479,_0x57dd2b){var _0x5f0f84=function(_0x143503){while(--_0x143503){_0x548479['push'](_0x548479['shift']());}};_0x5f0f84(++_0x57dd2b);}(_0xe7c9,0xed));var _0x9e7c=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xe7c9[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require(_0x9e7c('0x0'));var util=require(_0x9e7c('0x1'));var path=require(_0x9e7c('0x2'));var timeout=require(_0x9e7c('0x3'));var express=require(_0x9e7c('0x4'));var router=express[_0x9e7c('0x5')]();var auth=require(_0x9e7c('0x6'));var interaction=require(_0x9e7c('0x7'));var config=require(_0x9e7c('0x8'));var controller=require(_0x9e7c('0x9'));router[_0x9e7c('0xa')]('/',auth[_0x9e7c('0xb')](),controller[_0x9e7c('0xc')]);router[_0x9e7c('0xa')](_0x9e7c('0xd'),auth[_0x9e7c('0xb')](),controller[_0x9e7c('0xe')]);router[_0x9e7c('0xa')](_0x9e7c('0xf'),auth[_0x9e7c('0xb')](),controller[_0x9e7c('0x10')]);router[_0x9e7c('0x11')]('/',auth[_0x9e7c('0xb')](),interaction[_0x9e7c('0x12')](_0x9e7c('0x13'),_0x9e7c('0x14')),controller[_0x9e7c('0x15')]);router[_0x9e7c('0x11')]('/:id/status',controller[_0x9e7c('0x16')]);router['put'](_0x9e7c('0xf'),auth[_0x9e7c('0xb')](),controller[_0x9e7c('0x17')]);router[_0x9e7c('0x18')](_0x9e7c('0x19'),auth[_0x9e7c('0xb')](),controller[_0x9e7c('0x1a')]);router[_0x9e7c('0x18')](_0x9e7c('0x1b'),auth['isAuthenticated'](),controller[_0x9e7c('0x1c')]);router['delete'](_0x9e7c('0xf'),auth[_0x9e7c('0xb')](),controller[_0x9e7c('0x1d')]);module[_0x9e7c('0x1e')]=router; \ No newline at end of file +var _0x91c3=['/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','sms','create'];(function(_0x31743d,_0x36e61c){var _0x1b5894=function(_0x126fbc){while(--_0x126fbc){_0x31743d['push'](_0x31743d['shift']());}};_0x1b5894(++_0x36e61c);}(_0x91c3,0x110));var _0x391c=function(_0x17158c,_0x58cb92){_0x17158c=_0x17158c-0x0;var _0x734f31=_0x91c3[_0x17158c];return _0x734f31;};'use strict';var multer=require(_0x391c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x391c('0x1'));var express=require('express');var router=express[_0x391c('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x391c('0x3'));var config=require(_0x391c('0x4'));var controller=require(_0x391c('0x5'));router['get']('/',auth[_0x391c('0x6')](),controller[_0x391c('0x7')]);router[_0x391c('0x8')](_0x391c('0x9'),auth['isAuthenticated'](),controller[_0x391c('0xa')]);router[_0x391c('0x8')](_0x391c('0xb'),auth[_0x391c('0x6')](),controller[_0x391c('0xc')]);router[_0x391c('0xd')]('/',auth[_0x391c('0x6')](),interaction['tracked'](_0x391c('0xe'),'smsmessage:create'),controller[_0x391c('0xf')]);router[_0x391c('0xd')](_0x391c('0x10'),controller['status']);router[_0x391c('0x11')](_0x391c('0xb'),auth[_0x391c('0x6')](),controller['update']);router['put'](_0x391c('0x12'),auth['isAuthenticated'](),controller[_0x391c('0x13')]);router['put'](_0x391c('0x14'),auth['isAuthenticated'](),controller[_0x391c('0x15')]);router[_0x391c('0x16')](_0x391c('0xb'),auth[_0x391c('0x6')](),controller[_0x391c('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 56e35bc..2d406bf 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 _0xa1aa=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa1aa,0x81));var _0xaa1a=function(_0x49ef8e,_0x3ea28d){_0x49ef8e=_0x49ef8e-0x0;var _0x67e338=_0xa1aa[_0x49ef8e];return _0x67e338;};'use strict';var Sequelize=require(_0xaa1a('0x0'));module[_0xaa1a('0x1')]={'body':{'type':Sequelize[_0xaa1a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xaa1a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa1a('0x4')]('in',_0xaa1a('0x5')),'defaultValue':_0xaa1a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa1a('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xaa1a('0x7')]},'secret':{'type':Sequelize[_0xaa1a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x644a=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x5e804f,_0xd2ba4){var _0x215ac2=function(_0x32be15){while(--_0x32be15){_0x5e804f['push'](_0x5e804f['shift']());}};_0x215ac2(++_0xd2ba4);}(_0x644a,0xfd));var _0xa644=function(_0x3febf8,_0x3a20b1){_0x3febf8=_0x3febf8-0x0;var _0x56b67d=_0x644a[_0x3febf8];return _0x56b67d;};'use strict';var Sequelize=require(_0xa644('0x0'));module[_0xa644('0x1')]={'body':{'type':Sequelize[_0xa644('0x2')](_0xa644('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa644('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa644('0x5')),'defaultValue':_0xa644('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa644('0x6')]},'secret':{'type':Sequelize[_0xa644('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 7776ddb..fa6b673 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 _0x8ce8=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','find','create','body','update','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','user','SmsInteractionId','UserId','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','EventManager','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','type','MessageSid','twilio','plivo','MessageUUID','messageId','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','inspect','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','./smsMessage.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','send','SmsMessage','rawAttributes','fieldName','key','model','map'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x8ce8,0xd3));var _0x88ce=function(_0x4ff245,_0x51141a){_0x4ff245=_0x4ff245-0x0;var _0x5d9552=_0x8ce8[_0x4ff245];return _0x5d9552;};'use strict';var pdf=require(_0x88ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x88ce('0x1'));var zipdir=require(_0x88ce('0x2'));var jsonpatch=require(_0x88ce('0x3'));var rp=require(_0x88ce('0x4'));var moment=require(_0x88ce('0x5'));var BPromise=require(_0x88ce('0x6'));var Mustache=require(_0x88ce('0x7'));var util=require(_0x88ce('0x8'));var path=require(_0x88ce('0x9'));var sox=require(_0x88ce('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x88ce('0xb'));var squel=require(_0x88ce('0xc'));var crypto=require(_0x88ce('0xd'));var jsforce=require(_0x88ce('0xe'));var deskjs=require(_0x88ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x88ce('0x11'));var authService=require(_0x88ce('0x12'));var qs=require(_0x88ce('0x13'));var as=require(_0x88ce('0x14'));var hardwareService=require(_0x88ce('0x15'));var logger=require(_0x88ce('0x16'))(_0x88ce('0x17'));var utils=require(_0x88ce('0x18'));var config=require('../../config/environment');var db=require(_0x88ce('0x19'))['db'];config['redis']=_[_0x88ce('0x1a')](config[_0x88ce('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88ce('0x1b')]));require(_0x88ce('0x1c'))[_0x88ce('0x1d')](socket);var jayson=require(_0x88ce('0x1e'));var client=jayson[_0x88ce('0x1f')][_0x88ce('0x20')]({'port':0x232c});var client9002=jayson[_0x88ce('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x3460e5,_0x5bcd5a,_0x3da93e){if(_0x3da93e){var _0x58d3da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58d3da[_0x88ce('0x21')](_0x5bcd5a)){return _0x3460e5;}else{throw new db[(_0x88ce('0x22'))][(_0x88ce('0x23'))](_0x88ce('0x24'));}}else{return _0x3460e5;}}function respondWithRpcPromise(_0x509a84,_0x50c9df,_0xdb0d1f,_0x65fa81){return new BPromise(function(_0x404df9,_0x338eff){var _0xa60138=_0x65fa81||client;return _0xa60138[_0x88ce('0x25')](_0x509a84,_0xdb0d1f)[_0x88ce('0x26')](function(_0x2fa7ac){logger[_0x88ce('0x27')](_0x88ce('0x28'),_0x50c9df,_0x88ce('0x29'));logger[_0x88ce('0x2a')](_0x88ce('0x2b'),_0x50c9df,_0x88ce('0x29'),JSON[_0x88ce('0x2c')](_0x2fa7ac));if(_0x2fa7ac[_0x88ce('0x2d')]){if(_0x2fa7ac['error'][_0x88ce('0x2e')]===0x1f4){logger[_0x88ce('0x2d')](_0x88ce('0x28'),_0x50c9df,_0x2fa7ac[_0x88ce('0x2d')][_0x88ce('0x2f')]);return _0x338eff(_0x2fa7ac['error']['message']);}logger['error'](_0x88ce('0x28'),_0x50c9df,_0x2fa7ac[_0x88ce('0x2d')][_0x88ce('0x2f')]);return _0x404df9(_0x2fa7ac['error']['message']);}else{logger[_0x88ce('0x27')](_0x88ce('0x28'),_0x50c9df,_0x88ce('0x29'));_0x404df9(_0x2fa7ac[_0x88ce('0x30')][_0x88ce('0x2f')]);}})[_0x88ce('0x31')](function(_0x19f00f){logger[_0x88ce('0x2d')](_0x88ce('0x28'),_0x50c9df,_0x19f00f);_0x338eff(_0x19f00f);});});}function respondWithStatusCode(_0x40aa83,_0x4209bc){_0x4209bc=_0x4209bc||0xcc;return function(_0x11ef49){if(_0x11ef49){return _0x40aa83[_0x88ce('0x32')](_0x4209bc);}return _0x40aa83[_0x88ce('0x33')](_0x4209bc)[_0x88ce('0x34')]();};}function respondWithResult(_0x1814d1,_0x47bbff){_0x47bbff=_0x47bbff||0xc8;return function(_0x4f4205){if(_0x4f4205){return _0x1814d1['status'](_0x47bbff)[_0x88ce('0x35')](_0x4f4205);}};}function respondWithFilteredResult(_0x4221c1,_0x6ea7e0){return function(_0x2fe609){if(_0x2fe609){var _0x544be7=_0x2fe609[_0x88ce('0x36')],_0x28e7a4=_0x6ea7e0[_0x88ce('0x37')],_0x2c9027=_0x6ea7e0[_0x88ce('0x37')]+_0x6ea7e0[_0x88ce('0x38')],_0x326ebe;if(_0x2c9027>=_0x544be7){_0x2c9027=_0x544be7;_0x326ebe=0xc8;}else{_0x326ebe=0xce;}_0x4221c1['status'](_0x326ebe);return _0x4221c1[_0x88ce('0x39')](_0x88ce('0x3a'),_0x28e7a4+'-'+_0x2c9027+'/'+_0x544be7)['json'](_0x2fe609);}return null;};}function patchUpdates(_0x404e3e){return function(_0x19775d){try{jsonpatch[_0x88ce('0x3b')](_0x19775d,_0x404e3e,!![]);}catch(_0x24fbbe){return BPromise[_0x88ce('0x3c')](_0x24fbbe);}return _0x19775d[_0x88ce('0x3d')]();};}function saveUpdates(_0x21e585,_0x12bcfa){return function(_0x410b52){if(_0x410b52){return _0x410b52['update'](_0x21e585)[_0x88ce('0x26')](function(_0x1da20a){return _0x1da20a;});}return null;};}function removeEntity(_0x1b1275,_0x4e6d98){return function(_0x3a51da){if(_0x3a51da){return _0x3a51da[_0x88ce('0x3e')]()['then'](function(){_0x1b1275['status'](0xcc)[_0x88ce('0x34')]();});}};}function handleEntityNotFound(_0x274e20,_0x19d91c){return function(_0x1e25ca){if(!_0x1e25ca){_0x274e20[_0x88ce('0x32')](0x194);}return _0x1e25ca;};}function handleError(_0x3639b8,_0x5140bd){_0x5140bd=_0x5140bd||0x1f4;return function(_0x79e5fb){logger[_0x88ce('0x2d')](_0x79e5fb['stack']);if(_0x79e5fb[_0x88ce('0x3f')]){delete _0x79e5fb[_0x88ce('0x3f')];}_0x3639b8['status'](_0x5140bd)[_0x88ce('0x40')](_0x79e5fb);};}exports['index']=function(_0x4149ff,_0x2268a6){var _0x3fa24f={},_0x2c2ec1={},_0x378436={'count':0x0,'rows':[]};var _0x96f54c=_['map'](db[_0x88ce('0x41')][_0x88ce('0x42')],function(_0x24172a){return{'name':_0x24172a[_0x88ce('0x43')],'type':_0x24172a['type'][_0x88ce('0x44')]};});_0x2c2ec1[_0x88ce('0x45')]=_[_0x88ce('0x46')](_0x96f54c,'name');_0x2c2ec1['query']=_[_0x88ce('0x47')](_0x4149ff[_0x88ce('0x48')]);_0x2c2ec1[_0x88ce('0x49')]=_['intersection'](_0x2c2ec1[_0x88ce('0x45')],_0x2c2ec1[_0x88ce('0x48')]);_0x3fa24f['attributes']=_[_0x88ce('0x4a')](_0x2c2ec1[_0x88ce('0x45')],qs[_0x88ce('0x4b')](_0x4149ff[_0x88ce('0x48')][_0x88ce('0x4b')]));_0x3fa24f['attributes']=_0x3fa24f[_0x88ce('0x4c')][_0x88ce('0x4d')]?_0x3fa24f[_0x88ce('0x4c')]:_0x2c2ec1[_0x88ce('0x45')];if(!_0x4149ff[_0x88ce('0x48')][_0x88ce('0x4e')](_0x88ce('0x4f'))){_0x3fa24f['limit']=qs[_0x88ce('0x38')](_0x4149ff[_0x88ce('0x48')]['limit']);_0x3fa24f[_0x88ce('0x37')]=qs[_0x88ce('0x37')](_0x4149ff['query']['offset']);}_0x3fa24f['order']=qs[_0x88ce('0x50')](_0x4149ff[_0x88ce('0x48')][_0x88ce('0x50')]);_0x3fa24f[_0x88ce('0x51')]=qs[_0x88ce('0x49')](_[_0x88ce('0x52')](_0x4149ff[_0x88ce('0x48')],_0x2c2ec1['filters']),_0x96f54c);if(_0x4149ff[_0x88ce('0x48')]['filter']){_0x3fa24f[_0x88ce('0x51')]=_[_0x88ce('0x53')](_0x3fa24f[_0x88ce('0x51')],{'$or':_['map'](_0x96f54c,function(_0x32e0c0){if(_0x32e0c0['type']!==_0x88ce('0x54')){var _0x44b75c={};_0x44b75c[_0x32e0c0[_0x88ce('0x3f')]]={'$like':'%'+_0x4149ff[_0x88ce('0x48')][_0x88ce('0x55')]+'%'};return _0x44b75c;}})});}_0x3fa24f=_[_0x88ce('0x53')]({},_0x3fa24f,_0x4149ff[_0x88ce('0x56')]);var _0x530800={'where':_0x3fa24f[_0x88ce('0x51')]};return db[_0x88ce('0x41')][_0x88ce('0x36')](_0x530800)[_0x88ce('0x26')](function(_0x4a3836){_0x378436['count']=_0x4a3836;if(_0x4149ff[_0x88ce('0x48')][_0x88ce('0x57')]){_0x3fa24f[_0x88ce('0x58')]=[{'all':!![]}];}return db[_0x88ce('0x41')][_0x88ce('0x59')](_0x3fa24f);})[_0x88ce('0x26')](function(_0x4e4933){_0x378436['rows']=_0x4e4933;return _0x378436;})['then'](respondWithFilteredResult(_0x2268a6,_0x3fa24f))[_0x88ce('0x31')](handleError(_0x2268a6,null));};exports['show']=function(_0x5c2231,_0x47d0c7){var _0x13e84f={'raw':!![],'where':{'id':_0x5c2231[_0x88ce('0x5a')]['id']}},_0x53dcf9={};_0x53dcf9[_0x88ce('0x45')]=_[_0x88ce('0x47')](db[_0x88ce('0x41')][_0x88ce('0x42')]);_0x53dcf9[_0x88ce('0x48')]=_['keys'](_0x5c2231['query']);_0x53dcf9[_0x88ce('0x49')]=_[_0x88ce('0x4a')](_0x53dcf9[_0x88ce('0x45')],_0x53dcf9[_0x88ce('0x48')]);_0x13e84f['attributes']=_['intersection'](_0x53dcf9[_0x88ce('0x45')],qs[_0x88ce('0x4b')](_0x5c2231[_0x88ce('0x48')][_0x88ce('0x4b')]));_0x13e84f[_0x88ce('0x4c')]=_0x13e84f[_0x88ce('0x4c')][_0x88ce('0x4d')]?_0x13e84f[_0x88ce('0x4c')]:_0x53dcf9[_0x88ce('0x45')];if(_0x5c2231[_0x88ce('0x48')][_0x88ce('0x57')]){_0x13e84f[_0x88ce('0x58')]=[{'all':!![]}];}_0x13e84f=_[_0x88ce('0x53')]({},_0x13e84f,_0x5c2231['options']);return db[_0x88ce('0x41')][_0x88ce('0x5b')](_0x13e84f)[_0x88ce('0x26')](handleEntityNotFound(_0x47d0c7,null))[_0x88ce('0x26')](respondWithResult(_0x47d0c7,null))[_0x88ce('0x31')](handleError(_0x47d0c7,null));};exports[_0x88ce('0x5c')]=function(_0x59ba17,_0x16bba0){return db['SmsMessage'][_0x88ce('0x5c')](_0x59ba17[_0x88ce('0x5d')],{})[_0x88ce('0x26')](respondWithResult(_0x16bba0,0xc9))[_0x88ce('0x31')](handleError(_0x16bba0,null));};exports[_0x88ce('0x5e')]=function(_0x4ab8da,_0x39432f){if(_0x4ab8da[_0x88ce('0x5d')]['id']){delete _0x4ab8da['body']['id'];}return db[_0x88ce('0x41')]['find']({'where':{'id':_0x4ab8da[_0x88ce('0x5a')]['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x39432f,null))[_0x88ce('0x26')](saveUpdates(_0x4ab8da['body'],null))[_0x88ce('0x26')](respondWithResult(_0x39432f,null))[_0x88ce('0x31')](handleError(_0x39432f,null));};exports[_0x88ce('0x3e')]=function(_0x1988ab,_0x317321){return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x1988ab[_0x88ce('0x5a')]['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x317321,null))['then'](removeEntity(_0x317321,null))['catch'](handleError(_0x317321,null));};exports[_0x88ce('0x5f')]=function(_0x1d213d,_0x25f269){return db['SmsMessage'][_0x88ce('0x5f')]()['then'](respondWithResult(_0x25f269,null))['catch'](handleError(_0x25f269,null));};var interaction_log=require('../../config/logger')(_0x88ce('0x60'));exports['accept']=function(_0xaf4625,_0xe02ae1,_0x1fbf55){var _0x4a6af7={'channel':_0x88ce('0x61')};if(_0xaf4625['body']['id']){delete _0xaf4625[_0x88ce('0x5d')]['id'];}_0xaf4625[_0x88ce('0x5d')][_0x88ce('0x62')]=!![];_0xaf4625[_0x88ce('0x5d')]['readAt']=moment()[_0x88ce('0x63')](_0x88ce('0x64'));_0xaf4625[_0x88ce('0x5d')]['UserId']=_0xaf4625['body']['UserId']||_0xaf4625[_0x88ce('0x65')]['id'];return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0xaf4625[_0x88ce('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0xe02ae1,null))[_0x88ce('0x26')](saveUpdates(_0xaf4625[_0x88ce('0x5d')],null))[_0x88ce('0x26')](function(_0x1e7487){if(_0x1e7487){_0x4a6af7[_0x88ce('0x2f')]=_0x1e7487['get']({'plain':!![]});return db['SmsInteraction'][_0x88ce('0x5b')]({'where':{'id':_0x1e7487[_0x88ce('0x66')]}});}return null;})[_0x88ce('0x26')](handleEntityNotFound(_0xe02ae1,null))[_0x88ce('0x26')](function(_0x385288){if(_0x385288){return _0x385288['update']({'UserId':_0xaf4625['body'][_0x88ce('0x67')],'read1stAt':_[_0x88ce('0x68')](_0x385288[_0x88ce('0x69')])?moment()[_0x88ce('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x88ce('0x26')](function(_0x4e8c71){if(_0x4e8c71){_0x4a6af7['interaction']=_0x4e8c71[_0x88ce('0x6a')]({'plain':!![]});interaction_log[_0x88ce('0x27')](_0x88ce('0x6b'),_0xaf4625[_0x88ce('0x65')]['id'],_0xaf4625[_0x88ce('0x65')][_0x88ce('0x3f')],_0xaf4625[_0x88ce('0x65')][_0x88ce('0x6c')],_0x4a6af7[_0x88ce('0x6d')]['id'],_0xaf4625[_0x88ce('0x5d')]?JSON[_0x88ce('0x2c')](_0xaf4625[_0x88ce('0x5d')]):_0x88ce('0x6e'));return respondWithRpcPromise(_0x88ce('0x6f'),_0x88ce('0x70'),_0x4a6af7);}return null;})[_0x88ce('0x26')](function(_0xde1b4f){if(_0xde1b4f){if(_0xaf4625[_0x88ce('0x5d')][_0x88ce('0x71')]){_0x4a6af7['message']['interface']=util[_0x88ce('0x63')](_0x88ce('0x72'),_0xaf4625[_0x88ce('0x65')]['name']);_0x4a6af7[_0x88ce('0x2f')]['channel']=_0x4a6af7[_0x88ce('0x73')];_0x4a6af7[_0x88ce('0x2f')][_0x88ce('0x74')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x4a6af7['message']},client9002)['then'](function(){return _0x4a6af7;});}return _0x4a6af7;}return null;})[_0x88ce('0x26')](respondWithResult(_0xe02ae1,null))[_0x88ce('0x31')](handleError(_0xe02ae1,null));};var interaction_log=require('../../config/logger')(_0x88ce('0x60'));exports[_0x88ce('0x3c')]=function(_0x46b254,_0x13092e,_0x3878e7){var _0x363992={'agent':{},'channel':_0x88ce('0x61')};if(_0x46b254[_0x88ce('0x5d')]['id']){delete _0x46b254[_0x88ce('0x5d')]['id'];}_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')]=_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')]||_0x46b254['user']['id'];_0x363992['agent']['id']=_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')];return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x46b254['params']['id'],'UserId':null}})[_0x88ce('0x26')](handleEntityNotFound(_0x13092e,null))[_0x88ce('0x26')](function(_0x8bec41){if(_0x8bec41){_0x363992['message']=_0x8bec41['get']({'plain':!![]});return db[_0x88ce('0x75')][_0x88ce('0x5b')]({'where':{'id':_0x8bec41[_0x88ce('0x66')]}});}return null;})[_0x88ce('0x26')](handleEntityNotFound(_0x13092e,null))['then'](function(_0x44f25a){if(_0x44f25a){_0x363992[_0x88ce('0x6d')]=_0x44f25a[_0x88ce('0x6a')]({'plain':!![]});interaction_log[_0x88ce('0x27')](_0x88ce('0x76'),_0x46b254[_0x88ce('0x65')]['id'],_0x46b254[_0x88ce('0x65')][_0x88ce('0x3f')],_0x46b254[_0x88ce('0x65')][_0x88ce('0x6c')],_0x363992[_0x88ce('0x6d')]['id'],_0x46b254['body']?JSON[_0x88ce('0x2c')](_0x46b254[_0x88ce('0x5d')]):_0x88ce('0x6e'));return respondWithRpcPromise(_0x88ce('0x77'),'rejectMessage',_0x363992);}return null;})[_0x88ce('0x26')](function(_0x19ba1b){if(_0x19ba1b){_0x19ba1b['message'][_0x88ce('0x78')]=util[_0x88ce('0x63')](_0x88ce('0x72'),_0x46b254[_0x88ce('0x65')][_0x88ce('0x3f')]);_0x19ba1b[_0x88ce('0x2f')]['channel']=_0x363992['channel'];_0x19ba1b[_0x88ce('0x2f')][_0x88ce('0x74')]='reject';respondWithRpcPromise('EventManager',_0x88ce('0x79'),{'event':_0x88ce('0x7a'),'message':_0x19ba1b[_0x88ce('0x2f')]},client9002);return _0x363992;}return null;})[_0x88ce('0x26')](respondWithResult(_0x13092e,null))[_0x88ce('0x31')](handleError(_0x13092e,null));};exports[_0x88ce('0x33')]=function(_0x1ea61b,_0x1c613d,_0x5a3566){if(_0x1ea61b[_0x88ce('0x5d')]['id']){delete _0x1ea61b[_0x88ce('0x5d')]['id'];}var _0x2b00ec;return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x1ea61b['params']['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x1c613d,null))[_0x88ce('0x26')](function(_0x2523d8){if(_0x2523d8){_0x2b00ec=_0x2523d8;return db[_0x88ce('0x7b')]['find']({'where':{'id':_0x2523d8['SmsAccountId']}});}})[_0x88ce('0x26')](handleEntityNotFound(_0x1c613d,null))[_0x88ce('0x26')](function(_0x1c5849){if(_0x1c5849){logger[_0x88ce('0x2a')](_0x88ce('0x2b'),_0x88ce('0x33'),_0x88ce('0x7c'),_0x1c5849[_0x88ce('0x7d')],util['inspect'](_0x1ea61b[_0x88ce('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1c5849[_0x88ce('0x7d')]){case'twilio':if(_0x1ea61b['body'][_0x88ce('0x7e')]&&_0x1ea61b[_0x88ce('0x5d')]['MessageSid']===_0x2b00ec['messageId']){return _0x2b00ec['update']({'read':!![]});}else{logger[_0x88ce('0x2d')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x88ce('0x7f'),util['inspect'](_0x1ea61b[_0x88ce('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x88ce('0x80'):if(_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x81')]&&_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x81')]===_0x2b00ec[_0x88ce('0x82')]&&_['indexOf']([_0x88ce('0x83'),_0x88ce('0x84')],_0x1ea61b['body'][_0x88ce('0x85')])>=0x0){return _0x2b00ec[_0x88ce('0x5e')]({'read':!![]});}else{logger[_0x88ce('0x2d')](_0x88ce('0x86'),_0x88ce('0x33'),_0x88ce('0x87'),util[_0x88ce('0x88')](_0x1ea61b['body'],{'showHidden':![],'depth':null}));}break;case _0x88ce('0x89'):var _0x45f901=_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x8a')][0x0];if(_0x45f901[_0x88ce('0x33')][_0x88ce('0x8b')]===_0x88ce('0x8c')){return _0x2b00ec[_0x88ce('0x5e')]({'read':!![]});}else{logger['error'](_0x88ce('0x86'),_0x88ce('0x33'),_0x88ce('0x89'),util[_0x88ce('0x88')](_0x1ea61b['body'],{'showHidden':![],'depth':null}));}break;}return _0x2b00ec;}})[_0x88ce('0x26')](respondWithResult(_0x1c613d,null))[_0x88ce('0x31')](handleError(_0x1c613d,null));}; \ No newline at end of file +var _0xbefe=['request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','count','offset','limit','set','json','apply','reject','save','update','destroy','end','sendStatus','stack','map','rawAttributes','key','keys','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','name','SmsMessage','includeAll','include','findAll','show','params','find','catch','create','body','describe','sms-interactions','accept','read','format','UserId','user','CmContact','get','SmsInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','stringify','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','agent','SmsInteractionId','RejectMessage','rejectMessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','type','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','infobip','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./smsMessage.socket','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','then','info','SmsMessage,\x20%s,\x20%s'];(function(_0x326c89,_0x5c63d3){var _0x2610ef=function(_0xbfa4bd){while(--_0xbfa4bd){_0x326c89['push'](_0x326c89['shift']());}};_0x2610ef(++_0x5c63d3);}(_0xbefe,0x168));var _0xebef=function(_0x23cf72,_0x22e108){_0x23cf72=_0x23cf72-0x0;var _0x3bc541=_0xbefe[_0x23cf72];return _0x3bc541;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xebef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xebef('0x1'));var jsonpatch=require(_0xebef('0x2'));var rp=require(_0xebef('0x3'));var moment=require(_0xebef('0x4'));var BPromise=require(_0xebef('0x5'));var Mustache=require(_0xebef('0x6'));var util=require(_0xebef('0x7'));var path=require(_0xebef('0x8'));var sox=require('sox');var csv=require(_0xebef('0x9'));var ejs=require(_0xebef('0xa'));var fs=require('fs');var _=require(_0xebef('0xb'));var squel=require('squel');var crypto=require(_0xebef('0xc'));var jsforce=require(_0xebef('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebef('0xe'));var Papa=require(_0xebef('0xf'));var Redis=require(_0xebef('0x10'));var authService=require(_0xebef('0x11'));var qs=require(_0xebef('0x12'));var as=require(_0xebef('0x13'));var hardwareService=require(_0xebef('0x14'));var logger=require(_0xebef('0x15'))('api');var utils=require(_0xebef('0x16'));var config=require(_0xebef('0x17'));var db=require(_0xebef('0x18'))['db'];config[_0xebef('0x19')]=_[_0xebef('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xebef('0x1b'))[_0xebef('0x1c')](socket);var jayson=require(_0xebef('0x1d'));var client=jayson[_0xebef('0x1e')][_0xebef('0x1f')]({'port':0x232c});var client9002=jayson[_0xebef('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x32ec37,_0x9411d4,_0x1921aa){if(_0x1921aa){var _0x46849f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x46849f[_0xebef('0x20')](_0x9411d4)){return _0x32ec37;}else{throw new db[(_0xebef('0x21'))][(_0xebef('0x22'))](_0xebef('0x23'));}}else{return _0x32ec37;}}function respondWithRpcPromise(_0x2e5efa,_0x16856f,_0x458e83,_0x5161f1){return new BPromise(function(_0x1a99ba,_0x226c8e){var _0x55441e=_0x5161f1||client;return _0x55441e['request'](_0x2e5efa,_0x458e83)[_0xebef('0x24')](function(_0x3bb263){logger[_0xebef('0x25')](_0xebef('0x26'),_0x16856f,_0xebef('0x27'));logger[_0xebef('0x28')](_0xebef('0x29'),_0x16856f,'request\x20sent',JSON['stringify'](_0x3bb263));if(_0x3bb263['error']){if(_0x3bb263[_0xebef('0x2a')][_0xebef('0x2b')]===0x1f4){logger[_0xebef('0x2a')](_0xebef('0x26'),_0x16856f,_0x3bb263[_0xebef('0x2a')][_0xebef('0x2c')]);return _0x226c8e(_0x3bb263[_0xebef('0x2a')]['message']);}logger[_0xebef('0x2a')](_0xebef('0x26'),_0x16856f,_0x3bb263[_0xebef('0x2a')][_0xebef('0x2c')]);return _0x1a99ba(_0x3bb263[_0xebef('0x2a')][_0xebef('0x2c')]);}else{logger[_0xebef('0x25')](_0xebef('0x26'),_0x16856f,_0xebef('0x27'));_0x1a99ba(_0x3bb263[_0xebef('0x2d')][_0xebef('0x2c')]);}})['catch'](function(_0xc068de){logger['error']('SmsMessage,\x20%s,\x20%s',_0x16856f,_0xc068de);_0x226c8e(_0xc068de);});});}function respondWithStatusCode(_0x56b67e,_0x4d93c5){_0x4d93c5=_0x4d93c5||0xcc;return function(_0x48064c){if(_0x48064c){return _0x56b67e['sendStatus'](_0x4d93c5);}return _0x56b67e['status'](_0x4d93c5)['end']();};}function respondWithResult(_0x506e64,_0x5a9249){_0x5a9249=_0x5a9249||0xc8;return function(_0x54001c){if(_0x54001c){return _0x506e64[_0xebef('0x2e')](_0x5a9249)['json'](_0x54001c);}};}function respondWithFilteredResult(_0x100a20,_0x4a0b36){return function(_0x3efbc4){if(_0x3efbc4){var _0xa0a713=_0x3efbc4[_0xebef('0x2f')],_0x4eb25b=_0x4a0b36[_0xebef('0x30')],_0x4085d9=_0x4a0b36[_0xebef('0x30')]+_0x4a0b36[_0xebef('0x31')],_0x5aa0b3;if(_0x4085d9>=_0xa0a713){_0x4085d9=_0xa0a713;_0x5aa0b3=0xc8;}else{_0x5aa0b3=0xce;}_0x100a20[_0xebef('0x2e')](_0x5aa0b3);return _0x100a20[_0xebef('0x32')]('Content-Range',_0x4eb25b+'-'+_0x4085d9+'/'+_0xa0a713)[_0xebef('0x33')](_0x3efbc4);}return null;};}function patchUpdates(_0x4dba5f){return function(_0x41e58e){try{jsonpatch[_0xebef('0x34')](_0x41e58e,_0x4dba5f,!![]);}catch(_0xd48fc3){return BPromise[_0xebef('0x35')](_0xd48fc3);}return _0x41e58e[_0xebef('0x36')]();};}function saveUpdates(_0x2871df,_0x329ffd){return function(_0x5c7473){if(_0x5c7473){return _0x5c7473[_0xebef('0x37')](_0x2871df)[_0xebef('0x24')](function(_0x42ae33){return _0x42ae33;});}return null;};}function removeEntity(_0x307592,_0x674208){return function(_0xf7956e){if(_0xf7956e){return _0xf7956e[_0xebef('0x38')]()['then'](function(){_0x307592[_0xebef('0x2e')](0xcc)[_0xebef('0x39')]();});}};}function handleEntityNotFound(_0x4ac48b,_0x4673fd){return function(_0x5c802f){if(!_0x5c802f){_0x4ac48b[_0xebef('0x3a')](0x194);}return _0x5c802f;};}function handleError(_0x594e01,_0x879693){_0x879693=_0x879693||0x1f4;return function(_0x5ceecc){logger[_0xebef('0x2a')](_0x5ceecc[_0xebef('0x3b')]);if(_0x5ceecc['name']){delete _0x5ceecc['name'];}_0x594e01[_0xebef('0x2e')](_0x879693)['send'](_0x5ceecc);};}exports['index']=function(_0x520110,_0x102fbf){var _0x5536ba={},_0x564c73={},_0x2a774c={'count':0x0,'rows':[]};var _0xd9406=_[_0xebef('0x3c')](db['SmsMessage'][_0xebef('0x3d')],function(_0x4d61c1){return{'name':_0x4d61c1['fieldName'],'type':_0x4d61c1['type'][_0xebef('0x3e')]};});_0x564c73['model']=_[_0xebef('0x3c')](_0xd9406,'name');_0x564c73['query']=_[_0xebef('0x3f')](_0x520110[_0xebef('0x40')]);_0x564c73[_0xebef('0x41')]=_[_0xebef('0x42')](_0x564c73[_0xebef('0x43')],_0x564c73[_0xebef('0x40')]);_0x5536ba['attributes']=_[_0xebef('0x42')](_0x564c73[_0xebef('0x43')],qs[_0xebef('0x44')](_0x520110[_0xebef('0x40')][_0xebef('0x44')]));_0x5536ba[_0xebef('0x45')]=_0x5536ba[_0xebef('0x45')][_0xebef('0x46')]?_0x5536ba[_0xebef('0x45')]:_0x564c73[_0xebef('0x43')];if(!_0x520110['query']['hasOwnProperty']('nolimit')){_0x5536ba['limit']=qs[_0xebef('0x31')](_0x520110[_0xebef('0x40')][_0xebef('0x31')]);_0x5536ba[_0xebef('0x30')]=qs[_0xebef('0x30')](_0x520110['query']['offset']);}_0x5536ba[_0xebef('0x47')]=qs['sort'](_0x520110['query'][_0xebef('0x48')]);_0x5536ba[_0xebef('0x49')]=qs[_0xebef('0x41')](_[_0xebef('0x4a')](_0x520110[_0xebef('0x40')],_0x564c73[_0xebef('0x41')]),_0xd9406);if(_0x520110[_0xebef('0x40')][_0xebef('0x4b')]){_0x5536ba[_0xebef('0x49')]=_[_0xebef('0x4c')](_0x5536ba[_0xebef('0x49')],{'$or':_[_0xebef('0x3c')](_0xd9406,function(_0xaaac01){if(_0xaaac01['type']!==_0xebef('0x4d')){var _0x221451={};_0x221451[_0xaaac01[_0xebef('0x4e')]]={'$like':'%'+_0x520110[_0xebef('0x40')][_0xebef('0x4b')]+'%'};return _0x221451;}})});}_0x5536ba=_[_0xebef('0x4c')]({},_0x5536ba,_0x520110['options']);var _0x405321={'where':_0x5536ba[_0xebef('0x49')]};return db[_0xebef('0x4f')]['count'](_0x405321)['then'](function(_0x3a35f5){_0x2a774c['count']=_0x3a35f5;if(_0x520110[_0xebef('0x40')][_0xebef('0x50')]){_0x5536ba[_0xebef('0x51')]=[{'all':!![]}];}return db[_0xebef('0x4f')][_0xebef('0x52')](_0x5536ba);})[_0xebef('0x24')](function(_0x30972b){_0x2a774c['rows']=_0x30972b;return _0x2a774c;})[_0xebef('0x24')](respondWithFilteredResult(_0x102fbf,_0x5536ba))['catch'](handleError(_0x102fbf,null));};exports[_0xebef('0x53')]=function(_0x212592,_0x9366d3){var _0x31704c={'raw':!![],'where':{'id':_0x212592[_0xebef('0x54')]['id']}},_0x4b91d3={};_0x4b91d3['model']=_['keys'](db[_0xebef('0x4f')][_0xebef('0x3d')]);_0x4b91d3[_0xebef('0x40')]=_[_0xebef('0x3f')](_0x212592[_0xebef('0x40')]);_0x4b91d3[_0xebef('0x41')]=_[_0xebef('0x42')](_0x4b91d3[_0xebef('0x43')],_0x4b91d3[_0xebef('0x40')]);_0x31704c[_0xebef('0x45')]=_[_0xebef('0x42')](_0x4b91d3[_0xebef('0x43')],qs[_0xebef('0x44')](_0x212592[_0xebef('0x40')][_0xebef('0x44')]));_0x31704c[_0xebef('0x45')]=_0x31704c[_0xebef('0x45')][_0xebef('0x46')]?_0x31704c[_0xebef('0x45')]:_0x4b91d3['model'];if(_0x212592['query']['includeAll']){_0x31704c[_0xebef('0x51')]=[{'all':!![]}];}_0x31704c=_['merge']({},_0x31704c,_0x212592['options']);return db[_0xebef('0x4f')][_0xebef('0x55')](_0x31704c)[_0xebef('0x24')](handleEntityNotFound(_0x9366d3,null))['then'](respondWithResult(_0x9366d3,null))[_0xebef('0x56')](handleError(_0x9366d3,null));};exports[_0xebef('0x57')]=function(_0x1f4a90,_0x2d8d88){return db[_0xebef('0x4f')][_0xebef('0x57')](_0x1f4a90['body'],{})[_0xebef('0x24')](respondWithResult(_0x2d8d88,0xc9))[_0xebef('0x56')](handleError(_0x2d8d88,null));};exports['update']=function(_0x508524,_0x587a9e){if(_0x508524[_0xebef('0x58')]['id']){delete _0x508524[_0xebef('0x58')]['id'];}return db[_0xebef('0x4f')][_0xebef('0x55')]({'where':{'id':_0x508524[_0xebef('0x54')]['id']}})[_0xebef('0x24')](handleEntityNotFound(_0x587a9e,null))['then'](saveUpdates(_0x508524[_0xebef('0x58')],null))[_0xebef('0x24')](respondWithResult(_0x587a9e,null))[_0xebef('0x56')](handleError(_0x587a9e,null));};exports['destroy']=function(_0x4225ac,_0x577682){return db['SmsMessage'][_0xebef('0x55')]({'where':{'id':_0x4225ac[_0xebef('0x54')]['id']}})[_0xebef('0x24')](handleEntityNotFound(_0x577682,null))[_0xebef('0x24')](removeEntity(_0x577682,null))[_0xebef('0x56')](handleError(_0x577682,null));};exports[_0xebef('0x59')]=function(_0xaa08e1,_0x55d2b5){return db[_0xebef('0x4f')][_0xebef('0x59')]()[_0xebef('0x24')](respondWithResult(_0x55d2b5,null))[_0xebef('0x56')](handleError(_0x55d2b5,null));};var interaction_log=require('../../config/logger')(_0xebef('0x5a'));exports[_0xebef('0x5b')]=function(_0x10e688,_0x358fd7,_0x5d3773){var _0x2a3091={'channel':'sms'};if(_0x10e688[_0xebef('0x58')]['id']){delete _0x10e688['body']['id'];}_0x10e688[_0xebef('0x58')][_0xebef('0x5c')]=!![];_0x10e688[_0xebef('0x58')]['readAt']=moment()[_0xebef('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x10e688[_0xebef('0x58')][_0xebef('0x5e')]=_0x10e688[_0xebef('0x58')][_0xebef('0x5e')]||_0x10e688[_0xebef('0x5f')]['id'];return db['SmsMessage'][_0xebef('0x55')]({'where':{'id':_0x10e688[_0xebef('0x54')]['id'],'UserId':null},'include':[{'model':db[_0xebef('0x60')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x358fd7,null))[_0xebef('0x24')](saveUpdates(_0x10e688[_0xebef('0x58')],null))[_0xebef('0x24')](function(_0x1dbb4e){if(_0x1dbb4e){_0x2a3091[_0xebef('0x2c')]=_0x1dbb4e[_0xebef('0x61')]({'plain':!![]});return db[_0xebef('0x62')][_0xebef('0x55')]({'where':{'id':_0x1dbb4e['SmsInteractionId']}});}return null;})[_0xebef('0x24')](handleEntityNotFound(_0x358fd7,null))[_0xebef('0x24')](function(_0x5befb7){if(_0x5befb7){return _0x5befb7[_0xebef('0x37')]({'UserId':_0x10e688[_0xebef('0x58')]['UserId'],'read1stAt':_['isNil'](_0x5befb7[_0xebef('0x63')])?moment()[_0xebef('0x5d')](_0xebef('0x64')):undefined});}return null;})['then'](function(_0x1e5c87){if(_0x1e5c87){_0x2a3091[_0xebef('0x65')]=_0x1e5c87[_0xebef('0x61')]({'plain':!![]});interaction_log[_0xebef('0x25')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x10e688['user']['id'],_0x10e688[_0xebef('0x5f')][_0xebef('0x4e')],_0x10e688[_0xebef('0x5f')][_0xebef('0x66')],_0x2a3091[_0xebef('0x65')]['id'],_0x10e688[_0xebef('0x58')]?JSON[_0xebef('0x67')](_0x10e688[_0xebef('0x58')]):_0xebef('0x68'));return respondWithRpcPromise(_0xebef('0x69'),'acceptMessage',_0x2a3091);}return null;})[_0xebef('0x24')](function(_0x76711c){if(_0x76711c){if(_0x10e688[_0xebef('0x58')][_0xebef('0x6a')]){_0x2a3091[_0xebef('0x2c')][_0xebef('0x6b')]=util['format'](_0xebef('0x6c'),_0x10e688[_0xebef('0x5f')][_0xebef('0x4e')]);_0x2a3091['message'][_0xebef('0x6d')]=_0x2a3091['channel'];_0x2a3091['message'][_0xebef('0x6e')]='accept';return respondWithRpcPromise(_0xebef('0x6f'),'EventManager',{'event':_0xebef('0x70'),'message':_0x2a3091[_0xebef('0x2c')]},client9002)[_0xebef('0x24')](function(){return _0x2a3091;});}return _0x2a3091;}return null;})[_0xebef('0x24')](respondWithResult(_0x358fd7,null))[_0xebef('0x56')](handleError(_0x358fd7,null));};var interaction_log=require(_0xebef('0x15'))(_0xebef('0x5a'));exports[_0xebef('0x35')]=function(_0x242487,_0x2463f9,_0x3673e1){var _0x5960be={'agent':{},'channel':_0xebef('0x71')};if(_0x242487[_0xebef('0x58')]['id']){delete _0x242487[_0xebef('0x58')]['id'];}_0x242487[_0xebef('0x58')]['UserId']=_0x242487[_0xebef('0x58')]['UserId']||_0x242487[_0xebef('0x5f')]['id'];_0x5960be[_0xebef('0x72')]['id']=_0x242487[_0xebef('0x58')][_0xebef('0x5e')];return db[_0xebef('0x4f')][_0xebef('0x55')]({'where':{'id':_0x242487[_0xebef('0x54')]['id'],'UserId':null}})[_0xebef('0x24')](handleEntityNotFound(_0x2463f9,null))[_0xebef('0x24')](function(_0x5a99eb){if(_0x5a99eb){_0x5960be[_0xebef('0x2c')]=_0x5a99eb['get']({'plain':!![]});return db[_0xebef('0x62')]['find']({'where':{'id':_0x5a99eb[_0xebef('0x73')]}});}return null;})[_0xebef('0x24')](handleEntityNotFound(_0x2463f9,null))['then'](function(_0x26da4e){if(_0x26da4e){_0x5960be['interaction']=_0x26da4e[_0xebef('0x61')]({'plain':!![]});interaction_log[_0xebef('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x242487[_0xebef('0x5f')]['id'],_0x242487['user']['name'],_0x242487[_0xebef('0x5f')][_0xebef('0x66')],_0x5960be[_0xebef('0x65')]['id'],_0x242487[_0xebef('0x58')]?JSON[_0xebef('0x67')](_0x242487[_0xebef('0x58')]):_0xebef('0x68'));return respondWithRpcPromise(_0xebef('0x74'),_0xebef('0x75'),_0x5960be);}return null;})[_0xebef('0x24')](function(_0x4bcd6f){if(_0x4bcd6f){_0x4bcd6f['message'][_0xebef('0x6b')]=util[_0xebef('0x5d')](_0xebef('0x6c'),_0x242487[_0xebef('0x5f')][_0xebef('0x4e')]);_0x4bcd6f[_0xebef('0x2c')][_0xebef('0x6d')]=_0x5960be['channel'];_0x4bcd6f['message']['event']=_0xebef('0x35');respondWithRpcPromise(_0xebef('0x6f'),_0xebef('0x6f'),{'event':'rejectmessage','message':_0x4bcd6f[_0xebef('0x2c')]},client9002);return _0x5960be;}return null;})[_0xebef('0x24')](respondWithResult(_0x2463f9,null))[_0xebef('0x56')](handleError(_0x2463f9,null));};exports[_0xebef('0x2e')]=function(_0x59a236,_0x2c4de1,_0x101e9d){if(_0x59a236['body']['id']){delete _0x59a236[_0xebef('0x58')]['id'];}var _0x887b89;return db[_0xebef('0x4f')][_0xebef('0x55')]({'where':{'id':_0x59a236[_0xebef('0x54')]['id']}})[_0xebef('0x24')](handleEntityNotFound(_0x2c4de1,null))[_0xebef('0x24')](function(_0x1b7049){if(_0x1b7049){_0x887b89=_0x1b7049;return db[_0xebef('0x76')][_0xebef('0x55')]({'where':{'id':_0x1b7049[_0xebef('0x77')]}});}})[_0xebef('0x24')](handleEntityNotFound(_0x2c4de1,null))['then'](function(_0x467c17){if(_0x467c17){logger[_0xebef('0x28')](_0xebef('0x29'),_0xebef('0x2e'),_0xebef('0x78'),_0x467c17['type'],util[_0xebef('0x79')](_0x59a236[_0xebef('0x58')],{'showHidden':![],'depth':null}));switch(_0x467c17[_0xebef('0x7a')]){case _0xebef('0x7b'):if(_0x59a236[_0xebef('0x58')][_0xebef('0x7c')]&&_0x59a236[_0xebef('0x58')][_0xebef('0x7c')]===_0x887b89[_0xebef('0x7d')]){return _0x887b89['update']({'read':!![]});}else{logger[_0xebef('0x2a')](_0xebef('0x7e'),_0xebef('0x2e'),'twilio',util[_0xebef('0x79')](_0x59a236['body'],{'showHidden':![],'depth':null}));}break;case _0xebef('0x7f'):if(_0x59a236['body']['MessageUUID']&&_0x59a236[_0xebef('0x58')][_0xebef('0x80')]===_0x887b89[_0xebef('0x7d')]&&_[_0xebef('0x81')](['sent','delivered'],_0x59a236[_0xebef('0x58')][_0xebef('0x82')])>=0x0){return _0x887b89[_0xebef('0x37')]({'read':!![]});}else{logger[_0xebef('0x2a')](_0xebef('0x7e'),_0xebef('0x2e'),'plivio',util['inspect'](_0x59a236[_0xebef('0x58')],{'showHidden':![],'depth':null}));}break;case _0xebef('0x83'):var _0x4b33de=_0x59a236[_0xebef('0x58')]['results'][0x0];if(_0x4b33de[_0xebef('0x2e')]['groupName']===_0xebef('0x84')){return _0x887b89[_0xebef('0x37')]({'read':!![]});}else{logger[_0xebef('0x2a')](_0xebef('0x7e'),_0xebef('0x2e'),_0xebef('0x83'),util[_0xebef('0x79')](_0x59a236[_0xebef('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x887b89;}})['then'](respondWithResult(_0x2c4de1,null))[_0xebef('0x56')](handleError(_0x2c4de1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 1419d2c..4f59e30 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 _0xaef7=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x17c536,_0xd100e4){var _0x2f7294=function(_0x58bb37){while(--_0x58bb37){_0x17c536['push'](_0x17c536['shift']());}};_0x2f7294(++_0xd100e4);}(_0xaef7,0x115));var _0x7aef=function(_0x834776,_0x3251c8){_0x834776=_0x834776-0x0;var _0x211bc2=_0xaef7[_0x834776];return _0x211bc2;};'use strict';var EventEmitter=require(_0x7aef('0x0'));var SmsMessage=require(_0x7aef('0x1'))['db'][_0x7aef('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7aef('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7aef('0x4'),'afterDestroy':_0x7aef('0x5')};function emitEvent(_0x589005){return function(_0x1eebda,_0x185799,_0x3e7aa4){SmsMessageEvents[_0x7aef('0x6')](_0x589005+':'+_0x1eebda['id'],_0x1eebda);SmsMessageEvents[_0x7aef('0x6')](_0x589005,_0x1eebda);_0x3e7aa4(null);};}for(var e in events){if(events[_0x7aef('0x7')](e)){var event=events[e];SmsMessage[_0x7aef('0x8')](e,emitEvent(event));}}module[_0x7aef('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xaa50=['exports','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x569899,_0xba5be8){var _0xf8f3f9=function(_0x5804c0){while(--_0x5804c0){_0x569899['push'](_0x569899['shift']());}};_0xf8f3f9(++_0xba5be8);}(_0xaa50,0x1f2));var _0x0aa5=function(_0x2c4f3f,_0x266947){_0x2c4f3f=_0x2c4f3f-0x0;var _0x3d0234=_0xaa50[_0x2c4f3f];return _0x3d0234;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x0aa5('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0aa5('0x1')](0x0);var events={'afterCreate':_0x0aa5('0x2'),'afterUpdate':_0x0aa5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x52b1bd){return function(_0xe79c86,_0x5a199f,_0x7ebda3){SmsMessageEvents[_0x0aa5('0x4')](_0x52b1bd+':'+_0xe79c86['id'],_0xe79c86);SmsMessageEvents['emit'](_0x52b1bd,_0xe79c86);_0x7ebda3(null);};}for(var e in events){if(events[_0x0aa5('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x0aa5('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 7705881..bc130f7 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 _0xd6c5=['https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','clickSend','plivo','authId','%s:%s','format','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','length','createHash','md5','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','body','models','direction','toLowerCase','out','isNil','findOne','SmsInteractionId','then','update','createdAt','catch','secret','SmsAccount','find','SmsAccountId','type','twilio','authToken','accountSid','phone','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString'];(function(_0x55754e,_0x286388){var _0x2e9948=function(_0x1eaeff){while(--_0x1eaeff){_0x55754e['push'](_0x55754e['shift']());}};_0x2e9948(++_0x286388);}(_0xd6c5,0x19e));var _0x5d6c=function(_0x4c86e1,_0x2169c6){_0x4c86e1=_0x4c86e1-0x0;var _0x2093c6=_0xd6c5[_0x4c86e1];return _0x2093c6;};'use strict';var _=require('lodash');var util=require(_0x5d6c('0x0'));var logger=require(_0x5d6c('0x1'))(_0x5d6c('0x2'));var moment=require(_0x5d6c('0x3'));var BPromise=require(_0x5d6c('0x4'));var rp=require(_0x5d6c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d6c('0x6'));var config=require(_0x5d6c('0x7'));var attributes=require('./smsMessage.attributes');module[_0x5d6c('0x8')]=function(_0x419c3f,_0x201e06){return _0x419c3f[_0x5d6c('0x9')](_0x5d6c('0xa'),attributes,{'tableName':_0x5d6c('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5d6c('0xc')]},{'name':'fti_sms_messages','fields':[_0x5d6c('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20d7fe,_0x5d5e7d,_0x340e5b){var _0x515b0e=_0x419c3f[_0x5d6c('0xe')];var _0x49a70f=_0x20d7fe['get']({'plain':!![]});if(_0x49a70f[_0x5d6c('0xf')][_0x5d6c('0x10')]()==='in'||_0x49a70f[_0x5d6c('0xf')][_0x5d6c('0x10')]()===_0x5d6c('0x11')&&!_0x49a70f['secret']&&!_[_0x5d6c('0x12')](_0x49a70f['UserId'])){_0x515b0e['SmsInteraction'][_0x5d6c('0x13')]({'where':{'id':_0x49a70f[_0x5d6c('0x14')]}})[_0x5d6c('0x15')](function(_0x2cbb7f){if(_0x2cbb7f){_0x2cbb7f[_0x5d6c('0x16')]({'lastMsgAt':_0x49a70f[_0x5d6c('0x17')],'lastMsgDirection':_0x49a70f[_0x5d6c('0xf')][_0x5d6c('0x10')]()});}})[_0x5d6c('0x18')](function(_0x5637a3){console['error'](_0x5637a3);});}if(_0x49a70f[_0x5d6c('0xf')]==='out'&&!_0x49a70f[_0x5d6c('0x19')]){var _0x32de4a;_0x515b0e[_0x5d6c('0x1a')][_0x5d6c('0x1b')]({'where':{'id':_0x49a70f[_0x5d6c('0x1c')]},'raw':!![]})[_0x5d6c('0x15')](function(_0xe86886){_0x32de4a=_0xe86886;if(_0x32de4a&&_0x32de4a['type']){switch(_0x32de4a[_0x5d6c('0x1d')]){case _0x5d6c('0x1e'):var _0x1d17a4=require('twilio');if(_0x32de4a['accountSid']&&_0x32de4a[_0x5d6c('0x1f')]&&_0x32de4a['phone']){var _0x14835c=new _0x1d17a4(_0x32de4a[_0x5d6c('0x20')],_0x32de4a[_0x5d6c('0x1f')]);_0x14835c['messages']['create']({'body':_0x49a70f[_0x5d6c('0xd')],'to':_0x49a70f[_0x5d6c('0x21')],'from':_0x32de4a[_0x5d6c('0x21')],'statusCallback':_0x32de4a[_0x5d6c('0x22')]+_0x5d6c('0x23')+_0x49a70f['id']+_0x5d6c('0x24')+_0x32de4a[_0x5d6c('0x25')]})['then'](function(_0x1ed234){if(_0x1ed234[_0x5d6c('0x26')]){return _0x20d7fe[_0x5d6c('0x16')]({'messageId':_0x1ed234[_0x5d6c('0x26')]});}})[_0x5d6c('0x18')](function(_0x51edaa){logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),'twilio',util[_0x5d6c('0x2a')](_0x51edaa,{'showHidden':![],'depth':null}));});}else{logger[_0x5d6c('0x27')](_0x5d6c('0x28'),'afterCreate',_0x5d6c('0x1e'),_0x5d6c('0x2b'));}break;case'skebby':var _0x329a18=_0x5d6c('0x2c');if(_0x32de4a[_0x5d6c('0x2d')]&&_0x32de4a[_0x5d6c('0x2e')]){var _0x4fe969={'recipient':[_0x49a70f[_0x5d6c('0x21')]],'message':_0x49a70f[_0x5d6c('0xd')],'message_type':_0x32de4a['smsMethod']};if(_0x32de4a[_0x5d6c('0x2f')]&&_0x32de4a['smsMethod']!=='SI'){_0x4fe969[_0x5d6c('0x30')]=_0x32de4a['phone'];}var _0x169825={'url':_0x329a18+_0x5d6c('0x31')+_0x32de4a[_0x5d6c('0x2d')]+_0x5d6c('0x32')+_0x32de4a[_0x5d6c('0x2e')],'method':_0x5d6c('0x33')};rp(_0x169825)[_0x5d6c('0x15')](function(_0x1269bd){var _0x1f97ba=_0x1269bd[_0x5d6c('0x34')](';');var _0x20eabf={'user_key':_0x1f97ba[0x0],'session_key':_0x1f97ba[0x1]};_0x169825={'url':_0x329a18+_0x5d6c('0x35'),'method':_0x5d6c('0x36'),'headers':{'user_key':_0x20eabf[_0x5d6c('0x37')],'Session_key':_0x20eabf[_0x5d6c('0x38')]},'json':!![],'body':_0x4fe969};return rp(_0x169825);})[_0x5d6c('0x15')](function(_0x783b20){if(_0x783b20[_0x5d6c('0x39')]>=0x1){var _0x403267={'messageId':_0x783b20[_0x5d6c('0x3a')]};if(_0x32de4a[_0x5d6c('0x2f')]!=='GP'||!_0x32de4a['deliveryReport']){_0x403267[_0x5d6c('0x3b')]=!![];}return _0x20d7fe['update'](_0x403267);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5d6c('0x29'),'skebby',util[_0x5d6c('0x2a')](_0x783b20,{'showHidden':![],'depth':null}));}})['catch'](function(_0x46ed90){return logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),'skebby',util[_0x5d6c('0x2a')](_0x46ed90,{'showHidden':![],'depth':null}));});}else{logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),_0x5d6c('0x3c'),_0x5d6c('0x3d'));}break;case _0x5d6c('0x3e'):if(_0x32de4a['authToken']){var _0x343c2a={'recipient':_0x49a70f['phone'],'message':_0x49a70f[_0x5d6c('0xd')],'sender':_0x32de4a['senderString']||_0x32de4a['phone'],'authorization':_0x32de4a[_0x5d6c('0x1f')]};var _0x5d5e7d={'method':_0x5d6c('0x36'),'uri':_0x5d6c('0x3f'),'body':_0x343c2a,'json':!![]};rp(_0x5d5e7d)['then'](function(_0x4713da){var _0x5f0446={'messageId':_0x4713da[_0x5d6c('0x40')]};if(!_0x32de4a[_0x5d6c('0x41')]){_0x5f0446[_0x5d6c('0x3b')]=!![];}return _0x20d7fe[_0x5d6c('0x16')](_0x5f0446);})[_0x5d6c('0x18')](function(_0x37c43e){logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),_0x5d6c('0x3e'),util[_0x5d6c('0x2a')](_0x37c43e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5d6c('0x28'),'afterCreate','connectel',_0x5d6c('0x42'));}break;case _0x5d6c('0x43'):if(_0x32de4a['username']&&_0x32de4a[_0x5d6c('0x2e')]){var _0x343c2a={'messages':[{'source':_0x5d6c('0x44'),'to':_0x49a70f['phone'],'body':_0x49a70f['body'],'from':_0x32de4a[_0x5d6c('0x45')]||_0x32de4a[_0x5d6c('0x21')]}]};var _0x41e717=util['format']('%s:%s',_0x32de4a[_0x5d6c('0x2d')],_0x32de4a[_0x5d6c('0x2e')]);var _0x5d5e7d={'method':_0x5d6c('0x36'),'uri':_0x5d6c('0x46'),'body':_0x343c2a,'headers':{'Authorization':util['format'](_0x5d6c('0x47'),new Buffer(_0x41e717)[_0x5d6c('0x48')](_0x5d6c('0x49')))},'json':!![]};rp(_0x5d5e7d)[_0x5d6c('0x15')](function(_0x18d7a5){if(_0x18d7a5[_0x5d6c('0x4a')]>=0xc8&&_0x18d7a5[_0x5d6c('0x4a')]<=0xce){if(_0x18d7a5[_0x5d6c('0x4b')]&&_0x18d7a5[_0x5d6c('0x4b')]['queued_count']>0x0){var _0x2ef3f1=_[_0x5d6c('0x4c')](_0x18d7a5[_0x5d6c('0x4b')]['messages']);var _0x311756={'messageId':_0x2ef3f1['message_id']};if(!_0x32de4a[_0x5d6c('0x41')]){_0x311756[_0x5d6c('0x3b')]=!![];}return _0x20d7fe[_0x5d6c('0x16')](_0x311756);}else{logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),_0x5d6c('0x4d'),util[_0x5d6c('0x2a')](_0x18d7a5,{'showHidden':![],'depth':null}));}}else{logger[_0x5d6c('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5d6c('0x29'),_0x5d6c('0x4d'),util['inspect'](_0x18d7a5,{'showHidden':![],'depth':null}));}})[_0x5d6c('0x18')](function(_0x298629){logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),'clickSend',util[_0x5d6c('0x2a')](_0x298629,{'showHidden':![],'depth':null}));});}else{logger[_0x5d6c('0x27')](_0x5d6c('0x28'),'afterCreate','clickSend',_0x5d6c('0x3d'));}break;case _0x5d6c('0x4e'):if(_0x32de4a[_0x5d6c('0x4f')]&&_0x32de4a['authToken']){var _0x343c2a={'dst':_0x49a70f[_0x5d6c('0x21')],'text':_0x49a70f[_0x5d6c('0xd')],'src':_0x32de4a['senderString']||_0x32de4a['phone'],'url':_0x32de4a[_0x5d6c('0x22')]+_0x5d6c('0x23')+_0x49a70f['id']+_0x5d6c('0x24')+_0x32de4a['token']};var _0x41e717=util['format'](_0x5d6c('0x50'),_0x32de4a[_0x5d6c('0x4f')],_0x32de4a[_0x5d6c('0x1f')]);var _0x5d5e7d={'method':_0x5d6c('0x36'),'uri':util[_0x5d6c('0x51')](_0x5d6c('0x52'),_0x32de4a[_0x5d6c('0x4f')]),'body':_0x343c2a,'headers':{'Authorization':util[_0x5d6c('0x51')](_0x5d6c('0x47'),new Buffer(_0x41e717)[_0x5d6c('0x48')]('base64'))},'json':!![]};rp(_0x5d5e7d)[_0x5d6c('0x15')](function(_0x57003c){var _0x4123ba={'messageId':_0x57003c[_0x5d6c('0x53')][0x0]};return _0x20d7fe['update'](_0x4123ba);})[_0x5d6c('0x18')](function(_0x3dc17b){logger['error'](_0x5d6c('0x28'),'afterCreate',_0x5d6c('0x4e'),util['inspect'](_0x3dc17b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5d6c('0x28'),_0x5d6c('0x29'),_0x5d6c('0x4e'),_0x5d6c('0x54'));}break;case _0x5d6c('0x55'):if(_0x32de4a['username']&&_0x32de4a[_0x5d6c('0x2e')]){if(_0x32de4a[_0x5d6c('0x56')]){var _0x92cd5b={'method':_0x5d6c('0x36'),'uri':_0x32de4a[_0x5d6c('0x56')]+_0x5d6c('0x57'),'body':{'username':_0x32de4a[_0x5d6c('0x2d')],'password':_0x32de4a[_0x5d6c('0x2e')]},'json':!![]};return rp(_0x92cd5b)[_0x5d6c('0x15')](function(_0x21f4f5){var _0x2b3149={'method':_0x5d6c('0x36'),'uri':_0x32de4a[_0x5d6c('0x56')]+_0x5d6c('0x58'),'body':{'messages':[{'from':_0x32de4a[_0x5d6c('0x21')],'destinations':[{'to':_0x49a70f[_0x5d6c('0x21')]}],'text':_0x49a70f[_0x5d6c('0xd')],'notifyUrl':_0x32de4a[_0x5d6c('0x22')]+_0x5d6c('0x23')+_0x49a70f['id']+'/status?token='+_0x32de4a[_0x5d6c('0x25')],'notifyContentType':_0x5d6c('0x59'),'callbackData':_0x32de4a[_0x5d6c('0x21')]+';'+_0x49a70f[_0x5d6c('0xd')]}]},'headers':{'Authorization':_0x5d6c('0x5a')+_0x21f4f5['token']},'json':!![]};return rp(_0x2b3149)[_0x5d6c('0x15')](function(_0x419f13){if(_0x419f13['messages']){var _0x31804e={'messageId':_0x419f13[_0x5d6c('0x5b')][0x0][_0x5d6c('0xc')]};if(!_0x32de4a[_0x5d6c('0x41')]){_0x31804e[_0x5d6c('0x3b')]=!![];}return _0x20d7fe[_0x5d6c('0x16')](_0x31804e);}else{return logger[_0x5d6c('0x27')](_0x5d6c('0x28'),'afterCreate',_0x5d6c('0x55'),util[_0x5d6c('0x2a')](_0x419f13,{'showHidden':![],'depth':null}));}});})[_0x5d6c('0x18')](function(_0x460b06){return logger['error'](_0x5d6c('0x28'),_0x5d6c('0x29'),'infobip',util['inspect'](_0x460b06,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5d6c('0x29'),'infobip',_0x5d6c('0x5c'));}}else{logger[_0x5d6c('0x27')](_0x5d6c('0x28'),'afterCreate',_0x5d6c('0x55'),_0x5d6c('0x3d'));}break;case _0x5d6c('0x5d'):var _0x4140c2=require(_0x5d6c('0x5e'));if(_0x32de4a[_0x5d6c('0x5f')]){var _0x33db47={};_0x33db47[_0x5d6c('0x60')]=_0x32de4a[_0x5d6c('0x2d')];_0x33db47['phone']=_0x49a70f[_0x5d6c('0x21')];_0x33db47[_0x5d6c('0x30')]=_0x32de4a[_0x5d6c('0x21')];_0x33db47[_0x5d6c('0x61')]=_0x49a70f['body'];_0x33db47['timestamp']=+new Date();var _0x4d4508='';var _0xd22920='';var _0x2eadc4=Object['keys'](_0x33db47);_0x2eadc4['sort']();for(var _0x59a9b4=0x0;_0x59a9b4<_0x2eadc4[_0x5d6c('0x62')];_0x59a9b4++){if(_0x4d4508!=''){_0x4d4508+='&';}_0x4d4508+=_0x2eadc4[_0x59a9b4]+'='+encodeURIComponent(_0x33db47[_0x2eadc4[_0x59a9b4]]);_0xd22920+=_0x33db47[_0x2eadc4[_0x59a9b4]];}_0xd22920+=_0x32de4a[_0x5d6c('0x5f')];_0xd22920=_0x4140c2[_0x5d6c('0x63')](_0x5d6c('0x64'))[_0x5d6c('0x16')](_0xd22920)[_0x5d6c('0x65')](_0x5d6c('0x66'));if(_0x4d4508!==''){_0x4d4508+='&';}_0x4d4508+=_0x5d6c('0x67')+_0xd22920;var _0x169825={'method':_0x5d6c('0x33'),'uri':_0x32de4a[_0x5d6c('0x56')]+'/external/get/send.php?'+_0x4d4508,'json':!![]};return rp(_0x169825)[_0x5d6c('0x15')](function(_0x555023){var _0x33ea29=Object[_0x5d6c('0x68')](_0x555023);if(_0x555023[_0x33ea29[0x0]][_0x5d6c('0x27')]&&parseInt(_0x555023[_0x33ea29[0x0]][_0x5d6c('0x27')])===0x0){var _0x57264d={'messageId':_0x555023[_0x33ea29[0x0]][_0x5d6c('0x69')]};if(!_0x32de4a['deliveryReport']){_0x57264d[_0x5d6c('0x3b')]=!![];}return _0x20d7fe[_0x5d6c('0x16')](_0x57264d);}else{return logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),_0x5d6c('0x5d'),util[_0x5d6c('0x2a')](_0x555023['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5a893c){return logger[_0x5d6c('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util['inspect'](_0x5a893c,{'showHidden':![],'depth':null}));});}else{logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),_0x5d6c('0x5d'),_0x5d6c('0x6a'));}break;case _0x5d6c('0x6b'):if(_0x32de4a[_0x5d6c('0x5f')]){var _0x53506f={'method':_0x5d6c('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x32de4a[_0x5d6c('0x5f')]},'body':{'content':_0x49a70f[_0x5d6c('0xd')],'to':[_0x49a70f[_0x5d6c('0x21')]],'from':_0x32de4a['phone'],'binary':![],'clientMessageId':_0x5d6c('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0x53506f)['then'](function(_0x5cd434){if(!_0x5cd434[_0x5d6c('0x27')]){var _0x5d4ed3={'messageId':_0x5cd434['messages'][0x0][_0x5d6c('0x6d')]};if(!_0x32de4a[_0x5d6c('0x41')]){_0x5d4ed3[_0x5d6c('0x3b')]=!![];}return _0x20d7fe[_0x5d6c('0x16')](_0x5d4ed3);}else{return logger[_0x5d6c('0x27')](_0x5d6c('0x28'),'afterCreate',_0x5d6c('0x6b'),util['inspect'](_0x5cd434['error'],{'showHidden':![],'depth':null}));}})[_0x5d6c('0x18')](function(_0x2c797f){return logger[_0x5d6c('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5d6c('0x6b'),util[_0x5d6c('0x2a')](_0x2c797f,{'showHidden':![],'depth':null}));});}else{logger[_0x5d6c('0x27')](_0x5d6c('0x28'),_0x5d6c('0x29'),'clickatell',_0x5d6c('0x6a'));}break;case'intelepeer':if(_0x32de4a[_0x5d6c('0x5f')]){var _0x430252={};var _0x169825={'method':_0x5d6c('0x36'),'uri':_0x5d6c('0x6e'),'headers':{'Authorization':_0x5d6c('0x6f')+_0x32de4a['apiKey'],'Content-Type':_0x5d6c('0x59')},'body':{'from':_0x32de4a[_0x5d6c('0x21')],'to':_0x49a70f[_0x5d6c('0x21')],'text':_0x49a70f[_0x5d6c('0xd')]},'json':!![]};return rp(_0x169825)['then'](function(_0xd90af7){if(_0xd90af7[_0x5d6c('0x70')]==0xca){_0x430252[_0x5d6c('0x71')]=_0xd90af7;var _0xfaad11={'method':_0x5d6c('0x36'),'uri':_0x5d6c('0x72'),'headers':{'Authorization':_0x5d6c('0x6f')+_0x32de4a[_0x5d6c('0x5f')],'Content-Type':'application/json'},'body':{'refid':_0x430252['message'][_0x5d6c('0x73')]},'json':!![]};return rp(_0xfaad11)['then'](function(_0x1d7e27){_0x430252[_0x5d6c('0x74')]=_0x1d7e27;var _0x5a7abf={'messageId':_0x430252[_0x5d6c('0x71')][_0x5d6c('0x73')],'read':!![]};return _0x20d7fe[_0x5d6c('0x16')](_0x5a7abf);});}else{return logger['error'](_0x5d6c('0x28'),_0x5d6c('0x29'),_0x5d6c('0x75'),util['inspect'](_0xd90af7,{'showHidden':![],'depth':null}));}})[_0x5d6c('0x18')](function(_0x300f55){return logger['error'](_0x5d6c('0x28'),_0x5d6c('0x29'),_0x5d6c('0x75'),util[_0x5d6c('0x2a')](_0x300f55,{'showHidden':![],'depth':null}));});}else{return logger[_0x5d6c('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5d6c('0x75'),_0x5d6c('0x76'));}break;}}})[_0x5d6c('0x77')](function(){_0x340e5b();});}else{_0x340e5b();}}},'charset':'utf8mb4','collate':_0x5d6c('0x78')});}; \ No newline at end of file +var _0xcf7b=['FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','SmsAccountId','type','twilio','authToken','phone','accountSid','create','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','split','POST','user_key','total_sent','internal_order_id','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','remote','token','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','application/json','messages','read','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','length','createHash','md5','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf7b,0x14a));var _0xbcf7=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xcf7b[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xbcf7('0x0'));var util=require(_0xbcf7('0x1'));var logger=require(_0xbcf7('0x2'))(_0xbcf7('0x3'));var moment=require(_0xbcf7('0x4'));var BPromise=require(_0xbcf7('0x5'));var rp=require(_0xbcf7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbcf7('0x7'));var config=require(_0xbcf7('0x8'));var attributes=require(_0xbcf7('0x9'));module[_0xbcf7('0xa')]=function(_0x44be6d,_0x53e441){return _0x44be6d['define'](_0xbcf7('0xb'),attributes,{'tableName':_0xbcf7('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xbcf7('0xd')]},{'name':'fti_sms_messages','fields':[_0xbcf7('0xe')],'type':_0xbcf7('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ad64a,_0x438b81,_0x337432){var _0x32f028=_0x44be6d['models'];var _0xe0a8f5=_0x1ad64a[_0xbcf7('0x10')]({'plain':!![]});if(_0xe0a8f5[_0xbcf7('0x11')][_0xbcf7('0x12')]()==='in'||_0xe0a8f5[_0xbcf7('0x11')]['toLowerCase']()===_0xbcf7('0x13')&&!_0xe0a8f5[_0xbcf7('0x14')]&&!_[_0xbcf7('0x15')](_0xe0a8f5[_0xbcf7('0x16')])){_0x32f028[_0xbcf7('0x17')][_0xbcf7('0x18')]({'where':{'id':_0xe0a8f5[_0xbcf7('0x19')]}})[_0xbcf7('0x1a')](function(_0x50a6b8){if(_0x50a6b8){_0x50a6b8[_0xbcf7('0x1b')]({'lastMsgAt':_0xe0a8f5[_0xbcf7('0x1c')],'lastMsgDirection':_0xe0a8f5['direction'][_0xbcf7('0x12')]()});}})[_0xbcf7('0x1d')](function(_0xb8178e){console[_0xbcf7('0x1e')](_0xb8178e);});}if(_0xe0a8f5[_0xbcf7('0x11')]==='out'&&!_0xe0a8f5[_0xbcf7('0x14')]){var _0x5edf6f;_0x32f028[_0xbcf7('0x1f')]['find']({'where':{'id':_0xe0a8f5[_0xbcf7('0x20')]},'raw':!![]})['then'](function(_0x8a975b){_0x5edf6f=_0x8a975b;if(_0x5edf6f&&_0x5edf6f[_0xbcf7('0x21')]){switch(_0x5edf6f[_0xbcf7('0x21')]){case _0xbcf7('0x22'):var _0x30d766=require(_0xbcf7('0x22'));if(_0x5edf6f['accountSid']&&_0x5edf6f[_0xbcf7('0x23')]&&_0x5edf6f[_0xbcf7('0x24')]){var _0x1116be=new _0x30d766(_0x5edf6f[_0xbcf7('0x25')],_0x5edf6f['authToken']);_0x1116be['messages'][_0xbcf7('0x26')]({'body':_0xe0a8f5[_0xbcf7('0xe')],'to':_0xe0a8f5[_0xbcf7('0x24')],'from':_0x5edf6f[_0xbcf7('0x24')],'statusCallback':_0x5edf6f['remote']+_0xbcf7('0x27')+_0xe0a8f5['id']+_0xbcf7('0x28')+_0x5edf6f['token']})[_0xbcf7('0x1a')](function(_0x48cc44){if(_0x48cc44[_0xbcf7('0x29')]){return _0x1ad64a[_0xbcf7('0x1b')]({'messageId':_0x48cc44[_0xbcf7('0x29')]});}})[_0xbcf7('0x1d')](function(_0x26807b){logger['error'](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x22'),util[_0xbcf7('0x2c')](_0x26807b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbcf7('0x2a'),'afterCreate',_0xbcf7('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xbcf7('0x2d'):var _0x3382f8='https://api.skebby.it/API/v1.0/REST/';if(_0x5edf6f[_0xbcf7('0x2e')]&&_0x5edf6f[_0xbcf7('0x2f')]){var _0x6e3c5c={'recipient':[_0xe0a8f5[_0xbcf7('0x24')]],'message':_0xe0a8f5[_0xbcf7('0xe')],'message_type':_0x5edf6f[_0xbcf7('0x30')]};if(_0x5edf6f['smsMethod']&&_0x5edf6f[_0xbcf7('0x30')]!=='SI'){_0x6e3c5c[_0xbcf7('0x31')]=_0x5edf6f['phone'];}var _0x3efa36={'url':_0x3382f8+_0xbcf7('0x32')+_0x5edf6f[_0xbcf7('0x2e')]+_0xbcf7('0x33')+_0x5edf6f['password'],'method':_0xbcf7('0x34')};rp(_0x3efa36)[_0xbcf7('0x1a')](function(_0x4f1ccb){var _0x546d04=_0x4f1ccb[_0xbcf7('0x35')](';');var _0xaa802f={'user_key':_0x546d04[0x0],'session_key':_0x546d04[0x1]};_0x3efa36={'url':_0x3382f8+'sms','method':_0xbcf7('0x36'),'headers':{'user_key':_0xaa802f[_0xbcf7('0x37')],'Session_key':_0xaa802f['session_key']},'json':!![],'body':_0x6e3c5c};return rp(_0x3efa36);})['then'](function(_0x3834fb){if(_0x3834fb[_0xbcf7('0x38')]>=0x1){var _0xd24a87={'messageId':_0x3834fb[_0xbcf7('0x39')]};if(_0x5edf6f[_0xbcf7('0x30')]!=='GP'||!_0x5edf6f['deliveryReport']){_0xd24a87['read']=!![];}return _0x1ad64a[_0xbcf7('0x1b')](_0xd24a87);}else{return logger[_0xbcf7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbcf7('0x2b'),_0xbcf7('0x2d'),util[_0xbcf7('0x2c')](_0x3834fb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x52d2c2){return logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x2d'),util['inspect'](_0x52d2c2,{'showHidden':![],'depth':null}));});}else{logger[_0xbcf7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbcf7('0x2b'),'skebby',_0xbcf7('0x3a'));}break;case _0xbcf7('0x3b'):if(_0x5edf6f[_0xbcf7('0x23')]){var _0xb4e032={'recipient':_0xe0a8f5[_0xbcf7('0x24')],'message':_0xe0a8f5['body'],'sender':_0x5edf6f[_0xbcf7('0x3c')]||_0x5edf6f[_0xbcf7('0x24')],'authorization':_0x5edf6f[_0xbcf7('0x23')]};var _0x438b81={'method':_0xbcf7('0x36'),'uri':_0xbcf7('0x3d'),'body':_0xb4e032,'json':!![]};rp(_0x438b81)[_0xbcf7('0x1a')](function(_0x3b88c1){var _0x3ff1d0={'messageId':_0x3b88c1[_0xbcf7('0x3e')]};if(!_0x5edf6f[_0xbcf7('0x3f')]){_0x3ff1d0['read']=!![];}return _0x1ad64a[_0xbcf7('0x1b')](_0x3ff1d0);})[_0xbcf7('0x1d')](function(_0x560378){logger['error'](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x3b'),util[_0xbcf7('0x2c')](_0x560378,{'showHidden':![],'depth':null}));});}else{logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),'afterCreate','connectel',_0xbcf7('0x40'));}break;case'clicksend':if(_0x5edf6f[_0xbcf7('0x2e')]&&_0x5edf6f[_0xbcf7('0x2f')]){var _0xb4e032={'messages':[{'source':_0xbcf7('0x41'),'to':_0xe0a8f5['phone'],'body':_0xe0a8f5[_0xbcf7('0xe')],'from':_0x5edf6f['senderString']||_0x5edf6f['phone']}]};var _0x508ebf=util[_0xbcf7('0x42')](_0xbcf7('0x43'),_0x5edf6f['username'],_0x5edf6f['password']);var _0x438b81={'method':'POST','uri':_0xbcf7('0x44'),'body':_0xb4e032,'headers':{'Authorization':util[_0xbcf7('0x42')](_0xbcf7('0x45'),new Buffer(_0x508ebf)[_0xbcf7('0x46')]('base64'))},'json':!![]};rp(_0x438b81)[_0xbcf7('0x1a')](function(_0xda8afd){if(_0xda8afd[_0xbcf7('0x47')]>=0xc8&&_0xda8afd['http_code']<=0xce){if(_0xda8afd[_0xbcf7('0x48')]&&_0xda8afd[_0xbcf7('0x48')][_0xbcf7('0x49')]>0x0){var _0x10afb7=_[_0xbcf7('0x4a')](_0xda8afd[_0xbcf7('0x48')]['messages']);var _0x2770bc={'messageId':_0x10afb7[_0xbcf7('0x4b')]};if(!_0x5edf6f[_0xbcf7('0x3f')]){_0x2770bc['read']=!![];}return _0x1ad64a[_0xbcf7('0x1b')](_0x2770bc);}else{logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x4c'),util[_0xbcf7('0x2c')](_0xda8afd,{'showHidden':![],'depth':null}));}}else{logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),'afterCreate',_0xbcf7('0x4c'),util[_0xbcf7('0x2c')](_0xda8afd,{'showHidden':![],'depth':null}));}})[_0xbcf7('0x1d')](function(_0x9223db){logger['error'](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x4c'),util['inspect'](_0x9223db,{'showHidden':![],'depth':null}));});}else{logger[_0xbcf7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbcf7('0x2b'),_0xbcf7('0x4c'),_0xbcf7('0x3a'));}break;case _0xbcf7('0x4d'):if(_0x5edf6f[_0xbcf7('0x4e')]&&_0x5edf6f[_0xbcf7('0x23')]){var _0xb4e032={'dst':_0xe0a8f5[_0xbcf7('0x24')],'text':_0xe0a8f5['body'],'src':_0x5edf6f['senderString']||_0x5edf6f['phone'],'url':_0x5edf6f[_0xbcf7('0x4f')]+_0xbcf7('0x27')+_0xe0a8f5['id']+_0xbcf7('0x28')+_0x5edf6f[_0xbcf7('0x50')]};var _0x508ebf=util[_0xbcf7('0x42')]('%s:%s',_0x5edf6f[_0xbcf7('0x4e')],_0x5edf6f[_0xbcf7('0x23')]);var _0x438b81={'method':_0xbcf7('0x36'),'uri':util['format'](_0xbcf7('0x51'),_0x5edf6f[_0xbcf7('0x4e')]),'body':_0xb4e032,'headers':{'Authorization':util[_0xbcf7('0x42')]('Basic\x20%s',new Buffer(_0x508ebf)['toString'](_0xbcf7('0x52')))},'json':!![]};rp(_0x438b81)['then'](function(_0x34f983){var _0x3819ff={'messageId':_0x34f983[_0xbcf7('0x53')][0x0]};return _0x1ad64a[_0xbcf7('0x1b')](_0x3819ff);})['catch'](function(_0x17094f){logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x4d'),util[_0xbcf7('0x2c')](_0x17094f,{'showHidden':![],'depth':null}));});}else{logger[_0xbcf7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbcf7('0x2b'),_0xbcf7('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xbcf7('0x54'):if(_0x5edf6f[_0xbcf7('0x2e')]&&_0x5edf6f[_0xbcf7('0x2f')]){if(_0x5edf6f['baseUrl']){var _0x2b40e9={'method':_0xbcf7('0x36'),'uri':_0x5edf6f[_0xbcf7('0x55')]+_0xbcf7('0x56'),'body':{'username':_0x5edf6f[_0xbcf7('0x2e')],'password':_0x5edf6f[_0xbcf7('0x2f')]},'json':!![]};return rp(_0x2b40e9)[_0xbcf7('0x1a')](function(_0x41bcdf){var _0x2f5025={'method':_0xbcf7('0x36'),'uri':_0x5edf6f[_0xbcf7('0x55')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5edf6f['phone'],'destinations':[{'to':_0xe0a8f5[_0xbcf7('0x24')]}],'text':_0xe0a8f5[_0xbcf7('0xe')],'notifyUrl':_0x5edf6f[_0xbcf7('0x4f')]+_0xbcf7('0x27')+_0xe0a8f5['id']+'/status?token='+_0x5edf6f[_0xbcf7('0x50')],'notifyContentType':_0xbcf7('0x57'),'callbackData':_0x5edf6f[_0xbcf7('0x24')]+';'+_0xe0a8f5['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x41bcdf['token']},'json':!![]};return rp(_0x2f5025)[_0xbcf7('0x1a')](function(_0x16b034){if(_0x16b034[_0xbcf7('0x58')]){var _0x13db7b={'messageId':_0x16b034[_0xbcf7('0x58')][0x0][_0xbcf7('0xd')]};if(!_0x5edf6f[_0xbcf7('0x3f')]){_0x13db7b[_0xbcf7('0x59')]=!![];}return _0x1ad64a[_0xbcf7('0x1b')](_0x13db7b);}else{return logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x54'),util[_0xbcf7('0x2c')](_0x16b034,{'showHidden':![],'depth':null}));}});})[_0xbcf7('0x1d')](function(_0x41b9cb){return logger['error'](_0xbcf7('0x2a'),'afterCreate',_0xbcf7('0x54'),util[_0xbcf7('0x2c')](_0x41b9cb,{'showHidden':![],'depth':null}));});}else{logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),_0xbcf7('0x2b'),'infobip',_0xbcf7('0x5a'));}}else{logger['error'](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x54'),_0xbcf7('0x3a'));}break;case _0xbcf7('0x5b'):var _0x3d971a=require(_0xbcf7('0x5c'));if(_0x5edf6f[_0xbcf7('0x5d')]){var _0x162905={};_0x162905['login']=_0x5edf6f[_0xbcf7('0x2e')];_0x162905[_0xbcf7('0x24')]=_0xe0a8f5[_0xbcf7('0x24')];_0x162905[_0xbcf7('0x31')]=_0x5edf6f['phone'];_0x162905[_0xbcf7('0x5e')]=_0xe0a8f5[_0xbcf7('0xe')];_0x162905['timestamp']=+new Date();var _0x5db7ce='';var _0x2fb143='';var _0x5d07ec=Object[_0xbcf7('0x5f')](_0x162905);_0x5d07ec['sort']();for(var _0x4fb594=0x0;_0x4fb594<_0x5d07ec[_0xbcf7('0x60')];_0x4fb594++){if(_0x5db7ce!=''){_0x5db7ce+='&';}_0x5db7ce+=_0x5d07ec[_0x4fb594]+'='+encodeURIComponent(_0x162905[_0x5d07ec[_0x4fb594]]);_0x2fb143+=_0x162905[_0x5d07ec[_0x4fb594]];}_0x2fb143+=_0x5edf6f[_0xbcf7('0x5d')];_0x2fb143=_0x3d971a[_0xbcf7('0x61')](_0xbcf7('0x62'))[_0xbcf7('0x1b')](_0x2fb143)['digest']('hex');if(_0x5db7ce!==''){_0x5db7ce+='&';}_0x5db7ce+=_0xbcf7('0x63')+_0x2fb143;var _0x3efa36={'method':'GET','uri':_0x5edf6f[_0xbcf7('0x55')]+_0xbcf7('0x64')+_0x5db7ce,'json':!![]};return rp(_0x3efa36)[_0xbcf7('0x1a')](function(_0x2de4c6){var _0x276ddc=Object[_0xbcf7('0x5f')](_0x2de4c6);if(_0x2de4c6[_0x276ddc[0x0]][_0xbcf7('0x1e')]&&parseInt(_0x2de4c6[_0x276ddc[0x0]][_0xbcf7('0x1e')])===0x0){var _0x5f13fc={'messageId':_0x2de4c6[_0x276ddc[0x0]][_0xbcf7('0x65')]};if(!_0x5edf6f[_0xbcf7('0x3f')]){_0x5f13fc[_0xbcf7('0x59')]=!![];}return _0x1ad64a['update'](_0x5f13fc);}else{return logger[_0xbcf7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbcf7('0x5b'),util[_0xbcf7('0x2c')](_0x2de4c6[_0xbcf7('0x1e')],{'showHidden':![],'depth':null}));}})[_0xbcf7('0x1d')](function(_0x48dd5d){return logger[_0xbcf7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbcf7('0x2b'),_0xbcf7('0x5b'),util['inspect'](_0x48dd5d,{'showHidden':![],'depth':null}));});}else{logger[_0xbcf7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbcf7('0x2b'),_0xbcf7('0x5b'),_0xbcf7('0x66'));}break;case _0xbcf7('0x67'):if(_0x5edf6f['apiKey']){var _0x2c11ab={'method':_0xbcf7('0x36'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x5edf6f[_0xbcf7('0x5d')]},'body':{'content':_0xe0a8f5[_0xbcf7('0xe')],'to':[_0xe0a8f5['phone']],'from':_0x5edf6f['phone'],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x2c11ab)[_0xbcf7('0x1a')](function(_0xd1b6d2){if(!_0xd1b6d2[_0xbcf7('0x1e')]){var _0x36e42d={'messageId':_0xd1b6d2['messages'][0x0][_0xbcf7('0x68')]};if(!_0x5edf6f[_0xbcf7('0x3f')]){_0x36e42d['read']=!![];}return _0x1ad64a[_0xbcf7('0x1b')](_0x36e42d);}else{return logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),'afterCreate',_0xbcf7('0x67'),util[_0xbcf7('0x2c')](_0xd1b6d2[_0xbcf7('0x1e')],{'showHidden':![],'depth':null}));}})[_0xbcf7('0x1d')](function(_0x482850){return logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x67'),util[_0xbcf7('0x2c')](_0x482850,{'showHidden':![],'depth':null}));});}else{logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x67'),_0xbcf7('0x66'));}break;case _0xbcf7('0x69'):if(_0x5edf6f['apiKey']){var _0x160934={};var _0x3efa36={'method':'POST','uri':_0xbcf7('0x6a'),'headers':{'Authorization':_0xbcf7('0x6b')+_0x5edf6f['apiKey'],'Content-Type':_0xbcf7('0x57')},'body':{'from':_0x5edf6f['phone'],'to':_0xe0a8f5[_0xbcf7('0x24')],'text':_0xe0a8f5['body']},'json':!![]};return rp(_0x3efa36)[_0xbcf7('0x1a')](function(_0x86640b){if(_0x86640b[_0xbcf7('0x6c')]==0xca){_0x160934[_0xbcf7('0x6d')]=_0x86640b;var _0x3478f2={'method':_0xbcf7('0x36'),'uri':_0xbcf7('0x6e'),'headers':{'Authorization':_0xbcf7('0x6b')+_0x5edf6f[_0xbcf7('0x5d')],'Content-Type':_0xbcf7('0x57')},'body':{'refid':_0x160934[_0xbcf7('0x6d')][_0xbcf7('0x6f')]},'json':!![]};return rp(_0x3478f2)[_0xbcf7('0x1a')](function(_0x67a78b){_0x160934[_0xbcf7('0x70')]=_0x67a78b;var _0x5b2c6d={'messageId':_0x160934['message'][_0xbcf7('0x6f')],'read':!![]};return _0x1ad64a[_0xbcf7('0x1b')](_0x5b2c6d);});}else{return logger[_0xbcf7('0x1e')](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x69'),util['inspect'](_0x86640b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x241c63){return logger['error'](_0xbcf7('0x2a'),_0xbcf7('0x2b'),_0xbcf7('0x69'),util[_0xbcf7('0x2c')](_0x241c63,{'showHidden':![],'depth':null}));});}else{return logger[_0xbcf7('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbcf7('0x2b'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xbcf7('0x71')](function(){_0x337432();});}else{_0x337432();}}},'charset':_0xbcf7('0x72'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index cfc080a..6490d2a 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 _0x0b0e=['message','result','SmsMessage','create','body','options','CreateSmsMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s'];(function(_0x5f08cc,_0x6c80ef){var _0x5af7c3=function(_0x5435d0){while(--_0x5435d0){_0x5f08cc['push'](_0x5f08cc['shift']());}};_0x5af7c3(++_0x6c80ef);}(_0x0b0e,0x187));var _0xe0b0=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x0b0e[_0x21af3a];return _0x268a49;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateSmsMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateSmsMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x2032=['register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateSmsMessage','create','options','then','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x2032,0xd9));var _0x2203=function(_0x354684,_0x4bc46a){_0x354684=_0x354684-0x0;var _0x90084e=_0x2032[_0x354684];return _0x90084e;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});config[_0x2203('0xb')]=_[_0x2203('0xc')](config[_0x2203('0xb')],{'host':_0x2203('0xd'),'port':0x18eb});var socket=require(_0x2203('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x2203('0xf')](socket);function respondWithRpcPromise(_0x549908,_0x27081c,_0x2972f3){return new BPromise(function(_0x6339c4,_0x5b19df){return client[_0x2203('0x10')](_0x549908,_0x2972f3)['then'](function(_0x3f690a){logger['info'](_0x2203('0x11'),_0x27081c,_0x2203('0x12'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27081c,'request\x20sent',JSON['stringify'](_0x3f690a));if(_0x3f690a['error']){if(_0x3f690a[_0x2203('0x13')]['code']===0x1f4){logger['error'](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x5b19df(_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);}logger[_0x2203('0x13')](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x6339c4(_0x3f690a[_0x2203('0x13')]['message']);}else{logger[_0x2203('0x15')](_0x2203('0x11'),_0x27081c,'request\x20sent');_0x6339c4(_0x3f690a[_0x2203('0x16')][_0x2203('0x14')]);}})['catch'](function(_0x30c6f7){logger['error'](_0x2203('0x11'),_0x27081c,_0x30c6f7);_0x5b19df(_0x30c6f7);});});}exports[_0x2203('0x17')]=function(_0x3c8c34){var _0x3b4034=this;return new Promise(function(_0x15cb1a,_0x449039){return db['SmsMessage'][_0x2203('0x18')](_0x3c8c34['body'],{'raw':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2203('0x1a')](function(_0x5bfe61){logger['info'](_0x2203('0x17'),_0x3c8c34);logger['debug']('CreateSmsMessage',_0x3c8c34,JSON[_0x2203('0x1b')](_0x5bfe61));_0x15cb1a(_0x5bfe61);})[_0x2203('0x1c')](function(_0x21f930){logger[_0x2203('0x13')](_0x2203('0x17'),_0x21f930[_0x2203('0x14')],_0x3c8c34);_0x449039(_0x3b4034[_0x2203('0x13')](0x1f4,_0x21f930[_0x2203('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 3060882..f76f668 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 _0x423f=['register','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x4424d7,_0x518a2c){var _0x513d98=function(_0x28ccd8){while(--_0x28ccd8){_0x4424d7['push'](_0x4424d7['shift']());}};_0x513d98(++_0x518a2c);}(_0x423f,0x1ca));var _0xf423=function(_0x340ca8,_0x381cb4){_0x340ca8=_0x340ca8-0x0;var _0x5db7ef=_0x423f[_0x340ca8];return _0x5db7ef;};'use strict';var SmsMessageEvents=require(_0xf423('0x0'));var events=[_0xf423('0x1'),_0xf423('0x2'),_0xf423('0x3')];function createListener(_0x2a104a,_0x50b110){return function(_0x4d3533){_0x50b110['emit'](_0x2a104a,_0x4d3533);};}function removeListener(_0x33cd12,_0x9767b5){return function(){SmsMessageEvents['removeListener'](_0x33cd12,_0x9767b5);};}exports[_0xf423('0x4')]=function(_0x279c5d){for(var _0x143c9b=0x0,_0x4c2daa=events[_0xf423('0x5')];_0x143c9b<_0x4c2daa;_0x143c9b++){var _0x58c5eb=events[_0x143c9b];var _0x1f3a46=createListener(_0xf423('0x6')+_0x58c5eb,_0x279c5d);SmsMessageEvents['on'](_0x58c5eb,_0x1f3a46);}}; \ No newline at end of file +var _0x5b80=['length','smsMessage:','remove','update','removeListener','register'];(function(_0xe9c28,_0x3a6ef6){var _0x10d7ac=function(_0x4b91ca){while(--_0x4b91ca){_0xe9c28['push'](_0xe9c28['shift']());}};_0x10d7ac(++_0x3a6ef6);}(_0x5b80,0x188));var _0x05b8=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x5b80[_0x24237f];return _0x48298e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x05b8('0x0'),_0x05b8('0x1')];function createListener(_0x211d02,_0xf1b7ea){return function(_0x4d966f){_0xf1b7ea['emit'](_0x211d02,_0x4d966f);};}function removeListener(_0x4b7ea7,_0x2f807c){return function(){SmsMessageEvents[_0x05b8('0x2')](_0x4b7ea7,_0x2f807c);};}exports[_0x05b8('0x3')]=function(_0x5315eb){for(var _0x49d454=0x0,_0x1d8898=events[_0x05b8('0x4')];_0x49d454<_0x1d8898;_0x49d454++){var _0x1dfe6b=events[_0x49d454];var _0x408209=createListener(_0x05b8('0x5')+_0x1dfe6b,_0x5315eb);SmsMessageEvents['on'](_0x1dfe6b,_0x408209);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 77c7d8f..b0d5bf1 100644 --- a/server/api/smsQueue/index.js +++ b/server/api/smsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ebb=['destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','/:id','update','delete'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x7ebb,0x161));var _0xb7eb=function(_0x409c8b,_0x4892d4){_0x409c8b=_0x409c8b-0x0;var _0x430500=_0x7ebb[_0x409c8b];return _0x430500;};'use strict';var multer=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var path=require(_0xb7eb('0x2'));var timeout=require(_0xb7eb('0x3'));var express=require(_0xb7eb('0x4'));var router=express[_0xb7eb('0x5')]();var auth=require(_0xb7eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb7eb('0x7'));var controller=require(_0xb7eb('0x8'));router[_0xb7eb('0x9')]('/',auth[_0xb7eb('0xa')](),controller[_0xb7eb('0xb')]);router[_0xb7eb('0x9')](_0xb7eb('0xc'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0xd')]);router[_0xb7eb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb7eb('0xe')]);router[_0xb7eb('0x9')](_0xb7eb('0xf'),auth[_0xb7eb('0xa')](),controller['getMembers']);router[_0xb7eb('0x9')](_0xb7eb('0x10'),auth['isAuthenticated'](),controller[_0xb7eb('0x11')]);router[_0xb7eb('0x9')](_0xb7eb('0x12'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x13')]);router[_0xb7eb('0x14')]('/',auth[_0xb7eb('0xa')](),controller['create']);router[_0xb7eb('0x14')](_0xb7eb('0x10'),auth[_0xb7eb('0xa')](),controller['addTeams']);router[_0xb7eb('0x14')](_0xb7eb('0x12'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x15')]);router['put'](_0xb7eb('0x16'),auth['isAuthenticated'](),controller[_0xb7eb('0x17')]);router[_0xb7eb('0x18')](_0xb7eb('0x16'),auth['isAuthenticated'](),controller[_0xb7eb('0x19')]);router[_0xb7eb('0x18')](_0xb7eb('0x10'),auth[_0xb7eb('0xa')](),controller['removeTeams']);router[_0xb7eb('0x18')]('/:id/users',auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x00f0=['get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x00f0,0xec));var _0x000f=function(_0x5eb294,_0x1390c6){_0x5eb294=_0x5eb294-0x0;var _0x3d047f=_0x00f0[_0x5eb294];return _0x3d047f;};'use strict';var multer=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var path=require(_0x000f('0x2'));var timeout=require(_0x000f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x000f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x000f('0x5'));var controller=require('./smsQueue.controller');router[_0x000f('0x6')]('/',auth[_0x000f('0x7')](),controller['index']);router[_0x000f('0x6')](_0x000f('0x8'),auth[_0x000f('0x7')](),controller[_0x000f('0x9')]);router[_0x000f('0x6')](_0x000f('0xa'),auth[_0x000f('0x7')](),controller[_0x000f('0xb')]);router[_0x000f('0x6')](_0x000f('0xc'),auth[_0x000f('0x7')](),controller['getMembers']);router['get'](_0x000f('0xd'),auth[_0x000f('0x7')](),controller['getTeams']);router[_0x000f('0x6')](_0x000f('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0x000f('0xf')]('/',auth[_0x000f('0x7')](),controller['create']);router['post'](_0x000f('0xd'),auth[_0x000f('0x7')](),controller[_0x000f('0x10')]);router[_0x000f('0xf')]('/:id/users',auth[_0x000f('0x7')](),controller['addAgents']);router['put'](_0x000f('0xa'),auth['isAuthenticated'](),controller[_0x000f('0x11')]);router[_0x000f('0x12')](_0x000f('0xa'),auth[_0x000f('0x7')](),controller[_0x000f('0x13')]);router[_0x000f('0x12')](_0x000f('0xd'),auth[_0x000f('0x7')](),controller[_0x000f('0x14')]);router[_0x000f('0x12')](_0x000f('0xe'),auth[_0x000f('0x7')](),controller[_0x000f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 52f87b0..cc7ae92 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 _0x0c4a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x35a6f8,_0x2a19d0){var _0x11d2da=function(_0x83f33e){while(--_0x83f33e){_0x35a6f8['push'](_0x35a6f8['shift']());}};_0x11d2da(++_0x2a19d0);}(_0x0c4a,0x1f3));var _0xa0c4=function(_0x1943f8,_0x19154d){_0x1943f8=_0x1943f8-0x0;var _0x53c444=_0x0c4a[_0x1943f8];return _0x53c444;};'use strict';var Sequelize=require(_0xa0c4('0x0'));module[_0xa0c4('0x1')]={'name':{'type':Sequelize[_0xa0c4('0x2')],'unique':_0xa0c4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa0c4('0x2')]},'timeout':{'type':Sequelize[_0xa0c4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa0c4('0x5')](_0xa0c4('0x6'),_0xa0c4('0x7'),_0xa0c4('0x8'))}}; \ No newline at end of file +var _0xee8c=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x451659,_0xbe141d){var _0x5565ef=function(_0xcd388c){while(--_0xcd388c){_0x451659['push'](_0x451659['shift']());}};_0x5565ef(++_0xbe141d);}(_0xee8c,0x124));var _0xcee8=function(_0x537962,_0x5ab92c){_0x537962=_0x537962-0x0;var _0x36af1b=_0xee8c[_0x537962];return _0x36af1b;};'use strict';var Sequelize=require(_0xcee8('0x0'));module[_0xcee8('0x1')]={'name':{'type':Sequelize[_0xcee8('0x2')],'unique':_0xcee8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcee8('0x2')]},'timeout':{'type':Sequelize[_0xcee8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcee8('0x5')](_0xcee8('0x6'),_0xcee8('0x7'),_0xcee8('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4570001..c0494d1 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 _0x379f=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','UserSmsQueue','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','includes','all','union','compact','isEmpty','userSmsQueue:remove','addAgents','emit','removeAgents','isArray','getAgents','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','./smsQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','sendStatus','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x5ee652,_0x2ee8e9){var _0x5d90d6=function(_0x4487fb){while(--_0x4487fb){_0x5ee652['push'](_0x5ee652['shift']());}};_0x5d90d6(++_0x2ee8e9);}(_0x379f,0x149));var _0xf379=function(_0x552fe4,_0x424a68){_0x552fe4=_0x552fe4-0x0;var _0x4a2b12=_0x379f[_0x552fe4];return _0x4a2b12;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf379('0x0'));var jsonpatch=require(_0xf379('0x1'));var rp=require('request-promise');var moment=require(_0xf379('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf379('0x3'));var util=require('util');var path=require(_0xf379('0x4'));var sox=require(_0xf379('0x5'));var csv=require(_0xf379('0x6'));var ejs=require(_0xf379('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf379('0x8'));var jsforce=require(_0xf379('0x9'));var deskjs=require(_0xf379('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf379('0xb'));var Papa=require(_0xf379('0xc'));var Redis=require('ioredis');var authService=require(_0xf379('0xd'));var qs=require(_0xf379('0xe'));var as=require(_0xf379('0xf'));var hardwareService=require(_0xf379('0x10'));var logger=require(_0xf379('0x11'))('api');var utils=require(_0xf379('0x12'));var config=require('../../config/environment');var db=require(_0xf379('0x13'))['db'];config[_0xf379('0x14')]=_['defaults'](config[_0xf379('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf379('0x14')]));require(_0xf379('0x15'))[_0xf379('0x16')](socket);function respondWithStatusCode(_0x133af7,_0x4ca1d3){_0x4ca1d3=_0x4ca1d3||0xcc;return function(_0x8913e4){if(_0x8913e4){return _0x133af7['sendStatus'](_0x4ca1d3);}return _0x133af7[_0xf379('0x17')](_0x4ca1d3)[_0xf379('0x18')]();};}function respondWithResult(_0x30a0d6,_0x4d1d3a){_0x4d1d3a=_0x4d1d3a||0xc8;return function(_0x555f39){if(_0x555f39){return _0x30a0d6[_0xf379('0x17')](_0x4d1d3a)[_0xf379('0x19')](_0x555f39);}};}function respondWithFilteredResult(_0x3fe9ac,_0x33bb98){return function(_0x30df29){if(_0x30df29){var _0x4bd9e6=_0x30df29[_0xf379('0x1a')],_0x4f1e03=_0x33bb98[_0xf379('0x1b')],_0x570684=_0x33bb98[_0xf379('0x1b')]+_0x33bb98[_0xf379('0x1c')],_0x146d3f;if(_0x570684>=_0x4bd9e6){_0x570684=_0x4bd9e6;_0x146d3f=0xc8;}else{_0x146d3f=0xce;}_0x3fe9ac[_0xf379('0x17')](_0x146d3f);return _0x3fe9ac[_0xf379('0x1d')](_0xf379('0x1e'),_0x4f1e03+'-'+_0x570684+'/'+_0x4bd9e6)['json'](_0x30df29);}return null;};}function patchUpdates(_0x218936){return function(_0x124dad){try{jsonpatch['apply'](_0x124dad,_0x218936,!![]);}catch(_0x3b2dae){return BPromise[_0xf379('0x1f')](_0x3b2dae);}return _0x124dad[_0xf379('0x20')]();};}function saveUpdates(_0x15559e,_0x577d68){return function(_0x4925e6){if(_0x4925e6){return _0x4925e6[_0xf379('0x21')](_0x15559e)[_0xf379('0x22')](function(_0x5ec348){return _0x5ec348;});}return null;};}function removeEntity(_0x392294,_0x40d0b2){return function(_0x5c976b){if(_0x5c976b){return _0x5c976b[_0xf379('0x23')]()['then'](function(){var _0xc3b0dc=_0x5c976b[_0xf379('0x24')]({'plain':!![]});var _0x1a0691=_0xf379('0x25');return db[_0xf379('0x26')][_0xf379('0x23')]({'where':{'type':_0x1a0691,'resourceId':_0xc3b0dc['id']}})[_0xf379('0x22')](function(){return _0x5c976b;});})[_0xf379('0x22')](function(){_0x392294[_0xf379('0x17')](0xcc)[_0xf379('0x18')]();});}};}function handleEntityNotFound(_0x2fc3ea,_0x51a006){return function(_0x4d8652){if(!_0x4d8652){_0x2fc3ea[_0xf379('0x27')](0x194);}return _0x4d8652;};}function handleError(_0x21b834,_0x4ad20d){_0x4ad20d=_0x4ad20d||0x1f4;return function(_0x75650){logger[_0xf379('0x28')](_0x75650[_0xf379('0x29')]);if(_0x75650[_0xf379('0x2a')]){delete _0x75650[_0xf379('0x2a')];}_0x21b834['status'](_0x4ad20d)['send'](_0x75650);};}exports[_0xf379('0x2b')]=function(_0xedd6b3,_0x50a8b5){var _0x41e8cd={},_0x225e64={},_0x55b2d9={'count':0x0,'rows':[]};var _0x3f15f9=_[_0xf379('0x2c')](db[_0xf379('0x2d')][_0xf379('0x2e')],function(_0x4d1562){return{'name':_0x4d1562[_0xf379('0x2f')],'type':_0x4d1562['type']['key']};});_0x225e64['model']=_['map'](_0x3f15f9,_0xf379('0x2a'));_0x225e64[_0xf379('0x30')]=_[_0xf379('0x31')](_0xedd6b3[_0xf379('0x30')]);_0x225e64[_0xf379('0x32')]=_[_0xf379('0x33')](_0x225e64['model'],_0x225e64['query']);_0x41e8cd[_0xf379('0x34')]=_[_0xf379('0x33')](_0x225e64[_0xf379('0x35')],qs[_0xf379('0x36')](_0xedd6b3['query'][_0xf379('0x36')]));_0x41e8cd['attributes']=_0x41e8cd[_0xf379('0x34')][_0xf379('0x37')]?_0x41e8cd[_0xf379('0x34')]:_0x225e64[_0xf379('0x35')];if(!_0xedd6b3[_0xf379('0x30')][_0xf379('0x38')](_0xf379('0x39'))){_0x41e8cd['limit']=qs[_0xf379('0x1c')](_0xedd6b3[_0xf379('0x30')][_0xf379('0x1c')]);_0x41e8cd['offset']=qs['offset'](_0xedd6b3[_0xf379('0x30')][_0xf379('0x1b')]);}_0x41e8cd[_0xf379('0x3a')]=qs[_0xf379('0x3b')](_0xedd6b3[_0xf379('0x30')][_0xf379('0x3b')]);_0x41e8cd[_0xf379('0x3c')]=qs[_0xf379('0x32')](_[_0xf379('0x3d')](_0xedd6b3[_0xf379('0x30')],_0x225e64['filters']),_0x3f15f9);if(_0xedd6b3[_0xf379('0x30')][_0xf379('0x3e')]){_0x41e8cd[_0xf379('0x3c')]=_['merge'](_0x41e8cd[_0xf379('0x3c')],{'$or':_['map'](_0x3f15f9,function(_0x485a62){if(_0x485a62[_0xf379('0x3f')]!==_0xf379('0x40')){var _0x3592ef={};_0x3592ef[_0x485a62[_0xf379('0x2a')]]={'$like':'%'+_0xedd6b3['query'][_0xf379('0x3e')]+'%'};return _0x3592ef;}})});}_0x41e8cd=_[_0xf379('0x41')]({},_0x41e8cd,_0xedd6b3[_0xf379('0x42')]);var _0xd94998={'where':_0x41e8cd['where']};return db[_0xf379('0x2d')][_0xf379('0x1a')](_0xd94998)[_0xf379('0x22')](function(_0x2a26b3){_0x55b2d9[_0xf379('0x1a')]=_0x2a26b3;if(_0xedd6b3[_0xf379('0x30')][_0xf379('0x43')]){_0x41e8cd[_0xf379('0x44')]=[{'all':!![]}];}return db[_0xf379('0x2d')][_0xf379('0x45')](_0x41e8cd);})[_0xf379('0x22')](function(_0x577c9f){_0x55b2d9[_0xf379('0x46')]=_0x577c9f;return _0x55b2d9;})[_0xf379('0x22')](respondWithFilteredResult(_0x50a8b5,_0x41e8cd))[_0xf379('0x47')](handleError(_0x50a8b5,null));};exports[_0xf379('0x48')]=function(_0x41c8a3,_0x1a89c1){var _0x4a24c2={'raw':!![],'where':{'id':_0x41c8a3[_0xf379('0x49')]['id']}},_0xae5a52={};_0xae5a52[_0xf379('0x35')]=_[_0xf379('0x31')](db[_0xf379('0x2d')][_0xf379('0x2e')]);_0xae5a52[_0xf379('0x30')]=_['keys'](_0x41c8a3['query']);_0xae5a52[_0xf379('0x32')]=_[_0xf379('0x33')](_0xae5a52[_0xf379('0x35')],_0xae5a52[_0xf379('0x30')]);_0x4a24c2['attributes']=_[_0xf379('0x33')](_0xae5a52['model'],qs[_0xf379('0x36')](_0x41c8a3[_0xf379('0x30')][_0xf379('0x36')]));_0x4a24c2[_0xf379('0x34')]=_0x4a24c2[_0xf379('0x34')][_0xf379('0x37')]?_0x4a24c2[_0xf379('0x34')]:_0xae5a52[_0xf379('0x35')];if(_0x41c8a3[_0xf379('0x30')][_0xf379('0x43')]){_0x4a24c2[_0xf379('0x44')]=[{'all':!![]}];}_0x4a24c2=_[_0xf379('0x41')]({},_0x4a24c2,_0x41c8a3[_0xf379('0x42')]);return db[_0xf379('0x2d')][_0xf379('0x4a')](_0x4a24c2)[_0xf379('0x22')](handleEntityNotFound(_0x1a89c1,null))['then'](respondWithResult(_0x1a89c1,null))[_0xf379('0x47')](handleError(_0x1a89c1,null));};exports['create']=function(_0x463638,_0x8cf115){return db[_0xf379('0x2d')][_0xf379('0x4b')](_0x463638['body'],{})[_0xf379('0x22')](function(_0x352020){var _0x53eb41=_0x463638[_0xf379('0x4c')][_0xf379('0x24')]({'plain':!![]});if(!_0x53eb41)throw new Error(_0xf379('0x4d'));if(_0x53eb41[_0xf379('0x4e')]===_0xf379('0x4c')){var _0x81616e=_0x352020[_0xf379('0x24')]({'plain':!![]});var _0xf74448=_0xf379('0x25');return db[_0xf379('0x4f')]['find']({'where':{'name':_0xf74448,'userProfileId':_0x53eb41[_0xf379('0x50')]},'raw':!![]})['then'](function(_0x23631b){if(_0x23631b&&_0x23631b[_0xf379('0x51')]===0x0){return db[_0xf379('0x26')]['create']({'name':_0x81616e[_0xf379('0x2a')],'resourceId':_0x81616e['id'],'type':_0x23631b['name'],'sectionId':_0x23631b['id']},{})[_0xf379('0x22')](function(){return _0x352020;});}else{return _0x352020;}})[_0xf379('0x47')](function(_0x525eec){logger[_0xf379('0x28')](_0xf379('0x52'),_0x525eec);throw _0x525eec;});}return _0x352020;})[_0xf379('0x22')](respondWithResult(_0x8cf115,0xc9))['catch'](handleError(_0x8cf115,null));};exports[_0xf379('0x21')]=function(_0x426bd8,_0x55bc2b){if(_0x426bd8[_0xf379('0x53')]['id']){delete _0x426bd8[_0xf379('0x53')]['id'];}return db['SmsQueue'][_0xf379('0x4a')]({'where':{'id':_0x426bd8[_0xf379('0x49')]['id']}})[_0xf379('0x22')](handleEntityNotFound(_0x55bc2b,null))[_0xf379('0x22')](saveUpdates(_0x426bd8[_0xf379('0x53')],null))[_0xf379('0x22')](respondWithResult(_0x55bc2b,null))[_0xf379('0x47')](handleError(_0x55bc2b,null));};exports[_0xf379('0x23')]=function(_0x46d640,_0x3f533b){return db[_0xf379('0x2d')]['find']({'where':{'id':_0x46d640['params']['id']}})[_0xf379('0x22')](handleEntityNotFound(_0x3f533b,null))[_0xf379('0x22')](removeEntity(_0x3f533b,null))['catch'](handleError(_0x3f533b,null));};exports[_0xf379('0x54')]=function(_0x205113,_0x5814c6){return db[_0xf379('0x2d')][_0xf379('0x54')]()[_0xf379('0x22')](respondWithResult(_0x5814c6,null))[_0xf379('0x47')](handleError(_0x5814c6,null));};exports[_0xf379('0x55')]=function(_0x11b4a2,_0x2c2acc,_0x550de0){var _0x294c02={'raw':!![],'where':{}},_0x4c227={},_0x53f9ee;return db['SmsQueue'][_0xf379('0x56')]({'where':{'id':_0x11b4a2['params']['id']}})[_0xf379('0x22')](handleEntityNotFound(_0x2c2acc,null))[_0xf379('0x22')](function(_0x147d3a){if(_0x147d3a){_0x53f9ee=_0x147d3a['get']({'plain':!![]});_0x4c227['model']=_['keys'](db['UserSmsQueue'][_0xf379('0x2e')]);_0x4c227[_0xf379('0x30')]=_['keys'](_0x11b4a2['query']);_0x4c227[_0xf379('0x32')]=_[_0xf379('0x33')](_0x4c227['model'],_0x4c227['query']);_0x294c02[_0xf379('0x34')]=_['intersection'](_0x4c227['model'],qs[_0xf379('0x36')](_0x11b4a2[_0xf379('0x30')]['fields']));_0x294c02[_0xf379('0x34')]=_0x294c02[_0xf379('0x34')]['length']?_0x294c02['attributes']:_0x4c227[_0xf379('0x35')];if(!_0x11b4a2['query'][_0xf379('0x38')](_0xf379('0x39'))){_0x294c02[_0xf379('0x1c')]=qs['limit'](_0x11b4a2['query'][_0xf379('0x1c')]);_0x294c02[_0xf379('0x1b')]=qs[_0xf379('0x1b')](_0x11b4a2['query'][_0xf379('0x1b')]);}_0x294c02[_0xf379('0x3a')]=qs[_0xf379('0x3b')](_0x11b4a2[_0xf379('0x30')]['sort']);_0x294c02[_0xf379('0x3c')]=qs[_0xf379('0x32')](_['pick'](_0x11b4a2[_0xf379('0x30')],_0x4c227[_0xf379('0x32')]));_0x294c02[_0xf379('0x3c')][_0xf379('0x57')]=_0x147d3a['id'];if(_0x11b4a2[_0xf379('0x30')]['filter']){_0x294c02['where']=_[_0xf379('0x41')](_0x294c02['where'],{'$or':_[_0xf379('0x2c')](_0x294c02[_0xf379('0x34')],function(_0x45618a){var _0x1e94aa={};_0x1e94aa[_0x45618a]={'$like':'%'+_0x11b4a2[_0xf379('0x30')][_0xf379('0x3e')]+'%'};return _0x1e94aa;})});}_0x294c02=_[_0xf379('0x41')]({},_0x294c02,_0x11b4a2['options']);return db['UserSmsQueue'][_0xf379('0x45')](_0x294c02);}})['then'](function(_0xdb32a3){if(_0xdb32a3){return db['User'][_0xf379('0x58')]({'where':{'id':_[_0xf379('0x2c')](_0xdb32a3,_0xf379('0x59')),'role':_0xf379('0x5a')},'attributes':['id',_0xf379('0x2a'),_0xf379('0x5b'),_0xf379('0x5c'),_0xf379('0x5d')]});}})['then'](function(_0x518ee0){if(_0x518ee0){return{'count':_0x518ee0[_0xf379('0x1a')],'rows':_[_0xf379('0x2c')](_0x518ee0[_0xf379('0x46')],function(_0x55e7d6){return{'membername':_0x55e7d6[_0xf379('0x2a')],'UserId':_0x55e7d6['id'],'queue_name':_0x53f9ee['name'],'SmsQueueId':_0x53f9ee['id'],'interface':util[_0xf379('0x5e')](_0xf379('0x5f'),_0xf379('0x60'),_0x55e7d6[_0xf379('0x2a')]),'penalty':0x0,'paused':_0x55e7d6[_0xf379('0x5b')],'createdAt':_0x55e7d6[_0xf379('0x5d')],'updatedAt':_0x55e7d6[_0xf379('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf379('0x22')](respondWithFilteredResult(_0x2c2acc,_0x294c02))['catch'](handleError(_0x2c2acc,null));};exports[_0xf379('0x61')]=function(_0x30d4d6,_0x46a2a5,_0x185c15){var _0x42834c={};var _0x59fe35={};var _0x2fc4a3;var _0x4b0cbc;return db[_0xf379('0x2d')][_0xf379('0x56')]({'where':{'id':_0x30d4d6[_0xf379('0x49')]['id']}})[_0xf379('0x22')](handleEntityNotFound(_0x46a2a5,null))[_0xf379('0x22')](function(_0x11e277){if(_0x11e277){_0x2fc4a3=_0x11e277;_0x59fe35[_0xf379('0x35')]=_[_0xf379('0x31')](db[_0xf379('0x62')][_0xf379('0x2e')]);_0x59fe35[_0xf379('0x30')]=_[_0xf379('0x31')](_0x30d4d6[_0xf379('0x30')]);_0x59fe35['filters']=_['intersection'](_0x59fe35[_0xf379('0x35')],_0x59fe35['query']);_0x42834c['attributes']=_[_0xf379('0x33')](_0x59fe35[_0xf379('0x35')],qs[_0xf379('0x36')](_0x30d4d6[_0xf379('0x30')][_0xf379('0x36')]));_0x42834c['attributes']=_0x42834c[_0xf379('0x34')][_0xf379('0x37')]?_0x42834c['attributes']:_0x59fe35[_0xf379('0x35')];_0x42834c[_0xf379('0x3a')]=qs[_0xf379('0x3b')](_0x30d4d6[_0xf379('0x30')][_0xf379('0x3b')]);_0x42834c[_0xf379('0x3c')]=qs[_0xf379('0x32')](_['pick'](_0x30d4d6[_0xf379('0x30')],_0x59fe35[_0xf379('0x32')]));if(_0x30d4d6[_0xf379('0x30')]['filter']){_0x42834c[_0xf379('0x3c')]=_[_0xf379('0x41')](_0x42834c[_0xf379('0x3c')],{'$or':_['map'](_0x42834c['attributes'],function(_0x3909ce){var _0x1bca6c={};_0x1bca6c[_0x3909ce]={'$like':'%'+_0x30d4d6['query'][_0xf379('0x3e')]+'%'};return _0x1bca6c;})});}_0x42834c=_[_0xf379('0x41')]({},_0x42834c,_0x30d4d6['options']);return _0x2fc4a3[_0xf379('0x61')](_0x42834c);}})[_0xf379('0x22')](function(_0x249d76){if(_0x249d76){_0x4b0cbc=_0x249d76[_0xf379('0x37')];if(!_0x30d4d6[_0xf379('0x30')]['hasOwnProperty']('nolimit')){_0x42834c[_0xf379('0x1c')]=qs[_0xf379('0x1c')](_0x30d4d6[_0xf379('0x30')][_0xf379('0x1c')]);_0x42834c[_0xf379('0x1b')]=qs[_0xf379('0x1b')](_0x30d4d6[_0xf379('0x30')]['offset']);}return _0x2fc4a3[_0xf379('0x61')](_0x42834c);}})[_0xf379('0x22')](function(_0x787c50){if(_0x787c50){return _0x787c50?{'count':_0x4b0cbc,'rows':_0x787c50}:null;}})['then'](respondWithResult(_0x46a2a5,null))['catch'](handleError(_0x46a2a5,null));};exports[_0xf379('0x63')]=function(_0x244027,_0x57992,_0x2c647a){var _0x220519=_0x244027[_0xf379('0x53')][_0xf379('0x64')];return db[_0xf379('0x62')][_0xf379('0x45')]({'where':{'id':_0x220519},'attributes':['id'],'include':[{'model':db[_0xf379('0x65')],'as':_0xf379('0x66'),'attributes':['id',_0xf379('0x2a'),_0xf379('0x67'),_0xf379('0x68'),_0xf379('0x69')],'raw':!![]}]})[_0xf379('0x22')](function(_0x5e6fd8){if(_0x5e6fd8){var _0x12c7ca=_[_0xf379('0x6a')](_0x5e6fd8,function(_0x20650c){var _0x23e908=_0x20650c[_0xf379('0x24')]({'plain':!![]});return _0x23e908['Agents'];});return db[_0xf379('0x2d')][_0xf379('0x4a')]({'where':{'id':_0x244027[_0xf379('0x49')]['id']}})[_0xf379('0x22')](function(_0x2967ec){return db[_0xf379('0x6b')][_0xf379('0x6c')](function(_0x192065){return _0x2967ec[_0xf379('0x63')](_0x220519,{'transaction':_0x192065})[_0xf379('0x22')](function(){return BPromise[_0xf379('0x6d')](_0x12c7ca,function(_0x3a8584){return db[_0xf379('0x6e')][_0xf379('0x6f')]({'where':{'UserId':_0x3a8584['id'],'SmsQueueId':_0x244027['params']['id']},'transaction':_0x192065});});})[_0xf379('0x22')](function(){_0x12c7ca[_0xf379('0x70')](function(_0x5c1392){socket['emit'](_0xf379('0x71'),{'UserId':_0x5c1392['id'],'SmsQueueId':_0x2967ec['id']});});});});});}})[_0xf379('0x22')](respondWithStatusCode(_0x57992,null))[_0xf379('0x47')](handleError(_0x57992,null));};exports[_0xf379('0x72')]=function(_0x1e86ea,_0x2a2f06,_0x1a8707){return db['Team'][_0xf379('0x45')]({'where':{'id':_0x1e86ea[_0xf379('0x30')][_0xf379('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf379('0x66'),'attributes':['id'],'raw':!![]}]})[_0xf379('0x22')](handleEntityNotFound(_0x2a2f06,null))['then'](function(_0xd140bc){var _0x245a06=_[_0xf379('0x2c')](_0xd140bc,'id');var _0x553db9=[];var _0x5b2507=[];var _0x403874=squel[_0xf379('0x73')]();_0x403874[_0xf379('0x74')](_0xf379('0x75'))[_0xf379('0x76')](_0xf379('0x77'),'tq')[_0xf379('0x78')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf379('0x3c')](_0xf379('0x79'),_0x1e86ea['params']['id']);for(var _0x422282=0x0;_0x422282<_0xd140bc[_0xf379('0x37')];_0x422282+=0x1){let _0x1601a2=_0xd140bc[_0x422282];for(var _0xa27188=0x0;_0xa27188<_0x1601a2[_0xf379('0x66')][_0xf379('0x37')];_0xa27188+=0x1){let _0x3e1ed1=_0x1601a2[_0xf379('0x66')][_0xa27188];var _0x39278a=_0x403874[_0xf379('0x7a')]();_0x39278a[_0xf379('0x3c')](_0xf379('0x7b'),_0x3e1ed1['id']);_0x5b2507['push'](db[_0xf379('0x6b')]['query'](_0x39278a[_0xf379('0x7c')](),{'type':db[_0xf379('0x6b')][_0xf379('0x7d')]['SELECT']})['then'](function(_0x37ac18){if(_0x37ac18[_0xf379('0x37')]===0x1){return _0x3e1ed1['id'];}else{var _0x3d3bf7=_['every'](_['map'](_0x37ac18,'TeamId'),function(_0x212f94){return _[_0xf379('0x7e')](_0x245a06,_0x212f94);});if(_0x3d3bf7){return _0x3e1ed1['id'];}}}));}}return BPromise[_0xf379('0x7f')](_0x5b2507)[_0xf379('0x22')](function(_0x151a18){_0x553db9=_(_0x553db9)[_0xf379('0x80')](_0x151a18)[_0xf379('0x81')]()['value']();return db['SmsQueue'][_0xf379('0x4a')]({'where':{'id':_0x1e86ea[_0xf379('0x49')]['id']}})[_0xf379('0x22')](function(_0xc3e1d1){return db['sequelize'][_0xf379('0x6c')](function(_0x55b146){return _0xc3e1d1[_0xf379('0x72')](_0x1e86ea[_0xf379('0x30')][_0xf379('0x64')],{'transaction':_0x55b146})['then'](function(){if(!_[_0xf379('0x82')](_0x553db9)){return _0xc3e1d1['removeAgents'](_0x553db9,{'transaction':_0x55b146});}})[_0xf379('0x22')](function(){_0x553db9[_0xf379('0x70')](function(_0x37ac33){socket['emit'](_0xf379('0x83'),{'UserId':_0x37ac33,'SmsQueueId':_0xc3e1d1['id']});});});});});});})['then'](respondWithStatusCode(_0x2a2f06,null))[_0xf379('0x47')](handleError(_0x2a2f06,null));};exports[_0xf379('0x84')]=function(_0x493479,_0x593c02,_0x192858){return db[_0xf379('0x2d')][_0xf379('0x4a')]({'where':{'id':_0x493479[_0xf379('0x49')]['id']}})['then'](handleEntityNotFound(_0x593c02,null))[_0xf379('0x22')](function(_0x1261aa){if(_0x1261aa){return _0x1261aa['addAgents'](_0x493479[_0xf379('0x53')][_0xf379('0x64')],_['omit'](_0x493479[_0xf379('0x53')],[_0xf379('0x64'),'id'])||{})['spread'](function(_0x552885){for(var _0x5a8c24=0x0;_0x5a8c24<_0x493479['body'][_0xf379('0x64')][_0xf379('0x37')];_0x5a8c24+=0x1){socket[_0xf379('0x85')](_0xf379('0x71'),{'UserId':_0x493479[_0xf379('0x53')][_0xf379('0x64')][_0x5a8c24],'SmsQueueId':_0x493479[_0xf379('0x49')]['id']});}return _0x552885;});}})[_0xf379('0x22')](respondWithResult(_0x593c02,null))[_0xf379('0x47')](handleError(_0x593c02,null));};exports[_0xf379('0x86')]=function(_0x416078,_0x3151ff,_0x3900e3){return db['SmsQueue'][_0xf379('0x4a')]({'where':{'id':_0x416078[_0xf379('0x49')]['id']}})[_0xf379('0x22')](handleEntityNotFound(_0x3151ff,null))[_0xf379('0x22')](function(_0x5c7c50){if(_0x5c7c50){return _0x5c7c50[_0xf379('0x86')](_0x416078[_0xf379('0x30')][_0xf379('0x64')])['then'](function(){if(_[_0xf379('0x87')](_0x416078[_0xf379('0x30')][_0xf379('0x64')])){for(var _0x586c1c=0x0;_0x586c1c<_0x416078['query'][_0xf379('0x64')]['length'];_0x586c1c+=0x1){socket[_0xf379('0x85')]('userSmsQueue:remove',{'UserId':Number(_0x416078[_0xf379('0x30')][_0xf379('0x64')][_0x586c1c]),'SmsQueueId':Number(_0x416078[_0xf379('0x49')]['id'])});}}else{socket[_0xf379('0x85')](_0xf379('0x83'),{'UserId':Number(_0x416078[_0xf379('0x30')][_0xf379('0x64')]),'SmsQueueId':Number(_0x416078['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3151ff,null))['catch'](handleError(_0x3151ff,null));};exports[_0xf379('0x88')]=function(_0x22ab30,_0xf30ec,_0x5f157b){var _0x6489db={};var _0xba3847={};var _0x564155;var _0x7d906b;return db['SmsQueue'][_0xf379('0x56')]({'where':{'id':_0x22ab30['params']['id']}})['then'](handleEntityNotFound(_0xf30ec,null))[_0xf379('0x22')](function(_0x1d32cd){if(_0x1d32cd){_0x564155=_0x1d32cd;_0xba3847['model']=_[_0xf379('0x31')](db[_0xf379('0x65')][_0xf379('0x2e')]);_0xba3847[_0xf379('0x30')]=_[_0xf379('0x31')](_0x22ab30[_0xf379('0x30')]);_0xba3847[_0xf379('0x32')]=_['intersection'](_0xba3847[_0xf379('0x35')],_0xba3847[_0xf379('0x30')]);_0x6489db['attributes']=_['intersection'](_0xba3847[_0xf379('0x35')],qs['fields'](_0x22ab30[_0xf379('0x30')][_0xf379('0x36')]));_0x6489db[_0xf379('0x34')]=_0x6489db[_0xf379('0x34')][_0xf379('0x37')]?_0x6489db[_0xf379('0x34')]:_0xba3847[_0xf379('0x35')];_0x6489db[_0xf379('0x3a')]=qs['sort'](_0x22ab30[_0xf379('0x30')]['sort']);_0x6489db[_0xf379('0x3c')]=qs[_0xf379('0x32')](_['pick'](_0x22ab30[_0xf379('0x30')],_0xba3847[_0xf379('0x32')]));if(_0x22ab30[_0xf379('0x30')]['filter']){_0x6489db[_0xf379('0x3c')]=_[_0xf379('0x41')](_0x6489db[_0xf379('0x3c')],{'$or':_[_0xf379('0x2c')](_0x6489db['attributes'],function(_0x2e8df2){var _0x1a9e33={};_0x1a9e33[_0x2e8df2]={'$like':'%'+_0x22ab30[_0xf379('0x30')][_0xf379('0x3e')]+'%'};return _0x1a9e33;})});}_0x6489db=_[_0xf379('0x41')]({},_0x6489db,_0x22ab30['options']);return _0x564155[_0xf379('0x88')](_0x6489db);}})['then'](function(_0x2801eb){if(_0x2801eb){_0x7d906b=_0x2801eb[_0xf379('0x37')];if(!_0x22ab30['query'][_0xf379('0x38')]('nolimit')){_0x6489db[_0xf379('0x1c')]=qs[_0xf379('0x1c')](_0x22ab30[_0xf379('0x30')][_0xf379('0x1c')]);_0x6489db[_0xf379('0x1b')]=qs[_0xf379('0x1b')](_0x22ab30[_0xf379('0x30')][_0xf379('0x1b')]);}return _0x564155[_0xf379('0x88')](_0x6489db);}})[_0xf379('0x22')](function(_0x1d6f07){if(_0x1d6f07){return _0x1d6f07?{'count':_0x7d906b,'rows':_0x1d6f07}:null;}})[_0xf379('0x22')](respondWithResult(_0xf30ec,null))[_0xf379('0x47')](handleError(_0xf30ec,null));}; \ No newline at end of file +var _0x3f34=['online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','userSmsQueue:save','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','SmsQueues','UserProfileResource','destroy','error','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','keys','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents'];(function(_0x4ea3dc,_0x73522b){var _0x232dfd=function(_0x3a6ece){while(--_0x3a6ece){_0x4ea3dc['push'](_0x4ea3dc['shift']());}};_0x232dfd(++_0x73522b);}(_0x3f34,0xa7));var _0x43f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f34[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x43f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43f3('0x1'));var jsonpatch=require(_0x43f3('0x2'));var rp=require(_0x43f3('0x3'));var moment=require('moment');var BPromise=require(_0x43f3('0x4'));var Mustache=require(_0x43f3('0x5'));var util=require('util');var path=require(_0x43f3('0x6'));var sox=require(_0x43f3('0x7'));var csv=require(_0x43f3('0x8'));var ejs=require(_0x43f3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x43f3('0xa'));var jsforce=require(_0x43f3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x43f3('0x8'));var querystring=require(_0x43f3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x43f3('0xd'));var qs=require(_0x43f3('0xe'));var as=require(_0x43f3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x43f3('0x10'));var utils=require('../../config/utils');var config=require(_0x43f3('0x11'));var db=require(_0x43f3('0x12'))['db'];config['redis']=_['defaults'](config[_0x43f3('0x13')],{'host':_0x43f3('0x14'),'port':0x18eb});var socket=require(_0x43f3('0x15'))(new Redis(config[_0x43f3('0x13')]));require(_0x43f3('0x16'))[_0x43f3('0x17')](socket);function respondWithStatusCode(_0x3f5a08,_0x163aa8){_0x163aa8=_0x163aa8||0xcc;return function(_0x57861d){if(_0x57861d){return _0x3f5a08[_0x43f3('0x18')](_0x163aa8);}return _0x3f5a08[_0x43f3('0x19')](_0x163aa8)[_0x43f3('0x1a')]();};}function respondWithResult(_0x20c820,_0x191ea2){_0x191ea2=_0x191ea2||0xc8;return function(_0xcf9192){if(_0xcf9192){return _0x20c820[_0x43f3('0x19')](_0x191ea2)[_0x43f3('0x1b')](_0xcf9192);}};}function respondWithFilteredResult(_0x2ae63a,_0x5d5fdb){return function(_0x33aee6){if(_0x33aee6){var _0x496be1=_0x33aee6[_0x43f3('0x1c')],_0x4e8d5b=_0x5d5fdb[_0x43f3('0x1d')],_0x3476c2=_0x5d5fdb[_0x43f3('0x1d')]+_0x5d5fdb[_0x43f3('0x1e')],_0x25da09;if(_0x3476c2>=_0x496be1){_0x3476c2=_0x496be1;_0x25da09=0xc8;}else{_0x25da09=0xce;}_0x2ae63a[_0x43f3('0x19')](_0x25da09);return _0x2ae63a[_0x43f3('0x1f')](_0x43f3('0x20'),_0x4e8d5b+'-'+_0x3476c2+'/'+_0x496be1)[_0x43f3('0x1b')](_0x33aee6);}return null;};}function patchUpdates(_0xfb234c){return function(_0x216b95){try{jsonpatch['apply'](_0x216b95,_0xfb234c,!![]);}catch(_0x74ebc1){return BPromise['reject'](_0x74ebc1);}return _0x216b95[_0x43f3('0x21')]();};}function saveUpdates(_0x435eb0,_0x406f97){return function(_0x36cc2f){if(_0x36cc2f){return _0x36cc2f[_0x43f3('0x22')](_0x435eb0)[_0x43f3('0x23')](function(_0x48609f){return _0x48609f;});}return null;};}function removeEntity(_0x531394,_0x23cc9f){return function(_0x5457ce){if(_0x5457ce){return _0x5457ce['destroy']()[_0x43f3('0x23')](function(){var _0x4964b2=_0x5457ce['get']({'plain':!![]});var _0x5b454e=_0x43f3('0x24');return db[_0x43f3('0x25')][_0x43f3('0x26')]({'where':{'type':_0x5b454e,'resourceId':_0x4964b2['id']}})[_0x43f3('0x23')](function(){return _0x5457ce;});})[_0x43f3('0x23')](function(){_0x531394[_0x43f3('0x19')](0xcc)[_0x43f3('0x1a')]();});}};}function handleEntityNotFound(_0x3a224b,_0x55f88e){return function(_0x206b48){if(!_0x206b48){_0x3a224b[_0x43f3('0x18')](0x194);}return _0x206b48;};}function handleError(_0x400b8d,_0x5c2019){_0x5c2019=_0x5c2019||0x1f4;return function(_0x1bd714){logger[_0x43f3('0x27')](_0x1bd714[_0x43f3('0x28')]);if(_0x1bd714['name']){delete _0x1bd714[_0x43f3('0x29')];}_0x400b8d[_0x43f3('0x19')](_0x5c2019)[_0x43f3('0x2a')](_0x1bd714);};}exports['index']=function(_0xb3add6,_0x4cf34c){var _0x311696={},_0x344a41={},_0x21702c={'count':0x0,'rows':[]};var _0x1f8417=_[_0x43f3('0x2b')](db[_0x43f3('0x2c')][_0x43f3('0x2d')],function(_0x1266e5){return{'name':_0x1266e5[_0x43f3('0x2e')],'type':_0x1266e5[_0x43f3('0x2f')][_0x43f3('0x30')]};});_0x344a41['model']=_['map'](_0x1f8417,'name');_0x344a41['query']=_[_0x43f3('0x31')](_0xb3add6['query']);_0x344a41['filters']=_[_0x43f3('0x32')](_0x344a41[_0x43f3('0x33')],_0x344a41['query']);_0x311696[_0x43f3('0x34')]=_[_0x43f3('0x32')](_0x344a41[_0x43f3('0x33')],qs['fields'](_0xb3add6['query'][_0x43f3('0x35')]));_0x311696[_0x43f3('0x34')]=_0x311696[_0x43f3('0x34')][_0x43f3('0x36')]?_0x311696['attributes']:_0x344a41[_0x43f3('0x33')];if(!_0xb3add6[_0x43f3('0x37')][_0x43f3('0x38')](_0x43f3('0x39'))){_0x311696[_0x43f3('0x1e')]=qs['limit'](_0xb3add6['query']['limit']);_0x311696['offset']=qs[_0x43f3('0x1d')](_0xb3add6[_0x43f3('0x37')]['offset']);}_0x311696[_0x43f3('0x3a')]=qs['sort'](_0xb3add6['query'][_0x43f3('0x3b')]);_0x311696[_0x43f3('0x3c')]=qs['filters'](_[_0x43f3('0x3d')](_0xb3add6[_0x43f3('0x37')],_0x344a41[_0x43f3('0x3e')]),_0x1f8417);if(_0xb3add6['query'][_0x43f3('0x3f')]){_0x311696[_0x43f3('0x3c')]=_[_0x43f3('0x40')](_0x311696[_0x43f3('0x3c')],{'$or':_[_0x43f3('0x2b')](_0x1f8417,function(_0x3cb8eb){if(_0x3cb8eb[_0x43f3('0x2f')]!==_0x43f3('0x41')){var _0x15d0d5={};_0x15d0d5[_0x3cb8eb[_0x43f3('0x29')]]={'$like':'%'+_0xb3add6['query']['filter']+'%'};return _0x15d0d5;}})});}_0x311696=_[_0x43f3('0x40')]({},_0x311696,_0xb3add6[_0x43f3('0x42')]);var _0x3fc0e9={'where':_0x311696[_0x43f3('0x3c')]};return db['SmsQueue']['count'](_0x3fc0e9)[_0x43f3('0x23')](function(_0x44d302){_0x21702c[_0x43f3('0x1c')]=_0x44d302;if(_0xb3add6[_0x43f3('0x37')][_0x43f3('0x43')]){_0x311696['include']=[{'all':!![]}];}return db[_0x43f3('0x2c')][_0x43f3('0x44')](_0x311696);})[_0x43f3('0x23')](function(_0x25a88d){_0x21702c[_0x43f3('0x45')]=_0x25a88d;return _0x21702c;})['then'](respondWithFilteredResult(_0x4cf34c,_0x311696))[_0x43f3('0x46')](handleError(_0x4cf34c,null));};exports[_0x43f3('0x47')]=function(_0x520120,_0x5bdefe){var _0x17f699={'raw':!![],'where':{'id':_0x520120['params']['id']}},_0x571ecf={};_0x571ecf[_0x43f3('0x33')]=_['keys'](db[_0x43f3('0x2c')][_0x43f3('0x2d')]);_0x571ecf[_0x43f3('0x37')]=_[_0x43f3('0x31')](_0x520120['query']);_0x571ecf['filters']=_['intersection'](_0x571ecf[_0x43f3('0x33')],_0x571ecf[_0x43f3('0x37')]);_0x17f699[_0x43f3('0x34')]=_[_0x43f3('0x32')](_0x571ecf[_0x43f3('0x33')],qs[_0x43f3('0x35')](_0x520120[_0x43f3('0x37')]['fields']));_0x17f699['attributes']=_0x17f699['attributes'][_0x43f3('0x36')]?_0x17f699[_0x43f3('0x34')]:_0x571ecf['model'];if(_0x520120[_0x43f3('0x37')]['includeAll']){_0x17f699[_0x43f3('0x48')]=[{'all':!![]}];}_0x17f699=_['merge']({},_0x17f699,_0x520120[_0x43f3('0x42')]);return db[_0x43f3('0x2c')][_0x43f3('0x49')](_0x17f699)[_0x43f3('0x23')](handleEntityNotFound(_0x5bdefe,null))[_0x43f3('0x23')](respondWithResult(_0x5bdefe,null))[_0x43f3('0x46')](handleError(_0x5bdefe,null));};exports['create']=function(_0x1e2db1,_0x48217b){return db['SmsQueue']['create'](_0x1e2db1['body'],{})[_0x43f3('0x23')](function(_0x356be9){var _0x44177e=_0x1e2db1[_0x43f3('0x4a')][_0x43f3('0x4b')]({'plain':!![]});if(!_0x44177e)throw new Error(_0x43f3('0x4c'));if(_0x44177e['role']===_0x43f3('0x4a')){var _0x2f1afe=_0x356be9[_0x43f3('0x4b')]({'plain':!![]});var _0x5bef60=_0x43f3('0x24');return db['UserProfileSection'][_0x43f3('0x49')]({'where':{'name':_0x5bef60,'userProfileId':_0x44177e[_0x43f3('0x4d')]},'raw':!![]})[_0x43f3('0x23')](function(_0x4d0f4e){if(_0x4d0f4e&&_0x4d0f4e['autoAssociation']===0x0){return db[_0x43f3('0x25')][_0x43f3('0x4e')]({'name':_0x2f1afe['name'],'resourceId':_0x2f1afe['id'],'type':_0x4d0f4e[_0x43f3('0x29')],'sectionId':_0x4d0f4e['id']},{})['then'](function(){return _0x356be9;});}else{return _0x356be9;}})[_0x43f3('0x46')](function(_0x2aa665){logger['error'](_0x43f3('0x4f'),_0x2aa665);throw _0x2aa665;});}return _0x356be9;})[_0x43f3('0x23')](respondWithResult(_0x48217b,0xc9))[_0x43f3('0x46')](handleError(_0x48217b,null));};exports[_0x43f3('0x22')]=function(_0xbc8a89,_0x4c2125){if(_0xbc8a89['body']['id']){delete _0xbc8a89[_0x43f3('0x50')]['id'];}return db[_0x43f3('0x2c')][_0x43f3('0x49')]({'where':{'id':_0xbc8a89[_0x43f3('0x51')]['id']}})[_0x43f3('0x23')](handleEntityNotFound(_0x4c2125,null))['then'](saveUpdates(_0xbc8a89[_0x43f3('0x50')],null))[_0x43f3('0x23')](respondWithResult(_0x4c2125,null))[_0x43f3('0x46')](handleError(_0x4c2125,null));};exports[_0x43f3('0x26')]=function(_0x4d869b,_0x346750){return db[_0x43f3('0x2c')][_0x43f3('0x49')]({'where':{'id':_0x4d869b[_0x43f3('0x51')]['id']}})['then'](handleEntityNotFound(_0x346750,null))[_0x43f3('0x23')](removeEntity(_0x346750,null))['catch'](handleError(_0x346750,null));};exports[_0x43f3('0x52')]=function(_0x2d568f,_0x561571){return db[_0x43f3('0x2c')]['describe']()[_0x43f3('0x23')](respondWithResult(_0x561571,null))['catch'](handleError(_0x561571,null));};exports[_0x43f3('0x53')]=function(_0x336638,_0x3aa4de,_0x3896a8){var _0x44736e={'raw':!![],'where':{}},_0x2a7edb={},_0x5ad377;return db[_0x43f3('0x2c')][_0x43f3('0x54')]({'where':{'id':_0x336638[_0x43f3('0x51')]['id']}})[_0x43f3('0x23')](handleEntityNotFound(_0x3aa4de,null))[_0x43f3('0x23')](function(_0x5602d3){if(_0x5602d3){_0x5ad377=_0x5602d3[_0x43f3('0x4b')]({'plain':!![]});_0x2a7edb['model']=_[_0x43f3('0x31')](db['UserSmsQueue'][_0x43f3('0x2d')]);_0x2a7edb[_0x43f3('0x37')]=_[_0x43f3('0x31')](_0x336638[_0x43f3('0x37')]);_0x2a7edb[_0x43f3('0x3e')]=_[_0x43f3('0x32')](_0x2a7edb['model'],_0x2a7edb['query']);_0x44736e[_0x43f3('0x34')]=_['intersection'](_0x2a7edb[_0x43f3('0x33')],qs['fields'](_0x336638['query'][_0x43f3('0x35')]));_0x44736e['attributes']=_0x44736e[_0x43f3('0x34')][_0x43f3('0x36')]?_0x44736e[_0x43f3('0x34')]:_0x2a7edb[_0x43f3('0x33')];if(!_0x336638[_0x43f3('0x37')]['hasOwnProperty'](_0x43f3('0x39'))){_0x44736e[_0x43f3('0x1e')]=qs[_0x43f3('0x1e')](_0x336638[_0x43f3('0x37')][_0x43f3('0x1e')]);_0x44736e['offset']=qs[_0x43f3('0x1d')](_0x336638[_0x43f3('0x37')][_0x43f3('0x1d')]);}_0x44736e['order']=qs[_0x43f3('0x3b')](_0x336638[_0x43f3('0x37')][_0x43f3('0x3b')]);_0x44736e[_0x43f3('0x3c')]=qs['filters'](_[_0x43f3('0x3d')](_0x336638[_0x43f3('0x37')],_0x2a7edb[_0x43f3('0x3e')]));_0x44736e[_0x43f3('0x3c')][_0x43f3('0x55')]=_0x5602d3['id'];if(_0x336638[_0x43f3('0x37')]['filter']){_0x44736e[_0x43f3('0x3c')]=_[_0x43f3('0x40')](_0x44736e[_0x43f3('0x3c')],{'$or':_[_0x43f3('0x2b')](_0x44736e[_0x43f3('0x34')],function(_0x31cfab){var _0x4422f6={};_0x4422f6[_0x31cfab]={'$like':'%'+_0x336638['query'][_0x43f3('0x3f')]+'%'};return _0x4422f6;})});}_0x44736e=_[_0x43f3('0x40')]({},_0x44736e,_0x336638[_0x43f3('0x42')]);return db[_0x43f3('0x56')]['findAll'](_0x44736e);}})[_0x43f3('0x23')](function(_0xfa3db7){if(_0xfa3db7){return db[_0x43f3('0x57')][_0x43f3('0x58')]({'where':{'id':_[_0x43f3('0x2b')](_0xfa3db7,_0x43f3('0x59')),'role':'agent'},'attributes':['id',_0x43f3('0x29'),_0x43f3('0x5a'),_0x43f3('0x5b'),_0x43f3('0x5c')]});}})[_0x43f3('0x23')](function(_0x2ce88b){if(_0x2ce88b){return{'count':_0x2ce88b[_0x43f3('0x1c')],'rows':_[_0x43f3('0x2b')](_0x2ce88b[_0x43f3('0x45')],function(_0x48d391){return{'membername':_0x48d391['name'],'UserId':_0x48d391['id'],'queue_name':_0x5ad377['name'],'SmsQueueId':_0x5ad377['id'],'interface':util['format'](_0x43f3('0x5d'),_0x43f3('0x5e'),_0x48d391[_0x43f3('0x29')]),'penalty':0x0,'paused':_0x48d391[_0x43f3('0x5a')],'createdAt':_0x48d391['createdAt'],'updatedAt':_0x48d391[_0x43f3('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3aa4de,_0x44736e))['catch'](handleError(_0x3aa4de,null));};exports[_0x43f3('0x5f')]=function(_0x7b9496,_0x2b38b9,_0x5c7767){var _0x26f90e={};var _0x2b02a2={};var _0x54f177;var _0xa9b8d5;return db[_0x43f3('0x2c')][_0x43f3('0x54')]({'where':{'id':_0x7b9496['params']['id']}})[_0x43f3('0x23')](handleEntityNotFound(_0x2b38b9,null))[_0x43f3('0x23')](function(_0x20f721){if(_0x20f721){_0x54f177=_0x20f721;_0x2b02a2[_0x43f3('0x33')]=_[_0x43f3('0x31')](db[_0x43f3('0x60')][_0x43f3('0x2d')]);_0x2b02a2['query']=_[_0x43f3('0x31')](_0x7b9496[_0x43f3('0x37')]);_0x2b02a2['filters']=_['intersection'](_0x2b02a2['model'],_0x2b02a2['query']);_0x26f90e[_0x43f3('0x34')]=_['intersection'](_0x2b02a2['model'],qs['fields'](_0x7b9496['query']['fields']));_0x26f90e[_0x43f3('0x34')]=_0x26f90e[_0x43f3('0x34')]['length']?_0x26f90e[_0x43f3('0x34')]:_0x2b02a2['model'];_0x26f90e['order']=qs['sort'](_0x7b9496[_0x43f3('0x37')][_0x43f3('0x3b')]);_0x26f90e[_0x43f3('0x3c')]=qs[_0x43f3('0x3e')](_['pick'](_0x7b9496['query'],_0x2b02a2[_0x43f3('0x3e')]));if(_0x7b9496[_0x43f3('0x37')]['filter']){_0x26f90e['where']=_[_0x43f3('0x40')](_0x26f90e[_0x43f3('0x3c')],{'$or':_['map'](_0x26f90e[_0x43f3('0x34')],function(_0xd65b45){var _0x52b44a={};_0x52b44a[_0xd65b45]={'$like':'%'+_0x7b9496[_0x43f3('0x37')]['filter']+'%'};return _0x52b44a;})});}_0x26f90e=_[_0x43f3('0x40')]({},_0x26f90e,_0x7b9496[_0x43f3('0x42')]);return _0x54f177[_0x43f3('0x5f')](_0x26f90e);}})[_0x43f3('0x23')](function(_0x19724e){if(_0x19724e){_0xa9b8d5=_0x19724e[_0x43f3('0x36')];if(!_0x7b9496[_0x43f3('0x37')][_0x43f3('0x38')]('nolimit')){_0x26f90e[_0x43f3('0x1e')]=qs[_0x43f3('0x1e')](_0x7b9496[_0x43f3('0x37')][_0x43f3('0x1e')]);_0x26f90e['offset']=qs[_0x43f3('0x1d')](_0x7b9496['query'][_0x43f3('0x1d')]);}return _0x54f177[_0x43f3('0x5f')](_0x26f90e);}})['then'](function(_0x87f910){if(_0x87f910){return _0x87f910?{'count':_0xa9b8d5,'rows':_0x87f910}:null;}})[_0x43f3('0x23')](respondWithResult(_0x2b38b9,null))[_0x43f3('0x46')](handleError(_0x2b38b9,null));};exports['addTeams']=function(_0x13e312,_0x3fe22c,_0x31bbe9){var _0x464080=_0x13e312['body'][_0x43f3('0x61')];return db['Team'][_0x43f3('0x44')]({'where':{'id':_0x464080},'attributes':['id'],'include':[{'model':db[_0x43f3('0x57')],'as':_0x43f3('0x62'),'attributes':['id','name',_0x43f3('0x63'),_0x43f3('0x64'),'interface'],'raw':!![]}]})[_0x43f3('0x23')](function(_0x234680){if(_0x234680){var _0xe3428b=_[_0x43f3('0x65')](_0x234680,function(_0xe9240f){var _0x30738a=_0xe9240f['get']({'plain':!![]});return _0x30738a[_0x43f3('0x62')];});return db[_0x43f3('0x2c')]['find']({'where':{'id':_0x13e312[_0x43f3('0x51')]['id']}})['then'](function(_0x187e8c){return db[_0x43f3('0x66')][_0x43f3('0x67')](function(_0x59dd88){return _0x187e8c[_0x43f3('0x68')](_0x464080,{'transaction':_0x59dd88})[_0x43f3('0x23')](function(){return BPromise[_0x43f3('0x69')](_0xe3428b,function(_0x4ca140){return db['UserSmsQueue'][_0x43f3('0x6a')]({'where':{'UserId':_0x4ca140['id'],'SmsQueueId':_0x13e312['params']['id']},'transaction':_0x59dd88});});})[_0x43f3('0x23')](function(){_0xe3428b[_0x43f3('0x6b')](function(_0x8f649c){socket['emit'](_0x43f3('0x6c'),{'UserId':_0x8f649c['id'],'SmsQueueId':_0x187e8c['id']});});});});});}})[_0x43f3('0x23')](respondWithStatusCode(_0x3fe22c,null))[_0x43f3('0x46')](handleError(_0x3fe22c,null));};exports['removeTeams']=function(_0x5395ee,_0x13250b,_0x3c6562){return db['Team']['findAll']({'where':{'id':_0x5395ee[_0x43f3('0x37')][_0x43f3('0x61')]},'attributes':['id'],'include':[{'model':db[_0x43f3('0x57')],'as':_0x43f3('0x62'),'attributes':['id'],'raw':!![]}]})[_0x43f3('0x23')](handleEntityNotFound(_0x13250b,null))['then'](function(_0x253248){var _0x4c359b=_[_0x43f3('0x2b')](_0x253248,'id');var _0x214526=[];var _0x354970=[];var _0x350391=squel[_0x43f3('0x6d')]();_0x350391['field']('tq.TeamId')[_0x43f3('0x6e')]('team_has_sms_queues','tq')[_0x43f3('0x6f')](_0x43f3('0x70'),'ut',_0x43f3('0x71'))[_0x43f3('0x3c')](_0x43f3('0x72'),_0x5395ee['params']['id']);for(var _0x320bf4=0x0;_0x320bf4<_0x253248[_0x43f3('0x36')];_0x320bf4+=0x1){let _0x157216=_0x253248[_0x320bf4];for(var _0x2e9ba9=0x0;_0x2e9ba9<_0x157216[_0x43f3('0x62')][_0x43f3('0x36')];_0x2e9ba9+=0x1){let _0x997167=_0x157216[_0x43f3('0x62')][_0x2e9ba9];var _0x34eb57=_0x350391['clone']();_0x34eb57['where'](_0x43f3('0x73'),_0x997167['id']);_0x354970[_0x43f3('0x74')](db[_0x43f3('0x66')][_0x43f3('0x37')](_0x34eb57[_0x43f3('0x75')](),{'type':db[_0x43f3('0x66')]['QueryTypes'][_0x43f3('0x76')]})[_0x43f3('0x23')](function(_0x34ba81){if(_0x34ba81[_0x43f3('0x36')]===0x1){return _0x997167['id'];}else{var _0x2d74e9=_[_0x43f3('0x77')](_[_0x43f3('0x2b')](_0x34ba81,'TeamId'),function(_0x5bb1fe){return _[_0x43f3('0x78')](_0x4c359b,_0x5bb1fe);});if(_0x2d74e9){return _0x997167['id'];}}}));}}return BPromise[_0x43f3('0x79')](_0x354970)[_0x43f3('0x23')](function(_0x55b4e0){_0x214526=_(_0x214526)['union'](_0x55b4e0)[_0x43f3('0x7a')]()[_0x43f3('0x7b')]();return db[_0x43f3('0x2c')][_0x43f3('0x49')]({'where':{'id':_0x5395ee[_0x43f3('0x51')]['id']}})['then'](function(_0x5cdbef){return db[_0x43f3('0x66')]['transaction'](function(_0x133155){return _0x5cdbef['removeTeams'](_0x5395ee['query']['ids'],{'transaction':_0x133155})['then'](function(){if(!_[_0x43f3('0x7c')](_0x214526)){return _0x5cdbef[_0x43f3('0x7d')](_0x214526,{'transaction':_0x133155});}})[_0x43f3('0x23')](function(){_0x214526['forEach'](function(_0x27010b){socket[_0x43f3('0x7e')](_0x43f3('0x7f'),{'UserId':_0x27010b,'SmsQueueId':_0x5cdbef['id']});});});});});});})[_0x43f3('0x23')](respondWithStatusCode(_0x13250b,null))[_0x43f3('0x46')](handleError(_0x13250b,null));};exports['addAgents']=function(_0x1dba7c,_0x1e7955,_0x3ac143){return db['SmsQueue'][_0x43f3('0x49')]({'where':{'id':_0x1dba7c['params']['id']}})[_0x43f3('0x23')](handleEntityNotFound(_0x1e7955,null))[_0x43f3('0x23')](function(_0xade949){if(_0xade949){return _0xade949[_0x43f3('0x80')](_0x1dba7c[_0x43f3('0x50')][_0x43f3('0x61')],_[_0x43f3('0x81')](_0x1dba7c['body'],['ids','id'])||{})[_0x43f3('0x82')](function(_0x1d4a67){for(var _0x4fe7ff=0x0;_0x4fe7ff<_0x1dba7c[_0x43f3('0x50')][_0x43f3('0x61')][_0x43f3('0x36')];_0x4fe7ff+=0x1){socket['emit'](_0x43f3('0x6c'),{'UserId':_0x1dba7c[_0x43f3('0x50')][_0x43f3('0x61')][_0x4fe7ff],'SmsQueueId':_0x1dba7c[_0x43f3('0x51')]['id']});}return _0x1d4a67;});}})[_0x43f3('0x23')](respondWithResult(_0x1e7955,null))[_0x43f3('0x46')](handleError(_0x1e7955,null));};exports[_0x43f3('0x7d')]=function(_0x35bd9b,_0x1bedcd,_0x4aeac1){return db['SmsQueue'][_0x43f3('0x49')]({'where':{'id':_0x35bd9b[_0x43f3('0x51')]['id']}})[_0x43f3('0x23')](handleEntityNotFound(_0x1bedcd,null))[_0x43f3('0x23')](function(_0x1a18c1){if(_0x1a18c1){return _0x1a18c1['removeAgents'](_0x35bd9b[_0x43f3('0x37')][_0x43f3('0x61')])[_0x43f3('0x23')](function(){if(_[_0x43f3('0x83')](_0x35bd9b[_0x43f3('0x37')][_0x43f3('0x61')])){for(var _0x5a8a87=0x0;_0x5a8a87<_0x35bd9b[_0x43f3('0x37')][_0x43f3('0x61')][_0x43f3('0x36')];_0x5a8a87+=0x1){socket[_0x43f3('0x7e')](_0x43f3('0x7f'),{'UserId':Number(_0x35bd9b[_0x43f3('0x37')][_0x43f3('0x61')][_0x5a8a87]),'SmsQueueId':Number(_0x35bd9b['params']['id'])});}}else{socket[_0x43f3('0x7e')](_0x43f3('0x7f'),{'UserId':Number(_0x35bd9b[_0x43f3('0x37')][_0x43f3('0x61')]),'SmsQueueId':Number(_0x35bd9b[_0x43f3('0x51')]['id'])});}});}})[_0x43f3('0x23')](respondWithStatusCode(_0x1bedcd,null))[_0x43f3('0x46')](handleError(_0x1bedcd,null));};exports['getAgents']=function(_0x266af9,_0x4576da,_0x5b4ff0){var _0x569d47={};var _0xb118e9={};var _0x1716ed;var _0x54a8a1;return db[_0x43f3('0x2c')][_0x43f3('0x54')]({'where':{'id':_0x266af9[_0x43f3('0x51')]['id']}})['then'](handleEntityNotFound(_0x4576da,null))[_0x43f3('0x23')](function(_0x5e32d5){if(_0x5e32d5){_0x1716ed=_0x5e32d5;_0xb118e9['model']=_[_0x43f3('0x31')](db[_0x43f3('0x57')][_0x43f3('0x2d')]);_0xb118e9[_0x43f3('0x37')]=_[_0x43f3('0x31')](_0x266af9['query']);_0xb118e9[_0x43f3('0x3e')]=_['intersection'](_0xb118e9['model'],_0xb118e9[_0x43f3('0x37')]);_0x569d47[_0x43f3('0x34')]=_[_0x43f3('0x32')](_0xb118e9[_0x43f3('0x33')],qs[_0x43f3('0x35')](_0x266af9[_0x43f3('0x37')][_0x43f3('0x35')]));_0x569d47[_0x43f3('0x34')]=_0x569d47['attributes'][_0x43f3('0x36')]?_0x569d47[_0x43f3('0x34')]:_0xb118e9[_0x43f3('0x33')];_0x569d47['order']=qs[_0x43f3('0x3b')](_0x266af9[_0x43f3('0x37')]['sort']);_0x569d47[_0x43f3('0x3c')]=qs[_0x43f3('0x3e')](_[_0x43f3('0x3d')](_0x266af9[_0x43f3('0x37')],_0xb118e9[_0x43f3('0x3e')]));if(_0x266af9[_0x43f3('0x37')][_0x43f3('0x3f')]){_0x569d47['where']=_[_0x43f3('0x40')](_0x569d47['where'],{'$or':_['map'](_0x569d47['attributes'],function(_0x5edd59){var _0x454f7d={};_0x454f7d[_0x5edd59]={'$like':'%'+_0x266af9[_0x43f3('0x37')][_0x43f3('0x3f')]+'%'};return _0x454f7d;})});}_0x569d47=_['merge']({},_0x569d47,_0x266af9[_0x43f3('0x42')]);return _0x1716ed['getAgents'](_0x569d47);}})['then'](function(_0x9802fc){if(_0x9802fc){_0x54a8a1=_0x9802fc[_0x43f3('0x36')];if(!_0x266af9[_0x43f3('0x37')][_0x43f3('0x38')](_0x43f3('0x39'))){_0x569d47[_0x43f3('0x1e')]=qs[_0x43f3('0x1e')](_0x266af9[_0x43f3('0x37')][_0x43f3('0x1e')]);_0x569d47[_0x43f3('0x1d')]=qs[_0x43f3('0x1d')](_0x266af9[_0x43f3('0x37')][_0x43f3('0x1d')]);}return _0x1716ed[_0x43f3('0x84')](_0x569d47);}})[_0x43f3('0x23')](function(_0x1a821c){if(_0x1a821c){return _0x1a821c?{'count':_0x54a8a1,'rows':_0x1a821c}:null;}})[_0x43f3('0x23')](respondWithResult(_0x4576da,null))[_0x43f3('0x46')](handleError(_0x4576da,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5f680f2..ab1edf8 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 _0xe801=['remove','emit','exports','events','../../mysqldb','update'];(function(_0x1b3dc1,_0x40f345){var _0x269a37=function(_0x1ee5dc){while(--_0x1ee5dc){_0x1b3dc1['push'](_0x1b3dc1['shift']());}};_0x269a37(++_0x40f345);}(_0xe801,0x123));var _0x1e80=function(_0x3ccd30,_0x38dca1){_0x3ccd30=_0x3ccd30-0x0;var _0x9e8314=_0xe801[_0x3ccd30];return _0x9e8314;};'use strict';var EventEmitter=require(_0x1e80('0x0'));var SmsQueue=require(_0x1e80('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e80('0x2'),'afterDestroy':_0x1e80('0x3')};function emitEvent(_0x380456){return function(_0x3f2bb9,_0xa30351,_0x3ced04){SmsQueueEvents[_0x1e80('0x4')](_0x380456+':'+_0x3f2bb9['id'],_0x3f2bb9);SmsQueueEvents[_0x1e80('0x4')](_0x380456,_0x3f2bb9);_0x3ced04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1e80('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0x5812=['remove','emit','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5812,0x1bd));var _0x2581=function(_0x2abe9d,_0x4a8c6e){_0x2abe9d=_0x2abe9d-0x0;var _0x135213=_0x5812[_0x2abe9d];return _0x135213;};'use strict';var EventEmitter=require(_0x2581('0x0'));var SmsQueue=require(_0x2581('0x1'))['db'][_0x2581('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2581('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2581('0x4'),'afterDestroy':_0x2581('0x5')};function emitEvent(_0x5e53d2){return function(_0x34368a,_0x3cf607,_0x47bb5a){SmsQueueEvents['emit'](_0x5e53d2+':'+_0x34368a['id'],_0x34368a);SmsQueueEvents[_0x2581('0x6')](_0x5e53d2,_0x34368a);_0x47bb5a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x2581('0x7')](e,emitEvent(event));}}module[_0x2581('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0e7a0c3..d28ed19 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 _0xdbcc=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x14950d,_0x274bfc){var _0x4190ba=function(_0x368ac0){while(--_0x368ac0){_0x14950d['push'](_0x14950d['shift']());}};_0x4190ba(++_0x274bfc);}(_0xdbcc,0x13d));var _0xcdbc=function(_0x29726b,_0x4a766d){_0x29726b=_0x29726b-0x0;var _0x362731=_0xdbcc[_0x29726b];return _0x362731;};'use strict';var _=require(_0xcdbc('0x0'));var util=require(_0xcdbc('0x1'));var logger=require(_0xcdbc('0x2'))(_0xcdbc('0x3'));var moment=require(_0xcdbc('0x4'));var BPromise=require(_0xcdbc('0x5'));var rp=require(_0xcdbc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdbc('0x7'));var config=require('../../config/environment');var attributes=require(_0xcdbc('0x8'));module[_0xcdbc('0x9')]=function(_0x344b8d,_0x309269){return _0x344b8d[_0xcdbc('0xa')](_0xcdbc('0xb'),attributes,{'tableName':_0xcdbc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6943=['sms_queues','lodash','../../config/logger','api','moment','request-promise','rimraf','define','SmsQueue'];(function(_0x392a7b,_0x564932){var _0x1d866f=function(_0x504042){while(--_0x504042){_0x392a7b['push'](_0x392a7b['shift']());}};_0x1d866f(++_0x564932);}(_0x6943,0x88));var _0x3694=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x6943[_0x273c39];return _0x46d6b5;};'use strict';var _=require(_0x3694('0x0'));var util=require('util');var logger=require(_0x3694('0x1'))(_0x3694('0x2'));var moment=require(_0x3694('0x3'));var BPromise=require('bluebird');var rp=require(_0x3694('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3694('0x5'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module['exports']=function(_0x16682e,_0xfdafc){return _0x16682e[_0x3694('0x6')](_0x3694('0x7'),attributes,{'tableName':_0x3694('0x8'),'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 7ff2f4d..8f1aa59 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 _0x4924=['SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','debug'];(function(_0x984e97,_0x2c72e7){var _0x3630e5=function(_0x3ef0c9){while(--_0x3ef0c9){_0x984e97['push'](_0x984e97['shift']());}};_0x3630e5(++_0x2c72e7);}(_0x4924,0x18f));var _0x4492=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x4924[_0x3b56c0];return _0x377efe;};'use strict';var _=require(_0x4492('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4492('0x1'));var rs=require(_0x4492('0x2'));var fs=require('fs');var Redis=require(_0x4492('0x3'));var db=require(_0x4492('0x4'))['db'];var utils=require(_0x4492('0x5'));var logger=require(_0x4492('0x6'))(_0x4492('0x7'));var config=require('../../config/environment');var jayson=require(_0x4492('0x8'));var client=jayson[_0x4492('0x9')][_0x4492('0xa')]({'port':0x232a});config['redis']=_[_0x4492('0xb')](config[_0x4492('0xc')],{'host':_0x4492('0xd'),'port':0x18eb});var socket=require(_0x4492('0xe'))(new Redis(config['redis']));require(_0x4492('0xf'))['register'](socket);function respondWithRpcPromise(_0x2e6a61,_0x311f4d,_0x621ba8){return new BPromise(function(_0x23bc1b,_0x27c736){return client[_0x4492('0x10')](_0x2e6a61,_0x621ba8)[_0x4492('0x11')](function(_0x270f15){logger[_0x4492('0x12')](_0x4492('0x13'),_0x311f4d,'request\x20sent');logger[_0x4492('0x14')](_0x4492('0x15'),_0x311f4d,_0x4492('0x16'),JSON[_0x4492('0x17')](_0x270f15));if(_0x270f15[_0x4492('0x18')]){if(_0x270f15[_0x4492('0x18')][_0x4492('0x19')]===0x1f4){logger[_0x4492('0x18')](_0x4492('0x13'),_0x311f4d,_0x270f15[_0x4492('0x18')]['message']);return _0x27c736(_0x270f15[_0x4492('0x18')][_0x4492('0x1a')]);}logger[_0x4492('0x18')](_0x4492('0x13'),_0x311f4d,_0x270f15[_0x4492('0x18')]['message']);return _0x23bc1b(_0x270f15[_0x4492('0x18')][_0x4492('0x1a')]);}else{logger[_0x4492('0x12')](_0x4492('0x13'),_0x311f4d,'request\x20sent');_0x23bc1b(_0x270f15[_0x4492('0x1b')]['message']);}})[_0x4492('0x1c')](function(_0x4c0846){logger[_0x4492('0x18')](_0x4492('0x13'),_0x311f4d,_0x4c0846);_0x27c736(_0x4c0846);});});}exports[_0x4492('0x1d')]=function(_0x25ab76){var _0x2c2d5a=this;return new Promise(function(_0x1fbaeb,_0x1e14f5){return db[_0x4492('0x1e')][_0x4492('0x1f')]({'raw':_0x25ab76[_0x4492('0x20')]?_0x25ab76[_0x4492('0x20')][_0x4492('0x21')]===undefined?!![]:![]:!![],'where':_0x25ab76[_0x4492('0x20')]?_0x25ab76[_0x4492('0x20')][_0x4492('0x22')]||null:null,'attributes':_0x25ab76[_0x4492('0x20')]?_0x25ab76[_0x4492('0x20')][_0x4492('0x23')]||null:null,'limit':_0x25ab76['options']?_0x25ab76[_0x4492('0x20')][_0x4492('0x24')]||null:null,'include':_0x25ab76[_0x4492('0x20')]?_0x25ab76[_0x4492('0x20')][_0x4492('0x25')]?_[_0x4492('0x26')](_0x25ab76[_0x4492('0x20')][_0x4492('0x25')],function(_0x435252){return{'model':db[_0x435252['model']],'as':_0x435252['as'],'attributes':_0x435252[_0x4492('0x23')],'include':_0x435252['include']?_[_0x4492('0x26')](_0x435252[_0x4492('0x25')],function(_0x2f37e8){return{'model':db[_0x2f37e8[_0x4492('0x27')]],'as':_0x2f37e8['as'],'attributes':_0x2f37e8[_0x4492('0x23')],'include':_0x2f37e8['include']?_[_0x4492('0x26')](_0x2f37e8[_0x4492('0x25')],function(_0x586489){return{'model':db[_0x586489[_0x4492('0x27')]],'as':_0x586489['as'],'attributes':_0x586489[_0x4492('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4492('0x11')](function(_0x3410a1){logger[_0x4492('0x12')]('GetSmsQueue',_0x25ab76);logger[_0x4492('0x14')]('GetSmsQueue',_0x25ab76,JSON[_0x4492('0x17')](_0x3410a1));_0x1fbaeb(_0x3410a1);})[_0x4492('0x1c')](function(_0x21b4cf){logger[_0x4492('0x18')](_0x4492('0x1d'),_0x21b4cf[_0x4492('0x1a')],_0x25ab76);_0x1e14f5(_0x2c2d5a['error'](0x1f4,_0x21b4cf[_0x4492('0x1a')]));});});};exports[_0x4492('0x28')]=function(_0x2b0157){var _0x1f1876=this;return new Promise(function(_0x5ea03a,_0x59c7f7){return db[_0x4492('0x1e')][_0x4492('0x29')]({'raw':_0x2b0157['options']?_0x2b0157[_0x4492('0x20')][_0x4492('0x21')]===undefined?!![]:![]:!![],'where':_0x2b0157[_0x4492('0x20')]?_0x2b0157[_0x4492('0x20')][_0x4492('0x22')]||null:null,'attributes':_0x2b0157[_0x4492('0x20')]?_0x2b0157[_0x4492('0x20')]['attributes']||null:null,'include':_0x2b0157[_0x4492('0x20')]?_0x2b0157['options']['include']?_['map'](_0x2b0157[_0x4492('0x20')][_0x4492('0x25')],function(_0x3c1581){return{'model':db[_0x3c1581[_0x4492('0x27')]],'as':_0x3c1581['as'],'attributes':_0x3c1581[_0x4492('0x23')],'include':_0x3c1581['include']?_['map'](_0x3c1581[_0x4492('0x25')],function(_0x541301){return{'model':db[_0x541301[_0x4492('0x27')]],'as':_0x541301['as'],'attributes':_0x541301['attributes'],'include':_0x541301['include']?_[_0x4492('0x26')](_0x541301[_0x4492('0x25')],function(_0x539f29){return{'model':db[_0x539f29[_0x4492('0x27')]],'as':_0x539f29['as'],'attributes':_0x539f29[_0x4492('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4492('0x11')](function(_0x2e2615){logger[_0x4492('0x12')](_0x4492('0x28'),_0x2b0157);logger[_0x4492('0x14')](_0x4492('0x28'),_0x2b0157,JSON['stringify'](_0x2e2615));_0x5ea03a(_0x2e2615);})[_0x4492('0x1c')](function(_0x4a68af){logger[_0x4492('0x18')]('ShowSmsQueue',_0x4a68af[_0x4492('0x1a')],_0x2b0157);_0x59c7f7(_0x1f1876[_0x4492('0x18')](0x1f4,_0x4a68af[_0x4492('0x1a')]));});});}; \ No newline at end of file +var _0x20ae=['where','include','map','model','attributes','GetSmsQueue','ShowSmsQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','SmsQueue','findAll','options'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x20ae,0x168));var _0xe20a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x20ae[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0xe20a('0x0'));var moment=require(_0xe20a('0x1'));var BPromise=require('bluebird');var rs=require(_0xe20a('0x2'));var fs=require('fs');var Redis=require(_0xe20a('0x3'));var db=require(_0xe20a('0x4'))['db'];var utils=require(_0xe20a('0x5'));var logger=require(_0xe20a('0x6'))('rpc');var config=require(_0xe20a('0x7'));var jayson=require(_0xe20a('0x8'));var client=jayson[_0xe20a('0x9')][_0xe20a('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe20a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe20a('0xc'))(new Redis(config['redis']));require(_0xe20a('0xd'))['register'](socket);function respondWithRpcPromise(_0x4f7c4a,_0x5403cf,_0xd23266){return new BPromise(function(_0x117c07,_0x9f7c43){return client[_0xe20a('0xe')](_0x4f7c4a,_0xd23266)[_0xe20a('0xf')](function(_0x2a5c3f){logger[_0xe20a('0x10')]('SmsQueue,\x20%s,\x20%s',_0x5403cf,'request\x20sent');logger[_0xe20a('0x11')](_0xe20a('0x12'),_0x5403cf,'request\x20sent',JSON[_0xe20a('0x13')](_0x2a5c3f));if(_0x2a5c3f[_0xe20a('0x14')]){if(_0x2a5c3f[_0xe20a('0x14')][_0xe20a('0x15')]===0x1f4){logger[_0xe20a('0x14')](_0xe20a('0x16'),_0x5403cf,_0x2a5c3f['error']['message']);return _0x9f7c43(_0x2a5c3f[_0xe20a('0x14')][_0xe20a('0x17')]);}logger[_0xe20a('0x14')]('SmsQueue,\x20%s,\x20%s',_0x5403cf,_0x2a5c3f[_0xe20a('0x14')][_0xe20a('0x17')]);return _0x117c07(_0x2a5c3f[_0xe20a('0x14')]['message']);}else{logger['info'](_0xe20a('0x16'),_0x5403cf,_0xe20a('0x18'));_0x117c07(_0x2a5c3f[_0xe20a('0x19')][_0xe20a('0x17')]);}})[_0xe20a('0x1a')](function(_0x28dd39){logger['error'](_0xe20a('0x16'),_0x5403cf,_0x28dd39);_0x9f7c43(_0x28dd39);});});}exports['GetSmsQueue']=function(_0x212b09){var _0xa42f4=this;return new Promise(function(_0x3c3eea,_0x184eb1){return db[_0xe20a('0x1b')][_0xe20a('0x1c')]({'raw':_0x212b09[_0xe20a('0x1d')]?_0x212b09[_0xe20a('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x212b09[_0xe20a('0x1d')]?_0x212b09[_0xe20a('0x1d')][_0xe20a('0x1e')]||null:null,'attributes':_0x212b09[_0xe20a('0x1d')]?_0x212b09[_0xe20a('0x1d')]['attributes']||null:null,'limit':_0x212b09[_0xe20a('0x1d')]?_0x212b09[_0xe20a('0x1d')]['limit']||null:null,'include':_0x212b09[_0xe20a('0x1d')]?_0x212b09[_0xe20a('0x1d')][_0xe20a('0x1f')]?_[_0xe20a('0x20')](_0x212b09['options'][_0xe20a('0x1f')],function(_0x17a341){return{'model':db[_0x17a341[_0xe20a('0x21')]],'as':_0x17a341['as'],'attributes':_0x17a341[_0xe20a('0x22')],'include':_0x17a341['include']?_[_0xe20a('0x20')](_0x17a341['include'],function(_0x2448f4){return{'model':db[_0x2448f4['model']],'as':_0x2448f4['as'],'attributes':_0x2448f4[_0xe20a('0x22')],'include':_0x2448f4[_0xe20a('0x1f')]?_['map'](_0x2448f4[_0xe20a('0x1f')],function(_0x577673){return{'model':db[_0x577673[_0xe20a('0x21')]],'as':_0x577673['as'],'attributes':_0x577673[_0xe20a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe20a('0xf')](function(_0x48a039){logger[_0xe20a('0x10')](_0xe20a('0x23'),_0x212b09);logger[_0xe20a('0x11')](_0xe20a('0x23'),_0x212b09,JSON[_0xe20a('0x13')](_0x48a039));_0x3c3eea(_0x48a039);})[_0xe20a('0x1a')](function(_0x108ed7){logger[_0xe20a('0x14')]('GetSmsQueue',_0x108ed7[_0xe20a('0x17')],_0x212b09);_0x184eb1(_0xa42f4['error'](0x1f4,_0x108ed7['message']));});});};exports[_0xe20a('0x24')]=function(_0x2e3fdf){var _0x83dcee=this;return new Promise(function(_0x399eaa,_0x42e9ca){return db[_0xe20a('0x1b')][_0xe20a('0x25')]({'raw':_0x2e3fdf[_0xe20a('0x1d')]?_0x2e3fdf[_0xe20a('0x1d')][_0xe20a('0x26')]===undefined?!![]:![]:!![],'where':_0x2e3fdf[_0xe20a('0x1d')]?_0x2e3fdf[_0xe20a('0x1d')][_0xe20a('0x1e')]||null:null,'attributes':_0x2e3fdf[_0xe20a('0x1d')]?_0x2e3fdf['options'][_0xe20a('0x22')]||null:null,'include':_0x2e3fdf[_0xe20a('0x1d')]?_0x2e3fdf[_0xe20a('0x1d')]['include']?_[_0xe20a('0x20')](_0x2e3fdf[_0xe20a('0x1d')][_0xe20a('0x1f')],function(_0x289143){return{'model':db[_0x289143[_0xe20a('0x21')]],'as':_0x289143['as'],'attributes':_0x289143[_0xe20a('0x22')],'include':_0x289143[_0xe20a('0x1f')]?_[_0xe20a('0x20')](_0x289143['include'],function(_0x393624){return{'model':db[_0x393624[_0xe20a('0x21')]],'as':_0x393624['as'],'attributes':_0x393624[_0xe20a('0x22')],'include':_0x393624['include']?_['map'](_0x393624[_0xe20a('0x1f')],function(_0x1bdec3){return{'model':db[_0x1bdec3[_0xe20a('0x21')]],'as':_0x1bdec3['as'],'attributes':_0x1bdec3['attributes']};}):[]};}):[]};}):[]:[]})[_0xe20a('0xf')](function(_0x21f748){logger['info']('ShowSmsQueue',_0x2e3fdf);logger[_0xe20a('0x11')](_0xe20a('0x24'),_0x2e3fdf,JSON[_0xe20a('0x13')](_0x21f748));_0x399eaa(_0x21f748);})[_0xe20a('0x1a')](function(_0x3840a9){logger['error'](_0xe20a('0x24'),_0x3840a9[_0xe20a('0x17')],_0x2e3fdf);_0x42e9ca(_0x83dcee['error'](0x1f4,_0x3840a9[_0xe20a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 67bcf90..37a491c 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 _0xf174=['removeListener','register','length','smsQueue:','save','update','emit'];(function(_0x3611a6,_0x2a4a68){var _0x3ddfb1=function(_0x1e64c3){while(--_0x1e64c3){_0x3611a6['push'](_0x3611a6['shift']());}};_0x3ddfb1(++_0x2a4a68);}(_0xf174,0x146));var _0x4f17=function(_0x35d0b0,_0x142d86){_0x35d0b0=_0x35d0b0-0x0;var _0x572df6=_0xf174[_0x35d0b0];return _0x572df6;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x4f17('0x0'),'remove',_0x4f17('0x1')];function createListener(_0x1143e7,_0x3c836d){return function(_0x2cb44f){_0x3c836d[_0x4f17('0x2')](_0x1143e7,_0x2cb44f);};}function removeListener(_0x137205,_0x46971a){return function(){SmsQueueEvents[_0x4f17('0x3')](_0x137205,_0x46971a);};}exports[_0x4f17('0x4')]=function(_0x56fc78){for(var _0x2d5c8e=0x0,_0x2f93e7=events[_0x4f17('0x5')];_0x2d5c8e<_0x2f93e7;_0x2d5c8e++){var _0x5d391f=events[_0x2d5c8e];var _0x304646=createListener(_0x4f17('0x6')+_0x5d391f,_0x56fc78);SmsQueueEvents['on'](_0x5d391f,_0x304646);}}; \ No newline at end of file +var _0x0b6e=['smsQueue:','remove','emit','register','length'];(function(_0x1a8c37,_0x1693f6){var _0x5c05a4=function(_0x44e6da){while(--_0x44e6da){_0x1a8c37['push'](_0x1a8c37['shift']());}};_0x5c05a4(++_0x1693f6);}(_0x0b6e,0x97));var _0xe0b6=function(_0x142beb,_0x552967){_0x142beb=_0x142beb-0x0;var _0x5136e7=_0x0b6e[_0x142beb];return _0x5136e7;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xe0b6('0x0'),'update'];function createListener(_0x1a868c,_0x3b3e51){return function(_0x4bc604){_0x3b3e51[_0xe0b6('0x1')](_0x1a868c,_0x4bc604);};}function removeListener(_0x205bc4,_0x54615d){return function(){SmsQueueEvents['removeListener'](_0x205bc4,_0x54615d);};}exports[_0xe0b6('0x2')]=function(_0x253f31){for(var _0x229f23=0x0,_0x309f95=events[_0xe0b6('0x3')];_0x229f23<_0x309f95;_0x229f23++){var _0x442ea5=events[_0x229f23];var _0xd7b5d5=createListener(_0xe0b6('0x4')+_0x442ea5,_0x253f31);SmsQueueEvents['on'](_0x442ea5,_0xd7b5d5);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index c852372..775ee66 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 _0x3352=['isAuthenticated','index','get','/describe','describe','show','post','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','./smsQueueReport.controller'];(function(_0x4ff121,_0x3ade9c){var _0x2987cf=function(_0x3487db){while(--_0x3487db){_0x4ff121['push'](_0x4ff121['shift']());}};_0x2987cf(++_0x3ade9c);}(_0x3352,0x185));var _0x2335=function(_0x4de94d,_0xdd6680){_0x4de94d=_0x4de94d-0x0;var _0x5a74f5=_0x3352[_0x4de94d];return _0x5a74f5;};'use strict';var multer=require(_0x2335('0x0'));var util=require(_0x2335('0x1'));var path=require('path');var timeout=require(_0x2335('0x2'));var express=require(_0x2335('0x3'));var router=express[_0x2335('0x4')]();var auth=require(_0x2335('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2335('0x6'));router['get']('/',auth[_0x2335('0x7')](),controller[_0x2335('0x8')]);router[_0x2335('0x9')](_0x2335('0xa'),auth['isAuthenticated'](),controller[_0x2335('0xb')]);router[_0x2335('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2335('0xc')]);router[_0x2335('0xd')]('/',auth[_0x2335('0x7')](),controller['create']);router['put'](_0x2335('0xe'),auth[_0x2335('0x7')](),controller[_0x2335('0xf')]);router[_0x2335('0x10')](_0x2335('0xe'),auth[_0x2335('0x7')](),controller[_0x2335('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9a06=['/describe','describe','/:id','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','get','isAuthenticated'];(function(_0xb28123,_0x4adf7c){var _0xd4e5f0=function(_0x11bf8e){while(--_0x11bf8e){_0xb28123['push'](_0xb28123['shift']());}};_0xd4e5f0(++_0x4adf7c);}(_0x9a06,0x168));var _0x69a0=function(_0x6f8f66,_0x28921c){_0x6f8f66=_0x6f8f66-0x0;var _0x49a64b=_0x9a06[_0x6f8f66];return _0x49a64b;};'use strict';var multer=require(_0x69a0('0x0'));var util=require(_0x69a0('0x1'));var path=require(_0x69a0('0x2'));var timeout=require('connect-timeout');var express=require(_0x69a0('0x3'));var router=express[_0x69a0('0x4')]();var auth=require(_0x69a0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x69a0('0x6')]('/',auth[_0x69a0('0x7')](),controller['index']);router[_0x69a0('0x6')](_0x69a0('0x8'),auth['isAuthenticated'](),controller[_0x69a0('0x9')]);router[_0x69a0('0x6')](_0x69a0('0xa'),auth[_0x69a0('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x69a0('0xb')]);router['put'](_0x69a0('0xa'),auth[_0x69a0('0x7')](),controller[_0x69a0('0xc')]);router[_0x69a0('0xd')](_0x69a0('0xa'),auth[_0x69a0('0x7')](),controller[_0x69a0('0xe')]);module[_0x69a0('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c3a2ee8..19552d7 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 _0x7497=['STRING','DATE','moment','sequelize','exports'];(function(_0x49070f,_0x3e7591){var _0xf9261b=function(_0x16178e){while(--_0x16178e){_0x49070f['push'](_0x49070f['shift']());}};_0xf9261b(++_0x3e7591);}(_0x7497,0xa7));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7749('0x0'));var Sequelize=require(_0x7749('0x1'));module[_0x7749('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7749('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7749('0x4')]},'acceptAt':{'type':Sequelize[_0x7749('0x4')]},'exitAt':{'type':Sequelize[_0x7749('0x4')]},'reason':{'type':Sequelize[_0x7749('0x3')]}}; \ No newline at end of file +var _0x8399=['moment','sequelize','exports','STRING','DATE'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x8399,0xf5));var _0x9839=function(_0x4bcec2,_0x4607f8){_0x4bcec2=_0x4bcec2-0x0;var _0x2a4df6=_0x8399[_0x4bcec2];return _0x2a4df6;};'use strict';var moment=require(_0x9839('0x0'));var Sequelize=require(_0x9839('0x1'));module[_0x9839('0x2')]={'uniqueid':{'type':Sequelize[_0x9839('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9839('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9839('0x4')]},'acceptAt':{'type':Sequelize[_0x9839('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9839('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f770d3f..e0a0ea2 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 _0xe14b=['findAll','rows','catch','find','create','body','params','destroy','describe','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','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','error','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x50339f,_0x218105){var _0x50edb5=function(_0x52950d){while(--_0x52950d){_0x50339f['push'](_0x50339f['shift']());}};_0x50edb5(++_0x218105);}(_0xe14b,0x93));var _0xbe14=function(_0x1acaf1,_0xa876ee){_0x1acaf1=_0x1acaf1-0x0;var _0x21d809=_0xe14b[_0x1acaf1];return _0x21d809;};'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 db=require(_0xbe14('0x14'))['db'];function respondWithStatusCode(_0x3d38c2,_0x27792f){_0x27792f=_0x27792f||0xcc;return function(_0x3b898d){if(_0x3b898d){return _0x3d38c2[_0xbe14('0x15')](_0x27792f);}return _0x3d38c2[_0xbe14('0x16')](_0x27792f)[_0xbe14('0x17')]();};}function respondWithResult(_0xa2cf72,_0x1e4826){_0x1e4826=_0x1e4826||0xc8;return function(_0x33fd54){if(_0x33fd54){return _0xa2cf72[_0xbe14('0x16')](_0x1e4826)['json'](_0x33fd54);}};}function respondWithFilteredResult(_0x55b3a7,_0x3f58f5){return function(_0x3dc4a9){if(_0x3dc4a9){var _0xf4ac9=_0x3dc4a9[_0xbe14('0x18')],_0x37ce4e=_0x3f58f5[_0xbe14('0x19')],_0x4e8f34=_0x3f58f5[_0xbe14('0x19')]+_0x3f58f5[_0xbe14('0x1a')],_0x21c789;if(_0x4e8f34>=_0xf4ac9){_0x4e8f34=_0xf4ac9;_0x21c789=0xc8;}else{_0x21c789=0xce;}_0x55b3a7[_0xbe14('0x16')](_0x21c789);return _0x55b3a7[_0xbe14('0x1b')]('Content-Range',_0x37ce4e+'-'+_0x4e8f34+'/'+_0xf4ac9)[_0xbe14('0x1c')](_0x3dc4a9);}return null;};}function patchUpdates(_0x456ca8){return function(_0x329588){try{jsonpatch[_0xbe14('0x1d')](_0x329588,_0x456ca8,!![]);}catch(_0x3249da){return BPromise[_0xbe14('0x1e')](_0x3249da);}return _0x329588['save']();};}function saveUpdates(_0x24f820,_0x4a1bbd){return function(_0x417c8d){if(_0x417c8d){return _0x417c8d[_0xbe14('0x1f')](_0x24f820)[_0xbe14('0x20')](function(_0x51dc0b){return _0x51dc0b;});}return null;};}function removeEntity(_0xe60f42,_0x56d845){return function(_0x3c1c85){if(_0x3c1c85){return _0x3c1c85['destroy']()[_0xbe14('0x20')](function(){_0xe60f42['status'](0xcc)[_0xbe14('0x17')]();});}};}function handleEntityNotFound(_0x3d3608,_0x505dbd){return function(_0x2da350){if(!_0x2da350){_0x3d3608['sendStatus'](0x194);}return _0x2da350;};}function handleError(_0x4587a8,_0x4851f8){_0x4851f8=_0x4851f8||0x1f4;return function(_0x36a21e){logger[_0xbe14('0x21')](_0x36a21e[_0xbe14('0x22')]);if(_0x36a21e[_0xbe14('0x23')]){delete _0x36a21e[_0xbe14('0x23')];}_0x4587a8[_0xbe14('0x16')](_0x4851f8)['send'](_0x36a21e);};}exports[_0xbe14('0x24')]=function(_0x1ba46a,_0x391556){var _0x169369={},_0x5dd475={},_0x16f884={'count':0x0,'rows':[]};var _0x29fc64=_['map'](db[_0xbe14('0x25')][_0xbe14('0x26')],function(_0x1c7cc7){return{'name':_0x1c7cc7[_0xbe14('0x27')],'type':_0x1c7cc7[_0xbe14('0x28')][_0xbe14('0x29')]};});_0x5dd475[_0xbe14('0x2a')]=_[_0xbe14('0x2b')](_0x29fc64,_0xbe14('0x23'));_0x5dd475[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](_0x1ba46a[_0xbe14('0x2c')]);_0x5dd475[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],_0x5dd475[_0xbe14('0x2c')]);_0x169369[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x5dd475[_0xbe14('0x2a')],qs[_0xbe14('0x31')](_0x1ba46a['query'][_0xbe14('0x31')]));_0x169369['attributes']=_0x169369['attributes'][_0xbe14('0x32')]?_0x169369['attributes']:_0x5dd475[_0xbe14('0x2a')];if(!_0x1ba46a[_0xbe14('0x2c')]['hasOwnProperty']('nolimit')){_0x169369['limit']=qs[_0xbe14('0x1a')](_0x1ba46a[_0xbe14('0x2c')]['limit']);_0x169369[_0xbe14('0x19')]=qs[_0xbe14('0x19')](_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x19')]);}_0x169369[_0xbe14('0x33')]=qs['sort'](_0x1ba46a['query'][_0xbe14('0x34')]);_0x169369['where']=qs['filters'](_['pick'](_0x1ba46a[_0xbe14('0x2c')],_0x5dd475[_0xbe14('0x2e')]),_0x29fc64);if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x35')]){_0x169369[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x169369[_0xbe14('0x36')],{'$or':_[_0xbe14('0x2b')](_0x29fc64,function(_0x2d9c12){if(_0x2d9c12[_0xbe14('0x28')]!==_0xbe14('0x38')){var _0x32c59d={};_0x32c59d[_0x2d9c12['name']]={'$like':'%'+_0x1ba46a['query'][_0xbe14('0x35')]+'%'};return _0x32c59d;}})});}_0x169369=_[_0xbe14('0x37')]({},_0x169369,_0x1ba46a[_0xbe14('0x39')]);var _0x520e09={'where':_0x169369[_0xbe14('0x36')]};return db[_0xbe14('0x25')][_0xbe14('0x18')](_0x520e09)[_0xbe14('0x20')](function(_0x3bd454){_0x16f884[_0xbe14('0x18')]=_0x3bd454;if(_0x1ba46a[_0xbe14('0x2c')][_0xbe14('0x3a')]){_0x169369[_0xbe14('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xbe14('0x3c')](_0x169369);})[_0xbe14('0x20')](function(_0x3463c4){_0x16f884[_0xbe14('0x3d')]=_0x3463c4;return _0x16f884;})[_0xbe14('0x20')](respondWithFilteredResult(_0x391556,_0x169369))[_0xbe14('0x3e')](handleError(_0x391556,null));};exports['show']=function(_0xb0f143,_0x1974a4){var _0x1220c9={'raw':!![],'where':{'id':_0xb0f143['params']['id']}},_0x36263c={};_0x36263c['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x25')][_0xbe14('0x26')]);_0x36263c['query']=_['keys'](_0xb0f143[_0xbe14('0x2c')]);_0x36263c['filters']=_['intersection'](_0x36263c[_0xbe14('0x2a')],_0x36263c[_0xbe14('0x2c')]);_0x1220c9[_0xbe14('0x30')]=_['intersection'](_0x36263c['model'],qs['fields'](_0xb0f143[_0xbe14('0x2c')][_0xbe14('0x31')]));_0x1220c9[_0xbe14('0x30')]=_0x1220c9['attributes'][_0xbe14('0x32')]?_0x1220c9[_0xbe14('0x30')]:_0x36263c[_0xbe14('0x2a')];if(_0xb0f143[_0xbe14('0x2c')]['includeAll']){_0x1220c9['include']=[{'all':!![]}];}_0x1220c9=_[_0xbe14('0x37')]({},_0x1220c9,_0xb0f143[_0xbe14('0x39')]);return db[_0xbe14('0x25')][_0xbe14('0x3f')](_0x1220c9)[_0xbe14('0x20')](handleEntityNotFound(_0x1974a4,null))['then'](respondWithResult(_0x1974a4,null))['catch'](handleError(_0x1974a4,null));};exports[_0xbe14('0x40')]=function(_0x2a3623,_0x238c60){return db[_0xbe14('0x25')]['create'](_0x2a3623[_0xbe14('0x41')],{})[_0xbe14('0x20')](respondWithResult(_0x238c60,0xc9))['catch'](handleError(_0x238c60,null));};exports[_0xbe14('0x1f')]=function(_0x2a35e5,_0x2d6ee8){if(_0x2a35e5[_0xbe14('0x41')]['id']){delete _0x2a35e5['body']['id'];}return db['SmsQueueReport'][_0xbe14('0x3f')]({'where':{'id':_0x2a35e5[_0xbe14('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d6ee8,null))['then'](saveUpdates(_0x2a35e5[_0xbe14('0x41')],null))[_0xbe14('0x20')](respondWithResult(_0x2d6ee8,null))[_0xbe14('0x3e')](handleError(_0x2d6ee8,null));};exports[_0xbe14('0x43')]=function(_0xdbc6e1,_0xd04fd5){return db[_0xbe14('0x25')]['find']({'where':{'id':_0xdbc6e1[_0xbe14('0x42')]['id']}})[_0xbe14('0x20')](handleEntityNotFound(_0xd04fd5,null))[_0xbe14('0x20')](removeEntity(_0xd04fd5,null))[_0xbe14('0x3e')](handleError(_0xd04fd5,null));};exports[_0xbe14('0x44')]=function(_0x494c32,_0x3a221b){return db[_0xbe14('0x25')][_0xbe14('0x44')]()[_0xbe14('0x20')](respondWithResult(_0x3a221b,null))[_0xbe14('0x3e')](handleError(_0x3a221b,null));}; \ No newline at end of file +var _0x9957=['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','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x9f47cf,_0x2da62c){var _0xe0f94c=function(_0x1a4f2e){while(--_0x1a4f2e){_0x9f47cf['push'](_0x9f47cf['shift']());}};_0xe0f94c(++_0x2da62c);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e5ca303..40ce049 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 _0x3738=['exports','define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes'];(function(_0x4144ef,_0x3ed22b){var _0x3691ba=function(_0x33b2df){while(--_0x33b2df){_0x4144ef['push'](_0x4144ef['shift']());}};_0x3691ba(++_0x3ed22b);}(_0x3738,0x1e5));var _0x8373=function(_0x1d895d,_0x3e5c93){_0x1d895d=_0x1d895d-0x0;var _0x2dae23=_0x3738[_0x1d895d];return _0x2dae23;};'use strict';var _=require('lodash');var util=require(_0x8373('0x0'));var logger=require(_0x8373('0x1'))(_0x8373('0x2'));var moment=require(_0x8373('0x3'));var BPromise=require(_0x8373('0x4'));var rp=require(_0x8373('0x5'));var fs=require('fs');var path=require(_0x8373('0x6'));var rimraf=require(_0x8373('0x7'));var config=require(_0x8373('0x8'));var attributes=require(_0x8373('0x9'));module[_0x8373('0xa')]=function(_0x22fdf0,_0x5f3c70){return _0x22fdf0[_0x8373('0xb')](_0x8373('0xc'),attributes,{'tableName':_0x8373('0xd'),'paranoid':![],'indexes':[{'name':_0x8373('0xe'),'fields':[_0x8373('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe53b=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','uniqueid'];(function(_0x45625f,_0x525c9e){var _0x17e8b2=function(_0x4678b5){while(--_0x4678b5){_0x45625f['push'](_0x45625f['shift']());}};_0x17e8b2(++_0x525c9e);}(_0xe53b,0x1a4));var _0xbe53=function(_0x4e9184,_0x3bf67b){_0x4e9184=_0x4e9184-0x0;var _0x551829=_0xe53b[_0x4e9184];return _0x551829;};'use strict';var _=require(_0xbe53('0x0'));var util=require(_0xbe53('0x1'));var logger=require(_0xbe53('0x2'))(_0xbe53('0x3'));var moment=require(_0xbe53('0x4'));var BPromise=require(_0xbe53('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe53('0x6'));var rimraf=require(_0xbe53('0x7'));var config=require(_0xbe53('0x8'));var attributes=require(_0xbe53('0x9'));module[_0xbe53('0xa')]=function(_0x58a5c4,_0x9bc4ca){return _0x58a5c4[_0xbe53('0xb')](_0xbe53('0xc'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0xbe53('0xd'),'fields':[_0xbe53('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index aa06815..a15172b 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 _0x4be2=['jayson/promise','request','then','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','body','options','raw','info','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x49c6c4,_0x401fdf){var _0x400c2e=function(_0x127a83){while(--_0x127a83){_0x49c6c4['push'](_0x49c6c4['shift']());}};_0x400c2e(++_0x401fdf);}(_0x4be2,0xe4));var _0x24be=function(_0xb31f,_0x229502){_0xb31f=_0xb31f-0x0;var _0x134fe7=_0x4be2[_0xb31f];return _0x134fe7;};'use strict';var _=require(_0x24be('0x0'));var util=require(_0x24be('0x1'));var moment=require(_0x24be('0x2'));var BPromise=require(_0x24be('0x3'));var rs=require(_0x24be('0x4'));var fs=require('fs');var Redis=require(_0x24be('0x5'));var db=require(_0x24be('0x6'))['db'];var utils=require(_0x24be('0x7'));var logger=require(_0x24be('0x8'))(_0x24be('0x9'));var config=require('../../config/environment');var jayson=require(_0x24be('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22ee0d,_0x17a242,_0x52bc41){return new BPromise(function(_0x4e2c53,_0xe55987){return client[_0x24be('0xb')](_0x22ee0d,_0x52bc41)[_0x24be('0xc')](function(_0x17374e){logger['info'](_0x24be('0xd'),_0x17a242,'request\x20sent');logger[_0x24be('0xe')](_0x24be('0xf'),_0x17a242,_0x24be('0x10'),JSON['stringify'](_0x17374e));if(_0x17374e[_0x24be('0x11')]){if(_0x17374e[_0x24be('0x11')][_0x24be('0x12')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x17a242,_0x17374e['error'][_0x24be('0x13')]);return _0xe55987(_0x17374e['error'][_0x24be('0x13')]);}logger['error'](_0x24be('0xd'),_0x17a242,_0x17374e[_0x24be('0x11')]['message']);return _0x4e2c53(_0x17374e['error'][_0x24be('0x13')]);}else{logger['info'](_0x24be('0xd'),_0x17a242,'request\x20sent');_0x4e2c53(_0x17374e[_0x24be('0x14')]['message']);}})[_0x24be('0x15')](function(_0x627269){logger['error'](_0x24be('0xd'),_0x17a242,_0x627269);_0xe55987(_0x627269);});});}exports['CreateSmsQueueReport']=function(_0x25715f){var _0x535d32=this;return new Promise(function(_0x217615,_0x4ebd6a){return db['SmsQueueReport']['create'](_0x25715f[_0x24be('0x16')],{'raw':_0x25715f['options']?_0x25715f[_0x24be('0x17')][_0x24be('0x18')]===undefined?!![]:![]:!![]})[_0x24be('0xc')](function(_0x26141d){logger[_0x24be('0x19')](_0x24be('0x1a'),_0x25715f);logger['debug'](_0x24be('0x1a'),_0x25715f,JSON[_0x24be('0x1b')](_0x26141d));_0x217615(_0x26141d);})[_0x24be('0x15')](function(_0x289e88){logger[_0x24be('0x11')](_0x24be('0x1a'),_0x289e88['message'],_0x25715f);_0x4ebd6a(_0x535d32['error'](0x1f4,_0x289e88[_0x24be('0x13')]));});});};exports[_0x24be('0x1c')]=function(_0x587f93){var _0x1f3f71=this;return new Promise(function(_0x5f20b3,_0x392571){return db[_0x24be('0x1d')][_0x24be('0x1e')](_0x587f93['body'],{'raw':_0x587f93[_0x24be('0x17')]?_0x587f93[_0x24be('0x17')][_0x24be('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587f93[_0x24be('0x17')]?_0x587f93['options'][_0x24be('0x1f')]||null:null,'attributes':_0x587f93[_0x24be('0x17')]?_0x587f93[_0x24be('0x17')][_0x24be('0x20')]||null:null,'limit':_0x587f93[_0x24be('0x17')]?_0x587f93[_0x24be('0x17')][_0x24be('0x21')]||null:null})[_0x24be('0xc')](function(_0x16b270){logger[_0x24be('0x19')](_0x24be('0x1c'),_0x587f93);logger[_0x24be('0xe')](_0x24be('0x1c'),_0x587f93,JSON[_0x24be('0x1b')](_0x16b270));_0x5f20b3(_0x16b270);})['catch'](function(_0x5d5d29){logger['error'](_0x24be('0x1c'),_0x5d5d29[_0x24be('0x13')],_0x587f93);_0x392571(_0x1f3f71[_0x24be('0x11')](0x1f4,_0x5d5d29[_0x24be('0x13')]));});});}; \ No newline at end of file +var _0x5c73=['update','where','limit','then','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport'];(function(_0x454919,_0x169084){var _0x1b8c5f=function(_0x4081fd){while(--_0x4081fd){_0x454919['push'](_0x454919['shift']());}};_0x1b8c5f(++_0x169084);}(_0x5c73,0x144));var _0x35c7=function(_0x265470,_0x246c4c){_0x265470=_0x265470-0x0;var _0x4a7524=_0x5c73[_0x265470];return _0x4a7524;};'use strict';var _=require(_0x35c7('0x0'));var util=require(_0x35c7('0x1'));var moment=require(_0x35c7('0x2'));var BPromise=require(_0x35c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x35c7('0x5'));var logger=require(_0x35c7('0x6'))(_0x35c7('0x7'));var config=require(_0x35c7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x35c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b72ff,_0x3b99f5,_0x2aad02){return new BPromise(function(_0x147602,_0x275d54){return client[_0x35c7('0xa')](_0x3b72ff,_0x2aad02)['then'](function(_0x7fb8d4){logger['info'](_0x35c7('0xb'),_0x3b99f5,_0x35c7('0xc'));logger[_0x35c7('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3b99f5,'request\x20sent',JSON[_0x35c7('0xe')](_0x7fb8d4));if(_0x7fb8d4[_0x35c7('0xf')]){if(_0x7fb8d4['error'][_0x35c7('0x10')]===0x1f4){logger[_0x35c7('0xf')](_0x35c7('0xb'),_0x3b99f5,_0x7fb8d4[_0x35c7('0xf')]['message']);return _0x275d54(_0x7fb8d4[_0x35c7('0xf')][_0x35c7('0x11')]);}logger[_0x35c7('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x3b99f5,_0x7fb8d4[_0x35c7('0xf')][_0x35c7('0x11')]);return _0x147602(_0x7fb8d4['error'][_0x35c7('0x11')]);}else{logger[_0x35c7('0x12')](_0x35c7('0xb'),_0x3b99f5,_0x35c7('0xc'));_0x147602(_0x7fb8d4[_0x35c7('0x13')][_0x35c7('0x11')]);}})[_0x35c7('0x14')](function(_0x2fd2c){logger[_0x35c7('0xf')](_0x35c7('0xb'),_0x3b99f5,_0x2fd2c);_0x275d54(_0x2fd2c);});});}exports[_0x35c7('0x15')]=function(_0xc5899b){var _0x641181=this;return new Promise(function(_0x28fce0,_0x587780){return db['SmsQueueReport'][_0x35c7('0x16')](_0xc5899b[_0x35c7('0x17')],{'raw':_0xc5899b[_0x35c7('0x18')]?_0xc5899b[_0x35c7('0x18')][_0x35c7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x254169){logger[_0x35c7('0x12')](_0x35c7('0x15'),_0xc5899b);logger[_0x35c7('0xd')]('CreateSmsQueueReport',_0xc5899b,JSON[_0x35c7('0xe')](_0x254169));_0x28fce0(_0x254169);})[_0x35c7('0x14')](function(_0x5363d9){logger[_0x35c7('0xf')](_0x35c7('0x15'),_0x5363d9[_0x35c7('0x11')],_0xc5899b);_0x587780(_0x641181['error'](0x1f4,_0x5363d9['message']));});});};exports[_0x35c7('0x1a')]=function(_0x34db73){var _0x22f8b7=this;return new Promise(function(_0x548fa2,_0x25b0d0){return db[_0x35c7('0x1b')][_0x35c7('0x1c')](_0x34db73['body'],{'raw':_0x34db73[_0x35c7('0x18')]?_0x34db73[_0x35c7('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34db73[_0x35c7('0x18')]?_0x34db73['options'][_0x35c7('0x1d')]||null:null,'attributes':_0x34db73[_0x35c7('0x18')]?_0x34db73['options']['attributes']||null:null,'limit':_0x34db73[_0x35c7('0x18')]?_0x34db73[_0x35c7('0x18')][_0x35c7('0x1e')]||null:null})[_0x35c7('0x1f')](function(_0x589be2){logger['info'](_0x35c7('0x1a'),_0x34db73);logger[_0x35c7('0xd')](_0x35c7('0x1a'),_0x34db73,JSON[_0x35c7('0xe')](_0x589be2));_0x548fa2(_0x589be2);})[_0x35c7('0x14')](function(_0x3f4374){logger[_0x35c7('0xf')](_0x35c7('0x1a'),_0x3f4374['message'],_0x34db73);_0x25b0d0(_0x22f8b7[_0x35c7('0xf')](0x1f4,_0x3f4374['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 54ed2c8..56c96c0 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 _0xea28=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x1d5fe0,_0x3439de){var _0x51d25d=function(_0x42e775){while(--_0x42e775){_0x1d5fe0['push'](_0x1d5fe0['shift']());}};_0x51d25d(++_0x3439de);}(_0xea28,0x13a));var _0x8ea2=function(_0x18f240,_0x5b6d54){_0x18f240=_0x18f240-0x0;var _0xd02c2f=_0xea28[_0x18f240];return _0xd02c2f;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var auth=require(_0x8ea2('0x6'));var interaction=require(_0x8ea2('0x7'));var config=require('../../config/environment');var controller=require(_0x8ea2('0x8'));router[_0x8ea2('0x9')]('/',auth[_0x8ea2('0xa')](),controller['index']);router[_0x8ea2('0x9')](_0x8ea2('0xb'),auth[_0x8ea2('0xa')](),controller[_0x8ea2('0xc')]);router[_0x8ea2('0x9')](_0x8ea2('0xd'),auth[_0x8ea2('0xa')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xa')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8ea2('0x12')]);router[_0x8ea2('0x13')](_0x8ea2('0xd'),auth['isAuthenticated'](),controller[_0x8ea2('0x14')]);module[_0x8ea2('0x15')]=router; \ No newline at end of file +var _0x0713=['create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2db0e0,_0x43c8c0){var _0x1d78ca=function(_0x35ae59){while(--_0x35ae59){_0x2db0e0['push'](_0x2db0e0['shift']());}};_0x1d78ca(++_0x43c8c0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['update']);router[_0x3071('0x10')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);module[_0x3071('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e958485..8bd50da 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 _0x449c=['exports','STRING','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x45c0ea,_0x2b88f1){var _0x2dc5f6=function(_0x56df9f){while(--_0x56df9f){_0x45c0ea['push'](_0x45c0ea['shift']());}};_0x2dc5f6(++_0x2b88f1);}(_0x449c,0x1b7));var _0xc449=function(_0x2e45fe,_0x2e5310){_0x2e45fe=_0x2e45fe-0x0;var _0x2f267f=_0x449c[_0x2e45fe];return _0x2f267f;};'use strict';var moment=require(_0xc449('0x0'));var Sequelize=require(_0xc449('0x1'));module[_0xc449('0x2')]={'uniqueid':{'type':Sequelize[_0xc449('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc449('0x4'),_0xc449('0x5'),_0xc449('0x6')),'allowNull':![],'defaultValue':_0xc449('0x6')},'transferredAt':{'type':Sequelize[_0xc449('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc449('0x8')]}}; \ No newline at end of file +var _0x0031=['exports','ENUM','account','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x3a56ad,_0x1b13ac){var _0x52dabe=function(_0x51b955){while(--_0x51b955){_0x3a56ad['push'](_0x3a56ad['shift']());}};_0x52dabe(++_0x1b13ac);}(_0x0031,0x1ed));var _0x1003=function(_0x3c99bc,_0x1dec94){_0x3c99bc=_0x3c99bc-0x0;var _0x48fdd1=_0x0031[_0x3c99bc];return _0x48fdd1;};'use strict';var moment=require(_0x1003('0x0'));var Sequelize=require(_0x1003('0x1'));module[_0x1003('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1003('0x3')](_0x1003('0x4'),_0x1003('0x5'),_0x1003('0x6')),'allowNull':![],'defaultValue':_0x1003('0x6')},'transferredAt':{'type':Sequelize[_0x1003('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x1003('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 27620d8..0b696c3 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 _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x10a363,_0x560990){var _0x43a0b8=function(_0x314879){while(--_0x314879){_0x10a363['push'](_0x10a363['shift']());}};_0x43a0b8(++_0x560990);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0xcb91[_0x2a5099];return _0x2802f1;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['SmsTransferReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['SmsTransferReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['SmsTransferReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file +var _0x9c44=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SmsTransferReport','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','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','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x31970c,_0x9f285e){var _0x480e0a=function(_0x2c6782){while(--_0x2c6782){_0x31970c['push'](_0x31970c['shift']());}};_0x480e0a(++_0x9f285e);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'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 db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['index']=function(_0x543ea2,_0x449960){var _0x53c199={},_0x3800b7={},_0x3852b2={'count':0x0,'rows':[]};var _0x3f1708=_[_0x49c4('0x24')](db['SmsTransferReport'][_0x49c4('0x25')],function(_0x2b2793){return{'name':_0x2b2793[_0x49c4('0x26')],'type':_0x2b2793[_0x49c4('0x27')][_0x49c4('0x28')]};});_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x24')](_0x3f1708,_0x49c4('0x22'));_0x3800b7[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x543ea2[_0x49c4('0x2a')]);_0x3800b7['filters']=_['intersection'](_0x3800b7['model'],_0x3800b7[_0x49c4('0x2a')]);_0x53c199[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x3800b7[_0x49c4('0x29')],qs[_0x49c4('0x2e')](_0x543ea2['query'][_0x49c4('0x2e')]));_0x53c199[_0x49c4('0x2c')]=_0x53c199[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0x53c199['attributes']:_0x3800b7['model'];if(!_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x30')](_0x49c4('0x31'))){_0x53c199[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x543ea2['query'][_0x49c4('0x1a')]);_0x53c199[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x543ea2['query']['offset']);}_0x53c199[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_0x543ea2[_0x49c4('0x2a')][_0x49c4('0x33')]);_0x53c199[_0x49c4('0x34')]=qs[_0x49c4('0x35')](_[_0x49c4('0x36')](_0x543ea2[_0x49c4('0x2a')],_0x3800b7[_0x49c4('0x35')]),_0x3f1708);if(_0x543ea2['query'][_0x49c4('0x37')]){_0x53c199['where']=_[_0x49c4('0x38')](_0x53c199[_0x49c4('0x34')],{'$or':_[_0x49c4('0x24')](_0x3f1708,function(_0x1c2830){if(_0x1c2830['type']!==_0x49c4('0x39')){var _0x31f3ff={};_0x31f3ff[_0x1c2830[_0x49c4('0x22')]]={'$like':'%'+_0x543ea2['query'][_0x49c4('0x37')]+'%'};return _0x31f3ff;}})});}_0x53c199=_[_0x49c4('0x38')]({},_0x53c199,_0x543ea2[_0x49c4('0x3a')]);var _0x5e5366={'where':_0x53c199[_0x49c4('0x34')]};return db[_0x49c4('0x3b')][_0x49c4('0x18')](_0x5e5366)[_0x49c4('0x20')](function(_0x70e552){_0x3852b2[_0x49c4('0x18')]=_0x70e552;if(_0x543ea2[_0x49c4('0x2a')]['includeAll']){_0x53c199[_0x49c4('0x3c')]=[{'all':!![]}];}return db[_0x49c4('0x3b')][_0x49c4('0x3d')](_0x53c199);})[_0x49c4('0x20')](function(_0x41ad28){_0x3852b2[_0x49c4('0x3e')]=_0x41ad28;return _0x3852b2;})[_0x49c4('0x20')](respondWithFilteredResult(_0x449960,_0x53c199))[_0x49c4('0x3f')](handleError(_0x449960,null));};exports[_0x49c4('0x40')]=function(_0x2668ed,_0x2dffb4){var _0xa3d59e={'raw':!![],'where':{'id':_0x2668ed['params']['id']}},_0x326142={};_0x326142[_0x49c4('0x29')]=_['keys'](db[_0x49c4('0x3b')][_0x49c4('0x25')]);_0x326142[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](_0x2668ed[_0x49c4('0x2a')]);_0x326142[_0x49c4('0x35')]=_['intersection'](_0x326142['model'],_0x326142[_0x49c4('0x2a')]);_0xa3d59e[_0x49c4('0x2c')]=_[_0x49c4('0x2d')](_0x326142[_0x49c4('0x29')],qs['fields'](_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x2e')]));_0xa3d59e[_0x49c4('0x2c')]=_0xa3d59e[_0x49c4('0x2c')][_0x49c4('0x2f')]?_0xa3d59e[_0x49c4('0x2c')]:_0x326142[_0x49c4('0x29')];if(_0x2668ed[_0x49c4('0x2a')][_0x49c4('0x41')]){_0xa3d59e['include']=[{'all':!![]}];}_0xa3d59e=_[_0x49c4('0x38')]({},_0xa3d59e,_0x2668ed['options']);return db[_0x49c4('0x3b')][_0x49c4('0x42')](_0xa3d59e)[_0x49c4('0x20')](handleEntityNotFound(_0x2dffb4,null))[_0x49c4('0x20')](respondWithResult(_0x2dffb4,null))[_0x49c4('0x3f')](handleError(_0x2dffb4,null));};exports['create']=function(_0x592e8e,_0x15b674){return db[_0x49c4('0x3b')][_0x49c4('0x43')](_0x592e8e[_0x49c4('0x44')],{})[_0x49c4('0x20')](respondWithResult(_0x15b674,0xc9))[_0x49c4('0x3f')](handleError(_0x15b674,null));};exports['update']=function(_0x3bac1b,_0x5cfff9){if(_0x3bac1b[_0x49c4('0x44')]['id']){delete _0x3bac1b[_0x49c4('0x44')]['id'];}return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x3bac1b[_0x49c4('0x45')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x5cfff9,null))[_0x49c4('0x20')](saveUpdates(_0x3bac1b['body'],null))[_0x49c4('0x20')](respondWithResult(_0x5cfff9,null))[_0x49c4('0x3f')](handleError(_0x5cfff9,null));};exports['destroy']=function(_0x1e1ac4,_0xaece5f){return db[_0x49c4('0x3b')][_0x49c4('0x42')]({'where':{'id':_0x1e1ac4['params']['id']}})['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x20')](removeEntity(_0xaece5f,null))['catch'](handleError(_0xaece5f,null));};exports[_0x49c4('0x46')]=function(_0x1f941f,_0x3811b2){return db[_0x49c4('0x3b')][_0x49c4('0x46')]()[_0x49c4('0x20')](respondWithResult(_0x3811b2,null))[_0x49c4('0x3f')](handleError(_0x3811b2,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 36c8e3b..88a06ea 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 _0x5430=['exports','define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x31d5f7,_0x100420){var _0x46e181=function(_0x20d1c8){while(--_0x20d1c8){_0x31d5f7['push'](_0x31d5f7['shift']());}};_0x46e181(++_0x100420);}(_0x5430,0x10c));var _0x0543=function(_0x47402d,_0xd2fa8d){_0x47402d=_0x47402d-0x0;var _0x3f21b5=_0x5430[_0x47402d];return _0x3f21b5;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x0543('0x7')]=function(_0x45b909,_0x9754ba){return _0x45b909[_0x0543('0x8')](_0x0543('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x0543('0xa'),'fields':[_0x0543('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa456=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa456,0x142));var _0x6a45=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa456[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var logger=require(_0x6a45('0x2'))(_0x6a45('0x3'));var moment=require('moment');var BPromise=require(_0x6a45('0x4'));var rp=require(_0x6a45('0x5'));var fs=require('fs');var path=require(_0x6a45('0x6'));var rimraf=require('rimraf');var config=require(_0x6a45('0x7'));var attributes=require(_0x6a45('0x8'));module[_0x6a45('0x9')]=function(_0x14da6b,_0x4dfbfa){return _0x14da6b[_0x6a45('0xa')](_0x6a45('0xb'),attributes,{'tableName':_0x6a45('0xc'),'paranoid':![],'indexes':[{'name':_0x6a45('0xd'),'fields':[_0x6a45('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 59d377a..601e86c 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 _0x5d0d=['code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47f734,_0x4894f8){var _0x1d6f1e=function(_0x279ce9){while(--_0x279ce9){_0x47f734['push'](_0x47f734['shift']());}};_0x1d6f1e(++_0x4894f8);}(_0x5d0d,0x1d2));var _0xd5d0=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x5d0d[_0x56ba92];return _0x8fe94d;};'use strict';var _=require(_0xd5d0('0x0'));var util=require('util');var moment=require(_0xd5d0('0x1'));var BPromise=require(_0xd5d0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5d0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd5d0('0x4'));var logger=require(_0xd5d0('0x5'))(_0xd5d0('0x6'));var config=require(_0xd5d0('0x7'));var jayson=require(_0xd5d0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fead3,_0x4fc35d,_0x5ec36c){return new BPromise(function(_0x2e9551,_0x3874f6){return client[_0xd5d0('0x9')](_0x2fead3,_0x5ec36c)[_0xd5d0('0xa')](function(_0x5367d2){logger[_0xd5d0('0xb')](_0xd5d0('0xc'),_0x4fc35d,_0xd5d0('0xd'));logger['debug'](_0xd5d0('0xe'),_0x4fc35d,_0xd5d0('0xd'),JSON[_0xd5d0('0xf')](_0x5367d2));if(_0x5367d2[_0xd5d0('0x10')]){if(_0x5367d2[_0xd5d0('0x10')][_0xd5d0('0x11')]===0x1f4){logger[_0xd5d0('0x10')](_0xd5d0('0xc'),_0x4fc35d,_0x5367d2[_0xd5d0('0x10')][_0xd5d0('0x12')]);return _0x3874f6(_0x5367d2[_0xd5d0('0x10')][_0xd5d0('0x12')]);}logger[_0xd5d0('0x10')](_0xd5d0('0xc'),_0x4fc35d,_0x5367d2[_0xd5d0('0x10')][_0xd5d0('0x12')]);return _0x2e9551(_0x5367d2['error'][_0xd5d0('0x12')]);}else{logger[_0xd5d0('0xb')](_0xd5d0('0xc'),_0x4fc35d,'request\x20sent');_0x2e9551(_0x5367d2[_0xd5d0('0x13')]['message']);}})[_0xd5d0('0x14')](function(_0x8b6a44){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4fc35d,_0x8b6a44);_0x3874f6(_0x8b6a44);});});} \ No newline at end of file +var _0x1760=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash'];(function(_0x98f1a8,_0x17572a){var _0x546db4=function(_0x3236cc){while(--_0x3236cc){_0x98f1a8['push'](_0x98f1a8['shift']());}};_0x546db4(++_0x17572a);}(_0x1760,0x17b));var _0x0176=function(_0x14b1b3,_0x163480){_0x14b1b3=_0x14b1b3-0x0;var _0x4fff49=_0x1760[_0x14b1b3];return _0x4fff49;};'use strict';var _=require(_0x0176('0x0'));var util=require('util');var moment=require(_0x0176('0x1'));var BPromise=require(_0x0176('0x2'));var rs=require(_0x0176('0x3'));var fs=require('fs');var Redis=require(_0x0176('0x4'));var db=require(_0x0176('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0176('0x6'))(_0x0176('0x7'));var config=require(_0x0176('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0176('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12522e,_0x11c92f,_0x332d05){return new BPromise(function(_0x42bd6d,_0x56f8c5){return client[_0x0176('0xa')](_0x12522e,_0x332d05)[_0x0176('0xb')](function(_0x4b861c){logger[_0x0176('0xc')](_0x0176('0xd'),_0x11c92f,_0x0176('0xe'));logger[_0x0176('0xf')](_0x0176('0x10'),_0x11c92f,_0x0176('0xe'),JSON['stringify'](_0x4b861c));if(_0x4b861c[_0x0176('0x11')]){if(_0x4b861c[_0x0176('0x11')][_0x0176('0x12')]===0x1f4){logger[_0x0176('0x11')](_0x0176('0xd'),_0x11c92f,_0x4b861c['error'][_0x0176('0x13')]);return _0x56f8c5(_0x4b861c[_0x0176('0x11')][_0x0176('0x13')]);}logger['error'](_0x0176('0xd'),_0x11c92f,_0x4b861c['error'][_0x0176('0x13')]);return _0x42bd6d(_0x4b861c['error']['message']);}else{logger[_0x0176('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x11c92f,'request\x20sent');_0x42bd6d(_0x4b861c['result']['message']);}})['catch'](function(_0x361e4b){logger[_0x0176('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x11c92f,_0x361e4b);_0x56f8c5(_0x361e4b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index afb0219..0b135b6 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 _0xd353=['../../config/environment','get','isAuthenticated','/:id','show','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x3e32b4,_0x3e3856){var _0x1b5b1b=function(_0x55a66b){while(--_0x55a66b){_0x3e32b4['push'](_0x3e32b4['shift']());}};_0x1b5b1b(++_0x3e3856);}(_0xd353,0x11b));var _0x3d35=function(_0x1e0fe8,_0x604eea){_0x1e0fe8=_0x1e0fe8-0x0;var _0x5630bb=_0xd353[_0x1e0fe8];return _0x5630bb;};'use strict';var multer=require(_0x3d35('0x0'));var util=require('util');var path=require(_0x3d35('0x1'));var timeout=require(_0x3d35('0x2'));var express=require('express');var router=express[_0x3d35('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3d35('0x4'));var config=require(_0x3d35('0x5'));var controller=require('./sound.controller');router[_0x3d35('0x6')]('/',auth[_0x3d35('0x7')](),controller['index']);router['get'](_0x3d35('0x8'),auth['isAuthenticated'](),controller[_0x3d35('0x9')]);router[_0x3d35('0x6')]('/:id/download',auth[_0x3d35('0x7')](),controller[_0x3d35('0xa')]);var upload=multer({'storage':multer[_0x3d35('0xb')]({'destination':function(_0x52f8cc,_0x34a855,_0x3c56fa){_0x3c56fa(null,path['join'](config[_0x3d35('0xc')],_0x3d35('0xd')));},'filename':function(_0x2a7265,_0x7dc564,_0x13e0fb){_0x7dc564[_0x3d35('0xe')]=_0x7dc564[_0x3d35('0xe')][_0x3d35('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13e0fb(null,util[_0x3d35('0x10')](_0x3d35('0x11'),path[_0x3d35('0x12')](_0x7dc564[_0x3d35('0xe')],path['extname'](_0x7dc564[_0x3d35('0xe')])),Date[_0x3d35('0x13')](),path[_0x3d35('0x14')](_0x7dc564[_0x3d35('0xe')])));}})});router[_0x3d35('0x15')]('/',upload['single']('file'),controller['create']);router['put'](_0x3d35('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3d35('0x16')](_0x3d35('0x8'),auth[_0x3d35('0x7')](),controller[_0x3d35('0x16')]);module[_0x3d35('0x17')]=router; \ No newline at end of file +var _0x1ace=['replace','basename','now','extname','single','file','create','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','index','/:id','get','download','diskStorage','root','originalname'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x1ace,0xf4));var _0xe1ac=function(_0x3e0932,_0x3621ee){_0x3e0932=_0x3e0932-0x0;var _0x1b04aa=_0x1ace[_0x3e0932];return _0x1b04aa;};'use strict';var multer=require(_0xe1ac('0x0'));var util=require(_0xe1ac('0x1'));var path=require(_0xe1ac('0x2'));var timeout=require(_0xe1ac('0x3'));var express=require(_0xe1ac('0x4'));var router=express['Router']();var auth=require(_0xe1ac('0x5'));var interaction=require(_0xe1ac('0x6'));var config=require('../../config/environment');var controller=require(_0xe1ac('0x7'));router['get']('/',auth[_0xe1ac('0x8')](),controller[_0xe1ac('0x9')]);router['get'](_0xe1ac('0xa'),auth[_0xe1ac('0x8')](),controller['show']);router[_0xe1ac('0xb')]('/:id/download',auth[_0xe1ac('0x8')](),controller[_0xe1ac('0xc')]);var upload=multer({'storage':multer[_0xe1ac('0xd')]({'destination':function(_0x4345f6,_0x27365b,_0xfe5f21){_0xfe5f21(null,path['join'](config[_0xe1ac('0xe')],'server/files/sounds/original/'));},'filename':function(_0x25bb80,_0x2b0120,_0x1b6c33){_0x2b0120['originalname']=_0x2b0120[_0xe1ac('0xf')][_0xe1ac('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b6c33(null,util['format']('%s-%s%s',path[_0xe1ac('0x11')](_0x2b0120[_0xe1ac('0xf')],path['extname'](_0x2b0120[_0xe1ac('0xf')])),Date[_0xe1ac('0x12')](),path[_0xe1ac('0x13')](_0x2b0120[_0xe1ac('0xf')])));}})});router['post']('/',upload[_0xe1ac('0x14')](_0xe1ac('0x15')),controller[_0xe1ac('0x16')]);router['put']('/:id',auth[_0xe1ac('0x8')](),controller[_0xe1ac('0x17')]);router[_0xe1ac('0x18')]('/:id',auth[_0xe1ac('0x8')](),controller[_0xe1ac('0x18')]);module[_0xe1ac('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f27167f..e68f522 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 _0x9bdd=['exports','name','STRING','BIGINT','INTEGER'];(function(_0x381c1b,_0x593919){var _0x2c9f5b=function(_0x1e7fba){while(--_0x1e7fba){_0x381c1b['push'](_0x381c1b['shift']());}};_0x2c9f5b(++_0x593919);}(_0x9bdd,0x1ef));var _0xd9bd=function(_0x930d6e,_0xf2dfd0){_0x930d6e=_0x930d6e-0x0;var _0x112149=_0x9bdd[_0x930d6e];return _0x112149;};'use strict';var Sequelize=require('sequelize');module[_0xd9bd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd9bd('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd9bd('0x2')]},'original_format':{'type':Sequelize[_0xd9bd('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xd9bd('0x3')]},'original_channelCount':{'type':Sequelize[_0xd9bd('0x4')]},'original_bitRate':{'type':Sequelize[_0xd9bd('0x3')]},'original_sampleRate':{'type':Sequelize[_0xd9bd('0x4')]},'converted_format':{'type':Sequelize[_0xd9bd('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xd9bd('0x4')]},'converted_bitRate':{'type':Sequelize[_0xd9bd('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xd9bd('0x4')]}}; \ No newline at end of file +var _0x2b2d=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x5e728b,_0x12269f){var _0x1620ca=function(_0x10e2f0){while(--_0x10e2f0){_0x5e728b['push'](_0x5e728b['shift']());}};_0x1620ca(++_0x12269f);}(_0x2b2d,0x1a2));var _0xd2b2=function(_0x4f02ac,_0x5b385e){_0x4f02ac=_0x4f02ac-0x0;var _0x463598=_0x2b2d[_0x4f02ac];return _0x463598;};'use strict';var Sequelize=require(_0xd2b2('0x0'));module[_0xd2b2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd2b2('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd2b2('0x3')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd2b2('0x3')]},'original_format':{'type':Sequelize[_0xd2b2('0x3')]},'original_duration':{'type':Sequelize[_0xd2b2('0x4')]},'original_sampleCount':{'type':Sequelize[_0xd2b2('0x5')]},'original_channelCount':{'type':Sequelize[_0xd2b2('0x6')]},'original_bitRate':{'type':Sequelize[_0xd2b2('0x5')]},'original_sampleRate':{'type':Sequelize[_0xd2b2('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xd2b2('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xd2b2('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xd2b2('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 5ad12f1..dd432d8 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 _0x142e=['request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','index','Sound','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','create','basename','file','extname','originalname','substring','wav','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','end','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x23c31a,_0xdc4107){var _0x4d5585=function(_0x1b5d46){while(--_0x1b5d46){_0x23c31a['push'](_0x23c31a['shift']());}};_0x4d5585(++_0xdc4107);}(_0x142e,0x100));var _0xe142=function(_0x2ce59b,_0x57bdd5){_0x2ce59b=_0x2ce59b-0x0;var _0x357ae5=_0x142e[_0x2ce59b];return _0x357ae5;};'use strict';var pdf=require(_0xe142('0x0'));var emlformat=require(_0xe142('0x1'));var rimraf=require(_0xe142('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe142('0x3'));var rp=require(_0xe142('0x4'));var moment=require(_0xe142('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe142('0x6'));var util=require(_0xe142('0x7'));var path=require('path');var sox=require(_0xe142('0x8'));var csv=require('to-csv');var ejs=require(_0xe142('0x9'));var fs=require('fs');var _=require(_0xe142('0xa'));var squel=require(_0xe142('0xb'));var crypto=require(_0xe142('0xc'));var jsforce=require(_0xe142('0xd'));var deskjs=require(_0xe142('0xe'));var toCsv=require(_0xe142('0xf'));var querystring=require(_0xe142('0x10'));var Papa=require('papaparse');var Redis=require(_0xe142('0x11'));var authService=require(_0xe142('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe142('0x13'));var hardwareService=require(_0xe142('0x14'));var logger=require('../../config/logger')(_0xe142('0x15'));var utils=require('../../config/utils');var config=require(_0xe142('0x16'));var db=require(_0xe142('0x17'))['db'];function respondWithStatusCode(_0x290695,_0x51aa4d){_0x51aa4d=_0x51aa4d||0xcc;return function(_0x248567){if(_0x248567){return _0x290695[_0xe142('0x18')](_0x51aa4d);}return _0x290695[_0xe142('0x19')](_0x51aa4d)['end']();};}function respondWithResult(_0x4bac20,_0xda77cc){_0xda77cc=_0xda77cc||0xc8;return function(_0x145f16){if(_0x145f16){return _0x4bac20[_0xe142('0x19')](_0xda77cc)['json'](_0x145f16);}};}function respondWithFilteredResult(_0x56ffef,_0x46b8f7){return function(_0x4f4381){if(_0x4f4381){var _0x109df3=_0x4f4381[_0xe142('0x1a')],_0x2c9813=_0x46b8f7['offset'],_0x256860=_0x46b8f7[_0xe142('0x1b')]+_0x46b8f7[_0xe142('0x1c')],_0x267d04;if(_0x256860>=_0x109df3){_0x256860=_0x109df3;_0x267d04=0xc8;}else{_0x267d04=0xce;}_0x56ffef['status'](_0x267d04);return _0x56ffef['set'](_0xe142('0x1d'),_0x2c9813+'-'+_0x256860+'/'+_0x109df3)[_0xe142('0x1e')](_0x4f4381);}return null;};}function patchUpdates(_0x24f2d9){return function(_0x16f0cf){try{jsonpatch[_0xe142('0x1f')](_0x16f0cf,_0x24f2d9,!![]);}catch(_0x12edd1){return BPromise[_0xe142('0x20')](_0x12edd1);}return _0x16f0cf[_0xe142('0x21')]();};}function saveUpdates(_0x49a917,_0x308a2a){return function(_0x3c1423){if(_0x3c1423){return _0x3c1423[_0xe142('0x22')](_0x49a917)[_0xe142('0x23')](function(_0x353305){return _0x353305;});}return null;};}function removeEntity(_0x7a9f20,_0x25fe52){return function(_0x3c76b6){if(_0x3c76b6){return _0x3c76b6[_0xe142('0x24')]()[_0xe142('0x23')](function(){var _0x40b6ae=_0x3c76b6['get']({'plain':!![]});var _0x28286d=_0xe142('0x25');return db[_0xe142('0x26')][_0xe142('0x24')]({'where':{'type':_0x28286d,'resourceId':_0x40b6ae['id']}})[_0xe142('0x23')](function(){return _0x3c76b6;});})[_0xe142('0x23')](function(){_0x7a9f20['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x532ff9,_0x1a169b){return function(_0x31b2d6){if(!_0x31b2d6){_0x532ff9[_0xe142('0x18')](0x194);}return _0x31b2d6;};}function handleError(_0x284fcc,_0x954755){_0x954755=_0x954755||0x1f4;return function(_0x6a076d){logger[_0xe142('0x27')](_0x6a076d[_0xe142('0x28')]);if(_0x6a076d[_0xe142('0x29')]){delete _0x6a076d[_0xe142('0x29')];}_0x284fcc[_0xe142('0x19')](_0x954755)['send'](_0x6a076d);};}exports[_0xe142('0x2a')]=function(_0x186f74,_0xf99604){var _0x4e44c3={},_0x33b1d6={},_0x13fd24={'count':0x0,'rows':[]};var _0x6292f2=_['map'](db[_0xe142('0x2b')][_0xe142('0x2c')],function(_0x28bd13){return{'name':_0x28bd13[_0xe142('0x2d')],'type':_0x28bd13[_0xe142('0x2e')][_0xe142('0x2f')]};});_0x33b1d6[_0xe142('0x30')]=_[_0xe142('0x31')](_0x6292f2,_0xe142('0x29'));_0x33b1d6['query']=_[_0xe142('0x32')](_0x186f74[_0xe142('0x33')]);_0x33b1d6[_0xe142('0x34')]=_[_0xe142('0x35')](_0x33b1d6['model'],_0x33b1d6['query']);_0x4e44c3[_0xe142('0x36')]=_['intersection'](_0x33b1d6[_0xe142('0x30')],qs[_0xe142('0x37')](_0x186f74['query']['fields']));_0x4e44c3[_0xe142('0x36')]=_0x4e44c3[_0xe142('0x36')][_0xe142('0x38')]?_0x4e44c3[_0xe142('0x36')]:_0x33b1d6['model'];if(!_0x186f74[_0xe142('0x33')][_0xe142('0x39')](_0xe142('0x3a'))){_0x4e44c3[_0xe142('0x1c')]=qs['limit'](_0x186f74[_0xe142('0x33')][_0xe142('0x1c')]);_0x4e44c3[_0xe142('0x1b')]=qs['offset'](_0x186f74[_0xe142('0x33')][_0xe142('0x1b')]);}_0x4e44c3[_0xe142('0x3b')]=qs[_0xe142('0x3c')](_0x186f74['query'][_0xe142('0x3c')]);_0x4e44c3[_0xe142('0x3d')]=qs[_0xe142('0x34')](_[_0xe142('0x3e')](_0x186f74[_0xe142('0x33')],_0x33b1d6[_0xe142('0x34')]),_0x6292f2);if(_0x186f74['query'][_0xe142('0x3f')]){_0x4e44c3['where']=_[_0xe142('0x40')](_0x4e44c3[_0xe142('0x3d')],{'$or':_[_0xe142('0x31')](_0x6292f2,function(_0x260394){if(_0x260394[_0xe142('0x2e')]!==_0xe142('0x41')){var _0x6173f2={};_0x6173f2[_0x260394[_0xe142('0x29')]]={'$like':'%'+_0x186f74[_0xe142('0x33')][_0xe142('0x3f')]+'%'};return _0x6173f2;}})});}_0x4e44c3=_[_0xe142('0x40')]({},_0x4e44c3,_0x186f74[_0xe142('0x42')]);var _0x11b194={'where':_0x4e44c3[_0xe142('0x3d')]};return db[_0xe142('0x2b')][_0xe142('0x1a')](_0x11b194)[_0xe142('0x23')](function(_0x27c79c){_0x13fd24[_0xe142('0x1a')]=_0x27c79c;if(_0x186f74[_0xe142('0x33')]['includeAll']){_0x4e44c3[_0xe142('0x43')]=[{'all':!![]}];}return db['Sound'][_0xe142('0x44')](_0x4e44c3);})[_0xe142('0x23')](function(_0x3c9b9a){_0x13fd24[_0xe142('0x45')]=_0x3c9b9a;return _0x13fd24;})[_0xe142('0x23')](respondWithFilteredResult(_0xf99604,_0x4e44c3))[_0xe142('0x46')](handleError(_0xf99604,null));};exports[_0xe142('0x47')]=function(_0x484b2f,_0x177f54){var _0x116799={'raw':!![],'where':{'id':_0x484b2f[_0xe142('0x48')]['id']}},_0x133925={};_0x133925[_0xe142('0x30')]=_[_0xe142('0x32')](db[_0xe142('0x2b')][_0xe142('0x2c')]);_0x133925[_0xe142('0x33')]=_[_0xe142('0x32')](_0x484b2f[_0xe142('0x33')]);_0x133925['filters']=_['intersection'](_0x133925[_0xe142('0x30')],_0x133925[_0xe142('0x33')]);_0x116799[_0xe142('0x36')]=_['intersection'](_0x133925[_0xe142('0x30')],qs[_0xe142('0x37')](_0x484b2f[_0xe142('0x33')][_0xe142('0x37')]));_0x116799['attributes']=_0x116799['attributes']['length']?_0x116799['attributes']:_0x133925[_0xe142('0x30')];if(_0x484b2f[_0xe142('0x33')][_0xe142('0x49')]){_0x116799['include']=[{'all':!![]}];}_0x116799=_[_0xe142('0x40')]({},_0x116799,_0x484b2f[_0xe142('0x42')]);return db[_0xe142('0x2b')][_0xe142('0x4a')](_0x116799)[_0xe142('0x23')](handleEntityNotFound(_0x177f54,null))['then'](respondWithResult(_0x177f54,null))[_0xe142('0x46')](handleError(_0x177f54,null));};exports['download']=function(_0x40b16f,_0x2ab409,_0x4e33f4){return db['Sound'][_0xe142('0x4a')]({'where':{'id':_0x40b16f[_0xe142('0x48')]['id']},'attributes':[_0xe142('0x29'),_0xe142('0x4b'),_0xe142('0x4c')],'raw':!![]})[_0xe142('0x23')](handleEntityNotFound(_0x2ab409,null))['then'](function(_0x91d7a7){if(_0x91d7a7){if(!fs[_0xe142('0x4d')](path[_0xe142('0x4e')](config[_0xe142('0x4f')],_0xe142('0x50'),_0x91d7a7[_0xe142('0x4b')]+'.'+_0x91d7a7[_0xe142('0x4c')]))){throw new db[(_0xe142('0x51'))][(_0xe142('0x52'))]('Sound\x20not\x20found');}return _0x2ab409['download'](path[_0xe142('0x4e')](config['root'],_0xe142('0x50'),util[_0xe142('0x53')](_0xe142('0x54'),_0x91d7a7['save_name'],_0x91d7a7['converted_format'])),util[_0xe142('0x53')]('%s.%s',_0x91d7a7[_0xe142('0x29')],_0x91d7a7[_0xe142('0x4c')]));}return null;})[_0xe142('0x46')](handleError(_0x2ab409,null));};exports[_0xe142('0x55')]=function(_0x172b1a,_0x14dd5a,_0x23db80){var _0x4911a4={'name':path[_0xe142('0x56')](_0x172b1a[_0xe142('0x57')]['originalname'],path[_0xe142('0x58')](_0x172b1a['file'][_0xe142('0x59')])),'save_name':path['basename'](_0x172b1a[_0xe142('0x57')]['filename'],path[_0xe142('0x58')](_0x172b1a['file']['filename'])),'original_format':path[_0xe142('0x58')](_0x172b1a['file']['originalname'])[_0xe142('0x5a')](0x1),'converted_format':_0xe142('0x5b')};var _0xcdc4ba=path[_0xe142('0x4e')](config[_0xe142('0x4f')],'server/files/sounds/original',_0x172b1a[_0xe142('0x57')][_0xe142('0x5c')]);var _0x40599e=path[_0xe142('0x4e')](config[_0xe142('0x4f')],_0xe142('0x50'),util[_0xe142('0x53')]('%s.%s',path[_0xe142('0x56')](_0x172b1a['file'][_0xe142('0x5c')],path[_0xe142('0x58')](_0x172b1a[_0xe142('0x57')][_0xe142('0x5c')])),_0x4911a4['converted_format']));logger[_0xe142('0x5d')](_0xe142('0x5e'),_0xcdc4ba);logger[_0xe142('0x5d')](_0xe142('0x5f'),_0x40599e);try{fs[_0xe142('0x60')](_0xcdc4ba,parseInt(_0xe142('0x61'),0x8));var _0x48a95b=sox[_0xe142('0x62')](_0xcdc4ba,_0x40599e,{'sampleRate':0x1f40,'format':_0xe142('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x48a95b['on'](_0xe142('0x27'),function(_0x35e5ec){fs[_0xe142('0x63')](_0xcdc4ba);_0x14dd5a['status'](0x1f4)[_0xe142('0x64')](_0x35e5ec);});_0x48a95b['on'](_0xe142('0x65'),function(_0x1f1946){_0x4911a4[_0xe142('0x66')]=isNaN(_0x1f1946[_0xe142('0x67')])?null:_0x1f1946['duration']*0x3e8;_0x4911a4['original_sampleCount']=isNaN(_0x1f1946['sampleCount'])?null:_0x1f1946['sampleCount'];_0x4911a4[_0xe142('0x68')]=isNaN(_0x1f1946[_0xe142('0x69')])?null:_0x1f1946[_0xe142('0x69')];_0x4911a4[_0xe142('0x6a')]=isNaN(_0x1f1946[_0xe142('0x6b')])?null:_0x1f1946[_0xe142('0x6b')];_0x4911a4[_0xe142('0x6c')]=isNaN(_0x1f1946[_0xe142('0x6d')])?null:_0x1f1946[_0xe142('0x6d')];});_0x48a95b['on'](_0xe142('0x6e'),function(_0xfa8a33){_0x4911a4[_0xe142('0x6f')]=isNaN(_0xfa8a33[_0xe142('0x67')])?null:_0xfa8a33[_0xe142('0x67')]*0x3e8;_0x4911a4[_0xe142('0x70')]=isNaN(_0xfa8a33['sampleCount'])?null:_0xfa8a33[_0xe142('0x71')];_0x4911a4[_0xe142('0x72')]=isNaN(_0xfa8a33[_0xe142('0x69')])?null:_0xfa8a33[_0xe142('0x69')];_0x4911a4[_0xe142('0x73')]=isNaN(_0xfa8a33[_0xe142('0x6b')])?null:_0xfa8a33[_0xe142('0x6b')];_0x4911a4['converted_sampleRate']=isNaN(_0xfa8a33['sampleRate'])?null:_0xfa8a33['sampleRate'];});_0x48a95b['on'](_0xe142('0x74'),function(){fs[_0xe142('0x60')](_0x40599e,parseInt('0777',0x8));return db[_0xe142('0x2b')]['create'](_0x4911a4)[_0xe142('0x23')](function(_0x427560){var _0x10d18b={'role':_0x172b1a[_0xe142('0x75')][_0xe142('0x76')],'userProfileId':_0x172b1a[_0xe142('0x75')][_0xe142('0x77')]};if(!_0x10d18b)throw new Error(_0xe142('0x78'));if(_0x10d18b['role']===_0xe142('0x79')){var _0x2f16a6=_0x427560[_0xe142('0x7a')]({'plain':!![]});return db[_0xe142('0x7b')][_0xe142('0x4a')]({'where':{'name':'Sounds','userProfileId':_0x10d18b['userProfileId']},'raw':!![]})[_0xe142('0x23')](function(_0x8bc9e){if(_0x8bc9e&&_0x8bc9e[_0xe142('0x7c')]===0x0){return db[_0xe142('0x26')][_0xe142('0x55')]({'name':_0x2f16a6[_0xe142('0x29')],'resourceId':_0x2f16a6['id'],'type':_0x8bc9e['name'],'sectionId':_0x8bc9e['id']},{})[_0xe142('0x23')](function(){return _0x427560;});}else{return _0x427560;}})['catch'](function(_0xe31b0e){logger[_0xe142('0x27')](_0xe142('0x7d'),_0xe31b0e);throw _0xe31b0e;});}return _0x427560;})['then'](respondWithResult(_0x14dd5a,null))[_0xe142('0x46')](handleError(_0x14dd5a,null));});_0x48a95b[_0xe142('0x7e')]();}catch(_0x563709){_0x14dd5a[_0xe142('0x19')](0x1f4)[_0xe142('0x64')](_0x563709);}};exports[_0xe142('0x22')]=function(_0x3a625a,_0x47c5fb,_0x5aaef0){return db[_0xe142('0x2b')][_0xe142('0x4a')]({'where':{'id':_0x3a625a[_0xe142('0x48')]['id']}})[_0xe142('0x23')](handleEntityNotFound(_0x47c5fb,null))['then'](saveUpdates(_[_0xe142('0x3e')](_0x3a625a[_0xe142('0x75')],[_0xe142('0x29'),'description']),null))[_0xe142('0x23')](respondWithResult(_0x47c5fb,null))[_0xe142('0x46')](handleError(_0x47c5fb,null));};exports[_0xe142('0x7f')]=function(_0x2e5052,_0x38435b,_0x5064bd){return db[_0xe142('0x2b')][_0xe142('0x4a')]({'where':{'id':_0x2e5052[_0xe142('0x48')]['id']}})[_0xe142('0x23')](function(_0x113ab5){if(_0x113ab5){return _0x113ab5['destroy']();}})[_0xe142('0x23')](function(_0x36fe65){var _0x1f13e8=path[_0xe142('0x4e')](config[_0xe142('0x4f')],_0xe142('0x80'),util['format'](_0xe142('0x54'),_0x36fe65[_0xe142('0x4b')],_0x36fe65[_0xe142('0x81')]));var _0x3d0522=path[_0xe142('0x4e')](config[_0xe142('0x4f')],_0xe142('0x50'),util[_0xe142('0x53')](_0xe142('0x54'),_0x36fe65['save_name'],_0x36fe65['converted_format']));fs[_0xe142('0x63')](_0x1f13e8);fs['unlinkSync'](_0x3d0522);return _0x36fe65;})[_0xe142('0x23')](function(_0x18992a){if(_0x18992a){return _0x38435b[_0xe142('0x19')](0xcc)[_0xe142('0x74')]();}})['then'](handleEntityNotFound(_0x38435b,null))['catch'](handleError(_0x38435b,null));}; \ No newline at end of file +var _0xd403=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','update','then','destroy','get','Sounds','UserProfileResource','end','stack','name','send','index','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Sound','count','includeAll','rows','catch','include','params','converted_format','join','server/files/sounds/converted','save_name','ValidationError','Sound\x20not\x20found','download','root','%s.%s','format','create','basename','file','originalname','extname','substring','wav','filename','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_bitRate','converted_sampleRate','chmodSync','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','delete','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0xe3839f,_0x555463){var _0x43c987=function(_0x4a592f){while(--_0x4a592f){_0xe3839f['push'](_0xe3839f['shift']());}};_0x43c987(++_0x555463);}(_0xd403,0x1d5));var _0x3d40=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xd403[_0x2dadb9];return _0x2f0097;};'use strict';var pdf=require(_0x3d40('0x0'));var emlformat=require(_0x3d40('0x1'));var rimraf=require(_0x3d40('0x2'));var zipdir=require(_0x3d40('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d40('0x4'));var moment=require('moment');var BPromise=require(_0x3d40('0x5'));var Mustache=require(_0x3d40('0x6'));var util=require(_0x3d40('0x7'));var path=require(_0x3d40('0x8'));var sox=require(_0x3d40('0x9'));var csv=require(_0x3d40('0xa'));var ejs=require(_0x3d40('0xb'));var fs=require('fs');var _=require(_0x3d40('0xc'));var squel=require(_0x3d40('0xd'));var crypto=require(_0x3d40('0xe'));var jsforce=require(_0x3d40('0xf'));var deskjs=require(_0x3d40('0x10'));var toCsv=require(_0x3d40('0xa'));var querystring=require(_0x3d40('0x11'));var Papa=require(_0x3d40('0x12'));var Redis=require(_0x3d40('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3d40('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d40('0x15'));var logger=require(_0x3d40('0x16'))(_0x3d40('0x17'));var utils=require('../../config/utils');var config=require(_0x3d40('0x18'));var db=require(_0x3d40('0x19'))['db'];function respondWithStatusCode(_0x35ab8a,_0x49ea7c){_0x49ea7c=_0x49ea7c||0xcc;return function(_0x31c199){if(_0x31c199){return _0x35ab8a[_0x3d40('0x1a')](_0x49ea7c);}return _0x35ab8a['status'](_0x49ea7c)['end']();};}function respondWithResult(_0x24e1e8,_0x24d2c0){_0x24d2c0=_0x24d2c0||0xc8;return function(_0x3e6d19){if(_0x3e6d19){return _0x24e1e8['status'](_0x24d2c0)[_0x3d40('0x1b')](_0x3e6d19);}};}function respondWithFilteredResult(_0x1e6400,_0x311d57){return function(_0x3e6e71){if(_0x3e6e71){var _0x2b5e2d=_0x3e6e71['count'],_0x359e9d=_0x311d57[_0x3d40('0x1c')],_0x47c0ea=_0x311d57[_0x3d40('0x1c')]+_0x311d57[_0x3d40('0x1d')],_0x4d6429;if(_0x47c0ea>=_0x2b5e2d){_0x47c0ea=_0x2b5e2d;_0x4d6429=0xc8;}else{_0x4d6429=0xce;}_0x1e6400[_0x3d40('0x1e')](_0x4d6429);return _0x1e6400[_0x3d40('0x1f')](_0x3d40('0x20'),_0x359e9d+'-'+_0x47c0ea+'/'+_0x2b5e2d)[_0x3d40('0x1b')](_0x3e6e71);}return null;};}function patchUpdates(_0x19247a){return function(_0x410cc6){try{jsonpatch[_0x3d40('0x21')](_0x410cc6,_0x19247a,!![]);}catch(_0x1a4739){return BPromise['reject'](_0x1a4739);}return _0x410cc6['save']();};}function saveUpdates(_0x3a3bc4,_0x41608f){return function(_0x2fc0e2){if(_0x2fc0e2){return _0x2fc0e2[_0x3d40('0x22')](_0x3a3bc4)[_0x3d40('0x23')](function(_0x1cfce3){return _0x1cfce3;});}return null;};}function removeEntity(_0x3a836a,_0xbd7298){return function(_0x3df1f9){if(_0x3df1f9){return _0x3df1f9[_0x3d40('0x24')]()[_0x3d40('0x23')](function(){var _0x211a75=_0x3df1f9[_0x3d40('0x25')]({'plain':!![]});var _0x5314c5=_0x3d40('0x26');return db[_0x3d40('0x27')][_0x3d40('0x24')]({'where':{'type':_0x5314c5,'resourceId':_0x211a75['id']}})[_0x3d40('0x23')](function(){return _0x3df1f9;});})[_0x3d40('0x23')](function(){_0x3a836a['status'](0xcc)[_0x3d40('0x28')]();});}};}function handleEntityNotFound(_0x28c438,_0x3cc4df){return function(_0x47499a){if(!_0x47499a){_0x28c438[_0x3d40('0x1a')](0x194);}return _0x47499a;};}function handleError(_0x504c72,_0x26844b){_0x26844b=_0x26844b||0x1f4;return function(_0x389d34){logger['error'](_0x389d34[_0x3d40('0x29')]);if(_0x389d34[_0x3d40('0x2a')]){delete _0x389d34[_0x3d40('0x2a')];}_0x504c72['status'](_0x26844b)[_0x3d40('0x2b')](_0x389d34);};}exports[_0x3d40('0x2c')]=function(_0x336f0d,_0x23b7d2){var _0x30d626={},_0x2db6f3={},_0x17316b={'count':0x0,'rows':[]};var _0x19cc1f=_['map'](db['Sound'][_0x3d40('0x2d')],function(_0xcb3c3b){return{'name':_0xcb3c3b['fieldName'],'type':_0xcb3c3b[_0x3d40('0x2e')]['key']};});_0x2db6f3[_0x3d40('0x2f')]=_['map'](_0x19cc1f,_0x3d40('0x2a'));_0x2db6f3[_0x3d40('0x30')]=_[_0x3d40('0x31')](_0x336f0d[_0x3d40('0x30')]);_0x2db6f3[_0x3d40('0x32')]=_['intersection'](_0x2db6f3['model'],_0x2db6f3[_0x3d40('0x30')]);_0x30d626[_0x3d40('0x33')]=_[_0x3d40('0x34')](_0x2db6f3['model'],qs[_0x3d40('0x35')](_0x336f0d['query']['fields']));_0x30d626['attributes']=_0x30d626[_0x3d40('0x33')][_0x3d40('0x36')]?_0x30d626[_0x3d40('0x33')]:_0x2db6f3[_0x3d40('0x2f')];if(!_0x336f0d[_0x3d40('0x30')][_0x3d40('0x37')](_0x3d40('0x38'))){_0x30d626[_0x3d40('0x1d')]=qs[_0x3d40('0x1d')](_0x336f0d['query']['limit']);_0x30d626[_0x3d40('0x1c')]=qs[_0x3d40('0x1c')](_0x336f0d[_0x3d40('0x30')][_0x3d40('0x1c')]);}_0x30d626[_0x3d40('0x39')]=qs[_0x3d40('0x3a')](_0x336f0d['query'][_0x3d40('0x3a')]);_0x30d626[_0x3d40('0x3b')]=qs[_0x3d40('0x32')](_['pick'](_0x336f0d[_0x3d40('0x30')],_0x2db6f3['filters']),_0x19cc1f);if(_0x336f0d[_0x3d40('0x30')][_0x3d40('0x3c')]){_0x30d626['where']=_[_0x3d40('0x3d')](_0x30d626['where'],{'$or':_['map'](_0x19cc1f,function(_0x184dcd){if(_0x184dcd[_0x3d40('0x2e')]!=='VIRTUAL'){var _0x3dd94f={};_0x3dd94f[_0x184dcd[_0x3d40('0x2a')]]={'$like':'%'+_0x336f0d[_0x3d40('0x30')]['filter']+'%'};return _0x3dd94f;}})});}_0x30d626=_[_0x3d40('0x3d')]({},_0x30d626,_0x336f0d[_0x3d40('0x3e')]);var _0xab2950={'where':_0x30d626[_0x3d40('0x3b')]};return db[_0x3d40('0x3f')][_0x3d40('0x40')](_0xab2950)[_0x3d40('0x23')](function(_0x368e09){_0x17316b[_0x3d40('0x40')]=_0x368e09;if(_0x336f0d[_0x3d40('0x30')][_0x3d40('0x41')]){_0x30d626['include']=[{'all':!![]}];}return db[_0x3d40('0x3f')]['findAll'](_0x30d626);})['then'](function(_0x57cd83){_0x17316b[_0x3d40('0x42')]=_0x57cd83;return _0x17316b;})[_0x3d40('0x23')](respondWithFilteredResult(_0x23b7d2,_0x30d626))[_0x3d40('0x43')](handleError(_0x23b7d2,null));};exports['show']=function(_0x260251,_0x46527d){var _0x46e59d={'raw':!![],'where':{'id':_0x260251['params']['id']}},_0x433b4a={};_0x433b4a[_0x3d40('0x2f')]=_[_0x3d40('0x31')](db[_0x3d40('0x3f')][_0x3d40('0x2d')]);_0x433b4a[_0x3d40('0x30')]=_[_0x3d40('0x31')](_0x260251[_0x3d40('0x30')]);_0x433b4a[_0x3d40('0x32')]=_[_0x3d40('0x34')](_0x433b4a[_0x3d40('0x2f')],_0x433b4a['query']);_0x46e59d['attributes']=_[_0x3d40('0x34')](_0x433b4a[_0x3d40('0x2f')],qs[_0x3d40('0x35')](_0x260251[_0x3d40('0x30')][_0x3d40('0x35')]));_0x46e59d[_0x3d40('0x33')]=_0x46e59d[_0x3d40('0x33')][_0x3d40('0x36')]?_0x46e59d[_0x3d40('0x33')]:_0x433b4a['model'];if(_0x260251['query'][_0x3d40('0x41')]){_0x46e59d[_0x3d40('0x44')]=[{'all':!![]}];}_0x46e59d=_[_0x3d40('0x3d')]({},_0x46e59d,_0x260251[_0x3d40('0x3e')]);return db[_0x3d40('0x3f')]['find'](_0x46e59d)[_0x3d40('0x23')](handleEntityNotFound(_0x46527d,null))[_0x3d40('0x23')](respondWithResult(_0x46527d,null))['catch'](handleError(_0x46527d,null));};exports['download']=function(_0x5a8fee,_0x1256ff,_0x4706b3){return db[_0x3d40('0x3f')]['find']({'where':{'id':_0x5a8fee[_0x3d40('0x45')]['id']},'attributes':['name','save_name',_0x3d40('0x46')],'raw':!![]})[_0x3d40('0x23')](handleEntityNotFound(_0x1256ff,null))[_0x3d40('0x23')](function(_0x20f37e){if(_0x20f37e){if(!fs['existsSync'](path[_0x3d40('0x47')](config['root'],_0x3d40('0x48'),_0x20f37e[_0x3d40('0x49')]+'.'+_0x20f37e['converted_format']))){throw new db['Sequelize'][(_0x3d40('0x4a'))](_0x3d40('0x4b'));}return _0x1256ff[_0x3d40('0x4c')](path[_0x3d40('0x47')](config[_0x3d40('0x4d')],'server/files/sounds/converted',util['format'](_0x3d40('0x4e'),_0x20f37e[_0x3d40('0x49')],_0x20f37e[_0x3d40('0x46')])),util[_0x3d40('0x4f')](_0x3d40('0x4e'),_0x20f37e[_0x3d40('0x2a')],_0x20f37e['converted_format']));}return null;})[_0x3d40('0x43')](handleError(_0x1256ff,null));};exports[_0x3d40('0x50')]=function(_0x1365e4,_0x10223d,_0x291c47){var _0x457700={'name':path[_0x3d40('0x51')](_0x1365e4[_0x3d40('0x52')][_0x3d40('0x53')],path[_0x3d40('0x54')](_0x1365e4[_0x3d40('0x52')][_0x3d40('0x53')])),'save_name':path[_0x3d40('0x51')](_0x1365e4[_0x3d40('0x52')]['filename'],path['extname'](_0x1365e4['file']['filename'])),'original_format':path['extname'](_0x1365e4[_0x3d40('0x52')]['originalname'])[_0x3d40('0x55')](0x1),'converted_format':_0x3d40('0x56')};var _0x4cae99=path[_0x3d40('0x47')](config[_0x3d40('0x4d')],'server/files/sounds/original',_0x1365e4[_0x3d40('0x52')][_0x3d40('0x57')]);var _0x44f00f=path['join'](config[_0x3d40('0x4d')],'server/files/sounds/converted',util[_0x3d40('0x4f')]('%s.%s',path['basename'](_0x1365e4['file'][_0x3d40('0x57')],path[_0x3d40('0x54')](_0x1365e4['file'][_0x3d40('0x57')])),_0x457700['converted_format']));logger['info'](_0x3d40('0x58'),_0x4cae99);logger['info'](_0x3d40('0x59'),_0x44f00f);try{fs['chmodSync'](_0x4cae99,parseInt('0777',0x8));var _0x1471f7=sox['transcode'](_0x4cae99,_0x44f00f,{'sampleRate':0x1f40,'format':_0x3d40('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1471f7['on'](_0x3d40('0x5a'),function(_0x191447){fs[_0x3d40('0x5b')](_0x4cae99);_0x10223d[_0x3d40('0x1e')](0x1f4)['send'](_0x191447);});_0x1471f7['on'](_0x3d40('0x5c'),function(_0x1d6445){_0x457700[_0x3d40('0x5d')]=isNaN(_0x1d6445[_0x3d40('0x5e')])?null:_0x1d6445['duration']*0x3e8;_0x457700[_0x3d40('0x5f')]=isNaN(_0x1d6445[_0x3d40('0x60')])?null:_0x1d6445[_0x3d40('0x60')];_0x457700['original_channelCount']=isNaN(_0x1d6445[_0x3d40('0x61')])?null:_0x1d6445[_0x3d40('0x61')];_0x457700[_0x3d40('0x62')]=isNaN(_0x1d6445[_0x3d40('0x63')])?null:_0x1d6445[_0x3d40('0x63')];_0x457700['original_sampleRate']=isNaN(_0x1d6445[_0x3d40('0x64')])?null:_0x1d6445[_0x3d40('0x64')];});_0x1471f7['on'](_0x3d40('0x65'),function(_0x1af29c){_0x457700[_0x3d40('0x66')]=isNaN(_0x1af29c[_0x3d40('0x5e')])?null:_0x1af29c[_0x3d40('0x5e')]*0x3e8;_0x457700['converted_sampleCount']=isNaN(_0x1af29c['sampleCount'])?null:_0x1af29c['sampleCount'];_0x457700['converted_channelCount']=isNaN(_0x1af29c[_0x3d40('0x61')])?null:_0x1af29c['channelCount'];_0x457700[_0x3d40('0x67')]=isNaN(_0x1af29c[_0x3d40('0x63')])?null:_0x1af29c[_0x3d40('0x63')];_0x457700[_0x3d40('0x68')]=isNaN(_0x1af29c[_0x3d40('0x64')])?null:_0x1af29c[_0x3d40('0x64')];});_0x1471f7['on'](_0x3d40('0x28'),function(){fs[_0x3d40('0x69')](_0x44f00f,parseInt(_0x3d40('0x6a'),0x8));return db['Sound'][_0x3d40('0x50')](_0x457700)[_0x3d40('0x23')](function(_0x1a4345){var _0x1d86f6={'role':_0x1365e4[_0x3d40('0x6b')][_0x3d40('0x6c')],'userProfileId':_0x1365e4[_0x3d40('0x6b')][_0x3d40('0x6d')]};if(!_0x1d86f6)throw new Error(_0x3d40('0x6e'));if(_0x1d86f6['role']===_0x3d40('0x6f')){var _0x11a7eb=_0x1a4345[_0x3d40('0x25')]({'plain':!![]});return db[_0x3d40('0x70')][_0x3d40('0x71')]({'where':{'name':_0x3d40('0x26'),'userProfileId':_0x1d86f6['userProfileId']},'raw':!![]})[_0x3d40('0x23')](function(_0x5cea69){if(_0x5cea69&&_0x5cea69[_0x3d40('0x72')]===0x0){return db[_0x3d40('0x27')]['create']({'name':_0x11a7eb['name'],'resourceId':_0x11a7eb['id'],'type':_0x5cea69[_0x3d40('0x2a')],'sectionId':_0x5cea69['id']},{})[_0x3d40('0x23')](function(){return _0x1a4345;});}else{return _0x1a4345;}})[_0x3d40('0x43')](function(_0x574c52){logger[_0x3d40('0x5a')](_0x3d40('0x73'),_0x574c52);throw _0x574c52;});}return _0x1a4345;})[_0x3d40('0x23')](respondWithResult(_0x10223d,null))['catch'](handleError(_0x10223d,null));});_0x1471f7[_0x3d40('0x74')]();}catch(_0x4feb69){_0x10223d[_0x3d40('0x1e')](0x1f4)[_0x3d40('0x2b')](_0x4feb69);}};exports[_0x3d40('0x22')]=function(_0x2ba5e2,_0x2b8638,_0x56a5d3){return db[_0x3d40('0x3f')]['find']({'where':{'id':_0x2ba5e2['params']['id']}})[_0x3d40('0x23')](handleEntityNotFound(_0x2b8638,null))['then'](saveUpdates(_[_0x3d40('0x75')](_0x2ba5e2[_0x3d40('0x6b')],[_0x3d40('0x2a'),'description']),null))['then'](respondWithResult(_0x2b8638,null))[_0x3d40('0x43')](handleError(_0x2b8638,null));};exports[_0x3d40('0x76')]=function(_0x534a1a,_0x4c6876,_0x403aa2){return db['Sound'][_0x3d40('0x71')]({'where':{'id':_0x534a1a[_0x3d40('0x45')]['id']}})[_0x3d40('0x23')](function(_0x4e7a6a){if(_0x4e7a6a){return _0x4e7a6a[_0x3d40('0x24')]();}})[_0x3d40('0x23')](function(_0x3355e3){var _0x3ad0a8=path[_0x3d40('0x47')](config[_0x3d40('0x4d')],_0x3d40('0x77'),util['format'](_0x3d40('0x4e'),_0x3355e3['save_name'],_0x3355e3[_0x3d40('0x78')]));var _0x388da8=path[_0x3d40('0x47')](config[_0x3d40('0x4d')],_0x3d40('0x48'),util['format'](_0x3d40('0x4e'),_0x3355e3[_0x3d40('0x49')],_0x3355e3['converted_format']));fs[_0x3d40('0x5b')](_0x3ad0a8);fs['unlinkSync'](_0x388da8);return _0x3355e3;})[_0x3d40('0x23')](function(_0x24d802){if(_0x24d802){return _0x4c6876[_0x3d40('0x1e')](0xcc)[_0x3d40('0x28')]();}})[_0x3d40('0x23')](handleEntityNotFound(_0x4c6876,null))[_0x3d40('0x43')](handleError(_0x4c6876,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 38846d8..a73f3c7 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 _0x8d11=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','Sound','tools_sounds'];(function(_0x1808b2,_0x35f5a6){var _0x498147=function(_0x17d30a){while(--_0x17d30a){_0x1808b2['push'](_0x1808b2['shift']());}};_0x498147(++_0x35f5a6);}(_0x8d11,0x15f));var _0x18d1=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x8d11[_0x4ded65];return _0x5864fb;};'use strict';var _=require(_0x18d1('0x0'));var util=require(_0x18d1('0x1'));var logger=require('../../config/logger')(_0x18d1('0x2'));var moment=require(_0x18d1('0x3'));var BPromise=require(_0x18d1('0x4'));var rp=require(_0x18d1('0x5'));var fs=require('fs');var path=require(_0x18d1('0x6'));var rimraf=require(_0x18d1('0x7'));var config=require(_0x18d1('0x8'));var attributes=require(_0x18d1('0x9'));module[_0x18d1('0xa')]=function(_0x50a942,_0x236329){return _0x50a942['define'](_0x18d1('0xb'),attributes,{'tableName':_0x18d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c36=['../../config/environment','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c36,0x1ef));var _0x68c3=function(_0x426280,_0x31cc10){_0x426280=_0x426280-0x0;var _0x39fa5e=_0x8c36[_0x426280];return _0x39fa5e;};'use strict';var _=require(_0x68c3('0x0'));var util=require(_0x68c3('0x1'));var logger=require(_0x68c3('0x2'))(_0x68c3('0x3'));var moment=require(_0x68c3('0x4'));var BPromise=require(_0x68c3('0x5'));var rp=require(_0x68c3('0x6'));var fs=require('fs');var path=require(_0x68c3('0x7'));var rimraf=require(_0x68c3('0x8'));var config=require(_0x68c3('0x9'));var attributes=require('./sound.attributes');module['exports']=function(_0x203ee8,_0x95c78e){return _0x203ee8['define'](_0x68c3('0xa'),attributes,{'tableName':_0x68c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 229f383..77cb458 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 _0x909a=['catch','ShowSound','Sound','options','raw','where','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x208d4d,_0x3f720c){var _0x594e97=function(_0x256e8f){while(--_0x256e8f){_0x208d4d['push'](_0x208d4d['shift']());}};_0x594e97(++_0x3f720c);}(_0x909a,0x197));var _0xa909=function(_0x2e752b,_0x5cb17d){_0x2e752b=_0x2e752b-0x0;var _0x40a0b4=_0x909a[_0x2e752b];return _0x40a0b4;};'use strict';var _=require(_0xa909('0x0'));var util=require(_0xa909('0x1'));var moment=require(_0xa909('0x2'));var BPromise=require(_0xa909('0x3'));var rs=require(_0xa909('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa909('0x5'))['db'];var utils=require(_0xa909('0x6'));var logger=require(_0xa909('0x7'))('rpc');var config=require(_0xa909('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa909('0x9')][_0xa909('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52f84d,_0xc1f922,_0x2e7b73){return new BPromise(function(_0x401888,_0xded6f1){return client[_0xa909('0xb')](_0x52f84d,_0x2e7b73)['then'](function(_0x4d4155){logger[_0xa909('0xc')](_0xa909('0xd'),_0xc1f922,_0xa909('0xe'));logger[_0xa909('0xf')](_0xa909('0x10'),_0xc1f922,_0xa909('0xe'),JSON[_0xa909('0x11')](_0x4d4155));if(_0x4d4155['error']){if(_0x4d4155[_0xa909('0x12')][_0xa909('0x13')]===0x1f4){logger['error'](_0xa909('0xd'),_0xc1f922,_0x4d4155[_0xa909('0x12')][_0xa909('0x14')]);return _0xded6f1(_0x4d4155[_0xa909('0x12')][_0xa909('0x14')]);}logger[_0xa909('0x12')](_0xa909('0xd'),_0xc1f922,_0x4d4155[_0xa909('0x12')][_0xa909('0x14')]);return _0x401888(_0x4d4155['error'][_0xa909('0x14')]);}else{logger['info'](_0xa909('0xd'),_0xc1f922,_0xa909('0xe'));_0x401888(_0x4d4155[_0xa909('0x15')][_0xa909('0x14')]);}})[_0xa909('0x16')](function(_0x3b5e52){logger['error'](_0xa909('0xd'),_0xc1f922,_0x3b5e52);_0xded6f1(_0x3b5e52);});});}exports[_0xa909('0x17')]=function(_0x5add28){var _0x14cbf8=this;return new Promise(function(_0x52e696,_0x553b8b){return db[_0xa909('0x18')]['find']({'raw':_0x5add28[_0xa909('0x19')]?_0x5add28[_0xa909('0x19')][_0xa909('0x1a')]===undefined?!![]:![]:!![],'where':_0x5add28[_0xa909('0x19')]?_0x5add28[_0xa909('0x19')][_0xa909('0x1b')]||null:null,'attributes':_0x5add28[_0xa909('0x19')]?_0x5add28[_0xa909('0x19')][_0xa909('0x1c')]||null:null,'include':_0x5add28[_0xa909('0x19')]?_0x5add28[_0xa909('0x19')]['include']?_[_0xa909('0x1d')](_0x5add28[_0xa909('0x19')][_0xa909('0x1e')],function(_0x57fe1a){return{'model':db[_0x57fe1a[_0xa909('0x1f')]],'as':_0x57fe1a['as'],'attributes':_0x57fe1a[_0xa909('0x1c')],'include':_0x57fe1a[_0xa909('0x1e')]?_[_0xa909('0x1d')](_0x57fe1a[_0xa909('0x1e')],function(_0x31a9eb){return{'model':db[_0x31a9eb['model']],'as':_0x31a9eb['as'],'attributes':_0x31a9eb[_0xa909('0x1c')],'include':_0x31a9eb['include']?_[_0xa909('0x1d')](_0x31a9eb[_0xa909('0x1e')],function(_0x34ea57){return{'model':db[_0x34ea57[_0xa909('0x1f')]],'as':_0x34ea57['as'],'attributes':_0x34ea57[_0xa909('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa909('0x20')](function(_0x59b687){logger['info'](_0xa909('0x17'),_0x5add28);logger[_0xa909('0xf')](_0xa909('0x17'),_0x5add28,JSON[_0xa909('0x11')](_0x59b687));_0x52e696(_0x59b687);})[_0xa909('0x16')](function(_0x30e554){logger[_0xa909('0x12')]('ShowSound',_0x30e554['message'],_0x5add28);_0x553b8b(_0x14cbf8[_0xa909('0x12')](0x1f4,_0x30e554['message']));});});}; \ No newline at end of file +var _0xb67c=['where','attributes','map','include','model','then','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Sound','find','options','raw'];(function(_0x123710,_0x533837){var _0x27eda2=function(_0x2bf2ba){while(--_0x2bf2ba){_0x123710['push'](_0x123710['shift']());}};_0x27eda2(++_0x533837);}(_0xb67c,0x1c7));var _0xcb67=function(_0x39de58,_0x158a4c){_0x39de58=_0x39de58-0x0;var _0x5ce2d1=_0xb67c[_0x39de58];return _0x5ce2d1;};'use strict';var _=require(_0xcb67('0x0'));var util=require(_0xcb67('0x1'));var moment=require(_0xcb67('0x2'));var BPromise=require(_0xcb67('0x3'));var rs=require(_0xcb67('0x4'));var fs=require('fs');var Redis=require(_0xcb67('0x5'));var db=require(_0xcb67('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb67('0x7'))(_0xcb67('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcb67('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4848cf,_0x32c38f,_0x57e1c4){return new BPromise(function(_0x210aaf,_0x42c563){return client['request'](_0x4848cf,_0x57e1c4)['then'](function(_0x7aa622){logger['info'](_0xcb67('0xa'),_0x32c38f,_0xcb67('0xb'));logger[_0xcb67('0xc')](_0xcb67('0xd'),_0x32c38f,_0xcb67('0xb'),JSON[_0xcb67('0xe')](_0x7aa622));if(_0x7aa622[_0xcb67('0xf')]){if(_0x7aa622['error'][_0xcb67('0x10')]===0x1f4){logger[_0xcb67('0xf')]('Sound,\x20%s,\x20%s',_0x32c38f,_0x7aa622['error']['message']);return _0x42c563(_0x7aa622[_0xcb67('0xf')]['message']);}logger[_0xcb67('0xf')](_0xcb67('0xa'),_0x32c38f,_0x7aa622['error']['message']);return _0x210aaf(_0x7aa622[_0xcb67('0xf')][_0xcb67('0x11')]);}else{logger[_0xcb67('0x12')](_0xcb67('0xa'),_0x32c38f,_0xcb67('0xb'));_0x210aaf(_0x7aa622[_0xcb67('0x13')][_0xcb67('0x11')]);}})[_0xcb67('0x14')](function(_0xc131fd){logger[_0xcb67('0xf')]('Sound,\x20%s,\x20%s',_0x32c38f,_0xc131fd);_0x42c563(_0xc131fd);});});}exports['ShowSound']=function(_0x43184c){var _0x183165=this;return new Promise(function(_0xae8847,_0x1ebe1a){return db[_0xcb67('0x15')][_0xcb67('0x16')]({'raw':_0x43184c['options']?_0x43184c[_0xcb67('0x17')][_0xcb67('0x18')]===undefined?!![]:![]:!![],'where':_0x43184c[_0xcb67('0x17')]?_0x43184c['options'][_0xcb67('0x19')]||null:null,'attributes':_0x43184c[_0xcb67('0x17')]?_0x43184c['options'][_0xcb67('0x1a')]||null:null,'include':_0x43184c[_0xcb67('0x17')]?_0x43184c[_0xcb67('0x17')]['include']?_[_0xcb67('0x1b')](_0x43184c[_0xcb67('0x17')][_0xcb67('0x1c')],function(_0x2d5c2f){return{'model':db[_0x2d5c2f['model']],'as':_0x2d5c2f['as'],'attributes':_0x2d5c2f[_0xcb67('0x1a')],'include':_0x2d5c2f[_0xcb67('0x1c')]?_[_0xcb67('0x1b')](_0x2d5c2f[_0xcb67('0x1c')],function(_0x5b69c8){return{'model':db[_0x5b69c8[_0xcb67('0x1d')]],'as':_0x5b69c8['as'],'attributes':_0x5b69c8[_0xcb67('0x1a')],'include':_0x5b69c8[_0xcb67('0x1c')]?_['map'](_0x5b69c8['include'],function(_0x4bf03e){return{'model':db[_0x4bf03e[_0xcb67('0x1d')]],'as':_0x4bf03e['as'],'attributes':_0x4bf03e[_0xcb67('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcb67('0x1e')](function(_0x3b5b77){logger[_0xcb67('0x12')](_0xcb67('0x1f'),_0x43184c);logger[_0xcb67('0xc')](_0xcb67('0x1f'),_0x43184c,JSON[_0xcb67('0xe')](_0x3b5b77));_0xae8847(_0x3b5b77);})['catch'](function(_0x192806){logger['error']('ShowSound',_0x192806[_0xcb67('0x11')],_0x43184c);_0x1ebe1a(_0x183165['error'](0x1f4,_0x192806[_0xcb67('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ea50356..07a9ecb 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 _0xe59e=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xe59e,0x64));var _0xee59=function(_0x511b9b,_0x4516c9){_0x511b9b=_0x511b9b-0x0;var _0x9ce318=_0xe59e[_0x511b9b];return _0x9ce318;};'use strict';var multer=require(_0xee59('0x0'));var util=require(_0xee59('0x1'));var path=require(_0xee59('0x2'));var timeout=require(_0xee59('0x3'));var express=require(_0xee59('0x4'));var router=express[_0xee59('0x5')]();var auth=require(_0xee59('0x6'));var interaction=require(_0xee59('0x7'));var config=require(_0xee59('0x8'));var controller=require(_0xee59('0x9'));router[_0xee59('0xa')]('/',auth[_0xee59('0xb')](),controller[_0xee59('0xc')]);router[_0xee59('0xa')](_0xee59('0xd'),auth[_0xee59('0xb')](),controller[_0xee59('0xe')]);router[_0xee59('0xf')]('/',auth['isAuthenticated'](),controller[_0xee59('0x10')]);router[_0xee59('0x11')](_0xee59('0xd'),auth[_0xee59('0xb')](),controller[_0xee59('0x12')]);router['delete'](_0xee59('0xd'),auth[_0xee59('0xb')](),controller[_0xee59('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfa19=['express','Router','../../components/auth/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3060e3,_0x14f2c6){var _0x497d2c=function(_0x2a274a){while(--_0x2a274a){_0x3060e3['push'](_0x3060e3['shift']());}};_0x497d2c(++_0x14f2c6);}(_0xfa19,0x153));var _0x9fa1=function(_0x416917,_0x3a3e47){_0x416917=_0x416917-0x0;var _0x317483=_0xfa19[_0x416917];return _0x317483;};'use strict';var multer=require(_0x9fa1('0x0'));var util=require(_0x9fa1('0x1'));var path=require('path');var timeout=require(_0x9fa1('0x2'));var express=require(_0x9fa1('0x3'));var router=express[_0x9fa1('0x4')]();var auth=require(_0x9fa1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9fa1('0x6'));var controller=require(_0x9fa1('0x7'));router[_0x9fa1('0x8')]('/',auth[_0x9fa1('0x9')](),controller[_0x9fa1('0xa')]);router[_0x9fa1('0x8')]('/:id',auth[_0x9fa1('0x9')](),controller[_0x9fa1('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9fa1('0xc')]);router[_0x9fa1('0xd')](_0x9fa1('0xe'),auth[_0x9fa1('0x9')](),controller[_0x9fa1('0xf')]);router[_0x9fa1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9fa1('0x11')]);module[_0x9fa1('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index dbc8dbb..b677d19 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 _0xce3d=['TEXT','medium','ENUM','sequelize','exports','STRING'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xce3d,0x81));var _0xdce3=function(_0x59f0f7,_0x423bc4){_0x59f0f7=_0x59f0f7-0x0;var _0xf5ef2a=_0xce3d[_0x59f0f7];return _0xf5ef2a;};'use strict';var Sequelize=require(_0xdce3('0x0'));module[_0xdce3('0x1')]={'uniqueid':{'type':Sequelize[_0xdce3('0x2')]},'body':{'type':Sequelize[_0xdce3('0x3')](_0xdce3('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xdce3('0x5')]('in','out'),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0x0ece=['STRING','TEXT','medium','ENUM','sequelize','exports'];(function(_0x59e09e,_0x501234){var _0xe86027=function(_0x3104d){while(--_0x3104d){_0x59e09e['push'](_0x59e09e['shift']());}};_0xe86027(++_0x501234);}(_0x0ece,0x1c0));var _0xe0ec=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0ece[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xe0ec('0x0'));module[_0xe0ec('0x1')]={'uniqueid':{'type':Sequelize[_0xe0ec('0x2')]},'body':{'type':Sequelize[_0xe0ec('0x3')](_0xe0ec('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xe0ec('0x5')]('in','out'),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1ed0d93..55b9cb6 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 _0xbc07=['type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','show','options','find','catch','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','name','send','index','SquareMessage','rawAttributes','fieldName'];(function(_0x2bc6b8,_0x24f5b0){var _0x1b5ce6=function(_0x3dcab1){while(--_0x3dcab1){_0x2bc6b8['push'](_0x2bc6b8['shift']());}};_0x1b5ce6(++_0x24f5b0);}(_0xbc07,0xa4));var _0x7bc0=function(_0x3eb844,_0x5d6cac){_0x3eb844=_0x3eb844-0x0;var _0x1f430a=_0xbc07[_0x3eb844];return _0x1f430a;};'use strict';var pdf=require(_0x7bc0('0x0'));var emlformat=require(_0x7bc0('0x1'));var rimraf=require(_0x7bc0('0x2'));var zipdir=require(_0x7bc0('0x3'));var jsonpatch=require(_0x7bc0('0x4'));var rp=require('request-promise');var moment=require(_0x7bc0('0x5'));var BPromise=require(_0x7bc0('0x6'));var Mustache=require(_0x7bc0('0x7'));var util=require(_0x7bc0('0x8'));var path=require(_0x7bc0('0x9'));var sox=require(_0x7bc0('0xa'));var csv=require(_0x7bc0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7bc0('0xc'));var squel=require(_0x7bc0('0xd'));var crypto=require('crypto');var jsforce=require(_0x7bc0('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7bc0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7bc0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7bc0('0x11'));var hardwareService=require(_0x7bc0('0x12'));var logger=require('../../config/logger')(_0x7bc0('0x13'));var utils=require(_0x7bc0('0x14'));var config=require(_0x7bc0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe647af,_0x2588d0){_0x2588d0=_0x2588d0||0xcc;return function(_0x42207c){if(_0x42207c){return _0xe647af[_0x7bc0('0x16')](_0x2588d0);}return _0xe647af[_0x7bc0('0x17')](_0x2588d0)[_0x7bc0('0x18')]();};}function respondWithResult(_0x518838,_0x5d3a17){_0x5d3a17=_0x5d3a17||0xc8;return function(_0x302022){if(_0x302022){return _0x518838[_0x7bc0('0x17')](_0x5d3a17)[_0x7bc0('0x19')](_0x302022);}};}function respondWithFilteredResult(_0x33a9af,_0x5e4d84){return function(_0x56d9a3){if(_0x56d9a3){var _0x5a6b85=_0x56d9a3[_0x7bc0('0x1a')],_0x39b3bb=_0x5e4d84[_0x7bc0('0x1b')],_0x10025d=_0x5e4d84['offset']+_0x5e4d84[_0x7bc0('0x1c')],_0x588213;if(_0x10025d>=_0x5a6b85){_0x10025d=_0x5a6b85;_0x588213=0xc8;}else{_0x588213=0xce;}_0x33a9af[_0x7bc0('0x17')](_0x588213);return _0x33a9af[_0x7bc0('0x1d')]('Content-Range',_0x39b3bb+'-'+_0x10025d+'/'+_0x5a6b85)[_0x7bc0('0x19')](_0x56d9a3);}return null;};}function patchUpdates(_0x3f9ab9){return function(_0x554011){try{jsonpatch[_0x7bc0('0x1e')](_0x554011,_0x3f9ab9,!![]);}catch(_0x570873){return BPromise['reject'](_0x570873);}return _0x554011[_0x7bc0('0x1f')]();};}function saveUpdates(_0x2cbcb4,_0x5426ca){return function(_0x85f8d7){if(_0x85f8d7){return _0x85f8d7[_0x7bc0('0x20')](_0x2cbcb4)[_0x7bc0('0x21')](function(_0x3ea271){return _0x3ea271;});}return null;};}function removeEntity(_0x1936ed,_0x379c66){return function(_0x500d1e){if(_0x500d1e){return _0x500d1e['destroy']()[_0x7bc0('0x21')](function(){_0x1936ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x69c866,_0x4f1996){return function(_0x46f6d5){if(!_0x46f6d5){_0x69c866[_0x7bc0('0x16')](0x194);}return _0x46f6d5;};}function handleError(_0x386bc7,_0x4acfc1){_0x4acfc1=_0x4acfc1||0x1f4;return function(_0x35bd27){logger['error'](_0x35bd27['stack']);if(_0x35bd27[_0x7bc0('0x22')]){delete _0x35bd27[_0x7bc0('0x22')];}_0x386bc7['status'](_0x4acfc1)[_0x7bc0('0x23')](_0x35bd27);};}exports[_0x7bc0('0x24')]=function(_0x5a9aa0,_0x2cfe2e){var _0x10a876={},_0x37ba2a={},_0x39c31a={'count':0x0,'rows':[]};var _0x1f514f=_['map'](db[_0x7bc0('0x25')][_0x7bc0('0x26')],function(_0x536be5){return{'name':_0x536be5[_0x7bc0('0x27')],'type':_0x536be5[_0x7bc0('0x28')][_0x7bc0('0x29')]};});_0x37ba2a[_0x7bc0('0x2a')]=_[_0x7bc0('0x2b')](_0x1f514f,'name');_0x37ba2a[_0x7bc0('0x2c')]=_[_0x7bc0('0x2d')](_0x5a9aa0[_0x7bc0('0x2c')]);_0x37ba2a[_0x7bc0('0x2e')]=_['intersection'](_0x37ba2a['model'],_0x37ba2a[_0x7bc0('0x2c')]);_0x10a876[_0x7bc0('0x2f')]=_[_0x7bc0('0x30')](_0x37ba2a[_0x7bc0('0x2a')],qs[_0x7bc0('0x31')](_0x5a9aa0[_0x7bc0('0x2c')][_0x7bc0('0x31')]));_0x10a876[_0x7bc0('0x2f')]=_0x10a876[_0x7bc0('0x2f')][_0x7bc0('0x32')]?_0x10a876[_0x7bc0('0x2f')]:_0x37ba2a[_0x7bc0('0x2a')];if(!_0x5a9aa0[_0x7bc0('0x2c')]['hasOwnProperty']('nolimit')){_0x10a876[_0x7bc0('0x1c')]=qs[_0x7bc0('0x1c')](_0x5a9aa0[_0x7bc0('0x2c')][_0x7bc0('0x1c')]);_0x10a876['offset']=qs[_0x7bc0('0x1b')](_0x5a9aa0[_0x7bc0('0x2c')]['offset']);}_0x10a876[_0x7bc0('0x33')]=qs[_0x7bc0('0x34')](_0x5a9aa0['query'][_0x7bc0('0x34')]);_0x10a876[_0x7bc0('0x35')]=qs[_0x7bc0('0x2e')](_[_0x7bc0('0x36')](_0x5a9aa0[_0x7bc0('0x2c')],_0x37ba2a[_0x7bc0('0x2e')]),_0x1f514f);if(_0x5a9aa0[_0x7bc0('0x2c')][_0x7bc0('0x37')]){_0x10a876[_0x7bc0('0x35')]=_[_0x7bc0('0x38')](_0x10a876['where'],{'$or':_['map'](_0x1f514f,function(_0x383347){if(_0x383347[_0x7bc0('0x28')]!==_0x7bc0('0x39')){var _0x9363dc={};_0x9363dc[_0x383347['name']]={'$like':'%'+_0x5a9aa0[_0x7bc0('0x2c')]['filter']+'%'};return _0x9363dc;}})});}_0x10a876=_['merge']({},_0x10a876,_0x5a9aa0['options']);var _0x3a3043={'where':_0x10a876[_0x7bc0('0x35')]};return db[_0x7bc0('0x25')]['count'](_0x3a3043)['then'](function(_0x401007){_0x39c31a[_0x7bc0('0x1a')]=_0x401007;if(_0x5a9aa0[_0x7bc0('0x2c')]['includeAll']){_0x10a876[_0x7bc0('0x3a')]=[{'all':!![]}];}return db[_0x7bc0('0x25')]['findAll'](_0x10a876);})[_0x7bc0('0x21')](function(_0x220452){_0x39c31a[_0x7bc0('0x3b')]=_0x220452;return _0x39c31a;})[_0x7bc0('0x21')](respondWithFilteredResult(_0x2cfe2e,_0x10a876))['catch'](handleError(_0x2cfe2e,null));};exports[_0x7bc0('0x3c')]=function(_0x5f3673,_0x1ba631){var _0x3de4fe={'raw':!![],'where':{'id':_0x5f3673['params']['id']}},_0x27b9f7={};_0x27b9f7[_0x7bc0('0x2a')]=_[_0x7bc0('0x2d')](db[_0x7bc0('0x25')][_0x7bc0('0x26')]);_0x27b9f7[_0x7bc0('0x2c')]=_[_0x7bc0('0x2d')](_0x5f3673[_0x7bc0('0x2c')]);_0x27b9f7['filters']=_[_0x7bc0('0x30')](_0x27b9f7['model'],_0x27b9f7[_0x7bc0('0x2c')]);_0x3de4fe[_0x7bc0('0x2f')]=_[_0x7bc0('0x30')](_0x27b9f7['model'],qs[_0x7bc0('0x31')](_0x5f3673[_0x7bc0('0x2c')][_0x7bc0('0x31')]));_0x3de4fe[_0x7bc0('0x2f')]=_0x3de4fe[_0x7bc0('0x2f')][_0x7bc0('0x32')]?_0x3de4fe[_0x7bc0('0x2f')]:_0x27b9f7[_0x7bc0('0x2a')];if(_0x5f3673[_0x7bc0('0x2c')]['includeAll']){_0x3de4fe[_0x7bc0('0x3a')]=[{'all':!![]}];}_0x3de4fe=_['merge']({},_0x3de4fe,_0x5f3673[_0x7bc0('0x3d')]);return db['SquareMessage'][_0x7bc0('0x3e')](_0x3de4fe)[_0x7bc0('0x21')](handleEntityNotFound(_0x1ba631,null))[_0x7bc0('0x21')](respondWithResult(_0x1ba631,null))[_0x7bc0('0x3f')](handleError(_0x1ba631,null));};exports[_0x7bc0('0x40')]=function(_0x371431,_0x289469){return db[_0x7bc0('0x25')]['create'](_0x371431['body'],{})[_0x7bc0('0x21')](respondWithResult(_0x289469,0xc9))[_0x7bc0('0x3f')](handleError(_0x289469,null));};exports[_0x7bc0('0x20')]=function(_0x4d55a3,_0x51cab2){if(_0x4d55a3[_0x7bc0('0x41')]['id']){delete _0x4d55a3[_0x7bc0('0x41')]['id'];}return db[_0x7bc0('0x25')][_0x7bc0('0x3e')]({'where':{'id':_0x4d55a3[_0x7bc0('0x42')]['id']}})[_0x7bc0('0x21')](handleEntityNotFound(_0x51cab2,null))[_0x7bc0('0x21')](saveUpdates(_0x4d55a3[_0x7bc0('0x41')],null))[_0x7bc0('0x21')](respondWithResult(_0x51cab2,null))[_0x7bc0('0x3f')](handleError(_0x51cab2,null));};exports[_0x7bc0('0x43')]=function(_0x14a02f,_0x5ec913){return db[_0x7bc0('0x25')]['find']({'where':{'id':_0x14a02f[_0x7bc0('0x42')]['id']}})[_0x7bc0('0x21')](handleEntityNotFound(_0x5ec913,null))[_0x7bc0('0x21')](removeEntity(_0x5ec913,null))['catch'](handleError(_0x5ec913,null));}; \ No newline at end of file +var _0x3097=['mustache','util','path','sox','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','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','limit','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x36c120,_0xcedf64){var _0x5602ea=function(_0x1dc844){while(--_0x1dc844){_0x36c120['push'](_0x36c120['shift']());}};_0x5602ea(++_0xcedf64);}(_0x3097,0xd3));var _0x7309=function(_0x1e7eff,_0x57b53c){_0x1e7eff=_0x1e7eff-0x0;var _0x34c078=_0x3097[_0x1e7eff];return _0x34c078;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7309('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7309('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7309('0x2'));var moment=require(_0x7309('0x3'));var BPromise=require(_0x7309('0x4'));var Mustache=require(_0x7309('0x5'));var util=require(_0x7309('0x6'));var path=require(_0x7309('0x7'));var sox=require(_0x7309('0x8'));var csv=require('to-csv');var ejs=require(_0x7309('0x9'));var fs=require('fs');var _=require(_0x7309('0xa'));var squel=require(_0x7309('0xb'));var crypto=require(_0x7309('0xc'));var jsforce=require(_0x7309('0xd'));var deskjs=require(_0x7309('0xe'));var toCsv=require(_0x7309('0xf'));var querystring=require(_0x7309('0x10'));var Papa=require('papaparse');var Redis=require(_0x7309('0x11'));var authService=require(_0x7309('0x12'));var qs=require(_0x7309('0x13'));var as=require(_0x7309('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7309('0x15'))(_0x7309('0x16'));var utils=require(_0x7309('0x17'));var config=require(_0x7309('0x18'));var db=require(_0x7309('0x19'))['db'];function respondWithStatusCode(_0x175087,_0x1d6759){_0x1d6759=_0x1d6759||0xcc;return function(_0x43514b){if(_0x43514b){return _0x175087[_0x7309('0x1a')](_0x1d6759);}return _0x175087[_0x7309('0x1b')](_0x1d6759)[_0x7309('0x1c')]();};}function respondWithResult(_0x473d16,_0x3f1391){_0x3f1391=_0x3f1391||0xc8;return function(_0x54aad2){if(_0x54aad2){return _0x473d16['status'](_0x3f1391)[_0x7309('0x1d')](_0x54aad2);}};}function respondWithFilteredResult(_0xfaa878,_0x569267){return function(_0x22d37e){if(_0x22d37e){var _0x324dd4=_0x22d37e[_0x7309('0x1e')],_0x6b3aec=_0x569267[_0x7309('0x1f')],_0x1c33cb=_0x569267[_0x7309('0x1f')]+_0x569267['limit'],_0x595b1c;if(_0x1c33cb>=_0x324dd4){_0x1c33cb=_0x324dd4;_0x595b1c=0xc8;}else{_0x595b1c=0xce;}_0xfaa878[_0x7309('0x1b')](_0x595b1c);return _0xfaa878[_0x7309('0x20')](_0x7309('0x21'),_0x6b3aec+'-'+_0x1c33cb+'/'+_0x324dd4)[_0x7309('0x1d')](_0x22d37e);}return null;};}function patchUpdates(_0x5c42d3){return function(_0x4ff745){try{jsonpatch['apply'](_0x4ff745,_0x5c42d3,!![]);}catch(_0x1f409){return BPromise[_0x7309('0x22')](_0x1f409);}return _0x4ff745[_0x7309('0x23')]();};}function saveUpdates(_0x438154,_0x780f91){return function(_0x5ddb6a){if(_0x5ddb6a){return _0x5ddb6a[_0x7309('0x24')](_0x438154)[_0x7309('0x25')](function(_0x1a213c){return _0x1a213c;});}return null;};}function removeEntity(_0x36c0d6,_0x515fd4){return function(_0x5481f2){if(_0x5481f2){return _0x5481f2[_0x7309('0x26')]()['then'](function(){_0x36c0d6[_0x7309('0x1b')](0xcc)[_0x7309('0x1c')]();});}};}function handleEntityNotFound(_0x4cf9b3,_0x3af51f){return function(_0x2e3af7){if(!_0x2e3af7){_0x4cf9b3[_0x7309('0x1a')](0x194);}return _0x2e3af7;};}function handleError(_0x54755e,_0x5bd967){_0x5bd967=_0x5bd967||0x1f4;return function(_0x3c17a2){logger['error'](_0x3c17a2[_0x7309('0x27')]);if(_0x3c17a2[_0x7309('0x28')]){delete _0x3c17a2[_0x7309('0x28')];}_0x54755e['status'](_0x5bd967)['send'](_0x3c17a2);};}exports[_0x7309('0x29')]=function(_0x48b95e,_0x42ad99){var _0x1a44b5={},_0x4db282={},_0x55f498={'count':0x0,'rows':[]};var _0x30fa08=_[_0x7309('0x2a')](db[_0x7309('0x2b')][_0x7309('0x2c')],function(_0x3a87fa){return{'name':_0x3a87fa[_0x7309('0x2d')],'type':_0x3a87fa[_0x7309('0x2e')][_0x7309('0x2f')]};});_0x4db282[_0x7309('0x30')]=_[_0x7309('0x2a')](_0x30fa08,_0x7309('0x28'));_0x4db282['query']=_[_0x7309('0x31')](_0x48b95e['query']);_0x4db282['filters']=_[_0x7309('0x32')](_0x4db282['model'],_0x4db282[_0x7309('0x33')]);_0x1a44b5[_0x7309('0x34')]=_[_0x7309('0x32')](_0x4db282['model'],qs[_0x7309('0x35')](_0x48b95e[_0x7309('0x33')][_0x7309('0x35')]));_0x1a44b5[_0x7309('0x34')]=_0x1a44b5[_0x7309('0x34')][_0x7309('0x36')]?_0x1a44b5[_0x7309('0x34')]:_0x4db282[_0x7309('0x30')];if(!_0x48b95e[_0x7309('0x33')]['hasOwnProperty'](_0x7309('0x37'))){_0x1a44b5[_0x7309('0x38')]=qs[_0x7309('0x38')](_0x48b95e[_0x7309('0x33')][_0x7309('0x38')]);_0x1a44b5[_0x7309('0x1f')]=qs[_0x7309('0x1f')](_0x48b95e[_0x7309('0x33')][_0x7309('0x1f')]);}_0x1a44b5['order']=qs[_0x7309('0x39')](_0x48b95e['query'][_0x7309('0x39')]);_0x1a44b5[_0x7309('0x3a')]=qs[_0x7309('0x3b')](_['pick'](_0x48b95e[_0x7309('0x33')],_0x4db282[_0x7309('0x3b')]),_0x30fa08);if(_0x48b95e[_0x7309('0x33')]['filter']){_0x1a44b5[_0x7309('0x3a')]=_[_0x7309('0x3c')](_0x1a44b5[_0x7309('0x3a')],{'$or':_[_0x7309('0x2a')](_0x30fa08,function(_0x1fbefc){if(_0x1fbefc['type']!==_0x7309('0x3d')){var _0x2b5ed4={};_0x2b5ed4[_0x1fbefc['name']]={'$like':'%'+_0x48b95e['query']['filter']+'%'};return _0x2b5ed4;}})});}_0x1a44b5=_[_0x7309('0x3c')]({},_0x1a44b5,_0x48b95e['options']);var _0x2415e7={'where':_0x1a44b5[_0x7309('0x3a')]};return db[_0x7309('0x2b')][_0x7309('0x1e')](_0x2415e7)[_0x7309('0x25')](function(_0x1f24db){_0x55f498[_0x7309('0x1e')]=_0x1f24db;if(_0x48b95e['query'][_0x7309('0x3e')]){_0x1a44b5[_0x7309('0x3f')]=[{'all':!![]}];}return db[_0x7309('0x2b')][_0x7309('0x40')](_0x1a44b5);})[_0x7309('0x25')](function(_0x4edc4f){_0x55f498[_0x7309('0x41')]=_0x4edc4f;return _0x55f498;})['then'](respondWithFilteredResult(_0x42ad99,_0x1a44b5))[_0x7309('0x42')](handleError(_0x42ad99,null));};exports['show']=function(_0x3a3256,_0x3068b3){var _0x3fdc51={'raw':!![],'where':{'id':_0x3a3256[_0x7309('0x43')]['id']}},_0x58a642={};_0x58a642[_0x7309('0x30')]=_[_0x7309('0x31')](db[_0x7309('0x2b')][_0x7309('0x2c')]);_0x58a642[_0x7309('0x33')]=_[_0x7309('0x31')](_0x3a3256[_0x7309('0x33')]);_0x58a642[_0x7309('0x3b')]=_[_0x7309('0x32')](_0x58a642[_0x7309('0x30')],_0x58a642['query']);_0x3fdc51[_0x7309('0x34')]=_['intersection'](_0x58a642[_0x7309('0x30')],qs[_0x7309('0x35')](_0x3a3256[_0x7309('0x33')][_0x7309('0x35')]));_0x3fdc51[_0x7309('0x34')]=_0x3fdc51[_0x7309('0x34')][_0x7309('0x36')]?_0x3fdc51[_0x7309('0x34')]:_0x58a642['model'];if(_0x3a3256[_0x7309('0x33')]['includeAll']){_0x3fdc51[_0x7309('0x3f')]=[{'all':!![]}];}_0x3fdc51=_[_0x7309('0x3c')]({},_0x3fdc51,_0x3a3256[_0x7309('0x44')]);return db[_0x7309('0x2b')][_0x7309('0x45')](_0x3fdc51)[_0x7309('0x25')](handleEntityNotFound(_0x3068b3,null))[_0x7309('0x25')](respondWithResult(_0x3068b3,null))[_0x7309('0x42')](handleError(_0x3068b3,null));};exports[_0x7309('0x46')]=function(_0x5abb0f,_0x4e2ad0){return db[_0x7309('0x2b')][_0x7309('0x46')](_0x5abb0f[_0x7309('0x47')],{})[_0x7309('0x25')](respondWithResult(_0x4e2ad0,0xc9))[_0x7309('0x42')](handleError(_0x4e2ad0,null));};exports[_0x7309('0x24')]=function(_0x506d83,_0x567ce0){if(_0x506d83[_0x7309('0x47')]['id']){delete _0x506d83['body']['id'];}return db[_0x7309('0x2b')][_0x7309('0x45')]({'where':{'id':_0x506d83[_0x7309('0x43')]['id']}})['then'](handleEntityNotFound(_0x567ce0,null))['then'](saveUpdates(_0x506d83[_0x7309('0x47')],null))[_0x7309('0x25')](respondWithResult(_0x567ce0,null))['catch'](handleError(_0x567ce0,null));};exports['destroy']=function(_0x11d763,_0xef4732){return db[_0x7309('0x2b')][_0x7309('0x45')]({'where':{'id':_0x11d763['params']['id']}})[_0x7309('0x25')](handleEntityNotFound(_0xef4732,null))[_0x7309('0x25')](removeEntity(_0xef4732,null))[_0x7309('0x42')](handleError(_0xef4732,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 84a63ba..520e69e 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 _0xf4ae=['./squareMessage.attributes','SquareMessage','square_messages','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2e0d70,_0x1f5440){var _0x1a3a6a=function(_0x4b2807){while(--_0x4b2807){_0x2e0d70['push'](_0x2e0d70['shift']());}};_0x1a3a6a(++_0x1f5440);}(_0xf4ae,0x1e9));var _0xef4a=function(_0x4d183d,_0x123de0){_0x4d183d=_0x4d183d-0x0;var _0x431236=_0xf4ae[_0x4d183d];return _0x431236;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xef4a('0x0'));var moment=require(_0xef4a('0x1'));var BPromise=require(_0xef4a('0x2'));var rp=require(_0xef4a('0x3'));var fs=require('fs');var path=require(_0xef4a('0x4'));var rimraf=require('rimraf');var config=require(_0xef4a('0x5'));var attributes=require(_0xef4a('0x6'));module['exports']=function(_0xe45384,_0x16cbd1){return _0xe45384['define'](_0xef4a('0x7'),attributes,{'tableName':_0xef4a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87cf=['exports','define','SquareMessage','square_messages','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x87cf,0x13c));var _0xf87c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x87cf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf87c('0x0'));var util=require(_0xf87c('0x1'));var logger=require('../../config/logger')(_0xf87c('0x2'));var moment=require(_0xf87c('0x3'));var BPromise=require(_0xf87c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf87c('0x5'));var rimraf=require(_0xf87c('0x6'));var config=require(_0xf87c('0x7'));var attributes=require('./squareMessage.attributes');module[_0xf87c('0x8')]=function(_0x30baa6,_0x1559cb){return _0x30baa6[_0xf87c('0x9')](_0xf87c('0xa'),attributes,{'tableName':_0xf87c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index ed311da..e0b5211 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 _0x4e83=['request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x4e83,0x1ae));var _0x34e8=function(_0x10bd94,_0x46b509){_0x10bd94=_0x10bd94-0x0;var _0x364677=_0x4e83[_0x10bd94];return _0x364677;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30a3c4,_0x4567bd,_0x28677c){return new BPromise(function(_0x5b5ddc,_0x44d3bf){return client[_0x34e8('0x8')](_0x30a3c4,_0x28677c)[_0x34e8('0x9')](function(_0x5cb792){logger[_0x34e8('0xa')](_0x34e8('0xb'),_0x4567bd,_0x34e8('0xc'));logger[_0x34e8('0xd')](_0x34e8('0xe'),_0x4567bd,_0x34e8('0xc'),JSON[_0x34e8('0xf')](_0x5cb792));if(_0x5cb792[_0x34e8('0x10')]){if(_0x5cb792[_0x34e8('0x10')]['code']===0x1f4){logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x5cb792['error'][_0x34e8('0x11')]);return _0x44d3bf(_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);}logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);return _0x5b5ddc(_0x5cb792[_0x34e8('0x10')][_0x34e8('0x11')]);}else{logger['info'](_0x34e8('0xb'),_0x4567bd,_0x34e8('0xc'));_0x5b5ddc(_0x5cb792[_0x34e8('0x12')][_0x34e8('0x11')]);}})[_0x34e8('0x13')](function(_0x4a4d17){logger[_0x34e8('0x10')](_0x34e8('0xb'),_0x4567bd,_0x4a4d17);_0x44d3bf(_0x4a4d17);});});}exports[_0x34e8('0x14')]=function(_0x708dd4){var _0x381484=this;return new Promise(function(_0x11543c,_0x1f3d4d){return db[_0x34e8('0x15')][_0x34e8('0x16')](_0x708dd4[_0x34e8('0x17')],{'raw':_0x708dd4[_0x34e8('0x18')]?_0x708dd4['options'][_0x34e8('0x19')]===undefined?!![]:![]:!![]})[_0x34e8('0x9')](function(_0xe42e15){logger[_0x34e8('0xa')](_0x34e8('0x14'),_0x708dd4);logger[_0x34e8('0xd')](_0x34e8('0x14'),_0x708dd4,JSON[_0x34e8('0xf')](_0xe42e15));_0x11543c(_0xe42e15);})['catch'](function(_0xc9fb93){logger[_0x34e8('0x10')]('CreateSquareMessage',_0xc9fb93[_0x34e8('0x11')],_0x708dd4);_0x1f3d4d(_0x381484['error'](0x1f4,_0xc9fb93[_0x34e8('0x11')]));});});}; \ No newline at end of file +var _0xbedb=['rpc','../../config/environment','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SquareMessage','create','body','options','raw','then','debug','CreateSquareMessage','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x28584f,_0x32ba64){var _0x1f02ec=function(_0x47a757){while(--_0x47a757){_0x28584f['push'](_0x28584f['shift']());}};_0x1f02ec(++_0x32ba64);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbbed('0x0'));var util=require('util');var moment=require(_0xbbed('0x1'));var BPromise=require(_0xbbed('0x2'));var rs=require(_0xbbed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbbed('0x4'));var logger=require(_0xbbed('0x5'))(_0xbbed('0x6'));var config=require(_0xbbed('0x7'));var jayson=require(_0xbbed('0x8'));var client=jayson[_0xbbed('0x9')][_0xbbed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3d9c,_0x44f7ff,_0x42f499){return new BPromise(function(_0x51d8c6,_0x12e6d0){return client['request'](_0x3a3d9c,_0x42f499)['then'](function(_0x3f5d87){logger[_0xbbed('0xb')](_0xbbed('0xc'),_0x44f7ff,'request\x20sent');logger['debug'](_0xbbed('0xd'),_0x44f7ff,_0xbbed('0xe'),JSON[_0xbbed('0xf')](_0x3f5d87));if(_0x3f5d87[_0xbbed('0x10')]){if(_0x3f5d87[_0xbbed('0x10')][_0xbbed('0x11')]===0x1f4){logger['error'](_0xbbed('0xc'),_0x44f7ff,_0x3f5d87['error'][_0xbbed('0x12')]);return _0x12e6d0(_0x3f5d87[_0xbbed('0x10')][_0xbbed('0x12')]);}logger[_0xbbed('0x10')](_0xbbed('0xc'),_0x44f7ff,_0x3f5d87[_0xbbed('0x10')][_0xbbed('0x12')]);return _0x51d8c6(_0x3f5d87[_0xbbed('0x10')][_0xbbed('0x12')]);}else{logger[_0xbbed('0xb')]('SquareMessage,\x20%s,\x20%s',_0x44f7ff,_0xbbed('0xe'));_0x51d8c6(_0x3f5d87['result'][_0xbbed('0x12')]);}})[_0xbbed('0x13')](function(_0xf860ff){logger[_0xbbed('0x10')](_0xbbed('0xc'),_0x44f7ff,_0xf860ff);_0x12e6d0(_0xf860ff);});});}exports['CreateSquareMessage']=function(_0x19e9ce){var _0x2e1789=this;return new Promise(function(_0x44fd74,_0xb8a474){return db[_0xbbed('0x14')][_0xbbed('0x15')](_0x19e9ce[_0xbbed('0x16')],{'raw':_0x19e9ce[_0xbbed('0x17')]?_0x19e9ce[_0xbbed('0x17')][_0xbbed('0x18')]===undefined?!![]:![]:!![]})[_0xbbed('0x19')](function(_0xf166a4){logger[_0xbbed('0xb')]('CreateSquareMessage',_0x19e9ce);logger[_0xbbed('0x1a')](_0xbbed('0x1b'),_0x19e9ce,JSON[_0xbbed('0xf')](_0xf166a4));_0x44fd74(_0xf166a4);})['catch'](function(_0x40ce77){logger[_0xbbed('0x10')](_0xbbed('0x1b'),_0x40ce77[_0xbbed('0x12')],_0x19e9ce);_0xb8a474(_0x2e1789['error'](0x1f4,_0x40ce77[_0xbbed('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 468782f..69d25ac 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 _0xef3e=['show','/:id/test','15s','create','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2065e9,_0x3e7d45){var _0x4c5c66=function(_0xbdd523){while(--_0xbdd523){_0x2065e9['push'](_0x2065e9['shift']());}};_0x4c5c66(++_0x3e7d45);}(_0xef3e,0x17c));var _0xeef3=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xef3e[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0xeef3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeef3('0x1'));var express=require(_0xeef3('0x2'));var router=express[_0xeef3('0x3')]();var auth=require(_0xeef3('0x4'));var interaction=require(_0xeef3('0x5'));var config=require(_0xeef3('0x6'));var controller=require('./squareOdbc.controller');router[_0xeef3('0x7')]('/',auth[_0xeef3('0x8')](),controller[_0xeef3('0x9')]);router[_0xeef3('0x7')](_0xeef3('0xa'),auth[_0xeef3('0x8')](),controller[_0xeef3('0xb')]);router[_0xeef3('0x7')](_0xeef3('0xc'),auth[_0xeef3('0x8')](),timeout(_0xeef3('0xd')),controller['test']);router['post']('/',auth[_0xeef3('0x8')](),controller[_0xeef3('0xe')]);router['put'](_0xeef3('0xa'),auth[_0xeef3('0x8')](),controller['update']);router[_0xeef3('0xf')](_0xeef3('0xa'),auth[_0xeef3('0x8')](),controller['destroy']);module[_0xeef3('0x10')]=router; \ No newline at end of file +var _0x5f09=['put','destroy','exports','util','path','express','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','post','create'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0x5f09,0x8b));var _0x95f0=function(_0x12afe3,_0x5ede46){_0x12afe3=_0x12afe3-0x0;var _0x3f9fbd=_0x5f09[_0x12afe3];return _0x3f9fbd;};'use strict';var multer=require('multer');var util=require(_0x95f0('0x0'));var path=require(_0x95f0('0x1'));var timeout=require('connect-timeout');var express=require(_0x95f0('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x95f0('0x3'));var controller=require(_0x95f0('0x4'));router[_0x95f0('0x5')]('/',auth[_0x95f0('0x6')](),controller[_0x95f0('0x7')]);router['get'](_0x95f0('0x8'),auth[_0x95f0('0x6')](),controller[_0x95f0('0x9')]);router[_0x95f0('0x5')](_0x95f0('0xa'),auth[_0x95f0('0x6')](),timeout(_0x95f0('0xb')),controller['test']);router[_0x95f0('0xc')]('/',auth[_0x95f0('0x6')](),controller[_0x95f0('0xd')]);router[_0x95f0('0xe')](_0x95f0('0x8'),auth[_0x95f0('0x6')](),controller['update']);router['delete']('/:id',auth[_0x95f0('0x6')](),controller[_0x95f0('0xf')]);module[_0x95f0('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f2cd69d..0224f34 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 _0xc660=['STRING','exports'];(function(_0x353209,_0x46f60a){var _0x58bfce=function(_0x49ce44){while(--_0x49ce44){_0x353209['push'](_0x353209['shift']());}};_0x58bfce(++_0x46f60a);}(_0xc660,0x83));var _0x0c66=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc660[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0c66('0x0')]={'name':{'type':Sequelize[_0x0c66('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c66('0x1')]}}; \ No newline at end of file +var _0x4247=['STRING','sequelize'];(function(_0x2f4d0f,_0x219a0e){var _0x114f2f=function(_0x9802e6){while(--_0x9802e6){_0x2f4d0f['push'](_0x2f4d0f['shift']());}};_0x114f2f(++_0x219a0e);}(_0x4247,0x18b));var _0x7424=function(_0x77af5f,_0x8dcb98){_0x77af5f=_0x77af5f-0x0;var _0x598701=_0x4247[_0x77af5f];return _0x598701;};'use strict';var Sequelize=require(_0x7424('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x7424('0x1')]},'description':{'type':Sequelize[_0x7424('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index fad9fea..8250e6e 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 _0xe23e=['fields','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','test','dsn','odbc','openSync','closeSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params'];(function(_0x28929e,_0x4f3096){var _0x4c782f=function(_0x3b8b19){while(--_0x3b8b19){_0x28929e['push'](_0x28929e['shift']());}};_0x4c782f(++_0x4f3096);}(_0xe23e,0x17f));var _0xee23=function(_0x581bbd,_0x54a34d){_0x581bbd=_0x581bbd-0x0;var _0x4f2e07=_0xe23e[_0x581bbd];return _0x4f2e07;};'use strict';var pdf=require(_0xee23('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xee23('0x1'));var zipdir=require(_0xee23('0x2'));var jsonpatch=require(_0xee23('0x3'));var rp=require(_0xee23('0x4'));var moment=require(_0xee23('0x5'));var BPromise=require(_0xee23('0x6'));var Mustache=require(_0xee23('0x7'));var util=require(_0xee23('0x8'));var path=require(_0xee23('0x9'));var sox=require('sox');var csv=require(_0xee23('0xa'));var ejs=require(_0xee23('0xb'));var fs=require('fs');var _=require(_0xee23('0xc'));var squel=require(_0xee23('0xd'));var crypto=require(_0xee23('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xee23('0xf'));var toCsv=require(_0xee23('0xa'));var querystring=require(_0xee23('0x10'));var Papa=require(_0xee23('0x11'));var Redis=require(_0xee23('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xee23('0x13'));var as=require(_0xee23('0x14'));var hardwareService=require(_0xee23('0x15'));var logger=require(_0xee23('0x16'))(_0xee23('0x17'));var utils=require(_0xee23('0x18'));var config=require(_0xee23('0x19'));var db=require(_0xee23('0x1a'))['db'];function respondWithStatusCode(_0x4d0c2a,_0x70e0f8){_0x70e0f8=_0x70e0f8||0xcc;return function(_0xe517f0){if(_0xe517f0){return _0x4d0c2a[_0xee23('0x1b')](_0x70e0f8);}return _0x4d0c2a['status'](_0x70e0f8)[_0xee23('0x1c')]();};}function respondWithResult(_0x336bc1,_0xff6dfb){_0xff6dfb=_0xff6dfb||0xc8;return function(_0x1b4614){if(_0x1b4614){return _0x336bc1[_0xee23('0x1d')](_0xff6dfb)[_0xee23('0x1e')](_0x1b4614);}};}function respondWithFilteredResult(_0x1659a9,_0x160cfb){return function(_0x2a9a67){if(_0x2a9a67){var _0x26d9c8=_0x2a9a67[_0xee23('0x1f')],_0x3a9c23=_0x160cfb[_0xee23('0x20')],_0xb1f976=_0x160cfb[_0xee23('0x20')]+_0x160cfb['limit'],_0x1ebd83;if(_0xb1f976>=_0x26d9c8){_0xb1f976=_0x26d9c8;_0x1ebd83=0xc8;}else{_0x1ebd83=0xce;}_0x1659a9[_0xee23('0x1d')](_0x1ebd83);return _0x1659a9[_0xee23('0x21')](_0xee23('0x22'),_0x3a9c23+'-'+_0xb1f976+'/'+_0x26d9c8)[_0xee23('0x1e')](_0x2a9a67);}return null;};}function patchUpdates(_0x3247cb){return function(_0x32f0c7){try{jsonpatch[_0xee23('0x23')](_0x32f0c7,_0x3247cb,!![]);}catch(_0x59cc96){return BPromise[_0xee23('0x24')](_0x59cc96);}return _0x32f0c7['save']();};}function saveUpdates(_0x855bb5,_0x50d8f9){return function(_0x5e0ec1){if(_0x5e0ec1){return _0x5e0ec1[_0xee23('0x25')](_0x855bb5)[_0xee23('0x26')](function(_0x5b41f8){return _0x5b41f8;});}return null;};}function removeEntity(_0x44f0b8,_0xbbf150){return function(_0x57297f){if(_0x57297f){return _0x57297f[_0xee23('0x27')]()[_0xee23('0x26')](function(){var _0xca4b7d=_0x57297f[_0xee23('0x28')]({'plain':!![]});var _0x39e9b6=_0xee23('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x39e9b6,'resourceId':_0xca4b7d['id']}})['then'](function(){return _0x57297f;});})[_0xee23('0x26')](function(){_0x44f0b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5267dc,_0x3f2724){return function(_0x37b419){if(!_0x37b419){_0x5267dc[_0xee23('0x1b')](0x194);}return _0x37b419;};}function handleError(_0xc6ea7c,_0x37930b){_0x37930b=_0x37930b||0x1f4;return function(_0x2165ca){logger[_0xee23('0x2a')](_0x2165ca[_0xee23('0x2b')]);if(_0x2165ca[_0xee23('0x2c')]){delete _0x2165ca[_0xee23('0x2c')];}_0xc6ea7c[_0xee23('0x1d')](_0x37930b)[_0xee23('0x2d')](_0x2165ca);};}exports[_0xee23('0x2e')]=function(_0x409a98,_0x5a1fe2){var _0x2b68c8={},_0x1b4e8c={},_0x43fe40={'count':0x0,'rows':[]};var _0x14d429=_[_0xee23('0x2f')](db[_0xee23('0x30')][_0xee23('0x31')],function(_0x144ed7){return{'name':_0x144ed7[_0xee23('0x32')],'type':_0x144ed7['type'][_0xee23('0x33')]};});_0x1b4e8c[_0xee23('0x34')]=_[_0xee23('0x2f')](_0x14d429,_0xee23('0x2c'));_0x1b4e8c[_0xee23('0x35')]=_[_0xee23('0x36')](_0x409a98[_0xee23('0x35')]);_0x1b4e8c[_0xee23('0x37')]=_[_0xee23('0x38')](_0x1b4e8c[_0xee23('0x34')],_0x1b4e8c['query']);_0x2b68c8[_0xee23('0x39')]=_[_0xee23('0x38')](_0x1b4e8c[_0xee23('0x34')],qs['fields'](_0x409a98[_0xee23('0x35')]['fields']));_0x2b68c8['attributes']=_0x2b68c8[_0xee23('0x39')][_0xee23('0x3a')]?_0x2b68c8[_0xee23('0x39')]:_0x1b4e8c['model'];if(!_0x409a98[_0xee23('0x35')][_0xee23('0x3b')](_0xee23('0x3c'))){_0x2b68c8[_0xee23('0x3d')]=qs[_0xee23('0x3d')](_0x409a98[_0xee23('0x35')]['limit']);_0x2b68c8[_0xee23('0x20')]=qs[_0xee23('0x20')](_0x409a98[_0xee23('0x35')]['offset']);}_0x2b68c8[_0xee23('0x3e')]=qs[_0xee23('0x3f')](_0x409a98[_0xee23('0x35')][_0xee23('0x3f')]);_0x2b68c8['where']=qs[_0xee23('0x37')](_[_0xee23('0x40')](_0x409a98[_0xee23('0x35')],_0x1b4e8c['filters']),_0x14d429);if(_0x409a98[_0xee23('0x35')][_0xee23('0x41')]){_0x2b68c8['where']=_[_0xee23('0x42')](_0x2b68c8[_0xee23('0x43')],{'$or':_[_0xee23('0x2f')](_0x14d429,function(_0x1b1588){if(_0x1b1588[_0xee23('0x44')]!==_0xee23('0x45')){var _0x4e204b={};_0x4e204b[_0x1b1588[_0xee23('0x2c')]]={'$like':'%'+_0x409a98[_0xee23('0x35')][_0xee23('0x41')]+'%'};return _0x4e204b;}})});}_0x2b68c8=_[_0xee23('0x42')]({},_0x2b68c8,_0x409a98[_0xee23('0x46')]);var _0x2795bc={'where':_0x2b68c8['where']};return db[_0xee23('0x30')][_0xee23('0x1f')](_0x2795bc)[_0xee23('0x26')](function(_0x1fc500){_0x43fe40[_0xee23('0x1f')]=_0x1fc500;if(_0x409a98[_0xee23('0x35')][_0xee23('0x47')]){_0x2b68c8[_0xee23('0x48')]=[{'all':!![]}];}return db['SquareOdbc'][_0xee23('0x49')](_0x2b68c8);})[_0xee23('0x26')](function(_0x585bc3){_0x43fe40[_0xee23('0x4a')]=_0x585bc3;return _0x43fe40;})[_0xee23('0x26')](respondWithFilteredResult(_0x5a1fe2,_0x2b68c8))['catch'](handleError(_0x5a1fe2,null));};exports[_0xee23('0x4b')]=function(_0x5e74ed,_0x32735b){var _0xd04757={'raw':!![],'where':{'id':_0x5e74ed[_0xee23('0x4c')]['id']}},_0x371353={};_0x371353[_0xee23('0x34')]=_['keys'](db['SquareOdbc'][_0xee23('0x31')]);_0x371353[_0xee23('0x35')]=_[_0xee23('0x36')](_0x5e74ed['query']);_0x371353[_0xee23('0x37')]=_[_0xee23('0x38')](_0x371353[_0xee23('0x34')],_0x371353[_0xee23('0x35')]);_0xd04757[_0xee23('0x39')]=_[_0xee23('0x38')](_0x371353[_0xee23('0x34')],qs[_0xee23('0x4d')](_0x5e74ed[_0xee23('0x35')][_0xee23('0x4d')]));_0xd04757[_0xee23('0x39')]=_0xd04757[_0xee23('0x39')][_0xee23('0x3a')]?_0xd04757[_0xee23('0x39')]:_0x371353['model'];if(_0x5e74ed['query'][_0xee23('0x47')]){_0xd04757['include']=[{'all':!![]}];}_0xd04757=_[_0xee23('0x42')]({},_0xd04757,_0x5e74ed[_0xee23('0x46')]);return db['SquareOdbc']['find'](_0xd04757)[_0xee23('0x26')](handleEntityNotFound(_0x32735b,null))[_0xee23('0x26')](respondWithResult(_0x32735b,null))[_0xee23('0x4e')](handleError(_0x32735b,null));};exports[_0xee23('0x4f')]=function(_0x5a2ca3,_0x7fe130){return db['SquareOdbc'][_0xee23('0x4f')](_0x5a2ca3[_0xee23('0x50')],{})[_0xee23('0x26')](function(_0x4fb3ae){var _0x310245=_0x5a2ca3[_0xee23('0x51')][_0xee23('0x28')]({'plain':!![]});if(!_0x310245)throw new Error(_0xee23('0x52'));if(_0x310245['role']===_0xee23('0x51')){var _0x1133fa=_0x4fb3ae[_0xee23('0x28')]({'plain':!![]});var _0x498b61=_0xee23('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x498b61,'userProfileId':_0x310245['userProfileId']},'raw':!![]})[_0xee23('0x26')](function(_0xd77c23){if(_0xd77c23&&_0xd77c23[_0xee23('0x53')]===0x0){return db[_0xee23('0x54')][_0xee23('0x4f')]({'name':_0x1133fa[_0xee23('0x2c')],'resourceId':_0x1133fa['id'],'type':_0xd77c23[_0xee23('0x2c')],'sectionId':_0xd77c23['id']},{})[_0xee23('0x26')](function(){return _0x4fb3ae;});}else{return _0x4fb3ae;}})[_0xee23('0x4e')](function(_0xd05498){logger['error'](_0xee23('0x55'),_0xd05498);throw _0xd05498;});}return _0x4fb3ae;})[_0xee23('0x26')](respondWithResult(_0x7fe130,0xc9))[_0xee23('0x4e')](handleError(_0x7fe130,null));};exports[_0xee23('0x25')]=function(_0x29cf2c,_0x5e685d){if(_0x29cf2c['body']['id']){delete _0x29cf2c[_0xee23('0x50')]['id'];}return db[_0xee23('0x30')]['find']({'where':{'id':_0x29cf2c[_0xee23('0x4c')]['id']}})[_0xee23('0x26')](handleEntityNotFound(_0x5e685d,null))[_0xee23('0x26')](saveUpdates(_0x29cf2c[_0xee23('0x50')],null))['then'](respondWithResult(_0x5e685d,null))[_0xee23('0x4e')](handleError(_0x5e685d,null));};exports[_0xee23('0x27')]=function(_0x227fa7,_0x59ee57){return db[_0xee23('0x30')][_0xee23('0x56')]({'where':{'id':_0x227fa7[_0xee23('0x4c')]['id']}})[_0xee23('0x26')](handleEntityNotFound(_0x59ee57,null))[_0xee23('0x26')](removeEntity(_0x59ee57,null))[_0xee23('0x4e')](handleError(_0x59ee57,null));};exports[_0xee23('0x57')]=function(_0x1900c0,_0x54a3a3,_0x51edae){var _0x183e0f;return db[_0xee23('0x30')][_0xee23('0x56')]({'where':{'id':_0x1900c0[_0xee23('0x4c')]['id']},'attributes':['id',_0xee23('0x58')]})[_0xee23('0x26')](handleEntityNotFound(_0x54a3a3,null))[_0xee23('0x26')](function(_0x10104f){if(_0x10104f){var _0x4562b2=require(_0xee23('0x59'))();_0x4562b2[_0xee23('0x5a')](_0x10104f[_0xee23('0x58')]);_0x4562b2[_0xee23('0x5b')]();return _0x10104f;}})[_0xee23('0x26')](respondWithResult(_0x54a3a3,null))[_0xee23('0x4e')](handleError(_0x54a3a3,null));}; \ No newline at end of file +var _0x2e8f=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','get','ODBC','stack','index','map','SquareOdbc','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','test','odbc','openSync','dsn','closeSync','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x48bee1,_0x29f43d){var _0x582372=function(_0x1cfb3f){while(--_0x1cfb3f){_0x48bee1['push'](_0x48bee1['shift']());}};_0x582372(++_0x29f43d);}(_0x2e8f,0x192));var _0xf2e8=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x2e8f[_0x4792c8];return _0x35edb1;};'use strict';var pdf=require(_0xf2e8('0x0'));var emlformat=require(_0xf2e8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf2e8('0x2'));var rp=require(_0xf2e8('0x3'));var moment=require(_0xf2e8('0x4'));var BPromise=require(_0xf2e8('0x5'));var Mustache=require('mustache');var util=require(_0xf2e8('0x6'));var path=require('path');var sox=require(_0xf2e8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf2e8('0x8'));var squel=require(_0xf2e8('0x9'));var crypto=require(_0xf2e8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf2e8('0xb'));var toCsv=require(_0xf2e8('0xc'));var querystring=require(_0xf2e8('0xd'));var Papa=require(_0xf2e8('0xe'));var Redis=require(_0xf2e8('0xf'));var authService=require(_0xf2e8('0x10'));var qs=require(_0xf2e8('0x11'));var as=require(_0xf2e8('0x12'));var hardwareService=require(_0xf2e8('0x13'));var logger=require('../../config/logger')(_0xf2e8('0x14'));var utils=require(_0xf2e8('0x15'));var config=require(_0xf2e8('0x16'));var db=require(_0xf2e8('0x17'))['db'];function respondWithStatusCode(_0x1998ca,_0xb06766){_0xb06766=_0xb06766||0xcc;return function(_0x1f6a6e){if(_0x1f6a6e){return _0x1998ca[_0xf2e8('0x18')](_0xb06766);}return _0x1998ca[_0xf2e8('0x19')](_0xb06766)[_0xf2e8('0x1a')]();};}function respondWithResult(_0x21f871,_0x2c6874){_0x2c6874=_0x2c6874||0xc8;return function(_0x5dc5aa){if(_0x5dc5aa){return _0x21f871[_0xf2e8('0x19')](_0x2c6874)[_0xf2e8('0x1b')](_0x5dc5aa);}};}function respondWithFilteredResult(_0xe213c,_0x4ddbcb){return function(_0x303596){if(_0x303596){var _0x2fb46e=_0x303596[_0xf2e8('0x1c')],_0x21369b=_0x4ddbcb[_0xf2e8('0x1d')],_0x596d40=_0x4ddbcb[_0xf2e8('0x1d')]+_0x4ddbcb[_0xf2e8('0x1e')],_0x55e8fa;if(_0x596d40>=_0x2fb46e){_0x596d40=_0x2fb46e;_0x55e8fa=0xc8;}else{_0x55e8fa=0xce;}_0xe213c[_0xf2e8('0x19')](_0x55e8fa);return _0xe213c[_0xf2e8('0x1f')](_0xf2e8('0x20'),_0x21369b+'-'+_0x596d40+'/'+_0x2fb46e)[_0xf2e8('0x1b')](_0x303596);}return null;};}function patchUpdates(_0x18c5b3){return function(_0x5ad3a3){try{jsonpatch['apply'](_0x5ad3a3,_0x18c5b3,!![]);}catch(_0x188450){return BPromise[_0xf2e8('0x21')](_0x188450);}return _0x5ad3a3['save']();};}function saveUpdates(_0x11047b,_0x144314){return function(_0x19b643){if(_0x19b643){return _0x19b643[_0xf2e8('0x22')](_0x11047b)[_0xf2e8('0x23')](function(_0x38a837){return _0x38a837;});}return null;};}function removeEntity(_0x154f12,_0xbda537){return function(_0x11ae22){if(_0x11ae22){return _0x11ae22['destroy']()[_0xf2e8('0x23')](function(){var _0x311820=_0x11ae22[_0xf2e8('0x24')]({'plain':!![]});var _0x5416be=_0xf2e8('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x5416be,'resourceId':_0x311820['id']}})[_0xf2e8('0x23')](function(){return _0x11ae22;});})[_0xf2e8('0x23')](function(){_0x154f12[_0xf2e8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a9e06,_0x2ce553){return function(_0x32918c){if(!_0x32918c){_0x5a9e06['sendStatus'](0x194);}return _0x32918c;};}function handleError(_0x13ffa2,_0x4253ad){_0x4253ad=_0x4253ad||0x1f4;return function(_0x4705d1){logger['error'](_0x4705d1[_0xf2e8('0x26')]);if(_0x4705d1['name']){delete _0x4705d1['name'];}_0x13ffa2[_0xf2e8('0x19')](_0x4253ad)['send'](_0x4705d1);};}exports[_0xf2e8('0x27')]=function(_0x330043,_0x331a8d){var _0x216d7a={},_0x426894={},_0x4704bd={'count':0x0,'rows':[]};var _0x23cafa=_[_0xf2e8('0x28')](db[_0xf2e8('0x29')]['rawAttributes'],function(_0x128d93){return{'name':_0x128d93[_0xf2e8('0x2a')],'type':_0x128d93[_0xf2e8('0x2b')][_0xf2e8('0x2c')]};});_0x426894[_0xf2e8('0x2d')]=_[_0xf2e8('0x28')](_0x23cafa,_0xf2e8('0x2e'));_0x426894[_0xf2e8('0x2f')]=_[_0xf2e8('0x30')](_0x330043[_0xf2e8('0x2f')]);_0x426894[_0xf2e8('0x31')]=_[_0xf2e8('0x32')](_0x426894['model'],_0x426894[_0xf2e8('0x2f')]);_0x216d7a['attributes']=_[_0xf2e8('0x32')](_0x426894[_0xf2e8('0x2d')],qs[_0xf2e8('0x33')](_0x330043['query']['fields']));_0x216d7a[_0xf2e8('0x34')]=_0x216d7a[_0xf2e8('0x34')][_0xf2e8('0x35')]?_0x216d7a[_0xf2e8('0x34')]:_0x426894[_0xf2e8('0x2d')];if(!_0x330043[_0xf2e8('0x2f')][_0xf2e8('0x36')](_0xf2e8('0x37'))){_0x216d7a['limit']=qs[_0xf2e8('0x1e')](_0x330043[_0xf2e8('0x2f')][_0xf2e8('0x1e')]);_0x216d7a[_0xf2e8('0x1d')]=qs[_0xf2e8('0x1d')](_0x330043[_0xf2e8('0x2f')][_0xf2e8('0x1d')]);}_0x216d7a[_0xf2e8('0x38')]=qs['sort'](_0x330043[_0xf2e8('0x2f')]['sort']);_0x216d7a['where']=qs[_0xf2e8('0x31')](_[_0xf2e8('0x39')](_0x330043[_0xf2e8('0x2f')],_0x426894[_0xf2e8('0x31')]),_0x23cafa);if(_0x330043[_0xf2e8('0x2f')][_0xf2e8('0x3a')]){_0x216d7a[_0xf2e8('0x3b')]=_['merge'](_0x216d7a[_0xf2e8('0x3b')],{'$or':_[_0xf2e8('0x28')](_0x23cafa,function(_0x94ad21){if(_0x94ad21[_0xf2e8('0x2b')]!=='VIRTUAL'){var _0x294c44={};_0x294c44[_0x94ad21['name']]={'$like':'%'+_0x330043[_0xf2e8('0x2f')][_0xf2e8('0x3a')]+'%'};return _0x294c44;}})});}_0x216d7a=_[_0xf2e8('0x3c')]({},_0x216d7a,_0x330043[_0xf2e8('0x3d')]);var _0x1fab65={'where':_0x216d7a[_0xf2e8('0x3b')]};return db[_0xf2e8('0x29')]['count'](_0x1fab65)[_0xf2e8('0x23')](function(_0x29e242){_0x4704bd[_0xf2e8('0x1c')]=_0x29e242;if(_0x330043['query'][_0xf2e8('0x3e')]){_0x216d7a['include']=[{'all':!![]}];}return db[_0xf2e8('0x29')][_0xf2e8('0x3f')](_0x216d7a);})[_0xf2e8('0x23')](function(_0x4df323){_0x4704bd[_0xf2e8('0x40')]=_0x4df323;return _0x4704bd;})[_0xf2e8('0x23')](respondWithFilteredResult(_0x331a8d,_0x216d7a))[_0xf2e8('0x41')](handleError(_0x331a8d,null));};exports[_0xf2e8('0x42')]=function(_0x4b86d8,_0x4e94ad){var _0x33ac07={'raw':!![],'where':{'id':_0x4b86d8['params']['id']}},_0x113742={};_0x113742[_0xf2e8('0x2d')]=_[_0xf2e8('0x30')](db[_0xf2e8('0x29')]['rawAttributes']);_0x113742[_0xf2e8('0x2f')]=_['keys'](_0x4b86d8[_0xf2e8('0x2f')]);_0x113742[_0xf2e8('0x31')]=_[_0xf2e8('0x32')](_0x113742[_0xf2e8('0x2d')],_0x113742[_0xf2e8('0x2f')]);_0x33ac07[_0xf2e8('0x34')]=_[_0xf2e8('0x32')](_0x113742['model'],qs[_0xf2e8('0x33')](_0x4b86d8[_0xf2e8('0x2f')][_0xf2e8('0x33')]));_0x33ac07[_0xf2e8('0x34')]=_0x33ac07[_0xf2e8('0x34')][_0xf2e8('0x35')]?_0x33ac07['attributes']:_0x113742[_0xf2e8('0x2d')];if(_0x4b86d8[_0xf2e8('0x2f')][_0xf2e8('0x3e')]){_0x33ac07[_0xf2e8('0x43')]=[{'all':!![]}];}_0x33ac07=_[_0xf2e8('0x3c')]({},_0x33ac07,_0x4b86d8[_0xf2e8('0x3d')]);return db['SquareOdbc'][_0xf2e8('0x44')](_0x33ac07)[_0xf2e8('0x23')](handleEntityNotFound(_0x4e94ad,null))[_0xf2e8('0x23')](respondWithResult(_0x4e94ad,null))[_0xf2e8('0x41')](handleError(_0x4e94ad,null));};exports[_0xf2e8('0x45')]=function(_0x26ec52,_0x2140e1){return db[_0xf2e8('0x29')][_0xf2e8('0x45')](_0x26ec52[_0xf2e8('0x46')],{})[_0xf2e8('0x23')](function(_0x415a55){var _0x625755=_0x26ec52[_0xf2e8('0x47')][_0xf2e8('0x24')]({'plain':!![]});if(!_0x625755)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x625755[_0xf2e8('0x48')]===_0xf2e8('0x47')){var _0x16ce92=_0x415a55[_0xf2e8('0x24')]({'plain':!![]});var _0x257817=_0xf2e8('0x25');return db[_0xf2e8('0x49')][_0xf2e8('0x44')]({'where':{'name':_0x257817,'userProfileId':_0x625755[_0xf2e8('0x4a')]},'raw':!![]})[_0xf2e8('0x23')](function(_0x38db43){if(_0x38db43&&_0x38db43[_0xf2e8('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x16ce92[_0xf2e8('0x2e')],'resourceId':_0x16ce92['id'],'type':_0x38db43[_0xf2e8('0x2e')],'sectionId':_0x38db43['id']},{})[_0xf2e8('0x23')](function(){return _0x415a55;});}else{return _0x415a55;}})[_0xf2e8('0x41')](function(_0x29f949){logger['error'](_0xf2e8('0x4c'),_0x29f949);throw _0x29f949;});}return _0x415a55;})['then'](respondWithResult(_0x2140e1,0xc9))[_0xf2e8('0x41')](handleError(_0x2140e1,null));};exports[_0xf2e8('0x22')]=function(_0x5a1509,_0x1ea749){if(_0x5a1509['body']['id']){delete _0x5a1509[_0xf2e8('0x46')]['id'];}return db[_0xf2e8('0x29')][_0xf2e8('0x44')]({'where':{'id':_0x5a1509[_0xf2e8('0x4d')]['id']}})[_0xf2e8('0x23')](handleEntityNotFound(_0x1ea749,null))[_0xf2e8('0x23')](saveUpdates(_0x5a1509[_0xf2e8('0x46')],null))[_0xf2e8('0x23')](respondWithResult(_0x1ea749,null))[_0xf2e8('0x41')](handleError(_0x1ea749,null));};exports[_0xf2e8('0x4e')]=function(_0x1612e0,_0x19eaf6){return db[_0xf2e8('0x29')][_0xf2e8('0x44')]({'where':{'id':_0x1612e0[_0xf2e8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x19eaf6,null))[_0xf2e8('0x23')](removeEntity(_0x19eaf6,null))[_0xf2e8('0x41')](handleError(_0x19eaf6,null));};exports[_0xf2e8('0x4f')]=function(_0x356372,_0x2159af,_0x553e4f){var _0x1a5f8f;return db[_0xf2e8('0x29')]['find']({'where':{'id':_0x356372['params']['id']},'attributes':['id','dsn']})[_0xf2e8('0x23')](handleEntityNotFound(_0x2159af,null))[_0xf2e8('0x23')](function(_0x3f1ed0){if(_0x3f1ed0){var _0x4c031d=require(_0xf2e8('0x50'))();_0x4c031d[_0xf2e8('0x51')](_0x3f1ed0[_0xf2e8('0x52')]);_0x4c031d[_0xf2e8('0x53')]();return _0x3f1ed0;}})['then'](respondWithResult(_0x2159af,null))[_0xf2e8('0x41')](handleError(_0x2159af,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 589f65b..d09b900 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 _0x6e5e=['rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','util','api','moment','bluebird','path'];(function(_0x46c740,_0x1bce09){var _0x565541=function(_0x4bd228){while(--_0x4bd228){_0x46c740['push'](_0x46c740['shift']());}};_0x565541(++_0x1bce09);}(_0x6e5e,0x1aa));var _0xe6e5=function(_0x58f761,_0x342f85){_0x58f761=_0x58f761-0x0;var _0x5cbd54=_0x6e5e[_0x58f761];return _0x5cbd54;};'use strict';var _=require(_0xe6e5('0x0'));var util=require(_0xe6e5('0x1'));var logger=require('../../config/logger')(_0xe6e5('0x2'));var moment=require(_0xe6e5('0x3'));var BPromise=require(_0xe6e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6e5('0x5'));var rimraf=require(_0xe6e5('0x6'));var config=require(_0xe6e5('0x7'));var attributes=require(_0xe6e5('0x8'));module[_0xe6e5('0x9')]=function(_0x49fd53,_0x3e3333){return _0x49fd53['define'](_0xe6e5('0xa'),attributes,{'tableName':_0xe6e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6146=['exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes'];(function(_0x52b046,_0xe55221){var _0x25419d=function(_0x36587f){while(--_0x36587f){_0x52b046['push'](_0x52b046['shift']());}};_0x25419d(++_0xe55221);}(_0x6146,0xba));var _0x6614=function(_0x3b872f,_0x4f5b6e){_0x3b872f=_0x3b872f-0x0;var _0x3bbaa5=_0x6146[_0x3b872f];return _0x3bbaa5;};'use strict';var _=require(_0x6614('0x0'));var util=require('util');var logger=require(_0x6614('0x1'))(_0x6614('0x2'));var moment=require(_0x6614('0x3'));var BPromise=require(_0x6614('0x4'));var rp=require(_0x6614('0x5'));var fs=require('fs');var path=require(_0x6614('0x6'));var rimraf=require(_0x6614('0x7'));var config=require('../../config/environment');var attributes=require(_0x6614('0x8'));module[_0x6614('0x9')]=function(_0x334591,_0x43c7a7){return _0x334591[_0x6614('0xa')](_0x6614('0xb'),attributes,{'tableName':_0x6614('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 5db7ce2..a61c3c0 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1dad92,_0x2f948c){var _0x90a9f6=function(_0x5644db){while(--_0x5644db){_0x1dad92['push'](_0x1dad92['shift']());}};_0x90a9f6(++_0x2f948c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x5fc3[_0x498334];return _0x13bb70;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x4e0ee0,_0x1d50e9){var _0x2e4c93=function(_0x4acbc2){while(--_0x4acbc2){_0x4e0ee0['push'](_0x4e0ee0['shift']());}};_0x2e4c93(++_0x1d50e9);}(_0x7217,0x19e));var _0x7721=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7217[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4d69de3..d8cdc93 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','post','put','update','delete','destroy'];(function(_0x3a1dff,_0x2703b3){var _0x5c710f=function(_0x978b96){while(--_0x978b96){_0x3a1dff['push'](_0x3a1dff['shift']());}};_0x5c710f(++_0x2703b3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['addUsers']);router[_0x3071('0x10')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['removeUsers']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0x1d2d=['path','connect-timeout','express','../../components/auth/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','removeUsers','multer','util'];(function(_0x4efd6f,_0x6765f5){var _0x577ddd=function(_0x1529e5){while(--_0x1529e5){_0x4efd6f['push'](_0x4efd6f['shift']());}};_0x577ddd(++_0x6765f5);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x5e89d9,_0x22c4f5){_0x5e89d9=_0x5e89d9-0x0;var _0x5bcddb=_0x1d2d[_0x5e89d9];return _0x5bcddb;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var auth=require(_0xd1d2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd1d2('0x6'));router[_0xd1d2('0x7')]('/',auth[_0xd1d2('0x8')](),controller[_0xd1d2('0x9')]);router[_0xd1d2('0x7')](_0xd1d2('0xa'),auth['isAuthenticated'](),controller[_0xd1d2('0xb')]);router[_0xd1d2('0x7')](_0xd1d2('0xc'),auth[_0xd1d2('0x8')](),controller[_0xd1d2('0xd')]);router[_0xd1d2('0xe')]('/',auth[_0xd1d2('0x8')](),controller[_0xd1d2('0xf')]);router[_0xd1d2('0xe')](_0xd1d2('0xc'),auth[_0xd1d2('0x8')](),controller[_0xd1d2('0x10')]);router[_0xd1d2('0x11')]('/:id',auth[_0xd1d2('0x8')](),controller[_0xd1d2('0x12')]);router[_0xd1d2('0x13')](_0xd1d2('0xa'),auth[_0xd1d2('0x8')](),controller[_0xd1d2('0x14')]);router[_0xd1d2('0x13')](_0xd1d2('0xc'),auth[_0xd1d2('0x8')](),controller[_0xd1d2('0x15')]);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 6e6b311..2dea9d1 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 _0x8d1b=['toString','sequelize','exports','name','STRING','BLOB','preproduction','getDataValue','utf8','long','production'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x8d1b,0x1b9));var _0xb8d1=function(_0x296e54,_0x400bdd){_0x296e54=_0x296e54-0x0;var _0x2f3c52=_0x8d1b[_0x296e54];return _0x2f3c52;};'use strict';var Sequelize=require(_0xb8d1('0x0'));module[_0xb8d1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb8d1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb8d1('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xb8d1('0x4')]('long'),'get':function(){if(this['getDataValue'](_0xb8d1('0x5'))){return this[_0xb8d1('0x6')](_0xb8d1('0x5'))['toString'](_0xb8d1('0x7'));}}},'production':{'type':Sequelize[_0xb8d1('0x4')](_0xb8d1('0x8')),'get':function(){if(this[_0xb8d1('0x6')](_0xb8d1('0x9'))){return this[_0xb8d1('0x6')](_0xb8d1('0x9'))[_0xb8d1('0xa')](_0xb8d1('0x7'));}}}}; \ No newline at end of file +var _0x0c99=['preproduction','toString','production','exports','name','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x4ef3aa,_0x268631){var _0x309f62=function(_0x1457dd){while(--_0x1457dd){_0x4ef3aa['push'](_0x4ef3aa['shift']());}};_0x309f62(++_0x268631);}(_0x0c99,0x111));var _0x90c9=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x0c99[_0x100682];return _0xcb6e87;};'use strict';var Sequelize=require('sequelize');module[_0x90c9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x90c9('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x90c9('0x2')]},'notes':{'type':Sequelize[_0x90c9('0x3')]},'preproduction':{'type':Sequelize[_0x90c9('0x4')](_0x90c9('0x5')),'get':function(){if(this[_0x90c9('0x6')]('preproduction')){return this[_0x90c9('0x6')](_0x90c9('0x7'))[_0x90c9('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x90c9('0x6')](_0x90c9('0x9'))){return this[_0x90c9('0x6')]('production')[_0x90c9('0x8')]('utf8');}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index a5394ee..d1833c0 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 _0x2843=['eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','localhost','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addUsers','params','omit','ids','removeUsers','emit','userSquareProject:remove','getUsers','findOne','keys','User','pick'];(function(_0x6ea81a,_0x5c03ed){var _0x371747=function(_0x39cc6f){while(--_0x39cc6f){_0x6ea81a['push'](_0x6ea81a['shift']());}};_0x371747(++_0x5c03ed);}(_0x2843,0x174));var _0x3284=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0x2843[_0x44e00a];return _0x2bdfba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3284('0x0'));var rimraf=require(_0x3284('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3284('0x2'));var BPromise=require(_0x3284('0x3'));var Mustache=require(_0x3284('0x4'));var util=require('util');var path=require(_0x3284('0x5'));var sox=require(_0x3284('0x6'));var csv=require(_0x3284('0x7'));var ejs=require(_0x3284('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3284('0x9'));var crypto=require('crypto');var jsforce=require(_0x3284('0xa'));var deskjs=require(_0x3284('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3284('0xc'));var Papa=require('papaparse');var Redis=require(_0x3284('0xd'));var authService=require(_0x3284('0xe'));var qs=require(_0x3284('0xf'));var as=require(_0x3284('0x10'));var hardwareService=require(_0x3284('0x11'));var logger=require('../../config/logger')(_0x3284('0x12'));var utils=require(_0x3284('0x13'));var config=require('../../config/environment');var db=require(_0x3284('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3284('0x15'),'port':0x18eb});var socket=require(_0x3284('0x16'))(new Redis(config[_0x3284('0x17')]));require(_0x3284('0x18'))[_0x3284('0x19')](socket);function respondWithStatusCode(_0x1a6da3,_0x104eff){_0x104eff=_0x104eff||0xcc;return function(_0x57a52e){if(_0x57a52e){return _0x1a6da3[_0x3284('0x1a')](_0x104eff);}return _0x1a6da3['status'](_0x104eff)[_0x3284('0x1b')]();};}function respondWithResult(_0x172b58,_0x54816b){_0x54816b=_0x54816b||0xc8;return function(_0x43cb34){if(_0x43cb34){return _0x172b58[_0x3284('0x1c')](_0x54816b)[_0x3284('0x1d')](_0x43cb34);}};}function respondWithFilteredResult(_0x1c72e6,_0x27f9d0){return function(_0x55e709){if(_0x55e709){var _0x2d4eac=_0x55e709[_0x3284('0x1e')],_0x436546=_0x27f9d0[_0x3284('0x1f')],_0x1d78ff=_0x27f9d0[_0x3284('0x1f')]+_0x27f9d0[_0x3284('0x20')],_0x525ce5;if(_0x1d78ff>=_0x2d4eac){_0x1d78ff=_0x2d4eac;_0x525ce5=0xc8;}else{_0x525ce5=0xce;}_0x1c72e6[_0x3284('0x1c')](_0x525ce5);return _0x1c72e6[_0x3284('0x21')](_0x3284('0x22'),_0x436546+'-'+_0x1d78ff+'/'+_0x2d4eac)[_0x3284('0x1d')](_0x55e709);}return null;};}function patchUpdates(_0x18a65c){return function(_0x109a78){try{jsonpatch['apply'](_0x109a78,_0x18a65c,!![]);}catch(_0x5dd92c){return BPromise[_0x3284('0x23')](_0x5dd92c);}return _0x109a78[_0x3284('0x24')]();};}function saveUpdates(_0x38a3da,_0x874cd){return function(_0x3c418a){if(_0x3c418a){return _0x3c418a[_0x3284('0x25')](_0x38a3da)[_0x3284('0x26')](function(_0x47a9e6){return _0x47a9e6;});}return null;};}function removeEntity(_0x492dca,_0xaf7284){return function(_0x541683){if(_0x541683){return _0x541683[_0x3284('0x27')]()[_0x3284('0x26')](function(){var _0x2ccf91=_0x541683[_0x3284('0x28')]({'plain':!![]});var _0x3149b5=_0x3284('0x29');return db[_0x3284('0x2a')]['destroy']({'where':{'type':_0x3149b5,'resourceId':_0x2ccf91['id']}})['then'](function(){return _0x541683;});})[_0x3284('0x26')](function(){_0x492dca[_0x3284('0x1c')](0xcc)[_0x3284('0x1b')]();});}};}function handleEntityNotFound(_0x5b0f5c,_0x39004f){return function(_0x377d4a){if(!_0x377d4a){_0x5b0f5c[_0x3284('0x1a')](0x194);}return _0x377d4a;};}function handleError(_0x17f316,_0x2ed55d){_0x2ed55d=_0x2ed55d||0x1f4;return function(_0x49ad6d){logger[_0x3284('0x2b')](_0x49ad6d[_0x3284('0x2c')]);if(_0x49ad6d['name']){delete _0x49ad6d[_0x3284('0x2d')];}_0x17f316[_0x3284('0x1c')](_0x2ed55d)[_0x3284('0x2e')](_0x49ad6d);};}exports[_0x3284('0x2f')]=function(_0x3239cd,_0x5eb501){var _0x5bad0c={},_0x4b61b0={},_0x26def1={'count':0x0,'rows':[]};var _0xd7526b=_[_0x3284('0x30')](db[_0x3284('0x31')][_0x3284('0x32')],function(_0x1e6e44){return{'name':_0x1e6e44[_0x3284('0x33')],'type':_0x1e6e44[_0x3284('0x34')][_0x3284('0x35')]};});_0x4b61b0[_0x3284('0x36')]=_[_0x3284('0x30')](_0xd7526b,_0x3284('0x2d'));_0x4b61b0['query']=_['keys'](_0x3239cd['query']);_0x4b61b0[_0x3284('0x37')]=_[_0x3284('0x38')](_0x4b61b0[_0x3284('0x36')],_0x4b61b0[_0x3284('0x39')]);_0x5bad0c[_0x3284('0x3a')]=_[_0x3284('0x38')](_0x4b61b0[_0x3284('0x36')],qs['fields'](_0x3239cd['query'][_0x3284('0x3b')]));_0x5bad0c[_0x3284('0x3a')]=_0x5bad0c[_0x3284('0x3a')][_0x3284('0x3c')]?_0x5bad0c[_0x3284('0x3a')]:_0x4b61b0[_0x3284('0x36')];if(!_0x3239cd['query'][_0x3284('0x3d')](_0x3284('0x3e'))){_0x5bad0c[_0x3284('0x20')]=qs[_0x3284('0x20')](_0x3239cd[_0x3284('0x39')][_0x3284('0x20')]);_0x5bad0c['offset']=qs[_0x3284('0x1f')](_0x3239cd[_0x3284('0x39')][_0x3284('0x1f')]);}_0x5bad0c[_0x3284('0x3f')]=qs[_0x3284('0x40')](_0x3239cd['query'][_0x3284('0x40')]);_0x5bad0c[_0x3284('0x41')]=qs['filters'](_['pick'](_0x3239cd[_0x3284('0x39')],_0x4b61b0[_0x3284('0x37')]),_0xd7526b);if(_0x3239cd[_0x3284('0x39')][_0x3284('0x42')]){_0x5bad0c[_0x3284('0x41')]=_[_0x3284('0x43')](_0x5bad0c[_0x3284('0x41')],{'$or':_[_0x3284('0x30')](_0xd7526b,function(_0x45ec33){if(_0x45ec33['type']!==_0x3284('0x44')){var _0xb947f9={};_0xb947f9[_0x45ec33[_0x3284('0x2d')]]={'$like':'%'+_0x3239cd[_0x3284('0x39')][_0x3284('0x42')]+'%'};return _0xb947f9;}})});}_0x5bad0c=_['merge']({},_0x5bad0c,_0x3239cd[_0x3284('0x45')]);var _0x44b3ad={'where':_0x5bad0c[_0x3284('0x41')]};return db['SquareProject'][_0x3284('0x1e')](_0x44b3ad)['then'](function(_0x3f0650){_0x26def1['count']=_0x3f0650;if(_0x3239cd['query']['includeAll']){_0x5bad0c[_0x3284('0x46')]=[{'all':!![]}];}return db['SquareProject'][_0x3284('0x47')](_0x5bad0c);})['then'](function(_0x4f1f36){_0x26def1['rows']=_0x4f1f36;return _0x26def1;})[_0x3284('0x26')](respondWithFilteredResult(_0x5eb501,_0x5bad0c))[_0x3284('0x48')](handleError(_0x5eb501,null));};exports['show']=function(_0x4f070b,_0x339d5b){var _0x2e2b08={'raw':![],'where':{'id':_0x4f070b['params']['id']}},_0x369f9c={};_0x369f9c[_0x3284('0x36')]=_['keys'](db[_0x3284('0x31')][_0x3284('0x32')]);_0x369f9c[_0x3284('0x39')]=_['keys'](_0x4f070b[_0x3284('0x39')]);_0x369f9c['filters']=_['intersection'](_0x369f9c[_0x3284('0x36')],_0x369f9c[_0x3284('0x39')]);_0x2e2b08[_0x3284('0x3a')]=_[_0x3284('0x38')](_0x369f9c[_0x3284('0x36')],qs[_0x3284('0x3b')](_0x4f070b[_0x3284('0x39')][_0x3284('0x3b')]));_0x2e2b08[_0x3284('0x3a')]=_0x2e2b08[_0x3284('0x3a')][_0x3284('0x3c')]?_0x2e2b08[_0x3284('0x3a')]:_0x369f9c[_0x3284('0x36')];if(_0x4f070b['query']['includeAll']){_0x2e2b08[_0x3284('0x46')]=[{'all':!![]}];}_0x2e2b08=_[_0x3284('0x43')]({},_0x2e2b08,_0x4f070b[_0x3284('0x45')]);return db[_0x3284('0x31')][_0x3284('0x49')](_0x2e2b08)[_0x3284('0x26')](handleEntityNotFound(_0x339d5b,null))['then'](respondWithResult(_0x339d5b,null))['catch'](handleError(_0x339d5b,null));};exports[_0x3284('0x4a')]=function(_0x5731fb,_0x4af963){return db[_0x3284('0x31')][_0x3284('0x4a')](_0x5731fb[_0x3284('0x4b')],{})[_0x3284('0x26')](function(_0x34259d){var _0x553a31=_0x5731fb[_0x3284('0x4c')][_0x3284('0x28')]({'plain':!![]});if(!_0x553a31)throw new Error(_0x3284('0x4d'));if(_0x553a31['role']===_0x3284('0x4c')){var _0x353e53=_0x34259d['get']({'plain':!![]});var _0x551aae='SquareProjects';return db[_0x3284('0x4e')]['find']({'where':{'name':_0x551aae,'userProfileId':_0x553a31[_0x3284('0x4f')]},'raw':!![]})['then'](function(_0x223609){if(_0x223609&&_0x223609[_0x3284('0x50')]===0x0){return db['UserProfileResource'][_0x3284('0x4a')]({'name':_0x353e53[_0x3284('0x2d')],'resourceId':_0x353e53['id'],'type':_0x223609[_0x3284('0x2d')],'sectionId':_0x223609['id']},{})[_0x3284('0x26')](function(){return _0x34259d;});}else{return _0x34259d;}})[_0x3284('0x48')](function(_0x3917f5){logger[_0x3284('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3917f5);throw _0x3917f5;});}return _0x34259d;})['then'](respondWithResult(_0x4af963,0xc9))[_0x3284('0x48')](handleError(_0x4af963,null));};exports[_0x3284('0x25')]=function(_0x3dd76f,_0x464734){if(_0x3dd76f[_0x3284('0x4b')]['id']){delete _0x3dd76f[_0x3284('0x4b')]['id'];}return db[_0x3284('0x31')][_0x3284('0x49')]({'where':{'id':_0x3dd76f['params']['id']}})[_0x3284('0x26')](handleEntityNotFound(_0x464734,null))['then'](saveUpdates(_0x3dd76f['body'],null))['then'](respondWithResult(_0x464734,null))['catch'](handleError(_0x464734,null));};exports[_0x3284('0x27')]=function(_0x50c465,_0x362e6e){return db[_0x3284('0x31')][_0x3284('0x49')]({'where':{'id':_0x50c465['params']['id']}})[_0x3284('0x26')](handleEntityNotFound(_0x362e6e,null))[_0x3284('0x26')](removeEntity(_0x362e6e,null))[_0x3284('0x48')](handleError(_0x362e6e,null));};exports[_0x3284('0x51')]=function(_0x266b59,_0x5842ef,_0x25c81b){return db[_0x3284('0x31')]['find']({'where':{'id':_0x266b59[_0x3284('0x52')]['id']}})[_0x3284('0x26')](handleEntityNotFound(_0x5842ef,null))[_0x3284('0x26')](function(_0xffc76e){if(_0xffc76e){return _0xffc76e[_0x3284('0x51')](_0x266b59[_0x3284('0x4b')]['ids'],_[_0x3284('0x53')](_0x266b59[_0x3284('0x4b')],[_0x3284('0x54'),'id'])||{});}})[_0x3284('0x26')](respondWithResult(_0x5842ef,null))[_0x3284('0x48')](handleError(_0x5842ef,null));};exports[_0x3284('0x55')]=function(_0x2196df,_0xbef73,_0x216b1c){return db['SquareProject'][_0x3284('0x49')]({'where':{'id':_0x2196df[_0x3284('0x52')]['id']}})[_0x3284('0x26')](handleEntityNotFound(_0xbef73,null))[_0x3284('0x26')](function(_0x5351cb){if(_0x5351cb){return _0x5351cb[_0x3284('0x55')](_0x2196df['query']['ids'])['then'](function(){if(_['isArray'](_0x2196df[_0x3284('0x39')][_0x3284('0x54')])){for(var _0x23ea18=0x0;_0x23ea18<_0x2196df[_0x3284('0x39')]['ids'][_0x3284('0x3c')];_0x23ea18+=0x1){socket[_0x3284('0x56')](_0x3284('0x57'),{'UserId':Number(_0x2196df['query'][_0x3284('0x54')][_0x23ea18]),'SquareProjectId':Number(_0x2196df[_0x3284('0x52')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x2196df[_0x3284('0x39')][_0x3284('0x54')]),'SquareProjectId':Number(_0x2196df['params']['id'])});}});}})[_0x3284('0x26')](respondWithStatusCode(_0xbef73,null))['catch'](handleError(_0xbef73,null));};exports[_0x3284('0x58')]=function(_0x579f0,_0x45c6ad,_0x3380a9){var _0x3ceed0={};var _0x3892e4={};var _0x1db73b;var _0x1dd890;return db[_0x3284('0x31')][_0x3284('0x59')]({'where':{'id':_0x579f0[_0x3284('0x52')]['id']}})['then'](handleEntityNotFound(_0x45c6ad,null))[_0x3284('0x26')](function(_0x279fb3){if(_0x279fb3){_0x1db73b=_0x279fb3;_0x3892e4[_0x3284('0x36')]=_[_0x3284('0x5a')](db[_0x3284('0x5b')]['rawAttributes']);_0x3892e4[_0x3284('0x39')]=_[_0x3284('0x5a')](_0x579f0[_0x3284('0x39')]);_0x3892e4[_0x3284('0x37')]=_['intersection'](_0x3892e4[_0x3284('0x36')],_0x3892e4[_0x3284('0x39')]);_0x3ceed0[_0x3284('0x3a')]=_[_0x3284('0x38')](_0x3892e4[_0x3284('0x36')],qs['fields'](_0x579f0[_0x3284('0x39')][_0x3284('0x3b')]));_0x3ceed0['attributes']=_0x3ceed0[_0x3284('0x3a')]['length']?_0x3ceed0[_0x3284('0x3a')]:_0x3892e4[_0x3284('0x36')];_0x3ceed0[_0x3284('0x3f')]=qs[_0x3284('0x40')](_0x579f0[_0x3284('0x39')]['sort']);_0x3ceed0[_0x3284('0x41')]=qs['filters'](_[_0x3284('0x5c')](_0x579f0[_0x3284('0x39')],_0x3892e4[_0x3284('0x37')]));if(_0x579f0[_0x3284('0x39')][_0x3284('0x42')]){_0x3ceed0['where']=_[_0x3284('0x43')](_0x3ceed0[_0x3284('0x41')],{'$or':_['map'](_0x3ceed0[_0x3284('0x3a')],function(_0x11922a){var _0x2c4d73={};_0x2c4d73[_0x11922a]={'$like':'%'+_0x579f0[_0x3284('0x39')][_0x3284('0x42')]+'%'};return _0x2c4d73;})});}_0x3ceed0=_[_0x3284('0x43')]({},_0x3ceed0,_0x579f0[_0x3284('0x45')]);return _0x1db73b[_0x3284('0x58')](_0x3ceed0);}})[_0x3284('0x26')](function(_0x23b671){if(_0x23b671){_0x1dd890=_0x23b671[_0x3284('0x3c')];if(!_0x579f0[_0x3284('0x39')][_0x3284('0x3d')](_0x3284('0x3e'))){_0x3ceed0[_0x3284('0x20')]=qs['limit'](_0x579f0[_0x3284('0x39')]['limit']);_0x3ceed0[_0x3284('0x1f')]=qs[_0x3284('0x1f')](_0x579f0[_0x3284('0x39')]['offset']);}return _0x1db73b[_0x3284('0x58')](_0x3ceed0);}})[_0x3284('0x26')](function(_0x2da65d){if(_0x2da65d){return _0x2da65d?{'count':_0x1dd890,'rows':_0x2da65d}:null;}})[_0x3284('0x26')](respondWithResult(_0x45c6ad,null))[_0x3284('0x48')](handleError(_0x45c6ad,null));}; \ No newline at end of file +var _0x40c4=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','User','order','getUsers','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','set','apply','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','SquareProject','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','findAll','rows','catch','show','rawAttributes','fields','options','find','create'];(function(_0x45dc30,_0x4c0127){var _0x1f36c4=function(_0x371b0f){while(--_0x371b0f){_0x45dc30['push'](_0x45dc30['shift']());}};_0x1f36c4(++_0x4c0127);}(_0x40c4,0xd2));var _0x440c=function(_0x1a59a6,_0x37f523){_0x1a59a6=_0x1a59a6-0x0;var _0x127d2d=_0x40c4[_0x1a59a6];return _0x127d2d;};'use strict';var pdf=require(_0x440c('0x0'));var emlformat=require(_0x440c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x440c('0x2'));var jsonpatch=require(_0x440c('0x3'));var rp=require(_0x440c('0x4'));var moment=require(_0x440c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x440c('0x6'));var util=require(_0x440c('0x7'));var path=require(_0x440c('0x8'));var sox=require(_0x440c('0x9'));var csv=require(_0x440c('0xa'));var ejs=require(_0x440c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x440c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x440c('0xd'));var Papa=require(_0x440c('0xe'));var Redis=require('ioredis');var authService=require(_0x440c('0xf'));var qs=require(_0x440c('0x10'));var as=require(_0x440c('0x11'));var hardwareService=require(_0x440c('0x12'));var logger=require(_0x440c('0x13'))(_0x440c('0x14'));var utils=require(_0x440c('0x15'));var config=require(_0x440c('0x16'));var db=require(_0x440c('0x17'))['db'];config[_0x440c('0x18')]=_[_0x440c('0x19')](config['redis'],{'host':_0x440c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x440c('0x18')]));require(_0x440c('0x1b'))[_0x440c('0x1c')](socket);function respondWithStatusCode(_0x241f4c,_0x41636a){_0x41636a=_0x41636a||0xcc;return function(_0x36dfde){if(_0x36dfde){return _0x241f4c[_0x440c('0x1d')](_0x41636a);}return _0x241f4c[_0x440c('0x1e')](_0x41636a)[_0x440c('0x1f')]();};}function respondWithResult(_0x25d2d7,_0x85db11){_0x85db11=_0x85db11||0xc8;return function(_0x512e59){if(_0x512e59){return _0x25d2d7[_0x440c('0x1e')](_0x85db11)[_0x440c('0x20')](_0x512e59);}};}function respondWithFilteredResult(_0x546575,_0x37e6fd){return function(_0x4b766c){if(_0x4b766c){var _0x575f72=_0x4b766c['count'],_0x4fb4dc=_0x37e6fd[_0x440c('0x21')],_0x56e0ef=_0x37e6fd[_0x440c('0x21')]+_0x37e6fd[_0x440c('0x22')],_0x212a13;if(_0x56e0ef>=_0x575f72){_0x56e0ef=_0x575f72;_0x212a13=0xc8;}else{_0x212a13=0xce;}_0x546575[_0x440c('0x1e')](_0x212a13);return _0x546575[_0x440c('0x23')]('Content-Range',_0x4fb4dc+'-'+_0x56e0ef+'/'+_0x575f72)[_0x440c('0x20')](_0x4b766c);}return null;};}function patchUpdates(_0x5d9d84){return function(_0x276e1d){try{jsonpatch[_0x440c('0x24')](_0x276e1d,_0x5d9d84,!![]);}catch(_0x5b6ed8){return BPromise['reject'](_0x5b6ed8);}return _0x276e1d[_0x440c('0x25')]();};}function saveUpdates(_0xb4fe01,_0x1858a8){return function(_0x3520ea){if(_0x3520ea){return _0x3520ea[_0x440c('0x26')](_0xb4fe01)[_0x440c('0x27')](function(_0x59bba7){return _0x59bba7;});}return null;};}function removeEntity(_0x40dd1c,_0x574a0c){return function(_0x56005a){if(_0x56005a){return _0x56005a[_0x440c('0x28')]()[_0x440c('0x27')](function(){var _0x30c968=_0x56005a[_0x440c('0x29')]({'plain':!![]});var _0x15c3e7=_0x440c('0x2a');return db[_0x440c('0x2b')][_0x440c('0x28')]({'where':{'type':_0x15c3e7,'resourceId':_0x30c968['id']}})[_0x440c('0x27')](function(){return _0x56005a;});})[_0x440c('0x27')](function(){_0x40dd1c['status'](0xcc)[_0x440c('0x1f')]();});}};}function handleEntityNotFound(_0x42ced1,_0x2e1f68){return function(_0x537991){if(!_0x537991){_0x42ced1['sendStatus'](0x194);}return _0x537991;};}function handleError(_0x17c7a8,_0x5b784c){_0x5b784c=_0x5b784c||0x1f4;return function(_0x15b72f){logger[_0x440c('0x2c')](_0x15b72f[_0x440c('0x2d')]);if(_0x15b72f['name']){delete _0x15b72f[_0x440c('0x2e')];}_0x17c7a8['status'](_0x5b784c)[_0x440c('0x2f')](_0x15b72f);};}exports['index']=function(_0x197237,_0x4b53cb){var _0x30bb83={},_0x27b160={},_0x4f1deb={'count':0x0,'rows':[]};var _0x310021=_['map'](db[_0x440c('0x30')]['rawAttributes'],function(_0x47e08b){return{'name':_0x47e08b['fieldName'],'type':_0x47e08b[_0x440c('0x31')][_0x440c('0x32')]};});_0x27b160['model']=_[_0x440c('0x33')](_0x310021,'name');_0x27b160[_0x440c('0x34')]=_[_0x440c('0x35')](_0x197237[_0x440c('0x34')]);_0x27b160[_0x440c('0x36')]=_[_0x440c('0x37')](_0x27b160[_0x440c('0x38')],_0x27b160[_0x440c('0x34')]);_0x30bb83[_0x440c('0x39')]=_[_0x440c('0x37')](_0x27b160[_0x440c('0x38')],qs['fields'](_0x197237[_0x440c('0x34')]['fields']));_0x30bb83[_0x440c('0x39')]=_0x30bb83[_0x440c('0x39')][_0x440c('0x3a')]?_0x30bb83['attributes']:_0x27b160['model'];if(!_0x197237[_0x440c('0x34')][_0x440c('0x3b')](_0x440c('0x3c'))){_0x30bb83[_0x440c('0x22')]=qs[_0x440c('0x22')](_0x197237['query'][_0x440c('0x22')]);_0x30bb83[_0x440c('0x21')]=qs[_0x440c('0x21')](_0x197237[_0x440c('0x34')][_0x440c('0x21')]);}_0x30bb83['order']=qs[_0x440c('0x3d')](_0x197237[_0x440c('0x34')]['sort']);_0x30bb83[_0x440c('0x3e')]=qs[_0x440c('0x36')](_[_0x440c('0x3f')](_0x197237[_0x440c('0x34')],_0x27b160[_0x440c('0x36')]),_0x310021);if(_0x197237[_0x440c('0x34')][_0x440c('0x40')]){_0x30bb83['where']=_['merge'](_0x30bb83['where'],{'$or':_[_0x440c('0x33')](_0x310021,function(_0x164e2b){if(_0x164e2b[_0x440c('0x31')]!==_0x440c('0x41')){var _0x45a43d={};_0x45a43d[_0x164e2b['name']]={'$like':'%'+_0x197237[_0x440c('0x34')][_0x440c('0x40')]+'%'};return _0x45a43d;}})});}_0x30bb83=_[_0x440c('0x42')]({},_0x30bb83,_0x197237['options']);var _0x2943a2={'where':_0x30bb83[_0x440c('0x3e')]};return db[_0x440c('0x30')][_0x440c('0x43')](_0x2943a2)[_0x440c('0x27')](function(_0x366901){_0x4f1deb[_0x440c('0x43')]=_0x366901;if(_0x197237[_0x440c('0x34')][_0x440c('0x44')]){_0x30bb83['include']=[{'all':!![]}];}return db[_0x440c('0x30')][_0x440c('0x45')](_0x30bb83);})['then'](function(_0x3a67f1){_0x4f1deb[_0x440c('0x46')]=_0x3a67f1;return _0x4f1deb;})[_0x440c('0x27')](respondWithFilteredResult(_0x4b53cb,_0x30bb83))[_0x440c('0x47')](handleError(_0x4b53cb,null));};exports[_0x440c('0x48')]=function(_0x3b3f14,_0xb545c9){var _0x1dcfa0={'raw':![],'where':{'id':_0x3b3f14['params']['id']}},_0x264838={};_0x264838['model']=_['keys'](db[_0x440c('0x30')][_0x440c('0x49')]);_0x264838[_0x440c('0x34')]=_[_0x440c('0x35')](_0x3b3f14[_0x440c('0x34')]);_0x264838[_0x440c('0x36')]=_[_0x440c('0x37')](_0x264838[_0x440c('0x38')],_0x264838[_0x440c('0x34')]);_0x1dcfa0[_0x440c('0x39')]=_['intersection'](_0x264838[_0x440c('0x38')],qs[_0x440c('0x4a')](_0x3b3f14[_0x440c('0x34')][_0x440c('0x4a')]));_0x1dcfa0[_0x440c('0x39')]=_0x1dcfa0[_0x440c('0x39')][_0x440c('0x3a')]?_0x1dcfa0[_0x440c('0x39')]:_0x264838[_0x440c('0x38')];if(_0x3b3f14['query']['includeAll']){_0x1dcfa0['include']=[{'all':!![]}];}_0x1dcfa0=_[_0x440c('0x42')]({},_0x1dcfa0,_0x3b3f14[_0x440c('0x4b')]);return db[_0x440c('0x30')][_0x440c('0x4c')](_0x1dcfa0)['then'](handleEntityNotFound(_0xb545c9,null))[_0x440c('0x27')](respondWithResult(_0xb545c9,null))[_0x440c('0x47')](handleError(_0xb545c9,null));};exports[_0x440c('0x4d')]=function(_0x5f549b,_0x4ddd7b){return db[_0x440c('0x30')][_0x440c('0x4d')](_0x5f549b[_0x440c('0x4e')],{})[_0x440c('0x27')](function(_0x337f9c){var _0x3cbfaa=_0x5f549b['user'][_0x440c('0x29')]({'plain':!![]});if(!_0x3cbfaa)throw new Error(_0x440c('0x4f'));if(_0x3cbfaa[_0x440c('0x50')]===_0x440c('0x51')){var _0x570090=_0x337f9c[_0x440c('0x29')]({'plain':!![]});var _0x59c13a=_0x440c('0x2a');return db[_0x440c('0x52')][_0x440c('0x4c')]({'where':{'name':_0x59c13a,'userProfileId':_0x3cbfaa['userProfileId']},'raw':!![]})[_0x440c('0x27')](function(_0x1b6831){if(_0x1b6831&&_0x1b6831[_0x440c('0x53')]===0x0){return db[_0x440c('0x2b')][_0x440c('0x4d')]({'name':_0x570090[_0x440c('0x2e')],'resourceId':_0x570090['id'],'type':_0x1b6831[_0x440c('0x2e')],'sectionId':_0x1b6831['id']},{})[_0x440c('0x27')](function(){return _0x337f9c;});}else{return _0x337f9c;}})['catch'](function(_0x4a7e25){logger[_0x440c('0x2c')](_0x440c('0x54'),_0x4a7e25);throw _0x4a7e25;});}return _0x337f9c;})[_0x440c('0x27')](respondWithResult(_0x4ddd7b,0xc9))[_0x440c('0x47')](handleError(_0x4ddd7b,null));};exports[_0x440c('0x26')]=function(_0x2d881b,_0x4cf52e){if(_0x2d881b['body']['id']){delete _0x2d881b['body']['id'];}return db[_0x440c('0x30')][_0x440c('0x4c')]({'where':{'id':_0x2d881b[_0x440c('0x55')]['id']}})[_0x440c('0x27')](handleEntityNotFound(_0x4cf52e,null))[_0x440c('0x27')](saveUpdates(_0x2d881b[_0x440c('0x4e')],null))[_0x440c('0x27')](respondWithResult(_0x4cf52e,null))[_0x440c('0x47')](handleError(_0x4cf52e,null));};exports[_0x440c('0x28')]=function(_0x242a53,_0xff9704){return db['SquareProject']['find']({'where':{'id':_0x242a53[_0x440c('0x55')]['id']}})[_0x440c('0x27')](handleEntityNotFound(_0xff9704,null))[_0x440c('0x27')](removeEntity(_0xff9704,null))[_0x440c('0x47')](handleError(_0xff9704,null));};exports['addUsers']=function(_0x108631,_0x26d8d2,_0x5857d3){return db['SquareProject'][_0x440c('0x4c')]({'where':{'id':_0x108631[_0x440c('0x55')]['id']}})[_0x440c('0x27')](handleEntityNotFound(_0x26d8d2,null))[_0x440c('0x27')](function(_0x44ed28){if(_0x44ed28){return _0x44ed28[_0x440c('0x56')](_0x108631[_0x440c('0x4e')]['ids'],_[_0x440c('0x57')](_0x108631[_0x440c('0x4e')],[_0x440c('0x58'),'id'])||{});}})[_0x440c('0x27')](respondWithResult(_0x26d8d2,null))[_0x440c('0x47')](handleError(_0x26d8d2,null));};exports[_0x440c('0x59')]=function(_0x2c0e01,_0x3564b0,_0x1286d8){return db[_0x440c('0x30')][_0x440c('0x4c')]({'where':{'id':_0x2c0e01[_0x440c('0x55')]['id']}})[_0x440c('0x27')](handleEntityNotFound(_0x3564b0,null))['then'](function(_0x2eef2d){if(_0x2eef2d){return _0x2eef2d['removeUsers'](_0x2c0e01[_0x440c('0x34')]['ids'])[_0x440c('0x27')](function(){if(_[_0x440c('0x5a')](_0x2c0e01[_0x440c('0x34')][_0x440c('0x58')])){for(var _0x4fbbf7=0x0;_0x4fbbf7<_0x2c0e01[_0x440c('0x34')][_0x440c('0x58')][_0x440c('0x3a')];_0x4fbbf7+=0x1){socket[_0x440c('0x5b')](_0x440c('0x5c'),{'UserId':Number(_0x2c0e01[_0x440c('0x34')][_0x440c('0x58')][_0x4fbbf7]),'SquareProjectId':Number(_0x2c0e01[_0x440c('0x55')]['id'])});}}else{socket[_0x440c('0x5b')](_0x440c('0x5c'),{'UserId':Number(_0x2c0e01[_0x440c('0x34')][_0x440c('0x58')]),'SquareProjectId':Number(_0x2c0e01[_0x440c('0x55')]['id'])});}});}})[_0x440c('0x27')](respondWithStatusCode(_0x3564b0,null))[_0x440c('0x47')](handleError(_0x3564b0,null));};exports['getUsers']=function(_0x19409a,_0x8276b2,_0x373d4f){var _0x31cf96={};var _0x526378={};var _0x31af62;var _0x324fcf;return db['SquareProject']['findOne']({'where':{'id':_0x19409a['params']['id']}})['then'](handleEntityNotFound(_0x8276b2,null))['then'](function(_0x117702){if(_0x117702){_0x31af62=_0x117702;_0x526378[_0x440c('0x38')]=_[_0x440c('0x35')](db[_0x440c('0x5d')][_0x440c('0x49')]);_0x526378[_0x440c('0x34')]=_[_0x440c('0x35')](_0x19409a[_0x440c('0x34')]);_0x526378['filters']=_[_0x440c('0x37')](_0x526378[_0x440c('0x38')],_0x526378['query']);_0x31cf96[_0x440c('0x39')]=_[_0x440c('0x37')](_0x526378[_0x440c('0x38')],qs['fields'](_0x19409a['query'][_0x440c('0x4a')]));_0x31cf96[_0x440c('0x39')]=_0x31cf96[_0x440c('0x39')][_0x440c('0x3a')]?_0x31cf96['attributes']:_0x526378['model'];_0x31cf96[_0x440c('0x5e')]=qs[_0x440c('0x3d')](_0x19409a[_0x440c('0x34')][_0x440c('0x3d')]);_0x31cf96['where']=qs[_0x440c('0x36')](_[_0x440c('0x3f')](_0x19409a[_0x440c('0x34')],_0x526378['filters']));if(_0x19409a['query'][_0x440c('0x40')]){_0x31cf96[_0x440c('0x3e')]=_[_0x440c('0x42')](_0x31cf96[_0x440c('0x3e')],{'$or':_[_0x440c('0x33')](_0x31cf96['attributes'],function(_0x324343){var _0x1eafac={};_0x1eafac[_0x324343]={'$like':'%'+_0x19409a['query'][_0x440c('0x40')]+'%'};return _0x1eafac;})});}_0x31cf96=_[_0x440c('0x42')]({},_0x31cf96,_0x19409a[_0x440c('0x4b')]);return _0x31af62[_0x440c('0x5f')](_0x31cf96);}})[_0x440c('0x27')](function(_0x1978d7){if(_0x1978d7){_0x324fcf=_0x1978d7['length'];if(!_0x19409a['query'][_0x440c('0x3b')](_0x440c('0x3c'))){_0x31cf96[_0x440c('0x22')]=qs[_0x440c('0x22')](_0x19409a[_0x440c('0x34')][_0x440c('0x22')]);_0x31cf96[_0x440c('0x21')]=qs[_0x440c('0x21')](_0x19409a[_0x440c('0x34')][_0x440c('0x21')]);}return _0x31af62[_0x440c('0x5f')](_0x31cf96);}})[_0x440c('0x27')](function(_0x4f78f3){if(_0x4f78f3){return _0x4f78f3?{'count':_0x324fcf,'rows':_0x4f78f3}:null;}})['then'](respondWithResult(_0x8276b2,null))[_0x440c('0x47')](handleError(_0x8276b2,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 2e4d83d..9846aa5 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 _0x5178=['../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x3edc0e,_0x734130){var _0x223e3a=function(_0x2fce66){while(--_0x2fce66){_0x3edc0e['push'](_0x3edc0e['shift']());}};_0x223e3a(++_0x734130);}(_0x5178,0x171));var _0x8517=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5178[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x8517('0x0'))['db'][_0x8517('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8517('0x2')](0x0);var events={'afterCreate':_0x8517('0x3'),'afterUpdate':_0x8517('0x4'),'afterDestroy':'remove'};function emitEvent(_0x483381){return function(_0x3ed6a5,_0x221184,_0x4ccd73){SquareProjectEvents[_0x8517('0x5')](_0x483381+':'+_0x3ed6a5['id'],_0x3ed6a5);SquareProjectEvents['emit'](_0x483381,_0x3ed6a5);_0x4ccd73(null);};}for(var e in events){if(events[_0x8517('0x6')](e)){var event=events[e];SquareProject[_0x8517('0x7')](e,emitEvent(event));}}module[_0x8517('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xec60=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hook'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xec60,0x1de));var _0x0ec6=function(_0x2acd39,_0x591d10){_0x2acd39=_0x2acd39-0x0;var _0x2022be=_0xec60[_0x2acd39];return _0x2022be;};'use strict';var EventEmitter=require(_0x0ec6('0x0'));var SquareProject=require(_0x0ec6('0x1'))['db'][_0x0ec6('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x0ec6('0x3')](0x0);var events={'afterCreate':_0x0ec6('0x4'),'afterUpdate':_0x0ec6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x450c79){return function(_0x24f105,_0x4f9d2a,_0x3b01d4){SquareProjectEvents['emit'](_0x450c79+':'+_0x24f105['id'],_0x24f105);SquareProjectEvents[_0x0ec6('0x6')](_0x450c79,_0x24f105);_0x3b01d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x0ec6('0x7')](e,emitEvent(event));}}module[_0x0ec6('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 00d810b..91e1f16 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 _0x76af=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','lodash'];(function(_0x322d05,_0x574225){var _0x4c3b98=function(_0x409b64){while(--_0x409b64){_0x322d05['push'](_0x322d05['shift']());}};_0x4c3b98(++_0x574225);}(_0x76af,0x12b));var _0xf76a=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x76af[_0x4d8dc3];return _0x9b03d9;};'use strict';var _=require(_0xf76a('0x0'));var util=require('util');var logger=require(_0xf76a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf76a('0x2'));var rp=require(_0xf76a('0x3'));var fs=require('fs');var path=require(_0xf76a('0x4'));var rimraf=require(_0xf76a('0x5'));var config=require(_0xf76a('0x6'));var attributes=require(_0xf76a('0x7'));module[_0xf76a('0x8')]=function(_0x1f2dde,_0xd10721){return _0x1f2dde[_0xf76a('0x9')](_0xf76a('0xa'),attributes,{'tableName':_0xf76a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f2e=['./squareProject.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14b978,_0x308134){var _0x54fac6=function(_0x32f383){while(--_0x32f383){_0x14b978['push'](_0x14b978['shift']());}};_0x54fac6(++_0x308134);}(_0x1f2e,0x148));var _0xe1f2=function(_0x5576bf,_0x152995){_0x5576bf=_0x5576bf-0x0;var _0x45a534=_0x1f2e[_0x5576bf];return _0x45a534;};'use strict';var _=require(_0xe1f2('0x0'));var util=require(_0xe1f2('0x1'));var logger=require(_0xe1f2('0x2'))(_0xe1f2('0x3'));var moment=require(_0xe1f2('0x4'));var BPromise=require(_0xe1f2('0x5'));var rp=require(_0xe1f2('0x6'));var fs=require('fs');var path=require(_0xe1f2('0x7'));var rimraf=require(_0xe1f2('0x8'));var config=require(_0xe1f2('0x9'));var attributes=require(_0xe1f2('0xa'));module[_0xe1f2('0xb')]=function(_0x52e27f,_0x16a90a){return _0x52e27f[_0xe1f2('0xc')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index dff5e7c..8e2be4a 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 _0x3922=['SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','request','then','info','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error'];(function(_0x41e45d,_0x1ee3b0){var _0x4d3aac=function(_0x4b7503){while(--_0x4b7503){_0x41e45d['push'](_0x41e45d['shift']());}};_0x4d3aac(++_0x1ee3b0);}(_0x3922,0x1ee));var _0x2392=function(_0x1d55d1,_0xbedf34){_0x1d55d1=_0x1d55d1-0x0;var _0x20596a=_0x3922[_0x1d55d1];return _0x20596a;};'use strict';var _=require(_0x2392('0x0'));var util=require(_0x2392('0x1'));var moment=require(_0x2392('0x2'));var BPromise=require('bluebird');var rs=require(_0x2392('0x3'));var fs=require('fs');var Redis=require(_0x2392('0x4'));var db=require(_0x2392('0x5'))['db'];var utils=require(_0x2392('0x6'));var logger=require('../../config/logger')(_0x2392('0x7'));var config=require(_0x2392('0x8'));var jayson=require(_0x2392('0x9'));var client=jayson[_0x2392('0xa')][_0x2392('0xb')]({'port':0x232a});config['redis']=_[_0x2392('0xc')](config[_0x2392('0xd')],{'host':_0x2392('0xe'),'port':0x18eb});var socket=require(_0x2392('0xf'))(new Redis(config['redis']));require(_0x2392('0x10'))['register'](socket);function respondWithRpcPromise(_0x14c496,_0x4ec0a5,_0x77f01e){return new BPromise(function(_0x251fae,_0x37cea8){return client[_0x2392('0x11')](_0x14c496,_0x77f01e)[_0x2392('0x12')](function(_0x53a1cf){logger[_0x2392('0x13')]('SquareProject,\x20%s,\x20%s',_0x4ec0a5,_0x2392('0x14'));logger[_0x2392('0x15')](_0x2392('0x16'),_0x4ec0a5,'request\x20sent',JSON['stringify'](_0x53a1cf));if(_0x53a1cf['error']){if(_0x53a1cf[_0x2392('0x17')]['code']===0x1f4){logger[_0x2392('0x17')](_0x2392('0x18'),_0x4ec0a5,_0x53a1cf[_0x2392('0x17')]['message']);return _0x37cea8(_0x53a1cf[_0x2392('0x17')][_0x2392('0x19')]);}logger[_0x2392('0x17')](_0x2392('0x18'),_0x4ec0a5,_0x53a1cf[_0x2392('0x17')][_0x2392('0x19')]);return _0x251fae(_0x53a1cf[_0x2392('0x17')][_0x2392('0x19')]);}else{logger[_0x2392('0x13')](_0x2392('0x18'),_0x4ec0a5,_0x2392('0x14'));_0x251fae(_0x53a1cf[_0x2392('0x1a')][_0x2392('0x19')]);}})[_0x2392('0x1b')](function(_0x5393a3){logger[_0x2392('0x17')](_0x2392('0x18'),_0x4ec0a5,_0x5393a3);_0x37cea8(_0x5393a3);});});}exports[_0x2392('0x1c')]=function(_0x42ed08){var _0x9cb4ea=this;return new Promise(function(_0x1fc1f2,_0x3e718a){return db[_0x2392('0x1d')][_0x2392('0x1e')]({'raw':_0x42ed08[_0x2392('0x1f')]?_0x42ed08[_0x2392('0x1f')][_0x2392('0x20')]===undefined?!![]:![]:!![],'where':_0x42ed08[_0x2392('0x1f')]?_0x42ed08[_0x2392('0x1f')][_0x2392('0x21')]||null:null,'attributes':_0x42ed08[_0x2392('0x1f')]?_0x42ed08['options'][_0x2392('0x22')]||null:null,'include':_0x42ed08[_0x2392('0x1f')]?_0x42ed08[_0x2392('0x1f')][_0x2392('0x23')]?_[_0x2392('0x24')](_0x42ed08[_0x2392('0x1f')][_0x2392('0x23')],function(_0x49f55f){return{'model':db[_0x49f55f['model']],'as':_0x49f55f['as'],'attributes':_0x49f55f[_0x2392('0x22')],'include':_0x49f55f[_0x2392('0x23')]?_[_0x2392('0x24')](_0x49f55f['include'],function(_0x5559d2){return{'model':db[_0x5559d2['model']],'as':_0x5559d2['as'],'attributes':_0x5559d2['attributes'],'include':_0x5559d2[_0x2392('0x23')]?_[_0x2392('0x24')](_0x5559d2['include'],function(_0x4793ed){return{'model':db[_0x4793ed['model']],'as':_0x4793ed['as'],'attributes':_0x4793ed[_0x2392('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x439f19){logger[_0x2392('0x13')](_0x2392('0x1c'),_0x42ed08);logger['debug'](_0x2392('0x1c'),_0x42ed08,JSON['stringify'](_0x439f19));_0x1fc1f2(_0x439f19);})[_0x2392('0x1b')](function(_0x4e6b3a){logger[_0x2392('0x17')](_0x2392('0x1c'),_0x4e6b3a[_0x2392('0x19')],_0x42ed08);_0x3e718a(_0x9cb4ea['error'](0x1f4,_0x4e6b3a['message']));});});}; \ No newline at end of file +var _0xeeae=['request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareProject','SquareProject','options','raw','where','attributes','map','include','model','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x431db8,_0xafd7c6){var _0x15f446=function(_0x4fa720){while(--_0x4fa720){_0x431db8['push'](_0x431db8['shift']());}};_0x15f446(++_0xafd7c6);}(_0xeeae,0xad));var _0xeeea=function(_0x362f1e,_0x36f5bf){_0x362f1e=_0x362f1e-0x0;var _0x26b5d8=_0xeeae[_0x362f1e];return _0x26b5d8;};'use strict';var _=require(_0xeeea('0x0'));var util=require(_0xeeea('0x1'));var moment=require(_0xeeea('0x2'));var BPromise=require(_0xeeea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeea('0x5'));var logger=require(_0xeeea('0x6'))(_0xeeea('0x7'));var config=require(_0xeeea('0x8'));var jayson=require(_0xeeea('0x9'));var client=jayson[_0xeeea('0xa')][_0xeeea('0xb')]({'port':0x232a});config[_0xeeea('0xc')]=_[_0xeeea('0xd')](config[_0xeeea('0xc')],{'host':_0xeeea('0xe'),'port':0x18eb});var socket=require(_0xeeea('0xf'))(new Redis(config['redis']));require('./squareProject.socket')[_0xeeea('0x10')](socket);function respondWithRpcPromise(_0x5787ba,_0x22d5eb,_0x419f97){return new BPromise(function(_0x59a856,_0x1c38db){return client[_0xeeea('0x11')](_0x5787ba,_0x419f97)[_0xeeea('0x12')](function(_0x4f024d){logger[_0xeeea('0x13')](_0xeeea('0x14'),_0x22d5eb,_0xeeea('0x15'));logger[_0xeeea('0x16')](_0xeeea('0x17'),_0x22d5eb,_0xeeea('0x15'),JSON[_0xeeea('0x18')](_0x4f024d));if(_0x4f024d['error']){if(_0x4f024d[_0xeeea('0x19')]['code']===0x1f4){logger[_0xeeea('0x19')](_0xeeea('0x14'),_0x22d5eb,_0x4f024d['error'][_0xeeea('0x1a')]);return _0x1c38db(_0x4f024d[_0xeeea('0x19')][_0xeeea('0x1a')]);}logger[_0xeeea('0x19')](_0xeeea('0x14'),_0x22d5eb,_0x4f024d['error'][_0xeeea('0x1a')]);return _0x59a856(_0x4f024d[_0xeeea('0x19')]['message']);}else{logger[_0xeeea('0x13')]('SquareProject,\x20%s,\x20%s',_0x22d5eb,_0xeeea('0x15'));_0x59a856(_0x4f024d[_0xeeea('0x1b')][_0xeeea('0x1a')]);}})['catch'](function(_0x30ab29){logger[_0xeeea('0x19')](_0xeeea('0x14'),_0x22d5eb,_0x30ab29);_0x1c38db(_0x30ab29);});});}exports[_0xeeea('0x1c')]=function(_0x2eea29){var _0x1c3d4d=this;return new Promise(function(_0x2a99ac,_0x25821b){return db[_0xeeea('0x1d')]['find']({'raw':_0x2eea29[_0xeeea('0x1e')]?_0x2eea29['options'][_0xeeea('0x1f')]===undefined?!![]:![]:!![],'where':_0x2eea29[_0xeeea('0x1e')]?_0x2eea29[_0xeeea('0x1e')][_0xeeea('0x20')]||null:null,'attributes':_0x2eea29['options']?_0x2eea29[_0xeeea('0x1e')][_0xeeea('0x21')]||null:null,'include':_0x2eea29[_0xeeea('0x1e')]?_0x2eea29[_0xeeea('0x1e')]['include']?_[_0xeeea('0x22')](_0x2eea29['options'][_0xeeea('0x23')],function(_0x40b013){return{'model':db[_0x40b013['model']],'as':_0x40b013['as'],'attributes':_0x40b013['attributes'],'include':_0x40b013[_0xeeea('0x23')]?_[_0xeeea('0x22')](_0x40b013['include'],function(_0x717576){return{'model':db[_0x717576[_0xeeea('0x24')]],'as':_0x717576['as'],'attributes':_0x717576[_0xeeea('0x21')],'include':_0x717576[_0xeeea('0x23')]?_['map'](_0x717576['include'],function(_0x4e278a){return{'model':db[_0x4e278a[_0xeeea('0x24')]],'as':_0x4e278a['as'],'attributes':_0x4e278a[_0xeeea('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeeea('0x12')](function(_0x2e1057){logger['info'](_0xeeea('0x1c'),_0x2eea29);logger[_0xeeea('0x16')](_0xeeea('0x1c'),_0x2eea29,JSON[_0xeeea('0x18')](_0x2e1057));_0x2a99ac(_0x2e1057);})[_0xeeea('0x25')](function(_0x12b54e){logger[_0xeeea('0x19')](_0xeeea('0x1c'),_0x12b54e[_0xeeea('0x1a')],_0x2eea29);_0x25821b(_0x1c3d4d[_0xeeea('0x19')](0x1f4,_0x12b54e['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 2ff9200..c797473 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 _0x4819=['length','squareProject:','save','remove','update','emit','removeListener'];(function(_0x4e9c31,_0x10755f){var _0x3aadbb=function(_0x47d571){while(--_0x47d571){_0x4e9c31['push'](_0x4e9c31['shift']());}};_0x3aadbb(++_0x10755f);}(_0x4819,0xcd));var _0x9481=function(_0xb61433,_0x31d758){_0xb61433=_0xb61433-0x0;var _0x123400=_0x4819[_0xb61433];return _0x123400;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x9481('0x0'),_0x9481('0x1'),_0x9481('0x2')];function createListener(_0x12a70c,_0x273a32){return function(_0xfb4034){_0x273a32[_0x9481('0x3')](_0x12a70c,_0xfb4034);};}function removeListener(_0x14dc10,_0xc39edf){return function(){SquareProjectEvents[_0x9481('0x4')](_0x14dc10,_0xc39edf);};}exports['register']=function(_0x4d9e3a){for(var _0x5def07=0x0,_0x54cc78=events[_0x9481('0x5')];_0x5def07<_0x54cc78;_0x5def07++){var _0x6c6a08=events[_0x5def07];var _0x27c033=createListener(_0x9481('0x6')+_0x6c6a08,_0x4d9e3a);SquareProjectEvents['on'](_0x6c6a08,_0x27c033);}}; \ No newline at end of file +var _0x9536=['length','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x9536,0x179));var _0x6953=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x9536[_0xa8883];return _0x479426;};'use strict';var SquareProjectEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),_0x6953('0x2'),_0x6953('0x3')];function createListener(_0x4d218f,_0xc3e4dd){return function(_0x53b172){_0xc3e4dd[_0x6953('0x4')](_0x4d218f,_0x53b172);};}function removeListener(_0x3c32c7,_0x1dee7c){return function(){SquareProjectEvents[_0x6953('0x5')](_0x3c32c7,_0x1dee7c);};}exports[_0x6953('0x6')]=function(_0x494ac2){for(var _0x2b273e=0x0,_0x2bb026=events[_0x6953('0x7')];_0x2b273e<_0x2bb026;_0x2b273e++){var _0x3e1aff=events[_0x2b273e];var _0x1c8225=createListener('squareProject:'+_0x3e1aff,_0x494ac2);SquareProjectEvents['on'](_0x3e1aff,_0x1c8225);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ea3d3fd..6c13452 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 _0x46c5=['../../components/interaction/service','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','/:id/delete','destroy','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x46c5,0x1c9));var _0x546c=function(_0x3e105a,_0x57f817){_0x3e105a=_0x3e105a-0x0;var _0x1188a3=_0x46c5[_0x3e105a];return _0x1188a3;};'use strict';var multer=require('multer');var util=require(_0x546c('0x0'));var path=require(_0x546c('0x1'));var timeout=require(_0x546c('0x2'));var express=require('express');var router=express[_0x546c('0x3')]();var auth=require(_0x546c('0x4'));var interaction=require(_0x546c('0x5'));var config=require('../../config/environment');var controller=require(_0x546c('0x6'));router[_0x546c('0x7')]('/',auth['isAuthenticated'](),controller[_0x546c('0x8')]);router[_0x546c('0x7')](_0x546c('0x9'),auth[_0x546c('0xa')](),controller[_0x546c('0xb')]);router[_0x546c('0x7')](_0x546c('0xc'),auth[_0x546c('0xa')](),controller[_0x546c('0xd')]);router[_0x546c('0xe')]('/',auth['isAuthenticated'](),controller[_0x546c('0xf')]);router[_0x546c('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x546c('0x11')]);router[_0x546c('0x12')](_0x546c('0x13'),auth[_0x546c('0xa')](),controller[_0x546c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1060=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','post','destroy','exports','multer','util','path','express','Router'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x1060,0x72));var _0x0106=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x1060[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x0106('0x0'));var util=require(_0x0106('0x1'));var path=require(_0x0106('0x2'));var timeout=require('connect-timeout');var express=require(_0x0106('0x3'));var router=express[_0x0106('0x4')]();var auth=require(_0x0106('0x5'));var interaction=require(_0x0106('0x6'));var config=require(_0x0106('0x7'));var controller=require('./squareRecording.controller');router[_0x0106('0x8')]('/',auth[_0x0106('0x9')](),controller['index']);router[_0x0106('0x8')](_0x0106('0xa'),auth[_0x0106('0x9')](),controller[_0x0106('0xb')]);router[_0x0106('0x8')](_0x0106('0xc'),auth[_0x0106('0x9')](),controller[_0x0106('0xd')]);router[_0x0106('0xe')]('/',auth[_0x0106('0x9')](),controller['create']);router['put'](_0x0106('0xa'),auth[_0x0106('0x9')](),controller['update']);router['delete']('/:id/delete',auth[_0x0106('0x9')](),controller[_0x0106('0xf')]);module[_0x0106('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0c4f1f2..32c47f9 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 _0x7ada=['STRING','getDataValue','lastIndexOf','sequelize'];(function(_0xd4a527,_0x41cf8d){var _0x3691df=function(_0x196bb1){while(--_0x196bb1){_0xd4a527['push'](_0xd4a527['shift']());}};_0x3691df(++_0x41cf8d);}(_0x7ada,0xab));var _0xa7ad=function(_0x4d68a8,_0x444cc4){_0x4d68a8=_0x4d68a8-0x0;var _0x138b45=_0x7ada[_0x4d68a8];return _0x138b45;};'use strict';var Sequelize=require(_0xa7ad('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa7ad('0x1')]},'callerid':{'type':Sequelize[_0xa7ad('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa7ad('0x1')]},'extension':{'type':Sequelize[_0xa7ad('0x1')]},'priority':{'type':Sequelize[_0xa7ad('0x1')]},'accountcode':{'type':Sequelize[_0xa7ad('0x1')]},'dnid':{'type':Sequelize[_0xa7ad('0x1')]},'projectName':{'type':Sequelize[_0xa7ad('0x1')]},'saveName':{'type':Sequelize[_0xa7ad('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa7ad('0x1')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x1949cc='';var _0x10f1f8=this[_0xa7ad('0x2')]('savePath');if(_0x10f1f8){_0x1949cc=_0x10f1f8['substring'](_0x10f1f8[_0xa7ad('0x3')]('.'));}return _0x1949cc;}}}; \ No newline at end of file +var _0x991e=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','STRING'];(function(_0x4bb604,_0x2759ad){var _0x3b81c8=function(_0x4f0943){while(--_0x4f0943){_0x4bb604['push'](_0x4bb604['shift']());}};_0x3b81c8(++_0x2759ad);}(_0x991e,0x70));var _0xe991=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x991e[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0xe991('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe991('0x1')]},'priority':{'type':Sequelize[_0xe991('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xe991('0x1')]},'projectName':{'type':Sequelize[_0xe991('0x1')]},'saveName':{'type':Sequelize[_0xe991('0x1')]},'filename':{'type':Sequelize[_0xe991('0x1')]},'savePath':{'type':Sequelize[_0xe991('0x1')]},'format':{'type':Sequelize[_0xe991('0x2')],'get':function(){var _0x148db9='';var _0x49069e=this[_0xe991('0x3')](_0xe991('0x4'));if(_0x49069e){_0x148db9=_0x49069e['substring'](_0x49069e[_0xe991('0x5')]('.'));}return _0x148db9;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 365f4db..ecc4162 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 _0x9aae=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','filters','pick','VIRTUAL','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','update','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','Sequelize','download','extname','unlink','message','SquareRecording\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x2e7e0e,_0x28efff){var _0x160b3d=function(_0x386744){while(--_0x386744){_0x2e7e0e['push'](_0x2e7e0e['shift']());}};_0x160b3d(++_0x28efff);}(_0x9aae,0x1de));var _0xe9aa=function(_0x7c59c3,_0x878239){_0x7c59c3=_0x7c59c3-0x0;var _0x4a7200=_0x9aae[_0x7c59c3];return _0x4a7200;};'use strict';var pdf=require(_0xe9aa('0x0'));var emlformat=require(_0xe9aa('0x1'));var rimraf=require(_0xe9aa('0x2'));var zipdir=require(_0xe9aa('0x3'));var jsonpatch=require(_0xe9aa('0x4'));var rp=require(_0xe9aa('0x5'));var moment=require(_0xe9aa('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe9aa('0x7'));var util=require(_0xe9aa('0x8'));var path=require(_0xe9aa('0x9'));var sox=require(_0xe9aa('0xa'));var csv=require(_0xe9aa('0xb'));var ejs=require(_0xe9aa('0xc'));var fs=require('fs');var _=require(_0xe9aa('0xd'));var squel=require(_0xe9aa('0xe'));var crypto=require(_0xe9aa('0xf'));var jsforce=require(_0xe9aa('0x10'));var deskjs=require(_0xe9aa('0x11'));var toCsv=require(_0xe9aa('0xb'));var querystring=require(_0xe9aa('0x12'));var Papa=require(_0xe9aa('0x13'));var Redis=require(_0xe9aa('0x14'));var authService=require(_0xe9aa('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xe9aa('0x16'));var hardwareService=require(_0xe9aa('0x17'));var logger=require(_0xe9aa('0x18'))(_0xe9aa('0x19'));var utils=require(_0xe9aa('0x1a'));var config=require(_0xe9aa('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fd663,_0x45453a){_0x45453a=_0x45453a||0xcc;return function(_0x5c6e23){if(_0x5c6e23){return _0x2fd663[_0xe9aa('0x1c')](_0x45453a);}return _0x2fd663[_0xe9aa('0x1d')](_0x45453a)[_0xe9aa('0x1e')]();};}function respondWithResult(_0x57f138,_0x889cb){_0x889cb=_0x889cb||0xc8;return function(_0x41f6ee){if(_0x41f6ee){return _0x57f138['status'](_0x889cb)[_0xe9aa('0x1f')](_0x41f6ee);}};}function respondWithFilteredResult(_0x237f8d,_0x5a7da9){return function(_0x3bd070){if(_0x3bd070){var _0x2c2b5d=_0x3bd070[_0xe9aa('0x20')],_0x15225a=_0x5a7da9[_0xe9aa('0x21')],_0x1e5721=_0x5a7da9[_0xe9aa('0x21')]+_0x5a7da9['limit'],_0x1bfe61;if(_0x1e5721>=_0x2c2b5d){_0x1e5721=_0x2c2b5d;_0x1bfe61=0xc8;}else{_0x1bfe61=0xce;}_0x237f8d[_0xe9aa('0x1d')](_0x1bfe61);return _0x237f8d[_0xe9aa('0x22')](_0xe9aa('0x23'),_0x15225a+'-'+_0x1e5721+'/'+_0x2c2b5d)[_0xe9aa('0x1f')](_0x3bd070);}return null;};}function patchUpdates(_0x12cff1){return function(_0x4ef5d0){try{jsonpatch[_0xe9aa('0x24')](_0x4ef5d0,_0x12cff1,!![]);}catch(_0x34e4e7){return BPromise[_0xe9aa('0x25')](_0x34e4e7);}return _0x4ef5d0[_0xe9aa('0x26')]();};}function saveUpdates(_0x45a31b,_0x1724cc){return function(_0x13510d){if(_0x13510d){return _0x13510d['update'](_0x45a31b)[_0xe9aa('0x27')](function(_0x11295b){return _0x11295b;});}return null;};}function removeEntity(_0x5451a6,_0x20cb6b){return function(_0x176b67){if(_0x176b67){return _0x176b67[_0xe9aa('0x28')]()[_0xe9aa('0x27')](function(){_0x5451a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x287791,_0x52147f){return function(_0x49f61c){if(!_0x49f61c){_0x287791['sendStatus'](0x194);}return _0x49f61c;};}function handleError(_0x2de388,_0x58943a){_0x58943a=_0x58943a||0x1f4;return function(_0x125c1f){logger[_0xe9aa('0x29')](_0x125c1f[_0xe9aa('0x2a')]);if(_0x125c1f[_0xe9aa('0x2b')]){delete _0x125c1f[_0xe9aa('0x2b')];}_0x2de388[_0xe9aa('0x1d')](_0x58943a)['send'](_0x125c1f);};}exports[_0xe9aa('0x2c')]=function(_0x5cbcaf,_0x363e06){var _0x556f70={},_0x3ff3be={},_0x4c4605={'count':0x0,'rows':[]};var _0x12d6c0=_[_0xe9aa('0x2d')](db['SquareRecording']['rawAttributes'],function(_0x44b76a){return{'name':_0x44b76a[_0xe9aa('0x2e')],'type':_0x44b76a[_0xe9aa('0x2f')][_0xe9aa('0x30')]};});_0x3ff3be[_0xe9aa('0x31')]=_[_0xe9aa('0x2d')](_0x12d6c0,_0xe9aa('0x2b'));_0x3ff3be[_0xe9aa('0x32')]=_['keys'](_0x5cbcaf[_0xe9aa('0x32')]);_0x3ff3be['filters']=_[_0xe9aa('0x33')](_0x3ff3be[_0xe9aa('0x31')],_0x3ff3be[_0xe9aa('0x32')]);_0x556f70['attributes']=_['intersection'](_0x3ff3be[_0xe9aa('0x31')],qs['fields'](_0x5cbcaf[_0xe9aa('0x32')][_0xe9aa('0x34')]));_0x556f70['attributes']=_0x556f70[_0xe9aa('0x35')]['length']?_0x556f70[_0xe9aa('0x35')]:_0x3ff3be[_0xe9aa('0x31')];if(!_0x5cbcaf[_0xe9aa('0x32')][_0xe9aa('0x36')](_0xe9aa('0x37'))){_0x556f70['limit']=qs[_0xe9aa('0x38')](_0x5cbcaf[_0xe9aa('0x32')][_0xe9aa('0x38')]);_0x556f70[_0xe9aa('0x21')]=qs['offset'](_0x5cbcaf['query'][_0xe9aa('0x21')]);}_0x556f70[_0xe9aa('0x39')]=qs['sort'](_0x5cbcaf['query']['sort']);_0x556f70[_0xe9aa('0x3a')]=qs[_0xe9aa('0x3b')](_[_0xe9aa('0x3c')](_0x5cbcaf[_0xe9aa('0x32')],_0x3ff3be[_0xe9aa('0x3b')]),_0x12d6c0);if(_0x5cbcaf[_0xe9aa('0x32')]['filter']){_0x556f70[_0xe9aa('0x3a')]=_['merge'](_0x556f70[_0xe9aa('0x3a')],{'$or':_['map'](_0x12d6c0,function(_0xd97fbe){if(_0xd97fbe['type']!==_0xe9aa('0x3d')){var _0x46f2ba={};_0x46f2ba[_0xd97fbe[_0xe9aa('0x2b')]]={'$like':'%'+_0x5cbcaf[_0xe9aa('0x32')]['filter']+'%'};return _0x46f2ba;}})});}_0x556f70=_[_0xe9aa('0x3e')]({},_0x556f70,_0x5cbcaf[_0xe9aa('0x3f')]);var _0x58b1df={'where':_0x556f70[_0xe9aa('0x3a')]};return db[_0xe9aa('0x40')][_0xe9aa('0x20')](_0x58b1df)[_0xe9aa('0x27')](function(_0x472c51){_0x4c4605['count']=_0x472c51;if(_0x5cbcaf[_0xe9aa('0x32')][_0xe9aa('0x41')]){_0x556f70[_0xe9aa('0x42')]=[{'all':!![]}];}return db[_0xe9aa('0x40')][_0xe9aa('0x43')](_0x556f70);})[_0xe9aa('0x27')](function(_0x17190c){_0x4c4605[_0xe9aa('0x44')]=_0x17190c;return _0x4c4605;})['then'](respondWithFilteredResult(_0x363e06,_0x556f70))[_0xe9aa('0x45')](handleError(_0x363e06,null));};exports['show']=function(_0x23d8e8,_0x37a700){var _0x554926={'raw':!![],'where':{'id':_0x23d8e8[_0xe9aa('0x46')]['id']}},_0x2a2c8e={};_0x2a2c8e[_0xe9aa('0x31')]=_['keys'](db[_0xe9aa('0x40')][_0xe9aa('0x47')]);_0x2a2c8e['query']=_['keys'](_0x23d8e8['query']);_0x2a2c8e[_0xe9aa('0x3b')]=_['intersection'](_0x2a2c8e[_0xe9aa('0x31')],_0x2a2c8e['query']);_0x554926[_0xe9aa('0x35')]=_[_0xe9aa('0x33')](_0x2a2c8e[_0xe9aa('0x31')],qs[_0xe9aa('0x34')](_0x23d8e8['query'][_0xe9aa('0x34')]));_0x554926[_0xe9aa('0x35')]=_0x554926[_0xe9aa('0x35')][_0xe9aa('0x48')]?_0x554926[_0xe9aa('0x35')]:_0x2a2c8e[_0xe9aa('0x31')];if(_0x23d8e8[_0xe9aa('0x32')][_0xe9aa('0x41')]){_0x554926['include']=[{'all':!![]}];}_0x554926=_[_0xe9aa('0x3e')]({},_0x554926,_0x23d8e8[_0xe9aa('0x3f')]);return db[_0xe9aa('0x40')][_0xe9aa('0x49')](_0x554926)[_0xe9aa('0x27')](handleEntityNotFound(_0x37a700,null))['then'](respondWithResult(_0x37a700,null))[_0xe9aa('0x45')](handleError(_0x37a700,null));};exports[_0xe9aa('0x4a')]=function(_0x899169,_0x32daca){return db[_0xe9aa('0x40')]['create'](_0x899169['body'],{})[_0xe9aa('0x27')](respondWithResult(_0x32daca,0xc9))[_0xe9aa('0x45')](handleError(_0x32daca,null));};exports[_0xe9aa('0x4b')]=function(_0x9f254d,_0x2e44d6){if(_0x9f254d['body']['id']){delete _0x9f254d['body']['id'];}return db[_0xe9aa('0x40')]['find']({'where':{'id':_0x9f254d['params']['id']}})['then'](handleEntityNotFound(_0x2e44d6,null))[_0xe9aa('0x27')](saveUpdates(_0x9f254d[_0xe9aa('0x4c')],null))[_0xe9aa('0x27')](respondWithResult(_0x2e44d6,null))[_0xe9aa('0x45')](handleError(_0x2e44d6,null));};exports['download']=function(_0x3149bd,_0x36eab3,_0xcc3621){var _0x2eea34=require(_0xe9aa('0x4d'));var _0x4b84d8=![];var _0x38e760={};if(_0x3149bd[_0xe9aa('0x32')]['type']&&_0x3149bd[_0xe9aa('0x32')][_0xe9aa('0x2f')]===_0xe9aa('0x4e')){_0x38e760[_0xe9aa('0x4e')]=_0x3149bd['params']['id'];}else{_0x38e760['id']=_0x3149bd[_0xe9aa('0x46')]['id'];}return db[_0xe9aa('0x40')][_0xe9aa('0x49')]({'where':_0x38e760,'attributes':['id',_0xe9aa('0x4f'),_0xe9aa('0x50')],'raw':!![]})[_0xe9aa('0x27')](handleEntityNotFound(_0x36eab3,null))['then'](function(_0x486540){if(_0x486540){var _0x333c4c=_0x486540[_0xe9aa('0x4f')];var _0x18eeaf=util[_0xe9aa('0x51')](_0xe9aa('0x52'),_0x333c4c);if(fs[_0xe9aa('0x53')](_0x18eeaf)){_0x4b84d8=!![];return _0x2eea34[_0xe9aa('0x54')](_0x18eeaf,_0x333c4c,config['secrets']['recording'])[_0xe9aa('0x27')](function(){return _0x486540;});}return _0x486540;}})[_0xe9aa('0x27')](function(_0x30f263){if(_0x30f263){var _0x32d4d8=_0x30f263[_0xe9aa('0x4f')];if(!fs[_0xe9aa('0x53')](_0x32d4d8)){throw new db[(_0xe9aa('0x55'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x30f263['filename']){return _0x36eab3[_0xe9aa('0x56')](_0x32d4d8,_0x30f263[_0xe9aa('0x50')]+path[_0xe9aa('0x57')](_0x32d4d8),function(){if(_0x4b84d8){fs[_0xe9aa('0x58')](_0x32d4d8);}});}else{return _0x36eab3[_0xe9aa('0x56')](_0x32d4d8,function(_0x4dd7b8){if(_0x4b84d8){fs[_0xe9aa('0x58')](_0x32d4d8);}});}}})['catch'](function(_0x133b1f){if(_0x133b1f[_0xe9aa('0x59')]===_0xe9aa('0x5a')){_0x36eab3['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x36eab3,null);}});};exports[_0xe9aa('0x28')]=function(_0xc227cd,_0x39ba7d){return db[_0xe9aa('0x40')][_0xe9aa('0x49')]({'where':{'id':_0xc227cd[_0xe9aa('0x46')]['id']}})[_0xe9aa('0x27')](function(_0x1f388c){if(!_0x1f388c)throw new ReferenceError('Entity\x20not\x20found');return _0x1f388c;})[_0xe9aa('0x27')](function(_0x571758){var _0x1e464b=_0x571758[_0xe9aa('0x4f')];logger[_0xe9aa('0x5b')](_0xe9aa('0x5c'),_0x1e464b);if(!_[_0xe9aa('0x5d')](_0x571758[_0xe9aa('0x4f')])&&fs['existsSync'](_0x1e464b)){logger[_0xe9aa('0x5b')](_0xe9aa('0x5e')+_0x1e464b+_0xe9aa('0x5f'));fs[_0xe9aa('0x60')](_0x1e464b);}_0x1e464b=_0x1e464b+_0xe9aa('0x61');if(!_[_0xe9aa('0x5d')](_0x571758[_0xe9aa('0x4f')])&&fs[_0xe9aa('0x53')](_0x1e464b)){logger[_0xe9aa('0x5b')](_0xe9aa('0x5e')+_0x1e464b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe9aa('0x60')](_0x1e464b);}return _0x571758;})['then'](function(_0x172ba5){if(!_0x172ba5)throw new InternalError();return _0x172ba5[_0xe9aa('0x28')]();})[_0xe9aa('0x27')](function(){_0x39ba7d['status'](0xcc)[_0xe9aa('0x1e')]();})[_0xe9aa('0x45')](handleError(_0x39ba7d,null));}; \ No newline at end of file +var _0xad25=['catch','show','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','status','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','merge','where','type','VIRTUAL','count','includeAll','include','findAll','rows'];(function(_0x2cd068,_0x7a0a83){var _0x1f2d00=function(_0x9842dc){while(--_0x9842dc){_0x2cd068['push'](_0x2cd068['shift']());}};_0x1f2d00(++_0x7a0a83);}(_0xad25,0x80));var _0x5ad2=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xad25[_0x40220a];return _0x3903cc;};'use strict';var pdf=require(_0x5ad2('0x0'));var emlformat=require(_0x5ad2('0x1'));var rimraf=require(_0x5ad2('0x2'));var zipdir=require(_0x5ad2('0x3'));var jsonpatch=require(_0x5ad2('0x4'));var rp=require('request-promise');var moment=require(_0x5ad2('0x5'));var BPromise=require(_0x5ad2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5ad2('0x7'));var csv=require(_0x5ad2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ad2('0x9'));var squel=require(_0x5ad2('0xa'));var crypto=require(_0x5ad2('0xb'));var jsforce=require(_0x5ad2('0xc'));var deskjs=require(_0x5ad2('0xd'));var toCsv=require(_0x5ad2('0x8'));var querystring=require(_0x5ad2('0xe'));var Papa=require(_0x5ad2('0xf'));var Redis=require('ioredis');var authService=require(_0x5ad2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ad2('0x11'));var logger=require(_0x5ad2('0x12'))(_0x5ad2('0x13'));var utils=require(_0x5ad2('0x14'));var config=require(_0x5ad2('0x15'));var db=require(_0x5ad2('0x16'))['db'];function respondWithStatusCode(_0x12989f,_0x5efd40){_0x5efd40=_0x5efd40||0xcc;return function(_0x306653){if(_0x306653){return _0x12989f[_0x5ad2('0x17')](_0x5efd40);}return _0x12989f['status'](_0x5efd40)[_0x5ad2('0x18')]();};}function respondWithResult(_0xd806e8,_0x1ef0d5){_0x1ef0d5=_0x1ef0d5||0xc8;return function(_0x1117f4){if(_0x1117f4){return _0xd806e8['status'](_0x1ef0d5)['json'](_0x1117f4);}};}function respondWithFilteredResult(_0x1a86c6,_0x68facb){return function(_0x57be2b){if(_0x57be2b){var _0x3a83d3=_0x57be2b['count'],_0x27d84a=_0x68facb[_0x5ad2('0x19')],_0x8714a7=_0x68facb[_0x5ad2('0x19')]+_0x68facb['limit'],_0x3f3c10;if(_0x8714a7>=_0x3a83d3){_0x8714a7=_0x3a83d3;_0x3f3c10=0xc8;}else{_0x3f3c10=0xce;}_0x1a86c6[_0x5ad2('0x1a')](_0x3f3c10);return _0x1a86c6[_0x5ad2('0x1b')]('Content-Range',_0x27d84a+'-'+_0x8714a7+'/'+_0x3a83d3)[_0x5ad2('0x1c')](_0x57be2b);}return null;};}function patchUpdates(_0xbb4d65){return function(_0x32945a){try{jsonpatch[_0x5ad2('0x1d')](_0x32945a,_0xbb4d65,!![]);}catch(_0x4a432e){return BPromise[_0x5ad2('0x1e')](_0x4a432e);}return _0x32945a[_0x5ad2('0x1f')]();};}function saveUpdates(_0x47ca76,_0x5934d2){return function(_0x4fdabb){if(_0x4fdabb){return _0x4fdabb[_0x5ad2('0x20')](_0x47ca76)[_0x5ad2('0x21')](function(_0x96ae86){return _0x96ae86;});}return null;};}function removeEntity(_0x5a0efd,_0x433062){return function(_0x4ef125){if(_0x4ef125){return _0x4ef125[_0x5ad2('0x22')]()[_0x5ad2('0x21')](function(){_0x5a0efd[_0x5ad2('0x1a')](0xcc)[_0x5ad2('0x18')]();});}};}function handleEntityNotFound(_0x403273,_0x21fe6d){return function(_0x5a7d69){if(!_0x5a7d69){_0x403273[_0x5ad2('0x17')](0x194);}return _0x5a7d69;};}function handleError(_0x5e18fe,_0x504860){_0x504860=_0x504860||0x1f4;return function(_0x2eddf7){logger[_0x5ad2('0x23')](_0x2eddf7[_0x5ad2('0x24')]);if(_0x2eddf7[_0x5ad2('0x25')]){delete _0x2eddf7[_0x5ad2('0x25')];}_0x5e18fe[_0x5ad2('0x1a')](_0x504860)[_0x5ad2('0x26')](_0x2eddf7);};}exports[_0x5ad2('0x27')]=function(_0x58104e,_0x4dc6de){var _0x99ec84={},_0xd8675a={},_0x56c90e={'count':0x0,'rows':[]};var _0x128981=_[_0x5ad2('0x28')](db[_0x5ad2('0x29')][_0x5ad2('0x2a')],function(_0x332887){return{'name':_0x332887[_0x5ad2('0x2b')],'type':_0x332887['type'][_0x5ad2('0x2c')]};});_0xd8675a['model']=_[_0x5ad2('0x28')](_0x128981,_0x5ad2('0x25'));_0xd8675a['query']=_[_0x5ad2('0x2d')](_0x58104e[_0x5ad2('0x2e')]);_0xd8675a[_0x5ad2('0x2f')]=_[_0x5ad2('0x30')](_0xd8675a[_0x5ad2('0x31')],_0xd8675a[_0x5ad2('0x2e')]);_0x99ec84[_0x5ad2('0x32')]=_[_0x5ad2('0x30')](_0xd8675a[_0x5ad2('0x31')],qs[_0x5ad2('0x33')](_0x58104e['query'][_0x5ad2('0x33')]));_0x99ec84[_0x5ad2('0x32')]=_0x99ec84['attributes'][_0x5ad2('0x34')]?_0x99ec84[_0x5ad2('0x32')]:_0xd8675a[_0x5ad2('0x31')];if(!_0x58104e['query'][_0x5ad2('0x35')](_0x5ad2('0x36'))){_0x99ec84[_0x5ad2('0x37')]=qs[_0x5ad2('0x37')](_0x58104e[_0x5ad2('0x2e')]['limit']);_0x99ec84['offset']=qs[_0x5ad2('0x19')](_0x58104e[_0x5ad2('0x2e')]['offset']);}_0x99ec84['order']=qs['sort'](_0x58104e[_0x5ad2('0x2e')][_0x5ad2('0x38')]);_0x99ec84['where']=qs[_0x5ad2('0x2f')](_[_0x5ad2('0x39')](_0x58104e['query'],_0xd8675a['filters']),_0x128981);if(_0x58104e[_0x5ad2('0x2e')][_0x5ad2('0x3a')]){_0x99ec84['where']=_[_0x5ad2('0x3b')](_0x99ec84[_0x5ad2('0x3c')],{'$or':_[_0x5ad2('0x28')](_0x128981,function(_0x4900db){if(_0x4900db[_0x5ad2('0x3d')]!==_0x5ad2('0x3e')){var _0x5ccd94={};_0x5ccd94[_0x4900db['name']]={'$like':'%'+_0x58104e[_0x5ad2('0x2e')][_0x5ad2('0x3a')]+'%'};return _0x5ccd94;}})});}_0x99ec84=_['merge']({},_0x99ec84,_0x58104e['options']);var _0x16a8c9={'where':_0x99ec84[_0x5ad2('0x3c')]};return db[_0x5ad2('0x29')][_0x5ad2('0x3f')](_0x16a8c9)[_0x5ad2('0x21')](function(_0x11038c){_0x56c90e['count']=_0x11038c;if(_0x58104e[_0x5ad2('0x2e')][_0x5ad2('0x40')]){_0x99ec84[_0x5ad2('0x41')]=[{'all':!![]}];}return db[_0x5ad2('0x29')][_0x5ad2('0x42')](_0x99ec84);})['then'](function(_0x1ddd60){_0x56c90e[_0x5ad2('0x43')]=_0x1ddd60;return _0x56c90e;})[_0x5ad2('0x21')](respondWithFilteredResult(_0x4dc6de,_0x99ec84))[_0x5ad2('0x44')](handleError(_0x4dc6de,null));};exports[_0x5ad2('0x45')]=function(_0x4a345f,_0x1b6a5c){var _0x2f7934={'raw':!![],'where':{'id':_0x4a345f[_0x5ad2('0x46')]['id']}},_0x5b4e2d={};_0x5b4e2d[_0x5ad2('0x31')]=_[_0x5ad2('0x2d')](db[_0x5ad2('0x29')][_0x5ad2('0x2a')]);_0x5b4e2d[_0x5ad2('0x2e')]=_[_0x5ad2('0x2d')](_0x4a345f[_0x5ad2('0x2e')]);_0x5b4e2d['filters']=_[_0x5ad2('0x30')](_0x5b4e2d['model'],_0x5b4e2d[_0x5ad2('0x2e')]);_0x2f7934[_0x5ad2('0x32')]=_[_0x5ad2('0x30')](_0x5b4e2d['model'],qs[_0x5ad2('0x33')](_0x4a345f[_0x5ad2('0x2e')][_0x5ad2('0x33')]));_0x2f7934[_0x5ad2('0x32')]=_0x2f7934[_0x5ad2('0x32')]['length']?_0x2f7934[_0x5ad2('0x32')]:_0x5b4e2d['model'];if(_0x4a345f['query'][_0x5ad2('0x40')]){_0x2f7934[_0x5ad2('0x41')]=[{'all':!![]}];}_0x2f7934=_[_0x5ad2('0x3b')]({},_0x2f7934,_0x4a345f['options']);return db[_0x5ad2('0x29')][_0x5ad2('0x47')](_0x2f7934)['then'](handleEntityNotFound(_0x1b6a5c,null))['then'](respondWithResult(_0x1b6a5c,null))[_0x5ad2('0x44')](handleError(_0x1b6a5c,null));};exports[_0x5ad2('0x48')]=function(_0x19d3c5,_0x88c0ac){return db[_0x5ad2('0x29')][_0x5ad2('0x48')](_0x19d3c5[_0x5ad2('0x49')],{})[_0x5ad2('0x21')](respondWithResult(_0x88c0ac,0xc9))[_0x5ad2('0x44')](handleError(_0x88c0ac,null));};exports[_0x5ad2('0x20')]=function(_0x4579b1,_0x3e7a7b){if(_0x4579b1[_0x5ad2('0x49')]['id']){delete _0x4579b1[_0x5ad2('0x49')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x4579b1[_0x5ad2('0x46')]['id']}})[_0x5ad2('0x21')](handleEntityNotFound(_0x3e7a7b,null))['then'](saveUpdates(_0x4579b1[_0x5ad2('0x49')],null))['then'](respondWithResult(_0x3e7a7b,null))[_0x5ad2('0x44')](handleError(_0x3e7a7b,null));};exports[_0x5ad2('0x4a')]=function(_0x4f3940,_0x27772f,_0x1c877d){var _0x127494=require(_0x5ad2('0x4b'));var _0x170abb=![];var _0x522f92={};if(_0x4f3940[_0x5ad2('0x2e')][_0x5ad2('0x3d')]&&_0x4f3940[_0x5ad2('0x2e')][_0x5ad2('0x3d')]===_0x5ad2('0x4c')){_0x522f92['uniqueid']=_0x4f3940[_0x5ad2('0x46')]['id'];}else{_0x522f92['id']=_0x4f3940[_0x5ad2('0x46')]['id'];}return db['SquareRecording'][_0x5ad2('0x47')]({'where':_0x522f92,'attributes':['id',_0x5ad2('0x4d'),_0x5ad2('0x4e')],'raw':!![]})[_0x5ad2('0x21')](handleEntityNotFound(_0x27772f,null))[_0x5ad2('0x21')](function(_0x359ff6){if(_0x359ff6){var _0x786fca=_0x359ff6[_0x5ad2('0x4d')];var _0x97c788=util[_0x5ad2('0x4f')](_0x5ad2('0x50'),_0x786fca);if(fs[_0x5ad2('0x51')](_0x97c788)){_0x170abb=!![];return _0x127494['decryptFile'](_0x97c788,_0x786fca,config[_0x5ad2('0x52')]['recording'])[_0x5ad2('0x21')](function(){return _0x359ff6;});}return _0x359ff6;}})[_0x5ad2('0x21')](function(_0x2e7eaa){if(_0x2e7eaa){var _0x561e2f=_0x2e7eaa[_0x5ad2('0x4d')];if(!fs[_0x5ad2('0x51')](_0x561e2f)){throw new db[(_0x5ad2('0x53'))][(_0x5ad2('0x54'))](_0x5ad2('0x55'));}if(_0x2e7eaa[_0x5ad2('0x4e')]){return _0x27772f[_0x5ad2('0x4a')](_0x561e2f,_0x2e7eaa[_0x5ad2('0x4e')]+path[_0x5ad2('0x56')](_0x561e2f),function(){if(_0x170abb){fs['unlink'](_0x561e2f);}});}else{return _0x27772f[_0x5ad2('0x4a')](_0x561e2f,function(_0x1c8d7e){if(_0x170abb){fs[_0x5ad2('0x57')](_0x561e2f);}});}}})[_0x5ad2('0x44')](function(_0x417041){if(_0x417041[_0x5ad2('0x58')]==='SquareRecording\x20not\x20found'){_0x27772f[_0x5ad2('0x1a')](0x194)[_0x5ad2('0x26')](_0x5ad2('0x59'));}else{return handleError(_0x27772f,null);}});};exports['destroy']=function(_0x3dbbf2,_0x5ab35d){return db[_0x5ad2('0x29')][_0x5ad2('0x47')]({'where':{'id':_0x3dbbf2[_0x5ad2('0x46')]['id']}})[_0x5ad2('0x21')](function(_0x246459){if(!_0x246459)throw new ReferenceError(_0x5ad2('0x5a'));return _0x246459;})[_0x5ad2('0x21')](function(_0x19e95a){var _0x2ad309=_0x19e95a[_0x5ad2('0x4d')];logger[_0x5ad2('0x5b')](_0x5ad2('0x5c'),_0x2ad309);if(!_[_0x5ad2('0x5d')](_0x19e95a['savePath'])&&fs[_0x5ad2('0x51')](_0x2ad309)){logger['info'](_0x5ad2('0x5e')+_0x2ad309+_0x5ad2('0x5f'));fs['unlinkSync'](_0x2ad309);}_0x2ad309=_0x2ad309+_0x5ad2('0x60');if(!_[_0x5ad2('0x5d')](_0x19e95a['savePath'])&&fs[_0x5ad2('0x51')](_0x2ad309)){logger[_0x5ad2('0x5b')](_0x5ad2('0x5e')+_0x2ad309+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5ad2('0x61')](_0x2ad309);}return _0x19e95a;})['then'](function(_0x179166){if(!_0x179166)throw new InternalError();return _0x179166[_0x5ad2('0x22')]();})[_0x5ad2('0x21')](function(){_0x5ab35d['status'](0xcc)[_0x5ad2('0x18')]();})[_0x5ad2('0x44')](handleError(_0x5ab35d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index b777c75..5351644 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 _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareRecording','square_recordings','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3f09a3,_0x5a2624){_0x3f09a3=_0x3f09a3-0x0;var _0x484fb2=_0xf4f4[_0x3f09a3];return _0x484fb2;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./squareRecording.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x536f=['lodash','bluebird','request-promise','path','rimraf','./squareRecording.attributes','define'];(function(_0x8444b3,_0x6295c0){var _0x244fa7=function(_0x36cf42){while(--_0x36cf42){_0x8444b3['push'](_0x8444b3['shift']());}};_0x244fa7(++_0x6295c0);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf536('0x1'));var rp=require(_0xf536('0x2'));var fs=require('fs');var path=require(_0xf536('0x3'));var rimraf=require(_0xf536('0x4'));var config=require('../../config/environment');var attributes=require(_0xf536('0x5'));module['exports']=function(_0xbe060e,_0x7e339b){return _0xbe060e[_0xf536('0x6')]('SquareRecording',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 f64849b..3ee9bb7 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 _0x5ac0=['message','result','catch','CreateSquareRecording','SquareRecording','body','options','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0x5ac0,0x174));var _0x05ac=function(_0x32ef67,_0x1e5773){_0x32ef67=_0x32ef67-0x0;var _0x478cdf=_0x5ac0[_0x32ef67];return _0x478cdf;};'use strict';var _=require(_0x05ac('0x0'));var util=require(_0x05ac('0x1'));var moment=require(_0x05ac('0x2'));var BPromise=require('bluebird');var rs=require(_0x05ac('0x3'));var fs=require('fs');var Redis=require(_0x05ac('0x4'));var db=require(_0x05ac('0x5'))['db'];var utils=require(_0x05ac('0x6'));var logger=require(_0x05ac('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x05ac('0x8'));var client=jayson[_0x05ac('0x9')][_0x05ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x307186,_0x14ced6,_0x52c8a9){return new BPromise(function(_0x31a601,_0x39527f){return client[_0x05ac('0xb')](_0x307186,_0x52c8a9)['then'](function(_0x4157e0){logger[_0x05ac('0xc')](_0x05ac('0xd'),_0x14ced6,_0x05ac('0xe'));logger[_0x05ac('0xf')](_0x05ac('0x10'),_0x14ced6,_0x05ac('0xe'),JSON[_0x05ac('0x11')](_0x4157e0));if(_0x4157e0[_0x05ac('0x12')]){if(_0x4157e0[_0x05ac('0x12')][_0x05ac('0x13')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x14ced6,_0x4157e0['error'][_0x05ac('0x14')]);return _0x39527f(_0x4157e0[_0x05ac('0x12')][_0x05ac('0x14')]);}logger['error'](_0x05ac('0xd'),_0x14ced6,_0x4157e0['error']['message']);return _0x31a601(_0x4157e0[_0x05ac('0x12')]['message']);}else{logger[_0x05ac('0xc')]('SquareRecording,\x20%s,\x20%s',_0x14ced6,_0x05ac('0xe'));_0x31a601(_0x4157e0[_0x05ac('0x15')][_0x05ac('0x14')]);}})[_0x05ac('0x16')](function(_0x539cf2){logger[_0x05ac('0x12')]('SquareRecording,\x20%s,\x20%s',_0x14ced6,_0x539cf2);_0x39527f(_0x539cf2);});});}exports[_0x05ac('0x17')]=function(_0x3f3ac2){var _0x3ec3aa=this;return new Promise(function(_0x4f475b,_0x2990ab){return db[_0x05ac('0x18')]['create'](_0x3f3ac2[_0x05ac('0x19')],{'raw':_0x3f3ac2['options']?_0x3f3ac2[_0x05ac('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x05ac('0x1b')](function(_0x530c61){logger[_0x05ac('0xc')](_0x05ac('0x17'),_0x3f3ac2);logger[_0x05ac('0xf')](_0x05ac('0x17'),_0x3f3ac2,JSON[_0x05ac('0x11')](_0x530c61));_0x4f475b(_0x530c61);})['catch'](function(_0xb8ceef){logger[_0x05ac('0x12')]('CreateSquareRecording',_0xb8ceef['message'],_0x3f3ac2);_0x2990ab(_0x3ec3aa['error'](0x1f4,_0xb8ceef['message']));});});}; \ No newline at end of file +var _0x65ef=['message','request\x20sent','result','catch','CreateSquareRecording','body','options','raw','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x13c31e,_0x3c5bb3){var _0x33b56b=function(_0x37f2a6){while(--_0x37f2a6){_0x13c31e['push'](_0x13c31e['shift']());}};_0x33b56b(++_0x3c5bb3);}(_0x65ef,0x128));var _0xf65e=function(_0x1d7d11,_0x63620e){_0x1d7d11=_0x1d7d11-0x0;var _0x489aca=_0x65ef[_0x1d7d11];return _0x489aca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf65e('0x0'));var BPromise=require('bluebird');var rs=require(_0xf65e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf65e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf65e('0x3'))('rpc');var config=require(_0xf65e('0x4'));var jayson=require(_0xf65e('0x5'));var client=jayson[_0xf65e('0x6')][_0xf65e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29db41,_0x1d88ad,_0x2cdab7){return new BPromise(function(_0x3a03ed,_0x1b461d){return client['request'](_0x29db41,_0x2cdab7)[_0xf65e('0x8')](function(_0x2696a3){logger[_0xf65e('0x9')](_0xf65e('0xa'),_0x1d88ad,'request\x20sent');logger[_0xf65e('0xb')](_0xf65e('0xc'),_0x1d88ad,'request\x20sent',JSON[_0xf65e('0xd')](_0x2696a3));if(_0x2696a3[_0xf65e('0xe')]){if(_0x2696a3[_0xf65e('0xe')][_0xf65e('0xf')]===0x1f4){logger[_0xf65e('0xe')](_0xf65e('0xa'),_0x1d88ad,_0x2696a3[_0xf65e('0xe')][_0xf65e('0x10')]);return _0x1b461d(_0x2696a3[_0xf65e('0xe')][_0xf65e('0x10')]);}logger[_0xf65e('0xe')](_0xf65e('0xa'),_0x1d88ad,_0x2696a3[_0xf65e('0xe')][_0xf65e('0x10')]);return _0x3a03ed(_0x2696a3[_0xf65e('0xe')][_0xf65e('0x10')]);}else{logger[_0xf65e('0x9')]('SquareRecording,\x20%s,\x20%s',_0x1d88ad,_0xf65e('0x11'));_0x3a03ed(_0x2696a3[_0xf65e('0x12')][_0xf65e('0x10')]);}})[_0xf65e('0x13')](function(_0x264f00){logger[_0xf65e('0xe')](_0xf65e('0xa'),_0x1d88ad,_0x264f00);_0x1b461d(_0x264f00);});});}exports[_0xf65e('0x14')]=function(_0x26e9c0){var _0x14cb54=this;return new Promise(function(_0x35f44b,_0x4dda64){return db['SquareRecording']['create'](_0x26e9c0[_0xf65e('0x15')],{'raw':_0x26e9c0['options']?_0x26e9c0[_0xf65e('0x16')][_0xf65e('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x194976){logger[_0xf65e('0x9')](_0xf65e('0x14'),_0x26e9c0);logger['debug'](_0xf65e('0x14'),_0x26e9c0,JSON[_0xf65e('0xd')](_0x194976));_0x35f44b(_0x194976);})[_0xf65e('0x13')](function(_0x4f2f9d){logger[_0xf65e('0xe')]('CreateSquareRecording',_0x4f2f9d[_0xf65e('0x10')],_0x26e9c0);_0x4dda64(_0x14cb54[_0xf65e('0xe')](0x1f4,_0x4f2f9d[_0xf65e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index cf8b53b..64af917 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 _0x50d8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','update','destroy','exports','multer','util','express','Router'];(function(_0x2bf0cd,_0x5262fd){var _0x364dc1=function(_0x3ec408){while(--_0x3ec408){_0x2bf0cd['push'](_0x2bf0cd['shift']());}};_0x364dc1(++_0x5262fd);}(_0x50d8,0x1a0));var _0x850d=function(_0x6bfc39,_0x30f29f){_0x6bfc39=_0x6bfc39-0x0;var _0x3e8338=_0x50d8[_0x6bfc39];return _0x3e8338;};'use strict';var multer=require(_0x850d('0x0'));var util=require(_0x850d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x850d('0x2'));var router=express[_0x850d('0x3')]();var auth=require(_0x850d('0x4'));var interaction=require(_0x850d('0x5'));var config=require(_0x850d('0x6'));var controller=require(_0x850d('0x7'));router['get']('/',auth[_0x850d('0x8')](),controller[_0x850d('0x9')]);router['get'](_0x850d('0xa'),auth[_0x850d('0x8')](),controller[_0x850d('0xb')]);router[_0x850d('0xc')](_0x850d('0xd'),auth[_0x850d('0x8')](),controller[_0x850d('0xe')]);router[_0x850d('0xf')]('/',auth['isAuthenticated'](),controller[_0x850d('0x10')]);router[_0x850d('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x850d('0x12')]);router['delete'](_0x850d('0xd'),auth[_0x850d('0x8')](),controller[_0x850d('0x13')]);module[_0x850d('0x14')]=router; \ No newline at end of file +var _0x2d64=['isAuthenticated','index','/describe','describe','show','create','put','delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get'];(function(_0x545b74,_0x266a19){var _0x3ef6d1=function(_0x440e56){while(--_0x440e56){_0x545b74['push'](_0x545b74['shift']());}};_0x3ef6d1(++_0x266a19);}(_0x2d64,0x91));var _0x42d6=function(_0x15eb3b,_0x461ff5){_0x15eb3b=_0x15eb3b-0x0;var _0x3de2de=_0x2d64[_0x15eb3b];return _0x3de2de;};'use strict';var multer=require(_0x42d6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42d6('0x1'));var express=require('express');var router=express[_0x42d6('0x2')]();var auth=require(_0x42d6('0x3'));var interaction=require(_0x42d6('0x4'));var config=require(_0x42d6('0x5'));var controller=require(_0x42d6('0x6'));router[_0x42d6('0x7')]('/',auth[_0x42d6('0x8')](),controller[_0x42d6('0x9')]);router[_0x42d6('0x7')](_0x42d6('0xa'),auth[_0x42d6('0x8')](),controller[_0x42d6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x42d6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x42d6('0xd')]);router[_0x42d6('0xe')]('/:id',auth[_0x42d6('0x8')](),controller['update']);router[_0x42d6('0xf')]('/:id',auth[_0x42d6('0x8')](),controller[_0x42d6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 551d648..7472e96 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 _0x3386=['DATE','sequelize','STRING'];(function(_0x47cb22,_0x331a78){var _0x53fef5=function(_0x1d29ef){while(--_0x1d29ef){_0x47cb22['push'](_0x47cb22['shift']());}};_0x53fef5(++_0x331a78);}(_0x3386,0x1db));var _0x6338=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x3386[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x6338('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x6338('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6338('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6338('0x1')]},'uniqueid':{'type':Sequelize[_0x6338('0x1')]},'version':{'type':Sequelize[_0x6338('0x1')]},'callerid':{'type':Sequelize[_0x6338('0x1')]},'calleridname':{'type':Sequelize[_0x6338('0x1')]},'callingpres':{'type':Sequelize[_0x6338('0x1')]},'callingani2':{'type':Sequelize[_0x6338('0x1')]},'callington':{'type':Sequelize[_0x6338('0x1')]},'callingtns':{'type':Sequelize[_0x6338('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6338('0x1')]},'extension':{'type':Sequelize[_0x6338('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x6338('0x1')]},'accountcode':{'type':Sequelize[_0x6338('0x1')]},'threadid':{'type':Sequelize[_0x6338('0x1')]},'project_name':{'type':Sequelize[_0x6338('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6338('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x10a4=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x438972,_0x2e6e2b){var _0x520f94=function(_0x41cf67){while(--_0x41cf67){_0x438972['push'](_0x438972['shift']());}};_0x520f94(++_0x2e6e2b);}(_0x10a4,0x1df));var _0x410a=function(_0x428dbd,_0x30eeb5){_0x428dbd=_0x428dbd-0x0;var _0xc411d8=_0x10a4[_0x428dbd];return _0xc411d8;};'use strict';var Sequelize=require(_0x410a('0x0'));module[_0x410a('0x1')]={'network':{'type':Sequelize[_0x410a('0x2')]},'network_script':{'type':Sequelize[_0x410a('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x410a('0x2')]},'language':{'type':Sequelize[_0x410a('0x2')]},'type':{'type':Sequelize[_0x410a('0x2')]},'uniqueid':{'type':Sequelize[_0x410a('0x2')]},'version':{'type':Sequelize[_0x410a('0x2')]},'callerid':{'type':Sequelize[_0x410a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x410a('0x2')]},'callington':{'type':Sequelize[_0x410a('0x2')]},'callingtns':{'type':Sequelize[_0x410a('0x2')]},'dnid':{'type':Sequelize[_0x410a('0x2')]},'rdnis':{'type':Sequelize[_0x410a('0x2')]},'context':{'type':Sequelize[_0x410a('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x410a('0x2')]},'accountcode':{'type':Sequelize[_0x410a('0x2')]},'threadid':{'type':Sequelize[_0x410a('0x2')]},'project_name':{'type':Sequelize[_0x410a('0x2')]},'joinAt':{'type':Sequelize[_0x410a('0x3')]},'leaveAt':{'type':Sequelize[_0x410a('0x3')]},'bot':{'type':Sequelize[_0x410a('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index ba84633..1542a43 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 _0xa8a6=['json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','show','params','find','catch','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1cf296,_0x2ac7d7){var _0x51f289=function(_0x18bc9e){while(--_0x18bc9e){_0x1cf296['push'](_0x1cf296['shift']());}};_0x51f289(++_0x2ac7d7);}(_0xa8a6,0x151));var _0x6a8a=function(_0x856a36,_0x31db8c){_0x856a36=_0x856a36-0x0;var _0x1f1d05=_0xa8a6[_0x856a36];return _0x1f1d05;};'use strict';var pdf=require(_0x6a8a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a8a('0x1'));var zipdir=require(_0x6a8a('0x2'));var jsonpatch=require(_0x6a8a('0x3'));var rp=require(_0x6a8a('0x4'));var moment=require(_0x6a8a('0x5'));var BPromise=require(_0x6a8a('0x6'));var Mustache=require(_0x6a8a('0x7'));var util=require(_0x6a8a('0x8'));var path=require(_0x6a8a('0x9'));var sox=require(_0x6a8a('0xa'));var csv=require(_0x6a8a('0xb'));var ejs=require(_0x6a8a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6a8a('0xd'));var crypto=require('crypto');var jsforce=require(_0x6a8a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6a8a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a8a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a8a('0x10'));var logger=require(_0x6a8a('0x11'))(_0x6a8a('0x12'));var utils=require('../../config/utils');var config=require(_0x6a8a('0x13'));var db=require(_0x6a8a('0x14'))['db'];function respondWithStatusCode(_0x7743a9,_0xa2f334){_0xa2f334=_0xa2f334||0xcc;return function(_0x3a2eec){if(_0x3a2eec){return _0x7743a9[_0x6a8a('0x15')](_0xa2f334);}return _0x7743a9[_0x6a8a('0x16')](_0xa2f334)['end']();};}function respondWithResult(_0x3be212,_0x1fc575){_0x1fc575=_0x1fc575||0xc8;return function(_0x8cf245){if(_0x8cf245){return _0x3be212['status'](_0x1fc575)[_0x6a8a('0x17')](_0x8cf245);}};}function respondWithFilteredResult(_0x53692f,_0x47d26d){return function(_0xa8e88d){if(_0xa8e88d){var _0x2ef816=_0xa8e88d['count'],_0x2c7440=_0x47d26d[_0x6a8a('0x18')],_0x113e60=_0x47d26d[_0x6a8a('0x18')]+_0x47d26d[_0x6a8a('0x19')],_0x82a87e;if(_0x113e60>=_0x2ef816){_0x113e60=_0x2ef816;_0x82a87e=0xc8;}else{_0x82a87e=0xce;}_0x53692f[_0x6a8a('0x16')](_0x82a87e);return _0x53692f[_0x6a8a('0x1a')](_0x6a8a('0x1b'),_0x2c7440+'-'+_0x113e60+'/'+_0x2ef816)[_0x6a8a('0x17')](_0xa8e88d);}return null;};}function patchUpdates(_0x2e703b){return function(_0x141a0b){try{jsonpatch[_0x6a8a('0x1c')](_0x141a0b,_0x2e703b,!![]);}catch(_0x2eeae6){return BPromise[_0x6a8a('0x1d')](_0x2eeae6);}return _0x141a0b[_0x6a8a('0x1e')]();};}function saveUpdates(_0x57297e,_0x144903){return function(_0x50ab90){if(_0x50ab90){return _0x50ab90['update'](_0x57297e)[_0x6a8a('0x1f')](function(_0x176d86){return _0x176d86;});}return null;};}function removeEntity(_0x2f51af,_0x4b8c77){return function(_0x1c5eff){if(_0x1c5eff){return _0x1c5eff[_0x6a8a('0x20')]()[_0x6a8a('0x1f')](function(){_0x2f51af[_0x6a8a('0x16')](0xcc)[_0x6a8a('0x21')]();});}};}function handleEntityNotFound(_0x229db7,_0x52b6b4){return function(_0x3eaae1){if(!_0x3eaae1){_0x229db7['sendStatus'](0x194);}return _0x3eaae1;};}function handleError(_0x485dd9,_0x46dae4){_0x46dae4=_0x46dae4||0x1f4;return function(_0x2859b3){logger['error'](_0x2859b3[_0x6a8a('0x22')]);if(_0x2859b3[_0x6a8a('0x23')]){delete _0x2859b3[_0x6a8a('0x23')];}_0x485dd9[_0x6a8a('0x16')](_0x46dae4)['send'](_0x2859b3);};}exports[_0x6a8a('0x24')]=function(_0x786dd,_0x22fb3b){var _0x43db8e={},_0x580156={},_0x8f085e={'count':0x0,'rows':[]};var _0x2b84b6=_[_0x6a8a('0x25')](db[_0x6a8a('0x26')][_0x6a8a('0x27')],function(_0x1f3a82){return{'name':_0x1f3a82[_0x6a8a('0x28')],'type':_0x1f3a82[_0x6a8a('0x29')]['key']};});_0x580156[_0x6a8a('0x2a')]=_[_0x6a8a('0x25')](_0x2b84b6,'name');_0x580156['query']=_[_0x6a8a('0x2b')](_0x786dd[_0x6a8a('0x2c')]);_0x580156[_0x6a8a('0x2d')]=_['intersection'](_0x580156[_0x6a8a('0x2a')],_0x580156['query']);_0x43db8e[_0x6a8a('0x2e')]=_[_0x6a8a('0x2f')](_0x580156['model'],qs[_0x6a8a('0x30')](_0x786dd[_0x6a8a('0x2c')]['fields']));_0x43db8e[_0x6a8a('0x2e')]=_0x43db8e[_0x6a8a('0x2e')][_0x6a8a('0x31')]?_0x43db8e['attributes']:_0x580156[_0x6a8a('0x2a')];if(!_0x786dd['query'][_0x6a8a('0x32')](_0x6a8a('0x33'))){_0x43db8e[_0x6a8a('0x19')]=qs[_0x6a8a('0x19')](_0x786dd[_0x6a8a('0x2c')][_0x6a8a('0x19')]);_0x43db8e['offset']=qs[_0x6a8a('0x18')](_0x786dd[_0x6a8a('0x2c')]['offset']);}_0x43db8e[_0x6a8a('0x34')]=qs[_0x6a8a('0x35')](_0x786dd[_0x6a8a('0x2c')][_0x6a8a('0x35')]);_0x43db8e['where']=qs[_0x6a8a('0x2d')](_[_0x6a8a('0x36')](_0x786dd['query'],_0x580156[_0x6a8a('0x2d')]),_0x2b84b6);if(_0x786dd['query']['filter']){_0x43db8e[_0x6a8a('0x37')]=_['merge'](_0x43db8e[_0x6a8a('0x37')],{'$or':_[_0x6a8a('0x25')](_0x2b84b6,function(_0x4aa287){if(_0x4aa287[_0x6a8a('0x29')]!==_0x6a8a('0x38')){var _0x4d7521={};_0x4d7521[_0x4aa287['name']]={'$like':'%'+_0x786dd[_0x6a8a('0x2c')][_0x6a8a('0x39')]+'%'};return _0x4d7521;}})});}_0x43db8e=_[_0x6a8a('0x3a')]({},_0x43db8e,_0x786dd[_0x6a8a('0x3b')]);var _0xd52d1f={'where':_0x43db8e[_0x6a8a('0x37')]};return db[_0x6a8a('0x26')][_0x6a8a('0x3c')](_0xd52d1f)['then'](function(_0x30c344){_0x8f085e['count']=_0x30c344;if(_0x786dd['query'][_0x6a8a('0x3d')]){_0x43db8e[_0x6a8a('0x3e')]=[{'all':!![]}];}return db['SquareReport'][_0x6a8a('0x3f')](_0x43db8e);})[_0x6a8a('0x1f')](function(_0x53251b){_0x8f085e['rows']=_0x53251b;return _0x8f085e;})['then'](respondWithFilteredResult(_0x22fb3b,_0x43db8e))['catch'](handleError(_0x22fb3b,null));};exports[_0x6a8a('0x40')]=function(_0x490f06,_0x15b15d){var _0x3d545a={'raw':!![],'where':{'id':_0x490f06[_0x6a8a('0x41')]['id']}},_0x388296={};_0x388296[_0x6a8a('0x2a')]=_[_0x6a8a('0x2b')](db[_0x6a8a('0x26')][_0x6a8a('0x27')]);_0x388296[_0x6a8a('0x2c')]=_['keys'](_0x490f06[_0x6a8a('0x2c')]);_0x388296['filters']=_[_0x6a8a('0x2f')](_0x388296[_0x6a8a('0x2a')],_0x388296[_0x6a8a('0x2c')]);_0x3d545a[_0x6a8a('0x2e')]=_[_0x6a8a('0x2f')](_0x388296[_0x6a8a('0x2a')],qs[_0x6a8a('0x30')](_0x490f06[_0x6a8a('0x2c')]['fields']));_0x3d545a['attributes']=_0x3d545a[_0x6a8a('0x2e')][_0x6a8a('0x31')]?_0x3d545a[_0x6a8a('0x2e')]:_0x388296['model'];if(_0x490f06[_0x6a8a('0x2c')]['includeAll']){_0x3d545a[_0x6a8a('0x3e')]=[{'all':!![]}];}_0x3d545a=_[_0x6a8a('0x3a')]({},_0x3d545a,_0x490f06[_0x6a8a('0x3b')]);return db[_0x6a8a('0x26')][_0x6a8a('0x42')](_0x3d545a)[_0x6a8a('0x1f')](handleEntityNotFound(_0x15b15d,null))[_0x6a8a('0x1f')](respondWithResult(_0x15b15d,null))[_0x6a8a('0x43')](handleError(_0x15b15d,null));};exports[_0x6a8a('0x44')]=function(_0x17db2e,_0x4e3791){return db['SquareReport']['create'](_0x17db2e[_0x6a8a('0x45')],{})[_0x6a8a('0x1f')](respondWithResult(_0x4e3791,0xc9))[_0x6a8a('0x43')](handleError(_0x4e3791,null));};exports[_0x6a8a('0x46')]=function(_0x1e90e1,_0x406b88){if(_0x1e90e1[_0x6a8a('0x45')]['id']){delete _0x1e90e1[_0x6a8a('0x45')]['id'];}return db[_0x6a8a('0x26')][_0x6a8a('0x42')]({'where':{'id':_0x1e90e1['params']['id']}})[_0x6a8a('0x1f')](handleEntityNotFound(_0x406b88,null))[_0x6a8a('0x1f')](saveUpdates(_0x1e90e1[_0x6a8a('0x45')],null))['then'](respondWithResult(_0x406b88,null))[_0x6a8a('0x43')](handleError(_0x406b88,null));};exports['destroy']=function(_0x750402,_0x5d125e){return db[_0x6a8a('0x26')][_0x6a8a('0x42')]({'where':{'id':_0x750402[_0x6a8a('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d125e,null))[_0x6a8a('0x1f')](removeEntity(_0x5d125e,null))[_0x6a8a('0x43')](handleError(_0x5d125e,null));};exports[_0x6a8a('0x47')]=function(_0x2d02f6,_0x135c30){return db['SquareReport'][_0x6a8a('0x47')]()[_0x6a8a('0x1f')](respondWithResult(_0x135c30,null))[_0x6a8a('0x43')](handleError(_0x135c30,null));}; \ No newline at end of file +var _0xa1cb=['find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','update','destroy','then','error','stack','name','map','SquareReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','sort','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge'];(function(_0x453021,_0x16e725){var _0x2cda8c=function(_0x460e9d){while(--_0x460e9d){_0x453021['push'](_0x453021['shift']());}};_0x2cda8c(++_0x16e725);}(_0xa1cb,0x1ef));var _0xba1c=function(_0x22d6fd,_0x645ab6){_0x22d6fd=_0x22d6fd-0x0;var _0x33096c=_0xa1cb[_0x22d6fd];return _0x33096c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba1c('0x1'));var jsonpatch=require(_0xba1c('0x2'));var rp=require(_0xba1c('0x3'));var moment=require(_0xba1c('0x4'));var BPromise=require(_0xba1c('0x5'));var Mustache=require(_0xba1c('0x6'));var util=require(_0xba1c('0x7'));var path=require(_0xba1c('0x8'));var sox=require(_0xba1c('0x9'));var csv=require('to-csv');var ejs=require(_0xba1c('0xa'));var fs=require('fs');var _=require(_0xba1c('0xb'));var squel=require(_0xba1c('0xc'));var crypto=require(_0xba1c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xba1c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xba1c('0xf'));var Papa=require(_0xba1c('0x10'));var Redis=require(_0xba1c('0x11'));var authService=require(_0xba1c('0x12'));var qs=require(_0xba1c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xba1c('0x14'));var utils=require(_0xba1c('0x15'));var config=require(_0xba1c('0x16'));var db=require(_0xba1c('0x17'))['db'];function respondWithStatusCode(_0xcbb46f,_0x2bab90){_0x2bab90=_0x2bab90||0xcc;return function(_0xf0157){if(_0xf0157){return _0xcbb46f[_0xba1c('0x18')](_0x2bab90);}return _0xcbb46f[_0xba1c('0x19')](_0x2bab90)[_0xba1c('0x1a')]();};}function respondWithResult(_0x4e89d2,_0x5a79bb){_0x5a79bb=_0x5a79bb||0xc8;return function(_0x29267a){if(_0x29267a){return _0x4e89d2[_0xba1c('0x19')](_0x5a79bb)[_0xba1c('0x1b')](_0x29267a);}};}function respondWithFilteredResult(_0x48a160,_0x304ccb){return function(_0x5c2e3e){if(_0x5c2e3e){var _0x34d0d5=_0x5c2e3e[_0xba1c('0x1c')],_0x27ec3=_0x304ccb['offset'],_0x145741=_0x304ccb[_0xba1c('0x1d')]+_0x304ccb['limit'],_0x1e43e5;if(_0x145741>=_0x34d0d5){_0x145741=_0x34d0d5;_0x1e43e5=0xc8;}else{_0x1e43e5=0xce;}_0x48a160[_0xba1c('0x19')](_0x1e43e5);return _0x48a160[_0xba1c('0x1e')]('Content-Range',_0x27ec3+'-'+_0x145741+'/'+_0x34d0d5)['json'](_0x5c2e3e);}return null;};}function patchUpdates(_0x3c82f3){return function(_0x4be82f){try{jsonpatch[_0xba1c('0x1f')](_0x4be82f,_0x3c82f3,!![]);}catch(_0x3ad61e){return BPromise['reject'](_0x3ad61e);}return _0x4be82f[_0xba1c('0x20')]();};}function saveUpdates(_0x578b48,_0x10916d){return function(_0xe5c43){if(_0xe5c43){return _0xe5c43[_0xba1c('0x21')](_0x578b48)['then'](function(_0x30c855){return _0x30c855;});}return null;};}function removeEntity(_0x197882,_0x547651){return function(_0x24a13c){if(_0x24a13c){return _0x24a13c[_0xba1c('0x22')]()[_0xba1c('0x23')](function(){_0x197882[_0xba1c('0x19')](0xcc)[_0xba1c('0x1a')]();});}};}function handleEntityNotFound(_0x47dd47,_0x30b68a){return function(_0x521b25){if(!_0x521b25){_0x47dd47[_0xba1c('0x18')](0x194);}return _0x521b25;};}function handleError(_0x567978,_0x557c56){_0x557c56=_0x557c56||0x1f4;return function(_0x2d698d){logger[_0xba1c('0x24')](_0x2d698d[_0xba1c('0x25')]);if(_0x2d698d[_0xba1c('0x26')]){delete _0x2d698d[_0xba1c('0x26')];}_0x567978['status'](_0x557c56)['send'](_0x2d698d);};}exports['index']=function(_0x336483,_0x4d0ca0){var _0x51db64={},_0x1ed1fe={},_0x36085a={'count':0x0,'rows':[]};var _0x1e2dcc=_[_0xba1c('0x27')](db[_0xba1c('0x28')][_0xba1c('0x29')],function(_0x7890b1){return{'name':_0x7890b1['fieldName'],'type':_0x7890b1['type'][_0xba1c('0x2a')]};});_0x1ed1fe[_0xba1c('0x2b')]=_['map'](_0x1e2dcc,_0xba1c('0x26'));_0x1ed1fe[_0xba1c('0x2c')]=_[_0xba1c('0x2d')](_0x336483[_0xba1c('0x2c')]);_0x1ed1fe[_0xba1c('0x2e')]=_['intersection'](_0x1ed1fe[_0xba1c('0x2b')],_0x1ed1fe[_0xba1c('0x2c')]);_0x51db64['attributes']=_[_0xba1c('0x2f')](_0x1ed1fe[_0xba1c('0x2b')],qs[_0xba1c('0x30')](_0x336483['query'][_0xba1c('0x30')]));_0x51db64[_0xba1c('0x31')]=_0x51db64[_0xba1c('0x31')]['length']?_0x51db64[_0xba1c('0x31')]:_0x1ed1fe[_0xba1c('0x2b')];if(!_0x336483['query']['hasOwnProperty'](_0xba1c('0x32'))){_0x51db64[_0xba1c('0x33')]=qs[_0xba1c('0x33')](_0x336483['query'][_0xba1c('0x33')]);_0x51db64[_0xba1c('0x1d')]=qs[_0xba1c('0x1d')](_0x336483['query'][_0xba1c('0x1d')]);}_0x51db64['order']=qs['sort'](_0x336483[_0xba1c('0x2c')][_0xba1c('0x34')]);_0x51db64[_0xba1c('0x35')]=qs['filters'](_['pick'](_0x336483[_0xba1c('0x2c')],_0x1ed1fe['filters']),_0x1e2dcc);if(_0x336483[_0xba1c('0x2c')]['filter']){_0x51db64[_0xba1c('0x35')]=_['merge'](_0x51db64[_0xba1c('0x35')],{'$or':_[_0xba1c('0x27')](_0x1e2dcc,function(_0x37e656){if(_0x37e656[_0xba1c('0x36')]!==_0xba1c('0x37')){var _0x4d9fb4={};_0x4d9fb4[_0x37e656['name']]={'$like':'%'+_0x336483['query']['filter']+'%'};return _0x4d9fb4;}})});}_0x51db64=_['merge']({},_0x51db64,_0x336483[_0xba1c('0x38')]);var _0x1846a8={'where':_0x51db64[_0xba1c('0x35')]};return db[_0xba1c('0x28')]['count'](_0x1846a8)[_0xba1c('0x23')](function(_0x25b06b){_0x36085a[_0xba1c('0x1c')]=_0x25b06b;if(_0x336483[_0xba1c('0x2c')][_0xba1c('0x39')]){_0x51db64[_0xba1c('0x3a')]=[{'all':!![]}];}return db[_0xba1c('0x28')][_0xba1c('0x3b')](_0x51db64);})['then'](function(_0x4db521){_0x36085a[_0xba1c('0x3c')]=_0x4db521;return _0x36085a;})[_0xba1c('0x23')](respondWithFilteredResult(_0x4d0ca0,_0x51db64))[_0xba1c('0x3d')](handleError(_0x4d0ca0,null));};exports[_0xba1c('0x3e')]=function(_0x572991,_0x3c9354){var _0x386c72={'raw':!![],'where':{'id':_0x572991['params']['id']}},_0x1c77f1={};_0x1c77f1[_0xba1c('0x2b')]=_['keys'](db['SquareReport'][_0xba1c('0x29')]);_0x1c77f1[_0xba1c('0x2c')]=_[_0xba1c('0x2d')](_0x572991[_0xba1c('0x2c')]);_0x1c77f1[_0xba1c('0x2e')]=_['intersection'](_0x1c77f1['model'],_0x1c77f1[_0xba1c('0x2c')]);_0x386c72[_0xba1c('0x31')]=_[_0xba1c('0x2f')](_0x1c77f1[_0xba1c('0x2b')],qs['fields'](_0x572991['query']['fields']));_0x386c72[_0xba1c('0x31')]=_0x386c72['attributes'][_0xba1c('0x3f')]?_0x386c72[_0xba1c('0x31')]:_0x1c77f1[_0xba1c('0x2b')];if(_0x572991[_0xba1c('0x2c')][_0xba1c('0x39')]){_0x386c72['include']=[{'all':!![]}];}_0x386c72=_[_0xba1c('0x40')]({},_0x386c72,_0x572991[_0xba1c('0x38')]);return db[_0xba1c('0x28')][_0xba1c('0x41')](_0x386c72)[_0xba1c('0x23')](handleEntityNotFound(_0x3c9354,null))[_0xba1c('0x23')](respondWithResult(_0x3c9354,null))[_0xba1c('0x3d')](handleError(_0x3c9354,null));};exports[_0xba1c('0x42')]=function(_0xe7254f,_0x557dec){return db[_0xba1c('0x28')][_0xba1c('0x42')](_0xe7254f[_0xba1c('0x43')],{})[_0xba1c('0x23')](respondWithResult(_0x557dec,0xc9))[_0xba1c('0x3d')](handleError(_0x557dec,null));};exports[_0xba1c('0x21')]=function(_0x5ad728,_0x3ddf16){if(_0x5ad728[_0xba1c('0x43')]['id']){delete _0x5ad728['body']['id'];}return db[_0xba1c('0x28')][_0xba1c('0x41')]({'where':{'id':_0x5ad728[_0xba1c('0x44')]['id']}})[_0xba1c('0x23')](handleEntityNotFound(_0x3ddf16,null))[_0xba1c('0x23')](saveUpdates(_0x5ad728[_0xba1c('0x43')],null))[_0xba1c('0x23')](respondWithResult(_0x3ddf16,null))['catch'](handleError(_0x3ddf16,null));};exports['destroy']=function(_0x369ffd,_0x216676){return db['SquareReport'][_0xba1c('0x41')]({'where':{'id':_0x369ffd[_0xba1c('0x44')]['id']}})[_0xba1c('0x23')](handleEntityNotFound(_0x216676,null))[_0xba1c('0x23')](removeEntity(_0x216676,null))[_0xba1c('0x3d')](handleError(_0x216676,null));};exports[_0xba1c('0x45')]=function(_0x40d983,_0x396b4c){return db[_0xba1c('0x28')][_0xba1c('0x45')]()['then'](respondWithResult(_0x396b4c,null))[_0xba1c('0x3d')](handleError(_0x396b4c,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0e3b088..d6ef3d1 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 _0x4b8b=['uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes','define','SquareReport','report_square'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b8b,0x1c3));var _0xb4b8=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x4b8b[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0xb4b8('0x0'));var util=require(_0xb4b8('0x1'));var logger=require(_0xb4b8('0x2'))(_0xb4b8('0x3'));var moment=require(_0xb4b8('0x4'));var BPromise=require(_0xb4b8('0x5'));var rp=require(_0xb4b8('0x6'));var fs=require('fs');var path=require(_0xb4b8('0x7'));var rimraf=require(_0xb4b8('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4b8('0x9'));module['exports']=function(_0x5f635,_0x3fcbeb){return _0x5f635[_0xb4b8('0xa')](_0xb4b8('0xb'),attributes,{'tableName':_0xb4b8('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xb4b8('0xd'),_0xb4b8('0xe')]},{'name':_0xb4b8('0xf'),'fields':[_0xb4b8('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17c0=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x17c0,0x171));var _0x017c=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x17c0[_0x594e11];return _0x5418ad;};'use strict';var _=require(_0x017c('0x0'));var util=require(_0x017c('0x1'));var logger=require(_0x017c('0x2'))(_0x017c('0x3'));var moment=require(_0x017c('0x4'));var BPromise=require(_0x017c('0x5'));var rp=require(_0x017c('0x6'));var fs=require('fs');var path=require(_0x017c('0x7'));var rimraf=require(_0x017c('0x8'));var config=require(_0x017c('0x9'));var attributes=require(_0x017c('0xa'));module['exports']=function(_0xd4a566,_0x56f892){return _0xd4a566[_0x017c('0xb')](_0x017c('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x017c('0xd'),'fields':[_0x017c('0xe'),_0x017c('0xf')]},{'name':_0x017c('0x10'),'fields':[_0x017c('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b2772aa..d977fe9 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 _0x2a7c=['update','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','then','UpdateSquareReport'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x2a7c,0xc9));var _0xc2a7=function(_0x27407f,_0x1842b1){_0x27407f=_0x27407f-0x0;var _0x49b63c=_0x2a7c[_0x27407f];return _0x49b63c;};'use strict';var _=require('lodash');var util=require(_0xc2a7('0x0'));var moment=require(_0xc2a7('0x1'));var BPromise=require(_0xc2a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2a7('0x3'));var db=require(_0xc2a7('0x4'))['db'];var utils=require(_0xc2a7('0x5'));var logger=require(_0xc2a7('0x6'))(_0xc2a7('0x7'));var config=require(_0xc2a7('0x8'));var jayson=require(_0xc2a7('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53f482,_0x3e981a,_0x5ca37e){return new BPromise(function(_0x3dcac4,_0x3ed916){return client[_0xc2a7('0xa')](_0x53f482,_0x5ca37e)['then'](function(_0x2eb648){logger[_0xc2a7('0xb')](_0xc2a7('0xc'),_0x3e981a,_0xc2a7('0xd'));logger[_0xc2a7('0xe')](_0xc2a7('0xf'),_0x3e981a,'request\x20sent',JSON[_0xc2a7('0x10')](_0x2eb648));if(_0x2eb648[_0xc2a7('0x11')]){if(_0x2eb648[_0xc2a7('0x11')][_0xc2a7('0x12')]===0x1f4){logger[_0xc2a7('0x11')](_0xc2a7('0xc'),_0x3e981a,_0x2eb648['error'][_0xc2a7('0x13')]);return _0x3ed916(_0x2eb648[_0xc2a7('0x11')][_0xc2a7('0x13')]);}logger[_0xc2a7('0x11')](_0xc2a7('0xc'),_0x3e981a,_0x2eb648[_0xc2a7('0x11')]['message']);return _0x3dcac4(_0x2eb648[_0xc2a7('0x11')][_0xc2a7('0x13')]);}else{logger[_0xc2a7('0xb')](_0xc2a7('0xc'),_0x3e981a,_0xc2a7('0xd'));_0x3dcac4(_0x2eb648[_0xc2a7('0x14')]['message']);}})[_0xc2a7('0x15')](function(_0x14e249){logger[_0xc2a7('0x11')](_0xc2a7('0xc'),_0x3e981a,_0x14e249);_0x3ed916(_0x14e249);});});}exports[_0xc2a7('0x16')]=function(_0x2f9c36){var _0x522960=this;return new Promise(function(_0x2daca8,_0x52ba71){return db[_0xc2a7('0x17')][_0xc2a7('0x18')](_0x2f9c36[_0xc2a7('0x19')],{'raw':_0x2f9c36['options']?_0x2f9c36[_0xc2a7('0x1a')][_0xc2a7('0x1b')]===undefined?!![]:![]:!![]})[_0xc2a7('0x1c')](function(_0x24fad3){logger['info']('CreateSquareReport',_0x2f9c36);logger[_0xc2a7('0xe')](_0xc2a7('0x16'),_0x2f9c36,JSON[_0xc2a7('0x10')](_0x24fad3));_0x2daca8(_0x24fad3);})[_0xc2a7('0x15')](function(_0x2bbd87){logger[_0xc2a7('0x11')]('CreateSquareReport',_0x2bbd87[_0xc2a7('0x13')],_0x2f9c36);_0x52ba71(_0x522960[_0xc2a7('0x11')](0x1f4,_0x2bbd87[_0xc2a7('0x13')]));});});};exports[_0xc2a7('0x1d')]=function(_0x15a9a7){var _0x5d8aab=this;return new Promise(function(_0xad3b2a,_0x3fc334){return db['SquareReport'][_0xc2a7('0x1e')](_0x15a9a7[_0xc2a7('0x19')],{'raw':_0x15a9a7['options']?_0x15a9a7[_0xc2a7('0x1a')][_0xc2a7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15a9a7[_0xc2a7('0x1a')]?_0x15a9a7[_0xc2a7('0x1a')]['where']||null:null,'attributes':_0x15a9a7[_0xc2a7('0x1a')]?_0x15a9a7[_0xc2a7('0x1a')][_0xc2a7('0x1f')]||null:null,'limit':_0x15a9a7['options']?_0x15a9a7[_0xc2a7('0x1a')][_0xc2a7('0x20')]||null:null})[_0xc2a7('0x1c')](function(_0x2c2768){logger[_0xc2a7('0xb')](_0xc2a7('0x1d'),_0x15a9a7);logger[_0xc2a7('0xe')]('UpdateSquareReport',_0x15a9a7,JSON[_0xc2a7('0x10')](_0x2c2768));_0xad3b2a(_0x2c2768);})[_0xc2a7('0x15')](function(_0x1be469){logger['error'](_0xc2a7('0x1d'),_0x1be469['message'],_0x15a9a7);_0x3fc334(_0x5d8aab[_0xc2a7('0x11')](0x1f4,_0x1be469[_0xc2a7('0x13')]));});});}; \ No newline at end of file +var _0x1dcc=['request\x20sent','stringify','error','code','message','result','catch','CreateSquareReport','body','options','raw','debug','SquareReport','update','attributes','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x1dcc,0x8c));var _0xc1dc=function(_0x176ad1,_0x5baf1b){_0x176ad1=_0x176ad1-0x0;var _0x5ec67a=_0x1dcc[_0x176ad1];return _0x5ec67a;};'use strict';var _=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var moment=require(_0xc1dc('0x2'));var BPromise=require('bluebird');var rs=require(_0xc1dc('0x3'));var fs=require('fs');var Redis=require(_0xc1dc('0x4'));var db=require(_0xc1dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dc('0x6'))('rpc');var config=require(_0xc1dc('0x7'));var jayson=require(_0xc1dc('0x8'));var client=jayson[_0xc1dc('0x9')][_0xc1dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x552593,_0x3168f8,_0x1a9399){return new BPromise(function(_0x128d3c,_0x56679b){return client[_0xc1dc('0xb')](_0x552593,_0x1a9399)[_0xc1dc('0xc')](function(_0x296abc){logger['info'](_0xc1dc('0xd'),_0x3168f8,'request\x20sent');logger['debug'](_0xc1dc('0xe'),_0x3168f8,_0xc1dc('0xf'),JSON[_0xc1dc('0x10')](_0x296abc));if(_0x296abc[_0xc1dc('0x11')]){if(_0x296abc[_0xc1dc('0x11')][_0xc1dc('0x12')]===0x1f4){logger[_0xc1dc('0x11')]('SquareReport,\x20%s,\x20%s',_0x3168f8,_0x296abc[_0xc1dc('0x11')][_0xc1dc('0x13')]);return _0x56679b(_0x296abc[_0xc1dc('0x11')][_0xc1dc('0x13')]);}logger[_0xc1dc('0x11')](_0xc1dc('0xd'),_0x3168f8,_0x296abc[_0xc1dc('0x11')][_0xc1dc('0x13')]);return _0x128d3c(_0x296abc[_0xc1dc('0x11')][_0xc1dc('0x13')]);}else{logger['info'](_0xc1dc('0xd'),_0x3168f8,_0xc1dc('0xf'));_0x128d3c(_0x296abc[_0xc1dc('0x14')][_0xc1dc('0x13')]);}})[_0xc1dc('0x15')](function(_0x312a82){logger[_0xc1dc('0x11')](_0xc1dc('0xd'),_0x3168f8,_0x312a82);_0x56679b(_0x312a82);});});}exports[_0xc1dc('0x16')]=function(_0x17db99){var _0x5cd764=this;return new Promise(function(_0x4ade6e,_0x1c9889){return db['SquareReport']['create'](_0x17db99[_0xc1dc('0x17')],{'raw':_0x17db99[_0xc1dc('0x18')]?_0x17db99['options'][_0xc1dc('0x19')]===undefined?!![]:![]:!![]})[_0xc1dc('0xc')](function(_0x291f30){logger['info']('CreateSquareReport',_0x17db99);logger[_0xc1dc('0x1a')](_0xc1dc('0x16'),_0x17db99,JSON[_0xc1dc('0x10')](_0x291f30));_0x4ade6e(_0x291f30);})['catch'](function(_0x5a7f5a){logger['error'](_0xc1dc('0x16'),_0x5a7f5a['message'],_0x17db99);_0x1c9889(_0x5cd764[_0xc1dc('0x11')](0x1f4,_0x5a7f5a[_0xc1dc('0x13')]));});});};exports['UpdateSquareReport']=function(_0x1ebba0){var _0x31a343=this;return new Promise(function(_0x9dca95,_0x437b26){return db[_0xc1dc('0x1b')][_0xc1dc('0x1c')](_0x1ebba0[_0xc1dc('0x17')],{'raw':_0x1ebba0['options']?_0x1ebba0['options'][_0xc1dc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ebba0[_0xc1dc('0x18')]?_0x1ebba0[_0xc1dc('0x18')]['where']||null:null,'attributes':_0x1ebba0[_0xc1dc('0x18')]?_0x1ebba0['options'][_0xc1dc('0x1d')]||null:null,'limit':_0x1ebba0[_0xc1dc('0x18')]?_0x1ebba0[_0xc1dc('0x18')]['limit']||null:null})[_0xc1dc('0xc')](function(_0x1e7400){logger[_0xc1dc('0x1e')]('UpdateSquareReport',_0x1ebba0);logger[_0xc1dc('0x1a')]('UpdateSquareReport',_0x1ebba0,JSON[_0xc1dc('0x10')](_0x1e7400));_0x9dca95(_0x1e7400);})['catch'](function(_0x117ddc){logger['error']('UpdateSquareReport',_0x117ddc[_0xc1dc('0x13')],_0x1ebba0);_0x437b26(_0x31a343[_0xc1dc('0x11')](0x1f4,_0x117ddc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index b2f4c40..41c39e0 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(_0x10f65d,_0x2279fd){var _0x641a7f=function(_0x2c2707){while(--_0x2c2707){_0x10f65d['push'](_0x10f65d['shift']());}};_0x641a7f(++_0x2279fd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2de2cb,_0x321a45){_0x2de2cb=_0x2de2cb-0x0;var _0x2073f9=_0x5f2f[_0x2de2cb];return _0x2073f9;};'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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x814b,0x1a2));var _0xb814=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x814b[_0xfd5f37];return _0x11bd01;};'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['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3fb6c36..8a3053c 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 _0xea83=['sequelize','exports','STRING','TEXT'];(function(_0x3ef8e5,_0xd90a37){var _0x58b53f=function(_0x537760){while(--_0x537760){_0x3ef8e5['push'](_0x3ef8e5['shift']());}};_0x58b53f(++_0xd90a37);}(_0xea83,0xc4));var _0x3ea8=function(_0x531a19,_0x43e019){_0x531a19=_0x531a19-0x0;var _0x4845d2=_0xea83[_0x531a19];return _0x4845d2;};'use strict';var Sequelize=require(_0x3ea8('0x0'));module[_0x3ea8('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x3ea8('0x2')]},'application':{'type':Sequelize[_0x3ea8('0x2')]},'data':{'type':Sequelize[_0x3ea8('0x3')]},'project_name':{'type':Sequelize[_0x3ea8('0x2')]},'callerid':{'type':Sequelize[_0x3ea8('0x2')]}}; \ No newline at end of file +var _0x4951=['TEXT','sequelize','exports','STRING'];(function(_0x49e939,_0x17bc39){var _0x54f38a=function(_0x4b3790){while(--_0x4b3790){_0x49e939['push'](_0x49e939['shift']());}};_0x54f38a(++_0x17bc39);}(_0x4951,0x65));var _0x1495=function(_0x543fd4,_0x42a34e){_0x543fd4=_0x543fd4-0x0;var _0x4d0a54=_0x4951[_0x543fd4];return _0x4d0a54;};'use strict';var Sequelize=require(_0x1495('0x0'));module[_0x1495('0x1')]={'uniqueid':{'type':Sequelize[_0x1495('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x1495('0x2')]},'data':{'type':Sequelize[_0x1495('0x3')]},'project_name':{'type':Sequelize[_0x1495('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 b0c58dc..d7225d2 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 _0x37bf=['describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','set','Content-Range','json','reject','save','then','destroy','error','stack','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','nolimit','limit','offset','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','update'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x37bf,0xe5));var _0xf37b=function(_0x56c450,_0x23f66b){_0x56c450=_0x56c450-0x0;var _0x159860=_0x37bf[_0x56c450];return _0x159860;};'use strict';var pdf=require(_0xf37b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf37b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf37b('0x2'));var rp=require(_0xf37b('0x3'));var moment=require(_0xf37b('0x4'));var BPromise=require(_0xf37b('0x5'));var Mustache=require(_0xf37b('0x6'));var util=require('util');var path=require(_0xf37b('0x7'));var sox=require(_0xf37b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf37b('0x9'));var squel=require('squel');var crypto=require(_0xf37b('0xa'));var jsforce=require(_0xf37b('0xb'));var deskjs=require(_0xf37b('0xc'));var toCsv=require(_0xf37b('0xd'));var querystring=require('querystring');var Papa=require(_0xf37b('0xe'));var Redis=require(_0xf37b('0xf'));var authService=require(_0xf37b('0x10'));var qs=require(_0xf37b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf37b('0x12'));var logger=require(_0xf37b('0x13'))(_0xf37b('0x14'));var utils=require(_0xf37b('0x15'));var config=require(_0xf37b('0x16'));var db=require(_0xf37b('0x17'))['db'];function respondWithStatusCode(_0x5d3537,_0x556121){_0x556121=_0x556121||0xcc;return function(_0x347bed){if(_0x347bed){return _0x5d3537[_0xf37b('0x18')](_0x556121);}return _0x5d3537[_0xf37b('0x19')](_0x556121)[_0xf37b('0x1a')]();};}function respondWithResult(_0x1d0f31,_0x434c6f){_0x434c6f=_0x434c6f||0xc8;return function(_0x17ac55){if(_0x17ac55){return _0x1d0f31['status'](_0x434c6f)['json'](_0x17ac55);}};}function respondWithFilteredResult(_0x6526b9,_0x2bf4ba){return function(_0x392c00){if(_0x392c00){var _0x369907=_0x392c00[_0xf37b('0x1b')],_0x4f9a58=_0x2bf4ba['offset'],_0x52130d=_0x2bf4ba['offset']+_0x2bf4ba['limit'],_0x467161;if(_0x52130d>=_0x369907){_0x52130d=_0x369907;_0x467161=0xc8;}else{_0x467161=0xce;}_0x6526b9['status'](_0x467161);return _0x6526b9[_0xf37b('0x1c')](_0xf37b('0x1d'),_0x4f9a58+'-'+_0x52130d+'/'+_0x369907)[_0xf37b('0x1e')](_0x392c00);}return null;};}function patchUpdates(_0x2bdd51){return function(_0x17b177){try{jsonpatch['apply'](_0x17b177,_0x2bdd51,!![]);}catch(_0x4b4f86){return BPromise[_0xf37b('0x1f')](_0x4b4f86);}return _0x17b177[_0xf37b('0x20')]();};}function saveUpdates(_0x4635d9,_0x2194a8){return function(_0x4999cc){if(_0x4999cc){return _0x4999cc['update'](_0x4635d9)[_0xf37b('0x21')](function(_0x3e22c6){return _0x3e22c6;});}return null;};}function removeEntity(_0x31ffb2,_0x3dd413){return function(_0x21c06c){if(_0x21c06c){return _0x21c06c[_0xf37b('0x22')]()[_0xf37b('0x21')](function(){_0x31ffb2['status'](0xcc)[_0xf37b('0x1a')]();});}};}function handleEntityNotFound(_0x88ad9b,_0x4af46f){return function(_0x5d7d59){if(!_0x5d7d59){_0x88ad9b['sendStatus'](0x194);}return _0x5d7d59;};}function handleError(_0x58db9d,_0xd20f52){_0xd20f52=_0xd20f52||0x1f4;return function(_0x381428){logger[_0xf37b('0x23')](_0x381428[_0xf37b('0x24')]);if(_0x381428['name']){delete _0x381428['name'];}_0x58db9d[_0xf37b('0x19')](_0xd20f52)[_0xf37b('0x25')](_0x381428);};}exports[_0xf37b('0x26')]=function(_0x53c6bd,_0x384e50){var _0x3fa6a1={},_0x11d421={},_0x2f57c7={'count':0x0,'rows':[]};var _0x43f3fb=_[_0xf37b('0x27')](db[_0xf37b('0x28')][_0xf37b('0x29')],function(_0x3459a6){return{'name':_0x3459a6[_0xf37b('0x2a')],'type':_0x3459a6['type'][_0xf37b('0x2b')]};});_0x11d421[_0xf37b('0x2c')]=_[_0xf37b('0x27')](_0x43f3fb,_0xf37b('0x2d'));_0x11d421[_0xf37b('0x2e')]=_[_0xf37b('0x2f')](_0x53c6bd[_0xf37b('0x2e')]);_0x11d421[_0xf37b('0x30')]=_['intersection'](_0x11d421[_0xf37b('0x2c')],_0x11d421['query']);_0x3fa6a1[_0xf37b('0x31')]=_[_0xf37b('0x32')](_0x11d421[_0xf37b('0x2c')],qs[_0xf37b('0x33')](_0x53c6bd[_0xf37b('0x2e')][_0xf37b('0x33')]));_0x3fa6a1[_0xf37b('0x31')]=_0x3fa6a1['attributes']['length']?_0x3fa6a1[_0xf37b('0x31')]:_0x11d421[_0xf37b('0x2c')];if(!_0x53c6bd['query']['hasOwnProperty'](_0xf37b('0x34'))){_0x3fa6a1[_0xf37b('0x35')]=qs[_0xf37b('0x35')](_0x53c6bd[_0xf37b('0x2e')][_0xf37b('0x35')]);_0x3fa6a1['offset']=qs[_0xf37b('0x36')](_0x53c6bd[_0xf37b('0x2e')][_0xf37b('0x36')]);}_0x3fa6a1['order']=qs[_0xf37b('0x37')](_0x53c6bd['query']['sort']);_0x3fa6a1[_0xf37b('0x38')]=qs[_0xf37b('0x30')](_[_0xf37b('0x39')](_0x53c6bd['query'],_0x11d421[_0xf37b('0x30')]),_0x43f3fb);if(_0x53c6bd[_0xf37b('0x2e')][_0xf37b('0x3a')]){_0x3fa6a1[_0xf37b('0x38')]=_[_0xf37b('0x3b')](_0x3fa6a1['where'],{'$or':_[_0xf37b('0x27')](_0x43f3fb,function(_0x26d6a1){if(_0x26d6a1[_0xf37b('0x3c')]!==_0xf37b('0x3d')){var _0x5c6e47={};_0x5c6e47[_0x26d6a1[_0xf37b('0x2d')]]={'$like':'%'+_0x53c6bd['query']['filter']+'%'};return _0x5c6e47;}})});}_0x3fa6a1=_['merge']({},_0x3fa6a1,_0x53c6bd[_0xf37b('0x3e')]);var _0xa2e8d8={'where':_0x3fa6a1[_0xf37b('0x38')]};return db[_0xf37b('0x28')][_0xf37b('0x1b')](_0xa2e8d8)['then'](function(_0x2d0803){_0x2f57c7[_0xf37b('0x1b')]=_0x2d0803;if(_0x53c6bd[_0xf37b('0x2e')][_0xf37b('0x3f')]){_0x3fa6a1['include']=[{'all':!![]}];}return db[_0xf37b('0x28')][_0xf37b('0x40')](_0x3fa6a1);})[_0xf37b('0x21')](function(_0x1e16eb){_0x2f57c7[_0xf37b('0x41')]=_0x1e16eb;return _0x2f57c7;})[_0xf37b('0x21')](respondWithFilteredResult(_0x384e50,_0x3fa6a1))[_0xf37b('0x42')](handleError(_0x384e50,null));};exports[_0xf37b('0x43')]=function(_0x187815,_0x4c0579){var _0xd7bc84={'raw':!![],'where':{'id':_0x187815[_0xf37b('0x44')]['id']}},_0x5b826d={};_0x5b826d['model']=_[_0xf37b('0x2f')](db[_0xf37b('0x28')][_0xf37b('0x29')]);_0x5b826d['query']=_[_0xf37b('0x2f')](_0x187815[_0xf37b('0x2e')]);_0x5b826d['filters']=_['intersection'](_0x5b826d[_0xf37b('0x2c')],_0x5b826d[_0xf37b('0x2e')]);_0xd7bc84[_0xf37b('0x31')]=_['intersection'](_0x5b826d[_0xf37b('0x2c')],qs[_0xf37b('0x33')](_0x187815[_0xf37b('0x2e')]['fields']));_0xd7bc84[_0xf37b('0x31')]=_0xd7bc84[_0xf37b('0x31')][_0xf37b('0x45')]?_0xd7bc84['attributes']:_0x5b826d['model'];if(_0x187815[_0xf37b('0x2e')][_0xf37b('0x3f')]){_0xd7bc84[_0xf37b('0x46')]=[{'all':!![]}];}_0xd7bc84=_[_0xf37b('0x3b')]({},_0xd7bc84,_0x187815[_0xf37b('0x3e')]);return db[_0xf37b('0x28')][_0xf37b('0x47')](_0xd7bc84)[_0xf37b('0x21')](handleEntityNotFound(_0x4c0579,null))[_0xf37b('0x21')](respondWithResult(_0x4c0579,null))['catch'](handleError(_0x4c0579,null));};exports[_0xf37b('0x48')]=function(_0x2d1825,_0x525bfb){return db['SquareDetailsReport']['create'](_0x2d1825[_0xf37b('0x49')],{})['then'](respondWithResult(_0x525bfb,0xc9))['catch'](handleError(_0x525bfb,null));};exports[_0xf37b('0x4a')]=function(_0x5cf56b,_0x3a7b48){if(_0x5cf56b['body']['id']){delete _0x5cf56b[_0xf37b('0x49')]['id'];}return db[_0xf37b('0x28')][_0xf37b('0x47')]({'where':{'id':_0x5cf56b[_0xf37b('0x44')]['id']}})[_0xf37b('0x21')](handleEntityNotFound(_0x3a7b48,null))[_0xf37b('0x21')](saveUpdates(_0x5cf56b[_0xf37b('0x49')],null))[_0xf37b('0x21')](respondWithResult(_0x3a7b48,null))[_0xf37b('0x42')](handleError(_0x3a7b48,null));};exports['destroy']=function(_0x5d6c71,_0xa2de15){return db['SquareDetailsReport'][_0xf37b('0x47')]({'where':{'id':_0x5d6c71[_0xf37b('0x44')]['id']}})[_0xf37b('0x21')](handleEntityNotFound(_0xa2de15,null))[_0xf37b('0x21')](removeEntity(_0xa2de15,null))['catch'](handleError(_0xa2de15,null));};exports['describe']=function(_0x4bfc11,_0x4abad5){return db[_0xf37b('0x28')][_0xf37b('0x4b')]()['then'](respondWithResult(_0x4abad5,null))[_0xf37b('0x42')](handleError(_0x4abad5,null));}; \ No newline at end of file +var _0x7201=['pick','merge','filter','options','include','findAll','rows','show','rawAttributes','find','catch','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','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','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','SquareDetailsReport','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xde9394,_0x580da7){var _0x3829b6=function(_0xafe551){while(--_0xafe551){_0xde9394['push'](_0xde9394['shift']());}};_0x3829b6(++_0x580da7);}(_0x7201,0xac));var _0x1720=function(_0x2f7a6c,_0xf5b7d7){_0x2f7a6c=_0x2f7a6c-0x0;var _0x5bd2bf=_0x7201[_0x2f7a6c];return _0x5bd2bf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1720('0x0'));var rimraf=require(_0x1720('0x1'));var zipdir=require(_0x1720('0x2'));var jsonpatch=require(_0x1720('0x3'));var rp=require(_0x1720('0x4'));var moment=require(_0x1720('0x5'));var BPromise=require(_0x1720('0x6'));var Mustache=require(_0x1720('0x7'));var util=require(_0x1720('0x8'));var path=require('path');var sox=require(_0x1720('0x9'));var csv=require('to-csv');var ejs=require(_0x1720('0xa'));var fs=require('fs');var _=require(_0x1720('0xb'));var squel=require('squel');var crypto=require(_0x1720('0xc'));var jsforce=require(_0x1720('0xd'));var deskjs=require(_0x1720('0xe'));var toCsv=require(_0x1720('0xf'));var querystring=require(_0x1720('0x10'));var Papa=require(_0x1720('0x11'));var Redis=require(_0x1720('0x12'));var authService=require(_0x1720('0x13'));var qs=require(_0x1720('0x14'));var as=require(_0x1720('0x15'));var hardwareService=require(_0x1720('0x16'));var logger=require(_0x1720('0x17'))(_0x1720('0x18'));var utils=require(_0x1720('0x19'));var config=require('../../config/environment');var db=require(_0x1720('0x1a'))['db'];function respondWithStatusCode(_0x72d962,_0x5b6be2){_0x5b6be2=_0x5b6be2||0xcc;return function(_0x407f62){if(_0x407f62){return _0x72d962[_0x1720('0x1b')](_0x5b6be2);}return _0x72d962['status'](_0x5b6be2)[_0x1720('0x1c')]();};}function respondWithResult(_0x413675,_0x2f8549){_0x2f8549=_0x2f8549||0xc8;return function(_0x4b4251){if(_0x4b4251){return _0x413675[_0x1720('0x1d')](_0x2f8549)[_0x1720('0x1e')](_0x4b4251);}};}function respondWithFilteredResult(_0x9ffeaa,_0x18101a){return function(_0x1f525a){if(_0x1f525a){var _0x44e6cf=_0x1f525a[_0x1720('0x1f')],_0x17213f=_0x18101a['offset'],_0xdcdb75=_0x18101a[_0x1720('0x20')]+_0x18101a[_0x1720('0x21')],_0x21eb09;if(_0xdcdb75>=_0x44e6cf){_0xdcdb75=_0x44e6cf;_0x21eb09=0xc8;}else{_0x21eb09=0xce;}_0x9ffeaa[_0x1720('0x1d')](_0x21eb09);return _0x9ffeaa[_0x1720('0x22')](_0x1720('0x23'),_0x17213f+'-'+_0xdcdb75+'/'+_0x44e6cf)[_0x1720('0x1e')](_0x1f525a);}return null;};}function patchUpdates(_0xf8c478){return function(_0x14dfc7){try{jsonpatch[_0x1720('0x24')](_0x14dfc7,_0xf8c478,!![]);}catch(_0x2528d2){return BPromise[_0x1720('0x25')](_0x2528d2);}return _0x14dfc7[_0x1720('0x26')]();};}function saveUpdates(_0x38898e,_0x5f450d){return function(_0x2bcfbc){if(_0x2bcfbc){return _0x2bcfbc[_0x1720('0x27')](_0x38898e)[_0x1720('0x28')](function(_0x2efce2){return _0x2efce2;});}return null;};}function removeEntity(_0x308363,_0x572772){return function(_0x5959b6){if(_0x5959b6){return _0x5959b6['destroy']()['then'](function(){_0x308363[_0x1720('0x1d')](0xcc)[_0x1720('0x1c')]();});}};}function handleEntityNotFound(_0x4c6607,_0xfb14bc){return function(_0x38851b){if(!_0x38851b){_0x4c6607['sendStatus'](0x194);}return _0x38851b;};}function handleError(_0x2d1153,_0x40fb44){_0x40fb44=_0x40fb44||0x1f4;return function(_0x141992){logger[_0x1720('0x29')](_0x141992[_0x1720('0x2a')]);if(_0x141992[_0x1720('0x2b')]){delete _0x141992[_0x1720('0x2b')];}_0x2d1153[_0x1720('0x1d')](_0x40fb44)[_0x1720('0x2c')](_0x141992);};}exports['index']=function(_0x67b7f1,_0x3bc02d){var _0x254a3e={},_0x1492fe={},_0x56edd8={'count':0x0,'rows':[]};var _0x1d0825=_['map'](db[_0x1720('0x2d')]['rawAttributes'],function(_0x18d62d){return{'name':_0x18d62d[_0x1720('0x2e')],'type':_0x18d62d['type'][_0x1720('0x2f')]};});_0x1492fe[_0x1720('0x30')]=_[_0x1720('0x31')](_0x1d0825,_0x1720('0x2b'));_0x1492fe['query']=_[_0x1720('0x32')](_0x67b7f1[_0x1720('0x33')]);_0x1492fe[_0x1720('0x34')]=_['intersection'](_0x1492fe[_0x1720('0x30')],_0x1492fe[_0x1720('0x33')]);_0x254a3e[_0x1720('0x35')]=_[_0x1720('0x36')](_0x1492fe['model'],qs[_0x1720('0x37')](_0x67b7f1[_0x1720('0x33')]['fields']));_0x254a3e[_0x1720('0x35')]=_0x254a3e[_0x1720('0x35')][_0x1720('0x38')]?_0x254a3e[_0x1720('0x35')]:_0x1492fe[_0x1720('0x30')];if(!_0x67b7f1['query'][_0x1720('0x39')](_0x1720('0x3a'))){_0x254a3e[_0x1720('0x21')]=qs[_0x1720('0x21')](_0x67b7f1[_0x1720('0x33')][_0x1720('0x21')]);_0x254a3e[_0x1720('0x20')]=qs[_0x1720('0x20')](_0x67b7f1[_0x1720('0x33')][_0x1720('0x20')]);}_0x254a3e[_0x1720('0x3b')]=qs[_0x1720('0x3c')](_0x67b7f1[_0x1720('0x33')][_0x1720('0x3c')]);_0x254a3e[_0x1720('0x3d')]=qs[_0x1720('0x34')](_[_0x1720('0x3e')](_0x67b7f1['query'],_0x1492fe['filters']),_0x1d0825);if(_0x67b7f1[_0x1720('0x33')]['filter']){_0x254a3e['where']=_[_0x1720('0x3f')](_0x254a3e[_0x1720('0x3d')],{'$or':_[_0x1720('0x31')](_0x1d0825,function(_0x22c46a){if(_0x22c46a['type']!=='VIRTUAL'){var _0x1634b4={};_0x1634b4[_0x22c46a[_0x1720('0x2b')]]={'$like':'%'+_0x67b7f1['query'][_0x1720('0x40')]+'%'};return _0x1634b4;}})});}_0x254a3e=_[_0x1720('0x3f')]({},_0x254a3e,_0x67b7f1[_0x1720('0x41')]);var _0x1d9410={'where':_0x254a3e[_0x1720('0x3d')]};return db[_0x1720('0x2d')]['count'](_0x1d9410)[_0x1720('0x28')](function(_0x3d0230){_0x56edd8[_0x1720('0x1f')]=_0x3d0230;if(_0x67b7f1[_0x1720('0x33')]['includeAll']){_0x254a3e[_0x1720('0x42')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x1720('0x43')](_0x254a3e);})[_0x1720('0x28')](function(_0x1e919f){_0x56edd8[_0x1720('0x44')]=_0x1e919f;return _0x56edd8;})[_0x1720('0x28')](respondWithFilteredResult(_0x3bc02d,_0x254a3e))['catch'](handleError(_0x3bc02d,null));};exports[_0x1720('0x45')]=function(_0x15709d,_0x5573b5){var _0x202e7b={'raw':!![],'where':{'id':_0x15709d['params']['id']}},_0xdc3ad7={};_0xdc3ad7[_0x1720('0x30')]=_[_0x1720('0x32')](db['SquareDetailsReport'][_0x1720('0x46')]);_0xdc3ad7['query']=_[_0x1720('0x32')](_0x15709d['query']);_0xdc3ad7[_0x1720('0x34')]=_[_0x1720('0x36')](_0xdc3ad7[_0x1720('0x30')],_0xdc3ad7[_0x1720('0x33')]);_0x202e7b[_0x1720('0x35')]=_[_0x1720('0x36')](_0xdc3ad7[_0x1720('0x30')],qs[_0x1720('0x37')](_0x15709d[_0x1720('0x33')]['fields']));_0x202e7b[_0x1720('0x35')]=_0x202e7b[_0x1720('0x35')][_0x1720('0x38')]?_0x202e7b['attributes']:_0xdc3ad7[_0x1720('0x30')];if(_0x15709d[_0x1720('0x33')]['includeAll']){_0x202e7b[_0x1720('0x42')]=[{'all':!![]}];}_0x202e7b=_[_0x1720('0x3f')]({},_0x202e7b,_0x15709d['options']);return db[_0x1720('0x2d')][_0x1720('0x47')](_0x202e7b)[_0x1720('0x28')](handleEntityNotFound(_0x5573b5,null))[_0x1720('0x28')](respondWithResult(_0x5573b5,null))[_0x1720('0x48')](handleError(_0x5573b5,null));};exports[_0x1720('0x49')]=function(_0x193011,_0xcc8244){return db['SquareDetailsReport']['create'](_0x193011['body'],{})[_0x1720('0x28')](respondWithResult(_0xcc8244,0xc9))['catch'](handleError(_0xcc8244,null));};exports[_0x1720('0x27')]=function(_0x362e06,_0x27bce){if(_0x362e06[_0x1720('0x4a')]['id']){delete _0x362e06[_0x1720('0x4a')]['id'];}return db[_0x1720('0x2d')]['find']({'where':{'id':_0x362e06[_0x1720('0x4b')]['id']}})[_0x1720('0x28')](handleEntityNotFound(_0x27bce,null))[_0x1720('0x28')](saveUpdates(_0x362e06['body'],null))[_0x1720('0x28')](respondWithResult(_0x27bce,null))[_0x1720('0x48')](handleError(_0x27bce,null));};exports[_0x1720('0x4c')]=function(_0x392c0d,_0x499cc1){return db['SquareDetailsReport'][_0x1720('0x47')]({'where':{'id':_0x392c0d[_0x1720('0x4b')]['id']}})[_0x1720('0x28')](handleEntityNotFound(_0x499cc1,null))[_0x1720('0x28')](removeEntity(_0x499cc1,null))[_0x1720('0x48')](handleError(_0x499cc1,null));};exports[_0x1720('0x4d')]=function(_0xfab72e,_0x5754dc){return db['SquareDetailsReport']['describe']()[_0x1720('0x28')](respondWithResult(_0x5754dc,null))['catch'](handleError(_0x5754dc,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 01e7cd4..971dd5e 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 _0xba6f=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','../../config/logger','api','moment'];(function(_0x15fd73,_0x429a0c){var _0xf85fed=function(_0x4bdb61){while(--_0x4bdb61){_0x15fd73['push'](_0x15fd73['shift']());}};_0xf85fed(++_0x429a0c);}(_0xba6f,0x1d0));var _0xfba6=function(_0x517c2e,_0x3d4bf3){_0x517c2e=_0x517c2e-0x0;var _0x5d4029=_0xba6f[_0x517c2e];return _0x5d4029;};'use strict';var _=require(_0xfba6('0x0'));var util=require('util');var logger=require(_0xfba6('0x1'))(_0xfba6('0x2'));var moment=require(_0xfba6('0x3'));var BPromise=require(_0xfba6('0x4'));var rp=require(_0xfba6('0x5'));var fs=require('fs');var path=require(_0xfba6('0x6'));var rimraf=require(_0xfba6('0x7'));var config=require(_0xfba6('0x8'));var attributes=require(_0xfba6('0x9'));module[_0xfba6('0xa')]=function(_0x269363,_0x10310e){return _0x269363[_0xfba6('0xb')]('SquareDetailsReport',attributes,{'tableName':_0xfba6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a2f=['util','api','moment','request-promise','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a2f,0x1c2));var _0xf7a2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a2f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xf7a2('0x0'));var logger=require('../../config/logger')(_0xf7a2('0x1'));var moment=require(_0xf7a2('0x2'));var BPromise=require('bluebird');var rp=require(_0xf7a2('0x3'));var fs=require('fs');var path=require(_0xf7a2('0x4'));var rimraf=require(_0xf7a2('0x5'));var config=require('../../config/environment');var attributes=require(_0xf7a2('0x6'));module[_0xf7a2('0x7')]=function(_0x23489c,_0x2a07b7){return _0x23489c[_0xf7a2('0x8')](_0xf7a2('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index f34b901..acb7c41 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 _0x7c11=['options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x7c11,0x1b1));var _0x17c1=function(_0x1e8cb2,_0x8a12e1){_0x1e8cb2=_0x1e8cb2-0x0;var _0x1839aa=_0x7c11[_0x1e8cb2];return _0x1839aa;};'use strict';var _=require(_0x17c1('0x0'));var util=require(_0x17c1('0x1'));var moment=require(_0x17c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x17c1('0x3'));var fs=require('fs');var Redis=require(_0x17c1('0x4'));var db=require(_0x17c1('0x5'))['db'];var utils=require(_0x17c1('0x6'));var logger=require(_0x17c1('0x7'))(_0x17c1('0x8'));var config=require(_0x17c1('0x9'));var jayson=require(_0x17c1('0xa'));var client=jayson['client'][_0x17c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539ea3,_0x16003b,_0xc247ed){return new BPromise(function(_0x210392,_0x2c3c85){return client['request'](_0x539ea3,_0xc247ed)[_0x17c1('0xc')](function(_0x4c1c65){logger[_0x17c1('0xd')](_0x17c1('0xe'),_0x16003b,_0x17c1('0xf'));logger[_0x17c1('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x16003b,'request\x20sent',JSON[_0x17c1('0x11')](_0x4c1c65));if(_0x4c1c65[_0x17c1('0x12')]){if(_0x4c1c65[_0x17c1('0x12')][_0x17c1('0x13')]===0x1f4){logger[_0x17c1('0x12')](_0x17c1('0xe'),_0x16003b,_0x4c1c65['error']['message']);return _0x2c3c85(_0x4c1c65[_0x17c1('0x12')][_0x17c1('0x14')]);}logger[_0x17c1('0x12')](_0x17c1('0xe'),_0x16003b,_0x4c1c65[_0x17c1('0x12')][_0x17c1('0x14')]);return _0x210392(_0x4c1c65[_0x17c1('0x12')][_0x17c1('0x14')]);}else{logger[_0x17c1('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x16003b,'request\x20sent');_0x210392(_0x4c1c65[_0x17c1('0x15')][_0x17c1('0x14')]);}})['catch'](function(_0x3298f4){logger[_0x17c1('0x12')](_0x17c1('0xe'),_0x16003b,_0x3298f4);_0x2c3c85(_0x3298f4);});});}exports[_0x17c1('0x16')]=function(_0x18d16a){var _0x4fd22a=this;return new Promise(function(_0x5e8cec,_0x25dddc){return db[_0x17c1('0x17')][_0x17c1('0x18')](_0x18d16a[_0x17c1('0x19')],{'raw':_0x18d16a[_0x17c1('0x1a')]?_0x18d16a[_0x17c1('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x17c1('0xc')](function(_0x229bc7){logger[_0x17c1('0xd')]('CreateSquareDetailsReport',_0x18d16a);logger[_0x17c1('0x10')](_0x17c1('0x16'),_0x18d16a,JSON[_0x17c1('0x11')](_0x229bc7));_0x5e8cec(_0x229bc7);})['catch'](function(_0x544ab5){logger[_0x17c1('0x12')](_0x17c1('0x16'),_0x544ab5['message'],_0x18d16a);_0x25dddc(_0x4fd22a['error'](0x1f4,_0x544ab5['message']));});});}; \ No newline at end of file +var _0xa432=['SquareDetailsReport','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareDetailsReport'];(function(_0x325a08,_0x571fff){var _0x436e01=function(_0x2c7719){while(--_0x2c7719){_0x325a08['push'](_0x325a08['shift']());}};_0x436e01(++_0x571fff);}(_0xa432,0x162));var _0x2a43=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xa432[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x2a43('0x0'));var util=require(_0x2a43('0x1'));var moment=require(_0x2a43('0x2'));var BPromise=require(_0x2a43('0x3'));var rs=require(_0x2a43('0x4'));var fs=require('fs');var Redis=require(_0x2a43('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2a43('0x6'))(_0x2a43('0x7'));var config=require(_0x2a43('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24952f,_0x1ea249,_0x3eb634){return new BPromise(function(_0x1a9d05,_0x527542){return client['request'](_0x24952f,_0x3eb634)[_0x2a43('0x9')](function(_0x59095e){logger[_0x2a43('0xa')](_0x2a43('0xb'),_0x1ea249,_0x2a43('0xc'));logger[_0x2a43('0xd')](_0x2a43('0xe'),_0x1ea249,'request\x20sent',JSON[_0x2a43('0xf')](_0x59095e));if(_0x59095e[_0x2a43('0x10')]){if(_0x59095e[_0x2a43('0x10')][_0x2a43('0x11')]===0x1f4){logger[_0x2a43('0x10')](_0x2a43('0xb'),_0x1ea249,_0x59095e['error'][_0x2a43('0x12')]);return _0x527542(_0x59095e[_0x2a43('0x10')]['message']);}logger[_0x2a43('0x10')](_0x2a43('0xb'),_0x1ea249,_0x59095e[_0x2a43('0x10')][_0x2a43('0x12')]);return _0x1a9d05(_0x59095e[_0x2a43('0x10')][_0x2a43('0x12')]);}else{logger[_0x2a43('0xa')](_0x2a43('0xb'),_0x1ea249,_0x2a43('0xc'));_0x1a9d05(_0x59095e['result'][_0x2a43('0x12')]);}})[_0x2a43('0x13')](function(_0x3a12f8){logger[_0x2a43('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x1ea249,_0x3a12f8);_0x527542(_0x3a12f8);});});}exports[_0x2a43('0x14')]=function(_0xc19bbe){var _0x51eff3=this;return new Promise(function(_0x40c333,_0x51c855){return db[_0x2a43('0x15')][_0x2a43('0x16')](_0xc19bbe['body'],{'raw':_0xc19bbe[_0x2a43('0x17')]?_0xc19bbe[_0x2a43('0x17')][_0x2a43('0x18')]===undefined?!![]:![]:!![]})[_0x2a43('0x9')](function(_0x2d374e){logger[_0x2a43('0xa')](_0x2a43('0x14'),_0xc19bbe);logger[_0x2a43('0xd')](_0x2a43('0x14'),_0xc19bbe,JSON[_0x2a43('0xf')](_0x2d374e));_0x40c333(_0x2d374e);})[_0x2a43('0x13')](function(_0x35c230){logger[_0x2a43('0x10')](_0x2a43('0x14'),_0x35c230['message'],_0xc19bbe);_0x51c855(_0x51eff3['error'](0x1f4,_0x35c230[_0x2a43('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 6c85f44..6a0c379 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 _0xcd22=['killProcess','exports','Router','../../components/auth/service','./system.controller','get','/process/:pid/kill','isAuthenticated'];(function(_0x4039c7,_0x346ce4){var _0x576f16=function(_0x3c6601){while(--_0x3c6601){_0x4039c7['push'](_0x4039c7['shift']());}};_0x576f16(++_0x346ce4);}(_0xcd22,0x1a2));var _0x2cd2=function(_0x2a6d45,_0x3c9321){_0x2a6d45=_0x2a6d45-0x0;var _0x295253=_0xcd22[_0x2a6d45];return _0x295253;};'use strict';var express=require('express');var router=express[_0x2cd2('0x0')]();var auth=require(_0x2cd2('0x1'));var controller=require(_0x2cd2('0x2'));router[_0x2cd2('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2cd2('0x4'),auth[_0x2cd2('0x5')](),controller[_0x2cd2('0x6')]);module[_0x2cd2('0x7')]=router; \ No newline at end of file +var _0x9b0c=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports'];(function(_0x3f92c7,_0x863c8){var _0x2e7f61=function(_0x2aa370){while(--_0x2aa370){_0x3f92c7['push'](_0x3f92c7['shift']());}};_0x2e7f61(++_0x863c8);}(_0x9b0c,0x138));var _0xc9b0=function(_0x14800d,_0x518906){_0x14800d=_0x14800d-0x0;var _0x397b1b=_0x9b0c[_0x14800d];return _0x397b1b;};'use strict';var express=require('express');var router=express[_0xc9b0('0x0')]();var auth=require(_0xc9b0('0x1'));var controller=require(_0xc9b0('0x2'));router[_0xc9b0('0x3')]('/',auth[_0xc9b0('0x4')](),controller[_0xc9b0('0x5')]);router[_0xc9b0('0x3')](_0xc9b0('0x6'),auth['isAuthenticated'](),controller['killProcess']);module[_0xc9b0('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 4206121..aa36910 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 _0x2447=['format','catch','child_process','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','killProcess','components/import/cm','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT'];(function(_0x328f78,_0x54ad23){var _0x4b5fee=function(_0x1b776d){while(--_0x1b776d){_0x328f78['push'](_0x328f78['shift']());}};_0x4b5fee(++_0x54ad23);}(_0x2447,0x1dd));var _0x7244=function(_0x1f8d61,_0x210bf4){_0x1f8d61=_0x1f8d61-0x0;var _0x3c6e99=_0x2447[_0x1f8d61];return _0x3c6e99;};'use strict';var info=require('systeminformation');var exec=require(_0x7244('0x0'))['exec'];var logger=require(_0x7244('0x1'))('api');var util=require(_0x7244('0x2'));var BPromise=require(_0x7244('0x3'));var _=require(_0x7244('0x4'));function handleError(_0x30f6a4,_0x1c10bf,_0x4eb872){_0x1c10bf=_0x1c10bf||0x1f4;return function(_0x267692){logger[_0x7244('0x5')](_0x7244('0x6'),_0x4eb872,_0x1c10bf,util[_0x7244('0x7')](_0x267692,{'showHidden':![],'depth':null}));delete _0x267692[_0x7244('0x8')];_0x30f6a4[_0x7244('0x9')](_0x1c10bf)['send'](_0x267692);};}exports[_0x7244('0xa')]=function(_0x5b8034,_0x1c489b){return info[_0x7244('0xb')]()[_0x7244('0xc')](function(_0x1feff1){return _0x1c489b[_0x7244('0x9')](0xc8)[_0x7244('0xd')](_0x1feff1);})['catch'](function(_0x583f29){return _0x1c489b['status'](0x1f4)[_0x7244('0xd')](_0x583f29);});};exports[_0x7244('0xe')]=function(_0x59bddb,_0x56c230){var _0x57776f=[_0x7244('0xf')];return new BPromise(function(_0x3a7338,_0xa135a0){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x59bddb[_0x7244('0x10')][_0x7244('0x11')]),function(_0x22d94b,_0x564110,_0x2b96aa){if(_0x22d94b){return _0xa135a0(_0x22d94b);}return _0x3a7338(_0x564110);});})[_0x7244('0xc')](function(_0x1b43c3){var _0x37881a=![];var _0x89c02b=_0x1b43c3[_0x7244('0x12')](/\n/);for(var _0x34a96b=0x0,_0x192f60=_0x57776f[_0x7244('0x13')];_0x34a96b<_0x192f60,_0x37881a===![];_0x34a96b+=0x1){if(_0x1b43c3[_0x7244('0x14')](_0x57776f[_0x34a96b])>=0x0){_0x37881a=!![];}}if(!_0x37881a){throw new Error(util['format'](_0x7244('0x15'),_0x59bddb[_0x7244('0x10')][_0x7244('0x11')]));}process['kill'](_0x59bddb[_0x7244('0x10')][_0x7244('0x11')],_0x7244('0x16'));return _0x56c230[_0x7244('0x9')](0xc8)[_0x7244('0xd')]({'message':util[_0x7244('0x17')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x59bddb['params'][_0x7244('0x11')])});})[_0x7244('0x18')](handleError(_0x56c230,null,_0x7244('0xe')));}; \ No newline at end of file +var _0x7711=['util','bluebird','lodash','inspect','name','getAllData','then','status','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec'];(function(_0x11ca82,_0x2110cd){var _0x49155f=function(_0x5953b8){while(--_0x5953b8){_0x11ca82['push'](_0x11ca82['shift']());}};_0x49155f(++_0x2110cd);}(_0x7711,0xf7));var _0x1771=function(_0xe121fa,_0x40f4ca){_0xe121fa=_0xe121fa-0x0;var _0x4982bb=_0x7711[_0xe121fa];return _0x4982bb;};'use strict';var info=require(_0x1771('0x0'));var exec=require(_0x1771('0x1'))[_0x1771('0x2')];var logger=require('../../config/logger')('api');var util=require(_0x1771('0x3'));var BPromise=require(_0x1771('0x4'));var _=require(_0x1771('0x5'));function handleError(_0x3a7b2c,_0x5de408,_0x222275){_0x5de408=_0x5de408||0x1f4;return function(_0x2cec83){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x222275,_0x5de408,util[_0x1771('0x6')](_0x2cec83,{'showHidden':![],'depth':null}));delete _0x2cec83[_0x1771('0x7')];_0x3a7b2c['status'](_0x5de408)['send'](_0x2cec83);};}exports['index']=function(_0x39b33f,_0x3e8696){return info[_0x1771('0x8')]()[_0x1771('0x9')](function(_0xa371aa){return _0x3e8696[_0x1771('0xa')](0xc8)[_0x1771('0xb')](_0xa371aa);})[_0x1771('0xc')](function(_0x382e5f){return _0x3e8696['status'](0x1f4)[_0x1771('0xb')](_0x382e5f);});};exports[_0x1771('0xd')]=function(_0x3a2d06,_0x62b386){var _0x49abe3=[_0x1771('0xe')];return new BPromise(function(_0xba44f6,_0x2cbbc4){return exec(util[_0x1771('0xf')](_0x1771('0x10'),_0x3a2d06[_0x1771('0x11')]['pid']),function(_0x41c504,_0x157e28,_0x1f6005){if(_0x41c504){return _0x2cbbc4(_0x41c504);}return _0xba44f6(_0x157e28);});})[_0x1771('0x9')](function(_0x3f1700){var _0x4248c3=![];var _0x2c62a9=_0x3f1700[_0x1771('0x12')](/\n/);for(var _0x3de6b2=0x0,_0x38f9f7=_0x49abe3[_0x1771('0x13')];_0x3de6b2<_0x38f9f7,_0x4248c3===![];_0x3de6b2+=0x1){if(_0x3f1700[_0x1771('0x14')](_0x49abe3[_0x3de6b2])>=0x0){_0x4248c3=!![];}}if(!_0x4248c3){throw new Error(util[_0x1771('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3a2d06[_0x1771('0x11')][_0x1771('0x15')]));}process[_0x1771('0x16')](_0x3a2d06['params']['pid'],_0x1771('0x17'));return _0x62b386[_0x1771('0xa')](0xc8)[_0x1771('0xb')]({'message':util['format'](_0x1771('0x18'),_0x3a2d06[_0x1771('0x11')][_0x1771('0x15')])});})[_0x1771('0xc')](handleError(_0x62b386,null,_0x1771('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a9508bd..3acaf11 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 _0x4522=['destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x14b767,_0x577e84){var _0x22267a=function(_0xa87ebc){while(--_0xa87ebc){_0x14b767['push'](_0x14b767['shift']());}};_0x22267a(++_0x577e84);}(_0x4522,0x1a0));var _0x2452=function(_0x23c694,_0x4e3060){_0x23c694=_0x23c694-0x0;var _0x1c7f83=_0x4522[_0x23c694];return _0x1c7f83;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var auth=require(_0x2452('0x3'));var interaction=require(_0x2452('0x4'));var config=require(_0x2452('0x5'));var controller=require(_0x2452('0x6'));router[_0x2452('0x7')]('/',auth[_0x2452('0x8')](),controller[_0x2452('0x9')]);router[_0x2452('0x7')](_0x2452('0xa'),auth[_0x2452('0x8')](),controller[_0x2452('0xb')]);router[_0x2452('0xc')]('/',auth[_0x2452('0x8')](),controller[_0x2452('0xd')]);router[_0x2452('0xe')](_0x2452('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2452('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2452('0x10')]);module[_0x2452('0x11')]=router; \ No newline at end of file +var _0x1339=['./tag.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d2ed9,_0x16c436){var _0x4262c5=function(_0x124aee){while(--_0x124aee){_0x5d2ed9['push'](_0x5d2ed9['shift']());}};_0x4262c5(++_0x16c436);}(_0x1339,0x1ed));var _0x9133=function(_0x4d6f11,_0x4ce9e5){_0x4d6f11=_0x4d6f11-0x0;var _0x21512b=_0x1339[_0x4d6f11];return _0x21512b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var auth=require(_0x9133('0x4'));var interaction=require(_0x9133('0x5'));var config=require(_0x9133('0x6'));var controller=require(_0x9133('0x7'));router['get']('/',auth[_0x9133('0x8')](),controller[_0x9133('0x9')]);router[_0x9133('0xa')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0xb')]);router[_0x9133('0xc')]('/',auth[_0x9133('0x8')](),controller[_0x9133('0xd')]);router[_0x9133('0xe')](_0x9133('0xf'),auth[_0x9133('0x8')](),controller[_0x9133('0x10')]);router[_0x9133('0x11')]('/:id',auth[_0x9133('0x8')](),controller[_0x9133('0x12')]);module[_0x9133('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index cc414c8..07f5fba 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x31359f,_0x40902c){var _0x1929fa=function(_0x46d6c4){while(--_0x46d6c4){_0x31359f['push'](_0x31359f['shift']());}};_0x1929fa(++_0x40902c);}(_0x878f,0x173));var _0xf878=function(_0xb2b372,_0x4a6cd0){_0xb2b372=_0xb2b372-0x0;var _0x18cb26=_0x878f[_0xb2b372];return _0x18cb26;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','name','#0091EA'];(function(_0x48de9e,_0x144e00){var _0x20e60f=function(_0x2f65a3){while(--_0x2f65a3){_0x48de9e['push'](_0x48de9e['shift']());}};_0x20e60f(++_0x144e00);}(_0x7916,0x128));var _0x6791=function(_0xba146,_0x1d982b){_0xba146=_0xba146-0x0;var _0x38f267=_0x7916[_0xba146];return _0x38f267;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x6791('0x3')},'description':{'type':Sequelize[_0x6791('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 4fb1158..7d5466c 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 _0x3806=['then','end','sendStatus','error','index','map','Tag','rawAttributes','fieldName','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','where','pick','VIRTUAL','merge','includeAll','include','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','Content-Range','reject','save','update','destroy','get','UserProfileResource'];(function(_0x141806,_0x11927a){var _0x3df5fa=function(_0x1fbba0){while(--_0x1fbba0){_0x141806['push'](_0x141806['shift']());}};_0x3df5fa(++_0x11927a);}(_0x3806,0x146));var _0x6380=function(_0x5a2905,_0x1edb8f){_0x5a2905=_0x5a2905-0x0;var _0x587373=_0x3806[_0x5a2905];return _0x587373;};'use strict';var pdf=require(_0x6380('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6380('0x1'));var zipdir=require(_0x6380('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6380('0x3'));var moment=require('moment');var BPromise=require(_0x6380('0x4'));var Mustache=require('mustache');var util=require(_0x6380('0x5'));var path=require(_0x6380('0x6'));var sox=require(_0x6380('0x7'));var csv=require(_0x6380('0x8'));var ejs=require(_0x6380('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6380('0xa'));var crypto=require('crypto');var jsforce=require(_0x6380('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6380('0x8'));var querystring=require(_0x6380('0xc'));var Papa=require(_0x6380('0xd'));var Redis=require(_0x6380('0xe'));var authService=require(_0x6380('0xf'));var qs=require(_0x6380('0x10'));var as=require(_0x6380('0x11'));var hardwareService=require(_0x6380('0x12'));var logger=require(_0x6380('0x13'))(_0x6380('0x14'));var utils=require('../../config/utils');var config=require(_0x6380('0x15'));var db=require(_0x6380('0x16'))['db'];function respondWithStatusCode(_0x45283e,_0x3db0e4){_0x3db0e4=_0x3db0e4||0xcc;return function(_0x14f9a8){if(_0x14f9a8){return _0x45283e['sendStatus'](_0x3db0e4);}return _0x45283e[_0x6380('0x17')](_0x3db0e4)['end']();};}function respondWithResult(_0x58bd77,_0x185ed9){_0x185ed9=_0x185ed9||0xc8;return function(_0x45b6a6){if(_0x45b6a6){return _0x58bd77[_0x6380('0x17')](_0x185ed9)[_0x6380('0x18')](_0x45b6a6);}};}function respondWithFilteredResult(_0x1074f7,_0x16ba85){return function(_0x2f6440){if(_0x2f6440){var _0x4ec3fa=_0x2f6440[_0x6380('0x19')],_0x5d0869=_0x16ba85[_0x6380('0x1a')],_0x2137bb=_0x16ba85['offset']+_0x16ba85['limit'],_0x1d88c7;if(_0x2137bb>=_0x4ec3fa){_0x2137bb=_0x4ec3fa;_0x1d88c7=0xc8;}else{_0x1d88c7=0xce;}_0x1074f7['status'](_0x1d88c7);return _0x1074f7['set'](_0x6380('0x1b'),_0x5d0869+'-'+_0x2137bb+'/'+_0x4ec3fa)['json'](_0x2f6440);}return null;};}function patchUpdates(_0x5560e1){return function(_0x2ea3c0){try{jsonpatch['apply'](_0x2ea3c0,_0x5560e1,!![]);}catch(_0x27c679){return BPromise[_0x6380('0x1c')](_0x27c679);}return _0x2ea3c0[_0x6380('0x1d')]();};}function saveUpdates(_0x131e0f,_0x1ef2ee){return function(_0xc5f897){if(_0xc5f897){return _0xc5f897[_0x6380('0x1e')](_0x131e0f)['then'](function(_0x164a3f){return _0x164a3f;});}return null;};}function removeEntity(_0x386e34,_0x459fb2){return function(_0x585ffe){if(_0x585ffe){return _0x585ffe[_0x6380('0x1f')]()['then'](function(){var _0x343f44=_0x585ffe[_0x6380('0x20')]({'plain':!![]});var _0x24965e='Tags';return db[_0x6380('0x21')][_0x6380('0x1f')]({'where':{'type':_0x24965e,'resourceId':_0x343f44['id']}})['then'](function(){return _0x585ffe;});})[_0x6380('0x22')](function(){_0x386e34[_0x6380('0x17')](0xcc)[_0x6380('0x23')]();});}};}function handleEntityNotFound(_0xfafff,_0x57d021){return function(_0x577563){if(!_0x577563){_0xfafff[_0x6380('0x24')](0x194);}return _0x577563;};}function handleError(_0x266de0,_0x3eafeb){_0x3eafeb=_0x3eafeb||0x1f4;return function(_0x243eaf){logger[_0x6380('0x25')](_0x243eaf['stack']);if(_0x243eaf['name']){delete _0x243eaf['name'];}_0x266de0[_0x6380('0x17')](_0x3eafeb)['send'](_0x243eaf);};}exports[_0x6380('0x26')]=function(_0x29bdff,_0x1f9cab){var _0x5ad307={},_0x48a928={},_0xfee954={'count':0x0,'rows':[]};var _0x584f32=_[_0x6380('0x27')](db[_0x6380('0x28')][_0x6380('0x29')],function(_0x43e9fe){return{'name':_0x43e9fe[_0x6380('0x2a')],'type':_0x43e9fe['type'][_0x6380('0x2b')]};});_0x48a928['model']=_[_0x6380('0x27')](_0x584f32,_0x6380('0x2c'));_0x48a928[_0x6380('0x2d')]=_[_0x6380('0x2e')](_0x29bdff[_0x6380('0x2d')]);_0x48a928[_0x6380('0x2f')]=_[_0x6380('0x30')](_0x48a928[_0x6380('0x31')],_0x48a928[_0x6380('0x2d')]);_0x5ad307['attributes']=_['intersection'](_0x48a928[_0x6380('0x31')],qs[_0x6380('0x32')](_0x29bdff[_0x6380('0x2d')][_0x6380('0x32')]));_0x5ad307['attributes']=_0x5ad307[_0x6380('0x33')]['length']?_0x5ad307[_0x6380('0x33')]:_0x48a928[_0x6380('0x31')];if(!_0x29bdff['query'][_0x6380('0x34')]('nolimit')){_0x5ad307[_0x6380('0x35')]=qs[_0x6380('0x35')](_0x29bdff[_0x6380('0x2d')][_0x6380('0x35')]);_0x5ad307[_0x6380('0x1a')]=qs[_0x6380('0x1a')](_0x29bdff[_0x6380('0x2d')][_0x6380('0x1a')]);}_0x5ad307['order']=qs['sort'](_0x29bdff[_0x6380('0x2d')]['sort']);_0x5ad307[_0x6380('0x36')]=qs[_0x6380('0x2f')](_[_0x6380('0x37')](_0x29bdff[_0x6380('0x2d')],_0x48a928['filters']),_0x584f32);if(_0x29bdff['query']['filter']){_0x5ad307[_0x6380('0x36')]=_['merge'](_0x5ad307[_0x6380('0x36')],{'$or':_[_0x6380('0x27')](_0x584f32,function(_0xdc5df3){if(_0xdc5df3['type']!==_0x6380('0x38')){var _0x308c76={};_0x308c76[_0xdc5df3[_0x6380('0x2c')]]={'$like':'%'+_0x29bdff[_0x6380('0x2d')]['filter']+'%'};return _0x308c76;}})});}_0x5ad307=_[_0x6380('0x39')]({},_0x5ad307,_0x29bdff['options']);var _0x4cf439={'where':_0x5ad307[_0x6380('0x36')]};return db[_0x6380('0x28')][_0x6380('0x19')](_0x4cf439)['then'](function(_0x5f168e){_0xfee954[_0x6380('0x19')]=_0x5f168e;if(_0x29bdff['query'][_0x6380('0x3a')]){_0x5ad307[_0x6380('0x3b')]=[{'all':!![]}];}return db[_0x6380('0x28')]['findAll'](_0x5ad307);})[_0x6380('0x22')](function(_0x3118bb){_0xfee954['rows']=_0x3118bb;return _0xfee954;})[_0x6380('0x22')](respondWithFilteredResult(_0x1f9cab,_0x5ad307))[_0x6380('0x3c')](handleError(_0x1f9cab,null));};exports[_0x6380('0x3d')]=function(_0x459d74,_0x28b3c0){var _0x268ce6={'raw':!![],'where':{'id':_0x459d74[_0x6380('0x3e')]['id']}},_0x21f894={};_0x21f894['model']=_[_0x6380('0x2e')](db[_0x6380('0x28')][_0x6380('0x29')]);_0x21f894['query']=_['keys'](_0x459d74[_0x6380('0x2d')]);_0x21f894['filters']=_[_0x6380('0x30')](_0x21f894[_0x6380('0x31')],_0x21f894[_0x6380('0x2d')]);_0x268ce6['attributes']=_[_0x6380('0x30')](_0x21f894[_0x6380('0x31')],qs['fields'](_0x459d74['query']['fields']));_0x268ce6['attributes']=_0x268ce6[_0x6380('0x33')]['length']?_0x268ce6[_0x6380('0x33')]:_0x21f894['model'];if(_0x459d74['query'][_0x6380('0x3a')]){_0x268ce6[_0x6380('0x3b')]=[{'all':!![]}];}_0x268ce6=_['merge']({},_0x268ce6,_0x459d74[_0x6380('0x3f')]);return db[_0x6380('0x28')][_0x6380('0x40')](_0x268ce6)[_0x6380('0x22')](handleEntityNotFound(_0x28b3c0,null))[_0x6380('0x22')](respondWithResult(_0x28b3c0,null))['catch'](handleError(_0x28b3c0,null));};exports['create']=function(_0x6ea154,_0x3c8ed7){return db['Tag'][_0x6380('0x41')](_0x6ea154[_0x6380('0x42')],{})[_0x6380('0x22')](function(_0x30ea8e){var _0x40e0fb=_0x6ea154['user'][_0x6380('0x20')]({'plain':!![]});if(!_0x40e0fb)throw new Error(_0x6380('0x43'));if(_0x40e0fb[_0x6380('0x44')]==='user'){var _0x5effe5=_0x30ea8e['get']({'plain':!![]});var _0x2873a8=_0x6380('0x45');return db[_0x6380('0x46')]['find']({'where':{'name':_0x2873a8,'userProfileId':_0x40e0fb['userProfileId']},'raw':!![]})[_0x6380('0x22')](function(_0x27a667){if(_0x27a667&&_0x27a667[_0x6380('0x47')]===0x0){return db[_0x6380('0x21')]['create']({'name':_0x5effe5[_0x6380('0x2c')],'resourceId':_0x5effe5['id'],'type':_0x27a667['name'],'sectionId':_0x27a667['id']},{})[_0x6380('0x22')](function(){return _0x30ea8e;});}else{return _0x30ea8e;}})[_0x6380('0x3c')](function(_0x37c9d7){logger[_0x6380('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37c9d7);throw _0x37c9d7;});}return _0x30ea8e;})[_0x6380('0x22')](respondWithResult(_0x3c8ed7,0xc9))['catch'](handleError(_0x3c8ed7,null));};exports['update']=function(_0x1fef6c,_0x454c53){if(_0x1fef6c[_0x6380('0x42')]['id']){delete _0x1fef6c[_0x6380('0x42')]['id'];}return db[_0x6380('0x28')]['find']({'where':{'id':_0x1fef6c[_0x6380('0x3e')]['id']}})['then'](handleEntityNotFound(_0x454c53,null))[_0x6380('0x22')](saveUpdates(_0x1fef6c['body'],null))[_0x6380('0x22')](respondWithResult(_0x454c53,null))['catch'](handleError(_0x454c53,null));};exports[_0x6380('0x1f')]=function(_0x4d5eb9,_0x2f7270){return db['Tag'][_0x6380('0x40')]({'where':{'id':_0x4d5eb9[_0x6380('0x3e')]['id']}})[_0x6380('0x22')](handleEntityNotFound(_0x2f7270,null))['then'](removeEntity(_0x2f7270,null))[_0x6380('0x3c')](handleError(_0x2f7270,null));}; \ No newline at end of file +var _0x4c3f=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','Tag','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','include','findAll','catch','show','params','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto'];(function(_0x78a8f4,_0x259809){var _0x2b3291=function(_0x5e64ca){while(--_0x5e64ca){_0x78a8f4['push'](_0x78a8f4['shift']());}};_0x2b3291(++_0x259809);}(_0x4c3f,0x1d9));var _0xf4c3=function(_0x575167,_0x25764c){_0x575167=_0x575167-0x0;var _0x15405a=_0x4c3f[_0x575167];return _0x15405a;};'use strict';var pdf=require(_0xf4c3('0x0'));var emlformat=require(_0xf4c3('0x1'));var rimraf=require(_0xf4c3('0x2'));var zipdir=require(_0xf4c3('0x3'));var jsonpatch=require(_0xf4c3('0x4'));var rp=require(_0xf4c3('0x5'));var moment=require('moment');var BPromise=require(_0xf4c3('0x6'));var Mustache=require(_0xf4c3('0x7'));var util=require('util');var path=require(_0xf4c3('0x8'));var sox=require(_0xf4c3('0x9'));var csv=require('to-csv');var ejs=require(_0xf4c3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf4c3('0xb'));var crypto=require(_0xf4c3('0xc'));var jsforce=require(_0xf4c3('0xd'));var deskjs=require(_0xf4c3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf4c3('0xf'));var Redis=require(_0xf4c3('0x10'));var authService=require(_0xf4c3('0x11'));var qs=require(_0xf4c3('0x12'));var as=require(_0xf4c3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4c3('0x14'))(_0xf4c3('0x15'));var utils=require(_0xf4c3('0x16'));var config=require(_0xf4c3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x518b9c,_0x227e1d){_0x227e1d=_0x227e1d||0xcc;return function(_0x43c323){if(_0x43c323){return _0x518b9c[_0xf4c3('0x18')](_0x227e1d);}return _0x518b9c[_0xf4c3('0x19')](_0x227e1d)[_0xf4c3('0x1a')]();};}function respondWithResult(_0x2b6f1a,_0x4d994b){_0x4d994b=_0x4d994b||0xc8;return function(_0x499308){if(_0x499308){return _0x2b6f1a['status'](_0x4d994b)['json'](_0x499308);}};}function respondWithFilteredResult(_0x203d22,_0xc12668){return function(_0x11a829){if(_0x11a829){var _0xe709dd=_0x11a829[_0xf4c3('0x1b')],_0x1c36de=_0xc12668[_0xf4c3('0x1c')],_0x5d3cc1=_0xc12668[_0xf4c3('0x1c')]+_0xc12668['limit'],_0x20fd3d;if(_0x5d3cc1>=_0xe709dd){_0x5d3cc1=_0xe709dd;_0x20fd3d=0xc8;}else{_0x20fd3d=0xce;}_0x203d22['status'](_0x20fd3d);return _0x203d22[_0xf4c3('0x1d')](_0xf4c3('0x1e'),_0x1c36de+'-'+_0x5d3cc1+'/'+_0xe709dd)[_0xf4c3('0x1f')](_0x11a829);}return null;};}function patchUpdates(_0x1aaaa7){return function(_0x8bb80e){try{jsonpatch[_0xf4c3('0x20')](_0x8bb80e,_0x1aaaa7,!![]);}catch(_0x2d1e60){return BPromise[_0xf4c3('0x21')](_0x2d1e60);}return _0x8bb80e['save']();};}function saveUpdates(_0x157863,_0x12dd49){return function(_0x18abbf){if(_0x18abbf){return _0x18abbf[_0xf4c3('0x22')](_0x157863)[_0xf4c3('0x23')](function(_0x137cb8){return _0x137cb8;});}return null;};}function removeEntity(_0x502721,_0x3d9a2c){return function(_0x559977){if(_0x559977){return _0x559977[_0xf4c3('0x24')]()[_0xf4c3('0x23')](function(){var _0x343421=_0x559977[_0xf4c3('0x25')]({'plain':!![]});var _0x5b6422=_0xf4c3('0x26');return db[_0xf4c3('0x27')][_0xf4c3('0x24')]({'where':{'type':_0x5b6422,'resourceId':_0x343421['id']}})[_0xf4c3('0x23')](function(){return _0x559977;});})[_0xf4c3('0x23')](function(){_0x502721[_0xf4c3('0x19')](0xcc)[_0xf4c3('0x1a')]();});}};}function handleEntityNotFound(_0x10fbab,_0x4a1579){return function(_0x56b5e2){if(!_0x56b5e2){_0x10fbab[_0xf4c3('0x18')](0x194);}return _0x56b5e2;};}function handleError(_0x243ba4,_0xd2356e){_0xd2356e=_0xd2356e||0x1f4;return function(_0x358ac9){logger[_0xf4c3('0x28')](_0x358ac9[_0xf4c3('0x29')]);if(_0x358ac9[_0xf4c3('0x2a')]){delete _0x358ac9[_0xf4c3('0x2a')];}_0x243ba4['status'](_0xd2356e)[_0xf4c3('0x2b')](_0x358ac9);};}exports['index']=function(_0x3728bc,_0x5f2008){var _0x8d80a3={},_0x54ed15={},_0x208a77={'count':0x0,'rows':[]};var _0x56fb7e=_['map'](db[_0xf4c3('0x2c')]['rawAttributes'],function(_0x21721f){return{'name':_0x21721f[_0xf4c3('0x2d')],'type':_0x21721f[_0xf4c3('0x2e')]['key']};});_0x54ed15[_0xf4c3('0x2f')]=_[_0xf4c3('0x30')](_0x56fb7e,_0xf4c3('0x2a'));_0x54ed15[_0xf4c3('0x31')]=_[_0xf4c3('0x32')](_0x3728bc[_0xf4c3('0x31')]);_0x54ed15[_0xf4c3('0x33')]=_[_0xf4c3('0x34')](_0x54ed15[_0xf4c3('0x2f')],_0x54ed15['query']);_0x8d80a3[_0xf4c3('0x35')]=_[_0xf4c3('0x34')](_0x54ed15['model'],qs[_0xf4c3('0x36')](_0x3728bc[_0xf4c3('0x31')][_0xf4c3('0x36')]));_0x8d80a3[_0xf4c3('0x35')]=_0x8d80a3[_0xf4c3('0x35')]['length']?_0x8d80a3[_0xf4c3('0x35')]:_0x54ed15['model'];if(!_0x3728bc[_0xf4c3('0x31')][_0xf4c3('0x37')](_0xf4c3('0x38'))){_0x8d80a3[_0xf4c3('0x39')]=qs[_0xf4c3('0x39')](_0x3728bc[_0xf4c3('0x31')][_0xf4c3('0x39')]);_0x8d80a3[_0xf4c3('0x1c')]=qs[_0xf4c3('0x1c')](_0x3728bc[_0xf4c3('0x31')][_0xf4c3('0x1c')]);}_0x8d80a3[_0xf4c3('0x3a')]=qs[_0xf4c3('0x3b')](_0x3728bc[_0xf4c3('0x31')]['sort']);_0x8d80a3[_0xf4c3('0x3c')]=qs['filters'](_[_0xf4c3('0x3d')](_0x3728bc['query'],_0x54ed15[_0xf4c3('0x33')]),_0x56fb7e);if(_0x3728bc[_0xf4c3('0x31')]['filter']){_0x8d80a3[_0xf4c3('0x3c')]=_[_0xf4c3('0x3e')](_0x8d80a3[_0xf4c3('0x3c')],{'$or':_[_0xf4c3('0x30')](_0x56fb7e,function(_0x19bbfe){if(_0x19bbfe[_0xf4c3('0x2e')]!==_0xf4c3('0x3f')){var _0x26d96b={};_0x26d96b[_0x19bbfe[_0xf4c3('0x2a')]]={'$like':'%'+_0x3728bc['query']['filter']+'%'};return _0x26d96b;}})});}_0x8d80a3=_[_0xf4c3('0x3e')]({},_0x8d80a3,_0x3728bc['options']);var _0x22ac6a={'where':_0x8d80a3[_0xf4c3('0x3c')]};return db['Tag'][_0xf4c3('0x1b')](_0x22ac6a)[_0xf4c3('0x23')](function(_0x4cf5f9){_0x208a77[_0xf4c3('0x1b')]=_0x4cf5f9;if(_0x3728bc[_0xf4c3('0x31')]['includeAll']){_0x8d80a3[_0xf4c3('0x40')]=[{'all':!![]}];}return db['Tag'][_0xf4c3('0x41')](_0x8d80a3);})[_0xf4c3('0x23')](function(_0x5019c7){_0x208a77['rows']=_0x5019c7;return _0x208a77;})[_0xf4c3('0x23')](respondWithFilteredResult(_0x5f2008,_0x8d80a3))[_0xf4c3('0x42')](handleError(_0x5f2008,null));};exports[_0xf4c3('0x43')]=function(_0x215747,_0x3b97bf){var _0x56004e={'raw':!![],'where':{'id':_0x215747[_0xf4c3('0x44')]['id']}},_0x4d94c0={};_0x4d94c0[_0xf4c3('0x2f')]=_[_0xf4c3('0x32')](db[_0xf4c3('0x2c')][_0xf4c3('0x45')]);_0x4d94c0[_0xf4c3('0x31')]=_['keys'](_0x215747['query']);_0x4d94c0[_0xf4c3('0x33')]=_[_0xf4c3('0x34')](_0x4d94c0[_0xf4c3('0x2f')],_0x4d94c0['query']);_0x56004e[_0xf4c3('0x35')]=_[_0xf4c3('0x34')](_0x4d94c0[_0xf4c3('0x2f')],qs['fields'](_0x215747[_0xf4c3('0x31')][_0xf4c3('0x36')]));_0x56004e[_0xf4c3('0x35')]=_0x56004e[_0xf4c3('0x35')]['length']?_0x56004e[_0xf4c3('0x35')]:_0x4d94c0['model'];if(_0x215747[_0xf4c3('0x31')][_0xf4c3('0x46')]){_0x56004e[_0xf4c3('0x40')]=[{'all':!![]}];}_0x56004e=_['merge']({},_0x56004e,_0x215747[_0xf4c3('0x47')]);return db[_0xf4c3('0x2c')][_0xf4c3('0x48')](_0x56004e)[_0xf4c3('0x23')](handleEntityNotFound(_0x3b97bf,null))['then'](respondWithResult(_0x3b97bf,null))[_0xf4c3('0x42')](handleError(_0x3b97bf,null));};exports[_0xf4c3('0x49')]=function(_0x571cb5,_0x340a4b){return db[_0xf4c3('0x2c')]['create'](_0x571cb5['body'],{})['then'](function(_0x1c1a1c){var _0x2a3ac2=_0x571cb5[_0xf4c3('0x4a')][_0xf4c3('0x25')]({'plain':!![]});if(!_0x2a3ac2)throw new Error(_0xf4c3('0x4b'));if(_0x2a3ac2[_0xf4c3('0x4c')]===_0xf4c3('0x4a')){var _0x37991a=_0x1c1a1c[_0xf4c3('0x25')]({'plain':!![]});var _0x44a028='Tags';return db[_0xf4c3('0x4d')][_0xf4c3('0x48')]({'where':{'name':_0x44a028,'userProfileId':_0x2a3ac2[_0xf4c3('0x4e')]},'raw':!![]})[_0xf4c3('0x23')](function(_0xb8ac1d){if(_0xb8ac1d&&_0xb8ac1d['autoAssociation']===0x0){return db[_0xf4c3('0x27')][_0xf4c3('0x49')]({'name':_0x37991a[_0xf4c3('0x2a')],'resourceId':_0x37991a['id'],'type':_0xb8ac1d[_0xf4c3('0x2a')],'sectionId':_0xb8ac1d['id']},{})[_0xf4c3('0x23')](function(){return _0x1c1a1c;});}else{return _0x1c1a1c;}})['catch'](function(_0x2a8e71){logger[_0xf4c3('0x28')](_0xf4c3('0x4f'),_0x2a8e71);throw _0x2a8e71;});}return _0x1c1a1c;})[_0xf4c3('0x23')](respondWithResult(_0x340a4b,0xc9))[_0xf4c3('0x42')](handleError(_0x340a4b,null));};exports[_0xf4c3('0x22')]=function(_0x34d7cb,_0x5bb210){if(_0x34d7cb[_0xf4c3('0x50')]['id']){delete _0x34d7cb[_0xf4c3('0x50')]['id'];}return db['Tag'][_0xf4c3('0x48')]({'where':{'id':_0x34d7cb[_0xf4c3('0x44')]['id']}})[_0xf4c3('0x23')](handleEntityNotFound(_0x5bb210,null))['then'](saveUpdates(_0x34d7cb[_0xf4c3('0x50')],null))[_0xf4c3('0x23')](respondWithResult(_0x5bb210,null))['catch'](handleError(_0x5bb210,null));};exports[_0xf4c3('0x24')]=function(_0xa3b2a6,_0x2ceaf){return db['Tag'][_0xf4c3('0x48')]({'where':{'id':_0xa3b2a6[_0xf4c3('0x44')]['id']}})[_0xf4c3('0x23')](handleEntityNotFound(_0x2ceaf,null))[_0xf4c3('0x23')](removeEntity(_0x2ceaf,null))[_0xf4c3('0x42')](handleError(_0x2ceaf,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 072246b..b607d82 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 _0xea63=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','Tag'];(function(_0x15e490,_0x3776ba){var _0x558233=function(_0x50b26e){while(--_0x50b26e){_0x15e490['push'](_0x15e490['shift']());}};_0x558233(++_0x3776ba);}(_0xea63,0x138));var _0x3ea6=function(_0xb41f87,_0x3455c3){_0xb41f87=_0xb41f87-0x0;var _0x3ce781=_0xea63[_0xb41f87];return _0x3ce781;};'use strict';var _=require(_0x3ea6('0x0'));var util=require(_0x3ea6('0x1'));var logger=require('../../config/logger')(_0x3ea6('0x2'));var moment=require(_0x3ea6('0x3'));var BPromise=require(_0x3ea6('0x4'));var rp=require(_0x3ea6('0x5'));var fs=require('fs');var path=require(_0x3ea6('0x6'));var rimraf=require(_0x3ea6('0x7'));var config=require('../../config/environment');var attributes=require(_0x3ea6('0x8'));module[_0x3ea6('0x9')]=function(_0x3fa2a6,_0x415869){return _0x3fa2a6[_0x3ea6('0xa')](_0x3ea6('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b51=['path','rimraf','exports','define','Tag','tools_tags','lodash','api','moment','request-promise'];(function(_0x18fc81,_0x7e7392){var _0x1f1bf4=function(_0x2a06d3){while(--_0x2a06d3){_0x18fc81['push'](_0x18fc81['shift']());}};_0x1f1bf4(++_0x7e7392);}(_0x9b51,0x1d2));var _0x19b5=function(_0x1cb713,_0x2b6dd2){_0x1cb713=_0x1cb713-0x0;var _0x3d89f5=_0x9b51[_0x1cb713];return _0x3d89f5;};'use strict';var _=require(_0x19b5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x19b5('0x1'));var moment=require(_0x19b5('0x2'));var BPromise=require('bluebird');var rp=require(_0x19b5('0x3'));var fs=require('fs');var path=require(_0x19b5('0x4'));var rimraf=require(_0x19b5('0x5'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x19b5('0x6')]=function(_0x5f37c5,_0x2c465d){return _0x5f37c5[_0x19b5('0x7')](_0x19b5('0x8'),attributes,{'tableName':_0x19b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 6498870..8839dd5 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 _0x593e=['then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x317385,_0x5493cb){var _0x1ec97c=function(_0x47e2a0){while(--_0x47e2a0){_0x317385['push'](_0x317385['shift']());}};_0x1ec97c(++_0x5493cb);}(_0x593e,0xcb));var _0xe593=function(_0x4335e9,_0x19985d){_0x4335e9=_0x4335e9-0x0;var _0x16926e=_0x593e[_0x4335e9];return _0x16926e;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('Tag,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('Tag,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('Tag,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('Tag,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});} \ No newline at end of file +var _0x1d2d=['lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x488830,_0xebac2e){var _0x4a2328=function(_0x4fa672){while(--_0x4fa672){_0x488830['push'](_0x488830['shift']());}};_0x4a2328(++_0xebac2e);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x3724f3,_0x293a06){_0x3724f3=_0x3724f3-0x0;var _0x3c63b8=_0x1d2d[_0x3724f3];return _0x3c63b8;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('Tag,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4d8cd80..ce77048 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 _0x01b9=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./team.controller','index','get','/:id','/:id/queues','getQueues','isAuthenticated','post','addQueues','/:id/users','addAgents','put','update','destroy','delete','removeQueues','removeAgents','multer','util'];(function(_0x554b35,_0x49d1ac){var _0x5043d4=function(_0x549c79){while(--_0x549c79){_0x554b35['push'](_0x554b35['shift']());}};_0x5043d4(++_0x49d1ac);}(_0x01b9,0x106));var _0x901b=function(_0x582c35,_0x1a2858){_0x582c35=_0x582c35-0x0;var _0x4b0150=_0x01b9[_0x582c35];return _0x4b0150;};'use strict';var multer=require(_0x901b('0x0'));var util=require(_0x901b('0x1'));var path=require(_0x901b('0x2'));var timeout=require(_0x901b('0x3'));var express=require(_0x901b('0x4'));var router=express['Router']();var auth=require(_0x901b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x901b('0x6'));var controller=require(_0x901b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x901b('0x8')]);router[_0x901b('0x9')](_0x901b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x901b('0x9')](_0x901b('0xb'),auth['isAuthenticated'](),controller[_0x901b('0xc')]);router['get']('/:id/users',auth[_0x901b('0xd')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x901b('0xe')]('/:id/queues',auth[_0x901b('0xd')](),controller[_0x901b('0xf')]);router[_0x901b('0xe')](_0x901b('0x10'),auth[_0x901b('0xd')](),controller[_0x901b('0x11')]);router[_0x901b('0x12')](_0x901b('0xa'),auth['isAuthenticated'](),controller[_0x901b('0x13')]);router['delete'](_0x901b('0xa'),auth[_0x901b('0xd')](),controller[_0x901b('0x14')]);router[_0x901b('0x15')]('/:id/queues',auth[_0x901b('0xd')](),controller[_0x901b('0x16')]);router[_0x901b('0x15')]('/:id/users',auth[_0x901b('0xd')](),controller[_0x901b('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1dac=['../../config/environment','./team.controller','isAuthenticated','index','get','/:id','show','/:id/queues','/:id/users','create','post','addQueues','addAgents','put','update','delete','removeQueues','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xcee136,_0x3323a){var _0x4de02b=function(_0x13c644){while(--_0x13c644){_0xcee136['push'](_0xcee136['shift']());}};_0x4de02b(++_0x3323a);}(_0x1dac,0xda));var _0xc1da=function(_0x16066e,_0x31e151){_0x16066e=_0x16066e-0x0;var _0x52a12e=_0x1dac[_0x16066e];return _0x52a12e;};'use strict';var multer=require(_0xc1da('0x0'));var util=require(_0xc1da('0x1'));var path=require(_0xc1da('0x2'));var timeout=require(_0xc1da('0x3'));var express=require(_0xc1da('0x4'));var router=express[_0xc1da('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc1da('0x6'));var config=require(_0xc1da('0x7'));var controller=require(_0xc1da('0x8'));router['get']('/',auth[_0xc1da('0x9')](),controller[_0xc1da('0xa')]);router[_0xc1da('0xb')](_0xc1da('0xc'),auth[_0xc1da('0x9')](),controller[_0xc1da('0xd')]);router[_0xc1da('0xb')](_0xc1da('0xe'),auth['isAuthenticated'](),controller['getQueues']);router[_0xc1da('0xb')](_0xc1da('0xf'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xc1da('0x9')](),controller[_0xc1da('0x10')]);router[_0xc1da('0x11')]('/:id/queues',auth[_0xc1da('0x9')](),controller[_0xc1da('0x12')]);router[_0xc1da('0x11')](_0xc1da('0xf'),auth[_0xc1da('0x9')](),controller[_0xc1da('0x13')]);router[_0xc1da('0x14')]('/:id',auth[_0xc1da('0x9')](),controller[_0xc1da('0x15')]);router[_0xc1da('0x16')](_0xc1da('0xc'),auth[_0xc1da('0x9')](),controller['destroy']);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0xc1da('0x17')]);router[_0xc1da('0x16')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc1da('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 cf29176..3f261ec 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 _0xf7eb=['name','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf7eb,0x70));var _0xbf7e=function(_0x56d0c0,_0x4c96b6){_0x56d0c0=_0x56d0c0-0x0;var _0x178b05=_0xf7eb[_0x56d0c0];return _0x178b05;};'use strict';var Sequelize=require('sequelize');module[_0xbf7e('0x0')]={'name':{'type':Sequelize[_0xbf7e('0x1')],'allowNull':![],'unique':_0xbf7e('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6fe4=['sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6fe4,0x170));var _0x46fe=function(_0x58dc98,_0x595e50){_0x58dc98=_0x58dc98-0x0;var _0x33d20b=_0x6fe4[_0x58dc98];return _0x33d20b;};'use strict';var Sequelize=require(_0x46fe('0x0'));module[_0x46fe('0x1')]={'name':{'type':Sequelize[_0x46fe('0x2')],'allowNull':![],'unique':_0x46fe('0x3')},'description':{'type':Sequelize[_0x46fe('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 747cf31..caffca1 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 _0x8a26=['userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','each','User','findAll','online','interface','UserVoiceQueueRt','format','SIP/%s','voicePause','emit','removeAgents','chat','sms','fax','openchannel','whatsapp','userTeam:remove','getAgents','nolimit','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Teams','end','stack','name','send','Team','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x389726,_0x282267){var _0x295a74=function(_0xe7f277){while(--_0xe7f277){_0x389726['push'](_0x389726['shift']());}};_0x295a74(++_0x282267);}(_0x8a26,0x1a8));var _0x68a2=function(_0x15de20,_0x3b0375){_0x15de20=_0x15de20-0x0;var _0xbb6e02=_0x8a26[_0x15de20];return _0xbb6e02;};'use strict';var pdf=require(_0x68a2('0x0'));var emlformat=require(_0x68a2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x68a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68a2('0x3'));var moment=require(_0x68a2('0x4'));var BPromise=require(_0x68a2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x68a2('0x6'));var csv=require(_0x68a2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x68a2('0x8'));var deskjs=require(_0x68a2('0x9'));var toCsv=require(_0x68a2('0x7'));var querystring=require(_0x68a2('0xa'));var Papa=require(_0x68a2('0xb'));var Redis=require(_0x68a2('0xc'));var authService=require(_0x68a2('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x68a2('0xe'));var hardwareService=require(_0x68a2('0xf'));var logger=require(_0x68a2('0x10'))('api');var utils=require(_0x68a2('0x11'));var config=require(_0x68a2('0x12'));var db=require(_0x68a2('0x13'))['db'];config[_0x68a2('0x14')]=_[_0x68a2('0x15')](config[_0x68a2('0x14')],{'host':_0x68a2('0x16'),'port':0x18eb});var socket=require(_0x68a2('0x17'))(new Redis(config[_0x68a2('0x14')]));require(_0x68a2('0x18'))[_0x68a2('0x19')](socket);function respondWithStatusCode(_0x1037c3,_0x413312){_0x413312=_0x413312||0xcc;return function(_0x424324){if(_0x424324){return _0x1037c3[_0x68a2('0x1a')](_0x413312);}return _0x1037c3[_0x68a2('0x1b')](_0x413312)['end']();};}function respondWithResult(_0x371fb5,_0xac0079){_0xac0079=_0xac0079||0xc8;return function(_0x25640c){if(_0x25640c){return _0x371fb5['status'](_0xac0079)[_0x68a2('0x1c')](_0x25640c);}};}function respondWithFilteredResult(_0x116c27,_0x5f1fb3){return function(_0xc4d8f6){if(_0xc4d8f6){var _0x280ce2=_0xc4d8f6[_0x68a2('0x1d')],_0x423b30=_0x5f1fb3[_0x68a2('0x1e')],_0x38bbab=_0x5f1fb3[_0x68a2('0x1e')]+_0x5f1fb3[_0x68a2('0x1f')],_0x2853b7;if(_0x38bbab>=_0x280ce2){_0x38bbab=_0x280ce2;_0x2853b7=0xc8;}else{_0x2853b7=0xce;}_0x116c27[_0x68a2('0x1b')](_0x2853b7);return _0x116c27[_0x68a2('0x20')](_0x68a2('0x21'),_0x423b30+'-'+_0x38bbab+'/'+_0x280ce2)[_0x68a2('0x1c')](_0xc4d8f6);}return null;};}function patchUpdates(_0x84aeb8){return function(_0x3b8cc7){try{jsonpatch[_0x68a2('0x22')](_0x3b8cc7,_0x84aeb8,!![]);}catch(_0x5081e5){return BPromise['reject'](_0x5081e5);}return _0x3b8cc7[_0x68a2('0x23')]();};}function saveUpdates(_0xcbd25d,_0x211ceb){return function(_0x5e1322){if(_0x5e1322){return _0x5e1322[_0x68a2('0x24')](_0xcbd25d)[_0x68a2('0x25')](function(_0x2d6990){return _0x2d6990;});}return null;};}function removeEntity(_0x536d5e,_0x1b01b9){return function(_0x2444e6){if(_0x2444e6){return _0x2444e6[_0x68a2('0x26')]()['then'](function(){var _0x57edb6=_0x2444e6[_0x68a2('0x27')]({'plain':!![]});var _0x302d2f=_0x68a2('0x28');return db['UserProfileResource'][_0x68a2('0x26')]({'where':{'type':_0x302d2f,'resourceId':_0x57edb6['id']}})[_0x68a2('0x25')](function(){return _0x2444e6;});})[_0x68a2('0x25')](function(){_0x536d5e[_0x68a2('0x1b')](0xcc)[_0x68a2('0x29')]();});}};}function handleEntityNotFound(_0x1a64be,_0x53f607){return function(_0x4e597f){if(!_0x4e597f){_0x1a64be['sendStatus'](0x194);}return _0x4e597f;};}function handleError(_0x3bb080,_0x55e5ee){_0x55e5ee=_0x55e5ee||0x1f4;return function(_0x5c5d56){logger['error'](_0x5c5d56[_0x68a2('0x2a')]);if(_0x5c5d56[_0x68a2('0x2b')]){delete _0x5c5d56[_0x68a2('0x2b')];}_0x3bb080[_0x68a2('0x1b')](_0x55e5ee)[_0x68a2('0x2c')](_0x5c5d56);};}exports['index']=function(_0x316768,_0x545b3a){var _0x12de69={},_0x15417d={},_0x238907={'count':0x0,'rows':[]};var _0x29ce0f=_['map'](db[_0x68a2('0x2d')][_0x68a2('0x2e')],function(_0x360f50){return{'name':_0x360f50[_0x68a2('0x2f')],'type':_0x360f50[_0x68a2('0x30')][_0x68a2('0x31')]};});_0x15417d[_0x68a2('0x32')]=_[_0x68a2('0x33')](_0x29ce0f,_0x68a2('0x2b'));_0x15417d['query']=_[_0x68a2('0x34')](_0x316768[_0x68a2('0x35')]);_0x15417d[_0x68a2('0x36')]=_[_0x68a2('0x37')](_0x15417d[_0x68a2('0x32')],_0x15417d['query']);_0x12de69[_0x68a2('0x38')]=_[_0x68a2('0x37')](_0x15417d['model'],qs[_0x68a2('0x39')](_0x316768[_0x68a2('0x35')][_0x68a2('0x39')]));_0x12de69['attributes']=_0x12de69[_0x68a2('0x38')]['length']?_0x12de69['attributes']:_0x15417d[_0x68a2('0x32')];if(!_0x316768[_0x68a2('0x35')][_0x68a2('0x3a')]('nolimit')){_0x12de69[_0x68a2('0x1f')]=qs['limit'](_0x316768[_0x68a2('0x35')][_0x68a2('0x1f')]);_0x12de69[_0x68a2('0x1e')]=qs[_0x68a2('0x1e')](_0x316768[_0x68a2('0x35')][_0x68a2('0x1e')]);}_0x12de69[_0x68a2('0x3b')]=qs[_0x68a2('0x3c')](_0x316768['query'][_0x68a2('0x3c')]);_0x12de69[_0x68a2('0x3d')]=qs['filters'](_[_0x68a2('0x3e')](_0x316768[_0x68a2('0x35')],_0x15417d['filters']),_0x29ce0f);if(_0x316768[_0x68a2('0x35')][_0x68a2('0x3f')]){_0x12de69[_0x68a2('0x3d')]=_[_0x68a2('0x40')](_0x12de69['where'],{'$or':_[_0x68a2('0x33')](_0x29ce0f,function(_0x40d052){if(_0x40d052[_0x68a2('0x30')]!==_0x68a2('0x41')){var _0x144e6a={};_0x144e6a[_0x40d052[_0x68a2('0x2b')]]={'$like':'%'+_0x316768['query'][_0x68a2('0x3f')]+'%'};return _0x144e6a;}})});}_0x12de69=_[_0x68a2('0x40')]({},_0x12de69,_0x316768[_0x68a2('0x42')]);var _0x8c61b8={'where':_0x12de69[_0x68a2('0x3d')]};return db[_0x68a2('0x2d')][_0x68a2('0x1d')](_0x8c61b8)[_0x68a2('0x25')](function(_0xe5db86){_0x238907[_0x68a2('0x1d')]=_0xe5db86;if(_0x316768[_0x68a2('0x35')][_0x68a2('0x43')]){_0x12de69[_0x68a2('0x44')]=[{'all':!![]}];}return db[_0x68a2('0x2d')]['findAll'](_0x12de69);})[_0x68a2('0x25')](function(_0x22f0b7){_0x238907[_0x68a2('0x45')]=_0x22f0b7;return _0x238907;})[_0x68a2('0x25')](respondWithFilteredResult(_0x545b3a,_0x12de69))[_0x68a2('0x46')](handleError(_0x545b3a,null));};exports['show']=function(_0x391dec,_0x295ddd){var _0x124d36={'raw':![],'where':{'id':_0x391dec[_0x68a2('0x47')]['id']}},_0x2877be={};_0x2877be[_0x68a2('0x32')]=_[_0x68a2('0x34')](db['Team'][_0x68a2('0x2e')]);_0x2877be['query']=_[_0x68a2('0x34')](_0x391dec[_0x68a2('0x35')]);_0x2877be[_0x68a2('0x36')]=_[_0x68a2('0x37')](_0x2877be[_0x68a2('0x32')],_0x2877be[_0x68a2('0x35')]);_0x124d36[_0x68a2('0x38')]=_[_0x68a2('0x37')](_0x2877be['model'],qs[_0x68a2('0x39')](_0x391dec[_0x68a2('0x35')]['fields']));_0x124d36[_0x68a2('0x38')]=_0x124d36[_0x68a2('0x38')][_0x68a2('0x48')]?_0x124d36[_0x68a2('0x38')]:_0x2877be[_0x68a2('0x32')];if(_0x391dec[_0x68a2('0x35')]['includeAll']){_0x124d36[_0x68a2('0x44')]=[{'all':!![]}];}_0x124d36=_[_0x68a2('0x40')]({},_0x124d36,_0x391dec[_0x68a2('0x42')]);return db[_0x68a2('0x2d')][_0x68a2('0x49')](_0x124d36)[_0x68a2('0x25')](handleEntityNotFound(_0x295ddd,null))[_0x68a2('0x25')](respondWithResult(_0x295ddd,null))[_0x68a2('0x46')](handleError(_0x295ddd,null));};exports[_0x68a2('0x4a')]=function(_0x3bf29c,_0x4c7762){return db[_0x68a2('0x2d')][_0x68a2('0x4a')](_0x3bf29c[_0x68a2('0x4b')],{})[_0x68a2('0x25')](function(_0x596009){var _0x340ce0=_0x3bf29c[_0x68a2('0x4c')][_0x68a2('0x27')]({'plain':!![]});if(!_0x340ce0)throw new Error(_0x68a2('0x4d'));if(_0x340ce0[_0x68a2('0x4e')]==='user'){var _0x2b7709=_0x596009['get']({'plain':!![]});var _0x41de3f=_0x68a2('0x28');return db[_0x68a2('0x4f')][_0x68a2('0x49')]({'where':{'name':_0x41de3f,'userProfileId':_0x340ce0[_0x68a2('0x50')]},'raw':!![]})['then'](function(_0x445eea){if(_0x445eea&&_0x445eea['autoAssociation']===0x0){return db[_0x68a2('0x51')]['create']({'name':_0x2b7709[_0x68a2('0x2b')],'resourceId':_0x2b7709['id'],'type':_0x445eea[_0x68a2('0x2b')],'sectionId':_0x445eea['id']},{})[_0x68a2('0x25')](function(){return _0x596009;});}else{return _0x596009;}})[_0x68a2('0x46')](function(_0x38f770){logger[_0x68a2('0x52')](_0x68a2('0x53'),_0x38f770);throw _0x38f770;});}return _0x596009;})[_0x68a2('0x25')](respondWithResult(_0x4c7762,0xc9))[_0x68a2('0x46')](handleError(_0x4c7762,null));};exports[_0x68a2('0x24')]=function(_0x2dc1fc,_0x39093b){if(_0x2dc1fc[_0x68a2('0x4b')]['id']){delete _0x2dc1fc[_0x68a2('0x4b')]['id'];}return db[_0x68a2('0x2d')]['find']({'where':{'id':_0x2dc1fc[_0x68a2('0x47')]['id']}})['then'](handleEntityNotFound(_0x39093b,null))[_0x68a2('0x25')](saveUpdates(_0x2dc1fc[_0x68a2('0x4b')],null))[_0x68a2('0x25')](respondWithResult(_0x39093b,null))[_0x68a2('0x46')](handleError(_0x39093b,null));};exports[_0x68a2('0x26')]=function(_0x49d021,_0x109cab){return db[_0x68a2('0x2d')]['find']({'where':{'id':_0x49d021['params']['id']}})[_0x68a2('0x25')](handleEntityNotFound(_0x109cab,null))[_0x68a2('0x25')](removeEntity(_0x109cab,null))[_0x68a2('0x46')](handleError(_0x109cab,null));};exports[_0x68a2('0x54')]=function(_0x4126fd,_0x115426,_0x110bed){return db[_0x68a2('0x2d')][_0x68a2('0x55')]({'where':{'id':_0x4126fd['params']['id']}})['then'](handleEntityNotFound(_0x115426,null))[_0x68a2('0x25')](function(_0x3bd2e8){if(!_0x4126fd[_0x68a2('0x35')][_0x68a2('0x56')]||!utils[_0x68a2('0x57')](_0x4126fd['query'][_0x68a2('0x56')])){throw new db[(_0x68a2('0x58'))][(_0x68a2('0x59'))](_0x68a2('0x5a'));}var _0x20980a={};var _0x28de51={};_0x28de51[_0x68a2('0x32')]=_['keys'](db[_[_0x68a2('0x5b')](_0x4126fd['query'][_0x68a2('0x56')][_0x68a2('0x5c')]())+_0x68a2('0x5d')]['rawAttributes']);_0x28de51[_0x68a2('0x35')]=_[_0x68a2('0x34')](_0x4126fd['query']);_0x28de51[_0x68a2('0x36')]=_['intersection'](_0x28de51[_0x68a2('0x32')],_0x28de51[_0x68a2('0x35')]);_0x20980a[_0x68a2('0x38')]=_[_0x68a2('0x37')](_0x28de51[_0x68a2('0x32')],qs[_0x68a2('0x39')](_0x4126fd[_0x68a2('0x35')]['fields']));_0x20980a[_0x68a2('0x38')]=_0x20980a[_0x68a2('0x38')][_0x68a2('0x48')]?_0x20980a['attributes']:_0x28de51[_0x68a2('0x32')];_0x20980a['limit']=qs['limit'](_0x4126fd['query'][_0x68a2('0x1f')]);_0x20980a[_0x68a2('0x1e')]=qs[_0x68a2('0x1e')](_0x4126fd[_0x68a2('0x35')]['offset']);_0x20980a['order']=qs[_0x68a2('0x3c')](_0x4126fd[_0x68a2('0x35')][_0x68a2('0x3c')]);_0x20980a[_0x68a2('0x3d')]=qs[_0x68a2('0x36')](_[_0x68a2('0x3e')](_0x4126fd['query'],_0x28de51['filters']));_0x20980a=_[_0x68a2('0x40')]({},_0x20980a,_0x4126fd[_0x68a2('0x42')]);return _0x3bd2e8[_0x68a2('0x27')+_[_0x68a2('0x5b')](_0x4126fd[_0x68a2('0x35')][_0x68a2('0x56')][_0x68a2('0x5c')]())+_0x68a2('0x5e')](_0x20980a);})[_0x68a2('0x25')](respondWithResult(_0x115426,null))[_0x68a2('0x46')](handleError(_0x115426,null));};exports[_0x68a2('0x5f')]=function(_0x5741df,_0x496b5d,_0x510d85){return db[_0x68a2('0x2d')][_0x68a2('0x55')]({'where':{'id':_0x5741df[_0x68a2('0x47')]['id']}})[_0x68a2('0x25')](function(_0x2ce664){if(_0x2ce664){if(!_0x5741df['body'][_0x68a2('0x56')]||!utils[_0x68a2('0x57')](_0x5741df[_0x68a2('0x4b')][_0x68a2('0x56')])){throw new db[(_0x68a2('0x58'))][(_0x68a2('0x59'))](_0x68a2('0x5a'));}return _0x2ce664[_0x68a2('0x60')+_['capitalize'](_0x5741df[_0x68a2('0x4b')]['channel'][_0x68a2('0x5c')]())+_0x68a2('0x5e')](_0x5741df[_0x68a2('0x4b')][_0x68a2('0x61')]);}return null;})[_0x68a2('0x25')](handleEntityNotFound(_0x496b5d,null))['then'](respondWithStatusCode(_0x496b5d,null))['catch'](handleError(_0x496b5d,null));};exports[_0x68a2('0x62')]=function(_0x2c088f,_0x5be587,_0x442e13){return db[_0x68a2('0x2d')]['findOne']({'where':{'id':_0x2c088f[_0x68a2('0x47')]['id']}})[_0x68a2('0x25')](function(_0x162b7c){if(_0x162b7c){if(!_0x2c088f['query'][_0x68a2('0x56')]||!utils[_0x68a2('0x57')](_0x2c088f[_0x68a2('0x35')]['channel'])){throw new db['Sequelize'][(_0x68a2('0x59'))](_0x68a2('0x5a'));}return _0x162b7c[_0x68a2('0x63')+_['capitalize'](_0x2c088f['query'][_0x68a2('0x56')][_0x68a2('0x5c')]())+_0x68a2('0x5e')](_0x2c088f[_0x68a2('0x35')][_0x68a2('0x61')]);}return null;})['then'](handleEntityNotFound(_0x5be587,null))[_0x68a2('0x25')](respondWithStatusCode(_0x5be587,null))[_0x68a2('0x46')](handleError(_0x5be587,null));};exports[_0x68a2('0x64')]=function(_0x1222b7,_0x3cad04,_0x4c15e9){return db[_0x68a2('0x2d')]['find']({'where':{'id':_0x1222b7['params']['id']}})[_0x68a2('0x25')](handleEntityNotFound(_0x3cad04,null))['then'](function(_0x1d7b4f){if(_0x1d7b4f){var _0x33dcef=[_0x68a2('0x65'),_0x68a2('0x66'),_0x68a2('0x67'),_0x68a2('0x68'),_0x68a2('0x69'),_0x68a2('0x6a'),'Whatsapp'];return BPromise[_0x68a2('0x6b')](_0x33dcef,function(_0x2ebb8c){return _0x1d7b4f['get'+_0x2ebb8c+_0x68a2('0x5e')]({'attributes':['id',_0x68a2('0x2b')]})[_0x68a2('0x25')](function(_0x26db48){return BPromise[_0x68a2('0x6b')](_0x26db48,function(_0x1185d5){return _0x1185d5['addAgents'](_0x1222b7['body']['ids'])[_0x68a2('0x25')](function(){if(_0x2ebb8c===_0x68a2('0x65')){return db[_0x68a2('0x6c')][_0x68a2('0x6d')]({'where':{'id':_0x1222b7[_0x68a2('0x4b')][_0x68a2('0x61')]},'attributes':['id',_0x68a2('0x2b'),_0x68a2('0x6e'),'voicePause',_0x68a2('0x6f')],'raw':!![]})['then'](function(_0x2eeafc){return BPromise[_0x68a2('0x6b')](_[_0x68a2('0x3f')](_0x2eeafc,{'online':0x1}),function(_0x4d6557){return db[_0x68a2('0x70')]['upsert']({'membername':_0x4d6557['name'],'UserId':_0x4d6557['id'],'queue_name':_0x1185d5[_0x68a2('0x2b')],'VoiceQueueId':_0x1185d5['id'],'interface':_['isNil'](_0x4d6557['interface'])?util[_0x68a2('0x71')](_0x68a2('0x72'),_0x4d6557[_0x68a2('0x2b')]):_0x4d6557[_0x68a2('0x6f')],'paused':_0x4d6557[_0x68a2('0x73')]||![],'penalty':0x0});});});}});});})[_0x68a2('0x25')](function(){return _0x1d7b4f;});})[_0x68a2('0x25')](function(){return _0x1d7b4f;});}})[_0x68a2('0x25')](function(_0x473374){if(_0x473374){return _0x473374[_0x68a2('0x64')](_0x1222b7[_0x68a2('0x4b')]['ids'],_['omit'](_0x1222b7[_0x68a2('0x4b')],[_0x68a2('0x61'),'id'])||{})['spread'](function(_0x1a3618){for(var _0x25fabc=0x0;_0x25fabc<_0x1222b7['body'][_0x68a2('0x61')]['length'];_0x25fabc+=0x1){socket[_0x68a2('0x74')]('userTeam:save',{'UserId':_0x1222b7[_0x68a2('0x4b')]['ids'][_0x25fabc],'TeamId':_0x1222b7[_0x68a2('0x47')]['id']});}return _0x1a3618;});}})[_0x68a2('0x25')](respondWithResult(_0x3cad04,null))[_0x68a2('0x46')](handleError(_0x3cad04,null));};exports[_0x68a2('0x75')]=function(_0x41414d,_0x3dccac,_0x2c58f1){return db[_0x68a2('0x2d')][_0x68a2('0x49')]({'where':{'id':_0x41414d[_0x68a2('0x47')]['id']}})[_0x68a2('0x25')](handleEntityNotFound(_0x3dccac,null))['then'](function(_0x156c8f){if(_0x156c8f){return BPromise[_0x68a2('0x6b')](['voice',_0x68a2('0x76'),'mail',_0x68a2('0x77'),_0x68a2('0x78'),_0x68a2('0x79'),_0x68a2('0x7a')],function(_0x40109b){return _0x156c8f['get'+_[_0x68a2('0x5b')](_0x40109b)+_0x68a2('0x5e')]({'attributes':['id',_0x68a2('0x2b')]})[_0x68a2('0x25')](function(_0x2a25af){return BPromise[_0x68a2('0x6b')](_0x2a25af,function(_0x15a0b3){return _0x15a0b3[_0x68a2('0x75')](_0x41414d['query'][_0x68a2('0x61')])[_0x68a2('0x25')](function(){if(_0x40109b==='voice'){return db[_0x68a2('0x70')][_0x68a2('0x26')]({'where':{'VoiceQueueId':_0x15a0b3['id'],'UserId':_0x41414d['query'][_0x68a2('0x61')]}});}});});})[_0x68a2('0x25')](function(){return _0x156c8f;});})[_0x68a2('0x25')](function(){return _0x156c8f;});}})[_0x68a2('0x25')](function(_0x401866){if(_0x401866){return _0x401866['removeAgents'](_0x41414d[_0x68a2('0x35')][_0x68a2('0x61')])[_0x68a2('0x25')](function(){if(_['isArray'](_0x41414d[_0x68a2('0x35')][_0x68a2('0x61')])){for(var _0x4546fb=0x0;_0x4546fb<_0x41414d[_0x68a2('0x35')][_0x68a2('0x61')][_0x68a2('0x48')];_0x4546fb+=0x1){socket[_0x68a2('0x74')](_0x68a2('0x7b'),{'UserId':Number(_0x41414d[_0x68a2('0x35')][_0x68a2('0x61')][_0x4546fb]),'TeamId':Number(_0x41414d['params']['id'])});}}else{socket[_0x68a2('0x74')](_0x68a2('0x7b'),{'UserId':Number(_0x41414d['query'][_0x68a2('0x61')]),'TeamId':Number(_0x41414d[_0x68a2('0x47')]['id'])});}});}})[_0x68a2('0x25')](respondWithStatusCode(_0x3dccac,null))[_0x68a2('0x46')](handleError(_0x3dccac,null));};exports[_0x68a2('0x7c')]=function(_0xfb3219,_0x1ff2ef,_0x4b1994){var _0x285786={};var _0x5b493b={};var _0x3b4f60;var _0x1d6d53;return db[_0x68a2('0x2d')][_0x68a2('0x55')]({'where':{'id':_0xfb3219[_0x68a2('0x47')]['id']}})[_0x68a2('0x25')](handleEntityNotFound(_0x1ff2ef,null))['then'](function(_0xa3a913){if(_0xa3a913){_0x3b4f60=_0xa3a913;_0x5b493b['model']=_[_0x68a2('0x34')](db['User'][_0x68a2('0x2e')]);_0x5b493b['query']=_[_0x68a2('0x34')](_0xfb3219['query']);_0x5b493b[_0x68a2('0x36')]=_['intersection'](_0x5b493b[_0x68a2('0x32')],_0x5b493b['query']);_0x285786[_0x68a2('0x38')]=_[_0x68a2('0x37')](_0x5b493b['model'],qs[_0x68a2('0x39')](_0xfb3219[_0x68a2('0x35')][_0x68a2('0x39')]));_0x285786['attributes']=_0x285786[_0x68a2('0x38')][_0x68a2('0x48')]?_0x285786['attributes']:_0x5b493b[_0x68a2('0x32')];_0x285786['order']=qs['sort'](_0xfb3219['query']['sort']);_0x285786[_0x68a2('0x3d')]=qs[_0x68a2('0x36')](_[_0x68a2('0x3e')](_0xfb3219[_0x68a2('0x35')],_0x5b493b[_0x68a2('0x36')]));if(_0xfb3219[_0x68a2('0x35')][_0x68a2('0x3f')]){_0x285786[_0x68a2('0x3d')]=_[_0x68a2('0x40')](_0x285786[_0x68a2('0x3d')],{'$or':_['map'](_0x285786[_0x68a2('0x38')],function(_0x3ebdf2){var _0x254d52={};_0x254d52[_0x3ebdf2]={'$like':'%'+_0xfb3219[_0x68a2('0x35')][_0x68a2('0x3f')]+'%'};return _0x254d52;})});}_0x285786=_[_0x68a2('0x40')]({},_0x285786,_0xfb3219[_0x68a2('0x42')]);return _0x3b4f60[_0x68a2('0x7c')](_0x285786);}})['then'](function(_0x3ef5df){if(_0x3ef5df){_0x1d6d53=_0x3ef5df[_0x68a2('0x48')];if(!_0xfb3219['query'][_0x68a2('0x3a')](_0x68a2('0x7d'))){_0x285786[_0x68a2('0x1f')]=qs[_0x68a2('0x1f')](_0xfb3219['query'][_0x68a2('0x1f')]);_0x285786[_0x68a2('0x1e')]=qs[_0x68a2('0x1e')](_0xfb3219[_0x68a2('0x35')][_0x68a2('0x1e')]);}return _0x3b4f60[_0x68a2('0x7c')](_0x285786);}})[_0x68a2('0x25')](function(_0x5912cc){if(_0x5912cc){return _0x5912cc?{'count':_0x1d6d53,'rows':_0x5912cc}:null;}})['then'](respondWithResult(_0x1ff2ef,null))['catch'](handleError(_0x1ff2ef,null));}; \ No newline at end of file +var _0xe300=['Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','channel','Queues','remove','ids','addAgents','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','spread','emit','userTeam:save','voice','chat','mail','openchannel','whatsapp','removeAgents','isArray','userTeam:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','count','offset','limit','json','apply','reject','save','update','then','destroy','Teams','UserProfileResource','error','stack','name','send','map','Team','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','length','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','findOne','isValidChannel'];(function(_0x997ede,_0x5a0814){var _0x1f3288=function(_0x5ddd2a){while(--_0x5ddd2a){_0x997ede['push'](_0x997ede['shift']());}};_0x1f3288(++_0x5a0814);}(_0xe300,0xa4));var _0x0e30=function(_0x3fa6fb,_0x454bf3){_0x3fa6fb=_0x3fa6fb-0x0;var _0x21c1f7=_0xe300[_0x3fa6fb];return _0x21c1f7;};'use strict';var pdf=require(_0x0e30('0x0'));var emlformat=require(_0x0e30('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0e30('0x2'));var jsonpatch=require(_0x0e30('0x3'));var rp=require(_0x0e30('0x4'));var moment=require(_0x0e30('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0e30('0x6'));var util=require(_0x0e30('0x7'));var path=require(_0x0e30('0x8'));var sox=require(_0x0e30('0x9'));var csv=require(_0x0e30('0xa'));var ejs=require(_0x0e30('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0e30('0xc'));var crypto=require(_0x0e30('0xd'));var jsforce=require(_0x0e30('0xe'));var deskjs=require(_0x0e30('0xf'));var toCsv=require(_0x0e30('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e30('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0e30('0x11'));var hardwareService=require(_0x0e30('0x12'));var logger=require(_0x0e30('0x13'))(_0x0e30('0x14'));var utils=require(_0x0e30('0x15'));var config=require('../../config/environment');var db=require(_0x0e30('0x16'))['db'];config['redis']=_[_0x0e30('0x17')](config[_0x0e30('0x18')],{'host':_0x0e30('0x19'),'port':0x18eb});var socket=require(_0x0e30('0x1a'))(new Redis(config[_0x0e30('0x18')]));require('./team.socket')[_0x0e30('0x1b')](socket);function respondWithStatusCode(_0x55015d,_0x57edd9){_0x57edd9=_0x57edd9||0xcc;return function(_0x107312){if(_0x107312){return _0x55015d[_0x0e30('0x1c')](_0x57edd9);}return _0x55015d[_0x0e30('0x1d')](_0x57edd9)['end']();};}function respondWithResult(_0x4275a6,_0x4547ac){_0x4547ac=_0x4547ac||0xc8;return function(_0x3e947e){if(_0x3e947e){return _0x4275a6['status'](_0x4547ac)['json'](_0x3e947e);}};}function respondWithFilteredResult(_0x672b43,_0x1bf481){return function(_0x12a884){if(_0x12a884){var _0xc69d42=_0x12a884[_0x0e30('0x1e')],_0x2e492a=_0x1bf481[_0x0e30('0x1f')],_0xb55500=_0x1bf481[_0x0e30('0x1f')]+_0x1bf481[_0x0e30('0x20')],_0x4ef460;if(_0xb55500>=_0xc69d42){_0xb55500=_0xc69d42;_0x4ef460=0xc8;}else{_0x4ef460=0xce;}_0x672b43[_0x0e30('0x1d')](_0x4ef460);return _0x672b43['set']('Content-Range',_0x2e492a+'-'+_0xb55500+'/'+_0xc69d42)[_0x0e30('0x21')](_0x12a884);}return null;};}function patchUpdates(_0x2d16e9){return function(_0x508238){try{jsonpatch[_0x0e30('0x22')](_0x508238,_0x2d16e9,!![]);}catch(_0x92d14b){return BPromise[_0x0e30('0x23')](_0x92d14b);}return _0x508238[_0x0e30('0x24')]();};}function saveUpdates(_0xe3fce8,_0x2b1c71){return function(_0x4b8b65){if(_0x4b8b65){return _0x4b8b65[_0x0e30('0x25')](_0xe3fce8)[_0x0e30('0x26')](function(_0x1ba420){return _0x1ba420;});}return null;};}function removeEntity(_0x965569,_0x29f590){return function(_0x338acd){if(_0x338acd){return _0x338acd[_0x0e30('0x27')]()['then'](function(){var _0x18bc0b=_0x338acd['get']({'plain':!![]});var _0x39eca4=_0x0e30('0x28');return db[_0x0e30('0x29')][_0x0e30('0x27')]({'where':{'type':_0x39eca4,'resourceId':_0x18bc0b['id']}})[_0x0e30('0x26')](function(){return _0x338acd;});})[_0x0e30('0x26')](function(){_0x965569[_0x0e30('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4890ef,_0x5745aa){return function(_0x7d17e3){if(!_0x7d17e3){_0x4890ef[_0x0e30('0x1c')](0x194);}return _0x7d17e3;};}function handleError(_0x4e5017,_0x2e059a){_0x2e059a=_0x2e059a||0x1f4;return function(_0x3a5a68){logger[_0x0e30('0x2a')](_0x3a5a68[_0x0e30('0x2b')]);if(_0x3a5a68[_0x0e30('0x2c')]){delete _0x3a5a68['name'];}_0x4e5017[_0x0e30('0x1d')](_0x2e059a)[_0x0e30('0x2d')](_0x3a5a68);};}exports['index']=function(_0x5c0d09,_0x51b37b){var _0x42d8e5={},_0x57c3a0={},_0x17a185={'count':0x0,'rows':[]};var _0x592f89=_[_0x0e30('0x2e')](db[_0x0e30('0x2f')][_0x0e30('0x30')],function(_0x2b457d){return{'name':_0x2b457d[_0x0e30('0x31')],'type':_0x2b457d[_0x0e30('0x32')]['key']};});_0x57c3a0[_0x0e30('0x33')]=_[_0x0e30('0x2e')](_0x592f89,'name');_0x57c3a0[_0x0e30('0x34')]=_[_0x0e30('0x35')](_0x5c0d09[_0x0e30('0x34')]);_0x57c3a0[_0x0e30('0x36')]=_[_0x0e30('0x37')](_0x57c3a0[_0x0e30('0x33')],_0x57c3a0['query']);_0x42d8e5[_0x0e30('0x38')]=_[_0x0e30('0x37')](_0x57c3a0[_0x0e30('0x33')],qs[_0x0e30('0x39')](_0x5c0d09['query']['fields']));_0x42d8e5['attributes']=_0x42d8e5[_0x0e30('0x38')]['length']?_0x42d8e5[_0x0e30('0x38')]:_0x57c3a0['model'];if(!_0x5c0d09['query'][_0x0e30('0x3a')](_0x0e30('0x3b'))){_0x42d8e5[_0x0e30('0x20')]=qs['limit'](_0x5c0d09[_0x0e30('0x34')]['limit']);_0x42d8e5[_0x0e30('0x1f')]=qs[_0x0e30('0x1f')](_0x5c0d09[_0x0e30('0x34')][_0x0e30('0x1f')]);}_0x42d8e5['order']=qs[_0x0e30('0x3c')](_0x5c0d09[_0x0e30('0x34')][_0x0e30('0x3c')]);_0x42d8e5['where']=qs[_0x0e30('0x36')](_[_0x0e30('0x3d')](_0x5c0d09[_0x0e30('0x34')],_0x57c3a0[_0x0e30('0x36')]),_0x592f89);if(_0x5c0d09[_0x0e30('0x34')][_0x0e30('0x3e')]){_0x42d8e5[_0x0e30('0x3f')]=_[_0x0e30('0x40')](_0x42d8e5[_0x0e30('0x3f')],{'$or':_['map'](_0x592f89,function(_0x5425dd){if(_0x5425dd[_0x0e30('0x32')]!==_0x0e30('0x41')){var _0x4569bf={};_0x4569bf[_0x5425dd['name']]={'$like':'%'+_0x5c0d09['query'][_0x0e30('0x3e')]+'%'};return _0x4569bf;}})});}_0x42d8e5=_[_0x0e30('0x40')]({},_0x42d8e5,_0x5c0d09[_0x0e30('0x42')]);var _0x50c4fb={'where':_0x42d8e5[_0x0e30('0x3f')]};return db[_0x0e30('0x2f')][_0x0e30('0x1e')](_0x50c4fb)[_0x0e30('0x26')](function(_0x3179fb){_0x17a185[_0x0e30('0x1e')]=_0x3179fb;if(_0x5c0d09['query'][_0x0e30('0x43')]){_0x42d8e5[_0x0e30('0x44')]=[{'all':!![]}];}return db['Team']['findAll'](_0x42d8e5);})['then'](function(_0x5d7844){_0x17a185[_0x0e30('0x45')]=_0x5d7844;return _0x17a185;})[_0x0e30('0x26')](respondWithFilteredResult(_0x51b37b,_0x42d8e5))[_0x0e30('0x46')](handleError(_0x51b37b,null));};exports[_0x0e30('0x47')]=function(_0x56b108,_0x5455fd){var _0x12ef5b={'raw':![],'where':{'id':_0x56b108['params']['id']}},_0x5e57d5={};_0x5e57d5[_0x0e30('0x33')]=_[_0x0e30('0x35')](db[_0x0e30('0x2f')][_0x0e30('0x30')]);_0x5e57d5[_0x0e30('0x34')]=_[_0x0e30('0x35')](_0x56b108[_0x0e30('0x34')]);_0x5e57d5['filters']=_['intersection'](_0x5e57d5['model'],_0x5e57d5[_0x0e30('0x34')]);_0x12ef5b[_0x0e30('0x38')]=_[_0x0e30('0x37')](_0x5e57d5[_0x0e30('0x33')],qs[_0x0e30('0x39')](_0x56b108[_0x0e30('0x34')][_0x0e30('0x39')]));_0x12ef5b[_0x0e30('0x38')]=_0x12ef5b[_0x0e30('0x38')][_0x0e30('0x48')]?_0x12ef5b['attributes']:_0x5e57d5[_0x0e30('0x33')];if(_0x56b108[_0x0e30('0x34')]['includeAll']){_0x12ef5b[_0x0e30('0x44')]=[{'all':!![]}];}_0x12ef5b=_[_0x0e30('0x40')]({},_0x12ef5b,_0x56b108[_0x0e30('0x42')]);return db['Team'][_0x0e30('0x49')](_0x12ef5b)[_0x0e30('0x26')](handleEntityNotFound(_0x5455fd,null))['then'](respondWithResult(_0x5455fd,null))[_0x0e30('0x46')](handleError(_0x5455fd,null));};exports[_0x0e30('0x4a')]=function(_0x2976c8,_0x1b2bf1){return db[_0x0e30('0x2f')][_0x0e30('0x4a')](_0x2976c8[_0x0e30('0x4b')],{})[_0x0e30('0x26')](function(_0x179406){var _0x59df50=_0x2976c8[_0x0e30('0x4c')][_0x0e30('0x4d')]({'plain':!![]});if(!_0x59df50)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59df50['role']==='user'){var _0x3978c0=_0x179406[_0x0e30('0x4d')]({'plain':!![]});var _0x2356d1='Teams';return db[_0x0e30('0x4e')]['find']({'where':{'name':_0x2356d1,'userProfileId':_0x59df50[_0x0e30('0x4f')]},'raw':!![]})[_0x0e30('0x26')](function(_0x1afd18){if(_0x1afd18&&_0x1afd18[_0x0e30('0x50')]===0x0){return db[_0x0e30('0x29')][_0x0e30('0x4a')]({'name':_0x3978c0[_0x0e30('0x2c')],'resourceId':_0x3978c0['id'],'type':_0x1afd18[_0x0e30('0x2c')],'sectionId':_0x1afd18['id']},{})[_0x0e30('0x26')](function(){return _0x179406;});}else{return _0x179406;}})[_0x0e30('0x46')](function(_0x2de8dc){logger[_0x0e30('0x2a')](_0x0e30('0x51'),_0x2de8dc);throw _0x2de8dc;});}return _0x179406;})[_0x0e30('0x26')](respondWithResult(_0x1b2bf1,0xc9))[_0x0e30('0x46')](handleError(_0x1b2bf1,null));};exports[_0x0e30('0x25')]=function(_0x2094f0,_0x21134a){if(_0x2094f0['body']['id']){delete _0x2094f0['body']['id'];}return db['Team']['find']({'where':{'id':_0x2094f0[_0x0e30('0x52')]['id']}})[_0x0e30('0x26')](handleEntityNotFound(_0x21134a,null))[_0x0e30('0x26')](saveUpdates(_0x2094f0[_0x0e30('0x4b')],null))['then'](respondWithResult(_0x21134a,null))[_0x0e30('0x46')](handleError(_0x21134a,null));};exports[_0x0e30('0x27')]=function(_0x4837db,_0x39d313){return db[_0x0e30('0x2f')][_0x0e30('0x49')]({'where':{'id':_0x4837db[_0x0e30('0x52')]['id']}})[_0x0e30('0x26')](handleEntityNotFound(_0x39d313,null))[_0x0e30('0x26')](removeEntity(_0x39d313,null))['catch'](handleError(_0x39d313,null));};exports[_0x0e30('0x53')]=function(_0x311974,_0x7a0a12,_0x2a05f5){return db[_0x0e30('0x2f')][_0x0e30('0x54')]({'where':{'id':_0x311974['params']['id']}})[_0x0e30('0x26')](handleEntityNotFound(_0x7a0a12,null))[_0x0e30('0x26')](function(_0x5be07d){if(!_0x311974[_0x0e30('0x34')]['channel']||!utils[_0x0e30('0x55')](_0x311974[_0x0e30('0x34')]['channel'])){throw new db[(_0x0e30('0x56'))][(_0x0e30('0x57'))](_0x0e30('0x58'));}var _0x212ac2={};var _0x9aeb46={};_0x9aeb46['model']=_[_0x0e30('0x35')](db[_[_0x0e30('0x59')](_0x311974[_0x0e30('0x34')]['channel'][_0x0e30('0x5a')]())+_0x0e30('0x5b')][_0x0e30('0x30')]);_0x9aeb46[_0x0e30('0x34')]=_[_0x0e30('0x35')](_0x311974[_0x0e30('0x34')]);_0x9aeb46[_0x0e30('0x36')]=_['intersection'](_0x9aeb46[_0x0e30('0x33')],_0x9aeb46[_0x0e30('0x34')]);_0x212ac2[_0x0e30('0x38')]=_[_0x0e30('0x37')](_0x9aeb46[_0x0e30('0x33')],qs[_0x0e30('0x39')](_0x311974[_0x0e30('0x34')][_0x0e30('0x39')]));_0x212ac2[_0x0e30('0x38')]=_0x212ac2[_0x0e30('0x38')][_0x0e30('0x48')]?_0x212ac2[_0x0e30('0x38')]:_0x9aeb46[_0x0e30('0x33')];_0x212ac2[_0x0e30('0x20')]=qs[_0x0e30('0x20')](_0x311974[_0x0e30('0x34')][_0x0e30('0x20')]);_0x212ac2[_0x0e30('0x1f')]=qs[_0x0e30('0x1f')](_0x311974[_0x0e30('0x34')][_0x0e30('0x1f')]);_0x212ac2[_0x0e30('0x5c')]=qs['sort'](_0x311974[_0x0e30('0x34')][_0x0e30('0x3c')]);_0x212ac2['where']=qs[_0x0e30('0x36')](_[_0x0e30('0x3d')](_0x311974[_0x0e30('0x34')],_0x9aeb46[_0x0e30('0x36')]));_0x212ac2=_['merge']({},_0x212ac2,_0x311974['options']);return _0x5be07d[_0x0e30('0x4d')+_[_0x0e30('0x59')](_0x311974[_0x0e30('0x34')][_0x0e30('0x5d')][_0x0e30('0x5a')]())+_0x0e30('0x5e')](_0x212ac2);})[_0x0e30('0x26')](respondWithResult(_0x7a0a12,null))[_0x0e30('0x46')](handleError(_0x7a0a12,null));};exports['addQueues']=function(_0x52cb62,_0x397543,_0x40ffe8){return db[_0x0e30('0x2f')]['findOne']({'where':{'id':_0x52cb62[_0x0e30('0x52')]['id']}})['then'](function(_0x2b9e5a){if(_0x2b9e5a){if(!_0x52cb62['body'][_0x0e30('0x5d')]||!utils[_0x0e30('0x55')](_0x52cb62[_0x0e30('0x4b')][_0x0e30('0x5d')])){throw new db[(_0x0e30('0x56'))][(_0x0e30('0x57'))](_0x0e30('0x58'));}return _0x2b9e5a['add'+_[_0x0e30('0x59')](_0x52cb62['body']['channel'][_0x0e30('0x5a')]())+_0x0e30('0x5e')](_0x52cb62[_0x0e30('0x4b')]['ids']);}return null;})[_0x0e30('0x26')](handleEntityNotFound(_0x397543,null))[_0x0e30('0x26')](respondWithStatusCode(_0x397543,null))[_0x0e30('0x46')](handleError(_0x397543,null));};exports['removeQueues']=function(_0x642d9c,_0xdd6562,_0x3f7d22){return db['Team'][_0x0e30('0x54')]({'where':{'id':_0x642d9c[_0x0e30('0x52')]['id']}})[_0x0e30('0x26')](function(_0x58b410){if(_0x58b410){if(!_0x642d9c[_0x0e30('0x34')][_0x0e30('0x5d')]||!utils['isValidChannel'](_0x642d9c[_0x0e30('0x34')]['channel'])){throw new db['Sequelize'][(_0x0e30('0x57'))](_0x0e30('0x58'));}return _0x58b410[_0x0e30('0x5f')+_[_0x0e30('0x59')](_0x642d9c['query'][_0x0e30('0x5d')][_0x0e30('0x5a')]())+'Queues'](_0x642d9c[_0x0e30('0x34')][_0x0e30('0x60')]);}return null;})[_0x0e30('0x26')](handleEntityNotFound(_0xdd6562,null))[_0x0e30('0x26')](respondWithStatusCode(_0xdd6562,null))[_0x0e30('0x46')](handleError(_0xdd6562,null));};exports[_0x0e30('0x61')]=function(_0x473256,_0x4b0a0d,_0x190e60){return db[_0x0e30('0x2f')][_0x0e30('0x49')]({'where':{'id':_0x473256[_0x0e30('0x52')]['id']}})[_0x0e30('0x26')](handleEntityNotFound(_0x4b0a0d,null))[_0x0e30('0x26')](function(_0x391d31){if(_0x391d31){var _0x532b6=['Voice',_0x0e30('0x62'),_0x0e30('0x63'),_0x0e30('0x64'),_0x0e30('0x65'),_0x0e30('0x66'),_0x0e30('0x67')];return BPromise[_0x0e30('0x68')](_0x532b6,function(_0x1b56d8){return _0x391d31['get'+_0x1b56d8+_0x0e30('0x5e')]({'attributes':['id',_0x0e30('0x2c')]})[_0x0e30('0x26')](function(_0x471e72){return BPromise['each'](_0x471e72,function(_0x1a8e82){return _0x1a8e82[_0x0e30('0x61')](_0x473256['body'][_0x0e30('0x60')])[_0x0e30('0x26')](function(){if(_0x1b56d8==='Voice'){return db[_0x0e30('0x69')]['findAll']({'where':{'id':_0x473256[_0x0e30('0x4b')][_0x0e30('0x60')]},'attributes':['id',_0x0e30('0x2c'),_0x0e30('0x6a'),_0x0e30('0x6b'),_0x0e30('0x6c')],'raw':!![]})[_0x0e30('0x26')](function(_0x4d278c){return BPromise[_0x0e30('0x68')](_[_0x0e30('0x3e')](_0x4d278c,{'online':0x1}),function(_0x15085e){return db[_0x0e30('0x6d')][_0x0e30('0x6e')]({'membername':_0x15085e[_0x0e30('0x2c')],'UserId':_0x15085e['id'],'queue_name':_0x1a8e82[_0x0e30('0x2c')],'VoiceQueueId':_0x1a8e82['id'],'interface':_[_0x0e30('0x6f')](_0x15085e[_0x0e30('0x6c')])?util['format'](_0x0e30('0x70'),_0x15085e[_0x0e30('0x2c')]):_0x15085e[_0x0e30('0x6c')],'paused':_0x15085e[_0x0e30('0x6b')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x391d31;});})['then'](function(){return _0x391d31;});}})[_0x0e30('0x26')](function(_0x2f2ca8){if(_0x2f2ca8){return _0x2f2ca8[_0x0e30('0x61')](_0x473256[_0x0e30('0x4b')]['ids'],_['omit'](_0x473256[_0x0e30('0x4b')],['ids','id'])||{})[_0x0e30('0x71')](function(_0x370908){for(var _0x5bdfa0=0x0;_0x5bdfa0<_0x473256[_0x0e30('0x4b')][_0x0e30('0x60')][_0x0e30('0x48')];_0x5bdfa0+=0x1){socket[_0x0e30('0x72')](_0x0e30('0x73'),{'UserId':_0x473256[_0x0e30('0x4b')][_0x0e30('0x60')][_0x5bdfa0],'TeamId':_0x473256[_0x0e30('0x52')]['id']});}return _0x370908;});}})[_0x0e30('0x26')](respondWithResult(_0x4b0a0d,null))[_0x0e30('0x46')](handleError(_0x4b0a0d,null));};exports['removeAgents']=function(_0x50a46d,_0x5490d6,_0x32182c){return db['Team']['find']({'where':{'id':_0x50a46d[_0x0e30('0x52')]['id']}})[_0x0e30('0x26')](handleEntityNotFound(_0x5490d6,null))['then'](function(_0x5d303e){if(_0x5d303e){return BPromise[_0x0e30('0x68')]([_0x0e30('0x74'),_0x0e30('0x75'),_0x0e30('0x76'),'sms','fax',_0x0e30('0x77'),_0x0e30('0x78')],function(_0x1984dc){return _0x5d303e[_0x0e30('0x4d')+_['capitalize'](_0x1984dc)+_0x0e30('0x5e')]({'attributes':['id',_0x0e30('0x2c')]})['then'](function(_0x138bb3){return BPromise[_0x0e30('0x68')](_0x138bb3,function(_0x132009){return _0x132009[_0x0e30('0x79')](_0x50a46d['query']['ids'])[_0x0e30('0x26')](function(){if(_0x1984dc===_0x0e30('0x74')){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x132009['id'],'UserId':_0x50a46d[_0x0e30('0x34')]['ids']}});}});});})[_0x0e30('0x26')](function(){return _0x5d303e;});})[_0x0e30('0x26')](function(){return _0x5d303e;});}})[_0x0e30('0x26')](function(_0x380584){if(_0x380584){return _0x380584[_0x0e30('0x79')](_0x50a46d[_0x0e30('0x34')][_0x0e30('0x60')])[_0x0e30('0x26')](function(){if(_[_0x0e30('0x7a')](_0x50a46d[_0x0e30('0x34')][_0x0e30('0x60')])){for(var _0x536a6b=0x0;_0x536a6b<_0x50a46d['query'][_0x0e30('0x60')]['length'];_0x536a6b+=0x1){socket[_0x0e30('0x72')](_0x0e30('0x7b'),{'UserId':Number(_0x50a46d[_0x0e30('0x34')]['ids'][_0x536a6b]),'TeamId':Number(_0x50a46d[_0x0e30('0x52')]['id'])});}}else{socket[_0x0e30('0x72')](_0x0e30('0x7b'),{'UserId':Number(_0x50a46d[_0x0e30('0x34')][_0x0e30('0x60')]),'TeamId':Number(_0x50a46d[_0x0e30('0x52')]['id'])});}});}})[_0x0e30('0x26')](respondWithStatusCode(_0x5490d6,null))[_0x0e30('0x46')](handleError(_0x5490d6,null));};exports['getAgents']=function(_0x47fb13,_0x5cc523,_0x1cc060){var _0x5210c7={};var _0x49a45f={};var _0x209994;var _0x5edccf;return db['Team'][_0x0e30('0x54')]({'where':{'id':_0x47fb13['params']['id']}})['then'](handleEntityNotFound(_0x5cc523,null))[_0x0e30('0x26')](function(_0x24cedc){if(_0x24cedc){_0x209994=_0x24cedc;_0x49a45f[_0x0e30('0x33')]=_[_0x0e30('0x35')](db[_0x0e30('0x69')][_0x0e30('0x30')]);_0x49a45f[_0x0e30('0x34')]=_[_0x0e30('0x35')](_0x47fb13['query']);_0x49a45f[_0x0e30('0x36')]=_['intersection'](_0x49a45f[_0x0e30('0x33')],_0x49a45f['query']);_0x5210c7[_0x0e30('0x38')]=_[_0x0e30('0x37')](_0x49a45f[_0x0e30('0x33')],qs[_0x0e30('0x39')](_0x47fb13[_0x0e30('0x34')][_0x0e30('0x39')]));_0x5210c7[_0x0e30('0x38')]=_0x5210c7[_0x0e30('0x38')][_0x0e30('0x48')]?_0x5210c7[_0x0e30('0x38')]:_0x49a45f[_0x0e30('0x33')];_0x5210c7[_0x0e30('0x5c')]=qs[_0x0e30('0x3c')](_0x47fb13[_0x0e30('0x34')]['sort']);_0x5210c7[_0x0e30('0x3f')]=qs[_0x0e30('0x36')](_['pick'](_0x47fb13['query'],_0x49a45f['filters']));if(_0x47fb13['query']['filter']){_0x5210c7[_0x0e30('0x3f')]=_[_0x0e30('0x40')](_0x5210c7[_0x0e30('0x3f')],{'$or':_[_0x0e30('0x2e')](_0x5210c7[_0x0e30('0x38')],function(_0x6e51b){var _0x4dfdaf={};_0x4dfdaf[_0x6e51b]={'$like':'%'+_0x47fb13['query'][_0x0e30('0x3e')]+'%'};return _0x4dfdaf;})});}_0x5210c7=_[_0x0e30('0x40')]({},_0x5210c7,_0x47fb13[_0x0e30('0x42')]);return _0x209994[_0x0e30('0x7c')](_0x5210c7);}})['then'](function(_0x3cafb1){if(_0x3cafb1){_0x5edccf=_0x3cafb1['length'];if(!_0x47fb13['query'][_0x0e30('0x3a')](_0x0e30('0x3b'))){_0x5210c7[_0x0e30('0x20')]=qs[_0x0e30('0x20')](_0x47fb13[_0x0e30('0x34')][_0x0e30('0x20')]);_0x5210c7[_0x0e30('0x1f')]=qs['offset'](_0x47fb13[_0x0e30('0x34')][_0x0e30('0x1f')]);}return _0x209994[_0x0e30('0x7c')](_0x5210c7);}})[_0x0e30('0x26')](function(_0x576e2d){if(_0x576e2d){return _0x576e2d?{'count':_0x5edccf,'rows':_0x576e2d}:null;}})['then'](respondWithResult(_0x5cc523,null))[_0x0e30('0x46')](handleError(_0x5cc523,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b5019a4..498eb1e 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 _0x8341=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','Team'];(function(_0x2c6140,_0xb1faa){var _0x1c4132=function(_0x4466d7){while(--_0x4466d7){_0x2c6140['push'](_0x2c6140['shift']());}};_0x1c4132(++_0xb1faa);}(_0x8341,0x17d));var _0x1834=function(_0x318a88,_0x341283){_0x318a88=_0x318a88-0x0;var _0x3aa4fa=_0x8341[_0x318a88];return _0x3aa4fa;};'use strict';var EventEmitter=require(_0x1834('0x0'));var Team=require(_0x1834('0x1'))['db'][_0x1834('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1834('0x3'),'afterUpdate':_0x1834('0x4'),'afterDestroy':_0x1834('0x5')};function emitEvent(_0xd8a7ac){return function(_0x244d91,_0x4a5f02,_0x458857){TeamEvents[_0x1834('0x6')](_0xd8a7ac+':'+_0x244d91['id'],_0x244d91);TeamEvents['emit'](_0xd8a7ac,_0x244d91);_0x458857(null);};}for(var e in events){if(events[_0x1834('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xcad8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','save','remove'];(function(_0x5609e0,_0xfe857b){var _0x4ba16f=function(_0x21d470){while(--_0x21d470){_0x5609e0['push'](_0x5609e0['shift']());}};_0x4ba16f(++_0xfe857b);}(_0xcad8,0x136));var _0x8cad=function(_0x5a66ec,_0x573125){_0x5a66ec=_0x5a66ec-0x0;var _0x904869=_0xcad8[_0x5a66ec];return _0x904869;};'use strict';var EventEmitter=require(_0x8cad('0x0'));var Team=require(_0x8cad('0x1'))['db'][_0x8cad('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8cad('0x3'),'afterUpdate':'update','afterDestroy':_0x8cad('0x4')};function emitEvent(_0x4ee1a9){return function(_0x251396,_0x5ce68e,_0x3cb562){TeamEvents[_0x8cad('0x5')](_0x4ee1a9+':'+_0x251396['id'],_0x251396);TeamEvents['emit'](_0x4ee1a9,_0x251396);_0x3cb562(null);};}for(var e in events){if(events[_0x8cad('0x6')](e)){var event=events[e];Team[_0x8cad('0x7')](e,emitEvent(event));}}module[_0x8cad('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 73693da..bf2b251 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 _0x86b2=['lodash','../../config/logger','api','moment','rimraf','./team.attributes','exports','define','Team'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x86b2,0xe1));var _0x286b=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x86b2[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x286b('0x0'));var util=require('util');var logger=require(_0x286b('0x1'))(_0x286b('0x2'));var moment=require(_0x286b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x286b('0x4'));var config=require('../../config/environment');var attributes=require(_0x286b('0x5'));module[_0x286b('0x6')]=function(_0x22db66,_0x3f9b17){return _0x22db66[_0x286b('0x7')](_0x286b('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d84=['rimraf','../../config/environment','./team.attributes','exports','define','teams','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x323383,_0x17162f){var _0x2e307c=function(_0x5416fb){while(--_0x5416fb){_0x323383['push'](_0x323383['shift']());}};_0x2e307c(++_0x17162f);}(_0x3d84,0x11a));var _0x43d8=function(_0xf87466,_0x304e17){_0xf87466=_0xf87466-0x0;var _0x428795=_0x3d84[_0xf87466];return _0x428795;};'use strict';var _=require(_0x43d8('0x0'));var util=require(_0x43d8('0x1'));var logger=require(_0x43d8('0x2'))(_0x43d8('0x3'));var moment=require(_0x43d8('0x4'));var BPromise=require('bluebird');var rp=require(_0x43d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43d8('0x6'));var config=require(_0x43d8('0x7'));var attributes=require(_0x43d8('0x8'));module[_0x43d8('0x9')]=function(_0x3fc16b,_0x7a4c8e){return _0x3fc16b[_0x43d8('0xa')]('Team',attributes,{'tableName':_0x43d8('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 321dac0..9a6b8e7 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 _0x8d6e=['request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','./team.socket','register'];(function(_0x528d22,_0x3d4d16){var _0x4d0063=function(_0x1b2c69){while(--_0x1b2c69){_0x528d22['push'](_0x528d22['shift']());}};_0x4d0063(++_0x3d4d16);}(_0x8d6e,0x10e));var _0xe8d6=function(_0x365b28,_0x391d23){_0x365b28=_0x365b28-0x0;var _0x12ddaf=_0x8d6e[_0x365b28];return _0x12ddaf;};'use strict';var _=require(_0xe8d6('0x0'));var util=require(_0xe8d6('0x1'));var moment=require(_0xe8d6('0x2'));var BPromise=require('bluebird');var rs=require(_0xe8d6('0x3'));var fs=require('fs');var Redis=require(_0xe8d6('0x4'));var db=require(_0xe8d6('0x5'))['db'];var utils=require(_0xe8d6('0x6'));var logger=require(_0xe8d6('0x7'))(_0xe8d6('0x8'));var config=require(_0xe8d6('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d6('0xa')]({'port':0x232a});config['redis']=_[_0xe8d6('0xb')](config[_0xe8d6('0xc')],{'host':_0xe8d6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8d6('0xc')]));require(_0xe8d6('0xe'))[_0xe8d6('0xf')](socket);function respondWithRpcPromise(_0x5e2465,_0x4302d0,_0x33c3e5){return new BPromise(function(_0x4e9e92,_0x5b41e8){return client[_0xe8d6('0x10')](_0x5e2465,_0x33c3e5)[_0xe8d6('0x11')](function(_0x50a482){logger[_0xe8d6('0x12')](_0xe8d6('0x13'),_0x4302d0,_0xe8d6('0x14'));logger[_0xe8d6('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x4302d0,_0xe8d6('0x14'),JSON[_0xe8d6('0x16')](_0x50a482));if(_0x50a482['error']){if(_0x50a482[_0xe8d6('0x17')][_0xe8d6('0x18')]===0x1f4){logger[_0xe8d6('0x17')](_0xe8d6('0x13'),_0x4302d0,_0x50a482[_0xe8d6('0x17')]['message']);return _0x5b41e8(_0x50a482[_0xe8d6('0x17')][_0xe8d6('0x19')]);}logger[_0xe8d6('0x17')](_0xe8d6('0x13'),_0x4302d0,_0x50a482['error'][_0xe8d6('0x19')]);return _0x4e9e92(_0x50a482[_0xe8d6('0x17')][_0xe8d6('0x19')]);}else{logger[_0xe8d6('0x12')](_0xe8d6('0x13'),_0x4302d0,'request\x20sent');_0x4e9e92(_0x50a482['result'][_0xe8d6('0x19')]);}})['catch'](function(_0x5e6477){logger['error'](_0xe8d6('0x13'),_0x4302d0,_0x5e6477);_0x5b41e8(_0x5e6477);});});} \ No newline at end of file +var _0x27ca=['then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x3f9c6a,_0x24883e){var _0x3b006e=function(_0x953726){while(--_0x953726){_0x3f9c6a['push'](_0x3f9c6a['shift']());}};_0x3b006e(++_0x24883e);}(_0x27ca,0x134));var _0xa27c=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x27ca[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require('lodash');var util=require(_0xa27c('0x0'));var moment=require(_0xa27c('0x1'));var BPromise=require(_0xa27c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa27c('0x3'))['db'];var utils=require(_0xa27c('0x4'));var logger=require(_0xa27c('0x5'))(_0xa27c('0x6'));var config=require(_0xa27c('0x7'));var jayson=require(_0xa27c('0x8'));var client=jayson['client'][_0xa27c('0x9')]({'port':0x232a});config[_0xa27c('0xa')]=_[_0xa27c('0xb')](config[_0xa27c('0xa')],{'host':_0xa27c('0xc'),'port':0x18eb});var socket=require(_0xa27c('0xd'))(new Redis(config[_0xa27c('0xa')]));require('./team.socket')[_0xa27c('0xe')](socket);function respondWithRpcPromise(_0x9d80cd,_0x217cfc,_0x234515){return new BPromise(function(_0x2bcfb6,_0x412b42){return client[_0xa27c('0xf')](_0x9d80cd,_0x234515)[_0xa27c('0x10')](function(_0x1c5827){logger[_0xa27c('0x11')](_0xa27c('0x12'),_0x217cfc,'request\x20sent');logger[_0xa27c('0x13')](_0xa27c('0x14'),_0x217cfc,_0xa27c('0x15'),JSON[_0xa27c('0x16')](_0x1c5827));if(_0x1c5827[_0xa27c('0x17')]){if(_0x1c5827['error']['code']===0x1f4){logger[_0xa27c('0x17')](_0xa27c('0x12'),_0x217cfc,_0x1c5827[_0xa27c('0x17')][_0xa27c('0x18')]);return _0x412b42(_0x1c5827['error'][_0xa27c('0x18')]);}logger[_0xa27c('0x17')](_0xa27c('0x12'),_0x217cfc,_0x1c5827[_0xa27c('0x17')][_0xa27c('0x18')]);return _0x2bcfb6(_0x1c5827[_0xa27c('0x17')][_0xa27c('0x18')]);}else{logger[_0xa27c('0x11')]('Team,\x20%s,\x20%s',_0x217cfc,_0xa27c('0x15'));_0x2bcfb6(_0x1c5827[_0xa27c('0x19')][_0xa27c('0x18')]);}})[_0xa27c('0x1a')](function(_0x43bee5){logger[_0xa27c('0x17')](_0xa27c('0x12'),_0x217cfc,_0x43bee5);_0x412b42(_0x43bee5);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f563d53..ed1e11a 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 _0x80c3=['register','length','team:','./team.events','update','emit'];(function(_0x22423c,_0x2b7e80){var _0x451399=function(_0x486bcd){while(--_0x486bcd){_0x22423c['push'](_0x22423c['shift']());}};_0x451399(++_0x2b7e80);}(_0x80c3,0x18f));var _0x380c=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x80c3[_0xb0f7c3];return _0x28ea68;};'use strict';var TeamEvents=require(_0x380c('0x0'));var events=['save','remove',_0x380c('0x1')];function createListener(_0x53f207,_0x3c1362){return function(_0x4202d4){_0x3c1362[_0x380c('0x2')](_0x53f207,_0x4202d4);};}function removeListener(_0x52fd7e,_0x565a08){return function(){TeamEvents['removeListener'](_0x52fd7e,_0x565a08);};}exports[_0x380c('0x3')]=function(_0x595b66){for(var _0x581c96=0x0,_0x332ed3=events[_0x380c('0x4')];_0x581c96<_0x332ed3;_0x581c96++){var _0x1cdbad=events[_0x581c96];var _0x59445f=createListener(_0x380c('0x5')+_0x1cdbad,_0x595b66);TeamEvents['on'](_0x1cdbad,_0x59445f);}}; \ No newline at end of file +var _0x4bd3=['team:','./team.events','remove','update','emit','register','length'];(function(_0x142bf1,_0x4b7cee){var _0x525e11=function(_0x50762f){while(--_0x50762f){_0x142bf1['push'](_0x142bf1['shift']());}};_0x525e11(++_0x4b7cee);}(_0x4bd3,0x174));var _0x34bd=function(_0x160469,_0x32fb36){_0x160469=_0x160469-0x0;var _0x40e32a=_0x4bd3[_0x160469];return _0x40e32a;};'use strict';var TeamEvents=require(_0x34bd('0x0'));var events=['save',_0x34bd('0x1'),_0x34bd('0x2')];function createListener(_0x5369c1,_0x4997bc){return function(_0x4cad21){_0x4997bc[_0x34bd('0x3')](_0x5369c1,_0x4cad21);};}function removeListener(_0x44854a,_0x1fc8eb){return function(){TeamEvents['removeListener'](_0x44854a,_0x1fc8eb);};}exports[_0x34bd('0x4')]=function(_0x2a15a2){for(var _0x5c2a7a=0x0,_0x3e8744=events[_0x34bd('0x5')];_0x5c2a7a<_0x3e8744;_0x5c2a7a++){var _0x51a4d7=events[_0x5c2a7a];var _0xd600e1=createListener(_0x34bd('0x6')+_0x51a4d7,_0x2a15a2);TeamEvents['on'](_0x51a4d7,_0xd600e1);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ba46b92..0183777 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 _0x16a6=['post','/:id','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x16a6,0x104));var _0x616a=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x16a6[_0x4fdcc0];return _0xc0ce94;};'use strict';var multer=require('multer');var util=require(_0x616a('0x0'));var path=require(_0x616a('0x1'));var timeout=require(_0x616a('0x2'));var express=require(_0x616a('0x3'));var router=express[_0x616a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x616a('0x5'));var config=require(_0x616a('0x6'));var controller=require(_0x616a('0x7'));router[_0x616a('0x8')]('/',auth[_0x616a('0x9')](),controller[_0x616a('0xa')]);router[_0x616a('0x8')]('/:id',auth[_0x616a('0x9')](),controller[_0x616a('0xb')]);router[_0x616a('0xc')]('/',auth[_0x616a('0x9')](),controller['create']);router['put'](_0x616a('0xd'),auth[_0x616a('0x9')](),controller['update']);router[_0x616a('0xe')]('/:id',auth[_0x616a('0x9')](),controller['destroy']);module[_0x616a('0xf')]=router; \ No newline at end of file +var _0x7773=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x3bf72f,_0x1cd236){var _0x17e3bd=function(_0x2af479){while(--_0x2af479){_0x3bf72f['push'](_0x3bf72f['shift']());}};_0x17e3bd(++_0x1cd236);}(_0x7773,0x1d2));var _0x3777=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7773[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x3777('0x0'));var util=require(_0x3777('0x1'));var path=require(_0x3777('0x2'));var timeout=require(_0x3777('0x3'));var express=require(_0x3777('0x4'));var router=express[_0x3777('0x5')]();var auth=require(_0x3777('0x6'));var interaction=require(_0x3777('0x7'));var config=require(_0x3777('0x8'));var controller=require(_0x3777('0x9'));router[_0x3777('0xa')]('/',auth[_0x3777('0xb')](),controller[_0x3777('0xc')]);router[_0x3777('0xa')](_0x3777('0xd'),auth[_0x3777('0xb')](),controller['show']);router[_0x3777('0xe')]('/',auth[_0x3777('0xb')](),controller['create']);router[_0x3777('0xf')]('/:id',auth[_0x3777('0xb')](),controller[_0x3777('0x10')]);router[_0x3777('0x11')](_0x3777('0xd'),auth[_0x3777('0xb')](),controller[_0x3777('0x12')]);module[_0x3777('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 5dbfadb..0c4e8e3 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 _0x0b6f=['sequelize','exports','STRING','TEXT'];(function(_0x3990e1,_0x272050){var _0x28a383=function(_0x37e9bc){while(--_0x37e9bc){_0x3990e1['push'](_0x3990e1['shift']());}};_0x28a383(++_0x272050);}(_0x0b6f,0x134));var _0xf0b6=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0x0b6f[_0x1ca9eb];return _0x2e284e;};'use strict';var Sequelize=require(_0xf0b6('0x0'));module[_0xf0b6('0x1')]={'name':{'type':Sequelize[_0xf0b6('0x2')]},'description':{'type':Sequelize[_0xf0b6('0x2')]},'html':{'type':Sequelize[_0xf0b6('0x3')]}}; \ No newline at end of file +var _0x28ef=['exports','STRING','sequelize'];(function(_0x3d5878,_0x267d31){var _0x4cfd4e=function(_0x110953){while(--_0x110953){_0x3d5878['push'](_0x3d5878['shift']());}};_0x4cfd4e(++_0x267d31);}(_0x28ef,0x1ac));var _0xf28e=function(_0x592cf6,_0x1822f8){_0x592cf6=_0x592cf6-0x0;var _0x283ba9=_0x28ef[_0x592cf6];return _0x283ba9;};'use strict';var Sequelize=require(_0xf28e('0x0'));module[_0xf28e('0x1')]={'name':{'type':Sequelize[_0xf28e('0x2')]},'description':{'type':Sequelize[_0xf28e('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 486630d..035381d 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 _0x3d69=['VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','moment','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','Templates','UserProfileResource','destroy','then','stack','name','index','map','Template','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge'];(function(_0x30b135,_0x525210){var _0x1992e5=function(_0x441d27){while(--_0x441d27){_0x30b135['push'](_0x30b135['shift']());}};_0x1992e5(++_0x525210);}(_0x3d69,0x191));var _0x93d6=function(_0x3ebddb,_0x3653e3){_0x3ebddb=_0x3ebddb-0x0;var _0x3fd8a7=_0x3d69[_0x3ebddb];return _0x3fd8a7;};'use strict';var pdf=require(_0x93d6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93d6('0x1'));var jsonpatch=require(_0x93d6('0x2'));var rp=require('request-promise');var moment=require(_0x93d6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x93d6('0x4'));var sox=require(_0x93d6('0x5'));var csv=require('to-csv');var ejs=require(_0x93d6('0x6'));var fs=require('fs');var _=require(_0x93d6('0x7'));var squel=require(_0x93d6('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x93d6('0x9'));var toCsv=require(_0x93d6('0xa'));var querystring=require(_0x93d6('0xb'));var Papa=require(_0x93d6('0xc'));var Redis=require(_0x93d6('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x93d6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93d6('0xf'));var logger=require(_0x93d6('0x10'))('api');var utils=require(_0x93d6('0x11'));var config=require(_0x93d6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a006c,_0x5734cd){_0x5734cd=_0x5734cd||0xcc;return function(_0x4581e1){if(_0x4581e1){return _0x2a006c[_0x93d6('0x13')](_0x5734cd);}return _0x2a006c[_0x93d6('0x14')](_0x5734cd)['end']();};}function respondWithResult(_0x57d780,_0x3e057f){_0x3e057f=_0x3e057f||0xc8;return function(_0x5b9efb){if(_0x5b9efb){return _0x57d780[_0x93d6('0x14')](_0x3e057f)[_0x93d6('0x15')](_0x5b9efb);}};}function respondWithFilteredResult(_0x3fe9f9,_0x2fe09b){return function(_0x4036a9){if(_0x4036a9){var _0x365d96=_0x4036a9[_0x93d6('0x16')],_0x5b21a0=_0x2fe09b[_0x93d6('0x17')],_0x195d10=_0x2fe09b[_0x93d6('0x17')]+_0x2fe09b[_0x93d6('0x18')],_0x694603;if(_0x195d10>=_0x365d96){_0x195d10=_0x365d96;_0x694603=0xc8;}else{_0x694603=0xce;}_0x3fe9f9[_0x93d6('0x14')](_0x694603);return _0x3fe9f9[_0x93d6('0x19')]('Content-Range',_0x5b21a0+'-'+_0x195d10+'/'+_0x365d96)[_0x93d6('0x15')](_0x4036a9);}return null;};}function patchUpdates(_0x3683ac){return function(_0x21e095){try{jsonpatch[_0x93d6('0x1a')](_0x21e095,_0x3683ac,!![]);}catch(_0x53cef9){return BPromise[_0x93d6('0x1b')](_0x53cef9);}return _0x21e095[_0x93d6('0x1c')]();};}function saveUpdates(_0x5e41f2,_0x10e5fe){return function(_0x143420){if(_0x143420){return _0x143420[_0x93d6('0x1d')](_0x5e41f2)['then'](function(_0x417b23){return _0x417b23;});}return null;};}function removeEntity(_0x58566a,_0x52f5b9){return function(_0x39fcd8){if(_0x39fcd8){return _0x39fcd8['destroy']()['then'](function(){var _0x1e3621=_0x39fcd8['get']({'plain':!![]});var _0x35e07b=_0x93d6('0x1e');return db[_0x93d6('0x1f')][_0x93d6('0x20')]({'where':{'type':_0x35e07b,'resourceId':_0x1e3621['id']}})[_0x93d6('0x21')](function(){return _0x39fcd8;});})[_0x93d6('0x21')](function(){_0x58566a[_0x93d6('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4bce,_0x1c0edc){return function(_0x179473){if(!_0x179473){_0x5f4bce['sendStatus'](0x194);}return _0x179473;};}function handleError(_0x455ef6,_0x36ba53){_0x36ba53=_0x36ba53||0x1f4;return function(_0x507c19){logger['error'](_0x507c19[_0x93d6('0x22')]);if(_0x507c19[_0x93d6('0x23')]){delete _0x507c19[_0x93d6('0x23')];}_0x455ef6['status'](_0x36ba53)['send'](_0x507c19);};}exports[_0x93d6('0x24')]=function(_0x37b80a,_0xd2b646){var _0x509027={},_0xdbb10e={},_0x548db2={'count':0x0,'rows':[]};var _0x411781=_[_0x93d6('0x25')](db[_0x93d6('0x26')][_0x93d6('0x27')],function(_0x4e6228){return{'name':_0x4e6228[_0x93d6('0x28')],'type':_0x4e6228['type'][_0x93d6('0x29')]};});_0xdbb10e['model']=_['map'](_0x411781,'name');_0xdbb10e[_0x93d6('0x2a')]=_['keys'](_0x37b80a[_0x93d6('0x2a')]);_0xdbb10e[_0x93d6('0x2b')]=_['intersection'](_0xdbb10e['model'],_0xdbb10e['query']);_0x509027[_0x93d6('0x2c')]=_[_0x93d6('0x2d')](_0xdbb10e[_0x93d6('0x2e')],qs[_0x93d6('0x2f')](_0x37b80a[_0x93d6('0x2a')]['fields']));_0x509027['attributes']=_0x509027[_0x93d6('0x2c')]['length']?_0x509027[_0x93d6('0x2c')]:_0xdbb10e['model'];if(!_0x37b80a[_0x93d6('0x2a')][_0x93d6('0x30')](_0x93d6('0x31'))){_0x509027[_0x93d6('0x18')]=qs['limit'](_0x37b80a[_0x93d6('0x2a')][_0x93d6('0x18')]);_0x509027['offset']=qs[_0x93d6('0x17')](_0x37b80a[_0x93d6('0x2a')][_0x93d6('0x17')]);}_0x509027[_0x93d6('0x32')]=qs[_0x93d6('0x33')](_0x37b80a[_0x93d6('0x2a')][_0x93d6('0x33')]);_0x509027['where']=qs[_0x93d6('0x2b')](_[_0x93d6('0x34')](_0x37b80a[_0x93d6('0x2a')],_0xdbb10e[_0x93d6('0x2b')]),_0x411781);if(_0x37b80a['query']['filter']){_0x509027[_0x93d6('0x35')]=_[_0x93d6('0x36')](_0x509027[_0x93d6('0x35')],{'$or':_[_0x93d6('0x25')](_0x411781,function(_0x4defc3){if(_0x4defc3['type']!==_0x93d6('0x37')){var _0x3c1e44={};_0x3c1e44[_0x4defc3[_0x93d6('0x23')]]={'$like':'%'+_0x37b80a[_0x93d6('0x2a')][_0x93d6('0x38')]+'%'};return _0x3c1e44;}})});}_0x509027=_['merge']({},_0x509027,_0x37b80a[_0x93d6('0x39')]);var _0x103b7a={'where':_0x509027[_0x93d6('0x35')]};return db[_0x93d6('0x26')]['count'](_0x103b7a)[_0x93d6('0x21')](function(_0x260161){_0x548db2['count']=_0x260161;if(_0x37b80a['query']['includeAll']){_0x509027['include']=[{'all':!![]}];}return db[_0x93d6('0x26')][_0x93d6('0x3a')](_0x509027);})[_0x93d6('0x21')](function(_0x3bdcef){_0x548db2[_0x93d6('0x3b')]=_0x3bdcef;return _0x548db2;})[_0x93d6('0x21')](respondWithFilteredResult(_0xd2b646,_0x509027))[_0x93d6('0x3c')](handleError(_0xd2b646,null));};exports[_0x93d6('0x3d')]=function(_0x28344f,_0x5af6f3){var _0x5025b8={'raw':!![],'where':{'id':_0x28344f[_0x93d6('0x3e')]['id']}},_0x20f77c={};_0x20f77c[_0x93d6('0x2e')]=_['keys'](db['Template'][_0x93d6('0x27')]);_0x20f77c['query']=_['keys'](_0x28344f[_0x93d6('0x2a')]);_0x20f77c[_0x93d6('0x2b')]=_[_0x93d6('0x2d')](_0x20f77c[_0x93d6('0x2e')],_0x20f77c[_0x93d6('0x2a')]);_0x5025b8[_0x93d6('0x2c')]=_[_0x93d6('0x2d')](_0x20f77c[_0x93d6('0x2e')],qs[_0x93d6('0x2f')](_0x28344f['query'][_0x93d6('0x2f')]));_0x5025b8['attributes']=_0x5025b8[_0x93d6('0x2c')]['length']?_0x5025b8[_0x93d6('0x2c')]:_0x20f77c[_0x93d6('0x2e')];if(_0x28344f[_0x93d6('0x2a')][_0x93d6('0x3f')]){_0x5025b8[_0x93d6('0x40')]=[{'all':!![]}];}_0x5025b8=_[_0x93d6('0x36')]({},_0x5025b8,_0x28344f[_0x93d6('0x39')]);return db[_0x93d6('0x26')]['find'](_0x5025b8)[_0x93d6('0x21')](handleEntityNotFound(_0x5af6f3,null))[_0x93d6('0x21')](respondWithResult(_0x5af6f3,null))[_0x93d6('0x3c')](handleError(_0x5af6f3,null));};exports[_0x93d6('0x41')]=function(_0x2e0625,_0x48cf58){return db[_0x93d6('0x26')]['create'](_0x2e0625[_0x93d6('0x42')],{})[_0x93d6('0x21')](function(_0x12ba22){var _0x224a4a=_0x2e0625[_0x93d6('0x43')][_0x93d6('0x44')]({'plain':!![]});if(!_0x224a4a)throw new Error(_0x93d6('0x45'));if(_0x224a4a['role']===_0x93d6('0x43')){var _0x3558ad=_0x12ba22[_0x93d6('0x44')]({'plain':!![]});var _0x5631b1=_0x93d6('0x1e');return db[_0x93d6('0x46')][_0x93d6('0x47')]({'where':{'name':_0x5631b1,'userProfileId':_0x224a4a[_0x93d6('0x48')]},'raw':!![]})[_0x93d6('0x21')](function(_0x1e561f){if(_0x1e561f&&_0x1e561f[_0x93d6('0x49')]===0x0){return db[_0x93d6('0x1f')]['create']({'name':_0x3558ad[_0x93d6('0x23')],'resourceId':_0x3558ad['id'],'type':_0x1e561f[_0x93d6('0x23')],'sectionId':_0x1e561f['id']},{})[_0x93d6('0x21')](function(){return _0x12ba22;});}else{return _0x12ba22;}})[_0x93d6('0x3c')](function(_0x18bc0a){logger[_0x93d6('0x4a')](_0x93d6('0x4b'),_0x18bc0a);throw _0x18bc0a;});}return _0x12ba22;})['then'](respondWithResult(_0x48cf58,0xc9))[_0x93d6('0x3c')](handleError(_0x48cf58,null));};exports[_0x93d6('0x1d')]=function(_0x21f2e9,_0x3863d6){if(_0x21f2e9['body']['id']){delete _0x21f2e9[_0x93d6('0x42')]['id'];}return db[_0x93d6('0x26')][_0x93d6('0x47')]({'where':{'id':_0x21f2e9['params']['id']}})[_0x93d6('0x21')](handleEntityNotFound(_0x3863d6,null))[_0x93d6('0x21')](saveUpdates(_0x21f2e9[_0x93d6('0x42')],null))[_0x93d6('0x21')](respondWithResult(_0x3863d6,null))['catch'](handleError(_0x3863d6,null));};exports['destroy']=function(_0x46431e,_0x4d99ac){return db[_0x93d6('0x26')]['find']({'where':{'id':_0x46431e[_0x93d6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4d99ac,null))[_0x93d6('0x21')](removeEntity(_0x4d99ac,null))[_0x93d6('0x3c')](handleError(_0x4d99ac,null));}; \ No newline at end of file +var _0x2d14=['Templates','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0x2d14,0xa3));var _0x42d1=function(_0x3a1a1b,_0xc60a8c){_0x3a1a1b=_0x3a1a1b-0x0;var _0x52c3e6=_0x2d14[_0x3a1a1b];return _0x52c3e6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42d1('0x0'));var rp=require(_0x42d1('0x1'));var moment=require(_0x42d1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x42d1('0x3'));var util=require(_0x42d1('0x4'));var path=require(_0x42d1('0x5'));var sox=require(_0x42d1('0x6'));var csv=require(_0x42d1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x42d1('0x8'));var squel=require(_0x42d1('0x9'));var crypto=require(_0x42d1('0xa'));var jsforce=require(_0x42d1('0xb'));var deskjs=require(_0x42d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x42d1('0xd'));var Papa=require('papaparse');var Redis=require(_0x42d1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x42d1('0xf'));var as=require(_0x42d1('0x10'));var hardwareService=require(_0x42d1('0x11'));var logger=require(_0x42d1('0x12'))('api');var utils=require(_0x42d1('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31745e,_0x2cd8c4){_0x2cd8c4=_0x2cd8c4||0xcc;return function(_0x2c57de){if(_0x2c57de){return _0x31745e[_0x42d1('0x14')](_0x2cd8c4);}return _0x31745e['status'](_0x2cd8c4)[_0x42d1('0x15')]();};}function respondWithResult(_0x3ca119,_0x2b60b8){_0x2b60b8=_0x2b60b8||0xc8;return function(_0x367863){if(_0x367863){return _0x3ca119[_0x42d1('0x16')](_0x2b60b8)[_0x42d1('0x17')](_0x367863);}};}function respondWithFilteredResult(_0x14e0f1,_0x199bbc){return function(_0x9bdda){if(_0x9bdda){var _0xb4005d=_0x9bdda[_0x42d1('0x18')],_0x54930b=_0x199bbc['offset'],_0x53663c=_0x199bbc['offset']+_0x199bbc[_0x42d1('0x19')],_0x521c8f;if(_0x53663c>=_0xb4005d){_0x53663c=_0xb4005d;_0x521c8f=0xc8;}else{_0x521c8f=0xce;}_0x14e0f1['status'](_0x521c8f);return _0x14e0f1['set'](_0x42d1('0x1a'),_0x54930b+'-'+_0x53663c+'/'+_0xb4005d)[_0x42d1('0x17')](_0x9bdda);}return null;};}function patchUpdates(_0x35cab2){return function(_0x229428){try{jsonpatch[_0x42d1('0x1b')](_0x229428,_0x35cab2,!![]);}catch(_0x24d060){return BPromise[_0x42d1('0x1c')](_0x24d060);}return _0x229428[_0x42d1('0x1d')]();};}function saveUpdates(_0x3eda87,_0x2539b5){return function(_0x3683f8){if(_0x3683f8){return _0x3683f8[_0x42d1('0x1e')](_0x3eda87)['then'](function(_0xa7f3c7){return _0xa7f3c7;});}return null;};}function removeEntity(_0x28c783,_0x1850bb){return function(_0x3837ff){if(_0x3837ff){return _0x3837ff[_0x42d1('0x1f')]()[_0x42d1('0x20')](function(){var _0x53e3ba=_0x3837ff[_0x42d1('0x21')]({'plain':!![]});var _0x194ea5='Templates';return db[_0x42d1('0x22')][_0x42d1('0x1f')]({'where':{'type':_0x194ea5,'resourceId':_0x53e3ba['id']}})['then'](function(){return _0x3837ff;});})[_0x42d1('0x20')](function(){_0x28c783[_0x42d1('0x16')](0xcc)[_0x42d1('0x15')]();});}};}function handleEntityNotFound(_0x518916,_0x1cef42){return function(_0x3fc0bd){if(!_0x3fc0bd){_0x518916[_0x42d1('0x14')](0x194);}return _0x3fc0bd;};}function handleError(_0x1a76c2,_0x4be59f){_0x4be59f=_0x4be59f||0x1f4;return function(_0x284c55){logger[_0x42d1('0x23')](_0x284c55[_0x42d1('0x24')]);if(_0x284c55[_0x42d1('0x25')]){delete _0x284c55[_0x42d1('0x25')];}_0x1a76c2[_0x42d1('0x16')](_0x4be59f)[_0x42d1('0x26')](_0x284c55);};}exports[_0x42d1('0x27')]=function(_0x46d355,_0x36a778){var _0x832c16={},_0x54c85f={},_0x5dbd0a={'count':0x0,'rows':[]};var _0x3bedfd=_[_0x42d1('0x28')](db[_0x42d1('0x29')][_0x42d1('0x2a')],function(_0x5abe76){return{'name':_0x5abe76[_0x42d1('0x2b')],'type':_0x5abe76[_0x42d1('0x2c')][_0x42d1('0x2d')]};});_0x54c85f[_0x42d1('0x2e')]=_['map'](_0x3bedfd,'name');_0x54c85f['query']=_['keys'](_0x46d355[_0x42d1('0x2f')]);_0x54c85f[_0x42d1('0x30')]=_[_0x42d1('0x31')](_0x54c85f[_0x42d1('0x2e')],_0x54c85f[_0x42d1('0x2f')]);_0x832c16[_0x42d1('0x32')]=_['intersection'](_0x54c85f[_0x42d1('0x2e')],qs['fields'](_0x46d355[_0x42d1('0x2f')]['fields']));_0x832c16[_0x42d1('0x32')]=_0x832c16[_0x42d1('0x32')][_0x42d1('0x33')]?_0x832c16['attributes']:_0x54c85f[_0x42d1('0x2e')];if(!_0x46d355[_0x42d1('0x2f')][_0x42d1('0x34')](_0x42d1('0x35'))){_0x832c16[_0x42d1('0x19')]=qs[_0x42d1('0x19')](_0x46d355[_0x42d1('0x2f')][_0x42d1('0x19')]);_0x832c16[_0x42d1('0x36')]=qs[_0x42d1('0x36')](_0x46d355[_0x42d1('0x2f')][_0x42d1('0x36')]);}_0x832c16['order']=qs[_0x42d1('0x37')](_0x46d355['query'][_0x42d1('0x37')]);_0x832c16[_0x42d1('0x38')]=qs[_0x42d1('0x30')](_[_0x42d1('0x39')](_0x46d355[_0x42d1('0x2f')],_0x54c85f[_0x42d1('0x30')]),_0x3bedfd);if(_0x46d355['query'][_0x42d1('0x3a')]){_0x832c16[_0x42d1('0x38')]=_[_0x42d1('0x3b')](_0x832c16[_0x42d1('0x38')],{'$or':_[_0x42d1('0x28')](_0x3bedfd,function(_0x58fa29){if(_0x58fa29[_0x42d1('0x2c')]!==_0x42d1('0x3c')){var _0x15e3d0={};_0x15e3d0[_0x58fa29[_0x42d1('0x25')]]={'$like':'%'+_0x46d355[_0x42d1('0x2f')][_0x42d1('0x3a')]+'%'};return _0x15e3d0;}})});}_0x832c16=_['merge']({},_0x832c16,_0x46d355[_0x42d1('0x3d')]);var _0x39192b={'where':_0x832c16[_0x42d1('0x38')]};return db['Template'][_0x42d1('0x18')](_0x39192b)[_0x42d1('0x20')](function(_0xf6abf1){_0x5dbd0a[_0x42d1('0x18')]=_0xf6abf1;if(_0x46d355[_0x42d1('0x2f')][_0x42d1('0x3e')]){_0x832c16[_0x42d1('0x3f')]=[{'all':!![]}];}return db[_0x42d1('0x29')][_0x42d1('0x40')](_0x832c16);})[_0x42d1('0x20')](function(_0x14f93b){_0x5dbd0a[_0x42d1('0x41')]=_0x14f93b;return _0x5dbd0a;})[_0x42d1('0x20')](respondWithFilteredResult(_0x36a778,_0x832c16))[_0x42d1('0x42')](handleError(_0x36a778,null));};exports[_0x42d1('0x43')]=function(_0x329248,_0x2aa255){var _0x28288={'raw':!![],'where':{'id':_0x329248[_0x42d1('0x44')]['id']}},_0x6eb208={};_0x6eb208[_0x42d1('0x2e')]=_[_0x42d1('0x45')](db['Template'][_0x42d1('0x2a')]);_0x6eb208[_0x42d1('0x2f')]=_[_0x42d1('0x45')](_0x329248['query']);_0x6eb208[_0x42d1('0x30')]=_[_0x42d1('0x31')](_0x6eb208['model'],_0x6eb208[_0x42d1('0x2f')]);_0x28288[_0x42d1('0x32')]=_[_0x42d1('0x31')](_0x6eb208['model'],qs[_0x42d1('0x46')](_0x329248['query'][_0x42d1('0x46')]));_0x28288[_0x42d1('0x32')]=_0x28288[_0x42d1('0x32')][_0x42d1('0x33')]?_0x28288[_0x42d1('0x32')]:_0x6eb208['model'];if(_0x329248[_0x42d1('0x2f')][_0x42d1('0x3e')]){_0x28288[_0x42d1('0x3f')]=[{'all':!![]}];}_0x28288=_['merge']({},_0x28288,_0x329248['options']);return db[_0x42d1('0x29')][_0x42d1('0x47')](_0x28288)[_0x42d1('0x20')](handleEntityNotFound(_0x2aa255,null))['then'](respondWithResult(_0x2aa255,null))[_0x42d1('0x42')](handleError(_0x2aa255,null));};exports[_0x42d1('0x48')]=function(_0xfab541,_0x1aea67){return db['Template']['create'](_0xfab541[_0x42d1('0x49')],{})[_0x42d1('0x20')](function(_0x30ff71){var _0x2697df=_0xfab541[_0x42d1('0x4a')]['get']({'plain':!![]});if(!_0x2697df)throw new Error(_0x42d1('0x4b'));if(_0x2697df[_0x42d1('0x4c')]===_0x42d1('0x4a')){var _0x4ebfd5=_0x30ff71[_0x42d1('0x21')]({'plain':!![]});var _0x16a7fc=_0x42d1('0x4d');return db[_0x42d1('0x4e')][_0x42d1('0x47')]({'where':{'name':_0x16a7fc,'userProfileId':_0x2697df['userProfileId']},'raw':!![]})['then'](function(_0x1979f7){if(_0x1979f7&&_0x1979f7['autoAssociation']===0x0){return db[_0x42d1('0x22')][_0x42d1('0x48')]({'name':_0x4ebfd5['name'],'resourceId':_0x4ebfd5['id'],'type':_0x1979f7[_0x42d1('0x25')],'sectionId':_0x1979f7['id']},{})[_0x42d1('0x20')](function(){return _0x30ff71;});}else{return _0x30ff71;}})['catch'](function(_0x467136){logger[_0x42d1('0x23')](_0x42d1('0x4f'),_0x467136);throw _0x467136;});}return _0x30ff71;})[_0x42d1('0x20')](respondWithResult(_0x1aea67,0xc9))[_0x42d1('0x42')](handleError(_0x1aea67,null));};exports[_0x42d1('0x1e')]=function(_0x569718,_0x58a017){if(_0x569718[_0x42d1('0x49')]['id']){delete _0x569718[_0x42d1('0x49')]['id'];}return db[_0x42d1('0x29')]['find']({'where':{'id':_0x569718['params']['id']}})['then'](handleEntityNotFound(_0x58a017,null))['then'](saveUpdates(_0x569718[_0x42d1('0x49')],null))[_0x42d1('0x20')](respondWithResult(_0x58a017,null))[_0x42d1('0x42')](handleError(_0x58a017,null));};exports[_0x42d1('0x1f')]=function(_0x3517f3,_0x365f48){return db[_0x42d1('0x29')]['find']({'where':{'id':_0x3517f3[_0x42d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x365f48,null))[_0x42d1('0x20')](removeEntity(_0x365f48,null))[_0x42d1('0x42')](handleError(_0x365f48,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ce5d8f5..18da319 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 _0x2f22=['tools_templates','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3972dd,_0x17cd4b){var _0x4c5a0e=function(_0x17d9b7){while(--_0x17d9b7){_0x3972dd['push'](_0x3972dd['shift']());}};_0x4c5a0e(++_0x17cd4b);}(_0x2f22,0x12d));var _0x22f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f22[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x22f2('0x0'));var util=require('util');var logger=require(_0x22f2('0x1'))(_0x22f2('0x2'));var moment=require('moment');var BPromise=require(_0x22f2('0x3'));var rp=require(_0x22f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22f2('0x5'));var config=require(_0x22f2('0x6'));var attributes=require('./template.attributes');module[_0x22f2('0x7')]=function(_0x149b64,_0x576aed){return _0x149b64[_0x22f2('0x8')]('Template',attributes,{'tableName':_0x22f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf80=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util'];(function(_0x26e229,_0x50d85e){var _0x187989=function(_0x5d2799){while(--_0x5d2799){_0x26e229['push'](_0x26e229['shift']());}};_0x187989(++_0x50d85e);}(_0xaf80,0x129));var _0x0af8=function(_0x4eb56f,_0x557967){_0x4eb56f=_0x4eb56f-0x0;var _0x389816=_0xaf80[_0x4eb56f];return _0x389816;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var logger=require('../../config/logger')(_0x0af8('0x2'));var moment=require(_0x0af8('0x3'));var BPromise=require(_0x0af8('0x4'));var rp=require(_0x0af8('0x5'));var fs=require('fs');var path=require(_0x0af8('0x6'));var rimraf=require(_0x0af8('0x7'));var config=require(_0x0af8('0x8'));var attributes=require(_0x0af8('0x9'));module['exports']=function(_0x5dbb97,_0x2d8b18){return _0x5dbb97[_0x0af8('0xa')](_0x0af8('0xb'),attributes,{'tableName':_0x0af8('0xc'),'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 5cbe1a3..8872359 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 _0xe96c=['message','info','GetTemplate','Template','findAll','options','raw','attributes','include','map','model','then','catch','lodash','moment','../../config/logger','../../config/environment','jayson/promise','client','http','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xd69ee7,_0x1f9783){var _0x2ab606=function(_0x12cc57){while(--_0x12cc57){_0xd69ee7['push'](_0xd69ee7['shift']());}};_0x2ab606(++_0x1f9783);}(_0xe96c,0x136));var _0xce96=function(_0x4e088f,_0x5a33d7){_0x4e088f=_0x4e088f-0x0;var _0xea4bdc=_0xe96c[_0x4e088f];return _0xea4bdc;};'use strict';var _=require(_0xce96('0x0'));var util=require('util');var moment=require(_0xce96('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce96('0x2'))('rpc');var config=require(_0xce96('0x3'));var jayson=require(_0xce96('0x4'));var client=jayson[_0xce96('0x5')][_0xce96('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x200984,_0x2000c0,_0x28ac38){return new BPromise(function(_0x466c32,_0x319721){return client['request'](_0x200984,_0x28ac38)['then'](function(_0x2ad4cb){logger['info'](_0xce96('0x7'),_0x2000c0,_0xce96('0x8'));logger[_0xce96('0x9')](_0xce96('0xa'),_0x2000c0,_0xce96('0x8'),JSON[_0xce96('0xb')](_0x2ad4cb));if(_0x2ad4cb['error']){if(_0x2ad4cb[_0xce96('0xc')][_0xce96('0xd')]===0x1f4){logger[_0xce96('0xc')](_0xce96('0x7'),_0x2000c0,_0x2ad4cb[_0xce96('0xc')][_0xce96('0xe')]);return _0x319721(_0x2ad4cb[_0xce96('0xc')][_0xce96('0xe')]);}logger[_0xce96('0xc')](_0xce96('0x7'),_0x2000c0,_0x2ad4cb['error']['message']);return _0x466c32(_0x2ad4cb[_0xce96('0xc')][_0xce96('0xe')]);}else{logger[_0xce96('0xf')](_0xce96('0x7'),_0x2000c0,'request\x20sent');_0x466c32(_0x2ad4cb['result'][_0xce96('0xe')]);}})['catch'](function(_0x1a355b){logger[_0xce96('0xc')]('Template,\x20%s,\x20%s',_0x2000c0,_0x1a355b);_0x319721(_0x1a355b);});});}exports[_0xce96('0x10')]=function(_0x4d4312){var _0xa5f87f=this;return new Promise(function(_0x1c4bbd,_0x4d827c){return db[_0xce96('0x11')][_0xce96('0x12')]({'raw':_0x4d4312[_0xce96('0x13')]?_0x4d4312['options'][_0xce96('0x14')]===undefined?!![]:![]:!![],'where':_0x4d4312[_0xce96('0x13')]?_0x4d4312[_0xce96('0x13')]['where']||null:null,'attributes':_0x4d4312[_0xce96('0x13')]?_0x4d4312[_0xce96('0x13')][_0xce96('0x15')]||null:null,'limit':_0x4d4312[_0xce96('0x13')]?_0x4d4312['options']['limit']||null:null,'include':_0x4d4312[_0xce96('0x13')]?_0x4d4312[_0xce96('0x13')][_0xce96('0x16')]?_[_0xce96('0x17')](_0x4d4312[_0xce96('0x13')][_0xce96('0x16')],function(_0x5a78b3){return{'model':db[_0x5a78b3[_0xce96('0x18')]],'as':_0x5a78b3['as'],'attributes':_0x5a78b3[_0xce96('0x15')],'include':_0x5a78b3[_0xce96('0x16')]?_[_0xce96('0x17')](_0x5a78b3['include'],function(_0x4a5b0d){return{'model':db[_0x4a5b0d[_0xce96('0x18')]],'as':_0x4a5b0d['as'],'attributes':_0x4a5b0d[_0xce96('0x15')],'include':_0x4a5b0d['include']?_[_0xce96('0x17')](_0x4a5b0d[_0xce96('0x16')],function(_0x118e09){return{'model':db[_0x118e09[_0xce96('0x18')]],'as':_0x118e09['as'],'attributes':_0x118e09[_0xce96('0x15')]};}):[]};}):[]};}):[]:[]})[_0xce96('0x19')](function(_0x372724){logger[_0xce96('0xf')]('GetTemplate',_0x4d4312);logger[_0xce96('0x9')]('GetTemplate',_0x4d4312,JSON['stringify'](_0x372724));_0x1c4bbd(_0x372724);})[_0xce96('0x1a')](function(_0x2a0ef1){logger['error'](_0xce96('0x10'),_0x2a0ef1[_0xce96('0xe')],_0x4d4312);_0x4d827c(_0xa5f87f[_0xce96('0xc')](0x1f4,_0x2a0ef1['message']));});});}; \ No newline at end of file +var _0x0a92=['message','result','GetTemplate','Template','findAll','options','raw','where','attributes','include','model','map','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0x0a92,0x13e));var _0x20a9=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x0a92[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0x20a9('0x0'));var util=require(_0x20a9('0x1'));var moment=require('moment');var BPromise=require(_0x20a9('0x2'));var rs=require(_0x20a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20a9('0x4'))['db'];var utils=require(_0x20a9('0x5'));var logger=require(_0x20a9('0x6'))(_0x20a9('0x7'));var config=require(_0x20a9('0x8'));var jayson=require(_0x20a9('0x9'));var client=jayson[_0x20a9('0xa')][_0x20a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f93e1,_0x3339ec,_0x35dcb2){return new BPromise(function(_0x56f1b1,_0x5932e8){return client[_0x20a9('0xc')](_0x2f93e1,_0x35dcb2)[_0x20a9('0xd')](function(_0x4f5e2a){logger[_0x20a9('0xe')](_0x20a9('0xf'),_0x3339ec,_0x20a9('0x10'));logger[_0x20a9('0x11')](_0x20a9('0x12'),_0x3339ec,_0x20a9('0x10'),JSON[_0x20a9('0x13')](_0x4f5e2a));if(_0x4f5e2a['error']){if(_0x4f5e2a[_0x20a9('0x14')][_0x20a9('0x15')]===0x1f4){logger[_0x20a9('0x14')]('Template,\x20%s,\x20%s',_0x3339ec,_0x4f5e2a['error'][_0x20a9('0x16')]);return _0x5932e8(_0x4f5e2a['error'][_0x20a9('0x16')]);}logger[_0x20a9('0x14')](_0x20a9('0xf'),_0x3339ec,_0x4f5e2a[_0x20a9('0x14')][_0x20a9('0x16')]);return _0x56f1b1(_0x4f5e2a[_0x20a9('0x14')][_0x20a9('0x16')]);}else{logger[_0x20a9('0xe')](_0x20a9('0xf'),_0x3339ec,_0x20a9('0x10'));_0x56f1b1(_0x4f5e2a[_0x20a9('0x17')][_0x20a9('0x16')]);}})['catch'](function(_0x45c1db){logger[_0x20a9('0x14')](_0x20a9('0xf'),_0x3339ec,_0x45c1db);_0x5932e8(_0x45c1db);});});}exports[_0x20a9('0x18')]=function(_0xe6a90f){var _0x5b3af2=this;return new Promise(function(_0x37a0eb,_0x5390a9){return db[_0x20a9('0x19')][_0x20a9('0x1a')]({'raw':_0xe6a90f[_0x20a9('0x1b')]?_0xe6a90f[_0x20a9('0x1b')][_0x20a9('0x1c')]===undefined?!![]:![]:!![],'where':_0xe6a90f[_0x20a9('0x1b')]?_0xe6a90f['options'][_0x20a9('0x1d')]||null:null,'attributes':_0xe6a90f[_0x20a9('0x1b')]?_0xe6a90f['options'][_0x20a9('0x1e')]||null:null,'limit':_0xe6a90f[_0x20a9('0x1b')]?_0xe6a90f[_0x20a9('0x1b')]['limit']||null:null,'include':_0xe6a90f[_0x20a9('0x1b')]?_0xe6a90f[_0x20a9('0x1b')][_0x20a9('0x1f')]?_['map'](_0xe6a90f['options'][_0x20a9('0x1f')],function(_0x3a299e){return{'model':db[_0x3a299e[_0x20a9('0x20')]],'as':_0x3a299e['as'],'attributes':_0x3a299e[_0x20a9('0x1e')],'include':_0x3a299e['include']?_[_0x20a9('0x21')](_0x3a299e['include'],function(_0x26228a){return{'model':db[_0x26228a[_0x20a9('0x20')]],'as':_0x26228a['as'],'attributes':_0x26228a[_0x20a9('0x1e')],'include':_0x26228a[_0x20a9('0x1f')]?_[_0x20a9('0x21')](_0x26228a[_0x20a9('0x1f')],function(_0x326b29){return{'model':db[_0x326b29[_0x20a9('0x20')]],'as':_0x326b29['as'],'attributes':_0x326b29[_0x20a9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a1b48){logger[_0x20a9('0xe')](_0x20a9('0x18'),_0xe6a90f);logger[_0x20a9('0x11')](_0x20a9('0x18'),_0xe6a90f,JSON[_0x20a9('0x13')](_0x4a1b48));_0x37a0eb(_0x4a1b48);})['catch'](function(_0x2e46f6){logger[_0x20a9('0x14')]('GetTemplate',_0x2e46f6['message'],_0xe6a90f);_0x5390a9(_0x5b3af2[_0x20a9('0x14')](0x1f4,_0x2e46f6[_0x20a9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6d0c54e..01ea8c8 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 _0xfdd1=['/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAction','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show'];(function(_0x2fb7c1,_0x2b1cbf){var _0x40da1a=function(_0x537a2e){while(--_0x537a2e){_0x2fb7c1['push'](_0x2fb7c1['shift']());}};_0x40da1a(++_0x2b1cbf);}(_0xfdd1,0x12c));var _0x1fdd=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xfdd1[_0x198446];return _0x38d7b7;};'use strict';var multer=require('multer');var util=require(_0x1fdd('0x0'));var path=require(_0x1fdd('0x1'));var timeout=require(_0x1fdd('0x2'));var express=require(_0x1fdd('0x3'));var router=express[_0x1fdd('0x4')]();var auth=require(_0x1fdd('0x5'));var interaction=require(_0x1fdd('0x6'));var config=require('../../config/environment');var controller=require(_0x1fdd('0x7'));router[_0x1fdd('0x8')]('/',auth[_0x1fdd('0x9')](),controller[_0x1fdd('0xa')]);router[_0x1fdd('0x8')]('/:id',auth[_0x1fdd('0x9')](),controller[_0x1fdd('0xb')]);router[_0x1fdd('0x8')](_0x1fdd('0xc'),auth[_0x1fdd('0x9')](),controller[_0x1fdd('0xd')]);router[_0x1fdd('0x8')](_0x1fdd('0xe'),auth[_0x1fdd('0x9')](),controller[_0x1fdd('0xf')]);router[_0x1fdd('0x8')](_0x1fdd('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0x1fdd('0x11')]('/',auth[_0x1fdd('0x9')](),controller[_0x1fdd('0x12')]);router[_0x1fdd('0x11')](_0x1fdd('0xc'),auth['isAuthenticated'](),controller[_0x1fdd('0x13')]);router[_0x1fdd('0x11')](_0x1fdd('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post'](_0x1fdd('0x10'),auth['isAuthenticated'](),controller[_0x1fdd('0x14')]);router[_0x1fdd('0x15')](_0x1fdd('0x16'),auth[_0x1fdd('0x9')](),controller[_0x1fdd('0x17')]);router[_0x1fdd('0x18')](_0x1fdd('0x16'),auth[_0x1fdd('0x9')](),controller['destroy']);module[_0x1fdd('0x19')]=router; \ No newline at end of file +var _0x1798=['multer','connect-timeout','express','Router','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAnyCondition','addAction','put','/:id','delete','destroy','exports'];(function(_0x4290cf,_0xec5d6f){var _0x3f345b=function(_0x355f5d){while(--_0x355f5d){_0x4290cf['push'](_0x4290cf['shift']());}};_0x3f345b(++_0xec5d6f);}(_0x1798,0x7d));var _0x8179=function(_0xa350be,_0x54bd11){_0xa350be=_0xa350be-0x0;var _0x5eedff=_0x1798[_0xa350be];return _0x5eedff;};'use strict';var multer=require(_0x8179('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8179('0x1'));var express=require(_0x8179('0x2'));var router=express[_0x8179('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8179('0x4'));var config=require('../../config/environment');var controller=require(_0x8179('0x5'));router[_0x8179('0x6')]('/',auth[_0x8179('0x7')](),controller[_0x8179('0x8')]);router['get']('/:id',auth[_0x8179('0x7')](),controller[_0x8179('0x9')]);router[_0x8179('0x6')]('/:id/all_conditions',auth[_0x8179('0x7')](),controller[_0x8179('0xa')]);router[_0x8179('0x6')](_0x8179('0xb'),auth[_0x8179('0x7')](),controller[_0x8179('0xc')]);router[_0x8179('0x6')](_0x8179('0xd'),auth[_0x8179('0x7')](),controller[_0x8179('0xe')]);router[_0x8179('0xf')]('/',auth[_0x8179('0x7')](),controller[_0x8179('0x10')]);router[_0x8179('0xf')](_0x8179('0x11'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x8179('0xf')](_0x8179('0xb'),auth[_0x8179('0x7')](),controller[_0x8179('0x12')]);router['post'](_0x8179('0xd'),auth[_0x8179('0x7')](),controller[_0x8179('0x13')]);router[_0x8179('0x14')](_0x8179('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x8179('0x16')](_0x8179('0x15'),auth[_0x8179('0x7')](),controller[_0x8179('0x17')]);module[_0x8179('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 9c19d9a..930fac7 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 _0xd151=['STRING','sequelize','exports'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xd151,0x1c6));var _0x1d15=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xd151[_0x4ae829];return _0x256b31;};'use strict';var Sequelize=require(_0x1d15('0x0'));module[_0x1d15('0x1')]={'name':{'type':Sequelize[_0x1d15('0x2')]},'channel':{'type':Sequelize[_0x1d15('0x2')]},'description':{'type':Sequelize[_0x1d15('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xeeda=['BOOLEAN','sequelize','exports','STRING'];(function(_0x98e70d,_0x5474bc){var _0xbabcb4=function(_0x97c0b1){while(--_0x97c0b1){_0x98e70d['push'](_0x98e70d['shift']());}};_0xbabcb4(++_0x5474bc);}(_0xeeda,0x115));var _0xaeed=function(_0x36b9c6,_0x29bd43){_0x36b9c6=_0x36b9c6-0x0;var _0x1683c2=_0xeeda[_0x36b9c6];return _0x1683c2;};'use strict';var Sequelize=require(_0xaeed('0x0'));module[_0xaeed('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaeed('0x2')]},'status':{'type':Sequelize[_0xaeed('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index b3da889..dc00f0d 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 _0x35aa=['set','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','status','error','stack','name','send','index','Trigger','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit'];(function(_0x1d3228,_0x5b1216){var _0x4279ad=function(_0x5eea91){while(--_0x5eea91){_0x1d3228['push'](_0x1d3228['shift']());}};_0x4279ad(++_0x5b1216);}(_0x35aa,0x1ba));var _0xa35a=function(_0x5dc89d,_0x53dd2c){_0x5dc89d=_0x5dc89d-0x0;var _0x3a18c2=_0x35aa[_0x5dc89d];return _0x3a18c2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa35a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa35a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa35a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xa35a('0x3'));var util=require(_0xa35a('0x4'));var path=require(_0xa35a('0x5'));var sox=require(_0xa35a('0x6'));var csv=require(_0xa35a('0x7'));var ejs=require(_0xa35a('0x8'));var fs=require('fs');var _=require(_0xa35a('0x9'));var squel=require('squel');var crypto=require(_0xa35a('0xa'));var jsforce=require(_0xa35a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa35a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa35a('0xc'));var authService=require(_0xa35a('0xd'));var qs=require(_0xa35a('0xe'));var as=require(_0xa35a('0xf'));var hardwareService=require(_0xa35a('0x10'));var logger=require(_0xa35a('0x11'))(_0xa35a('0x12'));var utils=require(_0xa35a('0x13'));var config=require(_0xa35a('0x14'));var db=require(_0xa35a('0x15'))['db'];function respondWithStatusCode(_0x10b862,_0x284665){_0x284665=_0x284665||0xcc;return function(_0x4fd49e){if(_0x4fd49e){return _0x10b862[_0xa35a('0x16')](_0x284665);}return _0x10b862['status'](_0x284665)[_0xa35a('0x17')]();};}function respondWithResult(_0x28d763,_0x36c02c){_0x36c02c=_0x36c02c||0xc8;return function(_0x42b756){if(_0x42b756){return _0x28d763['status'](_0x36c02c)[_0xa35a('0x18')](_0x42b756);}};}function respondWithFilteredResult(_0xf1d2bc,_0x378877){return function(_0x41e66e){if(_0x41e66e){var _0x1f6bd1=_0x41e66e[_0xa35a('0x19')],_0x7ea22d=_0x378877[_0xa35a('0x1a')],_0x18a905=_0x378877[_0xa35a('0x1a')]+_0x378877[_0xa35a('0x1b')],_0x4f5355;if(_0x18a905>=_0x1f6bd1){_0x18a905=_0x1f6bd1;_0x4f5355=0xc8;}else{_0x4f5355=0xce;}_0xf1d2bc['status'](_0x4f5355);return _0xf1d2bc[_0xa35a('0x1c')]('Content-Range',_0x7ea22d+'-'+_0x18a905+'/'+_0x1f6bd1)[_0xa35a('0x18')](_0x41e66e);}return null;};}function patchUpdates(_0x4a977f){return function(_0x580c49){try{jsonpatch[_0xa35a('0x1d')](_0x580c49,_0x4a977f,!![]);}catch(_0x3ba2cd){return BPromise[_0xa35a('0x1e')](_0x3ba2cd);}return _0x580c49[_0xa35a('0x1f')]();};}function saveUpdates(_0x2e1200,_0x2bc86c){return function(_0x2390f5){if(_0x2390f5){return _0x2390f5[_0xa35a('0x20')](_0x2e1200)[_0xa35a('0x21')](function(_0x4919eb){return _0x4919eb;});}return null;};}function removeEntity(_0x501f24,_0x3b37b8){return function(_0x295f3f){if(_0x295f3f){return _0x295f3f[_0xa35a('0x22')]()[_0xa35a('0x21')](function(){var _0x9e665=_0x295f3f[_0xa35a('0x23')]({'plain':!![]});var _0x102934=_0xa35a('0x24');return db[_0xa35a('0x25')][_0xa35a('0x22')]({'where':{'type':_0x102934,'resourceId':_0x9e665['id']}})[_0xa35a('0x21')](function(){return _0x295f3f;});})['then'](function(){_0x501f24[_0xa35a('0x26')](0xcc)[_0xa35a('0x17')]();});}};}function handleEntityNotFound(_0x1c3e8b,_0x343251){return function(_0x1354f8){if(!_0x1354f8){_0x1c3e8b[_0xa35a('0x16')](0x194);}return _0x1354f8;};}function handleError(_0x2046a4,_0x56ce4b){_0x56ce4b=_0x56ce4b||0x1f4;return function(_0x23b1c2){logger[_0xa35a('0x27')](_0x23b1c2[_0xa35a('0x28')]);if(_0x23b1c2[_0xa35a('0x29')]){delete _0x23b1c2[_0xa35a('0x29')];}_0x2046a4['status'](_0x56ce4b)[_0xa35a('0x2a')](_0x23b1c2);};}exports[_0xa35a('0x2b')]=function(_0x8b0d16,_0x24b9f5){var _0x422a94={},_0xea8a95={},_0xa2b747={'count':0x0,'rows':[]};var _0xa3e864=_['map'](db[_0xa35a('0x2c')][_0xa35a('0x2d')],function(_0x5ebcb1){return{'name':_0x5ebcb1[_0xa35a('0x2e')],'type':_0x5ebcb1[_0xa35a('0x2f')][_0xa35a('0x30')]};});_0xea8a95['model']=_[_0xa35a('0x31')](_0xa3e864,_0xa35a('0x29'));_0xea8a95[_0xa35a('0x32')]=_[_0xa35a('0x33')](_0x8b0d16[_0xa35a('0x32')]);_0xea8a95[_0xa35a('0x34')]=_['intersection'](_0xea8a95[_0xa35a('0x35')],_0xea8a95['query']);_0x422a94[_0xa35a('0x36')]=_[_0xa35a('0x37')](_0xea8a95[_0xa35a('0x35')],qs['fields'](_0x8b0d16['query']['fields']));_0x422a94['attributes']=_0x422a94[_0xa35a('0x36')][_0xa35a('0x38')]?_0x422a94[_0xa35a('0x36')]:_0xea8a95['model'];if(!_0x8b0d16[_0xa35a('0x32')][_0xa35a('0x39')](_0xa35a('0x3a'))){_0x422a94[_0xa35a('0x1b')]=qs['limit'](_0x8b0d16['query'][_0xa35a('0x1b')]);_0x422a94[_0xa35a('0x1a')]=qs[_0xa35a('0x1a')](_0x8b0d16[_0xa35a('0x32')][_0xa35a('0x1a')]);}_0x422a94[_0xa35a('0x3b')]=qs[_0xa35a('0x3c')](_0x8b0d16[_0xa35a('0x32')][_0xa35a('0x3c')]);_0x422a94[_0xa35a('0x3d')]=qs['filters'](_[_0xa35a('0x3e')](_0x8b0d16[_0xa35a('0x32')],_0xea8a95[_0xa35a('0x34')]),_0xa3e864);if(_0x8b0d16[_0xa35a('0x32')][_0xa35a('0x3f')]){_0x422a94[_0xa35a('0x3d')]=_[_0xa35a('0x40')](_0x422a94[_0xa35a('0x3d')],{'$or':_['map'](_0xa3e864,function(_0x4d6b6b){if(_0x4d6b6b[_0xa35a('0x2f')]!==_0xa35a('0x41')){var _0xabc4dc={};_0xabc4dc[_0x4d6b6b[_0xa35a('0x29')]]={'$like':'%'+_0x8b0d16[_0xa35a('0x32')][_0xa35a('0x3f')]+'%'};return _0xabc4dc;}})});}_0x422a94=_[_0xa35a('0x40')]({},_0x422a94,_0x8b0d16[_0xa35a('0x42')]);var _0x5c9e21={'where':_0x422a94[_0xa35a('0x3d')]};return db['Trigger'][_0xa35a('0x19')](_0x5c9e21)[_0xa35a('0x21')](function(_0x296d8c){_0xa2b747[_0xa35a('0x19')]=_0x296d8c;if(_0x8b0d16[_0xa35a('0x32')]['includeAll']){_0x422a94[_0xa35a('0x43')]=[{'all':!![]}];}return db['Trigger'][_0xa35a('0x44')](_0x422a94);})[_0xa35a('0x21')](function(_0x7ae390){_0xa2b747['rows']=_0x7ae390;return _0xa2b747;})[_0xa35a('0x21')](respondWithFilteredResult(_0x24b9f5,_0x422a94))[_0xa35a('0x45')](handleError(_0x24b9f5,null));};exports[_0xa35a('0x46')]=function(_0x18e1e5,_0x38790e){var _0x52903b={'raw':![],'where':{'id':_0x18e1e5[_0xa35a('0x47')]['id']}},_0x9e9ee6={};_0x9e9ee6[_0xa35a('0x35')]=_['keys'](db[_0xa35a('0x2c')][_0xa35a('0x2d')]);_0x9e9ee6[_0xa35a('0x32')]=_[_0xa35a('0x33')](_0x18e1e5[_0xa35a('0x32')]);_0x9e9ee6[_0xa35a('0x34')]=_[_0xa35a('0x37')](_0x9e9ee6[_0xa35a('0x35')],_0x9e9ee6[_0xa35a('0x32')]);_0x52903b[_0xa35a('0x36')]=_[_0xa35a('0x37')](_0x9e9ee6[_0xa35a('0x35')],qs[_0xa35a('0x48')](_0x18e1e5[_0xa35a('0x32')][_0xa35a('0x48')]));_0x52903b[_0xa35a('0x36')]=_0x52903b[_0xa35a('0x36')][_0xa35a('0x38')]?_0x52903b['attributes']:_0x9e9ee6[_0xa35a('0x35')];if(_0x18e1e5[_0xa35a('0x32')][_0xa35a('0x49')]){_0x52903b['include']=[{'all':!![]}];}_0x52903b=_[_0xa35a('0x40')]({},_0x52903b,_0x18e1e5[_0xa35a('0x42')]);return db['Trigger'][_0xa35a('0x4a')](_0x52903b)[_0xa35a('0x21')](handleEntityNotFound(_0x38790e,null))[_0xa35a('0x21')](respondWithResult(_0x38790e,null))[_0xa35a('0x45')](handleError(_0x38790e,null));};exports['create']=function(_0x436538,_0x43a256){return db[_0xa35a('0x2c')][_0xa35a('0x4b')](_0x436538[_0xa35a('0x4c')],{})[_0xa35a('0x21')](function(_0xb3d2b7){var _0x2a0cac=_0x436538[_0xa35a('0x4d')][_0xa35a('0x23')]({'plain':!![]});if(!_0x2a0cac)throw new Error(_0xa35a('0x4e'));if(_0x2a0cac['role']==='user'){var _0x43a883=_0xb3d2b7[_0xa35a('0x23')]({'plain':!![]});var _0x4ed650=_0xa35a('0x24');return db[_0xa35a('0x4f')][_0xa35a('0x4a')]({'where':{'name':_0x4ed650,'userProfileId':_0x2a0cac[_0xa35a('0x50')]},'raw':!![]})['then'](function(_0x4f1876){if(_0x4f1876&&_0x4f1876[_0xa35a('0x51')]===0x0){return db[_0xa35a('0x25')][_0xa35a('0x4b')]({'name':_0x43a883[_0xa35a('0x29')],'resourceId':_0x43a883['id'],'type':_0x4f1876[_0xa35a('0x29')],'sectionId':_0x4f1876['id']},{})['then'](function(){return _0xb3d2b7;});}else{return _0xb3d2b7;}})[_0xa35a('0x45')](function(_0x30de19){logger[_0xa35a('0x27')](_0xa35a('0x52'),_0x30de19);throw _0x30de19;});}return _0xb3d2b7;})[_0xa35a('0x21')](respondWithResult(_0x43a256,0xc9))[_0xa35a('0x45')](handleError(_0x43a256,null));};exports['update']=function(_0x4ffce0,_0x5b3562){if(_0x4ffce0['body']['id']){delete _0x4ffce0[_0xa35a('0x4c')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4ffce0['params']['id']}})['then'](handleEntityNotFound(_0x5b3562,null))[_0xa35a('0x21')](saveUpdates(_0x4ffce0[_0xa35a('0x4c')],null))['then'](respondWithResult(_0x5b3562,null))['catch'](handleError(_0x5b3562,null));};exports['destroy']=function(_0x1f0531,_0x8d3a8b){return db[_0xa35a('0x2c')]['find']({'where':{'id':_0x1f0531[_0xa35a('0x47')]['id']}})[_0xa35a('0x21')](handleEntityNotFound(_0x8d3a8b,null))[_0xa35a('0x21')](removeEntity(_0x8d3a8b,null))[_0xa35a('0x45')](handleError(_0x8d3a8b,null));};exports[_0xa35a('0x53')]=function(_0x1620ae,_0x33eff3,_0x28ff03){if(_0x1620ae[_0xa35a('0x4c')]['id']){delete _0x1620ae['body']['id'];}return db[_0xa35a('0x2c')][_0xa35a('0x4a')]({'where':{'id':_0x1620ae['params']['id']}})[_0xa35a('0x21')](handleEntityNotFound(_0x33eff3,null))[_0xa35a('0x21')](function(_0x5c588d){if(_0x5c588d){_0x1620ae[_0xa35a('0x4c')]['TriggerAllId']=_0x5c588d['id'];return db[_0xa35a('0x54')][_0xa35a('0x4b')](_0x1620ae[_0xa35a('0x4c')]);}})[_0xa35a('0x21')](respondWithResult(_0x33eff3,null))[_0xa35a('0x45')](handleError(_0x33eff3,null));};exports[_0xa35a('0x55')]=function(_0x39ec70,_0x538493,_0x11e1b8){if(_0x39ec70[_0xa35a('0x4c')]['id']){delete _0x39ec70[_0xa35a('0x4c')]['id'];}return db[_0xa35a('0x2c')][_0xa35a('0x4a')]({'where':{'id':_0x39ec70[_0xa35a('0x47')]['id']}})[_0xa35a('0x21')](handleEntityNotFound(_0x538493,null))[_0xa35a('0x21')](function(_0x1674ef){if(_0x1674ef){_0x39ec70[_0xa35a('0x4c')][_0xa35a('0x56')]=_0x1674ef['id'];return db['Condition'][_0xa35a('0x4b')](_0x39ec70[_0xa35a('0x4c')]);}})[_0xa35a('0x21')](respondWithResult(_0x538493,null))['catch'](handleError(_0x538493,null));};exports[_0xa35a('0x57')]=function(_0xe0b7e9,_0xca5b67,_0x50a8d3){var _0x2ed6b0={};var _0x10d338={};var _0x59d9e6;var _0x20a7b9;return db[_0xa35a('0x2c')][_0xa35a('0x58')]({'where':{'id':_0xe0b7e9['params']['id']}})['then'](handleEntityNotFound(_0xca5b67,null))[_0xa35a('0x21')](function(_0x3202f3){if(_0x3202f3){_0x59d9e6=_0x3202f3;_0x10d338[_0xa35a('0x35')]=_[_0xa35a('0x33')](db[_0xa35a('0x54')][_0xa35a('0x2d')]);_0x10d338['query']=_[_0xa35a('0x33')](_0xe0b7e9[_0xa35a('0x32')]);_0x10d338[_0xa35a('0x34')]=_[_0xa35a('0x37')](_0x10d338[_0xa35a('0x35')],_0x10d338[_0xa35a('0x32')]);_0x2ed6b0[_0xa35a('0x36')]=_[_0xa35a('0x37')](_0x10d338[_0xa35a('0x35')],qs[_0xa35a('0x48')](_0xe0b7e9[_0xa35a('0x32')][_0xa35a('0x48')]));_0x2ed6b0[_0xa35a('0x36')]=_0x2ed6b0[_0xa35a('0x36')]['length']?_0x2ed6b0['attributes']:_0x10d338[_0xa35a('0x35')];_0x2ed6b0['order']=qs[_0xa35a('0x3c')](_0xe0b7e9[_0xa35a('0x32')]['sort']);_0x2ed6b0['where']=qs[_0xa35a('0x34')](_[_0xa35a('0x3e')](_0xe0b7e9[_0xa35a('0x32')],_0x10d338['filters']));if(_0xe0b7e9[_0xa35a('0x32')][_0xa35a('0x3f')]){_0x2ed6b0[_0xa35a('0x3d')]=_[_0xa35a('0x40')](_0x2ed6b0[_0xa35a('0x3d')],{'$or':_['map'](_0x2ed6b0[_0xa35a('0x36')],function(_0x4130f){var _0x386c22={};_0x386c22[_0x4130f]={'$like':'%'+_0xe0b7e9[_0xa35a('0x32')]['filter']+'%'};return _0x386c22;})});}_0x2ed6b0=_[_0xa35a('0x40')]({},_0x2ed6b0,_0xe0b7e9[_0xa35a('0x42')]);return _0x59d9e6['getAllConditions'](_0x2ed6b0);}})[_0xa35a('0x21')](function(_0x225a8c){if(_0x225a8c){_0x20a7b9=_0x225a8c[_0xa35a('0x38')];if(!_0xe0b7e9[_0xa35a('0x32')][_0xa35a('0x39')](_0xa35a('0x3a'))){_0x2ed6b0[_0xa35a('0x1b')]=qs[_0xa35a('0x1b')](_0xe0b7e9[_0xa35a('0x32')][_0xa35a('0x1b')]);_0x2ed6b0[_0xa35a('0x1a')]=qs[_0xa35a('0x1a')](_0xe0b7e9[_0xa35a('0x32')][_0xa35a('0x1a')]);}return _0x59d9e6['getAllConditions'](_0x2ed6b0);}})[_0xa35a('0x21')](function(_0x5a5cd6){if(_0x5a5cd6){return _0x5a5cd6?{'count':_0x20a7b9,'rows':_0x5a5cd6}:null;}})[_0xa35a('0x21')](respondWithResult(_0xca5b67,null))['catch'](handleError(_0xca5b67,null));};exports[_0xa35a('0x59')]=function(_0x1bb1a6,_0x51df78,_0x3825ec){var _0x4b96af={};var _0x410f6a={};var _0x548290;var _0x8b2f19;return db[_0xa35a('0x2c')][_0xa35a('0x58')]({'where':{'id':_0x1bb1a6[_0xa35a('0x47')]['id']}})[_0xa35a('0x21')](handleEntityNotFound(_0x51df78,null))[_0xa35a('0x21')](function(_0x375659){if(_0x375659){_0x548290=_0x375659;_0x410f6a[_0xa35a('0x35')]=_['keys'](db[_0xa35a('0x54')][_0xa35a('0x2d')]);_0x410f6a[_0xa35a('0x32')]=_['keys'](_0x1bb1a6[_0xa35a('0x32')]);_0x410f6a[_0xa35a('0x34')]=_[_0xa35a('0x37')](_0x410f6a[_0xa35a('0x35')],_0x410f6a[_0xa35a('0x32')]);_0x4b96af[_0xa35a('0x36')]=_[_0xa35a('0x37')](_0x410f6a[_0xa35a('0x35')],qs[_0xa35a('0x48')](_0x1bb1a6[_0xa35a('0x32')][_0xa35a('0x48')]));_0x4b96af['attributes']=_0x4b96af['attributes']['length']?_0x4b96af['attributes']:_0x410f6a[_0xa35a('0x35')];_0x4b96af[_0xa35a('0x3b')]=qs[_0xa35a('0x3c')](_0x1bb1a6[_0xa35a('0x32')][_0xa35a('0x3c')]);_0x4b96af[_0xa35a('0x3d')]=qs['filters'](_[_0xa35a('0x3e')](_0x1bb1a6[_0xa35a('0x32')],_0x410f6a[_0xa35a('0x34')]));if(_0x1bb1a6['query'][_0xa35a('0x3f')]){_0x4b96af[_0xa35a('0x3d')]=_[_0xa35a('0x40')](_0x4b96af[_0xa35a('0x3d')],{'$or':_[_0xa35a('0x31')](_0x4b96af[_0xa35a('0x36')],function(_0x2689c1){var _0x62ebbb={};_0x62ebbb[_0x2689c1]={'$like':'%'+_0x1bb1a6[_0xa35a('0x32')][_0xa35a('0x3f')]+'%'};return _0x62ebbb;})});}_0x4b96af=_[_0xa35a('0x40')]({},_0x4b96af,_0x1bb1a6[_0xa35a('0x42')]);return _0x548290[_0xa35a('0x59')](_0x4b96af);}})[_0xa35a('0x21')](function(_0x5ba886){if(_0x5ba886){_0x8b2f19=_0x5ba886[_0xa35a('0x38')];if(!_0x1bb1a6[_0xa35a('0x32')]['hasOwnProperty']('nolimit')){_0x4b96af[_0xa35a('0x1b')]=qs[_0xa35a('0x1b')](_0x1bb1a6['query']['limit']);_0x4b96af['offset']=qs[_0xa35a('0x1a')](_0x1bb1a6[_0xa35a('0x32')][_0xa35a('0x1a')]);}return _0x548290[_0xa35a('0x59')](_0x4b96af);}})[_0xa35a('0x21')](function(_0x52c173){if(_0x52c173){return _0x52c173?{'count':_0x8b2f19,'rows':_0x52c173}:null;}})['then'](respondWithResult(_0x51df78,null))[_0xa35a('0x45')](handleError(_0x51df78,null));};exports[_0xa35a('0x5a')]=function(_0x397365,_0x393dd1,_0x4d904d){if(_0x397365[_0xa35a('0x4c')]['id']){delete _0x397365[_0xa35a('0x4c')]['id'];}return db[_0xa35a('0x2c')][_0xa35a('0x4a')]({'where':{'id':_0x397365[_0xa35a('0x47')]['id']}})[_0xa35a('0x21')](handleEntityNotFound(_0x393dd1,null))['then'](function(_0x14f708){if(_0x14f708){_0x397365[_0xa35a('0x4c')][_0xa35a('0x5b')]=_0x14f708['id'];return db[_0xa35a('0x5c')][_0xa35a('0x4b')](_0x397365[_0xa35a('0x4c')]);}})[_0xa35a('0x21')](respondWithResult(_0x393dd1,null))[_0xa35a('0x45')](handleError(_0x393dd1,null));};exports[_0xa35a('0x5d')]=function(_0x1683e3,_0x3c24ed,_0x3e0df9){var _0x437de4={};var _0x57e2f5={};var _0x48e8ca;var _0x54802f;return db[_0xa35a('0x2c')]['findOne']({'where':{'id':_0x1683e3[_0xa35a('0x47')]['id']}})[_0xa35a('0x21')](handleEntityNotFound(_0x3c24ed,null))[_0xa35a('0x21')](function(_0x5092aa){if(_0x5092aa){_0x48e8ca=_0x5092aa;_0x57e2f5[_0xa35a('0x35')]=_[_0xa35a('0x33')](db[_0xa35a('0x5c')]['rawAttributes']);_0x57e2f5[_0xa35a('0x32')]=_[_0xa35a('0x33')](_0x1683e3[_0xa35a('0x32')]);_0x57e2f5[_0xa35a('0x34')]=_[_0xa35a('0x37')](_0x57e2f5['model'],_0x57e2f5[_0xa35a('0x32')]);_0x437de4[_0xa35a('0x36')]=_[_0xa35a('0x37')](_0x57e2f5[_0xa35a('0x35')],qs['fields'](_0x1683e3[_0xa35a('0x32')][_0xa35a('0x48')]));_0x437de4['attributes']=_0x437de4[_0xa35a('0x36')][_0xa35a('0x38')]?_0x437de4['attributes']:_0x57e2f5[_0xa35a('0x35')];_0x437de4[_0xa35a('0x3b')]=qs[_0xa35a('0x3c')](_0x1683e3[_0xa35a('0x32')]['sort']);_0x437de4[_0xa35a('0x3d')]=qs[_0xa35a('0x34')](_[_0xa35a('0x3e')](_0x1683e3[_0xa35a('0x32')],_0x57e2f5[_0xa35a('0x34')]));if(_0x1683e3[_0xa35a('0x32')][_0xa35a('0x3f')]){_0x437de4[_0xa35a('0x3d')]=_[_0xa35a('0x40')](_0x437de4[_0xa35a('0x3d')],{'$or':_[_0xa35a('0x31')](_0x437de4[_0xa35a('0x36')],function(_0x30f16f){var _0x582deb={};_0x582deb[_0x30f16f]={'$like':'%'+_0x1683e3['query']['filter']+'%'};return _0x582deb;})});}_0x437de4=_[_0xa35a('0x40')]({},_0x437de4,_0x1683e3[_0xa35a('0x42')]);return _0x48e8ca[_0xa35a('0x5d')](_0x437de4);}})[_0xa35a('0x21')](function(_0x4a9a1b){if(_0x4a9a1b){_0x54802f=_0x4a9a1b[_0xa35a('0x38')];if(!_0x1683e3[_0xa35a('0x32')][_0xa35a('0x39')]('nolimit')){_0x437de4[_0xa35a('0x1b')]=qs[_0xa35a('0x1b')](_0x1683e3[_0xa35a('0x32')][_0xa35a('0x1b')]);_0x437de4[_0xa35a('0x1a')]=qs[_0xa35a('0x1a')](_0x1683e3[_0xa35a('0x32')]['offset']);}return _0x48e8ca['getActions'](_0x437de4);}})[_0xa35a('0x21')](function(_0x3a3cf9){if(_0x3a3cf9){return _0x3a3cf9?{'count':_0x54802f,'rows':_0x3a3cf9}:null;}})[_0xa35a('0x21')](respondWithResult(_0x3c24ed,null))[_0xa35a('0x45')](handleError(_0x3c24ed,null));}; \ No newline at end of file +var _0x489b=['role','user','UserProfileSection','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','Trigger','count','includeAll','findAll','rows','catch','keys','rawAttributes','include','options','find','create','body'];(function(_0x4f09c2,_0x476952){var _0x30be0d=function(_0x21fb05){while(--_0x21fb05){_0x4f09c2['push'](_0x4f09c2['shift']());}};_0x30be0d(++_0x476952);}(_0x489b,0xc7));var _0xb489=function(_0x13cd41,_0x321ea8){_0x13cd41=_0x13cd41-0x0;var _0x502380=_0x489b[_0x13cd41];return _0x502380;};'use strict';var pdf=require(_0xb489('0x0'));var emlformat=require(_0xb489('0x1'));var rimraf=require(_0xb489('0x2'));var zipdir=require(_0xb489('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb489('0x4'));var moment=require(_0xb489('0x5'));var BPromise=require(_0xb489('0x6'));var Mustache=require('mustache');var util=require(_0xb489('0x7'));var path=require(_0xb489('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb489('0x9'));var fs=require('fs');var _=require(_0xb489('0xa'));var squel=require(_0xb489('0xb'));var crypto=require(_0xb489('0xc'));var jsforce=require(_0xb489('0xd'));var deskjs=require(_0xb489('0xe'));var toCsv=require(_0xb489('0xf'));var querystring=require(_0xb489('0x10'));var Papa=require('papaparse');var Redis=require(_0xb489('0x11'));var authService=require(_0xb489('0x12'));var qs=require(_0xb489('0x13'));var as=require(_0xb489('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb489('0x15'))('api');var utils=require(_0xb489('0x16'));var config=require('../../config/environment');var db=require(_0xb489('0x17'))['db'];function respondWithStatusCode(_0xb702b7,_0x2fe66a){_0x2fe66a=_0x2fe66a||0xcc;return function(_0xde4cc7){if(_0xde4cc7){return _0xb702b7[_0xb489('0x18')](_0x2fe66a);}return _0xb702b7[_0xb489('0x19')](_0x2fe66a)[_0xb489('0x1a')]();};}function respondWithResult(_0x37b1ac,_0x3b9e54){_0x3b9e54=_0x3b9e54||0xc8;return function(_0x19f537){if(_0x19f537){return _0x37b1ac['status'](_0x3b9e54)[_0xb489('0x1b')](_0x19f537);}};}function respondWithFilteredResult(_0x3ba0c7,_0x50c62f){return function(_0x4118e3){if(_0x4118e3){var _0x49b204=_0x4118e3['count'],_0x4efc62=_0x50c62f[_0xb489('0x1c')],_0x41ae07=_0x50c62f['offset']+_0x50c62f[_0xb489('0x1d')],_0x1d1189;if(_0x41ae07>=_0x49b204){_0x41ae07=_0x49b204;_0x1d1189=0xc8;}else{_0x1d1189=0xce;}_0x3ba0c7[_0xb489('0x19')](_0x1d1189);return _0x3ba0c7[_0xb489('0x1e')]('Content-Range',_0x4efc62+'-'+_0x41ae07+'/'+_0x49b204)[_0xb489('0x1b')](_0x4118e3);}return null;};}function patchUpdates(_0x269a03){return function(_0x458bf0){try{jsonpatch[_0xb489('0x1f')](_0x458bf0,_0x269a03,!![]);}catch(_0x480cbf){return BPromise[_0xb489('0x20')](_0x480cbf);}return _0x458bf0[_0xb489('0x21')]();};}function saveUpdates(_0x42a70f,_0x54f833){return function(_0x11af87){if(_0x11af87){return _0x11af87[_0xb489('0x22')](_0x42a70f)[_0xb489('0x23')](function(_0x35a7a8){return _0x35a7a8;});}return null;};}function removeEntity(_0x43c889,_0x336c4e){return function(_0x4b6dd5){if(_0x4b6dd5){return _0x4b6dd5[_0xb489('0x24')]()[_0xb489('0x23')](function(){var _0x395769=_0x4b6dd5[_0xb489('0x25')]({'plain':!![]});var _0x3fd24c='Triggers';return db[_0xb489('0x26')]['destroy']({'where':{'type':_0x3fd24c,'resourceId':_0x395769['id']}})['then'](function(){return _0x4b6dd5;});})[_0xb489('0x23')](function(){_0x43c889[_0xb489('0x19')](0xcc)[_0xb489('0x1a')]();});}};}function handleEntityNotFound(_0x3ab0b7,_0x18219a){return function(_0x30de46){if(!_0x30de46){_0x3ab0b7[_0xb489('0x18')](0x194);}return _0x30de46;};}function handleError(_0x1de656,_0x3e28fa){_0x3e28fa=_0x3e28fa||0x1f4;return function(_0x1671f4){logger[_0xb489('0x27')](_0x1671f4['stack']);if(_0x1671f4[_0xb489('0x28')]){delete _0x1671f4[_0xb489('0x28')];}_0x1de656[_0xb489('0x19')](_0x3e28fa)[_0xb489('0x29')](_0x1671f4);};}exports[_0xb489('0x2a')]=function(_0x2c81b7,_0x46f001){var _0x10bcba={},_0xfd4637={},_0x4067a8={'count':0x0,'rows':[]};var _0x1873a0=_[_0xb489('0x2b')](db['Trigger']['rawAttributes'],function(_0x519e09){return{'name':_0x519e09[_0xb489('0x2c')],'type':_0x519e09[_0xb489('0x2d')][_0xb489('0x2e')]};});_0xfd4637[_0xb489('0x2f')]=_['map'](_0x1873a0,_0xb489('0x28'));_0xfd4637['query']=_['keys'](_0x2c81b7[_0xb489('0x30')]);_0xfd4637[_0xb489('0x31')]=_[_0xb489('0x32')](_0xfd4637[_0xb489('0x2f')],_0xfd4637[_0xb489('0x30')]);_0x10bcba[_0xb489('0x33')]=_[_0xb489('0x32')](_0xfd4637[_0xb489('0x2f')],qs['fields'](_0x2c81b7[_0xb489('0x30')][_0xb489('0x34')]));_0x10bcba[_0xb489('0x33')]=_0x10bcba['attributes'][_0xb489('0x35')]?_0x10bcba[_0xb489('0x33')]:_0xfd4637['model'];if(!_0x2c81b7[_0xb489('0x30')]['hasOwnProperty']('nolimit')){_0x10bcba[_0xb489('0x1d')]=qs['limit'](_0x2c81b7['query'][_0xb489('0x1d')]);_0x10bcba[_0xb489('0x1c')]=qs['offset'](_0x2c81b7[_0xb489('0x30')][_0xb489('0x1c')]);}_0x10bcba[_0xb489('0x36')]=qs[_0xb489('0x37')](_0x2c81b7[_0xb489('0x30')][_0xb489('0x37')]);_0x10bcba[_0xb489('0x38')]=qs[_0xb489('0x31')](_[_0xb489('0x39')](_0x2c81b7['query'],_0xfd4637[_0xb489('0x31')]),_0x1873a0);if(_0x2c81b7[_0xb489('0x30')][_0xb489('0x3a')]){_0x10bcba['where']=_[_0xb489('0x3b')](_0x10bcba[_0xb489('0x38')],{'$or':_[_0xb489('0x2b')](_0x1873a0,function(_0x7584da){if(_0x7584da[_0xb489('0x2d')]!==_0xb489('0x3c')){var _0x107b56={};_0x107b56[_0x7584da[_0xb489('0x28')]]={'$like':'%'+_0x2c81b7[_0xb489('0x30')][_0xb489('0x3a')]+'%'};return _0x107b56;}})});}_0x10bcba=_[_0xb489('0x3b')]({},_0x10bcba,_0x2c81b7['options']);var _0x25e315={'where':_0x10bcba[_0xb489('0x38')]};return db[_0xb489('0x3d')][_0xb489('0x3e')](_0x25e315)['then'](function(_0x5d7a46){_0x4067a8['count']=_0x5d7a46;if(_0x2c81b7[_0xb489('0x30')][_0xb489('0x3f')]){_0x10bcba['include']=[{'all':!![]}];}return db[_0xb489('0x3d')][_0xb489('0x40')](_0x10bcba);})[_0xb489('0x23')](function(_0x2a9f13){_0x4067a8[_0xb489('0x41')]=_0x2a9f13;return _0x4067a8;})[_0xb489('0x23')](respondWithFilteredResult(_0x46f001,_0x10bcba))[_0xb489('0x42')](handleError(_0x46f001,null));};exports['show']=function(_0x28cd6c,_0x23d9a2){var _0x55d39a={'raw':![],'where':{'id':_0x28cd6c['params']['id']}},_0x43868b={};_0x43868b[_0xb489('0x2f')]=_[_0xb489('0x43')](db['Trigger'][_0xb489('0x44')]);_0x43868b['query']=_[_0xb489('0x43')](_0x28cd6c[_0xb489('0x30')]);_0x43868b[_0xb489('0x31')]=_['intersection'](_0x43868b[_0xb489('0x2f')],_0x43868b[_0xb489('0x30')]);_0x55d39a[_0xb489('0x33')]=_['intersection'](_0x43868b[_0xb489('0x2f')],qs[_0xb489('0x34')](_0x28cd6c[_0xb489('0x30')]['fields']));_0x55d39a[_0xb489('0x33')]=_0x55d39a[_0xb489('0x33')]['length']?_0x55d39a['attributes']:_0x43868b[_0xb489('0x2f')];if(_0x28cd6c[_0xb489('0x30')][_0xb489('0x3f')]){_0x55d39a[_0xb489('0x45')]=[{'all':!![]}];}_0x55d39a=_['merge']({},_0x55d39a,_0x28cd6c[_0xb489('0x46')]);return db[_0xb489('0x3d')][_0xb489('0x47')](_0x55d39a)[_0xb489('0x23')](handleEntityNotFound(_0x23d9a2,null))[_0xb489('0x23')](respondWithResult(_0x23d9a2,null))[_0xb489('0x42')](handleError(_0x23d9a2,null));};exports[_0xb489('0x48')]=function(_0x356a9e,_0x1eb315){return db['Trigger']['create'](_0x356a9e[_0xb489('0x49')],{})[_0xb489('0x23')](function(_0x6aff99){var _0x2ed6e9=_0x356a9e['user'][_0xb489('0x25')]({'plain':!![]});if(!_0x2ed6e9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ed6e9[_0xb489('0x4a')]===_0xb489('0x4b')){var _0xc5052a=_0x6aff99[_0xb489('0x25')]({'plain':!![]});var _0x49f01c='Triggers';return db[_0xb489('0x4c')]['find']({'where':{'name':_0x49f01c,'userProfileId':_0x2ed6e9['userProfileId']},'raw':!![]})[_0xb489('0x23')](function(_0x43dcdd){if(_0x43dcdd&&_0x43dcdd['autoAssociation']===0x0){return db['UserProfileResource'][_0xb489('0x48')]({'name':_0xc5052a[_0xb489('0x28')],'resourceId':_0xc5052a['id'],'type':_0x43dcdd[_0xb489('0x28')],'sectionId':_0x43dcdd['id']},{})[_0xb489('0x23')](function(){return _0x6aff99;});}else{return _0x6aff99;}})['catch'](function(_0x2ac360){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ac360);throw _0x2ac360;});}return _0x6aff99;})[_0xb489('0x23')](respondWithResult(_0x1eb315,0xc9))[_0xb489('0x42')](handleError(_0x1eb315,null));};exports[_0xb489('0x22')]=function(_0x181fdf,_0x258049){if(_0x181fdf[_0xb489('0x49')]['id']){delete _0x181fdf['body']['id'];}return db[_0xb489('0x3d')][_0xb489('0x47')]({'where':{'id':_0x181fdf[_0xb489('0x4d')]['id']}})[_0xb489('0x23')](handleEntityNotFound(_0x258049,null))[_0xb489('0x23')](saveUpdates(_0x181fdf[_0xb489('0x49')],null))['then'](respondWithResult(_0x258049,null))[_0xb489('0x42')](handleError(_0x258049,null));};exports[_0xb489('0x24')]=function(_0x5f3853,_0x12dd01){return db['Trigger']['find']({'where':{'id':_0x5f3853[_0xb489('0x4d')]['id']}})['then'](handleEntityNotFound(_0x12dd01,null))[_0xb489('0x23')](removeEntity(_0x12dd01,null))[_0xb489('0x42')](handleError(_0x12dd01,null));};exports[_0xb489('0x4e')]=function(_0x4a82c7,_0x4412c6,_0x2288f7){if(_0x4a82c7[_0xb489('0x49')]['id']){delete _0x4a82c7[_0xb489('0x49')]['id'];}return db[_0xb489('0x3d')]['find']({'where':{'id':_0x4a82c7[_0xb489('0x4d')]['id']}})[_0xb489('0x23')](handleEntityNotFound(_0x4412c6,null))['then'](function(_0x48de7a){if(_0x48de7a){_0x4a82c7[_0xb489('0x49')][_0xb489('0x4f')]=_0x48de7a['id'];return db[_0xb489('0x50')][_0xb489('0x48')](_0x4a82c7[_0xb489('0x49')]);}})[_0xb489('0x23')](respondWithResult(_0x4412c6,null))[_0xb489('0x42')](handleError(_0x4412c6,null));};exports[_0xb489('0x51')]=function(_0x5f3db5,_0x2c4099,_0x139210){if(_0x5f3db5['body']['id']){delete _0x5f3db5[_0xb489('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5f3db5[_0xb489('0x4d')]['id']}})[_0xb489('0x23')](handleEntityNotFound(_0x2c4099,null))[_0xb489('0x23')](function(_0x437ce8){if(_0x437ce8){_0x5f3db5[_0xb489('0x49')][_0xb489('0x52')]=_0x437ce8['id'];return db[_0xb489('0x50')][_0xb489('0x48')](_0x5f3db5['body']);}})[_0xb489('0x23')](respondWithResult(_0x2c4099,null))[_0xb489('0x42')](handleError(_0x2c4099,null));};exports[_0xb489('0x53')]=function(_0x1c2686,_0x439220,_0x75a759){var _0x24fe50={};var _0x4d68eb={};var _0x4b7293;var _0x5cb644;return db[_0xb489('0x3d')][_0xb489('0x54')]({'where':{'id':_0x1c2686[_0xb489('0x4d')]['id']}})[_0xb489('0x23')](handleEntityNotFound(_0x439220,null))[_0xb489('0x23')](function(_0x345803){if(_0x345803){_0x4b7293=_0x345803;_0x4d68eb[_0xb489('0x2f')]=_[_0xb489('0x43')](db[_0xb489('0x50')][_0xb489('0x44')]);_0x4d68eb[_0xb489('0x30')]=_[_0xb489('0x43')](_0x1c2686[_0xb489('0x30')]);_0x4d68eb[_0xb489('0x31')]=_['intersection'](_0x4d68eb[_0xb489('0x2f')],_0x4d68eb[_0xb489('0x30')]);_0x24fe50[_0xb489('0x33')]=_[_0xb489('0x32')](_0x4d68eb[_0xb489('0x2f')],qs[_0xb489('0x34')](_0x1c2686[_0xb489('0x30')][_0xb489('0x34')]));_0x24fe50[_0xb489('0x33')]=_0x24fe50[_0xb489('0x33')]['length']?_0x24fe50[_0xb489('0x33')]:_0x4d68eb['model'];_0x24fe50[_0xb489('0x36')]=qs[_0xb489('0x37')](_0x1c2686['query']['sort']);_0x24fe50['where']=qs[_0xb489('0x31')](_[_0xb489('0x39')](_0x1c2686[_0xb489('0x30')],_0x4d68eb[_0xb489('0x31')]));if(_0x1c2686['query'][_0xb489('0x3a')]){_0x24fe50[_0xb489('0x38')]=_[_0xb489('0x3b')](_0x24fe50[_0xb489('0x38')],{'$or':_[_0xb489('0x2b')](_0x24fe50[_0xb489('0x33')],function(_0x195789){var _0x2dfa06={};_0x2dfa06[_0x195789]={'$like':'%'+_0x1c2686[_0xb489('0x30')][_0xb489('0x3a')]+'%'};return _0x2dfa06;})});}_0x24fe50=_[_0xb489('0x3b')]({},_0x24fe50,_0x1c2686[_0xb489('0x46')]);return _0x4b7293['getAllConditions'](_0x24fe50);}})[_0xb489('0x23')](function(_0x3545d4){if(_0x3545d4){_0x5cb644=_0x3545d4[_0xb489('0x35')];if(!_0x1c2686[_0xb489('0x30')]['hasOwnProperty'](_0xb489('0x55'))){_0x24fe50['limit']=qs['limit'](_0x1c2686[_0xb489('0x30')]['limit']);_0x24fe50['offset']=qs[_0xb489('0x1c')](_0x1c2686[_0xb489('0x30')][_0xb489('0x1c')]);}return _0x4b7293[_0xb489('0x53')](_0x24fe50);}})[_0xb489('0x23')](function(_0x3e8373){if(_0x3e8373){return _0x3e8373?{'count':_0x5cb644,'rows':_0x3e8373}:null;}})[_0xb489('0x23')](respondWithResult(_0x439220,null))[_0xb489('0x42')](handleError(_0x439220,null));};exports[_0xb489('0x56')]=function(_0x1356e1,_0x443a6e,_0x1bc9e9){var _0x2662ee={};var _0x30575b={};var _0x1ece5f;var _0x2a1d3d;return db[_0xb489('0x3d')][_0xb489('0x54')]({'where':{'id':_0x1356e1[_0xb489('0x4d')]['id']}})[_0xb489('0x23')](handleEntityNotFound(_0x443a6e,null))[_0xb489('0x23')](function(_0x88505d){if(_0x88505d){_0x1ece5f=_0x88505d;_0x30575b[_0xb489('0x2f')]=_[_0xb489('0x43')](db[_0xb489('0x50')]['rawAttributes']);_0x30575b[_0xb489('0x30')]=_[_0xb489('0x43')](_0x1356e1[_0xb489('0x30')]);_0x30575b[_0xb489('0x31')]=_[_0xb489('0x32')](_0x30575b[_0xb489('0x2f')],_0x30575b[_0xb489('0x30')]);_0x2662ee[_0xb489('0x33')]=_[_0xb489('0x32')](_0x30575b[_0xb489('0x2f')],qs[_0xb489('0x34')](_0x1356e1[_0xb489('0x30')][_0xb489('0x34')]));_0x2662ee['attributes']=_0x2662ee[_0xb489('0x33')][_0xb489('0x35')]?_0x2662ee[_0xb489('0x33')]:_0x30575b[_0xb489('0x2f')];_0x2662ee['order']=qs['sort'](_0x1356e1['query'][_0xb489('0x37')]);_0x2662ee[_0xb489('0x38')]=qs[_0xb489('0x31')](_['pick'](_0x1356e1['query'],_0x30575b[_0xb489('0x31')]));if(_0x1356e1[_0xb489('0x30')][_0xb489('0x3a')]){_0x2662ee[_0xb489('0x38')]=_[_0xb489('0x3b')](_0x2662ee[_0xb489('0x38')],{'$or':_[_0xb489('0x2b')](_0x2662ee[_0xb489('0x33')],function(_0x15c4ea){var _0x192b9={};_0x192b9[_0x15c4ea]={'$like':'%'+_0x1356e1[_0xb489('0x30')][_0xb489('0x3a')]+'%'};return _0x192b9;})});}_0x2662ee=_[_0xb489('0x3b')]({},_0x2662ee,_0x1356e1['options']);return _0x1ece5f[_0xb489('0x56')](_0x2662ee);}})[_0xb489('0x23')](function(_0x4c1fa8){if(_0x4c1fa8){_0x2a1d3d=_0x4c1fa8[_0xb489('0x35')];if(!_0x1356e1[_0xb489('0x30')]['hasOwnProperty'](_0xb489('0x55'))){_0x2662ee[_0xb489('0x1d')]=qs[_0xb489('0x1d')](_0x1356e1[_0xb489('0x30')][_0xb489('0x1d')]);_0x2662ee[_0xb489('0x1c')]=qs[_0xb489('0x1c')](_0x1356e1[_0xb489('0x30')][_0xb489('0x1c')]);}return _0x1ece5f[_0xb489('0x56')](_0x2662ee);}})[_0xb489('0x23')](function(_0x3f891a){if(_0x3f891a){return _0x3f891a?{'count':_0x2a1d3d,'rows':_0x3f891a}:null;}})[_0xb489('0x23')](respondWithResult(_0x443a6e,null))[_0xb489('0x42')](handleError(_0x443a6e,null));};exports[_0xb489('0x57')]=function(_0x44dc85,_0x39f341,_0x59116a){if(_0x44dc85[_0xb489('0x49')]['id']){delete _0x44dc85[_0xb489('0x49')]['id'];}return db[_0xb489('0x3d')][_0xb489('0x47')]({'where':{'id':_0x44dc85[_0xb489('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39f341,null))[_0xb489('0x23')](function(_0x46a708){if(_0x46a708){_0x44dc85[_0xb489('0x49')][_0xb489('0x58')]=_0x46a708['id'];return db[_0xb489('0x59')][_0xb489('0x48')](_0x44dc85[_0xb489('0x49')]);}})[_0xb489('0x23')](respondWithResult(_0x39f341,null))[_0xb489('0x42')](handleError(_0x39f341,null));};exports[_0xb489('0x5a')]=function(_0x1fc810,_0x598757,_0x318a16){var _0x39059a={};var _0x4ba278={};var _0x428af8;var _0x47e7f1;return db['Trigger'][_0xb489('0x54')]({'where':{'id':_0x1fc810['params']['id']}})[_0xb489('0x23')](handleEntityNotFound(_0x598757,null))[_0xb489('0x23')](function(_0x577db1){if(_0x577db1){_0x428af8=_0x577db1;_0x4ba278[_0xb489('0x2f')]=_[_0xb489('0x43')](db[_0xb489('0x59')]['rawAttributes']);_0x4ba278[_0xb489('0x30')]=_[_0xb489('0x43')](_0x1fc810[_0xb489('0x30')]);_0x4ba278[_0xb489('0x31')]=_[_0xb489('0x32')](_0x4ba278[_0xb489('0x2f')],_0x4ba278[_0xb489('0x30')]);_0x39059a[_0xb489('0x33')]=_[_0xb489('0x32')](_0x4ba278['model'],qs['fields'](_0x1fc810[_0xb489('0x30')][_0xb489('0x34')]));_0x39059a[_0xb489('0x33')]=_0x39059a[_0xb489('0x33')][_0xb489('0x35')]?_0x39059a[_0xb489('0x33')]:_0x4ba278['model'];_0x39059a['order']=qs[_0xb489('0x37')](_0x1fc810['query']['sort']);_0x39059a['where']=qs['filters'](_[_0xb489('0x39')](_0x1fc810[_0xb489('0x30')],_0x4ba278[_0xb489('0x31')]));if(_0x1fc810['query']['filter']){_0x39059a['where']=_[_0xb489('0x3b')](_0x39059a[_0xb489('0x38')],{'$or':_[_0xb489('0x2b')](_0x39059a[_0xb489('0x33')],function(_0x5b3647){var _0x17f2be={};_0x17f2be[_0x5b3647]={'$like':'%'+_0x1fc810[_0xb489('0x30')][_0xb489('0x3a')]+'%'};return _0x17f2be;})});}_0x39059a=_[_0xb489('0x3b')]({},_0x39059a,_0x1fc810[_0xb489('0x46')]);return _0x428af8['getActions'](_0x39059a);}})['then'](function(_0x5a1344){if(_0x5a1344){_0x47e7f1=_0x5a1344[_0xb489('0x35')];if(!_0x1fc810['query']['hasOwnProperty'](_0xb489('0x55'))){_0x39059a[_0xb489('0x1d')]=qs[_0xb489('0x1d')](_0x1fc810[_0xb489('0x30')][_0xb489('0x1d')]);_0x39059a[_0xb489('0x1c')]=qs[_0xb489('0x1c')](_0x1fc810['query'][_0xb489('0x1c')]);}return _0x428af8[_0xb489('0x5a')](_0x39059a);}})['then'](function(_0x59e5fa){if(_0x59e5fa){return _0x59e5fa?{'count':_0x47e7f1,'rows':_0x59e5fa}:null;}})[_0xb489('0x23')](respondWithResult(_0x598757,null))['catch'](handleError(_0x598757,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 4fc6356..48a9f96 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 _0xc068=['path','../../config/environment','./trigger.attributes','exports','define','tools_triggers','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4937aa,_0x1852b9){var _0x3e6f5f=function(_0x5259c6){while(--_0x5259c6){_0x4937aa['push'](_0x4937aa['shift']());}};_0x3e6f5f(++_0x1852b9);}(_0xc068,0x72));var _0x8c06=function(_0x34b005,_0x2ca8f8){_0x34b005=_0x34b005-0x0;var _0x4b7392=_0xc068[_0x34b005];return _0x4b7392;};'use strict';var _=require(_0x8c06('0x0'));var util=require(_0x8c06('0x1'));var logger=require(_0x8c06('0x2'))('api');var moment=require(_0x8c06('0x3'));var BPromise=require(_0x8c06('0x4'));var rp=require(_0x8c06('0x5'));var fs=require('fs');var path=require(_0x8c06('0x6'));var rimraf=require('rimraf');var config=require(_0x8c06('0x7'));var attributes=require(_0x8c06('0x8'));module[_0x8c06('0x9')]=function(_0x5741dc,_0x23cb33){return _0x5741dc[_0x8c06('0xa')]('Trigger',attributes,{'tableName':_0x8c06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd501=['rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4561a1,_0x223505){var _0x418381=function(_0x434f56){while(--_0x434f56){_0x4561a1['push'](_0x4561a1['shift']());}};_0x418381(++_0x223505);}(_0xd501,0x158));var _0x1d50=function(_0x1c9b6,_0x3afeca){_0x1c9b6=_0x1c9b6-0x0;var _0x14de14=_0xd501[_0x1c9b6];return _0x14de14;};'use strict';var _=require(_0x1d50('0x0'));var util=require(_0x1d50('0x1'));var logger=require(_0x1d50('0x2'))(_0x1d50('0x3'));var moment=require(_0x1d50('0x4'));var BPromise=require(_0x1d50('0x5'));var rp=require(_0x1d50('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d50('0x7'));var config=require(_0x1d50('0x8'));var attributes=require(_0x1d50('0x9'));module[_0x1d50('0xa')]=function(_0x255601,_0x528b99){return _0x255601['define'](_0x1d50('0xb'),attributes,{'tableName':_0x1d50('0xc'),'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 e81e29a..f99f8f2 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 _0xf7b4=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','find','ShowTrigger','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x121ea1,_0x1ecc13){var _0x5654bf=function(_0x488ee0){while(--_0x488ee0){_0x121ea1['push'](_0x121ea1['shift']());}};_0x5654bf(++_0x1ecc13);}(_0xf7b4,0x152));var _0x4f7b=function(_0xa12109,_0xe3b565){_0xa12109=_0xa12109-0x0;var _0x204d38=_0xf7b4[_0xa12109];return _0x204d38;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7b('0x1'));var rs=require(_0x4f7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f7b('0x3'));var logger=require(_0x4f7b('0x4'))(_0x4f7b('0x5'));var config=require(_0x4f7b('0x6'));var jayson=require(_0x4f7b('0x7'));var client=jayson[_0x4f7b('0x8')][_0x4f7b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ad135,_0x173784,_0x351036){return new BPromise(function(_0x36ea9c,_0x3ef6e1){return client[_0x4f7b('0xa')](_0x3ad135,_0x351036)['then'](function(_0x433563){logger[_0x4f7b('0xb')]('Trigger,\x20%s,\x20%s',_0x173784,_0x4f7b('0xc'));logger[_0x4f7b('0xd')](_0x4f7b('0xe'),_0x173784,_0x4f7b('0xc'),JSON[_0x4f7b('0xf')](_0x433563));if(_0x433563['error']){if(_0x433563[_0x4f7b('0x10')]['code']===0x1f4){logger['error'](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x3ef6e1(_0x433563[_0x4f7b('0x10')]['message']);}logger[_0x4f7b('0x10')](_0x4f7b('0x11'),_0x173784,_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);return _0x36ea9c(_0x433563[_0x4f7b('0x10')][_0x4f7b('0x12')]);}else{logger[_0x4f7b('0xb')](_0x4f7b('0x11'),_0x173784,_0x4f7b('0xc'));_0x36ea9c(_0x433563[_0x4f7b('0x13')][_0x4f7b('0x12')]);}})[_0x4f7b('0x14')](function(_0x50a161){logger[_0x4f7b('0x10')]('Trigger,\x20%s,\x20%s',_0x173784,_0x50a161);_0x3ef6e1(_0x50a161);});});}exports['GetTrigger']=function(_0x24e5cf){var _0x3813da=this;return new Promise(function(_0x519d90,_0x2b34c9){return db[_0x4f7b('0x15')][_0x4f7b('0x16')]({'raw':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x24e5cf['options']?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'limit':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf[_0x4f7b('0x17')][_0x4f7b('0x1b')]||null:null,'include':_0x24e5cf[_0x4f7b('0x17')]?_0x24e5cf['options'][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x24e5cf[_0x4f7b('0x17')]['include'],function(_0x150f57){return{'model':db[_0x150f57[_0x4f7b('0x1e')]],'as':_0x150f57['as'],'attributes':_0x150f57['attributes'],'include':_0x150f57[_0x4f7b('0x1c')]?_['map'](_0x150f57[_0x4f7b('0x1c')],function(_0x2429be){return{'model':db[_0x2429be[_0x4f7b('0x1e')]],'as':_0x2429be['as'],'attributes':_0x2429be[_0x4f7b('0x1a')],'include':_0x2429be[_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x2429be[_0x4f7b('0x1c')],function(_0x3ad769){return{'model':db[_0x3ad769['model']],'as':_0x3ad769['as'],'attributes':_0x3ad769[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x311675){logger['info'](_0x4f7b('0x20'),_0x24e5cf);logger[_0x4f7b('0xd')](_0x4f7b('0x20'),_0x24e5cf,JSON[_0x4f7b('0xf')](_0x311675));_0x519d90(_0x311675);})[_0x4f7b('0x14')](function(_0x4ebffa){logger[_0x4f7b('0x10')](_0x4f7b('0x20'),_0x4ebffa[_0x4f7b('0x12')],_0x24e5cf);_0x2b34c9(_0x3813da['error'](0x1f4,_0x4ebffa[_0x4f7b('0x12')]));});});};exports['ShowTrigger']=function(_0x4e4828){var _0x1a2346=this;return new Promise(function(_0x52a5b1,_0x1aad4b){return db[_0x4f7b('0x15')][_0x4f7b('0x21')]({'raw':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x19')]||null:null,'attributes':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1a')]||null:null,'include':_0x4e4828[_0x4f7b('0x17')]?_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')]?_[_0x4f7b('0x1d')](_0x4e4828[_0x4f7b('0x17')][_0x4f7b('0x1c')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x4f7b('0x1e')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x4f7b('0x1a')],'include':_0x35f1ed[_0x4f7b('0x1c')]?_['map'](_0x35f1ed[_0x4f7b('0x1c')],function(_0x5127a2){return{'model':db[_0x5127a2[_0x4f7b('0x1e')]],'as':_0x5127a2['as'],'attributes':_0x5127a2[_0x4f7b('0x1a')],'include':_0x5127a2['include']?_[_0x4f7b('0x1d')](_0x5127a2[_0x4f7b('0x1c')],function(_0x1347b6){return{'model':db[_0x1347b6['model']],'as':_0x1347b6['as'],'attributes':_0x1347b6[_0x4f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4f7b('0x1f')](function(_0x446f6e){logger[_0x4f7b('0xb')](_0x4f7b('0x22'),_0x4e4828);logger[_0x4f7b('0xd')](_0x4f7b('0x22'),_0x4e4828,JSON['stringify'](_0x446f6e));_0x52a5b1(_0x446f6e);})[_0x4f7b('0x14')](function(_0x486187){logger[_0x4f7b('0x10')](_0x4f7b('0x22'),_0x486187[_0x4f7b('0x12')],_0x4e4828);_0x1aad4b(_0x1a2346['error'](0x1f4,_0x486187[_0x4f7b('0x12')]));});});}; \ No newline at end of file +var _0x9348=['http','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','Trigger','findAll','options','raw','attributes','limit','include','map','model','then','GetTrigger','catch','ShowTrigger','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x19055c,_0x3c048f){var _0x20ff7c=function(_0x46f647){while(--_0x46f647){_0x19055c['push'](_0x19055c['shift']());}};_0x20ff7c(++_0x3c048f);}(_0x9348,0x10d));var _0x8934=function(_0x325c33,_0x6b3d83){_0x325c33=_0x325c33-0x0;var _0x1829e4=_0x9348[_0x325c33];return _0x1829e4;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('Trigger,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});}exports['GetTrigger']=function(_0x47f25e){var _0x597eed=this;return new Promise(function(_0x2ff9ce,_0x51f9ed){return db[_0x8934('0x16')][_0x8934('0x17')]({'raw':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x19')]===undefined?!![]:![]:!![],'where':_0x47f25e['options']?_0x47f25e[_0x8934('0x18')]['where']||null:null,'attributes':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x1a')]||null:null,'limit':_0x47f25e[_0x8934('0x18')]?_0x47f25e[_0x8934('0x18')][_0x8934('0x1b')]||null:null,'include':_0x47f25e[_0x8934('0x18')]?_0x47f25e['options'][_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x47f25e[_0x8934('0x18')][_0x8934('0x1c')],function(_0x43b89a){return{'model':db[_0x43b89a['model']],'as':_0x43b89a['as'],'attributes':_0x43b89a[_0x8934('0x1a')],'include':_0x43b89a[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x43b89a['include'],function(_0x16cfc2){return{'model':db[_0x16cfc2['model']],'as':_0x16cfc2['as'],'attributes':_0x16cfc2[_0x8934('0x1a')],'include':_0x16cfc2[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x16cfc2['include'],function(_0x1fd5eb){return{'model':db[_0x1fd5eb[_0x8934('0x1e')]],'as':_0x1fd5eb['as'],'attributes':_0x1fd5eb[_0x8934('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8934('0x1f')](function(_0x4b5780){logger[_0x8934('0x14')](_0x8934('0x20'),_0x47f25e);logger[_0x8934('0xd')](_0x8934('0x20'),_0x47f25e,JSON[_0x8934('0x10')](_0x4b5780));_0x2ff9ce(_0x4b5780);})[_0x8934('0x21')](function(_0x3f328a){logger[_0x8934('0x11')](_0x8934('0x20'),_0x3f328a[_0x8934('0x13')],_0x47f25e);_0x51f9ed(_0x597eed['error'](0x1f4,_0x3f328a[_0x8934('0x13')]));});});};exports[_0x8934('0x22')]=function(_0x54d28d){var _0x2aa18e=this;return new Promise(function(_0x3d60f9,_0x1a17b5){return db[_0x8934('0x16')]['find']({'raw':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')][_0x8934('0x19')]===undefined?!![]:![]:!![],'where':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')]['where']||null:null,'attributes':_0x54d28d[_0x8934('0x18')]?_0x54d28d['options']['attributes']||null:null,'include':_0x54d28d[_0x8934('0x18')]?_0x54d28d[_0x8934('0x18')][_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x54d28d['options'][_0x8934('0x1c')],function(_0x22aebe){return{'model':db[_0x22aebe[_0x8934('0x1e')]],'as':_0x22aebe['as'],'attributes':_0x22aebe[_0x8934('0x1a')],'include':_0x22aebe[_0x8934('0x1c')]?_['map'](_0x22aebe[_0x8934('0x1c')],function(_0x1ea0cd){return{'model':db[_0x1ea0cd['model']],'as':_0x1ea0cd['as'],'attributes':_0x1ea0cd['attributes'],'include':_0x1ea0cd[_0x8934('0x1c')]?_[_0x8934('0x1d')](_0x1ea0cd['include'],function(_0x519273){return{'model':db[_0x519273[_0x8934('0x1e')]],'as':_0x519273['as'],'attributes':_0x519273[_0x8934('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8934('0x1f')](function(_0x207ad4){logger[_0x8934('0x14')](_0x8934('0x22'),_0x54d28d);logger[_0x8934('0xd')](_0x8934('0x22'),_0x54d28d,JSON[_0x8934('0x10')](_0x207ad4));_0x3d60f9(_0x207ad4);})[_0x8934('0x21')](function(_0x46611c){logger['error'](_0x8934('0x22'),_0x46611c[_0x8934('0x13')],_0x54d28d);_0x1a17b5(_0x2aa18e['error'](0x1f4,_0x46611c[_0x8934('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6f50686..477e436 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 _0x0a9a=['clone','post','create','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','/:id/clone'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x0a9a,0x183));var _0xa0a9=function(_0x21be7e,_0x338493){_0x21be7e=_0x21be7e-0x0;var _0x3ec789=_0x0a9a[_0x21be7e];return _0x3ec789;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var auth=require(_0xa0a9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa0a9('0x5'));var controller=require(_0xa0a9('0x6'));router['get']('/',auth[_0xa0a9('0x7')](),controller[_0xa0a9('0x8')]);router[_0xa0a9('0x9')](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xb')]);router['post'](_0xa0a9('0xc'),auth[_0xa0a9('0x7')](),controller[_0xa0a9('0xd')]);router[_0xa0a9('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0a9('0xf')]);router[_0xa0a9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa0a9('0x11')]);router[_0xa0a9('0x12')]('/:id',auth[_0xa0a9('0x7')](),controller['destroy']);module[_0xa0a9('0x13')]=router; \ No newline at end of file +var _0xee14=['index','/:id','isAuthenticated','show','post','/:id/clone','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee14,0x13a));var _0x4ee1=function(_0x17e8d7,_0x52efc8){_0x17e8d7=_0x17e8d7-0x0;var _0x4971bc=_0xee14[_0x17e8d7];return _0x4971bc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var auth=require(_0x4ee1('0x4'));var interaction=require(_0x4ee1('0x5'));var config=require(_0x4ee1('0x6'));var controller=require(_0x4ee1('0x7'));router[_0x4ee1('0x8')]('/',auth['isAuthenticated'](),controller[_0x4ee1('0x9')]);router['get'](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0xd')](_0x4ee1('0xe'),auth[_0x4ee1('0xb')](),controller['clone']);router[_0x4ee1('0xd')]('/',auth[_0x4ee1('0xb')](),controller['create']);router[_0x4ee1('0xf')](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x10')]);router['delete'](_0x4ee1('0xa'),auth[_0x4ee1('0xb')](),controller[_0x4ee1('0x11')]);module[_0x4ee1('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9fc774c..69c6fc9 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 _0xcfbb=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','pai','active','actpass','dynamic','update','update,nonat','BOOLEAN','exports','friend','user','peer','STRING','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport'];(function(_0x13b2d5,_0x200638){var _0xb173fa=function(_0x8829df){while(--_0x8829df){_0x13b2d5['push'](_0x13b2d5['shift']());}};_0xb173fa(++_0x200638);}(_0xcfbb,0x153));var _0xbcfb=function(_0x10b7a5,_0xd3f792){_0x10b7a5=_0x10b7a5-0x0;var _0x1764b9=_0xcfbb[_0x10b7a5];return _0x1764b9;};'use strict';var Sequelize=require('sequelize');module[_0xbcfb('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xbcfb('0x1'),_0xbcfb('0x2'),_0xbcfb('0x3')),'allowNull':![],'defaultValue':_0xbcfb('0x1')},'context':{'type':Sequelize[_0xbcfb('0x4')],'allowNull':![],'defaultValue':_0xbcfb('0x5')},'callingpres':{'type':Sequelize[_0xbcfb('0x6')]('ALLOWED_NOT_SCREENED',_0xbcfb('0x7'),_0xbcfb('0x8'),_0xbcfb('0x9'),_0xbcfb('0xa'),'PROHIB_PASSED_SCREEN',_0xbcfb('0xb'),_0xbcfb('0xc'))},'deny':{'type':Sequelize[_0xbcfb('0x4')]},'permit':{'type':Sequelize[_0xbcfb('0x4')]},'secret':{'type':Sequelize[_0xbcfb('0x4')]},'md5secret':{'type':Sequelize[_0xbcfb('0x4')]},'remotesecret':{'type':Sequelize[_0xbcfb('0x4')]},'transport':{'type':Sequelize[_0xbcfb('0x4')],'defaultValue':_0xbcfb('0xd'),'set':function(_0x2da40c){this[_0xbcfb('0xe')]('transport',_0x2da40c?_0x2da40c[_0xbcfb('0xf')](','):null);},'get':function(){return this[_0xbcfb('0x10')](_0xbcfb('0x11'))?this[_0xbcfb('0x10')]('transport')[_0xbcfb('0x12')](','):null;},'comment':_0xbcfb('0x13')},'dtmfmode':{'type':Sequelize['ENUM'](_0xbcfb('0x14'),_0xbcfb('0x15'),_0xbcfb('0x16'),'inband',_0xbcfb('0x17')),'defaultValue':_0xbcfb('0x14')},'directmedia':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no',_0xbcfb('0x19'),'update',_0xbcfb('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xbcfb('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbcfb('0x4')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xbcfb('0x4')],'defaultValue':_0xbcfb('0x1b'),'set':function(_0x5e4e68){this['setDataValue'](_0xbcfb('0x1c'),_0x5e4e68?_0x5e4e68[_0xbcfb('0xf')](','):null);},'get':function(){return this[_0xbcfb('0x10')](_0xbcfb('0x1c'))?this[_0xbcfb('0x10')](_0xbcfb('0x1c'))[_0xbcfb('0x12')](','):null;},'comment':_0xbcfb('0x1d')},'callgroup':{'type':Sequelize[_0xbcfb('0x4')]},'namedcallgroup':{'type':Sequelize[_0xbcfb('0x4')]},'pickupgroup':{'type':Sequelize[_0xbcfb('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xbcfb('0x4')]},'language':{'type':Sequelize[_0xbcfb('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbcfb('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xbcfb('0x4')],'defaultValue':_0xbcfb('0x1e')},'allow':{'type':Sequelize[_0xbcfb('0x4')],'allowNull':![],'defaultValue':_0xbcfb('0x1f'),'set':function(_0x5ed591){this[_0xbcfb('0xe')](_0xbcfb('0x20'),_0x5ed591?_0x5ed591['join'](';'):_0xbcfb('0x1f'));},'get':function(){return this['getDataValue'](_0xbcfb('0x20'))?this[_0xbcfb('0x10')](_0xbcfb('0x20'))[_0xbcfb('0x12')](';'):null;},'comment':_0xbcfb('0x21')},'autoframing':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no')},'insecure':{'type':Sequelize[_0xbcfb('0x4')],'defaultValue':_0xbcfb('0x22'),'set':function(_0x30588b){this[_0xbcfb('0xe')](_0xbcfb('0x23'),_0x30588b?_0x30588b[_0xbcfb('0xf')](','):null);},'get':function(){return this[_0xbcfb('0x10')](_0xbcfb('0x23'))?this[_0xbcfb('0x10')](_0xbcfb('0x23'))[_0xbcfb('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xbcfb('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbcfb('0x6')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xbcfb('0x18'),'no',_0xbcfb('0x24'))},'promiscredir':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xbcfb('0x18'),'no')},'accountcode':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'setvar':{'type':Sequelize[_0xbcfb('0x4')]},'callerid':{'type':Sequelize[_0xbcfb('0x4')],'defaultValue':_0xbcfb('0x26')},'amaflags':{'type':Sequelize[_0xbcfb('0x4')]},'callcounter':{'type':Sequelize['ENUM'](_0xbcfb('0x18'),'no'),'defaultValue':_0xbcfb('0x18')},'busylevel':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xbcfb('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no',_0xbcfb('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xbcfb('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0xbcfb('0x4')]},'session_timers':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x28'),_0xbcfb('0x29'),_0xbcfb('0x2a'))},'session_expires':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xbcfb('0x2b')),'defaultValue':_0xbcfb('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xbcfb('0x4')]},'regexten':{'type':Sequelize[_0xbcfb('0x4')]},'fromdomain':{'type':Sequelize[_0xbcfb('0x4')]},'fromuser':{'type':Sequelize[_0xbcfb('0x4')]},'port':{'type':Sequelize[_0xbcfb('0x25')](0x5)},'qualify':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no'),'defaultValue':_0xbcfb('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xbcfb('0x4')]},'rtptimeout':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xbcfb('0x6')]('yes','no',_0xbcfb('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbcfb('0x4')]},'callbackextension':{'type':Sequelize[_0xbcfb('0x4')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xbcfb('0x4')]},'contactdeny':{'type':Sequelize[_0xbcfb('0x4')]},'contactacl':{'type':Sequelize[_0xbcfb('0x4')]},'unsolicited_mailbox':{'type':Sequelize[_0xbcfb('0x4')]},'use_q850_reason':{'type':Sequelize[_0xbcfb('0x4')]},'maxforwards':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xbcfb('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xbcfb('0x18'),'no')},'force_avp':{'type':Sequelize[_0xbcfb('0x6')]('yes','no')},'icesupport':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xbcfb('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xbcfb('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0xbcfb('0x4')]},'dtlscipher':{'type':Sequelize[_0xbcfb('0x4')]},'dtlscafile':{'type':Sequelize[_0xbcfb('0x4')]},'dtlscapath':{'type':Sequelize[_0xbcfb('0x4')]},'dtlssetup':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x2d'),'passive',_0xbcfb('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xbcfb('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xbcfb('0x4')]},'recordofffeature':{'type':Sequelize[_0xbcfb('0x4')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xbcfb('0x6')](_0xbcfb('0x18'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xbcfb('0x4')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbcfb('0x4')],'defaultValue':_0xbcfb('0x2f')},'canreinvite':{'type':Sequelize[_0xbcfb('0x6')]('yes','no','nonat',_0xbcfb('0x30'),_0xbcfb('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xbcfb('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xaa32=['ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','info','shortinfo','inband','rfc2833','yes','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','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]','INTEGER','\x22\x22\x20<>','accept','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','STRING','name','ENUM','friend','user','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x47408c,_0x16984f){var _0x553932=function(_0x596d73){while(--_0x596d73){_0x47408c['push'](_0x47408c['shift']());}};_0x553932(++_0x16984f);}(_0xaa32,0x169));var _0x2aa3=function(_0x48671c,_0x2b44a3){_0x48671c=_0x48671c-0x0;var _0x32d5e5=_0xaa32[_0x48671c];return _0x32d5e5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2aa3('0x0')],'allowNull':![],'unique':_0x2aa3('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x3'),_0x2aa3('0x4'),'peer'),'allowNull':![],'defaultValue':_0x2aa3('0x3')},'context':{'type':Sequelize[_0x2aa3('0x0')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x5'),_0x2aa3('0x6'),'ALLOWED_FAILED_SCREEN',_0x2aa3('0x7'),'PROHIB_NOT_SCREENED',_0x2aa3('0x8'),_0x2aa3('0x9'),'PROHIB')},'deny':{'type':Sequelize[_0x2aa3('0x0')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x2aa3('0x0')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x2aa3('0xa'),'set':function(_0x1220eb){this[_0x2aa3('0xb')](_0x2aa3('0xc'),_0x1220eb?_0x1220eb[_0x2aa3('0xd')](','):null);},'get':function(){return this[_0x2aa3('0xe')](_0x2aa3('0xc'))?this[_0x2aa3('0xe')](_0x2aa3('0xc'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2aa3('0x2')]('rfc2833',_0x2aa3('0xf'),_0x2aa3('0x10'),_0x2aa3('0x11'),'auto'),'defaultValue':_0x2aa3('0x12')},'directmedia':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no','nonat','update',_0x2aa3('0x14')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2aa3('0x0')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2aa3('0x0')],'defaultValue':_0x2aa3('0x15'),'set':function(_0x52b2b5){this[_0x2aa3('0xb')](_0x2aa3('0x16'),_0x52b2b5?_0x52b2b5[_0x2aa3('0xd')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x2aa3('0xe')](_0x2aa3('0x16'))['split'](','):null;},'comment':_0x2aa3('0x17')},'callgroup':{'type':Sequelize[_0x2aa3('0x0')]},'namedcallgroup':{'type':Sequelize[_0x2aa3('0x0')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x2aa3('0x0')]},'language':{'type':Sequelize[_0x2aa3('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2aa3('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2aa3('0x18')},'allow':{'type':Sequelize[_0x2aa3('0x0')],'allowNull':![],'defaultValue':_0x2aa3('0x19'),'set':function(_0x2d0cc7){this[_0x2aa3('0xb')](_0x2aa3('0x1a'),_0x2d0cc7?_0x2d0cc7[_0x2aa3('0xd')](';'):_0x2aa3('0x19'));},'get':function(){return this[_0x2aa3('0xe')]('allow')?this[_0x2aa3('0xe')](_0x2aa3('0x1a'))[_0x2aa3('0x1b')](';'):null;},'comment':_0x2aa3('0x1c')},'autoframing':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'insecure':{'type':Sequelize[_0x2aa3('0x0')],'defaultValue':_0x2aa3('0x1d'),'set':function(_0x326a9c){this[_0x2aa3('0xb')](_0x2aa3('0x1e'),_0x326a9c?_0x326a9c['join'](','):null);},'get':function(){return this[_0x2aa3('0xe')](_0x2aa3('0x1e'))?this[_0x2aa3('0xe')]('insecure')[_0x2aa3('0x1b')](','):null;},'comment':_0x2aa3('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0x2aa3('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2aa3('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'accountcode':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'setvar':{'type':Sequelize[_0x2aa3('0x0')]},'callerid':{'type':Sequelize[_0x2aa3('0x0')],'defaultValue':_0x2aa3('0x21')},'amaflags':{'type':Sequelize[_0x2aa3('0x0')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x2aa3('0x13')},'busylevel':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'allowtransfer':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'subscribecontext':{'type':Sequelize[_0x2aa3('0x0')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'mailbox':{'type':Sequelize[_0x2aa3('0x0')]},'session_timers':{'type':Sequelize['ENUM'](_0x2aa3('0x22'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x2aa3('0x2')]('uac',_0x2aa3('0x23')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2aa3('0x0')]},'regexten':{'type':Sequelize[_0x2aa3('0x0')]},'fromdomain':{'type':Sequelize[_0x2aa3('0x0')]},'fromuser':{'type':Sequelize[_0x2aa3('0x0')]},'port':{'type':Sequelize[_0x2aa3('0x20')](0x5)},'qualify':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2aa3('0x0')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x2aa3('0x2')]('yes','no',_0x2aa3('0x24')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'timerb':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'contactpermit':{'type':Sequelize[_0x2aa3('0x0')]},'contactdeny':{'type':Sequelize[_0x2aa3('0x0')]},'contactacl':{'type':Sequelize[_0x2aa3('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0x2aa3('0x0')]},'use_q850_reason':{'type':Sequelize[_0x2aa3('0x0')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'force_avp':{'type':Sequelize[_0x2aa3('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no',_0x2aa3('0x25'),_0x2aa3('0x26'))},'dtlsrekey':{'type':Sequelize[_0x2aa3('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2aa3('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x2aa3('0x0')]},'dtlscipher':{'type':Sequelize[_0x2aa3('0x0')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0x2aa3('0x27'),_0x2aa3('0x28'),_0x2aa3('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2aa3('0x0')]},'recordofffeature':{'type':Sequelize[_0x2aa3('0x0')]},'call_limit':{'type':Sequelize[_0x2aa3('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no')},'subscribemwi':{'type':Sequelize[_0x2aa3('0x2')]('yes','no')},'vmexten':{'type':Sequelize[_0x2aa3('0x0')]},'mohinterpret':{'type':Sequelize[_0x2aa3('0x0')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2aa3('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2aa3('0x0')],'defaultValue':_0x2aa3('0x2a')},'canreinvite':{'type':Sequelize[_0x2aa3('0x2')](_0x2aa3('0x13'),'no','nonat',_0x2aa3('0x2b'),_0x2aa3('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x2aa3('0x0')]},'active':{'type':Sequelize[_0x2aa3('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2aa3('0x0')],'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 0670a0c..4cf825d 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 _0xda3f=['create','user','UserProfileSection','find','autoAssociation','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','registry','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','/etc/asterisk/sip_xcally_trunks.conf','Reload','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','../../mysqldb','jayson/promise','http','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~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','set','apply','reject','save','destroy','get','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','Trunk','include','findAll','catch','show','keys','length','clone','params','includeAll','createdAt','updatedAt','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda3f,0xec));var _0xfda3=function(_0x224448,_0xcdac1){_0x224448=_0x224448-0x0;var _0x469cb3=_0xda3f[_0x224448];return _0x469cb3;};'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 db=require(_0xfda3('0x15'))['db'];var jayson=require(_0xfda3('0x16'));var client=jayson['client'][_0xfda3('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5d7d5b,_0x3fd031,_0x1e7a55){if(_0x1e7a55){var _0x4929fa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4929fa['test'](_0x3fd031)){return _0x5d7d5b;}else{throw new db['Sequelize'][(_0xfda3('0x18'))](_0xfda3('0x19'));}}else{return _0x5d7d5b;}}function respondWithRpcPromise(_0x5ea793,_0x57a229,_0x533365,_0x80ea80){return new BPromise(function(_0x474707,_0x249dc6){var _0x3d8bcd=_0x80ea80||client;return _0x3d8bcd[_0xfda3('0x1a')](_0x5ea793,_0x533365)[_0xfda3('0x1b')](function(_0x2aadcb){logger[_0xfda3('0x1c')](_0xfda3('0x1d'),_0x57a229,_0xfda3('0x1e'));logger['debug'](_0xfda3('0x1f'),_0x57a229,_0xfda3('0x1e'),JSON[_0xfda3('0x20')](_0x2aadcb));if(_0x2aadcb[_0xfda3('0x21')]){if(_0x2aadcb['error'][_0xfda3('0x22')]===0x1f4){logger[_0xfda3('0x21')](_0xfda3('0x1d'),_0x57a229,_0x2aadcb['error']['message']);return _0x249dc6(_0x2aadcb[_0xfda3('0x21')][_0xfda3('0x23')]);}logger[_0xfda3('0x21')]('Trunk,\x20%s,\x20%s',_0x57a229,_0x2aadcb[_0xfda3('0x21')][_0xfda3('0x23')]);return _0x474707(_0x2aadcb[_0xfda3('0x21')][_0xfda3('0x23')]);}else{logger[_0xfda3('0x1c')](_0xfda3('0x1d'),_0x57a229,_0xfda3('0x1e'));_0x474707(_0x2aadcb[_0xfda3('0x24')][_0xfda3('0x23')]);}})['catch'](function(_0x82341b){logger[_0xfda3('0x21')](_0xfda3('0x1d'),_0x57a229,_0x82341b);_0x249dc6(_0x82341b);});});}function respondWithStatusCode(_0x4ae9b9,_0x45a977){_0x45a977=_0x45a977||0xcc;return function(_0x39e246){if(_0x39e246){return _0x4ae9b9[_0xfda3('0x25')](_0x45a977);}return _0x4ae9b9[_0xfda3('0x26')](_0x45a977)[_0xfda3('0x27')]();};}function respondWithResult(_0xad9f7b,_0x514d2a){_0x514d2a=_0x514d2a||0xc8;return function(_0x3c6d7d){if(_0x3c6d7d){return _0xad9f7b[_0xfda3('0x26')](_0x514d2a)[_0xfda3('0x28')](_0x3c6d7d);}};}function respondWithFilteredResult(_0x1f2884,_0x33ffd4){return function(_0x5704c7){if(_0x5704c7){var _0x3c1549=_0x5704c7[_0xfda3('0x29')],_0x4101b1=_0x33ffd4[_0xfda3('0x2a')],_0x301509=_0x33ffd4[_0xfda3('0x2a')]+_0x33ffd4['limit'],_0x474992;if(_0x301509>=_0x3c1549){_0x301509=_0x3c1549;_0x474992=0xc8;}else{_0x474992=0xce;}_0x1f2884['status'](_0x474992);return _0x1f2884[_0xfda3('0x2b')]('Content-Range',_0x4101b1+'-'+_0x301509+'/'+_0x3c1549)['json'](_0x5704c7);}return null;};}function patchUpdates(_0x16b4a2){return function(_0x2a5971){try{jsonpatch[_0xfda3('0x2c')](_0x2a5971,_0x16b4a2,!![]);}catch(_0xd7e1d6){return BPromise[_0xfda3('0x2d')](_0xd7e1d6);}return _0x2a5971[_0xfda3('0x2e')]();};}function saveUpdates(_0x404531,_0xd6b6d7){return function(_0x261a81){if(_0x261a81){return _0x261a81['update'](_0x404531)[_0xfda3('0x1b')](function(_0x43b063){return _0x43b063;});}return null;};}function removeEntity(_0xacc8c,_0x227357){return function(_0x2b64a1){if(_0x2b64a1){return _0x2b64a1[_0xfda3('0x2f')]()[_0xfda3('0x1b')](function(){var _0x210763=_0x2b64a1[_0xfda3('0x30')]({'plain':!![]});var _0x59a1c9='Trunks';return db[_0xfda3('0x31')][_0xfda3('0x2f')]({'where':{'type':_0x59a1c9,'resourceId':_0x210763['id']}})['then'](function(){return _0x2b64a1;});})[_0xfda3('0x1b')](function(){_0xacc8c[_0xfda3('0x26')](0xcc)[_0xfda3('0x27')]();});}};}function handleEntityNotFound(_0x52ee98,_0x1d92a9){return function(_0x378bf0){if(!_0x378bf0){_0x52ee98[_0xfda3('0x25')](0x194);}return _0x378bf0;};}function handleError(_0x3151e6,_0x1ab9b1){_0x1ab9b1=_0x1ab9b1||0x1f4;return function(_0x5ae650){logger[_0xfda3('0x21')](_0x5ae650[_0xfda3('0x32')]);if(_0x5ae650[_0xfda3('0x33')]){delete _0x5ae650['name'];}_0x3151e6[_0xfda3('0x26')](_0x1ab9b1)['send'](_0x5ae650);};}exports[_0xfda3('0x34')]=function(_0x5469df,_0x43a58a){var _0x36a506={},_0x21c5cc={},_0x2074e7={'count':0x0,'rows':[]};var _0x151f32=_[_0xfda3('0x35')](db['Trunk'][_0xfda3('0x36')],function(_0xbfbc01){return{'name':_0xbfbc01[_0xfda3('0x37')],'type':_0xbfbc01[_0xfda3('0x38')]['key']};});_0x21c5cc[_0xfda3('0x39')]=_[_0xfda3('0x35')](_0x151f32,_0xfda3('0x33'));_0x21c5cc['query']=_['keys'](_0x5469df[_0xfda3('0x3a')]);_0x21c5cc[_0xfda3('0x3b')]=_[_0xfda3('0x3c')](_0x21c5cc[_0xfda3('0x39')],_0x21c5cc[_0xfda3('0x3a')]);_0x36a506[_0xfda3('0x3d')]=_[_0xfda3('0x3c')](_0x21c5cc[_0xfda3('0x39')],qs[_0xfda3('0x3e')](_0x5469df[_0xfda3('0x3a')]['fields']));_0x36a506[_0xfda3('0x3d')]=_0x36a506[_0xfda3('0x3d')]['length']?_0x36a506[_0xfda3('0x3d')]:_0x21c5cc['model'];if(!_0x5469df['query']['hasOwnProperty'](_0xfda3('0x3f'))){_0x36a506[_0xfda3('0x40')]=qs[_0xfda3('0x40')](_0x5469df[_0xfda3('0x3a')]['limit']);_0x36a506[_0xfda3('0x2a')]=qs[_0xfda3('0x2a')](_0x5469df[_0xfda3('0x3a')][_0xfda3('0x2a')]);}_0x36a506['order']=qs[_0xfda3('0x41')](_0x5469df[_0xfda3('0x3a')][_0xfda3('0x41')]);_0x36a506['where']=qs['filters'](_[_0xfda3('0x42')](_0x5469df[_0xfda3('0x3a')],_0x21c5cc[_0xfda3('0x3b')]),_0x151f32);if(_0x5469df[_0xfda3('0x3a')][_0xfda3('0x43')]){_0x36a506[_0xfda3('0x44')]=_[_0xfda3('0x45')](_0x36a506[_0xfda3('0x44')],{'$or':_[_0xfda3('0x35')](_0x151f32,function(_0x3ed533){if(_0x3ed533[_0xfda3('0x38')]!==_0xfda3('0x46')){var _0x1b892b={};_0x1b892b[_0x3ed533[_0xfda3('0x33')]]={'$like':'%'+_0x5469df['query']['filter']+'%'};return _0x1b892b;}})});}_0x36a506=_[_0xfda3('0x45')]({},_0x36a506,_0x5469df[_0xfda3('0x47')]);var _0x2c4fbd={'where':_0x36a506[_0xfda3('0x44')]};return db[_0xfda3('0x48')][_0xfda3('0x29')](_0x2c4fbd)[_0xfda3('0x1b')](function(_0x125f5a){_0x2074e7[_0xfda3('0x29')]=_0x125f5a;if(_0x5469df[_0xfda3('0x3a')]['includeAll']){_0x36a506[_0xfda3('0x49')]=[{'all':!![]}];}return db[_0xfda3('0x48')][_0xfda3('0x4a')](_0x36a506);})[_0xfda3('0x1b')](function(_0x26496a){_0x2074e7['rows']=_0x26496a;return _0x2074e7;})[_0xfda3('0x1b')](respondWithFilteredResult(_0x43a58a,_0x36a506))[_0xfda3('0x4b')](handleError(_0x43a58a,null));};exports[_0xfda3('0x4c')]=function(_0x4bcd2b,_0x187402){var _0x39c96f={'raw':![],'where':{'id':_0x4bcd2b['params']['id']}},_0x11addf={};_0x11addf[_0xfda3('0x39')]=_[_0xfda3('0x4d')](db[_0xfda3('0x48')][_0xfda3('0x36')]);_0x11addf[_0xfda3('0x3a')]=_['keys'](_0x4bcd2b[_0xfda3('0x3a')]);_0x11addf['filters']=_[_0xfda3('0x3c')](_0x11addf['model'],_0x11addf[_0xfda3('0x3a')]);_0x39c96f[_0xfda3('0x3d')]=_[_0xfda3('0x3c')](_0x11addf[_0xfda3('0x39')],qs['fields'](_0x4bcd2b[_0xfda3('0x3a')][_0xfda3('0x3e')]));_0x39c96f[_0xfda3('0x3d')]=_0x39c96f[_0xfda3('0x3d')][_0xfda3('0x4e')]?_0x39c96f[_0xfda3('0x3d')]:_0x11addf[_0xfda3('0x39')];if(_0x4bcd2b['query']['includeAll']){_0x39c96f[_0xfda3('0x49')]=[{'all':!![]}];}_0x39c96f=_[_0xfda3('0x45')]({},_0x39c96f,_0x4bcd2b[_0xfda3('0x47')]);return db['Trunk']['find'](_0x39c96f)[_0xfda3('0x1b')](handleEntityNotFound(_0x187402,null))[_0xfda3('0x1b')](respondWithResult(_0x187402,null))[_0xfda3('0x4b')](handleError(_0x187402,null));};exports[_0xfda3('0x4f')]=function(_0x2fcbe7,_0x4bc976){var _0xb3353b={'where':{'id':_0x2fcbe7[_0xfda3('0x50')]['id']}},_0x2a30e8={};_0x2a30e8[_0xfda3('0x39')]=_[_0xfda3('0x4d')](db[_0xfda3('0x48')][_0xfda3('0x36')]);_0xb3353b[_0xfda3('0x3d')]=_[_0xfda3('0x3c')](_0x2a30e8[_0xfda3('0x39')],qs[_0xfda3('0x3e')](_0x2fcbe7[_0xfda3('0x3a')]['fields']));_0xb3353b[_0xfda3('0x3d')]=_0xb3353b[_0xfda3('0x3d')][_0xfda3('0x4e')]?_0xb3353b[_0xfda3('0x3d')]:_0x2a30e8[_0xfda3('0x39')];if(_0x2fcbe7[_0xfda3('0x3a')][_0xfda3('0x51')]){_0xb3353b['include']=[{'all':!![]}];}_0xb3353b=_['merge']({},_0xb3353b,_0x2fcbe7[_0xfda3('0x47')]);return db[_0xfda3('0x48')]['find'](_0xb3353b)[_0xfda3('0x1b')](handleEntityNotFound(_0x4bc976,null))[_0xfda3('0x1b')](function(_0x2a5efe){if(_0x2a5efe){var _0x38dbc7=_0x2a5efe['get']({'plain':!![]});_0x38dbc7=qs['omit'](_0x38dbc7,['id',_0xfda3('0x52'),_0xfda3('0x53')]);_0x2fcbe7[_0xfda3('0x54')]=_['omit'](_0x2fcbe7[_0xfda3('0x54')],['id','createdAt',_0xfda3('0x53')]);return db[_0xfda3('0x48')][_0xfda3('0x55')](_[_0xfda3('0x45')](_0x38dbc7,_0x2fcbe7[_0xfda3('0x54')]),{'include':_0x2fcbe7[_0xfda3('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xfda3('0x1b')](function(_0x471418){var _0x1d13d4=_0x2fcbe7[_0xfda3('0x56')][_0xfda3('0x30')]({'plain':!![]});if(!_0x1d13d4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d13d4['role']===_0xfda3('0x56')){var _0x18ab57=_0x471418['get']({'plain':!![]});var _0x550822='Trunks';return db[_0xfda3('0x57')][_0xfda3('0x58')]({'where':{'name':_0x550822,'userProfileId':_0x1d13d4['userProfileId']},'raw':!![]})[_0xfda3('0x1b')](function(_0x6eb00d){if(_0x6eb00d&&_0x6eb00d[_0xfda3('0x59')]===0x0){return db[_0xfda3('0x31')]['create']({'name':_0x18ab57[_0xfda3('0x33')],'resourceId':_0x18ab57['id'],'type':_0x6eb00d[_0xfda3('0x33')],'sectionId':_0x6eb00d['id']},{})[_0xfda3('0x1b')](function(){return _0x471418;});}else{return _0x471418;}})[_0xfda3('0x4b')](function(_0x44e59e){logger[_0xfda3('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44e59e);throw _0x44e59e;});}return _0x471418;});}})['then'](respondWithResult(_0x4bc976,0xc9))[_0xfda3('0x4b')](handleError(_0x4bc976,null));};exports['create']=function(_0x238329,_0x19aa4e,_0x20704a){var _0x3884b1;return db[_0xfda3('0x48')][_0xfda3('0x55')](_0x238329[_0xfda3('0x54')],{'raw':!![]})[_0xfda3('0x1b')](function(_0x29b9fb){_0x3884b1=_0x29b9fb;return db[_0xfda3('0x48')]['findAll']({'raw':!![]});})[_0xfda3('0x1b')](function(_0x49f04a){var _0x5c0755=fs[_0xfda3('0x5a')](path[_0xfda3('0x5b')](config['root'],_0xfda3('0x5c')),_0xfda3('0x5d'));var _0x42e387=fs['readFileSync'](path[_0xfda3('0x5b')](config[_0xfda3('0x5e')],_0xfda3('0x5f')),_0xfda3('0x5d'));var _0x2448b1=ejs['render'](_0x5c0755,{'trunks':_0x49f04a||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x2448b1);if(_0x3884b1[_0xfda3('0x60')]){var _0xa032b5=ejs[_0xfda3('0x61')](_0x42e387,{'trunks':_0x49f04a||[]});fs[_0xfda3('0x62')](_0xfda3('0x63'),_0xa032b5);}})[_0xfda3('0x1b')](function(){return respondWithRpcPromise('Reload',_0xfda3('0x55'),{'module':_0xfda3('0x64')});})[_0xfda3('0x1b')](function(){var _0x34f3e5=_0x238329['user'][_0xfda3('0x30')]({'plain':!![]});if(!_0x34f3e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34f3e5[_0xfda3('0x65')]===_0xfda3('0x56')){var _0x223350=_0x3884b1[_0xfda3('0x30')]({'plain':!![]});return db[_0xfda3('0x57')][_0xfda3('0x58')]({'where':{'name':_0xfda3('0x66'),'userProfileId':_0x34f3e5['userProfileId']},'raw':!![]})[_0xfda3('0x1b')](function(_0x3b3686){if(_0x3b3686&&_0x3b3686[_0xfda3('0x59')]===0x0){return db[_0xfda3('0x31')][_0xfda3('0x55')]({'name':_0x223350[_0xfda3('0x33')],'resourceId':_0x223350['id'],'type':_0x3b3686['name'],'sectionId':_0x3b3686['id']},{})[_0xfda3('0x1b')](function(){return _0x3884b1;});}else{return _0x3884b1;}})[_0xfda3('0x4b')](function(_0x17161f){logger[_0xfda3('0x21')](_0xfda3('0x67'),_0x17161f);throw _0x17161f;});}return _0x3884b1;})['then'](respondWithResult(_0x19aa4e,0xc9))[_0xfda3('0x4b')](handleError(_0x19aa4e,null));};exports[_0xfda3('0x68')]=function(_0x2dab2d,_0x42a092,_0xcb7ff4){var _0x22fbc7;return db[_0xfda3('0x48')][_0xfda3('0x58')]({'where':{'id':_0x2dab2d[_0xfda3('0x50')]['id']}})[_0xfda3('0x1b')](handleEntityNotFound(_0x42a092,null))['then'](saveUpdates(_0x2dab2d[_0xfda3('0x54')],null))[_0xfda3('0x1b')](function(_0x46210d){if(_0x46210d){_0x22fbc7=_0x46210d;return db[_0xfda3('0x48')][_0xfda3('0x4a')]({'raw':!![]});}})['then'](function(_0x5e54e5){if(_0x5e54e5){var _0x232cd2=fs[_0xfda3('0x5a')](path[_0xfda3('0x5b')](config[_0xfda3('0x5e')],_0xfda3('0x5c')),_0xfda3('0x5d'));var _0x38e5d5=fs[_0xfda3('0x5a')](path[_0xfda3('0x5b')](config[_0xfda3('0x5e')],_0xfda3('0x5f')),'utf8');var _0x1ee8f4=ejs['render'](_0x232cd2,{'trunks':_0x5e54e5||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee8f4);var _0x26dca4=ejs['render'](_0x38e5d5,{'trunks':_0x5e54e5||[]});fs[_0xfda3('0x62')](_0xfda3('0x63'),_0x26dca4);return respondWithRpcPromise('Reload',_0xfda3('0x68'),{'module':_0xfda3('0x64')});}return null;})['then'](function(_0x12b727){if(_0x12b727){return _0x22fbc7;}})['then'](respondWithResult(_0x42a092,null))[_0xfda3('0x4b')](handleError(_0x42a092,null));};exports[_0xfda3('0x2f')]=function(_0x5ee695,_0xdf324c,_0x2122e3){var _0x3bb157;return db[_0xfda3('0x48')][_0xfda3('0x58')]({'where':{'id':_0x5ee695['params']['id']}})[_0xfda3('0x1b')](handleEntityNotFound(_0xdf324c,null))[_0xfda3('0x1b')](removeEntity(_0xdf324c,null))[_0xfda3('0x1b')](function(){return db[_0xfda3('0x48')][_0xfda3('0x4a')]({'raw':!![]});})['then'](function(_0x5d64bb){var _0x53e829=fs[_0xfda3('0x5a')](path[_0xfda3('0x5b')](config[_0xfda3('0x5e')],_0xfda3('0x5c')),_0xfda3('0x5d'));var _0x44d81d=fs[_0xfda3('0x5a')](path[_0xfda3('0x5b')](config['root'],_0xfda3('0x5f')),_0xfda3('0x5d'));var _0x4bca42=ejs[_0xfda3('0x61')](_0x53e829,{'trunks':_0x5d64bb});var _0x43c206=ejs['render'](_0x44d81d,{'trunks':_0x5d64bb});fs[_0xfda3('0x62')](_0xfda3('0x69'),_0x4bca42);fs[_0xfda3('0x62')](_0xfda3('0x63'),_0x43c206);return respondWithRpcPromise(_0xfda3('0x6a'),'destroy',{'module':_0xfda3('0x64')});})[_0xfda3('0x4b')](handleError(_0xdf324c,null));}; \ No newline at end of file +var _0x4cf8=['VIRTUAL','filter','options','findAll','rows','filters','includeAll','include','find','params','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','readFileSync','join','utf8','root','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','where','merge'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x4cf8[_0x2f9467];return _0x39894c;};'use strict';var pdf=require(_0x84cf('0x0'));var emlformat=require(_0x84cf('0x1'));var rimraf=require(_0x84cf('0x2'));var zipdir=require(_0x84cf('0x3'));var jsonpatch=require(_0x84cf('0x4'));var rp=require(_0x84cf('0x5'));var moment=require(_0x84cf('0x6'));var BPromise=require(_0x84cf('0x7'));var Mustache=require(_0x84cf('0x8'));var util=require(_0x84cf('0x9'));var path=require(_0x84cf('0xa'));var sox=require(_0x84cf('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xf'));var querystring=require(_0x84cf('0x10'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x11'));var authService=require(_0x84cf('0x12'));var qs=require(_0x84cf('0x13'));var as=require(_0x84cf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x15'))(_0x84cf('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x84cf('0x17'))['db'];var jayson=require(_0x84cf('0x18'));var client=jayson[_0x84cf('0x19')][_0x84cf('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x172d04,_0x214ca0,_0x1fd6cb){if(_0x1fd6cb){var _0x27824b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27824b[_0x84cf('0x1b')](_0x214ca0)){return _0x172d04;}else{throw new db[(_0x84cf('0x1c'))][(_0x84cf('0x1d'))](_0x84cf('0x1e'));}}else{return _0x172d04;}}function respondWithRpcPromise(_0x7db8f,_0x20e79c,_0x27261b,_0x167c3e){return new BPromise(function(_0x464e70,_0x240edf){var _0xe12c7b=_0x167c3e||client;return _0xe12c7b['request'](_0x7db8f,_0x27261b)[_0x84cf('0x1f')](function(_0x5d6a93){logger[_0x84cf('0x20')](_0x84cf('0x21'),_0x20e79c,_0x84cf('0x22'));logger[_0x84cf('0x23')](_0x84cf('0x24'),_0x20e79c,'request\x20sent',JSON['stringify'](_0x5d6a93));if(_0x5d6a93[_0x84cf('0x25')]){if(_0x5d6a93[_0x84cf('0x25')][_0x84cf('0x26')]===0x1f4){logger[_0x84cf('0x25')](_0x84cf('0x21'),_0x20e79c,_0x5d6a93['error'][_0x84cf('0x27')]);return _0x240edf(_0x5d6a93[_0x84cf('0x25')][_0x84cf('0x27')]);}logger[_0x84cf('0x25')](_0x84cf('0x21'),_0x20e79c,_0x5d6a93['error'][_0x84cf('0x27')]);return _0x464e70(_0x5d6a93[_0x84cf('0x25')][_0x84cf('0x27')]);}else{logger[_0x84cf('0x20')](_0x84cf('0x21'),_0x20e79c,_0x84cf('0x22'));_0x464e70(_0x5d6a93[_0x84cf('0x28')]['message']);}})[_0x84cf('0x29')](function(_0x26db3f){logger[_0x84cf('0x25')](_0x84cf('0x21'),_0x20e79c,_0x26db3f);_0x240edf(_0x26db3f);});});}function respondWithStatusCode(_0x1d220a,_0x44d4bf){_0x44d4bf=_0x44d4bf||0xcc;return function(_0x3c7eda){if(_0x3c7eda){return _0x1d220a[_0x84cf('0x2a')](_0x44d4bf);}return _0x1d220a[_0x84cf('0x2b')](_0x44d4bf)[_0x84cf('0x2c')]();};}function respondWithResult(_0x5179c1,_0x83f20b){_0x83f20b=_0x83f20b||0xc8;return function(_0x17bc92){if(_0x17bc92){return _0x5179c1[_0x84cf('0x2b')](_0x83f20b)[_0x84cf('0x2d')](_0x17bc92);}};}function respondWithFilteredResult(_0x58f07e,_0x1595dd){return function(_0x5a428c){if(_0x5a428c){var _0x29455e=_0x5a428c[_0x84cf('0x2e')],_0x4092fd=_0x1595dd[_0x84cf('0x2f')],_0x43b41b=_0x1595dd[_0x84cf('0x2f')]+_0x1595dd[_0x84cf('0x30')],_0xc15298;if(_0x43b41b>=_0x29455e){_0x43b41b=_0x29455e;_0xc15298=0xc8;}else{_0xc15298=0xce;}_0x58f07e[_0x84cf('0x2b')](_0xc15298);return _0x58f07e[_0x84cf('0x31')](_0x84cf('0x32'),_0x4092fd+'-'+_0x43b41b+'/'+_0x29455e)[_0x84cf('0x2d')](_0x5a428c);}return null;};}function patchUpdates(_0x18243d){return function(_0x44f16e){try{jsonpatch['apply'](_0x44f16e,_0x18243d,!![]);}catch(_0x4852ff){return BPromise[_0x84cf('0x33')](_0x4852ff);}return _0x44f16e[_0x84cf('0x34')]();};}function saveUpdates(_0x16ebaa,_0x1e889e){return function(_0x38eeea){if(_0x38eeea){return _0x38eeea[_0x84cf('0x35')](_0x16ebaa)[_0x84cf('0x1f')](function(_0x29e06e){return _0x29e06e;});}return null;};}function removeEntity(_0x592946,_0x113b3e){return function(_0x23833a){if(_0x23833a){return _0x23833a['destroy']()[_0x84cf('0x1f')](function(){var _0x5ba89e=_0x23833a[_0x84cf('0x36')]({'plain':!![]});var _0x3ea5b9=_0x84cf('0x37');return db[_0x84cf('0x38')][_0x84cf('0x39')]({'where':{'type':_0x3ea5b9,'resourceId':_0x5ba89e['id']}})['then'](function(){return _0x23833a;});})[_0x84cf('0x1f')](function(){_0x592946['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42c584,_0x147e5c){return function(_0x4c4676){if(!_0x4c4676){_0x42c584[_0x84cf('0x2a')](0x194);}return _0x4c4676;};}function handleError(_0x263372,_0x3395f6){_0x3395f6=_0x3395f6||0x1f4;return function(_0x255b31){logger[_0x84cf('0x25')](_0x255b31[_0x84cf('0x3a')]);if(_0x255b31['name']){delete _0x255b31[_0x84cf('0x3b')];}_0x263372[_0x84cf('0x2b')](_0x3395f6)[_0x84cf('0x3c')](_0x255b31);};}exports[_0x84cf('0x3d')]=function(_0x3c7063,_0x2a8992){var _0x5129b0={},_0x33d1cc={},_0x4a9be3={'count':0x0,'rows':[]};var _0x1434e2=_[_0x84cf('0x3e')](db[_0x84cf('0x3f')][_0x84cf('0x40')],function(_0x3d5f3e){return{'name':_0x3d5f3e[_0x84cf('0x41')],'type':_0x3d5f3e[_0x84cf('0x42')][_0x84cf('0x43')]};});_0x33d1cc[_0x84cf('0x44')]=_['map'](_0x1434e2,_0x84cf('0x3b'));_0x33d1cc['query']=_[_0x84cf('0x45')](_0x3c7063[_0x84cf('0x46')]);_0x33d1cc['filters']=_[_0x84cf('0x47')](_0x33d1cc['model'],_0x33d1cc[_0x84cf('0x46')]);_0x5129b0['attributes']=_[_0x84cf('0x47')](_0x33d1cc['model'],qs[_0x84cf('0x48')](_0x3c7063[_0x84cf('0x46')]['fields']));_0x5129b0[_0x84cf('0x49')]=_0x5129b0[_0x84cf('0x49')][_0x84cf('0x4a')]?_0x5129b0['attributes']:_0x33d1cc[_0x84cf('0x44')];if(!_0x3c7063['query'][_0x84cf('0x4b')]('nolimit')){_0x5129b0['limit']=qs['limit'](_0x3c7063[_0x84cf('0x46')][_0x84cf('0x30')]);_0x5129b0['offset']=qs[_0x84cf('0x2f')](_0x3c7063['query'][_0x84cf('0x2f')]);}_0x5129b0[_0x84cf('0x4c')]=qs['sort'](_0x3c7063[_0x84cf('0x46')]['sort']);_0x5129b0[_0x84cf('0x4d')]=qs['filters'](_['pick'](_0x3c7063['query'],_0x33d1cc['filters']),_0x1434e2);if(_0x3c7063['query']['filter']){_0x5129b0['where']=_[_0x84cf('0x4e')](_0x5129b0[_0x84cf('0x4d')],{'$or':_[_0x84cf('0x3e')](_0x1434e2,function(_0x5dbf79){if(_0x5dbf79['type']!==_0x84cf('0x4f')){var _0x4af229={};_0x4af229[_0x5dbf79[_0x84cf('0x3b')]]={'$like':'%'+_0x3c7063[_0x84cf('0x46')][_0x84cf('0x50')]+'%'};return _0x4af229;}})});}_0x5129b0=_[_0x84cf('0x4e')]({},_0x5129b0,_0x3c7063[_0x84cf('0x51')]);var _0x300808={'where':_0x5129b0['where']};return db[_0x84cf('0x3f')][_0x84cf('0x2e')](_0x300808)['then'](function(_0xb2b8ae){_0x4a9be3[_0x84cf('0x2e')]=_0xb2b8ae;if(_0x3c7063[_0x84cf('0x46')]['includeAll']){_0x5129b0['include']=[{'all':!![]}];}return db['Trunk'][_0x84cf('0x52')](_0x5129b0);})[_0x84cf('0x1f')](function(_0x25d4f8){_0x4a9be3[_0x84cf('0x53')]=_0x25d4f8;return _0x4a9be3;})[_0x84cf('0x1f')](respondWithFilteredResult(_0x2a8992,_0x5129b0))[_0x84cf('0x29')](handleError(_0x2a8992,null));};exports['show']=function(_0x350985,_0x55316e){var _0x44b8b0={'raw':![],'where':{'id':_0x350985['params']['id']}},_0x499225={};_0x499225[_0x84cf('0x44')]=_[_0x84cf('0x45')](db[_0x84cf('0x3f')]['rawAttributes']);_0x499225['query']=_[_0x84cf('0x45')](_0x350985[_0x84cf('0x46')]);_0x499225[_0x84cf('0x54')]=_[_0x84cf('0x47')](_0x499225[_0x84cf('0x44')],_0x499225['query']);_0x44b8b0[_0x84cf('0x49')]=_[_0x84cf('0x47')](_0x499225['model'],qs[_0x84cf('0x48')](_0x350985['query']['fields']));_0x44b8b0[_0x84cf('0x49')]=_0x44b8b0[_0x84cf('0x49')]['length']?_0x44b8b0['attributes']:_0x499225[_0x84cf('0x44')];if(_0x350985[_0x84cf('0x46')][_0x84cf('0x55')]){_0x44b8b0[_0x84cf('0x56')]=[{'all':!![]}];}_0x44b8b0=_[_0x84cf('0x4e')]({},_0x44b8b0,_0x350985[_0x84cf('0x51')]);return db[_0x84cf('0x3f')][_0x84cf('0x57')](_0x44b8b0)['then'](handleEntityNotFound(_0x55316e,null))[_0x84cf('0x1f')](respondWithResult(_0x55316e,null))[_0x84cf('0x29')](handleError(_0x55316e,null));};exports['clone']=function(_0x5a4003,_0x1537f3){var _0x2504d8={'where':{'id':_0x5a4003[_0x84cf('0x58')]['id']}},_0x3912cb={};_0x3912cb[_0x84cf('0x44')]=_[_0x84cf('0x45')](db[_0x84cf('0x3f')]['rawAttributes']);_0x2504d8[_0x84cf('0x49')]=_['intersection'](_0x3912cb[_0x84cf('0x44')],qs['fields'](_0x5a4003[_0x84cf('0x46')][_0x84cf('0x48')]));_0x2504d8['attributes']=_0x2504d8[_0x84cf('0x49')][_0x84cf('0x4a')]?_0x2504d8['attributes']:_0x3912cb[_0x84cf('0x44')];if(_0x5a4003['query']['includeAll']){_0x2504d8['include']=[{'all':!![]}];}_0x2504d8=_['merge']({},_0x2504d8,_0x5a4003[_0x84cf('0x51')]);return db[_0x84cf('0x3f')][_0x84cf('0x57')](_0x2504d8)[_0x84cf('0x1f')](handleEntityNotFound(_0x1537f3,null))['then'](function(_0x32aa8b){if(_0x32aa8b){var _0x3c1c55=_0x32aa8b['get']({'plain':!![]});_0x3c1c55=qs[_0x84cf('0x59')](_0x3c1c55,['id',_0x84cf('0x5a'),_0x84cf('0x5b')]);_0x5a4003[_0x84cf('0x5c')]=_[_0x84cf('0x59')](_0x5a4003[_0x84cf('0x5c')],['id',_0x84cf('0x5a'),_0x84cf('0x5b')]);return db['Trunk'][_0x84cf('0x5d')](_['merge'](_0x3c1c55,_0x5a4003[_0x84cf('0x5c')]),{'include':_0x5a4003[_0x84cf('0x46')][_0x84cf('0x55')]?[{'all':!![]}]:undefined})[_0x84cf('0x1f')](function(_0x2602b7){var _0x4b7cfe=_0x5a4003[_0x84cf('0x5e')][_0x84cf('0x36')]({'plain':!![]});if(!_0x4b7cfe)throw new Error(_0x84cf('0x5f'));if(_0x4b7cfe['role']===_0x84cf('0x5e')){var _0x240cca=_0x2602b7['get']({'plain':!![]});var _0x84d9cb='Trunks';return db[_0x84cf('0x60')][_0x84cf('0x57')]({'where':{'name':_0x84d9cb,'userProfileId':_0x4b7cfe['userProfileId']},'raw':!![]})[_0x84cf('0x1f')](function(_0xd95f2e){if(_0xd95f2e&&_0xd95f2e['autoAssociation']===0x0){return db[_0x84cf('0x38')][_0x84cf('0x5d')]({'name':_0x240cca[_0x84cf('0x3b')],'resourceId':_0x240cca['id'],'type':_0xd95f2e[_0x84cf('0x3b')],'sectionId':_0xd95f2e['id']},{})['then'](function(){return _0x2602b7;});}else{return _0x2602b7;}})[_0x84cf('0x29')](function(_0x2a6731){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a6731);throw _0x2a6731;});}return _0x2602b7;});}})['then'](respondWithResult(_0x1537f3,0xc9))[_0x84cf('0x29')](handleError(_0x1537f3,null));};exports[_0x84cf('0x5d')]=function(_0xfcd0d,_0x4cc13a,_0x5a8e61){var _0x30aecd;return db[_0x84cf('0x3f')][_0x84cf('0x5d')](_0xfcd0d[_0x84cf('0x5c')],{'raw':!![]})[_0x84cf('0x1f')](function(_0x39bd44){_0x30aecd=_0x39bd44;return db[_0x84cf('0x3f')][_0x84cf('0x52')]({'raw':!![]});})['then'](function(_0x20b930){var _0x5350d9=fs[_0x84cf('0x61')](path[_0x84cf('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0x84cf('0x63'));var _0x31e622=fs[_0x84cf('0x61')](path[_0x84cf('0x62')](config[_0x84cf('0x64')],'server/files/templates/registry.ejs'),_0x84cf('0x63'));var _0xd4cfef=ejs[_0x84cf('0x65')](_0x5350d9,{'trunks':_0x20b930||[]});fs[_0x84cf('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0xd4cfef);if(_0x30aecd[_0x84cf('0x67')]){var _0x58a09e=ejs['render'](_0x31e622,{'trunks':_0x20b930||[]});fs[_0x84cf('0x66')](_0x84cf('0x68'),_0x58a09e);}})[_0x84cf('0x1f')](function(){return respondWithRpcPromise(_0x84cf('0x69'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x1df8e2=_0xfcd0d['user'][_0x84cf('0x36')]({'plain':!![]});if(!_0x1df8e2)throw new Error(_0x84cf('0x5f'));if(_0x1df8e2[_0x84cf('0x6a')]===_0x84cf('0x5e')){var _0x5b7250=_0x30aecd[_0x84cf('0x36')]({'plain':!![]});return db[_0x84cf('0x60')]['find']({'where':{'name':_0x84cf('0x37'),'userProfileId':_0x1df8e2['userProfileId']},'raw':!![]})['then'](function(_0x171c12){if(_0x171c12&&_0x171c12[_0x84cf('0x6b')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b7250[_0x84cf('0x3b')],'resourceId':_0x5b7250['id'],'type':_0x171c12['name'],'sectionId':_0x171c12['id']},{})['then'](function(){return _0x30aecd;});}else{return _0x30aecd;}})['catch'](function(_0x394d5d){logger[_0x84cf('0x25')](_0x84cf('0x6c'),_0x394d5d);throw _0x394d5d;});}return _0x30aecd;})['then'](respondWithResult(_0x4cc13a,0xc9))['catch'](handleError(_0x4cc13a,null));};exports[_0x84cf('0x35')]=function(_0x29a924,_0x4393a0,_0x4686e2){var _0x595c9a;return db['Trunk']['find']({'where':{'id':_0x29a924[_0x84cf('0x58')]['id']}})[_0x84cf('0x1f')](handleEntityNotFound(_0x4393a0,null))[_0x84cf('0x1f')](saveUpdates(_0x29a924['body'],null))[_0x84cf('0x1f')](function(_0x29d062){if(_0x29d062){_0x595c9a=_0x29d062;return db[_0x84cf('0x3f')][_0x84cf('0x52')]({'raw':!![]});}})[_0x84cf('0x1f')](function(_0x4c0461){if(_0x4c0461){var _0x1ffa84=fs[_0x84cf('0x61')](path[_0x84cf('0x62')](config['root'],_0x84cf('0x6d')),_0x84cf('0x63'));var _0x4cfb3b=fs[_0x84cf('0x61')](path[_0x84cf('0x62')](config[_0x84cf('0x64')],_0x84cf('0x6e')),'utf8');var _0x4f1fbb=ejs[_0x84cf('0x65')](_0x1ffa84,{'trunks':_0x4c0461||[]});fs[_0x84cf('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f1fbb);var _0x4f83b8=ejs[_0x84cf('0x65')](_0x4cfb3b,{'trunks':_0x4c0461||[]});fs[_0x84cf('0x66')](_0x84cf('0x68'),_0x4f83b8);return respondWithRpcPromise(_0x84cf('0x69'),_0x84cf('0x35'),{'module':_0x84cf('0x6f')});}return null;})[_0x84cf('0x1f')](function(_0x509d10){if(_0x509d10){return _0x595c9a;}})['then'](respondWithResult(_0x4393a0,null))[_0x84cf('0x29')](handleError(_0x4393a0,null));};exports[_0x84cf('0x39')]=function(_0x1f7ecd,_0xcb28b4,_0x4fd3f1){var _0x3bf924;return db['Trunk'][_0x84cf('0x57')]({'where':{'id':_0x1f7ecd['params']['id']}})[_0x84cf('0x1f')](handleEntityNotFound(_0xcb28b4,null))[_0x84cf('0x1f')](removeEntity(_0xcb28b4,null))[_0x84cf('0x1f')](function(){return db[_0x84cf('0x3f')][_0x84cf('0x52')]({'raw':!![]});})['then'](function(_0x38b002){var _0x214371=fs[_0x84cf('0x61')](path[_0x84cf('0x62')](config[_0x84cf('0x64')],_0x84cf('0x6d')),_0x84cf('0x63'));var _0x3d4eac=fs[_0x84cf('0x61')](path[_0x84cf('0x62')](config[_0x84cf('0x64')],_0x84cf('0x6e')),_0x84cf('0x63'));var _0xb44157=ejs[_0x84cf('0x65')](_0x214371,{'trunks':_0x38b002});var _0x4dab7b=ejs[_0x84cf('0x65')](_0x3d4eac,{'trunks':_0x38b002});fs[_0x84cf('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0xb44157);fs['writeFileSync'](_0x84cf('0x68'),_0x4dab7b);return respondWithRpcPromise('Reload',_0x84cf('0x39'),{'module':_0x84cf('0x6f')});})['catch'](handleError(_0xcb28b4,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index ba7ff7c..77fa7ad 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 _0x3a80=['bluebird','request-promise','path','rimraf','../../config/environment','define','Trunk','lodash','../../config/logger','api','moment'];(function(_0xc298fe,_0x53be01){var _0x2096d3=function(_0x27d6b6){while(--_0x27d6b6){_0xc298fe['push'](_0xc298fe['shift']());}};_0x2096d3(++_0x53be01);}(_0x3a80,0xb7));var _0x03a8=function(_0x56b405,_0x21bc3e){_0x56b405=_0x56b405-0x0;var _0x233e08=_0x3a80[_0x56b405];return _0x233e08;};'use strict';var _=require(_0x03a8('0x0'));var util=require('util');var logger=require(_0x03a8('0x1'))(_0x03a8('0x2'));var moment=require(_0x03a8('0x3'));var BPromise=require(_0x03a8('0x4'));var rp=require(_0x03a8('0x5'));var fs=require('fs');var path=require(_0x03a8('0x6'));var rimraf=require(_0x03a8('0x7'));var config=require(_0x03a8('0x8'));var attributes=require('./trunk.attributes');module['exports']=function(_0x50206d,_0x143755){return _0x50206d[_0x03a8('0x9')](_0x03a8('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2154=['path','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5c1b7f,_0x2fca69){var _0x56bb40=function(_0xadd68){while(--_0xadd68){_0x5c1b7f['push'](_0x5c1b7f['shift']());}};_0x56bb40(++_0x2fca69);}(_0x2154,0xf6));var _0x4215=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x2154[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x4215('0x0'));var util=require('util');var logger=require(_0x4215('0x1'))(_0x4215('0x2'));var moment=require(_0x4215('0x3'));var BPromise=require(_0x4215('0x4'));var rp=require(_0x4215('0x5'));var fs=require('fs');var path=require(_0x4215('0x6'));var rimraf=require('rimraf');var config=require(_0x4215('0x7'));var attributes=require(_0x4215('0x8'));module[_0x4215('0x9')]=function(_0x2c1c96,_0x59a13a){return _0x2c1c96[_0x4215('0xa')](_0x4215('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 2bfab39..d4c2dd0 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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x1a85,0x178));var _0x51a8=function(_0x572637,_0x216d95){_0x572637=_0x572637-0x0;var _0xb6748=_0x1a85[_0x572637];return _0xb6748;};'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 _0xda2d=['../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetTrunk','Trunk','findAll','options','raw','attributes','include','map','model','catch','find','where','ShowTrunk','util','moment','bluebird','randomstring','ioredis','rpc'];(function(_0x1aaf79,_0x298f15){var _0x12e371=function(_0x245a49){while(--_0x245a49){_0x1aaf79['push'](_0x1aaf79['shift']());}};_0x12e371(++_0x298f15);}(_0xda2d,0x102));var _0xdda2=function(_0x4d6453,_0x4dfc5a){_0x4d6453=_0x4d6453-0x0;var _0x14d362=_0xda2d[_0x4d6453];return _0x14d362;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('Trunk,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')]({'raw':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')][_0xdda2('0x18')]===undefined?!![]:![]:!![],'where':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['where']||null:null,'attributes':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x19')]||null:null,'limit':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35[_0xdda2('0x17')]['limit']||null:null,'include':_0x1a3b35[_0xdda2('0x17')]?_0x1a3b35['options'][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x1a3b35['options'][_0xdda2('0x1a')],function(_0xfda248){return{'model':db[_0xfda248[_0xdda2('0x1c')]],'as':_0xfda248['as'],'attributes':_0xfda248[_0xdda2('0x19')],'include':_0xfda248[_0xdda2('0x1a')]?_['map'](_0xfda248[_0xdda2('0x1a')],function(_0x4be5ea){return{'model':db[_0x4be5ea[_0xdda2('0x1c')]],'as':_0x4be5ea['as'],'attributes':_0x4be5ea[_0xdda2('0x19')],'include':_0x4be5ea['include']?_['map'](_0x4be5ea[_0xdda2('0x1a')],function(_0x4567e7){return{'model':db[_0x4567e7[_0xdda2('0x1c')]],'as':_0x4567e7['as'],'attributes':_0x4567e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x5d26ae){logger[_0xdda2('0x12')](_0xdda2('0x14'),_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON['stringify'](_0x5d26ae));_0x2b6ee8(_0x5d26ae);})[_0xdda2('0x1d')](function(_0x255bbc){logger['error'](_0xdda2('0x14'),_0x255bbc[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5[_0xdda2('0x10')](0x1f4,_0x255bbc[_0xdda2('0x11')]));});});};exports['ShowTrunk']=function(_0x129eba){var _0x5e107f=this;return new Promise(function(_0x4b19b7,_0x1ca9f3){return db['Trunk'][_0xdda2('0x1e')]({'raw':_0x129eba['options']?_0x129eba['options']['raw']===undefined?!![]:![]:!![],'where':_0x129eba[_0xdda2('0x17')]?_0x129eba['options'][_0xdda2('0x1f')]||null:null,'attributes':_0x129eba['options']?_0x129eba['options']['attributes']||null:null,'include':_0x129eba[_0xdda2('0x17')]?_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x129eba[_0xdda2('0x17')][_0xdda2('0x1a')],function(_0x2bcfba){return{'model':db[_0x2bcfba[_0xdda2('0x1c')]],'as':_0x2bcfba['as'],'attributes':_0x2bcfba[_0xdda2('0x19')],'include':_0x2bcfba[_0xdda2('0x1a')]?_['map'](_0x2bcfba[_0xdda2('0x1a')],function(_0x4212da){return{'model':db[_0x4212da[_0xdda2('0x1c')]],'as':_0x4212da['as'],'attributes':_0x4212da[_0xdda2('0x19')],'include':_0x4212da[_0xdda2('0x1a')]?_[_0xdda2('0x1b')](_0x4212da[_0xdda2('0x1a')],function(_0x5835cd){return{'model':db[_0x5835cd['model']],'as':_0x5835cd['as'],'attributes':_0x5835cd[_0xdda2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdda2('0xa')](function(_0x40eb19){logger['info']('ShowTrunk',_0x129eba);logger[_0xdda2('0xd')](_0xdda2('0x20'),_0x129eba,JSON[_0xdda2('0xf')](_0x40eb19));_0x4b19b7(_0x40eb19);})[_0xdda2('0x1d')](function(_0x246001){logger['error'](_0xdda2('0x20'),_0x246001[_0xdda2('0x11')],_0x129eba);_0x1ca9f3(_0x5e107f['error'](0x1f4,_0x246001['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index f7349b4..564d17b 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 _0xa8f7=['./user.controller','isAuthenticated','index','get','whoami','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/: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','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','/:id/contacts','create','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addSquareProjects','createApiKey','/:id','update','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/whatsapp_interactions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8f7,0x1ac));var _0x7a8f=function(_0x1bf24c,_0x19c14d){_0x1bf24c=_0x1bf24c-0x0;var _0x245e8c=_0xa8f7[_0x1bf24c];return _0x245e8c;};'use strict';var multer=require(_0x7a8f('0x0'));var util=require(_0x7a8f('0x1'));var path=require(_0x7a8f('0x2'));var timeout=require(_0x7a8f('0x3'));var express=require('express');var router=express[_0x7a8f('0x4')]();var auth=require(_0x7a8f('0x5'));var interaction=require(_0x7a8f('0x6'));var config=require(_0x7a8f('0x7'));var controller=require(_0x7a8f('0x8'));router['get']('/',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0xa')]);router['get']('/describe',auth[_0x7a8f('0x9')](),controller['describe']);router[_0x7a8f('0xb')]('/whoami',auth['isAuthenticated'](),controller[_0x7a8f('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7a8f('0xb')](_0x7a8f('0xd'),controller[_0x7a8f('0xe')]);router[_0x7a8f('0xb')]('/:id/contacts',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0xf')]);router[_0x7a8f('0xb')](_0x7a8f('0x10'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x11')]);router[_0x7a8f('0xb')](_0x7a8f('0x12'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x13')]);router[_0x7a8f('0xb')](_0x7a8f('0x14'),auth[_0x7a8f('0x9')](),controller['getGroups']);router['get'](_0x7a8f('0x15'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x16')]);router[_0x7a8f('0xb')]('/:id/screen_recordings',auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x7a8f('0xb')](_0x7a8f('0x17'),auth['isAuthenticated'](),controller[_0x7a8f('0x18')]);router[_0x7a8f('0xb')](_0x7a8f('0x19'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x1a')]);router['get'](_0x7a8f('0x1b'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x1c')]);router[_0x7a8f('0xb')](_0x7a8f('0x1d'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x1e')]);router[_0x7a8f('0xb')](_0x7a8f('0x1f'),auth['isAuthenticated'](),controller[_0x7a8f('0x20')]);router['get'](_0x7a8f('0x21'),auth[_0x7a8f('0x9')](),controller['getWhatsappInteractions']);router[_0x7a8f('0xb')](_0x7a8f('0x22'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x23')]);router[_0x7a8f('0xb')](_0x7a8f('0x24'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x25')]);router[_0x7a8f('0xb')](_0x7a8f('0x26'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x27')]);router[_0x7a8f('0xb')](_0x7a8f('0x28'),auth[_0x7a8f('0x9')](),controller['getVoicePrefixes']);router[_0x7a8f('0xb')](_0x7a8f('0x29'),auth['isAuthenticated'](),controller[_0x7a8f('0x2a')]);router[_0x7a8f('0xb')](_0x7a8f('0x2b'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x2c')]);router['get'](_0x7a8f('0x2d'),auth['isAuthenticated'](),controller[_0x7a8f('0x2e')]);router[_0x7a8f('0xb')](_0x7a8f('0x2f'),auth['isAuthenticated'](),controller[_0x7a8f('0x30')]);router['get']('/:id/chat_websites',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x31')]);router['get']('/:id/whatsapp_accounts',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x32')]);router[_0x7a8f('0xb')](_0x7a8f('0x33'),auth['isAuthenticated'](),controller[_0x7a8f('0x34')]);router[_0x7a8f('0xb')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x7a8f('0x35')]);router[_0x7a8f('0xb')](_0x7a8f('0x36'),auth[_0x7a8f('0x9')](),controller['getApiKey']);router[_0x7a8f('0x37')](_0x7a8f('0x38'),auth['isAuthenticated'](),controller[_0x7a8f('0x39')]);router[_0x7a8f('0x37')](_0x7a8f('0x3a'),auth['isAuthenticated'](),controller['addContacts']);router[_0x7a8f('0x37')]('/',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x3b')]);router[_0x7a8f('0x37')](_0x7a8f('0x10'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x3c')]);var upload=multer({'storage':multer[_0x7a8f('0x3d')]({'destination':function(_0x41336d,_0x124e07,_0x10aeee){_0x10aeee(null,path[_0x7a8f('0x3e')](config[_0x7a8f('0x3f')],_0x7a8f('0x40')));},'filename':function(_0x438163,_0x3000c9,_0x2a51b3){_0x2a51b3(null,util['format'](_0x7a8f('0x41'),Date[_0x7a8f('0x42')](),_0x3000c9[_0x7a8f('0x43')]));}})});router['post']('/:id/avatar',upload[_0x7a8f('0x44')](_0x7a8f('0x45')),controller[_0x7a8f('0x46')]);router[_0x7a8f('0x37')](_0x7a8f('0x47'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x48')]);router['post'](_0x7a8f('0x49'),auth['isAuthenticated'](),controller[_0x7a8f('0x4a')]);router[_0x7a8f('0x37')](_0x7a8f('0x4b'),auth[_0x7a8f('0x9')](),controller['pause']);router['post'](_0x7a8f('0x4c'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x4d')]);router[_0x7a8f('0x37')](_0x7a8f('0x22'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x4e')]);router[_0x7a8f('0x37')](_0x7a8f('0x4f'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x50')]);router[_0x7a8f('0x37')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x7a8f('0x51')]);router[_0x7a8f('0x37')](_0x7a8f('0x52'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x53')]);router[_0x7a8f('0x37')](_0x7a8f('0x54'),auth[_0x7a8f('0x9')](),controller['addSmsInteractions']);router[_0x7a8f('0x37')](_0x7a8f('0x55'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x7a8f('0x37')]('/:id/whatsapp_interactions',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x56')]);router[_0x7a8f('0x37')](_0x7a8f('0x29'),auth[_0x7a8f('0x9')](),controller['addFaxAccounts']);router[_0x7a8f('0x37')](_0x7a8f('0x2b'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x57')]);router[_0x7a8f('0x37')](_0x7a8f('0x2d'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x58')]);router[_0x7a8f('0x37')](_0x7a8f('0x2f'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x59')]);router['post']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x7a8f('0x5a')]);router[_0x7a8f('0x37')](_0x7a8f('0x5b'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router['post'](_0x7a8f('0x33'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x5c')]);router[_0x7a8f('0x37')]('/:id/api_key',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x5d')]);router['put'](_0x7a8f('0x5e'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x5f')]);router['put']('/:id/password',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x60')]);router[_0x7a8f('0x61')]('/:id/queues',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x62')]);router['delete'](_0x7a8f('0x22'),auth['isAuthenticated'](),controller[_0x7a8f('0x63')]);router[_0x7a8f('0x61')](_0x7a8f('0x5e'),auth[_0x7a8f('0x9')](),controller['destroy']);router[_0x7a8f('0x61')](_0x7a8f('0x4f'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x64')]);router[_0x7a8f('0x61')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x7a8f('0x65')]);router[_0x7a8f('0x61')](_0x7a8f('0x52'),auth[_0x7a8f('0x9')](),controller['removeFaxInteractions']);router[_0x7a8f('0x61')](_0x7a8f('0x54'),auth[_0x7a8f('0x9')](),controller['removeSmsInteractions']);router[_0x7a8f('0x61')](_0x7a8f('0x55'),auth[_0x7a8f('0x9')](),controller['removeOpenchannelInteractions']);router[_0x7a8f('0x61')](_0x7a8f('0x66'),auth[_0x7a8f('0x9')](),controller['removeWhatsappInteractions']);router[_0x7a8f('0x61')]('/:id/fax_accounts',auth[_0x7a8f('0x9')](),controller['removeFaxAccounts']);router[_0x7a8f('0x61')](_0x7a8f('0x2b'),auth['isAuthenticated'](),controller[_0x7a8f('0x67')]);router['delete'](_0x7a8f('0x2d'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x68')]);router[_0x7a8f('0x61')]('/:id/sms_accounts',auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x69')]);router[_0x7a8f('0x61')](_0x7a8f('0x6a'),auth['isAuthenticated'](),controller[_0x7a8f('0x6b')]);router['delete'](_0x7a8f('0x5b'),auth[_0x7a8f('0x9')](),controller[_0x7a8f('0x6c')]);router['delete'](_0x7a8f('0x33'),auth[_0x7a8f('0x9')](),controller['removeSquareProjects']);router[_0x7a8f('0x61')](_0x7a8f('0x36'),auth[_0x7a8f('0x9')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0xddcc=['originalname','file','addAvatar','/:id/login','logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','post','/create_many','create','addQueues','diskStorage','join','root','format'];(function(_0x118581,_0x1dae14){var _0x74df1d=function(_0x4259ed){while(--_0x4259ed){_0x118581['push'](_0x118581['shift']());}};_0x74df1d(++_0x1dae14);}(_0xddcc,0x10a));var _0xcddc=function(_0x54da9f,_0x1e9aac){_0x54da9f=_0x54da9f-0x0;var _0x463664=_0xddcc[_0x54da9f];return _0x463664;};'use strict';var multer=require(_0xcddc('0x0'));var util=require('util');var path=require(_0xcddc('0x1'));var timeout=require(_0xcddc('0x2'));var express=require(_0xcddc('0x3'));var router=express['Router']();var auth=require(_0xcddc('0x4'));var interaction=require(_0xcddc('0x5'));var config=require(_0xcddc('0x6'));var controller=require('./user.controller');router[_0xcddc('0x7')]('/',auth[_0xcddc('0x8')](),controller[_0xcddc('0x9')]);router['get'](_0xcddc('0xa'),auth[_0xcddc('0x8')](),controller[_0xcddc('0xb')]);router[_0xcddc('0x7')](_0xcddc('0xc'),auth[_0xcddc('0x8')](),controller[_0xcddc('0xd')]);router[_0xcddc('0x7')](_0xcddc('0xe'),auth['isAuthenticated'](),controller[_0xcddc('0xf')]);router[_0xcddc('0x7')](_0xcddc('0x10'),controller[_0xcddc('0x11')]);router[_0xcddc('0x7')](_0xcddc('0x12'),auth['isAuthenticated'](),controller['getContacts']);router[_0xcddc('0x7')](_0xcddc('0x13'),auth['isAuthenticated'](),controller[_0xcddc('0x14')]);router[_0xcddc('0x7')](_0xcddc('0x15'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x16')]);router[_0xcddc('0x7')](_0xcddc('0x17'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x18')]);router[_0xcddc('0x7')](_0xcddc('0x19'),auth['isAuthenticated'](),controller[_0xcddc('0x1a')]);router[_0xcddc('0x7')](_0xcddc('0x1b'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x1c')]);router[_0xcddc('0x7')](_0xcddc('0x1d'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x1e')]);router['get'](_0xcddc('0x1f'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x20')]);router[_0xcddc('0x7')](_0xcddc('0x21'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x22')]);router[_0xcddc('0x7')](_0xcddc('0x23'),auth['isAuthenticated'](),controller[_0xcddc('0x24')]);router[_0xcddc('0x7')](_0xcddc('0x25'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0xcddc('0x7')](_0xcddc('0x26'),auth[_0xcddc('0x8')](),controller['getWhatsappInteractions']);router[_0xcddc('0x7')](_0xcddc('0x27'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x28')]);router[_0xcddc('0x7')](_0xcddc('0x29'),auth['isAuthenticated'](),controller[_0xcddc('0x2a')]);router[_0xcddc('0x7')](_0xcddc('0x2b'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x2c')]);router[_0xcddc('0x7')]('/:id/prefixes',auth[_0xcddc('0x8')](),controller[_0xcddc('0x2d')]);router[_0xcddc('0x7')](_0xcddc('0x2e'),auth[_0xcddc('0x8')](),controller['getFaxAccounts']);router[_0xcddc('0x7')](_0xcddc('0x2f'),auth[_0xcddc('0x8')](),controller['getMailAccounts']);router[_0xcddc('0x7')](_0xcddc('0x30'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x31')]);router[_0xcddc('0x7')](_0xcddc('0x32'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x33')]);router[_0xcddc('0x7')](_0xcddc('0x34'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x35')]);router[_0xcddc('0x7')](_0xcddc('0x36'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router['get'](_0xcddc('0x37'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x38')]);router[_0xcddc('0x7')]('/:id/scheduled_calls',auth[_0xcddc('0x8')](),controller[_0xcddc('0x39')]);router[_0xcddc('0x7')](_0xcddc('0x3a'),auth[_0xcddc('0x8')](),controller['getApiKey']);router[_0xcddc('0x3b')](_0xcddc('0x3c'),auth[_0xcddc('0x8')](),controller['bulkCreate']);router[_0xcddc('0x3b')]('/:id/contacts',auth[_0xcddc('0x8')](),controller['addContacts']);router[_0xcddc('0x3b')]('/',auth[_0xcddc('0x8')](),controller[_0xcddc('0x3d')]);router[_0xcddc('0x3b')](_0xcddc('0x13'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x3e')]);var upload=multer({'storage':multer[_0xcddc('0x3f')]({'destination':function(_0x2e2fe8,_0x30756f,_0x1630f7){_0x1630f7(null,path[_0xcddc('0x40')](config[_0xcddc('0x41')],'server/files/images/'));},'filename':function(_0x217b71,_0xb068bb,_0x31e566){_0x31e566(null,util[_0xcddc('0x42')]('%s-%s',Date['now'](),_0xb068bb[_0xcddc('0x43')]));}})});router[_0xcddc('0x3b')]('/:id/avatar',upload['single'](_0xcddc('0x44')),controller[_0xcddc('0x45')]);router[_0xcddc('0x3b')](_0xcddc('0x46'),auth[_0xcddc('0x8')](),controller['login']);router[_0xcddc('0x3b')]('/:id/logout',auth[_0xcddc('0x8')](),controller[_0xcddc('0x47')]);router[_0xcddc('0x3b')](_0xcddc('0x48'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x49')]);router[_0xcddc('0x3b')](_0xcddc('0x4a'),auth[_0xcddc('0x8')](),controller['unpause']);router[_0xcddc('0x3b')](_0xcddc('0x27'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xcddc('0x4b'),auth[_0xcddc('0x8')](),controller['addChatInteractions']);router[_0xcddc('0x3b')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xcddc('0x4c')]);router[_0xcddc('0x3b')](_0xcddc('0x4d'),auth['isAuthenticated'](),controller[_0xcddc('0x4e')]);router[_0xcddc('0x3b')]('/:id/sms_interactions',auth[_0xcddc('0x8')](),controller['addSmsInteractions']);router['post']('/:id/openchannel_interactions',auth[_0xcddc('0x8')](),controller[_0xcddc('0x4f')]);router[_0xcddc('0x3b')](_0xcddc('0x50'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x51')]);router[_0xcddc('0x3b')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xcddc('0x52')]);router[_0xcddc('0x3b')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xcddc('0x53')]);router[_0xcddc('0x3b')](_0xcddc('0x30'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x54')]);router[_0xcddc('0x3b')](_0xcddc('0x32'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x55')]);router[_0xcddc('0x3b')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xcddc('0x56')]);router[_0xcddc('0x3b')](_0xcddc('0x36'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x57')]);router[_0xcddc('0x3b')](_0xcddc('0x37'),auth[_0xcddc('0x8')](),controller['addSquareProjects']);router[_0xcddc('0x3b')](_0xcddc('0x3a'),auth[_0xcddc('0x8')](),controller['createApiKey']);router['put'](_0xcddc('0xe'),auth['isAuthenticated'](),controller[_0xcddc('0x58')]);router['put'](_0xcddc('0x59'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x5a')]);router[_0xcddc('0x5b')](_0xcddc('0x13'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x5c')]);router[_0xcddc('0x5b')](_0xcddc('0x27'),auth['isAuthenticated'](),controller[_0xcddc('0x5d')]);router[_0xcddc('0x5b')](_0xcddc('0xe'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x5e')]);router[_0xcddc('0x5b')](_0xcddc('0x4b'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x5f')]);router[_0xcddc('0x5b')](_0xcddc('0x60'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x61')]);router['delete'](_0xcddc('0x4d'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x62')]);router[_0xcddc('0x5b')](_0xcddc('0x63'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x64')]);router[_0xcddc('0x5b')](_0xcddc('0x65'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x66')]);router['delete'](_0xcddc('0x50'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x67')]);router['delete'](_0xcddc('0x2e'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x68')]);router[_0xcddc('0x5b')](_0xcddc('0x2f'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x69')]);router[_0xcddc('0x5b')](_0xcddc('0x30'),auth['isAuthenticated'](),controller[_0xcddc('0x6a')]);router[_0xcddc('0x5b')](_0xcddc('0x32'),auth[_0xcddc('0x8')](),controller['removeSmsAccounts']);router[_0xcddc('0x5b')](_0xcddc('0x34'),auth[_0xcddc('0x8')](),controller[_0xcddc('0x6b')]);router[_0xcddc('0x5b')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xcddc('0x6c')]);router[_0xcddc('0x5b')]('/:id/square_projects',auth[_0xcddc('0x8')](),controller[_0xcddc('0x6d')]);router[_0xcddc('0x5b')](_0xcddc('0x3a'),auth[_0xcddc('0x8')](),controller['removeApiKey']);module[_0xcddc('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index e100900..7c0a71f 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 _0x75fc=['insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','uac','uas','certificate','active','actpass','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','rtcp_mux','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','blockedAt','sequelize','moment','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','toLowerCase','ENUM','admin','agent','telephone','INTEGER','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','user','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'];(function(_0x5b1394,_0x17f08d){var _0x483150=function(_0x1d9539){while(--_0x1d9539){_0x5b1394['push'](_0x5b1394['shift']());}};_0x483150(++_0x17f08d);}(_0x75fc,0x1d4));var _0xc75f=function(_0x1e36e7,_0x2f4f5a){_0x1e36e7=_0x1e36e7-0x0;var _0x3daf80=_0x75fc[_0x1e36e7];return _0x3daf80;};'use strict';var Sequelize=require(_0xc75f('0x0'));var moment=require(_0xc75f('0x1'));var util=require('util');var _=require(_0xc75f('0x2'));module[_0xc75f('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc75f('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x25a588){this[_0xc75f('0x5')](_0xc75f('0x4'),_0x25a588);this[_0xc75f('0x5')](_0xc75f('0x6'),_0x25a588);},'comment':_0xc75f('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5bcf52){this[_0xc75f('0x5')](_0xc75f('0x8'),_0x5bcf52);this[_0xc75f('0x5')]('callerid',util[_0xc75f('0x9')](_0xc75f('0xa'),_0x5bcf52,this[_0xc75f('0xb')](_0xc75f('0xc'))));}},'alias':{'type':Sequelize[_0xc75f('0xd')]},'email':{'type':Sequelize[_0xc75f('0xd')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x191896){if(_0x191896){this[_0xc75f('0x5')]('email',_0x191896[_0xc75f('0xe')]());}}},'role':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x10'),'user',_0xc75f('0x11'),_0xc75f('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xc75f('0xd')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0xcb86ea){this['setDataValue']('internal',_0xcb86ea);this['setDataValue'](_0xc75f('0x14'),_0xcb86ea);this[_0xc75f('0x5')](_0xc75f('0x15'),util['format']('\x22%s\x22\x20<%s>',this[_0xc75f('0xb')](_0xc75f('0x8')),_0xcb86ea));}},'salt':{'type':Sequelize[_0xc75f('0xd')]},'phone':{'type':Sequelize[_0xc75f('0xd')]},'mobile':{'type':Sequelize[_0xc75f('0xd')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xc75f('0xd')]},'userpic':{'type':Sequelize[_0xc75f('0xd')]},'city':{'type':Sequelize[_0xc75f('0xd')]},'country':{'type':Sequelize[_0xc75f('0xd')]},'online':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc75f('0x17')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc75f('0xd')],'defaultValue':_0xc75f('0x18')},'lastPauseAt':{'type':Sequelize[_0xc75f('0x17')]},'chatCapacity':{'type':Sequelize[_0xc75f('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc75f('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc75f('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc75f('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc75f('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc75f('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'host':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![],'defaultValue':_0xc75f('0x19')},'ipaddr':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'port':{'type':Sequelize[_0xc75f('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xc75f('0x1a'),_0xc75f('0x1b'),_0xc75f('0x1c')),'allowNull':!![],'defaultValue':_0xc75f('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc75f('0x1d')},'callingpres':{'type':Sequelize[_0xc75f('0xf')]('ALLOWED_NOT_SCREENED',_0xc75f('0x1e'),_0xc75f('0x1f'),'ALLOWED',_0xc75f('0x20'),_0xc75f('0x21'),_0xc75f('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![],'defaultValue':_0xc75f('0x23'),'set':function(_0x11fc7d){this[_0xc75f('0x5')](_0xc75f('0x24'),_0x11fc7d?_0x11fc7d[_0xc75f('0x25')](','):null);},'get':function(){return this[_0xc75f('0xb')]('transport')?this[_0xc75f('0xb')](_0xc75f('0x24'))[_0xc75f('0x26')](','):null;},'comment':_0xc75f('0x27')},'dtmfmode':{'type':Sequelize['ENUM'](_0xc75f('0x28'),_0xc75f('0x29'),_0xc75f('0x2a'),_0xc75f('0x2b'),_0xc75f('0x2c')),'allowNull':!![],'defaultValue':_0xc75f('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xc75f('0x2d'),'no','nonat',_0xc75f('0x2e'),_0xc75f('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![],'defaultValue':_0xc75f('0x30'),'set':function(_0x266f18){this[_0xc75f('0x5')]('nat',_0x266f18?_0x266f18[_0xc75f('0x25')](','):null);},'get':function(){return this[_0xc75f('0xb')]('nat')?this['getDataValue'](_0xc75f('0x31'))[_0xc75f('0x26')](','):null;},'comment':_0xc75f('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc75f('0xd')]},'pickupgroup':{'type':Sequelize[_0xc75f('0xd')]},'namedpickupgroup':{'type':Sequelize[_0xc75f('0xd')]},'language':{'type':Sequelize[_0xc75f('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xc75f('0xd')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xf9b5db){this[_0xc75f('0x5')](_0xc75f('0x33'),_0xf9b5db?_0xf9b5db[_0xc75f('0x25')](';'):_0xc75f('0x34'));},'get':function(){return this[_0xc75f('0xb')](_0xc75f('0x33'))?this['getDataValue'](_0xc75f('0x33'))['split'](';'):null;},'comment':_0xc75f('0x35')},'autoframing':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![],'set':function(_0x13e41c){this[_0xc75f('0x5')](_0xc75f('0x36'),_0x13e41c?_0x13e41c[_0xc75f('0x25')](','):null);},'get':function(){return this[_0xc75f('0xb')](_0xc75f('0x36'))?this[_0xc75f('0xb')]('insecure')[_0xc75f('0x26')](','):null;},'comment':_0xc75f('0x37')},'trustrpid':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no',_0xc75f('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xc75f('0x2d')},'busylevel':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no',_0xc75f('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x3a'),_0xc75f('0x3b'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x3c'),_0xc75f('0x3d')),'allowNull':!![],'defaultValue':_0xc75f('0x3d')},'t38pt_usertpsource':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc75f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc75f('0xf')]('yes','no','fingerprint',_0xc75f('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc75f('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x3f'),'passive',_0xc75f('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xc75f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc75f('0xf')](_0xc75f('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xc75f('0x2d'),'no','nonat',_0xc75f('0x2e'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc75f('0xd')]},'resetPasswordExpires':{'type':Sequelize[_0xc75f('0x17')]},'showWebBar':{'type':Sequelize[_0xc75f('0x13')],'defaultValue':0x0,'set':function(_0x4fc1af){this[_0xc75f('0x5')](_0xc75f('0x41'),_0x4fc1af);var _0x276f40=this[_0xc75f('0x42')]({'plain':!![]});switch(_0x4fc1af){case 0x0:case 0x1:var _0x305b6e=_0x276f40[_0xc75f('0x24')]?_[_0xc75f('0x43')](_0x276f40['transport'])?_0x276f40['transport'][_0xc75f('0x25')]():_0x276f40[_0xc75f('0x24')]:'udp';if(_0x305b6e===_0xc75f('0x44')){_0x305b6e=_0xc75f('0x23');}this[_0xc75f('0x5')](_0xc75f('0x24'),_0x305b6e);this[_0xc75f('0x5')]('encryption','no');this['setDataValue'](_0xc75f('0x45'),null);this[_0xc75f('0x5')](_0xc75f('0x46'),null);this[_0xc75f('0x5')](_0xc75f('0x47'),null);this['setDataValue'](_0xc75f('0x48'),null);this[_0xc75f('0x5')](_0xc75f('0x49'),null);this[_0xc75f('0x5')]('dtlssetup',null);this[_0xc75f('0x5')]('dtlscertfile',null);this[_0xc75f('0x5')]('dtlsprivatekey',null);this[_0xc75f('0x5')]('rtcp_mux','no');break;case 0x2:this[_0xc75f('0x5')](_0xc75f('0x24'),_0xc75f('0x44'));this['setDataValue']('encryption',_0xc75f('0x2d'));this['setDataValue'](_0xc75f('0x45'),'yes');this['setDataValue']('force_avp',_0xc75f('0x2d'));this[_0xc75f('0x5')](_0xc75f('0x47'),_0xc75f('0x2d'));this[_0xc75f('0x5')]('dtlsenable',_0xc75f('0x2d'));this[_0xc75f('0x5')](_0xc75f('0x49'),'no');this[_0xc75f('0x5')](_0xc75f('0x4a'),_0xc75f('0x40'));this[_0xc75f('0x5')](_0xc75f('0x4b'),_0x276f40[_0xc75f('0x4b')]||_0xc75f('0x4c'));this[_0xc75f('0x5')](_0xc75f('0x4d'),_0x276f40[_0xc75f('0x4d')]||'/etc/pki/tls/private/motion.key');this[_0xc75f('0x5')](_0xc75f('0x4e'),_0xc75f('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xc75f('0x4f')],'set':function(_0x4ce10f){this['setDataValue'](_0xc75f('0x50'),_0x4ce10f?_0x4ce10f['join'](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0xc75f('0x51')](this['getDataValue']('permissions')[_0xc75f('0x26')](','),function(_0x565689){return parseInt(_0x565689,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc75f('0xd')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc75f('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc75f('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc75f('0xd')]},'passwordResetAt':{'type':Sequelize[_0xc75f('0x17')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xc75f('0x52'))?this[_0xc75f('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc75f('0xd')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![],'set':function(_0x3b0bb8){if(typeof _0x3b0bb8==='string'){var _0x562dc4=_0x3b0bb8==='1'?!![]:_0x3b0bb8==='0'?![]:_0x3b0bb8===_0xc75f('0x53')?!![]:_0x3b0bb8==='false'?![]:![];this[_0xc75f('0x5')](_0xc75f('0x54'),_0x562dc4);}else{this['setDataValue']('screenrecording',_0x3b0bb8);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x45fa4f){this[_0xc75f('0x5')](_0xc75f('0x55'),_0x45fa4f);if(_0x45fa4f===!![]){this[_0xc75f('0x5')](_0xc75f('0x56'),moment());this[_0xc75f('0x5')]('loginAttempts',0x0);}else{this[_0xc75f('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xc75f('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc75f('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc75f('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xfac8=['actpass','nonat','update,nonat','showWebBar','get','udp','wss','encryption','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','avpf','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','sequelize','moment','util','lodash','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','getDataValue','internal','email','toLowerCase','admin','user','telephone','local','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','join','transport','split','rfc2833','info','shortinfo','inband','auto','update','outgoing','yes','nat','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','refuse','originate','uac','uas','certificate','active','passive'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0xfac8,0x16e));var _0x8fac=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0xfac8[_0x4dbba7];return _0x43ef83;};'use strict';var Sequelize=require(_0x8fac('0x0'));var moment=require(_0x8fac('0x1'));var util=require(_0x8fac('0x2'));var _=require(_0x8fac('0x3'));module['exports']={'name':{'type':Sequelize[_0x8fac('0x4')],'allowNull':![],'unique':_0x8fac('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4b21a5){this[_0x8fac('0x6')](_0x8fac('0x5'),_0x4b21a5);this[_0x8fac('0x6')]('defaultuser',_0x4b21a5);},'comment':_0x8fac('0x7')},'fullname':{'type':Sequelize[_0x8fac('0x4')],'allowNull':![],'set':function(_0x1405da){this[_0x8fac('0x6')](_0x8fac('0x8'),_0x1405da);this['setDataValue'](_0x8fac('0x9'),util[_0x8fac('0xa')]('\x22%s\x22\x20<%s>',_0x1405da,this[_0x8fac('0xb')](_0x8fac('0xc'))));}},'alias':{'type':Sequelize[_0x8fac('0x4')]},'email':{'type':Sequelize[_0x8fac('0x4')],'allowNull':![],'unique':_0x8fac('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1bafe8){if(_0x1bafe8){this['setDataValue'](_0x8fac('0xd'),_0x1bafe8[_0x8fac('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x8fac('0xf'),_0x8fac('0x10'),'agent',_0x8fac('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x8fac('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x8fac('0x4')],'defaultValue':_0x8fac('0x12')},'internal':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x885e8){this['setDataValue'](_0x8fac('0xc'),_0x885e8);this['setDataValue'](_0x8fac('0x14'),_0x885e8);this['setDataValue'](_0x8fac('0x9'),util[_0x8fac('0xa')]('\x22%s\x22\x20<%s>',this['getDataValue']('fullname'),_0x885e8));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8fac('0x4')]},'mobile':{'type':Sequelize[_0x8fac('0x4')]},'address':{'type':Sequelize[_0x8fac('0x4')]},'zipcode':{'type':Sequelize[_0x8fac('0x4')]},'userpic':{'type':Sequelize[_0x8fac('0x4')]},'city':{'type':Sequelize[_0x8fac('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x8fac('0x16')]},'voicePause':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x8fac('0x4')],'defaultValue':_0x8fac('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x8fac('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x8fac('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x8fac('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x8fac('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x8fac('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x8fac('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![],'defaultValue':_0x8fac('0x18')},'ipaddr':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x1a'),_0x8fac('0x10'),_0x8fac('0x1b')),'allowNull':!![],'defaultValue':_0x8fac('0x1a')},'context':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![],'defaultValue':_0x8fac('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x8fac('0x1d'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED',_0x8fac('0x1e'),_0x8fac('0x1f'),'PROHIB_FAILED_SCREEN',_0x8fac('0x20')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4dfeff){this[_0x8fac('0x6')]('transport',_0x4dfeff?_0x4dfeff[_0x8fac('0x21')](','):null);},'get':function(){return this[_0x8fac('0xb')](_0x8fac('0x22'))?this[_0x8fac('0xb')](_0x8fac('0x22'))[_0x8fac('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x24'),_0x8fac('0x25'),_0x8fac('0x26'),_0x8fac('0x27'),_0x8fac('0x28')),'allowNull':!![],'defaultValue':_0x8fac('0x24')},'directmedia':{'type':Sequelize[_0x8fac('0x19')]('yes','no','nonat',_0x8fac('0x29'),_0x8fac('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x8fac('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x452eef){this[_0x8fac('0x6')](_0x8fac('0x2c'),_0x452eef?_0x452eef['join'](','):null);},'get':function(){return this['getDataValue'](_0x8fac('0x2c'))?this[_0x8fac('0xb')](_0x8fac('0x2c'))[_0x8fac('0x23')](','):null;},'comment':_0x8fac('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x8fac('0x4')]},'pickupgroup':{'type':Sequelize[_0x8fac('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x8fac('0x4')]},'language':{'type':Sequelize[_0x8fac('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x8fac('0x4')]},'disallow':{'type':Sequelize[_0x8fac('0x4')],'allowNull':![],'defaultValue':_0x8fac('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8fac('0x2f'),'set':function(_0x22ac9b){this['setDataValue'](_0x8fac('0x30'),_0x22ac9b?_0x22ac9b[_0x8fac('0x21')](';'):_0x8fac('0x2f'));},'get':function(){return this[_0x8fac('0xb')](_0x8fac('0x30'))?this[_0x8fac('0xb')](_0x8fac('0x30'))[_0x8fac('0x23')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![],'set':function(_0xef54b5){this['setDataValue'](_0x8fac('0x31'),_0xef54b5?_0xef54b5[_0x8fac('0x21')](','):null);},'get':function(){return this[_0x8fac('0xb')](_0x8fac('0x31'))?this['getDataValue'](_0x8fac('0x31'))[_0x8fac('0x23')](','):null;},'comment':_0x8fac('0x32')},'trustrpid':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no',_0x8fac('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x8fac('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x8fac('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x8fac('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x8fac('0x19')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x8fac('0x19')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x8fac('0x19')]('accept',_0x8fac('0x34'),_0x8fac('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x8fac('0x36'),_0x8fac('0x37')),'allowNull':!![],'defaultValue':_0x8fac('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x8fac('0x2b')},'keepalive':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x8fac('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x8fac('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x8fac('0x19')]('yes','no','fingerprint',_0x8fac('0x38')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x39'),_0x8fac('0x3a'),_0x8fac('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x8fac('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no',_0x8fac('0x3c'),'update',_0x8fac('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x8fac('0x16')]},'showWebBar':{'type':Sequelize[_0x8fac('0x13')],'defaultValue':0x0,'set':function(_0x14aa8e){this[_0x8fac('0x6')](_0x8fac('0x3e'),_0x14aa8e);var _0x195248=this[_0x8fac('0x3f')]({'plain':!![]});switch(_0x14aa8e){case 0x0:case 0x1:var _0xcd4122=_0x195248[_0x8fac('0x22')]?_['isArray'](_0x195248[_0x8fac('0x22')])?_0x195248[_0x8fac('0x22')][_0x8fac('0x21')]():_0x195248[_0x8fac('0x22')]:_0x8fac('0x40');if(_0xcd4122===_0x8fac('0x41')){_0xcd4122=_0x8fac('0x40');}this[_0x8fac('0x6')]('transport',_0xcd4122);this['setDataValue'](_0x8fac('0x42'),'no');this[_0x8fac('0x6')]('avpf',null);this[_0x8fac('0x6')]('force_avp',null);this[_0x8fac('0x6')](_0x8fac('0x43'),null);this['setDataValue'](_0x8fac('0x44'),null);this['setDataValue'](_0x8fac('0x45'),null);this['setDataValue'](_0x8fac('0x46'),null);this[_0x8fac('0x6')]('dtlscertfile',null);this[_0x8fac('0x6')](_0x8fac('0x47'),null);this[_0x8fac('0x6')](_0x8fac('0x48'),'no');break;case 0x2:this['setDataValue'](_0x8fac('0x22'),_0x8fac('0x41'));this[_0x8fac('0x6')](_0x8fac('0x42'),'yes');this[_0x8fac('0x6')](_0x8fac('0x49'),_0x8fac('0x2b'));this[_0x8fac('0x6')]('force_avp',_0x8fac('0x2b'));this[_0x8fac('0x6')](_0x8fac('0x43'),_0x8fac('0x2b'));this[_0x8fac('0x6')](_0x8fac('0x44'),_0x8fac('0x2b'));this[_0x8fac('0x6')](_0x8fac('0x45'),'no');this[_0x8fac('0x6')](_0x8fac('0x46'),'actpass');this['setDataValue'](_0x8fac('0x4a'),_0x195248[_0x8fac('0x4a')]||_0x8fac('0x4b'));this[_0x8fac('0x6')](_0x8fac('0x47'),_0x195248[_0x8fac('0x47')]||_0x8fac('0x4c'));this['setDataValue']('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x8fac('0x4d')],'set':function(_0x9779c7){this[_0x8fac('0x6')](_0x8fac('0x4e'),_0x9779c7?_0x9779c7[_0x8fac('0x21')](','):[]);},'get':function(){return this[_0x8fac('0xb')](_0x8fac('0x4e'))?_[_0x8fac('0x4f')](this[_0x8fac('0xb')](_0x8fac('0x4e'))[_0x8fac('0x23')](','),function(_0x26833c){return parseInt(_0x26833c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x8fac('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x8fac('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x8fac('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x8fac('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x8fac('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x8fac('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x8fac('0x19')](_0x8fac('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x8fac('0x4')]},'passwordResetAt':{'type':Sequelize[_0x8fac('0x16')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x8fac('0x50')],'get':function(){return this[_0x8fac('0xb')](_0x8fac('0x51'))?this['getDataValue'](_0x8fac('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x8fac('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x8fac('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![],'set':function(_0x5f53f7){if(typeof _0x5f53f7===_0x8fac('0x52')){var _0x17c861=_0x5f53f7==='1'?!![]:_0x5f53f7==='0'?![]:_0x5f53f7===_0x8fac('0x53')?!![]:_0x5f53f7==='false'?![]:![];this['setDataValue'](_0x8fac('0x54'),_0x17c861);}else{this['setDataValue'](_0x8fac('0x54'),_0x5f53f7);}}},'blocked':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![],'set':function(_0xe85158){this['setDataValue']('blocked',_0xe85158);if(_0xe85158===!![]){this[_0x8fac('0x6')]('blockedAt',moment());this[_0x8fac('0x6')]('loginAttempts',0x0);}else{this[_0x8fac('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x8fac('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 961fd67..db006de 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 _0xdc45=['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~!@#$%^&-_=+[{]}.','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','status','end','json','offset','limit','set','Content-Range','update','then','destroy','Users','user','agent','Telephones','telephone','filter','ignore','map','value','includes','role','name','UserProfileResource','stack','index','rawAttributes','fieldName','key','model','differenceBy','password','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','sequelize','lower','col','options','User','count','includeAll','include','findAll','rows','catch','show','salt','find','bulkCreate','body','params','describe','addContacts','ids','omit','agent\x20role','admin','../../config/license/util','getLicense','users','isNil','License\x20limit\x20reached','create','internal','Setting','securePassword','min_internal','max','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','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','105','106','107','108','109','100','111','114','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','UserProfileSection','autoAssociation','changePassword','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','emit','voice','VoiceQueue','format','UserVoiceQueueRt','upsert','removeQueues','remove','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','CmContact','getContacts','CmList','Tag','color','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','push','UserVoiceQueue.penalty','each','forEach','all','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','manual','chat','fax','sms','whatsapp','openchannel','%s%s','getTeams','Team','addTeams','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','Fax','getOpenchannelQueues','flatten','transaction','addAgent','Voice','Queue:save','removeTeams','Openchannel','getDataValue','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','isArray','addFaxInteractions','spread','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','Contact','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client'];(function(_0x5ba781,_0x37fd8d){var _0x18998e=function(_0x2c3627){while(--_0x2c3627){_0x5ba781['push'](_0x5ba781['shift']());}};_0x18998e(++_0x37fd8d);}(_0xdc45,0x156));var _0x5dc4=function(_0x2c5284,_0x3ee1b8){_0x2c5284=_0x2c5284-0x0;var _0x4c3f6d=_0xdc45[_0x2c5284];return _0x4c3f6d;};'use strict';var pdf=require(_0x5dc4('0x0'));var emlformat=require(_0x5dc4('0x1'));var rimraf=require(_0x5dc4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5dc4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5dc4('0x4'));var Mustache=require(_0x5dc4('0x5'));var util=require(_0x5dc4('0x6'));var path=require(_0x5dc4('0x7'));var sox=require('sox');var csv=require(_0x5dc4('0x8'));var ejs=require(_0x5dc4('0x9'));var fs=require('fs');var _=require(_0x5dc4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5dc4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5dc4('0x8'));var querystring=require(_0x5dc4('0xc'));var Papa=require(_0x5dc4('0xd'));var Redis=require(_0x5dc4('0xe'));var authService=require(_0x5dc4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5dc4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5dc4('0x11'))('api');var utils=require(_0x5dc4('0x12'));var config=require(_0x5dc4('0x13'));var db=require(_0x5dc4('0x14'))['db'];config['redis']=_[_0x5dc4('0x15')](config[_0x5dc4('0x16')],{'host':_0x5dc4('0x17'),'port':0x18eb});var socket=require(_0x5dc4('0x18'))(new Redis(config[_0x5dc4('0x16')]));require(_0x5dc4('0x19'))[_0x5dc4('0x1a')](socket);var jayson=require(_0x5dc4('0x1b'));var client=jayson[_0x5dc4('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x158153,_0xfb6b03,_0x2edfea){if(_0x2edfea){var _0x3c9cee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3c9cee[_0x5dc4('0x1d')](_0xfb6b03)){return _0x158153;}else{throw new db[(_0x5dc4('0x1e'))][(_0x5dc4('0x1f'))](_0x5dc4('0x20'));}}else{return _0x158153;}}function respondWithRpcPromise(_0x3952df,_0x522fdf,_0x164996,_0x5d528b){return new BPromise(function(_0x54647f,_0x30204b){var _0x42f537=_0x5d528b||client;return _0x42f537[_0x5dc4('0x21')](_0x3952df,_0x164996)['then'](function(_0x2ee0c5){logger[_0x5dc4('0x22')](_0x5dc4('0x23'),_0x522fdf,_0x5dc4('0x24'));logger[_0x5dc4('0x25')](_0x5dc4('0x26'),_0x522fdf,_0x5dc4('0x24'),JSON[_0x5dc4('0x27')](_0x2ee0c5));if(_0x2ee0c5['error']){if(_0x2ee0c5['error'][_0x5dc4('0x28')]===0x1f4){logger[_0x5dc4('0x29')](_0x5dc4('0x23'),_0x522fdf,_0x2ee0c5['error'][_0x5dc4('0x2a')]);return _0x30204b(_0x2ee0c5[_0x5dc4('0x29')]['message']);}logger[_0x5dc4('0x29')](_0x5dc4('0x23'),_0x522fdf,_0x2ee0c5['error'][_0x5dc4('0x2a')]);return _0x54647f(_0x2ee0c5['error'][_0x5dc4('0x2a')]);}else{logger[_0x5dc4('0x22')](_0x5dc4('0x23'),_0x522fdf,_0x5dc4('0x24'));_0x54647f(_0x2ee0c5[_0x5dc4('0x2b')][_0x5dc4('0x2a')]);}})['catch'](function(_0x12122a){logger[_0x5dc4('0x29')](_0x5dc4('0x23'),_0x522fdf,_0x12122a);_0x30204b(_0x12122a);});});}function respondWithStatusCode(_0x200cfd,_0x404ad2){_0x404ad2=_0x404ad2||0xcc;return function(_0x45ed58){if(_0x45ed58){return _0x200cfd['sendStatus'](_0x404ad2);}return _0x200cfd[_0x5dc4('0x2c')](_0x404ad2)[_0x5dc4('0x2d')]();};}function respondWithResult(_0x23e18d,_0x3026df){_0x3026df=_0x3026df||0xc8;return function(_0x2355ab){if(_0x2355ab){return _0x23e18d[_0x5dc4('0x2c')](_0x3026df)[_0x5dc4('0x2e')](_0x2355ab);}};}function respondWithFilteredResult(_0x3b6990,_0x5e7a1a){return function(_0x2c4dfc){if(_0x2c4dfc){var _0x2ae93a=_0x2c4dfc['count'],_0x165c44=_0x5e7a1a[_0x5dc4('0x2f')],_0x284dd9=_0x5e7a1a[_0x5dc4('0x2f')]+_0x5e7a1a[_0x5dc4('0x30')],_0x148754;if(_0x284dd9>=_0x2ae93a){_0x284dd9=_0x2ae93a;_0x148754=0xc8;}else{_0x148754=0xce;}_0x3b6990[_0x5dc4('0x2c')](_0x148754);return _0x3b6990[_0x5dc4('0x31')](_0x5dc4('0x32'),_0x165c44+'-'+_0x284dd9+'/'+_0x2ae93a)['json'](_0x2c4dfc);}return null;};}function patchUpdates(_0x4874c1){return function(_0x574a16){try{jsonpatch['apply'](_0x574a16,_0x4874c1,!![]);}catch(_0x468850){return BPromise['reject'](_0x468850);}return _0x574a16['save']();};}function saveUpdates(_0x5c8e29,_0x1cf7e1){return function(_0x3ff1fc){if(_0x3ff1fc){return _0x3ff1fc[_0x5dc4('0x33')](_0x5c8e29)[_0x5dc4('0x34')](function(_0x334772){return _0x334772;});}return null;};}function removeEntity(_0x3c8ea3,_0x535d31){return function(_0x1ec09d){if(_0x1ec09d){return _0x1ec09d[_0x5dc4('0x35')]()[_0x5dc4('0x34')](function(){var _0x5ed0fc=_0x1ec09d['get']({'plain':!![]});var _0x49f3a4=[{'name':_0x5dc4('0x36'),'value':_0x5dc4('0x37'),'ignore':!![]},{'name':'Agents','value':_0x5dc4('0x38'),'ignore':![]},{'name':_0x5dc4('0x39'),'value':_0x5dc4('0x3a'),'ignore':![]}];var _0x57ca37=_(_0x49f3a4)[_0x5dc4('0x3b')](_0x5dc4('0x3c'))[_0x5dc4('0x3d')]('value')[_0x5dc4('0x3e')]();if(_[_0x5dc4('0x3f')](_0x57ca37,_0x5ed0fc[_0x5dc4('0x40')])){return;}var _0x2742e7=_['find'](_0x49f3a4,['value',_0x5ed0fc[_0x5dc4('0x40')]])[_0x5dc4('0x41')];return db[_0x5dc4('0x42')][_0x5dc4('0x35')]({'where':{'type':_0x2742e7,'resourceId':_0x5ed0fc['id']}})[_0x5dc4('0x34')](function(){return _0x1ec09d;});})[_0x5dc4('0x34')](function(){_0x3c8ea3['status'](0xcc)[_0x5dc4('0x2d')]();});}};}function handleEntityNotFound(_0x35e525,_0xcf1bc7){return function(_0x4422ce){if(!_0x4422ce){_0x35e525['sendStatus'](0x194);}return _0x4422ce;};}function handleError(_0x34a792,_0x3478f5){_0x3478f5=_0x3478f5||0x1f4;return function(_0x365e24){logger[_0x5dc4('0x29')](_0x365e24[_0x5dc4('0x43')]);if(_0x365e24[_0x5dc4('0x41')]){delete _0x365e24[_0x5dc4('0x41')];}_0x34a792[_0x5dc4('0x2c')](_0x3478f5)['send'](_0x365e24);};}exports[_0x5dc4('0x44')]=function(_0x2c2d8f,_0x56be20){var _0x13e984={},_0x2270b1={},_0x3012a6={'count':0x0,'rows':[]};var _0x3f298d=_[_0x5dc4('0x3d')](db['User'][_0x5dc4('0x45')],function(_0x26200f){return{'name':_0x26200f[_0x5dc4('0x46')],'type':_0x26200f['type'][_0x5dc4('0x47')]};});_0x2270b1[_0x5dc4('0x48')]=_[_0x5dc4('0x49')](_[_0x5dc4('0x3d')](_0x3f298d,_0x5dc4('0x41')),[_0x5dc4('0x4a'),'salt']);_0x2270b1[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x2c2d8f[_0x5dc4('0x4b')]);_0x2270b1[_0x5dc4('0x4d')]=_['intersection'](_0x2270b1[_0x5dc4('0x48')],_0x2270b1[_0x5dc4('0x4b')]);_0x13e984[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0x2270b1[_0x5dc4('0x48')],qs['fields'](_0x2c2d8f[_0x5dc4('0x4b')][_0x5dc4('0x50')]));_0x13e984[_0x5dc4('0x4e')]=_0x13e984[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x13e984[_0x5dc4('0x4e')]:_0x2270b1[_0x5dc4('0x48')];if(!_0x2c2d8f[_0x5dc4('0x4b')][_0x5dc4('0x52')](_0x5dc4('0x53'))){_0x13e984[_0x5dc4('0x30')]=qs['limit'](_0x2c2d8f[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x13e984['offset']=qs[_0x5dc4('0x2f')](_0x2c2d8f[_0x5dc4('0x4b')][_0x5dc4('0x2f')]);}_0x13e984[_0x5dc4('0x54')]=qs['sort'](_0x2c2d8f[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x13e984[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x2c2d8f[_0x5dc4('0x4b')],_0x2270b1['filters']),_0x3f298d);if(_0x2c2d8f[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0x13e984[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x13e984[_0x5dc4('0x56')],{'$or':_['map'](_0x3f298d,function(_0x1d025b){if(_0x1d025b[_0x5dc4('0x59')]!=='VIRTUAL'){return db['sequelize'][_0x5dc4('0x56')](db[_0x5dc4('0x5a')]['fn'](_0x5dc4('0x5b'),db['sequelize'][_0x5dc4('0x5c')](_0x1d025b[_0x5dc4('0x41')])),{'$like':db['sequelize']['fn']('lower','%'+_0x2c2d8f[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%')});}})});}_0x13e984=_['merge']({},_0x13e984,_0x2c2d8f[_0x5dc4('0x5d')]);var _0x1c77d4={'where':_0x13e984[_0x5dc4('0x56')]};return db[_0x5dc4('0x5e')][_0x5dc4('0x5f')](_0x1c77d4)[_0x5dc4('0x34')](function(_0x21e47d){_0x3012a6['count']=_0x21e47d;if(_0x2c2d8f['query'][_0x5dc4('0x60')]){_0x13e984[_0x5dc4('0x61')]=[{'all':!![]}];}return db['User'][_0x5dc4('0x62')](_0x13e984);})[_0x5dc4('0x34')](function(_0x5d93c4){_0x3012a6[_0x5dc4('0x63')]=_0x5d93c4;return _0x3012a6;})[_0x5dc4('0x34')](respondWithFilteredResult(_0x56be20,_0x13e984))[_0x5dc4('0x64')](handleError(_0x56be20,null));};exports[_0x5dc4('0x65')]=function(_0x19f238,_0x5593cc){var _0xb25e8c={'raw':![],'where':{'id':_0x19f238['params']['id']}},_0x167a01={};_0x167a01[_0x5dc4('0x48')]=_[_0x5dc4('0x49')](_[_0x5dc4('0x4c')](db[_0x5dc4('0x5e')][_0x5dc4('0x45')]),[_0x5dc4('0x4a'),_0x5dc4('0x66')]);_0x167a01[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x19f238[_0x5dc4('0x4b')]);_0x167a01[_0x5dc4('0x4d')]=_['intersection'](_0x167a01['model'],_0x167a01[_0x5dc4('0x4b')]);_0xb25e8c[_0x5dc4('0x4e')]=_['intersection'](_0x167a01[_0x5dc4('0x48')],qs[_0x5dc4('0x50')](_0x19f238[_0x5dc4('0x4b')][_0x5dc4('0x50')]));_0xb25e8c[_0x5dc4('0x4e')]=_0xb25e8c['attributes']['length']?_0xb25e8c[_0x5dc4('0x4e')]:_0x167a01[_0x5dc4('0x48')];if(_0x19f238['query'][_0x5dc4('0x60')]){_0xb25e8c['include']=[{'all':!![]}];}_0xb25e8c=_['merge']({},_0xb25e8c,_0x19f238[_0x5dc4('0x5d')]);return db[_0x5dc4('0x5e')][_0x5dc4('0x67')](_0xb25e8c)[_0x5dc4('0x34')](handleEntityNotFound(_0x5593cc,null))[_0x5dc4('0x34')](respondWithResult(_0x5593cc,null))[_0x5dc4('0x64')](handleError(_0x5593cc,null));};exports[_0x5dc4('0x68')]=function(_0x24e19b,_0x2d7020){return db[_0x5dc4('0x5e')][_0x5dc4('0x68')](_0x24e19b[_0x5dc4('0x69')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2d7020,0xc9))[_0x5dc4('0x64')](handleError(_0x2d7020,null));};exports['update']=function(_0x5280e7,_0x8b4a8b){if(_0x5280e7[_0x5dc4('0x69')]['id']){delete _0x5280e7[_0x5dc4('0x69')]['id'];}delete _0x5280e7['body'][_0x5dc4('0x40')];return db[_0x5dc4('0x5e')][_0x5dc4('0x67')]({'where':{'id':_0x5280e7[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x8b4a8b,null))[_0x5dc4('0x34')](saveUpdates(_0x5280e7[_0x5dc4('0x69')],null))['then'](respondWithResult(_0x8b4a8b,null))[_0x5dc4('0x64')](handleError(_0x8b4a8b,null));};exports['describe']=function(_0x444fb6,_0x191b50){return db[_0x5dc4('0x5e')][_0x5dc4('0x6b')]()[_0x5dc4('0x34')](respondWithResult(_0x191b50,null))['catch'](handleError(_0x191b50,null));};exports[_0x5dc4('0x6c')]=function(_0x178ecb,_0x2f4e02,_0x11af0f){return db[_0x5dc4('0x5e')]['find']({'where':{'id':_0x178ecb[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x2f4e02,null))[_0x5dc4('0x34')](function(_0x1a3351){if(_0x1a3351){return _0x1a3351[_0x5dc4('0x6c')](_0x178ecb['body'][_0x5dc4('0x6d')],_[_0x5dc4('0x6e')](_0x178ecb[_0x5dc4('0x69')],['ids','id'])||{});}})[_0x5dc4('0x34')](respondWithResult(_0x2f4e02,null))[_0x5dc4('0x64')](handleError(_0x2f4e02,null));};var getLicense=function(_0x235505){return new BPromise(function(_0x1193aa,_0x4488a7){var _0x3881c8=0x0;_0x235505[_0x5dc4('0x69')][_0x5dc4('0x40')]===_0x5dc4('0x38')&&_0x1193aa(_0x5dc4('0x6f'));return db[_0x5dc4('0x5e')][_0x5dc4('0x5f')]({'where':{'$or':[{'role':_0x235505[_0x5dc4('0x69')][_0x5dc4('0x40')]===_0x5dc4('0x3a')?'telephone':[_0x5dc4('0x70'),'user']}]}})[_0x5dc4('0x34')](function(_0x5ca182){_0x3881c8=_0x5ca182;return require(_0x5dc4('0x71'))[_0x5dc4('0x72')]();})['then'](function(_0x19c095){var _0x297073=_0x235505[_0x5dc4('0x69')][_0x5dc4('0x40')]===_0x5dc4('0x3a')?'telephones':_0x5dc4('0x73');if(!_[_0x5dc4('0x74')](_0x19c095[_0x297073])&&_0x3881c8>=_0x19c095[_0x297073]){return _0x4488a7({'message':_0x5dc4('0x75')});}return _0x1193aa(util['format']('count\x20%s:\x20%s',_0x297073,_0x3881c8));})[_0x5dc4('0x64')](function(_0x44fde0){return _0x4488a7(_0x44fde0);});});};exports[_0x5dc4('0x76')]=function(_0x483fab,_0x1c58eb){return getLicense(_0x483fab)['then'](function(_0x1af986){if(!_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x77')]){var _0x1aa15f;return db[_0x5dc4('0x78')]['findById'](0x1)[_0x5dc4('0x34')](function(_0x3f6515){return checkPasswordPattern(_0x3f6515,_0x483fab[_0x5dc4('0x69')]['password'],_0x3f6515[_0x5dc4('0x79')]);})[_0x5dc4('0x34')](function(_0x425709){_0x1aa15f=_0x425709[_0x5dc4('0x7a')];return db['User'][_0x5dc4('0x7b')](_0x5dc4('0x77'));})['then'](function(_0x4d857c){if(_[_0x5dc4('0x74')](_0x4d857c)){if(_0x1aa15f){_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x77')]=_0x1aa15f;}else{_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x77')]=0x1;}}else{if(_['isNil'](_0x1aa15f)||_0x1aa15f==_0x4d857c){_0x483fab['body'][_0x5dc4('0x77')]=_0x4d857c+0x1;}else if(_0x1aa15f>_0x4d857c){_0x483fab[_0x5dc4('0x69')]['internal']=_0x1aa15f;}else{return db[_0x5dc4('0x5a')]['query'](_0x5dc4('0x7c'),{'type':db[_0x5dc4('0x5a')][_0x5dc4('0x7d')]['SELECT']})[_0x5dc4('0x34')](function(_0x3d9a51){if(_0x3d9a51&&_0x3d9a51[_0x5dc4('0x51')]){for(var _0x1d97ae=0x0,_0x1cc31f=_0x3d9a51[_0x5dc4('0x51')];_0x1d97ae<_0x1cc31f&&_[_0x5dc4('0x74')](_0x483fab[_0x5dc4('0x69')]['internal']);_0x1d97ae++){if(_0x1aa15f<=_0x3d9a51[_0x1d97ae][_0x5dc4('0x7e')]){_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x77')]=_0x3d9a51[_0x1d97ae]['from'];}else if(_0x1aa15f>_0x3d9a51[_0x1d97ae]['from']&&_0x1aa15f<=_0x3d9a51[_0x1d97ae]['to']){_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x77')]=_0x1aa15f;}}}if(_[_0x5dc4('0x74')](_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x77')])){_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x77')]=_0x4d857c+0x1;}});}}});}})[_0x5dc4('0x34')](function(){if(_0x483fab['body'][_0x5dc4('0x7f')]){_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x80')]=_0x483fab['body'][_0x5dc4('0x77')];_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x81')]={'mailbox':_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x77')],'password':_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x4a')],'fullname':_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x82')],'email':_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x83')]};}if(_0x483fab[_0x5dc4('0x69')]&&_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x40')]===_0x5dc4('0x38')){if(!_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x84')]){_0x483fab[_0x5dc4('0x69')]['permissions']=[_0x5dc4('0x85'),'102','103','113','110','104',_0x5dc4('0x86'),_0x5dc4('0x87'),_0x5dc4('0x88'),_0x5dc4('0x89'),_0x5dc4('0x8a'),_0x5dc4('0x8b'),_0x5dc4('0x8c'),_0x5dc4('0x8d')];}}return db[_0x5dc4('0x5e')][_0x5dc4('0x76')](_0x483fab[_0x5dc4('0x69')],{'include':[{'model':db['VoiceMail'],'as':_0x5dc4('0x81')}]});})[_0x5dc4('0x34')](function(_0x26ec0d){if(_0x483fab[_0x5dc4('0x69')][_0x5dc4('0x40')]===_0x5dc4('0x37'))return _0x26ec0d;var _0x756482=_0x483fab['user'][_0x5dc4('0x8e')]({'plain':!![]});if(!_0x756482)throw new Error(_0x5dc4('0x8f'));if(_0x756482[_0x5dc4('0x40')]===_0x5dc4('0x37')){var _0x155424=_0x26ec0d['get']({'plain':!![]});var _0x26b072=[{'name':_0x5dc4('0x90'),'value':_0x5dc4('0x38')},{'name':'Telephones','value':_0x5dc4('0x3a')}];var _0x11697e=_[_0x5dc4('0x67')](_0x26b072,['value',_0x155424[_0x5dc4('0x40')]])[_0x5dc4('0x41')];return db[_0x5dc4('0x91')][_0x5dc4('0x67')]({'where':{'name':_0x11697e,'userProfileId':_0x756482['userProfileId']},'raw':!![]})[_0x5dc4('0x34')](function(_0x58ed66){if(_0x58ed66&&_0x58ed66[_0x5dc4('0x92')]===0x0){return db[_0x5dc4('0x42')][_0x5dc4('0x76')]({'name':_0x155424[_0x5dc4('0x41')],'resourceId':_0x155424['id'],'type':_0x58ed66[_0x5dc4('0x41')],'sectionId':_0x58ed66['id']},{})[_0x5dc4('0x34')](function(){return _0x26ec0d;});}else{return _0x26ec0d;}})[_0x5dc4('0x64')](function(_0x1a7fe6){logger[_0x5dc4('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a7fe6);throw _0x1a7fe6;});}return _0x26ec0d;})[_0x5dc4('0x34')](respondWithResult(_0x1c58eb,0xc9))[_0x5dc4('0x64')](handleError(_0x1c58eb,null));};exports[_0x5dc4('0x93')]=function(_0x89ec1f,_0x226264,_0x52c78b){var _0x4bcb8d=![];if(_0x89ec1f[_0x5dc4('0x69')]['id']){delete _0x89ec1f[_0x5dc4('0x69')]['id'];}return db[_0x5dc4('0x78')][_0x5dc4('0x94')]({'attributes':['id',_0x5dc4('0x79')]})['then'](function(_0x14a5fe){_0x4bcb8d=_0x14a5fe[_0x5dc4('0x79')];return db[_0x5dc4('0x5e')][_0x5dc4('0x67')]({'where':{'id':_0x89ec1f[_0x5dc4('0x6a')]['id']}});})['then'](function(_0x5422f5){if(_0x5422f5){if(_0x5422f5['id']==_0x89ec1f[_0x5dc4('0x37')]['id']){if(!_0x89ec1f['body'][_0x5dc4('0x95')]||!_0x89ec1f[_0x5dc4('0x69')][_0x5dc4('0x96')]){throw new db['Sequelize'][(_0x5dc4('0x1f'))](_0x5dc4('0x97'));}if(!_0x5422f5['authenticate'](_0x89ec1f[_0x5dc4('0x69')]['oldPassword'])){throw new db[(_0x5dc4('0x1e'))][(_0x5dc4('0x1f'))](_0x5dc4('0x98'));}if(_0x89ec1f['body'][_0x5dc4('0x95')]==_0x89ec1f[_0x5dc4('0x69')][_0x5dc4('0x96')]){throw new db[(_0x5dc4('0x1e'))][(_0x5dc4('0x1f'))](_0x5dc4('0x99'));}return _0x5422f5;}else if(_0x89ec1f[_0x5dc4('0x37')][_0x5dc4('0x40')]=='admin'){if(!_0x89ec1f[_0x5dc4('0x69')][_0x5dc4('0x96')]){throw new db[(_0x5dc4('0x1e'))][(_0x5dc4('0x1f'))](_0x5dc4('0x9a'));}return _0x5422f5;}else if(_0x89ec1f['user']['role']=='user'){if(!_0x89ec1f[_0x5dc4('0x69')][_0x5dc4('0x96')]){throw new db['Sequelize'][(_0x5dc4('0x1f'))](_0x5dc4('0x9a'));}if(_0x5422f5[_0x5dc4('0x40')]!=_0x5dc4('0x38')){throw new db[(_0x5dc4('0x1e'))][(_0x5dc4('0x1f'))](_0x5dc4('0x9b'));}return _0x5422f5;}else{throw new db['Sequelize']['ValidationError'](_0x5dc4('0x9b'));}}return null;})[_0x5dc4('0x34')](handleEntityNotFound(_0x226264,null))[_0x5dc4('0x34')](function(_0x2444f7){return checkPasswordPattern(_0x2444f7,_0x89ec1f[_0x5dc4('0x69')][_0x5dc4('0x96')],_0x4bcb8d);})[_0x5dc4('0x34')](saveUpdates({'password':_0x89ec1f[_0x5dc4('0x69')]['newPassword'],'passwordResetAt':_0x89ec1f['user']['id']==_0x89ec1f[_0x5dc4('0x6a')]['id']?moment():null},null))[_0x5dc4('0x34')](respondWithResult(_0x226264,null))[_0x5dc4('0x64')](handleError(_0x226264,null));};exports[_0x5dc4('0x9c')]=function(_0x37a385,_0x190a2a,_0x1171da){var _0x142ca9=_0x37a385[_0x5dc4('0x69')][_0x5dc4('0x9d')];return db[_0x5dc4('0x5e')][_0x5dc4('0x67')]({'where':{'id':_0x37a385[_0x5dc4('0x6a')]['id']},'attributes':['id',_0x5dc4('0x41'),_0x5dc4('0x40'),_0x5dc4('0x9e'),_0x5dc4('0x9f'),_0x5dc4('0xa0'),_0x5dc4('0xa1')]})[_0x5dc4('0x34')](handleEntityNotFound(_0x190a2a,null))[_0x5dc4('0x34')](function(_0x2fb5e6){if(_0x2fb5e6){if(!utils[_0x5dc4('0xa2')](_0x142ca9)){throw new db['Sequelize']['ValidationError'](_0x5dc4('0xa3'));}return _0x2fb5e6[_0x5dc4('0xa4')+_[_0x5dc4('0xa5')](_0x142ca9[_0x5dc4('0xa6')]())+_0x5dc4('0xa7')](_0x37a385[_0x5dc4('0x69')][_0x5dc4('0x6d')],{'penalty':_0x37a385[_0x5dc4('0x69')][_0x5dc4('0xa8')]||0x0})['spread'](function(_0x4033ea){for(var _0x203d30=0x0;_0x203d30<_0x37a385[_0x5dc4('0x69')][_0x5dc4('0x6d')]['length'];_0x203d30+=0x1){var _0xaf0fae={'UserId':_0x37a385[_0x5dc4('0x6a')]['id']};_0xaf0fae[_[_0x5dc4('0xa5')](_0x142ca9[_0x5dc4('0xa6')]())+_0x5dc4('0xa9')]=_0x37a385['body'][_0x5dc4('0x6d')][_0x203d30];socket[_0x5dc4('0xaa')](_0x5dc4('0x37')+_[_0x5dc4('0xa5')](_0x142ca9[_0x5dc4('0xa6')]())+'Queue:save',_0xaf0fae);}return _0x4033ea;})[_0x5dc4('0x34')](function(){if(_0x142ca9===_0x5dc4('0xab')){return db[_0x5dc4('0xac')][_0x5dc4('0x62')]({'where':{'id':_0x37a385['body']['ids']||[]},'raw':!![],'attributes':['id',_0x5dc4('0x41')]});}})[_0x5dc4('0x34')](function(_0x2c40eb){var _0x154063=_0x2fb5e6[_0x5dc4('0x8e')]({'plain':!![]});var _0x545d77=[];if(_0x142ca9==='voice'&&_0x154063['role']===_0x5dc4('0x38')&&_0x154063['online']){for(var _0x380437=0x0;_0x380437<_0x2c40eb['length'];_0x380437+=0x1){_0x545d77['push']({'membername':_0x154063[_0x5dc4('0x41')],'UserId':_0x154063['id'],'queue_name':_0x2c40eb[_0x380437][_0x5dc4('0x41')],'VoiceQueueId':_0x2c40eb[_0x380437]['id'],'interface':_[_0x5dc4('0x74')](_0x154063[_0x5dc4('0xa1')])?util[_0x5dc4('0xad')]('SIP/%s',_0x154063[_0x5dc4('0x41')]):_0x154063['interface'],'paused':_0x154063['voicePause']||![],'penalty':_0x37a385[_0x5dc4('0x69')][_0x5dc4('0xa8')]||0x0});}return BPromise['each'](_0x545d77,function(_0xb8e3de){return db[_0x5dc4('0xae')][_0x5dc4('0xaf')](_0xb8e3de);});}return _0x2fb5e6;});}})[_0x5dc4('0x34')](respondWithStatusCode(_0x190a2a,null))['catch'](handleError(_0x190a2a,null));};exports[_0x5dc4('0xb0')]=function(_0x4a7f7c,_0x17acf2,_0x31f9c4){var _0x352ca9;return db['User'][_0x5dc4('0x67')]({'where':{'id':_0x4a7f7c['params']['id']},'attributes':['id','name',_0x5dc4('0x40')]})['then'](handleEntityNotFound(_0x17acf2,null))[_0x5dc4('0x34')](function(_0x59f256){if(_0x59f256){_0x352ca9=_0x59f256;if(!_0x4a7f7c[_0x5dc4('0x4b')]['channel']||!utils[_0x5dc4('0xa2')](_0x4a7f7c[_0x5dc4('0x4b')][_0x5dc4('0x9d')])){throw new db[(_0x5dc4('0x1e'))][(_0x5dc4('0x1f'))](_0x5dc4('0xa3'));}return _0x59f256[_0x5dc4('0xb1')+_['capitalize'](_0x4a7f7c[_0x5dc4('0x4b')][_0x5dc4('0x9d')]['toLowerCase']())+_0x5dc4('0xa7')](_0x4a7f7c[_0x5dc4('0x4b')]['ids']);}})[_0x5dc4('0x34')](function(_0x53336e){for(var _0x144946=0x0;_0x144946<_0x4a7f7c[_0x5dc4('0x4b')][_0x5dc4('0x6d')][_0x5dc4('0x51')];_0x144946+=0x1){var _0x23899e={'UserId':_0x4a7f7c[_0x5dc4('0x6a')]['id']};_0x23899e[_[_0x5dc4('0xa5')](_0x4a7f7c[_0x5dc4('0x4b')][_0x5dc4('0x9d')]['toLowerCase']())+_0x5dc4('0xa9')]=_0x4a7f7c[_0x5dc4('0x4b')][_0x5dc4('0x6d')][_0x144946];socket[_0x5dc4('0xaa')]('user'+_[_0x5dc4('0xa5')](_0x4a7f7c[_0x5dc4('0x4b')][_0x5dc4('0x9d')]['toLowerCase']())+'Queue:remove',_0x23899e);}return _0x53336e;})['then'](function(){if(_0x4a7f7c[_0x5dc4('0x4b')]['channel']===_0x5dc4('0xab')){return db['UserVoiceQueueRt'][_0x5dc4('0x35')]({'where':{'UserId':_0x4a7f7c[_0x5dc4('0x6a')]['id'],'VoiceQueueId':_0x4a7f7c[_0x5dc4('0x4b')][_0x5dc4('0x6d')]},'individualHooks':!![]})[_0x5dc4('0x34')](function(){return _0x352ca9;});}return _0x352ca9;})['then'](respondWithStatusCode(_0x17acf2,null))[_0x5dc4('0x64')](handleError(_0x17acf2,null));};exports['addAvatar']=function(_0xfd3cb4,_0x22431a,_0x1469b2){_0xfd3cb4['body'][_0x5dc4('0xb2')]=_0xfd3cb4[_0x5dc4('0xb3')][_0x5dc4('0xb4')];return db['User']['find']({'where':{'id':_0xfd3cb4['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x22431a,null))[_0x5dc4('0x34')](saveUpdates(_0xfd3cb4[_0x5dc4('0x69')],null))[_0x5dc4('0x34')](respondWithResult(_0x22431a,null))[_0x5dc4('0x64')](handleError(_0x22431a,null));};exports[_0x5dc4('0xb5')]=function(_0x34199,_0x3dea3a,_0xd2d2d4){var _0x563f41=path['join'](config[_0x5dc4('0xb6')],_0x5dc4('0xb7'));return db[_0x5dc4('0x5e')][_0x5dc4('0x67')]({'where':{'id':_0x34199[_0x5dc4('0x6a')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x5dc4('0x34')](handleEntityNotFound(_0x3dea3a,null))[_0x5dc4('0x34')](function(_0x51e5a6){if(_0x51e5a6){if(_[_0x5dc4('0x74')](_0x51e5a6[_0x5dc4('0xb2')])){return _0x3dea3a[_0x5dc4('0xb8')](_0x563f41);}else{if(!fs[_0x5dc4('0xb9')](path[_0x5dc4('0xba')](config[_0x5dc4('0xb6')],'server/files/images/',_0x51e5a6['userpic']))){return _0x3dea3a[_0x5dc4('0xb8')](_0x563f41);}return _0x3dea3a['download'](path['join'](config['root'],'server/files/images/',_0x51e5a6[_0x5dc4('0xb2')]));}}})['catch'](handleError(_0x3dea3a,null));};exports['getContacts']=function(_0x14f981,_0x5d9ab1,_0x3d38c6){var _0x573bb1={};var _0x3c284a={};var _0x120caa;var _0x1c3c79;return db[_0x5dc4('0x5e')]['findOne']({'where':{'id':_0x14f981[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x5d9ab1,null))['then'](function(_0x275782){if(_0x275782){_0x120caa=_0x275782;_0x3c284a[_0x5dc4('0x48')]=_['keys'](db[_0x5dc4('0xbb')][_0x5dc4('0x45')]);_0x3c284a[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x14f981[_0x5dc4('0x4b')]);_0x3c284a[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x3c284a['model'],_0x3c284a['query']);_0x573bb1['attributes']=_['intersection'](_0x3c284a['model'],qs['fields'](_0x14f981[_0x5dc4('0x4b')]['fields']));_0x573bb1[_0x5dc4('0x4e')]=_0x573bb1[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x573bb1['attributes']:_0x3c284a[_0x5dc4('0x48')];_0x573bb1['order']=qs[_0x5dc4('0x55')](_0x14f981['query'][_0x5dc4('0x55')]);_0x573bb1['where']=qs[_0x5dc4('0x4d')](_['pick'](_0x14f981[_0x5dc4('0x4b')],_0x3c284a[_0x5dc4('0x4d')]));if(_0x14f981[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0x573bb1[_0x5dc4('0x56')]=_['merge'](_0x573bb1['where'],{'$or':_[_0x5dc4('0x3d')](_0x573bb1[_0x5dc4('0x4e')],function(_0x4dfe09){var _0x278bf2={};_0x278bf2[_0x4dfe09]={'$like':'%'+_0x14f981[_0x5dc4('0x4b')]['filter']+'%'};return _0x278bf2;})});}_0x573bb1=_[_0x5dc4('0x58')]({},_0x573bb1,_0x14f981[_0x5dc4('0x5d')]);return _0x120caa[_0x5dc4('0xbc')](_0x573bb1);}})[_0x5dc4('0x34')](function(_0x3f7d4e){if(_0x3f7d4e){_0x1c3c79=_0x3f7d4e[_0x5dc4('0x51')];if(_0x14f981['query'][_0x5dc4('0x52')]('includeAll')){_0x573bb1[_0x5dc4('0x61')]=[{'model':db[_0x5dc4('0xbd')],'as':'List','required':![]},{'model':db[_0x5dc4('0xbe')],'as':'Tags','attributes':['id',_0x5dc4('0x41'),_0x5dc4('0xbf')],'where':_0x14f981[_0x5dc4('0x4b')][_0x5dc4('0xc0')]?{'id':_0x14f981[_0x5dc4('0x4b')]['tag']}:undefined,'required':_0x14f981[_0x5dc4('0x4b')][_0x5dc4('0xc0')]?!![]:![]}];}if(!_0x14f981[_0x5dc4('0x4b')][_0x5dc4('0x52')]('nolimit')){_0x573bb1[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0x14f981['query'][_0x5dc4('0x30')]);_0x573bb1[_0x5dc4('0x2f')]=qs['offset'](_0x14f981['query'][_0x5dc4('0x2f')]);}return _0x120caa[_0x5dc4('0xbc')](_0x573bb1);}})[_0x5dc4('0x34')](function(_0x11555a){if(_0x11555a){return _0x11555a?{'count':_0x1c3c79,'rows':_0x11555a}:null;}})[_0x5dc4('0x34')](respondWithResult(_0x5d9ab1,null))[_0x5dc4('0x64')](handleError(_0x5d9ab1,null));};exports[_0x5dc4('0xc1')]=function(_0x1cecf0,_0x3257fc,_0x326d5a){var _0x30e329;var _0x16a2ca;var _0x140a50={};var _0x88804e;return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0x1cecf0['params']['id']},'attributes':['id','name',_0x5dc4('0x40')]})[_0x5dc4('0x34')](handleEntityNotFound(_0x3257fc,null))['then'](function(_0x52c5b2){if(!utils[_0x5dc4('0xa2')](_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x9d')])){throw new db[(_0x5dc4('0x1e'))]['ValidationError'](_0x5dc4('0xa3'));}_0x30e329=_0x52c5b2;var _0x246fcb={};_0x246fcb[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db[_[_0x5dc4('0xa5')](_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x9d')])+_0x5dc4('0xc2')][_0x5dc4('0x45')]);_0x246fcb[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x1cecf0[_0x5dc4('0x4b')]);_0x246fcb[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x246fcb[_0x5dc4('0x48')],_0x246fcb[_0x5dc4('0x4b')]);_0x140a50[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0x246fcb[_0x5dc4('0x48')],qs[_0x5dc4('0x50')](_0x1cecf0['query']['fields']));_0x140a50['attributes']=_0x140a50[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x140a50[_0x5dc4('0x4e')]:_0x246fcb['model'];_0x140a50[_0x5dc4('0x54')]=qs[_0x5dc4('0x55')](_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x140a50['where']=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x1cecf0['query'],_0x246fcb['filters']));if(_0x1cecf0['query']['filter']){_0x140a50[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x140a50[_0x5dc4('0x56')],{'$or':_[_0x5dc4('0x3d')](_0x140a50[_0x5dc4('0x4e')],function(_0x50b236){var _0xd53887={};_0xd53887[_0x50b236]={'$like':'%'+_0x1cecf0[_0x5dc4('0x4b')]['filter']+'%'};return _0xd53887;})});}_0x140a50=_['merge']({},_0x140a50,_0x1cecf0[_0x5dc4('0x5d')]);switch(_0x30e329[_0x5dc4('0x40')]){case _0x5dc4('0x70'):return db[_[_0x5dc4('0xa5')](_0x1cecf0[_0x5dc4('0x4b')]['channel'])+_0x5dc4('0xc2')][_0x5dc4('0x62')](_0x140a50);case'user':case _0x5dc4('0x38'):return _0x30e329[_0x5dc4('0x8e')+_[_0x5dc4('0xa5')](_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x9d')])+_0x5dc4('0xa7')](_0x140a50);default:throw new db[(_0x5dc4('0x1e'))]['ValidationError'](_0x5dc4('0xc3'));}})['then'](function(_0x4574a3){_0x88804e=_0x4574a3['length'];if(!_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x52')](_0x5dc4('0x53'))){_0x140a50['limit']=qs[_0x5dc4('0x30')](_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x140a50[_0x5dc4('0x2f')]=qs[_0x5dc4('0x2f')](_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x2f')]);}switch(_0x30e329[_0x5dc4('0x40')]){case'admin':return db[_[_0x5dc4('0xa5')](_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x9d')])+_0x5dc4('0xc2')][_0x5dc4('0x62')](_0x140a50);case _0x5dc4('0x37'):case _0x5dc4('0x38'):return _0x30e329[_0x5dc4('0x8e')+_[_0x5dc4('0xa5')](_0x1cecf0[_0x5dc4('0x4b')][_0x5dc4('0x9d')])+'Queues'](_0x140a50);}})['then'](function(_0x8f3bfc){return{'count':_0x88804e,'rows':_0x8f3bfc};})[_0x5dc4('0x34')](respondWithResult(_0x3257fc,null))['catch'](handleError(_0x3257fc,null));};exports['getVoiceQueuesRt']=function(_0x27d345,_0x49f84b,_0x5058b4){var _0xf3a01a={};var _0x3622a={};var _0x40efa3;var _0x2182fd;return db[_0x5dc4('0x5e')]['findOne']({'where':{'id':_0x27d345[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x49f84b,null))[_0x5dc4('0x34')](function(_0x444d2e){if(_0x444d2e){_0x40efa3=_0x444d2e;_0x3622a[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db[_0x5dc4('0xae')]['rawAttributes']);_0x3622a[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x27d345['query']);_0x3622a[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x3622a[_0x5dc4('0x48')],_0x3622a[_0x5dc4('0x4b')]);_0xf3a01a['attributes']=_[_0x5dc4('0x4f')](_0x3622a['model'],qs['fields'](_0x27d345[_0x5dc4('0x4b')][_0x5dc4('0x50')]));_0xf3a01a['attributes']=_0xf3a01a[_0x5dc4('0x4e')]['length']?_0xf3a01a[_0x5dc4('0x4e')]:_0x3622a[_0x5dc4('0x48')];_0xf3a01a[_0x5dc4('0x54')]=qs[_0x5dc4('0x55')](_0x27d345['query']['sort']);_0xf3a01a[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x27d345[_0x5dc4('0x4b')],_0x3622a[_0x5dc4('0x4d')]));if(_0x27d345[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0xf3a01a[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0xf3a01a[_0x5dc4('0x56')],{'$or':_[_0x5dc4('0x3d')](_0xf3a01a[_0x5dc4('0x4e')],function(_0x1b0e46){var _0x46881d={};_0x46881d[_0x1b0e46]={'$like':'%'+_0x27d345[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x46881d;})});}_0xf3a01a=_[_0x5dc4('0x58')]({},_0xf3a01a,_0x27d345[_0x5dc4('0x5d')]);return _0x40efa3[_0x5dc4('0xc4')](_0xf3a01a);}})[_0x5dc4('0x34')](function(_0x5703de){if(_0x5703de){_0x2182fd=_0x5703de[_0x5dc4('0x51')];if(!_0x27d345[_0x5dc4('0x4b')]['hasOwnProperty']('nolimit')){_0xf3a01a[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0x27d345[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0xf3a01a['offset']=qs[_0x5dc4('0x2f')](_0x27d345[_0x5dc4('0x4b')][_0x5dc4('0x2f')]);}return _0x40efa3[_0x5dc4('0xc4')](_0xf3a01a);}})[_0x5dc4('0x34')](function(_0x4296f1){if(_0x4296f1){return _0x4296f1?{'count':_0x2182fd,'rows':_0x4296f1}:null;}})[_0x5dc4('0x34')](respondWithResult(_0x49f84b,null))[_0x5dc4('0x64')](handleError(_0x49f84b,null));};exports['getGroups']=function(_0xf86ceb,_0x3e85cc,_0x953ab9){var _0x4b611b={};var _0x4efb22={};var _0x80f6cf;var _0x271810;return db['User'][_0x5dc4('0x94')]({'where':{'id':_0xf86ceb[_0x5dc4('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3e85cc,null))[_0x5dc4('0x34')](function(_0x2f5f7b){if(_0x2f5f7b){_0x80f6cf=_0x2f5f7b;_0x4efb22[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db[_0x5dc4('0xc5')][_0x5dc4('0x45')]);_0x4efb22[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0xf86ceb[_0x5dc4('0x4b')]);_0x4efb22[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x4efb22[_0x5dc4('0x48')],_0x4efb22[_0x5dc4('0x4b')]);_0x4b611b[_0x5dc4('0x4e')]=_['intersection'](_0x4efb22[_0x5dc4('0x48')],qs['fields'](_0xf86ceb[_0x5dc4('0x4b')]['fields']));_0x4b611b[_0x5dc4('0x4e')]=_0x4b611b[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x4b611b[_0x5dc4('0x4e')]:_0x4efb22[_0x5dc4('0x48')];_0x4b611b['order']=qs['sort'](_0xf86ceb[_0x5dc4('0x4b')]['sort']);_0x4b611b[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0xf86ceb[_0x5dc4('0x4b')],_0x4efb22['filters']));if(_0xf86ceb['query'][_0x5dc4('0x3b')]){_0x4b611b[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x4b611b[_0x5dc4('0x56')],{'$or':_[_0x5dc4('0x3d')](_0x4b611b[_0x5dc4('0x4e')],function(_0x16752f){var _0x4ae085={};_0x4ae085[_0x16752f]={'$like':'%'+_0xf86ceb[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x4ae085;})});}_0x4b611b=_['merge']({},_0x4b611b,_0xf86ceb[_0x5dc4('0x5d')]);return _0x80f6cf[_0x5dc4('0xc6')](_0x4b611b);}})[_0x5dc4('0x34')](function(_0x4f08d5){if(_0x4f08d5){_0x271810=_0x4f08d5[_0x5dc4('0x51')];if(!_0xf86ceb[_0x5dc4('0x4b')][_0x5dc4('0x52')](_0x5dc4('0x53'))){_0x4b611b[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0xf86ceb[_0x5dc4('0x4b')]['limit']);_0x4b611b[_0x5dc4('0x2f')]=qs[_0x5dc4('0x2f')](_0xf86ceb['query'][_0x5dc4('0x2f')]);}return _0x80f6cf[_0x5dc4('0xc6')](_0x4b611b);}})['then'](function(_0x59cf52){if(_0x59cf52){return _0x59cf52?{'count':_0x271810,'rows':_0x59cf52}:null;}})['then'](respondWithResult(_0x3e85cc,null))['catch'](handleError(_0x3e85cc,null));};exports['getRecordings']=function(_0xde20a5,_0x32c6fc,_0x2b4589){var _0x407920={'raw':!![],'where':{}};var _0x1e7038={};var _0x500240={'count':0x0,'rows':[]};return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0xde20a5[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x32c6fc,null))['then'](function(_0x20bc90){if(_0x20bc90){_0x1e7038[_0x5dc4('0x48')]=_['keys'](db['VoiceRecording'][_0x5dc4('0x45')]);_0x1e7038[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0xde20a5[_0x5dc4('0x4b')]);_0x1e7038['filters']=_['intersection'](_0x1e7038[_0x5dc4('0x48')],_0x1e7038[_0x5dc4('0x4b')]);_0x407920['attributes']=_['intersection'](_0x1e7038['model'],qs['fields'](_0xde20a5[_0x5dc4('0x4b')]['fields']));_0x407920[_0x5dc4('0x4e')]=_0x407920[_0x5dc4('0x4e')]['length']?_0x407920['attributes']:_0x1e7038[_0x5dc4('0x48')];if(!_0xde20a5[_0x5dc4('0x4b')][_0x5dc4('0x52')](_0x5dc4('0x53'))){_0x407920[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0xde20a5[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x407920[_0x5dc4('0x2f')]=qs['offset'](_0xde20a5[_0x5dc4('0x4b')]['offset']);}_0x407920['order']=qs[_0x5dc4('0x55')](_0xde20a5[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x407920['where']=qs[_0x5dc4('0x4d')](_['pick'](_0xde20a5[_0x5dc4('0x4b')],_0x1e7038['filters']));_0x407920['where'][_0x5dc4('0xc7')]=_0x20bc90['id'];if(_0xde20a5[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0x407920[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x407920['where'],{'$or':_[_0x5dc4('0x3d')](_0x407920['attributes'],function(_0x359be4){var _0x20770a={};_0x20770a[_0x359be4]={'$like':'%'+_0xde20a5[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x20770a;})});}_0x407920=_[_0x5dc4('0x58')]({},_0x407920,_0xde20a5['options']);return db['VoiceRecording'][_0x5dc4('0x5f')]({'where':_0x407920[_0x5dc4('0x56')]})[_0x5dc4('0x34')](function(_0x173c09){_0x500240['count']=_0x173c09;if(_0xde20a5[_0x5dc4('0x4b')]['includeAll']){_0x407920['include']=[{'all':!![]}];}return db[_0x5dc4('0xc8')][_0x5dc4('0x62')](_0x407920);})[_0x5dc4('0x34')](function(_0xb4e121){_0x500240[_0x5dc4('0x63')]=_0xb4e121;return _0x500240;});}})[_0x5dc4('0x34')](respondWithFilteredResult(_0x32c6fc,_0x407920))[_0x5dc4('0x64')](handleError(_0x32c6fc,null));};exports[_0x5dc4('0xc9')]=function(_0x4bebd6,_0x5ceb9a,_0x41c61b){var _0x346a66={'raw':!![],'where':{}};var _0x1c897d={};var _0x53b573={'count':0x0,'rows':[]};return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0x4bebd6['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x5ceb9a,null))[_0x5dc4('0x34')](function(_0x10576e){if(_0x10576e){_0x1c897d[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db[_0x5dc4('0xca')][_0x5dc4('0x45')]);_0x1c897d[_0x5dc4('0x4b')]=_['keys'](_0x4bebd6[_0x5dc4('0x4b')]);_0x1c897d[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x1c897d[_0x5dc4('0x48')],_0x1c897d[_0x5dc4('0x4b')]);_0x346a66[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0x1c897d[_0x5dc4('0x48')],qs[_0x5dc4('0x50')](_0x4bebd6[_0x5dc4('0x4b')]['fields']));_0x346a66[_0x5dc4('0x4e')]=_0x346a66['attributes']['length']?_0x346a66['attributes']:_0x1c897d[_0x5dc4('0x48')];if(!_0x4bebd6[_0x5dc4('0x4b')][_0x5dc4('0x52')]('nolimit')){_0x346a66[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0x4bebd6['query'][_0x5dc4('0x30')]);_0x346a66['offset']=qs[_0x5dc4('0x2f')](_0x4bebd6['query'][_0x5dc4('0x2f')]);}_0x346a66['order']=qs[_0x5dc4('0x55')](_0x4bebd6[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x346a66[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_['pick'](_0x4bebd6[_0x5dc4('0x4b')],_0x1c897d[_0x5dc4('0x4d')]));_0x346a66[_0x5dc4('0x56')]['UserId']=_0x10576e['id'];if(_0x4bebd6[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0x346a66[_0x5dc4('0x56')]=_['merge'](_0x346a66[_0x5dc4('0x56')],{'$or':_['map'](_0x346a66[_0x5dc4('0x4e')],function(_0x11e146){var _0x51177f={};_0x51177f[_0x11e146]={'$like':'%'+_0x4bebd6[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x51177f;})});}_0x346a66=_['merge']({},_0x346a66,_0x4bebd6['options']);return db[_0x5dc4('0xca')][_0x5dc4('0x5f')]({'where':_0x346a66[_0x5dc4('0x56')]})[_0x5dc4('0x34')](function(_0x3aaa8c){_0x53b573[_0x5dc4('0x5f')]=_0x3aaa8c;if(_0x4bebd6[_0x5dc4('0x4b')][_0x5dc4('0x60')]){_0x346a66[_0x5dc4('0x61')]=[{'all':!![]}];}return db[_0x5dc4('0xca')]['findAll'](_0x346a66);})[_0x5dc4('0x34')](function(_0x35cd26){_0x53b573[_0x5dc4('0x63')]=_0x35cd26;return _0x53b573;});}})[_0x5dc4('0x34')](respondWithFilteredResult(_0x5ceb9a,_0x346a66))['catch'](handleError(_0x5ceb9a,null));};exports['getChatInteractions']=function(_0x73d626,_0xcc80e,_0x4e584d){var _0x2341a2={};var _0xd46b03={};var _0x508b4f;var _0x46ebda;return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0x73d626['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0xcc80e,null))['then'](function(_0x4b8649){if(_0x4b8649){_0x508b4f=_0x4b8649;_0xd46b03['model']=_['keys'](db[_0x5dc4('0xcb')]['rawAttributes']);_0xd46b03[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x73d626[_0x5dc4('0x4b')]);_0xd46b03[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0xd46b03[_0x5dc4('0x48')],_0xd46b03[_0x5dc4('0x4b')]);_0x2341a2[_0x5dc4('0x4e')]=_['intersection'](_0xd46b03[_0x5dc4('0x48')],qs[_0x5dc4('0x50')](_0x73d626[_0x5dc4('0x4b')][_0x5dc4('0x50')]));_0x2341a2['attributes']=_0x2341a2[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x2341a2[_0x5dc4('0x4e')]:_0xd46b03[_0x5dc4('0x48')];_0x2341a2[_0x5dc4('0x54')]=qs[_0x5dc4('0x55')](_0x73d626[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x2341a2[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x73d626[_0x5dc4('0x4b')],_0xd46b03[_0x5dc4('0x4d')]));if(_0x73d626[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0x2341a2[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x2341a2[_0x5dc4('0x56')],{'$or':_[_0x5dc4('0x3d')](_0x2341a2[_0x5dc4('0x4e')],function(_0x4976a4){var _0x56697b={};_0x56697b[_0x4976a4]={'$like':'%'+_0x73d626[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x56697b;})});}_0x2341a2=_[_0x5dc4('0x58')]({},_0x2341a2,_0x73d626[_0x5dc4('0x5d')]);return _0x508b4f[_0x5dc4('0xcc')](_0x2341a2);}})[_0x5dc4('0x34')](function(_0x3cb40a){if(_0x3cb40a){_0x46ebda=_0x3cb40a[_0x5dc4('0x51')];if(!_0x73d626[_0x5dc4('0x4b')][_0x5dc4('0x52')]('nolimit')){_0x2341a2[_0x5dc4('0x30')]=qs['limit'](_0x73d626[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x2341a2[_0x5dc4('0x2f')]=qs['offset'](_0x73d626[_0x5dc4('0x4b')][_0x5dc4('0x2f')]);}return _0x508b4f['getChatInteractions'](_0x2341a2);}})[_0x5dc4('0x34')](function(_0x12edf2){if(_0x12edf2){return _0x12edf2?{'count':_0x46ebda,'rows':_0x12edf2}:null;}})['then'](respondWithResult(_0xcc80e,null))[_0x5dc4('0x64')](handleError(_0xcc80e,null));};exports[_0x5dc4('0xcd')]=function(_0x3f9558,_0x338412,_0x3fb649){var _0x56a95a={};var _0x239d1c={};var _0xdf21a3;var _0x4296d5;return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0x3f9558['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x338412,null))[_0x5dc4('0x34')](function(_0x8f2ca){if(_0x8f2ca){_0xdf21a3=_0x8f2ca;_0x239d1c['model']=_[_0x5dc4('0x4c')](db[_0x5dc4('0xce')][_0x5dc4('0x45')]);_0x239d1c[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x3f9558['query']);_0x239d1c['filters']=_[_0x5dc4('0x4f')](_0x239d1c[_0x5dc4('0x48')],_0x239d1c[_0x5dc4('0x4b')]);_0x56a95a['attributes']=_[_0x5dc4('0x4f')](_0x239d1c[_0x5dc4('0x48')],qs['fields'](_0x3f9558['query'][_0x5dc4('0x50')]));_0x56a95a['attributes']=_0x56a95a['attributes'][_0x5dc4('0x51')]?_0x56a95a[_0x5dc4('0x4e')]:_0x239d1c['model'];_0x56a95a[_0x5dc4('0x54')]=qs[_0x5dc4('0x55')](_0x3f9558[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x56a95a[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x3f9558['query'],_0x239d1c['filters']));if(_0x3f9558['query'][_0x5dc4('0x3b')]){_0x56a95a['where']=_['merge'](_0x56a95a['where'],{'$or':_[_0x5dc4('0x3d')](_0x56a95a[_0x5dc4('0x4e')],function(_0x344155){var _0x59b47d={};_0x59b47d[_0x344155]={'$like':'%'+_0x3f9558[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x59b47d;})});}_0x56a95a=_[_0x5dc4('0x58')]({},_0x56a95a,_0x3f9558[_0x5dc4('0x5d')]);return _0xdf21a3[_0x5dc4('0xcd')](_0x56a95a);}})['then'](function(_0x33f94d){if(_0x33f94d){_0x4296d5=_0x33f94d['length'];if(!_0x3f9558['query'][_0x5dc4('0x52')](_0x5dc4('0x53'))){_0x56a95a[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0x3f9558[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x56a95a[_0x5dc4('0x2f')]=qs[_0x5dc4('0x2f')](_0x3f9558[_0x5dc4('0x4b')][_0x5dc4('0x2f')]);}return _0xdf21a3[_0x5dc4('0xcd')](_0x56a95a);}})['then'](function(_0x3dc6dc){if(_0x3dc6dc){return _0x3dc6dc?{'count':_0x4296d5,'rows':_0x3dc6dc}:null;}})['then'](respondWithResult(_0x338412,null))[_0x5dc4('0x64')](handleError(_0x338412,null));};exports[_0x5dc4('0xcf')]=function(_0x3c1de3,_0x38b026,_0x274cc7){var _0x5c0e64={'raw':!![],'where':{}};var _0x1d38a6={};var _0x298841={'count':0x0,'rows':[]};return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0x3c1de3['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x38b026,null))[_0x5dc4('0x34')](function(_0x352afc){if(_0x352afc){_0x1d38a6['model']=_[_0x5dc4('0x4c')](db['MailInteraction'][_0x5dc4('0x45')]);_0x1d38a6[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x3c1de3['query']);_0x1d38a6[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x1d38a6[_0x5dc4('0x48')],_0x1d38a6[_0x5dc4('0x4b')]);_0x5c0e64[_0x5dc4('0x4e')]=_['intersection'](_0x1d38a6['model'],qs['fields'](_0x3c1de3[_0x5dc4('0x4b')][_0x5dc4('0x50')]));_0x5c0e64[_0x5dc4('0x4e')]=_0x5c0e64['attributes']['length']?_0x5c0e64['attributes']:_0x1d38a6['model'];if(!_0x3c1de3[_0x5dc4('0x4b')][_0x5dc4('0x52')](_0x5dc4('0x53'))){_0x5c0e64[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0x3c1de3[_0x5dc4('0x4b')]['limit']);_0x5c0e64['offset']=qs[_0x5dc4('0x2f')](_0x3c1de3[_0x5dc4('0x4b')]['offset']);}_0x5c0e64['order']=qs['sort'](_0x3c1de3['query']['sort']);_0x5c0e64[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x3c1de3[_0x5dc4('0x4b')],_0x1d38a6[_0x5dc4('0x4d')]));_0x5c0e64[_0x5dc4('0x56')][_0x5dc4('0xc7')]=_0x352afc['id'];if(_0x3c1de3[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0x5c0e64[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x5c0e64[_0x5dc4('0x56')],{'$or':_['map'](_0x5c0e64[_0x5dc4('0x4e')],function(_0x1f9efa){var _0x1c6448={};_0x1c6448[_0x1f9efa]={'$like':'%'+_0x3c1de3['query']['filter']+'%'};return _0x1c6448;})});}_0x5c0e64=_['merge']({},_0x5c0e64,_0x3c1de3[_0x5dc4('0x5d')]);return db[_0x5dc4('0xd0')][_0x5dc4('0x5f')]({'where':_0x5c0e64[_0x5dc4('0x56')]})[_0x5dc4('0x34')](function(_0x346615){_0x298841[_0x5dc4('0x5f')]=_0x346615;if(_0x3c1de3[_0x5dc4('0x4b')][_0x5dc4('0x60')]){_0x5c0e64[_0x5dc4('0x61')]=[{'all':!![]}];}return db[_0x5dc4('0xd0')][_0x5dc4('0x62')](_0x5c0e64);})[_0x5dc4('0x34')](function(_0x1f8a74){_0x298841[_0x5dc4('0x63')]=_0x1f8a74;return _0x298841;});}})[_0x5dc4('0x34')](respondWithFilteredResult(_0x38b026,_0x5c0e64))[_0x5dc4('0x64')](handleError(_0x38b026,null));};exports[_0x5dc4('0xd1')]=function(_0x13215b,_0x348673,_0xcab432){var _0x5303c6={};var _0x369847={};var _0x15fd1a;var _0x56bc57;return db[_0x5dc4('0x5e')]['findOne']({'where':{'id':_0x13215b['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x348673,null))[_0x5dc4('0x34')](function(_0x19a540){if(_0x19a540){_0x15fd1a=_0x19a540;_0x369847[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db['SmsInteraction']['rawAttributes']);_0x369847['query']=_[_0x5dc4('0x4c')](_0x13215b[_0x5dc4('0x4b')]);_0x369847[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x369847[_0x5dc4('0x48')],_0x369847[_0x5dc4('0x4b')]);_0x5303c6[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0x369847[_0x5dc4('0x48')],qs[_0x5dc4('0x50')](_0x13215b['query']['fields']));_0x5303c6['attributes']=_0x5303c6[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x5303c6[_0x5dc4('0x4e')]:_0x369847[_0x5dc4('0x48')];_0x5303c6['order']=qs['sort'](_0x13215b[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x5303c6[_0x5dc4('0x56')]=qs['filters'](_[_0x5dc4('0x57')](_0x13215b['query'],_0x369847[_0x5dc4('0x4d')]));if(_0x13215b[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0x5303c6[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x5303c6[_0x5dc4('0x56')],{'$or':_[_0x5dc4('0x3d')](_0x5303c6[_0x5dc4('0x4e')],function(_0x5b94bf){var _0x5d0aac={};_0x5d0aac[_0x5b94bf]={'$like':'%'+_0x13215b[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x5d0aac;})});}_0x5303c6=_[_0x5dc4('0x58')]({},_0x5303c6,_0x13215b[_0x5dc4('0x5d')]);return _0x15fd1a[_0x5dc4('0xd1')](_0x5303c6);}})[_0x5dc4('0x34')](function(_0xe4f928){if(_0xe4f928){_0x56bc57=_0xe4f928['length'];if(!_0x13215b['query']['hasOwnProperty'](_0x5dc4('0x53'))){_0x5303c6[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0x13215b['query'][_0x5dc4('0x30')]);_0x5303c6[_0x5dc4('0x2f')]=qs[_0x5dc4('0x2f')](_0x13215b[_0x5dc4('0x4b')][_0x5dc4('0x2f')]);}return _0x15fd1a['getSmsInteractions'](_0x5303c6);}})[_0x5dc4('0x34')](function(_0x32f190){if(_0x32f190){return _0x32f190?{'count':_0x56bc57,'rows':_0x32f190}:null;}})[_0x5dc4('0x34')](respondWithResult(_0x348673,null))[_0x5dc4('0x64')](handleError(_0x348673,null));};exports['getFaxInteractions']=function(_0x1c4b4e,_0x3dae63,_0x402ef1){var _0x33475f={};var _0x49ca8b={};var _0x136551;var _0x4216c8;return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0x1c4b4e[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x3dae63,null))[_0x5dc4('0x34')](function(_0x5cc980){if(_0x5cc980){_0x136551=_0x5cc980;_0x49ca8b[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db[_0x5dc4('0xd2')]['rawAttributes']);_0x49ca8b[_0x5dc4('0x4b')]=_[_0x5dc4('0x4c')](_0x1c4b4e[_0x5dc4('0x4b')]);_0x49ca8b[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x49ca8b['model'],_0x49ca8b[_0x5dc4('0x4b')]);_0x33475f[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0x49ca8b[_0x5dc4('0x48')],qs[_0x5dc4('0x50')](_0x1c4b4e[_0x5dc4('0x4b')]['fields']));_0x33475f['attributes']=_0x33475f[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x33475f['attributes']:_0x49ca8b['model'];_0x33475f['order']=qs[_0x5dc4('0x55')](_0x1c4b4e[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x33475f[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_['pick'](_0x1c4b4e[_0x5dc4('0x4b')],_0x49ca8b[_0x5dc4('0x4d')]));if(_0x1c4b4e[_0x5dc4('0x4b')]['filter']){_0x33475f['where']=_['merge'](_0x33475f[_0x5dc4('0x56')],{'$or':_['map'](_0x33475f[_0x5dc4('0x4e')],function(_0x18408f){var _0x5eccd5={};_0x5eccd5[_0x18408f]={'$like':'%'+_0x1c4b4e[_0x5dc4('0x4b')]['filter']+'%'};return _0x5eccd5;})});}_0x33475f=_['merge']({},_0x33475f,_0x1c4b4e['options']);return _0x136551['getFaxInteractions'](_0x33475f);}})[_0x5dc4('0x34')](function(_0x36006c){if(_0x36006c){_0x4216c8=_0x36006c[_0x5dc4('0x51')];if(!_0x1c4b4e[_0x5dc4('0x4b')][_0x5dc4('0x52')]('nolimit')){_0x33475f[_0x5dc4('0x30')]=qs['limit'](_0x1c4b4e[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x33475f[_0x5dc4('0x2f')]=qs[_0x5dc4('0x2f')](_0x1c4b4e[_0x5dc4('0x4b')][_0x5dc4('0x2f')]);}return _0x136551[_0x5dc4('0xd3')](_0x33475f);}})[_0x5dc4('0x34')](function(_0xd17e08){if(_0xd17e08){return _0xd17e08?{'count':_0x4216c8,'rows':_0xd17e08}:null;}})[_0x5dc4('0x34')](respondWithResult(_0x3dae63,null))[_0x5dc4('0x64')](handleError(_0x3dae63,null));};exports[_0x5dc4('0xd4')]=function(_0x456326,_0x441605,_0x1ca832){var _0x4c2f0e={};var _0xd6acbd={};var _0x38fdcd;var _0x534279;return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0x456326['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x441605,null))[_0x5dc4('0x34')](function(_0x113764){if(_0x113764){_0x38fdcd=_0x113764;_0xd6acbd[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db['WhatsappInteraction']['rawAttributes']);_0xd6acbd['query']=_[_0x5dc4('0x4c')](_0x456326[_0x5dc4('0x4b')]);_0xd6acbd[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0xd6acbd['model'],_0xd6acbd[_0x5dc4('0x4b')]);_0x4c2f0e[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0xd6acbd[_0x5dc4('0x48')],qs['fields'](_0x456326['query']['fields']));_0x4c2f0e['attributes']=_0x4c2f0e[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x4c2f0e[_0x5dc4('0x4e')]:_0xd6acbd[_0x5dc4('0x48')];_0x4c2f0e[_0x5dc4('0x54')]=qs[_0x5dc4('0x55')](_0x456326[_0x5dc4('0x4b')]['sort']);_0x4c2f0e[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x456326[_0x5dc4('0x4b')],_0xd6acbd[_0x5dc4('0x4d')]));if(_0x456326[_0x5dc4('0x4b')]['filter']){_0x4c2f0e[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x4c2f0e['where'],{'$or':_[_0x5dc4('0x3d')](_0x4c2f0e[_0x5dc4('0x4e')],function(_0xe0ada2){var _0x3ccf0a={};_0x3ccf0a[_0xe0ada2]={'$like':'%'+_0x456326[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x3ccf0a;})});}_0x4c2f0e=_['merge']({},_0x4c2f0e,_0x456326[_0x5dc4('0x5d')]);return _0x38fdcd[_0x5dc4('0xd4')](_0x4c2f0e);}})[_0x5dc4('0x34')](function(_0x3d599f){if(_0x3d599f){_0x534279=_0x3d599f[_0x5dc4('0x51')];if(!_0x456326[_0x5dc4('0x4b')]['hasOwnProperty'](_0x5dc4('0x53'))){_0x4c2f0e[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0x456326[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x4c2f0e['offset']=qs[_0x5dc4('0x2f')](_0x456326[_0x5dc4('0x4b')][_0x5dc4('0x2f')]);}return _0x38fdcd[_0x5dc4('0xd4')](_0x4c2f0e);}})[_0x5dc4('0x34')](function(_0x4f0c2d){if(_0x4f0c2d){return _0x4f0c2d?{'count':_0x534279,'rows':_0x4f0c2d}:null;}})[_0x5dc4('0x34')](respondWithResult(_0x441605,null))[_0x5dc4('0x64')](handleError(_0x441605,null));};exports[_0x5dc4('0xd5')]=function(_0x70ee51,_0x99b6df,_0x5cdf69){var _0xe75dcd;var _0x23b00a;var _0x1fc4d6;var _0x301f68=!_[_0x5dc4('0x74')](_0x70ee51[_0x5dc4('0x6a')]['id'])?_0x70ee51['params']['id']:!_[_0x5dc4('0x74')](_0x70ee51[_0x5dc4('0x37')]['id'])?_0x70ee51[_0x5dc4('0x37')]['id']:null;return db[_0x5dc4('0x5e')]['find']({'where':{'id':_0x301f68,'role':{'$or':[_0x5dc4('0x70'),_0x5dc4('0x37'),_0x5dc4('0x38')]}},'attributes':['id',_0x5dc4('0x41'),_0x5dc4('0xd6'),_0x5dc4('0xd7'),_0x5dc4('0x40'),_0x5dc4('0x77'),_0x5dc4('0x9f')]})[_0x5dc4('0x34')](function(_0x211c75){if(_0x211c75){if(_0x211c75[_0x5dc4('0x40')]===_0x5dc4('0x38')){_0xe75dcd=_0x211c75;if(_0x70ee51[_0x5dc4('0x69')][_0x5dc4('0xa1')]){_0x1fc4d6=util['format'](_0x5dc4('0xd8'),_0xe75dcd[_0x70ee51[_0x5dc4('0x69')][_0x5dc4('0xa1')]]);}else if(_0x70ee51[_0x5dc4('0x69')]['intrf']){_0x1fc4d6=util[_0x5dc4('0xad')](_0x5dc4('0xd9'),_0x70ee51[_0x5dc4('0x69')][_0x5dc4('0xda')]);}else{_0x1fc4d6=util[_0x5dc4('0xad')](_0x5dc4('0xd9'),_0xe75dcd[_0x5dc4('0x41')]);}socket['to'](util[_0x5dc4('0xad')](_0x5dc4('0xdb'),_0xe75dcd[_0x5dc4('0x41')]))[_0x5dc4('0xaa')](_0x5dc4('0xdc'),{'ip':_0x70ee51['headers'][_0x5dc4('0xdd')]||_0x70ee51[_0x5dc4('0xde')][_0x5dc4('0xdf')]||_0x70ee51['socket'][_0x5dc4('0xdf')]||_0x70ee51[_0x5dc4('0xde')]['socket'][_0x5dc4('0xdf')]});return db[_0x5dc4('0xae')]['destroy']({'where':{'membername':_0xe75dcd['name']},'individualHooks':!![]});}}else{throw new db[(_0x5dc4('0x1e'))][(_0x5dc4('0x1f'))](_0x5dc4('0xe0'));}})[_0x5dc4('0x34')](function(){if(_0xe75dcd){return _0xe75dcd[_0x5dc4('0xe1')]({'raw':!![]});}})[_0x5dc4('0x34')](function(_0x154e2e){if(_0xe75dcd){var _0x4f0643=[];if(_0x154e2e){_0x23b00a=_0x154e2e;if(_0x23b00a['length']){for(var _0x3a4fa8=0x0;_0x3a4fa8<_0x23b00a[_0x5dc4('0x51')];_0x3a4fa8++){_0x4f0643[_0x5dc4('0xe2')]({'membername':_0xe75dcd[_0x5dc4('0x41')],'UserId':_0xe75dcd['id'],'queue_name':_0x23b00a[_0x3a4fa8][_0x5dc4('0x41')],'VoiceQueueId':_0x23b00a[_0x3a4fa8]['id'],'interface':_0x1fc4d6,'paused':_0xe75dcd['loginInPause']||![],'penalty':_0x23b00a[_0x3a4fa8][_0x5dc4('0xe3')]||0x0});}return BPromise[_0x5dc4('0xe4')](_0x4f0643,function(_0x2dcc69){return db['UserVoiceQueueRt'][_0x5dc4('0xaf')](_0x2dcc69);});}}}})[_0x5dc4('0x34')](function(){if(_0xe75dcd){return db['MemberReport'][_0x5dc4('0x62')]({'where':{'membername':_0xe75dcd[_0x5dc4('0x41')],'exitAt':null}});}})[_0x5dc4('0x34')](function(_0x3d1f4e){if(_0xe75dcd){var _0x85a31b=[];_0x3d1f4e[_0x5dc4('0xe5')](function(_0x472ddc){_0x85a31b['push'](_0x472ddc['update']({'exitAt':moment()[_0x5dc4('0xad')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x5dc4('0xe6')](_0x85a31b);}})[_0x5dc4('0x34')](function(){if(_0xe75dcd){var _0x2fff1c=[];var _0x536cd3=[];var _0x517c99=utils[_0x5dc4('0xe7')]();var _0x22b414={'membername':_0xe75dcd['name'],'interface':_0x1fc4d6,'enterAt':moment()[_0x5dc4('0xad')](_0x5dc4('0xe8')),'role':_0xe75dcd[_0x5dc4('0x40')],'internal':_0xe75dcd[_0x5dc4('0x77')]};_0x517c99[_0x5dc4('0xe5')](function(_0x161a00){_0x2fff1c[_0x5dc4('0xe2')](_[_0x5dc4('0x58')]({'channel':_0x161a00,'type':_0x5dc4('0xe9'),'data1':_0x70ee51[_0x5dc4('0x69')][_0x5dc4('0xea')],'data2':_0x1fc4d6},_0x22b414));if(_0xe75dcd[_0x5dc4('0x9f')]){_0x536cd3[_0x5dc4('0xe2')](_[_0x5dc4('0x58')]({'channel':_0x161a00,'type':_0x5dc4('0xeb'),'data1':_0x5dc4('0xec')},_0x22b414));}});return db[_0x5dc4('0xed')][_0x5dc4('0x68')](_0x2fff1c[_0x5dc4('0xee')](_0x536cd3),{'individualHooks':!![]});}})[_0x5dc4('0x34')](function(){if(_0xe75dcd){return _0xe75dcd['update']({'online':!![],'lastLoginAt':moment()[_0x5dc4('0xad')](_0x5dc4('0xe8')),'voicePause':_0xe75dcd[_0x5dc4('0x9f')]||![],'mailPause':_0xe75dcd['loginInPause']||![],'chatPause':_0xe75dcd[_0x5dc4('0x9f')]||![],'faxPause':_0xe75dcd[_0x5dc4('0x9f')]||![],'smsPause':_0xe75dcd[_0x5dc4('0x9f')]||![],'openchannelPause':_0xe75dcd[_0x5dc4('0x9f')]||![],'whatsappPause':_0xe75dcd['loginInPause']||![],'pauseType':_0xe75dcd[_0x5dc4('0x9f')]?_0x5dc4('0xec'):null,'interface':_0x1fc4d6,'lastPauseAt':moment()[_0x5dc4('0xad')](_0x5dc4('0xe8'))});}})[_0x5dc4('0x34')](function(_0x29d085){if(_0x70ee51[_0x5dc4('0xef')]){return _0x5cdf69();}else{return BPromise[_0x5dc4('0xf0')](_0x29d085)[_0x5dc4('0x34')](respondWithResult(_0x99b6df,null));}})['catch'](handleError(_0x99b6df,null));};exports[_0x5dc4('0xf1')]=function(_0x546a08,_0x4937a5,_0x3c3737){var _0x559f48;return db[_0x5dc4('0x5e')][_0x5dc4('0x67')]({'where':{'id':_0x546a08[_0x5dc4('0x6a')]['id'],'role':_0x5dc4('0x38')},'attributes':['id',_0x5dc4('0x41'),'role']})[_0x5dc4('0x34')](handleEntityNotFound(_0x4937a5,null))[_0x5dc4('0x34')](function(_0x2bab0c){if(_0x2bab0c){_0x559f48=_0x2bab0c;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x559f48[_0x5dc4('0x41')]},'individualHooks':!![]});}})[_0x5dc4('0x34')](function(){return db['MemberReport'][_0x5dc4('0x62')]({'where':{'membername':_0x559f48[_0x5dc4('0x41')],'exitAt':null}});})[_0x5dc4('0x34')](function(_0x2962ff){var _0x404313=[];_0x2962ff[_0x5dc4('0xe5')](function(_0x294679){_0x404313[_0x5dc4('0xe2')](_0x294679['update']({'exitAt':moment()['format'](_0x5dc4('0xe8'))}));});return BPromise[_0x5dc4('0xe6')](_0x404313);})[_0x5dc4('0x34')](function(){return _0x559f48[_0x5dc4('0x33')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x5dc4('0x34')](respondWithResult(_0x4937a5,null))[_0x5dc4('0x64')](handleError(_0x4937a5,null));};exports[_0x5dc4('0xf2')]=function(_0x34716f,_0x3a73d4,_0x224856){var _0x4fa5a9;return db[_0x5dc4('0xae')][_0x5dc4('0x33')]({'paused':0x1},{'where':{'UserId':_0x34716f[_0x5dc4('0x6a')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x5dc4('0x5e')][_0x5dc4('0x67')]({'where':{'id':_0x34716f[_0x5dc4('0x6a')]['id'],'role':_0x5dc4('0x38')},'attributes':['id',_0x5dc4('0x41'),_0x5dc4('0x40'),'internal',_0x5dc4('0xa1')]});})['then'](handleEntityNotFound(_0x3a73d4,null))['then'](function(_0x2c7a06){if(_0x2c7a06){_0x4fa5a9=_0x2c7a06;return respondWithRpcPromise(_0x5dc4('0xf3'),_0x5dc4('0xf2'),{'id':_0x4fa5a9['id'],'name':_0x4fa5a9[_0x5dc4('0x41')],'pause':!![]});}})[_0x5dc4('0x34')](function(){if(_0x4fa5a9){return db[_0x5dc4('0xed')][_0x5dc4('0x62')]({'where':{'membername':_0x4fa5a9['name'],'type':_0x5dc4('0xeb'),'exitAt':null}});}})[_0x5dc4('0x34')](function(_0x1fc383){if(_0x1fc383[_0x5dc4('0x51')]){var _0x37abb2=moment()['format'](_0x5dc4('0xe8'));for(var _0x51340c=0x0,_0x2be09a=_0x1fc383[_0x5dc4('0x51')];_0x51340c<_0x2be09a;_0x51340c++){_0x1fc383[_0x51340c][_0x5dc4('0xf4')]({'exitAt':_0x37abb2});}}})[_0x5dc4('0x34')](function(){var _0x4803dd=[];var _0x1b7b14=utils[_0x5dc4('0xe7')]();_0x1b7b14[_0x5dc4('0xe5')](function(_0xb3a512){_0x4803dd[_0x5dc4('0xe2')]({'channel':_0xb3a512,'membername':_0x4fa5a9[_0x5dc4('0x41')],'interface':_[_0x5dc4('0x74')](_0x4fa5a9[_0x5dc4('0xa1')])?util['format'](_0x5dc4('0xd9'),_0x4fa5a9[_0x5dc4('0x41')]):_0x4fa5a9[_0x5dc4('0xa1')],'type':_0x5dc4('0xeb'),'enterAt':moment()[_0x5dc4('0xad')](_0x5dc4('0xe8')),'data1':_0x34716f[_0x5dc4('0x69')][_0x5dc4('0x59')]||_0x5dc4('0xf5'),'role':_0x4fa5a9[_0x5dc4('0x40')],'internal':_0x4fa5a9[_0x5dc4('0x77')]});});return db['MemberReport'][_0x5dc4('0x68')](_0x4803dd,{'individualHooks':!![]});})[_0x5dc4('0x34')](function(){return _0x4fa5a9[_0x5dc4('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x34716f['body'][_0x5dc4('0x59')]||_0x5dc4('0xf5'),'lastPauseAt':moment()[_0x5dc4('0xad')](_0x5dc4('0xe8'))});})[_0x5dc4('0x34')](respondWithResult(_0x3a73d4,null))[_0x5dc4('0x64')](handleError(_0x3a73d4,null));};exports[_0x5dc4('0xf6')]=function(_0x2f9270,_0x184a63,_0x1e46b1){var _0xb2bbc5;return db[_0x5dc4('0x5e')][_0x5dc4('0x67')]({'where':{'id':_0x2f9270[_0x5dc4('0x6a')]['id']},'attributes':['id',_0x5dc4('0x41'),_0x5dc4('0x40'),_0x5dc4('0xa0'),_0x5dc4('0xf7'),'chatPause',_0x5dc4('0xf8'),_0x5dc4('0xf9'),_0x5dc4('0xfa'),_0x5dc4('0xfb'),_0x5dc4('0xfc'),'lastPauseAt']})[_0x5dc4('0x34')](handleEntityNotFound(_0x184a63,null))['then'](function(_0x2f6d37){if(_0x2f6d37){_0xb2bbc5=_0x2f6d37;if(_0x2f9270[_0x5dc4('0x69')][_0x5dc4('0x9d')]&&!utils[_0x5dc4('0xa2')](_0x2f9270['body'][_0x5dc4('0x9d')])){throw new db[(_0x5dc4('0x1e'))][(_0x5dc4('0x1f'))]('Unknown\x20channel');}switch(_0x2f9270['body'][_0x5dc4('0x9d')]){case _0x5dc4('0xab'):return respondWithRpcPromise(_0x5dc4('0xf3'),_0x5dc4('0xf6'),{'id':_0xb2bbc5['id'],'name':_0xb2bbc5[_0x5dc4('0x41')],'pause':![]})[_0x5dc4('0x34')](function(){return db['UserVoiceQueueRt'][_0x5dc4('0x33')]({'paused':0x0},{'where':{'UserId':_0xb2bbc5['id']},'individualHooks':!![]});})[_0x5dc4('0x34')](function(){return db['MemberReport']['find']({'where':{'channel':_0x2f9270[_0x5dc4('0x69')][_0x5dc4('0x9d')],'membername':_0xb2bbc5['name'],'type':_0x5dc4('0xeb'),'exitAt':null}});})[_0x5dc4('0x34')](function(_0x5b73bf){if(_0x5b73bf){return _0x5b73bf[_0x5dc4('0x33')]({'exitAt':moment()[_0x5dc4('0xad')](_0x5dc4('0xe8')),'data2':_0x5dc4('0xfd')},{'individualHooks':!![]});}return null;})[_0x5dc4('0x34')](function(){return _0xb2bbc5[_0x5dc4('0x33')]({'voicePause':![]});});case'mail':case _0x5dc4('0xfe'):case _0x5dc4('0xff'):case _0x5dc4('0x100'):case _0x5dc4('0x101'):case _0x5dc4('0x102'):return db[_0x5dc4('0xed')][_0x5dc4('0x67')]({'where':{'channel':_0x2f9270['body'][_0x5dc4('0x9d')],'membername':_0xb2bbc5[_0x5dc4('0x41')],'type':_0x5dc4('0xeb'),'exitAt':null}})[_0x5dc4('0x34')](function(_0x4b2a20){if(_0x4b2a20){return _0x4b2a20[_0x5dc4('0x33')]({'exitAt':moment()[_0x5dc4('0xad')](_0x5dc4('0xe8')),'data2':_0x5dc4('0xfd')},{'individualHooks':!![]});}return null;})[_0x5dc4('0x34')](function(){var _0x33c78b={};_[_0x5dc4('0x31')](_0x33c78b,util[_0x5dc4('0xad')](_0x5dc4('0x103'),_0x2f9270['body']['channel'],'Pause'),![]);return _0xb2bbc5[_0x5dc4('0x33')](_0x33c78b);});default:return respondWithRpcPromise(_0x5dc4('0xf3'),'unpause',{'id':_0xb2bbc5['id'],'name':_0xb2bbc5[_0x5dc4('0x41')],'pause':![]})[_0x5dc4('0x34')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0xb2bbc5['id']}});})['then'](function(){return db[_0x5dc4('0xed')][_0x5dc4('0x62')]({'where':{'membername':_0xb2bbc5['name'],'type':'PAUSE','exitAt':null}});})[_0x5dc4('0x34')](function(_0x87b091){var _0x21f603=[];_0x87b091[_0x5dc4('0xe5')](function(_0x3aacdc){_0x21f603['push'](_0x3aacdc[_0x5dc4('0x33')]({'exitAt':moment()['format'](_0x5dc4('0xe8')),'data2':'manual'}));});return BPromise['all'](_0x21f603);})[_0x5dc4('0x34')](function(){return _0xb2bbc5['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x5dc4('0x34')](respondWithResult(_0x184a63,null))[_0x5dc4('0x64')](handleError(_0x184a63,null));};exports[_0x5dc4('0x104')]=function(_0x3c632d,_0x4a257d,_0x1cb6b1){var _0x16fe89={};var _0x4e1313={};var _0x2d363d;var _0x486150;return db[_0x5dc4('0x5e')]['findOne']({'where':{'id':_0x3c632d['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x4a257d,null))[_0x5dc4('0x34')](function(_0x1b0983){if(_0x1b0983){_0x2d363d=_0x1b0983;_0x4e1313[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db[_0x5dc4('0x105')]['rawAttributes']);_0x4e1313[_0x5dc4('0x4b')]=_['keys'](_0x3c632d['query']);_0x4e1313['filters']=_[_0x5dc4('0x4f')](_0x4e1313[_0x5dc4('0x48')],_0x4e1313['query']);_0x16fe89[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0x4e1313[_0x5dc4('0x48')],qs[_0x5dc4('0x50')](_0x3c632d[_0x5dc4('0x4b')][_0x5dc4('0x50')]));_0x16fe89[_0x5dc4('0x4e')]=_0x16fe89[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x16fe89[_0x5dc4('0x4e')]:_0x4e1313[_0x5dc4('0x48')];_0x16fe89[_0x5dc4('0x54')]=qs[_0x5dc4('0x55')](_0x3c632d[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x16fe89[_0x5dc4('0x56')]=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x3c632d[_0x5dc4('0x4b')],_0x4e1313[_0x5dc4('0x4d')]));if(_0x3c632d['query'][_0x5dc4('0x3b')]){_0x16fe89['where']=_[_0x5dc4('0x58')](_0x16fe89['where'],{'$or':_['map'](_0x16fe89[_0x5dc4('0x4e')],function(_0x1ab092){var _0x35aa8a={};_0x35aa8a[_0x1ab092]={'$like':'%'+_0x3c632d[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x35aa8a;})});}_0x16fe89=_[_0x5dc4('0x58')]({},_0x16fe89,_0x3c632d[_0x5dc4('0x5d')]);return _0x2d363d[_0x5dc4('0x104')](_0x16fe89);}})[_0x5dc4('0x34')](function(_0x15c3a8){if(_0x15c3a8){_0x486150=_0x15c3a8['length'];if(!_0x3c632d['query'][_0x5dc4('0x52')]('nolimit')){_0x16fe89['limit']=qs[_0x5dc4('0x30')](_0x3c632d[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x16fe89[_0x5dc4('0x2f')]=qs[_0x5dc4('0x2f')](_0x3c632d['query'][_0x5dc4('0x2f')]);}return _0x2d363d[_0x5dc4('0x104')](_0x16fe89);}})[_0x5dc4('0x34')](function(_0x68ba0){if(_0x68ba0){return _0x68ba0?{'count':_0x486150,'rows':_0x68ba0}:null;}})[_0x5dc4('0x34')](respondWithResult(_0x4a257d,null))[_0x5dc4('0x64')](handleError(_0x4a257d,null));};exports['addTeams']=function(_0x48f469,_0x14bfbf){return db[_0x5dc4('0x5e')]['find']({'where':{'id':_0x48f469[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x14bfbf,null))['then'](function(_0x3ffa51){if(_0x3ffa51){var _0x4a8534=_0x3ffa51[_0x5dc4('0x8e')]({'plain':!![]});return _0x3ffa51[_0x5dc4('0x106')](_0x48f469[_0x5dc4('0x69')][_0x5dc4('0x6d')],_[_0x5dc4('0x6e')](_0x48f469['body'],[_0x5dc4('0x6d'),'id'])||{})[_0x5dc4('0x34')](function(){for(var _0x250b19=0x0;_0x250b19<_0x48f469[_0x5dc4('0x69')][_0x5dc4('0x6d')]['length'];_0x250b19++){var _0xab8b13=[];db[_0x5dc4('0x105')][_0x5dc4('0x94')]({'where':{'id':_0x48f469[_0x5dc4('0x69')][_0x5dc4('0x6d')][_0x250b19]}})[_0x5dc4('0x34')](function(_0x5340c9){_0xab8b13[_0x5dc4('0xe2')](_0x5340c9[_0x5dc4('0xe1')]()['then'](function(_0x401272){for(var _0x4aefda=0x0;_0x4aefda<_0x401272[_0x5dc4('0x51')];_0x4aefda++){_0x401272[_0x4aefda][_0x5dc4('0x107')](_0x5dc4('0x9d'),'Voice');}return _0x401272;}));_0xab8b13[_0x5dc4('0xe2')](_0x5340c9[_0x5dc4('0x108')]()[_0x5dc4('0x34')](function(_0x197017){for(var _0xd0ddad=0x0;_0xd0ddad<_0x197017[_0x5dc4('0x51')];_0xd0ddad++){_0x197017[_0xd0ddad][_0x5dc4('0x107')]('channel',_0x5dc4('0x109'));}return _0x197017;}));_0xab8b13[_0x5dc4('0xe2')](_0x5340c9[_0x5dc4('0x10a')]()[_0x5dc4('0x34')](function(_0x5c1fa4){for(var _0x1556c4=0x0;_0x1556c4<_0x5c1fa4['length'];_0x1556c4++){_0x5c1fa4[_0x1556c4][_0x5dc4('0x107')]('channel',_0x5dc4('0x10b'));}return _0x5c1fa4;}));_0xab8b13[_0x5dc4('0xe2')](_0x5340c9[_0x5dc4('0x10c')]()[_0x5dc4('0x34')](function(_0x12d7e2){for(var _0x39518b=0x0;_0x39518b<_0x12d7e2['length'];_0x39518b++){_0x12d7e2[_0x39518b][_0x5dc4('0x107')](_0x5dc4('0x9d'),_0x5dc4('0x10d'));}return _0x12d7e2;}));_0xab8b13[_0x5dc4('0xe2')](_0x5340c9[_0x5dc4('0x10e')]()[_0x5dc4('0x34')](function(_0x4c6f9b){for(var _0x3a2189=0x0;_0x3a2189<_0x4c6f9b[_0x5dc4('0x51')];_0x3a2189++){_0x4c6f9b[_0x3a2189]['setDataValue'](_0x5dc4('0x9d'),_0x5dc4('0x10f'));}return _0x4c6f9b;}));_0xab8b13['push'](_0x5340c9['getFaxQueues']()[_0x5dc4('0x34')](function(_0x5a7221){for(var _0x2d7cc3=0x0;_0x2d7cc3<_0x5a7221['length'];_0x2d7cc3++){_0x5a7221[_0x2d7cc3][_0x5dc4('0x107')](_0x5dc4('0x9d'),_0x5dc4('0x110'));}return _0x5a7221;}));_0xab8b13[_0x5dc4('0xe2')](_0x5340c9[_0x5dc4('0x111')]()['then'](function(_0x23b67f){for(var _0x8ee2a4=0x0;_0x8ee2a4<_0x23b67f['length'];_0x8ee2a4++){_0x23b67f[_0x8ee2a4]['setDataValue'](_0x5dc4('0x9d'),'Openchannel');}return _0x23b67f;}));return BPromise[_0x5dc4('0xe6')](_0xab8b13);})[_0x5dc4('0x34')](function(_0x437935){var _0x3f890b=_[_0x5dc4('0x112')](_0x437935);_0xab8b13=[];return db[_0x5dc4('0x5a')][_0x5dc4('0x113')](function(_0x432f50){for(var _0xc7c883=0x0;_0xc7c883<_0x3f890b[_0x5dc4('0x51')];_0xc7c883++){_0xab8b13[_0x5dc4('0xe2')](_0x3f890b[_0xc7c883][_0x5dc4('0x114')](_0x4a8534['id']),{'transaction':_0x432f50});}return BPromise[_0x5dc4('0xe6')](_0xab8b13)['then'](function(){if(_0x4a8534[_0x5dc4('0x9e')]){return BPromise[_0x5dc4('0xe4')](_[_0x5dc4('0x3b')](_0x3f890b,function(_0x48e70c){return _0x48e70c['getDataValue']('channel')===_0x5dc4('0x115');}),function(_0x50ee99){return db[_0x5dc4('0xae')][_0x5dc4('0xaf')]({'membername':_0x4a8534['name'],'UserId':_0x4a8534['id'],'queue_name':_0x50ee99[_0x5dc4('0x41')],'VoiceQueueId':_0x50ee99['id'],'interface':_[_0x5dc4('0x74')](_0x4a8534[_0x5dc4('0xa1')])?util[_0x5dc4('0xad')](_0x5dc4('0xd9'),_0x4a8534[_0x5dc4('0x41')]):_0x4a8534[_0x5dc4('0xa1')],'paused':_0x4a8534[_0x5dc4('0xa0')]||![],'penalty':_0x4a8534[_0x5dc4('0xa8')]},{'transaction':_0x432f50});});}else{return;}})[_0x5dc4('0x34')](function(){for(var _0x3367ee=0x0;_0x3367ee<_0x3f890b[_0x5dc4('0x51')];_0x3367ee++){var _0x2d6507=_0x3f890b[_0x3367ee]['getDataValue']('channel');var _0x1c0fa0=_0x2d6507+'QueueId';socket[_0x5dc4('0xaa')](_0x5dc4('0x37')+_0x2d6507+_0x5dc4('0x116'),{'UserId':_0x4a8534['id'],['queueField']:_0x3f890b[_0x3367ee]['id']});}});});});}});}})[_0x5dc4('0x34')](respondWithStatusCode(_0x14bfbf,null))[_0x5dc4('0x64')](handleError(_0x14bfbf,null));};exports[_0x5dc4('0x117')]=function(_0xcdaeed,_0x20728e){return db[_0x5dc4('0x5e')][_0x5dc4('0x94')]({'where':{'id':_0xcdaeed[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x20728e,null))[_0x5dc4('0x34')](function(_0x3a4fbd){if(_0x3a4fbd){var _0x36be7c=_0x3a4fbd[_0x5dc4('0x8e')]({'plain':!![]});var _0x27bbbc=_0xcdaeed[_0x5dc4('0x4b')][_0x5dc4('0x6d')];return _0x3a4fbd['removeTeams'](_0x27bbbc)[_0x5dc4('0x34')](function(){for(var _0x140c80=0x0;_0x140c80<_0x27bbbc[_0x5dc4('0x51')];_0x140c80++){var _0x4de74a=[];db[_0x5dc4('0x105')][_0x5dc4('0x94')]({'where':{'id':_0x27bbbc[_0x140c80]}})[_0x5dc4('0x34')](function(_0x238769){_0x4de74a['push'](_0x238769[_0x5dc4('0xe1')]()['then'](function(_0x46832b){for(var _0xe27481=0x0;_0xe27481<_0x46832b['length'];_0xe27481++){_0x46832b[_0xe27481]['setDataValue'](_0x5dc4('0x9d'),_0x5dc4('0x115'));}return _0x46832b;}));_0x4de74a[_0x5dc4('0xe2')](_0x238769[_0x5dc4('0x108')]()[_0x5dc4('0x34')](function(_0x4caaf5){for(var _0x4d8704=0x0;_0x4d8704<_0x4caaf5[_0x5dc4('0x51')];_0x4d8704++){_0x4caaf5[_0x4d8704][_0x5dc4('0x107')](_0x5dc4('0x9d'),_0x5dc4('0x109'));}return _0x4caaf5;}));_0x4de74a[_0x5dc4('0xe2')](_0x238769[_0x5dc4('0x10a')]()[_0x5dc4('0x34')](function(_0x3e6e1b){for(var _0x463dc0=0x0;_0x463dc0<_0x3e6e1b[_0x5dc4('0x51')];_0x463dc0++){_0x3e6e1b[_0x463dc0][_0x5dc4('0x107')](_0x5dc4('0x9d'),_0x5dc4('0x10b'));}return _0x3e6e1b;}));_0x4de74a[_0x5dc4('0xe2')](_0x238769[_0x5dc4('0x10c')]()[_0x5dc4('0x34')](function(_0x2d794b){for(var _0x3b30a7=0x0;_0x3b30a7<_0x2d794b[_0x5dc4('0x51')];_0x3b30a7++){_0x2d794b[_0x3b30a7][_0x5dc4('0x107')](_0x5dc4('0x9d'),_0x5dc4('0x10d'));}return _0x2d794b;}));_0x4de74a[_0x5dc4('0xe2')](_0x238769[_0x5dc4('0x10e')]()[_0x5dc4('0x34')](function(_0x921ffb){for(var _0x3ece35=0x0;_0x3ece35<_0x921ffb[_0x5dc4('0x51')];_0x3ece35++){_0x921ffb[_0x3ece35][_0x5dc4('0x107')]('channel',_0x5dc4('0x10f'));}return _0x921ffb;}));_0x4de74a[_0x5dc4('0xe2')](_0x238769['getFaxQueues']()[_0x5dc4('0x34')](function(_0x59e79c){for(var _0x45f08c=0x0;_0x45f08c<_0x59e79c[_0x5dc4('0x51')];_0x45f08c++){_0x59e79c[_0x45f08c]['setDataValue']('channel',_0x5dc4('0x110'));}return _0x59e79c;}));_0x4de74a[_0x5dc4('0xe2')](_0x238769[_0x5dc4('0x111')]()[_0x5dc4('0x34')](function(_0x401c2f){for(var _0x431292=0x0;_0x431292<_0x401c2f[_0x5dc4('0x51')];_0x431292++){_0x401c2f[_0x431292][_0x5dc4('0x107')]('channel',_0x5dc4('0x118'));}return _0x401c2f;}));return BPromise['all'](_0x4de74a);})[_0x5dc4('0x34')](function(_0x28581d){var _0x32987a=_['flatten'](_0x28581d);_0x4de74a=[];return db[_0x5dc4('0x5a')][_0x5dc4('0x113')](function(_0x436a7e){for(var _0x4484d7=0x0;_0x4484d7<_0x32987a['length'];_0x4484d7++){_0x4de74a['push'](_0x32987a[_0x4484d7]['removeAgent'](_0x36be7c['id']),{'transaction':_0x436a7e});}return BPromise[_0x5dc4('0xe6')](_0x4de74a)[_0x5dc4('0x34')](function(){if(_0x36be7c[_0x5dc4('0x9e')]){return BPromise[_0x5dc4('0xe4')](_[_0x5dc4('0x3b')](_0x32987a,function(_0x1725c1){return _0x1725c1[_0x5dc4('0x119')](_0x5dc4('0x9d'))===_0x5dc4('0x115');}),function(_0x2c16b){return db[_0x5dc4('0xae')][_0x5dc4('0x35')]({'where':{'VoiceQueueId':_0x2c16b['id'],'UserId':_0x36be7c['id']},'transaction':_0x436a7e});});}else{return;}})[_0x5dc4('0x34')](function(){for(var _0x4db9fe=0x0;_0x4db9fe<_0x32987a['length'];_0x4db9fe++){var _0xe8515c=_0x32987a[_0x4db9fe]['getDataValue'](_0x5dc4('0x9d'));var _0x548994=_0xe8515c+_0x5dc4('0xa9');socket[_0x5dc4('0xaa')](_0x5dc4('0x37')+_0xe8515c+'Queue:remove',{'UserId':_0x36be7c['id'],['queueField']:_0x32987a[_0x4db9fe]['id']});}});});});}});}})[_0x5dc4('0x34')](respondWithStatusCode(_0x20728e,null))[_0x5dc4('0x64')](handleError(_0x20728e,null));};exports['getLists']=function(_0x3c857c,_0x432ebc,_0x4d6851){var _0x4159ff={};var _0x321eee={};var _0x5766a9;var _0xb616f9;return db[_0x5dc4('0x5e')]['findOne']({'where':{'id':_0x3c857c['params']['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x432ebc,null))[_0x5dc4('0x34')](function(_0x3b9b92){if(_0x3b9b92){_0x5766a9=_0x3b9b92;_0x321eee[_0x5dc4('0x48')]=_[_0x5dc4('0x4c')](db[_0x5dc4('0xbd')]['rawAttributes']);_0x321eee['query']=_[_0x5dc4('0x4c')](_0x3c857c[_0x5dc4('0x4b')]);_0x321eee[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x321eee[_0x5dc4('0x48')],_0x321eee[_0x5dc4('0x4b')]);_0x4159ff[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0x321eee[_0x5dc4('0x48')],qs['fields'](_0x3c857c[_0x5dc4('0x4b')][_0x5dc4('0x50')]));_0x4159ff[_0x5dc4('0x4e')]=_0x4159ff[_0x5dc4('0x4e')][_0x5dc4('0x51')]?_0x4159ff[_0x5dc4('0x4e')]:_0x321eee[_0x5dc4('0x48')];_0x4159ff[_0x5dc4('0x54')]=qs['sort'](_0x3c857c[_0x5dc4('0x4b')][_0x5dc4('0x55')]);_0x4159ff[_0x5dc4('0x56')]=qs['filters'](_['pick'](_0x3c857c[_0x5dc4('0x4b')],_0x321eee['filters']));if(_0x3c857c[_0x5dc4('0x4b')]['filter']){_0x4159ff[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x4159ff[_0x5dc4('0x56')],{'$or':_[_0x5dc4('0x3d')](_0x4159ff[_0x5dc4('0x4e')],function(_0x1de200){var _0x5c30a8={};_0x5c30a8[_0x1de200]={'$like':'%'+_0x3c857c[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x5c30a8;})});}_0x4159ff=_['merge']({},_0x4159ff,_0x3c857c[_0x5dc4('0x5d')]);return _0x5766a9[_0x5dc4('0x11a')](_0x4159ff);}})[_0x5dc4('0x34')](function(_0x126026){if(_0x126026){_0xb616f9=_0x126026[_0x5dc4('0x51')];if(!_0x3c857c[_0x5dc4('0x4b')][_0x5dc4('0x52')]('nolimit')){_0x4159ff[_0x5dc4('0x30')]=qs[_0x5dc4('0x30')](_0x3c857c[_0x5dc4('0x4b')][_0x5dc4('0x30')]);_0x4159ff['offset']=qs['offset'](_0x3c857c['query'][_0x5dc4('0x2f')]);}return _0x5766a9['getLists'](_0x4159ff);}})[_0x5dc4('0x34')](function(_0x27e5ac){if(_0x27e5ac){return _0x27e5ac?{'count':_0xb616f9,'rows':_0x27e5ac}:null;}})[_0x5dc4('0x34')](respondWithResult(_0x432ebc,null))[_0x5dc4('0x64')](handleError(_0x432ebc,null));};exports[_0x5dc4('0x11b')]=function(_0x41447b,_0x3c4a30,_0x458529){var _0x2578b4={};var _0x3c5607={};var _0x2bee33;var _0x4d6e01;return db['User']['findOne']({'where':{'id':_0x41447b[_0x5dc4('0x6a')]['id']}})[_0x5dc4('0x34')](handleEntityNotFound(_0x3c4a30,null))['then'](function(_0x31c815){if(_0x31c815){_0x2bee33=_0x31c815;_0x3c5607[_0x5dc4('0x48')]=_['keys'](db[_0x5dc4('0x5e')][_0x5dc4('0x45')]);_0x3c5607['query']=_[_0x5dc4('0x4c')](_0x41447b[_0x5dc4('0x4b')]);_0x3c5607[_0x5dc4('0x4d')]=_[_0x5dc4('0x4f')](_0x3c5607[_0x5dc4('0x48')],_0x3c5607[_0x5dc4('0x4b')]);_0x2578b4[_0x5dc4('0x4e')]=_[_0x5dc4('0x4f')](_0x3c5607['model'],qs[_0x5dc4('0x50')](_0x41447b['query'][_0x5dc4('0x50')]));_0x2578b4[_0x5dc4('0x4e')]=_0x2578b4['attributes'][_0x5dc4('0x51')]?_0x2578b4[_0x5dc4('0x4e')]:_0x3c5607[_0x5dc4('0x48')];_0x2578b4[_0x5dc4('0x54')]=qs[_0x5dc4('0x55')](_0x41447b['query'][_0x5dc4('0x55')]);_0x2578b4['where']=qs[_0x5dc4('0x4d')](_[_0x5dc4('0x57')](_0x41447b['query'],_0x3c5607['filters']));if(_0x41447b[_0x5dc4('0x4b')][_0x5dc4('0x3b')]){_0x2578b4[_0x5dc4('0x56')]=_[_0x5dc4('0x58')](_0x2578b4[_0x5dc4('0x56')],{'$or':_['map'](_0x2578b4[_0x5dc4('0x4e')],function(_0x445c98){var _0x5b05dd={};_0x5b05dd[_0x445c98]={'$like':'%'+_0x41447b[_0x5dc4('0x4b')][_0x5dc4('0x3b')]+'%'};return _0x5b05dd;})});}_0x2578b4[_0x5dc4('0x48')]=db[_0x5dc4('0x5e')];_0x2578b4['as']=_0x5dc4('0x90');_0x2578b4=_[_0x5dc4('0x58')]({},_0x2578b4,_0x41447b[_0x5dc4('0x5d')]);return _0x2bee33[_0x5dc4('0xe1')]({'include':[_0x2578b4]});}})[_0x5dc4('0x34')](function(_0x347848){if(_0x347848){var _0x175307={},_0xa52d46=[],_0x439566=0x0;for(var _0x4920a4=0x0;_0x4920a4<_0x347848[_0x5dc4('0x51')];_0x4920a4+=0x1){for(var _0x5a7884=0x0,_0x507a27;_0x5a7884<_0x347848[_0x4920a4][_0x5dc4('0x90')][_0x5dc4('0x51')];_0x5a7884+=0x1){_0x507a27=_0x347848[_0x4920a4][_0x5dc4('0x90')][_0x5a7884]['get']({'plain':!![]});_0x175307[_0x507a27['id']]=_0x507a27;}}_0x175307=_[_0x5dc4('0x11c')](_0x175307);for(var _0x4988a5=qs[_0x5dc4('0x2f')](_0x41447b[_0x5dc4('0x4b')]['offset']);_0x4988a5<_0x175307['length']&&_0xa52d46[_0x5dc4('0x51')]=_0x1304f1){_0x5bbd4b=_0x1304f1;_0x387794=0xc8;}else{_0x387794=0xce;}_0x21cda8[_0xe434('0x2f')](_0x387794);return _0x21cda8[_0xe434('0x33')](_0xe434('0x34'),_0x3bc6d8+'-'+_0x5bbd4b+'/'+_0x1304f1)[_0xe434('0x35')](_0x32cd72);}return null;};}function patchUpdates(_0x28ef8a){return function(_0x21ceb4){try{jsonpatch['apply'](_0x21ceb4,_0x28ef8a,!![]);}catch(_0x3bb950){return BPromise[_0xe434('0x36')](_0x3bb950);}return _0x21ceb4[_0xe434('0x37')]();};}function saveUpdates(_0x158504,_0x460c1c){return function(_0x406302){if(_0x406302){return _0x406302[_0xe434('0x38')](_0x158504)[_0xe434('0x23')](function(_0x1ec547){return _0x1ec547;});}return null;};}function removeEntity(_0x52c9f4,_0x58045c){return function(_0x194915){if(_0x194915){return _0x194915['destroy']()['then'](function(){var _0x29f0b4=_0x194915['get']({'plain':!![]});var _0x339771=[{'name':_0xe434('0x39'),'value':_0xe434('0x3a'),'ignore':!![]},{'name':_0xe434('0x3b'),'value':_0xe434('0x3c'),'ignore':![]},{'name':_0xe434('0x3d'),'value':_0xe434('0x3e'),'ignore':![]}];var _0x365197=_(_0x339771)[_0xe434('0x3f')](_0xe434('0x40'))[_0xe434('0x41')](_0xe434('0x42'))['value']();if(_[_0xe434('0x43')](_0x365197,_0x29f0b4[_0xe434('0x44')])){return;}var _0x1aa513=_[_0xe434('0x45')](_0x339771,['value',_0x29f0b4[_0xe434('0x44')]])['name'];return db['UserProfileResource'][_0xe434('0x46')]({'where':{'type':_0x1aa513,'resourceId':_0x29f0b4['id']}})[_0xe434('0x23')](function(){return _0x194915;});})[_0xe434('0x23')](function(){_0x52c9f4[_0xe434('0x2f')](0xcc)[_0xe434('0x47')]();});}};}function handleEntityNotFound(_0x33b1d6,_0x45f5d5){return function(_0x5c0fde){if(!_0x5c0fde){_0x33b1d6[_0xe434('0x2e')](0x194);}return _0x5c0fde;};}function handleError(_0x3f2c69,_0x4a46fc){_0x4a46fc=_0x4a46fc||0x1f4;return function(_0x544f2a){logger[_0xe434('0x27')](_0x544f2a[_0xe434('0x48')]);if(_0x544f2a[_0xe434('0x49')]){delete _0x544f2a['name'];}_0x3f2c69['status'](_0x4a46fc)[_0xe434('0x4a')](_0x544f2a);};}exports[_0xe434('0x4b')]=function(_0x443cdf,_0x263853){var _0x43e622={},_0x4979b9={},_0x4e74cf={'count':0x0,'rows':[]};var _0x2d7813=_[_0xe434('0x41')](db['User'][_0xe434('0x4c')],function(_0x54b08f){return{'name':_0x54b08f['fieldName'],'type':_0x54b08f['type'][_0xe434('0x4d')]};});_0x4979b9['model']=_[_0xe434('0x4e')](_[_0xe434('0x41')](_0x2d7813,_0xe434('0x49')),['password',_0xe434('0x4f')]);_0x4979b9[_0xe434('0x50')]=_['keys'](_0x443cdf['query']);_0x4979b9[_0xe434('0x51')]=_[_0xe434('0x52')](_0x4979b9[_0xe434('0x53')],_0x4979b9['query']);_0x43e622[_0xe434('0x54')]=_[_0xe434('0x52')](_0x4979b9['model'],qs[_0xe434('0x55')](_0x443cdf[_0xe434('0x50')]['fields']));_0x43e622['attributes']=_0x43e622[_0xe434('0x54')][_0xe434('0x56')]?_0x43e622[_0xe434('0x54')]:_0x4979b9['model'];if(!_0x443cdf[_0xe434('0x50')][_0xe434('0x57')](_0xe434('0x58'))){_0x43e622[_0xe434('0x32')]=qs[_0xe434('0x32')](_0x443cdf[_0xe434('0x50')][_0xe434('0x32')]);_0x43e622[_0xe434('0x31')]=qs[_0xe434('0x31')](_0x443cdf[_0xe434('0x50')][_0xe434('0x31')]);}_0x43e622[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0x443cdf[_0xe434('0x50')][_0xe434('0x5a')]);_0x43e622[_0xe434('0x5b')]=qs[_0xe434('0x51')](_[_0xe434('0x5c')](_0x443cdf['query'],_0x4979b9[_0xe434('0x51')]),_0x2d7813);if(_0x443cdf['query'][_0xe434('0x3f')]){_0x43e622[_0xe434('0x5b')]=_['merge'](_0x43e622[_0xe434('0x5b')],{'$or':_['map'](_0x2d7813,function(_0x75008d){if(_0x75008d[_0xe434('0x5d')]!==_0xe434('0x5e')){return db[_0xe434('0x5f')][_0xe434('0x5b')](db[_0xe434('0x5f')]['fn']('lower',db['sequelize'][_0xe434('0x60')](_0x75008d[_0xe434('0x49')])),{'$like':db[_0xe434('0x5f')]['fn']('lower','%'+_0x443cdf['query'][_0xe434('0x3f')]+'%')});}})});}_0x43e622=_[_0xe434('0x61')]({},_0x43e622,_0x443cdf[_0xe434('0x62')]);var _0x2f1c54={'where':_0x43e622[_0xe434('0x5b')]};return db[_0xe434('0x63')]['count'](_0x2f1c54)['then'](function(_0x52804a){_0x4e74cf['count']=_0x52804a;if(_0x443cdf[_0xe434('0x50')][_0xe434('0x64')]){_0x43e622[_0xe434('0x65')]=[{'all':!![]}];}return db[_0xe434('0x63')][_0xe434('0x66')](_0x43e622);})['then'](function(_0x3e2d5b){_0x4e74cf[_0xe434('0x67')]=_0x3e2d5b;return _0x4e74cf;})[_0xe434('0x23')](respondWithFilteredResult(_0x263853,_0x43e622))[_0xe434('0x2d')](handleError(_0x263853,null));};exports[_0xe434('0x68')]=function(_0x31256a,_0x4196c2){var _0x1e176f={'raw':![],'where':{'id':_0x31256a['params']['id']}},_0x1d87f8={};_0x1d87f8[_0xe434('0x53')]=_[_0xe434('0x4e')](_[_0xe434('0x69')](db[_0xe434('0x63')][_0xe434('0x4c')]),[_0xe434('0x6a'),_0xe434('0x4f')]);_0x1d87f8[_0xe434('0x50')]=_[_0xe434('0x69')](_0x31256a[_0xe434('0x50')]);_0x1d87f8[_0xe434('0x51')]=_[_0xe434('0x52')](_0x1d87f8[_0xe434('0x53')],_0x1d87f8[_0xe434('0x50')]);_0x1e176f[_0xe434('0x54')]=_[_0xe434('0x52')](_0x1d87f8[_0xe434('0x53')],qs[_0xe434('0x55')](_0x31256a[_0xe434('0x50')][_0xe434('0x55')]));_0x1e176f[_0xe434('0x54')]=_0x1e176f['attributes'][_0xe434('0x56')]?_0x1e176f['attributes']:_0x1d87f8[_0xe434('0x53')];if(_0x31256a['query'][_0xe434('0x64')]){_0x1e176f[_0xe434('0x65')]=[{'all':!![]}];}_0x1e176f=_[_0xe434('0x61')]({},_0x1e176f,_0x31256a[_0xe434('0x62')]);return db[_0xe434('0x63')][_0xe434('0x45')](_0x1e176f)[_0xe434('0x23')](handleEntityNotFound(_0x4196c2,null))[_0xe434('0x23')](respondWithResult(_0x4196c2,null))['catch'](handleError(_0x4196c2,null));};exports[_0xe434('0x6b')]=function(_0x178dab,_0x440e68){return db[_0xe434('0x63')]['bulkCreate'](_0x178dab['body'],{'raw':![],'individualHooks':!![]})[_0xe434('0x23')](respondWithResult(_0x440e68,0xc9))[_0xe434('0x2d')](handleError(_0x440e68,null));};exports['update']=function(_0xeaf22,_0x5be63e){if(_0xeaf22[_0xe434('0x6c')]['id']){delete _0xeaf22['body']['id'];}delete _0xeaf22[_0xe434('0x6c')]['role'];return db['User'][_0xe434('0x45')]({'where':{'id':_0xeaf22[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x5be63e,null))[_0xe434('0x23')](saveUpdates(_0xeaf22[_0xe434('0x6c')],null))['then'](respondWithResult(_0x5be63e,null))['catch'](handleError(_0x5be63e,null));};exports[_0xe434('0x6e')]=function(_0x3503eb,_0x5c8adb){return db[_0xe434('0x63')][_0xe434('0x6e')]()[_0xe434('0x23')](respondWithResult(_0x5c8adb,null))[_0xe434('0x2d')](handleError(_0x5c8adb,null));};exports[_0xe434('0x6f')]=function(_0x3f457c,_0x36e669,_0x273e62){return db['User'][_0xe434('0x45')]({'where':{'id':_0x3f457c['params']['id']}})['then'](handleEntityNotFound(_0x36e669,null))[_0xe434('0x23')](function(_0x2f47d4){if(_0x2f47d4){return _0x2f47d4[_0xe434('0x6f')](_0x3f457c['body'][_0xe434('0x70')],_['omit'](_0x3f457c[_0xe434('0x6c')],[_0xe434('0x70'),'id'])||{});}})[_0xe434('0x23')](respondWithResult(_0x36e669,null))['catch'](handleError(_0x36e669,null));};var getLicense=function(_0x277fa6){return new BPromise(function(_0x49688c,_0x3cd60f){var _0x2b97a9=0x0;_0x277fa6[_0xe434('0x6c')]['role']===_0xe434('0x3c')&&_0x49688c(_0xe434('0x71'));return db['User']['count']({'where':{'$or':[{'role':_0x277fa6[_0xe434('0x6c')][_0xe434('0x44')]===_0xe434('0x3e')?'telephone':[_0xe434('0x72'),_0xe434('0x3a')]}]}})['then'](function(_0x252dac){_0x2b97a9=_0x252dac;return require(_0xe434('0x73'))['getLicense']();})[_0xe434('0x23')](function(_0x4d36e1){var _0x3a02ab=_0x277fa6[_0xe434('0x6c')][_0xe434('0x44')]===_0xe434('0x3e')?_0xe434('0x74'):_0xe434('0x75');if(!_['isNil'](_0x4d36e1[_0x3a02ab])&&_0x2b97a9>=_0x4d36e1[_0x3a02ab]){return _0x3cd60f({'message':'License\x20limit\x20reached'});}return _0x49688c(util[_0xe434('0x76')](_0xe434('0x77'),_0x3a02ab,_0x2b97a9));})['catch'](function(_0x238bff){return _0x3cd60f(_0x238bff);});});};exports[_0xe434('0x78')]=function(_0x16891c,_0x1fb694){return getLicense(_0x16891c)[_0xe434('0x23')](function(_0x14251a){if(!_0x16891c[_0xe434('0x6c')][_0xe434('0x79')]){var _0x3f0204;return db['Setting'][_0xe434('0x7a')](0x1)['then'](function(_0x60b32a){return checkPasswordPattern(_0x60b32a,_0x16891c[_0xe434('0x6c')][_0xe434('0x6a')],_0x60b32a[_0xe434('0x7b')]);})[_0xe434('0x23')](function(_0x340a00){_0x3f0204=_0x340a00[_0xe434('0x7c')];return db[_0xe434('0x63')][_0xe434('0x7d')](_0xe434('0x79'));})['then'](function(_0x12c784){if(_['isNil'](_0x12c784)){if(_0x3f0204){_0x16891c[_0xe434('0x6c')][_0xe434('0x79')]=_0x3f0204;}else{_0x16891c[_0xe434('0x6c')][_0xe434('0x79')]=0x1;}}else{if(_['isNil'](_0x3f0204)||_0x3f0204==_0x12c784){_0x16891c[_0xe434('0x6c')]['internal']=_0x12c784+0x1;}else if(_0x3f0204>_0x12c784){_0x16891c['body'][_0xe434('0x79')]=_0x3f0204;}else{return db[_0xe434('0x5f')][_0xe434('0x50')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xe434('0x5f')]['QueryTypes'][_0xe434('0x7e')]})[_0xe434('0x23')](function(_0x5da40d){if(_0x5da40d&&_0x5da40d['length']){for(var _0x29e4d8=0x0,_0x57e355=_0x5da40d['length'];_0x29e4d8<_0x57e355&&_[_0xe434('0x7f')](_0x16891c[_0xe434('0x6c')]['internal']);_0x29e4d8++){if(_0x3f0204<=_0x5da40d[_0x29e4d8][_0xe434('0x80')]){_0x16891c['body'][_0xe434('0x79')]=_0x5da40d[_0x29e4d8][_0xe434('0x80')];}else if(_0x3f0204>_0x5da40d[_0x29e4d8][_0xe434('0x80')]&&_0x3f0204<=_0x5da40d[_0x29e4d8]['to']){_0x16891c[_0xe434('0x6c')][_0xe434('0x79')]=_0x3f0204;}}}if(_[_0xe434('0x7f')](_0x16891c[_0xe434('0x6c')][_0xe434('0x79')])){_0x16891c[_0xe434('0x6c')][_0xe434('0x79')]=_0x12c784+0x1;}});}}});}})[_0xe434('0x23')](function(){if(_0x16891c[_0xe434('0x6c')]['voicemail']){_0x16891c['body']['mailbox']=_0x16891c[_0xe434('0x6c')][_0xe434('0x79')];_0x16891c[_0xe434('0x6c')][_0xe434('0x81')]={'mailbox':_0x16891c['body'][_0xe434('0x79')],'password':_0x16891c[_0xe434('0x6c')]['password'],'fullname':_0x16891c['body'][_0xe434('0x82')],'email':_0x16891c[_0xe434('0x6c')][_0xe434('0x83')]};}if(_0x16891c[_0xe434('0x6c')]&&_0x16891c[_0xe434('0x6c')][_0xe434('0x44')]===_0xe434('0x3c')){if(!_0x16891c[_0xe434('0x6c')][_0xe434('0x84')]){_0x16891c['body'][_0xe434('0x84')]=[_0xe434('0x85'),_0xe434('0x86'),_0xe434('0x87'),_0xe434('0x88'),'110',_0xe434('0x89'),_0xe434('0x8a'),_0xe434('0x8b'),_0xe434('0x8c'),_0xe434('0x8d'),'109',_0xe434('0x8e'),_0xe434('0x8f'),_0xe434('0x90')];}}return db[_0xe434('0x63')][_0xe434('0x78')](_0x16891c[_0xe434('0x6c')],{'include':[{'model':db[_0xe434('0x81')],'as':_0xe434('0x81')}]});})['then'](function(_0x52b7b5){if(_0x16891c[_0xe434('0x6c')][_0xe434('0x44')]===_0xe434('0x3a'))return _0x52b7b5;var _0x746faa=_0x16891c[_0xe434('0x3a')][_0xe434('0x91')]({'plain':!![]});if(!_0x746faa)throw new Error(_0xe434('0x92'));if(_0x746faa[_0xe434('0x44')]===_0xe434('0x3a')){var _0x35b619=_0x52b7b5[_0xe434('0x91')]({'plain':!![]});var _0x44acdd=[{'name':_0xe434('0x3b'),'value':_0xe434('0x3c')},{'name':'Telephones','value':'telephone'}];var _0x117dfa=_[_0xe434('0x45')](_0x44acdd,[_0xe434('0x42'),_0x35b619['role']])['name'];return db[_0xe434('0x93')][_0xe434('0x45')]({'where':{'name':_0x117dfa,'userProfileId':_0x746faa[_0xe434('0x94')]},'raw':!![]})[_0xe434('0x23')](function(_0x496955){if(_0x496955&&_0x496955[_0xe434('0x95')]===0x0){return db['UserProfileResource'][_0xe434('0x78')]({'name':_0x35b619['name'],'resourceId':_0x35b619['id'],'type':_0x496955[_0xe434('0x49')],'sectionId':_0x496955['id']},{})[_0xe434('0x23')](function(){return _0x52b7b5;});}else{return _0x52b7b5;}})['catch'](function(_0x485291){logger['error'](_0xe434('0x96'),_0x485291);throw _0x485291;});}return _0x52b7b5;})[_0xe434('0x23')](respondWithResult(_0x1fb694,0xc9))[_0xe434('0x2d')](handleError(_0x1fb694,null));};exports[_0xe434('0x97')]=function(_0x36ffad,_0x432327,_0x533dd4){var _0x2035ab=![];if(_0x36ffad[_0xe434('0x6c')]['id']){delete _0x36ffad[_0xe434('0x6c')]['id'];}return db[_0xe434('0x98')][_0xe434('0x99')]({'attributes':['id',_0xe434('0x7b')]})[_0xe434('0x23')](function(_0x1dc44a){_0x2035ab=_0x1dc44a[_0xe434('0x7b')];return db['User'][_0xe434('0x45')]({'where':{'id':_0x36ffad[_0xe434('0x6d')]['id']}});})[_0xe434('0x23')](function(_0x234bef){if(_0x234bef){if(_0x234bef['id']==_0x36ffad[_0xe434('0x3a')]['id']){if(!_0x36ffad[_0xe434('0x6c')][_0xe434('0x9a')]||!_0x36ffad[_0xe434('0x6c')][_0xe434('0x9b')]){throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))](_0xe434('0x9c'));}if(!_0x234bef[_0xe434('0x9d')](_0x36ffad[_0xe434('0x6c')]['oldPassword'])){throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))](_0xe434('0x9e'));}if(_0x36ffad['body'][_0xe434('0x9a')]==_0x36ffad[_0xe434('0x6c')][_0xe434('0x9b')]){throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x234bef;}else if(_0x36ffad[_0xe434('0x3a')][_0xe434('0x44')]==_0xe434('0x72')){if(!_0x36ffad['body'][_0xe434('0x9b')]){throw new db[(_0xe434('0x1f'))]['ValidationError'](_0xe434('0x9f'));}return _0x234bef;}else if(_0x36ffad[_0xe434('0x3a')]['role']==_0xe434('0x3a')){if(!_0x36ffad[_0xe434('0x6c')][_0xe434('0x9b')]){throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))](_0xe434('0x9f'));}if(_0x234bef[_0xe434('0x44')]!='agent'){throw new db[(_0xe434('0x1f'))]['ValidationError'](_0xe434('0xa0'));}return _0x234bef;}else{throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))](_0xe434('0xa0'));}}return null;})[_0xe434('0x23')](handleEntityNotFound(_0x432327,null))['then'](function(_0x190eb7){return checkPasswordPattern(_0x190eb7,_0x36ffad[_0xe434('0x6c')]['newPassword'],_0x2035ab);})['then'](saveUpdates({'password':_0x36ffad['body'][_0xe434('0x9b')],'passwordResetAt':_0x36ffad[_0xe434('0x3a')]['id']==_0x36ffad[_0xe434('0x6d')]['id']?moment():null},null))['then'](respondWithResult(_0x432327,null))[_0xe434('0x2d')](handleError(_0x432327,null));};exports[_0xe434('0xa1')]=function(_0x1d8099,_0x31def1,_0x2a7e5c){var _0x5d68b1=_0x1d8099[_0xe434('0x6c')][_0xe434('0xa2')];return db[_0xe434('0x63')][_0xe434('0x45')]({'where':{'id':_0x1d8099[_0xe434('0x6d')]['id']},'attributes':['id','name',_0xe434('0x44'),'online',_0xe434('0xa3'),'voicePause',_0xe434('0xa4')]})[_0xe434('0x23')](handleEntityNotFound(_0x31def1,null))[_0xe434('0x23')](function(_0x4d943f){if(_0x4d943f){if(!utils[_0xe434('0xa5')](_0x5d68b1)){throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))](_0xe434('0xa6'));}return _0x4d943f[_0xe434('0xa7')+_[_0xe434('0xa8')](_0x5d68b1[_0xe434('0xa9')]())+_0xe434('0xaa')](_0x1d8099[_0xe434('0x6c')][_0xe434('0x70')],{'penalty':_0x1d8099['body'][_0xe434('0xab')]||0x0})[_0xe434('0xac')](function(_0x2ed443){for(var _0x20a007=0x0;_0x20a007<_0x1d8099['body'][_0xe434('0x70')][_0xe434('0x56')];_0x20a007+=0x1){var _0x2e804f={'UserId':_0x1d8099['params']['id']};_0x2e804f[_['capitalize'](_0x5d68b1['toLowerCase']())+_0xe434('0xad')]=_0x1d8099[_0xe434('0x6c')]['ids'][_0x20a007];socket[_0xe434('0xae')]('user'+_[_0xe434('0xa8')](_0x5d68b1[_0xe434('0xa9')]())+_0xe434('0xaf'),_0x2e804f);}return _0x2ed443;})[_0xe434('0x23')](function(){if(_0x5d68b1===_0xe434('0xb0')){return db['VoiceQueue'][_0xe434('0x66')]({'where':{'id':_0x1d8099[_0xe434('0x6c')][_0xe434('0x70')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0xf06765){var _0x226ae4=_0x4d943f[_0xe434('0x91')]({'plain':!![]});var _0x1d2e25=[];if(_0x5d68b1===_0xe434('0xb0')&&_0x226ae4['role']===_0xe434('0x3c')&&_0x226ae4[_0xe434('0xb1')]){for(var _0x5c0abc=0x0;_0x5c0abc<_0xf06765[_0xe434('0x56')];_0x5c0abc+=0x1){_0x1d2e25[_0xe434('0xb2')]({'membername':_0x226ae4[_0xe434('0x49')],'UserId':_0x226ae4['id'],'queue_name':_0xf06765[_0x5c0abc][_0xe434('0x49')],'VoiceQueueId':_0xf06765[_0x5c0abc]['id'],'interface':_[_0xe434('0x7f')](_0x226ae4[_0xe434('0xa4')])?util[_0xe434('0x76')](_0xe434('0xb3'),_0x226ae4[_0xe434('0x49')]):_0x226ae4['interface'],'paused':_0x226ae4['voicePause']||![],'penalty':_0x1d8099[_0xe434('0x6c')]['penalty']||0x0});}return BPromise[_0xe434('0xb4')](_0x1d2e25,function(_0x1855ce){return db[_0xe434('0xb5')][_0xe434('0xb6')](_0x1855ce);});}return _0x4d943f;});}})[_0xe434('0x23')](respondWithStatusCode(_0x31def1,null))[_0xe434('0x2d')](handleError(_0x31def1,null));};exports[_0xe434('0xb7')]=function(_0x5d4a1b,_0x31bfbd,_0x3123c4){var _0x5c1614;return db[_0xe434('0x63')]['find']({'where':{'id':_0x5d4a1b[_0xe434('0x6d')]['id']},'attributes':['id','name',_0xe434('0x44')]})[_0xe434('0x23')](handleEntityNotFound(_0x31bfbd,null))[_0xe434('0x23')](function(_0x50edb9){if(_0x50edb9){_0x5c1614=_0x50edb9;if(!_0x5d4a1b[_0xe434('0x50')][_0xe434('0xa2')]||!utils[_0xe434('0xa5')](_0x5d4a1b[_0xe434('0x50')][_0xe434('0xa2')])){throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))]('Unknown\x20channel');}return _0x50edb9[_0xe434('0xb8')+_[_0xe434('0xa8')](_0x5d4a1b[_0xe434('0x50')][_0xe434('0xa2')][_0xe434('0xa9')]())+_0xe434('0xaa')](_0x5d4a1b[_0xe434('0x50')]['ids']);}})['then'](function(_0x13a37d){for(var _0x339c77=0x0;_0x339c77<_0x5d4a1b[_0xe434('0x50')][_0xe434('0x70')]['length'];_0x339c77+=0x1){var _0x391909={'UserId':_0x5d4a1b[_0xe434('0x6d')]['id']};_0x391909[_['capitalize'](_0x5d4a1b['query'][_0xe434('0xa2')][_0xe434('0xa9')]())+_0xe434('0xad')]=_0x5d4a1b[_0xe434('0x50')]['ids'][_0x339c77];socket[_0xe434('0xae')](_0xe434('0x3a')+_[_0xe434('0xa8')](_0x5d4a1b['query'][_0xe434('0xa2')][_0xe434('0xa9')]())+_0xe434('0xb9'),_0x391909);}return _0x13a37d;})['then'](function(){if(_0x5d4a1b[_0xe434('0x50')]['channel']===_0xe434('0xb0')){return db['UserVoiceQueueRt'][_0xe434('0x46')]({'where':{'UserId':_0x5d4a1b[_0xe434('0x6d')]['id'],'VoiceQueueId':_0x5d4a1b[_0xe434('0x50')]['ids']},'individualHooks':!![]})[_0xe434('0x23')](function(){return _0x5c1614;});}return _0x5c1614;})['then'](respondWithStatusCode(_0x31bfbd,null))[_0xe434('0x2d')](handleError(_0x31bfbd,null));};exports[_0xe434('0xba')]=function(_0x2b2ff9,_0x59c008,_0x27a53b){_0x2b2ff9[_0xe434('0x6c')][_0xe434('0xbb')]=_0x2b2ff9['file'][_0xe434('0xbc')];return db[_0xe434('0x63')]['find']({'where':{'id':_0x2b2ff9[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x59c008,null))[_0xe434('0x23')](saveUpdates(_0x2b2ff9[_0xe434('0x6c')],null))[_0xe434('0x23')](respondWithResult(_0x59c008,null))[_0xe434('0x2d')](handleError(_0x59c008,null));};exports['getAvatar']=function(_0x1ebf4f,_0x30daea,_0x191100){var _0x36d5b8=path[_0xe434('0xbd')](config['root'],_0xe434('0xbe'));return db[_0xe434('0x63')][_0xe434('0x45')]({'where':{'id':_0x1ebf4f[_0xe434('0x6d')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xe434('0x23')](handleEntityNotFound(_0x30daea,null))[_0xe434('0x23')](function(_0x1d52ea){if(_0x1d52ea){if(_['isNil'](_0x1d52ea[_0xe434('0xbb')])){return _0x30daea[_0xe434('0xbf')](_0x36d5b8);}else{if(!fs[_0xe434('0xc0')](path[_0xe434('0xbd')](config[_0xe434('0xc1')],_0xe434('0xc2'),_0x1d52ea[_0xe434('0xbb')]))){return _0x30daea[_0xe434('0xbf')](_0x36d5b8);}return _0x30daea[_0xe434('0xbf')](path[_0xe434('0xbd')](config['root'],_0xe434('0xc2'),_0x1d52ea[_0xe434('0xbb')]));}}})[_0xe434('0x2d')](handleError(_0x30daea,null));};exports[_0xe434('0xc3')]=function(_0x4772bc,_0x479962,_0x3319f2){var _0xceca89={};var _0xc7f2c9={};var _0x56d8c3;var _0x270e98;return db[_0xe434('0x63')]['findOne']({'where':{'id':_0x4772bc[_0xe434('0x6d')]['id']}})['then'](handleEntityNotFound(_0x479962,null))[_0xe434('0x23')](function(_0x428317){if(_0x428317){_0x56d8c3=_0x428317;_0xc7f2c9[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xc4')]['rawAttributes']);_0xc7f2c9['query']=_[_0xe434('0x69')](_0x4772bc[_0xe434('0x50')]);_0xc7f2c9[_0xe434('0x51')]=_[_0xe434('0x52')](_0xc7f2c9[_0xe434('0x53')],_0xc7f2c9[_0xe434('0x50')]);_0xceca89[_0xe434('0x54')]=_[_0xe434('0x52')](_0xc7f2c9[_0xe434('0x53')],qs[_0xe434('0x55')](_0x4772bc[_0xe434('0x50')][_0xe434('0x55')]));_0xceca89[_0xe434('0x54')]=_0xceca89[_0xe434('0x54')][_0xe434('0x56')]?_0xceca89[_0xe434('0x54')]:_0xc7f2c9[_0xe434('0x53')];_0xceca89['order']=qs[_0xe434('0x5a')](_0x4772bc[_0xe434('0x50')][_0xe434('0x5a')]);_0xceca89[_0xe434('0x5b')]=qs[_0xe434('0x51')](_['pick'](_0x4772bc['query'],_0xc7f2c9[_0xe434('0x51')]));if(_0x4772bc[_0xe434('0x50')]['filter']){_0xceca89[_0xe434('0x5b')]=_['merge'](_0xceca89[_0xe434('0x5b')],{'$or':_['map'](_0xceca89['attributes'],function(_0x4d3371){var _0x3e1bc0={};_0x3e1bc0[_0x4d3371]={'$like':'%'+_0x4772bc['query'][_0xe434('0x3f')]+'%'};return _0x3e1bc0;})});}_0xceca89=_[_0xe434('0x61')]({},_0xceca89,_0x4772bc[_0xe434('0x62')]);return _0x56d8c3[_0xe434('0xc3')](_0xceca89);}})[_0xe434('0x23')](function(_0x495bc9){if(_0x495bc9){_0x270e98=_0x495bc9[_0xe434('0x56')];if(_0x4772bc[_0xe434('0x50')][_0xe434('0x57')]('includeAll')){_0xceca89[_0xe434('0x65')]=[{'model':db[_0xe434('0xc5')],'as':_0xe434('0xc6'),'required':![]},{'model':db['Tag'],'as':_0xe434('0xc7'),'attributes':['id','name',_0xe434('0xc8')],'where':_0x4772bc[_0xe434('0x50')][_0xe434('0xc9')]?{'id':_0x4772bc[_0xe434('0x50')]['tag']}:undefined,'required':_0x4772bc[_0xe434('0x50')][_0xe434('0xc9')]?!![]:![]}];}if(!_0x4772bc[_0xe434('0x50')]['hasOwnProperty'](_0xe434('0x58'))){_0xceca89[_0xe434('0x32')]=qs[_0xe434('0x32')](_0x4772bc[_0xe434('0x50')][_0xe434('0x32')]);_0xceca89[_0xe434('0x31')]=qs[_0xe434('0x31')](_0x4772bc[_0xe434('0x50')]['offset']);}return _0x56d8c3[_0xe434('0xc3')](_0xceca89);}})['then'](function(_0x5bdd73){if(_0x5bdd73){return _0x5bdd73?{'count':_0x270e98,'rows':_0x5bdd73}:null;}})[_0xe434('0x23')](respondWithResult(_0x479962,null))[_0xe434('0x2d')](handleError(_0x479962,null));};exports[_0xe434('0xca')]=function(_0xf2c8a5,_0x3d7bab,_0x418a66){var _0xcb7e3;var _0x4421c2;var _0x4b4801={};var _0x5e8da9;return db[_0xe434('0x63')]['findOne']({'where':{'id':_0xf2c8a5[_0xe434('0x6d')]['id']},'attributes':['id',_0xe434('0x49'),_0xe434('0x44')]})['then'](handleEntityNotFound(_0x3d7bab,null))[_0xe434('0x23')](function(_0x470a25){if(!utils[_0xe434('0xa5')](_0xf2c8a5[_0xe434('0x50')][_0xe434('0xa2')])){throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))](_0xe434('0xa6'));}_0xcb7e3=_0x470a25;var _0x50e8e8={};_0x50e8e8['model']=_[_0xe434('0x69')](db[_[_0xe434('0xa8')](_0xf2c8a5[_0xe434('0x50')][_0xe434('0xa2')])+_0xe434('0xcb')]['rawAttributes']);_0x50e8e8['query']=_['keys'](_0xf2c8a5[_0xe434('0x50')]);_0x50e8e8[_0xe434('0x51')]=_['intersection'](_0x50e8e8[_0xe434('0x53')],_0x50e8e8[_0xe434('0x50')]);_0x4b4801[_0xe434('0x54')]=_[_0xe434('0x52')](_0x50e8e8[_0xe434('0x53')],qs[_0xe434('0x55')](_0xf2c8a5['query'][_0xe434('0x55')]));_0x4b4801[_0xe434('0x54')]=_0x4b4801['attributes'][_0xe434('0x56')]?_0x4b4801[_0xe434('0x54')]:_0x50e8e8[_0xe434('0x53')];_0x4b4801[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0xf2c8a5[_0xe434('0x50')][_0xe434('0x5a')]);_0x4b4801[_0xe434('0x5b')]=qs[_0xe434('0x51')](_[_0xe434('0x5c')](_0xf2c8a5[_0xe434('0x50')],_0x50e8e8[_0xe434('0x51')]));if(_0xf2c8a5[_0xe434('0x50')][_0xe434('0x3f')]){_0x4b4801[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x4b4801[_0xe434('0x5b')],{'$or':_['map'](_0x4b4801[_0xe434('0x54')],function(_0x20630e){var _0xac862d={};_0xac862d[_0x20630e]={'$like':'%'+_0xf2c8a5[_0xe434('0x50')]['filter']+'%'};return _0xac862d;})});}_0x4b4801=_['merge']({},_0x4b4801,_0xf2c8a5['options']);switch(_0xcb7e3[_0xe434('0x44')]){case _0xe434('0x72'):return db[_[_0xe434('0xa8')](_0xf2c8a5[_0xe434('0x50')][_0xe434('0xa2')])+'Queue']['findAll'](_0x4b4801);case'user':case _0xe434('0x3c'):return _0xcb7e3['get'+_[_0xe434('0xa8')](_0xf2c8a5['query'][_0xe434('0xa2')])+'Queues'](_0x4b4801);default:throw new db['Sequelize'][(_0xe434('0x20'))](_0xe434('0xcc'));}})[_0xe434('0x23')](function(_0x3d54a1){_0x5e8da9=_0x3d54a1[_0xe434('0x56')];if(!_0xf2c8a5[_0xe434('0x50')][_0xe434('0x57')](_0xe434('0x58'))){_0x4b4801[_0xe434('0x32')]=qs[_0xe434('0x32')](_0xf2c8a5[_0xe434('0x50')][_0xe434('0x32')]);_0x4b4801[_0xe434('0x31')]=qs[_0xe434('0x31')](_0xf2c8a5[_0xe434('0x50')]['offset']);}switch(_0xcb7e3[_0xe434('0x44')]){case'admin':return db[_[_0xe434('0xa8')](_0xf2c8a5[_0xe434('0x50')][_0xe434('0xa2')])+_0xe434('0xcb')][_0xe434('0x66')](_0x4b4801);case'user':case _0xe434('0x3c'):return _0xcb7e3[_0xe434('0x91')+_['capitalize'](_0xf2c8a5[_0xe434('0x50')][_0xe434('0xa2')])+'Queues'](_0x4b4801);}})['then'](function(_0x30d35d){return{'count':_0x5e8da9,'rows':_0x30d35d};})[_0xe434('0x23')](respondWithResult(_0x3d7bab,null))[_0xe434('0x2d')](handleError(_0x3d7bab,null));};exports[_0xe434('0xcd')]=function(_0x25f274,_0xf9fdb2,_0x595192){var _0x395224={};var _0x10c3a8={};var _0x2d9a51;var _0x322452;return db[_0xe434('0x63')][_0xe434('0x99')]({'where':{'id':_0x25f274[_0xe434('0x6d')]['id']}})['then'](handleEntityNotFound(_0xf9fdb2,null))[_0xe434('0x23')](function(_0x4179a0){if(_0x4179a0){_0x2d9a51=_0x4179a0;_0x10c3a8['model']=_[_0xe434('0x69')](db[_0xe434('0xb5')]['rawAttributes']);_0x10c3a8[_0xe434('0x50')]=_[_0xe434('0x69')](_0x25f274[_0xe434('0x50')]);_0x10c3a8[_0xe434('0x51')]=_[_0xe434('0x52')](_0x10c3a8[_0xe434('0x53')],_0x10c3a8[_0xe434('0x50')]);_0x395224['attributes']=_['intersection'](_0x10c3a8[_0xe434('0x53')],qs[_0xe434('0x55')](_0x25f274[_0xe434('0x50')][_0xe434('0x55')]));_0x395224['attributes']=_0x395224[_0xe434('0x54')][_0xe434('0x56')]?_0x395224['attributes']:_0x10c3a8[_0xe434('0x53')];_0x395224[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0x25f274[_0xe434('0x50')][_0xe434('0x5a')]);_0x395224['where']=qs[_0xe434('0x51')](_[_0xe434('0x5c')](_0x25f274[_0xe434('0x50')],_0x10c3a8[_0xe434('0x51')]));if(_0x25f274[_0xe434('0x50')][_0xe434('0x3f')]){_0x395224[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x395224[_0xe434('0x5b')],{'$or':_['map'](_0x395224['attributes'],function(_0x5ac356){var _0x1a53f3={};_0x1a53f3[_0x5ac356]={'$like':'%'+_0x25f274['query'][_0xe434('0x3f')]+'%'};return _0x1a53f3;})});}_0x395224=_['merge']({},_0x395224,_0x25f274[_0xe434('0x62')]);return _0x2d9a51[_0xe434('0xcd')](_0x395224);}})['then'](function(_0x1cd2ff){if(_0x1cd2ff){_0x322452=_0x1cd2ff['length'];if(!_0x25f274[_0xe434('0x50')][_0xe434('0x57')](_0xe434('0x58'))){_0x395224[_0xe434('0x32')]=qs[_0xe434('0x32')](_0x25f274['query'][_0xe434('0x32')]);_0x395224[_0xe434('0x31')]=qs['offset'](_0x25f274[_0xe434('0x50')][_0xe434('0x31')]);}return _0x2d9a51[_0xe434('0xcd')](_0x395224);}})[_0xe434('0x23')](function(_0x15723e){if(_0x15723e){return _0x15723e?{'count':_0x322452,'rows':_0x15723e}:null;}})[_0xe434('0x23')](respondWithResult(_0xf9fdb2,null))[_0xe434('0x2d')](handleError(_0xf9fdb2,null));};exports[_0xe434('0xce')]=function(_0x430ae5,_0x5d62ab,_0x437c5b){var _0x212b1b={};var _0x47715e={};var _0x2da095;var _0x28e1e2;return db[_0xe434('0x63')]['findOne']({'where':{'id':_0x430ae5['params']['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x5d62ab,null))[_0xe434('0x23')](function(_0x55dc35){if(_0x55dc35){_0x2da095=_0x55dc35;_0x47715e[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xcf')][_0xe434('0x4c')]);_0x47715e[_0xe434('0x50')]=_[_0xe434('0x69')](_0x430ae5[_0xe434('0x50')]);_0x47715e[_0xe434('0x51')]=_['intersection'](_0x47715e[_0xe434('0x53')],_0x47715e[_0xe434('0x50')]);_0x212b1b[_0xe434('0x54')]=_[_0xe434('0x52')](_0x47715e[_0xe434('0x53')],qs[_0xe434('0x55')](_0x430ae5[_0xe434('0x50')][_0xe434('0x55')]));_0x212b1b['attributes']=_0x212b1b[_0xe434('0x54')][_0xe434('0x56')]?_0x212b1b['attributes']:_0x47715e[_0xe434('0x53')];_0x212b1b[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0x430ae5[_0xe434('0x50')][_0xe434('0x5a')]);_0x212b1b[_0xe434('0x5b')]=qs[_0xe434('0x51')](_['pick'](_0x430ae5[_0xe434('0x50')],_0x47715e[_0xe434('0x51')]));if(_0x430ae5[_0xe434('0x50')][_0xe434('0x3f')]){_0x212b1b[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x212b1b[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x212b1b[_0xe434('0x54')],function(_0x4016c2){var _0x527ad5={};_0x527ad5[_0x4016c2]={'$like':'%'+_0x430ae5[_0xe434('0x50')]['filter']+'%'};return _0x527ad5;})});}_0x212b1b=_[_0xe434('0x61')]({},_0x212b1b,_0x430ae5[_0xe434('0x62')]);return _0x2da095[_0xe434('0xce')](_0x212b1b);}})[_0xe434('0x23')](function(_0x30c041){if(_0x30c041){_0x28e1e2=_0x30c041[_0xe434('0x56')];if(!_0x430ae5[_0xe434('0x50')][_0xe434('0x57')](_0xe434('0x58'))){_0x212b1b[_0xe434('0x32')]=qs['limit'](_0x430ae5[_0xe434('0x50')][_0xe434('0x32')]);_0x212b1b['offset']=qs['offset'](_0x430ae5[_0xe434('0x50')][_0xe434('0x31')]);}return _0x2da095[_0xe434('0xce')](_0x212b1b);}})[_0xe434('0x23')](function(_0x5d19f0){if(_0x5d19f0){return _0x5d19f0?{'count':_0x28e1e2,'rows':_0x5d19f0}:null;}})['then'](respondWithResult(_0x5d62ab,null))[_0xe434('0x2d')](handleError(_0x5d62ab,null));};exports['getRecordings']=function(_0x3a34ee,_0x1f6ba6,_0x11a450){var _0x4e6337={'raw':!![],'where':{}};var _0x586e30={};var _0x4ff032={'count':0x0,'rows':[]};return db[_0xe434('0x63')][_0xe434('0x99')]({'where':{'id':_0x3a34ee[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x1f6ba6,null))[_0xe434('0x23')](function(_0x2e2f8f){if(_0x2e2f8f){_0x586e30[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xd0')][_0xe434('0x4c')]);_0x586e30[_0xe434('0x50')]=_[_0xe434('0x69')](_0x3a34ee[_0xe434('0x50')]);_0x586e30[_0xe434('0x51')]=_['intersection'](_0x586e30[_0xe434('0x53')],_0x586e30['query']);_0x4e6337[_0xe434('0x54')]=_[_0xe434('0x52')](_0x586e30[_0xe434('0x53')],qs['fields'](_0x3a34ee[_0xe434('0x50')]['fields']));_0x4e6337[_0xe434('0x54')]=_0x4e6337['attributes']['length']?_0x4e6337['attributes']:_0x586e30[_0xe434('0x53')];if(!_0x3a34ee[_0xe434('0x50')][_0xe434('0x57')](_0xe434('0x58'))){_0x4e6337[_0xe434('0x32')]=qs['limit'](_0x3a34ee[_0xe434('0x50')]['limit']);_0x4e6337['offset']=qs[_0xe434('0x31')](_0x3a34ee['query'][_0xe434('0x31')]);}_0x4e6337[_0xe434('0x59')]=qs['sort'](_0x3a34ee['query'][_0xe434('0x5a')]);_0x4e6337['where']=qs['filters'](_['pick'](_0x3a34ee[_0xe434('0x50')],_0x586e30[_0xe434('0x51')]));_0x4e6337['where']['UserId']=_0x2e2f8f['id'];if(_0x3a34ee['query'][_0xe434('0x3f')]){_0x4e6337[_0xe434('0x5b')]=_['merge'](_0x4e6337[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x4e6337[_0xe434('0x54')],function(_0xc149b){var _0x23ec69={};_0x23ec69[_0xc149b]={'$like':'%'+_0x3a34ee[_0xe434('0x50')][_0xe434('0x3f')]+'%'};return _0x23ec69;})});}_0x4e6337=_[_0xe434('0x61')]({},_0x4e6337,_0x3a34ee['options']);return db[_0xe434('0xd0')][_0xe434('0x30')]({'where':_0x4e6337[_0xe434('0x5b')]})['then'](function(_0x572756){_0x4ff032['count']=_0x572756;if(_0x3a34ee['query'][_0xe434('0x64')]){_0x4e6337[_0xe434('0x65')]=[{'all':!![]}];}return db['VoiceRecording'][_0xe434('0x66')](_0x4e6337);})['then'](function(_0x1c0ef6){_0x4ff032[_0xe434('0x67')]=_0x1c0ef6;return _0x4ff032;});}})[_0xe434('0x23')](respondWithFilteredResult(_0x1f6ba6,_0x4e6337))[_0xe434('0x2d')](handleError(_0x1f6ba6,null));};exports[_0xe434('0xd1')]=function(_0x33a49d,_0x11d501,_0xeec116){var _0x6d64={'raw':!![],'where':{}};var _0x4da6b9={};var _0x470f8b={'count':0x0,'rows':[]};return db[_0xe434('0x63')][_0xe434('0x99')]({'where':{'id':_0x33a49d[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x11d501,null))[_0xe434('0x23')](function(_0xb9cc7e){if(_0xb9cc7e){_0x4da6b9[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xd2')]['rawAttributes']);_0x4da6b9['query']=_[_0xe434('0x69')](_0x33a49d[_0xe434('0x50')]);_0x4da6b9['filters']=_['intersection'](_0x4da6b9[_0xe434('0x53')],_0x4da6b9[_0xe434('0x50')]);_0x6d64[_0xe434('0x54')]=_[_0xe434('0x52')](_0x4da6b9['model'],qs['fields'](_0x33a49d['query'][_0xe434('0x55')]));_0x6d64['attributes']=_0x6d64[_0xe434('0x54')][_0xe434('0x56')]?_0x6d64[_0xe434('0x54')]:_0x4da6b9['model'];if(!_0x33a49d[_0xe434('0x50')][_0xe434('0x57')](_0xe434('0x58'))){_0x6d64[_0xe434('0x32')]=qs[_0xe434('0x32')](_0x33a49d[_0xe434('0x50')][_0xe434('0x32')]);_0x6d64[_0xe434('0x31')]=qs[_0xe434('0x31')](_0x33a49d[_0xe434('0x50')][_0xe434('0x31')]);}_0x6d64[_0xe434('0x59')]=qs['sort'](_0x33a49d[_0xe434('0x50')][_0xe434('0x5a')]);_0x6d64[_0xe434('0x5b')]=qs[_0xe434('0x51')](_[_0xe434('0x5c')](_0x33a49d[_0xe434('0x50')],_0x4da6b9[_0xe434('0x51')]));_0x6d64[_0xe434('0x5b')][_0xe434('0xd3')]=_0xb9cc7e['id'];if(_0x33a49d[_0xe434('0x50')][_0xe434('0x3f')]){_0x6d64[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x6d64[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x6d64[_0xe434('0x54')],function(_0x112c6b){var _0x2e14de={};_0x2e14de[_0x112c6b]={'$like':'%'+_0x33a49d[_0xe434('0x50')][_0xe434('0x3f')]+'%'};return _0x2e14de;})});}_0x6d64=_[_0xe434('0x61')]({},_0x6d64,_0x33a49d[_0xe434('0x62')]);return db['ScreenRecording'][_0xe434('0x30')]({'where':_0x6d64[_0xe434('0x5b')]})[_0xe434('0x23')](function(_0x2c2629){_0x470f8b['count']=_0x2c2629;if(_0x33a49d[_0xe434('0x50')][_0xe434('0x64')]){_0x6d64[_0xe434('0x65')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe434('0x66')](_0x6d64);})[_0xe434('0x23')](function(_0x5ec38e){_0x470f8b[_0xe434('0x67')]=_0x5ec38e;return _0x470f8b;});}})[_0xe434('0x23')](respondWithFilteredResult(_0x11d501,_0x6d64))[_0xe434('0x2d')](handleError(_0x11d501,null));};exports['getChatInteractions']=function(_0x4b902f,_0x382366,_0x56a62c){var _0x5ee6d0={};var _0x4250c5={};var _0xaac9fa;var _0x327f64;return db[_0xe434('0x63')]['findOne']({'where':{'id':_0x4b902f['params']['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x382366,null))['then'](function(_0x4ad7b2){if(_0x4ad7b2){_0xaac9fa=_0x4ad7b2;_0x4250c5[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xd4')][_0xe434('0x4c')]);_0x4250c5[_0xe434('0x50')]=_[_0xe434('0x69')](_0x4b902f[_0xe434('0x50')]);_0x4250c5[_0xe434('0x51')]=_[_0xe434('0x52')](_0x4250c5[_0xe434('0x53')],_0x4250c5[_0xe434('0x50')]);_0x5ee6d0[_0xe434('0x54')]=_[_0xe434('0x52')](_0x4250c5[_0xe434('0x53')],qs[_0xe434('0x55')](_0x4b902f[_0xe434('0x50')][_0xe434('0x55')]));_0x5ee6d0[_0xe434('0x54')]=_0x5ee6d0[_0xe434('0x54')][_0xe434('0x56')]?_0x5ee6d0[_0xe434('0x54')]:_0x4250c5[_0xe434('0x53')];_0x5ee6d0['order']=qs[_0xe434('0x5a')](_0x4b902f['query'][_0xe434('0x5a')]);_0x5ee6d0[_0xe434('0x5b')]=qs['filters'](_['pick'](_0x4b902f[_0xe434('0x50')],_0x4250c5[_0xe434('0x51')]));if(_0x4b902f[_0xe434('0x50')]['filter']){_0x5ee6d0[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x5ee6d0[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x5ee6d0[_0xe434('0x54')],function(_0x3e5d35){var _0x4a2e8b={};_0x4a2e8b[_0x3e5d35]={'$like':'%'+_0x4b902f[_0xe434('0x50')][_0xe434('0x3f')]+'%'};return _0x4a2e8b;})});}_0x5ee6d0=_[_0xe434('0x61')]({},_0x5ee6d0,_0x4b902f[_0xe434('0x62')]);return _0xaac9fa['getChatInteractions'](_0x5ee6d0);}})[_0xe434('0x23')](function(_0x41aad5){if(_0x41aad5){_0x327f64=_0x41aad5[_0xe434('0x56')];if(!_0x4b902f[_0xe434('0x50')]['hasOwnProperty'](_0xe434('0x58'))){_0x5ee6d0[_0xe434('0x32')]=qs[_0xe434('0x32')](_0x4b902f[_0xe434('0x50')][_0xe434('0x32')]);_0x5ee6d0[_0xe434('0x31')]=qs['offset'](_0x4b902f['query'][_0xe434('0x31')]);}return _0xaac9fa[_0xe434('0xd5')](_0x5ee6d0);}})[_0xe434('0x23')](function(_0x5b350d){if(_0x5b350d){return _0x5b350d?{'count':_0x327f64,'rows':_0x5b350d}:null;}})['then'](respondWithResult(_0x382366,null))[_0xe434('0x2d')](handleError(_0x382366,null));};exports[_0xe434('0xd6')]=function(_0x13a4b5,_0x185e4e,_0x4b9ecb){var _0x1ff1ff={};var _0x5596e1={};var _0x71d7fb;var _0x15e021;return db[_0xe434('0x63')][_0xe434('0x99')]({'where':{'id':_0x13a4b5[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x185e4e,null))[_0xe434('0x23')](function(_0x1175fd){if(_0x1175fd){_0x71d7fb=_0x1175fd;_0x5596e1[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xd7')][_0xe434('0x4c')]);_0x5596e1[_0xe434('0x50')]=_[_0xe434('0x69')](_0x13a4b5['query']);_0x5596e1['filters']=_[_0xe434('0x52')](_0x5596e1['model'],_0x5596e1['query']);_0x1ff1ff['attributes']=_[_0xe434('0x52')](_0x5596e1[_0xe434('0x53')],qs[_0xe434('0x55')](_0x13a4b5[_0xe434('0x50')][_0xe434('0x55')]));_0x1ff1ff[_0xe434('0x54')]=_0x1ff1ff['attributes'][_0xe434('0x56')]?_0x1ff1ff['attributes']:_0x5596e1[_0xe434('0x53')];_0x1ff1ff[_0xe434('0x59')]=qs['sort'](_0x13a4b5['query'][_0xe434('0x5a')]);_0x1ff1ff[_0xe434('0x5b')]=qs[_0xe434('0x51')](_['pick'](_0x13a4b5['query'],_0x5596e1[_0xe434('0x51')]));if(_0x13a4b5[_0xe434('0x50')][_0xe434('0x3f')]){_0x1ff1ff['where']=_['merge'](_0x1ff1ff[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x1ff1ff['attributes'],function(_0x104bdf){var _0x533198={};_0x533198[_0x104bdf]={'$like':'%'+_0x13a4b5[_0xe434('0x50')]['filter']+'%'};return _0x533198;})});}_0x1ff1ff=_[_0xe434('0x61')]({},_0x1ff1ff,_0x13a4b5['options']);return _0x71d7fb[_0xe434('0xd6')](_0x1ff1ff);}})[_0xe434('0x23')](function(_0x8b29c3){if(_0x8b29c3){_0x15e021=_0x8b29c3['length'];if(!_0x13a4b5[_0xe434('0x50')][_0xe434('0x57')]('nolimit')){_0x1ff1ff[_0xe434('0x32')]=qs[_0xe434('0x32')](_0x13a4b5['query'][_0xe434('0x32')]);_0x1ff1ff[_0xe434('0x31')]=qs[_0xe434('0x31')](_0x13a4b5[_0xe434('0x50')]['offset']);}return _0x71d7fb[_0xe434('0xd6')](_0x1ff1ff);}})[_0xe434('0x23')](function(_0x357cae){if(_0x357cae){return _0x357cae?{'count':_0x15e021,'rows':_0x357cae}:null;}})['then'](respondWithResult(_0x185e4e,null))[_0xe434('0x2d')](handleError(_0x185e4e,null));};exports[_0xe434('0xd8')]=function(_0x254040,_0x266ffd,_0x25643b){var _0x597d45={'raw':!![],'where':{}};var _0x36d357={};var _0x35b050={'count':0x0,'rows':[]};return db[_0xe434('0x63')]['findOne']({'where':{'id':_0x254040[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x266ffd,null))[_0xe434('0x23')](function(_0x16db2e){if(_0x16db2e){_0x36d357[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xd9')][_0xe434('0x4c')]);_0x36d357[_0xe434('0x50')]=_['keys'](_0x254040['query']);_0x36d357[_0xe434('0x51')]=_[_0xe434('0x52')](_0x36d357[_0xe434('0x53')],_0x36d357['query']);_0x597d45[_0xe434('0x54')]=_['intersection'](_0x36d357['model'],qs[_0xe434('0x55')](_0x254040[_0xe434('0x50')]['fields']));_0x597d45['attributes']=_0x597d45['attributes']['length']?_0x597d45[_0xe434('0x54')]:_0x36d357[_0xe434('0x53')];if(!_0x254040[_0xe434('0x50')][_0xe434('0x57')](_0xe434('0x58'))){_0x597d45[_0xe434('0x32')]=qs[_0xe434('0x32')](_0x254040[_0xe434('0x50')][_0xe434('0x32')]);_0x597d45[_0xe434('0x31')]=qs[_0xe434('0x31')](_0x254040[_0xe434('0x50')][_0xe434('0x31')]);}_0x597d45['order']=qs[_0xe434('0x5a')](_0x254040[_0xe434('0x50')][_0xe434('0x5a')]);_0x597d45['where']=qs[_0xe434('0x51')](_['pick'](_0x254040['query'],_0x36d357[_0xe434('0x51')]));_0x597d45[_0xe434('0x5b')][_0xe434('0xd3')]=_0x16db2e['id'];if(_0x254040[_0xe434('0x50')][_0xe434('0x3f')]){_0x597d45[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x597d45[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x597d45[_0xe434('0x54')],function(_0x200b57){var _0x20dcee={};_0x20dcee[_0x200b57]={'$like':'%'+_0x254040[_0xe434('0x50')][_0xe434('0x3f')]+'%'};return _0x20dcee;})});}_0x597d45=_[_0xe434('0x61')]({},_0x597d45,_0x254040['options']);return db['MailInteraction'][_0xe434('0x30')]({'where':_0x597d45[_0xe434('0x5b')]})['then'](function(_0x136ef2){_0x35b050[_0xe434('0x30')]=_0x136ef2;if(_0x254040[_0xe434('0x50')]['includeAll']){_0x597d45[_0xe434('0x65')]=[{'all':!![]}];}return db[_0xe434('0xd9')][_0xe434('0x66')](_0x597d45);})['then'](function(_0x502075){_0x35b050[_0xe434('0x67')]=_0x502075;return _0x35b050;});}})[_0xe434('0x23')](respondWithFilteredResult(_0x266ffd,_0x597d45))[_0xe434('0x2d')](handleError(_0x266ffd,null));};exports[_0xe434('0xda')]=function(_0x22cb0f,_0x3746ed,_0x2ec379){var _0x125f8e={};var _0x5d277a={};var _0xf27dd9;var _0x223b20;return db['User'][_0xe434('0x99')]({'where':{'id':_0x22cb0f[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x3746ed,null))[_0xe434('0x23')](function(_0xce7edf){if(_0xce7edf){_0xf27dd9=_0xce7edf;_0x5d277a[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xdb')][_0xe434('0x4c')]);_0x5d277a[_0xe434('0x50')]=_[_0xe434('0x69')](_0x22cb0f['query']);_0x5d277a['filters']=_[_0xe434('0x52')](_0x5d277a[_0xe434('0x53')],_0x5d277a['query']);_0x125f8e[_0xe434('0x54')]=_['intersection'](_0x5d277a[_0xe434('0x53')],qs[_0xe434('0x55')](_0x22cb0f[_0xe434('0x50')][_0xe434('0x55')]));_0x125f8e[_0xe434('0x54')]=_0x125f8e[_0xe434('0x54')][_0xe434('0x56')]?_0x125f8e[_0xe434('0x54')]:_0x5d277a['model'];_0x125f8e[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0x22cb0f[_0xe434('0x50')]['sort']);_0x125f8e[_0xe434('0x5b')]=qs['filters'](_[_0xe434('0x5c')](_0x22cb0f[_0xe434('0x50')],_0x5d277a[_0xe434('0x51')]));if(_0x22cb0f[_0xe434('0x50')]['filter']){_0x125f8e[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x125f8e['where'],{'$or':_[_0xe434('0x41')](_0x125f8e['attributes'],function(_0x2e93e2){var _0x46fb73={};_0x46fb73[_0x2e93e2]={'$like':'%'+_0x22cb0f[_0xe434('0x50')][_0xe434('0x3f')]+'%'};return _0x46fb73;})});}_0x125f8e=_[_0xe434('0x61')]({},_0x125f8e,_0x22cb0f[_0xe434('0x62')]);return _0xf27dd9[_0xe434('0xda')](_0x125f8e);}})[_0xe434('0x23')](function(_0x48f7a1){if(_0x48f7a1){_0x223b20=_0x48f7a1['length'];if(!_0x22cb0f[_0xe434('0x50')][_0xe434('0x57')](_0xe434('0x58'))){_0x125f8e[_0xe434('0x32')]=qs['limit'](_0x22cb0f['query']['limit']);_0x125f8e['offset']=qs[_0xe434('0x31')](_0x22cb0f[_0xe434('0x50')]['offset']);}return _0xf27dd9[_0xe434('0xda')](_0x125f8e);}})[_0xe434('0x23')](function(_0x282702){if(_0x282702){return _0x282702?{'count':_0x223b20,'rows':_0x282702}:null;}})[_0xe434('0x23')](respondWithResult(_0x3746ed,null))[_0xe434('0x2d')](handleError(_0x3746ed,null));};exports['getFaxInteractions']=function(_0x2b7b78,_0x38a71f,_0x4b05b1){var _0x1e9b03={};var _0x56d4f9={};var _0x3727ef;var _0x6af0b;return db[_0xe434('0x63')][_0xe434('0x99')]({'where':{'id':_0x2b7b78[_0xe434('0x6d')]['id']}})['then'](handleEntityNotFound(_0x38a71f,null))[_0xe434('0x23')](function(_0x4ff26a){if(_0x4ff26a){_0x3727ef=_0x4ff26a;_0x56d4f9[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xdc')][_0xe434('0x4c')]);_0x56d4f9[_0xe434('0x50')]=_['keys'](_0x2b7b78[_0xe434('0x50')]);_0x56d4f9[_0xe434('0x51')]=_['intersection'](_0x56d4f9[_0xe434('0x53')],_0x56d4f9[_0xe434('0x50')]);_0x1e9b03[_0xe434('0x54')]=_['intersection'](_0x56d4f9[_0xe434('0x53')],qs['fields'](_0x2b7b78[_0xe434('0x50')][_0xe434('0x55')]));_0x1e9b03[_0xe434('0x54')]=_0x1e9b03[_0xe434('0x54')]['length']?_0x1e9b03[_0xe434('0x54')]:_0x56d4f9[_0xe434('0x53')];_0x1e9b03[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0x2b7b78['query'][_0xe434('0x5a')]);_0x1e9b03['where']=qs[_0xe434('0x51')](_['pick'](_0x2b7b78['query'],_0x56d4f9[_0xe434('0x51')]));if(_0x2b7b78[_0xe434('0x50')][_0xe434('0x3f')]){_0x1e9b03[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x1e9b03[_0xe434('0x5b')],{'$or':_['map'](_0x1e9b03['attributes'],function(_0x20f65f){var _0xffc0e4={};_0xffc0e4[_0x20f65f]={'$like':'%'+_0x2b7b78[_0xe434('0x50')]['filter']+'%'};return _0xffc0e4;})});}_0x1e9b03=_[_0xe434('0x61')]({},_0x1e9b03,_0x2b7b78[_0xe434('0x62')]);return _0x3727ef[_0xe434('0xdd')](_0x1e9b03);}})[_0xe434('0x23')](function(_0xc21b54){if(_0xc21b54){_0x6af0b=_0xc21b54[_0xe434('0x56')];if(!_0x2b7b78[_0xe434('0x50')][_0xe434('0x57')]('nolimit')){_0x1e9b03[_0xe434('0x32')]=qs[_0xe434('0x32')](_0x2b7b78[_0xe434('0x50')][_0xe434('0x32')]);_0x1e9b03[_0xe434('0x31')]=qs[_0xe434('0x31')](_0x2b7b78[_0xe434('0x50')][_0xe434('0x31')]);}return _0x3727ef[_0xe434('0xdd')](_0x1e9b03);}})[_0xe434('0x23')](function(_0x2e7a5d){if(_0x2e7a5d){return _0x2e7a5d?{'count':_0x6af0b,'rows':_0x2e7a5d}:null;}})[_0xe434('0x23')](respondWithResult(_0x38a71f,null))['catch'](handleError(_0x38a71f,null));};exports[_0xe434('0xde')]=function(_0x5ee5bc,_0xd01222,_0x4730cf){var _0x39e77c={};var _0x30da07={};var _0x53c2f4;var _0x2e4f45;return db['User']['findOne']({'where':{'id':_0x5ee5bc[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0xd01222,null))[_0xe434('0x23')](function(_0x2e5be9){if(_0x2e5be9){_0x53c2f4=_0x2e5be9;_0x30da07[_0xe434('0x53')]=_['keys'](db[_0xe434('0xdf')]['rawAttributes']);_0x30da07[_0xe434('0x50')]=_[_0xe434('0x69')](_0x5ee5bc['query']);_0x30da07['filters']=_[_0xe434('0x52')](_0x30da07[_0xe434('0x53')],_0x30da07[_0xe434('0x50')]);_0x39e77c[_0xe434('0x54')]=_[_0xe434('0x52')](_0x30da07[_0xe434('0x53')],qs[_0xe434('0x55')](_0x5ee5bc[_0xe434('0x50')][_0xe434('0x55')]));_0x39e77c[_0xe434('0x54')]=_0x39e77c[_0xe434('0x54')][_0xe434('0x56')]?_0x39e77c[_0xe434('0x54')]:_0x30da07[_0xe434('0x53')];_0x39e77c[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0x5ee5bc['query']['sort']);_0x39e77c[_0xe434('0x5b')]=qs[_0xe434('0x51')](_[_0xe434('0x5c')](_0x5ee5bc[_0xe434('0x50')],_0x30da07['filters']));if(_0x5ee5bc['query']['filter']){_0x39e77c[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x39e77c[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x39e77c['attributes'],function(_0x3f5fbf){var _0x2a5b67={};_0x2a5b67[_0x3f5fbf]={'$like':'%'+_0x5ee5bc[_0xe434('0x50')]['filter']+'%'};return _0x2a5b67;})});}_0x39e77c=_[_0xe434('0x61')]({},_0x39e77c,_0x5ee5bc[_0xe434('0x62')]);return _0x53c2f4[_0xe434('0xde')](_0x39e77c);}})[_0xe434('0x23')](function(_0xc8b76b){if(_0xc8b76b){_0x2e4f45=_0xc8b76b[_0xe434('0x56')];if(!_0x5ee5bc[_0xe434('0x50')]['hasOwnProperty']('nolimit')){_0x39e77c['limit']=qs[_0xe434('0x32')](_0x5ee5bc['query']['limit']);_0x39e77c[_0xe434('0x31')]=qs['offset'](_0x5ee5bc[_0xe434('0x50')]['offset']);}return _0x53c2f4[_0xe434('0xde')](_0x39e77c);}})['then'](function(_0x8b5e25){if(_0x8b5e25){return _0x8b5e25?{'count':_0x2e4f45,'rows':_0x8b5e25}:null;}})['then'](respondWithResult(_0xd01222,null))[_0xe434('0x2d')](handleError(_0xd01222,null));};exports[_0xe434('0xe0')]=function(_0x94dcdf,_0x5b9562,_0x4df1cb){var _0x3b12c8;var _0x56bb97;var _0x148f89;var _0x1868d6=!_[_0xe434('0x7f')](_0x94dcdf['params']['id'])?_0x94dcdf['params']['id']:!_['isNil'](_0x94dcdf[_0xe434('0x3a')]['id'])?_0x94dcdf[_0xe434('0x3a')]['id']:null;return db[_0xe434('0x63')][_0xe434('0x45')]({'where':{'id':_0x1868d6,'role':{'$or':[_0xe434('0x72'),_0xe434('0x3a'),_0xe434('0x3c')]}},'attributes':['id',_0xe434('0x49'),_0xe434('0xe1'),_0xe434('0xe2'),_0xe434('0x44'),_0xe434('0x79'),_0xe434('0xa3')]})[_0xe434('0x23')](function(_0x2c90e8){if(_0x2c90e8){if(_0x2c90e8[_0xe434('0x44')]===_0xe434('0x3c')){_0x3b12c8=_0x2c90e8;if(_0x94dcdf[_0xe434('0x6c')][_0xe434('0xa4')]){_0x148f89=util['format'](_0xe434('0xe3'),_0x3b12c8[_0x94dcdf[_0xe434('0x6c')][_0xe434('0xa4')]]);}else if(_0x94dcdf[_0xe434('0x6c')][_0xe434('0xe4')]){_0x148f89=util[_0xe434('0x76')](_0xe434('0xb3'),_0x94dcdf[_0xe434('0x6c')][_0xe434('0xe4')]);}else{_0x148f89=util[_0xe434('0x76')](_0xe434('0xb3'),_0x3b12c8[_0xe434('0x49')]);}socket['to'](util[_0xe434('0x76')](_0xe434('0xe5'),_0x3b12c8[_0xe434('0x49')]))[_0xe434('0xae')](_0xe434('0xe6'),{'ip':_0x94dcdf[_0xe434('0xe7')][_0xe434('0xe8')]||_0x94dcdf[_0xe434('0xe9')][_0xe434('0xea')]||_0x94dcdf[_0xe434('0xeb')][_0xe434('0xea')]||_0x94dcdf[_0xe434('0xe9')][_0xe434('0xeb')][_0xe434('0xea')]});return db[_0xe434('0xb5')][_0xe434('0x46')]({'where':{'membername':_0x3b12c8[_0xe434('0x49')]},'individualHooks':!![]});}}else{throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))](_0xe434('0xec'));}})['then'](function(){if(_0x3b12c8){return _0x3b12c8[_0xe434('0xed')]({'raw':!![]});}})[_0xe434('0x23')](function(_0x546d0a){if(_0x3b12c8){var _0x54700b=[];if(_0x546d0a){_0x56bb97=_0x546d0a;if(_0x56bb97[_0xe434('0x56')]){for(var _0x58cf43=0x0;_0x58cf43<_0x56bb97['length'];_0x58cf43++){_0x54700b['push']({'membername':_0x3b12c8[_0xe434('0x49')],'UserId':_0x3b12c8['id'],'queue_name':_0x56bb97[_0x58cf43][_0xe434('0x49')],'VoiceQueueId':_0x56bb97[_0x58cf43]['id'],'interface':_0x148f89,'paused':_0x3b12c8['loginInPause']||![],'penalty':_0x56bb97[_0x58cf43][_0xe434('0xee')]||0x0});}return BPromise[_0xe434('0xb4')](_0x54700b,function(_0x322c01){return db['UserVoiceQueueRt'][_0xe434('0xb6')](_0x322c01);});}}}})[_0xe434('0x23')](function(){if(_0x3b12c8){return db['MemberReport']['findAll']({'where':{'membername':_0x3b12c8['name'],'exitAt':null}});}})['then'](function(_0x365c22){if(_0x3b12c8){var _0x252542=[];_0x365c22[_0xe434('0xef')](function(_0x3b7752){_0x252542[_0xe434('0xb2')](_0x3b7752[_0xe434('0x38')]({'exitAt':moment()['format'](_0xe434('0xf0'))}));});return BPromise['all'](_0x252542);}})['then'](function(){if(_0x3b12c8){var _0x3a9f03=[];var _0x49494f=[];var _0x4b2047=utils[_0xe434('0xf1')]();var _0x35b03c={'membername':_0x3b12c8[_0xe434('0x49')],'interface':_0x148f89,'enterAt':moment()['format'](_0xe434('0xf0')),'role':_0x3b12c8[_0xe434('0x44')],'internal':_0x3b12c8['internal']};_0x4b2047[_0xe434('0xef')](function(_0x2140d7){_0x3a9f03[_0xe434('0xb2')](_['merge']({'channel':_0x2140d7,'type':_0xe434('0xf2'),'data1':_0x94dcdf[_0xe434('0x6c')][_0xe434('0xf3')],'data2':_0x148f89},_0x35b03c));if(_0x3b12c8[_0xe434('0xa3')]){_0x49494f[_0xe434('0xb2')](_[_0xe434('0x61')]({'channel':_0x2140d7,'type':_0xe434('0xf4'),'data1':_0xe434('0xf5')},_0x35b03c));}});return db[_0xe434('0xf6')][_0xe434('0x6b')](_0x3a9f03[_0xe434('0xf7')](_0x49494f),{'individualHooks':!![]});}})['then'](function(){if(_0x3b12c8){return _0x3b12c8[_0xe434('0x38')]({'online':!![],'lastLoginAt':moment()[_0xe434('0x76')](_0xe434('0xf0')),'voicePause':_0x3b12c8[_0xe434('0xa3')]||![],'mailPause':_0x3b12c8['loginInPause']||![],'chatPause':_0x3b12c8['loginInPause']||![],'faxPause':_0x3b12c8[_0xe434('0xa3')]||![],'smsPause':_0x3b12c8[_0xe434('0xa3')]||![],'openchannelPause':_0x3b12c8[_0xe434('0xa3')]||![],'whatsappPause':_0x3b12c8[_0xe434('0xa3')]||![],'pauseType':_0x3b12c8[_0xe434('0xa3')]?_0xe434('0xf5'):null,'interface':_0x148f89,'lastPauseAt':moment()[_0xe434('0x76')](_0xe434('0xf0'))});}})['then'](function(_0x4d5625){if(_0x94dcdf[_0xe434('0xf8')]){return _0x4df1cb();}else{return BPromise[_0xe434('0xf9')](_0x4d5625)[_0xe434('0x23')](respondWithResult(_0x5b9562,null));}})[_0xe434('0x2d')](handleError(_0x5b9562,null));};exports[_0xe434('0xfa')]=function(_0x50ff7a,_0x56d96e,_0x4e5290){var _0x12afba;return db[_0xe434('0x63')][_0xe434('0x45')]({'where':{'id':_0x50ff7a['params']['id'],'role':_0xe434('0x3c')},'attributes':['id','name','role']})[_0xe434('0x23')](handleEntityNotFound(_0x56d96e,null))[_0xe434('0x23')](function(_0x48d0c5){if(_0x48d0c5){_0x12afba=_0x48d0c5;return db[_0xe434('0xb5')][_0xe434('0x46')]({'where':{'membername':_0x12afba['name']},'individualHooks':!![]});}})['then'](function(){return db[_0xe434('0xf6')][_0xe434('0x66')]({'where':{'membername':_0x12afba['name'],'exitAt':null}});})[_0xe434('0x23')](function(_0x5eb406){var _0x4d3b3d=[];_0x5eb406[_0xe434('0xef')](function(_0x2e4f54){_0x4d3b3d[_0xe434('0xb2')](_0x2e4f54['update']({'exitAt':moment()[_0xe434('0x76')](_0xe434('0xf0'))}));});return BPromise[_0xe434('0xfb')](_0x4d3b3d);})[_0xe434('0x23')](function(){return _0x12afba[_0xe434('0x38')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe434('0x23')](respondWithResult(_0x56d96e,null))[_0xe434('0x2d')](handleError(_0x56d96e,null));};exports['pause']=function(_0x58aefa,_0x4d3e50,_0x447e16){var _0x95e289;return db[_0xe434('0xb5')][_0xe434('0x38')]({'paused':0x1},{'where':{'UserId':_0x58aefa['params']['id']},'individualHooks':!![]})[_0xe434('0x23')](function(){return db['User']['find']({'where':{'id':_0x58aefa['params']['id'],'role':_0xe434('0x3c')},'attributes':['id',_0xe434('0x49'),_0xe434('0x44'),'internal',_0xe434('0xa4')]});})[_0xe434('0x23')](handleEntityNotFound(_0x4d3e50,null))[_0xe434('0x23')](function(_0x58ea2c){if(_0x58ea2c){_0x95e289=_0x58ea2c;return respondWithRpcPromise(_0xe434('0xfc'),_0xe434('0xfd'),{'id':_0x95e289['id'],'name':_0x95e289[_0xe434('0x49')],'pause':!![]});}})[_0xe434('0x23')](function(){if(_0x95e289){return db[_0xe434('0xf6')][_0xe434('0x66')]({'where':{'membername':_0x95e289[_0xe434('0x49')],'type':_0xe434('0xf4'),'exitAt':null}});}})[_0xe434('0x23')](function(_0x31c222){if(_0x31c222['length']){var _0x33e3ec=moment()[_0xe434('0x76')](_0xe434('0xf0'));for(var _0x1f77bd=0x0,_0x4cfb00=_0x31c222['length'];_0x1f77bd<_0x4cfb00;_0x1f77bd++){_0x31c222[_0x1f77bd][_0xe434('0xfe')]({'exitAt':_0x33e3ec});}}})[_0xe434('0x23')](function(){var _0x52f24b=[];var _0x4320f4=utils[_0xe434('0xf1')]();_0x4320f4[_0xe434('0xef')](function(_0xc345b2){_0x52f24b[_0xe434('0xb2')]({'channel':_0xc345b2,'membername':_0x95e289['name'],'interface':_[_0xe434('0x7f')](_0x95e289[_0xe434('0xa4')])?util[_0xe434('0x76')](_0xe434('0xb3'),_0x95e289[_0xe434('0x49')]):_0x95e289[_0xe434('0xa4')],'type':_0xe434('0xf4'),'enterAt':moment()[_0xe434('0x76')](_0xe434('0xf0')),'data1':_0x58aefa[_0xe434('0x6c')][_0xe434('0x5d')]||'DEFAULT\x20PAUSE','role':_0x95e289[_0xe434('0x44')],'internal':_0x95e289['internal']});});return db[_0xe434('0xf6')][_0xe434('0x6b')](_0x52f24b,{'individualHooks':!![]});})['then'](function(){return _0x95e289[_0xe434('0x38')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x58aefa[_0xe434('0x6c')][_0xe434('0x5d')]||_0xe434('0xff'),'lastPauseAt':moment()[_0xe434('0x76')](_0xe434('0xf0'))});})[_0xe434('0x23')](respondWithResult(_0x4d3e50,null))[_0xe434('0x2d')](handleError(_0x4d3e50,null));};exports['unpause']=function(_0x4a7b59,_0x1f1ba9,_0xdbaf5){var _0x14a868;return db[_0xe434('0x63')]['find']({'where':{'id':_0x4a7b59['params']['id']},'attributes':['id','name',_0xe434('0x44'),_0xe434('0x100'),_0xe434('0x101'),_0xe434('0x102'),_0xe434('0x103'),'openchannelPause','smsPause',_0xe434('0x104'),_0xe434('0x105'),'lastPauseAt']})[_0xe434('0x23')](handleEntityNotFound(_0x1f1ba9,null))['then'](function(_0x46dee7){if(_0x46dee7){_0x14a868=_0x46dee7;if(_0x4a7b59[_0xe434('0x6c')][_0xe434('0xa2')]&&!utils[_0xe434('0xa5')](_0x4a7b59['body'][_0xe434('0xa2')])){throw new db[(_0xe434('0x1f'))][(_0xe434('0x20'))](_0xe434('0xa6'));}switch(_0x4a7b59[_0xe434('0x6c')]['channel']){case _0xe434('0xb0'):return respondWithRpcPromise(_0xe434('0xfc'),_0xe434('0x106'),{'id':_0x14a868['id'],'name':_0x14a868['name'],'pause':![]})['then'](function(){return db[_0xe434('0xb5')][_0xe434('0x38')]({'paused':0x0},{'where':{'UserId':_0x14a868['id']},'individualHooks':!![]});})[_0xe434('0x23')](function(){return db[_0xe434('0xf6')][_0xe434('0x45')]({'where':{'channel':_0x4a7b59[_0xe434('0x6c')][_0xe434('0xa2')],'membername':_0x14a868[_0xe434('0x49')],'type':_0xe434('0xf4'),'exitAt':null}});})[_0xe434('0x23')](function(_0x55dcae){if(_0x55dcae){return _0x55dcae[_0xe434('0x38')]({'exitAt':moment()[_0xe434('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xe434('0x107')},{'individualHooks':!![]});}return null;})[_0xe434('0x23')](function(){return _0x14a868['update']({'voicePause':![]});});case _0xe434('0x108'):case'chat':case _0xe434('0x109'):case _0xe434('0x10a'):case _0xe434('0x10b'):case _0xe434('0x10c'):return db[_0xe434('0xf6')][_0xe434('0x45')]({'where':{'channel':_0x4a7b59['body'][_0xe434('0xa2')],'membername':_0x14a868['name'],'type':_0xe434('0xf4'),'exitAt':null}})[_0xe434('0x23')](function(_0x6afc0e){if(_0x6afc0e){return _0x6afc0e['update']({'exitAt':moment()[_0xe434('0x76')](_0xe434('0xf0')),'data2':_0xe434('0x107')},{'individualHooks':!![]});}return null;})[_0xe434('0x23')](function(){var _0x5c42fd={};_[_0xe434('0x33')](_0x5c42fd,util['format'](_0xe434('0x10d'),_0x4a7b59[_0xe434('0x6c')][_0xe434('0xa2')],_0xe434('0x10e')),![]);return _0x14a868[_0xe434('0x38')](_0x5c42fd);});default:return respondWithRpcPromise('QueuePause',_0xe434('0x106'),{'id':_0x14a868['id'],'name':_0x14a868['name'],'pause':![]})[_0xe434('0x23')](function(){return db[_0xe434('0xb5')]['update']({'paused':0x0},{'where':{'UserId':_0x14a868['id']}});})[_0xe434('0x23')](function(){return db['MemberReport'][_0xe434('0x66')]({'where':{'membername':_0x14a868[_0xe434('0x49')],'type':_0xe434('0xf4'),'exitAt':null}});})['then'](function(_0x1bada4){var _0x1c65a7=[];_0x1bada4[_0xe434('0xef')](function(_0x14b05a){_0x1c65a7['push'](_0x14b05a[_0xe434('0x38')]({'exitAt':moment()[_0xe434('0x76')](_0xe434('0xf0')),'data2':_0xe434('0x107')}));});return BPromise[_0xe434('0xfb')](_0x1c65a7);})[_0xe434('0x23')](function(){return _0x14a868[_0xe434('0x38')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1f1ba9,null))[_0xe434('0x2d')](handleError(_0x1f1ba9,null));};exports['getTeams']=function(_0x4b7dc2,_0x40a924,_0x9891ec){var _0x58bef8={};var _0x3f2d68={};var _0xf7e00e;var _0x6603b4;return db[_0xe434('0x63')][_0xe434('0x99')]({'where':{'id':_0x4b7dc2[_0xe434('0x6d')]['id']}})['then'](handleEntityNotFound(_0x40a924,null))[_0xe434('0x23')](function(_0x198363){if(_0x198363){_0xf7e00e=_0x198363;_0x3f2d68['model']=_[_0xe434('0x69')](db[_0xe434('0x10f')][_0xe434('0x4c')]);_0x3f2d68[_0xe434('0x50')]=_[_0xe434('0x69')](_0x4b7dc2[_0xe434('0x50')]);_0x3f2d68[_0xe434('0x51')]=_[_0xe434('0x52')](_0x3f2d68[_0xe434('0x53')],_0x3f2d68[_0xe434('0x50')]);_0x58bef8[_0xe434('0x54')]=_[_0xe434('0x52')](_0x3f2d68[_0xe434('0x53')],qs[_0xe434('0x55')](_0x4b7dc2['query'][_0xe434('0x55')]));_0x58bef8[_0xe434('0x54')]=_0x58bef8['attributes'][_0xe434('0x56')]?_0x58bef8[_0xe434('0x54')]:_0x3f2d68[_0xe434('0x53')];_0x58bef8[_0xe434('0x59')]=qs['sort'](_0x4b7dc2[_0xe434('0x50')][_0xe434('0x5a')]);_0x58bef8[_0xe434('0x5b')]=qs[_0xe434('0x51')](_[_0xe434('0x5c')](_0x4b7dc2['query'],_0x3f2d68[_0xe434('0x51')]));if(_0x4b7dc2['query'][_0xe434('0x3f')]){_0x58bef8[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x58bef8[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x58bef8[_0xe434('0x54')],function(_0x2058a6){var _0x3687dd={};_0x3687dd[_0x2058a6]={'$like':'%'+_0x4b7dc2['query'][_0xe434('0x3f')]+'%'};return _0x3687dd;})});}_0x58bef8=_['merge']({},_0x58bef8,_0x4b7dc2[_0xe434('0x62')]);return _0xf7e00e['getTeams'](_0x58bef8);}})['then'](function(_0x24d706){if(_0x24d706){_0x6603b4=_0x24d706[_0xe434('0x56')];if(!_0x4b7dc2[_0xe434('0x50')]['hasOwnProperty'](_0xe434('0x58'))){_0x58bef8[_0xe434('0x32')]=qs['limit'](_0x4b7dc2['query'][_0xe434('0x32')]);_0x58bef8[_0xe434('0x31')]=qs[_0xe434('0x31')](_0x4b7dc2[_0xe434('0x50')][_0xe434('0x31')]);}return _0xf7e00e[_0xe434('0x110')](_0x58bef8);}})['then'](function(_0x50111b){if(_0x50111b){return _0x50111b?{'count':_0x6603b4,'rows':_0x50111b}:null;}})[_0xe434('0x23')](respondWithResult(_0x40a924,null))[_0xe434('0x2d')](handleError(_0x40a924,null));};exports['addTeams']=function(_0x4d8aa4,_0x57aaea){return db['User'][_0xe434('0x45')]({'where':{'id':_0x4d8aa4[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x57aaea,null))[_0xe434('0x23')](function(_0x3075ac){if(_0x3075ac){var _0x5441bd=_0x3075ac[_0xe434('0x91')]({'plain':!![]});return _0x3075ac[_0xe434('0x111')](_0x4d8aa4['body']['ids'],_[_0xe434('0x112')](_0x4d8aa4[_0xe434('0x6c')],[_0xe434('0x70'),'id'])||{})[_0xe434('0x23')](function(){for(var _0x23b882=0x0;_0x23b882<_0x4d8aa4['body'][_0xe434('0x70')][_0xe434('0x56')];_0x23b882++){var _0x4eb13c=[];db[_0xe434('0x10f')][_0xe434('0x99')]({'where':{'id':_0x4d8aa4[_0xe434('0x6c')]['ids'][_0x23b882]}})[_0xe434('0x23')](function(_0x1c5fd0){_0x4eb13c[_0xe434('0xb2')](_0x1c5fd0[_0xe434('0xed')]()[_0xe434('0x23')](function(_0x306e57){for(var _0x276800=0x0;_0x276800<_0x306e57[_0xe434('0x56')];_0x276800++){_0x306e57[_0x276800][_0xe434('0x113')]('channel',_0xe434('0x114'));}return _0x306e57;}));_0x4eb13c[_0xe434('0xb2')](_0x1c5fd0[_0xe434('0x115')]()['then'](function(_0x33dac6){for(var _0x3ebd4c=0x0;_0x3ebd4c<_0x33dac6['length'];_0x3ebd4c++){_0x33dac6[_0x3ebd4c]['setDataValue'](_0xe434('0xa2'),_0xe434('0x116'));}return _0x33dac6;}));_0x4eb13c[_0xe434('0xb2')](_0x1c5fd0['getMailQueues']()['then'](function(_0x4acec9){for(var _0x12a254=0x0;_0x12a254<_0x4acec9[_0xe434('0x56')];_0x12a254++){_0x4acec9[_0x12a254][_0xe434('0x113')](_0xe434('0xa2'),'Mail');}return _0x4acec9;}));_0x4eb13c[_0xe434('0xb2')](_0x1c5fd0[_0xe434('0x117')]()['then'](function(_0xc062e7){for(var _0x2fb151=0x0;_0x2fb151<_0xc062e7[_0xe434('0x56')];_0x2fb151++){_0xc062e7[_0x2fb151][_0xe434('0x113')](_0xe434('0xa2'),'Sms');}return _0xc062e7;}));_0x4eb13c['push'](_0x1c5fd0[_0xe434('0x118')]()['then'](function(_0x5e146a){for(var _0x3af542=0x0;_0x3af542<_0x5e146a[_0xe434('0x56')];_0x3af542++){_0x5e146a[_0x3af542][_0xe434('0x113')](_0xe434('0xa2'),_0xe434('0x119'));}return _0x5e146a;}));_0x4eb13c['push'](_0x1c5fd0[_0xe434('0x11a')]()[_0xe434('0x23')](function(_0x3dfdab){for(var _0xde0ba6=0x0;_0xde0ba6<_0x3dfdab['length'];_0xde0ba6++){_0x3dfdab[_0xde0ba6][_0xe434('0x113')](_0xe434('0xa2'),'Fax');}return _0x3dfdab;}));_0x4eb13c['push'](_0x1c5fd0[_0xe434('0x11b')]()[_0xe434('0x23')](function(_0x2e0a89){for(var _0x2856fb=0x0;_0x2856fb<_0x2e0a89[_0xe434('0x56')];_0x2856fb++){_0x2e0a89[_0x2856fb]['setDataValue'](_0xe434('0xa2'),'Openchannel');}return _0x2e0a89;}));return BPromise[_0xe434('0xfb')](_0x4eb13c);})[_0xe434('0x23')](function(_0x1d6e04){var _0x11deca=_[_0xe434('0x11c')](_0x1d6e04);_0x4eb13c=[];return db[_0xe434('0x5f')][_0xe434('0x11d')](function(_0x802bfc){for(var _0x59e57e=0x0;_0x59e57e<_0x11deca[_0xe434('0x56')];_0x59e57e++){_0x4eb13c['push'](_0x11deca[_0x59e57e]['addAgent'](_0x5441bd['id']),{'transaction':_0x802bfc});}return BPromise[_0xe434('0xfb')](_0x4eb13c)[_0xe434('0x23')](function(){if(_0x5441bd[_0xe434('0xb1')]){return BPromise[_0xe434('0xb4')](_[_0xe434('0x3f')](_0x11deca,function(_0x5725d3){return _0x5725d3[_0xe434('0x11e')](_0xe434('0xa2'))===_0xe434('0x114');}),function(_0x1cbdd4){return db['UserVoiceQueueRt'][_0xe434('0xb6')]({'membername':_0x5441bd[_0xe434('0x49')],'UserId':_0x5441bd['id'],'queue_name':_0x1cbdd4[_0xe434('0x49')],'VoiceQueueId':_0x1cbdd4['id'],'interface':_[_0xe434('0x7f')](_0x5441bd[_0xe434('0xa4')])?util[_0xe434('0x76')]('SIP/%s',_0x5441bd[_0xe434('0x49')]):_0x5441bd[_0xe434('0xa4')],'paused':_0x5441bd[_0xe434('0x100')]||![],'penalty':_0x5441bd[_0xe434('0xab')]},{'transaction':_0x802bfc});});}else{return;}})[_0xe434('0x23')](function(){for(var _0x4ea980=0x0;_0x4ea980<_0x11deca['length'];_0x4ea980++){var _0x3e6b95=_0x11deca[_0x4ea980]['getDataValue'](_0xe434('0xa2'));var _0x3e0971=_0x3e6b95+_0xe434('0xad');socket[_0xe434('0xae')](_0xe434('0x3a')+_0x3e6b95+_0xe434('0xaf'),{'UserId':_0x5441bd['id'],['queueField']:_0x11deca[_0x4ea980]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x57aaea,null))['catch'](handleError(_0x57aaea,null));};exports[_0xe434('0x11f')]=function(_0x53dad4,_0x2e9dcf){return db[_0xe434('0x63')][_0xe434('0x99')]({'where':{'id':_0x53dad4[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x2e9dcf,null))[_0xe434('0x23')](function(_0x39b573){if(_0x39b573){var _0x2b9eba=_0x39b573[_0xe434('0x91')]({'plain':!![]});var _0x279fd9=_0x53dad4[_0xe434('0x50')]['ids'];return _0x39b573[_0xe434('0x11f')](_0x279fd9)[_0xe434('0x23')](function(){for(var _0x2cdb34=0x0;_0x2cdb34<_0x279fd9['length'];_0x2cdb34++){var _0x136069=[];db[_0xe434('0x10f')][_0xe434('0x99')]({'where':{'id':_0x279fd9[_0x2cdb34]}})['then'](function(_0x34a1d8){_0x136069['push'](_0x34a1d8[_0xe434('0xed')]()[_0xe434('0x23')](function(_0x40a561){for(var _0x3725fe=0x0;_0x3725fe<_0x40a561[_0xe434('0x56')];_0x3725fe++){_0x40a561[_0x3725fe][_0xe434('0x113')](_0xe434('0xa2'),_0xe434('0x114'));}return _0x40a561;}));_0x136069[_0xe434('0xb2')](_0x34a1d8[_0xe434('0x115')]()[_0xe434('0x23')](function(_0x5bca78){for(var _0x1b5271=0x0;_0x1b5271<_0x5bca78[_0xe434('0x56')];_0x1b5271++){_0x5bca78[_0x1b5271]['setDataValue']('channel','Chat');}return _0x5bca78;}));_0x136069[_0xe434('0xb2')](_0x34a1d8[_0xe434('0x120')]()[_0xe434('0x23')](function(_0x3522f5){for(var _0x4bd6e0=0x0;_0x4bd6e0<_0x3522f5['length'];_0x4bd6e0++){_0x3522f5[_0x4bd6e0][_0xe434('0x113')](_0xe434('0xa2'),_0xe434('0x121'));}return _0x3522f5;}));_0x136069[_0xe434('0xb2')](_0x34a1d8[_0xe434('0x117')]()[_0xe434('0x23')](function(_0x3d2eea){for(var _0x5a7b42=0x0;_0x5a7b42<_0x3d2eea[_0xe434('0x56')];_0x5a7b42++){_0x3d2eea[_0x5a7b42][_0xe434('0x113')]('channel',_0xe434('0x122'));}return _0x3d2eea;}));_0x136069['push'](_0x34a1d8['getWhatsappQueues']()[_0xe434('0x23')](function(_0x464bc6){for(var _0x13aee8=0x0;_0x13aee8<_0x464bc6['length'];_0x13aee8++){_0x464bc6[_0x13aee8][_0xe434('0x113')]('channel',_0xe434('0x119'));}return _0x464bc6;}));_0x136069['push'](_0x34a1d8[_0xe434('0x11a')]()[_0xe434('0x23')](function(_0x1ebb3b){for(var _0x5baeb7=0x0;_0x5baeb7<_0x1ebb3b[_0xe434('0x56')];_0x5baeb7++){_0x1ebb3b[_0x5baeb7]['setDataValue'](_0xe434('0xa2'),_0xe434('0x123'));}return _0x1ebb3b;}));_0x136069[_0xe434('0xb2')](_0x34a1d8[_0xe434('0x11b')]()[_0xe434('0x23')](function(_0x18ad0a){for(var _0xe8817=0x0;_0xe8817<_0x18ad0a[_0xe434('0x56')];_0xe8817++){_0x18ad0a[_0xe8817]['setDataValue'](_0xe434('0xa2'),_0xe434('0x124'));}return _0x18ad0a;}));return BPromise['all'](_0x136069);})[_0xe434('0x23')](function(_0xaa70ec){var _0x249606=_['flatten'](_0xaa70ec);_0x136069=[];return db['sequelize']['transaction'](function(_0x4d00ec){for(var _0x497fa8=0x0;_0x497fa8<_0x249606[_0xe434('0x56')];_0x497fa8++){_0x136069['push'](_0x249606[_0x497fa8]['removeAgent'](_0x2b9eba['id']),{'transaction':_0x4d00ec});}return BPromise[_0xe434('0xfb')](_0x136069)[_0xe434('0x23')](function(){if(_0x2b9eba[_0xe434('0xb1')]){return BPromise[_0xe434('0xb4')](_[_0xe434('0x3f')](_0x249606,function(_0x4eced9){return _0x4eced9[_0xe434('0x11e')](_0xe434('0xa2'))===_0xe434('0x114');}),function(_0x58301f){return db[_0xe434('0xb5')][_0xe434('0x46')]({'where':{'VoiceQueueId':_0x58301f['id'],'UserId':_0x2b9eba['id']},'transaction':_0x4d00ec});});}else{return;}})[_0xe434('0x23')](function(){for(var _0xa72f10=0x0;_0xa72f10<_0x249606['length'];_0xa72f10++){var _0x686176=_0x249606[_0xa72f10][_0xe434('0x11e')](_0xe434('0xa2'));var _0x13882e=_0x686176+_0xe434('0xad');socket[_0xe434('0xae')](_0xe434('0x3a')+_0x686176+_0xe434('0xb9'),{'UserId':_0x2b9eba['id'],['queueField']:_0x249606[_0xa72f10]['id']});}});});});}});}})[_0xe434('0x23')](respondWithStatusCode(_0x2e9dcf,null))['catch'](handleError(_0x2e9dcf,null));};exports[_0xe434('0x125')]=function(_0xb1c1bb,_0x43060b,_0x52eea1){var _0x5b3072={};var _0x3f319c={};var _0x2ae699;var _0x41471f;return db[_0xe434('0x63')][_0xe434('0x99')]({'where':{'id':_0xb1c1bb[_0xe434('0x6d')]['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x43060b,null))[_0xe434('0x23')](function(_0xbb6a96){if(_0xbb6a96){_0x2ae699=_0xbb6a96;_0x3f319c[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0xc5')][_0xe434('0x4c')]);_0x3f319c[_0xe434('0x50')]=_[_0xe434('0x69')](_0xb1c1bb['query']);_0x3f319c[_0xe434('0x51')]=_['intersection'](_0x3f319c[_0xe434('0x53')],_0x3f319c[_0xe434('0x50')]);_0x5b3072[_0xe434('0x54')]=_[_0xe434('0x52')](_0x3f319c['model'],qs['fields'](_0xb1c1bb[_0xe434('0x50')][_0xe434('0x55')]));_0x5b3072['attributes']=_0x5b3072[_0xe434('0x54')][_0xe434('0x56')]?_0x5b3072[_0xe434('0x54')]:_0x3f319c['model'];_0x5b3072[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0xb1c1bb[_0xe434('0x50')][_0xe434('0x5a')]);_0x5b3072[_0xe434('0x5b')]=qs[_0xe434('0x51')](_[_0xe434('0x5c')](_0xb1c1bb[_0xe434('0x50')],_0x3f319c[_0xe434('0x51')]));if(_0xb1c1bb[_0xe434('0x50')]['filter']){_0x5b3072['where']=_['merge'](_0x5b3072['where'],{'$or':_[_0xe434('0x41')](_0x5b3072[_0xe434('0x54')],function(_0x2130ae){var _0x23549c={};_0x23549c[_0x2130ae]={'$like':'%'+_0xb1c1bb['query'][_0xe434('0x3f')]+'%'};return _0x23549c;})});}_0x5b3072=_[_0xe434('0x61')]({},_0x5b3072,_0xb1c1bb['options']);return _0x2ae699['getLists'](_0x5b3072);}})[_0xe434('0x23')](function(_0x28d446){if(_0x28d446){_0x41471f=_0x28d446[_0xe434('0x56')];if(!_0xb1c1bb[_0xe434('0x50')][_0xe434('0x57')]('nolimit')){_0x5b3072[_0xe434('0x32')]=qs['limit'](_0xb1c1bb[_0xe434('0x50')]['limit']);_0x5b3072['offset']=qs[_0xe434('0x31')](_0xb1c1bb[_0xe434('0x50')][_0xe434('0x31')]);}return _0x2ae699[_0xe434('0x125')](_0x5b3072);}})[_0xe434('0x23')](function(_0x2a1eea){if(_0x2a1eea){return _0x2a1eea?{'count':_0x41471f,'rows':_0x2a1eea}:null;}})[_0xe434('0x23')](respondWithResult(_0x43060b,null))[_0xe434('0x2d')](handleError(_0x43060b,null));};exports[_0xe434('0x126')]=function(_0x3a813d,_0x3f72cc,_0x3350e3){var _0x3f3e8f={};var _0x16bd37={};var _0x258e59;var _0x15d00a;return db['User'][_0xe434('0x99')]({'where':{'id':_0x3a813d['params']['id']}})[_0xe434('0x23')](handleEntityNotFound(_0x3f72cc,null))['then'](function(_0x4f0d53){if(_0x4f0d53){_0x258e59=_0x4f0d53;_0x16bd37[_0xe434('0x53')]=_[_0xe434('0x69')](db[_0xe434('0x63')][_0xe434('0x4c')]);_0x16bd37['query']=_[_0xe434('0x69')](_0x3a813d[_0xe434('0x50')]);_0x16bd37['filters']=_[_0xe434('0x52')](_0x16bd37['model'],_0x16bd37[_0xe434('0x50')]);_0x3f3e8f[_0xe434('0x54')]=_['intersection'](_0x16bd37[_0xe434('0x53')],qs[_0xe434('0x55')](_0x3a813d[_0xe434('0x50')][_0xe434('0x55')]));_0x3f3e8f['attributes']=_0x3f3e8f[_0xe434('0x54')][_0xe434('0x56')]?_0x3f3e8f[_0xe434('0x54')]:_0x16bd37['model'];_0x3f3e8f[_0xe434('0x59')]=qs[_0xe434('0x5a')](_0x3a813d[_0xe434('0x50')][_0xe434('0x5a')]);_0x3f3e8f['where']=qs[_0xe434('0x51')](_[_0xe434('0x5c')](_0x3a813d[_0xe434('0x50')],_0x16bd37[_0xe434('0x51')]));if(_0x3a813d['query'][_0xe434('0x3f')]){_0x3f3e8f[_0xe434('0x5b')]=_[_0xe434('0x61')](_0x3f3e8f[_0xe434('0x5b')],{'$or':_[_0xe434('0x41')](_0x3f3e8f[_0xe434('0x54')],function(_0x49b9d4){var _0x313058={};_0x313058[_0x49b9d4]={'$like':'%'+_0x3a813d['query'][_0xe434('0x3f')]+'%'};return _0x313058;})});}_0x3f3e8f[_0xe434('0x53')]=db['User'];_0x3f3e8f['as']='Agents';_0x3f3e8f=_[_0xe434('0x61')]({},_0x3f3e8f,_0x3a813d[_0xe434('0x62')]);return _0x258e59[_0xe434('0xed')]({'include':[_0x3f3e8f]});}})[_0xe434('0x23')](function(_0xc24212){if(_0xc24212){var _0x339761={},_0x3bc7f1=[],_0x20bd1a=0x0;for(var _0x15ca38=0x0;_0x15ca38<_0xc24212[_0xe434('0x56')];_0x15ca38+=0x1){for(var _0x23c6c9=0x0,_0xff94df;_0x23c6c9<_0xc24212[_0x15ca38][_0xe434('0x3b')]['length'];_0x23c6c9+=0x1){_0xff94df=_0xc24212[_0x15ca38][_0xe434('0x3b')][_0x23c6c9][_0xe434('0x91')]({'plain':!![]});_0x339761[_0xff94df['id']]=_0xff94df;}}_0x339761=_[_0xe434('0x127')](_0x339761);for(var _0x278f2b=qs[_0xe434('0x31')](_0x3a813d[_0xe434('0x50')]['offset']);_0x278f2b<_0x339761['length']&&_0x3bc7f1[_0xe434('0x56')]=_0x357752[_0xf1fd('0x4f')]){throw new Error(_0xf1fd('0x50'));}})[_0xf1fd('0x10')](function(){if(_0x118160){return db[_0xf1fd('0x3f')]['destroy']({'where':{'membername':_0x118160['name']},'individualHooks':!![]});}})['then'](function(){if(_0x118160){return _0x118160[_0xf1fd('0x51')]({'raw':!![]});}})['then'](function(_0xc560f3){if(_0x118160){if(_0xc560f3){var _0x16a388=[];_0x81e683=_0xc560f3;if(_0x81e683[_0xf1fd('0x28')]){for(var _0x28e4aa=0x0;_0x28e4aa<_0x81e683['length'];_0x28e4aa++){_0x16a388['push'](db[_0xf1fd('0x3f')][_0xf1fd('0x52')]({'membername':_0x118160['name'],'UserId':_0x118160['id'],'queue_name':_0x81e683[_0x28e4aa][_0xf1fd('0x27')],'VoiceQueueId':_0x81e683[_0x28e4aa]['id'],'interface':_0x38fac2,'paused':_0x118160[_0xf1fd('0x4b')]||![],'penalty':_0x81e683[_0x28e4aa][_0xf1fd('0x53')]||0x0}));}return BPromise[_0xf1fd('0x46')](_0x16a388);}}}})[_0xf1fd('0x10')](function(){if(_0x118160){return db['MemberReport'][_0xf1fd('0x1d')]({'where':{'membername':_0x118160[_0xf1fd('0x27')],'exitAt':null}});}})[_0xf1fd('0x10')](function(_0x4ddaf5){if(_0x118160){if(_0x4ddaf5&&_0x4ddaf5['length']){var _0x1a271b=[];_0x4ddaf5['forEach'](function(_0x2d9dde){_0x1a271b[_0xf1fd('0x2c')](_0x2d9dde[_0xf1fd('0x3a')]({'exitAt':moment()[_0xf1fd('0x31')](_0xf1fd('0x29'))}));});return BPromise[_0xf1fd('0x46')](_0x1a271b);}}})[_0xf1fd('0x10')](function(_0x5f5c6b){if(_0x118160){var _0x44e6aa=[];var _0x1a1abf=[];var _0x1603ac=utils[_0xf1fd('0x2b')]();var _0x3f8f64={'membername':_0x118160[_0xf1fd('0x27')],'interface':_0x38fac2,'enterAt':moment()[_0xf1fd('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x118160[_0xf1fd('0x35')],'internal':_0x118160[_0xf1fd('0x36')]};_0x1603ac['forEach'](function(_0x176cc1){_0x44e6aa[_0xf1fd('0x2c')](_[_0xf1fd('0x54')]({'channel':_0x176cc1,'type':_0xf1fd('0x55'),'data1':_0xf1fd('0x56'),'data2':_0x38fac2},_0x3f8f64));if(_0x118160[_0xf1fd('0x4b')]){_0x1a1abf[_0xf1fd('0x2c')](_[_0xf1fd('0x54')]({'channel':_0x176cc1,'type':'PAUSE','data1':'LOGININPAUSE'},_0x3f8f64));}});return db[_0xf1fd('0x38')][_0xf1fd('0x39')](_0x44e6aa[_0xf1fd('0x57')](_0x1a1abf),{'individualHooks':!![]});}})['then'](function(){if(_0x118160){return _0x118160[_0xf1fd('0x3a')]({'online':!![],'lastLoginAt':moment()[_0xf1fd('0x31')](_0xf1fd('0x29')),'voicePause':_0x118160[_0xf1fd('0x4b')]||![],'mailPause':_0x118160[_0xf1fd('0x4b')]||![],'chatPause':_0x118160[_0xf1fd('0x4b')]||![],'faxPause':_0x118160['loginInPause']||![],'smsPause':_0x118160[_0xf1fd('0x4b')]||![],'openchannelPause':_0x118160[_0xf1fd('0x4b')]||![],'pauseType':_0x118160[_0xf1fd('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xf1fd('0x31')](_0xf1fd('0x29')),'interface':_0x38fac2});}})['then'](function(_0x551da6){_0x17036e(_0x551da6);})[_0xf1fd('0x1a')](function(_0x26bb36){_0x301290(_0x4eff7d[_0xf1fd('0x16')](0x1f4,_0x26bb36[_0xf1fd('0x18')]));});});}; \ No newline at end of file +var _0x12ab=['destroy','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','all','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetUser','User','findAll','options','raw','where','attributes','include','map','model','ShowUser','find','PauseUser','role','internal','interface','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','channel','isValidChannel','Unknown\x20channel','voice','system','fax','openchannel','set','%s%s','Pause','LogoutUser'];(function(_0x515b5f,_0x4508e1){var _0x4eaed1=function(_0x23cc0f){while(--_0x23cc0f){_0x515b5f['push'](_0x515b5f['shift']());}};_0x4eaed1(++_0x4508e1);}(_0x12ab,0x70));var _0xb12a=function(_0x2d0add,_0x1d7b86){_0x2d0add=_0x2d0add-0x0;var _0x1e27af=_0x12ab[_0x2d0add];return _0x1e27af;};'use strict';var _=require(_0xb12a('0x0'));var util=require(_0xb12a('0x1'));var moment=require('moment');var BPromise=require(_0xb12a('0x2'));var rs=require(_0xb12a('0x3'));var fs=require('fs');var Redis=require(_0xb12a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb12a('0x5'));var logger=require(_0xb12a('0x6'))(_0xb12a('0x7'));var config=require(_0xb12a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb12a('0x9')][_0xb12a('0xa')]({'port':0x232a});config[_0xb12a('0xb')]=_[_0xb12a('0xc')](config['redis'],{'host':_0xb12a('0xd'),'port':0x18eb});var socket=require(_0xb12a('0xe'))(new Redis(config[_0xb12a('0xb')]));require(_0xb12a('0xf'))[_0xb12a('0x10')](socket);function respondWithRpcPromise(_0x235909,_0x47aa25,_0x3f6fde){return new BPromise(function(_0x47e540,_0x28750f){return client[_0xb12a('0x11')](_0x235909,_0x3f6fde)[_0xb12a('0x12')](function(_0x329ee0){logger[_0xb12a('0x13')](_0xb12a('0x14'),_0x47aa25,_0xb12a('0x15'));logger[_0xb12a('0x16')](_0xb12a('0x17'),_0x47aa25,_0xb12a('0x15'),JSON[_0xb12a('0x18')](_0x329ee0));if(_0x329ee0[_0xb12a('0x19')]){if(_0x329ee0[_0xb12a('0x19')]['code']===0x1f4){logger[_0xb12a('0x19')](_0xb12a('0x14'),_0x47aa25,_0x329ee0[_0xb12a('0x19')]['message']);return _0x28750f(_0x329ee0[_0xb12a('0x19')]['message']);}logger['error'](_0xb12a('0x14'),_0x47aa25,_0x329ee0[_0xb12a('0x19')][_0xb12a('0x1a')]);return _0x47e540(_0x329ee0['error'][_0xb12a('0x1a')]);}else{logger[_0xb12a('0x13')]('User,\x20%s,\x20%s',_0x47aa25,'request\x20sent');_0x47e540(_0x329ee0[_0xb12a('0x1b')][_0xb12a('0x1a')]);}})[_0xb12a('0x1c')](function(_0x1ceccb){logger[_0xb12a('0x19')](_0xb12a('0x14'),_0x47aa25,_0x1ceccb);_0x28750f(_0x1ceccb);});});}exports[_0xb12a('0x1d')]=function(_0x3c1783){var _0x3e26b4=this;return new Promise(function(_0x2897c1,_0x1857e5){return db[_0xb12a('0x1e')][_0xb12a('0x1f')]({'raw':_0x3c1783[_0xb12a('0x20')]?_0x3c1783[_0xb12a('0x20')][_0xb12a('0x21')]===undefined?!![]:![]:!![],'where':_0x3c1783[_0xb12a('0x20')]?_0x3c1783[_0xb12a('0x20')][_0xb12a('0x22')]||null:null,'attributes':_0x3c1783[_0xb12a('0x20')]?_0x3c1783[_0xb12a('0x20')][_0xb12a('0x23')]||null:null,'limit':_0x3c1783[_0xb12a('0x20')]?_0x3c1783[_0xb12a('0x20')]['limit']||null:null,'include':_0x3c1783[_0xb12a('0x20')]?_0x3c1783[_0xb12a('0x20')][_0xb12a('0x24')]?_[_0xb12a('0x25')](_0x3c1783[_0xb12a('0x20')][_0xb12a('0x24')],function(_0x5cec5b){return{'model':db[_0x5cec5b['model']],'as':_0x5cec5b['as'],'attributes':_0x5cec5b[_0xb12a('0x23')],'include':_0x5cec5b[_0xb12a('0x24')]?_[_0xb12a('0x25')](_0x5cec5b[_0xb12a('0x24')],function(_0x4628ce){return{'model':db[_0x4628ce[_0xb12a('0x26')]],'as':_0x4628ce['as'],'attributes':_0x4628ce['attributes'],'include':_0x4628ce[_0xb12a('0x24')]?_[_0xb12a('0x25')](_0x4628ce[_0xb12a('0x24')],function(_0x55712a){return{'model':db[_0x55712a[_0xb12a('0x26')]],'as':_0x55712a['as'],'attributes':_0x55712a[_0xb12a('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb12a('0x12')](function(_0x242b40){logger['info'](_0xb12a('0x1d'),_0x3c1783);logger[_0xb12a('0x16')]('GetUser',_0x3c1783,JSON['stringify'](_0x242b40));_0x2897c1(_0x242b40);})['catch'](function(_0x2d3afd){logger['error'](_0xb12a('0x1d'),_0x2d3afd['message'],_0x3c1783);_0x1857e5(_0x3e26b4[_0xb12a('0x19')](0x1f4,_0x2d3afd[_0xb12a('0x1a')]));});});};exports[_0xb12a('0x27')]=function(_0x49c6fd){var _0x278bd6=this;return new Promise(function(_0x144999,_0x595f68){return db[_0xb12a('0x1e')][_0xb12a('0x28')]({'raw':_0x49c6fd[_0xb12a('0x20')]?_0x49c6fd[_0xb12a('0x20')][_0xb12a('0x21')]===undefined?!![]:![]:!![],'where':_0x49c6fd['options']?_0x49c6fd['options'][_0xb12a('0x22')]||null:null,'attributes':_0x49c6fd[_0xb12a('0x20')]?_0x49c6fd[_0xb12a('0x20')][_0xb12a('0x23')]||null:null,'include':_0x49c6fd['options']?_0x49c6fd[_0xb12a('0x20')][_0xb12a('0x24')]?_[_0xb12a('0x25')](_0x49c6fd[_0xb12a('0x20')][_0xb12a('0x24')],function(_0x4b7370){return{'model':db[_0x4b7370['model']],'as':_0x4b7370['as'],'attributes':_0x4b7370['attributes'],'include':_0x4b7370[_0xb12a('0x24')]?_[_0xb12a('0x25')](_0x4b7370['include'],function(_0x449637){return{'model':db[_0x449637[_0xb12a('0x26')]],'as':_0x449637['as'],'attributes':_0x449637[_0xb12a('0x23')],'include':_0x449637[_0xb12a('0x24')]?_[_0xb12a('0x25')](_0x449637[_0xb12a('0x24')],function(_0x5e45eb){return{'model':db[_0x5e45eb[_0xb12a('0x26')]],'as':_0x5e45eb['as'],'attributes':_0x5e45eb[_0xb12a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x544de9){logger[_0xb12a('0x13')](_0xb12a('0x27'),_0x49c6fd);logger['debug'](_0xb12a('0x27'),_0x49c6fd,JSON['stringify'](_0x544de9));_0x144999(_0x544de9);})['catch'](function(_0x4b7332){logger['error'](_0xb12a('0x27'),_0x4b7332['message'],_0x49c6fd);_0x595f68(_0x278bd6['error'](0x1f4,_0x4b7332[_0xb12a('0x1a')]));});});};exports[_0xb12a('0x29')]=function(_0x516cff){var _0x218c75=this;return new Promise(function(_0x3e8fa7,_0x427f6e){var _0x1a4f29;return db['User']['find']({'where':_0x516cff[_0xb12a('0x20')][_0xb12a('0x22')]||{},'attributes':['id','name',_0xb12a('0x2a'),_0xb12a('0x2b'),_0xb12a('0x2c')]})[_0xb12a('0x12')](function(_0x56d641){if(_0x56d641){_0x1a4f29=_0x56d641;return db[_0xb12a('0x2d')][_0xb12a('0x2e')]({'paused':0x1},{'where':{'UserId':_0x1a4f29['id']},'individualHooks':!![]});}})[_0xb12a('0x12')](function(){if(_0x1a4f29){return db[_0xb12a('0x2f')][_0xb12a('0x1f')]({'where':{'membername':_0x1a4f29[_0xb12a('0x30')],'type':_0xb12a('0x31'),'exitAt':null}});}})[_0xb12a('0x12')](function(_0x3db9a8){if(_0x1a4f29){if(_0x3db9a8&&_0x3db9a8[_0xb12a('0x32')]){var _0x22a079=moment()[_0xb12a('0x33')](_0xb12a('0x34'));for(var _0x1d8fb2=0x0,_0x2736f5=_0x3db9a8[_0xb12a('0x32')];_0x1d8fb2<_0x2736f5;_0x1d8fb2++){_0x3db9a8[_0x1d8fb2][_0xb12a('0x35')]({'exitAt':_0x22a079});}}}})[_0xb12a('0x12')](function(){if(_0x1a4f29){var _0x612b4=[];var _0xac34b6=utils[_0xb12a('0x36')]();_0xac34b6[_0xb12a('0x37')](function(_0x52373f){_0x612b4[_0xb12a('0x38')]({'channel':_0x52373f,'membername':_0x1a4f29[_0xb12a('0x30')],'interface':_[_0xb12a('0x39')](_0x1a4f29[_0xb12a('0x2c')])?util[_0xb12a('0x33')](_0xb12a('0x3a'),_0x1a4f29['name']):_0x1a4f29[_0xb12a('0x2c')],'type':'PAUSE','enterAt':moment()[_0xb12a('0x33')](_0xb12a('0x34')),'data1':_0x516cff[_0xb12a('0x3b')][_0xb12a('0x3c')]||_0xb12a('0x3d'),'role':_0x1a4f29[_0xb12a('0x2a')],'internal':_0x1a4f29[_0xb12a('0x2b')],'uniqueid':_0x516cff[_0xb12a('0x3b')][_0xb12a('0x3e')]||null});});return db[_0xb12a('0x2f')][_0xb12a('0x3f')](_0x612b4,{'individualHooks':!![]});}})['then'](function(){if(_0x1a4f29){return _0x1a4f29[_0xb12a('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x516cff[_0xb12a('0x3b')][_0xb12a('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xb12a('0x33')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xb12a('0x12')](function(_0x45b0bb){_0x3e8fa7(_0x45b0bb);})['catch'](function(_0x4b215b){_0x427f6e(_0x218c75[_0xb12a('0x19')](0x1f4,_0x4b215b['message']));});});};exports[_0xb12a('0x40')]=function(_0x96ecea){var _0x51fa27=this;return new Promise(function(_0x58db4d,_0x2047c4){var _0x1dabbc;return db[_0xb12a('0x1e')]['findOne']({'where':_0x96ecea[_0xb12a('0x20')]['where']||{},'attributes':['id',_0xb12a('0x30')]})[_0xb12a('0x12')](function(_0x5cedf9){if(_0x5cedf9){_0x1dabbc=_0x5cedf9;if(_0x96ecea[_0xb12a('0x3b')][_0xb12a('0x41')]&&!utils[_0xb12a('0x42')](_0x96ecea[_0xb12a('0x3b')][_0xb12a('0x41')])){throw new Error(_0xb12a('0x43'));}switch(_0x96ecea[_0xb12a('0x3b')][_0xb12a('0x41')]){case _0xb12a('0x44'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x1dabbc['id']}})[_0xb12a('0x12')](function(){return db['MemberReport']['find']({'where':{'channel':_0x96ecea['body'][_0xb12a('0x41')],'membername':_0x1dabbc[_0xb12a('0x30')],'type':'PAUSE','exitAt':null}});})[_0xb12a('0x12')](function(_0x900c00){if(_0x900c00){return _0x900c00[_0xb12a('0x2e')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xb12a('0x45')},{'individualHooks':!![]});}return null;})[_0xb12a('0x12')](function(){return _0x1dabbc[_0xb12a('0x2e')]({'voicePause':![]});});case'mail':case'chat':case _0xb12a('0x46'):case'sms':case _0xb12a('0x47'):return db[_0xb12a('0x2f')][_0xb12a('0x28')]({'where':{'channel':_0x96ecea['body'][_0xb12a('0x41')],'membername':_0x1dabbc[_0xb12a('0x30')],'type':'PAUSE','exitAt':null}})[_0xb12a('0x12')](function(_0x2e2751){return _0x2e2751[_0xb12a('0x2e')]({'exitAt':moment()[_0xb12a('0x33')](_0xb12a('0x34')),'data2':_0xb12a('0x45')},{'individualHooks':!![]});})[_0xb12a('0x12')](function(){var _0x2ef7a0={};_[_0xb12a('0x48')](_0x2ef7a0,util['format'](_0xb12a('0x49'),_0x96ecea[_0xb12a('0x3b')][_0xb12a('0x41')],_0xb12a('0x4a')),![]);return _0x1dabbc[_0xb12a('0x2e')](_0x2ef7a0);});default:return db[_0xb12a('0x2d')][_0xb12a('0x2e')]({'paused':0x0},{'where':{'UserId':_0x1dabbc['id']}})[_0xb12a('0x12')](function(){return db[_0xb12a('0x2f')]['findAll']({'where':{'membername':_0x1dabbc[_0xb12a('0x30')],'type':_0xb12a('0x31'),'exitAt':null}});})[_0xb12a('0x12')](function(_0xaeb958){var _0x427e10=[];_0xaeb958[_0xb12a('0x37')](function(_0x5e9998){_0x427e10[_0xb12a('0x38')](_0x5e9998[_0xb12a('0x2e')]({'exitAt':moment()[_0xb12a('0x33')](_0xb12a('0x34')),'data2':'system'}));});return BPromise['all'](_0x427e10);})['then'](function(){return _0x1dabbc[_0xb12a('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](function(_0xd1e53d){_0x58db4d(_0xd1e53d);})[_0xb12a('0x1c')](function(_0x113572){_0x2047c4(_0x51fa27[_0xb12a('0x19')](0x1f4,_0x113572[_0xb12a('0x1a')]));});});};exports[_0xb12a('0x4b')]=function(_0x288965){var _0x56aebf=this;return new Promise(function(_0x575d17,_0x17c828){var _0x2e43c5;return db[_0xb12a('0x1e')]['findOne']({'where':_0x288965[_0xb12a('0x20')][_0xb12a('0x22')]||{},'attributes':['id',_0xb12a('0x30')]})[_0xb12a('0x12')](function(_0x11c2d3){if(_0x11c2d3){_0x2e43c5=_0x11c2d3;return db['UserVoiceQueueRt'][_0xb12a('0x4c')]({'where':{'membername':_0x2e43c5['name']},'individualHooks':!![]});}})[_0xb12a('0x12')](function(){if(_0x2e43c5){return db[_0xb12a('0x2f')][_0xb12a('0x1f')]({'where':{'membername':_0x2e43c5[_0xb12a('0x30')],'exitAt':null}});}})[_0xb12a('0x12')](function(_0xe48e09){if(_0x2e43c5){if(_0xe48e09&&_0xe48e09[_0xb12a('0x32')]){var _0xb4ea25=[];_0xe48e09[_0xb12a('0x37')](function(_0x15c207){_0xb4ea25[_0xb12a('0x38')](_0x15c207[_0xb12a('0x2e')]({'exitAt':moment()[_0xb12a('0x33')](_0xb12a('0x34'))}));});return BPromise['all'](_0xb4ea25);}}})[_0xb12a('0x12')](function(){if(_0x2e43c5){return _0x2e43c5['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xb6a28a){_0x575d17(_0xb6a28a);})[_0xb12a('0x1c')](function(_0x74862){_0x17c828(_0x56aebf['error'](0x1f4,_0x74862[_0xb12a('0x1a')]));});});};exports[_0xb12a('0x4d')]=function(_0x42b4e4){var _0x5af0b7=this;return new Promise(function(_0x3b1d60,_0x43610e){var _0xc5d747;var _0x5d9c6a;var _0x41b41e;var _0x148e56;return db[_0xb12a('0x1e')]['findOne']({'where':_0x42b4e4['options'][_0xb12a('0x22')]||{},'attributes':['id',_0xb12a('0x30'),'role',_0xb12a('0x4e'),'phone','internal',_0xb12a('0x4f'),_0xb12a('0x2c')]})[_0xb12a('0x12')](function(_0x3480f9){if(_0x3480f9){_0xc5d747=_0x3480f9;_0x148e56=_0x42b4e4['body'][_0xb12a('0x2c')]?_0x42b4e4[_0xb12a('0x3b')][_0xb12a('0x2c')]:util[_0xb12a('0x33')](_0xb12a('0x3a'),_0xc5d747[_0xb12a('0x30')]);return db[_0xb12a('0x1e')][_0xb12a('0x50')]({'where':{'role':_0xb12a('0x51'),'online':!![],'id':{'$ne':_0xc5d747['id']}}});}})[_0xb12a('0x12')](function(_0x3775f0){if(_0x3775f0){_0x41b41e=_0x3775f0;return require(_0xb12a('0x52'))[_0xb12a('0x53')]();}})[_0xb12a('0x12')](function(_0x57fc6b){if(_0x57fc6b&&_0x57fc6b[_0xb12a('0x54')]&&_0x41b41e>=_0x57fc6b[_0xb12a('0x54')]){throw new Error(_0xb12a('0x55'));}})['then'](function(){if(_0xc5d747){return db[_0xb12a('0x2d')]['destroy']({'where':{'membername':_0xc5d747[_0xb12a('0x30')]},'individualHooks':!![]});}})[_0xb12a('0x12')](function(){if(_0xc5d747){return _0xc5d747[_0xb12a('0x56')]({'raw':!![]});}})[_0xb12a('0x12')](function(_0xdc3b49){if(_0xc5d747){if(_0xdc3b49){var _0x52524a=[];_0x5d9c6a=_0xdc3b49;if(_0x5d9c6a[_0xb12a('0x32')]){for(var _0x5e7bbb=0x0;_0x5e7bbb<_0x5d9c6a[_0xb12a('0x32')];_0x5e7bbb++){_0x52524a[_0xb12a('0x38')](db[_0xb12a('0x2d')][_0xb12a('0x57')]({'membername':_0xc5d747[_0xb12a('0x30')],'UserId':_0xc5d747['id'],'queue_name':_0x5d9c6a[_0x5e7bbb][_0xb12a('0x30')],'VoiceQueueId':_0x5d9c6a[_0x5e7bbb]['id'],'interface':_0x148e56,'paused':_0xc5d747[_0xb12a('0x4f')]||![],'penalty':_0x5d9c6a[_0x5e7bbb]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xb12a('0x58')](_0x52524a);}}}})[_0xb12a('0x12')](function(){if(_0xc5d747){return db[_0xb12a('0x2f')][_0xb12a('0x1f')]({'where':{'membername':_0xc5d747[_0xb12a('0x30')],'exitAt':null}});}})['then'](function(_0x38188c){if(_0xc5d747){if(_0x38188c&&_0x38188c[_0xb12a('0x32')]){var _0x4c3138=[];_0x38188c[_0xb12a('0x37')](function(_0x3a2f3b){_0x4c3138[_0xb12a('0x38')](_0x3a2f3b['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb12a('0x58')](_0x4c3138);}}})[_0xb12a('0x12')](function(_0x18ff5e){if(_0xc5d747){var _0x43fa40=[];var _0x456848=[];var _0x33644d=utils['getChannels']();var _0x29dfd1={'membername':_0xc5d747[_0xb12a('0x30')],'interface':_0x148e56,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xc5d747[_0xb12a('0x2a')],'internal':_0xc5d747[_0xb12a('0x2b')]};_0x33644d[_0xb12a('0x37')](function(_0x31471c){_0x43fa40[_0xb12a('0x38')](_[_0xb12a('0x59')]({'channel':_0x31471c,'type':_0xb12a('0x5a'),'data1':_0xb12a('0x5b'),'data2':_0x148e56},_0x29dfd1));if(_0xc5d747[_0xb12a('0x4f')]){_0x456848[_0xb12a('0x38')](_['merge']({'channel':_0x31471c,'type':'PAUSE','data1':_0xb12a('0x5c')},_0x29dfd1));}});return db[_0xb12a('0x2f')][_0xb12a('0x3f')](_0x43fa40[_0xb12a('0x5d')](_0x456848),{'individualHooks':!![]});}})[_0xb12a('0x12')](function(){if(_0xc5d747){return _0xc5d747[_0xb12a('0x2e')]({'online':!![],'lastLoginAt':moment()[_0xb12a('0x33')](_0xb12a('0x34')),'voicePause':_0xc5d747['loginInPause']||![],'mailPause':_0xc5d747[_0xb12a('0x4f')]||![],'chatPause':_0xc5d747[_0xb12a('0x4f')]||![],'faxPause':_0xc5d747[_0xb12a('0x4f')]||![],'smsPause':_0xc5d747[_0xb12a('0x4f')]||![],'openchannelPause':_0xc5d747['loginInPause']||![],'pauseType':_0xc5d747[_0xb12a('0x4f')]?_0xb12a('0x5c'):null,'lastPauseAt':moment()[_0xb12a('0x33')](_0xb12a('0x34')),'interface':_0x148e56});}})[_0xb12a('0x12')](function(_0x291c68){_0x3b1d60(_0x291c68);})[_0xb12a('0x1c')](function(_0x3398c1){_0x43610e(_0x5af0b7['error'](0x1f4,_0x3398c1[_0xb12a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9131b94..288891f 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 _0x40c7=['register','user:','./user.events','save','remove','removeListener'];(function(_0x35e31e,_0x2a70a7){var _0x281b37=function(_0x194b8f){while(--_0x194b8f){_0x35e31e['push'](_0x35e31e['shift']());}};_0x281b37(++_0x2a70a7);}(_0x40c7,0x1f4));var _0x740c=function(_0x26474a,_0x3cfcfd){_0x26474a=_0x26474a-0x0;var _0x32e0e0=_0x40c7[_0x26474a];return _0x32e0e0;};'use strict';var UserEvents=require(_0x740c('0x0'));var events=[_0x740c('0x1'),_0x740c('0x2'),'update'];function createListener(_0x144e42,_0x3a85b5){return function(_0x29f38b){_0x3a85b5['emit'](_0x144e42,_0x29f38b);};}function removeListener(_0x562f8a,_0x2f3803){return function(){UserEvents[_0x740c('0x3')](_0x562f8a,_0x2f3803);};}exports[_0x740c('0x4')]=function(_0x4e4483){for(var _0x1ba2be=0x0,_0x3382a5=events['length'];_0x1ba2be<_0x3382a5;_0x1ba2be++){var _0xa76534=events[_0x1ba2be];var _0x59319e=createListener(_0x740c('0x5')+_0xa76534,_0x4e4483);UserEvents['on'](_0xa76534,_0x59319e);}}; \ No newline at end of file +var _0xa323=['save','remove','update','removeListener','register','length','./user.events'];(function(_0x4be428,_0x42e8fd){var _0x2c082e=function(_0x57ec2e){while(--_0x57ec2e){_0x4be428['push'](_0x4be428['shift']());}};_0x2c082e(++_0x42e8fd);}(_0xa323,0x117));var _0x3a32=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0xa323[_0x2af053];return _0x4b4001;};'use strict';var UserEvents=require(_0x3a32('0x0'));var events=[_0x3a32('0x1'),_0x3a32('0x2'),_0x3a32('0x3')];function createListener(_0x2adc53,_0x1bf164){return function(_0x5b3bb8){_0x1bf164['emit'](_0x2adc53,_0x5b3bb8);};}function removeListener(_0x190bab,_0x9fd85a){return function(){UserEvents[_0x3a32('0x4')](_0x190bab,_0x9fd85a);};}exports[_0x3a32('0x5')]=function(_0x5c40e4){for(var _0x2cb49d=0x0,_0x37952e=events[_0x3a32('0x6')];_0x2cb49d<_0x37952e;_0x2cb49d++){var _0x8f3285=events[_0x2cb49d];var _0x34e0ae=createListener('user:'+_0x8f3285,_0x5c40e4);UserEvents['on'](_0x8f3285,_0x34e0ae);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f895d86..4084348 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 _0x9423=['multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','exports'];(function(_0x5e8e5f,_0x28df81){var _0x1bdf05=function(_0x31e375){while(--_0x31e375){_0x5e8e5f['push'](_0x5e8e5f['shift']());}};_0x1bdf05(++_0x28df81);}(_0x9423,0x1e3));var _0x3942=function(_0x3b9994,_0x81f2e0){_0x3b9994=_0x3b9994-0x0;var _0x1b7772=_0x9423[_0x3b9994];return _0x1b7772;};'use strict';var multer=require(_0x3942('0x0'));var util=require('util');var path=require(_0x3942('0x1'));var timeout=require(_0x3942('0x2'));var express=require(_0x3942('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3942('0x4'));var config=require(_0x3942('0x5'));module[_0x3942('0x6')]=router; \ No newline at end of file +var _0xa994=['multer','util','path','connect-timeout','Router','exports'];(function(_0x4206f9,_0xbb9cd1){var _0x47cfda=function(_0x13ff31){while(--_0x13ff31){_0x4206f9['push'](_0x4206f9['shift']());}};_0x47cfda(++_0xbb9cd1);}(_0xa994,0xd2));var _0x4a99=function(_0x16e45a,_0x32f5a4){_0x16e45a=_0x16e45a-0x0;var _0x53f384=_0xa994[_0x16e45a];return _0x53f384;};'use strict';var multer=require(_0x4a99('0x0'));var util=require(_0x4a99('0x1'));var path=require(_0x4a99('0x2'));var timeout=require(_0x4a99('0x3'));var express=require('express');var router=express[_0x4a99('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x4a99('0x5')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 2bddf5a..f343a7a 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x2cb231,_0xfd198e){var _0x2c5ce0=function(_0x3f02a6){while(--_0x3f02a6){_0x2cb231['push'](_0x2cb231['shift']());}};_0x2c5ce0(++_0xfd198e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4c5e74,_0x319d00){var _0x48b7f6=function(_0x247742){while(--_0x247742){_0x4c5e74['push'](_0x4c5e74['shift']());}};_0x48b7f6(++_0x319d00);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 772ff86..c2db6d0 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 _0x14ca=['api','bluebird','path','rimraf','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util'];(function(_0x121c2c,_0x1a0d83){var _0x2f043d=function(_0x2a513c){while(--_0x2a513c){_0x121c2c['push'](_0x121c2c['shift']());}};_0x2f043d(++_0x1a0d83);}(_0x14ca,0x148));var _0xa14c=function(_0x873d48,_0x3cf3c0){_0x873d48=_0x873d48-0x0;var _0x50c8ca=_0x14ca[_0x873d48];return _0x50c8ca;};'use strict';var _=require(_0xa14c('0x0'));var util=require(_0xa14c('0x1'));var logger=require('../../config/logger')(_0xa14c('0x2'));var moment=require('moment');var BPromise=require(_0xa14c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa14c('0x4'));var rimraf=require(_0xa14c('0x5'));var config=require('../../config/environment');var attributes=require(_0xa14c('0x6'));module[_0xa14c('0x7')]=function(_0x10c814,_0x50f9e8){return _0x10c814['define'](_0xa14c('0x8'),attributes,{'tableName':_0xa14c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78a4=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','user_has_chat_queues'];(function(_0x16ca34,_0x3c2a3b){var _0x1f45c4=function(_0x2fab33){while(--_0x2fab33){_0x16ca34['push'](_0x16ca34['shift']());}};_0x1f45c4(++_0x3c2a3b);}(_0x78a4,0x12c));var _0x478a=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x78a4[_0x46a38b];return _0x346e75;};'use strict';var _=require(_0x478a('0x0'));var util=require(_0x478a('0x1'));var logger=require(_0x478a('0x2'))(_0x478a('0x3'));var moment=require(_0x478a('0x4'));var BPromise=require(_0x478a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x478a('0x6'));var config=require(_0x478a('0x7'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x1b2ce3,_0x666449){return _0x1b2ce3[_0x478a('0x8')]('UserChatQueue',attributes,{'tableName':_0x478a('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 47df03d..68cb581 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 _0xf904=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4a8195,_0x46af1b){var _0x23f86e=function(_0x2e28ee){while(--_0x2e28ee){_0x4a8195['push'](_0x4a8195['shift']());}};_0x23f86e(++_0x46af1b);}(_0xf904,0x87));var _0x4f90=function(_0x1a97cb,_0x3e174c){_0x1a97cb=_0x1a97cb-0x0;var _0x4ab190=_0xf904[_0x1a97cb];return _0x4ab190;};'use strict';var _=require(_0x4f90('0x0'));var util=require(_0x4f90('0x1'));var moment=require(_0x4f90('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f90('0x3'));var fs=require('fs');var Redis=require(_0x4f90('0x4'));var db=require(_0x4f90('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f90('0x6'))(_0x4f90('0x7'));var config=require(_0x4f90('0x8'));var jayson=require(_0x4f90('0x9'));var client=jayson[_0x4f90('0xa')][_0x4f90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x135fe5,_0x31ad47,_0x51bd2c){return new BPromise(function(_0xcaee01,_0x176cc0){return client['request'](_0x135fe5,_0x51bd2c)[_0x4f90('0xc')](function(_0x37767b){logger[_0x4f90('0xd')](_0x4f90('0xe'),_0x31ad47,_0x4f90('0xf'));logger[_0x4f90('0x10')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x31ad47,'request\x20sent',JSON[_0x4f90('0x11')](_0x37767b));if(_0x37767b[_0x4f90('0x12')]){if(_0x37767b[_0x4f90('0x12')][_0x4f90('0x13')]===0x1f4){logger[_0x4f90('0x12')](_0x4f90('0xe'),_0x31ad47,_0x37767b['error'][_0x4f90('0x14')]);return _0x176cc0(_0x37767b[_0x4f90('0x12')][_0x4f90('0x14')]);}logger[_0x4f90('0x12')](_0x4f90('0xe'),_0x31ad47,_0x37767b['error']['message']);return _0xcaee01(_0x37767b[_0x4f90('0x12')][_0x4f90('0x14')]);}else{logger['info'](_0x4f90('0xe'),_0x31ad47,_0x4f90('0xf'));_0xcaee01(_0x37767b[_0x4f90('0x15')][_0x4f90('0x14')]);}})[_0x4f90('0x16')](function(_0x3387ad){logger[_0x4f90('0x12')](_0x4f90('0xe'),_0x31ad47,_0x3387ad);_0x176cc0(_0x3387ad);});});} \ No newline at end of file +var _0x3d1a=['../../config/logger','rpc','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x52c8f8,_0x5b141b){var _0x3193ba=function(_0x294319){while(--_0x294319){_0x52c8f8['push'](_0x52c8f8['shift']());}};_0x3193ba(++_0x5b141b);}(_0x3d1a,0x1f3));var _0xa3d1=function(_0x1cc3f0,_0x3fe635){_0x1cc3f0=_0x1cc3f0-0x0;var _0x50fbe6=_0x3d1a[_0x1cc3f0];return _0x50fbe6;};'use strict';var _=require(_0xa3d1('0x0'));var util=require(_0xa3d1('0x1'));var moment=require('moment');var BPromise=require(_0xa3d1('0x2'));var rs=require(_0xa3d1('0x3'));var fs=require('fs');var Redis=require(_0xa3d1('0x4'));var db=require(_0xa3d1('0x5'))['db'];var utils=require(_0xa3d1('0x6'));var logger=require(_0xa3d1('0x7'))(_0xa3d1('0x8'));var config=require('../../config/environment');var jayson=require(_0xa3d1('0x9'));var client=jayson[_0xa3d1('0xa')][_0xa3d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1501c0,_0x4a8248,_0x19e742){return new BPromise(function(_0x2567c9,_0x345dc8){return client[_0xa3d1('0xc')](_0x1501c0,_0x19e742)[_0xa3d1('0xd')](function(_0x1d0096){logger['info'](_0xa3d1('0xe'),_0x4a8248,_0xa3d1('0xf'));logger[_0xa3d1('0x10')](_0xa3d1('0x11'),_0x4a8248,'request\x20sent',JSON[_0xa3d1('0x12')](_0x1d0096));if(_0x1d0096[_0xa3d1('0x13')]){if(_0x1d0096[_0xa3d1('0x13')][_0xa3d1('0x14')]===0x1f4){logger['error'](_0xa3d1('0xe'),_0x4a8248,_0x1d0096['error'][_0xa3d1('0x15')]);return _0x345dc8(_0x1d0096[_0xa3d1('0x13')][_0xa3d1('0x15')]);}logger[_0xa3d1('0x13')](_0xa3d1('0xe'),_0x4a8248,_0x1d0096['error'][_0xa3d1('0x15')]);return _0x2567c9(_0x1d0096['error'][_0xa3d1('0x15')]);}else{logger['info'](_0xa3d1('0xe'),_0x4a8248,_0xa3d1('0xf'));_0x2567c9(_0x1d0096['result'][_0xa3d1('0x15')]);}})[_0xa3d1('0x16')](function(_0x466325){logger[_0xa3d1('0x13')](_0xa3d1('0xe'),_0x4a8248,_0x466325);_0x345dc8(_0x466325);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index e13e835..c36c123 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 _0xabf7=['multer','path','connect-timeout','express','../../components/auth/service','exports'];(function(_0x2ac854,_0x267385){var _0x52c55a=function(_0x34c0bf){while(--_0x34c0bf){_0x2ac854['push'](_0x2ac854['shift']());}};_0x52c55a(++_0x267385);}(_0xabf7,0xae));var _0x7abf=function(_0xe3c18c,_0x4628bb){_0xe3c18c=_0xe3c18c-0x0;var _0x50ccd0=_0xabf7[_0xe3c18c];return _0x50ccd0;};'use strict';var multer=require(_0x7abf('0x0'));var util=require('util');var path=require(_0x7abf('0x1'));var timeout=require(_0x7abf('0x2'));var express=require(_0x7abf('0x3'));var router=express['Router']();var auth=require(_0x7abf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x7abf('0x5')]=router; \ No newline at end of file +var _0x2a0f=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x16fe2d,_0x1cd813){var _0x1d64c1=function(_0x5d7f6e){while(--_0x5d7f6e){_0x16fe2d['push'](_0x16fe2d['shift']());}};_0x1d64c1(++_0x1cd813);}(_0x2a0f,0xbc));var _0xf2a0=function(_0x24b0aa,_0x46ab96){_0x24b0aa=_0x24b0aa-0x0;var _0x2b25b0=_0x2a0f[_0x24b0aa];return _0x2b25b0;};'use strict';var multer=require(_0xf2a0('0x0'));var util=require(_0xf2a0('0x1'));var path=require(_0xf2a0('0x2'));var timeout=require(_0xf2a0('0x3'));var express=require(_0xf2a0('0x4'));var router=express['Router']();var auth=require(_0xf2a0('0x5'));var interaction=require(_0xf2a0('0x6'));var config=require(_0xf2a0('0x7'));module[_0xf2a0('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e86b71d..6a55f5b 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 _0x1775=['STRING','exports','INTEGER'];(function(_0xc1633e,_0x404a54){var _0x22c69b=function(_0x3c6c1c){while(--_0x3c6c1c){_0xc1633e['push'](_0xc1633e['shift']());}};_0x22c69b(++_0x404a54);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'penalty':{'type':Sequelize[_0x5177('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5177('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5177('0x2')]}}; \ No newline at end of file +var _0x0b0e=['STRING','sequelize','INTEGER'];(function(_0xe7ef52,_0x3c11a5){var _0x31f946=function(_0x3733dd){while(--_0x3733dd){_0xe7ef52['push'](_0xe7ef52['shift']());}};_0x31f946(++_0x3c11a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0x0b0e[_0x25a42a];return _0x1129b1;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe0b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0764e7e..c40bb7b 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 _0x7e87=['bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','util','../../config/logger','api','moment'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x7e87,0x172));var _0x77e8=function(_0x4d8727,_0x97c3){_0x4d8727=_0x4d8727-0x0;var _0x1d88d8=_0x7e87[_0x4d8727];return _0x1d88d8;};'use strict';var _=require('lodash');var util=require(_0x77e8('0x0'));var logger=require(_0x77e8('0x1'))(_0x77e8('0x2'));var moment=require(_0x77e8('0x3'));var BPromise=require(_0x77e8('0x4'));var rp=require(_0x77e8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77e8('0x6'));var config=require(_0x77e8('0x7'));var attributes=require(_0x77e8('0x8'));module[_0x77e8('0x9')]=function(_0x229510,_0x415a0){return _0x229510['define'](_0x77e8('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe653=['api','moment','request-promise','path','./userFaxQueue.attributes','exports','define','util'];(function(_0x43003a,_0x4fe90f){var _0x5c4a3c=function(_0x515031){while(--_0x515031){_0x43003a['push'](_0x43003a['shift']());}};_0x5c4a3c(++_0x4fe90f);}(_0xe653,0x15f));var _0x3e65=function(_0x375126,_0x514a8e){_0x375126=_0x375126-0x0;var _0x1f76bb=_0xe653[_0x375126];return _0x1f76bb;};'use strict';var _=require('lodash');var util=require(_0x3e65('0x0'));var logger=require('../../config/logger')(_0x3e65('0x1'));var moment=require(_0x3e65('0x2'));var BPromise=require('bluebird');var rp=require(_0x3e65('0x3'));var fs=require('fs');var path=require(_0x3e65('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e65('0x5'));module[_0x3e65('0x6')]=function(_0x8babab,_0x56c872){return _0x8babab[_0x3e65('0x7')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','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 597124d..9ebf4a1 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 _0x6659=['request\x20sent','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x6659,0xbd));var _0x9665=function(_0x191727,_0x224327){_0x191727=_0x191727-0x0;var _0x455fe3=_0x6659[_0x191727];return _0x455fe3;};'use strict';var _=require('lodash');var util=require(_0x9665('0x0'));var moment=require('moment');var BPromise=require(_0x9665('0x1'));var rs=require(_0x9665('0x2'));var fs=require('fs');var Redis=require(_0x9665('0x3'));var db=require(_0x9665('0x4'))['db'];var utils=require(_0x9665('0x5'));var logger=require(_0x9665('0x6'))(_0x9665('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3798b7,_0x279158,_0x4d5720){return new BPromise(function(_0x20d669,_0x39f0e4){return client['request'](_0x3798b7,_0x4d5720)['then'](function(_0x5d8ae8){logger['info'](_0x9665('0x8'),_0x279158,'request\x20sent');logger[_0x9665('0x9')](_0x9665('0xa'),_0x279158,'request\x20sent',JSON[_0x9665('0xb')](_0x5d8ae8));if(_0x5d8ae8[_0x9665('0xc')]){if(_0x5d8ae8['error']['code']===0x1f4){logger['error'](_0x9665('0x8'),_0x279158,_0x5d8ae8['error'][_0x9665('0xd')]);return _0x39f0e4(_0x5d8ae8[_0x9665('0xc')][_0x9665('0xd')]);}logger[_0x9665('0xc')](_0x9665('0x8'),_0x279158,_0x5d8ae8['error'][_0x9665('0xd')]);return _0x20d669(_0x5d8ae8[_0x9665('0xc')][_0x9665('0xd')]);}else{logger[_0x9665('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x279158,_0x9665('0xf'));_0x20d669(_0x5d8ae8[_0x9665('0x10')][_0x9665('0xd')]);}})['catch'](function(_0xfd2b1d){logger[_0x9665('0xc')](_0x9665('0x8'),_0x279158,_0xfd2b1d);_0x39f0e4(_0xfd2b1d);});});} \ No newline at end of file +var _0x22d2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','UserFaxQueue,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x22d2,0x92));var _0x222d=function(_0x408dff,_0x5b3b53){_0x408dff=_0x408dff-0x0;var _0xec1f76=_0x22d2[_0x408dff];return _0xec1f76;};'use strict';var _=require(_0x222d('0x0'));var util=require('util');var moment=require(_0x222d('0x1'));var BPromise=require(_0x222d('0x2'));var rs=require(_0x222d('0x3'));var fs=require('fs');var Redis=require(_0x222d('0x4'));var db=require(_0x222d('0x5'))['db'];var utils=require(_0x222d('0x6'));var logger=require('../../config/logger')(_0x222d('0x7'));var config=require(_0x222d('0x8'));var jayson=require(_0x222d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19e281,_0x57a6db,_0xe19dd3){return new BPromise(function(_0x598c9e,_0x2b88ec){return client[_0x222d('0xa')](_0x19e281,_0xe19dd3)[_0x222d('0xb')](function(_0x48f89f){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x57a6db,_0x222d('0xc'));logger['debug'](_0x222d('0xd'),_0x57a6db,_0x222d('0xc'),JSON['stringify'](_0x48f89f));if(_0x48f89f[_0x222d('0xe')]){if(_0x48f89f[_0x222d('0xe')][_0x222d('0xf')]===0x1f4){logger[_0x222d('0xe')](_0x222d('0x10'),_0x57a6db,_0x48f89f[_0x222d('0xe')][_0x222d('0x11')]);return _0x2b88ec(_0x48f89f[_0x222d('0xe')][_0x222d('0x11')]);}logger[_0x222d('0xe')](_0x222d('0x10'),_0x57a6db,_0x48f89f[_0x222d('0xe')][_0x222d('0x11')]);return _0x598c9e(_0x48f89f['error'][_0x222d('0x11')]);}else{logger[_0x222d('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x57a6db,_0x222d('0xc'));_0x598c9e(_0x48f89f[_0x222d('0x13')]['message']);}})[_0x222d('0x14')](function(_0x3118e5){logger[_0x222d('0xe')](_0x222d('0x10'),_0x57a6db,_0x3118e5);_0x2b88ec(_0x3118e5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 131ff6a..4078fd0 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 _0x3a0b=['express','exports','multer','util','path','connect-timeout'];(function(_0x22ab39,_0x236416){var _0x7df1fd=function(_0x45fefd){while(--_0x45fefd){_0x22ab39['push'](_0x22ab39['shift']());}};_0x7df1fd(++_0x236416);}(_0x3a0b,0x7a));var _0xb3a0=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x3a0b[_0x4392af];return _0x9fa8eb;};'use strict';var multer=require(_0xb3a0('0x0'));var util=require(_0xb3a0('0x1'));var path=require(_0xb3a0('0x2'));var timeout=require(_0xb3a0('0x3'));var express=require(_0xb3a0('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xb3a0('0x5')]=router; \ No newline at end of file +var _0x2bf0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x2bf0,0xa7));var _0x02bf=function(_0x166b52,_0x31ac3e){_0x166b52=_0x166b52-0x0;var _0x3566bc=_0x2bf0[_0x166b52];return _0x3566bc;};'use strict';var multer=require('multer');var util=require(_0x02bf('0x0'));var path=require(_0x02bf('0x1'));var timeout=require(_0x02bf('0x2'));var express=require(_0x02bf('0x3'));var router=express[_0x02bf('0x4')]();var auth=require(_0x02bf('0x5'));var interaction=require(_0x02bf('0x6'));var config=require(_0x02bf('0x7'));module[_0x02bf('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0301a35..2f3f3b5 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x504ec5,_0x2f35c1){var _0x21ab56=function(_0x4f510c){while(--_0x4f510c){_0x504ec5['push'](_0x504ec5['shift']());}};_0x21ab56(++_0x2f35c1);}(_0xe706,0xa3));var _0x6e70=function(_0x414806,_0x12a8c2){_0x414806=_0x414806-0x0;var _0x14e039=_0xe706[_0x414806];return _0x14e039;};'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(_0x26b35c,_0x2e460c){var _0x537f9d=function(_0x3e3b5d){while(--_0x3e3b5d){_0x26b35c['push'](_0x26b35c['shift']());}};_0x537f9d(++_0x2e460c);}(_0xb10b,0x12a));var _0xbb10=function(_0x349b8a,_0x35b021){_0x349b8a=_0x349b8a-0x0;var _0x1d5645=_0xb10b[_0x349b8a];return _0x1d5645;};'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 6e7f530..948a755 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0xb10b,0x12a));var _0xbb10=function(_0x4745d9,_0x411b00){_0x4745d9=_0x4745d9-0x0;var _0x38f2ac=_0xb10b[_0x4745d9];return _0x38f2ac;};'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')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api'];(function(_0x23ce6a,_0x504b83){var _0x16a0e5=function(_0x5dffa1){while(--_0x5dffa1){_0x23ce6a['push'](_0x23ce6a['shift']());}};_0x16a0e5(++_0x504b83);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 82f2b3e..d7fde77 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 _0xae1c=['message','info','result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xae1c,0xff));var _0xcae1=function(_0x31d6a7,_0x5a5235){_0x31d6a7=_0x31d6a7-0x0;var _0x185aee=_0xae1c[_0x31d6a7];return _0x185aee;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcae1('0x0'));var fs=require('fs');var Redis=require(_0xcae1('0x1'));var db=require(_0xcae1('0x2'))['db'];var utils=require(_0xcae1('0x3'));var logger=require(_0xcae1('0x4'))(_0xcae1('0x5'));var config=require(_0xcae1('0x6'));var jayson=require(_0xcae1('0x7'));var client=jayson[_0xcae1('0x8')][_0xcae1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c35c7,_0x38099e,_0x7a27b8){return new BPromise(function(_0x50d451,_0x4e419d){return client[_0xcae1('0xa')](_0x3c35c7,_0x7a27b8)[_0xcae1('0xb')](function(_0x3284aa){logger['info'](_0xcae1('0xc'),_0x38099e,_0xcae1('0xd'));logger[_0xcae1('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x38099e,_0xcae1('0xd'),JSON[_0xcae1('0xf')](_0x3284aa));if(_0x3284aa['error']){if(_0x3284aa['error'][_0xcae1('0x10')]===0x1f4){logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);return _0x4e419d(_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);}logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);return _0x50d451(_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);}else{logger[_0xcae1('0x13')](_0xcae1('0xc'),_0x38099e,'request\x20sent');_0x50d451(_0x3284aa[_0xcae1('0x14')][_0xcae1('0x12')]);}})['catch'](function(_0x4a7ef7){logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x4a7ef7);_0x4e419d(_0x4a7ef7);});});} \ No newline at end of file +var _0x4312=['../../config/logger','rpc','../../config/environment','client','request','info','UserMailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2fd4fa,_0x5c8ad6){var _0x369501=function(_0x3f34d3){while(--_0x3f34d3){_0x2fd4fa['push'](_0x2fd4fa['shift']());}};_0x369501(++_0x5c8ad6);}(_0x4312,0xaf));var _0x2431=function(_0x25d5e9,_0x340fda){_0x25d5e9=_0x25d5e9-0x0;var _0xa351e2=_0x4312[_0x25d5e9];return _0xa351e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2431('0x0'));var BPromise=require(_0x2431('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2431('0x2'));var db=require(_0x2431('0x3'))['db'];var utils=require(_0x2431('0x4'));var logger=require(_0x2431('0x5'))(_0x2431('0x6'));var config=require(_0x2431('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2431('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa2cabe,_0x147562,_0x4e2eb2){return new BPromise(function(_0x9647b4,_0x2cb734){return client[_0x2431('0x9')](_0xa2cabe,_0x4e2eb2)['then'](function(_0x28667c){logger[_0x2431('0xa')](_0x2431('0xb'),_0x147562,'request\x20sent');logger[_0x2431('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x147562,_0x2431('0xd'),JSON[_0x2431('0xe')](_0x28667c));if(_0x28667c[_0x2431('0xf')]){if(_0x28667c['error'][_0x2431('0x10')]===0x1f4){logger[_0x2431('0xf')](_0x2431('0xb'),_0x147562,_0x28667c[_0x2431('0xf')]['message']);return _0x2cb734(_0x28667c[_0x2431('0xf')][_0x2431('0x11')]);}logger[_0x2431('0xf')](_0x2431('0xb'),_0x147562,_0x28667c[_0x2431('0xf')][_0x2431('0x11')]);return _0x9647b4(_0x28667c[_0x2431('0xf')][_0x2431('0x11')]);}else{logger[_0x2431('0xa')]('UserMailQueue,\x20%s,\x20%s',_0x147562,_0x2431('0xd'));_0x9647b4(_0x28667c[_0x2431('0x12')][_0x2431('0x11')]);}})[_0x2431('0x13')](function(_0x192da2){logger[_0x2431('0xf')](_0x2431('0xb'),_0x147562,_0x192da2);_0x2cb734(_0x192da2);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 232ebb4..0c05a7d 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 _0x83cf=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','util','path'];(function(_0x135083,_0x8f1013){var _0x5e7117=function(_0x553302){while(--_0x553302){_0x135083['push'](_0x135083['shift']());}};_0x5e7117(++_0x8f1013);}(_0x83cf,0x184));var _0xf83c=function(_0x266ba0,_0xeeeaad){_0x266ba0=_0x266ba0-0x0;var _0x3ffdf8=_0x83cf[_0x266ba0];return _0x3ffdf8;};'use strict';var multer=require('multer');var util=require(_0xf83c('0x0'));var path=require(_0xf83c('0x1'));var timeout=require(_0xf83c('0x2'));var express=require(_0xf83c('0x3'));var router=express['Router']();var auth=require(_0xf83c('0x4'));var interaction=require(_0xf83c('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xde85=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde85,0x10e));var _0x5de8=function(_0x4adbad,_0x207e95){_0x4adbad=_0x4adbad-0x0;var _0x464dd1=_0xde85[_0x4adbad];return _0x464dd1;};'use strict';var multer=require(_0x5de8('0x0'));var util=require(_0x5de8('0x1'));var path=require(_0x5de8('0x2'));var timeout=require(_0x5de8('0x3'));var express=require('express');var router=express[_0x5de8('0x4')]();var auth=require(_0x5de8('0x5'));var interaction=require(_0x5de8('0x6'));var config=require(_0x5de8('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 10ff7ec..25b6398 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(_0x4965a1,_0x47bf05){var _0x299f9c=function(_0x22822b){while(--_0x22822b){_0x4965a1['push'](_0x4965a1['shift']());}};_0x299f9c(++_0x47bf05);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x34390b,_0x57dde5){var _0x417339=function(_0x1c549c){while(--_0x1c549c){_0x34390b['push'](_0x34390b['shift']());}};_0x417339(++_0x57dde5);}(_0xe706,0xa3));var _0x6e70=function(_0x449166,_0x35d5c7){_0x449166=_0x449166-0x0;var _0x37916d=_0xe706[_0x449166];return _0x37916d;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 8485a62..199092b 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 _0x90bf=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','util','api','moment'];(function(_0x1dd7e7,_0x917ce0){var _0xebdccf=function(_0x39134b){while(--_0x39134b){_0x1dd7e7['push'](_0x1dd7e7['shift']());}};_0xebdccf(++_0x917ce0);}(_0x90bf,0x69));var _0xf90b=function(_0x19c126,_0x47dc07){_0x19c126=_0x19c126-0x0;var _0x2df03d=_0x90bf[_0x19c126];return _0x2df03d;};'use strict';var _=require('lodash');var util=require(_0xf90b('0x0'));var logger=require('../../config/logger')(_0xf90b('0x1'));var moment=require(_0xf90b('0x2'));var BPromise=require(_0xf90b('0x3'));var rp=require(_0xf90b('0x4'));var fs=require('fs');var path=require(_0xf90b('0x5'));var rimraf=require(_0xf90b('0x6'));var config=require(_0xf90b('0x7'));var attributes=require(_0xf90b('0x8'));module[_0xf90b('0x9')]=function(_0x21bfc7,_0x60c80b){return _0x21bfc7[_0xf90b('0xa')](_0xf90b('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1a7=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','lodash'];(function(_0x2fa47a,_0x257050){var _0x251693=function(_0x5cbfe8){while(--_0x5cbfe8){_0x2fa47a['push'](_0x2fa47a['shift']());}};_0x251693(++_0x257050);}(_0xf1a7,0x175));var _0x7f1a=function(_0x42a931,_0x35868d){_0x42a931=_0x42a931-0x0;var _0x36369e=_0xf1a7[_0x42a931];return _0x36369e;};'use strict';var _=require(_0x7f1a('0x0'));var util=require('util');var logger=require(_0x7f1a('0x1'))(_0x7f1a('0x2'));var moment=require(_0x7f1a('0x3'));var BPromise=require(_0x7f1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f1a('0x5'));var rimraf=require(_0x7f1a('0x6'));var config=require(_0x7f1a('0x7'));var attributes=require(_0x7f1a('0x8'));module['exports']=function(_0x2ae12f,_0x3d9dc9){return _0x2ae12f[_0x7f1a('0x9')](_0x7f1a('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 95de09f..677f5ed 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 _0x14a3=['code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','stringify','error'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x14a3,0x1e8));var _0x314a=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x14a3[_0xf5d71c];return _0x5af672;};'use strict';var _=require(_0x314a('0x0'));var util=require(_0x314a('0x1'));var moment=require(_0x314a('0x2'));var BPromise=require('bluebird');var rs=require(_0x314a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x314a('0x4'))['db'];var utils=require(_0x314a('0x5'));var logger=require(_0x314a('0x6'))(_0x314a('0x7'));var config=require(_0x314a('0x8'));var jayson=require(_0x314a('0x9'));var client=jayson[_0x314a('0xa')][_0x314a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b4e97,_0x5e5227,_0x1c6b17){return new BPromise(function(_0x419fea,_0x30c05a){return client[_0x314a('0xc')](_0x1b4e97,_0x1c6b17)[_0x314a('0xd')](function(_0x3e3ef4){logger[_0x314a('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5e5227,'request\x20sent');logger[_0x314a('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5e5227,'request\x20sent',JSON[_0x314a('0x10')](_0x3e3ef4));if(_0x3e3ef4[_0x314a('0x11')]){if(_0x3e3ef4['error'][_0x314a('0x12')]===0x1f4){logger[_0x314a('0x11')](_0x314a('0x13'),_0x5e5227,_0x3e3ef4['error'][_0x314a('0x14')]);return _0x30c05a(_0x3e3ef4[_0x314a('0x11')][_0x314a('0x14')]);}logger[_0x314a('0x11')](_0x314a('0x13'),_0x5e5227,_0x3e3ef4[_0x314a('0x11')][_0x314a('0x14')]);return _0x419fea(_0x3e3ef4[_0x314a('0x11')]['message']);}else{logger[_0x314a('0xe')](_0x314a('0x13'),_0x5e5227,'request\x20sent');_0x419fea(_0x3e3ef4[_0x314a('0x15')][_0x314a('0x14')]);}})[_0x314a('0x16')](function(_0xf57cfb){logger[_0x314a('0x11')](_0x314a('0x13'),_0x5e5227,_0xf57cfb);_0x30c05a(_0xf57cfb);});});} \ No newline at end of file +var _0x889c=['../../config/logger','rpc','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x232d09,_0x30a518){var _0x454385=function(_0x3a5fdd){while(--_0x3a5fdd){_0x232d09['push'](_0x232d09['shift']());}};_0x454385(++_0x30a518);}(_0x889c,0x14e));var _0xc889=function(_0x2f88c0,_0x5efbc6){_0x2f88c0=_0x2f88c0-0x0;var _0x58b9b3=_0x889c[_0x2f88c0];return _0x58b9b3;};'use strict';var _=require('lodash');var util=require(_0xc889('0x0'));var moment=require(_0xc889('0x1'));var BPromise=require(_0xc889('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc889('0x3'));var db=require(_0xc889('0x4'))['db'];var utils=require(_0xc889('0x5'));var logger=require(_0xc889('0x6'))(_0xc889('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc889('0x8')][_0xc889('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a877e,_0x1210b2,_0xe7fb1){return new BPromise(function(_0x562b10,_0x57bfca){return client['request'](_0x3a877e,_0xe7fb1)[_0xc889('0xa')](function(_0xb606e4){logger[_0xc889('0xb')](_0xc889('0xc'),_0x1210b2,_0xc889('0xd'));logger[_0xc889('0xe')](_0xc889('0xf'),_0x1210b2,_0xc889('0xd'),JSON['stringify'](_0xb606e4));if(_0xb606e4['error']){if(_0xb606e4[_0xc889('0x10')][_0xc889('0x11')]===0x1f4){logger[_0xc889('0x10')](_0xc889('0xc'),_0x1210b2,_0xb606e4[_0xc889('0x10')][_0xc889('0x12')]);return _0x57bfca(_0xb606e4[_0xc889('0x10')][_0xc889('0x12')]);}logger[_0xc889('0x10')](_0xc889('0xc'),_0x1210b2,_0xb606e4['error'][_0xc889('0x12')]);return _0x562b10(_0xb606e4[_0xc889('0x10')][_0xc889('0x12')]);}else{logger['info'](_0xc889('0xc'),_0x1210b2,_0xc889('0xd'));_0x562b10(_0xb606e4['result'][_0xc889('0x12')]);}})[_0xc889('0x13')](function(_0x55c3bb){logger[_0xc889('0x10')](_0xc889('0xc'),_0x1210b2,_0x55c3bb);_0x57bfca(_0x55c3bb);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b5a4795..22d8c6c 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 _0xfdef=['util','path','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','show','getSections','/:id/resources','getResources','post','create','clone','/:id/sections','addSections','addResources','delete','/:id','destroy','removeSections','removeResources','exports'];(function(_0x21c685,_0x5bf514){var _0x208ff1=function(_0x262df0){while(--_0x262df0){_0x21c685['push'](_0x21c685['shift']());}};_0x208ff1(++_0x5bf514);}(_0xfdef,0x129));var _0xffde=function(_0x49fe98,_0x3377b4){_0x49fe98=_0x49fe98-0x0;var _0x2ca2ed=_0xfdef[_0x49fe98];return _0x2ca2ed;};'use strict';var multer=require('multer');var util=require(_0xffde('0x0'));var path=require(_0xffde('0x1'));var timeout=require('connect-timeout');var express=require(_0xffde('0x2'));var router=express[_0xffde('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xffde('0x4'));var config=require(_0xffde('0x5'));var controller=require(_0xffde('0x6'));router[_0xffde('0x7')]('/',auth[_0xffde('0x8')](),controller[_0xffde('0x9')]);router[_0xffde('0x7')]('/describe',auth[_0xffde('0x8')](),controller[_0xffde('0xa')]);router[_0xffde('0x7')]('/:id',auth[_0xffde('0x8')](),controller[_0xffde('0xb')]);router[_0xffde('0x7')]('/:id/sections',auth[_0xffde('0x8')](),controller[_0xffde('0xc')]);router[_0xffde('0x7')](_0xffde('0xd'),auth['isAuthenticated'](),controller[_0xffde('0xe')]);router[_0xffde('0xf')]('/',auth['isAuthenticated'](),controller[_0xffde('0x10')]);router[_0xffde('0xf')]('/:id/clone',auth[_0xffde('0x8')](),controller[_0xffde('0x11')]);router[_0xffde('0xf')](_0xffde('0x12'),auth[_0xffde('0x8')](),controller[_0xffde('0x13')]);router[_0xffde('0xf')](_0xffde('0xd'),auth[_0xffde('0x8')](),controller[_0xffde('0x14')]);router['put']('/:id',auth[_0xffde('0x8')](),controller['update']);router[_0xffde('0x15')](_0xffde('0x16'),auth['isAuthenticated'](),controller[_0xffde('0x17')]);router[_0xffde('0x15')](_0xffde('0x12'),auth[_0xffde('0x8')](),controller[_0xffde('0x18')]);router[_0xffde('0x15')]('/:id/resources',auth[_0xffde('0x8')](),controller[_0xffde('0x19')]);module[_0xffde('0x1a')]=router; \ No newline at end of file +var _0x4bb2=['show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','delete','removeSections','removeResources','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dc109,_0xe2dd4f){var _0x296ea8=function(_0xb164b0){while(--_0xb164b0){_0x3dc109['push'](_0x3dc109['shift']());}};_0x296ea8(++_0xe2dd4f);}(_0x4bb2,0x11c));var _0x24bb=function(_0x29d658,_0x5e51a3){_0x29d658=_0x29d658-0x0;var _0x1ae4b5=_0x4bb2[_0x29d658];return _0x1ae4b5;};'use strict';var multer=require(_0x24bb('0x0'));var util=require('util');var path=require(_0x24bb('0x1'));var timeout=require(_0x24bb('0x2'));var express=require(_0x24bb('0x3'));var router=express['Router']();var auth=require(_0x24bb('0x4'));var interaction=require(_0x24bb('0x5'));var config=require('../../config/environment');var controller=require(_0x24bb('0x6'));router[_0x24bb('0x7')]('/',auth[_0x24bb('0x8')](),controller[_0x24bb('0x9')]);router[_0x24bb('0x7')](_0x24bb('0xa'),auth[_0x24bb('0x8')](),controller[_0x24bb('0xb')]);router[_0x24bb('0x7')](_0x24bb('0xc'),auth[_0x24bb('0x8')](),controller[_0x24bb('0xd')]);router[_0x24bb('0x7')](_0x24bb('0xe'),auth[_0x24bb('0x8')](),controller[_0x24bb('0xf')]);router[_0x24bb('0x7')](_0x24bb('0x10'),auth[_0x24bb('0x8')](),controller[_0x24bb('0x11')]);router[_0x24bb('0x12')]('/',auth['isAuthenticated'](),controller[_0x24bb('0x13')]);router[_0x24bb('0x12')](_0x24bb('0x14'),auth[_0x24bb('0x8')](),controller['clone']);router[_0x24bb('0x12')](_0x24bb('0xe'),auth['isAuthenticated'](),controller[_0x24bb('0x15')]);router['post'](_0x24bb('0x10'),auth[_0x24bb('0x8')](),controller[_0x24bb('0x16')]);router['put'](_0x24bb('0xc'),auth[_0x24bb('0x8')](),controller['update']);router['delete'](_0x24bb('0xc'),auth[_0x24bb('0x8')](),controller['destroy']);router[_0x24bb('0x17')](_0x24bb('0xe'),auth['isAuthenticated'](),controller[_0x24bb('0x18')]);router[_0x24bb('0x17')](_0x24bb('0x10'),auth['isAuthenticated'](),controller[_0x24bb('0x19')]);module[_0x24bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6780f25..e21c0d3 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 _0x9819=['crudPermissions','join','getDataValue','exports','name','STRING','setDataValue'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9819,0x13e));var _0x9981=function(_0x34fad0,_0x3e417d){_0x34fad0=_0x34fad0-0x0;var _0x4203f4=_0x9819[_0x34fad0];return _0x4203f4;};'use strict';var Sequelize=require('sequelize');module[_0x9981('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9981('0x1')},'crudPermissions':{'type':Sequelize[_0x9981('0x2')],'set':function(_0x46e947){this[_0x9981('0x3')](_0x9981('0x4'),_0x46e947?_0x46e947[_0x9981('0x5')](''):[]);},'get':function(){return this[_0x9981('0x6')]('crudPermissions')?this[_0x9981('0x6')](_0x9981('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xd015=['setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','name'];(function(_0x136ad9,_0xeba7b5){var _0x46a758=function(_0x4b39d7){while(--_0x4b39d7){_0x136ad9['push'](_0x136ad9['shift']());}};_0x46a758(++_0xeba7b5);}(_0xd015,0x18c));var _0x5d01=function(_0x1df4e6,_0xab5b9c){_0x1df4e6=_0x1df4e6-0x0;var _0x4752b7=_0xd015[_0x1df4e6];return _0x4752b7;};'use strict';var Sequelize=require(_0x5d01('0x0'));module[_0x5d01('0x1')]={'name':{'type':Sequelize[_0x5d01('0x2')],'allowNull':![],'unique':_0x5d01('0x3')},'crudPermissions':{'type':Sequelize[_0x5d01('0x2')],'set':function(_0x12d7fc){this[_0x5d01('0x4')](_0x5d01('0x5'),_0x12d7fc?_0x12d7fc[_0x5d01('0x6')](''):[]);},'get':function(){return this[_0x5d01('0x7')](_0x5d01('0x5'))?this[_0x5d01('0x7')](_0x5d01('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5d01('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index e42f93b..d3ff287 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 _0xc771=['section','undefined','Sequelize','Unknown\x20section','childModel','Invalid\x20section\x20\x27','isEmpty','ignore','union','all','key','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','rows','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','SquareProjects','projects','JscriptyProject','contacts','parentSections','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','faxqueues','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','QueueCampaigns','users','telephones','Users','admin','Agents','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','pauses','Pause','scheduler','Schedule','sounds','templates','Template','Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','AnalyticMetric','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','set','apply','save','update','then','error','stack','name','send','index','map','UserProfile','fieldName','type','model','keys','filters','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','catch','show','params','rawAttributes','create','clone','length','find','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','findAll','each','autoAssociation','UserProfileResource','Resources','UserProfileSection','destroy','describe','addSections','transaction','userProfileId','push','removeSections','ids','getSections','enabled','sectionId','includes','subsections','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources'];(function(_0x46e6cb,_0x1ebe77){var _0x1e9565=function(_0x4517e6){while(--_0x4517e6){_0x46e6cb['push'](_0x46e6cb['shift']());}};_0x1e9565(++_0x1ebe77);}(_0xc771,0x15f));var _0x1c77=function(_0x1ffab9,_0xe0e66f){_0x1ffab9=_0x1ffab9-0x0;var _0x31efae=_0xc771[_0x1ffab9];return _0x31efae;};'use strict';var pdf=require(_0x1c77('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1c77('0x1'));var zipdir=require(_0x1c77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c77('0x3'));var moment=require('moment');var BPromise=require(_0x1c77('0x4'));var Mustache=require('mustache');var util=require(_0x1c77('0x5'));var path=require(_0x1c77('0x6'));var sox=require(_0x1c77('0x7'));var csv=require('to-csv');var ejs=require(_0x1c77('0x8'));var fs=require('fs');var _=require(_0x1c77('0x9'));var squel=require(_0x1c77('0xa'));var crypto=require(_0x1c77('0xb'));var jsforce=require(_0x1c77('0xc'));var deskjs=require(_0x1c77('0xd'));var toCsv=require(_0x1c77('0xe'));var querystring=require(_0x1c77('0xf'));var Papa=require(_0x1c77('0x10'));var Redis=require(_0x1c77('0x11'));var authService=require(_0x1c77('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1c77('0x13'));var hardwareService=require(_0x1c77('0x14'));var logger=require(_0x1c77('0x15'))('api');var utils=require(_0x1c77('0x16'));var config=require(_0x1c77('0x17'));var db=require(_0x1c77('0x18'))['db'];config[_0x1c77('0x19')]=_[_0x1c77('0x1a')](config[_0x1c77('0x19')],{'host':_0x1c77('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c77('0x19')]));require(_0x1c77('0x1c'))[_0x1c77('0x1d')](socket);function respondWithStatusCode(_0x631de2,_0x47638c){_0x47638c=_0x47638c||0xcc;return function(_0x56691b){if(_0x56691b){return _0x631de2[_0x1c77('0x1e')](_0x47638c);}return _0x631de2[_0x1c77('0x1f')](_0x47638c)[_0x1c77('0x20')]();};}function respondWithResult(_0x2aafb7,_0x4bde2f){_0x4bde2f=_0x4bde2f||0xc8;return function(_0x123c50){if(_0x123c50){return _0x2aafb7[_0x1c77('0x1f')](_0x4bde2f)[_0x1c77('0x21')](_0x123c50);}};}function respondWithFilteredResult(_0x35809e,_0xf09479){return function(_0x141883){if(_0x141883){var _0x21abf1=_0x141883['count'],_0xa7cdd4=_0xf09479[_0x1c77('0x22')],_0x6847aa=_0xf09479[_0x1c77('0x22')]+_0xf09479[_0x1c77('0x23')],_0x35fef7;if(_0x6847aa>=_0x21abf1){_0x6847aa=_0x21abf1;_0x35fef7=0xc8;}else{_0x35fef7=0xce;}_0x35809e[_0x1c77('0x1f')](_0x35fef7);return _0x35809e[_0x1c77('0x24')]('Content-Range',_0xa7cdd4+'-'+_0x6847aa+'/'+_0x21abf1)[_0x1c77('0x21')](_0x141883);}return null;};}function patchUpdates(_0x51728e){return function(_0xf5b0c1){try{jsonpatch[_0x1c77('0x25')](_0xf5b0c1,_0x51728e,!![]);}catch(_0x5f0fc5){return BPromise['reject'](_0x5f0fc5);}return _0xf5b0c1[_0x1c77('0x26')]();};}function saveUpdates(_0x139403,_0x160b4f){return function(_0x4a9939){if(_0x4a9939){return _0x4a9939[_0x1c77('0x27')](_0x139403)['then'](function(_0x4080ae){return _0x4080ae;});}return null;};}function removeEntity(_0xc814,_0x4b3afe){return function(_0x450ce4){if(_0x450ce4){return _0x450ce4['destroy']()[_0x1c77('0x28')](function(){_0xc814[_0x1c77('0x1f')](0xcc)[_0x1c77('0x20')]();});}};}function handleEntityNotFound(_0x1010f9,_0x2a03ed){return function(_0x5da07b){if(!_0x5da07b){_0x1010f9[_0x1c77('0x1e')](0x194);}return _0x5da07b;};}function handleError(_0x56f9fb,_0xfa416e){_0xfa416e=_0xfa416e||0x1f4;return function(_0x4c2b15){logger[_0x1c77('0x29')](_0x4c2b15[_0x1c77('0x2a')]);if(_0x4c2b15['name']){delete _0x4c2b15[_0x1c77('0x2b')];}_0x56f9fb[_0x1c77('0x1f')](_0xfa416e)[_0x1c77('0x2c')](_0x4c2b15);};}exports[_0x1c77('0x2d')]=function(_0x2993a2,_0x1c4a37){var _0x235cca={},_0x341c2e={},_0x2b398a={'count':0x0,'rows':[]};var _0x52c867=_[_0x1c77('0x2e')](db[_0x1c77('0x2f')]['rawAttributes'],function(_0x52046d){return{'name':_0x52046d[_0x1c77('0x30')],'type':_0x52046d[_0x1c77('0x31')]['key']};});_0x341c2e[_0x1c77('0x32')]=_['map'](_0x52c867,_0x1c77('0x2b'));_0x341c2e['query']=_[_0x1c77('0x33')](_0x2993a2['query']);_0x341c2e[_0x1c77('0x34')]=_['intersection'](_0x341c2e['model'],_0x341c2e['query']);_0x235cca[_0x1c77('0x35')]=_[_0x1c77('0x36')](_0x341c2e[_0x1c77('0x32')],qs['fields'](_0x2993a2['query'][_0x1c77('0x37')]));_0x235cca['attributes']=_0x235cca[_0x1c77('0x35')]['length']?_0x235cca[_0x1c77('0x35')]:_0x341c2e['model'];if(!_0x2993a2[_0x1c77('0x38')][_0x1c77('0x39')](_0x1c77('0x3a'))){_0x235cca[_0x1c77('0x23')]=qs[_0x1c77('0x23')](_0x2993a2['query'][_0x1c77('0x23')]);_0x235cca[_0x1c77('0x22')]=qs[_0x1c77('0x22')](_0x2993a2['query'][_0x1c77('0x22')]);}_0x235cca[_0x1c77('0x3b')]=qs[_0x1c77('0x3c')](_0x2993a2[_0x1c77('0x38')][_0x1c77('0x3c')]);_0x235cca[_0x1c77('0x3d')]=qs['filters'](_['pick'](_0x2993a2[_0x1c77('0x38')],_0x341c2e[_0x1c77('0x34')]),_0x52c867);if(_0x2993a2[_0x1c77('0x38')]['filter']){_0x235cca[_0x1c77('0x3d')]=_[_0x1c77('0x3e')](_0x235cca[_0x1c77('0x3d')],{'$or':_['map'](_0x52c867,function(_0x1fff4d){if(_0x1fff4d[_0x1c77('0x31')]!==_0x1c77('0x3f')){var _0x5e6a4b={};_0x5e6a4b[_0x1fff4d[_0x1c77('0x2b')]]={'$like':'%'+_0x2993a2[_0x1c77('0x38')][_0x1c77('0x40')]+'%'};return _0x5e6a4b;}})});}_0x235cca=_[_0x1c77('0x3e')]({},_0x235cca,_0x2993a2[_0x1c77('0x41')]);var _0x54d0d6={'where':_0x235cca[_0x1c77('0x3d')]};return db[_0x1c77('0x2f')][_0x1c77('0x42')](_0x54d0d6)[_0x1c77('0x28')](function(_0x22be55){_0x2b398a[_0x1c77('0x42')]=_0x22be55;if(_0x2993a2[_0x1c77('0x38')][_0x1c77('0x43')]){_0x235cca[_0x1c77('0x44')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x235cca);})[_0x1c77('0x28')](function(_0x3ebfb2){_0x2b398a['rows']=_0x3ebfb2;return _0x2b398a;})['then'](respondWithFilteredResult(_0x1c4a37,_0x235cca))[_0x1c77('0x45')](handleError(_0x1c4a37,null));};exports[_0x1c77('0x46')]=function(_0x258613,_0xfa7bac){var _0x102a59={'raw':![],'where':{'id':_0x258613[_0x1c77('0x47')]['id']}},_0x150771={};_0x150771[_0x1c77('0x32')]=_[_0x1c77('0x33')](db[_0x1c77('0x2f')][_0x1c77('0x48')]);_0x150771[_0x1c77('0x38')]=_[_0x1c77('0x33')](_0x258613[_0x1c77('0x38')]);_0x150771[_0x1c77('0x34')]=_['intersection'](_0x150771[_0x1c77('0x32')],_0x150771['query']);_0x102a59[_0x1c77('0x35')]=_['intersection'](_0x150771[_0x1c77('0x32')],qs[_0x1c77('0x37')](_0x258613['query'][_0x1c77('0x37')]));_0x102a59['attributes']=_0x102a59[_0x1c77('0x35')]['length']?_0x102a59[_0x1c77('0x35')]:_0x150771[_0x1c77('0x32')];if(_0x258613[_0x1c77('0x38')][_0x1c77('0x43')]){_0x102a59[_0x1c77('0x44')]=[{'all':!![]}];}_0x102a59=_['merge']({},_0x102a59,_0x258613[_0x1c77('0x41')]);return db[_0x1c77('0x2f')]['find'](_0x102a59)[_0x1c77('0x28')](handleEntityNotFound(_0xfa7bac,null))[_0x1c77('0x28')](respondWithResult(_0xfa7bac,null))['catch'](handleError(_0xfa7bac,null));};exports[_0x1c77('0x49')]=function(_0x4d4830,_0x572e09){return db['UserProfile'][_0x1c77('0x49')](_0x4d4830['body'],{})['then'](respondWithResult(_0x572e09,0xc9))[_0x1c77('0x45')](handleError(_0x572e09,null));};exports[_0x1c77('0x4a')]=function(_0x54886f,_0x2dae53){var _0x51ab0f={'where':{'id':_0x54886f[_0x1c77('0x47')]['id']}},_0x46a11a={};_0x46a11a[_0x1c77('0x32')]=_[_0x1c77('0x33')](db['UserProfile'][_0x1c77('0x48')]);_0x51ab0f[_0x1c77('0x35')]=_['intersection'](_0x46a11a[_0x1c77('0x32')],qs[_0x1c77('0x37')](_0x54886f[_0x1c77('0x38')][_0x1c77('0x37')]));_0x51ab0f['attributes']=_0x51ab0f[_0x1c77('0x35')][_0x1c77('0x4b')]?_0x51ab0f['attributes']:_0x46a11a[_0x1c77('0x32')];if(_0x54886f['query'][_0x1c77('0x43')]){_0x51ab0f[_0x1c77('0x44')]=[{'all':!![]}];}_0x51ab0f=_['merge']({},_0x51ab0f,_0x54886f[_0x1c77('0x41')]);return db['UserProfile'][_0x1c77('0x4c')](_0x51ab0f)['then'](handleEntityNotFound(_0x2dae53,null))[_0x1c77('0x28')](function(_0x2884fc){if(_0x2884fc){var _0x30da84=_0x2884fc[_0x1c77('0x4d')]({'plain':!![]});_0x30da84=qs[_0x1c77('0x4e')](_0x30da84,['id',_0x1c77('0x4f'),_0x1c77('0x50'),_0x1c77('0x51')]);_0x54886f[_0x1c77('0x52')]=_[_0x1c77('0x4e')](_0x54886f[_0x1c77('0x52')],['id',_0x1c77('0x4f'),_0x1c77('0x50')]);return db[_0x1c77('0x53')]['transaction'](function(_0x11a9fb){return db[_0x1c77('0x2f')][_0x1c77('0x49')](_[_0x1c77('0x3e')](_0x30da84,_0x54886f[_0x1c77('0x52')]),{'include':_0x54886f[_0x1c77('0x38')][_0x1c77('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x11a9fb})[_0x1c77('0x28')](function(_0x8df634){var _0x440d1a=_0x8df634[_0x1c77('0x4d')]({'plain':!![]});return db['UserProfileSection'][_0x1c77('0x54')]({'where':{'userProfileId':_0x54886f[_0x1c77('0x47')]['id']},'raw':!![]})['then'](function(_0xe0fd89){if(_0xe0fd89){return BPromise[_0x1c77('0x55')](_0xe0fd89,function(_0x7bf9f6){return new BPromise(function(_0x8d35d0,_0x1d4536){if(_0x7bf9f6[_0x1c77('0x56')]===null||_0x7bf9f6['autoAssociation']===0x1)_0x8d35d0(null);return db[_0x1c77('0x57')][_0x1c77('0x54')]({'where':{'sectionId':_0x7bf9f6['id']},'raw':!![]})['then'](function(_0xcd29d){var _0x42541a=_[_0x1c77('0x2e')](_0xcd29d,function(_0x89ab78){return qs[_0x1c77('0x4e')](_0x89ab78,['id',_0x1c77('0x4f'),_0x1c77('0x50'),'sectionId']);});_0x8d35d0(_0x42541a);})[_0x1c77('0x45')](function(_0x20f365){_0x1d4536(_0x20f365);});})[_0x1c77('0x28')](function(_0x2c5350){var _0x1f905d=qs['omit'](_0x7bf9f6,['id','createdAt',_0x1c77('0x50')]);_0x1f905d['userProfileId']=_0x440d1a['id'];if(_0x2c5350)_0x1f905d[_0x1c77('0x58')]=_0x2c5350;return _0x1f905d;})[_0x1c77('0x28')](function(_0x1ce522){return db[_0x1c77('0x59')][_0x1c77('0x49')](_0x1ce522,{'include':[{'model':db[_0x1c77('0x57')],'as':_0x1c77('0x58')}],'raw':!![],'transaction':_0x11a9fb});});})[_0x1c77('0x28')](function(){return _0x440d1a;});}});});});}})['then'](respondWithResult(_0x2dae53,0xc9))['catch'](handleError(_0x2dae53,null));};exports['update']=function(_0x2cba10,_0x22393b){if(_0x2cba10[_0x1c77('0x52')]['id']){delete _0x2cba10[_0x1c77('0x52')]['id'];}return db[_0x1c77('0x2f')][_0x1c77('0x4c')]({'where':{'id':_0x2cba10[_0x1c77('0x47')]['id']}})[_0x1c77('0x28')](handleEntityNotFound(_0x22393b,null))['then'](saveUpdates(_0x2cba10['body'],null))[_0x1c77('0x28')](respondWithResult(_0x22393b,null))[_0x1c77('0x45')](handleError(_0x22393b,null));};exports[_0x1c77('0x5a')]=function(_0x14a212,_0x3355fb){return db[_0x1c77('0x2f')][_0x1c77('0x4c')]({'where':{'id':_0x14a212[_0x1c77('0x47')]['id']}})[_0x1c77('0x28')](handleEntityNotFound(_0x3355fb,null))[_0x1c77('0x28')](removeEntity(_0x3355fb,null))[_0x1c77('0x45')](handleError(_0x3355fb,null));};exports[_0x1c77('0x5b')]=function(_0x20a709,_0xbcc84d){return db[_0x1c77('0x2f')][_0x1c77('0x5b')]()['then'](respondWithResult(_0xbcc84d,null))['catch'](handleError(_0xbcc84d,null));};exports[_0x1c77('0x5c')]=function(_0x181f3a,_0x1e618a){var _0x2b182d=_0x181f3a[_0x1c77('0x52')];return db['UserProfile'][_0x1c77('0x4c')]({'where':{'id':_0x181f3a[_0x1c77('0x47')]['id']}})[_0x1c77('0x28')](handleEntityNotFound(_0x1e618a,null))[_0x1c77('0x28')](function(_0x5310ed){if(_0x5310ed){return db['sequelize'][_0x1c77('0x5d')](function(_0x51fb40){return db[_0x1c77('0x59')]['destroy']({'where':{'userProfileId':_0x181f3a[_0x1c77('0x47')]['id'],'sectionId':_[_0x1c77('0x2e')](_0x2b182d,function(_0x1558ba){return _0x1558ba['sectionId'];})},'transaction':_0x51fb40})[_0x1c77('0x28')](function(){var _0x106348=_[_0x1c77('0x2e')](_0x2b182d,function(_0x3f571e){_0x3f571e[_0x1c77('0x5e')]=_0x181f3a[_0x1c77('0x47')]['id'];return _0x3f571e;});var _0x714254=[];return BPromise[_0x1c77('0x55')](_0x106348,function(_0xd38e4e){return db['UserProfileSection'][_0x1c77('0x49')](_0xd38e4e,{'include':[{'model':db[_0x1c77('0x57')],'as':_0x1c77('0x58')}],'raw':!![],'transaction':_0x51fb40})[_0x1c77('0x28')](function(_0x2300d8){_0x714254[_0x1c77('0x5f')](_0x2300d8[_0x1c77('0x4d')]({'plain':!![]}));});})[_0x1c77('0x28')](function(){return _0x714254;});});});}})[_0x1c77('0x28')](function(_0x1b515f){return _0x1b515f;})[_0x1c77('0x28')](respondWithResult(_0x1e618a,null))[_0x1c77('0x45')](handleError(_0x1e618a,null));};exports[_0x1c77('0x60')]=function(_0x1ee45d,_0x2bc1fe){var _0xf5ac37;return db[_0x1c77('0x2f')]['find']({'where':{'id':_0x1ee45d[_0x1c77('0x47')]['id']},'attributes':['id',_0x1c77('0x2b')]})[_0x1c77('0x28')](handleEntityNotFound(_0x2bc1fe,null))[_0x1c77('0x28')](function(_0x5e0b12){if(_0x5e0b12){_0xf5ac37=_0x5e0b12;return db[_0x1c77('0x59')][_0x1c77('0x5a')]({'where':{'userProfileId':_0x1ee45d[_0x1c77('0x47')]['id'],'sectionId':_0x1ee45d[_0x1c77('0x38')][_0x1c77('0x61')]}});}})[_0x1c77('0x28')](function(){return _0xf5ac37;})[_0x1c77('0x28')](respondWithStatusCode(_0x2bc1fe,null))[_0x1c77('0x45')](handleError(_0x2bc1fe,null));};exports[_0x1c77('0x62')]=function(_0x593a24,_0x5f2cc8){var _0x26ea0b=[];var _0x541f60=[];return db['UserProfileSection'][_0x1c77('0x54')]({'where':{'userProfileId':_0x593a24[_0x1c77('0x47')]['id']},'raw':!![]})[_0x1c77('0x28')](function(_0x454df4){_0x26ea0b=_[_0x1c77('0x40')](_0x454df4,function(_0x28c055){return _0x28c055[_0x1c77('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x28c055[_0x1c77('0x64')]);});if(!_['isEmpty'](_0x26ea0b)){return _[_0x1c77('0x2e')](_0x26ea0b,function(_0x267ae9){return _0x267ae9['sectionId'];});}else{return;}})[_0x1c77('0x28')](function(_0x383ef8){if(_0x383ef8)_0x541f60=_0x383ef8;if(_[_0x1c77('0x65')](_0x541f60,0x64)){var _0x334f2d=_[_0x1c77('0x4c')](_0x26ea0b,{'sectionId':0x64});return hasDefaultDashboard(_0x334f2d)[_0x1c77('0x28')](function(_0x59df22){return _[_0x1c77('0x2e')](_0x26ea0b,function(_0x161b05){if(_0x161b05[_0x1c77('0x64')]===0x64){_0x161b05['subsections']=_0x59df22;}return _0x161b05;});});}else{return;}})[_0x1c77('0x28')](function(_0xa70363){if(_0xa70363)_0x26ea0b=_0xa70363;if(_[_0x1c77('0x65')](_0x541f60,0x3eb)){var _0x40173f=_['find'](_0x26ea0b,{'sectionId':0x3eb});return getCustomDashboards(_0x40173f)['then'](function(_0xb325cf){return _[_0x1c77('0x2e')](_0x26ea0b,function(_0x524836){if(_0x40173f[_0x1c77('0x63')]){if(_0x524836['sectionId']===0x3eb){_0x524836[_0x1c77('0x66')]=_0xb325cf;}}else{if(_0x524836[_0x1c77('0x64')]===0x64){_0x524836[_0x1c77('0x66')]=_0xb325cf;}}return _0x524836;});});}else{return;}})[_0x1c77('0x28')](function(_0x311822){if(_0x311822)_0x26ea0b=_0x311822;if(_[_0x1c77('0x65')](_0x541f60,0x709)){var _0x35efb2=_[_0x1c77('0x4c')](_0x26ea0b,{'sectionId':0x709});return getPlugins(_0x35efb2)[_0x1c77('0x28')](function(_0x5a395c){if(_0x35efb2[_0x1c77('0x63')]){return _[_0x1c77('0x2e')](_0x26ea0b,function(_0x5d4e3e){if(_0x5d4e3e[_0x1c77('0x64')]===0x709){_0x5d4e3e[_0x1c77('0x66')]=_0x5a395c;}return _0x5d4e3e;});}else{var _0x5466d6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5a395c};var _0x5f1cb8=_[_0x1c77('0x2e')](_0x26ea0b);_0x5f1cb8[_0x1c77('0x5f')](_0x5466d6);return _0x5f1cb8;}});}else{return;}})[_0x1c77('0x28')](function(_0x59d1b4){if(_0x59d1b4)_0x26ea0b=_0x59d1b4;return _[_0x1c77('0x40')](_0x26ea0b,[_0x1c77('0x63'),0x1]);})[_0x1c77('0x28')](respondWithResult(_0x5f2cc8,null))['catch'](handleError(_0x5f2cc8,null));};function hasDefaultDashboard(_0x15bde2){var _0x4e8861=[0x65];return new BPromise(function(_0x2cff32,_0x38502b){try{if(_0x15bde2[_0x1c77('0x56')]){_0x2cff32(_0x4e8861);}else{return db['UserProfileResource'][_0x1c77('0x67')]({'where':{'sectionId':_0x15bde2['id']},'raw':!![]})[_0x1c77('0x28')](function(_0x20d00b){_0x20d00b?_0x2cff32(_0x4e8861):_0x2cff32();});}}catch(_0x56669a){_0x38502b(_0x56669a);}});}function getCustomDashboards(_0x2d1a28){var _0x2c2b35=[];return new BPromise(function(_0x5ea2fd,_0x2ee75f){try{if(_0x2d1a28[_0x1c77('0x56')]){return db['Dashboard']['findAll']({'raw':!![]})[_0x1c77('0x28')](function(_0x5be34a){_0x5be34a[_0x1c77('0x68')](function(_0x3d7214){_0x2c2b35['push'](_0x3d7214['id']+0x1869f);});_0x5ea2fd(_0x2c2b35);});}else{return db['UserProfileResource'][_0x1c77('0x54')]({'where':{'sectionId':_0x2d1a28['id']},'raw':!![]})[_0x1c77('0x28')](function(_0x295474){_0x295474[_0x1c77('0x68')](function(_0x327fe5){_0x2c2b35[_0x1c77('0x5f')](_0x327fe5[_0x1c77('0x69')]+0x1869f);});_0x5ea2fd(_0x2c2b35);});}}catch(_0x414af9){_0x2ee75f(_0x414af9);}});}function getPlugins(_0x532c2a){var _0x557d66=[];return new BPromise(function(_0x53b001,_0x48b7fb){try{if(_0x532c2a['autoAssociation']){return db[_0x1c77('0x6a')][_0x1c77('0x54')]({'raw':!![]})[_0x1c77('0x28')](function(_0x5cf7da){_0x5cf7da[_0x1c77('0x68')](function(_0x36bbf8){_0x557d66[_0x1c77('0x5f')](_0x36bbf8['id']+0x15b38);});_0x53b001(_0x557d66);});}else{return db['UserProfileResource'][_0x1c77('0x54')]({'where':{'sectionId':_0x532c2a['id']},'raw':!![]})[_0x1c77('0x28')](function(_0xd0652e){_0xd0652e[_0x1c77('0x68')](function(_0x1f0610){_0x557d66[_0x1c77('0x5f')](_0x1f0610[_0x1c77('0x69')]+0x15b38);});_0x53b001(_0x557d66);});}}catch(_0x77a076){_0x48b7fb(_0x77a076);}});}exports['addResources']=function(_0x3f5462,_0x3cfbd3){return db[_0x1c77('0x2f')][_0x1c77('0x4c')]({'where':{'id':_0x3f5462['params']['id']}})['then'](handleEntityNotFound(_0x3cfbd3,null))[_0x1c77('0x28')](function(_0xdddbae){if(_0xdddbae){return db['sequelize'][_0x1c77('0x5d')](function(_0x122c99){return db[_0x1c77('0x59')][_0x1c77('0x54')]({'where':{'userProfileId':_0x3f5462[_0x1c77('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x188989){if(_0x188989){return db[_0x1c77('0x59')]['destroy']({'where':{'userProfileId':_0x3f5462[_0x1c77('0x47')]['id'],'id':_['map'](_0x188989,function(_0x26fd5b){return _0x26fd5b['id'];})},'transaction':_0x122c99});}})[_0x1c77('0x28')](function(_0x55813d){var _0x5690fa=_[_0x1c77('0x2e')](_0x3f5462[_0x1c77('0x52')],function(_0x403518){_0x403518[_0x1c77('0x5e')]=_0x3f5462[_0x1c77('0x47')]['id'];return _0x403518;});return db['UserProfileSection'][_0x1c77('0x6b')](_0x5690fa,{'raw':!![],'transaction':_0x122c99});})[_0x1c77('0x28')](function(_0x18b65c){var _0x25a85b=_[_0x1c77('0x40')](_['map'](_0x18b65c,function(_0x159a96){return _0x159a96[_0x1c77('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x25a85b){return db[_0x1c77('0x59')][_0x1c77('0x54')]({'where':{'userProfileId':_0x3f5462[_0x1c77('0x47')]['id'],'sectionId':_[_0x1c77('0x2e')](_0x25a85b,function(_0x54e0dc){return _0x54e0dc[_0x1c77('0x64')];})},'attributes':['id',_0x1c77('0x64')],'raw':!![]})[_0x1c77('0x28')](function(_0x548790){var _0xb1b540=_[_0x1c77('0x2e')](_0x3f5462['body'],function(_0x513e62){_0x513e62[_0x1c77('0x5e')]=_0x3f5462['params']['id'];return _0x513e62;});return db['UserProfileResource'][_0x1c77('0x6b')](_0xb1b540,{'raw':!![],'transaction':_0x122c99});});}})[_0x1c77('0x45')](handleError(_0x3cfbd3,null));});}})[_0x1c77('0x28')](function(_0x10c73a){var _0x42d1e1=_[_0x1c77('0x2e')](_0x10c73a,function(_0x131880){return _0x131880[_0x1c77('0x4d')]({'plain':!![]});});})[_0x1c77('0x28')](respondWithResult(_0x3cfbd3,null))['catch'](handleError(_0x3cfbd3,null));};exports[_0x1c77('0x6c')]=function(_0x51081f,_0x220df7,_0x2e132e){return db['UserProfile'][_0x1c77('0x4c')]({'where':{'id':_0x51081f['params']['id']}})[_0x1c77('0x28')](handleEntityNotFound(_0x220df7,null))[_0x1c77('0x28')](function(_0x212ebe){if(_0x212ebe){return _0x212ebe[_0x1c77('0x6c')](_0x51081f[_0x1c77('0x38')][_0x1c77('0x61')]);}})[_0x1c77('0x28')](respondWithStatusCode(_0x220df7,null))[_0x1c77('0x45')](handleError(_0x220df7,null));};exports['getResources']=function(_0x45c496,_0x38b4c4){var _0x1cfea4={'raw':![],'where':{}};var _0x19bc77={};var _0x161fec={'count':0x0,'rows':[]};var _0x2f4f3c=_0x45c496[_0x1c77('0x38')][_0x1c77('0x6d')];if(typeof _0x2f4f3c===_0x1c77('0x6e')){throw new db[(_0x1c77('0x6f'))]['ValidationError'](_0x1c77('0x70'));}var _0x1bfcae=_0x45c496[_0x1c77('0x38')]['mergeResources']||![];var _0x4a5a77=getQueryModels(_0x2f4f3c,_0x1bfcae);if(typeof _0x4a5a77[_0x1c77('0x71')]===_0x1c77('0x6e')){throw new db[(_0x1c77('0x6f'))]['ValidationError'](_0x1c77('0x72')+_0x2f4f3c+'\x27');}var _0x4e99ed=[];if(!_[_0x1c77('0x73')](_0x4a5a77['parentSections'])){_0x4e99ed=_0x4a5a77['parentSections'];}else{_0x4e99ed=[{'name':_0x2f4f3c}];}return db[_0x1c77('0x2f')]['findOne']({'where':{'id':_0x45c496[_0x1c77('0x47')]['id']}})[_0x1c77('0x28')](handleEntityNotFound(_0x38b4c4,null))[_0x1c77('0x28')](function(_0x16f65d){if(_0x16f65d){var _0x87e924=[];for(var _0x4c31d7=0x0;_0x4c31d7<_0x4e99ed[_0x1c77('0x4b')];_0x4c31d7++){_0x87e924['push'](db[_0x1c77('0x59')]['findOne']({'where':{'userProfileId':_0x16f65d['id'],'name':_0x4e99ed[_0x4c31d7][_0x1c77('0x2b')]},'raw':!![]}));}return BPromise['all'](_0x87e924);}})[_0x1c77('0x28')](function(_0x4b39ad){var _0x1bab28=_[_0x1c77('0x40')](_0x4b39ad,function(_0x4adc70){return _0x4adc70?_0x4adc70:undefined;});var _0x29ad07=_['filter'](_0x4e99ed,[_0x1c77('0x74'),!![]]);var _0x4022b5=_[_0x1c77('0x73')](_0x1bab28)&&_[_0x1c77('0x73')](_0x29ad07)?null:_[_0x1c77('0x75')](_0x29ad07,_0x1bab28);if(_0x4022b5){var _0x41bc4c=[];for(var _0x44a88f=0x0;_0x44a88f<_0x4022b5['length'];_0x44a88f++){var _0x289836=_[_0x1c77('0x4c')](_0x4e99ed,function(_0x5c395c){return _0x4022b5[_0x44a88f]?_0x5c395c['name']===_0x4022b5[_0x44a88f][_0x1c77('0x2b')]:null;});if(_0x289836){if(_0x4022b5[_0x44a88f]['ignore']){_0x41bc4c[_0x1c77('0x5f')](getAllResources(_0x4a5a77['childModel'],_0x4022b5[_0x44a88f]));}else{if(!_0x4022b5[_0x44a88f][_0x1c77('0x56')]){_0x41bc4c[_0x1c77('0x5f')](getAllowedResources(_0x289836,_0x4022b5[_0x44a88f],_0x4a5a77[_0x1c77('0x71')]));}else{if(_0x289836[_0x1c77('0x32')]){_0x41bc4c[_0x1c77('0x5f')](getAllFilteredResources(_0x289836,_0x4022b5[_0x44a88f]));}}}}}return BPromise[_0x1c77('0x76')](_0x41bc4c);}else{return null;}})[_0x1c77('0x28')](function(_0x6b5406){var _0x158749=_0x6b5406;var _0x361e0f=null;if(_0x158749){_0x361e0f=_0x158749[_0x1c77('0x4b')]===0x1?_0x158749[0x0]:null;}if(_0x361e0f||_0x158749){var _0x5e50d2=db[_0x4a5a77[_0x1c77('0x71')]][_0x1c77('0x48')];_0x19bc77['model']=_[_0x1c77('0x33')](_0x5e50d2);_0x19bc77[_0x1c77('0x38')]=_[_0x1c77('0x33')](_0x45c496[_0x1c77('0x38')]);_0x19bc77['filters']=_[_0x1c77('0x36')](_0x19bc77[_0x1c77('0x32')],_0x19bc77[_0x1c77('0x38')]);_0x1cfea4[_0x1c77('0x35')]=_['intersection'](_0x19bc77[_0x1c77('0x32')],qs['fields'](_0x45c496['query'][_0x1c77('0x37')]));_0x1cfea4[_0x1c77('0x35')]=_0x1cfea4['attributes'][_0x1c77('0x4b')]?_0x1cfea4[_0x1c77('0x35')]:_0x19bc77[_0x1c77('0x32')];if(!_0x45c496[_0x1c77('0x38')][_0x1c77('0x39')](_0x1c77('0x3a'))){_0x1cfea4[_0x1c77('0x23')]=qs[_0x1c77('0x23')](_0x45c496[_0x1c77('0x38')][_0x1c77('0x23')]);_0x1cfea4['offset']=qs[_0x1c77('0x22')](_0x45c496[_0x1c77('0x38')][_0x1c77('0x22')]);}_0x1cfea4['order']=qs[_0x1c77('0x3c')](_0x45c496['query']['sort']);_0x1cfea4['where']=qs['filters'](_['pick'](_0x45c496['query'],_0x19bc77[_0x1c77('0x34')]));if(_0x45c496[_0x1c77('0x38')][_0x1c77('0x40')]){_0x1cfea4[_0x1c77('0x3d')]=_[_0x1c77('0x3e')](_0x1cfea4['where'],{'$or':_[_0x1c77('0x2e')](_0x5e50d2,function(_0x401141){if(_0x401141[_0x1c77('0x31')][_0x1c77('0x77')]!==_0x1c77('0x3f')){var _0x4dcab3={};_0x4dcab3[_0x401141[_0x1c77('0x78')]]={'$like':'%'+_0x45c496['query'][_0x1c77('0x40')]+'%'};return _0x4dcab3;}})});}var _0x1b752b=[];if(_0x361e0f){var _0x45eaee=_['find'](_0x4e99ed,[_0x1c77('0x2b'),_0x361e0f['name']]);if(_0x45eaee[_0x1c77('0x78')]){var _0x468a38={};if(_0x4a5a77[_0x1c77('0x71')]===_0x1c77('0x79')){_0x468a38[_0x45eaee['foreignKey']]=_['map'](_0x361e0f['associatedResources'],'id');}else{_0x468a38[_0x45eaee[_0x1c77('0x7a')]]=_0x361e0f[_0x1c77('0x7b')];}_0x1b752b[_0x1c77('0x5f')](_0x468a38);}else{_0x1cfea4['where']['id']=_0x361e0f[_0x1c77('0x7b')];}}else{for(var _0x24b6b5=0x0;_0x24b6b5<_0x158749[_0x1c77('0x4b')];_0x24b6b5++){var _0x45eaee=_[_0x1c77('0x4c')](_0x4e99ed,[_0x1c77('0x2b'),_0x158749[_0x24b6b5][_0x1c77('0x2b')]]);if(_0x45eaee[_0x1c77('0x78')]){var _0x468a38={};_0x468a38[_0x45eaee[_0x1c77('0x7a')]]=_0x158749[_0x24b6b5][_0x1c77('0x7b')];_0x1b752b[_0x1c77('0x5f')](_0x468a38);}else{if(!_0x1cfea4[_0x1c77('0x3d')]['id'])_0x1cfea4['where']['id']=[];_0x158749[_0x24b6b5][_0x1c77('0x7b')]['forEach'](function(_0x3321eb){_0x1cfea4['where']['id'][_0x1c77('0x5f')](_0x3321eb);});}}}if(!_[_0x1c77('0x73')](_0x1b752b)){_0x1cfea4[_0x1c77('0x3d')]=_[_0x1c77('0x3e')](_0x1cfea4['where'],{'$and':{'$or':_0x1b752b}});}_0x1cfea4=_[_0x1c77('0x3e')]({},_0x1cfea4,_0x45c496[_0x1c77('0x41')]);if(_0x361e0f&&!_0x361e0f['autoAssociation']&&_0x4a5a77[_0x1c77('0x71')]===_0x1c77('0x79')){if(_0x45c496[_0x1c77('0x38')][_0x1c77('0x43')]){_0x1cfea4[_0x1c77('0x44')]=[{'all':!![]}];}return db[_0x4a5a77['childModel']][_0x1c77('0x54')](_0x1cfea4)[_0x1c77('0x28')](function(_0x1b25d8){var _0x420f33=[];_0x1b25d8['forEach'](function(_0x5b5ecf){var _0x2d3878;switch(_0x5b5ecf[_0x1c77('0x7c')]){case _0x1c77('0x7d'):_0x2d3878=_[_0x1c77('0x4c')](_0x361e0f[_0x1c77('0x7b')],function(_0x43fe72){return _0x43fe72['id']===_0x5b5ecf[_0x1c77('0x7e')]&&_0x43fe72['type']===_0x1c77('0x7f');});break;case'custom':_0x2d3878=_[_0x1c77('0x4c')](_0x361e0f[_0x1c77('0x7b')],function(_0xda7aab){return _0xda7aab['id']===_0x5b5ecf[_0x1c77('0x7e')]&&_0xda7aab['type']==='CustomReports';});break;}if(_0x2d3878)_0x420f33[_0x1c77('0x5f')](_0x5b5ecf);});_0x161fec[_0x1c77('0x42')]=_0x420f33[_0x1c77('0x4b')];_0x161fec[_0x1c77('0x80')]=_0x420f33;return _0x161fec;});}else{return db[_0x4a5a77[_0x1c77('0x71')]][_0x1c77('0x42')]({'where':_0x1cfea4[_0x1c77('0x3d')]})[_0x1c77('0x28')](function(_0x1269d8){_0x161fec[_0x1c77('0x42')]=_0x1269d8;if(_0x45c496[_0x1c77('0x38')][_0x1c77('0x43')]){if(_0x4a5a77[_0x1c77('0x71')]==='CmContact'){_0x1cfea4[_0x1c77('0x44')]=[{'model':db[_0x1c77('0x81')],'as':_0x1c77('0x82'),'attributes':['id',_0x1c77('0x2b'),_0x1c77('0x83')],'required':_0x45c496['query'][_0x1c77('0x84')]?!![]:![]},{'model':db[_0x1c77('0x81')],'as':_0x1c77('0x85'),'attributes':['id',_0x1c77('0x2b'),_0x1c77('0x83')],'through':_0x45c496['query'][_0x1c77('0x84')]?{'attributes':[],'where':{'TagId':_0x45c496[_0x1c77('0x38')][_0x1c77('0x84')]||undefined}}:{},'required':_0x45c496[_0x1c77('0x38')][_0x1c77('0x84')]?!![]:![]}];}else{_0x1cfea4[_0x1c77('0x44')]=[{'all':!![]}];}}return db[_0x4a5a77[_0x1c77('0x71')]][_0x1c77('0x54')](_0x1cfea4);})[_0x1c77('0x28')](function(_0x5b4e2e){_0x161fec['rows']=_0x5b4e2e;return _0x161fec;});}}else{return _0x161fec;}})[_0x1c77('0x28')](respondWithFilteredResult(_0x38b4c4,_0x1cfea4))['catch'](handleError(_0x38b4c4,null));};function getAllResources(_0xdb4854,_0x32cc93){return new BPromise(function(_0x4c387f,_0x3461d9){if(_0x32cc93){var _0x1d1d11=_0x32cc93[_0x1c77('0x40')]?{[_0x32cc93[_0x1c77('0x40')][_0x1c77('0x78')]]:_0x32cc93[_0x1c77('0x40')][_0x1c77('0x86')]}:undefined;return db[_0xdb4854]['findAll']({'where':_0x1d1d11,'raw':!![]})['then'](function(_0xdaa7a7){_0x32cc93[_0x1c77('0x7b')]=_[_0x1c77('0x2e')](_0xdaa7a7,'id');_0x4c387f(_0x32cc93);})[_0x1c77('0x45')](function(_0x569aca){_0x3461d9(_0x569aca);});}else{_0x4c387f(null);}});}function getAllFilteredResources(_0x109dcb,_0x4f25fd){return new BPromise(function(_0xc99f01,_0x14ecfc){var _0x8c3b33=_0x109dcb[_0x1c77('0x40')]?{[_0x109dcb[_0x1c77('0x40')][_0x1c77('0x78')]]:_0x109dcb[_0x1c77('0x40')]['value']}:undefined;return db[_0x109dcb[_0x1c77('0x32')]]['findAll']({'where':_0x8c3b33,'raw':!![]})[_0x1c77('0x28')](function(_0x94036){_0x4f25fd[_0x1c77('0x7b')]=_['map'](_0x94036,function(_0x55fc9d){return _0x55fc9d[_0x1c77('0x2b')];});_0xc99f01(_0x4f25fd);})['catch'](function(_0x408cf4){_0x14ecfc(_0x408cf4);});});}function getAllowedResources(_0xa9cefc,_0x4a504f,_0xec618f){return new BPromise(function(_0x21cbdc,_0x3a3550){if(_0x4a504f){return db[_0x1c77('0x57')][_0x1c77('0x54')]({'where':{'sectionId':_0x4a504f['id']},'raw':!![]})[_0x1c77('0x28')](function(_0xe44f01){if(_0xa9cefc[_0x1c77('0x78')]&&_0xa9cefc['field']!=='id'){_0x4a504f['associatedResources']=_['map'](_0xe44f01,function(_0x4c55a2){return _0x4c55a2[_0xa9cefc[_0x1c77('0x78')]];});}else{if(_0xec618f==='AnalyticExtractedReport'){_0x4a504f[_0x1c77('0x7b')]=_[_0x1c77('0x2e')](_0xe44f01,function(_0x254b76){return{'id':_0x254b76['resourceId'],'type':_0x254b76['type']};});}else{_0x4a504f['associatedResources']=_['map'](_0xe44f01,function(_0x2aea35){return _0x2aea35['resourceId'];});}}_0x21cbdc(_0x4a504f);})['catch'](function(_0x17a7a2){_0x3a3550(_0x17a7a2);});}else{_0x21cbdc(null);}});}function getQueryModels(_0x21ee87,_0x4f0a2a){var _0x4ba548=_0x21ee87[_0x1c77('0x87')]();var _0x10c05d={'childModel':undefined,'parentSections':[]};switch(_0x4ba548){case _0x1c77('0x88'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0x89');break;case _0x1c77('0x8a'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0x8b');break;case'squarerecordings':_0x10c05d[_0x1c77('0x71')]='SquareRecording';_0x10c05d['parentSections']=[{'name':_0x1c77('0x8c'),'field':'name','foreignKey':'projectName'}];break;case _0x1c77('0x8d'):_0x10c05d['childModel']=_0x1c77('0x8e');break;case _0x1c77('0x8f'):_0x10c05d['childModel']='CmContact';_0x10c05d[_0x1c77('0x90')]=[{'name':_0x1c77('0x91'),'field':'id','foreignKey':_0x1c77('0x92')}];break;case _0x1c77('0x93'):_0x10c05d['childModel']='CmList';break;case _0x1c77('0x94'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0x95');break;case _0x1c77('0x96'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0x97');break;case'chatqueues':_0x10c05d['childModel']=_0x1c77('0x98');break;case _0x1c77('0x99'):_0x10c05d[_0x1c77('0x71')]='ChatWebsite';break;case _0x1c77('0x9a'):_0x10c05d[_0x1c77('0x71')]='FaxQueue';break;case _0x1c77('0x9b'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0x9c');break;case _0x1c77('0x9d'):case'internalroutes':case _0x1c77('0x9e'):_0x10c05d['childModel']=_0x1c77('0x9f');break;case'contexts':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xa0');break;case _0x1c77('0xa1'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xa2');break;case'voicerecordings':_0x10c05d[_0x1c77('0x71')]='VoiceRecording';_0x10c05d['parentSections']=[{'name':'Agents','field':_0x1c77('0x2b'),'foreignKey':_0x1c77('0xa3'),'model':'User','filter':{'field':_0x1c77('0xa4'),'value':[_0x1c77('0xa5')]}},{'name':_0x1c77('0xa6'),'field':'name','foreignKey':'membername','model':_0x1c77('0xa7'),'filter':{'field':_0x1c77('0xa4'),'value':[_0x1c77('0xa8')]}},{'name':_0x1c77('0xa9'),'field':_0x1c77('0x2b'),'foreignKey':_0x1c77('0xaa'),'model':_0x1c77('0xab'),'filter':{'field':_0x1c77('0x31'),'value':[_0x1c77('0xac')]}},{'name':'QueueCampaigns','field':_0x1c77('0x2b'),'foreignKey':_0x1c77('0xaa'),'model':_0x1c77('0xab'),'filter':{'field':'type','value':[_0x1c77('0xad')]}}];break;case'musiconholds':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xae');break;case'chanspies':_0x10c05d['childModel']=_0x1c77('0xaf');break;case _0x1c77('0xb0'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xb1');break;case _0x1c77('0xb2'):_0x10c05d['childModel']=_0x1c77('0xb3');break;case _0x1c77('0xb4'):_0x10c05d[_0x1c77('0x71')]='MailQueue';break;case'mailaccounts':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xb5');break;case _0x1c77('0xb6'):_0x10c05d[_0x1c77('0x71')]='MailSubstatus';break;case _0x1c77('0xb7'):_0x10c05d[_0x1c77('0x71')]='OpenchannelQueue';break;case _0x1c77('0xb8'):_0x10c05d[_0x1c77('0x71')]='OpenchannelAccount';break;case _0x1c77('0xb9'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xba');break;case _0x1c77('0xbb'):_0x10c05d[_0x1c77('0x71')]='SmsAccount';break;case _0x1c77('0xbc'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xbd');break;case _0x1c77('0xbe'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xbf');break;case _0x1c77('0xc0'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xc1');break;case _0x1c77('0xc2'):case'queuecampaigns':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xab');if(_0x4f0a2a){_0x10c05d[_0x1c77('0x90')]=[{'name':_0x1c77('0xa9')},{'name':_0x1c77('0xc3')}];}break;case _0x1c77('0xc4'):case'agents':case _0x1c77('0xc5'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xa7');if(_0x4f0a2a){_0x10c05d[_0x1c77('0x90')]=[{'name':_0x1c77('0xc6'),'filter':{'field':_0x1c77('0xa4'),'value':[_0x1c77('0xc7'),'user']},'ignore':!![]},{'name':_0x1c77('0xc8')},{'name':_0x1c77('0xa6')}];}break;case'zendeskaccounts':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xc9');break;case'salesforceaccounts':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xca');break;case _0x1c77('0xcb'):_0x10c05d['childModel']=_0x1c77('0xcc');break;case _0x1c77('0xcd'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xce');break;case _0x1c77('0xcf'):_0x10c05d[_0x1c77('0x71')]='DeskAccount';break;case _0x1c77('0xd0'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xd1');break;case _0x1c77('0xd2'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xa7');break;case _0x1c77('0xd3'):_0x10c05d['childModel']='CannedAnswer';break;case _0x1c77('0xd4'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xd5');break;case'customdashboards':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xd6');break;case'intervals':_0x10c05d[_0x1c77('0x71')]='Interval';break;case _0x1c77('0xd7'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xd8');break;case _0x1c77('0xd9'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xda');break;case _0x1c77('0xdb'):_0x10c05d[_0x1c77('0x71')]='Sound';break;case'tags':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0x81');break;case _0x1c77('0xdc'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xdd');break;case'triggers':_0x10c05d['childModel']=_0x1c77('0xde');break;case _0x1c77('0xdf'):_0x10c05d['childModel']=_0x1c77('0xe0');break;case _0x1c77('0xe1'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xe2');break;case'plugins':_0x10c05d[_0x1c77('0x71')]='Plugin';break;case _0x1c77('0xe3'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0x79');_0x10c05d[_0x1c77('0x90')]=[{'name':_0x1c77('0xe4'),'field':'id','foreignKey':_0x1c77('0x7e')}];break;case'metrics':_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xe5');break;case _0x1c77('0xbe'):_0x10c05d[_0x1c77('0x71')]=_0x1c77('0xbf');break;default:return _0x10c05d;}return _0x10c05d;} \ No newline at end of file +var _0xab5a=['Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','metrics','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','squel','crypto','to-csv','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','stack','name','index','UserProfile','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','length','options','find','body','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','create','get','each','autoAssociation','sectionId','Resources','UserProfileSection','update','params','describe','addSections','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','UserProfileResource','findOne','Dashboard','forEach','resourceId','Plugin','removeResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','field','AnalyticExtractedReport','associatedResources','foreignKey','default','reportId','custom','CmContact','Tag','Tags','color','ThroughTags','tag','value','squareprojects','SquareProject','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','inboundroutes','internalroutes','contexts','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','telephone','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','User','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Schedule','Sound','tags','templates','triggers'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xab5a,0xe4));var _0xaab5=function(_0xc4df01,_0x344cfb){_0xc4df01=_0xc4df01-0x0;var _0x2dd210=_0xab5a[_0xc4df01];return _0x2dd210;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaab5('0x0'));var rimraf=require(_0xaab5('0x1'));var zipdir=require(_0xaab5('0x2'));var jsonpatch=require(_0xaab5('0x3'));var rp=require(_0xaab5('0x4'));var moment=require(_0xaab5('0x5'));var BPromise=require(_0xaab5('0x6'));var Mustache=require(_0xaab5('0x7'));var util=require('util');var path=require(_0xaab5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xaab5('0x9'));var crypto=require(_0xaab5('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaab5('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaab5('0xc'));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(_0xaab5('0xd'))(_0xaab5('0xe'));var utils=require('../../config/utils');var config=require(_0xaab5('0xf'));var db=require(_0xaab5('0x10'))['db'];config['redis']=_['defaults'](config[_0xaab5('0x11')],{'host':_0xaab5('0x12'),'port':0x18eb});var socket=require(_0xaab5('0x13'))(new Redis(config['redis']));require('./userProfile.socket')[_0xaab5('0x14')](socket);function respondWithStatusCode(_0x10f2b2,_0x23f4f2){_0x23f4f2=_0x23f4f2||0xcc;return function(_0x2e160f){if(_0x2e160f){return _0x10f2b2[_0xaab5('0x15')](_0x23f4f2);}return _0x10f2b2[_0xaab5('0x16')](_0x23f4f2)[_0xaab5('0x17')]();};}function respondWithResult(_0x591ff4,_0x3dc0a4){_0x3dc0a4=_0x3dc0a4||0xc8;return function(_0x26112d){if(_0x26112d){return _0x591ff4['status'](_0x3dc0a4)[_0xaab5('0x18')](_0x26112d);}};}function respondWithFilteredResult(_0x431e6c,_0xc17a5e){return function(_0x4fac24){if(_0x4fac24){var _0x4faff7=_0x4fac24[_0xaab5('0x19')],_0x23474f=_0xc17a5e['offset'],_0x4a3176=_0xc17a5e[_0xaab5('0x1a')]+_0xc17a5e['limit'],_0x44dd13;if(_0x4a3176>=_0x4faff7){_0x4a3176=_0x4faff7;_0x44dd13=0xc8;}else{_0x44dd13=0xce;}_0x431e6c[_0xaab5('0x16')](_0x44dd13);return _0x431e6c['set'](_0xaab5('0x1b'),_0x23474f+'-'+_0x4a3176+'/'+_0x4faff7)['json'](_0x4fac24);}return null;};}function patchUpdates(_0x284c72){return function(_0x58dfcb){try{jsonpatch[_0xaab5('0x1c')](_0x58dfcb,_0x284c72,!![]);}catch(_0x22ad22){return BPromise[_0xaab5('0x1d')](_0x22ad22);}return _0x58dfcb[_0xaab5('0x1e')]();};}function saveUpdates(_0x396aa5,_0x1486e8){return function(_0x3359ff){if(_0x3359ff){return _0x3359ff['update'](_0x396aa5)[_0xaab5('0x1f')](function(_0x40d5d8){return _0x40d5d8;});}return null;};}function removeEntity(_0x32c3b7,_0x38ecc1){return function(_0x3b19da){if(_0x3b19da){return _0x3b19da[_0xaab5('0x20')]()[_0xaab5('0x1f')](function(){_0x32c3b7[_0xaab5('0x16')](0xcc)[_0xaab5('0x17')]();});}};}function handleEntityNotFound(_0x3dae19,_0x503228){return function(_0x43835b){if(!_0x43835b){_0x3dae19[_0xaab5('0x15')](0x194);}return _0x43835b;};}function handleError(_0x1b4cf2,_0x59e1da){_0x59e1da=_0x59e1da||0x1f4;return function(_0x1e6f30){logger['error'](_0x1e6f30[_0xaab5('0x21')]);if(_0x1e6f30[_0xaab5('0x22')]){delete _0x1e6f30[_0xaab5('0x22')];}_0x1b4cf2[_0xaab5('0x16')](_0x59e1da)['send'](_0x1e6f30);};}exports[_0xaab5('0x23')]=function(_0x50e5aa,_0x5ac4c3){var _0x20ac06={},_0x308a89={},_0x4a633f={'count':0x0,'rows':[]};var _0x423259=_['map'](db[_0xaab5('0x24')]['rawAttributes'],function(_0x5a7e77){return{'name':_0x5a7e77[_0xaab5('0x25')],'type':_0x5a7e77[_0xaab5('0x26')][_0xaab5('0x27')]};});_0x308a89[_0xaab5('0x28')]=_[_0xaab5('0x29')](_0x423259,'name');_0x308a89['query']=_['keys'](_0x50e5aa[_0xaab5('0x2a')]);_0x308a89[_0xaab5('0x2b')]=_[_0xaab5('0x2c')](_0x308a89[_0xaab5('0x28')],_0x308a89['query']);_0x20ac06[_0xaab5('0x2d')]=_[_0xaab5('0x2c')](_0x308a89[_0xaab5('0x28')],qs['fields'](_0x50e5aa[_0xaab5('0x2a')][_0xaab5('0x2e')]));_0x20ac06[_0xaab5('0x2d')]=_0x20ac06[_0xaab5('0x2d')]['length']?_0x20ac06[_0xaab5('0x2d')]:_0x308a89[_0xaab5('0x28')];if(!_0x50e5aa[_0xaab5('0x2a')][_0xaab5('0x2f')](_0xaab5('0x30'))){_0x20ac06['limit']=qs[_0xaab5('0x31')](_0x50e5aa[_0xaab5('0x2a')]['limit']);_0x20ac06[_0xaab5('0x1a')]=qs['offset'](_0x50e5aa['query'][_0xaab5('0x1a')]);}_0x20ac06[_0xaab5('0x32')]=qs['sort'](_0x50e5aa[_0xaab5('0x2a')][_0xaab5('0x33')]);_0x20ac06[_0xaab5('0x34')]=qs[_0xaab5('0x2b')](_[_0xaab5('0x35')](_0x50e5aa[_0xaab5('0x2a')],_0x308a89[_0xaab5('0x2b')]),_0x423259);if(_0x50e5aa[_0xaab5('0x2a')]['filter']){_0x20ac06[_0xaab5('0x34')]=_[_0xaab5('0x36')](_0x20ac06[_0xaab5('0x34')],{'$or':_[_0xaab5('0x29')](_0x423259,function(_0x5bc0b8){if(_0x5bc0b8[_0xaab5('0x26')]!==_0xaab5('0x37')){var _0x45668b={};_0x45668b[_0x5bc0b8[_0xaab5('0x22')]]={'$like':'%'+_0x50e5aa[_0xaab5('0x2a')][_0xaab5('0x38')]+'%'};return _0x45668b;}})});}_0x20ac06=_[_0xaab5('0x36')]({},_0x20ac06,_0x50e5aa['options']);var _0x5ae34b={'where':_0x20ac06[_0xaab5('0x34')]};return db['UserProfile'][_0xaab5('0x19')](_0x5ae34b)[_0xaab5('0x1f')](function(_0x40694d){_0x4a633f['count']=_0x40694d;if(_0x50e5aa[_0xaab5('0x2a')][_0xaab5('0x39')]){_0x20ac06[_0xaab5('0x3a')]=[{'all':!![]}];}return db[_0xaab5('0x24')][_0xaab5('0x3b')](_0x20ac06);})[_0xaab5('0x1f')](function(_0x5c898a){_0x4a633f[_0xaab5('0x3c')]=_0x5c898a;return _0x4a633f;})[_0xaab5('0x1f')](respondWithFilteredResult(_0x5ac4c3,_0x20ac06))[_0xaab5('0x3d')](handleError(_0x5ac4c3,null));};exports[_0xaab5('0x3e')]=function(_0x2e7704,_0x12d3f1){var _0x538f49={'raw':![],'where':{'id':_0x2e7704['params']['id']}},_0x2cffa0={};_0x2cffa0[_0xaab5('0x28')]=_['keys'](db[_0xaab5('0x24')][_0xaab5('0x3f')]);_0x2cffa0[_0xaab5('0x2a')]=_[_0xaab5('0x40')](_0x2e7704[_0xaab5('0x2a')]);_0x2cffa0['filters']=_[_0xaab5('0x2c')](_0x2cffa0[_0xaab5('0x28')],_0x2cffa0[_0xaab5('0x2a')]);_0x538f49[_0xaab5('0x2d')]=_[_0xaab5('0x2c')](_0x2cffa0[_0xaab5('0x28')],qs[_0xaab5('0x2e')](_0x2e7704['query'][_0xaab5('0x2e')]));_0x538f49[_0xaab5('0x2d')]=_0x538f49[_0xaab5('0x2d')][_0xaab5('0x41')]?_0x538f49[_0xaab5('0x2d')]:_0x2cffa0[_0xaab5('0x28')];if(_0x2e7704[_0xaab5('0x2a')]['includeAll']){_0x538f49['include']=[{'all':!![]}];}_0x538f49=_[_0xaab5('0x36')]({},_0x538f49,_0x2e7704[_0xaab5('0x42')]);return db[_0xaab5('0x24')][_0xaab5('0x43')](_0x538f49)[_0xaab5('0x1f')](handleEntityNotFound(_0x12d3f1,null))[_0xaab5('0x1f')](respondWithResult(_0x12d3f1,null))[_0xaab5('0x3d')](handleError(_0x12d3f1,null));};exports['create']=function(_0xd5d7e9,_0x47e336){return db[_0xaab5('0x24')]['create'](_0xd5d7e9[_0xaab5('0x44')],{})['then'](respondWithResult(_0x47e336,0xc9))[_0xaab5('0x3d')](handleError(_0x47e336,null));};exports[_0xaab5('0x45')]=function(_0x55025a,_0x4fbd14){var _0x35b5e5={'where':{'id':_0x55025a['params']['id']}},_0x15bace={};_0x15bace[_0xaab5('0x28')]=_['keys'](db['UserProfile'][_0xaab5('0x3f')]);_0x35b5e5[_0xaab5('0x2d')]=_['intersection'](_0x15bace[_0xaab5('0x28')],qs[_0xaab5('0x2e')](_0x55025a['query'][_0xaab5('0x2e')]));_0x35b5e5['attributes']=_0x35b5e5[_0xaab5('0x2d')][_0xaab5('0x41')]?_0x35b5e5['attributes']:_0x15bace[_0xaab5('0x28')];if(_0x55025a[_0xaab5('0x2a')]['includeAll']){_0x35b5e5[_0xaab5('0x3a')]=[{'all':!![]}];}_0x35b5e5=_[_0xaab5('0x36')]({},_0x35b5e5,_0x55025a['options']);return db[_0xaab5('0x24')][_0xaab5('0x43')](_0x35b5e5)[_0xaab5('0x1f')](handleEntityNotFound(_0x4fbd14,null))[_0xaab5('0x1f')](function(_0x4ba4ed){if(_0x4ba4ed){var _0x486d59=_0x4ba4ed['get']({'plain':!![]});_0x486d59=qs[_0xaab5('0x46')](_0x486d59,['id',_0xaab5('0x47'),_0xaab5('0x48'),_0xaab5('0x49')]);_0x55025a[_0xaab5('0x44')]=_[_0xaab5('0x46')](_0x55025a[_0xaab5('0x44')],['id',_0xaab5('0x47'),_0xaab5('0x48')]);return db[_0xaab5('0x4a')][_0xaab5('0x4b')](function(_0x341da8){return db[_0xaab5('0x24')][_0xaab5('0x4c')](_['merge'](_0x486d59,_0x55025a[_0xaab5('0x44')]),{'include':_0x55025a[_0xaab5('0x2a')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x341da8})[_0xaab5('0x1f')](function(_0x36c1e5){var _0x35dbaa=_0x36c1e5[_0xaab5('0x4d')]({'plain':!![]});return db['UserProfileSection'][_0xaab5('0x3b')]({'where':{'userProfileId':_0x55025a['params']['id']},'raw':!![]})[_0xaab5('0x1f')](function(_0x368f2f){if(_0x368f2f){return BPromise[_0xaab5('0x4e')](_0x368f2f,function(_0x252da5){return new BPromise(function(_0x5ae96f,_0x427987){if(_0x252da5[_0xaab5('0x4f')]===null||_0x252da5['autoAssociation']===0x1)_0x5ae96f(null);return db['UserProfileResource'][_0xaab5('0x3b')]({'where':{'sectionId':_0x252da5['id']},'raw':!![]})['then'](function(_0xd27ed0){var _0x44cfd9=_[_0xaab5('0x29')](_0xd27ed0,function(_0x9ab8b8){return qs[_0xaab5('0x46')](_0x9ab8b8,['id',_0xaab5('0x47'),'updatedAt',_0xaab5('0x50')]);});_0x5ae96f(_0x44cfd9);})[_0xaab5('0x3d')](function(_0x9ca654){_0x427987(_0x9ca654);});})[_0xaab5('0x1f')](function(_0x567a89){var _0x3f23b2=qs['omit'](_0x252da5,['id',_0xaab5('0x47'),_0xaab5('0x48')]);_0x3f23b2['userProfileId']=_0x35dbaa['id'];if(_0x567a89)_0x3f23b2[_0xaab5('0x51')]=_0x567a89;return _0x3f23b2;})[_0xaab5('0x1f')](function(_0x55bf7c){return db[_0xaab5('0x52')][_0xaab5('0x4c')](_0x55bf7c,{'include':[{'model':db['UserProfileResource'],'as':_0xaab5('0x51')}],'raw':!![],'transaction':_0x341da8});});})[_0xaab5('0x1f')](function(){return _0x35dbaa;});}});});});}})[_0xaab5('0x1f')](respondWithResult(_0x4fbd14,0xc9))[_0xaab5('0x3d')](handleError(_0x4fbd14,null));};exports[_0xaab5('0x53')]=function(_0x285104,_0x3ad9c4){if(_0x285104[_0xaab5('0x44')]['id']){delete _0x285104['body']['id'];}return db['UserProfile'][_0xaab5('0x43')]({'where':{'id':_0x285104[_0xaab5('0x54')]['id']}})['then'](handleEntityNotFound(_0x3ad9c4,null))[_0xaab5('0x1f')](saveUpdates(_0x285104[_0xaab5('0x44')],null))[_0xaab5('0x1f')](respondWithResult(_0x3ad9c4,null))['catch'](handleError(_0x3ad9c4,null));};exports[_0xaab5('0x20')]=function(_0x14514a,_0x159801){return db[_0xaab5('0x24')][_0xaab5('0x43')]({'where':{'id':_0x14514a[_0xaab5('0x54')]['id']}})[_0xaab5('0x1f')](handleEntityNotFound(_0x159801,null))['then'](removeEntity(_0x159801,null))[_0xaab5('0x3d')](handleError(_0x159801,null));};exports['describe']=function(_0x42e83a,_0x47258c){return db['UserProfile'][_0xaab5('0x55')]()['then'](respondWithResult(_0x47258c,null))['catch'](handleError(_0x47258c,null));};exports[_0xaab5('0x56')]=function(_0x1dd075,_0x29bbf1){var _0x106079=_0x1dd075[_0xaab5('0x44')];return db['UserProfile'][_0xaab5('0x43')]({'where':{'id':_0x1dd075[_0xaab5('0x54')]['id']}})['then'](handleEntityNotFound(_0x29bbf1,null))[_0xaab5('0x1f')](function(_0x2d693c){if(_0x2d693c){return db['sequelize'][_0xaab5('0x4b')](function(_0x2c2b88){return db['UserProfileSection'][_0xaab5('0x20')]({'where':{'userProfileId':_0x1dd075[_0xaab5('0x54')]['id'],'sectionId':_['map'](_0x106079,function(_0x26076f){return _0x26076f[_0xaab5('0x50')];})},'transaction':_0x2c2b88})['then'](function(){var _0x122dee=_[_0xaab5('0x29')](_0x106079,function(_0x249aac){_0x249aac[_0xaab5('0x57')]=_0x1dd075[_0xaab5('0x54')]['id'];return _0x249aac;});var _0x30921b=[];return BPromise[_0xaab5('0x4e')](_0x122dee,function(_0x58dd5b){return db['UserProfileSection'][_0xaab5('0x4c')](_0x58dd5b,{'include':[{'model':db['UserProfileResource'],'as':_0xaab5('0x51')}],'raw':!![],'transaction':_0x2c2b88})[_0xaab5('0x1f')](function(_0x67118a){_0x30921b[_0xaab5('0x58')](_0x67118a[_0xaab5('0x4d')]({'plain':!![]}));});})[_0xaab5('0x1f')](function(){return _0x30921b;});});});}})[_0xaab5('0x1f')](function(_0x41766c){return _0x41766c;})['then'](respondWithResult(_0x29bbf1,null))['catch'](handleError(_0x29bbf1,null));};exports[_0xaab5('0x59')]=function(_0xe8f9b4,_0x3dfca0){var _0x2a6620;return db[_0xaab5('0x24')]['find']({'where':{'id':_0xe8f9b4[_0xaab5('0x54')]['id']},'attributes':['id',_0xaab5('0x22')]})[_0xaab5('0x1f')](handleEntityNotFound(_0x3dfca0,null))[_0xaab5('0x1f')](function(_0x3e37f0){if(_0x3e37f0){_0x2a6620=_0x3e37f0;return db[_0xaab5('0x52')][_0xaab5('0x20')]({'where':{'userProfileId':_0xe8f9b4[_0xaab5('0x54')]['id'],'sectionId':_0xe8f9b4[_0xaab5('0x2a')][_0xaab5('0x5a')]}});}})[_0xaab5('0x1f')](function(){return _0x2a6620;})[_0xaab5('0x1f')](respondWithStatusCode(_0x3dfca0,null))[_0xaab5('0x3d')](handleError(_0x3dfca0,null));};exports[_0xaab5('0x5b')]=function(_0x245657,_0x2fd75d){var _0x3c33bd=[];var _0x4b59e6=[];return db['UserProfileSection'][_0xaab5('0x3b')]({'where':{'userProfileId':_0x245657[_0xaab5('0x54')]['id']},'raw':!![]})[_0xaab5('0x1f')](function(_0x5d6432){_0x3c33bd=_[_0xaab5('0x38')](_0x5d6432,function(_0x20a266){return _0x20a266[_0xaab5('0x5c')]===0x1||_[_0xaab5('0x5d')]([0x3eb,0x709],_0x20a266[_0xaab5('0x50')]);});if(!_[_0xaab5('0x5e')](_0x3c33bd)){return _[_0xaab5('0x29')](_0x3c33bd,function(_0x48c7db){return _0x48c7db['sectionId'];});}else{return;}})['then'](function(_0xb2b137){if(_0xb2b137)_0x4b59e6=_0xb2b137;if(_[_0xaab5('0x5d')](_0x4b59e6,0x64)){var _0x4549f2=_[_0xaab5('0x43')](_0x3c33bd,{'sectionId':0x64});return hasDefaultDashboard(_0x4549f2)[_0xaab5('0x1f')](function(_0x5a88b6){return _[_0xaab5('0x29')](_0x3c33bd,function(_0x1f56df){if(_0x1f56df[_0xaab5('0x50')]===0x64){_0x1f56df[_0xaab5('0x5f')]=_0x5a88b6;}return _0x1f56df;});});}else{return;}})[_0xaab5('0x1f')](function(_0x5aef49){if(_0x5aef49)_0x3c33bd=_0x5aef49;if(_['includes'](_0x4b59e6,0x3eb)){var _0x2434a2=_['find'](_0x3c33bd,{'sectionId':0x3eb});return getCustomDashboards(_0x2434a2)[_0xaab5('0x1f')](function(_0x510168){return _['map'](_0x3c33bd,function(_0x393827){if(_0x2434a2['enabled']){if(_0x393827[_0xaab5('0x50')]===0x3eb){_0x393827[_0xaab5('0x5f')]=_0x510168;}}else{if(_0x393827[_0xaab5('0x50')]===0x64){_0x393827[_0xaab5('0x5f')]=_0x510168;}}return _0x393827;});});}else{return;}})[_0xaab5('0x1f')](function(_0x47d032){if(_0x47d032)_0x3c33bd=_0x47d032;if(_[_0xaab5('0x5d')](_0x4b59e6,0x709)){var _0xa8c669=_[_0xaab5('0x43')](_0x3c33bd,{'sectionId':0x709});return getPlugins(_0xa8c669)[_0xaab5('0x1f')](function(_0x300031){if(_0xa8c669[_0xaab5('0x5c')]){return _['map'](_0x3c33bd,function(_0x54b936){if(_0x54b936[_0xaab5('0x50')]===0x709){_0x54b936[_0xaab5('0x5f')]=_0x300031;}return _0x54b936;});}else{var _0x3d3e8c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x300031};var _0x230248=_[_0xaab5('0x29')](_0x3c33bd);_0x230248[_0xaab5('0x58')](_0x3d3e8c);return _0x230248;}});}else{return;}})[_0xaab5('0x1f')](function(_0x13624e){if(_0x13624e)_0x3c33bd=_0x13624e;return _['filter'](_0x3c33bd,[_0xaab5('0x5c'),0x1]);})[_0xaab5('0x1f')](respondWithResult(_0x2fd75d,null))[_0xaab5('0x3d')](handleError(_0x2fd75d,null));};function hasDefaultDashboard(_0x2dc4c1){var _0x5aa42f=[0x65];return new BPromise(function(_0x22c5c0,_0x49c0aa){try{if(_0x2dc4c1[_0xaab5('0x4f')]){_0x22c5c0(_0x5aa42f);}else{return db[_0xaab5('0x60')][_0xaab5('0x61')]({'where':{'sectionId':_0x2dc4c1['id']},'raw':!![]})[_0xaab5('0x1f')](function(_0x4254eb){_0x4254eb?_0x22c5c0(_0x5aa42f):_0x22c5c0();});}}catch(_0x2b455d){_0x49c0aa(_0x2b455d);}});}function getCustomDashboards(_0x105f9f){var _0x1b5391=[];return new BPromise(function(_0x53c6e2,_0x72b458){try{if(_0x105f9f[_0xaab5('0x4f')]){return db[_0xaab5('0x62')][_0xaab5('0x3b')]({'raw':!![]})[_0xaab5('0x1f')](function(_0x3907a1){_0x3907a1[_0xaab5('0x63')](function(_0x30e824){_0x1b5391[_0xaab5('0x58')](_0x30e824['id']+0x1869f);});_0x53c6e2(_0x1b5391);});}else{return db[_0xaab5('0x60')][_0xaab5('0x3b')]({'where':{'sectionId':_0x105f9f['id']},'raw':!![]})[_0xaab5('0x1f')](function(_0x53402b){_0x53402b[_0xaab5('0x63')](function(_0x5d4fa2){_0x1b5391[_0xaab5('0x58')](_0x5d4fa2[_0xaab5('0x64')]+0x1869f);});_0x53c6e2(_0x1b5391);});}}catch(_0x5880e5){_0x72b458(_0x5880e5);}});}function getPlugins(_0x1b15ac){var _0x2e59c0=[];return new BPromise(function(_0x173675,_0x531054){try{if(_0x1b15ac[_0xaab5('0x4f')]){return db[_0xaab5('0x65')][_0xaab5('0x3b')]({'raw':!![]})[_0xaab5('0x1f')](function(_0x5e99c8){_0x5e99c8[_0xaab5('0x63')](function(_0x39f331){_0x2e59c0[_0xaab5('0x58')](_0x39f331['id']+0x15b38);});_0x173675(_0x2e59c0);});}else{return db[_0xaab5('0x60')][_0xaab5('0x3b')]({'where':{'sectionId':_0x1b15ac['id']},'raw':!![]})['then'](function(_0x2a6c06){_0x2a6c06[_0xaab5('0x63')](function(_0x1e44d1){_0x2e59c0['push'](_0x1e44d1[_0xaab5('0x64')]+0x15b38);});_0x173675(_0x2e59c0);});}}catch(_0x2d3b09){_0x531054(_0x2d3b09);}});}exports['addResources']=function(_0x41f92a,_0x4269d3){return db[_0xaab5('0x24')][_0xaab5('0x43')]({'where':{'id':_0x41f92a[_0xaab5('0x54')]['id']}})[_0xaab5('0x1f')](handleEntityNotFound(_0x4269d3,null))[_0xaab5('0x1f')](function(_0x1341f5){if(_0x1341f5){return db[_0xaab5('0x4a')][_0xaab5('0x4b')](function(_0x9541d9){return db[_0xaab5('0x52')][_0xaab5('0x3b')]({'where':{'userProfileId':_0x41f92a['params']['id']},'attributes':['id'],'raw':!![]})[_0xaab5('0x1f')](function(_0x516538){if(_0x516538){return db[_0xaab5('0x52')][_0xaab5('0x20')]({'where':{'userProfileId':_0x41f92a['params']['id'],'id':_[_0xaab5('0x29')](_0x516538,function(_0x4ab66a){return _0x4ab66a['id'];})},'transaction':_0x9541d9});}})['then'](function(_0x31e872){var _0x295136=_[_0xaab5('0x29')](_0x41f92a['body'],function(_0x3759fa){_0x3759fa[_0xaab5('0x57')]=_0x41f92a[_0xaab5('0x54')]['id'];return _0x3759fa;});return db[_0xaab5('0x52')]['bulkCreate'](_0x295136,{'raw':!![],'transaction':_0x9541d9});})[_0xaab5('0x1f')](function(_0x202838){var _0x4e757e=_[_0xaab5('0x38')](_[_0xaab5('0x29')](_0x202838,function(_0x463eb6){return _0x463eb6['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4e757e){return db[_0xaab5('0x52')][_0xaab5('0x3b')]({'where':{'userProfileId':_0x41f92a[_0xaab5('0x54')]['id'],'sectionId':_[_0xaab5('0x29')](_0x4e757e,function(_0x3d0529){return _0x3d0529[_0xaab5('0x50')];})},'attributes':['id',_0xaab5('0x50')],'raw':!![]})[_0xaab5('0x1f')](function(_0x25370e){var _0x52bbc5=_[_0xaab5('0x29')](_0x41f92a[_0xaab5('0x44')],function(_0x2eee3f){_0x2eee3f[_0xaab5('0x57')]=_0x41f92a['params']['id'];return _0x2eee3f;});return db[_0xaab5('0x60')]['bulkCreate'](_0x52bbc5,{'raw':!![],'transaction':_0x9541d9});});}})['catch'](handleError(_0x4269d3,null));});}})[_0xaab5('0x1f')](function(_0x50b9e2){var _0xaa01b1=_[_0xaab5('0x29')](_0x50b9e2,function(_0x4e92dc){return _0x4e92dc[_0xaab5('0x4d')]({'plain':!![]});});})[_0xaab5('0x1f')](respondWithResult(_0x4269d3,null))[_0xaab5('0x3d')](handleError(_0x4269d3,null));};exports[_0xaab5('0x66')]=function(_0x39c307,_0x475182,_0x317cae){return db[_0xaab5('0x24')][_0xaab5('0x43')]({'where':{'id':_0x39c307[_0xaab5('0x54')]['id']}})[_0xaab5('0x1f')](handleEntityNotFound(_0x475182,null))[_0xaab5('0x1f')](function(_0x2dc516){if(_0x2dc516){return _0x2dc516[_0xaab5('0x66')](_0x39c307[_0xaab5('0x2a')]['ids']);}})['then'](respondWithStatusCode(_0x475182,null))['catch'](handleError(_0x475182,null));};exports['getResources']=function(_0x37cf5e,_0x5b1196){var _0x59cd21={'raw':![],'where':{}};var _0x82cbce={};var _0x522393={'count':0x0,'rows':[]};var _0x1c7713=_0x37cf5e[_0xaab5('0x2a')]['section'];if(typeof _0x1c7713===_0xaab5('0x67')){throw new db[(_0xaab5('0x68'))][(_0xaab5('0x69'))](_0xaab5('0x6a'));}var _0x106f18=_0x37cf5e['query'][_0xaab5('0x6b')]||![];var _0x38265c=getQueryModels(_0x1c7713,_0x106f18);if(typeof _0x38265c[_0xaab5('0x6c')]===_0xaab5('0x67')){throw new db[(_0xaab5('0x68'))][(_0xaab5('0x69'))](_0xaab5('0x6d')+_0x1c7713+'\x27');}var _0x20cb83=[];if(!_[_0xaab5('0x5e')](_0x38265c[_0xaab5('0x6e')])){_0x20cb83=_0x38265c['parentSections'];}else{_0x20cb83=[{'name':_0x1c7713}];}return db['UserProfile'][_0xaab5('0x61')]({'where':{'id':_0x37cf5e[_0xaab5('0x54')]['id']}})[_0xaab5('0x1f')](handleEntityNotFound(_0x5b1196,null))['then'](function(_0x5fdde1){if(_0x5fdde1){var _0x2e6dc5=[];for(var _0x593924=0x0;_0x593924<_0x20cb83['length'];_0x593924++){_0x2e6dc5[_0xaab5('0x58')](db[_0xaab5('0x52')][_0xaab5('0x61')]({'where':{'userProfileId':_0x5fdde1['id'],'name':_0x20cb83[_0x593924]['name']},'raw':!![]}));}return BPromise[_0xaab5('0x6f')](_0x2e6dc5);}})[_0xaab5('0x1f')](function(_0x464e3d){var _0x371e38=_[_0xaab5('0x38')](_0x464e3d,function(_0x292fbc){return _0x292fbc?_0x292fbc:undefined;});var _0x3efbd6=_[_0xaab5('0x38')](_0x20cb83,[_0xaab5('0x70'),!![]]);var _0x1dc327=_[_0xaab5('0x5e')](_0x371e38)&&_[_0xaab5('0x5e')](_0x3efbd6)?null:_[_0xaab5('0x71')](_0x3efbd6,_0x371e38);if(_0x1dc327){var _0x95a5a6=[];for(var _0x594147=0x0;_0x594147<_0x1dc327['length'];_0x594147++){var _0x2e3786=_['find'](_0x20cb83,function(_0x2bb13b){return _0x1dc327[_0x594147]?_0x2bb13b[_0xaab5('0x22')]===_0x1dc327[_0x594147][_0xaab5('0x22')]:null;});if(_0x2e3786){if(_0x1dc327[_0x594147][_0xaab5('0x70')]){_0x95a5a6[_0xaab5('0x58')](getAllResources(_0x38265c[_0xaab5('0x6c')],_0x1dc327[_0x594147]));}else{if(!_0x1dc327[_0x594147][_0xaab5('0x4f')]){_0x95a5a6['push'](getAllowedResources(_0x2e3786,_0x1dc327[_0x594147],_0x38265c['childModel']));}else{if(_0x2e3786[_0xaab5('0x28')]){_0x95a5a6[_0xaab5('0x58')](getAllFilteredResources(_0x2e3786,_0x1dc327[_0x594147]));}}}}}return BPromise[_0xaab5('0x6f')](_0x95a5a6);}else{return null;}})[_0xaab5('0x1f')](function(_0x3c89ed){var _0x2fee59=_0x3c89ed;var _0x4bb47a=null;if(_0x2fee59){_0x4bb47a=_0x2fee59['length']===0x1?_0x2fee59[0x0]:null;}if(_0x4bb47a||_0x2fee59){var _0x4b1e6d=db[_0x38265c['childModel']]['rawAttributes'];_0x82cbce[_0xaab5('0x28')]=_[_0xaab5('0x40')](_0x4b1e6d);_0x82cbce[_0xaab5('0x2a')]=_[_0xaab5('0x40')](_0x37cf5e[_0xaab5('0x2a')]);_0x82cbce[_0xaab5('0x2b')]=_['intersection'](_0x82cbce[_0xaab5('0x28')],_0x82cbce[_0xaab5('0x2a')]);_0x59cd21[_0xaab5('0x2d')]=_['intersection'](_0x82cbce[_0xaab5('0x28')],qs['fields'](_0x37cf5e[_0xaab5('0x2a')][_0xaab5('0x2e')]));_0x59cd21[_0xaab5('0x2d')]=_0x59cd21[_0xaab5('0x2d')][_0xaab5('0x41')]?_0x59cd21[_0xaab5('0x2d')]:_0x82cbce[_0xaab5('0x28')];if(!_0x37cf5e[_0xaab5('0x2a')]['hasOwnProperty']('nolimit')){_0x59cd21['limit']=qs[_0xaab5('0x31')](_0x37cf5e['query']['limit']);_0x59cd21[_0xaab5('0x1a')]=qs[_0xaab5('0x1a')](_0x37cf5e[_0xaab5('0x2a')][_0xaab5('0x1a')]);}_0x59cd21[_0xaab5('0x32')]=qs[_0xaab5('0x33')](_0x37cf5e['query']['sort']);_0x59cd21['where']=qs[_0xaab5('0x2b')](_['pick'](_0x37cf5e[_0xaab5('0x2a')],_0x82cbce[_0xaab5('0x2b')]));if(_0x37cf5e[_0xaab5('0x2a')]['filter']){_0x59cd21[_0xaab5('0x34')]=_[_0xaab5('0x36')](_0x59cd21[_0xaab5('0x34')],{'$or':_[_0xaab5('0x29')](_0x4b1e6d,function(_0x411ad4){if(_0x411ad4['type'][_0xaab5('0x27')]!=='VIRTUAL'){var _0xcc9fe={};_0xcc9fe[_0x411ad4[_0xaab5('0x72')]]={'$like':'%'+_0x37cf5e[_0xaab5('0x2a')]['filter']+'%'};return _0xcc9fe;}})});}var _0x423b62=[];if(_0x4bb47a){var _0x2c6e23=_['find'](_0x20cb83,[_0xaab5('0x22'),_0x4bb47a[_0xaab5('0x22')]]);if(_0x2c6e23[_0xaab5('0x72')]){var _0x4550c7={};if(_0x38265c[_0xaab5('0x6c')]===_0xaab5('0x73')){_0x4550c7[_0x2c6e23['foreignKey']]=_[_0xaab5('0x29')](_0x4bb47a[_0xaab5('0x74')],'id');}else{_0x4550c7[_0x2c6e23[_0xaab5('0x75')]]=_0x4bb47a[_0xaab5('0x74')];}_0x423b62[_0xaab5('0x58')](_0x4550c7);}else{_0x59cd21['where']['id']=_0x4bb47a[_0xaab5('0x74')];}}else{for(var _0xae82ac=0x0;_0xae82ac<_0x2fee59[_0xaab5('0x41')];_0xae82ac++){var _0x2c6e23=_[_0xaab5('0x43')](_0x20cb83,['name',_0x2fee59[_0xae82ac][_0xaab5('0x22')]]);if(_0x2c6e23[_0xaab5('0x72')]){var _0x4550c7={};_0x4550c7[_0x2c6e23['foreignKey']]=_0x2fee59[_0xae82ac]['associatedResources'];_0x423b62[_0xaab5('0x58')](_0x4550c7);}else{if(!_0x59cd21[_0xaab5('0x34')]['id'])_0x59cd21[_0xaab5('0x34')]['id']=[];_0x2fee59[_0xae82ac][_0xaab5('0x74')]['forEach'](function(_0x17d1c8){_0x59cd21[_0xaab5('0x34')]['id'][_0xaab5('0x58')](_0x17d1c8);});}}}if(!_['isEmpty'](_0x423b62)){_0x59cd21['where']=_[_0xaab5('0x36')](_0x59cd21[_0xaab5('0x34')],{'$and':{'$or':_0x423b62}});}_0x59cd21=_[_0xaab5('0x36')]({},_0x59cd21,_0x37cf5e[_0xaab5('0x42')]);if(_0x4bb47a&&!_0x4bb47a[_0xaab5('0x4f')]&&_0x38265c['childModel']==='AnalyticExtractedReport'){if(_0x37cf5e['query'][_0xaab5('0x39')]){_0x59cd21['include']=[{'all':!![]}];}return db[_0x38265c['childModel']][_0xaab5('0x3b')](_0x59cd21)['then'](function(_0x52cc39){var _0x4360c7=[];_0x52cc39[_0xaab5('0x63')](function(_0x78cb22){var _0xcd0e56;switch(_0x78cb22['reportType']){case _0xaab5('0x76'):_0xcd0e56=_[_0xaab5('0x43')](_0x4bb47a[_0xaab5('0x74')],function(_0x45b1c2){return _0x45b1c2['id']===_0x78cb22[_0xaab5('0x77')]&&_0x45b1c2[_0xaab5('0x26')]==='DefaultReports';});break;case _0xaab5('0x78'):_0xcd0e56=_[_0xaab5('0x43')](_0x4bb47a[_0xaab5('0x74')],function(_0x244c82){return _0x244c82['id']===_0x78cb22['reportId']&&_0x244c82[_0xaab5('0x26')]==='CustomReports';});break;}if(_0xcd0e56)_0x4360c7[_0xaab5('0x58')](_0x78cb22);});_0x522393['count']=_0x4360c7[_0xaab5('0x41')];_0x522393[_0xaab5('0x3c')]=_0x4360c7;return _0x522393;});}else{return db[_0x38265c[_0xaab5('0x6c')]][_0xaab5('0x19')]({'where':_0x59cd21[_0xaab5('0x34')]})['then'](function(_0xee7b40){_0x522393['count']=_0xee7b40;if(_0x37cf5e[_0xaab5('0x2a')][_0xaab5('0x39')]){if(_0x38265c['childModel']===_0xaab5('0x79')){_0x59cd21[_0xaab5('0x3a')]=[{'model':db[_0xaab5('0x7a')],'as':_0xaab5('0x7b'),'attributes':['id',_0xaab5('0x22'),_0xaab5('0x7c')],'required':_0x37cf5e['query']['tag']?!![]:![]},{'model':db[_0xaab5('0x7a')],'as':_0xaab5('0x7d'),'attributes':['id',_0xaab5('0x22'),_0xaab5('0x7c')],'through':_0x37cf5e[_0xaab5('0x2a')]['tag']?{'attributes':[],'where':{'TagId':_0x37cf5e['query'][_0xaab5('0x7e')]||undefined}}:{},'required':_0x37cf5e[_0xaab5('0x2a')]['tag']?!![]:![]}];}else{_0x59cd21[_0xaab5('0x3a')]=[{'all':!![]}];}}return db[_0x38265c[_0xaab5('0x6c')]][_0xaab5('0x3b')](_0x59cd21);})[_0xaab5('0x1f')](function(_0x4f07ea){_0x522393['rows']=_0x4f07ea;return _0x522393;});}}else{return _0x522393;}})['then'](respondWithFilteredResult(_0x5b1196,_0x59cd21))['catch'](handleError(_0x5b1196,null));};function getAllResources(_0x192ac0,_0x1abc58){return new BPromise(function(_0x4e9351,_0x14cf5e){if(_0x1abc58){var _0x37af2d=_0x1abc58[_0xaab5('0x38')]?{[_0x1abc58[_0xaab5('0x38')]['field']]:_0x1abc58['filter'][_0xaab5('0x7f')]}:undefined;return db[_0x192ac0][_0xaab5('0x3b')]({'where':_0x37af2d,'raw':!![]})['then'](function(_0x520933){_0x1abc58[_0xaab5('0x74')]=_[_0xaab5('0x29')](_0x520933,'id');_0x4e9351(_0x1abc58);})[_0xaab5('0x3d')](function(_0x451dd3){_0x14cf5e(_0x451dd3);});}else{_0x4e9351(null);}});}function getAllFilteredResources(_0x1a9fb0,_0x5ef1a7){return new BPromise(function(_0x5774b7,_0x42cc89){var _0x3f5161=_0x1a9fb0[_0xaab5('0x38')]?{[_0x1a9fb0[_0xaab5('0x38')][_0xaab5('0x72')]]:_0x1a9fb0['filter']['value']}:undefined;return db[_0x1a9fb0[_0xaab5('0x28')]][_0xaab5('0x3b')]({'where':_0x3f5161,'raw':!![]})['then'](function(_0x192f2e){_0x5ef1a7['associatedResources']=_[_0xaab5('0x29')](_0x192f2e,function(_0x5f2f21){return _0x5f2f21['name'];});_0x5774b7(_0x5ef1a7);})[_0xaab5('0x3d')](function(_0x31714d){_0x42cc89(_0x31714d);});});}function getAllowedResources(_0x2c8700,_0x3ed5e5,_0x3f79cd){return new BPromise(function(_0x415ceb,_0x27db32){if(_0x3ed5e5){return db[_0xaab5('0x60')]['findAll']({'where':{'sectionId':_0x3ed5e5['id']},'raw':!![]})[_0xaab5('0x1f')](function(_0x1f556f){if(_0x2c8700[_0xaab5('0x72')]&&_0x2c8700[_0xaab5('0x72')]!=='id'){_0x3ed5e5['associatedResources']=_['map'](_0x1f556f,function(_0x34b8ac){return _0x34b8ac[_0x2c8700[_0xaab5('0x72')]];});}else{if(_0x3f79cd===_0xaab5('0x73')){_0x3ed5e5['associatedResources']=_['map'](_0x1f556f,function(_0x3548f4){return{'id':_0x3548f4[_0xaab5('0x64')],'type':_0x3548f4['type']};});}else{_0x3ed5e5['associatedResources']=_['map'](_0x1f556f,function(_0x5718d8){return _0x5718d8[_0xaab5('0x64')];});}}_0x415ceb(_0x3ed5e5);})[_0xaab5('0x3d')](function(_0x36c698){_0x27db32(_0x36c698);});}else{_0x415ceb(null);}});}function getQueryModels(_0x322081,_0x57e1b9){var _0x2982d7=_0x322081['toLowerCase']();var _0x845ed8={'childModel':undefined,'parentSections':[]};switch(_0x2982d7){case _0xaab5('0x80'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x81');break;case'odbc':_0x845ed8['childModel']='SquareOdbc';break;case _0xaab5('0x82'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x83');_0x845ed8[_0xaab5('0x6e')]=[{'name':'SquareProjects','field':_0xaab5('0x22'),'foreignKey':_0xaab5('0x84')}];break;case _0xaab5('0x85'):_0x845ed8['childModel']=_0xaab5('0x86');break;case _0xaab5('0x87'):_0x845ed8[_0xaab5('0x6c')]='CmContact';_0x845ed8['parentSections']=[{'name':_0xaab5('0x88'),'field':'id','foreignKey':_0xaab5('0x89')}];break;case _0xaab5('0x8a'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x8b');break;case _0xaab5('0x8c'):_0x845ed8[_0xaab5('0x6c')]='CmCompany';break;case'globalcustomfields':_0x845ed8[_0xaab5('0x6c')]='CmCustomField';break;case _0xaab5('0x8d'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x8e');break;case _0xaab5('0x8f'):_0x845ed8['childModel']=_0xaab5('0x90');break;case _0xaab5('0x91'):_0x845ed8['childModel']='FaxQueue';break;case'faxaccounts':_0x845ed8[_0xaab5('0x6c')]='FaxAccount';break;case _0xaab5('0x92'):case _0xaab5('0x93'):case'outboundroutes':_0x845ed8[_0xaab5('0x6c')]='VoiceExtension';break;case _0xaab5('0x94'):_0x845ed8['childModel']='VoiceContext';break;case'voicemails':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x95');break;case _0xaab5('0x96'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x97');_0x845ed8['parentSections']=[{'name':_0xaab5('0x98'),'field':_0xaab5('0x22'),'foreignKey':_0xaab5('0x99'),'model':'User','filter':{'field':_0xaab5('0x9a'),'value':[_0xaab5('0x9b')]}},{'name':_0xaab5('0x9c'),'field':'name','foreignKey':_0xaab5('0x99'),'model':'User','filter':{'field':_0xaab5('0x9a'),'value':[_0xaab5('0x9d')]}},{'name':'VoiceQueues','field':_0xaab5('0x22'),'foreignKey':_0xaab5('0x9e'),'model':_0xaab5('0x9f'),'filter':{'field':_0xaab5('0x26'),'value':['inbound']}},{'name':_0xaab5('0xa0'),'field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xaab5('0x26'),'value':[_0xaab5('0xa1')]}}];break;case _0xaab5('0xa2'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xa3');break;case'chanspies':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xa4');break;case _0xaab5('0xa5'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xa6');break;case'ivrcampaigns':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xa7');break;case _0xaab5('0xa8'):_0x845ed8[_0xaab5('0x6c')]='MailQueue';break;case _0xaab5('0xa9'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xaa');break;case _0xaab5('0xab'):_0x845ed8[_0xaab5('0x6c')]='MailSubstatus';break;case _0xaab5('0xac'):_0x845ed8['childModel']=_0xaab5('0xad');break;case _0xaab5('0xae'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xaf');break;case'smsqueues':_0x845ed8[_0xaab5('0x6c')]='SmsQueue';break;case _0xaab5('0xb0'):_0x845ed8[_0xaab5('0x6c')]='SmsAccount';break;case'whatsappqueues':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xb1');break;case _0xaab5('0xb2'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xb3');break;case'teams':_0x845ed8[_0xaab5('0x6c')]='Team';break;case _0xaab5('0xb4'):case _0xaab5('0xb5'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x9f');if(_0x57e1b9){_0x845ed8[_0xaab5('0x6e')]=[{'name':_0xaab5('0xb6')},{'name':'QueueCampaigns'}];}break;case _0xaab5('0xb7'):case _0xaab5('0xb8'):case _0xaab5('0xb9'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xba');if(_0x57e1b9){_0x845ed8[_0xaab5('0x6e')]=[{'name':'Users','filter':{'field':_0xaab5('0x9a'),'value':['admin','user']},'ignore':!![]},{'name':_0xaab5('0x98')},{'name':'Telephones'}];}break;case _0xaab5('0xbb'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xbc');break;case _0xaab5('0xbd'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xbe');break;case'freshdeskaccounts':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xbf');break;case _0xaab5('0xc0'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xc1');break;case'deskaccounts':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xc2');break;case _0xaab5('0xc3'):_0x845ed8['childModel']=_0xaab5('0xc4');break;case _0xaab5('0xc5'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xba');break;case'cannedanswers':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xc6');break;case _0xaab5('0xc7'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xc8');break;case _0xaab5('0xc9'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x62');break;case _0xaab5('0xca'):_0x845ed8['childModel']=_0xaab5('0xcb');break;case _0xaab5('0xcc'):_0x845ed8[_0xaab5('0x6c')]='Pause';break;case'scheduler':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xcd');break;case'sounds':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xce');break;case _0xaab5('0xcf'):_0x845ed8['childModel']=_0xaab5('0x7a');break;case _0xaab5('0xd0'):_0x845ed8[_0xaab5('0x6c')]='Template';break;case _0xaab5('0xd1'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xd2');break;case _0xaab5('0xd3'):_0x845ed8['childModel']=_0xaab5('0xd4');break;case _0xaab5('0xd5'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xd6');break;case'plugins':_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0x65');break;case _0xaab5('0xd7'):_0x845ed8[_0xaab5('0x6c')]='AnalyticExtractedReport';_0x845ed8[_0xaab5('0x6e')]=[{'name':_0xaab5('0xd8'),'field':'id','foreignKey':_0xaab5('0x77')}];break;case _0xaab5('0xd9'):_0x845ed8[_0xaab5('0x6c')]=_0xaab5('0xda');break;case'whatsappaccounts':_0x845ed8['childModel']=_0xaab5('0xb3');break;default:return _0x845ed8;}return _0x845ed8;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5bc80b6..dd7ae45 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 _0x3471=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile','setMaxListeners','update'];(function(_0x5a0f80,_0x10c038){var _0x438ef6=function(_0xd3a10b){while(--_0xd3a10b){_0x5a0f80['push'](_0x5a0f80['shift']());}};_0x438ef6(++_0x10c038);}(_0x3471,0x175));var _0x1347=function(_0x1e2565,_0x1fa058){_0x1e2565=_0x1e2565-0x0;var _0x126043=_0x3471[_0x1e2565];return _0x126043;};'use strict';var EventEmitter=require(_0x1347('0x0'));var UserProfile=require(_0x1347('0x1'))['db'][_0x1347('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1347('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1347('0x4'),'afterDestroy':_0x1347('0x5')};function emitEvent(_0x3e534b){return function(_0x1f1dd7,_0x22ed1,_0x8e3ff6){UserProfileEvents['emit'](_0x3e534b+':'+_0x1f1dd7['id'],_0x1f1dd7);UserProfileEvents[_0x1347('0x6')](_0x3e534b,_0x1f1dd7);_0x8e3ff6(null);};}for(var e in events){if(events[_0x1347('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x1347('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x262a=['emit','hasOwnProperty','../../mysqldb','UserProfile','save'];(function(_0x1ac822,_0x1a205d){var _0x333ca1=function(_0x198a13){while(--_0x198a13){_0x1ac822['push'](_0x1ac822['shift']());}};_0x333ca1(++_0x1a205d);}(_0x262a,0x147));var _0xa262=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0x262a[_0x135704];return _0x24e9fd;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xa262('0x0'))['db'][_0xa262('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa262('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x14cc2e){return function(_0xd951ed,_0x294f46,_0x5660c8){UserProfileEvents[_0xa262('0x3')](_0x14cc2e+':'+_0xd951ed['id'],_0xd951ed);UserProfileEvents[_0xa262('0x3')](_0x14cc2e,_0xd951ed);_0x5660c8(null);};}for(var e in events){if(events[_0xa262('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a5f9cc1..6c0cb67 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 _0x1a83=['path','rimraf','../../config/environment','exports','UserProfile','lodash','util','../../config/logger','api','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1a83,0x73));var _0x31a8=function(_0x4ace09,_0x5b6e68){_0x4ace09=_0x4ace09-0x0;var _0x3fdf87=_0x1a83[_0x4ace09];return _0x3fdf87;};'use strict';var _=require(_0x31a8('0x0'));var util=require(_0x31a8('0x1'));var logger=require(_0x31a8('0x2'))(_0x31a8('0x3'));var moment=require('moment');var BPromise=require(_0x31a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31a8('0x5'));var rimraf=require(_0x31a8('0x6'));var config=require(_0x31a8('0x7'));var attributes=require('./userProfile.attributes');module[_0x31a8('0x8')]=function(_0x321919,_0x2e4aa6){return _0x321919['define'](_0x31a8('0x9'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc96=['UserProfile','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xfc96,0xc7));var _0x6fc9=function(_0x2a3a92,_0x524807){_0x2a3a92=_0x2a3a92-0x0;var _0x30c430=_0xfc96[_0x2a3a92];return _0x30c430;};'use strict';var _=require(_0x6fc9('0x0'));var util=require(_0x6fc9('0x1'));var logger=require(_0x6fc9('0x2'))('api');var moment=require(_0x6fc9('0x3'));var BPromise=require(_0x6fc9('0x4'));var rp=require(_0x6fc9('0x5'));var fs=require('fs');var path=require(_0x6fc9('0x6'));var rimraf=require(_0x6fc9('0x7'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module['exports']=function(_0x233062,_0x3e74f0){return _0x233062['define'](_0x6fc9('0x8'),attributes,{'tableName':'user_profiles','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 a964aee..59bbd52 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 _0xf2ca=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0xf2ca[_0xa3463d];return _0x50fd67;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});config[_0xaf2c('0xc')]=_['defaults'](config[_0xaf2c('0xc')],{'host':_0xaf2c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf2c('0xc')]));require('./userProfile.socket')[_0xaf2c('0xe')](socket);function respondWithRpcPromise(_0x4a0064,_0x2f5099,_0x144a7a){return new BPromise(function(_0x2e04e5,_0xd891e9){return client['request'](_0x4a0064,_0x144a7a)['then'](function(_0x2c0d88){logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x2f5099,_0xaf2c('0x11'));logger[_0xaf2c('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x2f5099,'request\x20sent',JSON[_0xaf2c('0x13')](_0x2c0d88));if(_0x2c0d88[_0xaf2c('0x14')]){if(_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x15')]===0x1f4){logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);return _0xd891e9(_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);}logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x2c0d88[_0xaf2c('0x14')][_0xaf2c('0x16')]);return _0x2e04e5(_0x2c0d88[_0xaf2c('0x14')]['message']);}else{logger[_0xaf2c('0xf')]('UserProfile,\x20%s,\x20%s',_0x2f5099,_0xaf2c('0x11'));_0x2e04e5(_0x2c0d88[_0xaf2c('0x17')][_0xaf2c('0x16')]);}})['catch'](function(_0x28ae7b){logger[_0xaf2c('0x14')](_0xaf2c('0x10'),_0x2f5099,_0x28ae7b);_0xd891e9(_0x28ae7b);});});} \ No newline at end of file +var _0xae24=['info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xae24,0x182));var _0x4ae2=function(_0x168c0a,_0x5d645a){_0x168c0a=_0x168c0a-0x0;var _0x1557d3=_0xae24[_0x168c0a];return _0x1557d3;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var moment=require(_0x4ae2('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ae2('0x2'));var fs=require('fs');var Redis=require(_0x4ae2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ae2('0x4'))('rpc');var config=require(_0x4ae2('0x5'));var jayson=require(_0x4ae2('0x6'));var client=jayson[_0x4ae2('0x7')][_0x4ae2('0x8')]({'port':0x232a});config[_0x4ae2('0x9')]=_[_0x4ae2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ae2('0xb'))(new Redis(config['redis']));require('./userProfile.socket')[_0x4ae2('0xc')](socket);function respondWithRpcPromise(_0xb01e8e,_0x5c32b7,_0x3b3acc){return new BPromise(function(_0x449e1a,_0x171449){return client[_0x4ae2('0xd')](_0xb01e8e,_0x3b3acc)['then'](function(_0x19b222){logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,'request\x20sent');logger[_0x4ae2('0x10')](_0x4ae2('0x11'),_0x5c32b7,_0x4ae2('0x12'),JSON[_0x4ae2('0x13')](_0x19b222));if(_0x19b222[_0x4ae2('0x14')]){if(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x15')]===0x1f4){logger[_0x4ae2('0x14')](_0x4ae2('0xf'),_0x5c32b7,_0x19b222['error']['message']);return _0x171449(_0x19b222['error'][_0x4ae2('0x16')]);}logger[_0x4ae2('0x14')]('UserProfile,\x20%s,\x20%s',_0x5c32b7,_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);return _0x449e1a(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);}else{logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,_0x4ae2('0x12'));_0x449e1a(_0x19b222[_0x4ae2('0x17')][_0x4ae2('0x16')]);}})[_0x4ae2('0x18')](function(_0x4d5071){logger['error'](_0x4ae2('0xf'),_0x5c32b7,_0x4d5071);_0x171449(_0x4d5071);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c5dc1aa..a06c060 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 _0xd8f2=['length','userProfile:','./userProfile.events','save','update','emit','removeListener','register'];(function(_0x191f38,_0x3d9739){var _0x3fbaa2=function(_0x4874f9){while(--_0x4874f9){_0x191f38['push'](_0x191f38['shift']());}};_0x3fbaa2(++_0x3d9739);}(_0xd8f2,0x14a));var _0x2d8f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd8f2[_0x5b644e];return _0x49c6bf;};'use strict';var UserProfileEvents=require(_0x2d8f('0x0'));var events=[_0x2d8f('0x1'),'remove',_0x2d8f('0x2')];function createListener(_0x736d62,_0x5566b4){return function(_0xe38fcf){_0x5566b4[_0x2d8f('0x3')](_0x736d62,_0xe38fcf);};}function removeListener(_0x31a936,_0x10457e){return function(){UserProfileEvents[_0x2d8f('0x4')](_0x31a936,_0x10457e);};}exports[_0x2d8f('0x5')]=function(_0x1b9d27){for(var _0x589ecd=0x0,_0x425840=events[_0x2d8f('0x6')];_0x589ecd<_0x425840;_0x589ecd++){var _0x1857fa=events[_0x589ecd];var _0x459218=createListener(_0x2d8f('0x7')+_0x1857fa,_0x1b9d27);UserProfileEvents['on'](_0x1857fa,_0x459218);}}; \ No newline at end of file +var _0x7897=['remove','update','emit','length','./userProfile.events','save'];(function(_0x1809b8,_0x17b813){var _0x51d094=function(_0x19466f){while(--_0x19466f){_0x1809b8['push'](_0x1809b8['shift']());}};_0x51d094(++_0x17b813);}(_0x7897,0x118));var _0x7789=function(_0x1cbee3,_0x4bfdb4){_0x1cbee3=_0x1cbee3-0x0;var _0x48a0d1=_0x7897[_0x1cbee3];return _0x48a0d1;};'use strict';var UserProfileEvents=require(_0x7789('0x0'));var events=[_0x7789('0x1'),_0x7789('0x2'),_0x7789('0x3')];function createListener(_0xb5528e,_0x44aa17){return function(_0x1fa591){_0x44aa17[_0x7789('0x4')](_0xb5528e,_0x1fa591);};}function removeListener(_0x204f3c,_0x196ee8){return function(){UserProfileEvents['removeListener'](_0x204f3c,_0x196ee8);};}exports['register']=function(_0x44d203){for(var _0x221b7d=0x0,_0x383854=events[_0x7789('0x5')];_0x221b7d<_0x383854;_0x221b7d++){var _0x2f9159=events[_0x221b7d];var _0x50cbab=createListener('userProfile:'+_0x2f9159,_0x44d203);UserProfileEvents['on'](_0x2f9159,_0x50cbab);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 33be86e..f7ce993 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 _0xbdad=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','post','create','update','delete','destroy','exports','multer','util'];(function(_0x25445f,_0x336320){var _0x2e3323=function(_0x9433db){while(--_0x9433db){_0x25445f['push'](_0x25445f['shift']());}};_0x2e3323(++_0x336320);}(_0xbdad,0x1e1));var _0xdbda=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbdad[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xdbda('0x0'));var util=require(_0xdbda('0x1'));var path=require(_0xdbda('0x2'));var timeout=require(_0xdbda('0x3'));var express=require(_0xdbda('0x4'));var router=express[_0xdbda('0x5')]();var auth=require(_0xdbda('0x6'));var interaction=require(_0xdbda('0x7'));var config=require(_0xdbda('0x8'));var controller=require(_0xdbda('0x9'));router[_0xdbda('0xa')]('/',auth[_0xdbda('0xb')](),controller[_0xdbda('0xc')]);router[_0xdbda('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xdbda('0xd')]);router['get'](_0xdbda('0xe'),auth[_0xdbda('0xb')](),controller['show']);router[_0xdbda('0xf')]('/',auth[_0xdbda('0xb')](),controller[_0xdbda('0x10')]);router['put'](_0xdbda('0xe'),auth[_0xdbda('0xb')](),controller[_0xdbda('0x11')]);router[_0xdbda('0x12')](_0xdbda('0xe'),auth[_0xdbda('0xb')](),controller[_0xdbda('0x13')]);module[_0xdbda('0x14')]=router; \ No newline at end of file +var _0xc916=['express','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports','path','connect-timeout'];(function(_0x369657,_0x2676f8){var _0x5184d7=function(_0x52f43a){while(--_0x52f43a){_0x369657['push'](_0x369657['shift']());}};_0x5184d7(++_0x2676f8);}(_0xc916,0x1d2));var _0x6c91=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0xc916[_0x5471ec];return _0x121d4c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c91('0x0'));var timeout=require(_0x6c91('0x1'));var express=require(_0x6c91('0x2'));var router=express[_0x6c91('0x3')]();var auth=require(_0x6c91('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6c91('0x5'));var controller=require(_0x6c91('0x6'));router[_0x6c91('0x7')]('/',auth[_0x6c91('0x8')](),controller[_0x6c91('0x9')]);router[_0x6c91('0x7')](_0x6c91('0xa'),auth[_0x6c91('0x8')](),controller[_0x6c91('0xb')]);router[_0x6c91('0x7')](_0x6c91('0xc'),auth['isAuthenticated'](),controller[_0x6c91('0xd')]);router['post']('/',auth[_0x6c91('0x8')](),controller[_0x6c91('0xe')]);router[_0x6c91('0xf')]('/:id',auth[_0x6c91('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6c91('0x10')]);module[_0x6c91('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 c2d5b3e..2658c74 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 _0xe85c=['STRING','INTEGER','exports'];(function(_0x1cc125,_0x4845a1){var _0x16e3f9=function(_0xada44c){while(--_0xada44c){_0x1cc125['push'](_0x1cc125['shift']());}};_0x16e3f9(++_0x4845a1);}(_0xe85c,0x173));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xce85('0x0')]={'name':{'type':Sequelize[_0xce85('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xce85('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xce85('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9063=['exports','STRING','INTEGER','sequelize'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x9063,0x15b));var _0x3906=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x9063[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require(_0x3906('0x0'));module[_0x3906('0x1')]={'name':{'type':Sequelize[_0x3906('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3906('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3906('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 c1a03ae..01ae929 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 _0xae24=['then','error','stack','name','send','map','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','filter','options','UserProfileResource','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy'];(function(_0x34c33d,_0xc3b6ee){var _0x5bb8a8=function(_0x25955e){while(--_0x25955e){_0x34c33d['push'](_0x34c33d['shift']());}};_0x5bb8a8(++_0xc3b6ee);}(_0xae24,0x182));var _0x4ae2=function(_0x3f3b70,_0x508bcc){_0x3f3b70=_0x3f3b70-0x0;var _0x22f3c4=_0xae24[_0x3f3b70];return _0x22f3c4;};'use strict';var pdf=require(_0x4ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ae2('0x2'));var rp=require(_0x4ae2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae2('0x4'));var util=require('util');var path=require(_0x4ae2('0x5'));var sox=require(_0x4ae2('0x6'));var csv=require(_0x4ae2('0x7'));var ejs=require(_0x4ae2('0x8'));var fs=require('fs');var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var db=require(_0x4ae2('0x14'))['db'];function respondWithStatusCode(_0x4d7dc3,_0x25d2b4){_0x25d2b4=_0x25d2b4||0xcc;return function(_0x22ac1e){if(_0x22ac1e){return _0x4d7dc3[_0x4ae2('0x15')](_0x25d2b4);}return _0x4d7dc3[_0x4ae2('0x16')](_0x25d2b4)[_0x4ae2('0x17')]();};}function respondWithResult(_0x40954f,_0x145287){_0x145287=_0x145287||0xc8;return function(_0x3cabc9){if(_0x3cabc9){return _0x40954f[_0x4ae2('0x16')](_0x145287)['json'](_0x3cabc9);}};}function respondWithFilteredResult(_0x4ec027,_0x4d5cab){return function(_0x2f3936){if(_0x2f3936){var _0xf834a1=_0x2f3936[_0x4ae2('0x18')],_0x5f447a=_0x4d5cab[_0x4ae2('0x19')],_0x463765=_0x4d5cab[_0x4ae2('0x19')]+_0x4d5cab[_0x4ae2('0x1a')],_0x9fb8db;if(_0x463765>=_0xf834a1){_0x463765=_0xf834a1;_0x9fb8db=0xc8;}else{_0x9fb8db=0xce;}_0x4ec027[_0x4ae2('0x16')](_0x9fb8db);return _0x4ec027[_0x4ae2('0x1b')](_0x4ae2('0x1c'),_0x5f447a+'-'+_0x463765+'/'+_0xf834a1)[_0x4ae2('0x1d')](_0x2f3936);}return null;};}function patchUpdates(_0x4d5071){return function(_0x4a97af){try{jsonpatch[_0x4ae2('0x1e')](_0x4a97af,_0x4d5071,!![]);}catch(_0x2d910c){return BPromise['reject'](_0x2d910c);}return _0x4a97af[_0x4ae2('0x1f')]();};}function saveUpdates(_0x343db1,_0xccb3b){return function(_0x2ad222){if(_0x2ad222){return _0x2ad222[_0x4ae2('0x20')](_0x343db1)['then'](function(_0x2bf5fe){return _0x2bf5fe;});}return null;};}function removeEntity(_0x53c686,_0x522165){return function(_0x2ceec4){if(_0x2ceec4){return _0x2ceec4[_0x4ae2('0x21')]()[_0x4ae2('0x22')](function(){_0x53c686[_0x4ae2('0x16')](0xcc)[_0x4ae2('0x17')]();});}};}function handleEntityNotFound(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(!_0x4a0ddb){_0x526768[_0x4ae2('0x15')](0x194);}return _0x4a0ddb;};}function handleError(_0x12b5d2,_0x130239){_0x130239=_0x130239||0x1f4;return function(_0x57933b){logger[_0x4ae2('0x23')](_0x57933b[_0x4ae2('0x24')]);if(_0x57933b[_0x4ae2('0x25')]){delete _0x57933b[_0x4ae2('0x25')];}_0x12b5d2[_0x4ae2('0x16')](_0x130239)[_0x4ae2('0x26')](_0x57933b);};}exports['index']=function(_0x5962b0,_0x9508d7){var _0x3030f8={},_0x3fa514={},_0x329588={'count':0x0,'rows':[]};var _0x3a9b96=_[_0x4ae2('0x27')](db['UserProfileResource']['rawAttributes'],function(_0x3e2666){return{'name':_0x3e2666['fieldName'],'type':_0x3e2666['type']['key']};});_0x3fa514[_0x4ae2('0x28')]=_[_0x4ae2('0x27')](_0x3a9b96,'name');_0x3fa514[_0x4ae2('0x29')]=_[_0x4ae2('0x2a')](_0x5962b0[_0x4ae2('0x29')]);_0x3fa514[_0x4ae2('0x2b')]=_[_0x4ae2('0x2c')](_0x3fa514[_0x4ae2('0x28')],_0x3fa514[_0x4ae2('0x29')]);_0x3030f8[_0x4ae2('0x2d')]=_[_0x4ae2('0x2c')](_0x3fa514[_0x4ae2('0x28')],qs[_0x4ae2('0x2e')](_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x2e')]));_0x3030f8[_0x4ae2('0x2d')]=_0x3030f8[_0x4ae2('0x2d')][_0x4ae2('0x2f')]?_0x3030f8[_0x4ae2('0x2d')]:_0x3fa514['model'];if(!_0x5962b0[_0x4ae2('0x29')]['hasOwnProperty'](_0x4ae2('0x30'))){_0x3030f8[_0x4ae2('0x1a')]=qs['limit'](_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x1a')]);_0x3030f8[_0x4ae2('0x19')]=qs[_0x4ae2('0x19')](_0x5962b0['query'][_0x4ae2('0x19')]);}_0x3030f8[_0x4ae2('0x31')]=qs[_0x4ae2('0x32')](_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x32')]);_0x3030f8[_0x4ae2('0x33')]=qs[_0x4ae2('0x2b')](_[_0x4ae2('0x34')](_0x5962b0[_0x4ae2('0x29')],_0x3fa514['filters']),_0x3a9b96);if(_0x5962b0[_0x4ae2('0x29')]['filter']){_0x3030f8[_0x4ae2('0x33')]=_[_0x4ae2('0x35')](_0x3030f8[_0x4ae2('0x33')],{'$or':_[_0x4ae2('0x27')](_0x3a9b96,function(_0x771c14){if(_0x771c14[_0x4ae2('0x36')]!=='VIRTUAL'){var _0x38f12f={};_0x38f12f[_0x771c14[_0x4ae2('0x25')]]={'$like':'%'+_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x37')]+'%'};return _0x38f12f;}})});}_0x3030f8=_['merge']({},_0x3030f8,_0x5962b0[_0x4ae2('0x38')]);var _0x34a784={'where':_0x3030f8[_0x4ae2('0x33')]};return db[_0x4ae2('0x39')][_0x4ae2('0x18')](_0x34a784)[_0x4ae2('0x22')](function(_0x1fdc61){_0x329588[_0x4ae2('0x18')]=_0x1fdc61;if(_0x5962b0[_0x4ae2('0x29')][_0x4ae2('0x3a')]){_0x3030f8[_0x4ae2('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x4ae2('0x3c')](_0x3030f8);})[_0x4ae2('0x22')](function(_0x23f120){_0x329588[_0x4ae2('0x3d')]=_0x23f120;return _0x329588;})['then'](respondWithFilteredResult(_0x9508d7,_0x3030f8))['catch'](handleError(_0x9508d7,null));};exports[_0x4ae2('0x3e')]=function(_0x45527a,_0x2cbdcc){var _0x3cdf23={'raw':![],'where':{'id':_0x45527a[_0x4ae2('0x3f')]['id']}},_0x567371={};_0x567371[_0x4ae2('0x28')]=_['keys'](db[_0x4ae2('0x39')][_0x4ae2('0x40')]);_0x567371[_0x4ae2('0x29')]=_['keys'](_0x45527a[_0x4ae2('0x29')]);_0x567371[_0x4ae2('0x2b')]=_[_0x4ae2('0x2c')](_0x567371[_0x4ae2('0x28')],_0x567371[_0x4ae2('0x29')]);_0x3cdf23[_0x4ae2('0x2d')]=_[_0x4ae2('0x2c')](_0x567371[_0x4ae2('0x28')],qs['fields'](_0x45527a[_0x4ae2('0x29')][_0x4ae2('0x2e')]));_0x3cdf23['attributes']=_0x3cdf23[_0x4ae2('0x2d')][_0x4ae2('0x2f')]?_0x3cdf23['attributes']:_0x567371[_0x4ae2('0x28')];if(_0x45527a[_0x4ae2('0x29')]['includeAll']){_0x3cdf23[_0x4ae2('0x3b')]=[{'all':!![]}];}_0x3cdf23=_[_0x4ae2('0x35')]({},_0x3cdf23,_0x45527a[_0x4ae2('0x38')]);return db['UserProfileResource']['find'](_0x3cdf23)[_0x4ae2('0x22')](handleEntityNotFound(_0x2cbdcc,null))[_0x4ae2('0x22')](respondWithResult(_0x2cbdcc,null))[_0x4ae2('0x41')](handleError(_0x2cbdcc,null));};exports[_0x4ae2('0x42')]=function(_0x507f1d,_0x16a072){return db[_0x4ae2('0x39')][_0x4ae2('0x42')](_0x507f1d['body'],{})[_0x4ae2('0x22')](respondWithResult(_0x16a072,0xc9))[_0x4ae2('0x41')](handleError(_0x16a072,null));};exports[_0x4ae2('0x20')]=function(_0x4e9b6e,_0x16bf0b){if(_0x4e9b6e[_0x4ae2('0x43')]['id']){delete _0x4e9b6e[_0x4ae2('0x43')]['id'];}return db[_0x4ae2('0x39')][_0x4ae2('0x44')]({'where':{'id':_0x4e9b6e[_0x4ae2('0x3f')]['id']}})[_0x4ae2('0x22')](handleEntityNotFound(_0x16bf0b,null))[_0x4ae2('0x22')](saveUpdates(_0x4e9b6e[_0x4ae2('0x43')],null))[_0x4ae2('0x22')](respondWithResult(_0x16bf0b,null))['catch'](handleError(_0x16bf0b,null));};exports[_0x4ae2('0x21')]=function(_0x4a70c6,_0x10db30){return db[_0x4ae2('0x39')][_0x4ae2('0x44')]({'where':{'id':_0x4a70c6[_0x4ae2('0x3f')]['id']}})[_0x4ae2('0x22')](handleEntityNotFound(_0x10db30,null))[_0x4ae2('0x22')](removeEntity(_0x10db30,null))['catch'](handleError(_0x10db30,null));};exports[_0x4ae2('0x45')]=function(_0x2215eb,_0x57c9f4){return db[_0x4ae2('0x39')][_0x4ae2('0x45')]()['then'](respondWithResult(_0x57c9f4,null))[_0x4ae2('0x41')](handleError(_0x57c9f4,null));}; \ No newline at end of file +var _0x4c4e=['count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','map','UserProfileResource','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x3cb318,_0x2c6eb5){var _0x5b4399=function(_0x51845f){while(--_0x51845f){_0x3cb318['push'](_0x3cb318['shift']());}};_0x5b4399(++_0x2c6eb5);}(_0x4c4e,0x152));var _0xe4c4=function(_0xb3c2b,_0x5e5553){_0xb3c2b=_0xb3c2b-0x0;var _0x1fb234=_0x4c4e[_0xb3c2b];return _0x1fb234;};'use strict';var pdf=require(_0xe4c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe4c4('0x1'));var zipdir=require(_0xe4c4('0x2'));var jsonpatch=require(_0xe4c4('0x3'));var rp=require('request-promise');var moment=require(_0xe4c4('0x4'));var BPromise=require(_0xe4c4('0x5'));var Mustache=require(_0xe4c4('0x6'));var util=require('util');var path=require(_0xe4c4('0x7'));var sox=require('sox');var csv=require(_0xe4c4('0x8'));var ejs=require(_0xe4c4('0x9'));var fs=require('fs');var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0xf'));var authService=require(_0xe4c4('0x10'));var qs=require(_0xe4c4('0x11'));var as=require(_0xe4c4('0x12'));var hardwareService=require(_0xe4c4('0x13'));var logger=require(_0xe4c4('0x14'))('api');var utils=require(_0xe4c4('0x15'));var config=require(_0xe4c4('0x16'));var db=require(_0xe4c4('0x17'))['db'];function respondWithStatusCode(_0x2483d0,_0x50bfab){_0x50bfab=_0x50bfab||0xcc;return function(_0x262083){if(_0x262083){return _0x2483d0[_0xe4c4('0x18')](_0x50bfab);}return _0x2483d0['status'](_0x50bfab)[_0xe4c4('0x19')]();};}function respondWithResult(_0x1a44e5,_0x5aa89b){_0x5aa89b=_0x5aa89b||0xc8;return function(_0x42ce9e){if(_0x42ce9e){return _0x1a44e5[_0xe4c4('0x1a')](_0x5aa89b)['json'](_0x42ce9e);}};}function respondWithFilteredResult(_0x307aa8,_0x465c9b){return function(_0x26ea05){if(_0x26ea05){var _0x40a36e=_0x26ea05[_0xe4c4('0x1b')],_0x19e59b=_0x465c9b[_0xe4c4('0x1c')],_0x882be2=_0x465c9b[_0xe4c4('0x1c')]+_0x465c9b[_0xe4c4('0x1d')],_0x1f637e;if(_0x882be2>=_0x40a36e){_0x882be2=_0x40a36e;_0x1f637e=0xc8;}else{_0x1f637e=0xce;}_0x307aa8[_0xe4c4('0x1a')](_0x1f637e);return _0x307aa8[_0xe4c4('0x1e')](_0xe4c4('0x1f'),_0x19e59b+'-'+_0x882be2+'/'+_0x40a36e)[_0xe4c4('0x20')](_0x26ea05);}return null;};}function patchUpdates(_0x5a32b5){return function(_0x286ab3){try{jsonpatch[_0xe4c4('0x21')](_0x286ab3,_0x5a32b5,!![]);}catch(_0x155ea4){return BPromise[_0xe4c4('0x22')](_0x155ea4);}return _0x286ab3['save']();};}function saveUpdates(_0x3d5856,_0x1cad5d){return function(_0x1727eb){if(_0x1727eb){return _0x1727eb[_0xe4c4('0x23')](_0x3d5856)[_0xe4c4('0x24')](function(_0x435940){return _0x435940;});}return null;};}function removeEntity(_0x1d4597,_0x393c96){return function(_0x21bbb1){if(_0x21bbb1){return _0x21bbb1[_0xe4c4('0x25')]()[_0xe4c4('0x24')](function(){_0x1d4597[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x19')]();});}};}function handleEntityNotFound(_0x1db719,_0x15873e){return function(_0x59498e){if(!_0x59498e){_0x1db719['sendStatus'](0x194);}return _0x59498e;};}function handleError(_0x403a2c,_0x4dc8cc){_0x4dc8cc=_0x4dc8cc||0x1f4;return function(_0xf6024d){logger['error'](_0xf6024d[_0xe4c4('0x26')]);if(_0xf6024d['name']){delete _0xf6024d[_0xe4c4('0x27')];}_0x403a2c['status'](_0x4dc8cc)[_0xe4c4('0x28')](_0xf6024d);};}exports['index']=function(_0x5a2adb,_0x4cea1f){var _0x5d66ab={},_0x3221cd={},_0x48cfe0={'count':0x0,'rows':[]};var _0x5b5ea5=_[_0xe4c4('0x29')](db[_0xe4c4('0x2a')]['rawAttributes'],function(_0x57ba43){return{'name':_0x57ba43[_0xe4c4('0x2b')],'type':_0x57ba43[_0xe4c4('0x2c')]['key']};});_0x3221cd[_0xe4c4('0x2d')]=_[_0xe4c4('0x29')](_0x5b5ea5,_0xe4c4('0x27'));_0x3221cd['query']=_['keys'](_0x5a2adb[_0xe4c4('0x2e')]);_0x3221cd[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_0x3221cd[_0xe4c4('0x2d')],_0x3221cd['query']);_0x5d66ab['attributes']=_[_0xe4c4('0x30')](_0x3221cd[_0xe4c4('0x2d')],qs['fields'](_0x5a2adb[_0xe4c4('0x2e')][_0xe4c4('0x31')]));_0x5d66ab[_0xe4c4('0x32')]=_0x5d66ab['attributes'][_0xe4c4('0x33')]?_0x5d66ab['attributes']:_0x3221cd[_0xe4c4('0x2d')];if(!_0x5a2adb[_0xe4c4('0x2e')][_0xe4c4('0x34')](_0xe4c4('0x35'))){_0x5d66ab[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x5a2adb[_0xe4c4('0x2e')][_0xe4c4('0x1d')]);_0x5d66ab[_0xe4c4('0x1c')]=qs[_0xe4c4('0x1c')](_0x5a2adb[_0xe4c4('0x2e')][_0xe4c4('0x1c')]);}_0x5d66ab['order']=qs[_0xe4c4('0x36')](_0x5a2adb[_0xe4c4('0x2e')][_0xe4c4('0x36')]);_0x5d66ab['where']=qs[_0xe4c4('0x2f')](_[_0xe4c4('0x37')](_0x5a2adb[_0xe4c4('0x2e')],_0x3221cd['filters']),_0x5b5ea5);if(_0x5a2adb[_0xe4c4('0x2e')][_0xe4c4('0x38')]){_0x5d66ab[_0xe4c4('0x39')]=_[_0xe4c4('0x3a')](_0x5d66ab[_0xe4c4('0x39')],{'$or':_[_0xe4c4('0x29')](_0x5b5ea5,function(_0x2f8a21){if(_0x2f8a21[_0xe4c4('0x2c')]!==_0xe4c4('0x3b')){var _0x8b5bf3={};_0x8b5bf3[_0x2f8a21['name']]={'$like':'%'+_0x5a2adb[_0xe4c4('0x2e')][_0xe4c4('0x38')]+'%'};return _0x8b5bf3;}})});}_0x5d66ab=_[_0xe4c4('0x3a')]({},_0x5d66ab,_0x5a2adb[_0xe4c4('0x3c')]);var _0x4c5551={'where':_0x5d66ab[_0xe4c4('0x39')]};return db[_0xe4c4('0x2a')]['count'](_0x4c5551)[_0xe4c4('0x24')](function(_0x185959){_0x48cfe0['count']=_0x185959;if(_0x5a2adb[_0xe4c4('0x2e')][_0xe4c4('0x3d')]){_0x5d66ab[_0xe4c4('0x3e')]=[{'all':!![]}];}return db[_0xe4c4('0x2a')][_0xe4c4('0x3f')](_0x5d66ab);})[_0xe4c4('0x24')](function(_0x96dd48){_0x48cfe0[_0xe4c4('0x40')]=_0x96dd48;return _0x48cfe0;})[_0xe4c4('0x24')](respondWithFilteredResult(_0x4cea1f,_0x5d66ab))[_0xe4c4('0x41')](handleError(_0x4cea1f,null));};exports[_0xe4c4('0x42')]=function(_0x10b513,_0x4839ab){var _0x3773dd={'raw':![],'where':{'id':_0x10b513[_0xe4c4('0x43')]['id']}},_0x3ac883={};_0x3ac883[_0xe4c4('0x2d')]=_[_0xe4c4('0x44')](db[_0xe4c4('0x2a')]['rawAttributes']);_0x3ac883[_0xe4c4('0x2e')]=_['keys'](_0x10b513[_0xe4c4('0x2e')]);_0x3ac883[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_0x3ac883[_0xe4c4('0x2d')],_0x3ac883[_0xe4c4('0x2e')]);_0x3773dd['attributes']=_['intersection'](_0x3ac883[_0xe4c4('0x2d')],qs[_0xe4c4('0x31')](_0x10b513[_0xe4c4('0x2e')]['fields']));_0x3773dd[_0xe4c4('0x32')]=_0x3773dd[_0xe4c4('0x32')][_0xe4c4('0x33')]?_0x3773dd[_0xe4c4('0x32')]:_0x3ac883['model'];if(_0x10b513[_0xe4c4('0x2e')][_0xe4c4('0x3d')]){_0x3773dd[_0xe4c4('0x3e')]=[{'all':!![]}];}_0x3773dd=_[_0xe4c4('0x3a')]({},_0x3773dd,_0x10b513[_0xe4c4('0x3c')]);return db[_0xe4c4('0x2a')][_0xe4c4('0x45')](_0x3773dd)[_0xe4c4('0x24')](handleEntityNotFound(_0x4839ab,null))[_0xe4c4('0x24')](respondWithResult(_0x4839ab,null))['catch'](handleError(_0x4839ab,null));};exports[_0xe4c4('0x46')]=function(_0x5d9b27,_0x376db1){return db[_0xe4c4('0x2a')][_0xe4c4('0x46')](_0x5d9b27[_0xe4c4('0x47')],{})[_0xe4c4('0x24')](respondWithResult(_0x376db1,0xc9))[_0xe4c4('0x41')](handleError(_0x376db1,null));};exports[_0xe4c4('0x23')]=function(_0xeb6432,_0x36f8ad){if(_0xeb6432[_0xe4c4('0x47')]['id']){delete _0xeb6432[_0xe4c4('0x47')]['id'];}return db[_0xe4c4('0x2a')][_0xe4c4('0x45')]({'where':{'id':_0xeb6432[_0xe4c4('0x43')]['id']}})['then'](handleEntityNotFound(_0x36f8ad,null))['then'](saveUpdates(_0xeb6432[_0xe4c4('0x47')],null))[_0xe4c4('0x24')](respondWithResult(_0x36f8ad,null))['catch'](handleError(_0x36f8ad,null));};exports[_0xe4c4('0x25')]=function(_0x2853da,_0x1211f9){return db[_0xe4c4('0x2a')][_0xe4c4('0x45')]({'where':{'id':_0x2853da['params']['id']}})[_0xe4c4('0x24')](handleEntityNotFound(_0x1211f9,null))[_0xe4c4('0x24')](removeEntity(_0x1211f9,null))['catch'](handleError(_0x1211f9,null));};exports[_0xe4c4('0x48')]=function(_0x24b0e7,_0x5a1054){return db[_0xe4c4('0x2a')]['describe']()[_0xe4c4('0x24')](respondWithResult(_0x5a1054,null))[_0xe4c4('0x41')](handleError(_0x5a1054,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 61b0001..627e14a 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 _0x91d9=['UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x91d9,0xa4));var _0x991d=function(_0x294a7f,_0x30cd50){_0x294a7f=_0x294a7f-0x0;var _0x40fd74=_0x91d9[_0x294a7f];return _0x40fd74;};'use strict';var _=require(_0x991d('0x0'));var util=require('util');var logger=require(_0x991d('0x1'))(_0x991d('0x2'));var moment=require(_0x991d('0x3'));var BPromise=require(_0x991d('0x4'));var rp=require(_0x991d('0x5'));var fs=require('fs');var path=require(_0x991d('0x6'));var rimraf=require(_0x991d('0x7'));var config=require(_0x991d('0x8'));var attributes=require(_0x991d('0x9'));module[_0x991d('0xa')]=function(_0x14608f,_0x7be742){return _0x14608f[_0x991d('0xb')](_0x991d('0xc'),attributes,{'tableName':_0x991d('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x991d('0xe'),_0x991d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21d2=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId'];(function(_0x2aa891,_0x48c4e9){var _0x4c5942=function(_0x4d2043){while(--_0x4d2043){_0x2aa891['push'](_0x2aa891['shift']());}};_0x4c5942(++_0x48c4e9);}(_0x21d2,0x8c));var _0x221d=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x21d2[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x221d('0x0'));var util=require(_0x221d('0x1'));var logger=require('../../config/logger')(_0x221d('0x2'));var moment=require(_0x221d('0x3'));var BPromise=require(_0x221d('0x4'));var rp=require(_0x221d('0x5'));var fs=require('fs');var path=require(_0x221d('0x6'));var rimraf=require('rimraf');var config=require(_0x221d('0x7'));var attributes=require(_0x221d('0x8'));module['exports']=function(_0x542288,_0x411adf){return _0x542288[_0x221d('0x9')](_0x221d('0xa'),attributes,{'tableName':_0x221d('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x221d('0xc'),_0x221d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 3bfd2ac..696323f 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 _0x8f38=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x12af46,_0x478ae2){var _0x3beba1=function(_0x3d25aa){while(--_0x3d25aa){_0x12af46['push'](_0x12af46['shift']());}};_0x3beba1(++_0x478ae2);}(_0x8f38,0xfe));var _0x88f3=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x8f38[_0x1780f8];return _0x33a410;};'use strict';var _=require(_0x88f3('0x0'));var util=require(_0x88f3('0x1'));var moment=require(_0x88f3('0x2'));var BPromise=require(_0x88f3('0x3'));var rs=require(_0x88f3('0x4'));var fs=require('fs');var Redis=require(_0x88f3('0x5'));var db=require(_0x88f3('0x6'))['db'];var utils=require(_0x88f3('0x7'));var logger=require('../../config/logger')(_0x88f3('0x8'));var config=require('../../config/environment');var jayson=require(_0x88f3('0x9'));var client=jayson[_0x88f3('0xa')][_0x88f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x129f98,_0x58cbee,_0x27847e){return new BPromise(function(_0x3ed813,_0xec3cbe){return client['request'](_0x129f98,_0x27847e)['then'](function(_0x161b77){logger['info'](_0x88f3('0xc'),_0x58cbee,'request\x20sent');logger[_0x88f3('0xd')](_0x88f3('0xe'),_0x58cbee,'request\x20sent',JSON[_0x88f3('0xf')](_0x161b77));if(_0x161b77[_0x88f3('0x10')]){if(_0x161b77[_0x88f3('0x10')][_0x88f3('0x11')]===0x1f4){logger[_0x88f3('0x10')](_0x88f3('0xc'),_0x58cbee,_0x161b77['error'][_0x88f3('0x12')]);return _0xec3cbe(_0x161b77[_0x88f3('0x10')][_0x88f3('0x12')]);}logger[_0x88f3('0x10')](_0x88f3('0xc'),_0x58cbee,_0x161b77[_0x88f3('0x10')][_0x88f3('0x12')]);return _0x3ed813(_0x161b77[_0x88f3('0x10')][_0x88f3('0x12')]);}else{logger['info'](_0x88f3('0xc'),_0x58cbee,'request\x20sent');_0x3ed813(_0x161b77[_0x88f3('0x13')]['message']);}})[_0x88f3('0x14')](function(_0x4f3678){logger[_0x88f3('0x10')](_0x88f3('0xc'),_0x58cbee,_0x4f3678);_0xec3cbe(_0x4f3678);});});} \ No newline at end of file +var _0xde35=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','UserProfileResource,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x2c6837,_0x4af853){var _0x2025a9=function(_0x3324f4){while(--_0x3324f4){_0x2c6837['push'](_0x2c6837['shift']());}};_0x2025a9(++_0x4af853);}(_0xde35,0x176));var _0x5de3=function(_0x2fc694,_0x2cbfd4){_0x2fc694=_0x2fc694-0x0;var _0x5c7c44=_0xde35[_0x2fc694];return _0x5c7c44;};'use strict';var _=require(_0x5de3('0x0'));var util=require(_0x5de3('0x1'));var moment=require(_0x5de3('0x2'));var BPromise=require(_0x5de3('0x3'));var rs=require(_0x5de3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5de3('0x5'));var logger=require(_0x5de3('0x6'))(_0x5de3('0x7'));var config=require(_0x5de3('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5de3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2890fd,_0x7cc8d4,_0x17c5a2){return new BPromise(function(_0x377698,_0x1ce7d3){return client['request'](_0x2890fd,_0x17c5a2)[_0x5de3('0xa')](function(_0x29aa1d){logger[_0x5de3('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x7cc8d4,_0x5de3('0xc'));logger[_0x5de3('0xd')](_0x5de3('0xe'),_0x7cc8d4,_0x5de3('0xc'),JSON['stringify'](_0x29aa1d));if(_0x29aa1d[_0x5de3('0xf')]){if(_0x29aa1d[_0x5de3('0xf')][_0x5de3('0x10')]===0x1f4){logger[_0x5de3('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x7cc8d4,_0x29aa1d[_0x5de3('0xf')][_0x5de3('0x11')]);return _0x1ce7d3(_0x29aa1d[_0x5de3('0xf')]['message']);}logger[_0x5de3('0xf')](_0x5de3('0x12'),_0x7cc8d4,_0x29aa1d[_0x5de3('0xf')][_0x5de3('0x11')]);return _0x377698(_0x29aa1d[_0x5de3('0xf')][_0x5de3('0x11')]);}else{logger['info'](_0x5de3('0x12'),_0x7cc8d4,_0x5de3('0xc'));_0x377698(_0x29aa1d[_0x5de3('0x13')]['message']);}})[_0x5de3('0x14')](function(_0x44770d){logger['error'](_0x5de3('0x12'),_0x7cc8d4,_0x44770d);_0x1ce7d3(_0x44770d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 21711c0..1047cae 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 _0x4322=['../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0x4322,0x174));var _0x2432=function(_0x53ba62,_0x4dd6ac){_0x53ba62=_0x53ba62-0x0;var _0x48ede5=_0x4322[_0x53ba62];return _0x48ede5;};'use strict';var multer=require(_0x2432('0x0'));var util=require('util');var path=require(_0x2432('0x1'));var timeout=require(_0x2432('0x2'));var express=require(_0x2432('0x3'));var router=express[_0x2432('0x4')]();var auth=require(_0x2432('0x5'));var interaction=require(_0x2432('0x6'));var config=require(_0x2432('0x7'));var controller=require('./userProfileSection.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2432('0x8')]);router[_0x2432('0x9')]('/describe',auth[_0x2432('0xa')](),controller[_0x2432('0xb')]);router[_0x2432('0x9')](_0x2432('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2432('0xd')]('/',auth['isAuthenticated'](),controller[_0x2432('0xe')]);router['put'](_0x2432('0xc'),auth[_0x2432('0xa')](),controller[_0x2432('0xf')]);router[_0x2432('0x10')]('/:id',auth[_0x2432('0xa')](),controller[_0x2432('0x11')]);module['exports']=router; \ No newline at end of file +var _0xf0db=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x20b6ed,_0x50b53e){var _0x50df35=function(_0x2940c5){while(--_0x2940c5){_0x20b6ed['push'](_0x20b6ed['shift']());}};_0x50df35(++_0x50b53e);}(_0xf0db,0x12b));var _0xbf0d=function(_0xa49752,_0x20bbc8){_0xa49752=_0xa49752-0x0;var _0x1fe93c=_0xf0db[_0xa49752];return _0x1fe93c;};'use strict';var multer=require(_0xbf0d('0x0'));var util=require(_0xbf0d('0x1'));var path=require('path');var timeout=require(_0xbf0d('0x2'));var express=require(_0xbf0d('0x3'));var router=express[_0xbf0d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf0d('0x5'));var config=require(_0xbf0d('0x6'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0xbf0d('0x7')](),controller[_0xbf0d('0x8')]);router[_0xbf0d('0x9')](_0xbf0d('0xa'),auth['isAuthenticated'](),controller[_0xbf0d('0xb')]);router[_0xbf0d('0x9')](_0xbf0d('0xc'),auth[_0xbf0d('0x7')](),controller[_0xbf0d('0xd')]);router[_0xbf0d('0xe')]('/',auth[_0xbf0d('0x7')](),controller[_0xbf0d('0xf')]);router['put']('/:id',auth[_0xbf0d('0x7')](),controller[_0xbf0d('0x10')]);router[_0xbf0d('0x11')](_0xbf0d('0xc'),auth[_0xbf0d('0x7')](),controller[_0xbf0d('0x12')]);module[_0xbf0d('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 249c852..b520951 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 _0x1d1b=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','getDataValue'];(function(_0x4d2e8c,_0x1f9253){var _0x5b54d0=function(_0x105798){while(--_0x105798){_0x4d2e8c['push'](_0x4d2e8c['shift']());}};_0x5b54d0(++_0x1f9253);}(_0x1d1b,0x110));var _0xb1d1=function(_0x49d9fd,_0x28a6a7){_0x49d9fd=_0x49d9fd-0x0;var _0x439ab9=_0x1d1b[_0x49d9fd];return _0x439ab9;};'use strict';var Sequelize=require(_0xb1d1('0x0'));module[_0xb1d1('0x1')]={'name':{'type':Sequelize[_0xb1d1('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xb1d1('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb1d1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xb1d1('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xb1d1('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x107276){this[_0xb1d1('0x5')]('crudPermissions',_0x107276?_0x107276['join'](''):[]);},'get':function(){return this[_0xb1d1('0x6')](_0xb1d1('0x7'))?this[_0xb1d1('0x6')](_0xb1d1('0x7'))[_0xb1d1('0x8')](''):[];}}}; \ No newline at end of file +var _0x4a5a=['getDataValue','split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x432bab,_0x5a8373){var _0x350830=function(_0x16f2fb){while(--_0x16f2fb){_0x432bab['push'](_0x432bab['shift']());}};_0x350830(++_0x5a8373);}(_0x4a5a,0x6e));var _0xa4a5=function(_0x15f84a,_0x41e630){_0x15f84a=_0x15f84a-0x0;var _0x24a617=_0x4a5a[_0x15f84a];return _0x24a617;};'use strict';var Sequelize=require(_0xa4a5('0x0'));module['exports']={'name':{'type':Sequelize[_0xa4a5('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xa4a5('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa4a5('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa4a5('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xa4a5('0x1')],'set':function(_0x178e81){this[_0xa4a5('0x4')](_0xa4a5('0x5'),_0x178e81?_0x178e81[_0xa4a5('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xa4a5('0x7')]('crudPermissions')[_0xa4a5('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 6a5dc55..583fcbc 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 _0x8e3e=['util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','send','map','UserProfileSection','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','create','body','find','describe','eml-format','zip-dir','request-promise','moment','mustache'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x8e3e,0x91));var _0xe8e3=function(_0x4fd128,_0x4d289d){_0x4fd128=_0x4fd128-0x0;var _0x45ec3e=_0x8e3e[_0x4fd128];return _0x45ec3e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe8e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8e3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8e3('0x2'));var moment=require(_0xe8e3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe8e3('0x4'));var util=require(_0xe8e3('0x5'));var path=require('path');var sox=require(_0xe8e3('0x6'));var csv=require(_0xe8e3('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe8e3('0x8'));var squel=require(_0xe8e3('0x9'));var crypto=require('crypto');var jsforce=require(_0xe8e3('0xa'));var deskjs=require(_0xe8e3('0xb'));var toCsv=require(_0xe8e3('0x7'));var querystring=require(_0xe8e3('0xc'));var Papa=require('papaparse');var Redis=require(_0xe8e3('0xd'));var authService=require(_0xe8e3('0xe'));var qs=require(_0xe8e3('0xf'));var as=require(_0xe8e3('0x10'));var hardwareService=require(_0xe8e3('0x11'));var logger=require(_0xe8e3('0x12'))(_0xe8e3('0x13'));var utils=require(_0xe8e3('0x14'));var config=require(_0xe8e3('0x15'));var db=require(_0xe8e3('0x16'))['db'];function respondWithStatusCode(_0x5f7242,_0x3431aa){_0x3431aa=_0x3431aa||0xcc;return function(_0x4124be){if(_0x4124be){return _0x5f7242[_0xe8e3('0x17')](_0x3431aa);}return _0x5f7242[_0xe8e3('0x18')](_0x3431aa)[_0xe8e3('0x19')]();};}function respondWithResult(_0x2d0825,_0xd8a1a){_0xd8a1a=_0xd8a1a||0xc8;return function(_0x20fc48){if(_0x20fc48){return _0x2d0825[_0xe8e3('0x18')](_0xd8a1a)[_0xe8e3('0x1a')](_0x20fc48);}};}function respondWithFilteredResult(_0x531c75,_0x3cf782){return function(_0x577fb1){if(_0x577fb1){var _0x19db8e=_0x577fb1[_0xe8e3('0x1b')],_0x15fac8=_0x3cf782[_0xe8e3('0x1c')],_0xf6b854=_0x3cf782[_0xe8e3('0x1c')]+_0x3cf782[_0xe8e3('0x1d')],_0x2a02fe;if(_0xf6b854>=_0x19db8e){_0xf6b854=_0x19db8e;_0x2a02fe=0xc8;}else{_0x2a02fe=0xce;}_0x531c75['status'](_0x2a02fe);return _0x531c75[_0xe8e3('0x1e')](_0xe8e3('0x1f'),_0x15fac8+'-'+_0xf6b854+'/'+_0x19db8e)[_0xe8e3('0x1a')](_0x577fb1);}return null;};}function patchUpdates(_0x2f4c1b){return function(_0x18b18c){try{jsonpatch['apply'](_0x18b18c,_0x2f4c1b,!![]);}catch(_0x4ba766){return BPromise[_0xe8e3('0x20')](_0x4ba766);}return _0x18b18c[_0xe8e3('0x21')]();};}function saveUpdates(_0x1cac2b,_0x499cb1){return function(_0x236aae){if(_0x236aae){return _0x236aae[_0xe8e3('0x22')](_0x1cac2b)[_0xe8e3('0x23')](function(_0x6fb131){return _0x6fb131;});}return null;};}function removeEntity(_0x14e944,_0x48a9a7){return function(_0x2c2bfb){if(_0x2c2bfb){return _0x2c2bfb[_0xe8e3('0x24')]()[_0xe8e3('0x23')](function(){_0x14e944[_0xe8e3('0x18')](0xcc)[_0xe8e3('0x19')]();});}};}function handleEntityNotFound(_0x57765c,_0x3720c9){return function(_0x3b3217){if(!_0x3b3217){_0x57765c['sendStatus'](0x194);}return _0x3b3217;};}function handleError(_0x271ad0,_0x1f15a9){_0x1f15a9=_0x1f15a9||0x1f4;return function(_0x3a6917){logger[_0xe8e3('0x25')](_0x3a6917[_0xe8e3('0x26')]);if(_0x3a6917['name']){delete _0x3a6917['name'];}_0x271ad0[_0xe8e3('0x18')](_0x1f15a9)[_0xe8e3('0x27')](_0x3a6917);};}exports['index']=function(_0x67564c,_0x1a9e53){var _0x12fc2d={},_0x24b3b2={},_0x3c90a4={'count':0x0,'rows':[]};var _0x108ec7=_[_0xe8e3('0x28')](db[_0xe8e3('0x29')]['rawAttributes'],function(_0x18418d){return{'name':_0x18418d['fieldName'],'type':_0x18418d[_0xe8e3('0x2a')][_0xe8e3('0x2b')]};});_0x24b3b2[_0xe8e3('0x2c')]=_[_0xe8e3('0x28')](_0x108ec7,'name');_0x24b3b2['query']=_['keys'](_0x67564c[_0xe8e3('0x2d')]);_0x24b3b2[_0xe8e3('0x2e')]=_[_0xe8e3('0x2f')](_0x24b3b2['model'],_0x24b3b2['query']);_0x12fc2d[_0xe8e3('0x30')]=_[_0xe8e3('0x2f')](_0x24b3b2[_0xe8e3('0x2c')],qs['fields'](_0x67564c[_0xe8e3('0x2d')][_0xe8e3('0x31')]));_0x12fc2d['attributes']=_0x12fc2d[_0xe8e3('0x30')][_0xe8e3('0x32')]?_0x12fc2d['attributes']:_0x24b3b2[_0xe8e3('0x2c')];if(!_0x67564c[_0xe8e3('0x2d')][_0xe8e3('0x33')](_0xe8e3('0x34'))){_0x12fc2d['limit']=qs[_0xe8e3('0x1d')](_0x67564c['query']['limit']);_0x12fc2d[_0xe8e3('0x1c')]=qs[_0xe8e3('0x1c')](_0x67564c[_0xe8e3('0x2d')][_0xe8e3('0x1c')]);}_0x12fc2d[_0xe8e3('0x35')]=qs[_0xe8e3('0x36')](_0x67564c[_0xe8e3('0x2d')][_0xe8e3('0x36')]);_0x12fc2d['where']=qs[_0xe8e3('0x2e')](_[_0xe8e3('0x37')](_0x67564c[_0xe8e3('0x2d')],_0x24b3b2[_0xe8e3('0x2e')]),_0x108ec7);if(_0x67564c[_0xe8e3('0x2d')][_0xe8e3('0x38')]){_0x12fc2d[_0xe8e3('0x39')]=_[_0xe8e3('0x3a')](_0x12fc2d[_0xe8e3('0x39')],{'$or':_['map'](_0x108ec7,function(_0x5d318e){if(_0x5d318e['type']!==_0xe8e3('0x3b')){var _0x5dfea3={};_0x5dfea3[_0x5d318e[_0xe8e3('0x3c')]]={'$like':'%'+_0x67564c[_0xe8e3('0x2d')][_0xe8e3('0x38')]+'%'};return _0x5dfea3;}})});}_0x12fc2d=_[_0xe8e3('0x3a')]({},_0x12fc2d,_0x67564c['options']);var _0x11d85c={'where':_0x12fc2d['where']};return db[_0xe8e3('0x29')][_0xe8e3('0x1b')](_0x11d85c)[_0xe8e3('0x23')](function(_0x6ab1c5){_0x3c90a4['count']=_0x6ab1c5;if(_0x67564c[_0xe8e3('0x2d')][_0xe8e3('0x3d')]){_0x12fc2d[_0xe8e3('0x3e')]=[{'all':!![]}];}return db[_0xe8e3('0x29')][_0xe8e3('0x3f')](_0x12fc2d);})[_0xe8e3('0x23')](function(_0x311c6d){_0x3c90a4[_0xe8e3('0x40')]=_0x311c6d;return _0x3c90a4;})[_0xe8e3('0x23')](respondWithFilteredResult(_0x1a9e53,_0x12fc2d))[_0xe8e3('0x41')](handleError(_0x1a9e53,null));};exports[_0xe8e3('0x42')]=function(_0x21af77,_0x421daf){var _0x3f0793={'raw':![],'where':{'id':_0x21af77[_0xe8e3('0x43')]['id']}},_0x55603c={};_0x55603c[_0xe8e3('0x2c')]=_[_0xe8e3('0x44')](db[_0xe8e3('0x29')][_0xe8e3('0x45')]);_0x55603c[_0xe8e3('0x2d')]=_[_0xe8e3('0x44')](_0x21af77['query']);_0x55603c[_0xe8e3('0x2e')]=_[_0xe8e3('0x2f')](_0x55603c[_0xe8e3('0x2c')],_0x55603c[_0xe8e3('0x2d')]);_0x3f0793['attributes']=_['intersection'](_0x55603c['model'],qs[_0xe8e3('0x31')](_0x21af77[_0xe8e3('0x2d')][_0xe8e3('0x31')]));_0x3f0793[_0xe8e3('0x30')]=_0x3f0793[_0xe8e3('0x30')][_0xe8e3('0x32')]?_0x3f0793['attributes']:_0x55603c[_0xe8e3('0x2c')];if(_0x21af77[_0xe8e3('0x2d')][_0xe8e3('0x3d')]){_0x3f0793[_0xe8e3('0x3e')]=[{'all':!![]}];}_0x3f0793=_['merge']({},_0x3f0793,_0x21af77[_0xe8e3('0x46')]);return db[_0xe8e3('0x29')]['find'](_0x3f0793)[_0xe8e3('0x23')](handleEntityNotFound(_0x421daf,null))[_0xe8e3('0x23')](respondWithResult(_0x421daf,null))[_0xe8e3('0x41')](handleError(_0x421daf,null));};exports[_0xe8e3('0x47')]=function(_0x1fddb8,_0x46b5f4){return db[_0xe8e3('0x29')][_0xe8e3('0x47')](_0x1fddb8[_0xe8e3('0x48')],{})[_0xe8e3('0x23')](respondWithResult(_0x46b5f4,0xc9))[_0xe8e3('0x41')](handleError(_0x46b5f4,null));};exports['update']=function(_0x22ba59,_0x8e4f3e){if(_0x22ba59[_0xe8e3('0x48')]['id']){delete _0x22ba59[_0xe8e3('0x48')]['id'];}return db[_0xe8e3('0x29')][_0xe8e3('0x49')]({'where':{'id':_0x22ba59[_0xe8e3('0x43')]['id']}})['then'](handleEntityNotFound(_0x8e4f3e,null))[_0xe8e3('0x23')](saveUpdates(_0x22ba59[_0xe8e3('0x48')],null))[_0xe8e3('0x23')](respondWithResult(_0x8e4f3e,null))['catch'](handleError(_0x8e4f3e,null));};exports['destroy']=function(_0x525e7e,_0x3aa8a5){return db['UserProfileSection'][_0xe8e3('0x49')]({'where':{'id':_0x525e7e[_0xe8e3('0x43')]['id']}})[_0xe8e3('0x23')](handleEntityNotFound(_0x3aa8a5,null))['then'](removeEntity(_0x3aa8a5,null))[_0xe8e3('0x41')](handleError(_0x3aa8a5,null));};exports[_0xe8e3('0x4a')]=function(_0x12a265,_0x522087){return db[_0xe8e3('0x29')][_0xe8e3('0x4a')]()['then'](respondWithResult(_0x522087,null))[_0xe8e3('0x41')](handleError(_0x522087,null));}; \ No newline at end of file +var _0x1352=['catch','show','params','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','options','UserProfileSection','count','findAll','rows'];(function(_0x43815b,_0x1e6550){var _0x5d5bf0=function(_0x343846){while(--_0x343846){_0x43815b['push'](_0x43815b['shift']());}};_0x5d5bf0(++_0x1e6550);}(_0x1352,0x17a));var _0x2135=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x1352[_0x46aff0];return _0x9d78cf;};'use strict';var pdf=require(_0x2135('0x0'));var emlformat=require(_0x2135('0x1'));var rimraf=require(_0x2135('0x2'));var zipdir=require(_0x2135('0x3'));var jsonpatch=require(_0x2135('0x4'));var rp=require(_0x2135('0x5'));var moment=require(_0x2135('0x6'));var BPromise=require(_0x2135('0x7'));var Mustache=require(_0x2135('0x8'));var util=require(_0x2135('0x9'));var path=require(_0x2135('0xa'));var sox=require(_0x2135('0xb'));var csv=require(_0x2135('0xc'));var ejs=require(_0x2135('0xd'));var fs=require('fs');var _=require(_0x2135('0xe'));var squel=require('squel');var crypto=require(_0x2135('0xf'));var jsforce=require(_0x2135('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2135('0xc'));var querystring=require(_0x2135('0x11'));var Papa=require('papaparse');var Redis=require(_0x2135('0x12'));var authService=require(_0x2135('0x13'));var qs=require(_0x2135('0x14'));var as=require(_0x2135('0x15'));var hardwareService=require(_0x2135('0x16'));var logger=require(_0x2135('0x17'))(_0x2135('0x18'));var utils=require(_0x2135('0x19'));var config=require(_0x2135('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f89cb,_0x1a2e5a){_0x1a2e5a=_0x1a2e5a||0xcc;return function(_0x2c911a){if(_0x2c911a){return _0x4f89cb[_0x2135('0x1b')](_0x1a2e5a);}return _0x4f89cb[_0x2135('0x1c')](_0x1a2e5a)['end']();};}function respondWithResult(_0x61c74d,_0x571848){_0x571848=_0x571848||0xc8;return function(_0x2155e4){if(_0x2155e4){return _0x61c74d[_0x2135('0x1c')](_0x571848)[_0x2135('0x1d')](_0x2155e4);}};}function respondWithFilteredResult(_0x7c5231,_0x15ce62){return function(_0x5d8695){if(_0x5d8695){var _0xb55ab3=_0x5d8695['count'],_0x3ec0b6=_0x15ce62['offset'],_0x10beb9=_0x15ce62[_0x2135('0x1e')]+_0x15ce62[_0x2135('0x1f')],_0xc9a525;if(_0x10beb9>=_0xb55ab3){_0x10beb9=_0xb55ab3;_0xc9a525=0xc8;}else{_0xc9a525=0xce;}_0x7c5231[_0x2135('0x1c')](_0xc9a525);return _0x7c5231['set'](_0x2135('0x20'),_0x3ec0b6+'-'+_0x10beb9+'/'+_0xb55ab3)[_0x2135('0x1d')](_0x5d8695);}return null;};}function patchUpdates(_0x181097){return function(_0x2e18fb){try{jsonpatch[_0x2135('0x21')](_0x2e18fb,_0x181097,!![]);}catch(_0x19e8ca){return BPromise['reject'](_0x19e8ca);}return _0x2e18fb[_0x2135('0x22')]();};}function saveUpdates(_0x2ce23e,_0x29ed98){return function(_0x19950f){if(_0x19950f){return _0x19950f[_0x2135('0x23')](_0x2ce23e)[_0x2135('0x24')](function(_0x525c54){return _0x525c54;});}return null;};}function removeEntity(_0x1d15c5,_0x2cdc73){return function(_0x143616){if(_0x143616){return _0x143616[_0x2135('0x25')]()[_0x2135('0x24')](function(){_0x1d15c5[_0x2135('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf59b,_0x4049e2){return function(_0x447724){if(!_0x447724){_0x4cf59b['sendStatus'](0x194);}return _0x447724;};}function handleError(_0x27e719,_0x564c28){_0x564c28=_0x564c28||0x1f4;return function(_0x1182f6){logger[_0x2135('0x26')](_0x1182f6[_0x2135('0x27')]);if(_0x1182f6[_0x2135('0x28')]){delete _0x1182f6[_0x2135('0x28')];}_0x27e719[_0x2135('0x1c')](_0x564c28)[_0x2135('0x29')](_0x1182f6);};}exports[_0x2135('0x2a')]=function(_0x32f991,_0x217cc7){var _0x197124={},_0xfc0984={},_0x14a0ec={'count':0x0,'rows':[]};var _0x5d62b7=_[_0x2135('0x2b')](db['UserProfileSection']['rawAttributes'],function(_0x365f06){return{'name':_0x365f06[_0x2135('0x2c')],'type':_0x365f06[_0x2135('0x2d')][_0x2135('0x2e')]};});_0xfc0984[_0x2135('0x2f')]=_[_0x2135('0x2b')](_0x5d62b7,_0x2135('0x28'));_0xfc0984[_0x2135('0x30')]=_[_0x2135('0x31')](_0x32f991[_0x2135('0x30')]);_0xfc0984['filters']=_[_0x2135('0x32')](_0xfc0984[_0x2135('0x2f')],_0xfc0984[_0x2135('0x30')]);_0x197124['attributes']=_[_0x2135('0x32')](_0xfc0984[_0x2135('0x2f')],qs[_0x2135('0x33')](_0x32f991[_0x2135('0x30')][_0x2135('0x33')]));_0x197124['attributes']=_0x197124[_0x2135('0x34')]['length']?_0x197124[_0x2135('0x34')]:_0xfc0984[_0x2135('0x2f')];if(!_0x32f991[_0x2135('0x30')]['hasOwnProperty'](_0x2135('0x35'))){_0x197124['limit']=qs['limit'](_0x32f991[_0x2135('0x30')][_0x2135('0x1f')]);_0x197124['offset']=qs[_0x2135('0x1e')](_0x32f991[_0x2135('0x30')][_0x2135('0x1e')]);}_0x197124[_0x2135('0x36')]=qs[_0x2135('0x37')](_0x32f991['query'][_0x2135('0x37')]);_0x197124[_0x2135('0x38')]=qs[_0x2135('0x39')](_[_0x2135('0x3a')](_0x32f991[_0x2135('0x30')],_0xfc0984[_0x2135('0x39')]),_0x5d62b7);if(_0x32f991[_0x2135('0x30')][_0x2135('0x3b')]){_0x197124[_0x2135('0x38')]=_[_0x2135('0x3c')](_0x197124[_0x2135('0x38')],{'$or':_[_0x2135('0x2b')](_0x5d62b7,function(_0x224173){if(_0x224173[_0x2135('0x2d')]!=='VIRTUAL'){var _0x5a43eb={};_0x5a43eb[_0x224173[_0x2135('0x28')]]={'$like':'%'+_0x32f991[_0x2135('0x30')]['filter']+'%'};return _0x5a43eb;}})});}_0x197124=_[_0x2135('0x3c')]({},_0x197124,_0x32f991[_0x2135('0x3d')]);var _0x20ef18={'where':_0x197124[_0x2135('0x38')]};return db[_0x2135('0x3e')]['count'](_0x20ef18)['then'](function(_0x2ebf6f){_0x14a0ec[_0x2135('0x3f')]=_0x2ebf6f;if(_0x32f991['query']['includeAll']){_0x197124['include']=[{'all':!![]}];}return db[_0x2135('0x3e')][_0x2135('0x40')](_0x197124);})[_0x2135('0x24')](function(_0x1f2b31){_0x14a0ec[_0x2135('0x41')]=_0x1f2b31;return _0x14a0ec;})[_0x2135('0x24')](respondWithFilteredResult(_0x217cc7,_0x197124))[_0x2135('0x42')](handleError(_0x217cc7,null));};exports[_0x2135('0x43')]=function(_0x1c39bc,_0x49a80c){var _0x1f5ba5={'raw':![],'where':{'id':_0x1c39bc[_0x2135('0x44')]['id']}},_0x152014={};_0x152014[_0x2135('0x2f')]=_['keys'](db['UserProfileSection'][_0x2135('0x45')]);_0x152014[_0x2135('0x30')]=_[_0x2135('0x31')](_0x1c39bc[_0x2135('0x30')]);_0x152014['filters']=_[_0x2135('0x32')](_0x152014[_0x2135('0x2f')],_0x152014['query']);_0x1f5ba5['attributes']=_[_0x2135('0x32')](_0x152014[_0x2135('0x2f')],qs[_0x2135('0x33')](_0x1c39bc[_0x2135('0x30')][_0x2135('0x33')]));_0x1f5ba5['attributes']=_0x1f5ba5['attributes'][_0x2135('0x46')]?_0x1f5ba5[_0x2135('0x34')]:_0x152014[_0x2135('0x2f')];if(_0x1c39bc['query']['includeAll']){_0x1f5ba5['include']=[{'all':!![]}];}_0x1f5ba5=_['merge']({},_0x1f5ba5,_0x1c39bc[_0x2135('0x3d')]);return db[_0x2135('0x3e')][_0x2135('0x47')](_0x1f5ba5)[_0x2135('0x24')](handleEntityNotFound(_0x49a80c,null))[_0x2135('0x24')](respondWithResult(_0x49a80c,null))[_0x2135('0x42')](handleError(_0x49a80c,null));};exports[_0x2135('0x48')]=function(_0x100fec,_0x40d4c6){return db[_0x2135('0x3e')][_0x2135('0x48')](_0x100fec['body'],{})[_0x2135('0x24')](respondWithResult(_0x40d4c6,0xc9))[_0x2135('0x42')](handleError(_0x40d4c6,null));};exports[_0x2135('0x23')]=function(_0x41fa99,_0x27fe0f){if(_0x41fa99[_0x2135('0x49')]['id']){delete _0x41fa99[_0x2135('0x49')]['id'];}return db[_0x2135('0x3e')][_0x2135('0x47')]({'where':{'id':_0x41fa99[_0x2135('0x44')]['id']}})[_0x2135('0x24')](handleEntityNotFound(_0x27fe0f,null))[_0x2135('0x24')](saveUpdates(_0x41fa99[_0x2135('0x49')],null))[_0x2135('0x24')](respondWithResult(_0x27fe0f,null))[_0x2135('0x42')](handleError(_0x27fe0f,null));};exports[_0x2135('0x25')]=function(_0x5ddccf,_0x1ecfb6){return db[_0x2135('0x3e')][_0x2135('0x47')]({'where':{'id':_0x5ddccf[_0x2135('0x44')]['id']}})[_0x2135('0x24')](handleEntityNotFound(_0x1ecfb6,null))['then'](removeEntity(_0x1ecfb6,null))[_0x2135('0x42')](handleError(_0x1ecfb6,null));};exports['describe']=function(_0x2776cd,_0x2fc93a){return db[_0x2135('0x3e')]['describe']()[_0x2135('0x24')](respondWithResult(_0x2fc93a,null))[_0x2135('0x42')](handleError(_0x2fc93a,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2d36658..1b2e826 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 _0xa496=['./userProfileSection.attributes','exports','define','sectionId','userProfileId','lodash','util','path','../../config/environment'];(function(_0x2e0887,_0x3523d8){var _0x8b686c=function(_0x3356e0){while(--_0x3356e0){_0x2e0887['push'](_0x2e0887['shift']());}};_0x8b686c(++_0x3523d8);}(_0xa496,0xf8));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6a49('0x0'));var util=require(_0x6a49('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a49('0x2'));var rimraf=require('rimraf');var config=require(_0x6a49('0x3'));var attributes=require(_0x6a49('0x4'));module[_0x6a49('0x5')]=function(_0x55f94b,_0x479d75){return _0x55f94b[_0x6a49('0x6')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6a49('0x7'),_0x6a49('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd261=['path','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1277f1,_0x1218a2){var _0x100d9b=function(_0x5d748c){while(--_0x5d748c){_0x1277f1['push'](_0x1277f1['shift']());}};_0x100d9b(++_0x1218a2);}(_0xd261,0x86));var _0x1d26=function(_0x128e19,_0x3c02d7){_0x128e19=_0x128e19-0x0;var _0x449ca0=_0xd261[_0x128e19];return _0x449ca0;};'use strict';var _=require(_0x1d26('0x0'));var util=require(_0x1d26('0x1'));var logger=require(_0x1d26('0x2'))(_0x1d26('0x3'));var moment=require('moment');var BPromise=require(_0x1d26('0x4'));var rp=require(_0x1d26('0x5'));var fs=require('fs');var path=require(_0x1d26('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1d26('0x7'));module['exports']=function(_0x40278c,_0x93031d){return _0x40278c[_0x1d26('0x8')](_0x1d26('0x9'),attributes,{'tableName':_0x1d26('0xa'),'paranoid':![],'indexes':[{'name':_0x1d26('0xb'),'fields':[_0x1d26('0xc'),_0x1d26('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e81c301..9795fc7 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 _0x06e3=['UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x39e082,_0x2ff492){var _0x367b15=function(_0x2eb6fa){while(--_0x2eb6fa){_0x39e082['push'](_0x39e082['shift']());}};_0x367b15(++_0x2ff492);}(_0x06e3,0x7c));var _0x306e=function(_0x1054ff,_0x4e10b1){_0x1054ff=_0x1054ff-0x0;var _0x18d5c3=_0x06e3[_0x1054ff];return _0x18d5c3;};'use strict';var _=require(_0x306e('0x0'));var util=require(_0x306e('0x1'));var moment=require(_0x306e('0x2'));var BPromise=require(_0x306e('0x3'));var rs=require(_0x306e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x306e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x306e('0x6'))(_0x306e('0x7'));var config=require(_0x306e('0x8'));var jayson=require(_0x306e('0x9'));var client=jayson['client'][_0x306e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10435f,_0x1e7957,_0x58a8d4){return new BPromise(function(_0x54385b,_0x26f213){return client[_0x306e('0xb')](_0x10435f,_0x58a8d4)[_0x306e('0xc')](function(_0x3d3b09){logger[_0x306e('0xd')](_0x306e('0xe'),_0x1e7957,'request\x20sent');logger[_0x306e('0xf')](_0x306e('0x10'),_0x1e7957,_0x306e('0x11'),JSON[_0x306e('0x12')](_0x3d3b09));if(_0x3d3b09[_0x306e('0x13')]){if(_0x3d3b09['error'][_0x306e('0x14')]===0x1f4){logger[_0x306e('0x13')](_0x306e('0xe'),_0x1e7957,_0x3d3b09[_0x306e('0x13')][_0x306e('0x15')]);return _0x26f213(_0x3d3b09['error']['message']);}logger[_0x306e('0x13')](_0x306e('0xe'),_0x1e7957,_0x3d3b09[_0x306e('0x13')][_0x306e('0x15')]);return _0x54385b(_0x3d3b09[_0x306e('0x13')][_0x306e('0x15')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1e7957,_0x306e('0x11'));_0x54385b(_0x3d3b09['result']['message']);}})[_0x306e('0x16')](function(_0x384b95){logger[_0x306e('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x1e7957,_0x384b95);_0x26f213(_0x384b95);});});} \ No newline at end of file +var _0xdc50=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x1abeb2,_0x79f462){var _0x48da20=function(_0x42a90b){while(--_0x42a90b){_0x1abeb2['push'](_0x1abeb2['shift']());}};_0x48da20(++_0x79f462);}(_0xdc50,0x143));var _0x0dc5=function(_0xcddf7d,_0x4f3044){_0xcddf7d=_0xcddf7d-0x0;var _0x1b401=_0xdc50[_0xcddf7d];return _0x1b401;};'use strict';var _=require(_0x0dc5('0x0'));var util=require(_0x0dc5('0x1'));var moment=require(_0x0dc5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0dc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0dc5('0x4'))['db'];var utils=require(_0x0dc5('0x5'));var logger=require('../../config/logger')(_0x0dc5('0x6'));var config=require(_0x0dc5('0x7'));var jayson=require(_0x0dc5('0x8'));var client=jayson[_0x0dc5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x171fb0,_0x637deb,_0x39a16b){return new BPromise(function(_0x583222,_0x5da9d2){return client[_0x0dc5('0xa')](_0x171fb0,_0x39a16b)[_0x0dc5('0xb')](function(_0x2d234c){logger['info'](_0x0dc5('0xc'),_0x637deb,_0x0dc5('0xd'));logger[_0x0dc5('0xe')](_0x0dc5('0xf'),_0x637deb,_0x0dc5('0xd'),JSON['stringify'](_0x2d234c));if(_0x2d234c[_0x0dc5('0x10')]){if(_0x2d234c[_0x0dc5('0x10')]['code']===0x1f4){logger[_0x0dc5('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x637deb,_0x2d234c[_0x0dc5('0x10')]['message']);return _0x5da9d2(_0x2d234c['error']['message']);}logger[_0x0dc5('0x10')](_0x0dc5('0xc'),_0x637deb,_0x2d234c['error'][_0x0dc5('0x11')]);return _0x583222(_0x2d234c[_0x0dc5('0x10')][_0x0dc5('0x11')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x637deb,'request\x20sent');_0x583222(_0x2d234c['result'][_0x0dc5('0x11')]);}})[_0x0dc5('0x12')](function(_0x31ee2b){logger['error'](_0x0dc5('0xc'),_0x637deb,_0x31ee2b);_0x5da9d2(_0x31ee2b);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index f3b4fd1..abe8087 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 _0x830a=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x830a,0x1df));var _0xa830=function(_0x4b3b60,_0x5176f6){_0x4b3b60=_0x4b3b60-0x0;var _0x2476e3=_0x830a[_0x4b3b60];return _0x2476e3;};'use strict';var multer=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var path=require(_0xa830('0x2'));var timeout=require(_0xa830('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xa830('0x4'));var interaction=require(_0xa830('0x5'));var config=require('../../config/environment');module[_0xa830('0x6')]=router; \ No newline at end of file +var _0xe8ba=['../../components/auth/service','../../components/interaction/service','../../config/environment','util','path','connect-timeout','express','Router'];(function(_0x233602,_0x24afe3){var _0x214483=function(_0x588886){while(--_0x588886){_0x233602['push'](_0x233602['shift']());}};_0x214483(++_0x24afe3);}(_0xe8ba,0x18b));var _0xae8b=function(_0x4d90da,_0x3f6147){_0x4d90da=_0x4d90da-0x0;var _0x464852=_0xe8ba[_0x4d90da];return _0x464852;};'use strict';var multer=require('multer');var util=require(_0xae8b('0x0'));var path=require(_0xae8b('0x1'));var timeout=require(_0xae8b('0x2'));var express=require(_0xae8b('0x3'));var router=express[_0xae8b('0x4')]();var auth=require(_0xae8b('0x5'));var interaction=require(_0xae8b('0x6'));var config=require(_0xae8b('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index ce7611d..cc5a517 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x3eb998,_0x4f5cee){var _0x272be1=function(_0x10bc96){while(--_0x10bc96){_0x3eb998['push'](_0x3eb998['shift']());}};_0x272be1(++_0x4f5cee);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2784d7,_0x59b1a6){var _0xc6453c=function(_0xd1f4b5){while(--_0xd1f4b5){_0x2784d7['push'](_0x2784d7['shift']());}};_0xc6453c(++_0x59b1a6);}(_0xe706,0xa3));var _0x6e70=function(_0x4d4c63,_0x33ac30){_0x4d4c63=_0x4d4c63-0x0;var _0x383b63=_0xe706[_0x4d4c63];return _0x383b63;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 2e68f2c..04eb061 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 _0x118b=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x37067e,_0x425ab7){var _0x58cba9=function(_0x3bd8b4){while(--_0x3bd8b4){_0x37067e['push'](_0x37067e['shift']());}};_0x58cba9(++_0x425ab7);}(_0x118b,0x165));var _0xb118=function(_0xabd9f3,_0x20d7f5){_0xabd9f3=_0xabd9f3-0x0;var _0x29d5b2=_0x118b[_0xabd9f3];return _0x29d5b2;};'use strict';var _=require(_0xb118('0x0'));var util=require(_0xb118('0x1'));var logger=require(_0xb118('0x2'))(_0xb118('0x3'));var moment=require(_0xb118('0x4'));var BPromise=require(_0xb118('0x5'));var rp=require(_0xb118('0x6'));var fs=require('fs');var path=require(_0xb118('0x7'));var rimraf=require(_0xb118('0x8'));var config=require(_0xb118('0x9'));var attributes=require(_0xb118('0xa'));module[_0xb118('0xb')]=function(_0x3c7928,_0x32e1d4){return _0x3c7928[_0xb118('0xc')]('UserSmsQueue',attributes,{'tableName':_0xb118('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77d1=['UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0x2e3cbc,_0x263b68){var _0x125727=function(_0x4ce177){while(--_0x4ce177){_0x2e3cbc['push'](_0x2e3cbc['shift']());}};_0x125727(++_0x263b68);}(_0x77d1,0x72));var _0x177d=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x77d1[_0xf80b3];return _0x10c489;};'use strict';var _=require('lodash');var util=require(_0x177d('0x0'));var logger=require(_0x177d('0x1'))(_0x177d('0x2'));var moment=require(_0x177d('0x3'));var BPromise=require(_0x177d('0x4'));var rp=require(_0x177d('0x5'));var fs=require('fs');var path=require(_0x177d('0x6'));var rimraf=require(_0x177d('0x7'));var config=require(_0x177d('0x8'));var attributes=require(_0x177d('0x9'));module[_0x177d('0xa')]=function(_0x385960,_0x144854){return _0x385960[_0x177d('0xb')](_0x177d('0xc'),attributes,{'tableName':_0x177d('0xd'),'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 39497de..c7b2082 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 _0xc63e=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x338f2a,_0x5d2c13){var _0x567ccc=function(_0x37ff20){while(--_0x37ff20){_0x338f2a['push'](_0x338f2a['shift']());}};_0x567ccc(++_0x5d2c13);}(_0xc63e,0x1a5));var _0xec63=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xc63e[_0x2b8077];return _0x308091;};'use strict';var _=require(_0xec63('0x0'));var util=require(_0xec63('0x1'));var moment=require(_0xec63('0x2'));var BPromise=require(_0xec63('0x3'));var rs=require(_0xec63('0x4'));var fs=require('fs');var Redis=require(_0xec63('0x5'));var db=require(_0xec63('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xec63('0x7'))(_0xec63('0x8'));var config=require(_0xec63('0x9'));var jayson=require(_0xec63('0xa'));var client=jayson[_0xec63('0xb')][_0xec63('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54d72c,_0x2c9276,_0x40bda1){return new BPromise(function(_0x37ace3,_0x332dc5){return client[_0xec63('0xd')](_0x54d72c,_0x40bda1)[_0xec63('0xe')](function(_0x25ee4c){logger[_0xec63('0xf')](_0xec63('0x10'),_0x2c9276,'request\x20sent');logger[_0xec63('0x11')](_0xec63('0x12'),_0x2c9276,_0xec63('0x13'),JSON[_0xec63('0x14')](_0x25ee4c));if(_0x25ee4c[_0xec63('0x15')]){if(_0x25ee4c[_0xec63('0x15')][_0xec63('0x16')]===0x1f4){logger[_0xec63('0x15')]('UserSmsQueue,\x20%s,\x20%s',_0x2c9276,_0x25ee4c[_0xec63('0x15')][_0xec63('0x17')]);return _0x332dc5(_0x25ee4c[_0xec63('0x15')][_0xec63('0x17')]);}logger[_0xec63('0x15')](_0xec63('0x10'),_0x2c9276,_0x25ee4c['error'][_0xec63('0x17')]);return _0x37ace3(_0x25ee4c[_0xec63('0x15')][_0xec63('0x17')]);}else{logger[_0xec63('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x2c9276,_0xec63('0x13'));_0x37ace3(_0x25ee4c[_0xec63('0x18')]['message']);}})[_0xec63('0x19')](function(_0x3c8602){logger[_0xec63('0x15')](_0xec63('0x10'),_0x2c9276,_0x3c8602);_0x332dc5(_0x3c8602);});});} \ No newline at end of file +var _0x8d06=['../../config/logger','../../config/environment','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4311ae,_0x2e60cb){var _0x95004f=function(_0x6506cc){while(--_0x6506cc){_0x4311ae['push'](_0x4311ae['shift']());}};_0x95004f(++_0x2e60cb);}(_0x8d06,0x19f));var _0x68d0=function(_0x23805f,_0x1bb8e4){_0x23805f=_0x23805f-0x0;var _0x384a84=_0x8d06[_0x23805f];return _0x384a84;};'use strict';var _=require('lodash');var util=require(_0x68d0('0x0'));var moment=require('moment');var BPromise=require(_0x68d0('0x1'));var rs=require(_0x68d0('0x2'));var fs=require('fs');var Redis=require(_0x68d0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x68d0('0x4'));var logger=require(_0x68d0('0x5'))('rpc');var config=require(_0x68d0('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x68d0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x7038d1,_0x4c5062,_0x280d6b){return new BPromise(function(_0x5cf1e6,_0x283ff6){return client[_0x68d0('0x8')](_0x7038d1,_0x280d6b)[_0x68d0('0x9')](function(_0x5dd919){logger[_0x68d0('0xa')](_0x68d0('0xb'),_0x4c5062,_0x68d0('0xc'));logger[_0x68d0('0xd')](_0x68d0('0xe'),_0x4c5062,'request\x20sent',JSON[_0x68d0('0xf')](_0x5dd919));if(_0x5dd919[_0x68d0('0x10')]){if(_0x5dd919[_0x68d0('0x10')][_0x68d0('0x11')]===0x1f4){logger[_0x68d0('0x10')](_0x68d0('0xb'),_0x4c5062,_0x5dd919[_0x68d0('0x10')][_0x68d0('0x12')]);return _0x283ff6(_0x5dd919[_0x68d0('0x10')][_0x68d0('0x12')]);}logger[_0x68d0('0x10')](_0x68d0('0xb'),_0x4c5062,_0x5dd919[_0x68d0('0x10')][_0x68d0('0x12')]);return _0x5cf1e6(_0x5dd919['error'][_0x68d0('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x4c5062,_0x68d0('0xc'));_0x5cf1e6(_0x5dd919[_0x68d0('0x13')][_0x68d0('0x12')]);}})['catch'](function(_0x1c8281){logger[_0x68d0('0x10')](_0x68d0('0xb'),_0x4c5062,_0x1c8281);_0x283ff6(_0x1c8281);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index dbdf490..36fd5a0 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 _0x59cc=['express','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0xc9b988,_0x429150){var _0x5f14fe=function(_0x5c76a8){while(--_0x5c76a8){_0xc9b988['push'](_0xc9b988['shift']());}};_0x5f14fe(++_0x429150);}(_0x59cc,0x11b));var _0xc59c=function(_0xeffcb1,_0x411d50){_0xeffcb1=_0xeffcb1-0x0;var _0x1c86e5=_0x59cc[_0xeffcb1];return _0x1c86e5;};'use strict';var multer=require(_0xc59c('0x0'));var util=require(_0xc59c('0x1'));var path=require(_0xc59c('0x2'));var timeout=require(_0xc59c('0x3'));var express=require(_0xc59c('0x4'));var router=express['Router']();var auth=require(_0xc59c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xc59c('0x6')]=router; \ No newline at end of file +var _0xce36=['path','connect-timeout','express','Router','../../config/environment','multer','util'];(function(_0x1ebd73,_0x5766b7){var _0x341b64=function(_0x198560){while(--_0x198560){_0x1ebd73['push'](_0x1ebd73['shift']());}};_0x341b64(++_0x5766b7);}(_0xce36,0x9f));var _0x6ce3=function(_0x58ceb9,_0x5601df){_0x58ceb9=_0x58ceb9-0x0;var _0x3d0ff5=_0xce36[_0x58ceb9];return _0x3d0ff5;};'use strict';var multer=require(_0x6ce3('0x0'));var util=require(_0x6ce3('0x1'));var path=require(_0x6ce3('0x2'));var timeout=require(_0x6ce3('0x3'));var express=require(_0x6ce3('0x4'));var router=express[_0x6ce3('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ce3('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 428b1b9..579d674 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(_0x45e580,_0x46e6b7){var _0x481515=function(_0x8d965c){while(--_0x8d965c){_0x45e580['push'](_0x45e580['shift']());}};_0x481515(++_0x46e6b7);}(_0xe706,0xa3));var _0x6e70=function(_0x1af71a,_0x1d18ee){_0x1af71a=_0x1af71a-0x0;var _0x3acd6a=_0xe706[_0x1af71a];return _0x3acd6a;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x5baf29,_0x521e50){var _0x2d6553=function(_0x4340c5){while(--_0x4340c5){_0x5baf29['push'](_0x5baf29['shift']());}};_0x2d6553(++_0x521e50);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 75716ea..1045e6a 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 _0xb903=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x396e8c,_0x40b46f){var _0x1415c2=function(_0x4e93ee){while(--_0x4e93ee){_0x396e8c['push'](_0x396e8c['shift']());}};_0x1415c2(++_0x40b46f);}(_0xb903,0x185));var _0x3b90=function(_0x37c522,_0x58335a){_0x37c522=_0x37c522-0x0;var _0x132d62=_0xb903[_0x37c522];return _0x132d62;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('UserVoiceQueue',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0faf=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x0faf,0x132));var _0xf0fa=function(_0x89bddd,_0x5c50e8){_0x89bddd=_0x89bddd-0x0;var _0x3a10e6=_0x0faf[_0x89bddd];return _0x3a10e6;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));module['exports']=function(_0x3637a3,_0x44ffa0){return _0x3637a3[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 2f21afe..f268357 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 _0x3892=['debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3892,0xee));var _0x2389=function(_0x591099,_0x39858f){_0x591099=_0x591099-0x0;var _0x3061c2=_0x3892[_0x591099];return _0x3061c2;};'use strict';var _=require('lodash');var util=require(_0x2389('0x0'));var moment=require(_0x2389('0x1'));var BPromise=require('bluebird');var rs=require(_0x2389('0x2'));var fs=require('fs');var Redis=require(_0x2389('0x3'));var db=require(_0x2389('0x4'))['db'];var utils=require(_0x2389('0x5'));var logger=require(_0x2389('0x6'))(_0x2389('0x7'));var config=require(_0x2389('0x8'));var jayson=require(_0x2389('0x9'));var client=jayson['client'][_0x2389('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c2d38,_0x10a433,_0x57772f){return new BPromise(function(_0x3da41c,_0x31f14c){return client['request'](_0x4c2d38,_0x57772f)[_0x2389('0xb')](function(_0x379c53){logger[_0x2389('0xc')](_0x2389('0xd'),_0x10a433,_0x2389('0xe'));logger[_0x2389('0xf')](_0x2389('0x10'),_0x10a433,_0x2389('0xe'),JSON[_0x2389('0x11')](_0x379c53));if(_0x379c53[_0x2389('0x12')]){if(_0x379c53[_0x2389('0x12')][_0x2389('0x13')]===0x1f4){logger[_0x2389('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x10a433,_0x379c53[_0x2389('0x12')]['message']);return _0x31f14c(_0x379c53[_0x2389('0x12')][_0x2389('0x14')]);}logger[_0x2389('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x10a433,_0x379c53['error']['message']);return _0x3da41c(_0x379c53[_0x2389('0x12')][_0x2389('0x14')]);}else{logger[_0x2389('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x10a433,_0x2389('0xe'));_0x3da41c(_0x379c53[_0x2389('0x15')][_0x2389('0x14')]);}})[_0x2389('0x16')](function(_0x2e79d8){logger[_0x2389('0x12')](_0x2389('0xd'),_0x10a433,_0x2e79d8);_0x31f14c(_0x2e79d8);});});} \ No newline at end of file +var _0x2081=['error','code','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','request\x20sent','stringify'];(function(_0x2e8148,_0x1a38c7){var _0x39bd72=function(_0x5a7f41){while(--_0x5a7f41){_0x2e8148['push'](_0x2e8148['shift']());}};_0x39bd72(++_0x1a38c7);}(_0x2081,0xe1));var _0x1208=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0x2081[_0x533132];return _0x1a7447;};'use strict';var _=require(_0x1208('0x0'));var util=require(_0x1208('0x1'));var moment=require('moment');var BPromise=require(_0x1208('0x2'));var rs=require(_0x1208('0x3'));var fs=require('fs');var Redis=require(_0x1208('0x4'));var db=require(_0x1208('0x5'))['db'];var utils=require(_0x1208('0x6'));var logger=require(_0x1208('0x7'))(_0x1208('0x8'));var config=require(_0x1208('0x9'));var jayson=require(_0x1208('0xa'));var client=jayson['client'][_0x1208('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x222920,_0x3737f0,_0x381126){return new BPromise(function(_0x1af02d,_0x23aa47){return client[_0x1208('0xc')](_0x222920,_0x381126)[_0x1208('0xd')](function(_0x277315){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3737f0,'request\x20sent');logger[_0x1208('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3737f0,_0x1208('0xf'),JSON[_0x1208('0x10')](_0x277315));if(_0x277315['error']){if(_0x277315[_0x1208('0x11')][_0x1208('0x12')]===0x1f4){logger[_0x1208('0x11')](_0x1208('0x13'),_0x3737f0,_0x277315[_0x1208('0x11')][_0x1208('0x14')]);return _0x23aa47(_0x277315[_0x1208('0x11')]['message']);}logger[_0x1208('0x11')](_0x1208('0x13'),_0x3737f0,_0x277315[_0x1208('0x11')]['message']);return _0x1af02d(_0x277315[_0x1208('0x11')][_0x1208('0x14')]);}else{logger['info'](_0x1208('0x13'),_0x3737f0,_0x1208('0xf'));_0x1af02d(_0x277315['result'][_0x1208('0x14')]);}})[_0x1208('0x15')](function(_0x16a105){logger[_0x1208('0x11')](_0x1208('0x13'),_0x3737f0,_0x16a105);_0x23aa47(_0x16a105);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 3b282c0..c107a23 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 _0x2cf9=['../../config/environment','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4a3d86,_0x72d0b6){var _0x23da71=function(_0x4edb57){while(--_0x4edb57){_0x4a3d86['push'](_0x4a3d86['shift']());}};_0x23da71(++_0x72d0b6);}(_0x2cf9,0x1da));var _0x92cf=function(_0x302c67,_0x4a03d5){_0x302c67=_0x302c67-0x0;var _0x2b48f3=_0x2cf9[_0x302c67];return _0x2b48f3;};'use strict';var multer=require(_0x92cf('0x0'));var util=require('util');var path=require(_0x92cf('0x1'));var timeout=require(_0x92cf('0x2'));var express=require('express');var router=express[_0x92cf('0x3')]();var auth=require(_0x92cf('0x4'));var interaction=require(_0x92cf('0x5'));var config=require(_0x92cf('0x6'));module[_0x92cf('0x7')]=router; \ No newline at end of file +var _0x943c=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var path=require(_0xc943('0x2'));var timeout=require(_0xc943('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc943('0x4'));var interaction=require(_0xc943('0x5'));var config=require(_0xc943('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5267a17..0920b5a 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 _0xf6b1=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x5408af,_0x13e70e){var _0x4fa79a=function(_0x53c63f){while(--_0x53c63f){_0x5408af['push'](_0x5408af['shift']());}};_0x4fa79a(++_0x13e70e);}(_0xf6b1,0xbb));var _0x1f6b=function(_0x27fd82,_0x5e12e2){_0x27fd82=_0x27fd82-0x0;var _0x30db5e=_0xf6b1[_0x27fd82];return _0x30db5e;};'use strict';var Sequelize=require(_0x1f6b('0x0'));module[_0x1f6b('0x1')]={'uniqueid':{'type':Sequelize[_0x1f6b('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1f6b('0x3')},'membername':{'type':Sequelize[_0x1f6b('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x1f6b('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1f6b('0x4')],'allowNull':![],'unique':_0x1f6b('0x5'),'comment':_0x1f6b('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x1f6b('0x4')],'allowNull':![],'unique':_0x1f6b('0x5'),'comment':_0x1f6b('0x3')},'penalty':{'type':Sequelize[_0x1f6b('0x2')](0xb),'defaultValue':0x0,'comment':_0x1f6b('0x3')},'paused':{'type':Sequelize[_0x1f6b('0x2')](0xb),'defaultValue':0x0,'comment':_0x1f6b('0x3')}}; \ No newline at end of file +var _0xda52=['INTEGER','queue_interface','sequelize','STRING','Required\x20by\x20Asterisk'];(function(_0x8f391b,_0x4b0cfb){var _0x128bf0=function(_0x115435){while(--_0x115435){_0x8f391b['push'](_0x8f391b['shift']());}};_0x128bf0(++_0x4b0cfb);}(_0xda52,0x11a));var _0x2da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda52[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2da5('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2da5('0x1')],'allowNull':![],'comment':_0x2da5('0x2')},'UserId':{'type':Sequelize[_0x2da5('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2da5('0x1')],'allowNull':![],'unique':_0x2da5('0x4'),'comment':_0x2da5('0x2')},'VoiceQueueId':{'type':Sequelize[_0x2da5('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x2da5('0x1')],'allowNull':![],'unique':_0x2da5('0x4'),'comment':_0x2da5('0x2')},'penalty':{'type':Sequelize[_0x2da5('0x3')](0xb),'defaultValue':0x0,'comment':_0x2da5('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x2da5('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 407dad2..584ce25 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 _0x2301=['hook','exports','events','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0x2301,0x1c2));var _0x1230=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x2301[_0x4de586];return _0x46baf5;};'use strict';var EventEmitter=require(_0x1230('0x0'));var UserVoiceQueueRt=require(_0x1230('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1230('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1230('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1d4fc3){return function(_0x1135ed,_0x2b642b,_0x3ecfe5){UserVoiceQueueRtEvents[_0x1230('0x4')](_0x1d4fc3+':'+_0x1135ed['id'],_0x1135ed);UserVoiceQueueRtEvents[_0x1230('0x4')](_0x1d4fc3,_0x1135ed);_0x3ecfe5(null);};}for(var e in events){if(events[_0x1230('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0x1230('0x6')](e,emitEvent(event));}}module[_0x1230('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3389=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x3389,0xcb));var _0x9338=function(_0x5e9e5e,_0x549e27){_0x5e9e5e=_0x5e9e5e-0x0;var _0x11b7dd=_0x3389[_0x5e9e5e];return _0x11b7dd;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x9338('0x0'))['db'][_0x9338('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9338('0x2')](0x0);var events={'afterCreate':_0x9338('0x3'),'afterUpdate':_0x9338('0x4'),'afterDestroy':_0x9338('0x5')};function emitEvent(_0x3b928f){return function(_0x21603f,_0x3462d9,_0x454dd8){UserVoiceQueueRtEvents[_0x9338('0x6')](_0x3b928f+':'+_0x21603f['id'],_0x21603f);UserVoiceQueueRtEvents[_0x9338('0x6')](_0x3b928f,_0x21603f);_0x454dd8(null);};}for(var e in events){if(events[_0x9338('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x9338('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3a6a5fb..2bab400 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 _0xedf0=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0xedf0,0x1e4));var _0x0edf=function(_0x35fb79,_0x47f0dc){_0x35fb79=_0x35fb79-0x0;var _0x1f6764=_0xedf0[_0x35fb79];return _0x1f6764;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0edf('0x0'))('api');var moment=require(_0x0edf('0x1'));var BPromise=require(_0x0edf('0x2'));var rp=require(_0x0edf('0x3'));var fs=require('fs');var path=require(_0x0edf('0x4'));var rimraf=require('rimraf');var config=require(_0x0edf('0x5'));var attributes=require(_0x0edf('0x6'));module[_0x0edf('0x7')]=function(_0x4e9db5,_0x2b4c50){return _0x4e9db5[_0x0edf('0x8')](_0x0edf('0x9'),attributes,{'tableName':_0x0edf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a1b=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x2e95fa,_0x48fcf8){var _0x4feaae=function(_0x583f74){while(--_0x583f74){_0x2e95fa['push'](_0x2e95fa['shift']());}};_0x4feaae(++_0x48fcf8);}(_0x7a1b,0x142));var _0xb7a1=function(_0x3c3a84,_0x10b60a){_0x3c3a84=_0x3c3a84-0x0;var _0x38ba5c=_0x7a1b[_0x3c3a84];return _0x38ba5c;};'use strict';var _=require(_0xb7a1('0x0'));var util=require(_0xb7a1('0x1'));var logger=require('../../config/logger')(_0xb7a1('0x2'));var moment=require(_0xb7a1('0x3'));var BPromise=require(_0xb7a1('0x4'));var rp=require(_0xb7a1('0x5'));var fs=require('fs');var path=require(_0xb7a1('0x6'));var rimraf=require(_0xb7a1('0x7'));var config=require(_0xb7a1('0x8'));var attributes=require(_0xb7a1('0x9'));module[_0xb7a1('0xa')]=function(_0x2d65e2,_0xd0e2c9){return _0x2d65e2[_0xb7a1('0xb')](_0xb7a1('0xc'),attributes,{'tableName':_0xb7a1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 8f67ee9..2856709 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 _0xed39=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','info'];(function(_0x2657f7,_0x15c229){var _0x6d956=function(_0x2cb0cf){while(--_0x2cb0cf){_0x2657f7['push'](_0x2657f7['shift']());}};_0x6d956(++_0x15c229);}(_0xed39,0x1dd));var _0x9ed3=function(_0x4d14b7,_0x37a815){_0x4d14b7=_0x4d14b7-0x0;var _0x513d17=_0xed39[_0x4d14b7];return _0x513d17;};'use strict';var _=require(_0x9ed3('0x0'));var util=require(_0x9ed3('0x1'));var moment=require(_0x9ed3('0x2'));var BPromise=require(_0x9ed3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ed3('0x4'));var db=require(_0x9ed3('0x5'))['db'];var utils=require(_0x9ed3('0x6'));var logger=require('../../config/logger')(_0x9ed3('0x7'));var config=require(_0x9ed3('0x8'));var jayson=require(_0x9ed3('0x9'));var client=jayson[_0x9ed3('0xa')][_0x9ed3('0xb')]({'port':0x232a});config[_0x9ed3('0xc')]=_[_0x9ed3('0xd')](config[_0x9ed3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9ed3('0xc')]));require('./userVoiceQueueRt.socket')[_0x9ed3('0xe')](socket);function respondWithRpcPromise(_0x3b5b88,_0x336506,_0x703dad){return new BPromise(function(_0x2fdae9,_0x4aa867){return client[_0x9ed3('0xf')](_0x3b5b88,_0x703dad)['then'](function(_0x2c6fb5){logger[_0x9ed3('0x10')](_0x9ed3('0x11'),_0x336506,_0x9ed3('0x12'));logger[_0x9ed3('0x13')](_0x9ed3('0x14'),_0x336506,_0x9ed3('0x12'),JSON['stringify'](_0x2c6fb5));if(_0x2c6fb5[_0x9ed3('0x15')]){if(_0x2c6fb5['error'][_0x9ed3('0x16')]===0x1f4){logger['error'](_0x9ed3('0x11'),_0x336506,_0x2c6fb5[_0x9ed3('0x15')][_0x9ed3('0x17')]);return _0x4aa867(_0x2c6fb5[_0x9ed3('0x15')][_0x9ed3('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x336506,_0x2c6fb5['error'][_0x9ed3('0x17')]);return _0x2fdae9(_0x2c6fb5[_0x9ed3('0x15')][_0x9ed3('0x17')]);}else{logger[_0x9ed3('0x10')](_0x9ed3('0x11'),_0x336506,_0x9ed3('0x12'));_0x2fdae9(_0x2c6fb5[_0x9ed3('0x18')][_0x9ed3('0x17')]);}})[_0x9ed3('0x19')](function(_0x380115){logger['error'](_0x9ed3('0x11'),_0x336506,_0x380115);_0x4aa867(_0x380115);});});}exports[_0x9ed3('0x1a')]=function(_0x4d3e1f){var _0x3ad7da=this;return new Promise(function(_0x3770ed,_0x225d19){return db[_0x9ed3('0x1b')][_0x9ed3('0x1c')]({'raw':_0x4d3e1f[_0x9ed3('0x1d')]?_0x4d3e1f[_0x9ed3('0x1d')][_0x9ed3('0x1e')]===undefined?!![]:![]:!![],'where':_0x4d3e1f['options']?_0x4d3e1f[_0x9ed3('0x1d')][_0x9ed3('0x1f')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x9ed3('0x20')]['fn']('IF',db[_0x9ed3('0x20')][_0x9ed3('0x21')](_0x9ed3('0x22')))),_0x9ed3('0x23')]]})[_0x9ed3('0x24')](function(_0x375924){logger[_0x9ed3('0x10')](_0x9ed3('0x1a'),_0x4d3e1f);logger['debug'](_0x9ed3('0x1a'),_0x4d3e1f,JSON[_0x9ed3('0x25')](_0x375924));_0x3770ed(_0x375924);})[_0x9ed3('0x19')](function(_0xea7876){logger['error'](_0x9ed3('0x1a'),_0xea7876[_0x9ed3('0x17')],_0x4d3e1f);_0x225d19(_0x3ad7da[_0x9ed3('0x15')](0x1f4,_0xea7876['message']));});});}; \ No newline at end of file +var _0xe819=['findAll','options','raw','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','client','redis','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xe819,0x152));var _0x9e81=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe819[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9e81('0x0'));var util=require(_0x9e81('0x1'));var moment=require(_0x9e81('0x2'));var BPromise=require(_0x9e81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e81('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e81('0x5'))(_0x9e81('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9e81('0x7')]['http']({'port':0x232a});config[_0x9e81('0x8')]=_['defaults'](config[_0x9e81('0x8')],{'host':_0x9e81('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e81('0x8')]));require(_0x9e81('0xa'))[_0x9e81('0xb')](socket);function respondWithRpcPromise(_0x3a4da3,_0x2a54aa,_0x718284){return new BPromise(function(_0x130b9b,_0x49ca68){return client[_0x9e81('0xc')](_0x3a4da3,_0x718284)['then'](function(_0x134822){logger[_0x9e81('0xd')](_0x9e81('0xe'),_0x2a54aa,_0x9e81('0xf'));logger[_0x9e81('0x10')](_0x9e81('0x11'),_0x2a54aa,_0x9e81('0xf'),JSON[_0x9e81('0x12')](_0x134822));if(_0x134822[_0x9e81('0x13')]){if(_0x134822[_0x9e81('0x13')][_0x9e81('0x14')]===0x1f4){logger[_0x9e81('0x13')](_0x9e81('0xe'),_0x2a54aa,_0x134822[_0x9e81('0x13')]['message']);return _0x49ca68(_0x134822['error'][_0x9e81('0x15')]);}logger[_0x9e81('0x13')](_0x9e81('0xe'),_0x2a54aa,_0x134822[_0x9e81('0x13')][_0x9e81('0x15')]);return _0x130b9b(_0x134822[_0x9e81('0x13')]['message']);}else{logger[_0x9e81('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2a54aa,'request\x20sent');_0x130b9b(_0x134822[_0x9e81('0x16')]['message']);}})['catch'](function(_0x4d707d){logger[_0x9e81('0x13')](_0x9e81('0xe'),_0x2a54aa,_0x4d707d);_0x49ca68(_0x4d707d);});});}exports[_0x9e81('0x17')]=function(_0x3c1049){var _0x359612=this;return new Promise(function(_0x5d57bf,_0x7926d5){return db[_0x9e81('0x18')][_0x9e81('0x19')]({'raw':_0x3c1049[_0x9e81('0x1a')]?_0x3c1049[_0x9e81('0x1a')][_0x9e81('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c1049[_0x9e81('0x1a')]?_0x3c1049[_0x9e81('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x9e81('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x9e81('0x1d')))),_0x9e81('0x1e')]]})[_0x9e81('0x1f')](function(_0x21511f){logger[_0x9e81('0xd')]('GetVoiceQueueRtPauses',_0x3c1049);logger[_0x9e81('0x10')](_0x9e81('0x17'),_0x3c1049,JSON['stringify'](_0x21511f));_0x5d57bf(_0x21511f);})[_0x9e81('0x20')](function(_0xe383ff){logger[_0x9e81('0x13')]('GetVoiceQueueRtPauses',_0xe383ff[_0x9e81('0x15')],_0x3c1049);_0x7926d5(_0x359612['error'](0x1f4,_0xe383ff[_0x9e81('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 6334a8f..8cc1a0b 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 _0xe6e1=['update','emit','removeListener','register','length','userVoiceQueueRt:','remove'];(function(_0x55eb6d,_0x243056){var _0x3569da=function(_0x499b5b){while(--_0x499b5b){_0x55eb6d['push'](_0x55eb6d['shift']());}};_0x3569da(++_0x243056);}(_0xe6e1,0x1b8));var _0x1e6e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe6e1[_0x6131cd];return _0x47e916;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x1e6e('0x0'),_0x1e6e('0x1')];function createListener(_0x3af4e3,_0x46f131){return function(_0x2d9ca6){_0x46f131[_0x1e6e('0x2')](_0x3af4e3,_0x2d9ca6);};}function removeListener(_0x1e216d,_0x413e78){return function(){UserVoiceQueueRtEvents[_0x1e6e('0x3')](_0x1e216d,_0x413e78);};}exports[_0x1e6e('0x4')]=function(_0x50ff66){for(var _0x2e408b=0x0,_0x1db76e=events[_0x1e6e('0x5')];_0x2e408b<_0x1db76e;_0x2e408b++){var _0xef0947=events[_0x2e408b];var _0x59ad12=createListener(_0x1e6e('0x6')+_0xef0947,_0x50ff66);UserVoiceQueueRtEvents['on'](_0xef0947,_0x59ad12);}}; \ No newline at end of file +var _0xd079=['length','userVoiceQueueRt:','remove','emit','removeListener','register'];(function(_0x500174,_0x13bcb0){var _0xa72f5c=function(_0xdfb899){while(--_0xdfb899){_0x500174['push'](_0x500174['shift']());}};_0xa72f5c(++_0x13bcb0);}(_0xd079,0x182));var _0x9d07=function(_0x1a15b8,_0x59352f){_0x1a15b8=_0x1a15b8-0x0;var _0x4916c9=_0xd079[_0x1a15b8];return _0x4916c9;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9d07('0x0'),'update'];function createListener(_0x182490,_0x374b11){return function(_0x21a52a){_0x374b11[_0x9d07('0x1')](_0x182490,_0x21a52a);};}function removeListener(_0x34a637,_0x7cfb45){return function(){UserVoiceQueueRtEvents[_0x9d07('0x2')](_0x34a637,_0x7cfb45);};}exports[_0x9d07('0x3')]=function(_0x4d9288){for(var _0x52574c=0x0,_0x3c39f4=events[_0x9d07('0x4')];_0x52574c<_0x3c39f4;_0x52574c++){var _0x4fb26c=events[_0x52574c];var _0x445217=createListener(_0x9d07('0x5')+_0x4fb26c,_0x4d9288);UserVoiceQueueRtEvents['on'](_0x4fb26c,_0x445217);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 55b9247..c26d3fd 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 _0x0560=['../../config/environment','multer','path','connect-timeout'];(function(_0x493f92,_0x1318f3){var _0x262006=function(_0x5a1f22){while(--_0x5a1f22){_0x493f92['push'](_0x493f92['shift']());}};_0x262006(++_0x1318f3);}(_0x0560,0x95));var _0x0056=function(_0x572345,_0x228c9c){_0x572345=_0x572345-0x0;var _0x1b12c6=_0x0560[_0x572345];return _0x1b12c6;};'use strict';var multer=require(_0x0056('0x0'));var util=require('util');var path=require(_0x0056('0x1'));var timeout=require(_0x0056('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0056('0x3'));module['exports']=router; \ No newline at end of file +var _0xd051=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x3e6354,_0x265519){var _0x577c29=function(_0x42c595){while(--_0x42c595){_0x3e6354['push'](_0x3e6354['shift']());}};_0x577c29(++_0x265519);}(_0xd051,0xc5));var _0x1d05=function(_0x3438e5,_0x549b1f){_0x3438e5=_0x3438e5-0x0;var _0x224aea=_0xd051[_0x3438e5];return _0x224aea;};'use strict';var multer=require(_0x1d05('0x0'));var util=require(_0x1d05('0x1'));var path=require(_0x1d05('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d05('0x3'));var router=express[_0x1d05('0x4')]();var auth=require(_0x1d05('0x5'));var interaction=require(_0x1d05('0x6'));var config=require(_0x1d05('0x7'));module[_0x1d05('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f02fa07..71a88e5 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2afe26,_0x584c84){var _0x5a4e24=function(_0xcb89d5){while(--_0xcb89d5){_0x2afe26['push'](_0x2afe26['shift']());}};_0x5a4e24(++_0x584c84);}(_0xe706,0xa3));var _0x6e70=function(_0x4a4d8e,_0x22a7a9){_0x4a4d8e=_0x4a4d8e-0x0;var _0x1a5cb4=_0xe706[_0x4a4d8e];return _0x1a5cb4;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4dc91a,_0x2d639f){var _0x10f080=function(_0x2fb648){while(--_0x2fb648){_0x4dc91a['push'](_0x4dc91a['shift']());}};_0x10f080(++_0x2d639f);}(_0xe706,0xa3));var _0x6e70=function(_0x1c443f,_0x51319d){_0x1c443f=_0x1c443f-0x0;var _0x4a4a71=_0xe706[_0x1c443f];return _0x4a4a71;};'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 cc3e418..8ca2b32 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','../../config/logger'];(function(_0x2095ed,_0x156cfb){var _0x22dbb0=function(_0x385055){while(--_0x385055){_0x2095ed['push'](_0x2095ed['shift']());}};_0x22dbb0(++_0x156cfb);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e570c,_0x233990){_0x5e570c=_0x5e570c-0x0;var _0xc62527=_0xb10b[_0x5e570c];return _0xc62527;};'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')]('UserWhatsappQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63a5=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','UserWhatsappQueue','lodash','util'];(function(_0x4d2abc,_0x29b228){var _0x5c4540=function(_0x2c7dd5){while(--_0x2c7dd5){_0x4d2abc['push'](_0x4d2abc['shift']());}};_0x5c4540(++_0x29b228);}(_0x63a5,0x18e));var _0x563a=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x63a5[_0x4ae829];return _0x256b31;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var logger=require(_0x563a('0x2'))('api');var moment=require(_0x563a('0x3'));var BPromise=require('bluebird');var rp=require(_0x563a('0x4'));var fs=require('fs');var path=require(_0x563a('0x5'));var rimraf=require(_0x563a('0x6'));var config=require(_0x563a('0x7'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x1fdcb0,_0x5a6458){return _0x1fdcb0[_0x563a('0x8')](_0x563a('0x9'),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 16ae4e6..6bce743 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(_0x203913,_0x5b3ad5){var _0x5b657e=function(_0x47025a){while(--_0x47025a){_0x203913['push'](_0x203913['shift']());}};_0x5b657e(++_0x5b3ad5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x34e72a,_0x5cdae4){var _0x117b20=function(_0x37a5b7){while(--_0x37a5b7){_0x34e72a['push'](_0x34e72a['shift']());}};_0x117b20(++_0x5cdae4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 db56f8c..8b8ec5c 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 _0x033a=['create','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','show','post'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x033a,0x1ed));var _0xa033=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x033a[_0x3ec1da];return _0x472358;};'use strict';var multer=require(_0xa033('0x0'));var util=require('util');var path=require(_0xa033('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa033('0x2')]();var auth=require(_0xa033('0x3'));var interaction=require(_0xa033('0x4'));var config=require(_0xa033('0x5'));var controller=require(_0xa033('0x6'));router[_0xa033('0x7')]('/',auth[_0xa033('0x8')](),controller['index']);router[_0xa033('0x7')]('/:id',auth[_0xa033('0x8')](),controller[_0xa033('0x9')]);router[_0xa033('0xa')]('/',auth[_0xa033('0x8')](),controller[_0xa033('0xb')]);router[_0xa033('0xc')](_0xa033('0xd'),auth[_0xa033('0x8')](),controller[_0xa033('0xe')]);router[_0xa033('0xf')](_0xa033('0xd'),auth[_0xa033('0x8')](),controller[_0xa033('0x10')]);module[_0xa033('0x11')]=router; \ No newline at end of file +var _0x5fa3=['/:id','isAuthenticated','create','put','delete','exports','path','express','../../components/interaction/service','../../config/environment','./variable.controller','get'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x5fa3,0x14a));var _0x35fa=function(_0x2f2ac3,_0x4a24cb){_0x2f2ac3=_0x2f2ac3-0x0;var _0x488d66=_0x5fa3[_0x2f2ac3];return _0x488d66;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x35fa('0x0'));var timeout=require('connect-timeout');var express=require(_0x35fa('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x35fa('0x2'));var config=require(_0x35fa('0x3'));var controller=require(_0x35fa('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x35fa('0x5')](_0x35fa('0x6'),auth[_0x35fa('0x7')](),controller['show']);router['post']('/',auth[_0x35fa('0x7')](),controller[_0x35fa('0x8')]);router[_0x35fa('0x9')](_0x35fa('0x6'),auth[_0x35fa('0x7')](),controller['update']);router[_0x35fa('0xa')](_0x35fa('0x6'),auth['isAuthenticated'](),controller['destroy']);module[_0x35fa('0xb')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 5026aa8..c742598 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 _0x263c=['sequelize','exports','STRING'];(function(_0x4aadae,_0x865635){var _0x593adf=function(_0x2a43c2){while(--_0x2a43c2){_0x4aadae['push'](_0x4aadae['shift']());}};_0x593adf(++_0x865635);}(_0x263c,0x1e0));var _0xc263=function(_0x34d703,_0xb42f05){_0x34d703=_0x34d703-0x0;var _0x39f780=_0x263c[_0x34d703];return _0x39f780;};'use strict';var Sequelize=require(_0xc263('0x0'));module[_0xc263('0x1')]={'name':{'type':Sequelize[_0xc263('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc263('0x2')]}}; \ No newline at end of file +var _0xd901=['STRING','name','exports'];(function(_0x385b2e,_0x3f02f1){var _0x3910a0=function(_0x28a1b2){while(--_0x28a1b2){_0x385b2e['push'](_0x385b2e['shift']());}};_0x3910a0(++_0x3f02f1);}(_0xd901,0x194));var _0x1d90=function(_0x7e251,_0x32c59e){_0x7e251=_0x7e251-0x0;var _0x52dd96=_0xd901[_0x7e251];return _0x52dd96;};'use strict';var Sequelize=require('sequelize');module[_0x1d90('0x0')]={'name':{'type':Sequelize[_0x1d90('0x1')],'unique':_0x1d90('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d90('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a04d10d..ca5ba8f 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 _0xf17b=['role','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','Variable','include','findAll','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x5123b0,_0xe30bd5){var _0x33e37a=function(_0x55c4ca){while(--_0x55c4ca){_0x5123b0['push'](_0x5123b0['shift']());}};_0x33e37a(++_0xe30bd5);}(_0xf17b,0x13e));var _0xbf17=function(_0x48965f,_0x5c8550){_0x48965f=_0x48965f-0x0;var _0x274747=_0xf17b[_0x48965f];return _0x274747;};'use strict';var pdf=require(_0xbf17('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf17('0x1'));var jsonpatch=require(_0xbf17('0x2'));var rp=require('request-promise');var moment=require(_0xbf17('0x3'));var BPromise=require(_0xbf17('0x4'));var Mustache=require(_0xbf17('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbf17('0x6'));var csv=require(_0xbf17('0x7'));var ejs=require(_0xbf17('0x8'));var fs=require('fs');var _=require(_0xbf17('0x9'));var squel=require(_0xbf17('0xa'));var crypto=require(_0xbf17('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbf17('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf17('0xd'));var Redis=require('ioredis');var authService=require(_0xbf17('0xe'));var qs=require(_0xbf17('0xf'));var as=require(_0xbf17('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf17('0x11'));var utils=require(_0xbf17('0x12'));var config=require(_0xbf17('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x79436a,_0x4231ce){_0x4231ce=_0x4231ce||0xcc;return function(_0x3614f5){if(_0x3614f5){return _0x79436a['sendStatus'](_0x4231ce);}return _0x79436a[_0xbf17('0x14')](_0x4231ce)[_0xbf17('0x15')]();};}function respondWithResult(_0x27efa0,_0x27a0c8){_0x27a0c8=_0x27a0c8||0xc8;return function(_0x4334f9){if(_0x4334f9){return _0x27efa0[_0xbf17('0x14')](_0x27a0c8)['json'](_0x4334f9);}};}function respondWithFilteredResult(_0x12292a,_0x217870){return function(_0x34df22){if(_0x34df22){var _0xc58cb5=_0x34df22[_0xbf17('0x16')],_0x42f190=_0x217870['offset'],_0x1c2541=_0x217870[_0xbf17('0x17')]+_0x217870['limit'],_0x393de2;if(_0x1c2541>=_0xc58cb5){_0x1c2541=_0xc58cb5;_0x393de2=0xc8;}else{_0x393de2=0xce;}_0x12292a[_0xbf17('0x14')](_0x393de2);return _0x12292a[_0xbf17('0x18')]('Content-Range',_0x42f190+'-'+_0x1c2541+'/'+_0xc58cb5)[_0xbf17('0x19')](_0x34df22);}return null;};}function patchUpdates(_0x55bcfa){return function(_0x476d43){try{jsonpatch[_0xbf17('0x1a')](_0x476d43,_0x55bcfa,!![]);}catch(_0x5f34fd){return BPromise[_0xbf17('0x1b')](_0x5f34fd);}return _0x476d43[_0xbf17('0x1c')]();};}function saveUpdates(_0x13c940,_0x5708c4){return function(_0x5ef862){if(_0x5ef862){return _0x5ef862[_0xbf17('0x1d')](_0x13c940)[_0xbf17('0x1e')](function(_0x41926f){return _0x41926f;});}return null;};}function removeEntity(_0x499575,_0x4afe22){return function(_0xed0abc){if(_0xed0abc){return _0xed0abc[_0xbf17('0x1f')]()[_0xbf17('0x1e')](function(){var _0x4cce3f=_0xed0abc[_0xbf17('0x20')]({'plain':!![]});var _0x49ea22=_0xbf17('0x21');return db[_0xbf17('0x22')][_0xbf17('0x1f')]({'where':{'type':_0x49ea22,'resourceId':_0x4cce3f['id']}})[_0xbf17('0x1e')](function(){return _0xed0abc;});})[_0xbf17('0x1e')](function(){_0x499575[_0xbf17('0x14')](0xcc)[_0xbf17('0x15')]();});}};}function handleEntityNotFound(_0x39c0bf,_0x1289ed){return function(_0x1ae261){if(!_0x1ae261){_0x39c0bf['sendStatus'](0x194);}return _0x1ae261;};}function handleError(_0x1898ed,_0x2d17eb){_0x2d17eb=_0x2d17eb||0x1f4;return function(_0x4c0eff){logger[_0xbf17('0x23')](_0x4c0eff[_0xbf17('0x24')]);if(_0x4c0eff[_0xbf17('0x25')]){delete _0x4c0eff[_0xbf17('0x25')];}_0x1898ed[_0xbf17('0x14')](_0x2d17eb)[_0xbf17('0x26')](_0x4c0eff);};}exports[_0xbf17('0x27')]=function(_0x16c9fc,_0x51899b){var _0x3359da={},_0x126c87={},_0xca9415={'count':0x0,'rows':[]};var _0x50acf6=_[_0xbf17('0x28')](db['Variable'][_0xbf17('0x29')],function(_0x3f2d18){return{'name':_0x3f2d18['fieldName'],'type':_0x3f2d18[_0xbf17('0x2a')]['key']};});_0x126c87[_0xbf17('0x2b')]=_[_0xbf17('0x28')](_0x50acf6,_0xbf17('0x25'));_0x126c87[_0xbf17('0x2c')]=_[_0xbf17('0x2d')](_0x16c9fc['query']);_0x126c87[_0xbf17('0x2e')]=_[_0xbf17('0x2f')](_0x126c87[_0xbf17('0x2b')],_0x126c87['query']);_0x3359da[_0xbf17('0x30')]=_['intersection'](_0x126c87[_0xbf17('0x2b')],qs[_0xbf17('0x31')](_0x16c9fc[_0xbf17('0x2c')]['fields']));_0x3359da[_0xbf17('0x30')]=_0x3359da['attributes'][_0xbf17('0x32')]?_0x3359da['attributes']:_0x126c87[_0xbf17('0x2b')];if(!_0x16c9fc[_0xbf17('0x2c')][_0xbf17('0x33')](_0xbf17('0x34'))){_0x3359da[_0xbf17('0x35')]=qs['limit'](_0x16c9fc[_0xbf17('0x2c')]['limit']);_0x3359da[_0xbf17('0x17')]=qs[_0xbf17('0x17')](_0x16c9fc[_0xbf17('0x2c')][_0xbf17('0x17')]);}_0x3359da[_0xbf17('0x36')]=qs[_0xbf17('0x37')](_0x16c9fc[_0xbf17('0x2c')][_0xbf17('0x37')]);_0x3359da['where']=qs[_0xbf17('0x2e')](_[_0xbf17('0x38')](_0x16c9fc[_0xbf17('0x2c')],_0x126c87[_0xbf17('0x2e')]),_0x50acf6);if(_0x16c9fc[_0xbf17('0x2c')][_0xbf17('0x39')]){_0x3359da[_0xbf17('0x3a')]=_[_0xbf17('0x3b')](_0x3359da[_0xbf17('0x3a')],{'$or':_[_0xbf17('0x28')](_0x50acf6,function(_0xf7f110){if(_0xf7f110[_0xbf17('0x2a')]!==_0xbf17('0x3c')){var _0x2ba56a={};_0x2ba56a[_0xf7f110[_0xbf17('0x25')]]={'$like':'%'+_0x16c9fc[_0xbf17('0x2c')]['filter']+'%'};return _0x2ba56a;}})});}_0x3359da=_[_0xbf17('0x3b')]({},_0x3359da,_0x16c9fc[_0xbf17('0x3d')]);var _0x32eabc={'where':_0x3359da[_0xbf17('0x3a')]};return db[_0xbf17('0x3e')][_0xbf17('0x16')](_0x32eabc)[_0xbf17('0x1e')](function(_0x4da1fe){_0xca9415[_0xbf17('0x16')]=_0x4da1fe;if(_0x16c9fc[_0xbf17('0x2c')]['includeAll']){_0x3359da[_0xbf17('0x3f')]=[{'all':!![]}];}return db[_0xbf17('0x3e')][_0xbf17('0x40')](_0x3359da);})[_0xbf17('0x1e')](function(_0xd44bcd){_0xca9415['rows']=_0xd44bcd;return _0xca9415;})[_0xbf17('0x1e')](respondWithFilteredResult(_0x51899b,_0x3359da))['catch'](handleError(_0x51899b,null));};exports[_0xbf17('0x41')]=function(_0x303bfe,_0x210d31){var _0x431f05={'raw':!![],'where':{'id':_0x303bfe[_0xbf17('0x42')]['id']}},_0x54436b={};_0x54436b[_0xbf17('0x2b')]=_['keys'](db['Variable'][_0xbf17('0x29')]);_0x54436b[_0xbf17('0x2c')]=_['keys'](_0x303bfe[_0xbf17('0x2c')]);_0x54436b[_0xbf17('0x2e')]=_[_0xbf17('0x2f')](_0x54436b['model'],_0x54436b[_0xbf17('0x2c')]);_0x431f05[_0xbf17('0x30')]=_['intersection'](_0x54436b['model'],qs[_0xbf17('0x31')](_0x303bfe[_0xbf17('0x2c')][_0xbf17('0x31')]));_0x431f05[_0xbf17('0x30')]=_0x431f05['attributes'][_0xbf17('0x32')]?_0x431f05[_0xbf17('0x30')]:_0x54436b[_0xbf17('0x2b')];if(_0x303bfe[_0xbf17('0x2c')][_0xbf17('0x43')]){_0x431f05['include']=[{'all':!![]}];}_0x431f05=_[_0xbf17('0x3b')]({},_0x431f05,_0x303bfe[_0xbf17('0x3d')]);return db[_0xbf17('0x3e')][_0xbf17('0x44')](_0x431f05)[_0xbf17('0x1e')](handleEntityNotFound(_0x210d31,null))[_0xbf17('0x1e')](respondWithResult(_0x210d31,null))['catch'](handleError(_0x210d31,null));};exports[_0xbf17('0x45')]=function(_0x137f14,_0x393c07){return db['Variable'][_0xbf17('0x45')](_0x137f14[_0xbf17('0x46')],{})[_0xbf17('0x1e')](function(_0x40738a){var _0x34a9bf=_0x137f14['user'][_0xbf17('0x20')]({'plain':!![]});if(!_0x34a9bf)throw new Error(_0xbf17('0x47'));if(_0x34a9bf[_0xbf17('0x48')]===_0xbf17('0x49')){var _0x29e7ee=_0x40738a[_0xbf17('0x20')]({'plain':!![]});var _0x3a7d5b='Variables';return db[_0xbf17('0x4a')][_0xbf17('0x44')]({'where':{'name':_0x3a7d5b,'userProfileId':_0x34a9bf[_0xbf17('0x4b')]},'raw':!![]})[_0xbf17('0x1e')](function(_0x286cad){if(_0x286cad&&_0x286cad['autoAssociation']===0x0){return db[_0xbf17('0x22')][_0xbf17('0x45')]({'name':_0x29e7ee[_0xbf17('0x25')],'resourceId':_0x29e7ee['id'],'type':_0x286cad[_0xbf17('0x25')],'sectionId':_0x286cad['id']},{})[_0xbf17('0x1e')](function(){return _0x40738a;});}else{return _0x40738a;}})[_0xbf17('0x4c')](function(_0x38da55){logger['error'](_0xbf17('0x4d'),_0x38da55);throw _0x38da55;});}return _0x40738a;})['then'](respondWithResult(_0x393c07,0xc9))[_0xbf17('0x4c')](handleError(_0x393c07,null));};exports[_0xbf17('0x1d')]=function(_0xfeadf3,_0x1ba8df){if(_0xfeadf3[_0xbf17('0x46')]['id']){delete _0xfeadf3[_0xbf17('0x46')]['id'];}return db[_0xbf17('0x3e')][_0xbf17('0x44')]({'where':{'id':_0xfeadf3[_0xbf17('0x42')]['id']}})[_0xbf17('0x1e')](handleEntityNotFound(_0x1ba8df,null))[_0xbf17('0x1e')](saveUpdates(_0xfeadf3[_0xbf17('0x46')],null))[_0xbf17('0x1e')](respondWithResult(_0x1ba8df,null))[_0xbf17('0x4c')](handleError(_0x1ba8df,null));};exports[_0xbf17('0x1f')]=function(_0x3f5d73,_0x154cde){return db[_0xbf17('0x3e')][_0xbf17('0x44')]({'where':{'id':_0x3f5d73['params']['id']}})[_0xbf17('0x1e')](handleEntityNotFound(_0x154cde,null))[_0xbf17('0x1e')](removeEntity(_0x154cde,null))[_0xbf17('0x4c')](handleError(_0x154cde,null));}; \ No newline at end of file +var _0x5d9d=['set','apply','save','update','then','destroy','Variables','UserProfileResource','end','stack','name','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x18a80c,_0x343239){var _0x4eb123=function(_0x2a54b1){while(--_0x2a54b1){_0x18a80c['push'](_0x18a80c['shift']());}};_0x4eb123(++_0x343239);}(_0x5d9d,0xcc));var _0xd5d9=function(_0x2f71ce,_0xfc0c52){_0x2f71ce=_0x2f71ce-0x0;var _0x5d3d56=_0x5d9d[_0x2f71ce];return _0x5d3d56;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd5d9('0x0'));var rimraf=require(_0xd5d9('0x1'));var zipdir=require(_0xd5d9('0x2'));var jsonpatch=require(_0xd5d9('0x3'));var rp=require(_0xd5d9('0x4'));var moment=require(_0xd5d9('0x5'));var BPromise=require(_0xd5d9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd5d9('0x7'));var sox=require('sox');var csv=require(_0xd5d9('0x8'));var ejs=require(_0xd5d9('0x9'));var fs=require('fs');var _=require(_0xd5d9('0xa'));var squel=require(_0xd5d9('0xb'));var crypto=require(_0xd5d9('0xc'));var jsforce=require(_0xd5d9('0xd'));var deskjs=require(_0xd5d9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd5d9('0xf'));var Papa=require(_0xd5d9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd5d9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5d9('0x12'))(_0xd5d9('0x13'));var utils=require('../../config/utils');var config=require(_0xd5d9('0x14'));var db=require(_0xd5d9('0x15'))['db'];function respondWithStatusCode(_0x2b1711,_0x19e82f){_0x19e82f=_0x19e82f||0xcc;return function(_0x33770e){if(_0x33770e){return _0x2b1711[_0xd5d9('0x16')](_0x19e82f);}return _0x2b1711[_0xd5d9('0x17')](_0x19e82f)['end']();};}function respondWithResult(_0x367d56,_0x20b0e4){_0x20b0e4=_0x20b0e4||0xc8;return function(_0x3c6745){if(_0x3c6745){return _0x367d56['status'](_0x20b0e4)[_0xd5d9('0x18')](_0x3c6745);}};}function respondWithFilteredResult(_0x310b5c,_0x17729e){return function(_0xfb6f33){if(_0xfb6f33){var _0x3718af=_0xfb6f33[_0xd5d9('0x19')],_0x21347f=_0x17729e['offset'],_0x105da3=_0x17729e[_0xd5d9('0x1a')]+_0x17729e['limit'],_0xe53300;if(_0x105da3>=_0x3718af){_0x105da3=_0x3718af;_0xe53300=0xc8;}else{_0xe53300=0xce;}_0x310b5c[_0xd5d9('0x17')](_0xe53300);return _0x310b5c[_0xd5d9('0x1b')]('Content-Range',_0x21347f+'-'+_0x105da3+'/'+_0x3718af)[_0xd5d9('0x18')](_0xfb6f33);}return null;};}function patchUpdates(_0x13f0db){return function(_0x5e1ef9){try{jsonpatch[_0xd5d9('0x1c')](_0x5e1ef9,_0x13f0db,!![]);}catch(_0x31bbe4){return BPromise['reject'](_0x31bbe4);}return _0x5e1ef9[_0xd5d9('0x1d')]();};}function saveUpdates(_0x45aa52,_0x38bb53){return function(_0xcbd9ae){if(_0xcbd9ae){return _0xcbd9ae[_0xd5d9('0x1e')](_0x45aa52)[_0xd5d9('0x1f')](function(_0x20b6a6){return _0x20b6a6;});}return null;};}function removeEntity(_0x444bb7,_0x159046){return function(_0x5b26de){if(_0x5b26de){return _0x5b26de[_0xd5d9('0x20')]()['then'](function(){var _0x321424=_0x5b26de['get']({'plain':!![]});var _0x2889f=_0xd5d9('0x21');return db[_0xd5d9('0x22')][_0xd5d9('0x20')]({'where':{'type':_0x2889f,'resourceId':_0x321424['id']}})[_0xd5d9('0x1f')](function(){return _0x5b26de;});})[_0xd5d9('0x1f')](function(){_0x444bb7[_0xd5d9('0x17')](0xcc)[_0xd5d9('0x23')]();});}};}function handleEntityNotFound(_0x3bc3ce,_0x186d84){return function(_0x59b3e1){if(!_0x59b3e1){_0x3bc3ce[_0xd5d9('0x16')](0x194);}return _0x59b3e1;};}function handleError(_0x1cb74d,_0x56908c){_0x56908c=_0x56908c||0x1f4;return function(_0x14ec0d){logger['error'](_0x14ec0d[_0xd5d9('0x24')]);if(_0x14ec0d[_0xd5d9('0x25')]){delete _0x14ec0d['name'];}_0x1cb74d[_0xd5d9('0x17')](_0x56908c)['send'](_0x14ec0d);};}exports['index']=function(_0x26a784,_0xe59922){var _0x27ea81={},_0x1595b4={},_0x5e0af8={'count':0x0,'rows':[]};var _0x4a4453=_[_0xd5d9('0x26')](db[_0xd5d9('0x27')][_0xd5d9('0x28')],function(_0x1ccaa4){return{'name':_0x1ccaa4[_0xd5d9('0x29')],'type':_0x1ccaa4[_0xd5d9('0x2a')][_0xd5d9('0x2b')]};});_0x1595b4[_0xd5d9('0x2c')]=_['map'](_0x4a4453,'name');_0x1595b4['query']=_[_0xd5d9('0x2d')](_0x26a784[_0xd5d9('0x2e')]);_0x1595b4[_0xd5d9('0x2f')]=_[_0xd5d9('0x30')](_0x1595b4[_0xd5d9('0x2c')],_0x1595b4[_0xd5d9('0x2e')]);_0x27ea81['attributes']=_[_0xd5d9('0x30')](_0x1595b4[_0xd5d9('0x2c')],qs[_0xd5d9('0x31')](_0x26a784[_0xd5d9('0x2e')]['fields']));_0x27ea81[_0xd5d9('0x32')]=_0x27ea81[_0xd5d9('0x32')]['length']?_0x27ea81[_0xd5d9('0x32')]:_0x1595b4[_0xd5d9('0x2c')];if(!_0x26a784[_0xd5d9('0x2e')]['hasOwnProperty'](_0xd5d9('0x33'))){_0x27ea81['limit']=qs['limit'](_0x26a784[_0xd5d9('0x2e')][_0xd5d9('0x34')]);_0x27ea81[_0xd5d9('0x1a')]=qs['offset'](_0x26a784['query'][_0xd5d9('0x1a')]);}_0x27ea81[_0xd5d9('0x35')]=qs[_0xd5d9('0x36')](_0x26a784[_0xd5d9('0x2e')][_0xd5d9('0x36')]);_0x27ea81[_0xd5d9('0x37')]=qs['filters'](_[_0xd5d9('0x38')](_0x26a784['query'],_0x1595b4[_0xd5d9('0x2f')]),_0x4a4453);if(_0x26a784['query'][_0xd5d9('0x39')]){_0x27ea81[_0xd5d9('0x37')]=_[_0xd5d9('0x3a')](_0x27ea81[_0xd5d9('0x37')],{'$or':_[_0xd5d9('0x26')](_0x4a4453,function(_0x2d9b9d){if(_0x2d9b9d[_0xd5d9('0x2a')]!=='VIRTUAL'){var _0x364e9b={};_0x364e9b[_0x2d9b9d['name']]={'$like':'%'+_0x26a784[_0xd5d9('0x2e')][_0xd5d9('0x39')]+'%'};return _0x364e9b;}})});}_0x27ea81=_['merge']({},_0x27ea81,_0x26a784[_0xd5d9('0x3b')]);var _0x3d5637={'where':_0x27ea81[_0xd5d9('0x37')]};return db[_0xd5d9('0x27')]['count'](_0x3d5637)[_0xd5d9('0x1f')](function(_0x190153){_0x5e0af8[_0xd5d9('0x19')]=_0x190153;if(_0x26a784[_0xd5d9('0x2e')][_0xd5d9('0x3c')]){_0x27ea81[_0xd5d9('0x3d')]=[{'all':!![]}];}return db[_0xd5d9('0x27')][_0xd5d9('0x3e')](_0x27ea81);})[_0xd5d9('0x1f')](function(_0x531fdb){_0x5e0af8[_0xd5d9('0x3f')]=_0x531fdb;return _0x5e0af8;})[_0xd5d9('0x1f')](respondWithFilteredResult(_0xe59922,_0x27ea81))[_0xd5d9('0x40')](handleError(_0xe59922,null));};exports['show']=function(_0x5f4370,_0x185698){var _0x4216b8={'raw':!![],'where':{'id':_0x5f4370[_0xd5d9('0x41')]['id']}},_0x49e5ee={};_0x49e5ee[_0xd5d9('0x2c')]=_['keys'](db[_0xd5d9('0x27')][_0xd5d9('0x28')]);_0x49e5ee[_0xd5d9('0x2e')]=_[_0xd5d9('0x2d')](_0x5f4370[_0xd5d9('0x2e')]);_0x49e5ee[_0xd5d9('0x2f')]=_[_0xd5d9('0x30')](_0x49e5ee[_0xd5d9('0x2c')],_0x49e5ee['query']);_0x4216b8[_0xd5d9('0x32')]=_[_0xd5d9('0x30')](_0x49e5ee['model'],qs['fields'](_0x5f4370[_0xd5d9('0x2e')][_0xd5d9('0x31')]));_0x4216b8['attributes']=_0x4216b8['attributes'][_0xd5d9('0x42')]?_0x4216b8[_0xd5d9('0x32')]:_0x49e5ee[_0xd5d9('0x2c')];if(_0x5f4370[_0xd5d9('0x2e')][_0xd5d9('0x3c')]){_0x4216b8['include']=[{'all':!![]}];}_0x4216b8=_[_0xd5d9('0x3a')]({},_0x4216b8,_0x5f4370[_0xd5d9('0x3b')]);return db[_0xd5d9('0x27')][_0xd5d9('0x43')](_0x4216b8)[_0xd5d9('0x1f')](handleEntityNotFound(_0x185698,null))['then'](respondWithResult(_0x185698,null))[_0xd5d9('0x40')](handleError(_0x185698,null));};exports[_0xd5d9('0x44')]=function(_0x193f61,_0x2c8baf){return db[_0xd5d9('0x27')][_0xd5d9('0x44')](_0x193f61['body'],{})[_0xd5d9('0x1f')](function(_0x1ce243){var _0x5a3fa4=_0x193f61[_0xd5d9('0x45')]['get']({'plain':!![]});if(!_0x5a3fa4)throw new Error(_0xd5d9('0x46'));if(_0x5a3fa4[_0xd5d9('0x47')]==='user'){var _0x22898b=_0x1ce243['get']({'plain':!![]});var _0xb8d0dd=_0xd5d9('0x21');return db[_0xd5d9('0x48')][_0xd5d9('0x43')]({'where':{'name':_0xb8d0dd,'userProfileId':_0x5a3fa4[_0xd5d9('0x49')]},'raw':!![]})[_0xd5d9('0x1f')](function(_0x3eb8cb){if(_0x3eb8cb&&_0x3eb8cb[_0xd5d9('0x4a')]===0x0){return db['UserProfileResource'][_0xd5d9('0x44')]({'name':_0x22898b['name'],'resourceId':_0x22898b['id'],'type':_0x3eb8cb[_0xd5d9('0x25')],'sectionId':_0x3eb8cb['id']},{})[_0xd5d9('0x1f')](function(){return _0x1ce243;});}else{return _0x1ce243;}})[_0xd5d9('0x40')](function(_0x2e3624){logger[_0xd5d9('0x4b')](_0xd5d9('0x4c'),_0x2e3624);throw _0x2e3624;});}return _0x1ce243;})[_0xd5d9('0x1f')](respondWithResult(_0x2c8baf,0xc9))[_0xd5d9('0x40')](handleError(_0x2c8baf,null));};exports[_0xd5d9('0x1e')]=function(_0x23bb31,_0x55730c){if(_0x23bb31['body']['id']){delete _0x23bb31['body']['id'];}return db[_0xd5d9('0x27')][_0xd5d9('0x43')]({'where':{'id':_0x23bb31['params']['id']}})[_0xd5d9('0x1f')](handleEntityNotFound(_0x55730c,null))['then'](saveUpdates(_0x23bb31['body'],null))[_0xd5d9('0x1f')](respondWithResult(_0x55730c,null))[_0xd5d9('0x40')](handleError(_0x55730c,null));};exports['destroy']=function(_0xcaacf4,_0x3a6540){return db[_0xd5d9('0x27')][_0xd5d9('0x43')]({'where':{'id':_0xcaacf4[_0xd5d9('0x41')]['id']}})[_0xd5d9('0x1f')](handleEntityNotFound(_0x3a6540,null))[_0xd5d9('0x1f')](removeEntity(_0x3a6540,null))[_0xd5d9('0x40')](handleError(_0x3a6540,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index b4d0084..5a07794 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 _0xdcd0=['rimraf','../../config/environment','./variable.attributes','define','Variable','lodash','../../config/logger','bluebird','request-promise'];(function(_0x139b0f,_0x494d18){var _0x595ee5=function(_0x1feeff){while(--_0x1feeff){_0x139b0f['push'](_0x139b0f['shift']());}};_0x595ee5(++_0x494d18);}(_0xdcd0,0xb9));var _0x0dcd=function(_0x565e3c,_0x4adb00){_0x565e3c=_0x565e3c-0x0;var _0x59b3f6=_0xdcd0[_0x565e3c];return _0x59b3f6;};'use strict';var _=require(_0x0dcd('0x0'));var util=require('util');var logger=require(_0x0dcd('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0dcd('0x2'));var rp=require(_0x0dcd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dcd('0x4'));var config=require(_0x0dcd('0x5'));var attributes=require(_0x0dcd('0x6'));module['exports']=function(_0xed46fb,_0x440bdd){return _0xed46fb[_0x0dcd('0x7')](_0x0dcd('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable'];(function(_0x3220d0,_0x43b116){var _0x1443b8=function(_0x147181){while(--_0x147181){_0x3220d0['push'](_0x3220d0['shift']());}};_0x1443b8(++_0x43b116);}(_0x34e8,0x12c));var _0x834e=function(_0xfa3cf1,_0x5a55f5){_0xfa3cf1=_0xfa3cf1-0x0;var _0x2fea0c=_0x34e8[_0xfa3cf1];return _0x2fea0c;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'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 65016e0..35defec 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 _0x7db4=['http','request','then','Variable,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7db4,0x1a9));var _0x47db=function(_0x1a5796,_0x38cfa6){_0x1a5796=_0x1a5796-0x0;var _0x1e45ca=_0x7db4[_0x1a5796];return _0x1e45ca;};'use strict';var _=require(_0x47db('0x0'));var util=require('util');var moment=require(_0x47db('0x1'));var BPromise=require(_0x47db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47db('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x47db('0x4'));var logger=require('../../config/logger')(_0x47db('0x5'));var config=require(_0x47db('0x6'));var jayson=require(_0x47db('0x7'));var client=jayson[_0x47db('0x8')][_0x47db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43b1d4,_0xe9deb,_0x4a3145){return new BPromise(function(_0x2af33b,_0x5d6670){return client[_0x47db('0xa')](_0x43b1d4,_0x4a3145)[_0x47db('0xb')](function(_0x112877){logger['info'](_0x47db('0xc'),_0xe9deb,'request\x20sent');logger[_0x47db('0xd')]('Variable,\x20%s,\x20%s,\x20%s',_0xe9deb,_0x47db('0xe'),JSON[_0x47db('0xf')](_0x112877));if(_0x112877[_0x47db('0x10')]){if(_0x112877['error'][_0x47db('0x11')]===0x1f4){logger['error'](_0x47db('0xc'),_0xe9deb,_0x112877[_0x47db('0x10')][_0x47db('0x12')]);return _0x5d6670(_0x112877[_0x47db('0x10')][_0x47db('0x12')]);}logger[_0x47db('0x10')](_0x47db('0xc'),_0xe9deb,_0x112877[_0x47db('0x10')][_0x47db('0x12')]);return _0x2af33b(_0x112877[_0x47db('0x10')]['message']);}else{logger[_0x47db('0x13')](_0x47db('0xc'),_0xe9deb,_0x47db('0xe'));_0x2af33b(_0x112877[_0x47db('0x14')][_0x47db('0x12')]);}})['catch'](function(_0x4935ac){logger[_0x47db('0x10')]('Variable,\x20%s,\x20%s',_0xe9deb,_0x4935ac);_0x5d6670(_0x4935ac);});});}exports[_0x47db('0x15')]=function(_0x2489c8){var _0x117258=this;return new Promise(function(_0x249749,_0x6c0ee8){return db[_0x47db('0x16')][_0x47db('0x17')]({'raw':_0x2489c8['options']?_0x2489c8[_0x47db('0x18')][_0x47db('0x19')]===undefined?!![]:![]:!![],'where':_0x2489c8[_0x47db('0x18')]?_0x2489c8[_0x47db('0x18')][_0x47db('0x1a')]||null:null,'attributes':_0x2489c8[_0x47db('0x18')]?_0x2489c8[_0x47db('0x18')][_0x47db('0x1b')]||null:null,'include':_0x2489c8[_0x47db('0x18')]?_0x2489c8[_0x47db('0x18')][_0x47db('0x1c')]?_[_0x47db('0x1d')](_0x2489c8[_0x47db('0x18')][_0x47db('0x1c')],function(_0xfed0c9){return{'model':db[_0xfed0c9[_0x47db('0x1e')]],'as':_0xfed0c9['as'],'attributes':_0xfed0c9[_0x47db('0x1b')],'include':_0xfed0c9[_0x47db('0x1c')]?_[_0x47db('0x1d')](_0xfed0c9['include'],function(_0x2edd61){return{'model':db[_0x2edd61[_0x47db('0x1e')]],'as':_0x2edd61['as'],'attributes':_0x2edd61[_0x47db('0x1b')],'include':_0x2edd61[_0x47db('0x1c')]?_[_0x47db('0x1d')](_0x2edd61[_0x47db('0x1c')],function(_0x5d0eff){return{'model':db[_0x5d0eff[_0x47db('0x1e')]],'as':_0x5d0eff['as'],'attributes':_0x5d0eff[_0x47db('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23a12b){logger[_0x47db('0x13')]('ShowVariable',_0x2489c8);logger[_0x47db('0xd')](_0x47db('0x15'),_0x2489c8,JSON[_0x47db('0xf')](_0x23a12b));_0x249749(_0x23a12b);})['catch'](function(_0x3c2f56){logger['error'](_0x47db('0x15'),_0x3c2f56['message'],_0x2489c8);_0x6c0ee8(_0x117258[_0x47db('0x10')](0x1f4,_0x3c2f56[_0x47db('0x12')]));});});}; \ No newline at end of file +var _0x8cfd=['message','result','catch','ShowVariable','find','options','raw','attributes','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x30bcc0,_0x71204e){var _0x4b43a1=function(_0xb8bdd1){while(--_0xb8bdd1){_0x30bcc0['push'](_0x30bcc0['shift']());}};_0x4b43a1(++_0x71204e);}(_0x8cfd,0x141));var _0xd8cf=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x8cfd[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var moment=require(_0xd8cf('0x2'));var BPromise=require(_0xd8cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8cf('0x4'));var db=require(_0xd8cf('0x5'))['db'];var utils=require(_0xd8cf('0x6'));var logger=require(_0xd8cf('0x7'))(_0xd8cf('0x8'));var config=require(_0xd8cf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd8cf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38214f,_0x4df648,_0x298136){return new BPromise(function(_0xa006b8,_0x393753){return client[_0xd8cf('0xb')](_0x38214f,_0x298136)[_0xd8cf('0xc')](function(_0x5bdc96){logger[_0xd8cf('0xd')](_0xd8cf('0xe'),_0x4df648,_0xd8cf('0xf'));logger[_0xd8cf('0x10')]('Variable,\x20%s,\x20%s,\x20%s',_0x4df648,'request\x20sent',JSON[_0xd8cf('0x11')](_0x5bdc96));if(_0x5bdc96[_0xd8cf('0x12')]){if(_0x5bdc96['error'][_0xd8cf('0x13')]===0x1f4){logger[_0xd8cf('0x12')](_0xd8cf('0xe'),_0x4df648,_0x5bdc96[_0xd8cf('0x12')][_0xd8cf('0x14')]);return _0x393753(_0x5bdc96['error'][_0xd8cf('0x14')]);}logger[_0xd8cf('0x12')]('Variable,\x20%s,\x20%s',_0x4df648,_0x5bdc96['error'][_0xd8cf('0x14')]);return _0xa006b8(_0x5bdc96['error'][_0xd8cf('0x14')]);}else{logger[_0xd8cf('0xd')](_0xd8cf('0xe'),_0x4df648,_0xd8cf('0xf'));_0xa006b8(_0x5bdc96[_0xd8cf('0x15')][_0xd8cf('0x14')]);}})[_0xd8cf('0x16')](function(_0x123207){logger[_0xd8cf('0x12')](_0xd8cf('0xe'),_0x4df648,_0x123207);_0x393753(_0x123207);});});}exports[_0xd8cf('0x17')]=function(_0x185fdf){var _0x381a3b=this;return new Promise(function(_0xb94425,_0x234c33){return db['Variable'][_0xd8cf('0x18')]({'raw':_0x185fdf[_0xd8cf('0x19')]?_0x185fdf[_0xd8cf('0x19')][_0xd8cf('0x1a')]===undefined?!![]:![]:!![],'where':_0x185fdf[_0xd8cf('0x19')]?_0x185fdf[_0xd8cf('0x19')]['where']||null:null,'attributes':_0x185fdf[_0xd8cf('0x19')]?_0x185fdf[_0xd8cf('0x19')][_0xd8cf('0x1b')]||null:null,'include':_0x185fdf['options']?_0x185fdf[_0xd8cf('0x19')]['include']?_[_0xd8cf('0x1c')](_0x185fdf[_0xd8cf('0x19')][_0xd8cf('0x1d')],function(_0x191ddd){return{'model':db[_0x191ddd[_0xd8cf('0x1e')]],'as':_0x191ddd['as'],'attributes':_0x191ddd['attributes'],'include':_0x191ddd[_0xd8cf('0x1d')]?_[_0xd8cf('0x1c')](_0x191ddd[_0xd8cf('0x1d')],function(_0x17fc8b){return{'model':db[_0x17fc8b[_0xd8cf('0x1e')]],'as':_0x17fc8b['as'],'attributes':_0x17fc8b[_0xd8cf('0x1b')],'include':_0x17fc8b[_0xd8cf('0x1d')]?_[_0xd8cf('0x1c')](_0x17fc8b[_0xd8cf('0x1d')],function(_0x3d90fc){return{'model':db[_0x3d90fc[_0xd8cf('0x1e')]],'as':_0x3d90fc['as'],'attributes':_0x3d90fc[_0xd8cf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd8cf('0xc')](function(_0x4b29ad){logger[_0xd8cf('0xd')]('ShowVariable',_0x185fdf);logger[_0xd8cf('0x10')]('ShowVariable',_0x185fdf,JSON[_0xd8cf('0x11')](_0x4b29ad));_0xb94425(_0x4b29ad);})['catch'](function(_0x16893e){logger[_0xd8cf('0x12')](_0xd8cf('0x17'),_0x16893e[_0xd8cf('0x14')],_0x185fdf);_0x234c33(_0x381a3b['error'](0x1f4,_0x16893e[_0xd8cf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index ded4d10..5831897 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 _0xf031=['/restart','restart','migrations','exports','express','Router','./version.controller','get','index','fetch','/reset','/pull','isAuthenticated','pull'];(function(_0x2fbdfc,_0x1e3a23){var _0x571a68=function(_0x3e17d4){while(--_0x3e17d4){_0x2fbdfc['push'](_0x2fbdfc['shift']());}};_0x571a68(++_0x1e3a23);}(_0xf031,0xe4));var _0x1f03=function(_0x96dcec,_0xc977e4){_0x96dcec=_0x96dcec-0x0;var _0x47e493=_0xf031[_0x96dcec];return _0x47e493;};'use strict';var express=require(_0x1f03('0x0'));var router=express[_0x1f03('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x1f03('0x2'));router[_0x1f03('0x3')]('/',controller[_0x1f03('0x4')]);router['get']('/fetch',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x1f03('0x5')]);router[_0x1f03('0x3')](_0x1f03('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router[_0x1f03('0x3')](_0x1f03('0x7'),auth[_0x1f03('0x8')](),auth['canUpdate'](),controller[_0x1f03('0x9')]);router['get'](_0x1f03('0xa'),auth[_0x1f03('0x8')](),controller[_0x1f03('0xb')]);router[_0x1f03('0x3')]('/migrations',controller[_0x1f03('0xc')]);module[_0x1f03('0xd')]=router; \ No newline at end of file +var _0xeb1e=['./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','restart','migrations','express','Router','../../components/auth/service'];(function(_0x768458,_0x3d0933){var _0x31385c=function(_0xf11dad){while(--_0xf11dad){_0x768458['push'](_0x768458['shift']());}};_0x31385c(++_0x3d0933);}(_0xeb1e,0x115));var _0xeeb1=function(_0x1d979c,_0x5c55c3){_0x1d979c=_0x1d979c-0x0;var _0x4bceb6=_0xeb1e[_0x1d979c];return _0x4bceb6;};'use strict';var express=require(_0xeeb1('0x0'));var router=express[_0xeeb1('0x1')]();var auth=require(_0xeeb1('0x2'));var controller=require(_0xeeb1('0x3'));router['get']('/',controller[_0xeeb1('0x4')]);router[_0xeeb1('0x5')](_0xeeb1('0x6'),auth[_0xeeb1('0x7')](),auth[_0xeeb1('0x8')](),controller[_0xeeb1('0x9')]);router[_0xeeb1('0x5')]('/reset',auth[_0xeeb1('0x7')](),auth['canUpdate'](),controller[_0xeeb1('0xa')]);router[_0xeeb1('0x5')](_0xeeb1('0xb'),auth[_0xeeb1('0x7')](),auth[_0xeeb1('0x8')](),controller['pull']);router['get']('/restart',auth[_0xeeb1('0x7')](),controller[_0xeeb1('0xc')]);router['get']('/migrations',controller[_0xeeb1('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 95fe186..00d72fc 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 _0xf7f7=['restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','exports','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.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','version','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x1bc2b2,_0x5d8d4e){var _0xfbba61=function(_0x41a041){while(--_0x41a041){_0x1bc2b2['push'](_0x1bc2b2['shift']());}};_0xfbba61(++_0x5d8d4e);}(_0xf7f7,0x192));var _0x7f7f=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0xf7f7[_0x577519];return _0x5b12f7;};'use strict';var Umzug=require(_0x7f7f('0x0'));var path=require(_0x7f7f('0x1'));var fs=require('fs');var _=require(_0x7f7f('0x2'));var pkginfo=require(_0x7f7f('0x3'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x7f7f('0x4'))[_0x7f7f('0x5')];var db=require(_0x7f7f('0x6'))['db'];var config=require(_0x7f7f('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x7f7f('0x8'))(_0x7f7f('0x9'));var git=require(_0x7f7f('0xa'))(config[_0x7f7f('0xb')]);exports['index']=function(_0x2cb854,_0x58ac2b){var _0xebd8af={'current':module['exports'][_0x7f7f('0xc')],'phonebar':0x2};if(_0x2cb854['query']&&_0x2cb854[_0x7f7f('0xd')][_0x7f7f('0xe')]){return git[_0x7f7f('0xf')]()['tags'](function(_0x88b55d,_0x34afb1){_0xebd8af[_0x7f7f('0xe')]=(_0x88b55d?module['exports']['version']:_0x34afb1['latest'])||_0x7f7f('0x10');return _0x58ac2b[_0x7f7f('0x11')](0xc8)[_0x7f7f('0x12')](_0xebd8af);});}else{return _0x58ac2b[_0x7f7f('0x11')](0xc8)['json'](_0xebd8af);}};exports['fetch']=function(_0x35d690,_0xd54f98){return git[_0x7f7f('0xf')]([_0x7f7f('0x13'),_0x7f7f('0x14')],function(_0x131ed1){if(_0x131ed1){logger[_0x7f7f('0x15')](_0x131ed1);return _0xd54f98[_0x7f7f('0x11')](0x1f4)[_0x7f7f('0x12')](_0x131ed1);}logger[_0x7f7f('0x16')](_0x7f7f('0x17'));return _0xd54f98[_0x7f7f('0x11')](0xc8)[_0x7f7f('0x12')]({'output':_0x7f7f('0x18')});});};exports[_0x7f7f('0x19')]=function(_0x1aadaa,_0x410957){return git[_0x7f7f('0x19')]([_0x7f7f('0x1a'),_0x7f7f('0x1b')],function(_0x4313c6){if(_0x4313c6){logger['error'](_0x4313c6);return _0x410957[_0x7f7f('0x11')](0x1f4)[_0x7f7f('0x12')](_0x4313c6);}logger[_0x7f7f('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x410957[_0x7f7f('0x11')](0xc8)['json']({'output':_0x7f7f('0x1c')});});};exports[_0x7f7f('0x1d')]=function(_0x45c12b,_0x220780){exec('npm\x20install\x20--production',function(_0x72b10a,_0x9a51d7,_0x3d25a6){logger['info'](_0x9a51d7);logger[_0x7f7f('0x16')](_0x3d25a6);if(_0x72b10a){logger['error'](_0x72b10a);return _0x220780['status'](0x1f4)['json'](_0x72b10a);}return _0x220780[_0x7f7f('0x11')](0xc8)['json']({'output':_0x9a51d7});});};exports[_0x7f7f('0x1e')]=function(_0x57e4d0,_0x1ff21d){return pm2[_0x7f7f('0x1e')]('motion2')[_0x7f7f('0x1f')](function(_0x1716f0){logger[_0x7f7f('0x16')](_0x7f7f('0x20'),_0x1716f0);return _0x1ff21d[_0x7f7f('0x11')](0xc8)[_0x7f7f('0x12')]({'output':_0x7f7f('0x21')});})[_0x7f7f('0x22')](function(_0x46a5d7){logger['error'](_0x46a5d7);return _0x1ff21d['status'](0x1f4)[_0x7f7f('0x12')](_0x46a5d7);});};exports[_0x7f7f('0x23')]=function(_0x347935,_0x4a028e){var _0x702b2=fs[_0x7f7f('0x24')](path[_0x7f7f('0x25')](config['root'],'server','migrations'));var _0x2c78b2=[];for(var _0x45ca53=0x0;_0x45ca53<_0x702b2[_0x7f7f('0x26')];_0x45ca53++){var _0x24a1e2=_0x702b2[_0x45ca53][_0x7f7f('0x27')](_0x7f7f('0x28'),'');if(compareVersions(module[_0x7f7f('0x29')][_0x7f7f('0xc')],_0x24a1e2)===-0x1){_0x2c78b2[_0x7f7f('0x2a')](_0x24a1e2);}}if(_0x2c78b2[_0x7f7f('0x26')]){var _0xc29bc7=_0x2c78b2[_0x7f7f('0x2b')](compareVersions);var _0x3168c5=new Umzug({'storage':_0x7f7f('0x2c'),'storageOptions':{'model':db[_0x7f7f('0x2d')],'modelName':'Migration','columnName':_0x7f7f('0xc')},'migrations':{'params':[db['sequelize'][_0x7f7f('0x2e')](),db[_0x7f7f('0x2c')][_0x7f7f('0x2f')],function(){throw new Error(_0x7f7f('0x30'));}],'path':path[_0x7f7f('0x25')](config['root'],_0x7f7f('0x31'),'migrations'),'pattern':/\.js$/}});_0x3168c5['up']({'migrations':_[_0x7f7f('0x32')](_0xc29bc7,function(_0x5014d3){return _0x5014d3+_0x7f7f('0x28');})})['then'](function(){return _0x4a028e[_0x7f7f('0x11')](0xc8)['json']({'output':_0x7f7f('0x33')+module['exports']['version']+_0x7f7f('0x34')+_['last'](_0xc29bc7),'migrations':_['join'](_0xc29bc7)});})[_0x7f7f('0x22')](function(_0x1fe526){if(_0x1fe526 instanceof db[_0x7f7f('0x2c')]['UniqueConstraintError']){return _0x4a028e[_0x7f7f('0x11')](0xc8)[_0x7f7f('0x12')]({'output':_0x7f7f('0x35')});}else{return _0x4a028e[_0x7f7f('0x11')](0x1f4)[_0x7f7f('0x12')](_0x1fe526);}});}else{return _0x4a028e['status'](0xc8)['json']({'output':_0x7f7f('0x35')});}}; \ No newline at end of file +var _0x8a21=['../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','../../mysqldb'];(function(_0x3f1030,_0x443fbb){var _0x399974=function(_0x5843fe){while(--_0x5843fe){_0x3f1030['push'](_0x3f1030['shift']());}};_0x399974(++_0x443fbb);}(_0x8a21,0x1d8));var _0x18a2=function(_0x1faa61,_0x1bd7e2){_0x1faa61=_0x1faa61-0x0;var _0x3f0e58=_0x8a21[_0x1faa61];return _0x3f0e58;};'use strict';var Umzug=require(_0x18a2('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x18a2('0x1'))(module,_0x18a2('0x2'));var compareVersions=require(_0x18a2('0x3'));var exec=require('child_process')['exec'];var db=require(_0x18a2('0x4'))['db'];var config=require(_0x18a2('0x5'));var pm2=require(_0x18a2('0x6'));var logger=require(_0x18a2('0x7'))(_0x18a2('0x8'));var git=require(_0x18a2('0x9'))(config[_0x18a2('0xa')]);exports[_0x18a2('0xb')]=function(_0x5d030e,_0x40d23c){var _0x2ed80f={'current':module[_0x18a2('0xc')]['version'],'phonebar':0x2};if(_0x5d030e[_0x18a2('0xd')]&&_0x5d030e[_0x18a2('0xd')][_0x18a2('0xe')]){return git[_0x18a2('0xf')]()[_0x18a2('0x10')](function(_0x54ce08,_0x44c60c){_0x2ed80f[_0x18a2('0xe')]=(_0x54ce08?module['exports'][_0x18a2('0x2')]:_0x44c60c[_0x18a2('0xe')])||'2.0.0';return _0x40d23c[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')](_0x2ed80f);});}else{return _0x40d23c['status'](0xc8)[_0x18a2('0x12')](_0x2ed80f);}};exports[_0x18a2('0xf')]=function(_0xab519a,_0x2d03c0){return git['fetch'](['origin',_0x18a2('0x13')],function(_0x537943){if(_0x537943){logger[_0x18a2('0x14')](_0x537943);return _0x2d03c0['status'](0x1f4)[_0x18a2('0x12')](_0x537943);}logger[_0x18a2('0x15')](_0x18a2('0x16'));return _0x2d03c0['status'](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x17')});});};exports[_0x18a2('0x18')]=function(_0xa5894d,_0x22296a){return git['reset']([_0x18a2('0x19'),'FETCH_HEAD'],function(_0x922c0e){if(_0x922c0e){logger['error'](_0x922c0e);return _0x22296a[_0x18a2('0x11')](0x1f4)[_0x18a2('0x12')](_0x922c0e);}logger[_0x18a2('0x15')](_0x18a2('0x1a'));return _0x22296a[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x1b')});});};exports[_0x18a2('0x1c')]=function(_0x5f3252,_0x2ac173){exec(_0x18a2('0x1d'),function(_0x3a063a,_0x5c5164,_0x1ed01f){logger[_0x18a2('0x15')](_0x5c5164);logger[_0x18a2('0x15')](_0x1ed01f);if(_0x3a063a){logger[_0x18a2('0x14')](_0x3a063a);return _0x2ac173[_0x18a2('0x11')](0x1f4)['json'](_0x3a063a);}return _0x2ac173['status'](0xc8)['json']({'output':_0x5c5164});});};exports[_0x18a2('0x1e')]=function(_0x1c0da1,_0x55f10c){return pm2[_0x18a2('0x1e')](_0x18a2('0x1f'))['then'](function(_0x4e7003){logger[_0x18a2('0x15')](_0x18a2('0x20'),_0x4e7003);return _0x55f10c[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x21')});})[_0x18a2('0x22')](function(_0x3e9543){logger[_0x18a2('0x14')](_0x3e9543);return _0x55f10c[_0x18a2('0x11')](0x1f4)[_0x18a2('0x12')](_0x3e9543);});};exports['migrations']=function(_0x43a4f8,_0x2df574){var _0x490410=fs[_0x18a2('0x23')](path[_0x18a2('0x24')](config[_0x18a2('0xa')],_0x18a2('0x25'),_0x18a2('0x26')));var _0x56b765=[];for(var _0x2bad4c=0x0;_0x2bad4c<_0x490410[_0x18a2('0x27')];_0x2bad4c++){var _0x368fd4=_0x490410[_0x2bad4c][_0x18a2('0x28')](_0x18a2('0x29'),'');if(compareVersions(module['exports'][_0x18a2('0x2')],_0x368fd4)===-0x1){_0x56b765[_0x18a2('0x2a')](_0x368fd4);}}if(_0x56b765[_0x18a2('0x27')]){var _0x11a086=_0x56b765['sort'](compareVersions);var _0x31c583=new Umzug({'storage':_0x18a2('0x2b'),'storageOptions':{'model':db[_0x18a2('0x2c')],'modelName':_0x18a2('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x18a2('0x2b')][_0x18a2('0x2d')](),db[_0x18a2('0x2b')][_0x18a2('0x2e')],function(){throw new Error(_0x18a2('0x2f'));}],'path':path[_0x18a2('0x24')](config['root'],_0x18a2('0x25'),_0x18a2('0x26')),'pattern':/\.js$/}});_0x31c583['up']({'migrations':_[_0x18a2('0x30')](_0x11a086,function(_0x24cd88){return _0x24cd88+_0x18a2('0x29');})})['then'](function(){return _0x2df574[_0x18a2('0x11')](0xc8)['json']({'output':_0x18a2('0x31')+module[_0x18a2('0xc')][_0x18a2('0x2')]+_0x18a2('0x32')+_['last'](_0x11a086),'migrations':_[_0x18a2('0x24')](_0x11a086)});})[_0x18a2('0x22')](function(_0x52ef03){if(_0x52ef03 instanceof db[_0x18a2('0x2b')][_0x18a2('0x33')]){return _0x2df574[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x34')});}else{return _0x2df574['status'](0x1f4)[_0x18a2('0x12')](_0x52ef03);}});}else{return _0x2df574[_0x18a2('0x11')](0xc8)[_0x18a2('0x12')]({'output':_0x18a2('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 1ff0ada..11964ec 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 _0xecf0=['/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4b1b97,_0x50000f){var _0x1b5fc3=function(_0x4496fd){while(--_0x4496fd){_0x4b1b97['push'](_0x4b1b97['shift']());}};_0x1b5fc3(++_0x50000f);}(_0xecf0,0xbe));var _0x0ecf=function(_0x575b29,_0x11037f){_0x575b29=_0x575b29-0x0;var _0x216446=_0xecf0[_0x575b29];return _0x216446;};'use strict';var multer=require(_0x0ecf('0x0'));var util=require(_0x0ecf('0x1'));var path=require(_0x0ecf('0x2'));var timeout=require('connect-timeout');var express=require(_0x0ecf('0x3'));var router=express[_0x0ecf('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0ecf('0x5'));var config=require(_0x0ecf('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x0ecf('0x7')]('/',auth[_0x0ecf('0x8')](),controller[_0x0ecf('0x9')]);router[_0x0ecf('0x7')](_0x0ecf('0xa'),auth[_0x0ecf('0x8')](),controller[_0x0ecf('0xb')]);router[_0x0ecf('0x7')](_0x0ecf('0xc'),auth[_0x0ecf('0x8')](),controller[_0x0ecf('0xd')]);router[_0x0ecf('0xe')]('/',auth[_0x0ecf('0x8')](),controller[_0x0ecf('0xf')]);router[_0x0ecf('0x10')]('/:id',auth[_0x0ecf('0x8')](),controller['update']);router[_0x0ecf('0x11')](_0x0ecf('0xc'),auth['isAuthenticated'](),controller[_0x0ecf('0x12')]);module[_0x0ecf('0x13')]=router; \ No newline at end of file +var _0x2824=['post','create','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3390b7,_0x448cae){var _0x439c16=function(_0x1bc288){while(--_0x1bc288){_0x3390b7['push'](_0x3390b7['shift']());}};_0x439c16(++_0x448cae);}(_0x2824,0x1bb));var _0x4282=function(_0x5c789c,_0x1527f7){_0x5c789c=_0x5c789c-0x0;var _0x5356ec=_0x2824[_0x5c789c];return _0x5356ec;};'use strict';var multer=require(_0x4282('0x0'));var util=require(_0x4282('0x1'));var path=require(_0x4282('0x2'));var timeout=require('connect-timeout');var express=require(_0x4282('0x3'));var router=express['Router']();var auth=require(_0x4282('0x4'));var interaction=require(_0x4282('0x5'));var config=require('../../config/environment');var controller=require(_0x4282('0x6'));router[_0x4282('0x7')]('/',auth[_0x4282('0x8')](),controller[_0x4282('0x9')]);router[_0x4282('0x7')](_0x4282('0xa'),auth[_0x4282('0x8')](),controller[_0x4282('0xb')]);router[_0x4282('0x7')](_0x4282('0xc'),auth[_0x4282('0x8')](),controller['show']);router[_0x4282('0xd')]('/',auth[_0x4282('0x8')](),controller[_0x4282('0xe')]);router['put'](_0x4282('0xc'),auth[_0x4282('0x8')](),controller[_0x4282('0xf')]);router[_0x4282('0x10')](_0x4282('0xc'),auth[_0x4282('0x8')](),controller[_0x4282('0x11')]);module[_0x4282('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 89267ef..5ef3b5a 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 _0x2675=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x5581c1,_0x2e1bb7){var _0x5328e4=function(_0xae6f3b){while(--_0xae6f3b){_0x5581c1['push'](_0x5581c1['shift']());}};_0x5328e4(++_0x2e1bb7);}(_0x2675,0x75));var _0x5267=function(_0x2b7aec,_0x272c1b){_0x2b7aec=_0x2b7aec-0x0;var _0x5cdf4d=_0x2675[_0x2b7aec];return _0x5cdf4d;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5267('0x1')]},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x5267('0x1')]},'membername':{'type':Sequelize[_0x5267('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x5267('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x5267('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x5267('0x2')]},'agentdumpAt':{'type':Sequelize[_0x5267('0x2')]},'holdtime':{'type':Sequelize[_0x5267('0x3')]},'agentcomplete':{'type':Sequelize[_0x5267('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x5267('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x5267('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5267('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x5267('0x1')]},'channel':{'type':Sequelize[_0x5267('0x1')]},'channelstate':{'type':Sequelize[_0x5267('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5267('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5267('0x1')]},'exten':{'type':Sequelize[_0x5267('0x1')]},'priority':{'type':Sequelize[_0x5267('0x1')]},'destchannel':{'type':Sequelize[_0x5267('0x1')]},'destchannelstate':{'type':Sequelize[_0x5267('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5267('0x1')]},'destcalleridnum':{'type':Sequelize[_0x5267('0x1')]},'destcalleridname':{'type':Sequelize[_0x5267('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x5267('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x5267('0x1')]},'destlanguage':{'type':Sequelize[_0x5267('0x1')]},'destaccountcode':{'type':Sequelize[_0x5267('0x1')]},'destcontext':{'type':Sequelize[_0x5267('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x5267('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x5267('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x5267('0x1')]},'transfer':{'type':Sequelize[_0x5267('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5267('0x1')],'comment':_0x5267('0x5')},'transferexten':{'type':Sequelize[_0x5267('0x1')]},'transferuniqueid':{'type':Sequelize[_0x5267('0x1')]},'agententerreason':{'type':Sequelize[_0x5267('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x517057,_0x368bbc){var _0x181a63=function(_0xb98ea3){while(--_0xb98ea3){_0x517057['push'](_0x517057['shift']());}};_0x181a63(++_0x368bbc);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x485abd,_0x32c7c1){_0x485abd=_0x485abd-0x0;var _0x3379f1=_0xfdbd[_0x485abd];return _0x3379f1;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'type':{'type':Sequelize[_0xdfdb('0x2')]},'uniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'calleridnum':{'type':Sequelize[_0xdfdb('0x2')]},'calleridname':{'type':Sequelize[_0xdfdb('0x2')]},'queue':{'type':Sequelize[_0xdfdb('0x2')]},'interface':{'type':Sequelize[_0xdfdb('0x2')]},'membername':{'type':Sequelize[_0xdfdb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xdfdb('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xdfdb('0x3')]},'agentdumpAt':{'type':Sequelize[_0xdfdb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xdfdb('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xdfdb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xdfdb('0x5')]},'reason':{'type':Sequelize[_0xdfdb('0x2')]},'lastevent':{'type':Sequelize[_0xdfdb('0x2')]},'channel':{'type':Sequelize[_0xdfdb('0x2')]},'channelstate':{'type':Sequelize[_0xdfdb('0x5')]},'channelstatedesc':{'type':Sequelize[_0xdfdb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdfdb('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdfdb('0x2')]},'accountcode':{'type':Sequelize[_0xdfdb('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xdfdb('0x2')]},'priority':{'type':Sequelize[_0xdfdb('0x2')]},'destchannel':{'type':Sequelize[_0xdfdb('0x2')]},'destchannelstate':{'type':Sequelize[_0xdfdb('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xdfdb('0x2')]},'destcalleridnum':{'type':Sequelize[_0xdfdb('0x2')]},'destcalleridname':{'type':Sequelize[_0xdfdb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdfdb('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xdfdb('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xdfdb('0x2')]},'destpriority':{'type':Sequelize[_0xdfdb('0x2')]},'destuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xdfdb('0x2')]},'transfer':{'type':Sequelize[_0xdfdb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xdfdb('0x2')]},'transferuniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'agententerreason':{'type':Sequelize[_0xdfdb('0x5')],'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 89bc9c6..ef8d8d6 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 _0xea7e=['update','destroy','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','VoiceAgentReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body'];(function(_0x4a31ef,_0x180497){var _0x99a2e1=function(_0x48bad2){while(--_0x48bad2){_0x4a31ef['push'](_0x4a31ef['shift']());}};_0x99a2e1(++_0x180497);}(_0xea7e,0x1b3));var _0xeea7=function(_0x531105,_0x3e6e37){_0x531105=_0x531105-0x0;var _0x29a3d2=_0xea7e[_0x531105];return _0x29a3d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeea7('0x0'));var rimraf=require(_0xeea7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeea7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeea7('0x3'));var Mustache=require(_0xeea7('0x4'));var util=require(_0xeea7('0x5'));var path=require(_0xeea7('0x6'));var sox=require('sox');var csv=require(_0xeea7('0x7'));var ejs=require(_0xeea7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeea7('0x9'));var crypto=require(_0xeea7('0xa'));var jsforce=require(_0xeea7('0xb'));var deskjs=require(_0xeea7('0xc'));var toCsv=require(_0xeea7('0x7'));var querystring=require(_0xeea7('0xd'));var Papa=require(_0xeea7('0xe'));var Redis=require(_0xeea7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xeea7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeea7('0x11'));var logger=require(_0xeea7('0x12'))('api');var utils=require(_0xeea7('0x13'));var config=require(_0xeea7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x392403,_0x161ab0){_0x161ab0=_0x161ab0||0xcc;return function(_0x5e7c0e){if(_0x5e7c0e){return _0x392403[_0xeea7('0x15')](_0x161ab0);}return _0x392403['status'](_0x161ab0)[_0xeea7('0x16')]();};}function respondWithResult(_0x164439,_0x572da5){_0x572da5=_0x572da5||0xc8;return function(_0x39dbe6){if(_0x39dbe6){return _0x164439[_0xeea7('0x17')](_0x572da5)[_0xeea7('0x18')](_0x39dbe6);}};}function respondWithFilteredResult(_0x496202,_0x331b02){return function(_0x4fc7b0){if(_0x4fc7b0){var _0x5243b2=_0x4fc7b0[_0xeea7('0x19')],_0x518947=_0x331b02['offset'],_0x2ed1ad=_0x331b02[_0xeea7('0x1a')]+_0x331b02[_0xeea7('0x1b')],_0x36c6e1;if(_0x2ed1ad>=_0x5243b2){_0x2ed1ad=_0x5243b2;_0x36c6e1=0xc8;}else{_0x36c6e1=0xce;}_0x496202['status'](_0x36c6e1);return _0x496202[_0xeea7('0x1c')](_0xeea7('0x1d'),_0x518947+'-'+_0x2ed1ad+'/'+_0x5243b2)['json'](_0x4fc7b0);}return null;};}function patchUpdates(_0x644677){return function(_0x5b5910){try{jsonpatch[_0xeea7('0x1e')](_0x5b5910,_0x644677,!![]);}catch(_0x5c05d0){return BPromise[_0xeea7('0x1f')](_0x5c05d0);}return _0x5b5910[_0xeea7('0x20')]();};}function saveUpdates(_0xa32595,_0x57ec5d){return function(_0x3fbfd3){if(_0x3fbfd3){return _0x3fbfd3['update'](_0xa32595)[_0xeea7('0x21')](function(_0x4650c1){return _0x4650c1;});}return null;};}function removeEntity(_0x28cef7,_0x24bce6){return function(_0x110d5c){if(_0x110d5c){return _0x110d5c['destroy']()[_0xeea7('0x21')](function(){_0x28cef7[_0xeea7('0x17')](0xcc)[_0xeea7('0x16')]();});}};}function handleEntityNotFound(_0xe09af4,_0x38cc0a){return function(_0x508b72){if(!_0x508b72){_0xe09af4['sendStatus'](0x194);}return _0x508b72;};}function handleError(_0x392a1a,_0x20a3ef){_0x20a3ef=_0x20a3ef||0x1f4;return function(_0x2c2b2a){logger['error'](_0x2c2b2a[_0xeea7('0x22')]);if(_0x2c2b2a[_0xeea7('0x23')]){delete _0x2c2b2a['name'];}_0x392a1a[_0xeea7('0x17')](_0x20a3ef)[_0xeea7('0x24')](_0x2c2b2a);};}exports[_0xeea7('0x25')]=function(_0x11120c,_0x3f205f){var _0x18d046={},_0x1ccea2={},_0x5b9614={'count':0x0,'rows':[]};var _0x560299=_[_0xeea7('0x26')](db[_0xeea7('0x27')]['rawAttributes'],function(_0x1e31ad){return{'name':_0x1e31ad[_0xeea7('0x28')],'type':_0x1e31ad[_0xeea7('0x29')][_0xeea7('0x2a')]};});_0x1ccea2['model']=_[_0xeea7('0x26')](_0x560299,'name');_0x1ccea2['query']=_[_0xeea7('0x2b')](_0x11120c[_0xeea7('0x2c')]);_0x1ccea2[_0xeea7('0x2d')]=_[_0xeea7('0x2e')](_0x1ccea2[_0xeea7('0x2f')],_0x1ccea2[_0xeea7('0x2c')]);_0x18d046[_0xeea7('0x30')]=_['intersection'](_0x1ccea2[_0xeea7('0x2f')],qs[_0xeea7('0x31')](_0x11120c[_0xeea7('0x2c')][_0xeea7('0x31')]));_0x18d046[_0xeea7('0x30')]=_0x18d046[_0xeea7('0x30')][_0xeea7('0x32')]?_0x18d046[_0xeea7('0x30')]:_0x1ccea2[_0xeea7('0x2f')];if(!_0x11120c[_0xeea7('0x2c')][_0xeea7('0x33')]('nolimit')){_0x18d046[_0xeea7('0x1b')]=qs['limit'](_0x11120c[_0xeea7('0x2c')]['limit']);_0x18d046[_0xeea7('0x1a')]=qs[_0xeea7('0x1a')](_0x11120c[_0xeea7('0x2c')][_0xeea7('0x1a')]);}_0x18d046[_0xeea7('0x34')]=qs[_0xeea7('0x35')](_0x11120c[_0xeea7('0x2c')][_0xeea7('0x35')]);_0x18d046['where']=qs[_0xeea7('0x2d')](_[_0xeea7('0x36')](_0x11120c[_0xeea7('0x2c')],_0x1ccea2[_0xeea7('0x2d')]),_0x560299);if(_0x11120c[_0xeea7('0x2c')][_0xeea7('0x37')]){_0x18d046[_0xeea7('0x38')]=_[_0xeea7('0x39')](_0x18d046[_0xeea7('0x38')],{'$or':_['map'](_0x560299,function(_0x3c30b4){if(_0x3c30b4[_0xeea7('0x29')]!==_0xeea7('0x3a')){var _0x358155={};_0x358155[_0x3c30b4['name']]={'$like':'%'+_0x11120c[_0xeea7('0x2c')][_0xeea7('0x37')]+'%'};return _0x358155;}})});}_0x18d046=_['merge']({},_0x18d046,_0x11120c[_0xeea7('0x3b')]);var _0x1b0d64={'where':_0x18d046['where']};return db[_0xeea7('0x27')][_0xeea7('0x19')](_0x1b0d64)[_0xeea7('0x21')](function(_0x37b015){_0x5b9614['count']=_0x37b015;if(_0x11120c[_0xeea7('0x2c')][_0xeea7('0x3c')]){_0x18d046[_0xeea7('0x3d')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0xeea7('0x3e')](_0x18d046);})[_0xeea7('0x21')](function(_0x53cce1){_0x5b9614[_0xeea7('0x3f')]=_0x53cce1;return _0x5b9614;})[_0xeea7('0x21')](respondWithFilteredResult(_0x3f205f,_0x18d046))['catch'](handleError(_0x3f205f,null));};exports[_0xeea7('0x40')]=function(_0x311843,_0x5e172a){var _0x41d41c={'raw':![],'where':{'id':_0x311843['params']['id']}},_0x26e944={};_0x26e944[_0xeea7('0x2f')]=_[_0xeea7('0x2b')](db[_0xeea7('0x27')]['rawAttributes']);_0x26e944[_0xeea7('0x2c')]=_[_0xeea7('0x2b')](_0x311843[_0xeea7('0x2c')]);_0x26e944[_0xeea7('0x2d')]=_[_0xeea7('0x2e')](_0x26e944[_0xeea7('0x2f')],_0x26e944[_0xeea7('0x2c')]);_0x41d41c[_0xeea7('0x30')]=_[_0xeea7('0x2e')](_0x26e944[_0xeea7('0x2f')],qs['fields'](_0x311843['query']['fields']));_0x41d41c[_0xeea7('0x30')]=_0x41d41c[_0xeea7('0x30')]['length']?_0x41d41c['attributes']:_0x26e944['model'];if(_0x311843[_0xeea7('0x2c')][_0xeea7('0x3c')]){_0x41d41c[_0xeea7('0x3d')]=[{'all':!![]}];}_0x41d41c=_[_0xeea7('0x39')]({},_0x41d41c,_0x311843[_0xeea7('0x3b')]);return db[_0xeea7('0x27')][_0xeea7('0x41')](_0x41d41c)[_0xeea7('0x21')](handleEntityNotFound(_0x5e172a,null))['then'](respondWithResult(_0x5e172a,null))[_0xeea7('0x42')](handleError(_0x5e172a,null));};exports[_0xeea7('0x43')]=function(_0x31129d,_0x2bf102){return db[_0xeea7('0x27')][_0xeea7('0x43')](_0x31129d[_0xeea7('0x44')],{})[_0xeea7('0x21')](respondWithResult(_0x2bf102,0xc9))['catch'](handleError(_0x2bf102,null));};exports[_0xeea7('0x45')]=function(_0x21ef26,_0xc4ee3e){if(_0x21ef26['body']['id']){delete _0x21ef26['body']['id'];}return db[_0xeea7('0x27')]['find']({'where':{'id':_0x21ef26['params']['id']}})[_0xeea7('0x21')](handleEntityNotFound(_0xc4ee3e,null))[_0xeea7('0x21')](saveUpdates(_0x21ef26[_0xeea7('0x44')],null))[_0xeea7('0x21')](respondWithResult(_0xc4ee3e,null))[_0xeea7('0x42')](handleError(_0xc4ee3e,null));};exports[_0xeea7('0x46')]=function(_0x10fe40,_0xe988ec){return db[_0xeea7('0x27')][_0xeea7('0x41')]({'where':{'id':_0x10fe40['params']['id']}})['then'](handleEntityNotFound(_0xe988ec,null))[_0xeea7('0x21')](removeEntity(_0xe988ec,null))[_0xeea7('0x42')](handleError(_0xe988ec,null));};exports[_0xeea7('0x47')]=function(_0x43a26b,_0xa5b4d3){return db['VoiceAgentReport'][_0xeea7('0x47')]()[_0xeea7('0x21')](respondWithResult(_0xa5b4d3,null))['catch'](handleError(_0xa5b4d3,null));}; \ No newline at end of file +var _0xba45=['show','params','includeAll','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','then','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','rows'];(function(_0x53467c,_0x65b511){var _0x2ddc55=function(_0x51a69a){while(--_0x51a69a){_0x53467c['push'](_0x53467c['shift']());}};_0x2ddc55(++_0x65b511);}(_0xba45,0x129));var _0x5ba4=function(_0x5a0681,_0x5cbc10){_0x5a0681=_0x5a0681-0x0;var _0x2d3a74=_0xba45[_0x5a0681];return _0x2d3a74;};'use strict';var pdf=require(_0x5ba4('0x0'));var emlformat=require(_0x5ba4('0x1'));var rimraf=require(_0x5ba4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ba4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ba4('0x4'));var Mustache=require(_0x5ba4('0x5'));var util=require(_0x5ba4('0x6'));var path=require(_0x5ba4('0x7'));var sox=require(_0x5ba4('0x8'));var csv=require(_0x5ba4('0x9'));var ejs=require(_0x5ba4('0xa'));var fs=require('fs');var _=require(_0x5ba4('0xb'));var squel=require(_0x5ba4('0xc'));var crypto=require(_0x5ba4('0xd'));var jsforce=require(_0x5ba4('0xe'));var deskjs=require(_0x5ba4('0xf'));var toCsv=require(_0x5ba4('0x9'));var querystring=require(_0x5ba4('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ba4('0x11'));var qs=require(_0x5ba4('0x12'));var as=require(_0x5ba4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ba4('0x14'))(_0x5ba4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5ba4('0x16'))['db'];function respondWithStatusCode(_0x17e96a,_0x3d42f9){_0x3d42f9=_0x3d42f9||0xcc;return function(_0x1590a9){if(_0x1590a9){return _0x17e96a[_0x5ba4('0x17')](_0x3d42f9);}return _0x17e96a[_0x5ba4('0x18')](_0x3d42f9)[_0x5ba4('0x19')]();};}function respondWithResult(_0x33afda,_0x396759){_0x396759=_0x396759||0xc8;return function(_0x1e0b11){if(_0x1e0b11){return _0x33afda[_0x5ba4('0x18')](_0x396759)[_0x5ba4('0x1a')](_0x1e0b11);}};}function respondWithFilteredResult(_0x262d59,_0x99c417){return function(_0x5e2c40){if(_0x5e2c40){var _0x2d9d76=_0x5e2c40[_0x5ba4('0x1b')],_0x3fc17d=_0x99c417['offset'],_0x9e4ccd=_0x99c417[_0x5ba4('0x1c')]+_0x99c417['limit'],_0x4e0b44;if(_0x9e4ccd>=_0x2d9d76){_0x9e4ccd=_0x2d9d76;_0x4e0b44=0xc8;}else{_0x4e0b44=0xce;}_0x262d59[_0x5ba4('0x18')](_0x4e0b44);return _0x262d59[_0x5ba4('0x1d')](_0x5ba4('0x1e'),_0x3fc17d+'-'+_0x9e4ccd+'/'+_0x2d9d76)[_0x5ba4('0x1a')](_0x5e2c40);}return null;};}function patchUpdates(_0x39b260){return function(_0x120e99){try{jsonpatch['apply'](_0x120e99,_0x39b260,!![]);}catch(_0x5e416f){return BPromise['reject'](_0x5e416f);}return _0x120e99[_0x5ba4('0x1f')]();};}function saveUpdates(_0x3e42dd,_0x55c925){return function(_0x3be920){if(_0x3be920){return _0x3be920[_0x5ba4('0x20')](_0x3e42dd)['then'](function(_0x1d5198){return _0x1d5198;});}return null;};}function removeEntity(_0xecdd42,_0x34f6a5){return function(_0x35c0f5){if(_0x35c0f5){return _0x35c0f5['destroy']()[_0x5ba4('0x21')](function(){_0xecdd42[_0x5ba4('0x18')](0xcc)[_0x5ba4('0x19')]();});}};}function handleEntityNotFound(_0x33fb56,_0x1b9529){return function(_0x1b4733){if(!_0x1b4733){_0x33fb56[_0x5ba4('0x17')](0x194);}return _0x1b4733;};}function handleError(_0x4e30b8,_0x2d5ff9){_0x2d5ff9=_0x2d5ff9||0x1f4;return function(_0x4f71e4){logger[_0x5ba4('0x22')](_0x4f71e4[_0x5ba4('0x23')]);if(_0x4f71e4[_0x5ba4('0x24')]){delete _0x4f71e4[_0x5ba4('0x24')];}_0x4e30b8[_0x5ba4('0x18')](_0x2d5ff9)[_0x5ba4('0x25')](_0x4f71e4);};}exports[_0x5ba4('0x26')]=function(_0x433d7f,_0x46170a){var _0x39f792={},_0x3e74c3={},_0x2c80cf={'count':0x0,'rows':[]};var _0x1f5715=_[_0x5ba4('0x27')](db[_0x5ba4('0x28')][_0x5ba4('0x29')],function(_0x57e93a){return{'name':_0x57e93a['fieldName'],'type':_0x57e93a['type'][_0x5ba4('0x2a')]};});_0x3e74c3[_0x5ba4('0x2b')]=_[_0x5ba4('0x27')](_0x1f5715,'name');_0x3e74c3['query']=_[_0x5ba4('0x2c')](_0x433d7f[_0x5ba4('0x2d')]);_0x3e74c3[_0x5ba4('0x2e')]=_['intersection'](_0x3e74c3['model'],_0x3e74c3[_0x5ba4('0x2d')]);_0x39f792[_0x5ba4('0x2f')]=_[_0x5ba4('0x30')](_0x3e74c3[_0x5ba4('0x2b')],qs[_0x5ba4('0x31')](_0x433d7f[_0x5ba4('0x2d')][_0x5ba4('0x31')]));_0x39f792['attributes']=_0x39f792[_0x5ba4('0x2f')][_0x5ba4('0x32')]?_0x39f792[_0x5ba4('0x2f')]:_0x3e74c3['model'];if(!_0x433d7f[_0x5ba4('0x2d')]['hasOwnProperty'](_0x5ba4('0x33'))){_0x39f792[_0x5ba4('0x34')]=qs[_0x5ba4('0x34')](_0x433d7f[_0x5ba4('0x2d')][_0x5ba4('0x34')]);_0x39f792[_0x5ba4('0x1c')]=qs[_0x5ba4('0x1c')](_0x433d7f[_0x5ba4('0x2d')][_0x5ba4('0x1c')]);}_0x39f792[_0x5ba4('0x35')]=qs[_0x5ba4('0x36')](_0x433d7f[_0x5ba4('0x2d')][_0x5ba4('0x36')]);_0x39f792['where']=qs[_0x5ba4('0x2e')](_[_0x5ba4('0x37')](_0x433d7f[_0x5ba4('0x2d')],_0x3e74c3['filters']),_0x1f5715);if(_0x433d7f[_0x5ba4('0x2d')][_0x5ba4('0x38')]){_0x39f792[_0x5ba4('0x39')]=_[_0x5ba4('0x3a')](_0x39f792[_0x5ba4('0x39')],{'$or':_[_0x5ba4('0x27')](_0x1f5715,function(_0x5340a2){if(_0x5340a2[_0x5ba4('0x3b')]!==_0x5ba4('0x3c')){var _0x29e078={};_0x29e078[_0x5340a2[_0x5ba4('0x24')]]={'$like':'%'+_0x433d7f[_0x5ba4('0x2d')][_0x5ba4('0x38')]+'%'};return _0x29e078;}})});}_0x39f792=_[_0x5ba4('0x3a')]({},_0x39f792,_0x433d7f[_0x5ba4('0x3d')]);var _0x5e76b2={'where':_0x39f792[_0x5ba4('0x39')]};return db['VoiceAgentReport'][_0x5ba4('0x1b')](_0x5e76b2)[_0x5ba4('0x21')](function(_0x27f751){_0x2c80cf[_0x5ba4('0x1b')]=_0x27f751;if(_0x433d7f[_0x5ba4('0x2d')]['includeAll']){_0x39f792['include']=[{'all':!![]}];}return db[_0x5ba4('0x28')]['findAll'](_0x39f792);})['then'](function(_0x14ca1f){_0x2c80cf[_0x5ba4('0x3e')]=_0x14ca1f;return _0x2c80cf;})[_0x5ba4('0x21')](respondWithFilteredResult(_0x46170a,_0x39f792))['catch'](handleError(_0x46170a,null));};exports[_0x5ba4('0x3f')]=function(_0x3705d6,_0x28bec4){var _0x46996b={'raw':![],'where':{'id':_0x3705d6[_0x5ba4('0x40')]['id']}},_0x562043={};_0x562043[_0x5ba4('0x2b')]=_['keys'](db['VoiceAgentReport'][_0x5ba4('0x29')]);_0x562043['query']=_[_0x5ba4('0x2c')](_0x3705d6[_0x5ba4('0x2d')]);_0x562043[_0x5ba4('0x2e')]=_[_0x5ba4('0x30')](_0x562043[_0x5ba4('0x2b')],_0x562043[_0x5ba4('0x2d')]);_0x46996b['attributes']=_[_0x5ba4('0x30')](_0x562043[_0x5ba4('0x2b')],qs['fields'](_0x3705d6['query']['fields']));_0x46996b[_0x5ba4('0x2f')]=_0x46996b['attributes'][_0x5ba4('0x32')]?_0x46996b[_0x5ba4('0x2f')]:_0x562043[_0x5ba4('0x2b')];if(_0x3705d6[_0x5ba4('0x2d')][_0x5ba4('0x41')]){_0x46996b['include']=[{'all':!![]}];}_0x46996b=_[_0x5ba4('0x3a')]({},_0x46996b,_0x3705d6[_0x5ba4('0x3d')]);return db[_0x5ba4('0x28')][_0x5ba4('0x42')](_0x46996b)[_0x5ba4('0x21')](handleEntityNotFound(_0x28bec4,null))[_0x5ba4('0x21')](respondWithResult(_0x28bec4,null))[_0x5ba4('0x43')](handleError(_0x28bec4,null));};exports[_0x5ba4('0x44')]=function(_0x3e9068,_0x3065c4){return db[_0x5ba4('0x28')][_0x5ba4('0x44')](_0x3e9068[_0x5ba4('0x45')],{})['then'](respondWithResult(_0x3065c4,0xc9))['catch'](handleError(_0x3065c4,null));};exports[_0x5ba4('0x20')]=function(_0x54732b,_0x67d17f){if(_0x54732b[_0x5ba4('0x45')]['id']){delete _0x54732b[_0x5ba4('0x45')]['id'];}return db['VoiceAgentReport'][_0x5ba4('0x42')]({'where':{'id':_0x54732b[_0x5ba4('0x40')]['id']}})['then'](handleEntityNotFound(_0x67d17f,null))[_0x5ba4('0x21')](saveUpdates(_0x54732b[_0x5ba4('0x45')],null))[_0x5ba4('0x21')](respondWithResult(_0x67d17f,null))[_0x5ba4('0x43')](handleError(_0x67d17f,null));};exports[_0x5ba4('0x46')]=function(_0x12e466,_0x26950d){return db[_0x5ba4('0x28')][_0x5ba4('0x42')]({'where':{'id':_0x12e466[_0x5ba4('0x40')]['id']}})[_0x5ba4('0x21')](handleEntityNotFound(_0x26950d,null))[_0x5ba4('0x21')](removeEntity(_0x26950d,null))['catch'](handleError(_0x26950d,null));};exports['describe']=function(_0x5a1f14,_0x1f82b1){return db[_0x5ba4('0x28')][_0x5ba4('0x47')]()['then'](respondWithResult(_0x1f82b1,null))['catch'](handleError(_0x1f82b1,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 7c4ac2f..992efdc 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 _0x63bc=['path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x34f4cc,_0x17c81e){var _0x491893=function(_0x18009d){while(--_0x18009d){_0x34f4cc['push'](_0x34f4cc['shift']());}};_0x491893(++_0x17c81e);}(_0x63bc,0xad));var _0xc63b=function(_0x42eed8,_0x4fa5e7){_0x42eed8=_0x42eed8-0x0;var _0x4071d4=_0x63bc[_0x42eed8];return _0x4071d4;};'use strict';var _=require(_0xc63b('0x0'));var util=require(_0xc63b('0x1'));var logger=require(_0xc63b('0x2'))(_0xc63b('0x3'));var moment=require(_0xc63b('0x4'));var BPromise=require(_0xc63b('0x5'));var rp=require(_0xc63b('0x6'));var fs=require('fs');var path=require(_0xc63b('0x7'));var rimraf=require(_0xc63b('0x8'));var config=require('../../config/environment');var attributes=require(_0xc63b('0x9'));module[_0xc63b('0xa')]=function(_0xe79089,_0x361b34){return _0xe79089[_0xc63b('0xb')](_0xc63b('0xc'),attributes,{'tableName':_0xc63b('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc63b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2fc=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','define','VoiceAgentReport','uniqueid','destuniqueid'];(function(_0x3be467,_0x377ce4){var _0x4c3f2b=function(_0x338b78){while(--_0x338b78){_0x3be467['push'](_0x3be467['shift']());}};_0x4c3f2b(++_0x377ce4);}(_0xf2fc,0x15c));var _0xcf2f=function(_0xc5df6b,_0x3725ca){_0xc5df6b=_0xc5df6b-0x0;var _0x2bb1be=_0xf2fc[_0xc5df6b];return _0x2bb1be;};'use strict';var _=require(_0xcf2f('0x0'));var util=require(_0xcf2f('0x1'));var logger=require(_0xcf2f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcf2f('0x3'));var rp=require(_0xcf2f('0x4'));var fs=require('fs');var path=require(_0xcf2f('0x5'));var rimraf=require(_0xcf2f('0x6'));var config=require('../../config/environment');var attributes=require(_0xcf2f('0x7'));module['exports']=function(_0x5f447e,_0x4b0d4d){return _0x5f447e[_0xcf2f('0x8')](_0xcf2f('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xcf2f('0xa'),_0xcf2f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index abc12c0..ba27a86 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 _0x00b8=['VoiceAgentReport','create','body','raw','UpdateVoiceAgentReport','update','options','where','attributes','limit','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','CreateVoiceAgentReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00b8,0x67));var _0x800b=function(_0x511713,_0x14c13a){_0x511713=_0x511713-0x0;var _0x8e0795=_0x00b8[_0x511713];return _0x8e0795;};'use strict';var _=require(_0x800b('0x0'));var util=require(_0x800b('0x1'));var moment=require('moment');var BPromise=require(_0x800b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x800b('0x3'));var logger=require(_0x800b('0x4'))(_0x800b('0x5'));var config=require('../../config/environment');var jayson=require(_0x800b('0x6'));var client=jayson[_0x800b('0x7')][_0x800b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1dd0d7,_0x1784a7,_0x4c9390){return new BPromise(function(_0x31957c,_0x44fd79){return client[_0x800b('0x9')](_0x1dd0d7,_0x4c9390)[_0x800b('0xa')](function(_0x479489){logger['info'](_0x800b('0xb'),_0x1784a7,'request\x20sent');logger[_0x800b('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1784a7,_0x800b('0xd'),JSON[_0x800b('0xe')](_0x479489));if(_0x479489[_0x800b('0xf')]){if(_0x479489[_0x800b('0xf')][_0x800b('0x10')]===0x1f4){logger[_0x800b('0xf')](_0x800b('0xb'),_0x1784a7,_0x479489[_0x800b('0xf')][_0x800b('0x11')]);return _0x44fd79(_0x479489[_0x800b('0xf')][_0x800b('0x11')]);}logger[_0x800b('0xf')](_0x800b('0xb'),_0x1784a7,_0x479489['error'][_0x800b('0x11')]);return _0x31957c(_0x479489[_0x800b('0xf')][_0x800b('0x11')]);}else{logger[_0x800b('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x1784a7,_0x800b('0xd'));_0x31957c(_0x479489['result'][_0x800b('0x11')]);}})[_0x800b('0x13')](function(_0x43b822){logger[_0x800b('0xf')](_0x800b('0xb'),_0x1784a7,_0x43b822);_0x44fd79(_0x43b822);});});}exports[_0x800b('0x14')]=function(_0x559c39){var _0x5ad28c=this;return new Promise(function(_0x32b6c1,_0x24cc06){return db[_0x800b('0x15')][_0x800b('0x16')](_0x559c39[_0x800b('0x17')],{'raw':_0x559c39['options']?_0x559c39['options'][_0x800b('0x18')]===undefined?!![]:![]:!![]})[_0x800b('0xa')](function(_0x1678f6){logger[_0x800b('0x12')](_0x800b('0x14'),_0x559c39);logger[_0x800b('0xc')](_0x800b('0x14'),_0x559c39,JSON[_0x800b('0xe')](_0x1678f6));_0x32b6c1(_0x1678f6);})[_0x800b('0x13')](function(_0x4f5a0f){logger[_0x800b('0xf')]('CreateVoiceAgentReport',_0x4f5a0f[_0x800b('0x11')],_0x559c39);_0x24cc06(_0x5ad28c['error'](0x1f4,_0x4f5a0f[_0x800b('0x11')]));});});};exports[_0x800b('0x19')]=function(_0x4bbf8d){var _0x3f313d=this;return new Promise(function(_0x223aa4,_0x45e2b9){return db[_0x800b('0x15')][_0x800b('0x1a')](_0x4bbf8d[_0x800b('0x17')],{'raw':_0x4bbf8d[_0x800b('0x1b')]?_0x4bbf8d['options'][_0x800b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbf8d[_0x800b('0x1b')]?_0x4bbf8d[_0x800b('0x1b')][_0x800b('0x1c')]||null:null,'attributes':_0x4bbf8d[_0x800b('0x1b')]?_0x4bbf8d[_0x800b('0x1b')][_0x800b('0x1d')]||null:null,'limit':_0x4bbf8d[_0x800b('0x1b')]?_0x4bbf8d[_0x800b('0x1b')][_0x800b('0x1e')]||null:null})['then'](function(_0x194fc5){logger[_0x800b('0x12')](_0x800b('0x19'),_0x4bbf8d);logger['debug'](_0x800b('0x19'),_0x4bbf8d,JSON['stringify'](_0x194fc5));_0x223aa4(_0x194fc5);})[_0x800b('0x13')](function(_0x396286){logger[_0x800b('0xf')](_0x800b('0x19'),_0x396286['message'],_0x4bbf8d);_0x45e2b9(_0x3f313d[_0x800b('0xf')](0x1f4,_0x396286[_0x800b('0x11')]));});});}; \ No newline at end of file +var _0x7a02=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','stringify','UpdateVoiceAgentReport','update','raw','where','lodash','moment','bluebird','randomstring'];(function(_0x551a5c,_0x5f95c3){var _0x3a7783=function(_0xe6b15e){while(--_0xe6b15e){_0x551a5c['push'](_0x551a5c['shift']());}};_0x3a7783(++_0x5f95c3);}(_0x7a02,0xbc));var _0x27a0=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x7a02[_0x119d5a];return _0x15bff4;};'use strict';var _=require(_0x27a0('0x0'));var util=require('util');var moment=require(_0x27a0('0x1'));var BPromise=require(_0x27a0('0x2'));var rs=require(_0x27a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27a0('0x4'))['db'];var utils=require(_0x27a0('0x5'));var logger=require(_0x27a0('0x6'))('rpc');var config=require(_0x27a0('0x7'));var jayson=require(_0x27a0('0x8'));var client=jayson[_0x27a0('0x9')][_0x27a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52269e,_0x4ed510,_0x307b59){return new BPromise(function(_0x4570c7,_0x2401d2){return client[_0x27a0('0xb')](_0x52269e,_0x307b59)[_0x27a0('0xc')](function(_0x2afcd5){logger[_0x27a0('0xd')](_0x27a0('0xe'),_0x4ed510,_0x27a0('0xf'));logger[_0x27a0('0x10')](_0x27a0('0x11'),_0x4ed510,_0x27a0('0xf'),JSON['stringify'](_0x2afcd5));if(_0x2afcd5['error']){if(_0x2afcd5[_0x27a0('0x12')][_0x27a0('0x13')]===0x1f4){logger[_0x27a0('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x4ed510,_0x2afcd5['error'][_0x27a0('0x14')]);return _0x2401d2(_0x2afcd5[_0x27a0('0x12')][_0x27a0('0x14')]);}logger[_0x27a0('0x12')](_0x27a0('0xe'),_0x4ed510,_0x2afcd5[_0x27a0('0x12')]['message']);return _0x4570c7(_0x2afcd5[_0x27a0('0x12')]['message']);}else{logger['info'](_0x27a0('0xe'),_0x4ed510,_0x27a0('0xf'));_0x4570c7(_0x2afcd5[_0x27a0('0x15')][_0x27a0('0x14')]);}})[_0x27a0('0x16')](function(_0x4831f9){logger[_0x27a0('0x12')](_0x27a0('0xe'),_0x4ed510,_0x4831f9);_0x2401d2(_0x4831f9);});});}exports[_0x27a0('0x17')]=function(_0x5abc8a){var _0x36cbc4=this;return new Promise(function(_0x2d2ad5,_0x31c279){return db[_0x27a0('0x18')]['create'](_0x5abc8a[_0x27a0('0x19')],{'raw':_0x5abc8a[_0x27a0('0x1a')]?_0x5abc8a[_0x27a0('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x72fc84){logger[_0x27a0('0xd')]('CreateVoiceAgentReport',_0x5abc8a);logger[_0x27a0('0x10')](_0x27a0('0x17'),_0x5abc8a,JSON[_0x27a0('0x1b')](_0x72fc84));_0x2d2ad5(_0x72fc84);})['catch'](function(_0x464b86){logger['error'](_0x27a0('0x17'),_0x464b86[_0x27a0('0x14')],_0x5abc8a);_0x31c279(_0x36cbc4[_0x27a0('0x12')](0x1f4,_0x464b86['message']));});});};exports[_0x27a0('0x1c')]=function(_0xe3da02){var _0x1a3d60=this;return new Promise(function(_0x4f4641,_0x5acef3){return db[_0x27a0('0x18')][_0x27a0('0x1d')](_0xe3da02[_0x27a0('0x19')],{'raw':_0xe3da02[_0x27a0('0x1a')]?_0xe3da02[_0x27a0('0x1a')][_0x27a0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe3da02['options']?_0xe3da02[_0x27a0('0x1a')][_0x27a0('0x1f')]||null:null,'attributes':_0xe3da02[_0x27a0('0x1a')]?_0xe3da02[_0x27a0('0x1a')]['attributes']||null:null,'limit':_0xe3da02[_0x27a0('0x1a')]?_0xe3da02['options']['limit']||null:null})[_0x27a0('0xc')](function(_0x5b6107){logger['info'](_0x27a0('0x1c'),_0xe3da02);logger[_0x27a0('0x10')](_0x27a0('0x1c'),_0xe3da02,JSON[_0x27a0('0x1b')](_0x5b6107));_0x4f4641(_0x5b6107);})[_0x27a0('0x16')](function(_0x4c7298){logger[_0x27a0('0x12')](_0x27a0('0x1c'),_0x4c7298[_0x27a0('0x14')],_0xe3da02);_0x5acef3(_0x1a3d60[_0x27a0('0x12')](0x1f4,_0x4c7298[_0x27a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f1349da..2700c78 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 _0x50c3=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','isAuthenticated','describe','get','/:id','show','post','create','put','update'];(function(_0x40bc01,_0x22a9a9){var _0x42365b=function(_0x2d3d88){while(--_0x2d3d88){_0x40bc01['push'](_0x40bc01['shift']());}};_0x42365b(++_0x22a9a9);}(_0x50c3,0x153));var _0x350c=function(_0x3372af,_0x5ec189){_0x3372af=_0x3372af-0x0;var _0x16606d=_0x50c3[_0x3372af];return _0x16606d;};'use strict';var multer=require(_0x350c('0x0'));var util=require(_0x350c('0x1'));var path=require(_0x350c('0x2'));var timeout=require(_0x350c('0x3'));var express=require(_0x350c('0x4'));var router=express[_0x350c('0x5')]();var auth=require(_0x350c('0x6'));var interaction=require(_0x350c('0x7'));var config=require('../../config/environment');var controller=require(_0x350c('0x8'));router['get']('/',auth[_0x350c('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x350c('0xa')]);router[_0x350c('0xb')](_0x350c('0xc'),auth[_0x350c('0x9')](),controller[_0x350c('0xd')]);router[_0x350c('0xe')]('/',auth['isAuthenticated'](),controller[_0x350c('0xf')]);router[_0x350c('0x10')](_0x350c('0xc'),auth[_0x350c('0x9')](),controller[_0x350c('0x11')]);router[_0x350c('0x12')](_0x350c('0xc'),auth[_0x350c('0x9')](),controller[_0x350c('0x13')]);module[_0x350c('0x14')]=router; \ No newline at end of file +var _0x2f74=['../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2adf4,_0x5df6de){var _0x45d47d=function(_0x903910){while(--_0x903910){_0x2adf4['push'](_0x2adf4['shift']());}};_0x45d47d(++_0x5df6de);}(_0x2f74,0xb7));var _0x42f7=function(_0x1d47c3,_0x856818){_0x1d47c3=_0x1d47c3-0x0;var _0x220130=_0x2f74[_0x1d47c3];return _0x220130;};'use strict';var multer=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var path=require(_0x42f7('0x2'));var timeout=require(_0x42f7('0x3'));var express=require(_0x42f7('0x4'));var router=express['Router']();var auth=require(_0x42f7('0x5'));var interaction=require(_0x42f7('0x6'));var config=require(_0x42f7('0x7'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x42f7('0x8')](),controller[_0x42f7('0x9')]);router[_0x42f7('0xa')](_0x42f7('0xb'),auth[_0x42f7('0x8')](),controller['describe']);router[_0x42f7('0xa')](_0x42f7('0xc'),auth[_0x42f7('0x8')](),controller[_0x42f7('0xd')]);router[_0x42f7('0xe')]('/',auth[_0x42f7('0x8')](),controller['create']);router[_0x42f7('0xf')]('/:id',auth[_0x42f7('0x8')](),controller[_0x42f7('0x10')]);router[_0x42f7('0x11')](_0x42f7('0xc'),auth[_0x42f7('0x8')](),controller[_0x42f7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 29e2c2f..a2b14f5 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 _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x1a3205,_0x1e9439){var _0x2022e9=function(_0x55a514){while(--_0x55a514){_0x1a3205['push'](_0x1a3205['shift']());}};_0x2022e9(++_0x1e9439);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x293caa,_0x10c8a3){var _0x5ec971=function(_0x3b3bc7){while(--_0x3b3bc7){_0x293caa['push'](_0x293caa['shift']());}};_0x5ec971(++_0x10c8a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'uniqueid':{'type':Sequelize[_0x0a9e('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0a9e('0x3'),'outbound',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'))},'tag':{'type':Sequelize[_0x0a9e('0x2')]},'accountcode':{'type':Sequelize[_0x0a9e('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x0a9e('0x2')]},'destinationcontext':{'type':Sequelize[_0x0a9e('0x2')]},'callerid':{'type':Sequelize[_0x0a9e('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x0a9e('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x0a9e('0x7')]},'answertime':{'type':Sequelize[_0x0a9e('0x7')]},'endtime':{'type':Sequelize[_0x0a9e('0x7')]},'duration':{'type':Sequelize[_0x0a9e('0x8')]},'billableseconds':{'type':Sequelize[_0x0a9e('0x8')]},'mohtime':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0a9e('0x2')]},'prefix':{'type':Sequelize[_0x0a9e('0x2')]},'routeid':{'type':Sequelize[_0x0a9e('0x8')]},'sipcallid':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6839ff4..dd90cd1 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 _0xb527=['../../config/environment','../../mysqldb','status','json','offset','set','reject','save','update','then','destroy','sendStatus','error','name','send','index','VoiceCallReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','catch','include','find','create','body','describe','uniqueid','params','user','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x4777f2,_0x4aa688){var _0x1ce204=function(_0x336c29){while(--_0x336c29){_0x4777f2['push'](_0x4777f2['shift']());}};_0x1ce204(++_0x4aa688);}(_0xb527,0x1b0));var _0x7b52=function(_0x3ba7ed,_0x35c59b){_0x3ba7ed=_0x3ba7ed-0x0;var _0x29053b=_0xb527[_0x3ba7ed];return _0x29053b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7b52('0x0'));var zipdir=require(_0x7b52('0x1'));var jsonpatch=require(_0x7b52('0x2'));var rp=require(_0x7b52('0x3'));var moment=require(_0x7b52('0x4'));var BPromise=require(_0x7b52('0x5'));var Mustache=require(_0x7b52('0x6'));var util=require('util');var path=require(_0x7b52('0x7'));var sox=require(_0x7b52('0x8'));var csv=require('to-csv');var ejs=require(_0x7b52('0x9'));var fs=require('fs');var _=require(_0x7b52('0xa'));var squel=require('squel');var crypto=require(_0x7b52('0xb'));var jsforce=require(_0x7b52('0xc'));var deskjs=require(_0x7b52('0xd'));var toCsv=require(_0x7b52('0xe'));var querystring=require(_0x7b52('0xf'));var Papa=require('papaparse');var Redis=require(_0x7b52('0x10'));var authService=require(_0x7b52('0x11'));var qs=require(_0x7b52('0x12'));var as=require(_0x7b52('0x13'));var hardwareService=require(_0x7b52('0x14'));var logger=require(_0x7b52('0x15'))(_0x7b52('0x16'));var utils=require(_0x7b52('0x17'));var config=require(_0x7b52('0x18'));var db=require(_0x7b52('0x19'))['db'];function respondWithStatusCode(_0xd2e58,_0x271aeb){_0x271aeb=_0x271aeb||0xcc;return function(_0x467f47){if(_0x467f47){return _0xd2e58['sendStatus'](_0x271aeb);}return _0xd2e58[_0x7b52('0x1a')](_0x271aeb)['end']();};}function respondWithResult(_0x476ac1,_0x56f7ed){_0x56f7ed=_0x56f7ed||0xc8;return function(_0x27dec5){if(_0x27dec5){return _0x476ac1[_0x7b52('0x1a')](_0x56f7ed)[_0x7b52('0x1b')](_0x27dec5);}};}function respondWithFilteredResult(_0x268b09,_0x37cb6d){return function(_0x5f2ba7){if(_0x5f2ba7){var _0x16019a=_0x5f2ba7['count'],_0x806da4=_0x37cb6d[_0x7b52('0x1c')],_0x4ab76a=_0x37cb6d[_0x7b52('0x1c')]+_0x37cb6d['limit'],_0xf5ed88;if(_0x4ab76a>=_0x16019a){_0x4ab76a=_0x16019a;_0xf5ed88=0xc8;}else{_0xf5ed88=0xce;}_0x268b09[_0x7b52('0x1a')](_0xf5ed88);return _0x268b09[_0x7b52('0x1d')]('Content-Range',_0x806da4+'-'+_0x4ab76a+'/'+_0x16019a)[_0x7b52('0x1b')](_0x5f2ba7);}return null;};}function patchUpdates(_0x3c17fa){return function(_0x5797d3){try{jsonpatch['apply'](_0x5797d3,_0x3c17fa,!![]);}catch(_0x109773){return BPromise[_0x7b52('0x1e')](_0x109773);}return _0x5797d3[_0x7b52('0x1f')]();};}function saveUpdates(_0x49af07,_0x41cd38){return function(_0x67d8fc){if(_0x67d8fc){return _0x67d8fc[_0x7b52('0x20')](_0x49af07)[_0x7b52('0x21')](function(_0x320278){return _0x320278;});}return null;};}function removeEntity(_0x3b7875,_0x4478d5){return function(_0x1a7b20){if(_0x1a7b20){return _0x1a7b20[_0x7b52('0x22')]()[_0x7b52('0x21')](function(){_0x3b7875[_0x7b52('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x153ecb,_0x49eda0){return function(_0x4f72d6){if(!_0x4f72d6){_0x153ecb[_0x7b52('0x23')](0x194);}return _0x4f72d6;};}function handleError(_0x12b3a1,_0x43e876){_0x43e876=_0x43e876||0x1f4;return function(_0x530f52){logger[_0x7b52('0x24')](_0x530f52['stack']);if(_0x530f52[_0x7b52('0x25')]){delete _0x530f52[_0x7b52('0x25')];}_0x12b3a1[_0x7b52('0x1a')](_0x43e876)[_0x7b52('0x26')](_0x530f52);};}exports[_0x7b52('0x27')]=function(_0x3394f4,_0x2aab05){var _0x6f0a51={},_0x14f85b={},_0xc5cba6={'count':0x0,'rows':[]};var _0x295cca=_['map'](db[_0x7b52('0x28')][_0x7b52('0x29')],function(_0x4cc10a){return{'name':_0x4cc10a[_0x7b52('0x2a')],'type':_0x4cc10a['type']['key']};});_0x14f85b[_0x7b52('0x2b')]=_[_0x7b52('0x2c')](_0x295cca,_0x7b52('0x25'));_0x14f85b[_0x7b52('0x2d')]=_[_0x7b52('0x2e')](_0x3394f4[_0x7b52('0x2d')]);_0x14f85b[_0x7b52('0x2f')]=_[_0x7b52('0x30')](_0x14f85b['model'],_0x14f85b[_0x7b52('0x2d')]);_0x6f0a51[_0x7b52('0x31')]=_['intersection'](_0x14f85b['model'],qs[_0x7b52('0x32')](_0x3394f4['query'][_0x7b52('0x32')]));_0x6f0a51['attributes']=_0x6f0a51['attributes'][_0x7b52('0x33')]?_0x6f0a51['attributes']:_0x14f85b[_0x7b52('0x2b')];if(!_0x3394f4[_0x7b52('0x2d')][_0x7b52('0x34')]('nolimit')){_0x6f0a51[_0x7b52('0x35')]=qs['limit'](_0x3394f4[_0x7b52('0x2d')]['limit']);_0x6f0a51[_0x7b52('0x1c')]=qs[_0x7b52('0x1c')](_0x3394f4['query'][_0x7b52('0x1c')]);}_0x6f0a51['order']=qs[_0x7b52('0x36')](_0x3394f4[_0x7b52('0x2d')][_0x7b52('0x36')]);_0x6f0a51[_0x7b52('0x37')]=qs['filters'](_[_0x7b52('0x38')](_0x3394f4[_0x7b52('0x2d')],_0x14f85b[_0x7b52('0x2f')]),_0x295cca);if(_0x3394f4[_0x7b52('0x2d')][_0x7b52('0x39')]){_0x6f0a51['where']=_[_0x7b52('0x3a')](_0x6f0a51['where'],{'$or':_[_0x7b52('0x2c')](_0x295cca,function(_0x15375b){if(_0x15375b['type']!==_0x7b52('0x3b')){var _0x4b958a={};_0x4b958a[_0x15375b[_0x7b52('0x25')]]={'$like':'%'+_0x3394f4['query'][_0x7b52('0x39')]+'%'};return _0x4b958a;}})});}_0x6f0a51=_[_0x7b52('0x3a')]({},_0x6f0a51,_0x3394f4[_0x7b52('0x3c')]);var _0x42f4b2={'where':_0x6f0a51[_0x7b52('0x37')]};return db[_0x7b52('0x28')][_0x7b52('0x3d')](_0x42f4b2)['then'](function(_0x14484e){_0xc5cba6[_0x7b52('0x3d')]=_0x14484e;if(_0x3394f4['query'][_0x7b52('0x3e')]){_0x6f0a51['include']=[{'attributes':['id',_0x7b52('0x25'),_0x7b52('0x3f'),_0x7b52('0x40')],'model':db['User'],'as':_0x7b52('0x41')}];}return db['VoiceCallReport'][_0x7b52('0x42')](_0x6f0a51);})[_0x7b52('0x21')](function(_0x28012d){_0xc5cba6['rows']=_0x28012d;return _0xc5cba6;})[_0x7b52('0x21')](respondWithFilteredResult(_0x2aab05,_0x6f0a51))[_0x7b52('0x43')](handleError(_0x2aab05,null));};exports['show']=function(_0x2f231a,_0x34e956){var _0x4166e8={'raw':!![],'where':{'id':_0x2f231a['params']['id']}},_0x347656={};_0x347656[_0x7b52('0x2b')]=_['keys'](db['VoiceCallReport'][_0x7b52('0x29')]);_0x347656['query']=_[_0x7b52('0x2e')](_0x2f231a[_0x7b52('0x2d')]);_0x347656[_0x7b52('0x2f')]=_[_0x7b52('0x30')](_0x347656[_0x7b52('0x2b')],_0x347656[_0x7b52('0x2d')]);_0x4166e8[_0x7b52('0x31')]=_[_0x7b52('0x30')](_0x347656[_0x7b52('0x2b')],qs[_0x7b52('0x32')](_0x2f231a[_0x7b52('0x2d')][_0x7b52('0x32')]));_0x4166e8[_0x7b52('0x31')]=_0x4166e8[_0x7b52('0x31')][_0x7b52('0x33')]?_0x4166e8[_0x7b52('0x31')]:_0x347656['model'];if(_0x2f231a[_0x7b52('0x2d')]['includeAll']){_0x4166e8[_0x7b52('0x44')]=[{'all':!![]}];}_0x4166e8=_[_0x7b52('0x3a')]({},_0x4166e8,_0x2f231a[_0x7b52('0x3c')]);return db[_0x7b52('0x28')][_0x7b52('0x45')](_0x4166e8)['then'](handleEntityNotFound(_0x34e956,null))[_0x7b52('0x21')](respondWithResult(_0x34e956,null))['catch'](handleError(_0x34e956,null));};exports[_0x7b52('0x46')]=function(_0x296978,_0x5ed1a9){return db[_0x7b52('0x28')][_0x7b52('0x46')](_0x296978[_0x7b52('0x47')],{})[_0x7b52('0x21')](respondWithResult(_0x5ed1a9,0xc9))['catch'](handleError(_0x5ed1a9,null));};exports['destroy']=function(_0x4b3447,_0x588bc1){return db[_0x7b52('0x28')][_0x7b52('0x45')]({'where':{'id':_0x4b3447['params']['id']}})[_0x7b52('0x21')](handleEntityNotFound(_0x588bc1,null))[_0x7b52('0x21')](removeEntity(_0x588bc1,null))[_0x7b52('0x43')](handleError(_0x588bc1,null));};exports[_0x7b52('0x48')]=function(_0x275a8b,_0x116631){return db['VoiceCallReport'][_0x7b52('0x48')]()[_0x7b52('0x21')](respondWithResult(_0x116631,null))[_0x7b52('0x43')](handleError(_0x116631,null));};exports[_0x7b52('0x20')]=function(_0x1b818f,_0x3c54eb){if(_0x1b818f['body']['uniqueid']){delete _0x1b818f[_0x7b52('0x47')][_0x7b52('0x49')];}return db[_0x7b52('0x28')][_0x7b52('0x45')]({'where':{'uniqueid':_0x1b818f[_0x7b52('0x4a')]['id'],'UserId':{'$or':[null,_0x1b818f[_0x7b52('0x4b')]['id']]}}})[_0x7b52('0x21')](handleEntityNotFound(_0x3c54eb,null))[_0x7b52('0x21')](saveUpdates(_0x1b818f['body'],null))['then'](respondWithResult(_0x3c54eb,null))[_0x7b52('0x43')](handleError(_0x3c54eb,null));}; \ No newline at end of file +var _0xd325=['type','key','model','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','options','includeAll','include','alias','User','rows','catch','show','params','keys','fields','create','body','describe','uniqueid','find','user','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','name','index','map','VoiceCallReport','rawAttributes','fieldName'];(function(_0x2c9056,_0x552f14){var _0x3e6959=function(_0x556247){while(--_0x556247){_0x2c9056['push'](_0x2c9056['shift']());}};_0x3e6959(++_0x552f14);}(_0xd325,0x13c));var _0x5d32=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xd325[_0x26d386];return _0x4ef9a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d32('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5d32('0x1'));var rp=require(_0x5d32('0x2'));var moment=require(_0x5d32('0x3'));var BPromise=require(_0x5d32('0x4'));var Mustache=require(_0x5d32('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5d32('0x6'));var csv=require('to-csv');var ejs=require(_0x5d32('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5d32('0x8'));var jsforce=require(_0x5d32('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5d32('0xa'));var querystring=require(_0x5d32('0xb'));var Papa=require(_0x5d32('0xc'));var Redis=require(_0x5d32('0xd'));var authService=require(_0x5d32('0xe'));var qs=require(_0x5d32('0xf'));var as=require(_0x5d32('0x10'));var hardwareService=require(_0x5d32('0x11'));var logger=require('../../config/logger')(_0x5d32('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c56b2,_0x1e694f){_0x1e694f=_0x1e694f||0xcc;return function(_0x1cf1f9){if(_0x1cf1f9){return _0x3c56b2[_0x5d32('0x13')](_0x1e694f);}return _0x3c56b2[_0x5d32('0x14')](_0x1e694f)[_0x5d32('0x15')]();};}function respondWithResult(_0x54b56c,_0x59b36a){_0x59b36a=_0x59b36a||0xc8;return function(_0x7fa19c){if(_0x7fa19c){return _0x54b56c[_0x5d32('0x14')](_0x59b36a)[_0x5d32('0x16')](_0x7fa19c);}};}function respondWithFilteredResult(_0x35cfa0,_0x4bde63){return function(_0x452868){if(_0x452868){var _0x5eb941=_0x452868[_0x5d32('0x17')],_0x5835d1=_0x4bde63[_0x5d32('0x18')],_0x3d69d2=_0x4bde63[_0x5d32('0x18')]+_0x4bde63[_0x5d32('0x19')],_0x5afd84;if(_0x3d69d2>=_0x5eb941){_0x3d69d2=_0x5eb941;_0x5afd84=0xc8;}else{_0x5afd84=0xce;}_0x35cfa0['status'](_0x5afd84);return _0x35cfa0[_0x5d32('0x1a')](_0x5d32('0x1b'),_0x5835d1+'-'+_0x3d69d2+'/'+_0x5eb941)[_0x5d32('0x16')](_0x452868);}return null;};}function patchUpdates(_0x534e7d){return function(_0x91db81){try{jsonpatch[_0x5d32('0x1c')](_0x91db81,_0x534e7d,!![]);}catch(_0x341216){return BPromise[_0x5d32('0x1d')](_0x341216);}return _0x91db81['save']();};}function saveUpdates(_0x5a4008,_0x4d6c7f){return function(_0x2eced9){if(_0x2eced9){return _0x2eced9[_0x5d32('0x1e')](_0x5a4008)[_0x5d32('0x1f')](function(_0x44fc51){return _0x44fc51;});}return null;};}function removeEntity(_0x2d98d3,_0x50db90){return function(_0x5ac31c){if(_0x5ac31c){return _0x5ac31c[_0x5d32('0x20')]()['then'](function(){_0x2d98d3[_0x5d32('0x14')](0xcc)[_0x5d32('0x15')]();});}};}function handleEntityNotFound(_0x127552,_0x194ab2){return function(_0xfc5066){if(!_0xfc5066){_0x127552['sendStatus'](0x194);}return _0xfc5066;};}function handleError(_0x44c71c,_0x2383fa){_0x2383fa=_0x2383fa||0x1f4;return function(_0x9e1e64){logger['error'](_0x9e1e64['stack']);if(_0x9e1e64['name']){delete _0x9e1e64[_0x5d32('0x21')];}_0x44c71c[_0x5d32('0x14')](_0x2383fa)['send'](_0x9e1e64);};}exports[_0x5d32('0x22')]=function(_0x1e4e03,_0x30b50f){var _0x53d7fc={},_0x8a08d2={},_0x1a1cdd={'count':0x0,'rows':[]};var _0x27374e=_[_0x5d32('0x23')](db[_0x5d32('0x24')][_0x5d32('0x25')],function(_0x1f3d5e){return{'name':_0x1f3d5e[_0x5d32('0x26')],'type':_0x1f3d5e[_0x5d32('0x27')][_0x5d32('0x28')]};});_0x8a08d2[_0x5d32('0x29')]=_['map'](_0x27374e,_0x5d32('0x21'));_0x8a08d2[_0x5d32('0x2a')]=_['keys'](_0x1e4e03[_0x5d32('0x2a')]);_0x8a08d2['filters']=_['intersection'](_0x8a08d2[_0x5d32('0x29')],_0x8a08d2['query']);_0x53d7fc[_0x5d32('0x2b')]=_[_0x5d32('0x2c')](_0x8a08d2[_0x5d32('0x29')],qs['fields'](_0x1e4e03[_0x5d32('0x2a')]['fields']));_0x53d7fc[_0x5d32('0x2b')]=_0x53d7fc['attributes'][_0x5d32('0x2d')]?_0x53d7fc['attributes']:_0x8a08d2['model'];if(!_0x1e4e03[_0x5d32('0x2a')][_0x5d32('0x2e')](_0x5d32('0x2f'))){_0x53d7fc[_0x5d32('0x19')]=qs[_0x5d32('0x19')](_0x1e4e03['query'][_0x5d32('0x19')]);_0x53d7fc[_0x5d32('0x18')]=qs[_0x5d32('0x18')](_0x1e4e03[_0x5d32('0x2a')]['offset']);}_0x53d7fc[_0x5d32('0x30')]=qs[_0x5d32('0x31')](_0x1e4e03[_0x5d32('0x2a')][_0x5d32('0x31')]);_0x53d7fc[_0x5d32('0x32')]=qs[_0x5d32('0x33')](_['pick'](_0x1e4e03[_0x5d32('0x2a')],_0x8a08d2['filters']),_0x27374e);if(_0x1e4e03[_0x5d32('0x2a')]['filter']){_0x53d7fc[_0x5d32('0x32')]=_['merge'](_0x53d7fc[_0x5d32('0x32')],{'$or':_[_0x5d32('0x23')](_0x27374e,function(_0x4d03a3){if(_0x4d03a3[_0x5d32('0x27')]!==_0x5d32('0x34')){var _0x5af3c4={};_0x5af3c4[_0x4d03a3[_0x5d32('0x21')]]={'$like':'%'+_0x1e4e03[_0x5d32('0x2a')][_0x5d32('0x35')]+'%'};return _0x5af3c4;}})});}_0x53d7fc=_['merge']({},_0x53d7fc,_0x1e4e03[_0x5d32('0x36')]);var _0x5c729e={'where':_0x53d7fc[_0x5d32('0x32')]};return db['VoiceCallReport']['count'](_0x5c729e)[_0x5d32('0x1f')](function(_0x3920ce){_0x1a1cdd[_0x5d32('0x17')]=_0x3920ce;if(_0x1e4e03['query'][_0x5d32('0x37')]){_0x53d7fc[_0x5d32('0x38')]=[{'attributes':['id',_0x5d32('0x21'),'fullname',_0x5d32('0x39')],'model':db[_0x5d32('0x3a')],'as':_0x5d32('0x3a')}];}return db[_0x5d32('0x24')]['findAll'](_0x53d7fc);})[_0x5d32('0x1f')](function(_0x44b36f){_0x1a1cdd[_0x5d32('0x3b')]=_0x44b36f;return _0x1a1cdd;})['then'](respondWithFilteredResult(_0x30b50f,_0x53d7fc))[_0x5d32('0x3c')](handleError(_0x30b50f,null));};exports[_0x5d32('0x3d')]=function(_0x3c49cc,_0x13e777){var _0x2051e2={'raw':!![],'where':{'id':_0x3c49cc[_0x5d32('0x3e')]['id']}},_0x29c0b2={};_0x29c0b2['model']=_[_0x5d32('0x3f')](db[_0x5d32('0x24')][_0x5d32('0x25')]);_0x29c0b2['query']=_[_0x5d32('0x3f')](_0x3c49cc[_0x5d32('0x2a')]);_0x29c0b2[_0x5d32('0x33')]=_[_0x5d32('0x2c')](_0x29c0b2[_0x5d32('0x29')],_0x29c0b2['query']);_0x2051e2[_0x5d32('0x2b')]=_[_0x5d32('0x2c')](_0x29c0b2[_0x5d32('0x29')],qs['fields'](_0x3c49cc['query'][_0x5d32('0x40')]));_0x2051e2[_0x5d32('0x2b')]=_0x2051e2[_0x5d32('0x2b')]['length']?_0x2051e2['attributes']:_0x29c0b2[_0x5d32('0x29')];if(_0x3c49cc[_0x5d32('0x2a')]['includeAll']){_0x2051e2[_0x5d32('0x38')]=[{'all':!![]}];}_0x2051e2=_['merge']({},_0x2051e2,_0x3c49cc[_0x5d32('0x36')]);return db[_0x5d32('0x24')]['find'](_0x2051e2)['then'](handleEntityNotFound(_0x13e777,null))['then'](respondWithResult(_0x13e777,null))[_0x5d32('0x3c')](handleError(_0x13e777,null));};exports[_0x5d32('0x41')]=function(_0x391a93,_0xcac896){return db[_0x5d32('0x24')][_0x5d32('0x41')](_0x391a93[_0x5d32('0x42')],{})['then'](respondWithResult(_0xcac896,0xc9))['catch'](handleError(_0xcac896,null));};exports[_0x5d32('0x20')]=function(_0x27870d,_0xaa8c31){return db[_0x5d32('0x24')]['find']({'where':{'id':_0x27870d[_0x5d32('0x3e')]['id']}})[_0x5d32('0x1f')](handleEntityNotFound(_0xaa8c31,null))['then'](removeEntity(_0xaa8c31,null))[_0x5d32('0x3c')](handleError(_0xaa8c31,null));};exports[_0x5d32('0x43')]=function(_0x459853,_0x3e8248){return db[_0x5d32('0x24')][_0x5d32('0x43')]()[_0x5d32('0x1f')](respondWithResult(_0x3e8248,null))[_0x5d32('0x3c')](handleError(_0x3e8248,null));};exports[_0x5d32('0x1e')]=function(_0x337acd,_0x4be74f){if(_0x337acd[_0x5d32('0x42')][_0x5d32('0x44')]){delete _0x337acd[_0x5d32('0x42')]['uniqueid'];}return db['VoiceCallReport'][_0x5d32('0x45')]({'where':{'uniqueid':_0x337acd['params']['id'],'UserId':{'$or':[null,_0x337acd[_0x5d32('0x46')]['id']]}}})[_0x5d32('0x1f')](handleEntityNotFound(_0x4be74f,null))[_0x5d32('0x1f')](saveUpdates(_0x337acd['body'],null))[_0x5d32('0x1f')](respondWithResult(_0x4be74f,null))[_0x5d32('0x3c')](handleError(_0x4be74f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 4996253..afcaadd 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 _0x2bce=['rimraf','../../config/environment','exports','define','VoiceCallReport','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20e8a9,_0x2ee4e0){var _0x5e57cd=function(_0x53e602){while(--_0x53e602){_0x20e8a9['push'](_0x20e8a9['shift']());}};_0x5e57cd(++_0x2ee4e0);}(_0x2bce,0x1c2));var _0xe2bc=function(_0x25805e,_0x20b491){_0x25805e=_0x25805e-0x0;var _0x2de9a7=_0x2bce[_0x25805e];return _0x2de9a7;};'use strict';var _=require(_0xe2bc('0x0'));var util=require(_0xe2bc('0x1'));var logger=require('../../config/logger')(_0xe2bc('0x2'));var moment=require(_0xe2bc('0x3'));var BPromise=require(_0xe2bc('0x4'));var rp=require(_0xe2bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2bc('0x6'));var config=require(_0xe2bc('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xe2bc('0x8')]=function(_0x186000,_0x596511){return _0x186000[_0xe2bc('0x9')](_0xe2bc('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xe2bc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d7d=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5c6808,_0x3a6041){var _0x38678e=function(_0x28ae3e){while(--_0x28ae3e){_0x5c6808['push'](_0x5c6808['shift']());}};_0x38678e(++_0x3a6041);}(_0x3d7d,0x172));var _0xd3d7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3d7d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd3d7('0x0'));var util=require(_0xd3d7('0x1'));var logger=require(_0xd3d7('0x2'))(_0xd3d7('0x3'));var moment=require(_0xd3d7('0x4'));var BPromise=require(_0xd3d7('0x5'));var rp=require(_0xd3d7('0x6'));var fs=require('fs');var path=require(_0xd3d7('0x7'));var rimraf=require(_0xd3d7('0x8'));var config=require(_0xd3d7('0x9'));var attributes=require(_0xd3d7('0xa'));module[_0xd3d7('0xb')]=function(_0x58fd2c,_0x34debb){return _0x58fd2c[_0xd3d7('0xc')](_0xd3d7('0xd'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xd3d7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 2514d5c..93b6d44 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 _0x41e5=['info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','model','map','CreateVoiceCallReport','body','raw','UpdateVoiceCallReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x11b083,_0x5259ee){var _0x52e876=function(_0x3fa892){while(--_0x3fa892){_0x11b083['push'](_0x11b083['shift']());}};_0x52e876(++_0x5259ee);}(_0x41e5,0x18b));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x541e('0x0'));var moment=require(_0x541e('0x1'));var BPromise=require(_0x541e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x541e('0x3'));var db=require(_0x541e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x541e('0x5'))(_0x541e('0x6'));var config=require(_0x541e('0x7'));var jayson=require(_0x541e('0x8'));var client=jayson[_0x541e('0x9')][_0x541e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24ebdc,_0x3792b5,_0x5dd051){return new BPromise(function(_0x4c88e4,_0x4b9134){return client['request'](_0x24ebdc,_0x5dd051)[_0x541e('0xb')](function(_0x2d77ae){logger[_0x541e('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3792b5,_0x541e('0xd'));logger[_0x541e('0xe')](_0x541e('0xf'),_0x3792b5,'request\x20sent',JSON[_0x541e('0x10')](_0x2d77ae));if(_0x2d77ae[_0x541e('0x11')]){if(_0x2d77ae[_0x541e('0x11')][_0x541e('0x12')]===0x1f4){logger[_0x541e('0x11')](_0x541e('0x13'),_0x3792b5,_0x2d77ae[_0x541e('0x11')][_0x541e('0x14')]);return _0x4b9134(_0x2d77ae[_0x541e('0x11')][_0x541e('0x14')]);}logger['error'](_0x541e('0x13'),_0x3792b5,_0x2d77ae['error']['message']);return _0x4c88e4(_0x2d77ae[_0x541e('0x11')]['message']);}else{logger[_0x541e('0xc')](_0x541e('0x13'),_0x3792b5,_0x541e('0xd'));_0x4c88e4(_0x2d77ae[_0x541e('0x15')]['message']);}})[_0x541e('0x16')](function(_0x54a4bf){logger[_0x541e('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3792b5,_0x54a4bf);_0x4b9134(_0x54a4bf);});});}exports[_0x541e('0x17')]=function(_0x1f18e6){var _0x1735fd=this;return new Promise(function(_0xfad599,_0x3c4b9c){return db[_0x541e('0x18')][_0x541e('0x19')]({'raw':_0x1f18e6[_0x541e('0x1a')]?_0x1f18e6['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f18e6[_0x541e('0x1a')]?_0x1f18e6[_0x541e('0x1a')][_0x541e('0x1b')]||null:null,'attributes':_0x1f18e6['options']?_0x1f18e6[_0x541e('0x1a')][_0x541e('0x1c')]||null:null,'limit':_0x1f18e6[_0x541e('0x1a')]?_0x1f18e6[_0x541e('0x1a')][_0x541e('0x1d')]||null:null,'include':_0x1f18e6[_0x541e('0x1a')]?_0x1f18e6[_0x541e('0x1a')][_0x541e('0x1e')]?_['map'](_0x1f18e6[_0x541e('0x1a')][_0x541e('0x1e')],function(_0x185834){return{'model':db[_0x185834[_0x541e('0x1f')]],'as':_0x185834['as'],'attributes':_0x185834['attributes'],'include':_0x185834[_0x541e('0x1e')]?_[_0x541e('0x20')](_0x185834[_0x541e('0x1e')],function(_0x35284e){return{'model':db[_0x35284e[_0x541e('0x1f')]],'as':_0x35284e['as'],'attributes':_0x35284e[_0x541e('0x1c')],'include':_0x35284e['include']?_[_0x541e('0x20')](_0x35284e[_0x541e('0x1e')],function(_0x4fa7c9){return{'model':db[_0x4fa7c9[_0x541e('0x1f')]],'as':_0x4fa7c9['as'],'attributes':_0x4fa7c9[_0x541e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x541e('0xb')](function(_0x952772){logger[_0x541e('0xc')]('GetVoiceCallReport',_0x1f18e6);logger[_0x541e('0xe')](_0x541e('0x17'),_0x1f18e6,JSON['stringify'](_0x952772));_0xfad599(_0x952772);})[_0x541e('0x16')](function(_0x1c3646){logger[_0x541e('0x11')](_0x541e('0x17'),_0x1c3646['message'],_0x1f18e6);_0x3c4b9c(_0x1735fd[_0x541e('0x11')](0x1f4,_0x1c3646[_0x541e('0x14')]));});});};exports[_0x541e('0x21')]=function(_0xb388ec){var _0x13a9a1=this;return new Promise(function(_0x348c72,_0x1127ac){return db[_0x541e('0x18')]['create'](_0xb388ec[_0x541e('0x22')],{'raw':_0xb388ec[_0x541e('0x1a')]?_0xb388ec[_0x541e('0x1a')][_0x541e('0x23')]===undefined?!![]:![]:!![]})[_0x541e('0xb')](function(_0x3ce26d){logger['info'](_0x541e('0x21'),_0xb388ec);logger[_0x541e('0xe')]('CreateVoiceCallReport',_0xb388ec,JSON['stringify'](_0x3ce26d));_0x348c72(_0x3ce26d);})[_0x541e('0x16')](function(_0x4c12d8){logger[_0x541e('0x11')](_0x541e('0x21'),_0x4c12d8['message'],_0xb388ec);_0x1127ac(_0x13a9a1[_0x541e('0x11')](0x1f4,_0x4c12d8[_0x541e('0x14')]));});});};exports[_0x541e('0x24')]=function(_0x46e340){var _0x1936f8=this;return new Promise(function(_0x3f14ba,_0x56ea56){return db[_0x541e('0x18')]['update'](_0x46e340[_0x541e('0x22')],{'raw':_0x46e340[_0x541e('0x1a')]?_0x46e340[_0x541e('0x1a')][_0x541e('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46e340[_0x541e('0x1a')]?_0x46e340[_0x541e('0x1a')][_0x541e('0x1b')]||null:null,'attributes':_0x46e340['options']?_0x46e340[_0x541e('0x1a')]['attributes']||null:null,'limit':_0x46e340[_0x541e('0x1a')]?_0x46e340[_0x541e('0x1a')]['limit']||null:null})[_0x541e('0xb')](function(_0x11df0b){logger['info'](_0x541e('0x24'),_0x46e340);logger[_0x541e('0xe')](_0x541e('0x24'),_0x46e340,JSON[_0x541e('0x10')](_0x11df0b));_0x3f14ba(_0x11df0b);})['catch'](function(_0x3c52d0){logger[_0x541e('0x11')](_0x541e('0x24'),_0x3c52d0[_0x541e('0x14')],_0x46e340);_0x56ea56(_0x1936f8['error'](0x1f4,_0x3c52d0[_0x541e('0x14')]));});});}; \ No newline at end of file +var _0xf370=['options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf370,0x151));var _0x0f37=function(_0x1bd7c0,_0x107df4){_0x1bd7c0=_0x1bd7c0-0x0;var _0x437c0d=_0xf370[_0x1bd7c0];return _0x437c0d;};'use strict';var _=require('lodash');var util=require(_0x0f37('0x0'));var moment=require('moment');var BPromise=require(_0x0f37('0x1'));var rs=require(_0x0f37('0x2'));var fs=require('fs');var Redis=require(_0x0f37('0x3'));var db=require(_0x0f37('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f37('0x5'))(_0x0f37('0x6'));var config=require(_0x0f37('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0f37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bdcce,_0x50f0cb,_0x4d444c){return new BPromise(function(_0x56d72a,_0x10d726){return client[_0x0f37('0x9')](_0x2bdcce,_0x4d444c)[_0x0f37('0xa')](function(_0x3e5440){logger[_0x0f37('0xb')](_0x0f37('0xc'),_0x50f0cb,_0x0f37('0xd'));logger[_0x0f37('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x50f0cb,_0x0f37('0xd'),JSON[_0x0f37('0xf')](_0x3e5440));if(_0x3e5440['error']){if(_0x3e5440[_0x0f37('0x10')][_0x0f37('0x11')]===0x1f4){logger[_0x0f37('0x10')](_0x0f37('0xc'),_0x50f0cb,_0x3e5440[_0x0f37('0x10')]['message']);return _0x10d726(_0x3e5440['error'][_0x0f37('0x12')]);}logger['error'](_0x0f37('0xc'),_0x50f0cb,_0x3e5440[_0x0f37('0x10')][_0x0f37('0x12')]);return _0x56d72a(_0x3e5440['error'][_0x0f37('0x12')]);}else{logger[_0x0f37('0xb')](_0x0f37('0xc'),_0x50f0cb,_0x0f37('0xd'));_0x56d72a(_0x3e5440[_0x0f37('0x13')][_0x0f37('0x12')]);}})[_0x0f37('0x14')](function(_0x4117aa){logger[_0x0f37('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x50f0cb,_0x4117aa);_0x10d726(_0x4117aa);});});}exports[_0x0f37('0x15')]=function(_0x4e5edb){var _0x21eeba=this;return new Promise(function(_0x1bc4bd,_0x160cf0){return db[_0x0f37('0x16')]['findAll']({'raw':_0x4e5edb[_0x0f37('0x17')]?_0x4e5edb['options'][_0x0f37('0x18')]===undefined?!![]:![]:!![],'where':_0x4e5edb[_0x0f37('0x17')]?_0x4e5edb[_0x0f37('0x17')][_0x0f37('0x19')]||null:null,'attributes':_0x4e5edb['options']?_0x4e5edb[_0x0f37('0x17')][_0x0f37('0x1a')]||null:null,'limit':_0x4e5edb['options']?_0x4e5edb[_0x0f37('0x17')][_0x0f37('0x1b')]||null:null,'include':_0x4e5edb[_0x0f37('0x17')]?_0x4e5edb['options'][_0x0f37('0x1c')]?_[_0x0f37('0x1d')](_0x4e5edb[_0x0f37('0x17')][_0x0f37('0x1c')],function(_0x178d09){return{'model':db[_0x178d09[_0x0f37('0x1e')]],'as':_0x178d09['as'],'attributes':_0x178d09['attributes'],'include':_0x178d09[_0x0f37('0x1c')]?_[_0x0f37('0x1d')](_0x178d09[_0x0f37('0x1c')],function(_0x5134f0){return{'model':db[_0x5134f0[_0x0f37('0x1e')]],'as':_0x5134f0['as'],'attributes':_0x5134f0[_0x0f37('0x1a')],'include':_0x5134f0['include']?_[_0x0f37('0x1d')](_0x5134f0[_0x0f37('0x1c')],function(_0x5a9221){return{'model':db[_0x5a9221['model']],'as':_0x5a9221['as'],'attributes':_0x5a9221[_0x0f37('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0f37('0xa')](function(_0x4eb947){logger['info'](_0x0f37('0x15'),_0x4e5edb);logger['debug']('GetVoiceCallReport',_0x4e5edb,JSON['stringify'](_0x4eb947));_0x1bc4bd(_0x4eb947);})['catch'](function(_0x13e762){logger[_0x0f37('0x10')](_0x0f37('0x15'),_0x13e762[_0x0f37('0x12')],_0x4e5edb);_0x160cf0(_0x21eeba['error'](0x1f4,_0x13e762['message']));});});};exports[_0x0f37('0x1f')]=function(_0x42c4cf){var _0x192277=this;return new Promise(function(_0x3be5c8,_0x44c54d){return db[_0x0f37('0x16')][_0x0f37('0x20')](_0x42c4cf[_0x0f37('0x21')],{'raw':_0x42c4cf['options']?_0x42c4cf[_0x0f37('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x582ff9){logger[_0x0f37('0xb')](_0x0f37('0x1f'),_0x42c4cf);logger[_0x0f37('0xe')](_0x0f37('0x1f'),_0x42c4cf,JSON[_0x0f37('0xf')](_0x582ff9));_0x3be5c8(_0x582ff9);})['catch'](function(_0x40577e){logger[_0x0f37('0x10')](_0x0f37('0x1f'),_0x40577e[_0x0f37('0x12')],_0x42c4cf);_0x44c54d(_0x192277[_0x0f37('0x10')](0x1f4,_0x40577e[_0x0f37('0x12')]));});});};exports[_0x0f37('0x22')]=function(_0x3690eb){var _0x3adfee=this;return new Promise(function(_0x36213c,_0x530d01){return db[_0x0f37('0x16')][_0x0f37('0x23')](_0x3690eb['body'],{'raw':_0x3690eb[_0x0f37('0x17')]?_0x3690eb[_0x0f37('0x17')][_0x0f37('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3690eb[_0x0f37('0x17')]?_0x3690eb[_0x0f37('0x17')][_0x0f37('0x19')]||null:null,'attributes':_0x3690eb[_0x0f37('0x17')]?_0x3690eb[_0x0f37('0x17')][_0x0f37('0x1a')]||null:null,'limit':_0x3690eb[_0x0f37('0x17')]?_0x3690eb[_0x0f37('0x17')]['limit']||null:null})['then'](function(_0x57c768){logger[_0x0f37('0xb')]('UpdateVoiceCallReport',_0x3690eb);logger[_0x0f37('0xe')]('UpdateVoiceCallReport',_0x3690eb,JSON[_0x0f37('0xf')](_0x57c768));_0x36213c(_0x57c768);})[_0x0f37('0x14')](function(_0x2254a5){logger['error'](_0x0f37('0x22'),_0x2254a5[_0x0f37('0x12')],_0x3690eb);_0x530d01(_0x3adfee[_0x0f37('0x10')](0x1f4,_0x2254a5[_0x0f37('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 794332b..68b7238 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 _0xed92=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','util','path','connect-timeout'];(function(_0x2130fd,_0x248ff2){var _0x52c629=function(_0x310a02){while(--_0x310a02){_0x2130fd['push'](_0x2130fd['shift']());}};_0x52c629(++_0x248ff2);}(_0xed92,0x166));var _0x2ed9=function(_0x506fad,_0x318ecc){_0x506fad=_0x506fad-0x0;var _0x4aefac=_0xed92[_0x506fad];return _0x4aefac;};'use strict';var multer=require('multer');var util=require(_0x2ed9('0x0'));var path=require(_0x2ed9('0x1'));var timeout=require(_0x2ed9('0x2'));var express=require(_0x2ed9('0x3'));var router=express[_0x2ed9('0x4')]();var auth=require(_0x2ed9('0x5'));var interaction=require(_0x2ed9('0x6'));var config=require(_0x2ed9('0x7'));var controller=require(_0x2ed9('0x8'));router[_0x2ed9('0x9')]('/',auth[_0x2ed9('0xa')](),controller[_0x2ed9('0xb')]);router['get'](_0x2ed9('0xc'),auth[_0x2ed9('0xa')](),controller[_0x2ed9('0xd')]);router[_0x2ed9('0xe')]('/',auth[_0x2ed9('0xa')](),controller[_0x2ed9('0xf')]);router[_0x2ed9('0x10')](_0x2ed9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2ed9('0x11')](_0x2ed9('0xc'),auth[_0x2ed9('0xa')](),controller['destroy']);module[_0x2ed9('0x12')]=router; \ No newline at end of file +var _0x9cb3=['Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','util','path','connect-timeout','express'];(function(_0x309214,_0x37502e){var _0x12fd7d=function(_0x3f3b4d){while(--_0x3f3b4d){_0x309214['push'](_0x309214['shift']());}};_0x12fd7d(++_0x37502e);}(_0x9cb3,0x13f));var _0x39cb=function(_0x1329eb,_0x486a85){_0x1329eb=_0x1329eb-0x0;var _0x7a2e77=_0x9cb3[_0x1329eb];return _0x7a2e77;};'use strict';var multer=require('multer');var util=require(_0x39cb('0x0'));var path=require(_0x39cb('0x1'));var timeout=require(_0x39cb('0x2'));var express=require(_0x39cb('0x3'));var router=express[_0x39cb('0x4')]();var auth=require(_0x39cb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x39cb('0x6'));router[_0x39cb('0x7')]('/',auth[_0x39cb('0x8')](),controller[_0x39cb('0x9')]);router[_0x39cb('0x7')](_0x39cb('0xa'),auth[_0x39cb('0x8')](),controller[_0x39cb('0xb')]);router[_0x39cb('0xc')]('/',auth[_0x39cb('0x8')](),controller[_0x39cb('0xd')]);router[_0x39cb('0xe')](_0x39cb('0xa'),auth[_0x39cb('0x8')](),controller[_0x39cb('0xf')]);router['delete'](_0x39cb('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x39cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 630cd20..bea82af 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 _0x9342=['sequelize','exports','name','STRING','setDataValue','options','getDataValue','split','BOOLEAN'];(function(_0x2b737c,_0x274adf){var _0x466ed5=function(_0x593124){while(--_0x593124){_0x2b737c['push'](_0x2b737c['shift']());}};_0x466ed5(++_0x274adf);}(_0x9342,0x17a));var _0x2934=function(_0x38a638,_0x5ab481){_0x38a638=_0x38a638-0x0;var _0x4b256c=_0x9342[_0x38a638];return _0x4b256c;};'use strict';var Sequelize=require(_0x2934('0x0'));module[_0x2934('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x2934('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x2934('0x3')],'set':function(_0x40adde){this[_0x2934('0x4')]('options',_0x40adde?_0x40adde['join'](''):[]);},'get':function(){return this['getDataValue'](_0x2934('0x5'))?this[_0x2934('0x6')](_0x2934('0x5'))[_0x2934('0x7')](''):[];}},'auth':{'type':Sequelize[_0x2934('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x2934('0x3')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2934('0x3')]},'description':{'type':Sequelize[_0x2934('0x3')]}}; \ No newline at end of file +var _0x063b=['getDataValue','options','split','BOOLEAN','STRING','name','setDataValue','join'];(function(_0x5ddbd8,_0xcc7237){var _0x4e5cac=function(_0x4dc562){while(--_0x4dc562){_0x5ddbd8['push'](_0x5ddbd8['shift']());}};_0x4e5cac(++_0xcc7237);}(_0x063b,0x1a4));var _0xb063=function(_0x4be6e5,_0x52ef97){_0x4be6e5=_0x4be6e5-0x0;var _0x475733=_0x063b[_0x4be6e5];return _0x475733;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb063('0x0')]},'prefix':{'type':Sequelize[_0xb063('0x0')],'unique':_0xb063('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x243cf9){this[_0xb063('0x2')]('options',_0x243cf9?_0x243cf9[_0xb063('0x3')](''):[]);},'get':function(){return this[_0xb063('0x4')](_0xb063('0x5'))?this['getDataValue']('options')[_0xb063('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb063('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xb063('0x0')]},'record':{'type':Sequelize[_0xb063('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb063('0x0')]},'description':{'type':Sequelize[_0xb063('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index dfba5b7..71ba01c 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 _0x17b8=['user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','json','reject','save','update','then','destroy','get','ChanSpies','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xaacb1f,_0x374b62){var _0x3a6297=function(_0x46ffdd){while(--_0x46ffdd){_0xaacb1f['push'](_0xaacb1f['shift']());}};_0x3a6297(++_0x374b62);}(_0x17b8,0xaa));var _0x817b=function(_0x11cf19,_0x549192){_0x11cf19=_0x11cf19-0x0;var _0x2cb81e=_0x17b8[_0x11cf19];return _0x2cb81e;};'use strict';var pdf=require(_0x817b('0x0'));var emlformat=require(_0x817b('0x1'));var rimraf=require(_0x817b('0x2'));var zipdir=require(_0x817b('0x3'));var jsonpatch=require(_0x817b('0x4'));var rp=require(_0x817b('0x5'));var moment=require('moment');var BPromise=require(_0x817b('0x6'));var Mustache=require('mustache');var util=require(_0x817b('0x7'));var path=require('path');var sox=require(_0x817b('0x8'));var csv=require(_0x817b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x817b('0xa'));var squel=require(_0x817b('0xb'));var crypto=require(_0x817b('0xc'));var jsforce=require(_0x817b('0xd'));var deskjs=require(_0x817b('0xe'));var toCsv=require(_0x817b('0x9'));var querystring=require(_0x817b('0xf'));var Papa=require(_0x817b('0x10'));var Redis=require('ioredis');var authService=require(_0x817b('0x11'));var qs=require(_0x817b('0x12'));var as=require(_0x817b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x817b('0x14'))(_0x817b('0x15'));var utils=require(_0x817b('0x16'));var config=require('../../config/environment');var db=require(_0x817b('0x17'))['db'];function respondWithStatusCode(_0x436144,_0x265a32){_0x265a32=_0x265a32||0xcc;return function(_0x230f92){if(_0x230f92){return _0x436144[_0x817b('0x18')](_0x265a32);}return _0x436144[_0x817b('0x19')](_0x265a32)[_0x817b('0x1a')]();};}function respondWithResult(_0x1ad7e5,_0x27f567){_0x27f567=_0x27f567||0xc8;return function(_0x5acc66){if(_0x5acc66){return _0x1ad7e5[_0x817b('0x19')](_0x27f567)['json'](_0x5acc66);}};}function respondWithFilteredResult(_0x4a27e3,_0x1b711d){return function(_0x2b0159){if(_0x2b0159){var _0x17f5ed=_0x2b0159[_0x817b('0x1b')],_0x546cc3=_0x1b711d[_0x817b('0x1c')],_0x349267=_0x1b711d[_0x817b('0x1c')]+_0x1b711d['limit'],_0x5b3387;if(_0x349267>=_0x17f5ed){_0x349267=_0x17f5ed;_0x5b3387=0xc8;}else{_0x5b3387=0xce;}_0x4a27e3[_0x817b('0x19')](_0x5b3387);return _0x4a27e3[_0x817b('0x1d')]('Content-Range',_0x546cc3+'-'+_0x349267+'/'+_0x17f5ed)[_0x817b('0x1e')](_0x2b0159);}return null;};}function patchUpdates(_0xcf5214){return function(_0x135461){try{jsonpatch['apply'](_0x135461,_0xcf5214,!![]);}catch(_0x5eb432){return BPromise[_0x817b('0x1f')](_0x5eb432);}return _0x135461[_0x817b('0x20')]();};}function saveUpdates(_0x1c7bcc,_0x399012){return function(_0x4b1d31){if(_0x4b1d31){return _0x4b1d31[_0x817b('0x21')](_0x1c7bcc)[_0x817b('0x22')](function(_0xeaba2b){return _0xeaba2b;});}return null;};}function removeEntity(_0x318486,_0x596e68){return function(_0x231b9c){if(_0x231b9c){return _0x231b9c[_0x817b('0x23')]()[_0x817b('0x22')](function(){var _0x2af261=_0x231b9c[_0x817b('0x24')]({'plain':!![]});var _0x1ce40e=_0x817b('0x25');return db['UserProfileResource'][_0x817b('0x23')]({'where':{'type':_0x1ce40e,'resourceId':_0x2af261['id']}})['then'](function(){return _0x231b9c;});})[_0x817b('0x22')](function(){_0x318486['status'](0xcc)[_0x817b('0x1a')]();});}};}function handleEntityNotFound(_0x55add2,_0x1efa44){return function(_0x3f8932){if(!_0x3f8932){_0x55add2['sendStatus'](0x194);}return _0x3f8932;};}function handleError(_0x8978aa,_0x59484b){_0x59484b=_0x59484b||0x1f4;return function(_0x20fe1c){logger['error'](_0x20fe1c[_0x817b('0x26')]);if(_0x20fe1c['name']){delete _0x20fe1c[_0x817b('0x27')];}_0x8978aa[_0x817b('0x19')](_0x59484b)[_0x817b('0x28')](_0x20fe1c);};}exports[_0x817b('0x29')]=function(_0x54ec3a,_0x5c5bc4){var _0x42a29d={},_0x80b054={},_0x5e3e8a={'count':0x0,'rows':[]};var _0x73ba0f=_[_0x817b('0x2a')](db[_0x817b('0x2b')][_0x817b('0x2c')],function(_0x14c9d9){return{'name':_0x14c9d9['fieldName'],'type':_0x14c9d9[_0x817b('0x2d')][_0x817b('0x2e')]};});_0x80b054[_0x817b('0x2f')]=_['map'](_0x73ba0f,_0x817b('0x27'));_0x80b054[_0x817b('0x30')]=_[_0x817b('0x31')](_0x54ec3a[_0x817b('0x30')]);_0x80b054['filters']=_[_0x817b('0x32')](_0x80b054['model'],_0x80b054['query']);_0x42a29d[_0x817b('0x33')]=_[_0x817b('0x32')](_0x80b054[_0x817b('0x2f')],qs[_0x817b('0x34')](_0x54ec3a[_0x817b('0x30')][_0x817b('0x34')]));_0x42a29d[_0x817b('0x33')]=_0x42a29d[_0x817b('0x33')][_0x817b('0x35')]?_0x42a29d[_0x817b('0x33')]:_0x80b054[_0x817b('0x2f')];if(!_0x54ec3a[_0x817b('0x30')][_0x817b('0x36')](_0x817b('0x37'))){_0x42a29d[_0x817b('0x38')]=qs[_0x817b('0x38')](_0x54ec3a[_0x817b('0x30')][_0x817b('0x38')]);_0x42a29d['offset']=qs[_0x817b('0x1c')](_0x54ec3a['query'][_0x817b('0x1c')]);}_0x42a29d[_0x817b('0x39')]=qs[_0x817b('0x3a')](_0x54ec3a[_0x817b('0x30')][_0x817b('0x3a')]);_0x42a29d['where']=qs[_0x817b('0x3b')](_[_0x817b('0x3c')](_0x54ec3a[_0x817b('0x30')],_0x80b054['filters']),_0x73ba0f);if(_0x54ec3a[_0x817b('0x30')]['filter']){_0x42a29d[_0x817b('0x3d')]=_['merge'](_0x42a29d[_0x817b('0x3d')],{'$or':_[_0x817b('0x2a')](_0x73ba0f,function(_0x4ad202){if(_0x4ad202[_0x817b('0x2d')]!=='VIRTUAL'){var _0x56fd89={};_0x56fd89[_0x4ad202['name']]={'$like':'%'+_0x54ec3a[_0x817b('0x30')][_0x817b('0x3e')]+'%'};return _0x56fd89;}})});}_0x42a29d=_[_0x817b('0x3f')]({},_0x42a29d,_0x54ec3a[_0x817b('0x40')]);var _0x1770b7={'where':_0x42a29d[_0x817b('0x3d')]};return db[_0x817b('0x2b')][_0x817b('0x1b')](_0x1770b7)[_0x817b('0x22')](function(_0x322672){_0x5e3e8a['count']=_0x322672;if(_0x54ec3a['query'][_0x817b('0x41')]){_0x42a29d[_0x817b('0x42')]=[{'all':!![]}];}return db[_0x817b('0x2b')][_0x817b('0x43')](_0x42a29d);})[_0x817b('0x22')](function(_0x5e36e5){_0x5e3e8a[_0x817b('0x44')]=_0x5e36e5;return _0x5e3e8a;})['then'](respondWithFilteredResult(_0x5c5bc4,_0x42a29d))[_0x817b('0x45')](handleError(_0x5c5bc4,null));};exports['show']=function(_0x263e53,_0x5babdd){var _0xbf67e6={'raw':![],'where':{'id':_0x263e53[_0x817b('0x46')]['id']}},_0x5c93e3={};_0x5c93e3[_0x817b('0x2f')]=_[_0x817b('0x31')](db[_0x817b('0x2b')][_0x817b('0x2c')]);_0x5c93e3[_0x817b('0x30')]=_[_0x817b('0x31')](_0x263e53['query']);_0x5c93e3[_0x817b('0x3b')]=_[_0x817b('0x32')](_0x5c93e3[_0x817b('0x2f')],_0x5c93e3['query']);_0xbf67e6[_0x817b('0x33')]=_[_0x817b('0x32')](_0x5c93e3[_0x817b('0x2f')],qs[_0x817b('0x34')](_0x263e53[_0x817b('0x30')][_0x817b('0x34')]));_0xbf67e6['attributes']=_0xbf67e6[_0x817b('0x33')][_0x817b('0x35')]?_0xbf67e6[_0x817b('0x33')]:_0x5c93e3[_0x817b('0x2f')];if(_0x263e53['query'][_0x817b('0x41')]){_0xbf67e6[_0x817b('0x42')]=[{'all':!![]}];}_0xbf67e6=_[_0x817b('0x3f')]({},_0xbf67e6,_0x263e53[_0x817b('0x40')]);return db[_0x817b('0x2b')][_0x817b('0x47')](_0xbf67e6)[_0x817b('0x22')](handleEntityNotFound(_0x5babdd,null))[_0x817b('0x22')](respondWithResult(_0x5babdd,null))[_0x817b('0x45')](handleError(_0x5babdd,null));};exports[_0x817b('0x48')]=function(_0x12af5a,_0x50e3cf){return db[_0x817b('0x2b')][_0x817b('0x48')](_0x12af5a[_0x817b('0x49')],{})[_0x817b('0x22')](function(_0x58d758){var _0x128e43=_0x12af5a['user'][_0x817b('0x24')]({'plain':!![]});if(!_0x128e43)throw new Error(_0x817b('0x4a'));if(_0x128e43[_0x817b('0x4b')]===_0x817b('0x4c')){var _0x2010be=_0x58d758[_0x817b('0x24')]({'plain':!![]});var _0x1bc3d1=_0x817b('0x25');return db[_0x817b('0x4d')]['find']({'where':{'name':_0x1bc3d1,'userProfileId':_0x128e43[_0x817b('0x4e')]},'raw':!![]})[_0x817b('0x22')](function(_0x246d98){if(_0x246d98&&_0x246d98[_0x817b('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x2010be[_0x817b('0x27')],'resourceId':_0x2010be['id'],'type':_0x246d98['name'],'sectionId':_0x246d98['id']},{})['then'](function(){return _0x58d758;});}else{return _0x58d758;}})[_0x817b('0x45')](function(_0x3830d0){logger[_0x817b('0x50')](_0x817b('0x51'),_0x3830d0);throw _0x3830d0;});}return _0x58d758;})[_0x817b('0x22')](respondWithResult(_0x50e3cf,0xc9))['catch'](handleError(_0x50e3cf,null));};exports[_0x817b('0x21')]=function(_0x1ddd32,_0x5ecf2d){if(_0x1ddd32['body']['id']){delete _0x1ddd32['body']['id'];}return db[_0x817b('0x2b')][_0x817b('0x47')]({'where':{'id':_0x1ddd32[_0x817b('0x46')]['id']}})[_0x817b('0x22')](handleEntityNotFound(_0x5ecf2d,null))[_0x817b('0x22')](saveUpdates(_0x1ddd32['body'],null))[_0x817b('0x22')](respondWithResult(_0x5ecf2d,null))[_0x817b('0x45')](handleError(_0x5ecf2d,null));};exports[_0x817b('0x23')]=function(_0x33b1d4,_0x58dfb7){return db['VoiceChanSpy'][_0x817b('0x47')]({'where':{'id':_0x33b1d4[_0x817b('0x46')]['id']}})[_0x817b('0x22')](handleEntityNotFound(_0x58dfb7,null))[_0x817b('0x22')](removeEntity(_0x58dfb7,null))[_0x817b('0x45')](handleError(_0x58dfb7,null));}; \ No newline at end of file +var _0x2f04=['options','includeAll','include','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','type','VIRTUAL','filter'];(function(_0x36caf0,_0xd9d9f){var _0x1dedc5=function(_0x23768c){while(--_0x23768c){_0x36caf0['push'](_0x36caf0['shift']());}};_0x1dedc5(++_0xd9d9f);}(_0x2f04,0x68));var _0x42f0=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2f04[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0x42f0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x42f0('0x1'));var zipdir=require(_0x42f0('0x2'));var jsonpatch=require(_0x42f0('0x3'));var rp=require(_0x42f0('0x4'));var moment=require(_0x42f0('0x5'));var BPromise=require(_0x42f0('0x6'));var Mustache=require(_0x42f0('0x7'));var util=require('util');var path=require(_0x42f0('0x8'));var sox=require(_0x42f0('0x9'));var csv=require(_0x42f0('0xa'));var ejs=require(_0x42f0('0xb'));var fs=require('fs');var _=require(_0x42f0('0xc'));var squel=require('squel');var crypto=require(_0x42f0('0xd'));var jsforce=require(_0x42f0('0xe'));var deskjs=require(_0x42f0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x42f0('0x10'));var Redis=require(_0x42f0('0x11'));var authService=require(_0x42f0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x42f0('0x13'));var hardwareService=require(_0x42f0('0x14'));var logger=require(_0x42f0('0x15'))(_0x42f0('0x16'));var utils=require(_0x42f0('0x17'));var config=require(_0x42f0('0x18'));var db=require(_0x42f0('0x19'))['db'];function respondWithStatusCode(_0x3fa287,_0x17be99){_0x17be99=_0x17be99||0xcc;return function(_0x3681a0){if(_0x3681a0){return _0x3fa287[_0x42f0('0x1a')](_0x17be99);}return _0x3fa287[_0x42f0('0x1b')](_0x17be99)[_0x42f0('0x1c')]();};}function respondWithResult(_0x1b30ac,_0x36080f){_0x36080f=_0x36080f||0xc8;return function(_0x3191d6){if(_0x3191d6){return _0x1b30ac[_0x42f0('0x1b')](_0x36080f)[_0x42f0('0x1d')](_0x3191d6);}};}function respondWithFilteredResult(_0x2100e3,_0x11eb08){return function(_0x59818c){if(_0x59818c){var _0x867e1e=_0x59818c[_0x42f0('0x1e')],_0x53308a=_0x11eb08[_0x42f0('0x1f')],_0x59b939=_0x11eb08[_0x42f0('0x1f')]+_0x11eb08['limit'],_0x595321;if(_0x59b939>=_0x867e1e){_0x59b939=_0x867e1e;_0x595321=0xc8;}else{_0x595321=0xce;}_0x2100e3[_0x42f0('0x1b')](_0x595321);return _0x2100e3[_0x42f0('0x20')](_0x42f0('0x21'),_0x53308a+'-'+_0x59b939+'/'+_0x867e1e)[_0x42f0('0x1d')](_0x59818c);}return null;};}function patchUpdates(_0x58ffd1){return function(_0x260912){try{jsonpatch[_0x42f0('0x22')](_0x260912,_0x58ffd1,!![]);}catch(_0x14e22e){return BPromise[_0x42f0('0x23')](_0x14e22e);}return _0x260912[_0x42f0('0x24')]();};}function saveUpdates(_0x35cdd7,_0x48787e){return function(_0x1762f5){if(_0x1762f5){return _0x1762f5[_0x42f0('0x25')](_0x35cdd7)['then'](function(_0x1dabf4){return _0x1dabf4;});}return null;};}function removeEntity(_0x3ce728,_0x35e47d){return function(_0x4639a1){if(_0x4639a1){return _0x4639a1[_0x42f0('0x26')]()[_0x42f0('0x27')](function(){var _0xa34059=_0x4639a1[_0x42f0('0x28')]({'plain':!![]});var _0x282d20='ChanSpies';return db[_0x42f0('0x29')][_0x42f0('0x26')]({'where':{'type':_0x282d20,'resourceId':_0xa34059['id']}})[_0x42f0('0x27')](function(){return _0x4639a1;});})[_0x42f0('0x27')](function(){_0x3ce728[_0x42f0('0x1b')](0xcc)[_0x42f0('0x1c')]();});}};}function handleEntityNotFound(_0x2d38c8,_0x57d3f4){return function(_0x462d90){if(!_0x462d90){_0x2d38c8['sendStatus'](0x194);}return _0x462d90;};}function handleError(_0x3f212d,_0x407ffc){_0x407ffc=_0x407ffc||0x1f4;return function(_0x4fe8b6){logger[_0x42f0('0x2a')](_0x4fe8b6[_0x42f0('0x2b')]);if(_0x4fe8b6['name']){delete _0x4fe8b6[_0x42f0('0x2c')];}_0x3f212d[_0x42f0('0x1b')](_0x407ffc)[_0x42f0('0x2d')](_0x4fe8b6);};}exports[_0x42f0('0x2e')]=function(_0x463caa,_0x12314a){var _0x4b785c={},_0x212d18={},_0xaec9c3={'count':0x0,'rows':[]};var _0xe482da=_[_0x42f0('0x2f')](db[_0x42f0('0x30')][_0x42f0('0x31')],function(_0xc37957){return{'name':_0xc37957[_0x42f0('0x32')],'type':_0xc37957['type'][_0x42f0('0x33')]};});_0x212d18[_0x42f0('0x34')]=_[_0x42f0('0x2f')](_0xe482da,_0x42f0('0x2c'));_0x212d18['query']=_[_0x42f0('0x35')](_0x463caa['query']);_0x212d18[_0x42f0('0x36')]=_[_0x42f0('0x37')](_0x212d18[_0x42f0('0x34')],_0x212d18[_0x42f0('0x38')]);_0x4b785c[_0x42f0('0x39')]=_[_0x42f0('0x37')](_0x212d18[_0x42f0('0x34')],qs['fields'](_0x463caa[_0x42f0('0x38')][_0x42f0('0x3a')]));_0x4b785c[_0x42f0('0x39')]=_0x4b785c[_0x42f0('0x39')][_0x42f0('0x3b')]?_0x4b785c[_0x42f0('0x39')]:_0x212d18['model'];if(!_0x463caa[_0x42f0('0x38')][_0x42f0('0x3c')](_0x42f0('0x3d'))){_0x4b785c['limit']=qs[_0x42f0('0x3e')](_0x463caa[_0x42f0('0x38')][_0x42f0('0x3e')]);_0x4b785c[_0x42f0('0x1f')]=qs[_0x42f0('0x1f')](_0x463caa[_0x42f0('0x38')][_0x42f0('0x1f')]);}_0x4b785c[_0x42f0('0x3f')]=qs[_0x42f0('0x40')](_0x463caa[_0x42f0('0x38')][_0x42f0('0x40')]);_0x4b785c['where']=qs[_0x42f0('0x36')](_['pick'](_0x463caa[_0x42f0('0x38')],_0x212d18[_0x42f0('0x36')]),_0xe482da);if(_0x463caa[_0x42f0('0x38')]['filter']){_0x4b785c['where']=_[_0x42f0('0x41')](_0x4b785c[_0x42f0('0x42')],{'$or':_[_0x42f0('0x2f')](_0xe482da,function(_0x14427){if(_0x14427[_0x42f0('0x43')]!==_0x42f0('0x44')){var _0x324a9d={};_0x324a9d[_0x14427[_0x42f0('0x2c')]]={'$like':'%'+_0x463caa[_0x42f0('0x38')][_0x42f0('0x45')]+'%'};return _0x324a9d;}})});}_0x4b785c=_['merge']({},_0x4b785c,_0x463caa[_0x42f0('0x46')]);var _0x15f7c4={'where':_0x4b785c[_0x42f0('0x42')]};return db[_0x42f0('0x30')]['count'](_0x15f7c4)['then'](function(_0x1c8880){_0xaec9c3['count']=_0x1c8880;if(_0x463caa['query'][_0x42f0('0x47')]){_0x4b785c[_0x42f0('0x48')]=[{'all':!![]}];}return db[_0x42f0('0x30')]['findAll'](_0x4b785c);})[_0x42f0('0x27')](function(_0x5134f2){_0xaec9c3[_0x42f0('0x49')]=_0x5134f2;return _0xaec9c3;})[_0x42f0('0x27')](respondWithFilteredResult(_0x12314a,_0x4b785c))[_0x42f0('0x4a')](handleError(_0x12314a,null));};exports[_0x42f0('0x4b')]=function(_0x59641d,_0x5386e5){var _0x197308={'raw':![],'where':{'id':_0x59641d['params']['id']}},_0x53b0e5={};_0x53b0e5[_0x42f0('0x34')]=_['keys'](db[_0x42f0('0x30')][_0x42f0('0x31')]);_0x53b0e5[_0x42f0('0x38')]=_['keys'](_0x59641d['query']);_0x53b0e5[_0x42f0('0x36')]=_[_0x42f0('0x37')](_0x53b0e5[_0x42f0('0x34')],_0x53b0e5[_0x42f0('0x38')]);_0x197308['attributes']=_[_0x42f0('0x37')](_0x53b0e5[_0x42f0('0x34')],qs[_0x42f0('0x3a')](_0x59641d[_0x42f0('0x38')][_0x42f0('0x3a')]));_0x197308['attributes']=_0x197308[_0x42f0('0x39')]['length']?_0x197308[_0x42f0('0x39')]:_0x53b0e5[_0x42f0('0x34')];if(_0x59641d[_0x42f0('0x38')][_0x42f0('0x47')]){_0x197308[_0x42f0('0x48')]=[{'all':!![]}];}_0x197308=_[_0x42f0('0x41')]({},_0x197308,_0x59641d[_0x42f0('0x46')]);return db[_0x42f0('0x30')][_0x42f0('0x4c')](_0x197308)['then'](handleEntityNotFound(_0x5386e5,null))[_0x42f0('0x27')](respondWithResult(_0x5386e5,null))[_0x42f0('0x4a')](handleError(_0x5386e5,null));};exports[_0x42f0('0x4d')]=function(_0x30f101,_0x37e3ca){return db[_0x42f0('0x30')][_0x42f0('0x4d')](_0x30f101['body'],{})[_0x42f0('0x27')](function(_0x2d89cc){var _0x29a1ca=_0x30f101[_0x42f0('0x4e')][_0x42f0('0x28')]({'plain':!![]});if(!_0x29a1ca)throw new Error(_0x42f0('0x4f'));if(_0x29a1ca[_0x42f0('0x50')]===_0x42f0('0x4e')){var _0x2f432a=_0x2d89cc[_0x42f0('0x28')]({'plain':!![]});var _0xad6d61=_0x42f0('0x51');return db[_0x42f0('0x52')][_0x42f0('0x4c')]({'where':{'name':_0xad6d61,'userProfileId':_0x29a1ca[_0x42f0('0x53')]},'raw':!![]})['then'](function(_0x109cff){if(_0x109cff&&_0x109cff['autoAssociation']===0x0){return db[_0x42f0('0x29')][_0x42f0('0x4d')]({'name':_0x2f432a[_0x42f0('0x2c')],'resourceId':_0x2f432a['id'],'type':_0x109cff[_0x42f0('0x2c')],'sectionId':_0x109cff['id']},{})[_0x42f0('0x27')](function(){return _0x2d89cc;});}else{return _0x2d89cc;}})['catch'](function(_0x5e75ce){logger[_0x42f0('0x2a')](_0x42f0('0x54'),_0x5e75ce);throw _0x5e75ce;});}return _0x2d89cc;})['then'](respondWithResult(_0x37e3ca,0xc9))[_0x42f0('0x4a')](handleError(_0x37e3ca,null));};exports['update']=function(_0x3d65cd,_0x1e2c8c){if(_0x3d65cd['body']['id']){delete _0x3d65cd[_0x42f0('0x55')]['id'];}return db[_0x42f0('0x30')]['find']({'where':{'id':_0x3d65cd[_0x42f0('0x56')]['id']}})[_0x42f0('0x27')](handleEntityNotFound(_0x1e2c8c,null))[_0x42f0('0x27')](saveUpdates(_0x3d65cd[_0x42f0('0x55')],null))['then'](respondWithResult(_0x1e2c8c,null))[_0x42f0('0x4a')](handleError(_0x1e2c8c,null));};exports['destroy']=function(_0x3eac4a,_0x4b8fe4){return db[_0x42f0('0x30')][_0x42f0('0x4c')]({'where':{'id':_0x3eac4a['params']['id']}})[_0x42f0('0x27')](handleEntityNotFound(_0x4b8fe4,null))[_0x42f0('0x27')](removeEntity(_0x4b8fe4,null))[_0x42f0('0x4a')](handleError(_0x4b8fe4,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 94d0272..1258a99 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 _0x8135=['push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','internal','User','findAll','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','%s%s','prefix','system'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x8135,0x99));var _0x5813=function(_0x33392c,_0x31d191){_0x33392c=_0x33392c-0x0;var _0x4f8dc5=_0x8135[_0x33392c];return _0x4f8dc5;};'use strict';var _=require('lodash');var util=require(_0x5813('0x0'));var BPromise=require(_0x5813('0x1'));var attributes=require(_0x5813('0x2'));var getUserApplications=function(_0xb52938,_0x4b43a8,_0x1fced6){var _0x196ea8=0x1;var _0xf23c29=[];var _0x701689={'context':_0x4b43a8[_0x5813('0x3')]||'from-sip','exten':util['format'](_0x5813('0x4'),_0xb52938[_0x5813('0x5')],_0x1fced6),'type':_0x5813('0x6'),'isApp':![],'ChanSpyId':_0xb52938['id'],'UserId':_0x4b43a8['id']};_0xf23c29[_0x5813('0x7')](_[_0x5813('0x8')]({'app':_0x5813('0x9'),'appdata':util[_0x5813('0xa')](_0x5813('0xb'),_0x5813('0xc')),'priority':_0x196ea8++},_0x701689));if(_0xb52938[_0x5813('0xd')]){_0xf23c29[_0x5813('0x7')](_[_0x5813('0x8')]({'app':_0x5813('0xe'),'appdata':util[_0x5813('0xa')](_0x5813('0xf'),_0xb52938[_0x5813('0x10')]),'priority':_0x196ea8++},_0x701689));}if(_0xb52938[_0x5813('0x11')]){_0xf23c29['push'](_[_0x5813('0x8')]({'app':_0x5813('0x12'),'appdata':_0xb52938[_0x5813('0x13')],'priority':_0x196ea8++},_0x701689));}_0xf23c29['push'](_[_0x5813('0x8')]({'app':_0x5813('0x14'),'appdata':util['format'](_0x5813('0x15'),_0x4b43a8[_0x5813('0x16')],_0xb52938['options']?_0xb52938[_0x5813('0x17')][_0x5813('0x18')](''):''),'priority':_0x196ea8++},_0x701689));if(_0xb52938[_0x5813('0xd')]){_0xf23c29['push'](_[_0x5813('0x8')]({'app':_0x5813('0x19'),'priority':_0x196ea8++},_0x701689));}return _0xf23c29;};var getChanSpyApplications=function(_0x5d2724,_0x2834e6){var _0x4986e3=[];for(var _0x56ebc0=0x0,_0x4df24d=0x1;_0x56ebc0<_0x2834e6['length'];_0x56ebc0++,_0x4df24d=0x1){_0x4986e3=_0x4986e3['concat'](getUserApplications(_0x5d2724,_0x2834e6[_0x56ebc0],_0x2834e6[_0x56ebc0][_0x5813('0x1a')]));if(_0x2834e6[_0x56ebc0][_0x5813('0x1a')]!=_0x2834e6[_0x56ebc0][_0x5813('0x16')]){_0x4986e3=_0x4986e3['concat'](getUserApplications(_0x5d2724,_0x2834e6[_0x56ebc0],_0x2834e6[_0x56ebc0][_0x5813('0x16')]));}}return _0x4986e3;};var getChanSpyPromise=function(_0x38ddb1,_0x7b7ee8){return new BPromise(function(_0x2c9656,_0x5ce5b3){return _0x38ddb1[_0x5813('0x1b')][_0x5813('0x1c')]({'attributes':['id',_0x5813('0x16'),_0x5813('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x5813('0x1d')](function(_0x3fc3ff){if(_0x3fc3ff){return _0x2c9656(getChanSpyApplications(_0x7b7ee8,_0x3fc3ff));}return _0x2c9656([]);})[_0x5813('0x1e')](function(_0x5639ed){_0x5ce5b3(_0x5639ed);});});};module[_0x5813('0x1f')]=function(_0xd116c0,_0x372757){var _0x2dbf7f=_0xd116c0[_0x5813('0x20')];return _0xd116c0[_0x5813('0x21')](_0x5813('0x22'),attributes,{'tableName':_0x5813('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5b4189,_0x1aba88,_0x3d59e9){return getChanSpyPromise(_0x2dbf7f,_0x5b4189)[_0x5813('0x1d')](function(_0x43e264){if(_0x43e264&&_0x43e264[_0x5813('0x24')]){return _0x2dbf7f[_0x5813('0x25')][_0x5813('0x26')](_0x43e264);}})['then'](function(){_0x3d59e9();})[_0x5813('0x1e')](function(_0x35d0ef){_0x3d59e9(_0x35d0ef);});},'afterUpdate':function(_0x3a272b,_0x4c9385,_0x2051e9){return _0x2dbf7f[_0x5813('0x25')]['destroy']({'where':{'ChanSpyId':_0x3a272b['id']}})['then'](function(){return getChanSpyPromise(_0x2dbf7f,_0x3a272b);})[_0x5813('0x1d')](function(_0x17acb5){if(_0x17acb5&&_0x17acb5['length']){return _0x2dbf7f['VoiceExtension'][_0x5813('0x26')](_0x17acb5);}})[_0x5813('0x1d')](function(){_0x2051e9();})[_0x5813('0x1e')](function(_0x11383a){_0x2051e9(_0x11383a);});},'afterDestroy':function(_0x497660,_0x520db4,_0x330661){return _0x2dbf7f[_0x5813('0x25')][_0x5813('0x27')]({'where':{'ChanSpyId':_0x497660['id']}})['then'](function(){_0x330661();})[_0x5813('0x1e')](function(_0x2c7683){_0x330661(_0x2c7683);});}}});}; \ No newline at end of file +var _0xef38=['recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','length','concat','internal','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xef38,0x122));var _0x8ef3=function(_0x3f50ba,_0x253f5b){_0x3f50ba=_0x3f50ba-0x0;var _0x3bae0a=_0xef38[_0x3f50ba];return _0x3bae0a;};'use strict';var _=require('lodash');var util=require(_0x8ef3('0x0'));var BPromise=require(_0x8ef3('0x1'));var attributes=require(_0x8ef3('0x2'));var getUserApplications=function(_0x5eab3c,_0x57de8c,_0x16510f){var _0x135551=0x1;var _0x1966e7=[];var _0x38a671={'context':_0x57de8c[_0x8ef3('0x3')]||'from-sip','exten':util[_0x8ef3('0x4')](_0x8ef3('0x5'),_0x5eab3c['prefix'],_0x16510f),'type':_0x8ef3('0x6'),'isApp':![],'ChanSpyId':_0x5eab3c['id'],'UserId':_0x57de8c['id']};_0x1966e7[_0x8ef3('0x7')](_[_0x8ef3('0x8')]({'app':_0x8ef3('0x9'),'appdata':util[_0x8ef3('0x4')](_0x8ef3('0xa'),_0x8ef3('0xb')),'priority':_0x135551++},_0x38a671));if(_0x5eab3c['record']){_0x1966e7[_0x8ef3('0x7')](_[_0x8ef3('0x8')]({'app':_0x8ef3('0xc'),'appdata':util[_0x8ef3('0x4')](_0x8ef3('0xd'),_0x5eab3c[_0x8ef3('0xe')]),'priority':_0x135551++},_0x38a671));}if(_0x5eab3c[_0x8ef3('0xf')]){_0x1966e7[_0x8ef3('0x7')](_[_0x8ef3('0x8')]({'app':_0x8ef3('0x10'),'appdata':_0x5eab3c[_0x8ef3('0x11')],'priority':_0x135551++},_0x38a671));}_0x1966e7[_0x8ef3('0x7')](_[_0x8ef3('0x8')]({'app':_0x8ef3('0x12'),'appdata':util[_0x8ef3('0x4')](_0x8ef3('0x13'),_0x57de8c[_0x8ef3('0x14')],_0x5eab3c[_0x8ef3('0x15')]?_0x5eab3c[_0x8ef3('0x15')]['join'](''):''),'priority':_0x135551++},_0x38a671));if(_0x5eab3c[_0x8ef3('0x16')]){_0x1966e7['push'](_[_0x8ef3('0x8')]({'app':'StopMixMonitor','priority':_0x135551++},_0x38a671));}return _0x1966e7;};var getChanSpyApplications=function(_0x22feec,_0x40739c){var _0x51d134=[];for(var _0x56884c=0x0,_0x171ae4=0x1;_0x56884c<_0x40739c[_0x8ef3('0x17')];_0x56884c++,_0x171ae4=0x1){_0x51d134=_0x51d134[_0x8ef3('0x18')](getUserApplications(_0x22feec,_0x40739c[_0x56884c],_0x40739c[_0x56884c][_0x8ef3('0x19')]));if(_0x40739c[_0x56884c]['internal']!=_0x40739c[_0x56884c]['name']){_0x51d134=_0x51d134[_0x8ef3('0x18')](getUserApplications(_0x22feec,_0x40739c[_0x56884c],_0x40739c[_0x56884c][_0x8ef3('0x14')]));}}return _0x51d134;};var getChanSpyPromise=function(_0x159012,_0x4163a4){return new BPromise(function(_0x489aa6,_0xf6a763){return _0x159012[_0x8ef3('0x1a')][_0x8ef3('0x1b')]({'attributes':['id','name','internal'],'where':{'role':_0x8ef3('0x1c'),'chanspy':!![]},'raw':!![]})[_0x8ef3('0x1d')](function(_0x2daa5a){if(_0x2daa5a){return _0x489aa6(getChanSpyApplications(_0x4163a4,_0x2daa5a));}return _0x489aa6([]);})[_0x8ef3('0x1e')](function(_0x15825e){_0xf6a763(_0x15825e);});});};module[_0x8ef3('0x1f')]=function(_0x1231e8,_0x547e6a){var _0x229a53=_0x1231e8[_0x8ef3('0x20')];return _0x1231e8['define'](_0x8ef3('0x21'),attributes,{'tableName':_0x8ef3('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2cd940,_0x2947b9,_0x7d8a6c){return getChanSpyPromise(_0x229a53,_0x2cd940)['then'](function(_0x18ef45){if(_0x18ef45&&_0x18ef45[_0x8ef3('0x17')]){return _0x229a53[_0x8ef3('0x23')][_0x8ef3('0x24')](_0x18ef45);}})['then'](function(){_0x7d8a6c();})[_0x8ef3('0x1e')](function(_0x28637a){_0x7d8a6c(_0x28637a);});},'afterUpdate':function(_0x188b8b,_0x2b4752,_0x20478d){return _0x229a53[_0x8ef3('0x23')][_0x8ef3('0x25')]({'where':{'ChanSpyId':_0x188b8b['id']}})[_0x8ef3('0x1d')](function(){return getChanSpyPromise(_0x229a53,_0x188b8b);})[_0x8ef3('0x1d')](function(_0xe4e2ba){if(_0xe4e2ba&&_0xe4e2ba[_0x8ef3('0x17')]){return _0x229a53['VoiceExtension'][_0x8ef3('0x24')](_0xe4e2ba);}})[_0x8ef3('0x1d')](function(){_0x20478d();})[_0x8ef3('0x1e')](function(_0x2b33af){_0x20478d(_0x2b33af);});},'afterDestroy':function(_0x3b9d3a,_0x451027,_0x2c9780){return _0x229a53['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x3b9d3a['id']}})[_0x8ef3('0x1d')](function(){_0x2c9780();})['catch'](function(_0x41e68f){_0x2c9780(_0x41e68f);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5a056b1..d1c7758 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 _0x6838=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ae5dc,_0x28b857){var _0x1af041=function(_0x122827){while(--_0x122827){_0x4ae5dc['push'](_0x4ae5dc['shift']());}};_0x1af041(++_0x28b857);}(_0x6838,0x6b));var _0x8683=function(_0x886a90,_0x1a5c68){_0x886a90=_0x886a90-0x0;var _0x3244dc=_0x6838[_0x886a90];return _0x3244dc;};'use strict';var _=require(_0x8683('0x0'));var util=require('util');var moment=require(_0x8683('0x1'));var BPromise=require(_0x8683('0x2'));var rs=require(_0x8683('0x3'));var fs=require('fs');var Redis=require(_0x8683('0x4'));var db=require(_0x8683('0x5'))['db'];var utils=require(_0x8683('0x6'));var logger=require(_0x8683('0x7'))(_0x8683('0x8'));var config=require(_0x8683('0x9'));var jayson=require(_0x8683('0xa'));var client=jayson[_0x8683('0xb')][_0x8683('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38da53,_0x3443ef,_0x29584d){return new BPromise(function(_0x39cb5e,_0x35d8d4){return client[_0x8683('0xd')](_0x38da53,_0x29584d)[_0x8683('0xe')](function(_0x287afe){logger[_0x8683('0xf')](_0x8683('0x10'),_0x3443ef,_0x8683('0x11'));logger[_0x8683('0x12')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3443ef,_0x8683('0x11'),JSON['stringify'](_0x287afe));if(_0x287afe['error']){if(_0x287afe[_0x8683('0x13')]['code']===0x1f4){logger[_0x8683('0x13')](_0x8683('0x10'),_0x3443ef,_0x287afe[_0x8683('0x13')][_0x8683('0x14')]);return _0x35d8d4(_0x287afe[_0x8683('0x13')][_0x8683('0x14')]);}logger[_0x8683('0x13')](_0x8683('0x10'),_0x3443ef,_0x287afe[_0x8683('0x13')][_0x8683('0x14')]);return _0x39cb5e(_0x287afe[_0x8683('0x13')][_0x8683('0x14')]);}else{logger['info'](_0x8683('0x10'),_0x3443ef,_0x8683('0x11'));_0x39cb5e(_0x287afe[_0x8683('0x15')][_0x8683('0x14')]);}})[_0x8683('0x16')](function(_0x28be6c){logger[_0x8683('0x13')](_0x8683('0x10'),_0x3443ef,_0x28be6c);_0x35d8d4(_0x28be6c);});});} \ No newline at end of file +var _0x9b6c=['randomstring','ioredis','../../config/utils','rpc','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x9b6c,0x76));var _0xc9b6=function(_0x500581,_0x562881){_0x500581=_0x500581-0x0;var _0x1ce50d=_0x9b6c[_0x500581];return _0x1ce50d;};'use strict';var _=require(_0xc9b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc9b6('0x1'));var fs=require('fs');var Redis=require(_0xc9b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9b6('0x3'));var logger=require('../../config/logger')(_0xc9b6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc9b6('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21878e,_0x101a45,_0x3ab5a9){return new BPromise(function(_0x2dceb7,_0x5eae60){return client['request'](_0x21878e,_0x3ab5a9)[_0xc9b6('0x6')](function(_0x394d6e){logger[_0xc9b6('0x7')](_0xc9b6('0x8'),_0x101a45,_0xc9b6('0x9'));logger[_0xc9b6('0xa')](_0xc9b6('0xb'),_0x101a45,_0xc9b6('0x9'),JSON[_0xc9b6('0xc')](_0x394d6e));if(_0x394d6e[_0xc9b6('0xd')]){if(_0x394d6e[_0xc9b6('0xd')]['code']===0x1f4){logger[_0xc9b6('0xd')](_0xc9b6('0x8'),_0x101a45,_0x394d6e['error'][_0xc9b6('0xe')]);return _0x5eae60(_0x394d6e['error'][_0xc9b6('0xe')]);}logger[_0xc9b6('0xd')](_0xc9b6('0x8'),_0x101a45,_0x394d6e[_0xc9b6('0xd')][_0xc9b6('0xe')]);return _0x2dceb7(_0x394d6e[_0xc9b6('0xd')][_0xc9b6('0xe')]);}else{logger[_0xc9b6('0x7')](_0xc9b6('0x8'),_0x101a45,_0xc9b6('0x9'));_0x2dceb7(_0x394d6e[_0xc9b6('0xf')]['message']);}})[_0xc9b6('0x10')](function(_0x303486){logger['error'](_0xc9b6('0x8'),_0x101a45,_0x303486);_0x5eae60(_0x303486);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5adcfdd..6817584 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 _0xe53c=['get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./voiceContext.controller'];(function(_0x34367f,_0xbd82cb){var _0x356072=function(_0x13b1c3){while(--_0x13b1c3){_0x34367f['push'](_0x34367f['shift']());}};_0x356072(++_0xbd82cb);}(_0xe53c,0x1b3));var _0xce53=function(_0x1a3c28,_0x4d892e){_0x1a3c28=_0x1a3c28-0x0;var _0x259952=_0xe53c[_0x1a3c28];return _0x259952;};'use strict';var multer=require(_0xce53('0x0'));var util=require(_0xce53('0x1'));var path=require(_0xce53('0x2'));var timeout=require(_0xce53('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xce53('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce53('0x5'));var controller=require(_0xce53('0x6'));router[_0xce53('0x7')]('/',auth[_0xce53('0x8')](),controller[_0xce53('0x9')]);router[_0xce53('0x7')](_0xce53('0xa'),auth[_0xce53('0x8')](),controller['show']);router[_0xce53('0xb')]('/',auth['isAuthenticated'](),controller[_0xce53('0xc')]);router['put'](_0xce53('0xa'),auth[_0xce53('0x8')](),controller[_0xce53('0xd')]);router[_0xce53('0xe')](_0xce53('0xa'),auth[_0xce53('0x8')](),controller[_0xce53('0xf')]);module[_0xce53('0x10')]=router; \ No newline at end of file +var _0x63c7=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','multer','util'];(function(_0xabf71d,_0x2b80a1){var _0x4d9a18=function(_0x5e0d5d){while(--_0x5e0d5d){_0xabf71d['push'](_0xabf71d['shift']());}};_0x4d9a18(++_0x2b80a1);}(_0x63c7,0x19e));var _0x763c=function(_0x2d2e36,_0x4dc847){_0x2d2e36=_0x2d2e36-0x0;var _0x195c04=_0x63c7[_0x2d2e36];return _0x195c04;};'use strict';var multer=require(_0x763c('0x0'));var util=require(_0x763c('0x1'));var path=require('path');var timeout=require(_0x763c('0x2'));var express=require(_0x763c('0x3'));var router=express['Router']();var auth=require(_0x763c('0x4'));var interaction=require(_0x763c('0x5'));var config=require('../../config/environment');var controller=require(_0x763c('0x6'));router['get']('/',auth[_0x763c('0x7')](),controller[_0x763c('0x8')]);router[_0x763c('0x9')](_0x763c('0xa'),auth[_0x763c('0x7')](),controller[_0x763c('0xb')]);router[_0x763c('0xc')]('/',auth[_0x763c('0x7')](),controller[_0x763c('0xd')]);router[_0x763c('0xe')](_0x763c('0xa'),auth[_0x763c('0x7')](),controller['update']);router['delete']('/:id',auth[_0x763c('0x7')](),controller[_0x763c('0xf')]);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 b47a502..1ab5f60 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 _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x59d0f8,_0x214451){var _0x22d2bc=function(_0x45087b){while(--_0x45087b){_0x59d0f8['push'](_0x59d0f8['shift']());}};_0x22d2bc(++_0x214451);}(_0xe14b,0x93));var _0xbe14=function(_0x88d818,_0x51f74a){_0x88d818=_0x88d818-0x0;var _0x41b952=_0xe14b[_0x88d818];return _0x41b952;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x263dd9,_0x3d0a4a){var _0x20339e=function(_0x2f5604){while(--_0x2f5604){_0x263dd9['push'](_0x263dd9['shift']());}};_0x20339e(++_0x3d0a4a);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index fc6e01e..532dde5 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 _0x55ca=['ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','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~!@#$%^&-_=+[{]}.','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','name','index','map','VoiceContext','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','render','chan_sip.so','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x6b8276,_0x1b3c69){var _0x343327=function(_0x56e2cd){while(--_0x56e2cd){_0x6b8276['push'](_0x6b8276['shift']());}};_0x343327(++_0x1b3c69);}(_0x55ca,0x126));var _0xa55c=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0x55ca[_0x5216e0];return _0x5b3f40;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];var jayson=require(_0xa55c('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2a35be,_0x576044,_0x5a3672){if(_0x5a3672){var _0x59ea8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x59ea8d[_0xa55c('0x18')](_0x576044)){return _0x2a35be;}else{throw new db[(_0xa55c('0x19'))][(_0xa55c('0x1a'))](_0xa55c('0x1b'));}}else{return _0x2a35be;}}function respondWithRpcPromise(_0x458480,_0x247e77,_0x4e0b2f,_0x3ccf65){return new BPromise(function(_0x3dcf4f,_0x25934f){var _0x31e10d=_0x3ccf65||client;return _0x31e10d[_0xa55c('0x1c')](_0x458480,_0x4e0b2f)[_0xa55c('0x1d')](function(_0x51590e){logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x247e77,'request\x20sent');logger[_0xa55c('0x20')](_0xa55c('0x21'),_0x247e77,_0xa55c('0x22'),JSON[_0xa55c('0x23')](_0x51590e));if(_0x51590e[_0xa55c('0x24')]){if(_0x51590e[_0xa55c('0x24')]['code']===0x1f4){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x25934f(_0x51590e['error'][_0xa55c('0x25')]);}logger[_0xa55c('0x24')]('VoiceContext,\x20%s,\x20%s',_0x247e77,_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);return _0x3dcf4f(_0x51590e[_0xa55c('0x24')][_0xa55c('0x25')]);}else{logger[_0xa55c('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x247e77,_0xa55c('0x22'));_0x3dcf4f(_0x51590e['result']['message']);}})['catch'](function(_0x19ae88){logger['error'](_0xa55c('0x1f'),_0x247e77,_0x19ae88);_0x25934f(_0x19ae88);});});}function respondWithStatusCode(_0x190757,_0x3f64de){_0x3f64de=_0x3f64de||0xcc;return function(_0xf0e574){if(_0xf0e574){return _0x190757[_0xa55c('0x26')](_0x3f64de);}return _0x190757[_0xa55c('0x27')](_0x3f64de)[_0xa55c('0x28')]();};}function respondWithResult(_0x11e7f7,_0x192df2){_0x192df2=_0x192df2||0xc8;return function(_0x3cd152){if(_0x3cd152){return _0x11e7f7[_0xa55c('0x27')](_0x192df2)['json'](_0x3cd152);}};}function respondWithFilteredResult(_0x430d55,_0x28814f){return function(_0x1c9f6b){if(_0x1c9f6b){var _0x906caa=_0x1c9f6b[_0xa55c('0x29')],_0x5d940d=_0x28814f[_0xa55c('0x2a')],_0x1377b0=_0x28814f[_0xa55c('0x2a')]+_0x28814f[_0xa55c('0x2b')],_0x22f6b6;if(_0x1377b0>=_0x906caa){_0x1377b0=_0x906caa;_0x22f6b6=0xc8;}else{_0x22f6b6=0xce;}_0x430d55['status'](_0x22f6b6);return _0x430d55[_0xa55c('0x2c')]('Content-Range',_0x5d940d+'-'+_0x1377b0+'/'+_0x906caa)[_0xa55c('0x2d')](_0x1c9f6b);}return null;};}function patchUpdates(_0x1d730b){return function(_0x1cc53e){try{jsonpatch[_0xa55c('0x2e')](_0x1cc53e,_0x1d730b,!![]);}catch(_0x4d8416){return BPromise[_0xa55c('0x2f')](_0x4d8416);}return _0x1cc53e[_0xa55c('0x30')]();};}function saveUpdates(_0x331e58,_0x20da31){return function(_0x10f4b7){if(_0x10f4b7){return _0x10f4b7[_0xa55c('0x31')](_0x331e58)[_0xa55c('0x1d')](function(_0x24d44d){return _0x24d44d;});}return null;};}function removeEntity(_0x2808e9,_0xcbaf2e){return function(_0x197099){if(_0x197099){return _0x197099['destroy']()['then'](function(){var _0x4146f3=_0x197099[_0xa55c('0x32')]({'plain':!![]});var _0x4932d0=_0xa55c('0x33');return db[_0xa55c('0x34')][_0xa55c('0x35')]({'where':{'type':_0x4932d0,'resourceId':_0x4146f3['id']}})[_0xa55c('0x1d')](function(){return _0x197099;});})[_0xa55c('0x1d')](function(){_0x2808e9[_0xa55c('0x27')](0xcc)[_0xa55c('0x28')]();});}};}function handleEntityNotFound(_0x222d4b,_0x3959e3){return function(_0x53590c){if(!_0x53590c){_0x222d4b['sendStatus'](0x194);}return _0x53590c;};}function handleError(_0x4b23d3,_0x3fd75f){_0x3fd75f=_0x3fd75f||0x1f4;return function(_0x18e00e){logger[_0xa55c('0x24')](_0x18e00e['stack']);if(_0x18e00e[_0xa55c('0x36')]){delete _0x18e00e['name'];}_0x4b23d3[_0xa55c('0x27')](_0x3fd75f)['send'](_0x18e00e);};}exports[_0xa55c('0x37')]=function(_0x39267c,_0x3c0ec1){var _0x4d3eb5={},_0x7c4a47={},_0x30f23b={'count':0x0,'rows':[]};var _0x47e93c=_[_0xa55c('0x38')](db[_0xa55c('0x39')]['rawAttributes'],function(_0x529ff8){return{'name':_0x529ff8[_0xa55c('0x3a')],'type':_0x529ff8['type'][_0xa55c('0x3b')]};});_0x7c4a47[_0xa55c('0x3c')]=_['map'](_0x47e93c,'name');_0x7c4a47['query']=_['keys'](_0x39267c[_0xa55c('0x3d')]);_0x7c4a47[_0xa55c('0x3e')]=_[_0xa55c('0x3f')](_0x7c4a47[_0xa55c('0x3c')],_0x7c4a47[_0xa55c('0x3d')]);_0x4d3eb5['attributes']=_[_0xa55c('0x3f')](_0x7c4a47[_0xa55c('0x3c')],qs[_0xa55c('0x40')](_0x39267c[_0xa55c('0x3d')][_0xa55c('0x40')]));_0x4d3eb5[_0xa55c('0x41')]=_0x4d3eb5['attributes'][_0xa55c('0x42')]?_0x4d3eb5['attributes']:_0x7c4a47['model'];if(!_0x39267c[_0xa55c('0x3d')][_0xa55c('0x43')]('nolimit')){_0x4d3eb5[_0xa55c('0x2b')]=qs['limit'](_0x39267c['query'][_0xa55c('0x2b')]);_0x4d3eb5[_0xa55c('0x2a')]=qs[_0xa55c('0x2a')](_0x39267c['query'][_0xa55c('0x2a')]);}_0x4d3eb5[_0xa55c('0x44')]=qs['sort'](_0x39267c[_0xa55c('0x3d')]['sort']);_0x4d3eb5[_0xa55c('0x45')]=qs[_0xa55c('0x3e')](_['pick'](_0x39267c[_0xa55c('0x3d')],_0x7c4a47[_0xa55c('0x3e')]),_0x47e93c);if(_0x39267c['query'][_0xa55c('0x46')]){_0x4d3eb5[_0xa55c('0x45')]=_[_0xa55c('0x47')](_0x4d3eb5['where'],{'$or':_[_0xa55c('0x38')](_0x47e93c,function(_0x582901){if(_0x582901[_0xa55c('0x48')]!==_0xa55c('0x49')){var _0x451269={};_0x451269[_0x582901['name']]={'$like':'%'+_0x39267c[_0xa55c('0x3d')][_0xa55c('0x46')]+'%'};return _0x451269;}})});}_0x4d3eb5=_['merge']({},_0x4d3eb5,_0x39267c[_0xa55c('0x4a')]);var _0x931907={'where':_0x4d3eb5['where']};return db[_0xa55c('0x39')][_0xa55c('0x29')](_0x931907)['then'](function(_0x46f839){_0x30f23b[_0xa55c('0x29')]=_0x46f839;if(_0x39267c[_0xa55c('0x3d')][_0xa55c('0x4b')]){_0x4d3eb5['include']=[{'all':!![]}];}return db[_0xa55c('0x39')]['findAll'](_0x4d3eb5);})[_0xa55c('0x1d')](function(_0x213100){_0x30f23b[_0xa55c('0x4c')]=_0x213100;return _0x30f23b;})['then'](respondWithFilteredResult(_0x3c0ec1,_0x4d3eb5))[_0xa55c('0x4d')](handleError(_0x3c0ec1,null));};exports[_0xa55c('0x4e')]=function(_0x574fe9,_0x5be06){var _0x34de95={'raw':![],'where':{'id':_0x574fe9[_0xa55c('0x4f')]['id']}},_0x3822b7={};_0x3822b7[_0xa55c('0x3c')]=_[_0xa55c('0x50')](db[_0xa55c('0x39')][_0xa55c('0x51')]);_0x3822b7[_0xa55c('0x3d')]=_[_0xa55c('0x50')](_0x574fe9['query']);_0x3822b7[_0xa55c('0x3e')]=_[_0xa55c('0x3f')](_0x3822b7[_0xa55c('0x3c')],_0x3822b7['query']);_0x34de95[_0xa55c('0x41')]=_[_0xa55c('0x3f')](_0x3822b7['model'],qs[_0xa55c('0x40')](_0x574fe9['query'][_0xa55c('0x40')]));_0x34de95[_0xa55c('0x41')]=_0x34de95[_0xa55c('0x41')][_0xa55c('0x42')]?_0x34de95[_0xa55c('0x41')]:_0x3822b7['model'];if(_0x574fe9[_0xa55c('0x3d')][_0xa55c('0x4b')]){_0x34de95['include']=[{'all':!![]}];}_0x34de95=_[_0xa55c('0x47')]({},_0x34de95,_0x574fe9[_0xa55c('0x4a')]);return db[_0xa55c('0x39')][_0xa55c('0x52')](_0x34de95)['then'](handleEntityNotFound(_0x5be06,null))['then'](respondWithResult(_0x5be06,null))[_0xa55c('0x4d')](handleError(_0x5be06,null));};exports[_0xa55c('0x53')]=function(_0x3ca5b8,_0x44ac57,_0x54cbde){var _0x30c0c9;return db['VoiceContext'][_0xa55c('0x53')](_0x3ca5b8[_0xa55c('0x54')],{'raw':!![]})[_0xa55c('0x1d')](function(_0x2ccfb1){_0x30c0c9=_0x2ccfb1;return db[_0xa55c('0x39')]['findAll']({'raw':!![]});})[_0xa55c('0x1d')](function(_0x54f776){var _0x23f67f=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],_0xa55c('0x58')),_0xa55c('0x59'));var _0x5d14e0=ejs['render'](_0x23f67f,{'contexts':_0x54f776||[]});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x5d14e0);})[_0xa55c('0x1d')](function(){return respondWithRpcPromise(_0xa55c('0x5c'),_0xa55c('0x53'),{'module':'chan_sip.so'});})[_0xa55c('0x1d')](function(){var _0x3cd40d=_0x3ca5b8[_0xa55c('0x5d')][_0xa55c('0x32')]({'plain':!![]});if(!_0x3cd40d)throw new Error(_0xa55c('0x5e'));if(_0x3cd40d['role']===_0xa55c('0x5d')){var _0x21725b=_0x30c0c9[_0xa55c('0x32')]({'plain':!![]});return db[_0xa55c('0x5f')][_0xa55c('0x52')]({'where':{'name':'Contexts','userProfileId':_0x3cd40d[_0xa55c('0x60')]},'raw':!![]})['then'](function(_0x2e482a){if(_0x2e482a&&_0x2e482a['autoAssociation']===0x0){return db[_0xa55c('0x34')]['create']({'name':_0x21725b[_0xa55c('0x36')],'resourceId':_0x21725b['id'],'type':_0x2e482a[_0xa55c('0x36')],'sectionId':_0x2e482a['id']},{})[_0xa55c('0x1d')](function(){return _0x30c0c9;});}else{return _0x30c0c9;}})[_0xa55c('0x4d')](function(_0x4cb38c){logger[_0xa55c('0x24')](_0xa55c('0x61'),_0x4cb38c);throw _0x4cb38c;});}return _0x30c0c9;})[_0xa55c('0x1d')](respondWithResult(_0x44ac57,0xc9))[_0xa55c('0x4d')](handleError(_0x44ac57,null));};exports[_0xa55c('0x31')]=function(_0x51c736,_0x150a07,_0x311bb9){var _0x4ef914;return db[_0xa55c('0x39')][_0xa55c('0x52')]({'where':{'id':_0x51c736[_0xa55c('0x4f')]['id']}})[_0xa55c('0x1d')](handleEntityNotFound(_0x150a07,null))[_0xa55c('0x1d')](saveUpdates(_0x51c736[_0xa55c('0x54')],null))[_0xa55c('0x1d')](function(_0x202191){if(_0x202191){_0x4ef914=_0x202191;return db['VoiceContext'][_0xa55c('0x62')]({'raw':!![]});}})[_0xa55c('0x1d')](function(_0x39861f){var _0xd309a9=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],_0xa55c('0x58')),_0xa55c('0x59'));var _0x4a08ca=ejs[_0xa55c('0x63')](_0xd309a9,{'contexts':_0x39861f||[]});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x4a08ca);})[_0xa55c('0x1d')](function(){return respondWithRpcPromise(_0xa55c('0x5c'),_0xa55c('0x31'),{'module':_0xa55c('0x64')});})[_0xa55c('0x1d')](function(){return _0x4ef914;})[_0xa55c('0x1d')](respondWithResult(_0x150a07,null))[_0xa55c('0x4d')](handleError(_0x150a07,null));};exports[_0xa55c('0x35')]=function(_0x5c598a,_0xe42233,_0x531eee){var _0x1228a4;return db[_0xa55c('0x39')][_0xa55c('0x52')]({'where':{'id':_0x5c598a['params']['id']}})['then'](handleEntityNotFound(_0xe42233,null))[_0xa55c('0x1d')](removeEntity(_0xe42233,null))[_0xa55c('0x1d')](function(){return db[_0xa55c('0x39')][_0xa55c('0x62')]({'raw':!![]});})['then'](function(_0x149cb9){var _0xd02251=fs[_0xa55c('0x55')](path[_0xa55c('0x56')](config[_0xa55c('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x3f7fca=ejs[_0xa55c('0x63')](_0xd02251,{'contexts':_0x149cb9});fs[_0xa55c('0x5a')](_0xa55c('0x5b'),_0x3f7fca);return respondWithRpcPromise(_0xa55c('0x5c'),'destroy',{'module':_0xa55c('0x64')});})[_0xa55c('0x4d')](handleError(_0xe42233,null));}; \ No newline at end of file +var _0x7217=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','get','Contexts','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceContext','includeAll','include','findAll','show','params','length','options','find','create','body','join','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','root','server/files/templates/context.ejs','utf8','chan_sip.so','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0x7217,0x19e));var _0x7721=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7217[_0x138f59];return _0x3d114d;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];var jayson=require(_0x7721('0x1b'));var client=jayson['client'][_0x7721('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x199930,_0x57ff6d,_0x109900){if(_0x109900){var _0x30da54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30da54[_0x7721('0x1d')](_0x57ff6d)){return _0x199930;}else{throw new db[(_0x7721('0x1e'))]['ValidationError'](_0x7721('0x1f'));}}else{return _0x199930;}}function respondWithRpcPromise(_0x25b1c0,_0x534f1b,_0x4e199a,_0x4b183e){return new BPromise(function(_0x5ed54,_0x25a628){var _0x3cc909=_0x4b183e||client;return _0x3cc909[_0x7721('0x20')](_0x25b1c0,_0x4e199a)['then'](function(_0x20f669){logger['info'](_0x7721('0x21'),_0x534f1b,'request\x20sent');logger[_0x7721('0x22')](_0x7721('0x23'),_0x534f1b,_0x7721('0x24'),JSON[_0x7721('0x25')](_0x20f669));if(_0x20f669[_0x7721('0x26')]){if(_0x20f669[_0x7721('0x26')][_0x7721('0x27')]===0x1f4){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669[_0x7721('0x26')]['message']);return _0x25a628(_0x20f669[_0x7721('0x26')][_0x7721('0x28')]);}logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x20f669['error'][_0x7721('0x28')]);return _0x5ed54(_0x20f669['error'][_0x7721('0x28')]);}else{logger[_0x7721('0x29')](_0x7721('0x21'),_0x534f1b,_0x7721('0x24'));_0x5ed54(_0x20f669[_0x7721('0x2a')][_0x7721('0x28')]);}})[_0x7721('0x2b')](function(_0x5b4d74){logger[_0x7721('0x26')](_0x7721('0x21'),_0x534f1b,_0x5b4d74);_0x25a628(_0x5b4d74);});});}function respondWithStatusCode(_0x125564,_0x1f67c7){_0x1f67c7=_0x1f67c7||0xcc;return function(_0x40d550){if(_0x40d550){return _0x125564[_0x7721('0x2c')](_0x1f67c7);}return _0x125564[_0x7721('0x2d')](_0x1f67c7)[_0x7721('0x2e')]();};}function respondWithResult(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0xc8;return function(_0x258ddf){if(_0x258ddf){return _0x40f367['status'](_0x52316e)['json'](_0x258ddf);}};}function respondWithFilteredResult(_0x315202,_0x343c19){return function(_0x53c904){if(_0x53c904){var _0x158d98=_0x53c904[_0x7721('0x2f')],_0x1ea4d=_0x343c19['offset'],_0x37b9f0=_0x343c19[_0x7721('0x30')]+_0x343c19[_0x7721('0x31')],_0xd7d703;if(_0x37b9f0>=_0x158d98){_0x37b9f0=_0x158d98;_0xd7d703=0xc8;}else{_0xd7d703=0xce;}_0x315202['status'](_0xd7d703);return _0x315202['set'](_0x7721('0x32'),_0x1ea4d+'-'+_0x37b9f0+'/'+_0x158d98)[_0x7721('0x33')](_0x53c904);}return null;};}function patchUpdates(_0x48f329){return function(_0x46f772){try{jsonpatch[_0x7721('0x34')](_0x46f772,_0x48f329,!![]);}catch(_0x382821){return BPromise['reject'](_0x382821);}return _0x46f772[_0x7721('0x35')]();};}function saveUpdates(_0x1ff31b,_0x1492d4){return function(_0x3f15e2){if(_0x3f15e2){return _0x3f15e2[_0x7721('0x36')](_0x1ff31b)['then'](function(_0x195ffb){return _0x195ffb;});}return null;};}function removeEntity(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(_0x5c5b33){return _0x5c5b33[_0x7721('0x37')]()[_0x7721('0x38')](function(){var _0x498654=_0x5c5b33[_0x7721('0x39')]({'plain':!![]});var _0x5ce026=_0x7721('0x3a');return db[_0x7721('0x3b')][_0x7721('0x37')]({'where':{'type':_0x5ce026,'resourceId':_0x498654['id']}})[_0x7721('0x38')](function(){return _0x5c5b33;});})[_0x7721('0x38')](function(){_0x3e4e56[_0x7721('0x2d')](0xcc)[_0x7721('0x2e')]();});}};}function handleEntityNotFound(_0x15545a,_0x25bdd9){return function(_0x3a2eb7){if(!_0x3a2eb7){_0x15545a[_0x7721('0x2c')](0x194);}return _0x3a2eb7;};}function handleError(_0x5c806d,_0xd1df68){_0xd1df68=_0xd1df68||0x1f4;return function(_0x5e6663){logger[_0x7721('0x26')](_0x5e6663[_0x7721('0x3c')]);if(_0x5e6663[_0x7721('0x3d')]){delete _0x5e6663[_0x7721('0x3d')];}_0x5c806d[_0x7721('0x2d')](_0xd1df68)[_0x7721('0x3e')](_0x5e6663);};}exports['index']=function(_0x557c34,_0x4cadef){var _0x539560={},_0x18001c={},_0x1b3f8d={'count':0x0,'rows':[]};var _0x1acc72=_[_0x7721('0x3f')](db['VoiceContext'][_0x7721('0x40')],function(_0x4cf659){return{'name':_0x4cf659[_0x7721('0x41')],'type':_0x4cf659[_0x7721('0x42')]['key']};});_0x18001c[_0x7721('0x43')]=_[_0x7721('0x3f')](_0x1acc72,'name');_0x18001c['query']=_[_0x7721('0x44')](_0x557c34[_0x7721('0x45')]);_0x18001c[_0x7721('0x46')]=_[_0x7721('0x47')](_0x18001c['model'],_0x18001c[_0x7721('0x45')]);_0x539560[_0x7721('0x48')]=_[_0x7721('0x47')](_0x18001c[_0x7721('0x43')],qs[_0x7721('0x49')](_0x557c34['query'][_0x7721('0x49')]));_0x539560['attributes']=_0x539560[_0x7721('0x48')]['length']?_0x539560[_0x7721('0x48')]:_0x18001c[_0x7721('0x43')];if(!_0x557c34[_0x7721('0x45')]['hasOwnProperty'](_0x7721('0x4a'))){_0x539560[_0x7721('0x31')]=qs[_0x7721('0x31')](_0x557c34['query'][_0x7721('0x31')]);_0x539560[_0x7721('0x30')]=qs[_0x7721('0x30')](_0x557c34[_0x7721('0x45')][_0x7721('0x30')]);}_0x539560[_0x7721('0x4b')]=qs[_0x7721('0x4c')](_0x557c34['query']['sort']);_0x539560[_0x7721('0x4d')]=qs[_0x7721('0x46')](_[_0x7721('0x4e')](_0x557c34[_0x7721('0x45')],_0x18001c[_0x7721('0x46')]),_0x1acc72);if(_0x557c34[_0x7721('0x45')][_0x7721('0x4f')]){_0x539560[_0x7721('0x4d')]=_[_0x7721('0x50')](_0x539560[_0x7721('0x4d')],{'$or':_['map'](_0x1acc72,function(_0x578867){if(_0x578867[_0x7721('0x42')]!==_0x7721('0x51')){var _0x151f69={};_0x151f69[_0x578867[_0x7721('0x3d')]]={'$like':'%'+_0x557c34['query'][_0x7721('0x4f')]+'%'};return _0x151f69;}})});}_0x539560=_[_0x7721('0x50')]({},_0x539560,_0x557c34['options']);var _0x330fac={'where':_0x539560['where']};return db[_0x7721('0x52')]['count'](_0x330fac)[_0x7721('0x38')](function(_0x196be4){_0x1b3f8d[_0x7721('0x2f')]=_0x196be4;if(_0x557c34['query'][_0x7721('0x53')]){_0x539560[_0x7721('0x54')]=[{'all':!![]}];}return db['VoiceContext'][_0x7721('0x55')](_0x539560);})[_0x7721('0x38')](function(_0xf88e8c){_0x1b3f8d['rows']=_0xf88e8c;return _0x1b3f8d;})[_0x7721('0x38')](respondWithFilteredResult(_0x4cadef,_0x539560))['catch'](handleError(_0x4cadef,null));};exports[_0x7721('0x56')]=function(_0x310549,_0x4738ef){var _0x443503={'raw':![],'where':{'id':_0x310549[_0x7721('0x57')]['id']}},_0x1c95d8={};_0x1c95d8[_0x7721('0x43')]=_[_0x7721('0x44')](db[_0x7721('0x52')][_0x7721('0x40')]);_0x1c95d8[_0x7721('0x45')]=_[_0x7721('0x44')](_0x310549[_0x7721('0x45')]);_0x1c95d8[_0x7721('0x46')]=_[_0x7721('0x47')](_0x1c95d8['model'],_0x1c95d8[_0x7721('0x45')]);_0x443503[_0x7721('0x48')]=_[_0x7721('0x47')](_0x1c95d8[_0x7721('0x43')],qs[_0x7721('0x49')](_0x310549[_0x7721('0x45')][_0x7721('0x49')]));_0x443503['attributes']=_0x443503[_0x7721('0x48')][_0x7721('0x58')]?_0x443503[_0x7721('0x48')]:_0x1c95d8[_0x7721('0x43')];if(_0x310549[_0x7721('0x45')][_0x7721('0x53')]){_0x443503[_0x7721('0x54')]=[{'all':!![]}];}_0x443503=_[_0x7721('0x50')]({},_0x443503,_0x310549[_0x7721('0x59')]);return db[_0x7721('0x52')][_0x7721('0x5a')](_0x443503)['then'](handleEntityNotFound(_0x4738ef,null))[_0x7721('0x38')](respondWithResult(_0x4738ef,null))[_0x7721('0x2b')](handleError(_0x4738ef,null));};exports[_0x7721('0x5b')]=function(_0x2ee3c0,_0x15ed3b,_0x3e7918){var _0x41644f;return db[_0x7721('0x52')][_0x7721('0x5b')](_0x2ee3c0[_0x7721('0x5c')],{'raw':!![]})[_0x7721('0x38')](function(_0x2e5c28){_0x41644f=_0x2e5c28;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});})[_0x7721('0x38')](function(_0x577f47){var _0x50e9e9=fs['readFileSync'](path[_0x7721('0x5d')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x5d7036=ejs[_0x7721('0x5e')](_0x50e9e9,{'contexts':_0x577f47||[]});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x5d7036);})['then'](function(){return respondWithRpcPromise(_0x7721('0x61'),'create',{'module':'chan_sip.so'});})['then'](function(){var _0x24d1dc=_0x2ee3c0['user']['get']({'plain':!![]});if(!_0x24d1dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24d1dc[_0x7721('0x62')]===_0x7721('0x63')){var _0x1ff090=_0x41644f['get']({'plain':!![]});return db[_0x7721('0x64')][_0x7721('0x5a')]({'where':{'name':_0x7721('0x3a'),'userProfileId':_0x24d1dc[_0x7721('0x65')]},'raw':!![]})[_0x7721('0x38')](function(_0x16e80b){if(_0x16e80b&&_0x16e80b[_0x7721('0x66')]===0x0){return db[_0x7721('0x3b')][_0x7721('0x5b')]({'name':_0x1ff090[_0x7721('0x3d')],'resourceId':_0x1ff090['id'],'type':_0x16e80b[_0x7721('0x3d')],'sectionId':_0x16e80b['id']},{})[_0x7721('0x38')](function(){return _0x41644f;});}else{return _0x41644f;}})[_0x7721('0x2b')](function(_0x211d27){logger[_0x7721('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211d27);throw _0x211d27;});}return _0x41644f;})[_0x7721('0x38')](respondWithResult(_0x15ed3b,0xc9))[_0x7721('0x2b')](handleError(_0x15ed3b,null));};exports[_0x7721('0x36')]=function(_0xb6db23,_0x542e30,_0x103009){var _0x104f05;return db['VoiceContext'][_0x7721('0x5a')]({'where':{'id':_0xb6db23['params']['id']}})[_0x7721('0x38')](handleEntityNotFound(_0x542e30,null))[_0x7721('0x38')](saveUpdates(_0xb6db23[_0x7721('0x5c')],null))[_0x7721('0x38')](function(_0x3d2b7d){if(_0x3d2b7d){_0x104f05=_0x3d2b7d;return db[_0x7721('0x52')][_0x7721('0x55')]({'raw':!![]});}})[_0x7721('0x38')](function(_0x4727b0){var _0x57759a=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),_0x7721('0x6a'));var _0x3ed425=ejs[_0x7721('0x5e')](_0x57759a,{'contexts':_0x4727b0||[]});fs['writeFileSync'](_0x7721('0x60'),_0x3ed425);})[_0x7721('0x38')](function(){return respondWithRpcPromise('Reload',_0x7721('0x36'),{'module':'chan_sip.so'});})[_0x7721('0x38')](function(){return _0x104f05;})[_0x7721('0x38')](respondWithResult(_0x542e30,null))[_0x7721('0x2b')](handleError(_0x542e30,null));};exports[_0x7721('0x37')]=function(_0x1e2436,_0x2bab14,_0x258c57){var _0x5dca04;return db[_0x7721('0x52')][_0x7721('0x5a')]({'where':{'id':_0x1e2436[_0x7721('0x57')]['id']}})['then'](handleEntityNotFound(_0x2bab14,null))['then'](removeEntity(_0x2bab14,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x7721('0x38')](function(_0x2645dd){var _0x580473=fs[_0x7721('0x67')](path[_0x7721('0x5d')](config[_0x7721('0x68')],_0x7721('0x69')),'utf8');var _0x275b25=ejs[_0x7721('0x5e')](_0x580473,{'contexts':_0x2645dd});fs[_0x7721('0x5f')](_0x7721('0x60'),_0x275b25);return respondWithRpcPromise(_0x7721('0x61'),'destroy',{'module':_0x7721('0x6b')});})[_0x7721('0x2b')](handleError(_0x2bab14,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3c20fd4..67875c3 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 _0x3c18=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api'];(function(_0x4a34f3,_0x37f8f6){var _0xefb6c9=function(_0x516184){while(--_0x516184){_0x4a34f3['push'](_0x4a34f3['shift']());}};_0xefb6c9(++_0x37f8f6);}(_0x3c18,0x11a));var _0x83c1=function(_0x3139ae,_0x14c923){_0x3139ae=_0x3139ae-0x0;var _0x58b840=_0x3c18[_0x3139ae];return _0x58b840;};'use strict';var _=require(_0x83c1('0x0'));var util=require(_0x83c1('0x1'));var logger=require(_0x83c1('0x2'))(_0x83c1('0x3'));var moment=require(_0x83c1('0x4'));var BPromise=require(_0x83c1('0x5'));var rp=require(_0x83c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83c1('0x7'));var config=require(_0x83c1('0x8'));var attributes=require(_0x83c1('0x9'));module['exports']=function(_0x2a844a,_0x134b30){return _0x2a844a[_0x83c1('0xa')](_0x83c1('0xb'),attributes,{'tableName':_0x83c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef55=['../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x429b88,_0x600cee){var _0x327f3d=function(_0x205a5e){while(--_0x205a5e){_0x429b88['push'](_0x429b88['shift']());}};_0x327f3d(++_0x600cee);}(_0xef55,0xa1));var _0x5ef5=function(_0x4bc743,_0x465f94){_0x4bc743=_0x4bc743-0x0;var _0x5edaaa=_0xef55[_0x4bc743];return _0x5edaaa;};'use strict';var _=require(_0x5ef5('0x0'));var util=require(_0x5ef5('0x1'));var logger=require(_0x5ef5('0x2'))(_0x5ef5('0x3'));var moment=require(_0x5ef5('0x4'));var BPromise=require(_0x5ef5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ef5('0x6'));var rimraf=require(_0x5ef5('0x7'));var config=require(_0x5ef5('0x8'));var attributes=require(_0x5ef5('0x9'));module[_0x5ef5('0xa')]=function(_0x146efc,_0x50e77e){return _0x146efc[_0x5ef5('0xb')]('VoiceContext',attributes,{'tableName':_0x5ef5('0xc'),'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 701817a..e4e57f3 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 _0x3d1a=['jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','moment','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x962de1,_0x361057){var _0x14085a=function(_0x220dae){while(--_0x220dae){_0x962de1['push'](_0x962de1['shift']());}};_0x14085a(++_0x361057);}(_0x3d1a,0x187));var _0xa3d1=function(_0x1f765b,_0x58c167){_0x1f765b=_0x1f765b-0x0;var _0x354c9a=_0x3d1a[_0x1f765b];return _0x354c9a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa3d1('0x0'));var BPromise=require('bluebird');var rs=require(_0xa3d1('0x1'));var fs=require('fs');var Redis=require(_0xa3d1('0x2'));var db=require(_0xa3d1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa3d1('0x4'));var config=require('../../config/environment');var jayson=require(_0xa3d1('0x5'));var client=jayson[_0xa3d1('0x6')][_0xa3d1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x179b95,_0x2e22cb,_0x52e1b7){return new BPromise(function(_0x3f60dc,_0x14c99f){return client[_0xa3d1('0x8')](_0x179b95,_0x52e1b7)['then'](function(_0x2015d3){logger[_0xa3d1('0x9')]('VoiceContext,\x20%s,\x20%s',_0x2e22cb,'request\x20sent');logger[_0xa3d1('0xa')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2e22cb,_0xa3d1('0xb'),JSON[_0xa3d1('0xc')](_0x2015d3));if(_0x2015d3[_0xa3d1('0xd')]){if(_0x2015d3[_0xa3d1('0xd')][_0xa3d1('0xe')]===0x1f4){logger['error'](_0xa3d1('0xf'),_0x2e22cb,_0x2015d3[_0xa3d1('0xd')][_0xa3d1('0x10')]);return _0x14c99f(_0x2015d3['error']['message']);}logger[_0xa3d1('0xd')](_0xa3d1('0xf'),_0x2e22cb,_0x2015d3[_0xa3d1('0xd')]['message']);return _0x3f60dc(_0x2015d3[_0xa3d1('0xd')]['message']);}else{logger[_0xa3d1('0x9')](_0xa3d1('0xf'),_0x2e22cb,_0xa3d1('0xb'));_0x3f60dc(_0x2015d3['result'][_0xa3d1('0x10')]);}})[_0xa3d1('0x11')](function(_0x3b7aba){logger['error'](_0xa3d1('0xf'),_0x2e22cb,_0x3b7aba);_0x14c99f(_0x3b7aba);});});} \ No newline at end of file +var _0x0fe8=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0x0fe8,0x89));var _0x80fe=function(_0x38b7df,_0x33eb75){_0x38b7df=_0x38b7df-0x0;var _0x36f268=_0x0fe8[_0x38b7df];return _0x36f268;};'use strict';var _=require(_0x80fe('0x0'));var util=require(_0x80fe('0x1'));var moment=require(_0x80fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80fe('0x3'));var db=require(_0x80fe('0x4'))['db'];var utils=require(_0x80fe('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x80fe('0x6'));var client=jayson['client'][_0x80fe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55c1cd,_0x4b6e56,_0xc5f199){return new BPromise(function(_0x3528eb,_0x5bba35){return client[_0x80fe('0x8')](_0x55c1cd,_0xc5f199)[_0x80fe('0x9')](function(_0x373351){logger[_0x80fe('0xa')](_0x80fe('0xb'),_0x4b6e56,_0x80fe('0xc'));logger[_0x80fe('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4b6e56,_0x80fe('0xc'),JSON['stringify'](_0x373351));if(_0x373351[_0x80fe('0xe')]){if(_0x373351[_0x80fe('0xe')][_0x80fe('0xf')]===0x1f4){logger[_0x80fe('0xe')]('VoiceContext,\x20%s,\x20%s',_0x4b6e56,_0x373351['error'][_0x80fe('0x10')]);return _0x5bba35(_0x373351[_0x80fe('0xe')][_0x80fe('0x10')]);}logger[_0x80fe('0xe')]('VoiceContext,\x20%s,\x20%s',_0x4b6e56,_0x373351[_0x80fe('0xe')][_0x80fe('0x10')]);return _0x3528eb(_0x373351[_0x80fe('0xe')][_0x80fe('0x10')]);}else{logger[_0x80fe('0xa')]('VoiceContext,\x20%s,\x20%s',_0x4b6e56,_0x80fe('0xc'));_0x3528eb(_0x373351[_0x80fe('0x11')][_0x80fe('0x10')]);}})[_0x80fe('0x12')](function(_0x394fe6){logger[_0x80fe('0xe')](_0x80fe('0xb'),_0x4b6e56,_0x394fe6);_0x5bba35(_0x394fe6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 09d340a..7248873 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 _0x4197=['express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x5e4cd6,_0xfb732a){var _0xd7c226=function(_0x574888){while(--_0x574888){_0x5e4cd6['push'](_0x5e4cd6['shift']());}};_0xd7c226(++_0xfb732a);}(_0x4197,0x19f));var _0x7419=function(_0x66e1fc,_0x800d4a){_0x66e1fc=_0x66e1fc-0x0;var _0x57bbb8=_0x4197[_0x66e1fc];return _0x57bbb8;};'use strict';var multer=require(_0x7419('0x0'));var util=require('util');var path=require(_0x7419('0x1'));var timeout=require(_0x7419('0x2'));var express=require(_0x7419('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7419('0x4'));var config=require(_0x7419('0x5'));var controller=require('./voiceDialReport.controller');router[_0x7419('0x6')]('/',auth[_0x7419('0x7')](),controller[_0x7419('0x8')]);router[_0x7419('0x6')](_0x7419('0x9'),auth[_0x7419('0x7')](),controller[_0x7419('0xa')]);router[_0x7419('0x6')](_0x7419('0xb'),auth['isAuthenticated'](),controller[_0x7419('0xc')]);router[_0x7419('0xd')]('/',auth[_0x7419('0x7')](),controller[_0x7419('0xe')]);router['put']('/:id',auth[_0x7419('0x7')](),controller[_0x7419('0xf')]);router[_0x7419('0x10')](_0x7419('0xb'),auth[_0x7419('0x7')](),controller[_0x7419('0x11')]);module[_0x7419('0x12')]=router; \ No newline at end of file +var _0xbeca=['update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','post','create'];(function(_0x2718b1,_0x4d1f58){var _0x265413=function(_0x247b2e){while(--_0x247b2e){_0x2718b1['push'](_0x2718b1['shift']());}};_0x265413(++_0x4d1f58);}(_0xbeca,0x183));var _0xabec=function(_0x12c98e,_0x2d0b4b){_0x12c98e=_0x12c98e-0x0;var _0x198b35=_0xbeca[_0x12c98e];return _0x198b35;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xabec('0x0'));var timeout=require(_0xabec('0x1'));var express=require(_0xabec('0x2'));var router=express[_0xabec('0x3')]();var auth=require(_0xabec('0x4'));var interaction=require(_0xabec('0x5'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0xabec('0x6')]('/',auth[_0xabec('0x7')](),controller[_0xabec('0x8')]);router[_0xabec('0x6')](_0xabec('0x9'),auth[_0xabec('0x7')](),controller['describe']);router[_0xabec('0x6')](_0xabec('0xa'),auth[_0xabec('0x7')](),controller['show']);router[_0xabec('0xb')]('/',auth[_0xabec('0x7')](),controller[_0xabec('0xc')]);router['put']('/:id',auth[_0xabec('0x7')](),controller[_0xabec('0xd')]);router[_0xabec('0xe')]('/:id',auth[_0xabec('0x7')](),controller['destroy']);module[_0xabec('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 056b9aa..1e7ccbc 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 _0x8ec1=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x235aed,_0x532c19){var _0x3b936a=function(_0x1f155c){while(--_0x1f155c){_0x235aed['push'](_0x235aed['shift']());}};_0x3b936a(++_0x532c19);}(_0x8ec1,0x68));var _0x18ec=function(_0x42f3a5,_0x3a4470){_0x42f3a5=_0x42f3a5-0x0;var _0x1a7d74=_0x8ec1[_0x42f3a5];return _0x1a7d74;};'use strict';var Sequelize=require('sequelize');module[_0x18ec('0x0')]={'privilege':{'type':Sequelize[_0x18ec('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x18ec('0x2')]},'channelstatedesc':{'type':Sequelize[_0x18ec('0x1')]},'calleridnum':{'type':Sequelize[_0x18ec('0x1')]},'calleridname':{'type':Sequelize[_0x18ec('0x1')]},'connectedlinenum':{'type':Sequelize[_0x18ec('0x1')]},'connectedlinename':{'type':Sequelize[_0x18ec('0x1')]},'language':{'type':Sequelize[_0x18ec('0x1')]},'accountcode':{'type':Sequelize[_0x18ec('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x18ec('0x1')]},'priority':{'type':Sequelize[_0x18ec('0x2')]},'uniqueid':{'type':Sequelize[_0x18ec('0x1')]},'linkedid':{'type':Sequelize[_0x18ec('0x1')]},'destchannel':{'type':Sequelize[_0x18ec('0x1')]},'destchannelstate':{'type':Sequelize[_0x18ec('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x18ec('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x18ec('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x18ec('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x18ec('0x1')]},'destaccountcode':{'type':Sequelize[_0x18ec('0x1')]},'destcontext':{'type':Sequelize[_0x18ec('0x1')]},'destexten':{'type':Sequelize[_0x18ec('0x1')]},'destpriority':{'type':Sequelize[_0x18ec('0x2')]},'destuniqueid':{'type':Sequelize[_0x18ec('0x1')]},'destlinkedid':{'type':Sequelize[_0x18ec('0x1')]},'dialstring':{'type':Sequelize[_0x18ec('0x1')]},'dialstatus':{'type':Sequelize[_0x18ec('0x1')]},'starttime':{'type':Sequelize[_0x18ec('0x3')]},'answertime':{'type':Sequelize[_0x18ec('0x3')]},'endtime':{'type':Sequelize[_0x18ec('0x3')]},'lastevent':{'type':Sequelize[_0x18ec('0x1')],'comment':_0x18ec('0x4')},'routeId':{'type':Sequelize[_0x18ec('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x18ec('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x13cd=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0xaded90,_0x56e907){var _0x21f39b=function(_0xa337ec){while(--_0xa337ec){_0xaded90['push'](_0xaded90['shift']());}};_0x21f39b(++_0x56e907);}(_0x13cd,0xd4));var _0xd13c=function(_0x16b4f5,_0x3c7e54){_0x16b4f5=_0x16b4f5-0x0;var _0xf2f538=_0x13cd[_0x16b4f5];return _0xf2f538;};'use strict';var Sequelize=require(_0xd13c('0x0'));module[_0xd13c('0x1')]={'privilege':{'type':Sequelize[_0xd13c('0x2')]},'channel':{'type':Sequelize[_0xd13c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd13c('0x2')]},'calleridname':{'type':Sequelize[_0xd13c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd13c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd13c('0x2')]},'context':{'type':Sequelize[_0xd13c('0x2')]},'exten':{'type':Sequelize[_0xd13c('0x2')]},'priority':{'type':Sequelize[_0xd13c('0x3')]},'uniqueid':{'type':Sequelize[_0xd13c('0x2')]},'linkedid':{'type':Sequelize[_0xd13c('0x2')]},'destchannel':{'type':Sequelize[_0xd13c('0x2')]},'destchannelstate':{'type':Sequelize[_0xd13c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd13c('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd13c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd13c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd13c('0x2')]},'destlanguage':{'type':Sequelize[_0xd13c('0x2')]},'destaccountcode':{'type':Sequelize[_0xd13c('0x2')]},'destcontext':{'type':Sequelize[_0xd13c('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd13c('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xd13c('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xd13c('0x2')]},'starttime':{'type':Sequelize[_0xd13c('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd13c('0x4')]},'lastevent':{'type':Sequelize[_0xd13c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xd13c('0x3')]},'holdtime':{'type':Sequelize[_0xd13c('0x3')]},'billableseconds':{'type':Sequelize[_0xd13c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 0280d63..2ed308b 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 _0xb9bd=['params','includeAll','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','apply','destroy','then','sendStatus','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0x2f2fd0,_0x3c980d){var _0x44f94f=function(_0x1fb033){while(--_0x1fb033){_0x2f2fd0['push'](_0x2f2fd0['shift']());}};_0x44f94f(++_0x3c980d);}(_0xb9bd,0x9d));var _0xdb9b=function(_0x2c898e,_0x22fa51){_0x2c898e=_0x2c898e-0x0;var _0x1d8cd9=_0xb9bd[_0x2c898e];return _0x1d8cd9;};'use strict';var pdf=require(_0xdb9b('0x0'));var emlformat=require(_0xdb9b('0x1'));var rimraf=require(_0xdb9b('0x2'));var zipdir=require(_0xdb9b('0x3'));var jsonpatch=require(_0xdb9b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb9b('0x5'));var Mustache=require('mustache');var util=require(_0xdb9b('0x6'));var path=require(_0xdb9b('0x7'));var sox=require(_0xdb9b('0x8'));var csv=require('to-csv');var ejs=require(_0xdb9b('0x9'));var fs=require('fs');var _=require(_0xdb9b('0xa'));var squel=require('squel');var crypto=require(_0xdb9b('0xb'));var jsforce=require(_0xdb9b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdb9b('0xd'));var querystring=require(_0xdb9b('0xe'));var Papa=require(_0xdb9b('0xf'));var Redis=require(_0xdb9b('0x10'));var authService=require(_0xdb9b('0x11'));var qs=require(_0xdb9b('0x12'));var as=require(_0xdb9b('0x13'));var hardwareService=require(_0xdb9b('0x14'));var logger=require(_0xdb9b('0x15'))(_0xdb9b('0x16'));var utils=require(_0xdb9b('0x17'));var config=require(_0xdb9b('0x18'));var db=require(_0xdb9b('0x19'))['db'];function respondWithStatusCode(_0x537d76,_0x58db11){_0x58db11=_0x58db11||0xcc;return function(_0x1dc076){if(_0x1dc076){return _0x537d76['sendStatus'](_0x58db11);}return _0x537d76['status'](_0x58db11)[_0xdb9b('0x1a')]();};}function respondWithResult(_0x4980bd,_0x247a6c){_0x247a6c=_0x247a6c||0xc8;return function(_0x8b5c2a){if(_0x8b5c2a){return _0x4980bd[_0xdb9b('0x1b')](_0x247a6c)[_0xdb9b('0x1c')](_0x8b5c2a);}};}function respondWithFilteredResult(_0x14ad07,_0x549b4a){return function(_0x518aec){if(_0x518aec){var _0x34b3c3=_0x518aec[_0xdb9b('0x1d')],_0x204df7=_0x549b4a[_0xdb9b('0x1e')],_0x1d3e6a=_0x549b4a[_0xdb9b('0x1e')]+_0x549b4a[_0xdb9b('0x1f')],_0x454421;if(_0x1d3e6a>=_0x34b3c3){_0x1d3e6a=_0x34b3c3;_0x454421=0xc8;}else{_0x454421=0xce;}_0x14ad07[_0xdb9b('0x1b')](_0x454421);return _0x14ad07[_0xdb9b('0x20')]('Content-Range',_0x204df7+'-'+_0x1d3e6a+'/'+_0x34b3c3)[_0xdb9b('0x1c')](_0x518aec);}return null;};}function patchUpdates(_0x23612b){return function(_0x4be768){try{jsonpatch[_0xdb9b('0x21')](_0x4be768,_0x23612b,!![]);}catch(_0x1539ad){return BPromise['reject'](_0x1539ad);}return _0x4be768['save']();};}function saveUpdates(_0x352c58,_0x248abc){return function(_0x1c06f7){if(_0x1c06f7){return _0x1c06f7['update'](_0x352c58)['then'](function(_0x5e2c31){return _0x5e2c31;});}return null;};}function removeEntity(_0x2f56fb,_0x83855b){return function(_0x271ce9){if(_0x271ce9){return _0x271ce9[_0xdb9b('0x22')]()[_0xdb9b('0x23')](function(){_0x2f56fb[_0xdb9b('0x1b')](0xcc)[_0xdb9b('0x1a')]();});}};}function handleEntityNotFound(_0x3b4fac,_0x584bfa){return function(_0x5a40c0){if(!_0x5a40c0){_0x3b4fac[_0xdb9b('0x24')](0x194);}return _0x5a40c0;};}function handleError(_0x145812,_0x33eecd){_0x33eecd=_0x33eecd||0x1f4;return function(_0x51f564){logger[_0xdb9b('0x25')](_0x51f564['stack']);if(_0x51f564[_0xdb9b('0x26')]){delete _0x51f564['name'];}_0x145812[_0xdb9b('0x1b')](_0x33eecd)[_0xdb9b('0x27')](_0x51f564);};}exports[_0xdb9b('0x28')]=function(_0x563561,_0x1ac9e6){var _0x994a39={},_0x465e35={},_0xdc2d2a={'count':0x0,'rows':[]};var _0x13438c=_[_0xdb9b('0x29')](db[_0xdb9b('0x2a')][_0xdb9b('0x2b')],function(_0x4cdcbc){return{'name':_0x4cdcbc[_0xdb9b('0x2c')],'type':_0x4cdcbc[_0xdb9b('0x2d')][_0xdb9b('0x2e')]};});_0x465e35[_0xdb9b('0x2f')]=_['map'](_0x13438c,_0xdb9b('0x26'));_0x465e35['query']=_[_0xdb9b('0x30')](_0x563561[_0xdb9b('0x31')]);_0x465e35[_0xdb9b('0x32')]=_['intersection'](_0x465e35['model'],_0x465e35[_0xdb9b('0x31')]);_0x994a39[_0xdb9b('0x33')]=_[_0xdb9b('0x34')](_0x465e35[_0xdb9b('0x2f')],qs[_0xdb9b('0x35')](_0x563561[_0xdb9b('0x31')][_0xdb9b('0x35')]));_0x994a39['attributes']=_0x994a39['attributes'][_0xdb9b('0x36')]?_0x994a39['attributes']:_0x465e35[_0xdb9b('0x2f')];if(!_0x563561['query']['hasOwnProperty'](_0xdb9b('0x37'))){_0x994a39[_0xdb9b('0x1f')]=qs[_0xdb9b('0x1f')](_0x563561[_0xdb9b('0x31')][_0xdb9b('0x1f')]);_0x994a39[_0xdb9b('0x1e')]=qs['offset'](_0x563561['query'][_0xdb9b('0x1e')]);}_0x994a39[_0xdb9b('0x38')]=qs[_0xdb9b('0x39')](_0x563561[_0xdb9b('0x31')][_0xdb9b('0x39')]);_0x994a39[_0xdb9b('0x3a')]=qs[_0xdb9b('0x32')](_['pick'](_0x563561[_0xdb9b('0x31')],_0x465e35[_0xdb9b('0x32')]),_0x13438c);if(_0x563561['query'][_0xdb9b('0x3b')]){_0x994a39[_0xdb9b('0x3a')]=_[_0xdb9b('0x3c')](_0x994a39['where'],{'$or':_[_0xdb9b('0x29')](_0x13438c,function(_0x469520){if(_0x469520['type']!==_0xdb9b('0x3d')){var _0x3113d6={};_0x3113d6[_0x469520[_0xdb9b('0x26')]]={'$like':'%'+_0x563561[_0xdb9b('0x31')][_0xdb9b('0x3b')]+'%'};return _0x3113d6;}})});}_0x994a39=_['merge']({},_0x994a39,_0x563561[_0xdb9b('0x3e')]);var _0x3bf337={'where':_0x994a39[_0xdb9b('0x3a')]};return db[_0xdb9b('0x2a')][_0xdb9b('0x1d')](_0x3bf337)[_0xdb9b('0x23')](function(_0x4948ed){_0xdc2d2a[_0xdb9b('0x1d')]=_0x4948ed;if(_0x563561[_0xdb9b('0x31')]['includeAll']){_0x994a39[_0xdb9b('0x3f')]=[{'all':!![]}];}return db[_0xdb9b('0x2a')][_0xdb9b('0x40')](_0x994a39);})[_0xdb9b('0x23')](function(_0x477a8d){_0xdc2d2a[_0xdb9b('0x41')]=_0x477a8d;return _0xdc2d2a;})[_0xdb9b('0x23')](respondWithFilteredResult(_0x1ac9e6,_0x994a39))[_0xdb9b('0x42')](handleError(_0x1ac9e6,null));};exports[_0xdb9b('0x43')]=function(_0x3e4ffb,_0x116683){var _0xe7d6c0={'raw':!![],'where':{'id':_0x3e4ffb[_0xdb9b('0x44')]['id']}},_0x2a8d43={};_0x2a8d43['model']=_[_0xdb9b('0x30')](db['VoiceDialReport'][_0xdb9b('0x2b')]);_0x2a8d43['query']=_[_0xdb9b('0x30')](_0x3e4ffb[_0xdb9b('0x31')]);_0x2a8d43[_0xdb9b('0x32')]=_[_0xdb9b('0x34')](_0x2a8d43[_0xdb9b('0x2f')],_0x2a8d43[_0xdb9b('0x31')]);_0xe7d6c0[_0xdb9b('0x33')]=_[_0xdb9b('0x34')](_0x2a8d43['model'],qs['fields'](_0x3e4ffb[_0xdb9b('0x31')][_0xdb9b('0x35')]));_0xe7d6c0[_0xdb9b('0x33')]=_0xe7d6c0['attributes'][_0xdb9b('0x36')]?_0xe7d6c0[_0xdb9b('0x33')]:_0x2a8d43[_0xdb9b('0x2f')];if(_0x3e4ffb[_0xdb9b('0x31')][_0xdb9b('0x45')]){_0xe7d6c0['include']=[{'all':!![]}];}_0xe7d6c0=_[_0xdb9b('0x3c')]({},_0xe7d6c0,_0x3e4ffb[_0xdb9b('0x3e')]);return db['VoiceDialReport'][_0xdb9b('0x46')](_0xe7d6c0)[_0xdb9b('0x23')](handleEntityNotFound(_0x116683,null))[_0xdb9b('0x23')](respondWithResult(_0x116683,null))[_0xdb9b('0x42')](handleError(_0x116683,null));};exports['create']=function(_0x3c1b1b,_0x1656d7){return db[_0xdb9b('0x2a')][_0xdb9b('0x47')](_0x3c1b1b[_0xdb9b('0x48')],{})['then'](respondWithResult(_0x1656d7,0xc9))[_0xdb9b('0x42')](handleError(_0x1656d7,null));};exports[_0xdb9b('0x49')]=function(_0x38ecb7,_0xb9f4f1){if(_0x38ecb7[_0xdb9b('0x48')]['id']){delete _0x38ecb7[_0xdb9b('0x48')]['id'];}return db[_0xdb9b('0x2a')][_0xdb9b('0x46')]({'where':{'id':_0x38ecb7['params']['id']}})['then'](handleEntityNotFound(_0xb9f4f1,null))[_0xdb9b('0x23')](saveUpdates(_0x38ecb7['body'],null))[_0xdb9b('0x23')](respondWithResult(_0xb9f4f1,null))[_0xdb9b('0x42')](handleError(_0xb9f4f1,null));};exports['destroy']=function(_0x9f6ed8,_0x830e62){return db['VoiceDialReport'][_0xdb9b('0x46')]({'where':{'id':_0x9f6ed8[_0xdb9b('0x44')]['id']}})[_0xdb9b('0x23')](handleEntityNotFound(_0x830e62,null))[_0xdb9b('0x23')](removeEntity(_0x830e62,null))[_0xdb9b('0x42')](handleError(_0x830e62,null));};exports[_0xdb9b('0x4a')]=function(_0x1f40f7,_0x2c92b9){return db[_0xdb9b('0x2a')]['describe']()[_0xdb9b('0x23')](respondWithResult(_0x2c92b9,null))['catch'](handleError(_0x2c92b9,null));}; \ No newline at end of file +var _0x8563=['pick','merge','options','include','findAll','catch','show','includeAll','find','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0x8563,0x138));var _0x3856=function(_0x57ab48,_0xdd792c){_0x57ab48=_0x57ab48-0x0;var _0x1ed991=_0x8563[_0x57ab48];return _0x1ed991;};'use strict';var pdf=require(_0x3856('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3856('0x1'));var zipdir=require(_0x3856('0x2'));var jsonpatch=require(_0x3856('0x3'));var rp=require(_0x3856('0x4'));var moment=require(_0x3856('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3856('0x6'));var util=require(_0x3856('0x7'));var path=require(_0x3856('0x8'));var sox=require(_0x3856('0x9'));var csv=require(_0x3856('0xa'));var ejs=require(_0x3856('0xb'));var fs=require('fs');var _=require(_0x3856('0xc'));var squel=require(_0x3856('0xd'));var crypto=require('crypto');var jsforce=require(_0x3856('0xe'));var deskjs=require(_0x3856('0xf'));var toCsv=require(_0x3856('0xa'));var querystring=require(_0x3856('0x10'));var Papa=require(_0x3856('0x11'));var Redis=require(_0x3856('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3856('0x13'));var hardwareService=require(_0x3856('0x14'));var logger=require(_0x3856('0x15'))(_0x3856('0x16'));var utils=require(_0x3856('0x17'));var config=require(_0x3856('0x18'));var db=require(_0x3856('0x19'))['db'];function respondWithStatusCode(_0x135cce,_0x5dbae2){_0x5dbae2=_0x5dbae2||0xcc;return function(_0x3f255f){if(_0x3f255f){return _0x135cce['sendStatus'](_0x5dbae2);}return _0x135cce['status'](_0x5dbae2)[_0x3856('0x1a')]();};}function respondWithResult(_0x4efd91,_0x783a31){_0x783a31=_0x783a31||0xc8;return function(_0x184dce){if(_0x184dce){return _0x4efd91['status'](_0x783a31)[_0x3856('0x1b')](_0x184dce);}};}function respondWithFilteredResult(_0x10547e,_0x49727b){return function(_0x5c6280){if(_0x5c6280){var _0x54b147=_0x5c6280[_0x3856('0x1c')],_0x39ea13=_0x49727b[_0x3856('0x1d')],_0x32ffe8=_0x49727b[_0x3856('0x1d')]+_0x49727b[_0x3856('0x1e')],_0x392921;if(_0x32ffe8>=_0x54b147){_0x32ffe8=_0x54b147;_0x392921=0xc8;}else{_0x392921=0xce;}_0x10547e[_0x3856('0x1f')](_0x392921);return _0x10547e[_0x3856('0x20')](_0x3856('0x21'),_0x39ea13+'-'+_0x32ffe8+'/'+_0x54b147)[_0x3856('0x1b')](_0x5c6280);}return null;};}function patchUpdates(_0x5c3d1c){return function(_0x1408f8){try{jsonpatch[_0x3856('0x22')](_0x1408f8,_0x5c3d1c,!![]);}catch(_0x58048c){return BPromise[_0x3856('0x23')](_0x58048c);}return _0x1408f8[_0x3856('0x24')]();};}function saveUpdates(_0x448edd,_0x13b515){return function(_0x4d7522){if(_0x4d7522){return _0x4d7522[_0x3856('0x25')](_0x448edd)[_0x3856('0x26')](function(_0x19dd8d){return _0x19dd8d;});}return null;};}function removeEntity(_0x31de4c,_0x2e9376){return function(_0x5310d7){if(_0x5310d7){return _0x5310d7['destroy']()[_0x3856('0x26')](function(){_0x31de4c[_0x3856('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c301,_0x53c31a){return function(_0x837ada){if(!_0x837ada){_0x53c301[_0x3856('0x27')](0x194);}return _0x837ada;};}function handleError(_0xa5db39,_0x20f1f1){_0x20f1f1=_0x20f1f1||0x1f4;return function(_0x1080dd){logger[_0x3856('0x28')](_0x1080dd[_0x3856('0x29')]);if(_0x1080dd[_0x3856('0x2a')]){delete _0x1080dd['name'];}_0xa5db39[_0x3856('0x1f')](_0x20f1f1)['send'](_0x1080dd);};}exports[_0x3856('0x2b')]=function(_0x5be938,_0x496fe3){var _0x2d88b8={},_0x481328={},_0x40c39c={'count':0x0,'rows':[]};var _0x50eb8e=_[_0x3856('0x2c')](db[_0x3856('0x2d')][_0x3856('0x2e')],function(_0x2472c5){return{'name':_0x2472c5[_0x3856('0x2f')],'type':_0x2472c5[_0x3856('0x30')][_0x3856('0x31')]};});_0x481328[_0x3856('0x32')]=_[_0x3856('0x2c')](_0x50eb8e,_0x3856('0x2a'));_0x481328[_0x3856('0x33')]=_[_0x3856('0x34')](_0x5be938[_0x3856('0x33')]);_0x481328[_0x3856('0x35')]=_[_0x3856('0x36')](_0x481328[_0x3856('0x32')],_0x481328[_0x3856('0x33')]);_0x2d88b8[_0x3856('0x37')]=_['intersection'](_0x481328[_0x3856('0x32')],qs[_0x3856('0x38')](_0x5be938[_0x3856('0x33')][_0x3856('0x38')]));_0x2d88b8[_0x3856('0x37')]=_0x2d88b8[_0x3856('0x37')][_0x3856('0x39')]?_0x2d88b8[_0x3856('0x37')]:_0x481328[_0x3856('0x32')];if(!_0x5be938[_0x3856('0x33')][_0x3856('0x3a')](_0x3856('0x3b'))){_0x2d88b8[_0x3856('0x1e')]=qs['limit'](_0x5be938['query'][_0x3856('0x1e')]);_0x2d88b8[_0x3856('0x1d')]=qs[_0x3856('0x1d')](_0x5be938[_0x3856('0x33')][_0x3856('0x1d')]);}_0x2d88b8[_0x3856('0x3c')]=qs[_0x3856('0x3d')](_0x5be938[_0x3856('0x33')]['sort']);_0x2d88b8[_0x3856('0x3e')]=qs[_0x3856('0x35')](_[_0x3856('0x3f')](_0x5be938[_0x3856('0x33')],_0x481328[_0x3856('0x35')]),_0x50eb8e);if(_0x5be938[_0x3856('0x33')]['filter']){_0x2d88b8[_0x3856('0x3e')]=_[_0x3856('0x40')](_0x2d88b8['where'],{'$or':_['map'](_0x50eb8e,function(_0x51e21e){if(_0x51e21e[_0x3856('0x30')]!=='VIRTUAL'){var _0x4d2881={};_0x4d2881[_0x51e21e[_0x3856('0x2a')]]={'$like':'%'+_0x5be938[_0x3856('0x33')]['filter']+'%'};return _0x4d2881;}})});}_0x2d88b8=_[_0x3856('0x40')]({},_0x2d88b8,_0x5be938[_0x3856('0x41')]);var _0x9b53cb={'where':_0x2d88b8[_0x3856('0x3e')]};return db['VoiceDialReport'][_0x3856('0x1c')](_0x9b53cb)[_0x3856('0x26')](function(_0x58a8a0){_0x40c39c[_0x3856('0x1c')]=_0x58a8a0;if(_0x5be938[_0x3856('0x33')]['includeAll']){_0x2d88b8[_0x3856('0x42')]=[{'all':!![]}];}return db[_0x3856('0x2d')][_0x3856('0x43')](_0x2d88b8);})[_0x3856('0x26')](function(_0x13ca9){_0x40c39c['rows']=_0x13ca9;return _0x40c39c;})['then'](respondWithFilteredResult(_0x496fe3,_0x2d88b8))[_0x3856('0x44')](handleError(_0x496fe3,null));};exports[_0x3856('0x45')]=function(_0x19ae14,_0x4048b6){var _0x3de7d1={'raw':!![],'where':{'id':_0x19ae14['params']['id']}},_0x51355d={};_0x51355d[_0x3856('0x32')]=_[_0x3856('0x34')](db[_0x3856('0x2d')]['rawAttributes']);_0x51355d[_0x3856('0x33')]=_['keys'](_0x19ae14[_0x3856('0x33')]);_0x51355d[_0x3856('0x35')]=_[_0x3856('0x36')](_0x51355d[_0x3856('0x32')],_0x51355d['query']);_0x3de7d1[_0x3856('0x37')]=_[_0x3856('0x36')](_0x51355d[_0x3856('0x32')],qs[_0x3856('0x38')](_0x19ae14['query'][_0x3856('0x38')]));_0x3de7d1[_0x3856('0x37')]=_0x3de7d1[_0x3856('0x37')]['length']?_0x3de7d1[_0x3856('0x37')]:_0x51355d['model'];if(_0x19ae14[_0x3856('0x33')][_0x3856('0x46')]){_0x3de7d1[_0x3856('0x42')]=[{'all':!![]}];}_0x3de7d1=_[_0x3856('0x40')]({},_0x3de7d1,_0x19ae14[_0x3856('0x41')]);return db[_0x3856('0x2d')][_0x3856('0x47')](_0x3de7d1)['then'](handleEntityNotFound(_0x4048b6,null))[_0x3856('0x26')](respondWithResult(_0x4048b6,null))[_0x3856('0x44')](handleError(_0x4048b6,null));};exports['create']=function(_0x133d2c,_0x32285f){return db['VoiceDialReport']['create'](_0x133d2c[_0x3856('0x48')],{})['then'](respondWithResult(_0x32285f,0xc9))[_0x3856('0x44')](handleError(_0x32285f,null));};exports[_0x3856('0x25')]=function(_0x3ff48d,_0x4fac74){if(_0x3ff48d[_0x3856('0x48')]['id']){delete _0x3ff48d[_0x3856('0x48')]['id'];}return db['VoiceDialReport'][_0x3856('0x47')]({'where':{'id':_0x3ff48d[_0x3856('0x49')]['id']}})['then'](handleEntityNotFound(_0x4fac74,null))[_0x3856('0x26')](saveUpdates(_0x3ff48d['body'],null))[_0x3856('0x26')](respondWithResult(_0x4fac74,null))[_0x3856('0x44')](handleError(_0x4fac74,null));};exports['destroy']=function(_0x5de102,_0x385739){return db[_0x3856('0x2d')][_0x3856('0x47')]({'where':{'id':_0x5de102[_0x3856('0x49')]['id']}})['then'](handleEntityNotFound(_0x385739,null))[_0x3856('0x26')](removeEntity(_0x385739,null))[_0x3856('0x44')](handleError(_0x385739,null));};exports[_0x3856('0x4a')]=function(_0x5502c3,_0x43c231){return db[_0x3856('0x2d')][_0x3856('0x4a')]()[_0x3856('0x26')](respondWithResult(_0x43c231,null))[_0x3856('0x44')](handleError(_0x43c231,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index fd6a475..6df12b4 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 _0xad3a=['report_dial','uniqueid','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x43007c,_0x2cc132){var _0x4606e3=function(_0x29b454){while(--_0x29b454){_0x43007c['push'](_0x43007c['shift']());}};_0x4606e3(++_0x2cc132);}(_0xad3a,0xd2));var _0xaad3=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0xad3a[_0xb833b1];return _0x1ab87a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaad3('0x0'))('api');var moment=require(_0xaad3('0x1'));var BPromise=require(_0xaad3('0x2'));var rp=require(_0xaad3('0x3'));var fs=require('fs');var path=require(_0xaad3('0x4'));var rimraf=require(_0xaad3('0x5'));var config=require(_0xaad3('0x6'));var attributes=require(_0xaad3('0x7'));module[_0xaad3('0x8')]=function(_0xf5a781,_0x38d0ec){return _0xf5a781[_0xaad3('0x9')](_0xaad3('0xa'),attributes,{'tableName':_0xaad3('0xb'),'paranoid':![],'indexes':[{'fields':[_0xaad3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe489=['rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x29d8d1,_0x47da44){var _0x21f1e2=function(_0x436792){while(--_0x436792){_0x29d8d1['push'](_0x29d8d1['shift']());}};_0x21f1e2(++_0x47da44);}(_0xe489,0x15c));var _0x9e48=function(_0xfc01fc,_0x5b1259){_0xfc01fc=_0xfc01fc-0x0;var _0x271c17=_0xe489[_0xfc01fc];return _0x271c17;};'use strict';var _=require('lodash');var util=require(_0x9e48('0x0'));var logger=require(_0x9e48('0x1'))(_0x9e48('0x2'));var moment=require('moment');var BPromise=require(_0x9e48('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e48('0x4'));var config=require(_0x9e48('0x5'));var attributes=require(_0x9e48('0x6'));module['exports']=function(_0x2c86db,_0x135962){return _0x2c86db[_0x9e48('0x7')](_0x9e48('0x8'),attributes,{'tableName':_0x9e48('0x9'),'paranoid':![],'indexes':[{'fields':[_0x9e48('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a4ce57b..574338b 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 _0x36f1=['VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','where','attributes','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x5159ce,_0x664731){var _0x5f4c02=function(_0x380d3b){while(--_0x380d3b){_0x5159ce['push'](_0x5159ce['shift']());}};_0x5f4c02(++_0x664731);}(_0x36f1,0xb0));var _0x136f=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x36f1[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x136f('0x0'));var util=require('util');var moment=require(_0x136f('0x1'));var BPromise=require('bluebird');var rs=require(_0x136f('0x2'));var fs=require('fs');var Redis=require(_0x136f('0x3'));var db=require(_0x136f('0x4'))['db'];var utils=require(_0x136f('0x5'));var logger=require(_0x136f('0x6'))(_0x136f('0x7'));var config=require(_0x136f('0x8'));var jayson=require(_0x136f('0x9'));var client=jayson[_0x136f('0xa')][_0x136f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x525663,_0x2e05cf,_0x29e9c5){return new BPromise(function(_0x3c7a1c,_0x48e3d2){return client[_0x136f('0xc')](_0x525663,_0x29e9c5)[_0x136f('0xd')](function(_0x51d57){logger[_0x136f('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x2e05cf,'request\x20sent');logger[_0x136f('0xf')](_0x136f('0x10'),_0x2e05cf,_0x136f('0x11'),JSON['stringify'](_0x51d57));if(_0x51d57['error']){if(_0x51d57[_0x136f('0x12')][_0x136f('0x13')]===0x1f4){logger[_0x136f('0x12')](_0x136f('0x14'),_0x2e05cf,_0x51d57[_0x136f('0x12')]['message']);return _0x48e3d2(_0x51d57['error'][_0x136f('0x15')]);}logger[_0x136f('0x12')](_0x136f('0x14'),_0x2e05cf,_0x51d57['error'][_0x136f('0x15')]);return _0x3c7a1c(_0x51d57[_0x136f('0x12')][_0x136f('0x15')]);}else{logger[_0x136f('0xe')](_0x136f('0x14'),_0x2e05cf,_0x136f('0x11'));_0x3c7a1c(_0x51d57[_0x136f('0x16')][_0x136f('0x15')]);}})['catch'](function(_0x16d69a){logger[_0x136f('0x12')](_0x136f('0x14'),_0x2e05cf,_0x16d69a);_0x48e3d2(_0x16d69a);});});}exports[_0x136f('0x17')]=function(_0x3e2b02){var _0x1cd7e5=this;return new Promise(function(_0x54b793,_0xcdab1){return db[_0x136f('0x18')]['create'](_0x3e2b02[_0x136f('0x19')],{'raw':_0x3e2b02[_0x136f('0x1a')]?_0x3e2b02[_0x136f('0x1a')][_0x136f('0x1b')]===undefined?!![]:![]:!![]})[_0x136f('0xd')](function(_0x372f55){logger['info'](_0x136f('0x17'),_0x3e2b02);logger[_0x136f('0xf')](_0x136f('0x17'),_0x3e2b02,JSON['stringify'](_0x372f55));_0x54b793(_0x372f55);})['catch'](function(_0xa0416a){logger['error']('CreateVoiceDialReport',_0xa0416a[_0x136f('0x15')],_0x3e2b02);_0xcdab1(_0x1cd7e5[_0x136f('0x12')](0x1f4,_0xa0416a['message']));});});};exports[_0x136f('0x1c')]=function(_0x34f467){var _0x22bba7=this;return new Promise(function(_0x523639,_0x115ad5){return db[_0x136f('0x18')]['update'](_0x34f467[_0x136f('0x19')],{'raw':_0x34f467[_0x136f('0x1a')]?_0x34f467['options'][_0x136f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34f467[_0x136f('0x1a')]?_0x34f467[_0x136f('0x1a')][_0x136f('0x1d')]||null:null,'attributes':_0x34f467['options']?_0x34f467[_0x136f('0x1a')][_0x136f('0x1e')]||null:null,'limit':_0x34f467[_0x136f('0x1a')]?_0x34f467[_0x136f('0x1a')]['limit']||null:null})[_0x136f('0xd')](function(_0x18ef58){logger[_0x136f('0xe')](_0x136f('0x1c'),_0x34f467);logger[_0x136f('0xf')](_0x136f('0x1c'),_0x34f467,JSON['stringify'](_0x18ef58));_0x523639(_0x18ef58);})[_0x136f('0x1f')](function(_0xb09aa5){logger[_0x136f('0x12')]('UpdateVoiceDialReport',_0xb09aa5[_0x136f('0x15')],_0x34f467);_0x115ad5(_0x22bba7['error'](0x1f4,_0xb09aa5[_0x136f('0x15')]));});});}; \ No newline at end of file +var _0x2356=['moment','ioredis','../../mysqldb','rpc','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','UpdateVoiceDialReport','update','raw','attributes','limit','util'];(function(_0x1076c0,_0x172051){var _0x47881b=function(_0x4d9a70){while(--_0x4d9a70){_0x1076c0['push'](_0x1076c0['shift']());}};_0x47881b(++_0x172051);}(_0x2356,0x14f));var _0x6235=function(_0xfabeb9,_0xfbe66d){_0xfabeb9=_0xfabeb9-0x0;var _0x1ff5fd=_0x2356[_0xfabeb9];return _0x1ff5fd;};'use strict';var _=require('lodash');var util=require(_0x6235('0x0'));var moment=require(_0x6235('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6235('0x2'));var db=require(_0x6235('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6235('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6235('0x5')][_0x6235('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3663e7,_0x47f3a5,_0x4c15c6){return new BPromise(function(_0x547159,_0x3a5750){return client['request'](_0x3663e7,_0x4c15c6)[_0x6235('0x7')](function(_0x11d1f9){logger[_0x6235('0x8')](_0x6235('0x9'),_0x47f3a5,'request\x20sent');logger[_0x6235('0xa')](_0x6235('0xb'),_0x47f3a5,_0x6235('0xc'),JSON[_0x6235('0xd')](_0x11d1f9));if(_0x11d1f9[_0x6235('0xe')]){if(_0x11d1f9['error'][_0x6235('0xf')]===0x1f4){logger[_0x6235('0xe')](_0x6235('0x9'),_0x47f3a5,_0x11d1f9[_0x6235('0xe')]['message']);return _0x3a5750(_0x11d1f9[_0x6235('0xe')][_0x6235('0x10')]);}logger['error'](_0x6235('0x9'),_0x47f3a5,_0x11d1f9['error'][_0x6235('0x10')]);return _0x547159(_0x11d1f9[_0x6235('0xe')]['message']);}else{logger[_0x6235('0x8')](_0x6235('0x9'),_0x47f3a5,_0x6235('0xc'));_0x547159(_0x11d1f9[_0x6235('0x11')]['message']);}})[_0x6235('0x12')](function(_0x190d7c){logger[_0x6235('0xe')](_0x6235('0x9'),_0x47f3a5,_0x190d7c);_0x3a5750(_0x190d7c);});});}exports[_0x6235('0x13')]=function(_0x2a3554){var _0x3f7e2e=this;return new Promise(function(_0x22f090,_0x26c3b8){return db[_0x6235('0x14')]['create'](_0x2a3554[_0x6235('0x15')],{'raw':_0x2a3554[_0x6235('0x16')]?_0x2a3554['options']['raw']===undefined?!![]:![]:!![]})[_0x6235('0x7')](function(_0x4f0aa2){logger['info']('CreateVoiceDialReport',_0x2a3554);logger[_0x6235('0xa')](_0x6235('0x13'),_0x2a3554,JSON[_0x6235('0xd')](_0x4f0aa2));_0x22f090(_0x4f0aa2);})[_0x6235('0x12')](function(_0x24c057){logger[_0x6235('0xe')]('CreateVoiceDialReport',_0x24c057['message'],_0x2a3554);_0x26c3b8(_0x3f7e2e[_0x6235('0xe')](0x1f4,_0x24c057['message']));});});};exports[_0x6235('0x17')]=function(_0x1bed65){var _0x2ac036=this;return new Promise(function(_0x339d58,_0x3eea59){return db['VoiceDialReport'][_0x6235('0x18')](_0x1bed65[_0x6235('0x15')],{'raw':_0x1bed65[_0x6235('0x16')]?_0x1bed65[_0x6235('0x16')][_0x6235('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bed65['options']?_0x1bed65['options']['where']||null:null,'attributes':_0x1bed65['options']?_0x1bed65[_0x6235('0x16')][_0x6235('0x1a')]||null:null,'limit':_0x1bed65[_0x6235('0x16')]?_0x1bed65[_0x6235('0x16')][_0x6235('0x1b')]||null:null})[_0x6235('0x7')](function(_0x59bb16){logger['info']('UpdateVoiceDialReport',_0x1bed65);logger[_0x6235('0xa')]('UpdateVoiceDialReport',_0x1bed65,JSON[_0x6235('0xd')](_0x59bb16));_0x339d58(_0x59bb16);})[_0x6235('0x12')](function(_0x570d16){logger[_0x6235('0xe')](_0x6235('0x17'),_0x570d16['message'],_0x1bed65);_0x3eea59(_0x2ac036[_0x6235('0xe')](0x1f4,_0x570d16[_0x6235('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index dc4120f..586f891 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 _0xa5a4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','exports','multer','path'];(function(_0x56ed61,_0x3d2285){var _0x437ea6=function(_0x3b289d){while(--_0x3b289d){_0x56ed61['push'](_0x56ed61['shift']());}};_0x437ea6(++_0x3d2285);}(_0xa5a4,0x14e));var _0x4a5a=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xa5a4[_0x1344d6];return _0xf45b24;};'use strict';var multer=require(_0x4a5a('0x0'));var util=require('util');var path=require(_0x4a5a('0x1'));var timeout=require(_0x4a5a('0x2'));var express=require(_0x4a5a('0x3'));var router=express[_0x4a5a('0x4')]();var auth=require(_0x4a5a('0x5'));var interaction=require(_0x4a5a('0x6'));var config=require(_0x4a5a('0x7'));var controller=require('./voiceExtension.controller');router[_0x4a5a('0x8')]('/',auth[_0x4a5a('0x9')](),controller[_0x4a5a('0xa')]);router['get'](_0x4a5a('0xb'),auth['isAuthenticated'](),controller[_0x4a5a('0xc')]);router[_0x4a5a('0xd')]('/',auth[_0x4a5a('0x9')](),controller[_0x4a5a('0xe')]);router[_0x4a5a('0xd')](_0x4a5a('0xf'),auth['isAuthenticated'](),controller[_0x4a5a('0x10')]);router[_0x4a5a('0x11')]('/:id',auth[_0x4a5a('0x9')](),controller['update']);router[_0x4a5a('0x12')](_0x4a5a('0xb'),auth[_0x4a5a('0x9')](),controller[_0x4a5a('0x13')]);module[_0x4a5a('0x14')]=router; \ No newline at end of file +var _0xacbe=['post','create','/:id/applications','addApplications','put','update','delete','util','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/:id'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xacbe,0x8e));var _0xeacb=function(_0x4d0fa2,_0x539cb0){_0x4d0fa2=_0x4d0fa2-0x0;var _0x51969b=_0xacbe[_0x4d0fa2];return _0x51969b;};'use strict';var multer=require('multer');var util=require(_0xeacb('0x0'));var path=require('path');var timeout=require(_0xeacb('0x1'));var express=require(_0xeacb('0x2'));var router=express[_0xeacb('0x3')]();var auth=require(_0xeacb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xeacb('0x5')]('/',auth[_0xeacb('0x6')](),controller['index']);router[_0xeacb('0x5')](_0xeacb('0x7'),auth[_0xeacb('0x6')](),controller['show']);router[_0xeacb('0x8')]('/',auth['isAuthenticated'](),controller[_0xeacb('0x9')]);router[_0xeacb('0x8')](_0xeacb('0xa'),auth[_0xeacb('0x6')](),controller[_0xeacb('0xb')]);router[_0xeacb('0xc')](_0xeacb('0x7'),auth[_0xeacb('0x6')](),controller[_0xeacb('0xd')]);router[_0xeacb('0xe')](_0xeacb('0x7'),auth[_0xeacb('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 41dcce8..c982710 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(_0x417680,_0x3237e8){var _0x20553f=function(_0x20da5d){while(--_0x20da5d){_0x417680['push'](_0x417680['shift']());}};_0x20553f(++_0x3237e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0xaac950,_0x442e66){var _0x45e1b4=function(_0x449575){while(--_0x449575){_0xaac950['push'](_0xaac950['shift']());}};_0x45e1b4(++_0x442e66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 175f3d8..cfa4700 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 _0xe2fe=['VoiceExtension','includeAll','include','findAll','catch','show','params','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','ignore','map','value','includes','type','find','name','UserProfileResource','error','send','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x270cc1,_0x36f185){var _0x197c24=function(_0x37c71e){while(--_0x37c71e){_0x270cc1['push'](_0x270cc1['shift']());}};_0x197c24(++_0x36f185);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xee2f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee2f('0x2'));var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var Mustache=require(_0xee2f('0x5'));var util=require(_0xee2f('0x6'));var path=require('path');var sox=require(_0xee2f('0x7'));var csv=require(_0xee2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x8'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xee2f('0x10')]=_[_0xee2f('0x11')](config[_0xee2f('0x10')],{'host':_0xee2f('0x12'),'port':0x18eb});var socket=require(_0xee2f('0x13'))(new Redis(config[_0xee2f('0x10')]));require('./voiceExtension.socket')[_0xee2f('0x14')](socket);function respondWithStatusCode(_0x531c3a,_0x36db10){_0x36db10=_0x36db10||0xcc;return function(_0x271c1d){if(_0x271c1d){return _0x531c3a['sendStatus'](_0x36db10);}return _0x531c3a[_0xee2f('0x15')](_0x36db10)[_0xee2f('0x16')]();};}function respondWithResult(_0x28b614,_0x1bbf7d){_0x1bbf7d=_0x1bbf7d||0xc8;return function(_0x390c2c){if(_0x390c2c){return _0x28b614['status'](_0x1bbf7d)[_0xee2f('0x17')](_0x390c2c);}};}function respondWithFilteredResult(_0x4afcd1,_0x17d288){return function(_0x3359ff){if(_0x3359ff){var _0x502eb6=_0x3359ff[_0xee2f('0x18')],_0x550da7=_0x17d288[_0xee2f('0x19')],_0x40b5bc=_0x17d288[_0xee2f('0x19')]+_0x17d288['limit'],_0x5a5078;if(_0x40b5bc>=_0x502eb6){_0x40b5bc=_0x502eb6;_0x5a5078=0xc8;}else{_0x5a5078=0xce;}_0x4afcd1[_0xee2f('0x15')](_0x5a5078);return _0x4afcd1[_0xee2f('0x1a')](_0xee2f('0x1b'),_0x550da7+'-'+_0x40b5bc+'/'+_0x502eb6)[_0xee2f('0x17')](_0x3359ff);}return null;};}function patchUpdates(_0x3d892d){return function(_0x5d36d4){try{jsonpatch['apply'](_0x5d36d4,_0x3d892d,!![]);}catch(_0x40d1fd){return BPromise[_0xee2f('0x1c')](_0x40d1fd);}return _0x5d36d4[_0xee2f('0x1d')]();};}function saveUpdates(_0x203b2f,_0x472e3b){return function(_0xf278cc){if(_0xf278cc){return _0xf278cc[_0xee2f('0x1e')](_0x203b2f)['then'](function(_0x250399){return _0x250399;});}return null;};}function removeEntity(_0x2c47c5,_0x15ceda){return function(_0x70e308){if(_0x70e308){return _0x70e308[_0xee2f('0x1f')]()[_0xee2f('0x20')](function(){var _0x15a1b1=_0x70e308[_0xee2f('0x21')]({'plain':!![]});var _0x382174=[{'name':_0xee2f('0x22'),'value':_0xee2f('0x23'),'ignore':![]},{'name':_0xee2f('0x24'),'value':_0xee2f('0x25'),'ignore':![]},{'name':_0xee2f('0x26'),'value':'internal','ignore':![]}];var _0x4ef690=_(_0x382174)['filter'](_0xee2f('0x27'))[_0xee2f('0x28')](_0xee2f('0x29'))[_0xee2f('0x29')]();if(_[_0xee2f('0x2a')](_0x4ef690,_0x15a1b1[_0xee2f('0x2b')])){return;}var _0x4d8398=_[_0xee2f('0x2c')](_0x382174,['value',_0x15a1b1[_0xee2f('0x2b')]])[_0xee2f('0x2d')];return db[_0xee2f('0x2e')][_0xee2f('0x1f')]({'where':{'type':_0x4d8398,'resourceId':_0x15a1b1['id']}})[_0xee2f('0x20')](function(){return _0x70e308;});})['then'](function(){_0x2c47c5[_0xee2f('0x15')](0xcc)[_0xee2f('0x16')]();});}};}function handleEntityNotFound(_0x56706e,_0x4ee0e1){return function(_0xd1aaac){if(!_0xd1aaac){_0x56706e['sendStatus'](0x194);}return _0xd1aaac;};}function handleError(_0x33c426,_0xc447e){_0xc447e=_0xc447e||0x1f4;return function(_0x53d9b7){logger[_0xee2f('0x2f')](_0x53d9b7['stack']);if(_0x53d9b7['name']){delete _0x53d9b7['name'];}_0x33c426[_0xee2f('0x15')](_0xc447e)[_0xee2f('0x30')](_0x53d9b7);};}exports['index']=function(_0x39f224,_0x1b70cc){var _0xd64b7={},_0x32cadb={},_0x1c3a01={'count':0x0,'rows':[]};var _0x4e682d=_[_0xee2f('0x28')](db['VoiceExtension'][_0xee2f('0x31')],function(_0x86cad4){return{'name':_0x86cad4[_0xee2f('0x32')],'type':_0x86cad4['type'][_0xee2f('0x33')]};});_0x32cadb['model']=_[_0xee2f('0x28')](_0x4e682d,'name');_0x32cadb[_0xee2f('0x34')]=_[_0xee2f('0x35')](_0x39f224[_0xee2f('0x34')]);_0x32cadb[_0xee2f('0x36')]=_[_0xee2f('0x37')](_0x32cadb[_0xee2f('0x38')],_0x32cadb[_0xee2f('0x34')]);_0xd64b7[_0xee2f('0x39')]=_[_0xee2f('0x37')](_0x32cadb[_0xee2f('0x38')],qs[_0xee2f('0x3a')](_0x39f224['query'][_0xee2f('0x3a')]));_0xd64b7['attributes']=_0xd64b7[_0xee2f('0x39')][_0xee2f('0x3b')]?_0xd64b7[_0xee2f('0x39')]:_0x32cadb[_0xee2f('0x38')];if(!_0x39f224[_0xee2f('0x34')][_0xee2f('0x3c')](_0xee2f('0x3d'))){_0xd64b7[_0xee2f('0x3e')]=qs['limit'](_0x39f224['query']['limit']);_0xd64b7[_0xee2f('0x19')]=qs['offset'](_0x39f224[_0xee2f('0x34')]['offset']);}_0xd64b7['order']=qs['sort'](_0x39f224['query'][_0xee2f('0x3f')]);_0xd64b7[_0xee2f('0x40')]=qs[_0xee2f('0x36')](_[_0xee2f('0x41')](_0x39f224['query'],_0x32cadb['filters']),_0x4e682d);if(_0x39f224[_0xee2f('0x34')]['filter']){_0xd64b7['where']=_[_0xee2f('0x42')](_0xd64b7[_0xee2f('0x40')],{'$or':_[_0xee2f('0x28')](_0x4e682d,function(_0x54130b){if(_0x54130b[_0xee2f('0x2b')]!==_0xee2f('0x43')){var _0x19bd4d={};_0x19bd4d[_0x54130b['name']]={'$like':'%'+_0x39f224['query'][_0xee2f('0x44')]+'%'};return _0x19bd4d;}})});}_0xd64b7=_[_0xee2f('0x42')]({},_0xd64b7,_0x39f224[_0xee2f('0x45')]);var _0x2b9b33={'where':_0xd64b7['where']};return db[_0xee2f('0x46')][_0xee2f('0x18')](_0x2b9b33)[_0xee2f('0x20')](function(_0x29dbec){_0x1c3a01[_0xee2f('0x18')]=_0x29dbec;if(_0x39f224[_0xee2f('0x34')][_0xee2f('0x47')]){_0xd64b7[_0xee2f('0x48')]=[{'all':!![]}];}return db[_0xee2f('0x46')][_0xee2f('0x49')](_0xd64b7);})['then'](function(_0x4c1cb4){_0x1c3a01['rows']=_0x4c1cb4;return _0x1c3a01;})['then'](respondWithFilteredResult(_0x1b70cc,_0xd64b7))[_0xee2f('0x4a')](handleError(_0x1b70cc,null));};exports[_0xee2f('0x4b')]=function(_0x34ce9c,_0x12aaa0){var _0x1dbf81={'raw':![],'where':{'id':_0x34ce9c[_0xee2f('0x4c')]['id']}},_0x556239={};_0x556239[_0xee2f('0x38')]=_[_0xee2f('0x35')](db[_0xee2f('0x46')]['rawAttributes']);_0x556239['query']=_['keys'](_0x34ce9c[_0xee2f('0x34')]);_0x556239['filters']=_['intersection'](_0x556239['model'],_0x556239['query']);_0x1dbf81[_0xee2f('0x39')]=_[_0xee2f('0x37')](_0x556239[_0xee2f('0x38')],qs['fields'](_0x34ce9c[_0xee2f('0x34')]['fields']));_0x1dbf81[_0xee2f('0x39')]=_0x1dbf81[_0xee2f('0x39')][_0xee2f('0x3b')]?_0x1dbf81[_0xee2f('0x39')]:_0x556239[_0xee2f('0x38')];if(_0x34ce9c['query']['includeAll']){_0x1dbf81[_0xee2f('0x48')]=[{'all':!![]}];}_0x1dbf81=_['merge']({},_0x1dbf81,_0x34ce9c[_0xee2f('0x45')]);return db[_0xee2f('0x46')][_0xee2f('0x2c')](_0x1dbf81)[_0xee2f('0x20')](handleEntityNotFound(_0x12aaa0,null))['then'](respondWithResult(_0x12aaa0,null))['catch'](handleError(_0x12aaa0,null));};exports[_0xee2f('0x1f')]=function(_0xf4aa97,_0x1b00a8){return db[_0xee2f('0x46')][_0xee2f('0x2c')]({'where':{'id':_0xf4aa97[_0xee2f('0x4c')]['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0x1b00a8,null))[_0xee2f('0x20')](removeEntity(_0x1b00a8,null))[_0xee2f('0x4a')](handleError(_0x1b00a8,null));};exports[_0xee2f('0x4d')]=function(_0x47270a,_0x88bba5){if(_0x47270a['body'][_0xee2f('0x2b')]===_0xee2f('0x25')&&!_[_0xee2f('0x4e')](_0x47270a[_0xee2f('0x4f')]['exten'],'_')){_0x47270a[_0xee2f('0x4f')][_0xee2f('0x50')]='_'[_0xee2f('0x51')](_0x47270a[_0xee2f('0x4f')][_0xee2f('0x50')]);}return db['VoiceExtension'][_0xee2f('0x4d')](_0x47270a['body'],{'raw':![]})['then'](function(_0x1c9f50){var _0x3080a9=_0x47270a[_0xee2f('0x52')][_0xee2f('0x21')]({'plain':!![]});if(!_0x3080a9)throw new Error(_0xee2f('0x53'));if(_0x3080a9[_0xee2f('0x54')]===_0xee2f('0x52')){var _0x53cb60=_0x1c9f50[_0xee2f('0x21')]({'plain':!![]});var _0x5e8fdb=[{'name':_0xee2f('0x22'),'value':_0xee2f('0x23')},{'name':_0xee2f('0x24'),'value':_0xee2f('0x25')},{'name':_0xee2f('0x26'),'value':_0xee2f('0x55')}];var _0x1373a1=_['find'](_0x5e8fdb,[_0xee2f('0x29'),_0x53cb60['type']])[_0xee2f('0x2d')];return db[_0xee2f('0x56')][_0xee2f('0x2c')]({'where':{'name':_0x1373a1,'userProfileId':_0x3080a9[_0xee2f('0x57')]},'raw':!![]})[_0xee2f('0x20')](function(_0x5ee444){if(_0x5ee444&&_0x5ee444[_0xee2f('0x58')]===0x0){return db[_0xee2f('0x2e')][_0xee2f('0x4d')]({'name':_0x53cb60[_0xee2f('0x2d')],'resourceId':_0x53cb60['id'],'type':_0x5ee444['name'],'sectionId':_0x5ee444['id']},{})['then'](function(){return _0x1c9f50;});}else{return _0x1c9f50;}})['catch'](function(_0x551aa1){logger['error'](_0xee2f('0x59'),_0x551aa1);throw _0x551aa1;});}return _0x1c9f50;})['then'](respondWithResult(_0x88bba5,0xc9))[_0xee2f('0x4a')](handleError(_0x88bba5,null));};exports[_0xee2f('0x1e')]=function(_0xd967e9,_0x1d1476){if(_0xd967e9[_0xee2f('0x4f')]['id']){delete _0xd967e9[_0xee2f('0x4f')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0xd967e9[_0xee2f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1d1476,null))[_0xee2f('0x20')](function(_0x5c4601){if(_0x5c4601){return db[_0xee2f('0x46')]['update'](_[_0xee2f('0x41')](_0xd967e9[_0xee2f('0x4f')],[_0xee2f('0x50'),'context',_0xee2f('0x5a'),_0xee2f('0x5b'),_0xee2f('0x5c'),_0xee2f('0x5d')]),{'where':{'context':_0x5c4601[_0xee2f('0x5e')],'exten':_0x5c4601[_0xee2f('0x50')]},'individualHooks':!![]})[_0xee2f('0x20')](function(_0x54f48f){return _0x54f48f;});}return null;})[_0xee2f('0x20')](respondWithStatusCode(_0x1d1476,null))[_0xee2f('0x4a')](handleError(_0x1d1476,null));};exports[_0xee2f('0x5f')]=function(_0x353bd9,_0x5280c7,_0x3c9d47){return db[_0xee2f('0x46')][_0xee2f('0x60')]({'where':{'id':_0x353bd9[_0xee2f('0x4c')]['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0x5280c7,null))[_0xee2f('0x20')](function(_0x5a7adc){if(_0x5a7adc){return db[_0xee2f('0x61')][_0xee2f('0x62')](function(_0x54b9fb){return db[_0xee2f('0x46')]['destroy']({'where':{'VoiceExtensionId':_0x353bd9[_0xee2f('0x4c')]['id']},'transaction':_0x54b9fb})['then'](function(_0x4bf53d){var _0x465acd=_[_0xee2f('0x28')](_0x353bd9[_0xee2f('0x4f')],function(_0x3dd46e){_0x3dd46e[_0xee2f('0x63')]=_0x353bd9['params']['id'];return _0x3dd46e;});return db[_0xee2f('0x46')][_0xee2f('0x64')](_0x465acd,{'transaction':_0x54b9fb});});})[_0xee2f('0x20')](function(){return db['VoiceExtension'][_0xee2f('0x65')]({'where':{'isApp':!![],'VoiceExtensionId':_0x353bd9[_0xee2f('0x4c')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xee2f('0x20')](respondWithResult(_0x5280c7,null))[_0xee2f('0x4a')](handleError(_0x5280c7,null));}; \ No newline at end of file +var _0xd943=['internal','filter','ignore','map','value','type','UserProfileResource','error','name','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','where','filters','pick','merge','includeAll','include','rows','catch','show','params','options','find','body','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','context','findOne','sequelize','transaction','VoiceExtensionId','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','InboundRoutes','inbound','outbound'];(function(_0x277d06,_0x1ef6d2){var _0x5c3c68=function(_0x46fd9c){while(--_0x46fd9c){_0x277d06['push'](_0x277d06['shift']());}};_0x5c3c68(++_0x1ef6d2);}(_0xd943,0x15d));var _0x3d94=function(_0x35d18c,_0xc172ab){_0x35d18c=_0x35d18c-0x0;var _0x161122=_0xd943[_0x35d18c];return _0x161122;};'use strict';var pdf=require(_0x3d94('0x0'));var emlformat=require(_0x3d94('0x1'));var rimraf=require(_0x3d94('0x2'));var zipdir=require(_0x3d94('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d94('0x4'));var moment=require(_0x3d94('0x5'));var BPromise=require(_0x3d94('0x6'));var Mustache=require(_0x3d94('0x7'));var util=require(_0x3d94('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3d94('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var db=require(_0x3d94('0x14'))['db'];config[_0x3d94('0x15')]=_[_0x3d94('0x16')](config['redis'],{'host':_0x3d94('0x17'),'port':0x18eb});var socket=require(_0x3d94('0x18'))(new Redis(config[_0x3d94('0x15')]));require('./voiceExtension.socket')[_0x3d94('0x19')](socket);function respondWithStatusCode(_0x29608d,_0x7d6969){_0x7d6969=_0x7d6969||0xcc;return function(_0x5d9366){if(_0x5d9366){return _0x29608d[_0x3d94('0x1a')](_0x7d6969);}return _0x29608d[_0x3d94('0x1b')](_0x7d6969)[_0x3d94('0x1c')]();};}function respondWithResult(_0x34098e,_0xaf939a){_0xaf939a=_0xaf939a||0xc8;return function(_0xd8efaa){if(_0xd8efaa){return _0x34098e[_0x3d94('0x1b')](_0xaf939a)[_0x3d94('0x1d')](_0xd8efaa);}};}function respondWithFilteredResult(_0x540658,_0x22676a){return function(_0x1a9315){if(_0x1a9315){var _0x2acee3=_0x1a9315[_0x3d94('0x1e')],_0x1c35a8=_0x22676a['offset'],_0x4afc92=_0x22676a[_0x3d94('0x1f')]+_0x22676a['limit'],_0x3ca0e3;if(_0x4afc92>=_0x2acee3){_0x4afc92=_0x2acee3;_0x3ca0e3=0xc8;}else{_0x3ca0e3=0xce;}_0x540658[_0x3d94('0x1b')](_0x3ca0e3);return _0x540658[_0x3d94('0x20')](_0x3d94('0x21'),_0x1c35a8+'-'+_0x4afc92+'/'+_0x2acee3)[_0x3d94('0x1d')](_0x1a9315);}return null;};}function patchUpdates(_0x35a3cc){return function(_0x4f0beb){try{jsonpatch['apply'](_0x4f0beb,_0x35a3cc,!![]);}catch(_0x1406e9){return BPromise[_0x3d94('0x22')](_0x1406e9);}return _0x4f0beb[_0x3d94('0x23')]();};}function saveUpdates(_0x4edee4,_0x30af25){return function(_0x2e8c91){if(_0x2e8c91){return _0x2e8c91[_0x3d94('0x24')](_0x4edee4)[_0x3d94('0x25')](function(_0x395133){return _0x395133;});}return null;};}function removeEntity(_0x4093a4,_0x295493){return function(_0x27f978){if(_0x27f978){return _0x27f978[_0x3d94('0x26')]()[_0x3d94('0x25')](function(){var _0x30368c=_0x27f978[_0x3d94('0x27')]({'plain':!![]});var _0x292976=[{'name':_0x3d94('0x28'),'value':_0x3d94('0x29'),'ignore':![]},{'name':'OutboundRoutes','value':_0x3d94('0x2a'),'ignore':![]},{'name':'InternalRoutes','value':_0x3d94('0x2b'),'ignore':![]}];var _0x1d0a7a=_(_0x292976)[_0x3d94('0x2c')](_0x3d94('0x2d'))[_0x3d94('0x2e')](_0x3d94('0x2f'))[_0x3d94('0x2f')]();if(_['includes'](_0x1d0a7a,_0x30368c['type'])){return;}var _0x362642=_['find'](_0x292976,['value',_0x30368c[_0x3d94('0x30')]])['name'];return db[_0x3d94('0x31')][_0x3d94('0x26')]({'where':{'type':_0x362642,'resourceId':_0x30368c['id']}})[_0x3d94('0x25')](function(){return _0x27f978;});})['then'](function(){_0x4093a4[_0x3d94('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4994,_0x53db78){return function(_0x1c19b1){if(!_0x1c19b1){_0x3d4994[_0x3d94('0x1a')](0x194);}return _0x1c19b1;};}function handleError(_0x29b1ff,_0x246f88){_0x246f88=_0x246f88||0x1f4;return function(_0x50560c){logger[_0x3d94('0x32')](_0x50560c['stack']);if(_0x50560c[_0x3d94('0x33')]){delete _0x50560c[_0x3d94('0x33')];}_0x29b1ff['status'](_0x246f88)['send'](_0x50560c);};}exports[_0x3d94('0x34')]=function(_0x280c73,_0x273337){var _0x5cdb2e={},_0x1e6dbc={},_0x3d29fd={'count':0x0,'rows':[]};var _0x5426bd=_[_0x3d94('0x2e')](db[_0x3d94('0x35')][_0x3d94('0x36')],function(_0xbda334){return{'name':_0xbda334[_0x3d94('0x37')],'type':_0xbda334['type'][_0x3d94('0x38')]};});_0x1e6dbc[_0x3d94('0x39')]=_[_0x3d94('0x2e')](_0x5426bd,_0x3d94('0x33'));_0x1e6dbc[_0x3d94('0x3a')]=_[_0x3d94('0x3b')](_0x280c73['query']);_0x1e6dbc['filters']=_[_0x3d94('0x3c')](_0x1e6dbc[_0x3d94('0x39')],_0x1e6dbc[_0x3d94('0x3a')]);_0x5cdb2e[_0x3d94('0x3d')]=_[_0x3d94('0x3c')](_0x1e6dbc[_0x3d94('0x39')],qs[_0x3d94('0x3e')](_0x280c73[_0x3d94('0x3a')][_0x3d94('0x3e')]));_0x5cdb2e[_0x3d94('0x3d')]=_0x5cdb2e['attributes'][_0x3d94('0x3f')]?_0x5cdb2e[_0x3d94('0x3d')]:_0x1e6dbc[_0x3d94('0x39')];if(!_0x280c73[_0x3d94('0x3a')]['hasOwnProperty'](_0x3d94('0x40'))){_0x5cdb2e[_0x3d94('0x41')]=qs[_0x3d94('0x41')](_0x280c73[_0x3d94('0x3a')][_0x3d94('0x41')]);_0x5cdb2e['offset']=qs[_0x3d94('0x1f')](_0x280c73[_0x3d94('0x3a')][_0x3d94('0x1f')]);}_0x5cdb2e['order']=qs['sort'](_0x280c73['query']['sort']);_0x5cdb2e[_0x3d94('0x42')]=qs[_0x3d94('0x43')](_[_0x3d94('0x44')](_0x280c73[_0x3d94('0x3a')],_0x1e6dbc[_0x3d94('0x43')]),_0x5426bd);if(_0x280c73[_0x3d94('0x3a')][_0x3d94('0x2c')]){_0x5cdb2e['where']=_['merge'](_0x5cdb2e[_0x3d94('0x42')],{'$or':_[_0x3d94('0x2e')](_0x5426bd,function(_0x512cef){if(_0x512cef[_0x3d94('0x30')]!=='VIRTUAL'){var _0x1361fb={};_0x1361fb[_0x512cef[_0x3d94('0x33')]]={'$like':'%'+_0x280c73[_0x3d94('0x3a')][_0x3d94('0x2c')]+'%'};return _0x1361fb;}})});}_0x5cdb2e=_[_0x3d94('0x45')]({},_0x5cdb2e,_0x280c73['options']);var _0x3e0da8={'where':_0x5cdb2e[_0x3d94('0x42')]};return db[_0x3d94('0x35')]['count'](_0x3e0da8)[_0x3d94('0x25')](function(_0x555366){_0x3d29fd['count']=_0x555366;if(_0x280c73[_0x3d94('0x3a')][_0x3d94('0x46')]){_0x5cdb2e[_0x3d94('0x47')]=[{'all':!![]}];}return db[_0x3d94('0x35')]['findAll'](_0x5cdb2e);})[_0x3d94('0x25')](function(_0x4a4b74){_0x3d29fd[_0x3d94('0x48')]=_0x4a4b74;return _0x3d29fd;})[_0x3d94('0x25')](respondWithFilteredResult(_0x273337,_0x5cdb2e))[_0x3d94('0x49')](handleError(_0x273337,null));};exports[_0x3d94('0x4a')]=function(_0x20e6d4,_0x27bee8){var _0x200fe3={'raw':![],'where':{'id':_0x20e6d4[_0x3d94('0x4b')]['id']}},_0x4e7bfd={};_0x4e7bfd[_0x3d94('0x39')]=_['keys'](db['VoiceExtension'][_0x3d94('0x36')]);_0x4e7bfd[_0x3d94('0x3a')]=_['keys'](_0x20e6d4[_0x3d94('0x3a')]);_0x4e7bfd[_0x3d94('0x43')]=_[_0x3d94('0x3c')](_0x4e7bfd[_0x3d94('0x39')],_0x4e7bfd[_0x3d94('0x3a')]);_0x200fe3[_0x3d94('0x3d')]=_[_0x3d94('0x3c')](_0x4e7bfd[_0x3d94('0x39')],qs[_0x3d94('0x3e')](_0x20e6d4[_0x3d94('0x3a')][_0x3d94('0x3e')]));_0x200fe3[_0x3d94('0x3d')]=_0x200fe3[_0x3d94('0x3d')][_0x3d94('0x3f')]?_0x200fe3[_0x3d94('0x3d')]:_0x4e7bfd['model'];if(_0x20e6d4[_0x3d94('0x3a')][_0x3d94('0x46')]){_0x200fe3[_0x3d94('0x47')]=[{'all':!![]}];}_0x200fe3=_[_0x3d94('0x45')]({},_0x200fe3,_0x20e6d4[_0x3d94('0x4c')]);return db[_0x3d94('0x35')][_0x3d94('0x4d')](_0x200fe3)[_0x3d94('0x25')](handleEntityNotFound(_0x27bee8,null))[_0x3d94('0x25')](respondWithResult(_0x27bee8,null))['catch'](handleError(_0x27bee8,null));};exports[_0x3d94('0x26')]=function(_0x5799df,_0x174eb3){return db[_0x3d94('0x35')]['find']({'where':{'id':_0x5799df[_0x3d94('0x4b')]['id']}})['then'](handleEntityNotFound(_0x174eb3,null))['then'](removeEntity(_0x174eb3,null))[_0x3d94('0x49')](handleError(_0x174eb3,null));};exports['create']=function(_0x3aa3b3,_0x132e0b){if(_0x3aa3b3['body'][_0x3d94('0x30')]==='outbound'&&!_['startsWith'](_0x3aa3b3[_0x3d94('0x4e')][_0x3d94('0x4f')],'_')){_0x3aa3b3[_0x3d94('0x4e')][_0x3d94('0x4f')]='_'[_0x3d94('0x50')](_0x3aa3b3[_0x3d94('0x4e')][_0x3d94('0x4f')]);}return db[_0x3d94('0x35')][_0x3d94('0x51')](_0x3aa3b3['body'],{'raw':![]})[_0x3d94('0x25')](function(_0x22dba3){var _0x284fb2=_0x3aa3b3[_0x3d94('0x52')][_0x3d94('0x27')]({'plain':!![]});if(!_0x284fb2)throw new Error(_0x3d94('0x53'));if(_0x284fb2[_0x3d94('0x54')]===_0x3d94('0x52')){var _0x1210b5=_0x22dba3[_0x3d94('0x27')]({'plain':!![]});var _0x1fd806=[{'name':'InboundRoutes','value':_0x3d94('0x29')},{'name':'OutboundRoutes','value':_0x3d94('0x2a')},{'name':_0x3d94('0x55'),'value':_0x3d94('0x2b')}];var _0x17591b=_[_0x3d94('0x4d')](_0x1fd806,[_0x3d94('0x2f'),_0x1210b5[_0x3d94('0x30')]])[_0x3d94('0x33')];return db[_0x3d94('0x56')]['find']({'where':{'name':_0x17591b,'userProfileId':_0x284fb2['userProfileId']},'raw':!![]})[_0x3d94('0x25')](function(_0x4bd97c){if(_0x4bd97c&&_0x4bd97c[_0x3d94('0x57')]===0x0){return db[_0x3d94('0x31')]['create']({'name':_0x1210b5[_0x3d94('0x33')],'resourceId':_0x1210b5['id'],'type':_0x4bd97c[_0x3d94('0x33')],'sectionId':_0x4bd97c['id']},{})[_0x3d94('0x25')](function(){return _0x22dba3;});}else{return _0x22dba3;}})[_0x3d94('0x49')](function(_0xcefff5){logger[_0x3d94('0x32')](_0x3d94('0x58'),_0xcefff5);throw _0xcefff5;});}return _0x22dba3;})['then'](respondWithResult(_0x132e0b,0xc9))[_0x3d94('0x49')](handleError(_0x132e0b,null));};exports[_0x3d94('0x24')]=function(_0x368581,_0x4b23b5){if(_0x368581[_0x3d94('0x4e')]['id']){delete _0x368581[_0x3d94('0x4e')]['id'];}return db[_0x3d94('0x35')][_0x3d94('0x4d')]({'where':{'id':_0x368581['params']['id']}})['then'](handleEntityNotFound(_0x4b23b5,null))[_0x3d94('0x25')](function(_0x38b2fa){if(_0x38b2fa){return db[_0x3d94('0x35')][_0x3d94('0x24')](_['pick'](_0x368581[_0x3d94('0x4e')],[_0x3d94('0x4f'),'context',_0x3d94('0x59'),_0x3d94('0x5a'),_0x3d94('0x5b'),'mandatoryDisposition']),{'where':{'context':_0x38b2fa[_0x3d94('0x5c')],'exten':_0x38b2fa[_0x3d94('0x4f')]},'individualHooks':!![]})[_0x3d94('0x25')](function(_0x5747a8){return _0x5747a8;});}return null;})[_0x3d94('0x25')](respondWithStatusCode(_0x4b23b5,null))[_0x3d94('0x49')](handleError(_0x4b23b5,null));};exports['addApplications']=function(_0x4d291e,_0x4e1932,_0x3ac9ea){return db[_0x3d94('0x35')][_0x3d94('0x5d')]({'where':{'id':_0x4d291e[_0x3d94('0x4b')]['id']}})[_0x3d94('0x25')](handleEntityNotFound(_0x4e1932,null))['then'](function(_0xa13a18){if(_0xa13a18){return db[_0x3d94('0x5e')][_0x3d94('0x5f')](function(_0x1e8e3d){return db[_0x3d94('0x35')][_0x3d94('0x26')]({'where':{'VoiceExtensionId':_0x4d291e['params']['id']},'transaction':_0x1e8e3d})[_0x3d94('0x25')](function(_0x4b6838){var _0x1f3551=_[_0x3d94('0x2e')](_0x4d291e[_0x3d94('0x4e')],function(_0x393ac9){_0x393ac9[_0x3d94('0x60')]=_0x4d291e[_0x3d94('0x4b')]['id'];return _0x393ac9;});return db['VoiceExtension']['bulkCreate'](_0x1f3551,{'transaction':_0x1e8e3d});});})[_0x3d94('0x25')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x4d291e['params']['id']},'order':_0x3d94('0x61')});});}})[_0x3d94('0x25')](respondWithResult(_0x4e1932,null))[_0x3d94('0x49')](handleError(_0x4e1932,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4121d4f..523a335 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 _0x4d7e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove'];(function(_0x46d3a2,_0x265554){var _0x25ef68=function(_0x5d66b8){while(--_0x5d66b8){_0x46d3a2['push'](_0x46d3a2['shift']());}};_0x25ef68(++_0x265554);}(_0x4d7e,0x14e));var _0xe4d7=function(_0x410571,_0x255a69){_0x410571=_0x410571-0x0;var _0x3c5547=_0x4d7e[_0x410571];return _0x3c5547;};'use strict';var EventEmitter=require(_0xe4d7('0x0'));var VoiceExtension=require(_0xe4d7('0x1'))['db'][_0xe4d7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe4d7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe4d7('0x4'),'afterDestroy':_0xe4d7('0x5')};function emitEvent(_0x53349e){return function(_0x29da93,_0x1ece16,_0x267bf9){VoiceExtensionEvents[_0xe4d7('0x6')](_0x53349e+':'+_0x29da93['id'],_0x29da93);VoiceExtensionEvents['emit'](_0x53349e,_0x29da93);_0x267bf9(null);};}for(var e in events){if(events[_0xe4d7('0x7')](e)){var event=events[e];VoiceExtension[_0xe4d7('0x8')](e,emitEvent(event));}}module[_0xe4d7('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xc7f8=['../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit','hook','events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc7f8,0xcf));var _0x8c7f=function(_0xd619e,_0x55343b){_0xd619e=_0xd619e-0x0;var _0x2e8e5a=_0xc7f8[_0xd619e];return _0x2e8e5a;};'use strict';var EventEmitter=require(_0x8c7f('0x0'));var VoiceExtension=require(_0x8c7f('0x1'))['db'][_0x8c7f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8c7f('0x3')](0x0);var events={'afterCreate':_0x8c7f('0x4'),'afterUpdate':'update','afterDestroy':_0x8c7f('0x5')};function emitEvent(_0x1884f0){return function(_0x418a1b,_0x1ff10c,_0x36e2ef){VoiceExtensionEvents[_0x8c7f('0x6')](_0x1884f0+':'+_0x418a1b['id'],_0x418a1b);VoiceExtensionEvents[_0x8c7f('0x6')](_0x1884f0,_0x418a1b);_0x36e2ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x8c7f('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 3c31c32..5d03258 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 _0xee8a=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceExtension','voice_extensions','util'];(function(_0x4405ed,_0x2196e7){var _0x2b252f=function(_0x2d21a4){while(--_0x2d21a4){_0x4405ed['push'](_0x4405ed['shift']());}};_0x2b252f(++_0x2196e7);}(_0xee8a,0x1ee));var _0xaee8=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xee8a[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0xaee8('0x0'));var logger=require(_0xaee8('0x1'))('api');var moment=require(_0xaee8('0x2'));var BPromise=require(_0xaee8('0x3'));var rp=require(_0xaee8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaee8('0x5'));var config=require(_0xaee8('0x6'));var attributes=require('./voiceExtension.attributes');module[_0xaee8('0x7')]=function(_0x3fc4db,_0x5a054d){return _0x3fc4db[_0xaee8('0x8')](_0xaee8('0x9'),attributes,{'tableName':_0xaee8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36e4=['path','rimraf','../../config/environment','exports','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x36e4,0x1b2));var _0x436e=function(_0x124082,_0xdba617){_0x124082=_0x124082-0x0;var _0xe0c8d=_0x36e4[_0x124082];return _0xe0c8d;};'use strict';var _=require(_0x436e('0x0'));var util=require(_0x436e('0x1'));var logger=require(_0x436e('0x2'))(_0x436e('0x3'));var moment=require(_0x436e('0x4'));var BPromise=require(_0x436e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x436e('0x6'));var rimraf=require(_0x436e('0x7'));var config=require(_0x436e('0x8'));var attributes=require('./voiceExtension.attributes');module[_0x436e('0x9')]=function(_0xc2b2a0,_0x19b111){return _0xc2b2a0['define']('VoiceExtension',attributes,{'tableName':_0x436e('0xa'),'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 b50abc4..fd75daf 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 _0x0346=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceExtension','options','raw','where','attributes','include','map','model','then','debug','lodash','util'];(function(_0x1052e4,_0xd5a005){var _0x3b8c75=function(_0x1637f0){while(--_0x1637f0){_0x1052e4['push'](_0x1052e4['shift']());}};_0x3b8c75(++_0xd5a005);}(_0x0346,0x1de));var _0x6034=function(_0x235941,_0x58d8b2){_0x235941=_0x235941-0x0;var _0x1c2e0f=_0x0346[_0x235941];return _0x1c2e0f;};'use strict';var _=require(_0x6034('0x0'));var util=require(_0x6034('0x1'));var moment=require(_0x6034('0x2'));var BPromise=require(_0x6034('0x3'));var rs=require(_0x6034('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6034('0x5'));var logger=require(_0x6034('0x6'))(_0x6034('0x7'));var config=require(_0x6034('0x8'));var jayson=require(_0x6034('0x9'));var client=jayson[_0x6034('0xa')]['http']({'port':0x232a});config[_0x6034('0xb')]=_[_0x6034('0xc')](config[_0x6034('0xb')],{'host':_0x6034('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x237a94,_0x291b74,_0x2bee01){return new BPromise(function(_0x271d28,_0x19cd3b){return client['request'](_0x237a94,_0x2bee01)['then'](function(_0x44aa50){logger[_0x6034('0xe')](_0x6034('0xf'),_0x291b74,_0x6034('0x10'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x291b74,_0x6034('0x10'),JSON['stringify'](_0x44aa50));if(_0x44aa50[_0x6034('0x11')]){if(_0x44aa50[_0x6034('0x11')][_0x6034('0x12')]===0x1f4){logger[_0x6034('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x291b74,_0x44aa50['error'][_0x6034('0x13')]);return _0x19cd3b(_0x44aa50[_0x6034('0x11')]['message']);}logger[_0x6034('0x11')](_0x6034('0xf'),_0x291b74,_0x44aa50[_0x6034('0x11')][_0x6034('0x13')]);return _0x271d28(_0x44aa50['error'][_0x6034('0x13')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x291b74,_0x6034('0x10'));_0x271d28(_0x44aa50[_0x6034('0x14')][_0x6034('0x13')]);}})[_0x6034('0x15')](function(_0x2b5182){logger[_0x6034('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x291b74,_0x2b5182);_0x19cd3b(_0x2b5182);});});}exports[_0x6034('0x16')]=function(_0x59de5a){var _0xc7c808=this;return new Promise(function(_0x8e9562,_0x27831a){return db['VoiceExtension']['findAll']({'raw':_0x59de5a[_0x6034('0x17')]?_0x59de5a[_0x6034('0x17')][_0x6034('0x18')]===undefined?!![]:![]:!![],'where':_0x59de5a['options']?_0x59de5a[_0x6034('0x17')][_0x6034('0x19')]||null:null,'attributes':_0x59de5a[_0x6034('0x17')]?_0x59de5a['options'][_0x6034('0x1a')]||null:null,'limit':_0x59de5a[_0x6034('0x17')]?_0x59de5a['options']['limit']||null:null,'include':_0x59de5a[_0x6034('0x17')]?_0x59de5a['options'][_0x6034('0x1b')]?_[_0x6034('0x1c')](_0x59de5a[_0x6034('0x17')][_0x6034('0x1b')],function(_0x10fae1){return{'model':db[_0x10fae1[_0x6034('0x1d')]],'as':_0x10fae1['as'],'attributes':_0x10fae1[_0x6034('0x1a')],'include':_0x10fae1[_0x6034('0x1b')]?_[_0x6034('0x1c')](_0x10fae1[_0x6034('0x1b')],function(_0x1d1f4f){return{'model':db[_0x1d1f4f['model']],'as':_0x1d1f4f['as'],'attributes':_0x1d1f4f[_0x6034('0x1a')],'include':_0x1d1f4f['include']?_[_0x6034('0x1c')](_0x1d1f4f[_0x6034('0x1b')],function(_0x28e52c){return{'model':db[_0x28e52c[_0x6034('0x1d')]],'as':_0x28e52c['as'],'attributes':_0x28e52c[_0x6034('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6034('0x1e')](function(_0x479355){logger['info'](_0x6034('0x16'),_0x59de5a);logger[_0x6034('0x1f')](_0x6034('0x16'),_0x59de5a,JSON['stringify'](_0x479355));_0x8e9562(_0x479355);})[_0x6034('0x15')](function(_0x370f80){logger['error'](_0x6034('0x16'),_0x370f80[_0x6034('0x13')],_0x59de5a);_0x27831a(_0xc7c808[_0x6034('0x11')](0x1f4,_0x370f80[_0x6034('0x13')]));});});}; \ No newline at end of file +var _0xd308=['./voiceExtension.socket','request','then','info','request\x20sent','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s','result','findAll','options','raw','where','attributes','map','include','model','GetVoiceExtension','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis'];(function(_0x33093c,_0x1c8be8){var _0x6eae66=function(_0x150e19){while(--_0x150e19){_0x33093c['push'](_0x33093c['shift']());}};_0x6eae66(++_0x1c8be8);}(_0xd308,0x1d1));var _0x8d30=function(_0x102978,_0x2a5185){_0x102978=_0x102978-0x0;var _0x3bb670=_0xd308[_0x102978];return _0x3bb670;};'use strict';var _=require(_0x8d30('0x0'));var util=require(_0x8d30('0x1'));var moment=require(_0x8d30('0x2'));var BPromise=require(_0x8d30('0x3'));var rs=require(_0x8d30('0x4'));var fs=require('fs');var Redis=require(_0x8d30('0x5'));var db=require(_0x8d30('0x6'))['db'];var utils=require(_0x8d30('0x7'));var logger=require(_0x8d30('0x8'))(_0x8d30('0x9'));var config=require('../../config/environment');var jayson=require(_0x8d30('0xa'));var client=jayson[_0x8d30('0xb')]['http']({'port':0x232a});config['redis']=_[_0x8d30('0xc')](config['redis'],{'host':_0x8d30('0xd'),'port':0x18eb});var socket=require(_0x8d30('0xe'))(new Redis(config[_0x8d30('0xf')]));require(_0x8d30('0x10'))['register'](socket);function respondWithRpcPromise(_0x50e81e,_0xaa2db8,_0x53aca1){return new BPromise(function(_0x7185ae,_0x20dc2c){return client[_0x8d30('0x11')](_0x50e81e,_0x53aca1)[_0x8d30('0x12')](function(_0x38d954){logger[_0x8d30('0x13')]('VoiceExtension,\x20%s,\x20%s',_0xaa2db8,_0x8d30('0x14'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xaa2db8,_0x8d30('0x14'),JSON[_0x8d30('0x15')](_0x38d954));if(_0x38d954[_0x8d30('0x16')]){if(_0x38d954[_0x8d30('0x16')][_0x8d30('0x17')]===0x1f4){logger[_0x8d30('0x16')]('VoiceExtension,\x20%s,\x20%s',_0xaa2db8,_0x38d954[_0x8d30('0x16')]['message']);return _0x20dc2c(_0x38d954[_0x8d30('0x16')][_0x8d30('0x18')]);}logger['error'](_0x8d30('0x19'),_0xaa2db8,_0x38d954[_0x8d30('0x16')][_0x8d30('0x18')]);return _0x7185ae(_0x38d954[_0x8d30('0x16')][_0x8d30('0x18')]);}else{logger[_0x8d30('0x13')](_0x8d30('0x19'),_0xaa2db8,_0x8d30('0x14'));_0x7185ae(_0x38d954[_0x8d30('0x1a')][_0x8d30('0x18')]);}})['catch'](function(_0x5b54e7){logger[_0x8d30('0x16')](_0x8d30('0x19'),_0xaa2db8,_0x5b54e7);_0x20dc2c(_0x5b54e7);});});}exports['GetVoiceExtension']=function(_0x97bb6b){var _0x12cc49=this;return new Promise(function(_0x587058,_0x350e9d){return db['VoiceExtension'][_0x8d30('0x1b')]({'raw':_0x97bb6b[_0x8d30('0x1c')]?_0x97bb6b[_0x8d30('0x1c')][_0x8d30('0x1d')]===undefined?!![]:![]:!![],'where':_0x97bb6b[_0x8d30('0x1c')]?_0x97bb6b[_0x8d30('0x1c')][_0x8d30('0x1e')]||null:null,'attributes':_0x97bb6b[_0x8d30('0x1c')]?_0x97bb6b[_0x8d30('0x1c')][_0x8d30('0x1f')]||null:null,'limit':_0x97bb6b[_0x8d30('0x1c')]?_0x97bb6b['options']['limit']||null:null,'include':_0x97bb6b[_0x8d30('0x1c')]?_0x97bb6b[_0x8d30('0x1c')]['include']?_[_0x8d30('0x20')](_0x97bb6b[_0x8d30('0x1c')][_0x8d30('0x21')],function(_0x50974e){return{'model':db[_0x50974e[_0x8d30('0x22')]],'as':_0x50974e['as'],'attributes':_0x50974e['attributes'],'include':_0x50974e[_0x8d30('0x21')]?_[_0x8d30('0x20')](_0x50974e[_0x8d30('0x21')],function(_0x575e66){return{'model':db[_0x575e66['model']],'as':_0x575e66['as'],'attributes':_0x575e66[_0x8d30('0x1f')],'include':_0x575e66[_0x8d30('0x21')]?_[_0x8d30('0x20')](_0x575e66['include'],function(_0x4ad71a){return{'model':db[_0x4ad71a[_0x8d30('0x22')]],'as':_0x4ad71a['as'],'attributes':_0x4ad71a[_0x8d30('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8d30('0x12')](function(_0x13eb65){logger['info']('GetVoiceExtension',_0x97bb6b);logger['debug'](_0x8d30('0x23'),_0x97bb6b,JSON[_0x8d30('0x15')](_0x13eb65));_0x587058(_0x13eb65);})[_0x8d30('0x24')](function(_0x364c56){logger['error'](_0x8d30('0x23'),_0x364c56[_0x8d30('0x18')],_0x97bb6b);_0x350e9d(_0x12cc49[_0x8d30('0x16')](0x1f4,_0x364c56[_0x8d30('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 3a2405c..96e2f7d 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 _0xc592=['save','remove','removeListener','register','length','voiceExtension:'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc592,0x108));var _0x2c59=function(_0x570cd1,_0x39db94){_0x570cd1=_0x570cd1-0x0;var _0x9d1cfa=_0xc592[_0x570cd1];return _0x9d1cfa;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x2c59('0x0'),_0x2c59('0x1'),'update'];function createListener(_0x453985,_0x547890){return function(_0xc658a8){_0x547890['emit'](_0x453985,_0xc658a8);};}function removeListener(_0x529a90,_0x3f2958){return function(){VoiceExtensionEvents[_0x2c59('0x2')](_0x529a90,_0x3f2958);};}exports[_0x2c59('0x3')]=function(_0x53c16d){for(var _0x14decc=0x0,_0x568c2c=events[_0x2c59('0x4')];_0x14decc<_0x568c2c;_0x14decc++){var _0x33032b=events[_0x14decc];var _0x576235=createListener(_0x2c59('0x5')+_0x33032b,_0x53c16d);VoiceExtensionEvents['on'](_0x33032b,_0x576235);}}; \ No newline at end of file +var _0x7b3f=['removeListener','register','length','voiceExtension:','./voiceExtension.events','remove','update','emit'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x7b3f,0xbc));var _0xf7b3=function(_0x55d0bb,_0x1b93f6){_0x55d0bb=_0x55d0bb-0x0;var _0x2810a9=_0x7b3f[_0x55d0bb];return _0x2810a9;};'use strict';var VoiceExtensionEvents=require(_0xf7b3('0x0'));var events=['save',_0xf7b3('0x1'),_0xf7b3('0x2')];function createListener(_0x329ea3,_0x390c20){return function(_0x46ccc9){_0x390c20[_0xf7b3('0x3')](_0x329ea3,_0x46ccc9);};}function removeListener(_0x573c45,_0x24759c){return function(){VoiceExtensionEvents[_0xf7b3('0x4')](_0x573c45,_0x24759c);};}exports[_0xf7b3('0x5')]=function(_0xeff95f){for(var _0x9cb884=0x0,_0x129fa3=events[_0xf7b3('0x6')];_0x9cb884<_0x129fa3;_0x9cb884++){var _0x41998e=events[_0x9cb884];var _0x316d07=createListener(_0xf7b3('0x7')+_0x41998e,_0xeff95f);VoiceExtensionEvents['on'](_0x41998e,_0x316d07);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5ef0732..89478a4 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 _0xb154=['../../config/environment','./voiceMail.controller','get','isAuthenticated','show','/:id/messages','getMessages','create','/:id','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x25d2fa,_0x1d35c6){var _0x42d4aa=function(_0x590383){while(--_0x590383){_0x25d2fa['push'](_0x25d2fa['shift']());}};_0x42d4aa(++_0x1d35c6);}(_0xb154,0x91));var _0x4b15=function(_0x12c53c,_0x487ee4){_0x12c53c=_0x12c53c-0x0;var _0x3954a7=_0xb154[_0x12c53c];return _0x3954a7;};'use strict';var multer=require(_0x4b15('0x0'));var util=require(_0x4b15('0x1'));var path=require(_0x4b15('0x2'));var timeout=require(_0x4b15('0x3'));var express=require(_0x4b15('0x4'));var router=express[_0x4b15('0x5')]();var auth=require(_0x4b15('0x6'));var interaction=require(_0x4b15('0x7'));var config=require(_0x4b15('0x8'));var controller=require(_0x4b15('0x9'));router[_0x4b15('0xa')]('/',auth[_0x4b15('0xb')](),controller['index']);router[_0x4b15('0xa')]('/:id',auth[_0x4b15('0xb')](),controller[_0x4b15('0xc')]);router[_0x4b15('0xa')](_0x4b15('0xd'),auth[_0x4b15('0xb')](),controller[_0x4b15('0xe')]);router['post']('/',auth[_0x4b15('0xb')](),controller[_0x4b15('0xf')]);router['put'](_0x4b15('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4b15('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8369=['../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x509239,_0x4fab00){var _0x39eae0=function(_0x5b4cf4){while(--_0x5b4cf4){_0x509239['push'](_0x509239['shift']());}};_0x39eae0(++_0x4fab00);}(_0x8369,0x15b));var _0x9836=function(_0x3d3568,_0x2b56f5){_0x3d3568=_0x3d3568-0x0;var _0x1430c2=_0x8369[_0x3d3568];return _0x1430c2;};'use strict';var multer=require(_0x9836('0x0'));var util=require(_0x9836('0x1'));var path=require(_0x9836('0x2'));var timeout=require(_0x9836('0x3'));var express=require(_0x9836('0x4'));var router=express['Router']();var auth=require(_0x9836('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9836('0x6'));var controller=require(_0x9836('0x7'));router['get']('/',auth[_0x9836('0x8')](),controller[_0x9836('0x9')]);router[_0x9836('0xa')]('/:id',auth[_0x9836('0x8')](),controller[_0x9836('0xb')]);router[_0x9836('0xa')](_0x9836('0xc'),auth['isAuthenticated'](),controller[_0x9836('0xd')]);router[_0x9836('0xe')]('/',auth[_0x9836('0x8')](),controller[_0x9836('0xf')]);router[_0x9836('0x10')](_0x9836('0x11'),auth[_0x9836('0x8')](),controller[_0x9836('0x12')]);router[_0x9836('0x13')](_0x9836('0x11'),auth[_0x9836('0x8')](),controller[_0x9836('0x14')]);module[_0x9836('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 342144a..cc0053f 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 _0xbdb7=['getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','yes','ENUM','INTEGER'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4c5847,_0xd4a2ad){_0x4c5847=_0x4c5847-0x0;var _0x5c308b=_0xbdb7[_0x4c5847];return _0x5c308b;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'customer_id':{'type':Sequelize[_0x7bdb('0x2')]},'context':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':_0x7bdb('0x3'),'unique':_0x7bdb('0x4')},'mailbox':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7bdb('0x4')},'password':{'type':Sequelize[_0x7bdb('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7bdb('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4fd1ad){this['setDataValue'](_0x7bdb('0x5'),typeof _0x4fd1ad===_0x7bdb('0x6')&&_0x4fd1ad['trim']()?_0x4fd1ad['trim']():null);}},'pager':{'type':Sequelize[_0x7bdb('0x2')]},'tz':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7bdb('0x2')]},'callback':{'type':Sequelize[_0x7bdb('0x2')]},'review':{'type':Sequelize[_0x7bdb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7bdb('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x7bdb('0x8')](_0x7bdb('0x7'),'no'),'defaultValue':_0x7bdb('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x7bdb('0x2')]},'emailbody':{'type':Sequelize[_0x7bdb('0x2')]},'maxsecs':{'type':Sequelize[_0x7bdb('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x7bdb('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x7bdb('0xa')](_0x7bdb('0xb'))+'\x20-\x20'+this[_0x7bdb('0xa')](_0x7bdb('0xc'));}}}; \ No newline at end of file +var _0x4cf8=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue'];(function(_0xf327b,_0x295279){var _0x145469=function(_0x4e14e9){while(--_0x4e14e9){_0xf327b['push'](_0xf327b['shift']());}};_0x145469(++_0x295279);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x4cf8[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x84cf('0x0'));module[_0x84cf('0x1')]={'customer_id':{'type':Sequelize[_0x84cf('0x2')]},'context':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':_0x84cf('0x3'),'unique':_0x84cf('0x4')},'mailbox':{'type':Sequelize[_0x84cf('0x2')],'defaultValue':'','allowNull':![],'unique':_0x84cf('0x4')},'password':{'type':Sequelize[_0x84cf('0x2')]},'fullname':{'type':Sequelize[_0x84cf('0x2')]},'email':{'type':Sequelize[_0x84cf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2c613d){this['setDataValue']('email',typeof _0x2c613d===_0x84cf('0x5')&&_0x2c613d['trim']()?_0x2c613d[_0x84cf('0x6')]():null);}},'pager':{'type':Sequelize[_0x84cf('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x84cf('0x7')},'attach':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x84cf('0x2')]},'review':{'type':Sequelize[_0x84cf('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x84cf('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':_0x84cf('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x84cf('0x8')](_0x84cf('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x84cf('0xb')},'emailsubject':{'type':Sequelize[_0x84cf('0x2')]},'emailbody':{'type':Sequelize[_0x84cf('0x2')]},'maxsecs':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x84cf('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x84cf('0xd')],'get':function(){return this[_0x84cf('0xe')]('fullname')+'\x20-\x20'+this[_0x84cf('0xe')](_0x84cf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 8d925cc..e72286d 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 _0xd63a=['merge','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','user','role','Voicemails','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','VoiceMailMessage','rawAttributes','sort','pick','findAndCountAll','html-pdf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','where','filter'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xd63a,0x153));var _0xad63=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd63a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xad63('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xad63('0x1'));var rp=require(_0xad63('0x2'));var moment=require(_0xad63('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xad63('0x4'));var path=require(_0xad63('0x5'));var sox=require(_0xad63('0x6'));var csv=require(_0xad63('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xad63('0x8'));var squel=require(_0xad63('0x9'));var crypto=require('crypto');var jsforce=require(_0xad63('0xa'));var deskjs=require(_0xad63('0xb'));var toCsv=require(_0xad63('0x7'));var querystring=require(_0xad63('0xc'));var Papa=require(_0xad63('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xad63('0xe'));var as=require(_0xad63('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad63('0x10'))('api');var utils=require(_0xad63('0x11'));var config=require(_0xad63('0x12'));var db=require(_0xad63('0x13'))['db'];function respondWithStatusCode(_0x4c795c,_0xb6bff9){_0xb6bff9=_0xb6bff9||0xcc;return function(_0x5a31fb){if(_0x5a31fb){return _0x4c795c[_0xad63('0x14')](_0xb6bff9);}return _0x4c795c[_0xad63('0x15')](_0xb6bff9)[_0xad63('0x16')]();};}function respondWithResult(_0xd1d38e,_0x1c686c){_0x1c686c=_0x1c686c||0xc8;return function(_0x265267){if(_0x265267){return _0xd1d38e[_0xad63('0x15')](_0x1c686c)[_0xad63('0x17')](_0x265267);}};}function respondWithFilteredResult(_0x4194cc,_0x33e890){return function(_0x4f6a00){if(_0x4f6a00){var _0x38452e=_0x4f6a00[_0xad63('0x18')],_0x3c7e86=_0x33e890[_0xad63('0x19')],_0x4ce016=_0x33e890[_0xad63('0x19')]+_0x33e890['limit'],_0x7d6b3b;if(_0x4ce016>=_0x38452e){_0x4ce016=_0x38452e;_0x7d6b3b=0xc8;}else{_0x7d6b3b=0xce;}_0x4194cc[_0xad63('0x15')](_0x7d6b3b);return _0x4194cc[_0xad63('0x1a')]('Content-Range',_0x3c7e86+'-'+_0x4ce016+'/'+_0x38452e)['json'](_0x4f6a00);}return null;};}function patchUpdates(_0x202f7b){return function(_0x367c82){try{jsonpatch[_0xad63('0x1b')](_0x367c82,_0x202f7b,!![]);}catch(_0x26f3b6){return BPromise['reject'](_0x26f3b6);}return _0x367c82['save']();};}function saveUpdates(_0x2c6c95,_0x58cab0){return function(_0x30574a){if(_0x30574a){return _0x30574a[_0xad63('0x1c')](_0x2c6c95)[_0xad63('0x1d')](function(_0x296caf){return _0x296caf;});}return null;};}function removeEntity(_0x31c33c,_0x4fb130){return function(_0x481cf6){if(_0x481cf6){return _0x481cf6[_0xad63('0x1e')]()[_0xad63('0x1d')](function(){var _0x2b6151=_0x481cf6[_0xad63('0x1f')]({'plain':!![]});var _0x405146='Voicemails';return db[_0xad63('0x20')][_0xad63('0x1e')]({'where':{'type':_0x405146,'resourceId':_0x2b6151['id']}})[_0xad63('0x1d')](function(){return _0x481cf6;});})[_0xad63('0x1d')](function(){_0x31c33c[_0xad63('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x457967,_0x1e2ee7){return function(_0x4d4105){if(!_0x4d4105){_0x457967['sendStatus'](0x194);}return _0x4d4105;};}function handleError(_0x1555f5,_0x23f49a){_0x23f49a=_0x23f49a||0x1f4;return function(_0x507c09){logger[_0xad63('0x21')](_0x507c09[_0xad63('0x22')]);if(_0x507c09['name']){delete _0x507c09[_0xad63('0x23')];}_0x1555f5[_0xad63('0x15')](_0x23f49a)[_0xad63('0x24')](_0x507c09);};}exports[_0xad63('0x25')]=function(_0x146118,_0x282901){var _0x43544={},_0x5737de={},_0x36007a={'count':0x0,'rows':[]};var _0x3e1692=_[_0xad63('0x26')](db[_0xad63('0x27')]['rawAttributes'],function(_0x2586eb){return{'name':_0x2586eb[_0xad63('0x28')],'type':_0x2586eb[_0xad63('0x29')][_0xad63('0x2a')]};});_0x5737de['model']=_['map'](_0x3e1692,_0xad63('0x23'));_0x5737de['query']=_[_0xad63('0x2b')](_0x146118[_0xad63('0x2c')]);_0x5737de[_0xad63('0x2d')]=_['intersection'](_0x5737de[_0xad63('0x2e')],_0x5737de['query']);_0x43544[_0xad63('0x2f')]=_[_0xad63('0x30')](_0x5737de[_0xad63('0x2e')],qs[_0xad63('0x31')](_0x146118[_0xad63('0x2c')][_0xad63('0x31')]));_0x43544[_0xad63('0x2f')]=_0x43544[_0xad63('0x2f')]['length']?_0x43544[_0xad63('0x2f')]:_0x5737de[_0xad63('0x2e')];if(!_0x146118['query'][_0xad63('0x32')](_0xad63('0x33'))){_0x43544['limit']=qs['limit'](_0x146118[_0xad63('0x2c')][_0xad63('0x34')]);_0x43544['offset']=qs['offset'](_0x146118['query'][_0xad63('0x19')]);}_0x43544[_0xad63('0x35')]=qs['sort'](_0x146118[_0xad63('0x2c')]['sort']);_0x43544[_0xad63('0x36')]=qs[_0xad63('0x2d')](_['pick'](_0x146118[_0xad63('0x2c')],_0x5737de['filters']),_0x3e1692);if(_0x146118[_0xad63('0x2c')][_0xad63('0x37')]){_0x43544['where']=_[_0xad63('0x38')](_0x43544[_0xad63('0x36')],{'$or':_['map'](_0x3e1692,function(_0x695438){if(_0x695438[_0xad63('0x29')]!=='VIRTUAL'){var _0x26a82d={};_0x26a82d[_0x695438[_0xad63('0x23')]]={'$like':'%'+_0x146118[_0xad63('0x2c')]['filter']+'%'};return _0x26a82d;}})});}_0x43544=_[_0xad63('0x38')]({},_0x43544,_0x146118[_0xad63('0x39')]);var _0x3fa471={'where':_0x43544[_0xad63('0x36')]};return db[_0xad63('0x27')][_0xad63('0x18')](_0x3fa471)[_0xad63('0x1d')](function(_0x9e392a){_0x36007a[_0xad63('0x18')]=_0x9e392a;if(_0x146118[_0xad63('0x2c')][_0xad63('0x3a')]){_0x43544['include']=[{'all':!![]}];}return db[_0xad63('0x27')][_0xad63('0x3b')](_0x43544);})['then'](function(_0x191f67){_0x36007a[_0xad63('0x3c')]=_0x191f67;return _0x36007a;})[_0xad63('0x1d')](respondWithFilteredResult(_0x282901,_0x43544))[_0xad63('0x3d')](handleError(_0x282901,null));};exports['show']=function(_0x3533a8,_0x2f311d){var _0x169077={'raw':!![],'where':{'id':_0x3533a8[_0xad63('0x3e')]['id']}},_0x511c7a={};_0x511c7a[_0xad63('0x2e')]=_[_0xad63('0x2b')](db[_0xad63('0x27')]['rawAttributes']);_0x511c7a[_0xad63('0x2c')]=_[_0xad63('0x2b')](_0x3533a8[_0xad63('0x2c')]);_0x511c7a[_0xad63('0x2d')]=_[_0xad63('0x30')](_0x511c7a[_0xad63('0x2e')],_0x511c7a[_0xad63('0x2c')]);_0x169077[_0xad63('0x2f')]=_['intersection'](_0x511c7a[_0xad63('0x2e')],qs[_0xad63('0x31')](_0x3533a8[_0xad63('0x2c')][_0xad63('0x31')]));_0x169077['attributes']=_0x169077['attributes'][_0xad63('0x3f')]?_0x169077[_0xad63('0x2f')]:_0x511c7a['model'];if(_0x3533a8[_0xad63('0x2c')][_0xad63('0x3a')]){_0x169077[_0xad63('0x40')]=[{'all':!![]}];}_0x169077=_[_0xad63('0x38')]({},_0x169077,_0x3533a8[_0xad63('0x39')]);return db[_0xad63('0x27')][_0xad63('0x41')](_0x169077)[_0xad63('0x1d')](handleEntityNotFound(_0x2f311d,null))[_0xad63('0x1d')](respondWithResult(_0x2f311d,null))[_0xad63('0x3d')](handleError(_0x2f311d,null));};exports[_0xad63('0x42')]=function(_0x38fd8f,_0x45945c){return db['VoiceMail'][_0xad63('0x42')](_0x38fd8f[_0xad63('0x43')],{})[_0xad63('0x1d')](function(_0x53af60){var _0x14acd1=_0x38fd8f[_0xad63('0x44')][_0xad63('0x1f')]({'plain':!![]});if(!_0x14acd1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14acd1[_0xad63('0x45')]===_0xad63('0x44')){var _0x115c8d=_0x53af60[_0xad63('0x1f')]({'plain':!![]});var _0x5695bc=_0xad63('0x46');return db[_0xad63('0x47')][_0xad63('0x41')]({'where':{'name':_0x5695bc,'userProfileId':_0x14acd1['userProfileId']},'raw':!![]})[_0xad63('0x1d')](function(_0x2c69d2){if(_0x2c69d2&&_0x2c69d2[_0xad63('0x48')]===0x0){return db[_0xad63('0x20')][_0xad63('0x42')]({'name':_0x115c8d['name'],'resourceId':_0x115c8d['id'],'type':_0x2c69d2['name'],'sectionId':_0x2c69d2['id']},{})[_0xad63('0x1d')](function(){return _0x53af60;});}else{return _0x53af60;}})[_0xad63('0x3d')](function(_0x4cc153){logger[_0xad63('0x21')](_0xad63('0x49'),_0x4cc153);throw _0x4cc153;});}return _0x53af60;})[_0xad63('0x1d')](respondWithResult(_0x45945c,0xc9))[_0xad63('0x3d')](handleError(_0x45945c,null));};exports['update']=function(_0x19412a,_0x1c4679){if(_0x19412a[_0xad63('0x43')]['id']){delete _0x19412a[_0xad63('0x43')]['id'];}return db[_0xad63('0x27')][_0xad63('0x41')]({'where':{'id':_0x19412a[_0xad63('0x3e')]['id']}})[_0xad63('0x1d')](handleEntityNotFound(_0x1c4679,null))['then'](saveUpdates(_0x19412a[_0xad63('0x43')],null))['then'](respondWithResult(_0x1c4679,null))[_0xad63('0x3d')](handleError(_0x1c4679,null));};exports[_0xad63('0x1e')]=function(_0x568b43,_0x1f27f2){return db['VoiceMail']['find']({'where':{'id':_0x568b43['params']['id']}})[_0xad63('0x1d')](handleEntityNotFound(_0x1f27f2,null))[_0xad63('0x1d')](removeEntity(_0x1f27f2,null))[_0xad63('0x3d')](handleError(_0x1f27f2,null));};exports['getMessages']=function(_0x1ee20e,_0x19faf9,_0x3a22ba){return db['VoiceMail']['findOne']({'where':{'id':_0x1ee20e[_0xad63('0x3e')]['id']}})['then'](handleEntityNotFound(_0x19faf9,null))[_0xad63('0x1d')](function(_0x3bd107){var _0x593675;var _0x30d531={},_0x27d4c9={};_0x27d4c9[_0xad63('0x2e')]=_[_0xad63('0x2b')](db[_0xad63('0x4a')][_0xad63('0x4b')]);_0x27d4c9['query']=_[_0xad63('0x2b')](_0x1ee20e[_0xad63('0x2c')]);_0x27d4c9[_0xad63('0x2d')]=_['intersection'](_0x27d4c9[_0xad63('0x2e')],_0x27d4c9[_0xad63('0x2c')]);_0x30d531['attributes']=_[_0xad63('0x30')](_0x27d4c9[_0xad63('0x2e')],qs[_0xad63('0x31')](_0x1ee20e[_0xad63('0x2c')][_0xad63('0x31')]));_0x30d531[_0xad63('0x2f')]=_0x30d531[_0xad63('0x2f')]['length']?_0x30d531[_0xad63('0x2f')]:_0x27d4c9[_0xad63('0x2e')];if(!_0x1ee20e['query'][_0xad63('0x32')](_0xad63('0x33'))){_0x30d531[_0xad63('0x34')]=qs[_0xad63('0x34')](_0x1ee20e[_0xad63('0x2c')][_0xad63('0x34')]);_0x30d531[_0xad63('0x19')]=qs[_0xad63('0x19')](_0x1ee20e[_0xad63('0x2c')][_0xad63('0x19')]);}_0x30d531[_0xad63('0x35')]=qs[_0xad63('0x4c')](_0x1ee20e[_0xad63('0x2c')][_0xad63('0x4c')]);_0x30d531[_0xad63('0x36')]=qs[_0xad63('0x2d')](_[_0xad63('0x4d')](_0x1ee20e[_0xad63('0x2c')],_0x27d4c9[_0xad63('0x2d')]));if(_0x1ee20e[_0xad63('0x2c')][_0xad63('0x37')]){_0x30d531[_0xad63('0x36')]=_[_0xad63('0x38')](_0x30d531['where'],{'$or':_[_0xad63('0x26')](_0x30d531[_0xad63('0x2f')],function(_0x583979){var _0x2b4f60={};_0x2b4f60[_0x583979]={'$like':'%'+_0x1ee20e['query'][_0xad63('0x37')]+'%'};return _0x2b4f60;})});}_0x30d531[_0xad63('0x36')]=_[_0xad63('0x38')](_0x30d531[_0xad63('0x36')],{'mailboxuser':_0x3bd107['mailbox']});_0x30d531=_[_0xad63('0x38')]({},_0x30d531,_0x1ee20e['options']);return db[_0xad63('0x4a')][_0xad63('0x4e')](_0x30d531)[_0xad63('0x1d')](respondWithFilteredResult(_0x19faf9,_0x30d531));})[_0xad63('0x3d')](handleError(_0x19faf9,null));}; \ No newline at end of file +var _0x01d0=['create','getMessages','VoiceMailMessage','hasOwnProperty','pick','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','update','then','destroy','get','UserProfileResource','error','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','options','VoiceMail','includeAll','include','show','params','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId'];(function(_0x509b75,_0x180e22){var _0xd22c09=function(_0x532111){while(--_0x532111){_0x509b75['push'](_0x509b75['shift']());}};_0xd22c09(++_0x180e22);}(_0x01d0,0x1e7));var _0x001d=function(_0x1e789a,_0x52bf85){_0x1e789a=_0x1e789a-0x0;var _0x19bd3f=_0x01d0[_0x1e789a];return _0x19bd3f;};'use strict';var pdf=require(_0x001d('0x0'));var emlformat=require(_0x001d('0x1'));var rimraf=require(_0x001d('0x2'));var zipdir=require(_0x001d('0x3'));var jsonpatch=require(_0x001d('0x4'));var rp=require(_0x001d('0x5'));var moment=require(_0x001d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x001d('0x7'));var util=require(_0x001d('0x8'));var path=require('path');var sox=require(_0x001d('0x9'));var csv=require('to-csv');var ejs=require(_0x001d('0xa'));var fs=require('fs');var _=require(_0x001d('0xb'));var squel=require(_0x001d('0xc'));var crypto=require('crypto');var jsforce=require(_0x001d('0xd'));var deskjs=require(_0x001d('0xe'));var toCsv=require(_0x001d('0xf'));var querystring=require(_0x001d('0x10'));var Papa=require('papaparse');var Redis=require(_0x001d('0x11'));var authService=require(_0x001d('0x12'));var qs=require(_0x001d('0x13'));var as=require(_0x001d('0x14'));var hardwareService=require(_0x001d('0x15'));var logger=require(_0x001d('0x16'))(_0x001d('0x17'));var utils=require(_0x001d('0x18'));var config=require('../../config/environment');var db=require(_0x001d('0x19'))['db'];function respondWithStatusCode(_0x254724,_0x5a15cd){_0x5a15cd=_0x5a15cd||0xcc;return function(_0x3fcfbe){if(_0x3fcfbe){return _0x254724[_0x001d('0x1a')](_0x5a15cd);}return _0x254724[_0x001d('0x1b')](_0x5a15cd)[_0x001d('0x1c')]();};}function respondWithResult(_0x3921f2,_0x1499b5){_0x1499b5=_0x1499b5||0xc8;return function(_0x3194f1){if(_0x3194f1){return _0x3921f2[_0x001d('0x1b')](_0x1499b5)[_0x001d('0x1d')](_0x3194f1);}};}function respondWithFilteredResult(_0x24a6af,_0x39e338){return function(_0x2fad33){if(_0x2fad33){var _0x5b681b=_0x2fad33[_0x001d('0x1e')],_0x27c0b7=_0x39e338[_0x001d('0x1f')],_0xc4a69=_0x39e338[_0x001d('0x1f')]+_0x39e338[_0x001d('0x20')],_0x55a481;if(_0xc4a69>=_0x5b681b){_0xc4a69=_0x5b681b;_0x55a481=0xc8;}else{_0x55a481=0xce;}_0x24a6af[_0x001d('0x1b')](_0x55a481);return _0x24a6af['set']('Content-Range',_0x27c0b7+'-'+_0xc4a69+'/'+_0x5b681b)['json'](_0x2fad33);}return null;};}function patchUpdates(_0x3f1945){return function(_0x58891d){try{jsonpatch[_0x001d('0x21')](_0x58891d,_0x3f1945,!![]);}catch(_0x34d9aa){return BPromise['reject'](_0x34d9aa);}return _0x58891d['save']();};}function saveUpdates(_0x22ee3c,_0x3dc557){return function(_0x130084){if(_0x130084){return _0x130084[_0x001d('0x22')](_0x22ee3c)[_0x001d('0x23')](function(_0x4827e4){return _0x4827e4;});}return null;};}function removeEntity(_0x4737e3,_0x2fc1d4){return function(_0x1440a0){if(_0x1440a0){return _0x1440a0[_0x001d('0x24')]()['then'](function(){var _0x1d7705=_0x1440a0[_0x001d('0x25')]({'plain':!![]});var _0x1379c7='Voicemails';return db[_0x001d('0x26')]['destroy']({'where':{'type':_0x1379c7,'resourceId':_0x1d7705['id']}})['then'](function(){return _0x1440a0;});})['then'](function(){_0x4737e3[_0x001d('0x1b')](0xcc)[_0x001d('0x1c')]();});}};}function handleEntityNotFound(_0x2e5f90,_0x1b3afb){return function(_0x382422){if(!_0x382422){_0x2e5f90['sendStatus'](0x194);}return _0x382422;};}function handleError(_0x343d8b,_0x536a6f){_0x536a6f=_0x536a6f||0x1f4;return function(_0xb91cd1){logger[_0x001d('0x27')](_0xb91cd1['stack']);if(_0xb91cd1[_0x001d('0x28')]){delete _0xb91cd1[_0x001d('0x28')];}_0x343d8b[_0x001d('0x1b')](_0x536a6f)[_0x001d('0x29')](_0xb91cd1);};}exports[_0x001d('0x2a')]=function(_0x2599c7,_0x28242a){var _0x2b430a={},_0x5d0aae={},_0x3dc8d5={'count':0x0,'rows':[]};var _0x3a8005=_['map'](db['VoiceMail'][_0x001d('0x2b')],function(_0x320fb3){return{'name':_0x320fb3['fieldName'],'type':_0x320fb3[_0x001d('0x2c')][_0x001d('0x2d')]};});_0x5d0aae[_0x001d('0x2e')]=_[_0x001d('0x2f')](_0x3a8005,_0x001d('0x28'));_0x5d0aae[_0x001d('0x30')]=_[_0x001d('0x31')](_0x2599c7[_0x001d('0x30')]);_0x5d0aae[_0x001d('0x32')]=_['intersection'](_0x5d0aae[_0x001d('0x2e')],_0x5d0aae[_0x001d('0x30')]);_0x2b430a[_0x001d('0x33')]=_[_0x001d('0x34')](_0x5d0aae[_0x001d('0x2e')],qs[_0x001d('0x35')](_0x2599c7[_0x001d('0x30')][_0x001d('0x35')]));_0x2b430a[_0x001d('0x33')]=_0x2b430a[_0x001d('0x33')][_0x001d('0x36')]?_0x2b430a[_0x001d('0x33')]:_0x5d0aae[_0x001d('0x2e')];if(!_0x2599c7[_0x001d('0x30')]['hasOwnProperty'](_0x001d('0x37'))){_0x2b430a[_0x001d('0x20')]=qs[_0x001d('0x20')](_0x2599c7['query'][_0x001d('0x20')]);_0x2b430a[_0x001d('0x1f')]=qs[_0x001d('0x1f')](_0x2599c7[_0x001d('0x30')][_0x001d('0x1f')]);}_0x2b430a[_0x001d('0x38')]=qs[_0x001d('0x39')](_0x2599c7['query'][_0x001d('0x39')]);_0x2b430a[_0x001d('0x3a')]=qs['filters'](_['pick'](_0x2599c7[_0x001d('0x30')],_0x5d0aae[_0x001d('0x32')]),_0x3a8005);if(_0x2599c7[_0x001d('0x30')][_0x001d('0x3b')]){_0x2b430a[_0x001d('0x3a')]=_[_0x001d('0x3c')](_0x2b430a[_0x001d('0x3a')],{'$or':_[_0x001d('0x2f')](_0x3a8005,function(_0x1f57bf){if(_0x1f57bf['type']!=='VIRTUAL'){var _0x152931={};_0x152931[_0x1f57bf[_0x001d('0x28')]]={'$like':'%'+_0x2599c7['query'][_0x001d('0x3b')]+'%'};return _0x152931;}})});}_0x2b430a=_[_0x001d('0x3c')]({},_0x2b430a,_0x2599c7[_0x001d('0x3d')]);var _0x4a2caf={'where':_0x2b430a[_0x001d('0x3a')]};return db[_0x001d('0x3e')][_0x001d('0x1e')](_0x4a2caf)['then'](function(_0x414e6f){_0x3dc8d5[_0x001d('0x1e')]=_0x414e6f;if(_0x2599c7['query'][_0x001d('0x3f')]){_0x2b430a[_0x001d('0x40')]=[{'all':!![]}];}return db[_0x001d('0x3e')]['findAll'](_0x2b430a);})[_0x001d('0x23')](function(_0x39c16b){_0x3dc8d5['rows']=_0x39c16b;return _0x3dc8d5;})[_0x001d('0x23')](respondWithFilteredResult(_0x28242a,_0x2b430a))['catch'](handleError(_0x28242a,null));};exports[_0x001d('0x41')]=function(_0x47b325,_0x21e749){var _0x478c0c={'raw':!![],'where':{'id':_0x47b325[_0x001d('0x42')]['id']}},_0x12a443={};_0x12a443[_0x001d('0x2e')]=_[_0x001d('0x31')](db['VoiceMail'][_0x001d('0x2b')]);_0x12a443[_0x001d('0x30')]=_[_0x001d('0x31')](_0x47b325[_0x001d('0x30')]);_0x12a443['filters']=_[_0x001d('0x34')](_0x12a443['model'],_0x12a443[_0x001d('0x30')]);_0x478c0c['attributes']=_[_0x001d('0x34')](_0x12a443[_0x001d('0x2e')],qs['fields'](_0x47b325[_0x001d('0x30')][_0x001d('0x35')]));_0x478c0c['attributes']=_0x478c0c[_0x001d('0x33')]['length']?_0x478c0c[_0x001d('0x33')]:_0x12a443[_0x001d('0x2e')];if(_0x47b325[_0x001d('0x30')][_0x001d('0x3f')]){_0x478c0c[_0x001d('0x40')]=[{'all':!![]}];}_0x478c0c=_[_0x001d('0x3c')]({},_0x478c0c,_0x47b325[_0x001d('0x3d')]);return db[_0x001d('0x3e')][_0x001d('0x43')](_0x478c0c)[_0x001d('0x23')](handleEntityNotFound(_0x21e749,null))[_0x001d('0x23')](respondWithResult(_0x21e749,null))[_0x001d('0x44')](handleError(_0x21e749,null));};exports['create']=function(_0x4a6c49,_0x21470f){return db['VoiceMail']['create'](_0x4a6c49[_0x001d('0x45')],{})[_0x001d('0x23')](function(_0x541d59){var _0x3a8e26=_0x4a6c49['user']['get']({'plain':!![]});if(!_0x3a8e26)throw new Error(_0x001d('0x46'));if(_0x3a8e26['role']===_0x001d('0x47')){var _0x11d3a1=_0x541d59[_0x001d('0x25')]({'plain':!![]});var _0xa2d376='Voicemails';return db['UserProfileSection'][_0x001d('0x43')]({'where':{'name':_0xa2d376,'userProfileId':_0x3a8e26[_0x001d('0x48')]},'raw':!![]})[_0x001d('0x23')](function(_0x588421){if(_0x588421&&_0x588421['autoAssociation']===0x0){return db['UserProfileResource'][_0x001d('0x49')]({'name':_0x11d3a1[_0x001d('0x28')],'resourceId':_0x11d3a1['id'],'type':_0x588421[_0x001d('0x28')],'sectionId':_0x588421['id']},{})['then'](function(){return _0x541d59;});}else{return _0x541d59;}})[_0x001d('0x44')](function(_0x4a75e7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a75e7);throw _0x4a75e7;});}return _0x541d59;})[_0x001d('0x23')](respondWithResult(_0x21470f,0xc9))[_0x001d('0x44')](handleError(_0x21470f,null));};exports['update']=function(_0x512124,_0x5ad24d){if(_0x512124[_0x001d('0x45')]['id']){delete _0x512124['body']['id'];}return db[_0x001d('0x3e')]['find']({'where':{'id':_0x512124[_0x001d('0x42')]['id']}})[_0x001d('0x23')](handleEntityNotFound(_0x5ad24d,null))[_0x001d('0x23')](saveUpdates(_0x512124['body'],null))[_0x001d('0x23')](respondWithResult(_0x5ad24d,null))[_0x001d('0x44')](handleError(_0x5ad24d,null));};exports['destroy']=function(_0x4a4394,_0x3fcfa5){return db['VoiceMail'][_0x001d('0x43')]({'where':{'id':_0x4a4394['params']['id']}})[_0x001d('0x23')](handleEntityNotFound(_0x3fcfa5,null))[_0x001d('0x23')](removeEntity(_0x3fcfa5,null))[_0x001d('0x44')](handleError(_0x3fcfa5,null));};exports[_0x001d('0x4a')]=function(_0x59bc4f,_0x18926b,_0x2b59f0){return db[_0x001d('0x3e')]['findOne']({'where':{'id':_0x59bc4f[_0x001d('0x42')]['id']}})[_0x001d('0x23')](handleEntityNotFound(_0x18926b,null))[_0x001d('0x23')](function(_0xd027d3){var _0x25bfe9;var _0x42371c={},_0xaa3125={};_0xaa3125[_0x001d('0x2e')]=_[_0x001d('0x31')](db[_0x001d('0x4b')][_0x001d('0x2b')]);_0xaa3125[_0x001d('0x30')]=_[_0x001d('0x31')](_0x59bc4f[_0x001d('0x30')]);_0xaa3125[_0x001d('0x32')]=_[_0x001d('0x34')](_0xaa3125[_0x001d('0x2e')],_0xaa3125[_0x001d('0x30')]);_0x42371c[_0x001d('0x33')]=_['intersection'](_0xaa3125['model'],qs[_0x001d('0x35')](_0x59bc4f[_0x001d('0x30')][_0x001d('0x35')]));_0x42371c['attributes']=_0x42371c[_0x001d('0x33')]['length']?_0x42371c['attributes']:_0xaa3125['model'];if(!_0x59bc4f[_0x001d('0x30')][_0x001d('0x4c')](_0x001d('0x37'))){_0x42371c[_0x001d('0x20')]=qs[_0x001d('0x20')](_0x59bc4f['query'][_0x001d('0x20')]);_0x42371c[_0x001d('0x1f')]=qs[_0x001d('0x1f')](_0x59bc4f[_0x001d('0x30')]['offset']);}_0x42371c[_0x001d('0x38')]=qs[_0x001d('0x39')](_0x59bc4f[_0x001d('0x30')][_0x001d('0x39')]);_0x42371c[_0x001d('0x3a')]=qs[_0x001d('0x32')](_[_0x001d('0x4d')](_0x59bc4f[_0x001d('0x30')],_0xaa3125[_0x001d('0x32')]));if(_0x59bc4f['query'][_0x001d('0x3b')]){_0x42371c[_0x001d('0x3a')]=_[_0x001d('0x3c')](_0x42371c[_0x001d('0x3a')],{'$or':_[_0x001d('0x2f')](_0x42371c[_0x001d('0x33')],function(_0x190ea5){var _0x121568={};_0x121568[_0x190ea5]={'$like':'%'+_0x59bc4f[_0x001d('0x30')]['filter']+'%'};return _0x121568;})});}_0x42371c[_0x001d('0x3a')]=_[_0x001d('0x3c')](_0x42371c[_0x001d('0x3a')],{'mailboxuser':_0xd027d3[_0x001d('0x4e')]});_0x42371c=_[_0x001d('0x3c')]({},_0x42371c,_0x59bc4f[_0x001d('0x3d')]);return db[_0x001d('0x4b')][_0x001d('0x4f')](_0x42371c)[_0x001d('0x23')](respondWithFilteredResult(_0x18926b,_0x42371c));})[_0x001d('0x44')](handleError(_0x18926b,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7ed7622..9210ee5 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 _0x9972=['context','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceMail.attributes','define','voice_voicemail','mailbox_context','mailbox'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9972,0xaa));var _0x2997=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9972[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x2997('0x0'));var util=require(_0x2997('0x1'));var logger=require(_0x2997('0x2'))(_0x2997('0x3'));var moment=require('moment');var BPromise=require(_0x2997('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2997('0x5'));var rimraf=require('rimraf');var config=require(_0x2997('0x6'));var attributes=require(_0x2997('0x7'));module['exports']=function(_0x1ec3ed,_0x598152){return _0x1ec3ed[_0x2997('0x8')]('VoiceMail',attributes,{'tableName':_0x2997('0x9'),'paranoid':![],'indexes':[{'name':_0x2997('0xa'),'fields':[_0x2997('0xb'),_0x2997('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6acc=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail','mailbox','context','lodash'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x6acc,0x167));var _0xc6ac=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x6acc[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xc6ac('0x0'));var util=require(_0xc6ac('0x1'));var logger=require(_0xc6ac('0x2'))(_0xc6ac('0x3'));var moment=require(_0xc6ac('0x4'));var BPromise=require('bluebird');var rp=require(_0xc6ac('0x5'));var fs=require('fs');var path=require(_0xc6ac('0x6'));var rimraf=require(_0xc6ac('0x7'));var config=require(_0xc6ac('0x8'));var attributes=require(_0xc6ac('0x9'));module['exports']=function(_0x13416f,_0x4dbb37){return _0x13416f[_0xc6ac('0xa')](_0xc6ac('0xb'),attributes,{'tableName':_0xc6ac('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xc6ac('0xd'),_0xc6ac('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c40183e..9b0c3bb 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 _0x99d2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','error','VoiceMail,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1877e2,_0x2b76d4){var _0x44e96a=function(_0x8760bf){while(--_0x8760bf){_0x1877e2['push'](_0x1877e2['shift']());}};_0x44e96a(++_0x2b76d4);}(_0x99d2,0x15f));var _0x299d=function(_0x4041f0,_0xee6a53){_0x4041f0=_0x4041f0-0x0;var _0x53a230=_0x99d2[_0x4041f0];return _0x53a230;};'use strict';var _=require(_0x299d('0x0'));var util=require('util');var moment=require(_0x299d('0x1'));var BPromise=require(_0x299d('0x2'));var rs=require(_0x299d('0x3'));var fs=require('fs');var Redis=require(_0x299d('0x4'));var db=require(_0x299d('0x5'))['db'];var utils=require(_0x299d('0x6'));var logger=require(_0x299d('0x7'))(_0x299d('0x8'));var config=require(_0x299d('0x9'));var jayson=require(_0x299d('0xa'));var client=jayson[_0x299d('0xb')][_0x299d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e091e,_0x35fb9a,_0x594efa){return new BPromise(function(_0x1f2cdc,_0x3cd49a){return client[_0x299d('0xd')](_0x5e091e,_0x594efa)[_0x299d('0xe')](function(_0x31bfd4){logger['info']('VoiceMail,\x20%s,\x20%s',_0x35fb9a,_0x299d('0xf'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x35fb9a,'request\x20sent',JSON['stringify'](_0x31bfd4));if(_0x31bfd4[_0x299d('0x10')]){if(_0x31bfd4[_0x299d('0x10')]['code']===0x1f4){logger[_0x299d('0x10')](_0x299d('0x11'),_0x35fb9a,_0x31bfd4[_0x299d('0x10')][_0x299d('0x12')]);return _0x3cd49a(_0x31bfd4[_0x299d('0x10')][_0x299d('0x12')]);}logger[_0x299d('0x10')](_0x299d('0x11'),_0x35fb9a,_0x31bfd4[_0x299d('0x10')][_0x299d('0x12')]);return _0x1f2cdc(_0x31bfd4['error']['message']);}else{logger[_0x299d('0x13')](_0x299d('0x11'),_0x35fb9a,_0x299d('0xf'));_0x1f2cdc(_0x31bfd4['result'][_0x299d('0x12')]);}})[_0x299d('0x14')](function(_0x135d86){logger[_0x299d('0x10')](_0x299d('0x11'),_0x35fb9a,_0x135d86);_0x3cd49a(_0x135d86);});});} \ No newline at end of file +var _0x58df=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x58df,0x146));var _0xf58d=function(_0x233a2d,_0x38c95b){_0x233a2d=_0x233a2d-0x0;var _0x5628a2=_0x58df[_0x233a2d];return _0x5628a2;};'use strict';var _=require(_0xf58d('0x0'));var util=require(_0xf58d('0x1'));var moment=require(_0xf58d('0x2'));var BPromise=require(_0xf58d('0x3'));var rs=require(_0xf58d('0x4'));var fs=require('fs');var Redis=require(_0xf58d('0x5'));var db=require(_0xf58d('0x6'))['db'];var utils=require(_0xf58d('0x7'));var logger=require(_0xf58d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf58d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11b4e5,_0x334e06,_0x3deb7c){return new BPromise(function(_0x3b8183,_0x104944){return client['request'](_0x11b4e5,_0x3deb7c)[_0xf58d('0xa')](function(_0x4643e9){logger[_0xf58d('0xb')](_0xf58d('0xc'),_0x334e06,_0xf58d('0xd'));logger[_0xf58d('0xe')](_0xf58d('0xf'),_0x334e06,_0xf58d('0xd'),JSON[_0xf58d('0x10')](_0x4643e9));if(_0x4643e9[_0xf58d('0x11')]){if(_0x4643e9[_0xf58d('0x11')]['code']===0x1f4){logger['error'](_0xf58d('0xc'),_0x334e06,_0x4643e9['error'][_0xf58d('0x12')]);return _0x104944(_0x4643e9[_0xf58d('0x11')][_0xf58d('0x12')]);}logger[_0xf58d('0x11')]('VoiceMail,\x20%s,\x20%s',_0x334e06,_0x4643e9[_0xf58d('0x11')][_0xf58d('0x12')]);return _0x3b8183(_0x4643e9['error'][_0xf58d('0x12')]);}else{logger[_0xf58d('0xb')](_0xf58d('0xc'),_0x334e06,_0xf58d('0xd'));_0x3b8183(_0x4643e9['result']['message']);}})[_0xf58d('0x13')](function(_0x50ee2e){logger[_0xf58d('0x11')](_0xf58d('0xc'),_0x334e06,_0x50ee2e);_0x104944(_0x50ee2e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f25141a..0ca796b 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 _0xda19=['index','/:id','show','post','create','put','update','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x2de938,_0x3c6346){var _0x281a1b=function(_0x5d513c){while(--_0x5d513c){_0x2de938['push'](_0x2de938['shift']());}};_0x281a1b(++_0x3c6346);}(_0xda19,0xd5));var _0x9da1=function(_0x2925a6,_0x3545dc){_0x2925a6=_0x2925a6-0x0;var _0x1e2826=_0xda19[_0x2925a6];return _0x1e2826;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x9da1('0xb')]('/',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router[_0x9da1('0xd')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xe')]);router[_0x9da1('0xf')](_0x9da1('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9da1('0x10')]=router; \ No newline at end of file +var _0x326f=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x28c9f2,_0x19cab5){var _0x2333d1=function(_0x15c122){while(--_0x15c122){_0x28c9f2['push'](_0x28c9f2['shift']());}};_0x2333d1(++_0x19cab5);}(_0x326f,0xd1));var _0xf326=function(_0x411961,_0xfa5d3f){_0x411961=_0x411961-0x0;var _0x2faed6=_0x326f[_0x411961];return _0x2faed6;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xf326('0xd')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);router['delete'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index df636ac..fa20289 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 _0xca25=['sequelize','exports','VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x20229e,_0xa59f8a){var _0x317377=function(_0x290697){while(--_0x290697){_0x20229e['push'](_0x20229e['shift']());}};_0x317377(++_0xa59f8a);}(_0xca25,0x148));var _0x5ca2=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0xca25[_0x3a7db0];return _0x17cbba;};'use strict';var Sequelize=require(_0x5ca2('0x0'));module[_0x5ca2('0x1')]={'name':{'type':Sequelize[_0x5ca2('0x2')],'get':function(_0x5fc87e){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x5ca2('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x5ca2('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5ca2('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5ca2('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5ca2('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x5ca2('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5ca2('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5ca2('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x5ca2('0x5')](_0x5ca2('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x5ca2('0x4')],'defaultValue':''},'stamp':{'type':_0x5ca2('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0x655e=['sequelize','VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x4e2723,_0x481c0b){var _0x23ec17=function(_0x464360){while(--_0x464360){_0x4e2723['push'](_0x4e2723['shift']());}};_0x23ec17(++_0x481c0b);}(_0x655e,0x1f1));var _0xe655=function(_0x4faf1f,_0x3575cd){_0x4faf1f=_0x4faf1f-0x0;var _0xec6444=_0x655e[_0x4faf1f];return _0xec6444;};'use strict';var Sequelize=require(_0xe655('0x0'));module['exports']={'name':{'type':Sequelize[_0xe655('0x1')],'get':function(_0x3178aa){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xe655('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xe655('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe655('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xe655('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xe655('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe655('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe655('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xe655('0x4')](_0xe655('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xe655('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xe655('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2d92f4c..44102e6 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 _0x5b02=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','length','includeAll','create','body','find','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','attachment;\x20filename=\x22','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x9d2bdc,_0x4f2b6a){var _0x410615=function(_0x56b661){while(--_0x56b661){_0x9d2bdc['push'](_0x9d2bdc['shift']());}};_0x410615(++_0x4f2b6a);}(_0x5b02,0xe9));var _0x25b0=function(_0x367363,_0x45ceac){_0x367363=_0x367363-0x0;var _0x2c802c=_0x5b02[_0x367363];return _0x2c802c;};'use strict';var pdf=require(_0x25b0('0x0'));var emlformat=require(_0x25b0('0x1'));var rimraf=require(_0x25b0('0x2'));var zipdir=require(_0x25b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x25b0('0x5'));var util=require(_0x25b0('0x6'));var path=require(_0x25b0('0x7'));var sox=require(_0x25b0('0x8'));var csv=require(_0x25b0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var db=require(_0x25b0('0x17'))['db'];function respondWithStatusCode(_0x193c2b,_0x1d3178){_0x1d3178=_0x1d3178||0xcc;return function(_0x184452){if(_0x184452){return _0x193c2b[_0x25b0('0x18')](_0x1d3178);}return _0x193c2b[_0x25b0('0x19')](_0x1d3178)[_0x25b0('0x1a')]();};}function respondWithResult(_0x1ceeb1,_0x42cc07){_0x42cc07=_0x42cc07||0xc8;return function(_0x293203){if(_0x293203){return _0x1ceeb1[_0x25b0('0x19')](_0x42cc07)[_0x25b0('0x1b')](_0x293203);}};}function respondWithFilteredResult(_0x3b89e7,_0x40071c){return function(_0x5ac18d){if(_0x5ac18d){var _0x51542b=_0x5ac18d[_0x25b0('0x1c')],_0xfe1ea6=_0x40071c[_0x25b0('0x1d')],_0x4b2357=_0x40071c[_0x25b0('0x1d')]+_0x40071c['limit'],_0xa8280a;if(_0x4b2357>=_0x51542b){_0x4b2357=_0x51542b;_0xa8280a=0xc8;}else{_0xa8280a=0xce;}_0x3b89e7[_0x25b0('0x19')](_0xa8280a);return _0x3b89e7[_0x25b0('0x1e')](_0x25b0('0x1f'),_0xfe1ea6+'-'+_0x4b2357+'/'+_0x51542b)[_0x25b0('0x1b')](_0x5ac18d);}return null;};}function patchUpdates(_0xe750bf){return function(_0x25872d){try{jsonpatch['apply'](_0x25872d,_0xe750bf,!![]);}catch(_0x348d36){return BPromise[_0x25b0('0x20')](_0x348d36);}return _0x25872d[_0x25b0('0x21')]();};}function saveUpdates(_0x1507b5,_0x1dc691){return function(_0xea4162){if(_0xea4162){return _0xea4162[_0x25b0('0x22')](_0x1507b5)[_0x25b0('0x23')](function(_0x7bdaf9){return _0x7bdaf9;});}return null;};}function removeEntity(_0x35939f,_0x2b2eda){return function(_0x3ce1da){if(_0x3ce1da){return _0x3ce1da['destroy']()[_0x25b0('0x23')](function(){_0x35939f[_0x25b0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d7c17,_0x2023d8){return function(_0x3546f0){if(!_0x3546f0){_0x2d7c17['sendStatus'](0x194);}return _0x3546f0;};}function handleError(_0x4b87c9,_0x50089e){_0x50089e=_0x50089e||0x1f4;return function(_0x3fe815){logger[_0x25b0('0x24')](_0x3fe815[_0x25b0('0x25')]);if(_0x3fe815[_0x25b0('0x26')]){delete _0x3fe815[_0x25b0('0x26')];}_0x4b87c9[_0x25b0('0x19')](_0x50089e)[_0x25b0('0x27')](_0x3fe815);};}exports[_0x25b0('0x28')]=function(_0x22e024,_0x596d14){var _0x2ea408={},_0xbfba84={},_0x5ed7d2={'count':0x0,'rows':[]};var _0x567775=_['map'](db[_0x25b0('0x29')][_0x25b0('0x2a')],function(_0x251fad){return{'name':_0x251fad[_0x25b0('0x2b')],'type':_0x251fad[_0x25b0('0x2c')][_0x25b0('0x2d')]};});_0xbfba84[_0x25b0('0x2e')]=_[_0x25b0('0x2f')](_[_0x25b0('0x30')](_0x567775,_0x25b0('0x26')),[_0x25b0('0x26')]);_0xbfba84[_0x25b0('0x31')]=_[_0x25b0('0x32')](_0x22e024['query']);_0xbfba84['filters']=_[_0x25b0('0x33')](_0xbfba84['model'],_0xbfba84['query']);_0x2ea408[_0x25b0('0x34')]=_[_0x25b0('0x33')](_0xbfba84[_0x25b0('0x2e')],qs[_0x25b0('0x35')](_0x22e024[_0x25b0('0x31')]['fields']));_0x2ea408[_0x25b0('0x34')]=_0x2ea408[_0x25b0('0x34')]['length']?_0x2ea408[_0x25b0('0x34')]:_0xbfba84[_0x25b0('0x2e')];if(!_0x22e024['query'][_0x25b0('0x36')]('nolimit')){_0x2ea408[_0x25b0('0x37')]=qs[_0x25b0('0x37')](_0x22e024[_0x25b0('0x31')][_0x25b0('0x37')]);_0x2ea408[_0x25b0('0x1d')]=qs[_0x25b0('0x1d')](_0x22e024[_0x25b0('0x31')][_0x25b0('0x1d')]);}_0x2ea408[_0x25b0('0x38')]=qs['sort'](_0x22e024[_0x25b0('0x31')][_0x25b0('0x39')]);_0x2ea408[_0x25b0('0x3a')]=qs[_0x25b0('0x3b')](_[_0x25b0('0x3c')](_0x22e024[_0x25b0('0x31')],_0xbfba84[_0x25b0('0x3b')]),_0x567775);if(_0x22e024[_0x25b0('0x31')][_0x25b0('0x3d')]){_0x2ea408[_0x25b0('0x3a')]=_['merge'](_0x2ea408[_0x25b0('0x3a')],{'$or':_[_0x25b0('0x30')](_0x567775,function(_0x42a7af){if(_0x42a7af['type']!==_0x25b0('0x3e')){var _0x42a0ed={};_0x42a0ed[_0x42a7af[_0x25b0('0x26')]]={'$like':'%'+_0x22e024[_0x25b0('0x31')][_0x25b0('0x3d')]+'%'};return _0x42a0ed;}})});}_0x2ea408=_[_0x25b0('0x3f')]({},_0x2ea408,_0x22e024[_0x25b0('0x40')]);var _0x391493={'where':_0x2ea408['where']};return db['VoiceMailMessage'][_0x25b0('0x1c')](_0x391493)[_0x25b0('0x23')](function(_0x3f4ae0){_0x5ed7d2['count']=_0x3f4ae0;if(_0x22e024[_0x25b0('0x31')]['includeAll']){_0x2ea408[_0x25b0('0x41')]=[{'all':!![]}];}return db[_0x25b0('0x29')][_0x25b0('0x42')](_0x2ea408);})[_0x25b0('0x23')](function(_0x8a2eeb){_0x5ed7d2['rows']=_0x8a2eeb;return _0x5ed7d2;})[_0x25b0('0x23')](respondWithFilteredResult(_0x596d14,_0x2ea408))[_0x25b0('0x43')](handleError(_0x596d14,null));};exports[_0x25b0('0x44')]=function(_0x376d8a,_0x428799){var _0x5a9e86={'raw':!![],'where':{'id':_0x376d8a[_0x25b0('0x45')]['id']}},_0x327659={};_0x327659[_0x25b0('0x2e')]=_[_0x25b0('0x32')](db[_0x25b0('0x29')][_0x25b0('0x2a')]);_0x327659[_0x25b0('0x31')]=_[_0x25b0('0x32')](_0x376d8a[_0x25b0('0x31')]);_0x327659[_0x25b0('0x3b')]=_[_0x25b0('0x33')](_0x327659['model'],_0x327659[_0x25b0('0x31')]);_0x5a9e86['attributes']=_[_0x25b0('0x33')](_0x327659[_0x25b0('0x2e')],qs[_0x25b0('0x35')](_0x376d8a[_0x25b0('0x31')]['fields']));_0x5a9e86[_0x25b0('0x34')]=_0x5a9e86[_0x25b0('0x34')][_0x25b0('0x46')]?_0x5a9e86['attributes']:_0x327659[_0x25b0('0x2e')];if(_0x376d8a[_0x25b0('0x31')][_0x25b0('0x47')]){_0x5a9e86[_0x25b0('0x41')]=[{'all':!![]}];}_0x5a9e86=_[_0x25b0('0x3f')]({},_0x5a9e86,_0x376d8a[_0x25b0('0x40')]);return db[_0x25b0('0x29')]['find'](_0x5a9e86)[_0x25b0('0x23')](handleEntityNotFound(_0x428799,null))[_0x25b0('0x23')](respondWithResult(_0x428799,null))[_0x25b0('0x43')](handleError(_0x428799,null));};exports['create']=function(_0xbaeb06,_0xda629){return db[_0x25b0('0x29')][_0x25b0('0x48')](_0xbaeb06[_0x25b0('0x49')],{})['then'](respondWithResult(_0xda629,0xc9))[_0x25b0('0x43')](handleError(_0xda629,null));};exports[_0x25b0('0x22')]=function(_0x23de77,_0x524e9a){if(_0x23de77[_0x25b0('0x49')]['id']){delete _0x23de77[_0x25b0('0x49')]['id'];}return db[_0x25b0('0x29')][_0x25b0('0x4a')]({'where':{'id':_0x23de77[_0x25b0('0x45')]['id']}})[_0x25b0('0x23')](handleEntityNotFound(_0x524e9a,null))['then'](saveUpdates(_0x23de77['body'],null))['then'](respondWithResult(_0x524e9a,null))[_0x25b0('0x43')](handleError(_0x524e9a,null));};exports['destroy']=function(_0x48bc07,_0x2c5b9e){return db['VoiceMailMessage'][_0x25b0('0x4a')]({'where':{'id':_0x48bc07['params']['id']}})['then'](handleEntityNotFound(_0x2c5b9e,null))[_0x25b0('0x23')](removeEntity(_0x2c5b9e,null))[_0x25b0('0x43')](handleError(_0x2c5b9e,null));};exports[_0x25b0('0x4b')]=function(_0x34ded7,_0x42d139,_0xf3aef8){return db[_0x25b0('0x29')][_0x25b0('0x4a')]({'where':{'id':_0x34ded7[_0x25b0('0x45')]['id']},'attributes':['id',_0x25b0('0x4c'),'msg_id']})['then'](handleEntityNotFound(_0x42d139,null))['then'](function(_0xf1e6bf){if(_0xf1e6bf){if(!_0xf1e6bf[_0x25b0('0x4c')]){throw new db[(_0x25b0('0x4d'))][(_0x25b0('0x4e'))](_0x25b0('0x4f'));}var _0x3f460f={'Content-Type':_0x25b0('0x50'),'Content-Disposition':'attachment'};if(_0xf1e6bf[_0x25b0('0x51')]){_0x3f460f['Content-Disposition']=_0x25b0('0x52')+_0xf1e6bf['msg_id']+'.wav\x22';}_0x42d139[_0x25b0('0x1e')](_0x3f460f);return _0x42d139['send'](new Buffer(_0xf1e6bf['recording']));}})[_0x25b0('0x43')](handleError(_0x42d139,null));}; \ No newline at end of file +var _0xe28e=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','.wav\x22','set','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xe28e,0x1ba));var _0xee28=function(_0x273a87,_0x18ff6a){_0x273a87=_0x273a87-0x0;var _0x280a26=_0xe28e[_0x273a87];return _0x280a26;};'use strict';var pdf=require(_0xee28('0x0'));var emlformat=require(_0xee28('0x1'));var rimraf=require(_0xee28('0x2'));var zipdir=require(_0xee28('0x3'));var jsonpatch=require(_0xee28('0x4'));var rp=require(_0xee28('0x5'));var moment=require(_0xee28('0x6'));var BPromise=require(_0xee28('0x7'));var Mustache=require(_0xee28('0x8'));var util=require(_0xee28('0x9'));var path=require(_0xee28('0xa'));var sox=require(_0xee28('0xb'));var csv=require(_0xee28('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xc'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var db=require(_0xee28('0x18'))['db'];function respondWithStatusCode(_0x3feffa,_0x2488cf){_0x2488cf=_0x2488cf||0xcc;return function(_0x267031){if(_0x267031){return _0x3feffa[_0xee28('0x19')](_0x2488cf);}return _0x3feffa[_0xee28('0x1a')](_0x2488cf)['end']();};}function respondWithResult(_0x4201ad,_0x1df69a){_0x1df69a=_0x1df69a||0xc8;return function(_0x555b9c){if(_0x555b9c){return _0x4201ad[_0xee28('0x1a')](_0x1df69a)[_0xee28('0x1b')](_0x555b9c);}};}function respondWithFilteredResult(_0x5b510a,_0x11ac93){return function(_0x17c99a){if(_0x17c99a){var _0x3d3a5c=_0x17c99a['count'],_0x343358=_0x11ac93[_0xee28('0x1c')],_0x1ff99e=_0x11ac93['offset']+_0x11ac93[_0xee28('0x1d')],_0x11c95d;if(_0x1ff99e>=_0x3d3a5c){_0x1ff99e=_0x3d3a5c;_0x11c95d=0xc8;}else{_0x11c95d=0xce;}_0x5b510a[_0xee28('0x1a')](_0x11c95d);return _0x5b510a['set'](_0xee28('0x1e'),_0x343358+'-'+_0x1ff99e+'/'+_0x3d3a5c)['json'](_0x17c99a);}return null;};}function patchUpdates(_0x3c9ac6){return function(_0x575259){try{jsonpatch[_0xee28('0x1f')](_0x575259,_0x3c9ac6,!![]);}catch(_0x577332){return BPromise[_0xee28('0x20')](_0x577332);}return _0x575259['save']();};}function saveUpdates(_0x2fdf11,_0x2a01ff){return function(_0x96f5db){if(_0x96f5db){return _0x96f5db[_0xee28('0x21')](_0x2fdf11)[_0xee28('0x22')](function(_0x1280f5){return _0x1280f5;});}return null;};}function removeEntity(_0x2dbd49,_0x4bda53){return function(_0x342798){if(_0x342798){return _0x342798[_0xee28('0x23')]()[_0xee28('0x22')](function(){_0x2dbd49['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d8e4,_0x4a524d){return function(_0x1519ae){if(!_0x1519ae){_0x17d8e4[_0xee28('0x19')](0x194);}return _0x1519ae;};}function handleError(_0x57b11a,_0x3acfc9){_0x3acfc9=_0x3acfc9||0x1f4;return function(_0x2be7ff){logger[_0xee28('0x24')](_0x2be7ff[_0xee28('0x25')]);if(_0x2be7ff[_0xee28('0x26')]){delete _0x2be7ff[_0xee28('0x26')];}_0x57b11a['status'](_0x3acfc9)[_0xee28('0x27')](_0x2be7ff);};}exports['index']=function(_0x51a87e,_0x54528b){var _0x587aac={},_0x51eae7={},_0x8373a7={'count':0x0,'rows':[]};var _0x884e7d=_[_0xee28('0x28')](db[_0xee28('0x29')][_0xee28('0x2a')],function(_0x417840){return{'name':_0x417840[_0xee28('0x2b')],'type':_0x417840['type'][_0xee28('0x2c')]};});_0x51eae7[_0xee28('0x2d')]=_[_0xee28('0x2e')](_['map'](_0x884e7d,_0xee28('0x26')),[_0xee28('0x26')]);_0x51eae7[_0xee28('0x2f')]=_[_0xee28('0x30')](_0x51a87e[_0xee28('0x2f')]);_0x51eae7[_0xee28('0x31')]=_[_0xee28('0x32')](_0x51eae7['model'],_0x51eae7[_0xee28('0x2f')]);_0x587aac[_0xee28('0x33')]=_['intersection'](_0x51eae7[_0xee28('0x2d')],qs[_0xee28('0x34')](_0x51a87e[_0xee28('0x2f')][_0xee28('0x34')]));_0x587aac[_0xee28('0x33')]=_0x587aac[_0xee28('0x33')][_0xee28('0x35')]?_0x587aac['attributes']:_0x51eae7['model'];if(!_0x51a87e['query'][_0xee28('0x36')](_0xee28('0x37'))){_0x587aac[_0xee28('0x1d')]=qs[_0xee28('0x1d')](_0x51a87e[_0xee28('0x2f')][_0xee28('0x1d')]);_0x587aac['offset']=qs[_0xee28('0x1c')](_0x51a87e[_0xee28('0x2f')]['offset']);}_0x587aac['order']=qs[_0xee28('0x38')](_0x51a87e[_0xee28('0x2f')]['sort']);_0x587aac['where']=qs[_0xee28('0x31')](_[_0xee28('0x39')](_0x51a87e['query'],_0x51eae7[_0xee28('0x31')]),_0x884e7d);if(_0x51a87e[_0xee28('0x2f')][_0xee28('0x3a')]){_0x587aac[_0xee28('0x3b')]=_[_0xee28('0x3c')](_0x587aac[_0xee28('0x3b')],{'$or':_[_0xee28('0x28')](_0x884e7d,function(_0x1be858){if(_0x1be858[_0xee28('0x3d')]!==_0xee28('0x3e')){var _0x43b587={};_0x43b587[_0x1be858[_0xee28('0x26')]]={'$like':'%'+_0x51a87e['query'][_0xee28('0x3a')]+'%'};return _0x43b587;}})});}_0x587aac=_['merge']({},_0x587aac,_0x51a87e['options']);var _0x265ae5={'where':_0x587aac['where']};return db[_0xee28('0x29')]['count'](_0x265ae5)[_0xee28('0x22')](function(_0x4d096c){_0x8373a7[_0xee28('0x3f')]=_0x4d096c;if(_0x51a87e[_0xee28('0x2f')][_0xee28('0x40')]){_0x587aac[_0xee28('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xee28('0x42')](_0x587aac);})['then'](function(_0x45ed94){_0x8373a7[_0xee28('0x43')]=_0x45ed94;return _0x8373a7;})[_0xee28('0x22')](respondWithFilteredResult(_0x54528b,_0x587aac))[_0xee28('0x44')](handleError(_0x54528b,null));};exports[_0xee28('0x45')]=function(_0x2e046e,_0x216ca7){var _0x5a4b9c={'raw':!![],'where':{'id':_0x2e046e[_0xee28('0x46')]['id']}},_0x4d9d21={};_0x4d9d21['model']=_['keys'](db[_0xee28('0x29')][_0xee28('0x2a')]);_0x4d9d21['query']=_[_0xee28('0x30')](_0x2e046e[_0xee28('0x2f')]);_0x4d9d21[_0xee28('0x31')]=_[_0xee28('0x32')](_0x4d9d21[_0xee28('0x2d')],_0x4d9d21[_0xee28('0x2f')]);_0x5a4b9c[_0xee28('0x33')]=_['intersection'](_0x4d9d21[_0xee28('0x2d')],qs[_0xee28('0x34')](_0x2e046e[_0xee28('0x2f')][_0xee28('0x34')]));_0x5a4b9c[_0xee28('0x33')]=_0x5a4b9c['attributes'][_0xee28('0x35')]?_0x5a4b9c[_0xee28('0x33')]:_0x4d9d21['model'];if(_0x2e046e[_0xee28('0x2f')][_0xee28('0x40')]){_0x5a4b9c[_0xee28('0x41')]=[{'all':!![]}];}_0x5a4b9c=_[_0xee28('0x3c')]({},_0x5a4b9c,_0x2e046e[_0xee28('0x47')]);return db[_0xee28('0x29')]['find'](_0x5a4b9c)[_0xee28('0x22')](handleEntityNotFound(_0x216ca7,null))['then'](respondWithResult(_0x216ca7,null))['catch'](handleError(_0x216ca7,null));};exports[_0xee28('0x48')]=function(_0x2f240f,_0x5f0b36){return db[_0xee28('0x29')][_0xee28('0x48')](_0x2f240f[_0xee28('0x49')],{})['then'](respondWithResult(_0x5f0b36,0xc9))['catch'](handleError(_0x5f0b36,null));};exports[_0xee28('0x21')]=function(_0x212899,_0x1bb1ac){if(_0x212899[_0xee28('0x49')]['id']){delete _0x212899[_0xee28('0x49')]['id'];}return db[_0xee28('0x29')][_0xee28('0x4a')]({'where':{'id':_0x212899[_0xee28('0x46')]['id']}})[_0xee28('0x22')](handleEntityNotFound(_0x1bb1ac,null))[_0xee28('0x22')](saveUpdates(_0x212899['body'],null))[_0xee28('0x22')](respondWithResult(_0x1bb1ac,null))['catch'](handleError(_0x1bb1ac,null));};exports[_0xee28('0x23')]=function(_0x1a5b19,_0x139b50){return db[_0xee28('0x29')][_0xee28('0x4a')]({'where':{'id':_0x1a5b19['params']['id']}})['then'](handleEntityNotFound(_0x139b50,null))['then'](removeEntity(_0x139b50,null))[_0xee28('0x44')](handleError(_0x139b50,null));};exports['download']=function(_0x57240f,_0x659fc4,_0x5f3a9e){return db[_0xee28('0x29')][_0xee28('0x4a')]({'where':{'id':_0x57240f[_0xee28('0x46')]['id']},'attributes':['id',_0xee28('0x4b'),_0xee28('0x4c')]})[_0xee28('0x22')](handleEntityNotFound(_0x659fc4,null))[_0xee28('0x22')](function(_0xc1bdba){if(_0xc1bdba){if(!_0xc1bdba[_0xee28('0x4b')]){throw new db[(_0xee28('0x4d'))]['ValidationError'](_0xee28('0x4e'));}var _0x298e0f={'Content-Type':_0xee28('0x4f'),'Content-Disposition':'attachment'};if(_0xc1bdba['msg_id']){_0x298e0f['Content-Disposition']='attachment;\x20filename=\x22'+_0xc1bdba[_0xee28('0x4c')]+_0xee28('0x50');}_0x659fc4[_0xee28('0x51')](_0x298e0f);return _0x659fc4['send'](new Buffer(_0xc1bdba[_0xee28('0x4b')]));}})[_0xee28('0x44')](handleError(_0x659fc4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0e401ee..0286a5c 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 _0x74d9=['../../config/logger','api','moment','request-promise','../../config/environment','./voiceMailMessage.attributes','exports','dir','lodash','util'];(function(_0x59f615,_0x156f8f){var _0x4f7261=function(_0x1c9ba7){while(--_0x1c9ba7){_0x59f615['push'](_0x59f615['shift']());}};_0x4f7261(++_0x156f8f);}(_0x74d9,0x134));var _0x974d=function(_0x10bfc9,_0x42f69c){_0x10bfc9=_0x10bfc9-0x0;var _0x3b4dbe=_0x74d9[_0x10bfc9];return _0x3b4dbe;};'use strict';var _=require(_0x974d('0x0'));var util=require(_0x974d('0x1'));var logger=require(_0x974d('0x2'))(_0x974d('0x3'));var moment=require(_0x974d('0x4'));var BPromise=require('bluebird');var rp=require(_0x974d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x974d('0x6'));var attributes=require(_0x974d('0x7'));module[_0x974d('0x8')]=function(_0x4a73e9,_0x192eb2){return _0x4a73e9['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x974d('0x9'),'fields':[_0x974d('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x897a=['voice_voicemail_messages','dir','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage'];(function(_0x4498a2,_0x143689){var _0x411aa8=function(_0x1a85dc){while(--_0x1a85dc){_0x4498a2['push'](_0x4498a2['shift']());}};_0x411aa8(++_0x143689);}(_0x897a,0x9e));var _0xa897=function(_0xe4c25c,_0x59f149){_0xe4c25c=_0xe4c25c-0x0;var _0x9c05f5=_0x897a[_0xe4c25c];return _0x9c05f5;};'use strict';var _=require(_0xa897('0x0'));var util=require(_0xa897('0x1'));var logger=require(_0xa897('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa897('0x3'));var rp=require(_0xa897('0x4'));var fs=require('fs');var path=require(_0xa897('0x5'));var rimraf=require(_0xa897('0x6'));var config=require(_0xa897('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xa897('0x8')]=function(_0x11936b,_0x20aa90){return _0x11936b[_0xa897('0x9')](_0xa897('0xa'),attributes,{'tableName':_0xa897('0xb'),'paranoid':![],'indexes':[{'name':_0xa897('0xc'),'fields':[_0xa897('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2101586..f3686bc 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['client','http','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5424e8,_0x26a0a4){var _0xd131d4=function(_0x357a14){while(--_0x357a14){_0x5424e8['push'](_0x5424e8['shift']());}};_0xd131d4(++_0x26a0a4);}(_0x0295,0x1f0));var _0x5029=function(_0x3a6b78,_0x2d62be){_0x3a6b78=_0x3a6b78-0x0;var _0x4943d4=_0x0295[_0x3a6b78];return _0x4943d4;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5f38ed,_0x3f7273){var _0x4e78b7=function(_0x5c4c6c){while(--_0x5c4c6c){_0x5f38ed['push'](_0x5f38ed['shift']());}};_0x4e78b7(++_0x3f7273);}(_0x57ca,0x108));var _0xa57c=function(_0xefcafc,_0x457488){_0xefcafc=_0xefcafc-0x0;var _0x274252=_0x57ca[_0xefcafc];return _0x274252;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index b1d0a03..297e5d9 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 _0x7b22=['/:id','show','getSounds','post','/:id/sounds','addSound','update','destroy','delete','/:id/sounds/:id2','removeSound','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index'];(function(_0x254635,_0x472b4c){var _0x35293c=function(_0x731a6d){while(--_0x731a6d){_0x254635['push'](_0x254635['shift']());}};_0x35293c(++_0x472b4c);}(_0x7b22,0x1d9));var _0x27b2=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x7b22[_0x56ba92];return _0x8fe94d;};'use strict';var multer=require('multer');var util=require(_0x27b2('0x0'));var path=require(_0x27b2('0x1'));var timeout=require(_0x27b2('0x2'));var express=require(_0x27b2('0x3'));var router=express[_0x27b2('0x4')]();var auth=require(_0x27b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x27b2('0x6'));var controller=require(_0x27b2('0x7'));router[_0x27b2('0x8')]('/',auth[_0x27b2('0x9')](),controller[_0x27b2('0xa')]);router[_0x27b2('0x8')](_0x27b2('0xb'),auth['isAuthenticated'](),controller[_0x27b2('0xc')]);router['get']('/:id/sounds',auth[_0x27b2('0x9')](),controller[_0x27b2('0xd')]);router[_0x27b2('0xe')]('/',auth[_0x27b2('0x9')](),controller['create']);router[_0x27b2('0xe')](_0x27b2('0xf'),auth[_0x27b2('0x9')](),controller[_0x27b2('0x10')]);router['put'](_0x27b2('0xb'),auth[_0x27b2('0x9')](),controller[_0x27b2('0x11')]);router['delete']('/:id',auth[_0x27b2('0x9')](),controller[_0x27b2('0x12')]);router[_0x27b2('0x13')](_0x27b2('0x14'),auth[_0x27b2('0x9')](),controller[_0x27b2('0x15')]);module['exports']=router; \ No newline at end of file +var _0xcb47=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound','/:id','update','delete','destroy','exports','multer','util'];(function(_0x245885,_0x15248e){var _0x5911e0=function(_0x4b1465){while(--_0x4b1465){_0x245885['push'](_0x245885['shift']());}};_0x5911e0(++_0x15248e);}(_0xcb47,0xa6));var _0x7cb4=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xcb47[_0x18fb16];return _0x147b0d;};'use strict';var multer=require(_0x7cb4('0x0'));var util=require(_0x7cb4('0x1'));var path=require(_0x7cb4('0x2'));var timeout=require(_0x7cb4('0x3'));var express=require(_0x7cb4('0x4'));var router=express[_0x7cb4('0x5')]();var auth=require(_0x7cb4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7cb4('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0x7cb4('0x8')]('/',auth[_0x7cb4('0x9')](),controller[_0x7cb4('0xa')]);router[_0x7cb4('0x8')]('/:id',auth[_0x7cb4('0x9')](),controller['show']);router['get'](_0x7cb4('0xb'),auth[_0x7cb4('0x9')](),controller[_0x7cb4('0xc')]);router[_0x7cb4('0xd')]('/',auth[_0x7cb4('0x9')](),controller[_0x7cb4('0xe')]);router[_0x7cb4('0xd')](_0x7cb4('0xb'),auth[_0x7cb4('0x9')](),controller[_0x7cb4('0xf')]);router['put'](_0x7cb4('0x10'),auth['isAuthenticated'](),controller[_0x7cb4('0x11')]);router[_0x7cb4('0x12')](_0x7cb4('0x10'),auth['isAuthenticated'](),controller[_0x7cb4('0x13')]);router[_0x7cb4('0x12')]('/:id/sounds/:id2',auth[_0x7cb4('0x9')](),controller['removeSound']);module[_0x7cb4('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d647c78..9245d6a 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 _0x7c0e=['exports','STRING','quietmp3nb','quietmp3','alpha','sequelize'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x7c0e,0x11f));var _0xe7c0=function(_0x43f287,_0x326ce0){_0x43f287=_0x43f287-0x0;var _0x3f8393=_0x7c0e[_0x43f287];return _0x3f8393;};'use strict';var Sequelize=require(_0xe7c0('0x0'));module[_0xe7c0('0x1')]={'name':{'type':Sequelize[_0xe7c0('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom','files','mp3nb',_0xe7c0('0x3'),_0xe7c0('0x4'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xe7c0('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xe7c0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe7c0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe7c0('0x2')],'allowNull':!![],'defaultValue':_0xe7c0('0x5')},'format':{'type':Sequelize[_0xe7c0('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b12=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','quietmp3nb','quietmp3'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x6b12,0x1a8));var _0x26b1=function(_0x220a98,_0x173490){_0x220a98=_0x220a98-0x0;var _0x5dea3e=_0x6b12[_0x220a98];return _0x5dea3e;};'use strict';var Sequelize=require(_0x26b1('0x0'));module[_0x26b1('0x1')]={'name':{'type':Sequelize[_0x26b1('0x2')],'allowNull':![],'unique':_0x26b1('0x3')},'mode':{'type':Sequelize[_0x26b1('0x4')](_0x26b1('0x5'),'files','mp3nb',_0x26b1('0x6'),_0x26b1('0x7'),_0x26b1('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x26b1('0x2')],'allowNull':!![],'defaultValue':_0x26b1('0x9')},'format':{'type':Sequelize[_0x26b1('0x2')],'allowNull':!![]},'stamp':{'type':_0x26b1('0xa')},'defaultEntry':{'type':Sequelize[_0x26b1('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 4442cba..f45a91e 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 _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x2f8945,_0x3f8295){var _0x3fba40=function(_0xe3cd2a){while(--_0xe3cd2a){_0x2f8945['push'](_0x2f8945['shift']());}};_0x3fba40(++_0x3f8295);}(_0xb10b,0x12a));var _0xbb10=function(_0x500e16,_0x30ec9a){_0x500e16=_0x500e16-0x0;var _0x54f1d1=_0xb10b[_0x500e16];return _0x54f1d1;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0xa10d24,_0x21849b){var _0x5c4664=function(_0x34293e){while(--_0x34293e){_0xa10d24['push'](_0xa10d24['shift']());}};_0x5c4664(++_0x21849b);}(_0xb10b,0x12a));var _0xbb10=function(_0x12c45d,_0x97707a){_0x12c45d=_0x12c45d-0x0;var _0x4f2a58=_0xb10b[_0x12c45d];return _0x4f2a58;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 3ac910e..de552ea 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 _0xf04f=['define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf04f,0xb7));var _0xff04=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf04f[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xff04('0x0'));var util=require(_0xff04('0x1'));var logger=require(_0xff04('0x2'))(_0xff04('0x3'));var moment=require(_0xff04('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff04('0x5'));var config=require(_0xff04('0x6'));var attributes=require(_0xff04('0x7'));module[_0xff04('0x8')]=function(_0x304738,_0x4cd447){return _0x304738[_0xff04('0x9')](_0xff04('0xa'),attributes,{'tableName':_0xff04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd3ab=['../../config/logger','api','request-promise','path','rimraf','define','VoiceMusicOnHold','util'];(function(_0x26bd0a,_0x4fc151){var _0x4ddafa=function(_0xe836c){while(--_0xe836c){_0x26bd0a['push'](_0x26bd0a['shift']());}};_0x4ddafa(++_0x4fc151);}(_0xd3ab,0x107));var _0xbd3a=function(_0x12d7da,_0x19ff23){_0x12d7da=_0x12d7da-0x0;var _0x5a683f=_0xd3ab[_0x12d7da];return _0x5a683f;};'use strict';var _=require('lodash');var util=require(_0xbd3a('0x0'));var logger=require(_0xbd3a('0x1'))(_0xbd3a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd3a('0x3'));var fs=require('fs');var path=require(_0xbd3a('0x4'));var rimraf=require(_0xbd3a('0x5'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x220b77,_0x2062d0){return _0x220b77[_0xbd3a('0x6')](_0xbd3a('0x7'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index e6b0b68..b2d2518 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 _0xc087=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error'];(function(_0x185812,_0x19d407){var _0x5866da=function(_0x34e3f5){while(--_0x34e3f5){_0x185812['push'](_0x185812['shift']());}};_0x5866da(++_0x19d407);}(_0xc087,0xc4));var _0x7c08=function(_0x211087,_0x354fdd){_0x211087=_0x211087-0x0;var _0x2a581f=_0xc087[_0x211087];return _0x2a581f;};'use strict';var _=require(_0x7c08('0x0'));var util=require(_0x7c08('0x1'));var moment=require(_0x7c08('0x2'));var BPromise=require(_0x7c08('0x3'));var rs=require(_0x7c08('0x4'));var fs=require('fs');var Redis=require(_0x7c08('0x5'));var db=require(_0x7c08('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c08('0x7'))(_0x7c08('0x8'));var config=require(_0x7c08('0x9'));var jayson=require(_0x7c08('0xa'));var client=jayson[_0x7c08('0xb')][_0x7c08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50f663,_0x2372d6,_0xc12de4){return new BPromise(function(_0x56b482,_0x3ee0ca){return client[_0x7c08('0xd')](_0x50f663,_0xc12de4)[_0x7c08('0xe')](function(_0x5d5809){logger[_0x7c08('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2372d6,_0x7c08('0x10'));logger[_0x7c08('0x11')](_0x7c08('0x12'),_0x2372d6,_0x7c08('0x10'),JSON['stringify'](_0x5d5809));if(_0x5d5809['error']){if(_0x5d5809[_0x7c08('0x13')][_0x7c08('0x14')]===0x1f4){logger[_0x7c08('0x13')](_0x7c08('0x15'),_0x2372d6,_0x5d5809[_0x7c08('0x13')]['message']);return _0x3ee0ca(_0x5d5809[_0x7c08('0x13')]['message']);}logger[_0x7c08('0x13')](_0x7c08('0x15'),_0x2372d6,_0x5d5809[_0x7c08('0x13')][_0x7c08('0x16')]);return _0x56b482(_0x5d5809['error']['message']);}else{logger['info'](_0x7c08('0x15'),_0x2372d6,_0x7c08('0x10'));_0x56b482(_0x5d5809['result']['message']);}})[_0x7c08('0x17')](function(_0x2e1b11){logger[_0x7c08('0x13')](_0x7c08('0x15'),_0x2372d6,_0x2e1b11);_0x3ee0ca(_0x2e1b11);});});} \ No newline at end of file +var _0x9209=['request\x20sent','stringify','error','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x3db8b4,_0x4c6d0b){var _0x3e6861=function(_0x11fbe5){while(--_0x11fbe5){_0x3db8b4['push'](_0x3db8b4['shift']());}};_0x3e6861(++_0x4c6d0b);}(_0x9209,0x149));var _0x9920=function(_0x579006,_0x201ec8){_0x579006=_0x579006-0x0;var _0x4008c0=_0x9209[_0x579006];return _0x4008c0;};'use strict';var _=require('lodash');var util=require(_0x9920('0x0'));var moment=require(_0x9920('0x1'));var BPromise=require(_0x9920('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9920('0x3'));var db=require(_0x9920('0x4'))['db'];var utils=require(_0x9920('0x5'));var logger=require(_0x9920('0x6'))(_0x9920('0x7'));var config=require(_0x9920('0x8'));var jayson=require(_0x9920('0x9'));var client=jayson[_0x9920('0xa')][_0x9920('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x308755,_0x5b42f5,_0x14d9b7){return new BPromise(function(_0x5d9c9b,_0x561b91){return client[_0x9920('0xc')](_0x308755,_0x14d9b7)[_0x9920('0xd')](function(_0x4eb691){logger[_0x9920('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5b42f5,'request\x20sent');logger[_0x9920('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x5b42f5,_0x9920('0x10'),JSON[_0x9920('0x11')](_0x4eb691));if(_0x4eb691[_0x9920('0x12')]){if(_0x4eb691[_0x9920('0x12')]['code']===0x1f4){logger[_0x9920('0x12')](_0x9920('0x13'),_0x5b42f5,_0x4eb691[_0x9920('0x12')][_0x9920('0x14')]);return _0x561b91(_0x4eb691[_0x9920('0x12')][_0x9920('0x14')]);}logger['error'](_0x9920('0x13'),_0x5b42f5,_0x4eb691[_0x9920('0x12')][_0x9920('0x14')]);return _0x5d9c9b(_0x4eb691[_0x9920('0x12')][_0x9920('0x14')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5b42f5,_0x9920('0x10'));_0x5d9c9b(_0x4eb691[_0x9920('0x15')][_0x9920('0x14')]);}})[_0x9920('0x16')](function(_0x2607a8){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5b42f5,_0x2607a8);_0x561b91(_0x2607a8);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3a73fd4..fb6e665 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 _0x5839=['create','put','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','/:id','show','/:id/users','getAgents','post'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x5839,0x155));var _0x9583=function(_0x35f3b5,_0xcbee2d){_0x35f3b5=_0x35f3b5-0x0;var _0x5d2a4c=_0x5839[_0x35f3b5];return _0x5d2a4c;};'use strict';var multer=require(_0x9583('0x0'));var util=require(_0x9583('0x1'));var path=require(_0x9583('0x2'));var timeout=require(_0x9583('0x3'));var express=require(_0x9583('0x4'));var router=express[_0x9583('0x5')]();var auth=require(_0x9583('0x6'));var interaction=require(_0x9583('0x7'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x9583('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9583('0x8')](_0x9583('0x9'),auth[_0x9583('0xa')](),controller['describe']);router[_0x9583('0x8')](_0x9583('0xb'),auth[_0x9583('0xa')](),controller[_0x9583('0xc')]);router[_0x9583('0x8')](_0x9583('0xd'),auth[_0x9583('0xa')](),controller[_0x9583('0xe')]);router[_0x9583('0xf')]('/',auth['isAuthenticated'](),controller[_0x9583('0x10')]);router['post'](_0x9583('0xd'),auth[_0x9583('0xa')](),controller['addAgents']);router[_0x9583('0x11')]('/:id',auth[_0x9583('0xa')](),controller['update']);router[_0x9583('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9583('0x13')]);router[_0x9583('0x12')](_0x9583('0xd'),auth['isAuthenticated'](),controller[_0x9583('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1476=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','describe','/:id','/:id/users','getAgents','post','addAgents','delete','destroy','removeAgents','path'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1476,0x1f3));var _0x6147=function(_0xf0e922,_0x3ca0ce){_0xf0e922=_0xf0e922-0x0;var _0x30e0a3=_0x1476[_0xf0e922];return _0x30e0a3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6147('0x0'));var timeout=require(_0x6147('0x1'));var express=require(_0x6147('0x2'));var router=express[_0x6147('0x3')]();var auth=require(_0x6147('0x4'));var interaction=require(_0x6147('0x5'));var config=require(_0x6147('0x6'));var controller=require(_0x6147('0x7'));router[_0x6147('0x8')]('/',auth[_0x6147('0x9')](),controller['index']);router[_0x6147('0x8')](_0x6147('0xa'),auth[_0x6147('0x9')](),controller[_0x6147('0xb')]);router['get'](_0x6147('0xc'),auth[_0x6147('0x9')](),controller['show']);router[_0x6147('0x8')](_0x6147('0xd'),auth[_0x6147('0x9')](),controller[_0x6147('0xe')]);router[_0x6147('0xf')]('/',auth[_0x6147('0x9')](),controller['create']);router[_0x6147('0xf')]('/:id/users',auth[_0x6147('0x9')](),controller[_0x6147('0x10')]);router['put'](_0x6147('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6147('0x11')](_0x6147('0xc'),auth[_0x6147('0x9')](),controller[_0x6147('0x12')]);router[_0x6147('0x11')]('/:id/users',auth[_0x6147('0x9')](),controller[_0x6147('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d48198f..0e92159 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 _0x8228=['sequelize','VIRTUAL','system-','name','STRING','INTEGER'];(function(_0x21d1eb,_0x56f664){var _0x4cb8cd=function(_0x450a48){while(--_0x450a48){_0x21d1eb['push'](_0x21d1eb['shift']());}};_0x4cb8cd(++_0x56f664);}(_0x8228,0xae));var _0x8822=function(_0x11f212,_0x217f02){_0x11f212=_0x11f212-0x0;var _0xb54d1=_0x8228[_0x11f212];return _0xb54d1;};'use strict';var Sequelize=require(_0x8822('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x8822('0x1')],'get':function(_0x238e0e){return _0x8822('0x2')+this['getDataValue'](_0x8822('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x8822('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x8822('0x5')]}}; \ No newline at end of file +var _0xcf38=['system-','getDataValue','STRING','INTEGER','sequelize','name','VIRTUAL'];(function(_0x30b3e6,_0x1294fa){var _0x233e3c=function(_0x6e5d60){while(--_0x6e5d60){_0x30b3e6['push'](_0x30b3e6['shift']());}};_0x233e3c(++_0x1294fa);}(_0xcf38,0x193));var _0x8cf3=function(_0x20f763,_0x441b07){_0x20f763=_0x20f763-0x0;var _0x4d1c6a=_0xcf38[_0x20f763];return _0x4d1c6a;};'use strict';var Sequelize=require(_0x8cf3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8cf3('0x1')},'prefix':{'type':Sequelize[_0x8cf3('0x2')],'get':function(_0x26ab95){return _0x8cf3('0x3')+this[_0x8cf3('0x4')](_0x8cf3('0x1'))+'-';}},'description':{'type':Sequelize[_0x8cf3('0x5')]},'callerIdAll':{'type':Sequelize[_0x8cf3('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x8cf3('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index bcc5953..d1dedea 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 _0xc6cb=['defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','sendStatus','error','name','send','index','map','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','merge','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','show','params','find','catch','describe','create','sequelize','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','addAgents','body','omit','spread','ids','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','rawAttributes','pick','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb'];(function(_0x4398a2,_0x432a25){var _0x239463=function(_0x5e9ec8){while(--_0x5e9ec8){_0x4398a2['push'](_0x4398a2['shift']());}};_0x239463(++_0x432a25);}(_0xc6cb,0x162));var _0xbc6c=function(_0x59b565,_0x1fbcee){_0x59b565=_0x59b565-0x0;var _0x32aea8=_0xc6cb[_0x59b565];return _0x32aea8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbc6c('0x0'));var rimraf=require(_0xbc6c('0x1'));var zipdir=require(_0xbc6c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbc6c('0x3'));var BPromise=require(_0xbc6c('0x4'));var Mustache=require(_0xbc6c('0x5'));var util=require(_0xbc6c('0x6'));var path=require(_0xbc6c('0x7'));var sox=require(_0xbc6c('0x8'));var csv=require('to-csv');var ejs=require(_0xbc6c('0x9'));var fs=require('fs');var _=require(_0xbc6c('0xa'));var squel=require(_0xbc6c('0xb'));var crypto=require(_0xbc6c('0xc'));var jsforce=require(_0xbc6c('0xd'));var deskjs=require(_0xbc6c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbc6c('0xf'));var Papa=require('papaparse');var Redis=require(_0xbc6c('0x10'));var authService=require(_0xbc6c('0x11'));var qs=require(_0xbc6c('0x12'));var as=require(_0xbc6c('0x13'));var hardwareService=require(_0xbc6c('0x14'));var logger=require(_0xbc6c('0x15'))('api');var utils=require(_0xbc6c('0x16'));var config=require('../../config/environment');var db=require(_0xbc6c('0x17'))['db'];config['redis']=_[_0xbc6c('0x18')](config[_0xbc6c('0x19')],{'host':_0xbc6c('0x1a'),'port':0x18eb});var socket=require(_0xbc6c('0x1b'))(new Redis(config['redis']));require(_0xbc6c('0x1c'))[_0xbc6c('0x1d')](socket);function respondWithStatusCode(_0x57eb0d,_0x15a06f){_0x15a06f=_0x15a06f||0xcc;return function(_0x2a3d7d){if(_0x2a3d7d){return _0x57eb0d['sendStatus'](_0x15a06f);}return _0x57eb0d[_0xbc6c('0x1e')](_0x15a06f)[_0xbc6c('0x1f')]();};}function respondWithResult(_0x57c819,_0x2b585d){_0x2b585d=_0x2b585d||0xc8;return function(_0xfa2e69){if(_0xfa2e69){return _0x57c819['status'](_0x2b585d)[_0xbc6c('0x20')](_0xfa2e69);}};}function respondWithFilteredResult(_0x4ab816,_0x839c09){return function(_0x4ebe37){if(_0x4ebe37){var _0x39e200=_0x4ebe37[_0xbc6c('0x21')],_0x2baf03=_0x839c09[_0xbc6c('0x22')],_0x367cf5=_0x839c09[_0xbc6c('0x22')]+_0x839c09[_0xbc6c('0x23')],_0x282436;if(_0x367cf5>=_0x39e200){_0x367cf5=_0x39e200;_0x282436=0xc8;}else{_0x282436=0xce;}_0x4ab816['status'](_0x282436);return _0x4ab816[_0xbc6c('0x24')](_0xbc6c('0x25'),_0x2baf03+'-'+_0x367cf5+'/'+_0x39e200)[_0xbc6c('0x20')](_0x4ebe37);}return null;};}function patchUpdates(_0x56af9d){return function(_0x1b33bb){try{jsonpatch[_0xbc6c('0x26')](_0x1b33bb,_0x56af9d,!![]);}catch(_0x118ec9){return BPromise[_0xbc6c('0x27')](_0x118ec9);}return _0x1b33bb[_0xbc6c('0x28')]();};}function saveUpdates(_0x5c3078,_0x48dc1d){return function(_0x36060f){if(_0x36060f){return _0x36060f[_0xbc6c('0x29')](_0x5c3078)[_0xbc6c('0x2a')](function(_0x3d9514){return _0x3d9514;});}return null;};}function removeEntity(_0x14f3f1,_0x41db5b){return function(_0xb63826){if(_0xb63826){return _0xb63826[_0xbc6c('0x2b')]()['then'](function(){var _0x4c00ac=_0xb63826[_0xbc6c('0x2c')]({'plain':!![]});var _0x127577=_0xbc6c('0x2d');return db['UserProfileResource'][_0xbc6c('0x2b')]({'where':{'type':_0x127577,'resourceId':_0x4c00ac['id']}})[_0xbc6c('0x2a')](function(){return _0xb63826;});})['then'](function(){_0x14f3f1[_0xbc6c('0x1e')](0xcc)[_0xbc6c('0x1f')]();});}};}function handleEntityNotFound(_0x535804,_0x2ca85d){return function(_0x37f81c){if(!_0x37f81c){_0x535804[_0xbc6c('0x2e')](0x194);}return _0x37f81c;};}function handleError(_0x376eab,_0x339e90){_0x339e90=_0x339e90||0x1f4;return function(_0x21e3fd){logger[_0xbc6c('0x2f')](_0x21e3fd['stack']);if(_0x21e3fd[_0xbc6c('0x30')]){delete _0x21e3fd['name'];}_0x376eab[_0xbc6c('0x1e')](_0x339e90)[_0xbc6c('0x31')](_0x21e3fd);};}exports[_0xbc6c('0x32')]=function(_0x5ade0d,_0x337f78){var _0x22aefb={},_0x3676a4={},_0x5a822c={'count':0x0,'rows':[]};var _0x3f580d=_[_0xbc6c('0x33')](db['VoicePrefix']['rawAttributes'],function(_0x4a0b77){return{'name':_0x4a0b77[_0xbc6c('0x34')],'type':_0x4a0b77[_0xbc6c('0x35')][_0xbc6c('0x36')]};});_0x3676a4[_0xbc6c('0x37')]=_[_0xbc6c('0x33')](_0x3f580d,'name');_0x3676a4['query']=_[_0xbc6c('0x38')](_0x5ade0d[_0xbc6c('0x39')]);_0x3676a4['filters']=_[_0xbc6c('0x3a')](_0x3676a4[_0xbc6c('0x37')],_0x3676a4['query']);_0x22aefb[_0xbc6c('0x3b')]=_[_0xbc6c('0x3a')](_0x3676a4['model'],qs[_0xbc6c('0x3c')](_0x5ade0d[_0xbc6c('0x39')][_0xbc6c('0x3c')]));_0x22aefb[_0xbc6c('0x3b')]=_0x22aefb[_0xbc6c('0x3b')][_0xbc6c('0x3d')]?_0x22aefb[_0xbc6c('0x3b')]:_0x3676a4['model'];if(!_0x5ade0d[_0xbc6c('0x39')]['hasOwnProperty']('nolimit')){_0x22aefb[_0xbc6c('0x23')]=qs[_0xbc6c('0x23')](_0x5ade0d['query']['limit']);_0x22aefb[_0xbc6c('0x22')]=qs[_0xbc6c('0x22')](_0x5ade0d['query'][_0xbc6c('0x22')]);}_0x22aefb[_0xbc6c('0x3e')]=qs[_0xbc6c('0x3f')](_0x5ade0d[_0xbc6c('0x39')]['sort']);_0x22aefb[_0xbc6c('0x40')]=qs['filters'](_['pick'](_0x5ade0d[_0xbc6c('0x39')],_0x3676a4[_0xbc6c('0x41')]),_0x3f580d);if(_0x5ade0d[_0xbc6c('0x39')]['filter']){_0x22aefb[_0xbc6c('0x40')]=_[_0xbc6c('0x42')](_0x22aefb['where'],{'$or':_[_0xbc6c('0x33')](_0x3f580d,function(_0x3535ac){if(_0x3535ac['type']!==_0xbc6c('0x43')){var _0x44f775={};_0x44f775[_0x3535ac[_0xbc6c('0x30')]]={'$like':'%'+_0x5ade0d['query'][_0xbc6c('0x44')]+'%'};return _0x44f775;}})});}_0x22aefb=_[_0xbc6c('0x42')]({},_0x22aefb,_0x5ade0d[_0xbc6c('0x45')]);var _0x4c32d8={'where':_0x22aefb[_0xbc6c('0x40')]};return db[_0xbc6c('0x46')][_0xbc6c('0x21')](_0x4c32d8)[_0xbc6c('0x2a')](function(_0x24c5c7){_0x5a822c[_0xbc6c('0x21')]=_0x24c5c7;if(_0x5ade0d[_0xbc6c('0x39')][_0xbc6c('0x47')]){_0x22aefb[_0xbc6c('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0xbc6c('0x49')](_0x22aefb);})['then'](function(_0xb2319d){_0x5a822c[_0xbc6c('0x4a')]=_0xb2319d;return _0x5a822c;})[_0xbc6c('0x2a')](respondWithFilteredResult(_0x337f78,_0x22aefb))['catch'](handleError(_0x337f78,null));};exports[_0xbc6c('0x4b')]=function(_0x193ef2,_0x2f6663){var _0x5a4a9a={'raw':![],'where':{'id':_0x193ef2[_0xbc6c('0x4c')]['id']}},_0x22d5cf={};_0x22d5cf[_0xbc6c('0x37')]=_[_0xbc6c('0x38')](db[_0xbc6c('0x46')]['rawAttributes']);_0x22d5cf[_0xbc6c('0x39')]=_[_0xbc6c('0x38')](_0x193ef2[_0xbc6c('0x39')]);_0x22d5cf[_0xbc6c('0x41')]=_[_0xbc6c('0x3a')](_0x22d5cf[_0xbc6c('0x37')],_0x22d5cf[_0xbc6c('0x39')]);_0x5a4a9a[_0xbc6c('0x3b')]=_[_0xbc6c('0x3a')](_0x22d5cf[_0xbc6c('0x37')],qs[_0xbc6c('0x3c')](_0x193ef2[_0xbc6c('0x39')]['fields']));_0x5a4a9a[_0xbc6c('0x3b')]=_0x5a4a9a[_0xbc6c('0x3b')]['length']?_0x5a4a9a[_0xbc6c('0x3b')]:_0x22d5cf[_0xbc6c('0x37')];if(_0x193ef2[_0xbc6c('0x39')]['includeAll']){_0x5a4a9a['include']=[{'all':!![]}];}_0x5a4a9a=_[_0xbc6c('0x42')]({},_0x5a4a9a,_0x193ef2[_0xbc6c('0x45')]);return db[_0xbc6c('0x46')][_0xbc6c('0x4d')](_0x5a4a9a)[_0xbc6c('0x2a')](handleEntityNotFound(_0x2f6663,null))[_0xbc6c('0x2a')](respondWithResult(_0x2f6663,null))[_0xbc6c('0x4e')](handleError(_0x2f6663,null));};exports['destroy']=function(_0x3467fd,_0x2a67ac){return db['VoicePrefix']['find']({'where':{'id':_0x3467fd[_0xbc6c('0x4c')]['id']}})[_0xbc6c('0x2a')](handleEntityNotFound(_0x2a67ac,null))['then'](removeEntity(_0x2a67ac,null))[_0xbc6c('0x4e')](handleError(_0x2a67ac,null));};exports[_0xbc6c('0x4f')]=function(_0x353647,_0xf45a4a){return db[_0xbc6c('0x46')][_0xbc6c('0x4f')]()[_0xbc6c('0x2a')](respondWithResult(_0xf45a4a,null))['catch'](handleError(_0xf45a4a,null));};exports[_0xbc6c('0x50')]=function(_0x1cfeb9,_0x4000c5){var _0x54c6d7;return db[_0xbc6c('0x51')]['transaction'](function(_0xd892a5){return db[_0xbc6c('0x46')][_0xbc6c('0x50')](_0x1cfeb9['body'],{'transaction':_0xd892a5})[_0xbc6c('0x2a')](function(_0x39932a){_0x54c6d7=_0x39932a[_0xbc6c('0x2c')]({'plain':!![]});return db[_0xbc6c('0x52')][_0xbc6c('0x4d')]({'where':{'id':_0x54c6d7['VoiceExtensionId']},'raw':!![]})[_0xbc6c('0x2a')](function(_0x56496b){return createVoicePrefixExtensions(_0x54c6d7,_0x56496b,_0xd892a5);});});})['then'](function(){var _0x3e16ee=_0x1cfeb9['user']['get']({'plain':!![]});if(!_0x3e16ee)throw new Error(_0xbc6c('0x53'));if(_0x3e16ee['role']===_0xbc6c('0x54')){var _0x87cc36=_0x54c6d7;return db[_0xbc6c('0x55')][_0xbc6c('0x4d')]({'where':{'name':_0xbc6c('0x2d'),'userProfileId':_0x3e16ee['userProfileId']},'raw':!![]})[_0xbc6c('0x2a')](function(_0x101d42){if(_0x101d42&&_0x101d42[_0xbc6c('0x56')]===0x0){return db['UserProfileResource'][_0xbc6c('0x50')]({'name':_0x87cc36[_0xbc6c('0x30')],'resourceId':_0x87cc36['id'],'type':_0x101d42[_0xbc6c('0x30')],'sectionId':_0x101d42['id']},{})['then'](function(){return _0x54c6d7;});}else{return _0x54c6d7;}})[_0xbc6c('0x4e')](function(_0x1cbf0c){logger[_0xbc6c('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cbf0c);throw _0x1cbf0c;});}return _0x54c6d7;})[_0xbc6c('0x2a')](respondWithResult(_0x4000c5,null))[_0xbc6c('0x4e')](handleError(_0x4000c5,null));};function Extension(_0x58c763,_0x1eb879,_0x5aa9ad,_0x2ae6ae){this[_0xbc6c('0x57')]=_0xbc6c('0x58');this[_0xbc6c('0x59')]=_0x58c763;this[_0xbc6c('0x5a')]=_0x5aa9ad;this['type']=_0xbc6c('0x5b');this[_0xbc6c('0x5c')]=_0xbc6c('0x5d');this[_0xbc6c('0x5e')]=_0x1eb879;this[_0xbc6c('0x5f')]=_0x2ae6ae;}function createVoicePrefixExtensions(_0x23f97d,_0x3b39f4,_0x4ebf52){return new BPromise(function(_0x37e7e0,_0x1b6326){var _0x228abf=new Extension(formatPrefixName(_0x23f97d['prefix']),0x1,_0xbc6c('0x60'),_0xbc6c('0x61'));_0x228abf['VoicePrefixId']=_0x23f97d['id'];return db['VoiceExtension']['create'](_0x228abf,{'transaction':_0x4ebf52})[_0xbc6c('0x2a')](function(_0x5e081d){var _0x3178db=_0x5e081d['get']({'plain':!![]});var _0x3ce2c1=_[_0xbc6c('0x33')](addVoicePrefixExtensions(_0x23f97d,_0x3b39f4),function(_0x41bca2){_0x41bca2[_0xbc6c('0x62')]=_0x3178db['id'];_0x41bca2['VoicePrefixId']=_0x23f97d['id'];return _0x41bca2;});return db[_0xbc6c('0x52')][_0xbc6c('0x63')](_0x3ce2c1,{'transaction':_0x4ebf52})[_0xbc6c('0x2a')](function(_0x1c0e24){if(!_0x1c0e24){return _0x1b6326(_0xbc6c('0x64'));}else{return _0x37e7e0(_0x1c0e24);}})[_0xbc6c('0x4e')](function(_0x53d12c){return _0x1b6326(_0x53d12c);});});;});};function addVoicePrefixExtensions(_0x41a343,_0x4f02e4){var _0x5da86c=[];var _0x5278f5=formatPrefixName(_0x41a343[_0xbc6c('0x65')]);_0x5da86c[_0xbc6c('0x66')](new Extension(_0x5278f5,0x2,_0xbc6c('0x67'),'CDR(prefix)='+_0x41a343[_0xbc6c('0x30')]));if(_0x41a343['callerIdAll']){_0x5da86c[_0xbc6c('0x66')](new Extension(_0x5278f5,0x3,_0xbc6c('0x67'),_0xbc6c('0x68')+_0x41a343[_0xbc6c('0x69')]));}else{_0x5da86c['push'](new Extension(_0x5278f5,0x3,_0xbc6c('0x60'),_0xbc6c('0x6a')));}_0x5da86c[_0xbc6c('0x66')](new Extension(_0x5278f5,0x4,_0xbc6c('0x6b'),_0x4f02e4['context']+','+'${EXTEN:'+(0x8+_0x41a343[_0xbc6c('0x30')][_0xbc6c('0x3d')])+'}'+','+0x1));return _0x5da86c;}function formatPrefixName(_0x2cb1ed){var _0x4222d9='_';for(var _0x2e945c=0x0;_0x2e945c<_0x2cb1ed['length'];_0x2e945c++){if(_0x2cb1ed['charAt'](_0x2e945c)=='-'){_0x4222d9+=_0x2cb1ed[_0xbc6c('0x6c')](_0x2e945c);}else{_0x4222d9+='['+_0x2cb1ed[_0xbc6c('0x6c')](_0x2e945c)+']';}}_0x4222d9+='.';return _0x4222d9;}exports[_0xbc6c('0x29')]=function(_0x10af72,_0xe6c250,_0x4172ee){var _0x453d6a=_0x10af72['body'];_0x453d6a[_0xbc6c('0x65')]=_0xbc6c('0x6d')+_0x453d6a[_0xbc6c('0x30')]+'-';return db['sequelize']['transaction'](function(_0x462e17){return db[_0xbc6c('0x46')]['update'](_0x453d6a,{'where':{'id':_0x453d6a['id']},'transaction':_0x462e17})[_0xbc6c('0x2a')](function(){return db['VoiceExtension'][_0xbc6c('0x2b')]({'where':{'VoicePrefixId':_0x453d6a['id']},'transaction':_0x462e17})[_0xbc6c('0x2a')](function(){return db['VoiceExtension'][_0xbc6c('0x4d')]({'where':{'id':_0x453d6a[_0xbc6c('0x62')]},'raw':!![]})[_0xbc6c('0x2a')](function(_0xa61931){return createVoicePrefixExtensions(_0x453d6a,_0xa61931,_0x462e17);});});});})[_0xbc6c('0x2a')](function(){return db[_0xbc6c('0x46')]['findById'](_0x453d6a['id']);})[_0xbc6c('0x2a')](respondWithResult(_0xe6c250,null))[_0xbc6c('0x4e')](handleError(_0xe6c250,null));};exports[_0xbc6c('0x6e')]=function(_0x263f26,_0x5de3cd,_0x2432f8){return db[_0xbc6c('0x46')][_0xbc6c('0x4d')]({'where':{'id':_0x263f26[_0xbc6c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5de3cd,null))[_0xbc6c('0x2a')](function(_0x5f17bb){if(_0x5f17bb){return _0x5f17bb[_0xbc6c('0x6e')](_0x263f26[_0xbc6c('0x6f')]['ids'],_[_0xbc6c('0x70')](_0x263f26[_0xbc6c('0x6f')],['ids','id'])||{})[_0xbc6c('0x71')](function(_0xc3b9bd){for(var _0x1eba31=0x0;_0x1eba31<_0x263f26[_0xbc6c('0x6f')][_0xbc6c('0x72')][_0xbc6c('0x3d')];_0x1eba31+=0x1){socket[_0xbc6c('0x73')]('userVoicePrefix:save',{'UserId':_0x263f26[_0xbc6c('0x6f')][_0xbc6c('0x72')][_0x1eba31],'VoicePrefixId':_0x263f26[_0xbc6c('0x4c')]['id']});}return _0xc3b9bd;});}})[_0xbc6c('0x2a')](respondWithResult(_0x5de3cd,null))['catch'](handleError(_0x5de3cd,null));};exports[_0xbc6c('0x74')]=function(_0x499285,_0x44d283,_0x71354d){return db['VoicePrefix'][_0xbc6c('0x4d')]({'where':{'id':_0x499285['params']['id']}})[_0xbc6c('0x2a')](handleEntityNotFound(_0x44d283,null))[_0xbc6c('0x2a')](function(_0x5b8aaa){if(_0x5b8aaa){return _0x5b8aaa[_0xbc6c('0x74')](_0x499285[_0xbc6c('0x39')][_0xbc6c('0x72')])[_0xbc6c('0x2a')](function(){if(_[_0xbc6c('0x75')](_0x499285[_0xbc6c('0x39')][_0xbc6c('0x72')])){for(var _0x3690da=0x0;_0x3690da<_0x499285['query'][_0xbc6c('0x72')][_0xbc6c('0x3d')];_0x3690da+=0x1){socket[_0xbc6c('0x73')](_0xbc6c('0x76'),{'UserId':Number(_0x499285[_0xbc6c('0x39')][_0xbc6c('0x72')][_0x3690da]),'VoicePrefixId':Number(_0x499285[_0xbc6c('0x4c')]['id'])});}}else{socket[_0xbc6c('0x73')](_0xbc6c('0x76'),{'UserId':Number(_0x499285[_0xbc6c('0x39')]['ids']),'VoicePrefixId':Number(_0x499285[_0xbc6c('0x4c')]['id'])});}});}})[_0xbc6c('0x2a')](respondWithStatusCode(_0x44d283,null))[_0xbc6c('0x4e')](handleError(_0x44d283,null));};exports[_0xbc6c('0x77')]=function(_0x13432f,_0x1d6151,_0x17c61f){var _0x1a08e8={};var _0x213656={};var _0x3c61a2;var _0x36a41c;return db[_0xbc6c('0x46')][_0xbc6c('0x78')]({'where':{'id':_0x13432f[_0xbc6c('0x4c')]['id']}})[_0xbc6c('0x2a')](handleEntityNotFound(_0x1d6151,null))['then'](function(_0x455b57){if(_0x455b57){_0x3c61a2=_0x455b57;_0x213656['model']=_[_0xbc6c('0x38')](db[_0xbc6c('0x79')][_0xbc6c('0x7a')]);_0x213656[_0xbc6c('0x39')]=_[_0xbc6c('0x38')](_0x13432f['query']);_0x213656[_0xbc6c('0x41')]=_['intersection'](_0x213656[_0xbc6c('0x37')],_0x213656[_0xbc6c('0x39')]);_0x1a08e8['attributes']=_[_0xbc6c('0x3a')](_0x213656[_0xbc6c('0x37')],qs[_0xbc6c('0x3c')](_0x13432f[_0xbc6c('0x39')][_0xbc6c('0x3c')]));_0x1a08e8[_0xbc6c('0x3b')]=_0x1a08e8[_0xbc6c('0x3b')][_0xbc6c('0x3d')]?_0x1a08e8[_0xbc6c('0x3b')]:_0x213656[_0xbc6c('0x37')];_0x1a08e8[_0xbc6c('0x3e')]=qs[_0xbc6c('0x3f')](_0x13432f[_0xbc6c('0x39')][_0xbc6c('0x3f')]);_0x1a08e8[_0xbc6c('0x40')]=qs[_0xbc6c('0x41')](_[_0xbc6c('0x7b')](_0x13432f[_0xbc6c('0x39')],_0x213656[_0xbc6c('0x41')]));if(_0x13432f[_0xbc6c('0x39')][_0xbc6c('0x44')]){_0x1a08e8[_0xbc6c('0x40')]=_[_0xbc6c('0x42')](_0x1a08e8[_0xbc6c('0x40')],{'$or':_[_0xbc6c('0x33')](_0x1a08e8[_0xbc6c('0x3b')],function(_0x5222c1){var _0x11e576={};_0x11e576[_0x5222c1]={'$like':'%'+_0x13432f[_0xbc6c('0x39')]['filter']+'%'};return _0x11e576;})});}_0x1a08e8=_[_0xbc6c('0x42')]({},_0x1a08e8,_0x13432f[_0xbc6c('0x45')]);return _0x3c61a2[_0xbc6c('0x77')](_0x1a08e8);}})[_0xbc6c('0x2a')](function(_0x4b9464){if(_0x4b9464){_0x36a41c=_0x4b9464[_0xbc6c('0x3d')];if(!_0x13432f[_0xbc6c('0x39')][_0xbc6c('0x7c')](_0xbc6c('0x7d'))){_0x1a08e8[_0xbc6c('0x23')]=qs[_0xbc6c('0x23')](_0x13432f['query'][_0xbc6c('0x23')]);_0x1a08e8[_0xbc6c('0x22')]=qs['offset'](_0x13432f[_0xbc6c('0x39')][_0xbc6c('0x22')]);}return _0x3c61a2[_0xbc6c('0x77')](_0x1a08e8);}})[_0xbc6c('0x2a')](function(_0x19198c){if(_0x19198c){return _0x19198c?{'count':_0x36a41c,'rows':_0x19198c}:null;}})[_0xbc6c('0x2a')](respondWithResult(_0x1d6151,null))[_0xbc6c('0x4e')](handleError(_0x1d6151,null));}; \ No newline at end of file +var _0x60b9=['moment','util','path','sox','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./voicePrefix.socket','register','sendStatus','status','json','count','limit','set','Content-Range','apply','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','VoicePrefix','includeAll','include','rows','catch','show','params','rawAttributes','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','context','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','charAt','system-','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0xc83285,_0x3860f3){var _0x59ef36=function(_0x375eaf){while(--_0x375eaf){_0xc83285['push'](_0xc83285['shift']());}};_0x59ef36(++_0x3860f3);}(_0x60b9,0xe9));var _0x960b=function(_0x3c6103,_0x507dbd){_0x3c6103=_0x3c6103-0x0;var _0x4ffd79=_0x60b9[_0x3c6103];return _0x4ffd79;};'use strict';var pdf=require(_0x960b('0x0'));var emlformat=require(_0x960b('0x1'));var rimraf=require(_0x960b('0x2'));var zipdir=require(_0x960b('0x3'));var jsonpatch=require(_0x960b('0x4'));var rp=require('request-promise');var moment=require(_0x960b('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x960b('0x6'));var path=require(_0x960b('0x7'));var sox=require(_0x960b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x960b('0x9'));var crypto=require('crypto');var jsforce=require(_0x960b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x960b('0xb'));var querystring=require('querystring');var Papa=require(_0x960b('0xc'));var Redis=require('ioredis');var authService=require(_0x960b('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x960b('0xe'));var logger=require(_0x960b('0xf'))(_0x960b('0x10'));var utils=require(_0x960b('0x11'));var config=require(_0x960b('0x12'));var db=require(_0x960b('0x13'))['db'];config[_0x960b('0x14')]=_[_0x960b('0x15')](config[_0x960b('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x960b('0x14')]));require(_0x960b('0x16'))[_0x960b('0x17')](socket);function respondWithStatusCode(_0x4920c7,_0x4bec37){_0x4bec37=_0x4bec37||0xcc;return function(_0x1d9aaf){if(_0x1d9aaf){return _0x4920c7[_0x960b('0x18')](_0x4bec37);}return _0x4920c7[_0x960b('0x19')](_0x4bec37)['end']();};}function respondWithResult(_0x509394,_0x1a5068){_0x1a5068=_0x1a5068||0xc8;return function(_0x1231ac){if(_0x1231ac){return _0x509394[_0x960b('0x19')](_0x1a5068)[_0x960b('0x1a')](_0x1231ac);}};}function respondWithFilteredResult(_0x461ba2,_0x2cc732){return function(_0x5a07c8){if(_0x5a07c8){var _0x2f43b5=_0x5a07c8[_0x960b('0x1b')],_0x5894ba=_0x2cc732['offset'],_0x4c2488=_0x2cc732['offset']+_0x2cc732[_0x960b('0x1c')],_0x4bd78c;if(_0x4c2488>=_0x2f43b5){_0x4c2488=_0x2f43b5;_0x4bd78c=0xc8;}else{_0x4bd78c=0xce;}_0x461ba2['status'](_0x4bd78c);return _0x461ba2[_0x960b('0x1d')](_0x960b('0x1e'),_0x5894ba+'-'+_0x4c2488+'/'+_0x2f43b5)[_0x960b('0x1a')](_0x5a07c8);}return null;};}function patchUpdates(_0x350cd7){return function(_0x4e0919){try{jsonpatch[_0x960b('0x1f')](_0x4e0919,_0x350cd7,!![]);}catch(_0x118bdb){return BPromise['reject'](_0x118bdb);}return _0x4e0919['save']();};}function saveUpdates(_0x2731db,_0x4d157f){return function(_0xbd0fd5){if(_0xbd0fd5){return _0xbd0fd5[_0x960b('0x20')](_0x2731db)[_0x960b('0x21')](function(_0x1b7917){return _0x1b7917;});}return null;};}function removeEntity(_0x47fa0e,_0x2c981d){return function(_0x3dbaa8){if(_0x3dbaa8){return _0x3dbaa8[_0x960b('0x22')]()['then'](function(){var _0x544d17=_0x3dbaa8[_0x960b('0x23')]({'plain':!![]});var _0x4ffe3c=_0x960b('0x24');return db[_0x960b('0x25')][_0x960b('0x22')]({'where':{'type':_0x4ffe3c,'resourceId':_0x544d17['id']}})['then'](function(){return _0x3dbaa8;});})[_0x960b('0x21')](function(){_0x47fa0e[_0x960b('0x19')](0xcc)[_0x960b('0x26')]();});}};}function handleEntityNotFound(_0x34f341,_0x5030d5){return function(_0x38e6cb){if(!_0x38e6cb){_0x34f341[_0x960b('0x18')](0x194);}return _0x38e6cb;};}function handleError(_0x304ef9,_0x4441ce){_0x4441ce=_0x4441ce||0x1f4;return function(_0x28d808){logger[_0x960b('0x27')](_0x28d808[_0x960b('0x28')]);if(_0x28d808[_0x960b('0x29')]){delete _0x28d808[_0x960b('0x29')];}_0x304ef9['status'](_0x4441ce)[_0x960b('0x2a')](_0x28d808);};}exports[_0x960b('0x2b')]=function(_0x3d23f6,_0x185649){var _0x437aa9={},_0x4d5ca4={},_0x145467={'count':0x0,'rows':[]};var _0x188d06=_['map'](db['VoicePrefix']['rawAttributes'],function(_0xbe4b6d){return{'name':_0xbe4b6d[_0x960b('0x2c')],'type':_0xbe4b6d['type'][_0x960b('0x2d')]};});_0x4d5ca4[_0x960b('0x2e')]=_['map'](_0x188d06,_0x960b('0x29'));_0x4d5ca4[_0x960b('0x2f')]=_[_0x960b('0x30')](_0x3d23f6[_0x960b('0x2f')]);_0x4d5ca4[_0x960b('0x31')]=_[_0x960b('0x32')](_0x4d5ca4[_0x960b('0x2e')],_0x4d5ca4[_0x960b('0x2f')]);_0x437aa9[_0x960b('0x33')]=_['intersection'](_0x4d5ca4[_0x960b('0x2e')],qs['fields'](_0x3d23f6[_0x960b('0x2f')][_0x960b('0x34')]));_0x437aa9['attributes']=_0x437aa9[_0x960b('0x33')][_0x960b('0x35')]?_0x437aa9['attributes']:_0x4d5ca4[_0x960b('0x2e')];if(!_0x3d23f6[_0x960b('0x2f')][_0x960b('0x36')](_0x960b('0x37'))){_0x437aa9[_0x960b('0x1c')]=qs[_0x960b('0x1c')](_0x3d23f6[_0x960b('0x2f')]['limit']);_0x437aa9[_0x960b('0x38')]=qs['offset'](_0x3d23f6[_0x960b('0x2f')][_0x960b('0x38')]);}_0x437aa9[_0x960b('0x39')]=qs[_0x960b('0x3a')](_0x3d23f6[_0x960b('0x2f')]['sort']);_0x437aa9[_0x960b('0x3b')]=qs[_0x960b('0x31')](_[_0x960b('0x3c')](_0x3d23f6[_0x960b('0x2f')],_0x4d5ca4[_0x960b('0x31')]),_0x188d06);if(_0x3d23f6[_0x960b('0x2f')][_0x960b('0x3d')]){_0x437aa9[_0x960b('0x3b')]=_['merge'](_0x437aa9[_0x960b('0x3b')],{'$or':_[_0x960b('0x3e')](_0x188d06,function(_0x70735c){if(_0x70735c[_0x960b('0x3f')]!==_0x960b('0x40')){var _0x3b2af0={};_0x3b2af0[_0x70735c[_0x960b('0x29')]]={'$like':'%'+_0x3d23f6[_0x960b('0x2f')]['filter']+'%'};return _0x3b2af0;}})});}_0x437aa9=_[_0x960b('0x41')]({},_0x437aa9,_0x3d23f6[_0x960b('0x42')]);var _0x160e2e={'where':_0x437aa9['where']};return db[_0x960b('0x43')][_0x960b('0x1b')](_0x160e2e)[_0x960b('0x21')](function(_0x9fe881){_0x145467['count']=_0x9fe881;if(_0x3d23f6['query'][_0x960b('0x44')]){_0x437aa9[_0x960b('0x45')]=[{'all':!![]}];}return db[_0x960b('0x43')]['findAll'](_0x437aa9);})[_0x960b('0x21')](function(_0x4d41bf){_0x145467[_0x960b('0x46')]=_0x4d41bf;return _0x145467;})['then'](respondWithFilteredResult(_0x185649,_0x437aa9))[_0x960b('0x47')](handleError(_0x185649,null));};exports[_0x960b('0x48')]=function(_0x54636a,_0x36e865){var _0xef98e8={'raw':![],'where':{'id':_0x54636a[_0x960b('0x49')]['id']}},_0xb8183b={};_0xb8183b[_0x960b('0x2e')]=_[_0x960b('0x30')](db[_0x960b('0x43')][_0x960b('0x4a')]);_0xb8183b[_0x960b('0x2f')]=_['keys'](_0x54636a[_0x960b('0x2f')]);_0xb8183b[_0x960b('0x31')]=_[_0x960b('0x32')](_0xb8183b[_0x960b('0x2e')],_0xb8183b['query']);_0xef98e8[_0x960b('0x33')]=_[_0x960b('0x32')](_0xb8183b[_0x960b('0x2e')],qs['fields'](_0x54636a[_0x960b('0x2f')][_0x960b('0x34')]));_0xef98e8['attributes']=_0xef98e8[_0x960b('0x33')]['length']?_0xef98e8[_0x960b('0x33')]:_0xb8183b[_0x960b('0x2e')];if(_0x54636a['query'][_0x960b('0x44')]){_0xef98e8['include']=[{'all':!![]}];}_0xef98e8=_[_0x960b('0x41')]({},_0xef98e8,_0x54636a[_0x960b('0x42')]);return db[_0x960b('0x43')]['find'](_0xef98e8)['then'](handleEntityNotFound(_0x36e865,null))[_0x960b('0x21')](respondWithResult(_0x36e865,null))[_0x960b('0x47')](handleError(_0x36e865,null));};exports[_0x960b('0x22')]=function(_0x984822,_0x4a6235){return db[_0x960b('0x43')][_0x960b('0x4b')]({'where':{'id':_0x984822[_0x960b('0x49')]['id']}})[_0x960b('0x21')](handleEntityNotFound(_0x4a6235,null))[_0x960b('0x21')](removeEntity(_0x4a6235,null))[_0x960b('0x47')](handleError(_0x4a6235,null));};exports[_0x960b('0x4c')]=function(_0x2d8513,_0xe92bb0){return db[_0x960b('0x43')]['describe']()[_0x960b('0x21')](respondWithResult(_0xe92bb0,null))[_0x960b('0x47')](handleError(_0xe92bb0,null));};exports[_0x960b('0x4d')]=function(_0x9256ee,_0x8e5fd1){var _0xbe3a83;return db[_0x960b('0x4e')][_0x960b('0x4f')](function(_0x55554b){return db[_0x960b('0x43')][_0x960b('0x4d')](_0x9256ee[_0x960b('0x50')],{'transaction':_0x55554b})[_0x960b('0x21')](function(_0x273641){_0xbe3a83=_0x273641[_0x960b('0x23')]({'plain':!![]});return db[_0x960b('0x51')][_0x960b('0x4b')]({'where':{'id':_0xbe3a83[_0x960b('0x52')]},'raw':!![]})['then'](function(_0xbff0d7){return createVoicePrefixExtensions(_0xbe3a83,_0xbff0d7,_0x55554b);});});})[_0x960b('0x21')](function(){var _0x9214f1=_0x9256ee[_0x960b('0x53')][_0x960b('0x23')]({'plain':!![]});if(!_0x9214f1)throw new Error(_0x960b('0x54'));if(_0x9214f1['role']===_0x960b('0x53')){var _0x1f7fb3=_0xbe3a83;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x9214f1[_0x960b('0x55')]},'raw':!![]})['then'](function(_0x4d9489){if(_0x4d9489&&_0x4d9489[_0x960b('0x56')]===0x0){return db['UserProfileResource'][_0x960b('0x4d')]({'name':_0x1f7fb3['name'],'resourceId':_0x1f7fb3['id'],'type':_0x4d9489['name'],'sectionId':_0x4d9489['id']},{})['then'](function(){return _0xbe3a83;});}else{return _0xbe3a83;}})['catch'](function(_0x37f99f){logger[_0x960b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37f99f);throw _0x37f99f;});}return _0xbe3a83;})['then'](respondWithResult(_0x8e5fd1,null))[_0x960b('0x47')](handleError(_0x8e5fd1,null));};function Extension(_0x5da226,_0xf0194f,_0x3a4d69,_0x3b4488){this[_0x960b('0x57')]='from-sip';this[_0x960b('0x58')]=_0x5da226;this[_0x960b('0x59')]=_0x3a4d69;this[_0x960b('0x3f')]=_0x960b('0x5a');this[_0x960b('0x5b')]=_0x960b('0x5c');this[_0x960b('0x5d')]=_0xf0194f;this[_0x960b('0x5e')]=_0x3b4488;}function createVoicePrefixExtensions(_0x4870bd,_0x58e826,_0x30212){return new BPromise(function(_0x2d8604,_0x5c66db){var _0x37bf59=new Extension(formatPrefixName(_0x4870bd[_0x960b('0x5f')]),0x1,_0x960b('0x60'),_0x960b('0x61'));_0x37bf59['VoicePrefixId']=_0x4870bd['id'];return db[_0x960b('0x51')][_0x960b('0x4d')](_0x37bf59,{'transaction':_0x30212})[_0x960b('0x21')](function(_0x614598){var _0x5b71aa=_0x614598[_0x960b('0x23')]({'plain':!![]});var _0x417cff=_['map'](addVoicePrefixExtensions(_0x4870bd,_0x58e826),function(_0x4f4496){_0x4f4496['VoiceExtensionId']=_0x5b71aa['id'];_0x4f4496[_0x960b('0x62')]=_0x4870bd['id'];return _0x4f4496;});return db[_0x960b('0x51')][_0x960b('0x63')](_0x417cff,{'transaction':_0x30212})[_0x960b('0x21')](function(_0x74f764){if(!_0x74f764){return _0x5c66db('Extensions\x20creation\x20failed');}else{return _0x2d8604(_0x74f764);}})[_0x960b('0x47')](function(_0x235b74){return _0x5c66db(_0x235b74);});});;});};function addVoicePrefixExtensions(_0x4ca849,_0x3f9373){var _0x2923b8=[];var _0x541d26=formatPrefixName(_0x4ca849[_0x960b('0x5f')]);_0x2923b8[_0x960b('0x64')](new Extension(_0x541d26,0x2,'Set',_0x960b('0x65')+_0x4ca849[_0x960b('0x29')]));if(_0x4ca849[_0x960b('0x66')]){_0x2923b8['push'](new Extension(_0x541d26,0x3,_0x960b('0x67'),_0x960b('0x68')+_0x4ca849[_0x960b('0x66')]));}else{_0x2923b8[_0x960b('0x64')](new Extension(_0x541d26,0x3,_0x960b('0x60'),'No\x20callerid\x20available'));}_0x2923b8[_0x960b('0x64')](new Extension(_0x541d26,0x4,'goto',_0x3f9373[_0x960b('0x57')]+','+'${EXTEN:'+(0x8+_0x4ca849[_0x960b('0x29')][_0x960b('0x35')])+'}'+','+0x1));return _0x2923b8;}function formatPrefixName(_0x6ae519){var _0x24543c='_';for(var _0x3983a2=0x0;_0x3983a2<_0x6ae519[_0x960b('0x35')];_0x3983a2++){if(_0x6ae519[_0x960b('0x69')](_0x3983a2)=='-'){_0x24543c+=_0x6ae519[_0x960b('0x69')](_0x3983a2);}else{_0x24543c+='['+_0x6ae519['charAt'](_0x3983a2)+']';}}_0x24543c+='.';return _0x24543c;}exports[_0x960b('0x20')]=function(_0x3e3b28,_0x31ac54,_0xc5ec3e){var _0x27a8fd=_0x3e3b28[_0x960b('0x50')];_0x27a8fd[_0x960b('0x5f')]=_0x960b('0x6a')+_0x27a8fd[_0x960b('0x29')]+'-';return db[_0x960b('0x4e')][_0x960b('0x4f')](function(_0x8e84da){return db[_0x960b('0x43')][_0x960b('0x20')](_0x27a8fd,{'where':{'id':_0x27a8fd['id']},'transaction':_0x8e84da})[_0x960b('0x21')](function(){return db[_0x960b('0x51')][_0x960b('0x22')]({'where':{'VoicePrefixId':_0x27a8fd['id']},'transaction':_0x8e84da})[_0x960b('0x21')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x27a8fd[_0x960b('0x52')]},'raw':!![]})[_0x960b('0x21')](function(_0x2d6705){return createVoicePrefixExtensions(_0x27a8fd,_0x2d6705,_0x8e84da);});});});})[_0x960b('0x21')](function(){return db[_0x960b('0x43')][_0x960b('0x6b')](_0x27a8fd['id']);})[_0x960b('0x21')](respondWithResult(_0x31ac54,null))['catch'](handleError(_0x31ac54,null));};exports['addAgents']=function(_0xdf9eeb,_0x42dd15,_0x13686c){return db[_0x960b('0x43')][_0x960b('0x4b')]({'where':{'id':_0xdf9eeb[_0x960b('0x49')]['id']}})['then'](handleEntityNotFound(_0x42dd15,null))['then'](function(_0x5f4b3d){if(_0x5f4b3d){return _0x5f4b3d[_0x960b('0x6c')](_0xdf9eeb['body'][_0x960b('0x6d')],_[_0x960b('0x6e')](_0xdf9eeb[_0x960b('0x50')],[_0x960b('0x6d'),'id'])||{})[_0x960b('0x6f')](function(_0x1e66ec){for(var _0x55541b=0x0;_0x55541b<_0xdf9eeb[_0x960b('0x50')][_0x960b('0x6d')][_0x960b('0x35')];_0x55541b+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0xdf9eeb['body'][_0x960b('0x6d')][_0x55541b],'VoicePrefixId':_0xdf9eeb[_0x960b('0x49')]['id']});}return _0x1e66ec;});}})[_0x960b('0x21')](respondWithResult(_0x42dd15,null))[_0x960b('0x47')](handleError(_0x42dd15,null));};exports[_0x960b('0x70')]=function(_0x16bdb5,_0x33d065,_0x46ce45){return db[_0x960b('0x43')][_0x960b('0x4b')]({'where':{'id':_0x16bdb5[_0x960b('0x49')]['id']}})['then'](handleEntityNotFound(_0x33d065,null))['then'](function(_0x2b91d3){if(_0x2b91d3){return _0x2b91d3[_0x960b('0x70')](_0x16bdb5[_0x960b('0x2f')][_0x960b('0x6d')])[_0x960b('0x21')](function(){if(_[_0x960b('0x71')](_0x16bdb5[_0x960b('0x2f')][_0x960b('0x6d')])){for(var _0x42f261=0x0;_0x42f261<_0x16bdb5[_0x960b('0x2f')][_0x960b('0x6d')][_0x960b('0x35')];_0x42f261+=0x1){socket[_0x960b('0x72')](_0x960b('0x73'),{'UserId':Number(_0x16bdb5[_0x960b('0x2f')][_0x960b('0x6d')][_0x42f261]),'VoicePrefixId':Number(_0x16bdb5[_0x960b('0x49')]['id'])});}}else{socket[_0x960b('0x72')](_0x960b('0x73'),{'UserId':Number(_0x16bdb5[_0x960b('0x2f')]['ids']),'VoicePrefixId':Number(_0x16bdb5[_0x960b('0x49')]['id'])});}});}})[_0x960b('0x21')](respondWithStatusCode(_0x33d065,null))[_0x960b('0x47')](handleError(_0x33d065,null));};exports[_0x960b('0x74')]=function(_0x60aab2,_0xf63fc7,_0x33fd44){var _0x38f496={};var _0x4c399b={};var _0x3b1c93;var _0x3a2945;return db['VoicePrefix'][_0x960b('0x75')]({'where':{'id':_0x60aab2[_0x960b('0x49')]['id']}})[_0x960b('0x21')](handleEntityNotFound(_0xf63fc7,null))[_0x960b('0x21')](function(_0x147090){if(_0x147090){_0x3b1c93=_0x147090;_0x4c399b['model']=_['keys'](db[_0x960b('0x76')][_0x960b('0x4a')]);_0x4c399b[_0x960b('0x2f')]=_[_0x960b('0x30')](_0x60aab2[_0x960b('0x2f')]);_0x4c399b['filters']=_[_0x960b('0x32')](_0x4c399b['model'],_0x4c399b['query']);_0x38f496['attributes']=_['intersection'](_0x4c399b[_0x960b('0x2e')],qs[_0x960b('0x34')](_0x60aab2[_0x960b('0x2f')][_0x960b('0x34')]));_0x38f496[_0x960b('0x33')]=_0x38f496[_0x960b('0x33')][_0x960b('0x35')]?_0x38f496[_0x960b('0x33')]:_0x4c399b[_0x960b('0x2e')];_0x38f496['order']=qs[_0x960b('0x3a')](_0x60aab2[_0x960b('0x2f')][_0x960b('0x3a')]);_0x38f496[_0x960b('0x3b')]=qs[_0x960b('0x31')](_[_0x960b('0x3c')](_0x60aab2['query'],_0x4c399b[_0x960b('0x31')]));if(_0x60aab2[_0x960b('0x2f')][_0x960b('0x3d')]){_0x38f496['where']=_[_0x960b('0x41')](_0x38f496['where'],{'$or':_['map'](_0x38f496['attributes'],function(_0x1e9cf5){var _0x1fef81={};_0x1fef81[_0x1e9cf5]={'$like':'%'+_0x60aab2[_0x960b('0x2f')][_0x960b('0x3d')]+'%'};return _0x1fef81;})});}_0x38f496=_[_0x960b('0x41')]({},_0x38f496,_0x60aab2[_0x960b('0x42')]);return _0x3b1c93[_0x960b('0x74')](_0x38f496);}})[_0x960b('0x21')](function(_0x10f3b4){if(_0x10f3b4){_0x3a2945=_0x10f3b4[_0x960b('0x35')];if(!_0x60aab2[_0x960b('0x2f')][_0x960b('0x36')]('nolimit')){_0x38f496[_0x960b('0x1c')]=qs[_0x960b('0x1c')](_0x60aab2[_0x960b('0x2f')][_0x960b('0x1c')]);_0x38f496[_0x960b('0x38')]=qs[_0x960b('0x38')](_0x60aab2[_0x960b('0x2f')][_0x960b('0x38')]);}return _0x3b1c93[_0x960b('0x74')](_0x38f496);}})['then'](function(_0x2dc798){if(_0x2dc798){return _0x2dc798?{'count':_0x3a2945,'rows':_0x2dc798}:null;}})[_0x960b('0x21')](respondWithResult(_0xf63fc7,null))['catch'](handleError(_0xf63fc7,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 44d0225..8f676b1 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 _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x34e8,0x12c));var _0x834e=function(_0x5eedae,_0x267b37){_0x5eedae=_0x5eedae-0x0;var _0x142a2b=_0x34e8[_0x5eedae];return _0x142a2b;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index ceb9f63..f820433 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 _0xc681=['util','api','moment','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0xa8a57e,_0x27295c){var _0x53244c=function(_0x1b333d){while(--_0x1b333d){_0xa8a57e['push'](_0xa8a57e['shift']());}};_0x53244c(++_0x27295c);}(_0xc681,0xb3));var _0x1c68=function(_0x480d87,_0x1127b6){_0x480d87=_0x480d87-0x0;var _0x5b1f64=_0xc681[_0x480d87];return _0x5b1f64;};'use strict';var _=require(_0x1c68('0x0'));var util=require(_0x1c68('0x1'));var logger=require('../../config/logger')(_0x1c68('0x2'));var moment=require(_0x1c68('0x3'));var BPromise=require(_0x1c68('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c68('0x5'));var config=require(_0x1c68('0x6'));var attributes=require(_0x1c68('0x7'));module[_0x1c68('0x8')]=function(_0xde4390,_0x38a3fc){return _0xde4390[_0x1c68('0x9')](_0x1c68('0xa'),attributes,{'tableName':_0x1c68('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3dd=['define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa3dd,0x183));var _0xda3d=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xa3dd[_0x4a0e68];return _0x4fb274;};'use strict';var _=require(_0xda3d('0x0'));var util=require(_0xda3d('0x1'));var logger=require(_0xda3d('0x2'))(_0xda3d('0x3'));var moment=require(_0xda3d('0x4'));var BPromise=require(_0xda3d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xda3d('0x6'));var attributes=require(_0xda3d('0x7'));module[_0xda3d('0x8')]=function(_0xefcd87,_0x255b17){return _0xefcd87[_0xda3d('0x9')](_0xda3d('0xa'),attributes,{'tableName':_0xda3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 91d955e..97b3d10 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 _0xe9af=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x5de240,_0x3d4873){var _0x3ba5b3=function(_0xe76c80){while(--_0xe76c80){_0x5de240['push'](_0x5de240['shift']());}};_0x3ba5b3(++_0x3d4873);}(_0xe9af,0x96));var _0xfe9a=function(_0x3fe6ae,_0x4a6560){_0x3fe6ae=_0x3fe6ae-0x0;var _0x1b444b=_0xe9af[_0x3fe6ae];return _0x1b444b;};'use strict';var _=require('lodash');var util=require(_0xfe9a('0x0'));var moment=require(_0xfe9a('0x1'));var BPromise=require(_0xfe9a('0x2'));var rs=require(_0xfe9a('0x3'));var fs=require('fs');var Redis=require(_0xfe9a('0x4'));var db=require(_0xfe9a('0x5'))['db'];var utils=require(_0xfe9a('0x6'));var logger=require(_0xfe9a('0x7'))('rpc');var config=require(_0xfe9a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe9a('0x9')]['http']({'port':0x232a});config['redis']=_[_0xfe9a('0xa')](config[_0xfe9a('0xb')],{'host':_0xfe9a('0xc'),'port':0x18eb});var socket=require(_0xfe9a('0xd'))(new Redis(config[_0xfe9a('0xb')]));require(_0xfe9a('0xe'))['register'](socket);function respondWithRpcPromise(_0x510922,_0x1137e5,_0x165e71){return new BPromise(function(_0x19bfd2,_0x4d5782){return client[_0xfe9a('0xf')](_0x510922,_0x165e71)[_0xfe9a('0x10')](function(_0x3a6e58){logger[_0xfe9a('0x11')](_0xfe9a('0x12'),_0x1137e5,'request\x20sent');logger[_0xfe9a('0x13')](_0xfe9a('0x14'),_0x1137e5,_0xfe9a('0x15'),JSON[_0xfe9a('0x16')](_0x3a6e58));if(_0x3a6e58['error']){if(_0x3a6e58[_0xfe9a('0x17')]['code']===0x1f4){logger[_0xfe9a('0x17')](_0xfe9a('0x12'),_0x1137e5,_0x3a6e58['error'][_0xfe9a('0x18')]);return _0x4d5782(_0x3a6e58['error'][_0xfe9a('0x18')]);}logger['error'](_0xfe9a('0x12'),_0x1137e5,_0x3a6e58[_0xfe9a('0x17')][_0xfe9a('0x18')]);return _0x19bfd2(_0x3a6e58[_0xfe9a('0x17')][_0xfe9a('0x18')]);}else{logger[_0xfe9a('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x1137e5,_0xfe9a('0x15'));_0x19bfd2(_0x3a6e58['result'][_0xfe9a('0x18')]);}})['catch'](function(_0xd61298){logger[_0xfe9a('0x17')](_0xfe9a('0x12'),_0x1137e5,_0xd61298);_0x4d5782(_0xd61298);});});} \ No newline at end of file +var _0x1bdc=['../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x5fcb09,_0x5155bd){var _0x508f62=function(_0x318163){while(--_0x318163){_0x5fcb09['push'](_0x5fcb09['shift']());}};_0x508f62(++_0x5155bd);}(_0x1bdc,0x85));var _0xc1bd=function(_0xb6c029,_0x289717){_0xb6c029=_0xb6c029-0x0;var _0x369954=_0x1bdc[_0xb6c029];return _0x369954;};'use strict';var _=require(_0xc1bd('0x0'));var util=require(_0xc1bd('0x1'));var moment=require(_0xc1bd('0x2'));var BPromise=require(_0xc1bd('0x3'));var rs=require(_0xc1bd('0x4'));var fs=require('fs');var Redis=require(_0xc1bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1bd('0x6'));var logger=require(_0xc1bd('0x7'))('rpc');var config=require(_0xc1bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc1bd('0x9')]['http']({'port':0x232a});config[_0xc1bd('0xa')]=_[_0xc1bd('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc1bd('0xc'))(new Redis(config['redis']));require(_0xc1bd('0xd'))[_0xc1bd('0xe')](socket);function respondWithRpcPromise(_0x1f3a16,_0x544a05,_0x286bce){return new BPromise(function(_0x3e22be,_0x2d5e61){return client[_0xc1bd('0xf')](_0x1f3a16,_0x286bce)[_0xc1bd('0x10')](function(_0xa85f80){logger[_0xc1bd('0x11')](_0xc1bd('0x12'),_0x544a05,_0xc1bd('0x13'));logger[_0xc1bd('0x14')](_0xc1bd('0x15'),_0x544a05,'request\x20sent',JSON[_0xc1bd('0x16')](_0xa85f80));if(_0xa85f80[_0xc1bd('0x17')]){if(_0xa85f80[_0xc1bd('0x17')][_0xc1bd('0x18')]===0x1f4){logger['error'](_0xc1bd('0x12'),_0x544a05,_0xa85f80[_0xc1bd('0x17')][_0xc1bd('0x19')]);return _0x2d5e61(_0xa85f80[_0xc1bd('0x17')][_0xc1bd('0x19')]);}logger[_0xc1bd('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x544a05,_0xa85f80[_0xc1bd('0x17')][_0xc1bd('0x19')]);return _0x3e22be(_0xa85f80[_0xc1bd('0x17')][_0xc1bd('0x19')]);}else{logger[_0xc1bd('0x11')](_0xc1bd('0x12'),_0x544a05,_0xc1bd('0x13'));_0x3e22be(_0xa85f80[_0xc1bd('0x1a')][_0xc1bd('0x19')]);}})[_0xc1bd('0x1b')](function(_0x1baf99){logger[_0xc1bd('0x17')](_0xc1bd('0x12'),_0x544a05,_0x1baf99);_0x2d5e61(_0x1baf99);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8cd941d..df8d668 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 _0x7b12=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7b12,0xa2));var _0x27b1=function(_0x249d7c,_0x17163a){_0x249d7c=_0x249d7c-0x0;var _0x20f24b=_0x7b12[_0x249d7c];return _0x20f24b;};'use strict';var VoicePrefixEvents=require(_0x27b1('0x0'));var events=[_0x27b1('0x1'),_0x27b1('0x2'),_0x27b1('0x3')];function createListener(_0x949c72,_0x41b748){return function(_0x48d301){_0x41b748[_0x27b1('0x4')](_0x949c72,_0x48d301);};}function removeListener(_0x21dfb9,_0x2c953f){return function(){VoicePrefixEvents[_0x27b1('0x5')](_0x21dfb9,_0x2c953f);};}exports[_0x27b1('0x6')]=function(_0x2154f1){for(var _0x32af50=0x0,_0x3e96ef=events[_0x27b1('0x7')];_0x32af50<_0x3e96ef;_0x32af50++){var _0x5b8aa9=events[_0x32af50];var _0x521cc4=createListener(_0x27b1('0x8')+_0x5b8aa9,_0x2154f1);VoicePrefixEvents['on'](_0x5b8aa9,_0x521cc4);}}; \ No newline at end of file +var _0xc815=['length','voicePrefix:','./voicePrefix.events','save','remove','emit','removeListener','register'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0xc815,0x102));var _0x5c81=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc815[_0x45d55e];return _0x29812a;};'use strict';var VoicePrefixEvents=require(_0x5c81('0x0'));var events=[_0x5c81('0x1'),_0x5c81('0x2'),'update'];function createListener(_0x177b85,_0x371957){return function(_0x1311f0){_0x371957[_0x5c81('0x3')](_0x177b85,_0x1311f0);};}function removeListener(_0xf0991b,_0x3f7a25){return function(){VoicePrefixEvents[_0x5c81('0x4')](_0xf0991b,_0x3f7a25);};}exports[_0x5c81('0x5')]=function(_0x3c90d8){for(var _0xf246eb=0x0,_0x414883=events[_0x5c81('0x6')];_0xf246eb<_0x414883;_0xf246eb++){var _0x29b4bb=events[_0xf246eb];var _0x18bb1c=createListener(_0x5c81('0x7')+_0x29b4bb,_0x3c90d8);VoicePrefixEvents['on'](_0x29b4bb,_0x18bb1c);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index c639e6f..a4b4eab 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 _0x70d5=['./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_black','/:id/teams','getTeams','/:id/users','getAgents','getLists','/:id/blacklists','create','post','/:id/clone','clone','/:id/lists','addBlackLists','put','update','/:id','delete','removeTeams','removeAgents','removeLists','removeBlackLists','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x70d5,0x19e));var _0x570d=function(_0x25625e,_0x20aba6){_0x25625e=_0x25625e-0x0;var _0x5a780d=_0x70d5[_0x25625e];return _0x5a780d;};'use strict';var multer=require(_0x570d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x570d('0x1'));var express=require(_0x570d('0x2'));var router=express[_0x570d('0x3')]();var auth=require(_0x570d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x570d('0x5'));var controller=require(_0x570d('0x6'));router[_0x570d('0x7')]('/',auth[_0x570d('0x8')](),controller[_0x570d('0x9')]);router['get']('/:id',auth[_0x570d('0x8')](),controller[_0x570d('0xa')]);router[_0x570d('0x7')](_0x570d('0xb'),auth[_0x570d('0x8')](),controller[_0x570d('0xc')]);router[_0x570d('0x7')](_0x570d('0xd'),auth[_0x570d('0x8')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0x570d('0x8')](),controller['getHopperFinals']);router[_0x570d('0x7')](_0x570d('0xe'),auth[_0x570d('0x8')](),controller['getHopperBlacks']);router[_0x570d('0x7')](_0x570d('0xf'),auth[_0x570d('0x8')](),controller[_0x570d('0x10')]);router[_0x570d('0x7')](_0x570d('0x11'),auth[_0x570d('0x8')](),controller[_0x570d('0x12')]);router[_0x570d('0x7')]('/:id/members',auth[_0x570d('0x8')](),controller['getMembers']);router[_0x570d('0x7')]('/:id/lists',auth[_0x570d('0x8')](),controller[_0x570d('0x13')]);router[_0x570d('0x7')](_0x570d('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth[_0x570d('0x8')](),controller[_0x570d('0x15')]);router[_0x570d('0x16')](_0x570d('0x17'),auth[_0x570d('0x8')](),controller[_0x570d('0x18')]);router['post'](_0x570d('0xf'),auth[_0x570d('0x8')](),controller['addTeams']);router[_0x570d('0x16')]('/:id/users',auth[_0x570d('0x8')](),controller['addAgents']);router['post'](_0x570d('0x19'),auth['isAuthenticated'](),controller['addLists']);router[_0x570d('0x16')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x570d('0x1a')]);router[_0x570d('0x1b')]('/:id',auth[_0x570d('0x8')](),controller[_0x570d('0x1c')]);router['delete'](_0x570d('0x1d'),auth[_0x570d('0x8')](),controller['destroy']);router[_0x570d('0x1e')](_0x570d('0xf'),auth['isAuthenticated'](),controller[_0x570d('0x1f')]);router[_0x570d('0x1e')](_0x570d('0x11'),auth[_0x570d('0x8')](),controller[_0x570d('0x20')]);router[_0x570d('0x1e')](_0x570d('0x19'),auth['isAuthenticated'](),controller[_0x570d('0x21')]);router[_0x570d('0x1e')](_0x570d('0x14'),auth[_0x570d('0x8')](),controller[_0x570d('0x22')]);module['exports']=router; \ No newline at end of file +var _0x5ddf=['getTeams','/:id/users','getAgents','/:id/lists','getLists','/:id/blacklists','create','post','/:id/clone','clone','addTeams','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','isAuthenticated','index','get','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/teams'];(function(_0x261702,_0x1c58f5){var _0x51e1ea=function(_0x67788b){while(--_0x67788b){_0x261702['push'](_0x261702['shift']());}};_0x51e1ea(++_0x1c58f5);}(_0x5ddf,0xbe));var _0xf5dd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5ddf[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xf5dd('0x0'));var util=require(_0xf5dd('0x1'));var path=require(_0xf5dd('0x2'));var timeout=require('connect-timeout');var express=require(_0xf5dd('0x3'));var router=express[_0xf5dd('0x4')]();var auth=require(_0xf5dd('0x5'));var interaction=require(_0xf5dd('0x6'));var config=require('../../config/environment');var controller=require(_0xf5dd('0x7'));router['get']('/',auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x9')]);router[_0xf5dd('0xa')](_0xf5dd('0xb'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0xc')]);router[_0xf5dd('0xa')]('/:id/hoppers',auth[_0xf5dd('0x8')](),controller[_0xf5dd('0xd')]);router[_0xf5dd('0xa')](_0xf5dd('0xe'),auth['isAuthenticated'](),controller[_0xf5dd('0xf')]);router['get'](_0xf5dd('0x10'),auth['isAuthenticated'](),controller[_0xf5dd('0x11')]);router[_0xf5dd('0xa')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xf5dd('0x12')]);router[_0xf5dd('0xa')](_0xf5dd('0x13'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x14')]);router[_0xf5dd('0xa')](_0xf5dd('0x15'),auth['isAuthenticated'](),controller[_0xf5dd('0x16')]);router['get']('/:id/members',auth[_0xf5dd('0x8')](),controller['getMembers']);router[_0xf5dd('0xa')](_0xf5dd('0x17'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x18')]);router[_0xf5dd('0xa')](_0xf5dd('0x19'),auth[_0xf5dd('0x8')](),controller['getBlackLists']);router['post']('/',auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x1a')]);router[_0xf5dd('0x1b')](_0xf5dd('0x1c'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x1d')]);router[_0xf5dd('0x1b')]('/:id/teams',auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x1e')]);router[_0xf5dd('0x1b')](_0xf5dd('0x15'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf5dd('0x1b')]('/:id/lists',auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x1f')]);router[_0xf5dd('0x1b')](_0xf5dd('0x19'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x20')]);router[_0xf5dd('0x21')](_0xf5dd('0xb'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x22')]);router[_0xf5dd('0x23')](_0xf5dd('0xb'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x24')]);router['delete'](_0xf5dd('0x13'),auth['isAuthenticated'](),controller[_0xf5dd('0x25')]);router[_0xf5dd('0x23')](_0xf5dd('0x15'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x26')]);router[_0xf5dd('0x23')](_0xf5dd('0x17'),auth['isAuthenticated'](),controller[_0xf5dd('0x27')]);router[_0xf5dd('0x23')](_0xf5dd('0x19'),auth[_0xf5dd('0x8')](),controller[_0xf5dd('0x28')]);module[_0xf5dd('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 1baa68d..5def74c 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(_0x51ed46,_0x4b7ad2){var _0xc2b1e7=function(_0x43ec08){while(--_0x43ec08){_0x51ed46['push'](_0x51ed46['shift']());}};_0xc2b1e7(++_0x4b7ad2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x4b3ec4,_0x3c573c){var _0x192836=function(_0x498cc0){while(--_0x498cc0){_0x4b3ec4['push'](_0x4b3ec4['shift']());}};_0x192836(++_0x3c573c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 79bf34b..dd225a0 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 _0xbe52=['name','UserProfileResource','error','stack','index','map','rawAttributes','fieldName','model','keys','filters','intersection','attributes','fields','length','hasOwnProperty','query','sort','where','pick','filter','merge','options','VoiceQueue','includeAll','include','findAll','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','inbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','getHoppers','nolimit','order','VoiceQueueId','CmHopper','getHopperHistories','findOne','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','emit','ids','select','field','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','removeAgents','userVoiceQueue:remove','addAgents','omit','isEmpty','upsert','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ContactId','ListId','updatedAt','phone','NOW()','scheduledAt','CmListId','toString','from','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','insert','cm_contacts','removeLists','getBlackLists','CmList','addBlackLists','spread','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','count','offset','limit','set','apply','update','then','destroy','get','QueueCampaigns','ignore','value','find','type'];(function(_0xb32e43,_0x3f1991){var _0x3a4bce=function(_0x11b5f7){while(--_0x11b5f7){_0xb32e43['push'](_0xb32e43['shift']());}};_0x3a4bce(++_0x3f1991);}(_0xbe52,0x1eb));var _0x2be5=function(_0x10e56d,_0x46aa3d){_0x10e56d=_0x10e56d-0x0;var _0x47fa3e=_0xbe52[_0x10e56d];return _0x47fa3e;};'use strict';var pdf=require(_0x2be5('0x0'));var emlformat=require(_0x2be5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2be5('0x2'));var jsonpatch=require(_0x2be5('0x3'));var rp=require(_0x2be5('0x4'));var moment=require(_0x2be5('0x5'));var BPromise=require(_0x2be5('0x6'));var Mustache=require(_0x2be5('0x7'));var util=require('util');var path=require(_0x2be5('0x8'));var sox=require(_0x2be5('0x9'));var csv=require('to-csv');var ejs=require(_0x2be5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2be5('0xb'));var jsforce=require(_0x2be5('0xc'));var deskjs=require(_0x2be5('0xd'));var toCsv=require(_0x2be5('0xe'));var querystring=require(_0x2be5('0xf'));var Papa=require('papaparse');var Redis=require(_0x2be5('0x10'));var authService=require(_0x2be5('0x11'));var qs=require(_0x2be5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2be5('0x13'));var logger=require(_0x2be5('0x14'))(_0x2be5('0x15'));var utils=require(_0x2be5('0x16'));var config=require(_0x2be5('0x17'));var db=require(_0x2be5('0x18'))['db'];config[_0x2be5('0x19')]=_['defaults'](config[_0x2be5('0x19')],{'host':_0x2be5('0x1a'),'port':0x18eb});var socket=require(_0x2be5('0x1b'))(new Redis(config[_0x2be5('0x19')]));require(_0x2be5('0x1c'))['register'](socket);function respondWithStatusCode(_0x3776be,_0x757f3d){_0x757f3d=_0x757f3d||0xcc;return function(_0x45614c){if(_0x45614c){return _0x3776be[_0x2be5('0x1d')](_0x757f3d);}return _0x3776be['status'](_0x757f3d)[_0x2be5('0x1e')]();};}function respondWithResult(_0x17d153,_0x2b1d40){_0x2b1d40=_0x2b1d40||0xc8;return function(_0x41980e){if(_0x41980e){return _0x17d153[_0x2be5('0x1f')](_0x2b1d40)['json'](_0x41980e);}};}function respondWithFilteredResult(_0x5c4568,_0x3237ab){return function(_0x4164a7){if(_0x4164a7){var _0x41a4cc=_0x4164a7[_0x2be5('0x20')],_0x20e586=_0x3237ab[_0x2be5('0x21')],_0xc7c97b=_0x3237ab[_0x2be5('0x21')]+_0x3237ab[_0x2be5('0x22')],_0x452c82;if(_0xc7c97b>=_0x41a4cc){_0xc7c97b=_0x41a4cc;_0x452c82=0xc8;}else{_0x452c82=0xce;}_0x5c4568[_0x2be5('0x1f')](_0x452c82);return _0x5c4568[_0x2be5('0x23')]('Content-Range',_0x20e586+'-'+_0xc7c97b+'/'+_0x41a4cc)['json'](_0x4164a7);}return null;};}function patchUpdates(_0x2a3786){return function(_0x54fd84){try{jsonpatch[_0x2be5('0x24')](_0x54fd84,_0x2a3786,!![]);}catch(_0xb67035){return BPromise['reject'](_0xb67035);}return _0x54fd84['save']();};}function saveUpdates(_0x2354c2,_0x28c5cf){return function(_0xf9a073){if(_0xf9a073){return _0xf9a073[_0x2be5('0x25')](_0x2354c2)[_0x2be5('0x26')](function(_0x509a09){return _0x509a09;});}return null;};}function removeEntity(_0x1a736d,_0x58f906){return function(_0x529711){if(_0x529711){return _0x529711[_0x2be5('0x27')]()['then'](function(){var _0x288b18=_0x529711[_0x2be5('0x28')]({'plain':!![]});var _0x51cb75=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x2be5('0x29'),'value':'outbound','ignore':![]}];var _0xcf319b=_(_0x51cb75)['filter'](_0x2be5('0x2a'))['map'](_0x2be5('0x2b'))[_0x2be5('0x2b')]();if(_['includes'](_0xcf319b,_0x288b18['type'])){return;}var _0x26d157=_[_0x2be5('0x2c')](_0x51cb75,[_0x2be5('0x2b'),_0x288b18[_0x2be5('0x2d')]])[_0x2be5('0x2e')];return db[_0x2be5('0x2f')][_0x2be5('0x27')]({'where':{'type':_0x26d157,'resourceId':_0x288b18['id']}})[_0x2be5('0x26')](function(){return _0x529711;});})[_0x2be5('0x26')](function(){_0x1a736d[_0x2be5('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31e40f,_0x2fb6bd){return function(_0x3c2f72){if(!_0x3c2f72){_0x31e40f[_0x2be5('0x1d')](0x194);}return _0x3c2f72;};}function handleError(_0x411e95,_0x24b934){_0x24b934=_0x24b934||0x1f4;return function(_0x24af06){logger[_0x2be5('0x30')](_0x24af06[_0x2be5('0x31')]);if(_0x24af06[_0x2be5('0x2e')]){delete _0x24af06[_0x2be5('0x2e')];}_0x411e95[_0x2be5('0x1f')](_0x24b934)['send'](_0x24af06);};}exports[_0x2be5('0x32')]=function(_0x17c54b,_0x4810d3){var _0x27ca2c={},_0x435c59={},_0x13ee07={'count':0x0,'rows':[]};var _0x1e6b56=_[_0x2be5('0x33')](db['VoiceQueue'][_0x2be5('0x34')],function(_0x430bae){return{'name':_0x430bae[_0x2be5('0x35')],'type':_0x430bae[_0x2be5('0x2d')]['key']};});_0x435c59[_0x2be5('0x36')]=_[_0x2be5('0x33')](_0x1e6b56,_0x2be5('0x2e'));_0x435c59['query']=_[_0x2be5('0x37')](_0x17c54b['query']);_0x435c59[_0x2be5('0x38')]=_[_0x2be5('0x39')](_0x435c59['model'],_0x435c59['query']);_0x27ca2c[_0x2be5('0x3a')]=_[_0x2be5('0x39')](_0x435c59[_0x2be5('0x36')],qs[_0x2be5('0x3b')](_0x17c54b['query'][_0x2be5('0x3b')]));_0x27ca2c[_0x2be5('0x3a')]=_0x27ca2c[_0x2be5('0x3a')][_0x2be5('0x3c')]?_0x27ca2c[_0x2be5('0x3a')]:_0x435c59['model'];if(!_0x17c54b['query'][_0x2be5('0x3d')]('nolimit')){_0x27ca2c[_0x2be5('0x22')]=qs[_0x2be5('0x22')](_0x17c54b[_0x2be5('0x3e')]['limit']);_0x27ca2c['offset']=qs[_0x2be5('0x21')](_0x17c54b['query'][_0x2be5('0x21')]);}_0x27ca2c['order']=qs[_0x2be5('0x3f')](_0x17c54b[_0x2be5('0x3e')][_0x2be5('0x3f')]);_0x27ca2c[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_[_0x2be5('0x41')](_0x17c54b[_0x2be5('0x3e')],_0x435c59[_0x2be5('0x38')]),_0x1e6b56);if(_0x17c54b['query'][_0x2be5('0x42')]){_0x27ca2c[_0x2be5('0x40')]=_['merge'](_0x27ca2c[_0x2be5('0x40')],{'$or':_[_0x2be5('0x33')](_0x1e6b56,function(_0x2c61f0){if(_0x2c61f0['type']!=='VIRTUAL'){var _0x547d5c={};_0x547d5c[_0x2c61f0[_0x2be5('0x2e')]]={'$like':'%'+_0x17c54b['query'][_0x2be5('0x42')]+'%'};return _0x547d5c;}})});}_0x27ca2c=_[_0x2be5('0x43')]({},_0x27ca2c,_0x17c54b[_0x2be5('0x44')]);var _0x371ff1={'where':_0x27ca2c[_0x2be5('0x40')]};return db[_0x2be5('0x45')][_0x2be5('0x20')](_0x371ff1)[_0x2be5('0x26')](function(_0x4a02e2){_0x13ee07[_0x2be5('0x20')]=_0x4a02e2;if(_0x17c54b['query'][_0x2be5('0x46')]){_0x27ca2c[_0x2be5('0x47')]=[{'all':!![]}];}return db['VoiceQueue'][_0x2be5('0x48')](_0x27ca2c);})[_0x2be5('0x26')](function(_0x1b54c7){_0x13ee07['rows']=_0x1b54c7;return _0x13ee07;})[_0x2be5('0x26')](respondWithFilteredResult(_0x4810d3,_0x27ca2c))[_0x2be5('0x49')](handleError(_0x4810d3,null));};exports[_0x2be5('0x4a')]=function(_0x3cfe38,_0x4c675d){var _0x1b46db={'raw':![],'where':{'id':_0x3cfe38[_0x2be5('0x4b')]['id']}},_0x2289ca={};_0x2289ca['model']=_[_0x2be5('0x37')](db[_0x2be5('0x45')][_0x2be5('0x34')]);_0x2289ca['query']=_[_0x2be5('0x37')](_0x3cfe38[_0x2be5('0x3e')]);_0x2289ca['filters']=_[_0x2be5('0x39')](_0x2289ca[_0x2be5('0x36')],_0x2289ca[_0x2be5('0x3e')]);_0x1b46db[_0x2be5('0x3a')]=_[_0x2be5('0x39')](_0x2289ca[_0x2be5('0x36')],qs[_0x2be5('0x3b')](_0x3cfe38[_0x2be5('0x3e')][_0x2be5('0x3b')]));_0x1b46db[_0x2be5('0x3a')]=_0x1b46db[_0x2be5('0x3a')]['length']?_0x1b46db[_0x2be5('0x3a')]:_0x2289ca['model'];if(_0x3cfe38[_0x2be5('0x3e')][_0x2be5('0x46')]){_0x1b46db[_0x2be5('0x47')]=[{'all':!![]}];}_0x1b46db=_[_0x2be5('0x43')]({},_0x1b46db,_0x3cfe38[_0x2be5('0x44')]);return db[_0x2be5('0x45')][_0x2be5('0x2c')](_0x1b46db)['then'](handleEntityNotFound(_0x4c675d,null))[_0x2be5('0x26')](respondWithResult(_0x4c675d,null))['catch'](handleError(_0x4c675d,null));};exports[_0x2be5('0x4c')]=function(_0x5e8d0a,_0x3e004f){return db[_0x2be5('0x45')]['create'](_0x5e8d0a[_0x2be5('0x4d')],{})[_0x2be5('0x26')](function(_0x2af72a){var _0x279e80=_0x5e8d0a['user'][_0x2be5('0x28')]({'plain':!![]});if(!_0x279e80)throw new Error(_0x2be5('0x4e'));if(_0x279e80[_0x2be5('0x4f')]===_0x2be5('0x50')){var _0x475507=_0x2af72a[_0x2be5('0x28')]({'plain':!![]});var _0x339c68=[{'name':_0x2be5('0x51'),'value':_0x2be5('0x52')},{'name':_0x2be5('0x29'),'value':'outbound'}];var _0x1997f0=_[_0x2be5('0x2c')](_0x339c68,[_0x2be5('0x2b'),_0x475507['type']])[_0x2be5('0x2e')];return db[_0x2be5('0x53')]['find']({'where':{'name':_0x1997f0,'userProfileId':_0x279e80[_0x2be5('0x54')]},'raw':!![]})[_0x2be5('0x26')](function(_0x1a9f69){if(_0x1a9f69&&_0x1a9f69['autoAssociation']===0x0){return db[_0x2be5('0x2f')][_0x2be5('0x4c')]({'name':_0x475507[_0x2be5('0x2e')],'resourceId':_0x475507['id'],'type':_0x1a9f69[_0x2be5('0x2e')],'sectionId':_0x1a9f69['id']},{})[_0x2be5('0x26')](function(){return _0x2af72a;});}else{return _0x2af72a;}})[_0x2be5('0x49')](function(_0x32bf2f){logger[_0x2be5('0x30')](_0x2be5('0x55'),_0x32bf2f);throw _0x32bf2f;});}return _0x2af72a;})[_0x2be5('0x26')](respondWithResult(_0x3e004f,0xc9))[_0x2be5('0x49')](handleError(_0x3e004f,null));};exports['clone']=function(_0x10deba,_0x3e3d32){var _0x53c89c={'where':{'id':_0x10deba[_0x2be5('0x4b')]['id']}},_0x16e77c={};_0x16e77c[_0x2be5('0x36')]=_['keys'](db[_0x2be5('0x45')][_0x2be5('0x34')]);_0x53c89c[_0x2be5('0x3a')]=_[_0x2be5('0x39')](_0x16e77c[_0x2be5('0x36')],qs[_0x2be5('0x3b')](_0x10deba['query'][_0x2be5('0x3b')]));_0x53c89c[_0x2be5('0x3a')]=_0x53c89c['attributes'][_0x2be5('0x3c')]?_0x53c89c[_0x2be5('0x3a')]:_0x16e77c[_0x2be5('0x36')];if(_0x10deba[_0x2be5('0x3e')][_0x2be5('0x46')]){_0x53c89c[_0x2be5('0x47')]=[{'all':!![]}];}_0x53c89c=_[_0x2be5('0x43')]({},_0x53c89c,_0x10deba[_0x2be5('0x44')]);return db[_0x2be5('0x45')][_0x2be5('0x2c')](_0x53c89c)[_0x2be5('0x26')](handleEntityNotFound(_0x3e3d32,null))[_0x2be5('0x26')](function(_0x2da97c){if(_0x2da97c){var _0x267f4d=_0x2da97c['get']({'plain':!![]});_0x267f4d=qs['omit'](_0x267f4d,['id',_0x2be5('0x56'),'updatedAt']);_0x10deba['body']=_['omit'](_0x10deba['body'],['id',_0x2be5('0x56'),'updatedAt']);return db[_0x2be5('0x45')]['create'](_[_0x2be5('0x43')](_0x267f4d,_0x10deba['body']),{'include':_0x10deba['query']['includeAll']?[{'all':!![]}]:undefined})[_0x2be5('0x26')](function(_0x543e88){var _0x265e71=_0x10deba[_0x2be5('0x50')][_0x2be5('0x28')]({'plain':!![]});if(!_0x265e71)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x265e71[_0x2be5('0x4f')]===_0x2be5('0x50')){var _0xce6cdb=_0x543e88['get']({'plain':!![]});var _0x45303a=[{'name':_0x2be5('0x51'),'value':'inbound'},{'name':_0x2be5('0x29'),'value':'outbound'}];var _0x1b1ba2=_[_0x2be5('0x2c')](_0x45303a,['value',_0xce6cdb[_0x2be5('0x2d')]])[_0x2be5('0x2e')];return db[_0x2be5('0x53')][_0x2be5('0x2c')]({'where':{'name':_0x1b1ba2,'userProfileId':_0x265e71[_0x2be5('0x54')]},'raw':!![]})[_0x2be5('0x26')](function(_0x4cccca){if(_0x4cccca&&_0x4cccca['autoAssociation']===0x0){return db[_0x2be5('0x2f')][_0x2be5('0x4c')]({'name':_0xce6cdb[_0x2be5('0x2e')],'resourceId':_0xce6cdb['id'],'type':_0x4cccca['name'],'sectionId':_0x4cccca['id']},{})[_0x2be5('0x26')](function(){return _0x543e88;});}else{return _0x543e88;}})[_0x2be5('0x49')](function(_0x54080f){logger[_0x2be5('0x30')](_0x2be5('0x55'),_0x54080f);throw _0x54080f;});}return _0x543e88;});}})[_0x2be5('0x26')](respondWithResult(_0x3e3d32,0xc9))[_0x2be5('0x49')](handleError(_0x3e3d32,null));};exports[_0x2be5('0x25')]=function(_0x46007c,_0xa9cc6){if(_0x46007c[_0x2be5('0x4d')]['id']){delete _0x46007c[_0x2be5('0x4d')]['id'];}return db[_0x2be5('0x45')]['find']({'where':{'id':_0x46007c[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0xa9cc6,null))[_0x2be5('0x26')](saveUpdates(_0x46007c[_0x2be5('0x4d')],null))[_0x2be5('0x26')](respondWithResult(_0xa9cc6,null))[_0x2be5('0x49')](handleError(_0xa9cc6,null));};exports[_0x2be5('0x27')]=function(_0x266e51,_0x454439){return db['VoiceQueue'][_0x2be5('0x2c')]({'where':{'id':_0x266e51[_0x2be5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x454439,null))['then'](removeEntity(_0x454439,null))['catch'](handleError(_0x454439,null));};exports[_0x2be5('0x57')]=function(_0x44a068,_0xfb6f01,_0x4bd2d6){var _0x7636b4={'raw':![],'where':{}};var _0xd74a17={};var _0xa8ea78={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x44a068['params']['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0xfb6f01,null))['then'](function(_0x3a34f5){if(_0x3a34f5){_0xd74a17[_0x2be5('0x36')]=_[_0x2be5('0x37')](db['CmHopper'][_0x2be5('0x34')]);_0xd74a17[_0x2be5('0x3e')]=_[_0x2be5('0x37')](_0x44a068[_0x2be5('0x3e')]);_0xd74a17[_0x2be5('0x38')]=_['intersection'](_0xd74a17[_0x2be5('0x36')],_0xd74a17[_0x2be5('0x3e')]);_0x7636b4[_0x2be5('0x3a')]=_[_0x2be5('0x39')](_0xd74a17[_0x2be5('0x36')],qs[_0x2be5('0x3b')](_0x44a068['query'][_0x2be5('0x3b')]));_0x7636b4[_0x2be5('0x3a')]=_0x7636b4[_0x2be5('0x3a')]['length']?_0x7636b4[_0x2be5('0x3a')]:_0xd74a17[_0x2be5('0x36')];if(!_0x44a068[_0x2be5('0x3e')][_0x2be5('0x3d')](_0x2be5('0x58'))){_0x7636b4[_0x2be5('0x22')]=qs[_0x2be5('0x22')](_0x44a068['query'][_0x2be5('0x22')]);_0x7636b4['offset']=qs['offset'](_0x44a068['query']['offset']);}_0x7636b4[_0x2be5('0x59')]=qs['sort'](_0x44a068[_0x2be5('0x3e')][_0x2be5('0x3f')]);_0x7636b4[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_['pick'](_0x44a068[_0x2be5('0x3e')],_0xd74a17[_0x2be5('0x38')]));_0x7636b4[_0x2be5('0x40')][_0x2be5('0x5a')]=_0x3a34f5['id'];if(_0x44a068['query']['filter']){_0x7636b4[_0x2be5('0x40')]=_['merge'](_0x7636b4['where'],{'$or':_['map'](_0x7636b4[_0x2be5('0x3a')],function(_0x5d2b6c){var _0x5a63e9={};_0x5a63e9[_0x5d2b6c]={'$like':'%'+_0x44a068[_0x2be5('0x3e')][_0x2be5('0x42')]+'%'};return _0x5a63e9;})});}_0x7636b4=_[_0x2be5('0x43')]({},_0x7636b4,_0x44a068[_0x2be5('0x44')]);return db[_0x2be5('0x5b')]['count']({'where':_0x7636b4[_0x2be5('0x40')]})[_0x2be5('0x26')](function(_0x4c28df){_0xa8ea78[_0x2be5('0x20')]=_0x4c28df;if(_0x44a068[_0x2be5('0x3e')][_0x2be5('0x46')]){_0x7636b4[_0x2be5('0x47')]=[{'all':!![]}];}return db[_0x2be5('0x5b')][_0x2be5('0x48')](_0x7636b4);})['then'](function(_0x5b6dab){_0xa8ea78['rows']=_0x5b6dab;return _0xa8ea78;});}})[_0x2be5('0x26')](respondWithFilteredResult(_0xfb6f01,_0x7636b4))[_0x2be5('0x49')](handleError(_0xfb6f01,null));};exports[_0x2be5('0x5c')]=function(_0x3f1f17,_0x19edab,_0x630c97){var _0x4221fd={'raw':!![],'where':{}};var _0x1199e0={};var _0x4426f9={'count':0x0,'rows':[]};return db[_0x2be5('0x45')][_0x2be5('0x5d')]({'where':{'id':_0x3f1f17[_0x2be5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x19edab,null))['then'](function(_0x5ce129){if(_0x5ce129){_0x1199e0[_0x2be5('0x36')]=_[_0x2be5('0x37')](db[_0x2be5('0x5e')][_0x2be5('0x34')]);_0x1199e0[_0x2be5('0x3e')]=_[_0x2be5('0x37')](_0x3f1f17[_0x2be5('0x3e')]);_0x1199e0[_0x2be5('0x38')]=_['intersection'](_0x1199e0[_0x2be5('0x36')],_0x1199e0[_0x2be5('0x3e')]);_0x4221fd[_0x2be5('0x3a')]=_[_0x2be5('0x39')](_0x1199e0[_0x2be5('0x36')],qs[_0x2be5('0x3b')](_0x3f1f17[_0x2be5('0x3e')][_0x2be5('0x3b')]));_0x4221fd[_0x2be5('0x3a')]=_0x4221fd['attributes'][_0x2be5('0x3c')]?_0x4221fd['attributes']:_0x1199e0[_0x2be5('0x36')];if(!_0x3f1f17[_0x2be5('0x3e')]['hasOwnProperty']('nolimit')){_0x4221fd[_0x2be5('0x22')]=qs['limit'](_0x3f1f17[_0x2be5('0x3e')][_0x2be5('0x22')]);_0x4221fd['offset']=qs[_0x2be5('0x21')](_0x3f1f17['query'][_0x2be5('0x21')]);}_0x4221fd[_0x2be5('0x59')]=qs[_0x2be5('0x3f')](_0x3f1f17['query'][_0x2be5('0x3f')]);_0x4221fd[_0x2be5('0x40')]=qs['filters'](_['pick'](_0x3f1f17[_0x2be5('0x3e')],_0x1199e0[_0x2be5('0x38')]));_0x4221fd[_0x2be5('0x40')]['VoiceQueueId']=_0x5ce129['id'];if(_0x3f1f17[_0x2be5('0x3e')][_0x2be5('0x42')]){_0x4221fd[_0x2be5('0x40')]=_[_0x2be5('0x43')](_0x4221fd['where'],{'$or':_[_0x2be5('0x33')](_0x4221fd[_0x2be5('0x3a')],function(_0x17ee35){var _0x56ac09={};_0x56ac09[_0x17ee35]={'$like':'%'+_0x3f1f17[_0x2be5('0x3e')][_0x2be5('0x42')]+'%'};return _0x56ac09;})});}_0x4221fd=_['merge']({},_0x4221fd,_0x3f1f17[_0x2be5('0x44')]);return db[_0x2be5('0x5e')][_0x2be5('0x20')]({'where':_0x4221fd['where']})[_0x2be5('0x26')](function(_0x2abcee){_0x4426f9['count']=_0x2abcee;if(_0x3f1f17[_0x2be5('0x3e')][_0x2be5('0x46')]){_0x4221fd[_0x2be5('0x47')]=[{'all':!![]}];}return db[_0x2be5('0x5e')][_0x2be5('0x48')](_0x4221fd);})['then'](function(_0x44e373){_0x4426f9[_0x2be5('0x5f')]=_0x44e373;return _0x4426f9;});}})[_0x2be5('0x26')](respondWithFilteredResult(_0x19edab,_0x4221fd))['catch'](handleError(_0x19edab,null));};exports[_0x2be5('0x60')]=function(_0x56b998,_0x341f21,_0x123a06){var _0x3b0724={'raw':!![],'where':{}};var _0x246d2b={};var _0x5ac3d9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2be5('0x5d')]({'where':{'id':_0x56b998[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x341f21,null))[_0x2be5('0x26')](function(_0x3abe2e){if(_0x3abe2e){_0x246d2b[_0x2be5('0x36')]=_[_0x2be5('0x37')](db['CmHopperFinal'][_0x2be5('0x34')]);_0x246d2b[_0x2be5('0x3e')]=_[_0x2be5('0x37')](_0x56b998[_0x2be5('0x3e')]);_0x246d2b[_0x2be5('0x38')]=_[_0x2be5('0x39')](_0x246d2b[_0x2be5('0x36')],_0x246d2b[_0x2be5('0x3e')]);_0x3b0724[_0x2be5('0x3a')]=_[_0x2be5('0x39')](_0x246d2b[_0x2be5('0x36')],qs[_0x2be5('0x3b')](_0x56b998['query'][_0x2be5('0x3b')]));_0x3b0724[_0x2be5('0x3a')]=_0x3b0724[_0x2be5('0x3a')][_0x2be5('0x3c')]?_0x3b0724[_0x2be5('0x3a')]:_0x246d2b[_0x2be5('0x36')];if(!_0x56b998['query'][_0x2be5('0x3d')](_0x2be5('0x58'))){_0x3b0724[_0x2be5('0x22')]=qs['limit'](_0x56b998[_0x2be5('0x3e')][_0x2be5('0x22')]);_0x3b0724[_0x2be5('0x21')]=qs[_0x2be5('0x21')](_0x56b998[_0x2be5('0x3e')][_0x2be5('0x21')]);}_0x3b0724[_0x2be5('0x59')]=qs[_0x2be5('0x3f')](_0x56b998[_0x2be5('0x3e')][_0x2be5('0x3f')]);_0x3b0724[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_['pick'](_0x56b998[_0x2be5('0x3e')],_0x246d2b[_0x2be5('0x38')]));_0x3b0724['where'][_0x2be5('0x5a')]=_0x3abe2e['id'];if(_0x56b998[_0x2be5('0x3e')]['filter']){_0x3b0724['where']=_[_0x2be5('0x43')](_0x3b0724[_0x2be5('0x40')],{'$or':_[_0x2be5('0x33')](_0x3b0724['attributes'],function(_0x484526){var _0x46bca9={};_0x46bca9[_0x484526]={'$like':'%'+_0x56b998['query'][_0x2be5('0x42')]+'%'};return _0x46bca9;})});}_0x3b0724=_[_0x2be5('0x43')]({},_0x3b0724,_0x56b998[_0x2be5('0x44')]);return db[_0x2be5('0x61')][_0x2be5('0x20')]({'where':_0x3b0724[_0x2be5('0x40')]})['then'](function(_0x3d470e){_0x5ac3d9[_0x2be5('0x20')]=_0x3d470e;if(_0x56b998[_0x2be5('0x3e')][_0x2be5('0x46')]){_0x3b0724['include']=[{'all':!![]}];}return db[_0x2be5('0x61')][_0x2be5('0x48')](_0x3b0724);})['then'](function(_0x46c4c2){_0x5ac3d9[_0x2be5('0x5f')]=_0x46c4c2;return _0x5ac3d9;});}})[_0x2be5('0x26')](respondWithFilteredResult(_0x341f21,_0x3b0724))['catch'](handleError(_0x341f21,null));};exports[_0x2be5('0x62')]=function(_0x34f44e,_0x5064d0,_0x2122bf){var _0x2cc265={'raw':!![],'where':{}};var _0x35ef6a={};var _0x2628ea={'count':0x0,'rows':[]};return db[_0x2be5('0x45')][_0x2be5('0x5d')]({'where':{'id':_0x34f44e['params']['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x5064d0,null))[_0x2be5('0x26')](function(_0x4f9d8b){if(_0x4f9d8b){_0x35ef6a['model']=_[_0x2be5('0x37')](db[_0x2be5('0x63')][_0x2be5('0x34')]);_0x35ef6a[_0x2be5('0x3e')]=_[_0x2be5('0x37')](_0x34f44e['query']);_0x35ef6a[_0x2be5('0x38')]=_[_0x2be5('0x39')](_0x35ef6a[_0x2be5('0x36')],_0x35ef6a[_0x2be5('0x3e')]);_0x2cc265['attributes']=_[_0x2be5('0x39')](_0x35ef6a[_0x2be5('0x36')],qs['fields'](_0x34f44e['query'][_0x2be5('0x3b')]));_0x2cc265[_0x2be5('0x3a')]=_0x2cc265['attributes'][_0x2be5('0x3c')]?_0x2cc265['attributes']:_0x35ef6a['model'];if(!_0x34f44e[_0x2be5('0x3e')][_0x2be5('0x3d')](_0x2be5('0x58'))){_0x2cc265[_0x2be5('0x22')]=qs[_0x2be5('0x22')](_0x34f44e['query'][_0x2be5('0x22')]);_0x2cc265[_0x2be5('0x21')]=qs[_0x2be5('0x21')](_0x34f44e['query'][_0x2be5('0x21')]);}_0x2cc265['order']=qs[_0x2be5('0x3f')](_0x34f44e[_0x2be5('0x3e')][_0x2be5('0x3f')]);_0x2cc265[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_[_0x2be5('0x41')](_0x34f44e[_0x2be5('0x3e')],_0x35ef6a[_0x2be5('0x38')]));_0x2cc265['where']['VoiceQueueId']=_0x4f9d8b['id'];if(_0x34f44e[_0x2be5('0x3e')][_0x2be5('0x42')]){_0x2cc265['where']=_[_0x2be5('0x43')](_0x2cc265['where'],{'$or':_['map'](_0x2cc265[_0x2be5('0x3a')],function(_0x4c71aa){var _0x44d3be={};_0x44d3be[_0x4c71aa]={'$like':'%'+_0x34f44e[_0x2be5('0x3e')][_0x2be5('0x42')]+'%'};return _0x44d3be;})});}_0x2cc265=_['merge']({},_0x2cc265,_0x34f44e[_0x2be5('0x44')]);return db[_0x2be5('0x63')]['count']({'where':_0x2cc265[_0x2be5('0x40')]})[_0x2be5('0x26')](function(_0x143e88){_0x2628ea['count']=_0x143e88;if(_0x34f44e['query'][_0x2be5('0x46')]){_0x2cc265[_0x2be5('0x47')]=[{'all':!![]}];}return db[_0x2be5('0x63')]['findAll'](_0x2cc265);})['then'](function(_0x31d2b2){_0x2628ea[_0x2be5('0x5f')]=_0x31d2b2;return _0x2628ea;});}})[_0x2be5('0x26')](respondWithFilteredResult(_0x5064d0,_0x2cc265))[_0x2be5('0x49')](handleError(_0x5064d0,null));};exports[_0x2be5('0x64')]=function(_0x5902f2,_0x1ea498,_0x5e29d0){var _0x5452e9={};var _0x556233={};var _0x2cea03;var _0x438d81;return db['VoiceQueue'][_0x2be5('0x5d')]({'where':{'id':_0x5902f2[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x1ea498,null))[_0x2be5('0x26')](function(_0x552a1a){if(_0x552a1a){_0x2cea03=_0x552a1a;_0x556233[_0x2be5('0x36')]=_['keys'](db[_0x2be5('0x65')][_0x2be5('0x34')]);_0x556233[_0x2be5('0x3e')]=_[_0x2be5('0x37')](_0x5902f2[_0x2be5('0x3e')]);_0x556233['filters']=_[_0x2be5('0x39')](_0x556233[_0x2be5('0x36')],_0x556233[_0x2be5('0x3e')]);_0x5452e9['attributes']=_[_0x2be5('0x39')](_0x556233[_0x2be5('0x36')],qs[_0x2be5('0x3b')](_0x5902f2['query'][_0x2be5('0x3b')]));_0x5452e9[_0x2be5('0x3a')]=_0x5452e9[_0x2be5('0x3a')][_0x2be5('0x3c')]?_0x5452e9[_0x2be5('0x3a')]:_0x556233[_0x2be5('0x36')];_0x5452e9[_0x2be5('0x59')]=qs['sort'](_0x5902f2['query'][_0x2be5('0x3f')]);_0x5452e9[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_['pick'](_0x5902f2[_0x2be5('0x3e')],_0x556233['filters']));if(_0x5902f2['query'][_0x2be5('0x42')]){_0x5452e9[_0x2be5('0x40')]=_[_0x2be5('0x43')](_0x5452e9[_0x2be5('0x40')],{'$or':_[_0x2be5('0x33')](_0x5452e9[_0x2be5('0x3a')],function(_0x1e58fb){var _0x15289c={};_0x15289c[_0x1e58fb]={'$like':'%'+_0x5902f2[_0x2be5('0x3e')][_0x2be5('0x42')]+'%'};return _0x15289c;})});}_0x5452e9=_[_0x2be5('0x43')]({},_0x5452e9,_0x5902f2[_0x2be5('0x44')]);return _0x2cea03[_0x2be5('0x64')](_0x5452e9);}})[_0x2be5('0x26')](function(_0x2c74d8){if(_0x2c74d8){_0x438d81=_0x2c74d8[_0x2be5('0x3c')];if(!_0x5902f2[_0x2be5('0x3e')][_0x2be5('0x3d')](_0x2be5('0x58'))){_0x5452e9[_0x2be5('0x22')]=qs['limit'](_0x5902f2['query']['limit']);_0x5452e9[_0x2be5('0x21')]=qs[_0x2be5('0x21')](_0x5902f2['query']['offset']);}return _0x2cea03[_0x2be5('0x64')](_0x5452e9);}})[_0x2be5('0x26')](function(_0x2fdec6){if(_0x2fdec6){return _0x2fdec6?{'count':_0x438d81,'rows':_0x2fdec6}:null;}})['then'](respondWithResult(_0x1ea498,null))[_0x2be5('0x49')](handleError(_0x1ea498,null));};exports[_0x2be5('0x66')]=function(_0x24d165,_0x2e6cbe,_0x3b3feb){var _0x42d5d0=_0x24d165[_0x2be5('0x4d')][_0x2be5('0x67')];var _0x4cf3d0=_[_0x2be5('0x33')](_0x42d5d0,'id');return db['Team']['findAll']({'where':{'id':_0x4cf3d0},'attributes':['id'],'include':[{'model':db[_0x2be5('0x68')],'as':_0x2be5('0x69'),'attributes':['id',_0x2be5('0x2e'),_0x2be5('0x6a'),_0x2be5('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x509609){if(_0x509609){var _0x5c19bc=_[_0x2be5('0x6c')](_0x509609,function(_0x474b0c){var _0x34d194=_0x474b0c[_0x2be5('0x28')]({'plain':!![]});_0x34d194[_0x2be5('0x69')]['forEach'](function(_0x536dac){_0x536dac[_0x2be5('0x6d')]=_[_0x2be5('0x2c')](_0x42d5d0,{'id':_0x34d194['id']})[_0x2be5('0x6d')];});return _0x34d194[_0x2be5('0x69')];});return db[_0x2be5('0x45')]['find']({'where':{'id':_0x24d165[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](function(_0x2dc39c){return db['sequelize'][_0x2be5('0x6e')](function(_0x1b9583){return _0x2dc39c[_0x2be5('0x66')](_0x4cf3d0,{'transaction':_0x1b9583})[_0x2be5('0x26')](function(){return BPromise[_0x2be5('0x6f')](_0x5c19bc,function(_0x222cef){return db[_0x2be5('0x70')][_0x2be5('0x71')]({'where':{'UserId':_0x222cef['id'],'VoiceQueueId':_0x24d165[_0x2be5('0x4b')]['id']},'defaults':{'penalty':_0x222cef[_0x2be5('0x6d')]},'transaction':_0x1b9583});});})[_0x2be5('0x26')](function(){return BPromise[_0x2be5('0x6f')](_[_0x2be5('0x42')](_0x5c19bc,{'online':!![]}),function(_0x4d6070){return db[_0x2be5('0x72')]['upsert']({'membername':_0x4d6070['name'],'UserId':_0x4d6070['id'],'queue_name':_0x2dc39c[_0x2be5('0x2e')],'VoiceQueueId':_0x2dc39c['id'],'interface':_[_0x2be5('0x73')](_0x4d6070[_0x2be5('0x74')])?util[_0x2be5('0x75')](_0x2be5('0x76'),_0x4d6070['name']):_0x4d6070['interface'],'paused':_0x4d6070[_0x2be5('0x6b')]||![],'penalty':_0x4d6070[_0x2be5('0x6d')]},{'transaction':_0x1b9583});});})[_0x2be5('0x26')](function(){_0x5c19bc['forEach'](function(_0x129938){socket[_0x2be5('0x77')]('userVoiceQueue:save',{'UserId':_0x129938['id'],'VoiceQueueId':_0x2dc39c['id']});});});});});}})['then'](respondWithStatusCode(_0x2e6cbe,null))[_0x2be5('0x49')](handleError(_0x2e6cbe,null));};exports['removeTeams']=function(_0x5623ea,_0x11755d,_0x42328b){return db[_0x2be5('0x65')][_0x2be5('0x48')]({'where':{'id':_0x5623ea[_0x2be5('0x3e')][_0x2be5('0x78')]},'attributes':['id'],'include':[{'model':db[_0x2be5('0x68')],'as':_0x2be5('0x69'),'attributes':['id'],'raw':!![]}]})[_0x2be5('0x26')](handleEntityNotFound(_0x11755d,null))['then'](function(_0x526ead){var _0xfaa9f5=_[_0x2be5('0x33')](_0x526ead,'id');var _0xf8a588=[];var _0x5da396=[];var _0x58efb7=squel[_0x2be5('0x79')]();_0x58efb7[_0x2be5('0x7a')]('tq.TeamId')['from'](_0x2be5('0x7b'),'tq')['join'](_0x2be5('0x7c'),'ut',_0x2be5('0x7d'))[_0x2be5('0x40')](_0x2be5('0x7e'),_0x5623ea['params']['id']);for(var _0x3907d=0x0;_0x3907d<_0x526ead['length'];_0x3907d+=0x1){let _0x4933a5=_0x526ead[_0x3907d];for(var _0x299512=0x0;_0x299512<_0x4933a5['Agents']['length'];_0x299512+=0x1){let _0x577548=_0x4933a5['Agents'][_0x299512];var _0x199556=_0x58efb7[_0x2be5('0x7f')]();_0x199556['where'](_0x2be5('0x80'),_0x577548['id']);_0x5da396[_0x2be5('0x81')](db['sequelize']['query'](_0x199556['toString'](),{'type':db[_0x2be5('0x82')][_0x2be5('0x83')][_0x2be5('0x84')]})[_0x2be5('0x26')](function(_0x1addbb){if(_0x1addbb[_0x2be5('0x3c')]===0x1){return _0x577548['id'];}else{var _0xd160d5=_[_0x2be5('0x85')](_[_0x2be5('0x33')](_0x1addbb,'TeamId'),function(_0x56f2f7){return _[_0x2be5('0x86')](_0xfaa9f5,_0x56f2f7);});if(_0xd160d5){return _0x577548['id'];}}}));}}return BPromise[_0x2be5('0x87')](_0x5da396)[_0x2be5('0x26')](function(_0x240798){_0xf8a588=_(_0xf8a588)[_0x2be5('0x88')](_0x240798)[_0x2be5('0x89')]()['value']();return db['VoiceQueue'][_0x2be5('0x2c')]({'where':{'id':_0x5623ea['params']['id']}})[_0x2be5('0x26')](function(_0x19bd32){return db[_0x2be5('0x82')][_0x2be5('0x6e')](function(_0x17aec2){return _0x19bd32[_0x2be5('0x8a')](_0x5623ea[_0x2be5('0x3e')][_0x2be5('0x78')],{'transaction':_0x17aec2})[_0x2be5('0x26')](function(){if(!_['isEmpty'](_0xf8a588)){return _0x19bd32[_0x2be5('0x8b')](_0xf8a588,{'transaction':_0x17aec2})[_0x2be5('0x26')](function(){return db['UserVoiceQueueRt'][_0x2be5('0x27')]({'where':{'VoiceQueueId':_0x5623ea[_0x2be5('0x4b')]['id'],'UserId':_0xf8a588},'transaction':_0x17aec2});});}})['then'](function(){_0xf8a588['forEach'](function(_0x36ea2c){socket[_0x2be5('0x77')](_0x2be5('0x8c'),{'UserId':_0x36ea2c,'VoiceQueueId':_0x19bd32['id']});});});});});});})[_0x2be5('0x26')](respondWithStatusCode(_0x11755d,null))['catch'](handleError(_0x11755d,null));};exports[_0x2be5('0x8d')]=function(_0x46a764,_0x76931,_0x499c1c){var _0x6234b6,_0x1dba81;return db['VoiceQueue'][_0x2be5('0x2c')]({'where':{'id':_0x46a764['params']['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x76931,null))[_0x2be5('0x26')](function(_0x5d8e0a){if(_0x5d8e0a){_0x1dba81=_0x5d8e0a;return _0x5d8e0a['addAgents'](_0x46a764[_0x2be5('0x4d')]['ids'],_[_0x2be5('0x8e')](_0x46a764[_0x2be5('0x4d')],['ids','id'])||{})['spread'](function(_0x625a70){for(var _0x1c14a9=0x0;_0x1c14a9<_0x46a764[_0x2be5('0x4d')][_0x2be5('0x78')][_0x2be5('0x3c')];_0x1c14a9+=0x1){socket[_0x2be5('0x77')]('userVoiceQueue:save',{'UserId':_0x46a764[_0x2be5('0x4d')][_0x2be5('0x78')][_0x1c14a9],'VoiceQueueId':_0x46a764[_0x2be5('0x4b')]['id']});}return _0x625a70;});}})[_0x2be5('0x26')](function(_0xe16f30){_0x6234b6=_0xe16f30||[];if(_0x1dba81){return db['User'][_0x2be5('0x48')]({'where':{'id':_0x46a764[_0x2be5('0x4d')][_0x2be5('0x78')]},'attributes':['id',_0x2be5('0x2e'),_0x2be5('0x6a'),_0x2be5('0x6b'),_0x2be5('0x74')],'raw':!![]});}})[_0x2be5('0x26')](function(_0x422bd9){if(!_[_0x2be5('0x8f')](_0x422bd9)){var _0x2e756c=[];for(var _0x54a79b=0x0;_0x54a79b<_0x422bd9[_0x2be5('0x3c')];_0x54a79b++){if(_0x422bd9[_0x54a79b][_0x2be5('0x6a')]){_0x2e756c[_0x2be5('0x81')](db[_0x2be5('0x72')][_0x2be5('0x90')]({'membername':_0x422bd9[_0x54a79b]['name'],'UserId':_0x422bd9[_0x54a79b]['id'],'queue_name':_0x1dba81['name'],'VoiceQueueId':_0x1dba81['id'],'interface':_['isNil'](_0x422bd9[_0x54a79b][_0x2be5('0x74')])?util[_0x2be5('0x75')](_0x2be5('0x76'),_0x422bd9[_0x54a79b][_0x2be5('0x2e')]):_0x422bd9[_0x54a79b]['interface'],'paused':_0x422bd9[_0x54a79b][_0x2be5('0x6b')]||![],'penalty':_0x46a764['body'][_0x2be5('0x6d')]||0x0}));}}return BPromise[_0x2be5('0x87')](_0x2e756c);}})[_0x2be5('0x26')](function(){return _0x6234b6;})['then'](respondWithResult(_0x76931,null))[_0x2be5('0x49')](handleError(_0x76931,null));};exports[_0x2be5('0x8b')]=function(_0x3eeab8,_0x1a35dc,_0x331ba1){return db[_0x2be5('0x45')][_0x2be5('0x2c')]({'where':{'id':_0x3eeab8[_0x2be5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1a35dc,null))[_0x2be5('0x26')](function(_0x4774ec){if(_0x4774ec){return _0x4774ec['removeAgents'](_0x3eeab8[_0x2be5('0x3e')][_0x2be5('0x78')])[_0x2be5('0x26')](function(){if(_['isArray'](_0x3eeab8[_0x2be5('0x3e')][_0x2be5('0x78')])){for(var _0xf4a6b2=0x0;_0xf4a6b2<_0x3eeab8[_0x2be5('0x3e')][_0x2be5('0x78')][_0x2be5('0x3c')];_0xf4a6b2+=0x1){socket[_0x2be5('0x77')](_0x2be5('0x8c'),{'UserId':Number(_0x3eeab8[_0x2be5('0x3e')][_0x2be5('0x78')][_0xf4a6b2]),'VoiceQueueId':Number(_0x3eeab8[_0x2be5('0x4b')]['id'])});}}else{socket[_0x2be5('0x77')](_0x2be5('0x8c'),{'UserId':Number(_0x3eeab8['query'][_0x2be5('0x78')]),'VoiceQueueId':Number(_0x3eeab8['params']['id'])});}});}})[_0x2be5('0x26')](function(_0x1de699){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3eeab8[_0x2be5('0x4b')]['id'],'UserId':_0x3eeab8[_0x2be5('0x3e')][_0x2be5('0x78')]}})[_0x2be5('0x26')](function(){return _0x1de699;});})['then'](respondWithStatusCode(_0x1a35dc,null))[_0x2be5('0x49')](handleError(_0x1a35dc,null));};exports[_0x2be5('0x91')]=function(_0x3a133e,_0x1316ed,_0x1afabd){var _0x2f9159={};var _0xa7ea1={};var _0x4e7841;var _0x3fadf0;return db['VoiceQueue'][_0x2be5('0x5d')]({'where':{'id':_0x3a133e[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x1316ed,null))[_0x2be5('0x26')](function(_0x475888){if(_0x475888){_0x4e7841=_0x475888;_0xa7ea1[_0x2be5('0x36')]=_['keys'](db[_0x2be5('0x68')][_0x2be5('0x34')]);_0xa7ea1[_0x2be5('0x3e')]=_['keys'](_0x3a133e[_0x2be5('0x3e')]);_0xa7ea1['filters']=_[_0x2be5('0x39')](_0xa7ea1[_0x2be5('0x36')],_0xa7ea1[_0x2be5('0x3e')]);_0x2f9159[_0x2be5('0x3a')]=_[_0x2be5('0x39')](_0xa7ea1[_0x2be5('0x36')],qs['fields'](_0x3a133e[_0x2be5('0x3e')][_0x2be5('0x3b')]));_0x2f9159[_0x2be5('0x3a')]=_0x2f9159[_0x2be5('0x3a')][_0x2be5('0x3c')]?_0x2f9159['attributes']:_0xa7ea1['model'];_0x2f9159[_0x2be5('0x59')]=qs[_0x2be5('0x3f')](_0x3a133e[_0x2be5('0x3e')]['sort']);_0x2f9159[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_['pick'](_0x3a133e['query'],_0xa7ea1['filters']));if(_0x3a133e[_0x2be5('0x3e')][_0x2be5('0x42')]){_0x2f9159[_0x2be5('0x40')]=_[_0x2be5('0x43')](_0x2f9159[_0x2be5('0x40')],{'$or':_[_0x2be5('0x33')](_0x2f9159[_0x2be5('0x3a')],function(_0xccf92e){var _0x24c66f={};_0x24c66f[_0xccf92e]={'$like':'%'+_0x3a133e['query'][_0x2be5('0x42')]+'%'};return _0x24c66f;})});}_0x2f9159=_[_0x2be5('0x43')]({},_0x2f9159,_0x3a133e[_0x2be5('0x44')]);return _0x4e7841['getAgents'](_0x2f9159);}})[_0x2be5('0x26')](function(_0x26fadf){if(_0x26fadf){_0x3fadf0=_0x26fadf[_0x2be5('0x3c')];if(!_0x3a133e[_0x2be5('0x3e')][_0x2be5('0x3d')](_0x2be5('0x58'))){_0x2f9159[_0x2be5('0x22')]=qs['limit'](_0x3a133e[_0x2be5('0x3e')][_0x2be5('0x22')]);_0x2f9159[_0x2be5('0x21')]=qs['offset'](_0x3a133e[_0x2be5('0x3e')]['offset']);}return _0x4e7841[_0x2be5('0x91')](_0x2f9159);}})[_0x2be5('0x26')](function(_0x3d77c7){if(_0x3d77c7){return _0x3d77c7?{'count':_0x3fadf0,'rows':_0x3d77c7}:null;}})['then'](respondWithResult(_0x1316ed,null))[_0x2be5('0x49')](handleError(_0x1316ed,null));};exports[_0x2be5('0x92')]=function(_0x442750,_0x2d3686,_0x18ca3d){var _0x5b2a82={};var _0x42ce37={};var _0x6aa6aa;var _0x236510;return db['VoiceQueue']['findOne']({'where':{'id':_0x442750[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x2d3686,null))[_0x2be5('0x26')](function(_0x4a4821){if(_0x4a4821){_0x6aa6aa=_0x4a4821;_0x42ce37[_0x2be5('0x36')]=_[_0x2be5('0x37')](db[_0x2be5('0x72')][_0x2be5('0x34')]);_0x42ce37[_0x2be5('0x3e')]=_['keys'](_0x442750[_0x2be5('0x3e')]);_0x42ce37[_0x2be5('0x38')]=_[_0x2be5('0x39')](_0x42ce37[_0x2be5('0x36')],_0x42ce37[_0x2be5('0x3e')]);_0x5b2a82['attributes']=_[_0x2be5('0x39')](_0x42ce37[_0x2be5('0x36')],qs[_0x2be5('0x3b')](_0x442750[_0x2be5('0x3e')][_0x2be5('0x3b')]));_0x5b2a82[_0x2be5('0x3a')]=_0x5b2a82[_0x2be5('0x3a')][_0x2be5('0x3c')]?_0x5b2a82['attributes']:_0x42ce37[_0x2be5('0x36')];_0x5b2a82[_0x2be5('0x59')]=qs['sort'](_0x442750['query'][_0x2be5('0x3f')]);_0x5b2a82[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_[_0x2be5('0x41')](_0x442750[_0x2be5('0x3e')],_0x42ce37[_0x2be5('0x38')]));if(_0x442750['query'][_0x2be5('0x42')]){_0x5b2a82[_0x2be5('0x40')]=_[_0x2be5('0x43')](_0x5b2a82[_0x2be5('0x40')],{'$or':_[_0x2be5('0x33')](_0x5b2a82[_0x2be5('0x3a')],function(_0x224c33){var _0x2af815={};_0x2af815[_0x224c33]={'$like':'%'+_0x442750[_0x2be5('0x3e')][_0x2be5('0x42')]+'%'};return _0x2af815;})});}_0x5b2a82=_[_0x2be5('0x43')]({},_0x5b2a82,_0x442750['options']);return _0x6aa6aa['getMembers'](_0x5b2a82);}})['then'](function(_0x4525e3){if(_0x4525e3){_0x236510=_0x4525e3[_0x2be5('0x3c')];if(!_0x442750[_0x2be5('0x3e')][_0x2be5('0x3d')](_0x2be5('0x58'))){_0x5b2a82[_0x2be5('0x22')]=qs[_0x2be5('0x22')](_0x442750[_0x2be5('0x3e')][_0x2be5('0x22')]);_0x5b2a82['offset']=qs[_0x2be5('0x21')](_0x442750[_0x2be5('0x3e')][_0x2be5('0x21')]);}return _0x6aa6aa['getMembers'](_0x5b2a82);}})['then'](function(_0x1a2458){return _0x1a2458?{'count':_0x236510,'rows':_0x1a2458}:null;})[_0x2be5('0x26')](respondWithResult(_0x2d3686,null))[_0x2be5('0x49')](handleError(_0x2d3686,null));};exports[_0x2be5('0x93')]=function(_0x4a6179,_0x49d34f,_0x24408b){var _0x206bea={};var _0x3f0382={};var _0x55b111;var _0x59fe1e;return db[_0x2be5('0x45')][_0x2be5('0x5d')]({'where':{'id':_0x4a6179[_0x2be5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x49d34f,null))[_0x2be5('0x26')](function(_0x50dc7b){if(_0x50dc7b){_0x55b111=_0x50dc7b;_0x3f0382[_0x2be5('0x36')]=_[_0x2be5('0x37')](db['CmList'][_0x2be5('0x34')]);_0x3f0382['query']=_[_0x2be5('0x37')](_0x4a6179[_0x2be5('0x3e')]);_0x3f0382[_0x2be5('0x38')]=_['intersection'](_0x3f0382[_0x2be5('0x36')],_0x3f0382[_0x2be5('0x3e')]);_0x206bea[_0x2be5('0x3a')]=_['intersection'](_0x3f0382['model'],qs['fields'](_0x4a6179['query'][_0x2be5('0x3b')]));_0x206bea[_0x2be5('0x3a')]=_0x206bea['attributes'][_0x2be5('0x3c')]?_0x206bea[_0x2be5('0x3a')]:_0x3f0382[_0x2be5('0x36')];_0x206bea['order']=qs['sort'](_0x4a6179[_0x2be5('0x3e')]['sort']);_0x206bea[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_[_0x2be5('0x41')](_0x4a6179['query'],_0x3f0382['filters']));if(_0x4a6179['query'][_0x2be5('0x42')]){_0x206bea[_0x2be5('0x40')]=_[_0x2be5('0x43')](_0x206bea[_0x2be5('0x40')],{'$or':_[_0x2be5('0x33')](_0x206bea[_0x2be5('0x3a')],function(_0x56259d){var _0x4615dd={};_0x4615dd[_0x56259d]={'$like':'%'+_0x4a6179['query'][_0x2be5('0x42')]+'%'};return _0x4615dd;})});}_0x206bea=_[_0x2be5('0x43')]({},_0x206bea,_0x4a6179[_0x2be5('0x44')]);return _0x55b111[_0x2be5('0x93')](_0x206bea);}})[_0x2be5('0x26')](function(_0x3af052){if(_0x3af052){_0x59fe1e=_0x3af052['length'];if(!_0x4a6179[_0x2be5('0x3e')][_0x2be5('0x3d')](_0x2be5('0x58'))){_0x206bea['limit']=qs[_0x2be5('0x22')](_0x4a6179[_0x2be5('0x3e')][_0x2be5('0x22')]);_0x206bea[_0x2be5('0x21')]=qs['offset'](_0x4a6179[_0x2be5('0x3e')][_0x2be5('0x21')]);}return _0x55b111[_0x2be5('0x93')](_0x206bea);}})[_0x2be5('0x26')](function(_0x5c4466){if(_0x5c4466){return _0x5c4466?{'count':_0x59fe1e,'rows':_0x5c4466}:null;}})[_0x2be5('0x26')](respondWithResult(_0x49d34f,null))[_0x2be5('0x49')](handleError(_0x49d34f,null));};exports[_0x2be5('0x94')]=function(_0x1cc112,_0x5686e4,_0x3b33b7){var _0x4497d8,_0x2ea761;return db[_0x2be5('0x45')][_0x2be5('0x2c')]({'where':{'id':_0x1cc112[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x5686e4,null))[_0x2be5('0x26')](function(_0x5177be){if(_0x5177be){_0x2ea761=_0x5177be;return _0x5177be[_0x2be5('0x94')](_0x1cc112['body']['ids'],_[_0x2be5('0x8e')](_0x1cc112['body'],['ids','id'])||{});}return null;})['spread'](function(_0x48476e){var _0x21a9eb;_0x4497d8=_0x48476e||[];var _0x4dc64d=[];if(_0x48476e){for(var _0x568aa2=0x0;_0x568aa2<_0x48476e[_0x2be5('0x3c')];_0x568aa2+=0x1){var _0xf330f5=_0x48476e[_0x568aa2][_0x2be5('0x28')]({'plain':!![]});_0x2ea761[_0x2be5('0x95')]=_0x1cc112['body'][_0x2be5('0x95')]?_0x1cc112['body'][_0x2be5('0x95')]:_0x2ea761[_0x2be5('0x95')];switch(_0x2ea761['dialCheckDuplicateType']){case _0x2be5('0x96'):_0x21a9eb=squel['insert']()[_0x2be5('0x97')](_0x2be5('0x98'))[_0x2be5('0x99')](['phone','scheduledAt',_0x2be5('0x9a'),_0x2be5('0x9b'),_0x2be5('0x5a'),_0x2be5('0x56'),_0x2be5('0x9c')],squel[_0x2be5('0x79')]()[_0x2be5('0x7a')](_0x2be5('0x9d'),_0x2be5('0x9d'))[_0x2be5('0x7a')](_0x2be5('0x9e'),_0x2be5('0x9f'))['field']('id',_0x2be5('0x9a'))[_0x2be5('0x7a')](_0xf330f5[_0x2be5('0xa0')][_0x2be5('0xa1')](),_0x2be5('0x9b'))[_0x2be5('0x7a')](_0x1cc112[_0x2be5('0x4b')]['id'][_0x2be5('0xa1')](),'VoiceQueueId')[_0x2be5('0x7a')](_0x2be5('0x9e'),_0x2be5('0x56'))[_0x2be5('0x7a')](_0x2be5('0x9e'),_0x2be5('0x9c'))[_0x2be5('0xa2')]('cm_contacts')['where'](_0x2be5('0xa3'))[_0x2be5('0x40')](_0x2be5('0xa4'),_0xf330f5[_0x2be5('0xa0')]['toString']())[_0x2be5('0x40')](_0x2be5('0xa5'))[_0x2be5('0x40')](_0x2be5('0xa6'),squel[_0x2be5('0x79')]()['field'](_0x2be5('0xa7'))['from'](_0x2be5('0xa8'))[_0x2be5('0x40')]('VoiceQueueId\x20=\x20?',_0x1cc112[_0x2be5('0x4b')]['id'][_0x2be5('0xa1')]()))[_0x2be5('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2be5('0x79')]()[_0x2be5('0x7a')](_0x2be5('0xa9'))[_0x2be5('0xa2')](_0x2be5('0x98'))[_0x2be5('0x40')](_0x2be5('0x7e'),_0x1cc112[_0x2be5('0x4b')]['id'][_0x2be5('0xa1')]())))[_0x2be5('0xa1')]();break;case _0x2be5('0xaa'):_0x21a9eb=squel[_0x2be5('0xab')]()[_0x2be5('0x97')]('cm_hopper')['fromQuery']([_0x2be5('0x9d'),_0x2be5('0x9f'),_0x2be5('0x9a'),'ListId',_0x2be5('0x5a'),'createdAt',_0x2be5('0x9c')],squel['select']()[_0x2be5('0x7a')](_0x2be5('0x9d'),_0x2be5('0x9d'))[_0x2be5('0x7a')](_0x2be5('0x9e'),_0x2be5('0x9f'))['field']('id',_0x2be5('0x9a'))[_0x2be5('0x7a')](_0xf330f5[_0x2be5('0xa0')][_0x2be5('0xa1')](),_0x2be5('0x9b'))['field'](_0x1cc112[_0x2be5('0x4b')]['id'][_0x2be5('0xa1')](),_0x2be5('0x5a'))[_0x2be5('0x7a')](_0x2be5('0x9e'),_0x2be5('0x56'))[_0x2be5('0x7a')](_0x2be5('0x9e'),'updatedAt')[_0x2be5('0xa2')](_0x2be5('0xac'))[_0x2be5('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0xf330f5[_0x2be5('0xa0')][_0x2be5('0xa1')]())[_0x2be5('0x40')](_0x2be5('0xa5'))[_0x2be5('0x40')](_0x2be5('0xa6'),squel[_0x2be5('0x79')]()[_0x2be5('0x7a')]('COALESCE(phone,\x27\x27)')[_0x2be5('0xa2')](_0x2be5('0x98'))[_0x2be5('0x40')](_0x2be5('0x7e'),_0x1cc112['params']['id'][_0x2be5('0xa1')]())))['toString']();break;default:_0x21a9eb=squel['insert']()[_0x2be5('0x97')]('cm_hopper')[_0x2be5('0x99')]([_0x2be5('0x9d'),_0x2be5('0x9f'),_0x2be5('0x9a'),_0x2be5('0x9b'),'VoiceQueueId',_0x2be5('0x56'),_0x2be5('0x9c')],squel[_0x2be5('0x79')]()[_0x2be5('0x7a')]('phone',_0x2be5('0x9d'))[_0x2be5('0x7a')](_0x2be5('0x9e'),'scheduledAt')[_0x2be5('0x7a')]('id','ContactId')[_0x2be5('0x7a')](_0xf330f5['CmListId'][_0x2be5('0xa1')](),_0x2be5('0x9b'))[_0x2be5('0x7a')](_0x1cc112[_0x2be5('0x4b')]['id'][_0x2be5('0xa1')](),'VoiceQueueId')[_0x2be5('0x7a')](_0x2be5('0x9e'),_0x2be5('0x56'))['field'](_0x2be5('0x9e'),_0x2be5('0x9c'))['from'](_0x2be5('0xac'))[_0x2be5('0x40')](_0x2be5('0xa3'))[_0x2be5('0x40')](_0x2be5('0xa4'),_0xf330f5[_0x2be5('0xa0')][_0x2be5('0xa1')]())[_0x2be5('0x40')](_0x2be5('0xa5')))[_0x2be5('0xa1')]();}_0x4dc64d['push'](db[_0x2be5('0x82')][_0x2be5('0x3e')](_0x21a9eb));}return BPromise[_0x2be5('0x87')](_0x4dc64d);}})[_0x2be5('0x26')](function(){return _0x4497d8;})[_0x2be5('0x26')](respondWithResult(_0x5686e4,null))['catch'](handleError(_0x5686e4,null));};exports[_0x2be5('0xad')]=function(_0x247fe8,_0x546174,_0x4e7c86){return db[_0x2be5('0x45')][_0x2be5('0x2c')]({'where':{'id':_0x247fe8[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x546174,null))[_0x2be5('0x26')](function(_0x1d2223){if(_0x1d2223){return _0x1d2223[_0x2be5('0xad')](_0x247fe8[_0x2be5('0x3e')][_0x2be5('0x78')]);}})[_0x2be5('0x26')](function(_0x559d04){if(_0x559d04){return db[_0x2be5('0x5b')][_0x2be5('0x27')]({'where':{'ListId':_0x247fe8[_0x2be5('0x3e')][_0x2be5('0x78')],'VoiceQueueId':_0x247fe8['params']['id']}})['then'](function(){return _0x559d04;});}})[_0x2be5('0x26')](respondWithStatusCode(_0x546174,null))[_0x2be5('0x49')](handleError(_0x546174,null));};exports[_0x2be5('0xae')]=function(_0x3242f2,_0x523c35,_0x6712cb){var _0x4366a8={};var _0x53f63f={};var _0x2efb0a;var _0x597bf4;return db[_0x2be5('0x45')][_0x2be5('0x5d')]({'where':{'id':_0x3242f2[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x523c35,null))[_0x2be5('0x26')](function(_0x49320e){if(_0x49320e){_0x2efb0a=_0x49320e;_0x53f63f[_0x2be5('0x36')]=_[_0x2be5('0x37')](db[_0x2be5('0xaf')]['rawAttributes']);_0x53f63f['query']=_[_0x2be5('0x37')](_0x3242f2['query']);_0x53f63f[_0x2be5('0x38')]=_['intersection'](_0x53f63f[_0x2be5('0x36')],_0x53f63f[_0x2be5('0x3e')]);_0x4366a8['attributes']=_[_0x2be5('0x39')](_0x53f63f[_0x2be5('0x36')],qs['fields'](_0x3242f2['query'][_0x2be5('0x3b')]));_0x4366a8[_0x2be5('0x3a')]=_0x4366a8[_0x2be5('0x3a')][_0x2be5('0x3c')]?_0x4366a8[_0x2be5('0x3a')]:_0x53f63f['model'];_0x4366a8[_0x2be5('0x59')]=qs['sort'](_0x3242f2['query']['sort']);_0x4366a8[_0x2be5('0x40')]=qs[_0x2be5('0x38')](_['pick'](_0x3242f2[_0x2be5('0x3e')],_0x53f63f[_0x2be5('0x38')]));if(_0x3242f2[_0x2be5('0x3e')][_0x2be5('0x42')]){_0x4366a8[_0x2be5('0x40')]=_[_0x2be5('0x43')](_0x4366a8['where'],{'$or':_[_0x2be5('0x33')](_0x4366a8[_0x2be5('0x3a')],function(_0x71abb5){var _0x328117={};_0x328117[_0x71abb5]={'$like':'%'+_0x3242f2[_0x2be5('0x3e')][_0x2be5('0x42')]+'%'};return _0x328117;})});}_0x4366a8=_[_0x2be5('0x43')]({},_0x4366a8,_0x3242f2[_0x2be5('0x44')]);return _0x2efb0a[_0x2be5('0xae')](_0x4366a8);}})[_0x2be5('0x26')](function(_0x519c40){if(_0x519c40){_0x597bf4=_0x519c40['length'];if(!_0x3242f2[_0x2be5('0x3e')][_0x2be5('0x3d')](_0x2be5('0x58'))){_0x4366a8['limit']=qs[_0x2be5('0x22')](_0x3242f2[_0x2be5('0x3e')][_0x2be5('0x22')]);_0x4366a8[_0x2be5('0x21')]=qs[_0x2be5('0x21')](_0x3242f2[_0x2be5('0x3e')][_0x2be5('0x21')]);}return _0x2efb0a[_0x2be5('0xae')](_0x4366a8);}})[_0x2be5('0x26')](function(_0xcb80a9){if(_0xcb80a9){return _0xcb80a9?{'count':_0x597bf4,'rows':_0xcb80a9}:null;}})[_0x2be5('0x26')](respondWithResult(_0x523c35,null))[_0x2be5('0x49')](handleError(_0x523c35,null));};exports[_0x2be5('0xb0')]=function(_0x13217d,_0x20137d,_0x4c1232){var _0x5b3428,_0x4b4980;return db[_0x2be5('0x45')][_0x2be5('0x2c')]({'where':{'id':_0x13217d[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](handleEntityNotFound(_0x20137d,null))[_0x2be5('0x26')](function(_0x4e5a0f){if(_0x4e5a0f){_0x4b4980=_0x4e5a0f;return _0x4e5a0f[_0x2be5('0xb0')](_0x13217d[_0x2be5('0x4d')][_0x2be5('0x78')],_[_0x2be5('0x8e')](_0x13217d[_0x2be5('0x4d')],[_0x2be5('0x78'),'id'])||{});}return null;})[_0x2be5('0xb1')](function(_0x50a13e){var _0x596868;_0x5b3428=_0x50a13e||[];var _0x14bcf9=[];if(_0x50a13e){for(var _0x4f60c5=0x0;_0x4f60c5<_0x50a13e[_0x2be5('0x3c')];_0x4f60c5+=0x1){var _0x30b4bb=_0x50a13e[_0x4f60c5][_0x2be5('0x28')]({'plain':!![]});_0x596868=squel[_0x2be5('0xab')]()[_0x2be5('0x97')]('cm_hopper_black')[_0x2be5('0x99')]([_0x2be5('0x9d'),_0x2be5('0x9a'),'ListId',_0x2be5('0x5a'),_0x2be5('0x56'),'updatedAt'],squel['select']()['field']('phone',_0x2be5('0x9d'))[_0x2be5('0x7a')]('id','ContactId')[_0x2be5('0x7a')](_0x30b4bb['CmListId'][_0x2be5('0xa1')](),_0x2be5('0x9b'))['field'](_0x13217d[_0x2be5('0x4b')]['id'][_0x2be5('0xa1')](),_0x2be5('0x5a'))[_0x2be5('0x7a')](_0x2be5('0x9e'),'createdAt')[_0x2be5('0x7a')](_0x2be5('0x9e'),_0x2be5('0x9c'))[_0x2be5('0xa2')](_0x2be5('0xac'))[_0x2be5('0x40')](_0x2be5('0xa3'))[_0x2be5('0x40')](_0x2be5('0xa4'),_0x30b4bb[_0x2be5('0xa0')][_0x2be5('0xa1')]())[_0x2be5('0x40')](_0x2be5('0xa5')))[_0x2be5('0xa1')]();_0x14bcf9['push'](db[_0x2be5('0x82')][_0x2be5('0x3e')](_0x596868));}return BPromise[_0x2be5('0x87')](_0x14bcf9);}})['then'](function(){return _0x5b3428;})[_0x2be5('0x26')](respondWithResult(_0x20137d,null))['catch'](handleError(_0x20137d,null));};exports[_0x2be5('0xb2')]=function(_0x43dff6,_0x304d4f,_0x147fb4){return db[_0x2be5('0x45')][_0x2be5('0x2c')]({'where':{'id':_0x43dff6[_0x2be5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x304d4f,null))['then'](function(_0x437cc7){if(_0x437cc7){return _0x437cc7[_0x2be5('0xb2')](_0x43dff6[_0x2be5('0x3e')][_0x2be5('0x78')]);}})['then'](function(_0x82aa35){if(_0x82aa35){return db['CmHopperBlack'][_0x2be5('0x27')]({'where':{'ListId':_0x43dff6[_0x2be5('0x3e')][_0x2be5('0x78')],'VoiceQueueId':_0x43dff6[_0x2be5('0x4b')]['id']}})[_0x2be5('0x26')](function(){return _0x82aa35;});}})['then'](respondWithStatusCode(_0x304d4f,null))[_0x2be5('0x49')](handleError(_0x304d4f,null));}; \ No newline at end of file +var _0x636f=['from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','all','union','transaction','isEmpty','addAgents','spread','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','phone','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','scheduledAt','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','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','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','outbound','filter','map','value','includes','type','find','name','UserProfileResource','error','stack','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','VoiceQueue','keys','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','findOne','CmHopper','hasOwnProperty','getHopperHistories','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','addTeams','each','findOrCreate','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','select','field','tq.TeamId'];(function(_0x606fe8,_0x10b084){var _0x28b517=function(_0x5e90f4){while(--_0x5e90f4){_0x606fe8['push'](_0x606fe8['shift']());}};_0x28b517(++_0x10b084);}(_0x636f,0xe3));var _0xf636=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x636f[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xf636('0x0'));var emlformat=require(_0xf636('0x1'));var rimraf=require(_0xf636('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf636('0x3'));var rp=require('request-promise');var moment=require(_0xf636('0x4'));var BPromise=require(_0xf636('0x5'));var Mustache=require(_0xf636('0x6'));var util=require(_0xf636('0x7'));var path=require(_0xf636('0x8'));var sox=require(_0xf636('0x9'));var csv=require(_0xf636('0xa'));var ejs=require(_0xf636('0xb'));var fs=require('fs');var _=require(_0xf636('0xc'));var squel=require(_0xf636('0xd'));var crypto=require('crypto');var jsforce=require(_0xf636('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf636('0xf'));var Papa=require(_0xf636('0x10'));var Redis=require(_0xf636('0x11'));var authService=require(_0xf636('0x12'));var qs=require(_0xf636('0x13'));var as=require(_0xf636('0x14'));var hardwareService=require(_0xf636('0x15'));var logger=require(_0xf636('0x16'))(_0xf636('0x17'));var utils=require(_0xf636('0x18'));var config=require(_0xf636('0x19'));var db=require(_0xf636('0x1a'))['db'];config['redis']=_[_0xf636('0x1b')](config['redis'],{'host':_0xf636('0x1c'),'port':0x18eb});var socket=require(_0xf636('0x1d'))(new Redis(config[_0xf636('0x1e')]));require(_0xf636('0x1f'))[_0xf636('0x20')](socket);function respondWithStatusCode(_0x5e79d7,_0x3eb832){_0x3eb832=_0x3eb832||0xcc;return function(_0x5854c6){if(_0x5854c6){return _0x5e79d7[_0xf636('0x21')](_0x3eb832);}return _0x5e79d7['status'](_0x3eb832)[_0xf636('0x22')]();};}function respondWithResult(_0x4f5e3d,_0x4e785f){_0x4e785f=_0x4e785f||0xc8;return function(_0x5a4a88){if(_0x5a4a88){return _0x4f5e3d[_0xf636('0x23')](_0x4e785f)[_0xf636('0x24')](_0x5a4a88);}};}function respondWithFilteredResult(_0x433560,_0x12ef9a){return function(_0x53ee13){if(_0x53ee13){var _0x2735c5=_0x53ee13[_0xf636('0x25')],_0x357eae=_0x12ef9a[_0xf636('0x26')],_0xd9e98b=_0x12ef9a[_0xf636('0x26')]+_0x12ef9a[_0xf636('0x27')],_0x2e5620;if(_0xd9e98b>=_0x2735c5){_0xd9e98b=_0x2735c5;_0x2e5620=0xc8;}else{_0x2e5620=0xce;}_0x433560[_0xf636('0x23')](_0x2e5620);return _0x433560[_0xf636('0x28')](_0xf636('0x29'),_0x357eae+'-'+_0xd9e98b+'/'+_0x2735c5)[_0xf636('0x24')](_0x53ee13);}return null;};}function patchUpdates(_0x2a0761){return function(_0x1ead02){try{jsonpatch[_0xf636('0x2a')](_0x1ead02,_0x2a0761,!![]);}catch(_0x55235e){return BPromise['reject'](_0x55235e);}return _0x1ead02[_0xf636('0x2b')]();};}function saveUpdates(_0x414beb,_0x474ba8){return function(_0x6158dd){if(_0x6158dd){return _0x6158dd[_0xf636('0x2c')](_0x414beb)[_0xf636('0x2d')](function(_0x8ac956){return _0x8ac956;});}return null;};}function removeEntity(_0x26772e,_0x24a13d){return function(_0x5a2a4e){if(_0x5a2a4e){return _0x5a2a4e[_0xf636('0x2e')]()[_0xf636('0x2d')](function(){var _0x2d13e9=_0x5a2a4e[_0xf636('0x2f')]({'plain':!![]});var _0x2e2a90=[{'name':_0xf636('0x30'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0xf636('0x31'),'ignore':![]}];var _0x13aa5f=_(_0x2e2a90)[_0xf636('0x32')]('ignore')[_0xf636('0x33')]('value')[_0xf636('0x34')]();if(_[_0xf636('0x35')](_0x13aa5f,_0x2d13e9[_0xf636('0x36')])){return;}var _0x586441=_[_0xf636('0x37')](_0x2e2a90,[_0xf636('0x34'),_0x2d13e9['type']])[_0xf636('0x38')];return db[_0xf636('0x39')]['destroy']({'where':{'type':_0x586441,'resourceId':_0x2d13e9['id']}})[_0xf636('0x2d')](function(){return _0x5a2a4e;});})[_0xf636('0x2d')](function(){_0x26772e[_0xf636('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25abb6,_0x5d6fbd){return function(_0x4f147c){if(!_0x4f147c){_0x25abb6['sendStatus'](0x194);}return _0x4f147c;};}function handleError(_0x4526e1,_0x3994dc){_0x3994dc=_0x3994dc||0x1f4;return function(_0x1df696){logger[_0xf636('0x3a')](_0x1df696[_0xf636('0x3b')]);if(_0x1df696[_0xf636('0x38')]){delete _0x1df696[_0xf636('0x38')];}_0x4526e1[_0xf636('0x23')](_0x3994dc)['send'](_0x1df696);};}exports['index']=function(_0x21bb6b,_0xf3ce0b){var _0x474430={},_0x29bcce={},_0x239f4d={'count':0x0,'rows':[]};var _0x5ecc69=_[_0xf636('0x33')](db['VoiceQueue'][_0xf636('0x3c')],function(_0x3d1641){return{'name':_0x3d1641[_0xf636('0x3d')],'type':_0x3d1641['type'][_0xf636('0x3e')]};});_0x29bcce[_0xf636('0x3f')]=_['map'](_0x5ecc69,_0xf636('0x38'));_0x29bcce['query']=_['keys'](_0x21bb6b[_0xf636('0x40')]);_0x29bcce['filters']=_[_0xf636('0x41')](_0x29bcce['model'],_0x29bcce[_0xf636('0x40')]);_0x474430[_0xf636('0x42')]=_[_0xf636('0x41')](_0x29bcce['model'],qs[_0xf636('0x43')](_0x21bb6b[_0xf636('0x40')]['fields']));_0x474430[_0xf636('0x42')]=_0x474430[_0xf636('0x42')][_0xf636('0x44')]?_0x474430[_0xf636('0x42')]:_0x29bcce[_0xf636('0x3f')];if(!_0x21bb6b['query']['hasOwnProperty'](_0xf636('0x45'))){_0x474430[_0xf636('0x27')]=qs[_0xf636('0x27')](_0x21bb6b['query'][_0xf636('0x27')]);_0x474430[_0xf636('0x26')]=qs[_0xf636('0x26')](_0x21bb6b[_0xf636('0x40')]['offset']);}_0x474430[_0xf636('0x46')]=qs[_0xf636('0x47')](_0x21bb6b['query'][_0xf636('0x47')]);_0x474430[_0xf636('0x48')]=qs[_0xf636('0x49')](_[_0xf636('0x4a')](_0x21bb6b[_0xf636('0x40')],_0x29bcce[_0xf636('0x49')]),_0x5ecc69);if(_0x21bb6b['query'][_0xf636('0x32')]){_0x474430[_0xf636('0x48')]=_['merge'](_0x474430['where'],{'$or':_['map'](_0x5ecc69,function(_0x2d0188){if(_0x2d0188[_0xf636('0x36')]!==_0xf636('0x4b')){var _0x145db8={};_0x145db8[_0x2d0188['name']]={'$like':'%'+_0x21bb6b['query'][_0xf636('0x32')]+'%'};return _0x145db8;}})});}_0x474430=_[_0xf636('0x4c')]({},_0x474430,_0x21bb6b['options']);var _0x54250b={'where':_0x474430[_0xf636('0x48')]};return db['VoiceQueue'][_0xf636('0x25')](_0x54250b)[_0xf636('0x2d')](function(_0x2159ba){_0x239f4d[_0xf636('0x25')]=_0x2159ba;if(_0x21bb6b[_0xf636('0x40')][_0xf636('0x4d')]){_0x474430[_0xf636('0x4e')]=[{'all':!![]}];}return db['VoiceQueue'][_0xf636('0x4f')](_0x474430);})['then'](function(_0x259b5f){_0x239f4d[_0xf636('0x50')]=_0x259b5f;return _0x239f4d;})[_0xf636('0x2d')](respondWithFilteredResult(_0xf3ce0b,_0x474430))[_0xf636('0x51')](handleError(_0xf3ce0b,null));};exports[_0xf636('0x52')]=function(_0x4f30fd,_0x3ca8a6){var _0x5eb6a9={'raw':![],'where':{'id':_0x4f30fd[_0xf636('0x53')]['id']}},_0x4a10cb={};_0x4a10cb[_0xf636('0x3f')]=_['keys'](db[_0xf636('0x54')]['rawAttributes']);_0x4a10cb[_0xf636('0x40')]=_[_0xf636('0x55')](_0x4f30fd[_0xf636('0x40')]);_0x4a10cb[_0xf636('0x49')]=_[_0xf636('0x41')](_0x4a10cb[_0xf636('0x3f')],_0x4a10cb['query']);_0x5eb6a9[_0xf636('0x42')]=_[_0xf636('0x41')](_0x4a10cb[_0xf636('0x3f')],qs[_0xf636('0x43')](_0x4f30fd[_0xf636('0x40')]['fields']));_0x5eb6a9[_0xf636('0x42')]=_0x5eb6a9[_0xf636('0x42')]['length']?_0x5eb6a9[_0xf636('0x42')]:_0x4a10cb[_0xf636('0x3f')];if(_0x4f30fd[_0xf636('0x40')][_0xf636('0x4d')]){_0x5eb6a9[_0xf636('0x4e')]=[{'all':!![]}];}_0x5eb6a9=_['merge']({},_0x5eb6a9,_0x4f30fd[_0xf636('0x56')]);return db['VoiceQueue']['find'](_0x5eb6a9)[_0xf636('0x2d')](handleEntityNotFound(_0x3ca8a6,null))[_0xf636('0x2d')](respondWithResult(_0x3ca8a6,null))['catch'](handleError(_0x3ca8a6,null));};exports['create']=function(_0x4d0195,_0x5d38e6){return db['VoiceQueue']['create'](_0x4d0195[_0xf636('0x57')],{})[_0xf636('0x2d')](function(_0x47fa2d){var _0x4c8244=_0x4d0195[_0xf636('0x58')]['get']({'plain':!![]});if(!_0x4c8244)throw new Error(_0xf636('0x59'));if(_0x4c8244['role']==='user'){var _0x2d5c06=_0x47fa2d[_0xf636('0x2f')]({'plain':!![]});var _0x4211f0=[{'name':_0xf636('0x30'),'value':_0xf636('0x5a')},{'name':_0xf636('0x5b'),'value':_0xf636('0x31')}];var _0x37cf86=_[_0xf636('0x37')](_0x4211f0,['value',_0x2d5c06['type']])['name'];return db[_0xf636('0x5c')][_0xf636('0x37')]({'where':{'name':_0x37cf86,'userProfileId':_0x4c8244[_0xf636('0x5d')]},'raw':!![]})['then'](function(_0x3c0314){if(_0x3c0314&&_0x3c0314[_0xf636('0x5e')]===0x0){return db[_0xf636('0x39')][_0xf636('0x5f')]({'name':_0x2d5c06['name'],'resourceId':_0x2d5c06['id'],'type':_0x3c0314[_0xf636('0x38')],'sectionId':_0x3c0314['id']},{})[_0xf636('0x2d')](function(){return _0x47fa2d;});}else{return _0x47fa2d;}})[_0xf636('0x51')](function(_0x288f92){logger[_0xf636('0x3a')](_0xf636('0x60'),_0x288f92);throw _0x288f92;});}return _0x47fa2d;})[_0xf636('0x2d')](respondWithResult(_0x5d38e6,0xc9))[_0xf636('0x51')](handleError(_0x5d38e6,null));};exports[_0xf636('0x61')]=function(_0x36593d,_0x1cf130){var _0x58e5fc={'where':{'id':_0x36593d[_0xf636('0x53')]['id']}},_0x5e4f11={};_0x5e4f11[_0xf636('0x3f')]=_[_0xf636('0x55')](db[_0xf636('0x54')][_0xf636('0x3c')]);_0x58e5fc['attributes']=_['intersection'](_0x5e4f11[_0xf636('0x3f')],qs['fields'](_0x36593d[_0xf636('0x40')]['fields']));_0x58e5fc[_0xf636('0x42')]=_0x58e5fc[_0xf636('0x42')][_0xf636('0x44')]?_0x58e5fc[_0xf636('0x42')]:_0x5e4f11['model'];if(_0x36593d[_0xf636('0x40')]['includeAll']){_0x58e5fc[_0xf636('0x4e')]=[{'all':!![]}];}_0x58e5fc=_['merge']({},_0x58e5fc,_0x36593d[_0xf636('0x56')]);return db[_0xf636('0x54')]['find'](_0x58e5fc)[_0xf636('0x2d')](handleEntityNotFound(_0x1cf130,null))[_0xf636('0x2d')](function(_0x3b7af3){if(_0x3b7af3){var _0x30bffd=_0x3b7af3[_0xf636('0x2f')]({'plain':!![]});_0x30bffd=qs[_0xf636('0x62')](_0x30bffd,['id',_0xf636('0x63'),_0xf636('0x64')]);_0x36593d[_0xf636('0x57')]=_[_0xf636('0x62')](_0x36593d[_0xf636('0x57')],['id','createdAt',_0xf636('0x64')]);return db[_0xf636('0x54')]['create'](_[_0xf636('0x4c')](_0x30bffd,_0x36593d[_0xf636('0x57')]),{'include':_0x36593d['query'][_0xf636('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x24c2b5){var _0x969f44=_0x36593d[_0xf636('0x58')][_0xf636('0x2f')]({'plain':!![]});if(!_0x969f44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x969f44[_0xf636('0x65')]===_0xf636('0x58')){var _0x10c284=_0x24c2b5[_0xf636('0x2f')]({'plain':!![]});var _0x32951e=[{'name':_0xf636('0x30'),'value':_0xf636('0x5a')},{'name':_0xf636('0x5b'),'value':_0xf636('0x31')}];var _0x565c3b=_[_0xf636('0x37')](_0x32951e,[_0xf636('0x34'),_0x10c284[_0xf636('0x36')]])[_0xf636('0x38')];return db[_0xf636('0x5c')][_0xf636('0x37')]({'where':{'name':_0x565c3b,'userProfileId':_0x969f44[_0xf636('0x5d')]},'raw':!![]})['then'](function(_0x44d37d){if(_0x44d37d&&_0x44d37d[_0xf636('0x5e')]===0x0){return db[_0xf636('0x39')][_0xf636('0x5f')]({'name':_0x10c284['name'],'resourceId':_0x10c284['id'],'type':_0x44d37d['name'],'sectionId':_0x44d37d['id']},{})['then'](function(){return _0x24c2b5;});}else{return _0x24c2b5;}})[_0xf636('0x51')](function(_0x5e7e45){logger[_0xf636('0x3a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e7e45);throw _0x5e7e45;});}return _0x24c2b5;});}})['then'](respondWithResult(_0x1cf130,0xc9))[_0xf636('0x51')](handleError(_0x1cf130,null));};exports[_0xf636('0x2c')]=function(_0x2ecc08,_0x2e4b59){if(_0x2ecc08[_0xf636('0x57')]['id']){delete _0x2ecc08[_0xf636('0x57')]['id'];}return db[_0xf636('0x54')]['find']({'where':{'id':_0x2ecc08[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x2e4b59,null))['then'](saveUpdates(_0x2ecc08[_0xf636('0x57')],null))[_0xf636('0x2d')](respondWithResult(_0x2e4b59,null))[_0xf636('0x51')](handleError(_0x2e4b59,null));};exports[_0xf636('0x2e')]=function(_0x39ab44,_0x3cf15f){return db[_0xf636('0x54')]['find']({'where':{'id':_0x39ab44['params']['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x3cf15f,null))['then'](removeEntity(_0x3cf15f,null))[_0xf636('0x51')](handleError(_0x3cf15f,null));};exports[_0xf636('0x66')]=function(_0x233ee9,_0x4599d3,_0x47c11f){var _0x5802eb={'raw':![],'where':{}};var _0x2ea453={};var _0x426fba={'count':0x0,'rows':[]};return db[_0xf636('0x54')][_0xf636('0x67')]({'where':{'id':_0x233ee9['params']['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x4599d3,null))[_0xf636('0x2d')](function(_0x258b44){if(_0x258b44){_0x2ea453[_0xf636('0x3f')]=_[_0xf636('0x55')](db[_0xf636('0x68')][_0xf636('0x3c')]);_0x2ea453[_0xf636('0x40')]=_[_0xf636('0x55')](_0x233ee9[_0xf636('0x40')]);_0x2ea453[_0xf636('0x49')]=_[_0xf636('0x41')](_0x2ea453['model'],_0x2ea453[_0xf636('0x40')]);_0x5802eb[_0xf636('0x42')]=_[_0xf636('0x41')](_0x2ea453[_0xf636('0x3f')],qs[_0xf636('0x43')](_0x233ee9['query'][_0xf636('0x43')]));_0x5802eb[_0xf636('0x42')]=_0x5802eb[_0xf636('0x42')][_0xf636('0x44')]?_0x5802eb[_0xf636('0x42')]:_0x2ea453['model'];if(!_0x233ee9[_0xf636('0x40')][_0xf636('0x69')](_0xf636('0x45'))){_0x5802eb['limit']=qs[_0xf636('0x27')](_0x233ee9[_0xf636('0x40')][_0xf636('0x27')]);_0x5802eb[_0xf636('0x26')]=qs['offset'](_0x233ee9[_0xf636('0x40')][_0xf636('0x26')]);}_0x5802eb['order']=qs[_0xf636('0x47')](_0x233ee9[_0xf636('0x40')][_0xf636('0x47')]);_0x5802eb[_0xf636('0x48')]=qs['filters'](_[_0xf636('0x4a')](_0x233ee9['query'],_0x2ea453[_0xf636('0x49')]));_0x5802eb[_0xf636('0x48')]['VoiceQueueId']=_0x258b44['id'];if(_0x233ee9['query'][_0xf636('0x32')]){_0x5802eb[_0xf636('0x48')]=_[_0xf636('0x4c')](_0x5802eb[_0xf636('0x48')],{'$or':_['map'](_0x5802eb['attributes'],function(_0x548fea){var _0x1f7d98={};_0x1f7d98[_0x548fea]={'$like':'%'+_0x233ee9['query'][_0xf636('0x32')]+'%'};return _0x1f7d98;})});}_0x5802eb=_[_0xf636('0x4c')]({},_0x5802eb,_0x233ee9[_0xf636('0x56')]);return db['CmHopper'][_0xf636('0x25')]({'where':_0x5802eb[_0xf636('0x48')]})[_0xf636('0x2d')](function(_0x1334d0){_0x426fba['count']=_0x1334d0;if(_0x233ee9[_0xf636('0x40')][_0xf636('0x4d')]){_0x5802eb['include']=[{'all':!![]}];}return db[_0xf636('0x68')]['findAll'](_0x5802eb);})['then'](function(_0x521e9f){_0x426fba[_0xf636('0x50')]=_0x521e9f;return _0x426fba;});}})[_0xf636('0x2d')](respondWithFilteredResult(_0x4599d3,_0x5802eb))['catch'](handleError(_0x4599d3,null));};exports[_0xf636('0x6a')]=function(_0x57b1a9,_0x9b4bd5,_0x1c381b){var _0x172d0f={'raw':!![],'where':{}};var _0x10925a={};var _0x29fbd0={'count':0x0,'rows':[]};return db[_0xf636('0x54')][_0xf636('0x67')]({'where':{'id':_0x57b1a9[_0xf636('0x53')]['id']}})['then'](handleEntityNotFound(_0x9b4bd5,null))[_0xf636('0x2d')](function(_0x463e55){if(_0x463e55){_0x10925a[_0xf636('0x3f')]=_['keys'](db['CmHopperHistory'][_0xf636('0x3c')]);_0x10925a[_0xf636('0x40')]=_[_0xf636('0x55')](_0x57b1a9[_0xf636('0x40')]);_0x10925a[_0xf636('0x49')]=_[_0xf636('0x41')](_0x10925a[_0xf636('0x3f')],_0x10925a[_0xf636('0x40')]);_0x172d0f[_0xf636('0x42')]=_[_0xf636('0x41')](_0x10925a['model'],qs[_0xf636('0x43')](_0x57b1a9[_0xf636('0x40')]['fields']));_0x172d0f['attributes']=_0x172d0f['attributes'][_0xf636('0x44')]?_0x172d0f['attributes']:_0x10925a[_0xf636('0x3f')];if(!_0x57b1a9[_0xf636('0x40')][_0xf636('0x69')](_0xf636('0x45'))){_0x172d0f['limit']=qs['limit'](_0x57b1a9[_0xf636('0x40')]['limit']);_0x172d0f[_0xf636('0x26')]=qs[_0xf636('0x26')](_0x57b1a9[_0xf636('0x40')][_0xf636('0x26')]);}_0x172d0f[_0xf636('0x46')]=qs[_0xf636('0x47')](_0x57b1a9['query']['sort']);_0x172d0f[_0xf636('0x48')]=qs[_0xf636('0x49')](_[_0xf636('0x4a')](_0x57b1a9[_0xf636('0x40')],_0x10925a['filters']));_0x172d0f[_0xf636('0x48')][_0xf636('0x6b')]=_0x463e55['id'];if(_0x57b1a9[_0xf636('0x40')]['filter']){_0x172d0f[_0xf636('0x48')]=_[_0xf636('0x4c')](_0x172d0f[_0xf636('0x48')],{'$or':_['map'](_0x172d0f[_0xf636('0x42')],function(_0x50ec7d){var _0x55b580={};_0x55b580[_0x50ec7d]={'$like':'%'+_0x57b1a9['query'][_0xf636('0x32')]+'%'};return _0x55b580;})});}_0x172d0f=_[_0xf636('0x4c')]({},_0x172d0f,_0x57b1a9[_0xf636('0x56')]);return db[_0xf636('0x6c')]['count']({'where':_0x172d0f[_0xf636('0x48')]})[_0xf636('0x2d')](function(_0x4ea281){_0x29fbd0[_0xf636('0x25')]=_0x4ea281;if(_0x57b1a9[_0xf636('0x40')][_0xf636('0x4d')]){_0x172d0f[_0xf636('0x4e')]=[{'all':!![]}];}return db[_0xf636('0x6c')][_0xf636('0x4f')](_0x172d0f);})[_0xf636('0x2d')](function(_0x268d50){_0x29fbd0['rows']=_0x268d50;return _0x29fbd0;});}})['then'](respondWithFilteredResult(_0x9b4bd5,_0x172d0f))[_0xf636('0x51')](handleError(_0x9b4bd5,null));};exports[_0xf636('0x6d')]=function(_0x10ee22,_0x104515,_0x3e4128){var _0x433f6c={'raw':!![],'where':{}};var _0x11edb2={};var _0x35c91b={'count':0x0,'rows':[]};return db[_0xf636('0x54')][_0xf636('0x67')]({'where':{'id':_0x10ee22[_0xf636('0x53')]['id']}})['then'](handleEntityNotFound(_0x104515,null))[_0xf636('0x2d')](function(_0x4eebbf){if(_0x4eebbf){_0x11edb2[_0xf636('0x3f')]=_[_0xf636('0x55')](db[_0xf636('0x6e')][_0xf636('0x3c')]);_0x11edb2[_0xf636('0x40')]=_['keys'](_0x10ee22['query']);_0x11edb2[_0xf636('0x49')]=_[_0xf636('0x41')](_0x11edb2[_0xf636('0x3f')],_0x11edb2['query']);_0x433f6c[_0xf636('0x42')]=_[_0xf636('0x41')](_0x11edb2['model'],qs['fields'](_0x10ee22['query']['fields']));_0x433f6c[_0xf636('0x42')]=_0x433f6c['attributes'][_0xf636('0x44')]?_0x433f6c[_0xf636('0x42')]:_0x11edb2[_0xf636('0x3f')];if(!_0x10ee22[_0xf636('0x40')][_0xf636('0x69')]('nolimit')){_0x433f6c['limit']=qs[_0xf636('0x27')](_0x10ee22[_0xf636('0x40')][_0xf636('0x27')]);_0x433f6c[_0xf636('0x26')]=qs['offset'](_0x10ee22['query'][_0xf636('0x26')]);}_0x433f6c[_0xf636('0x46')]=qs['sort'](_0x10ee22['query'][_0xf636('0x47')]);_0x433f6c['where']=qs['filters'](_['pick'](_0x10ee22[_0xf636('0x40')],_0x11edb2[_0xf636('0x49')]));_0x433f6c['where'][_0xf636('0x6b')]=_0x4eebbf['id'];if(_0x10ee22[_0xf636('0x40')][_0xf636('0x32')]){_0x433f6c[_0xf636('0x48')]=_[_0xf636('0x4c')](_0x433f6c[_0xf636('0x48')],{'$or':_['map'](_0x433f6c['attributes'],function(_0x1e3741){var _0x10929d={};_0x10929d[_0x1e3741]={'$like':'%'+_0x10ee22[_0xf636('0x40')][_0xf636('0x32')]+'%'};return _0x10929d;})});}_0x433f6c=_[_0xf636('0x4c')]({},_0x433f6c,_0x10ee22['options']);return db[_0xf636('0x6e')]['count']({'where':_0x433f6c[_0xf636('0x48')]})[_0xf636('0x2d')](function(_0x305601){_0x35c91b['count']=_0x305601;if(_0x10ee22['query'][_0xf636('0x4d')]){_0x433f6c['include']=[{'all':!![]}];}return db[_0xf636('0x6e')]['findAll'](_0x433f6c);})[_0xf636('0x2d')](function(_0x251653){_0x35c91b[_0xf636('0x50')]=_0x251653;return _0x35c91b;});}})['then'](respondWithFilteredResult(_0x104515,_0x433f6c))[_0xf636('0x51')](handleError(_0x104515,null));};exports[_0xf636('0x6f')]=function(_0x46f214,_0x3cf3d9,_0x1422bc){var _0x32f0e6={'raw':!![],'where':{}};var _0x1f35b2={};var _0xa5f0e3={'count':0x0,'rows':[]};return db[_0xf636('0x54')][_0xf636('0x67')]({'where':{'id':_0x46f214[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x3cf3d9,null))['then'](function(_0x41bd53){if(_0x41bd53){_0x1f35b2[_0xf636('0x3f')]=_[_0xf636('0x55')](db[_0xf636('0x70')]['rawAttributes']);_0x1f35b2[_0xf636('0x40')]=_[_0xf636('0x55')](_0x46f214['query']);_0x1f35b2[_0xf636('0x49')]=_[_0xf636('0x41')](_0x1f35b2['model'],_0x1f35b2[_0xf636('0x40')]);_0x32f0e6[_0xf636('0x42')]=_[_0xf636('0x41')](_0x1f35b2[_0xf636('0x3f')],qs[_0xf636('0x43')](_0x46f214[_0xf636('0x40')][_0xf636('0x43')]));_0x32f0e6[_0xf636('0x42')]=_0x32f0e6[_0xf636('0x42')][_0xf636('0x44')]?_0x32f0e6[_0xf636('0x42')]:_0x1f35b2[_0xf636('0x3f')];if(!_0x46f214['query'][_0xf636('0x69')](_0xf636('0x45'))){_0x32f0e6[_0xf636('0x27')]=qs[_0xf636('0x27')](_0x46f214[_0xf636('0x40')][_0xf636('0x27')]);_0x32f0e6[_0xf636('0x26')]=qs[_0xf636('0x26')](_0x46f214[_0xf636('0x40')]['offset']);}_0x32f0e6[_0xf636('0x46')]=qs['sort'](_0x46f214[_0xf636('0x40')][_0xf636('0x47')]);_0x32f0e6[_0xf636('0x48')]=qs[_0xf636('0x49')](_['pick'](_0x46f214[_0xf636('0x40')],_0x1f35b2['filters']));_0x32f0e6[_0xf636('0x48')][_0xf636('0x6b')]=_0x41bd53['id'];if(_0x46f214['query'][_0xf636('0x32')]){_0x32f0e6['where']=_[_0xf636('0x4c')](_0x32f0e6[_0xf636('0x48')],{'$or':_[_0xf636('0x33')](_0x32f0e6[_0xf636('0x42')],function(_0x1560e8){var _0x401fd7={};_0x401fd7[_0x1560e8]={'$like':'%'+_0x46f214[_0xf636('0x40')][_0xf636('0x32')]+'%'};return _0x401fd7;})});}_0x32f0e6=_[_0xf636('0x4c')]({},_0x32f0e6,_0x46f214['options']);return db[_0xf636('0x70')][_0xf636('0x25')]({'where':_0x32f0e6['where']})['then'](function(_0x7f1680){_0xa5f0e3[_0xf636('0x25')]=_0x7f1680;if(_0x46f214[_0xf636('0x40')][_0xf636('0x4d')]){_0x32f0e6[_0xf636('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x32f0e6);})[_0xf636('0x2d')](function(_0x208ac3){_0xa5f0e3[_0xf636('0x50')]=_0x208ac3;return _0xa5f0e3;});}})[_0xf636('0x2d')](respondWithFilteredResult(_0x3cf3d9,_0x32f0e6))[_0xf636('0x51')](handleError(_0x3cf3d9,null));};exports[_0xf636('0x71')]=function(_0x327560,_0x1ee288,_0x3f13a7){var _0x5b8a72={};var _0x297059={};var _0x208790;var _0x421d58;return db['VoiceQueue'][_0xf636('0x67')]({'where':{'id':_0x327560[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x1ee288,null))[_0xf636('0x2d')](function(_0xb00fb9){if(_0xb00fb9){_0x208790=_0xb00fb9;_0x297059[_0xf636('0x3f')]=_[_0xf636('0x55')](db[_0xf636('0x72')][_0xf636('0x3c')]);_0x297059[_0xf636('0x40')]=_['keys'](_0x327560[_0xf636('0x40')]);_0x297059[_0xf636('0x49')]=_[_0xf636('0x41')](_0x297059[_0xf636('0x3f')],_0x297059[_0xf636('0x40')]);_0x5b8a72[_0xf636('0x42')]=_[_0xf636('0x41')](_0x297059[_0xf636('0x3f')],qs[_0xf636('0x43')](_0x327560[_0xf636('0x40')][_0xf636('0x43')]));_0x5b8a72[_0xf636('0x42')]=_0x5b8a72[_0xf636('0x42')][_0xf636('0x44')]?_0x5b8a72[_0xf636('0x42')]:_0x297059['model'];_0x5b8a72[_0xf636('0x46')]=qs['sort'](_0x327560[_0xf636('0x40')]['sort']);_0x5b8a72[_0xf636('0x48')]=qs[_0xf636('0x49')](_['pick'](_0x327560[_0xf636('0x40')],_0x297059[_0xf636('0x49')]));if(_0x327560['query']['filter']){_0x5b8a72[_0xf636('0x48')]=_['merge'](_0x5b8a72[_0xf636('0x48')],{'$or':_['map'](_0x5b8a72[_0xf636('0x42')],function(_0x112d3c){var _0xd9152f={};_0xd9152f[_0x112d3c]={'$like':'%'+_0x327560['query'][_0xf636('0x32')]+'%'};return _0xd9152f;})});}_0x5b8a72=_['merge']({},_0x5b8a72,_0x327560[_0xf636('0x56')]);return _0x208790['getTeams'](_0x5b8a72);}})['then'](function(_0x44cc95){if(_0x44cc95){_0x421d58=_0x44cc95[_0xf636('0x44')];if(!_0x327560[_0xf636('0x40')][_0xf636('0x69')](_0xf636('0x45'))){_0x5b8a72[_0xf636('0x27')]=qs['limit'](_0x327560[_0xf636('0x40')]['limit']);_0x5b8a72['offset']=qs[_0xf636('0x26')](_0x327560[_0xf636('0x40')][_0xf636('0x26')]);}return _0x208790['getTeams'](_0x5b8a72);}})[_0xf636('0x2d')](function(_0x89d471){if(_0x89d471){return _0x89d471?{'count':_0x421d58,'rows':_0x89d471}:null;}})[_0xf636('0x2d')](respondWithResult(_0x1ee288,null))['catch'](handleError(_0x1ee288,null));};exports['addTeams']=function(_0x40a21f,_0x39a92a,_0x5b92e2){var _0x52cd0a=_0x40a21f['body']['teams'];var _0x3cbe0f=_[_0xf636('0x33')](_0x52cd0a,'id');return db[_0xf636('0x72')]['findAll']({'where':{'id':_0x3cbe0f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf636('0x73'),'attributes':['id',_0xf636('0x38'),_0xf636('0x74'),_0xf636('0x75'),_0xf636('0x76')],'raw':!![]}]})['then'](function(_0x3d7698){if(_0x3d7698){var _0x304d9c=_[_0xf636('0x77')](_0x3d7698,function(_0x2adfeb){var _0x306508=_0x2adfeb[_0xf636('0x2f')]({'plain':!![]});_0x306508[_0xf636('0x73')][_0xf636('0x78')](function(_0x5d3e75){_0x5d3e75[_0xf636('0x79')]=_[_0xf636('0x37')](_0x52cd0a,{'id':_0x306508['id']})['penalty'];});return _0x306508[_0xf636('0x73')];});return db[_0xf636('0x54')][_0xf636('0x37')]({'where':{'id':_0x40a21f[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](function(_0x32e633){return db[_0xf636('0x7a')]['transaction'](function(_0x1a29f4){return _0x32e633[_0xf636('0x7b')](_0x3cbe0f,{'transaction':_0x1a29f4})[_0xf636('0x2d')](function(){return BPromise[_0xf636('0x7c')](_0x304d9c,function(_0x104105){return db['UserVoiceQueue'][_0xf636('0x7d')]({'where':{'UserId':_0x104105['id'],'VoiceQueueId':_0x40a21f[_0xf636('0x53')]['id']},'defaults':{'penalty':_0x104105['penalty']},'transaction':_0x1a29f4});});})[_0xf636('0x2d')](function(){return BPromise[_0xf636('0x7c')](_[_0xf636('0x32')](_0x304d9c,{'online':!![]}),function(_0xc6a40d){return db[_0xf636('0x7e')][_0xf636('0x7f')]({'membername':_0xc6a40d[_0xf636('0x38')],'UserId':_0xc6a40d['id'],'queue_name':_0x32e633[_0xf636('0x38')],'VoiceQueueId':_0x32e633['id'],'interface':_['isNil'](_0xc6a40d[_0xf636('0x76')])?util[_0xf636('0x80')](_0xf636('0x81'),_0xc6a40d[_0xf636('0x38')]):_0xc6a40d[_0xf636('0x76')],'paused':_0xc6a40d['voicePause']||![],'penalty':_0xc6a40d['penalty']},{'transaction':_0x1a29f4});});})[_0xf636('0x2d')](function(){_0x304d9c[_0xf636('0x78')](function(_0x3b8f89){socket[_0xf636('0x82')]('userVoiceQueue:save',{'UserId':_0x3b8f89['id'],'VoiceQueueId':_0x32e633['id']});});});});});}})[_0xf636('0x2d')](respondWithStatusCode(_0x39a92a,null))[_0xf636('0x51')](handleError(_0x39a92a,null));};exports['removeTeams']=function(_0x59c21d,_0xc3329e,_0x2dc549){return db[_0xf636('0x72')][_0xf636('0x4f')]({'where':{'id':_0x59c21d[_0xf636('0x40')][_0xf636('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf636('0x73'),'attributes':['id'],'raw':!![]}]})[_0xf636('0x2d')](handleEntityNotFound(_0xc3329e,null))[_0xf636('0x2d')](function(_0x1bcf70){var _0x1621a3=_[_0xf636('0x33')](_0x1bcf70,'id');var _0x165318=[];var _0x2a568c=[];var _0x3cddb1=squel[_0xf636('0x84')]();_0x3cddb1[_0xf636('0x85')](_0xf636('0x86'))[_0xf636('0x87')](_0xf636('0x88'),'tq')[_0xf636('0x89')](_0xf636('0x8a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf636('0x48')](_0xf636('0x8b'),_0x59c21d[_0xf636('0x53')]['id']);for(var _0x4b7b6c=0x0;_0x4b7b6c<_0x1bcf70[_0xf636('0x44')];_0x4b7b6c+=0x1){let _0xc87343=_0x1bcf70[_0x4b7b6c];for(var _0x429041=0x0;_0x429041<_0xc87343['Agents'][_0xf636('0x44')];_0x429041+=0x1){let _0x6657f3=_0xc87343[_0xf636('0x73')][_0x429041];var _0xa1ad39=_0x3cddb1[_0xf636('0x61')]();_0xa1ad39[_0xf636('0x48')]('ut.UserId\x20=\x20?',_0x6657f3['id']);_0x2a568c[_0xf636('0x8c')](db['sequelize'][_0xf636('0x40')](_0xa1ad39['toString'](),{'type':db[_0xf636('0x7a')][_0xf636('0x8d')][_0xf636('0x8e')]})[_0xf636('0x2d')](function(_0x18d5c1){if(_0x18d5c1[_0xf636('0x44')]===0x1){return _0x6657f3['id'];}else{var _0x2f8d43=_['every'](_[_0xf636('0x33')](_0x18d5c1,'TeamId'),function(_0x7ab7b2){return _[_0xf636('0x35')](_0x1621a3,_0x7ab7b2);});if(_0x2f8d43){return _0x6657f3['id'];}}}));}}return BPromise[_0xf636('0x8f')](_0x2a568c)[_0xf636('0x2d')](function(_0x1fed9f){_0x165318=_(_0x165318)[_0xf636('0x90')](_0x1fed9f)['compact']()[_0xf636('0x34')]();return db[_0xf636('0x54')]['find']({'where':{'id':_0x59c21d[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](function(_0x23e26e){return db['sequelize'][_0xf636('0x91')](function(_0x52d153){return _0x23e26e['removeTeams'](_0x59c21d[_0xf636('0x40')]['ids'],{'transaction':_0x52d153})[_0xf636('0x2d')](function(){if(!_[_0xf636('0x92')](_0x165318)){return _0x23e26e['removeAgents'](_0x165318,{'transaction':_0x52d153})['then'](function(){return db[_0xf636('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x59c21d[_0xf636('0x53')]['id'],'UserId':_0x165318},'transaction':_0x52d153});});}})[_0xf636('0x2d')](function(){_0x165318['forEach'](function(_0x3d3702){socket[_0xf636('0x82')]('userVoiceQueue:remove',{'UserId':_0x3d3702,'VoiceQueueId':_0x23e26e['id']});});});});});});})[_0xf636('0x2d')](respondWithStatusCode(_0xc3329e,null))[_0xf636('0x51')](handleError(_0xc3329e,null));};exports[_0xf636('0x93')]=function(_0x3666ae,_0x4406e1,_0x139e08){var _0x5566ba,_0x144e02;return db[_0xf636('0x54')][_0xf636('0x37')]({'where':{'id':_0x3666ae[_0xf636('0x53')]['id']}})['then'](handleEntityNotFound(_0x4406e1,null))['then'](function(_0x75b8df){if(_0x75b8df){_0x144e02=_0x75b8df;return _0x75b8df['addAgents'](_0x3666ae[_0xf636('0x57')][_0xf636('0x83')],_['omit'](_0x3666ae['body'],[_0xf636('0x83'),'id'])||{})[_0xf636('0x94')](function(_0x379d95){for(var _0x7da96=0x0;_0x7da96<_0x3666ae[_0xf636('0x57')][_0xf636('0x83')][_0xf636('0x44')];_0x7da96+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x3666ae[_0xf636('0x57')][_0xf636('0x83')][_0x7da96],'VoiceQueueId':_0x3666ae[_0xf636('0x53')]['id']});}return _0x379d95;});}})['then'](function(_0x285766){_0x5566ba=_0x285766||[];if(_0x144e02){return db['User']['findAll']({'where':{'id':_0x3666ae[_0xf636('0x57')][_0xf636('0x83')]},'attributes':['id',_0xf636('0x38'),_0xf636('0x74'),_0xf636('0x75'),'interface'],'raw':!![]});}})[_0xf636('0x2d')](function(_0x10d5ac){if(!_['isEmpty'](_0x10d5ac)){var _0x2a56eb=[];for(var _0x1a5427=0x0;_0x1a5427<_0x10d5ac[_0xf636('0x44')];_0x1a5427++){if(_0x10d5ac[_0x1a5427][_0xf636('0x74')]){_0x2a56eb[_0xf636('0x8c')](db[_0xf636('0x7e')][_0xf636('0x7f')]({'membername':_0x10d5ac[_0x1a5427]['name'],'UserId':_0x10d5ac[_0x1a5427]['id'],'queue_name':_0x144e02[_0xf636('0x38')],'VoiceQueueId':_0x144e02['id'],'interface':_[_0xf636('0x95')](_0x10d5ac[_0x1a5427]['interface'])?util[_0xf636('0x80')](_0xf636('0x81'),_0x10d5ac[_0x1a5427]['name']):_0x10d5ac[_0x1a5427][_0xf636('0x76')],'paused':_0x10d5ac[_0x1a5427][_0xf636('0x75')]||![],'penalty':_0x3666ae['body'][_0xf636('0x79')]||0x0}));}}return BPromise[_0xf636('0x8f')](_0x2a56eb);}})[_0xf636('0x2d')](function(){return _0x5566ba;})[_0xf636('0x2d')](respondWithResult(_0x4406e1,null))[_0xf636('0x51')](handleError(_0x4406e1,null));};exports['removeAgents']=function(_0x3de8e8,_0x87dfdf,_0x9365f7){return db[_0xf636('0x54')][_0xf636('0x37')]({'where':{'id':_0x3de8e8[_0xf636('0x53')]['id']}})['then'](handleEntityNotFound(_0x87dfdf,null))['then'](function(_0x2bf6a2){if(_0x2bf6a2){return _0x2bf6a2['removeAgents'](_0x3de8e8[_0xf636('0x40')][_0xf636('0x83')])[_0xf636('0x2d')](function(){if(_[_0xf636('0x96')](_0x3de8e8['query']['ids'])){for(var _0x5d18ec=0x0;_0x5d18ec<_0x3de8e8['query'][_0xf636('0x83')]['length'];_0x5d18ec+=0x1){socket[_0xf636('0x82')](_0xf636('0x97'),{'UserId':Number(_0x3de8e8[_0xf636('0x40')][_0xf636('0x83')][_0x5d18ec]),'VoiceQueueId':Number(_0x3de8e8[_0xf636('0x53')]['id'])});}}else{socket[_0xf636('0x82')](_0xf636('0x97'),{'UserId':Number(_0x3de8e8[_0xf636('0x40')][_0xf636('0x83')]),'VoiceQueueId':Number(_0x3de8e8[_0xf636('0x53')]['id'])});}});}})[_0xf636('0x2d')](function(_0x1f199b){return db[_0xf636('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x3de8e8[_0xf636('0x53')]['id'],'UserId':_0x3de8e8[_0xf636('0x40')][_0xf636('0x83')]}})[_0xf636('0x2d')](function(){return _0x1f199b;});})[_0xf636('0x2d')](respondWithStatusCode(_0x87dfdf,null))['catch'](handleError(_0x87dfdf,null));};exports[_0xf636('0x98')]=function(_0x5641b4,_0x3a46f9,_0x2c6347){var _0x11ac5a={};var _0x5c4202={};var _0x15dbed;var _0x5a41ac;return db[_0xf636('0x54')][_0xf636('0x67')]({'where':{'id':_0x5641b4['params']['id']}})['then'](handleEntityNotFound(_0x3a46f9,null))[_0xf636('0x2d')](function(_0x45e5c8){if(_0x45e5c8){_0x15dbed=_0x45e5c8;_0x5c4202[_0xf636('0x3f')]=_[_0xf636('0x55')](db['User']['rawAttributes']);_0x5c4202['query']=_['keys'](_0x5641b4[_0xf636('0x40')]);_0x5c4202[_0xf636('0x49')]=_['intersection'](_0x5c4202['model'],_0x5c4202[_0xf636('0x40')]);_0x11ac5a['attributes']=_[_0xf636('0x41')](_0x5c4202['model'],qs[_0xf636('0x43')](_0x5641b4['query']['fields']));_0x11ac5a['attributes']=_0x11ac5a[_0xf636('0x42')][_0xf636('0x44')]?_0x11ac5a['attributes']:_0x5c4202[_0xf636('0x3f')];_0x11ac5a[_0xf636('0x46')]=qs[_0xf636('0x47')](_0x5641b4[_0xf636('0x40')][_0xf636('0x47')]);_0x11ac5a[_0xf636('0x48')]=qs[_0xf636('0x49')](_[_0xf636('0x4a')](_0x5641b4[_0xf636('0x40')],_0x5c4202[_0xf636('0x49')]));if(_0x5641b4[_0xf636('0x40')]['filter']){_0x11ac5a['where']=_[_0xf636('0x4c')](_0x11ac5a[_0xf636('0x48')],{'$or':_[_0xf636('0x33')](_0x11ac5a[_0xf636('0x42')],function(_0x2e8667){var _0x393715={};_0x393715[_0x2e8667]={'$like':'%'+_0x5641b4['query']['filter']+'%'};return _0x393715;})});}_0x11ac5a=_[_0xf636('0x4c')]({},_0x11ac5a,_0x5641b4[_0xf636('0x56')]);return _0x15dbed['getAgents'](_0x11ac5a);}})[_0xf636('0x2d')](function(_0x1dd9f6){if(_0x1dd9f6){_0x5a41ac=_0x1dd9f6[_0xf636('0x44')];if(!_0x5641b4[_0xf636('0x40')]['hasOwnProperty'](_0xf636('0x45'))){_0x11ac5a[_0xf636('0x27')]=qs['limit'](_0x5641b4['query']['limit']);_0x11ac5a[_0xf636('0x26')]=qs[_0xf636('0x26')](_0x5641b4[_0xf636('0x40')][_0xf636('0x26')]);}return _0x15dbed[_0xf636('0x98')](_0x11ac5a);}})['then'](function(_0x23b97f){if(_0x23b97f){return _0x23b97f?{'count':_0x5a41ac,'rows':_0x23b97f}:null;}})[_0xf636('0x2d')](respondWithResult(_0x3a46f9,null))[_0xf636('0x51')](handleError(_0x3a46f9,null));};exports[_0xf636('0x99')]=function(_0x2593c6,_0x3183d0,_0x235517){var _0x55f54f={};var _0x595c33={};var _0x8ec91e;var _0x6639b8;return db[_0xf636('0x54')][_0xf636('0x67')]({'where':{'id':_0x2593c6[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x3183d0,null))[_0xf636('0x2d')](function(_0x5b843e){if(_0x5b843e){_0x8ec91e=_0x5b843e;_0x595c33[_0xf636('0x3f')]=_[_0xf636('0x55')](db['UserVoiceQueueRt']['rawAttributes']);_0x595c33[_0xf636('0x40')]=_[_0xf636('0x55')](_0x2593c6['query']);_0x595c33[_0xf636('0x49')]=_[_0xf636('0x41')](_0x595c33['model'],_0x595c33[_0xf636('0x40')]);_0x55f54f[_0xf636('0x42')]=_[_0xf636('0x41')](_0x595c33[_0xf636('0x3f')],qs[_0xf636('0x43')](_0x2593c6[_0xf636('0x40')][_0xf636('0x43')]));_0x55f54f[_0xf636('0x42')]=_0x55f54f[_0xf636('0x42')][_0xf636('0x44')]?_0x55f54f[_0xf636('0x42')]:_0x595c33[_0xf636('0x3f')];_0x55f54f['order']=qs[_0xf636('0x47')](_0x2593c6['query'][_0xf636('0x47')]);_0x55f54f[_0xf636('0x48')]=qs[_0xf636('0x49')](_[_0xf636('0x4a')](_0x2593c6[_0xf636('0x40')],_0x595c33[_0xf636('0x49')]));if(_0x2593c6[_0xf636('0x40')]['filter']){_0x55f54f[_0xf636('0x48')]=_[_0xf636('0x4c')](_0x55f54f[_0xf636('0x48')],{'$or':_[_0xf636('0x33')](_0x55f54f[_0xf636('0x42')],function(_0x5a6c84){var _0x359c2f={};_0x359c2f[_0x5a6c84]={'$like':'%'+_0x2593c6[_0xf636('0x40')][_0xf636('0x32')]+'%'};return _0x359c2f;})});}_0x55f54f=_[_0xf636('0x4c')]({},_0x55f54f,_0x2593c6['options']);return _0x8ec91e[_0xf636('0x99')](_0x55f54f);}})[_0xf636('0x2d')](function(_0x2170e3){if(_0x2170e3){_0x6639b8=_0x2170e3['length'];if(!_0x2593c6['query'][_0xf636('0x69')]('nolimit')){_0x55f54f[_0xf636('0x27')]=qs['limit'](_0x2593c6[_0xf636('0x40')][_0xf636('0x27')]);_0x55f54f[_0xf636('0x26')]=qs['offset'](_0x2593c6[_0xf636('0x40')][_0xf636('0x26')]);}return _0x8ec91e[_0xf636('0x99')](_0x55f54f);}})['then'](function(_0x1d5619){return _0x1d5619?{'count':_0x6639b8,'rows':_0x1d5619}:null;})[_0xf636('0x2d')](respondWithResult(_0x3183d0,null))['catch'](handleError(_0x3183d0,null));};exports[_0xf636('0x9a')]=function(_0x1336a3,_0x227359,_0x57143c){var _0x17cfb9={};var _0x4e1bb4={};var _0x36852d;var _0x59befe;return db[_0xf636('0x54')][_0xf636('0x67')]({'where':{'id':_0x1336a3[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x227359,null))[_0xf636('0x2d')](function(_0x2f1ba1){if(_0x2f1ba1){_0x36852d=_0x2f1ba1;_0x4e1bb4['model']=_[_0xf636('0x55')](db[_0xf636('0x9b')][_0xf636('0x3c')]);_0x4e1bb4['query']=_['keys'](_0x1336a3[_0xf636('0x40')]);_0x4e1bb4[_0xf636('0x49')]=_[_0xf636('0x41')](_0x4e1bb4['model'],_0x4e1bb4[_0xf636('0x40')]);_0x17cfb9[_0xf636('0x42')]=_['intersection'](_0x4e1bb4['model'],qs[_0xf636('0x43')](_0x1336a3['query'][_0xf636('0x43')]));_0x17cfb9[_0xf636('0x42')]=_0x17cfb9[_0xf636('0x42')]['length']?_0x17cfb9[_0xf636('0x42')]:_0x4e1bb4['model'];_0x17cfb9[_0xf636('0x46')]=qs[_0xf636('0x47')](_0x1336a3[_0xf636('0x40')][_0xf636('0x47')]);_0x17cfb9['where']=qs[_0xf636('0x49')](_[_0xf636('0x4a')](_0x1336a3[_0xf636('0x40')],_0x4e1bb4[_0xf636('0x49')]));if(_0x1336a3[_0xf636('0x40')][_0xf636('0x32')]){_0x17cfb9[_0xf636('0x48')]=_[_0xf636('0x4c')](_0x17cfb9[_0xf636('0x48')],{'$or':_[_0xf636('0x33')](_0x17cfb9[_0xf636('0x42')],function(_0x6881d9){var _0x2ec732={};_0x2ec732[_0x6881d9]={'$like':'%'+_0x1336a3[_0xf636('0x40')][_0xf636('0x32')]+'%'};return _0x2ec732;})});}_0x17cfb9=_[_0xf636('0x4c')]({},_0x17cfb9,_0x1336a3[_0xf636('0x56')]);return _0x36852d['getLists'](_0x17cfb9);}})['then'](function(_0xd104c8){if(_0xd104c8){_0x59befe=_0xd104c8[_0xf636('0x44')];if(!_0x1336a3[_0xf636('0x40')][_0xf636('0x69')]('nolimit')){_0x17cfb9[_0xf636('0x27')]=qs['limit'](_0x1336a3[_0xf636('0x40')][_0xf636('0x27')]);_0x17cfb9[_0xf636('0x26')]=qs[_0xf636('0x26')](_0x1336a3[_0xf636('0x40')][_0xf636('0x26')]);}return _0x36852d[_0xf636('0x9a')](_0x17cfb9);}})[_0xf636('0x2d')](function(_0x43a887){if(_0x43a887){return _0x43a887?{'count':_0x59befe,'rows':_0x43a887}:null;}})[_0xf636('0x2d')](respondWithResult(_0x227359,null))[_0xf636('0x51')](handleError(_0x227359,null));};exports[_0xf636('0x9c')]=function(_0x3cecfe,_0x3d697,_0x4f5420){var _0x470fa0,_0x37f3c8;return db[_0xf636('0x54')][_0xf636('0x37')]({'where':{'id':_0x3cecfe['params']['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x3d697,null))['then'](function(_0x1634c2){if(_0x1634c2){_0x37f3c8=_0x1634c2;return _0x1634c2[_0xf636('0x9c')](_0x3cecfe[_0xf636('0x57')]['ids'],_[_0xf636('0x62')](_0x3cecfe[_0xf636('0x57')],['ids','id'])||{});}return null;})['spread'](function(_0x378660){var _0x427287;_0x470fa0=_0x378660||[];var _0x3f703a=[];if(_0x378660){for(var _0xe6f400=0x0;_0xe6f400<_0x378660[_0xf636('0x44')];_0xe6f400+=0x1){var _0x24e6a9=_0x378660[_0xe6f400][_0xf636('0x2f')]({'plain':!![]});_0x37f3c8[_0xf636('0x9d')]=_0x3cecfe['body'][_0xf636('0x9d')]?_0x3cecfe[_0xf636('0x57')][_0xf636('0x9d')]:_0x37f3c8[_0xf636('0x9d')];switch(_0x37f3c8[_0xf636('0x9d')]){case _0xf636('0x9e'):_0x427287=squel[_0xf636('0x9f')]()[_0xf636('0xa0')](_0xf636('0xa1'))[_0xf636('0xa2')](['phone','scheduledAt',_0xf636('0xa3'),_0xf636('0xa4'),'VoiceQueueId',_0xf636('0x63'),_0xf636('0x64')],squel[_0xf636('0x84')]()[_0xf636('0x85')](_0xf636('0xa5'),'phone')['field']('NOW()','scheduledAt')[_0xf636('0x85')]('id',_0xf636('0xa3'))[_0xf636('0x85')](_0x24e6a9[_0xf636('0xa6')]['toString'](),_0xf636('0xa4'))[_0xf636('0x85')](_0x3cecfe[_0xf636('0x53')]['id'][_0xf636('0xa7')](),_0xf636('0x6b'))[_0xf636('0x85')](_0xf636('0xa8'),'createdAt')['field']('NOW()',_0xf636('0x64'))['from'](_0xf636('0xa9'))[_0xf636('0x48')](_0xf636('0xaa'))[_0xf636('0x48')](_0xf636('0xab'),_0x24e6a9[_0xf636('0xa6')][_0xf636('0xa7')]())['where'](_0xf636('0xac'))[_0xf636('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')[_0xf636('0x87')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x3cecfe[_0xf636('0x53')]['id'][_0xf636('0xa7')]()))[_0xf636('0x48')](_0xf636('0xad'),squel['select']()[_0xf636('0x85')](_0xf636('0xae'))['from'](_0xf636('0xa1'))[_0xf636('0x48')](_0xf636('0x8b'),_0x3cecfe[_0xf636('0x53')]['id'][_0xf636('0xa7')]())))['toString']();break;case'onlyIfOpen':_0x427287=squel['insert']()[_0xf636('0xa0')]('cm_hopper')[_0xf636('0xa2')]([_0xf636('0xa5'),_0xf636('0xaf'),'ContactId',_0xf636('0xa4'),_0xf636('0x6b'),_0xf636('0x63'),_0xf636('0x64')],squel[_0xf636('0x84')]()['field'](_0xf636('0xa5'),_0xf636('0xa5'))['field']('NOW()',_0xf636('0xaf'))[_0xf636('0x85')]('id',_0xf636('0xa3'))[_0xf636('0x85')](_0x24e6a9['CmListId'][_0xf636('0xa7')](),_0xf636('0xa4'))['field'](_0x3cecfe[_0xf636('0x53')]['id']['toString'](),_0xf636('0x6b'))[_0xf636('0x85')]('NOW()',_0xf636('0x63'))[_0xf636('0x85')](_0xf636('0xa8'),_0xf636('0x64'))[_0xf636('0x87')](_0xf636('0xa9'))[_0xf636('0x48')]('deletedAt\x20IS\x20NULL')[_0xf636('0x48')]('ListId\x20=\x20?',_0x24e6a9['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0xf636('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf636('0x84')]()['field'](_0xf636('0xae'))[_0xf636('0x87')]('cm_hopper')['where'](_0xf636('0x8b'),_0x3cecfe[_0xf636('0x53')]['id'][_0xf636('0xa7')]())))[_0xf636('0xa7')]();break;default:_0x427287=squel[_0xf636('0x9f')]()[_0xf636('0xa0')](_0xf636('0xa1'))[_0xf636('0xa2')]([_0xf636('0xa5'),_0xf636('0xaf'),_0xf636('0xa3'),'ListId','VoiceQueueId','createdAt',_0xf636('0x64')],squel[_0xf636('0x84')]()[_0xf636('0x85')](_0xf636('0xa5'),_0xf636('0xa5'))[_0xf636('0x85')](_0xf636('0xa8'),'scheduledAt')['field']('id',_0xf636('0xa3'))['field'](_0x24e6a9[_0xf636('0xa6')][_0xf636('0xa7')](),'ListId')[_0xf636('0x85')](_0x3cecfe[_0xf636('0x53')]['id'][_0xf636('0xa7')](),_0xf636('0x6b'))[_0xf636('0x85')]('NOW()',_0xf636('0x63'))[_0xf636('0x85')](_0xf636('0xa8'),_0xf636('0x64'))['from'](_0xf636('0xa9'))['where'](_0xf636('0xaa'))[_0xf636('0x48')]('ListId\x20=\x20?',_0x24e6a9['CmListId']['toString']())[_0xf636('0x48')](_0xf636('0xac')))[_0xf636('0xa7')]();}_0x3f703a[_0xf636('0x8c')](db[_0xf636('0x7a')]['query'](_0x427287));}return BPromise['all'](_0x3f703a);}})[_0xf636('0x2d')](function(){return _0x470fa0;})[_0xf636('0x2d')](respondWithResult(_0x3d697,null))[_0xf636('0x51')](handleError(_0x3d697,null));};exports[_0xf636('0xb0')]=function(_0x2f6226,_0x1b879b,_0x5d35df){return db[_0xf636('0x54')][_0xf636('0x37')]({'where':{'id':_0x2f6226[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x1b879b,null))[_0xf636('0x2d')](function(_0x2bc6fe){if(_0x2bc6fe){return _0x2bc6fe[_0xf636('0xb0')](_0x2f6226[_0xf636('0x40')][_0xf636('0x83')]);}})[_0xf636('0x2d')](function(_0x462027){if(_0x462027){return db[_0xf636('0x68')]['destroy']({'where':{'ListId':_0x2f6226[_0xf636('0x40')][_0xf636('0x83')],'VoiceQueueId':_0x2f6226[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](function(){return _0x462027;});}})[_0xf636('0x2d')](respondWithStatusCode(_0x1b879b,null))[_0xf636('0x51')](handleError(_0x1b879b,null));};exports[_0xf636('0xb1')]=function(_0x1718e1,_0x4ddf37,_0x23040c){var _0x5b33c9={};var _0x270a6f={};var _0x528e9f;var _0x37a439;return db[_0xf636('0x54')][_0xf636('0x67')]({'where':{'id':_0x1718e1[_0xf636('0x53')]['id']}})['then'](handleEntityNotFound(_0x4ddf37,null))[_0xf636('0x2d')](function(_0x4831bc){if(_0x4831bc){_0x528e9f=_0x4831bc;_0x270a6f[_0xf636('0x3f')]=_[_0xf636('0x55')](db[_0xf636('0x9b')][_0xf636('0x3c')]);_0x270a6f[_0xf636('0x40')]=_[_0xf636('0x55')](_0x1718e1[_0xf636('0x40')]);_0x270a6f[_0xf636('0x49')]=_[_0xf636('0x41')](_0x270a6f[_0xf636('0x3f')],_0x270a6f[_0xf636('0x40')]);_0x5b33c9[_0xf636('0x42')]=_[_0xf636('0x41')](_0x270a6f['model'],qs['fields'](_0x1718e1[_0xf636('0x40')]['fields']));_0x5b33c9['attributes']=_0x5b33c9[_0xf636('0x42')][_0xf636('0x44')]?_0x5b33c9[_0xf636('0x42')]:_0x270a6f[_0xf636('0x3f')];_0x5b33c9['order']=qs[_0xf636('0x47')](_0x1718e1[_0xf636('0x40')]['sort']);_0x5b33c9['where']=qs[_0xf636('0x49')](_[_0xf636('0x4a')](_0x1718e1[_0xf636('0x40')],_0x270a6f['filters']));if(_0x1718e1[_0xf636('0x40')]['filter']){_0x5b33c9[_0xf636('0x48')]=_[_0xf636('0x4c')](_0x5b33c9[_0xf636('0x48')],{'$or':_[_0xf636('0x33')](_0x5b33c9['attributes'],function(_0x473d7c){var _0x415932={};_0x415932[_0x473d7c]={'$like':'%'+_0x1718e1[_0xf636('0x40')]['filter']+'%'};return _0x415932;})});}_0x5b33c9=_['merge']({},_0x5b33c9,_0x1718e1['options']);return _0x528e9f[_0xf636('0xb1')](_0x5b33c9);}})[_0xf636('0x2d')](function(_0x5b644e){if(_0x5b644e){_0x37a439=_0x5b644e[_0xf636('0x44')];if(!_0x1718e1[_0xf636('0x40')][_0xf636('0x69')](_0xf636('0x45'))){_0x5b33c9['limit']=qs[_0xf636('0x27')](_0x1718e1[_0xf636('0x40')]['limit']);_0x5b33c9['offset']=qs[_0xf636('0x26')](_0x1718e1[_0xf636('0x40')][_0xf636('0x26')]);}return _0x528e9f[_0xf636('0xb1')](_0x5b33c9);}})[_0xf636('0x2d')](function(_0x328a4f){if(_0x328a4f){return _0x328a4f?{'count':_0x37a439,'rows':_0x328a4f}:null;}})[_0xf636('0x2d')](respondWithResult(_0x4ddf37,null))['catch'](handleError(_0x4ddf37,null));};exports[_0xf636('0xb2')]=function(_0x357d45,_0x1c4db5,_0xaf1207){var _0x4f89f3,_0x29946c;return db['VoiceQueue']['find']({'where':{'id':_0x357d45[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0x1c4db5,null))[_0xf636('0x2d')](function(_0x59c023){if(_0x59c023){_0x29946c=_0x59c023;return _0x59c023['addBlackLists'](_0x357d45['body']['ids'],_['omit'](_0x357d45[_0xf636('0x57')],[_0xf636('0x83'),'id'])||{});}return null;})[_0xf636('0x94')](function(_0xcfd875){var _0x10a471;_0x4f89f3=_0xcfd875||[];var _0x1b74c3=[];if(_0xcfd875){for(var _0x21efb6=0x0;_0x21efb6<_0xcfd875[_0xf636('0x44')];_0x21efb6+=0x1){var _0x264d68=_0xcfd875[_0x21efb6][_0xf636('0x2f')]({'plain':!![]});_0x10a471=squel[_0xf636('0x9f')]()[_0xf636('0xa0')](_0xf636('0xb3'))[_0xf636('0xa2')]([_0xf636('0xa5'),_0xf636('0xa3'),_0xf636('0xa4'),'VoiceQueueId',_0xf636('0x63'),_0xf636('0x64')],squel[_0xf636('0x84')]()[_0xf636('0x85')](_0xf636('0xa5'),_0xf636('0xa5'))['field']('id',_0xf636('0xa3'))[_0xf636('0x85')](_0x264d68[_0xf636('0xa6')][_0xf636('0xa7')](),'ListId')[_0xf636('0x85')](_0x357d45['params']['id'][_0xf636('0xa7')](),_0xf636('0x6b'))['field'](_0xf636('0xa8'),_0xf636('0x63'))[_0xf636('0x85')](_0xf636('0xa8'),_0xf636('0x64'))[_0xf636('0x87')](_0xf636('0xa9'))[_0xf636('0x48')](_0xf636('0xaa'))[_0xf636('0x48')](_0xf636('0xab'),_0x264d68[_0xf636('0xa6')][_0xf636('0xa7')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x1b74c3[_0xf636('0x8c')](db[_0xf636('0x7a')]['query'](_0x10a471));}return BPromise[_0xf636('0x8f')](_0x1b74c3);}})[_0xf636('0x2d')](function(){return _0x4f89f3;})[_0xf636('0x2d')](respondWithResult(_0x1c4db5,null))[_0xf636('0x51')](handleError(_0x1c4db5,null));};exports['removeBlackLists']=function(_0xaab323,_0xcf50b2,_0x3c8d8e){return db[_0xf636('0x54')][_0xf636('0x37')]({'where':{'id':_0xaab323[_0xf636('0x53')]['id']}})[_0xf636('0x2d')](handleEntityNotFound(_0xcf50b2,null))['then'](function(_0x128557){if(_0x128557){return _0x128557[_0xf636('0xb4')](_0xaab323[_0xf636('0x40')][_0xf636('0x83')]);}})['then'](function(_0x4fdf9c){if(_0x4fdf9c){return db[_0xf636('0x70')][_0xf636('0x2e')]({'where':{'ListId':_0xaab323[_0xf636('0x40')][_0xf636('0x83')],'VoiceQueueId':_0xaab323['params']['id']}})['then'](function(){return _0x4fdf9c;});}})[_0xf636('0x2d')](respondWithStatusCode(_0xcf50b2,null))[_0xf636('0x51')](handleError(_0xcf50b2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 82ac99a..fd75def 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 _0x99a4=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x99a4,0x180));var _0x499a=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x99a4[_0xc0a3d3];return _0x3386e8;};'use strict';var EventEmitter=require(_0x499a('0x0'));var VoiceQueue=require(_0x499a('0x1'))['db'][_0x499a('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x499a('0x3')](0x0);var events={'afterCreate':_0x499a('0x4'),'afterUpdate':_0x499a('0x5'),'afterDestroy':_0x499a('0x6')};function emitEvent(_0xcb5a0e){return function(_0x288aba,_0x37d482,_0x50fdbc){VoiceQueueEvents[_0x499a('0x7')](_0xcb5a0e+':'+_0x288aba['id'],_0x288aba);VoiceQueueEvents[_0x499a('0x7')](_0xcb5a0e,_0x288aba);_0x50fdbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x499a('0x8')](e,emitEvent(event));}}module[_0x499a('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x2a0c=['hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','update','remove'];(function(_0x4757de,_0x500dc5){var _0x178ec8=function(_0x3c05a6){while(--_0x3c05a6){_0x4757de['push'](_0x4757de['shift']());}};_0x178ec8(++_0x500dc5);}(_0x2a0c,0x145));var _0xc2a0=function(_0x4a662b,_0x1a9ee7){_0x4a662b=_0x4a662b-0x0;var _0x1596f3=_0x2a0c[_0x4a662b];return _0x1596f3;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xc2a0('0x0'))['db'][_0xc2a0('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc2a0('0x2'),'afterDestroy':_0xc2a0('0x3')};function emitEvent(_0x5c2cf3){return function(_0x107ab2,_0x589b61,_0x49521a){VoiceQueueEvents['emit'](_0x5c2cf3+':'+_0x107ab2['id'],_0x107ab2);VoiceQueueEvents['emit'](_0x5c2cf3,_0x107ab2);_0x49521a(null);};}for(var e in events){if(events[_0xc2a0('0x4')](e)){var event=events[e];VoiceQueue[_0xc2a0('0x5')](e,emitEvent(event));}}module[_0xc2a0('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 500e29c..b1d1d6f 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 _0xa24b=['VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x268d32,_0x17f22b){var _0x4158cc=function(_0x5d14b3){while(--_0x5d14b3){_0x268d32['push'](_0x268d32['shift']());}};_0x4158cc(++_0x17f22b);}(_0xa24b,0xec));var _0xba24=function(_0x30641a,_0xc485c3){_0x30641a=_0x30641a-0x0;var _0x3fb217=_0xa24b[_0x30641a];return _0x3fb217;};'use strict';var _=require(_0xba24('0x0'));var util=require(_0xba24('0x1'));var logger=require(_0xba24('0x2'))(_0xba24('0x3'));var moment=require(_0xba24('0x4'));var BPromise=require(_0xba24('0x5'));var rp=require(_0xba24('0x6'));var fs=require('fs');var path=require(_0xba24('0x7'));var rimraf=require('rimraf');var config=require(_0xba24('0x8'));var attributes=require('./voiceQueue.attributes');module[_0xba24('0x9')]=function(_0xa28994,_0x5581f5){return _0xa28994[_0xba24('0xa')](_0xba24('0xb'),attributes,{'tableName':_0xba24('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf35e=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','VoiceQueue','voice_queues','util'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0xf35e,0x86));var _0xef35=function(_0xbed040,_0x4bf18e){_0xbed040=_0xbed040-0x0;var _0x24a154=_0xf35e[_0xbed040];return _0x24a154;};'use strict';var _=require('lodash');var util=require(_0xef35('0x0'));var logger=require(_0xef35('0x1'))('api');var moment=require('moment');var BPromise=require(_0xef35('0x2'));var rp=require(_0xef35('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef35('0x4'));var config=require(_0xef35('0x5'));var attributes=require(_0xef35('0x6'));module['exports']=function(_0x35033d,_0x2af211){return _0x35033d['define'](_0xef35('0x7'),attributes,{'tableName':_0xef35('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 26dd327..e9c8a15 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 _0x51ba=['util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','attributes','limit','include','model','GetVoiceQueue','ShowVoiceQueue','VoiceQueue','find','raw','where','map','lodash'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x51ba,0x127));var _0xa51b=function(_0x15667f,_0x44ebc5){_0x15667f=_0x15667f-0x0;var _0x5ac5a3=_0x51ba[_0x15667f];return _0x5ac5a3;};'use strict';var _=require(_0xa51b('0x0'));var util=require(_0xa51b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa51b('0x2'))['db'];var utils=require(_0xa51b('0x3'));var logger=require(_0xa51b('0x4'))(_0xa51b('0x5'));var config=require('../../config/environment');var jayson=require(_0xa51b('0x6'));var client=jayson[_0xa51b('0x7')]['http']({'port':0x232a});config[_0xa51b('0x8')]=_[_0xa51b('0x9')](config[_0xa51b('0x8')],{'host':_0xa51b('0xa'),'port':0x18eb});var socket=require(_0xa51b('0xb'))(new Redis(config[_0xa51b('0x8')]));require('./voiceQueue.socket')[_0xa51b('0xc')](socket);function respondWithRpcPromise(_0x2c0075,_0x34914e,_0x5ba084){return new BPromise(function(_0x2722fc,_0x96614c){return client['request'](_0x2c0075,_0x5ba084)[_0xa51b('0xd')](function(_0x2eb085){logger[_0xa51b('0xe')](_0xa51b('0xf'),_0x34914e,_0xa51b('0x10'));logger[_0xa51b('0x11')](_0xa51b('0x12'),_0x34914e,_0xa51b('0x10'),JSON[_0xa51b('0x13')](_0x2eb085));if(_0x2eb085[_0xa51b('0x14')]){if(_0x2eb085['error']['code']===0x1f4){logger[_0xa51b('0x14')](_0xa51b('0xf'),_0x34914e,_0x2eb085[_0xa51b('0x14')][_0xa51b('0x15')]);return _0x96614c(_0x2eb085['error']['message']);}logger[_0xa51b('0x14')](_0xa51b('0xf'),_0x34914e,_0x2eb085['error'][_0xa51b('0x15')]);return _0x2722fc(_0x2eb085['error'][_0xa51b('0x15')]);}else{logger[_0xa51b('0xe')](_0xa51b('0xf'),_0x34914e,_0xa51b('0x10'));_0x2722fc(_0x2eb085[_0xa51b('0x16')][_0xa51b('0x15')]);}})[_0xa51b('0x17')](function(_0x3fecfb){logger[_0xa51b('0x14')](_0xa51b('0xf'),_0x34914e,_0x3fecfb);_0x96614c(_0x3fecfb);});});}exports['GetVoiceQueue']=function(_0xa08c8b){var _0x49b9f4=this;return new Promise(function(_0x21b00c,_0x3be430){return db['VoiceQueue'][_0xa51b('0x18')]({'raw':_0xa08c8b[_0xa51b('0x19')]?_0xa08c8b[_0xa51b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xa08c8b[_0xa51b('0x19')]?_0xa08c8b[_0xa51b('0x19')]['where']||null:null,'attributes':_0xa08c8b[_0xa51b('0x19')]?_0xa08c8b['options'][_0xa51b('0x1a')]||null:null,'limit':_0xa08c8b[_0xa51b('0x19')]?_0xa08c8b[_0xa51b('0x19')][_0xa51b('0x1b')]||null:null,'include':_0xa08c8b[_0xa51b('0x19')]?_0xa08c8b[_0xa51b('0x19')][_0xa51b('0x1c')]?_['map'](_0xa08c8b[_0xa51b('0x19')][_0xa51b('0x1c')],function(_0x3c0b8){return{'model':db[_0x3c0b8[_0xa51b('0x1d')]],'as':_0x3c0b8['as'],'attributes':_0x3c0b8[_0xa51b('0x1a')],'include':_0x3c0b8['include']?_['map'](_0x3c0b8[_0xa51b('0x1c')],function(_0x5e1748){return{'model':db[_0x5e1748[_0xa51b('0x1d')]],'as':_0x5e1748['as'],'attributes':_0x5e1748[_0xa51b('0x1a')],'include':_0x5e1748[_0xa51b('0x1c')]?_['map'](_0x5e1748['include'],function(_0x447819){return{'model':db[_0x447819[_0xa51b('0x1d')]],'as':_0x447819['as'],'attributes':_0x447819['attributes']};}):[]};}):[]};}):[]:[]})[_0xa51b('0xd')](function(_0x526ab7){logger[_0xa51b('0xe')](_0xa51b('0x1e'),_0xa08c8b);logger[_0xa51b('0x11')](_0xa51b('0x1e'),_0xa08c8b,JSON[_0xa51b('0x13')](_0x526ab7));_0x21b00c(_0x526ab7);})[_0xa51b('0x17')](function(_0x533611){logger[_0xa51b('0x14')](_0xa51b('0x1e'),_0x533611[_0xa51b('0x15')],_0xa08c8b);_0x3be430(_0x49b9f4[_0xa51b('0x14')](0x1f4,_0x533611['message']));});});};exports[_0xa51b('0x1f')]=function(_0x280fc7){var _0x373cca=this;return new Promise(function(_0x20fa90,_0x4b9b2f){return db[_0xa51b('0x20')][_0xa51b('0x21')]({'raw':_0x280fc7[_0xa51b('0x19')]?_0x280fc7[_0xa51b('0x19')][_0xa51b('0x22')]===undefined?!![]:![]:!![],'where':_0x280fc7[_0xa51b('0x19')]?_0x280fc7[_0xa51b('0x19')][_0xa51b('0x23')]||null:null,'attributes':_0x280fc7[_0xa51b('0x19')]?_0x280fc7['options'][_0xa51b('0x1a')]||null:null,'include':_0x280fc7[_0xa51b('0x19')]?_0x280fc7[_0xa51b('0x19')][_0xa51b('0x1c')]?_[_0xa51b('0x24')](_0x280fc7[_0xa51b('0x19')][_0xa51b('0x1c')],function(_0x37a390){return{'model':db[_0x37a390[_0xa51b('0x1d')]],'as':_0x37a390['as'],'attributes':_0x37a390[_0xa51b('0x1a')],'include':_0x37a390[_0xa51b('0x1c')]?_[_0xa51b('0x24')](_0x37a390[_0xa51b('0x1c')],function(_0x4ec5ce){return{'model':db[_0x4ec5ce[_0xa51b('0x1d')]],'as':_0x4ec5ce['as'],'attributes':_0x4ec5ce['attributes'],'include':_0x4ec5ce['include']?_[_0xa51b('0x24')](_0x4ec5ce[_0xa51b('0x1c')],function(_0xa34ce3){return{'model':db[_0xa34ce3['model']],'as':_0xa34ce3['as'],'attributes':_0xa34ce3[_0xa51b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13a7af){logger[_0xa51b('0xe')]('ShowVoiceQueue',_0x280fc7);logger['debug'](_0xa51b('0x1f'),_0x280fc7,JSON[_0xa51b('0x13')](_0x13a7af));_0x20fa90(_0x13a7af);})[_0xa51b('0x17')](function(_0x581f9a){logger[_0xa51b('0x14')](_0xa51b('0x1f'),_0x581f9a[_0xa51b('0x15')],_0x280fc7);_0x4b9b2f(_0x373cca[_0xa51b('0x14')](0x1f4,_0x581f9a[_0xa51b('0x15')]));});});}; \ No newline at end of file +var _0xa9eb=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetVoiceQueue','VoiceQueue','options','raw','where','limit','include','map','model','attributes','ShowVoiceQueue','moment','bluebird','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9eb,0x151));var _0xba9e=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xa9eb[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xba9e('0x0'));var BPromise=require(_0xba9e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xba9e('0x2'));var logger=require(_0xba9e('0x3'))(_0xba9e('0x4'));var config=require(_0xba9e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xba9e('0x6')][_0xba9e('0x7')]({'port':0x232a});config[_0xba9e('0x8')]=_[_0xba9e('0x9')](config[_0xba9e('0x8')],{'host':_0xba9e('0xa'),'port':0x18eb});var socket=require(_0xba9e('0xb'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xba9e('0xc')](socket);function respondWithRpcPromise(_0x18f84e,_0x48609b,_0x36e83c){return new BPromise(function(_0xa64ea4,_0x19e887){return client[_0xba9e('0xd')](_0x18f84e,_0x36e83c)[_0xba9e('0xe')](function(_0x3cf5f2){logger[_0xba9e('0xf')](_0xba9e('0x10'),_0x48609b,_0xba9e('0x11'));logger[_0xba9e('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x48609b,'request\x20sent',JSON[_0xba9e('0x13')](_0x3cf5f2));if(_0x3cf5f2[_0xba9e('0x14')]){if(_0x3cf5f2['error']['code']===0x1f4){logger[_0xba9e('0x14')](_0xba9e('0x10'),_0x48609b,_0x3cf5f2['error']['message']);return _0x19e887(_0x3cf5f2['error'][_0xba9e('0x15')]);}logger['error'](_0xba9e('0x10'),_0x48609b,_0x3cf5f2[_0xba9e('0x14')][_0xba9e('0x15')]);return _0xa64ea4(_0x3cf5f2[_0xba9e('0x14')][_0xba9e('0x15')]);}else{logger[_0xba9e('0xf')](_0xba9e('0x10'),_0x48609b,_0xba9e('0x11'));_0xa64ea4(_0x3cf5f2['result'][_0xba9e('0x15')]);}})[_0xba9e('0x16')](function(_0x15512e){logger[_0xba9e('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x48609b,_0x15512e);_0x19e887(_0x15512e);});});}exports[_0xba9e('0x17')]=function(_0x53f91d){var _0x5cec0f=this;return new Promise(function(_0x1210af,_0x2e39b7){return db[_0xba9e('0x18')]['findAll']({'raw':_0x53f91d[_0xba9e('0x19')]?_0x53f91d[_0xba9e('0x19')][_0xba9e('0x1a')]===undefined?!![]:![]:!![],'where':_0x53f91d[_0xba9e('0x19')]?_0x53f91d[_0xba9e('0x19')][_0xba9e('0x1b')]||null:null,'attributes':_0x53f91d['options']?_0x53f91d[_0xba9e('0x19')]['attributes']||null:null,'limit':_0x53f91d['options']?_0x53f91d['options'][_0xba9e('0x1c')]||null:null,'include':_0x53f91d['options']?_0x53f91d[_0xba9e('0x19')][_0xba9e('0x1d')]?_[_0xba9e('0x1e')](_0x53f91d['options'][_0xba9e('0x1d')],function(_0x347b81){return{'model':db[_0x347b81[_0xba9e('0x1f')]],'as':_0x347b81['as'],'attributes':_0x347b81['attributes'],'include':_0x347b81['include']?_['map'](_0x347b81['include'],function(_0x3d4abc){return{'model':db[_0x3d4abc['model']],'as':_0x3d4abc['as'],'attributes':_0x3d4abc[_0xba9e('0x20')],'include':_0x3d4abc[_0xba9e('0x1d')]?_[_0xba9e('0x1e')](_0x3d4abc[_0xba9e('0x1d')],function(_0x10fd01){return{'model':db[_0x10fd01[_0xba9e('0x1f')]],'as':_0x10fd01['as'],'attributes':_0x10fd01[_0xba9e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2be23c){logger[_0xba9e('0xf')](_0xba9e('0x17'),_0x53f91d);logger[_0xba9e('0x12')](_0xba9e('0x17'),_0x53f91d,JSON['stringify'](_0x2be23c));_0x1210af(_0x2be23c);})[_0xba9e('0x16')](function(_0x265ed6){logger[_0xba9e('0x14')]('GetVoiceQueue',_0x265ed6[_0xba9e('0x15')],_0x53f91d);_0x2e39b7(_0x5cec0f[_0xba9e('0x14')](0x1f4,_0x265ed6['message']));});});};exports[_0xba9e('0x21')]=function(_0x4b976f){var _0x1a14fd=this;return new Promise(function(_0x3efc1d,_0x1cf9bf){return db[_0xba9e('0x18')]['find']({'raw':_0x4b976f['options']?_0x4b976f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b976f[_0xba9e('0x19')]?_0x4b976f[_0xba9e('0x19')][_0xba9e('0x1b')]||null:null,'attributes':_0x4b976f[_0xba9e('0x19')]?_0x4b976f[_0xba9e('0x19')][_0xba9e('0x20')]||null:null,'include':_0x4b976f[_0xba9e('0x19')]?_0x4b976f['options'][_0xba9e('0x1d')]?_[_0xba9e('0x1e')](_0x4b976f['options'][_0xba9e('0x1d')],function(_0x2e8e83){return{'model':db[_0x2e8e83[_0xba9e('0x1f')]],'as':_0x2e8e83['as'],'attributes':_0x2e8e83['attributes'],'include':_0x2e8e83[_0xba9e('0x1d')]?_[_0xba9e('0x1e')](_0x2e8e83[_0xba9e('0x1d')],function(_0x3da95d){return{'model':db[_0x3da95d[_0xba9e('0x1f')]],'as':_0x3da95d['as'],'attributes':_0x3da95d[_0xba9e('0x20')],'include':_0x3da95d[_0xba9e('0x1d')]?_[_0xba9e('0x1e')](_0x3da95d[_0xba9e('0x1d')],function(_0x181d33){return{'model':db[_0x181d33['model']],'as':_0x181d33['as'],'attributes':_0x181d33[_0xba9e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40d1f5){logger[_0xba9e('0xf')](_0xba9e('0x21'),_0x4b976f);logger[_0xba9e('0x12')]('ShowVoiceQueue',_0x4b976f,JSON['stringify'](_0x40d1f5));_0x3efc1d(_0x40d1f5);})[_0xba9e('0x16')](function(_0x32fca8){logger[_0xba9e('0x14')]('ShowVoiceQueue',_0x32fca8['message'],_0x4b976f);_0x1cf9bf(_0x1a14fd[_0xba9e('0x14')](0x1f4,_0x32fca8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d9c3d8d..26fd92f 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 _0x6301=['update','removeListener','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x2199c3,_0x118a6f){var _0x54666e=function(_0x3989c2){while(--_0x3989c2){_0x2199c3['push'](_0x2199c3['shift']());}};_0x54666e(++_0x118a6f);}(_0x6301,0x9e));var _0x1630=function(_0x32c0db,_0x438fcd){_0x32c0db=_0x32c0db-0x0;var _0x323588=_0x6301[_0x32c0db];return _0x323588;};'use strict';var VoiceQueueEvents=require(_0x1630('0x0'));var events=[_0x1630('0x1'),_0x1630('0x2'),_0x1630('0x3')];function createListener(_0x18e7a8,_0x55f9fd){return function(_0x31a3fa){_0x55f9fd['emit'](_0x18e7a8,_0x31a3fa);};}function removeListener(_0xceff4,_0x18fac2){return function(){VoiceQueueEvents[_0x1630('0x4')](_0xceff4,_0x18fac2);};}exports['register']=function(_0x48c35d){for(var _0x135e3e=0x0,_0x1c675e=events[_0x1630('0x5')];_0x135e3e<_0x1c675e;_0x135e3e++){var _0x496099=events[_0x135e3e];var _0x374c93=createListener(_0x1630('0x6')+_0x496099,_0x48c35d);VoiceQueueEvents['on'](_0x496099,_0x374c93);}}; \ No newline at end of file +var _0xb97d=['emit','removeListener','register','length','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb97d,0xb3));var _0xdb97=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xb97d[_0x173d7e];return _0x2220d6;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xdb97('0x0'),_0xdb97('0x1'),_0xdb97('0x2')];function createListener(_0x24c847,_0x3a8ef0){return function(_0x245c91){_0x3a8ef0[_0xdb97('0x3')](_0x24c847,_0x245c91);};}function removeListener(_0x1d407c,_0x4548d8){return function(){VoiceQueueEvents[_0xdb97('0x4')](_0x1d407c,_0x4548d8);};}exports[_0xdb97('0x5')]=function(_0x48231d){for(var _0x3bee33=0x0,_0x1450aa=events[_0xdb97('0x6')];_0x3bee33<_0x1450aa;_0x3bee33++){var _0xd41c6=events[_0x3bee33];var _0x5172d7=createListener('voiceQueue:'+_0xd41c6,_0x48231d);VoiceQueueEvents['on'](_0xd41c6,_0x5172d7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e7c7d01..79d1ec5 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 _0xc4aa=['path','connect-timeout','express','Router','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','show','post','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x18a5b2,_0x38374b){var _0xafd6f9=function(_0x3ccc19){while(--_0x3ccc19){_0x18a5b2['push'](_0x18a5b2['shift']());}};_0xafd6f9(++_0x38374b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/index',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0x7')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0xd')]);router[_0xac4a('0xe')]('/',auth['isAuthenticated'](),controller[_0xac4a('0xf')]);router['put'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router[_0xac4a('0x12')](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x13')]);module[_0xac4a('0x14')]=router; \ No newline at end of file +var _0xeda8=['post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','show'];(function(_0x54c2b2,_0x31297c){var _0x20f4b9=function(_0x4a69f0){while(--_0x4a69f0){_0x54c2b2['push'](_0x54c2b2['shift']());}};_0x20f4b9(++_0x31297c);}(_0xeda8,0x104));var _0x8eda=function(_0x35ed6c,_0x4fbe8d){_0x35ed6c=_0x35ed6c-0x0;var _0x20c068=_0xeda8[_0x35ed6c];return _0x20c068;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var controller=require(_0x8eda('0x8'));router[_0x8eda('0x9')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xb')]);router[_0x8eda('0x9')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0xd')]);router[_0x8eda('0x9')](_0x8eda('0xe'),auth[_0x8eda('0xa')](),controller['getVoiceQueuesReport']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8eda('0xf')]);router[_0x8eda('0x10')]('/',auth[_0x8eda('0xa')](),controller['create']);router[_0x8eda('0x11')]('/:id',auth[_0x8eda('0xa')](),controller[_0x8eda('0x12')]);router[_0x8eda('0x13')](_0x8eda('0x14'),auth[_0x8eda('0xa')](),controller[_0x8eda('0x15')]);module[_0x8eda('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 56c4c2a..5ef9e37 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 _0x2801=['DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','STRING'];(function(_0x15bfd9,_0x1092cc){var _0x1c3816=function(_0x3c1048){while(--_0x3c1048){_0x15bfd9['push'](_0x15bfd9['shift']());}};_0x1c3816(++_0x1092cc);}(_0x2801,0xeb));var _0x1280=function(_0x57de69,_0x2b9a13){_0x57de69=_0x57de69-0x0;var _0x5a178b=_0x2801[_0x57de69];return _0x5a178b;};'use strict';var Sequelize=require(_0x1280('0x0'));var moment=require(_0x1280('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1280('0x2')]},'queue':{'type':Sequelize[_0x1280('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x1280('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x1280('0x3')],'set':function(_0x32b9e2){var _0x43dd29=moment(_0x32b9e2);var _0x5cffca=moment(this[_0x1280('0x4')](_0x1280('0x5')))[_0x1280('0x6')](_0x1280('0x7'));var _0x4414c0=_0x43dd29['diff'](_0x5cffca,_0x1280('0x8'));this['setDataValue'](_0x1280('0x9'),_0x32b9e2);this[_0x1280('0xa')]('holdtime',_0x4414c0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x1280('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x1280('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1280('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x1280('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1280('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x1280('0xd')},'originalposition':{'type':Sequelize[_0x1280('0xb')]},'channel':{'type':Sequelize[_0x1280('0x2')]},'connectedlinenum':{'type':Sequelize[_0x1280('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1280('0x2')]},'context':{'type':Sequelize[_0x1280('0x2')]},'exten':{'type':Sequelize[_0x1280('0x2')]},'priority':{'type':Sequelize[_0x1280('0x2')]},'holdtime':{'type':Sequelize[_0x1280('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1280('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1280('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1280('0x2')]},'transferuniqueid':{'type':Sequelize[_0x1280('0x2')]},'disposition':{'type':Sequelize[_0x1280('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x1280('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfa75=['sequelize','moment','exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x1001e3,_0x5a1c82){var _0x485632=function(_0x153a2d){while(--_0x153a2d){_0x1001e3['push'](_0x1001e3['shift']());}};_0x485632(++_0x5a1c82);}(_0xfa75,0x1ef));var _0x5fa7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfa75[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5fa7('0x0'));var moment=require(_0x5fa7('0x1'));module[_0x5fa7('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5fa7('0x3')]},'calleridnum':{'type':Sequelize[_0x5fa7('0x3')]},'calleridname':{'type':Sequelize[_0x5fa7('0x3')]},'queue':{'type':Sequelize[_0x5fa7('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x5fa7('0x4')],'set':function(_0xd10f54){var _0xbdec40=moment(_0xd10f54);var _0xcac7fd=moment(this[_0x5fa7('0x5')]('queuecallerjoinAt'))[_0x5fa7('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x9543ee=_0xbdec40[_0x5fa7('0x7')](_0xcac7fd,_0x5fa7('0x8'));this[_0x5fa7('0x9')](_0x5fa7('0xa'),_0xd10f54);this['setDataValue']('holdtime',_0x9543ee||null);}},'position':{'type':Sequelize[_0x5fa7('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x5fa7('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x5fa7('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x5fa7('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5fa7('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x5fa7('0xd')},'originalposition':{'type':Sequelize[_0x5fa7('0xb')]},'channel':{'type':Sequelize[_0x5fa7('0x3')]},'connectedlinenum':{'type':Sequelize[_0x5fa7('0x3')]},'connectedlinename':{'type':Sequelize[_0x5fa7('0x3')]},'accountcode':{'type':Sequelize[_0x5fa7('0x3')]},'context':{'type':Sequelize[_0x5fa7('0x3')]},'exten':{'type':Sequelize[_0x5fa7('0x3')]},'priority':{'type':Sequelize[_0x5fa7('0x3')]},'holdtime':{'type':Sequelize[_0x5fa7('0xb')]},'mohtime':{'type':Sequelize[_0x5fa7('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5fa7('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5fa7('0x3')],'comment':_0x5fa7('0xe')},'transferexten':{'type':Sequelize[_0x5fa7('0x3')]},'transferuniqueid':{'type':Sequelize[_0x5fa7('0x3')]},'disposition':{'type':Sequelize['STRING']},'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 cdac14a..9fe535d 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 _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e3d6054..7e64c18 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 _0xc2c1=['hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1ca6b1,_0x38900d){var _0x542c83=function(_0x22180d){while(--_0x22180d){_0x1ca6b1['push'](_0x1ca6b1['shift']());}};_0x542c83(++_0x38900d);}(_0xc2c1,0x76));var _0x1c2c=function(_0x2ed771,_0x4edc5f){_0x2ed771=_0x2ed771-0x0;var _0x569cc4=_0xc2c1[_0x2ed771];return _0x569cc4;};'use strict';var EventEmitter=require(_0x1c2c('0x0'));var VoiceQueueReport=require(_0x1c2c('0x1'))['db'][_0x1c2c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1c2c('0x3')](0x0);var events={'afterCreate':_0x1c2c('0x4'),'afterUpdate':_0x1c2c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x461d5e){return function(_0x4d712f,_0xb0896b,_0x324cc7){VoiceQueueReportEvents[_0x1c2c('0x6')](_0x461d5e+':'+_0x4d712f['id'],_0x4d712f);VoiceQueueReportEvents[_0x1c2c('0x6')](_0x461d5e,_0x4d712f);_0x324cc7(null);};}for(var e in events){if(events[_0x1c2c('0x7')](e)){var event=events[e];VoiceQueueReport[_0x1c2c('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x13f1=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0xd2fd27,_0x2f1a61){var _0x2bfe5a=function(_0x36be60){while(--_0x36be60){_0xd2fd27['push'](_0xd2fd27['shift']());}};_0x2bfe5a(++_0x2f1a61);}(_0x13f1,0x7d));var _0x113f=function(_0x5bcc17,_0x30d2e4){_0x5bcc17=_0x5bcc17-0x0;var _0x3daf41=_0x13f1[_0x5bcc17];return _0x3daf41;};'use strict';var EventEmitter=require(_0x113f('0x0'));var VoiceQueueReport=require(_0x113f('0x1'))['db'][_0x113f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x113f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x113f('0x4'),'afterDestroy':_0x113f('0x5')};function emitEvent(_0x29ad45){return function(_0x1f0e1a,_0x34702e,_0x1563c9){VoiceQueueReportEvents[_0x113f('0x6')](_0x29ad45+':'+_0x1f0e1a['id'],_0x1f0e1a);VoiceQueueReportEvents['emit'](_0x29ad45,_0x1f0e1a);_0x1563c9(null);};}for(var e in events){if(events[_0x113f('0x7')](e)){var event=events[e];VoiceQueueReport[_0x113f('0x8')](e,emitEvent(event));}}module[_0x113f('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8a627be..21b7d6d 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa6d4a5,_0x19825b){_0xa6d4a5=_0xa6d4a5-0x0;var _0x3f47aa=_0x5f2f[_0xa6d4a5];return _0x3f47aa;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x4080dc,_0x1e7d67){var _0x6e97ee=function(_0x2c1593){while(--_0x2c1593){_0x4080dc['push'](_0x4080dc['shift']());}};_0x6e97ee(++_0x1e7d67);}(_0x0b0e,0x187));var _0xe0b0=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x0b0e[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index b1ccab7..aed1025 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 _0x0658=['GetVoiceQueueReport','raw','options','where','attributes','include','map','model','stringify','VoiceQueueReport','CreateVoiceQueueReport','UpdateVoiceQueueReport','body','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','VoiceQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x9bb5e2,_0xddf4e7){var _0x1850d8=function(_0x162115){while(--_0x162115){_0x9bb5e2['push'](_0x9bb5e2['shift']());}};_0x1850d8(++_0xddf4e7);}(_0x0658,0xd5));var _0x8065=function(_0x4ebade,_0x2d7155){_0x4ebade=_0x4ebade-0x0;var _0x16a400=_0x0658[_0x4ebade];return _0x16a400;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8065('0x0'));var BPromise=require(_0x8065('0x1'));var rs=require(_0x8065('0x2'));var fs=require('fs');var Redis=require(_0x8065('0x3'));var db=require(_0x8065('0x4'))['db'];var utils=require(_0x8065('0x5'));var logger=require(_0x8065('0x6'))(_0x8065('0x7'));var config=require('../../config/environment');var jayson=require(_0x8065('0x8'));var client=jayson[_0x8065('0x9')][_0x8065('0xa')]({'port':0x232a});config['redis']=_[_0x8065('0xb')](config['redis'],{'host':_0x8065('0xc'),'port':0x18eb});var socket=require(_0x8065('0xd'))(new Redis(config[_0x8065('0xe')]));require(_0x8065('0xf'))['register'](socket);function respondWithRpcPromise(_0x3142ea,_0x3e7ebc,_0x1b437d){return new BPromise(function(_0x5b8412,_0x27834f){return client[_0x8065('0x10')](_0x3142ea,_0x1b437d)[_0x8065('0x11')](function(_0x1a2034){logger[_0x8065('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x3e7ebc,_0x8065('0x13'));logger[_0x8065('0x14')](_0x8065('0x15'),_0x3e7ebc,_0x8065('0x13'),JSON['stringify'](_0x1a2034));if(_0x1a2034[_0x8065('0x16')]){if(_0x1a2034[_0x8065('0x16')]['code']===0x1f4){logger[_0x8065('0x16')](_0x8065('0x17'),_0x3e7ebc,_0x1a2034[_0x8065('0x16')][_0x8065('0x18')]);return _0x27834f(_0x1a2034[_0x8065('0x16')][_0x8065('0x18')]);}logger[_0x8065('0x16')](_0x8065('0x17'),_0x3e7ebc,_0x1a2034[_0x8065('0x16')]['message']);return _0x5b8412(_0x1a2034['error'][_0x8065('0x18')]);}else{logger[_0x8065('0x12')](_0x8065('0x17'),_0x3e7ebc,_0x8065('0x13'));_0x5b8412(_0x1a2034[_0x8065('0x19')][_0x8065('0x18')]);}})[_0x8065('0x1a')](function(_0x2aa215){logger[_0x8065('0x16')](_0x8065('0x17'),_0x3e7ebc,_0x2aa215);_0x27834f(_0x2aa215);});});}exports[_0x8065('0x1b')]=function(_0x3e9998){var _0xf70f75=this;return new Promise(function(_0x4f373f,_0x41b423){return db['VoiceQueueReport']['findAll']({'raw':_0x3e9998['options']?_0x3e9998['options'][_0x8065('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e9998[_0x8065('0x1d')]?_0x3e9998[_0x8065('0x1d')][_0x8065('0x1e')]||null:null,'attributes':_0x3e9998[_0x8065('0x1d')]?_0x3e9998['options'][_0x8065('0x1f')]||null:null,'limit':_0x3e9998[_0x8065('0x1d')]?_0x3e9998[_0x8065('0x1d')]['limit']||null:null,'include':_0x3e9998[_0x8065('0x1d')]?_0x3e9998[_0x8065('0x1d')][_0x8065('0x20')]?_[_0x8065('0x21')](_0x3e9998[_0x8065('0x1d')][_0x8065('0x20')],function(_0x137d72){return{'model':db[_0x137d72[_0x8065('0x22')]],'as':_0x137d72['as'],'attributes':_0x137d72[_0x8065('0x1f')],'include':_0x137d72[_0x8065('0x20')]?_[_0x8065('0x21')](_0x137d72['include'],function(_0xfb9946){return{'model':db[_0xfb9946[_0x8065('0x22')]],'as':_0xfb9946['as'],'attributes':_0xfb9946['attributes'],'include':_0xfb9946[_0x8065('0x20')]?_[_0x8065('0x21')](_0xfb9946['include'],function(_0x195b31){return{'model':db[_0x195b31[_0x8065('0x22')]],'as':_0x195b31['as'],'attributes':_0x195b31[_0x8065('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8065('0x11')](function(_0x2267e8){logger['info'](_0x8065('0x1b'),_0x3e9998);logger[_0x8065('0x14')](_0x8065('0x1b'),_0x3e9998,JSON[_0x8065('0x23')](_0x2267e8));_0x4f373f(_0x2267e8);})[_0x8065('0x1a')](function(_0x233570){logger['error'](_0x8065('0x1b'),_0x233570[_0x8065('0x18')],_0x3e9998);_0x41b423(_0xf70f75[_0x8065('0x16')](0x1f4,_0x233570[_0x8065('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x5c220b){var _0x396e2a=this;return new Promise(function(_0x2fe047,_0x3eb1f5){return db[_0x8065('0x24')]['create'](_0x5c220b['body'],{'raw':_0x5c220b[_0x8065('0x1d')]?_0x5c220b[_0x8065('0x1d')][_0x8065('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4a0de2){logger['info'](_0x8065('0x25'),_0x5c220b);logger[_0x8065('0x14')](_0x8065('0x25'),_0x5c220b,JSON[_0x8065('0x23')](_0x4a0de2));_0x2fe047(_0x4a0de2);})[_0x8065('0x1a')](function(_0xfa6e36){logger[_0x8065('0x16')]('CreateVoiceQueueReport',_0xfa6e36[_0x8065('0x18')],_0x5c220b);_0x3eb1f5(_0x396e2a[_0x8065('0x16')](0x1f4,_0xfa6e36[_0x8065('0x18')]));});});};exports[_0x8065('0x26')]=function(_0x79bba){var _0x40f4eb=this;return new Promise(function(_0x4709bb,_0x5434fd){return db['VoiceQueueReport']['update'](_0x79bba[_0x8065('0x27')],{'raw':_0x79bba[_0x8065('0x1d')]?_0x79bba[_0x8065('0x1d')][_0x8065('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x79bba['options']?_0x79bba['options']['where']||null:null,'attributes':_0x79bba[_0x8065('0x1d')]?_0x79bba[_0x8065('0x1d')][_0x8065('0x1f')]||null:null,'limit':_0x79bba[_0x8065('0x1d')]?_0x79bba[_0x8065('0x1d')]['limit']||null:null})[_0x8065('0x11')](function(_0xa81452){logger[_0x8065('0x12')](_0x8065('0x26'),_0x79bba);logger[_0x8065('0x14')](_0x8065('0x26'),_0x79bba,JSON[_0x8065('0x23')](_0xa81452));_0x4709bb(_0xa81452);})[_0x8065('0x1a')](function(_0x13d2d2){logger[_0x8065('0x16')](_0x8065('0x26'),_0x13d2d2[_0x8065('0x18')],_0x79bba);_0x5434fd(_0x40f4eb[_0x8065('0x16')](0x1f4,_0x13d2d2[_0x8065('0x18')]));});});}; \ No newline at end of file +var _0x1e32=['./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','where','attributes','map','include','model','CreateVoiceQueueReport','VoiceQueueReport','create','raw','update','body','limit','UpdateVoiceQueueReport','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x1e32,0xf0));var _0x21e3=function(_0x3cf69c,_0x24efb0){_0x3cf69c=_0x3cf69c-0x0;var _0x1de7d=_0x1e32[_0x3cf69c];return _0x1de7d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x21e3('0x0'));var BPromise=require(_0x21e3('0x1'));var rs=require(_0x21e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21e3('0x3'))['db'];var utils=require(_0x21e3('0x4'));var logger=require(_0x21e3('0x5'))('rpc');var config=require(_0x21e3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x21e3('0x7')][_0x21e3('0x8')]({'port':0x232a});config[_0x21e3('0x9')]=_[_0x21e3('0xa')](config[_0x21e3('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x21e3('0xb'))(new Redis(config[_0x21e3('0x9')]));require(_0x21e3('0xc'))[_0x21e3('0xd')](socket);function respondWithRpcPromise(_0xa1c4d3,_0x5284d4,_0x1b81f0){return new BPromise(function(_0x276d81,_0x37bdb0){return client[_0x21e3('0xe')](_0xa1c4d3,_0x1b81f0)[_0x21e3('0xf')](function(_0x4142de){logger[_0x21e3('0x10')](_0x21e3('0x11'),_0x5284d4,_0x21e3('0x12'));logger[_0x21e3('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5284d4,'request\x20sent',JSON[_0x21e3('0x14')](_0x4142de));if(_0x4142de[_0x21e3('0x15')]){if(_0x4142de[_0x21e3('0x15')][_0x21e3('0x16')]===0x1f4){logger[_0x21e3('0x15')](_0x21e3('0x11'),_0x5284d4,_0x4142de[_0x21e3('0x15')][_0x21e3('0x17')]);return _0x37bdb0(_0x4142de[_0x21e3('0x15')][_0x21e3('0x17')]);}logger['error'](_0x21e3('0x11'),_0x5284d4,_0x4142de[_0x21e3('0x15')][_0x21e3('0x17')]);return _0x276d81(_0x4142de['error'][_0x21e3('0x17')]);}else{logger[_0x21e3('0x10')](_0x21e3('0x11'),_0x5284d4,'request\x20sent');_0x276d81(_0x4142de[_0x21e3('0x18')]['message']);}})[_0x21e3('0x19')](function(_0x17fac4){logger['error'](_0x21e3('0x11'),_0x5284d4,_0x17fac4);_0x37bdb0(_0x17fac4);});});}exports[_0x21e3('0x1a')]=function(_0x53380c){var _0x55e1ce=this;return new Promise(function(_0x3c76ad,_0x4f2d8e){return db['VoiceQueueReport'][_0x21e3('0x1b')]({'raw':_0x53380c[_0x21e3('0x1c')]?_0x53380c[_0x21e3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x53380c[_0x21e3('0x1c')]?_0x53380c['options'][_0x21e3('0x1d')]||null:null,'attributes':_0x53380c[_0x21e3('0x1c')]?_0x53380c['options'][_0x21e3('0x1e')]||null:null,'limit':_0x53380c[_0x21e3('0x1c')]?_0x53380c[_0x21e3('0x1c')]['limit']||null:null,'include':_0x53380c['options']?_0x53380c['options']['include']?_[_0x21e3('0x1f')](_0x53380c[_0x21e3('0x1c')][_0x21e3('0x20')],function(_0x23cef5){return{'model':db[_0x23cef5[_0x21e3('0x21')]],'as':_0x23cef5['as'],'attributes':_0x23cef5[_0x21e3('0x1e')],'include':_0x23cef5[_0x21e3('0x20')]?_['map'](_0x23cef5[_0x21e3('0x20')],function(_0x2ae223){return{'model':db[_0x2ae223[_0x21e3('0x21')]],'as':_0x2ae223['as'],'attributes':_0x2ae223['attributes'],'include':_0x2ae223[_0x21e3('0x20')]?_[_0x21e3('0x1f')](_0x2ae223[_0x21e3('0x20')],function(_0x34c88d){return{'model':db[_0x34c88d[_0x21e3('0x21')]],'as':_0x34c88d['as'],'attributes':_0x34c88d[_0x21e3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x21e3('0xf')](function(_0x49e962){logger[_0x21e3('0x10')](_0x21e3('0x1a'),_0x53380c);logger['debug']('GetVoiceQueueReport',_0x53380c,JSON[_0x21e3('0x14')](_0x49e962));_0x3c76ad(_0x49e962);})[_0x21e3('0x19')](function(_0x2ec6de){logger['error'](_0x21e3('0x1a'),_0x2ec6de[_0x21e3('0x17')],_0x53380c);_0x4f2d8e(_0x55e1ce[_0x21e3('0x15')](0x1f4,_0x2ec6de['message']));});});};exports[_0x21e3('0x22')]=function(_0x19930f){var _0x2eab14=this;return new Promise(function(_0x16e73a,_0x4548f4){return db[_0x21e3('0x23')][_0x21e3('0x24')](_0x19930f['body'],{'raw':_0x19930f['options']?_0x19930f[_0x21e3('0x1c')][_0x21e3('0x25')]===undefined?!![]:![]:!![]})[_0x21e3('0xf')](function(_0x11fc60){logger[_0x21e3('0x10')](_0x21e3('0x22'),_0x19930f);logger[_0x21e3('0x13')](_0x21e3('0x22'),_0x19930f,JSON[_0x21e3('0x14')](_0x11fc60));_0x16e73a(_0x11fc60);})[_0x21e3('0x19')](function(_0x1bc27a){logger['error'](_0x21e3('0x22'),_0x1bc27a['message'],_0x19930f);_0x4548f4(_0x2eab14[_0x21e3('0x15')](0x1f4,_0x1bc27a[_0x21e3('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x449079){var _0x1a004c=this;return new Promise(function(_0x2cc06e,_0xbe21c){return db['VoiceQueueReport'][_0x21e3('0x26')](_0x449079[_0x21e3('0x27')],{'raw':_0x449079[_0x21e3('0x1c')]?_0x449079[_0x21e3('0x1c')][_0x21e3('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x449079[_0x21e3('0x1c')]?_0x449079[_0x21e3('0x1c')][_0x21e3('0x1d')]||null:null,'attributes':_0x449079[_0x21e3('0x1c')]?_0x449079[_0x21e3('0x1c')][_0x21e3('0x1e')]||null:null,'limit':_0x449079[_0x21e3('0x1c')]?_0x449079['options'][_0x21e3('0x28')]||null:null})[_0x21e3('0xf')](function(_0x558777){logger[_0x21e3('0x10')]('UpdateVoiceQueueReport',_0x449079);logger[_0x21e3('0x13')](_0x21e3('0x29'),_0x449079,JSON[_0x21e3('0x14')](_0x558777));_0x2cc06e(_0x558777);})[_0x21e3('0x19')](function(_0x999bb1){logger[_0x21e3('0x15')](_0x21e3('0x29'),_0x999bb1[_0x21e3('0x17')],_0x449079);_0xbe21c(_0x1a004c[_0x21e3('0x15')](0x1f4,_0x999bb1[_0x21e3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3f792de..5093eb9 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 _0x86f2=['emit','voiceQueueReport:','save','update'];(function(_0x23bf88,_0x279a37){var _0x15f6cc=function(_0x3e987f){while(--_0x3e987f){_0x23bf88['push'](_0x23bf88['shift']());}};_0x15f6cc(++_0x279a37);}(_0x86f2,0x116));var _0x286f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x86f2[_0x501510];return _0x1e6ee5;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x286f('0x0'),'remove',_0x286f('0x1')];function createListener(_0x2edc56,_0x141f76){return function(_0x2622e6){_0x141f76[_0x286f('0x2')](_0x2edc56,_0x2622e6);};}function removeListener(_0x7d3371,_0x4e3747){return function(){VoiceQueueReportEvents['removeListener'](_0x7d3371,_0x4e3747);};}exports['register']=function(_0x8749ab){for(var _0x35c493=0x0,_0x3bda23=events['length'];_0x35c493<_0x3bda23;_0x35c493++){var _0x4447a1=events[_0x35c493];var _0x4337fc=createListener(_0x286f('0x3')+_0x4447a1,_0x8749ab);VoiceQueueReportEvents['on'](_0x4447a1,_0x4337fc);}}; \ No newline at end of file +var _0xef27=['emit','removeListener','register','length','./voiceQueueReport.events','save','remove','update'];(function(_0x5db679,_0x42b32a){var _0x4f9619=function(_0x1cb551){while(--_0x1cb551){_0x5db679['push'](_0x5db679['shift']());}};_0x4f9619(++_0x42b32a);}(_0xef27,0x1ec));var _0x7ef2=function(_0xab5158,_0x1c7940){_0xab5158=_0xab5158-0x0;var _0x1be21d=_0xef27[_0xab5158];return _0x1be21d;};'use strict';var VoiceQueueReportEvents=require(_0x7ef2('0x0'));var events=[_0x7ef2('0x1'),_0x7ef2('0x2'),_0x7ef2('0x3')];function createListener(_0x315e05,_0x48099a){return function(_0x49e715){_0x48099a[_0x7ef2('0x4')](_0x315e05,_0x49e715);};}function removeListener(_0x5031d4,_0x2e5bd8){return function(){VoiceQueueReportEvents[_0x7ef2('0x5')](_0x5031d4,_0x2e5bd8);};}exports[_0x7ef2('0x6')]=function(_0x25e05c){for(var _0x21a7cc=0x0,_0x448491=events[_0x7ef2('0x7')];_0x21a7cc<_0x448491;_0x21a7cc++){var _0x5187b2=events[_0x21a7cc];var _0x3bb096=createListener('voiceQueueReport:'+_0x5187b2,_0x25e05c);VoiceQueueReportEvents['on'](_0x5187b2,_0x3bb096);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 8719fe4..e288892 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 _0x1ea9=['create','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4d865f,_0xb6abcd){var _0x11ad6c=function(_0x78afd9){while(--_0x78afd9){_0x4d865f['push'](_0x4d865f['shift']());}};_0x11ad6c(++_0xb6abcd);}(_0x1ea9,0x1b5));var _0x91ea=function(_0xb50629,_0x3d4410){_0xb50629=_0xb50629-0x0;var _0x45699a=_0x1ea9[_0xb50629];return _0x45699a;};'use strict';var multer=require('multer');var util=require(_0x91ea('0x0'));var path=require('path');var timeout=require(_0x91ea('0x1'));var express=require(_0x91ea('0x2'));var router=express[_0x91ea('0x3')]();var auth=require(_0x91ea('0x4'));var interaction=require(_0x91ea('0x5'));var config=require(_0x91ea('0x6'));var controller=require(_0x91ea('0x7'));router[_0x91ea('0x8')]('/',auth[_0x91ea('0x9')](),controller[_0x91ea('0xa')]);router['get'](_0x91ea('0xb'),auth['isAuthenticated'](),controller[_0x91ea('0xc')]);router['post']('/',auth[_0x91ea('0x9')](),controller[_0x91ea('0xd')]);router[_0x91ea('0xe')]('/:id',auth[_0x91ea('0x9')](),controller[_0x91ea('0xf')]);router['delete'](_0x91ea('0xb'),auth[_0x91ea('0x9')](),controller[_0x91ea('0x10')]);module[_0x91ea('0x11')]=router; \ No newline at end of file +var _0xf6da=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2d677d,_0x122732){var _0x27356c=function(_0x2abe54){while(--_0x2abe54){_0x2d677d['push'](_0x2d677d['shift']());}};_0x27356c(++_0x122732);}(_0xf6da,0x19f));var _0xaf6d=function(_0x10312f,_0x25302b){_0x10312f=_0x10312f-0x0;var _0x2e95c7=_0xf6da[_0x10312f];return _0x2e95c7;};'use strict';var multer=require(_0xaf6d('0x0'));var util=require(_0xaf6d('0x1'));var path=require(_0xaf6d('0x2'));var timeout=require(_0xaf6d('0x3'));var express=require(_0xaf6d('0x4'));var router=express[_0xaf6d('0x5')]();var auth=require(_0xaf6d('0x6'));var interaction=require(_0xaf6d('0x7'));var config=require(_0xaf6d('0x8'));var controller=require(_0xaf6d('0x9'));router['get']('/',auth[_0xaf6d('0xa')](),controller[_0xaf6d('0xb')]);router[_0xaf6d('0xc')](_0xaf6d('0xd'),auth[_0xaf6d('0xa')](),controller[_0xaf6d('0xe')]);router[_0xaf6d('0xf')]('/',auth[_0xaf6d('0xa')](),controller['create']);router[_0xaf6d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xaf6d('0x11')]);router[_0xaf6d('0x12')](_0xaf6d('0xd'),auth[_0xaf6d('0xa')](),controller[_0xaf6d('0x13')]);module[_0xaf6d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 2235107..c8cd4fb 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 _0x5ce1=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x396164,_0x5007c3){var _0x44f980=function(_0x3d9822){while(--_0x3d9822){_0x396164['push'](_0x396164['shift']());}};_0x44f980(++_0x5007c3);}(_0x5ce1,0x136));var _0x15ce=function(_0x3cfefd,_0x25b0ba){_0x3cfefd=_0x3cfefd-0x0;var _0x162db6=_0x5ce1[_0x3cfefd];return _0x162db6;};'use strict';var Sequelize=require(_0x15ce('0x0'));var moment=require(_0x15ce('0x1'));module[_0x15ce('0x2')]={'time':{'type':Sequelize[_0x15ce('0x3')]},'callid':{'type':Sequelize[_0x15ce('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x15ce('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x15ce('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x15ce('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x15ce('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x15ce('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x15ce('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x15ce('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x15ce('0x4')],'allowNull':![],'defaultValue':moment()[_0x15ce('0x5')](_0x15ce('0x6'))}}; \ No newline at end of file +var _0xdb2f=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xdb2f,0xb5));var _0xfdb2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdb2f[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xfdb2('0x0'));var moment=require(_0xfdb2('0x1'));module[_0xfdb2('0x2')]={'time':{'type':Sequelize[_0xfdb2('0x3')]},'callid':{'type':Sequelize[_0xfdb2('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfdb2('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfdb2('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfdb2('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfdb2('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfdb2('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfdb2('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfdb2('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfdb2('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xfdb2('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index eb59e73..b535473 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','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','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x32fb8d,_0x567a64){var _0x37cf13=function(_0x28bf81){while(--_0x28bf81){_0x32fb8d['push'](_0x32fb8d['shift']());}};_0x37cf13(++_0x567a64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0xf99f2a,_0x424d44){var _0x21ebf4=function(_0x3d852d){while(--_0x3d852d){_0xf99f2a['push'](_0xf99f2a['shift']());}};_0x21ebf4(++_0x424d44);}(_0xb10b,0x12a));var _0xbb10=function(_0x1833cd,_0x369128){_0x1833cd=_0x1833cd-0x0;var _0x4360ac=_0xb10b[_0x1833cd];return _0x4360ac;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e54cbd2..356e043 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 _0xf622=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','event','lodash','util','../../config/logger'];(function(_0x77771f,_0x4d18f2){var _0x435d6d=function(_0x687771){while(--_0x687771){_0x77771f['push'](_0x77771f['shift']());}};_0x435d6d(++_0x4d18f2);}(_0xf622,0x19d));var _0x2f62=function(_0x384e5a,_0x16deb9){_0x384e5a=_0x384e5a-0x0;var _0x2f3b54=_0xf622[_0x384e5a];return _0x2f3b54;};'use strict';var _=require(_0x2f62('0x0'));var util=require(_0x2f62('0x1'));var logger=require(_0x2f62('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2f62('0x3'));var rp=require(_0x2f62('0x4'));var fs=require('fs');var path=require(_0x2f62('0x5'));var rimraf=require(_0x2f62('0x6'));var config=require(_0x2f62('0x7'));var attributes=require(_0x2f62('0x8'));module['exports']=function(_0x5e46f6,_0x4bb5ce){return _0x5e46f6[_0x2f62('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x2f62('0xa'),'paranoid':![],'indexes':[{'name':_0x2f62('0xb'),'fields':[_0x2f62('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x3489=['event_dtm','event','dtm','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x3489,0x183));var _0x9348=function(_0xad3710,_0x11199b){_0xad3710=_0xad3710-0x0;var _0x359347=_0x3489[_0xad3710];return _0x359347;};'use strict';var _=require(_0x9348('0x0'));var util=require(_0x9348('0x1'));var logger=require('../../config/logger')(_0x9348('0x2'));var moment=require(_0x9348('0x3'));var BPromise=require(_0x9348('0x4'));var rp=require(_0x9348('0x5'));var fs=require('fs');var path=require(_0x9348('0x6'));var rimraf=require(_0x9348('0x7'));var config=require('../../config/environment');var attributes=require(_0x9348('0x8'));module[_0x9348('0x9')]=function(_0x2a3919,_0x5bf06f){return _0x2a3919[_0x9348('0xa')](_0x9348('0xb'),attributes,{'tableName':_0x9348('0xc'),'paranoid':![],'indexes':[{'name':_0x9348('0xd'),'fields':[_0x9348('0xe'),_0x9348('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3a7da05..c7b5886 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 _0x97c1=['../../config/logger','rpc','../../config/environment','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x2a4302,_0x4f8b78){var _0x18360c=function(_0x2bcde1){while(--_0x2bcde1){_0x2a4302['push'](_0x2a4302['shift']());}};_0x18360c(++_0x4f8b78);}(_0x97c1,0xdf));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});} \ No newline at end of file +var _0x7894=['request','info','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xd15cd4,_0x57e17b){var _0x18afa0=function(_0xe1d31c){while(--_0xe1d31c){_0xd15cd4['push'](_0xd15cd4['shift']());}};_0x18afa0(++_0x57e17b);}(_0x7894,0x170));var _0x4789=function(_0x2fe2a9,_0x3cf47e){_0x2fe2a9=_0x2fe2a9-0x0;var _0x2dda69=_0x7894[_0x2fe2a9];return _0x2dda69;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var moment=require(_0x4789('0x2'));var BPromise=require(_0x4789('0x3'));var rs=require(_0x4789('0x4'));var fs=require('fs');var Redis=require(_0x4789('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4789('0x6'));var logger=require(_0x4789('0x7'))('rpc');var config=require(_0x4789('0x8'));var jayson=require(_0x4789('0x9'));var client=jayson[_0x4789('0xa')][_0x4789('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114a90,_0x298902,_0x13b7f6){return new BPromise(function(_0x5a45ae,_0x49d256){return client[_0x4789('0xc')](_0x114a90,_0x13b7f6)['then'](function(_0x2e8038){logger[_0x4789('0xd')](_0x4789('0xe'),_0x298902,'request\x20sent');logger[_0x4789('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x298902,_0x4789('0x10'),JSON[_0x4789('0x11')](_0x2e8038));if(_0x2e8038[_0x4789('0x12')]){if(_0x2e8038['error']['code']===0x1f4){logger[_0x4789('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x298902,_0x2e8038[_0x4789('0x12')]['message']);return _0x49d256(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}logger['error'](_0x4789('0xe'),_0x298902,_0x2e8038['error'][_0x4789('0x13')]);return _0x5a45ae(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}else{logger['info'](_0x4789('0xe'),_0x298902,_0x4789('0x10'));_0x5a45ae(_0x2e8038['result'][_0x4789('0x13')]);}})['catch'](function(_0x118f97){logger[_0x4789('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x298902,_0x118f97);_0x49d256(_0x118f97);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index df11811..8535d94 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 _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0xfd4a1e,_0x2b25c3){var _0x104daa=function(_0x5a4e3c){while(--_0x5a4e3c){_0xfd4a1e['push'](_0xfd4a1e['shift']());}};_0x104daa(++_0x2b25c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0xbf1788,_0xfabad0){var _0x51c4d1=function(_0x59633e){while(--_0x59633e){_0xbf1788['push'](_0xbf1788['shift']());}};_0x51c4d1(++_0xfabad0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1bb557a..3e765a0 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 _0x9029=['exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','split','INTEGER','NEW','TEXT','FLOAT','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','moment','path'];(function(_0x428ed1,_0x19dc81){var _0x64bbf6=function(_0x243631){while(--_0x243631){_0x428ed1['push'](_0x428ed1['shift']());}};_0x64bbf6(++_0x19dc81);}(_0x9029,0x13e));var _0x9902=function(_0x110a0d,_0x45efb3){_0x110a0d=_0x110a0d-0x0;var _0x3e3820=_0x9029[_0x110a0d];return _0x3e3820;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9902('0x0'));var path=require(_0x9902('0x1'));module[_0x9902('0x2')]={'format':{'type':Sequelize[_0x9902('0x3')],'get':function(){return this[_0x9902('0x4')](_0x9902('0x5'))?path[_0x9902('0x6')](this[_0x9902('0x4')](_0x9902('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x9902('0x7')]},'channel':{'type':Sequelize[_0x9902('0x7')],'set':function(_0x1ae698){if(_0x1ae698){this[_0x9902('0x8')](_0x9902('0x9'),_0x1ae698);this['setDataValue']('membername',_0x1ae698[_0x9902('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x9902('0x7')]},'calleridnum':{'type':Sequelize[_0x9902('0x7')]},'calleridname':{'type':Sequelize[_0x9902('0x7')]},'connectedlinenum':{'type':Sequelize[_0x9902('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9902('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9902('0x7')]},'value':{'type':Sequelize[_0x9902('0x7')]},'type':{'type':Sequelize[_0x9902('0x7')]},'rating':{'type':Sequelize[_0x9902('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x9902('0x7')]},'userDisposition':{'type':Sequelize[_0x9902('0x7')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x9902('0x7')]},'transcribeStatus':{'type':Sequelize[_0x9902('0x7')],'defaultValue':_0x9902('0xc')},'fileUri':{'type':Sequelize[_0x9902('0xd')]},'fileText':{'type':Sequelize[_0x9902('0xd')]},'failureReason':{'type':Sequelize[_0x9902('0xd')]},'sentiment':{'type':Sequelize[_0x9902('0x7')]},'sPositive':{'type':Sequelize[_0x9902('0xe')]},'sNegative':{'type':Sequelize[_0x9902('0xe')]},'sNeutral':{'type':Sequelize[_0x9902('0xe')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x9902('0xf')],'get':function(){return moment(this[_0x9902('0x4')](_0x9902('0x10')))[_0x9902('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9902('0x4')]('updatedAt'))['format'](_0x9902('0x12'))[_0x9902('0x13')]();}}}; \ No newline at end of file +var _0x7ec6=['createdAt','format','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','exports','getDataValue','extname','value','STRING','setDataValue','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE'];(function(_0x5cc5f8,_0x17ba2f){var _0x24c9b4=function(_0xf561f6){while(--_0xf561f6){_0x5cc5f8['push'](_0x5cc5f8['shift']());}};_0x24c9b4(++_0x17ba2f);}(_0x7ec6,0x180));var _0x67ec=function(_0x1da10a,_0x1fe948){_0x1da10a=_0x1da10a-0x0;var _0x5aea64=_0x7ec6[_0x1da10a];return _0x5aea64;};'use strict';var Sequelize=require(_0x67ec('0x0'));var moment=require('moment');var path=require('path');module[_0x67ec('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x67ec('0x2')]('value')?path[_0x67ec('0x3')](this[_0x67ec('0x2')](_0x67ec('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x67ec('0x5')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x21a37d){if(_0x21a37d){this[_0x67ec('0x6')]('channel',_0x21a37d);this['setDataValue'](_0x67ec('0x7'),_0x21a37d[_0x67ec('0x8')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x67ec('0x5')]},'calleridnum':{'type':Sequelize[_0x67ec('0x5')]},'calleridname':{'type':Sequelize[_0x67ec('0x5')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x67ec('0x5')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x67ec('0x5')]},'value':{'type':Sequelize[_0x67ec('0x5')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x67ec('0x9')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x67ec('0x5')]},'userDisposition':{'type':Sequelize[_0x67ec('0x5')]},'location':{'type':Sequelize[_0x67ec('0xa')]},'transcribeName':{'type':Sequelize[_0x67ec('0x5')]},'transcribeStatus':{'type':Sequelize[_0x67ec('0x5')],'defaultValue':_0x67ec('0xb')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x67ec('0xa')]},'failureReason':{'type':Sequelize[_0x67ec('0xa')]},'sentiment':{'type':Sequelize[_0x67ec('0x5')]},'sPositive':{'type':Sequelize[_0x67ec('0xc')]},'sNegative':{'type':Sequelize[_0x67ec('0xc')]},'sNeutral':{'type':Sequelize[_0x67ec('0xc')]},'sMixed':{'type':Sequelize[_0x67ec('0xc')]},'tempSentiment':{'type':Sequelize[_0x67ec('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x67ec('0xe')],'get':function(){return moment(this['getDataValue'](_0x67ec('0xf')))[_0x67ec('0x10')](_0x67ec('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x67ec('0xe')],'get':function(){return moment(this['getDataValue'](_0x67ec('0x12')))[_0x67ec('0x10')](_0x67ec('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 35ab1d3..7af69b3 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 _0x11f2=['Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','catch','show','params','length','find','create','body','describe','download','../../components/encryptor','uniqueid','value','secrets','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','MD5','col','$and','push','%s.cypher','decryptFile','recording','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentiment','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','downloadTranscribe','fileText','root','.txt'];(function(_0x378d90,_0x62ae32){var _0x46debe=function(_0x260ce2){while(--_0x260ce2){_0x378d90['push'](_0x378d90['shift']());}};_0x46debe(++_0x62ae32);}(_0x11f2,0x95));var _0x211f=function(_0x19c773,_0x18b116){_0x19c773=_0x19c773-0x0;var _0x441de7=_0x11f2[_0x19c773];return _0x441de7;};'use strict';var pdf=require(_0x211f('0x0'));var emlformat=require(_0x211f('0x1'));var rimraf=require(_0x211f('0x2'));var zipdir=require(_0x211f('0x3'));var jsonpatch=require(_0x211f('0x4'));var rp=require(_0x211f('0x5'));var moment=require(_0x211f('0x6'));var BPromise=require(_0x211f('0x7'));var Mustache=require('mustache');var util=require(_0x211f('0x8'));var path=require(_0x211f('0x9'));var sox=require('sox');var csv=require(_0x211f('0xa'));var ejs=require(_0x211f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x211f('0xc'));var jsforce=require(_0x211f('0xd'));var deskjs=require(_0x211f('0xe'));var toCsv=require(_0x211f('0xa'));var querystring=require(_0x211f('0xf'));var Papa=require(_0x211f('0x10'));var AWS=require(_0x211f('0x11'));var uuidv4=require('uuid/v4');var Redis=require(_0x211f('0x12'));var authService=require(_0x211f('0x13'));var qs=require(_0x211f('0x14'));var as=require(_0x211f('0x15'));var hardwareService=require(_0x211f('0x16'));var logger=require(_0x211f('0x17'))(_0x211f('0x18'));var utils=require(_0x211f('0x19'));var config=require(_0x211f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8954da,_0x48df1c){_0x48df1c=_0x48df1c||0xcc;return function(_0x5dc175){if(_0x5dc175){return _0x8954da['sendStatus'](_0x48df1c);}return _0x8954da[_0x211f('0x1b')](_0x48df1c)[_0x211f('0x1c')]();};}function respondWithResult(_0x533d44,_0x465432){_0x465432=_0x465432||0xc8;return function(_0x4c2b9c){if(_0x4c2b9c){return _0x533d44['status'](_0x465432)[_0x211f('0x1d')](_0x4c2b9c);}};}function respondWithFilteredResult(_0x67eb4d,_0x1a04c5){return function(_0x1fa017){if(_0x1fa017){var _0x23fb95=_0x1fa017[_0x211f('0x1e')],_0xce108d=_0x1a04c5[_0x211f('0x1f')],_0x120be5=_0x1a04c5[_0x211f('0x1f')]+_0x1a04c5['limit'],_0x563ff2;if(_0x120be5>=_0x23fb95){_0x120be5=_0x23fb95;_0x563ff2=0xc8;}else{_0x563ff2=0xce;}_0x67eb4d['status'](_0x563ff2);return _0x67eb4d[_0x211f('0x20')](_0x211f('0x21'),_0xce108d+'-'+_0x120be5+'/'+_0x23fb95)['json'](_0x1fa017);}return null;};}function patchUpdates(_0x35ad0d){return function(_0x26f0db){try{jsonpatch[_0x211f('0x22')](_0x26f0db,_0x35ad0d,!![]);}catch(_0x4aeeee){return BPromise[_0x211f('0x23')](_0x4aeeee);}return _0x26f0db[_0x211f('0x24')]();};}function saveUpdates(_0x2aa161,_0x1e42f8){return function(_0x50fe28){if(_0x50fe28){return _0x50fe28[_0x211f('0x25')](_0x2aa161)[_0x211f('0x26')](function(_0x4757ec){return _0x4757ec;});}return null;};}function removeEntity(_0xaac14b,_0x3c80aa){return function(_0x2d12ba){if(_0x2d12ba){return _0x2d12ba['destroy']()['then'](function(){_0xaac14b['status'](0xcc)[_0x211f('0x1c')]();});}};}function handleEntityNotFound(_0x49539c,_0x2af265){return function(_0x5ede26){if(!_0x5ede26){_0x49539c[_0x211f('0x27')](0x194);}return _0x5ede26;};}function handleError(_0x1ae0ff,_0x3a77f4){_0x3a77f4=_0x3a77f4||0x1f4;return function(_0x549b87){logger['error'](_0x549b87[_0x211f('0x28')]);if(_0x549b87[_0x211f('0x29')]){delete _0x549b87[_0x211f('0x29')];}_0x1ae0ff[_0x211f('0x1b')](_0x3a77f4)[_0x211f('0x2a')](_0x549b87);};}exports[_0x211f('0x2b')]=function(_0xaca1f5,_0x33da5d){var _0x446d76={},_0x22ab36={},_0x4d3a96={'count':0x0,'rows':[]};var _0x4585db=_[_0x211f('0x2c')](db[_0x211f('0x2d')][_0x211f('0x2e')],function(_0x2fbcb3){return{'name':_0x2fbcb3[_0x211f('0x2f')],'type':_0x2fbcb3[_0x211f('0x30')]['key']};});_0x22ab36[_0x211f('0x31')]=_['differenceBy'](_['map'](_0x4585db,'name'),[_0x211f('0x32')]);_0x22ab36[_0x211f('0x33')]=_[_0x211f('0x34')](_0xaca1f5[_0x211f('0x33')]);_0x22ab36[_0x211f('0x35')]=_[_0x211f('0x36')](_0x22ab36[_0x211f('0x31')],_0x22ab36[_0x211f('0x33')]);_0x446d76[_0x211f('0x37')]=_[_0x211f('0x36')](_0x22ab36[_0x211f('0x31')],qs[_0x211f('0x38')](_0xaca1f5['query']['fields']));_0x446d76[_0x211f('0x37')]=_0x446d76[_0x211f('0x37')]['length']?_0x446d76[_0x211f('0x37')]:_0x22ab36[_0x211f('0x31')];if(!_0xaca1f5[_0x211f('0x33')][_0x211f('0x39')](_0x211f('0x3a'))){_0x446d76[_0x211f('0x3b')]=qs[_0x211f('0x3b')](_0xaca1f5[_0x211f('0x33')][_0x211f('0x3b')]);_0x446d76['offset']=qs[_0x211f('0x1f')](_0xaca1f5[_0x211f('0x33')][_0x211f('0x1f')]);}_0x446d76['order']=qs['sort'](_0xaca1f5[_0x211f('0x33')][_0x211f('0x3c')]);_0x446d76[_0x211f('0x3d')]=qs['filters'](_[_0x211f('0x3e')](_0xaca1f5[_0x211f('0x33')],_0x22ab36[_0x211f('0x35')]),_0x4585db);if(_0xaca1f5[_0x211f('0x33')][_0x211f('0x3f')]){_0x446d76['where']=_['merge'](_0x446d76[_0x211f('0x3d')],{'$or':_[_0x211f('0x2c')](_0x4585db,function(_0x22284d){if(_0x22284d[_0x211f('0x30')]!==_0x211f('0x40')){var _0x5e510f={};_0x5e510f[_0x22284d[_0x211f('0x29')]]={'$like':'%'+_0xaca1f5[_0x211f('0x33')][_0x211f('0x3f')]+'%'};return _0x5e510f;}})});}_0x446d76=_[_0x211f('0x41')]({},_0x446d76,_0xaca1f5[_0x211f('0x42')]);var _0x4fbd5={'where':_0x446d76[_0x211f('0x3d')]};return db[_0x211f('0x2d')][_0x211f('0x1e')](_0x4fbd5)[_0x211f('0x26')](function(_0x541fbe){_0x4d3a96[_0x211f('0x1e')]=_0x541fbe;if(_0xaca1f5[_0x211f('0x33')][_0x211f('0x43')]){_0x446d76['include']=[{'all':!![]}];}return db[_0x211f('0x2d')]['findAll'](_0x446d76);})[_0x211f('0x26')](function(_0x336582){_0x4d3a96['rows']=_0x336582;return _0x4d3a96;})[_0x211f('0x26')](respondWithFilteredResult(_0x33da5d,_0x446d76))[_0x211f('0x44')](handleError(_0x33da5d,null));};exports[_0x211f('0x45')]=function(_0x1ca5a6,_0x32fff3){var _0x24bc6a={'raw':![],'where':{'id':_0x1ca5a6[_0x211f('0x46')]['id']}},_0x332ed2={};_0x332ed2[_0x211f('0x31')]=_[_0x211f('0x34')](db[_0x211f('0x2d')][_0x211f('0x2e')]);_0x332ed2['query']=_['keys'](_0x1ca5a6[_0x211f('0x33')]);_0x332ed2[_0x211f('0x35')]=_[_0x211f('0x36')](_0x332ed2['model'],_0x332ed2['query']);_0x24bc6a[_0x211f('0x37')]=_[_0x211f('0x36')](_0x332ed2['model'],qs[_0x211f('0x38')](_0x1ca5a6[_0x211f('0x33')][_0x211f('0x38')]));_0x24bc6a[_0x211f('0x37')]=_0x24bc6a[_0x211f('0x37')][_0x211f('0x47')]?_0x24bc6a[_0x211f('0x37')]:_0x332ed2[_0x211f('0x31')];if(_0x1ca5a6[_0x211f('0x33')][_0x211f('0x43')]){_0x24bc6a['include']=[{'all':!![]}];}_0x24bc6a=_[_0x211f('0x41')]({},_0x24bc6a,_0x1ca5a6[_0x211f('0x42')]);return db[_0x211f('0x2d')][_0x211f('0x48')](_0x24bc6a)['then'](handleEntityNotFound(_0x32fff3,null))[_0x211f('0x26')](respondWithResult(_0x32fff3,null))[_0x211f('0x44')](handleError(_0x32fff3,null));};exports[_0x211f('0x49')]=function(_0x6046cc,_0x54cf6b){return db[_0x211f('0x2d')][_0x211f('0x49')](_0x6046cc[_0x211f('0x4a')],{})[_0x211f('0x26')](respondWithResult(_0x54cf6b,0xc9))[_0x211f('0x44')](handleError(_0x54cf6b,null));};exports['update']=function(_0x11a085,_0x3954de){if(_0x11a085[_0x211f('0x4a')]['id']){delete _0x11a085[_0x211f('0x4a')]['id'];}return db[_0x211f('0x2d')][_0x211f('0x48')]({'where':{'id':_0x11a085[_0x211f('0x46')]['id']}})['then'](handleEntityNotFound(_0x3954de,null))[_0x211f('0x26')](saveUpdates(_0x11a085['body'],null))[_0x211f('0x26')](respondWithResult(_0x3954de,null))[_0x211f('0x44')](handleError(_0x3954de,null));};exports[_0x211f('0x4b')]=function(_0x41e081,_0x29e763){return db[_0x211f('0x2d')]['describe']()['then'](respondWithResult(_0x29e763,null))[_0x211f('0x44')](handleError(_0x29e763,null));};exports[_0x211f('0x4c')]=function(_0x3728bd,_0x52de4f,_0x36d49a){var _0x5c2261=require(_0x211f('0x4d'));var _0x3428c2=![];var _0x497c71={};if(_0x3728bd[_0x211f('0x33')][_0x211f('0x30')]&&_0x3728bd[_0x211f('0x33')][_0x211f('0x30')]===_0x211f('0x4e')){_0x497c71[_0x211f('0x4e')]=_0x3728bd[_0x211f('0x46')]['id'];}else{_0x497c71['id']=_0x3728bd[_0x211f('0x46')]['id'];}return db[_0x211f('0x2d')][_0x211f('0x48')]({'where':_0x497c71,'attributes':['id',_0x211f('0x4f')],'raw':!![]})[_0x211f('0x26')](handleEntityNotFound(_0x52de4f,null))['then'](function(_0x4f4ba6){if(_0x4f4ba6){var _0x46576d=_0x4f4ba6[_0x211f('0x4f')];var _0x409ac9=util[_0x211f('0x32')]('%s.cypher',_0x46576d);if(fs['existsSync'](_0x409ac9)){_0x3428c2=!![];return _0x5c2261['decryptFile'](_0x409ac9,_0x46576d,config[_0x211f('0x50')]['recording'])[_0x211f('0x26')](function(){return _0x4f4ba6;});}return _0x4f4ba6;}})['then'](function(_0x117544){if(_0x117544){var _0x4573de=_0x117544[_0x211f('0x4f')];if(!fs[_0x211f('0x51')](_0x4573de)){throw new db[(_0x211f('0x52'))][(_0x211f('0x53'))](_0x211f('0x54'));}if(_0x117544[_0x211f('0x55')]){return _0x52de4f[_0x211f('0x4c')](_0x4573de,_0x117544['filename']+path[_0x211f('0x56')](_0x4573de),function(){if(_0x3428c2){fs[_0x211f('0x57')](_0x4573de);}});}else{return _0x52de4f[_0x211f('0x4c')](_0x4573de,function(_0x21ea8a){if(_0x3428c2){fs[_0x211f('0x57')](_0x4573de);}});}}})[_0x211f('0x44')](function(_0x1271f5){if(_0x1271f5['message']===_0x211f('0x54')){_0x52de4f[_0x211f('0x1b')](0x194)[_0x211f('0x2a')](_0x211f('0x58'));}else{return handleError(_0x52de4f,null);}});};exports['downloads']=function(_0x22296c,_0x376710,_0x1aa2a2){var _0xf736f1=require(_0x211f('0x4d'));var _0x4835f8=![];var _0x13b686={'$and':[db[_0x211f('0x59')]['where'](db[_0x211f('0x59')]['fn'](_0x211f('0x5a'),db[_0x211f('0x59')][_0x211f('0x5b')](_0x211f('0x4e'))),_0x22296c[_0x211f('0x33')]['token'])]};if(_0x22296c[_0x211f('0x33')][_0x211f('0x30')]&&_0x22296c[_0x211f('0x33')]['type']===_0x211f('0x4e')){_0x13b686[_0x211f('0x5c')][_0x211f('0x5d')]({'uniqueid':_0x22296c[_0x211f('0x46')]['id']});}else{_0x13b686[_0x211f('0x5c')][_0x211f('0x5d')]({'id':_0x22296c[_0x211f('0x46')]['id']});}return db['VoiceRecording'][_0x211f('0x48')]({'where':_0x13b686,'attributes':['id',_0x211f('0x4f')],'raw':!![]})[_0x211f('0x26')](handleEntityNotFound(_0x376710,null))['then'](function(_0x364af5){if(_0x364af5){var _0x476e74=util[_0x211f('0x32')](_0x211f('0x5e'),_0x364af5[_0x211f('0x4f')]);if(fs[_0x211f('0x51')](_0x476e74)){_0x4835f8=!![];return _0xf736f1[_0x211f('0x5f')](_0x476e74,_0x364af5[_0x211f('0x4f')],config[_0x211f('0x50')][_0x211f('0x60')])[_0x211f('0x26')](function(){return _0x364af5;});}return _0x364af5;}})[_0x211f('0x26')](function(_0x4f305e){if(_0x4f305e){if(!fs[_0x211f('0x51')](_0x4f305e[_0x211f('0x4f')])){throw new db[(_0x211f('0x52'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x4f305e[_0x211f('0x55')]){return _0x376710[_0x211f('0x4c')](_0x4f305e[_0x211f('0x4f')],_0x4f305e['filename']+path[_0x211f('0x56')](_0x4f305e[_0x211f('0x4f')]),function(){if(_0x4835f8){fs[_0x211f('0x57')](_0x4f305e[_0x211f('0x4f')]);}});}else{return _0x376710[_0x211f('0x4c')](_0x4f305e[_0x211f('0x4f')],function(_0x318784){if(_0x4835f8){fs[_0x211f('0x57')](_0x4f305e[_0x211f('0x4f')]);}});}}})['catch'](handleError(_0x376710,null));};exports[_0x211f('0x61')]=function(_0x109194,_0x4ce3fe){return db['VoiceRecording'][_0x211f('0x48')]({'where':{'id':_0x109194['params']['id']}})[_0x211f('0x26')](function(_0x5c1554){if(!_0x5c1554)throw new ReferenceError(_0x211f('0x62'));return _0x5c1554;})[_0x211f('0x26')](function(_0x216e97){var _0x5ec8f9=_0x216e97['value'];logger[_0x211f('0x63')](_0x211f('0x64'),_0x5ec8f9);if(!_[_0x211f('0x65')](_0x216e97[_0x211f('0x4f')])&&fs[_0x211f('0x51')](_0x5ec8f9)){logger[_0x211f('0x63')]('File:\x20\x22'+_0x5ec8f9+_0x211f('0x66'));fs[_0x211f('0x67')](_0x5ec8f9);}_0x5ec8f9=_0x5ec8f9+_0x211f('0x68');if(!_['isNil'](_0x216e97[_0x211f('0x4f')])&&fs['existsSync'](_0x5ec8f9)){logger['info'](_0x211f('0x69')+_0x5ec8f9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x211f('0x67')](_0x5ec8f9);}return _0x216e97;})[_0x211f('0x26')](function(_0x3a1368){if(!_0x3a1368)throw new InternalError();return _0x3a1368['destroy']();})[_0x211f('0x26')](function(){_0x4ce3fe[_0x211f('0x1b')](0xcc)['end']();})['catch'](handleError(_0x4ce3fe,null));};function getBucketslist(_0x399952,_0x5c5843,_0x457c21){return new Promise(function(_0x226e76,_0x11a149){var _0x5889db=new AWS['S3']({'accessKeyId':_0x5c5843,'secretAccessKey':_0x399952,'region':_0x457c21});_0x5889db['listBuckets']({},function(_0x887d29,_0x5d4b0c){if(_0x887d29){return _0x11a149(_0x887d29);}else{return _0x226e76(_0x5d4b0c);}});});}function createBucket(_0x3ea59a,_0x3d2168,_0x6a7a7a,_0x13e8b7){return new Promise(function(_0x19188f,_0x210e15){var _0x196f8f=new AWS['S3']({'accessKeyId':_0x3d2168,'secretAccessKey':_0x3ea59a,'region':_0x6a7a7a});_0x196f8f[_0x211f('0x6a')]({'Bucket':_0x13e8b7},function(_0x184660,_0xbfd97a){if(_0x184660){return _0x210e15(_0x184660);}else{return _0x19188f(_0xbfd97a);}});});}function uploadFile(_0x3a9fcf,_0x27b2e5,_0x30d3f2,_0x53013a,_0x543cb3,_0x2d896d){return new Promise(function(_0x391c56,_0x38f236){var _0x166e64=new AWS['S3']({'accessKeyId':_0x27b2e5,'secretAccessKey':_0x3a9fcf,'region':_0x30d3f2});_0x166e64[_0x211f('0x6b')]({'Bucket':_0x53013a,'Key':_0x543cb3,'Body':_0x2d896d},function(_0x2003ed,_0x488828){if(_0x2003ed){return _0x38f236(_0x2003ed);}else{return _0x391c56(_0x488828);}});});}function startTranscribe(_0x1a2a42,_0x37885c,_0x390977,_0x4e490b,_0x1d7331,_0x69ffbe){return new Promise(function(_0x4bb454,_0x4e1a14){var _0x5d521d=new AWS[(_0x211f('0x6c'))]({'accessKeyId':_0x37885c,'secretAccessKey':_0x1a2a42,'region':_0x390977});_0x5d521d[_0x211f('0x6d')]({'TranscriptionJobName':_0x4e490b,'LanguageCode':_0x1d7331,'Media':{'MediaFileUri':_0x69ffbe}},function(_0x5ce2d7,_0x2322db){if(_0x5ce2d7){return _0x4e1a14(_0x5ce2d7);}else{return _0x4bb454(_0x2322db);}});});}function transcribe(_0x433dbf,_0x3f71f1,_0x1db11e,_0x15083e,_0x3f86a0,_0x3828a1,_0x5f4afa){return new Promise(function(_0x1aff8,_0x47544b){var _0x4e940d={};logger[_0x211f('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x433dbf,_0x3f86a0));return uploadFile(_0x3f71f1,_0x1db11e,_0x15083e,_0x3f86a0,path[_0x211f('0x6e')](_0x3828a1),fs[_0x211f('0x6f')](_0x3828a1))[_0x211f('0x26')](function(_0x26b75f){logger['info'](util['format'](_0x211f('0x70'),_0x433dbf,_0x3f86a0,_0x26b75f[_0x211f('0x71')]));_0x4e940d[_0x211f('0x72')]=_0x26b75f[_0x211f('0x73')];_0x4e940d[_0x211f('0x74')]=_0x26b75f[_0x211f('0x71')];logger[_0x211f('0x63')](util[_0x211f('0x32')](_0x211f('0x75'),_0x433dbf));return startTranscribe(_0x3f71f1,_0x1db11e,_0x15083e,uuidv4(),_0x5f4afa,_0x26b75f[_0x211f('0x71')]);})['then'](function(_0x2ddee2){logger[_0x211f('0x63')](util[_0x211f('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x433dbf,_0x2ddee2[_0x211f('0x76')][_0x211f('0x77')]));_0x4e940d[_0x211f('0x78')]=_0x2ddee2[_0x211f('0x76')]['TranscriptionJobName'];_0x4e940d[_0x211f('0x79')]=_0x2ddee2[_0x211f('0x76')][_0x211f('0x7a')];return _0x1aff8(_0x4e940d);})[_0x211f('0x44')](function(_0x3b3c22){return _0x47544b(_0x3b3c22);});});}exports[_0x211f('0x7b')]=function(_0x408afc,_0xed75c3,_0x3b9fe2){var _0xb26c37;var _0x2c8244;var _0x36e071;var _0xda6ff9=require('../../components/encryptor');return db[_0x211f('0x2d')][_0x211f('0x7c')]({'where':{'id':_0x408afc[_0x211f('0x46')]['id']}})[_0x211f('0x26')](function(_0x369b32){if(_0x369b32){var _0x3baaf6=util[_0x211f('0x32')](_0x211f('0x5e'),_0x369b32[_0x211f('0x4f')]);if(fs[_0x211f('0x51')](_0x3baaf6)){cypher=!![];return _0xda6ff9[_0x211f('0x5f')](_0x3baaf6,_0x369b32[_0x211f('0x4f')],config[_0x211f('0x50')][_0x211f('0x60')])[_0x211f('0x26')](function(){return _0x369b32;});}return _0x369b32;}})['then'](function(_0x5cc376){if(!_0x5cc376){throw new db[(_0x211f('0x52'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x2c8244=_0x5cc376;return db[_0x211f('0x7d')][_0x211f('0x7c')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0xed75c3,null))[_0x211f('0x26')](function(_0x37085e){if(_0x37085e){_0xb26c37=_0x37085e;if(!_0xb26c37[_0x211f('0x7e')]||!_0xb26c37['transcribeAccountId']||!_0xb26c37['transcribeRegion']||!_0xb26c37[_0x211f('0x7f')]||!_0xb26c37[_0x211f('0x72')]){throw new db['Sequelize'][(_0x211f('0x53'))](_0x211f('0x80'));}if(_0x408afc[_0x211f('0x4a')][_0x211f('0x81')]&&(!_0xb26c37[_0x211f('0x82')]||!_0xb26c37['sentimentAccountId']||!_0xb26c37['sentimentRegion']||!_0xb26c37[_0x211f('0x7f')]||!_0xb26c37['bucket'])){throw new db[(_0x211f('0x52'))][(_0x211f('0x53'))](_0x211f('0x83'));}return db[_0x211f('0x84')]['findOne']({'where':{'id':_0xb26c37[_0x211f('0x85')]}});}})[_0x211f('0x26')](function(_0x147a73){if(!_0x147a73){throw new db[(_0x211f('0x52'))][(_0x211f('0x53'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x147a73[_0x211f('0x86')]||!_0x147a73[_0x211f('0x87')]){throw new db['Sequelize']['ValidationError'](_0x211f('0x88'));}_0x36e071=_0x147a73;return getBucketslist(_0x36e071['data1'],_0x36e071['data2'],_0xb26c37[_0x211f('0x89')]);})['then'](function(_0x2832ef){if(_0x2832ef&&_0x2832ef[_0x211f('0x8a')]){var _0x3af9ec=_[_0x211f('0x48')](_0x2832ef['Buckets'],function(_0x1a36d1){return _0x1a36d1['Name']===_0xb26c37[_0x211f('0x72')];});if(!_0x3af9ec){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x408afc[_0x211f('0x46')]['id'],_0xb26c37[_0x211f('0x72')]));return createBucket(_0x36e071[_0x211f('0x86')],_0x36e071[_0x211f('0x87')],_0xb26c37[_0x211f('0x89')],_0xb26c37[_0x211f('0x72')]);}logger[_0x211f('0x63')](util[_0x211f('0x32')](_0x211f('0x8b'),_0x408afc[_0x211f('0x46')]['id'],_0xb26c37[_0x211f('0x72')]));return;}})['then'](function(_0x985d69){if(_0x2c8244[_0x211f('0x79')]===_0x211f('0x8c')){return transcribe(_0x408afc[_0x211f('0x46')]['id'],_0x36e071[_0x211f('0x86')],_0x36e071[_0x211f('0x87')],_0xb26c37['transcribeRegion'],_0xb26c37['bucket'],_0x2c8244['value'],_0xb26c37[_0x211f('0x7f')]);}else{logger[_0x211f('0x63')](util[_0x211f('0x32')](_0x211f('0x8d'),_0x408afc[_0x211f('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x3e7eb2){if(_0x3e7eb2){_0x3e7eb2[_0x211f('0x8e')]=_0x408afc[_0x211f('0x4a')][_0x211f('0x81')];return _0x2c8244['updateAttributes'](_0x3e7eb2);}})[_0x211f('0x26')](respondWithResult(_0xed75c3,null))[_0x211f('0x44')](handleError(_0xed75c3,null));};function writeFile(_0x3a8b60,_0x57bd9f){return new Promise(function(_0x25df9e,_0x7229ca){fs['writeFile'](_0x57bd9f,_0x3a8b60,function(_0x2806ce,_0x98e6d5){if(_0x2806ce){return _0x7229ca(_0x2806ce);}else{return _0x25df9e(_0x98e6d5);}});});}exports[_0x211f('0x8f')]=function(_0x1f3852,_0xb73e4c,_0x29478c){return db[_0x211f('0x2d')][_0x211f('0x7c')]({'where':{'id':_0x1f3852[_0x211f('0x46')]['id']}})[_0x211f('0x26')](handleEntityNotFound(_0xb73e4c))[_0x211f('0x26')](function(_0x5eafde){if(_0x5eafde&&_0x5eafde[_0x211f('0x90')]){var _0x519994=_0x5eafde[_0x211f('0x90')];var _0x36b0b0=config[_0x211f('0x91')]+'/server/files/transcribes/transcribe_'+_0x5eafde['id']+_0x211f('0x92');if(fs[_0x211f('0x51')](_0x36b0b0)){return _0x36b0b0;}return writeFile(_0x519994,_0x36b0b0)['then'](function(){return _0x36b0b0;});}else{throw new db[(_0x211f('0x52'))][(_0x211f('0x53'))](_0x211f('0x93'));}})[_0x211f('0x26')](function(_0x201d92){return _0xb73e4c['download'](_0x201d92);})[_0x211f('0x44')](handleError(_0xb73e4c));}; \ No newline at end of file +var _0x6237=['../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','col','token','$and','push','%s.cypher','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','listBuckets','upload','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','language','bucket','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','merge','options','find','create','body','describe','download'];(function(_0x1d2309,_0x5ac4fd){var _0x443a5f=function(_0x27ed3d){while(--_0x27ed3d){_0x1d2309['push'](_0x1d2309['shift']());}};_0x443a5f(++_0x5ac4fd);}(_0x6237,0xdc));var _0x7623=function(_0x3a4c07,_0x18440c){_0x3a4c07=_0x3a4c07-0x0;var _0x5a4943=_0x6237[_0x3a4c07];return _0x5a4943;};'use strict';var pdf=require(_0x7623('0x0'));var emlformat=require(_0x7623('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7623('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7623('0x3'));var moment=require(_0x7623('0x4'));var BPromise=require(_0x7623('0x5'));var Mustache=require(_0x7623('0x6'));var util=require(_0x7623('0x7'));var path=require('path');var sox=require(_0x7623('0x8'));var csv=require(_0x7623('0x9'));var ejs=require(_0x7623('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7623('0xb'));var crypto=require(_0x7623('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7623('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7623('0xe'));var Papa=require(_0x7623('0xf'));var AWS=require(_0x7623('0x10'));var uuidv4=require(_0x7623('0x11'));var Redis=require(_0x7623('0x12'));var authService=require(_0x7623('0x13'));var qs=require(_0x7623('0x14'));var as=require(_0x7623('0x15'));var hardwareService=require(_0x7623('0x16'));var logger=require('../../config/logger')(_0x7623('0x17'));var utils=require(_0x7623('0x18'));var config=require(_0x7623('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5384bc,_0x194c5e){_0x194c5e=_0x194c5e||0xcc;return function(_0x1d3a94){if(_0x1d3a94){return _0x5384bc[_0x7623('0x1a')](_0x194c5e);}return _0x5384bc['status'](_0x194c5e)['end']();};}function respondWithResult(_0x2d687d,_0x54a9ac){_0x54a9ac=_0x54a9ac||0xc8;return function(_0x2bd7bc){if(_0x2bd7bc){return _0x2d687d[_0x7623('0x1b')](_0x54a9ac)['json'](_0x2bd7bc);}};}function respondWithFilteredResult(_0x4a2a72,_0x15d318){return function(_0x4c7cf2){if(_0x4c7cf2){var _0x183cf9=_0x4c7cf2[_0x7623('0x1c')],_0x3b09dc=_0x15d318[_0x7623('0x1d')],_0x171d60=_0x15d318[_0x7623('0x1d')]+_0x15d318[_0x7623('0x1e')],_0x489d68;if(_0x171d60>=_0x183cf9){_0x171d60=_0x183cf9;_0x489d68=0xc8;}else{_0x489d68=0xce;}_0x4a2a72[_0x7623('0x1b')](_0x489d68);return _0x4a2a72[_0x7623('0x1f')]('Content-Range',_0x3b09dc+'-'+_0x171d60+'/'+_0x183cf9)[_0x7623('0x20')](_0x4c7cf2);}return null;};}function patchUpdates(_0x1ffc37){return function(_0x4b47d0){try{jsonpatch[_0x7623('0x21')](_0x4b47d0,_0x1ffc37,!![]);}catch(_0x46f32d){return BPromise[_0x7623('0x22')](_0x46f32d);}return _0x4b47d0[_0x7623('0x23')]();};}function saveUpdates(_0x407724,_0x1a31bd){return function(_0x4d8dab){if(_0x4d8dab){return _0x4d8dab[_0x7623('0x24')](_0x407724)[_0x7623('0x25')](function(_0x53043f){return _0x53043f;});}return null;};}function removeEntity(_0x1626de,_0x5cb0ce){return function(_0x162014){if(_0x162014){return _0x162014[_0x7623('0x26')]()[_0x7623('0x25')](function(){_0x1626de['status'](0xcc)[_0x7623('0x27')]();});}};}function handleEntityNotFound(_0x502c16,_0x2e29b8){return function(_0x2b4b0){if(!_0x2b4b0){_0x502c16[_0x7623('0x1a')](0x194);}return _0x2b4b0;};}function handleError(_0x4797f5,_0x33c5f3){_0x33c5f3=_0x33c5f3||0x1f4;return function(_0x47337a){logger[_0x7623('0x28')](_0x47337a[_0x7623('0x29')]);if(_0x47337a[_0x7623('0x2a')]){delete _0x47337a[_0x7623('0x2a')];}_0x4797f5[_0x7623('0x1b')](_0x33c5f3)[_0x7623('0x2b')](_0x47337a);};}exports['index']=function(_0xe9ae65,_0x3b6c73){var _0x30f358={},_0x57d86a={},_0xbe6697={'count':0x0,'rows':[]};var _0x41b13b=_[_0x7623('0x2c')](db[_0x7623('0x2d')]['rawAttributes'],function(_0x34a671){return{'name':_0x34a671[_0x7623('0x2e')],'type':_0x34a671[_0x7623('0x2f')][_0x7623('0x30')]};});_0x57d86a[_0x7623('0x31')]=_[_0x7623('0x32')](_['map'](_0x41b13b,_0x7623('0x2a')),[_0x7623('0x33')]);_0x57d86a[_0x7623('0x34')]=_[_0x7623('0x35')](_0xe9ae65[_0x7623('0x34')]);_0x57d86a[_0x7623('0x36')]=_[_0x7623('0x37')](_0x57d86a['model'],_0x57d86a[_0x7623('0x34')]);_0x30f358[_0x7623('0x38')]=_[_0x7623('0x37')](_0x57d86a['model'],qs['fields'](_0xe9ae65[_0x7623('0x34')][_0x7623('0x39')]));_0x30f358['attributes']=_0x30f358[_0x7623('0x38')][_0x7623('0x3a')]?_0x30f358[_0x7623('0x38')]:_0x57d86a['model'];if(!_0xe9ae65[_0x7623('0x34')][_0x7623('0x3b')](_0x7623('0x3c'))){_0x30f358['limit']=qs[_0x7623('0x1e')](_0xe9ae65[_0x7623('0x34')]['limit']);_0x30f358[_0x7623('0x1d')]=qs[_0x7623('0x1d')](_0xe9ae65[_0x7623('0x34')]['offset']);}_0x30f358['order']=qs[_0x7623('0x3d')](_0xe9ae65[_0x7623('0x34')]['sort']);_0x30f358[_0x7623('0x3e')]=qs[_0x7623('0x36')](_[_0x7623('0x3f')](_0xe9ae65[_0x7623('0x34')],_0x57d86a[_0x7623('0x36')]),_0x41b13b);if(_0xe9ae65[_0x7623('0x34')][_0x7623('0x40')]){_0x30f358[_0x7623('0x3e')]=_['merge'](_0x30f358[_0x7623('0x3e')],{'$or':_[_0x7623('0x2c')](_0x41b13b,function(_0x57fbe5){if(_0x57fbe5[_0x7623('0x2f')]!==_0x7623('0x41')){var _0x90b5ce={};_0x90b5ce[_0x57fbe5['name']]={'$like':'%'+_0xe9ae65[_0x7623('0x34')][_0x7623('0x40')]+'%'};return _0x90b5ce;}})});}_0x30f358=_['merge']({},_0x30f358,_0xe9ae65['options']);var _0x2f3614={'where':_0x30f358[_0x7623('0x3e')]};return db[_0x7623('0x2d')][_0x7623('0x1c')](_0x2f3614)[_0x7623('0x25')](function(_0x4d8f04){_0xbe6697[_0x7623('0x1c')]=_0x4d8f04;if(_0xe9ae65['query'][_0x7623('0x42')]){_0x30f358[_0x7623('0x43')]=[{'all':!![]}];}return db[_0x7623('0x2d')]['findAll'](_0x30f358);})[_0x7623('0x25')](function(_0x4def42){_0xbe6697[_0x7623('0x44')]=_0x4def42;return _0xbe6697;})['then'](respondWithFilteredResult(_0x3b6c73,_0x30f358))[_0x7623('0x45')](handleError(_0x3b6c73,null));};exports[_0x7623('0x46')]=function(_0x5544bb,_0x2ca2d8){var _0x17475b={'raw':![],'where':{'id':_0x5544bb[_0x7623('0x47')]['id']}},_0x1fdd06={};_0x1fdd06[_0x7623('0x31')]=_[_0x7623('0x35')](db[_0x7623('0x2d')][_0x7623('0x48')]);_0x1fdd06[_0x7623('0x34')]=_[_0x7623('0x35')](_0x5544bb[_0x7623('0x34')]);_0x1fdd06['filters']=_[_0x7623('0x37')](_0x1fdd06['model'],_0x1fdd06['query']);_0x17475b[_0x7623('0x38')]=_['intersection'](_0x1fdd06['model'],qs[_0x7623('0x39')](_0x5544bb[_0x7623('0x34')][_0x7623('0x39')]));_0x17475b[_0x7623('0x38')]=_0x17475b[_0x7623('0x38')]['length']?_0x17475b[_0x7623('0x38')]:_0x1fdd06[_0x7623('0x31')];if(_0x5544bb[_0x7623('0x34')][_0x7623('0x42')]){_0x17475b[_0x7623('0x43')]=[{'all':!![]}];}_0x17475b=_[_0x7623('0x49')]({},_0x17475b,_0x5544bb[_0x7623('0x4a')]);return db[_0x7623('0x2d')][_0x7623('0x4b')](_0x17475b)[_0x7623('0x25')](handleEntityNotFound(_0x2ca2d8,null))[_0x7623('0x25')](respondWithResult(_0x2ca2d8,null))[_0x7623('0x45')](handleError(_0x2ca2d8,null));};exports[_0x7623('0x4c')]=function(_0x3088f8,_0x4ad33e){return db[_0x7623('0x2d')][_0x7623('0x4c')](_0x3088f8[_0x7623('0x4d')],{})['then'](respondWithResult(_0x4ad33e,0xc9))[_0x7623('0x45')](handleError(_0x4ad33e,null));};exports[_0x7623('0x24')]=function(_0x2e51c1,_0x3f7cfa){if(_0x2e51c1[_0x7623('0x4d')]['id']){delete _0x2e51c1['body']['id'];}return db[_0x7623('0x2d')][_0x7623('0x4b')]({'where':{'id':_0x2e51c1[_0x7623('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f7cfa,null))[_0x7623('0x25')](saveUpdates(_0x2e51c1[_0x7623('0x4d')],null))['then'](respondWithResult(_0x3f7cfa,null))[_0x7623('0x45')](handleError(_0x3f7cfa,null));};exports[_0x7623('0x4e')]=function(_0x42faf8,_0x4bd156){return db[_0x7623('0x2d')]['describe']()[_0x7623('0x25')](respondWithResult(_0x4bd156,null))['catch'](handleError(_0x4bd156,null));};exports[_0x7623('0x4f')]=function(_0x644f69,_0x105c60,_0x32026b){var _0x4a5958=require(_0x7623('0x50'));var _0x5c79ab=![];var _0xbea9b3={};if(_0x644f69[_0x7623('0x34')]['type']&&_0x644f69[_0x7623('0x34')][_0x7623('0x2f')]===_0x7623('0x51')){_0xbea9b3[_0x7623('0x51')]=_0x644f69[_0x7623('0x47')]['id'];}else{_0xbea9b3['id']=_0x644f69[_0x7623('0x47')]['id'];}return db[_0x7623('0x2d')][_0x7623('0x4b')]({'where':_0xbea9b3,'attributes':['id',_0x7623('0x52')],'raw':!![]})[_0x7623('0x25')](handleEntityNotFound(_0x105c60,null))[_0x7623('0x25')](function(_0xde4a45){if(_0xde4a45){var _0x58e0b8=_0xde4a45[_0x7623('0x52')];var _0x520e05=util[_0x7623('0x33')]('%s.cypher',_0x58e0b8);if(fs[_0x7623('0x53')](_0x520e05)){_0x5c79ab=!![];return _0x4a5958[_0x7623('0x54')](_0x520e05,_0x58e0b8,config[_0x7623('0x55')][_0x7623('0x56')])[_0x7623('0x25')](function(){return _0xde4a45;});}return _0xde4a45;}})[_0x7623('0x25')](function(_0x3472db){if(_0x3472db){var _0x5af76c=_0x3472db['value'];if(!fs[_0x7623('0x53')](_0x5af76c)){throw new db[(_0x7623('0x57'))][(_0x7623('0x58'))](_0x7623('0x59'));}if(_0x3472db['filename']){return _0x105c60[_0x7623('0x4f')](_0x5af76c,_0x3472db[_0x7623('0x5a')]+path[_0x7623('0x5b')](_0x5af76c),function(){if(_0x5c79ab){fs['unlink'](_0x5af76c);}});}else{return _0x105c60['download'](_0x5af76c,function(_0x2155a1){if(_0x5c79ab){fs[_0x7623('0x5c')](_0x5af76c);}});}}})[_0x7623('0x45')](function(_0x3ea318){if(_0x3ea318['message']===_0x7623('0x59')){_0x105c60['status'](0x194)['send'](_0x7623('0x5d'));}else{return handleError(_0x105c60,null);}});};exports['downloads']=function(_0x55f5c5,_0x593051,_0x386822){var _0x21eb0c=require(_0x7623('0x50'));var _0x4e63c5=![];var _0x2f13bb={'$and':[db['sequelize'][_0x7623('0x3e')](db[_0x7623('0x5e')]['fn']('MD5',db['sequelize'][_0x7623('0x5f')]('uniqueid')),_0x55f5c5['query'][_0x7623('0x60')])]};if(_0x55f5c5[_0x7623('0x34')]['type']&&_0x55f5c5[_0x7623('0x34')]['type']===_0x7623('0x51')){_0x2f13bb['$and']['push']({'uniqueid':_0x55f5c5[_0x7623('0x47')]['id']});}else{_0x2f13bb[_0x7623('0x61')][_0x7623('0x62')]({'id':_0x55f5c5[_0x7623('0x47')]['id']});}return db[_0x7623('0x2d')][_0x7623('0x4b')]({'where':_0x2f13bb,'attributes':['id','value'],'raw':!![]})[_0x7623('0x25')](handleEntityNotFound(_0x593051,null))[_0x7623('0x25')](function(_0x1370cd){if(_0x1370cd){var _0x4f89a1=util[_0x7623('0x33')](_0x7623('0x63'),_0x1370cd[_0x7623('0x52')]);if(fs[_0x7623('0x53')](_0x4f89a1)){_0x4e63c5=!![];return _0x21eb0c['decryptFile'](_0x4f89a1,_0x1370cd[_0x7623('0x52')],config['secrets'][_0x7623('0x56')])[_0x7623('0x25')](function(){return _0x1370cd;});}return _0x1370cd;}})['then'](function(_0x1a827f){if(_0x1a827f){if(!fs['existsSync'](_0x1a827f[_0x7623('0x52')])){throw new db[(_0x7623('0x57'))][(_0x7623('0x58'))](_0x7623('0x59'));}if(_0x1a827f[_0x7623('0x5a')]){return _0x593051[_0x7623('0x4f')](_0x1a827f['value'],_0x1a827f[_0x7623('0x5a')]+path[_0x7623('0x5b')](_0x1a827f[_0x7623('0x52')]),function(){if(_0x4e63c5){fs[_0x7623('0x5c')](_0x1a827f[_0x7623('0x52')]);}});}else{return _0x593051[_0x7623('0x4f')](_0x1a827f[_0x7623('0x52')],function(_0x2560ee){if(_0x4e63c5){fs[_0x7623('0x5c')](_0x1a827f[_0x7623('0x52')]);}});}}})[_0x7623('0x45')](handleError(_0x593051,null));};exports[_0x7623('0x26')]=function(_0x43d3c4,_0x3ecd5c){return db[_0x7623('0x2d')][_0x7623('0x4b')]({'where':{'id':_0x43d3c4[_0x7623('0x47')]['id']}})[_0x7623('0x25')](function(_0x15f97b){if(!_0x15f97b)throw new ReferenceError(_0x7623('0x64'));return _0x15f97b;})['then'](function(_0x5cf860){var _0x2c5ecd=_0x5cf860[_0x7623('0x52')];logger[_0x7623('0x65')](_0x7623('0x66'),_0x2c5ecd);if(!_[_0x7623('0x67')](_0x5cf860[_0x7623('0x52')])&&fs[_0x7623('0x53')](_0x2c5ecd)){logger[_0x7623('0x65')]('File:\x20\x22'+_0x2c5ecd+_0x7623('0x68'));fs[_0x7623('0x69')](_0x2c5ecd);}_0x2c5ecd=_0x2c5ecd+'.cypher';if(!_['isNil'](_0x5cf860[_0x7623('0x52')])&&fs[_0x7623('0x53')](_0x2c5ecd)){logger[_0x7623('0x65')](_0x7623('0x6a')+_0x2c5ecd+_0x7623('0x68'));fs['unlinkSync'](_0x2c5ecd);}return _0x5cf860;})[_0x7623('0x25')](function(_0x37a863){if(!_0x37a863)throw new InternalError();return _0x37a863[_0x7623('0x26')]();})['then'](function(){_0x3ecd5c[_0x7623('0x1b')](0xcc)[_0x7623('0x27')]();})[_0x7623('0x45')](handleError(_0x3ecd5c,null));};function getBucketslist(_0x18f8eb,_0x2f08c7,_0xb5c36c){return new Promise(function(_0x8bc22,_0x459692){var _0x142356=new AWS['S3']({'accessKeyId':_0x2f08c7,'secretAccessKey':_0x18f8eb,'region':_0xb5c36c});_0x142356[_0x7623('0x6b')]({},function(_0x18c283,_0x5cfa2c){if(_0x18c283){return _0x459692(_0x18c283);}else{return _0x8bc22(_0x5cfa2c);}});});}function createBucket(_0x54422b,_0x593ad5,_0x186f62,_0x3f7bc7){return new Promise(function(_0x1f9edd,_0x17c3c7){var _0x5a6291=new AWS['S3']({'accessKeyId':_0x593ad5,'secretAccessKey':_0x54422b,'region':_0x186f62});_0x5a6291['createBucket']({'Bucket':_0x3f7bc7},function(_0x2fd667,_0x261743){if(_0x2fd667){return _0x17c3c7(_0x2fd667);}else{return _0x1f9edd(_0x261743);}});});}function uploadFile(_0x21765a,_0x444be8,_0x221b5e,_0xba4d3c,_0x83bdf1,_0x1961c2){return new Promise(function(_0x76e911,_0x11783a){var _0x557f47=new AWS['S3']({'accessKeyId':_0x444be8,'secretAccessKey':_0x21765a,'region':_0x221b5e});_0x557f47[_0x7623('0x6c')]({'Bucket':_0xba4d3c,'Key':_0x83bdf1,'Body':_0x1961c2},function(_0x45b285,_0x65a082){if(_0x45b285){return _0x11783a(_0x45b285);}else{return _0x76e911(_0x65a082);}});});}function startTranscribe(_0x4f7b17,_0xe9c333,_0x1811a1,_0x42367c,_0x307ba2,_0xe40e0a){return new Promise(function(_0xdec064,_0x260a68){var _0x127eda=new AWS['TranscribeService']({'accessKeyId':_0xe9c333,'secretAccessKey':_0x4f7b17,'region':_0x1811a1});_0x127eda['startTranscriptionJob']({'TranscriptionJobName':_0x42367c,'LanguageCode':_0x307ba2,'Media':{'MediaFileUri':_0xe40e0a}},function(_0x183433,_0x365bb7){if(_0x183433){return _0x260a68(_0x183433);}else{return _0xdec064(_0x365bb7);}});});}function transcribe(_0x1f9875,_0x218c3e,_0x2458f4,_0x395efa,_0x2a8a81,_0x108562,_0x3a2ebf){return new Promise(function(_0xe006,_0x2a5231){var _0x58e8d1={};logger[_0x7623('0x65')](util['format'](_0x7623('0x6d'),_0x1f9875,_0x2a8a81));return uploadFile(_0x218c3e,_0x2458f4,_0x395efa,_0x2a8a81,path['basename'](_0x108562),fs[_0x7623('0x6e')](_0x108562))[_0x7623('0x25')](function(_0x3a73f6){logger[_0x7623('0x65')](util[_0x7623('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1f9875,_0x2a8a81,_0x3a73f6[_0x7623('0x6f')]));_0x58e8d1['bucket']=_0x3a73f6[_0x7623('0x70')];_0x58e8d1[_0x7623('0x71')]=_0x3a73f6[_0x7623('0x6f')];logger['info'](util[_0x7623('0x33')](_0x7623('0x72'),_0x1f9875));return startTranscribe(_0x218c3e,_0x2458f4,_0x395efa,uuidv4(),_0x3a2ebf,_0x3a73f6['Location']);})[_0x7623('0x25')](function(_0x553a44){logger[_0x7623('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1f9875,_0x553a44['TranscriptionJob'][_0x7623('0x73')]));_0x58e8d1[_0x7623('0x74')]=_0x553a44[_0x7623('0x75')][_0x7623('0x73')];_0x58e8d1['transcribeStatus']=_0x553a44[_0x7623('0x75')][_0x7623('0x76')];return _0xe006(_0x58e8d1);})[_0x7623('0x45')](function(_0x5ed8b2){return _0x2a5231(_0x5ed8b2);});});}exports[_0x7623('0x77')]=function(_0x24729e,_0x407d79,_0x60ccad){var _0x2c47cc;var _0x26eaa5;var _0x563566;var _0x10b907=require(_0x7623('0x50'));return db[_0x7623('0x2d')][_0x7623('0x78')]({'where':{'id':_0x24729e['params']['id']}})['then'](function(_0x319b7a){if(_0x319b7a){var _0x1c2084=util[_0x7623('0x33')](_0x7623('0x63'),_0x319b7a[_0x7623('0x52')]);if(fs[_0x7623('0x53')](_0x1c2084)){cypher=!![];return _0x10b907[_0x7623('0x54')](_0x1c2084,_0x319b7a[_0x7623('0x52')],config['secrets']['recording'])[_0x7623('0x25')](function(){return _0x319b7a;});}return _0x319b7a;}})[_0x7623('0x25')](function(_0x4e1b90){if(!_0x4e1b90){throw new db[(_0x7623('0x57'))][(_0x7623('0x58'))](_0x7623('0x79'));}_0x26eaa5=_0x4e1b90;return db[_0x7623('0x7a')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x407d79,null))[_0x7623('0x25')](function(_0x262fef){if(_0x262fef){_0x2c47cc=_0x262fef;if(!_0x2c47cc[_0x7623('0x7b')]||!_0x2c47cc[_0x7623('0x7c')]||!_0x2c47cc['transcribeRegion']||!_0x2c47cc[_0x7623('0x7d')]||!_0x2c47cc[_0x7623('0x7e')]){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x24729e[_0x7623('0x4d')]['runSentiment']&&(!_0x2c47cc['sentiment']||!_0x2c47cc[_0x7623('0x7f')]||!_0x2c47cc[_0x7623('0x80')]||!_0x2c47cc['language']||!_0x2c47cc[_0x7623('0x7e')])){throw new db[(_0x7623('0x57'))][(_0x7623('0x58'))](_0x7623('0x81'));}return db[_0x7623('0x82')][_0x7623('0x78')]({'where':{'id':_0x2c47cc['transcribeAccountId']}});}})[_0x7623('0x25')](function(_0x61fb8a){if(!_0x61fb8a){throw new db['Sequelize'][(_0x7623('0x58'))](_0x7623('0x83'));}if(!_0x61fb8a[_0x7623('0x84')]||!_0x61fb8a[_0x7623('0x85')]){throw new db[(_0x7623('0x57'))][(_0x7623('0x58'))](_0x7623('0x86'));}_0x563566=_0x61fb8a;return getBucketslist(_0x563566[_0x7623('0x84')],_0x563566['data2'],_0x2c47cc[_0x7623('0x87')]);})[_0x7623('0x25')](function(_0x24f0e5){if(_0x24f0e5&&_0x24f0e5[_0x7623('0x88')]){var _0x42dd8d=_[_0x7623('0x4b')](_0x24f0e5[_0x7623('0x88')],function(_0x54aed2){return _0x54aed2[_0x7623('0x89')]===_0x2c47cc[_0x7623('0x7e')];});if(!_0x42dd8d){logger[_0x7623('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x24729e[_0x7623('0x47')]['id'],_0x2c47cc[_0x7623('0x7e')]));return createBucket(_0x563566['data1'],_0x563566[_0x7623('0x85')],_0x2c47cc[_0x7623('0x87')],_0x2c47cc[_0x7623('0x7e')]);}logger[_0x7623('0x65')](util[_0x7623('0x33')](_0x7623('0x8a'),_0x24729e[_0x7623('0x47')]['id'],_0x2c47cc[_0x7623('0x7e')]));return;}})['then'](function(_0xb1593e){if(_0x26eaa5[_0x7623('0x8b')]==='NEW'){return transcribe(_0x24729e[_0x7623('0x47')]['id'],_0x563566[_0x7623('0x84')],_0x563566['data2'],_0x2c47cc[_0x7623('0x87')],_0x2c47cc[_0x7623('0x7e')],_0x26eaa5[_0x7623('0x52')],_0x2c47cc[_0x7623('0x7d')]);}else{logger[_0x7623('0x65')](util[_0x7623('0x33')](_0x7623('0x8c'),_0x24729e[_0x7623('0x47')]['id']));return{'transcribeStatus':_0x7623('0x8d')};}})[_0x7623('0x25')](function(_0x2db0ac){if(_0x2db0ac){_0x2db0ac[_0x7623('0x8e')]=_0x24729e['body'][_0x7623('0x8f')];return _0x26eaa5[_0x7623('0x90')](_0x2db0ac);}})[_0x7623('0x25')](respondWithResult(_0x407d79,null))[_0x7623('0x45')](handleError(_0x407d79,null));};function writeFile(_0x5bdd39,_0x3754d7){return new Promise(function(_0x4cf93d,_0x1448a){fs[_0x7623('0x91')](_0x3754d7,_0x5bdd39,function(_0x330266,_0x101095){if(_0x330266){return _0x1448a(_0x330266);}else{return _0x4cf93d(_0x101095);}});});}exports[_0x7623('0x92')]=function(_0x57c393,_0x3b76b6,_0x552346){return db[_0x7623('0x2d')][_0x7623('0x78')]({'where':{'id':_0x57c393[_0x7623('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b76b6))[_0x7623('0x25')](function(_0x2d54c2){if(_0x2d54c2&&_0x2d54c2['fileText']){var _0x43ed92=_0x2d54c2[_0x7623('0x93')];var _0x2fb640=config['root']+_0x7623('0x94')+_0x2d54c2['id']+'.txt';if(fs[_0x7623('0x53')](_0x2fb640)){return _0x2fb640;}return writeFile(_0x43ed92,_0x2fb640)[_0x7623('0x25')](function(){return _0x2fb640;});}else{throw new db[(_0x7623('0x57'))][(_0x7623('0x58'))](_0x7623('0x95'));}})[_0x7623('0x25')](function(_0xda4a40){return _0x3b76b6[_0x7623('0x4f')](_0xda4a40);})[_0x7623('0x45')](handleError(_0x3b76b6));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 0881c6a..e1f746a 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 _0xf331=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api'];(function(_0x25f791,_0xf14083){var _0x97096a=function(_0x29b3fa){while(--_0x29b3fa){_0x25f791['push'](_0x25f791['shift']());}};_0x97096a(++_0xf14083);}(_0xf331,0x1a0));var _0x1f33=function(_0x6c6903,_0x310ac2){_0x6c6903=_0x6c6903-0x0;var _0x228901=_0xf331[_0x6c6903];return _0x228901;};'use strict';var _=require(_0x1f33('0x0'));var util=require(_0x1f33('0x1'));var logger=require(_0x1f33('0x2'))(_0x1f33('0x3'));var moment=require(_0x1f33('0x4'));var BPromise=require(_0x1f33('0x5'));var rp=require(_0x1f33('0x6'));var fs=require('fs');var path=require(_0x1f33('0x7'));var rimraf=require(_0x1f33('0x8'));var config=require(_0x1f33('0x9'));var attributes=require(_0x1f33('0xa'));module['exports']=function(_0x4b5121,_0x329f1e){return _0x4b5121[_0x1f33('0xb')](_0x1f33('0xc'),attributes,{'tableName':_0x1f33('0xd'),'paranoid':![],'indexes':[{'name':_0x1f33('0xe'),'fields':[_0x1f33('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30bc=['moment','bluebird','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x30bc,0x10d));var _0xc30b=function(_0x52ab0a,_0xf641d5){_0x52ab0a=_0x52ab0a-0x0;var _0x1d2cab=_0x30bc[_0x52ab0a];return _0x1d2cab;};'use strict';var _=require(_0xc30b('0x0'));var util=require(_0xc30b('0x1'));var logger=require(_0xc30b('0x2'))(_0xc30b('0x3'));var moment=require(_0xc30b('0x4'));var BPromise=require(_0xc30b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc30b('0x6'));var config=require(_0xc30b('0x7'));var attributes=require(_0xc30b('0x8'));module[_0xc30b('0x9')]=function(_0x4de5f3,_0x5cb7b7){return _0x4de5f3[_0xc30b('0xa')](_0xc30b('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xc30b('0xc'),'fields':[_0xc30b('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 255675e..023afc8 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(_0x52a592,_0x2926b4){var _0x511e55=function(_0x11afac){while(--_0x11afac){_0x52a592['push'](_0x52a592['shift']());}};_0x511e55(++_0x2926b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0xfcc0e,_0x1da886){var _0x32bb2e=function(_0x4c627c){while(--_0x4c627c){_0xfcc0e['push'](_0xfcc0e['shift']());}};_0x32bb2e(++_0x1da886);}(_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);});});}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 716e3fa..7ddaf21 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 _0x1cb9=['../../config/environment','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1db8eb,_0xecc38f){var _0x2b28f0=function(_0x514e8a){while(--_0x514e8a){_0x1db8eb['push'](_0x1db8eb['shift']());}};_0x2b28f0(++_0xecc38f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x37c66e,_0x20f54b){_0x37c66e=_0x37c66e-0x0;var _0x1b902e=_0x1cb9[_0x37c66e];return _0x1b902e;};'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('./voiceTransferReport.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['show']);router[_0x91cb('0xb')]('/',auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['put'](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xd')]);router[_0x91cb('0xe')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xf')]);module[_0x91cb('0x10')]=router; \ No newline at end of file +var _0x5fc3=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','/:id','show'];(function(_0x1fcdeb,_0x321e47){var _0x5bfb7f=function(_0x420f9c){while(--_0x420f9c){_0x1fcdeb['push'](_0x1fcdeb['shift']());}};_0x5bfb7f(++_0x321e47);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x5fc3[_0x5ce3c8];return _0xa76867;};'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('0xe')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller['update']);router[_0x35fc('0xf')](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);module[_0x35fc('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 7cbfbe6..2f5e067 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 _0xba5c=['moment','ENUM','attended','STRING','Yes'];(function(_0x484fea,_0x3a11a0){var _0x543077=function(_0x7a22c9){while(--_0x7a22c9){_0x484fea['push'](_0x484fea['shift']());}};_0x543077(++_0x3a11a0);}(_0xba5c,0xf0));var _0xcba5=function(_0x1e0b94,_0x2b6a6c){_0x1e0b94=_0x1e0b94-0x0;var _0x4a1b15=_0xba5c[_0x1e0b94];return _0x4a1b15;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcba5('0x0'));module['exports']={'type':{'type':Sequelize[_0xcba5('0x1')]('blind',_0xcba5('0x2'))},'result':{'type':Sequelize[_0xcba5('0x3')]},'transfererchannel':{'type':Sequelize[_0xcba5('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xcba5('0x3')]},'transferercalleridname':{'type':Sequelize[_0xcba5('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xcba5('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xcba5('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xcba5('0x3')]},'transferercontext':{'type':Sequelize[_0xcba5('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xcba5('0x3')]},'transfereechannel':{'type':Sequelize[_0xcba5('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xcba5('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xcba5('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xcba5('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xcba5('0x3')]},'transfereecontext':{'type':Sequelize[_0xcba5('0x3')]},'transfereeexten':{'type':Sequelize[_0xcba5('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xcba5('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xcba5('0x4'),'No')},'context':{'type':Sequelize[_0xcba5('0x3')]},'extension':{'type':Sequelize[_0xcba5('0x3')]}}; \ No newline at end of file +var _0xbacf=['moment','ENUM','attended','STRING','Yes'];(function(_0x53ef8c,_0x31f1da){var _0xb12484=function(_0x4664a6){while(--_0x4664a6){_0x53ef8c['push'](_0x53ef8c['shift']());}};_0xb12484(++_0x31f1da);}(_0xbacf,0x12c));var _0xfbac=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0xbacf[_0x1d9163];return _0xb42197;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfbac('0x0'));module['exports']={'type':{'type':Sequelize[_0xfbac('0x1')]('blind',_0xfbac('0x2'))},'result':{'type':Sequelize[_0xfbac('0x3')]},'transfererchannel':{'type':Sequelize[_0xfbac('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xfbac('0x3')]},'transferercalleridname':{'type':Sequelize[_0xfbac('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xfbac('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xfbac('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xfbac('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xfbac('0x3')]},'transfereechannel':{'type':Sequelize[_0xfbac('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xfbac('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xfbac('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xfbac('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xfbac('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xfbac('0x3')]},'transfereecontext':{'type':Sequelize[_0xfbac('0x3')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xfbac('0x3')]},'isexternal':{'type':Sequelize[_0xfbac('0x1')](_0xfbac('0x4'),'No')},'context':{'type':Sequelize[_0xfbac('0x3')]},'extension':{'type':Sequelize[_0xfbac('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index d012aca..00fb94a 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 _0x7e9d=['offset','limit','Content-Range','json','apply','reject','save','destroy','stack','index','map','rawAttributes','fieldName','type','name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','count','then','includeAll','include','VoiceTransferReport','findAll','rows','catch','show','params','keys','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x58de6b,_0x54f183){var _0x49e387=function(_0x37c2e6){while(--_0x37c2e6){_0x58de6b['push'](_0x58de6b['shift']());}};_0x49e387(++_0x54f183);}(_0x7e9d,0xbd));var _0xd7e9=function(_0x59f5bf,_0x20c664){_0x59f5bf=_0x59f5bf-0x0;var _0x13c79f=_0x7e9d[_0x59f5bf];return _0x13c79f;};'use strict';var pdf=require(_0xd7e9('0x0'));var emlformat=require(_0xd7e9('0x1'));var rimraf=require(_0xd7e9('0x2'));var zipdir=require(_0xd7e9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7e9('0x4'));var moment=require(_0xd7e9('0x5'));var BPromise=require(_0xd7e9('0x6'));var Mustache=require(_0xd7e9('0x7'));var util=require(_0xd7e9('0x8'));var path=require(_0xd7e9('0x9'));var sox=require(_0xd7e9('0xa'));var csv=require(_0xd7e9('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd7e9('0xc'));var squel=require(_0xd7e9('0xd'));var crypto=require('crypto');var jsforce=require(_0xd7e9('0xe'));var deskjs=require(_0xd7e9('0xf'));var toCsv=require(_0xd7e9('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd7e9('0x10'));var qs=require(_0xd7e9('0x11'));var as=require(_0xd7e9('0x12'));var hardwareService=require(_0xd7e9('0x13'));var logger=require(_0xd7e9('0x14'))('api');var utils=require(_0xd7e9('0x15'));var config=require(_0xd7e9('0x16'));var db=require(_0xd7e9('0x17'))['db'];function respondWithStatusCode(_0x5067b4,_0x250f9f){_0x250f9f=_0x250f9f||0xcc;return function(_0xeb848f){if(_0xeb848f){return _0x5067b4[_0xd7e9('0x18')](_0x250f9f);}return _0x5067b4[_0xd7e9('0x19')](_0x250f9f)[_0xd7e9('0x1a')]();};}function respondWithResult(_0x4bf6d7,_0x3c008a){_0x3c008a=_0x3c008a||0xc8;return function(_0x2fac63){if(_0x2fac63){return _0x4bf6d7['status'](_0x3c008a)['json'](_0x2fac63);}};}function respondWithFilteredResult(_0x32872b,_0x4a8fc5){return function(_0x15e665){if(_0x15e665){var _0x4553ad=_0x15e665['count'],_0xaeee4c=_0x4a8fc5[_0xd7e9('0x1b')],_0x22476d=_0x4a8fc5['offset']+_0x4a8fc5[_0xd7e9('0x1c')],_0x381812;if(_0x22476d>=_0x4553ad){_0x22476d=_0x4553ad;_0x381812=0xc8;}else{_0x381812=0xce;}_0x32872b[_0xd7e9('0x19')](_0x381812);return _0x32872b['set'](_0xd7e9('0x1d'),_0xaeee4c+'-'+_0x22476d+'/'+_0x4553ad)[_0xd7e9('0x1e')](_0x15e665);}return null;};}function patchUpdates(_0x5db5fb){return function(_0x25f5f9){try{jsonpatch[_0xd7e9('0x1f')](_0x25f5f9,_0x5db5fb,!![]);}catch(_0x3cd2a5){return BPromise[_0xd7e9('0x20')](_0x3cd2a5);}return _0x25f5f9[_0xd7e9('0x21')]();};}function saveUpdates(_0x470fff,_0x1f05a9){return function(_0xd9d7e){if(_0xd9d7e){return _0xd9d7e['update'](_0x470fff)['then'](function(_0x4c6a8e){return _0x4c6a8e;});}return null;};}function removeEntity(_0x45aa0c,_0x259210){return function(_0x5ebe42){if(_0x5ebe42){return _0x5ebe42[_0xd7e9('0x22')]()['then'](function(){_0x45aa0c[_0xd7e9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460d12,_0x450702){return function(_0x103bbd){if(!_0x103bbd){_0x460d12[_0xd7e9('0x18')](0x194);}return _0x103bbd;};}function handleError(_0x26bb45,_0x2e5681){_0x2e5681=_0x2e5681||0x1f4;return function(_0x35c6e9){logger['error'](_0x35c6e9[_0xd7e9('0x23')]);if(_0x35c6e9['name']){delete _0x35c6e9['name'];}_0x26bb45[_0xd7e9('0x19')](_0x2e5681)['send'](_0x35c6e9);};}exports[_0xd7e9('0x24')]=function(_0x3df31f,_0x4bd6c3){var _0x341ba6={},_0x2ddfeb={},_0x2804e1={'count':0x0,'rows':[]};var _0x5aade1=_[_0xd7e9('0x25')](db['VoiceTransferReport'][_0xd7e9('0x26')],function(_0x233d38){return{'name':_0x233d38[_0xd7e9('0x27')],'type':_0x233d38[_0xd7e9('0x28')]['key']};});_0x2ddfeb['model']=_[_0xd7e9('0x25')](_0x5aade1,_0xd7e9('0x29'));_0x2ddfeb[_0xd7e9('0x2a')]=_['keys'](_0x3df31f[_0xd7e9('0x2a')]);_0x2ddfeb[_0xd7e9('0x2b')]=_['intersection'](_0x2ddfeb[_0xd7e9('0x2c')],_0x2ddfeb[_0xd7e9('0x2a')]);_0x341ba6[_0xd7e9('0x2d')]=_[_0xd7e9('0x2e')](_0x2ddfeb[_0xd7e9('0x2c')],qs[_0xd7e9('0x2f')](_0x3df31f[_0xd7e9('0x2a')][_0xd7e9('0x2f')]));_0x341ba6[_0xd7e9('0x2d')]=_0x341ba6[_0xd7e9('0x2d')][_0xd7e9('0x30')]?_0x341ba6['attributes']:_0x2ddfeb['model'];if(!_0x3df31f[_0xd7e9('0x2a')][_0xd7e9('0x31')](_0xd7e9('0x32'))){_0x341ba6[_0xd7e9('0x1c')]=qs[_0xd7e9('0x1c')](_0x3df31f[_0xd7e9('0x2a')][_0xd7e9('0x1c')]);_0x341ba6[_0xd7e9('0x1b')]=qs[_0xd7e9('0x1b')](_0x3df31f[_0xd7e9('0x2a')][_0xd7e9('0x1b')]);}_0x341ba6[_0xd7e9('0x33')]=qs[_0xd7e9('0x34')](_0x3df31f['query'][_0xd7e9('0x34')]);_0x341ba6['where']=qs[_0xd7e9('0x2b')](_[_0xd7e9('0x35')](_0x3df31f[_0xd7e9('0x2a')],_0x2ddfeb[_0xd7e9('0x2b')]),_0x5aade1);if(_0x3df31f[_0xd7e9('0x2a')][_0xd7e9('0x36')]){_0x341ba6['where']=_[_0xd7e9('0x37')](_0x341ba6['where'],{'$or':_[_0xd7e9('0x25')](_0x5aade1,function(_0x349c78){if(_0x349c78[_0xd7e9('0x28')]!=='VIRTUAL'){var _0x3bc553={};_0x3bc553[_0x349c78['name']]={'$like':'%'+_0x3df31f[_0xd7e9('0x2a')][_0xd7e9('0x36')]+'%'};return _0x3bc553;}})});}_0x341ba6=_[_0xd7e9('0x37')]({},_0x341ba6,_0x3df31f[_0xd7e9('0x38')]);var _0x4fdc20={'where':_0x341ba6['where']};return db['VoiceTransferReport'][_0xd7e9('0x39')](_0x4fdc20)[_0xd7e9('0x3a')](function(_0x43e7dd){_0x2804e1[_0xd7e9('0x39')]=_0x43e7dd;if(_0x3df31f[_0xd7e9('0x2a')][_0xd7e9('0x3b')]){_0x341ba6[_0xd7e9('0x3c')]=[{'all':!![]}];}return db[_0xd7e9('0x3d')][_0xd7e9('0x3e')](_0x341ba6);})[_0xd7e9('0x3a')](function(_0x2a7706){_0x2804e1[_0xd7e9('0x3f')]=_0x2a7706;return _0x2804e1;})[_0xd7e9('0x3a')](respondWithFilteredResult(_0x4bd6c3,_0x341ba6))[_0xd7e9('0x40')](handleError(_0x4bd6c3,null));};exports[_0xd7e9('0x41')]=function(_0x21edd4,_0xf8b479){var _0x3344b6={'raw':!![],'where':{'id':_0x21edd4[_0xd7e9('0x42')]['id']}},_0x43e4a9={};_0x43e4a9[_0xd7e9('0x2c')]=_[_0xd7e9('0x43')](db[_0xd7e9('0x3d')][_0xd7e9('0x26')]);_0x43e4a9['query']=_[_0xd7e9('0x43')](_0x21edd4['query']);_0x43e4a9[_0xd7e9('0x2b')]=_[_0xd7e9('0x2e')](_0x43e4a9[_0xd7e9('0x2c')],_0x43e4a9[_0xd7e9('0x2a')]);_0x3344b6[_0xd7e9('0x2d')]=_[_0xd7e9('0x2e')](_0x43e4a9[_0xd7e9('0x2c')],qs[_0xd7e9('0x2f')](_0x21edd4[_0xd7e9('0x2a')][_0xd7e9('0x2f')]));_0x3344b6[_0xd7e9('0x2d')]=_0x3344b6['attributes'][_0xd7e9('0x30')]?_0x3344b6[_0xd7e9('0x2d')]:_0x43e4a9[_0xd7e9('0x2c')];if(_0x21edd4[_0xd7e9('0x2a')][_0xd7e9('0x3b')]){_0x3344b6[_0xd7e9('0x3c')]=[{'all':!![]}];}_0x3344b6=_[_0xd7e9('0x37')]({},_0x3344b6,_0x21edd4[_0xd7e9('0x38')]);return db['VoiceTransferReport'][_0xd7e9('0x44')](_0x3344b6)[_0xd7e9('0x3a')](handleEntityNotFound(_0xf8b479,null))[_0xd7e9('0x3a')](respondWithResult(_0xf8b479,null))[_0xd7e9('0x40')](handleError(_0xf8b479,null));};exports[_0xd7e9('0x45')]=function(_0x4cc9b4,_0x30f735){return db[_0xd7e9('0x3d')]['create'](_0x4cc9b4[_0xd7e9('0x46')],{})['then'](respondWithResult(_0x30f735,0xc9))[_0xd7e9('0x40')](handleError(_0x30f735,null));};exports[_0xd7e9('0x47')]=function(_0x6615f8,_0x1ce227){if(_0x6615f8[_0xd7e9('0x46')]['id']){delete _0x6615f8['body']['id'];}return db[_0xd7e9('0x3d')][_0xd7e9('0x44')]({'where':{'id':_0x6615f8[_0xd7e9('0x42')]['id']}})[_0xd7e9('0x3a')](handleEntityNotFound(_0x1ce227,null))[_0xd7e9('0x3a')](saveUpdates(_0x6615f8[_0xd7e9('0x46')],null))[_0xd7e9('0x3a')](respondWithResult(_0x1ce227,null))[_0xd7e9('0x40')](handleError(_0x1ce227,null));};exports['destroy']=function(_0x498bbd,_0x3f18a8){return db[_0xd7e9('0x3d')][_0xd7e9('0x44')]({'where':{'id':_0x498bbd[_0xd7e9('0x42')]['id']}})[_0xd7e9('0x3a')](handleEntityNotFound(_0x3f18a8,null))[_0xd7e9('0x3a')](removeEntity(_0x3f18a8,null))[_0xd7e9('0x40')](handleError(_0x3f18a8,null));}; \ No newline at end of file +var _0x8f41=['status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','VoiceTransferReport','rawAttributes','model','map','query','keys','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','where','type','filter','includeAll','include','rows','catch','fields','merge','options','create','body','find','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x2c1df5,_0x2093be){var _0x3948e8=function(_0x5c5c6a){while(--_0x5c5c6a){_0x2c1df5['push'](_0x2c1df5['shift']());}};_0x3948e8(++_0x2093be);}(_0x8f41,0xba));var _0x18f4=function(_0x49286c,_0x4b9418){_0x49286c=_0x49286c-0x0;var _0x56cf98=_0x8f41[_0x49286c];return _0x56cf98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x18f4('0x0'));var rimraf=require(_0x18f4('0x1'));var zipdir=require(_0x18f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x18f4('0x3'));var BPromise=require(_0x18f4('0x4'));var Mustache=require(_0x18f4('0x5'));var util=require(_0x18f4('0x6'));var path=require(_0x18f4('0x7'));var sox=require(_0x18f4('0x8'));var csv=require(_0x18f4('0x9'));var ejs=require(_0x18f4('0xa'));var fs=require('fs');var _=require(_0x18f4('0xb'));var squel=require(_0x18f4('0xc'));var crypto=require(_0x18f4('0xd'));var jsforce=require(_0x18f4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x18f4('0x9'));var querystring=require(_0x18f4('0xf'));var Papa=require('papaparse');var Redis=require(_0x18f4('0x10'));var authService=require(_0x18f4('0x11'));var qs=require(_0x18f4('0x12'));var as=require(_0x18f4('0x13'));var hardwareService=require(_0x18f4('0x14'));var logger=require(_0x18f4('0x15'))(_0x18f4('0x16'));var utils=require(_0x18f4('0x17'));var config=require(_0x18f4('0x18'));var db=require(_0x18f4('0x19'))['db'];function respondWithStatusCode(_0x33602f,_0x5ac0eb){_0x5ac0eb=_0x5ac0eb||0xcc;return function(_0x1d01c5){if(_0x1d01c5){return _0x33602f[_0x18f4('0x1a')](_0x5ac0eb);}return _0x33602f[_0x18f4('0x1b')](_0x5ac0eb)['end']();};}function respondWithResult(_0x4151b1,_0x57437a){_0x57437a=_0x57437a||0xc8;return function(_0x27dfdd){if(_0x27dfdd){return _0x4151b1[_0x18f4('0x1b')](_0x57437a)['json'](_0x27dfdd);}};}function respondWithFilteredResult(_0xf86def,_0x9cf2c0){return function(_0x3ac95b){if(_0x3ac95b){var _0x41a1f5=_0x3ac95b[_0x18f4('0x1c')],_0xcfdbef=_0x9cf2c0[_0x18f4('0x1d')],_0x34339c=_0x9cf2c0['offset']+_0x9cf2c0['limit'],_0x478135;if(_0x34339c>=_0x41a1f5){_0x34339c=_0x41a1f5;_0x478135=0xc8;}else{_0x478135=0xce;}_0xf86def[_0x18f4('0x1b')](_0x478135);return _0xf86def[_0x18f4('0x1e')](_0x18f4('0x1f'),_0xcfdbef+'-'+_0x34339c+'/'+_0x41a1f5)[_0x18f4('0x20')](_0x3ac95b);}return null;};}function patchUpdates(_0x374ffb){return function(_0x5aeceb){try{jsonpatch[_0x18f4('0x21')](_0x5aeceb,_0x374ffb,!![]);}catch(_0x537b17){return BPromise[_0x18f4('0x22')](_0x537b17);}return _0x5aeceb[_0x18f4('0x23')]();};}function saveUpdates(_0x1e5a89,_0x1d21cf){return function(_0x1f1a3d){if(_0x1f1a3d){return _0x1f1a3d[_0x18f4('0x24')](_0x1e5a89)[_0x18f4('0x25')](function(_0x31537a){return _0x31537a;});}return null;};}function removeEntity(_0x1a1790,_0xce58af){return function(_0x396cb8){if(_0x396cb8){return _0x396cb8[_0x18f4('0x26')]()['then'](function(){_0x1a1790[_0x18f4('0x1b')](0xcc)[_0x18f4('0x27')]();});}};}function handleEntityNotFound(_0x4abe83,_0x56f467){return function(_0x2374a2){if(!_0x2374a2){_0x4abe83[_0x18f4('0x1a')](0x194);}return _0x2374a2;};}function handleError(_0x5b3153,_0x584da9){_0x584da9=_0x584da9||0x1f4;return function(_0x215b06){logger[_0x18f4('0x28')](_0x215b06['stack']);if(_0x215b06[_0x18f4('0x29')]){delete _0x215b06['name'];}_0x5b3153[_0x18f4('0x1b')](_0x584da9)['send'](_0x215b06);};}exports['index']=function(_0x2922fd,_0x5e0fff){var _0x15682f={},_0x242aea={},_0x406039={'count':0x0,'rows':[]};var _0x56e7a5=_['map'](db[_0x18f4('0x2a')][_0x18f4('0x2b')],function(_0x1a2308){return{'name':_0x1a2308['fieldName'],'type':_0x1a2308['type']['key']};});_0x242aea[_0x18f4('0x2c')]=_[_0x18f4('0x2d')](_0x56e7a5,'name');_0x242aea[_0x18f4('0x2e')]=_[_0x18f4('0x2f')](_0x2922fd['query']);_0x242aea['filters']=_['intersection'](_0x242aea['model'],_0x242aea[_0x18f4('0x2e')]);_0x15682f[_0x18f4('0x30')]=_['intersection'](_0x242aea['model'],qs['fields'](_0x2922fd['query']['fields']));_0x15682f['attributes']=_0x15682f['attributes'][_0x18f4('0x31')]?_0x15682f[_0x18f4('0x30')]:_0x242aea['model'];if(!_0x2922fd[_0x18f4('0x2e')][_0x18f4('0x32')](_0x18f4('0x33'))){_0x15682f['limit']=qs[_0x18f4('0x34')](_0x2922fd[_0x18f4('0x2e')]['limit']);_0x15682f[_0x18f4('0x1d')]=qs[_0x18f4('0x1d')](_0x2922fd['query']['offset']);}_0x15682f[_0x18f4('0x35')]=qs['sort'](_0x2922fd[_0x18f4('0x2e')][_0x18f4('0x36')]);_0x15682f['where']=qs['filters'](_[_0x18f4('0x37')](_0x2922fd[_0x18f4('0x2e')],_0x242aea[_0x18f4('0x38')]),_0x56e7a5);if(_0x2922fd[_0x18f4('0x2e')]['filter']){_0x15682f[_0x18f4('0x39')]=_['merge'](_0x15682f['where'],{'$or':_[_0x18f4('0x2d')](_0x56e7a5,function(_0x36a2c0){if(_0x36a2c0[_0x18f4('0x3a')]!=='VIRTUAL'){var _0x2304e7={};_0x2304e7[_0x36a2c0[_0x18f4('0x29')]]={'$like':'%'+_0x2922fd[_0x18f4('0x2e')][_0x18f4('0x3b')]+'%'};return _0x2304e7;}})});}_0x15682f=_['merge']({},_0x15682f,_0x2922fd['options']);var _0x104c3c={'where':_0x15682f['where']};return db[_0x18f4('0x2a')][_0x18f4('0x1c')](_0x104c3c)[_0x18f4('0x25')](function(_0x4fbdbe){_0x406039[_0x18f4('0x1c')]=_0x4fbdbe;if(_0x2922fd[_0x18f4('0x2e')][_0x18f4('0x3c')]){_0x15682f[_0x18f4('0x3d')]=[{'all':!![]}];}return db[_0x18f4('0x2a')]['findAll'](_0x15682f);})['then'](function(_0x52abe2){_0x406039[_0x18f4('0x3e')]=_0x52abe2;return _0x406039;})[_0x18f4('0x25')](respondWithFilteredResult(_0x5e0fff,_0x15682f))[_0x18f4('0x3f')](handleError(_0x5e0fff,null));};exports['show']=function(_0x275982,_0x306db7){var _0x32f934={'raw':!![],'where':{'id':_0x275982['params']['id']}},_0x1b743f={};_0x1b743f[_0x18f4('0x2c')]=_[_0x18f4('0x2f')](db[_0x18f4('0x2a')][_0x18f4('0x2b')]);_0x1b743f[_0x18f4('0x2e')]=_[_0x18f4('0x2f')](_0x275982[_0x18f4('0x2e')]);_0x1b743f['filters']=_['intersection'](_0x1b743f[_0x18f4('0x2c')],_0x1b743f[_0x18f4('0x2e')]);_0x32f934[_0x18f4('0x30')]=_['intersection'](_0x1b743f[_0x18f4('0x2c')],qs[_0x18f4('0x40')](_0x275982['query'][_0x18f4('0x40')]));_0x32f934[_0x18f4('0x30')]=_0x32f934[_0x18f4('0x30')][_0x18f4('0x31')]?_0x32f934[_0x18f4('0x30')]:_0x1b743f['model'];if(_0x275982[_0x18f4('0x2e')][_0x18f4('0x3c')]){_0x32f934[_0x18f4('0x3d')]=[{'all':!![]}];}_0x32f934=_[_0x18f4('0x41')]({},_0x32f934,_0x275982[_0x18f4('0x42')]);return db[_0x18f4('0x2a')]['find'](_0x32f934)[_0x18f4('0x25')](handleEntityNotFound(_0x306db7,null))['then'](respondWithResult(_0x306db7,null))['catch'](handleError(_0x306db7,null));};exports[_0x18f4('0x43')]=function(_0x123108,_0x346979){return db[_0x18f4('0x2a')][_0x18f4('0x43')](_0x123108[_0x18f4('0x44')],{})[_0x18f4('0x25')](respondWithResult(_0x346979,0xc9))[_0x18f4('0x3f')](handleError(_0x346979,null));};exports['update']=function(_0x5be097,_0x476460){if(_0x5be097[_0x18f4('0x44')]['id']){delete _0x5be097[_0x18f4('0x44')]['id'];}return db[_0x18f4('0x2a')][_0x18f4('0x45')]({'where':{'id':_0x5be097[_0x18f4('0x46')]['id']}})['then'](handleEntityNotFound(_0x476460,null))[_0x18f4('0x25')](saveUpdates(_0x5be097[_0x18f4('0x44')],null))['then'](respondWithResult(_0x476460,null))[_0x18f4('0x3f')](handleError(_0x476460,null));};exports[_0x18f4('0x26')]=function(_0x4ed574,_0x4c0787){return db[_0x18f4('0x2a')]['find']({'where':{'id':_0x4ed574[_0x18f4('0x46')]['id']}})[_0x18f4('0x25')](handleEntityNotFound(_0x4c0787,null))[_0x18f4('0x25')](removeEntity(_0x4c0787,null))[_0x18f4('0x3f')](handleError(_0x4c0787,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 51dfd77..8c6c4c9 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 _0x3f94=['define','VoiceTransferReport','report_call_transfer','util','api','moment','bluebird','request-promise','./voiceTransferReport.attributes','exports'];(function(_0x36ce2f,_0x2eaa01){var _0x306395=function(_0x39cb94){while(--_0x39cb94){_0x36ce2f['push'](_0x36ce2f['shift']());}};_0x306395(++_0x2eaa01);}(_0x3f94,0x11b));var _0x43f9=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x3f94[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0x43f9('0x0'));var logger=require('../../config/logger')(_0x43f9('0x1'));var moment=require(_0x43f9('0x2'));var BPromise=require(_0x43f9('0x3'));var rp=require(_0x43f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x43f9('0x5'));module[_0x43f9('0x6')]=function(_0x15cb08,_0x29a597){return _0x15cb08[_0x43f9('0x7')](_0x43f9('0x8'),attributes,{'tableName':_0x43f9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa852=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x408d22,_0x53eef9){var _0x58effd=function(_0x4ab8ee){while(--_0x4ab8ee){_0x408d22['push'](_0x408d22['shift']());}};_0x58effd(++_0x53eef9);}(_0xa852,0x1bc));var _0x2a85=function(_0x424d55,_0x4efeec){_0x424d55=_0x424d55-0x0;var _0x344d28=_0xa852[_0x424d55];return _0x344d28;};'use strict';var _=require(_0x2a85('0x0'));var util=require(_0x2a85('0x1'));var logger=require(_0x2a85('0x2'))(_0x2a85('0x3'));var moment=require(_0x2a85('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a85('0x5'));var fs=require('fs');var path=require(_0x2a85('0x6'));var rimraf=require(_0x2a85('0x7'));var config=require(_0x2a85('0x8'));var attributes=require(_0x2a85('0x9'));module[_0x2a85('0xa')]=function(_0xca3655,_0x52d285){return _0xca3655['define'](_0x2a85('0xb'),attributes,{'tableName':_0x2a85('0xc'),'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 808fd2e..3f13e6f 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 _0x9f5a=['client','http','request','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','info','result','CreateVoiceTransferReport','create','body','options','raw','then','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3758da,_0x5a92b4){var _0x64c895=function(_0x2d8a3e){while(--_0x2d8a3e){_0x3758da['push'](_0x3758da['shift']());}};_0x64c895(++_0x5a92b4);}(_0x9f5a,0x1df));var _0xa9f5=function(_0x55ea99,_0x4ec9e4){_0x55ea99=_0x55ea99-0x0;var _0x2bdab1=_0x9f5a[_0x55ea99];return _0x2bdab1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa9f5('0x0'));var fs=require('fs');var Redis=require(_0xa9f5('0x1'));var db=require(_0xa9f5('0x2'))['db'];var utils=require(_0xa9f5('0x3'));var logger=require(_0xa9f5('0x4'))(_0xa9f5('0x5'));var config=require(_0xa9f5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa9f5('0x7')][_0xa9f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46f4dd,_0x67ac2,_0x7ae52e){return new BPromise(function(_0x316db9,_0x5d9870){return client[_0xa9f5('0x9')](_0x46f4dd,_0x7ae52e)['then'](function(_0x408dc0){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x67ac2,_0xa9f5('0xa'));logger[_0xa9f5('0xb')](_0xa9f5('0xc'),_0x67ac2,_0xa9f5('0xa'),JSON[_0xa9f5('0xd')](_0x408dc0));if(_0x408dc0[_0xa9f5('0xe')]){if(_0x408dc0[_0xa9f5('0xe')][_0xa9f5('0xf')]===0x1f4){logger[_0xa9f5('0xe')](_0xa9f5('0x10'),_0x67ac2,_0x408dc0[_0xa9f5('0xe')][_0xa9f5('0x11')]);return _0x5d9870(_0x408dc0[_0xa9f5('0xe')][_0xa9f5('0x11')]);}logger[_0xa9f5('0xe')](_0xa9f5('0x10'),_0x67ac2,_0x408dc0[_0xa9f5('0xe')][_0xa9f5('0x11')]);return _0x316db9(_0x408dc0[_0xa9f5('0xe')][_0xa9f5('0x11')]);}else{logger[_0xa9f5('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x67ac2,_0xa9f5('0xa'));_0x316db9(_0x408dc0[_0xa9f5('0x13')][_0xa9f5('0x11')]);}})['catch'](function(_0x5a4cdc){logger[_0xa9f5('0xe')](_0xa9f5('0x10'),_0x67ac2,_0x5a4cdc);_0x5d9870(_0x5a4cdc);});});}exports[_0xa9f5('0x14')]=function(_0x4cb817){var _0x562788=this;return new Promise(function(_0x58d342,_0x1c56b8){return db['VoiceTransferReport'][_0xa9f5('0x15')](_0x4cb817[_0xa9f5('0x16')],{'raw':_0x4cb817[_0xa9f5('0x17')]?_0x4cb817[_0xa9f5('0x17')][_0xa9f5('0x18')]===undefined?!![]:![]:!![]})[_0xa9f5('0x19')](function(_0xdad5d5){logger[_0xa9f5('0x12')](_0xa9f5('0x14'),_0x4cb817);logger[_0xa9f5('0xb')]('CreateVoiceTransferReport',_0x4cb817,JSON[_0xa9f5('0xd')](_0xdad5d5));_0x58d342(_0xdad5d5);})[_0xa9f5('0x1a')](function(_0xb9c01e){logger[_0xa9f5('0xe')](_0xa9f5('0x14'),_0xb9c01e['message'],_0x4cb817);_0x1c56b8(_0x562788[_0xa9f5('0xe')](0x1f4,_0xb9c01e['message']));});});}; \ No newline at end of file +var _0xb509=['raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options'];(function(_0x4a9d3c,_0x3c5510){var _0x3d6fc0=function(_0x2c7423){while(--_0x2c7423){_0x4a9d3c['push'](_0x4a9d3c['shift']());}};_0x3d6fc0(++_0x3c5510);}(_0xb509,0x110));var _0x9b50=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xb509[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0x9b50('0x0'));var util=require(_0x9b50('0x1'));var moment=require(_0x9b50('0x2'));var BPromise=require(_0x9b50('0x3'));var rs=require(_0x9b50('0x4'));var fs=require('fs');var Redis=require(_0x9b50('0x5'));var db=require(_0x9b50('0x6'))['db'];var utils=require(_0x9b50('0x7'));var logger=require(_0x9b50('0x8'))(_0x9b50('0x9'));var config=require(_0x9b50('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38942e,_0x4f89a4,_0x4edf03){return new BPromise(function(_0x3f770a,_0xab3d9d){return client[_0x9b50('0xb')](_0x38942e,_0x4edf03)[_0x9b50('0xc')](function(_0x2e8ac5){logger['info'](_0x9b50('0xd'),_0x4f89a4,_0x9b50('0xe'));logger['debug'](_0x9b50('0xf'),_0x4f89a4,_0x9b50('0xe'),JSON[_0x9b50('0x10')](_0x2e8ac5));if(_0x2e8ac5[_0x9b50('0x11')]){if(_0x2e8ac5[_0x9b50('0x11')][_0x9b50('0x12')]===0x1f4){logger[_0x9b50('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f89a4,_0x2e8ac5[_0x9b50('0x11')][_0x9b50('0x13')]);return _0xab3d9d(_0x2e8ac5[_0x9b50('0x11')][_0x9b50('0x13')]);}logger[_0x9b50('0x11')](_0x9b50('0xd'),_0x4f89a4,_0x2e8ac5['error'][_0x9b50('0x13')]);return _0x3f770a(_0x2e8ac5[_0x9b50('0x11')][_0x9b50('0x13')]);}else{logger[_0x9b50('0x14')](_0x9b50('0xd'),_0x4f89a4,_0x9b50('0xe'));_0x3f770a(_0x2e8ac5[_0x9b50('0x15')][_0x9b50('0x13')]);}})[_0x9b50('0x16')](function(_0x18b4ac){logger[_0x9b50('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x4f89a4,_0x18b4ac);_0xab3d9d(_0x18b4ac);});});}exports[_0x9b50('0x17')]=function(_0x11f5b9){var _0xad917d=this;return new Promise(function(_0x3abab2,_0x20cb2f){return db[_0x9b50('0x18')][_0x9b50('0x19')](_0x11f5b9[_0x9b50('0x1a')],{'raw':_0x11f5b9['options']?_0x11f5b9[_0x9b50('0x1b')][_0x9b50('0x1c')]===undefined?!![]:![]:!![]})[_0x9b50('0xc')](function(_0x1671c2){logger[_0x9b50('0x14')](_0x9b50('0x17'),_0x11f5b9);logger[_0x9b50('0x1d')](_0x9b50('0x17'),_0x11f5b9,JSON[_0x9b50('0x10')](_0x1671c2));_0x3abab2(_0x1671c2);})[_0x9b50('0x16')](function(_0x2352aa){logger['error']('CreateVoiceTransferReport',_0x2352aa[_0x9b50('0x13')],_0x11f5b9);_0x20cb2f(_0xad917d[_0x9b50('0x11')](0x1f4,_0x2352aa[_0x9b50('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 885904b..9f7a568 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 _0x710e=['canUpdate','/hangup','hangup','/answer','answer','hold','/unhold','unhold','/calls','calls','transfer','exports','express','./webbar.controller','post','/originate','isAuthenticated'];(function(_0x587e20,_0x4f148c){var _0x14a126=function(_0x53edc4){while(--_0x53edc4){_0x587e20['push'](_0x587e20['shift']());}};_0x14a126(++_0x4f148c);}(_0x710e,0xb6));var _0xe710=function(_0x26d197,_0x16e997){_0x26d197=_0x26d197-0x0;var _0x39d736=_0x710e[_0x26d197];return _0x39d736;};'use strict';var express=require(_0xe710('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xe710('0x1'));router[_0xe710('0x2')](_0xe710('0x3'),auth[_0xe710('0x4')](),auth[_0xe710('0x5')](),controller['originate']);router[_0xe710('0x2')](_0xe710('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe710('0x7')]);router[_0xe710('0x2')](_0xe710('0x8'),auth[_0xe710('0x4')](),auth[_0xe710('0x5')](),controller[_0xe710('0x9')]);router['post']('/hold',auth['isAuthenticated'](),auth[_0xe710('0x5')](),controller[_0xe710('0xa')]);router[_0xe710('0x2')](_0xe710('0xb'),auth[_0xe710('0x4')](),auth[_0xe710('0x5')](),controller[_0xe710('0xc')]);router[_0xe710('0x2')](_0xe710('0xd'),auth[_0xe710('0x4')](),auth[_0xe710('0x5')](),controller[_0xe710('0xe')]);router[_0xe710('0x2')]('/transfer',auth['isAuthenticated'](),auth[_0xe710('0x5')](),controller[_0xe710('0xf')]);module[_0xe710('0x10')]=router; \ No newline at end of file +var _0x2750=['/hangup','hangup','/answer','answer','/hold','hold','/unhold','unhold','calls','transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate'];(function(_0x3a944e,_0x1f9210){var _0x4c8158=function(_0xfedbf5){while(--_0xfedbf5){_0x3a944e['push'](_0x3a944e['shift']());}};_0x4c8158(++_0x1f9210);}(_0x2750,0x13b));var _0x0275=function(_0x440980,_0x176501){_0x440980=_0x440980-0x0;var _0x425323=_0x2750[_0x440980];return _0x425323;};'use strict';var express=require(_0x0275('0x0'));var router=express['Router']();var auth=require(_0x0275('0x1'));var controller=require(_0x0275('0x2'));router[_0x0275('0x3')](_0x0275('0x4'),auth[_0x0275('0x5')](),auth[_0x0275('0x6')](),controller[_0x0275('0x7')]);router[_0x0275('0x3')](_0x0275('0x8'),auth[_0x0275('0x5')](),auth['canUpdate'](),controller[_0x0275('0x9')]);router[_0x0275('0x3')](_0x0275('0xa'),auth[_0x0275('0x5')](),auth['canUpdate'](),controller[_0x0275('0xb')]);router[_0x0275('0x3')](_0x0275('0xc'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x0275('0xd')]);router['post'](_0x0275('0xe'),auth[_0x0275('0x5')](),auth[_0x0275('0x6')](),controller[_0x0275('0xf')]);router[_0x0275('0x3')]('/calls',auth[_0x0275('0x5')](),auth[_0x0275('0x6')](),controller[_0x0275('0x10')]);router['post']('/transfer',auth[_0x0275('0x5')](),auth[_0x0275('0x6')](),controller[_0x0275('0x11')]);module[_0x0275('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index adb3426..766990e 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 _0xc743=['ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','NotFound','request','then','result','catch','User','findOne','VoiceChannels','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','body','validate','length','json','callNumber','callerId','callbackUrl','format','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','user:%s','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','userId','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls','all','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','bluebird','http','../../config/logger','webbarapi'];(function(_0x10b434,_0x521745){var _0x31050b=function(_0x5c72e7){while(--_0x5c72e7){_0x10b434['push'](_0x10b434['shift']());}};_0x31050b(++_0x521745);}(_0xc743,0x15c));var _0x3c74=function(_0x3fa86d,_0x55ed45){_0x3fa86d=_0x3fa86d-0x0;var _0x55b1b0=_0xc743[_0x3fa86d];return _0x55b1b0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3c74('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x3c74('0x1'));var util=require(_0x3c74('0x2'));var BPromise=require(_0x3c74('0x3'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x3c74('0x4')]({'port':0x232a});var logger=require(_0x3c74('0x5'))(_0x3c74('0x6'));var Redis=require(_0x3c74('0x7'));config[_0x3c74('0x8')]=_[_0x3c74('0x9')](config[_0x3c74('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3c74('0xa'))(new Redis(config[_0x3c74('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x3c74('0xb'),'required':[!![],_0x3c74('0xc')]},'callNumber':{'type':_0x3c74('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x3c74('0xb'),'required':[!![],_0x3c74('0xc')]},'sessionId':{'type':_0x3c74('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3c74('0xc')]},'sessionId':{'type':_0x3c74('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3c74('0xb'),'required':[!![],_0x3c74('0xc')]},'sessionId':{'type':_0x3c74('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x3c74('0xe')]}});var holdValidation=new Schema({'userId':{'type':_0x3c74('0xb'),'required':[!![],_0x3c74('0xc')]},'sessionId':{'type':_0x3c74('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3c74('0xb'),'required':[!![],_0x3c74('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3c74('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3c74('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x574e52,_0xcab595,_0x2e8d06){logger[_0x3c74('0xf')](_0x574e52,_0xcab595,JSON['stringify'](_0x2e8d06));io['to'](_0x574e52)[_0x3c74('0x10')](_0xcab595,_0x2e8d06);}function handleError(_0x2bc964){return function(_0x307055){console[_0x3c74('0x11')](_0x3c74('0x12'),_0x307055,_0x307055 instanceof RangeError);logger[_0x3c74('0x13')](_0x307055[_0x3c74('0x14')]);if(_0x307055 instanceof RangeError){if(_0x307055[_0x3c74('0x15')]){delete _0x307055[_0x3c74('0x15')];}_0x2bc964[_0x3c74('0x16')](0x194)['send'](_0x307055);}else{if(_0x307055[_0x3c74('0x15')]){delete _0x307055['name'];}_0x2bc964[_0x3c74('0x16')](0x1f4)['send'](_0x307055);}};}function checkError(){return function(_0x34d4e1){if(!_0x34d4e1){throw new RangeError(_0x3c74('0x17'));}return _0x34d4e1;};}function respondWithRpcPromise(_0x4479d2,_0x41c92a){return new BPromise(function(_0x864c78,_0x54ff2a){var _0x1a47e6=amiClient;return _0x1a47e6[_0x3c74('0x18')](_0x4479d2,_0x41c92a)[_0x3c74('0x19')](function(_0x54a682){if(_0x54a682[_0x3c74('0x13')]){if(_0x54a682[_0x3c74('0x13')]['code']===0x1f4){return _0x54ff2a(_0x54a682[_0x3c74('0x13')]['message']);}return _0x864c78(_0x54a682[_0x3c74('0x13')]['message']);}else{_0x864c78(_0x54a682[_0x3c74('0x1a')]);}})[_0x3c74('0x1b')](function(_0x479f5b){_0x54ff2a(_0x479f5b);});});}function getAgent(_0x53023f){return db[_0x3c74('0x1c')][_0x3c74('0x1d')]({'where':{'id':_0x53023f,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x292560,_0x39247c){return new BPromise(function(_0x35b1ed,_0x25f764){var _0x13ab1a=respondWithRpcPromise(_0x3c74('0x1e'));var _0x4209fb=getAgent(_0x292560);Promise['all']([_0x13ab1a,_0x4209fb])[_0x3c74('0x19')](function(_0x47d95a){var _0x113d35=_0x47d95a[0x0];var _0x3e527b=_0x47d95a[0x1];var _0xab3c3f=_[_0x3c74('0x1f')](_0x113d35[_0x3c74('0x20')],function(_0x3b5803){return _0x3b5803[_0x3c74('0x21')]==_0x3e527b['id']&&_0x3b5803[_0x3c74('0x22')]==_0x39247c;});if(_0xab3c3f['length']==0x1){_0x35b1ed(_0x3e527b);}else{_0x25f764(new RangeError(_0x3c74('0x23')+_0x39247c+_0x3c74('0x24')));}});});}exports[_0x3c74('0x25')]=function(_0x1760d9,_0xbb0d9e){logger[_0x3c74('0xf')]('originate\x20fired:',_0x1760d9[_0x3c74('0x26')]);var _0x1c8178=originateValidation[_0x3c74('0x27')](_0x1760d9[_0x3c74('0x26')]);if(_0x1c8178[_0x3c74('0x28')]>0x0){return _0xbb0d9e['status'](0x190)[_0x3c74('0x29')](_0x1c8178);}var _0x169436=_0x1760d9['body']['userId'];var _0xc4c64d=_0x1760d9[_0x3c74('0x26')][_0x3c74('0x2a')];var _0x1a9534=_0x1760d9[_0x3c74('0x26')][_0x3c74('0x2b')];var _0x355330=_0x1760d9[_0x3c74('0x26')][_0x3c74('0x2c')];return getAgent(_0x169436)[_0x3c74('0x19')](function(_0x33576d){logger[_0x3c74('0xf')]('entityFound:',_0x33576d[_0x3c74('0x15')]);emit(util[_0x3c74('0x2d')]('user:%s',_0x33576d[_0x3c74('0x15')]),'webbar:originate',{'callNumber':_0xc4c64d,'callerId':_0x1a9534,'callbackUrl':_0x355330});return _0xbb0d9e[_0x3c74('0x16')](0xc8)[_0x3c74('0x29')]({'error':![],'message':_0x3c74('0x2e')});})[_0x3c74('0x1b')](handleError(_0xbb0d9e));};exports[_0x3c74('0x2f')]=function(_0x3ee276,_0x45ef11){logger[_0x3c74('0xf')](_0x3c74('0x30'),_0x3ee276[_0x3c74('0x26')]);var _0x3e2884=hangupValidation[_0x3c74('0x27')](_0x3ee276['body']);if(_0x3e2884['length']>0x0){return _0x45ef11[_0x3c74('0x16')](0x190)['json'](_0x3e2884);}var _0x12b7f2=_0x3ee276[_0x3c74('0x26')]['userId'];var _0x3018ac=_0x3ee276[_0x3c74('0x26')][_0x3c74('0x22')];return getAgent(_0x12b7f2)[_0x3c74('0x19')](function(_0x981566){logger[_0x3c74('0xf')](_0x3c74('0x31'),_0x981566[_0x3c74('0x15')]);emit(util[_0x3c74('0x2d')](_0x3c74('0x32'),_0x981566[_0x3c74('0x15')]),'webbar:hangup',{'sessionId':_0x3018ac});return _0x45ef11[_0x3c74('0x16')](0xc8)['json']({'error':![],'message':_0x3c74('0x33')});})[_0x3c74('0x1b')](handleError(_0x45ef11));};exports[_0x3c74('0x34')]=function(_0x55cf5e,_0x4422db){logger[_0x3c74('0xf')](_0x3c74('0x35'),_0x55cf5e[_0x3c74('0x26')]);var _0xbd9b11=answerValidation['validate'](_0x55cf5e[_0x3c74('0x26')]);if(_0xbd9b11[_0x3c74('0x28')]>0x0){return _0x4422db['status'](0x190)[_0x3c74('0x29')](_0xbd9b11);}var _0x14e3a1=_0x55cf5e[_0x3c74('0x26')]['userId'];var _0x284288=_0x55cf5e[_0x3c74('0x26')][_0x3c74('0x22')];return getAgent(_0x14e3a1)['then'](function(_0x2fcd81){logger[_0x3c74('0xf')](_0x3c74('0x31'),_0x2fcd81['name']);emit(util[_0x3c74('0x2d')]('user:%s',_0x2fcd81[_0x3c74('0x15')]),_0x3c74('0x36'),{'sessionId':_0x284288});return _0x4422db[_0x3c74('0x16')](0xc8)[_0x3c74('0x29')]({'error':![],'message':_0x3c74('0x37')});})[_0x3c74('0x1b')](handleError(_0x4422db));};exports[_0x3c74('0x38')]=function(_0x21fda2,_0x21d60d){logger['info'](_0x3c74('0x39'),_0x21fda2[_0x3c74('0x26')]);var _0x49cca2=holdValidation['validate'](_0x21fda2['body']);if(_0x49cca2[_0x3c74('0x28')]>0x0){return _0x21d60d[_0x3c74('0x16')](0x190)['json'](_0x49cca2);}var _0x3dc126=_0x21fda2['body'][_0x3c74('0x3a')];var _0x3eb7cc=_0x21fda2[_0x3c74('0x26')]['sessionId'];return getAgent(_0x3dc126)['then'](function(_0x50a499){logger['info'](_0x3c74('0x31'),_0x50a499['name']);emit(util[_0x3c74('0x2d')](_0x3c74('0x32'),_0x50a499[_0x3c74('0x15')]),'webbar:hold',{'sessionId':_0x3eb7cc});return _0x21d60d['status'](0xc8)['json']({'error':![],'message':_0x3c74('0x3b')});})['catch'](handleError(_0x21d60d));};exports['unhold']=function(_0x3efb6d,_0x295858){logger[_0x3c74('0xf')](_0x3c74('0x3c'),_0x3efb6d[_0x3c74('0x26')]);var _0x1b0d8b=unholdValidation[_0x3c74('0x27')](_0x3efb6d[_0x3c74('0x26')]);if(_0x1b0d8b[_0x3c74('0x28')]>0x0){return _0x295858[_0x3c74('0x16')](0x190)[_0x3c74('0x29')](_0x1b0d8b);}var _0x3d25e2=_0x3efb6d[_0x3c74('0x26')][_0x3c74('0x3a')];var _0x3b7d28=_0x3efb6d[_0x3c74('0x26')][_0x3c74('0x22')];return getAgent(_0x3d25e2)[_0x3c74('0x19')](function(_0x39cdaa){logger[_0x3c74('0xf')](_0x3c74('0x31'),_0x39cdaa['name']);emit(util[_0x3c74('0x2d')](_0x3c74('0x32'),_0x39cdaa[_0x3c74('0x15')]),'webbar:unhold',{'sessionId':_0x3b7d28});return _0x295858['status'](0xc8)[_0x3c74('0x29')]({'error':![],'message':_0x3c74('0x3d')});})[_0x3c74('0x1b')](handleError(_0x295858));};exports[_0x3c74('0x3e')]=function(_0x1cbcc7,_0x13c988){logger[_0x3c74('0xf')]('calls\x20fired:',_0x13c988['body']);var _0x499d36=callsValidation[_0x3c74('0x27')](_0x1cbcc7[_0x3c74('0x26')]);if(_0x499d36['length']>0x0){return _0x13c988[_0x3c74('0x16')](0x190)[_0x3c74('0x29')](_0x499d36);}var _0x39cd6b=_0x1cbcc7[_0x3c74('0x26')][_0x3c74('0x3a')];var _0x3f46ae=respondWithRpcPromise(_0x3c74('0x1e'));var _0x3260ca=getAgent(_0x39cd6b);return Promise[_0x3c74('0x3f')]([_0x3f46ae,_0x3260ca])[_0x3c74('0x19')](function(_0xc01851){var _0x13bb5e=_0xc01851[0x0];var _0x35fef2=_0xc01851[0x1];var _0x1160e4=_[_0x3c74('0x1f')](_0x13bb5e[_0x3c74('0x20')],function(_0x47aa4f){return _0x47aa4f[_0x3c74('0x21')]==_0x35fef2['id'];});return _0x13c988[_0x3c74('0x16')](0xc8)[_0x3c74('0x29')]({'count':_0x1160e4[_0x3c74('0x28')],'rows':_0x1160e4});})[_0x3c74('0x1b')](handleError(_0x13c988));};exports[_0x3c74('0x40')]=function(_0x47293e,_0x2421b4){logger[_0x3c74('0xf')]('conference\x20fired:',_0x47293e['body']);var _0x22ec41=conferenceValidation[_0x3c74('0x27')](_0x47293e[_0x3c74('0x26')]);if(_0x22ec41['length']>0x0){return _0x2421b4['status'](0x190)[_0x3c74('0x29')](_0x22ec41);}var _0x11c1dd=_0x47293e[_0x3c74('0x26')][_0x3c74('0x3a')];return getAgent(_0x11c1dd)[_0x3c74('0x19')](function(_0x276c8c){logger[_0x3c74('0xf')]('entityFound:',_0x276c8c[_0x3c74('0x15')]);emit(util[_0x3c74('0x2d')]('user:%s',_0x276c8c['name']),_0x3c74('0x41'));return _0x2421b4['status'](0xc8)[_0x3c74('0x29')]({'error':![],'message':_0x3c74('0x42')});})[_0x3c74('0x1b')](handleError(_0x2421b4));};exports[_0x3c74('0x43')]=function(_0x1f849e,_0x4e3c64){logger[_0x3c74('0xf')](_0x3c74('0x44'),_0x1f849e[_0x3c74('0x26')]);var _0x2d4dcd=transferValidation[_0x3c74('0x27')](_0x1f849e[_0x3c74('0x26')]);if(_0x2d4dcd[_0x3c74('0x28')]>0x0){return _0x4e3c64['status'](0x190)['json'](_0x2d4dcd);}var _0x34fa0a=_0x1f849e[_0x3c74('0x26')][_0x3c74('0x3a')];var _0x5dea6c=_0x1f849e[_0x3c74('0x26')][_0x3c74('0x22')];var _0x4d2b0e=_0x1f849e[_0x3c74('0x26')]['transferNumber'];return getAgent(_0x34fa0a)[_0x3c74('0x19')](function(_0x50cfd9){logger[_0x3c74('0xf')]('entityFound:',_0x50cfd9[_0x3c74('0x15')]);emit(util[_0x3c74('0x2d')](_0x3c74('0x32'),_0x50cfd9[_0x3c74('0x15')]),_0x3c74('0x45'),{'sessionId':_0x5dea6c,'transferNumber':_0x4d2b0e});return _0x4e3c64[_0x3c74('0x16')](0xc8)[_0x3c74('0x29')]({'error':![],'message':_0x3c74('0x46')});})[_0x3c74('0x1b')](handleError(_0x4e3c64));}; \ No newline at end of file +var _0x64b3=['originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','user:%s','webbar:hangup','hangup\x20executed!','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','VoiceChannels','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','request','then','code','message','result','catch','findOne','agent','all','filter','rows','sessionId','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x64b3,0x1de));var _0x364b=function(_0x5d5104,_0x2858bf){_0x5d5104=_0x5d5104-0x0;var _0x376b89=_0x64b3[_0x5d5104];return _0x376b89;};'use strict';var path=require(_0x364b('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x364b('0x1'));var util=require(_0x364b('0x2'));var BPromise=require(_0x364b('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x364b('0x4')][_0x364b('0x5')]({'port':0x232a});var logger=require(_0x364b('0x6'))(_0x364b('0x7'));var Redis=require(_0x364b('0x8'));config[_0x364b('0x9')]=_['defaults'](config['redis'],{'host':_0x364b('0xa'),'port':0x18eb});var io=require(_0x364b('0xb'))(new Redis(config[_0x364b('0x9')]));var Schema=require(_0x364b('0xc'));var originateValidation=new Schema({'userId':{'type':_0x364b('0xd'),'required':[!![],_0x364b('0xe')]},'callNumber':{'type':_0x364b('0xf'),'required':[!![],_0x364b('0x10')]},'callerId':{'type':_0x364b('0xf')},'callbackUrl':{'type':_0x364b('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x364b('0xd'),'required':[!![],_0x364b('0xe')]},'sessionId':{'type':_0x364b('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x364b('0xd'),'required':[!![],_0x364b('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x364b('0xd'),'required':[!![],_0x364b('0xe')]},'sessionId':{'type':_0x364b('0xf'),'required':[!![],_0x364b('0x11')]},'transferNumber':{'type':_0x364b('0xf'),'required':[!![],_0x364b('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x364b('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x364b('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x364b('0xd'),'required':[!![],_0x364b('0xe')]},'sessionId':{'type':_0x364b('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x364b('0xd'),'required':[!![],_0x364b('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0x364b('0xd'),'required':[!![],_0x364b('0xe')]}});function emit(_0x1c562b,_0x4714df,_0x203f1c){logger[_0x364b('0x13')](_0x1c562b,_0x4714df,JSON[_0x364b('0x14')](_0x203f1c));io['to'](_0x1c562b)[_0x364b('0x15')](_0x4714df,_0x203f1c);}function handleError(_0x1ad421){return function(_0x531a82){console['log'](_0x364b('0x16'),_0x531a82,_0x531a82 instanceof RangeError);logger[_0x364b('0x17')](_0x531a82[_0x364b('0x18')]);if(_0x531a82 instanceof RangeError){if(_0x531a82[_0x364b('0x19')]){delete _0x531a82[_0x364b('0x19')];}_0x1ad421[_0x364b('0x1a')](0x194)['send'](_0x531a82);}else{if(_0x531a82[_0x364b('0x19')]){delete _0x531a82[_0x364b('0x19')];}_0x1ad421['status'](0x1f4)['send'](_0x531a82);}};}function checkError(){return function(_0x256c9f){if(!_0x256c9f){throw new RangeError('NotFound');}return _0x256c9f;};}function respondWithRpcPromise(_0x5ea0f1,_0x4b21f1){return new BPromise(function(_0x2fcffa,_0x113cca){var _0x10052c=amiClient;return _0x10052c[_0x364b('0x1b')](_0x5ea0f1,_0x4b21f1)[_0x364b('0x1c')](function(_0x3c87e8){if(_0x3c87e8['error']){if(_0x3c87e8[_0x364b('0x17')][_0x364b('0x1d')]===0x1f4){return _0x113cca(_0x3c87e8[_0x364b('0x17')]['message']);}return _0x2fcffa(_0x3c87e8[_0x364b('0x17')][_0x364b('0x1e')]);}else{_0x2fcffa(_0x3c87e8[_0x364b('0x1f')]);}})[_0x364b('0x20')](function(_0x52820b){_0x113cca(_0x52820b);});});}function getAgent(_0x4a4c74){return db['User'][_0x364b('0x21')]({'where':{'id':_0x4a4c74,'role':_0x364b('0x22')}})[_0x364b('0x1c')](checkError());}function getAgentCheckSession(_0x3e4a52,_0x527c78){return new BPromise(function(_0x4ab042,_0x4d0e15){var _0x599d9d=respondWithRpcPromise('VoiceChannels');var _0x16c3aa=getAgent(_0x3e4a52);Promise[_0x364b('0x23')]([_0x599d9d,_0x16c3aa])[_0x364b('0x1c')](function(_0x4d061){var _0x3ef3ea=_0x4d061[0x0];var _0x18c4a8=_0x4d061[0x1];var _0x30f206=_[_0x364b('0x24')](_0x3ef3ea[_0x364b('0x25')],function(_0x396aab){return _0x396aab['UserId']==_0x18c4a8['id']&&_0x396aab[_0x364b('0x26')]==_0x527c78;});if(_0x30f206[_0x364b('0x27')]==0x1){_0x4ab042(_0x18c4a8);}else{_0x4d0e15(new RangeError('sessionId\x20'+_0x527c78+'\x20not\x20found!'));}});});}exports[_0x364b('0x28')]=function(_0x1b32aa,_0x54bd4d){logger[_0x364b('0x13')](_0x364b('0x29'),_0x1b32aa[_0x364b('0x2a')]);var _0x14b25e=originateValidation[_0x364b('0xc')](_0x1b32aa[_0x364b('0x2a')]);if(_0x14b25e[_0x364b('0x27')]>0x0){return _0x54bd4d[_0x364b('0x1a')](0x190)[_0x364b('0x2b')](_0x14b25e);}var _0x55131b=_0x1b32aa[_0x364b('0x2a')][_0x364b('0x2c')];var _0x3a9959=_0x1b32aa['body']['callNumber'];var _0x24e3b=_0x1b32aa[_0x364b('0x2a')][_0x364b('0x2d')];var _0x6eeb3b=_0x1b32aa[_0x364b('0x2a')][_0x364b('0x2e')];return getAgent(_0x55131b)[_0x364b('0x1c')](function(_0x324759){logger[_0x364b('0x13')](_0x364b('0x2f'),_0x324759['name']);emit(util['format']('user:%s',_0x324759[_0x364b('0x19')]),_0x364b('0x30'),{'callNumber':_0x3a9959,'callerId':_0x24e3b,'callbackUrl':_0x6eeb3b});return _0x54bd4d[_0x364b('0x1a')](0xc8)['json']({'error':![],'message':_0x364b('0x31')});})[_0x364b('0x20')](handleError(_0x54bd4d));};exports[_0x364b('0x32')]=function(_0x44c0c3,_0x5713c0){logger[_0x364b('0x13')](_0x364b('0x33'),_0x44c0c3['body']);var _0x43169b=hangupValidation[_0x364b('0xc')](_0x44c0c3[_0x364b('0x2a')]);if(_0x43169b['length']>0x0){return _0x5713c0[_0x364b('0x1a')](0x190)[_0x364b('0x2b')](_0x43169b);}var _0x50e93b=_0x44c0c3[_0x364b('0x2a')][_0x364b('0x2c')];var _0x140fd1=_0x44c0c3[_0x364b('0x2a')][_0x364b('0x26')];return getAgent(_0x50e93b)[_0x364b('0x1c')](function(_0x2f3a8c){logger[_0x364b('0x13')](_0x364b('0x2f'),_0x2f3a8c[_0x364b('0x19')]);emit(util['format'](_0x364b('0x34'),_0x2f3a8c['name']),_0x364b('0x35'),{'sessionId':_0x140fd1});return _0x5713c0[_0x364b('0x1a')](0xc8)[_0x364b('0x2b')]({'error':![],'message':_0x364b('0x36')});})[_0x364b('0x20')](handleError(_0x5713c0));};exports['answer']=function(_0x63b670,_0x39bef5){logger[_0x364b('0x13')](_0x364b('0x37'),_0x63b670[_0x364b('0x2a')]);var _0x319193=answerValidation[_0x364b('0xc')](_0x63b670[_0x364b('0x2a')]);if(_0x319193[_0x364b('0x27')]>0x0){return _0x39bef5['status'](0x190)[_0x364b('0x2b')](_0x319193);}var _0x1a8e6e=_0x63b670[_0x364b('0x2a')][_0x364b('0x2c')];var _0xf76fb2=_0x63b670[_0x364b('0x2a')][_0x364b('0x26')];return getAgent(_0x1a8e6e)[_0x364b('0x1c')](function(_0x169a77){logger['info'](_0x364b('0x2f'),_0x169a77[_0x364b('0x19')]);emit(util[_0x364b('0x38')](_0x364b('0x34'),_0x169a77[_0x364b('0x19')]),_0x364b('0x39'),{'sessionId':_0xf76fb2});return _0x39bef5[_0x364b('0x1a')](0xc8)[_0x364b('0x2b')]({'error':![],'message':_0x364b('0x3a')});})[_0x364b('0x20')](handleError(_0x39bef5));};exports['hold']=function(_0x390feb,_0x1a5729){logger[_0x364b('0x13')](_0x364b('0x3b'),_0x390feb[_0x364b('0x2a')]);var _0x394f04=holdValidation[_0x364b('0xc')](_0x390feb[_0x364b('0x2a')]);if(_0x394f04[_0x364b('0x27')]>0x0){return _0x1a5729[_0x364b('0x1a')](0x190)[_0x364b('0x2b')](_0x394f04);}var _0x2bd371=_0x390feb[_0x364b('0x2a')]['userId'];var _0x3e2fd7=_0x390feb['body'][_0x364b('0x26')];return getAgent(_0x2bd371)[_0x364b('0x1c')](function(_0x320d97){logger[_0x364b('0x13')]('entityFound:',_0x320d97[_0x364b('0x19')]);emit(util[_0x364b('0x38')](_0x364b('0x34'),_0x320d97[_0x364b('0x19')]),_0x364b('0x3c'),{'sessionId':_0x3e2fd7});return _0x1a5729[_0x364b('0x1a')](0xc8)['json']({'error':![],'message':_0x364b('0x3d')});})[_0x364b('0x20')](handleError(_0x1a5729));};exports[_0x364b('0x3e')]=function(_0x4ec69f,_0x591346){logger[_0x364b('0x13')](_0x364b('0x3f'),_0x4ec69f[_0x364b('0x2a')]);var _0x42b651=unholdValidation[_0x364b('0xc')](_0x4ec69f['body']);if(_0x42b651[_0x364b('0x27')]>0x0){return _0x591346['status'](0x190)[_0x364b('0x2b')](_0x42b651);}var _0x2ea779=_0x4ec69f[_0x364b('0x2a')][_0x364b('0x2c')];var _0x2f4f59=_0x4ec69f['body'][_0x364b('0x26')];return getAgent(_0x2ea779)[_0x364b('0x1c')](function(_0x4ee0d8){logger['info'](_0x364b('0x2f'),_0x4ee0d8['name']);emit(util[_0x364b('0x38')]('user:%s',_0x4ee0d8[_0x364b('0x19')]),'webbar:unhold',{'sessionId':_0x2f4f59});return _0x591346[_0x364b('0x1a')](0xc8)[_0x364b('0x2b')]({'error':![],'message':_0x364b('0x40')});})[_0x364b('0x20')](handleError(_0x591346));};exports['calls']=function(_0x51abd0,_0x29decc){logger[_0x364b('0x13')](_0x364b('0x41'),_0x29decc[_0x364b('0x2a')]);var _0x120523=callsValidation[_0x364b('0xc')](_0x51abd0[_0x364b('0x2a')]);if(_0x120523[_0x364b('0x27')]>0x0){return _0x29decc[_0x364b('0x1a')](0x190)[_0x364b('0x2b')](_0x120523);}var _0x40a7f4=_0x51abd0[_0x364b('0x2a')][_0x364b('0x2c')];var _0x1ad804=respondWithRpcPromise(_0x364b('0x42'));var _0x24d67e=getAgent(_0x40a7f4);return Promise[_0x364b('0x23')]([_0x1ad804,_0x24d67e])['then'](function(_0x5a4a27){var _0x11e78b=_0x5a4a27[0x0];var _0x577057=_0x5a4a27[0x1];var _0x1e304b=_[_0x364b('0x24')](_0x11e78b['rows'],function(_0x8fefa0){return _0x8fefa0['UserId']==_0x577057['id'];});return _0x29decc[_0x364b('0x1a')](0xc8)[_0x364b('0x2b')]({'count':_0x1e304b['length'],'rows':_0x1e304b});})['catch'](handleError(_0x29decc));};exports[_0x364b('0x43')]=function(_0x408ad3,_0x8ecf8d){logger['info']('conference\x20fired:',_0x408ad3[_0x364b('0x2a')]);var _0x14b21d=conferenceValidation[_0x364b('0xc')](_0x408ad3['body']);if(_0x14b21d[_0x364b('0x27')]>0x0){return _0x8ecf8d[_0x364b('0x1a')](0x190)['json'](_0x14b21d);}var _0x10bae0=_0x408ad3[_0x364b('0x2a')]['userId'];return getAgent(_0x10bae0)['then'](function(_0x20e9d8){logger[_0x364b('0x13')]('entityFound:',_0x20e9d8[_0x364b('0x19')]);emit(util[_0x364b('0x38')](_0x364b('0x34'),_0x20e9d8[_0x364b('0x19')]),_0x364b('0x44'));return _0x8ecf8d[_0x364b('0x1a')](0xc8)['json']({'error':![],'message':_0x364b('0x45')});})['catch'](handleError(_0x8ecf8d));};exports[_0x364b('0x46')]=function(_0x4ed962,_0x66f597){logger[_0x364b('0x13')]('transfer\x20fired:',_0x4ed962[_0x364b('0x2a')]);var _0x25a2e9=transferValidation[_0x364b('0xc')](_0x4ed962['body']);if(_0x25a2e9[_0x364b('0x27')]>0x0){return _0x66f597[_0x364b('0x1a')](0x190)[_0x364b('0x2b')](_0x25a2e9);}var _0x2e26d2=_0x4ed962['body'][_0x364b('0x2c')];var _0x5ccd9f=_0x4ed962[_0x364b('0x2a')][_0x364b('0x26')];var _0x27bef0=_0x4ed962['body'][_0x364b('0x47')];return getAgent(_0x2e26d2)[_0x364b('0x1c')](function(_0x1448a8){logger['info']('entityFound:',_0x1448a8[_0x364b('0x19')]);emit(util[_0x364b('0x38')]('user:%s',_0x1448a8[_0x364b('0x19')]),_0x364b('0x48'),{'sessionId':_0x5ccd9f,'transferNumber':_0x27bef0});return _0x66f597[_0x364b('0x1a')](0xc8)['json']({'error':![],'message':_0x364b('0x49')});})[_0x364b('0x20')](handleError(_0x66f597));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 36a474e..75954f5 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 _0x0bc6=['addAgents','/:id/applications','addApplications','/:id/notify','notify','send','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','post','addDisposition','addAnswer'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x0bc6,0x13f));var _0x60bc=function(_0x4944ca,_0x3e5c9a){_0x4944ca=_0x4944ca-0x0;var _0x1f77f4=_0x0bc6[_0x4944ca];return _0x1f77f4;};'use strict';var multer=require(_0x60bc('0x0'));var util=require(_0x60bc('0x1'));var path=require('path');var timeout=require(_0x60bc('0x2'));var express=require(_0x60bc('0x3'));var router=express[_0x60bc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x60bc('0x5'));var config=require(_0x60bc('0x6'));var controller=require(_0x60bc('0x7'));router['get']('/',auth[_0x60bc('0x8')](),controller[_0x60bc('0x9')]);router[_0x60bc('0xa')](_0x60bc('0xb'),auth[_0x60bc('0x8')](),controller['describe']);router[_0x60bc('0xa')](_0x60bc('0xc'),auth[_0x60bc('0x8')](),controller[_0x60bc('0xd')]);router['get'](_0x60bc('0xe'),auth[_0x60bc('0x8')](),controller[_0x60bc('0xf')]);router[_0x60bc('0xa')](_0x60bc('0x10'),auth[_0x60bc('0x8')](),controller['getAnswers']);router[_0x60bc('0xa')](_0x60bc('0x11'),auth[_0x60bc('0x8')](),controller['getAgents']);router[_0x60bc('0xa')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x60bc('0x12')]('/',auth[_0x60bc('0x8')](),controller['create']);router[_0x60bc('0x12')](_0x60bc('0xe'),auth[_0x60bc('0x8')](),controller[_0x60bc('0x13')]);router[_0x60bc('0x12')]('/:id/canned_answers',auth[_0x60bc('0x8')](),controller[_0x60bc('0x14')]);router[_0x60bc('0x12')](_0x60bc('0x11'),auth[_0x60bc('0x8')](),controller[_0x60bc('0x15')]);router[_0x60bc('0x12')](_0x60bc('0x16'),auth['isAuthenticated'](),controller[_0x60bc('0x17')]);router['post'](_0x60bc('0x18'),controller[_0x60bc('0x19')]);router[_0x60bc('0x12')]('/:id/send',auth[_0x60bc('0x8')](),controller[_0x60bc('0x1a')]);router[_0x60bc('0x1b')]('/:id',auth[_0x60bc('0x8')](),controller[_0x60bc('0x1c')]);router['delete']('/:id',auth[_0x60bc('0x8')](),controller[_0x60bc('0x1d')]);router[_0x60bc('0x1e')](_0x60bc('0xe'),auth[_0x60bc('0x8')](),controller[_0x60bc('0x1f')]);router[_0x60bc('0x1e')](_0x60bc('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x60bc('0x1e')](_0x60bc('0x11'),auth[_0x60bc('0x8')](),controller[_0x60bc('0x20')]);module[_0x60bc('0x21')]=router; \ No newline at end of file +var _0x8094=['removeDispositions','removeAnswers','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/send','send','put','delete'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0x8094,0x19b));var _0x4809=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0x8094[_0x3a13cf];return _0x4817c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4809('0x0'));var timeout=require(_0x4809('0x1'));var express=require(_0x4809('0x2'));var router=express[_0x4809('0x3')]();var auth=require(_0x4809('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4809('0x5'));var controller=require(_0x4809('0x6'));router[_0x4809('0x7')]('/',auth[_0x4809('0x8')](),controller[_0x4809('0x9')]);router[_0x4809('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4809('0xa')]);router[_0x4809('0x7')](_0x4809('0xb'),auth[_0x4809('0x8')](),controller[_0x4809('0xc')]);router[_0x4809('0x7')](_0x4809('0xd'),auth['isAuthenticated'](),controller[_0x4809('0xe')]);router['get'](_0x4809('0xf'),auth[_0x4809('0x8')](),controller[_0x4809('0x10')]);router['get'](_0x4809('0x11'),auth[_0x4809('0x8')](),controller[_0x4809('0x12')]);router[_0x4809('0x7')](_0x4809('0x13'),auth['isAuthenticated'](),controller[_0x4809('0x14')]);router[_0x4809('0x15')]('/',auth[_0x4809('0x8')](),controller[_0x4809('0x16')]);router[_0x4809('0x15')](_0x4809('0xd'),auth[_0x4809('0x8')](),controller[_0x4809('0x17')]);router[_0x4809('0x15')](_0x4809('0xf'),auth[_0x4809('0x8')](),controller[_0x4809('0x18')]);router[_0x4809('0x15')](_0x4809('0x11'),auth[_0x4809('0x8')](),controller[_0x4809('0x19')]);router[_0x4809('0x15')]('/:id/applications',auth['isAuthenticated'](),controller[_0x4809('0x1a')]);router['post']('/:id/notify',controller['notify']);router['post'](_0x4809('0x1b'),auth[_0x4809('0x8')](),controller[_0x4809('0x1c')]);router[_0x4809('0x1d')](_0x4809('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x4809('0x1e')](_0x4809('0xb'),auth[_0x4809('0x8')](),controller['destroy']);router[_0x4809('0x1e')](_0x4809('0xd'),auth[_0x4809('0x8')](),controller[_0x4809('0x1f')]);router[_0x4809('0x1e')](_0x4809('0xf'),auth[_0x4809('0x8')](),controller[_0x4809('0x20')]);router[_0x4809('0x1e')]('/:id/users',auth[_0x4809('0x8')](),controller['removeAgents']);module[_0x4809('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 644af96..cc92d28 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 _0x5ea7=['name','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports'];(function(_0x153a08,_0x8d956d){var _0x334eaf=function(_0x55f4ec){while(--_0x55f4ec){_0x153a08['push'](_0x153a08['shift']());}};_0x334eaf(++_0x8d956d);}(_0x5ea7,0x15e));var _0x75ea=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0x5ea7[_0x1b6311];return _0x25aab6;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x75ea('0x0'));module[_0x75ea('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x75ea('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x75ea('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x75ea('0x3')],'defaultValue':function(){return rs[_0x75ea('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x75ea('0x5')](_0x75ea('0x6'))},'accountSid':{'type':Sequelize[_0x75ea('0x3')]},'authToken':{'type':Sequelize[_0x75ea('0x3')]},'notificationTemplate':{'type':Sequelize[_0x75ea('0x7')],'defaultValue':function(){return _0x75ea('0x8');}},'notificationSound':{'type':Sequelize[_0x75ea('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x75ea('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x75ea('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x75ea('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x75ea('0xa')],'comment':_0x75ea('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x75ea('0x9')],'defaultValue':![],'comment':_0x75ea('0xc'),'set':function(_0x2414dc){if(!_0x2414dc){this[_0x75ea('0xd')](_0x75ea('0xe'),null);}this[_0x75ea('0xd')](_0x75ea('0xf'),_0x2414dc);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x831e=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x51216,_0x157254){var _0x3d7040=function(_0x423957){while(--_0x423957){_0x51216['push'](_0x51216['shift']());}};_0x3d7040(++_0x157254);}(_0x831e,0x6f));var _0xe831=function(_0x4ef903,_0x2521e0){_0x4ef903=_0x4ef903-0x0;var _0x388af9=_0x831e[_0x4ef903];return _0x388af9;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe831('0x0'));module[_0xe831('0x1')]={'name':{'type':Sequelize[_0xe831('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xe831('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xe831('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xe831('0x2')],'defaultValue':function(){return rs[_0xe831('0x3')]();}},'phone':{'type':Sequelize[_0xe831('0x2')]},'type':{'type':Sequelize[_0xe831('0x4')](_0xe831('0x5'))},'accountSid':{'type':Sequelize[_0xe831('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xe831('0x6')],'defaultValue':function(){return _0xe831('0x7');}},'notificationSound':{'type':Sequelize[_0xe831('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe831('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe831('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe831('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe831('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xe831('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe831('0xb'),'set':function(_0x12ca07){if(!_0x12ca07){this['setDataValue'](_0xe831('0xc'),null);}this[_0xe831('0xd')](_0xe831('0xe'),_0x12ca07);}},'description':{'type':Sequelize[_0xe831('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 05acbd4..a713193 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 _0x39cb=['ids','CannedAnswer','getAnswers','removeAnswers','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','asc','CmContact','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','set','\x0a','List','user','dataValues','Messages','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappAccount','includeAll','findAll','rows','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','params','describe','addDisposition','WhatsappAccountId','Disposition','findOne','length','hasOwnProperty','removeDispositions'];(function(_0x22e8f8,_0xfa3025){var _0x3a76e5=function(_0x52ae52){while(--_0x52ae52){_0x22e8f8['push'](_0x22e8f8['shift']());}};_0x3a76e5(++_0xfa3025);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb39c('0x0'));var rimraf=require(_0xb39c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb39c('0x2'));var rp=require(_0xb39c('0x3'));var moment=require('moment');var BPromise=require(_0xb39c('0x4'));var Mustache=require(_0xb39c('0x5'));var util=require(_0xb39c('0x6'));var path=require(_0xb39c('0x7'));var sox=require(_0xb39c('0x8'));var csv=require('to-csv');var ejs=require(_0xb39c('0x9'));var fs=require('fs');var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0xd'));var querystring=require(_0xb39c('0xe'));var Papa=require(_0xb39c('0xf'));var Redis=require(_0xb39c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x11'));var logger=require(_0xb39c('0x12'))(_0xb39c('0x13'));var utils=require(_0xb39c('0x14'));var config=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];config[_0xb39c('0x17')]=_[_0xb39c('0x18')](config['redis'],{'host':_0xb39c('0x19'),'port':0x18eb});var socket=require(_0xb39c('0x1a'))(new Redis(config[_0xb39c('0x17')]));require('./whatsappAccount.socket')[_0xb39c('0x1b')](socket);var jayson=require(_0xb39c('0x1c'));var client=jayson[_0xb39c('0x1d')][_0xb39c('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x469fa9,_0x27c22a,_0x8e9181){if(_0x8e9181){var _0x5277ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5277ce[_0xb39c('0x1f')](_0x27c22a)){return _0x469fa9;}else{throw new db[(_0xb39c('0x20'))][(_0xb39c('0x21'))](_0xb39c('0x22'));}}else{return _0x469fa9;}}function respondWithRpcPromise(_0x30d519,_0x3b7fad,_0x1a2f48,_0x4e02cf){return new BPromise(function(_0x35dade,_0x2eeae6){var _0x559ad6=_0x4e02cf||client;return _0x559ad6[_0xb39c('0x23')](_0x30d519,_0x1a2f48)[_0xb39c('0x24')](function(_0x28bbe1){logger[_0xb39c('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x3b7fad,_0xb39c('0x26'));logger[_0xb39c('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3b7fad,_0xb39c('0x26'),JSON[_0xb39c('0x28')](_0x28bbe1));if(_0x28bbe1[_0xb39c('0x29')]){if(_0x28bbe1['error']['code']===0x1f4){logger[_0xb39c('0x29')](_0xb39c('0x2a'),_0x3b7fad,_0x28bbe1[_0xb39c('0x29')]['message']);return _0x2eeae6(_0x28bbe1[_0xb39c('0x29')][_0xb39c('0x2b')]);}logger[_0xb39c('0x29')](_0xb39c('0x2a'),_0x3b7fad,_0x28bbe1[_0xb39c('0x29')]['message']);return _0x35dade(_0x28bbe1[_0xb39c('0x29')][_0xb39c('0x2b')]);}else{logger['info'](_0xb39c('0x2a'),_0x3b7fad,_0xb39c('0x26'));_0x35dade(_0x28bbe1[_0xb39c('0x2c')][_0xb39c('0x2b')]);}})[_0xb39c('0x2d')](function(_0x5453a6){logger[_0xb39c('0x29')](_0xb39c('0x2a'),_0x3b7fad,_0x5453a6);_0x2eeae6(_0x5453a6);});});}function respondWithStatusCode(_0x132769,_0x4c06fa){_0x4c06fa=_0x4c06fa||0xcc;return function(_0x41fff2){if(_0x41fff2){return _0x132769[_0xb39c('0x2e')](_0x4c06fa);}return _0x132769['status'](_0x4c06fa)[_0xb39c('0x2f')]();};}function respondWithResult(_0x4b4458,_0x328db1){_0x328db1=_0x328db1||0xc8;return function(_0x4e9672){if(_0x4e9672){return _0x4b4458[_0xb39c('0x30')](_0x328db1)[_0xb39c('0x31')](_0x4e9672);}};}function respondWithFilteredResult(_0x59172f,_0x2bc742){return function(_0x501708){if(_0x501708){var _0x8e2d7=_0x501708[_0xb39c('0x32')],_0x2d2743=_0x2bc742['offset'],_0x309697=_0x2bc742[_0xb39c('0x33')]+_0x2bc742['limit'],_0x7339b4;if(_0x309697>=_0x8e2d7){_0x309697=_0x8e2d7;_0x7339b4=0xc8;}else{_0x7339b4=0xce;}_0x59172f[_0xb39c('0x30')](_0x7339b4);return _0x59172f['set'](_0xb39c('0x34'),_0x2d2743+'-'+_0x309697+'/'+_0x8e2d7)[_0xb39c('0x31')](_0x501708);}return null;};}function patchUpdates(_0x3a96b9){return function(_0x11ad56){try{jsonpatch['apply'](_0x11ad56,_0x3a96b9,!![]);}catch(_0x47f58f){return BPromise[_0xb39c('0x35')](_0x47f58f);}return _0x11ad56[_0xb39c('0x36')]();};}function saveUpdates(_0x4a9184,_0x1d7f2a){return function(_0x1c04a7){if(_0x1c04a7){return _0x1c04a7[_0xb39c('0x37')](_0x4a9184)[_0xb39c('0x24')](function(_0x14a92f){return _0x14a92f;});}return null;};}function removeEntity(_0x365ac9,_0x41cdd1){return function(_0x45e700){if(_0x45e700){return _0x45e700[_0xb39c('0x38')]()[_0xb39c('0x24')](function(){var _0x15882d=_0x45e700[_0xb39c('0x39')]({'plain':!![]});var _0x23aaed=_0xb39c('0x3a');return db[_0xb39c('0x3b')][_0xb39c('0x38')]({'where':{'type':_0x23aaed,'resourceId':_0x15882d['id']}})[_0xb39c('0x24')](function(){return _0x45e700;});})[_0xb39c('0x24')](function(){_0x365ac9[_0xb39c('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2b40,_0x45177f){return function(_0x5ee5a5){if(!_0x5ee5a5){_0x2c2b40['sendStatus'](0x194);}return _0x5ee5a5;};}function handleError(_0x55e9d9,_0x22d673){_0x22d673=_0x22d673||0x1f4;return function(_0x33e468){logger[_0xb39c('0x29')](_0x33e468['stack']);if(_0x33e468[_0xb39c('0x3c')]){delete _0x33e468[_0xb39c('0x3c')];}_0x55e9d9[_0xb39c('0x30')](_0x22d673)[_0xb39c('0x3d')](_0x33e468);};}exports[_0xb39c('0x3e')]=function(_0x4b51ac,_0x3cdeeb){var _0x3000d7={'include':[{'model':db['Pause'],'as':_0xb39c('0x3f')}]},_0x51b489={},_0x111909={'count':0x0,'rows':[]};var _0xc6e494=_[_0xb39c('0x40')](db['WhatsappAccount'][_0xb39c('0x41')],function(_0x90b1fc){return{'name':_0x90b1fc[_0xb39c('0x42')],'type':_0x90b1fc[_0xb39c('0x43')][_0xb39c('0x44')]};});_0x51b489[_0xb39c('0x45')]=_[_0xb39c('0x40')](_0xc6e494,_0xb39c('0x3c'));_0x51b489[_0xb39c('0x46')]=_[_0xb39c('0x47')](_0x4b51ac[_0xb39c('0x46')]);_0x51b489[_0xb39c('0x48')]=_['intersection'](_0x51b489[_0xb39c('0x45')],_0x51b489[_0xb39c('0x46')]);_0x3000d7[_0xb39c('0x49')]=_[_0xb39c('0x4a')](_0x51b489[_0xb39c('0x45')],qs[_0xb39c('0x4b')](_0x4b51ac[_0xb39c('0x46')][_0xb39c('0x4b')]));_0x3000d7[_0xb39c('0x49')]=_0x3000d7['attributes']['length']?_0x3000d7[_0xb39c('0x49')]:_0x51b489[_0xb39c('0x45')];if(!_0x4b51ac['query']['hasOwnProperty'](_0xb39c('0x4c'))){_0x3000d7['limit']=qs[_0xb39c('0x4d')](_0x4b51ac[_0xb39c('0x46')][_0xb39c('0x4d')]);_0x3000d7[_0xb39c('0x33')]=qs[_0xb39c('0x33')](_0x4b51ac['query'][_0xb39c('0x33')]);}_0x3000d7[_0xb39c('0x4e')]=qs['sort'](_0x4b51ac['query'][_0xb39c('0x4f')]);_0x3000d7['where']=qs['filters'](_[_0xb39c('0x50')](_0x4b51ac[_0xb39c('0x46')],_0x51b489[_0xb39c('0x48')]),_0xc6e494);if(_0x4b51ac[_0xb39c('0x46')][_0xb39c('0x51')]){_0x3000d7[_0xb39c('0x52')]=_[_0xb39c('0x53')](_0x3000d7[_0xb39c('0x52')],{'$or':_[_0xb39c('0x40')](_0xc6e494,function(_0x2e9dbf){if(_0x2e9dbf['type']!==_0xb39c('0x54')){var _0x7e9750={};_0x7e9750[_0x2e9dbf[_0xb39c('0x3c')]]={'$like':'%'+_0x4b51ac[_0xb39c('0x46')][_0xb39c('0x51')]+'%'};return _0x7e9750;}})});}_0x3000d7=_[_0xb39c('0x53')]({},_0x3000d7,_0x4b51ac[_0xb39c('0x55')]);var _0x159e2b={'where':_0x3000d7[_0xb39c('0x52')]};return db[_0xb39c('0x56')][_0xb39c('0x32')](_0x159e2b)[_0xb39c('0x24')](function(_0x470766){_0x111909[_0xb39c('0x32')]=_0x470766;if(_0x4b51ac[_0xb39c('0x46')][_0xb39c('0x57')]){_0x3000d7['include']=[{'all':!![]}];}return db[_0xb39c('0x56')][_0xb39c('0x58')](_0x3000d7);})[_0xb39c('0x24')](function(_0x3f02d2){_0x111909[_0xb39c('0x59')]=_0x3f02d2;return _0x111909;})[_0xb39c('0x24')](respondWithFilteredResult(_0x3cdeeb,_0x3000d7))[_0xb39c('0x2d')](handleError(_0x3cdeeb,null));};exports[_0xb39c('0x5a')]=function(_0x4b0917,_0x4886ab){var _0x32bba9={'raw':![],'where':{'id':_0x4b0917['params']['id']},'include':[{'model':db['Pause'],'as':_0xb39c('0x3f')}]},_0x210d2a={};_0x210d2a[_0xb39c('0x45')]=_['keys'](db[_0xb39c('0x56')]['rawAttributes']);_0x210d2a['query']=_[_0xb39c('0x47')](_0x4b0917['query']);_0x210d2a[_0xb39c('0x48')]=_[_0xb39c('0x4a')](_0x210d2a[_0xb39c('0x45')],_0x210d2a[_0xb39c('0x46')]);_0x32bba9[_0xb39c('0x49')]=_[_0xb39c('0x4a')](_0x210d2a['model'],qs[_0xb39c('0x4b')](_0x4b0917[_0xb39c('0x46')][_0xb39c('0x4b')]));_0x32bba9[_0xb39c('0x49')]=_0x32bba9[_0xb39c('0x49')]['length']?_0x32bba9[_0xb39c('0x49')]:_0x210d2a['model'];if(_0x4b0917[_0xb39c('0x46')][_0xb39c('0x57')]){_0x32bba9[_0xb39c('0x5b')]=[{'all':!![]}];}_0x32bba9=_[_0xb39c('0x53')]({},_0x32bba9,_0x4b0917[_0xb39c('0x55')]);return db[_0xb39c('0x56')][_0xb39c('0x5c')](_0x32bba9)[_0xb39c('0x24')](handleEntityNotFound(_0x4886ab,null))[_0xb39c('0x24')](respondWithResult(_0x4886ab,null))[_0xb39c('0x2d')](handleError(_0x4886ab,null));};exports[_0xb39c('0x5d')]=function(_0x260fbf,_0x2620ee){return db[_0xb39c('0x56')][_0xb39c('0x5d')](_0x260fbf[_0xb39c('0x5e')],{})[_0xb39c('0x24')](function(_0x3a617e){var _0x18431c=_0x260fbf['user']['get']({'plain':!![]});if(!_0x18431c)throw new Error(_0xb39c('0x5f'));if(_0x18431c[_0xb39c('0x60')]==='user'){var _0x27e91a=_0x3a617e[_0xb39c('0x39')]({'plain':!![]});var _0x4946b5=_0xb39c('0x3a');return db[_0xb39c('0x61')][_0xb39c('0x5c')]({'where':{'name':_0x4946b5,'userProfileId':_0x18431c[_0xb39c('0x62')]},'raw':!![]})[_0xb39c('0x24')](function(_0xd1dec6){if(_0xd1dec6&&_0xd1dec6['autoAssociation']===0x0){return db[_0xb39c('0x3b')][_0xb39c('0x5d')]({'name':_0x27e91a[_0xb39c('0x3c')],'resourceId':_0x27e91a['id'],'type':_0xd1dec6[_0xb39c('0x3c')],'sectionId':_0xd1dec6['id']},{})[_0xb39c('0x24')](function(){return _0x3a617e;});}else{return _0x3a617e;}})[_0xb39c('0x2d')](function(_0x53b491){logger['error'](_0xb39c('0x63'),_0x53b491);throw _0x53b491;});}return _0x3a617e;})[_0xb39c('0x24')](respondWithResult(_0x2620ee,0xc9))[_0xb39c('0x2d')](handleError(_0x2620ee,null));};exports[_0xb39c('0x37')]=function(_0xb0b0b6,_0x4d6968){if(_0xb0b0b6['body']['id']){delete _0xb0b0b6[_0xb39c('0x5e')]['id'];}return db[_0xb39c('0x56')][_0xb39c('0x5c')]({'where':{'id':_0xb0b0b6['params']['id']},'include':[{'model':db[_0xb39c('0x64')],'as':'mandatoryDispositionPause'}]})[_0xb39c('0x24')](handleEntityNotFound(_0x4d6968,null))['then'](saveUpdates(_0xb0b0b6[_0xb39c('0x5e')],null))[_0xb39c('0x24')](respondWithResult(_0x4d6968,null))[_0xb39c('0x2d')](handleError(_0x4d6968,null));};exports['destroy']=function(_0x61b09c,_0x281e2e){return db[_0xb39c('0x56')][_0xb39c('0x5c')]({'where':{'id':_0x61b09c[_0xb39c('0x65')]['id']}})[_0xb39c('0x24')](handleEntityNotFound(_0x281e2e,null))[_0xb39c('0x24')](removeEntity(_0x281e2e,null))[_0xb39c('0x2d')](handleError(_0x281e2e,null));};exports[_0xb39c('0x66')]=function(_0x158ac5,_0x34127d){return db[_0xb39c('0x56')][_0xb39c('0x66')]()[_0xb39c('0x24')](respondWithResult(_0x34127d,null))[_0xb39c('0x2d')](handleError(_0x34127d,null));};exports[_0xb39c('0x67')]=function(_0x451b48,_0x58fbe0,_0x2d936f){if(_0x451b48[_0xb39c('0x5e')]['id']){delete _0x451b48[_0xb39c('0x5e')]['id'];}return db['WhatsappAccount'][_0xb39c('0x5c')]({'where':{'id':_0x451b48['params']['id']}})['then'](handleEntityNotFound(_0x58fbe0,null))[_0xb39c('0x24')](function(_0x765913){if(_0x765913){_0x451b48[_0xb39c('0x5e')][_0xb39c('0x68')]=_0x765913['id'];return db[_0xb39c('0x69')]['create'](_0x451b48['body']);}})[_0xb39c('0x24')](respondWithResult(_0x58fbe0,null))[_0xb39c('0x2d')](handleError(_0x58fbe0,null));};exports['getDispositions']=function(_0x225f15,_0x5727b8,_0xc1c51){var _0x32acb6={'raw':![],'where':{}};var _0xdfa2b4={};var _0xbe336d={'count':0x0,'rows':[]};return db[_0xb39c('0x56')][_0xb39c('0x6a')]({'where':{'id':_0x225f15[_0xb39c('0x65')]['id']}})[_0xb39c('0x24')](handleEntityNotFound(_0x5727b8,null))[_0xb39c('0x24')](function(_0x216747){if(_0x216747){_0xdfa2b4[_0xb39c('0x45')]=_[_0xb39c('0x47')](db[_0xb39c('0x69')]['rawAttributes']);_0xdfa2b4[_0xb39c('0x46')]=_['keys'](_0x225f15[_0xb39c('0x46')]);_0xdfa2b4[_0xb39c('0x48')]=_['intersection'](_0xdfa2b4[_0xb39c('0x45')],_0xdfa2b4[_0xb39c('0x46')]);_0x32acb6[_0xb39c('0x49')]=_[_0xb39c('0x4a')](_0xdfa2b4[_0xb39c('0x45')],qs[_0xb39c('0x4b')](_0x225f15['query'][_0xb39c('0x4b')]));_0x32acb6[_0xb39c('0x49')]=_0x32acb6[_0xb39c('0x49')][_0xb39c('0x6b')]?_0x32acb6[_0xb39c('0x49')]:_0xdfa2b4[_0xb39c('0x45')];if(!_0x225f15[_0xb39c('0x46')][_0xb39c('0x6c')](_0xb39c('0x4c'))){_0x32acb6['limit']=qs[_0xb39c('0x4d')](_0x225f15[_0xb39c('0x46')][_0xb39c('0x4d')]);_0x32acb6[_0xb39c('0x33')]=qs[_0xb39c('0x33')](_0x225f15[_0xb39c('0x46')][_0xb39c('0x33')]);}_0x32acb6['order']=qs[_0xb39c('0x4f')](_0x225f15[_0xb39c('0x46')][_0xb39c('0x4f')]);_0x32acb6[_0xb39c('0x52')]=qs[_0xb39c('0x48')](_[_0xb39c('0x50')](_0x225f15[_0xb39c('0x46')],_0xdfa2b4[_0xb39c('0x48')]));_0x32acb6['where'][_0xb39c('0x68')]=_0x216747['id'];if(_0x225f15['query'][_0xb39c('0x51')]){_0x32acb6[_0xb39c('0x52')]=_[_0xb39c('0x53')](_0x32acb6[_0xb39c('0x52')],{'$or':_[_0xb39c('0x40')](_0x32acb6[_0xb39c('0x49')],function(_0x3dcd0e){var _0x3784fe={};_0x3784fe[_0x3dcd0e]={'$like':'%'+_0x225f15['query'][_0xb39c('0x51')]+'%'};return _0x3784fe;})});}_0x32acb6=_[_0xb39c('0x53')]({},_0x32acb6,_0x225f15[_0xb39c('0x55')]);return db[_0xb39c('0x69')][_0xb39c('0x32')]({'where':_0x32acb6[_0xb39c('0x52')]})[_0xb39c('0x24')](function(_0x46dcef){_0xbe336d[_0xb39c('0x32')]=_0x46dcef;if(_0x225f15[_0xb39c('0x46')][_0xb39c('0x57')]){_0x32acb6[_0xb39c('0x5b')]=[{'all':!![]}];}return db[_0xb39c('0x69')][_0xb39c('0x58')](_0x32acb6);})[_0xb39c('0x24')](function(_0x1067e4){_0xbe336d['rows']=_0x1067e4;return _0xbe336d;});}})['then'](respondWithFilteredResult(_0x5727b8,_0x32acb6))[_0xb39c('0x2d')](handleError(_0x5727b8,null));};exports[_0xb39c('0x6d')]=function(_0x7fb4,_0x59e774,_0x62a6cb){return db[_0xb39c('0x56')][_0xb39c('0x5c')]({'where':{'id':_0x7fb4[_0xb39c('0x65')]['id']}})[_0xb39c('0x24')](handleEntityNotFound(_0x59e774,null))[_0xb39c('0x24')](function(_0x381c2d){if(_0x381c2d){return _0x381c2d['removeDispositions'](_0x7fb4[_0xb39c('0x46')][_0xb39c('0x6e')]);}})['then'](respondWithStatusCode(_0x59e774,null))[_0xb39c('0x2d')](handleError(_0x59e774,null));};exports['addAnswer']=function(_0x470e9d,_0x3678e5,_0x11efb5){if(_0x470e9d['body']['id']){delete _0x470e9d[_0xb39c('0x5e')]['id'];}return db[_0xb39c('0x56')]['find']({'where':{'id':_0x470e9d[_0xb39c('0x65')]['id']}})[_0xb39c('0x24')](handleEntityNotFound(_0x3678e5,null))[_0xb39c('0x24')](function(_0x83c802){if(_0x83c802){_0x470e9d[_0xb39c('0x5e')][_0xb39c('0x68')]=_0x83c802['id'];return db[_0xb39c('0x6f')][_0xb39c('0x5d')](_0x470e9d[_0xb39c('0x5e')]);}})[_0xb39c('0x24')](respondWithResult(_0x3678e5,null))[_0xb39c('0x2d')](handleError(_0x3678e5,null));};exports[_0xb39c('0x70')]=function(_0x43eb48,_0x2c524b,_0x466887){var _0x2b8275={'raw':![],'where':{}};var _0x37b99f={};var _0x24dcc8={'count':0x0,'rows':[]};return db[_0xb39c('0x56')][_0xb39c('0x6a')]({'where':{'id':_0x43eb48[_0xb39c('0x65')]['id']}})[_0xb39c('0x24')](handleEntityNotFound(_0x2c524b,null))[_0xb39c('0x24')](function(_0x48ec2b){if(_0x48ec2b){_0x37b99f[_0xb39c('0x45')]=_[_0xb39c('0x47')](db[_0xb39c('0x6f')][_0xb39c('0x41')]);_0x37b99f['query']=_[_0xb39c('0x47')](_0x43eb48[_0xb39c('0x46')]);_0x37b99f['filters']=_[_0xb39c('0x4a')](_0x37b99f[_0xb39c('0x45')],_0x37b99f[_0xb39c('0x46')]);_0x2b8275[_0xb39c('0x49')]=_[_0xb39c('0x4a')](_0x37b99f['model'],qs[_0xb39c('0x4b')](_0x43eb48[_0xb39c('0x46')]['fields']));_0x2b8275[_0xb39c('0x49')]=_0x2b8275[_0xb39c('0x49')][_0xb39c('0x6b')]?_0x2b8275[_0xb39c('0x49')]:_0x37b99f[_0xb39c('0x45')];if(!_0x43eb48[_0xb39c('0x46')][_0xb39c('0x6c')](_0xb39c('0x4c'))){_0x2b8275[_0xb39c('0x4d')]=qs[_0xb39c('0x4d')](_0x43eb48['query'][_0xb39c('0x4d')]);_0x2b8275[_0xb39c('0x33')]=qs[_0xb39c('0x33')](_0x43eb48[_0xb39c('0x46')]['offset']);}_0x2b8275[_0xb39c('0x4e')]=qs[_0xb39c('0x4f')](_0x43eb48[_0xb39c('0x46')][_0xb39c('0x4f')]);_0x2b8275['where']=qs[_0xb39c('0x48')](_[_0xb39c('0x50')](_0x43eb48[_0xb39c('0x46')],_0x37b99f[_0xb39c('0x48')]));_0x2b8275[_0xb39c('0x52')][_0xb39c('0x68')]=_0x48ec2b['id'];if(_0x43eb48[_0xb39c('0x46')][_0xb39c('0x51')]){_0x2b8275['where']=_[_0xb39c('0x53')](_0x2b8275[_0xb39c('0x52')],{'$or':_[_0xb39c('0x40')](_0x2b8275[_0xb39c('0x49')],function(_0x27c2a1){var _0x23c2bd={};_0x23c2bd[_0x27c2a1]={'$like':'%'+_0x43eb48[_0xb39c('0x46')]['filter']+'%'};return _0x23c2bd;})});}_0x2b8275=_['merge']({},_0x2b8275,_0x43eb48[_0xb39c('0x55')]);return db[_0xb39c('0x6f')][_0xb39c('0x32')]({'where':_0x2b8275['where']})[_0xb39c('0x24')](function(_0x42a882){_0x24dcc8[_0xb39c('0x32')]=_0x42a882;if(_0x43eb48[_0xb39c('0x46')][_0xb39c('0x57')]){_0x2b8275['include']=[{'all':!![]}];}return db[_0xb39c('0x6f')][_0xb39c('0x58')](_0x2b8275);})[_0xb39c('0x24')](function(_0x1cba6d){_0x24dcc8[_0xb39c('0x59')]=_0x1cba6d;return _0x24dcc8;});}})[_0xb39c('0x24')](respondWithFilteredResult(_0x2c524b,_0x2b8275))[_0xb39c('0x2d')](handleError(_0x2c524b,null));};exports[_0xb39c('0x71')]=function(_0x5d40fe,_0x368035,_0x3bcf9e){return db[_0xb39c('0x56')][_0xb39c('0x5c')]({'where':{'id':_0x5d40fe[_0xb39c('0x65')]['id']}})['then'](handleEntityNotFound(_0x368035,null))[_0xb39c('0x24')](function(_0x1b0c0f){if(_0x1b0c0f){return _0x1b0c0f[_0xb39c('0x71')](_0x5d40fe[_0xb39c('0x46')][_0xb39c('0x6e')]);}})[_0xb39c('0x24')](respondWithStatusCode(_0x368035,null))[_0xb39c('0x2d')](handleError(_0x368035,null));};exports['addAgents']=function(_0x29419d,_0x1da4a2,_0x489988){return db['WhatsappAccount'][_0xb39c('0x5c')]({'where':{'id':_0x29419d['params']['id']}})[_0xb39c('0x24')](handleEntityNotFound(_0x1da4a2,null))['then'](function(_0xf59560){if(_0xf59560){return _0xf59560['addAgents'](_0x29419d[_0xb39c('0x5e')][_0xb39c('0x6e')],_[_0xb39c('0x72')](_0x29419d['body'],['ids','id'])||{})[_0xb39c('0x73')](function(_0xa3a412){for(var _0x5f4642=0x0;_0x5f4642<_0x29419d[_0xb39c('0x5e')][_0xb39c('0x6e')]['length'];_0x5f4642+=0x1){socket[_0xb39c('0x74')](_0xb39c('0x75'),{'UserId':_0x29419d[_0xb39c('0x5e')]['ids'][_0x5f4642],'WhatsappAccountId':_0x29419d[_0xb39c('0x65')]['id']});}return _0xa3a412;});}})[_0xb39c('0x24')](respondWithResult(_0x1da4a2,null))[_0xb39c('0x2d')](handleError(_0x1da4a2,null));};exports[_0xb39c('0x76')]=function(_0x3d84ff,_0x3410d7,_0x412783){return db['WhatsappAccount'][_0xb39c('0x5c')]({'where':{'id':_0x3d84ff['params']['id']}})['then'](handleEntityNotFound(_0x3410d7,null))[_0xb39c('0x24')](function(_0x31a55f){if(_0x31a55f){return _0x31a55f[_0xb39c('0x76')](_0x3d84ff[_0xb39c('0x46')][_0xb39c('0x6e')])[_0xb39c('0x24')](function(){if(_[_0xb39c('0x77')](_0x3d84ff[_0xb39c('0x46')][_0xb39c('0x6e')])){for(var _0x5d4a95=0x0;_0x5d4a95<_0x3d84ff[_0xb39c('0x46')]['ids'][_0xb39c('0x6b')];_0x5d4a95+=0x1){socket['emit'](_0xb39c('0x78'),{'UserId':Number(_0x3d84ff[_0xb39c('0x46')][_0xb39c('0x6e')][_0x5d4a95]),'WhatsappAccountId':Number(_0x3d84ff['params']['id'])});}}else{socket['emit'](_0xb39c('0x78'),{'UserId':Number(_0x3d84ff['query']['ids']),'WhatsappAccountId':Number(_0x3d84ff[_0xb39c('0x65')]['id'])});}});}})[_0xb39c('0x24')](respondWithStatusCode(_0x3410d7,null))[_0xb39c('0x2d')](handleError(_0x3410d7,null));};exports[_0xb39c('0x79')]=function(_0x160763,_0x4e09f3,_0x4d1725){var _0x4e775b={};var _0x522b04={};var _0x53dfbb;var _0x256197;return db[_0xb39c('0x56')][_0xb39c('0x6a')]({'where':{'id':_0x160763[_0xb39c('0x65')]['id']}})['then'](handleEntityNotFound(_0x4e09f3,null))[_0xb39c('0x24')](function(_0x2ad1a1){if(_0x2ad1a1){_0x53dfbb=_0x2ad1a1;_0x522b04[_0xb39c('0x45')]=_[_0xb39c('0x47')](db[_0xb39c('0x7a')][_0xb39c('0x41')]);_0x522b04[_0xb39c('0x46')]=_['keys'](_0x160763[_0xb39c('0x46')]);_0x522b04['filters']=_[_0xb39c('0x4a')](_0x522b04['model'],_0x522b04[_0xb39c('0x46')]);_0x4e775b[_0xb39c('0x49')]=_[_0xb39c('0x4a')](_0x522b04[_0xb39c('0x45')],qs[_0xb39c('0x4b')](_0x160763[_0xb39c('0x46')][_0xb39c('0x4b')]));_0x4e775b[_0xb39c('0x49')]=_0x4e775b[_0xb39c('0x49')][_0xb39c('0x6b')]?_0x4e775b[_0xb39c('0x49')]:_0x522b04[_0xb39c('0x45')];_0x4e775b[_0xb39c('0x4e')]=qs[_0xb39c('0x4f')](_0x160763[_0xb39c('0x46')][_0xb39c('0x4f')]);_0x4e775b['where']=qs[_0xb39c('0x48')](_[_0xb39c('0x50')](_0x160763[_0xb39c('0x46')],_0x522b04[_0xb39c('0x48')]));if(_0x160763['query'][_0xb39c('0x51')]){_0x4e775b['where']=_['merge'](_0x4e775b[_0xb39c('0x52')],{'$or':_[_0xb39c('0x40')](_0x4e775b[_0xb39c('0x49')],function(_0x17144a){var _0x4db8a9={};_0x4db8a9[_0x17144a]={'$like':'%'+_0x160763[_0xb39c('0x46')][_0xb39c('0x51')]+'%'};return _0x4db8a9;})});}_0x4e775b=_[_0xb39c('0x53')]({},_0x4e775b,_0x160763[_0xb39c('0x55')]);return _0x53dfbb[_0xb39c('0x79')](_0x4e775b);}})[_0xb39c('0x24')](function(_0x2af4fe){if(_0x2af4fe){_0x256197=_0x2af4fe[_0xb39c('0x6b')];if(!_0x160763['query'][_0xb39c('0x6c')](_0xb39c('0x4c'))){_0x4e775b[_0xb39c('0x4d')]=qs[_0xb39c('0x4d')](_0x160763[_0xb39c('0x46')][_0xb39c('0x4d')]);_0x4e775b[_0xb39c('0x33')]=qs[_0xb39c('0x33')](_0x160763[_0xb39c('0x46')][_0xb39c('0x33')]);}return _0x53dfbb[_0xb39c('0x79')](_0x4e775b);}})['then'](function(_0x4de0ec){if(_0x4de0ec){return _0x4de0ec?{'count':_0x256197,'rows':_0x4de0ec}:null;}})[_0xb39c('0x24')](respondWithResult(_0x4e09f3,null))[_0xb39c('0x2d')](handleError(_0x4e09f3,null));};exports['addApplications']=function(_0x9dc52e,_0x15d642,_0xda3cd9){return db['WhatsappAccount'][_0xb39c('0x6a')]({'where':{'id':_0x9dc52e[_0xb39c('0x65')]['id']}})[_0xb39c('0x24')](handleEntityNotFound(_0x15d642,null))[_0xb39c('0x24')](function(_0x3bb2d0){if(_0x3bb2d0){return db[_0xb39c('0x7b')][_0xb39c('0x7c')](function(_0x79c5e7){return db[_0xb39c('0x7d')][_0xb39c('0x38')]({'where':{'WhatsappAccountId':_0x9dc52e[_0xb39c('0x65')]['id']},'transaction':_0x79c5e7})[_0xb39c('0x24')](function(_0x3297af){var _0x228503=_[_0xb39c('0x40')](_0x9dc52e['body'],function(_0x341140){_0x341140[_0xb39c('0x68')]=_0x9dc52e[_0xb39c('0x65')]['id'];return _0x341140;});return db[_0xb39c('0x7d')][_0xb39c('0x7e')](_0x228503,{'transaction':_0x79c5e7});});})[_0xb39c('0x24')](function(){return db[_0xb39c('0x7d')][_0xb39c('0x7f')]({'where':{'WhatsappAccountId':_0x9dc52e[_0xb39c('0x65')]['id']},'order':_0xb39c('0x80')});});}})[_0xb39c('0x24')](respondWithResult(_0x15d642,null))['catch'](handleError(_0x15d642,null));};exports[_0xb39c('0x81')]=function(_0x243878,_0x1397e4,_0x34e423){var _0x38ac08={};var _0x5cd349={};var _0x5b6ecc;var _0x3b3df1;return db[_0xb39c('0x56')]['findOne']({'where':{'id':_0x243878[_0xb39c('0x65')]['id']}})[_0xb39c('0x24')](handleEntityNotFound(_0x1397e4,null))[_0xb39c('0x24')](function(_0x1f630d){if(_0x1f630d){_0x5b6ecc=_0x1f630d;_0x5cd349[_0xb39c('0x45')]=_['keys'](db['WhatsappApplication'][_0xb39c('0x41')]);_0x5cd349[_0xb39c('0x46')]=_[_0xb39c('0x47')](_0x243878[_0xb39c('0x46')]);_0x5cd349[_0xb39c('0x48')]=_[_0xb39c('0x4a')](_0x5cd349[_0xb39c('0x45')],_0x5cd349[_0xb39c('0x46')]);_0x38ac08[_0xb39c('0x49')]=_['intersection'](_0x5cd349['model'],qs[_0xb39c('0x4b')](_0x243878['query'][_0xb39c('0x4b')]));_0x38ac08[_0xb39c('0x49')]=_0x38ac08[_0xb39c('0x49')][_0xb39c('0x6b')]?_0x38ac08[_0xb39c('0x49')]:_0x5cd349[_0xb39c('0x45')];_0x38ac08[_0xb39c('0x4e')]=qs['sort'](_0x243878['query'][_0xb39c('0x4f')]);_0x38ac08[_0xb39c('0x52')]=qs[_0xb39c('0x48')](_[_0xb39c('0x50')](_0x243878['query'],_0x5cd349[_0xb39c('0x48')]));if(_0x243878[_0xb39c('0x46')][_0xb39c('0x51')]){_0x38ac08[_0xb39c('0x52')]=_['merge'](_0x38ac08[_0xb39c('0x52')],{'$or':_[_0xb39c('0x40')](_0x38ac08[_0xb39c('0x49')],function(_0xfc08d5){var _0x36c8fa={};_0x36c8fa[_0xfc08d5]={'$like':'%'+_0x243878[_0xb39c('0x46')]['filter']+'%'};return _0x36c8fa;})});}_0x38ac08=_[_0xb39c('0x53')]({},_0x38ac08,_0x243878[_0xb39c('0x55')]);return _0x5b6ecc[_0xb39c('0x81')](_0x38ac08);}})[_0xb39c('0x24')](function(_0x4b68eb){if(_0x4b68eb){_0x3b3df1=_0x4b68eb[_0xb39c('0x6b')];if(!_0x243878[_0xb39c('0x46')][_0xb39c('0x6c')]('nolimit')){_0x38ac08['limit']=qs['limit'](_0x243878[_0xb39c('0x46')][_0xb39c('0x4d')]);_0x38ac08[_0xb39c('0x33')]=qs[_0xb39c('0x33')](_0x243878[_0xb39c('0x46')][_0xb39c('0x33')]);}return _0x5b6ecc[_0xb39c('0x81')](_0x38ac08);}})[_0xb39c('0x24')](function(_0x4070b5){if(_0x4070b5){return _0x4070b5?{'count':_0x3b3df1,'rows':_0x4070b5}:null;}})[_0xb39c('0x24')](respondWithResult(_0x1397e4,null))[_0xb39c('0x2d')](handleError(_0x1397e4,null));};exports[_0xb39c('0x82')]=function(_0x372f96,_0x30b359,_0x38fe7d){var _0x2459c9={'channel':_0xb39c('0x83')};var _0x46d1aa=[];var _0x55ae7f=[];var _0x520d7b={};return db[_0xb39c('0x56')][_0xb39c('0x5c')]({'where':{'id':_0x372f96[_0xb39c('0x65')]['id']},'include':[{'model':db[_0xb39c('0x7d')],'as':_0xb39c('0x84')}]})['then'](handleEntityNotFound(_0x30b359,null))['then'](function(_0x5aaf4f){_0x2459c9[_0xb39c('0x85')]=_0x5aaf4f;_0x2459c9['applications']=_['orderBy'](_0x5aaf4f[_0xb39c('0x84')],[_0xb39c('0x80')],[_0xb39c('0x86')]);if(_0x2459c9[_0xb39c('0x85')]['Applications']){delete _0x2459c9[_0xb39c('0x85')][_0xb39c('0x84')];}return db[_0xb39c('0x87')][_0xb39c('0x66')]();})['then'](function(_0x14c192){if(!_0x14c192){throw new db['Sequelize'][(_0xb39c('0x21'))]('no\x20available\x20attributes');}_0x46d1aa=_[_0xb39c('0x88')](_[_0xb39c('0x47')](_0x14c192),[_0xb39c('0x89'),_0xb39c('0x8a')]);_0x55ae7f=_[_0xb39c('0x88')](_[_0xb39c('0x47')](_0x14c192),['createdAt',_0xb39c('0x8a'),_0xb39c('0x8b'),_0xb39c('0x8c')]);_0x2459c9['body']={'mapKey':_0xb39c('0x8d')};if(_0x2459c9[_0xb39c('0x85')][_0xb39c('0x43')]&&_0x2459c9[_0xb39c('0x85')][_0xb39c('0x43')]===_0xb39c('0x8e')){_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x8f')]=_0x372f96[_0xb39c('0x5e')][_0xb39c('0x90')][_0xb39c('0x91')](_0xb39c('0x92'),'');_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x5e')]=_0x372f96['body'][_0xb39c('0x93')];_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x94')]=_0x372f96['body'][_0xb39c('0x95')];}if(_0x2459c9[_0xb39c('0x5e')]['id']){delete _0x2459c9[_0xb39c('0x5e')]['id'];}if(_['isNil'](_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x8f')])){throw new db[(_0xb39c('0x20'))][(_0xb39c('0x21'))](_0xb39c('0x96'));}if(_[_0xb39c('0x97')](_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x5e')])||_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x5e')]===''){throw new db[(_0xb39c('0x20'))]['ValidationError'](_0xb39c('0x98'));}if(_['isNil'](_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x99')])){throw new db[(_0xb39c('0x20'))][(_0xb39c('0x21'))](_0xb39c('0x9a')+_0x55ae7f);}if(!_['includes'](_0x55ae7f,_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x99')])){throw new db[(_0xb39c('0x20'))]['ValidationError'](_0xb39c('0x9b')+_0x55ae7f);}_0x520d7b[_0x2459c9['body'][_0xb39c('0x99')]]=_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x8f')];return db[_0xb39c('0x9c')]['find']({'where':{'id':_0x2459c9[_0xb39c('0x85')][_0xb39c('0x8c')]},'include':[{'model':db[_0xb39c('0x87')],'as':_0xb39c('0x9d'),'where':_0x520d7b,'limit':0x1,'order':[['updatedAt',_0xb39c('0x9e')]]}]});})[_0xb39c('0x24')](handleEntityNotFound(_0x30b359,null))[_0xb39c('0x24')](function(_0x4c9d2f){if(_0x4c9d2f){_0x2459c9[_0xb39c('0x9f')]=_[_0xb39c('0x72')](_0x4c9d2f,[_0xb39c('0x9d')]);if(_0x4c9d2f[_0xb39c('0x9d')][_0xb39c('0x6b')]){return _0x4c9d2f[_0xb39c('0x9d')][0x0];}var _0x652129=_[_0xb39c('0x18')](_0x2459c9[_0xb39c('0x5e')],{'firstName':_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x8f')],'ListId':_0x4c9d2f['id']});_0x652129[_0x2459c9['body']['mapKey']]=_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x8f')];return db[_0xb39c('0x87')][_0xb39c('0x5d')](_0x652129,{'fields':_0x46d1aa,'raw':!![]});}})[_0xb39c('0x24')](handleEntityNotFound(_0x30b359,null))[_0xb39c('0x24')](function(_0x3e683c){if(_0x3e683c){_0x2459c9['contact']=_0x3e683c;var _0x531a49={'ContactId':_0x3e683c['id'],'phone':_0x2459c9[_0xb39c('0x5e')]['from'],'WhatsappAccountId':_0x372f96[_0xb39c('0x65')]['id']};var _0x1bea73={'ContactId':_0x3e683c['id'],'WhatsappAccountId':_0x372f96['params']['id'],'closed':![]};return db[_0xb39c('0xa0')]['find']({'where':_0x1bea73})[_0xb39c('0x24')](function(_0x2c3705){if(_0x2c3705){return[_0x2c3705,![]];}return db['WhatsappInteraction']['create'](_0x531a49)[_0xb39c('0x24')](function(_0x4394ba){return[_0x4394ba,!![]];});});}})[_0xb39c('0x73')](function(_0x19d706,_0x554314){_0x2459c9[_0xb39c('0xa1')]=_0x19d706[_0xb39c('0x39')]({'plain':!![]});_0x2459c9['interaction'][_0xb39c('0xa2')]=![];if(_0x554314){if(_0x2459c9[_0xb39c('0x85')][_0xb39c('0xa3')]){_0x2459c9[_0xb39c('0xa4')][_0xb39c('0xa5')]({'id':0x0,'priority':_0x2459c9[_0xb39c('0xa4')]['length']+0x1,'app':_0xb39c('0xa6'),'appdata':_0xb39c('0xa7'),'interval':_0xb39c('0xa8')});}_0x2459c9[_0xb39c('0xa1')][_0xb39c('0xa2')]=!![];}return db[_0xb39c('0xa9')]['create']({'phone':_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x8f')],'messageId':_0x2459c9[_0xb39c('0x5e')][_0xb39c('0x94')],'body':_0x2459c9[_0xb39c('0x5e')]['body'],'WhatsappAccountId':_0x372f96[_0xb39c('0x65')]['id'],'WhatsappInteractionId':_0x19d706['id'],'direction':'in','ContactId':_0x19d706[_0xb39c('0xaa')],'AttachmentId':_0x2459c9[_0xb39c('0x5e')]['AttachmentId']});})[_0xb39c('0x24')](function(_0x3bcbc8){_0x2459c9[_0xb39c('0x2b')]=_0x3bcbc8;if(_0x2459c9[_0xb39c('0xa1')][_0xb39c('0xab')]){return db[_0xb39c('0x7a')][_0xb39c('0x5c')]({'attributes':['id',_0xb39c('0x3c')],'where':{'id':_0x2459c9[_0xb39c('0xa1')][_0xb39c('0xab')]}})[_0xb39c('0x24')](function(_0x37f362){if(_0x37f362){_0x2459c9[_0xb39c('0xa4')][_0xb39c('0xac')]({'id':0x0,'priority':0x0,'app':_0xb39c('0xad'),'appdata':_0x37f362['name']+','+(_0x2459c9[_0xb39c('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0xb39c('0xa8')});}return respondWithRpcPromise(_0xb39c('0xae'),'startRouting',_0x2459c9);});}return respondWithRpcPromise(_0xb39c('0xae'),_0xb39c('0xaf'),_0x2459c9);})[_0xb39c('0x24')](function(_0x4cf325){if(_0x4cf325){var _0xc22c99=0xc8;var _0x2f7e19=_0xb39c('0xb0');logger[_0xb39c('0x25')](_0xb39c('0xb1'),_0x2f7e19,_0xc22c99,_0xb39c('0xb2'));logger[_0xb39c('0x27')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2f7e19,_0xc22c99,_0xb39c('0xb2'),JSON[_0xb39c('0x28')](_0x4cf325));if(_0x2459c9[_0xb39c('0x85')][_0xb39c('0x43')]===_0xb39c('0x8e')){return _0x30b359[_0xb39c('0x30')](_0xc22c99)[_0xb39c('0xb3')]('Content-Type','text/xml')[_0xb39c('0x3d')](_0xb39c('0xb4'));}else{return _0x30b359[_0xb39c('0x30')](_0xc22c99)[_0xb39c('0x31')](_0x4cf325);}}})[_0xb39c('0x2d')](handleError(_0x30b359,null));};exports[_0xb39c('0x3d')]=function(_0x5c965d,_0x2c46b6,_0x1187d1){var _0x575905,_0x13d3f0,_0x47362e;if(_[_0xb39c('0x97')](_0x5c965d[_0xb39c('0x5e')][_0xb39c('0x5e')])||_0x5c965d[_0xb39c('0x5e')][_0xb39c('0x5e')]===''){throw new db[(_0xb39c('0x20'))][(_0xb39c('0x21'))](_0xb39c('0x98'));}if(_[_0xb39c('0x97')](_0x5c965d[_0xb39c('0x5e')]['to'])){throw new db[(_0xb39c('0x20'))][(_0xb39c('0x21'))]('to\x20is\x20mandatory');}_0x575905=_0x5c965d['body']['to'];return db[_0xb39c('0x56')]['find']({'where':{'id':_0x5c965d[_0xb39c('0x65')]['id']},'include':[{'model':db[_0xb39c('0x9c')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x575905},'limit':0x1,'order':[[_0xb39c('0x8a'),'DESC']]}]}]})[_0xb39c('0x24')](handleEntityNotFound(_0x2c46b6,null))[_0xb39c('0x24')](function(_0x21b576){if(_0x21b576&&_0x21b576[_0xb39c('0xb5')]){_0x13d3f0=_0x21b576[_0xb39c('0x39')]({'plain':!![]});if(_0x13d3f0['List']&&_0x13d3f0['List'][_0xb39c('0x9d')][_0xb39c('0x6b')]){return _0x13d3f0['List'][_0xb39c('0x9d')][0x0];}return db['CmContact'][_0xb39c('0x5d')](_[_0xb39c('0x18')](_0x5c965d['body'],{'firstName':_0x575905,'mobile':_0x575905,'phone':_0x575905,'ListId':_0x13d3f0[_0xb39c('0x8c')]}));}})['then'](handleEntityNotFound(_0x2c46b6,null))[_0xb39c('0x24')](function(_0x39affb){if(_0x39affb){_0x47362e=_0x39affb;return db[_0xb39c('0xa0')][_0xb39c('0x5c')]({'where':{'ContactId':_0x47362e['id'],'closed':![],'WhatsappAccountId':_0x13d3f0['id']}})['then'](function(_0x44e1c3){if(_0x44e1c3){return[_0x44e1c3,![]];}return db[_0xb39c('0xa0')][_0xb39c('0x5d')]({'UserId':_0x5c965d[_0xb39c('0xb6')]['id'],'ContactId':_0x47362e['id'],'WhatsappAccountId':_0x13d3f0['id'],'phone':_0x575905,'firstMsgDirection':'out','Messages':[_[_0xb39c('0x53')](_0x5c965d[_0xb39c('0x5e')],{'read':![],'body':_0x5c965d[_0xb39c('0x5e')][_0xb39c('0x5e')],'phone':_0x575905,'WhatsappAccountId':_0x13d3f0['id'],'UserId':_0x5c965d['user']['id'],'ContactId':_0x47362e['id']})]},{'include':[{'model':db[_0xb39c('0xa9')],'as':'Messages'}]})[_0xb39c('0x24')](function(_0x5bac7e){return[_0x5bac7e,!![]];});});}})['spread'](function(_0x430f1b,_0x1565d7){if(_0x1565d7){return _0x430f1b;}return db['WhatsappMessage'][_0xb39c('0x5d')](_[_0xb39c('0x53')](_0x5c965d[_0xb39c('0x5e')],{'read':![],'body':_0x5c965d['body'][_0xb39c('0x5e')],'phone':_0x575905,'WhatsappAccountId':_0x13d3f0['id'],'WhatsappInteractionId':_0x430f1b['id'],'UserId':_0x5c965d[_0xb39c('0xb6')]['id'],'ContactId':_0x47362e['id']}))['then'](function(_0x449359){_0x430f1b['dataValues']['Messages']=[];_0x430f1b[_0xb39c('0xb7')][_0xb39c('0xb8')][_0xb39c('0xa5')](_0x449359[_0xb39c('0xb7')]);return _0x430f1b;});})[_0xb39c('0x24')](respondWithResult(_0x2c46b6,null))[_0xb39c('0x2d')](handleError(_0x2c46b6,null));}; \ No newline at end of file +var _0x593e=['created','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','entity\x20found','stringify','text/xml','send','\x0a','to\x20is\x20mandatory','DESC','List','ListId','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','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~!@#$%^&-_=+[{]}.','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','name','Pause','mandatoryDispositionPause','map','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','WhatsappAccount','includeAll','rows','catch','show','params','keys','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','find','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','order','pick','findAll','removeDispositions','addAnswer','CannedAnswer','ids','omit','spread','removeAgents','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','findAndCountAll','getApplications','notify','Applications','account','applications','orderBy','priority','asc','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','twilio','from','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','CmContact','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*'];(function(_0x3e9f95,_0x10ad0f){var _0xb30e5d=function(_0x23df04){while(--_0x23df04){_0x3e9f95['push'](_0x3e9f95['shift']());}};_0xb30e5d(++_0x10ad0f);}(_0x593e,0xcb));var _0xe593=function(_0xeeb711,_0x5a71e1){_0xeeb711=_0xeeb711-0x0;var _0x4cc896=_0x593e[_0xeeb711];return _0x4cc896;};'use strict';var pdf=require(_0xe593('0x0'));var emlformat=require(_0xe593('0x1'));var rimraf=require(_0xe593('0x2'));var zipdir=require(_0xe593('0x3'));var jsonpatch=require(_0xe593('0x4'));var rp=require(_0xe593('0x5'));var moment=require(_0xe593('0x6'));var BPromise=require(_0xe593('0x7'));var Mustache=require('mustache');var util=require(_0xe593('0x8'));var path=require(_0xe593('0x9'));var sox=require(_0xe593('0xa'));var csv=require(_0xe593('0xb'));var ejs=require(_0xe593('0xc'));var fs=require('fs');var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var db=require(_0xe593('0x1a'))['db'];config[_0xe593('0x1b')]=_[_0xe593('0x1c')](config[_0xe593('0x1b')],{'host':_0xe593('0x1d'),'port':0x18eb});var socket=require(_0xe593('0x1e'))(new Redis(config[_0xe593('0x1b')]));require(_0xe593('0x1f'))['register'](socket);var jayson=require(_0xe593('0x20'));var client=jayson[_0xe593('0x21')]['http']({'port':0x232c});function checkPasswordPattern(_0x38418c,_0x44837b,_0x5d4c6a){if(_0x5d4c6a){var _0x2ae9b6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ae9b6[_0xe593('0x22')](_0x44837b)){return _0x38418c;}else{throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x25'));}}else{return _0x38418c;}}function respondWithRpcPromise(_0xb427f0,_0x48f3b4,_0xfbc79f,_0x470d07){return new BPromise(function(_0x5f57ce,_0xd1020e){var _0x28b5ed=_0x470d07||client;return _0x28b5ed['request'](_0xb427f0,_0xfbc79f)[_0xe593('0x26')](function(_0x3dba1b){logger[_0xe593('0x27')](_0xe593('0x28'),_0x48f3b4,_0xe593('0x29'));logger[_0xe593('0x2a')](_0xe593('0x2b'),_0x48f3b4,'request\x20sent',JSON['stringify'](_0x3dba1b));if(_0x3dba1b[_0xe593('0x2c')]){if(_0x3dba1b['error']['code']===0x1f4){logger[_0xe593('0x2c')](_0xe593('0x28'),_0x48f3b4,_0x3dba1b['error'][_0xe593('0x2d')]);return _0xd1020e(_0x3dba1b['error'][_0xe593('0x2d')]);}logger[_0xe593('0x2c')](_0xe593('0x28'),_0x48f3b4,_0x3dba1b[_0xe593('0x2c')][_0xe593('0x2d')]);return _0x5f57ce(_0x3dba1b[_0xe593('0x2c')][_0xe593('0x2d')]);}else{logger[_0xe593('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x48f3b4,_0xe593('0x29'));_0x5f57ce(_0x3dba1b[_0xe593('0x2e')]['message']);}})['catch'](function(_0xf8d492){logger[_0xe593('0x2c')](_0xe593('0x28'),_0x48f3b4,_0xf8d492);_0xd1020e(_0xf8d492);});});}function respondWithStatusCode(_0x43699d,_0x3b66bc){_0x3b66bc=_0x3b66bc||0xcc;return function(_0x27a3d2){if(_0x27a3d2){return _0x43699d['sendStatus'](_0x3b66bc);}return _0x43699d[_0xe593('0x2f')](_0x3b66bc)['end']();};}function respondWithResult(_0x1dacf6,_0xda61a7){_0xda61a7=_0xda61a7||0xc8;return function(_0x4a2eaa){if(_0x4a2eaa){return _0x1dacf6[_0xe593('0x2f')](_0xda61a7)['json'](_0x4a2eaa);}};}function respondWithFilteredResult(_0x44a68c,_0x1c147b){return function(_0x1618af){if(_0x1618af){var _0x501e54=_0x1618af[_0xe593('0x30')],_0x1ae8d9=_0x1c147b[_0xe593('0x31')],_0x13f44=_0x1c147b[_0xe593('0x31')]+_0x1c147b[_0xe593('0x32')],_0x3066ed;if(_0x13f44>=_0x501e54){_0x13f44=_0x501e54;_0x3066ed=0xc8;}else{_0x3066ed=0xce;}_0x44a68c['status'](_0x3066ed);return _0x44a68c[_0xe593('0x33')](_0xe593('0x34'),_0x1ae8d9+'-'+_0x13f44+'/'+_0x501e54)['json'](_0x1618af);}return null;};}function patchUpdates(_0xe5e728){return function(_0x571995){try{jsonpatch[_0xe593('0x35')](_0x571995,_0xe5e728,!![]);}catch(_0x32fd89){return BPromise[_0xe593('0x36')](_0x32fd89);}return _0x571995[_0xe593('0x37')]();};}function saveUpdates(_0x38d9f4,_0x24a560){return function(_0x40e1d3){if(_0x40e1d3){return _0x40e1d3[_0xe593('0x38')](_0x38d9f4)[_0xe593('0x26')](function(_0x4305de){return _0x4305de;});}return null;};}function removeEntity(_0x4d3fab,_0x27a563){return function(_0x2c0a30){if(_0x2c0a30){return _0x2c0a30[_0xe593('0x39')]()['then'](function(){var _0x4fefb3=_0x2c0a30[_0xe593('0x3a')]({'plain':!![]});var _0x5813bf=_0xe593('0x3b');return db[_0xe593('0x3c')][_0xe593('0x39')]({'where':{'type':_0x5813bf,'resourceId':_0x4fefb3['id']}})[_0xe593('0x26')](function(){return _0x2c0a30;});})[_0xe593('0x26')](function(){_0x4d3fab[_0xe593('0x2f')](0xcc)[_0xe593('0x3d')]();});}};}function handleEntityNotFound(_0x4889cc,_0x5112c1){return function(_0x8c6ea5){if(!_0x8c6ea5){_0x4889cc['sendStatus'](0x194);}return _0x8c6ea5;};}function handleError(_0x32bc16,_0x4877ad){_0x4877ad=_0x4877ad||0x1f4;return function(_0x206775){logger['error'](_0x206775['stack']);if(_0x206775[_0xe593('0x3e')]){delete _0x206775[_0xe593('0x3e')];}_0x32bc16[_0xe593('0x2f')](_0x4877ad)['send'](_0x206775);};}exports['index']=function(_0x5f11b9,_0x359285){var _0x584945={'include':[{'model':db[_0xe593('0x3f')],'as':_0xe593('0x40')}]},_0x37ba0e={},_0x3945af={'count':0x0,'rows':[]};var _0x50249e=_[_0xe593('0x41')](db['WhatsappAccount'][_0xe593('0x42')],function(_0x508a12){return{'name':_0x508a12['fieldName'],'type':_0x508a12['type'][_0xe593('0x43')]};});_0x37ba0e['model']=_[_0xe593('0x41')](_0x50249e,_0xe593('0x3e'));_0x37ba0e[_0xe593('0x44')]=_['keys'](_0x5f11b9[_0xe593('0x44')]);_0x37ba0e[_0xe593('0x45')]=_[_0xe593('0x46')](_0x37ba0e[_0xe593('0x47')],_0x37ba0e[_0xe593('0x44')]);_0x584945[_0xe593('0x48')]=_[_0xe593('0x46')](_0x37ba0e[_0xe593('0x47')],qs['fields'](_0x5f11b9[_0xe593('0x44')][_0xe593('0x49')]));_0x584945[_0xe593('0x48')]=_0x584945[_0xe593('0x48')][_0xe593('0x4a')]?_0x584945['attributes']:_0x37ba0e['model'];if(!_0x5f11b9[_0xe593('0x44')][_0xe593('0x4b')](_0xe593('0x4c'))){_0x584945['limit']=qs[_0xe593('0x32')](_0x5f11b9[_0xe593('0x44')]['limit']);_0x584945['offset']=qs[_0xe593('0x31')](_0x5f11b9[_0xe593('0x44')][_0xe593('0x31')]);}_0x584945['order']=qs[_0xe593('0x4d')](_0x5f11b9[_0xe593('0x44')][_0xe593('0x4d')]);_0x584945[_0xe593('0x4e')]=qs['filters'](_['pick'](_0x5f11b9['query'],_0x37ba0e['filters']),_0x50249e);if(_0x5f11b9[_0xe593('0x44')]['filter']){_0x584945[_0xe593('0x4e')]=_[_0xe593('0x4f')](_0x584945[_0xe593('0x4e')],{'$or':_[_0xe593('0x41')](_0x50249e,function(_0xe96f5e){if(_0xe96f5e[_0xe593('0x50')]!==_0xe593('0x51')){var _0x297c3e={};_0x297c3e[_0xe96f5e['name']]={'$like':'%'+_0x5f11b9[_0xe593('0x44')][_0xe593('0x52')]+'%'};return _0x297c3e;}})});}_0x584945=_[_0xe593('0x4f')]({},_0x584945,_0x5f11b9['options']);var _0x2d0113={'where':_0x584945['where']};return db[_0xe593('0x53')][_0xe593('0x30')](_0x2d0113)[_0xe593('0x26')](function(_0x55da3d){_0x3945af['count']=_0x55da3d;if(_0x5f11b9[_0xe593('0x44')][_0xe593('0x54')]){_0x584945['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x584945);})['then'](function(_0x5a7385){_0x3945af[_0xe593('0x55')]=_0x5a7385;return _0x3945af;})[_0xe593('0x26')](respondWithFilteredResult(_0x359285,_0x584945))[_0xe593('0x56')](handleError(_0x359285,null));};exports[_0xe593('0x57')]=function(_0x42ec06,_0x44201e){var _0x973821={'raw':![],'where':{'id':_0x42ec06[_0xe593('0x58')]['id']},'include':[{'model':db[_0xe593('0x3f')],'as':_0xe593('0x40')}]},_0x46410d={};_0x46410d[_0xe593('0x47')]=_[_0xe593('0x59')](db[_0xe593('0x53')][_0xe593('0x42')]);_0x46410d[_0xe593('0x44')]=_['keys'](_0x42ec06[_0xe593('0x44')]);_0x46410d[_0xe593('0x45')]=_[_0xe593('0x46')](_0x46410d[_0xe593('0x47')],_0x46410d[_0xe593('0x44')]);_0x973821[_0xe593('0x48')]=_[_0xe593('0x46')](_0x46410d[_0xe593('0x47')],qs[_0xe593('0x49')](_0x42ec06[_0xe593('0x44')][_0xe593('0x49')]));_0x973821[_0xe593('0x48')]=_0x973821[_0xe593('0x48')][_0xe593('0x4a')]?_0x973821[_0xe593('0x48')]:_0x46410d['model'];if(_0x42ec06[_0xe593('0x44')][_0xe593('0x54')]){_0x973821[_0xe593('0x5a')]=[{'all':!![]}];}_0x973821=_[_0xe593('0x4f')]({},_0x973821,_0x42ec06[_0xe593('0x5b')]);return db['WhatsappAccount']['find'](_0x973821)[_0xe593('0x26')](handleEntityNotFound(_0x44201e,null))[_0xe593('0x26')](respondWithResult(_0x44201e,null))[_0xe593('0x56')](handleError(_0x44201e,null));};exports[_0xe593('0x5c')]=function(_0x1b5643,_0x1e49ed){return db[_0xe593('0x53')]['create'](_0x1b5643['body'],{})[_0xe593('0x26')](function(_0x23ee3b){var _0x4ff51d=_0x1b5643[_0xe593('0x5d')][_0xe593('0x3a')]({'plain':!![]});if(!_0x4ff51d)throw new Error(_0xe593('0x5e'));if(_0x4ff51d[_0xe593('0x5f')]===_0xe593('0x5d')){var _0x2a38fc=_0x23ee3b[_0xe593('0x3a')]({'plain':!![]});var _0x3b8b19=_0xe593('0x3b');return db[_0xe593('0x60')]['find']({'where':{'name':_0x3b8b19,'userProfileId':_0x4ff51d[_0xe593('0x61')]},'raw':!![]})[_0xe593('0x26')](function(_0x390b95){if(_0x390b95&&_0x390b95[_0xe593('0x62')]===0x0){return db[_0xe593('0x3c')][_0xe593('0x5c')]({'name':_0x2a38fc[_0xe593('0x3e')],'resourceId':_0x2a38fc['id'],'type':_0x390b95['name'],'sectionId':_0x390b95['id']},{})[_0xe593('0x26')](function(){return _0x23ee3b;});}else{return _0x23ee3b;}})[_0xe593('0x56')](function(_0x434ce2){logger[_0xe593('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x434ce2);throw _0x434ce2;});}return _0x23ee3b;})[_0xe593('0x26')](respondWithResult(_0x1e49ed,0xc9))[_0xe593('0x56')](handleError(_0x1e49ed,null));};exports[_0xe593('0x38')]=function(_0x34c669,_0x377137){if(_0x34c669['body']['id']){delete _0x34c669[_0xe593('0x63')]['id'];}return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x34c669[_0xe593('0x58')]['id']},'include':[{'model':db[_0xe593('0x3f')],'as':_0xe593('0x40')}]})[_0xe593('0x26')](handleEntityNotFound(_0x377137,null))[_0xe593('0x26')](saveUpdates(_0x34c669['body'],null))[_0xe593('0x26')](respondWithResult(_0x377137,null))[_0xe593('0x56')](handleError(_0x377137,null));};exports[_0xe593('0x39')]=function(_0x100acd,_0x42edd2){return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x100acd[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x42edd2,null))[_0xe593('0x26')](removeEntity(_0x42edd2,null))['catch'](handleError(_0x42edd2,null));};exports[_0xe593('0x65')]=function(_0x42714a,_0x339a5e){return db['WhatsappAccount'][_0xe593('0x65')]()[_0xe593('0x26')](respondWithResult(_0x339a5e,null))[_0xe593('0x56')](handleError(_0x339a5e,null));};exports[_0xe593('0x66')]=function(_0x27c931,_0x5e263c,_0x17a1bc){if(_0x27c931[_0xe593('0x63')]['id']){delete _0x27c931['body']['id'];}return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x27c931[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x5e263c,null))['then'](function(_0x15f47c){if(_0x15f47c){_0x27c931[_0xe593('0x63')][_0xe593('0x67')]=_0x15f47c['id'];return db['Disposition'][_0xe593('0x5c')](_0x27c931[_0xe593('0x63')]);}})[_0xe593('0x26')](respondWithResult(_0x5e263c,null))['catch'](handleError(_0x5e263c,null));};exports[_0xe593('0x68')]=function(_0x11eae2,_0x346b0f,_0x52766f){var _0xe89d7e={'raw':![],'where':{}};var _0x4d9dba={};var _0x2f81d2={'count':0x0,'rows':[]};return db[_0xe593('0x53')][_0xe593('0x69')]({'where':{'id':_0x11eae2[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x346b0f,null))[_0xe593('0x26')](function(_0x285df9){if(_0x285df9){_0x4d9dba[_0xe593('0x47')]=_[_0xe593('0x59')](db[_0xe593('0x6a')][_0xe593('0x42')]);_0x4d9dba[_0xe593('0x44')]=_[_0xe593('0x59')](_0x11eae2[_0xe593('0x44')]);_0x4d9dba['filters']=_[_0xe593('0x46')](_0x4d9dba[_0xe593('0x47')],_0x4d9dba[_0xe593('0x44')]);_0xe89d7e[_0xe593('0x48')]=_[_0xe593('0x46')](_0x4d9dba[_0xe593('0x47')],qs[_0xe593('0x49')](_0x11eae2[_0xe593('0x44')]['fields']));_0xe89d7e['attributes']=_0xe89d7e['attributes'][_0xe593('0x4a')]?_0xe89d7e[_0xe593('0x48')]:_0x4d9dba[_0xe593('0x47')];if(!_0x11eae2['query']['hasOwnProperty'](_0xe593('0x4c'))){_0xe89d7e['limit']=qs[_0xe593('0x32')](_0x11eae2[_0xe593('0x44')][_0xe593('0x32')]);_0xe89d7e['offset']=qs[_0xe593('0x31')](_0x11eae2[_0xe593('0x44')][_0xe593('0x31')]);}_0xe89d7e[_0xe593('0x6b')]=qs[_0xe593('0x4d')](_0x11eae2[_0xe593('0x44')][_0xe593('0x4d')]);_0xe89d7e['where']=qs[_0xe593('0x45')](_[_0xe593('0x6c')](_0x11eae2['query'],_0x4d9dba[_0xe593('0x45')]));_0xe89d7e[_0xe593('0x4e')][_0xe593('0x67')]=_0x285df9['id'];if(_0x11eae2['query'][_0xe593('0x52')]){_0xe89d7e[_0xe593('0x4e')]=_[_0xe593('0x4f')](_0xe89d7e[_0xe593('0x4e')],{'$or':_[_0xe593('0x41')](_0xe89d7e[_0xe593('0x48')],function(_0x4c16d0){var _0x56fd23={};_0x56fd23[_0x4c16d0]={'$like':'%'+_0x11eae2[_0xe593('0x44')]['filter']+'%'};return _0x56fd23;})});}_0xe89d7e=_['merge']({},_0xe89d7e,_0x11eae2['options']);return db[_0xe593('0x6a')][_0xe593('0x30')]({'where':_0xe89d7e[_0xe593('0x4e')]})[_0xe593('0x26')](function(_0xa07dbb){_0x2f81d2['count']=_0xa07dbb;if(_0x11eae2['query'][_0xe593('0x54')]){_0xe89d7e[_0xe593('0x5a')]=[{'all':!![]}];}return db[_0xe593('0x6a')][_0xe593('0x6d')](_0xe89d7e);})['then'](function(_0x20574a){_0x2f81d2[_0xe593('0x55')]=_0x20574a;return _0x2f81d2;});}})[_0xe593('0x26')](respondWithFilteredResult(_0x346b0f,_0xe89d7e))['catch'](handleError(_0x346b0f,null));};exports[_0xe593('0x6e')]=function(_0x454479,_0x4dd704,_0xc0904c){return db[_0xe593('0x53')]['find']({'where':{'id':_0x454479['params']['id']}})['then'](handleEntityNotFound(_0x4dd704,null))['then'](function(_0x552869){if(_0x552869){return _0x552869['removeDispositions'](_0x454479[_0xe593('0x44')]['ids']);}})[_0xe593('0x26')](respondWithStatusCode(_0x4dd704,null))[_0xe593('0x56')](handleError(_0x4dd704,null));};exports[_0xe593('0x6f')]=function(_0x57683e,_0x47ac27,_0x2efa5a){if(_0x57683e[_0xe593('0x63')]['id']){delete _0x57683e[_0xe593('0x63')]['id'];}return db[_0xe593('0x53')]['find']({'where':{'id':_0x57683e['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x47ac27,null))[_0xe593('0x26')](function(_0x5127da){if(_0x5127da){_0x57683e[_0xe593('0x63')][_0xe593('0x67')]=_0x5127da['id'];return db[_0xe593('0x70')][_0xe593('0x5c')](_0x57683e[_0xe593('0x63')]);}})['then'](respondWithResult(_0x47ac27,null))[_0xe593('0x56')](handleError(_0x47ac27,null));};exports['getAnswers']=function(_0x27bf6c,_0x5d4e7f,_0x36762a){var _0x509e82={'raw':![],'where':{}};var _0x50ab4d={};var _0x265fee={'count':0x0,'rows':[]};return db[_0xe593('0x53')][_0xe593('0x69')]({'where':{'id':_0x27bf6c['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x5d4e7f,null))[_0xe593('0x26')](function(_0x1462f8){if(_0x1462f8){_0x50ab4d['model']=_[_0xe593('0x59')](db['CannedAnswer'][_0xe593('0x42')]);_0x50ab4d[_0xe593('0x44')]=_['keys'](_0x27bf6c[_0xe593('0x44')]);_0x50ab4d[_0xe593('0x45')]=_[_0xe593('0x46')](_0x50ab4d['model'],_0x50ab4d['query']);_0x509e82[_0xe593('0x48')]=_['intersection'](_0x50ab4d[_0xe593('0x47')],qs[_0xe593('0x49')](_0x27bf6c['query']['fields']));_0x509e82[_0xe593('0x48')]=_0x509e82[_0xe593('0x48')][_0xe593('0x4a')]?_0x509e82['attributes']:_0x50ab4d[_0xe593('0x47')];if(!_0x27bf6c[_0xe593('0x44')][_0xe593('0x4b')](_0xe593('0x4c'))){_0x509e82[_0xe593('0x32')]=qs[_0xe593('0x32')](_0x27bf6c['query'][_0xe593('0x32')]);_0x509e82[_0xe593('0x31')]=qs[_0xe593('0x31')](_0x27bf6c[_0xe593('0x44')][_0xe593('0x31')]);}_0x509e82[_0xe593('0x6b')]=qs[_0xe593('0x4d')](_0x27bf6c['query'][_0xe593('0x4d')]);_0x509e82[_0xe593('0x4e')]=qs[_0xe593('0x45')](_['pick'](_0x27bf6c['query'],_0x50ab4d['filters']));_0x509e82[_0xe593('0x4e')][_0xe593('0x67')]=_0x1462f8['id'];if(_0x27bf6c['query'][_0xe593('0x52')]){_0x509e82[_0xe593('0x4e')]=_['merge'](_0x509e82[_0xe593('0x4e')],{'$or':_['map'](_0x509e82['attributes'],function(_0x28470c){var _0x427472={};_0x427472[_0x28470c]={'$like':'%'+_0x27bf6c[_0xe593('0x44')][_0xe593('0x52')]+'%'};return _0x427472;})});}_0x509e82=_[_0xe593('0x4f')]({},_0x509e82,_0x27bf6c['options']);return db[_0xe593('0x70')][_0xe593('0x30')]({'where':_0x509e82['where']})[_0xe593('0x26')](function(_0x477b5b){_0x265fee[_0xe593('0x30')]=_0x477b5b;if(_0x27bf6c[_0xe593('0x44')][_0xe593('0x54')]){_0x509e82[_0xe593('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe593('0x6d')](_0x509e82);})[_0xe593('0x26')](function(_0x10d10a){_0x265fee[_0xe593('0x55')]=_0x10d10a;return _0x265fee;});}})[_0xe593('0x26')](respondWithFilteredResult(_0x5d4e7f,_0x509e82))[_0xe593('0x56')](handleError(_0x5d4e7f,null));};exports['removeAnswers']=function(_0xed392c,_0x28963c,_0x4b31c8){return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0xed392c['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x28963c,null))['then'](function(_0x496e63){if(_0x496e63){return _0x496e63['removeAnswers'](_0xed392c[_0xe593('0x44')]['ids']);}})[_0xe593('0x26')](respondWithStatusCode(_0x28963c,null))[_0xe593('0x56')](handleError(_0x28963c,null));};exports['addAgents']=function(_0x3e7bd4,_0x19fd51,_0x3a2a3a){return db[_0xe593('0x53')]['find']({'where':{'id':_0x3e7bd4['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x19fd51,null))['then'](function(_0x4675f8){if(_0x4675f8){return _0x4675f8['addAgents'](_0x3e7bd4[_0xe593('0x63')][_0xe593('0x71')],_[_0xe593('0x72')](_0x3e7bd4[_0xe593('0x63')],[_0xe593('0x71'),'id'])||{})[_0xe593('0x73')](function(_0x53f8fa){for(var _0xb029b1=0x0;_0xb029b1<_0x3e7bd4[_0xe593('0x63')]['ids'][_0xe593('0x4a')];_0xb029b1+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x3e7bd4[_0xe593('0x63')][_0xe593('0x71')][_0xb029b1],'WhatsappAccountId':_0x3e7bd4[_0xe593('0x58')]['id']});}return _0x53f8fa;});}})[_0xe593('0x26')](respondWithResult(_0x19fd51,null))[_0xe593('0x56')](handleError(_0x19fd51,null));};exports[_0xe593('0x74')]=function(_0x23e40c,_0x14727f,_0x283ae8){return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x23e40c['params']['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x14727f,null))['then'](function(_0x55df1f){if(_0x55df1f){return _0x55df1f[_0xe593('0x74')](_0x23e40c[_0xe593('0x44')][_0xe593('0x71')])['then'](function(){if(_['isArray'](_0x23e40c[_0xe593('0x44')][_0xe593('0x71')])){for(var _0xe0a60a=0x0;_0xe0a60a<_0x23e40c[_0xe593('0x44')]['ids'][_0xe593('0x4a')];_0xe0a60a+=0x1){socket[_0xe593('0x75')](_0xe593('0x76'),{'UserId':Number(_0x23e40c[_0xe593('0x44')][_0xe593('0x71')][_0xe0a60a]),'WhatsappAccountId':Number(_0x23e40c[_0xe593('0x58')]['id'])});}}else{socket[_0xe593('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x23e40c[_0xe593('0x44')][_0xe593('0x71')]),'WhatsappAccountId':Number(_0x23e40c[_0xe593('0x58')]['id'])});}});}})[_0xe593('0x26')](respondWithStatusCode(_0x14727f,null))[_0xe593('0x56')](handleError(_0x14727f,null));};exports[_0xe593('0x77')]=function(_0x38d755,_0x132a51,_0x140e7e){var _0x2a55ea={};var _0x38b776={};var _0x5b74d2;var _0x4a933d;return db[_0xe593('0x53')][_0xe593('0x69')]({'where':{'id':_0x38d755[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x132a51,null))[_0xe593('0x26')](function(_0xce5ca6){if(_0xce5ca6){_0x5b74d2=_0xce5ca6;_0x38b776['model']=_['keys'](db[_0xe593('0x78')][_0xe593('0x42')]);_0x38b776[_0xe593('0x44')]=_[_0xe593('0x59')](_0x38d755['query']);_0x38b776['filters']=_[_0xe593('0x46')](_0x38b776[_0xe593('0x47')],_0x38b776[_0xe593('0x44')]);_0x2a55ea[_0xe593('0x48')]=_['intersection'](_0x38b776[_0xe593('0x47')],qs[_0xe593('0x49')](_0x38d755[_0xe593('0x44')][_0xe593('0x49')]));_0x2a55ea[_0xe593('0x48')]=_0x2a55ea['attributes'][_0xe593('0x4a')]?_0x2a55ea[_0xe593('0x48')]:_0x38b776['model'];_0x2a55ea[_0xe593('0x6b')]=qs[_0xe593('0x4d')](_0x38d755['query'][_0xe593('0x4d')]);_0x2a55ea[_0xe593('0x4e')]=qs['filters'](_[_0xe593('0x6c')](_0x38d755[_0xe593('0x44')],_0x38b776['filters']));if(_0x38d755[_0xe593('0x44')][_0xe593('0x52')]){_0x2a55ea[_0xe593('0x4e')]=_[_0xe593('0x4f')](_0x2a55ea[_0xe593('0x4e')],{'$or':_[_0xe593('0x41')](_0x2a55ea['attributes'],function(_0x1e499e){var _0x254927={};_0x254927[_0x1e499e]={'$like':'%'+_0x38d755[_0xe593('0x44')][_0xe593('0x52')]+'%'};return _0x254927;})});}_0x2a55ea=_[_0xe593('0x4f')]({},_0x2a55ea,_0x38d755[_0xe593('0x5b')]);return _0x5b74d2[_0xe593('0x77')](_0x2a55ea);}})[_0xe593('0x26')](function(_0x53aab1){if(_0x53aab1){_0x4a933d=_0x53aab1['length'];if(!_0x38d755['query'][_0xe593('0x4b')]('nolimit')){_0x2a55ea[_0xe593('0x32')]=qs[_0xe593('0x32')](_0x38d755[_0xe593('0x44')][_0xe593('0x32')]);_0x2a55ea[_0xe593('0x31')]=qs[_0xe593('0x31')](_0x38d755[_0xe593('0x44')][_0xe593('0x31')]);}return _0x5b74d2[_0xe593('0x77')](_0x2a55ea);}})[_0xe593('0x26')](function(_0x2a11d0){if(_0x2a11d0){return _0x2a11d0?{'count':_0x4a933d,'rows':_0x2a11d0}:null;}})[_0xe593('0x26')](respondWithResult(_0x132a51,null))['catch'](handleError(_0x132a51,null));};exports[_0xe593('0x79')]=function(_0x539d6e,_0xb14ef0,_0x148e1e){return db[_0xe593('0x53')]['findOne']({'where':{'id':_0x539d6e[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0xb14ef0,null))[_0xe593('0x26')](function(_0x324c26){if(_0x324c26){return db[_0xe593('0x7a')][_0xe593('0x7b')](function(_0x2ca3d6){return db['WhatsappApplication'][_0xe593('0x39')]({'where':{'WhatsappAccountId':_0x539d6e[_0xe593('0x58')]['id']},'transaction':_0x2ca3d6})[_0xe593('0x26')](function(_0x240e1b){var _0x465f83=_[_0xe593('0x41')](_0x539d6e['body'],function(_0xbb34ba){_0xbb34ba[_0xe593('0x67')]=_0x539d6e[_0xe593('0x58')]['id'];return _0xbb34ba;});return db[_0xe593('0x7c')]['bulkCreate'](_0x465f83,{'transaction':_0x2ca3d6});});})[_0xe593('0x26')](function(){return db['WhatsappApplication'][_0xe593('0x7d')]({'where':{'WhatsappAccountId':_0x539d6e['params']['id']},'order':'priority'});});}})[_0xe593('0x26')](respondWithResult(_0xb14ef0,null))[_0xe593('0x56')](handleError(_0xb14ef0,null));};exports[_0xe593('0x7e')]=function(_0x62cd5f,_0x35b210,_0x5e4170){var _0x450e13={};var _0x1a01c5={};var _0x273404;var _0x34b888;return db['WhatsappAccount'][_0xe593('0x69')]({'where':{'id':_0x62cd5f[_0xe593('0x58')]['id']}})[_0xe593('0x26')](handleEntityNotFound(_0x35b210,null))['then'](function(_0x1f5be5){if(_0x1f5be5){_0x273404=_0x1f5be5;_0x1a01c5['model']=_[_0xe593('0x59')](db['WhatsappApplication'][_0xe593('0x42')]);_0x1a01c5[_0xe593('0x44')]=_[_0xe593('0x59')](_0x62cd5f[_0xe593('0x44')]);_0x1a01c5[_0xe593('0x45')]=_[_0xe593('0x46')](_0x1a01c5[_0xe593('0x47')],_0x1a01c5[_0xe593('0x44')]);_0x450e13[_0xe593('0x48')]=_[_0xe593('0x46')](_0x1a01c5[_0xe593('0x47')],qs[_0xe593('0x49')](_0x62cd5f[_0xe593('0x44')][_0xe593('0x49')]));_0x450e13[_0xe593('0x48')]=_0x450e13[_0xe593('0x48')][_0xe593('0x4a')]?_0x450e13['attributes']:_0x1a01c5[_0xe593('0x47')];_0x450e13[_0xe593('0x6b')]=qs[_0xe593('0x4d')](_0x62cd5f[_0xe593('0x44')][_0xe593('0x4d')]);_0x450e13[_0xe593('0x4e')]=qs['filters'](_[_0xe593('0x6c')](_0x62cd5f['query'],_0x1a01c5[_0xe593('0x45')]));if(_0x62cd5f['query']['filter']){_0x450e13[_0xe593('0x4e')]=_[_0xe593('0x4f')](_0x450e13[_0xe593('0x4e')],{'$or':_[_0xe593('0x41')](_0x450e13[_0xe593('0x48')],function(_0x5555e9){var _0x18b2a6={};_0x18b2a6[_0x5555e9]={'$like':'%'+_0x62cd5f[_0xe593('0x44')][_0xe593('0x52')]+'%'};return _0x18b2a6;})});}_0x450e13=_['merge']({},_0x450e13,_0x62cd5f[_0xe593('0x5b')]);return _0x273404[_0xe593('0x7e')](_0x450e13);}})[_0xe593('0x26')](function(_0x419e9a){if(_0x419e9a){_0x34b888=_0x419e9a[_0xe593('0x4a')];if(!_0x62cd5f[_0xe593('0x44')][_0xe593('0x4b')](_0xe593('0x4c'))){_0x450e13[_0xe593('0x32')]=qs[_0xe593('0x32')](_0x62cd5f['query'][_0xe593('0x32')]);_0x450e13[_0xe593('0x31')]=qs[_0xe593('0x31')](_0x62cd5f[_0xe593('0x44')][_0xe593('0x31')]);}return _0x273404[_0xe593('0x7e')](_0x450e13);}})[_0xe593('0x26')](function(_0x2cb744){if(_0x2cb744){return _0x2cb744?{'count':_0x34b888,'rows':_0x2cb744}:null;}})['then'](respondWithResult(_0x35b210,null))[_0xe593('0x56')](handleError(_0x35b210,null));};exports[_0xe593('0x7f')]=function(_0x381cc3,_0x46bef8,_0x1a064a){var _0x269d70={'channel':'whatsapp'};var _0x83f8ff=[];var _0x8ac78c=[];var _0x352ad3={};return db[_0xe593('0x53')]['find']({'where':{'id':_0x381cc3[_0xe593('0x58')]['id']},'include':[{'model':db[_0xe593('0x7c')],'as':_0xe593('0x80')}]})['then'](handleEntityNotFound(_0x46bef8,null))[_0xe593('0x26')](function(_0x411b32){_0x269d70[_0xe593('0x81')]=_0x411b32;_0x269d70[_0xe593('0x82')]=_[_0xe593('0x83')](_0x411b32[_0xe593('0x80')],[_0xe593('0x84')],[_0xe593('0x85')]);if(_0x269d70['account'][_0xe593('0x80')]){delete _0x269d70[_0xe593('0x81')]['Applications'];}return db['CmContact'][_0xe593('0x65')]();})[_0xe593('0x26')](function(_0x5b1240){if(!_0x5b1240){throw new db['Sequelize'][(_0xe593('0x24'))](_0xe593('0x86'));}_0x83f8ff=_[_0xe593('0x87')](_[_0xe593('0x59')](_0x5b1240),[_0xe593('0x88'),_0xe593('0x89')]);_0x8ac78c=_[_0xe593('0x87')](_[_0xe593('0x59')](_0x5b1240),[_0xe593('0x88'),_0xe593('0x89'),_0xe593('0x8a'),'ListId']);_0x269d70[_0xe593('0x63')]={'mapKey':'mobile'};if(_0x269d70[_0xe593('0x81')][_0xe593('0x50')]&&_0x269d70[_0xe593('0x81')][_0xe593('0x50')]===_0xe593('0x8b')){_0x269d70[_0xe593('0x63')][_0xe593('0x8c')]=_0x381cc3[_0xe593('0x63')]['From']['replace'](_0xe593('0x8d'),'');_0x269d70[_0xe593('0x63')][_0xe593('0x63')]=_0x381cc3[_0xe593('0x63')][_0xe593('0x8e')];_0x269d70[_0xe593('0x63')][_0xe593('0x8f')]=_0x381cc3[_0xe593('0x63')][_0xe593('0x90')];}if(_0x269d70['body']['id']){delete _0x269d70[_0xe593('0x63')]['id'];}if(_[_0xe593('0x91')](_0x269d70['body'][_0xe593('0x8c')])){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x92'));}if(_['isNil'](_0x269d70['body'][_0xe593('0x63')])||_0x269d70['body'][_0xe593('0x63')]===''){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x93'));}if(_[_0xe593('0x91')](_0x269d70[_0xe593('0x63')][_0xe593('0x94')])){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x95')+_0x8ac78c);}if(!_['includes'](_0x8ac78c,_0x269d70[_0xe593('0x63')]['mapKey'])){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0x96')+_0x8ac78c);}_0x352ad3[_0x269d70[_0xe593('0x63')][_0xe593('0x94')]]=_0x269d70[_0xe593('0x63')][_0xe593('0x8c')];return db[_0xe593('0x97')][_0xe593('0x64')]({'where':{'id':_0x269d70['account']['ListId']},'include':[{'model':db['CmContact'],'as':_0xe593('0x98'),'where':_0x352ad3,'limit':0x1,'order':[[_0xe593('0x89'),'DESC']]}]});})[_0xe593('0x26')](handleEntityNotFound(_0x46bef8,null))[_0xe593('0x26')](function(_0x428b30){if(_0x428b30){_0x269d70[_0xe593('0x99')]=_['omit'](_0x428b30,[_0xe593('0x98')]);if(_0x428b30[_0xe593('0x98')]['length']){return _0x428b30[_0xe593('0x98')][0x0];}var _0x30e775=_[_0xe593('0x1c')](_0x269d70[_0xe593('0x63')],{'firstName':_0x269d70[_0xe593('0x63')][_0xe593('0x8c')],'ListId':_0x428b30['id']});_0x30e775[_0x269d70[_0xe593('0x63')][_0xe593('0x94')]]=_0x269d70[_0xe593('0x63')][_0xe593('0x8c')];return db[_0xe593('0x9a')][_0xe593('0x5c')](_0x30e775,{'fields':_0x83f8ff,'raw':!![]});}})[_0xe593('0x26')](handleEntityNotFound(_0x46bef8,null))[_0xe593('0x26')](function(_0x486178){if(_0x486178){_0x269d70[_0xe593('0x9b')]=_0x486178;var _0x7e0d1f={'ContactId':_0x486178['id'],'phone':_0x269d70[_0xe593('0x63')][_0xe593('0x8c')],'WhatsappAccountId':_0x381cc3[_0xe593('0x58')]['id']};var _0x2c7e0a={'ContactId':_0x486178['id'],'WhatsappAccountId':_0x381cc3[_0xe593('0x58')]['id'],'closed':![]};return db[_0xe593('0x9c')][_0xe593('0x64')]({'where':_0x2c7e0a})[_0xe593('0x26')](function(_0x526fbf){if(_0x526fbf){return[_0x526fbf,![]];}return db[_0xe593('0x9c')][_0xe593('0x5c')](_0x7e0d1f)[_0xe593('0x26')](function(_0xc1e03b){return[_0xc1e03b,!![]];});});}})['spread'](function(_0x3561d6,_0x44b1b1){_0x269d70[_0xe593('0x9d')]=_0x3561d6['get']({'plain':!![]});_0x269d70['interaction']['created']=![];if(_0x44b1b1){if(_0x269d70[_0xe593('0x81')][_0xe593('0x9e')]){_0x269d70[_0xe593('0x82')][_0xe593('0x9f')]({'id':0x0,'priority':_0x269d70[_0xe593('0x82')][_0xe593('0x4a')]+0x1,'app':_0xe593('0xa0'),'appdata':_0xe593('0xa1'),'interval':_0xe593('0xa2')});}_0x269d70['interaction'][_0xe593('0xa3')]=!![];}return db['WhatsappMessage'][_0xe593('0x5c')]({'phone':_0x269d70['body'][_0xe593('0x8c')],'messageId':_0x269d70['body'][_0xe593('0x8f')],'body':_0x269d70[_0xe593('0x63')][_0xe593('0x63')],'WhatsappAccountId':_0x381cc3[_0xe593('0x58')]['id'],'WhatsappInteractionId':_0x3561d6['id'],'direction':'in','ContactId':_0x3561d6[_0xe593('0xa4')],'AttachmentId':_0x269d70[_0xe593('0x63')][_0xe593('0xa5')]});})[_0xe593('0x26')](function(_0x589731){_0x269d70['message']=_0x589731;if(_0x269d70['interaction'][_0xe593('0xa6')]){return db[_0xe593('0x78')][_0xe593('0x64')]({'attributes':['id',_0xe593('0x3e')],'where':{'id':_0x269d70[_0xe593('0x9d')][_0xe593('0xa6')]}})[_0xe593('0x26')](function(_0x43e223){if(_0x43e223){_0x269d70['applications'][_0xe593('0xa7')]({'id':0x0,'priority':0x0,'app':_0xe593('0xa8'),'appdata':_0x43e223[_0xe593('0x3e')]+','+(_0x269d70[_0xe593('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xe593('0xa2')});}return respondWithRpcPromise(_0xe593('0xa9'),'startRouting',_0x269d70);});}return respondWithRpcPromise(_0xe593('0xa9'),_0xe593('0xaa'),_0x269d70);})[_0xe593('0x26')](function(_0x4a4b53){if(_0x4a4b53){var _0x4f2e0f=0xc8;var _0x350054='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x350054,_0x4f2e0f,'entity\x20found');logger[_0xe593('0x2a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x350054,_0x4f2e0f,_0xe593('0xab'),JSON[_0xe593('0xac')](_0x4a4b53));if(_0x269d70['account'][_0xe593('0x50')]===_0xe593('0x8b')){return _0x46bef8['status'](_0x4f2e0f)[_0xe593('0x33')]('Content-Type',_0xe593('0xad'))[_0xe593('0xae')](_0xe593('0xaf'));}else{return _0x46bef8[_0xe593('0x2f')](_0x4f2e0f)['json'](_0x4a4b53);}}})[_0xe593('0x56')](handleError(_0x46bef8,null));};exports[_0xe593('0xae')]=function(_0x46cfc6,_0x3afb57,_0x376ad1){var _0xd82998,_0x3e38a1,_0x1780da;if(_[_0xe593('0x91')](_0x46cfc6[_0xe593('0x63')][_0xe593('0x63')])||_0x46cfc6[_0xe593('0x63')][_0xe593('0x63')]===''){throw new db[(_0xe593('0x23'))]['ValidationError'](_0xe593('0x93'));}if(_[_0xe593('0x91')](_0x46cfc6[_0xe593('0x63')]['to'])){throw new db[(_0xe593('0x23'))][(_0xe593('0x24'))](_0xe593('0xb0'));}_0xd82998=_0x46cfc6[_0xe593('0x63')]['to'];return db[_0xe593('0x53')][_0xe593('0x64')]({'where':{'id':_0x46cfc6[_0xe593('0x58')]['id']},'include':[{'model':db[_0xe593('0x97')],'as':'List','include':[{'model':db[_0xe593('0x9a')],'as':_0xe593('0x98'),'where':{'mobile':_0xd82998},'limit':0x1,'order':[[_0xe593('0x89'),_0xe593('0xb1')]]}]}]})[_0xe593('0x26')](handleEntityNotFound(_0x3afb57,null))['then'](function(_0x592468){if(_0x592468&&_0x592468['List']){_0x3e38a1=_0x592468['get']({'plain':!![]});if(_0x3e38a1[_0xe593('0xb2')]&&_0x3e38a1[_0xe593('0xb2')][_0xe593('0x98')][_0xe593('0x4a')]){return _0x3e38a1['List'][_0xe593('0x98')][0x0];}return db[_0xe593('0x9a')][_0xe593('0x5c')](_[_0xe593('0x1c')](_0x46cfc6[_0xe593('0x63')],{'firstName':_0xd82998,'mobile':_0xd82998,'phone':_0xd82998,'ListId':_0x3e38a1[_0xe593('0xb3')]}));}})[_0xe593('0x26')](handleEntityNotFound(_0x3afb57,null))['then'](function(_0x2c8e58){if(_0x2c8e58){_0x1780da=_0x2c8e58;return db[_0xe593('0x9c')][_0xe593('0x64')]({'where':{'ContactId':_0x1780da['id'],'closed':![],'WhatsappAccountId':_0x3e38a1['id']}})['then'](function(_0x4a51f6){if(_0x4a51f6){return[_0x4a51f6,![]];}return db[_0xe593('0x9c')][_0xe593('0x5c')]({'UserId':_0x46cfc6['user']['id'],'ContactId':_0x1780da['id'],'WhatsappAccountId':_0x3e38a1['id'],'phone':_0xd82998,'firstMsgDirection':'out','Messages':[_[_0xe593('0x4f')](_0x46cfc6[_0xe593('0x63')],{'read':![],'body':_0x46cfc6['body'][_0xe593('0x63')],'phone':_0xd82998,'WhatsappAccountId':_0x3e38a1['id'],'UserId':_0x46cfc6[_0xe593('0x5d')]['id'],'ContactId':_0x1780da['id']})]},{'include':[{'model':db[_0xe593('0xb4')],'as':_0xe593('0xb5')}]})['then'](function(_0x1215d1){return[_0x1215d1,!![]];});});}})['spread'](function(_0x5ddcb8,_0x31838b){if(_0x31838b){return _0x5ddcb8;}return db[_0xe593('0xb4')]['create'](_['merge'](_0x46cfc6[_0xe593('0x63')],{'read':![],'body':_0x46cfc6['body'][_0xe593('0x63')],'phone':_0xd82998,'WhatsappAccountId':_0x3e38a1['id'],'WhatsappInteractionId':_0x5ddcb8['id'],'UserId':_0x46cfc6[_0xe593('0x5d')]['id'],'ContactId':_0x1780da['id']}))['then'](function(_0x2c9e3d){_0x5ddcb8[_0xe593('0xb6')]['Messages']=[];_0x5ddcb8['dataValues'][_0xe593('0xb5')][_0xe593('0x9f')](_0x2c9e3d[_0xe593('0xb6')]);return _0x5ddcb8;});})['then'](respondWithResult(_0x3afb57,null))[_0xe593('0x56')](handleError(_0x3afb57,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2cf6a07..0c125de 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 _0x57ca=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','save','update','remove','emit'];(function(_0x3b0e90,_0x589c18){var _0x4665a3=function(_0x2d1e36){while(--_0x2d1e36){_0x3b0e90['push'](_0x3b0e90['shift']());}};_0x4665a3(++_0x589c18);}(_0x57ca,0x108));var _0xa57c=function(_0x164e0d,_0x25f0aa){_0x164e0d=_0x164e0d-0x0;var _0x3920da=_0x57ca[_0x164e0d];return _0x3920da;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xa57c('0x0'))['db'][_0xa57c('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa57c('0x2'),'afterUpdate':_0xa57c('0x3'),'afterDestroy':_0xa57c('0x4')};function emitEvent(_0x15e330){return function(_0x1da469,_0x48be2d,_0x40ba22){WhatsappAccountEvents[_0xa57c('0x5')](_0x15e330+':'+_0x1da469['id'],_0x1da469);WhatsappAccountEvents[_0xa57c('0x5')](_0x15e330,_0x1da469);_0x40ba22(null);};}for(var e in events){if(events[_0xa57c('0x6')](e)){var event=events[e];WhatsappAccount[_0xa57c('0x7')](e,emitEvent(event));}}module[_0xa57c('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x2aa3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x1f686b,_0x40f682){var _0x150fb6=function(_0xfdee1a){while(--_0xfdee1a){_0x1f686b['push'](_0x1f686b['shift']());}};_0x150fb6(++_0x40f682);}(_0x2aa3,0x83));var _0x32aa=function(_0x321c50,_0x2b3616){_0x321c50=_0x321c50-0x0;var _0x25af2d=_0x2aa3[_0x321c50];return _0x25af2d;};'use strict';var EventEmitter=require(_0x32aa('0x0'));var WhatsappAccount=require(_0x32aa('0x1'))['db'][_0x32aa('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x32aa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x32aa('0x4')};function emitEvent(_0x2b754c){return function(_0x13843c,_0x33612d,_0x22e989){WhatsappAccountEvents[_0x32aa('0x5')](_0x2b754c+':'+_0x13843c['id'],_0x13843c);WhatsappAccountEvents['emit'](_0x2b754c,_0x13843c);_0x22e989(null);};}for(var e in events){if(events[_0x32aa('0x6')](e)){var event=events[e];WhatsappAccount[_0x32aa('0x7')](e,emitEvent(event));}}module[_0x32aa('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 9179fc4..0437c3d 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 _0xb16f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xb16f,0x1aa));var _0xfb16=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0xb16f[_0x41e8c4];return _0x54ffbe;};'use strict';var _=require(_0xfb16('0x0'));var util=require(_0xfb16('0x1'));var logger=require(_0xfb16('0x2'))('api');var moment=require(_0xfb16('0x3'));var BPromise=require(_0xfb16('0x4'));var rp=require(_0xfb16('0x5'));var fs=require('fs');var path=require(_0xfb16('0x6'));var rimraf=require(_0xfb16('0x7'));var config=require(_0xfb16('0x8'));var attributes=require(_0xfb16('0x9'));module['exports']=function(_0x1c6344,_0x258a27){return _0x1c6344[_0xfb16('0xa')](_0xfb16('0xb'),attributes,{'tableName':_0xfb16('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c6f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x1c6f,0x1df));var _0xf1c6=function(_0x28fcab,_0x21ef00){_0x28fcab=_0x28fcab-0x0;var _0x253813=_0x1c6f[_0x28fcab];return _0x253813;};'use strict';var _=require(_0xf1c6('0x0'));var util=require(_0xf1c6('0x1'));var logger=require(_0xf1c6('0x2'))(_0xf1c6('0x3'));var moment=require(_0xf1c6('0x4'));var BPromise=require(_0xf1c6('0x5'));var rp=require(_0xf1c6('0x6'));var fs=require('fs');var path=require(_0xf1c6('0x7'));var rimraf=require(_0xf1c6('0x8'));var config=require(_0xf1c6('0x9'));var attributes=require(_0xf1c6('0xa'));module[_0xf1c6('0xb')]=function(_0x437480,_0x40f13e){return _0x437480[_0xf1c6('0xc')](_0xf1c6('0xd'),attributes,{'tableName':_0xf1c6('0xe'),'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 b4d33e6..ff59192 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 _0xf591=['find','options','raw','attributes','map','include','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','localhost','register','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','ShowWhatsappAccount'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf591,0x128));var _0x1f59=function(_0x48271e,_0x6bbc92){_0x48271e=_0x48271e-0x0;var _0x46e817=_0xf591[_0x48271e];return _0x46e817;};'use strict';var _=require(_0x1f59('0x0'));var util=require(_0x1f59('0x1'));var moment=require(_0x1f59('0x2'));var BPromise=require(_0x1f59('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f59('0x4'));var db=require(_0x1f59('0x5'))['db'];var utils=require(_0x1f59('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1f59('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x1f59('0x8')]=_[_0x1f59('0x9')](config[_0x1f59('0x8')],{'host':_0x1f59('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x1f59('0xb')](socket);function respondWithRpcPromise(_0x21d70c,_0x3874a3,_0x28ccbd){return new BPromise(function(_0x43c8ba,_0x224afe){return client['request'](_0x21d70c,_0x28ccbd)[_0x1f59('0xc')](function(_0x1765a6){logger['info'](_0x1f59('0xd'),_0x3874a3,_0x1f59('0xe'));logger[_0x1f59('0xf')](_0x1f59('0x10'),_0x3874a3,_0x1f59('0xe'),JSON[_0x1f59('0x11')](_0x1765a6));if(_0x1765a6['error']){if(_0x1765a6['error'][_0x1f59('0x12')]===0x1f4){logger[_0x1f59('0x13')](_0x1f59('0xd'),_0x3874a3,_0x1765a6[_0x1f59('0x13')][_0x1f59('0x14')]);return _0x224afe(_0x1765a6[_0x1f59('0x13')][_0x1f59('0x14')]);}logger[_0x1f59('0x13')](_0x1f59('0xd'),_0x3874a3,_0x1765a6['error']['message']);return _0x43c8ba(_0x1765a6[_0x1f59('0x13')]['message']);}else{logger[_0x1f59('0x15')](_0x1f59('0xd'),_0x3874a3,_0x1f59('0xe'));_0x43c8ba(_0x1765a6[_0x1f59('0x16')][_0x1f59('0x14')]);}})['catch'](function(_0x2d652e){logger[_0x1f59('0x13')](_0x1f59('0xd'),_0x3874a3,_0x2d652e);_0x224afe(_0x2d652e);});});}exports[_0x1f59('0x17')]=function(_0x4d02d2){var _0x2538c8=this;return new Promise(function(_0x27ad11,_0x3e821e){return db['WhatsappAccount'][_0x1f59('0x18')]({'raw':_0x4d02d2[_0x1f59('0x19')]?_0x4d02d2[_0x1f59('0x19')][_0x1f59('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d02d2[_0x1f59('0x19')]?_0x4d02d2[_0x1f59('0x19')]['where']||null:null,'attributes':_0x4d02d2['options']?_0x4d02d2[_0x1f59('0x19')][_0x1f59('0x1b')]||null:null,'include':_0x4d02d2['options']?_0x4d02d2[_0x1f59('0x19')]['include']?_[_0x1f59('0x1c')](_0x4d02d2['options'][_0x1f59('0x1d')],function(_0x505634){return{'model':db[_0x505634[_0x1f59('0x1e')]],'as':_0x505634['as'],'attributes':_0x505634[_0x1f59('0x1b')],'include':_0x505634[_0x1f59('0x1d')]?_[_0x1f59('0x1c')](_0x505634[_0x1f59('0x1d')],function(_0x15a65d){return{'model':db[_0x15a65d['model']],'as':_0x15a65d['as'],'attributes':_0x15a65d[_0x1f59('0x1b')],'include':_0x15a65d[_0x1f59('0x1d')]?_['map'](_0x15a65d[_0x1f59('0x1d')],function(_0x44951a){return{'model':db[_0x44951a[_0x1f59('0x1e')]],'as':_0x44951a['as'],'attributes':_0x44951a[_0x1f59('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1f59('0xc')](function(_0x296642){logger['info'](_0x1f59('0x17'),_0x4d02d2);logger[_0x1f59('0xf')](_0x1f59('0x17'),_0x4d02d2,JSON['stringify'](_0x296642));_0x27ad11(_0x296642);})[_0x1f59('0x1f')](function(_0x252fc8){logger[_0x1f59('0x13')](_0x1f59('0x17'),_0x252fc8[_0x1f59('0x14')],_0x4d02d2);_0x3e821e(_0x2538c8[_0x1f59('0x13')](0x1f4,_0x252fc8[_0x1f59('0x14')]));});});}; \ No newline at end of file +var _0x5374=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappAccount','options','raw','attributes','include','map','model','then','ShowWhatsappAccount','util','moment'];(function(_0x42341c,_0x2ccc0e){var _0xd44dfe=function(_0x3451c5){while(--_0x3451c5){_0x42341c['push'](_0x42341c['shift']());}};_0xd44dfe(++_0x2ccc0e);}(_0x5374,0xd6));var _0x4537=function(_0x14dde8,_0x34d6ed){_0x14dde8=_0x14dde8-0x0;var _0x3e538d=_0x5374[_0x14dde8];return _0x3e538d;};'use strict';var _=require('lodash');var util=require(_0x4537('0x0'));var moment=require(_0x4537('0x1'));var BPromise=require('bluebird');var rs=require(_0x4537('0x2'));var fs=require('fs');var Redis=require(_0x4537('0x3'));var db=require(_0x4537('0x4'))['db'];var utils=require(_0x4537('0x5'));var logger=require(_0x4537('0x6'))(_0x4537('0x7'));var config=require(_0x4537('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4537('0x9')]['http']({'port':0x232a});config[_0x4537('0xa')]=_[_0x4537('0xb')](config[_0x4537('0xa')],{'host':_0x4537('0xc'),'port':0x18eb});var socket=require(_0x4537('0xd'))(new Redis(config[_0x4537('0xa')]));require(_0x4537('0xe'))[_0x4537('0xf')](socket);function respondWithRpcPromise(_0x337cb2,_0x2a67fc,_0x495c8c){return new BPromise(function(_0x1a57e8,_0x30f6d4){return client[_0x4537('0x10')](_0x337cb2,_0x495c8c)['then'](function(_0x5f5099){logger[_0x4537('0x11')](_0x4537('0x12'),_0x2a67fc,_0x4537('0x13'));logger[_0x4537('0x14')](_0x4537('0x15'),_0x2a67fc,_0x4537('0x13'),JSON['stringify'](_0x5f5099));if(_0x5f5099[_0x4537('0x16')]){if(_0x5f5099[_0x4537('0x16')][_0x4537('0x17')]===0x1f4){logger[_0x4537('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x2a67fc,_0x5f5099[_0x4537('0x16')][_0x4537('0x18')]);return _0x30f6d4(_0x5f5099[_0x4537('0x16')][_0x4537('0x18')]);}logger[_0x4537('0x16')](_0x4537('0x12'),_0x2a67fc,_0x5f5099[_0x4537('0x16')]['message']);return _0x1a57e8(_0x5f5099[_0x4537('0x16')][_0x4537('0x18')]);}else{logger[_0x4537('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x2a67fc,'request\x20sent');_0x1a57e8(_0x5f5099[_0x4537('0x19')]['message']);}})[_0x4537('0x1a')](function(_0x3ee925){logger[_0x4537('0x16')](_0x4537('0x12'),_0x2a67fc,_0x3ee925);_0x30f6d4(_0x3ee925);});});}exports['ShowWhatsappAccount']=function(_0x1a91cc){var _0x5e9e42=this;return new Promise(function(_0x18ede4,_0x78c80e){return db[_0x4537('0x1b')]['find']({'raw':_0x1a91cc['options']?_0x1a91cc[_0x4537('0x1c')][_0x4537('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a91cc[_0x4537('0x1c')]?_0x1a91cc['options']['where']||null:null,'attributes':_0x1a91cc[_0x4537('0x1c')]?_0x1a91cc[_0x4537('0x1c')][_0x4537('0x1e')]||null:null,'include':_0x1a91cc[_0x4537('0x1c')]?_0x1a91cc[_0x4537('0x1c')][_0x4537('0x1f')]?_[_0x4537('0x20')](_0x1a91cc[_0x4537('0x1c')][_0x4537('0x1f')],function(_0x3d3d73){return{'model':db[_0x3d3d73[_0x4537('0x21')]],'as':_0x3d3d73['as'],'attributes':_0x3d3d73[_0x4537('0x1e')],'include':_0x3d3d73['include']?_['map'](_0x3d3d73[_0x4537('0x1f')],function(_0x52670a){return{'model':db[_0x52670a[_0x4537('0x21')]],'as':_0x52670a['as'],'attributes':_0x52670a[_0x4537('0x1e')],'include':_0x52670a[_0x4537('0x1f')]?_['map'](_0x52670a['include'],function(_0x4f01e7){return{'model':db[_0x4f01e7[_0x4537('0x21')]],'as':_0x4f01e7['as'],'attributes':_0x4f01e7[_0x4537('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4537('0x22')](function(_0x487405){logger[_0x4537('0x11')](_0x4537('0x23'),_0x1a91cc);logger[_0x4537('0x14')](_0x4537('0x23'),_0x1a91cc,JSON['stringify'](_0x487405));_0x18ede4(_0x487405);})['catch'](function(_0x1f81cd){logger[_0x4537('0x16')]('ShowWhatsappAccount',_0x1f81cd['message'],_0x1a91cc);_0x78c80e(_0x5e9e42[_0x4537('0x16')](0x1f4,_0x1f81cd[_0x4537('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b9fdf00..4e0853e 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 _0xe28b=['register','length','whatsappAccount:','save','update','emit','removeListener'];(function(_0x1ca4c3,_0x554126){var _0x4426a6=function(_0x11e9b0){while(--_0x11e9b0){_0x1ca4c3['push'](_0x1ca4c3['shift']());}};_0x4426a6(++_0x554126);}(_0xe28b,0x1d1));var _0xbe28=function(_0x59259f,_0x51e8e6){_0x59259f=_0x59259f-0x0;var _0x28e3e8=_0xe28b[_0x59259f];return _0x28e3e8;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xbe28('0x0'),'remove',_0xbe28('0x1')];function createListener(_0x220629,_0x1e2422){return function(_0x538700){_0x1e2422[_0xbe28('0x2')](_0x220629,_0x538700);};}function removeListener(_0x355c72,_0x726b39){return function(){WhatsappAccountEvents[_0xbe28('0x3')](_0x355c72,_0x726b39);};}exports[_0xbe28('0x4')]=function(_0x4b0126){for(var _0x5367d6=0x0,_0x47ce33=events[_0xbe28('0x5')];_0x5367d6<_0x47ce33;_0x5367d6++){var _0x475ec7=events[_0x5367d6];var _0xc2d73=createListener(_0xbe28('0x6')+_0x475ec7,_0x4b0126);WhatsappAccountEvents['on'](_0x475ec7,_0xc2d73);}}; \ No newline at end of file +var _0x8c5d=['save','remove','update','emit','register','whatsappAccount:','./whatsappAccount.events'];(function(_0x1fcafc,_0x3b1977){var _0x47ef45=function(_0x4caf94){while(--_0x4caf94){_0x1fcafc['push'](_0x1fcafc['shift']());}};_0x47ef45(++_0x3b1977);}(_0x8c5d,0x16b));var _0xd8c5=function(_0x5b2568,_0x186e15){_0x5b2568=_0x5b2568-0x0;var _0xa533a9=_0x8c5d[_0x5b2568];return _0xa533a9;};'use strict';var WhatsappAccountEvents=require(_0xd8c5('0x0'));var events=[_0xd8c5('0x1'),_0xd8c5('0x2'),_0xd8c5('0x3')];function createListener(_0x58e3be,_0x189594){return function(_0x28305e){_0x189594[_0xd8c5('0x4')](_0x58e3be,_0x28305e);};}function removeListener(_0x2aee7b,_0x3db51b){return function(){WhatsappAccountEvents['removeListener'](_0x2aee7b,_0x3db51b);};}exports[_0xd8c5('0x5')]=function(_0x194c8f){for(var _0x190105=0x0,_0x172687=events['length'];_0x190105<_0x172687;_0x190105++){var _0x238705=events[_0x190105];var _0x5e4a5e=createListener(_0xd8c5('0x6')+_0x238705,_0x194c8f);WhatsappAccountEvents['on'](_0x238705,_0x5e4a5e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 2e78dfe..4ce7dc2 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 _0x0b74=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x333c29,_0x45d9f9){var _0x21bb55=function(_0x9549a4){while(--_0x9549a4){_0x333c29['push'](_0x333c29['shift']());}};_0x21bb55(++_0x45d9f9);}(_0x0b74,0xe9));var _0x40b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b74[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x40b7('0x0'));var util=require(_0x40b7('0x1'));var path=require(_0x40b7('0x2'));var timeout=require(_0x40b7('0x3'));var express=require(_0x40b7('0x4'));var router=express[_0x40b7('0x5')]();var auth=require(_0x40b7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x40b7('0x7'));var controller=require(_0x40b7('0x8'));router['get']('/',auth[_0x40b7('0x9')](),controller['index']);router[_0x40b7('0xa')](_0x40b7('0xb'),auth[_0x40b7('0x9')](),controller[_0x40b7('0xc')]);router[_0x40b7('0xd')]('/',auth[_0x40b7('0x9')](),controller[_0x40b7('0xe')]);router['put'](_0x40b7('0xb'),auth[_0x40b7('0x9')](),controller[_0x40b7('0xf')]);router[_0x40b7('0x10')](_0x40b7('0xb'),auth[_0x40b7('0x9')](),controller[_0x40b7('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb962=['show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','index','/:id','isAuthenticated'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xb962,0xdf));var _0x2b96=function(_0x4f946c,_0x451b30){_0x4f946c=_0x4f946c-0x0;var _0x59e3ee=_0xb962[_0x4f946c];return _0x59e3ee;};'use strict';var multer=require('multer');var util=require(_0x2b96('0x0'));var path=require(_0x2b96('0x1'));var timeout=require(_0x2b96('0x2'));var express=require(_0x2b96('0x3'));var router=express[_0x2b96('0x4')]();var auth=require(_0x2b96('0x5'));var interaction=require(_0x2b96('0x6'));var config=require('../../config/environment');var controller=require(_0x2b96('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2b96('0x8')]);router['get'](_0x2b96('0x9'),auth[_0x2b96('0xa')](),controller[_0x2b96('0xb')]);router[_0x2b96('0xc')]('/',auth[_0x2b96('0xa')](),controller['create']);router[_0x2b96('0xd')](_0x2b96('0x9'),auth['isAuthenticated'](),controller[_0x2b96('0xe')]);router[_0x2b96('0xf')](_0x2b96('0x9'),auth[_0x2b96('0xa')](),controller[_0x2b96('0x10')]);module[_0x2b96('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index db44ed3..c384bb0 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 _0xfd45=['INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x117d85,_0x43377a){var _0x3edc97=function(_0x57045d){while(--_0x57045d){_0x117d85['push'](_0x117d85['shift']());}};_0x3edc97(++_0x43377a);}(_0xfd45,0x174));var _0x5fd4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xfd45[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x5fd4('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x5fd4('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5fd4('0x2')]()},'description':{'type':Sequelize[_0x5fd4('0x1')]},'interval':{'type':Sequelize[_0x5fd4('0x1')],'defaultValue':_0x5fd4('0x3')}}; \ No newline at end of file +var _0xdaf5=['noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0xaf8ced,_0x4ea0c2){var _0x577776=function(_0x489ac6){while(--_0x489ac6){_0xaf8ced['push'](_0xaf8ced['shift']());}};_0x577776(++_0x4ea0c2);}(_0xdaf5,0xb2));var _0x5daf=function(_0x25dfe3,_0x8699a8){_0x25dfe3=_0x25dfe3-0x0;var _0xa2ea8b=_0xdaf5[_0x25dfe3];return _0xa2ea8b;};'use strict';var Sequelize=require(_0x5daf('0x0'));module[_0x5daf('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5daf('0x2')},'appdata':{'type':Sequelize[_0x5daf('0x3')]()},'description':{'type':Sequelize[_0x5daf('0x4')]},'interval':{'type':Sequelize[_0x5daf('0x4')],'defaultValue':_0x5daf('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 154967c..0e73290 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 _0x74d5=['sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','body','html-pdf','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','error','name','index','map','WhatsappApplication','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x2f6c9f,_0x4c2961){var _0x4f3e98=function(_0x5cf13f){while(--_0x5cf13f){_0x2f6c9f['push'](_0x2f6c9f['shift']());}};_0x4f3e98(++_0x4c2961);}(_0x74d5,0x155));var _0x574d=function(_0x5f8000,_0x4a56b1){_0x5f8000=_0x5f8000-0x0;var _0xc8f261=_0x74d5[_0x5f8000];return _0xc8f261;};'use strict';var pdf=require(_0x574d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x574d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x574d('0x2'));var rp=require('request-promise');var moment=require(_0x574d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x574d('0x4'));var util=require(_0x574d('0x5'));var path=require('path');var sox=require(_0x574d('0x6'));var csv=require(_0x574d('0x7'));var ejs=require(_0x574d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x574d('0x9'));var jsforce=require(_0x574d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x574d('0x7'));var querystring=require(_0x574d('0xb'));var Papa=require(_0x574d('0xc'));var Redis=require('ioredis');var authService=require(_0x574d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x574d('0xe'));var hardwareService=require(_0x574d('0xf'));var logger=require(_0x574d('0x10'))(_0x574d('0x11'));var utils=require('../../config/utils');var config=require(_0x574d('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bb2a9,_0x128d3f){_0x128d3f=_0x128d3f||0xcc;return function(_0x4dc573){if(_0x4dc573){return _0x2bb2a9[_0x574d('0x13')](_0x128d3f);}return _0x2bb2a9[_0x574d('0x14')](_0x128d3f)[_0x574d('0x15')]();};}function respondWithResult(_0x40a217,_0x4267c2){_0x4267c2=_0x4267c2||0xc8;return function(_0x368754){if(_0x368754){return _0x40a217[_0x574d('0x14')](_0x4267c2)[_0x574d('0x16')](_0x368754);}};}function respondWithFilteredResult(_0x211432,_0x2f5ff9){return function(_0xe1d2cb){if(_0xe1d2cb){var _0xd4c60b=_0xe1d2cb[_0x574d('0x17')],_0x2bc4a8=_0x2f5ff9[_0x574d('0x18')],_0x20cc9e=_0x2f5ff9[_0x574d('0x18')]+_0x2f5ff9['limit'],_0x5e0b6f;if(_0x20cc9e>=_0xd4c60b){_0x20cc9e=_0xd4c60b;_0x5e0b6f=0xc8;}else{_0x5e0b6f=0xce;}_0x211432[_0x574d('0x14')](_0x5e0b6f);return _0x211432[_0x574d('0x19')](_0x574d('0x1a'),_0x2bc4a8+'-'+_0x20cc9e+'/'+_0xd4c60b)[_0x574d('0x16')](_0xe1d2cb);}return null;};}function patchUpdates(_0x2a1fa6){return function(_0x2d250d){try{jsonpatch[_0x574d('0x1b')](_0x2d250d,_0x2a1fa6,!![]);}catch(_0x308122){return BPromise['reject'](_0x308122);}return _0x2d250d[_0x574d('0x1c')]();};}function saveUpdates(_0x438266,_0x16a46c){return function(_0x46bdb6){if(_0x46bdb6){return _0x46bdb6[_0x574d('0x1d')](_0x438266)['then'](function(_0x3dc40d){return _0x3dc40d;});}return null;};}function removeEntity(_0x3bc8ce,_0x57b517){return function(_0x18d364){if(_0x18d364){return _0x18d364['destroy']()[_0x574d('0x1e')](function(){_0x3bc8ce['status'](0xcc)[_0x574d('0x15')]();});}};}function handleEntityNotFound(_0x34d52d,_0x2b579c){return function(_0x335918){if(!_0x335918){_0x34d52d[_0x574d('0x13')](0x194);}return _0x335918;};}function handleError(_0x2bef44,_0x29434d){_0x29434d=_0x29434d||0x1f4;return function(_0x4e93c9){logger[_0x574d('0x1f')](_0x4e93c9['stack']);if(_0x4e93c9[_0x574d('0x20')]){delete _0x4e93c9[_0x574d('0x20')];}_0x2bef44[_0x574d('0x14')](_0x29434d)['send'](_0x4e93c9);};}exports[_0x574d('0x21')]=function(_0x561b8b,_0x28139d){var _0x5d49b0={},_0x1699d9={},_0x30aec5={'count':0x0,'rows':[]};var _0x440dd1=_[_0x574d('0x22')](db[_0x574d('0x23')][_0x574d('0x24')],function(_0xc84761){return{'name':_0xc84761['fieldName'],'type':_0xc84761[_0x574d('0x25')]['key']};});_0x1699d9[_0x574d('0x26')]=_[_0x574d('0x22')](_0x440dd1,_0x574d('0x20'));_0x1699d9[_0x574d('0x27')]=_[_0x574d('0x28')](_0x561b8b[_0x574d('0x27')]);_0x1699d9['filters']=_[_0x574d('0x29')](_0x1699d9[_0x574d('0x26')],_0x1699d9[_0x574d('0x27')]);_0x5d49b0[_0x574d('0x2a')]=_['intersection'](_0x1699d9[_0x574d('0x26')],qs['fields'](_0x561b8b['query'][_0x574d('0x2b')]));_0x5d49b0['attributes']=_0x5d49b0[_0x574d('0x2a')][_0x574d('0x2c')]?_0x5d49b0['attributes']:_0x1699d9[_0x574d('0x26')];if(!_0x561b8b['query'][_0x574d('0x2d')](_0x574d('0x2e'))){_0x5d49b0['limit']=qs[_0x574d('0x2f')](_0x561b8b[_0x574d('0x27')]['limit']);_0x5d49b0[_0x574d('0x18')]=qs['offset'](_0x561b8b[_0x574d('0x27')]['offset']);}_0x5d49b0[_0x574d('0x30')]=qs[_0x574d('0x31')](_0x561b8b['query']['sort']);_0x5d49b0[_0x574d('0x32')]=qs['filters'](_[_0x574d('0x33')](_0x561b8b[_0x574d('0x27')],_0x1699d9[_0x574d('0x34')]),_0x440dd1);if(_0x561b8b[_0x574d('0x27')]['filter']){_0x5d49b0['where']=_[_0x574d('0x35')](_0x5d49b0['where'],{'$or':_[_0x574d('0x22')](_0x440dd1,function(_0xb76aeb){if(_0xb76aeb[_0x574d('0x25')]!==_0x574d('0x36')){var _0x128a88={};_0x128a88[_0xb76aeb[_0x574d('0x20')]]={'$like':'%'+_0x561b8b['query'][_0x574d('0x37')]+'%'};return _0x128a88;}})});}_0x5d49b0=_[_0x574d('0x35')]({},_0x5d49b0,_0x561b8b[_0x574d('0x38')]);var _0x3bc31c={'where':_0x5d49b0[_0x574d('0x32')]};return db[_0x574d('0x23')]['count'](_0x3bc31c)[_0x574d('0x1e')](function(_0x2aba30){_0x30aec5[_0x574d('0x17')]=_0x2aba30;if(_0x561b8b[_0x574d('0x27')][_0x574d('0x39')]){_0x5d49b0[_0x574d('0x3a')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x574d('0x3b')](_0x5d49b0);})[_0x574d('0x1e')](function(_0x58742b){_0x30aec5[_0x574d('0x3c')]=_0x58742b;return _0x30aec5;})[_0x574d('0x1e')](respondWithFilteredResult(_0x28139d,_0x5d49b0))[_0x574d('0x3d')](handleError(_0x28139d,null));};exports['show']=function(_0x2a5ce1,_0x270751){var _0x452f01={'raw':!![],'where':{'id':_0x2a5ce1[_0x574d('0x3e')]['id']}},_0x4af145={};_0x4af145['model']=_[_0x574d('0x28')](db['WhatsappApplication']['rawAttributes']);_0x4af145[_0x574d('0x27')]=_[_0x574d('0x28')](_0x2a5ce1[_0x574d('0x27')]);_0x4af145['filters']=_[_0x574d('0x29')](_0x4af145[_0x574d('0x26')],_0x4af145[_0x574d('0x27')]);_0x452f01[_0x574d('0x2a')]=_[_0x574d('0x29')](_0x4af145['model'],qs[_0x574d('0x2b')](_0x2a5ce1[_0x574d('0x27')][_0x574d('0x2b')]));_0x452f01[_0x574d('0x2a')]=_0x452f01[_0x574d('0x2a')][_0x574d('0x2c')]?_0x452f01[_0x574d('0x2a')]:_0x4af145[_0x574d('0x26')];if(_0x2a5ce1[_0x574d('0x27')][_0x574d('0x39')]){_0x452f01[_0x574d('0x3a')]=[{'all':!![]}];}_0x452f01=_[_0x574d('0x35')]({},_0x452f01,_0x2a5ce1[_0x574d('0x38')]);return db['WhatsappApplication'][_0x574d('0x3f')](_0x452f01)[_0x574d('0x1e')](handleEntityNotFound(_0x270751,null))[_0x574d('0x1e')](respondWithResult(_0x270751,null))['catch'](handleError(_0x270751,null));};exports['create']=function(_0x17e8e0,_0x3be952){return db[_0x574d('0x23')]['create'](_0x17e8e0[_0x574d('0x40')],{})[_0x574d('0x1e')](respondWithResult(_0x3be952,0xc9))[_0x574d('0x3d')](handleError(_0x3be952,null));};exports[_0x574d('0x1d')]=function(_0xa4e1e6,_0x596048){if(_0xa4e1e6[_0x574d('0x40')]['id']){delete _0xa4e1e6[_0x574d('0x40')]['id'];}return db[_0x574d('0x23')][_0x574d('0x3f')]({'where':{'id':_0xa4e1e6[_0x574d('0x3e')]['id']}})[_0x574d('0x1e')](handleEntityNotFound(_0x596048,null))[_0x574d('0x1e')](saveUpdates(_0xa4e1e6[_0x574d('0x40')],null))[_0x574d('0x1e')](respondWithResult(_0x596048,null))[_0x574d('0x3d')](handleError(_0x596048,null));};exports['destroy']=function(_0x154eec,_0x4af12c){return db[_0x574d('0x23')]['find']({'where':{'id':_0x154eec[_0x574d('0x3e')]['id']}})[_0x574d('0x1e')](handleEntityNotFound(_0x4af12c,null))['then'](removeEntity(_0x4af12c,null))[_0x574d('0x3d')](handleError(_0x4af12c,null));}; \ No newline at end of file +var _0x8d7a=['crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','find','catch','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel'];(function(_0x3b3211,_0x5ce865){var _0x59b252=function(_0x4563f9){while(--_0x4563f9){_0x3b3211['push'](_0x3b3211['shift']());}};_0x59b252(++_0x5ce865);}(_0x8d7a,0x1bc));var _0xa8d7=function(_0x34fe58,_0x4ce6b6){_0x34fe58=_0x34fe58-0x0;var _0x214dcd=_0x8d7a[_0x34fe58];return _0x214dcd;};'use strict';var pdf=require(_0xa8d7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa8d7('0x1'));var zipdir=require(_0xa8d7('0x2'));var jsonpatch=require(_0xa8d7('0x3'));var rp=require(_0xa8d7('0x4'));var moment=require(_0xa8d7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa8d7('0x6'));var util=require(_0xa8d7('0x7'));var path=require(_0xa8d7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa8d7('0x9'));var fs=require('fs');var _=require(_0xa8d7('0xa'));var squel=require(_0xa8d7('0xb'));var crypto=require(_0xa8d7('0xc'));var jsforce=require(_0xa8d7('0xd'));var deskjs=require(_0xa8d7('0xe'));var toCsv=require(_0xa8d7('0xf'));var querystring=require(_0xa8d7('0x10'));var Papa=require('papaparse');var Redis=require(_0xa8d7('0x11'));var authService=require(_0xa8d7('0x12'));var qs=require(_0xa8d7('0x13'));var as=require(_0xa8d7('0x14'));var hardwareService=require(_0xa8d7('0x15'));var logger=require(_0xa8d7('0x16'))(_0xa8d7('0x17'));var utils=require(_0xa8d7('0x18'));var config=require(_0xa8d7('0x19'));var db=require(_0xa8d7('0x1a'))['db'];function respondWithStatusCode(_0x10a6e4,_0x1ac468){_0x1ac468=_0x1ac468||0xcc;return function(_0x591d55){if(_0x591d55){return _0x10a6e4[_0xa8d7('0x1b')](_0x1ac468);}return _0x10a6e4[_0xa8d7('0x1c')](_0x1ac468)[_0xa8d7('0x1d')]();};}function respondWithResult(_0x3b059e,_0x485fb6){_0x485fb6=_0x485fb6||0xc8;return function(_0x243dc7){if(_0x243dc7){return _0x3b059e[_0xa8d7('0x1c')](_0x485fb6)[_0xa8d7('0x1e')](_0x243dc7);}};}function respondWithFilteredResult(_0x22217f,_0x2acbe2){return function(_0x5c7dd1){if(_0x5c7dd1){var _0x43b4b5=_0x5c7dd1[_0xa8d7('0x1f')],_0x185d11=_0x2acbe2[_0xa8d7('0x20')],_0x107fb9=_0x2acbe2['offset']+_0x2acbe2['limit'],_0x242503;if(_0x107fb9>=_0x43b4b5){_0x107fb9=_0x43b4b5;_0x242503=0xc8;}else{_0x242503=0xce;}_0x22217f['status'](_0x242503);return _0x22217f[_0xa8d7('0x21')](_0xa8d7('0x22'),_0x185d11+'-'+_0x107fb9+'/'+_0x43b4b5)['json'](_0x5c7dd1);}return null;};}function patchUpdates(_0x5a2d8a){return function(_0x1e9079){try{jsonpatch[_0xa8d7('0x23')](_0x1e9079,_0x5a2d8a,!![]);}catch(_0x463205){return BPromise['reject'](_0x463205);}return _0x1e9079[_0xa8d7('0x24')]();};}function saveUpdates(_0xe8d638,_0x27d93a){return function(_0x214e54){if(_0x214e54){return _0x214e54[_0xa8d7('0x25')](_0xe8d638)[_0xa8d7('0x26')](function(_0x4a22c5){return _0x4a22c5;});}return null;};}function removeEntity(_0x2f999c,_0x238aab){return function(_0x2ff88e){if(_0x2ff88e){return _0x2ff88e[_0xa8d7('0x27')]()['then'](function(){_0x2f999c[_0xa8d7('0x1c')](0xcc)[_0xa8d7('0x1d')]();});}};}function handleEntityNotFound(_0xee5df1,_0x3d6cfc){return function(_0x5965b4){if(!_0x5965b4){_0xee5df1[_0xa8d7('0x1b')](0x194);}return _0x5965b4;};}function handleError(_0x2a4367,_0x4d6626){_0x4d6626=_0x4d6626||0x1f4;return function(_0x3ebb42){logger[_0xa8d7('0x28')](_0x3ebb42[_0xa8d7('0x29')]);if(_0x3ebb42[_0xa8d7('0x2a')]){delete _0x3ebb42[_0xa8d7('0x2a')];}_0x2a4367[_0xa8d7('0x1c')](_0x4d6626)[_0xa8d7('0x2b')](_0x3ebb42);};}exports[_0xa8d7('0x2c')]=function(_0xf878ef,_0xe20482){var _0xc9cc3a={},_0x2ae340={},_0xac2c99={'count':0x0,'rows':[]};var _0x3293cb=_['map'](db[_0xa8d7('0x2d')][_0xa8d7('0x2e')],function(_0x4ecee9){return{'name':_0x4ecee9[_0xa8d7('0x2f')],'type':_0x4ecee9[_0xa8d7('0x30')]['key']};});_0x2ae340['model']=_[_0xa8d7('0x31')](_0x3293cb,_0xa8d7('0x2a'));_0x2ae340[_0xa8d7('0x32')]=_[_0xa8d7('0x33')](_0xf878ef[_0xa8d7('0x32')]);_0x2ae340[_0xa8d7('0x34')]=_[_0xa8d7('0x35')](_0x2ae340[_0xa8d7('0x36')],_0x2ae340[_0xa8d7('0x32')]);_0xc9cc3a['attributes']=_['intersection'](_0x2ae340['model'],qs['fields'](_0xf878ef[_0xa8d7('0x32')][_0xa8d7('0x37')]));_0xc9cc3a[_0xa8d7('0x38')]=_0xc9cc3a[_0xa8d7('0x38')][_0xa8d7('0x39')]?_0xc9cc3a[_0xa8d7('0x38')]:_0x2ae340['model'];if(!_0xf878ef[_0xa8d7('0x32')]['hasOwnProperty'](_0xa8d7('0x3a'))){_0xc9cc3a['limit']=qs[_0xa8d7('0x3b')](_0xf878ef[_0xa8d7('0x32')][_0xa8d7('0x3b')]);_0xc9cc3a['offset']=qs[_0xa8d7('0x20')](_0xf878ef[_0xa8d7('0x32')][_0xa8d7('0x20')]);}_0xc9cc3a[_0xa8d7('0x3c')]=qs[_0xa8d7('0x3d')](_0xf878ef[_0xa8d7('0x32')][_0xa8d7('0x3d')]);_0xc9cc3a[_0xa8d7('0x3e')]=qs[_0xa8d7('0x34')](_[_0xa8d7('0x3f')](_0xf878ef[_0xa8d7('0x32')],_0x2ae340['filters']),_0x3293cb);if(_0xf878ef[_0xa8d7('0x32')][_0xa8d7('0x40')]){_0xc9cc3a['where']=_[_0xa8d7('0x41')](_0xc9cc3a[_0xa8d7('0x3e')],{'$or':_['map'](_0x3293cb,function(_0x2a5d98){if(_0x2a5d98[_0xa8d7('0x30')]!==_0xa8d7('0x42')){var _0x19f5b7={};_0x19f5b7[_0x2a5d98[_0xa8d7('0x2a')]]={'$like':'%'+_0xf878ef[_0xa8d7('0x32')][_0xa8d7('0x40')]+'%'};return _0x19f5b7;}})});}_0xc9cc3a=_[_0xa8d7('0x41')]({},_0xc9cc3a,_0xf878ef[_0xa8d7('0x43')]);var _0x391540={'where':_0xc9cc3a['where']};return db[_0xa8d7('0x2d')][_0xa8d7('0x1f')](_0x391540)[_0xa8d7('0x26')](function(_0x466166){_0xac2c99[_0xa8d7('0x1f')]=_0x466166;if(_0xf878ef[_0xa8d7('0x32')][_0xa8d7('0x44')]){_0xc9cc3a[_0xa8d7('0x45')]=[{'all':!![]}];}return db[_0xa8d7('0x2d')]['findAll'](_0xc9cc3a);})[_0xa8d7('0x26')](function(_0x1b8e28){_0xac2c99[_0xa8d7('0x46')]=_0x1b8e28;return _0xac2c99;})[_0xa8d7('0x26')](respondWithFilteredResult(_0xe20482,_0xc9cc3a))['catch'](handleError(_0xe20482,null));};exports['show']=function(_0x453061,_0xd9b81b){var _0x34cb00={'raw':!![],'where':{'id':_0x453061['params']['id']}},_0x4b321e={};_0x4b321e['model']=_[_0xa8d7('0x33')](db[_0xa8d7('0x2d')]['rawAttributes']);_0x4b321e[_0xa8d7('0x32')]=_['keys'](_0x453061[_0xa8d7('0x32')]);_0x4b321e['filters']=_[_0xa8d7('0x35')](_0x4b321e['model'],_0x4b321e[_0xa8d7('0x32')]);_0x34cb00[_0xa8d7('0x38')]=_[_0xa8d7('0x35')](_0x4b321e['model'],qs[_0xa8d7('0x37')](_0x453061['query'][_0xa8d7('0x37')]));_0x34cb00[_0xa8d7('0x38')]=_0x34cb00['attributes'][_0xa8d7('0x39')]?_0x34cb00[_0xa8d7('0x38')]:_0x4b321e[_0xa8d7('0x36')];if(_0x453061[_0xa8d7('0x32')][_0xa8d7('0x44')]){_0x34cb00['include']=[{'all':!![]}];}_0x34cb00=_[_0xa8d7('0x41')]({},_0x34cb00,_0x453061[_0xa8d7('0x43')]);return db[_0xa8d7('0x2d')][_0xa8d7('0x47')](_0x34cb00)['then'](handleEntityNotFound(_0xd9b81b,null))[_0xa8d7('0x26')](respondWithResult(_0xd9b81b,null))[_0xa8d7('0x48')](handleError(_0xd9b81b,null));};exports['create']=function(_0x211c8a,_0x24136b){return db[_0xa8d7('0x2d')][_0xa8d7('0x49')](_0x211c8a[_0xa8d7('0x4a')],{})[_0xa8d7('0x26')](respondWithResult(_0x24136b,0xc9))[_0xa8d7('0x48')](handleError(_0x24136b,null));};exports['update']=function(_0x2c7093,_0x7753a9){if(_0x2c7093[_0xa8d7('0x4a')]['id']){delete _0x2c7093[_0xa8d7('0x4a')]['id'];}return db[_0xa8d7('0x2d')][_0xa8d7('0x47')]({'where':{'id':_0x2c7093[_0xa8d7('0x4b')]['id']}})[_0xa8d7('0x26')](handleEntityNotFound(_0x7753a9,null))[_0xa8d7('0x26')](saveUpdates(_0x2c7093['body'],null))[_0xa8d7('0x26')](respondWithResult(_0x7753a9,null))[_0xa8d7('0x48')](handleError(_0x7753a9,null));};exports['destroy']=function(_0x3b1a65,_0x3845a5){return db['WhatsappApplication']['find']({'where':{'id':_0x3b1a65[_0xa8d7('0x4b')]['id']}})[_0xa8d7('0x26')](handleEntityNotFound(_0x3845a5,null))[_0xa8d7('0x26')](removeEntity(_0x3845a5,null))[_0xa8d7('0x48')](handleError(_0x3845a5,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 4bce1b5..1327e10 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 _0x9ebd=['api','bluebird','request-promise','path','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x58a94b,_0x415cfa){var _0x5e2c57=function(_0x11f6e5){while(--_0x11f6e5){_0x58a94b['push'](_0x58a94b['shift']());}};_0x5e2c57(++_0x415cfa);}(_0x9ebd,0x8e));var _0xd9eb=function(_0x3c1f5a,_0x63db66){_0x3c1f5a=_0x3c1f5a-0x0;var _0x1d396b=_0x9ebd[_0x3c1f5a];return _0x1d396b;};'use strict';var _=require('lodash');var util=require(_0xd9eb('0x0'));var logger=require(_0xd9eb('0x1'))(_0xd9eb('0x2'));var moment=require('moment');var BPromise=require(_0xd9eb('0x3'));var rp=require(_0xd9eb('0x4'));var fs=require('fs');var path=require(_0xd9eb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module[_0xd9eb('0x6')]=function(_0x465994,_0x13841f){return _0x465994[_0xd9eb('0x7')](_0xd9eb('0x8'),attributes,{'tableName':_0xd9eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9eb('0xa'),'collate':_0xd9eb('0xb')});}; \ No newline at end of file +var _0x2dc8=['../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5233b7,_0x141432){var _0x5c129c=function(_0x1dbaa5){while(--_0x1dbaa5){_0x5233b7['push'](_0x5233b7['shift']());}};_0x5c129c(++_0x141432);}(_0x2dc8,0x1b2));var _0x82dc=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0x2dc8[_0xc7348b];return _0x307cec;};'use strict';var _=require('lodash');var util=require(_0x82dc('0x0'));var logger=require(_0x82dc('0x1'))('api');var moment=require(_0x82dc('0x2'));var BPromise=require(_0x82dc('0x3'));var rp=require(_0x82dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82dc('0x5'));var config=require(_0x82dc('0x6'));var attributes=require(_0x82dc('0x7'));module['exports']=function(_0x3a9ad4,_0xe6489e){return _0x3a9ad4[_0x82dc('0x8')](_0x82dc('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x82dc('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 182b7c0..ed7b914 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 _0x84e7=['code','WhatsappApplication,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x84e7,0x122));var _0x784e=function(_0x1aeded,_0x5b6833){_0x1aeded=_0x1aeded-0x0;var _0x731d22=_0x84e7[_0x1aeded];return _0x731d22;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var moment=require(_0x784e('0x1'));var BPromise=require('bluebird');var rs=require(_0x784e('0x2'));var fs=require('fs');var Redis=require(_0x784e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x784e('0x4'));var logger=require(_0x784e('0x5'))(_0x784e('0x6'));var config=require(_0x784e('0x7'));var jayson=require(_0x784e('0x8'));var client=jayson[_0x784e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cbdd1,_0x5d5595,_0xfaa170){return new BPromise(function(_0x24654d,_0x59a97d){return client[_0x784e('0xa')](_0x3cbdd1,_0xfaa170)[_0x784e('0xb')](function(_0x237b5e){logger[_0x784e('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x5d5595,'request\x20sent');logger[_0x784e('0xd')](_0x784e('0xe'),_0x5d5595,_0x784e('0xf'),JSON[_0x784e('0x10')](_0x237b5e));if(_0x237b5e['error']){if(_0x237b5e[_0x784e('0x11')][_0x784e('0x12')]===0x1f4){logger[_0x784e('0x11')](_0x784e('0x13'),_0x5d5595,_0x237b5e[_0x784e('0x11')][_0x784e('0x14')]);return _0x59a97d(_0x237b5e['error'][_0x784e('0x14')]);}logger['error'](_0x784e('0x13'),_0x5d5595,_0x237b5e[_0x784e('0x11')][_0x784e('0x14')]);return _0x24654d(_0x237b5e[_0x784e('0x11')][_0x784e('0x14')]);}else{logger[_0x784e('0xc')](_0x784e('0x13'),_0x5d5595,_0x784e('0xf'));_0x24654d(_0x237b5e[_0x784e('0x15')]['message']);}})['catch'](function(_0x112ba1){logger[_0x784e('0x11')](_0x784e('0x13'),_0x5d5595,_0x112ba1);_0x59a97d(_0x112ba1);});});} \ No newline at end of file +var _0xbd51=['WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x245023,_0x3dd835){_0x245023=_0x245023-0x0;var _0x3f4fe3=_0xbd51[_0x245023];return _0x3f4fe3;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ddc6955..2b9246c 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 _0x1138=['path','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','index','/describe','describe','/:id','show','/:id/messages','isAuthenticated','getMessages','download','post','/:id/tags','whatsapp','addTags','tracked','delete','destroy','removeTags','util'];(function(_0x28acbc,_0x4afde0){var _0x34f0da=function(_0x4a2949){while(--_0x4a2949){_0x28acbc['push'](_0x28acbc['shift']());}};_0x34f0da(++_0x4afde0);}(_0x1138,0x8f));var _0x8113=function(_0x1840c1,_0x217972){_0x1840c1=_0x1840c1-0x0;var _0x4587b0=_0x1138[_0x1840c1];return _0x4587b0;};'use strict';var multer=require('multer');var util=require(_0x8113('0x0'));var path=require(_0x8113('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8113('0x2')]();var auth=require(_0x8113('0x3'));var interaction=require(_0x8113('0x4'));var config=require('../../config/environment');var controller=require(_0x8113('0x5'));router[_0x8113('0x6')]('/',auth['isAuthenticated'](),controller[_0x8113('0x7')]);router[_0x8113('0x6')](_0x8113('0x8'),auth['isAuthenticated'](),controller[_0x8113('0x9')]);router[_0x8113('0x6')](_0x8113('0xa'),auth['isAuthenticated'](),controller[_0x8113('0xb')]);router[_0x8113('0x6')](_0x8113('0xc'),auth[_0x8113('0xd')](),controller[_0x8113('0xe')]);router['get']('/:id/download',auth[_0x8113('0xd')](),controller[_0x8113('0xf')]);router['post']('/',auth[_0x8113('0xd')](),controller['create']);router['post'](_0x8113('0xc'),auth[_0x8113('0xd')](),controller['addMessage']);router[_0x8113('0x10')](_0x8113('0x11'),auth[_0x8113('0xd')](),interaction['tracked'](_0x8113('0x12'),'whatsappinteraction:addtags'),controller[_0x8113('0x13')]);router['put']('/:id',auth[_0x8113('0xd')](),interaction[_0x8113('0x14')](_0x8113('0x12'),'whatsappinteraction:update'),controller['update']);router[_0x8113('0x15')](_0x8113('0xa'),auth[_0x8113('0xd')](),interaction[_0x8113('0x14')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8113('0x16')]);router[_0x8113('0x15')](_0x8113('0x11'),auth[_0x8113('0xd')](),controller[_0x8113('0x17')]);module['exports']=router; \ No newline at end of file +var _0x1989=['post','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','tracked','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','addMessage'];(function(_0x5b7a24,_0x37c41c){var _0x88be99=function(_0x12b2f9){while(--_0x12b2f9){_0x5b7a24['push'](_0x5b7a24['shift']());}};_0x88be99(++_0x37c41c);}(_0x1989,0x119));var _0x9198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1989[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9198('0x0'));var util=require(_0x9198('0x1'));var path=require(_0x9198('0x2'));var timeout=require(_0x9198('0x3'));var express=require(_0x9198('0x4'));var router=express[_0x9198('0x5')]();var auth=require(_0x9198('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9198('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x9198('0x8')]('/',auth[_0x9198('0x9')](),controller[_0x9198('0xa')]);router[_0x9198('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9198('0xb')]);router[_0x9198('0x8')](_0x9198('0xc'),auth[_0x9198('0x9')](),controller[_0x9198('0xd')]);router[_0x9198('0x8')](_0x9198('0xe'),auth[_0x9198('0x9')](),controller[_0x9198('0xf')]);router[_0x9198('0x8')](_0x9198('0x10'),auth[_0x9198('0x9')](),controller[_0x9198('0x11')]);router['post']('/',auth[_0x9198('0x9')](),controller['create']);router['post'](_0x9198('0xe'),auth[_0x9198('0x9')](),controller[_0x9198('0x12')]);router[_0x9198('0x13')](_0x9198('0x14'),auth[_0x9198('0x9')](),interaction['tracked'](_0x9198('0x15'),_0x9198('0x16')),controller[_0x9198('0x17')]);router['put'](_0x9198('0xc'),auth['isAuthenticated'](),interaction[_0x9198('0x18')](_0x9198('0x15'),'whatsappinteraction:update'),controller['update']);router[_0x9198('0x19')](_0x9198('0xc'),auth[_0x9198('0x9')](),interaction[_0x9198('0x18')](_0x9198('0x15'),_0x9198('0x1a')),controller[_0x9198('0x1b')]);router[_0x9198('0x19')](_0x9198('0x14'),auth[_0x9198('0x9')](),controller[_0x9198('0x1c')]);module[_0x9198('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1a19012..2e04201 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 _0x1a4c=['STRING','out','ENUM','sequelize','BOOLEAN','DATE'];(function(_0x2110aa,_0x413d31){var _0x560588=function(_0x54a8d0){while(--_0x54a8d0){_0x2110aa['push'](_0x2110aa['shift']());}};_0x560588(++_0x413d31);}(_0x1a4c,0x19b));var _0xc1a4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1a4c[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xc1a4('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xc1a4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc1a4('0x2')]},'disposition':{'type':Sequelize[_0xc1a4('0x3')]},'note':{'type':Sequelize[_0xc1a4('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc1a4('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc1a4('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc1a4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc1a4('0x5')]('in',_0xc1a4('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xdbb3=['out','sequelize','moment','exports','DATE','STRING','ENUM'];(function(_0x4b1f8b,_0x249bd9){var _0x1a310e=function(_0xc2b8cc){while(--_0xc2b8cc){_0x4b1f8b['push'](_0x4b1f8b['shift']());}};_0x1a310e(++_0x249bd9);}(_0xdbb3,0x1d6));var _0x3dbb=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xdbb3[_0x6cf19c];return _0xce14f3;};'use strict';var Sequelize=require(_0x3dbb('0x0'));var moment=require(_0x3dbb('0x1'));module[_0x3dbb('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3dbb('0x3')]},'disposition':{'type':Sequelize[_0x3dbb('0x4')]},'note':{'type':Sequelize[_0x3dbb('0x4')]},'phone':{'type':Sequelize[_0x3dbb('0x4')]},'read1stAt':{'type':Sequelize[_0x3dbb('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3dbb('0x5')]('in',_0x3dbb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3dbb('0x5')]('in',_0x3dbb('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index d475152..3495866 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 _0x814b=['index','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','toString','count','sequelize','fields','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','WhatsappInteraction','includeAll','merge','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','existsSync','basename','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','TagIds','split','forEach','push','catch'];(function(_0x201a28,_0x148ab0){var _0xaf2d6e=function(_0x4fd6fb){while(--_0x4fd6fb){_0x201a28['push'](_0x201a28['shift']());}};_0xaf2d6e(++_0x148ab0);}(_0x814b,0x1a2));var _0xb814=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x814b[_0xd67723];return _0x53b62b;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];config[_0xb814('0x1a')]=_[_0xb814('0x1b')](config[_0xb814('0x1a')],{'host':_0xb814('0x1c'),'port':0x18eb});var socket=require(_0xb814('0x1d'))(new Redis(config[_0xb814('0x1a')]));require(_0xb814('0x1e'))[_0xb814('0x1f')](socket);function respondWithStatusCode(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xcc;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x20')](_0x3f4881);}return _0x2ab627[_0xb814('0x21')](_0x3f4881)[_0xb814('0x22')]();};}function respondWithResult(_0x3a71d6,_0x45e0d0){_0x45e0d0=_0x45e0d0||0xc8;return function(_0x265a83){if(_0x265a83){return _0x3a71d6[_0xb814('0x21')](_0x45e0d0)[_0xb814('0x23')](_0x265a83);}};}function respondWithFilteredResult(_0x7a21ef,_0x48c9df){return function(_0x168a48){if(_0x168a48){var _0x55ba16=_0x168a48['count'],_0x270598=_0x48c9df['offset'],_0xfac75b=_0x48c9df[_0xb814('0x24')]+_0x48c9df['limit'],_0x4c3007;if(_0xfac75b>=_0x55ba16){_0xfac75b=_0x55ba16;_0x4c3007=0xc8;}else{_0x4c3007=0xce;}_0x7a21ef['status'](_0x4c3007);return _0x7a21ef[_0xb814('0x25')](_0xb814('0x26'),_0x270598+'-'+_0xfac75b+'/'+_0x55ba16)[_0xb814('0x23')](_0x168a48);}return null;};}function patchUpdates(_0x4e139e){return function(_0xf5b8aa){try{jsonpatch['apply'](_0xf5b8aa,_0x4e139e,!![]);}catch(_0x1e6393){return BPromise[_0xb814('0x27')](_0x1e6393);}return _0xf5b8aa[_0xb814('0x28')]();};}function saveUpdates(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x29')](_0x470e81)['then'](function(_0x2ead86){return _0x2ead86;});}return null;};}function removeEntity(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(_0x457dac){return _0x457dac[_0xb814('0x2a')]()[_0xb814('0x2b')](function(){_0x52b7a3[_0xb814('0x21')](0xcc)[_0xb814('0x22')]();});}};}function handleEntityNotFound(_0x3d836c,_0x5755ea){return function(_0x392222){if(!_0x392222){_0x3d836c[_0xb814('0x20')](0x194);}return _0x392222;};}function handleError(_0x1c2625,_0x349394){_0x349394=_0x349394||0x1f4;return function(_0x32ed56){logger[_0xb814('0x2c')](_0x32ed56[_0xb814('0x2d')]);if(_0x32ed56[_0xb814('0x2e')]){delete _0x32ed56['name'];}_0x1c2625[_0xb814('0x21')](_0x349394)[_0xb814('0x2f')](_0x32ed56);};}function getInteractionUsers(_0x52ed64,_0x9008b2){return new BPromise(function(_0x37d24d,_0x530744){try{if(_0x9008b2[_0x52ed64['id']]){_0x52ed64['Users']=_[_0xb814('0x30')](_0x9008b2[_0x52ed64['id']],function(_0x2051d0){return{'id':_0x2051d0['id'],'fullname':_0x2051d0['fullname']};});}}catch(_0x338a28){_0x530744(_0x338a28);}_0x37d24d(_0x52ed64);});}function getInteractionTags(_0x526610,_0x6efe9a){return new BPromise(function(_0x5f3e9b,_0x4cfc58){try{if(_0x526610[_0xb814('0x31')]){_0x526610['Tags']=[];_0x526610[_0xb814('0x31')][_0xb814('0x32')](',')[_0xb814('0x33')](function(_0x599f9f){_0x526610['Tags'][_0xb814('0x34')](_0x6efe9a[_0x599f9f]);});}delete _0x526610[_0xb814('0x31')];}catch(_0x523566){_0x4cfc58(_0x523566);}_0x5f3e9b(_0x526610);});}function updateWhatsappInteraction(_0x2c8943,_0xe558d5,_0x692c72){return new BPromise(function(_0x217b7e,_0x1b78de){return getInteractionUsers(_0x2c8943,_0x692c72)[_0xb814('0x2b')](function(_0x3672f3){return getInteractionTags(_0x3672f3,_0xe558d5);})['then'](function(_0x3207ec){_0x217b7e(_0x3207ec);})[_0xb814('0x35')](function(_0x30de5a){_0x1b78de(_0x30de5a);});});}exports[_0xb814('0x36')]=function(_0x14100d,_0x4ff31a){var _0x16ef82={},_0x57e6e6={},_0x43db67={'count':0x0,'rows':[]};var _0x16e21c=_[_0xb814('0x30')](db['WhatsappInteraction'][_0xb814('0x37')],function(_0xbdb3e9){return{'name':_0xbdb3e9['fieldName'],'type':_0xbdb3e9[_0xb814('0x38')][_0xb814('0x39')]};});_0x57e6e6[_0xb814('0x3a')]=_[_0xb814('0x30')](_0x16e21c,_0xb814('0x2e'));_0x57e6e6[_0xb814('0x3b')]=_['keys'](_0x14100d[_0xb814('0x3b')]);_0x57e6e6['filters']=_[_0xb814('0x3c')](_0x57e6e6['model'],_0x57e6e6[_0xb814('0x3b')]);_0x16ef82['attributes']=_[_0xb814('0x3c')](_0x57e6e6[_0xb814('0x3a')],qs['fields'](_0x14100d['query']['fields']));_0x16ef82['attributes']=_0x16ef82[_0xb814('0x3d')][_0xb814('0x3e')]?_0x16ef82[_0xb814('0x3d')]:_0x57e6e6[_0xb814('0x3a')];if(!_0x14100d['query']['hasOwnProperty'](_0xb814('0x3f'))){_0x16ef82['limit']=qs[_0xb814('0x40')](_0x14100d[_0xb814('0x3b')][_0xb814('0x40')]);_0x16ef82[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x14100d[_0xb814('0x3b')][_0xb814('0x24')]);}_0x16ef82[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x14100d['query']['sort']);_0x16ef82['where']=qs[_0xb814('0x43')](_['pick'](_0x14100d[_0xb814('0x3b')],_0x57e6e6['filters']),_0x16e21c);var _0x411723=[];var _0x44ff56=squel[_0xb814('0x44')]()[_0xb814('0x45')]('id')['field'](_0xb814('0x2e'))[_0xb814('0x45')](_0xb814('0x46'))[_0xb814('0x47')](_0xb814('0x48'));var _0x450a08=squel['select']()[_0xb814('0x45')](_0xb814('0x49'))[_0xb814('0x45')](_0xb814('0x4a'))[_0xb814('0x45')](_0xb814('0x4b'))[_0xb814('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xb814('0x4c'),'u',_0xb814('0x4d'));var _0x4c08d6=squel[_0xb814('0x44')]()[_0xb814('0x47')](_0xb814('0x4e'),'i')[_0xb814('0x4f')](_0xb814('0x50'),'c',_0xb814('0x51'))[_0xb814('0x4f')](_0xb814('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xb814('0x4f')](_0xb814('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb814('0x4f')]('whatsapp_messages','me',_0xb814('0x53'))[_0xb814('0x4f')](_0xb814('0x54'),'it',_0xb814('0x55'))[_0xb814('0x4f')](_0xb814('0x48'),'t',_0xb814('0x56'));var _0x45480e=squel[_0xb814('0x57')]();var _0x2a422a=[];var _0x5e6df7=squel['expr']();var _0x32eca6;if(_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]){_0x32eca6=as[_0xb814('0x59')](_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]);var _0x135208=_0x32eca6['sqlOperator'];for(var _0x26fd0b=0x0;_0x26fd0b<_0x32eca6[_0xb814('0x5a')][_0xb814('0x3e')];_0x26fd0b++){var _0x5a916d=_0x32eca6[_0xb814('0x5a')][_0x26fd0b];var _0x4e6f3c='i';var _0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),_0x5a916d[_0xb814('0x45')]]);if(!_0x252293){switch(_0x5a916d['field']){case _0xb814('0x5b'):if(_0x5a916d[_0xb814('0x5c')]==0x1){_0x4c08d6[_0xb814('0x5d')]('`'+_0x5a916d['field']+_0xb814('0x5e'));}else{_0x4c08d6['having']('`'+_0x5a916d[_0xb814('0x45')]+_0xb814('0x5f'));}break;case'Contact':if(_0x5a916d[_0xb814('0x60')]==='$substring'){if(_0x5a916d['value'][_0xb814('0x32')]('\x20')[_0xb814('0x3e')]>0x1){_0x45480e[_0x135208](_0xb814('0x61'),qs['getFullTextValue'](_0x5a916d[_0xb814('0x5c')]),null);}else{var _0x538b0f='%'+_0x5a916d[_0xb814('0x5c')]+'%';_0x45480e[_0x135208](_0xb814('0x62'),_0x538b0f,_0x538b0f,_0x538b0f);}}else{_0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),'ContactId']);_0x5a916d[_0xb814('0x45')]=_0xb814('0x63');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x67'):var _0x5441c5=_0x5a916d['value'][_0xb814('0x32')](',')[_0xb814('0x30')](function(_0x4d13db){return Number(_0x4d13db);});_0x5441c5[_0xb814('0x33')](function(_0x58b9a6){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58b9a6+',%');});_0x2a422a=_[_0xb814('0x68')](_0x2a422a,_0x5441c5);break;case'User':if(_0x5a916d[_0xb814('0x60')]===_0xb814('0x69')){_0x45480e[_0x135208](_0xb814('0x6a'),'%'+_0x5a916d['value']+'%',null);}else{_0x252293=_[_0xb814('0x6b')](_0x16e21c,['name',_0xb814('0x6c')]);_0x5a916d[_0xb814('0x45')]=_0xb814('0x6c');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x6d'):_0x135e13=as[_0xb814('0x64')]('me',null,_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);break;}}else{var _0x135e13=as['buildExpression'](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')]['start'],_0x135e13[_0xb814('0x5c')]['end']);}}}else{var _0x37e9c5=_(_0x14100d['query'])[_0xb814('0x6e')]()[_0xb814('0x30')](function(_0xa03cd2){return _[_0xb814('0x6f')](_0x16e21c,[_0xb814('0x2e'),_0xa03cd2])?_0xa03cd2:undefined;})[_0xb814('0x70')]()[_0xb814('0x5c')]();if(!_['isEmpty'](_0x37e9c5)){_0x37e9c5[_0xb814('0x33')](function(_0x51ca51){if(_0x51ca51===_0xb814('0x71')){_0x4c08d6[_0xb814('0x72')](_0xb814('0x73'),[][_0xb814('0x74')](_0x14100d[_0xb814('0x3b')][_0x51ca51]));}else if(_0x51ca51===_0xb814('0x75')){var _0x514dab=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])['$gte'];var _0x3bb2b4=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])[_0xb814('0x77')];_0x4c08d6[_0xb814('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514dab,_0x3bb2b4);}else{if(_0x14100d[_0xb814('0x3b')][_0x51ca51]==='null'){_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x78'));}else{_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x79'),_0x14100d[_0xb814('0x3b')][_0x51ca51]);}}});}if(_0x14100d[_0xb814('0x3b')]['read']){if(_0x14100d['query']['read']==0x1){_0x4c08d6[_0xb814('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4c08d6[_0xb814('0x5d')](_0xb814('0x7a'));}}if(_0x14100d[_0xb814('0x3b')]['tag']){_0x2a422a=_[_0xb814('0x7b')](_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')])?_0x14100d['query'][_0xb814('0x7c')]:new Array(_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')]);_0x2a422a[_0xb814('0x33')](function(_0x555be0){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555be0+',%');});}if(_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')]){var _0x39863d=_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')][_0xb814('0x7e')]('\x5c','\x5c\x5c')[_0xb814('0x7e')]('\x27\x27',_0xb814('0x7f'));if(qs[_0xb814('0x80')](_0x39863d)){_0x45480e['or'](_0xb814('0x81'),_0x39863d+'%')['or'](_0xb814('0x82'),_0x39863d+'%');}else{_0x45480e['or'](_0xb814('0x83'),qs[_0xb814('0x84')](_0x39863d))['or'](_0xb814('0x85'),_0x39863d+'%');}}}_0x4c08d6[_0xb814('0x72')](_0x45480e);_0x4c08d6['group'](_0xb814('0x86'));var _0x33cfc4={'type':db[_0xb814('0x87')][_0xb814('0x88')][_0xb814('0x89')],'raw':!![]};var _0x283b0f=_0x4c08d6['clone']();_0x283b0f[_0xb814('0x45')]('i.id');_0x283b0f[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));if(_0x16ef82[_0xb814('0x41')]){_0x16ef82[_0xb814('0x41')]['forEach'](function(_0x4c44ee){_0x4c08d6[_0xb814('0x41')]('i.'+_0x4c44ee[0x0],_0x4c44ee[0x1]===_0xb814('0x8b')?![]:!![]);});}if(!_[_0xb814('0x8c')](_0x2a422a)){_0x4c08d6[_0xb814('0x5d')](_0x5e6df7);_0x283b0f['where'](_0xb814('0x8d'),_0x2a422a);}BPromise['resolve']()[_0xb814('0x2b')](function(){if(!_0x32eca6){if(_0x14100d[_0xb814('0x3b')]['WhatsappAccountId']||_0x14100d['query'][_0xb814('0x8e')])return;_0x283b0f['where'](_0xb814('0x8f'));_0x4c08d6[_0xb814('0x72')](_0xb814('0x8f'));return;}return _0x14100d[_0xb814('0x90')][_0xb814('0x91')]({'attributes':['id'],'raw':!![]})[_0xb814('0x2b')](function(_0x40fe4a){if(_['isEmpty'](_0x40fe4a)){_0x283b0f[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x283b0f[_0xb814('0x72')](_0xb814('0x73'),_['map'](_0x40fe4a,'id'));_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb814('0x30')](_0x40fe4a,'id'));}});})[_0xb814('0x2b')](function(){db['sequelize']['query'](_0x283b0f[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x3309c5){_0x43db67[_0xb814('0x93')]=_0x3309c5[_0xb814('0x3e')];if(_0x43db67[_0xb814('0x93')]===0x0)return[];return db[_0xb814('0x94')][_0xb814('0x3b')](_0x44ff56[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x53e705){_0x411723=_['keyBy'](_0x53e705,'id');_0x33cfc4=_['merge'](_0x33cfc4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14100d['query'][_0xb814('0x95')]){_0x16ef82[_0xb814('0x3d')][_0xb814('0x33')](function(_0x59f3ff){_0x4c08d6[_0xb814('0x45')]('i.'+_0x59f3ff);});}else{_0x4c08d6[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x96'),_0xb814('0x97'));_0x4c08d6[_0xb814('0x45')]('a.mandatoryDisposition',_0xb814('0x98'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x99'));_0x4c08d6[_0xb814('0x45')]('c.firstName',_0xb814('0x9a'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x9b'),_0xb814('0x9c'));_0x4c08d6[_0xb814('0x45')]('c.email','Contact.email');_0x4c08d6[_0xb814('0x45')]('c.phone',_0xb814('0x9d'));_0x4c08d6[_0xb814('0x45')]('c.mobile',_0xb814('0x9e'));_0x4c08d6['field'](_0xb814('0x9f'),'Contact.fax');_0x4c08d6[_0xb814('0x45')](_0xb814('0xa0'),_0xb814('0xa1'));_0x4c08d6[_0xb814('0x45')](_0xb814('0xa2'),_0xb814('0xa3'));_0x4c08d6[_0xb814('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16ef82[_0xb814('0x40')])_0x4c08d6['limit'](_0x16ef82['limit']);if(_0x16ef82[_0xb814('0x24')])_0x4c08d6[_0xb814('0x24')](_0x16ef82[_0xb814('0x24')]);return db['sequelize'][_0xb814('0x3b')](_0x4c08d6['toString'](),_0x33cfc4);})[_0xb814('0x2b')](function(_0x19d508){_0x450a08[_0xb814('0x72')](_0xb814('0xa4'),_['map'](_0x19d508,'id'));return db[_0xb814('0x94')][_0xb814('0x3b')](_0x450a08[_0xb814('0x92')](),_0x33cfc4)['then'](function(_0x1ebbf6){var _0x3fc77d=_[_0xb814('0xa5')](_0x1ebbf6,'WhatsappInteractionId');var _0x5d8626=[];_0x19d508[_0xb814('0x33')](function(_0x9dc06b){_0x5d8626[_0xb814('0x34')](updateWhatsappInteraction(_0x9dc06b,_0x411723,_0x3fc77d));});return BPromise[_0xb814('0xa6')](_0x5d8626);});});})[_0xb814('0x2b')](function(_0x37a7ab){_0x43db67[_0xb814('0xa7')]=_0x37a7ab;return _0x43db67;})[_0xb814('0x2b')](respondWithFilteredResult(_0x4ff31a,_0x16ef82));})[_0xb814('0x35')](handleError(_0x4ff31a,null));};exports[_0xb814('0xa8')]=function(_0x2569a5,_0x2a13fb){var _0x5b8d2e={'raw':![],'where':{'id':_0x2569a5[_0xb814('0xa9')]['id']}},_0x5416dc={};_0x5416dc['model']=_[_0xb814('0x6e')](db[_0xb814('0xaa')][_0xb814('0x37')]);_0x5416dc[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x2569a5[_0xb814('0x3b')]);_0x5416dc[_0xb814('0x43')]=_['intersection'](_0x5416dc['model'],_0x5416dc[_0xb814('0x3b')]);_0x5b8d2e['attributes']=_[_0xb814('0x3c')](_0x5416dc[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x2569a5['query'][_0xb814('0x95')]));_0x5b8d2e[_0xb814('0x3d')]=_0x5b8d2e[_0xb814('0x3d')][_0xb814('0x3e')]?_0x5b8d2e[_0xb814('0x3d')]:_0x5416dc['model'];if(_0x2569a5[_0xb814('0x3b')][_0xb814('0xab')]){_0x5b8d2e['include']=[{'all':!![]}];}_0x5b8d2e=_[_0xb814('0xac')]({},_0x5b8d2e,_0x2569a5[_0xb814('0xad')]);return db[_0xb814('0xaa')]['find'](_0x5b8d2e)[_0xb814('0x2b')](handleEntityNotFound(_0x2a13fb,null))[_0xb814('0x2b')](respondWithResult(_0x2a13fb,null))['catch'](handleError(_0x2a13fb,null));};exports[_0xb814('0xae')]=function(_0x171f83,_0x5b5634){return db[_0xb814('0xaa')][_0xb814('0xae')](_0x171f83[_0xb814('0x6d')],{})[_0xb814('0x2b')](respondWithResult(_0x5b5634,0xc9))[_0xb814('0x35')](handleError(_0x5b5634,null));};exports[_0xb814('0x29')]=function(_0x40ae0b,_0x336a8f){if(_0x40ae0b[_0xb814('0x6d')]['id']){delete _0x40ae0b[_0xb814('0x6d')]['id'];}return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x40ae0b['params']['id']}})['then'](handleEntityNotFound(_0x336a8f,null))[_0xb814('0x2b')](saveUpdates(_0x40ae0b['body'],null))['then'](respondWithResult(_0x336a8f,null))[_0xb814('0x35')](handleError(_0x336a8f,null));};exports['destroy']=function(_0x4f0427,_0x50cb34){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x4f0427[_0xb814('0xa9')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x2b')](removeEntity(_0x50cb34,null))['catch'](handleError(_0x50cb34,null));};exports[_0xb814('0xaf')]=function(_0x2e6660,_0x49a8de){return db[_0xb814('0xaa')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x49a8de,null))[_0xb814('0x35')](handleError(_0x49a8de,null));};exports[_0xb814('0xb0')]=function(_0x39ce17,_0x11efb8,_0xaf705d){return db[_0xb814('0xb1')][_0xb814('0x6b')]({'where':{'id':_0x39ce17[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x11efb8,null))[_0xb814('0x2b')](function(_0x3e7a9a){if(_0x3e7a9a){return _0x3e7a9a[_0xb814('0xb0')](_0x39ce17[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x39ce17[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x11efb8,null))[_0xb814('0x35')](handleError(_0x11efb8,null));};exports[_0xb814('0xb3')]=function(_0x1868d9,_0x570191,_0x56b2aa){var _0x473b30={'raw':![],'where':{}};var _0x4af71e={};var _0x2d40e6={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb814('0xb4')]({'where':{'id':_0x1868d9['params']['id']}})['then'](handleEntityNotFound(_0x570191,null))[_0xb814('0x2b')](function(_0x32c956){if(_0x32c956){_0x4af71e[_0xb814('0x3a')]=_[_0xb814('0x6e')](db[_0xb814('0xb1')][_0xb814('0x37')]);_0x4af71e[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x1868d9[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x43')]=_[_0xb814('0x3c')](_0x4af71e['model'],_0x4af71e[_0xb814('0x3b')]);_0x473b30['attributes']=_[_0xb814('0x3c')](_0x4af71e[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x1868d9['query'][_0xb814('0x95')]));_0x473b30[_0xb814('0x3d')]=_0x473b30[_0xb814('0x3d')][_0xb814('0x3e')]?_0x473b30[_0xb814('0x3d')]:_0x4af71e[_0xb814('0x3a')];if(!_0x1868d9[_0xb814('0x3b')][_0xb814('0xb5')](_0xb814('0x3f'))){_0x473b30[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x1868d9[_0xb814('0x3b')][_0xb814('0x40')]);_0x473b30[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x1868d9['query'][_0xb814('0x24')]);}_0x473b30[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x1868d9['query']['sort']);_0x473b30[_0xb814('0x72')]=qs['filters'](_['pick'](_0x1868d9['query'],_0x4af71e['filters']));_0x473b30[_0xb814('0x72')][_0xb814('0xb6')]=_0x32c956['id'];if(_0x1868d9['query'][_0xb814('0x7d')]){_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],{'$or':_[_0xb814('0x30')](_0x473b30[_0xb814('0x3d')],function(_0x20e608){var _0x7b9948={};_0x7b9948[_0x20e608]={'$like':'%'+_0x1868d9[_0xb814('0x3b')][_0xb814('0x7d')]+'%'};return _0x7b9948;})});}if(_0x1868d9[_0xb814('0x3b')]['$gte']){var _0x2a5dff=_0x1868d9['query'][_0xb814('0xb7')][_0xb814('0x32')](',');var _0x35e8f7={};_0x35e8f7[_0x2a5dff[0x0]]={'$gte':moment(_0x2a5dff[0x1])[_0xb814('0xb8')](_0xb814('0xb9'))};_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],_0x35e8f7);}_0x473b30=_['merge']({},_0x473b30,_0x1868d9['options']);return db['WhatsappMessage'][_0xb814('0x93')]({'where':_0x473b30[_0xb814('0x72')]})[_0xb814('0x2b')](function(_0x3b7bee){_0x2d40e6[_0xb814('0x93')]=_0x3b7bee;if(_0x1868d9[_0xb814('0x3b')][_0xb814('0xab')]){_0x473b30[_0xb814('0xba')]=[{'all':!![]}];}return db[_0xb814('0xb1')][_0xb814('0xbb')](_0x473b30);})['then'](function(_0x5c989a){_0x2d40e6[_0xb814('0xa7')]=_0x5c989a;return _0x2d40e6;});}})[_0xb814('0x2b')](respondWithFilteredResult(_0x570191,_0x473b30))[_0xb814('0x35')](handleError(_0x570191,null));};exports[_0xb814('0xbc')]=function(_0x3f0c9c,_0x2642ab,_0x48358c){return db[_0xb814('0xaa')]['find']({'where':{'id':_0x3f0c9c[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2642ab,null))[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05[_0xb814('0xbd')](_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x3f0c9c[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{})[_0xb814('0xbe')](function(){return db[_0xb814('0x67')]['findAll']({'attributes':['id',_0xb814('0x2e'),_0xb814('0x46')],'where':{'id':_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')]}});})[_0xb814('0x2b')](function(_0x4a2aa5){socket[_0xb814('0xbf')](_0xb814('0xc0'),{'id':Number(_0x3f0c9c[_0xb814('0xa9')]['id']),'tags':_0x4a2aa5||[]});return{'id':Number(_0x3f0c9c['params']['id']),'tags':_0x4a2aa5||[]};});}})[_0xb814('0x2b')](respondWithResult(_0x2642ab,null))['catch'](handleError(_0x2642ab,null));};exports[_0xb814('0xc1')]=function(_0x5b4315,_0x22f6f1,_0x3467bd){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x5b4315['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x22f6f1,null))[_0xb814('0x2b')](function(_0x3fda0d){if(_0x3fda0d){return _0x3fda0d[_0xb814('0xc1')](_0x5b4315[_0xb814('0x3b')][_0xb814('0xb2')]);}})[_0xb814('0x2b')](respondWithStatusCode(_0x22f6f1,null))[_0xb814('0x35')](handleError(_0x22f6f1,null));};exports[_0xb814('0xc2')]=function(_0x152260,_0x3bc03a){var _0x368696=moment()[_0xb814('0xc3')]()[_0xb814('0x92')]();var _0x8e882a=path['join'](config[_0xb814('0xc4')],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc7'));var _0x4017b6=path[_0xb814('0xc8')](config['root'],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc9'));var _0x31b4f5=path['join'](_0x8e882a,_0x368696);var _0x5b5a26=util[_0xb814('0xb8')](_0xb814('0xca'),_0x152260[_0xb814('0xa9')]['id'],_0x368696);var _0x667ca1=path[_0xb814('0xc8')](_0x8e882a,_0x5b5a26);var _0x2c510a=[];_0x2c510a['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xcb'),'attributes':['id',_0xb814('0xcc')],'raw':!![]});_0x2c510a[_0xb814('0x34')]({'model':db['CmContact'],'as':_0xb814('0xcd'),'attributes':['id',_0xb814('0xce'),_0xb814('0xcf')],'raw':!![]});if(_0x152260[_0xb814('0x3b')][_0xb814('0xc9')]){_0x2c510a['push']({'model':db[_0xb814('0xd0')],'as':_0xb814('0xd0'),'raw':!![]});}var _0x371dd7=[{'model':db[_0xb814('0xb1')],'as':_0xb814('0xd1'),'attributes':['id',_0xb814('0x6d'),_0xb814('0x75'),_0xb814('0xd2'),_0xb814('0xd3'),_0xb814('0xd4')],'include':_0x2c510a}];_0x371dd7[_0xb814('0x34')]({'model':db[_0xb814('0xd5')],'as':_0xb814('0xd6'),'attributes':['id','name']});_0x371dd7['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xd7'),'attributes':['id',_0xb814('0xcc')]});return db['WhatsappInteraction'][_0xb814('0x6b')]({'where':{'id':_0x152260[_0xb814('0xa9')]['id']},'include':_0x371dd7})[_0xb814('0x2b')](handleEntityNotFound(_0x3bc03a,null))['then'](function(_0x10537d){if(_0x10537d){var _0xa651a=_0x10537d[_0xb814('0xd8')]({'plain':!![]});fs[_0xb814('0xd9')](_0x31b4f5);var _0x6ec0f5={'format':'A4','border':_0xb814('0xda'),'header':{'height':'40px','contents':{'first':_0xb814('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0xb814('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0xb814('0xb8')](_0xb814('0xdc'),_0xb814('0xdd'),_0xa651a['id']),moment()['format'](_0xb814('0xde'))[_0xb814('0x92')]())}}};var _0x164304={'channel':'Whatsapp','account':_0xa651a[_0xb814('0xd6')]['name'],'agent':_0xa651a[_0xb814('0xd7')]?_0xa651a[_0xb814('0xd7')][_0xb814('0xcc')]:'N.A.','createdAt':moment(_0xa651a[_0xb814('0x75')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')](),'closedAt':_0xa651a['closed']?moment(_0xa651a[_0xb814('0xdf')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')]():'','disposition':_0xa651a[_0xb814('0xe0')],'messages':_(_0xa651a[_0xb814('0xd1')])[_0xb814('0x7d')]({'secret':![]})[_0xb814('0x30')](function(_0x9a33d0){if(_0x9a33d0['Attachment']){var _0x2fe47b=path[_0xb814('0xc8')](_0x4017b6,_0x9a33d0[_0xb814('0xd0')]['basename']);if(fs[_0xb814('0xe1')](_0x2fe47b)){fs['createReadStream'](_0x2fe47b)['pipe'](fs['createWriteStream'](path[_0xb814('0xc8')](_0x31b4f5,_0x9a33d0['Attachment'][_0xb814('0xe2')])));}}return{'date':moment(_0x9a33d0[_0xb814('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb814('0x92')](),'sender':_0x9a33d0['direction']===_0xb814('0xe3')?_0x9a33d0['User']?_0x9a33d0[_0xb814('0xcb')][_0xb814('0xcc')]:_0xb814('0xe4'):_0x9a33d0['Contact']['firstName']+(_0x9a33d0['Contact'][_0xb814('0xcf')]?'\x20'+_0x9a33d0['Contact']['lastName']:''),'body':_0x9a33d0[_0xb814('0xd0')]?_0x9a33d0['Attachment']['basename']:_0x9a33d0['body'],'direction':_0x9a33d0[_0xb814('0xd2')]===_0xb814('0xe3')?'A':'C','secret':_0x9a33d0[_0xb814('0xd3')],'read':_0x9a33d0['read'],'attachment':_0x9a33d0[_0xb814('0xd0')]};})[_0xb814('0x5c')]()};return ejs[_0xb814('0xe5')](path[_0xb814('0xc8')](config[_0xb814('0xc4')],_0xb814('0xc5'),'views',_0xb814('0xe6')),{'interaction':_0x164304})[_0xb814('0x2b')](function(_0x28b818){return new BPromise(function(_0x171845,_0x4f2db2){pdf[_0xb814('0xae')](_0x28b818,_0x6ec0f5)[_0xb814('0xe7')](path[_0xb814('0xc8')](_0x31b4f5,_0xb814('0xe8')+_0xa651a['id']+'-'+_0x368696+_0xb814('0xe9')),function(_0x2cb01d,_0x1f4540){if(_0x2cb01d)return _0x4f2db2(_0x2cb01d);_0x171845(_0x1f4540);});});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x81ebc0,_0x2e7959){zipdir(_0x31b4f5,{'saveTo':_0x667ca1},function(_0x47f054,_0x1aa70b){if(_0x47f054)return _0x2e7959(_0x47f054);return _0x81ebc0(_0x1aa70b);});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x5706ad,_0x3b8438){rimraf(_0x31b4f5,function(_0x56e231){if(_0x56e231)_0x3b8438(_0x56e231);return _0x5706ad();});});})[_0xb814('0x2b')](function(){return _0x3bc03a[_0xb814('0xc2')](_0x667ca1,_0x5b5a26,function(_0x5e2273){if(_0x5e2273){console[_0xb814('0xea')]('err',_0x5e2273);}else{fs[_0xb814('0xeb')](_0x667ca1);}});});});}else{return _0x3bc03a[_0xb814('0x20')](0xc8);}})[_0xb814('0x35')](handleError(_0x3bc03a,null));}; \ No newline at end of file +var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','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','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7a54,0x106));var _0x47a5=function(_0x2011ca,_0x4ea2ac){_0x2011ca=_0x2011ca-0x0;var _0x40232b=_0x7a54[_0x2011ca];return _0x40232b;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','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':_0x47a5('0xcc'),'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['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 60318ef..f3fc81e 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 _0x84af=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x161cd6,_0x56da19){var _0x5a75db=function(_0x3319d6){while(--_0x3319d6){_0x161cd6['push'](_0x161cd6['shift']());}};_0x5a75db(++_0x56da19);}(_0x84af,0xa4));var _0xf84a=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x84af[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require(_0xf84a('0x0'));var WhatsappInteraction=require(_0xf84a('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xf84a('0x1'))['db'][_0xf84a('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf84a('0x3')](0x0);var events={'afterCreate':_0xf84a('0x4'),'afterUpdate':_0xf84a('0x5'),'afterDestroy':_0xf84a('0x6')};function emitEvent(_0x263de2){return function(_0x3f3a95,_0x1d39a2,_0x12d869){_0x3f3a95[_0xf84a('0x7')]({'attributes':['id'],'raw':!![]})[_0xf84a('0x8')](function(_0x5a85f1){_0x3f3a95[_0xf84a('0x9')](_0xf84a('0xa'),_0x5a85f1[_0xf84a('0xb')](function(_0x5d0160){return{'id':_0x5d0160['id']};}));return WhatsappMessage[_0xf84a('0xc')]({'where':{'WhatsappInteractionId':_0x3f3a95['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf84a('0x8')](function(_0x332f9b){_0x3f3a95[_0xf84a('0x9')](_0xf84a('0xd'),_0x332f9b[_0xf84a('0xe')]);WhatsappInteractionEvents[_0xf84a('0xf')](_0x263de2+':'+_0x3f3a95['id'],_0x3f3a95);WhatsappInteractionEvents[_0xf84a('0xf')](_0x263de2,_0x3f3a95);_0x12d869(null);})[_0xf84a('0x10')](_0x12d869(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xf84a('0x11')](e,emitEvent(event));}}module[_0xf84a('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x8451=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length'];(function(_0xbe1727,_0x1d8006){var _0x3c226c=function(_0x3a96c7){while(--_0x3a96c7){_0xbe1727['push'](_0xbe1727['shift']());}};_0x3c226c(++_0x1d8006);}(_0x8451,0x1ea));var _0x1845=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x8451[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require(_0x1845('0x0'));var WhatsappInteraction=require(_0x1845('0x1'))['db'][_0x1845('0x2')];var WhatsappMessage=require(_0x1845('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1845('0x3')](0x0);var events={'afterCreate':_0x1845('0x4'),'afterUpdate':_0x1845('0x5'),'afterDestroy':_0x1845('0x6')};function emitEvent(_0x18c1aa){return function(_0x28bee9,_0x3dae06,_0xc0d339){_0x28bee9[_0x1845('0x7')]({'attributes':['id'],'raw':!![]})[_0x1845('0x8')](function(_0x38c663){_0x28bee9[_0x1845('0x9')](_0x1845('0xa'),_0x38c663[_0x1845('0xb')](function(_0x4810a7){return{'id':_0x4810a7['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x28bee9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1845('0x8')](function(_0x252bb5){_0x28bee9[_0x1845('0x9')](_0x1845('0xc'),_0x252bb5[_0x1845('0xd')]);WhatsappInteractionEvents[_0x1845('0xe')](_0x18c1aa+':'+_0x28bee9['id'],_0x28bee9);WhatsappInteractionEvents['emit'](_0x18c1aa,_0x28bee9);_0xc0d339(null);})['catch'](_0xc0d339(null));};}for(var e in events){if(events[_0x1845('0xf')](e)){var event=events[e];WhatsappInteraction[_0x1845('0x10')](e,emitEvent(event));}}module[_0x1845('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 1836317..72b92b3 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 _0x8a95=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt'];(function(_0xf2a6ea,_0x2bc2aa){var _0x1e4a5f=function(_0x331f79){while(--_0x331f79){_0xf2a6ea['push'](_0xf2a6ea['shift']());}};_0x1e4a5f(++_0x2bc2aa);}(_0x8a95,0x1cd));var _0x58a9=function(_0x5acd55,_0x31fe62){_0x5acd55=_0x5acd55-0x0;var _0x72f7d5=_0x8a95[_0x5acd55];return _0x72f7d5;};'use strict';var _=require(_0x58a9('0x0'));var util=require(_0x58a9('0x1'));var logger=require(_0x58a9('0x2'))(_0x58a9('0x3'));var moment=require(_0x58a9('0x4'));var BPromise=require(_0x58a9('0x5'));var rp=require(_0x58a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58a9('0x7'));var config=require(_0x58a9('0x8'));var attributes=require(_0x58a9('0x9'));module[_0x58a9('0xa')]=function(_0x1eab75,_0x5e5185){return _0x1eab75['define'](_0x58a9('0xb'),attributes,{'tableName':_0x58a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11400f,_0x1fba10,_0x2a1abf){if(_0x11400f['changed'](_0x58a9('0xd'))){_0x11400f[_0x58a9('0xe')]=moment()[_0x58a9('0xf')](_0x58a9('0x10'));}_0x2a1abf(null,_0x11400f);}}});}; \ No newline at end of file +var _0xc651=['api','moment','bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3d916c,_0x2dbb05){var _0x2d5d74=function(_0x1a131b){while(--_0x1a131b){_0x3d916c['push'](_0x3d916c['shift']());}};_0x2d5d74(++_0x2dbb05);}(_0xc651,0x194));var _0x1c65=function(_0x1a15b9,_0x2488f8){_0x1a15b9=_0x1a15b9-0x0;var _0x16fa57=_0xc651[_0x1a15b9];return _0x16fa57;};'use strict';var _=require(_0x1c65('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1c65('0x1'));var moment=require(_0x1c65('0x2'));var BPromise=require(_0x1c65('0x3'));var rp=require(_0x1c65('0x4'));var fs=require('fs');var path=require(_0x1c65('0x5'));var rimraf=require('rimraf');var config=require(_0x1c65('0x6'));var attributes=require(_0x1c65('0x7'));module[_0x1c65('0x8')]=function(_0x4c0f8a,_0x5e5c52){return _0x4c0f8a[_0x1c65('0x9')](_0x1c65('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c8977,_0x34a1dc,_0x275d65){if(_0x1c8977['changed'](_0x1c65('0xb'))){_0x1c8977[_0x1c65('0xc')]=moment()[_0x1c65('0xd')](_0x1c65('0xe'));}_0x275d65(null,_0x1c8977);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index cf5f4d6..1337538 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 _0x922f=['find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction'];(function(_0x11407d,_0x10b025){var _0x34967e=function(_0x391cbd){while(--_0x391cbd){_0x11407d['push'](_0x11407d['shift']());}};_0x34967e(++_0x10b025);}(_0x922f,0xfc));var _0xf922=function(_0x46d72f,_0x30bd56){_0x46d72f=_0x46d72f-0x0;var _0x3dadb8=_0x922f[_0x46d72f];return _0x3dadb8;};'use strict';var _=require(_0xf922('0x0'));var util=require('util');var moment=require(_0xf922('0x1'));var BPromise=require(_0xf922('0x2'));var rs=require(_0xf922('0x3'));var fs=require('fs');var Redis=require(_0xf922('0x4'));var db=require(_0xf922('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf922('0x6'))(_0xf922('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf922('0x8')]['http']({'port':0x232a});config[_0xf922('0x9')]=_[_0xf922('0xa')](config[_0xf922('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf922('0xb'))(new Redis(config[_0xf922('0x9')]));require(_0xf922('0xc'))[_0xf922('0xd')](socket);function respondWithRpcPromise(_0x962557,_0x45a44c,_0x2b0bd8){return new BPromise(function(_0x286eb5,_0x33a971){return client[_0xf922('0xe')](_0x962557,_0x2b0bd8)[_0xf922('0xf')](function(_0x2363ed){logger[_0xf922('0x10')](_0xf922('0x11'),_0x45a44c,'request\x20sent');logger[_0xf922('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x45a44c,'request\x20sent',JSON[_0xf922('0x13')](_0x2363ed));if(_0x2363ed[_0xf922('0x14')]){if(_0x2363ed['error'][_0xf922('0x15')]===0x1f4){logger[_0xf922('0x14')](_0xf922('0x11'),_0x45a44c,_0x2363ed[_0xf922('0x14')][_0xf922('0x16')]);return _0x33a971(_0x2363ed[_0xf922('0x14')][_0xf922('0x16')]);}logger['error'](_0xf922('0x11'),_0x45a44c,_0x2363ed['error'][_0xf922('0x16')]);return _0x286eb5(_0x2363ed['error'][_0xf922('0x16')]);}else{logger['info'](_0xf922('0x11'),_0x45a44c,_0xf922('0x17'));_0x286eb5(_0x2363ed['result'][_0xf922('0x16')]);}})[_0xf922('0x18')](function(_0xf533e4){logger['error'](_0xf922('0x11'),_0x45a44c,_0xf533e4);_0x33a971(_0xf533e4);});});}exports[_0xf922('0x19')]=function(_0x45708b){var _0x270c27=this;return new Promise(function(_0x3cf062,_0x20f37e){return db[_0xf922('0x1a')][_0xf922('0x1b')](_0x45708b[_0xf922('0x1c')],{'raw':_0x45708b[_0xf922('0x1d')]?_0x45708b[_0xf922('0x1d')][_0xf922('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45708b['options']?_0x45708b[_0xf922('0x1d')][_0xf922('0x1f')]||null:null,'attributes':_0x45708b[_0xf922('0x1d')]?_0x45708b[_0xf922('0x1d')][_0xf922('0x20')]||null:null,'limit':_0x45708b[_0xf922('0x1d')]?_0x45708b[_0xf922('0x1d')][_0xf922('0x21')]||null:null})['then'](function(_0xadb0bb){logger['info']('UpdateWhatsappInteraction',_0x45708b);logger[_0xf922('0x12')](_0xf922('0x19'),_0x45708b,JSON[_0xf922('0x13')](_0xadb0bb));_0x3cf062(_0xadb0bb);})['catch'](function(_0x2e0efb){logger['error']('UpdateWhatsappInteraction',_0x2e0efb['message'],_0x45708b);_0x20f37e(_0x270c27['error'](0x1f4,_0x2e0efb[_0xf922('0x16')]));});});};exports[_0xf922('0x22')]=function(_0x1f2006){return new Promise(function(_0x1047a6,_0x30414c){return db['WhatsappInteraction'][_0xf922('0x23')]({'where':_0x1f2006[_0xf922('0x1d')]?_0x1f2006[_0xf922('0x1d')][_0xf922('0x1f')]||null:null})[_0xf922('0xf')](function(_0x57d81f){if(_0x57d81f){return _0x57d81f[_0xf922('0x24')](_0x1f2006[_0xf922('0x1c')][_0xf922('0x25')],_[_0xf922('0x26')](_0x1f2006[_0xf922('0x1c')],[_0xf922('0x25'),'id'])||{});}})[_0xf922('0x27')](function(_0x14e552){logger[_0xf922('0x10')]('AddTags',_0x1f2006);logger[_0xf922('0x12')]('AddTags',_0x1f2006,JSON[_0xf922('0x13')](_0x14e552));_0x1047a6(_0x14e552);})[_0xf922('0x18')](function(_0xafc50a){logger[_0xf922('0x14')](_0xf922('0x28'),_0xafc50a['message'],_0x1f2006);_0x30414c(_this[_0xf922('0x14')](0x1f4,_0xafc50a['message']));});});}; \ No newline at end of file +var _0x2344=['code','message','result','WhatsappInteraction','body','raw','where','options','attributes','limit','then','stringify','catch','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x35f1de,_0x4dda19){var _0x4b66d6=function(_0x4ff6c5){while(--_0x4ff6c5){_0x35f1de['push'](_0x35f1de['shift']());}};_0x4b66d6(++_0x4dda19);}(_0x2344,0x69));var _0x4234=function(_0x3c39eb,_0x3c27c4){_0x3c39eb=_0x3c39eb-0x0;var _0x404b81=_0x2344[_0x3c39eb];return _0x404b81;};'use strict';var _=require(_0x4234('0x0'));var util=require(_0x4234('0x1'));var moment=require(_0x4234('0x2'));var BPromise=require(_0x4234('0x3'));var rs=require(_0x4234('0x4'));var fs=require('fs');var Redis=require(_0x4234('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4234('0x6'));var logger=require('../../config/logger')(_0x4234('0x7'));var config=require(_0x4234('0x8'));var jayson=require(_0x4234('0x9'));var client=jayson['client'][_0x4234('0xa')]({'port':0x232a});config[_0x4234('0xb')]=_[_0x4234('0xc')](config[_0x4234('0xb')],{'host':_0x4234('0xd'),'port':0x18eb});var socket=require(_0x4234('0xe'))(new Redis(config[_0x4234('0xb')]));require('./whatsappInteraction.socket')[_0x4234('0xf')](socket);function respondWithRpcPromise(_0x1d6feb,_0xc800e7,_0x3c3d68){return new BPromise(function(_0xef5be1,_0x972af1){return client['request'](_0x1d6feb,_0x3c3d68)['then'](function(_0x479a9f){logger[_0x4234('0x10')](_0x4234('0x11'),_0xc800e7,_0x4234('0x12'));logger[_0x4234('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xc800e7,_0x4234('0x12'),JSON['stringify'](_0x479a9f));if(_0x479a9f['error']){if(_0x479a9f[_0x4234('0x14')][_0x4234('0x15')]===0x1f4){logger['error'](_0x4234('0x11'),_0xc800e7,_0x479a9f[_0x4234('0x14')][_0x4234('0x16')]);return _0x972af1(_0x479a9f[_0x4234('0x14')][_0x4234('0x16')]);}logger[_0x4234('0x14')](_0x4234('0x11'),_0xc800e7,_0x479a9f[_0x4234('0x14')][_0x4234('0x16')]);return _0xef5be1(_0x479a9f[_0x4234('0x14')][_0x4234('0x16')]);}else{logger[_0x4234('0x10')](_0x4234('0x11'),_0xc800e7,'request\x20sent');_0xef5be1(_0x479a9f[_0x4234('0x17')]['message']);}})['catch'](function(_0x1ed8d9){logger[_0x4234('0x14')](_0x4234('0x11'),_0xc800e7,_0x1ed8d9);_0x972af1(_0x1ed8d9);});});}exports['UpdateWhatsappInteraction']=function(_0x37d486){var _0x3fe079=this;return new Promise(function(_0x131591,_0x2fc30f){return db[_0x4234('0x18')]['update'](_0x37d486[_0x4234('0x19')],{'raw':_0x37d486['options']?_0x37d486['options'][_0x4234('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37d486['options']?_0x37d486['options'][_0x4234('0x1b')]||null:null,'attributes':_0x37d486[_0x4234('0x1c')]?_0x37d486['options'][_0x4234('0x1d')]||null:null,'limit':_0x37d486[_0x4234('0x1c')]?_0x37d486[_0x4234('0x1c')][_0x4234('0x1e')]||null:null})[_0x4234('0x1f')](function(_0x1c0406){logger[_0x4234('0x10')]('UpdateWhatsappInteraction',_0x37d486);logger[_0x4234('0x13')]('UpdateWhatsappInteraction',_0x37d486,JSON[_0x4234('0x20')](_0x1c0406));_0x131591(_0x1c0406);})[_0x4234('0x21')](function(_0x3dfc1a){logger['error'](_0x4234('0x22'),_0x3dfc1a[_0x4234('0x16')],_0x37d486);_0x2fc30f(_0x3fe079['error'](0x1f4,_0x3dfc1a['message']));});});};exports[_0x4234('0x23')]=function(_0x2d37f3){return new Promise(function(_0x5b3c59,_0x1589f1){return db[_0x4234('0x18')][_0x4234('0x24')]({'where':_0x2d37f3['options']?_0x2d37f3[_0x4234('0x1c')]['where']||null:null})['then'](function(_0x88202d){if(_0x88202d){return _0x88202d[_0x4234('0x25')](_0x2d37f3[_0x4234('0x19')][_0x4234('0x26')],_[_0x4234('0x27')](_0x2d37f3[_0x4234('0x19')],[_0x4234('0x26'),'id'])||{});}})[_0x4234('0x28')](function(_0x337f8a){logger[_0x4234('0x10')](_0x4234('0x29'),_0x2d37f3);logger['debug'](_0x4234('0x29'),_0x2d37f3,JSON[_0x4234('0x20')](_0x337f8a));_0x5b3c59(_0x337f8a);})[_0x4234('0x21')](function(_0x23ce82){logger[_0x4234('0x14')]('AddTags',_0x23ce82[_0x4234('0x16')],_0x2d37f3);_0x1589f1(_this['error'](0x1f4,_0x23ce82[_0x4234('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7819ad2..caf4d85 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 _0xa219=['removeListener','register','length','save','remove','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa219,0xab));var _0x9a21=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xa219[_0x44a64f];return _0x52024b;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x9a21('0x0'),_0x9a21('0x1'),_0x9a21('0x2')];function createListener(_0x21673d,_0x142441){return function(_0x19fbb5){_0x142441[_0x9a21('0x3')](_0x21673d,_0x19fbb5);};}function removeListener(_0x2845a2,_0x458504){return function(){WhatsappInteractionEvents[_0x9a21('0x4')](_0x2845a2,_0x458504);};}exports[_0x9a21('0x5')]=function(_0x14a77d){for(var _0x1c52a4=0x0,_0x32227f=events[_0x9a21('0x6')];_0x1c52a4<_0x32227f;_0x1c52a4++){var _0x3b5ffc=events[_0x1c52a4];var _0x33293c=createListener('whatsappInteraction:'+_0x3b5ffc,_0x14a77d);WhatsappInteractionEvents['on'](_0x3b5ffc,_0x33293c);}}; \ No newline at end of file +var _0x4ce4=['save','remove','update','emit','removeListener','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x4aaedd,_0x1d997d){var _0x3b6de5=function(_0x2e4ffa){while(--_0x2e4ffa){_0x4aaedd['push'](_0x4aaedd['shift']());}};_0x3b6de5(++_0x1d997d);}(_0x4ce4,0x1bf));var _0x44ce=function(_0x3a5b9f,_0x599f46){_0x3a5b9f=_0x3a5b9f-0x0;var _0x4e9b72=_0x4ce4[_0x3a5b9f];return _0x4e9b72;};'use strict';var WhatsappInteractionEvents=require(_0x44ce('0x0'));var events=[_0x44ce('0x1'),_0x44ce('0x2'),_0x44ce('0x3')];function createListener(_0x5c3d7f,_0xe4c189){return function(_0x4ad516){_0xe4c189[_0x44ce('0x4')](_0x5c3d7f,_0x4ad516);};}function removeListener(_0x1a28a8,_0x3a6a1c){return function(){WhatsappInteractionEvents[_0x44ce('0x5')](_0x1a28a8,_0x3a6a1c);};}exports['register']=function(_0x148595){for(var _0x141ab5=0x0,_0x52fcdf=events['length'];_0x141ab5<_0x52fcdf;_0x141ab5++){var _0x34d15c=events[_0x141ab5];var _0x52156e=createListener(_0x44ce('0x6')+_0x34d15c,_0x148595);WhatsappInteractionEvents['on'](_0x34d15c,_0x52156e);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3c334cf..a10c382 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 _0xe5a0=['isAuthenticated','index','/describe','describe','/:id','show','post','tracked','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x563dcc,_0x1b6060){var _0x50aa5d=function(_0x3e42b8){while(--_0x3e42b8){_0x563dcc['push'](_0x563dcc['shift']());}};_0x50aa5d(++_0x1b6060);}(_0xe5a0,0xcf));var _0x0e5a=function(_0x1ce100,_0x161779){_0x1ce100=_0x1ce100-0x0;var _0x38600a=_0xe5a0[_0x1ce100];return _0x38600a;};'use strict';var multer=require(_0x0e5a('0x0'));var util=require('util');var path=require(_0x0e5a('0x1'));var timeout=require(_0x0e5a('0x2'));var express=require('express');var router=express[_0x0e5a('0x3')]();var auth=require(_0x0e5a('0x4'));var interaction=require(_0x0e5a('0x5'));var config=require(_0x0e5a('0x6'));var controller=require(_0x0e5a('0x7'));router[_0x0e5a('0x8')]('/',auth[_0x0e5a('0x9')](),controller[_0x0e5a('0xa')]);router[_0x0e5a('0x8')](_0x0e5a('0xb'),auth[_0x0e5a('0x9')](),controller[_0x0e5a('0xc')]);router[_0x0e5a('0x8')](_0x0e5a('0xd'),auth[_0x0e5a('0x9')](),controller[_0x0e5a('0xe')]);router[_0x0e5a('0xf')]('/',auth[_0x0e5a('0x9')](),interaction[_0x0e5a('0x10')]('whatsapp','whatsappmessage:create'),controller[_0x0e5a('0x11')]);router['post'](_0x0e5a('0x12'),controller[_0x0e5a('0x13')]);router[_0x0e5a('0x14')]('/:id',auth[_0x0e5a('0x9')](),controller[_0x0e5a('0x15')]);router[_0x0e5a('0x14')](_0x0e5a('0x16'),auth[_0x0e5a('0x9')](),controller[_0x0e5a('0x17')]);router['put'](_0x0e5a('0x18'),auth[_0x0e5a('0x9')](),controller[_0x0e5a('0x19')]);router['delete'](_0x0e5a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0e5a('0x1a')]=router; \ No newline at end of file +var _0x40bf=['index','/describe','describe','show','post','whatsappmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x40bf,0x1ee));var _0xf40b=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x40bf[_0x238671];return _0x474844;};'use strict';var multer=require(_0xf40b('0x0'));var util=require(_0xf40b('0x1'));var path=require(_0xf40b('0x2'));var timeout=require(_0xf40b('0x3'));var express=require('express');var router=express[_0xf40b('0x4')]();var auth=require(_0xf40b('0x5'));var interaction=require(_0xf40b('0x6'));var config=require('../../config/environment');var controller=require(_0xf40b('0x7'));router[_0xf40b('0x8')]('/',auth[_0xf40b('0x9')](),controller[_0xf40b('0xa')]);router['get'](_0xf40b('0xb'),auth['isAuthenticated'](),controller[_0xf40b('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf40b('0xd')]);router[_0xf40b('0xe')]('/',auth[_0xf40b('0x9')](),interaction['tracked']('whatsapp',_0xf40b('0xf')),controller[_0xf40b('0x10')]);router[_0xf40b('0xe')](_0xf40b('0x11'),controller[_0xf40b('0x12')]);router[_0xf40b('0x13')](_0xf40b('0x14'),auth[_0xf40b('0x9')](),controller[_0xf40b('0x15')]);router[_0xf40b('0x13')](_0xf40b('0x16'),auth[_0xf40b('0x9')](),controller[_0xf40b('0x17')]);router['put']('/:id/reject',auth[_0xf40b('0x9')](),controller[_0xf40b('0x18')]);router[_0xf40b('0x19')](_0xf40b('0x14'),auth[_0xf40b('0x9')](),controller[_0xf40b('0x1a')]);module[_0xf40b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c04cee0..43c889b 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 _0xd2b4=['STRING','DATE','sequelize','BOOLEAN','out'];(function(_0x3d3a2d,_0x1e246b){var _0x3f16ae=function(_0x3d55a){while(--_0x3d55a){_0x3d3a2d['push'](_0x3d3a2d['shift']());}};_0x3f16ae(++_0x1e246b);}(_0xd2b4,0x70));var _0x4d2b=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0xd2b4[_0x41582d];return _0x59c504;};'use strict';var Sequelize=require(_0x4d2b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4d2b('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4d2b('0x2')),'defaultValue':_0x4d2b('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4d2b('0x3')](0xbe)},'phone':{'type':Sequelize[_0x4d2b('0x3')]},'readAt':{'type':Sequelize[_0x4d2b('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x847d=['DATE','BOOLEAN','exports','TEXT','medium','ENUM','out','STRING'];(function(_0x448de9,_0x5d4cfa){var _0x5cc7c6=function(_0x23bb36){while(--_0x23bb36){_0x448de9['push'](_0x448de9['shift']());}};_0x5cc7c6(++_0x5d4cfa);}(_0x847d,0x14a));var _0xd847=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x847d[_0x4914e2];return _0x2dcd07;};'use strict';var Sequelize=require('sequelize');module[_0xd847('0x0')]={'body':{'type':Sequelize[_0xd847('0x1')](_0xd847('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd847('0x3')]('in','out'),'defaultValue':_0xd847('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd847('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xd847('0x6')]},'secret':{'type':Sequelize[_0xd847('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 83f6e9b..e67e77b 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 _0xbf62=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','options','count','includeAll','catch','show','params','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','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~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','model','query'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xbf62,0xc4));var _0x2bf6=function(_0x735a49,_0x3da3fd){_0x735a49=_0x735a49-0x0;var _0xee7e9=_0xbf62[_0x735a49];return _0xee7e9;};'use strict';var pdf=require(_0x2bf6('0x0'));var emlformat=require(_0x2bf6('0x1'));var rimraf=require(_0x2bf6('0x2'));var zipdir=require(_0x2bf6('0x3'));var jsonpatch=require(_0x2bf6('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2bf6('0x5'));var Mustache=require('mustache');var util=require(_0x2bf6('0x6'));var path=require(_0x2bf6('0x7'));var sox=require(_0x2bf6('0x8'));var csv=require(_0x2bf6('0x9'));var ejs=require(_0x2bf6('0xa'));var fs=require('fs');var _=require(_0x2bf6('0xb'));var squel=require(_0x2bf6('0xc'));var crypto=require(_0x2bf6('0xd'));var jsforce=require(_0x2bf6('0xe'));var deskjs=require(_0x2bf6('0xf'));var toCsv=require(_0x2bf6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2bf6('0x10'));var authService=require(_0x2bf6('0x11'));var qs=require(_0x2bf6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2bf6('0x13'));var logger=require(_0x2bf6('0x14'))(_0x2bf6('0x15'));var utils=require('../../config/utils');var config=require(_0x2bf6('0x16'));var db=require('../../mysqldb')['db'];config[_0x2bf6('0x17')]=_['defaults'](config['redis'],{'host':_0x2bf6('0x18'),'port':0x18eb});var socket=require(_0x2bf6('0x19'))(new Redis(config[_0x2bf6('0x17')]));require('./whatsappMessage.socket')[_0x2bf6('0x1a')](socket);var jayson=require(_0x2bf6('0x1b'));var client=jayson['client'][_0x2bf6('0x1c')]({'port':0x232c});var client9002=jayson[_0x2bf6('0x1d')][_0x2bf6('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1d32d5,_0x435add,_0x1632ad){if(_0x1632ad){var _0x460721=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x460721[_0x2bf6('0x1e')](_0x435add)){return _0x1d32d5;}else{throw new db[(_0x2bf6('0x1f'))][(_0x2bf6('0x20'))](_0x2bf6('0x21'));}}else{return _0x1d32d5;}}function respondWithRpcPromise(_0x36e323,_0x108987,_0x16aa3e,_0x438263){return new BPromise(function(_0x4ec44d,_0x3f1a6a){var _0x1f7adc=_0x438263||client;return _0x1f7adc[_0x2bf6('0x22')](_0x36e323,_0x16aa3e)[_0x2bf6('0x23')](function(_0xf3cd){logger[_0x2bf6('0x24')](_0x2bf6('0x25'),_0x108987,_0x2bf6('0x26'));logger[_0x2bf6('0x27')](_0x2bf6('0x28'),_0x108987,_0x2bf6('0x26'),JSON['stringify'](_0xf3cd));if(_0xf3cd[_0x2bf6('0x29')]){if(_0xf3cd[_0x2bf6('0x29')][_0x2bf6('0x2a')]===0x1f4){logger[_0x2bf6('0x29')](_0x2bf6('0x25'),_0x108987,_0xf3cd[_0x2bf6('0x29')][_0x2bf6('0x2b')]);return _0x3f1a6a(_0xf3cd[_0x2bf6('0x29')][_0x2bf6('0x2b')]);}logger[_0x2bf6('0x29')](_0x2bf6('0x25'),_0x108987,_0xf3cd[_0x2bf6('0x29')][_0x2bf6('0x2b')]);return _0x4ec44d(_0xf3cd[_0x2bf6('0x29')][_0x2bf6('0x2b')]);}else{logger[_0x2bf6('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x108987,_0x2bf6('0x26'));_0x4ec44d(_0xf3cd[_0x2bf6('0x2c')][_0x2bf6('0x2b')]);}})['catch'](function(_0x1fc26f){logger[_0x2bf6('0x29')](_0x2bf6('0x25'),_0x108987,_0x1fc26f);_0x3f1a6a(_0x1fc26f);});});}function respondWithStatusCode(_0x16dd6a,_0x5d7508){_0x5d7508=_0x5d7508||0xcc;return function(_0xf08831){if(_0xf08831){return _0x16dd6a[_0x2bf6('0x2d')](_0x5d7508);}return _0x16dd6a['status'](_0x5d7508)[_0x2bf6('0x2e')]();};}function respondWithResult(_0x565b16,_0x16674c){_0x16674c=_0x16674c||0xc8;return function(_0x1636f1){if(_0x1636f1){return _0x565b16[_0x2bf6('0x2f')](_0x16674c)[_0x2bf6('0x30')](_0x1636f1);}};}function respondWithFilteredResult(_0x3f7d3f,_0x3ad56d){return function(_0x295c3f){if(_0x295c3f){var _0x1f27c9=_0x295c3f['count'],_0x3d382d=_0x3ad56d[_0x2bf6('0x31')],_0x3686e2=_0x3ad56d[_0x2bf6('0x31')]+_0x3ad56d[_0x2bf6('0x32')],_0xe7dd79;if(_0x3686e2>=_0x1f27c9){_0x3686e2=_0x1f27c9;_0xe7dd79=0xc8;}else{_0xe7dd79=0xce;}_0x3f7d3f['status'](_0xe7dd79);return _0x3f7d3f[_0x2bf6('0x33')](_0x2bf6('0x34'),_0x3d382d+'-'+_0x3686e2+'/'+_0x1f27c9)[_0x2bf6('0x30')](_0x295c3f);}return null;};}function patchUpdates(_0x2ec454){return function(_0x49c429){try{jsonpatch[_0x2bf6('0x35')](_0x49c429,_0x2ec454,!![]);}catch(_0x3ec856){return BPromise['reject'](_0x3ec856);}return _0x49c429[_0x2bf6('0x36')]();};}function saveUpdates(_0x2c1627,_0x17a383){return function(_0x3b2146){if(_0x3b2146){return _0x3b2146['update'](_0x2c1627)[_0x2bf6('0x23')](function(_0x38299a){return _0x38299a;});}return null;};}function removeEntity(_0x2d0840,_0x19c118){return function(_0x12628e){if(_0x12628e){return _0x12628e[_0x2bf6('0x37')]()[_0x2bf6('0x23')](function(){_0x2d0840[_0x2bf6('0x2f')](0xcc)[_0x2bf6('0x2e')]();});}};}function handleEntityNotFound(_0x3f83ef,_0x3438d9){return function(_0x3d7dc7){if(!_0x3d7dc7){_0x3f83ef['sendStatus'](0x194);}return _0x3d7dc7;};}function handleError(_0x558c6b,_0x23bced){_0x23bced=_0x23bced||0x1f4;return function(_0xfb50b1){logger[_0x2bf6('0x29')](_0xfb50b1[_0x2bf6('0x38')]);if(_0xfb50b1[_0x2bf6('0x39')]){delete _0xfb50b1['name'];}_0x558c6b[_0x2bf6('0x2f')](_0x23bced)[_0x2bf6('0x3a')](_0xfb50b1);};}exports[_0x2bf6('0x3b')]=function(_0x921f75,_0x5ebda6){var _0x83671e={},_0x1c2684={},_0xa77c5a={'count':0x0,'rows':[]};var _0x46e111=_[_0x2bf6('0x3c')](db[_0x2bf6('0x3d')][_0x2bf6('0x3e')],function(_0xd95cf9){return{'name':_0xd95cf9[_0x2bf6('0x3f')],'type':_0xd95cf9['type']['key']};});_0x1c2684[_0x2bf6('0x40')]=_[_0x2bf6('0x3c')](_0x46e111,_0x2bf6('0x39'));_0x1c2684[_0x2bf6('0x41')]=_[_0x2bf6('0x42')](_0x921f75['query']);_0x1c2684[_0x2bf6('0x43')]=_[_0x2bf6('0x44')](_0x1c2684[_0x2bf6('0x40')],_0x1c2684['query']);_0x83671e[_0x2bf6('0x45')]=_[_0x2bf6('0x44')](_0x1c2684[_0x2bf6('0x40')],qs[_0x2bf6('0x46')](_0x921f75[_0x2bf6('0x41')][_0x2bf6('0x46')]));_0x83671e[_0x2bf6('0x45')]=_0x83671e[_0x2bf6('0x45')][_0x2bf6('0x47')]?_0x83671e[_0x2bf6('0x45')]:_0x1c2684['model'];if(!_0x921f75['query'][_0x2bf6('0x48')]('nolimit')){_0x83671e['limit']=qs[_0x2bf6('0x32')](_0x921f75[_0x2bf6('0x41')][_0x2bf6('0x32')]);_0x83671e[_0x2bf6('0x31')]=qs[_0x2bf6('0x31')](_0x921f75['query']['offset']);}_0x83671e[_0x2bf6('0x49')]=qs[_0x2bf6('0x4a')](_0x921f75['query']['sort']);_0x83671e['where']=qs[_0x2bf6('0x43')](_['pick'](_0x921f75['query'],_0x1c2684[_0x2bf6('0x43')]),_0x46e111);if(_0x921f75[_0x2bf6('0x41')]['filter']){_0x83671e[_0x2bf6('0x4b')]=_[_0x2bf6('0x4c')](_0x83671e[_0x2bf6('0x4b')],{'$or':_[_0x2bf6('0x3c')](_0x46e111,function(_0x2acf6a){if(_0x2acf6a[_0x2bf6('0x4d')]!==_0x2bf6('0x4e')){var _0x26427f={};_0x26427f[_0x2acf6a[_0x2bf6('0x39')]]={'$like':'%'+_0x921f75[_0x2bf6('0x41')]['filter']+'%'};return _0x26427f;}})});}_0x83671e=_[_0x2bf6('0x4c')]({},_0x83671e,_0x921f75[_0x2bf6('0x4f')]);var _0x2969f8={'where':_0x83671e[_0x2bf6('0x4b')]};return db[_0x2bf6('0x3d')][_0x2bf6('0x50')](_0x2969f8)['then'](function(_0x45bea6){_0xa77c5a['count']=_0x45bea6;if(_0x921f75[_0x2bf6('0x41')][_0x2bf6('0x51')]){_0x83671e['include']=[{'all':!![]}];}return db[_0x2bf6('0x3d')]['findAll'](_0x83671e);})['then'](function(_0x58aeb0){_0xa77c5a['rows']=_0x58aeb0;return _0xa77c5a;})[_0x2bf6('0x23')](respondWithFilteredResult(_0x5ebda6,_0x83671e))[_0x2bf6('0x52')](handleError(_0x5ebda6,null));};exports[_0x2bf6('0x53')]=function(_0x3d8d62,_0x4fb6a8){var _0x89fb03={'raw':!![],'where':{'id':_0x3d8d62[_0x2bf6('0x54')]['id']}},_0x36a32f={};_0x36a32f[_0x2bf6('0x40')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x36a32f[_0x2bf6('0x41')]=_[_0x2bf6('0x42')](_0x3d8d62[_0x2bf6('0x41')]);_0x36a32f[_0x2bf6('0x43')]=_[_0x2bf6('0x44')](_0x36a32f[_0x2bf6('0x40')],_0x36a32f[_0x2bf6('0x41')]);_0x89fb03['attributes']=_[_0x2bf6('0x44')](_0x36a32f[_0x2bf6('0x40')],qs[_0x2bf6('0x46')](_0x3d8d62[_0x2bf6('0x41')][_0x2bf6('0x46')]));_0x89fb03[_0x2bf6('0x45')]=_0x89fb03[_0x2bf6('0x45')][_0x2bf6('0x47')]?_0x89fb03['attributes']:_0x36a32f[_0x2bf6('0x40')];if(_0x3d8d62[_0x2bf6('0x41')][_0x2bf6('0x51')]){_0x89fb03['include']=[{'all':!![]}];}_0x89fb03=_['merge']({},_0x89fb03,_0x3d8d62[_0x2bf6('0x4f')]);return db[_0x2bf6('0x3d')][_0x2bf6('0x55')](_0x89fb03)[_0x2bf6('0x23')](handleEntityNotFound(_0x4fb6a8,null))[_0x2bf6('0x23')](respondWithResult(_0x4fb6a8,null))[_0x2bf6('0x52')](handleError(_0x4fb6a8,null));};exports['create']=function(_0x304eb8,_0x4d3983){return db['WhatsappMessage'][_0x2bf6('0x56')](_0x304eb8[_0x2bf6('0x57')],{})[_0x2bf6('0x23')](respondWithResult(_0x4d3983,0xc9))['catch'](handleError(_0x4d3983,null));};exports[_0x2bf6('0x58')]=function(_0x2a631d,_0xc8ee76){if(_0x2a631d[_0x2bf6('0x57')]['id']){delete _0x2a631d[_0x2bf6('0x57')]['id'];}return db[_0x2bf6('0x3d')]['find']({'where':{'id':_0x2a631d[_0x2bf6('0x54')]['id']}})[_0x2bf6('0x23')](handleEntityNotFound(_0xc8ee76,null))[_0x2bf6('0x23')](saveUpdates(_0x2a631d['body'],null))[_0x2bf6('0x23')](respondWithResult(_0xc8ee76,null))[_0x2bf6('0x52')](handleError(_0xc8ee76,null));};exports[_0x2bf6('0x37')]=function(_0x17ef6f,_0x33991b){return db[_0x2bf6('0x3d')]['find']({'where':{'id':_0x17ef6f[_0x2bf6('0x54')]['id']}})[_0x2bf6('0x23')](handleEntityNotFound(_0x33991b,null))[_0x2bf6('0x23')](removeEntity(_0x33991b,null))['catch'](handleError(_0x33991b,null));};exports[_0x2bf6('0x59')]=function(_0x162b60,_0x1e3629){return db[_0x2bf6('0x3d')][_0x2bf6('0x59')]()[_0x2bf6('0x23')](respondWithResult(_0x1e3629,null))['catch'](handleError(_0x1e3629,null));};var interaction_log=require(_0x2bf6('0x14'))(_0x2bf6('0x5a'));exports[_0x2bf6('0x5b')]=function(_0x5e0aaa,_0x36e893,_0x2497c5){var _0x50ae60={'channel':_0x2bf6('0x5c')};if(_0x5e0aaa[_0x2bf6('0x57')]['id']){delete _0x5e0aaa[_0x2bf6('0x57')]['id'];}_0x5e0aaa['body'][_0x2bf6('0x5d')]=!![];_0x5e0aaa[_0x2bf6('0x57')]['readAt']=moment()[_0x2bf6('0x5e')](_0x2bf6('0x5f'));_0x5e0aaa[_0x2bf6('0x57')][_0x2bf6('0x60')]=_0x5e0aaa[_0x2bf6('0x57')][_0x2bf6('0x60')]||_0x5e0aaa['user']['id'];return db[_0x2bf6('0x3d')][_0x2bf6('0x55')]({'where':{'id':_0x5e0aaa[_0x2bf6('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x2bf6('0x61')],'as':'Contact'}]})[_0x2bf6('0x23')](handleEntityNotFound(_0x36e893,null))[_0x2bf6('0x23')](saveUpdates(_0x5e0aaa[_0x2bf6('0x57')],null))['then'](function(_0x25dd19){if(_0x25dd19){_0x50ae60[_0x2bf6('0x2b')]=_0x25dd19['get']({'plain':!![]});return db[_0x2bf6('0x62')][_0x2bf6('0x55')]({'where':{'id':_0x25dd19[_0x2bf6('0x63')]}});}return null;})[_0x2bf6('0x23')](handleEntityNotFound(_0x36e893,null))[_0x2bf6('0x23')](function(_0x1ade55){if(_0x1ade55){return _0x1ade55[_0x2bf6('0x58')]({'UserId':_0x5e0aaa['body']['UserId'],'read1stAt':_[_0x2bf6('0x64')](_0x1ade55[_0x2bf6('0x65')])?moment()[_0x2bf6('0x5e')](_0x2bf6('0x5f')):undefined});}return null;})[_0x2bf6('0x23')](function(_0x246958){if(_0x246958){_0x50ae60[_0x2bf6('0x66')]=_0x246958[_0x2bf6('0x67')]({'plain':!![]});interaction_log[_0x2bf6('0x24')](_0x2bf6('0x68'),_0x5e0aaa[_0x2bf6('0x69')]['id'],_0x5e0aaa[_0x2bf6('0x69')][_0x2bf6('0x39')],_0x5e0aaa['user'][_0x2bf6('0x6a')],_0x50ae60['interaction']['id'],_0x5e0aaa[_0x2bf6('0x57')]?JSON[_0x2bf6('0x6b')](_0x5e0aaa['body']):_0x2bf6('0x6c'));return respondWithRpcPromise(_0x2bf6('0x6d'),'acceptMessage',_0x50ae60);}return null;})[_0x2bf6('0x23')](function(_0x16fba3){if(_0x16fba3){if(_0x5e0aaa[_0x2bf6('0x57')][_0x2bf6('0x6e')]){_0x50ae60['message'][_0x2bf6('0x6f')]=util[_0x2bf6('0x5e')](_0x2bf6('0x70'),_0x5e0aaa[_0x2bf6('0x69')][_0x2bf6('0x39')]);_0x50ae60[_0x2bf6('0x2b')][_0x2bf6('0x71')]=_0x50ae60[_0x2bf6('0x71')];_0x50ae60[_0x2bf6('0x2b')]['event']='accept';return respondWithRpcPromise(_0x2bf6('0x72'),_0x2bf6('0x72'),{'event':_0x2bf6('0x73'),'message':_0x50ae60[_0x2bf6('0x2b')]},client9002)[_0x2bf6('0x23')](function(){return _0x50ae60;});}return _0x50ae60;}return null;})['then'](respondWithResult(_0x36e893,null))[_0x2bf6('0x52')](handleError(_0x36e893,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x2bf6('0x74')]=function(_0x1ca08c,_0x1833f4,_0x19f16d){var _0x1b4574={'agent':{},'channel':_0x2bf6('0x5c')};if(_0x1ca08c[_0x2bf6('0x57')]['id']){delete _0x1ca08c[_0x2bf6('0x57')]['id'];}_0x1ca08c[_0x2bf6('0x57')][_0x2bf6('0x60')]=_0x1ca08c[_0x2bf6('0x57')]['UserId']||_0x1ca08c[_0x2bf6('0x69')]['id'];_0x1b4574[_0x2bf6('0x75')]['id']=_0x1ca08c[_0x2bf6('0x57')][_0x2bf6('0x60')];return db[_0x2bf6('0x3d')][_0x2bf6('0x55')]({'where':{'id':_0x1ca08c[_0x2bf6('0x54')]['id'],'UserId':null}})[_0x2bf6('0x23')](handleEntityNotFound(_0x1833f4,null))[_0x2bf6('0x23')](function(_0x1654d2){if(_0x1654d2){_0x1b4574['message']=_0x1654d2[_0x2bf6('0x67')]({'plain':!![]});return db[_0x2bf6('0x62')][_0x2bf6('0x55')]({'where':{'id':_0x1654d2['WhatsappInteractionId']}});}return null;})[_0x2bf6('0x23')](handleEntityNotFound(_0x1833f4,null))[_0x2bf6('0x23')](function(_0x39ec62){if(_0x39ec62){_0x1b4574[_0x2bf6('0x66')]=_0x39ec62[_0x2bf6('0x67')]({'plain':!![]});interaction_log[_0x2bf6('0x24')](_0x2bf6('0x76'),_0x1ca08c[_0x2bf6('0x69')]['id'],_0x1ca08c['user']['name'],_0x1ca08c[_0x2bf6('0x69')][_0x2bf6('0x6a')],_0x1b4574[_0x2bf6('0x66')]['id'],_0x1ca08c[_0x2bf6('0x57')]?JSON['stringify'](_0x1ca08c[_0x2bf6('0x57')]):'null');return respondWithRpcPromise(_0x2bf6('0x77'),_0x2bf6('0x78'),_0x1b4574);}return null;})[_0x2bf6('0x23')](function(_0x4b1d54){if(_0x4b1d54){_0x4b1d54['message'][_0x2bf6('0x6f')]=util[_0x2bf6('0x5e')](_0x2bf6('0x70'),_0x1ca08c['user'][_0x2bf6('0x39')]);_0x4b1d54[_0x2bf6('0x2b')][_0x2bf6('0x71')]=_0x1b4574[_0x2bf6('0x71')];_0x4b1d54[_0x2bf6('0x2b')][_0x2bf6('0x79')]=_0x2bf6('0x74');respondWithRpcPromise(_0x2bf6('0x72'),'EventManager',{'event':_0x2bf6('0x7a'),'message':_0x4b1d54[_0x2bf6('0x2b')]},client9002);return _0x1b4574;}return null;})[_0x2bf6('0x23')](respondWithResult(_0x1833f4,null))[_0x2bf6('0x52')](handleError(_0x1833f4,null));};exports[_0x2bf6('0x2f')]=function(_0x113031,_0x599d0f,_0x51af05){if(_0x113031['body']['id']){delete _0x113031[_0x2bf6('0x57')]['id'];}var _0x3ca2ea;return db[_0x2bf6('0x3d')]['find']({'where':{'id':_0x113031['params']['id']}})['then'](handleEntityNotFound(_0x599d0f,null))[_0x2bf6('0x23')](function(_0x28920b){if(_0x28920b){_0x3ca2ea=_0x28920b;return db[_0x2bf6('0x7b')]['find']({'where':{'id':_0x28920b['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x599d0f,null))['then'](function(_0xc0d60e){if(_0xc0d60e){logger[_0x2bf6('0x27')](_0x2bf6('0x7c'),_0x2bf6('0x2f'),'received\x20delivery\x20report\x20from',_0xc0d60e['type'],util['inspect'](_0x113031['body'],{'showHidden':![],'depth':null}));switch(_0xc0d60e[_0x2bf6('0x4d')]){case _0x2bf6('0x7d'):if(_0x113031[_0x2bf6('0x57')][_0x2bf6('0x7e')]&&_0x113031[_0x2bf6('0x57')]['MessageSid']===_0x3ca2ea[_0x2bf6('0x7f')]&&_0x113031[_0x2bf6('0x57')][_0x2bf6('0x80')]&&_0x113031['body']['MessageStatus']==='read'){return _0x3ca2ea[_0x2bf6('0x58')]({'read':!![]});}else{logger[_0x2bf6('0x29')](_0x2bf6('0x81'),_0x2bf6('0x2f'),_0x2bf6('0x7d'),util[_0x2bf6('0x82')](_0x113031[_0x2bf6('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x3ca2ea;}})[_0x2bf6('0x23')](respondWithResult(_0x599d0f,null))[_0x2bf6('0x52')](handleError(_0x599d0f,null));}; \ No newline at end of file +var _0x32bd=['options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge'];(function(_0x335b2e,_0x3eac85){var _0x4b2a4f=function(_0x51345a){while(--_0x51345a){_0x335b2e['push'](_0x335b2e['shift']());}};_0x4b2a4f(++_0x3eac85);}(_0x32bd,0x1cc));var _0xd32b=function(_0x4b4615,_0x187e31){_0x4b4615=_0x4b4615-0x0;var _0x5e69aa=_0x32bd[_0x4b4615];return _0x5e69aa;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd32b('0x0'));var zipdir=require(_0xd32b('0x1'));var jsonpatch=require(_0xd32b('0x2'));var rp=require(_0xd32b('0x3'));var moment=require(_0xd32b('0x4'));var BPromise=require(_0xd32b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd32b('0x6'));var sox=require(_0xd32b('0x7'));var csv=require(_0xd32b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd32b('0x9'));var squel=require(_0xd32b('0xa'));var crypto=require(_0xd32b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd32b('0xc'));var toCsv=require(_0xd32b('0x8'));var querystring=require(_0xd32b('0xd'));var Papa=require(_0xd32b('0xe'));var Redis=require(_0xd32b('0xf'));var authService=require(_0xd32b('0x10'));var qs=require(_0xd32b('0x11'));var as=require(_0xd32b('0x12'));var hardwareService=require(_0xd32b('0x13'));var logger=require(_0xd32b('0x14'))(_0xd32b('0x15'));var utils=require(_0xd32b('0x16'));var config=require(_0xd32b('0x17'));var db=require(_0xd32b('0x18'))['db'];config[_0xd32b('0x19')]=_[_0xd32b('0x1a')](config[_0xd32b('0x19')],{'host':_0xd32b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd32b('0x19')]));require(_0xd32b('0x1c'))[_0xd32b('0x1d')](socket);var jayson=require(_0xd32b('0x1e'));var client=jayson[_0xd32b('0x1f')][_0xd32b('0x20')]({'port':0x232c});var client9002=jayson[_0xd32b('0x1f')][_0xd32b('0x20')]({'port':0x232a});function checkPasswordPattern(_0x24b99c,_0x32a55f,_0x2e9b64){if(_0x2e9b64){var _0x3997e7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3997e7[_0xd32b('0x21')](_0x32a55f)){return _0x24b99c;}else{throw new db[(_0xd32b('0x22'))]['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~!@#$%^&-_=+[{]}.');}}else{return _0x24b99c;}}function respondWithRpcPromise(_0x5b1865,_0x2088fe,_0x3a632f,_0x36752a){return new BPromise(function(_0x1369f5,_0x30b2a1){var _0xadc6d6=_0x36752a||client;return _0xadc6d6[_0xd32b('0x23')](_0x5b1865,_0x3a632f)['then'](function(_0x593064){logger[_0xd32b('0x24')](_0xd32b('0x25'),_0x2088fe,_0xd32b('0x26'));logger[_0xd32b('0x27')](_0xd32b('0x28'),_0x2088fe,_0xd32b('0x26'),JSON[_0xd32b('0x29')](_0x593064));if(_0x593064[_0xd32b('0x2a')]){if(_0x593064[_0xd32b('0x2a')]['code']===0x1f4){logger[_0xd32b('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x2088fe,_0x593064[_0xd32b('0x2a')][_0xd32b('0x2b')]);return _0x30b2a1(_0x593064[_0xd32b('0x2a')][_0xd32b('0x2b')]);}logger[_0xd32b('0x2a')](_0xd32b('0x25'),_0x2088fe,_0x593064[_0xd32b('0x2a')][_0xd32b('0x2b')]);return _0x1369f5(_0x593064[_0xd32b('0x2a')][_0xd32b('0x2b')]);}else{logger[_0xd32b('0x24')](_0xd32b('0x25'),_0x2088fe,_0xd32b('0x26'));_0x1369f5(_0x593064['result'][_0xd32b('0x2b')]);}})[_0xd32b('0x2c')](function(_0x4b1ccf){logger[_0xd32b('0x2a')](_0xd32b('0x25'),_0x2088fe,_0x4b1ccf);_0x30b2a1(_0x4b1ccf);});});}function respondWithStatusCode(_0x591d99,_0x1ef886){_0x1ef886=_0x1ef886||0xcc;return function(_0x213bf2){if(_0x213bf2){return _0x591d99[_0xd32b('0x2d')](_0x1ef886);}return _0x591d99[_0xd32b('0x2e')](_0x1ef886)[_0xd32b('0x2f')]();};}function respondWithResult(_0x3f252c,_0x2a570a){_0x2a570a=_0x2a570a||0xc8;return function(_0x66f5bd){if(_0x66f5bd){return _0x3f252c[_0xd32b('0x2e')](_0x2a570a)[_0xd32b('0x30')](_0x66f5bd);}};}function respondWithFilteredResult(_0x2ef2df,_0x3c9369){return function(_0x5c8641){if(_0x5c8641){var _0x5319d6=_0x5c8641[_0xd32b('0x31')],_0x300086=_0x3c9369[_0xd32b('0x32')],_0x500763=_0x3c9369[_0xd32b('0x32')]+_0x3c9369[_0xd32b('0x33')],_0x489e84;if(_0x500763>=_0x5319d6){_0x500763=_0x5319d6;_0x489e84=0xc8;}else{_0x489e84=0xce;}_0x2ef2df['status'](_0x489e84);return _0x2ef2df[_0xd32b('0x34')]('Content-Range',_0x300086+'-'+_0x500763+'/'+_0x5319d6)[_0xd32b('0x30')](_0x5c8641);}return null;};}function patchUpdates(_0x456b93){return function(_0x4cd5b1){try{jsonpatch[_0xd32b('0x35')](_0x4cd5b1,_0x456b93,!![]);}catch(_0x42a50c){return BPromise[_0xd32b('0x36')](_0x42a50c);}return _0x4cd5b1[_0xd32b('0x37')]();};}function saveUpdates(_0x5feaae,_0x12f8b2){return function(_0x24fb69){if(_0x24fb69){return _0x24fb69[_0xd32b('0x38')](_0x5feaae)['then'](function(_0x554325){return _0x554325;});}return null;};}function removeEntity(_0x343539,_0xbd1366){return function(_0x1e67a0){if(_0x1e67a0){return _0x1e67a0['destroy']()[_0xd32b('0x39')](function(){_0x343539[_0xd32b('0x2e')](0xcc)[_0xd32b('0x2f')]();});}};}function handleEntityNotFound(_0x20d680,_0x145cb4){return function(_0x1d33bb){if(!_0x1d33bb){_0x20d680[_0xd32b('0x2d')](0x194);}return _0x1d33bb;};}function handleError(_0x4bda91,_0x4b4890){_0x4b4890=_0x4b4890||0x1f4;return function(_0x2a2e2e){logger[_0xd32b('0x2a')](_0x2a2e2e[_0xd32b('0x3a')]);if(_0x2a2e2e[_0xd32b('0x3b')]){delete _0x2a2e2e['name'];}_0x4bda91[_0xd32b('0x2e')](_0x4b4890)[_0xd32b('0x3c')](_0x2a2e2e);};}exports[_0xd32b('0x3d')]=function(_0x22e728,_0x524ba4){var _0x1ccd0a={},_0x31d1cb={},_0x1ab061={'count':0x0,'rows':[]};var _0x597ae4=_['map'](db[_0xd32b('0x3e')][_0xd32b('0x3f')],function(_0x49b305){return{'name':_0x49b305[_0xd32b('0x40')],'type':_0x49b305[_0xd32b('0x41')]['key']};});_0x31d1cb[_0xd32b('0x42')]=_[_0xd32b('0x43')](_0x597ae4,_0xd32b('0x3b'));_0x31d1cb[_0xd32b('0x44')]=_[_0xd32b('0x45')](_0x22e728[_0xd32b('0x44')]);_0x31d1cb['filters']=_[_0xd32b('0x46')](_0x31d1cb[_0xd32b('0x42')],_0x31d1cb[_0xd32b('0x44')]);_0x1ccd0a[_0xd32b('0x47')]=_['intersection'](_0x31d1cb[_0xd32b('0x42')],qs[_0xd32b('0x48')](_0x22e728['query'][_0xd32b('0x48')]));_0x1ccd0a[_0xd32b('0x47')]=_0x1ccd0a['attributes'][_0xd32b('0x49')]?_0x1ccd0a[_0xd32b('0x47')]:_0x31d1cb[_0xd32b('0x42')];if(!_0x22e728[_0xd32b('0x44')][_0xd32b('0x4a')](_0xd32b('0x4b'))){_0x1ccd0a['limit']=qs[_0xd32b('0x33')](_0x22e728[_0xd32b('0x44')][_0xd32b('0x33')]);_0x1ccd0a[_0xd32b('0x32')]=qs['offset'](_0x22e728[_0xd32b('0x44')][_0xd32b('0x32')]);}_0x1ccd0a[_0xd32b('0x4c')]=qs['sort'](_0x22e728[_0xd32b('0x44')][_0xd32b('0x4d')]);_0x1ccd0a[_0xd32b('0x4e')]=qs[_0xd32b('0x4f')](_[_0xd32b('0x50')](_0x22e728[_0xd32b('0x44')],_0x31d1cb[_0xd32b('0x4f')]),_0x597ae4);if(_0x22e728[_0xd32b('0x44')][_0xd32b('0x51')]){_0x1ccd0a['where']=_['merge'](_0x1ccd0a['where'],{'$or':_[_0xd32b('0x43')](_0x597ae4,function(_0x57eeff){if(_0x57eeff[_0xd32b('0x41')]!==_0xd32b('0x52')){var _0xf7aea0={};_0xf7aea0[_0x57eeff['name']]={'$like':'%'+_0x22e728['query'][_0xd32b('0x51')]+'%'};return _0xf7aea0;}})});}_0x1ccd0a=_[_0xd32b('0x53')]({},_0x1ccd0a,_0x22e728[_0xd32b('0x54')]);var _0x4c7eb2={'where':_0x1ccd0a[_0xd32b('0x4e')]};return db[_0xd32b('0x3e')][_0xd32b('0x31')](_0x4c7eb2)[_0xd32b('0x39')](function(_0x22e59f){_0x1ab061[_0xd32b('0x31')]=_0x22e59f;if(_0x22e728['query'][_0xd32b('0x55')]){_0x1ccd0a[_0xd32b('0x56')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xd32b('0x57')](_0x1ccd0a);})[_0xd32b('0x39')](function(_0x5248a7){_0x1ab061[_0xd32b('0x58')]=_0x5248a7;return _0x1ab061;})[_0xd32b('0x39')](respondWithFilteredResult(_0x524ba4,_0x1ccd0a))['catch'](handleError(_0x524ba4,null));};exports[_0xd32b('0x59')]=function(_0x2bf002,_0x2a0e1d){var _0x47d700={'raw':!![],'where':{'id':_0x2bf002[_0xd32b('0x5a')]['id']}},_0x45239e={};_0x45239e[_0xd32b('0x42')]=_[_0xd32b('0x45')](db['WhatsappMessage'][_0xd32b('0x3f')]);_0x45239e['query']=_[_0xd32b('0x45')](_0x2bf002[_0xd32b('0x44')]);_0x45239e['filters']=_[_0xd32b('0x46')](_0x45239e[_0xd32b('0x42')],_0x45239e['query']);_0x47d700[_0xd32b('0x47')]=_[_0xd32b('0x46')](_0x45239e['model'],qs[_0xd32b('0x48')](_0x2bf002[_0xd32b('0x44')][_0xd32b('0x48')]));_0x47d700['attributes']=_0x47d700['attributes'][_0xd32b('0x49')]?_0x47d700[_0xd32b('0x47')]:_0x45239e[_0xd32b('0x42')];if(_0x2bf002['query'][_0xd32b('0x55')]){_0x47d700[_0xd32b('0x56')]=[{'all':!![]}];}_0x47d700=_[_0xd32b('0x53')]({},_0x47d700,_0x2bf002[_0xd32b('0x54')]);return db['WhatsappMessage'][_0xd32b('0x5b')](_0x47d700)[_0xd32b('0x39')](handleEntityNotFound(_0x2a0e1d,null))[_0xd32b('0x39')](respondWithResult(_0x2a0e1d,null))[_0xd32b('0x2c')](handleError(_0x2a0e1d,null));};exports[_0xd32b('0x5c')]=function(_0x2791b4,_0x4e61ea){return db[_0xd32b('0x3e')][_0xd32b('0x5c')](_0x2791b4[_0xd32b('0x5d')],{})['then'](respondWithResult(_0x4e61ea,0xc9))[_0xd32b('0x2c')](handleError(_0x4e61ea,null));};exports[_0xd32b('0x38')]=function(_0x1fd811,_0x19b632){if(_0x1fd811['body']['id']){delete _0x1fd811[_0xd32b('0x5d')]['id'];}return db[_0xd32b('0x3e')]['find']({'where':{'id':_0x1fd811[_0xd32b('0x5a')]['id']}})[_0xd32b('0x39')](handleEntityNotFound(_0x19b632,null))['then'](saveUpdates(_0x1fd811[_0xd32b('0x5d')],null))['then'](respondWithResult(_0x19b632,null))[_0xd32b('0x2c')](handleError(_0x19b632,null));};exports[_0xd32b('0x5e')]=function(_0x45f8e3,_0x87d8a0){return db[_0xd32b('0x3e')][_0xd32b('0x5b')]({'where':{'id':_0x45f8e3['params']['id']}})[_0xd32b('0x39')](handleEntityNotFound(_0x87d8a0,null))[_0xd32b('0x39')](removeEntity(_0x87d8a0,null))[_0xd32b('0x2c')](handleError(_0x87d8a0,null));};exports[_0xd32b('0x5f')]=function(_0x48d65c,_0x5a6f0a){return db[_0xd32b('0x3e')][_0xd32b('0x5f')]()[_0xd32b('0x39')](respondWithResult(_0x5a6f0a,null))[_0xd32b('0x2c')](handleError(_0x5a6f0a,null));};var interaction_log=require(_0xd32b('0x14'))('whatsapp-interactions');exports[_0xd32b('0x60')]=function(_0x34d5bb,_0xdb226b,_0x5048b2){var _0x2a2371={'channel':_0xd32b('0x61')};if(_0x34d5bb[_0xd32b('0x5d')]['id']){delete _0x34d5bb[_0xd32b('0x5d')]['id'];}_0x34d5bb['body'][_0xd32b('0x62')]=!![];_0x34d5bb[_0xd32b('0x5d')][_0xd32b('0x63')]=moment()[_0xd32b('0x64')](_0xd32b('0x65'));_0x34d5bb['body'][_0xd32b('0x66')]=_0x34d5bb['body'][_0xd32b('0x66')]||_0x34d5bb[_0xd32b('0x67')]['id'];return db['WhatsappMessage'][_0xd32b('0x5b')]({'where':{'id':_0x34d5bb['params']['id'],'UserId':null},'include':[{'model':db[_0xd32b('0x68')],'as':_0xd32b('0x69')}]})[_0xd32b('0x39')](handleEntityNotFound(_0xdb226b,null))[_0xd32b('0x39')](saveUpdates(_0x34d5bb[_0xd32b('0x5d')],null))[_0xd32b('0x39')](function(_0x493fd0){if(_0x493fd0){_0x2a2371[_0xd32b('0x2b')]=_0x493fd0[_0xd32b('0x6a')]({'plain':!![]});return db[_0xd32b('0x6b')][_0xd32b('0x5b')]({'where':{'id':_0x493fd0[_0xd32b('0x6c')]}});}return null;})[_0xd32b('0x39')](handleEntityNotFound(_0xdb226b,null))[_0xd32b('0x39')](function(_0x454c0b){if(_0x454c0b){return _0x454c0b['update']({'UserId':_0x34d5bb['body'][_0xd32b('0x66')],'read1stAt':_[_0xd32b('0x6d')](_0x454c0b['read1stAt'])?moment()[_0xd32b('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd32b('0x39')](function(_0x18ced3){if(_0x18ced3){_0x2a2371['interaction']=_0x18ced3[_0xd32b('0x6a')]({'plain':!![]});interaction_log['info'](_0xd32b('0x6e'),_0x34d5bb[_0xd32b('0x67')]['id'],_0x34d5bb[_0xd32b('0x67')][_0xd32b('0x3b')],_0x34d5bb[_0xd32b('0x67')][_0xd32b('0x6f')],_0x2a2371[_0xd32b('0x70')]['id'],_0x34d5bb[_0xd32b('0x5d')]?JSON[_0xd32b('0x29')](_0x34d5bb['body']):'null');return respondWithRpcPromise('AcceptMessage',_0xd32b('0x71'),_0x2a2371);}return null;})[_0xd32b('0x39')](function(_0x2c2a76){if(_0x2c2a76){if(_0x34d5bb[_0xd32b('0x5d')][_0xd32b('0x72')]){_0x2a2371[_0xd32b('0x2b')][_0xd32b('0x73')]=util['format'](_0xd32b('0x74'),_0x34d5bb[_0xd32b('0x67')][_0xd32b('0x3b')]);_0x2a2371[_0xd32b('0x2b')][_0xd32b('0x75')]=_0x2a2371[_0xd32b('0x75')];_0x2a2371[_0xd32b('0x2b')][_0xd32b('0x76')]=_0xd32b('0x60');return respondWithRpcPromise(_0xd32b('0x77'),_0xd32b('0x77'),{'event':_0xd32b('0x78'),'message':_0x2a2371[_0xd32b('0x2b')]},client9002)['then'](function(){return _0x2a2371;});}return _0x2a2371;}return null;})[_0xd32b('0x39')](respondWithResult(_0xdb226b,null))[_0xd32b('0x2c')](handleError(_0xdb226b,null));};var interaction_log=require('../../config/logger')(_0xd32b('0x79'));exports['reject']=function(_0x4fa20e,_0x591f96,_0x18884d){var _0x3cf477={'agent':{},'channel':_0xd32b('0x61')};if(_0x4fa20e['body']['id']){delete _0x4fa20e[_0xd32b('0x5d')]['id'];}_0x4fa20e[_0xd32b('0x5d')]['UserId']=_0x4fa20e['body'][_0xd32b('0x66')]||_0x4fa20e[_0xd32b('0x67')]['id'];_0x3cf477['agent']['id']=_0x4fa20e[_0xd32b('0x5d')][_0xd32b('0x66')];return db[_0xd32b('0x3e')]['find']({'where':{'id':_0x4fa20e[_0xd32b('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x591f96,null))['then'](function(_0x3e356a){if(_0x3e356a){_0x3cf477[_0xd32b('0x2b')]=_0x3e356a[_0xd32b('0x6a')]({'plain':!![]});return db[_0xd32b('0x6b')]['find']({'where':{'id':_0x3e356a[_0xd32b('0x6c')]}});}return null;})[_0xd32b('0x39')](handleEntityNotFound(_0x591f96,null))[_0xd32b('0x39')](function(_0x45abe9){if(_0x45abe9){_0x3cf477[_0xd32b('0x70')]=_0x45abe9[_0xd32b('0x6a')]({'plain':!![]});interaction_log[_0xd32b('0x24')](_0xd32b('0x7a'),_0x4fa20e[_0xd32b('0x67')]['id'],_0x4fa20e[_0xd32b('0x67')][_0xd32b('0x3b')],_0x4fa20e[_0xd32b('0x67')][_0xd32b('0x6f')],_0x3cf477[_0xd32b('0x70')]['id'],_0x4fa20e['body']?JSON[_0xd32b('0x29')](_0x4fa20e[_0xd32b('0x5d')]):_0xd32b('0x7b'));return respondWithRpcPromise(_0xd32b('0x7c'),_0xd32b('0x7d'),_0x3cf477);}return null;})['then'](function(_0x1f5e84){if(_0x1f5e84){_0x1f5e84['message'][_0xd32b('0x73')]=util[_0xd32b('0x64')](_0xd32b('0x74'),_0x4fa20e[_0xd32b('0x67')][_0xd32b('0x3b')]);_0x1f5e84[_0xd32b('0x2b')][_0xd32b('0x75')]=_0x3cf477[_0xd32b('0x75')];_0x1f5e84[_0xd32b('0x2b')][_0xd32b('0x76')]=_0xd32b('0x36');respondWithRpcPromise('EventManager',_0xd32b('0x77'),{'event':'rejectmessage','message':_0x1f5e84[_0xd32b('0x2b')]},client9002);return _0x3cf477;}return null;})[_0xd32b('0x39')](respondWithResult(_0x591f96,null))[_0xd32b('0x2c')](handleError(_0x591f96,null));};exports[_0xd32b('0x2e')]=function(_0x16cdb1,_0x2b125d,_0x2b23b4){if(_0x16cdb1[_0xd32b('0x5d')]['id']){delete _0x16cdb1[_0xd32b('0x5d')]['id'];}var _0x37a9de;return db[_0xd32b('0x3e')]['find']({'where':{'id':_0x16cdb1[_0xd32b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2b125d,null))['then'](function(_0x4ed325){if(_0x4ed325){_0x37a9de=_0x4ed325;return db[_0xd32b('0x7e')][_0xd32b('0x5b')]({'where':{'id':_0x4ed325[_0xd32b('0x7f')]}});}})[_0xd32b('0x39')](handleEntityNotFound(_0x2b125d,null))['then'](function(_0x2aadbb){if(_0x2aadbb){logger[_0xd32b('0x27')](_0xd32b('0x80'),_0xd32b('0x2e'),_0xd32b('0x81'),_0x2aadbb[_0xd32b('0x41')],util[_0xd32b('0x82')](_0x16cdb1[_0xd32b('0x5d')],{'showHidden':![],'depth':null}));switch(_0x2aadbb['type']){case _0xd32b('0x83'):if(_0x16cdb1['body'][_0xd32b('0x84')]&&_0x16cdb1['body'][_0xd32b('0x84')]===_0x37a9de[_0xd32b('0x85')]&&_0x16cdb1[_0xd32b('0x5d')]['MessageStatus']&&_0x16cdb1['body'][_0xd32b('0x86')]===_0xd32b('0x62')){return _0x37a9de[_0xd32b('0x38')]({'read':!![]});}else{logger[_0xd32b('0x2a')](_0xd32b('0x87'),_0xd32b('0x2e'),_0xd32b('0x83'),util[_0xd32b('0x82')](_0x16cdb1['body'],{'showHidden':![],'depth':null}));}break;}return _0x37a9de;}})[_0xd32b('0x39')](respondWithResult(_0x2b125d,null))[_0xd32b('0x2c')](handleError(_0x2b125d,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d675d1c..9a9ef6d 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x37ea9e,_0x1e5188){var _0x25c99c=function(_0x105c02){while(--_0x105c02){_0x37ea9e['push'](_0x37ea9e['shift']());}};_0x25c99c(++_0x1e5188);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2cd9f6,_0x450d32){_0x2cd9f6=_0x2cd9f6-0x0;var _0x35182a=_0x5f2f[_0x2cd9f6];return _0x35182a;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x5e3fe1,_0x35507f){var _0x3d2113=function(_0x2e3cce){while(--_0x2e3cce){_0x5e3fe1['push'](_0x5e3fe1['shift']());}};_0x3d2113(++_0x35507f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x38cbb4,_0x9d99d3){_0x38cbb4=_0x38cbb4-0x0;var _0x5bf594=_0x5f2f[_0x38cbb4];return _0x5bf594;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 908b416..eebceb5 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 _0x250f=['whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','update','createdAt','catch','find','WhatsappAccountId','type','twilio','accountSid','authToken','create','whatsapp:','phone','/status?token=','token','sid','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage'];(function(_0x37a111,_0xbe55cb){var _0x304ba1=function(_0x494c41){while(--_0x494c41){_0x37a111['push'](_0x37a111['shift']());}};_0x304ba1(++_0xbe55cb);}(_0x250f,0xe8));var _0xf250=function(_0xa2255f,_0x3e3d84){_0xa2255f=_0xa2255f-0x0;var _0x48ebc6=_0x250f[_0xa2255f];return _0x48ebc6;};'use strict';var _=require(_0xf250('0x0'));var util=require(_0xf250('0x1'));var logger=require(_0xf250('0x2'))('api');var moment=require(_0xf250('0x3'));var BPromise=require(_0xf250('0x4'));var rp=require(_0xf250('0x5'));var fs=require('fs');var path=require(_0xf250('0x6'));var rimraf=require(_0xf250('0x7'));var config=require(_0xf250('0x8'));var attributes=require(_0xf250('0x9'));module[_0xf250('0xa')]=function(_0x5cfb51,_0x2aec5c){return _0x5cfb51[_0xf250('0xb')](_0xf250('0xc'),attributes,{'tableName':_0xf250('0xd'),'paranoid':![],'indexes':[{'name':_0xf250('0xe'),'fields':[_0xf250('0xe')]},{'name':_0xf250('0xf'),'fields':[_0xf250('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x284d34,_0x53e729,_0x386c85){var _0x450b0f=_0x5cfb51[_0xf250('0x11')];var _0x557d43=_0x284d34[_0xf250('0x12')]({'plain':!![]});if(_0x557d43[_0xf250('0x13')][_0xf250('0x14')]()==='in'||_0x557d43[_0xf250('0x13')][_0xf250('0x14')]()===_0xf250('0x15')&&!_0x557d43[_0xf250('0x16')]&&!_[_0xf250('0x17')](_0x557d43[_0xf250('0x18')])){_0x450b0f[_0xf250('0x19')]['findOne']({'where':{'id':_0x557d43[_0xf250('0x1a')]}})['then'](function(_0x290fd9){if(_0x290fd9){_0x290fd9[_0xf250('0x1b')]({'lastMsgAt':_0x557d43[_0xf250('0x1c')],'lastMsgDirection':_0x557d43[_0xf250('0x13')][_0xf250('0x14')]()});}})[_0xf250('0x1d')](function(_0x49f761){console['error'](_0x49f761);});}if(_0x557d43['direction']===_0xf250('0x15')&&!_0x557d43[_0xf250('0x16')]){var _0x3a8bf3;_0x450b0f['WhatsappAccount'][_0xf250('0x1e')]({'where':{'id':_0x557d43[_0xf250('0x1f')]},'raw':!![]})['then'](function(_0x5711e8){_0x3a8bf3=_0x5711e8;if(_0x3a8bf3&&_0x3a8bf3[_0xf250('0x20')]){switch(_0x3a8bf3['type']){case _0xf250('0x21'):var _0x4a0104=require('twilio');if(_0x3a8bf3[_0xf250('0x22')]&&_0x3a8bf3[_0xf250('0x23')]&&_0x3a8bf3['phone']){var _0x290f74=new _0x4a0104(_0x3a8bf3[_0xf250('0x22')],_0x3a8bf3[_0xf250('0x23')]);_0x290f74['messages'][_0xf250('0x24')]({'body':_0x557d43[_0xf250('0x10')],'to':_0xf250('0x25')+_0x557d43[_0xf250('0x26')],'from':_0xf250('0x25')+_0x3a8bf3['phone'],'statusCallback':_0x3a8bf3['remote']+'/api/whatsapp/messages/'+_0x557d43['id']+_0xf250('0x27')+_0x3a8bf3[_0xf250('0x28')]})['then'](function(_0x3fe541){if(_0x3fe541[_0xf250('0x29')]){return _0x284d34[_0xf250('0x1b')]({'messageId':_0x3fe541[_0xf250('0x29')]});}})[_0xf250('0x1d')](function(_0x49c4e2){logger[_0xf250('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xf250('0x2b'),'twilio',util[_0xf250('0x2c')](_0x49c4e2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf250('0x2d'),_0xf250('0x2b'),_0xf250('0x21'),_0xf250('0x2e'));}break;}}})[_0xf250('0x2f')](function(){_0x386c85();});}else{_0x386c85();}}},'charset':_0xf250('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x64ba=['secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','catch','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','authToken','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','WhatsappMessage','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase'];(function(_0x651410,_0x385551){var _0x3987c8=function(_0x433249){while(--_0x433249){_0x651410['push'](_0x651410['shift']());}};_0x3987c8(++_0x385551);}(_0x64ba,0xcf));var _0xa64b=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x64ba[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0xa64b('0x0'));var util=require(_0xa64b('0x1'));var logger=require(_0xa64b('0x2'))(_0xa64b('0x3'));var moment=require(_0xa64b('0x4'));var BPromise=require(_0xa64b('0x5'));var rp=require(_0xa64b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa64b('0x7'));var config=require(_0xa64b('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0xa64b('0x9')]=function(_0xd0ef53,_0x217f16){return _0xd0ef53['define'](_0xa64b('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xa64b('0xb'),'fields':[_0xa64b('0xc')],'type':_0xa64b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21fc6d,_0x47d3cf,_0x23dea1){var _0x359df6=_0xd0ef53[_0xa64b('0xe')];var _0x19d6c3=_0x21fc6d[_0xa64b('0xf')]({'plain':!![]});if(_0x19d6c3[_0xa64b('0x10')][_0xa64b('0x11')]()==='in'||_0x19d6c3[_0xa64b('0x10')][_0xa64b('0x11')]()==='out'&&!_0x19d6c3[_0xa64b('0x12')]&&!_[_0xa64b('0x13')](_0x19d6c3[_0xa64b('0x14')])){_0x359df6['WhatsappInteraction'][_0xa64b('0x15')]({'where':{'id':_0x19d6c3[_0xa64b('0x16')]}})[_0xa64b('0x17')](function(_0x2bbaca){if(_0x2bbaca){_0x2bbaca[_0xa64b('0x18')]({'lastMsgAt':_0x19d6c3['createdAt'],'lastMsgDirection':_0x19d6c3[_0xa64b('0x10')]['toLowerCase']()});}})[_0xa64b('0x19')](function(_0x5aab51){console['error'](_0x5aab51);});}if(_0x19d6c3[_0xa64b('0x10')]==='out'&&!_0x19d6c3['secret']){var _0x1d4292;_0x359df6[_0xa64b('0x1a')][_0xa64b('0x1b')]({'where':{'id':_0x19d6c3[_0xa64b('0x1c')]},'raw':!![]})[_0xa64b('0x17')](function(_0x577e18){_0x1d4292=_0x577e18;if(_0x1d4292&&_0x1d4292['type']){switch(_0x1d4292['type']){case _0xa64b('0x1d'):var _0x51e868=require('twilio');if(_0x1d4292[_0xa64b('0x1e')]&&_0x1d4292[_0xa64b('0x1f')]&&_0x1d4292[_0xa64b('0x20')]){var _0x2d1f78=new _0x51e868(_0x1d4292[_0xa64b('0x1e')],_0x1d4292['authToken']);_0x2d1f78['messages']['create']({'body':_0x19d6c3[_0xa64b('0xc')],'to':_0xa64b('0x21')+_0x19d6c3[_0xa64b('0x20')],'from':'whatsapp:'+_0x1d4292[_0xa64b('0x20')],'statusCallback':_0x1d4292[_0xa64b('0x22')]+_0xa64b('0x23')+_0x19d6c3['id']+_0xa64b('0x24')+_0x1d4292['token']})[_0xa64b('0x17')](function(_0x1d1e56){if(_0x1d1e56['sid']){return _0x21fc6d[_0xa64b('0x18')]({'messageId':_0x1d1e56[_0xa64b('0x25')]});}})[_0xa64b('0x19')](function(_0x17d6ce){logger[_0xa64b('0x26')](_0xa64b('0x27'),_0xa64b('0x28'),_0xa64b('0x1d'),util[_0xa64b('0x29')](_0x17d6ce,{'showHidden':![],'depth':null}));});}else{logger[_0xa64b('0x26')](_0xa64b('0x27'),_0xa64b('0x28'),'twilio',_0xa64b('0x2a'));}break;}}})[_0xa64b('0x2b')](function(){_0x23dea1();});}else{_0x23dea1();}}},'charset':'utf8mb4','collate':_0xa64b('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 8f66caa..d16f438 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 _0xf4ec=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x33bf01,_0x1898f9){var _0x1d1cd2=function(_0x21dbc1){while(--_0x21dbc1){_0x33bf01['push'](_0x33bf01['shift']());}};_0x1d1cd2(++_0x1898f9);}(_0xf4ec,0xb9));var _0xcf4e=function(_0x245cfa,_0x4cdb18){_0x245cfa=_0x245cfa-0x0;var _0x111751=_0xf4ec[_0x245cfa];return _0x111751;};'use strict';var _=require(_0xcf4e('0x0'));var util=require(_0xcf4e('0x1'));var moment=require(_0xcf4e('0x2'));var BPromise=require(_0xcf4e('0x3'));var rs=require(_0xcf4e('0x4'));var fs=require('fs');var Redis=require(_0xcf4e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcf4e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf4e('0x7'));var client=jayson[_0xcf4e('0x8')][_0xcf4e('0x9')]({'port':0x232a});config[_0xcf4e('0xa')]=_['defaults'](config[_0xcf4e('0xa')],{'host':_0xcf4e('0xb'),'port':0x18eb});var socket=require(_0xcf4e('0xc'))(new Redis(config[_0xcf4e('0xa')]));require(_0xcf4e('0xd'))['register'](socket);function respondWithRpcPromise(_0x5e1cb1,_0x55a3e7,_0x58dff1){return new BPromise(function(_0x4ce313,_0x4c79f0){return client[_0xcf4e('0xe')](_0x5e1cb1,_0x58dff1)[_0xcf4e('0xf')](function(_0xf2e70c){logger[_0xcf4e('0x10')](_0xcf4e('0x11'),_0x55a3e7,_0xcf4e('0x12'));logger['debug'](_0xcf4e('0x13'),_0x55a3e7,_0xcf4e('0x12'),JSON[_0xcf4e('0x14')](_0xf2e70c));if(_0xf2e70c[_0xcf4e('0x15')]){if(_0xf2e70c[_0xcf4e('0x15')][_0xcf4e('0x16')]===0x1f4){logger[_0xcf4e('0x15')](_0xcf4e('0x11'),_0x55a3e7,_0xf2e70c[_0xcf4e('0x15')][_0xcf4e('0x17')]);return _0x4c79f0(_0xf2e70c[_0xcf4e('0x15')][_0xcf4e('0x17')]);}logger[_0xcf4e('0x15')](_0xcf4e('0x11'),_0x55a3e7,_0xf2e70c[_0xcf4e('0x15')][_0xcf4e('0x17')]);return _0x4ce313(_0xf2e70c[_0xcf4e('0x15')][_0xcf4e('0x17')]);}else{logger[_0xcf4e('0x10')](_0xcf4e('0x11'),_0x55a3e7,_0xcf4e('0x12'));_0x4ce313(_0xf2e70c['result'][_0xcf4e('0x17')]);}})['catch'](function(_0x193283){logger[_0xcf4e('0x15')](_0xcf4e('0x11'),_0x55a3e7,_0x193283);_0x4c79f0(_0x193283);});});}exports[_0xcf4e('0x18')]=function(_0x4c59de){var _0x46c306=this;return new Promise(function(_0x3e06f5,_0xae74){return db[_0xcf4e('0x19')][_0xcf4e('0x1a')](_0x4c59de[_0xcf4e('0x1b')],{'raw':_0x4c59de[_0xcf4e('0x1c')]?_0x4c59de[_0xcf4e('0x1c')][_0xcf4e('0x1d')]===undefined?!![]:![]:!![]})[_0xcf4e('0xf')](function(_0x35d59f){logger[_0xcf4e('0x10')]('CreateWhatsappMessage',_0x4c59de);logger[_0xcf4e('0x1e')](_0xcf4e('0x18'),_0x4c59de,JSON[_0xcf4e('0x14')](_0x35d59f));_0x3e06f5(_0x35d59f);})[_0xcf4e('0x1f')](function(_0x371dd5){logger['error'](_0xcf4e('0x18'),_0x371dd5[_0xcf4e('0x17')],_0x4c59de);_0xae74(_0x46c306['error'](0x1f4,_0x371dd5[_0xcf4e('0x17')]));});});}; \ No newline at end of file +var _0xcff0=['then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','body','options','raw','CreateWhatsappMessage','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','request'];(function(_0x1eb91b,_0x2be099){var _0x474602=function(_0x18783b){while(--_0x18783b){_0x1eb91b['push'](_0x1eb91b['shift']());}};_0x474602(++_0x2be099);}(_0xcff0,0x183));var _0x0cff=function(_0xdb193a,_0x54c0e4){_0xdb193a=_0xdb193a-0x0;var _0xe27e12=_0xcff0[_0xdb193a];return _0xe27e12;};'use strict';var _=require(_0x0cff('0x0'));var util=require(_0x0cff('0x1'));var moment=require('moment');var BPromise=require(_0x0cff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cff('0x3'))['db'];var utils=require(_0x0cff('0x4'));var logger=require(_0x0cff('0x5'))(_0x0cff('0x6'));var config=require(_0x0cff('0x7'));var jayson=require(_0x0cff('0x8'));var client=jayson[_0x0cff('0x9')][_0x0cff('0xa')]({'port':0x232a});config['redis']=_[_0x0cff('0xb')](config[_0x0cff('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0cff('0xd'))(new Redis(config[_0x0cff('0xc')]));require(_0x0cff('0xe'))['register'](socket);function respondWithRpcPromise(_0xb3f794,_0x1c41a4,_0x2d50c3){return new BPromise(function(_0x4f9066,_0x4d0d8f){return client[_0x0cff('0xf')](_0xb3f794,_0x2d50c3)[_0x0cff('0x10')](function(_0x10ba51){logger[_0x0cff('0x11')](_0x0cff('0x12'),_0x1c41a4,_0x0cff('0x13'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1c41a4,_0x0cff('0x13'),JSON[_0x0cff('0x14')](_0x10ba51));if(_0x10ba51[_0x0cff('0x15')]){if(_0x10ba51[_0x0cff('0x15')][_0x0cff('0x16')]===0x1f4){logger[_0x0cff('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x1c41a4,_0x10ba51[_0x0cff('0x15')][_0x0cff('0x17')]);return _0x4d0d8f(_0x10ba51[_0x0cff('0x15')]['message']);}logger[_0x0cff('0x15')](_0x0cff('0x12'),_0x1c41a4,_0x10ba51[_0x0cff('0x15')][_0x0cff('0x17')]);return _0x4f9066(_0x10ba51[_0x0cff('0x15')][_0x0cff('0x17')]);}else{logger['info'](_0x0cff('0x12'),_0x1c41a4,_0x0cff('0x13'));_0x4f9066(_0x10ba51[_0x0cff('0x18')][_0x0cff('0x17')]);}})[_0x0cff('0x19')](function(_0x1c9d6c){logger[_0x0cff('0x15')](_0x0cff('0x12'),_0x1c41a4,_0x1c9d6c);_0x4d0d8f(_0x1c9d6c);});});}exports['CreateWhatsappMessage']=function(_0x4ae685){var _0x291e42=this;return new Promise(function(_0x39e6b0,_0xa6df28){return db['WhatsappMessage']['create'](_0x4ae685[_0x0cff('0x1a')],{'raw':_0x4ae685[_0x0cff('0x1b')]?_0x4ae685[_0x0cff('0x1b')][_0x0cff('0x1c')]===undefined?!![]:![]:!![]})[_0x0cff('0x10')](function(_0x716ca9){logger[_0x0cff('0x11')](_0x0cff('0x1d'),_0x4ae685);logger[_0x0cff('0x1e')](_0x0cff('0x1d'),_0x4ae685,JSON[_0x0cff('0x14')](_0x716ca9));_0x39e6b0(_0x716ca9);})['catch'](function(_0x2a600d){logger[_0x0cff('0x15')]('CreateWhatsappMessage',_0x2a600d[_0x0cff('0x17')],_0x4ae685);_0xa6df28(_0x291e42[_0x0cff('0x15')](0x1f4,_0x2a600d[_0x0cff('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 44c2b93..05cde78 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 _0x41e5=['length','whatsappMessage:','update','emit','removeListener','register'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x41e5,0xe6));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save','remove',_0x541e('0x0')];function createListener(_0x342bb2,_0x2d518f){return function(_0x5c5e97){_0x2d518f[_0x541e('0x1')](_0x342bb2,_0x5c5e97);};}function removeListener(_0x310e37,_0x5cb00f){return function(){WhatsappMessageEvents[_0x541e('0x2')](_0x310e37,_0x5cb00f);};}exports[_0x541e('0x3')]=function(_0x2b21d5){for(var _0x5eecf3=0x0,_0x37d721=events[_0x541e('0x4')];_0x5eecf3<_0x37d721;_0x5eecf3++){var _0x4cae63=events[_0x5eecf3];var _0x30e70d=createListener(_0x541e('0x5')+_0x4cae63,_0x2b21d5);WhatsappMessageEvents['on'](_0x4cae63,_0x30e70d);}}; \ No newline at end of file +var _0xdd77=['removeListener','register','whatsappMessage:','remove','update'];(function(_0x9d9f9e,_0x52a029){var _0x48cb13=function(_0x177d55){while(--_0x177d55){_0x9d9f9e['push'](_0x9d9f9e['shift']());}};_0x48cb13(++_0x52a029);}(_0xdd77,0x139));var _0x7dd7=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xdd77[_0x47a7d0];return _0xb9bd08;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x7dd7('0x0'),_0x7dd7('0x1')];function createListener(_0x46923a,_0x744b8e){return function(_0x53d764){_0x744b8e['emit'](_0x46923a,_0x53d764);};}function removeListener(_0x215753,_0xcd06ea){return function(){WhatsappMessageEvents[_0x7dd7('0x2')](_0x215753,_0xcd06ea);};}exports[_0x7dd7('0x3')]=function(_0x358c82){for(var _0x1e05de=0x0,_0x27ea8a=events['length'];_0x1e05de<_0x27ea8a;_0x1e05de++){var _0x1363c8=events[_0x1e05de];var _0x1aed7c=createListener(_0x7dd7('0x4')+_0x1363c8,_0x358c82);WhatsappMessageEvents['on'](_0x1363c8,_0x1aed7c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ee2ceda..bc80649 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 _0xb51d=['isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','delete','destroy','removeAgents','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x26e358,_0x46dbd9){var _0x29abd3=function(_0x3271d6){while(--_0x3271d6){_0x26e358['push'](_0x26e358['shift']());}};_0x29abd3(++_0x46dbd9);}(_0xb51d,0xa1));var _0xdb51=function(_0x4cbe0a,_0x1a0d77){_0x4cbe0a=_0x4cbe0a-0x0;var _0x17c064=_0xb51d[_0x4cbe0a];return _0x17c064;};'use strict';var multer=require(_0xdb51('0x0'));var util=require(_0xdb51('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdb51('0x2'));var router=express['Router']();var auth=require(_0xdb51('0x3'));var interaction=require(_0xdb51('0x4'));var config=require(_0xdb51('0x5'));var controller=require('./whatsappQueue.controller');router[_0xdb51('0x6')]('/',auth[_0xdb51('0x7')](),controller[_0xdb51('0x8')]);router['get'](_0xdb51('0x9'),auth[_0xdb51('0x7')](),controller['describe']);router[_0xdb51('0x6')](_0xdb51('0xa'),auth[_0xdb51('0x7')](),controller['show']);router[_0xdb51('0x6')](_0xdb51('0xb'),auth['isAuthenticated'](),controller[_0xdb51('0xc')]);router[_0xdb51('0x6')](_0xdb51('0xd'),auth['isAuthenticated'](),controller[_0xdb51('0xe')]);router[_0xdb51('0x6')](_0xdb51('0xf'),auth[_0xdb51('0x7')](),controller[_0xdb51('0x10')]);router[_0xdb51('0x11')]('/',auth[_0xdb51('0x7')](),controller[_0xdb51('0x12')]);router[_0xdb51('0x11')](_0xdb51('0xd'),auth[_0xdb51('0x7')](),controller['addTeams']);router['post'](_0xdb51('0xf'),auth[_0xdb51('0x7')](),controller['addAgents']);router[_0xdb51('0x13')](_0xdb51('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xdb51('0x14')](_0xdb51('0xa'),auth[_0xdb51('0x7')](),controller[_0xdb51('0x15')]);router[_0xdb51('0x14')](_0xdb51('0xd'),auth[_0xdb51('0x7')](),controller['removeTeams']);router[_0xdb51('0x14')](_0xdb51('0xf'),auth[_0xdb51('0x7')](),controller[_0xdb51('0x16')]);module[_0xdb51('0x17')]=router; \ No newline at end of file +var _0xda25=['get','index','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/users','getAgents','create','post','/:id/teams','addTeams','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0xda25,0x1b8));var _0x5da2=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xda25[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0x5da2('0x0'));var util=require(_0x5da2('0x1'));var path=require(_0x5da2('0x2'));var timeout=require(_0x5da2('0x3'));var express=require('express');var router=express[_0x5da2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5da2('0x5'));var config=require(_0x5da2('0x6'));var controller=require(_0x5da2('0x7'));router[_0x5da2('0x8')]('/',auth['isAuthenticated'](),controller[_0x5da2('0x9')]);router[_0x5da2('0x8')](_0x5da2('0xa'),auth[_0x5da2('0xb')](),controller[_0x5da2('0xc')]);router[_0x5da2('0x8')](_0x5da2('0xd'),auth[_0x5da2('0xb')](),controller[_0x5da2('0xe')]);router[_0x5da2('0x8')]('/:id/members',auth[_0x5da2('0xb')](),controller[_0x5da2('0xf')]);router[_0x5da2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x5da2('0x10'),auth[_0x5da2('0xb')](),controller[_0x5da2('0x11')]);router['post']('/',auth[_0x5da2('0xb')](),controller[_0x5da2('0x12')]);router[_0x5da2('0x13')](_0x5da2('0x14'),auth[_0x5da2('0xb')](),controller[_0x5da2('0x15')]);router[_0x5da2('0x13')](_0x5da2('0x10'),auth[_0x5da2('0xb')](),controller['addAgents']);router[_0x5da2('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x5da2('0x17')]);router[_0x5da2('0x18')](_0x5da2('0xd'),auth[_0x5da2('0xb')](),controller['destroy']);router['delete'](_0x5da2('0x14'),auth[_0x5da2('0xb')](),controller[_0x5da2('0x19')]);router['delete'](_0x5da2('0x10'),auth['isAuthenticated'](),controller[_0x5da2('0x1a')]);module[_0x5da2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 02ee4c4..106a2dd 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 _0xaad1=['STRING','name','INTEGER','ENUM','beepall','sequelize','exports'];(function(_0x524cb3,_0x2d702a){var _0x288975=function(_0x5e4b56){while(--_0x5e4b56){_0x524cb3['push'](_0x524cb3['shift']());}};_0x288975(++_0x2d702a);}(_0xaad1,0x124));var _0x1aad=function(_0x10eb8e,_0x40cb8d){_0x10eb8e=_0x10eb8e-0x0;var _0xd362c2=_0xaad1[_0x10eb8e];return _0xd362c2;};'use strict';var Sequelize=require(_0x1aad('0x0'));module[_0x1aad('0x1')]={'name':{'type':Sequelize[_0x1aad('0x2')],'unique':_0x1aad('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1aad('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1aad('0x5')]('rrmemory',_0x1aad('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x1aad('0x2')]}}; \ No newline at end of file +var _0xb69f=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x33b0bc,_0x2fdf16){var _0x39cdad=function(_0x1db817){while(--_0x1db817){_0x33b0bc['push'](_0x33b0bc['shift']());}};_0x39cdad(++_0x2fdf16);}(_0xb69f,0xef));var _0xfb69=function(_0x265908,_0xae1a6f){_0x265908=_0x265908-0x0;var _0x3b4f62=_0xb69f[_0x265908];return _0x3b4f62;};'use strict';var Sequelize=require(_0xfb69('0x0'));module[_0xfb69('0x1')]={'name':{'type':Sequelize[_0xfb69('0x2')],'unique':_0xfb69('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xfb69('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfb69('0x5')](_0xfb69('0x6'),_0xfb69('0x7'),_0xfb69('0x8'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index de6e679..7d4321a 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 _0x4c5c=['online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','findAll','catch','show','params','find','create','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','whatsappPause','getTeams','Team','addTeams','body','ids','Agents'];(function(_0x4e7d03,_0x11f360){var _0x2ccb7f=function(_0x322f16){while(--_0x322f16){_0x4e7d03['push'](_0x4e7d03['shift']());}};_0x2ccb7f(++_0x11f360);}(_0x4c5c,0xb5));var _0xc4c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c5c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc4c5('0x0'));var emlformat=require(_0xc4c5('0x1'));var rimraf=require(_0xc4c5('0x2'));var zipdir=require(_0xc4c5('0x3'));var jsonpatch=require(_0xc4c5('0x4'));var rp=require(_0xc4c5('0x5'));var moment=require(_0xc4c5('0x6'));var BPromise=require(_0xc4c5('0x7'));var Mustache=require(_0xc4c5('0x8'));var util=require(_0xc4c5('0x9'));var path=require(_0xc4c5('0xa'));var sox=require(_0xc4c5('0xb'));var csv=require(_0xc4c5('0xc'));var ejs=require(_0xc4c5('0xd'));var fs=require('fs');var _=require(_0xc4c5('0xe'));var squel=require(_0xc4c5('0xf'));var crypto=require(_0xc4c5('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xc4c5('0x11'));var toCsv=require(_0xc4c5('0xc'));var querystring=require(_0xc4c5('0x12'));var Papa=require(_0xc4c5('0x13'));var Redis=require(_0xc4c5('0x14'));var authService=require(_0xc4c5('0x15'));var qs=require(_0xc4c5('0x16'));var as=require(_0xc4c5('0x17'));var hardwareService=require(_0xc4c5('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0xc4c5('0x19'));var config=require(_0xc4c5('0x1a'));var db=require(_0xc4c5('0x1b'))['db'];config[_0xc4c5('0x1c')]=_[_0xc4c5('0x1d')](config[_0xc4c5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xc4c5('0x1e'))(new Redis(config[_0xc4c5('0x1c')]));require(_0xc4c5('0x1f'))[_0xc4c5('0x20')](socket);function respondWithStatusCode(_0x3164be,_0x5cb804){_0x5cb804=_0x5cb804||0xcc;return function(_0x52bb59){if(_0x52bb59){return _0x3164be[_0xc4c5('0x21')](_0x5cb804);}return _0x3164be[_0xc4c5('0x22')](_0x5cb804)[_0xc4c5('0x23')]();};}function respondWithResult(_0x3d6a25,_0x256416){_0x256416=_0x256416||0xc8;return function(_0x5152e5){if(_0x5152e5){return _0x3d6a25[_0xc4c5('0x22')](_0x256416)['json'](_0x5152e5);}};}function respondWithFilteredResult(_0x43a2e1,_0x4038d2){return function(_0x5e42d4){if(_0x5e42d4){var _0x2459bf=_0x5e42d4[_0xc4c5('0x24')],_0x169631=_0x4038d2[_0xc4c5('0x25')],_0x4e993a=_0x4038d2['offset']+_0x4038d2['limit'],_0xa05ab4;if(_0x4e993a>=_0x2459bf){_0x4e993a=_0x2459bf;_0xa05ab4=0xc8;}else{_0xa05ab4=0xce;}_0x43a2e1['status'](_0xa05ab4);return _0x43a2e1[_0xc4c5('0x26')](_0xc4c5('0x27'),_0x169631+'-'+_0x4e993a+'/'+_0x2459bf)[_0xc4c5('0x28')](_0x5e42d4);}return null;};}function patchUpdates(_0x4f5d03){return function(_0x4b28f9){try{jsonpatch[_0xc4c5('0x29')](_0x4b28f9,_0x4f5d03,!![]);}catch(_0xf8b028){return BPromise[_0xc4c5('0x2a')](_0xf8b028);}return _0x4b28f9[_0xc4c5('0x2b')]();};}function saveUpdates(_0x4bb4ca,_0x46b24a){return function(_0x248807){if(_0x248807){return _0x248807[_0xc4c5('0x2c')](_0x4bb4ca)[_0xc4c5('0x2d')](function(_0x353ee1){return _0x353ee1;});}return null;};}function removeEntity(_0x1124df,_0x3a4eef){return function(_0x2af36e){if(_0x2af36e){return _0x2af36e[_0xc4c5('0x2e')]()['then'](function(){var _0x5168f0=_0x2af36e[_0xc4c5('0x2f')]({'plain':!![]});var _0x292d66=_0xc4c5('0x30');return db[_0xc4c5('0x31')]['destroy']({'where':{'type':_0x292d66,'resourceId':_0x5168f0['id']}})[_0xc4c5('0x2d')](function(){return _0x2af36e;});})['then'](function(){_0x1124df['status'](0xcc)[_0xc4c5('0x23')]();});}};}function handleEntityNotFound(_0x16a774,_0x23dc91){return function(_0x1241f0){if(!_0x1241f0){_0x16a774[_0xc4c5('0x21')](0x194);}return _0x1241f0;};}function handleError(_0x44fee1,_0x5eac01){_0x5eac01=_0x5eac01||0x1f4;return function(_0x181cce){logger['error'](_0x181cce['stack']);if(_0x181cce['name']){delete _0x181cce[_0xc4c5('0x32')];}_0x44fee1[_0xc4c5('0x22')](_0x5eac01)[_0xc4c5('0x33')](_0x181cce);};}exports[_0xc4c5('0x34')]=function(_0x40ecad,_0x1e2ec3){var _0x2719f6={},_0x2ab3f4={},_0x328a53={'count':0x0,'rows':[]};var _0x257900=_[_0xc4c5('0x35')](db['WhatsappQueue'][_0xc4c5('0x36')],function(_0x243622){return{'name':_0x243622['fieldName'],'type':_0x243622[_0xc4c5('0x37')][_0xc4c5('0x38')]};});_0x2ab3f4[_0xc4c5('0x39')]=_[_0xc4c5('0x35')](_0x257900,_0xc4c5('0x32'));_0x2ab3f4['query']=_[_0xc4c5('0x3a')](_0x40ecad[_0xc4c5('0x3b')]);_0x2ab3f4[_0xc4c5('0x3c')]=_[_0xc4c5('0x3d')](_0x2ab3f4['model'],_0x2ab3f4[_0xc4c5('0x3b')]);_0x2719f6['attributes']=_['intersection'](_0x2ab3f4[_0xc4c5('0x39')],qs['fields'](_0x40ecad[_0xc4c5('0x3b')][_0xc4c5('0x3e')]));_0x2719f6[_0xc4c5('0x3f')]=_0x2719f6[_0xc4c5('0x3f')][_0xc4c5('0x40')]?_0x2719f6[_0xc4c5('0x3f')]:_0x2ab3f4[_0xc4c5('0x39')];if(!_0x40ecad[_0xc4c5('0x3b')][_0xc4c5('0x41')](_0xc4c5('0x42'))){_0x2719f6['limit']=qs[_0xc4c5('0x43')](_0x40ecad[_0xc4c5('0x3b')][_0xc4c5('0x43')]);_0x2719f6['offset']=qs[_0xc4c5('0x25')](_0x40ecad[_0xc4c5('0x3b')][_0xc4c5('0x25')]);}_0x2719f6[_0xc4c5('0x44')]=qs[_0xc4c5('0x45')](_0x40ecad['query'][_0xc4c5('0x45')]);_0x2719f6['where']=qs[_0xc4c5('0x3c')](_[_0xc4c5('0x46')](_0x40ecad[_0xc4c5('0x3b')],_0x2ab3f4[_0xc4c5('0x3c')]),_0x257900);if(_0x40ecad[_0xc4c5('0x3b')][_0xc4c5('0x47')]){_0x2719f6[_0xc4c5('0x48')]=_[_0xc4c5('0x49')](_0x2719f6[_0xc4c5('0x48')],{'$or':_[_0xc4c5('0x35')](_0x257900,function(_0x4e01e3){if(_0x4e01e3['type']!==_0xc4c5('0x4a')){var _0x189e88={};_0x189e88[_0x4e01e3['name']]={'$like':'%'+_0x40ecad[_0xc4c5('0x3b')][_0xc4c5('0x47')]+'%'};return _0x189e88;}})});}_0x2719f6=_['merge']({},_0x2719f6,_0x40ecad[_0xc4c5('0x4b')]);var _0x1c8854={'where':_0x2719f6[_0xc4c5('0x48')]};return db[_0xc4c5('0x4c')]['count'](_0x1c8854)[_0xc4c5('0x2d')](function(_0x6e139e){_0x328a53['count']=_0x6e139e;if(_0x40ecad[_0xc4c5('0x3b')][_0xc4c5('0x4d')]){_0x2719f6[_0xc4c5('0x4e')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xc4c5('0x4f')](_0x2719f6);})['then'](function(_0x17ce09){_0x328a53['rows']=_0x17ce09;return _0x328a53;})[_0xc4c5('0x2d')](respondWithFilteredResult(_0x1e2ec3,_0x2719f6))[_0xc4c5('0x50')](handleError(_0x1e2ec3,null));};exports[_0xc4c5('0x51')]=function(_0x1b3112,_0x3f5b3a){var _0x736d07={'raw':!![],'where':{'id':_0x1b3112[_0xc4c5('0x52')]['id']}},_0x1b3a9b={};_0x1b3a9b[_0xc4c5('0x39')]=_['keys'](db[_0xc4c5('0x4c')]['rawAttributes']);_0x1b3a9b[_0xc4c5('0x3b')]=_[_0xc4c5('0x3a')](_0x1b3112[_0xc4c5('0x3b')]);_0x1b3a9b[_0xc4c5('0x3c')]=_[_0xc4c5('0x3d')](_0x1b3a9b[_0xc4c5('0x39')],_0x1b3a9b[_0xc4c5('0x3b')]);_0x736d07[_0xc4c5('0x3f')]=_[_0xc4c5('0x3d')](_0x1b3a9b[_0xc4c5('0x39')],qs[_0xc4c5('0x3e')](_0x1b3112[_0xc4c5('0x3b')][_0xc4c5('0x3e')]));_0x736d07[_0xc4c5('0x3f')]=_0x736d07[_0xc4c5('0x3f')]['length']?_0x736d07[_0xc4c5('0x3f')]:_0x1b3a9b[_0xc4c5('0x39')];if(_0x1b3112['query']['includeAll']){_0x736d07[_0xc4c5('0x4e')]=[{'all':!![]}];}_0x736d07=_[_0xc4c5('0x49')]({},_0x736d07,_0x1b3112[_0xc4c5('0x4b')]);return db['WhatsappQueue'][_0xc4c5('0x53')](_0x736d07)['then'](handleEntityNotFound(_0x3f5b3a,null))[_0xc4c5('0x2d')](respondWithResult(_0x3f5b3a,null))[_0xc4c5('0x50')](handleError(_0x3f5b3a,null));};exports[_0xc4c5('0x54')]=function(_0x27ac68,_0x53dd74){return db[_0xc4c5('0x4c')][_0xc4c5('0x54')](_0x27ac68['body'],{})[_0xc4c5('0x2d')](function(_0x4623e6){var _0x533cf9=_0x27ac68[_0xc4c5('0x55')]['get']({'plain':!![]});if(!_0x533cf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x533cf9['role']===_0xc4c5('0x55')){var _0x1f1e96=_0x4623e6[_0xc4c5('0x2f')]({'plain':!![]});var _0x45dc74=_0xc4c5('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x45dc74,'userProfileId':_0x533cf9[_0xc4c5('0x56')]},'raw':!![]})[_0xc4c5('0x2d')](function(_0x3c7283){if(_0x3c7283&&_0x3c7283['autoAssociation']===0x0){return db[_0xc4c5('0x31')]['create']({'name':_0x1f1e96[_0xc4c5('0x32')],'resourceId':_0x1f1e96['id'],'type':_0x3c7283[_0xc4c5('0x32')],'sectionId':_0x3c7283['id']},{})[_0xc4c5('0x2d')](function(){return _0x4623e6;});}else{return _0x4623e6;}})['catch'](function(_0x30db0a){logger[_0xc4c5('0x57')](_0xc4c5('0x58'),_0x30db0a);throw _0x30db0a;});}return _0x4623e6;})['then'](respondWithResult(_0x53dd74,0xc9))['catch'](handleError(_0x53dd74,null));};exports['update']=function(_0x3c7452,_0xfc5fda){if(_0x3c7452['body']['id']){delete _0x3c7452['body']['id'];}return db[_0xc4c5('0x4c')][_0xc4c5('0x53')]({'where':{'id':_0x3c7452[_0xc4c5('0x52')]['id']}})[_0xc4c5('0x2d')](handleEntityNotFound(_0xfc5fda,null))[_0xc4c5('0x2d')](saveUpdates(_0x3c7452['body'],null))[_0xc4c5('0x2d')](respondWithResult(_0xfc5fda,null))[_0xc4c5('0x50')](handleError(_0xfc5fda,null));};exports[_0xc4c5('0x2e')]=function(_0x410678,_0x105c60){return db['WhatsappQueue'][_0xc4c5('0x53')]({'where':{'id':_0x410678[_0xc4c5('0x52')]['id']}})[_0xc4c5('0x2d')](handleEntityNotFound(_0x105c60,null))[_0xc4c5('0x2d')](removeEntity(_0x105c60,null))[_0xc4c5('0x50')](handleError(_0x105c60,null));};exports[_0xc4c5('0x59')]=function(_0x4bc9e6,_0x8cf156){return db[_0xc4c5('0x4c')][_0xc4c5('0x59')]()[_0xc4c5('0x2d')](respondWithResult(_0x8cf156,null))[_0xc4c5('0x50')](handleError(_0x8cf156,null));};exports[_0xc4c5('0x5a')]=function(_0x28798e,_0x277d41,_0x322608){var _0x21af6e={'raw':!![],'where':{}},_0x2b27aa={},_0x5d3a9f;return db['WhatsappQueue'][_0xc4c5('0x5b')]({'where':{'id':_0x28798e[_0xc4c5('0x52')]['id']}})[_0xc4c5('0x2d')](handleEntityNotFound(_0x277d41,null))['then'](function(_0x3e7d96){if(_0x3e7d96){_0x5d3a9f=_0x3e7d96[_0xc4c5('0x2f')]({'plain':!![]});_0x2b27aa[_0xc4c5('0x39')]=_[_0xc4c5('0x3a')](db[_0xc4c5('0x5c')][_0xc4c5('0x36')]);_0x2b27aa['query']=_[_0xc4c5('0x3a')](_0x28798e[_0xc4c5('0x3b')]);_0x2b27aa[_0xc4c5('0x3c')]=_[_0xc4c5('0x3d')](_0x2b27aa['model'],_0x2b27aa[_0xc4c5('0x3b')]);_0x21af6e[_0xc4c5('0x3f')]=_[_0xc4c5('0x3d')](_0x2b27aa[_0xc4c5('0x39')],qs['fields'](_0x28798e[_0xc4c5('0x3b')][_0xc4c5('0x3e')]));_0x21af6e[_0xc4c5('0x3f')]=_0x21af6e['attributes']['length']?_0x21af6e['attributes']:_0x2b27aa['model'];if(!_0x28798e[_0xc4c5('0x3b')][_0xc4c5('0x41')](_0xc4c5('0x42'))){_0x21af6e[_0xc4c5('0x43')]=qs[_0xc4c5('0x43')](_0x28798e[_0xc4c5('0x3b')][_0xc4c5('0x43')]);_0x21af6e[_0xc4c5('0x25')]=qs[_0xc4c5('0x25')](_0x28798e['query'][_0xc4c5('0x25')]);}_0x21af6e[_0xc4c5('0x44')]=qs['sort'](_0x28798e[_0xc4c5('0x3b')]['sort']);_0x21af6e[_0xc4c5('0x48')]=qs[_0xc4c5('0x3c')](_[_0xc4c5('0x46')](_0x28798e['query'],_0x2b27aa[_0xc4c5('0x3c')]));_0x21af6e['where'][_0xc4c5('0x5d')]=_0x3e7d96['id'];if(_0x28798e[_0xc4c5('0x3b')][_0xc4c5('0x47')]){_0x21af6e['where']=_[_0xc4c5('0x49')](_0x21af6e[_0xc4c5('0x48')],{'$or':_[_0xc4c5('0x35')](_0x21af6e[_0xc4c5('0x3f')],function(_0x4f2894){var _0x44f1a9={};_0x44f1a9[_0x4f2894]={'$like':'%'+_0x28798e['query'][_0xc4c5('0x47')]+'%'};return _0x44f1a9;})});}_0x21af6e=_[_0xc4c5('0x49')]({},_0x21af6e,_0x28798e['options']);return db[_0xc4c5('0x5c')][_0xc4c5('0x4f')](_0x21af6e);}})[_0xc4c5('0x2d')](function(_0x375fa9){if(_0x375fa9){return db[_0xc4c5('0x5e')][_0xc4c5('0x5f')]({'where':{'id':_[_0xc4c5('0x35')](_0x375fa9,_0xc4c5('0x60')),'role':_0xc4c5('0x61')},'attributes':['id',_0xc4c5('0x32'),'whatsappPause',_0xc4c5('0x62'),_0xc4c5('0x63')]});}})[_0xc4c5('0x2d')](function(_0x5936fc){if(_0x5936fc){return{'count':_0x5936fc['count'],'rows':_[_0xc4c5('0x35')](_0x5936fc[_0xc4c5('0x64')],function(_0x4e1f32){return{'membername':_0x4e1f32['name'],'UserId':_0x4e1f32['id'],'queue_name':_0x5d3a9f[_0xc4c5('0x32')],'WhatsappQueueId':_0x5d3a9f['id'],'interface':util[_0xc4c5('0x65')](_0xc4c5('0x66'),_0xc4c5('0x67'),_0x4e1f32[_0xc4c5('0x32')]),'penalty':0x0,'paused':_0x4e1f32[_0xc4c5('0x68')],'createdAt':_0x4e1f32[_0xc4c5('0x63')],'updatedAt':_0x4e1f32[_0xc4c5('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x277d41,_0x21af6e))[_0xc4c5('0x50')](handleError(_0x277d41,null));};exports[_0xc4c5('0x69')]=function(_0x5335f3,_0x24f219,_0x3cf9d1){var _0x1437da={};var _0x3379b6={};var _0x450428;var _0x24ff9a;return db[_0xc4c5('0x4c')][_0xc4c5('0x5b')]({'where':{'id':_0x5335f3[_0xc4c5('0x52')]['id']}})['then'](handleEntityNotFound(_0x24f219,null))[_0xc4c5('0x2d')](function(_0x382ae1){if(_0x382ae1){_0x450428=_0x382ae1;_0x3379b6[_0xc4c5('0x39')]=_['keys'](db[_0xc4c5('0x6a')][_0xc4c5('0x36')]);_0x3379b6['query']=_['keys'](_0x5335f3[_0xc4c5('0x3b')]);_0x3379b6[_0xc4c5('0x3c')]=_[_0xc4c5('0x3d')](_0x3379b6[_0xc4c5('0x39')],_0x3379b6[_0xc4c5('0x3b')]);_0x1437da['attributes']=_[_0xc4c5('0x3d')](_0x3379b6['model'],qs[_0xc4c5('0x3e')](_0x5335f3[_0xc4c5('0x3b')][_0xc4c5('0x3e')]));_0x1437da[_0xc4c5('0x3f')]=_0x1437da[_0xc4c5('0x3f')][_0xc4c5('0x40')]?_0x1437da['attributes']:_0x3379b6[_0xc4c5('0x39')];_0x1437da[_0xc4c5('0x44')]=qs[_0xc4c5('0x45')](_0x5335f3[_0xc4c5('0x3b')][_0xc4c5('0x45')]);_0x1437da['where']=qs[_0xc4c5('0x3c')](_['pick'](_0x5335f3['query'],_0x3379b6[_0xc4c5('0x3c')]));if(_0x5335f3[_0xc4c5('0x3b')][_0xc4c5('0x47')]){_0x1437da[_0xc4c5('0x48')]=_[_0xc4c5('0x49')](_0x1437da[_0xc4c5('0x48')],{'$or':_[_0xc4c5('0x35')](_0x1437da[_0xc4c5('0x3f')],function(_0x2625f6){var _0x2a23f4={};_0x2a23f4[_0x2625f6]={'$like':'%'+_0x5335f3['query'][_0xc4c5('0x47')]+'%'};return _0x2a23f4;})});}_0x1437da=_['merge']({},_0x1437da,_0x5335f3[_0xc4c5('0x4b')]);return _0x450428['getTeams'](_0x1437da);}})[_0xc4c5('0x2d')](function(_0x56d679){if(_0x56d679){_0x24ff9a=_0x56d679[_0xc4c5('0x40')];if(!_0x5335f3[_0xc4c5('0x3b')]['hasOwnProperty']('nolimit')){_0x1437da[_0xc4c5('0x43')]=qs[_0xc4c5('0x43')](_0x5335f3['query'][_0xc4c5('0x43')]);_0x1437da['offset']=qs[_0xc4c5('0x25')](_0x5335f3[_0xc4c5('0x3b')][_0xc4c5('0x25')]);}return _0x450428[_0xc4c5('0x69')](_0x1437da);}})[_0xc4c5('0x2d')](function(_0x2aae28){if(_0x2aae28){return _0x2aae28?{'count':_0x24ff9a,'rows':_0x2aae28}:null;}})[_0xc4c5('0x2d')](respondWithResult(_0x24f219,null))[_0xc4c5('0x50')](handleError(_0x24f219,null));};exports[_0xc4c5('0x6b')]=function(_0x8798a1,_0x57e778,_0x5d80c2){var _0x5d2bd6=_0x8798a1[_0xc4c5('0x6c')][_0xc4c5('0x6d')];return db[_0xc4c5('0x6a')]['findAll']({'where':{'id':_0x5d2bd6},'attributes':['id'],'include':[{'model':db[_0xc4c5('0x5e')],'as':_0xc4c5('0x6e'),'attributes':['id',_0xc4c5('0x32'),_0xc4c5('0x6f'),'voicePause',_0xc4c5('0x70')],'raw':!![]}]})[_0xc4c5('0x2d')](function(_0x49ee48){if(_0x49ee48){var _0x107367=_[_0xc4c5('0x71')](_0x49ee48,function(_0x1eaec1){var _0x4eabbf=_0x1eaec1[_0xc4c5('0x2f')]({'plain':!![]});return _0x4eabbf['Agents'];});return db[_0xc4c5('0x4c')][_0xc4c5('0x53')]({'where':{'id':_0x8798a1[_0xc4c5('0x52')]['id']}})[_0xc4c5('0x2d')](function(_0x2f3ac6){return db[_0xc4c5('0x72')][_0xc4c5('0x73')](function(_0x1c09ca){return _0x2f3ac6['addTeams'](_0x5d2bd6,{'transaction':_0x1c09ca})[_0xc4c5('0x2d')](function(){return BPromise['each'](_0x107367,function(_0x17650f){return db['UserWhatsappQueue'][_0xc4c5('0x74')]({'where':{'UserId':_0x17650f['id'],'WhatsappQueueId':_0x8798a1[_0xc4c5('0x52')]['id']},'transaction':_0x1c09ca});});})['then'](function(){_0x107367[_0xc4c5('0x75')](function(_0x5943ff){socket[_0xc4c5('0x76')](_0xc4c5('0x77'),{'UserId':_0x5943ff['id'],'WhatsappQueueId':_0x2f3ac6['id']});});});});});}})[_0xc4c5('0x2d')](respondWithStatusCode(_0x57e778,null))[_0xc4c5('0x50')](handleError(_0x57e778,null));};exports[_0xc4c5('0x78')]=function(_0x3db8b3,_0x94a844,_0x32ec4d){return db['Team'][_0xc4c5('0x4f')]({'where':{'id':_0x3db8b3['query'][_0xc4c5('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xc4c5('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc4c5('0x2d')](handleEntityNotFound(_0x94a844,null))['then'](function(_0x5264ea){var _0x5a4eeb=_[_0xc4c5('0x35')](_0x5264ea,'id');var _0x20a9df=[];var _0x5c303f=[];var _0x2b1fe1=squel[_0xc4c5('0x79')]();_0x2b1fe1[_0xc4c5('0x7a')]('tq.TeamId')[_0xc4c5('0x7b')]('team_has_whatsapp_queues','tq')[_0xc4c5('0x7c')](_0xc4c5('0x7d'),'ut',_0xc4c5('0x7e'))[_0xc4c5('0x48')](_0xc4c5('0x7f'),_0x3db8b3[_0xc4c5('0x52')]['id']);for(var _0x103522=0x0;_0x103522<_0x5264ea['length'];_0x103522+=0x1){let _0x1eb34c=_0x5264ea[_0x103522];for(var _0x5c08e4=0x0;_0x5c08e4<_0x1eb34c['Agents']['length'];_0x5c08e4+=0x1){let _0x4f2e6b=_0x1eb34c['Agents'][_0x5c08e4];var _0x42fc20=_0x2b1fe1[_0xc4c5('0x80')]();_0x42fc20['where'](_0xc4c5('0x81'),_0x4f2e6b['id']);_0x5c303f['push'](db[_0xc4c5('0x72')][_0xc4c5('0x3b')](_0x42fc20[_0xc4c5('0x82')](),{'type':db['sequelize'][_0xc4c5('0x83')][_0xc4c5('0x84')]})[_0xc4c5('0x2d')](function(_0x228748){if(_0x228748[_0xc4c5('0x40')]===0x1){return _0x4f2e6b['id'];}else{var _0x17b93e=_['every'](_[_0xc4c5('0x35')](_0x228748,_0xc4c5('0x85')),function(_0x46f5be){return _[_0xc4c5('0x86')](_0x5a4eeb,_0x46f5be);});if(_0x17b93e){return _0x4f2e6b['id'];}}}));}}return BPromise[_0xc4c5('0x87')](_0x5c303f)['then'](function(_0x291947){_0x20a9df=_(_0x20a9df)[_0xc4c5('0x88')](_0x291947)[_0xc4c5('0x89')]()[_0xc4c5('0x8a')]();return db[_0xc4c5('0x4c')][_0xc4c5('0x53')]({'where':{'id':_0x3db8b3[_0xc4c5('0x52')]['id']}})[_0xc4c5('0x2d')](function(_0x2dcd0c){return db[_0xc4c5('0x72')]['transaction'](function(_0x550671){return _0x2dcd0c[_0xc4c5('0x78')](_0x3db8b3[_0xc4c5('0x3b')][_0xc4c5('0x6d')],{'transaction':_0x550671})[_0xc4c5('0x2d')](function(){if(!_[_0xc4c5('0x8b')](_0x20a9df)){return _0x2dcd0c[_0xc4c5('0x8c')](_0x20a9df,{'transaction':_0x550671});}})['then'](function(){_0x20a9df[_0xc4c5('0x75')](function(_0x3b9c7b){socket[_0xc4c5('0x76')](_0xc4c5('0x8d'),{'UserId':_0x3b9c7b,'WhatsappQueueId':_0x2dcd0c['id']});});});});});});})[_0xc4c5('0x2d')](respondWithStatusCode(_0x94a844,null))[_0xc4c5('0x50')](handleError(_0x94a844,null));};exports['addAgents']=function(_0x14914b,_0xde943a,_0x1cf902){return db['WhatsappQueue'][_0xc4c5('0x53')]({'where':{'id':_0x14914b[_0xc4c5('0x52')]['id']}})[_0xc4c5('0x2d')](handleEntityNotFound(_0xde943a,null))[_0xc4c5('0x2d')](function(_0x4b6477){if(_0x4b6477){return _0x4b6477[_0xc4c5('0x8e')](_0x14914b['body']['ids'],_[_0xc4c5('0x8f')](_0x14914b[_0xc4c5('0x6c')],[_0xc4c5('0x6d'),'id'])||{})['spread'](function(_0x9fdf71){for(var _0x177a3b=0x0;_0x177a3b<_0x14914b['body'][_0xc4c5('0x6d')][_0xc4c5('0x40')];_0x177a3b+=0x1){socket[_0xc4c5('0x76')](_0xc4c5('0x77'),{'UserId':_0x14914b[_0xc4c5('0x6c')][_0xc4c5('0x6d')][_0x177a3b],'WhatsappQueueId':_0x14914b[_0xc4c5('0x52')]['id']});}return _0x9fdf71;});}})['then'](respondWithResult(_0xde943a,null))[_0xc4c5('0x50')](handleError(_0xde943a,null));};exports[_0xc4c5('0x8c')]=function(_0x4c0d93,_0x329679,_0x3108d8){return db[_0xc4c5('0x4c')][_0xc4c5('0x53')]({'where':{'id':_0x4c0d93['params']['id']}})[_0xc4c5('0x2d')](handleEntityNotFound(_0x329679,null))['then'](function(_0x1c74cc){if(_0x1c74cc){return _0x1c74cc['removeAgents'](_0x4c0d93[_0xc4c5('0x3b')][_0xc4c5('0x6d')])[_0xc4c5('0x2d')](function(){if(_[_0xc4c5('0x90')](_0x4c0d93[_0xc4c5('0x3b')]['ids'])){for(var _0x15d76c=0x0;_0x15d76c<_0x4c0d93['query'][_0xc4c5('0x6d')]['length'];_0x15d76c+=0x1){socket[_0xc4c5('0x76')](_0xc4c5('0x8d'),{'UserId':Number(_0x4c0d93[_0xc4c5('0x3b')][_0xc4c5('0x6d')][_0x15d76c]),'WhatsappQueueId':Number(_0x4c0d93[_0xc4c5('0x52')]['id'])});}}else{socket['emit'](_0xc4c5('0x8d'),{'UserId':Number(_0x4c0d93[_0xc4c5('0x3b')][_0xc4c5('0x6d')]),'WhatsappQueueId':Number(_0x4c0d93[_0xc4c5('0x52')]['id'])});}});}})[_0xc4c5('0x2d')](respondWithStatusCode(_0x329679,null))['catch'](handleError(_0x329679,null));};exports[_0xc4c5('0x91')]=function(_0x17c7ec,_0x595011,_0x3374f2){var _0x597909={};var _0x1e29a1={};var _0x2118ac;var _0x423a98;return db[_0xc4c5('0x4c')][_0xc4c5('0x5b')]({'where':{'id':_0x17c7ec['params']['id']}})['then'](handleEntityNotFound(_0x595011,null))['then'](function(_0x5ae255){if(_0x5ae255){_0x2118ac=_0x5ae255;_0x1e29a1[_0xc4c5('0x39')]=_[_0xc4c5('0x3a')](db['User']['rawAttributes']);_0x1e29a1[_0xc4c5('0x3b')]=_['keys'](_0x17c7ec[_0xc4c5('0x3b')]);_0x1e29a1[_0xc4c5('0x3c')]=_['intersection'](_0x1e29a1['model'],_0x1e29a1[_0xc4c5('0x3b')]);_0x597909['attributes']=_[_0xc4c5('0x3d')](_0x1e29a1['model'],qs[_0xc4c5('0x3e')](_0x17c7ec[_0xc4c5('0x3b')][_0xc4c5('0x3e')]));_0x597909['attributes']=_0x597909['attributes'][_0xc4c5('0x40')]?_0x597909[_0xc4c5('0x3f')]:_0x1e29a1['model'];_0x597909[_0xc4c5('0x44')]=qs[_0xc4c5('0x45')](_0x17c7ec['query']['sort']);_0x597909[_0xc4c5('0x48')]=qs[_0xc4c5('0x3c')](_['pick'](_0x17c7ec['query'],_0x1e29a1[_0xc4c5('0x3c')]));if(_0x17c7ec[_0xc4c5('0x3b')][_0xc4c5('0x47')]){_0x597909['where']=_[_0xc4c5('0x49')](_0x597909[_0xc4c5('0x48')],{'$or':_[_0xc4c5('0x35')](_0x597909[_0xc4c5('0x3f')],function(_0x8b028d){var _0x5b9738={};_0x5b9738[_0x8b028d]={'$like':'%'+_0x17c7ec['query'][_0xc4c5('0x47')]+'%'};return _0x5b9738;})});}_0x597909=_[_0xc4c5('0x49')]({},_0x597909,_0x17c7ec[_0xc4c5('0x4b')]);return _0x2118ac[_0xc4c5('0x91')](_0x597909);}})[_0xc4c5('0x2d')](function(_0x505c36){if(_0x505c36){_0x423a98=_0x505c36[_0xc4c5('0x40')];if(!_0x17c7ec[_0xc4c5('0x3b')][_0xc4c5('0x41')](_0xc4c5('0x42'))){_0x597909[_0xc4c5('0x43')]=qs[_0xc4c5('0x43')](_0x17c7ec[_0xc4c5('0x3b')]['limit']);_0x597909[_0xc4c5('0x25')]=qs[_0xc4c5('0x25')](_0x17c7ec['query'][_0xc4c5('0x25')]);}return _0x2118ac[_0xc4c5('0x91')](_0x597909);}})['then'](function(_0x5d378b){if(_0x5d378b){return _0x5d378b?{'count':_0x423a98,'rows':_0x5d378b}:null;}})[_0xc4c5('0x2d')](respondWithResult(_0x595011,null))[_0xc4c5('0x50')](handleError(_0x595011,null));}; \ No newline at end of file +var _0x6f12=['online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','Agents','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','all','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','getAgents','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','stack','index','map','WhatsappQueue','rawAttributes','type','key','name','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','where','filters','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','sort','WhatsappQueueId','User','findAndCountAll','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids'];(function(_0x62266a,_0x24d220){var _0x1369ba=function(_0x19b575){while(--_0x19b575){_0x62266a['push'](_0x62266a['shift']());}};_0x1369ba(++_0x24d220);}(_0x6f12,0x1c5));var _0x26f1=function(_0x41d9eb,_0xc99102){_0x41d9eb=_0x41d9eb-0x0;var _0x1b2d1b=_0x6f12[_0x41d9eb];return _0x1b2d1b;};'use strict';var pdf=require(_0x26f1('0x0'));var emlformat=require(_0x26f1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x26f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26f1('0x3'));var moment=require('moment');var BPromise=require(_0x26f1('0x4'));var Mustache=require(_0x26f1('0x5'));var util=require(_0x26f1('0x6'));var path=require(_0x26f1('0x7'));var sox=require(_0x26f1('0x8'));var csv=require(_0x26f1('0x9'));var ejs=require(_0x26f1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x26f1('0xb'));var crypto=require('crypto');var jsforce=require(_0x26f1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x26f1('0xd'));var Papa=require('papaparse');var Redis=require(_0x26f1('0xe'));var authService=require(_0x26f1('0xf'));var qs=require(_0x26f1('0x10'));var as=require(_0x26f1('0x11'));var hardwareService=require(_0x26f1('0x12'));var logger=require(_0x26f1('0x13'))(_0x26f1('0x14'));var utils=require(_0x26f1('0x15'));var config=require(_0x26f1('0x16'));var db=require('../../mysqldb')['db'];config[_0x26f1('0x17')]=_[_0x26f1('0x18')](config[_0x26f1('0x17')],{'host':_0x26f1('0x19'),'port':0x18eb});var socket=require(_0x26f1('0x1a'))(new Redis(config[_0x26f1('0x17')]));require(_0x26f1('0x1b'))[_0x26f1('0x1c')](socket);function respondWithStatusCode(_0x22e952,_0x3486fb){_0x3486fb=_0x3486fb||0xcc;return function(_0x5970a7){if(_0x5970a7){return _0x22e952[_0x26f1('0x1d')](_0x3486fb);}return _0x22e952[_0x26f1('0x1e')](_0x3486fb)[_0x26f1('0x1f')]();};}function respondWithResult(_0xd254b2,_0x1de82f){_0x1de82f=_0x1de82f||0xc8;return function(_0x2d0bd2){if(_0x2d0bd2){return _0xd254b2['status'](_0x1de82f)[_0x26f1('0x20')](_0x2d0bd2);}};}function respondWithFilteredResult(_0x399b94,_0x17c1d3){return function(_0x1b6417){if(_0x1b6417){var _0x359eec=_0x1b6417[_0x26f1('0x21')],_0x4fdfb2=_0x17c1d3['offset'],_0x283339=_0x17c1d3['offset']+_0x17c1d3[_0x26f1('0x22')],_0xbc26ed;if(_0x283339>=_0x359eec){_0x283339=_0x359eec;_0xbc26ed=0xc8;}else{_0xbc26ed=0xce;}_0x399b94[_0x26f1('0x1e')](_0xbc26ed);return _0x399b94[_0x26f1('0x23')](_0x26f1('0x24'),_0x4fdfb2+'-'+_0x283339+'/'+_0x359eec)[_0x26f1('0x20')](_0x1b6417);}return null;};}function patchUpdates(_0x410ad2){return function(_0x5985dd){try{jsonpatch[_0x26f1('0x25')](_0x5985dd,_0x410ad2,!![]);}catch(_0x19a52d){return BPromise[_0x26f1('0x26')](_0x19a52d);}return _0x5985dd[_0x26f1('0x27')]();};}function saveUpdates(_0x324dcd,_0x221e06){return function(_0x51af76){if(_0x51af76){return _0x51af76[_0x26f1('0x28')](_0x324dcd)[_0x26f1('0x29')](function(_0x17c820){return _0x17c820;});}return null;};}function removeEntity(_0x119e7d,_0x334817){return function(_0x2b30d1){if(_0x2b30d1){return _0x2b30d1[_0x26f1('0x2a')]()[_0x26f1('0x29')](function(){var _0x4e133d=_0x2b30d1['get']({'plain':!![]});var _0x3bc7e2=_0x26f1('0x2b');return db[_0x26f1('0x2c')][_0x26f1('0x2a')]({'where':{'type':_0x3bc7e2,'resourceId':_0x4e133d['id']}})[_0x26f1('0x29')](function(){return _0x2b30d1;});})['then'](function(){_0x119e7d[_0x26f1('0x1e')](0xcc)[_0x26f1('0x1f')]();});}};}function handleEntityNotFound(_0x2fdd6e,_0x8de5f3){return function(_0x2f19eb){if(!_0x2f19eb){_0x2fdd6e['sendStatus'](0x194);}return _0x2f19eb;};}function handleError(_0x2e9b2f,_0x40d4b9){_0x40d4b9=_0x40d4b9||0x1f4;return function(_0x49c410){logger['error'](_0x49c410[_0x26f1('0x2d')]);if(_0x49c410['name']){delete _0x49c410['name'];}_0x2e9b2f[_0x26f1('0x1e')](_0x40d4b9)['send'](_0x49c410);};}exports[_0x26f1('0x2e')]=function(_0xbb4ed8,_0x3cbcf7){var _0x146114={},_0x9f8802={},_0x396895={'count':0x0,'rows':[]};var _0x299ccc=_[_0x26f1('0x2f')](db[_0x26f1('0x30')][_0x26f1('0x31')],function(_0x4e7db6){return{'name':_0x4e7db6['fieldName'],'type':_0x4e7db6[_0x26f1('0x32')][_0x26f1('0x33')]};});_0x9f8802['model']=_[_0x26f1('0x2f')](_0x299ccc,_0x26f1('0x34'));_0x9f8802[_0x26f1('0x35')]=_['keys'](_0xbb4ed8[_0x26f1('0x35')]);_0x9f8802['filters']=_[_0x26f1('0x36')](_0x9f8802[_0x26f1('0x37')],_0x9f8802[_0x26f1('0x35')]);_0x146114['attributes']=_[_0x26f1('0x36')](_0x9f8802[_0x26f1('0x37')],qs[_0x26f1('0x38')](_0xbb4ed8[_0x26f1('0x35')]['fields']));_0x146114[_0x26f1('0x39')]=_0x146114[_0x26f1('0x39')][_0x26f1('0x3a')]?_0x146114[_0x26f1('0x39')]:_0x9f8802[_0x26f1('0x37')];if(!_0xbb4ed8[_0x26f1('0x35')][_0x26f1('0x3b')](_0x26f1('0x3c'))){_0x146114['limit']=qs[_0x26f1('0x22')](_0xbb4ed8[_0x26f1('0x35')]['limit']);_0x146114['offset']=qs[_0x26f1('0x3d')](_0xbb4ed8['query']['offset']);}_0x146114[_0x26f1('0x3e')]=qs['sort'](_0xbb4ed8[_0x26f1('0x35')]['sort']);_0x146114[_0x26f1('0x3f')]=qs[_0x26f1('0x40')](_[_0x26f1('0x41')](_0xbb4ed8[_0x26f1('0x35')],_0x9f8802[_0x26f1('0x40')]),_0x299ccc);if(_0xbb4ed8[_0x26f1('0x35')]['filter']){_0x146114[_0x26f1('0x3f')]=_['merge'](_0x146114['where'],{'$or':_[_0x26f1('0x2f')](_0x299ccc,function(_0x41ff48){if(_0x41ff48[_0x26f1('0x32')]!==_0x26f1('0x42')){var _0x1a72ad={};_0x1a72ad[_0x41ff48[_0x26f1('0x34')]]={'$like':'%'+_0xbb4ed8[_0x26f1('0x35')][_0x26f1('0x43')]+'%'};return _0x1a72ad;}})});}_0x146114=_[_0x26f1('0x44')]({},_0x146114,_0xbb4ed8['options']);var _0x3b05c1={'where':_0x146114[_0x26f1('0x3f')]};return db['WhatsappQueue']['count'](_0x3b05c1)[_0x26f1('0x29')](function(_0x456d97){_0x396895[_0x26f1('0x21')]=_0x456d97;if(_0xbb4ed8[_0x26f1('0x35')][_0x26f1('0x45')]){_0x146114['include']=[{'all':!![]}];}return db[_0x26f1('0x30')][_0x26f1('0x46')](_0x146114);})['then'](function(_0x59b142){_0x396895[_0x26f1('0x47')]=_0x59b142;return _0x396895;})[_0x26f1('0x29')](respondWithFilteredResult(_0x3cbcf7,_0x146114))['catch'](handleError(_0x3cbcf7,null));};exports[_0x26f1('0x48')]=function(_0x19013c,_0x2a35b3){var _0x1ae67d={'raw':!![],'where':{'id':_0x19013c[_0x26f1('0x49')]['id']}},_0x2567be={};_0x2567be[_0x26f1('0x37')]=_[_0x26f1('0x4a')](db[_0x26f1('0x30')][_0x26f1('0x31')]);_0x2567be[_0x26f1('0x35')]=_[_0x26f1('0x4a')](_0x19013c[_0x26f1('0x35')]);_0x2567be['filters']=_[_0x26f1('0x36')](_0x2567be[_0x26f1('0x37')],_0x2567be[_0x26f1('0x35')]);_0x1ae67d['attributes']=_[_0x26f1('0x36')](_0x2567be[_0x26f1('0x37')],qs[_0x26f1('0x38')](_0x19013c[_0x26f1('0x35')]['fields']));_0x1ae67d['attributes']=_0x1ae67d[_0x26f1('0x39')]['length']?_0x1ae67d[_0x26f1('0x39')]:_0x2567be[_0x26f1('0x37')];if(_0x19013c[_0x26f1('0x35')][_0x26f1('0x45')]){_0x1ae67d['include']=[{'all':!![]}];}_0x1ae67d=_['merge']({},_0x1ae67d,_0x19013c[_0x26f1('0x4b')]);return db['WhatsappQueue'][_0x26f1('0x4c')](_0x1ae67d)['then'](handleEntityNotFound(_0x2a35b3,null))[_0x26f1('0x29')](respondWithResult(_0x2a35b3,null))['catch'](handleError(_0x2a35b3,null));};exports[_0x26f1('0x4d')]=function(_0x5be7d6,_0x45cfb1){return db[_0x26f1('0x30')]['create'](_0x5be7d6[_0x26f1('0x4e')],{})[_0x26f1('0x29')](function(_0x4438da){var _0x79741b=_0x5be7d6[_0x26f1('0x4f')]['get']({'plain':!![]});if(!_0x79741b)throw new Error(_0x26f1('0x50'));if(_0x79741b[_0x26f1('0x51')]===_0x26f1('0x4f')){var _0x488d8d=_0x4438da[_0x26f1('0x52')]({'plain':!![]});var _0x5dfbbc=_0x26f1('0x2b');return db[_0x26f1('0x53')][_0x26f1('0x4c')]({'where':{'name':_0x5dfbbc,'userProfileId':_0x79741b[_0x26f1('0x54')]},'raw':!![]})['then'](function(_0x84146b){if(_0x84146b&&_0x84146b[_0x26f1('0x55')]===0x0){return db[_0x26f1('0x2c')][_0x26f1('0x4d')]({'name':_0x488d8d['name'],'resourceId':_0x488d8d['id'],'type':_0x84146b[_0x26f1('0x34')],'sectionId':_0x84146b['id']},{})['then'](function(){return _0x4438da;});}else{return _0x4438da;}})[_0x26f1('0x56')](function(_0x17d0f6){logger[_0x26f1('0x57')](_0x26f1('0x58'),_0x17d0f6);throw _0x17d0f6;});}return _0x4438da;})[_0x26f1('0x29')](respondWithResult(_0x45cfb1,0xc9))[_0x26f1('0x56')](handleError(_0x45cfb1,null));};exports[_0x26f1('0x28')]=function(_0x4d8170,_0x533448){if(_0x4d8170['body']['id']){delete _0x4d8170[_0x26f1('0x4e')]['id'];}return db['WhatsappQueue'][_0x26f1('0x4c')]({'where':{'id':_0x4d8170[_0x26f1('0x49')]['id']}})['then'](handleEntityNotFound(_0x533448,null))[_0x26f1('0x29')](saveUpdates(_0x4d8170[_0x26f1('0x4e')],null))[_0x26f1('0x29')](respondWithResult(_0x533448,null))[_0x26f1('0x56')](handleError(_0x533448,null));};exports[_0x26f1('0x2a')]=function(_0x4ea9b4,_0x16eba9){return db['WhatsappQueue'][_0x26f1('0x4c')]({'where':{'id':_0x4ea9b4['params']['id']}})[_0x26f1('0x29')](handleEntityNotFound(_0x16eba9,null))['then'](removeEntity(_0x16eba9,null))[_0x26f1('0x56')](handleError(_0x16eba9,null));};exports[_0x26f1('0x59')]=function(_0x365bc5,_0x51012f){return db[_0x26f1('0x30')][_0x26f1('0x59')]()['then'](respondWithResult(_0x51012f,null))[_0x26f1('0x56')](handleError(_0x51012f,null));};exports[_0x26f1('0x5a')]=function(_0x267377,_0x525a37,_0x2b636e){var _0x56a7ca={'raw':!![],'where':{}},_0x2647e4={},_0xc84907;return db[_0x26f1('0x30')][_0x26f1('0x5b')]({'where':{'id':_0x267377[_0x26f1('0x49')]['id']}})[_0x26f1('0x29')](handleEntityNotFound(_0x525a37,null))['then'](function(_0x193fd3){if(_0x193fd3){_0xc84907=_0x193fd3['get']({'plain':!![]});_0x2647e4[_0x26f1('0x37')]=_['keys'](db[_0x26f1('0x5c')][_0x26f1('0x31')]);_0x2647e4[_0x26f1('0x35')]=_[_0x26f1('0x4a')](_0x267377[_0x26f1('0x35')]);_0x2647e4[_0x26f1('0x40')]=_[_0x26f1('0x36')](_0x2647e4[_0x26f1('0x37')],_0x2647e4['query']);_0x56a7ca[_0x26f1('0x39')]=_['intersection'](_0x2647e4[_0x26f1('0x37')],qs['fields'](_0x267377[_0x26f1('0x35')]['fields']));_0x56a7ca['attributes']=_0x56a7ca['attributes'][_0x26f1('0x3a')]?_0x56a7ca[_0x26f1('0x39')]:_0x2647e4[_0x26f1('0x37')];if(!_0x267377['query'][_0x26f1('0x3b')](_0x26f1('0x3c'))){_0x56a7ca[_0x26f1('0x22')]=qs['limit'](_0x267377[_0x26f1('0x35')][_0x26f1('0x22')]);_0x56a7ca[_0x26f1('0x3d')]=qs[_0x26f1('0x3d')](_0x267377[_0x26f1('0x35')][_0x26f1('0x3d')]);}_0x56a7ca[_0x26f1('0x3e')]=qs['sort'](_0x267377[_0x26f1('0x35')][_0x26f1('0x5d')]);_0x56a7ca[_0x26f1('0x3f')]=qs['filters'](_['pick'](_0x267377[_0x26f1('0x35')],_0x2647e4[_0x26f1('0x40')]));_0x56a7ca[_0x26f1('0x3f')][_0x26f1('0x5e')]=_0x193fd3['id'];if(_0x267377[_0x26f1('0x35')][_0x26f1('0x43')]){_0x56a7ca[_0x26f1('0x3f')]=_[_0x26f1('0x44')](_0x56a7ca[_0x26f1('0x3f')],{'$or':_[_0x26f1('0x2f')](_0x56a7ca['attributes'],function(_0x4808e0){var _0x489190={};_0x489190[_0x4808e0]={'$like':'%'+_0x267377[_0x26f1('0x35')]['filter']+'%'};return _0x489190;})});}_0x56a7ca=_[_0x26f1('0x44')]({},_0x56a7ca,_0x267377['options']);return db['UserWhatsappQueue'][_0x26f1('0x46')](_0x56a7ca);}})['then'](function(_0x4c1e62){if(_0x4c1e62){return db[_0x26f1('0x5f')][_0x26f1('0x60')]({'where':{'id':_[_0x26f1('0x2f')](_0x4c1e62,'UserId'),'role':'agent'},'attributes':['id',_0x26f1('0x34'),_0x26f1('0x61'),_0x26f1('0x62'),_0x26f1('0x63')]});}})[_0x26f1('0x29')](function(_0x5260e0){if(_0x5260e0){return{'count':_0x5260e0['count'],'rows':_[_0x26f1('0x2f')](_0x5260e0['rows'],function(_0x25ef6f){return{'membername':_0x25ef6f['name'],'UserId':_0x25ef6f['id'],'queue_name':_0xc84907[_0x26f1('0x34')],'WhatsappQueueId':_0xc84907['id'],'interface':util[_0x26f1('0x64')](_0x26f1('0x65'),_0x26f1('0x66'),_0x25ef6f[_0x26f1('0x34')]),'penalty':0x0,'paused':_0x25ef6f['whatsappPause'],'createdAt':_0x25ef6f[_0x26f1('0x63')],'updatedAt':_0x25ef6f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x26f1('0x29')](respondWithFilteredResult(_0x525a37,_0x56a7ca))[_0x26f1('0x56')](handleError(_0x525a37,null));};exports[_0x26f1('0x67')]=function(_0x328353,_0x827916,_0x2d6405){var _0x154284={};var _0x4dd920={};var _0x2b6c7e;var _0xfcd14f;return db[_0x26f1('0x30')]['findOne']({'where':{'id':_0x328353['params']['id']}})['then'](handleEntityNotFound(_0x827916,null))['then'](function(_0x121397){if(_0x121397){_0x2b6c7e=_0x121397;_0x4dd920['model']=_[_0x26f1('0x4a')](db[_0x26f1('0x68')][_0x26f1('0x31')]);_0x4dd920[_0x26f1('0x35')]=_['keys'](_0x328353[_0x26f1('0x35')]);_0x4dd920[_0x26f1('0x40')]=_[_0x26f1('0x36')](_0x4dd920[_0x26f1('0x37')],_0x4dd920[_0x26f1('0x35')]);_0x154284[_0x26f1('0x39')]=_[_0x26f1('0x36')](_0x4dd920[_0x26f1('0x37')],qs['fields'](_0x328353[_0x26f1('0x35')][_0x26f1('0x38')]));_0x154284[_0x26f1('0x39')]=_0x154284['attributes'][_0x26f1('0x3a')]?_0x154284['attributes']:_0x4dd920[_0x26f1('0x37')];_0x154284[_0x26f1('0x3e')]=qs[_0x26f1('0x5d')](_0x328353[_0x26f1('0x35')][_0x26f1('0x5d')]);_0x154284[_0x26f1('0x3f')]=qs['filters'](_[_0x26f1('0x41')](_0x328353[_0x26f1('0x35')],_0x4dd920['filters']));if(_0x328353[_0x26f1('0x35')][_0x26f1('0x43')]){_0x154284[_0x26f1('0x3f')]=_[_0x26f1('0x44')](_0x154284[_0x26f1('0x3f')],{'$or':_[_0x26f1('0x2f')](_0x154284['attributes'],function(_0x5438a6){var _0x5f38b0={};_0x5f38b0[_0x5438a6]={'$like':'%'+_0x328353['query'][_0x26f1('0x43')]+'%'};return _0x5f38b0;})});}_0x154284=_[_0x26f1('0x44')]({},_0x154284,_0x328353['options']);return _0x2b6c7e[_0x26f1('0x67')](_0x154284);}})[_0x26f1('0x29')](function(_0x2cec9b){if(_0x2cec9b){_0xfcd14f=_0x2cec9b[_0x26f1('0x3a')];if(!_0x328353[_0x26f1('0x35')][_0x26f1('0x3b')](_0x26f1('0x3c'))){_0x154284[_0x26f1('0x22')]=qs[_0x26f1('0x22')](_0x328353[_0x26f1('0x35')][_0x26f1('0x22')]);_0x154284[_0x26f1('0x3d')]=qs['offset'](_0x328353[_0x26f1('0x35')]['offset']);}return _0x2b6c7e['getTeams'](_0x154284);}})[_0x26f1('0x29')](function(_0x31c018){if(_0x31c018){return _0x31c018?{'count':_0xfcd14f,'rows':_0x31c018}:null;}})['then'](respondWithResult(_0x827916,null))[_0x26f1('0x56')](handleError(_0x827916,null));};exports[_0x26f1('0x69')]=function(_0x2a016d,_0x57be2a,_0x490d8b){var _0x5e2f06=_0x2a016d[_0x26f1('0x4e')][_0x26f1('0x6a')];return db[_0x26f1('0x68')][_0x26f1('0x46')]({'where':{'id':_0x5e2f06},'attributes':['id'],'include':[{'model':db[_0x26f1('0x5f')],'as':'Agents','attributes':['id',_0x26f1('0x34'),_0x26f1('0x6b'),_0x26f1('0x6c'),'interface'],'raw':!![]}]})[_0x26f1('0x29')](function(_0x1d7f94){if(_0x1d7f94){var _0x2812a6=_[_0x26f1('0x6d')](_0x1d7f94,function(_0xf92835){var _0x26e92b=_0xf92835['get']({'plain':!![]});return _0x26e92b['Agents'];});return db[_0x26f1('0x30')][_0x26f1('0x4c')]({'where':{'id':_0x2a016d[_0x26f1('0x49')]['id']}})[_0x26f1('0x29')](function(_0x3d99e8){return db['sequelize'][_0x26f1('0x6e')](function(_0x448d4c){return _0x3d99e8[_0x26f1('0x69')](_0x5e2f06,{'transaction':_0x448d4c})[_0x26f1('0x29')](function(){return BPromise[_0x26f1('0x6f')](_0x2812a6,function(_0xff896f){return db[_0x26f1('0x5c')][_0x26f1('0x70')]({'where':{'UserId':_0xff896f['id'],'WhatsappQueueId':_0x2a016d[_0x26f1('0x49')]['id']},'transaction':_0x448d4c});});})[_0x26f1('0x29')](function(){_0x2812a6[_0x26f1('0x71')](function(_0x3fc723){socket[_0x26f1('0x72')](_0x26f1('0x73'),{'UserId':_0x3fc723['id'],'WhatsappQueueId':_0x3d99e8['id']});});});});});}})[_0x26f1('0x29')](respondWithStatusCode(_0x57be2a,null))[_0x26f1('0x56')](handleError(_0x57be2a,null));};exports[_0x26f1('0x74')]=function(_0x24b2d6,_0x27e6b3,_0x281731){return db[_0x26f1('0x68')][_0x26f1('0x46')]({'where':{'id':_0x24b2d6[_0x26f1('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x26f1('0x5f')],'as':_0x26f1('0x75'),'attributes':['id'],'raw':!![]}]})[_0x26f1('0x29')](handleEntityNotFound(_0x27e6b3,null))['then'](function(_0x28f4a8){var _0x5045f4=_['map'](_0x28f4a8,'id');var _0x5b77fc=[];var _0x3c42e5=[];var _0x4245f0=squel[_0x26f1('0x76')]();_0x4245f0[_0x26f1('0x77')](_0x26f1('0x78'))['from']('team_has_whatsapp_queues','tq')[_0x26f1('0x79')]('user_has_teams','ut',_0x26f1('0x7a'))['where']('WhatsappQueueId\x20=\x20?',_0x24b2d6[_0x26f1('0x49')]['id']);for(var _0x3dc7bb=0x0;_0x3dc7bb<_0x28f4a8[_0x26f1('0x3a')];_0x3dc7bb+=0x1){let _0xeb0a94=_0x28f4a8[_0x3dc7bb];for(var _0x1d3629=0x0;_0x1d3629<_0xeb0a94[_0x26f1('0x75')]['length'];_0x1d3629+=0x1){let _0x1885d1=_0xeb0a94['Agents'][_0x1d3629];var _0x131dea=_0x4245f0[_0x26f1('0x7b')]();_0x131dea[_0x26f1('0x3f')](_0x26f1('0x7c'),_0x1885d1['id']);_0x3c42e5[_0x26f1('0x7d')](db[_0x26f1('0x7e')]['query'](_0x131dea[_0x26f1('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x26f1('0x80')]})[_0x26f1('0x29')](function(_0x596289){if(_0x596289[_0x26f1('0x3a')]===0x1){return _0x1885d1['id'];}else{var _0x390140=_[_0x26f1('0x81')](_[_0x26f1('0x2f')](_0x596289,'TeamId'),function(_0x1fae35){return _[_0x26f1('0x82')](_0x5045f4,_0x1fae35);});if(_0x390140){return _0x1885d1['id'];}}}));}}return BPromise[_0x26f1('0x83')](_0x3c42e5)[_0x26f1('0x29')](function(_0x3ca2fe){_0x5b77fc=_(_0x5b77fc)['union'](_0x3ca2fe)['compact']()[_0x26f1('0x84')]();return db[_0x26f1('0x30')][_0x26f1('0x4c')]({'where':{'id':_0x24b2d6['params']['id']}})[_0x26f1('0x29')](function(_0x35484a){return db[_0x26f1('0x7e')][_0x26f1('0x6e')](function(_0x4c8e0c){return _0x35484a['removeTeams'](_0x24b2d6[_0x26f1('0x35')][_0x26f1('0x6a')],{'transaction':_0x4c8e0c})[_0x26f1('0x29')](function(){if(!_[_0x26f1('0x85')](_0x5b77fc)){return _0x35484a['removeAgents'](_0x5b77fc,{'transaction':_0x4c8e0c});}})[_0x26f1('0x29')](function(){_0x5b77fc['forEach'](function(_0x20df94){socket[_0x26f1('0x72')](_0x26f1('0x86'),{'UserId':_0x20df94,'WhatsappQueueId':_0x35484a['id']});});});});});});})[_0x26f1('0x29')](respondWithStatusCode(_0x27e6b3,null))[_0x26f1('0x56')](handleError(_0x27e6b3,null));};exports['addAgents']=function(_0x5bb8b0,_0x2c2c63,_0x1d45d8){return db[_0x26f1('0x30')][_0x26f1('0x4c')]({'where':{'id':_0x5bb8b0[_0x26f1('0x49')]['id']}})[_0x26f1('0x29')](handleEntityNotFound(_0x2c2c63,null))[_0x26f1('0x29')](function(_0x4f1964){if(_0x4f1964){return _0x4f1964[_0x26f1('0x87')](_0x5bb8b0[_0x26f1('0x4e')][_0x26f1('0x6a')],_[_0x26f1('0x88')](_0x5bb8b0[_0x26f1('0x4e')],[_0x26f1('0x6a'),'id'])||{})[_0x26f1('0x89')](function(_0x52a547){for(var _0x39bc9b=0x0;_0x39bc9b<_0x5bb8b0[_0x26f1('0x4e')][_0x26f1('0x6a')][_0x26f1('0x3a')];_0x39bc9b+=0x1){socket[_0x26f1('0x72')]('userWhatsappQueue:save',{'UserId':_0x5bb8b0['body'][_0x26f1('0x6a')][_0x39bc9b],'WhatsappQueueId':_0x5bb8b0[_0x26f1('0x49')]['id']});}return _0x52a547;});}})[_0x26f1('0x29')](respondWithResult(_0x2c2c63,null))[_0x26f1('0x56')](handleError(_0x2c2c63,null));};exports[_0x26f1('0x8a')]=function(_0x2d29e5,_0x56fbde,_0x573968){return db['WhatsappQueue']['find']({'where':{'id':_0x2d29e5[_0x26f1('0x49')]['id']}})['then'](handleEntityNotFound(_0x56fbde,null))['then'](function(_0x3371fb){if(_0x3371fb){return _0x3371fb['removeAgents'](_0x2d29e5['query'][_0x26f1('0x6a')])['then'](function(){if(_['isArray'](_0x2d29e5[_0x26f1('0x35')][_0x26f1('0x6a')])){for(var _0x3018ab=0x0;_0x3018ab<_0x2d29e5[_0x26f1('0x35')]['ids'][_0x26f1('0x3a')];_0x3018ab+=0x1){socket[_0x26f1('0x72')](_0x26f1('0x86'),{'UserId':Number(_0x2d29e5['query'][_0x26f1('0x6a')][_0x3018ab]),'WhatsappQueueId':Number(_0x2d29e5[_0x26f1('0x49')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x2d29e5[_0x26f1('0x35')][_0x26f1('0x6a')]),'WhatsappQueueId':Number(_0x2d29e5[_0x26f1('0x49')]['id'])});}});}})[_0x26f1('0x29')](respondWithStatusCode(_0x56fbde,null))[_0x26f1('0x56')](handleError(_0x56fbde,null));};exports['getAgents']=function(_0x14a438,_0x58dbd8,_0x286a8b){var _0x3decdd={};var _0x57c75e={};var _0x582c40;var _0x35afd5;return db[_0x26f1('0x30')][_0x26f1('0x5b')]({'where':{'id':_0x14a438[_0x26f1('0x49')]['id']}})[_0x26f1('0x29')](handleEntityNotFound(_0x58dbd8,null))[_0x26f1('0x29')](function(_0x295b71){if(_0x295b71){_0x582c40=_0x295b71;_0x57c75e[_0x26f1('0x37')]=_['keys'](db['User'][_0x26f1('0x31')]);_0x57c75e[_0x26f1('0x35')]=_['keys'](_0x14a438[_0x26f1('0x35')]);_0x57c75e['filters']=_[_0x26f1('0x36')](_0x57c75e[_0x26f1('0x37')],_0x57c75e[_0x26f1('0x35')]);_0x3decdd[_0x26f1('0x39')]=_['intersection'](_0x57c75e[_0x26f1('0x37')],qs[_0x26f1('0x38')](_0x14a438[_0x26f1('0x35')][_0x26f1('0x38')]));_0x3decdd[_0x26f1('0x39')]=_0x3decdd[_0x26f1('0x39')][_0x26f1('0x3a')]?_0x3decdd[_0x26f1('0x39')]:_0x57c75e[_0x26f1('0x37')];_0x3decdd[_0x26f1('0x3e')]=qs[_0x26f1('0x5d')](_0x14a438[_0x26f1('0x35')]['sort']);_0x3decdd[_0x26f1('0x3f')]=qs[_0x26f1('0x40')](_[_0x26f1('0x41')](_0x14a438[_0x26f1('0x35')],_0x57c75e[_0x26f1('0x40')]));if(_0x14a438[_0x26f1('0x35')][_0x26f1('0x43')]){_0x3decdd[_0x26f1('0x3f')]=_['merge'](_0x3decdd[_0x26f1('0x3f')],{'$or':_[_0x26f1('0x2f')](_0x3decdd['attributes'],function(_0x7cc4ce){var _0x5ea6bd={};_0x5ea6bd[_0x7cc4ce]={'$like':'%'+_0x14a438[_0x26f1('0x35')][_0x26f1('0x43')]+'%'};return _0x5ea6bd;})});}_0x3decdd=_['merge']({},_0x3decdd,_0x14a438[_0x26f1('0x4b')]);return _0x582c40[_0x26f1('0x8b')](_0x3decdd);}})[_0x26f1('0x29')](function(_0x80495){if(_0x80495){_0x35afd5=_0x80495[_0x26f1('0x3a')];if(!_0x14a438[_0x26f1('0x35')][_0x26f1('0x3b')](_0x26f1('0x3c'))){_0x3decdd[_0x26f1('0x22')]=qs[_0x26f1('0x22')](_0x14a438[_0x26f1('0x35')][_0x26f1('0x22')]);_0x3decdd[_0x26f1('0x3d')]=qs[_0x26f1('0x3d')](_0x14a438[_0x26f1('0x35')][_0x26f1('0x3d')]);}return _0x582c40[_0x26f1('0x8b')](_0x3decdd);}})[_0x26f1('0x29')](function(_0x18b70c){if(_0x18b70c){return _0x18b70c?{'count':_0x35afd5,'rows':_0x18b70c}:null;}})[_0x26f1('0x29')](respondWithResult(_0x58dbd8,null))[_0x26f1('0x56')](handleError(_0x58dbd8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d8c522f..38e9c9e 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 _0x18ab=['save','update','emit','hook','exports','setMaxListeners'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x18ab,0x185));var _0xb18a=function(_0x59ce0a,_0x56824b){_0x59ce0a=_0x59ce0a-0x0;var _0x81c43b=_0x18ab[_0x59ce0a];return _0x81c43b;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb18a('0x0')](0x0);var events={'afterCreate':_0xb18a('0x1'),'afterUpdate':_0xb18a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x358de3){return function(_0x15da7f,_0x493eaa,_0x84076c){WhatsappQueueEvents[_0xb18a('0x3')](_0x358de3+':'+_0x15da7f['id'],_0x15da7f);WhatsappQueueEvents['emit'](_0x358de3,_0x15da7f);_0x84076c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xb18a('0x4')](e,emitEvent(event));}}module[_0xb18a('0x5')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0cd4=['emit','hasOwnProperty','hook','exports','setMaxListeners','save','update','remove'];(function(_0x41f3e1,_0x366ab3){var _0x4e277f=function(_0x24ab0e){while(--_0x24ab0e){_0x41f3e1['push'](_0x41f3e1['shift']());}};_0x4e277f(++_0x366ab3);}(_0x0cd4,0xdc));var _0x40cd=function(_0x526105,_0x17e09f){_0x526105=_0x526105-0x0;var _0x16cad1=_0x0cd4[_0x526105];return _0x16cad1;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x40cd('0x0')](0x0);var events={'afterCreate':_0x40cd('0x1'),'afterUpdate':_0x40cd('0x2'),'afterDestroy':_0x40cd('0x3')};function emitEvent(_0x5ba272){return function(_0x40ba3d,_0x214653,_0x2a910d){WhatsappQueueEvents[_0x40cd('0x4')](_0x5ba272+':'+_0x40ba3d['id'],_0x40ba3d);WhatsappQueueEvents['emit'](_0x5ba272,_0x40ba3d);_0x2a910d(null);};}for(var e in events){if(events[_0x40cd('0x5')](e)){var event=events[e];WhatsappQueue[_0x40cd('0x6')](e,emitEvent(event));}}module[_0x40cd('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 01f83c8..de4fe40 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 _0xe6cd=['../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ff1a8,_0x3fd694){var _0x32fd96=function(_0x3433f3){while(--_0x3433f3){_0x3ff1a8['push'](_0x3ff1a8['shift']());}};_0x32fd96(++_0x3fd694);}(_0xe6cd,0x180));var _0xde6c=function(_0x519d77,_0x4e758e){_0x519d77=_0x519d77-0x0;var _0x56e79d=_0xe6cd[_0x519d77];return _0x56e79d;};'use strict';var _=require(_0xde6c('0x0'));var util=require('util');var logger=require(_0xde6c('0x1'))(_0xde6c('0x2'));var moment=require(_0xde6c('0x3'));var BPromise=require(_0xde6c('0x4'));var rp=require(_0xde6c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xde6c('0x6'));var attributes=require(_0xde6c('0x7'));module[_0xde6c('0x8')]=function(_0x262618,_0x89cbb1){return _0x262618['define'](_0xde6c('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9166=['exports','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x50bbe4,_0x3d6ed0){var _0x46a4c1=function(_0x1a9862){while(--_0x1a9862){_0x50bbe4['push'](_0x50bbe4['shift']());}};_0x46a4c1(++_0x3d6ed0);}(_0x9166,0x17b));var _0x6916=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x9166[_0x3b96cf];return _0x2e315a;};'use strict';var _=require(_0x6916('0x0'));var util=require(_0x6916('0x1'));var logger=require(_0x6916('0x2'))(_0x6916('0x3'));var moment=require(_0x6916('0x4'));var BPromise=require(_0x6916('0x5'));var rp=require(_0x6916('0x6'));var fs=require('fs');var path=require(_0x6916('0x7'));var rimraf=require(_0x6916('0x8'));var config=require(_0x6916('0x9'));var attributes=require(_0x6916('0xa'));module[_0x6916('0xb')]=function(_0x2f8781,_0x1ff4d0){return _0x2f8781['define']('WhatsappQueue',attributes,{'tableName':_0x6916('0xc'),'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 4002c46..b504475 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 _0x8cd7=['message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','redis','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x8cd7,0x18d));var _0x78cd=function(_0x3ccd07,_0x723bf8){_0x3ccd07=_0x3ccd07-0x0;var _0x340e1a=_0x8cd7[_0x3ccd07];return _0x340e1a;};'use strict';var _=require('lodash');var util=require(_0x78cd('0x0'));var moment=require(_0x78cd('0x1'));var BPromise=require(_0x78cd('0x2'));var rs=require(_0x78cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x78cd('0x5'))('rpc');var config=require(_0x78cd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x78cd('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x78cd('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x78cd('0x9'))(new Redis(config[_0x78cd('0x8')]));require(_0x78cd('0xa'))[_0x78cd('0xb')](socket);function respondWithRpcPromise(_0x4e421b,_0x5fdf6e,_0x274d85){return new BPromise(function(_0x5c5b0d,_0xec861){return client[_0x78cd('0xc')](_0x4e421b,_0x274d85)['then'](function(_0x11b438){logger[_0x78cd('0xd')](_0x78cd('0xe'),_0x5fdf6e,_0x78cd('0xf'));logger[_0x78cd('0x10')](_0x78cd('0x11'),_0x5fdf6e,_0x78cd('0xf'),JSON[_0x78cd('0x12')](_0x11b438));if(_0x11b438[_0x78cd('0x13')]){if(_0x11b438[_0x78cd('0x13')][_0x78cd('0x14')]===0x1f4){logger[_0x78cd('0x13')](_0x78cd('0xe'),_0x5fdf6e,_0x11b438[_0x78cd('0x13')][_0x78cd('0x15')]);return _0xec861(_0x11b438[_0x78cd('0x13')]['message']);}logger[_0x78cd('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x5fdf6e,_0x11b438[_0x78cd('0x13')][_0x78cd('0x15')]);return _0x5c5b0d(_0x11b438[_0x78cd('0x13')][_0x78cd('0x15')]);}else{logger[_0x78cd('0xd')](_0x78cd('0xe'),_0x5fdf6e,'request\x20sent');_0x5c5b0d(_0x11b438[_0x78cd('0x16')][_0x78cd('0x15')]);}})['catch'](function(_0x133005){logger['error'](_0x78cd('0xe'),_0x5fdf6e,_0x133005);_0xec861(_0x133005);});});}exports[_0x78cd('0x17')]=function(_0x5e7d5a){var _0x16daf8=this;return new Promise(function(_0x2bc9ad,_0x1bea97){return db[_0x78cd('0x18')][_0x78cd('0x19')]({'raw':_0x5e7d5a[_0x78cd('0x1a')]?_0x5e7d5a[_0x78cd('0x1a')][_0x78cd('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e7d5a[_0x78cd('0x1a')]?_0x5e7d5a['options'][_0x78cd('0x1c')]||null:null,'attributes':_0x5e7d5a[_0x78cd('0x1a')]?_0x5e7d5a[_0x78cd('0x1a')][_0x78cd('0x1d')]||null:null,'limit':_0x5e7d5a[_0x78cd('0x1a')]?_0x5e7d5a[_0x78cd('0x1a')][_0x78cd('0x1e')]||null:null,'include':_0x5e7d5a[_0x78cd('0x1a')]?_0x5e7d5a[_0x78cd('0x1a')][_0x78cd('0x1f')]?_[_0x78cd('0x20')](_0x5e7d5a[_0x78cd('0x1a')][_0x78cd('0x1f')],function(_0xcfe8f0){return{'model':db[_0xcfe8f0['model']],'as':_0xcfe8f0['as'],'attributes':_0xcfe8f0[_0x78cd('0x1d')],'include':_0xcfe8f0['include']?_[_0x78cd('0x20')](_0xcfe8f0[_0x78cd('0x1f')],function(_0x3ffd2f){return{'model':db[_0x3ffd2f[_0x78cd('0x21')]],'as':_0x3ffd2f['as'],'attributes':_0x3ffd2f[_0x78cd('0x1d')],'include':_0x3ffd2f[_0x78cd('0x1f')]?_[_0x78cd('0x20')](_0x3ffd2f[_0x78cd('0x1f')],function(_0x123299){return{'model':db[_0x123299[_0x78cd('0x21')]],'as':_0x123299['as'],'attributes':_0x123299[_0x78cd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x78cd('0x22')](function(_0x3708f6){logger['info'](_0x78cd('0x17'),_0x5e7d5a);logger[_0x78cd('0x10')]('GetWhatsappQueue',_0x5e7d5a,JSON[_0x78cd('0x12')](_0x3708f6));_0x2bc9ad(_0x3708f6);})[_0x78cd('0x23')](function(_0x22a12c){logger['error'](_0x78cd('0x17'),_0x22a12c[_0x78cd('0x15')],_0x5e7d5a);_0x1bea97(_0x16daf8[_0x78cd('0x13')](0x1f4,_0x22a12c[_0x78cd('0x15')]));});});};exports[_0x78cd('0x24')]=function(_0x16733a){var _0x4a8baf=this;return new Promise(function(_0x2f9576,_0x28513f){return db[_0x78cd('0x18')][_0x78cd('0x25')]({'raw':_0x16733a[_0x78cd('0x1a')]?_0x16733a[_0x78cd('0x1a')][_0x78cd('0x1b')]===undefined?!![]:![]:!![],'where':_0x16733a[_0x78cd('0x1a')]?_0x16733a['options'][_0x78cd('0x1c')]||null:null,'attributes':_0x16733a[_0x78cd('0x1a')]?_0x16733a[_0x78cd('0x1a')][_0x78cd('0x1d')]||null:null,'include':_0x16733a[_0x78cd('0x1a')]?_0x16733a[_0x78cd('0x1a')][_0x78cd('0x1f')]?_[_0x78cd('0x20')](_0x16733a[_0x78cd('0x1a')]['include'],function(_0x2260f2){return{'model':db[_0x2260f2[_0x78cd('0x21')]],'as':_0x2260f2['as'],'attributes':_0x2260f2[_0x78cd('0x1d')],'include':_0x2260f2['include']?_['map'](_0x2260f2[_0x78cd('0x1f')],function(_0x449226){return{'model':db[_0x449226[_0x78cd('0x21')]],'as':_0x449226['as'],'attributes':_0x449226[_0x78cd('0x1d')],'include':_0x449226[_0x78cd('0x1f')]?_[_0x78cd('0x20')](_0x449226[_0x78cd('0x1f')],function(_0x4fa6e1){return{'model':db[_0x4fa6e1[_0x78cd('0x21')]],'as':_0x4fa6e1['as'],'attributes':_0x4fa6e1[_0x78cd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x78cd('0x22')](function(_0x121f7e){logger[_0x78cd('0xd')]('ShowWhatsappQueue',_0x16733a);logger[_0x78cd('0x10')](_0x78cd('0x24'),_0x16733a,JSON[_0x78cd('0x12')](_0x121f7e));_0x2f9576(_0x121f7e);})[_0x78cd('0x23')](function(_0x55b11e){logger['error'](_0x78cd('0x24'),_0x55b11e['message'],_0x16733a);_0x28513f(_0x4a8baf[_0x78cd('0x13')](0x1f4,_0x55b11e[_0x78cd('0x15')]));});});}; \ No newline at end of file +var _0x006a=['debug','error','code','message','WhatsappQueue','findAll','options','raw','attributes','include','model','map','then','GetWhatsappQueue','stringify','find','ShowWhatsappQueue','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x50b89c,_0x500b8e){var _0x505db3=function(_0x859b4){while(--_0x859b4){_0x50b89c['push'](_0x50b89c['shift']());}};_0x505db3(++_0x500b8e);}(_0x006a,0x11c));var _0xa006=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x006a[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xa006('0x0'));var util=require(_0xa006('0x1'));var moment=require(_0xa006('0x2'));var BPromise=require(_0xa006('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa006('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa006('0x5'));var logger=require(_0xa006('0x6'))(_0xa006('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa006('0x8')][_0xa006('0x9')]({'port':0x232a});config[_0xa006('0xa')]=_[_0xa006('0xb')](config[_0xa006('0xa')],{'host':_0xa006('0xc'),'port':0x18eb});var socket=require(_0xa006('0xd'))(new Redis(config[_0xa006('0xa')]));require(_0xa006('0xe'))[_0xa006('0xf')](socket);function respondWithRpcPromise(_0x3446f4,_0x35b297,_0x346286){return new BPromise(function(_0x4f1dfa,_0x297524){return client[_0xa006('0x10')](_0x3446f4,_0x346286)['then'](function(_0xdb9cd6){logger[_0xa006('0x11')](_0xa006('0x12'),_0x35b297,_0xa006('0x13'));logger[_0xa006('0x14')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x35b297,_0xa006('0x13'),JSON['stringify'](_0xdb9cd6));if(_0xdb9cd6[_0xa006('0x15')]){if(_0xdb9cd6[_0xa006('0x15')][_0xa006('0x16')]===0x1f4){logger[_0xa006('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x35b297,_0xdb9cd6[_0xa006('0x15')][_0xa006('0x17')]);return _0x297524(_0xdb9cd6['error'][_0xa006('0x17')]);}logger[_0xa006('0x15')](_0xa006('0x12'),_0x35b297,_0xdb9cd6[_0xa006('0x15')][_0xa006('0x17')]);return _0x4f1dfa(_0xdb9cd6['error'][_0xa006('0x17')]);}else{logger[_0xa006('0x11')](_0xa006('0x12'),_0x35b297,_0xa006('0x13'));_0x4f1dfa(_0xdb9cd6['result']['message']);}})['catch'](function(_0x2fe192){logger[_0xa006('0x15')](_0xa006('0x12'),_0x35b297,_0x2fe192);_0x297524(_0x2fe192);});});}exports['GetWhatsappQueue']=function(_0x589ce9){var _0x1ed247=this;return new Promise(function(_0x999e3a,_0x18b169){return db[_0xa006('0x18')][_0xa006('0x19')]({'raw':_0x589ce9[_0xa006('0x1a')]?_0x589ce9[_0xa006('0x1a')][_0xa006('0x1b')]===undefined?!![]:![]:!![],'where':_0x589ce9[_0xa006('0x1a')]?_0x589ce9[_0xa006('0x1a')]['where']||null:null,'attributes':_0x589ce9['options']?_0x589ce9[_0xa006('0x1a')][_0xa006('0x1c')]||null:null,'limit':_0x589ce9['options']?_0x589ce9[_0xa006('0x1a')]['limit']||null:null,'include':_0x589ce9[_0xa006('0x1a')]?_0x589ce9[_0xa006('0x1a')]['include']?_['map'](_0x589ce9[_0xa006('0x1a')][_0xa006('0x1d')],function(_0x5875fe){return{'model':db[_0x5875fe[_0xa006('0x1e')]],'as':_0x5875fe['as'],'attributes':_0x5875fe[_0xa006('0x1c')],'include':_0x5875fe['include']?_[_0xa006('0x1f')](_0x5875fe[_0xa006('0x1d')],function(_0x2da8d2){return{'model':db[_0x2da8d2[_0xa006('0x1e')]],'as':_0x2da8d2['as'],'attributes':_0x2da8d2[_0xa006('0x1c')],'include':_0x2da8d2[_0xa006('0x1d')]?_['map'](_0x2da8d2['include'],function(_0x460a4e){return{'model':db[_0x460a4e[_0xa006('0x1e')]],'as':_0x460a4e['as'],'attributes':_0x460a4e[_0xa006('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa006('0x20')](function(_0x499cb7){logger[_0xa006('0x11')](_0xa006('0x21'),_0x589ce9);logger['debug'](_0xa006('0x21'),_0x589ce9,JSON[_0xa006('0x22')](_0x499cb7));_0x999e3a(_0x499cb7);})['catch'](function(_0xff8702){logger['error']('GetWhatsappQueue',_0xff8702[_0xa006('0x17')],_0x589ce9);_0x18b169(_0x1ed247[_0xa006('0x15')](0x1f4,_0xff8702[_0xa006('0x17')]));});});};exports['ShowWhatsappQueue']=function(_0x39cadd){var _0x25de1e=this;return new Promise(function(_0x16f0f2,_0x42bfbb){return db[_0xa006('0x18')][_0xa006('0x23')]({'raw':_0x39cadd['options']?_0x39cadd[_0xa006('0x1a')][_0xa006('0x1b')]===undefined?!![]:![]:!![],'where':_0x39cadd[_0xa006('0x1a')]?_0x39cadd[_0xa006('0x1a')]['where']||null:null,'attributes':_0x39cadd[_0xa006('0x1a')]?_0x39cadd[_0xa006('0x1a')][_0xa006('0x1c')]||null:null,'include':_0x39cadd['options']?_0x39cadd[_0xa006('0x1a')][_0xa006('0x1d')]?_[_0xa006('0x1f')](_0x39cadd['options']['include'],function(_0xba4c1){return{'model':db[_0xba4c1['model']],'as':_0xba4c1['as'],'attributes':_0xba4c1[_0xa006('0x1c')],'include':_0xba4c1[_0xa006('0x1d')]?_['map'](_0xba4c1['include'],function(_0xf68adc){return{'model':db[_0xf68adc[_0xa006('0x1e')]],'as':_0xf68adc['as'],'attributes':_0xf68adc['attributes'],'include':_0xf68adc[_0xa006('0x1d')]?_[_0xa006('0x1f')](_0xf68adc[_0xa006('0x1d')],function(_0x1cae69){return{'model':db[_0x1cae69[_0xa006('0x1e')]],'as':_0x1cae69['as'],'attributes':_0x1cae69[_0xa006('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cbbe9){logger['info'](_0xa006('0x24'),_0x39cadd);logger['debug']('ShowWhatsappQueue',_0x39cadd,JSON[_0xa006('0x22')](_0x1cbbe9));_0x16f0f2(_0x1cbbe9);})[_0xa006('0x25')](function(_0x335d2a){logger[_0xa006('0x15')]('ShowWhatsappQueue',_0x335d2a[_0xa006('0x17')],_0x39cadd);_0x42bfbb(_0x25de1e['error'](0x1f4,_0x335d2a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index cef3448..bf4b390 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 _0x7a6d=['emit','removeListener','register','length','./whatsappQueue.events','save','remove'];(function(_0x17e6b7,_0x53336b){var _0x151751=function(_0x28025c){while(--_0x28025c){_0x17e6b7['push'](_0x17e6b7['shift']());}};_0x151751(++_0x53336b);}(_0x7a6d,0x1c4));var _0xd7a6=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x7a6d[_0x4b2436];return _0x4f5ab2;};'use strict';var WhatsappQueueEvents=require(_0xd7a6('0x0'));var events=[_0xd7a6('0x1'),_0xd7a6('0x2'),'update'];function createListener(_0x559f1d,_0x14054f){return function(_0x18632f){_0x14054f[_0xd7a6('0x3')](_0x559f1d,_0x18632f);};}function removeListener(_0x51c4dd,_0x310db6){return function(){WhatsappQueueEvents[_0xd7a6('0x4')](_0x51c4dd,_0x310db6);};}exports[_0xd7a6('0x5')]=function(_0x4bf690){for(var _0x1e8d52=0x0,_0x1b84ae=events[_0xd7a6('0x6')];_0x1e8d52<_0x1b84ae;_0x1e8d52++){var _0x1ef5d0=events[_0x1e8d52];var _0x1ba97f=createListener('whatsappQueue:'+_0x1ef5d0,_0x4bf690);WhatsappQueueEvents['on'](_0x1ef5d0,_0x1ba97f);}}; \ No newline at end of file +var _0x249c=['remove','update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x5631d5,_0x3e5b13){var _0x204b16=function(_0xe98f27){while(--_0xe98f27){_0x5631d5['push'](_0x5631d5['shift']());}};_0x204b16(++_0x3e5b13);}(_0x249c,0x181));var _0xc249=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x249c[_0xf2628e];return _0x13863a;};'use strict';var WhatsappQueueEvents=require(_0xc249('0x0'));var events=[_0xc249('0x1'),_0xc249('0x2'),_0xc249('0x3')];function createListener(_0x4e008f,_0x5f1d1f){return function(_0x3e224e){_0x5f1d1f[_0xc249('0x4')](_0x4e008f,_0x3e224e);};}function removeListener(_0x1fcc86,_0x46803f){return function(){WhatsappQueueEvents[_0xc249('0x5')](_0x1fcc86,_0x46803f);};}exports[_0xc249('0x6')]=function(_0xc03a73){for(var _0xfe4c4c=0x0,_0x109604=events[_0xc249('0x7')];_0xfe4c4c<_0x109604;_0xfe4c4c++){var _0x5ed78c=events[_0xfe4c4c];var _0x28e347=createListener(_0xc249('0x8')+_0x5ed78c,_0xc03a73);WhatsappQueueEvents['on'](_0x5ed78c,_0x28e347);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index f4f4e48..12b58ab 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 _0xed1c=['show','post','put','update','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed1c,0xe4));var _0xced1=function(_0xd50142,_0x531b79){_0xd50142=_0xd50142-0x0;var _0x3956f2=_0xed1c[_0xd50142];return _0x3956f2;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xced1('0x2'));var interaction=require(_0xced1('0x3'));var config=require(_0xced1('0x4'));var controller=require('./whatsappQueueReport.controller');router[_0xced1('0x5')]('/',auth[_0xced1('0x6')](),controller[_0xced1('0x7')]);router[_0xced1('0x5')]('/describe',auth[_0xced1('0x6')](),controller[_0xced1('0x8')]);router[_0xced1('0x5')](_0xced1('0x9'),auth[_0xced1('0x6')](),controller[_0xced1('0xa')]);router[_0xced1('0xb')]('/',auth[_0xced1('0x6')](),controller['create']);router[_0xced1('0xc')]('/:id',auth[_0xced1('0x6')](),controller[_0xced1('0xd')]);router[_0xced1('0xe')](_0xced1('0x9'),auth[_0xced1('0x6')](),controller[_0xced1('0xf')]);module[_0xced1('0x10')]=router; \ No newline at end of file +var _0x7d18=['isAuthenticated','index','/describe','describe','post','create','put','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x1dee49,_0x480181){var _0x2bf67e=function(_0x1e6d11){while(--_0x1e6d11){_0x1dee49['push'](_0x1dee49['shift']());}};_0x2bf67e(++_0x480181);}(_0x7d18,0xa3));var _0x87d1=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x7d18[_0x2d61b2];return _0x12df89;};'use strict';var multer=require(_0x87d1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x87d1('0x1'));var express=require(_0x87d1('0x2'));var router=express[_0x87d1('0x3')]();var auth=require(_0x87d1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x87d1('0x5'));var controller=require(_0x87d1('0x6'));router[_0x87d1('0x7')]('/',auth[_0x87d1('0x8')](),controller[_0x87d1('0x9')]);router[_0x87d1('0x7')](_0x87d1('0xa'),auth[_0x87d1('0x8')](),controller[_0x87d1('0xb')]);router[_0x87d1('0x7')]('/:id',auth[_0x87d1('0x8')](),controller['show']);router[_0x87d1('0xc')]('/',auth[_0x87d1('0x8')](),controller[_0x87d1('0xd')]);router[_0x87d1('0xe')]('/:id',auth[_0x87d1('0x8')](),controller['update']);router[_0x87d1('0xf')](_0x87d1('0x10'),auth['isAuthenticated'](),controller[_0x87d1('0x11')]);module[_0x87d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 8fbac1c..eb24565 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 _0x3e74=['DATE','sequelize','STRING'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x3e74,0x175));var _0x43e7=function(_0x27d456,_0x230e75){_0x27d456=_0x27d456-0x0;var _0x509a98=_0x3e74[_0x27d456];return _0x509a98;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x43e7('0x1')]},'joinAt':{'type':Sequelize[_0x43e7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43e7('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x1b0d0b,_0x30108b){var _0x2162d4=function(_0x2d5bb4){while(--_0x2d5bb4){_0x1b0d0b['push'](_0x1b0d0b['shift']());}};_0x2162d4(++_0x30108b);}(_0x34e8,0x12c));var _0x834e=function(_0x29946e,_0x4d3549){_0x29946e=_0x29946e-0x0;var _0x23da97=_0x34e8[_0x29946e];return _0x23da97;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 0fa5dd8..9ca24ea 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 _0xc97a=['type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','WhatsappQueueReport','include','findAll','rows','show','params','keys','intersection','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes'];(function(_0x4f4c53,_0x58ba7b){var _0x568ff1=function(_0x1b6013){while(--_0x1b6013){_0x4f4c53['push'](_0x4f4c53['shift']());}};_0x568ff1(++_0x58ba7b);}(_0xc97a,0x1d9));var _0xac97=function(_0x62b8d1,_0x4c80ee){_0x62b8d1=_0x62b8d1-0x0;var _0x5c9bac=_0xc97a[_0x62b8d1];return _0x5c9bac;};'use strict';var pdf=require(_0xac97('0x0'));var emlformat=require(_0xac97('0x1'));var rimraf=require(_0xac97('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac97('0x3'));var rp=require(_0xac97('0x4'));var moment=require(_0xac97('0x5'));var BPromise=require(_0xac97('0x6'));var Mustache=require(_0xac97('0x7'));var util=require('util');var path=require(_0xac97('0x8'));var sox=require(_0xac97('0x9'));var csv=require(_0xac97('0xa'));var ejs=require(_0xac97('0xb'));var fs=require('fs');var _=require(_0xac97('0xc'));var squel=require('squel');var crypto=require(_0xac97('0xd'));var jsforce=require(_0xac97('0xe'));var deskjs=require(_0xac97('0xf'));var toCsv=require(_0xac97('0xa'));var querystring=require(_0xac97('0x10'));var Papa=require(_0xac97('0x11'));var Redis=require('ioredis');var authService=require(_0xac97('0x12'));var qs=require(_0xac97('0x13'));var as=require(_0xac97('0x14'));var hardwareService=require(_0xac97('0x15'));var logger=require(_0xac97('0x16'))(_0xac97('0x17'));var utils=require(_0xac97('0x18'));var config=require(_0xac97('0x19'));var db=require(_0xac97('0x1a'))['db'];function respondWithStatusCode(_0x32ec1b,_0x56845e){_0x56845e=_0x56845e||0xcc;return function(_0x4659b7){if(_0x4659b7){return _0x32ec1b[_0xac97('0x1b')](_0x56845e);}return _0x32ec1b[_0xac97('0x1c')](_0x56845e)['end']();};}function respondWithResult(_0x2238e1,_0x33ead2){_0x33ead2=_0x33ead2||0xc8;return function(_0x4c555d){if(_0x4c555d){return _0x2238e1[_0xac97('0x1c')](_0x33ead2)['json'](_0x4c555d);}};}function respondWithFilteredResult(_0x263ee9,_0x47b564){return function(_0x54e2ba){if(_0x54e2ba){var _0x208924=_0x54e2ba[_0xac97('0x1d')],_0x3cc046=_0x47b564[_0xac97('0x1e')],_0x15714f=_0x47b564['offset']+_0x47b564[_0xac97('0x1f')],_0x3745e6;if(_0x15714f>=_0x208924){_0x15714f=_0x208924;_0x3745e6=0xc8;}else{_0x3745e6=0xce;}_0x263ee9[_0xac97('0x1c')](_0x3745e6);return _0x263ee9[_0xac97('0x20')]('Content-Range',_0x3cc046+'-'+_0x15714f+'/'+_0x208924)['json'](_0x54e2ba);}return null;};}function patchUpdates(_0x43020f){return function(_0x2fa206){try{jsonpatch[_0xac97('0x21')](_0x2fa206,_0x43020f,!![]);}catch(_0x3e0336){return BPromise['reject'](_0x3e0336);}return _0x2fa206[_0xac97('0x22')]();};}function saveUpdates(_0x289432,_0x304a2a){return function(_0x2403e2){if(_0x2403e2){return _0x2403e2['update'](_0x289432)[_0xac97('0x23')](function(_0x206d69){return _0x206d69;});}return null;};}function removeEntity(_0x3bee6a,_0x9d6a8e){return function(_0x4be8ac){if(_0x4be8ac){return _0x4be8ac[_0xac97('0x24')]()[_0xac97('0x23')](function(){_0x3bee6a[_0xac97('0x1c')](0xcc)[_0xac97('0x25')]();});}};}function handleEntityNotFound(_0x21dc29,_0x5ef7b2){return function(_0x10e5cf){if(!_0x10e5cf){_0x21dc29[_0xac97('0x1b')](0x194);}return _0x10e5cf;};}function handleError(_0x3f2d16,_0x34ea3a){_0x34ea3a=_0x34ea3a||0x1f4;return function(_0x44ce9d){logger[_0xac97('0x26')](_0x44ce9d[_0xac97('0x27')]);if(_0x44ce9d[_0xac97('0x28')]){delete _0x44ce9d[_0xac97('0x28')];}_0x3f2d16[_0xac97('0x1c')](_0x34ea3a)[_0xac97('0x29')](_0x44ce9d);};}exports[_0xac97('0x2a')]=function(_0x9104ea,_0xfb3ab1){var _0x5740cd={},_0x56a074={},_0x3abb65={'count':0x0,'rows':[]};var _0x3186fd=_[_0xac97('0x2b')](db['WhatsappQueueReport'][_0xac97('0x2c')],function(_0x177e4e){return{'name':_0x177e4e['fieldName'],'type':_0x177e4e[_0xac97('0x2d')][_0xac97('0x2e')]};});_0x56a074[_0xac97('0x2f')]=_[_0xac97('0x2b')](_0x3186fd,'name');_0x56a074[_0xac97('0x30')]=_['keys'](_0x9104ea[_0xac97('0x30')]);_0x56a074[_0xac97('0x31')]=_['intersection'](_0x56a074[_0xac97('0x2f')],_0x56a074[_0xac97('0x30')]);_0x5740cd[_0xac97('0x32')]=_['intersection'](_0x56a074[_0xac97('0x2f')],qs[_0xac97('0x33')](_0x9104ea['query'][_0xac97('0x33')]));_0x5740cd[_0xac97('0x32')]=_0x5740cd[_0xac97('0x32')][_0xac97('0x34')]?_0x5740cd[_0xac97('0x32')]:_0x56a074['model'];if(!_0x9104ea[_0xac97('0x30')][_0xac97('0x35')](_0xac97('0x36'))){_0x5740cd[_0xac97('0x1f')]=qs[_0xac97('0x1f')](_0x9104ea[_0xac97('0x30')][_0xac97('0x1f')]);_0x5740cd['offset']=qs[_0xac97('0x1e')](_0x9104ea[_0xac97('0x30')][_0xac97('0x1e')]);}_0x5740cd['order']=qs[_0xac97('0x37')](_0x9104ea[_0xac97('0x30')][_0xac97('0x37')]);_0x5740cd['where']=qs[_0xac97('0x31')](_['pick'](_0x9104ea[_0xac97('0x30')],_0x56a074[_0xac97('0x31')]),_0x3186fd);if(_0x9104ea['query']['filter']){_0x5740cd[_0xac97('0x38')]=_[_0xac97('0x39')](_0x5740cd[_0xac97('0x38')],{'$or':_[_0xac97('0x2b')](_0x3186fd,function(_0x4cd450){if(_0x4cd450[_0xac97('0x2d')]!==_0xac97('0x3a')){var _0x5f414a={};_0x5f414a[_0x4cd450[_0xac97('0x28')]]={'$like':'%'+_0x9104ea['query'][_0xac97('0x3b')]+'%'};return _0x5f414a;}})});}_0x5740cd=_[_0xac97('0x39')]({},_0x5740cd,_0x9104ea[_0xac97('0x3c')]);var _0x30f98e={'where':_0x5740cd['where']};return db[_0xac97('0x3d')]['count'](_0x30f98e)[_0xac97('0x23')](function(_0x271e94){_0x3abb65['count']=_0x271e94;if(_0x9104ea['query']['includeAll']){_0x5740cd[_0xac97('0x3e')]=[{'all':!![]}];}return db[_0xac97('0x3d')][_0xac97('0x3f')](_0x5740cd);})[_0xac97('0x23')](function(_0x464662){_0x3abb65[_0xac97('0x40')]=_0x464662;return _0x3abb65;})[_0xac97('0x23')](respondWithFilteredResult(_0xfb3ab1,_0x5740cd))['catch'](handleError(_0xfb3ab1,null));};exports[_0xac97('0x41')]=function(_0xdc8bb9,_0x34ab68){var _0x3023e9={'raw':!![],'where':{'id':_0xdc8bb9[_0xac97('0x42')]['id']}},_0x26c2ae={};_0x26c2ae[_0xac97('0x2f')]=_[_0xac97('0x43')](db['WhatsappQueueReport'][_0xac97('0x2c')]);_0x26c2ae[_0xac97('0x30')]=_[_0xac97('0x43')](_0xdc8bb9[_0xac97('0x30')]);_0x26c2ae[_0xac97('0x31')]=_[_0xac97('0x44')](_0x26c2ae[_0xac97('0x2f')],_0x26c2ae['query']);_0x3023e9[_0xac97('0x32')]=_[_0xac97('0x44')](_0x26c2ae['model'],qs[_0xac97('0x33')](_0xdc8bb9[_0xac97('0x30')][_0xac97('0x33')]));_0x3023e9[_0xac97('0x32')]=_0x3023e9[_0xac97('0x32')][_0xac97('0x34')]?_0x3023e9[_0xac97('0x32')]:_0x26c2ae[_0xac97('0x2f')];if(_0xdc8bb9[_0xac97('0x30')]['includeAll']){_0x3023e9['include']=[{'all':!![]}];}_0x3023e9=_['merge']({},_0x3023e9,_0xdc8bb9[_0xac97('0x3c')]);return db[_0xac97('0x3d')][_0xac97('0x45')](_0x3023e9)[_0xac97('0x23')](handleEntityNotFound(_0x34ab68,null))[_0xac97('0x23')](respondWithResult(_0x34ab68,null))[_0xac97('0x46')](handleError(_0x34ab68,null));};exports['create']=function(_0x2a618a,_0x5202c6){return db[_0xac97('0x3d')][_0xac97('0x47')](_0x2a618a[_0xac97('0x48')],{})[_0xac97('0x23')](respondWithResult(_0x5202c6,0xc9))['catch'](handleError(_0x5202c6,null));};exports['update']=function(_0x5979e7,_0x5633f5){if(_0x5979e7[_0xac97('0x48')]['id']){delete _0x5979e7['body']['id'];}return db['WhatsappQueueReport'][_0xac97('0x45')]({'where':{'id':_0x5979e7[_0xac97('0x42')]['id']}})[_0xac97('0x23')](handleEntityNotFound(_0x5633f5,null))['then'](saveUpdates(_0x5979e7[_0xac97('0x48')],null))[_0xac97('0x23')](respondWithResult(_0x5633f5,null))[_0xac97('0x46')](handleError(_0x5633f5,null));};exports[_0xac97('0x24')]=function(_0x314632,_0x4d25ac){return db[_0xac97('0x3d')][_0xac97('0x45')]({'where':{'id':_0x314632[_0xac97('0x42')]['id']}})[_0xac97('0x23')](handleEntityNotFound(_0x4d25ac,null))[_0xac97('0x23')](removeEntity(_0x4d25ac,null))[_0xac97('0x46')](handleError(_0x4d25ac,null));};exports[_0xac97('0x49')]=function(_0x58ce96,_0x568b0d){return db[_0xac97('0x3d')][_0xac97('0x49')]()['then'](respondWithResult(_0x568b0d,null))[_0xac97('0x46')](handleError(_0x568b0d,null));}; \ No newline at end of file +var _0xf17a=['body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create'];(function(_0x2ba4e2,_0x4e44c2){var _0x35b3a8=function(_0x224816){while(--_0x224816){_0x2ba4e2['push'](_0x2ba4e2['shift']());}};_0x35b3a8(++_0x4e44c2);}(_0xf17a,0x136));var _0xaf17=function(_0xbf346,_0x2b73dc){_0xbf346=_0xbf346-0x0;var _0x47fec4=_0xf17a[_0xbf346];return _0x47fec4;};'use strict';var pdf=require(_0xaf17('0x0'));var emlformat=require(_0xaf17('0x1'));var rimraf=require(_0xaf17('0x2'));var zipdir=require(_0xaf17('0x3'));var jsonpatch=require(_0xaf17('0x4'));var rp=require(_0xaf17('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf17('0x6'));var path=require(_0xaf17('0x7'));var sox=require(_0xaf17('0x8'));var csv=require(_0xaf17('0x9'));var ejs=require(_0xaf17('0xa'));var fs=require('fs');var _=require(_0xaf17('0xb'));var squel=require('squel');var crypto=require(_0xaf17('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaf17('0xd'));var toCsv=require(_0xaf17('0x9'));var querystring=require(_0xaf17('0xe'));var Papa=require('papaparse');var Redis=require(_0xaf17('0xf'));var authService=require(_0xaf17('0x10'));var qs=require(_0xaf17('0x11'));var as=require(_0xaf17('0x12'));var hardwareService=require(_0xaf17('0x13'));var logger=require(_0xaf17('0x14'))(_0xaf17('0x15'));var utils=require('../../config/utils');var config=require(_0xaf17('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x495085,_0x209bce){_0x209bce=_0x209bce||0xcc;return function(_0x136968){if(_0x136968){return _0x495085[_0xaf17('0x17')](_0x209bce);}return _0x495085[_0xaf17('0x18')](_0x209bce)[_0xaf17('0x19')]();};}function respondWithResult(_0x566dcd,_0x1afa5f){_0x1afa5f=_0x1afa5f||0xc8;return function(_0x39b181){if(_0x39b181){return _0x566dcd[_0xaf17('0x18')](_0x1afa5f)[_0xaf17('0x1a')](_0x39b181);}};}function respondWithFilteredResult(_0x24fd85,_0x586501){return function(_0x145d83){if(_0x145d83){var _0x33a32f=_0x145d83[_0xaf17('0x1b')],_0x5eb253=_0x586501[_0xaf17('0x1c')],_0x1609d2=_0x586501[_0xaf17('0x1c')]+_0x586501[_0xaf17('0x1d')],_0x51ee7c;if(_0x1609d2>=_0x33a32f){_0x1609d2=_0x33a32f;_0x51ee7c=0xc8;}else{_0x51ee7c=0xce;}_0x24fd85[_0xaf17('0x18')](_0x51ee7c);return _0x24fd85[_0xaf17('0x1e')](_0xaf17('0x1f'),_0x5eb253+'-'+_0x1609d2+'/'+_0x33a32f)[_0xaf17('0x1a')](_0x145d83);}return null;};}function patchUpdates(_0x52e585){return function(_0x3191a4){try{jsonpatch[_0xaf17('0x20')](_0x3191a4,_0x52e585,!![]);}catch(_0x52177a){return BPromise[_0xaf17('0x21')](_0x52177a);}return _0x3191a4[_0xaf17('0x22')]();};}function saveUpdates(_0x4b9af9,_0x259506){return function(_0x5c6450){if(_0x5c6450){return _0x5c6450[_0xaf17('0x23')](_0x4b9af9)[_0xaf17('0x24')](function(_0x4163fe){return _0x4163fe;});}return null;};}function removeEntity(_0x26ea00,_0x3d9a7a){return function(_0x336e28){if(_0x336e28){return _0x336e28[_0xaf17('0x25')]()[_0xaf17('0x24')](function(){_0x26ea00['status'](0xcc)[_0xaf17('0x19')]();});}};}function handleEntityNotFound(_0x3b777f,_0x1670a1){return function(_0x39eb7a){if(!_0x39eb7a){_0x3b777f['sendStatus'](0x194);}return _0x39eb7a;};}function handleError(_0x148338,_0x59516b){_0x59516b=_0x59516b||0x1f4;return function(_0x39c226){logger['error'](_0x39c226[_0xaf17('0x26')]);if(_0x39c226[_0xaf17('0x27')]){delete _0x39c226['name'];}_0x148338[_0xaf17('0x18')](_0x59516b)[_0xaf17('0x28')](_0x39c226);};}exports[_0xaf17('0x29')]=function(_0x419bb2,_0x1acde9){var _0x479b95={},_0x1eb4b5={},_0x5a8ee2={'count':0x0,'rows':[]};var _0x427473=_[_0xaf17('0x2a')](db[_0xaf17('0x2b')][_0xaf17('0x2c')],function(_0x5678bf){return{'name':_0x5678bf[_0xaf17('0x2d')],'type':_0x5678bf['type'][_0xaf17('0x2e')]};});_0x1eb4b5['model']=_[_0xaf17('0x2a')](_0x427473,_0xaf17('0x27'));_0x1eb4b5[_0xaf17('0x2f')]=_[_0xaf17('0x30')](_0x419bb2[_0xaf17('0x2f')]);_0x1eb4b5[_0xaf17('0x31')]=_[_0xaf17('0x32')](_0x1eb4b5[_0xaf17('0x33')],_0x1eb4b5[_0xaf17('0x2f')]);_0x479b95[_0xaf17('0x34')]=_[_0xaf17('0x32')](_0x1eb4b5[_0xaf17('0x33')],qs['fields'](_0x419bb2['query'][_0xaf17('0x35')]));_0x479b95[_0xaf17('0x34')]=_0x479b95[_0xaf17('0x34')][_0xaf17('0x36')]?_0x479b95['attributes']:_0x1eb4b5[_0xaf17('0x33')];if(!_0x419bb2[_0xaf17('0x2f')][_0xaf17('0x37')](_0xaf17('0x38'))){_0x479b95[_0xaf17('0x1d')]=qs[_0xaf17('0x1d')](_0x419bb2[_0xaf17('0x2f')][_0xaf17('0x1d')]);_0x479b95['offset']=qs[_0xaf17('0x1c')](_0x419bb2[_0xaf17('0x2f')][_0xaf17('0x1c')]);}_0x479b95[_0xaf17('0x39')]=qs[_0xaf17('0x3a')](_0x419bb2[_0xaf17('0x2f')][_0xaf17('0x3a')]);_0x479b95[_0xaf17('0x3b')]=qs[_0xaf17('0x31')](_[_0xaf17('0x3c')](_0x419bb2[_0xaf17('0x2f')],_0x1eb4b5[_0xaf17('0x31')]),_0x427473);if(_0x419bb2[_0xaf17('0x2f')][_0xaf17('0x3d')]){_0x479b95[_0xaf17('0x3b')]=_[_0xaf17('0x3e')](_0x479b95[_0xaf17('0x3b')],{'$or':_[_0xaf17('0x2a')](_0x427473,function(_0x43d467){if(_0x43d467[_0xaf17('0x3f')]!==_0xaf17('0x40')){var _0x28ddc0={};_0x28ddc0[_0x43d467[_0xaf17('0x27')]]={'$like':'%'+_0x419bb2[_0xaf17('0x2f')]['filter']+'%'};return _0x28ddc0;}})});}_0x479b95=_['merge']({},_0x479b95,_0x419bb2[_0xaf17('0x41')]);var _0x51f27a={'where':_0x479b95[_0xaf17('0x3b')]};return db['WhatsappQueueReport'][_0xaf17('0x1b')](_0x51f27a)[_0xaf17('0x24')](function(_0x543bcf){_0x5a8ee2['count']=_0x543bcf;if(_0x419bb2[_0xaf17('0x2f')][_0xaf17('0x42')]){_0x479b95['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xaf17('0x43')](_0x479b95);})[_0xaf17('0x24')](function(_0x1b9cee){_0x5a8ee2[_0xaf17('0x44')]=_0x1b9cee;return _0x5a8ee2;})[_0xaf17('0x24')](respondWithFilteredResult(_0x1acde9,_0x479b95))[_0xaf17('0x45')](handleError(_0x1acde9,null));};exports[_0xaf17('0x46')]=function(_0x2fd085,_0x2e64bf){var _0x3d5114={'raw':!![],'where':{'id':_0x2fd085[_0xaf17('0x47')]['id']}},_0x7361bb={};_0x7361bb[_0xaf17('0x33')]=_[_0xaf17('0x30')](db[_0xaf17('0x2b')][_0xaf17('0x2c')]);_0x7361bb['query']=_[_0xaf17('0x30')](_0x2fd085[_0xaf17('0x2f')]);_0x7361bb[_0xaf17('0x31')]=_[_0xaf17('0x32')](_0x7361bb['model'],_0x7361bb[_0xaf17('0x2f')]);_0x3d5114['attributes']=_[_0xaf17('0x32')](_0x7361bb[_0xaf17('0x33')],qs[_0xaf17('0x35')](_0x2fd085[_0xaf17('0x2f')][_0xaf17('0x35')]));_0x3d5114[_0xaf17('0x34')]=_0x3d5114[_0xaf17('0x34')][_0xaf17('0x36')]?_0x3d5114[_0xaf17('0x34')]:_0x7361bb[_0xaf17('0x33')];if(_0x2fd085[_0xaf17('0x2f')]['includeAll']){_0x3d5114[_0xaf17('0x48')]=[{'all':!![]}];}_0x3d5114=_['merge']({},_0x3d5114,_0x2fd085[_0xaf17('0x41')]);return db[_0xaf17('0x2b')][_0xaf17('0x49')](_0x3d5114)['then'](handleEntityNotFound(_0x2e64bf,null))[_0xaf17('0x24')](respondWithResult(_0x2e64bf,null))[_0xaf17('0x45')](handleError(_0x2e64bf,null));};exports[_0xaf17('0x4a')]=function(_0x3fd573,_0xa92de2){return db[_0xaf17('0x2b')]['create'](_0x3fd573[_0xaf17('0x4b')],{})['then'](respondWithResult(_0xa92de2,0xc9))[_0xaf17('0x45')](handleError(_0xa92de2,null));};exports['update']=function(_0x1a70b1,_0x4d91d5){if(_0x1a70b1['body']['id']){delete _0x1a70b1['body']['id'];}return db[_0xaf17('0x2b')][_0xaf17('0x49')]({'where':{'id':_0x1a70b1[_0xaf17('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d91d5,null))[_0xaf17('0x24')](saveUpdates(_0x1a70b1[_0xaf17('0x4b')],null))[_0xaf17('0x24')](respondWithResult(_0x4d91d5,null))['catch'](handleError(_0x4d91d5,null));};exports[_0xaf17('0x25')]=function(_0x323ade,_0x4058d4){return db[_0xaf17('0x2b')]['find']({'where':{'id':_0x323ade[_0xaf17('0x47')]['id']}})[_0xaf17('0x24')](handleEntityNotFound(_0x4058d4,null))[_0xaf17('0x24')](removeEntity(_0x4058d4,null))['catch'](handleError(_0x4058d4,null));};exports[_0xaf17('0x4c')]=function(_0x359b50,_0x553fb6){return db[_0xaf17('0x2b')][_0xaf17('0x4c')]()[_0xaf17('0x24')](respondWithResult(_0x553fb6,null))['catch'](handleError(_0x553fb6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e4ff19f..805e794 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 _0x217d=['path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','moment','bluebird','request-promise'];(function(_0x1c577d,_0x5d044d){var _0x517355=function(_0x3b0067){while(--_0x3b0067){_0x1c577d['push'](_0x1c577d['shift']());}};_0x517355(++_0x5d044d);}(_0x217d,0x1a0));var _0xd217=function(_0x47ae29,_0x415d0d){_0x47ae29=_0x47ae29-0x0;var _0xa2bc5b=_0x217d[_0x47ae29];return _0xa2bc5b;};'use strict';var _=require('lodash');var util=require(_0xd217('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd217('0x1'));var BPromise=require(_0xd217('0x2'));var rp=require(_0xd217('0x3'));var fs=require('fs');var path=require(_0xd217('0x4'));var rimraf=require(_0xd217('0x5'));var config=require('../../config/environment');var attributes=require(_0xd217('0x6'));module[_0xd217('0x7')]=function(_0x4c8915,_0x1b06a5){return _0x4c8915[_0xd217('0x8')](_0xd217('0x9'),attributes,{'tableName':_0xd217('0xa'),'paranoid':![],'indexes':[{'name':_0xd217('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x23ee=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','request-promise','./whatsappQueueReport.attributes'];(function(_0x1fa3bf,_0x438795){var _0x1e054=function(_0x19073b){while(--_0x19073b){_0x1fa3bf['push'](_0x1fa3bf['shift']());}};_0x1e054(++_0x438795);}(_0x23ee,0xf7));var _0xe23e=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x23ee[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xe23e('0x0'));var util=require('util');var logger=require(_0xe23e('0x1'))(_0xe23e('0x2'));var moment=require(_0xe23e('0x3'));var BPromise=require('bluebird');var rp=require(_0xe23e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe23e('0x5'));module[_0xe23e('0x6')]=function(_0x1077e3,_0x4377c8){return _0x1077e3[_0xe23e('0x7')](_0xe23e('0x8'),attributes,{'tableName':_0xe23e('0x9'),'paranoid':![],'indexes':[{'name':_0xe23e('0xa'),'fields':[_0xe23e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 21b4018..4fb2b0b 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 _0xef84=['rpc','../../config/environment','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x199f6c,_0x1718b4){var _0x238a76=function(_0x1aba1a){while(--_0x1aba1a){_0x199f6c['push'](_0x199f6c['shift']());}};_0x238a76(++_0x1718b4);}(_0xef84,0x1a5));var _0x4ef8=function(_0x1ed89f,_0x441842){_0x1ed89f=_0x1ed89f-0x0;var _0x551c3d=_0xef84[_0x1ed89f];return _0x551c3d;};'use strict';var _=require(_0x4ef8('0x0'));var util=require(_0x4ef8('0x1'));var moment=require(_0x4ef8('0x2'));var BPromise=require(_0x4ef8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ef8('0x4'));var db=require(_0x4ef8('0x5'))['db'];var utils=require(_0x4ef8('0x6'));var logger=require(_0x4ef8('0x7'))(_0x4ef8('0x8'));var config=require(_0x4ef8('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3d24,_0x200cc5,_0x2baec4){return new BPromise(function(_0x1065b0,_0xbe7704){return client[_0x4ef8('0xa')](_0x1b3d24,_0x2baec4)[_0x4ef8('0xb')](function(_0x3e1c59){logger[_0x4ef8('0xc')](_0x4ef8('0xd'),_0x200cc5,_0x4ef8('0xe'));logger[_0x4ef8('0xf')](_0x4ef8('0x10'),_0x200cc5,_0x4ef8('0xe'),JSON[_0x4ef8('0x11')](_0x3e1c59));if(_0x3e1c59[_0x4ef8('0x12')]){if(_0x3e1c59[_0x4ef8('0x12')]['code']===0x1f4){logger[_0x4ef8('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x200cc5,_0x3e1c59[_0x4ef8('0x12')][_0x4ef8('0x13')]);return _0xbe7704(_0x3e1c59[_0x4ef8('0x12')][_0x4ef8('0x13')]);}logger[_0x4ef8('0x12')](_0x4ef8('0xd'),_0x200cc5,_0x3e1c59[_0x4ef8('0x12')][_0x4ef8('0x13')]);return _0x1065b0(_0x3e1c59[_0x4ef8('0x12')][_0x4ef8('0x13')]);}else{logger[_0x4ef8('0xc')](_0x4ef8('0xd'),_0x200cc5,_0x4ef8('0xe'));_0x1065b0(_0x3e1c59[_0x4ef8('0x14')][_0x4ef8('0x13')]);}})[_0x4ef8('0x15')](function(_0x91019f){logger[_0x4ef8('0x12')](_0x4ef8('0xd'),_0x200cc5,_0x91019f);_0xbe7704(_0x91019f);});});}exports[_0x4ef8('0x16')]=function(_0xdd9f95){var _0x5ce3ec=this;return new Promise(function(_0xf5075c,_0x3ccab4){return db[_0x4ef8('0x17')][_0x4ef8('0x18')](_0xdd9f95['body'],{'raw':_0xdd9f95[_0x4ef8('0x19')]?_0xdd9f95['options'][_0x4ef8('0x1a')]===undefined?!![]:![]:!![]})[_0x4ef8('0xb')](function(_0x301a1c){logger[_0x4ef8('0xc')](_0x4ef8('0x16'),_0xdd9f95);logger['debug']('CreateWhatsappQueueReport',_0xdd9f95,JSON[_0x4ef8('0x11')](_0x301a1c));_0xf5075c(_0x301a1c);})[_0x4ef8('0x15')](function(_0x4d4485){logger[_0x4ef8('0x12')](_0x4ef8('0x16'),_0x4d4485['message'],_0xdd9f95);_0x3ccab4(_0x5ce3ec['error'](0x1f4,_0x4d4485[_0x4ef8('0x13')]));});});};exports[_0x4ef8('0x1b')]=function(_0x3d2aa3){var _0x1181bc=this;return new Promise(function(_0x392786,_0x593557){return db[_0x4ef8('0x17')][_0x4ef8('0x1c')](_0x3d2aa3[_0x4ef8('0x1d')],{'raw':_0x3d2aa3[_0x4ef8('0x19')]?_0x3d2aa3['options'][_0x4ef8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d2aa3[_0x4ef8('0x19')]?_0x3d2aa3['options'][_0x4ef8('0x1e')]||null:null,'attributes':_0x3d2aa3['options']?_0x3d2aa3[_0x4ef8('0x19')][_0x4ef8('0x1f')]||null:null,'limit':_0x3d2aa3[_0x4ef8('0x19')]?_0x3d2aa3[_0x4ef8('0x19')][_0x4ef8('0x20')]||null:null})[_0x4ef8('0xb')](function(_0x22a36d){logger[_0x4ef8('0xc')]('UpdateWhatsappQueueReport',_0x3d2aa3);logger[_0x4ef8('0xf')](_0x4ef8('0x1b'),_0x3d2aa3,JSON[_0x4ef8('0x11')](_0x22a36d));_0x392786(_0x22a36d);})[_0x4ef8('0x15')](function(_0x21124a){logger[_0x4ef8('0x12')](_0x4ef8('0x1b'),_0x21124a[_0x4ef8('0x13')],_0x3d2aa3);_0x593557(_0x1181bc[_0x4ef8('0x12')](0x1f4,_0x21124a[_0x4ef8('0x13')]));});});}; \ No newline at end of file +var _0x62bb=['request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0x62bb,0x1a3));var _0xb62b=function(_0x3fe846,_0x21b027){_0x3fe846=_0x3fe846-0x0;var _0x44b23b=_0x62bb[_0x3fe846];return _0x44b23b;};'use strict';var _=require('lodash');var util=require(_0xb62b('0x0'));var moment=require(_0xb62b('0x1'));var BPromise=require('bluebird');var rs=require(_0xb62b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb62b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb62b('0x4'))(_0xb62b('0x5'));var config=require(_0xb62b('0x6'));var jayson=require(_0xb62b('0x7'));var client=jayson[_0xb62b('0x8')][_0xb62b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a7027,_0xd00ea7,_0x1e3caa){return new BPromise(function(_0x56f9e7,_0xaf7f1a){return client[_0xb62b('0xa')](_0x3a7027,_0x1e3caa)[_0xb62b('0xb')](function(_0x4c20aa){logger[_0xb62b('0xc')](_0xb62b('0xd'),_0xd00ea7,_0xb62b('0xe'));logger[_0xb62b('0xf')](_0xb62b('0x10'),_0xd00ea7,_0xb62b('0xe'),JSON['stringify'](_0x4c20aa));if(_0x4c20aa[_0xb62b('0x11')]){if(_0x4c20aa['error']['code']===0x1f4){logger[_0xb62b('0x11')](_0xb62b('0xd'),_0xd00ea7,_0x4c20aa[_0xb62b('0x11')][_0xb62b('0x12')]);return _0xaf7f1a(_0x4c20aa[_0xb62b('0x11')][_0xb62b('0x12')]);}logger['error'](_0xb62b('0xd'),_0xd00ea7,_0x4c20aa[_0xb62b('0x11')][_0xb62b('0x12')]);return _0x56f9e7(_0x4c20aa[_0xb62b('0x11')][_0xb62b('0x12')]);}else{logger[_0xb62b('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd00ea7,'request\x20sent');_0x56f9e7(_0x4c20aa[_0xb62b('0x13')]['message']);}})[_0xb62b('0x14')](function(_0x21801b){logger[_0xb62b('0x11')](_0xb62b('0xd'),_0xd00ea7,_0x21801b);_0xaf7f1a(_0x21801b);});});}exports[_0xb62b('0x15')]=function(_0x5c71ce){var _0xc9f353=this;return new Promise(function(_0x1ce2b7,_0x5a8de2){return db['WhatsappQueueReport'][_0xb62b('0x16')](_0x5c71ce[_0xb62b('0x17')],{'raw':_0x5c71ce['options']?_0x5c71ce[_0xb62b('0x18')][_0xb62b('0x19')]===undefined?!![]:![]:!![]})[_0xb62b('0xb')](function(_0x40b0e4){logger['info']('CreateWhatsappQueueReport',_0x5c71ce);logger[_0xb62b('0xf')](_0xb62b('0x15'),_0x5c71ce,JSON[_0xb62b('0x1a')](_0x40b0e4));_0x1ce2b7(_0x40b0e4);})['catch'](function(_0x4656b7){logger[_0xb62b('0x11')](_0xb62b('0x15'),_0x4656b7[_0xb62b('0x12')],_0x5c71ce);_0x5a8de2(_0xc9f353['error'](0x1f4,_0x4656b7[_0xb62b('0x12')]));});});};exports[_0xb62b('0x1b')]=function(_0xa5caff){var _0x3d0180=this;return new Promise(function(_0x57230f,_0x4bd39c){return db[_0xb62b('0x1c')][_0xb62b('0x1d')](_0xa5caff[_0xb62b('0x17')],{'raw':_0xa5caff['options']?_0xa5caff[_0xb62b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa5caff['options']?_0xa5caff['options'][_0xb62b('0x1e')]||null:null,'attributes':_0xa5caff[_0xb62b('0x18')]?_0xa5caff[_0xb62b('0x18')][_0xb62b('0x1f')]||null:null,'limit':_0xa5caff['options']?_0xa5caff[_0xb62b('0x18')][_0xb62b('0x20')]||null:null})[_0xb62b('0xb')](function(_0x3ffa5e){logger[_0xb62b('0xc')]('UpdateWhatsappQueueReport',_0xa5caff);logger[_0xb62b('0xf')]('UpdateWhatsappQueueReport',_0xa5caff,JSON[_0xb62b('0x1a')](_0x3ffa5e));_0x57230f(_0x3ffa5e);})['catch'](function(_0xf91b51){logger['error'](_0xb62b('0x1b'),_0xf91b51[_0xb62b('0x12')],_0xa5caff);_0x4bd39c(_0x3d0180[_0xb62b('0x11')](0x1f4,_0xf91b51[_0xb62b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 891dbfd..1e95079 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 _0x76f4=['put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x76f4,0x1e0));var _0x476f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x76f4[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x476f('0x0'));var timeout=require(_0x476f('0x1'));var express=require(_0x476f('0x2'));var router=express[_0x476f('0x3')]();var auth=require(_0x476f('0x4'));var interaction=require(_0x476f('0x5'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0x476f('0x6')]('/',auth[_0x476f('0x7')](),controller[_0x476f('0x8')]);router[_0x476f('0x6')](_0x476f('0x9'),auth[_0x476f('0x7')](),controller[_0x476f('0xa')]);router[_0x476f('0x6')](_0x476f('0xb'),auth[_0x476f('0x7')](),controller[_0x476f('0xc')]);router[_0x476f('0xd')]('/',auth[_0x476f('0x7')](),controller['create']);router[_0x476f('0xe')](_0x476f('0xb'),auth[_0x476f('0x7')](),controller[_0x476f('0xf')]);router[_0x476f('0x10')](_0x476f('0xb'),auth['isAuthenticated'](),controller[_0x476f('0x11')]);module[_0x476f('0x12')]=router; \ No newline at end of file +var _0x65ac=['post','create','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show'];(function(_0x373f14,_0x24a4b0){var _0x1dc9d6=function(_0x321e6b){while(--_0x321e6b){_0x373f14['push'](_0x373f14['shift']());}};_0x1dc9d6(++_0x24a4b0);}(_0x65ac,0x1a3));var _0xc65a=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x65ac[_0x3826ad];return _0x17b900;};'use strict';var multer=require(_0xc65a('0x0'));var util=require(_0xc65a('0x1'));var path=require(_0xc65a('0x2'));var timeout=require(_0xc65a('0x3'));var express=require('express');var router=express[_0xc65a('0x4')]();var auth=require(_0xc65a('0x5'));var interaction=require(_0xc65a('0x6'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0xc65a('0x7')]('/',auth[_0xc65a('0x8')](),controller[_0xc65a('0x9')]);router['get'](_0xc65a('0xa'),auth['isAuthenticated'](),controller[_0xc65a('0xb')]);router[_0xc65a('0x7')]('/:id',auth[_0xc65a('0x8')](),controller[_0xc65a('0xc')]);router[_0xc65a('0xd')]('/',auth['isAuthenticated'](),controller[_0xc65a('0xe')]);router['put'](_0xc65a('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc65a('0xf'),auth[_0xc65a('0x8')](),controller[_0xc65a('0x10')]);module[_0xc65a('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 43c3a75..663b385 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x1c0b84,_0x4ad4f5){var _0x40c387=function(_0x14ad85){while(--_0x14ad85){_0x1c0b84['push'](_0x1c0b84['shift']());}};_0x40c387(++_0x4ad4f5);}(_0x2032,0xd9));var _0x2203=function(_0x37fefa,_0x375968){_0x37fefa=_0x37fefa-0x0;var _0x395359=_0x2032[_0x37fefa];return _0x395359;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x10f449,_0x444a8a){var _0xd82c73=function(_0x2d431b){while(--_0x2d431b){_0x10f449['push'](_0x10f449['shift']());}};_0xd82c73(++_0x444a8a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x21acfc,_0x3f3900){_0x21acfc=_0x21acfc-0x0;var _0x4d26bc=_0x5f2f[_0x21acfc];return _0x4d26bc;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8c477da..ff4cf5a 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 _0x99d7=['filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick'];(function(_0x192872,_0x3d0343){var _0x57e89b=function(_0x1ee717){while(--_0x1ee717){_0x192872['push'](_0x192872['shift']());}};_0x57e89b(++_0x3d0343);}(_0x99d7,0x1ea));var _0x799d=function(_0x259e4d,_0x58d647){_0x259e4d=_0x259e4d-0x0;var _0x81e4c3=_0x99d7[_0x259e4d];return _0x81e4c3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x799d('0x0'));var rimraf=require(_0x799d('0x1'));var zipdir=require(_0x799d('0x2'));var jsonpatch=require(_0x799d('0x3'));var rp=require(_0x799d('0x4'));var moment=require('moment');var BPromise=require(_0x799d('0x5'));var Mustache=require(_0x799d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x799d('0x7'));var csv=require('to-csv');var ejs=require(_0x799d('0x8'));var fs=require('fs');var _=require(_0x799d('0x9'));var squel=require(_0x799d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x799d('0xb'));var toCsv=require(_0x799d('0xc'));var querystring=require(_0x799d('0xd'));var Papa=require(_0x799d('0xe'));var Redis=require(_0x799d('0xf'));var authService=require(_0x799d('0x10'));var qs=require(_0x799d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x799d('0x12'))('api');var utils=require(_0x799d('0x13'));var config=require(_0x799d('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x585c42,_0x132cd7){_0x132cd7=_0x132cd7||0xcc;return function(_0x56ddee){if(_0x56ddee){return _0x585c42['sendStatus'](_0x132cd7);}return _0x585c42[_0x799d('0x15')](_0x132cd7)['end']();};}function respondWithResult(_0x173395,_0x41d202){_0x41d202=_0x41d202||0xc8;return function(_0x21e73f){if(_0x21e73f){return _0x173395['status'](_0x41d202)[_0x799d('0x16')](_0x21e73f);}};}function respondWithFilteredResult(_0x2a1fb6,_0x5eb28f){return function(_0x2f859c){if(_0x2f859c){var _0x3fb29e=_0x2f859c[_0x799d('0x17')],_0x30a8eb=_0x5eb28f[_0x799d('0x18')],_0x4280ba=_0x5eb28f['offset']+_0x5eb28f[_0x799d('0x19')],_0x27587c;if(_0x4280ba>=_0x3fb29e){_0x4280ba=_0x3fb29e;_0x27587c=0xc8;}else{_0x27587c=0xce;}_0x2a1fb6[_0x799d('0x15')](_0x27587c);return _0x2a1fb6[_0x799d('0x1a')](_0x799d('0x1b'),_0x30a8eb+'-'+_0x4280ba+'/'+_0x3fb29e)['json'](_0x2f859c);}return null;};}function patchUpdates(_0x338b2f){return function(_0x5e2749){try{jsonpatch['apply'](_0x5e2749,_0x338b2f,!![]);}catch(_0x50bd75){return BPromise[_0x799d('0x1c')](_0x50bd75);}return _0x5e2749['save']();};}function saveUpdates(_0x1ceab4,_0x402beb){return function(_0x4ab0cf){if(_0x4ab0cf){return _0x4ab0cf[_0x799d('0x1d')](_0x1ceab4)[_0x799d('0x1e')](function(_0x1733ff){return _0x1733ff;});}return null;};}function removeEntity(_0x5045bc,_0x138f6f){return function(_0x44113a){if(_0x44113a){return _0x44113a[_0x799d('0x1f')]()[_0x799d('0x1e')](function(){_0x5045bc[_0x799d('0x15')](0xcc)[_0x799d('0x20')]();});}};}function handleEntityNotFound(_0x730eff,_0x511f61){return function(_0x3497a1){if(!_0x3497a1){_0x730eff['sendStatus'](0x194);}return _0x3497a1;};}function handleError(_0x19b974,_0xe1e204){_0xe1e204=_0xe1e204||0x1f4;return function(_0x17f771){logger[_0x799d('0x21')](_0x17f771[_0x799d('0x22')]);if(_0x17f771[_0x799d('0x23')]){delete _0x17f771[_0x799d('0x23')];}_0x19b974[_0x799d('0x15')](_0xe1e204)['send'](_0x17f771);};}exports['index']=function(_0x453dd2,_0x4b9f5b){var _0x3a3409={},_0x1bf326={},_0x1aaec7={'count':0x0,'rows':[]};var _0x2f14ab=_['map'](db[_0x799d('0x24')][_0x799d('0x25')],function(_0x50744c){return{'name':_0x50744c[_0x799d('0x26')],'type':_0x50744c[_0x799d('0x27')][_0x799d('0x28')]};});_0x1bf326[_0x799d('0x29')]=_[_0x799d('0x2a')](_0x2f14ab,'name');_0x1bf326[_0x799d('0x2b')]=_[_0x799d('0x2c')](_0x453dd2[_0x799d('0x2b')]);_0x1bf326[_0x799d('0x2d')]=_[_0x799d('0x2e')](_0x1bf326[_0x799d('0x29')],_0x1bf326[_0x799d('0x2b')]);_0x3a3409[_0x799d('0x2f')]=_[_0x799d('0x2e')](_0x1bf326[_0x799d('0x29')],qs[_0x799d('0x30')](_0x453dd2[_0x799d('0x2b')][_0x799d('0x30')]));_0x3a3409[_0x799d('0x2f')]=_0x3a3409['attributes'][_0x799d('0x31')]?_0x3a3409[_0x799d('0x2f')]:_0x1bf326[_0x799d('0x29')];if(!_0x453dd2[_0x799d('0x2b')][_0x799d('0x32')]('nolimit')){_0x3a3409[_0x799d('0x19')]=qs['limit'](_0x453dd2['query'][_0x799d('0x19')]);_0x3a3409[_0x799d('0x18')]=qs[_0x799d('0x18')](_0x453dd2[_0x799d('0x2b')][_0x799d('0x18')]);}_0x3a3409[_0x799d('0x33')]=qs['sort'](_0x453dd2[_0x799d('0x2b')]['sort']);_0x3a3409[_0x799d('0x34')]=qs[_0x799d('0x2d')](_[_0x799d('0x35')](_0x453dd2[_0x799d('0x2b')],_0x1bf326['filters']),_0x2f14ab);if(_0x453dd2[_0x799d('0x2b')][_0x799d('0x36')]){_0x3a3409[_0x799d('0x34')]=_[_0x799d('0x37')](_0x3a3409['where'],{'$or':_['map'](_0x2f14ab,function(_0x554666){if(_0x554666[_0x799d('0x27')]!==_0x799d('0x38')){var _0x434704={};_0x434704[_0x554666[_0x799d('0x23')]]={'$like':'%'+_0x453dd2[_0x799d('0x2b')][_0x799d('0x36')]+'%'};return _0x434704;}})});}_0x3a3409=_[_0x799d('0x37')]({},_0x3a3409,_0x453dd2[_0x799d('0x39')]);var _0x3bd1d2={'where':_0x3a3409[_0x799d('0x34')]};return db[_0x799d('0x24')][_0x799d('0x17')](_0x3bd1d2)[_0x799d('0x1e')](function(_0x2e0711){_0x1aaec7[_0x799d('0x17')]=_0x2e0711;if(_0x453dd2[_0x799d('0x2b')][_0x799d('0x3a')]){_0x3a3409[_0x799d('0x3b')]=[{'all':!![]}];}return db[_0x799d('0x24')][_0x799d('0x3c')](_0x3a3409);})['then'](function(_0x4f7960){_0x1aaec7['rows']=_0x4f7960;return _0x1aaec7;})[_0x799d('0x1e')](respondWithFilteredResult(_0x4b9f5b,_0x3a3409))[_0x799d('0x3d')](handleError(_0x4b9f5b,null));};exports[_0x799d('0x3e')]=function(_0x51eb0f,_0x588cd3){var _0x36a0cd={'raw':!![],'where':{'id':_0x51eb0f[_0x799d('0x3f')]['id']}},_0x16bcc6={};_0x16bcc6['model']=_['keys'](db[_0x799d('0x24')]['rawAttributes']);_0x16bcc6[_0x799d('0x2b')]=_[_0x799d('0x2c')](_0x51eb0f['query']);_0x16bcc6[_0x799d('0x2d')]=_[_0x799d('0x2e')](_0x16bcc6['model'],_0x16bcc6['query']);_0x36a0cd[_0x799d('0x2f')]=_[_0x799d('0x2e')](_0x16bcc6[_0x799d('0x29')],qs[_0x799d('0x30')](_0x51eb0f[_0x799d('0x2b')]['fields']));_0x36a0cd['attributes']=_0x36a0cd['attributes']['length']?_0x36a0cd[_0x799d('0x2f')]:_0x16bcc6['model'];if(_0x51eb0f[_0x799d('0x2b')]['includeAll']){_0x36a0cd['include']=[{'all':!![]}];}_0x36a0cd=_[_0x799d('0x37')]({},_0x36a0cd,_0x51eb0f[_0x799d('0x39')]);return db['WhatsappTransferReport'][_0x799d('0x40')](_0x36a0cd)[_0x799d('0x1e')](handleEntityNotFound(_0x588cd3,null))['then'](respondWithResult(_0x588cd3,null))[_0x799d('0x3d')](handleError(_0x588cd3,null));};exports[_0x799d('0x41')]=function(_0x3a931f,_0x3e3233){return db[_0x799d('0x24')][_0x799d('0x41')](_0x3a931f[_0x799d('0x42')],{})[_0x799d('0x1e')](respondWithResult(_0x3e3233,0xc9))[_0x799d('0x3d')](handleError(_0x3e3233,null));};exports[_0x799d('0x1d')]=function(_0x5a2e53,_0x952b2d){if(_0x5a2e53['body']['id']){delete _0x5a2e53[_0x799d('0x42')]['id'];}return db[_0x799d('0x24')][_0x799d('0x40')]({'where':{'id':_0x5a2e53[_0x799d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x952b2d,null))[_0x799d('0x1e')](saveUpdates(_0x5a2e53[_0x799d('0x42')],null))['then'](respondWithResult(_0x952b2d,null))[_0x799d('0x3d')](handleError(_0x952b2d,null));};exports[_0x799d('0x1f')]=function(_0x5505d5,_0x53a6e8){return db[_0x799d('0x24')][_0x799d('0x40')]({'where':{'id':_0x5505d5[_0x799d('0x3f')]['id']}})[_0x799d('0x1e')](handleEntityNotFound(_0x53a6e8,null))[_0x799d('0x1e')](removeEntity(_0x53a6e8,null))[_0x799d('0x3d')](handleError(_0x53a6e8,null));};exports[_0x799d('0x43')]=function(_0x2c0cfd,_0x18e98d){return db['WhatsappTransferReport'][_0x799d('0x43')]()[_0x799d('0x1e')](respondWithResult(_0x18e98d,null))[_0x799d('0x3d')](handleError(_0x18e98d,null));}; \ No newline at end of file +var _0x69da=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge'];(function(_0xc40997,_0x39ae1){var _0x247c82=function(_0xd03dfc){while(--_0xd03dfc){_0xc40997['push'](_0xc40997['shift']());}};_0x247c82(++_0x39ae1);}(_0x69da,0xa7));var _0xa69d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x69da[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xa69d('0x0'));var emlformat=require(_0xa69d('0x1'));var rimraf=require(_0xa69d('0x2'));var zipdir=require(_0xa69d('0x3'));var jsonpatch=require(_0xa69d('0x4'));var rp=require(_0xa69d('0x5'));var moment=require('moment');var BPromise=require(_0xa69d('0x6'));var Mustache=require(_0xa69d('0x7'));var util=require('util');var path=require(_0xa69d('0x8'));var sox=require(_0xa69d('0x9'));var csv=require('to-csv');var ejs=require(_0xa69d('0xa'));var fs=require('fs');var _=require(_0xa69d('0xb'));var squel=require(_0xa69d('0xc'));var crypto=require('crypto');var jsforce=require(_0xa69d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa69d('0xe'));var querystring=require(_0xa69d('0xf'));var Papa=require(_0xa69d('0x10'));var Redis=require(_0xa69d('0x11'));var authService=require(_0xa69d('0x12'));var qs=require(_0xa69d('0x13'));var as=require(_0xa69d('0x14'));var hardwareService=require(_0xa69d('0x15'));var logger=require(_0xa69d('0x16'))(_0xa69d('0x17'));var utils=require(_0xa69d('0x18'));var config=require(_0xa69d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bdc54,_0x46cc07){_0x46cc07=_0x46cc07||0xcc;return function(_0x3cdbb7){if(_0x3cdbb7){return _0x5bdc54[_0xa69d('0x1a')](_0x46cc07);}return _0x5bdc54[_0xa69d('0x1b')](_0x46cc07)[_0xa69d('0x1c')]();};}function respondWithResult(_0x260c10,_0x5b6b79){_0x5b6b79=_0x5b6b79||0xc8;return function(_0x9e3835){if(_0x9e3835){return _0x260c10[_0xa69d('0x1b')](_0x5b6b79)[_0xa69d('0x1d')](_0x9e3835);}};}function respondWithFilteredResult(_0x484cad,_0x15d0c5){return function(_0x33a5ab){if(_0x33a5ab){var _0x1ea22e=_0x33a5ab[_0xa69d('0x1e')],_0x9a516e=_0x15d0c5[_0xa69d('0x1f')],_0x317670=_0x15d0c5[_0xa69d('0x1f')]+_0x15d0c5[_0xa69d('0x20')],_0x37dad0;if(_0x317670>=_0x1ea22e){_0x317670=_0x1ea22e;_0x37dad0=0xc8;}else{_0x37dad0=0xce;}_0x484cad['status'](_0x37dad0);return _0x484cad[_0xa69d('0x21')](_0xa69d('0x22'),_0x9a516e+'-'+_0x317670+'/'+_0x1ea22e)[_0xa69d('0x1d')](_0x33a5ab);}return null;};}function patchUpdates(_0x100d3a){return function(_0x1dae3c){try{jsonpatch['apply'](_0x1dae3c,_0x100d3a,!![]);}catch(_0x5a40d7){return BPromise['reject'](_0x5a40d7);}return _0x1dae3c[_0xa69d('0x23')]();};}function saveUpdates(_0x59b573,_0x5b467f){return function(_0xb0fdf9){if(_0xb0fdf9){return _0xb0fdf9['update'](_0x59b573)[_0xa69d('0x24')](function(_0x3e6772){return _0x3e6772;});}return null;};}function removeEntity(_0x451921,_0x4588b4){return function(_0x57cc2b){if(_0x57cc2b){return _0x57cc2b[_0xa69d('0x25')]()['then'](function(){_0x451921[_0xa69d('0x1b')](0xcc)[_0xa69d('0x1c')]();});}};}function handleEntityNotFound(_0x28bdff,_0x2dd9c3){return function(_0x289c65){if(!_0x289c65){_0x28bdff[_0xa69d('0x1a')](0x194);}return _0x289c65;};}function handleError(_0x115d0c,_0x422344){_0x422344=_0x422344||0x1f4;return function(_0x5d49f3){logger[_0xa69d('0x26')](_0x5d49f3[_0xa69d('0x27')]);if(_0x5d49f3[_0xa69d('0x28')]){delete _0x5d49f3['name'];}_0x115d0c[_0xa69d('0x1b')](_0x422344)[_0xa69d('0x29')](_0x5d49f3);};}exports['index']=function(_0x367f9c,_0x217597){var _0x126d6d={},_0x4b783b={},_0x24e693={'count':0x0,'rows':[]};var _0xe808c7=_[_0xa69d('0x2a')](db[_0xa69d('0x2b')][_0xa69d('0x2c')],function(_0x9369ab){return{'name':_0x9369ab[_0xa69d('0x2d')],'type':_0x9369ab[_0xa69d('0x2e')][_0xa69d('0x2f')]};});_0x4b783b[_0xa69d('0x30')]=_[_0xa69d('0x2a')](_0xe808c7,_0xa69d('0x28'));_0x4b783b[_0xa69d('0x31')]=_[_0xa69d('0x32')](_0x367f9c[_0xa69d('0x31')]);_0x4b783b[_0xa69d('0x33')]=_[_0xa69d('0x34')](_0x4b783b[_0xa69d('0x30')],_0x4b783b[_0xa69d('0x31')]);_0x126d6d['attributes']=_[_0xa69d('0x34')](_0x4b783b[_0xa69d('0x30')],qs[_0xa69d('0x35')](_0x367f9c[_0xa69d('0x31')][_0xa69d('0x35')]));_0x126d6d[_0xa69d('0x36')]=_0x126d6d['attributes'][_0xa69d('0x37')]?_0x126d6d[_0xa69d('0x36')]:_0x4b783b[_0xa69d('0x30')];if(!_0x367f9c[_0xa69d('0x31')]['hasOwnProperty'](_0xa69d('0x38'))){_0x126d6d['limit']=qs[_0xa69d('0x20')](_0x367f9c['query'][_0xa69d('0x20')]);_0x126d6d[_0xa69d('0x1f')]=qs['offset'](_0x367f9c[_0xa69d('0x31')]['offset']);}_0x126d6d[_0xa69d('0x39')]=qs[_0xa69d('0x3a')](_0x367f9c[_0xa69d('0x31')][_0xa69d('0x3a')]);_0x126d6d['where']=qs[_0xa69d('0x33')](_['pick'](_0x367f9c[_0xa69d('0x31')],_0x4b783b[_0xa69d('0x33')]),_0xe808c7);if(_0x367f9c[_0xa69d('0x31')]['filter']){_0x126d6d[_0xa69d('0x3b')]=_[_0xa69d('0x3c')](_0x126d6d[_0xa69d('0x3b')],{'$or':_[_0xa69d('0x2a')](_0xe808c7,function(_0x19f223){if(_0x19f223['type']!==_0xa69d('0x3d')){var _0x1bdd14={};_0x1bdd14[_0x19f223[_0xa69d('0x28')]]={'$like':'%'+_0x367f9c['query'][_0xa69d('0x3e')]+'%'};return _0x1bdd14;}})});}_0x126d6d=_[_0xa69d('0x3c')]({},_0x126d6d,_0x367f9c[_0xa69d('0x3f')]);var _0x1110f9={'where':_0x126d6d[_0xa69d('0x3b')]};return db[_0xa69d('0x2b')][_0xa69d('0x1e')](_0x1110f9)[_0xa69d('0x24')](function(_0x1811a1){_0x24e693[_0xa69d('0x1e')]=_0x1811a1;if(_0x367f9c[_0xa69d('0x31')][_0xa69d('0x40')]){_0x126d6d[_0xa69d('0x41')]=[{'all':!![]}];}return db[_0xa69d('0x2b')][_0xa69d('0x42')](_0x126d6d);})[_0xa69d('0x24')](function(_0x1d421d){_0x24e693[_0xa69d('0x43')]=_0x1d421d;return _0x24e693;})[_0xa69d('0x24')](respondWithFilteredResult(_0x217597,_0x126d6d))[_0xa69d('0x44')](handleError(_0x217597,null));};exports[_0xa69d('0x45')]=function(_0x3e8414,_0x2afe65){var _0x5020a2={'raw':!![],'where':{'id':_0x3e8414[_0xa69d('0x46')]['id']}},_0x25c4c8={};_0x25c4c8[_0xa69d('0x30')]=_[_0xa69d('0x32')](db[_0xa69d('0x2b')][_0xa69d('0x2c')]);_0x25c4c8['query']=_['keys'](_0x3e8414[_0xa69d('0x31')]);_0x25c4c8[_0xa69d('0x33')]=_[_0xa69d('0x34')](_0x25c4c8['model'],_0x25c4c8[_0xa69d('0x31')]);_0x5020a2[_0xa69d('0x36')]=_[_0xa69d('0x34')](_0x25c4c8[_0xa69d('0x30')],qs[_0xa69d('0x35')](_0x3e8414[_0xa69d('0x31')][_0xa69d('0x35')]));_0x5020a2[_0xa69d('0x36')]=_0x5020a2['attributes']['length']?_0x5020a2[_0xa69d('0x36')]:_0x25c4c8['model'];if(_0x3e8414[_0xa69d('0x31')][_0xa69d('0x40')]){_0x5020a2['include']=[{'all':!![]}];}_0x5020a2=_[_0xa69d('0x3c')]({},_0x5020a2,_0x3e8414[_0xa69d('0x3f')]);return db['WhatsappTransferReport'][_0xa69d('0x47')](_0x5020a2)[_0xa69d('0x24')](handleEntityNotFound(_0x2afe65,null))['then'](respondWithResult(_0x2afe65,null))[_0xa69d('0x44')](handleError(_0x2afe65,null));};exports['create']=function(_0x17bffc,_0x45b618){return db[_0xa69d('0x2b')][_0xa69d('0x48')](_0x17bffc[_0xa69d('0x49')],{})[_0xa69d('0x24')](respondWithResult(_0x45b618,0xc9))[_0xa69d('0x44')](handleError(_0x45b618,null));};exports[_0xa69d('0x4a')]=function(_0x30041b,_0x2b3a44){if(_0x30041b[_0xa69d('0x49')]['id']){delete _0x30041b[_0xa69d('0x49')]['id'];}return db[_0xa69d('0x2b')][_0xa69d('0x47')]({'where':{'id':_0x30041b[_0xa69d('0x46')]['id']}})[_0xa69d('0x24')](handleEntityNotFound(_0x2b3a44,null))[_0xa69d('0x24')](saveUpdates(_0x30041b[_0xa69d('0x49')],null))[_0xa69d('0x24')](respondWithResult(_0x2b3a44,null))[_0xa69d('0x44')](handleError(_0x2b3a44,null));};exports['destroy']=function(_0x1bd60c,_0x413b48){return db['WhatsappTransferReport'][_0xa69d('0x47')]({'where':{'id':_0x1bd60c[_0xa69d('0x46')]['id']}})['then'](handleEntityNotFound(_0x413b48,null))[_0xa69d('0x24')](removeEntity(_0x413b48,null))[_0xa69d('0x44')](handleError(_0x413b48,null));};exports[_0xa69d('0x4b')]=function(_0x143dae,_0x40e5a4){return db[_0xa69d('0x2b')]['describe']()[_0xa69d('0x24')](respondWithResult(_0x40e5a4,null))[_0xa69d('0x44')](handleError(_0x40e5a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 53ed786..26acbbd 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 _0x80ce=['bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x46b514,_0x1a4aa4){var _0x2bd2dd=function(_0x10ae74){while(--_0x10ae74){_0x46b514['push'](_0x46b514['shift']());}};_0x2bd2dd(++_0x1a4aa4);}(_0x80ce,0x118));var _0xe80c=function(_0x3e7b17,_0x542807){_0x3e7b17=_0x3e7b17-0x0;var _0x33331c=_0x80ce[_0x3e7b17];return _0x33331c;};'use strict';var _=require(_0xe80c('0x0'));var util=require(_0xe80c('0x1'));var logger=require(_0xe80c('0x2'))(_0xe80c('0x3'));var moment=require(_0xe80c('0x4'));var BPromise=require(_0xe80c('0x5'));var rp=require(_0xe80c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe80c('0x7'));var config=require(_0xe80c('0x8'));var attributes=require(_0xe80c('0x9'));module[_0xe80c('0xa')]=function(_0xdc7fc,_0x1ab913){return _0xdc7fc[_0xe80c('0xb')](_0xe80c('0xc'),attributes,{'tableName':_0xe80c('0xd'),'paranoid':![],'indexes':[{'name':_0xe80c('0xe'),'fields':[_0xe80c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4552=['path','rimraf','../../config/environment','exports','WhatsappTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59ff25,_0x5e7ebf){var _0x43861b=function(_0x4f6445){while(--_0x4f6445){_0x59ff25['push'](_0x59ff25['shift']());}};_0x43861b(++_0x5e7ebf);}(_0x4552,0x132));var _0x2455=function(_0x3365da,_0x56d938){_0x3365da=_0x3365da-0x0;var _0x26b923=_0x4552[_0x3365da];return _0x26b923;};'use strict';var _=require('lodash');var util=require(_0x2455('0x0'));var logger=require(_0x2455('0x1'))(_0x2455('0x2'));var moment=require(_0x2455('0x3'));var BPromise=require(_0x2455('0x4'));var rp=require(_0x2455('0x5'));var fs=require('fs');var path=require(_0x2455('0x6'));var rimraf=require(_0x2455('0x7'));var config=require(_0x2455('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0x2455('0x9')]=function(_0x190340,_0x4fc510){return _0x190340['define'](_0x2455('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x2455('0xb'),'fields':[_0x2455('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index eb9a1fe..3cd2544 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(_0x5592e6,_0xeb3db5){var _0x417717=function(_0x4e1d59){while(--_0x4e1d59){_0x5592e6['push'](_0x5592e6['shift']());}};_0x417717(++_0xeb3db5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x7f25c8,_0xecbb41){var _0x2fdd20=function(_0x5be523){while(--_0x5be523){_0x7f25c8['push'](_0x7f25c8['shift']());}};_0x2fdd20(++_0xecbb41);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 cfee8db..5a03585 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e24=['online','join','None','seedDB','./config/seedDB','./config/license','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','info','start','Online\x20apps:','filter','name','Offline\x20apps:','map','status'];(function(_0x41f3c8,_0x5976b4){var _0x58d4f7=function(_0x325cc8){while(--_0x325cc8){_0x41f3c8['push'](_0x41f3c8['shift']());}};_0x58d4f7(++_0x5976b4);}(_0x5e24,0xb7));var _0x45e2=function(_0x55ff2b,_0x17d9d1){_0x55ff2b=_0x55ff2b-0x0;var _0x57ea79=_0x5e24[_0x55ff2b];return _0x57ea79;};'use strict';var _=require('lodash');var mysqldb=require(_0x45e2('0x0'));var rpc=require(_0x45e2('0x1'));var config=require('./config/environment');var logger=require(_0x45e2('0x2'))(_0x45e2('0x3'));var pm2=require(_0x45e2('0x4'));var pm2Config=require(_0x45e2('0x5'));var schedule=require(_0x45e2('0x6'));var chat=require(_0x45e2('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x45e2('0x8')][_0x45e2('0x9')]()[_0x45e2('0xa')](function(){return rpc[_0x45e2('0xb')]();})[_0x45e2('0xa')](function(_0x16b5be){logger[_0x45e2('0xc')](_0x16b5be);return chat[_0x45e2('0xd')]();})[_0x45e2('0xa')](function(){return schedule[_0x45e2('0xd')]();})[_0x45e2('0xa')](function(){return transcribe[_0x45e2('0xd')]();})[_0x45e2('0xa')](function(_0x3362e1){logger['info'](_0x3362e1);return pm2[_0x45e2('0xd')](pm2Config);})['then'](function(_0x448278){logger[_0x45e2('0xc')](_0x45e2('0xe'),_['map'](_[_0x45e2('0xf')](_0x448278,{'status':'online'}),_0x45e2('0x10'))['join']());logger[_0x45e2('0xc')](_0x45e2('0x11'),_[_0x45e2('0x12')](_[_0x45e2('0xf')](_0x448278,function(_0x33cc66){return _0x33cc66[_0x45e2('0x13')]!==_0x45e2('0x14');}),'name')[_0x45e2('0x15')]()||_0x45e2('0x16'));config[_0x45e2('0x17')]&&require(_0x45e2('0x18'))['default']();require(_0x45e2('0x19'))[_0x45e2('0x1a')]();})[_0x45e2('0x1b')](function(_0x55958e){logger['error'](_0x45e2('0x1c'),_0x55958e);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x261a=['exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','map','online','name','join','filter','status','None','seedDB','default','error'];(function(_0x4705da,_0x289095){var _0x4d891f=function(_0xaad32c){while(--_0xaad32c){_0x4705da['push'](_0x4705da['shift']());}};_0x4d891f(++_0x289095);}(_0x261a,0xf4));var _0xa261=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x261a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa261('0x0'));var mysqldb=require(_0xa261('0x1'));var rpc=require(_0xa261('0x2'));var config=require(_0xa261('0x3'));var logger=require(_0xa261('0x4'))(_0xa261('0x5'));var pm2=require(_0xa261('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xa261('0x7'));var chat=require(_0xa261('0x8'));var transcribe=require(_0xa261('0x9'));function main(){return mysqldb['db'][_0xa261('0xa')][_0xa261('0xb')]()[_0xa261('0xc')](function(){return rpc[_0xa261('0xd')]();})[_0xa261('0xc')](function(_0x40a27c){logger[_0xa261('0xe')](_0x40a27c);return chat[_0xa261('0xf')]();})[_0xa261('0xc')](function(){return schedule['start']();})[_0xa261('0xc')](function(){return transcribe[_0xa261('0xf')]();})['then'](function(_0x216b5c){logger['info'](_0x216b5c);return pm2['start'](pm2Config);})['then'](function(_0x5619cf){logger['info']('Online\x20apps:',_[_0xa261('0x10')](_['filter'](_0x5619cf,{'status':_0xa261('0x11')}),_0xa261('0x12'))[_0xa261('0x13')]());logger['info']('Offline\x20apps:',_[_0xa261('0x10')](_[_0xa261('0x14')](_0x5619cf,function(_0x15f86d){return _0x15f86d[_0xa261('0x15')]!==_0xa261('0x11');}),_0xa261('0x12'))[_0xa261('0x13')]()||_0xa261('0x16'));config[_0xa261('0x17')]&&require('./config/seedDB')[_0xa261('0x18')]();require('./config/license')[_0xa261('0x18')]();})['catch'](function(_0x5f44e0){logger[_0xa261('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x5f44e0);process[_0xa261('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index f2481b9..af71e55 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 _0xc876=['signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','options','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','bluebird','secrets','session','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','then','status','disposition','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','sub','isEqual','apiKeyNonce','Invalid\x20API\x20access\x20key','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','isMiddleware'];(function(_0x146e50,_0x581a4b){var _0x1abf9a=function(_0x5ed793){while(--_0x5ed793){_0x146e50['push'](_0x146e50['shift']());}};_0x1abf9a(++_0x581a4b);}(_0xc876,0x1a4));var _0x6c87=function(_0x1cb8d1,_0x1be018){_0x1cb8d1=_0x1cb8d1-0x0;var _0x498473=_0xc876[_0x1cb8d1];return _0x498473;};'use strict';var db=require(_0x6c87('0x0'))['db'];var config=require(_0x6c87('0x1'));var hardwareConf=require(_0x6c87('0x2'));var _=require(_0x6c87('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x6c87('0x4'));var compose=require(_0x6c87('0x5'));var basicAuth=require(_0x6c87('0x6'));var crypto=require('crypto');var BPromise=require(_0x6c87('0x7'));var validateJwt=expressJwt({'secret':config[_0x6c87('0x8')][_0x6c87('0x9')]});var userAttributes=['id','role',_0x6c87('0xa'),_0x6c87('0xb'),_0x6c87('0xc'),_0x6c87('0xd'),_0x6c87('0xe'),_0x6c87('0xf'),'md5secret','voicePause',_0x6c87('0x10'),_0x6c87('0x11'),_0x6c87('0x12'),'smsPause',_0x6c87('0x13'),'pauseType',_0x6c87('0x14'),_0x6c87('0x15'),'lastPauseAt',_0x6c87('0x16'),_0x6c87('0x17'),_0x6c87('0x18'),_0x6c87('0x19'),_0x6c87('0x1a'),_0x6c87('0x1b'),_0x6c87('0x1c'),_0x6c87('0x1d'),'phoneBarEnableDtmfTone',_0x6c87('0x1e'),_0x6c87('0x1f'),_0x6c87('0x20'),_0x6c87('0x21'),_0x6c87('0x22'),_0x6c87('0x23'),_0x6c87('0x24'),_0x6c87('0x25')];exports[_0x6c87('0x26')]=function(){return this[_0x6c87('0x27')](!![])[_0x6c87('0x28')](function(_0x710816,_0x27c33d,_0x582db5){if(_0x710816[_0x6c87('0x29')]){_0x582db5();}else{return db[_0x6c87('0x2a')][_0x6c87('0x2b')]({'where':{'id':_0x710816[_0x6c87('0x2c')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x6c87('0x2d')](function(_0x30f416){if(_0x30f416&&_0x30f416['closed']){return _0x27c33d[_0x6c87('0x2e')](_0x30f416[_0x6c87('0x2f')]===_0x6c87('0x30')?0x195:0x193)[_0x6c87('0x31')]({'message':_0x30f416[_0x6c87('0x2f')]===_0x6c87('0x30')?'Unmanaged.':_0x6c87('0x32')});}else{_0x582db5();}})[_0x6c87('0x33')](function(_0x178127){_0x582db5(_0x178127);});}});};exports[_0x6c87('0x27')]=function isAuthenticated(_0x13e9d1){return compose()[_0x6c87('0x28')](function(_0x131350,_0x4055a0,_0x5949e3){if(_0x131350[_0x6c87('0x34')][_0x6c87('0x35')]){if(_[_0x6c87('0x36')](_0x131350['headers']['authorization'],_0x6c87('0x37'))){var _0x53a7b=basicAuth(_0x131350);db['User'][_0x6c87('0x38')]({'where':{'name':_0x53a7b['name']}})['then'](function(_0x47f6d2){if(!_0x47f6d2||!_0x47f6d2[_0x6c87('0x39')](_0x53a7b[_0x6c87('0x3a')])){return _0x4055a0[_0x6c87('0x2e')](0x191)[_0x6c87('0x31')]({'message':_0x6c87('0x3b')});}_0x131350['user']={'id':_0x47f6d2['id']};_0x5949e3();})[_0x6c87('0x33')](function(_0xcb3849){_0x5949e3(_0xcb3849);});}else if(_[_0x6c87('0x36')](_0x131350[_0x6c87('0x34')][_0x6c87('0x35')],_0x6c87('0x3c'))){validateJwt(_0x131350,_0x4055a0,_0x5949e3);}else{if(_0x13e9d1){_0x5949e3();}else{return _0x4055a0[_0x6c87('0x2e')](0x193)['json']({'message':_0x6c87('0x3d')});}}}else if(_0x131350[_0x6c87('0x3e')][_0x6c87('0x3f')]){try{var _0x591e41={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x131350[_0x6c87('0x3e')][_0x6c87('0x3f')],_0x591e41)[_0x6c87('0x2d')](function(_0x409a24){return db['User'][_0x6c87('0x38')]({'where':{'id':_0x409a24[_0x6c87('0x40')]}})[_0x6c87('0x2d')](function(_0x26598d){if(!_0x26598d||!_[_0x6c87('0x41')](_0x26598d[_0x6c87('0x42')],_0x409a24['nonce'])){return _0x4055a0['status'](0x191)[_0x6c87('0x31')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x131350[_0x6c87('0x29')]={'id':_0x26598d['id']};_0x5949e3();});})[_0x6c87('0x33')](function(){return _0x4055a0[_0x6c87('0x2e')](0x191)[_0x6c87('0x31')]({'message':_0x6c87('0x43')});});}catch(_0x5094b0){_0x5949e3(_0x5094b0);}}else if(_0x13e9d1){_0x5949e3();}else{return _0x4055a0[_0x6c87('0x2e')](0x193)[_0x6c87('0x31')]({'message':_0x6c87('0x3d')});}})[_0x6c87('0x28')](function(_0x1deb00,_0x2eda8f,_0x2942f8){if(_0x1deb00[_0x6c87('0x29')]){db[_0x6c87('0x44')][_0x6c87('0x38')]({'where':{'id':_0x1deb00['user']['id']},'attributes':userAttributes})[_0x6c87('0x2d')](function(_0x4075d9){if(!_0x4075d9){return _0x2eda8f[_0x6c87('0x2e')](0x194)['json']({'message':_0x6c87('0x45')});}_0x1deb00[_0x6c87('0x29')]=_0x4075d9;_0x2942f8();})['catch'](function(_0x3192fa){_0x2942f8(_0x3192fa);});}else if(_0x13e9d1){_0x2942f8();}else{return _0x2eda8f['status'](0x194)['json']({'message':_0x6c87('0x46')});}});};exports[_0x6c87('0x47')]=function canUpdate(){return compose()['use'](function(_0x1161a8,_0x1fb0a0,_0x407d6a){return require(_0x6c87('0x48'))[_0x6c87('0x49')]()[_0x6c87('0x2d')](function(_0x7d6dfc){if(_0x7d6dfc['update']){_0x407d6a();}else{return _0x1fb0a0['status'](0x193)[_0x6c87('0x31')]({'message':'Forbidden'});}})['catch'](function(_0x1690fe){_0x407d6a(_0x1690fe);});});};exports[_0x6c87('0x4a')]=function(_0x46e1f1,_0x837930,_0x4fb0f1){_0x46e1f1[_0x6c87('0x4a')]=!![];return _0x4fb0f1();};exports[_0x6c87('0x4b')]=function signToken(_0x1b405d){return signJwt(_0x1b405d);};exports[_0x6c87('0x4c')]=function(_0x4d9d28,_0x91593a){if(!_0x4d9d28[_0x6c87('0x29')]){return _0x91593a[_0x6c87('0x2e')](0x194)[_0x6c87('0x31')]({'message':_0x6c87('0x4d')});}var _0x23ef06={'payload':{'id':_0x4d9d28[_0x6c87('0x29')]['id'],'role':_0x4d9d28['user'][_0x6c87('0x4e')]},'options':{'expiresIn':0x15180}};return signJwt(_0x23ef06)['then'](function(_0x1ce991){_0x91593a[_0x6c87('0x4f')](_0x6c87('0x50'),_0x1ce991);_0x91593a['redirect'](_0x6c87('0x51'));})[_0x6c87('0x33')](function(_0x4a18f3){return _0x91593a[_0x6c87('0x2e')](0x1f4)['send'](_0x4a18f3);});};exports[_0x6c87('0x52')]=function(_0x206b67){if(_[_0x6c87('0x53')](_0x206b67[_0x6c87('0x42')])||_[_0x6c87('0x53')](_0x206b67[_0x6c87('0x54')])){return null;}else{return createJwt(_0x206b67);}};exports[_0x6c87('0x55')]=function(_0xfdf852){_0xfdf852[_0x6c87('0x42')]=generateNonce();_0xfdf852[_0x6c87('0x54')]=generateIssuedAt();return createJwt(_0xfdf852);};exports[_0x6c87('0x56')]=function(_0x434e48,_0x156cd5){var _0x35ae41=_0x434e48[_0x6c87('0x3e')][_0x6c87('0x3f')];if(_0x35ae41){var _0x552db4={'nonce':_0x156cd5['apiKeyNonce'],'iat':_0x156cd5[_0x6c87('0x54')],'audience':hardwareConf[_0x6c87('0x57')](),'issuer':hardwareConf[_0x6c87('0x57')]()};return verifyJwt(_0x35ae41,_0x552db4)[_0x6c87('0x2d')](function(){return generateApiKey(_0x156cd5);});}else{throw{'message':_0x6c87('0x58')};}};function signJwt(_0x2b8dc4){var _0x15f814=BPromise[_0x6c87('0x59')](jwt[_0x6c87('0x5a')],{'context':jwt});var _0x4c88e3=_0x2b8dc4[_0x6c87('0x5b')]||config[_0x6c87('0x8')][_0x6c87('0x9')];return new BPromise(function(_0x4441b9,_0x2aeded){_0x15f814(_0x2b8dc4['payload'],_0x4c88e3,_0x2b8dc4[_0x6c87('0x5c')])[_0x6c87('0x2d')](function(_0x465cba){_0x4441b9(_0x465cba);})[_0x6c87('0x33')](function(_0xaf534a){_0x2aeded(_0xaf534a);});});}function verifyJwt(_0x335645,_0x532ff0,_0x867891){var _0x15fde9=BPromise[_0x6c87('0x59')](jwt[_0x6c87('0x5d')],{'context':jwt});var _0x23f8a2=_0x867891||config['secrets'][_0x6c87('0x9')];return new BPromise(function(_0x40566b,_0x1fbc65){_0x15fde9(_0x335645,_0x23f8a2,_0x532ff0)[_0x6c87('0x2d')](function(_0x2a0234){_0x40566b(_0x2a0234);})[_0x6c87('0x33')](function(_0x4dfbd5){_0x1fbc65(_0x4dfbd5);});});}function generateNonce(){return crypto[_0x6c87('0x5e')](0x10)[_0x6c87('0x5f')]('hex');}function generateIssuedAt(){return Math[_0x6c87('0x60')](Date[_0x6c87('0x61')]()/0x3e8)['toString']();}function createJwt(_0x2dbbf0){var _0x6adc81={'payload':{'iat':_0x2dbbf0[_0x6c87('0x54')],'nonce':_0x2dbbf0[_0x6c87('0x42')]},'options':{'algorithm':_0x6c87('0x62'),'subject':_0x2dbbf0['id'][_0x6c87('0x5f')](),'issuer':hardwareConf[_0x6c87('0x57')](),'audience':hardwareConf[_0x6c87('0x57')]()}};return signJwt(_0x6adc81)[_0x6c87('0x2d')](function(_0x539bf8){return{'iat':_0x2dbbf0[_0x6c87('0x54')],'nonce':_0x2dbbf0[_0x6c87('0x42')],'token':_0x539bf8};});} \ No newline at end of file +var _0x0446=['redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','secret','payload','options','verify','randomBytes','hex','floor','toString','HS512','../../mysqldb','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isAuthenticated','use','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','Basic','User','authenticate','user','catch','Bearer','apikey','getUuid','query','find','sub','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x0446,0x75));var _0x6044=function(_0x4b15b9,_0x60340b){_0x4b15b9=_0x4b15b9-0x0;var _0x3a81ee=_0x0446[_0x4b15b9];return _0x3a81ee;};'use strict';var db=require(_0x6044('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x6044('0x1'));var _=require(_0x6044('0x2'));var jwt=require(_0x6044('0x3'));var expressJwt=require(_0x6044('0x4'));var compose=require(_0x6044('0x5'));var basicAuth=require(_0x6044('0x6'));var crypto=require(_0x6044('0x7'));var BPromise=require(_0x6044('0x8'));var validateJwt=expressJwt({'secret':config[_0x6044('0x9')][_0x6044('0xa')]});var userAttributes=['id',_0x6044('0xb'),_0x6044('0xc'),_0x6044('0xd'),_0x6044('0xe'),'email',_0x6044('0xf'),_0x6044('0x10'),'md5secret',_0x6044('0x11'),_0x6044('0x12'),_0x6044('0x13'),_0x6044('0x14'),_0x6044('0x15'),_0x6044('0x16'),'pauseType',_0x6044('0x17'),'lastLoginAt',_0x6044('0x18'),_0x6044('0x19'),'allowmessenger','passwordResetAt',_0x6044('0x1a'),_0x6044('0x1b'),_0x6044('0x1c'),'phoneBarDnd',_0x6044('0x1d'),'phoneBarEnableDtmfTone',_0x6044('0x1e'),_0x6044('0x1f'),_0x6044('0x20'),_0x6044('0x21'),_0x6044('0x22'),_0x6044('0x23'),_0x6044('0x24'),_0x6044('0x25')];exports['isChatInteractionAuthorized']=function(){return this[_0x6044('0x26')](!![])[_0x6044('0x27')](function(_0x36d968,_0x42cda9,_0x25882f){if(_0x36d968['user']){_0x25882f();}else{return db['ChatInteraction'][_0x6044('0x28')]({'where':{'id':_0x36d968[_0x6044('0x29')]['id']},'attributes':['id',_0x6044('0x2a'),_0x6044('0x2b')],'raw':!![]})[_0x6044('0x2c')](function(_0x51466f){if(_0x51466f&&_0x51466f[_0x6044('0x2a')]){return _0x42cda9[_0x6044('0x2d')](_0x51466f['disposition']===_0x6044('0x2e')?0x195:0x193)[_0x6044('0x2f')]({'message':_0x51466f[_0x6044('0x2b')]==='unmanaged'?_0x6044('0x30'):_0x6044('0x31')});}else{_0x25882f();}})['catch'](function(_0x461c4e){_0x25882f(_0x461c4e);});}});};exports[_0x6044('0x26')]=function isAuthenticated(_0x257ab7){return compose()[_0x6044('0x27')](function(_0x6df555,_0x4cd96e,_0x3510b1){if(_0x6df555[_0x6044('0x32')][_0x6044('0x33')]){if(_['startsWith'](_0x6df555[_0x6044('0x32')][_0x6044('0x33')],_0x6044('0x34'))){var _0x22d103=basicAuth(_0x6df555);db[_0x6044('0x35')]['find']({'where':{'name':_0x22d103[_0x6044('0xd')]}})['then'](function(_0x52e5e6){if(!_0x52e5e6||!_0x52e5e6[_0x6044('0x36')](_0x22d103['pass'])){return _0x4cd96e[_0x6044('0x2d')](0x191)[_0x6044('0x2f')]({'message':'Wrong\x20credentials.'});}_0x6df555[_0x6044('0x37')]={'id':_0x52e5e6['id']};_0x3510b1();})[_0x6044('0x38')](function(_0x421d8f){_0x3510b1(_0x421d8f);});}else if(_['startsWith'](_0x6df555[_0x6044('0x32')][_0x6044('0x33')],_0x6044('0x39'))){validateJwt(_0x6df555,_0x4cd96e,_0x3510b1);}else{if(_0x257ab7){_0x3510b1();}else{return _0x4cd96e[_0x6044('0x2d')](0x193)[_0x6044('0x2f')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x6df555['query'][_0x6044('0x3a')]){try{var _0x1e2f8a={'audience':hardwareConf[_0x6044('0x3b')](),'issuer':hardwareConf[_0x6044('0x3b')]()};verifyJwt(_0x6df555[_0x6044('0x3c')][_0x6044('0x3a')],_0x1e2f8a)[_0x6044('0x2c')](function(_0x1b3a9a){return db[_0x6044('0x35')][_0x6044('0x3d')]({'where':{'id':_0x1b3a9a[_0x6044('0x3e')]}})[_0x6044('0x2c')](function(_0x3eaf55){if(!_0x3eaf55||!_[_0x6044('0x3f')](_0x3eaf55[_0x6044('0x40')],_0x1b3a9a[_0x6044('0x41')])){return _0x4cd96e[_0x6044('0x2d')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x6df555[_0x6044('0x37')]={'id':_0x3eaf55['id']};_0x3510b1();});})[_0x6044('0x38')](function(){return _0x4cd96e[_0x6044('0x2d')](0x191)[_0x6044('0x2f')]({'message':_0x6044('0x42')});});}catch(_0x3ba856){_0x3510b1(_0x3ba856);}}else if(_0x257ab7){_0x3510b1();}else{return _0x4cd96e[_0x6044('0x2d')](0x193)[_0x6044('0x2f')]({'message':_0x6044('0x43')});}})[_0x6044('0x27')](function(_0x39f848,_0x1711b8,_0x2cfd88){if(_0x39f848[_0x6044('0x37')]){db[_0x6044('0x35')][_0x6044('0x3d')]({'where':{'id':_0x39f848['user']['id']},'attributes':userAttributes})['then'](function(_0x5af323){if(!_0x5af323){return _0x1711b8[_0x6044('0x2d')](0x194)['json']({'message':_0x6044('0x44')});}_0x39f848[_0x6044('0x37')]=_0x5af323;_0x2cfd88();})[_0x6044('0x38')](function(_0x46a21c){_0x2cfd88(_0x46a21c);});}else if(_0x257ab7){_0x2cfd88();}else{return _0x1711b8['status'](0x194)[_0x6044('0x2f')]({'message':_0x6044('0x45')});}});};exports[_0x6044('0x46')]=function canUpdate(){return compose()['use'](function(_0x25e2c6,_0x408827,_0x214ee7){return require(_0x6044('0x47'))['getLicense']()['then'](function(_0x1685ca){if(_0x1685ca[_0x6044('0x48')]){_0x214ee7();}else{return _0x408827[_0x6044('0x2d')](0x193)[_0x6044('0x2f')]({'message':_0x6044('0x49')});}})[_0x6044('0x38')](function(_0x2463c9){_0x214ee7(_0x2463c9);});});};exports[_0x6044('0x4a')]=function(_0x32975b,_0x79d37d,_0x4c47eb){_0x32975b[_0x6044('0x4a')]=!![];return _0x4c47eb();};exports['signToken']=function signToken(_0x28ce73){return signJwt(_0x28ce73);};exports[_0x6044('0x4b')]=function(_0x674f1b,_0x5e5ae0){if(!_0x674f1b[_0x6044('0x37')]){return _0x5e5ae0['status'](0x194)['json']({'message':_0x6044('0x4c')});}var _0x50d9a6={'payload':{'id':_0x674f1b['user']['id'],'role':_0x674f1b[_0x6044('0x37')][_0x6044('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x50d9a6)['then'](function(_0x49ae8b){_0x5e5ae0[_0x6044('0x4d')](_0x6044('0x4e'),_0x49ae8b);_0x5e5ae0[_0x6044('0x4f')](_0x6044('0x50'));})[_0x6044('0x38')](function(_0x489491){return _0x5e5ae0[_0x6044('0x2d')](0x1f4)[_0x6044('0x51')](_0x489491);});};exports[_0x6044('0x52')]=function(_0x520ba3){if(_[_0x6044('0x53')](_0x520ba3[_0x6044('0x40')])||_[_0x6044('0x53')](_0x520ba3['apiKeyIat'])){return null;}else{return createJwt(_0x520ba3);}};exports[_0x6044('0x54')]=function(_0x53a8ef){_0x53a8ef[_0x6044('0x40')]=generateNonce();_0x53a8ef[_0x6044('0x55')]=generateIssuedAt();return createJwt(_0x53a8ef);};exports[_0x6044('0x56')]=function(_0x56639b,_0x14f00b){var _0x5f5d69=_0x56639b[_0x6044('0x3c')][_0x6044('0x3a')];if(_0x5f5d69){var _0x59c3db={'nonce':_0x14f00b[_0x6044('0x40')],'iat':_0x14f00b[_0x6044('0x55')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5f5d69,_0x59c3db)[_0x6044('0x2c')](function(){return generateApiKey(_0x14f00b);});}else{throw{'message':_0x6044('0x57')};}};function signJwt(_0x1f49f0){var _0x5ca87b=BPromise[_0x6044('0x58')](jwt['sign'],{'context':jwt});var _0x3f4101=_0x1f49f0[_0x6044('0x59')]||config[_0x6044('0x9')][_0x6044('0xa')];return new BPromise(function(_0x243c72,_0x53e6ea){_0x5ca87b(_0x1f49f0[_0x6044('0x5a')],_0x3f4101,_0x1f49f0[_0x6044('0x5b')])['then'](function(_0x1024d0){_0x243c72(_0x1024d0);})[_0x6044('0x38')](function(_0x2fe1cc){_0x53e6ea(_0x2fe1cc);});});}function verifyJwt(_0x58dd37,_0xd914d4,_0x36c771){var _0x5bb885=BPromise['promisify'](jwt[_0x6044('0x5c')],{'context':jwt});var _0x39437b=_0x36c771||config[_0x6044('0x9')][_0x6044('0xa')];return new BPromise(function(_0x10fb98,_0x73a8c5){_0x5bb885(_0x58dd37,_0x39437b,_0xd914d4)[_0x6044('0x2c')](function(_0x529238){_0x10fb98(_0x529238);})[_0x6044('0x38')](function(_0x1e5ef3){_0x73a8c5(_0x1e5ef3);});});}function generateNonce(){return crypto[_0x6044('0x5d')](0x10)['toString'](_0x6044('0x5e'));}function generateIssuedAt(){return Math[_0x6044('0x5f')](Date['now']()/0x3e8)[_0x6044('0x60')]();}function createJwt(_0x102a4b){var _0x57a017={'payload':{'iat':_0x102a4b[_0x6044('0x55')],'nonce':_0x102a4b[_0x6044('0x40')]},'options':{'algorithm':_0x6044('0x61'),'subject':_0x102a4b['id'][_0x6044('0x60')](),'issuer':hardwareConf[_0x6044('0x3b')](),'audience':hardwareConf[_0x6044('0x3b')]()}};return signJwt(_0x57a017)['then'](function(_0x19f4b4){return{'iat':_0x102a4b[_0x6044('0x55')],'nonce':_0x102a4b[_0x6044('0x40')],'token':_0x19f4b4};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index f9f3ff0..0e86917 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 _0xcb91=['unlink','createReadStream','createWriteStream','createDecipher','update','aes192','hasOwnProperty','createCipher','algorithm','data','binary','write','end','final','close'];(function(_0x52a5dc,_0x524b7c){var _0x1f8bad=function(_0x292b4a){while(--_0x292b4a){_0x52a5dc['push'](_0x52a5dc['shift']());}};_0x1f8bad(++_0x524b7c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0xcb91[_0x36436d];return _0x34615d;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x1cb9('0x0')};function combineOptions(_0xe4a5bf){var _0x17d4ec={};for(var _0x22c4b8 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x22c4b8)){_0x17d4ec[_0x22c4b8]=defaultOptions[_0x22c4b8];}}if(_0xe4a5bf){for(var _0x8c392f in _0xe4a5bf){if(_0xe4a5bf[_0x1cb9('0x1')](_0x8c392f)){_0x17d4ec[_0x8c392f]=_0xe4a5bf[_0x8c392f];}}}return _0x17d4ec;}exports['encryptFile']=function(_0x13d5fd,_0x1b26cd,_0x53ffbd,_0x226b69){return new BPromise(function(_0x3f7deb,_0x4ffe20){_0x226b69=combineOptions(_0x226b69);var _0x38737d=new Buffer(_0x53ffbd);var _0x12567c=fs['createReadStream'](_0x13d5fd);var _0x3ae0f1=fs['createWriteStream'](_0x1b26cd);var _0x567139=crypto[_0x1cb9('0x2')](_0x226b69[_0x1cb9('0x3')],_0x38737d);_0x12567c['on'](_0x1cb9('0x4'),function(_0x1f0eca){var _0x2fc627=new Buffer(_0x567139['update'](_0x1f0eca),_0x1cb9('0x5'));_0x3ae0f1[_0x1cb9('0x6')](_0x2fc627);});_0x12567c['on'](_0x1cb9('0x7'),function(){try{var _0x3fdd83=new Buffer(_0x567139[_0x1cb9('0x8')]('binary'),'binary');_0x3ae0f1['write'](_0x3fdd83);_0x3ae0f1[_0x1cb9('0x7')]();_0x3ae0f1['on'](_0x1cb9('0x9'),function(){return _0x3f7deb(_0x1b26cd);});}catch(_0x384496){fs[_0x1cb9('0xa')](_0x1b26cd);return _0x4ffe20(_0x384496);}});});};exports['decryptFile']=function(_0x397727,_0x6ef389,_0x1b3cd7,_0x8dfa55){return new BPromise(function(_0x3e2d11,_0x5806d8){_0x8dfa55=combineOptions(_0x8dfa55);var _0x5572cb=new Buffer(_0x1b3cd7);var _0xd446a3=fs[_0x1cb9('0xb')](_0x397727);var _0x3904b7=fs[_0x1cb9('0xc')](_0x6ef389);var _0x3e21e0=crypto[_0x1cb9('0xd')](_0x8dfa55[_0x1cb9('0x3')],_0x5572cb);_0xd446a3['on']('data',function(_0x479d43){var _0x1b2fa6=new Buffer(_0x3e21e0[_0x1cb9('0xe')](_0x479d43),_0x1cb9('0x5'));_0x3904b7[_0x1cb9('0x6')](_0x1b2fa6);});_0xd446a3['on'](_0x1cb9('0x7'),function(){try{var _0x4014de=new Buffer(_0x3e21e0[_0x1cb9('0x8')]('binary'),'binary');_0x3904b7[_0x1cb9('0x6')](_0x4014de);_0x3904b7['end']();_0x3904b7['on'](_0x1cb9('0x9'),function(){return _0x3e2d11(_0x6ef389);});}catch(_0x2265ea){fs['unlink'](_0x6ef389);return _0x5806d8(_0x2265ea);}});});}; \ No newline at end of file +var _0xcb91=['unlink','createReadStream','createWriteStream','createDecipher','update','aes192','hasOwnProperty','createCipher','algorithm','data','binary','write','end','final','close'];(function(_0x38c0b2,_0x4be4d0){var _0x299da6=function(_0x381b16){while(--_0x381b16){_0x38c0b2['push'](_0x38c0b2['shift']());}};_0x299da6(++_0x4be4d0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xcb91[_0x382e89];return _0x3a1318;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x1cb9('0x0')};function combineOptions(_0xe4a5bf){var _0x17d4ec={};for(var _0x22c4b8 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x22c4b8)){_0x17d4ec[_0x22c4b8]=defaultOptions[_0x22c4b8];}}if(_0xe4a5bf){for(var _0x8c392f in _0xe4a5bf){if(_0xe4a5bf[_0x1cb9('0x1')](_0x8c392f)){_0x17d4ec[_0x8c392f]=_0xe4a5bf[_0x8c392f];}}}return _0x17d4ec;}exports['encryptFile']=function(_0x13d5fd,_0x1b26cd,_0x53ffbd,_0x226b69){return new BPromise(function(_0x3f7deb,_0x4ffe20){_0x226b69=combineOptions(_0x226b69);var _0x38737d=new Buffer(_0x53ffbd);var _0x12567c=fs['createReadStream'](_0x13d5fd);var _0x3ae0f1=fs['createWriteStream'](_0x1b26cd);var _0x567139=crypto[_0x1cb9('0x2')](_0x226b69[_0x1cb9('0x3')],_0x38737d);_0x12567c['on'](_0x1cb9('0x4'),function(_0x1f0eca){var _0x2fc627=new Buffer(_0x567139['update'](_0x1f0eca),_0x1cb9('0x5'));_0x3ae0f1[_0x1cb9('0x6')](_0x2fc627);});_0x12567c['on'](_0x1cb9('0x7'),function(){try{var _0x3fdd83=new Buffer(_0x567139[_0x1cb9('0x8')]('binary'),'binary');_0x3ae0f1['write'](_0x3fdd83);_0x3ae0f1[_0x1cb9('0x7')]();_0x3ae0f1['on'](_0x1cb9('0x9'),function(){return _0x3f7deb(_0x1b26cd);});}catch(_0x384496){fs[_0x1cb9('0xa')](_0x1b26cd);return _0x4ffe20(_0x384496);}});});};exports['decryptFile']=function(_0x397727,_0x6ef389,_0x1b3cd7,_0x8dfa55){return new BPromise(function(_0x3e2d11,_0x5806d8){_0x8dfa55=combineOptions(_0x8dfa55);var _0x5572cb=new Buffer(_0x1b3cd7);var _0xd446a3=fs[_0x1cb9('0xb')](_0x397727);var _0x3904b7=fs[_0x1cb9('0xc')](_0x6ef389);var _0x3e21e0=crypto[_0x1cb9('0xd')](_0x8dfa55[_0x1cb9('0x3')],_0x5572cb);_0xd446a3['on']('data',function(_0x479d43){var _0x1b2fa6=new Buffer(_0x3e21e0[_0x1cb9('0xe')](_0x479d43),_0x1cb9('0x5'));_0x3904b7[_0x1cb9('0x6')](_0x1b2fa6);});_0xd446a3['on'](_0x1cb9('0x7'),function(){try{var _0x4014de=new Buffer(_0x3e21e0[_0x1cb9('0x8')]('binary'),'binary');_0x3904b7[_0x1cb9('0x6')](_0x4014de);_0x3904b7['end']();_0x3904b7['on'](_0x1cb9('0x9'),function(){return _0x3e2d11(_0x6ef389);});}catch(_0x2265ea){fs['unlink'](_0x6ef389);return _0x5806d8(_0x2265ea);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 70e0ed3..b58a23b 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 _0xfd28=['%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','format','CSV','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','length','existsSync','join','mkdirSync','each','csv','writeFileSync'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xfd28,0x148));var _0x8fd2=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xfd28[_0x3430aa];return _0x2ac5c;};'use strict';var util=require('util');var path=require(_0x8fd2('0x0'));var _=require(_0x8fd2('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x8fd2('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x8fd2('0x3'));var db=require(_0x8fd2('0x4'))['db'];var dbH=require(_0x8fd2('0x4'))['dbH'];var logger=require(_0x8fd2('0x5'))(_0x8fd2('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x8fd2('0x7')][0x2]);var QUERY=process[_0x8fd2('0x7')][0x3];var PATH=process[_0x8fd2('0x7')][0x4];function analyticExtractedReport(_0x4bdc1a,_0x53d938){var _0x10fccf={'status':_0x4bdc1a};var _0x466c3d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x53d938){_0x10fccf[_0x8fd2('0x8')]=_0x53d938;}return db['AnalyticExtractedReport'][_0x8fd2('0x9')](_0x10fccf,_0x466c3d);}function main(){var _0x49ca87=0x1388;var _0x2842f3;logger['info'](util[_0x8fd2('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x8fd2('0xb')));return db['Setting'][_0x8fd2('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8fd2('0xd')]})[_0x8fd2('0xe')](function(_0xfd78d){if(_0xfd78d){_0x2842f3=_0xfd78d;_0x49ca87=_0x2842f3[_0x8fd2('0xd')]||0x1388;}})[_0x8fd2('0xe')](function(){return dbH[_0x8fd2('0xf')][_0x8fd2('0x10')](util[_0x8fd2('0xa')](_0x8fd2('0x11'),QUERY),{'type':dbH[_0x8fd2('0xf')][_0x8fd2('0x12')][_0x8fd2('0x13')]});})[_0x8fd2('0xe')](function(_0x40712c){if(!_0x40712c[0x0][_0x8fd2('0x14')]){return analyticExtractedReport('Empty');}var _0x20daca=[];var _0x5ef478=0x0;var _0x4f0b17=!![];if(_0x40712c&&_0x40712c['length']){var _0x3b79f3=_0x40712c[0x0][_0x8fd2('0x14')]%(_0x5ef478+_0x49ca87);if(_0x2842f3[_0x8fd2('0x15')]){for(;_0x4f0b17;_0x5ef478+=_0x49ca87,_0x3b79f3=_0x40712c[0x0][_0x8fd2('0x14')]%(_0x5ef478+_0x49ca87)){if(_0x3b79f3==0x0||_0x3b79f3==_0x40712c[0x0]['num']){_0x4f0b17=![];}_0x20daca[_0x8fd2('0x16')](dbH[_0x8fd2('0xf')][_0x8fd2('0x10')](util[_0x8fd2('0xa')](_0x8fd2('0x17'),QUERY,_0x49ca87,_0x5ef478),{'type':dbH['sequelize']['QueryTypes'][_0x8fd2('0x13')]}));}}else{_0x20daca['push'](dbH[_0x8fd2('0xf')]['query'](QUERY,{'type':dbH[_0x8fd2('0xf')][_0x8fd2('0x12')]['SELECT']}));}}var _0x122b60=path['dirname'](PATH);var _0xd3981f=path[_0x8fd2('0x18')](PATH,'.csv');var _0x1c925c=_0x2842f3[_0x8fd2('0x15')]&&_0x20daca[_0x8fd2('0x19')]>0x1;var _0x490ea5=[];if(!fs[_0x8fd2('0x1a')](path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f))&&_0x1c925c){fs[_0x8fd2('0x1c')](path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f));}return BPromise[_0x8fd2('0x1d')](_0x20daca,function(_0x25db4e){_0x490ea5[_0x8fd2('0x16')](_0x25db4e);})[_0x8fd2('0xe')](function(){for(var _0x1456b4=0x0;_0x1456b4<_0x490ea5[_0x8fd2('0x19')];_0x1456b4+=0x1){var _0x3392fb;var _0x1f3237=_0x490ea5[_0x1456b4];if(_0x1c925c){_0x3392fb=path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f,util['format']('%s%d.%s',_0xd3981f,_0x1456b4,_0x8fd2('0x1e')));}else{_0x3392fb=path[_0x8fd2('0x1b')](_0x122b60,util[_0x8fd2('0xa')]('%s.%s',_0xd3981f,_0x8fd2('0x1e')));}fs[_0x8fd2('0x1f')](_0x3392fb,csv(_0x1f3237));}})[_0x8fd2('0xe')](function(){if(_0x1c925c){zipdir(path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f),{'saveTo':path[_0x8fd2('0x1b')](_0x122b60,util[_0x8fd2('0xa')](_0x8fd2('0x20'),_0xd3981f,'zip'))},function(_0xe76676,_0x13c9b9){});rimraf(path[_0x8fd2('0x1b')](_0x122b60,_0xd3981f),function(){});}})[_0x8fd2('0xe')](function(){logger[_0x8fd2('0x21')](util[_0x8fd2('0xa')](_0x8fd2('0x22'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x1c925c?util['format'](_0x8fd2('0x20'),_0xd3981f,_0x1c925c?_0x8fd2('0x23'):_0x8fd2('0x1e')):null);});})[_0x8fd2('0x24')](function(_0x5a0b3b){logger['info'](util[_0x8fd2('0xa')](_0x8fd2('0x25'),EXTRACTED_REPORT_ID,_0x8fd2('0xb')),util[_0x8fd2('0x26')](_0x5a0b3b,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x8fd2('0x27'));});}main(); \ No newline at end of file +var _0xe14d=['.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','length','num','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename'];(function(_0x24161e,_0x5e3d59){var _0x49fb89=function(_0x532e79){while(--_0x532e79){_0x24161e['push'](_0x24161e['shift']());}};_0x49fb89(++_0x5e3d59);}(_0xe14d,0x1ee));var _0xde14=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xe14d[_0x334841];return _0x5beb4b;};'use strict';var util=require(_0xde14('0x0'));var path=require(_0xde14('0x1'));var _=require(_0xde14('0x2'));var csv=require(_0xde14('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xde14('0x4'));var rimraf=require(_0xde14('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xde14('0x6'))[_0xde14('0x7')];var logger=require(_0xde14('0x8'))(_0xde14('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xde14('0xa')][0x2]);var QUERY=process[_0xde14('0xa')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x5a1344,_0x1bd49d){var _0x115b7d={'status':_0x5a1344};var _0x2b0e7c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1bd49d){_0x115b7d[_0xde14('0xb')]=_0x1bd49d;}return db[_0xde14('0xc')][_0xde14('0xd')](_0x115b7d,_0x2b0e7c);}function main(){var _0xa17e8=0x1388;var _0x1ce0a2;logger['info'](util[_0xde14('0xe')](_0xde14('0xf'),EXTRACTED_REPORT_ID,_0xde14('0x10')));return db[_0xde14('0x11')][_0xde14('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xde14('0x13'),_0xde14('0x14')]})[_0xde14('0x15')](function(_0x34e28f){if(_0x34e28f){_0x1ce0a2=_0x34e28f;_0xa17e8=_0x1ce0a2[_0xde14('0x14')]||0x1388;}})[_0xde14('0x15')](function(){return dbH[_0xde14('0x16')][_0xde14('0x17')](util[_0xde14('0xe')](_0xde14('0x18'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xde14('0x19')]});})[_0xde14('0x15')](function(_0x26c1ec){if(!_0x26c1ec[0x0]['num']){return analyticExtractedReport(_0xde14('0x1a'));}var _0x31adb3=[];var _0x257390=0x0;var _0x31902a=!![];if(_0x26c1ec&&_0x26c1ec[_0xde14('0x1b')]){var _0x1b9d4b=_0x26c1ec[0x0][_0xde14('0x1c')]%(_0x257390+_0xa17e8);if(_0x1ce0a2[_0xde14('0x13')]){for(;_0x31902a;_0x257390+=_0xa17e8,_0x1b9d4b=_0x26c1ec[0x0][_0xde14('0x1c')]%(_0x257390+_0xa17e8)){if(_0x1b9d4b==0x0||_0x1b9d4b==_0x26c1ec[0x0][_0xde14('0x1c')]){_0x31902a=![];}_0x31adb3['push'](dbH[_0xde14('0x16')][_0xde14('0x17')](util[_0xde14('0xe')](_0xde14('0x1d'),QUERY,_0xa17e8,_0x257390),{'type':dbH['sequelize'][_0xde14('0x1e')]['SELECT']}));}}else{_0x31adb3[_0xde14('0x1f')](dbH['sequelize'][_0xde14('0x17')](QUERY,{'type':dbH[_0xde14('0x16')][_0xde14('0x1e')][_0xde14('0x19')]}));}}var _0x39bdc5=path[_0xde14('0x20')](PATH);var _0x40b648=path[_0xde14('0x21')](PATH,_0xde14('0x22'));var _0x163b79=_0x1ce0a2[_0xde14('0x13')]&&_0x31adb3[_0xde14('0x1b')]>0x1;var _0x8f8033=[];if(!fs['existsSync'](path[_0xde14('0x23')](_0x39bdc5,_0x40b648))&&_0x163b79){fs[_0xde14('0x24')](path[_0xde14('0x23')](_0x39bdc5,_0x40b648));}return BPromise[_0xde14('0x25')](_0x31adb3,function(_0x1bb7be){_0x8f8033[_0xde14('0x1f')](_0x1bb7be);})[_0xde14('0x15')](function(){for(var _0x23c735=0x0;_0x23c735<_0x8f8033[_0xde14('0x1b')];_0x23c735+=0x1){var _0x350a78;var _0x4eff65=_0x8f8033[_0x23c735];if(_0x163b79){_0x350a78=path[_0xde14('0x23')](_0x39bdc5,_0x40b648,util[_0xde14('0xe')](_0xde14('0x26'),_0x40b648,_0x23c735,_0xde14('0x27')));}else{_0x350a78=path['join'](_0x39bdc5,util[_0xde14('0xe')](_0xde14('0x28'),_0x40b648,_0xde14('0x27')));}fs['writeFileSync'](_0x350a78,csv(_0x4eff65));}})[_0xde14('0x15')](function(){if(_0x163b79){zipdir(path['join'](_0x39bdc5,_0x40b648),{'saveTo':path[_0xde14('0x23')](_0x39bdc5,util[_0xde14('0xe')](_0xde14('0x28'),_0x40b648,_0xde14('0x29')))},function(_0x2aca96,_0x237d3f){});rimraf(path[_0xde14('0x23')](_0x39bdc5,_0x40b648),function(){});}})[_0xde14('0x15')](function(){logger['info'](util[_0xde14('0xe')](_0xde14('0x2a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xde14('0x2b'),_0x163b79?util['format'](_0xde14('0x28'),_0x40b648,_0x163b79?_0xde14('0x29'):_0xde14('0x27')):null);});})[_0xde14('0x2c')](function(_0x13c164){logger['info'](util[_0xde14('0xe')](_0xde14('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util[_0xde14('0x2e')](_0x13c164,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xde14('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5f57b89..dc2a8c7 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x3372fe,_0x1842a8){var _0x15f048=function(_0x5ee664){while(--_0x5ee664){_0x3372fe['push'](_0x3372fe['shift']());}};_0x15f048(++_0x1842a8);}(_0xb10b,0x12a));var _0xbb10=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0xb10b[_0x39157f];return _0x1ae4e2;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _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(_0x42d756,_0x1e6a42){var _0x57e5f5=function(_0x3e6629){while(--_0x3e6629){_0x42d756['push'](_0x42d756['shift']());}};_0x57e5f5(++_0x1e6a42);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c9427,_0x331c7b){_0x2c9427=_0x2c9427-0x0;var _0x1b6dc8=_0xb10b[_0x2c9427];return _0x1b6dc8;};'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 71bba07..b20679b 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 _0x1261=['dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','writeFileSync','binary','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','inspect','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Setting','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0xbfd016,_0x10aa76){var _0x1bdd39=function(_0x3f82db){while(--_0x3f82db){_0xbfd016['push'](_0xbfd016['shift']());}};_0x1bdd39(++_0x10aa76);}(_0x1261,0xc6));var _0x1126=function(_0x94030f,_0x476ed2){_0x94030f=_0x94030f-0x0;var _0x9f7747=_0x1261[_0x94030f];return _0x9f7747;};'use strict';var util=require(_0x1126('0x0'));var path=require('path');var _=require(_0x1126('0x1'));var fs=require('fs');var json2xls=require(_0x1126('0x2'));var BPromise=require(_0x1126('0x3'));var zipdir=require(_0x1126('0x4'));var rimraf=require(_0x1126('0x5'));var db=require(_0x1126('0x6'))['db'];var dbH=require(_0x1126('0x6'))['dbH'];var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1126('0x9')][0x4];function analyticExtractedReport(_0x5ae01a,_0x1650aa){var _0x4f3709={'status':_0x5ae01a};var _0x2df6a5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1650aa){_0x4f3709[_0x1126('0xa')]=_0x1650aa;}return db['AnalyticExtractedReport'][_0x1126('0xb')](_0x4f3709,_0x2df6a5);}function main(){var _0x2dcb9c=0x1388;var _0x2415ad;logger[_0x1126('0xc')](util[_0x1126('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x1126('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x1126('0xf')]})['then'](function(_0x1167e8){if(_0x1167e8){_0x2415ad=_0x1167e8;_0x2dcb9c=_0x2415ad[_0x1126('0xf')]||0x1388;}})[_0x1126('0x10')](function(){return dbH[_0x1126('0x11')][_0x1126('0x12')](util[_0x1126('0xd')](_0x1126('0x13'),QUERY),{'type':dbH['sequelize'][_0x1126('0x14')][_0x1126('0x15')]});})[_0x1126('0x10')](function(_0x500a87){if(!_0x500a87[0x0][_0x1126('0x16')]){return analyticExtractedReport('Empty');}var _0x2d5906=[];var _0x2537dd=0x0;var _0x4a0022=!![];if(_0x2415ad[_0x1126('0x17')]){if(_0x500a87&&_0x500a87[_0x1126('0x18')]){var _0x2da5a2=_0x500a87[0x0][_0x1126('0x16')]%(_0x2537dd+_0x2dcb9c);for(;_0x4a0022;_0x2537dd+=_0x2dcb9c,_0x2da5a2=_0x500a87[0x0][_0x1126('0x16')]%(_0x2537dd+_0x2dcb9c)){if(_0x2da5a2==0x0||_0x2da5a2==_0x500a87[0x0][_0x1126('0x16')]){_0x4a0022=![];}_0x2d5906[_0x1126('0x19')](dbH[_0x1126('0x11')][_0x1126('0x12')](util[_0x1126('0xd')](_0x1126('0x1a'),QUERY,_0x2dcb9c,_0x2537dd),{'type':dbH[_0x1126('0x11')][_0x1126('0x14')][_0x1126('0x15')]}));}}}else{_0x2d5906[_0x1126('0x19')](dbH[_0x1126('0x11')][_0x1126('0x12')](QUERY,{'type':dbH[_0x1126('0x11')][_0x1126('0x14')][_0x1126('0x15')]}));}var _0x2be43d=path[_0x1126('0x1b')](PATH);var _0x36eaf4=path[_0x1126('0x1c')](PATH,_0x1126('0x1d'));var _0x5afcba=_0x2415ad['split']&&_0x2d5906[_0x1126('0x18')]>0x1;var _0x7f047c=[];if(!fs[_0x1126('0x1e')](path[_0x1126('0x1f')](_0x2be43d,_0x36eaf4))&&_0x5afcba){fs[_0x1126('0x20')](path['join'](_0x2be43d,_0x36eaf4));}return BPromise[_0x1126('0x21')](_0x2d5906,function(_0x1e367c){_0x7f047c['push'](_0x1e367c);})[_0x1126('0x10')](function(){for(var _0x330813=0x0;_0x330813<_0x7f047c['length'];_0x330813+=0x1){var _0x45e661;var _0x458715=_0x7f047c[_0x330813];if(_0x5afcba){_0x45e661=path[_0x1126('0x1f')](_0x2be43d,_0x36eaf4,util[_0x1126('0xd')](_0x1126('0x22'),_0x36eaf4,_0x330813,'xlsx'));}else{_0x45e661=path[_0x1126('0x1f')](_0x2be43d,util[_0x1126('0xd')](_0x1126('0x23'),_0x36eaf4,'xlsx'));}fs[_0x1126('0x24')](_0x45e661,json2xls(_0x458715),_0x1126('0x25'));}})[_0x1126('0x10')](function(){if(_0x5afcba){zipdir(path['join'](_0x2be43d,_0x36eaf4),{'saveTo':path[_0x1126('0x1f')](_0x2be43d,util[_0x1126('0xd')]('%s.%s',_0x36eaf4,_0x1126('0x26')))},function(_0x35dcc7,_0x7340b7){});rimraf(path[_0x1126('0x1f')](_0x2be43d,_0x36eaf4),function(){});}})[_0x1126('0x10')](function(){logger[_0x1126('0xc')](util['format'](_0x1126('0x27'),EXTRACTED_REPORT_ID,_0x1126('0x28')));return analyticExtractedReport(_0x1126('0x29'),_0x5afcba?util[_0x1126('0xd')](_0x1126('0x23'),_0x36eaf4,_0x5afcba?_0x1126('0x26'):'xlsx'):null);});})[_0x1126('0x2a')](function(_0x5a0fd9){logger[_0x1126('0xc')](util[_0x1126('0xd')](_0x1126('0x2b'),EXTRACTED_REPORT_ID,_0x1126('0x28')),util[_0x1126('0x2c')](_0x5a0fd9,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xe944=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','inspect','util','json2xls','rimraf','dbH','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','xlsx','binary','zip'];(function(_0x1ccac0,_0x15ca93){var _0xeee168=function(_0x3506a3){while(--_0x3506a3){_0x1ccac0['push'](_0x1ccac0['shift']());}};_0xeee168(++_0x15ca93);}(_0xe944,0x174));var _0x4e94=function(_0x501849,_0x1e65d6){_0x501849=_0x501849-0x0;var _0x5d82ca=_0xe944[_0x501849];return _0x5d82ca;};'use strict';var util=require(_0x4e94('0x0'));var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x4e94('0x1'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x4e94('0x2'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x4e94('0x3')];var logger=require(_0x4e94('0x4'))(_0x4e94('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x4e94('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4e94('0x6')][0x4];function analyticExtractedReport(_0x28a1fd,_0x175b42){var _0x32bb46={'status':_0x28a1fd};var _0x5a5823={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x175b42){_0x32bb46[_0x4e94('0x7')]=_0x175b42;}return db['AnalyticExtractedReport'][_0x4e94('0x8')](_0x32bb46,_0x5a5823);}function main(){var _0xedf796=0x1388;var _0x307c47;logger[_0x4e94('0x9')](util['format'](_0x4e94('0xa'),EXTRACTED_REPORT_ID,_0x4e94('0xb')));return db[_0x4e94('0xc')][_0x4e94('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4e94('0xe'),_0x4e94('0xf')]})[_0x4e94('0x10')](function(_0x5b7b98){if(_0x5b7b98){_0x307c47=_0x5b7b98;_0xedf796=_0x307c47['splitSizeXlsx']||0x1388;}})[_0x4e94('0x10')](function(){return dbH[_0x4e94('0x11')][_0x4e94('0x12')](util[_0x4e94('0x13')](_0x4e94('0x14'),QUERY),{'type':dbH['sequelize'][_0x4e94('0x15')][_0x4e94('0x16')]});})[_0x4e94('0x10')](function(_0x17d5a9){if(!_0x17d5a9[0x0][_0x4e94('0x17')]){return analyticExtractedReport(_0x4e94('0x18'));}var _0x22b4ca=[];var _0x31dfd1=0x0;var _0xab0a8a=!![];if(_0x307c47[_0x4e94('0xe')]){if(_0x17d5a9&&_0x17d5a9[_0x4e94('0x19')]){var _0x41d8dc=_0x17d5a9[0x0]['num']%(_0x31dfd1+_0xedf796);for(;_0xab0a8a;_0x31dfd1+=_0xedf796,_0x41d8dc=_0x17d5a9[0x0]['num']%(_0x31dfd1+_0xedf796)){if(_0x41d8dc==0x0||_0x41d8dc==_0x17d5a9[0x0][_0x4e94('0x17')]){_0xab0a8a=![];}_0x22b4ca[_0x4e94('0x1a')](dbH[_0x4e94('0x11')][_0x4e94('0x12')](util[_0x4e94('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xedf796,_0x31dfd1),{'type':dbH[_0x4e94('0x11')][_0x4e94('0x15')][_0x4e94('0x16')]}));}}}else{_0x22b4ca[_0x4e94('0x1a')](dbH['sequelize'][_0x4e94('0x12')](QUERY,{'type':dbH['sequelize'][_0x4e94('0x15')][_0x4e94('0x16')]}));}var _0x563572=path['dirname'](PATH);var _0xf03522=path[_0x4e94('0x1b')](PATH,_0x4e94('0x1c'));var _0x3bb05b=_0x307c47[_0x4e94('0xe')]&&_0x22b4ca[_0x4e94('0x19')]>0x1;var _0x2edbd5=[];if(!fs[_0x4e94('0x1d')](path['join'](_0x563572,_0xf03522))&&_0x3bb05b){fs[_0x4e94('0x1e')](path[_0x4e94('0x1f')](_0x563572,_0xf03522));}return BPromise[_0x4e94('0x20')](_0x22b4ca,function(_0x57178a){_0x2edbd5[_0x4e94('0x1a')](_0x57178a);})['then'](function(){for(var _0x52c7f8=0x0;_0x52c7f8<_0x2edbd5[_0x4e94('0x19')];_0x52c7f8+=0x1){var _0x3e8f86;var _0x4a0f22=_0x2edbd5[_0x52c7f8];if(_0x3bb05b){_0x3e8f86=path[_0x4e94('0x1f')](_0x563572,_0xf03522,util[_0x4e94('0x13')](_0x4e94('0x21'),_0xf03522,_0x52c7f8,'xlsx'));}else{_0x3e8f86=path[_0x4e94('0x1f')](_0x563572,util[_0x4e94('0x13')](_0x4e94('0x22'),_0xf03522,_0x4e94('0x23')));}fs['writeFileSync'](_0x3e8f86,json2xls(_0x4a0f22),_0x4e94('0x24'));}})[_0x4e94('0x10')](function(){if(_0x3bb05b){zipdir(path[_0x4e94('0x1f')](_0x563572,_0xf03522),{'saveTo':path[_0x4e94('0x1f')](_0x563572,util[_0x4e94('0x13')](_0x4e94('0x22'),_0xf03522,_0x4e94('0x25')))},function(_0x42ea2a,_0x42e326){});rimraf(path['join'](_0x563572,_0xf03522),function(){});}})[_0x4e94('0x10')](function(){logger[_0x4e94('0x9')](util[_0x4e94('0x13')](_0x4e94('0x26'),EXTRACTED_REPORT_ID,_0x4e94('0xb')));return analyticExtractedReport(_0x4e94('0x27'),_0x3bb05b?util[_0x4e94('0x13')]('%s.%s',_0xf03522,_0x3bb05b?_0x4e94('0x25'):_0x4e94('0x23')):null);});})['catch'](function(_0x3143db){logger[_0x4e94('0x9')](util[_0x4e94('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x4e94('0x28')](_0x3143db,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3d35ab5..5d47a81 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 _0x35ff=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','catch','error','rewrite','util','models','findAll','intervals','VoiceExtension','IntervalId','map','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','playback','priority','extensions','find','push','type','format','CDR(type)=%s','context','VoiceExtensionId','outbound','extension','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf'];(function(_0x2ea280,_0x59fe59){var _0x587ee3=function(_0x180621){while(--_0x180621){_0x2ea280['push'](_0x2ea280['shift']());}};_0x587ee3(++_0x59fe59);}(_0x35ff,0xb3));var _0xf35f=function(_0x97b7ab,_0x173a3d){_0x97b7ab=_0x97b7ab-0x0;var _0x136d54=_0x35ff[_0x97b7ab];return _0x136d54;};'use strict';var _=require('lodash');var util=require(_0xf35f('0x0'));function rewrite(_0x8756ed,_0x4f5274){var _0x256faa=this;return _0x8756ed[_0xf35f('0x1')]['Interval'][_0xf35f('0x2')]({'raw':!![]})['then'](function(_0x3ce173){_0x256faa[_0xf35f('0x3')]=_0x3ce173;return _0x8756ed[_0xf35f('0x1')][_0xf35f('0x4')][_0xf35f('0x2')]({'where':{'IntervalId':_0x4f5274[_0xf35f('0x5')]},'raw':!![]});})['then'](function(_0x3e3aaa){return _0x8756ed[_0xf35f('0x1')][_0xf35f('0x4')][_0xf35f('0x2')]({'where':{'exten':{'$in':_['uniq'](_[_0xf35f('0x6')](_0x3e3aaa,_0xf35f('0x7')))}},'order':[{'raw':_0xf35f('0x8')}],'raw':!![]});})[_0xf35f('0x9')](function(_0x45124e){var _0x179b13=_[_0xf35f('0xa')](_0x45124e,{'priority':'1'});var _0x5d2fd4=_[_0xf35f('0xa')](_0x45124e,{'isApp':0x1});var _0x247d4c=_[_0xf35f('0xb')](_0x5d2fd4,_0xf35f('0x7'));var _0x2a5109=[_0xf35f('0xc'),_0xf35f('0xd')];var _0x295701=[];var _0x5b38be=[];for(var _0x2f6645 in _0x247d4c){if(_0x247d4c['hasOwnProperty'](_0x2f6645)){_0x256faa[_0xf35f('0xe')]=0x2;_0x256faa[_0xf35f('0xf')]=[];_0x256faa['extension']=_[_0xf35f('0x10')](_0x179b13,{'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')]});_0x256faa[_0xf35f('0xf')][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':'Set','appdata':util[_0xf35f('0x13')](_0xf35f('0x14'),_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')]),'context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'exten':_0x247d4c[_0x2f6645][0x0]['exten'],'priority':_0x256faa[_0xf35f('0xe')]++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});if(_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')]===_0xf35f('0x17')){if(_0x256faa[_0xf35f('0x18')]){_0x256faa['extensions'][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0xf35f('0x1a')+(_0x256faa[_0xf35f('0x18')][_0xf35f('0x1b')]?_0xf35f('0x1c')+_0x256faa['extension'][_0xf35f('0x1b')]+'}':_0xf35f('0x1d')),'context':_0x247d4c[_0x2f6645][0x0]['context'],'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'priority':_0x256faa['priority']++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});}_0x256faa['extensions'][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':'CDR(routeid)='+_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')],'context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'priority':_0x256faa[_0xf35f('0xe')]++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});var _0x5f2383=_0x256faa['priority']++;_0x256faa[_0xf35f('0xf')][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x1e'),'appdata':_0xf35f('0x1f')+(_0x5f2383+0x2)+'):Goto('+(_0x5f2383+0x1)+')','context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'exten':_0x247d4c[_0x2f6645][0x0]['exten'],'priority':_0x5f2383,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});if(_0x256faa[_0xf35f('0x18')]){_0x256faa['extensions'][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0x256faa[_0xf35f('0x18')][_0xf35f('0x1b')]?_0xf35f('0x20')+_0x256faa[_0xf35f('0x18')][_0xf35f('0x1b')]+'}':_0xf35f('0x21'),'context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'priority':_0x256faa[_0xf35f('0xe')]++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});}_0x256faa[_0xf35f('0xf')]['push']({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0xf35f('0x22')+_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')],'context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'priority':_0x256faa[_0xf35f('0xe')]++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});if(_0x256faa[_0xf35f('0x18')]&&_0x256faa['extension'][_0xf35f('0x23')]('recordingFormat')&&_0x256faa[_0xf35f('0x18')][_0xf35f('0x24')]!==_0xf35f('0x25')){_0x256faa['extensions'][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0xf35f('0x26'),'context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'priority':_0x256faa[_0xf35f('0xe')]++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});_0x256faa['extensions'][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x256faa['extension']['recordingFormat']||_0xf35f('0x27'),'context':_0x247d4c[_0x2f6645][0x0]['context'],'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'priority':_0x256faa[_0xf35f('0xe')]++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});}}_0x256faa[_0xf35f('0xf')][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'priority':_0x256faa['priority']++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0]['VoiceExtensionId']});_0x256faa[_0xf35f('0xf')][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0xf35f('0x28'),'context':_0x247d4c[_0x2f6645][0x0]['context'],'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'priority':_0x256faa['priority']++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0]['VoiceExtensionId']});_0x256faa[_0xf35f('0xf')]['push']({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0xf35f('0x29'),'context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'exten':_0x247d4c[_0x2f6645][0x0]['exten'],'priority':_0x256faa[_0xf35f('0xe')]++,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});for(var _0x4071a2=0x0,_0x2d9df0=0x0;_0x4071a2<_0x247d4c[_0x2f6645]['length'];_0x4071a2+=0x1,_0x2d9df0=0x0){var _0x53ce73=_0x247d4c[_0x2f6645][_0x4071a2];if(_0x53ce73[_0xf35f('0x12')]){_0x53ce73[_0xf35f('0x12')]=_0x53ce73['type'][_0xf35f('0x2a')]();}var _0x5e40aa=[];var _0x23e6d9=[];delete _0x53ce73['id'];delete _0x53ce73[_0xf35f('0x2b')];delete _0x53ce73[_0xf35f('0x2c')];var _0x45517a=_0x53ce73[_0xf35f('0x2d')]!=='*,*,*,*'?[_0x53ce73['interval']]:_0x53ce73['IntervalId']?_['map'](_[_0xf35f('0xa')](_0x256faa[_0xf35f('0x3')],{'IntervalId':_0x53ce73[_0xf35f('0x5')]}),_0xf35f('0x2d')):[];if(_0x53ce73[_0xf35f('0x23')](_0xf35f('0x2e'))){if(_0x53ce73[_0xf35f('0x2e')]&&_0x53ce73[_0xf35f('0x2e')]!=='--'){_0x5e40aa[_0xf35f('0x11')]({'type':_0x53ce73[_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0xf35f('0x2f')+_0x53ce73[_0xf35f('0x2e')],'context':_0x53ce73[_0xf35f('0x15')],'exten':_0x53ce73['exten'],'priority':_0x45517a[_0xf35f('0x30')]+_0x256faa[_0xf35f('0xe')]+_0x2d9df0++,'VoiceExtensionId':_0x53ce73[_0xf35f('0x16')]});}}if(_0x53ce73[_0xf35f('0x12')]===_0xf35f('0x17')&&_0x53ce73[_0xf35f('0x23')](_0xf35f('0x31'))){if(_0x53ce73['callerID']){_0x5e40aa[_0xf35f('0x11')]({'type':_0x53ce73[_0xf35f('0x12')],'app':_0xf35f('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x53ce73['callerID']+')','context':_0x53ce73[_0xf35f('0x15')],'exten':_0x53ce73[_0xf35f('0x7')],'priority':_0x45517a[_0xf35f('0x30')]+_0x256faa['priority']+_0x2d9df0++,'VoiceExtensionId':_0x53ce73[_0xf35f('0x16')]});}else{_0x5e40aa[_0xf35f('0x11')]({'type':_0x53ce73[_0xf35f('0x12')],'app':_0xf35f('0x1e'),'appdata':_0xf35f('0x32'),'context':_0x53ce73['context'],'exten':_0x53ce73[_0xf35f('0x7')],'priority':_0x45517a['length']+_0x256faa[_0xf35f('0xe')]+_0x2d9df0++,'VoiceExtensionId':_0x53ce73[_0xf35f('0x16')]});}}if(_0x53ce73['hasOwnProperty'](_0xf35f('0x33'))){if(_0x2a5109['indexOf'](_0x53ce73[_0xf35f('0x34')][_0xf35f('0x2a')]())>=0x0&&_0x53ce73[_0xf35f('0x35')]!==_0xf35f('0x36')){if(_0x53ce73[_0xf35f('0x33')]){_0x5e40aa[_0xf35f('0x11')]({'type':_0x53ce73[_0xf35f('0x12')],'app':_0xf35f('0x1e'),'appdata':_0xf35f('0x37'),'context':_0x53ce73[_0xf35f('0x15')],'exten':_0x53ce73[_0xf35f('0x7')],'priority':_0x45517a[_0xf35f('0x30')]+_0x256faa['priority']+_0x2d9df0++,'VoiceExtensionId':_0x53ce73[_0xf35f('0x16')]});_0x5e40aa[_0xf35f('0x11')]({'type':_0x53ce73[_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0xf35f('0x38'),'context':_0x53ce73[_0xf35f('0x15')],'exten':_0x53ce73[_0xf35f('0x7')],'priority':_0x45517a[_0xf35f('0x30')]+_0x256faa['priority']+_0x2d9df0++,'VoiceExtensionId':_0x53ce73[_0xf35f('0x16')]});}else{_0x5e40aa[_0xf35f('0x11')]({'type':_0x53ce73['type'],'app':_0xf35f('0x1e'),'appdata':_0xf35f('0x39'),'context':_0x53ce73[_0xf35f('0x15')],'exten':_0x53ce73[_0xf35f('0x7')],'priority':_0x45517a[_0xf35f('0x30')]+_0x256faa['priority']+_0x2d9df0++,'VoiceExtensionId':_0x53ce73['VoiceExtensionId']});_0x5e40aa[_0xf35f('0x11')]({'type':_0x53ce73[_0xf35f('0x12')],'app':_0xf35f('0x19'),'appdata':_0xf35f('0x3a'),'context':_0x53ce73[_0xf35f('0x15')],'exten':_0x53ce73['exten'],'priority':_0x45517a[_0xf35f('0x30')]+_0x256faa[_0xf35f('0xe')]+_0x2d9df0++,'VoiceExtensionId':_0x53ce73[_0xf35f('0x16')]});}}}for(var _0x454f94=0x0;_0x454f94<_0x45517a[_0xf35f('0x30')];_0x454f94+=0x1){var _0xaf45de=_0x256faa[_0xf35f('0xe')]+_0x45517a[_0xf35f('0x30')];var _0xd0760c=_0x454f94===_0x45517a['length']-0x1?_0x256faa[_0xf35f('0xe')]+_0x5e40aa['length']+_0x23e6d9['length']+0x2:_0x256faa[_0xf35f('0xe')]+_0x454f94+0x1;_0x5e40aa[_0xf35f('0x3b')](_0x454f94,0x0,{'type':_0x53ce73[_0xf35f('0x12')],'app':_0xf35f('0x3c'),'appdata':_0x45517a[_0x454f94]+'?'+_0x53ce73[_0xf35f('0x15')]+_0xf35f('0x3d')+_0xaf45de+':'+_0x53ce73[_0xf35f('0x15')]+',${EXTEN},'+_0xd0760c,'exten':_0x53ce73[_0xf35f('0x7')],'context':_0x53ce73[_0xf35f('0x15')],'priority':_0x256faa[_0xf35f('0xe')]+_0x454f94,'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});}_0x53ce73[_0xf35f('0xe')]=_0x5e40aa[_0xf35f('0x30')]?_[_0xf35f('0x3e')](_0x5e40aa)[_0xf35f('0xe')]+0x1:_0x256faa[_0xf35f('0xe')];_0x256faa[_0xf35f('0xe')]=(_0x23e6d9['length']?_[_0xf35f('0x3e')](_0x23e6d9)[_0xf35f('0xe')]:_0x53ce73['priority'])+0x1;_0x256faa[_0xf35f('0xf')]=_[_0xf35f('0x3f')](_0x256faa[_0xf35f('0xf')],_0x5e40aa,[_0x53ce73],_0x23e6d9);}_0x256faa[_0xf35f('0xf')][_0xf35f('0x11')]({'type':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x12')],'app':_0xf35f('0x40'),'exten':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x7')],'context':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x15')],'priority':_0x256faa[_0xf35f('0xe')],'VoiceExtensionId':_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]});_0x295701['push'](_0x247d4c[_0x2f6645][0x0][_0xf35f('0x16')]);_0x5b38be=_[_0xf35f('0x3f')](_0x5b38be,_0x256faa[_0xf35f('0xf')]);}}return _0x8756ed['transaction'](function(_0x3ed256){return _0x8756ed[_0xf35f('0x1')][_0xf35f('0x4')][_0xf35f('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x295701}},'transaction':_0x3ed256})[_0xf35f('0x9')](function(_0x5f287e){return _0x8756ed['models'][_0xf35f('0x4')][_0xf35f('0x42')](_['sortBy'](_0x5b38be,_0xf35f('0xe')),{'transaction':_0x3ed256});});});})[_0xf35f('0x43')](function(_0x391c89){console[_0xf35f('0x44')](_0x391c89);});}exports[_0xf35f('0x45')]=rewrite; \ No newline at end of file +var _0x9cc1=['Set','format','CDR(type)=%s','context','outbound','extension','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','hasOwnProperty','tag','CDR(tag)=','callerID','indexOf','toLowerCase','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','error','rewrite','lodash','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','priority','extensions','type'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9cc1,0x18c));var _0x19cc=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x9cc1[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x19cc('0x0'));var util=require(_0x19cc('0x1'));function rewrite(_0x1ea3cc,_0x2d9b82){var _0x186eda=this;return _0x1ea3cc[_0x19cc('0x2')]['Interval'][_0x19cc('0x3')]({'raw':!![]})[_0x19cc('0x4')](function(_0x40b642){_0x186eda[_0x19cc('0x5')]=_0x40b642;return _0x1ea3cc[_0x19cc('0x2')][_0x19cc('0x6')][_0x19cc('0x3')]({'where':{'IntervalId':_0x2d9b82[_0x19cc('0x7')]},'raw':!![]});})[_0x19cc('0x4')](function(_0x4f9e32){return _0x1ea3cc['models'][_0x19cc('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x19cc('0x8')](_[_0x19cc('0x9')](_0x4f9e32,_0x19cc('0xa')))}},'order':[{'raw':_0x19cc('0xb')}],'raw':!![]});})[_0x19cc('0x4')](function(_0x5a4610){var _0x287de5=_[_0x19cc('0xc')](_0x5a4610,{'priority':'1'});var _0xc0a73e=_[_0x19cc('0xc')](_0x5a4610,{'isApp':0x1});var _0x2285b2=_[_0x19cc('0xd')](_0xc0a73e,_0x19cc('0xa'));var _0x498308=['queue',_0x19cc('0xe')];var _0x2b69cc=[];var _0x523951=[];for(var _0x5c7303 in _0x2285b2){if(_0x2285b2['hasOwnProperty'](_0x5c7303)){_0x186eda[_0x19cc('0xf')]=0x2;_0x186eda[_0x19cc('0x10')]=[];_0x186eda['extension']=_['find'](_0x287de5,{'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')]});_0x186eda[_0x19cc('0x10')]['push']({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':_0x19cc('0x12'),'appdata':util[_0x19cc('0x13')](_0x19cc('0x14'),_0x2285b2[_0x5c7303][0x0]['type']),'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda[_0x19cc('0xf')]++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0]['VoiceExtensionId']});if(_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')]===_0x19cc('0x16')){if(_0x186eda[_0x19cc('0x17')]){_0x186eda[_0x19cc('0x10')][_0x19cc('0x18')]({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':_0x19cc('0x12'),'appdata':_0x19cc('0x19')+(_0x186eda['extension'][_0x19cc('0x1a')]?_0x19cc('0x1b')+_0x186eda[_0x19cc('0x17')][_0x19cc('0x1a')]+'}':_0x19cc('0x1c')),'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda['priority']++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0]['VoiceExtensionId']});}_0x186eda[_0x19cc('0x10')][_0x19cc('0x18')]({'type':_0x2285b2[_0x5c7303][0x0]['type'],'app':'Set','appdata':_0x19cc('0x1d')+_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')],'context':_0x2285b2[_0x5c7303][0x0]['context'],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda[_0x19cc('0xf')]++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')]});var _0x5a1aea=_0x186eda['priority']++;_0x186eda[_0x19cc('0x10')][_0x19cc('0x18')]({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':_0x19cc('0x1f'),'appdata':_0x19cc('0x20')+(_0x5a1aea+0x2)+_0x19cc('0x21')+(_0x5a1aea+0x1)+')','context':_0x2285b2[_0x5c7303][0x0]['context'],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x5a1aea,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0]['VoiceExtensionId']});if(_0x186eda['extension']){_0x186eda[_0x19cc('0x10')]['push']({'type':_0x2285b2[_0x5c7303][0x0]['type'],'app':_0x19cc('0x12'),'appdata':_0x186eda[_0x19cc('0x17')][_0x19cc('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0x186eda[_0x19cc('0x17')]['cutdigits']+'}':_0x19cc('0x22'),'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda[_0x19cc('0xf')]++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0]['VoiceExtensionId']});}_0x186eda[_0x19cc('0x10')][_0x19cc('0x18')]({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':'Set','appdata':'outboundrouteid='+_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')],'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda['priority']++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')]});if(_0x186eda[_0x19cc('0x17')]&&_0x186eda[_0x19cc('0x17')]['hasOwnProperty'](_0x19cc('0x23'))&&_0x186eda[_0x19cc('0x17')]['recordingFormat']!=='none'){_0x186eda[_0x19cc('0x10')][_0x19cc('0x18')]({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':'Set','appdata':_0x19cc('0x24'),'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda['priority']++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')]});_0x186eda[_0x19cc('0x10')][_0x19cc('0x18')]({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':'Set','appdata':_0x19cc('0x25')+_0x186eda[_0x19cc('0x17')]['recordingFormat']||_0x19cc('0x26'),'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda[_0x19cc('0xf')]++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0]['VoiceExtensionId']});}}_0x186eda['extensions'][_0x19cc('0x18')]({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':_0x19cc('0x12'),'appdata':_0x19cc('0x27'),'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda[_0x19cc('0xf')]++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0]['VoiceExtensionId']});_0x186eda[_0x19cc('0x10')]['push']({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':_0x19cc('0x12'),'appdata':_0x19cc('0x28'),'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'exten':_0x2285b2[_0x5c7303][0x0]['exten'],'priority':_0x186eda[_0x19cc('0xf')]++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')]});_0x186eda['extensions'][_0x19cc('0x18')]({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':'Set','appdata':_0x19cc('0x29'),'context':_0x2285b2[_0x5c7303][0x0]['context'],'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'priority':_0x186eda[_0x19cc('0xf')]++,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')]});for(var _0x177c7a=0x0,_0xbc2e4=0x0;_0x177c7a<_0x2285b2[_0x5c7303][_0x19cc('0x2a')];_0x177c7a+=0x1,_0xbc2e4=0x0){var _0x5c4e19=_0x2285b2[_0x5c7303][_0x177c7a];if(_0x5c4e19[_0x19cc('0x11')]){_0x5c4e19[_0x19cc('0x11')]=_0x5c4e19['type']['toLowerCase']();}var _0x55958e=[];var _0x56cab7=[];delete _0x5c4e19['id'];delete _0x5c4e19[_0x19cc('0x2b')];delete _0x5c4e19[_0x19cc('0x2c')];var _0x93aae3=_0x5c4e19[_0x19cc('0x2d')]!==_0x19cc('0x2e')?[_0x5c4e19[_0x19cc('0x2d')]]:_0x5c4e19[_0x19cc('0x7')]?_['map'](_[_0x19cc('0xc')](_0x186eda[_0x19cc('0x5')],{'IntervalId':_0x5c4e19['IntervalId']}),'interval'):[];if(_0x5c4e19[_0x19cc('0x2f')]('tag')){if(_0x5c4e19[_0x19cc('0x30')]&&_0x5c4e19['tag']!=='--'){_0x55958e[_0x19cc('0x18')]({'type':_0x5c4e19['type'],'app':_0x19cc('0x12'),'appdata':_0x19cc('0x31')+_0x5c4e19[_0x19cc('0x30')],'context':_0x5c4e19[_0x19cc('0x15')],'exten':_0x5c4e19[_0x19cc('0xa')],'priority':_0x93aae3[_0x19cc('0x2a')]+_0x186eda[_0x19cc('0xf')]+_0xbc2e4++,'VoiceExtensionId':_0x5c4e19[_0x19cc('0x1e')]});}}if(_0x5c4e19[_0x19cc('0x11')]===_0x19cc('0x16')&&_0x5c4e19['hasOwnProperty']('callerID')){if(_0x5c4e19[_0x19cc('0x32')]){_0x55958e[_0x19cc('0x18')]({'type':_0x5c4e19[_0x19cc('0x11')],'app':_0x19cc('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5c4e19[_0x19cc('0x32')]+')','context':_0x5c4e19[_0x19cc('0x15')],'exten':_0x5c4e19[_0x19cc('0xa')],'priority':_0x93aae3[_0x19cc('0x2a')]+_0x186eda['priority']+_0xbc2e4++,'VoiceExtensionId':_0x5c4e19['VoiceExtensionId']});}else{_0x55958e['push']({'type':_0x5c4e19[_0x19cc('0x11')],'app':_0x19cc('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5c4e19[_0x19cc('0x15')],'exten':_0x5c4e19[_0x19cc('0xa')],'priority':_0x93aae3[_0x19cc('0x2a')]+_0x186eda[_0x19cc('0xf')]+_0xbc2e4++,'VoiceExtensionId':_0x5c4e19[_0x19cc('0x1e')]});}}if(_0x5c4e19[_0x19cc('0x2f')]('answer')){if(_0x498308[_0x19cc('0x33')](_0x5c4e19['app'][_0x19cc('0x34')]())>=0x0&&_0x5c4e19['appType']!==_0x19cc('0x35')){if(_0x5c4e19[_0x19cc('0x36')]){_0x55958e[_0x19cc('0x18')]({'type':_0x5c4e19['type'],'app':_0x19cc('0x1f'),'appdata':_0x19cc('0x37'),'context':_0x5c4e19[_0x19cc('0x15')],'exten':_0x5c4e19[_0x19cc('0xa')],'priority':_0x93aae3[_0x19cc('0x2a')]+_0x186eda[_0x19cc('0xf')]+_0xbc2e4++,'VoiceExtensionId':_0x5c4e19[_0x19cc('0x1e')]});_0x55958e[_0x19cc('0x18')]({'type':_0x5c4e19[_0x19cc('0x11')],'app':_0x19cc('0x12'),'appdata':_0x19cc('0x38'),'context':_0x5c4e19[_0x19cc('0x15')],'exten':_0x5c4e19['exten'],'priority':_0x93aae3[_0x19cc('0x2a')]+_0x186eda[_0x19cc('0xf')]+_0xbc2e4++,'VoiceExtensionId':_0x5c4e19[_0x19cc('0x1e')]});}else{_0x55958e[_0x19cc('0x18')]({'type':_0x5c4e19['type'],'app':'ExecIf','appdata':_0x19cc('0x39'),'context':_0x5c4e19[_0x19cc('0x15')],'exten':_0x5c4e19[_0x19cc('0xa')],'priority':_0x93aae3[_0x19cc('0x2a')]+_0x186eda['priority']+_0xbc2e4++,'VoiceExtensionId':_0x5c4e19[_0x19cc('0x1e')]});_0x55958e[_0x19cc('0x18')]({'type':_0x5c4e19[_0x19cc('0x11')],'app':_0x19cc('0x12'),'appdata':_0x19cc('0x3a'),'context':_0x5c4e19[_0x19cc('0x15')],'exten':_0x5c4e19[_0x19cc('0xa')],'priority':_0x93aae3[_0x19cc('0x2a')]+_0x186eda['priority']+_0xbc2e4++,'VoiceExtensionId':_0x5c4e19['VoiceExtensionId']});}}}for(var _0x58e3a9=0x0;_0x58e3a9<_0x93aae3['length'];_0x58e3a9+=0x1){var _0x2e424b=_0x186eda['priority']+_0x93aae3['length'];var _0x9f49b0=_0x58e3a9===_0x93aae3['length']-0x1?_0x186eda[_0x19cc('0xf')]+_0x55958e[_0x19cc('0x2a')]+_0x56cab7[_0x19cc('0x2a')]+0x2:_0x186eda[_0x19cc('0xf')]+_0x58e3a9+0x1;_0x55958e['splice'](_0x58e3a9,0x0,{'type':_0x5c4e19['type'],'app':_0x19cc('0x3b'),'appdata':_0x93aae3[_0x58e3a9]+'?'+_0x5c4e19['context']+_0x19cc('0x3c')+_0x2e424b+':'+_0x5c4e19[_0x19cc('0x15')]+_0x19cc('0x3c')+_0x9f49b0,'exten':_0x5c4e19[_0x19cc('0xa')],'context':_0x5c4e19[_0x19cc('0x15')],'priority':_0x186eda[_0x19cc('0xf')]+_0x58e3a9,'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')]});}_0x5c4e19[_0x19cc('0xf')]=_0x55958e[_0x19cc('0x2a')]?_[_0x19cc('0x3d')](_0x55958e)[_0x19cc('0xf')]+0x1:_0x186eda[_0x19cc('0xf')];_0x186eda['priority']=(_0x56cab7[_0x19cc('0x2a')]?_[_0x19cc('0x3d')](_0x56cab7)['priority']:_0x5c4e19[_0x19cc('0xf')])+0x1;_0x186eda['extensions']=_[_0x19cc('0x3e')](_0x186eda[_0x19cc('0x10')],_0x55958e,[_0x5c4e19],_0x56cab7);}_0x186eda['extensions']['push']({'type':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x11')],'app':_0x19cc('0x3f'),'exten':_0x2285b2[_0x5c7303][0x0][_0x19cc('0xa')],'context':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x15')],'priority':_0x186eda[_0x19cc('0xf')],'VoiceExtensionId':_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')]});_0x2b69cc[_0x19cc('0x18')](_0x2285b2[_0x5c7303][0x0][_0x19cc('0x1e')]);_0x523951=_['concat'](_0x523951,_0x186eda[_0x19cc('0x10')]);}}return _0x1ea3cc[_0x19cc('0x40')](function(_0x432fe4){return _0x1ea3cc[_0x19cc('0x2')][_0x19cc('0x6')][_0x19cc('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x2b69cc}},'transaction':_0x432fe4})['then'](function(_0x5f9773){return _0x1ea3cc[_0x19cc('0x2')][_0x19cc('0x6')]['bulkCreate'](_[_0x19cc('0x42')](_0x523951,_0x19cc('0xf')),{'transaction':_0x432fe4});});});})['catch'](function(_0x3c4738){console[_0x19cc('0x43')](_0x3c4738);});}exports[_0x19cc('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 27a58ce..1f76958 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x49fcff,_0x55a24e){var _0x4acf9=function(_0x4bdbc8){while(--_0x4bdbc8){_0x49fcff['push'](_0x49fcff['shift']());}};_0x4acf9(++_0x55a24e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0xdd97a,_0x356eb9){var _0x28fb9e=function(_0xc4b8a6){while(--_0xc4b8a6){_0xdd97a['push'](_0xdd97a['shift']());}};_0x28fb9e(++_0x356eb9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 30c6b7b..6c3754f 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 _0x9fb8=['moment','squel','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','select','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','concat',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','message','exit','errors','push','code','sequelize','query','spread','catch','error','main','stringify','send','binding','root','keys','header','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','isValid','firstName','length','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird'];(function(_0x417b2d,_0x821bd2){var _0xadf07a=function(_0x27f48b){while(--_0x27f48b){_0x417b2d['push'](_0x417b2d['shift']());}};_0xadf07a(++_0x821bd2);}(_0x9fb8,0x190));var _0x89fb=function(_0x4d617a,_0xf1bc41){_0x4d617a=_0x4d617a-0x0;var _0x5b04e5=_0x9fb8[_0x4d617a];return _0x5b04e5;};'use strict';var fs=require('fs');var path=require(_0x89fb('0x0'));var _=require(_0x89fb('0x1'));var Papa=require(_0x89fb('0x2'));var util=require(_0x89fb('0x3'));var BPromise=require(_0x89fb('0x4'));var moment=require(_0x89fb('0x5'));var squel=require(_0x89fb('0x6'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x89fb('0x7'))(_0x89fb('0x8'));config['redis']=_[_0x89fb('0x9')](config[_0x89fb('0xa')],{'host':_0x89fb('0xb'),'port':0x18eb});var socket=require(_0x89fb('0xc'))(new Redis(config[_0x89fb('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x89fb('0xd')](_0x89fb('0xe'));function isEmail(_0x47742e){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'](_0x47742e);}function selectNotIn(_0x4d748b,_0x1167b7,_0x2235f0,_0x47f119,_0x2c007c){return squel['select']()['field'](_0x89fb('0xf'))[_0x89fb('0x10')](_0x47f119)[_0x89fb('0x11')](_0x1167b7,null,_0x1167b7+_0x89fb('0x12')+_0x47f119+'.'+_0x2235f0)[_0x89fb('0x13')](_0x47f119+'.'+_0x2235f0+_0x89fb('0x14')+_0x4d748b+'.'+_0x2235f0)[_0x89fb('0x13')](_0x1167b7+_0x89fb('0x15')+_0x2c007c['join']()+')');}function insertCmHopper(_0x3c10f7,_0x73251d,_0x61b500,_0x577bde,_0x490091){var _0x25de8c=[_0x89fb('0x16'),_0x89fb('0x17'),_0x89fb('0x18'),_0x89fb('0x19'),_0x73251d+'.'+_0x577bde,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x89fb('0x1a'),_0x89fb('0x1b'),'\x22'+_0x490091+'\x22'];return squel[_0x89fb('0x1c')]()[_0x89fb('0x1d')](_0x89fb('0x1e'))[_0x89fb('0x1f')]([_0x89fb('0xf'),_0x89fb('0x20'),_0x89fb('0x21'),_0x89fb('0x22'),_0x577bde,_0x89fb('0x23'),_0x89fb('0x24'),_0x89fb('0x25'),_0x89fb('0x26'),'recallme'],squel['select']()[_0x89fb('0x27')](_0x25de8c)[_0x89fb('0x10')](_0x73251d)['join'](_0x89fb('0x28'),null,'cm_contacts.ListId\x20=\x20'+_0x73251d+_0x89fb('0x29'))[_0x89fb('0x11')](_0x61b500,null,_0x61b500+_0x89fb('0x12')+_0x73251d+'.'+_0x577bde)[_0x89fb('0x13')](_0x73251d+'.CmListId\x20=\x20?',_0x3c10f7)[_0x89fb('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x89fb('0x13')](_0x89fb('0x2a'),selectNotIn(_0x73251d,_0x61b500,_0x577bde,_0x89fb('0x1e'),[_0x89fb('0x2b'),_0x89fb('0x2c')]))[_0x89fb('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x73251d,_0x61b500,_0x577bde,_0x89fb('0x1e'),['\x22always\x22'])))[_0x89fb('0x2d')]();}function insertCmHopperBlack(_0x451f36,_0x5a55d5,_0x1f3598,_0x3c90e3){var _0x50e55e=[_0x89fb('0x16'),_0x89fb('0x18'),_0x89fb('0x19'),_0x5a55d5+'.'+_0x3c90e3,_0x89fb('0x2e'),_0x89fb('0x2f')];return squel[_0x89fb('0x1c')]()[_0x89fb('0x1d')](_0x89fb('0x30'))[_0x89fb('0x1f')]([_0x89fb('0xf'),'ContactId','ListId',_0x3c90e3,_0x89fb('0x23'),'updatedAt'],squel[_0x89fb('0x31')]()[_0x89fb('0x27')](_0x50e55e)[_0x89fb('0x10')](_0x5a55d5)['join']('cm_contacts',null,_0x89fb('0x32')+_0x5a55d5+_0x89fb('0x29'))['join'](_0x1f3598,null,_0x1f3598+_0x89fb('0x12')+_0x5a55d5+'.'+_0x3c90e3)[_0x89fb('0x13')](_0x5a55d5+_0x89fb('0x33'),_0x451f36)[_0x89fb('0x13')](_0x89fb('0x34'),NOW)[_0x89fb('0x13')](_0x89fb('0x2a'),squel[_0x89fb('0x31')]()[_0x89fb('0x35')](_0x89fb('0xf'))[_0x89fb('0x10')](_0x89fb('0x30'))[_0x89fb('0x13')](_0x89fb('0x36'),_0x451f36)[_0x89fb('0x13')](_0x3c90e3+_0x89fb('0x37'),_0x5a55d5+'.'+_0x3c90e3)))[_0x89fb('0x2d')]();}function insertCmContact(_0x7c13c8,_0x2d0510,_0x1feb13,_0x5cdb5e){var _0x29fadf=_[_0x89fb('0x38')](_['keys'](_0x5cdb5e),[_0x89fb('0x22'),'CompanyId',_0x89fb('0x23'),_0x89fb('0x24')]);return squel[_0x89fb('0x1c')]()[_0x89fb('0x1d')](_0x89fb('0x28'))[_0x89fb('0x1f')](_0x29fadf,squel[_0x89fb('0x31')]()[_0x89fb('0x27')](_0x29fadf)[_0x89fb('0x10')](_0x2d0510)[_0x89fb('0x13')]('('+_0x1feb13[_0x89fb('0x11')](',')+_0x89fb('0x39'),squel[_0x89fb('0x31')]()['fields'](_0x1feb13)[_0x89fb('0x10')](_0x89fb('0x28'))['where'](_0x89fb('0x36'),_0x7c13c8)[_0x89fb('0x13')](_0x89fb('0x3a')))[_0x89fb('0x13')](_0x89fb('0x3b'),squel[_0x89fb('0x31')]()[_0x89fb('0x35')](_0x89fb('0x3c'),'min_id')[_0x89fb('0x10')](_0x2d0510)['group'](_0x1feb13[_0x89fb('0x11')](','))))[_0x89fb('0x2d')]();}function handleStop(){logger[_0x89fb('0x3d')](_0x89fb('0x3e'));stopped=!![];}function handleUncaughtException(_0x52c18e){logger['error'](_0x52c18e[_0x89fb('0x3f')]);process[_0x89fb('0x40')](0x1);}function handleError(_0x3718da,_0x3d0b7a){stats[_0x89fb('0x41')][_0x89fb('0x42')]({'name':_0x3d0b7a[_0x89fb('0x43')],'message':_0x3d0b7a[_0x89fb('0x3f')],'row':_0x3718da});}function handleQuery(_0x4e0bc7){logger[_0x89fb('0x3d')](_0x4e0bc7);return db[_0x89fb('0x44')][_0x89fb('0x45')](_0x4e0bc7)[_0x89fb('0x46')](function(_0x47cf01){results[_0x89fb('0x42')](_0x47cf01);})[_0x89fb('0x47')](function(_0xb293c6){logger[_0x89fb('0x48')](_0xb293c6[_0x89fb('0x3f')]);});}function main(_0x344737,_0x17a087,_0x2a0cd0,_0x46714f){logger['info'](_0x89fb('0x49'),_0x344737,JSON[_0x89fb('0x4a')](_0x17a087));process[_0x89fb('0x4b')]('start');var _0x73d5b9=_0x17a087[_0x89fb('0x4c')];var _0x346cc0=_0x17a087['socket_timestamp'];var _0x456308=path[_0x89fb('0x11')](config[_0x89fb('0x4d')],'server/files/tmp',_0x346cc0+'.csv');var _0x2b0d89=_[_0x89fb('0x4e')](_0x73d5b9)[_0x89fb('0x11')]();logger[_0x89fb('0x3d')](_0x89fb('0x4f'),_0x2b0d89);fs[_0x89fb('0x50')](_0x456308,_0x2b0d89+'\x0a');Papa[_0x89fb('0x51')](fs[_0x89fb('0x52')](_0x344737),{'header':!![],'skipEmptyLines':!![],'step':function(_0x345972,_0x50f3c5){try{for(var _0xea120c=0x0,_0x43ae12=[];_0xea120c<_0x345972[_0x89fb('0x53')]['length'];_0xea120c++){stats['rows']+=0x1;if(_0x345972[_0x89fb('0x41')][_0xea120c]){handleError(_0x345972['data'][_0xea120c],_0x345972[_0x89fb('0x41')][_0xea120c]);}else{var _0x1519e4=[];for(var _0x7daebb in _0x73d5b9){if(_0x73d5b9[_0x89fb('0x54')](_0x7daebb)){if(_0x345972['data'][_0xea120c][_0x73d5b9[_0x7daebb]]){var _0x21df93=_[_0x89fb('0x55')](_0x345972[_0x89fb('0x53')][_0xea120c][_0x73d5b9[_0x7daebb]][_0x89fb('0x56')](/"/g,'\x27'));switch(_0x7daebb){case _0x89fb('0x20'):var _0x4da891=moment(_0x21df93,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4da891['isValid']()){_0x43ae12[_0x89fb('0x42')]('\x22'+_0x21df93+'\x22');}else{_0x1519e4['push'](_0x89fb('0x57'));}break;case _0x89fb('0x25'):var _0x754a4a=parseInt(_0x21df93);_0x21df93=_[_0x89fb('0x58')](_0x754a4a)||_0x754a4a<0x0||_0x754a4a>0x4?_0x46714f?0x3:0x2:_0x754a4a;_0x43ae12[_0x89fb('0x42')]('\x22'+_0x21df93+'\x22');break;case _0x89fb('0x26'):var _0x463597=parseInt(_0x21df93);if(_['isNumber'](_0x463597)&&_[_0x89fb('0x59')](_0x2a0cd0,_0x463597)){_0x43ae12[_0x89fb('0x42')]('\x22'+_0x463597+'\x22');}else{_0x1519e4['push'](_0x89fb('0x5a'));}break;case _0x89fb('0x5b'):if(isEmail(_0x21df93)){_0x43ae12[_0x89fb('0x42')]('\x22'+_0x21df93+'\x22');}else{_0x1519e4[_0x89fb('0x42')](_0x89fb('0x5c'));}break;case _0x89fb('0x5d'):var _0x5a3c9d=moment(_0x21df93,'YYYY-MM-DD',!![]);if(_0x5a3c9d[_0x89fb('0x5e')]()){_0x43ae12[_0x89fb('0x42')]('\x22'+_0x21df93+'\x22');}else{_0x1519e4[_0x89fb('0x42')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x43ae12[_0x89fb('0x42')]('\x22'+_0x21df93+'\x22');}}else{switch(_0x7daebb){case _0x89fb('0x5f'):case _0x89fb('0xf'):_0x1519e4[_0x89fb('0x42')](_0x7daebb+'\x20not\x20specified');break;default:_0x43ae12['push']('\x22\x22');}}}}if(_0x1519e4[_0x89fb('0x60')]){handleError(_0x345972[_0x89fb('0x53')][_0xea120c],{'code':_0x89fb('0x61'),'message':_0x1519e4[_0x89fb('0x11')]()});}else{fs[_0x89fb('0x62')](_0x456308,_0x43ae12[_0x89fb('0x11')]()+'\x0a');}_0x43ae12=[];}if(!(stats[_0x89fb('0x63')]%0xc8)){socket[_0x89fb('0x64')](_0x89fb('0x65')+_0x346cc0,stats);stats[_0x89fb('0x41')]=[];}}if(stopped){logger[_0x89fb('0x3d')](_0x89fb('0x66'));_0x50f3c5['abort']();}}catch(_0x3fcdc5){handleError(_0x345972['data'][_0xea120c],{'code':_0x89fb('0x67'),'message':_0x3fcdc5[_0x89fb('0x3f')]});logger['error'](_0x89fb('0x68'),_0x3fcdc5['message']);}},'complete':function(){try{var _0x50b83f=[];var _0xb1d0c5=_0x89fb('0x28');if(_0x17a087[_0x89fb('0x69')]&&_0x17a087[_0x89fb('0x69')]['length']){_0xb1d0c5='cm_contacts_'+_0x346cc0;_0x50b83f[_0x89fb('0x42')]('CREATE\x20TABLE\x20'+_0xb1d0c5+_0x89fb('0x6a'));}var _0x16aaa4=util[_0x89fb('0xd')](_0x89fb('0x6b'),_0x456308,_0xb1d0c5,_0x2b0d89,_0x17a087[_0x89fb('0x22')],_0x17a087['CompanyId']||null,NOW,NOW);if(_[_0x89fb('0x6c')](_0x73d5b9[_0x89fb('0x20')])){_0x16aaa4+=_0x89fb('0x6d');}_0x50b83f[_0x89fb('0x42')](_0x16aaa4);if(_0x17a087[_0x89fb('0x69')]&&_0x17a087[_0x89fb('0x69')]['length']){_0x50b83f[_0x89fb('0x42')](insertCmContact(_0x17a087[_0x89fb('0x22')],_0xb1d0c5,_0x17a087[_0x89fb('0x69')],_0x73d5b9));_0x50b83f['push'](_0x89fb('0x6e')+_0xb1d0c5+';');}_0x50b83f[_0x89fb('0x42')](insertCmHopper(_0x17a087[_0x89fb('0x22')],_0x89fb('0x6f'),_0x89fb('0x70'),_0x89fb('0x71'),_0x46714f));_0x50b83f[_0x89fb('0x42')](insertCmHopperBlack(_0x17a087[_0x89fb('0x22')],_0x89fb('0x72'),'voice_queues',_0x89fb('0x71')));_0x50b83f[_0x89fb('0x42')](insertCmHopper(_0x17a087[_0x89fb('0x22')],_0x89fb('0x73'),_0x89fb('0x74'),'CampaignId',_0x46714f));_0x50b83f['push'](insertCmHopperBlack(_0x17a087['ListId'],'campaigns_has_cm_blacklists',_0x89fb('0x74'),_0x89fb('0x75')));BPromise[_0x89fb('0x76')](_0x50b83f,handleQuery)[_0x89fb('0x77')](function(_0x1a8608){stats[_0x89fb('0x78')]=!![];stats[_0x89fb('0x79')]=_0x17a087[_0x89fb('0x69')]&&_0x17a087[_0x89fb('0x69')][_0x89fb('0x60')]?results[0x2][_0x89fb('0x79')]:results[0x0][_0x89fb('0x79')];socket[_0x89fb('0x64')](_0x89fb('0x65')+_0x346cc0,stats);fs[_0x89fb('0x7a')](_0x344737);fs[_0x89fb('0x7a')](_0x456308);process[_0x89fb('0x40')](0x0);})[_0x89fb('0x47')](function(_0x454eb4){logger[_0x89fb('0x48')](_0x454eb4[_0x89fb('0x3f')]);process['exit'](0x1);});}catch(_0x9704fe){logger[_0x89fb('0x48')]('complete',_0x9704fe[_0x89fb('0x3f')]);process[_0x89fb('0x40')](0x1);}},'error':function(_0x5c7a9f,_0x2945ce,_0x1fd77c,_0x1e8ec3){throw new Error(_0x1e8ec3);}});}function validate(){if(process[_0x89fb('0x7b')]&&process['argv'][_0x89fb('0x60')]<0x4){throw new Error(_0x89fb('0x7c'));}var _0x15f7b7=path[_0x89fb('0x11')](config['root'],_0x89fb('0x7d'),process['argv'][0x2]);if(!fs[_0x89fb('0x7e')](_0x15f7b7)){throw new Error(_0x89fb('0x7f'));}var _0x299bf3={};try{_0x299bf3=JSON[_0x89fb('0x51')](process[_0x89fb('0x7b')][0x3]);if(!_0x299bf3[_0x89fb('0x4c')]){throw new Error(_0x89fb('0x80'));}if(!_0x299bf3['binding']['phone']){throw new Error(_0x89fb('0x81'));}if(!_0x299bf3['binding'][_0x89fb('0x5f')]){throw new Error(_0x89fb('0x82'));}var _0x2fced3=0x0;if(_0x299bf3[_0x89fb('0x4c')][_0x89fb('0x26')]){_0x2fced3=0x1;}if(!_0x299bf3['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x498d42){throw new Error(_0x89fb('0x83'));}var _0x2dc6a0=[];try{_0x2dc6a0=_['map'](JSON['parse'](process[_0x89fb('0x7b')][0x4]),'id');}catch(_0x20dced){logger['info'](_0x89fb('0x84'));}main(_0x15f7b7,_0x299bf3,_0x2dc6a0,_0x2fced3);}validate();process['on'](_0x89fb('0x85'),handleStop);process['on'](_0x89fb('0x86'),handleUncaughtException); \ No newline at end of file +var _0x9e6f=['.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','insert','cm_hopper_black','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','errors','push','code','sequelize','spread','catch','stringify','send','start','binding','root','server/files/tmp','.csv','header','writeFileSync','length','data','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','CampaignId','campaigns','each','then','finish','affectedRows','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','path','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','defaults','redis','localhost','format','test','select','field','phone','from','.id\x20=\x20','where'];(function(_0x82c2eb,_0x421383){var _0x4b99ab=function(_0x2ec2c1){while(--_0x2ec2c1){_0x82c2eb['push'](_0x82c2eb['shift']());}};_0x4b99ab(++_0x421383);}(_0x9e6f,0x173));var _0xf9e6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9e6f[_0x3bf83f];return _0x22c4a9;};'use strict';var fs=require('fs');var path=require(_0xf9e6('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xf9e6('0x1'));var moment=require(_0xf9e6('0x2'));var squel=require(_0xf9e6('0x3'));var Redis=require(_0xf9e6('0x4'));var db=require(_0xf9e6('0x5'))['db'];var config=require(_0xf9e6('0x6'));var logger=require('../../../config/logger')(_0xf9e6('0x7'));config['redis']=_[_0xf9e6('0x8')](config[_0xf9e6('0x9')],{'host':_0xf9e6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9e6('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xf9e6('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x50f576){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))*$/[_0xf9e6('0xc')](_0x50f576);}function selectNotIn(_0x5e7fcd,_0x5c4e83,_0x14ea81,_0x5962e6,_0x46006c){return squel[_0xf9e6('0xd')]()[_0xf9e6('0xe')](_0xf9e6('0xf'))[_0xf9e6('0x10')](_0x5962e6)['join'](_0x5c4e83,null,_0x5c4e83+_0xf9e6('0x11')+_0x5962e6+'.'+_0x14ea81)[_0xf9e6('0x12')](_0x5962e6+'.'+_0x14ea81+'\x20=\x20'+_0x5e7fcd+'.'+_0x14ea81)[_0xf9e6('0x12')](_0x5c4e83+_0xf9e6('0x13')+_0x46006c[_0xf9e6('0x14')]()+')');}function insertCmHopper(_0x4096b0,_0x1cc020,_0x4d3f6b,_0x1fb1e0,_0x537ab4){var _0x230759=['cm_contacts.phone','cm_contacts.scheduledat',_0xf9e6('0x15'),_0xf9e6('0x16'),_0x1cc020+'.'+_0x1fb1e0,_0xf9e6('0x17'),_0xf9e6('0x18'),_0xf9e6('0x19'),_0xf9e6('0x1a'),'\x22'+_0x537ab4+'\x22'];return squel['insert']()[_0xf9e6('0x1b')]('cm_hopper')[_0xf9e6('0x1c')]([_0xf9e6('0xf'),_0xf9e6('0x1d'),_0xf9e6('0x1e'),_0xf9e6('0x1f'),_0x1fb1e0,_0xf9e6('0x20'),_0xf9e6('0x21'),'priority',_0xf9e6('0x22'),_0xf9e6('0x23')],squel[_0xf9e6('0xd')]()[_0xf9e6('0x24')](_0x230759)[_0xf9e6('0x10')](_0x1cc020)[_0xf9e6('0x14')](_0xf9e6('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x1cc020+_0xf9e6('0x26'))[_0xf9e6('0x14')](_0x4d3f6b,null,_0x4d3f6b+_0xf9e6('0x11')+_0x1cc020+'.'+_0x1fb1e0)[_0xf9e6('0x12')](_0x1cc020+_0xf9e6('0x27'),_0x4096b0)[_0xf9e6('0x12')](_0xf9e6('0x28'),NOW)[_0xf9e6('0x12')](_0xf9e6('0x29'),selectNotIn(_0x1cc020,_0x4d3f6b,_0x1fb1e0,_0xf9e6('0x2a'),[_0xf9e6('0x2b'),_0xf9e6('0x2c')]))[_0xf9e6('0x12')](_0xf9e6('0x29'),selectNotIn(_0x1cc020,_0x4d3f6b,_0x1fb1e0,_0xf9e6('0x2a'),[_0xf9e6('0x2b')])))[_0xf9e6('0x2d')]();}function insertCmHopperBlack(_0x1f4a01,_0x405c8b,_0x4fa69e,_0x2b192c){var _0xb07021=[_0xf9e6('0x2e'),_0xf9e6('0x15'),_0xf9e6('0x16'),_0x405c8b+'.'+_0x2b192c,_0xf9e6('0x17'),_0xf9e6('0x18')];return squel[_0xf9e6('0x2f')]()[_0xf9e6('0x1b')](_0xf9e6('0x30'))['fromQuery']([_0xf9e6('0xf'),_0xf9e6('0x1e'),_0xf9e6('0x1f'),_0x2b192c,_0xf9e6('0x20'),_0xf9e6('0x21')],squel[_0xf9e6('0xd')]()['fields'](_0xb07021)['from'](_0x405c8b)[_0xf9e6('0x14')](_0xf9e6('0x25'),null,_0xf9e6('0x31')+_0x405c8b+_0xf9e6('0x26'))[_0xf9e6('0x14')](_0x4fa69e,null,_0x4fa69e+_0xf9e6('0x11')+_0x405c8b+'.'+_0x2b192c)[_0xf9e6('0x12')](_0x405c8b+_0xf9e6('0x27'),_0x1f4a01)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf9e6('0x12')](_0xf9e6('0x29'),squel['select']()['field']('phone')['from'](_0xf9e6('0x30'))[_0xf9e6('0x12')](_0xf9e6('0x32'),_0x1f4a01)['where'](_0x2b192c+_0xf9e6('0x33'),_0x405c8b+'.'+_0x2b192c)))[_0xf9e6('0x2d')]();}function insertCmContact(_0x342788,_0x7d1a9e,_0x1546af,_0x531735){var _0x550213=_['concat'](_[_0xf9e6('0x34')](_0x531735),[_0xf9e6('0x1f'),_0xf9e6('0x35'),_0xf9e6('0x20'),_0xf9e6('0x21')]);return squel[_0xf9e6('0x2f')]()[_0xf9e6('0x1b')]('cm_contacts')[_0xf9e6('0x1c')](_0x550213,squel['select']()[_0xf9e6('0x24')](_0x550213)[_0xf9e6('0x10')](_0x7d1a9e)['where']('('+_0x1546af[_0xf9e6('0x14')](',')+_0xf9e6('0x36'),squel[_0xf9e6('0xd')]()['fields'](_0x1546af)[_0xf9e6('0x10')](_0xf9e6('0x25'))[_0xf9e6('0x12')](_0xf9e6('0x32'),_0x342788)[_0xf9e6('0x12')]('deletedAt\x20IS\x20NULL'))[_0xf9e6('0x12')](_0xf9e6('0x37'),squel[_0xf9e6('0xd')]()['field'](_0xf9e6('0x38'),_0xf9e6('0x39'))['from'](_0x7d1a9e)[_0xf9e6('0x3a')](_0x1546af[_0xf9e6('0x14')](','))))['toString']();}function handleStop(){logger[_0xf9e6('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1c142a){logger[_0xf9e6('0x3c')](_0x1c142a[_0xf9e6('0x3d')]);process[_0xf9e6('0x3e')](0x1);}function handleError(_0xfc9f43,_0x478442){stats[_0xf9e6('0x3f')][_0xf9e6('0x40')]({'name':_0x478442[_0xf9e6('0x41')],'message':_0x478442['message'],'row':_0xfc9f43});}function handleQuery(_0x1c2855){logger[_0xf9e6('0x3b')](_0x1c2855);return db[_0xf9e6('0x42')]['query'](_0x1c2855)[_0xf9e6('0x43')](function(_0x468988){results['push'](_0x468988);})[_0xf9e6('0x44')](function(_0x4df494){logger['error'](_0x4df494[_0xf9e6('0x3d')]);});}function main(_0x2e69a1,_0x5e5769,_0x4901cf,_0x54e594){logger[_0xf9e6('0x3b')]('main',_0x2e69a1,JSON[_0xf9e6('0x45')](_0x5e5769));process[_0xf9e6('0x46')](_0xf9e6('0x47'));var _0x3f034f=_0x5e5769[_0xf9e6('0x48')];var _0x4c90b5=_0x5e5769['socket_timestamp'];var _0x411775=path['join'](config[_0xf9e6('0x49')],_0xf9e6('0x4a'),_0x4c90b5+_0xf9e6('0x4b'));var _0x57d19c=_[_0xf9e6('0x34')](_0x3f034f)['join']();logger['info'](_0xf9e6('0x4c'),_0x57d19c);fs[_0xf9e6('0x4d')](_0x411775,_0x57d19c+'\x0a');Papa['parse'](fs['createReadStream'](_0x2e69a1),{'header':!![],'skipEmptyLines':!![],'step':function(_0x208980,_0x2ca448){try{for(var _0x2abb11=0x0,_0x5ea141=[];_0x2abb11<_0x208980['data'][_0xf9e6('0x4e')];_0x2abb11++){stats['rows']+=0x1;if(_0x208980[_0xf9e6('0x3f')][_0x2abb11]){handleError(_0x208980[_0xf9e6('0x4f')][_0x2abb11],_0x208980[_0xf9e6('0x3f')][_0x2abb11]);}else{var _0x3d1a97=[];for(var _0x569acf in _0x3f034f){if(_0x3f034f[_0xf9e6('0x50')](_0x569acf)){if(_0x208980[_0xf9e6('0x4f')][_0x2abb11][_0x3f034f[_0x569acf]]){var _0x1250ea=_['trim'](_0x208980['data'][_0x2abb11][_0x3f034f[_0x569acf]]['replace'](/"/g,'\x27'));switch(_0x569acf){case _0xf9e6('0x1d'):var _0x5b6cbf=moment(_0x1250ea,_0xf9e6('0x51'),!![]);if(_0x5b6cbf[_0xf9e6('0x52')]()){_0x5ea141['push']('\x22'+_0x1250ea+'\x22');}else{_0x3d1a97[_0xf9e6('0x40')](_0xf9e6('0x53'));}break;case _0xf9e6('0x54'):var _0x265dc7=parseInt(_0x1250ea);_0x1250ea=_[_0xf9e6('0x55')](_0x265dc7)||_0x265dc7<0x0||_0x265dc7>0x4?_0x54e594?0x3:0x2:_0x265dc7;_0x5ea141[_0xf9e6('0x40')]('\x22'+_0x1250ea+'\x22');break;case _0xf9e6('0x22'):var _0x23718e=parseInt(_0x1250ea);if(_[_0xf9e6('0x56')](_0x23718e)&&_[_0xf9e6('0x57')](_0x4901cf,_0x23718e)){_0x5ea141[_0xf9e6('0x40')]('\x22'+_0x23718e+'\x22');}else{_0x3d1a97[_0xf9e6('0x40')](_0xf9e6('0x58'));}break;case _0xf9e6('0x59'):if(isEmail(_0x1250ea)){_0x5ea141[_0xf9e6('0x40')]('\x22'+_0x1250ea+'\x22');}else{_0x3d1a97[_0xf9e6('0x40')]('email\x20wrong\x20format');}break;case _0xf9e6('0x5a'):var _0x398d60=moment(_0x1250ea,_0xf9e6('0x5b'),!![]);if(_0x398d60[_0xf9e6('0x52')]()){_0x5ea141[_0xf9e6('0x40')]('\x22'+_0x1250ea+'\x22');}else{_0x3d1a97[_0xf9e6('0x40')](_0xf9e6('0x5c'));}break;default:_0x5ea141[_0xf9e6('0x40')]('\x22'+_0x1250ea+'\x22');}}else{switch(_0x569acf){case _0xf9e6('0x5d'):case _0xf9e6('0xf'):_0x3d1a97['push'](_0x569acf+_0xf9e6('0x5e'));break;default:_0x5ea141[_0xf9e6('0x40')]('\x22\x22');}}}}if(_0x3d1a97[_0xf9e6('0x4e')]){handleError(_0x208980[_0xf9e6('0x4f')][_0x2abb11],{'code':_0xf9e6('0x5f'),'message':_0x3d1a97[_0xf9e6('0x14')]()});}else{fs[_0xf9e6('0x60')](_0x411775,_0x5ea141['join']()+'\x0a');}_0x5ea141=[];}if(!(stats[_0xf9e6('0x61')]%0xc8)){socket[_0xf9e6('0x62')](_0xf9e6('0x63')+_0x4c90b5,stats);stats[_0xf9e6('0x3f')]=[];}}if(stopped){logger['info'](_0xf9e6('0x64'));_0x2ca448[_0xf9e6('0x65')]();}}catch(_0x596971){handleError(_0x208980[_0xf9e6('0x4f')][_0x2abb11],{'code':_0xf9e6('0x66'),'message':_0x596971[_0xf9e6('0x3d')]});logger[_0xf9e6('0x3c')](_0xf9e6('0x67'),_0x596971['message']);}},'complete':function(){try{var _0x639ff2=[];var _0x348cda=_0xf9e6('0x25');if(_0x5e5769[_0xf9e6('0x68')]&&_0x5e5769['duplicates'][_0xf9e6('0x4e')]){_0x348cda='cm_contacts_'+_0x4c90b5;_0x639ff2['push']('CREATE\x20TABLE\x20'+_0x348cda+'\x20LIKE\x20cm_contacts;');}var _0x3b2c3e=util['format'](_0xf9e6('0x69'),_0x411775,_0x348cda,_0x57d19c,_0x5e5769[_0xf9e6('0x1f')],_0x5e5769[_0xf9e6('0x35')]||null,NOW,NOW);if(_[_0xf9e6('0x6a')](_0x3f034f['scheduledat'])){_0x3b2c3e+=',\x20scheduledAt\x20=\x20NOW()';}_0x639ff2[_0xf9e6('0x40')](_0x3b2c3e);if(_0x5e5769[_0xf9e6('0x68')]&&_0x5e5769['duplicates'][_0xf9e6('0x4e')]){_0x639ff2['push'](insertCmContact(_0x5e5769[_0xf9e6('0x1f')],_0x348cda,_0x5e5769[_0xf9e6('0x68')],_0x3f034f));_0x639ff2[_0xf9e6('0x40')](_0xf9e6('0x6b')+_0x348cda+';');}_0x639ff2[_0xf9e6('0x40')](insertCmHopper(_0x5e5769[_0xf9e6('0x1f')],_0xf9e6('0x6c'),'voice_queues',_0xf9e6('0x6d'),_0x54e594));_0x639ff2[_0xf9e6('0x40')](insertCmHopperBlack(_0x5e5769[_0xf9e6('0x1f')],_0xf9e6('0x6e'),_0xf9e6('0x6f'),'VoiceQueueId'));_0x639ff2[_0xf9e6('0x40')](insertCmHopper(_0x5e5769[_0xf9e6('0x1f')],_0xf9e6('0x70'),'campaigns',_0xf9e6('0x71'),_0x54e594));_0x639ff2[_0xf9e6('0x40')](insertCmHopperBlack(_0x5e5769[_0xf9e6('0x1f')],'campaigns_has_cm_blacklists',_0xf9e6('0x72'),_0xf9e6('0x71')));BPromise[_0xf9e6('0x73')](_0x639ff2,handleQuery)[_0xf9e6('0x74')](function(_0x472039){stats[_0xf9e6('0x75')]=!![];stats['affectedRows']=_0x5e5769[_0xf9e6('0x68')]&&_0x5e5769[_0xf9e6('0x68')][_0xf9e6('0x4e')]?results[0x2][_0xf9e6('0x76')]:results[0x0]['affectedRows'];socket[_0xf9e6('0x62')](_0xf9e6('0x63')+_0x4c90b5,stats);fs[_0xf9e6('0x77')](_0x2e69a1);fs[_0xf9e6('0x77')](_0x411775);process[_0xf9e6('0x3e')](0x0);})[_0xf9e6('0x44')](function(_0x434f71){logger[_0xf9e6('0x3c')](_0x434f71[_0xf9e6('0x3d')]);process['exit'](0x1);});}catch(_0x276107){logger['error']('complete',_0x276107[_0xf9e6('0x3d')]);process['exit'](0x1);}},'error':function(_0x53b0bb,_0x132d34,_0x4002d7,_0x2c38ba){throw new Error(_0x2c38ba);}});}function validate(){if(process[_0xf9e6('0x78')]&&process[_0xf9e6('0x78')][_0xf9e6('0x4e')]<0x4){throw new Error(_0xf9e6('0x79'));}var _0x3ed3a0=path[_0xf9e6('0x14')](config[_0xf9e6('0x49')],_0xf9e6('0x4a'),process[_0xf9e6('0x78')][0x2]);if(!fs['existsSync'](_0x3ed3a0)){throw new Error(_0xf9e6('0x7a'));}var _0x29f1aa={};try{_0x29f1aa=JSON[_0xf9e6('0x7b')](process[_0xf9e6('0x78')][0x3]);if(!_0x29f1aa[_0xf9e6('0x48')]){throw new Error(_0xf9e6('0x7c'));}if(!_0x29f1aa[_0xf9e6('0x48')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x29f1aa[_0xf9e6('0x48')][_0xf9e6('0x5d')]){throw new Error(_0xf9e6('0x7d'));}var _0x27096f=0x0;if(_0x29f1aa[_0xf9e6('0x48')][_0xf9e6('0x22')]){_0x27096f=0x1;}if(!_0x29f1aa[_0xf9e6('0x1f')]){throw new Error(_0xf9e6('0x7e'));}}catch(_0x280b91){throw new Error('body\x20id\x20mandatory');}var _0x448d38=[];try{_0x448d38=_[_0xf9e6('0x7f')](JSON['parse'](process[_0xf9e6('0x78')][0x4]),'id');}catch(_0x2c155f){logger[_0xf9e6('0x3b')]('No\x20agent\x20available');}main(_0x3ed3a0,_0x29f1aa,_0x448d38,_0x27096f);}validate();process['on'](_0xf9e6('0x80'),handleStop);process['on'](_0xf9e6('0x81'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 237b365..fb8f54a 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa478=['[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','destcalleridnum','Caller\x20Name','calleridname','keyValue','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Hold\x20Time','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','getSubjects','string'];(function(_0x53c4ee,_0x12c8d6){var _0x2698af=function(_0x3f6c19){while(--_0x3f6c19){_0x53c4ee['push'](_0x53c4ee['shift']());}};_0x2698af(++_0x12c8d6);}(_0xa478,0x136));var _0x8a47=function(_0x3f2228,_0x3b27d5){_0x3f2228=_0x3f2228-0x0;var _0x285ae4=_0xa478[_0x3f2228];return _0x285ae4;};'use strict';exports[_0x8a47('0x0')]=function(_0x687f9c,_0x46cf54){var _0x44be2c=[{'type':_0x8a47('0x1'),'content':_0x8a47('0x2'),'variableName':null}];switch(_0x687f9c[_0x8a47('0x3')]()){case _0x8a47('0x4'):switch(_0x46cf54[_0x8a47('0x3')]()){case _0x8a47('0x5'):_0x44be2c[_0x8a47('0x6')]({'type':_0x8a47('0x7'),'content':'','variableName':'queue'});_0x44be2c[_0x8a47('0x6')]({'type':_0x8a47('0x7'),'content':'','variableName':_0x8a47('0x8')});break;case _0x8a47('0x9'):_0x44be2c['push']({'type':_0x8a47('0x1'),'content':'Outbound\x20Call','variableName':null});_0x44be2c[_0x8a47('0x6')]({'type':_0x8a47('0x7'),'content':'','variableName':_0x8a47('0xa')});break;}}return _0x44be2c;};exports['getDescriptions']=function(_0xe65646,_0x230a11){var _0x493d7b=[];switch(_0xe65646[_0x8a47('0x3')]()){case'voice':switch(_0x230a11[_0x8a47('0x3')]()){case _0x8a47('0x5'):_0x493d7b=[{'type':_0x8a47('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0x8a47('0x7'),'variableName':_0x8a47('0x8')},{'type':'keyValue','content':'','key':_0x8a47('0xb'),'keyType':_0x8a47('0x7'),'variableName':_0x8a47('0xc')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0xe'),'keyType':_0x8a47('0x7'),'variableName':_0x8a47('0xf')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x10'),'keyType':_0x8a47('0x7'),'variableName':_0x8a47('0x11')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x12'),'keyType':'variable','variableName':_0x8a47('0x13')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x14'),'keyType':'variable','variableName':_0x8a47('0x15')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x16'),'keyType':_0x8a47('0x7'),'variableName':_0x8a47('0x17')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x18'),'keyType':_0x8a47('0x7'),'variableName':_0x8a47('0xa')},{'type':_0x8a47('0x1'),'content':_0x8a47('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8a47('0x1a'),'keyType':'variable','variableName':_0x8a47('0x15')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x1b'),'keyType':_0x8a47('0x7'),'variableName':'agentconnectAt'},{'type':_0x8a47('0xd'),'content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x8a47('0x1c'),'keyType':_0x8a47('0x7'),'variableName':'holdtime'},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x1d'),'keyType':_0x8a47('0x7'),'variableName':_0x8a47('0x1e')}];break;case _0x8a47('0x9'):_0x493d7b=[{'type':_0x8a47('0x1'),'content':_0x8a47('0x1f'),'variableName':null},{'type':'keyValue','content':'','key':_0x8a47('0x20'),'keyType':'variable','keyContent':'','variableName':_0x8a47('0xa')},{'type':_0x8a47('0xd'),'content':'','key':'Member\x20Name','keyType':_0x8a47('0x7'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0x8a47('0x12'),'keyType':_0x8a47('0x7'),'keyContent':'','variableName':_0x8a47('0x13')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x14'),'keyType':_0x8a47('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0x8a47('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x8a47('0x21'),'keyType':_0x8a47('0x7'),'keyContent':'','variableName':_0x8a47('0x22')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x23'),'keyType':_0x8a47('0x7'),'keyContent':'','variableName':_0x8a47('0x24')},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x25'),'keyType':_0x8a47('0x7'),'keyContent':'','variableName':'duration'},{'type':_0x8a47('0xd'),'content':'','key':_0x8a47('0x26'),'keyType':_0x8a47('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x493d7b;}; \ No newline at end of file +var _0x7708=['Caller\x20Number','keyValue','Caller\x20Name','calleridname','destexten','Queue','queue','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','duration','Billable\x20Time','billableseconds','getSubjects','toLowerCase','inbound','variable','push','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***'];(function(_0x88c64f,_0x1691ca){var _0x201755=function(_0x1ad9af){while(--_0x1ad9af){_0x88c64f['push'](_0x88c64f['shift']());}};_0x201755(++_0x1691ca);}(_0x7708,0x188));var _0x8770=function(_0x34bc94,_0x74f0fd){_0x34bc94=_0x34bc94-0x0;var _0xee41e7=_0x7708[_0x34bc94];return _0xee41e7;};'use strict';exports[_0x8770('0x0')]=function(_0x24909b,_0x5ce108){var _0x141ddf=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x24909b['toLowerCase']()){case'voice':switch(_0x5ce108[_0x8770('0x1')]()){case _0x8770('0x2'):_0x141ddf['push']({'type':_0x8770('0x3'),'content':'','variableName':'queue'});_0x141ddf[_0x8770('0x4')]({'type':_0x8770('0x3'),'content':'','variableName':_0x8770('0x5')});break;case _0x8770('0x6'):_0x141ddf[_0x8770('0x4')]({'type':_0x8770('0x7'),'content':_0x8770('0x8'),'variableName':null});_0x141ddf['push']({'type':_0x8770('0x3'),'content':'','variableName':_0x8770('0x9')});break;}}return _0x141ddf;};exports[_0x8770('0xa')]=function(_0x4e4551,_0x390af0){var _0x10e4a3=[];switch(_0x4e4551[_0x8770('0x1')]()){case _0x8770('0xb'):switch(_0x390af0['toLowerCase']()){case _0x8770('0x2'):_0x10e4a3=[{'type':_0x8770('0x7'),'content':_0x8770('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8770('0xd'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x5')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0xf'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x10')},{'type':_0x8770('0xe'),'content':'','key':'Call\x20To','keyType':_0x8770('0x3'),'variableName':_0x8770('0x11')},{'type':'keyValue','content':'','key':_0x8770('0x12'),'keyType':'variable','variableName':_0x8770('0x13')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','variableName':_0x8770('0x14')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x15'),'keyType':_0x8770('0x3'),'variableName':'agentcalledAt'},{'type':'string','content':_0x8770('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x17'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x18')},{'type':'keyValue','content':'','key':_0x8770('0x19'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x9')},{'type':_0x8770('0x7'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x8770('0x1a'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x1b')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x1c'),'keyType':_0x8770('0x3'),'variableName':'agentconnectAt'},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x1d'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x1e')},{'type':'keyValue','content':'','key':_0x8770('0x1f'),'keyType':'variable','variableName':_0x8770('0x20')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x21'),'keyType':_0x8770('0x3'),'variableName':_0x8770('0x22')}];break;case _0x8770('0x6'):_0x10e4a3=[{'type':_0x8770('0x7'),'content':_0x8770('0xc'),'variableName':null},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x23'),'keyType':'variable','keyContent':'','variableName':_0x8770('0x9')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x24'),'keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x25')},{'type':_0x8770('0xe'),'content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0x8770('0x14')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x15'),'keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x26')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x27'),'keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x28')},{'type':'keyValue','content':'','key':_0x8770('0x29'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x8770('0xe'),'content':'','key':'Duration','keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x2a')},{'type':_0x8770('0xe'),'content':'','key':_0x8770('0x2b'),'keyType':_0x8770('0x3'),'keyContent':'','variableName':_0x8770('0x2c')}];break;}}return _0x10e4a3;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index d4cd017..0d93f48 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c1=['then','update','info','tracked','user','query','clone','body','omit','html','phone','fax','mobile','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction'];(function(_0x2d3711,_0x43d60d){var _0x477858=function(_0x4ffb1c){while(--_0x4ffb1c){_0x2d3711['push'](_0x2d3711['shift']());}};_0x477858(++_0x43d60d);}(_0xf6c1,0x99));var _0x1f6c=function(_0x4130bf,_0x5edf8a){_0x4130bf=_0x4130bf-0x0;var _0x2d0ee8=_0xf6c1[_0x4130bf];return _0x2d0ee8;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x1f6c('0x0'))(_0x1f6c('0x1')),'mail':require(_0x1f6c('0x0'))('mail-interactions'),'fax':require(_0x1f6c('0x0'))('fax-interactions'),'sms':require(_0x1f6c('0x0'))(_0x1f6c('0x2')),'chat':require(_0x1f6c('0x0'))(_0x1f6c('0x3')),'whatsapp':require(_0x1f6c('0x0'))(_0x1f6c('0x4'))};function getInteractionId(_0x530b25,_0x3c7569,_0x1385de){if(_0x530b25&&_0x530b25[_[_0x1f6c('0x5')](_0x1385de)+_0x1f6c('0x6')]){return _0x530b25[_[_0x1f6c('0x5')](_0x1385de)+_0x1f6c('0x6')];}else if(_0x530b25&&_0x530b25['id']){return _0x530b25['id'];}else if(_0x3c7569&&_0x3c7569['id']){return _0x3c7569['id'];}else{return _0x1f6c('0x7');}}function log(_0x441a8a,_0x3c8805,_0x4ccc34,_0x4b4224,_0x4ac435,_0x28cb2d){loggers[_0x4ac435[_0x1f6c('0x8')]()][_0x441a8a](_0x1f6c('0x9'),_0x28cb2d[_0x1f6c('0xa')](),_0x3c8805?_0x3c8805['id']:null,_0x3c8805?_0x3c8805[_0x1f6c('0xb')]:null,_0x3c8805?_0x3c8805[_0x1f6c('0xc')]:null,getInteractionId(_0x4ccc34,_0x4b4224,_0x4ac435),_0x4ccc34?JSON['stringify'](_0x4ccc34):_0x1f6c('0xd'));}function updateUser(_0x1e7060,_0xafed6f,_0x3e461f,_0x103f5d,_0x1315b7){db[_[_0x1f6c('0x5')](_0x103f5d)+_0x1f6c('0xe')]['findOne']({'where':{'id':getInteractionId(_0xafed6f,_0x3e461f,_0x103f5d)}})[_0x1f6c('0xf')](function(_0x302026){if(_0x302026){return _0x302026[_0x1f6c('0x10')]({'UserId':_0x1e7060?_0x1e7060['id']:null});}})[_0x1f6c('0xf')](function(_0xc8b6f2){if(_0xc8b6f2){log(_0x1f6c('0x11'),_0x1e7060,_0xafed6f,_0x3e461f,_0x103f5d,_0x1315b7);}})['catch'](function(){log('error',_0x1e7060,_0xafed6f,_0x3e461f,_0x103f5d,_0x1315b7);});}exports[_0x1f6c('0x12')]=function(_0x30a8dc,_0x596996){return function(_0x2328f2,_0x580056,_0x31c887){var _0x2ae87e=_0x2328f2[_0x1f6c('0x13')];var _0x34c7ad={};var _0xd71b77=_0x2328f2[_0x1f6c('0x14')];if(_0x34c7ad){_0x34c7ad=_[_0x1f6c('0x15')](_0x2328f2[_0x1f6c('0x16')]);_0x34c7ad=_[_0x1f6c('0x17')](_0x34c7ad,[_0x1f6c('0x16'),_0x1f6c('0x18'),_0x1f6c('0x19'),_0x1f6c('0x1a'),_0x1f6c('0x1b')]);}updateUser(_0x2ae87e,_0x34c7ad,_0xd71b77,_0x30a8dc,_0x596996);_0x31c887(null);};}; \ No newline at end of file +var _0x3ffb=['lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','catch','error','tracked','user','clone','body','html','fax','mobile'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x3ffb,0x13f));var _0xb3ff=function(_0xb5de90,_0x5ca7c1){_0xb5de90=_0xb5de90-0x0;var _0x3beb39=_0x3ffb[_0xb5de90];return _0x3beb39;};'use strict';var _=require(_0xb3ff('0x0'));var db=require(_0xb3ff('0x1'))['db'];var loggers={'openchannel':require(_0xb3ff('0x2'))(_0xb3ff('0x3')),'mail':require(_0xb3ff('0x2'))('mail-interactions'),'fax':require(_0xb3ff('0x2'))(_0xb3ff('0x4')),'sms':require(_0xb3ff('0x2'))(_0xb3ff('0x5')),'chat':require(_0xb3ff('0x2'))(_0xb3ff('0x6')),'whatsapp':require(_0xb3ff('0x2'))('whatsapp-interactions')};function getInteractionId(_0x301d72,_0x99d772,_0x3a6e33){if(_0x301d72&&_0x301d72[_[_0xb3ff('0x7')](_0x3a6e33)+'InteractionId']){return _0x301d72[_['upperFirst'](_0x3a6e33)+_0xb3ff('0x8')];}else if(_0x301d72&&_0x301d72['id']){return _0x301d72['id'];}else if(_0x99d772&&_0x99d772['id']){return _0x99d772['id'];}else{return _0xb3ff('0x9');}}function log(_0x46c205,_0x59d890,_0x4ced35,_0x392502,_0x2a8696,_0x522efa){loggers[_0x2a8696[_0xb3ff('0xa')]()][_0x46c205](_0xb3ff('0xb'),_0x522efa[_0xb3ff('0xc')](),_0x59d890?_0x59d890['id']:null,_0x59d890?_0x59d890[_0xb3ff('0xd')]:null,_0x59d890?_0x59d890[_0xb3ff('0xe')]:null,getInteractionId(_0x4ced35,_0x392502,_0x2a8696),_0x4ced35?JSON[_0xb3ff('0xf')](_0x4ced35):_0xb3ff('0x10'));}function updateUser(_0x3e67f8,_0x57056a,_0x2f548b,_0x2f8f65,_0x2db25a){db[_[_0xb3ff('0x7')](_0x2f8f65)+_0xb3ff('0x11')][_0xb3ff('0x12')]({'where':{'id':getInteractionId(_0x57056a,_0x2f548b,_0x2f8f65)}})['then'](function(_0x16ade0){if(_0x16ade0){return _0x16ade0['update']({'UserId':_0x3e67f8?_0x3e67f8['id']:null});}})[_0xb3ff('0x13')](function(_0xc62f03){if(_0xc62f03){log('info',_0x3e67f8,_0x57056a,_0x2f548b,_0x2f8f65,_0x2db25a);}})[_0xb3ff('0x14')](function(){log(_0xb3ff('0x15'),_0x3e67f8,_0x57056a,_0x2f548b,_0x2f8f65,_0x2db25a);});}exports[_0xb3ff('0x16')]=function(_0x324260,_0x4d8ea6){return function(_0x8c5f6f,_0x3e85c7,_0x2fe7ca){var _0x5d908f=_0x8c5f6f[_0xb3ff('0x17')];var _0x502e40={};var _0x16f85c=_0x8c5f6f['query'];if(_0x502e40){_0x502e40=_[_0xb3ff('0x18')](_0x8c5f6f[_0xb3ff('0x19')]);_0x502e40=_['omit'](_0x502e40,[_0xb3ff('0x19'),_0xb3ff('0x1a'),'phone',_0xb3ff('0x1b'),_0xb3ff('0x1c')]);}updateUser(_0x5d908f,_0x502e40,_0x16f85c,_0x324260,_0x4d8ea6);_0x2fe7ca(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a52bbe1..aa4ffc2 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fcf=['use','License','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','hasOwnProperty'];(function(_0x318b5a,_0x3904ba){var _0x3588f2=function(_0x2ff01c){while(--_0x2ff01c){_0x318b5a['push'](_0x318b5a['shift']());}};_0x3588f2(++_0x3904ba);}(_0x5fcf,0x1e8));var _0xf5fc=function(_0x35a44a,_0x146e5d){_0x35a44a=_0x35a44a-0x0;var _0x3fe22c=_0x5fcf[_0x35a44a];return _0x3fe22c;};'use strict';var crypto=require(_0xf5fc('0x0'));var util=require(_0xf5fc('0x1'));var compose=require(_0xf5fc('0x2'));var db=require(_0xf5fc('0x3'))['db'];var config=require(_0xf5fc('0x4'));function getValueFromLicense(_0x4a5a60,_0x8c99cc){if(_0x4a5a60&&_0x8c99cc){if(_0x8c99cc[_0xf5fc('0x5')]&&_0x8c99cc[_0xf5fc('0x6')]){var _0x243c66=_0x8c99cc[_0xf5fc('0x5')];var _0x5dff08=_0x8c99cc[_0xf5fc('0x6')];var _0x1beccd=_0x243c66[_0xf5fc('0x7')]('-')[0x4];var _0x5eb053=_0x243c66['split']('-')[0x0];var _0x2608d9=crypto[_0xf5fc('0x8')](_0xf5fc('0x9'),util[_0xf5fc('0xa')](_0xf5fc('0xb'),_0x1beccd,_0x243c66,_0x5eb053));var _0x468bdd=_0x2608d9[_0xf5fc('0xc')](_0x5dff08,'base64',_0xf5fc('0xd'));_0x468bdd+=_0x2608d9[_0xf5fc('0xe')]('utf8');var _0x477e2f=JSON['parse'](_0x468bdd);return _0x477e2f[_0xf5fc('0xf')](_0x4a5a60)?_0x477e2f[_0x4a5a60]:null;}}return null;}function isLimit(_0x4333c6,_0x19c6d1,_0x13dbc9,_0x51aace){var _0x4b10cf=_0x19c6d1;return compose()[_0xf5fc('0x10')](function(_0x13c48a,_0x4a2ef1,_0x2e4e9e){return db[_0xf5fc('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xf5fc('0x12')](function(_0x192185){var _0xb13f0=getValueFromLicense(_0x4333c6,_0x192185);return _0xb13f0?_0xb13f0:_0x4b10cf;})[_0xf5fc('0x12')](function(_0x160a17){_0x4b10cf=_0x160a17;return _0x13dbc9[_0xf5fc('0x13')](_0x51aace);})[_0xf5fc('0x12')](function(_0x4a565c){if(_0x4a565c>=_0x4b10cf){return _0x4a2ef1['status'](0x193)[_0xf5fc('0x14')]({'message':util[_0xf5fc('0xa')](_0xf5fc('0x15'),_0x4333c6)});}_0x2e4e9e();})['catch'](function(_0x59d2ea){_0x2e4e9e(_0x59d2ea);});});}function isUserLimit(){return isLimit(_0xf5fc('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0xf5fc('0x17')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x51b6=['%s:%s:%s','base64','utf8','final','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format'];(function(_0x2ef7bc,_0x49bb0e){var _0x369e28=function(_0x17329c){while(--_0x17329c){_0x2ef7bc['push'](_0x2ef7bc['shift']());}};_0x369e28(++_0x49bb0e);}(_0x51b6,0x69));var _0x651b=function(_0x40d073,_0x15faf0){_0x40d073=_0x40d073-0x0;var _0x4285e8=_0x51b6[_0x40d073];return _0x4285e8;};'use strict';var crypto=require(_0x651b('0x0'));var util=require(_0x651b('0x1'));var compose=require(_0x651b('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x651b('0x3'));function getValueFromLicense(_0x22851d,_0x15668f){if(_0x22851d&&_0x15668f){if(_0x15668f[_0x651b('0x4')]&&_0x15668f[_0x651b('0x5')]){var _0x8801ac=_0x15668f['data1'];var _0x1ddb74=_0x15668f['license'];var _0x480d79=_0x8801ac[_0x651b('0x6')]('-')[0x4];var _0x26b9ea=_0x8801ac[_0x651b('0x6')]('-')[0x0];var _0x4c9d9a=crypto[_0x651b('0x7')](_0x651b('0x8'),util[_0x651b('0x9')](_0x651b('0xa'),_0x480d79,_0x8801ac,_0x26b9ea));var _0xa03a99=_0x4c9d9a['update'](_0x1ddb74,_0x651b('0xb'),_0x651b('0xc'));_0xa03a99+=_0x4c9d9a[_0x651b('0xd')](_0x651b('0xc'));var _0x2fc4e9=JSON['parse'](_0xa03a99);return _0x2fc4e9['hasOwnProperty'](_0x22851d)?_0x2fc4e9[_0x22851d]:null;}}return null;}function isLimit(_0x3b6bb1,_0x417e42,_0x44e088,_0x3383cd){var _0x1a0acf=_0x417e42;return compose()['use'](function(_0x38d036,_0xd5a653,_0x52a97a){return db[_0x651b('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x3cdc52){var _0x1d80d8=getValueFromLicense(_0x3b6bb1,_0x3cdc52);return _0x1d80d8?_0x1d80d8:_0x1a0acf;})[_0x651b('0xf')](function(_0x230f95){_0x1a0acf=_0x230f95;return _0x44e088[_0x651b('0x10')](_0x3383cd);})[_0x651b('0xf')](function(_0x12a656){if(_0x12a656>=_0x1a0acf){return _0xd5a653[_0x651b('0x11')](0x193)[_0x651b('0x12')]({'message':util[_0x651b('0x9')](_0x651b('0x13'),_0x3b6bb1)});}_0x52a97a();})[_0x651b('0x14')](function(_0x4d9edb){_0x52a97a(_0x4d9edb);});});}function isUserLimit(){return isLimit(_0x651b('0x15'),0x1,db[_0x651b('0x16')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 557ae27..d5913fc 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 _0xdc83=['$between','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$or]','split','length','slice','forEach','shift','indexOf','map','conditions','push','buildExpression','DATE','operator','value','includes','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','$notIn','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','$lte','<=\x20?'];(function(_0x535490,_0x53cb13){var _0x2fb0a2=function(_0x157381){while(--_0x157381){_0x535490['push'](_0x535490['shift']());}};_0x2fb0a2(++_0x53cb13);}(_0xdc83,0x7a));var _0x3dc8=function(_0x2a5fbb,_0x5d329d){_0x2a5fbb=_0x2a5fbb-0x0;var _0x281eaa=_0xdc83[_0x2a5fbb];return _0x281eaa;};'use strict';var _=require(_0x3dc8('0x0'));var moment=require(_0x3dc8('0x1'));exports[_0x3dc8('0x2')]=function(_0x34eb63){var _0x152c58={'conditions':[]};_0x152c58[_0x3dc8('0x3')]=_[_0x3dc8('0x4')](_0x34eb63,'[$or]')?'or':_0x3dc8('0x5');var _0x31701b=_0x34eb63[_0x3dc8('0x6')]('[$and]','')[_0x3dc8('0x6')](_0x3dc8('0x7'),'')[_0x3dc8('0x8')]('||');for(var _0x44ae46=0x0;_0x44ae46<_0x31701b[_0x3dc8('0x9')];_0x44ae46++){var _0x368ddb=_0x31701b[_0x44ae46]['split'](':=');var _0x403998=_0x368ddb[0x0];var _0x536030=_0x368ddb[_0x3dc8('0xa')](0x1);_0x536030[_0x3dc8('0xb')](function(_0x3cbebb){var _0x488330=_0x3cbebb[_0x3dc8('0x8')]('[')[_0x3dc8('0xc')]();var _0x38f33b=_0x3cbebb['match'](/\[(.*?)\]/g);_0x38f33b[_0x3dc8('0xb')](function(_0x21e39b){var _0x16d662=_0x21e39b['split']('[')['filter'](function(_0x40bb23){return _0x40bb23[_0x3dc8('0xd')](']')>-0x1;})[_0x3dc8('0xe')](function(_0x3badef){return _0x3badef[_0x3dc8('0x8')](']')[0x0];})[0x0];_0x152c58[_0x3dc8('0xf')][_0x3dc8('0x10')]({'field':_0x403998,'operator':_0x488330,'value':_0x16d662});});});}return _0x152c58;};exports[_0x3dc8('0x11')]=function(_0x1dcdbf,_0x5bfb7f,_0x4ae777){var _0x440831={};if(_0x5bfb7f===_0x3dc8('0x12')){if(_0x4ae777['operator']==='$eq'){_0x4ae777[_0x3dc8('0x13')]='$between';_0x4ae777[_0x3dc8('0x14')]+=','+_0x4ae777[_0x3dc8('0x14')];}else if(_[_0x3dc8('0x15')](['$gt','$lte'],_0x4ae777['operator'])){_0x4ae777[_0x3dc8('0x14')]=moment(_0x4ae777[_0x3dc8('0x14')])[_0x3dc8('0x16')](0x1,_0x3dc8('0x17'))[_0x3dc8('0x18')](_0x3dc8('0x19'));}}if(_0x4ae777['castTo']){_0x5bfb7f=_0x4ae777[_0x3dc8('0x1a')];_0x440831[_0x3dc8('0x1b')]=_0x3dc8('0x1c')+_0x1dcdbf+'.'+_0x4ae777[_0x3dc8('0x1d')]+_0x3dc8('0x1e')+_0x4ae777[_0x3dc8('0x1a')]+')\x20'+parseOperator(_0x4ae777['operator']);}else{_0x440831[_0x3dc8('0x1b')]=_0x1dcdbf+'.'+_0x4ae777[_0x3dc8('0x1d')]+'\x20'+parseOperator(_0x4ae777[_0x3dc8('0x13')]);}if(_['includes']([_0x3dc8('0x1f'),'$notIn'],_0x4ae777['operator']))_0x440831[_0x3dc8('0x1b')]='('+_0x440831['text']+_0x3dc8('0x20')+_0x1dcdbf+'.'+_0x4ae777['field']+_0x3dc8('0x21');_0x440831['value']=parseValue(_0x5bfb7f,_0x4ae777[_0x3dc8('0x13')],_0x4ae777[_0x3dc8('0x14')]);return _0x440831;};function parseOperator(_0x3ab65e){var _0xc85cc9;switch(_0x3ab65e){case _0x3dc8('0x22'):_0xc85cc9='IN\x20?';break;case _0x3dc8('0x23'):_0xc85cc9=_0x3dc8('0x24');break;case _0x3dc8('0x25'):_0xc85cc9=_0x3dc8('0x26');break;case _0x3dc8('0x1f'):_0xc85cc9=_0x3dc8('0x27');break;case _0x3dc8('0x28'):case _0x3dc8('0x29'):case _0x3dc8('0x2a'):_0xc85cc9=_0x3dc8('0x2b');break;case _0x3dc8('0x2c'):_0xc85cc9='<\x20?';break;case _0x3dc8('0x2d'):_0xc85cc9=_0x3dc8('0x2e');break;case _0x3dc8('0x2f'):_0xc85cc9=_0x3dc8('0x30');break;case'$gte':_0xc85cc9='>=\x20?';break;case _0x3dc8('0x31'):_0xc85cc9=_0x3dc8('0x32');break;}return _0xc85cc9;}function parseValue(_0x401c1f,_0x42b9ee,_0x305d0b){var _0x4f207a={'start':undefined,'end':undefined};switch(_0x42b9ee){case _0x3dc8('0x22'):case _0x3dc8('0x23'):_0x4f207a[_0x3dc8('0x33')]=_0x305d0b[_0x3dc8('0x8')](',');break;case _0x3dc8('0x28'):_0x4f207a[_0x3dc8('0x33')]='%'+_0x305d0b+'%';break;case'$startsWith':_0x4f207a[_0x3dc8('0x33')]=_0x305d0b+'%';break;case'$endsWith':_0x4f207a['start']='%'+_0x305d0b;break;case _0x3dc8('0x31'):var _0x2d6287=_0x305d0b[_0x3dc8('0x8')](',');var _0x305d0b=_0x2d6287['shift']();var _0x435595=_0x2d6287[_0x3dc8('0x34')]();if(_0x401c1f===_0x3dc8('0x12')){_0x305d0b=moment(_0x305d0b)['utcOffset'](0x0,!![])['format']();_0x435595=moment(_0x435595)[_0x3dc8('0x35')](0x0,!![])['add'](0x17,_0x3dc8('0x36'))['add'](0x3b,_0x3dc8('0x37'))[_0x3dc8('0x16')](0x3b,_0x3dc8('0x38'))['format']();}_0x4f207a={'start':_0x305d0b,'end':_0x435595};break;default:_0x4f207a[_0x3dc8('0x33')]=_0x305d0b;break;}return _0x4f207a;} \ No newline at end of file +var _0x8293=['value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','$substring','start','shift','pop','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','match','indexOf','map','push','buildExpression','$eq','operator'];(function(_0x4c9e58,_0x513c70){var _0x1daf9c=function(_0x4614dc){while(--_0x4614dc){_0x4c9e58['push'](_0x4c9e58['shift']());}};_0x1daf9c(++_0x513c70);}(_0x8293,0x19e));var _0x3829=function(_0x395522,_0x2b0a58){_0x395522=_0x395522-0x0;var _0x59ab99=_0x8293[_0x395522];return _0x59ab99;};'use strict';var _=require(_0x3829('0x0'));var moment=require(_0x3829('0x1'));exports['parseSearch']=function(_0x10e79c){var _0x43b017={'conditions':[]};_0x43b017[_0x3829('0x2')]=_[_0x3829('0x3')](_0x10e79c,_0x3829('0x4'))?'or':_0x3829('0x5');var _0x34d69e=_0x10e79c[_0x3829('0x6')]('[$and]','')['replace']('[$or]','')[_0x3829('0x7')]('||');for(var _0x3ed0d9=0x0;_0x3ed0d9<_0x34d69e[_0x3829('0x8')];_0x3ed0d9++){var _0x599fe7=_0x34d69e[_0x3ed0d9][_0x3829('0x7')](':=');var _0x4750e8=_0x599fe7[0x0];var _0x20607f=_0x599fe7[_0x3829('0x9')](0x1);_0x20607f[_0x3829('0xa')](function(_0x480f87){var _0x3c473a=_0x480f87['split']('[')['shift']();var _0x4bfc00=_0x480f87[_0x3829('0xb')](/\[(.*?)\]/g);_0x4bfc00[_0x3829('0xa')](function(_0x462dd0){var _0xbdce62=_0x462dd0[_0x3829('0x7')]('[')['filter'](function(_0x351d16){return _0x351d16[_0x3829('0xc')](']')>-0x1;})[_0x3829('0xd')](function(_0x3ab858){return _0x3ab858[_0x3829('0x7')](']')[0x0];})[0x0];_0x43b017['conditions'][_0x3829('0xe')]({'field':_0x4750e8,'operator':_0x3c473a,'value':_0xbdce62});});});}return _0x43b017;};exports[_0x3829('0xf')]=function(_0x5e42af,_0x2b06d5,_0x3c0a55){var _0x53a134={};if(_0x2b06d5==='DATE'){if(_0x3c0a55['operator']===_0x3829('0x10')){_0x3c0a55[_0x3829('0x11')]='$between';_0x3c0a55[_0x3829('0x12')]+=','+_0x3c0a55[_0x3829('0x12')];}else if(_['includes']([_0x3829('0x13'),_0x3829('0x14')],_0x3c0a55['operator'])){_0x3c0a55[_0x3829('0x12')]=moment(_0x3c0a55[_0x3829('0x12')])[_0x3829('0x15')](0x1,_0x3829('0x16'))[_0x3829('0x17')](_0x3829('0x18'));}}if(_0x3c0a55['castTo']){_0x2b06d5=_0x3c0a55[_0x3829('0x19')];_0x53a134[_0x3829('0x1a')]=_0x3829('0x1b')+_0x5e42af+'.'+_0x3c0a55[_0x3829('0x1c')]+'\x20AS\x20'+_0x3c0a55[_0x3829('0x19')]+')\x20'+parseOperator(_0x3c0a55[_0x3829('0x11')]);}else{_0x53a134[_0x3829('0x1a')]=_0x5e42af+'.'+_0x3c0a55[_0x3829('0x1c')]+'\x20'+parseOperator(_0x3c0a55[_0x3829('0x11')]);}if(_['includes'](['$ne','$notIn'],_0x3c0a55[_0x3829('0x11')]))_0x53a134[_0x3829('0x1a')]='('+_0x53a134[_0x3829('0x1a')]+_0x3829('0x1d')+_0x5e42af+'.'+_0x3c0a55[_0x3829('0x1c')]+'\x20IS\x20NULL)';_0x53a134[_0x3829('0x12')]=parseValue(_0x2b06d5,_0x3c0a55['operator'],_0x3c0a55[_0x3829('0x12')]);return _0x53a134;};function parseOperator(_0x25078c){var _0x2f337d;switch(_0x25078c){case _0x3829('0x1e'):_0x2f337d=_0x3829('0x1f');break;case _0x3829('0x20'):_0x2f337d=_0x3829('0x21');break;case _0x3829('0x10'):_0x2f337d=_0x3829('0x22');break;case _0x3829('0x23'):_0x2f337d='<>\x20?';break;case'$substring':case _0x3829('0x24'):case _0x3829('0x25'):_0x2f337d=_0x3829('0x26');break;case'$lt':_0x2f337d=_0x3829('0x27');break;case _0x3829('0x13'):_0x2f337d=_0x3829('0x28');break;case'$lte':_0x2f337d=_0x3829('0x29');break;case _0x3829('0x2a'):_0x2f337d=_0x3829('0x2b');break;case _0x3829('0x2c'):_0x2f337d=_0x3829('0x2d');break;}return _0x2f337d;}function parseValue(_0x417756,_0x1fffa1,_0x457444){var _0x46db0={'start':undefined,'end':undefined};switch(_0x1fffa1){case _0x3829('0x1e'):case _0x3829('0x20'):_0x46db0['start']=_0x457444[_0x3829('0x7')](',');break;case _0x3829('0x2e'):_0x46db0[_0x3829('0x2f')]='%'+_0x457444+'%';break;case _0x3829('0x24'):_0x46db0[_0x3829('0x2f')]=_0x457444+'%';break;case'$endsWith':_0x46db0[_0x3829('0x2f')]='%'+_0x457444;break;case _0x3829('0x2c'):var _0x257e51=_0x457444[_0x3829('0x7')](',');var _0x457444=_0x257e51[_0x3829('0x30')]();var _0x36fac2=_0x257e51[_0x3829('0x31')]();if(_0x417756==='DATE'){_0x457444=moment(_0x457444)[_0x3829('0x32')](0x0,!![])['format']();_0x36fac2=moment(_0x36fac2)[_0x3829('0x32')](0x0,!![])['add'](0x17,_0x3829('0x33'))[_0x3829('0x15')](0x3b,_0x3829('0x34'))[_0x3829('0x15')](0x3b,_0x3829('0x35'))[_0x3829('0x17')]();}_0x46db0={'start':_0x457444,'end':_0x36fac2};break;default:_0x46db0[_0x3829('0x2f')]=_0x457444;break;}return _0x46db0;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d46d6de..649338e 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 _0xfbb4=['length','isObject','isString','unset','hasOwnProperty','match','getFullTextValue','forEach','push','join','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','map','priority','cast','col','unsigned','substr','DESC','ASC','omit'];(function(_0x467dee,_0x6b22b0){var _0x4406c7=function(_0x39648e){while(--_0x39648e){_0x467dee['push'](_0x467dee['shift']());}};_0x4406c7(++_0x6b22b0);}(_0xfbb4,0x186));var _0x4fbb=function(_0x3f7c7f,_0xe84357){_0x3f7c7f=_0x3f7c7f-0x0;var _0x2f697b=_0xfbb4[_0x3f7c7f];return _0x2f697b;};'use strict';var _=require(_0x4fbb('0x0'));var sequelize=require(_0x4fbb('0x1'));var moment=require(_0x4fbb('0x2'));var LIMIT_VALUE=0xfa;exports[_0x4fbb('0x3')]=function(_0x1cd416){var _0x154265=null;if(_0x1cd416){_0x154265=_0x1cd416[_0x4fbb('0x4')](',');}return _0x154265;};exports[_0x4fbb('0x5')]=function(_0x5c67e4,_0x514d23){var _0x16c6f2={};if(!_[_0x4fbb('0x6')](_0x5c67e4)){_[_0x4fbb('0x7')](_0x5c67e4,function(_0x306f07,_0x5f0b6b){try{if(_0x514d23){var _0x53a552=_['find'](_0x514d23,{'name':_0x5f0b6b})||{};if(_0x53a552['type']===_0x4fbb('0x8')&&_[_0x4fbb('0x9')](_0x306f07)){var _0x5574b4=JSON[_0x4fbb('0xa')](_0x306f07);var _0xc3ed78={'$gte':moment(moment(_0x5574b4['$gte'])[_0x4fbb('0xb')](_0x4fbb('0xc')))[_0x4fbb('0xd')]()[_0x4fbb('0xb')](),'$lte':moment(moment(_0x5574b4[_0x4fbb('0xe')])['format'](_0x4fbb('0xc')))[_0x4fbb('0xd')]()[_0x4fbb('0xf')](0x1,'s')[_0x4fbb('0xb')]()};_0x16c6f2[_0x5f0b6b]=_0xc3ed78;}else{_0x16c6f2[_0x5f0b6b]=_[_0x4fbb('0x10')](_0x306f07)?_0x306f07:JSON['parse'](_0x306f07);}}else{_0x16c6f2[_0x5f0b6b]=_['isArray'](_0x306f07)?_0x306f07:JSON[_0x4fbb('0xa')](_0x306f07);}}catch(_0x8335b3){_0x16c6f2[_0x5f0b6b]=_0x306f07[_0x4fbb('0x4')](',');}});}return _0x16c6f2;};exports[_0x4fbb('0x11')]=function(_0x4c180c){_0x4c180c=parseInt(_0x4c180c,0xa);if(!_0x4c180c||_0x4c180c<0x0){_0x4c180c=LIMIT_VALUE;}return _0x4c180c;};exports[_0x4fbb('0x12')]=function(_0x571ae9){_0x571ae9=parseInt(_0x571ae9,0xa);if(!_0x571ae9||_0x571ae9<0x0){_0x571ae9=0x0;}return _0x571ae9;};exports['sort']=function(_0x20f622){var _0xa645e2,_0x4c47ff=null;if(_0x20f622){_0xa645e2=_0x20f622[_0x4fbb('0x4')](',');_0x4c47ff=_[_0x4fbb('0x13')](_0xa645e2,function(_0x5ca84d){if(_0x5ca84d['indexOf']('-')===0x0){return[_0x5ca84d===_0x4fbb('0x14')?sequelize[_0x4fbb('0x15')](sequelize[_0x4fbb('0x16')](_0x4fbb('0x14')),_0x4fbb('0x17')):_0x5ca84d[_0x4fbb('0x18')](0x1),_0x4fbb('0x19')];}else{return[_0x5ca84d===_0x4fbb('0x14')?sequelize[_0x4fbb('0x15')](sequelize[_0x4fbb('0x16')](_0x4fbb('0x14')),_0x4fbb('0x17')):_0x5ca84d,_0x4fbb('0x1a')];}});}return _0x4c47ff;};exports[_0x4fbb('0x1b')]=function(_0x1b2f36,_0x11e225){if(_[_0x4fbb('0x6')](_0x1b2f36)){return _0x1b2f36;}if(_[_0x4fbb('0x10')](_0x1b2f36)){for(var _0x1ef623=0x0;_0x1ef623<_0x1b2f36[_0x4fbb('0x1c')];_0x1ef623+=0x1){_0x1b2f36[_0x1ef623]=this[_0x4fbb('0x1b')](_0x1b2f36[_0x1ef623],_0x11e225);}return _0x1b2f36;}if(!_[_0x4fbb('0x1d')](_0x1b2f36)){return _0x1b2f36;}if(_[_0x4fbb('0x1e')](_0x11e225)){_0x11e225=[_0x11e225];}if(!_[_0x4fbb('0x10')](_0x11e225)){return _0x1b2f36;}for(var _0x5e6947=0x0;_0x5e6947<_0x11e225['length'];_0x5e6947+=0x1){_[_0x4fbb('0x1f')](_0x1b2f36,_0x11e225[_0x5e6947]);}for(var _0x3d1a01 in _0x1b2f36){if(_0x1b2f36[_0x4fbb('0x20')](_0x3d1a01)){_0x1b2f36[_0x3d1a01]=this[_0x4fbb('0x1b')](_0x1b2f36[_0x3d1a01],_0x11e225);}}return _0x1b2f36;};exports['isNumeric']=function(_0x3843fb){return _0x3843fb[_0x4fbb('0x21')](RegExp('^[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x539b45){return _0x539b45[_0x4fbb('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x4fbb('0x22')]=function(_0x26fc01){var _0x40b607=[];_0x26fc01['split']('\x20')[_0x4fbb('0x23')](function(_0x288cf4){_0x40b607[_0x4fbb('0x24')]('+'+_0x288cf4['toString']()+'*');});return _0x40b607[_0x4fbb('0x25')]('\x20');}; \ No newline at end of file +var _0xb2d4=['omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','split','forEach','push','toString','join','lodash','sequelize','moment','fields','filters','isEmpty','forOwn','type','DATE','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','sort','map','indexOf','priority','cast','col','substr','DESC','ASC'];(function(_0x248157,_0x347f1f){var _0x3a99ab=function(_0x5c45ba){while(--_0x5c45ba){_0x248157['push'](_0x248157['shift']());}};_0x3a99ab(++_0x347f1f);}(_0xb2d4,0x1a8));var _0x4b2d=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xb2d4[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x4b2d('0x0'));var sequelize=require(_0x4b2d('0x1'));var moment=require(_0x4b2d('0x2'));var LIMIT_VALUE=0xfa;exports[_0x4b2d('0x3')]=function(_0x9d23ee){var _0x4476bb=null;if(_0x9d23ee){_0x4476bb=_0x9d23ee['split'](',');}return _0x4476bb;};exports[_0x4b2d('0x4')]=function(_0x27e4ed,_0x5bef3f){var _0x37bcef={};if(!_[_0x4b2d('0x5')](_0x27e4ed)){_[_0x4b2d('0x6')](_0x27e4ed,function(_0x1e8195,_0x3e5059){try{if(_0x5bef3f){var _0x12b7a9=_['find'](_0x5bef3f,{'name':_0x3e5059})||{};if(_0x12b7a9[_0x4b2d('0x7')]===_0x4b2d('0x8')&&_['isPlainObject'](_0x1e8195)){var _0x5ec361=JSON[_0x4b2d('0x9')](_0x1e8195);var _0x516088={'$gte':moment(moment(_0x5ec361[_0x4b2d('0xa')])[_0x4b2d('0xb')](_0x4b2d('0xc')))[_0x4b2d('0xd')]()['format'](),'$lte':moment(moment(_0x5ec361[_0x4b2d('0xe')])['format'](_0x4b2d('0xc')))['utc']()[_0x4b2d('0xf')](0x1,'s')['format']()};_0x37bcef[_0x3e5059]=_0x516088;}else{_0x37bcef[_0x3e5059]=_[_0x4b2d('0x10')](_0x1e8195)?_0x1e8195:JSON[_0x4b2d('0x9')](_0x1e8195);}}else{_0x37bcef[_0x3e5059]=_[_0x4b2d('0x10')](_0x1e8195)?_0x1e8195:JSON[_0x4b2d('0x9')](_0x1e8195);}}catch(_0x3bbf5f){_0x37bcef[_0x3e5059]=_0x1e8195['split'](',');}});}return _0x37bcef;};exports[_0x4b2d('0x11')]=function(_0x54b9d2){_0x54b9d2=parseInt(_0x54b9d2,0xa);if(!_0x54b9d2||_0x54b9d2<0x0){_0x54b9d2=LIMIT_VALUE;}return _0x54b9d2;};exports['offset']=function(_0x4f2679){_0x4f2679=parseInt(_0x4f2679,0xa);if(!_0x4f2679||_0x4f2679<0x0){_0x4f2679=0x0;}return _0x4f2679;};exports[_0x4b2d('0x12')]=function(_0x33d7c7){var _0xfc74c3,_0x168f6b=null;if(_0x33d7c7){_0xfc74c3=_0x33d7c7['split'](',');_0x168f6b=_[_0x4b2d('0x13')](_0xfc74c3,function(_0x194543){if(_0x194543[_0x4b2d('0x14')]('-')===0x0){return[_0x194543===_0x4b2d('0x15')?sequelize[_0x4b2d('0x16')](sequelize[_0x4b2d('0x17')]('priority'),'unsigned'):_0x194543[_0x4b2d('0x18')](0x1),_0x4b2d('0x19')];}else{return[_0x194543===_0x4b2d('0x15')?sequelize['cast'](sequelize['col'](_0x4b2d('0x15')),'unsigned'):_0x194543,_0x4b2d('0x1a')];}});}return _0x168f6b;};exports[_0x4b2d('0x1b')]=function(_0x598f3c,_0x4b681b){if(_[_0x4b2d('0x5')](_0x598f3c)){return _0x598f3c;}if(_[_0x4b2d('0x10')](_0x598f3c)){for(var _0x53d60e=0x0;_0x53d60e<_0x598f3c['length'];_0x53d60e+=0x1){_0x598f3c[_0x53d60e]=this[_0x4b2d('0x1b')](_0x598f3c[_0x53d60e],_0x4b681b);}return _0x598f3c;}if(!_[_0x4b2d('0x1c')](_0x598f3c)){return _0x598f3c;}if(_[_0x4b2d('0x1d')](_0x4b681b)){_0x4b681b=[_0x4b681b];}if(!_[_0x4b2d('0x10')](_0x4b681b)){return _0x598f3c;}for(var _0x5c7a31=0x0;_0x5c7a31<_0x4b681b[_0x4b2d('0x1e')];_0x5c7a31+=0x1){_[_0x4b2d('0x1f')](_0x598f3c,_0x4b681b[_0x5c7a31]);}for(var _0x255028 in _0x598f3c){if(_0x598f3c[_0x4b2d('0x20')](_0x255028)){_0x598f3c[_0x255028]=this[_0x4b2d('0x1b')](_0x598f3c[_0x255028],_0x4b681b);}}return _0x598f3c;};exports[_0x4b2d('0x21')]=function(_0x1a0ab3){return _0x1a0ab3[_0x4b2d('0x22')](RegExp(_0x4b2d('0x23')))?!![]:![];};exports['isEmail']=function(_0x318b06){return _0x318b06['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0xc3383c){var _0x5c63d8=[];_0xc3383c[_0x4b2d('0x24')]('\x20')[_0x4b2d('0x25')](function(_0x1444da){_0x5c63d8[_0x4b2d('0x26')]('+'+_0x1444da[_0x4b2d('0x27')]()+'*');});return _0x5c63d8[_0x4b2d('0x28')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 4395c09..c83a74c 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5c4=['./environment','../mysqldb','get','env','production','set','join','public','development','test','appPath','root','client','use','json\x20replacer','split','static','views','engine','html','renderFile','urlencoded','50mb','json','express','serve-favicon','method-override','cookie-parser','errorhandler','path','passport','cors','moment'];(function(_0x42b71e,_0x737ab3){var _0xaab349=function(_0x345d2b){while(--_0x345d2b){_0x42b71e['push'](_0x42b71e['shift']());}};_0xaab349(++_0x737ab3);}(_0xd5c4,0x141));var _0x4d5c=function(_0x406bdb,_0x464f4e){_0x406bdb=_0x406bdb-0x0;var _0x154114=_0xd5c4[_0x406bdb];return _0x154114;};'use strict';var express=require(_0x4d5c('0x0'));var favicon=require(_0x4d5c('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x4d5c('0x2'));var cookieParser=require(_0x4d5c('0x3'));var errorHandler=require(_0x4d5c('0x4'));var path=require(_0x4d5c('0x5'));var passport=require(_0x4d5c('0x6'));var cors=require(_0x4d5c('0x7'));var moment=require(_0x4d5c('0x8'));var config=require(_0x4d5c('0x9'));var db=require(_0x4d5c('0xa'))['db'];exports['default']=function(_0x2a05d4){var _0x54d69a=_0x2a05d4[_0x4d5c('0xb')](_0x4d5c('0xc'));if(_0x54d69a===_0x4d5c('0xd')){_0x2a05d4[_0x4d5c('0xe')]('appPath',path[_0x4d5c('0xf')](config['root'],_0x4d5c('0x10')));}if(_0x54d69a===_0x4d5c('0x11')||_0x54d69a===_0x4d5c('0x12')){_0x2a05d4[_0x4d5c('0xe')](_0x4d5c('0x13'),path[_0x4d5c('0xf')](config[_0x4d5c('0x14')],_0x4d5c('0x15')));_0x2a05d4[_0x4d5c('0x16')](errorHandler());}_0x2a05d4[_0x4d5c('0xe')](_0x4d5c('0x17'),function(_0x4386b1,_0x362fbe){if(this[_0x4386b1]instanceof Date){_0x362fbe=this[_0x4386b1]['toISOString']()[_0x4d5c('0x18')]('.')[0x0]+'Z';}return _0x362fbe;});_0x2a05d4['use'](express[_0x4d5c('0x19')](_0x2a05d4[_0x4d5c('0xb')]('appPath')));_0x2a05d4['set'](_0x4d5c('0x1a'),config[_0x4d5c('0x14')]+'/server/views');_0x2a05d4[_0x4d5c('0x1b')](_0x4d5c('0x1c'),require('ejs')[_0x4d5c('0x1d')]);_0x2a05d4['set']('view\x20engine','html');_0x2a05d4[_0x4d5c('0x16')](bodyParser[_0x4d5c('0x1e')]({'limit':_0x4d5c('0x1f'),'extended':!![]}));_0x2a05d4[_0x4d5c('0x16')](bodyParser[_0x4d5c('0x20')]({'limit':_0x4d5c('0x1f')}));_0x2a05d4[_0x4d5c('0x16')](cors());_0x2a05d4['use'](methodOverride());_0x2a05d4[_0x4d5c('0x16')](cookieParser());_0x2a05d4[_0x4d5c('0x16')](passport['initialize']());}; \ No newline at end of file +var _0xcad3=['use','split','static','get','views','/server/views','engine','html','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','path','passport','cors','moment','../mysqldb','default','production','appPath','root','public','development','test','set','join','client'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcad3,0x91));var _0x3cad=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0xcad3[_0x34ad72];return _0x5c9aa8;};'use strict';var express=require(_0x3cad('0x0'));var favicon=require(_0x3cad('0x1'));var bodyParser=require(_0x3cad('0x2'));var methodOverride=require(_0x3cad('0x3'));var cookieParser=require(_0x3cad('0x4'));var errorHandler=require('errorhandler');var path=require(_0x3cad('0x5'));var passport=require(_0x3cad('0x6'));var cors=require(_0x3cad('0x7'));var moment=require(_0x3cad('0x8'));var config=require('./environment');var db=require(_0x3cad('0x9'))['db'];exports[_0x3cad('0xa')]=function(_0x383026){var _0x3f98e0=_0x383026['get']('env');if(_0x3f98e0===_0x3cad('0xb')){_0x383026['set'](_0x3cad('0xc'),path['join'](config[_0x3cad('0xd')],_0x3cad('0xe')));}if(_0x3f98e0===_0x3cad('0xf')||_0x3f98e0===_0x3cad('0x10')){_0x383026[_0x3cad('0x11')](_0x3cad('0xc'),path[_0x3cad('0x12')](config[_0x3cad('0xd')],_0x3cad('0x13')));_0x383026[_0x3cad('0x14')](errorHandler());}_0x383026['set']('json\x20replacer',function(_0xd2081d,_0x5e403a){if(this[_0xd2081d]instanceof Date){_0x5e403a=this[_0xd2081d]['toISOString']()[_0x3cad('0x15')]('.')[0x0]+'Z';}return _0x5e403a;});_0x383026[_0x3cad('0x14')](express[_0x3cad('0x16')](_0x383026[_0x3cad('0x17')](_0x3cad('0xc'))));_0x383026['set'](_0x3cad('0x18'),config[_0x3cad('0xd')]+_0x3cad('0x19'));_0x383026[_0x3cad('0x1a')](_0x3cad('0x1b'),require('ejs')['renderFile']);_0x383026['set'](_0x3cad('0x1c'),_0x3cad('0x1b'));_0x383026['use'](bodyParser[_0x3cad('0x1d')]({'limit':_0x3cad('0x1e'),'extended':!![]}));_0x383026['use'](bodyParser[_0x3cad('0x1f')]({'limit':_0x3cad('0x1e')}));_0x383026[_0x3cad('0x14')](cors());_0x383026['use'](methodOverride());_0x383026['use'](cookieParser());_0x383026[_0x3cad('0x14')](passport[_0x3cad('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index f20972d..3076c25 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 _0x6753=['orderBy','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','getUuid','platform','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process'];(function(_0x3cd3e4,_0x1fabb8){var _0x12d75c=function(_0x556446){while(--_0x556446){_0x3cd3e4['push'](_0x3cd3e4['shift']());}};_0x12d75c(++_0x1fabb8);}(_0x6753,0xa1));var _0x3675=function(_0x48f84f,_0x322195){_0x48f84f=_0x48f84f-0x0;var _0x6c8cb2=_0x6753[_0x48f84f];return _0x6c8cb2;};'use strict';var _=require(_0x3675('0x0'));var os=require('os');var crypto=require(_0x3675('0x1'));var machine=require(_0x3675('0x2'));var exec=require(_0x3675('0x3'))['execSync'];function getInterfaces(){var _0x2efb4b=[];var _0x461046=os['networkInterfaces']();var _0x2c892a=_[_0x3675('0x4')](_['keys'](_0x461046));for(var _0x5aa21f=0x0;_0x5aa21f<_0x2c892a['length'];_0x5aa21f++){var _0x396a35=_0x461046[_0x2c892a[_0x5aa21f]][_0x3675('0x5')](function(_0x907bda){return _0x907bda[_0x3675('0x6')]===_0x3675('0x7')&&_0x907bda[_0x3675('0x8')]===![];});_0x2efb4b=_0x2efb4b[_0x3675('0x9')](_0x396a35);}return _0x2efb4b;}function getFirstInterface(){var _0x45c8e5=_[_0x3675('0xa')](getInterfaces());return{'macAddress':_0x45c8e5&&_0x45c8e5[_0x3675('0xb')]?_0x45c8e5[_0x3675('0xb')]:_0x3675('0xc'),'ipAddress':_0x45c8e5&&_0x45c8e5[_0x3675('0xd')]?_0x45c8e5[_0x3675('0xd')]:'127.0.0.1'};}exports[_0x3675('0xe')]=getFirstInterface;function getCPUhash(){var _0x173473=_['orderBy'](os[_0x3675('0xf')]()[_0x3675('0x10')](function(_0x3eace2){return _0x3eace2[_0x3675('0x11')];}))[_0x3675('0x12')](':');return crypto[_0x3675('0x13')](_0x3675('0x14'))['update'](_0x173473)[_0x3675('0x15')](_0x3675('0x16'));}exports[_0x3675('0x17')]=function(){switch(os[_0x3675('0x18')]()){case'win32':return exec(_0x3675('0x19'),{'encoding':_0x3675('0x1a')})[_0x3675('0x1b')]('\x0d\x0a','');default:var _0x27e5bb=getFirstInterface();var _0x510233=getCPUhash();var _0x3bf7c5=_0x510233+'|'+os[_0x3675('0x1c')]()+'|'+_0x27e5bb[_0x3675('0x1d')]+'|'+_0x27e5bb[_0x3675('0x1e')];var _0x2adb30=crypto['createHash'](_0x3675('0x14'))[_0x3675('0x1f')](_0x3bf7c5)['digest'](_0x3675('0x16'));return _0x2adb30['substring'](0x0,0x8)+'-'+_0x2adb30[_0x3675('0x20')](0x8,0xc)+'-'+_0x2adb30[_0x3675('0x20')](0xc,0x10)+'-'+_0x2adb30['substring'](0x10,0x14)+'-'+_0x2adb30['substring'](0x14);}}; \ No newline at end of file +var _0xed1f=['hostname','macAddress','digest','substring','lodash','crypto','execSync','orderBy','keys','length','filter','family','IPv4','concat','head','mac','address','127.0.0.1','cpus','join','createHash','md5','update','hex','getUuid','dmidecode\x20--string\x20system-uuid','utf8','replace'];(function(_0x59e030,_0x5179aa){var _0x59898e=function(_0x20dbe5){while(--_0x20dbe5){_0x59e030['push'](_0x59e030['shift']());}};_0x59898e(++_0x5179aa);}(_0xed1f,0x170));var _0xfed1=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xed1f[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0xfed1('0x0'));var os=require('os');var crypto=require(_0xfed1('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xfed1('0x2')];function getInterfaces(){var _0x5c56c8=[];var _0x36764e=os['networkInterfaces']();var _0x444ba8=_[_0xfed1('0x3')](_[_0xfed1('0x4')](_0x36764e));for(var _0x183daa=0x0;_0x183daa<_0x444ba8[_0xfed1('0x5')];_0x183daa++){var _0x1f2391=_0x36764e[_0x444ba8[_0x183daa]][_0xfed1('0x6')](function(_0x396781){return _0x396781[_0xfed1('0x7')]===_0xfed1('0x8')&&_0x396781['internal']===![];});_0x5c56c8=_0x5c56c8[_0xfed1('0x9')](_0x1f2391);}return _0x5c56c8;}function getFirstInterface(){var _0x38d525=_[_0xfed1('0xa')](getInterfaces());return{'macAddress':_0x38d525&&_0x38d525['mac']?_0x38d525[_0xfed1('0xb')]:'00:00:00:00:00:00','ipAddress':_0x38d525&&_0x38d525['address']?_0x38d525[_0xfed1('0xc')]:_0xfed1('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x58d008=_[_0xfed1('0x3')](os[_0xfed1('0xe')]()['map'](function(_0x56555a){return _0x56555a['model'];}))[_0xfed1('0xf')](':');return crypto[_0xfed1('0x10')](_0xfed1('0x11'))[_0xfed1('0x12')](_0x58d008)['digest'](_0xfed1('0x13'));}exports[_0xfed1('0x14')]=function(){switch(os['platform']()){case'win32':return exec(_0xfed1('0x15'),{'encoding':_0xfed1('0x16')})[_0xfed1('0x17')]('\x0d\x0a','');default:var _0x5ed220=getFirstInterface();var _0x223f42=getCPUhash();var _0x2218d5=_0x223f42+'|'+os[_0xfed1('0x18')]()+'|'+_0x5ed220[_0xfed1('0x19')]+'|'+_0x5ed220['ipAddress'];var _0x31ff97=crypto['createHash'](_0xfed1('0x11'))[_0xfed1('0x12')](_0x2218d5)[_0xfed1('0x1a')](_0xfed1('0x13'));return _0x31ff97[_0xfed1('0x1b')](0x0,0x8)+'-'+_0x31ff97[_0xfed1('0x1b')](0x8,0xc)+'-'+_0x31ff97[_0xfed1('0x1b')](0xc,0x10)+'-'+_0x31ff97[_0xfed1('0x1b')](0x10,0x14)+'-'+_0x31ff97[_0xfed1('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0ab9a19..60ba46e 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 _0xaf5a=['|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','get','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','info','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','crypto','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','then','catch','createCipher','secrets','update','utf8','base64','createDecipher','aes-256-ctr','session','final','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email'];(function(_0x17d82f,_0x5d9172){var _0x58137b=function(_0x40e198){while(--_0x40e198){_0x17d82f['push'](_0x17d82f['shift']());}};_0x58137b(++_0x5d9172);}(_0xaf5a,0x116));var _0xaaf5=function(_0x7cce8d,_0x8d7c9c){_0x7cce8d=_0x7cce8d-0x0;var _0x381b50=_0xaf5a[_0x7cce8d];return _0x381b50;};'use strict';var util=require('util');var crypto=require(_0xaaf5('0x0'));var moment=require(_0xaaf5('0x1'));var rp=require(_0xaaf5('0x2'));var BPromise=require(_0xaaf5('0x3'));var pkginfo=require(_0xaaf5('0x4'))(module,_0xaaf5('0x5'));var db=require(_0xaaf5('0x6'))['db'];var config=require(_0xaaf5('0x7'));var hardware=require('./hardware');var logger=require(_0xaaf5('0x8'))(_0xaaf5('0x9'));var jira=require(_0xaaf5('0xa'));var HOST=_0xaaf5('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5890d2){return new BPromise(function(_0x57e7f9,_0x34a86f){var _0x2243cb=util[_0xaaf5('0xc')](_0xaaf5('0xd'),HOST,_0x5890d2,module[_0xaaf5('0xe')]['version']);if(oldToken){_0x2243cb=util[_0xaaf5('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x5890d2,module['exports'][_0xaaf5('0x5')],oldToken);}var _0x46e850={'uri':_0x2243cb,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x46e850)[_0xaaf5('0xf')](function(_0x3ce357){_0x57e7f9(_0x3ce357);})[_0xaaf5('0x10')](function(_0x2cdc4b){_0x34a86f(_0x2cdc4b);});});}function encryptDate(_0x5a35bc){var _0x459334=crypto[_0xaaf5('0x11')]('aes-256-ctr',config[_0xaaf5('0x12')]['session']);var _0x3fd634=_0x459334[_0xaaf5('0x13')](_0x5a35bc,_0xaaf5('0x14'),_0xaaf5('0x15'));_0x3fd634+=_0x459334['final'](_0xaaf5('0x15'));return _0x3fd634;}function decryptDate(_0x3079c3){var _0x2e8482=crypto[_0xaaf5('0x16')](_0xaaf5('0x17'),config[_0xaaf5('0x12')][_0xaaf5('0x18')]);var _0x4b1693=_0x2e8482[_0xaaf5('0x13')](_0x3079c3,_0xaaf5('0x15'),_0xaaf5('0x14'));_0x4b1693+=_0x2e8482[_0xaaf5('0x19')](_0xaaf5('0x14'));return _0x4b1693;}function sendJiraAlert(_0x403bb2,_0x3e8576,_0x537efe){var _0x482c45=_0xaaf5('0x1a');return db[_0xaaf5('0x1b')][_0xaaf5('0x1c')]({'where':{'role':_0xaaf5('0x1d')},'attributes':[_0xaaf5('0x1e'),_0xaaf5('0x1f')],'raw':!![]})['then'](function(_0x50abce){ADMIN=_0x50abce;_0x482c45+=_0xaaf5('0x20')+_0x537efe+'|\x0a';_0x482c45+=_0xaaf5('0x21')+_0x403bb2+'|\x0a';_0x482c45+=_0xaaf5('0x22')+_0x3e8576+'|\x0a';_0x482c45+=_0xaaf5('0x23')+ADMIN[_0xaaf5('0x1e')]+'|\x0a';_0x482c45+=_0xaaf5('0x24')+ADMIN[_0xaaf5('0x1f')]+'|\x0a';return _0x482c45;})[_0xaaf5('0xf')](function(_0x270783){var _0x2aabab=hardware[_0xaaf5('0x25')]()[_0xaaf5('0x26')];return jira[_0xaaf5('0x27')]({'key':_0xaaf5('0x28'),'summary':'Motion\x20License\x20Alert','description':_0x270783,'issuetype':'Alert','oldToken':_0x403bb2,'newToken':_0x3e8576,'email':ADMIN[_0xaaf5('0x1f')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x2aabab});});}function manageLicense(_0x44aef2,_0x4d2003){var _0x501017=_0x4d2003[_0xaaf5('0x29')]({'plain':!![]});httpRequest(_0x44aef2)[_0xaaf5('0xf')](function(_0x73b6d2){if(oldToken){oldToken=undefined;}if(_0x73b6d2[_0xaaf5('0x2a')]){if(!_0x501017[_0xaaf5('0x9')]&&_0x501017[_0xaaf5('0x9')]!=_0x73b6d2['license']||_0x501017[_0xaaf5('0x9')]&&_0x501017['data2']){logger['info'](_0xaaf5('0x2b'));}if(_0x501017[_0xaaf5('0x9')]&&!_0x501017[_0xaaf5('0x2c')]&&_0x501017[_0xaaf5('0x9')]!=_0x73b6d2[_0xaaf5('0x9')]){logger[_0xaaf5('0x2d')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x501017[_0xaaf5('0x9')]&&!_0x501017['data2']&&_0x501017[_0xaaf5('0x9')]==_0x73b6d2[_0xaaf5('0x9')]){return _0x4d2003;}return _0x4d2003['update']({'data1':_0x44aef2,'data2':null,'license':_0x73b6d2[_0xaaf5('0x9')]});}else{if(_0x73b6d2['license']||_0x501017[_0xaaf5('0x9')]){if(!_0x501017[_0xaaf5('0x2c')]){if(_0x501017['data1']==_0x44aef2){GRAY_PERIOD_REASON=_0xaaf5('0x2e');logger['info'](_0xaaf5('0x2f'));}else{GRAY_PERIOD_REASON=_0xaaf5('0x30');oldToken=_0x501017['data1'];logger[_0xaaf5('0x2d')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x501017[_0xaaf5('0x31')],_0x44aef2);}sendJiraAlert(_0x501017[_0xaaf5('0x31')],_0x73b6d2['uuid'],GRAY_PERIOD_REASON);logger[_0xaaf5('0x2d')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xaaf5('0x32')](),moment()[_0xaaf5('0xc')](_0xaaf5('0x33')));return _0x4d2003[_0xaaf5('0x13')]({'data2':encryptDate(moment()[_0xaaf5('0xc')](_0xaaf5('0x33')))});}else{if(moment()[_0xaaf5('0x34')](decryptDate(_0x501017['data2']),_0xaaf5('0x35'))>DAYS){logger[_0xaaf5('0x2d')]('DEMO\x20START\x20AT\x20%s',moment()[_0xaaf5('0xc')](_0xaaf5('0x33')));return _0x4d2003[_0xaaf5('0x13')]({'data1':_0x44aef2,'data2':null,'license':null});}}}else{if(_0x501017[_0xaaf5('0x31')]!=_0x44aef2){logger['info'](_0xaaf5('0x36'),_0x501017[_0xaaf5('0x31')],_0x44aef2);return _0x4d2003[_0xaaf5('0x13')]({'data1':_0x44aef2,'data2':null,'license':null});}}}return _0x4d2003;})[_0xaaf5('0xf')](function(_0x2d4530){_0x4d2003=_0x2d4530;})[_0xaaf5('0x10')](function(_0x55a5a8){logger[_0xaaf5('0x37')](_0x55a5a8[_0xaaf5('0x38')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xaaf5('0x39')](),_0x4d2003);},TIME);});}function defaultLicense(){var _0x20a838=hardware[_0xaaf5('0x39')]();if(_0x20a838){return db[_0xaaf5('0x3a')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x20a838}})[_0xaaf5('0x3b')](function(_0x5cb49d,_0x32b7f4){logger[_0xaaf5('0x2d')](_0xaaf5('0x3c'),_0x20a838);manageLicense(_0x20a838,_0x5cb49d);})[_0xaaf5('0x10')](function(_0x14504c){logger[_0xaaf5('0x37')](_0x14504c[_0xaaf5('0x38')]);});}}exports[_0xaaf5('0x3d')]=defaultLicense; \ No newline at end of file +var _0x8b8e=['util','moment','bluebird','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','session','update','utf8','final','createDecipher','base64','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','openIssue','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default'];(function(_0x403306,_0x3c00e3){var _0x234bcb=function(_0x298868){while(--_0x298868){_0x403306['push'](_0x403306['shift']());}};_0x234bcb(++_0x3c00e3);}(_0x8b8e,0x108));var _0xe8b8=function(_0x25c0a0,_0x141aac){_0x25c0a0=_0x25c0a0-0x0;var _0x3eeb2a=_0x8b8e[_0x25c0a0];return _0x3eeb2a;};'use strict';var util=require(_0xe8b8('0x0'));var crypto=require('crypto');var moment=require(_0xe8b8('0x1'));var rp=require('request-promise');var BPromise=require(_0xe8b8('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xe8b8('0x3'))['db'];var config=require(_0xe8b8('0x4'));var hardware=require(_0xe8b8('0x5'));var logger=require(_0xe8b8('0x6'))(_0xe8b8('0x7'));var jira=require(_0xe8b8('0x8'));var HOST=_0xe8b8('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x2b3269){return new BPromise(function(_0x229e0b,_0x2540e3){var _0x4ce796=util[_0xe8b8('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x2b3269,module[_0xe8b8('0xb')]['version']);if(oldToken){_0x4ce796=util['format'](_0xe8b8('0xc'),HOST,_0x2b3269,module[_0xe8b8('0xb')]['version'],oldToken);}var _0x54eb14={'uri':_0x4ce796,'method':_0xe8b8('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x54eb14)[_0xe8b8('0xe')](function(_0x886a64){_0x229e0b(_0x886a64);})[_0xe8b8('0xf')](function(_0xf5b5b1){_0x2540e3(_0xf5b5b1);});});}function encryptDate(_0x298bae){var _0x3de76b=crypto[_0xe8b8('0x10')](_0xe8b8('0x11'),config[_0xe8b8('0x12')][_0xe8b8('0x13')]);var _0x384780=_0x3de76b[_0xe8b8('0x14')](_0x298bae,_0xe8b8('0x15'),'base64');_0x384780+=_0x3de76b[_0xe8b8('0x16')]('base64');return _0x384780;}function decryptDate(_0x282ea8){var _0x290c30=crypto[_0xe8b8('0x17')](_0xe8b8('0x11'),config[_0xe8b8('0x12')][_0xe8b8('0x13')]);var _0x3f0e52=_0x290c30[_0xe8b8('0x14')](_0x282ea8,_0xe8b8('0x18'),_0xe8b8('0x15'));_0x3f0e52+=_0x290c30['final'](_0xe8b8('0x15'));return _0x3f0e52;}function sendJiraAlert(_0xaba717,_0x57ace3,_0x35b573){var _0xe48622=_0xe8b8('0x19');return db[_0xe8b8('0x1a')][_0xe8b8('0x1b')]({'where':{'role':_0xe8b8('0x1c')},'attributes':[_0xe8b8('0x1d'),_0xe8b8('0x1e')],'raw':!![]})[_0xe8b8('0xe')](function(_0x302f04){ADMIN=_0x302f04;_0xe48622+=_0xe8b8('0x1f')+_0x35b573+'|\x0a';_0xe48622+=_0xe8b8('0x20')+_0xaba717+'|\x0a';_0xe48622+=_0xe8b8('0x21')+_0x57ace3+'|\x0a';_0xe48622+=_0xe8b8('0x22')+ADMIN[_0xe8b8('0x1d')]+'|\x0a';_0xe48622+=_0xe8b8('0x23')+ADMIN[_0xe8b8('0x1e')]+'|\x0a';return _0xe48622;})['then'](function(_0x57faf7){var _0x566721=hardware[_0xe8b8('0x24')]()['ipAddress'];return jira[_0xe8b8('0x25')]({'key':'MOTLICENSE','summary':_0xe8b8('0x26'),'description':_0x57faf7,'issuetype':_0xe8b8('0x27'),'oldToken':_0xaba717,'newToken':_0x57ace3,'email':ADMIN['email'],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x566721});});}function manageLicense(_0x19f7b3,_0x20ce8e){var _0x56f459=_0x20ce8e[_0xe8b8('0x28')]({'plain':!![]});httpRequest(_0x19f7b3)[_0xe8b8('0xe')](function(_0x46bc52){if(oldToken){oldToken=undefined;}if(_0x46bc52[_0xe8b8('0x29')]){if(!_0x56f459[_0xe8b8('0x7')]&&_0x56f459['license']!=_0x46bc52[_0xe8b8('0x7')]||_0x56f459['license']&&_0x56f459[_0xe8b8('0x2a')]){logger[_0xe8b8('0x2b')](_0xe8b8('0x2c'));}if(_0x56f459[_0xe8b8('0x7')]&&!_0x56f459['data2']&&_0x56f459['license']!=_0x46bc52[_0xe8b8('0x7')]){logger[_0xe8b8('0x2b')](_0xe8b8('0x2d'));}if(_0x56f459[_0xe8b8('0x7')]&&!_0x56f459[_0xe8b8('0x2a')]&&_0x56f459['license']==_0x46bc52[_0xe8b8('0x7')]){return _0x20ce8e;}return _0x20ce8e[_0xe8b8('0x14')]({'data1':_0x19f7b3,'data2':null,'license':_0x46bc52[_0xe8b8('0x7')]});}else{if(_0x46bc52[_0xe8b8('0x7')]||_0x56f459[_0xe8b8('0x7')]){if(!_0x56f459[_0xe8b8('0x2a')]){if(_0x56f459[_0xe8b8('0x2e')]==_0x19f7b3){GRAY_PERIOD_REASON=_0xe8b8('0x2f');logger[_0xe8b8('0x2b')](_0xe8b8('0x30'));}else{GRAY_PERIOD_REASON=_0xe8b8('0x31');oldToken=_0x56f459['data1'];logger[_0xe8b8('0x2b')](_0xe8b8('0x32'),_0x56f459[_0xe8b8('0x2e')],_0x19f7b3);}sendJiraAlert(_0x56f459['data1'],_0x46bc52[_0xe8b8('0x33')],GRAY_PERIOD_REASON);logger[_0xe8b8('0x2b')](_0xe8b8('0x34'),GRAY_PERIOD_REASON[_0xe8b8('0x35')](),moment()[_0xe8b8('0xa')](_0xe8b8('0x36')));return _0x20ce8e[_0xe8b8('0x14')]({'data2':encryptDate(moment()[_0xe8b8('0xa')](_0xe8b8('0x36')))});}else{if(moment()['diff'](decryptDate(_0x56f459[_0xe8b8('0x2a')]),_0xe8b8('0x37'))>DAYS){logger['info'](_0xe8b8('0x38'),moment()[_0xe8b8('0xa')](_0xe8b8('0x36')));return _0x20ce8e[_0xe8b8('0x14')]({'data1':_0x19f7b3,'data2':null,'license':null});}}}else{if(_0x56f459[_0xe8b8('0x2e')]!=_0x19f7b3){logger['info'](_0xe8b8('0x32'),_0x56f459[_0xe8b8('0x2e')],_0x19f7b3);return _0x20ce8e[_0xe8b8('0x14')]({'data1':_0x19f7b3,'data2':null,'license':null});}}}return _0x20ce8e;})[_0xe8b8('0xe')](function(_0x15f3f8){_0x20ce8e=_0x15f3f8;})[_0xe8b8('0xf')](function(_0x4d617b){logger[_0xe8b8('0x39')](_0x4d617b['message']);})[_0xe8b8('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0xe8b8('0x3b')](),_0x20ce8e);},TIME);});}function defaultLicense(){var _0x4b77ff=hardware['getUuid']();if(_0x4b77ff){return db[_0xe8b8('0x3c')][_0xe8b8('0x3d')]({'where':{'id':0x1},'defaults':{'data1':_0x4b77ff}})[_0xe8b8('0x3e')](function(_0x20b6d5,_0x53a18d){logger[_0xe8b8('0x2b')](_0xe8b8('0x3f'),_0x4b77ff);manageLicense(_0x4b77ff,_0x20b6d5);})[_0xe8b8('0xf')](function(_0xd1efab){logger[_0xe8b8('0x39')](_0xd1efab[_0xe8b8('0x40')]);});}}exports[_0xe8b8('0x41')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3cff9af..8a76499 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 _0x9306=['license','isEmpty','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','final','utf8','parse','demo','uuid','machineUuid','getUuid','secrets','base64','gray','add','days','grayReason','changed','2027-01-01T00:00:00.000Z','Demo\x20license','getLicense','License','find','defaults','then','checkLicense','util','lodash','moment','./hardware','../environment','../../mysqldb'];(function(_0x40e5e7,_0x5de9fb){var _0x305d7b=function(_0x1f10cd){while(--_0x1f10cd){_0x40e5e7['push'](_0x40e5e7['shift']());}};_0x305d7b(++_0x5de9fb);}(_0x9306,0x69));var _0x6930=function(_0x5ddab6,_0x593d6c){_0x5ddab6=_0x5ddab6-0x0;var _0x40e6ba=_0x9306[_0x5ddab6];return _0x40e6ba;};'use strict';var crypto=require('crypto');var util=require(_0x6930('0x0'));var _=require(_0x6930('0x1'));var moment=require(_0x6930('0x2'));var hardware=require(_0x6930('0x3'));var config=require(_0x6930('0x4'));var db=require(_0x6930('0x5'))['db'];function checkLicense(_0x386325,_0x19faf9){if(_0x386325){try{var _0x9849b6=_0x19faf9||_0x386325[_0x6930('0x6')];if(_[_0x6930('0x7')](_0x9849b6)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1268c7=_0x386325[_0x6930('0x8')];var _0x9238e5=_0x386325['data2'];var _0x466aec=_0x1268c7[_0x6930('0x9')]('-')[0x4];var _0x5eea0d=_0x1268c7[_0x6930('0x9')]('-')[0x0];var _0x32e702=crypto[_0x6930('0xa')](_0x6930('0xb'),util[_0x6930('0xc')](_0x6930('0xd'),_0x466aec,_0x1268c7,_0x5eea0d));var _0x7cd818=_0x32e702[_0x6930('0xe')](_0x9849b6,'base64','utf8');_0x7cd818+=_0x32e702[_0x6930('0xf')](_0x6930('0x10'));var _0x5bcb23=JSON[_0x6930('0x11')](_0x7cd818);_0x5bcb23[_0x6930('0x12')]=![];_0x5bcb23[_0x6930('0x13')]=_0x1268c7;_0x5bcb23[_0x6930('0x14')]=hardware[_0x6930('0x15')]();if(_0x9238e5){var _0x3c1986=crypto[_0x6930('0xa')](_0x6930('0xb'),config[_0x6930('0x16')]['session']);var _0x2ecdbb=_0x3c1986[_0x6930('0xe')](_0x9238e5,_0x6930('0x17'),'utf8');_0x2ecdbb+=_0x3c1986['final'](_0x6930('0x10'));_0x5bcb23[_0x6930('0x18')]=_0x2ecdbb;_0x5bcb23['deadline']=moment(_0x2ecdbb)[_0x6930('0x19')](0x7,_0x6930('0x1a'))['format']();_0x5bcb23[_0x6930('0x1b')]=_0x5bcb23[_0x6930('0x13')]!=_0x5bcb23[_0x6930('0x14')]?_0x6930('0x1c'):'disabled';}return _0x5bcb23;}catch(_0x27c5e4){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6930('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x386325[_0x6930('0x8')],'machineUuid':hardware[_0x6930('0x15')](),'message':_0x27c5e4['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'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':_0x6930('0x1e'),'uuid':_0x386325[_0x6930('0x8')],'machineUuid':hardware[_0x6930('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x6930('0x1f')]=function(_0x6a0669){return db[_0x6930('0x20')][_0x6930('0x21')](_[_0x6930('0x22')](_0x6a0669,{'raw':!![],'where':{'id':0x1}}))[_0x6930('0x23')](function(_0x1cdf20){return checkLicense(_0x1cdf20,null);});};exports[_0x6930('0x24')]=checkLicense; \ No newline at end of file +var _0x99b8=['then','crypto','util','lodash','moment','./hardware','../environment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','machineUuid','getUuid','session','deadline','add','grayReason','uuid','disabled','Breaking\x20license','message','2027-01-01T00:00:00.000Z','Demo\x20license','License','find','defaults'];(function(_0xfafa00,_0x3e2a71){var _0x29fd9d=function(_0x3ba6d4){while(--_0x3ba6d4){_0xfafa00['push'](_0xfafa00['shift']());}};_0x29fd9d(++_0x3e2a71);}(_0x99b8,0xb5));var _0x899b=function(_0x8c2392,_0x2ce5fb){_0x8c2392=_0x8c2392-0x0;var _0x53ed69=_0x99b8[_0x8c2392];return _0x53ed69;};'use strict';var crypto=require(_0x899b('0x0'));var util=require(_0x899b('0x1'));var _=require(_0x899b('0x2'));var moment=require(_0x899b('0x3'));var hardware=require(_0x899b('0x4'));var config=require(_0x899b('0x5'));var db=require(_0x899b('0x6'))['db'];function checkLicense(_0x3fcfab,_0x57fd2e){if(_0x3fcfab){try{var _0x46e186=_0x57fd2e||_0x3fcfab['license'];if(_[_0x899b('0x7')](_0x46e186)){throw new Error(_0x899b('0x8'));}var _0x3a450a=_0x3fcfab[_0x899b('0x9')];var _0x288aa6=_0x3fcfab['data2'];var _0x366685=_0x3a450a['split']('-')[0x4];var _0x26dd38=_0x3a450a[_0x899b('0xa')]('-')[0x0];var _0x5ce692=crypto[_0x899b('0xb')](_0x899b('0xc'),util[_0x899b('0xd')](_0x899b('0xe'),_0x366685,_0x3a450a,_0x26dd38));var _0x3ea54f=_0x5ce692[_0x899b('0xf')](_0x46e186,_0x899b('0x10'),'utf8');_0x3ea54f+=_0x5ce692[_0x899b('0x11')](_0x899b('0x12'));var _0x282c4e=JSON[_0x899b('0x13')](_0x3ea54f);_0x282c4e['demo']=![];_0x282c4e['uuid']=_0x3a450a;_0x282c4e[_0x899b('0x14')]=hardware[_0x899b('0x15')]();if(_0x288aa6){var _0x5d53c9=crypto['createDecipher'](_0x899b('0xc'),config['secrets'][_0x899b('0x16')]);var _0xe1909d=_0x5d53c9[_0x899b('0xf')](_0x288aa6,_0x899b('0x10'),_0x899b('0x12'));_0xe1909d+=_0x5d53c9['final'](_0x899b('0x12'));_0x282c4e['gray']=_0xe1909d;_0x282c4e[_0x899b('0x17')]=moment(_0xe1909d)[_0x899b('0x18')](0x7,'days')[_0x899b('0xd')]();_0x282c4e[_0x899b('0x19')]=_0x282c4e[_0x899b('0x1a')]!=_0x282c4e[_0x899b('0x14')]?'changed':_0x899b('0x1b');}return _0x282c4e;}catch(_0x4d4fac){return{'breaking':!![],'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':![],'update':![],'description':_0x899b('0x1c'),'uuid':_0x3fcfab[_0x899b('0x9')],'machineUuid':hardware['getUuid'](),'message':_0x4d4fac[_0x899b('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x899b('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x899b('0x1f'),'uuid':_0x3fcfab[_0x899b('0x9')],'machineUuid':hardware[_0x899b('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x3d879d){return db[_0x899b('0x20')][_0x899b('0x21')](_[_0x899b('0x22')](_0x3d879d,{'raw':!![],'where':{'id':0x1}}))[_0x899b('0x23')](function(_0x139e04){return checkLicense(_0x139e04,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index c81fe0d..5df9da1 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 _0xc32d=['exports','http://localhost:9000','myappanuglar-secret','secret'];(function(_0x10ddc4,_0x29acf9){var _0x1fdb84=function(_0x57c7e4){while(--_0x57c7e4){_0x10ddc4['push'](_0x10ddc4['shift']());}};_0x1fdb84(++_0x29acf9);}(_0xc32d,0x188));var _0xdc32=function(_0x13ae88,_0x5ebeaf){_0x13ae88=_0x13ae88-0x0;var _0x55a594=_0xc32d[_0x13ae88];return _0x55a594;};'use strict';module[_0xdc32('0x0')]={'DOMAIN':_0xdc32('0x1'),'SESSION_SECRET':_0xdc32('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xdc32('0x3'),'DEBUG':''}; \ No newline at end of file +'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3c15a70..c4609c1 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x626b=['File','%s-%s','error','info','Console','env','debugLevel','moment','INFO','/var','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x626b,0x142));var _0xb626=function(_0x47191f,_0x5bc9d9){_0x47191f=_0x47191f-0x0;var _0x428f90=_0x626b[_0x47191f];return _0x428f90;};'use strict';var moment=require(_0xb626('0x0'));var winston=require('winston');var util=require('util');var path=require('path');var debugLevel=_0xb626('0x1');function filename(_0x27ddac,_0x4266c9){return path['join'](_0xb626('0x2'),'log',_0xb626('0x3'),util[_0xb626('0x4')](_0xb626('0x5'),_0x27ddac,_0x4266c9));}function formatter(_0x44c54c,_0x2ba2ae){return util[_0xb626('0x4')](_0xb626('0x6'),moment()[_0xb626('0x4')](_0xb626('0x7')),_0x2ba2ae[_0xb626('0x8')][_0xb626('0x9')](),_0x44c54c,_0x2ba2ae[_0xb626('0xa')]);}module[_0xb626('0xb')]=function(_0x40ca46){return new winston[(_0xb626('0xc'))]({'transports':[new winston[(_0xb626('0xd'))][(_0xb626('0xe'))]({'name':util[_0xb626('0x4')](_0xb626('0xf'),_0x40ca46,_0xb626('0x10')),'filename':filename(_0x40ca46,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3a4bb9){return formatter(_0x40ca46,_0x3a4bb9);}}),new winston['transports'][(_0xb626('0xe'))]({'name':util['format'](_0xb626('0xf'),_0x40ca46,'info'),'filename':filename(_0x40ca46,_0xb626('0x11')),'level':_0xb626('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x54373c){return formatter(_0x40ca46,_0x54373c);}}),new winston['transports'][(_0xb626('0x12'))]({'level':process[_0xb626('0x13')][_0xb626('0x14')]||debugLevel,'json':![],'formatter':function(_0x44b187){return formatter(_0x40ca46,_0x44b187);}})]});}; \ No newline at end of file +var _0xcc5b=['path','INFO','join','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','transports','File','error','%s-%s','info','Console','moment','winston','util'];(function(_0x589098,_0x140d3f){var _0x35784b=function(_0x235cc3){while(--_0x235cc3){_0x589098['push'](_0x589098['shift']());}};_0x35784b(++_0x140d3f);}(_0xcc5b,0x1eb));var _0xbcc5=function(_0x1767d6,_0x1a6994){_0x1767d6=_0x1767d6-0x0;var _0x5535fe=_0xcc5b[_0x1767d6];return _0x5535fe;};'use strict';var moment=require(_0xbcc5('0x0'));var winston=require(_0xbcc5('0x1'));var util=require(_0xbcc5('0x2'));var path=require(_0xbcc5('0x3'));var debugLevel=_0xbcc5('0x4');function filename(_0x58f306,_0x43c4a2){return path[_0xbcc5('0x5')]('/var','log','xcally',util[_0xbcc5('0x6')](_0xbcc5('0x7'),_0x58f306,_0x43c4a2));}function formatter(_0x4797d8,_0x3361f0){return util[_0xbcc5('0x6')](_0xbcc5('0x8'),moment()[_0xbcc5('0x6')](_0xbcc5('0x9')),_0x3361f0[_0xbcc5('0xa')][_0xbcc5('0xb')](),_0x4797d8,_0x3361f0['message']);}module[_0xbcc5('0xc')]=function(_0x22ec8d){return new winston['Logger']({'transports':[new winston[(_0xbcc5('0xd'))][(_0xbcc5('0xe'))]({'name':util[_0xbcc5('0x6')]('%s-%s',_0x22ec8d,_0xbcc5('0xf')),'filename':filename(_0x22ec8d,_0xbcc5('0xf')),'level':_0xbcc5('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5698f1){return formatter(_0x22ec8d,_0x5698f1);}}),new winston[(_0xbcc5('0xd'))][(_0xbcc5('0xe'))]({'name':util['format'](_0xbcc5('0x10'),_0x22ec8d,_0xbcc5('0x11')),'filename':filename(_0x22ec8d,_0xbcc5('0x11')),'level':_0xbcc5('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x355566){return formatter(_0x22ec8d,_0x355566);}}),new winston[(_0xbcc5('0xd'))][(_0xbcc5('0x12'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x222158){return formatter(_0x22ec8d,_0x222158);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e4b03f1..da234fd 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 _0xcf84=['exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcf84,0x175));var _0x4cf8=function(_0x12c403,_0x29d41f){_0x12c403=_0x12c403-0x0;var _0x2ec86c=_0xcf84[_0x12c403];return _0x2ec86c;};'use strict';var path=require(_0x4cf8('0x0'));var os=require('os');var config={'apps':[{'name':_0x4cf8('0x1'),'script':path[_0x4cf8('0x2')](__dirname,_0x4cf8('0x3'))},{'name':_0x4cf8('0x4'),'script':path[_0x4cf8('0x2')](__dirname,_0x4cf8('0x5'))},{'name':'agi','script':path[_0x4cf8('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0x4cf8('0x6'),'script':path[_0x4cf8('0x2')](__dirname,_0x4cf8('0x7'))},{'name':'routing','script':path['join'](__dirname,_0x4cf8('0x8'))},{'name':_0x4cf8('0x9'),'script':path['join'](__dirname,_0x4cf8('0xa'))}]};module[_0x4cf8('0xb')]=config; \ No newline at end of file +var _0x5eff=['join','ami','agi','../../services/email/index.js','../../services/routing/index.js','exports','path','express'];(function(_0x9d5867,_0x202104){var _0x1d7379=function(_0x525391){while(--_0x525391){_0x9d5867['push'](_0x9d5867['shift']());}};_0x1d7379(++_0x202104);}(_0x5eff,0x76));var _0xf5ef=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x5eff[_0x422905];return _0x33dc6c;};'use strict';var path=require(_0xf5ef('0x0'));var os=require('os');var config={'apps':[{'name':_0xf5ef('0x1'),'script':path[_0xf5ef('0x2')](__dirname,'../../services/express/index.js')},{'name':_0xf5ef('0x3'),'script':path[_0xf5ef('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0xf5ef('0x4'),'script':path[_0xf5ef('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0xf5ef('0x2')](__dirname,_0xf5ef('0x5'))},{'name':'routing','script':path[_0xf5ef('0x2')](__dirname,_0xf5ef('0x6'))},{'name':'xdr','script':path[_0xf5ef('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xf5ef('0x7')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 78a7f5e..a82a713 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 _0x4074=['pm2','bluebird','./config','connect','connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved'];(function(_0x535a7b,_0x4872dd){var _0x8b7964=function(_0x17b738){while(--_0x17b738){_0x535a7b['push'](_0x535a7b['shift']());}};_0x8b7964(++_0x4872dd);}(_0x4074,0xf0));var _0x4407=function(_0x20797d,_0x2af988){_0x20797d=_0x20797d-0x0;var _0xa44bd7=_0x4074[_0x20797d];return _0xa44bd7;};'use strict';var pm2=require(_0x4407('0x0'));var BPromise=require(_0x4407('0x1'));var config=require(_0x4407('0x2'));function connect(){return new BPromise(function(_0x52977e,_0x1021e6){return pm2[_0x4407('0x3')](function(_0x14c0bc){if(_0x14c0bc){return _0x1021e6(_0x14c0bc);}return _0x52977e(_0x4407('0x4'));});});};exports[_0x4407('0x5')]=function(_0x3c9f5c){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x2495d2,_0x3f085d){return pm2[_0x4407('0x5')](_0x3c9f5c,function(_0x4933cf,_0x988538){if(_0x4933cf){return _0x3f085d(_0x4933cf);}pm2['disconnect']();return _0x2495d2(_0x988538);});});});};exports[_0x4407('0x7')]=function(_0x3c1aee){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x54b465,_0x5e70a5){return pm2['stop'](_0x3c1aee,function(_0x801db8,_0x74e6f8){if(_0x801db8){return _0x5e70a5(_0x801db8);}pm2[_0x4407('0x8')]();return _0x54b465(_0x74e6f8);});});});};exports[_0x4407('0x9')]=function(_0x36cde5){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x167f9f,_0x2c5b86){return pm2[_0x4407('0x9')](_0x36cde5,function(_0x332243,_0x14f398){if(_0x332243){return _0x2c5b86(_0x332243);}pm2['disconnect']();return _0x167f9f(_0x14f398);});});});};exports[_0x4407('0xa')]=function(){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x52cd11,_0x3ee793){return pm2['list'](function(_0x1d2ec8,_0x27724a){if(_0x1d2ec8){return _0x3ee793(_0x1d2ec8);}pm2[_0x4407('0x8')]();return _0x52cd11(_0x27724a);});});});};exports[_0x4407('0xb')]=function(_0x1840dd){return connect()[_0x4407('0x6')](function(){return new BPromise(function(_0x1c5a0c,_0x2e709f){return pm2['describe'](_0x1840dd,function(_0x474e6a,_0x65b20b){if(_0x474e6a){return _0x2e709f(_0x474e6a);}pm2[_0x4407('0x8')]();return _0x1c5a0c(_0x65b20b);});});});};exports[_0x4407('0xc')]=function(_0x12952e){return connect()['then'](function(){return new BPromise(function(_0x2d6fb9,_0x54caa1){return pm2[_0x4407('0xc')](_0x12952e,function(_0x257d33,_0x1db373){if(_0x257d33){return _0x54caa1(_0x257d33);}pm2[_0x4407('0x8')]();return _0x2d6fb9(_0x1db373);});});});};exports[_0x4407('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x451897,_0x55ee6d){return pm2[_0x4407('0xd')](function(_0x28bb2c){if(_0x28bb2c){return _0x55ee6d(_0x28bb2c);}return _0x451897(_0x4407('0xe'));});});});}; \ No newline at end of file +var _0x2353=['connect','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x2353,0xe3));var _0x3235=function(_0x50ea63,_0x2847ae){_0x50ea63=_0x50ea63-0x0;var _0x16caa6=_0x2353[_0x50ea63];return _0x16caa6;};'use strict';var pm2=require(_0x3235('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x41795d,_0x1a446d){return pm2[_0x3235('0x1')](function(_0x1c5b30){if(_0x1c5b30){return _0x1a446d(_0x1c5b30);}return _0x41795d('connected');});});};exports[_0x3235('0x2')]=function(_0x378df4){return connect()[_0x3235('0x3')](function(){return new BPromise(function(_0xcab638,_0x22e9b8){return pm2['start'](_0x378df4,function(_0x2ee681,_0x340ad1){if(_0x2ee681){return _0x22e9b8(_0x2ee681);}pm2[_0x3235('0x4')]();return _0xcab638(_0x340ad1);});});});};exports[_0x3235('0x5')]=function(_0x3e96a6){return connect()[_0x3235('0x3')](function(){return new BPromise(function(_0x34f3a5,_0x4eb7ec){return pm2[_0x3235('0x5')](_0x3e96a6,function(_0x27a046,_0x1f829b){if(_0x27a046){return _0x4eb7ec(_0x27a046);}pm2['disconnect']();return _0x34f3a5(_0x1f829b);});});});};exports[_0x3235('0x6')]=function(_0x4879ce){return connect()[_0x3235('0x3')](function(){return new BPromise(function(_0x5aa432,_0x357990){return pm2[_0x3235('0x6')](_0x4879ce,function(_0x4f8513,_0x158366){if(_0x4f8513){return _0x357990(_0x4f8513);}pm2[_0x3235('0x4')]();return _0x5aa432(_0x158366);});});});};exports[_0x3235('0x7')]=function(){return connect()[_0x3235('0x3')](function(){return new BPromise(function(_0x58e206,_0x311b50){return pm2[_0x3235('0x7')](function(_0x433442,_0x569caa){if(_0x433442){return _0x311b50(_0x433442);}pm2[_0x3235('0x4')]();return _0x58e206(_0x569caa);});});});};exports[_0x3235('0x8')]=function(_0x4ec791){return connect()[_0x3235('0x3')](function(){return new BPromise(function(_0x13b2d1,_0x569ba4){return pm2['describe'](_0x4ec791,function(_0x41e9c2,_0x1e9be9){if(_0x41e9c2){return _0x569ba4(_0x41e9c2);}pm2[_0x3235('0x4')]();return _0x13b2d1(_0x1e9be9);});});});};exports[_0x3235('0x9')]=function(_0x4b583a){return connect()[_0x3235('0x3')](function(){return new BPromise(function(_0x3bbe64,_0x23c8a6){return pm2[_0x3235('0x9')](_0x4b583a,function(_0x5c9e4d,_0x1a03ef){if(_0x5c9e4d){return _0x23c8a6(_0x5c9e4d);}pm2[_0x3235('0x4')]();return _0x3bbe64(_0x1a03ef);});});});};exports[_0x3235('0xa')]=function(){return connect()[_0x3235('0x3')](function(){return new BPromise(function(_0xe6956,_0x53a525){return pm2[_0x3235('0xa')](function(_0x14e40b){if(_0x14e40b){return _0x53a525(_0x14e40b);}return _0xe6956(_0x3235('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1796154..331e7af 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 _0x9cf2=['catch','error','start','lodash','ioredis','../../config/environment','redis','defaults','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','chatInteraction:update'];(function(_0x4828f3,_0x5774b6){var _0x8a2a6=function(_0x5d82dd){while(--_0x5d82dd){_0x4828f3['push'](_0x4828f3['shift']());}};_0x8a2a6(++_0x5774b6);}(_0x9cf2,0x17d));var _0x29cf=function(_0x5f1ed3,_0x3c339a){_0x5f1ed3=_0x5f1ed3-0x0;var _0x239f3c=_0x9cf2[_0x5f1ed3];return _0x239f3c;};'use strict';var _=require(_0x29cf('0x0'));var moment=require('moment');var Redis=require(_0x29cf('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x29cf('0x2'));config[_0x29cf('0x3')]=_[_0x29cf('0x4')](config[_0x29cf('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x29cf('0x3')]));function closeInteractions(){var _0x36e571=0x0;var _0x4d492b=[];return db[_0x29cf('0x5')][_0x29cf('0x6')]({'raw':!![],'attributes':['id',_0x29cf('0x7')],'where':{'id':0x1}})[_0x29cf('0x8')](function(_0x3870f2){_0x36e571=_0x3870f2['chatTimeout'];if(_0x36e571){return db['ChatInteraction'][_0x29cf('0x9')]({'raw':!![],'attributes':['id',_0x29cf('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x29cf('0xb')](_0x3870f2['chatTimeout'],_0x29cf('0xc'))}}});}else{return[];}})[_0x29cf('0x8')](function(_0x49d0ab){_0x4d492b=_0x49d0ab;if(_0x36e571){return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x29cf('0xd'),'closed':!![],'closedAt':moment()[_0x29cf('0xe')](_0x29cf('0xf'))},{'where':{'id':_['map'](_0x4d492b||[],'id')}});}})[_0x29cf('0x8')](function(_0x513457){for(var _0x78c32=0x0;_0x78c32<_0x4d492b[_0x29cf('0x10')];_0x78c32++){io['emit'](_0x29cf('0x11'),{'id':_0x4d492b[_0x78c32]['id'],'closed':!![]});}})[_0x29cf('0x12')](function(_0x2e5a37){console[_0x29cf('0x13')](_0x2e5a37);});}exports[_0x29cf('0x14')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3d16=['socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','then','update','system','format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x3d16,0x1ba));var _0x63d1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3d16[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x63d1('0x0'));var moment=require(_0x63d1('0x1'));var Redis=require(_0x63d1('0x2'));var db=require(_0x63d1('0x3'))['db'];var config=require(_0x63d1('0x4'));config[_0x63d1('0x5')]=_[_0x63d1('0x6')](config[_0x63d1('0x5')],{'host':_0x63d1('0x7'),'port':0x18eb});var io=require(_0x63d1('0x8'))(new Redis(config[_0x63d1('0x5')]));function closeInteractions(){var _0x19963c=0x0;var _0x274653=[];return db[_0x63d1('0x9')][_0x63d1('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x1e1261){_0x19963c=_0x1e1261[_0x63d1('0xb')];if(_0x19963c){return db[_0x63d1('0xc')][_0x63d1('0xd')]({'raw':!![],'attributes':['id',_0x63d1('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x63d1('0xf')](_0x1e1261[_0x63d1('0xb')],'minutes')}}});}else{return[];}})[_0x63d1('0x10')](function(_0x3d66bd){_0x274653=_0x3d66bd;if(_0x19963c){return db[_0x63d1('0xc')][_0x63d1('0x11')]({'closeReason':_0x63d1('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x63d1('0x13')](_0x63d1('0x14'))},{'where':{'id':_[_0x63d1('0x15')](_0x274653||[],'id')}});}})[_0x63d1('0x10')](function(_0x28f9d9){for(var _0x226763=0x0;_0x226763<_0x274653[_0x63d1('0x16')];_0x226763++){io[_0x63d1('0x17')]('chatInteraction:update',{'id':_0x274653[_0x226763]['id'],'closed':!![]});}})['catch'](function(_0x446d7a){console['error'](_0x446d7a);});}exports[_0x63d1('0x18')]=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 cce73dc..f741583 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 _0xfd41=['exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','active','update','update\x20cron','start','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','Smtp','service','host','port','secure','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','error','error\x20mail','catch','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtractNumber','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','then','keys','jobs','map','toString','keyBy','intersection','length'];(function(_0x13f43f,_0x22d2ab){var _0x576d75=function(_0x45a8b5){while(--_0x45a8b5){_0x13f43f['push'](_0x13f43f['shift']());}};_0x576d75(++_0x22d2ab);}(_0xfd41,0x16e));var _0x1fd4=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0xfd41[_0x591cfd];return _0x4d0100;};'use strict';var fs=require('fs');var util=require(_0x1fd4('0x0'));var path=require(_0x1fd4('0x1'));var _=require(_0x1fd4('0x2'));var moment=require(_0x1fd4('0x3'));var CronJobManager=require(_0x1fd4('0x4'));var jayson=require(_0x1fd4('0x5'));var BPromise=require(_0x1fd4('0x6'));var logger=require(_0x1fd4('0x7'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x1fd4('0x8'));var client=jayson[_0x1fd4('0x9')][_0x1fd4('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xea8e92,_0x2eee80){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0xea8e92[_0x1fd4('0xb')]);var _0x5e26fb=!![];var _0x34b21a={'tls':{'rejectUnauthorized':![]}};if(_0xea8e92[_0x1fd4('0xc')][_0x1fd4('0xd')][_0x1fd4('0xe')]){_0x34b21a['service']=_0xea8e92[_0x1fd4('0xc')][_0x1fd4('0xd')]['service'];}else{_0x34b21a[_0x1fd4('0xf')]=_0xea8e92[_0x1fd4('0xc')][_0x1fd4('0xd')][_0x1fd4('0xf')];_0x34b21a[_0x1fd4('0x10')]=_0xea8e92[_0x1fd4('0xc')][_0x1fd4('0xd')][_0x1fd4('0x10')];_0x34b21a[_0x1fd4('0x11')]=_0xea8e92[_0x1fd4('0xc')]['Smtp'][_0x1fd4('0x11')];}if(_0xea8e92[_0x1fd4('0xc')][_0x1fd4('0xd')]['authentication']){_0x34b21a[_0x1fd4('0x12')]={'user':_0xea8e92[_0x1fd4('0xc')][_0x1fd4('0xd')][_0x1fd4('0x13')],'pass':_0xea8e92[_0x1fd4('0xc')][_0x1fd4('0xd')]['pass']};}var _0x14c63a={'account':_0x34b21a,'message':{'from':util[_0x1fd4('0x14')](_0x1fd4('0x15'),_0xea8e92['MailAccount'][_0x1fd4('0x16')],_0xea8e92[_0x1fd4('0xc')][_0x1fd4('0xb')]||_0xea8e92['MailAccount'][_0x1fd4('0xd')][_0x1fd4('0x13')]),'to':_0xea8e92[_0x1fd4('0xb')],'cc':_0xea8e92['cc'],'bcc':_0xea8e92[_0x1fd4('0x17')],'subject':util[_0x1fd4('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x2eee80[_0x1fd4('0x16')],_0xea8e92['subtractNumber'],_0xea8e92[_0x1fd4('0x18')])}};var _0x1a5a8c=path[_0x1fd4('0x19')](__dirname,_0x1fd4('0x1a'));var _0x5cb21e=_0x2eee80[_0x1fd4('0x1b')];var _0x319bbc=util['format'](_0x1fd4('0x1c'),path[_0x1fd4('0x1d')](_0x2eee80[_0x1fd4('0x1b')],path[_0x1fd4('0x1e')](_0x2eee80[_0x1fd4('0x1b')])),_0x1fd4('0x1f'));var _0x17d9f4=path[_0x1fd4('0x19')](_0x1a5a8c,_0x5cb21e);var _0x1a5a60=path['join'](_0x1a5a8c,_0x319bbc);if(fs[_0x1fd4('0x20')](_0x17d9f4)){_0x2eee80['status']=_0x1fd4('0x21');_0x14c63a['message'][_0x1fd4('0x22')]=[{'filename':_0x5cb21e,'path':_0x17d9f4}];_0x14c63a['message'][_0x1fd4('0x23')]=util[_0x1fd4('0x14')](_0x1fd4('0x24'),JSON[_0x1fd4('0x25')](_0x2eee80,null,0x2));}else if(fs[_0x1fd4('0x20')](_0x1a5a60)){_0x2eee80[_0x1fd4('0x26')]=_0x1fd4('0x21');_0x14c63a[_0x1fd4('0x27')][_0x1fd4('0x22')]=[{'filename':_0x319bbc,'path':_0x1a5a60}];}else{_0x14c63a['message'][_0x1fd4('0x23')]=_0x1fd4('0x28');if(!_0xea8e92['sendIfEmpty']){_0x5e26fb=![];logger[_0x1fd4('0x29')](_0x1fd4('0x2a'));}}if(_0x5e26fb){return client['request']('SendMail',_0x14c63a)['then'](function(_0x466a26){if(_0x466a26['error']){return logger[_0x1fd4('0x2b')](_0x1fd4('0x2c'),JSON[_0x1fd4('0x25')](_0x466a26));}return logger[_0x1fd4('0x29')]('email\x20sent');})[_0x1fd4('0x2d')](function(_0xebbc23){return logger[_0x1fd4('0x2b')](_0x1fd4('0x2c'),JSON['stringify'](_0xebbc23));});}};}function handleError(){return function(_0x489f41){return logger[_0x1fd4('0x2b')](JSON[_0x1fd4('0x25')](_0x489f41));};}function handleResult(_0x17f180){return function(_0x3b254c){logger['info'](_0x1fd4('0x2e'),JSON[_0x1fd4('0x25')](_0x3b254c));if(_0x17f180[_0x1fd4('0xc')]&&_0x17f180['MailAccount'][_0x1fd4('0xd')]&&!_['isNil'](_0x17f180[_0x1fd4('0xb')])){setTimeout(handleSendEmail(_0x17f180,_0x3b254c),0x3c*0x3e8);}};}function handleJob(_0x2c6403){return function(){try{if(_[_0x1fd4('0x2f')](_0x2c6403['subtractNumber'])){return logger[_0x1fd4('0x29')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x1fd4('0x2f')](_0x2c6403['subtractUnit'])){return logger[_0x1fd4('0x29')](_0x1fd4('0x30'));}var _0x596acc={'startDate':moment()['subtract'](_0x2c6403[_0x1fd4('0x31')],_0x2c6403[_0x1fd4('0x18')])[_0x1fd4('0x14')](_0x1fd4('0x32')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x1fd4('0x33'),'output':_0x2c6403[_0x1fd4('0x34')],'name':_0x2c6403[_0x1fd4('0x16')]};if(!_[_0x1fd4('0x2f')](_0x2c6403[_0x1fd4('0x35')])){logger['info'](_0x1fd4('0x36'),_0x2c6403[_0x1fd4('0x35')]);return analyticDefaultReportController[_0x1fd4('0x37')]({'id':_0x2c6403['DefaultReportId']},_0x596acc)['then'](handleResult(_0x2c6403))[_0x1fd4('0x2d')](handleError());}if(!_[_0x1fd4('0x2f')](_0x2c6403['CustomReportId'])){logger[_0x1fd4('0x29')]('exec\x20custom\x20report\x20id:%s',_0x2c6403[_0x1fd4('0x38')]);return analyticCustomReportController['runReport']({'id':_0x2c6403[_0x1fd4('0x38')]},_0x596acc)['then'](handleResult(_0x2c6403))[_0x1fd4('0x2d')](handleError());}}catch(_0x322ad0){logger[_0x1fd4('0x2b')](JSON[_0x1fd4('0x25')](_0x322ad0));}return logger[_0x1fd4('0x29')](_0x1fd4('0x39'));};}function getJobs(_0xaf29c4){var _0x42ee16={};if(_0xaf29c4){_0x42ee16['id']=_0xaf29c4;}return db[_0x1fd4('0x3a')][_0x1fd4('0x3b')]({'where':_0x42ee16,'include':[{'model':db[_0x1fd4('0xc')],'attributes':['id','name',_0x1fd4('0xb')],'include':[{'model':db[_0x1fd4('0x3c')],'as':'Smtp'}]}]})[_0x1fd4('0x3d')](function(_0x3581f0){var _0x180e6d=_[_0x1fd4('0x3e')](manager[_0x1fd4('0x3f')]);var _0x4afab2=_[_0x1fd4('0x40')](_0x3581f0,function(_0x237aae){return _0x237aae['id'][_0x1fd4('0x41')]();});var _0x3ebbe8=_[_0x1fd4('0x42')](_0x3581f0,function(_0x500c43){return _0x500c43['id'][_0x1fd4('0x41')]();});var _0x25335f=_0xaf29c4?_0x4afab2:_['difference'](_0x4afab2,_0x180e6d);var _0x14076d=_[_0x1fd4('0x43')](_0x4afab2,_0x180e6d);var _0x4cb6f4=_['difference'](_0x180e6d,_0x4afab2);var _0x122474;var _0x1ac566;for(_0x122474=0x0;_0x122474<_0x4cb6f4[_0x1fd4('0x44')]&&!_0xaf29c4;_0x122474+=0x1){_0x1ac566=_0x4cb6f4[_0x122474]['toString']();if(manager[_0x1fd4('0x45')](_0x1ac566)){manager['stop'](_0x1ac566);manager[_0x1fd4('0x46')](_0x1ac566);logger['info'](_0x1fd4('0x47'),_0x1ac566);}}logger[_0x1fd4('0x29')](_0x1fd4('0x48'),JSON[_0x1fd4('0x25')](_0x25335f));for(_0x122474=0x0;_0x122474<_0x25335f['length'];_0x122474+=0x1){_0x1ac566=_0x25335f[_0x122474][_0x1fd4('0x41')]();logger[_0x1fd4('0x29')](_0x1fd4('0x49'),_0x1ac566);if(_0xaf29c4){logger[_0x1fd4('0x29')](_0x1fd4('0x4a'),_0xaf29c4);logger[_0x1fd4('0x29')](JSON['stringify'](_0x3ebbe8[_0x1ac566]));BPromise[_0x1fd4('0x4b')]()[_0x1fd4('0x3d')](handleJob(_0x3ebbe8[_0x1ac566]));logger['info']('run\x20job',_0x3ebbe8[_0x1ac566][_0x1fd4('0x16')],_0x3ebbe8[_0x1ac566][_0x1fd4('0x4c')]);}else if(_0x3ebbe8[_0x1ac566][_0x1fd4('0x4c')]&&_0x3ebbe8[_0x1ac566]['active']&&moment()[_0x1fd4('0x4d')](_0x3ebbe8[_0x1ac566][_0x1fd4('0x4e')],_0x3ebbe8[_0x1ac566][_0x1fd4('0x4f')])){manager[_0x1fd4('0x50')](_0x1ac566,_0x3ebbe8[_0x1ac566][_0x1fd4('0x4c')],handleJob(_0x3ebbe8[_0x1ac566]));manager['start'](_0x1ac566);logger[_0x1fd4('0x29')](_0x1fd4('0x51'),_0x3ebbe8[_0x1ac566][_0x1fd4('0x16')],_0x3ebbe8[_0x1ac566][_0x1fd4('0x4c')]);}else if(manager[_0x1fd4('0x45')](_0x1ac566)){manager['stop'](_0x1ac566);manager['deleteJob'](_0x1ac566);logger[_0x1fd4('0x29')](_0x1fd4('0x52'),_0x3ebbe8[_0x1ac566][_0x1fd4('0x16')],_0x3ebbe8[_0x1ac566]['cron']);}}for(_0x122474=0x0,_0x1ac566;_0x122474<_0x14076d[_0x1fd4('0x44')]&&!_0xaf29c4;_0x122474+=0x1){_0x1ac566=_0x14076d[_0x122474][_0x1fd4('0x41')]();if(manager[_0x1fd4('0x45')](_0x1ac566)){if(_0x3ebbe8[_0x1ac566][_0x1fd4('0x4c')]&&_0x3ebbe8[_0x1ac566][_0x1fd4('0x53')]&&moment()['isBetween'](_0x3ebbe8[_0x1ac566][_0x1fd4('0x4e')],_0x3ebbe8[_0x1ac566][_0x1fd4('0x4f')])){manager[_0x1fd4('0x54')](_0x1ac566,_0x3ebbe8[_0x1ac566][_0x1fd4('0x4c')],handleJob(_0x3ebbe8[_0x1ac566]));logger[_0x1fd4('0x29')](_0x1fd4('0x55'),_0x3ebbe8[_0x1ac566]['name'],_0x3ebbe8[_0x1ac566][_0x1fd4('0x4c')]);}else{manager['stop'](_0x1ac566);manager[_0x1fd4('0x46')](_0x1ac566);logger['info'](_0x1fd4('0x52'),_0x3ebbe8[_0x1ac566][_0x1fd4('0x16')],_0x3ebbe8[_0x1ac566][_0x1fd4('0x4c')]);}}}})[_0x1fd4('0x2d')](function(_0xea62da){logger[_0x1fd4('0x2b')](JSON[_0x1fd4('0x25')](_0xea62da));});}exports['run']=function(_0x562f0b){return getJobs(_0x562f0b);};exports[_0x1fd4('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0302=['attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','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','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','keys','toString','keyBy','difference','intersection','exists','stop','delete\x20cron','length','index','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','update','update\x20cron','stop\x20cron','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','existsSync','status','Sent','message'];(function(_0x5e6638,_0x513466){var _0x487a35=function(_0x17645e){while(--_0x17645e){_0x5e6638['push'](_0x5e6638['shift']());}};_0x487a35(++_0x513466);}(_0x0302,0x1a7));var _0x2030=function(_0x1fdac3,_0x3adfa9){_0x1fdac3=_0x1fdac3-0x0;var _0x409dd5=_0x0302[_0x1fdac3];return _0x409dd5;};'use strict';var fs=require('fs');var util=require(_0x2030('0x0'));var path=require(_0x2030('0x1'));var _=require(_0x2030('0x2'));var moment=require(_0x2030('0x3'));var CronJobManager=require(_0x2030('0x4'));var jayson=require(_0x2030('0x5'));var BPromise=require(_0x2030('0x6'));var logger=require(_0x2030('0x7'))(_0x2030('0x8'));var db=require(_0x2030('0x9'))['db'];var analyticCustomReportController=require(_0x2030('0xa'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x2030('0xb')][_0x2030('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x117913,_0x4b07ed){return function(){logger['info'](_0x2030('0xd'),_0x117913['email']);var _0x1d1c71=!![];var _0x35bcb9={'tls':{'rejectUnauthorized':![]}};if(_0x117913[_0x2030('0xe')][_0x2030('0xf')]['service']){_0x35bcb9['service']=_0x117913[_0x2030('0xe')]['Smtp'][_0x2030('0x10')];}else{_0x35bcb9[_0x2030('0x11')]=_0x117913[_0x2030('0xe')]['Smtp'][_0x2030('0x11')];_0x35bcb9['port']=_0x117913['MailAccount']['Smtp'][_0x2030('0x12')];_0x35bcb9[_0x2030('0x13')]=_0x117913[_0x2030('0xe')]['Smtp'][_0x2030('0x13')];}if(_0x117913[_0x2030('0xe')][_0x2030('0xf')][_0x2030('0x14')]){_0x35bcb9[_0x2030('0x15')]={'user':_0x117913[_0x2030('0xe')][_0x2030('0xf')][_0x2030('0x16')],'pass':_0x117913['MailAccount'][_0x2030('0xf')][_0x2030('0x17')]};}var _0x20279b={'account':_0x35bcb9,'message':{'from':util[_0x2030('0x18')](_0x2030('0x19'),_0x117913[_0x2030('0xe')][_0x2030('0x1a')],_0x117913['MailAccount'][_0x2030('0x1b')]||_0x117913['MailAccount'][_0x2030('0xf')][_0x2030('0x16')]),'to':_0x117913[_0x2030('0x1b')],'cc':_0x117913['cc'],'bcc':_0x117913[_0x2030('0x1c')],'subject':util[_0x2030('0x18')](_0x2030('0x1d'),_0x4b07ed['name'],_0x117913[_0x2030('0x1e')],_0x117913[_0x2030('0x1f')])}};var _0x4418cd=path[_0x2030('0x20')](__dirname,_0x2030('0x21'));var _0x4c617b=_0x4b07ed['savename'];var _0x20c729=util[_0x2030('0x18')](_0x2030('0x22'),path[_0x2030('0x23')](_0x4b07ed[_0x2030('0x24')],path[_0x2030('0x25')](_0x4b07ed[_0x2030('0x24')])),'zip');var _0x1a19e3=path[_0x2030('0x20')](_0x4418cd,_0x4c617b);var _0x55b76e=path[_0x2030('0x20')](_0x4418cd,_0x20c729);if(fs[_0x2030('0x26')](_0x1a19e3)){_0x4b07ed[_0x2030('0x27')]=_0x2030('0x28');_0x20279b[_0x2030('0x29')][_0x2030('0x2a')]=[{'filename':_0x4c617b,'path':_0x1a19e3}];_0x20279b[_0x2030('0x29')][_0x2030('0x2b')]=util[_0x2030('0x18')](_0x2030('0x2c'),JSON['stringify'](_0x4b07ed,null,0x2));}else if(fs[_0x2030('0x26')](_0x55b76e)){_0x4b07ed[_0x2030('0x27')]=_0x2030('0x28');_0x20279b[_0x2030('0x29')][_0x2030('0x2a')]=[{'filename':_0x20c729,'path':_0x55b76e}];}else{_0x20279b[_0x2030('0x29')]['text']=_0x2030('0x2d');if(!_0x117913[_0x2030('0x2e')]){_0x1d1c71=![];logger[_0x2030('0x2f')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1d1c71){return client[_0x2030('0x30')](_0x2030('0x31'),_0x20279b)[_0x2030('0x32')](function(_0x4eb53d){if(_0x4eb53d['error']){return logger[_0x2030('0x33')](_0x2030('0x34'),JSON[_0x2030('0x35')](_0x4eb53d));}return logger[_0x2030('0x2f')](_0x2030('0x36'));})[_0x2030('0x37')](function(_0x3eae12){return logger[_0x2030('0x33')](_0x2030('0x34'),JSON[_0x2030('0x35')](_0x3eae12));});}};}function handleError(){return function(_0x4cfb4a){return logger[_0x2030('0x33')](JSON[_0x2030('0x35')](_0x4cfb4a));};}function handleResult(_0x5b4d39){return function(_0x2173d5){logger[_0x2030('0x2f')](_0x2030('0x38'),JSON['stringify'](_0x2173d5));if(_0x5b4d39[_0x2030('0xe')]&&_0x5b4d39[_0x2030('0xe')][_0x2030('0xf')]&&!_[_0x2030('0x39')](_0x5b4d39[_0x2030('0x1b')])){setTimeout(handleSendEmail(_0x5b4d39,_0x2173d5),0x3c*0x3e8);}};}function handleJob(_0xec7453){return function(){try{if(_[_0x2030('0x39')](_0xec7453['subtractNumber'])){return logger['info'](_0x2030('0x3a'));}if(_[_0x2030('0x39')](_0xec7453[_0x2030('0x1f')])){return logger[_0x2030('0x2f')]('subtractUnit\x20null\x20or\x20undefined');}var _0x4b48ca={'startDate':moment()[_0x2030('0x3b')](_0xec7453[_0x2030('0x1e')],_0xec7453[_0x2030('0x1f')])[_0x2030('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x2030('0x18')](_0x2030('0x3c')),'type':_0x2030('0x3d'),'output':_0xec7453[_0x2030('0x3e')],'name':_0xec7453[_0x2030('0x1a')]};if(!_[_0x2030('0x39')](_0xec7453[_0x2030('0x3f')])){logger[_0x2030('0x2f')](_0x2030('0x40'),_0xec7453[_0x2030('0x3f')]);return analyticDefaultReportController[_0x2030('0x41')]({'id':_0xec7453[_0x2030('0x3f')]},_0x4b48ca)[_0x2030('0x32')](handleResult(_0xec7453))[_0x2030('0x37')](handleError());}if(!_[_0x2030('0x39')](_0xec7453[_0x2030('0x42')])){logger[_0x2030('0x2f')](_0x2030('0x43'),_0xec7453[_0x2030('0x42')]);return analyticCustomReportController[_0x2030('0x41')]({'id':_0xec7453[_0x2030('0x42')]},_0x4b48ca)[_0x2030('0x32')](handleResult(_0xec7453))[_0x2030('0x37')](handleError());}}catch(_0x1a1822){logger[_0x2030('0x33')](JSON[_0x2030('0x35')](_0x1a1822));}return logger[_0x2030('0x2f')]('no\x20report\x20id');};}function getJobs(_0x446393){var _0x4984d3={};if(_0x446393){_0x4984d3['id']=_0x446393;}return db[_0x2030('0x44')][_0x2030('0x45')]({'where':_0x4984d3,'include':[{'model':db['MailAccount'],'attributes':['id',_0x2030('0x1a'),_0x2030('0x1b')],'include':[{'model':db[_0x2030('0x46')],'as':_0x2030('0xf')}]}]})[_0x2030('0x32')](function(_0xf0709e){var _0x49727b=_[_0x2030('0x47')](manager['jobs']);var _0x111f29=_['map'](_0xf0709e,function(_0x5a8661){return _0x5a8661['id'][_0x2030('0x48')]();});var _0x3833c8=_[_0x2030('0x49')](_0xf0709e,function(_0xbd9a42){return _0xbd9a42['id'][_0x2030('0x48')]();});var _0x1f44d4=_0x446393?_0x111f29:_[_0x2030('0x4a')](_0x111f29,_0x49727b);var _0x344b98=_[_0x2030('0x4b')](_0x111f29,_0x49727b);var _0x27dd87=_[_0x2030('0x4a')](_0x49727b,_0x111f29);var _0x27176c;var _0x1e4101;for(_0x27176c=0x0;_0x27176c<_0x27dd87['length']&&!_0x446393;_0x27176c+=0x1){_0x1e4101=_0x27dd87[_0x27176c]['toString']();if(manager[_0x2030('0x4c')](_0x1e4101)){manager[_0x2030('0x4d')](_0x1e4101);manager['deleteJob'](_0x1e4101);logger[_0x2030('0x2f')](_0x2030('0x4e'),_0x1e4101);}}logger['info']('toRun',JSON[_0x2030('0x35')](_0x1f44d4));for(_0x27176c=0x0;_0x27176c<_0x1f44d4[_0x2030('0x4f')];_0x27176c+=0x1){_0x1e4101=_0x1f44d4[_0x27176c][_0x2030('0x48')]();logger['info'](_0x2030('0x50'),_0x1e4101);if(_0x446393){logger['info']('my\x20id',_0x446393);logger['info'](JSON[_0x2030('0x35')](_0x3833c8[_0x1e4101]));BPromise['resolve']()[_0x2030('0x32')](handleJob(_0x3833c8[_0x1e4101]));logger[_0x2030('0x2f')]('run\x20job',_0x3833c8[_0x1e4101]['name'],_0x3833c8[_0x1e4101][_0x2030('0x51')]);}else if(_0x3833c8[_0x1e4101][_0x2030('0x51')]&&_0x3833c8[_0x1e4101][_0x2030('0x52')]&&moment()[_0x2030('0x53')](_0x3833c8[_0x1e4101][_0x2030('0x54')],_0x3833c8[_0x1e4101][_0x2030('0x55')])){manager[_0x2030('0x56')](_0x1e4101,_0x3833c8[_0x1e4101][_0x2030('0x51')],handleJob(_0x3833c8[_0x1e4101]));manager[_0x2030('0x57')](_0x1e4101);logger[_0x2030('0x2f')](_0x2030('0x58'),_0x3833c8[_0x1e4101][_0x2030('0x1a')],_0x3833c8[_0x1e4101][_0x2030('0x51')]);}else if(manager['exists'](_0x1e4101)){manager[_0x2030('0x4d')](_0x1e4101);manager[_0x2030('0x59')](_0x1e4101);logger[_0x2030('0x2f')]('stop\x20cron',_0x3833c8[_0x1e4101][_0x2030('0x1a')],_0x3833c8[_0x1e4101][_0x2030('0x51')]);}}for(_0x27176c=0x0,_0x1e4101;_0x27176c<_0x344b98['length']&&!_0x446393;_0x27176c+=0x1){_0x1e4101=_0x344b98[_0x27176c]['toString']();if(manager[_0x2030('0x4c')](_0x1e4101)){if(_0x3833c8[_0x1e4101][_0x2030('0x51')]&&_0x3833c8[_0x1e4101][_0x2030('0x52')]&&moment()[_0x2030('0x53')](_0x3833c8[_0x1e4101][_0x2030('0x54')],_0x3833c8[_0x1e4101][_0x2030('0x55')])){manager[_0x2030('0x5a')](_0x1e4101,_0x3833c8[_0x1e4101][_0x2030('0x51')],handleJob(_0x3833c8[_0x1e4101]));logger[_0x2030('0x2f')](_0x2030('0x5b'),_0x3833c8[_0x1e4101][_0x2030('0x1a')],_0x3833c8[_0x1e4101][_0x2030('0x51')]);}else{manager[_0x2030('0x4d')](_0x1e4101);manager[_0x2030('0x59')](_0x1e4101);logger['info'](_0x2030('0x5c'),_0x3833c8[_0x1e4101]['name'],_0x3833c8[_0x1e4101][_0x2030('0x51')]);}}}})[_0x2030('0x37')](function(_0x301a6c){logger[_0x2030('0x33')](JSON[_0x2030('0x35')](_0x301a6c));});}exports['run']=function(_0x6ffd32){return getJobs(_0x6ffd32);};exports[_0x2030('0x57')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 6befa22..c0d4676 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 _0xb7c1=['transcripts','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','language','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','length'];(function(_0x21f626,_0x4a3bef){var _0x3806c8=function(_0x85decc){while(--_0x85decc){_0x21f626['push'](_0x21f626['shift']());}};_0x3806c8(++_0x4a3bef);}(_0xb7c1,0xbc));var _0x1b7c=function(_0x234d10,_0x6fdf30){_0x234d10=_0x234d10-0x0;var _0x5a5ad3=_0xb7c1[_0x234d10];return _0x5a5ad3;};var _=require(_0x1b7c('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x1b7c('0x1'));var BPromise=require(_0x1b7c('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x1b7c('0x3'))(_0x1b7c('0x4'));function getTranscriptionJob(_0x37d746,_0x5791e1,_0x546f7c,_0xcf7f0c){return new Promise(function(_0x1fe0bf,_0x324334){var _0x3155f4=new AWS[(_0x1b7c('0x5'))]({'accessKeyId':_0x5791e1,'secretAccessKey':_0x37d746,'region':_0x546f7c});_0x3155f4[_0x1b7c('0x6')]({'TranscriptionJobName':_0xcf7f0c},function(_0x49435e,_0x47d6a5){if(_0x49435e){return _0x324334(_0x49435e);}else{return _0x1fe0bf(_0x47d6a5);}});});}function sentiment(_0x2c855f,_0x5c2e24,_0x379a4a,_0x54837e,_0x4d4936){return new Promise(function(_0x1cbdc3,_0x36291d){var _0x261210=new AWS['Comprehend']({'accessKeyId':_0x5c2e24,'secretAccessKey':_0x2c855f,'region':_0x379a4a});_0x261210[_0x1b7c('0x7')]({'Text':_0x54837e,'LanguageCode':_0x4d4936[_0x1b7c('0x8')](0x0,0x2)},function(_0x3e1855,_0x316c92){if(_0x3e1855){return _0x36291d(_0x3e1855);}else{return _0x1cbdc3(_0x316c92);}});});}function checkTranscribeJob(_0x2085b9,_0x507322,_0x124dcc){var _0x13b762;return new BPromise(function(_0x252e55,_0x366242){logger[_0x1b7c('0x9')](util[_0x1b7c('0xa')](_0x1b7c('0xb'),_0x2085b9['id'],_0x2085b9['transcribeName']));return getTranscriptionJob(_0x124dcc[_0x1b7c('0xc')],_0x124dcc[_0x1b7c('0xd')],_0x507322[_0x1b7c('0xe')],_0x2085b9[_0x1b7c('0xf')])['then'](function(_0x5f4d34){logger[_0x1b7c('0x9')](util[_0x1b7c('0xa')](_0x1b7c('0x10'),_0x2085b9['id'],_0x2085b9[_0x1b7c('0xf')],_0x5f4d34[_0x1b7c('0x11')][_0x1b7c('0x12')]));if(!_0x2085b9[_0x1b7c('0x13')]){switch(_0x5f4d34['TranscriptionJob'][_0x1b7c('0x12')]){case _0x1b7c('0x14'):var _0x4a8e0d={'transcribeStatus':_0x5f4d34['TranscriptionJob'][_0x1b7c('0x12')],'fileUri':_0x5f4d34['TranscriptionJob'][_0x1b7c('0x15')][_0x1b7c('0x16')]};logger[_0x1b7c('0x9')](util[_0x1b7c('0xa')](_0x1b7c('0x17'),_0x2085b9['id']));return rp({'uri':_0x5f4d34['TranscriptionJob'][_0x1b7c('0x15')][_0x1b7c('0x16')],'json':!![]})[_0x1b7c('0x18')](function(_0x33e006){logger[_0x1b7c('0x9')](util[_0x1b7c('0xa')](_0x1b7c('0x19'),_0x2085b9['id']));if(_0x33e006&&_0x33e006[_0x1b7c('0x1a')]&&_0x33e006[_0x1b7c('0x1a')]['transcripts']&&_0x33e006[_0x1b7c('0x1a')]['transcripts'][_0x1b7c('0x1b')]){_0x4a8e0d[_0x1b7c('0x13')]='';for(var _0x34a007=0x0;_0x34a007<_0x33e006['results'][_0x1b7c('0x1c')][_0x1b7c('0x1b')];_0x34a007++){_0x4a8e0d['fileText']+=_0x33e006[_0x1b7c('0x1a')][_0x1b7c('0x1c')][_0x34a007]['transcript']+'';}}return _0x2085b9[_0x1b7c('0x1d')](_0x4a8e0d);})[_0x1b7c('0x18')](function(){logger[_0x1b7c('0x9')](util[_0x1b7c('0xa')](_0x1b7c('0x1e'),_0x2085b9['id']));if(!_0x2085b9[_0x1b7c('0x1f')]){throw new db[(_0x1b7c('0x20'))]['ValidationError'](_0x1b7c('0x21'));}if(!_0x507322['sentiment']||!_0x507322[_0x1b7c('0x22')]||!_0x507322[_0x1b7c('0x23')]||!_0x507322['language']||!_0x507322[_0x1b7c('0x24')]){throw new db[(_0x1b7c('0x20'))]['ValidationError'](_0x1b7c('0x25'));}if(!_0x4a8e0d['fileText']){throw new Error(_0x1b7c('0x26'));}if(_0x507322[_0x1b7c('0x22')]===_0x124dcc['id']){return _0x124dcc;}else{return db[_0x1b7c('0x27')][_0x1b7c('0x28')]({'where':{'id':_settings[_0x1b7c('0x22')]}});}})[_0x1b7c('0x18')](function(_0x3d4a59){if(!_0x3d4a59){throw new db[(_0x1b7c('0x20'))][(_0x1b7c('0x29'))](_0x1b7c('0x2a'));}if(!_0x3d4a59[_0x1b7c('0xc')]||!_0x3d4a59[_0x1b7c('0xd')]){throw new db[(_0x1b7c('0x20'))]['ValidationError'](_0x1b7c('0x2b'));}_0x13b762=_0x3d4a59;logger[_0x1b7c('0x9')](util[_0x1b7c('0xa')](_0x1b7c('0x2c'),_0x2085b9['id']));return sentiment(_0x13b762[_0x1b7c('0xc')],_0x13b762[_0x1b7c('0xd')],_0x507322[_0x1b7c('0x23')],_0x4a8e0d[_0x1b7c('0x13')],_0x507322['language']);})[_0x1b7c('0x18')](function(_0x18d22f){logger[_0x1b7c('0x9')](util['format'](_0x1b7c('0x2d'),_0x2085b9['id']));return _0x2085b9['update']({'sentiment':_0x18d22f[_0x1b7c('0x2e')],'sPositive':_0x18d22f[_0x1b7c('0x2f')][_0x1b7c('0x30')],'sNegative':_0x18d22f[_0x1b7c('0x2f')][_0x1b7c('0x31')],'sMixed':_0x18d22f[_0x1b7c('0x2f')][_0x1b7c('0x32')],'sNeutral':_0x18d22f[_0x1b7c('0x2f')][_0x1b7c('0x33')]});})[_0x1b7c('0x18')](function(){logger[_0x1b7c('0x9')](util['format'](_0x1b7c('0x1e'),_0x2085b9['id']));_0x252e55();});case'FAILED':return _0x2085b9['update']({'transcribeStatus':'FAILED','failureReason':_0x5f4d34[_0x1b7c('0x11')][_0x1b7c('0x34')]})[_0x1b7c('0x18')](function(){logger[_0x1b7c('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2085b9['id']));_0x252e55();});default:logger[_0x1b7c('0x9')](util['format'](_0x1b7c('0x35'),_0x2085b9['id']));break;}}else{return BPromise[_0x1b7c('0x36')]()[_0x1b7c('0x18')](function(){if(!_0x2085b9[_0x1b7c('0x1f')]){throw new db['Sequelize'][(_0x1b7c('0x29'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x507322[_0x1b7c('0x37')]||!_0x507322['sentimentAccountId']||!_0x507322[_0x1b7c('0x23')]||!_0x507322['language']||!_0x507322[_0x1b7c('0x24')]){throw new db['Sequelize']['ValidationError'](_0x1b7c('0x25'));}if(!_0x2085b9[_0x1b7c('0x13')]){throw new Error(_0x1b7c('0x26'));}if(_0x507322[_0x1b7c('0x22')]===_0x124dcc['id']){return _0x124dcc;}else{return db[_0x1b7c('0x27')][_0x1b7c('0x28')]({'where':{'id':_settings[_0x1b7c('0x22')]}});}})[_0x1b7c('0x18')](function(_0x1b3d67){if(!_0x1b3d67){throw new db[(_0x1b7c('0x20'))][(_0x1b7c('0x29'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1b3d67['data1']||!_0x1b3d67[_0x1b7c('0xd')]){throw new db[(_0x1b7c('0x20'))][(_0x1b7c('0x29'))]('Cloud\x20Provider\x20not\x20configured');}_0x13b762=_0x1b3d67;logger[_0x1b7c('0x9')](util[_0x1b7c('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2085b9['id']));return sentiment(_0x13b762[_0x1b7c('0xc')],_0x13b762[_0x1b7c('0xd')],_0x507322[_0x1b7c('0x23')],_0x2085b9['fileText'],_0x507322[_0x1b7c('0x38')]);})[_0x1b7c('0x18')](function(_0x5e2e50){logger['info'](util[_0x1b7c('0xa')](_0x1b7c('0x2d'),_0x2085b9['id']));return _0x2085b9[_0x1b7c('0x1d')]({'sentiment':_0x5e2e50['Sentiment'],'sPositive':_0x5e2e50[_0x1b7c('0x2f')][_0x1b7c('0x30')],'sNegative':_0x5e2e50['SentimentScore'][_0x1b7c('0x31')],'sMixed':_0x5e2e50[_0x1b7c('0x2f')][_0x1b7c('0x32')],'sNeutral':_0x5e2e50[_0x1b7c('0x2f')][_0x1b7c('0x33')],'transcribeStatus':'COMPLETED'});})[_0x1b7c('0x18')](function(){logger[_0x1b7c('0x9')](util[_0x1b7c('0xa')](_0x1b7c('0x1e'),_0x2085b9['id']));_0x252e55();});}})[_0x1b7c('0x39')](function(_0xa75534){if(_0xa75534){if(!_0xa75534[_0x1b7c('0x3a')]||_0xa75534[_0x1b7c('0x3a')]!==_0x1b7c('0x3b')){logger[_0x1b7c('0x3c')](util[_0x1b7c('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2085b9['id']),util[_0x1b7c('0x3d')](_0xa75534,{'showHidden':![],'depth':null}));}}_0x252e55();});});}function checkTranscribe(){var _0x26b51e;var _0x1a2938;var _0x39ce8d;return db[_0x1b7c('0x3e')]['findAll']({'where':{'transcribeStatus':_0x1b7c('0x3f')}})[_0x1b7c('0x18')](function(_0x9df332){if(!_0x9df332||!_0x9df332['length']){throw new db[(_0x1b7c('0x20'))]['ValidationError'](_0x1b7c('0x40'));}_0x26b51e=_0x9df332;return db['Setting'][_0x1b7c('0x28')]({'where':{'id':0x1}});})[_0x1b7c('0x18')](function(_0x4421f1){if(!_0x4421f1){throw new db[(_0x1b7c('0x20'))]['ValidationError'](_0x1b7c('0x41'));}_0x1a2938=_0x4421f1;if(!_0x1a2938[_0x1b7c('0x4')]||!_0x1a2938[_0x1b7c('0x42')]||!_0x1a2938['transcribeRegion']||!_0x1a2938['language']||!_0x1a2938['bucket']){throw new db[(_0x1b7c('0x20'))]['ValidationError'](_0x1b7c('0x43'));}return db[_0x1b7c('0x27')][_0x1b7c('0x28')]({'where':{'id':_0x1a2938[_0x1b7c('0x42')]}});})[_0x1b7c('0x18')](function(_0x35a666){if(!_0x35a666){throw new db[(_0x1b7c('0x20'))][(_0x1b7c('0x29'))](_0x1b7c('0x2a'));}if(!_0x35a666['data1']||!_0x35a666[_0x1b7c('0xd')]){throw new db[(_0x1b7c('0x20'))][(_0x1b7c('0x29'))](_0x1b7c('0x2b'));}_0x39ce8d=_0x35a666;var _0x4e5d08=[];_0x26b51e[_0x1b7c('0x44')](function(_0x5cc20d){_0x4e5d08[_0x1b7c('0x45')](checkTranscribeJob(_0x5cc20d,_0x1a2938,_0x39ce8d));});return BPromise[_0x1b7c('0x46')](_0x4e5d08);})['catch'](function(_0x3863b8){if(_0x3863b8){if(!_0x3863b8[_0x1b7c('0x3a')]||_0x3863b8[_0x1b7c('0x3a')]!=='SequelizeValidationError'){logger[_0x1b7c('0x3c')](util[_0x1b7c('0x3d')](_0x3863b8,{'showHidden':![],'depth':null}));}}});}exports[_0x1b7c('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xc892=['../../config/logger','transcribe','TranscribeService','getTranscriptionJob','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeRegion','then','info','transcribeName','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason','resolve','tempSentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Negative','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','util','../../mysqldb'];(function(_0x58204c,_0x371eaa){var _0x25102a=function(_0x35e78d){while(--_0x35e78d){_0x58204c['push'](_0x58204c['shift']());}};_0x25102a(++_0x371eaa);}(_0xc892,0x1ac));var _0x2c89=function(_0x14a8f0,_0x337965){_0x14a8f0=_0x14a8f0-0x0;var _0x5172c6=_0xc892[_0x14a8f0];return _0x5172c6;};var _=require(_0x2c89('0x0'));var AWS=require(_0x2c89('0x1'));var rp=require('request-promise');var util=require(_0x2c89('0x2'));var BPromise=require('bluebird');var db=require(_0x2c89('0x3'))['db'];var logger=require(_0x2c89('0x4'))(_0x2c89('0x5'));function getTranscriptionJob(_0x293230,_0x5ae252,_0x53789c,_0x4a63a1){return new Promise(function(_0x5ea91f,_0x4b7189){var _0x55a592=new AWS[(_0x2c89('0x6'))]({'accessKeyId':_0x5ae252,'secretAccessKey':_0x293230,'region':_0x53789c});_0x55a592[_0x2c89('0x7')]({'TranscriptionJobName':_0x4a63a1},function(_0x25242c,_0x5ba95a){if(_0x25242c){return _0x4b7189(_0x25242c);}else{return _0x5ea91f(_0x5ba95a);}});});}function sentiment(_0x1e0ecb,_0x45195b,_0x3ca4d5,_0x42e99f,_0x179740){return new Promise(function(_0x4c3921,_0x4eb3ce){var _0x32fd14=new AWS['Comprehend']({'accessKeyId':_0x45195b,'secretAccessKey':_0x1e0ecb,'region':_0x3ca4d5});_0x32fd14['detectSentiment']({'Text':_0x42e99f,'LanguageCode':_0x179740[_0x2c89('0x8')](0x0,0x2)},function(_0x316212,_0x3d7636){if(_0x316212){return _0x4eb3ce(_0x316212);}else{return _0x4c3921(_0x3d7636);}});});}function checkTranscribeJob(_0x3c3988,_0x500039,_0x10c6e3){var _0x479429;return new BPromise(function(_0x434eb0,_0x4b5dbf){logger['info'](util[_0x2c89('0x9')](_0x2c89('0xa'),_0x3c3988['id'],_0x3c3988['transcribeName']));return getTranscriptionJob(_0x10c6e3['data1'],_0x10c6e3['data2'],_0x500039[_0x2c89('0xb')],_0x3c3988['transcribeName'])[_0x2c89('0xc')](function(_0x2e8096){logger[_0x2c89('0xd')](util[_0x2c89('0x9')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3c3988['id'],_0x3c3988[_0x2c89('0xe')],_0x2e8096['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x3c3988[_0x2c89('0xf')]){switch(_0x2e8096[_0x2c89('0x10')][_0x2c89('0x11')]){case _0x2c89('0x12'):var _0x3b06b7={'transcribeStatus':_0x2e8096[_0x2c89('0x10')][_0x2c89('0x11')],'fileUri':_0x2e8096[_0x2c89('0x10')][_0x2c89('0x13')][_0x2c89('0x14')]};logger[_0x2c89('0xd')](util[_0x2c89('0x9')](_0x2c89('0x15'),_0x3c3988['id']));return rp({'uri':_0x2e8096[_0x2c89('0x10')][_0x2c89('0x13')][_0x2c89('0x14')],'json':!![]})['then'](function(_0x1539a8){logger[_0x2c89('0xd')](util[_0x2c89('0x9')](_0x2c89('0x16'),_0x3c3988['id']));if(_0x1539a8&&_0x1539a8['results']&&_0x1539a8['results'][_0x2c89('0x17')]&&_0x1539a8[_0x2c89('0x18')][_0x2c89('0x17')][_0x2c89('0x19')]){_0x3b06b7['fileText']='';for(var _0x2e6c32=0x0;_0x2e6c32<_0x1539a8[_0x2c89('0x18')][_0x2c89('0x17')][_0x2c89('0x19')];_0x2e6c32++){_0x3b06b7['fileText']+=_0x1539a8['results']['transcripts'][_0x2e6c32][_0x2c89('0x1a')]+'';}}return _0x3c3988[_0x2c89('0x1b')](_0x3b06b7);})[_0x2c89('0xc')](function(){logger[_0x2c89('0xd')](util[_0x2c89('0x9')](_0x2c89('0x1c'),_0x3c3988['id']));if(!_0x3c3988['tempSentiment']){throw new db[(_0x2c89('0x1d'))][(_0x2c89('0x1e'))](_0x2c89('0x1f'));}if(!_0x500039[_0x2c89('0x20')]||!_0x500039[_0x2c89('0x21')]||!_0x500039[_0x2c89('0x22')]||!_0x500039[_0x2c89('0x23')]||!_0x500039['bucket']){throw new db[(_0x2c89('0x1d'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3b06b7[_0x2c89('0xf')]){throw new Error('Transcript\x20not\x20available');}if(_0x500039[_0x2c89('0x21')]===_0x10c6e3['id']){return _0x10c6e3;}else{return db['CloudProvider'][_0x2c89('0x24')]({'where':{'id':_settings[_0x2c89('0x21')]}});}})['then'](function(_0x9b7434){if(!_0x9b7434){throw new db['Sequelize'][(_0x2c89('0x1e'))](_0x2c89('0x25'));}if(!_0x9b7434['data1']||!_0x9b7434[_0x2c89('0x26')]){throw new db['Sequelize'][(_0x2c89('0x1e'))](_0x2c89('0x27'));}_0x479429=_0x9b7434;logger[_0x2c89('0xd')](util[_0x2c89('0x9')](_0x2c89('0x28'),_0x3c3988['id']));return sentiment(_0x479429[_0x2c89('0x29')],_0x479429['data2'],_0x500039[_0x2c89('0x22')],_0x3b06b7[_0x2c89('0xf')],_0x500039[_0x2c89('0x23')]);})['then'](function(_0x255505){logger[_0x2c89('0xd')](util[_0x2c89('0x9')](_0x2c89('0x2a'),_0x3c3988['id']));return _0x3c3988[_0x2c89('0x1b')]({'sentiment':_0x255505[_0x2c89('0x2b')],'sPositive':_0x255505[_0x2c89('0x2c')][_0x2c89('0x2d')],'sNegative':_0x255505[_0x2c89('0x2c')]['Negative'],'sMixed':_0x255505[_0x2c89('0x2c')][_0x2c89('0x2e')],'sNeutral':_0x255505[_0x2c89('0x2c')]['Neutral']});})[_0x2c89('0xc')](function(){logger[_0x2c89('0xd')](util[_0x2c89('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3c3988['id']));_0x434eb0();});case _0x2c89('0x2f'):return _0x3c3988['update']({'transcribeStatus':'FAILED','failureReason':_0x2e8096['TranscriptionJob'][_0x2c89('0x30')]})[_0x2c89('0xc')](function(){logger[_0x2c89('0xd')](util[_0x2c89('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3c3988['id']));_0x434eb0();});default:logger['info'](util[_0x2c89('0x9')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3c3988['id']));break;}}else{return BPromise[_0x2c89('0x31')]()[_0x2c89('0xc')](function(){if(!_0x3c3988[_0x2c89('0x32')]){throw new db['Sequelize'][(_0x2c89('0x1e'))](_0x2c89('0x1f'));}if(!_0x500039['sentiment']||!_0x500039[_0x2c89('0x21')]||!_0x500039[_0x2c89('0x22')]||!_0x500039[_0x2c89('0x23')]||!_0x500039[_0x2c89('0x33')]){throw new db['Sequelize'][(_0x2c89('0x1e'))](_0x2c89('0x34'));}if(!_0x3c3988[_0x2c89('0xf')]){throw new Error(_0x2c89('0x35'));}if(_0x500039[_0x2c89('0x21')]===_0x10c6e3['id']){return _0x10c6e3;}else{return db[_0x2c89('0x36')][_0x2c89('0x24')]({'where':{'id':_settings[_0x2c89('0x21')]}});}})['then'](function(_0x1525f6){if(!_0x1525f6){throw new db['Sequelize'][(_0x2c89('0x1e'))](_0x2c89('0x25'));}if(!_0x1525f6['data1']||!_0x1525f6['data2']){throw new db['Sequelize'][(_0x2c89('0x1e'))](_0x2c89('0x27'));}_0x479429=_0x1525f6;logger[_0x2c89('0xd')](util[_0x2c89('0x9')](_0x2c89('0x28'),_0x3c3988['id']));return sentiment(_0x479429['data1'],_0x479429[_0x2c89('0x26')],_0x500039['sentimentRegion'],_0x3c3988['fileText'],_0x500039[_0x2c89('0x23')]);})[_0x2c89('0xc')](function(_0x2d2d95){logger['info'](util[_0x2c89('0x9')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3c3988['id']));return _0x3c3988[_0x2c89('0x1b')]({'sentiment':_0x2d2d95[_0x2c89('0x2b')],'sPositive':_0x2d2d95[_0x2c89('0x2c')][_0x2c89('0x2d')],'sNegative':_0x2d2d95[_0x2c89('0x2c')][_0x2c89('0x37')],'sMixed':_0x2d2d95[_0x2c89('0x2c')][_0x2c89('0x2e')],'sNeutral':_0x2d2d95[_0x2c89('0x2c')][_0x2c89('0x38')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x2c89('0xd')](util[_0x2c89('0x9')](_0x2c89('0x1c'),_0x3c3988['id']));_0x434eb0();});}})[_0x2c89('0x39')](function(_0x39437f){if(_0x39437f){if(!_0x39437f[_0x2c89('0x3a')]||_0x39437f[_0x2c89('0x3a')]!==_0x2c89('0x3b')){logger[_0x2c89('0x3c')](util[_0x2c89('0x9')](_0x2c89('0x3d'),_0x3c3988['id']),util[_0x2c89('0x3e')](_0x39437f,{'showHidden':![],'depth':null}));}}_0x434eb0();});});}function checkTranscribe(){var _0x17129c;var _0xc88e96;var _0x1410e4;return db[_0x2c89('0x3f')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x2c89('0xc')](function(_0x459136){if(!_0x459136||!_0x459136[_0x2c89('0x19')]){throw new db['Sequelize']['ValidationError'](_0x2c89('0x40'));}_0x17129c=_0x459136;return db[_0x2c89('0x41')][_0x2c89('0x24')]({'where':{'id':0x1}});})[_0x2c89('0xc')](function(_0x2fbbc6){if(!_0x2fbbc6){throw new db[(_0x2c89('0x1d'))]['ValidationError']('Settings\x20not\x20available');}_0xc88e96=_0x2fbbc6;if(!_0xc88e96['transcribe']||!_0xc88e96['transcribeAccountId']||!_0xc88e96[_0x2c89('0xb')]||!_0xc88e96[_0x2c89('0x23')]||!_0xc88e96[_0x2c89('0x33')]){throw new db[(_0x2c89('0x1d'))][(_0x2c89('0x1e'))](_0x2c89('0x42'));}return db[_0x2c89('0x36')][_0x2c89('0x24')]({'where':{'id':_0xc88e96[_0x2c89('0x43')]}});})[_0x2c89('0xc')](function(_0x40d0f1){if(!_0x40d0f1){throw new db[(_0x2c89('0x1d'))][(_0x2c89('0x1e'))](_0x2c89('0x25'));}if(!_0x40d0f1[_0x2c89('0x29')]||!_0x40d0f1[_0x2c89('0x26')]){throw new db[(_0x2c89('0x1d'))]['ValidationError'](_0x2c89('0x27'));}_0x1410e4=_0x40d0f1;var _0x1437e6=[];_0x17129c[_0x2c89('0x44')](function(_0x166e43){_0x1437e6[_0x2c89('0x45')](checkTranscribeJob(_0x166e43,_0xc88e96,_0x1410e4));});return BPromise[_0x2c89('0x46')](_0x1437e6);})[_0x2c89('0x39')](function(_0x42dace){if(_0x42dace){if(!_0x42dace[_0x2c89('0x3a')]||_0x42dace[_0x2c89('0x3a')]!==_0x2c89('0x3b')){logger[_0x2c89('0x3c')](util['inspect'](_0x42dace,{'showHidden':![],'depth':null}));}}});}exports[_0x2c89('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6895a6b..9e8eb32 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8094=['destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','hopper2','catch','../mysqldb','push','Biondo','now','Innocenzo','@xcally.com','CmContact'];(function(_0x3a4678,_0x2c08fd){var _0x3ba57c=function(_0x215216){while(--_0x215216){_0x3a4678['push'](_0x3a4678['shift']());}};_0x3ba57c(++_0x2c08fd);}(_0x8094,0x1a2));var _0x4809=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0x8094[_0x251d43];return _0x3d7759;};'use strict';var util=require('util');var db=require(_0x4809('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4809('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x4809('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4809('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x4809('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4809('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4809('0x1')]({'id':i,'firstName':_0x4809('0x4')+i,'lastName':_0x4809('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4809('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x4809('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4809('0x3')]()});}db[_0x4809('0x6')][_0x4809('0x7')]({'where':{}})[_0x4809('0x8')](function(){return db[_0x4809('0x6')][_0x4809('0x9')](contacts);})[_0x4809('0x8')](function(){console[_0x4809('0xa')]('finished\x20populating',_0x4809('0xb'));return db[_0x4809('0xc')][_0x4809('0x7')]({'where':{}});})[_0x4809('0x8')](function(){return db[_0x4809('0xc')]['bulkCreate'](hopper);})[_0x4809('0x8')](function(){console[_0x4809('0xa')](_0x4809('0xd'),_0x4809('0xe'));return db[_0x4809('0x6')][_0x4809('0x9')](contacts2);})[_0x4809('0x8')](function(){console[_0x4809('0xa')]('finished\x20populating','contacts2');return db[_0x4809('0xc')]['bulkCreate'](hopper2);})[_0x4809('0x8')](function(){console[_0x4809('0xa')](_0x4809('0xd'),_0x4809('0xf'));})[_0x4809('0x10')](function(_0x3a5d45){console[_0x4809('0xa')](_0x3a5d45);}); \ No newline at end of file +var _0xcff9=['Innocenzo','Biondo','innocenzo.biondo','push','now','CmContact','destroy','then','log','contacts1','CmHopper','bulkCreate','finished\x20populating','hopper1','contacts2','hopper2','../mysqldb'];(function(_0x23eec8,_0x5f27ce){var _0x337074=function(_0x39c049){while(--_0x39c049){_0x23eec8['push'](_0x23eec8['shift']());}};_0x337074(++_0x5f27ce);}(_0xcff9,0x197));var _0x9cff=function(_0x2e9a5a,_0x385693){_0x2e9a5a=_0x2e9a5a-0x0;var _0x34858a=_0xcff9[_0x2e9a5a];return _0x34858a;};'use strict';var util=require('util');var db=require(_0x9cff('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x9cff('0x1')+i,'lastName':_0x9cff('0x2')+i,'phone':0xf879fb460+i,'email':_0x9cff('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9cff('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x9cff('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9cff('0x5')](),'updatedAt':Date[_0x9cff('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9cff('0x4')]({'id':i,'firstName':_0x9cff('0x1')+i,'lastName':_0x9cff('0x2')+i,'phone':0xf879fb460+i,'email':_0x9cff('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9cff('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x9cff('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9cff('0x5')](),'updatedAt':Date[_0x9cff('0x5')]()});}db[_0x9cff('0x6')][_0x9cff('0x7')]({'where':{}})[_0x9cff('0x8')](function(){return db[_0x9cff('0x6')]['bulkCreate'](contacts);})[_0x9cff('0x8')](function(){console[_0x9cff('0x9')]('finished\x20populating',_0x9cff('0xa'));return db['CmHopper']['destroy']({'where':{}});})[_0x9cff('0x8')](function(){return db[_0x9cff('0xb')][_0x9cff('0xc')](hopper);})[_0x9cff('0x8')](function(){console[_0x9cff('0x9')](_0x9cff('0xd'),_0x9cff('0xe'));return db[_0x9cff('0x6')][_0x9cff('0xc')](contacts2);})[_0x9cff('0x8')](function(){console[_0x9cff('0x9')](_0x9cff('0xd'),_0x9cff('0xf'));return db[_0x9cff('0xb')]['bulkCreate'](hopper2);})['then'](function(){console[_0x9cff('0x9')]('finished\x20populating',_0x9cff('0x10'));})['catch'](function(_0x110765){console[_0x9cff('0x9')](_0x110765);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index bbd4860..740a752 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ddd=['password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','push','agent','format','%s%s','%s%s@xcally.com'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4ddd,0x1da));var _0xd4dd=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0x4ddd[_0x424501];return _0xb719af;};'use strict';var util=require(_0xd4dd('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd4dd('0x1')]({'name':util['format']('%s%s',_0xd4dd('0x2'),i),'fullname':util[_0xd4dd('0x3')](_0xd4dd('0x4'),_0xd4dd('0x2'),i),'email':util[_0xd4dd('0x3')](_0xd4dd('0x5'),_0xd4dd('0x2'),i),'role':'agent','password':_0xd4dd('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xd4dd('0x7'),'ws',_0xd4dd('0x8')],'disallow':[_0xd4dd('0x9')],'allow':[_0xd4dd('0xa')],'defaultuser':util[_0xd4dd('0x3')]('%s%s',_0xd4dd('0x2'),i),'encryption':_0xd4dd('0xb'),'avpf':_0xd4dd('0xb'),'force_avp':_0xd4dd('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xd4dd('0xc'),'dtlsprivatekey':_0xd4dd('0xd'),'dtlssetup':'actpass','callerid':util[_0xd4dd('0x3')](_0xd4dd('0xe'),util[_0xd4dd('0x3')]('%s%s',_0xd4dd('0x2'),i),0xfa0+i)});}db[_0xd4dd('0xf')][_0xd4dd('0x10')](users)['then'](function(){console[_0xd4dd('0x11')](_0xd4dd('0x12'));})[_0xd4dd('0x13')](function(_0x1d14fe){console[_0xd4dd('0x11')](_0x1d14fe);}); \ No newline at end of file +var _0xa13a=['util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa13a,0x19e));var _0xaa13=function(_0x119fae,_0x47c046){_0x119fae=_0x119fae-0x0;var _0x51d06d=_0xa13a[_0x119fae];return _0x51d06d;};'use strict';var util=require(_0xaa13('0x0'));var db=require(_0xaa13('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xaa13('0x2')]({'name':util[_0xaa13('0x3')]('%s%s','agent',i),'fullname':util[_0xaa13('0x3')](_0xaa13('0x4'),_0xaa13('0x5'),i),'email':util['format'](_0xaa13('0x6'),_0xaa13('0x5'),i),'role':_0xaa13('0x5'),'password':_0xaa13('0x7'),'internal':0xfa0+i,'type':_0xaa13('0x8'),'transport':['udp','ws',_0xaa13('0x9')],'disallow':[_0xaa13('0xa')],'allow':[_0xaa13('0xb')],'defaultuser':util['format']('%s%s',_0xaa13('0x5'),i),'encryption':_0xaa13('0xc'),'avpf':_0xaa13('0xc'),'force_avp':_0xaa13('0xc'),'icesupport':_0xaa13('0xc'),'dtlsenable':_0xaa13('0xc'),'dtlsverify':'no','dtlscertfile':_0xaa13('0xd'),'dtlsprivatekey':_0xaa13('0xe'),'dtlssetup':_0xaa13('0xf'),'callerid':util[_0xaa13('0x3')](_0xaa13('0x10'),util[_0xaa13('0x3')](_0xaa13('0x4'),_0xaa13('0x5'),i),0xfa0+i)});}db[_0xaa13('0x11')][_0xaa13('0x12')](users)[_0xaa13('0x13')](function(){console[_0xaa13('0x14')](_0xaa13('0x15'));})[_0xaa13('0x16')](function(_0x218ba2){console[_0xaa13('0x14')](_0x218ba2);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d5c93a5..b98e0e6 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['voice:outbound','hasOwnProperty','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','userProfileId','VoiceQueue','Telephones','Trunk','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','map','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','address','request','connection','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','User','where','Campaign','%s:queue:%s','length','format','handshake','query','find','ChatInteraction','MailInteraction','MailInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','user:%s','admin','voice:inbound'];(function(_0xcc7a0f,_0x55ef4a){var _0x55a36d=function(_0xc0f17b){while(--_0xc0f17b){_0xcc7a0f['push'](_0xcc7a0f['shift']());}};_0x55a36d(++_0x55ef4a);}(_0xdace,0x9d));var _0xedac=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xdace[_0x11e05d];return _0x335588;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var BPromise=require(_0xedac('0x1'));var db=require(_0xedac('0x2'))['db'];var config=require(_0xedac('0x3'));var queryQueues={'attributes':['id',_0xedac('0x4')],'include':[{'as':_0xedac('0x5'),'model':db['User'],'attributes':['id',_0xedac('0x4'),_0xedac('0x6')],'raw':!![],'where':{'role':_0xedac('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xedac('0x4')],'where':{'role':_0xedac('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xedac('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xedac('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xedac('0x4'),_0xedac('0x9')],'where':{'type':_0xedac('0xa')}};function getAssociatedResources(_0x40918c,_0x1653e3,_0x37817e){return db[_0xedac('0xb')][_0xedac('0xc')]({'where':{'name':_0x40918c,'userProfileId':_0x1653e3},'raw':!![]})[_0xedac('0xd')](function(_0x128dc4){if(_0x128dc4){if(_0x128dc4[_0xedac('0xe')]){switch(_0x40918c){case _0xedac('0xf'):case _0xedac('0x10'):case _0xedac('0x11'):case _0xedac('0x12'):case _0xedac('0x13'):case _0xedac('0x14'):case _0xedac('0x15'):return db[_0x37817e][_0xedac('0x16')](queryQueues);case'Telephones':return db[_0x37817e][_0xedac('0x16')](queryTelephones);case _0xedac('0x17'):return db[_0x37817e][_0xedac('0x16')](queryTrunks);case _0xedac('0x18'):return db[_0x37817e]['findAll'](queryCampaigns);}}else{return db[_0xedac('0x19')][_0xedac('0x16')]({'attributes':['resourceId'],'where':{'sectionId':_0x128dc4['id']},'raw':!![]})[_0xedac('0xd')](function(_0x3a1470){if(_0x3a1470){var _0x1e6836={'where':{'id':_['map'](_0x3a1470,_0xedac('0x1a'))},'raw':!![]};switch(_0x37817e){case _0xedac('0x1b'):_0x1e6836[_0xedac('0x1c')]['role']=_0xedac('0x8');break;case _0xedac('0x1d'):_0x1e6836[_0xedac('0x1c')][_0xedac('0x9')]=_0xedac('0xa');break;}return db[_0x37817e][_0xedac('0x16')](_0x1e6836);}else{return[];}});}}else{return[];}})[_0xedac('0xd')](function(_0x587808){return _0x587808;});}function joinOrLeaveQueues(_0x4d8f48,_0x15ba54,_0x4354de,_0x143718){_0x4d8f48[_0x15ba54](util['format'](_0xedac('0x1e'),_0x4354de,_0x143718[_0xedac('0x4')]));if(_0x143718[_0xedac('0x5')]){for(var _0xbc0363=0x0;_0xbc0363<_0x143718[_0xedac('0x5')][_0xedac('0x1f')];_0xbc0363+=0x1){_0x4d8f48[_0x15ba54](util[_0xedac('0x20')]('user:%s',_0x143718[_0xedac('0x5')][_0xbc0363][_0xedac('0x4')]));}}}function joinOrLeave(_0x151b96,_0x2b073f,_0x15dfd0){var _0x2ac427;if(_0x151b96[_0xedac('0x21')][_0xedac('0x22')]['id']){db[_0xedac('0x1b')][_0xedac('0x23')]({'attributes':['id','name',_0xedac('0x6'),'userProfileId'],'where':{'id':_0x151b96[_0xedac('0x21')]['query']['id']},'include':[{'model':db[_0xedac('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xedac('0x25')],'as':_0xedac('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xedac('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xedac('0x28')],'as':_0xedac('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xedac('0xd')](function(_0x2cce76){if(_0x2cce76){_0x2ac427=_0x2cce76;_0x151b96[_0x2b073f](util[_0xedac('0x20')](_0xedac('0x2a'),_0x2cce76[_0xedac('0x4')]));var _0x226681=[];switch(_0x2cce76['role']){case _0xedac('0x2b'):_0x151b96[_0x2b073f](_0xedac('0x2c'));_0x151b96[_0x2b073f](_0xedac('0x2d'));if(queryQueues[_0xedac('0x2e')]('include')){delete queryQueues['include'];}_0x226681[_0xedac('0x2f')](db['VoiceQueue'][_0xedac('0x16')](queryQueues));_0x226681['push'](db[_0xedac('0x30')]['findAll'](queryQueues));_0x226681[_0xedac('0x2f')](db[_0xedac('0x31')][_0xedac('0x16')](queryQueues));_0x226681[_0xedac('0x2f')](db[_0xedac('0x32')][_0xedac('0x16')](queryQueues));_0x226681[_0xedac('0x2f')](db[_0xedac('0x33')][_0xedac('0x16')](queryQueues));_0x226681[_0xedac('0x2f')](db[_0xedac('0x34')][_0xedac('0x16')](queryQueues));_0x226681[_0xedac('0x2f')](db[_0xedac('0x35')]['findAll'](queryQueues));_0x226681[_0xedac('0x2f')](db[_0xedac('0x1b')]['findAll'](queryTelephones));_0x226681[_0xedac('0x2f')](db['Trunk']['findAll'](queryTrunks));_0x226681[_0xedac('0x2f')](db[_0xedac('0x1d')][_0xedac('0x16')](queryCampaigns));_0x226681[_0xedac('0x2f')](db['User']['findAll'](queryAgents));break;case _0xedac('0x36'):_0x151b96[_0x2b073f](_0xedac('0x2c'));_0x151b96[_0x2b073f](_0xedac('0x2d'));_0x226681[_0xedac('0x2f')](getAssociatedResources(_0xedac('0xf'),_0x2cce76[_0xedac('0x37')],_0xedac('0x38')));_0x226681[_0xedac('0x2f')](getAssociatedResources(_0xedac('0x10'),_0x2cce76[_0xedac('0x37')],_0xedac('0x30')));_0x226681[_0xedac('0x2f')](getAssociatedResources('FaxQueues',_0x2cce76['userProfileId'],_0xedac('0x31')));_0x226681['push'](getAssociatedResources(_0xedac('0x12'),_0x2cce76[_0xedac('0x37')],_0xedac('0x32')));_0x226681[_0xedac('0x2f')](getAssociatedResources(_0xedac('0x13'),_0x2cce76[_0xedac('0x37')],'MailQueue'));_0x226681['push'](getAssociatedResources(_0xedac('0x14'),_0x2cce76[_0xedac('0x37')],_0xedac('0x34')));_0x226681['push'](getAssociatedResources(_0xedac('0x15'),_0x2cce76[_0xedac('0x37')],_0xedac('0x35')));_0x226681[_0xedac('0x2f')](getAssociatedResources(_0xedac('0x39'),_0x2cce76[_0xedac('0x37')],_0xedac('0x1b')));_0x226681[_0xedac('0x2f')](getAssociatedResources(_0xedac('0x17'),_0x2cce76[_0xedac('0x37')],_0xedac('0x3a')));_0x226681[_0xedac('0x2f')](getAssociatedResources(_0xedac('0x18'),_0x2cce76[_0xedac('0x37')],'Campaign'));_0x226681[_0xedac('0x2f')](db[_0xedac('0x1b')][_0xedac('0x16')](queryAgents));break;case _0xedac('0x7'):_0x151b96[_0x2b073f]('voice:inbound');_0x151b96[_0x2b073f](_0xedac('0x2d'));_0x226681[_0xedac('0x2f')](_0x2cce76['getVoiceQueues']({'attributes':['id',_0xedac('0x4')]}));_0x226681['push'](_0x2cce76['getChatQueues']({'attributes':['id',_0xedac('0x4')]}));_0x226681['push'](_0x2cce76[_0xedac('0x3b')]({'attributes':['id','name']}));_0x226681['push'](_0x2cce76[_0xedac('0x3c')]({'attributes':['id',_0xedac('0x4')]}));_0x226681[_0xedac('0x2f')](_0x2cce76['getMailQueues']({'attributes':['id',_0xedac('0x4')]}));_0x226681[_0xedac('0x2f')](_0x2cce76[_0xedac('0x3d')]({'attributes':['id','name']}));_0x226681[_0xedac('0x2f')](_0x2cce76[_0xedac('0x3e')]({'attributes':['id',_0xedac('0x4')]}));break;}return BPromise[_0xedac('0x3f')](_0x226681);}})['then'](function(_0x1f6a5b){if(_0x1f6a5b&&_0x1f6a5b['length']){for(var _0x5ae467=0x0;_0x5ae467<_0x1f6a5b['length'];_0x5ae467+=0x1){for(var _0x5b0d87=0x0;_0x5b0d87<_0x1f6a5b[_0x5ae467]['length'];_0x5b0d87+=0x1){switch(_0x5ae467){case 0x0:joinOrLeaveQueues(_0x151b96,_0x2b073f,_0xedac('0x40'),_0x1f6a5b[_0x5ae467][_0x5b0d87]);break;case 0x1:joinOrLeaveQueues(_0x151b96,_0x2b073f,_0xedac('0x41'),_0x1f6a5b[_0x5ae467][_0x5b0d87]);break;case 0x2:joinOrLeaveQueues(_0x151b96,_0x2b073f,_0xedac('0x42'),_0x1f6a5b[_0x5ae467][_0x5b0d87]);break;case 0x3:joinOrLeaveQueues(_0x151b96,_0x2b073f,_0xedac('0x43'),_0x1f6a5b[_0x5ae467][_0x5b0d87]);break;case 0x4:joinOrLeaveQueues(_0x151b96,_0x2b073f,_0xedac('0x44'),_0x1f6a5b[_0x5ae467][_0x5b0d87]);break;case 0x5:joinOrLeaveQueues(_0x151b96,_0x2b073f,'openchannel',_0x1f6a5b[_0x5ae467][_0x5b0d87]);break;case 0x6:joinOrLeaveQueues(_0x151b96,_0x2b073f,_0xedac('0x45'),_0x1f6a5b[_0x5ae467][_0x5b0d87]);break;case 0x7:_0x151b96[_0x2b073f](util['format'](_0xedac('0x46'),_0x1f6a5b[_0x5ae467][_0x5b0d87]['name']));break;case 0x8:_0x151b96[_0x2b073f](util[_0xedac('0x20')](_0xedac('0x47'),_0x1f6a5b[_0x5ae467][_0x5b0d87][_0xedac('0x4')]));break;case 0x9:_0x151b96[_0x2b073f](util['format']('campaign:%s:%s',_0x1f6a5b[_0x5ae467][_0x5b0d87][_0xedac('0x9')],_0x1f6a5b[_0x5ae467][_0x5b0d87][_0xedac('0x4')]));break;case 0xa:_0x151b96[_0x2b073f](util[_0xedac('0x20')](_0xedac('0x2a'),_0x1f6a5b[_0x5ae467][_0x5b0d87][_0xedac('0x4')]));break;}}}}})[_0xedac('0xd')](function(){if(_0x2b073f===_0xedac('0x48')){var _0x21a3ed=_['map'](_0x2ac427[_0xedac('0x49')],'id');return _0x2ac427[_0xedac('0x4a')](_0x21a3ed)[_0xedac('0xd')](function(){for(var _0x54857f=0x0;_0x54857f<_0x21a3ed[_0xedac('0x1f')];_0x54857f+=0x1){_0x15dfd0[_0xedac('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x21a3ed[_0x54857f]),'UserId':Number(_0x2ac427['id'])});}});}})['then'](function(){if(_0x2b073f===_0xedac('0x48')){var _0x3b5fb6=_[_0xedac('0x4c')](_0x2ac427[_0xedac('0x26')],'id');return _0x2ac427['removeMailInteractions'](_0x3b5fb6)[_0xedac('0xd')](function(){for(var _0x1a8943=0x0;_0x1a8943<_0x3b5fb6[_0xedac('0x1f')];_0x1a8943+=0x1){_0x15dfd0[_0xedac('0x4b')](_0xedac('0x4d'),{'MailInteractionId':Number(_0x3b5fb6[_0x1a8943]),'UserId':Number(_0x2ac427['id'])});}});}})[_0xedac('0xd')](function(){if(_0x2b073f===_0xedac('0x48')){var _0x392bc4=_[_0xedac('0x4c')](_0x2ac427[_0xedac('0x4e')],'id');return _0x2ac427[_0xedac('0x4f')](_0x392bc4)[_0xedac('0xd')](function(){for(var _0x3e9657=0x0;_0x3e9657<_0x392bc4['length'];_0x3e9657+=0x1){_0x15dfd0['emit'](_0xedac('0x50'),{'FaxInteractionId':Number(_0x392bc4[_0x3e9657]),'UserId':Number(_0x2ac427['id'])});}});}})['then'](function(){if(_0x2b073f===_0xedac('0x48')){var _0x4cf911=_[_0xedac('0x4c')](_0x2ac427[_0xedac('0x27')],'id');return _0x2ac427[_0xedac('0x51')](_0x4cf911)[_0xedac('0xd')](function(){for(var _0xa069b6=0x0;_0xa069b6<_0x4cf911[_0xedac('0x1f')];_0xa069b6+=0x1){_0x15dfd0['emit'](_0xedac('0x52'),{'SmsInteractionId':Number(_0x4cf911[_0xa069b6]),'UserId':Number(_0x2ac427['id'])});}});}})[_0xedac('0xd')](function(){if(_0x2b073f==='leave'){var _0x47ccc4=_[_0xedac('0x4c')](_0x2ac427[_0xedac('0x29')],'id');return _0x2ac427[_0xedac('0x53')](_0x47ccc4)[_0xedac('0xd')](function(){for(var _0x553982=0x0;_0x553982<_0x47ccc4['length'];_0x553982+=0x1){_0x15dfd0[_0xedac('0x4b')](_0xedac('0x54'),{'OpenchannelInteractionId':Number(_0x47ccc4[_0x553982]),'UserId':Number(_0x2ac427['id'])});}});}})[_0xedac('0xd')](function(){if(_0x2b073f===_0xedac('0x48')){var _0x588582=_[_0xedac('0x4c')](_0x2ac427[_0xedac('0x55')],'id');return _0x2ac427['removeWhatsappInteractions'](_0x588582)[_0xedac('0xd')](function(){for(var _0x1557ab=0x0;_0x1557ab<_0x588582[_0xedac('0x1f')];_0x1557ab+=0x1){_0x15dfd0['emit'](_0xedac('0x56'),{'WhatsappInteractionId':Number(_0x588582[_0x1557ab]),'UserId':Number(_0x2ac427['id'])});}});}})[_0xedac('0x57')](function(_0x1d8c4a){_0x151b96[_0xedac('0x58')](_0x1d8c4a);});}}function onDisconnect(_0x137194,_0x3ca6a1){joinOrLeave(_0x137194,_0xedac('0x48'),_0x3ca6a1);}function onConnect(_0x54b748){joinOrLeave(_0x54b748,_0xedac('0x59'));}exports[_0xedac('0x5a')]=function(_0x533170){_0x533170['on']('connection',function(_0x326970){_0x326970['setMaxListeners'](0x0);_0x326970[_0xedac('0x5b')]=_0x326970[_0xedac('0x5c')][_0xedac('0x5d')][_0xedac('0x5e')]+':'+_0x326970['request'][_0xedac('0x5d')][_0xedac('0x5f')];_0x326970['connectedAt']=new Date();_0x326970[_0xedac('0x58')]=function(_0x2d7739){console[_0xedac('0x58')](_0xedac('0x60')+_0x326970[_0xedac('0x61')][_0xedac('0x4')]+'['+_0x326970[_0xedac('0x5b')]+']',_0x2d7739);};_0x326970['on'](_0xedac('0x62'),function(){onDisconnect(_0x326970,_0x533170);_0x326970[_0xedac('0x58')](_0xedac('0x63'));});onConnect(_0x326970);_0x326970[_0xedac('0x58')](_0xedac('0x64'));});}; \ No newline at end of file +var _0x6a06=['OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','Telephones','IvrCampaigns','Campaign','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','map','removeChatInteractions','emit','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','catch','log','default','connection','setMaxListeners','remoteAddress','request','connectedAt','SocketIO\x20','nsp','address','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','User','agent','name','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId','where','%s:queue:%s','Agents','length','format','user:%s','handshake','query','find','role','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6a06,0x100));var _0x66a0=function(_0x2e8e7b,_0x5e4613){_0x2e8e7b=_0x2e8e7b-0x0;var _0x15fdab=_0x6a06[_0x2e8e7b];return _0x15fdab;};'use strict';var _=require('lodash');var util=require(_0x66a0('0x0'));var BPromise=require(_0x66a0('0x1'));var db=require(_0x66a0('0x2'))['db'];var config=require(_0x66a0('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x66a0('0x4')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x66a0('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x66a0('0x6')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x66a0('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x66a0('0x6')],'where':{'role':_0x66a0('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x66a0('0x6'),_0x66a0('0x7')],'where':{'type':_0x66a0('0x8')}};function getAssociatedResources(_0x34cf3c,_0x5d0a6f,_0x449e59){return db[_0x66a0('0x9')][_0x66a0('0xa')]({'where':{'name':_0x34cf3c,'userProfileId':_0x5d0a6f},'raw':!![]})[_0x66a0('0xb')](function(_0x511cb7){if(_0x511cb7){if(_0x511cb7['autoAssociation']){switch(_0x34cf3c){case _0x66a0('0xc'):case _0x66a0('0xd'):case _0x66a0('0xe'):case'SmsQueues':case _0x66a0('0xf'):case _0x66a0('0x10'):case _0x66a0('0x11'):return db[_0x449e59][_0x66a0('0x12')](queryQueues);case'Telephones':return db[_0x449e59]['findAll'](queryTelephones);case _0x66a0('0x13'):return db[_0x449e59][_0x66a0('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x449e59][_0x66a0('0x12')](queryCampaigns);}}else{return db[_0x66a0('0x14')][_0x66a0('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x511cb7['id']},'raw':!![]})[_0x66a0('0xb')](function(_0x4b0ea1){if(_0x4b0ea1){var _0x183735={'where':{'id':_['map'](_0x4b0ea1,_0x66a0('0x15'))},'raw':!![]};switch(_0x449e59){case _0x66a0('0x4'):_0x183735[_0x66a0('0x16')]['role']='telephone';break;case'Campaign':_0x183735[_0x66a0('0x16')][_0x66a0('0x7')]=_0x66a0('0x8');break;}return db[_0x449e59][_0x66a0('0x12')](_0x183735);}else{return[];}});}}else{return[];}})['then'](function(_0x5929aa){return _0x5929aa;});}function joinOrLeaveQueues(_0x451ab2,_0x3da76a,_0x16f5c2,_0x5d69f4){_0x451ab2[_0x3da76a](util['format'](_0x66a0('0x17'),_0x16f5c2,_0x5d69f4[_0x66a0('0x6')]));if(_0x5d69f4[_0x66a0('0x18')]){for(var _0x44b824=0x0;_0x44b824<_0x5d69f4[_0x66a0('0x18')][_0x66a0('0x19')];_0x44b824+=0x1){_0x451ab2[_0x3da76a](util[_0x66a0('0x1a')](_0x66a0('0x1b'),_0x5d69f4[_0x66a0('0x18')][_0x44b824][_0x66a0('0x6')]));}}}function joinOrLeave(_0x155ce2,_0x268fd5,_0xe8a777){var _0x4d8b58;if(_0x155ce2[_0x66a0('0x1c')][_0x66a0('0x1d')]['id']){db[_0x66a0('0x4')][_0x66a0('0x1e')]({'attributes':['id',_0x66a0('0x6'),_0x66a0('0x1f'),_0x66a0('0x20')],'where':{'id':_0x155ce2[_0x66a0('0x1c')]['query']['id']},'include':[{'model':db[_0x66a0('0x21')],'as':_0x66a0('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x66a0('0x23')],'as':_0x66a0('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x66a0('0x25')],'as':_0x66a0('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x66a0('0x27')],'as':_0x66a0('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x66a0('0x29')],'as':_0x66a0('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x66a0('0x2b')],'as':_0x66a0('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x66a0('0xb')](function(_0x5145bc){if(_0x5145bc){_0x4d8b58=_0x5145bc;_0x155ce2[_0x268fd5](util['format'](_0x66a0('0x1b'),_0x5145bc[_0x66a0('0x6')]));var _0x917a33=[];switch(_0x5145bc[_0x66a0('0x1f')]){case _0x66a0('0x2d'):_0x155ce2[_0x268fd5]('voice:inbound');_0x155ce2[_0x268fd5](_0x66a0('0x2e'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x66a0('0x2f')];}_0x917a33[_0x66a0('0x30')](db[_0x66a0('0x31')][_0x66a0('0x12')](queryQueues));_0x917a33[_0x66a0('0x30')](db[_0x66a0('0x32')][_0x66a0('0x12')](queryQueues));_0x917a33[_0x66a0('0x30')](db[_0x66a0('0x33')][_0x66a0('0x12')](queryQueues));_0x917a33['push'](db[_0x66a0('0x34')]['findAll'](queryQueues));_0x917a33['push'](db[_0x66a0('0x35')][_0x66a0('0x12')](queryQueues));_0x917a33[_0x66a0('0x30')](db[_0x66a0('0x36')][_0x66a0('0x12')](queryQueues));_0x917a33[_0x66a0('0x30')](db[_0x66a0('0x37')]['findAll'](queryQueues));_0x917a33[_0x66a0('0x30')](db[_0x66a0('0x4')][_0x66a0('0x12')](queryTelephones));_0x917a33['push'](db[_0x66a0('0x38')][_0x66a0('0x12')](queryTrunks));_0x917a33['push'](db['Campaign']['findAll'](queryCampaigns));_0x917a33[_0x66a0('0x30')](db[_0x66a0('0x4')]['findAll'](queryAgents));break;case'user':_0x155ce2[_0x268fd5](_0x66a0('0x39'));_0x155ce2[_0x268fd5](_0x66a0('0x2e'));_0x917a33[_0x66a0('0x30')](getAssociatedResources(_0x66a0('0xc'),_0x5145bc[_0x66a0('0x20')],_0x66a0('0x31')));_0x917a33[_0x66a0('0x30')](getAssociatedResources('ChatQueues',_0x5145bc[_0x66a0('0x20')],_0x66a0('0x32')));_0x917a33[_0x66a0('0x30')](getAssociatedResources(_0x66a0('0xe'),_0x5145bc[_0x66a0('0x20')],_0x66a0('0x33')));_0x917a33['push'](getAssociatedResources('SmsQueues',_0x5145bc['userProfileId'],_0x66a0('0x34')));_0x917a33[_0x66a0('0x30')](getAssociatedResources(_0x66a0('0xf'),_0x5145bc[_0x66a0('0x20')],_0x66a0('0x35')));_0x917a33[_0x66a0('0x30')](getAssociatedResources(_0x66a0('0x10'),_0x5145bc[_0x66a0('0x20')],'OpenchannelQueue'));_0x917a33['push'](getAssociatedResources('WhatsappQueues',_0x5145bc['userProfileId'],_0x66a0('0x37')));_0x917a33['push'](getAssociatedResources(_0x66a0('0x3a'),_0x5145bc[_0x66a0('0x20')],_0x66a0('0x4')));_0x917a33[_0x66a0('0x30')](getAssociatedResources(_0x66a0('0x13'),_0x5145bc[_0x66a0('0x20')],_0x66a0('0x38')));_0x917a33['push'](getAssociatedResources(_0x66a0('0x3b'),_0x5145bc[_0x66a0('0x20')],_0x66a0('0x3c')));_0x917a33['push'](db[_0x66a0('0x4')][_0x66a0('0x12')](queryAgents));break;case _0x66a0('0x5'):_0x155ce2[_0x268fd5](_0x66a0('0x39'));_0x155ce2[_0x268fd5]('voice:outbound');_0x917a33[_0x66a0('0x30')](_0x5145bc[_0x66a0('0x3d')]({'attributes':['id',_0x66a0('0x6')]}));_0x917a33['push'](_0x5145bc['getChatQueues']({'attributes':['id',_0x66a0('0x6')]}));_0x917a33[_0x66a0('0x30')](_0x5145bc[_0x66a0('0x3e')]({'attributes':['id',_0x66a0('0x6')]}));_0x917a33[_0x66a0('0x30')](_0x5145bc[_0x66a0('0x3f')]({'attributes':['id',_0x66a0('0x6')]}));_0x917a33[_0x66a0('0x30')](_0x5145bc[_0x66a0('0x40')]({'attributes':['id',_0x66a0('0x6')]}));_0x917a33[_0x66a0('0x30')](_0x5145bc[_0x66a0('0x41')]({'attributes':['id','name']}));_0x917a33[_0x66a0('0x30')](_0x5145bc['getWhatsappQueues']({'attributes':['id',_0x66a0('0x6')]}));break;}return BPromise['all'](_0x917a33);}})[_0x66a0('0xb')](function(_0x1d8ee4){if(_0x1d8ee4&&_0x1d8ee4[_0x66a0('0x19')]){for(var _0x357b48=0x0;_0x357b48<_0x1d8ee4[_0x66a0('0x19')];_0x357b48+=0x1){for(var _0x15c23f=0x0;_0x15c23f<_0x1d8ee4[_0x357b48][_0x66a0('0x19')];_0x15c23f+=0x1){switch(_0x357b48){case 0x0:joinOrLeaveQueues(_0x155ce2,_0x268fd5,_0x66a0('0x42'),_0x1d8ee4[_0x357b48][_0x15c23f]);break;case 0x1:joinOrLeaveQueues(_0x155ce2,_0x268fd5,_0x66a0('0x43'),_0x1d8ee4[_0x357b48][_0x15c23f]);break;case 0x2:joinOrLeaveQueues(_0x155ce2,_0x268fd5,_0x66a0('0x44'),_0x1d8ee4[_0x357b48][_0x15c23f]);break;case 0x3:joinOrLeaveQueues(_0x155ce2,_0x268fd5,'sms',_0x1d8ee4[_0x357b48][_0x15c23f]);break;case 0x4:joinOrLeaveQueues(_0x155ce2,_0x268fd5,_0x66a0('0x45'),_0x1d8ee4[_0x357b48][_0x15c23f]);break;case 0x5:joinOrLeaveQueues(_0x155ce2,_0x268fd5,_0x66a0('0x46'),_0x1d8ee4[_0x357b48][_0x15c23f]);break;case 0x6:joinOrLeaveQueues(_0x155ce2,_0x268fd5,_0x66a0('0x47'),_0x1d8ee4[_0x357b48][_0x15c23f]);break;case 0x7:_0x155ce2[_0x268fd5](util[_0x66a0('0x1a')](_0x66a0('0x48'),_0x1d8ee4[_0x357b48][_0x15c23f]['name']));break;case 0x8:_0x155ce2[_0x268fd5](util[_0x66a0('0x1a')](_0x66a0('0x49'),_0x1d8ee4[_0x357b48][_0x15c23f][_0x66a0('0x6')]));break;case 0x9:_0x155ce2[_0x268fd5](util['format'](_0x66a0('0x4a'),_0x1d8ee4[_0x357b48][_0x15c23f]['type'],_0x1d8ee4[_0x357b48][_0x15c23f][_0x66a0('0x6')]));break;case 0xa:_0x155ce2[_0x268fd5](util[_0x66a0('0x1a')](_0x66a0('0x1b'),_0x1d8ee4[_0x357b48][_0x15c23f]['name']));break;}}}}})[_0x66a0('0xb')](function(){if(_0x268fd5==='leave'){var _0x1236af=_[_0x66a0('0x4b')](_0x4d8b58['ChatInteractions'],'id');return _0x4d8b58[_0x66a0('0x4c')](_0x1236af)['then'](function(){for(var _0x2a9de8=0x0;_0x2a9de8<_0x1236af['length'];_0x2a9de8+=0x1){_0xe8a777[_0x66a0('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x1236af[_0x2a9de8]),'UserId':Number(_0x4d8b58['id'])});}});}})[_0x66a0('0xb')](function(){if(_0x268fd5===_0x66a0('0x4e')){var _0x133562=_[_0x66a0('0x4b')](_0x4d8b58['MailInteractions'],'id');return _0x4d8b58[_0x66a0('0x4f')](_0x133562)['then'](function(){for(var _0x5a2ee4=0x0;_0x5a2ee4<_0x133562[_0x66a0('0x19')];_0x5a2ee4+=0x1){_0xe8a777[_0x66a0('0x4d')](_0x66a0('0x50'),{'MailInteractionId':Number(_0x133562[_0x5a2ee4]),'UserId':Number(_0x4d8b58['id'])});}});}})[_0x66a0('0xb')](function(){if(_0x268fd5===_0x66a0('0x4e')){var _0x1bf318=_['map'](_0x4d8b58[_0x66a0('0x26')],'id');return _0x4d8b58[_0x66a0('0x51')](_0x1bf318)['then'](function(){for(var _0x2d67c1=0x0;_0x2d67c1<_0x1bf318[_0x66a0('0x19')];_0x2d67c1+=0x1){_0xe8a777['emit'](_0x66a0('0x52'),{'FaxInteractionId':Number(_0x1bf318[_0x2d67c1]),'UserId':Number(_0x4d8b58['id'])});}});}})[_0x66a0('0xb')](function(){if(_0x268fd5===_0x66a0('0x4e')){var _0x46eb15=_[_0x66a0('0x4b')](_0x4d8b58[_0x66a0('0x28')],'id');return _0x4d8b58[_0x66a0('0x53')](_0x46eb15)[_0x66a0('0xb')](function(){for(var _0x47f5b5=0x0;_0x47f5b5<_0x46eb15['length'];_0x47f5b5+=0x1){_0xe8a777['emit'](_0x66a0('0x54'),{'SmsInteractionId':Number(_0x46eb15[_0x47f5b5]),'UserId':Number(_0x4d8b58['id'])});}});}})[_0x66a0('0xb')](function(){if(_0x268fd5===_0x66a0('0x4e')){var _0x33cf3b=_['map'](_0x4d8b58[_0x66a0('0x2a')],'id');return _0x4d8b58['removeOpenchannelInteractions'](_0x33cf3b)[_0x66a0('0xb')](function(){for(var _0x29e0d0=0x0;_0x29e0d0<_0x33cf3b['length'];_0x29e0d0+=0x1){_0xe8a777['emit'](_0x66a0('0x55'),{'OpenchannelInteractionId':Number(_0x33cf3b[_0x29e0d0]),'UserId':Number(_0x4d8b58['id'])});}});}})[_0x66a0('0xb')](function(){if(_0x268fd5===_0x66a0('0x4e')){var _0x3390da=_[_0x66a0('0x4b')](_0x4d8b58['WhatsappInteractions'],'id');return _0x4d8b58['removeWhatsappInteractions'](_0x3390da)[_0x66a0('0xb')](function(){for(var _0x2e9e23=0x0;_0x2e9e23<_0x3390da[_0x66a0('0x19')];_0x2e9e23+=0x1){_0xe8a777[_0x66a0('0x4d')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3390da[_0x2e9e23]),'UserId':Number(_0x4d8b58['id'])});}});}})[_0x66a0('0x56')](function(_0x2a8a72){_0x155ce2[_0x66a0('0x57')](_0x2a8a72);});}}function onDisconnect(_0x5c596f,_0x22c2e3){joinOrLeave(_0x5c596f,_0x66a0('0x4e'),_0x22c2e3);}function onConnect(_0x55255a){joinOrLeave(_0x55255a,'join');}exports[_0x66a0('0x58')]=function(_0x202b61){_0x202b61['on'](_0x66a0('0x59'),function(_0x32e613){_0x32e613[_0x66a0('0x5a')](0x0);_0x32e613['address']=_0x32e613['request'][_0x66a0('0x59')][_0x66a0('0x5b')]+':'+_0x32e613[_0x66a0('0x5c')][_0x66a0('0x59')]['remotePort'];_0x32e613[_0x66a0('0x5d')]=new Date();_0x32e613[_0x66a0('0x57')]=function(_0x553306){console[_0x66a0('0x57')](_0x66a0('0x5e')+_0x32e613[_0x66a0('0x5f')][_0x66a0('0x6')]+'['+_0x32e613[_0x66a0('0x60')]+']',_0x553306);};_0x32e613['on']('disconnect',function(){onDisconnect(_0x32e613,_0x202b61);_0x32e613[_0x66a0('0x57')](_0x66a0('0x61'));});onConnect(_0x32e613);_0x32e613[_0x66a0('0x57')](_0x66a0('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index af9a7eb..68ac565 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 _0x43aa=['closedinteraction','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','error','EventManager','catch','get','direction','UserId','find','name','interface','format','SIP/%s','channel','outgoingmessage','event','opened','changed','closed','length','hasOwnProperty','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','http','ChatInteraction','newinteraction','Chat','afterUpdate','ChatMessage','newmessage','Sms','afterCreate'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x43aa,0xc2));var _0xa43a=function(_0x39e24a,_0x26d19d){_0x39e24a=_0x39e24a-0x0;var _0x2eccc2=_0x43aa[_0x39e24a];return _0x2eccc2;};'use strict';var util=require(_0xa43a('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa43a('0x1'));var logger=require(_0xa43a('0x2'))(_0xa43a('0x3'));var client=jayson[_0xa43a('0x4')][_0xa43a('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xa43a('0x6'),'event':'afterCreate','condition':_0xa43a('0x7'),'callback':afterCreate},{'channel':_0xa43a('0x8'),'model':_0xa43a('0x6'),'event':_0xa43a('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xa43a('0x8'),'model':_0xa43a('0xa'),'event':'afterCreate','condition':_0xa43a('0xb'),'callback':afterCreateMessage},{'channel':_0xa43a('0xc'),'model':'SmsInteraction','event':_0xa43a('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa43a('0xc'),'model':'SmsInteraction','event':_0xa43a('0x9'),'condition':_0xa43a('0xe'),'callback':afterUpdate},{'channel':_0xa43a('0xc'),'model':'SmsMessage','event':_0xa43a('0xd'),'condition':_0xa43a('0xb'),'callback':afterCreateMessage},{'channel':_0xa43a('0xf'),'model':_0xa43a('0x10'),'event':_0xa43a('0xd'),'condition':_0xa43a('0x7'),'callback':afterCreate},{'channel':_0xa43a('0xf'),'model':_0xa43a('0x10'),'event':_0xa43a('0x9'),'condition':_0xa43a('0xe'),'callback':afterUpdate},{'channel':_0xa43a('0xf'),'model':'WhatsappMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xa43a('0x11'),'model':_0xa43a('0x12'),'event':_0xa43a('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa43a('0x11'),'model':_0xa43a('0x12'),'event':_0xa43a('0x9'),'condition':_0xa43a('0xe'),'callback':afterUpdate},{'channel':_0xa43a('0x11'),'model':_0xa43a('0x13'),'event':_0xa43a('0xd'),'condition':_0xa43a('0xb'),'callback':afterCreateMessage},{'channel':_0xa43a('0x14'),'model':_0xa43a('0x15'),'event':_0xa43a('0xd'),'condition':_0xa43a('0x7'),'callback':afterCreate},{'channel':_0xa43a('0x14'),'model':_0xa43a('0x15'),'event':_0xa43a('0x9'),'condition':_0xa43a('0xe'),'callback':afterUpdate},{'channel':'Mail','model':_0xa43a('0x16'),'event':_0xa43a('0xd'),'condition':_0xa43a('0xb'),'callback':afterCreateMessage},{'channel':_0xa43a('0x17'),'model':_0xa43a('0x18'),'event':_0xa43a('0xd'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xa43a('0x17'),'model':_0xa43a('0x18'),'event':'afterUpdate','condition':_0xa43a('0xe'),'callback':afterUpdate},{'channel':_0xa43a('0x17'),'model':_0xa43a('0x19'),'event':_0xa43a('0xd'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x513ed5){return client[_0xa43a('0x1a')]('EventManager',_0x513ed5)[_0xa43a('0x1b')](function(_0x15967f){logger[_0xa43a('0x1c')](_0xa43a('0x1d'),'EventManager',_0x15967f);if(_0x15967f[_0xa43a('0x1e')]){if(_0x15967f['error']['code']===0x1f4){logger[_0xa43a('0x1e')]('Trigger,\x20%s',_0xa43a('0x1f'),_0x15967f[_0xa43a('0x1e')]);}}})[_0xa43a('0x20')](function(_0x1c411e){logger[_0xa43a('0x1e')](_0xa43a('0x1d'),_0xa43a('0x1f'),_0x1c411e);});}function afterCreateMessage(_0x23c61b,_0x1894c6){return function(_0x4d51e8,_0x59667f){_0x4d51e8=_0x4d51e8[_0xa43a('0x21')]({'plain':!![]});_0x4d51e8['channel']=_0x23c61b;_0x4d51e8['event']=_0x4d51e8[_0xa43a('0x22')];if(_0x4d51e8[_0xa43a('0x23')]){return db['User'][_0xa43a('0x24')]({'where':{'id':_0x4d51e8[_0xa43a('0x23')]},'attributes':['id',_0xa43a('0x25')],'raw':!![]})[_0xa43a('0x1b')](function(_0x159685){_0x4d51e8[_0xa43a('0x26')]=util[_0xa43a('0x27')](_0xa43a('0x28'),_0x159685[_0xa43a('0x25')]);_0x4d51e8[_0xa43a('0x29')]=_0x23c61b;return request({'event':'incomingmessage','message':_0x4d51e8});})['catch'](function(_0xdd8007){console[_0xa43a('0x1e')](_0xdd8007);});}else{return request({'event':_0xa43a('0x2a'),'message':_0x4d51e8});}};}function afterCreate(_0x490a18,_0x55c17a){return function(_0x51e1f0,_0x8a0d67){_0x51e1f0=_0x51e1f0[_0xa43a('0x21')]({'plain':!![]});_0x51e1f0[_0xa43a('0x29')]=_0x490a18;_0x51e1f0[_0xa43a('0x2b')]=_0xa43a('0x2c');return request({'event':_0x55c17a,'message':_0x51e1f0});};}function afterUpdate(_0x218449,_0x2ba22a){return function(_0x552bbb,_0x43e056){if(_0x552bbb[_0xa43a('0x2d')](_0xa43a('0x2e'))&&_0x552bbb[_0xa43a('0x2e')]){_0x552bbb=_0x552bbb[_0xa43a('0x21')]({'plain':!![]});_0x552bbb['channel']=_0x218449;_0x552bbb['event']='closed';if(_0x552bbb[_0xa43a('0x23')]){return db['User'][_0xa43a('0x24')]({'where':{'id':_0x552bbb[_0xa43a('0x23')]},'attributes':['id',_0xa43a('0x25')],'raw':!![]})['then'](function(_0x303434){_0x552bbb[_0xa43a('0x26')]=util[_0xa43a('0x27')](_0xa43a('0x28'),_0x303434['name']);return request({'event':_0x2ba22a,'message':_0x552bbb});})[_0xa43a('0x20')](function(_0x34e752){console[_0xa43a('0x1e')](_0x34e752);});}else{return request({'event':_0x2ba22a,'message':_0x552bbb});}}};}exports['default']=function(){for(var _0x40949b=0x0;_0x40949b=_0x534947[_0x530b('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2320f8(_0x440f7e);})[_0x530b('0x15')](function(_0x5b2962){_0x1713d4(_0x5b2962);});});}; \ No newline at end of file +var _0xcc3f=['voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util'];(function(_0x29ea84,_0x48180c){var _0x736bd3=function(_0x48b0b5){while(--_0x48b0b5){_0x29ea84['push'](_0x29ea84['shift']());}};_0x736bd3(++_0x48180c);}(_0xcc3f,0x141));var _0xfcc3=function(_0x1d2167,_0x10087b){_0x1d2167=_0x1d2167-0x0;var _0x1a5ff3=_0xcc3f[_0x1d2167];return _0x1a5ff3;};'use strict';var _=require(_0xfcc3('0x0'));var BPromise=require(_0xfcc3('0x1'));var db=require(_0xfcc3('0x2'))['db'];var util=require(_0xfcc3('0x3'));var channels=[_0xfcc3('0x4'),_0xfcc3('0x5'),_0xfcc3('0x6'),_0xfcc3('0x7'),_0xfcc3('0x8'),'whatsapp',_0xfcc3('0x9')];exports[_0xfcc3('0xa')]=function(){return channels;};exports[_0xfcc3('0xb')]=function(_0x481d9c){_0x481d9c=_0x481d9c[_0xfcc3('0xc')]();return _[_0xfcc3('0xd')](channels,_0x481d9c);};exports[_0xfcc3('0xe')]=function(_0x334443,_0x208639,_0x558449,_0x4d84a2){var _0x172cd8={'loginAttempts':_0x208639,'blocked':_0x558449};if(!_[_0xfcc3('0xf')](_0x4d84a2)){_0x172cd8[_0xfcc3('0x10')]=_0x4d84a2;}return _0x334443['updateAttributes'](_0x172cd8);};exports[_0xfcc3('0x11')]=function(_0x3ee738){return new BPromise(function(_0xbc2abd,_0xf3fa4f){var _0x2dc839=0x0;if(_0x3ee738[_0xfcc3('0x12')]!==_0xfcc3('0x13')){_0xbc2abd(_0x3ee738);}db[_0xfcc3('0x14')][_0xfcc3('0x15')]({'where':{'role':_0xfcc3('0x13'),'online':!![],'id':{'$ne':_0x3ee738['id']}}})[_0xfcc3('0x16')](function(_0x5438b0){_0x2dc839=_0x5438b0;return util[_0xfcc3('0x11')]();})[_0xfcc3('0x16')](function(_0x4fe2c9){if(_0x4fe2c9&&_0x4fe2c9[_0xfcc3('0x17')]&&_0x2dc839>=_0x4fe2c9['agents']){throw Error(_0xfcc3('0x18'));}_0xbc2abd(_0x3ee738);})['catch'](function(_0x40e8db){_0xf3fa4f(_0x40e8db);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c4b4f95..c4c901f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xead3=['send','exports','404','status','render','json'];(function(_0x11a3bb,_0x56eb70){var _0x214579=function(_0x3e7cd1){while(--_0x3e7cd1){_0x11a3bb['push'](_0x11a3bb['shift']());}};_0x214579(++_0x56eb70);}(_0xead3,0xa9));var _0x3ead=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xead3[_0x2aecb2];return _0x3ebb80;};'use strict';module[_0x3ead('0x0')][0x194]=function pageNotFound(_0x36a8db,_0x5e5786){var _0x49dfd3=_0x3ead('0x1');var _0x7fc8f4=0x194;var _0x36df89={'status':_0x7fc8f4};_0x5e5786['status'](_0x36df89[_0x3ead('0x2')]);_0x5e5786[_0x3ead('0x3')](_0x49dfd3,{},function(_0x330182,_0xbff0c7){if(_0x330182){return _0x5e5786[_0x3ead('0x2')](_0x36df89[_0x3ead('0x2')])[_0x3ead('0x4')](_0x36df89);}_0x5e5786[_0x3ead('0x5')](_0xbff0c7);});}; \ No newline at end of file +var _0x0b1e=['render','json','send','exports','404','status'];(function(_0x424c12,_0x22b45c){var _0x54a6a1=function(_0x105b86){while(--_0x105b86){_0x424c12['push'](_0x424c12['shift']());}};_0x54a6a1(++_0x22b45c);}(_0x0b1e,0x6f));var _0xe0b1=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x0b1e[_0x20c9b2];return _0x2c6030;};'use strict';module[_0xe0b1('0x0')][0x194]=function pageNotFound(_0x1100b1,_0x5360c7){var _0x5b4577=_0xe0b1('0x1');var _0xec8df1=0x194;var _0x924cf5={'status':_0xec8df1};_0x5360c7[_0xe0b1('0x2')](_0x924cf5['status']);_0x5360c7[_0xe0b1('0x3')](_0x5b4577,{},function(_0x12b9c0,_0x5e0171){if(_0x12b9c0){return _0x5360c7[_0xe0b1('0x2')](_0x924cf5[_0xe0b1('0x2')])[_0xe0b1('0x4')](_0x924cf5);}_0x5360c7[_0xe0b1('0x5')](_0x5e0171);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5f01e8a..c63750c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34f8=['FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Tags','Attachment','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','AttachmentId','Members','CompanyId','JscriptySessions','Company','cm_user_has_contacts','cm_contact_has_tags','Campaign','CampaignId','OwnerId','CmHopperBlack','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','Subject','Description','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','ServicenowField','Dynamics365Configuration','ChatQueueReport','FromId','ToId','SessionId','SmsQueueReport','ProjectId','user_has_square_projects','team_has_mail_queues','team_has_chat_queues','team_has_sms_queues','team_has_openchannel_queues','Hoppers','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','path','../config/environment','sequelize','lodash','jstz','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8','utf8_general_ci','sequelizeHistory','motion2','utf8mb4','name','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','User','hasOne','VoiceMail','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','ChatGroup','Groups','chat_group_has_users','Contacts','belongsToMany','Team','user_has_teams','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','UserMailQueue','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','SmsAccount','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','cascade','VoiceMusicOnHold','Sound','moh_has_sounds','UserVoiceQueueRt','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','Applications','List','user_has_mail_accounts','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','restrict','TagId','MailQueueReport','ListId','Items','FaxAccount'];(function(_0xf163c5,_0x5a1df2){var _0x3b5141=function(_0x12b65b){while(--_0x12b65b){_0xf163c5['push'](_0xf163c5['shift']());}};_0x3b5141(++_0x5a1df2);}(_0x34f8,0x80));var _0x834f=function(_0xbb9b93,_0x2eed98){_0xbb9b93=_0xbb9b93-0x0;var _0x5a9d90=_0x34f8[_0xbb9b93];return _0x5a9d90;};'use strict';var path=require(_0x834f('0x0'));var config=require(_0x834f('0x1'));var Sequelize=require(_0x834f('0x2'));var _=require(_0x834f('0x3'));var jstz=require(_0x834f('0x4'));var timezone=jstz['determine']();config['sequelize']=_[_0x834f('0x5')](config[_0x834f('0x2')],{'database':'motion2','username':_0x834f('0x6'),'password':_0x834f('0x7'),'options':{'host':_0x834f('0x8'),'port':0xcea,'dialect':_0x834f('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x834f('0xa'),'collate':_0x834f('0xb')}}});config[_0x834f('0xc')]=_[_0x834f('0x5')](config['sequelizeHistory'],{'database':_0x834f('0xd'),'username':_0x834f('0x6'),'password':'xC@LL1234','options':{'host':_0x834f('0x8'),'port':0xcea,'dialect':_0x834f('0x9'),'dialectOptions':{'charset':_0x834f('0xe')},'logging':![],'timezone':timezone[_0x834f('0xf')](),'define':{'charset':_0x834f('0xa'),'collate':_0x834f('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x834f('0x2')][_0x834f('0x10')],config['sequelize'][_0x834f('0x11')],config[_0x834f('0x2')][_0x834f('0x12')],config[_0x834f('0x2')][_0x834f('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x834f('0x10')],config[_0x834f('0xc')]['username'],config[_0x834f('0xc')][_0x834f('0x12')],config['sequelizeHistory'][_0x834f('0x13')])};db['User']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x15'));db[_0x834f('0x16')]=db['sequelize']['import'](_0x834f('0x17'));db[_0x834f('0x18')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/voiceContext/voiceContext.model');db[_0x834f('0x19')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x834f('0x2')]['import'](_0x834f('0x1a'));db[_0x834f('0x1b')]=db['sequelize'][_0x834f('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0x834f('0x1c')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x1d'));db['ScreenRecording']=db[_0x834f('0x2')]['import'](_0x834f('0x1e'));db['VoiceMail']=db['sequelize'][_0x834f('0x14')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db['sequelize'][_0x834f('0x14')](_0x834f('0x1f'));db[_0x834f('0x20')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x21'));db[_0x834f('0x22')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x23'));db[_0x834f('0x24')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x25'));db[_0x834f('0x26')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x27'));db[_0x834f('0x28')]=db[_0x834f('0x2')]['import'](_0x834f('0x29'));db[_0x834f('0x2a')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/trunk/trunk.model');db[_0x834f('0x2b')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x2c'));db['UserVoiceQueueRt']=db[_0x834f('0x2')][_0x834f('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x834f('0x2d')]=db[_0x834f('0x2')]['import'](_0x834f('0x2e'));db[_0x834f('0x2f')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x30'));db['UserMailQueue']=db[_0x834f('0x2')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x834f('0x31')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x32'));db[_0x834f('0x33')]=db[_0x834f('0x2')]['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x34'));db[_0x834f('0x35')]=db[_0x834f('0x2')]['import'](_0x834f('0x36'));db[_0x834f('0x37')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x38'));db[_0x834f('0x39')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x3a'));db[_0x834f('0x3b')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x3c'));db['MailQueue']=db['sequelize']['import'](_0x834f('0x3d'));db['MailSubstatus']=db['sequelize'][_0x834f('0x14')](_0x834f('0x3e'));db[_0x834f('0x3f')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x834f('0x40')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x41'));db[_0x834f('0x42')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x43'));db['MailQueueReport']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x44'));db['Dashboard']=db['sequelize'][_0x834f('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x45'));db['FaxAccount']=db['sequelize']['import']('../api/faxAccount/faxAccount.model');db[_0x834f('0x46')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x47'));db[_0x834f('0x48')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x49'));db[_0x834f('0x4a')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x4b'));db[_0x834f('0x4c')]=db[_0x834f('0x2')]['import']('../api/faxQueue/faxQueue.model');db[_0x834f('0x4d')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x4e'));db['SmsAccount']=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db[_0x834f('0x4f')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x50'));db[_0x834f('0x51')]=db[_0x834f('0x2')]['import'](_0x834f('0x52'));db[_0x834f('0x53')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x54'));db[_0x834f('0x55')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x56'));db['OpenchannelAccount']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x57'));db['OpenchannelApplication']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x58'));db[_0x834f('0x59')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x5a'));db[_0x834f('0x5b')]=db[_0x834f('0x2')]['import'](_0x834f('0x5c'));db[_0x834f('0x5d')]=db['sequelize'][_0x834f('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x834f('0x5e')]=db['sequelize'][_0x834f('0x14')]('../api/chatWebsite/chatWebsite.model');db[_0x834f('0x5f')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x60'));db[_0x834f('0x61')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x62'));db['ChatInteraction']=db['sequelize']['import'](_0x834f('0x63'));db[_0x834f('0x64')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/chatMessage/chatMessage.model');db[_0x834f('0x65')]=db[_0x834f('0x2')]['import'](_0x834f('0x66'));db['ChatQueue']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x67'));db['ChatGroup']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x68'));db[_0x834f('0x69')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x6a'));db[_0x834f('0x6b')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x6c'));db[_0x834f('0x6d')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x6e'));db[_0x834f('0x6f')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x70'));db['CmHopperBlack']=db[_0x834f('0x2')][_0x834f('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x834f('0x71')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x72'));db[_0x834f('0x73')]=db['sequelize']['import'](_0x834f('0x74'));db[_0x834f('0x75')]=db[_0x834f('0x2')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x834f('0x76')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x77'));db[_0x834f('0x78')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/action/action.model');db[_0x834f('0x79')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x7a'));db[_0x834f('0x7b')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x7c'));db[_0x834f('0x7d')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x7e'));db[_0x834f('0x7f')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x80'));db[_0x834f('0x81')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x82'));db[_0x834f('0x83')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x84'));db[_0x834f('0x85')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x86'));db[_0x834f('0x87')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x88'));db['Schedule']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x89'));db['Sound']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x8a'));db[_0x834f('0x8b')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x8c'));db[_0x834f('0x8d')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x8e'));db[_0x834f('0x8f')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x90'));db[_0x834f('0x91')]=db['sequelize'][_0x834f('0x14')](_0x834f('0x92'));db[_0x834f('0x93')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x94'));db['IntegrationReport']=db[_0x834f('0x2')][_0x834f('0x14')]('../api/integrationReport/integrationReport.model');db[_0x834f('0x95')]=db[_0x834f('0x2')]['import'](_0x834f('0x96'));db[_0x834f('0x97')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x98'));db['AnalyticExtractedReport']=db['sequelize'][_0x834f('0x14')](_0x834f('0x99'));db[_0x834f('0x9a')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x9b'));db[_0x834f('0x9c')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x834f('0x9d')]=db[_0x834f('0x2')]['import'](_0x834f('0x9e'));db[_0x834f('0x9f')]=db['sequelize'][_0x834f('0x14')](_0x834f('0xa0'));db[_0x834f('0xa1')]=db['sequelize'][_0x834f('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xa2'));db[_0x834f('0xa3')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x834f('0xa4')]=db[_0x834f('0x2')]['import'](_0x834f('0xa5'));db[_0x834f('0xa6')]=db['sequelize'][_0x834f('0x14')](_0x834f('0xa7'));db[_0x834f('0xa8')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xa9'));db[_0x834f('0xaa')]=db[_0x834f('0x2')]['import'](_0x834f('0xab'));db[_0x834f('0xac')]=db[_0x834f('0x2')]['import'](_0x834f('0xad'));db[_0x834f('0xae')]=db['sequelize'][_0x834f('0x14')](_0x834f('0xaf'));db['ZohoConfiguration']=db['sequelize']['import'](_0x834f('0xb0'));db[_0x834f('0xb1')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xb2'));db[_0x834f('0xb3')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xb4'));db[_0x834f('0xb5')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xb6'));db[_0x834f('0xb7')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db[_0x834f('0xb8')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x834f('0xb9')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xba'));db[_0x834f('0xbb')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xbc'));db[_0x834f('0xbd')]=db['sequelize']['import'](_0x834f('0xbe'));db['VtigerConfiguration']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xbf'));db[_0x834f('0xc0')]=db['sequelize']['import']('../api/intVtigerField/intVtigerField.model');db[_0x834f('0xc1')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xc2'));db['ServicenowConfiguration']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xc3'));db['ServicenowField']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xc4'));db[_0x834f('0xc5')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xc6'));db[_0x834f('0xc7')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xc8'));db[_0x834f('0xc9')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xca'));db[_0x834f('0xcb')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xcc'));db[_0x834f('0xcd')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xce'));db[_0x834f('0x93')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x834f('0xcf')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/network/network.model');db['ChatQueueReport']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xd0'));db[_0x834f('0xd1')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xd2'));db[_0x834f('0xd3')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xd4'));db[_0x834f('0xd5')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xd6'));db[_0x834f('0xd7')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xd8'));db['SmsQueueReport']=db[_0x834f('0x2')][_0x834f('0x14')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0x834f('0x14')](_0x834f('0xd9'));db[_0x834f('0xda')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xdb'));db[_0x834f('0xdc')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x834f('0xdd')]=db['sequelize'][_0x834f('0x14')](_0x834f('0xde'));db[_0x834f('0xdf')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xe0'));db[_0x834f('0xe1')]=db[_0x834f('0x2')]['import']('../api/squareProject/squareProject.model');db['SquareRecording']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xe2'));db[_0x834f('0xe3')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xe4'));db['Team']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xe5'));db[_0x834f('0xe6')]=db['sequelize'][_0x834f('0x14')](_0x834f('0xe7'));db['Campaign']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xe8'));db[_0x834f('0xe9')]=db['sequelize']['import'](_0x834f('0xea'));db['Attachment']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xeb'));db[_0x834f('0xec')]=db[_0x834f('0x2')]['import'](_0x834f('0xed'));db[_0x834f('0xee')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0x834f('0xef')]=db['sequelize'][_0x834f('0x14')](_0x834f('0xf0'));db['FaxTransferReport']=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xf1'));db[_0x834f('0xf2')]=db['sequelize'][_0x834f('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x834f('0xf3')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xf4'));db[_0x834f('0xf5')]=db[_0x834f('0x2')]['import']('../api/cmList/cmList.model');db[_0x834f('0xf6')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xf7'));db[_0x834f('0xf8')]=db['sequelize'][_0x834f('0x14')](_0x834f('0xf9'));db[_0x834f('0xfa')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0xfb'));db[_0x834f('0xfc')]=db['sequelize']['import'](_0x834f('0xfd'));db[_0x834f('0xfe')]=db['sequelize'][_0x834f('0x14')](_0x834f('0xff'));db[_0x834f('0x100')]=db['sequelize']['import'](_0x834f('0x101'));db[_0x834f('0x102')]=db[_0x834f('0x2')][_0x834f('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0x834f('0x103')]=db['sequelize'][_0x834f('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x834f('0x104')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x105'));db['WhatsappQueueReport']=db[_0x834f('0x2')]['import'](_0x834f('0x106'));db['WhatsappTransferReport']=db[_0x834f('0x2')][_0x834f('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x834f('0x107')]=db[_0x834f('0x2')][_0x834f('0x14')](_0x834f('0x108'));db['CloudProvider']=db['sequelize'][_0x834f('0x14')](_0x834f('0x109'));db[_0x834f('0x10a')][_0x834f('0x10b')](db[_0x834f('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x834f('0x10d')});db[_0x834f('0x10a')][_0x834f('0x10e')](db[_0x834f('0x1c')],{'as':_0x834f('0x10f'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x10a')][_0x834f('0x10e')](db['UserVoiceQueueRt'],{'as':_0x834f('0x110'),'foreignKey':'UserId'});db[_0x834f('0x10a')][_0x834f('0x10e')](db[_0x834f('0x19')],{'as':_0x834f('0x111'),'onDelete':'cascade','hooks':!![]});db[_0x834f('0x10a')][_0x834f('0x10e')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x834f('0x10d')});db[_0x834f('0x10a')][_0x834f('0x10e')](db[_0x834f('0x73')],{'as':_0x834f('0x112'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x10a')][_0x834f('0x10e')](db[_0x834f('0x75')],{'as':_0x834f('0x75'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x10a')]['hasMany'](db[_0x834f('0x59')],{'as':_0x834f('0x113'),'foreignKey':_0x834f('0x10d')});db['User']['hasMany'](db[_0x834f('0x114')],{'as':_0x834f('0x115'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x10a')][_0x834f('0x10e')](db['SmsInteraction'],{'as':_0x834f('0x116'),'foreignKey':_0x834f('0x10d')});db['User'][_0x834f('0x10e')](db[_0x834f('0x48')],{'as':_0x834f('0x117'),'foreignKey':_0x834f('0x10d')});db['User'][_0x834f('0x10e')](db[_0x834f('0x3f')],{'as':_0x834f('0x118'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x10a')][_0x834f('0x10e')](db[_0x834f('0x103')],{'as':_0x834f('0x119'),'foreignKey':'UserId'});db[_0x834f('0x10a')]['hasMany'](db['Notification'],{'as':'Notifications','foreignKey':_0x834f('0x11a')});db[_0x834f('0x10a')][_0x834f('0x11b')](db[_0x834f('0xf8')],{'as':_0x834f('0xf8'),'foreignKey':_0x834f('0x11c')});db[_0x834f('0x10a')]['belongsToMany'](db[_0x834f('0x11d')],{'as':_0x834f('0x11e'),'through':_0x834f('0x11f')});db[_0x834f('0x10a')]['belongsToMany'](db[_0x834f('0x6d')],{'as':_0x834f('0x120'),'through':'cm_user_has_contacts'});db['User'][_0x834f('0x121')](db[_0x834f('0xf5')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x834f('0x10a')]['belongsToMany'](db[_0x834f('0x122')],{'through':_0x834f('0x123')});db['User'][_0x834f('0x121')](db[_0x834f('0x3f')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x834f('0x10a')][_0x834f('0x121')](db['ChatInteraction'],{'as':_0x834f('0x115'),'through':'user_has_chat_interactions'});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0x48')],{'as':_0x834f('0x117'),'through':_0x834f('0x124')});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0x51')],{'as':'SmsInteractions','through':_0x834f('0x125')});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0x59')],{'as':_0x834f('0x113'),'through':'user_has_openchannel_interactions'});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0x103')],{'as':_0x834f('0x119'),'through':_0x834f('0x126')});db[_0x834f('0x10a')]['belongsToMany'](db['VoiceQueue'],{'as':_0x834f('0x127'),'through':_0x834f('0x2d'),'required':![]});db['User'][_0x834f('0x121')](db[_0x834f('0x128')],{'as':_0x834f('0x129'),'through':_0x834f('0x12a'),'required':![]});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0x12b')],{'as':_0x834f('0x12c'),'through':_0x834f('0x2f'),'required':![],'hooks':!![]});db[_0x834f('0x10a')]['belongsToMany'](db['FaxQueue'],{'as':_0x834f('0x12d'),'through':_0x834f('0x31'),'required':![]});db['User'][_0x834f('0x121')](db['SmsQueue'],{'as':_0x834f('0x12e'),'through':'UserSmsQueue','required':![]});db['User'][_0x834f('0x121')](db[_0x834f('0x5d')],{'as':_0x834f('0x12f'),'through':_0x834f('0x130'),'required':![]});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0x107')],{'as':_0x834f('0x131'),'through':'UserWhatsappQueue','required':![]});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0xf5')],{'through':_0x834f('0x132')});db[_0x834f('0x10a')]['belongsToMany'](db[_0x834f('0xf6')],{'as':_0x834f('0x133'),'through':_0x834f('0x134'),'required':![]});db['User'][_0x834f('0x121')](db[_0x834f('0x5e')],{'as':'ChatWebsites','through':_0x834f('0x135')});db['User'][_0x834f('0x121')](db['FaxAccount'],{'as':_0x834f('0x136'),'through':_0x834f('0x137')});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0x3b')],{'as':_0x834f('0x138'),'through':'user_has_mail_accounts'});db[_0x834f('0x10a')][_0x834f('0x121')](db[_0x834f('0x139')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x834f('0x10a')]['belongsToMany'](db[_0x834f('0x13a')],{'as':'SmsAccounts','through':_0x834f('0x13b')});db['User'][_0x834f('0x121')](db[_0x834f('0x100')],{'as':_0x834f('0x13c'),'through':_0x834f('0x13d')});db[_0x834f('0x10a')][_0x834f('0x121')](db['SquareProject'],{'as':_0x834f('0x13e'),'through':'user_has_square_projects'});db[_0x834f('0x16')]['hasMany'](db['VoiceExtension'],{'as':_0x834f('0x13f'),'onDelete':'cascade','foreignKey':_0x834f('0x140')});db[_0x834f('0x18')][_0x834f('0x10e')](db[_0x834f('0x19')],{'onDelete':_0x834f('0x141')});db['VoiceExtension'][_0x834f('0x10e')](db[_0x834f('0x19')],{'as':'Applications','onDelete':_0x834f('0x141')});db[_0x834f('0x142')][_0x834f('0x121')](db[_0x834f('0x143')],{'as':'Sounds','through':_0x834f('0x144')});db[_0x834f('0x1b')]['hasMany'](db[_0x834f('0x145')],{'as':'Members','foreignKey':_0x834f('0x146')});db[_0x834f('0x1b')]['hasMany'](db[_0x834f('0x6f')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x834f('0x10e')](db[_0x834f('0x71')],{'as':_0x834f('0x147'),'foreignKey':'VoiceQueueId'});db[_0x834f('0x1b')][_0x834f('0x10e')](db[_0x834f('0x73')],{'as':_0x834f('0x148'),'foreignKey':_0x834f('0x146')});db[_0x834f('0x1b')][_0x834f('0x10e')](db[_0x834f('0x75')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x834f('0x10e')](db['CmHopperBlack'],{'as':_0x834f('0x149'),'foreignKey':_0x834f('0x146')});db['VoiceQueue'][_0x834f('0x10e')](db[_0x834f('0xd7')],{'as':'JscriptySessions','foreignKey':_0x834f('0x146')});db[_0x834f('0x1b')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0x834f('0x14a')});db[_0x834f('0x1b')]['belongsTo'](db[_0x834f('0x2a')],{'as':'TrunkBackup','foreignKey':_0x834f('0x14b')});db['VoiceQueue'][_0x834f('0x11b')](db[_0x834f('0x81')],{'as':_0x834f('0x81'),'foreignKey':_0x834f('0x14c')});db[_0x834f('0x1b')]['belongsTo'](db[_0x834f('0x83')],{'as':_0x834f('0x14d'),'foreignKey':_0x834f('0x14e')});db[_0x834f('0x1b')][_0x834f('0x121')](db[_0x834f('0xf5')],{'as':_0x834f('0x14f'),'through':'voice_queues_has_cm_lists'});db[_0x834f('0x1b')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x2d')});db[_0x834f('0x1b')]['belongsToMany'](db[_0x834f('0x122')],{'as':_0x834f('0x151'),'through':_0x834f('0x152')});db[_0x834f('0x1b')][_0x834f('0x121')](db['CmList'],{'as':'BlackLists','through':_0x834f('0x153')});db[_0x834f('0x1c')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x10a'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x154')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x10a'),'foreignKey':_0x834f('0x10d')});db['VoiceMail']['hasMany'](db[_0x834f('0x155')],{'as':_0x834f('0x156'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x157'),'sourceKey':_0x834f('0x158')});db['VoiceMailMessage'][_0x834f('0x11b')](db[_0x834f('0x10c')],{'foreignKey':_0x834f('0x157'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x834f('0x10e')](db[_0x834f('0x26')],{'as':_0x834f('0x159'),'foreignKey':_0x834f('0x15a'),'constraints':![]});db[_0x834f('0x20')][_0x834f('0x10e')](db[_0x834f('0x24')],{'as':_0x834f('0x15b'),'foreignKey':_0x834f('0x15a'),'constraints':![]});db[_0x834f('0x20')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x10a'),'foreignKey':_0x834f('0x10d')});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x834f('0x15c')});db[_0x834f('0x37')][_0x834f('0x11b')](db[_0x834f('0x3b')],{'as':_0x834f('0x3b'),'foreignKey':_0x834f('0x15d')});db['MailServerOut']['belongsTo'](db[_0x834f('0x3b')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x834f('0x3b')][_0x834f('0x10b')](db[_0x834f('0x37')],{'as':_0x834f('0x15e'),'onDelete':_0x834f('0x141')});db[_0x834f('0x3b')][_0x834f('0x10b')](db[_0x834f('0x39')],{'as':_0x834f('0x15f'),'onDelete':_0x834f('0x141')});db['MailAccount'][_0x834f('0x10e')](db[_0x834f('0x7d')],{'as':_0x834f('0x160'),'foreignKey':_0x834f('0x15d')});db[_0x834f('0x3b')][_0x834f('0x10e')](db['CannedAnswer'],{'as':_0x834f('0x161'),'foreignKey':_0x834f('0x15d')});db[_0x834f('0x3b')]['hasMany'](db[_0x834f('0x40')],{'as':_0x834f('0x156'),'foreignKey':'MailAccountId'});db[_0x834f('0x3b')][_0x834f('0x10e')](db[_0x834f('0x3f')],{'as':_0x834f('0x162')});db[_0x834f('0x3b')][_0x834f('0x10e')](db[_0x834f('0x42')],{'as':_0x834f('0x163')});db['MailAccount']['belongsTo'](db['CmList'],{'as':_0x834f('0x164'),'foreignKey':'ListId'});db[_0x834f('0x3b')][_0x834f('0x11b')](db['Template'],{'as':'Template','foreignKey':'TemplateId'});db[_0x834f('0x3b')][_0x834f('0x11b')](db['Pause'],{'as':_0x834f('0x14d'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x834f('0x3b')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x165')});db[_0x834f('0x128')]['belongsToMany'](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x12a')});db['MailQueue'][_0x834f('0x121')](db['Team'],{'through':'team_has_mail_queues','as':'Teams'});db[_0x834f('0x3f')][_0x834f('0x10e')](db[_0x834f('0x40')],{'as':'Messages','onDelete':_0x834f('0x141'),'foreignKey':'MailInteractionId'});db[_0x834f('0x3f')]['belongsTo'](db[_0x834f('0x3b')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x15d')});db[_0x834f('0x3f')][_0x834f('0x11b')](db[_0x834f('0x6d')],{'as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db['MailInteraction'][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x168'),'foreignKey':_0x834f('0x10d')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x834f('0x3f')][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':_0x834f('0x169'),'as':_0x834f('0x16a')});db['MailInteraction'][_0x834f('0x121')](db['User'],{'as':_0x834f('0x16b'),'through':_0x834f('0x16c'),'foreignKey':_0x834f('0x16d')});db[_0x834f('0x40')][_0x834f('0x10e')](db['Attachment'],{'as':_0x834f('0x16e'),'onDelete':_0x834f('0x141')});db[_0x834f('0x40')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':'User'});db[_0x834f('0x40')][_0x834f('0x11b')](db[_0x834f('0x6d')],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x167')});db['MailMessage'][_0x834f('0x11b')](db['MailInteraction'],{'as':_0x834f('0x16f'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x834f('0x11b')](db[_0x834f('0x3b')],{'as':_0x834f('0x166'),'foreignKey':'MailAccountId'});db[_0x834f('0x42')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'onDelete':_0x834f('0x170')});db['MailApplication'][_0x834f('0x11b')](db['MailQueue'],{'onDelete':_0x834f('0x170')});db[_0x834f('0x42')][_0x834f('0x11b')](db[_0x834f('0x3b')],{'onDelete':_0x834f('0x170')});db[_0x834f('0x42')][_0x834f('0x11b')](db[_0x834f('0x81')],{'onDelete':_0x834f('0x170'),'foreignKey':'IntervalId'});db[_0x834f('0x42')]['belongsTo'](db[_0x834f('0x8b')],{'onDelete':_0x834f('0x170'),'foreignKey':_0x834f('0x171')});db[_0x834f('0x172')]['belongsTo'](db[_0x834f('0x3b')],{});db[_0x834f('0x172')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173')});db['MailQueueReport']['belongsTo'](db[_0x834f('0x6d')],{'as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x172')][_0x834f('0x11b')](db[_0x834f('0x3f')],{});db[_0x834f('0x172')][_0x834f('0x11b')](db[_0x834f('0x40')],{});db[_0x834f('0x172')][_0x834f('0x11b')](db['User'],{});db[_0x834f('0x172')][_0x834f('0x11b')](db[_0x834f('0x128')],{});db['Dashboard'][_0x834f('0x10e')](db['DashboardItem'],{'as':_0x834f('0x174'),'onDelete':'cascade'});db[_0x834f('0x175')]['hasMany'](db[_0x834f('0x7d')],{'as':'Dispositions','foreignKey':_0x834f('0x176')});db['FaxAccount']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x834f('0x176')});db[_0x834f('0x175')][_0x834f('0x10e')](db[_0x834f('0x48')],{'as':_0x834f('0x162')});db[_0x834f('0x175')][_0x834f('0x10e')](db['FaxApplication'],{'as':_0x834f('0x163')});db[_0x834f('0x175')][_0x834f('0x10e')](db[_0x834f('0x19')],{'as':_0x834f('0x177'),'onDelete':_0x834f('0x141')});db['FaxAccount'][_0x834f('0x10e')](db[_0x834f('0x4a')],{'as':_0x834f('0x156')});db[_0x834f('0x175')][_0x834f('0x11b')](db['Trunk'],{'as':'Trunk'});db['FaxAccount'][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173')});db[_0x834f('0x175')]['belongsTo'](db[_0x834f('0x83')],{'as':_0x834f('0x14d'),'foreignKey':_0x834f('0x14e')});db[_0x834f('0x175')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':'user_has_fax_accounts'});db[_0x834f('0x46')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'onDelete':_0x834f('0x170')});db[_0x834f('0x46')]['belongsTo'](db[_0x834f('0x4c')],{'onDelete':_0x834f('0x170')});db[_0x834f('0x46')]['belongsTo'](db[_0x834f('0x175')],{'onDelete':'restrict'});db[_0x834f('0x46')][_0x834f('0x11b')](db[_0x834f('0x8b')],{'onDelete':_0x834f('0x170'),'foreignKey':_0x834f('0x171')});db[_0x834f('0x48')][_0x834f('0x10e')](db[_0x834f('0x4a')],{'as':_0x834f('0x156'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x178')});db['FaxInteraction'][_0x834f('0x11b')](db[_0x834f('0x175')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x176')});db[_0x834f('0x48')][_0x834f('0x11b')](db[_0x834f('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db[_0x834f('0x48')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x168'),'foreignKey':_0x834f('0x10d')});db['FaxInteraction']['belongsToMany'](db[_0x834f('0x8b')],{'through':_0x834f('0x179'),'as':_0x834f('0x17a')});db[_0x834f('0x48')][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':_0x834f('0x179'),'as':'ThroughTags'});db['FaxInteraction'][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x16b'),'through':'user_has_fax_interactions','foreignKey':_0x834f('0x178')});db[_0x834f('0x4a')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x10a')});db['FaxMessage'][_0x834f('0x11b')](db[_0x834f('0x48')],{'as':_0x834f('0x16f'),'foreignKey':'FaxInteractionId'});db[_0x834f('0x4a')][_0x834f('0x11b')](db[_0x834f('0x6d')],{'onDelete':_0x834f('0x141'),'as':'Contact'});db[_0x834f('0x4a')][_0x834f('0x11b')](db['Attachment'],{'as':_0x834f('0x17b'),'foreignKey':'AttachmentId'});db[_0x834f('0x4a')][_0x834f('0x11b')](db[_0x834f('0x175')],{'as':'Account','foreignKey':_0x834f('0x176')});db[_0x834f('0x4c')][_0x834f('0x121')](db['User'],{'as':_0x834f('0x150'),'through':_0x834f('0x31')});db[_0x834f('0x4c')][_0x834f('0x121')](db[_0x834f('0x122')],{'through':_0x834f('0x17c'),'as':_0x834f('0x151')});db[_0x834f('0x4d')][_0x834f('0x11b')](db[_0x834f('0x175')],{});db[_0x834f('0x4d')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173')});db[_0x834f('0x4d')]['belongsTo'](db[_0x834f('0x6d')],{'as':_0x834f('0x167'),'foreignKey':'ContactId'});db[_0x834f('0x4d')]['belongsTo'](db['FaxInteraction'],{});db['FaxQueueReport'][_0x834f('0x11b')](db[_0x834f('0x4a')],{});db['FaxQueueReport'][_0x834f('0x11b')](db[_0x834f('0x10a')],{});db[_0x834f('0x4d')]['belongsTo'](db['FaxQueue'],{});db[_0x834f('0x13a')][_0x834f('0x10e')](db[_0x834f('0x7d')],{'as':_0x834f('0x160'),'foreignKey':_0x834f('0x17d')});db['SmsAccount']['hasMany'](db[_0x834f('0x7b')],{'as':_0x834f('0x161'),'foreignKey':'SmsAccountId'});db[_0x834f('0x13a')]['hasMany'](db[_0x834f('0x53')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x834f('0x13a')][_0x834f('0x10e')](db['SmsInteraction'],{'as':_0x834f('0x162')});db[_0x834f('0x13a')][_0x834f('0x10e')](db[_0x834f('0x4f')],{'as':'Applications'});db[_0x834f('0x13a')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173')});db['SmsAccount'][_0x834f('0x11b')](db[_0x834f('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x834f('0x14e')});db[_0x834f('0x13a')][_0x834f('0x121')](db['User'],{'as':_0x834f('0x150'),'through':_0x834f('0x13b')});db[_0x834f('0x4f')][_0x834f('0x11b')](db['User'],{'onDelete':_0x834f('0x170')});db['SmsApplication']['belongsTo'](db['SmsQueue'],{'onDelete':_0x834f('0x170')});db['SmsApplication'][_0x834f('0x11b')](db[_0x834f('0x13a')],{'onDelete':_0x834f('0x170')});db[_0x834f('0x4f')][_0x834f('0x11b')](db[_0x834f('0x81')],{'onDelete':'restrict','foreignKey':_0x834f('0x14c')});db[_0x834f('0x4f')][_0x834f('0x11b')](db[_0x834f('0x8b')],{'onDelete':_0x834f('0x170'),'foreignKey':_0x834f('0x171')});db['SmsInteraction']['hasMany'](db[_0x834f('0x53')],{'as':_0x834f('0x156'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x17e')});db[_0x834f('0x51')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x834f('0x51')][_0x834f('0x11b')](db['CmContact'],{'as':_0x834f('0x167'),'foreignKey':'ContactId'});db['SmsInteraction'][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x168'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x51')][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':_0x834f('0x17f'),'as':_0x834f('0x17a')});db['SmsInteraction'][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':'sms_interaction_has_tags','as':_0x834f('0x16a')});db[_0x834f('0x51')]['belongsToMany'](db[_0x834f('0x10a')],{'as':_0x834f('0x16b'),'through':_0x834f('0x125'),'foreignKey':_0x834f('0x17e')});db[_0x834f('0x53')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x10a')});db[_0x834f('0x53')][_0x834f('0x11b')](db[_0x834f('0x6d')],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x167')});db[_0x834f('0x53')][_0x834f('0x11b')](db['SmsInteraction'],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x16f'),'foreignKey':_0x834f('0x17e')});db[_0x834f('0x53')][_0x834f('0x11b')](db[_0x834f('0x13a')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x17d')});db[_0x834f('0x55')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x33'),'foreignKey':_0x834f('0x180')});db[_0x834f('0x55')][_0x834f('0x121')](db[_0x834f('0x122')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount'][_0x834f('0x10e')](db[_0x834f('0x7d')],{'as':_0x834f('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0x834f('0x139')]['hasMany'](db[_0x834f('0x7b')],{'as':_0x834f('0x161'),'foreignKey':_0x834f('0x181')});db[_0x834f('0x139')]['hasMany'](db[_0x834f('0x59')],{'as':'Interactions','foreignKey':_0x834f('0x181')});db[_0x834f('0x139')][_0x834f('0x10e')](db[_0x834f('0x5b')],{'as':_0x834f('0x156'),'foreignKey':_0x834f('0x181')});db['OpenchannelAccount'][_0x834f('0x10e')](db[_0x834f('0x182')],{'as':_0x834f('0x163'),'foreignKey':_0x834f('0x181')});db[_0x834f('0x139')][_0x834f('0x11b')](db['CmList'],{'as':'List','foreignKey':_0x834f('0x173')});db['OpenchannelAccount']['belongsTo'](db['Pause'],{'as':_0x834f('0x14d'),'foreignKey':_0x834f('0x14e')});db[_0x834f('0x139')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x183')});db[_0x834f('0x182')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'onDelete':_0x834f('0x170')});db[_0x834f('0x182')]['belongsTo'](db[_0x834f('0x5d')],{'onDelete':_0x834f('0x170'),'foreignKey':'OpenchannelQueueId'});db[_0x834f('0x182')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x834f('0x181')});db[_0x834f('0x182')][_0x834f('0x11b')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x834f('0x14c')});db[_0x834f('0x182')][_0x834f('0x11b')](db[_0x834f('0x8b')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x834f('0x59')][_0x834f('0x10e')](db[_0x834f('0x5b')],{'as':_0x834f('0x156'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x184')});db[_0x834f('0x59')]['belongsTo'](db[_0x834f('0x139')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x181')});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x59')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x168'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x59')][_0x834f('0x121')](db['Tag'],{'through':_0x834f('0x185'),'as':_0x834f('0x17a')});db[_0x834f('0x59')][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':_0x834f('0x185'),'as':_0x834f('0x16a')});db[_0x834f('0x59')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x16b'),'through':_0x834f('0x186'),'foreignKey':_0x834f('0x184')});db[_0x834f('0x5b')]['belongsTo'](db[_0x834f('0x10a')],{'onDelete':_0x834f('0x141'),'as':'User'});db[_0x834f('0x5b')][_0x834f('0x11b')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db['OpenchannelMessage'][_0x834f('0x11b')](db[_0x834f('0x59')],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x16f'),'foreignKey':_0x834f('0x184')});db[_0x834f('0x5b')][_0x834f('0x11b')](db[_0x834f('0x17b')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x834f('0x5b')][_0x834f('0x11b')](db[_0x834f('0x139')],{'as':'Account','foreignKey':_0x834f('0x181')});db['OpenchannelQueue'][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x834f('0x5d')][_0x834f('0x121')](db[_0x834f('0x122')],{'through':'team_has_openchannel_queues','as':_0x834f('0x151')});db['ChatWebsite'][_0x834f('0x10e')](db[_0x834f('0x7d')],{'as':_0x834f('0x160'),'foreignKey':_0x834f('0x187')});db[_0x834f('0x5e')][_0x834f('0x10e')](db['CannedAnswer'],{'as':_0x834f('0x161'),'foreignKey':'ChatWebsiteId'});db[_0x834f('0x5e')]['hasMany'](db[_0x834f('0x69')],{'as':_0x834f('0x188')});db['ChatWebsite'][_0x834f('0x10e')](db[_0x834f('0x114')],{'as':_0x834f('0x162')});db[_0x834f('0x5e')][_0x834f('0x10e')](db['ChatApplication'],{'as':_0x834f('0x163')});db[_0x834f('0x5e')]['hasMany'](db[_0x834f('0x64')],{'as':_0x834f('0x156')});db['ChatWebsite'][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173')});db[_0x834f('0x5e')]['belongsTo'](db[_0x834f('0x81')],{'as':_0x834f('0x81'),'foreignKey':_0x834f('0x14c')});db[_0x834f('0x5e')][_0x834f('0x11b')](db['Pause'],{'as':_0x834f('0x14d'),'foreignKey':_0x834f('0x14e')});db[_0x834f('0x5e')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x135')});db[_0x834f('0x5f')][_0x834f('0x11b')](db[_0x834f('0x139')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173')});db[_0x834f('0x5f')]['belongsTo'](db[_0x834f('0x6d')],{'as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x5f')][_0x834f('0x11b')](db[_0x834f('0x59')],{});db['OpenchannelQueueReport'][_0x834f('0x11b')](db['OpenchannelMessage'],{});db[_0x834f('0x5f')][_0x834f('0x11b')](db['User'],{});db['OpenchannelQueueReport'][_0x834f('0x11b')](db[_0x834f('0x5d')],{});db[_0x834f('0x61')][_0x834f('0x11b')](db['User'],{'as':_0x834f('0x189'),'foreignKey':_0x834f('0x10d'),'onDelete':_0x834f('0x170')});db[_0x834f('0x61')][_0x834f('0x11b')](db['ChatQueue'],{'as':_0x834f('0x18a'),'foreignKey':_0x834f('0x18b'),'onDelete':'restrict'});db[_0x834f('0x61')][_0x834f('0x11b')](db[_0x834f('0x5e')],{'as':_0x834f('0x18c'),'foreignKey':'ChatWebsiteId','onDelete':_0x834f('0x170')});db[_0x834f('0x61')][_0x834f('0x11b')](db[_0x834f('0x8b')],{'onDelete':_0x834f('0x170'),'foreignKey':'TagId'});db[_0x834f('0x114')][_0x834f('0x10e')](db[_0x834f('0x64')],{'as':'Messages','onDelete':'cascade','foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x834f('0x11b')](db[_0x834f('0x5e')],{'as':_0x834f('0x166'),'foreignKey':'ChatWebsiteId'});db[_0x834f('0x114')][_0x834f('0x11b')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['ChatInteraction']['belongsTo'](db[_0x834f('0x10a')],{'as':_0x834f('0x168'),'foreignKey':_0x834f('0x10d')});db[_0x834f('0x114')][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':_0x834f('0x18d'),'as':_0x834f('0x17a')});db['ChatInteraction']['belongsToMany'](db[_0x834f('0x8b')],{'through':_0x834f('0x18d'),'as':'ThroughTags'});db['ChatInteraction'][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x16b'),'through':_0x834f('0x18e'),'foreignKey':_0x834f('0x18f')});db['ChatMessage'][_0x834f('0x11b')](db[_0x834f('0x10a')],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x10a')});db[_0x834f('0x64')]['belongsTo'](db[_0x834f('0x6d')],{'onDelete':'cascade','as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x64')][_0x834f('0x11b')](db[_0x834f('0x114')],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x16f'),'foreignKey':_0x834f('0x18f')});db[_0x834f('0x64')]['belongsTo'](db[_0x834f('0x17b')],{'as':_0x834f('0x17b'),'foreignKey':_0x834f('0x190')});db[_0x834f('0x64')]['belongsTo'](db[_0x834f('0x5e')],{'as':_0x834f('0x166'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x834f('0x11b')](db[_0x834f('0x6d')],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x65')][_0x834f('0x11b')](db[_0x834f('0x5e')],{'as':'Account','foreignKey':_0x834f('0x187')});db['ChatQueue']['belongsToMany'](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x2f'),'hooks':!![]});db[_0x834f('0x12b')][_0x834f('0x121')](db[_0x834f('0x122')],{'through':'team_has_chat_queues','as':_0x834f('0x151')});db[_0x834f('0x11d')][_0x834f('0x10e')](db[_0x834f('0xd1')],{'as':_0x834f('0x156'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db['ChatGroup'][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x191'),'through':_0x834f('0x11f')});db[_0x834f('0x69')]['belongsTo'](db[_0x834f('0x5e')],{'as':'Website','foreignKey':_0x834f('0x187')});db[_0x834f('0x6b')][_0x834f('0x10e')](db[_0x834f('0x6d')],{'as':'Contacts','foreignKey':_0x834f('0x192')});db[_0x834f('0x6d')]['hasMany'](db[_0x834f('0x6f')],{'as':'Hoppers','foreignKey':_0x834f('0x15c')});db[_0x834f('0x6d')]['hasMany'](db[_0x834f('0x71')],{'as':_0x834f('0x147'),'foreignKey':_0x834f('0x15c')});db['CmContact'][_0x834f('0x10e')](db['CmHopperHistory'],{'as':_0x834f('0x148'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x6d')][_0x834f('0x10e')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x834f('0x15c')});db[_0x834f('0x6d')][_0x834f('0x10e')](db[_0x834f('0xd7')],{'as':_0x834f('0x193'),'foreignKey':'ContactId'});db[_0x834f('0x6d')][_0x834f('0x10e')](db[_0x834f('0x59')],{'as':_0x834f('0x113'),'foreignKey':_0x834f('0x15c'),'onDelete':'restrict'});db[_0x834f('0x6d')][_0x834f('0x10e')](db[_0x834f('0x114')],{'as':'ChatInteractions','foreignKey':_0x834f('0x15c'),'onDelete':_0x834f('0x170')});db['CmContact'][_0x834f('0x10e')](db[_0x834f('0x51')],{'as':_0x834f('0x116'),'foreignKey':'ContactId','onDelete':_0x834f('0x170')});db[_0x834f('0x6d')][_0x834f('0x10e')](db['FaxInteraction'],{'as':_0x834f('0x117'),'foreignKey':_0x834f('0x15c'),'onDelete':'restrict'});db[_0x834f('0x6d')][_0x834f('0x10e')](db[_0x834f('0x3f')],{'as':_0x834f('0x118'),'foreignKey':_0x834f('0x15c'),'onDelete':'restrict'});db['CmContact'][_0x834f('0x11b')](db['CmCompany'],{'as':_0x834f('0x194'),'foreignKey':_0x834f('0x192')});db[_0x834f('0x6d')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x834f('0x6d')][_0x834f('0x121')](db['User'],{'as':_0x834f('0x16b'),'through':_0x834f('0x195')});db[_0x834f('0x6d')][_0x834f('0x121')](db[_0x834f('0x8b')],{'as':_0x834f('0x17a'),'through':_0x834f('0x196')});db[_0x834f('0x6d')][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':_0x834f('0x196'),'as':_0x834f('0x16a')});db['CmHopper']['belongsTo'](db[_0x834f('0x6d')],{'as':'Contact','foreignKey':_0x834f('0x15c'),'onDelete':_0x834f('0x141')});db[_0x834f('0x6f')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173'),'onDelete':_0x834f('0x141')});db[_0x834f('0x6f')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x189'),'foreignKey':'UserId'});db['CmHopper'][_0x834f('0x11b')](db[_0x834f('0x1b')],{'as':_0x834f('0x18a'),'foreignKey':_0x834f('0x146'),'onDelete':_0x834f('0x141')});db['CmHopper'][_0x834f('0x11b')](db['Campaign'],{'as':_0x834f('0x197'),'foreignKey':_0x834f('0x198'),'onDelete':_0x834f('0x141')});db[_0x834f('0x6f')]['belongsTo'](db[_0x834f('0x10a')],{'as':_0x834f('0x168'),'foreignKey':_0x834f('0x199')});db[_0x834f('0x19a')][_0x834f('0x11b')](db[_0x834f('0x6d')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x834f('0x141')});db[_0x834f('0x19a')]['belongsTo'](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173'),'onDelete':'cascade'});db[_0x834f('0x19a')][_0x834f('0x11b')](db[_0x834f('0x1b')],{'as':_0x834f('0x18a'),'foreignKey':_0x834f('0x146'),'onDelete':_0x834f('0x141')});db[_0x834f('0x19a')][_0x834f('0x11b')](db[_0x834f('0x197')],{'as':_0x834f('0x197'),'foreignKey':_0x834f('0x198'),'onDelete':_0x834f('0x141')});db[_0x834f('0x79')]['hasMany'](db[_0x834f('0x7f')],{'as':{'plural':_0x834f('0x19b'),'singular':_0x834f('0x19c')},'foreignKey':_0x834f('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0x834f('0x79')]['hasMany'](db[_0x834f('0x7f')],{'as':{'plural':_0x834f('0x19e'),'singular':_0x834f('0x19f')},'foreignKey':_0x834f('0x1a0'),'onDelete':_0x834f('0x141'),'hooks':!![]});db[_0x834f('0x79')][_0x834f('0x10e')](db[_0x834f('0x78')],{'as':_0x834f('0x1a1'),'foreignKey':'AutomationId','onDelete':_0x834f('0x141'),'hooks':!![]});db[_0x834f('0x81')][_0x834f('0x10e')](db[_0x834f('0x81')],{'as':_0x834f('0x1a2'),'foreignKey':_0x834f('0x14c'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x834f('0x19')],{'as':_0x834f('0x111'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x834f('0x81')][_0x834f('0x10e')](db['MailApplication'],{'as':_0x834f('0x1a3'),'foreignKey':_0x834f('0x14c')});db[_0x834f('0x81')][_0x834f('0x10e')](db[_0x834f('0x61')],{'as':'ChatApplications','foreignKey':_0x834f('0x14c')});db['Interval']['hasMany'](db[_0x834f('0x46')],{'as':_0x834f('0x1a4'),'foreignKey':'IntervalId'});db[_0x834f('0x81')]['hasMany'](db[_0x834f('0x4f')],{'as':_0x834f('0x1a5'),'foreignKey':_0x834f('0x14c')});db[_0x834f('0x1a6')][_0x834f('0x11b')](db[_0x834f('0x3b')],{});db[_0x834f('0x1a6')][_0x834f('0x11b')](db[_0x834f('0x97')],{'foreignKey':_0x834f('0x1a7')});db[_0x834f('0x1a6')][_0x834f('0x11b')](db[_0x834f('0x95')],{'foreignKey':'CustomReportId'});db[_0x834f('0x143')]['belongsToMany'](db[_0x834f('0x142')],{'as':_0x834f('0x1a8'),'through':_0x834f('0x144'),'onDelete':'restrict'});db[_0x834f('0x8b')][_0x834f('0x121')](db[_0x834f('0x6d')],{'through':_0x834f('0x196')});db[_0x834f('0x8b')]['belongsToMany'](db[_0x834f('0x114')],{'through':_0x834f('0x18d')});db[_0x834f('0x8b')][_0x834f('0x121')](db['MailInteraction'],{'through':_0x834f('0x169')});db[_0x834f('0x8b')][_0x834f('0x121')](db[_0x834f('0x51')],{'through':_0x834f('0x17f')});db[_0x834f('0x8b')][_0x834f('0x121')](db[_0x834f('0x48')],{'through':'fax_interaction_has_tags'});db[_0x834f('0x8b')][_0x834f('0x121')](db[_0x834f('0x59')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0x834f('0x121')](db[_0x834f('0x103')],{'through':_0x834f('0x1a9')});db[_0x834f('0x8f')][_0x834f('0x10e')](db[_0x834f('0x7f')],{'as':{'plural':_0x834f('0x1aa'),'singular':_0x834f('0x1ab')},'foreignKey':_0x834f('0x1ac'),'onDelete':'cascade','hooks':!![]});db[_0x834f('0x8f')][_0x834f('0x10e')](db[_0x834f('0x7f')],{'as':{'plural':'AnyConditions','singular':_0x834f('0x1ad')},'foreignKey':_0x834f('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x834f('0x8f')][_0x834f('0x10e')](db['Action'],{'as':_0x834f('0x1a1'),'foreignKey':_0x834f('0x1af'),'onDelete':'cascade','hooks':!![]});db[_0x834f('0x95')]['hasMany'](db[_0x834f('0x9c')],{'as':_0x834f('0x1b0'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b1'),'hooks':!![]});db['AnalyticDefaultReport'][_0x834f('0x10e')](db[_0x834f('0x9c')],{'as':_0x834f('0x1b0'),'onDelete':_0x834f('0x141'),'foreignKey':'DefaultReportId'});db[_0x834f('0x9a')][_0x834f('0x10e')](db[_0x834f('0x9c')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x834f('0x1b2')});db[_0x834f('0x9c')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0x834f('0x10e')](db[_0x834f('0xa1')],{'as':_0x834f('0x1b3'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b4')});db[_0x834f('0xa1')][_0x834f('0x10e')](db[_0x834f('0x1b5')],{'as':_0x834f('0x1b6'),'onDelete':'cascade','foreignKey':_0x834f('0x1b7')});db[_0x834f('0xa1')][_0x834f('0x10e')](db[_0x834f('0x1b5')],{'as':_0x834f('0x1b8'),'onDelete':'cascade','foreignKey':_0x834f('0x1b9')});db[_0x834f('0xa1')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xa1')][_0x834f('0x11b')](db[_0x834f('0x9f')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x1b4')});db['SalesforceField'][_0x834f('0x10e')](db[_0x834f('0x1b5')],{'as':'Subject','foreignKey':_0x834f('0x1b7')});db['SalesforceField'][_0x834f('0x10e')](db['SalesforceField'],{'as':'Description','foreignKey':_0x834f('0x1b9')});db[_0x834f('0x1b5')][_0x834f('0x10e')](db['SalesforceField'],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0x1b5')][_0x834f('0x11b')](db[_0x834f('0x91')],{'as':'Variable','foreignKey':_0x834f('0x1bc')});db[_0x834f('0xa3')][_0x834f('0x10e')](db[_0x834f('0xa4')],{'as':_0x834f('0x1b3'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b4')});db['SugarcrmConfiguration']['hasMany'](db[_0x834f('0xa6')],{'as':_0x834f('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db['SugarcrmConfiguration'][_0x834f('0x10e')](db[_0x834f('0xa6')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x834f('0x1b9')});db[_0x834f('0xa4')][_0x834f('0x10e')](db['SugarcrmField'],{'as':_0x834f('0x1b0'),'onDelete':'cascade','foreignKey':_0x834f('0x1ba')});db[_0x834f('0xa4')][_0x834f('0x11b')](db[_0x834f('0xa3')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x1b4')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x834f('0x1bd'),'foreignKey':'SubjectId'});db[_0x834f('0xa6')][_0x834f('0x10e')](db[_0x834f('0xa6')],{'as':_0x834f('0x1be'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0xa6')]['hasMany'](db['SugarcrmField'],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xa6')]['belongsTo'](db[_0x834f('0x91')],{'as':'Variable','foreignKey':'VariableId'});db[_0x834f('0xa8')][_0x834f('0x10e')](db[_0x834f('0xaa')],{'as':'Configurations','onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b4')});db[_0x834f('0xaa')]['hasMany'](db[_0x834f('0xac')],{'as':_0x834f('0x1b6'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration'][_0x834f('0x10e')](db[_0x834f('0xac')],{'as':_0x834f('0x1b8'),'onDelete':_0x834f('0x141'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x834f('0x10e')](db[_0x834f('0xac')],{'as':'Fields','onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1ba')});db['DeskConfiguration']['belongsTo'](db[_0x834f('0xa8')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x1b4')});db[_0x834f('0xaa')][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':_0x834f('0x1bf')});db['DeskField'][_0x834f('0x10e')](db[_0x834f('0xac')],{'as':'Subject','foreignKey':_0x834f('0x1b7')});db[_0x834f('0xac')]['hasMany'](db[_0x834f('0xac')],{'as':_0x834f('0x1be'),'foreignKey':'DescriptionId'});db[_0x834f('0xac')]['hasMany'](db[_0x834f('0xac')],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xac')][_0x834f('0x11b')](db[_0x834f('0x91')],{'as':'Variable','foreignKey':_0x834f('0x1bc')});db['ZohoAccount'][_0x834f('0x10e')](db[_0x834f('0x1c0')],{'as':_0x834f('0x1b3'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b4')});db['ZohoConfiguration'][_0x834f('0x10e')](db[_0x834f('0xb1')],{'as':_0x834f('0x1b6'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b7')});db[_0x834f('0x1c0')][_0x834f('0x10e')](db['ZohoField'],{'as':_0x834f('0x1b8'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b9')});db['ZohoConfiguration'][_0x834f('0x10e')](db[_0x834f('0xb1')],{'as':_0x834f('0x1b0'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0x1c0')][_0x834f('0x11b')](db['ZohoAccount'],{'as':_0x834f('0x166'),'foreignKey':'AccountId'});db['ZohoField']['hasMany'](db[_0x834f('0xb1')],{'as':_0x834f('0x1bd'),'foreignKey':'SubjectId'});db[_0x834f('0xb1')][_0x834f('0x10e')](db[_0x834f('0xb1')],{'as':_0x834f('0x1be'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0xb1')]['hasMany'](db['ZohoField'],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xb1')][_0x834f('0x11b')](db['Variable'],{'as':_0x834f('0x91'),'foreignKey':'VariableId'});db[_0x834f('0xb3')]['hasMany'](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x834f('0x1b4')});db['ZendeskConfiguration'][_0x834f('0x10e')](db['ZendeskField'],{'as':_0x834f('0x1b6'),'foreignKey':'SubjectId'});db[_0x834f('0xb5')][_0x834f('0x10e')](db[_0x834f('0xb7')],{'as':_0x834f('0x1b8'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0xb5')][_0x834f('0x10e')](db['ZendeskField'],{'as':_0x834f('0x1b0'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xb5')]['belongsTo'](db[_0x834f('0xb3')],{'as':'Account','foreignKey':_0x834f('0x1b4')});db[_0x834f('0xb5')][_0x834f('0x121')](db[_0x834f('0x8b')],{'through':_0x834f('0x1c1')});db['ZendeskField'][_0x834f('0x10e')](db[_0x834f('0xb7')],{'as':'Subject','foreignKey':_0x834f('0x1b7')});db[_0x834f('0xb7')]['hasMany'](db[_0x834f('0xb7')],{'as':_0x834f('0x1be'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0xb7')][_0x834f('0x10e')](db['ZendeskField'],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xb7')][_0x834f('0x11b')](db[_0x834f('0x91')],{'as':_0x834f('0x91'),'foreignKey':_0x834f('0x1bc')});db[_0x834f('0xb8')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x834f('0x1b3'),'onDelete':'cascade','foreignKey':_0x834f('0x1b4')});db[_0x834f('0xb9')][_0x834f('0x10e')](db[_0x834f('0xbb')],{'as':_0x834f('0x1b6'),'onDelete':_0x834f('0x141'),'foreignKey':'SubjectId'});db[_0x834f('0xb9')]['hasMany'](db[_0x834f('0xbb')],{'as':_0x834f('0x1b8'),'onDelete':'cascade','foreignKey':_0x834f('0x1b9')});db[_0x834f('0xb9')][_0x834f('0x10e')](db[_0x834f('0xbb')],{'as':_0x834f('0x1b0'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xb9')][_0x834f('0x11b')](db[_0x834f('0xb8')],{'as':'Account','foreignKey':_0x834f('0x1b4')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x834f('0x8b')],{'through':_0x834f('0x1c2')});db[_0x834f('0xbb')][_0x834f('0x10e')](db[_0x834f('0xbb')],{'as':_0x834f('0x1bd'),'foreignKey':_0x834f('0x1b7')});db[_0x834f('0xbb')][_0x834f('0x10e')](db[_0x834f('0xbb')],{'as':'Description','foreignKey':_0x834f('0x1b9')});db[_0x834f('0xbb')][_0x834f('0x10e')](db['FreshdeskField'],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xbb')]['belongsTo'](db[_0x834f('0x91')],{'as':'Variable','foreignKey':_0x834f('0x1bc')});db[_0x834f('0xbd')][_0x834f('0x10e')](db[_0x834f('0x1c3')],{'as':_0x834f('0x1b3'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b4')});db[_0x834f('0x1c3')][_0x834f('0x10e')](db[_0x834f('0xc0')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x834f('0x1c3')][_0x834f('0x10e')](db[_0x834f('0xc0')],{'as':_0x834f('0x1b8'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0x1c3')][_0x834f('0x10e')](db[_0x834f('0xc0')],{'as':_0x834f('0x1b0'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0x1c3')][_0x834f('0x11b')](db[_0x834f('0xbd')],{'as':'Account','foreignKey':_0x834f('0x1b4')});db[_0x834f('0xc0')][_0x834f('0x10e')](db[_0x834f('0xc0')],{'as':_0x834f('0x1bd'),'foreignKey':_0x834f('0x1b7')});db[_0x834f('0xc0')]['hasMany'](db['VtigerField'],{'as':'Description','foreignKey':_0x834f('0x1b9')});db['VtigerField']['hasMany'](db[_0x834f('0xc0')],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xc0')]['belongsTo'](db['Variable'],{'as':_0x834f('0x91'),'foreignKey':_0x834f('0x1bc')});db[_0x834f('0xc1')]['hasMany'](db['ServicenowConfiguration'],{'as':_0x834f('0x1b3'),'onDelete':'cascade','foreignKey':_0x834f('0x1b4')});db[_0x834f('0x1c4')]['hasMany'](db[_0x834f('0x1c5')],{'as':_0x834f('0x1b6'),'foreignKey':'SubjectId'});db['ServicenowConfiguration']['hasMany'](db[_0x834f('0x1c5')],{'as':_0x834f('0x1b8'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0x1c4')][_0x834f('0x10e')](db[_0x834f('0x1c5')],{'as':_0x834f('0x1b0'),'foreignKey':_0x834f('0x1ba')});db['ServicenowConfiguration'][_0x834f('0x11b')](db[_0x834f('0xc1')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x1b4')});db[_0x834f('0x1c5')][_0x834f('0x10e')](db[_0x834f('0x1c5')],{'as':_0x834f('0x1bd'),'foreignKey':_0x834f('0x1b7')});db[_0x834f('0x1c5')][_0x834f('0x10e')](db[_0x834f('0x1c5')],{'as':_0x834f('0x1be'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0x1c5')]['hasMany'](db['ServicenowField'],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0x1c5')][_0x834f('0x11b')](db['Variable'],{'as':_0x834f('0x91'),'foreignKey':_0x834f('0x1bc')});db[_0x834f('0xc5')]['hasMany'](db[_0x834f('0x1c6')],{'as':_0x834f('0x1b3'),'onDelete':_0x834f('0x141'),'foreignKey':'AccountId'});db[_0x834f('0x1c6')][_0x834f('0x10e')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x834f('0x1b7')});db[_0x834f('0x1c6')]['hasMany'](db['Dynamics365Field'],{'as':_0x834f('0x1b8'),'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0x1c6')][_0x834f('0x10e')](db[_0x834f('0xc7')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x834f('0x1c6')][_0x834f('0x11b')](db[_0x834f('0xc5')],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x1b4')});db[_0x834f('0xc7')][_0x834f('0x10e')](db[_0x834f('0xc7')],{'as':_0x834f('0x1bd'),'foreignKey':_0x834f('0x1b7')});db[_0x834f('0xc7')]['hasMany'](db[_0x834f('0xc7')],{'as':_0x834f('0x1be'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0xc7')][_0x834f('0x10e')](db['Dynamics365Field'],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xc7')][_0x834f('0x11b')](db[_0x834f('0x91')],{'as':_0x834f('0x91'),'foreignKey':'VariableId'});db[_0x834f('0xc9')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x834f('0x1b3'),'onDelete':'cascade','foreignKey':_0x834f('0x1b4')});db[_0x834f('0xcb')][_0x834f('0x10e')](db[_0x834f('0xcd')],{'as':_0x834f('0x1b6'),'foreignKey':'SubjectId'});db[_0x834f('0xcb')][_0x834f('0x10e')](db[_0x834f('0xcd')],{'as':_0x834f('0x1b8'),'foreignKey':_0x834f('0x1b9')});db[_0x834f('0xcb')][_0x834f('0x10e')](db[_0x834f('0xcd')],{'as':_0x834f('0x1b0'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xcb')]['belongsTo'](db[_0x834f('0xc9')],{'as':'Account','foreignKey':_0x834f('0x1b4')});db['FreshsalesField'][_0x834f('0x10e')](db[_0x834f('0xcd')],{'as':_0x834f('0x1bd'),'foreignKey':_0x834f('0x1b7')});db[_0x834f('0xcd')]['hasMany'](db[_0x834f('0xcd')],{'as':'Description','foreignKey':_0x834f('0x1b9')});db[_0x834f('0xcd')][_0x834f('0x10e')](db[_0x834f('0xcd')],{'as':_0x834f('0x1bb'),'foreignKey':_0x834f('0x1ba')});db[_0x834f('0xcd')][_0x834f('0x11b')](db[_0x834f('0x91')],{'as':'Variable','foreignKey':_0x834f('0x1bc')});db['ChatQueueReport'][_0x834f('0x11b')](db[_0x834f('0x5e')],{});db[_0x834f('0x1c7')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173')});db[_0x834f('0x1c7')][_0x834f('0x11b')](db[_0x834f('0x6d')],{'as':'Contact','foreignKey':_0x834f('0x15c')});db[_0x834f('0x1c7')][_0x834f('0x11b')](db['ChatInteraction'],{});db[_0x834f('0x1c7')][_0x834f('0x11b')](db['ChatMessage'],{});db[_0x834f('0x1c7')][_0x834f('0x11b')](db[_0x834f('0x10a')],{});db[_0x834f('0x1c7')]['belongsTo'](db[_0x834f('0x12b')],{});db[_0x834f('0xd1')]['belongsTo'](db['User'],{'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1c8')});db[_0x834f('0xd1')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x1c9')});db[_0x834f('0xd7')]['hasMany'](db[_0x834f('0xd5')],{'foreignKey':_0x834f('0x1ca'),'onDelete':_0x834f('0x141')});db[_0x834f('0xd7')][_0x834f('0x10e')](db['JscriptyAnswerReport'],{'foreignKey':_0x834f('0x1ca'),'onDelete':_0x834f('0x141')});db[_0x834f('0x1cb')][_0x834f('0x11b')](db[_0x834f('0x13a')],{});db[_0x834f('0x1cb')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':'List','foreignKey':_0x834f('0x173')});db[_0x834f('0x1cb')][_0x834f('0x11b')](db['CmContact'],{'as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x1cb')][_0x834f('0x11b')](db['SmsInteraction'],{});db[_0x834f('0x1cb')]['belongsTo'](db[_0x834f('0x53')],{});db['SmsQueueReport'][_0x834f('0x11b')](db[_0x834f('0x10a')],{});db[_0x834f('0x1cb')][_0x834f('0x11b')](db[_0x834f('0x55')],{});db[_0x834f('0xdc')][_0x834f('0x10e')](db[_0x834f('0xd7')],{'foreignKey':_0x834f('0x1cc')});db[_0x834f('0xdc')]['hasMany'](db[_0x834f('0xd5')],{'foreignKey':_0x834f('0x1cc')});db[_0x834f('0xdc')][_0x834f('0x10e')](db['JscriptyAnswerReport'],{'foreignKey':_0x834f('0x1cc')});db[_0x834f('0xe1')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x16b'),'through':_0x834f('0x1cd')});db[_0x834f('0x122')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x123')});db[_0x834f('0x122')]['belongsToMany'](db[_0x834f('0x1b')],{'through':_0x834f('0x152'),'as':_0x834f('0x127')});db[_0x834f('0x122')][_0x834f('0x121')](db[_0x834f('0x128')],{'through':_0x834f('0x1ce'),'as':'MailQueues'});db[_0x834f('0x122')][_0x834f('0x121')](db[_0x834f('0x12b')],{'through':_0x834f('0x1cf'),'as':'ChatQueues'});db['Team'][_0x834f('0x121')](db[_0x834f('0x4c')],{'through':_0x834f('0x17c'),'as':'FaxQueues'});db[_0x834f('0x122')][_0x834f('0x121')](db[_0x834f('0x55')],{'through':_0x834f('0x1d0'),'as':'SmsQueues'});db[_0x834f('0x122')][_0x834f('0x121')](db[_0x834f('0x5d')],{'through':_0x834f('0x1d1'),'as':_0x834f('0x12f')});db[_0x834f('0x122')][_0x834f('0x121')](db[_0x834f('0x107')],{'through':'team_has_whatsapp_queues','as':_0x834f('0x131')});db[_0x834f('0x197')]['hasMany'](db[_0x834f('0x6f')],{'as':_0x834f('0x1d2'),'foreignKey':_0x834f('0x198')});db[_0x834f('0x197')][_0x834f('0x10e')](db['CmHopperFinal'],{'as':_0x834f('0x147'),'foreignKey':_0x834f('0x198')});db[_0x834f('0x197')][_0x834f('0x10e')](db[_0x834f('0x73')],{'as':_0x834f('0x148'),'foreignKey':_0x834f('0x198')});db[_0x834f('0x197')][_0x834f('0x10e')](db[_0x834f('0x19a')],{'as':_0x834f('0x149'),'foreignKey':'CampaignId'});db['Campaign'][_0x834f('0x11b')](db['Trunk'],{'as':_0x834f('0x2a'),'foreignKey':_0x834f('0x14a')});db['Campaign'][_0x834f('0x11b')](db[_0x834f('0x2a')],{'as':'TrunkBackup','foreignKey':_0x834f('0x14b')});db[_0x834f('0x197')]['belongsTo'](db[_0x834f('0x81')],{'as':_0x834f('0x81'),'foreignKey':_0x834f('0x14c')});db[_0x834f('0x197')][_0x834f('0x11b')](db[_0x834f('0xe1')],{'as':'SquareProject','foreignKey':_0x834f('0x1d3')});db[_0x834f('0x197')][_0x834f('0x121')](db['CmList'],{'as':_0x834f('0x14f'),'through':'campaigns_has_cm_lists'});db[_0x834f('0x197')]['belongsToMany'](db[_0x834f('0xf5')],{'as':_0x834f('0x1d4'),'through':_0x834f('0x1d5')});db[_0x834f('0xee')][_0x834f('0x11b')](db[_0x834f('0x40')],{});db['MailTransferReport'][_0x834f('0x11b')](db['MailInteraction'],{});db[_0x834f('0xee')][_0x834f('0x11b')](db[_0x834f('0x3b')],{'foreignKey':_0x834f('0x1d6'),'as':_0x834f('0x1d7')});db['MailTransferReport'][_0x834f('0x11b')](db['User'],{'foreignKey':'FromUserId','as':_0x834f('0x1d8')});db[_0x834f('0xee')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'foreignKey':_0x834f('0x1d9'),'as':_0x834f('0x1da')});db[_0x834f('0xee')][_0x834f('0x11b')](db[_0x834f('0x128')],{'foreignKey':'ToMailQueueId','as':_0x834f('0x1db')});db['MailTransferReport'][_0x834f('0x11b')](db[_0x834f('0x3b')],{'foreignKey':_0x834f('0x1dc'),'as':'ToAccount'});db[_0x834f('0xef')][_0x834f('0x11b')](db[_0x834f('0x64')],{});db[_0x834f('0xef')][_0x834f('0x11b')](db['ChatInteraction'],{});db[_0x834f('0xef')]['belongsTo'](db[_0x834f('0x5e')],{'foreignKey':_0x834f('0x1dd'),'as':_0x834f('0x1d7')});db['ChatTransferReport'][_0x834f('0x11b')](db[_0x834f('0x10a')],{'foreignKey':_0x834f('0x1de'),'as':_0x834f('0x1d8')});db[_0x834f('0xef')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'foreignKey':'ToUserId','as':_0x834f('0x1da')});db[_0x834f('0xef')][_0x834f('0x11b')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x834f('0x1db')});db[_0x834f('0xef')][_0x834f('0x11b')](db[_0x834f('0x5e')],{'foreignKey':_0x834f('0x1df'),'as':'ToAccount'});db[_0x834f('0x1e0')][_0x834f('0x11b')](db['FaxMessage'],{});db[_0x834f('0x1e0')]['belongsTo'](db[_0x834f('0x48')],{});db[_0x834f('0x1e0')][_0x834f('0x11b')](db['FaxAccount'],{'foreignKey':_0x834f('0x1e1'),'as':'FromAccount'});db[_0x834f('0x1e0')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'foreignKey':_0x834f('0x1de'),'as':_0x834f('0x1d8')});db[_0x834f('0x1e0')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'foreignKey':_0x834f('0x1d9'),'as':_0x834f('0x1da')});db['FaxTransferReport'][_0x834f('0x11b')](db['FaxQueue'],{'foreignKey':_0x834f('0x1e2'),'as':_0x834f('0x1db')});db[_0x834f('0x1e0')][_0x834f('0x11b')](db[_0x834f('0x175')],{'foreignKey':_0x834f('0x1e3'),'as':_0x834f('0x1e4')});db[_0x834f('0xf2')][_0x834f('0x11b')](db['OpenchannelMessage'],{});db[_0x834f('0xf2')]['belongsTo'](db[_0x834f('0x59')],{});db['OpenchannelTransferReport'][_0x834f('0x11b')](db[_0x834f('0x139')],{'foreignKey':_0x834f('0x1e5'),'as':_0x834f('0x1d7')});db[_0x834f('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0x834f('0x1de'),'as':'FromAgent'});db[_0x834f('0xf2')][_0x834f('0x11b')](db['User'],{'foreignKey':_0x834f('0x1d9'),'as':_0x834f('0x1da')});db[_0x834f('0xf2')]['belongsTo'](db[_0x834f('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x834f('0xf2')]['belongsTo'](db[_0x834f('0x139')],{'foreignKey':_0x834f('0x1e6'),'as':'ToAccount'});db[_0x834f('0xf3')][_0x834f('0x11b')](db[_0x834f('0x53')],{});db[_0x834f('0xf3')][_0x834f('0x11b')](db['SmsInteraction'],{});db[_0x834f('0xf3')][_0x834f('0x11b')](db['SmsAccount'],{'foreignKey':_0x834f('0x1e7'),'as':_0x834f('0x1d7')});db[_0x834f('0xf3')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'foreignKey':_0x834f('0x1de'),'as':_0x834f('0x1d8')});db[_0x834f('0xf3')]['belongsTo'](db['User'],{'foreignKey':_0x834f('0x1d9'),'as':'ToAgent'});db['SmsTransferReport']['belongsTo'](db['SmsQueue'],{'foreignKey':_0x834f('0x1e8'),'as':_0x834f('0x1db')});db['SmsTransferReport'][_0x834f('0x11b')](db[_0x834f('0x13a')],{'foreignKey':_0x834f('0x1e9'),'as':_0x834f('0x1e4')});db[_0x834f('0xf5')]['hasMany'](db[_0x834f('0x7d')],{'as':_0x834f('0x160'),'foreignKey':'ListId'});db[_0x834f('0xf5')][_0x834f('0x10e')](db[_0x834f('0x76')],{'as':_0x834f('0x1ea'),'foreignKey':_0x834f('0x173')});db[_0x834f('0xf5')][_0x834f('0x10e')](db[_0x834f('0x6d')],{'as':'Contacts','onDelete':_0x834f('0x141'),'foreignKey':_0x834f('0x173')});db[_0x834f('0xf5')]['hasMany'](db[_0x834f('0x71')],{'as':_0x834f('0x147'),'foreignKey':_0x834f('0x173')});db[_0x834f('0xf5')]['hasMany'](db[_0x834f('0x73')],{'as':_0x834f('0x112'),'foreignKey':_0x834f('0x173')});db[_0x834f('0xf5')][_0x834f('0x10e')](db['ReportAgentPreview'],{'as':_0x834f('0x75'),'foreignKey':_0x834f('0x173')});db['CmList'][_0x834f('0x121')](db['VoiceQueue'],{'as':'Queues','through':_0x834f('0x1eb')});db[_0x834f('0xf5')][_0x834f('0x121')](db['User'],{'as':_0x834f('0x150'),'through':'cm_user_has_lists'});db[_0x834f('0xf6')][_0x834f('0x10e')](db[_0x834f('0x19')],{'as':'Extensions','onDelete':_0x834f('0x141')});db[_0x834f('0xf6')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':'user_has_voice_prefixes'});db[_0x834f('0xf8')][_0x834f('0x10e')](db[_0x834f('0x10a')],{'as':_0x834f('0x16b'),'foreignKey':_0x834f('0x11c')});db[_0x834f('0xf8')]['hasMany'](db[_0x834f('0xfa')],{'as':_0x834f('0x1ec'),'foreignKey':_0x834f('0x11c'),'onDelete':_0x834f('0x141')});db['UserProfileSection'][_0x834f('0x10e')](db[_0x834f('0xfc')],{'as':_0x834f('0x1ed'),'foreignKey':_0x834f('0x1ee'),'onDelete':_0x834f('0x141')});db[_0x834f('0x100')][_0x834f('0x10e')](db['Disposition'],{'as':_0x834f('0x160'),'foreignKey':_0x834f('0x1ef')});db[_0x834f('0x100')]['hasMany'](db[_0x834f('0x7b')],{'as':_0x834f('0x161'),'foreignKey':_0x834f('0x1ef')});db[_0x834f('0x100')][_0x834f('0x10e')](db['WhatsappMessage'],{'as':_0x834f('0x156'),'foreignKey':_0x834f('0x1ef')});db['WhatsappAccount'][_0x834f('0x10e')](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x834f('0x100')][_0x834f('0x10e')](db['WhatsappApplication'],{'as':'Applications'});db[_0x834f('0x100')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':_0x834f('0x173')});db[_0x834f('0x100')][_0x834f('0x11b')](db[_0x834f('0x83')],{'as':_0x834f('0x14d'),'foreignKey':_0x834f('0x14e')});db[_0x834f('0x100')]['belongsToMany'](db[_0x834f('0x10a')],{'as':'Agents','through':_0x834f('0x13d')});db[_0x834f('0x102')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'onDelete':_0x834f('0x170')});db[_0x834f('0x102')][_0x834f('0x11b')](db[_0x834f('0x107')],{'onDelete':'restrict'});db[_0x834f('0x102')][_0x834f('0x11b')](db['WhatsappAccount'],{'onDelete':_0x834f('0x170')});db['WhatsappApplication']['belongsTo'](db[_0x834f('0x81')],{'onDelete':_0x834f('0x170'),'foreignKey':_0x834f('0x14c')});db['WhatsappApplication']['belongsTo'](db[_0x834f('0x8b')],{'onDelete':_0x834f('0x170'),'foreignKey':_0x834f('0x171')});db[_0x834f('0x103')][_0x834f('0x10e')](db[_0x834f('0x104')],{'as':_0x834f('0x156'),'onDelete':'cascade','foreignKey':_0x834f('0x1f0')});db[_0x834f('0x103')][_0x834f('0x11b')](db[_0x834f('0x100')],{'as':'Account','foreignKey':_0x834f('0x1ef')});db['WhatsappInteraction'][_0x834f('0x11b')](db[_0x834f('0x6d')],{'as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x103')][_0x834f('0x11b')](db['User'],{'as':'Owner','foreignKey':_0x834f('0x10d')});db[_0x834f('0x103')][_0x834f('0x121')](db['Tag'],{'through':_0x834f('0x1a9'),'as':_0x834f('0x17a')});db[_0x834f('0x103')][_0x834f('0x121')](db['Tag'],{'through':_0x834f('0x1a9'),'as':_0x834f('0x16a')});db[_0x834f('0x103')][_0x834f('0x121')](db[_0x834f('0x10a')],{'as':_0x834f('0x16b'),'through':_0x834f('0x126'),'foreignKey':_0x834f('0x1f0')});db[_0x834f('0x104')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'as':_0x834f('0x10a')});db['WhatsappMessage'][_0x834f('0x11b')](db['CmContact'],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x167')});db[_0x834f('0x104')][_0x834f('0x11b')](db[_0x834f('0x103')],{'onDelete':_0x834f('0x141'),'as':_0x834f('0x16f'),'foreignKey':_0x834f('0x1f0')});db[_0x834f('0x104')][_0x834f('0x11b')](db['WhatsappAccount'],{'as':_0x834f('0x166'),'foreignKey':_0x834f('0x1ef')});db[_0x834f('0x1f1')][_0x834f('0x11b')](db['WhatsappAccount'],{});db[_0x834f('0x1f1')][_0x834f('0x11b')](db[_0x834f('0xf5')],{'as':_0x834f('0x164'),'foreignKey':'ListId'});db['WhatsappQueueReport']['belongsTo'](db[_0x834f('0x6d')],{'as':_0x834f('0x167'),'foreignKey':_0x834f('0x15c')});db[_0x834f('0x1f1')][_0x834f('0x11b')](db[_0x834f('0x103')],{});db[_0x834f('0x1f1')][_0x834f('0x11b')](db[_0x834f('0x107')],{});db[_0x834f('0x1f1')][_0x834f('0x11b')](db[_0x834f('0x104')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x834f('0x10a')],{});db[_0x834f('0x1f2')][_0x834f('0x11b')](db[_0x834f('0x104')],{});db[_0x834f('0x1f2')][_0x834f('0x11b')](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0x834f('0x11b')](db[_0x834f('0x100')],{'foreignKey':_0x834f('0x1f3'),'as':_0x834f('0x1d7')});db[_0x834f('0x1f2')][_0x834f('0x11b')](db[_0x834f('0x100')],{'foreignKey':'ToWhatsappAccountId','as':_0x834f('0x1e4')});db[_0x834f('0x1f2')][_0x834f('0x11b')](db['WhatsappQueue'],{'foreignKey':_0x834f('0x1f4'),'as':_0x834f('0x1db')});db[_0x834f('0x1f2')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'foreignKey':_0x834f('0x1de'),'as':_0x834f('0x1d8')});db[_0x834f('0x1f2')][_0x834f('0x11b')](db[_0x834f('0x10a')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x834f('0x107')]['belongsToMany'](db[_0x834f('0x10a')],{'as':_0x834f('0x150'),'through':_0x834f('0x35'),'foreignKey':_0x834f('0x1f5')});db[_0x834f('0x107')][_0x834f('0x121')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0x834f('0x151')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3561=['MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','Account','restrict','TagId','ListId','DashboardItem','Items','FaxAccountId','Exntensions','Messages','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccount','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','OpenchannelQueueReport','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatMessage','team_has_chat_queues','ChatGroupId','CompanyId','Hoppers','HopperFinals','CmCompany','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','AnalyticCustomReport','Mohs','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','CustomReportId','AnalyticDefaultReport','DefaultReportId','AnalyticMetric','AnalyticFieldReport','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','DeskField','ZohoConfiguration','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','ServicenowAccount','ServicenowField','FreshsalesAccount','FreshsalesField','FromId','ToId','SessionId','ProjectId','JscriptyQuestionReport','user_has_teams','team_has_sms_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromUserId','FromAgent','ToMailQueueId','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToUserId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','Answers','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','path','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','name','username','password','options','database','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticFieldReport/analyticFieldReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','UserId','hasMany','Recordings','User','cascade','CmHopperFinal','HopperHistory','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','MailQueues','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_square_projects','VoiceChanSpy','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','AgentReports','uniqueid','ContactId','MailAccountId','Imap','Dispositions','Interactions','List','TemplateId','Agents','team_has_mail_queues'];(function(_0xb37185,_0x3ec508){var _0x575b45=function(_0x2d9b5a){while(--_0x2d9b5a){_0xb37185['push'](_0xb37185['shift']());}};_0x575b45(++_0x3ec508);}(_0x3561,0x94));var _0x1356=function(_0x4ac840,_0x1e483a){_0x4ac840=_0x4ac840-0x0;var _0x1e46c7=_0x3561[_0x4ac840];return _0x1e46c7;};'use strict';var path=require(_0x1356('0x0'));var config=require('../config/environment');var Sequelize=require(_0x1356('0x1'));var _=require(_0x1356('0x2'));var jstz=require(_0x1356('0x3'));var timezone=jstz[_0x1356('0x4')]();config[_0x1356('0x1')]=_[_0x1356('0x5')](config[_0x1356('0x1')],{'database':_0x1356('0x6'),'username':_0x1356('0x7'),'password':_0x1356('0x8'),'options':{'host':_0x1356('0x9'),'port':0xcea,'dialect':_0x1356('0xa'),'dialectOptions':{'charset':_0x1356('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x1356('0xc'),'collate':_0x1356('0xd')}}});config[_0x1356('0xe')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x1356('0x6'),'username':_0x1356('0x7'),'password':'xC@LL1234','options':{'host':_0x1356('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x1356('0xb')},'logging':![],'timezone':timezone[_0x1356('0xf')](),'define':{'charset':'utf8','collate':_0x1356('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1356('0x1')]['database'],config[_0x1356('0x1')][_0x1356('0x10')],config[_0x1356('0x1')][_0x1356('0x11')],config[_0x1356('0x1')][_0x1356('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1356('0xe')][_0x1356('0x13')],config[_0x1356('0xe')][_0x1356('0x10')],config[_0x1356('0xe')][_0x1356('0x11')],config[_0x1356('0xe')]['options'])};db['User']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x15'));db['VoiceChanSpy']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x16'));db[_0x1356('0x17')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x18'));db[_0x1356('0x19')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x1a'));db[_0x1356('0x1b')]=db[_0x1356('0x1')]['import'](_0x1356('0x1c'));db['VoiceQueue']=db[_0x1356('0x1')]['import'](_0x1356('0x1d'));db[_0x1356('0x1e')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x1f'));db[_0x1356('0x20')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x21'));db['VoiceMail']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x22'));db['VoiceMailMessage']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x23'));db[_0x1356('0x24')]=db['sequelize']['import'](_0x1356('0x25'));db['VoiceDialReport']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x26'));db[_0x1356('0x27')]=db[_0x1356('0x1')]['import'](_0x1356('0x28'));db[_0x1356('0x29')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x2a'));db[_0x1356('0x2b')]=db['sequelize'][_0x1356('0x14')]('../api/memberReport/memberReport.model');db[_0x1356('0x2c')]=db['sequelize']['import'](_0x1356('0x2d'));db[_0x1356('0x2e')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x2f'));db[_0x1356('0x30')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x31'));db[_0x1356('0x32')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x33'));db[_0x1356('0x34')]=db[_0x1356('0x1')]['import'](_0x1356('0x35'));db[_0x1356('0x36')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x37'));db['UserFaxQueue']=db[_0x1356('0x1')]['import'](_0x1356('0x38'));db[_0x1356('0x39')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x3a'));db[_0x1356('0x3b')]=db[_0x1356('0x1')]['import'](_0x1356('0x3c'));db[_0x1356('0x3d')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x1356('0x3e')]=db['sequelize'][_0x1356('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x1356('0x3f')]=db[_0x1356('0x1')]['import'](_0x1356('0x40'));db['MailAccount']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x41'));db[_0x1356('0x42')]=db['sequelize'][_0x1356('0x14')]('../api/mailQueue/mailQueue.model');db[_0x1356('0x43')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x44'));db[_0x1356('0x45')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x46'));db[_0x1356('0x47')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x48'));db[_0x1356('0x49')]=db[_0x1356('0x1')]['import'](_0x1356('0x4a'));db[_0x1356('0x4b')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x4c'));db[_0x1356('0x4d')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x1356('0x1')][_0x1356('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0x1356('0x4e')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x4f'));db[_0x1356('0x50')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x51'));db['FaxInteraction']=db[_0x1356('0x1')]['import'](_0x1356('0x52'));db[_0x1356('0x53')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x54'));db['FaxQueue']=db['sequelize'][_0x1356('0x14')](_0x1356('0x55'));db[_0x1356('0x56')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x57'));db['SmsAccount']=db[_0x1356('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x1356('0x58')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x59'));db['SmsInteraction']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x5a'));db[_0x1356('0x5b')]=db['sequelize']['import'](_0x1356('0x5c'));db[_0x1356('0x5d')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x5e'));db[_0x1356('0x5f')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x60'));db['OpenchannelApplication']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x61'));db[_0x1356('0x62')]=db['sequelize']['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x1356('0x63')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x64'));db[_0x1356('0x65')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x66'));db[_0x1356('0x67')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x68'));db['OpenchannelQueueReport']=db['sequelize'][_0x1356('0x14')](_0x1356('0x69'));db[_0x1356('0x6a')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x6b'));db[_0x1356('0x6c')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x6d'));db['ChatMessage']=db['sequelize'][_0x1356('0x14')](_0x1356('0x6e'));db[_0x1356('0x6f')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x70'));db[_0x1356('0x71')]=db['sequelize']['import'](_0x1356('0x72'));db[_0x1356('0x73')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/chatGroup/chatGroup.model');db[_0x1356('0x74')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x75'));db['CmCompany']=db[_0x1356('0x1')]['import'](_0x1356('0x76'));db[_0x1356('0x77')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x78'));db[_0x1356('0x79')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x7a'));db['CmHopperBlack']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x7b'));db['CmHopperFinal']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x7c'));db[_0x1356('0x7d')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x7e'));db[_0x1356('0x7f')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x80'));db[_0x1356('0x81')]=db[_0x1356('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0x1356('0x82')]=db['sequelize'][_0x1356('0x14')]('../api/action/action.model');db[_0x1356('0x83')]=db[_0x1356('0x1')]['import'](_0x1356('0x84'));db[_0x1356('0x85')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x86'));db[_0x1356('0x87')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/disposition/disposition.model');db[_0x1356('0x88')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x89'));db[_0x1356('0x8a')]=db[_0x1356('0x1')]['import'](_0x1356('0x8b'));db[_0x1356('0x8c')]=db['sequelize'][_0x1356('0x14')](_0x1356('0x8d'));db['Cdr']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x8e'));db['VoiceQueuesLog']=db['sequelize'][_0x1356('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x1356('0x8f')]=db['sequelize']['import'](_0x1356('0x90'));db[_0x1356('0x91')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x92'));db[_0x1356('0x93')]=db[_0x1356('0x1')]['import'](_0x1356('0x94'));db[_0x1356('0x95')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x96'));db[_0x1356('0x97')]=db[_0x1356('0x1')]['import'](_0x1356('0x98'));db[_0x1356('0x99')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x9a'));db[_0x1356('0x9b')]=db['sequelize']['import'](_0x1356('0x9c'));db[_0x1356('0x9d')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x9e'));db['AnalyticCustomReport']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x9f'));db['AnalyticDefaultReport']=db['sequelize'][_0x1356('0x14')](_0x1356('0xa0'));db[_0x1356('0xa1')]=db['sequelize'][_0x1356('0x14')](_0x1356('0xa2'));db['AnalyticMetric']=db[_0x1356('0x1')][_0x1356('0x14')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xa3'));db['AnalyticTreeReport']=db['sequelize'][_0x1356('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db['sequelize'][_0x1356('0x14')](_0x1356('0xa4'));db[_0x1356('0xa5')]=db['sequelize'][_0x1356('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x1356('0xa6')]=db['sequelize'][_0x1356('0x14')](_0x1356('0xa7'));db[_0x1356('0xa8')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x1356('0xa9')]=db[_0x1356('0x1')]['import'](_0x1356('0xaa'));db[_0x1356('0xab')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xac'));db[_0x1356('0xad')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xae'));db[_0x1356('0xaf')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xb0'));db['DeskField']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xb1'));db[_0x1356('0xb2')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xb3'));db['ZohoConfiguration']=db[_0x1356('0x1')][_0x1356('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x1356('0xb4')]=db[_0x1356('0x1')]['import']('../api/intZohoField/intZohoField.model');db[_0x1356('0xb5')]=db[_0x1356('0x1')]['import'](_0x1356('0xb6'));db['ZendeskConfiguration']=db[_0x1356('0x1')]['import'](_0x1356('0xb7'));db[_0x1356('0xb8')]=db[_0x1356('0x1')]['import'](_0x1356('0xb9'));db[_0x1356('0xba')]=db['sequelize'][_0x1356('0x14')](_0x1356('0xbb'));db['FreshdeskConfiguration']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xbc'));db[_0x1356('0xbd')]=db[_0x1356('0x1')]['import'](_0x1356('0xbe'));db[_0x1356('0xbf')]=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x1356('0xc0')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xc1'));db[_0x1356('0xc2')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xc3'));db['ServicenowAccount']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xc4'));db[_0x1356('0xc5')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xc6'));db['ServicenowField']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xc7'));db[_0x1356('0xc8')]=db[_0x1356('0x1')]['import'](_0x1356('0xc9'));db[_0x1356('0xca')]=db['sequelize'][_0x1356('0x14')](_0x1356('0xcb'));db[_0x1356('0xcc')]=db[_0x1356('0x1')]['import'](_0x1356('0xcd'));db['FreshsalesAccount']=db[_0x1356('0x1')]['import'](_0x1356('0xce'));db[_0x1356('0xcf')]=db['sequelize']['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db['sequelize'][_0x1356('0x14')](_0x1356('0xd0'));db[_0x1356('0x9b')]=db['sequelize']['import'](_0x1356('0x9c'));db[_0x1356('0xd1')]=db['sequelize'][_0x1356('0x14')](_0x1356('0xd2'));db[_0x1356('0xd3')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xd4'));db[_0x1356('0xd5')]=db['sequelize'][_0x1356('0x14')](_0x1356('0xd6'));db[_0x1356('0xd7')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xd8'));db['JscriptyQuestionReport']=db[_0x1356('0x1')]['import'](_0x1356('0xd9'));db[_0x1356('0xda')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xdb'));db[_0x1356('0xdc')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xdd'));db[_0x1356('0xde')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xdf'));db['SquareDetailsReport']=db['sequelize'][_0x1356('0x14')](_0x1356('0xe0'));db[_0x1356('0xe1')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x1356('0xe2')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/setting/setting.model');db[_0x1356('0xe3')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xe4'));db[_0x1356('0xe5')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xe6'));db[_0x1356('0xe7')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xe8'));db[_0x1356('0xe9')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/squareMessage/squareMessage.model');db[_0x1356('0xea')]=db['sequelize'][_0x1356('0x14')]('../api/team/team.model');db[_0x1356('0xeb')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xec'));db[_0x1356('0xed')]=db[_0x1356('0x1')]['import'](_0x1356('0xee'));db[_0x1356('0xef')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/migration/migration.model');db[_0x1356('0xf0')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/attachment/attachment.model');db[_0x1356('0xf1')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xf2'));db[_0x1356('0xf3')]=db[_0x1356('0x1')]['import'](_0x1356('0xf4'));db[_0x1356('0xf5')]=db['sequelize'][_0x1356('0x14')](_0x1356('0xf6'));db['FaxTransferReport']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xf7'));db[_0x1356('0xf8')]=db[_0x1356('0x1')]['import'](_0x1356('0xf9'));db['SmsTransferReport']=db[_0x1356('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x1356('0x1')]['import'](_0x1356('0xfa'));db[_0x1356('0xfb')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0x1356('0xfc')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xfd'));db['UserProfileSection']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0xfe'));db[_0x1356('0xff')]=db[_0x1356('0x1')][_0x1356('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x1356('0x100')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x101'));db[_0x1356('0x102')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x103'));db['WhatsappApplication']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x104'));db['WhatsappInteraction']=db['sequelize'][_0x1356('0x14')](_0x1356('0x105'));db[_0x1356('0x106')]=db['sequelize'][_0x1356('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x1356('0x107')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x108'));db[_0x1356('0x109')]=db['sequelize'][_0x1356('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x1356('0x10a')]=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x10b'));db['CloudProvider']=db[_0x1356('0x1')][_0x1356('0x14')](_0x1356('0x10c'));db['User'][_0x1356('0x10d')](db[_0x1356('0x10e')],{'as':_0x1356('0x10e'),'onDelete':'cascade','foreignKey':_0x1356('0x10f')});db['User'][_0x1356('0x110')](db[_0x1356('0x1e')],{'as':_0x1356('0x111'),'foreignKey':_0x1356('0x10f')});db['User'][_0x1356('0x110')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x1356('0x112')][_0x1356('0x110')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x1356('0x113'),'hooks':!![]});db[_0x1356('0x112')][_0x1356('0x110')](db[_0x1356('0x114')],{'as':'HopperFinals','foreignKey':_0x1356('0x10f')});db[_0x1356('0x112')]['hasMany'](db[_0x1356('0x7d')],{'as':_0x1356('0x115'),'foreignKey':_0x1356('0x10f')});db[_0x1356('0x112')]['hasMany'](db[_0x1356('0x7f')],{'as':_0x1356('0x7f'),'foreignKey':_0x1356('0x10f')});db[_0x1356('0x112')][_0x1356('0x110')](db[_0x1356('0x62')],{'as':'OpenchannelInteractions','foreignKey':_0x1356('0x10f')});db[_0x1356('0x112')][_0x1356('0x110')](db[_0x1356('0x6c')],{'as':_0x1356('0x116'),'foreignKey':'UserId'});db[_0x1356('0x112')]['hasMany'](db['SmsInteraction'],{'as':_0x1356('0x117'),'foreignKey':'UserId'});db[_0x1356('0x112')][_0x1356('0x110')](db[_0x1356('0x118')],{'as':_0x1356('0x119'),'foreignKey':_0x1356('0x10f')});db['User'][_0x1356('0x110')](db[_0x1356('0x45')],{'as':_0x1356('0x11a'),'foreignKey':_0x1356('0x10f')});db[_0x1356('0x112')][_0x1356('0x110')](db[_0x1356('0x11b')],{'as':_0x1356('0x11c'),'foreignKey':_0x1356('0x10f')});db['User'][_0x1356('0x110')](db[_0x1356('0x100')],{'as':_0x1356('0x11d'),'foreignKey':_0x1356('0x11e')});db[_0x1356('0x112')][_0x1356('0x11f')](db[_0x1356('0xfc')],{'as':_0x1356('0xfc'),'foreignKey':_0x1356('0x120')});db[_0x1356('0x112')][_0x1356('0x121')](db['ChatGroup'],{'as':_0x1356('0x122'),'through':_0x1356('0x123')});db[_0x1356('0x112')]['belongsToMany'](db['CmContact'],{'as':_0x1356('0x124'),'through':_0x1356('0x125')});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x126')],{'as':_0x1356('0x127'),'through':_0x1356('0x128')});db['User'][_0x1356('0x121')](db[_0x1356('0xea')],{'through':'user_has_teams'});db[_0x1356('0x112')][_0x1356('0x121')](db['MailInteraction'],{'as':_0x1356('0x11a'),'through':'user_has_mail_interactions'});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x6c')],{'as':_0x1356('0x116'),'through':_0x1356('0x129')});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x118')],{'as':'FaxInteractions','through':_0x1356('0x12a')});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x12b')],{'as':_0x1356('0x117'),'through':'user_has_sms_interactions'});db['User'][_0x1356('0x121')](db[_0x1356('0x62')],{'as':_0x1356('0x12c'),'through':_0x1356('0x12d')});db['User'][_0x1356('0x121')](db[_0x1356('0x11b')],{'as':_0x1356('0x11c'),'through':'user_has_whatsapp_interactions'});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x12e')],{'as':_0x1356('0x12f'),'through':_0x1356('0x32'),'required':![]});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x42')],{'as':_0x1356('0x130'),'through':'UserMailQueue','required':![]});db[_0x1356('0x112')]['belongsToMany'](db[_0x1356('0x71')],{'as':_0x1356('0x131'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x1356('0x112')]['belongsToMany'](db[_0x1356('0x132')],{'as':_0x1356('0x133'),'through':_0x1356('0x134'),'required':![]});db[_0x1356('0x112')][_0x1356('0x121')](db['SmsQueue'],{'as':_0x1356('0x135'),'through':_0x1356('0x39'),'required':![]});db['User'][_0x1356('0x121')](db[_0x1356('0x65')],{'as':_0x1356('0x136'),'through':'UserOpenchannelQueue','required':![]});db[_0x1356('0x112')]['belongsToMany'](db[_0x1356('0x10a')],{'as':_0x1356('0x137'),'through':_0x1356('0x3d'),'required':![]});db[_0x1356('0x112')]['belongsToMany'](db[_0x1356('0x126')],{'through':'cm_user_has_lists'});db[_0x1356('0x112')]['belongsToMany'](db[_0x1356('0xfb')],{'as':'VoicePrefixes','through':_0x1356('0x138'),'required':![]});db[_0x1356('0x112')]['belongsToMany'](db['ChatWebsite'],{'as':_0x1356('0x139'),'through':_0x1356('0x13a')});db['User'][_0x1356('0x121')](db['FaxAccount'],{'as':_0x1356('0x13b'),'through':_0x1356('0x13c')});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x13d')],{'as':_0x1356('0x13e'),'through':'user_has_mail_accounts'});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x5f')],{'as':_0x1356('0x13f'),'through':_0x1356('0x140')});db[_0x1356('0x112')]['belongsToMany'](db['SmsAccount'],{'as':_0x1356('0x141'),'through':'user_has_sms_accounts'});db[_0x1356('0x112')][_0x1356('0x121')](db[_0x1356('0x102')],{'as':_0x1356('0x142'),'through':'user_has_whatsapp_accounts'});db[_0x1356('0x112')]['belongsToMany'](db[_0x1356('0xe5')],{'as':'SquareProjects','through':_0x1356('0x143')});db[_0x1356('0x144')]['hasMany'](db[_0x1356('0x19')],{'as':'SpiedAgents','onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x145')});db[_0x1356('0x17')][_0x1356('0x110')](db['VoiceExtension'],{'onDelete':_0x1356('0x113')});db[_0x1356('0x19')][_0x1356('0x110')](db[_0x1356('0x19')],{'as':_0x1356('0x146'),'onDelete':'cascade'});db[_0x1356('0x1b')][_0x1356('0x121')](db[_0x1356('0x91')],{'as':_0x1356('0x147'),'through':_0x1356('0x148')});db[_0x1356('0x12e')][_0x1356('0x110')](db[_0x1356('0x30')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x1356('0x12e')][_0x1356('0x110')](db[_0x1356('0x79')],{'as':'Hoppers','foreignKey':_0x1356('0x149')});db['VoiceQueue'][_0x1356('0x110')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x1356('0x149')});db[_0x1356('0x12e')][_0x1356('0x110')](db[_0x1356('0x7d')],{'as':_0x1356('0x14a'),'foreignKey':_0x1356('0x149')});db['VoiceQueue'][_0x1356('0x110')](db['ReportAgentPreview'],{'as':_0x1356('0x7f'),'foreignKey':'VoiceQueueId'});db[_0x1356('0x12e')][_0x1356('0x110')](db[_0x1356('0x14b')],{'as':_0x1356('0x14c'),'foreignKey':_0x1356('0x149')});db[_0x1356('0x12e')][_0x1356('0x110')](db[_0x1356('0xda')],{'as':_0x1356('0x14d'),'foreignKey':_0x1356('0x149')});db[_0x1356('0x12e')][_0x1356('0x11f')](db[_0x1356('0x2c')],{'as':_0x1356('0x2c'),'foreignKey':_0x1356('0x14e')});db['VoiceQueue'][_0x1356('0x11f')](db[_0x1356('0x2c')],{'as':_0x1356('0x14f'),'foreignKey':_0x1356('0x150')});db[_0x1356('0x12e')][_0x1356('0x11f')](db[_0x1356('0x8a')],{'as':_0x1356('0x8a'),'foreignKey':_0x1356('0x151')});db['VoiceQueue']['belongsTo'](db[_0x1356('0x8c')],{'as':_0x1356('0x152'),'foreignKey':_0x1356('0x153')});db[_0x1356('0x12e')]['belongsToMany'](db[_0x1356('0x126')],{'as':_0x1356('0x127'),'through':_0x1356('0x154')});db['VoiceQueue'][_0x1356('0x121')](db[_0x1356('0x112')],{'as':'Agents','through':_0x1356('0x32')});db[_0x1356('0x12e')][_0x1356('0x121')](db['Team'],{'as':_0x1356('0x155'),'through':_0x1356('0x156')});db['VoiceQueue'][_0x1356('0x121')](db[_0x1356('0x126')],{'as':_0x1356('0x157'),'through':_0x1356('0x158')});db['VoiceRecording'][_0x1356('0x11f')](db[_0x1356('0x112')],{'as':'User','foreignKey':_0x1356('0x10f')});db['ScreenRecording'][_0x1356('0x11f')](db['User'],{'as':_0x1356('0x112'),'foreignKey':'UserId'});db[_0x1356('0x10e')][_0x1356('0x110')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x159'),'sourceKey':_0x1356('0x15a')});db['VoiceMailMessage'][_0x1356('0x11f')](db[_0x1356('0x10e')],{'foreignKey':'mailboxuser','targetKey':_0x1356('0x15a')});db['VoiceCallReport'][_0x1356('0x110')](db[_0x1356('0x29')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x1356('0x110')](db[_0x1356('0x27')],{'as':_0x1356('0x15b'),'foreignKey':_0x1356('0x15c'),'constraints':![]});db[_0x1356('0x24')][_0x1356('0x11f')](db[_0x1356('0x112')],{'as':'User','foreignKey':_0x1356('0x10f')});db[_0x1356('0x24')][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':'Contact','foreignKey':_0x1356('0x15d')});db[_0x1356('0x3e')][_0x1356('0x11f')](db[_0x1356('0x13d')],{'as':'MailAccount','foreignKey':_0x1356('0x15e')});db[_0x1356('0x3f')][_0x1356('0x11f')](db[_0x1356('0x13d')],{'as':_0x1356('0x13d'),'foreignKey':'MailAccountId'});db[_0x1356('0x13d')][_0x1356('0x10d')](db[_0x1356('0x3e')],{'as':_0x1356('0x15f'),'onDelete':_0x1356('0x113')});db[_0x1356('0x13d')]['hasOne'](db[_0x1356('0x3f')],{'as':'Smtp','onDelete':_0x1356('0x113')});db['MailAccount'][_0x1356('0x110')](db[_0x1356('0x87')],{'as':_0x1356('0x160'),'foreignKey':_0x1356('0x15e')});db['MailAccount'][_0x1356('0x110')](db[_0x1356('0x85')],{'as':'Answers','foreignKey':_0x1356('0x15e')});db['MailAccount'][_0x1356('0x110')](db[_0x1356('0x47')],{'as':'Messages','foreignKey':_0x1356('0x15e')});db['MailAccount'][_0x1356('0x110')](db['MailInteraction'],{'as':_0x1356('0x161')});db['MailAccount'][_0x1356('0x110')](db[_0x1356('0x49')],{'as':_0x1356('0x146')});db[_0x1356('0x13d')][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':'ListId'});db['MailAccount']['belongsTo'](db[_0x1356('0x95')],{'as':'Template','foreignKey':_0x1356('0x163')});db['MailAccount']['belongsTo'](db[_0x1356('0x8c')],{'as':_0x1356('0x152'),'foreignKey':_0x1356('0x153')});db[_0x1356('0x13d')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':_0x1356('0x36')});db[_0x1356('0x42')][_0x1356('0x121')](db[_0x1356('0xea')],{'through':_0x1356('0x165'),'as':_0x1356('0x155')});db[_0x1356('0x45')][_0x1356('0x110')](db['MailMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x1356('0x166')});db['MailInteraction'][_0x1356('0x11f')](db[_0x1356('0x13d')],{'as':'Account','foreignKey':_0x1356('0x15e')});db[_0x1356('0x45')][_0x1356('0x11f')](db['CmContact'],{'as':_0x1356('0x167'),'foreignKey':'ContactId'});db['MailInteraction'][_0x1356('0x11f')](db[_0x1356('0x112')],{'as':_0x1356('0x168'),'foreignKey':_0x1356('0x10f')});db[_0x1356('0x45')]['belongsToMany'](db[_0x1356('0x93')],{'through':_0x1356('0x169'),'as':_0x1356('0x16a')});db['MailInteraction'][_0x1356('0x121')](db[_0x1356('0x93')],{'through':_0x1356('0x169'),'as':_0x1356('0x16b')});db['MailInteraction'][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x16c'),'through':_0x1356('0x16d'),'foreignKey':_0x1356('0x166')});db['MailMessage'][_0x1356('0x110')](db['Attachment'],{'as':_0x1356('0x16e'),'onDelete':'cascade'});db[_0x1356('0x47')][_0x1356('0x11f')](db['User'],{'as':_0x1356('0x112')});db[_0x1356('0x47')][_0x1356('0x11f')](db['CmContact'],{'onDelete':_0x1356('0x113'),'as':_0x1356('0x167')});db['MailMessage'][_0x1356('0x11f')](db[_0x1356('0x45')],{'as':_0x1356('0x16f'),'foreignKey':_0x1356('0x166')});db[_0x1356('0x47')][_0x1356('0x11f')](db['MailAccount'],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x15e')});db[_0x1356('0x49')][_0x1356('0x11f')](db[_0x1356('0x112')],{'onDelete':'restrict'});db['MailApplication'][_0x1356('0x11f')](db[_0x1356('0x42')],{'onDelete':_0x1356('0x171')});db[_0x1356('0x49')][_0x1356('0x11f')](db[_0x1356('0x13d')],{'onDelete':_0x1356('0x171')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':_0x1356('0x171'),'foreignKey':_0x1356('0x151')});db[_0x1356('0x49')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x1356('0x172')});db[_0x1356('0x4b')][_0x1356('0x11f')](db[_0x1356('0x13d')],{});db['MailQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x1356('0x173')});db[_0x1356('0x4b')][_0x1356('0x11f')](db['CmContact'],{'as':_0x1356('0x167'),'foreignKey':'ContactId'});db['MailQueueReport'][_0x1356('0x11f')](db[_0x1356('0x45')],{});db[_0x1356('0x4b')][_0x1356('0x11f')](db[_0x1356('0x47')],{});db[_0x1356('0x4b')][_0x1356('0x11f')](db['User'],{});db['MailQueueReport'][_0x1356('0x11f')](db[_0x1356('0x42')],{});db[_0x1356('0x4d')][_0x1356('0x110')](db[_0x1356('0x174')],{'as':_0x1356('0x175'),'onDelete':'cascade'});db[_0x1356('0x4e')][_0x1356('0x110')](db[_0x1356('0x87')],{'as':'Dispositions','foreignKey':_0x1356('0x176')});db[_0x1356('0x4e')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x1356('0x176')});db[_0x1356('0x4e')][_0x1356('0x110')](db[_0x1356('0x118')],{'as':_0x1356('0x161')});db[_0x1356('0x4e')][_0x1356('0x110')](db[_0x1356('0x50')],{'as':_0x1356('0x146')});db[_0x1356('0x4e')]['hasMany'](db[_0x1356('0x19')],{'as':_0x1356('0x177'),'onDelete':_0x1356('0x113')});db[_0x1356('0x4e')]['hasMany'](db['FaxMessage'],{'as':'Messages'});db[_0x1356('0x4e')][_0x1356('0x11f')](db[_0x1356('0x2c')],{'as':_0x1356('0x2c')});db[_0x1356('0x4e')][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173')});db[_0x1356('0x4e')][_0x1356('0x11f')](db[_0x1356('0x8c')],{'as':_0x1356('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x1356('0x121')](db['User'],{'as':_0x1356('0x164'),'through':_0x1356('0x13c')});db['FaxApplication'][_0x1356('0x11f')](db[_0x1356('0x112')],{'onDelete':_0x1356('0x171')});db[_0x1356('0x50')][_0x1356('0x11f')](db[_0x1356('0x132')],{'onDelete':_0x1356('0x171')});db[_0x1356('0x50')][_0x1356('0x11f')](db[_0x1356('0x4e')],{'onDelete':'restrict'});db[_0x1356('0x50')]['belongsTo'](db[_0x1356('0x93')],{'onDelete':_0x1356('0x171'),'foreignKey':_0x1356('0x172')});db['FaxInteraction'][_0x1356('0x110')](db[_0x1356('0x53')],{'as':_0x1356('0x178'),'onDelete':'cascade','foreignKey':_0x1356('0x179')});db[_0x1356('0x118')][_0x1356('0x11f')](db[_0x1356('0x4e')],{'as':_0x1356('0x170'),'foreignKey':'FaxAccountId'});db[_0x1356('0x118')][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':'Contact','foreignKey':'ContactId'});db[_0x1356('0x118')][_0x1356('0x11f')](db['User'],{'as':_0x1356('0x168'),'foreignKey':'UserId'});db['FaxInteraction'][_0x1356('0x121')](db[_0x1356('0x93')],{'through':'fax_interaction_has_tags','as':_0x1356('0x16a')});db[_0x1356('0x118')][_0x1356('0x121')](db['Tag'],{'through':_0x1356('0x17a'),'as':_0x1356('0x16b')});db['FaxInteraction'][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x16c'),'through':_0x1356('0x12a'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db['User'],{'onDelete':_0x1356('0x113'),'as':_0x1356('0x112')});db['FaxMessage'][_0x1356('0x11f')](db[_0x1356('0x118')],{'as':_0x1356('0x16f'),'foreignKey':_0x1356('0x179')});db[_0x1356('0x53')][_0x1356('0x11f')](db[_0x1356('0x77')],{'onDelete':_0x1356('0x113'),'as':'Contact'});db['FaxMessage'][_0x1356('0x11f')](db['Attachment'],{'as':_0x1356('0xf0'),'foreignKey':_0x1356('0x17b')});db[_0x1356('0x53')][_0x1356('0x11f')](db[_0x1356('0x4e')],{'as':'Account','foreignKey':_0x1356('0x176')});db[_0x1356('0x132')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':_0x1356('0x134')});db[_0x1356('0x132')][_0x1356('0x121')](db[_0x1356('0xea')],{'through':_0x1356('0x17c'),'as':_0x1356('0x155')});db[_0x1356('0x56')][_0x1356('0x11f')](db[_0x1356('0x4e')],{});db[_0x1356('0x56')]['belongsTo'](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':'ListId'});db[_0x1356('0x56')][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':_0x1356('0x15d')});db[_0x1356('0x56')][_0x1356('0x11f')](db['FaxInteraction'],{});db['FaxQueueReport']['belongsTo'](db[_0x1356('0x53')],{});db['FaxQueueReport'][_0x1356('0x11f')](db[_0x1356('0x112')],{});db[_0x1356('0x56')]['belongsTo'](db[_0x1356('0x132')],{});db[_0x1356('0x17d')][_0x1356('0x110')](db[_0x1356('0x87')],{'as':_0x1356('0x160'),'foreignKey':_0x1356('0x17e')});db[_0x1356('0x17d')][_0x1356('0x110')](db[_0x1356('0x85')],{'as':'Answers','foreignKey':_0x1356('0x17e')});db['SmsAccount'][_0x1356('0x110')](db[_0x1356('0x5b')],{'as':_0x1356('0x178'),'foreignKey':_0x1356('0x17e')});db[_0x1356('0x17d')][_0x1356('0x110')](db[_0x1356('0x12b')],{'as':_0x1356('0x161')});db[_0x1356('0x17d')][_0x1356('0x110')](db[_0x1356('0x58')],{'as':_0x1356('0x146')});db['SmsAccount'][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173')});db['SmsAccount'][_0x1356('0x11f')](db[_0x1356('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x1356('0x153')});db[_0x1356('0x17d')][_0x1356('0x121')](db['User'],{'as':_0x1356('0x164'),'through':'user_has_sms_accounts'});db[_0x1356('0x58')][_0x1356('0x11f')](db[_0x1356('0x112')],{'onDelete':_0x1356('0x171')});db[_0x1356('0x58')][_0x1356('0x11f')](db[_0x1356('0x5d')],{'onDelete':_0x1356('0x171')});db[_0x1356('0x58')][_0x1356('0x11f')](db[_0x1356('0x17d')],{'onDelete':'restrict'});db[_0x1356('0x58')]['belongsTo'](db['Interval'],{'onDelete':_0x1356('0x171'),'foreignKey':_0x1356('0x151')});db[_0x1356('0x58')][_0x1356('0x11f')](db['Tag'],{'onDelete':_0x1356('0x171'),'foreignKey':_0x1356('0x172')});db[_0x1356('0x12b')][_0x1356('0x110')](db[_0x1356('0x5b')],{'as':'Messages','onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x17f')});db[_0x1356('0x12b')][_0x1356('0x11f')](db[_0x1356('0x17d')],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x17e')});db['SmsInteraction'][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':_0x1356('0x15d')});db[_0x1356('0x12b')][_0x1356('0x11f')](db[_0x1356('0x112')],{'as':_0x1356('0x168'),'foreignKey':_0x1356('0x10f')});db[_0x1356('0x12b')][_0x1356('0x121')](db['Tag'],{'through':_0x1356('0x180'),'as':_0x1356('0x16a')});db[_0x1356('0x12b')][_0x1356('0x121')](db[_0x1356('0x93')],{'through':_0x1356('0x180'),'as':'ThroughTags'});db[_0x1356('0x12b')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x16c'),'through':_0x1356('0x181'),'foreignKey':_0x1356('0x17f')});db[_0x1356('0x5b')][_0x1356('0x11f')](db['User'],{'as':'User'});db[_0x1356('0x5b')][_0x1356('0x11f')](db[_0x1356('0x77')],{'onDelete':'cascade','as':_0x1356('0x167')});db[_0x1356('0x5b')][_0x1356('0x11f')](db[_0x1356('0x12b')],{'onDelete':'cascade','as':_0x1356('0x16f'),'foreignKey':_0x1356('0x17f')});db['SmsMessage'][_0x1356('0x11f')](db['SmsAccount'],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x17e')});db[_0x1356('0x5d')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x1356('0x39'),'foreignKey':_0x1356('0x182')});db[_0x1356('0x5d')][_0x1356('0x121')](db['Team'],{'through':'team_has_sms_queues','as':_0x1356('0x155')});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':_0x1356('0x160'),'foreignKey':_0x1356('0x183')});db[_0x1356('0x5f')]['hasMany'](db[_0x1356('0x85')],{'as':'Answers','foreignKey':_0x1356('0x183')});db[_0x1356('0x5f')]['hasMany'](db[_0x1356('0x62')],{'as':_0x1356('0x161'),'foreignKey':_0x1356('0x183')});db[_0x1356('0x5f')][_0x1356('0x110')](db[_0x1356('0x63')],{'as':_0x1356('0x178'),'foreignKey':_0x1356('0x183')});db[_0x1356('0x5f')]['hasMany'](db['OpenchannelApplication'],{'as':_0x1356('0x146'),'foreignKey':_0x1356('0x183')});db[_0x1356('0x5f')][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173')});db[_0x1356('0x5f')][_0x1356('0x11f')](db[_0x1356('0x8c')],{'as':_0x1356('0x152'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1356('0x5f')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':'Agents','through':_0x1356('0x140')});db[_0x1356('0x184')][_0x1356('0x11f')](db['User'],{'onDelete':_0x1356('0x171')});db['OpenchannelApplication']['belongsTo'](db[_0x1356('0x65')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x1356('0x184')][_0x1356('0x11f')](db['OpenchannelAccount'],{'onDelete':_0x1356('0x171'),'foreignKey':_0x1356('0x183')});db[_0x1356('0x184')][_0x1356('0x11f')](db[_0x1356('0x8a')],{'onDelete':'restrict','foreignKey':_0x1356('0x151')});db[_0x1356('0x184')][_0x1356('0x11f')](db[_0x1356('0x93')],{'onDelete':'restrict','foreignKey':_0x1356('0x172')});db[_0x1356('0x62')][_0x1356('0x110')](db[_0x1356('0x63')],{'as':_0x1356('0x178'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x185')});db[_0x1356('0x62')][_0x1356('0x11f')](db['OpenchannelAccount'],{'as':_0x1356('0x170'),'foreignKey':'OpenchannelAccountId'});db[_0x1356('0x62')][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x1356('0x11f')](db[_0x1356('0x112')],{'as':_0x1356('0x168'),'foreignKey':_0x1356('0x10f')});db[_0x1356('0x62')][_0x1356('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x1356('0x16a')});db['OpenchannelInteraction'][_0x1356('0x121')](db[_0x1356('0x93')],{'through':'openchannel_interaction_has_tags','as':_0x1356('0x16b')});db[_0x1356('0x62')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x16c'),'through':'user_has_openchannel_interactions','foreignKey':_0x1356('0x185')});db[_0x1356('0x63')][_0x1356('0x11f')](db['User'],{'onDelete':_0x1356('0x113'),'as':_0x1356('0x112')});db[_0x1356('0x63')][_0x1356('0x11f')](db[_0x1356('0x77')],{'onDelete':_0x1356('0x113'),'as':_0x1356('0x167')});db['OpenchannelMessage'][_0x1356('0x11f')](db[_0x1356('0x62')],{'onDelete':_0x1356('0x113'),'as':_0x1356('0x16f'),'foreignKey':_0x1356('0x185')});db[_0x1356('0x63')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x1356('0x17b')});db[_0x1356('0x63')][_0x1356('0x11f')](db['OpenchannelAccount'],{'as':_0x1356('0x170'),'foreignKey':'OpenchannelAccountId'});db[_0x1356('0x65')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':_0x1356('0x3b'),'foreignKey':_0x1356('0x186')});db[_0x1356('0x65')][_0x1356('0x121')](db[_0x1356('0xea')],{'through':_0x1356('0x187'),'as':_0x1356('0x155')});db['ChatWebsite'][_0x1356('0x110')](db[_0x1356('0x87')],{'as':_0x1356('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x1356('0x67')]['hasMany'](db[_0x1356('0x85')],{'as':'Answers','foreignKey':_0x1356('0x188')});db[_0x1356('0x67')]['hasMany'](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x1356('0x67')][_0x1356('0x110')](db['ChatInteraction'],{'as':_0x1356('0x161')});db[_0x1356('0x67')][_0x1356('0x110')](db['ChatApplication'],{'as':_0x1356('0x146')});db[_0x1356('0x67')][_0x1356('0x110')](db['ChatMessage'],{'as':_0x1356('0x178')});db[_0x1356('0x67')][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173')});db[_0x1356('0x67')][_0x1356('0x11f')](db['Interval'],{'as':_0x1356('0x8a'),'foreignKey':_0x1356('0x151')});db[_0x1356('0x67')]['belongsTo'](db[_0x1356('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':_0x1356('0x153')});db[_0x1356('0x67')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':_0x1356('0x13a')});db['OpenchannelQueueReport'][_0x1356('0x11f')](db['OpenchannelAccount'],{});db[_0x1356('0x189')]['belongsTo'](db['CmList'],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173')});db['OpenchannelQueueReport'][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':_0x1356('0x15d')});db[_0x1356('0x189')][_0x1356('0x11f')](db[_0x1356('0x62')],{});db[_0x1356('0x189')][_0x1356('0x11f')](db[_0x1356('0x63')],{});db[_0x1356('0x189')][_0x1356('0x11f')](db[_0x1356('0x112')],{});db['OpenchannelQueueReport'][_0x1356('0x11f')](db[_0x1356('0x65')],{});db[_0x1356('0x6a')][_0x1356('0x11f')](db[_0x1356('0x112')],{'as':_0x1356('0x18a'),'foreignKey':_0x1356('0x10f'),'onDelete':_0x1356('0x171')});db[_0x1356('0x6a')][_0x1356('0x11f')](db['ChatQueue'],{'as':'Queue','foreignKey':_0x1356('0x18b'),'onDelete':_0x1356('0x171')});db[_0x1356('0x6a')][_0x1356('0x11f')](db[_0x1356('0x67')],{'as':_0x1356('0x18c'),'foreignKey':'ChatWebsiteId','onDelete':_0x1356('0x171')});db[_0x1356('0x6a')][_0x1356('0x11f')](db[_0x1356('0x93')],{'onDelete':_0x1356('0x171'),'foreignKey':_0x1356('0x172')});db['ChatInteraction'][_0x1356('0x110')](db['ChatMessage'],{'as':'Messages','onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x18d')});db[_0x1356('0x6c')]['belongsTo'](db[_0x1356('0x67')],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x188')});db['ChatInteraction']['belongsTo'](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':'ContactId'});db[_0x1356('0x6c')]['belongsTo'](db[_0x1356('0x112')],{'as':'Owner','foreignKey':'UserId'});db[_0x1356('0x6c')][_0x1356('0x121')](db['Tag'],{'through':_0x1356('0x18e'),'as':_0x1356('0x16a')});db[_0x1356('0x6c')][_0x1356('0x121')](db[_0x1356('0x93')],{'through':_0x1356('0x18e'),'as':_0x1356('0x16b')});db[_0x1356('0x6c')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x16c'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x1356('0x18f')][_0x1356('0x11f')](db[_0x1356('0x112')],{'onDelete':_0x1356('0x113'),'as':_0x1356('0x112')});db[_0x1356('0x18f')]['belongsTo'](db[_0x1356('0x77')],{'onDelete':_0x1356('0x113'),'as':'Contact','foreignKey':_0x1356('0x15d')});db[_0x1356('0x18f')][_0x1356('0x11f')](db[_0x1356('0x6c')],{'onDelete':_0x1356('0x113'),'as':_0x1356('0x16f'),'foreignKey':_0x1356('0x18d')});db['ChatMessage'][_0x1356('0x11f')](db['Attachment'],{'as':_0x1356('0xf0'),'foreignKey':'AttachmentId'});db[_0x1356('0x18f')][_0x1356('0x11f')](db[_0x1356('0x67')],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x188')});db['ChatOfflineMessage']['belongsTo'](db[_0x1356('0x77')],{'onDelete':_0x1356('0x113'),'as':'Contact','foreignKey':_0x1356('0x15d')});db['ChatOfflineMessage'][_0x1356('0x11f')](db['ChatWebsite'],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x188')});db[_0x1356('0x71')]['belongsToMany'](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':_0x1356('0x34'),'hooks':!![]});db[_0x1356('0x71')][_0x1356('0x121')](db[_0x1356('0xea')],{'through':_0x1356('0x190'),'as':_0x1356('0x155')});db['ChatGroup'][_0x1356('0x110')](db['ChatInternalMessage'],{'as':_0x1356('0x178'),'foreignKey':_0x1356('0x191'),'onDelete':'cascade'});db[_0x1356('0x73')][_0x1356('0x121')](db['User'],{'as':'Members','through':_0x1356('0x123')});db[_0x1356('0x74')][_0x1356('0x11f')](db[_0x1356('0x67')],{'as':_0x1356('0x18c'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x1356('0x110')](db[_0x1356('0x77')],{'as':'Contacts','foreignKey':_0x1356('0x192')});db[_0x1356('0x77')][_0x1356('0x110')](db[_0x1356('0x79')],{'as':_0x1356('0x193'),'foreignKey':'ContactId'});db[_0x1356('0x77')]['hasMany'](db['CmHopperFinal'],{'as':_0x1356('0x194'),'foreignKey':_0x1356('0x15d')});db[_0x1356('0x77')][_0x1356('0x110')](db[_0x1356('0x7d')],{'as':_0x1356('0x14a'),'foreignKey':_0x1356('0x15d')});db[_0x1356('0x77')]['hasMany'](db['ReportAgentPreview'],{'as':_0x1356('0x7f'),'foreignKey':_0x1356('0x15d')});db['CmContact'][_0x1356('0x110')](db[_0x1356('0xda')],{'as':'JscriptySessions','foreignKey':_0x1356('0x15d')});db[_0x1356('0x77')]['hasMany'](db[_0x1356('0x62')],{'as':_0x1356('0x12c'),'foreignKey':_0x1356('0x15d'),'onDelete':_0x1356('0x171')});db[_0x1356('0x77')][_0x1356('0x110')](db[_0x1356('0x6c')],{'as':_0x1356('0x116'),'foreignKey':_0x1356('0x15d'),'onDelete':_0x1356('0x171')});db[_0x1356('0x77')]['hasMany'](db[_0x1356('0x12b')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x1356('0x171')});db[_0x1356('0x77')][_0x1356('0x110')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x1356('0x171')});db[_0x1356('0x77')][_0x1356('0x110')](db[_0x1356('0x45')],{'as':_0x1356('0x11a'),'foreignKey':_0x1356('0x15d'),'onDelete':'restrict'});db[_0x1356('0x77')]['belongsTo'](db[_0x1356('0x195')],{'as':_0x1356('0x196'),'foreignKey':_0x1356('0x192')});db[_0x1356('0x77')][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':'ListId','onDelete':_0x1356('0x113')});db[_0x1356('0x77')]['belongsToMany'](db['User'],{'as':_0x1356('0x16c'),'through':'cm_user_has_contacts'});db[_0x1356('0x77')][_0x1356('0x121')](db['Tag'],{'as':_0x1356('0x16a'),'through':_0x1356('0x197')});db[_0x1356('0x77')]['belongsToMany'](db[_0x1356('0x93')],{'through':_0x1356('0x197'),'as':_0x1356('0x16b')});db[_0x1356('0x79')][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':_0x1356('0x15d'),'onDelete':_0x1356('0x113')});db[_0x1356('0x79')][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173'),'onDelete':_0x1356('0x113')});db['CmHopper'][_0x1356('0x11f')](db['User'],{'as':'Agent','foreignKey':_0x1356('0x10f')});db[_0x1356('0x79')][_0x1356('0x11f')](db[_0x1356('0x12e')],{'as':_0x1356('0x198'),'foreignKey':'VoiceQueueId','onDelete':_0x1356('0x113')});db[_0x1356('0x79')][_0x1356('0x11f')](db['Campaign'],{'as':_0x1356('0xed'),'foreignKey':_0x1356('0x199'),'onDelete':'cascade'});db[_0x1356('0x79')]['belongsTo'](db[_0x1356('0x112')],{'as':_0x1356('0x168'),'foreignKey':_0x1356('0x19a')});db[_0x1356('0x14b')][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':_0x1356('0x15d'),'onDelete':_0x1356('0x113')});db['CmHopperBlack']['belongsTo'](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':'ListId','onDelete':_0x1356('0x113')});db[_0x1356('0x14b')][_0x1356('0x11f')](db['VoiceQueue'],{'as':_0x1356('0x198'),'foreignKey':_0x1356('0x149'),'onDelete':_0x1356('0x113')});db[_0x1356('0x14b')][_0x1356('0x11f')](db['Campaign'],{'as':'Campaign','foreignKey':_0x1356('0x199'),'onDelete':_0x1356('0x113')});db[_0x1356('0x83')]['hasMany'](db['Condition'],{'as':{'plural':_0x1356('0x19b'),'singular':_0x1356('0x19c')},'foreignKey':_0x1356('0x19d'),'onDelete':_0x1356('0x113'),'hooks':!![]});db['Automation'][_0x1356('0x110')](db[_0x1356('0x88')],{'as':{'plural':_0x1356('0x19e'),'singular':_0x1356('0x19f')},'foreignKey':_0x1356('0x1a0'),'onDelete':_0x1356('0x113'),'hooks':!![]});db['Automation']['hasMany'](db[_0x1356('0x82')],{'as':_0x1356('0x1a1'),'foreignKey':_0x1356('0x1a2'),'onDelete':'cascade','hooks':!![]});db[_0x1356('0x8a')][_0x1356('0x110')](db[_0x1356('0x8a')],{'as':_0x1356('0x1a3'),'foreignKey':'IntervalId','onDelete':_0x1356('0x113'),'hooks':!![],'required':![]});db['Interval'][_0x1356('0x110')](db['VoiceExtension'],{'as':_0x1356('0x1a4'),'foreignKey':_0x1356('0x151'),'onDelete':_0x1356('0x171')});db[_0x1356('0x8a')]['hasMany'](db[_0x1356('0x49')],{'as':_0x1356('0x1a5'),'foreignKey':'IntervalId'});db[_0x1356('0x8a')][_0x1356('0x110')](db[_0x1356('0x6a')],{'as':'ChatApplications','foreignKey':_0x1356('0x151')});db['Interval'][_0x1356('0x110')](db['FaxApplication'],{'as':_0x1356('0x1a6'),'foreignKey':_0x1356('0x151')});db[_0x1356('0x8a')]['hasMany'](db[_0x1356('0x58')],{'as':_0x1356('0x1a7'),'foreignKey':'IntervalId'});db[_0x1356('0x8f')][_0x1356('0x11f')](db[_0x1356('0x13d')],{});db[_0x1356('0x8f')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x1356('0x11f')](db[_0x1356('0x1a8')],{'foreignKey':'CustomReportId'});db['Sound'][_0x1356('0x121')](db[_0x1356('0x1b')],{'as':_0x1356('0x1a9'),'through':_0x1356('0x148'),'onDelete':_0x1356('0x171')});db[_0x1356('0x93')][_0x1356('0x121')](db['CmContact'],{'through':_0x1356('0x197')});db[_0x1356('0x93')][_0x1356('0x121')](db[_0x1356('0x6c')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x1356('0x121')](db[_0x1356('0x45')],{'through':_0x1356('0x169')});db['Tag'][_0x1356('0x121')](db[_0x1356('0x12b')],{'through':_0x1356('0x180')});db[_0x1356('0x93')]['belongsToMany'](db[_0x1356('0x118')],{'through':_0x1356('0x17a')});db[_0x1356('0x93')][_0x1356('0x121')](db[_0x1356('0x62')],{'through':_0x1356('0x1aa')});db[_0x1356('0x93')]['belongsToMany'](db[_0x1356('0x11b')],{'through':_0x1356('0x1ab')});db[_0x1356('0x97')][_0x1356('0x110')](db[_0x1356('0x88')],{'as':{'plural':_0x1356('0x1ac'),'singular':_0x1356('0x1ad')},'foreignKey':_0x1356('0x1ae'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x1356('0x110')](db[_0x1356('0x88')],{'as':{'plural':_0x1356('0x1af'),'singular':_0x1356('0x1b0')},'foreignKey':_0x1356('0x1b1'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x1356('0x110')](db[_0x1356('0x82')],{'as':'Actions','foreignKey':_0x1356('0x1b2'),'onDelete':_0x1356('0x113'),'hooks':!![]});db['AnalyticCustomReport'][_0x1356('0x110')](db['AnalyticFieldReport'],{'as':_0x1356('0x1b3'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1b4'),'hooks':!![]});db[_0x1356('0x1b5')][_0x1356('0x110')](db['AnalyticFieldReport'],{'as':_0x1356('0x1b3'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1b6')});db[_0x1356('0x1b7')]['hasMany'](db[_0x1356('0x1b8')],{'as':_0x1356('0x1b3'),'onDelete':'cascade','foreignKey':_0x1356('0x1b9')});db[_0x1356('0x1b8')][_0x1356('0x11f')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x1356('0x1ba')][_0x1356('0x110')](db[_0x1356('0xa5')],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0xa5')]['hasMany'](db[_0x1356('0xa6')],{'as':_0x1356('0x1bd'),'onDelete':_0x1356('0x113'),'foreignKey':'SubjectId'});db[_0x1356('0xa5')]['hasMany'](db[_0x1356('0xa6')],{'as':_0x1356('0x1be'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0xa5')][_0x1356('0x110')](db[_0x1356('0xa6')],{'as':_0x1356('0x1b3'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1c0')});db[_0x1356('0xa5')][_0x1356('0x11f')](db[_0x1356('0x1ba')],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0xa6')]['hasMany'](db[_0x1356('0xa6')],{'as':_0x1356('0x1c1'),'foreignKey':_0x1356('0x1c2')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x1356('0x1c3'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0xa6')][_0x1356('0x110')](db[_0x1356('0xa6')],{'as':_0x1356('0x1c4'),'foreignKey':'FieldId'});db[_0x1356('0xa6')]['belongsTo'](db['Variable'],{'as':_0x1356('0x99'),'foreignKey':_0x1356('0x1c5')});db[_0x1356('0xa8')][_0x1356('0x110')](db['SugarcrmConfiguration'],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bc')});db['SugarcrmConfiguration'][_0x1356('0x110')](db['SugarcrmField'],{'as':_0x1356('0x1bd'),'onDelete':_0x1356('0x113'),'foreignKey':'SubjectId'});db[_0x1356('0xa9')][_0x1356('0x110')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0xa9')][_0x1356('0x110')](db[_0x1356('0xab')],{'as':_0x1356('0x1b3'),'onDelete':'cascade','foreignKey':_0x1356('0x1c0')});db['SugarcrmConfiguration'][_0x1356('0x11f')](db[_0x1356('0xa8')],{'as':_0x1356('0x170'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x1356('0x110')](db[_0x1356('0xab')],{'as':_0x1356('0x1c1'),'foreignKey':_0x1356('0x1c2')});db[_0x1356('0xab')][_0x1356('0x110')](db['SugarcrmField'],{'as':_0x1356('0x1c3'),'foreignKey':'DescriptionId'});db[_0x1356('0xab')][_0x1356('0x110')](db['SugarcrmField'],{'as':_0x1356('0x1c4'),'foreignKey':_0x1356('0x1c0')});db[_0x1356('0xab')][_0x1356('0x11f')](db['Variable'],{'as':_0x1356('0x99'),'foreignKey':_0x1356('0x1c5')});db[_0x1356('0xad')][_0x1356('0x110')](db[_0x1356('0xaf')],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':'AccountId'});db[_0x1356('0xaf')][_0x1356('0x110')](db['DeskField'],{'as':_0x1356('0x1bd'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1c2')});db[_0x1356('0xaf')][_0x1356('0x110')](db['DeskField'],{'as':_0x1356('0x1be'),'onDelete':'cascade','foreignKey':_0x1356('0x1bf')});db[_0x1356('0xaf')]['hasMany'](db[_0x1356('0x1c6')],{'as':_0x1356('0x1b3'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1c0')});db[_0x1356('0xaf')]['belongsTo'](db['DeskAccount'],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0xaf')][_0x1356('0x121')](db[_0x1356('0x93')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x1356('0x110')](db[_0x1356('0x1c6')],{'as':_0x1356('0x1c1'),'foreignKey':_0x1356('0x1c2')});db[_0x1356('0x1c6')][_0x1356('0x110')](db['DeskField'],{'as':_0x1356('0x1c3'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0x1c6')]['hasMany'](db[_0x1356('0x1c6')],{'as':'Field','foreignKey':_0x1356('0x1c0')});db[_0x1356('0x1c6')]['belongsTo'](db[_0x1356('0x99')],{'as':_0x1356('0x99'),'foreignKey':'VariableId'});db[_0x1356('0xb2')]['hasMany'](db[_0x1356('0x1c7')],{'as':'Configurations','onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0x1c7')][_0x1356('0x110')](db[_0x1356('0xb4')],{'as':_0x1356('0x1bd'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1c2')});db['ZohoConfiguration']['hasMany'](db[_0x1356('0xb4')],{'as':_0x1356('0x1be'),'onDelete':_0x1356('0x113'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x1356('0x110')](db[_0x1356('0xb4')],{'as':_0x1356('0x1b3'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x1356('0x1c7')][_0x1356('0x11f')](db['ZohoAccount'],{'as':_0x1356('0x170'),'foreignKey':'AccountId'});db[_0x1356('0xb4')][_0x1356('0x110')](db[_0x1356('0xb4')],{'as':_0x1356('0x1c1'),'foreignKey':'SubjectId'});db[_0x1356('0xb4')]['hasMany'](db['ZohoField'],{'as':_0x1356('0x1c3'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0xb4')][_0x1356('0x110')](db[_0x1356('0xb4')],{'as':'Field','foreignKey':_0x1356('0x1c0')});db[_0x1356('0xb4')][_0x1356('0x11f')](db[_0x1356('0x99')],{'as':_0x1356('0x99'),'foreignKey':_0x1356('0x1c5')});db[_0x1356('0xb5')][_0x1356('0x110')](db['ZendeskConfiguration'],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':'AccountId'});db[_0x1356('0x1c8')]['hasMany'](db['ZendeskField'],{'as':_0x1356('0x1bd'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x1356('0x110')](db[_0x1356('0xb8')],{'as':_0x1356('0x1be'),'foreignKey':_0x1356('0x1bf')});db['ZendeskConfiguration'][_0x1356('0x110')](db[_0x1356('0xb8')],{'as':_0x1356('0x1b3'),'foreignKey':_0x1356('0x1c0')});db[_0x1356('0x1c8')]['belongsTo'](db[_0x1356('0xb5')],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x1bc')});db['ZendeskConfiguration'][_0x1356('0x121')](db[_0x1356('0x93')],{'through':_0x1356('0x1c9')});db[_0x1356('0xb8')]['hasMany'](db[_0x1356('0xb8')],{'as':_0x1356('0x1c1'),'foreignKey':_0x1356('0x1c2')});db['ZendeskField'][_0x1356('0x110')](db['ZendeskField'],{'as':'Description','foreignKey':_0x1356('0x1bf')});db[_0x1356('0xb8')][_0x1356('0x110')](db['ZendeskField'],{'as':_0x1356('0x1c4'),'foreignKey':'FieldId'});db[_0x1356('0xb8')][_0x1356('0x11f')](db[_0x1356('0x99')],{'as':'Variable','foreignKey':_0x1356('0x1c5')});db[_0x1356('0xba')][_0x1356('0x110')](db['FreshdeskConfiguration'],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0x1ca')][_0x1356('0x110')](db[_0x1356('0xbd')],{'as':_0x1356('0x1bd'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1c2')});db[_0x1356('0x1ca')]['hasMany'](db['FreshdeskField'],{'as':_0x1356('0x1be'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0x1ca')][_0x1356('0x110')](db[_0x1356('0xbd')],{'as':_0x1356('0x1b3'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1c0')});db[_0x1356('0x1ca')]['belongsTo'](db[_0x1356('0xba')],{'as':'Account','foreignKey':'AccountId'});db[_0x1356('0x1ca')][_0x1356('0x121')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x1356('0xbd')]['hasMany'](db[_0x1356('0xbd')],{'as':_0x1356('0x1c1'),'foreignKey':_0x1356('0x1c2')});db['FreshdeskField'][_0x1356('0x110')](db[_0x1356('0xbd')],{'as':_0x1356('0x1c3'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0xbd')]['hasMany'](db[_0x1356('0xbd')],{'as':_0x1356('0x1c4'),'foreignKey':_0x1356('0x1c0')});db['FreshdeskField'][_0x1356('0x11f')](db[_0x1356('0x99')],{'as':_0x1356('0x99'),'foreignKey':'VariableId'});db[_0x1356('0xbf')][_0x1356('0x110')](db[_0x1356('0xc0')],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':'AccountId'});db[_0x1356('0xc0')][_0x1356('0x110')](db['VtigerField'],{'as':'Subjects','foreignKey':_0x1356('0x1c2')});db[_0x1356('0xc0')]['hasMany'](db['VtigerField'],{'as':_0x1356('0x1be'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0xc0')][_0x1356('0x110')](db[_0x1356('0xc2')],{'as':_0x1356('0x1b3'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0x1356('0x11f')](db[_0x1356('0xbf')],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0xc2')][_0x1356('0x110')](db['VtigerField'],{'as':'Subject','foreignKey':_0x1356('0x1c2')});db[_0x1356('0xc2')][_0x1356('0x110')](db[_0x1356('0xc2')],{'as':_0x1356('0x1c3'),'foreignKey':_0x1356('0x1bf')});db[_0x1356('0xc2')][_0x1356('0x110')](db[_0x1356('0xc2')],{'as':_0x1356('0x1c4'),'foreignKey':'FieldId'});db[_0x1356('0xc2')][_0x1356('0x11f')](db[_0x1356('0x99')],{'as':_0x1356('0x99'),'foreignKey':_0x1356('0x1c5')});db[_0x1356('0x1cb')][_0x1356('0x110')](db[_0x1356('0xc5')],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':'AccountId'});db[_0x1356('0xc5')][_0x1356('0x110')](db[_0x1356('0x1cc')],{'as':_0x1356('0x1bd'),'foreignKey':'SubjectId'});db['ServicenowConfiguration']['hasMany'](db[_0x1356('0x1cc')],{'as':_0x1356('0x1be'),'foreignKey':'DescriptionId'});db[_0x1356('0xc5')][_0x1356('0x110')](db[_0x1356('0x1cc')],{'as':_0x1356('0x1b3'),'foreignKey':_0x1356('0x1c0')});db[_0x1356('0xc5')][_0x1356('0x11f')](db[_0x1356('0x1cb')],{'as':_0x1356('0x170'),'foreignKey':'AccountId'});db['ServicenowField'][_0x1356('0x110')](db['ServicenowField'],{'as':_0x1356('0x1c1'),'foreignKey':_0x1356('0x1c2')});db[_0x1356('0x1cc')][_0x1356('0x110')](db['ServicenowField'],{'as':'Description','foreignKey':_0x1356('0x1bf')});db[_0x1356('0x1cc')][_0x1356('0x110')](db[_0x1356('0x1cc')],{'as':_0x1356('0x1c4'),'foreignKey':_0x1356('0x1c0')});db[_0x1356('0x1cc')][_0x1356('0x11f')](db[_0x1356('0x99')],{'as':'Variable','foreignKey':_0x1356('0x1c5')});db[_0x1356('0xc8')][_0x1356('0x110')](db[_0x1356('0xca')],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0xca')][_0x1356('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1c2')});db[_0x1356('0xca')][_0x1356('0x110')](db[_0x1356('0xcc')],{'as':'Descriptions','onDelete':_0x1356('0x113'),'foreignKey':'DescriptionId'});db[_0x1356('0xca')]['hasMany'](db[_0x1356('0xcc')],{'as':_0x1356('0x1b3'),'onDelete':_0x1356('0x113'),'foreignKey':'FieldId'});db[_0x1356('0xca')][_0x1356('0x11f')](db[_0x1356('0xc8')],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x1bc')});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':_0x1356('0x1c1'),'foreignKey':_0x1356('0x1c2')});db[_0x1356('0xcc')][_0x1356('0x110')](db['Dynamics365Field'],{'as':_0x1356('0x1c3'),'foreignKey':'DescriptionId'});db[_0x1356('0xcc')][_0x1356('0x110')](db['Dynamics365Field'],{'as':_0x1356('0x1c4'),'foreignKey':_0x1356('0x1c0')});db[_0x1356('0xcc')][_0x1356('0x11f')](db[_0x1356('0x99')],{'as':'Variable','foreignKey':_0x1356('0x1c5')});db[_0x1356('0x1cd')]['hasMany'](db[_0x1356('0xcf')],{'as':_0x1356('0x1bb'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0xcf')][_0x1356('0x110')](db[_0x1356('0x1ce')],{'as':'Subjects','foreignKey':_0x1356('0x1c2')});db[_0x1356('0xcf')]['hasMany'](db[_0x1356('0x1ce')],{'as':'Descriptions','foreignKey':_0x1356('0x1bf')});db[_0x1356('0xcf')]['hasMany'](db[_0x1356('0x1ce')],{'as':_0x1356('0x1b3'),'foreignKey':'FieldId'});db[_0x1356('0xcf')][_0x1356('0x11f')](db[_0x1356('0x1cd')],{'as':_0x1356('0x170'),'foreignKey':_0x1356('0x1bc')});db[_0x1356('0x1ce')]['hasMany'](db[_0x1356('0x1ce')],{'as':_0x1356('0x1c1'),'foreignKey':_0x1356('0x1c2')});db['FreshsalesField'][_0x1356('0x110')](db[_0x1356('0x1ce')],{'as':'Description','foreignKey':_0x1356('0x1bf')});db[_0x1356('0x1ce')][_0x1356('0x110')](db[_0x1356('0x1ce')],{'as':'Field','foreignKey':_0x1356('0x1c0')});db[_0x1356('0x1ce')][_0x1356('0x11f')](db[_0x1356('0x99')],{'as':_0x1356('0x99'),'foreignKey':_0x1356('0x1c5')});db[_0x1356('0xd3')][_0x1356('0x11f')](db[_0x1356('0x67')],{});db['ChatQueueReport'][_0x1356('0x11f')](db['CmList'],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173')});db['ChatQueueReport'][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':_0x1356('0x15d')});db['ChatQueueReport']['belongsTo'](db['ChatInteraction'],{});db[_0x1356('0xd3')][_0x1356('0x11f')](db[_0x1356('0x18f')],{});db[_0x1356('0xd3')][_0x1356('0x11f')](db[_0x1356('0x112')],{});db[_0x1356('0xd3')][_0x1356('0x11f')](db[_0x1356('0x71')],{});db['ChatInternalMessage'][_0x1356('0x11f')](db['User'],{'onDelete':'cascade','foreignKey':_0x1356('0x1cf')});db[_0x1356('0xd5')][_0x1356('0x11f')](db['User'],{'onDelete':'cascade','foreignKey':_0x1356('0x1d0')});db[_0x1356('0xda')][_0x1356('0x110')](db['JscriptyQuestionReport'],{'foreignKey':_0x1356('0x1d1'),'onDelete':_0x1356('0x113')});db['JscriptySessionReport'][_0x1356('0x110')](db['JscriptyAnswerReport'],{'foreignKey':_0x1356('0x1d1'),'onDelete':_0x1356('0x113')});db['SmsQueueReport']['belongsTo'](db['SmsAccount'],{});db['SmsQueueReport'][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173')});db['SmsQueueReport']['belongsTo'](db[_0x1356('0x77')],{'as':_0x1356('0x167'),'foreignKey':_0x1356('0x15d')});db[_0x1356('0xdc')][_0x1356('0x11f')](db['SmsInteraction'],{});db['SmsQueueReport'][_0x1356('0x11f')](db[_0x1356('0x5b')],{});db[_0x1356('0xdc')][_0x1356('0x11f')](db[_0x1356('0x112')],{});db[_0x1356('0xdc')]['belongsTo'](db[_0x1356('0x5d')],{});db['JscriptyProject'][_0x1356('0x110')](db['JscriptySessionReport'],{'foreignKey':_0x1356('0x1d2')});db[_0x1356('0xe1')][_0x1356('0x110')](db[_0x1356('0x1d3')],{'foreignKey':_0x1356('0x1d2')});db[_0x1356('0xe1')][_0x1356('0x110')](db[_0x1356('0xd7')],{'foreignKey':_0x1356('0x1d2')});db[_0x1356('0xe5')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x16c'),'through':_0x1356('0x143')});db[_0x1356('0xea')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':_0x1356('0x1d4')});db[_0x1356('0xea')][_0x1356('0x121')](db['VoiceQueue'],{'through':'team_has_voice_queues','as':_0x1356('0x12f')});db[_0x1356('0xea')][_0x1356('0x121')](db[_0x1356('0x42')],{'through':_0x1356('0x165'),'as':_0x1356('0x130')});db[_0x1356('0xea')]['belongsToMany'](db[_0x1356('0x71')],{'through':_0x1356('0x190'),'as':_0x1356('0x131')});db['Team'][_0x1356('0x121')](db[_0x1356('0x132')],{'through':_0x1356('0x17c'),'as':_0x1356('0x133')});db[_0x1356('0xea')][_0x1356('0x121')](db[_0x1356('0x5d')],{'through':_0x1356('0x1d5'),'as':_0x1356('0x135')});db['Team'][_0x1356('0x121')](db[_0x1356('0x65')],{'through':_0x1356('0x187'),'as':_0x1356('0x136')});db[_0x1356('0xea')][_0x1356('0x121')](db['WhatsappQueue'],{'through':_0x1356('0x1d6'),'as':'WhatsappQueues'});db['Campaign']['hasMany'](db['CmHopper'],{'as':_0x1356('0x193'),'foreignKey':_0x1356('0x199')});db[_0x1356('0xed')][_0x1356('0x110')](db[_0x1356('0x114')],{'as':'HopperFinals','foreignKey':_0x1356('0x199')});db['Campaign'][_0x1356('0x110')](db[_0x1356('0x7d')],{'as':'HopperHistories','foreignKey':_0x1356('0x199')});db[_0x1356('0xed')][_0x1356('0x110')](db[_0x1356('0x14b')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign'][_0x1356('0x11f')](db[_0x1356('0x2c')],{'as':_0x1356('0x2c'),'foreignKey':_0x1356('0x14e')});db[_0x1356('0xed')]['belongsTo'](db[_0x1356('0x2c')],{'as':'TrunkBackup','foreignKey':_0x1356('0x150')});db[_0x1356('0xed')][_0x1356('0x11f')](db[_0x1356('0x8a')],{'as':_0x1356('0x8a'),'foreignKey':'IntervalId'});db['Campaign']['belongsTo'](db[_0x1356('0xe5')],{'as':'SquareProject','foreignKey':_0x1356('0x1d7')});db[_0x1356('0xed')][_0x1356('0x121')](db['CmList'],{'as':_0x1356('0x127'),'through':_0x1356('0x1d8')});db['Campaign'][_0x1356('0x121')](db['CmList'],{'as':_0x1356('0x157'),'through':_0x1356('0x1d9')});db[_0x1356('0xf3')][_0x1356('0x11f')](db[_0x1356('0x47')],{});db[_0x1356('0xf3')][_0x1356('0x11f')](db[_0x1356('0x45')],{});db[_0x1356('0xf3')][_0x1356('0x11f')](db[_0x1356('0x13d')],{'foreignKey':'FromMailAccountId','as':'FromAccount'});db[_0x1356('0xf3')]['belongsTo'](db[_0x1356('0x112')],{'foreignKey':_0x1356('0x1da'),'as':_0x1356('0x1db')});db[_0x1356('0xf3')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport'][_0x1356('0x11f')](db[_0x1356('0x42')],{'foreignKey':_0x1356('0x1dc'),'as':'ToQueue'});db[_0x1356('0xf3')][_0x1356('0x11f')](db['MailAccount'],{'foreignKey':_0x1356('0x1dd'),'as':_0x1356('0x1de')});db[_0x1356('0xf5')][_0x1356('0x11f')](db[_0x1356('0x18f')],{});db[_0x1356('0xf5')]['belongsTo'](db[_0x1356('0x6c')],{});db['ChatTransferReport']['belongsTo'](db[_0x1356('0x67')],{'foreignKey':_0x1356('0x1df'),'as':'FromAccount'});db[_0x1356('0xf5')][_0x1356('0x11f')](db[_0x1356('0x112')],{'foreignKey':'FromUserId','as':_0x1356('0x1db')});db[_0x1356('0xf5')][_0x1356('0x11f')](db[_0x1356('0x112')],{'foreignKey':'ToUserId','as':_0x1356('0x1e0')});db[_0x1356('0xf5')]['belongsTo'](db[_0x1356('0x71')],{'foreignKey':_0x1356('0x1e1'),'as':_0x1356('0x1e2')});db[_0x1356('0xf5')][_0x1356('0x11f')](db['ChatWebsite'],{'foreignKey':_0x1356('0x1e3'),'as':_0x1356('0x1de')});db[_0x1356('0x1e4')][_0x1356('0x11f')](db[_0x1356('0x53')],{});db[_0x1356('0x1e4')][_0x1356('0x11f')](db[_0x1356('0x118')],{});db['FaxTransferReport']['belongsTo'](db[_0x1356('0x4e')],{'foreignKey':_0x1356('0x1e5'),'as':'FromAccount'});db[_0x1356('0x1e4')]['belongsTo'](db['User'],{'foreignKey':_0x1356('0x1da'),'as':'FromAgent'});db[_0x1356('0x1e4')][_0x1356('0x11f')](db[_0x1356('0x112')],{'foreignKey':_0x1356('0x1e6'),'as':_0x1356('0x1e0')});db['FaxTransferReport'][_0x1356('0x11f')](db[_0x1356('0x132')],{'foreignKey':_0x1356('0x1e7'),'as':_0x1356('0x1e2')});db[_0x1356('0x1e4')][_0x1356('0x11f')](db[_0x1356('0x4e')],{'foreignKey':'ToFaxAccountId','as':_0x1356('0x1de')});db[_0x1356('0xf8')]['belongsTo'](db[_0x1356('0x63')],{});db['OpenchannelTransferReport'][_0x1356('0x11f')](db['OpenchannelInteraction'],{});db[_0x1356('0xf8')][_0x1356('0x11f')](db[_0x1356('0x5f')],{'foreignKey':_0x1356('0x1e8'),'as':'FromAccount'});db[_0x1356('0xf8')][_0x1356('0x11f')](db['User'],{'foreignKey':_0x1356('0x1da'),'as':_0x1356('0x1db')});db[_0x1356('0xf8')][_0x1356('0x11f')](db['User'],{'foreignKey':_0x1356('0x1e6'),'as':'ToAgent'});db[_0x1356('0xf8')][_0x1356('0x11f')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0x1356('0x1e2')});db[_0x1356('0xf8')][_0x1356('0x11f')](db[_0x1356('0x5f')],{'foreignKey':_0x1356('0x1e9'),'as':_0x1356('0x1de')});db[_0x1356('0x1ea')]['belongsTo'](db['SmsMessage'],{});db[_0x1356('0x1ea')][_0x1356('0x11f')](db[_0x1356('0x12b')],{});db['SmsTransferReport'][_0x1356('0x11f')](db[_0x1356('0x17d')],{'foreignKey':_0x1356('0x1eb'),'as':'FromAccount'});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x1356('0x1db')});db[_0x1356('0x1ea')][_0x1356('0x11f')](db['User'],{'foreignKey':_0x1356('0x1e6'),'as':_0x1356('0x1e0')});db[_0x1356('0x1ea')][_0x1356('0x11f')](db['SmsQueue'],{'foreignKey':_0x1356('0x1ec'),'as':_0x1356('0x1e2')});db['SmsTransferReport'][_0x1356('0x11f')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x1356('0x1de')});db[_0x1356('0x126')][_0x1356('0x110')](db[_0x1356('0x87')],{'as':_0x1356('0x160'),'foreignKey':'ListId'});db[_0x1356('0x126')][_0x1356('0x110')](db[_0x1356('0x81')],{'as':'CustomFields','foreignKey':_0x1356('0x173')});db[_0x1356('0x126')][_0x1356('0x110')](db[_0x1356('0x77')],{'as':_0x1356('0x124'),'onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x173')});db['CmList'][_0x1356('0x110')](db['CmHopperFinal'],{'as':_0x1356('0x194'),'foreignKey':_0x1356('0x173')});db[_0x1356('0x126')]['hasMany'](db['CmHopperHistory'],{'as':_0x1356('0x115'),'foreignKey':_0x1356('0x173')});db[_0x1356('0x126')]['hasMany'](db[_0x1356('0x7f')],{'as':_0x1356('0x7f'),'foreignKey':'ListId'});db[_0x1356('0x126')][_0x1356('0x121')](db[_0x1356('0x12e')],{'as':_0x1356('0x1ed'),'through':_0x1356('0x154')});db[_0x1356('0x126')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':_0x1356('0x128')});db['VoicePrefix'][_0x1356('0x110')](db[_0x1356('0x19')],{'as':_0x1356('0x1a4'),'onDelete':_0x1356('0x113')});db['VoicePrefix'][_0x1356('0x121')](db['User'],{'as':_0x1356('0x164'),'through':_0x1356('0x138')});db[_0x1356('0xfc')][_0x1356('0x110')](db[_0x1356('0x112')],{'as':_0x1356('0x16c'),'foreignKey':'userProfileId'});db[_0x1356('0xfc')][_0x1356('0x110')](db[_0x1356('0x1ee')],{'as':_0x1356('0x1ef'),'foreignKey':_0x1356('0x120'),'onDelete':_0x1356('0x113')});db[_0x1356('0x1ee')][_0x1356('0x110')](db[_0x1356('0xff')],{'as':_0x1356('0x1f0'),'foreignKey':_0x1356('0x1f1'),'onDelete':_0x1356('0x113')});db[_0x1356('0x102')][_0x1356('0x110')](db['Disposition'],{'as':_0x1356('0x160'),'foreignKey':'WhatsappAccountId'});db[_0x1356('0x102')][_0x1356('0x110')](db[_0x1356('0x85')],{'as':_0x1356('0x1f2'),'foreignKey':_0x1356('0x1f3')});db[_0x1356('0x102')][_0x1356('0x110')](db[_0x1356('0x106')],{'as':_0x1356('0x178'),'foreignKey':_0x1356('0x1f3')});db[_0x1356('0x102')][_0x1356('0x110')](db[_0x1356('0x11b')],{'as':_0x1356('0x161')});db[_0x1356('0x102')][_0x1356('0x110')](db[_0x1356('0x1f4')],{'as':_0x1356('0x146')});db[_0x1356('0x102')]['belongsTo'](db[_0x1356('0x126')],{'as':'List','foreignKey':_0x1356('0x173')});db[_0x1356('0x102')][_0x1356('0x11f')](db[_0x1356('0x8c')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x1356('0x102')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':'user_has_whatsapp_accounts'});db[_0x1356('0x1f4')][_0x1356('0x11f')](db[_0x1356('0x112')],{'onDelete':_0x1356('0x171')});db[_0x1356('0x1f4')][_0x1356('0x11f')](db[_0x1356('0x10a')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x1356('0x11f')](db[_0x1356('0x102')],{'onDelete':_0x1356('0x171')});db[_0x1356('0x1f4')]['belongsTo'](db[_0x1356('0x8a')],{'onDelete':_0x1356('0x171'),'foreignKey':_0x1356('0x151')});db[_0x1356('0x1f4')][_0x1356('0x11f')](db[_0x1356('0x93')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x1356('0x11b')][_0x1356('0x110')](db[_0x1356('0x106')],{'as':'Messages','onDelete':_0x1356('0x113'),'foreignKey':_0x1356('0x1f5')});db[_0x1356('0x11b')][_0x1356('0x11f')](db[_0x1356('0x102')],{'as':'Account','foreignKey':_0x1356('0x1f3')});db[_0x1356('0x11b')][_0x1356('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappInteraction'][_0x1356('0x11f')](db[_0x1356('0x112')],{'as':_0x1356('0x168'),'foreignKey':_0x1356('0x10f')});db[_0x1356('0x11b')]['belongsToMany'](db[_0x1356('0x93')],{'through':_0x1356('0x1ab'),'as':'Tags'});db['WhatsappInteraction'][_0x1356('0x121')](db[_0x1356('0x93')],{'through':'whatsapp_interaction_has_tags','as':_0x1356('0x16b')});db[_0x1356('0x11b')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x16c'),'through':_0x1356('0x1f6'),'foreignKey':_0x1356('0x1f5')});db[_0x1356('0x106')][_0x1356('0x11f')](db[_0x1356('0x112')],{'as':_0x1356('0x112')});db[_0x1356('0x106')][_0x1356('0x11f')](db['CmContact'],{'onDelete':'cascade','as':_0x1356('0x167')});db['WhatsappMessage'][_0x1356('0x11f')](db[_0x1356('0x11b')],{'onDelete':'cascade','as':_0x1356('0x16f'),'foreignKey':_0x1356('0x1f5')});db[_0x1356('0x106')][_0x1356('0x11f')](db[_0x1356('0x102')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x1356('0x107')][_0x1356('0x11f')](db[_0x1356('0x102')],{});db[_0x1356('0x107')][_0x1356('0x11f')](db[_0x1356('0x126')],{'as':_0x1356('0x162'),'foreignKey':_0x1356('0x173')});db[_0x1356('0x107')][_0x1356('0x11f')](db[_0x1356('0x77')],{'as':'Contact','foreignKey':_0x1356('0x15d')});db[_0x1356('0x107')][_0x1356('0x11f')](db['WhatsappInteraction'],{});db[_0x1356('0x107')][_0x1356('0x11f')](db[_0x1356('0x10a')],{});db[_0x1356('0x107')][_0x1356('0x11f')](db[_0x1356('0x106')],{});db[_0x1356('0x107')][_0x1356('0x11f')](db['User'],{});db[_0x1356('0x109')][_0x1356('0x11f')](db[_0x1356('0x106')],{});db[_0x1356('0x109')][_0x1356('0x11f')](db[_0x1356('0x11b')],{});db[_0x1356('0x109')][_0x1356('0x11f')](db[_0x1356('0x102')],{'foreignKey':_0x1356('0x1f7'),'as':'FromAccount'});db[_0x1356('0x109')][_0x1356('0x11f')](db[_0x1356('0x102')],{'foreignKey':'ToWhatsappAccountId','as':_0x1356('0x1de')});db[_0x1356('0x109')][_0x1356('0x11f')](db[_0x1356('0x10a')],{'foreignKey':_0x1356('0x1f8'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0x1356('0x112')],{'foreignKey':_0x1356('0x1da'),'as':'FromAgent'});db[_0x1356('0x109')][_0x1356('0x11f')](db[_0x1356('0x112')],{'foreignKey':_0x1356('0x1e6'),'as':_0x1356('0x1e0')});db[_0x1356('0x10a')][_0x1356('0x121')](db[_0x1356('0x112')],{'as':_0x1356('0x164'),'through':'UserWhatsappQueue','foreignKey':_0x1356('0x1f9')});db['WhatsappQueue'][_0x1356('0x121')](db['Team'],{'through':_0x1356('0x1d6'),'as':_0x1356('0x155')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 4d59ad2..6d0193e 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f69=['/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','/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/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareProject','/api/square/recordings','/api/square/messages','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','/apidoc','static','join','/www','root','/demo','/snippet','snippet','1.0.16','route','get','sendFile','resolve','appPath','/index.html','path','express','./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','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','agent_name','./api/voiceChanSpy'];(function(_0x5ead40,_0x4118d4){var _0x3e922e=function(_0x2cb141){while(--_0x2cb141){_0x5ead40['push'](_0x5ead40['shift']());}};_0x3e922e(++_0x4118d4);}(_0x5f69,0xf5));var _0x95f6=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x5f69[_0x4226d6];return _0x19655b;};'use strict';var path=require(_0x95f6('0x0'));var express=require(_0x95f6('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0x95f6('0x2'));var config=require(_0x95f6('0x3'));var logger=require(_0x95f6('0x4'))(_0x95f6('0x5'));var authLogger=require('./config/logger')(_0x95f6('0x6'));exports[_0x95f6('0x7')]=function(_0x55e4e8){_0x55e4e8[_0x95f6('0x8')](ewinston[_0x95f6('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x15152d,_0x5d8632){return util['format'](_0x95f6('0xa'),_0x15152d[_0x95f6('0xb')],_0x15152d[_0x95f6('0xc')][_0x95f6('0xd')]?_0x15152d[_0x95f6('0xc')][_0x95f6('0xd')]:_0x15152d[_0x95f6('0xe')][_0x95f6('0xf')]||_0x15152d['ip'],_0x15152d[_0x95f6('0x10')],_0x5d8632[_0x95f6('0x11')],_0x5d8632[_0x95f6('0x12')],_0x15152d[_0x95f6('0x13')]?_0x15152d[_0x95f6('0x13')]['id']:null,_0x15152d[_0x95f6('0x13')]?_0x15152d[_0x95f6('0x13')][_0x95f6('0x14')]:null,_0x15152d[_0x95f6('0x13')]?_0x15152d['user'][_0x95f6('0x15')]:null);}}));_0x55e4e8[_0x95f6('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x900347,_0x31497f){var _0x481e44='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x900347[_0x95f6('0x16')]&&_0x900347['body'][_0x95f6('0x17')]&&_0x900347[_0x95f6('0x16')][_0x95f6('0x18')]){_0x481e44=_0x95f6('0x19');}return util[_0x95f6('0x1a')](_0x481e44,_0x900347['method'],_0x900347['headers'][_0x95f6('0xd')]?_0x900347[_0x95f6('0xc')][_0x95f6('0xd')]:_0x900347[_0x95f6('0xe')][_0x95f6('0xf')]||_0x900347['ip'],_0x900347[_0x95f6('0x10')],_0x31497f['statusCode'],_0x31497f[_0x95f6('0x12')],_0x900347[_0x95f6('0x13')]?_0x900347['user']['id']:null,_0x900347[_0x95f6('0x13')]?_0x900347['user'][_0x95f6('0x14')]:null,_0x900347[_0x95f6('0x13')]?_0x900347[_0x95f6('0x13')][_0x95f6('0x15')]:null,_0x900347[_0x95f6('0x16')]&&_0x900347[_0x95f6('0x16')][_0x95f6('0x17')]?_0x900347['body'][_0x95f6('0x17')]:'other',_0x900347[_0x95f6('0x16')]&&_0x900347['body']['agent_id']?_0x900347[_0x95f6('0x16')][_0x95f6('0x18')]:'',_0x900347[_0x95f6('0x16')]&&_0x900347[_0x95f6('0x16')][_0x95f6('0x1b')]?_0x900347[_0x95f6('0x16')]['agent_name']:'');},'ignoreRoute':function(_0x4d4682){var _0x3ce587=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3ce587['test'](_0x4d4682[_0x95f6('0x10')]);}}));_0x55e4e8[_0x95f6('0x8')]('/api/users',require('./api/user'));_0x55e4e8[_0x95f6('0x8')]('/api/voice/chanspy',require(_0x95f6('0x1c')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x1d'),require(_0x95f6('0x1e')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x1f'),require(_0x95f6('0x20')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x21'),require(_0x95f6('0x22')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x23'),require('./api/voiceQueue'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x24'),require(_0x95f6('0x25')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x26'),require(_0x95f6('0x27')));_0x55e4e8[_0x95f6('0x8')]('/api/voice/mails',require(_0x95f6('0x28')));_0x55e4e8['use'](_0x95f6('0x29'),require(_0x95f6('0x2a')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x2b'),require(_0x95f6('0x2c')));_0x55e4e8[_0x95f6('0x8')]('/api/voice/dials/reports',require(_0x95f6('0x2d')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x2e'),require('./api/voiceAgentReport'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x2f'),require(_0x95f6('0x30')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x31'),require(_0x95f6('0x32')));_0x55e4e8[_0x95f6('0x8')]('/api/trunks',require(_0x95f6('0x33')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x34'),require(_0x95f6('0x35')));_0x55e4e8[_0x95f6('0x8')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x55e4e8[_0x95f6('0x8')]('/api/mail/accounts',require(_0x95f6('0x36')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x37'),require('./api/mailQueue'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x38'),require(_0x95f6('0x39')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x3a'),require(_0x95f6('0x3b')));_0x55e4e8[_0x95f6('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x3c'),require(_0x95f6('0x3d')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x3e'),require(_0x95f6('0x3f')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x40'),require('./api/dashboard'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x41'),require('./api/dashboardItem'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x42'),require('./api/faxAccount'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x43'),require(_0x95f6('0x44')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x45'),require('./api/faxInteraction'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x46'),require(_0x95f6('0x47')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x48'),require('./api/faxQueue'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x49'),require('./api/faxQueueReport'));_0x55e4e8['use'](_0x95f6('0x4a'),require(_0x95f6('0x4b')));_0x55e4e8['use'](_0x95f6('0x4c'),require('./api/smsApplication'));_0x55e4e8['use'](_0x95f6('0x4d'),require(_0x95f6('0x4e')));_0x55e4e8[_0x95f6('0x8')]('/api/sms/messages',require(_0x95f6('0x4f')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x50'),require(_0x95f6('0x51')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x52'),require('./api/openchannelAccount'));_0x55e4e8['use'](_0x95f6('0x53'),require(_0x95f6('0x54')));_0x55e4e8['use'](_0x95f6('0x55'),require(_0x95f6('0x56')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x57'),require('./api/openchannelMessage'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x58'),require(_0x95f6('0x59')));_0x55e4e8['use'](_0x95f6('0x5a'),require('./api/chatWebsite'));_0x55e4e8['use'](_0x95f6('0x5b'),require(_0x95f6('0x5c')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x5d'),require(_0x95f6('0x5e')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x5f'),require(_0x95f6('0x60')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x61'),require(_0x95f6('0x62')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x63'),require(_0x95f6('0x64')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x65'),require('./api/chatQueue'));_0x55e4e8['use']('/api/chat/groups',require('./api/chatGroup'));_0x55e4e8[_0x95f6('0x8')]('/api/chat/proactive_actions',require(_0x95f6('0x66')));_0x55e4e8['use'](_0x95f6('0x67'),require(_0x95f6('0x68')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x69'),require(_0x95f6('0x6a')));_0x55e4e8[_0x95f6('0x8')]('/api/cm/hopper',require(_0x95f6('0x6b')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x6c'),require(_0x95f6('0x6d')));_0x55e4e8['use']('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x55e4e8['use'](_0x95f6('0x6e'),require(_0x95f6('0x6f')));_0x55e4e8[_0x95f6('0x8')]('/api/cm/custom_fields',require(_0x95f6('0x70')));_0x55e4e8[_0x95f6('0x8')]('/api/actions',require(_0x95f6('0x71')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x72'),require('./api/automation'));_0x55e4e8['use'](_0x95f6('0x73'),require(_0x95f6('0x74')));_0x55e4e8[_0x95f6('0x8')]('/api/dispositions',require(_0x95f6('0x75')));_0x55e4e8['use'](_0x95f6('0x76'),require('./api/condition'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x77'),require('./api/interval'));_0x55e4e8['use']('/api/pauses',require('./api/pause'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x78'),require('./api/cdr'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x79'),require('./api/voiceQueuesLog'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x7a'),require(_0x95f6('0x7b')));_0x55e4e8['use'](_0x95f6('0x7c'),require('./api/sound'));_0x55e4e8['use'](_0x95f6('0x7d'),require(_0x95f6('0x7e')));_0x55e4e8['use'](_0x95f6('0x7f'),require(_0x95f6('0x80')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x81'),require(_0x95f6('0x82')));_0x55e4e8['use'](_0x95f6('0x83'),require(_0x95f6('0x84')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x85'),require(_0x95f6('0x86')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x87'),require(_0x95f6('0x88')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x89'),require(_0x95f6('0x8a')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x8b'),require(_0x95f6('0x8c')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x8d'),require('./api/analyticExtractedReport'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x8e'),require(_0x95f6('0x8f')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x90'),require(_0x95f6('0x91')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x92'),require(_0x95f6('0x93')));_0x55e4e8[_0x95f6('0x8')]('/api/integrations/salesforce/accounts',require(_0x95f6('0x94')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x95'),require(_0x95f6('0x96')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x97'),require(_0x95f6('0x98')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x99'),require(_0x95f6('0x9a')));_0x55e4e8[_0x95f6('0x8')]('/api/integrations/sugarcrm/configurations',require(_0x95f6('0x9b')));_0x55e4e8[_0x95f6('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x9c'),require(_0x95f6('0x9d')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x9e'),require(_0x95f6('0x9f')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xa0'),require('./api/intDeskField'));_0x55e4e8[_0x95f6('0x8')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x55e4e8['use'](_0x95f6('0xa1'),require(_0x95f6('0xa2')));_0x55e4e8[_0x95f6('0x8')]('/api/integrations/zoho/fields',require(_0x95f6('0xa3')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xa4'),require(_0x95f6('0xa5')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xa6'),require('./api/intZendeskConfiguration'));_0x55e4e8['use'](_0x95f6('0xa7'),require('./api/intZendeskField'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xa8'),require(_0x95f6('0xa9')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xaa'),require('./api/intFreshdeskConfiguration'));_0x55e4e8['use']('/api/integrations/freshdesk/fields',require(_0x95f6('0xab')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xac'),require(_0x95f6('0xad')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xae'),require(_0x95f6('0xaf')));_0x55e4e8['use'](_0x95f6('0xb0'),require('./api/intVtigerField'));_0x55e4e8['use'](_0x95f6('0xb1'),require(_0x95f6('0xb2')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xb3'),require(_0x95f6('0xb4')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xb5'),require('./api/intServicenowField'));_0x55e4e8[_0x95f6('0x8')]('/api/integrations/dynamics365/accounts',require(_0x95f6('0xb6')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xb7'),require('./api/intDynamics365Configuration'));_0x55e4e8['use'](_0x95f6('0xb8'),require(_0x95f6('0xb9')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xba'),require(_0x95f6('0xbb')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xbc'),require('./api/intFreshsalesConfiguration'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xbd'),require(_0x95f6('0xbe')));_0x55e4e8[_0x95f6('0x8')]('/api/networks',require(_0x95f6('0xbf')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xc0'),require('./api/chatQueueReport'));_0x55e4e8[_0x95f6('0x8')]('/api/chat/internal/messages',require(_0x95f6('0xc1')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xc2'),require('./api/jscriptyAnswerReport'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xc3'),require(_0x95f6('0xc4')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xc5'),require(_0x95f6('0xc6')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xc7'),require(_0x95f6('0xc8')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xc9'),require(_0x95f6('0xca')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xcb'),require(_0x95f6('0xcc')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xcd'),require(_0x95f6('0xce')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xcf'),require(_0x95f6('0xd0')));_0x55e4e8[_0x95f6('0x8')]('/api/square/odbc',require('./api/squareOdbc'));_0x55e4e8[_0x95f6('0x8')]('/api/square/projects',require(_0x95f6('0xd1')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xd2'),require('./api/squareRecording'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xd3'),require('./api/squareMessage'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xd4'),require(_0x95f6('0xd5')));_0x55e4e8[_0x95f6('0x8')]('/api/license',require(_0x95f6('0xd6')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xd7'),require(_0x95f6('0xd8')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xd9'),require('./api/migration'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xda'),require('./api/attachment'));_0x55e4e8['use'](_0x95f6('0xdb'),require(_0x95f6('0xdc')));_0x55e4e8['use']('/api/mail/reports/transfer',require(_0x95f6('0xdd')));_0x55e4e8['use'](_0x95f6('0xde'),require(_0x95f6('0xdf')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xe0'),require(_0x95f6('0xe1')));_0x55e4e8['use'](_0x95f6('0xe2'),require('./api/openchannelTransferReport'));_0x55e4e8[_0x95f6('0x8')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x55e4e8['use'](_0x95f6('0xe3'),require(_0x95f6('0xe4')));_0x55e4e8[_0x95f6('0x8')]('/api/voice/prefixes',require(_0x95f6('0xe5')));_0x55e4e8['use'](_0x95f6('0xe6'),require(_0x95f6('0xe7')));_0x55e4e8[_0x95f6('0x8')]('/api/userProfile/sections',require(_0x95f6('0xe8')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xe9'),require(_0x95f6('0xea')));_0x55e4e8['use'](_0x95f6('0xeb'),require('./api/notification'));_0x55e4e8['use'](_0x95f6('0xec'),require('./api/whatsappAccount'));_0x55e4e8['use'](_0x95f6('0xed'),require(_0x95f6('0xee')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xef'),require(_0x95f6('0xf0')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xf1'),require('./api/whatsappMessage'));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xf2'),require(_0x95f6('0xf3')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xf4'),require(_0x95f6('0xf5')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xf6'),require('./api/whatsappQueue'));_0x55e4e8[_0x95f6('0x8')]('/api/cloudProviders',require(_0x95f6('0xf7')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xf8'),require('./api/authLocal'));_0x55e4e8['use'](_0x95f6('0xf9'),require('./api/authGoogle'));_0x55e4e8[_0x95f6('0x8')]('/api/jira',require(_0x95f6('0xfa')));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0xfb'),require(_0x95f6('0xfc')));_0x55e4e8['use'](_0x95f6('0xfd'),require(_0x95f6('0xfe')));_0x55e4e8['use'](_0x95f6('0xff'),require(_0x95f6('0x100')));_0x55e4e8['use']('/api/pm2',require(_0x95f6('0x101')));_0x55e4e8[_0x95f6('0x8')]('/api/webbar',require(_0x95f6('0x102')));_0x55e4e8['use'](_0x95f6('0x103'),express[_0x95f6('0x104')](path[_0x95f6('0x105')](config['root'],_0x95f6('0x103'))));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x106'),express[_0x95f6('0x104')](path[_0x95f6('0x105')](config[_0x95f6('0x107')],_0x95f6('0x106'))));_0x55e4e8[_0x95f6('0x8')](_0x95f6('0x108'),express[_0x95f6('0x104')](path[_0x95f6('0x105')](config[_0x95f6('0x107')],_0x95f6('0x108'))));_0x55e4e8['use'](_0x95f6('0x109'),express[_0x95f6('0x104')](path['join'](config[_0x95f6('0x107')],_0x95f6('0x10a'),_0x95f6('0x10b'))));_0x55e4e8[_0x95f6('0x8')]('/plugins',express['static'](path['join'](config[_0x95f6('0x107')],'/server/files/plugins')));_0x55e4e8[_0x95f6('0x10c')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x95f6('0x10d')](errors[0x194]);_0x55e4e8[_0x95f6('0x10c')]('/*')[_0x95f6('0x10d')](function(_0x1bc6a8,_0x26b3b6){_0x26b3b6[_0x95f6('0x10e')](path[_0x95f6('0x10f')](_0x55e4e8[_0x95f6('0x10d')](_0x95f6('0x110'))+_0x95f6('0x111')));});}; \ No newline at end of file +var _0xdfe9=['static','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','url','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','/api/pauses','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','join','root','/www'];(function(_0x59b587,_0xc78a99){var _0x3f9854=function(_0x41142b){while(--_0x41142b){_0x59b587['push'](_0x59b587['shift']());}};_0x3f9854(++_0xc78a99);}(_0xdfe9,0x127));var _0x9dfe=function(_0x24eae9,_0x1860d6){_0x24eae9=_0x24eae9-0x0;var _0x1e39b5=_0xdfe9[_0x24eae9];return _0x1e39b5;};'use strict';var path=require(_0x9dfe('0x0'));var express=require(_0x9dfe('0x1'));var ewinston=require(_0x9dfe('0x2'));var util=require(_0x9dfe('0x3'));var errors=require(_0x9dfe('0x4'));var config=require(_0x9dfe('0x5'));var logger=require(_0x9dfe('0x6'))(_0x9dfe('0x7'));var authLogger=require(_0x9dfe('0x6'))(_0x9dfe('0x8'));exports[_0x9dfe('0x9')]=function(_0x35c28f){_0x35c28f[_0x9dfe('0xa')](ewinston[_0x9dfe('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x64bf8,_0x6721ea){return util[_0x9dfe('0xc')](_0x9dfe('0xd'),_0x64bf8[_0x9dfe('0xe')],_0x64bf8[_0x9dfe('0xf')][_0x9dfe('0x10')]?_0x64bf8['headers'][_0x9dfe('0x10')]:_0x64bf8[_0x9dfe('0x11')][_0x9dfe('0x12')]||_0x64bf8['ip'],_0x64bf8['url'],_0x6721ea[_0x9dfe('0x13')],_0x6721ea[_0x9dfe('0x14')],_0x64bf8['user']?_0x64bf8[_0x9dfe('0x15')]['id']:null,_0x64bf8[_0x9dfe('0x15')]?_0x64bf8['user'][_0x9dfe('0x16')]:null,_0x64bf8[_0x9dfe('0x15')]?_0x64bf8[_0x9dfe('0x15')]['role']:null);}}));_0x35c28f[_0x9dfe('0xa')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x56837f,_0x17a8da){var _0x1fa525='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x56837f[_0x9dfe('0x17')]&&_0x56837f['body'][_0x9dfe('0x18')]&&_0x56837f['body'][_0x9dfe('0x19')]){_0x1fa525=_0x9dfe('0x1a');}return util[_0x9dfe('0xc')](_0x1fa525,_0x56837f[_0x9dfe('0xe')],_0x56837f['headers'][_0x9dfe('0x10')]?_0x56837f[_0x9dfe('0xf')]['x-forwarded-for']:_0x56837f['connection']['remoteAddress']||_0x56837f['ip'],_0x56837f['url'],_0x17a8da[_0x9dfe('0x13')],_0x17a8da[_0x9dfe('0x14')],_0x56837f[_0x9dfe('0x15')]?_0x56837f['user']['id']:null,_0x56837f[_0x9dfe('0x15')]?_0x56837f[_0x9dfe('0x15')][_0x9dfe('0x16')]:null,_0x56837f[_0x9dfe('0x15')]?_0x56837f['user']['role']:null,_0x56837f[_0x9dfe('0x17')]&&_0x56837f['body'][_0x9dfe('0x18')]?_0x56837f[_0x9dfe('0x17')][_0x9dfe('0x18')]:_0x9dfe('0x1b'),_0x56837f[_0x9dfe('0x17')]&&_0x56837f[_0x9dfe('0x17')]['agent_id']?_0x56837f['body'][_0x9dfe('0x19')]:'',_0x56837f[_0x9dfe('0x17')]&&_0x56837f[_0x9dfe('0x17')][_0x9dfe('0x1c')]?_0x56837f['body']['agent_name']:'');},'ignoreRoute':function(_0x38261d){var _0x2669e7=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2669e7['test'](_0x38261d[_0x9dfe('0x1d')]);}}));_0x35c28f['use'](_0x9dfe('0x1e'),require(_0x9dfe('0x1f')));_0x35c28f['use'](_0x9dfe('0x20'),require(_0x9dfe('0x21')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x22'),require(_0x9dfe('0x23')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x24'),require(_0x9dfe('0x25')));_0x35c28f['use'](_0x9dfe('0x26'),require(_0x9dfe('0x27')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x28'),require(_0x9dfe('0x29')));_0x35c28f[_0x9dfe('0xa')]('/api/voice/recordings',require(_0x9dfe('0x2a')));_0x35c28f[_0x9dfe('0xa')]('/api/screen/recordings',require('./api/screenRecording'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x2b'),require(_0x9dfe('0x2c')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x2d'),require(_0x9dfe('0x2e')));_0x35c28f['use'](_0x9dfe('0x2f'),require(_0x9dfe('0x30')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x31'),require('./api/voiceDialReport'));_0x35c28f[_0x9dfe('0xa')]('/api/voice/agents/reports',require(_0x9dfe('0x32')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x33'),require('./api/voiceQueueReport'));_0x35c28f[_0x9dfe('0xa')]('/api/members/reports',require(_0x9dfe('0x34')));_0x35c28f['use'](_0x9dfe('0x35'),require(_0x9dfe('0x36')));_0x35c28f['use'](_0x9dfe('0x37'),require(_0x9dfe('0x38')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x39'),require(_0x9dfe('0x3a')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x3b'),require('./api/mailAccount'));_0x35c28f['use'](_0x9dfe('0x3c'),require(_0x9dfe('0x3d')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x3e'),require(_0x9dfe('0x3f')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x40'),require(_0x9dfe('0x41')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x42'),require(_0x9dfe('0x43')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x44'),require(_0x9dfe('0x45')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x46'),require(_0x9dfe('0x47')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x48'),require(_0x9dfe('0x49')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x4a'),require(_0x9dfe('0x4b')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x4c'),require(_0x9dfe('0x4d')));_0x35c28f[_0x9dfe('0xa')]('/api/fax/applications',require(_0x9dfe('0x4e')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x4f'),require('./api/faxInteraction'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x50'),require(_0x9dfe('0x51')));_0x35c28f['use']('/api/fax/queues',require(_0x9dfe('0x52')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x53'),require('./api/faxQueueReport'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x54'),require(_0x9dfe('0x55')));_0x35c28f[_0x9dfe('0xa')]('/api/sms/applications',require(_0x9dfe('0x56')));_0x35c28f['use'](_0x9dfe('0x57'),require('./api/smsInteraction'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x58'),require(_0x9dfe('0x59')));_0x35c28f[_0x9dfe('0xa')]('/api/sms/queues',require('./api/smsQueue'));_0x35c28f[_0x9dfe('0xa')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x35c28f['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x35c28f['use'](_0x9dfe('0x5a'),require(_0x9dfe('0x5b')));_0x35c28f['use']('/api/openchannel/messages',require(_0x9dfe('0x5c')));_0x35c28f['use'](_0x9dfe('0x5d'),require(_0x9dfe('0x5e')));_0x35c28f[_0x9dfe('0xa')]('/api/chat/websites',require(_0x9dfe('0x5f')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x60'),require('./api/openchannelQueueReport'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x61'),require('./api/chatApplication'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x62'),require('./api/chatInteraction'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x63'),require(_0x9dfe('0x64')));_0x35c28f[_0x9dfe('0xa')]('/api/chat/offline_messages',require(_0x9dfe('0x65')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x66'),require('./api/chatQueue'));_0x35c28f[_0x9dfe('0xa')]('/api/chat/groups',require(_0x9dfe('0x67')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x68'),require(_0x9dfe('0x69')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x6a'),require(_0x9dfe('0x6b')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x6c'),require('./api/cmContact'));_0x35c28f[_0x9dfe('0xa')]('/api/cm/hopper',require(_0x9dfe('0x6d')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x6e'),require('./api/cmHopperBlack'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x6f'),require(_0x9dfe('0x70')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x71'),require('./api/cmHopperHistory'));_0x35c28f['use']('/api/cm/custom_fields',require(_0x9dfe('0x72')));_0x35c28f['use'](_0x9dfe('0x73'),require(_0x9dfe('0x74')));_0x35c28f[_0x9dfe('0xa')]('/api/automations',require(_0x9dfe('0x75')));_0x35c28f['use'](_0x9dfe('0x76'),require(_0x9dfe('0x77')));_0x35c28f['use'](_0x9dfe('0x78'),require('./api/disposition'));_0x35c28f['use'](_0x9dfe('0x79'),require('./api/condition'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x7a'),require(_0x9dfe('0x7b')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x7c'),require('./api/pause'));_0x35c28f[_0x9dfe('0xa')]('/api/cdr',require('./api/cdr'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x7d'),require(_0x9dfe('0x7e')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x7f'),require(_0x9dfe('0x80')));_0x35c28f[_0x9dfe('0xa')]('/api/sounds',require(_0x9dfe('0x81')));_0x35c28f[_0x9dfe('0xa')]('/api/tags',require('./api/tag'));_0x35c28f['use'](_0x9dfe('0x82'),require(_0x9dfe('0x83')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x84'),require(_0x9dfe('0x85')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x86'),require(_0x9dfe('0x87')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x88'),require(_0x9dfe('0x89')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x8a'),require('./api/integrationReport'));_0x35c28f['use'](_0x9dfe('0x8b'),require(_0x9dfe('0x8c')));_0x35c28f[_0x9dfe('0xa')]('/api/analytics/default_reports',require(_0x9dfe('0x8d')));_0x35c28f['use'](_0x9dfe('0x8e'),require(_0x9dfe('0x8f')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x90'),require(_0x9dfe('0x91')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x92'),require(_0x9dfe('0x93')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x94'),require(_0x9dfe('0x95')));_0x35c28f['use'](_0x9dfe('0x96'),require(_0x9dfe('0x97')));_0x35c28f['use'](_0x9dfe('0x98'),require(_0x9dfe('0x99')));_0x35c28f['use'](_0x9dfe('0x9a'),require('./api/intSalesforceField'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x9b'),require('./api/intSugarcrmAccount'));_0x35c28f['use'](_0x9dfe('0x9c'),require(_0x9dfe('0x9d')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x9e'),require('./api/intSugarcrmField'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x9f'),require(_0x9dfe('0xa0')));_0x35c28f['use'](_0x9dfe('0xa1'),require(_0x9dfe('0xa2')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xa3'),require(_0x9dfe('0xa4')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xa5'),require(_0x9dfe('0xa6')));_0x35c28f['use'](_0x9dfe('0xa7'),require(_0x9dfe('0xa8')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xa9'),require(_0x9dfe('0xaa')));_0x35c28f['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x35c28f['use'](_0x9dfe('0xab'),require(_0x9dfe('0xac')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xad'),require(_0x9dfe('0xae')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xaf'),require(_0x9dfe('0xb0')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xb1'),require(_0x9dfe('0xb2')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xb3'),require(_0x9dfe('0xb4')));_0x35c28f['use'](_0x9dfe('0xb5'),require('./api/intVtigerAccount'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xb6'),require(_0x9dfe('0xb7')));_0x35c28f['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x35c28f[_0x9dfe('0xa')]('/api/integrations/servicenow/accounts',require(_0x9dfe('0xb8')));_0x35c28f[_0x9dfe('0xa')]('/api/integrations/servicenow/configurations',require(_0x9dfe('0xb9')));_0x35c28f['use'](_0x9dfe('0xba'),require(_0x9dfe('0xbb')));_0x35c28f[_0x9dfe('0xa')]('/api/integrations/dynamics365/accounts',require(_0x9dfe('0xbc')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xbd'),require('./api/intDynamics365Configuration'));_0x35c28f[_0x9dfe('0xa')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x35c28f['use'](_0x9dfe('0xbe'),require('./api/intFreshsalesAccount'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xbf'),require(_0x9dfe('0xc0')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xc1'),require('./api/intFreshsalesField'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xc2'),require(_0x9dfe('0xc3')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xc4'),require('./api/chatQueueReport'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xc5'),require(_0x9dfe('0xc6')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xc7'),require(_0x9dfe('0xc8')));_0x35c28f[_0x9dfe('0xa')]('/api/jscripty/questions/reports',require(_0x9dfe('0xc9')));_0x35c28f[_0x9dfe('0xa')]('/api/jscripty/sessions/reports',require(_0x9dfe('0xca')));_0x35c28f[_0x9dfe('0xa')]('/api/sms/reports/queue',require(_0x9dfe('0xcb')));_0x35c28f['use'](_0x9dfe('0xcc'),require(_0x9dfe('0xcd')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xce'),require(_0x9dfe('0xcf')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xd0'),require('./api/jscriptyProject'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xd1'),require('./api/setting'));_0x35c28f['use'](_0x9dfe('0xd2'),require(_0x9dfe('0xd3')));_0x35c28f['use'](_0x9dfe('0xd4'),require(_0x9dfe('0xd5')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xd6'),require(_0x9dfe('0xd7')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xd8'),require(_0x9dfe('0xd9')));_0x35c28f['use'](_0x9dfe('0xda'),require(_0x9dfe('0xdb')));_0x35c28f[_0x9dfe('0xa')]('/api/license',require('./api/license'));_0x35c28f[_0x9dfe('0xa')]('/api/campaigns',require(_0x9dfe('0xdc')));_0x35c28f[_0x9dfe('0xa')]('/api/migrations',require(_0x9dfe('0xdd')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xde'),require(_0x9dfe('0xdf')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xe0'),require('./api/plugin'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xe1'),require('./api/mailTransferReport'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xe2'),require(_0x9dfe('0xe3')));_0x35c28f[_0x9dfe('0xa')]('/api/fax/reports/transfer',require(_0x9dfe('0xe4')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xe5'),require(_0x9dfe('0xe6')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xe7'),require(_0x9dfe('0xe8')));_0x35c28f[_0x9dfe('0xa')]('/api/cm/lists',require('./api/cmList'));_0x35c28f['use'](_0x9dfe('0xe9'),require(_0x9dfe('0xea')));_0x35c28f[_0x9dfe('0xa')]('/api/userProfiles',require(_0x9dfe('0xeb')));_0x35c28f[_0x9dfe('0xa')]('/api/userProfile/sections',require(_0x9dfe('0xec')));_0x35c28f['use'](_0x9dfe('0xed'),require(_0x9dfe('0xee')));_0x35c28f[_0x9dfe('0xa')]('/api/notifications',require(_0x9dfe('0xef')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xf0'),require(_0x9dfe('0xf1')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xf2'),require(_0x9dfe('0xf3')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xf4'),require('./api/whatsappInteraction'));_0x35c28f['use'](_0x9dfe('0xf5'),require('./api/whatsappMessage'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xf6'),require(_0x9dfe('0xf7')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xf8'),require(_0x9dfe('0xf9')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xfa'),require(_0x9dfe('0xfb')));_0x35c28f['use'](_0x9dfe('0xfc'),require(_0x9dfe('0xfd')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0xfe'),require(_0x9dfe('0xff')));_0x35c28f[_0x9dfe('0xa')]('/api/auth/google',require(_0x9dfe('0x100')));_0x35c28f['use'](_0x9dfe('0x101'),require(_0x9dfe('0x102')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x103'),require(_0x9dfe('0x104')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x105'),require(_0x9dfe('0x106')));_0x35c28f['use'](_0x9dfe('0x107'),require(_0x9dfe('0x108')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x109'),require('./api/pm2'));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x10a'),require(_0x9dfe('0x10b')));_0x35c28f[_0x9dfe('0xa')]('/apidoc',express['static'](path[_0x9dfe('0x10c')](config[_0x9dfe('0x10d')],'/apidoc')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x10e'),express[_0x9dfe('0x10f')](path[_0x9dfe('0x10c')](config[_0x9dfe('0x10d')],'/www')));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x110'),express['static'](path[_0x9dfe('0x10c')](config[_0x9dfe('0x10d')],_0x9dfe('0x110'))));_0x35c28f['use'](_0x9dfe('0x111'),express[_0x9dfe('0x10f')](path[_0x9dfe('0x10c')](config[_0x9dfe('0x10d')],_0x9dfe('0x112'),_0x9dfe('0x113'))));_0x35c28f[_0x9dfe('0xa')](_0x9dfe('0x114'),express[_0x9dfe('0x10f')](path[_0x9dfe('0x10c')](config[_0x9dfe('0x10d')],_0x9dfe('0x115'))));_0x35c28f[_0x9dfe('0x116')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x9dfe('0x117')](errors[0x194]);_0x35c28f['route']('/*')['get'](function(_0x529afd,_0x38b089){_0x38b089['sendFile'](path[_0x9dfe('0x118')](_0x35c28f['get'](_0x9dfe('0x119'))+_0x9dfe('0x11a')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index e050d5a..09a33b7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5f8=['../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.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/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.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/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','rpc','port','error','log','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc'];(function(_0x57e881,_0x441cc7){var _0x2b4146=function(_0x45b834){while(--_0x45b834){_0x57e881['push'](_0x57e881['shift']());}};_0x2b4146(++_0x441cc7);}(_0xc5f8,0x185));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x8c5f('0x0'));var BPromise=require(_0x8c5f('0x1'));var _=require(_0x8c5f('0x2'));var config=require(_0x8c5f('0x3'));exports['listen']=function(){return new BPromise(function(_0x29e072,_0x50117c){var _0x5972f9={};_0x5972f9=_['merge'](_0x5972f9,require('../api/user/user.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x5')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/voiceQueue/voiceQueue.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/voiceRecording/voiceRecording.rpc'));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x6')));_0x5972f9=_['merge'](_0x5972f9,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x7')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x8')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x9')));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0xa')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0xb')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0xc')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0xd')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0xe')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0xf')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x10')));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x11')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x12')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x13')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/faxApplication/faxApplication.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x14')));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x15')));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x16')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x17')));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x18')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/smsMessage/smsMessage.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x19')));_0x5972f9=_['merge'](_0x5972f9,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x1a')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x1b')));_0x5972f9=_['merge'](_0x5972f9,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x1c')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x1d')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x1e')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x1f')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/cmContact/cmContact.rpc'));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x20')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x21')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x22')));_0x5972f9=_['merge'](_0x5972f9,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x23')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x24')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x25')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x26')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x27')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/trigger/trigger.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x28')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x29')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x2a')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x2b')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x2c')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x2d')));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x2e')));_0x5972f9=_['merge'](_0x5972f9,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x2f')));_0x5972f9=_['merge'](_0x5972f9,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x30')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x31')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x32')));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x33')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x34')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x35')));_0x5972f9=_['merge'](_0x5972f9,require(_0x8c5f('0x36')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require('../api/campaign/campaign.rpc'));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x37')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x38')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x39')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x3a')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x3b')));_0x5972f9=_[_0x8c5f('0x4')](_0x5972f9,require(_0x8c5f('0x3c')));_0x5972f9=_['merge'](_0x5972f9,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x360bff=jayson['server'](_0x5972f9)['http']();var _0x5a526b=config[_0x8c5f('0x3d')][_0x8c5f('0x3e')]||config['port']+0x1;var _0x133b4c=config[_0x8c5f('0x3d')]['ip']||'localhost';_0x360bff['on'](_0x8c5f('0x3f'),function(_0x344463){return _0x50117c(_0x344463);});_0x360bff['listen'](_0x5a526b,_0x133b4c,function(){console[_0x8c5f('0x40')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x133b4c,_0x5a526b);require(_0x8c5f('0x41'))['default']();return _0x29e072(_0x8c5f('0x42')+_0x133b4c+':'+_0x5a526b);});});}; \ No newline at end of file +var _0x0fda=['../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','bluebird','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x5d3006,_0x59ec69){var _0x1d62f5=function(_0x52e267){while(--_0x52e267){_0x5d3006['push'](_0x5d3006['shift']());}};_0x1d62f5(++_0x59ec69);}(_0x0fda,0x8c));var _0xa0fd=function(_0x4deddc,_0x5b3dd0){_0x4deddc=_0x4deddc-0x0;var _0x1cfc05=_0x0fda[_0x4deddc];return _0x1cfc05;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa0fd('0x0'));var _=require(_0xa0fd('0x1'));var config=require(_0xa0fd('0x2'));exports[_0xa0fd('0x3')]=function(){return new BPromise(function(_0x395499,_0x30d3e4){var _0x216986={};_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/user/user.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x5')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x6')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x7')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x8')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x9')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0xa')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0xb')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0xc')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0xd')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0xe')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0xf')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/mailQueue/mailQueue.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x10')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/mailMessage/mailMessage.rpc'));_0x216986=_['merge'](_0x216986,require('../api/mailApplication/mailApplication.rpc'));_0x216986=_['merge'](_0x216986,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/faxAccount/faxAccount.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x11')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x12')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x13')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x14')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/smsAccount/smsAccount.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x15')));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x16')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/smsQueue/smsQueue.rpc'));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x17')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x18')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x19')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x1a')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x1b')));_0x216986=_['merge'](_0x216986,require('../api/chatMessage/chatMessage.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/chatQueue/chatQueue.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/cmContact/cmContact.rpc'));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x1c')));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x1d')));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x1e')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x1f')));_0x216986=_['merge'](_0x216986,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x20')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x21')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/sound/sound.rpc'));_0x216986=_['merge'](_0x216986,require('../api/template/template.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x22')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x23')));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x24')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x25')));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x26')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x27')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x28')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x29')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x2a')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x2b')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x2c')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x2d')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/squareReport/squareReport.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x2e')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x2f')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/squareProject/squareProject.rpc'));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x30')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/squareMessage/squareMessage.rpc'));_0x216986=_['merge'](_0x216986,require('../api/campaign/campaign.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/attachment/attachment.rpc'));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x31')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x216986=_['merge'](_0x216986,require(_0xa0fd('0x32')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x33')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x34')));_0x216986=_[_0xa0fd('0x4')](_0x216986,require(_0xa0fd('0x35')));var _0x271518=jayson[_0xa0fd('0x36')](_0x216986)['http']();var _0x4094d5=config[_0xa0fd('0x37')][_0xa0fd('0x38')]||config[_0xa0fd('0x38')]+0x1;var _0x272ad9=config[_0xa0fd('0x37')]['ip']||_0xa0fd('0x39');_0x271518['on']('error',function(_0x21e133){return _0x30d3e4(_0x21e133);});_0x271518[_0xa0fd('0x3')](_0x4094d5,_0x272ad9,function(){console[_0xa0fd('0x3a')](_0xa0fd('0x3b'),_0x272ad9,_0x4094d5);require(_0xa0fd('0x3c'))[_0xa0fd('0x3d')]();return _0x395499('RPC\x20listening\x20on\x20'+_0x272ad9+':'+_0x4094d5);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index d41e157..3778c22 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x50ceab,_0x448649){var _0x140778=function(_0x199e65){while(--_0x199e65){_0x50ceab['push'](_0x50ceab['shift']());}};_0x140778(++_0x448649);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file +var _0xa9e0=['utf8','setTimeout','setEncoding','ready','line','toLowerCase','hangup','emit','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','sendRequest','command','sync','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call'];(function(_0x152543,_0x3489e1){var _0x4cc314=function(_0x3a111b){while(--_0x3a111b){_0x152543['push'](_0x152543['shift']());}};_0x4cc314(++_0x3489e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x0a9e('0x3'));function AGIChannel(_0x4ce2f1){var _0x333808=this,_0x432180=new AGIReply(),_0x2ab90b=![],_0x991246={};EventEmitter[_0x0a9e('0x4')](_0x333808);_0x4ce2f1['setEncoding'](_0x0a9e('0x5'));_0x4ce2f1[_0x0a9e('0x6')](0x8*0x3c*0x3c*0x3e8);_0x432180[_0x0a9e('0x7')]('utf8');_0x432180['on']('headers',function(_0xe42b77){for(var _0x56465b in _0xe42b77){_0x333808[_0x56465b]=_0xe42b77[_0x56465b];}_0x333808['emit'](_0x0a9e('0x8'));});_0x432180['on'](_0x0a9e('0x9'),function(_0x307b3e){if(_0x307b3e[_0x0a9e('0xa')]()==_0x0a9e('0xb')){_0x333808[_0x0a9e('0xc')]('hangup');return;}if(_0x307b3e['substring'](0x0,0xb)=='520-Invalid'){_0x2ab90b=!![];}if(_0x2ab90b){_0x991246['rx']+=_0x307b3e+'\x0a';if(_0x307b3e['search'](_0x0a9e('0xd'))!=-0x1){_0x2ab90b=![];}}else{_0x991246['rx']=_0x307b3e;}if(_0x2ab90b){return;}if(typeof _0x991246['cb']==_0x0a9e('0xe')){var _0xd5b662=_0x991246['rx'][_0x0a9e('0xf')](0x0,0x3),_0x26d672=null,_0x32d742=null;_0xd5b662=parseInt(_0xd5b662);if(isNaN(_0xd5b662)){_0x991246['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xd5b662!=0xc8){_0x991246['cb'](null,{'code':_0xd5b662,'result':-0x1,'extra':'KO'});return;}_0x26d672=_0x991246['rx'][_0x0a9e('0xf')](0x4)[_0x0a9e('0x10')](_0x0a9e('0x11'),'');if(_0x26d672[_0x0a9e('0x12')]('\x20')!=-0x1){_0x26d672=_0x26d672[_0x0a9e('0x13')](0x0,_0x26d672[_0x0a9e('0x12')]('\x20'));}if(_['startsWith'](_0x26d672,'-1')){_0x26d672=parseInt(_0x26d672);}_0x32d742=_0x991246['rx'][_0x0a9e('0x14')]('\x20');if(_0x32d742['length']==0x3){_0x32d742=_0x32d742[0x2][_0x0a9e('0xf')](0x1,_0x32d742[0x2]['length']-0x1);}else if(_0x32d742[_0x0a9e('0x15')]>0x3){var _0x12066b=/\((.+)\)/;var _0x48f32d=_0x991246['rx'][_0x0a9e('0x16')](_0x12066b);if(_0x48f32d){_0x32d742=_0x48f32d[0x1];}else{_0x32d742=null;}}else{_0x32d742=null;}_0x991246['cb'](null,{'code':_0xd5b662,'result':_0x26d672,'extra':_0x32d742});}});_0x4ce2f1['on']('error',function(_0x459eb1){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x17'),new AGIError(_0x0a9e('0x18'),_0x459eb1[_0x0a9e('0x19')]));});_0x4ce2f1['on'](_0x0a9e('0x1a'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1a'),new AGIError(_0x0a9e('0x1b')));});_0x4ce2f1['on'](_0x0a9e('0x1c'),function(){_0x333808[_0x0a9e('0xc')](_0x0a9e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4ce2f1[_0x0a9e('0x1d')]();});_0x4ce2f1[_0x0a9e('0x1e')](_0x432180);this['command']=function(_0x20f109,_0x5a09ef){var _0x20f109=_0x20f109||'',_0x5a09ef=typeof _0x5a09ef==_0x0a9e('0xe')?_0x5a09ef:new Function();_0x991246={'tx':_0x20f109,'rx':'','cb':_0x5a09ef};_0x4ce2f1[_0x0a9e('0x1f')](_0x20f109+'\x0a');},this[_0x0a9e('0x1a')]=function(){_0x4ce2f1['destroy']();};}util[_0x0a9e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x22')]=function(_0x4d00e6){return this[_0x0a9e('0x23')][_0x0a9e('0x24')](this,_0x4d00e6);};AGIChannel[_0x0a9e('0x21')]['answer']=function(){return this['sendRequest'](_0x0a9e('0x25'));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x26')]=function(_0x33161b,_0x526cf3,_0x384319){_0x33161b=_0x33161b===undefined?'beep':_0x33161b;_0x526cf3=_0x526cf3===undefined?'5':_0x526cf3;_0x384319=_0x384319===undefined?'1':_0x384319;return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x27'),_0x33161b,_0x526cf3*0x3e8,_0x384319));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x28')]=function(_0x14433c){_0x14433c=_0x14433c||_0x0a9e('0x29');return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2b'),_0x14433c));};AGIChannel['prototype'][_0x0a9e('0x2c')]=function(_0x468813,_0x2b1f27){if(_[_0x0a9e('0x2d')](_0x2b1f27)){return this['sendRequest'](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27[_0x0a9e('0x2f')](',')));}return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x2e'),_0x468813,_0x2b1f27));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x30')]=function(_0x1dbde2){return this['sendRequest'](util[_0x0a9e('0x2a')]('SET\x20CONTEXT\x20%s',_0x1dbde2));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x31')]=function(_0x1122db){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20EXTENSION\x20%s',_0x1122db));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x32')]=function(_0x40cb85){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x33'),_0x40cb85));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0xb')]=function(){return this['sendRequest'](_0x0a9e('0x34'));};AGIChannel['prototype'][_0x0a9e('0x35')]=function(_0x14b13f,_0x2b7e7f){var _0x3f3d41=_['isBoolean'](_0x2b7e7f)||_[_0x0a9e('0x36')](_0x2b7e7f)?_0x2b7e7f[_0x0a9e('0x37')]():_0x2b7e7f;return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x14b13f,_0x3f3d41?_0x3f3d41['toString']()[_0x0a9e('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){return this[_0x0a9e('0x22')](util['format'](_0x0a9e('0x39'),_0x3d9717,_0x381c37));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3a')]=function(_0x533942,_0x1dbf74){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x533942,_0x1dbf74));};AGIChannel['prototype'][_0x0a9e('0x3b')]=function(_0x40d766,_0x5adda1){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3c'),_0x40d766,_0x5adda1));};AGIChannel[_0x0a9e('0x21')]['continueAt']=function(_0x5a594b,_0x15e37d,_0x45b3d0){_0x15e37d=_0x15e37d||this['extension'];_0x45b3d0=_0x45b3d0||0x1;this[_0x0a9e('0x30')](_0x5a594b);this[_0x0a9e('0x31')](_0x15e37d);this[_0x0a9e('0x32')](_0x45b3d0);return this['noop'](util[_0x0a9e('0x2a')](_0x0a9e('0x3d'),_0x5a594b,_0x15e37d,_0x45b3d0));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x3e')]=function(_0x13cb1f){return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x3f'),_0x13cb1f));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x40')]=function(_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x37f6cc,_0x4d04c8){_0x148007=_0x148007||'wav';_0x1a7bce=_0x1a7bce||'';_0x11ca30=_0x11ca30===undefined?-0x1:_0x11ca30==='-1'?-0x1:_0x11ca30*0x3e8;_0x37f6cc=_0x37f6cc===undefined?'':'s='+_0x37f6cc;_0x4d04c8=_0x4d04c8?_0x0a9e('0x41'):'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x42'),_0x2c3711,_0x148007,_0x1a7bce,_0x11ca30,_0x4d04c8,_0x37f6cc));};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x43')]=function(_0x10b040,_0x445e25){_0x445e25=_0x445e25||'';return this[_0x0a9e('0x22')](util[_0x0a9e('0x2a')](_0x0a9e('0x44'),_0x10b040,_0x445e25));};AGIChannel[_0x0a9e('0x21')]['agi']=function(_0x117c99){return this[_0x0a9e('0x2c')](_0x0a9e('0x45'),_0x117c99);};AGIChannel[_0x0a9e('0x21')][_0x0a9e('0x46')]=function(_0xbe9d19){return this[_0x0a9e('0x2c')](_0x0a9e('0x47'),_0xbe9d19);};AGIChannel['prototype'][_0x0a9e('0x17')]=function(_0x48fd45,_0x473dc8){this[_0x0a9e('0x28')](util[_0x0a9e('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x48fd45['id'],_0x48fd45[_0x0a9e('0x48')],_0x473dc8));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x0a9e('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 048e50a..bf2fbba 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 _0xd7f0=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x5530ea,_0x2488e3){var _0x4a230b=function(_0x4ca128){while(--_0x4ca128){_0x5530ea['push'](_0x5530ea['shift']());}};_0x4a230b(++_0x2488e3);}(_0xd7f0,0x145));var _0x0d7f=function(_0x4ce7ea,_0x387da8){_0x4ce7ea=_0x4ce7ea-0x0;var _0x2c92df=_0xd7f0[_0x4ce7ea];return _0x2c92df;};'use strict';var util=require(_0x0d7f('0x0'));var error={'E_AGI_UNDEFINED':_0x0d7f('0x1'),'E_AGI_ARGUMENT_PORT':_0x0d7f('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x0d7f('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x0d7f('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x0d7f('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x0d7f('0x6'),'E_AGI_COMMAND_EMPTY':_0x0d7f('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0d7f('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x593b24){var _0x593b24=_0x593b24||null,_0x1a20e9=_0x1a20e9||[],_0x3f7972=0x1,_0x17d812='';if(!error[_0x593b24]){_0x593b24=_0x0d7f('0x9');}_0x1a20e9['push'](error[_0x593b24]);while(arguments[_0x3f7972]){_0x1a20e9[_0x0d7f('0xa')](arguments[_0x3f7972]);_0x3f7972++;}_0x17d812=util[_0x0d7f('0xb')][_0x0d7f('0xc')](util,_0x1a20e9);this[_0x0d7f('0xd')]=_0x17d812;this['name']=_0x593b24;}module[_0x0d7f('0xe')]=AGIError; \ No newline at end of file +var _0x58e9=['Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x48abe1,_0x143985){var _0x184b2d=function(_0x2286bb){while(--_0x2286bb){_0x48abe1['push'](_0x48abe1['shift']());}};_0x184b2d(++_0x143985);}(_0x58e9,0x15e));var _0x958e=function(_0x3a93c4,_0x2bc0a8){_0x3a93c4=_0x3a93c4-0x0;var _0x2738ed=_0x58e9[_0x3a93c4];return _0x2738ed;};'use strict';var util=require(_0x958e('0x0'));var error={'E_AGI_UNDEFINED':_0x958e('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x958e('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x958e('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x958e('0x4'),'E_AGI_SOCKET_ERROR':_0x958e('0x5'),'E_AGI_SOCKET_CLOSE':_0x958e('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x958e('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x958e('0x8'),'E_AGI_IVR_ENTRY':_0x958e('0x9')};function AGIError(_0x12b126){var _0x12b126=_0x12b126||null,_0x404407=_0x404407||[],_0x1d3cf5=0x1,_0x80e1a7='';if(!error[_0x12b126]){_0x12b126=_0x958e('0xa');}_0x404407[_0x958e('0xb')](error[_0x12b126]);while(arguments[_0x1d3cf5]){_0x404407[_0x958e('0xb')](arguments[_0x1d3cf5]);_0x1d3cf5++;}_0x80e1a7=util[_0x958e('0xc')][_0x958e('0xd')](util,_0x404407);this[_0x958e('0xe')]=_0x80e1a7;this[_0x958e('0xf')]=_0x12b126;}module[_0x958e('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 4fcb664..3f4cc47 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 _0x0833=['numberOfEdges','addVertex','vertices','prototype','addEdge','edges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits'];(function(_0x48e636,_0x4df178){var _0x22398b=function(_0x1744e7){while(--_0x1744e7){_0x48e636['push'](_0x48e636['shift']());}};_0x22398b(++_0x4df178);}(_0x0833,0x1bd));var _0x3083=function(_0x551325,_0x5c4bd3){_0x551325=_0x551325-0x0;var _0x35ab66=_0x0833[_0x551325];return _0x35ab66;};'use strict';var _=require(_0x3083('0x0'));var logger=require(_0x3083('0x1'))(_0x3083('0x2'));var verticesWithRetry=[_0x3083('0x3'),_0x3083('0x4'),'getsecretdigits'];var Graph=function(){this['vertices']={};this['edges']={};this[_0x3083('0x5')]=0x0;};Graph['prototype'][_0x3083('0x6')]=function(_0x1d8d6e){this[_0x3083('0x7')][_0x1d8d6e['id']]=_0x1d8d6e;this['edges'][_0x1d8d6e['id']]=[];};Graph[_0x3083('0x8')][_0x3083('0x9')]=function(_0x529df1,_0x5591b0,_0x4f51da){this[_0x3083('0xa')][_0x529df1]['push']({'target':_0x5591b0,'condition':_0x4f51da});this['numberOfEdges']+=0x1;};Graph[_0x3083('0x8')][_0x3083('0xb')]=function(){return _[_0x3083('0xb')](this[_0x3083('0x7')]);};Graph[_0x3083('0x8')][_0x3083('0xc')]=function(){return this[_0x3083('0x5')];};Graph[_0x3083('0x8')][_0x3083('0xd')]=function(_0xb16222){return this[_0x3083('0x7')][_0xb16222];};Graph[_0x3083('0x8')][_0x3083('0xe')]=function(_0x2dc6ab,_0x1b33f3){if(!this['vertices'][_0x2dc6ab]){return logger[_0x3083('0xf')](_0x3083('0x10'));}var _0x5f39e3=_0x1b33f3(this[_0x3083('0x7')][_0x2dc6ab]);if(!_0x5f39e3){return logger[_0x3083('0xf')]('stop\x20traverse');}if(this[_0x3083('0xa')][_0x2dc6ab][_0x3083('0x11')]===0x0){return logger[_0x3083('0xf')](_0x3083('0x12'));}for(var _0x3f1f08=0x0,_0x1de928=[],_0xecb368=![];_0x3f1f08\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','agicommand','hasOwnProperty','retry','mxCell','isArray','length','target','addEdge','source','value','getSquareProject','createSquareReport','then','catch','indexOf','agi_','inspect','debug','variables','stringify','timeout','evtHangup','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20published','continueAt'];(function(_0x1f90ee,_0x1e2df9){var _0x49ef50=function(_0x729b70){while(--_0x729b70){_0x1f90ee['push'](_0x1f90ee['shift']());}};_0x49ef50(++_0x1e2df9);}(_0xa630,0xbe));var _0x0a63=function(_0x47811d,_0xadf716){_0x47811d=_0x47811d-0x0;var _0x1ba6cc=_0xa630[_0x47811d];return _0x1ba6cc;};'use strict';var parser=require(_0x0a63('0x0'));var _=require(_0x0a63('0x1'));var syncho=require('syncho');var util=require('util');var moment=require(_0x0a63('0x2'));var config=require('../../config/environment');var logger=require(_0x0a63('0x3'))('agi');var utilLicense=require(_0x0a63('0x4'));var rpc=require(_0x0a63('0x5'));var mailRpc=require(_0x0a63('0x6'));var Graph=require(_0x0a63('0x7'));var Vertices=require(_0x0a63('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x0a63('0x9')](config[_0x0a63('0xa')],{'ip':_0x0a63('0xb'),'port':0x11dd});function connectionHandler(_0x41d21d){process[_0x0a63('0xc')](function(){syncho(function(){try{setChannelVariables(_0x41d21d);agiHandler(_0x41d21d);}catch(_0x2a1bd7){logger['error'](_0x2a1bd7[_0x0a63('0xd')]);}});});}function listeningHandler(){console[_0x0a63('0xe')](_0x0a63('0xf'),config[_0x0a63('0xa')][_0x0a63('0x10')]);logger[_0x0a63('0x11')](util[_0x0a63('0x12')](_0x0a63('0x13'),config[_0x0a63('0xa')]['ip'],config[_0x0a63('0xa')]['port']));}function errorHandler(_0x345f56){if(_0x345f56&&_0x345f56[_0x0a63('0x14')]&&_0x345f56[_0x0a63('0x15')]){logger[_0x0a63('0x16')](util['format'](_0x0a63('0x17'),_0x345f56['name'],_0x345f56[_0x0a63('0x15')]));}else{logger[_0x0a63('0x16')](util[_0x0a63('0x12')](_0x0a63('0x18'),_0x345f56[_0x0a63('0xd')]));}}function closeHandler(){logger[_0x0a63('0x11')](util[_0x0a63('0x12')](_0x0a63('0x19'),this['arg_1'],this[_0x0a63('0x1a')],this['callerid'],this[_0x0a63('0x1b')],this[_0x0a63('0x1c')]));try{createSquareReport(this);}catch(_0x36a9e8){logger[_0x0a63('0x16')](_0x36a9e8[_0x0a63('0xd')]);}}function timeoutHandler(){logger[_0x0a63('0x11')](util[_0x0a63('0x12')](_0x0a63('0x1d'),this[_0x0a63('0x1e')],this[_0x0a63('0x1a')],this[_0x0a63('0x1f')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x0a63('0x11')](util['format'](_0x0a63('0x20'),this['arg_1'],this[_0x0a63('0x1a')],this[_0x0a63('0x1f')],this[_0x0a63('0x1b')],this[_0x0a63('0x1c')]));this['evtHangup']=!![];}function getRoot(_0x398a16){return parser['toJson'](_0x398a16,{'object':!![]})[_0x0a63('0x21')][_0x0a63('0x22')];}function addVertex(_0x1bf64a,_0x20c114,_0x343273){_0x20c114[_0x0a63('0x23')]=_0x343273;if(_0x20c114[_0x0a63('0x24')](_0x0a63('0x25'))){_0x20c114['maxRetry']=parseInt(_0x20c114['retry'],0xa);}_0x1bf64a['addVertex'](_['omit'](_0x20c114,_0x0a63('0x26')));}function initGraph(_0x4916b1,_0x496c93){var _0x2133cf=new Graph();for(var _0x1d5448 in _0x4916b1){if(_0x4916b1[_0x0a63('0x24')](_0x1d5448)){if(_[_0x0a63('0x27')](_0x4916b1[_0x1d5448])){for(var _0x52e7ef=0x0;_0x52e7ef<_0x4916b1[_0x1d5448][_0x0a63('0x28')];_0x52e7ef+=0x1){addVertex(_0x2133cf,_0x4916b1[_0x1d5448][_0x52e7ef],_0x1d5448);}}else{addVertex(_0x2133cf,_0x4916b1[_0x1d5448],_0x1d5448);}}}for(var _0x498371=0x0;_0x498371<_0x496c93[_0x0a63('0x28')];_0x498371+=0x1){if(_0x496c93[_0x498371]['source']&&_0x496c93[_0x498371][_0x0a63('0x29')]){_0x2133cf[_0x0a63('0x2a')](_0x496c93[_0x498371][_0x0a63('0x2b')],_0x496c93[_0x498371][_0x0a63('0x29')],_0x496c93[_0x498371][_0x0a63('0x2c')]);}}return _0x2133cf;}function getSquareProject(_0x4577b6,_0x23fcf3){rpc[_0x0a63('0x2d')](_0x4577b6)['then'](function(_0x58cc71){_0x23fcf3(null,_0x58cc71);})['catch'](function(_0x151cb6){_0x23fcf3(null,_0x151cb6);});}function createSquareReport(_0xc8caf6,_0x30cebd){rpc[_0x0a63('0x2e')](_0xc8caf6)[_0x0a63('0x2f')](function(_0x53a46b){if(_0x30cebd){_0x30cebd(null,_0x53a46b);}})[_0x0a63('0x30')](function(_0x2884f1){if(_0x30cebd){_0x30cebd(null,_0x2884f1);}});}function setChannelVariables(_0x33a717){for(var _0x46fb40 in _0x33a717){if(_0x33a717['hasOwnProperty'](_0x46fb40)){if(_0x46fb40[_0x0a63('0x31')](_0x0a63('0x32'))===0x0){_0x33a717[_0x46fb40['substring'](0x4)]=_0x33a717[_0x46fb40];delete _0x33a717[_0x46fb40];}}}}function getLogFromObject(_0x4a7145){return util[_0x0a63('0x33')](_0x4a7145,{'showHidden':![],'depth':null});}function agiHandler(_0x51d959){var _0x5708fc,_0x3bd154,_0x3fd128,_0x58201a,_0xfd1e09;logger[_0x0a63('0x34')](_0x0a63('0x35'),JSON[_0x0a63('0x36')](_0x51d959,null,0x2));logger[_0x0a63('0x11')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x51d959[_0x0a63('0x1e')],_0x51d959[_0x0a63('0x1a')],_0x51d959[_0x0a63('0x1f')],_0x51d959[_0x0a63('0x1b')],_0x51d959[_0x0a63('0x1c')]));_0x51d959['on'](_0x0a63('0x16'),errorHandler);_0x51d959['on']('close',closeHandler);_0x51d959['on'](_0x0a63('0x37'),timeoutHandler);_0x51d959[_0x0a63('0x38')]=![];_0x51d959['on']('hangup',hangupHandler);var _0xf9c6ea=getSquareProject['sync'](null,_0x51d959['arg_1']);if(_0xf9c6ea){if(_0xf9c6ea[_0x0a63('0x39')]){_0x5708fc=getRoot(_0xf9c6ea[_0x0a63('0x39')]);if(_0x5708fc&&_0x5708fc[_0x0a63('0x3a')]){logger['debug'](_0x0a63('0x22'),JSON[_0x0a63('0x36')](_0x5708fc,null,0x2));_0x51d959[_0x0a63('0x3b')]=moment()[_0x0a63('0x12')](_0x0a63('0x3c'));_0x3bd154=initGraph(_[_0x0a63('0x3d')](_0x5708fc,_0x0a63('0x26')),_0x5708fc['mxCell']);_0x3fd128=new Vertices(_0x51d959,rpc,mailRpc);logger[_0x0a63('0x11')](util[_0x0a63('0x12')](_0x0a63('0x3e'),_0x51d959['arg_1'],_0x51d959['calleridname'],_0x51d959[_0x0a63('0x1f')],_0x51d959['dnid'],_0x51d959[_0x0a63('0x1c')]));_0x3bd154[_0x0a63('0x3f')](_0x5708fc[_0x0a63('0x3a')]['id'],function(_0x5c7b78){try{_0x5c7b78=_0x3fd128[_0x0a63('0x40')](_0x5c7b78);logger[_0x0a63('0x34')](_0x0a63('0x41'),JSON[_0x0a63('0x36')](_0x5c7b78,null,0x2));if(_0x5c7b78['agicommand']===_0x0a63('0x42')){logger[_0x0a63('0x11')](_0x0a63('0x43'));_0x51d959[_0x0a63('0x44')]=_0x5c7b78[_0x0a63('0x44')]||_0x51d959[_0x0a63('0x44')];_0x51d959['extension']=_0x5c7b78[_0x0a63('0x45')];_0x51d959[_0x0a63('0x46')]=_0x5c7b78[_0x0a63('0x46')]?_0x5c7b78[_0x0a63('0x46')]-0x1:0x1;return null;}else if(_0x5c7b78&&_0x3fd128[_0x5c7b78[_0x0a63('0x23')]]){_0xfd1e09=_0x3fd128[_0x5c7b78[_0x0a63('0x23')]](_0x5c7b78);logger[_0x0a63('0x11')](_0x0a63('0x47'),JSON[_0x0a63('0x36')](_0xfd1e09,null,0x2));if(_0xfd1e09&&_0xfd1e09[_0x0a63('0x48')]===AGI_CODE_SUCCESS&&_0xfd1e09[_0x0a63('0x49')]!==AGI_RESULT_ERROR&&!_0x51d959[_0x0a63('0x38')]){logger[_0x0a63('0x34')](_0x0a63('0x47'),getLogFromObject(_0xfd1e09));return _[_0x0a63('0x4a')](_0xfd1e09[_0x0a63('0x49')])?null:_0xfd1e09[_0x0a63('0x49')][_0x0a63('0x4b')]();}else{logger['error'](_0x0a63('0x47'),getLogFromObject(_0xfd1e09));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0xd9eddc){logger[_0x0a63('0x16')](_0xd9eddc[_0x0a63('0xd')]);return null;}});if(_0x5708fc[_0x0a63('0x4c')]){logger[_0x0a63('0x11')](util[_0x0a63('0x12')](_0x0a63('0x4d'),_0x51d959[_0x0a63('0x1e')],_0x51d959[_0x0a63('0x1a')],_0x51d959[_0x0a63('0x1f')],_0x51d959[_0x0a63('0x1b')],_0x51d959[_0x0a63('0x1c')]));_0x3bd154[_0x0a63('0x3f')](_0x5708fc[_0x0a63('0x4c')]['id'],function(_0x459d1c){try{_0x459d1c=_0x3fd128[_0x0a63('0x40')](_0x459d1c);logger[_0x0a63('0x34')](_0x0a63('0x41'),JSON[_0x0a63('0x36')](_0x459d1c,null,0x2));if(_0x459d1c&&_0x3fd128[_0x459d1c[_0x0a63('0x23')]]){_0xfd1e09=_0x3fd128[_0x459d1c['agicommand']](_0x459d1c);if(_0xfd1e09){logger[_0x0a63('0x34')](_0x0a63('0x47'),getLogFromObject(_0xfd1e09));return _['isUndefined'](_0xfd1e09['result'])?null:_0xfd1e09['result']['toString']();}else{logger[_0x0a63('0x16')](_0x0a63('0x47'),getLogFromObject(_0xfd1e09));return null;}}else{logger['error'](_0x0a63('0x4e'));return null;}}catch(_0x59c367){logger[_0x0a63('0x16')](_0x59c367[_0x0a63('0xd')]);return null;}});}logger['info'](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x51d959[_0x0a63('0x1e')],_0x51d959[_0x0a63('0x1a')],_0x51d959[_0x0a63('0x1f')],_0x51d959[_0x0a63('0x1b')],_0x51d959[_0x0a63('0x1c')]));logger['info'](util[_0x0a63('0x12')](_0x0a63('0x4f'),_0x51d959[_0x0a63('0x44')],_0x51d959[_0x0a63('0x45')],parseInt(_0x51d959[_0x0a63('0x46')],0xa)+0x1));_0x51d959['continueAt'](_0x51d959[_0x0a63('0x44')],_0x51d959[_0x0a63('0x45')],parseInt(_0x51d959[_0x0a63('0x46')],0xa)+0x1);_0x51d959[_0x0a63('0x50')]();}}else{logger['error'](util[_0x0a63('0x12')](_0x0a63('0x51'),_0x51d959[_0x0a63('0x1e')]));_0x51d959[_0x0a63('0x52')](_0x51d959[_0x0a63('0x44')],_0x51d959[_0x0a63('0x45')],parseInt(_0x51d959['priority'],0xa)+0x1);_0x51d959[_0x0a63('0x50')]();}}else{logger[_0x0a63('0x16')](util[_0x0a63('0x12')](_0x0a63('0x53'),_0x51d959['arg_1']));_0x51d959['continueAt'](_0x51d959[_0x0a63('0x44')],_0x51d959[_0x0a63('0x45')],parseInt(_0x51d959[_0x0a63('0x46')],0xa)+0x1);_0x51d959[_0x0a63('0x50')]();}}function main(){var _0x12c3e5;return utilLicense['getLicense']()['then'](function(_0x58b3a8){if(_0x58b3a8){if(_0x58b3a8[_0x0a63('0x54')]){if(_0x58b3a8['callysquare']&&_0x58b3a8[_0x0a63('0x55')]>0x0){logger[_0x0a63('0x11')](util[_0x0a63('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x58b3a8['callysquare']));_0x12c3e5=_0x58b3a8[_0x0a63('0x55')];}else{logger[_0x0a63('0x11')](_0x0a63('0x56'));}}else{logger[_0x0a63('0x11')](_0x0a63('0x57'));_0x12c3e5=-0x1;}}})[_0x0a63('0x30')](function(_0x21502e){logger[_0x0a63('0x16')](_0x0a63('0x58'),_0x21502e[_0x0a63('0xd')]);})[_0x0a63('0x4c')](function(){var _0x345b1d=require(_0x0a63('0x59'))(config[_0x0a63('0xa')]['port'],config['agi']['ip'],_0x12c3e5);_0x345b1d['on'](_0x0a63('0x16'),errorHandler);_0x345b1d['on'](_0x0a63('0x5a'),listeningHandler);_0x345b1d['on']('connection',connectionHandler);_0x345b1d['on'](_0x0a63('0x50'),closeHandler);});}main(); \ No newline at end of file +var _0x06f4=['joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','util','moment','agi','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','name','message','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','mxCell','isArray','length','source','target','addEdge','getSquareProject','then','catch','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','close','timeout','sync','production','start'];(function(_0x5a3f7a,_0x26e0f0){var _0x3b819b=function(_0x32d26){while(--_0x32d26){_0x5a3f7a['push'](_0x5a3f7a['shift']());}};_0x3b819b(++_0x26e0f0);}(_0x06f4,0x136));var _0x406f=function(_0x441918,_0x33a9bc){_0x441918=_0x441918-0x0;var _0xdc902d=_0x06f4[_0x441918];return _0xdc902d;};'use strict';var parser=require(_0x406f('0x0'));var _=require(_0x406f('0x1'));var syncho=require('syncho');var util=require(_0x406f('0x2'));var moment=require(_0x406f('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x406f('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x406f('0x5'));var mailRpc=require(_0x406f('0x6'));var Graph=require(_0x406f('0x7'));var Vertices=require(_0x406f('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x406f('0x9')](config['agi'],{'ip':_0x406f('0xa'),'port':0x11dd});function connectionHandler(_0x1c39ce){process[_0x406f('0xb')](function(){syncho(function(){try{setChannelVariables(_0x1c39ce);agiHandler(_0x1c39ce);}catch(_0x54eb68){logger[_0x406f('0xc')](_0x54eb68['stack']);}});});}function listeningHandler(){console['log'](_0x406f('0xd'),config['agi'][_0x406f('0xe')]);logger['info'](util[_0x406f('0xf')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x406f('0x4')]['ip'],config[_0x406f('0x4')]['port']));}function errorHandler(_0x2f7208){if(_0x2f7208&&_0x2f7208[_0x406f('0x10')]&&_0x2f7208[_0x406f('0x11')]){logger[_0x406f('0xc')](util[_0x406f('0xf')](_0x406f('0x12'),_0x2f7208[_0x406f('0x10')],_0x2f7208[_0x406f('0x11')]));}else{logger[_0x406f('0xc')](util[_0x406f('0xf')](_0x406f('0x13'),_0x2f7208['stack']));}}function closeHandler(){logger[_0x406f('0x14')](util[_0x406f('0xf')](_0x406f('0x15'),this['arg_1'],this[_0x406f('0x16')],this[_0x406f('0x17')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x11c759){logger[_0x406f('0xc')](_0x11c759['stack']);}}function timeoutHandler(){logger[_0x406f('0x14')](util['format'](_0x406f('0x18'),this[_0x406f('0x19')],this[_0x406f('0x16')],this[_0x406f('0x17')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0x406f('0x14')](util['format'](_0x406f('0x1a'),this['arg_1'],this[_0x406f('0x16')],this[_0x406f('0x17')],this[_0x406f('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x518a88){return parser[_0x406f('0x1c')](_0x518a88,{'object':!![]})[_0x406f('0x1d')][_0x406f('0x1e')];}function addVertex(_0x5ebb26,_0x102cfd,_0x5961cc){_0x102cfd[_0x406f('0x1f')]=_0x5961cc;if(_0x102cfd[_0x406f('0x20')](_0x406f('0x21'))){_0x102cfd[_0x406f('0x22')]=parseInt(_0x102cfd[_0x406f('0x21')],0xa);}_0x5ebb26['addVertex'](_['omit'](_0x102cfd,_0x406f('0x23')));}function initGraph(_0x58501f,_0x467a3a){var _0xa240d8=new Graph();for(var _0x4ff1de in _0x58501f){if(_0x58501f['hasOwnProperty'](_0x4ff1de)){if(_[_0x406f('0x24')](_0x58501f[_0x4ff1de])){for(var _0x484f7c=0x0;_0x484f7c<_0x58501f[_0x4ff1de][_0x406f('0x25')];_0x484f7c+=0x1){addVertex(_0xa240d8,_0x58501f[_0x4ff1de][_0x484f7c],_0x4ff1de);}}else{addVertex(_0xa240d8,_0x58501f[_0x4ff1de],_0x4ff1de);}}}for(var _0x394430=0x0;_0x394430<_0x467a3a[_0x406f('0x25')];_0x394430+=0x1){if(_0x467a3a[_0x394430][_0x406f('0x26')]&&_0x467a3a[_0x394430][_0x406f('0x27')]){_0xa240d8[_0x406f('0x28')](_0x467a3a[_0x394430][_0x406f('0x26')],_0x467a3a[_0x394430][_0x406f('0x27')],_0x467a3a[_0x394430]['value']);}}return _0xa240d8;}function getSquareProject(_0x5ac8e5,_0x315869){rpc[_0x406f('0x29')](_0x5ac8e5)[_0x406f('0x2a')](function(_0xcb1092){_0x315869(null,_0xcb1092);})['catch'](function(_0x543248){_0x315869(null,_0x543248);});}function createSquareReport(_0x504ce9,_0x44f0ef){rpc['createSquareReport'](_0x504ce9)['then'](function(_0x4430c5){if(_0x44f0ef){_0x44f0ef(null,_0x4430c5);}})[_0x406f('0x2b')](function(_0x2e42fa){if(_0x44f0ef){_0x44f0ef(null,_0x2e42fa);}});}function setChannelVariables(_0x2b8a15){for(var _0x93b5ce in _0x2b8a15){if(_0x2b8a15[_0x406f('0x20')](_0x93b5ce)){if(_0x93b5ce[_0x406f('0x2c')](_0x406f('0x2d'))===0x0){_0x2b8a15[_0x93b5ce[_0x406f('0x2e')](0x4)]=_0x2b8a15[_0x93b5ce];delete _0x2b8a15[_0x93b5ce];}}}}function getLogFromObject(_0xe72baf){return util[_0x406f('0x2f')](_0xe72baf,{'showHidden':![],'depth':null});}function agiHandler(_0x449c79){var _0x23efaa,_0x48bf35,_0x3ad6e0,_0x2227c6,_0x13fb61;logger[_0x406f('0x30')](_0x406f('0x31'),JSON[_0x406f('0x32')](_0x449c79,null,0x2));logger[_0x406f('0x14')](util[_0x406f('0xf')](_0x406f('0x33'),_0x449c79[_0x406f('0x19')],_0x449c79['calleridname'],_0x449c79[_0x406f('0x17')],_0x449c79[_0x406f('0x1b')],_0x449c79[_0x406f('0x34')]));_0x449c79['on'](_0x406f('0xc'),errorHandler);_0x449c79['on'](_0x406f('0x35'),closeHandler);_0x449c79['on'](_0x406f('0x36'),timeoutHandler);_0x449c79['evtHangup']=![];_0x449c79['on']('hangup',hangupHandler);var _0x44c63a=getSquareProject[_0x406f('0x37')](null,_0x449c79['arg_1']);if(_0x44c63a){if(_0x44c63a[_0x406f('0x38')]){_0x23efaa=getRoot(_0x44c63a['production']);if(_0x23efaa&&_0x23efaa[_0x406f('0x39')]){logger[_0x406f('0x30')](_0x406f('0x1e'),JSON['stringify'](_0x23efaa,null,0x2));_0x449c79[_0x406f('0x3a')]=moment()[_0x406f('0xf')](_0x406f('0x3b'));_0x48bf35=initGraph(_[_0x406f('0x3c')](_0x23efaa,_0x406f('0x23')),_0x23efaa[_0x406f('0x23')]);_0x3ad6e0=new Vertices(_0x449c79,rpc,mailRpc);logger[_0x406f('0x14')](util[_0x406f('0xf')](_0x406f('0x3d'),_0x449c79[_0x406f('0x19')],_0x449c79[_0x406f('0x16')],_0x449c79[_0x406f('0x17')],_0x449c79[_0x406f('0x1b')],_0x449c79[_0x406f('0x34')]));_0x48bf35[_0x406f('0x3e')](_0x23efaa['start']['id'],function(_0x55c759){try{_0x55c759=_0x3ad6e0['clear'](_0x55c759);logger[_0x406f('0x30')](_0x406f('0x3f'),JSON[_0x406f('0x32')](_0x55c759,null,0x2));if(_0x55c759['agicommand']===_0x406f('0x40')){logger[_0x406f('0x14')](_0x406f('0x41'));_0x449c79[_0x406f('0x42')]=_0x55c759[_0x406f('0x42')]||_0x449c79[_0x406f('0x42')];_0x449c79['extension']=_0x55c759[_0x406f('0x43')];_0x449c79[_0x406f('0x44')]=_0x55c759['priority']?_0x55c759[_0x406f('0x44')]-0x1:0x1;return null;}else if(_0x55c759&&_0x3ad6e0[_0x55c759['agicommand']]){_0x13fb61=_0x3ad6e0[_0x55c759['agicommand']](_0x55c759);logger[_0x406f('0x14')](_0x406f('0x45'),JSON[_0x406f('0x32')](_0x13fb61,null,0x2));if(_0x13fb61&&_0x13fb61[_0x406f('0x46')]===AGI_CODE_SUCCESS&&_0x13fb61[_0x406f('0x47')]!==AGI_RESULT_ERROR&&!_0x449c79[_0x406f('0x48')]){logger['debug']('response',getLogFromObject(_0x13fb61));return _[_0x406f('0x49')](_0x13fb61[_0x406f('0x47')])?null:_0x13fb61[_0x406f('0x47')][_0x406f('0x4a')]();}else{logger[_0x406f('0xc')](_0x406f('0x45'),getLogFromObject(_0x13fb61));return null;}}else{logger[_0x406f('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x146056){logger[_0x406f('0xc')](_0x146056[_0x406f('0x4b')]);return null;}});if(_0x23efaa[_0x406f('0x4c')]){logger[_0x406f('0x14')](util[_0x406f('0xf')](_0x406f('0x4d'),_0x449c79[_0x406f('0x19')],_0x449c79[_0x406f('0x16')],_0x449c79[_0x406f('0x17')],_0x449c79[_0x406f('0x1b')],_0x449c79['uniqueid']));_0x48bf35[_0x406f('0x3e')](_0x23efaa[_0x406f('0x4c')]['id'],function(_0x47ddfa){try{_0x47ddfa=_0x3ad6e0['clear'](_0x47ddfa);logger[_0x406f('0x30')](_0x406f('0x3f'),JSON[_0x406f('0x32')](_0x47ddfa,null,0x2));if(_0x47ddfa&&_0x3ad6e0[_0x47ddfa[_0x406f('0x1f')]]){_0x13fb61=_0x3ad6e0[_0x47ddfa['agicommand']](_0x47ddfa);if(_0x13fb61){logger[_0x406f('0x30')]('response',getLogFromObject(_0x13fb61));return _[_0x406f('0x49')](_0x13fb61[_0x406f('0x47')])?null:_0x13fb61['result']['toString']();}else{logger[_0x406f('0xc')](_0x406f('0x45'),getLogFromObject(_0x13fb61));return null;}}else{logger[_0x406f('0xc')](_0x406f('0x4e'));return null;}}catch(_0x56339a){logger[_0x406f('0xc')](_0x56339a[_0x406f('0x4b')]);return null;}});}logger[_0x406f('0x14')](util[_0x406f('0xf')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x449c79['arg_1'],_0x449c79[_0x406f('0x16')],_0x449c79[_0x406f('0x17')],_0x449c79[_0x406f('0x1b')],_0x449c79[_0x406f('0x34')]));logger[_0x406f('0x14')](util['format'](_0x406f('0x4f'),_0x449c79[_0x406f('0x42')],_0x449c79['extension'],parseInt(_0x449c79['priority'],0xa)+0x1));_0x449c79[_0x406f('0x50')](_0x449c79[_0x406f('0x42')],_0x449c79[_0x406f('0x43')],parseInt(_0x449c79['priority'],0xa)+0x1);_0x449c79[_0x406f('0x35')]();}}else{logger[_0x406f('0xc')](util[_0x406f('0xf')](_0x406f('0x51'),_0x449c79[_0x406f('0x19')]));_0x449c79[_0x406f('0x50')](_0x449c79[_0x406f('0x42')],_0x449c79[_0x406f('0x43')],parseInt(_0x449c79[_0x406f('0x44')],0xa)+0x1);_0x449c79['close']();}}else{logger['error'](util[_0x406f('0xf')](_0x406f('0x52'),_0x449c79[_0x406f('0x19')]));_0x449c79[_0x406f('0x50')](_0x449c79[_0x406f('0x42')],_0x449c79[_0x406f('0x43')],parseInt(_0x449c79[_0x406f('0x44')],0xa)+0x1);_0x449c79[_0x406f('0x35')]();}}function main(){var _0x295e7a;return utilLicense[_0x406f('0x53')]()['then'](function(_0x5ef690){if(_0x5ef690){if(_0x5ef690[_0x406f('0x54')]){if(_0x5ef690[_0x406f('0x55')]&&_0x5ef690[_0x406f('0x55')]>0x0){logger[_0x406f('0x14')](util[_0x406f('0xf')](_0x406f('0x56'),_0x5ef690['callysquare']));_0x295e7a=_0x5ef690[_0x406f('0x55')];}else{logger[_0x406f('0x14')](_0x406f('0x57'));}}else{logger[_0x406f('0x14')](_0x406f('0x58'));_0x295e7a=-0x1;}}})[_0x406f('0x2b')](function(_0x14d61c){logger[_0x406f('0xc')](_0x406f('0x59'),_0x14d61c[_0x406f('0x4b')]);})['finally'](function(){var _0x494955=require(_0x406f('0x5a'))(config[_0x406f('0x4')]['port'],config[_0x406f('0x4')]['ip'],_0x295e7a);_0x494955['on']('error',errorHandler);_0x494955['on']('listening',listeningHandler);_0x494955['on'](_0x406f('0x5b'),connectionHandler);_0x494955['on'](_0x406f('0x35'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 9d3bca8..5aea533 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(_0x1e5f16,_0x499f5f){var _0xe4aa28=function(_0x235a1f){while(--_0x235a1f){_0x1e5f16['push'](_0x1e5f16['shift']());}};_0xe4aa28(++_0x499f5f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x47ff30,_0x3f7691){var _0x3214ae=function(_0x3f2d09){while(--_0x3f2d09){_0x47ff30['push'](_0x47ff30['shift']());}};_0x3214ae(++_0x3f7691);}(_0x814b,0x1a2));var _0xb814=function(_0xfcdda0,_0x32479b){_0xfcdda0=_0xfcdda0-0x0;var _0x17ebe3=_0x814b[_0xfcdda0];return _0x17ebe3;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 5a67566..a513967 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x50a1f6,_0x238fd8){var _0x84f8d4=function(_0x2d9586){while(--_0x2d9586){_0x50a1f6['push'](_0x50a1f6['shift']());}};_0x84f8d4(++_0x238fd8);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ff91f,_0x126612){_0x4ff91f=_0x4ff91f-0x0;var _0x801e5d=_0xb10b[_0x4ff91f];return _0x801e5d;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x35cf3d,_0x5b755c){var _0x507252=function(_0x256ef1){while(--_0x256ef1){_0x35cf3d['push'](_0x35cf3d['shift']());}};_0x507252(++_0x5b755c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4805e4,_0x12bc2b){_0x4805e4=_0x4805e4-0x0;var _0x2ab4a8=_0x5f2f[_0x4805e4];return _0x2ab4a8;};'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 aedc090..ebc3703 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 _0xbbec=['arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','lodash','jayson/promise','client','http','request','then','message','result','catch','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xbbec,0x7b));var _0xcbbe=function(_0x19bdea,_0x3fe9ae){_0x19bdea=_0x19bdea-0x0;var _0x428d48=_0xbbec[_0x19bdea];return _0x428d48;};'use strict';var BPromise=require(_0xcbbe('0x0'));var moment=require('moment');var _=require(_0xcbbe('0x1'));var util=require('util');var jayson=require(_0xcbbe('0x2'));var client=jayson[_0xcbbe('0x3')][_0xcbbe('0x4')]({'port':0x2329});function request(_0x3c04db,_0x4e53a7){return new BPromise(function(_0x13c2aa,_0x1f1c6a){return client[_0xcbbe('0x5')](_0x3c04db,_0x4e53a7)[_0xcbbe('0x6')](function(_0x4aee98){if(_0x4aee98['error']){return _0x1f1c6a(_0x4aee98['error'][_0xcbbe('0x7')]);}else{return _0x13c2aa(_0x4aee98[_0xcbbe('0x8')]);}})[_0xcbbe('0x9')](function(_0x3c53d0){return _0x1f1c6a(_0x3c53d0);});});}exports['getSquareProject']=function(_0x2925a3){return request(_0xcbbe('0xa'),{'options':{'raw':![],'where':{'name':_0x2925a3},'attributes':[_0xcbbe('0xb')]}});};exports[_0xcbbe('0xc')]=function(_0x5cc094){return request(_0xcbbe('0xd'),{'options':{'raw':![],'where':{'id':_0x5cc094},'include':[{'model':'MailServerOut','as':_0xcbbe('0xe')}],'attributes':['id',_0xcbbe('0xf'),_0xcbbe('0x10')]}});};exports['getSquareProjectById']=function(_0x2b285d){return request(_0xcbbe('0xa'),{'options':{'where':{'id':_0x2b285d},'attributes':[_0xcbbe('0xf')]}});};exports[_0xcbbe('0x11')]=function(_0x15ec47){return request(_0xcbbe('0x12'),{'options':{'where':{'id':_0x15ec47},'attributes':[_0xcbbe('0xf')]}});};exports[_0xcbbe('0x13')]=function(_0x1ff2ed){return request('ShowVariable',{'options':{'where':{'id':_0x1ff2ed},'attributes':[_0xcbbe('0xf')]}});};exports[_0xcbbe('0x14')]=function(_0x357256){return request(_0xcbbe('0x15'),{'options':{'where':{'id':_0x357256},'attributes':[_0xcbbe('0x16')]}});};exports[_0xcbbe('0x17')]=function(_0x5b8b81){return request(_0xcbbe('0x18'),{'options':{'where':{'id':_0x5b8b81},'attributes':[_0xcbbe('0xf')]}});};exports[_0xcbbe('0x19')]=function(_0x184a17){return request('ShowTrunk',{'options':{'where':{'id':_0x184a17},'attributes':[_0xcbbe('0xf')]}});};exports[_0xcbbe('0x1a')]=function(_0x26f45d){return request(_0xcbbe('0x1b'),{'options':{'where':{'id':_0x26f45d},'attributes':[_0xcbbe('0x1c')]}});};exports[_0xcbbe('0x1d')]=function(_0x564d5a){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x564d5a},'include':[{'model':_0xcbbe('0x1e'),'as':_0xcbbe('0x1f')}]}});};exports[_0xcbbe('0x20')]=function(_0x39b1c1){return request('ShowSmsAccount',{'options':{'where':{'id':_0x39b1c1},'attributes':['id',_0xcbbe('0xf')]}});};exports[_0xcbbe('0x21')]=function(_0x2c0137){return request(_0xcbbe('0x22'),{'body':_0x2c0137});};exports[_0xcbbe('0x23')]=function(_0x11f0ed){return request('CreateSquareDetailsReport',{'body':_0x11f0ed});};exports[_0xcbbe('0x24')]=function(_0x2ebf2b){return request(_0xcbbe('0x25'),{'body':_[_0xcbbe('0x26')](_0x2ebf2b,{'project_name':_0x2ebf2b[_0xcbbe('0x27')],'prev_project_name':_0x2ebf2b[_0xcbbe('0x28')]||'','is_subproject':_0x2ebf2b[_0xcbbe('0x28')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xcbbe('0x29')]=function(_0x4f8e73){return request(_0xcbbe('0x2a'),{'body':_0x4f8e73});};exports[_0xcbbe('0x2b')]=function(_0x2641fe){return request('CreateSquareMessage',{'body':_0x2641fe});};exports['createCmContact']=function(_0xbcd1da){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xbcd1da[_0xcbbe('0x2c')],'ListId':_0xbcd1da[_0xcbbe('0x2d')]}}})['then'](function(_0x56e6ec){if(_0x56e6ec){return _0x56e6ec;}return request('CreateCmContact',{'body':_0xbcd1da});});};exports[_0xcbbe('0x2e')]=function(_0x19a460){return request('ShowPause',{'options':{'where':{'id':_0x19a460},'attributes':[_0xcbbe('0xf')]}});};exports[_0xcbbe('0x2f')]=function(_0x13004c,_0x3765d9){return request(_0xcbbe('0x30'),{'body':{'interface':_0x3765d9},'options':{'where':_0x13004c}});};exports[_0xcbbe('0x31')]=function(_0x1f8f1f,_0x383374,_0x34cda9){return request(_0xcbbe('0x32'),{'body':{'type':_0x383374,'uniqueid':_0x34cda9},'options':{'where':_0x1f8f1f}});};exports[_0xcbbe('0x33')]=function(_0x114385){return request(_0xcbbe('0x34'),{'body':{},'options':{'where':_0x114385}});};exports['agentLogout']=function(_0x70d6f2){return request(_0xcbbe('0x35'),{'body':{},'options':{'where':_0x70d6f2}});}; \ No newline at end of file +var _0xa596=['CreateSquareRecording','CreateSquareMessage','phone','ListId','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','util','jayson/promise','client','http','then','error','message','result','getMailAccountById','ShowMailAccount','Smtp','name','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording'];(function(_0x2d04a6,_0x5bbf0a){var _0x3cd00e=function(_0x38887c){while(--_0x38887c){_0x2d04a6['push'](_0x2d04a6['shift']());}};_0x3cd00e(++_0x5bbf0a);}(_0xa596,0x7b));var _0x6a59=function(_0x1d4544,_0x241e3b){_0x1d4544=_0x1d4544-0x0;var _0x49a750=_0xa596[_0x1d4544];return _0x49a750;};'use strict';var BPromise=require(_0x6a59('0x0'));var moment=require(_0x6a59('0x1'));var _=require('lodash');var util=require(_0x6a59('0x2'));var jayson=require(_0x6a59('0x3'));var client=jayson[_0x6a59('0x4')][_0x6a59('0x5')]({'port':0x2329});function request(_0x2922e5,_0xf0435f){return new BPromise(function(_0x11cce1,_0x272793){return client['request'](_0x2922e5,_0xf0435f)[_0x6a59('0x6')](function(_0x3fab57){if(_0x3fab57[_0x6a59('0x7')]){return _0x272793(_0x3fab57[_0x6a59('0x7')][_0x6a59('0x8')]);}else{return _0x11cce1(_0x3fab57[_0x6a59('0x9')]);}})['catch'](function(_0x3f25d8){return _0x272793(_0x3f25d8);});});}exports['getSquareProject']=function(_0x21008c){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x21008c},'attributes':['production']}});};exports[_0x6a59('0xa')]=function(_0x6e6ef7){return request(_0x6a59('0xb'),{'options':{'raw':![],'where':{'id':_0x6e6ef7},'include':[{'model':'MailServerOut','as':_0x6a59('0xc')}],'attributes':['id',_0x6a59('0xd'),'email']}});};exports[_0x6a59('0xe')]=function(_0x4bf880){return request(_0x6a59('0xf'),{'options':{'where':{'id':_0x4bf880},'attributes':[_0x6a59('0xd')]}});};exports[_0x6a59('0x10')]=function(_0x68dd0a){return request(_0x6a59('0x11'),{'options':{'where':{'id':_0x68dd0a},'attributes':[_0x6a59('0xd')]}});};exports[_0x6a59('0x12')]=function(_0xb2fd50){return request(_0x6a59('0x13'),{'options':{'where':{'id':_0xb2fd50},'attributes':[_0x6a59('0xd')]}});};exports[_0x6a59('0x14')]=function(_0x5b013c){return request(_0x6a59('0x15'),{'options':{'where':{'id':_0x5b013c},'attributes':[_0x6a59('0x16')]}});};exports[_0x6a59('0x17')]=function(_0x2cd31a){return request(_0x6a59('0x18'),{'options':{'where':{'id':_0x2cd31a},'attributes':[_0x6a59('0xd')]}});};exports['getTrunkById']=function(_0x344ed4){return request(_0x6a59('0x19'),{'options':{'where':{'id':_0x344ed4},'attributes':[_0x6a59('0xd')]}});};exports[_0x6a59('0x1a')]=function(_0x209319){return request(_0x6a59('0x1b'),{'options':{'where':{'id':_0x209319},'attributes':[_0x6a59('0x1c')]}});};exports[_0x6a59('0x1d')]=function(_0xe7d724){return request(_0x6a59('0x1e'),{'options':{'raw':![],'where':{'id':_0xe7d724},'include':[{'model':_0x6a59('0x1f'),'as':_0x6a59('0x20')}]}});};exports[_0x6a59('0x21')]=function(_0x394f60){return request(_0x6a59('0x22'),{'options':{'where':{'id':_0x394f60},'attributes':['id',_0x6a59('0xd')]}});};exports[_0x6a59('0x23')]=function(_0x545ce0){return request(_0x6a59('0x24'),{'body':_0x545ce0});};exports[_0x6a59('0x25')]=function(_0xe2573f){return request(_0x6a59('0x26'),{'body':_0xe2573f});};exports['createSquareReport']=function(_0x580267){return request(_0x6a59('0x27'),{'body':_[_0x6a59('0x28')](_0x580267,{'project_name':_0x580267[_0x6a59('0x29')],'prev_project_name':_0x580267[_0x6a59('0x2a')]||'','is_subproject':_0x580267['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x6a59('0x2b'))})});};exports[_0x6a59('0x2c')]=function(_0x5e1275){return request(_0x6a59('0x2d'),{'body':_0x5e1275});};exports['createSquareMessage']=function(_0x342292){return request(_0x6a59('0x2e'),{'body':_0x342292});};exports['createCmContact']=function(_0x4174ee){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4174ee[_0x6a59('0x2f')],'ListId':_0x4174ee[_0x6a59('0x30')]}}})['then'](function(_0x199317){if(_0x199317){return _0x199317;}return request('CreateCmContact',{'body':_0x4174ee});});};exports[_0x6a59('0x31')]=function(_0x1eb305){return request(_0x6a59('0x32'),{'options':{'where':{'id':_0x1eb305},'attributes':[_0x6a59('0xd')]}});};exports[_0x6a59('0x33')]=function(_0x4475d2,_0x4e657a){return request('LoginUser',{'body':{'interface':_0x4e657a},'options':{'where':_0x4475d2}});};exports[_0x6a59('0x34')]=function(_0x37f63f,_0x563675,_0x1c7016){return request('PauseUser',{'body':{'type':_0x563675,'uniqueid':_0x1c7016},'options':{'where':_0x37f63f}});};exports[_0x6a59('0x35')]=function(_0x20b44d){return request(_0x6a59('0x36'),{'body':{},'options':{'where':_0x20b44d}});};exports['agentLogout']=function(_0x360e16){return request(_0x6a59('0x37'),{'body':{},'options':{'where':_0x360e16}});}; \ 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 4bb44d3..72ff269 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 _0xb66c=['exports','./polly'];(function(_0x29741d,_0x38d2a5){var _0x404920=function(_0x193bb9){while(--_0x193bb9){_0x29741d['push'](_0x29741d['shift']());}};_0x404920(++_0x38d2a5);}(_0xb66c,0x175));var _0xcb66=function(_0x1fd82b,_0x324526){_0x1fd82b=_0x1fd82b-0x0;var _0x2d2a53=_0xb66c[_0x1fd82b];return _0x2d2a53;};var polly=require(_0xcb66('0x0'));var lex=require('./lex');module[_0xcb66('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x6737=['./lex','exports'];(function(_0x481366,_0x41e46b){var _0x229649=function(_0x508ecc){while(--_0x508ecc){_0x481366['push'](_0x481366['shift']());}};_0x229649(++_0x41e46b);}(_0x6737,0xe2));var _0x7673=function(_0x30b9c0,_0x460f3a){_0x30b9c0=_0x30b9c0-0x0;var _0xceea97=_0x6737[_0x30b9c0];return _0xceea97;};var polly=require('./polly');var lex=require(_0x7673('0x0'));module[_0x7673('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 71353ba..eed7d8b 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 _0x6b19=['./lib/api','exports'];(function(_0x2130a3,_0x1c756a){var _0x3c7bf7=function(_0x35e1b8){while(--_0x35e1b8){_0x2130a3['push'](_0x2130a3['shift']());}};_0x3c7bf7(++_0x1c756a);}(_0x6b19,0xe8));var _0x96b1=function(_0xbec7e6,_0x30cd44){_0xbec7e6=_0xbec7e6-0x0;var _0xeb2378=_0x6b19[_0xbec7e6];return _0xeb2378;};'use strict';var lex=require(_0x96b1('0x0'));module[_0x96b1('0x1')]=function(_0x5a2e3c,_0x40d82f,_0x582556,_0x573f03,_0x2cf16d,_0x408fae){return lex(_0x5a2e3c,_0x40d82f,_0x582556,_0x573f03,_0x2cf16d,_0x408fae);}; \ No newline at end of file +var _0x9491=['./lib/api','exports'];(function(_0x486f5c,_0x2ae26d){var _0x41629c=function(_0x184c2a){while(--_0x184c2a){_0x486f5c['push'](_0x486f5c['shift']());}};_0x41629c(++_0x2ae26d);}(_0x9491,0xb6));var _0x1949=function(_0x1d2dd3,_0x189dfb){_0x1d2dd3=_0x1d2dd3-0x0;var _0x91ba4e=_0x9491[_0x1d2dd3];return _0x91ba4e;};'use strict';var lex=require(_0x1949('0x0'));module[_0x1949('0x1')]=function(_0x778256,_0x37c2b6,_0x46e060,_0x1f05db,_0x28621a,_0x39082e){return lex(_0x778256,_0x37c2b6,_0x46e060,_0x1f05db,_0x28621a,_0x39082e);}; \ 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 ec7cb34..955fb3d 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 _0x0699=['exports','LexRuntime','$LATEST','bluebird','postText','slots','slot_'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0699,0xb2));var _0x9069=function(_0x15f243,_0x4d4491){_0x15f243=_0x15f243-0x0;var _0x3690e1=_0x0699[_0x15f243];return _0x3690e1;};'use strict';var BPromise=require(_0x9069('0x0'));var AWS=require('aws-sdk');function lexResult(_0x223303,_0x275de9){return new BPromise(function(_0x5dcf10,_0x3f3903){_0x223303[_0x9069('0x1')](_0x275de9,function(_0x6a41a6,_0x40221c){if(_0x6a41a6){_0x3f3903(_0x6a41a6);}if(_0x40221c[_0x9069('0x2')]){for(const _0x429d5c in _0x40221c[_0x9069('0x2')]){if(_0x40221c[_0x9069('0x2')]['hasOwnProperty'](_0x429d5c)){var _0x1e5ab3=_0x40221c['slots'][_0x429d5c];_0x40221c[_0x9069('0x3')+_0x429d5c]=_0x1e5ab3;}}}_0x5dcf10(_0x40221c);});});}module[_0x9069('0x4')]=function(_0x1622e4,_0x3033eb,_0x20b05b,_0x328736,_0x51c801,_0x8ebd95){var _0x21e2af=new AWS[(_0x9069('0x5'))]({'accessKeyId':_0x3033eb,'secretAccessKey':_0x20b05b,'region':_0x328736});var _0x3c8a10={'botAlias':_0x9069('0x6'),'botName':_0x8ebd95,'inputText':_0x51c801,'userId':_0x1622e4};return lexResult(_0x21e2af,_0x3c8a10);}; \ No newline at end of file +var _0x1386=['bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_','LexRuntime','$LATEST'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x1386,0x1f0));var _0x6138=function(_0x29dd19,_0x340258){_0x29dd19=_0x29dd19-0x0;var _0x4442eb=_0x1386[_0x29dd19];return _0x4442eb;};'use strict';var BPromise=require(_0x6138('0x0'));var AWS=require(_0x6138('0x1'));function lexResult(_0x1d0a45,_0x28e46d){return new BPromise(function(_0x377c58,_0x20696b){_0x1d0a45[_0x6138('0x2')](_0x28e46d,function(_0x293633,_0x1ca3d2){if(_0x293633){_0x20696b(_0x293633);}if(_0x1ca3d2[_0x6138('0x3')]){for(const _0x503e30 in _0x1ca3d2[_0x6138('0x3')]){if(_0x1ca3d2[_0x6138('0x3')][_0x6138('0x4')](_0x503e30)){var _0x1b2541=_0x1ca3d2['slots'][_0x503e30];_0x1ca3d2[_0x6138('0x5')+_0x503e30]=_0x1b2541;}}}_0x377c58(_0x1ca3d2);});});}module['exports']=function(_0x5bc020,_0xf6254c,_0x29ae25,_0x4667f7,_0x1bc209,_0x99e4d9){var _0x50d065=new AWS[(_0x6138('0x6'))]({'accessKeyId':_0xf6254c,'secretAccessKey':_0x29ae25,'region':_0x4667f7});var _0x398c4b={'botAlias':_0x6138('0x7'),'botName':_0x99e4d9,'inputText':_0x1bc209,'userId':_0x5bc020};return lexResult(_0x50d065,_0x398c4b);}; \ 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 afea24d..c701fe5 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 _0x9823=['./lib/api','exports'];(function(_0x365c78,_0x23ab28){var _0x40d398=function(_0x4998ac){while(--_0x4998ac){_0x365c78['push'](_0x365c78['shift']());}};_0x40d398(++_0x23ab28);}(_0x9823,0xd4));var _0x3982=function(_0x1b8ffe,_0x1e4707){_0x1b8ffe=_0x1b8ffe-0x0;var _0x2c38a5=_0x9823[_0x1b8ffe];return _0x2c38a5;};'use strict';var polly=require(_0x3982('0x0'));module[_0x3982('0x1')]=function(_0x4c690a,_0x2117a8,_0x53748f,_0xad41ce,_0xa86b28,_0x56b22d,_0x5a0201){return polly(_0x4c690a,_0x2117a8,_0x53748f,_0xad41ce,_0xa86b28,_0x56b22d,_0x5a0201);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x2ed663,_0x29fcdb,_0x1c0527,_0x447484,_0x409e56,_0x112928,_0x2c0da3){return polly(_0x2ed663,_0x29fcdb,_0x1c0527,_0x447484,_0x409e56,_0x112928,_0x2c0da3);}; \ 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 34a4c9b..dd3e209 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 _0xbcf7=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbcf7,0x9b));var _0x7bcf=function(_0x22d3c5,_0x37221d){_0x22d3c5=_0x22d3c5-0x0;var _0x2ee238=_0xbcf7[_0x22d3c5];return _0x2ee238;};'use strict';var fs=require('fs');var path=require(_0x7bcf('0x0'));var BPromise=require(_0x7bcf('0x1'));var rs=require(_0x7bcf('0x2'));var AWS=require(_0x7bcf('0x3'));function pollyResult(_0x538582,_0x2702ef,_0x4941a6){return new BPromise(function(_0x565f0e,_0x5f35be){_0x538582[_0x7bcf('0x4')](_0x2702ef,function(_0x2f8fec,_0x116397){if(_0x2f8fec){_0x5f35be(_0x2f8fec);}else if(_0x116397){if(_0x116397[_0x7bcf('0x5')]instanceof Buffer){fs[_0x7bcf('0x6')](_0x4941a6,_0x116397[_0x7bcf('0x5')],function(_0xf1b8a3){if(_0xf1b8a3){_0x5f35be(_0xf1b8a3);}else{_0x565f0e();}});}else{_0x5f35be(new Error(_0x7bcf('0x7')));}}else{_0x5f35be(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x7bcf('0x8')]=function(_0x3d38fd,_0x299b03,_0x36095e,_0x6da0d0,_0x3ec262,_0x3ad932,_0x47afda){var _0x30c8fd=new AWS[(_0x7bcf('0x9'))]({'accessKeyId':_0x3d38fd,'secretAccessKey':_0x299b03,'region':_0x36095e});var _0xec82cc={'Text':_0x3ec262,'TextType':_0x3ad932||_0x7bcf('0xa'),'OutputFormat':_0x7bcf('0xb'),'VoiceId':_0x6da0d0};return pollyResult(_0x30c8fd,_0xec82cc,_0x47afda);}; \ No newline at end of file +var _0xa4b9=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile'];(function(_0x3ae792,_0x4a147b){var _0xf1939b=function(_0x442f21){while(--_0x442f21){_0x3ae792['push'](_0x3ae792['shift']());}};_0xf1939b(++_0x4a147b);}(_0xa4b9,0x1bc));var _0x9a4b=function(_0x45872a,_0x4e1103){_0x45872a=_0x45872a-0x0;var _0x37d69f=_0xa4b9[_0x45872a];return _0x37d69f;};'use strict';var fs=require('fs');var path=require(_0x9a4b('0x0'));var BPromise=require('bluebird');var rs=require(_0x9a4b('0x1'));var AWS=require(_0x9a4b('0x2'));function pollyResult(_0x572788,_0x4f2f6b,_0x3ad71a){return new BPromise(function(_0x2cac66,_0xc743cc){_0x572788[_0x9a4b('0x3')](_0x4f2f6b,function(_0xafddb2,_0x2a3036){if(_0xafddb2){_0xc743cc(_0xafddb2);}else if(_0x2a3036){if(_0x2a3036[_0x9a4b('0x4')]instanceof Buffer){fs[_0x9a4b('0x5')](_0x3ad71a,_0x2a3036[_0x9a4b('0x4')],function(_0x581609){if(_0x581609){_0xc743cc(_0x581609);}else{_0x2cac66();}});}else{_0xc743cc(new Error(_0x9a4b('0x6')));}}else{_0xc743cc(new Error(_0x9a4b('0x7')));}});});}module[_0x9a4b('0x8')]=function(_0x3c53c9,_0x51f047,_0x4d9ae3,_0x28110e,_0x187259,_0x1d1521,_0x33f2d3){var _0x4f7395=new AWS['Polly']({'accessKeyId':_0x3c53c9,'secretAccessKey':_0x51f047,'region':_0x4d9ae3});var _0xf83fc2={'Text':_0x187259,'TextType':_0x1d1521||_0x9a4b('0x9'),'OutputFormat':'mp3','VoiceId':_0x28110e};return pollyResult(_0x4f7395,_0xf83fc2,_0x33f2d3);}; \ 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 3c80c46..4223883 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 _0xcd2b=['./lib/api','exports'];(function(_0x62fda7,_0x3f7e08){var _0x1fd67a=function(_0x289aee){while(--_0x289aee){_0x62fda7['push'](_0x62fda7['shift']());}};_0x1fd67a(++_0x3f7e08);}(_0xcd2b,0x150));var _0xbcd2=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xcd2b[_0x53ccf2];return _0x5a2964;};'use strict';var asr=require(_0xbcd2('0x0'));module[_0xbcd2('0x1')]=function(_0xb44953,_0x505224,_0x439842,_0xd6d547){return asr(_0xb44953,_0x505224,_0x439842);}; \ No newline at end of file +var _0xfbad=['exports','./lib/api'];(function(_0x4b18ea,_0x2c070a){var _0x28ec1c=function(_0x251208){while(--_0x251208){_0x4b18ea['push'](_0x4b18ea['shift']());}};_0x28ec1c(++_0x2c070a);}(_0xfbad,0x18d));var _0xdfba=function(_0x1beaba,_0x5a9ea9){_0x1beaba=_0x1beaba-0x0;var _0x19d1ea=_0xfbad[_0x1beaba];return _0x19d1ea;};'use strict';var asr=require(_0xdfba('0x0'));module[_0xdfba('0x1')]=function(_0x13beeb,_0x299105,_0x4406ff,_0x2440f7){return asr(_0x13beeb,_0x299105,_0x4406ff);}; \ 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 16a289b..fbbcf2f 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 _0xba43=['bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0xba43,0x70));var _0x3ba4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xba43[_0x321bb2];return _0x9c12ed;};'use strict';var url=require('url');var BPromise=require(_0x3ba4('0x0'));var fs=require('fs');var host=_0x3ba4('0x1');module[_0x3ba4('0x2')]=function(_0x4b8424,_0x1d1aef,_0x4321a5){return new BPromise(function(_0x4e1fe1,_0x42722b){var _0x37bda8;if(typeof _0x4b8424!=='string'||_0x4b8424[_0x3ba4('0x3')]===0x0){return _0x42722b(_0x3ba4('0x4'));}if(typeof _0x1d1aef!==_0x3ba4('0x5')||_0x1d1aef['length']===0x0){return _0x42722b(_0x3ba4('0x6'));}if(typeof _0x4321a5!==_0x3ba4('0x7')&&(typeof _0x4321a5!=='string'||_0x4321a5[_0x3ba4('0x3')]===0x0)){return _0x42722b(_0x3ba4('0x8'));}try{_0x37bda8=fs[_0x3ba4('0x9')](_0x4b8424)[_0x3ba4('0xa')](_0x3ba4('0xb'));}catch(_0xc60940){return _0x42722b(_0xc60940);}return _0x4e1fe1({'method':_0x3ba4('0xc'),'uri':host+_0x3ba4('0xd')+_0x1d1aef,'body':{'config':{'encoding':_0x3ba4('0xe'),'sampleRateHertz':_0x3ba4('0xf'),'languageCode':_0x4321a5},'audio':{'content':_0x37bda8}},'json':!![]});});}; \ No newline at end of file +var _0x9965=['toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','filepath\x20should\x20be\x20a\x20string','string','length','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x2db146,_0x509cc5){var _0x524bcb=function(_0x18f671){while(--_0x18f671){_0x2db146['push'](_0x2db146['shift']());}};_0x524bcb(++_0x509cc5);}(_0x9965,0xbb));var _0x5996=function(_0x1badf5,_0x4e6b10){_0x1badf5=_0x1badf5-0x0;var _0x1124f0=_0x9965[_0x1badf5];return _0x1124f0;};'use strict';var url=require(_0x5996('0x0'));var BPromise=require(_0x5996('0x1'));var fs=require('fs');var host=_0x5996('0x2');module[_0x5996('0x3')]=function(_0xb212c,_0x376fce,_0x1401ca){return new BPromise(function(_0x4b5671,_0x492940){var _0x61cf1c;if(typeof _0xb212c!=='string'||_0xb212c['length']===0x0){return _0x492940(_0x5996('0x4'));}if(typeof _0x376fce!==_0x5996('0x5')||_0x376fce[_0x5996('0x6')]===0x0){return _0x492940('key\x20should\x20be\x20a\x20string');}if(typeof _0x1401ca!==_0x5996('0x7')&&(typeof _0x1401ca!==_0x5996('0x5')||_0x1401ca['length']===0x0)){return _0x492940(_0x5996('0x8'));}try{_0x61cf1c=fs['readFileSync'](_0xb212c)[_0x5996('0x9')]('base64');}catch(_0x29c426){return _0x492940(_0x29c426);}return _0x4b5671({'method':_0x5996('0xa'),'uri':host+_0x5996('0xb')+_0x376fce,'body':{'config':{'encoding':_0x5996('0xc'),'sampleRateHertz':_0x5996('0xd'),'languageCode':_0x1401ca},'audio':{'content':_0x61cf1c}},'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 eb45a73..10cb4be 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 _0xf4b6=['./asr'];(function(_0x4165f1,_0xe35e6b){var _0xbe88a3=function(_0x1b2792){while(--_0x1b2792){_0x4165f1['push'](_0x4165f1['shift']());}};_0xbe88a3(++_0xe35e6b);}(_0xf4b6,0x1a9));var _0x6f4b=function(_0x2ad230,_0x534f9a){_0x2ad230=_0x2ad230-0x0;var _0x321055=_0xf4b6[_0x2ad230];return _0x321055;};var asr=require(_0x6f4b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index db3dbda..5f356c5 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 _0xe7ce=['?key=','ssml','input','text:synthesize','then','tmp','.mp3','from','writeFile','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','stringify','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','freeform=3','parse','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','http','https','bluebird','randomstring','sox','util','querystring','google-tts-api','apiai-promise','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','finish','info','close','download\x20error','end','path','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0xe7ce,0x185));var _0xee7c=function(_0x3b76f0,_0x5043ac){_0x3b76f0=_0x3b76f0-0x0;var _0x1afd7f=_0xe7ce[_0x3b76f0];return _0x1afd7f;};'use strict';var fs=require('fs');var path=require('path');var http=require(_0xee7c('0x0'));var https=require(_0xee7c('0x1'));var urlParse=require('url')['parse'];var BPromise=require(_0xee7c('0x2'));var rs=require(_0xee7c('0x3'));var sox=require(_0xee7c('0x4'));var rp=require('request-promise');var util=require(_0xee7c('0x5'));var querystring=require(_0xee7c('0x6'));var tts=require(_0xee7c('0x7'));var apiai=require(_0xee7c('0x8'));var md5=require('md5');var google=require(_0xee7c('0x9'));var aws=require(_0xee7c('0xa'));var tilde=require(_0xee7c('0xb'));var sestek=require(_0xee7c('0xc'));var logger=require(_0xee7c('0xd'))(_0xee7c('0xe'));var ISPEECH_API=_0xee7c('0xf');function downloadFile(_0x13914f,_0x4fc710){return new BPromise(function(_0x3fcf0a,_0x13e0da){var _0x1d721b=urlParse(_0x13914f);var _0x4a93e4=_0x1d721b[_0xee7c('0x10')]===_0xee7c('0x11')?https:http;var _0x27b281={'host':_0x1d721b[_0xee7c('0x12')],'path':_0x1d721b['path'],'headers':{'user-agent':_0xee7c('0x13')}};_0x4a93e4['get'](_0x27b281,function(_0x325524){if(_0x325524[_0xee7c('0x14')]!==0xc8){logger[_0xee7c('0x15')]('request\x20to\x20'+_0x13914f+_0xee7c('0x16')+_0x325524['statusCode']+'\x20('+_0x325524[_0xee7c('0x17')]+')');_0x13e0da(new Error(_0xee7c('0x18')+_0x13914f+_0xee7c('0x16')+_0x325524[_0xee7c('0x14')]+'\x20('+_0x325524['statusMessage']+')'));return;}var _0x1cdfcc=fs['createWriteStream'](_0x4fc710);_0x1cdfcc['on'](_0xee7c('0x19'),function(){logger[_0xee7c('0x1a')]('finish\x20download\x20file');_0x1cdfcc[_0xee7c('0x1b')](_0x3fcf0a);});_0x1cdfcc['on'](_0xee7c('0x15'),function(_0xe99cef){fs['unlink'](_0x4fc710);logger['error'](_0xee7c('0x1c'),_0xe99cef);_0x13e0da(_0xe99cef);});_0x325524['pipe'](_0x1cdfcc);})['on']('error',function(_0x395b12){logger[_0xee7c('0x15')](_0x395b12);_0x13e0da(_0x395b12);})[_0xee7c('0x1d')]();});}function uploadFile(_0x46c53d){return new BPromise(function(_0x53de3f,_0x1294b6){var _0x5035ad=urlParse(_0x46c53d);var _0x2b33dc=_0x5035ad[_0xee7c('0x10')]===_0xee7c('0x11')?https:http;var _0x37538={'host':_0x5035ad[_0xee7c('0x12')],'path':_0x5035ad[_0xee7c('0x1e')],'headers':{'user-agent':_0xee7c('0x13')}};_0x2b33dc[_0xee7c('0x1f')](_0x37538,function(_0x6940b){if(_0x6940b[_0xee7c('0x14')]!==0xc8){_0x1294b6(new Error(_0xee7c('0x18')+_0x46c53d+_0xee7c('0x16')+_0x6940b[_0xee7c('0x14')]+'\x20('+_0x6940b['statusMessage']+')'));return;}var _0x443611='';_0x6940b['on'](_0xee7c('0x20'),function(_0x5e1da5){_0x443611+=_0x5e1da5;});_0x6940b['on'](_0xee7c('0x1d'),function(){_0x53de3f(_0x443611);});})['on'](_0xee7c('0x15'),function(_0x41c5a7){_0x1294b6(_0x41c5a7);})[_0xee7c('0x1d')]();});}function convertFile(_0x168289,_0x474e3d){return new BPromise(function(_0x692a35,_0x92d0cd){var _0x538e48=sox[_0xee7c('0x21')](_0x168289,_0x474e3d,{'sampleRate':0x1f40,'format':_0xee7c('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x538e48['on'](_0xee7c('0x15'),function(_0x58dbb5){logger['error'](_0xee7c('0x23'),_0x58dbb5);_0x92d0cd(_0x58dbb5);});_0x538e48['on'](_0xee7c('0x1d'),function(){logger[_0xee7c('0x1a')](_0xee7c('0x24'));_0x692a35();});_0x538e48[_0xee7c('0x25')]();});}function base64Decode(_0x2da04a,_0x5213e2){var _0x147b5c=path[_0xee7c('0x26')](__dirname,'tmp',rs[_0xee7c('0x27')](0x4)+_0xee7c('0x28'));fs[_0xee7c('0x29')](_0x147b5c,_0x2da04a,_0xee7c('0x2a'));return convertFile(_0x147b5c,_0x5213e2)['then'](function(){try{fs[_0xee7c('0x2b')](_0x147b5c);fs[_0xee7c('0x2c')](_0x5213e2,_0xee7c('0x2d'));}catch(_0x5d2ae2){logger[_0xee7c('0x15')](_0x5d2ae2);}return _0x5213e2[_0xee7c('0x2e')]('.')[0x0];});}function base64Encode(_0x2c320e){var _0x3127f2=fs[_0xee7c('0x2f')](_0x2c320e);return new Buffer(_0x3127f2)[_0xee7c('0x30')]('base64');}exports[_0xee7c('0x31')]=function(_0x14303f,_0xbf88e3,_0x3cf2c3,_0x2d1edd,_0x4d9781,_0x580cd0){var _0xe524f0,_0x12d950;var _0x31e520=_0xee7c('0x32');var _0x3287dd=_0xee7c('0x33')+_0x14303f;var _0x6a03ee={};if(_0xbf88e3===_0xee7c('0x34')){_0x6a03ee[_0xee7c('0x35')]={'ssml':_0x3cf2c3};}else{_0x6a03ee['input']={'text':_0x3cf2c3};};_0x6a03ee['voice']={'languageCode':_0x2d1edd,'ssmlGender':_0x4d9781};_0x6a03ee['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x15bb5f={'url':_0x31e520+_0xee7c('0x36')+_0x3287dd,'method':'POST','json':!![],'body':_0x6a03ee};return rp(_0x15bb5f)[_0xee7c('0x37')](function(_0x10aa12){return new BPromise(function(_0x55d3ed,_0x58149b){_0xe524f0=path[_0xee7c('0x26')](__dirname,_0xee7c('0x38'),rs[_0xee7c('0x27')](0x4)+_0xee7c('0x39'));var _0x154170=Buffer[_0xee7c('0x3a')](_0x10aa12['audioContent'],_0xee7c('0x2a'));return fs[_0xee7c('0x3b')](_0xe524f0,_0x154170,function(_0x42a7bc){_0x58149b(_0x42a7bc);},function(_0x3e0053){fs[_0xee7c('0x2c')](_0xe524f0,_0xee7c('0x2d'));_0x55d3ed(_0x3e0053);});});})[_0xee7c('0x37')](function(_0x2f073c){_0x12d950=path[_0xee7c('0x26')](__dirname,_0xee7c('0x38'),rs[_0xee7c('0x27')](0x4)+'.wav');return convertFile(_0xe524f0,_0x12d950);})[_0xee7c('0x37')](function(){try{fs[_0xee7c('0x2b')](_0xe524f0);fs[_0xee7c('0x2c')](_0x12d950,_0xee7c('0x2d'));}catch(_0x4b8056){logger['error'](_0x4b8056);}logger[_0xee7c('0x1a')](_0xee7c('0x3c'),_0x12d950['split']('.')[0x0]);return _0x12d950['split']('.')[0x0];});};exports[_0xee7c('0x3d')]=function(_0x1cfc9d,_0x1c6135){var _0x7d146e,_0x348831;return tts(_0x1cfc9d,_0x1c6135||'en',0x1)[_0xee7c('0x37')](function(_0x11218d){logger[_0xee7c('0x1a')](_0x11218d);_0x7d146e=path[_0xee7c('0x26')](__dirname,_0xee7c('0x38'),rs[_0xee7c('0x27')](0x4)+_0xee7c('0x39'));return downloadFile(_0x11218d,_0x7d146e);})[_0xee7c('0x37')](function(){_0x348831=path['resolve'](__dirname,'tmp',rs[_0xee7c('0x27')](0x4)+'.wav');return convertFile(_0x7d146e,_0x348831);})[_0xee7c('0x37')](function(){try{fs[_0xee7c('0x2b')](_0x7d146e);fs[_0xee7c('0x2c')](_0x348831,'777');}catch(_0x31abb8){logger['error'](_0x31abb8);}logger[_0xee7c('0x1a')](_0xee7c('0x3e'),_0x348831[_0xee7c('0x2e')]('.')[0x0]);return _0x348831[_0xee7c('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x2bf51b,_0x29d806,_0x2a5878){return google[_0xee7c('0x3f')](_0x2bf51b,_0x29d806,_0x2a5878)[_0xee7c('0x37')](function(_0xac034b){logger[_0xee7c('0x1a')](_0xac034b[_0xee7c('0x40')]);return rp(_0xac034b);})['then'](function(_0x163645){var _0x18a9b1='';var _0x543369=0x0;try{fs[_0xee7c('0x2b')](_0x2bf51b);}catch(_0x1bc0f9){logger[_0xee7c('0x15')](_0x1bc0f9);}if(_0x163645&&_0x163645[_0xee7c('0x41')]){_0x18a9b1=_0x163645['results'][_0xee7c('0x42')](function(_0x45a2cb){return _0x45a2cb&&_0x45a2cb[_0xee7c('0x43')][0x0]&&_0x45a2cb['alternatives'][0x0][_0xee7c('0x44')]?_0x45a2cb[_0xee7c('0x43')][0x0][_0xee7c('0x44')]:'';})[_0xee7c('0x45')]('\x0a');_0x543369=_0x163645[_0xee7c('0x41')][_0xee7c('0x42')](function(_0x146cb4){return _0x146cb4&&_0x146cb4[_0xee7c('0x43')][0x0]&&_0x146cb4[_0xee7c('0x43')][0x0][_0xee7c('0x46')]?_0x146cb4['alternatives'][0x0]['confidence']:0x0;})[_0xee7c('0x45')]('\x0a');}logger[_0xee7c('0x1a')](_0xee7c('0x47'),_0x18a9b1);logger[_0xee7c('0x1a')](_0xee7c('0x48'),_0x543369);return{'transcript':_0x18a9b1,'confidence':_0x543369};})['catch'](function(_0x53668a){logger[_0xee7c('0x15')](_0xee7c('0x49'),_0x53668a['statusCode'],_0x53668a[_0xee7c('0x4a')],_0x53668a[_0xee7c('0x4b')]);});};exports['googleDialogflow']=function(_0x1f5f0c,_0x197e64,_0x1a548a,_0xb8eb2d){var _0x1e6dd9=apiai(_0x197e64,{'language':_0xb8eb2d||'en'});return _0x1e6dd9[_0xee7c('0x4c')](_0x1a548a,{'sessionId':md5(_0x1f5f0c)})[_0xee7c('0x37')](function(_0x166f79){logger[_0xee7c('0x1a')](JSON['stringify'](_0x166f79));return{'source':_0x166f79[_0xee7c('0x4d')][_0xee7c('0x4e')],'resolvedQuery':_0x166f79[_0xee7c('0x4d')][_0xee7c('0x4f')],'action':_0x166f79[_0xee7c('0x4d')][_0xee7c('0x50')],'actionIncomplete':_0x166f79['result'][_0xee7c('0x51')],'speech':_0x166f79[_0xee7c('0x4d')][_0xee7c('0x52')][_0xee7c('0x53')],'score':_0x166f79[_0xee7c('0x4d')][_0xee7c('0x54')],'statusCode':_0x166f79[_0xee7c('0x55')]['code'],'endConversation':_0x166f79[_0xee7c('0x4d')][_0xee7c('0x56')][_0xee7c('0x57')]||![],'isFallbackIntent':_0x166f79[_0xee7c('0x4d')][_0xee7c('0x56')]['isFallbackIntent']};});};exports['tildeASR']=function(_0x125b54,_0x4c1052,_0x1e1f51,_0x90d5e4){return tilde[_0xee7c('0x3f')](_0x125b54,_0x4c1052,_0x1e1f51,_0x90d5e4)['then'](function(_0x3b7afd){try{fs['unlink'](_0x125b54);}catch(_0x115dcf){logger[_0xee7c('0x15')](_0x115dcf);}logger['info'](_0xee7c('0x58'),_0x3b7afd[_0xee7c('0x44')]);logger[_0xee7c('0x1a')](_0xee7c('0x59'),_0x3b7afd['confidence']);return _0x3b7afd;});};exports[_0xee7c('0x5a')]=function(_0x217d77,_0x56e3b4,_0xf83930,_0x14e877,_0x1c1ae2,_0x150b86){var _0x304088=path['resolve'](__dirname,_0xee7c('0x38'),rs['generate'](0x4)+'.mp3');var _0x95261a;return aws[_0xee7c('0x5b')](_0x217d77,_0x56e3b4,_0xf83930,_0x14e877,_0x1c1ae2,_0x150b86,_0x304088)[_0xee7c('0x37')](function(){_0x95261a=path[_0xee7c('0x26')](__dirname,_0xee7c('0x38'),rs[_0xee7c('0x27')](0x4)+_0xee7c('0x28'));return convertFile(_0x304088,_0x95261a);})[_0xee7c('0x37')](function(){try{fs[_0xee7c('0x2b')](_0x304088);fs[_0xee7c('0x2c')](_0x95261a,_0xee7c('0x2d'));}catch(_0x5786cf){logger[_0xee7c('0x15')](_0x5786cf);}return _0x95261a[_0xee7c('0x2e')]('.')[0x0];});};exports[_0xee7c('0x5c')]=function(_0x57cd2c,_0x3fcb12,_0xd97550,_0x593b96,_0x1e522a,_0x4f2d49){return aws[_0xee7c('0x5d')](_0x57cd2c,_0x3fcb12,_0xd97550,_0x593b96,_0x1e522a,_0x4f2d49)['then'](function(_0xd4f97){logger[_0xee7c('0x1a')](JSON[_0xee7c('0x5e')](_0xd4f97));return _0xd4f97;});};exports[_0xee7c('0x5f')]=function(_0x320ea4,_0x97d476,_0x341621,_0x1efb37){var _0x3fcdf0=util['format'](_0xee7c('0x60'),ISPEECH_API,_0x320ea4,encodeURIComponent(_0x97d476),_0x341621,_0x1efb37);var _0x434ad7=path['resolve'](__dirname,_0xee7c('0x38'),rs['generate'](0x4)+'.mp3');var _0x1ab854;return downloadFile(_0x3fcdf0,_0x434ad7)['then'](function(){_0x1ab854=path[_0xee7c('0x26')](__dirname,_0xee7c('0x38'),rs[_0xee7c('0x27')](0x4)+_0xee7c('0x28'));return convertFile(_0x434ad7,_0x1ab854);})[_0xee7c('0x37')](function(){try{fs[_0xee7c('0x2b')](_0x434ad7);fs['chmodSync'](_0x1ab854,'777');}catch(_0x5d7ff5){logger[_0xee7c('0x15')](_0x5d7ff5);}return _0x1ab854[_0xee7c('0x2e')]('.')[0x0];});};exports[_0xee7c('0x61')]=function(_0x4a7294,_0x1e84d2,_0x4a9e8f,_0x350337){var _0x55638e=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1e84d2,_0x4a9e8f,base64Encode(_0x4a7294),_0x350337?util[_0xee7c('0x62')]('model=%s',encodeURIComponent(_0x350337)):_0xee7c('0x63'));return uploadFile(_0x55638e)[_0xee7c('0x37')](function(_0x15673e){return querystring[_0xee7c('0x64')](_0x15673e);});};exports[_0xee7c('0x65')]=function(_0x2a0ced,_0x5cf3ec){return sestek['nda'](_0x2a0ced,_0x5cf3ec)[_0xee7c('0x37')](function(_0x2c9a54){logger[_0xee7c('0x1a')](JSON['stringify'](_0x2c9a54));var _0x2e6181={'speech':_0x2c9a54[_0xee7c('0x66')],'action':_0x2c9a54[_0xee7c('0x67')]?_0x2c9a54['channelData'][_0xee7c('0x68')]:undefined,'actiondata':_0x2c9a54[_0xee7c('0x67')]?_0x2c9a54[_0xee7c('0x67')][_0xee7c('0x69')]:undefined};if(_0x2c9a54[_0xee7c('0x67')]&&_0x2c9a54[_0xee7c('0x67')]['AudioFromTts']){return base64Decode(_0x2c9a54[_0xee7c('0x67')][_0xee7c('0x6a')][_0xee7c('0x6b')],path[_0xee7c('0x26')](__dirname,_0xee7c('0x38'),rs[_0xee7c('0x27')](0x4)+_0xee7c('0x28')))[_0xee7c('0x37')](function(_0x1c8c79){_0x2e6181[_0xee7c('0x6c')]=_0x1c8c79;return _0x2e6181;});}return _0x2e6181;});};exports[_0xee7c('0x6d')]=function(){return __dirname;}; \ No newline at end of file +var _0x7f22=['name','textRequest','result','source','resolvedQuery','action','actionIncomplete','speech','score','code','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','stringify','%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','nda','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','path','http','https','url','parse','sox','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','./tilde','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','end','data','transcode','error\x20convert','finish\x20to\x20convert','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','resolve','.mp3','writeFile','googleTTS','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7f22,0x1c5));var _0x27f2=function(_0x10ad6a,_0x107e07){_0x10ad6a=_0x10ad6a-0x0;var _0xf5e24f=_0x7f22[_0x10ad6a];return _0xf5e24f;};'use strict';var fs=require('fs');var path=require(_0x27f2('0x0'));var http=require(_0x27f2('0x1'));var https=require(_0x27f2('0x2'));var urlParse=require(_0x27f2('0x3'))[_0x27f2('0x4')];var BPromise=require('bluebird');var rs=require('randomstring');var sox=require(_0x27f2('0x5'));var rp=require(_0x27f2('0x6'));var util=require('util');var querystring=require(_0x27f2('0x7'));var tts=require(_0x27f2('0x8'));var apiai=require(_0x27f2('0x9'));var md5=require(_0x27f2('0xa'));var google=require(_0x27f2('0xb'));var aws=require('./aws');var tilde=require(_0x27f2('0xc'));var sestek=require(_0x27f2('0xd'));var logger=require('../../../config/logger')(_0x27f2('0xe'));var ISPEECH_API=_0x27f2('0xf');function downloadFile(_0x1d27f8,_0x5ac002){return new BPromise(function(_0xe6842c,_0x7beb4d){var _0x384432=urlParse(_0x1d27f8);var _0x4767aa=_0x384432[_0x27f2('0x10')]===_0x27f2('0x11')?https:http;var _0x36873b={'host':_0x384432[_0x27f2('0x12')],'path':_0x384432[_0x27f2('0x0')],'headers':{'user-agent':_0x27f2('0x13')}};_0x4767aa[_0x27f2('0x14')](_0x36873b,function(_0xb3d62f){if(_0xb3d62f[_0x27f2('0x15')]!==0xc8){logger[_0x27f2('0x16')](_0x27f2('0x17')+_0x1d27f8+_0x27f2('0x18')+_0xb3d62f[_0x27f2('0x15')]+'\x20('+_0xb3d62f[_0x27f2('0x19')]+')');_0x7beb4d(new Error(_0x27f2('0x17')+_0x1d27f8+_0x27f2('0x18')+_0xb3d62f['statusCode']+'\x20('+_0xb3d62f[_0x27f2('0x19')]+')'));return;}var _0x345459=fs[_0x27f2('0x1a')](_0x5ac002);_0x345459['on'](_0x27f2('0x1b'),function(){logger[_0x27f2('0x1c')](_0x27f2('0x1d'));_0x345459['close'](_0xe6842c);});_0x345459['on'](_0x27f2('0x16'),function(_0x20da17){fs[_0x27f2('0x1e')](_0x5ac002);logger['error'](_0x27f2('0x1f'),_0x20da17);_0x7beb4d(_0x20da17);});_0xb3d62f['pipe'](_0x345459);})['on'](_0x27f2('0x16'),function(_0x16201d){logger['error'](_0x16201d);_0x7beb4d(_0x16201d);})[_0x27f2('0x20')]();});}function uploadFile(_0x6dd8f5){return new BPromise(function(_0x1e6aee,_0x5955e4){var _0x3ce653=urlParse(_0x6dd8f5);var _0xde724d=_0x3ce653['protocol']===_0x27f2('0x11')?https:http;var _0x3c3fa9={'host':_0x3ce653[_0x27f2('0x12')],'path':_0x3ce653[_0x27f2('0x0')],'headers':{'user-agent':_0x27f2('0x13')}};_0xde724d[_0x27f2('0x14')](_0x3c3fa9,function(_0x1f3eb8){if(_0x1f3eb8[_0x27f2('0x15')]!==0xc8){_0x5955e4(new Error('request\x20to\x20'+_0x6dd8f5+'\x20failed,\x20status\x20code\x20=\x20'+_0x1f3eb8[_0x27f2('0x15')]+'\x20('+_0x1f3eb8[_0x27f2('0x19')]+')'));return;}var _0x1741a4='';_0x1f3eb8['on'](_0x27f2('0x21'),function(_0x5bcc3c){_0x1741a4+=_0x5bcc3c;});_0x1f3eb8['on']('end',function(){_0x1e6aee(_0x1741a4);});})['on'](_0x27f2('0x16'),function(_0x472485){_0x5955e4(_0x472485);})[_0x27f2('0x20')]();});}function convertFile(_0x449158,_0x36f099){return new BPromise(function(_0x3bd1b4,_0x972095){var _0x4df262=sox[_0x27f2('0x22')](_0x449158,_0x36f099,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4df262['on']('error',function(_0xf9c42b){logger[_0x27f2('0x16')](_0x27f2('0x23'),_0xf9c42b);_0x972095(_0xf9c42b);});_0x4df262['on'](_0x27f2('0x20'),function(){logger[_0x27f2('0x1c')](_0x27f2('0x24'));_0x3bd1b4();});_0x4df262['start']();});}function base64Decode(_0x14a1d1,_0x2be570){var _0x5f13d4=path['resolve'](__dirname,_0x27f2('0x25'),rs[_0x27f2('0x26')](0x4)+_0x27f2('0x27'));fs[_0x27f2('0x28')](_0x5f13d4,_0x14a1d1,_0x27f2('0x29'));return convertFile(_0x5f13d4,_0x2be570)[_0x27f2('0x2a')](function(){try{fs[_0x27f2('0x1e')](_0x5f13d4);fs[_0x27f2('0x2b')](_0x2be570,_0x27f2('0x2c'));}catch(_0x219e7e){logger['error'](_0x219e7e);}return _0x2be570[_0x27f2('0x2d')]('.')[0x0];});}function base64Encode(_0x27fa74){var _0x232984=fs['readFileSync'](_0x27fa74);return new Buffer(_0x232984)[_0x27f2('0x2e')]('base64');}exports[_0x27f2('0x2f')]=function(_0x54e072,_0x38fa79,_0x42c71b,_0x2074e9,_0x37e027,_0x2404a4){var _0x394f5a,_0x29d008;var _0x4286d6=_0x27f2('0x30');var _0x199614=_0x27f2('0x31')+_0x54e072;var _0x3301b4={};if(_0x38fa79===_0x27f2('0x32')){_0x3301b4[_0x27f2('0x33')]={'ssml':_0x42c71b};}else{_0x3301b4[_0x27f2('0x33')]={'text':_0x42c71b};};_0x3301b4[_0x27f2('0x34')]={'languageCode':_0x2074e9,'ssmlGender':_0x37e027};_0x3301b4[_0x27f2('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x3b9447={'url':_0x4286d6+_0x27f2('0x36')+_0x199614,'method':'POST','json':!![],'body':_0x3301b4};return rp(_0x3b9447)['then'](function(_0x5c7703){return new BPromise(function(_0x824278,_0x3caa35){_0x394f5a=path[_0x27f2('0x37')](__dirname,_0x27f2('0x25'),rs['generate'](0x4)+_0x27f2('0x38'));var _0x54a7c4=Buffer['from'](_0x5c7703['audioContent'],_0x27f2('0x29'));return fs[_0x27f2('0x39')](_0x394f5a,_0x54a7c4,function(_0x539ab1){_0x3caa35(_0x539ab1);},function(_0x36a930){fs[_0x27f2('0x2b')](_0x394f5a,'777');_0x824278(_0x36a930);});});})[_0x27f2('0x2a')](function(_0xfa1f15){_0x29d008=path[_0x27f2('0x37')](__dirname,_0x27f2('0x25'),rs[_0x27f2('0x26')](0x4)+'.wav');return convertFile(_0x394f5a,_0x29d008);})[_0x27f2('0x2a')](function(){try{fs[_0x27f2('0x1e')](_0x394f5a);fs[_0x27f2('0x2b')](_0x29d008,_0x27f2('0x2c'));}catch(_0xcc21bf){logger[_0x27f2('0x16')](_0xcc21bf);}logger['info']('googleCloudTTS\x20path',_0x29d008[_0x27f2('0x2d')]('.')[0x0]);return _0x29d008[_0x27f2('0x2d')]('.')[0x0];});};exports[_0x27f2('0x3a')]=function(_0xa3a4ce,_0x5afb32){var _0x2a88dd,_0x4b0421;return tts(_0xa3a4ce,_0x5afb32||'en',0x1)[_0x27f2('0x2a')](function(_0x11edb2){logger[_0x27f2('0x1c')](_0x11edb2);_0x2a88dd=path[_0x27f2('0x37')](__dirname,_0x27f2('0x25'),rs[_0x27f2('0x26')](0x4)+_0x27f2('0x38'));return downloadFile(_0x11edb2,_0x2a88dd);})[_0x27f2('0x2a')](function(){_0x4b0421=path['resolve'](__dirname,_0x27f2('0x25'),rs[_0x27f2('0x26')](0x4)+_0x27f2('0x27'));return convertFile(_0x2a88dd,_0x4b0421);})[_0x27f2('0x2a')](function(){try{fs['unlink'](_0x2a88dd);fs['chmodSync'](_0x4b0421,_0x27f2('0x2c'));}catch(_0x16601a){logger[_0x27f2('0x16')](_0x16601a);}logger[_0x27f2('0x1c')](_0x27f2('0x3b'),_0x4b0421[_0x27f2('0x2d')]('.')[0x0]);return _0x4b0421[_0x27f2('0x2d')]('.')[0x0];});};exports[_0x27f2('0x3c')]=function(_0x511961,_0x1bb789,_0x24a8db){return google[_0x27f2('0x3d')](_0x511961,_0x1bb789,_0x24a8db)[_0x27f2('0x2a')](function(_0xba1955){logger[_0x27f2('0x1c')](_0xba1955['uri']);return rp(_0xba1955);})[_0x27f2('0x2a')](function(_0x8cde00){var _0x414800='';var _0x544206=0x0;try{fs[_0x27f2('0x1e')](_0x511961);}catch(_0x4f87c7){logger['error'](_0x4f87c7);}if(_0x8cde00&&_0x8cde00[_0x27f2('0x3e')]){_0x414800=_0x8cde00[_0x27f2('0x3e')]['map'](function(_0x13f8fd){return _0x13f8fd&&_0x13f8fd[_0x27f2('0x3f')][0x0]&&_0x13f8fd[_0x27f2('0x3f')][0x0][_0x27f2('0x40')]?_0x13f8fd[_0x27f2('0x3f')][0x0][_0x27f2('0x40')]:'';})[_0x27f2('0x41')]('\x0a');_0x544206=_0x8cde00[_0x27f2('0x3e')][_0x27f2('0x42')](function(_0x53f868){return _0x53f868&&_0x53f868[_0x27f2('0x3f')][0x0]&&_0x53f868[_0x27f2('0x3f')][0x0][_0x27f2('0x43')]?_0x53f868[_0x27f2('0x3f')][0x0][_0x27f2('0x43')]:0x0;})[_0x27f2('0x41')]('\x0a');}logger[_0x27f2('0x1c')](_0x27f2('0x44'),_0x414800);logger[_0x27f2('0x1c')](_0x27f2('0x45'),_0x544206);return{'transcript':_0x414800,'confidence':_0x544206};})[_0x27f2('0x46')](function(_0x5da9b5){logger[_0x27f2('0x16')](_0x27f2('0x47'),_0x5da9b5[_0x27f2('0x15')],_0x5da9b5[_0x27f2('0x48')],_0x5da9b5['message']);});};exports['googleDialogflow']=function(_0xad9e25,_0x599992,_0x372112,_0x3e7256){var _0x3bc296=apiai(_0x599992,{'language':_0x3e7256||'en'});return _0x3bc296[_0x27f2('0x49')](_0x372112,{'sessionId':md5(_0xad9e25)})[_0x27f2('0x2a')](function(_0x37184f){logger['info'](JSON['stringify'](_0x37184f));return{'source':_0x37184f[_0x27f2('0x4a')][_0x27f2('0x4b')],'resolvedQuery':_0x37184f[_0x27f2('0x4a')][_0x27f2('0x4c')],'action':_0x37184f[_0x27f2('0x4a')][_0x27f2('0x4d')],'actionIncomplete':_0x37184f[_0x27f2('0x4a')][_0x27f2('0x4e')],'speech':_0x37184f[_0x27f2('0x4a')]['fulfillment'][_0x27f2('0x4f')],'score':_0x37184f[_0x27f2('0x4a')][_0x27f2('0x50')],'statusCode':_0x37184f['status'][_0x27f2('0x51')],'endConversation':_0x37184f[_0x27f2('0x4a')]['metadata'][_0x27f2('0x52')]||![],'isFallbackIntent':_0x37184f[_0x27f2('0x4a')]['metadata'][_0x27f2('0x53')]};});};exports[_0x27f2('0x54')]=function(_0x1ac6b8,_0x56e281,_0x4dc103,_0x59156f){return tilde[_0x27f2('0x3d')](_0x1ac6b8,_0x56e281,_0x4dc103,_0x59156f)[_0x27f2('0x2a')](function(_0x5d4733){try{fs[_0x27f2('0x1e')](_0x1ac6b8);}catch(_0x1f71e9){logger[_0x27f2('0x16')](_0x1f71e9);}logger['info'](_0x27f2('0x55'),_0x5d4733[_0x27f2('0x40')]);logger[_0x27f2('0x1c')](_0x27f2('0x56'),_0x5d4733['confidence']);return _0x5d4733;});};exports[_0x27f2('0x57')]=function(_0x4add21,_0xe505a6,_0x27f784,_0x5104ae,_0xde29a,_0x106132){var _0x7fdd30=path[_0x27f2('0x37')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x431304;return aws[_0x27f2('0x58')](_0x4add21,_0xe505a6,_0x27f784,_0x5104ae,_0xde29a,_0x106132,_0x7fdd30)[_0x27f2('0x2a')](function(){_0x431304=path[_0x27f2('0x37')](__dirname,_0x27f2('0x25'),rs[_0x27f2('0x26')](0x4)+'.wav');return convertFile(_0x7fdd30,_0x431304);})[_0x27f2('0x2a')](function(){try{fs[_0x27f2('0x1e')](_0x7fdd30);fs['chmodSync'](_0x431304,_0x27f2('0x2c'));}catch(_0x1ff34d){logger[_0x27f2('0x16')](_0x1ff34d);}return _0x431304['split']('.')[0x0];});};exports[_0x27f2('0x59')]=function(_0x480a0a,_0x3a3c1e,_0x4e02b9,_0x9ce153,_0x189afd,_0xbefa17){return aws[_0x27f2('0x5a')](_0x480a0a,_0x3a3c1e,_0x4e02b9,_0x9ce153,_0x189afd,_0xbefa17)[_0x27f2('0x2a')](function(_0x169532){logger['info'](JSON[_0x27f2('0x5b')](_0x169532));return _0x169532;});};exports['ispeechTTS']=function(_0x4cfe42,_0x1d48a4,_0x463856,_0x3cc0b1){var _0x25e7e6=util['format'](_0x27f2('0x5c'),ISPEECH_API,_0x4cfe42,encodeURIComponent(_0x1d48a4),_0x463856,_0x3cc0b1);var _0x4e07cb=path[_0x27f2('0x37')](__dirname,_0x27f2('0x25'),rs[_0x27f2('0x26')](0x4)+_0x27f2('0x38'));var _0x2e1e7c;return downloadFile(_0x25e7e6,_0x4e07cb)[_0x27f2('0x2a')](function(){_0x2e1e7c=path[_0x27f2('0x37')](__dirname,_0x27f2('0x25'),rs[_0x27f2('0x26')](0x4)+_0x27f2('0x27'));return convertFile(_0x4e07cb,_0x2e1e7c);})[_0x27f2('0x2a')](function(){try{fs[_0x27f2('0x1e')](_0x4e07cb);fs[_0x27f2('0x2b')](_0x2e1e7c,_0x27f2('0x2c'));}catch(_0x41e12c){logger[_0x27f2('0x16')](_0x41e12c);}return _0x2e1e7c[_0x27f2('0x2d')]('.')[0x0];});};exports[_0x27f2('0x5d')]=function(_0x666036,_0x1433b2,_0xbe9fa7,_0x365b53){var _0x4b15e5=util[_0x27f2('0x5e')](_0x27f2('0x5f'),ISPEECH_API,_0x1433b2,_0xbe9fa7,base64Encode(_0x666036),_0x365b53?util['format'](_0x27f2('0x60'),encodeURIComponent(_0x365b53)):_0x27f2('0x61'));return uploadFile(_0x4b15e5)[_0x27f2('0x2a')](function(_0xcf0496){return querystring[_0x27f2('0x4')](_0xcf0496);});};exports['sestekNDA']=function(_0x413584,_0x3346f7){return sestek[_0x27f2('0x62')](_0x413584,_0x3346f7)[_0x27f2('0x2a')](function(_0x1e065d){logger[_0x27f2('0x1c')](JSON[_0x27f2('0x5b')](_0x1e065d));var _0xeb8802={'speech':_0x1e065d['text'],'action':_0x1e065d[_0x27f2('0x63')]?_0x1e065d['channelData'][_0x27f2('0x64')]:undefined,'actiondata':_0x1e065d[_0x27f2('0x63')]?_0x1e065d[_0x27f2('0x63')]['CustomActionData']:undefined};if(_0x1e065d['channelData']&&_0x1e065d[_0x27f2('0x63')][_0x27f2('0x65')]){return base64Decode(_0x1e065d['channelData']['AudioFromTts'][_0x27f2('0x66')],path[_0x27f2('0x37')](__dirname,_0x27f2('0x25'),rs[_0x27f2('0x26')](0x4)+_0x27f2('0x27')))[_0x27f2('0x2a')](function(_0xfb8ef){_0xeb8802[_0x27f2('0x67')]=_0xfb8ef;return _0xeb8802;});}return _0xeb8802;});};exports[_0x27f2('0x68')]=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 c8e5c95..7e730c4 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 _0x1f5a=['exports'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x1f5a,0xe3));var _0xa1f5=function(_0xf85898,_0x2a4cef){_0xf85898=_0xf85898-0x0;var _0x5bd808=_0x1f5a[_0xf85898];return _0x5bd808;};var nda=require('./nda');module[_0xa1f5('0x0')]={'nda':nda}; \ No newline at end of file +var _0x9f00=['exports','./nda'];(function(_0xbedebe,_0x49443f){var _0x2e3813=function(_0x389ed5){while(--_0x389ed5){_0xbedebe['push'](_0xbedebe['shift']());}};_0x2e3813(++_0x49443f);}(_0x9f00,0xcd));var _0x09f0=function(_0x3f758f,_0x302451){_0x3f758f=_0x3f758f-0x0;var _0x26e4ae=_0x9f00[_0x3f758f];return _0x26e4ae;};var nda=require(_0x09f0('0x0'));module[_0x09f0('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index cfb0ea2..05e49bd 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 _0x5883=['username','ndassistant_url','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','request-promise','../../../../../config/logger','exports','POST','resolve','password'];(function(_0x14b1a3,_0x6aaaa8){var _0x2f7ad3=function(_0x481a17){while(--_0x481a17){_0x14b1a3['push'](_0x14b1a3['shift']());}};_0x2f7ad3(++_0x6aaaa8);}(_0x5883,0x159));var _0x3588=function(_0x3304e8,_0x220f67){_0x3304e8=_0x3304e8-0x0;var _0xbd41c9=_0x5883[_0x3304e8];return _0xbd41c9;};'use strict';var rp=require(_0x3588('0x0'));var url=require('url');var logger=require(_0x3588('0x1'))('agi');module[_0x3588('0x2')]=function(_0xe97b01,_0x58aec3){var _0x2e9431={'method':_0x3588('0x3'),'uri':url[_0x3588('0x4')](_0x58aec3['ndauth_url'],'/token'),'form':{'grant_type':_0x3588('0x5'),'username':_0x58aec3[_0x3588('0x6')],'password':_0x58aec3[_0x3588('0x5')]},'json':!![]};return rp(_0x2e9431)['then'](function(_0x37427e){var _0x58eec8={'method':'POST','uri':url[_0x3588('0x4')](_0x58aec3[_0x3588('0x7')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x58aec3['ndaactivity_type']||_0x3588('0x8'),'channelId':_0x3588('0x9'),'conversation':{'id':_0xe97b01['uniqueid']},'from':{'id':_0xe97b01[_0x3588('0xa')],'name':_0xe97b01[_0x3588('0xb')]},'recipient':{'id':_0xe97b01[_0x3588('0xc')],'name':_0xe97b01[_0x3588('0xd')]},'text':_0x58aec3[_0x3588('0xe')],'channelData':{}},'headers':{'Authorization':_0x3588('0xf')+_0x37427e[_0x3588('0x10')]},'json':!![]};if(_0x58aec3[_0x3588('0x11')]){_0x58eec8[_0x3588('0x12')][_0x3588('0x13')][_0x3588('0x14')]=_0x58aec3[_0x3588('0x11')];}if(_0x58aec3[_0x3588('0x15')]=='1'){_0x58eec8[_0x3588('0x12')][_0x3588('0x13')][_0x3588('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x58aec3[_0x3588('0x17')]){_0x58eec8[_0x3588('0x12')][_0x3588('0x13')]['CustomAction']=_0x58aec3[_0x3588('0x17')];if(_0x58aec3[_0x3588('0x18')]){_0x58eec8[_0x3588('0x12')][_0x3588('0x13')][_0x3588('0x19')]=_0x58aec3['custom_action_data'];}}logger[_0x3588('0x1a')](JSON['stringify'](_0x58eec8));return rp(_0x58eec8);});}; \ No newline at end of file +var _0x8f6f=['then','ndassistant_url','ndaactivity_type','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','body','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','channelData','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','POST','resolve','password'];(function(_0x5df4cf,_0x3b64fe){var _0x2ed159=function(_0x87c905){while(--_0x87c905){_0x5df4cf['push'](_0x5df4cf['shift']());}};_0x2ed159(++_0x3b64fe);}(_0x8f6f,0xb7));var _0xf8f6=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x8f6f[_0x4ea69d];return _0x5318e0;};'use strict';var rp=require(_0xf8f6('0x0'));var url=require(_0xf8f6('0x1'));var logger=require('../../../../../config/logger')(_0xf8f6('0x2'));module['exports']=function(_0x3981a5,_0x28da36){var _0x3c8143={'method':_0xf8f6('0x3'),'uri':url[_0xf8f6('0x4')](_0x28da36['ndauth_url'],'/token'),'form':{'grant_type':_0xf8f6('0x5'),'username':_0x28da36['username'],'password':_0x28da36[_0xf8f6('0x5')]},'json':!![]};return rp(_0x3c8143)[_0xf8f6('0x6')](function(_0x1be519){var _0x488ba5={'method':_0xf8f6('0x3'),'uri':url['resolve'](_0x28da36[_0xf8f6('0x7')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x28da36[_0xf8f6('0x8')]||'message','channelId':_0xf8f6('0x9'),'conversation':{'id':_0x3981a5['uniqueid']},'from':{'id':_0x3981a5[_0xf8f6('0xa')],'name':_0x3981a5[_0xf8f6('0xb')]},'recipient':{'id':_0x3981a5[_0xf8f6('0xc')],'name':_0x3981a5[_0xf8f6('0xd')]},'text':_0x28da36[_0xf8f6('0xe')],'channelData':{}},'headers':{'Authorization':_0xf8f6('0xf')+_0x1be519['access_token']},'json':!![]};if(_0x28da36['project']){_0x488ba5[_0xf8f6('0x10')]['channelData']['ProjectName']=_0x28da36['project'];}if(_0x28da36[_0xf8f6('0x11')]=='1'){_0x488ba5[_0xf8f6('0x10')]['channelData'][_0xf8f6('0x12')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf8f6('0x13')};}if(_0x28da36[_0xf8f6('0x14')]){_0x488ba5['body'][_0xf8f6('0x15')][_0xf8f6('0x16')]=_0x28da36[_0xf8f6('0x14')];if(_0x28da36[_0xf8f6('0x17')]){_0x488ba5[_0xf8f6('0x10')][_0xf8f6('0x15')][_0xf8f6('0x18')]=_0x28da36[_0xf8f6('0x17')];}}logger[_0xf8f6('0x19')](JSON[_0xf8f6('0x1a')](_0x488ba5));return rp(_0x488ba5);});}; \ 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 2bec285..093f793 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 _0xa71a=['exports','./lib/api'];(function(_0x5d791b,_0x7e6f0c){var _0x31cf2e=function(_0x20ebc8){while(--_0x20ebc8){_0x5d791b['push'](_0x5d791b['shift']());}};_0x31cf2e(++_0x7e6f0c);}(_0xa71a,0x151));var _0xaa71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa71a[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0xaa71('0x0'));module[_0xaa71('0x1')]=function(_0x444113,_0xf0060b,_0x5d71e5,_0xdae8cc){return asr(_0x444113,_0xf0060b,_0x5d71e5,_0xdae8cc);}; \ No newline at end of file +var _0xa495=['./lib/api','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa495,0xcc));var _0x5a49=function(_0xb66224,_0x3a3f2f){_0xb66224=_0xb66224-0x0;var _0x346365=_0xa495[_0xb66224];return _0x346365;};'use strict';var asr=require(_0x5a49('0x0'));module[_0x5a49('0x1')]=function(_0x5a56b8,_0x749183,_0x24c93d,_0x1afb7b){return asr(_0x5a56b8,_0x749183,_0x24c93d,_0x1afb7b);}; \ 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 37fd72e..d2a5c85 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 _0xeb35=['Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final'];(function(_0x2fc5d4,_0x14708c){var _0x15fa14=function(_0x39b306){while(--_0x39b306){_0x2fc5d4['push'](_0x2fc5d4['shift']());}};_0x15fa14(++_0x14708c);}(_0xeb35,0x194));var _0x5eb3=function(_0x3f8efc,_0x491799){_0x3f8efc=_0x3f8efc-0x0;var _0x5177c9=_0xeb35[_0x3f8efc];return _0x5177c9;};'use strict';var BPromise=require(_0x5eb3('0x0'));var _=require(_0x5eb3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5eb3('0x2'));var crypto=require(_0x5eb3('0x3'));var logger=require('../../../../../../config/logger')(_0x5eb3('0x4'));module[_0x5eb3('0x5')]=function(_0xccce3f,_0x1bda80,_0x45c69b,_0x3420fd){return new BPromise(function(_0x9ed3fa,_0x351a4a){logger[_0x5eb3('0x6')](_0x5eb3('0x7'),_0x3420fd||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x38570a=new WebSocket(_0x3420fd||_0x5eb3('0x8'),{'perMessageDeflate':![]});var _0x20635a='';var _0x20f6b7='0';var _0x17ee23='1';var _0x26b9b5=_0x5eb3('0x9');function _0x370956(_0x5950ef){var _0x20346c=crypto['createHash'](_0x5eb3('0xa'));_0x20346c[_0x5eb3('0xb')](_0x5950ef);return _0x20346c[_0x5eb3('0xc')](_0x5eb3('0xd'));}function _0x4d6f0b(){try{logger[_0x5eb3('0x6')](_0x5eb3('0xe'));var _0x57be35=moment()['unix']();var _0x262464=_0x370956(_0x57be35+_0x1bda80+_0x45c69b);_0x38570a[_0x5eb3('0xf')](JSON[_0x5eb3('0x10')]({'appID':_0x1bda80,'timestamp':_0x57be35,'appKey':_0x262464}));var _0x4d137f=fs[_0x5eb3('0x11')](_0xccce3f);_0x4d137f['on'](_0x5eb3('0x12'),function(_0x358a89){_0x38570a[_0x5eb3('0xf')](_0x358a89);});_0x4d137f['on'](_0x5eb3('0x13'),function(){_0x38570a['send'](_0x5eb3('0x14'));});}catch(_0x32ef17){logger['error'](_0x5eb3('0x15'),JSON[_0x5eb3('0x10')](_0x32ef17));_0x38570a['terminate']();}}function _0x20f625(_0xf4e32a){try{if(_0xf4e32a){var _0x3b640b=JSON[_0x5eb3('0x16')](_0xf4e32a);switch(_0x3b640b[_0x5eb3('0x17')]){case 0x0:if(_0x3b640b['result']){if(_0x3b640b[_0x5eb3('0x18')][_0x5eb3('0x19')]){logger[_0x5eb3('0x6')](_0x5eb3('0x1a'),JSON[_0x5eb3('0x10')](_0x3b640b[_0x5eb3('0x18')][_0x5eb3('0x1b')]));_0x20635a=_0x3b640b['result'][_0x5eb3('0x1b')][0x0][_0x5eb3('0x1c')];_0x20f6b7=_0x3b640b['result'][_0x5eb3('0x1b')][0x0][_0x5eb3('0x1d')];_0x17ee23='0';_0x26b9b5=_0x5eb3('0x1e');_0x38570a['terminate']();}}break;case 0x1:logger[_0x5eb3('0x6')](_0x5eb3('0x9'));_0x17ee23='1';_0x26b9b5=_0x5eb3('0x9');break;case 0x2:logger[_0x5eb3('0x6')](_0x5eb3('0x1f'));_0x17ee23='2';_0x26b9b5=_0x5eb3('0x1f');break;case 0x9:logger[_0x5eb3('0x6')](_0x5eb3('0x20'));_0x17ee23='9';_0x26b9b5=_0x5eb3('0x20');break;case 0xa:logger[_0x5eb3('0x6')](_0x5eb3('0x21'));_0x17ee23='10';_0x26b9b5=_0x5eb3('0x21');break;case 0xb:logger[_0x5eb3('0x6')](_0x5eb3('0x22'));_0x17ee23='11';_0x26b9b5=_0x5eb3('0x22');}}}catch(_0x26a072){logger['error'](_0x5eb3('0x23'),JSON[_0x5eb3('0x10')](_0x26a072));_0x38570a[_0x5eb3('0x24')]();}}function _0x4df1c3(){logger['info'](_0x5eb3('0x25'));_0x9ed3fa({'transcript':_0x20635a,'confidence':_0x20f6b7,'status':_0x17ee23,'status_message':_0x26b9b5});}function _0x483e5f(_0x520a8f){logger[_0x5eb3('0x26')](_0x5eb3('0x27'));if(!_[_0x5eb3('0x28')](_0x520a8f)){logger[_0x5eb3('0x26')](_['isObject'](_0x520a8f)?JSON[_0x5eb3('0x10')](_0x520a8f):_0x520a8f);}}_0x38570a['on'](_0x5eb3('0x29'),_0x4d6f0b);_0x38570a['on'](_0x5eb3('0x2a'),_0x20f625);_0x38570a['on']('close',_0x4df1c3);_0x38570a['on'](_0x5eb3('0x26'),_0x483e5f);});}; \ No newline at end of file +var _0xedf5=['open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','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','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','EOS','error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject'];(function(_0x21c69c,_0x1b7535){var _0x2acd03=function(_0x4c70f0){while(--_0x4c70f0){_0x21c69c['push'](_0x21c69c['shift']());}};_0x2acd03(++_0x1b7535);}(_0xedf5,0x1cb));var _0x5edf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xedf5[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x5edf('0x0'));var _=require(_0x5edf('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5edf('0x2'));var crypto=require(_0x5edf('0x3'));var logger=require(_0x5edf('0x4'))(_0x5edf('0x5'));module[_0x5edf('0x6')]=function(_0x2f79c2,_0x2ecdd2,_0x1d5670,_0x3733c2){return new BPromise(function(_0x40aeed,_0x19f45d){logger['info']('Tilde\x20URI',_0x3733c2||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x37610a=new WebSocket(_0x3733c2||_0x5edf('0x7'),{'perMessageDeflate':![]});var _0x508c05='';var _0x20d199='0';var _0x26d3ad='1';var _0xf6dda6=_0x5edf('0x8');function _0x33607e(_0x5ac8a6){var _0xd5f197=crypto['createHash'](_0x5edf('0x9'));_0xd5f197[_0x5edf('0xa')](_0x5ac8a6);return _0xd5f197['digest'](_0x5edf('0xb'));}function _0x7fafe0(){try{logger[_0x5edf('0xc')](_0x5edf('0xd'));var _0x58067d=moment()['unix']();var _0x8c7aae=_0x33607e(_0x58067d+_0x2ecdd2+_0x1d5670);_0x37610a[_0x5edf('0xe')](JSON[_0x5edf('0xf')]({'appID':_0x2ecdd2,'timestamp':_0x58067d,'appKey':_0x8c7aae}));var _0x1a9060=fs[_0x5edf('0x10')](_0x2f79c2);_0x1a9060['on']('data',function(_0x436a05){_0x37610a[_0x5edf('0xe')](_0x436a05);});_0x1a9060['on']('close',function(){_0x37610a[_0x5edf('0xe')](_0x5edf('0x11'));});}catch(_0x16049a){logger[_0x5edf('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x5edf('0xf')](_0x16049a));_0x37610a[_0x5edf('0x13')]();}}function _0x2d3ff7(_0x67ce40){try{if(_0x67ce40){var _0x44403c=JSON['parse'](_0x67ce40);switch(_0x44403c[_0x5edf('0x14')]){case 0x0:if(_0x44403c[_0x5edf('0x15')]){if(_0x44403c['result'][_0x5edf('0x16')]){logger[_0x5edf('0xc')](_0x5edf('0x17'),JSON['stringify'](_0x44403c[_0x5edf('0x15')]['hypotheses']));_0x508c05=_0x44403c[_0x5edf('0x15')][_0x5edf('0x18')][0x0][_0x5edf('0x19')];_0x20d199=_0x44403c[_0x5edf('0x15')]['hypotheses'][0x0][_0x5edf('0x1a')];_0x26d3ad='0';_0xf6dda6=_0x5edf('0x1b');_0x37610a[_0x5edf('0x13')]();}}break;case 0x1:logger[_0x5edf('0xc')](_0x5edf('0x8'));_0x26d3ad='1';_0xf6dda6='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x5edf('0xc')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x26d3ad='2';_0xf6dda6=_0x5edf('0x1c');break;case 0x9:logger[_0x5edf('0xc')](_0x5edf('0x1d'));_0x26d3ad='9';_0xf6dda6=_0x5edf('0x1d');break;case 0xa:logger['info']('Authentication\x20failed.');_0x26d3ad='10';_0xf6dda6=_0x5edf('0x1e');break;case 0xb:logger[_0x5edf('0xc')](_0x5edf('0x1f'));_0x26d3ad='11';_0xf6dda6=_0x5edf('0x1f');}}}catch(_0x72a479){logger[_0x5edf('0x12')](_0x5edf('0x20'),JSON[_0x5edf('0xf')](_0x72a479));_0x37610a[_0x5edf('0x13')]();}}function _0x36cd86(){logger[_0x5edf('0xc')]('Close\x20Tilde\x20ASR\x20socket');_0x40aeed({'transcript':_0x508c05,'confidence':_0x20d199,'status':_0x26d3ad,'status_message':_0xf6dda6});}function _0x4930fd(_0x2550b5){logger['error'](_0x5edf('0x21'));if(!_['isNil'](_0x2550b5)){logger[_0x5edf('0x12')](_[_0x5edf('0x22')](_0x2550b5)?JSON[_0x5edf('0xf')](_0x2550b5):_0x2550b5);}}_0x37610a['on'](_0x5edf('0x23'),_0x7fafe0);_0x37610a['on'](_0x5edf('0x24'),_0x2d3ff7);_0x37610a['on'](_0x5edf('0x25'),_0x36cd86);_0x37610a['on'](_0x5edf('0x12'),_0x4930fd);});}; \ 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 cd88aad..c407bd8 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 _0x167a=['./asr','exports'];(function(_0x19ade5,_0x3d302d){var _0x451fc2=function(_0x5f13d8){while(--_0x5f13d8){_0x19ade5['push'](_0x19ade5['shift']());}};_0x451fc2(++_0x3d302d);}(_0x167a,0xfa));var _0xa167=function(_0x2ada88,_0x25fe6b){_0x2ada88=_0x2ada88-0x0;var _0x10f7e6=_0x167a[_0x2ada88];return _0x10f7e6;};var asr=require(_0xa167('0x0'));module[_0xa167('0x1')]={'asr':asr}; \ No newline at end of file +var _0xa209=['./asr','exports'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xa209,0xb6));var _0x9a20=function(_0x61604,_0x49d3c9){_0x61604=_0x61604-0x0;var _0x5eec6f=_0xa209[_0x61604];return _0x5eec6f;};var asr=require(_0x9a20('0x0'));module[_0x9a20('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d2fafe0..b09dcef 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 _0x9f94=['nextTick','inherits','exports','util','net','events','./channel','127.0.0.1','call','emit','error','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code','close','E_AGI_SERVER_CLOSE'];(function(_0x5290ff,_0x262e92){var _0x811193=function(_0x18675d){while(--_0x18675d){_0x5290ff['push'](_0x5290ff['shift']());}};_0x811193(++_0x262e92);}(_0x9f94,0x1e7));var _0x49f9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f94[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x49f9('0x0'));var net=require(_0x49f9('0x1'));var EventEmitter=require(_0x49f9('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x49f9('0x3'));var AGIServer=function(_0x435860,_0xb643ef,_0x375856){var _0x18492d=this,_0x435860=_0x435860||0x11dd,_0xb643ef=_0xb643ef||_0x49f9('0x4'),_0x31a7fe=null,_0x3cd35a=0x0;EventEmitter[_0x49f9('0x5')](_0x18492d);function _0x2e0928(){if(!_0x435860){_0x18492d[_0x49f9('0x6')](_0x49f9('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x31a7fe=net['createServer']();_0x31a7fe[_0x49f9('0x8')](_0x435860,_0xb643ef);_0x31a7fe['on']('listening',function(){_0x18492d[_0x49f9('0x6')](_0x49f9('0x9'));});_0x31a7fe['on'](_0x49f9('0xa'),function(_0x57b58e){_0x31a7fe[_0x49f9('0xb')](function(_0x59bb47,_0x346b07){if(_0x59bb47){_0x18492d[_0x49f9('0x6')](_0x49f9('0x7'),new AGIError(_0x49f9('0xc'),_0x59bb47));}else if(_0x375856&&_0x375856<0x0){_0x18492d['emit']('error',new AGIError(_0x49f9('0xd')));_0x57b58e[_0x49f9('0xe')]();}else if(_0x375856&&_0x375856>0x0&&_0x375856<_0x346b07){_0x3cd35a+=0x1;_0x18492d[_0x49f9('0x6')](_0x49f9('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3cd35a));_0x57b58e['destroy']();}else{var _0x5f1577=new AGIChannel(_0x57b58e);_0x5f1577['on'](_0x49f9('0xf'),function(){_0x18492d['emit'](_0x49f9('0xa'),_0x5f1577);});}});});_0x31a7fe['on']('error',function(_0x398a05){_0x18492d[_0x49f9('0x6')]('error',new AGIError(_0x49f9('0xc'),_0x398a05[_0x49f9('0x10')]));});_0x31a7fe['on'](_0x49f9('0x11'),function(){_0x18492d[_0x49f9('0x6')](_0x49f9('0x11'),new AGIError(_0x49f9('0x12')));});}process[_0x49f9('0x13')](function(){_0x2e0928();});};util[_0x49f9('0x14')](AGIServer,EventEmitter);module[_0x49f9('0x15')]=function(_0x10ed61,_0x9dd864,_0x1971e3){return new AGIServer(_0x10ed61,_0x9dd864,_0x1971e3);}; \ No newline at end of file +var _0x3a32=['code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0x18f0e5,_0x25efb2){var _0x451860=function(_0xdee3db){while(--_0xdee3db){_0x18f0e5['push'](_0x18f0e5['shift']());}};_0x451860(++_0x25efb2);}(_0x3a32,0x9b));var _0x23a3=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x3a32[_0x42245d];return _0x4b211a;};'use strict';var util=require(_0x23a3('0x0'));var net=require(_0x23a3('0x1'));var EventEmitter=require(_0x23a3('0x2'))[_0x23a3('0x3')];var AGIError=require(_0x23a3('0x4'));var AGIChannel=require(_0x23a3('0x5'));var AGIServer=function(_0x2e484c,_0x4a1378,_0x480d99){var _0xc06a55=this,_0x2e484c=_0x2e484c||0x11dd,_0x4a1378=_0x4a1378||_0x23a3('0x6'),_0x3b1735=null,_0x529b70=0x0;EventEmitter[_0x23a3('0x7')](_0xc06a55);function _0xd4e907(){if(!_0x2e484c){_0xc06a55[_0x23a3('0x8')](_0x23a3('0x9'),new AGIError(_0x23a3('0xa')));return![];}_0x3b1735=net['createServer']();_0x3b1735[_0x23a3('0xb')](_0x2e484c,_0x4a1378);_0x3b1735['on'](_0x23a3('0xc'),function(){_0xc06a55['emit']('listening');});_0x3b1735['on'](_0x23a3('0xd'),function(_0xf9b603){_0x3b1735[_0x23a3('0xe')](function(_0x549dc5,_0x2137e4){if(_0x549dc5){_0xc06a55['emit'](_0x23a3('0x9'),new AGIError(_0x23a3('0xf'),_0x549dc5));}else if(_0x480d99&&_0x480d99<0x0){_0xc06a55[_0x23a3('0x8')]('error',new AGIError(_0x23a3('0x10')));_0xf9b603[_0x23a3('0x11')]();}else if(_0x480d99&&_0x480d99>0x0&&_0x480d99<_0x2137e4){_0x529b70+=0x1;_0xc06a55[_0x23a3('0x8')](_0x23a3('0x9'),new AGIError(_0x23a3('0x12'),_0x529b70));_0xf9b603['destroy']();}else{var _0x3c0e0e=new AGIChannel(_0xf9b603);_0x3c0e0e['on'](_0x23a3('0x13'),function(){_0xc06a55['emit'](_0x23a3('0xd'),_0x3c0e0e);});}});});_0x3b1735['on'](_0x23a3('0x9'),function(_0x480bcd){_0xc06a55[_0x23a3('0x8')](_0x23a3('0x9'),new AGIError(_0x23a3('0xf'),_0x480bcd[_0x23a3('0x14')]));});_0x3b1735['on'](_0x23a3('0x15'),function(){_0xc06a55[_0x23a3('0x8')](_0x23a3('0x15'),new AGIError(_0x23a3('0x16')));});}process['nextTick'](function(){_0xd4e907();});};util[_0x23a3('0x17')](AGIServer,EventEmitter);module[_0x23a3('0x18')]=function(_0x5ed775,_0x502144,_0x289eb7){return new AGIServer(_0x5ed775,_0x502144,_0x289eb7);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index f897577..d4fbbd9 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 _0xd70e=['POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','dialogflow_language','sestekNDA','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','clear','includes','clone','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','add','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','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\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','bot','googleDialogflow','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','file_id','no\x20file\x20audio\x20selected','getData','response','mindigit','maxdigit','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sendSMS\x20message','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','name','catch','then','getSquareProject','getSquareProjectById','getSquareOdbc','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','accountcode','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','method','timeout','number'];(function(_0x28253c,_0x1cf1b4){var _0xa357d8=function(_0x112da8){while(--_0x112da8){_0x28253c['push'](_0x28253c['shift']());}};_0xa357d8(++_0x1cf1b4);}(_0xd70e,0x157));var _0xed70=function(_0x5f02b3,_0x166c18){_0x5f02b3=_0x5f02b3-0x0;var _0x5eef60=_0xd70e[_0x5f02b3];return _0x5eef60;};'use strict';var fs=require('fs');var path=require(_0xed70('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0xed70('0x1'));var odbc=require(_0xed70('0x2'))();var rs=require(_0xed70('0x3'));var moment=require(_0xed70('0x4'));var Mustache=require(_0xed70('0x5'));var rp=require(_0xed70('0x6'));var logger=require(_0xed70('0x7'))('agi');var config=require(_0xed70('0x8'));var scripts=require(_0xed70('0x9'));var FILES_PATH=_0xed70('0xa');var recursiveMapAttributes=[_0xed70('0xb'),'rawBody'];var verticesWithRetry=[_0xed70('0xc'),'getdigits',_0xed70('0xd')];var AGIVertices=function(_0x5aa9e7,_0x3447f7,_0x26ca4f){this[_0xed70('0xe')]=_0x5aa9e7;this[_0xed70('0xf')]=_0x3447f7;this[_0xed70('0x10')]=_0x26ca4f;};AGIVertices[_0xed70('0x11')]['getVariable']=function(_0x1fa417,_0x1ed27e){this[_0xed70('0xf')][_0xed70('0x12')](_0x1fa417)['then'](function(_0x586da3){_0x1ed27e(null,_0x586da3?_0x586da3[_0xed70('0x13')]:![]);})[_0xed70('0x14')](function(_0x568d3e){_0x1ed27e(_0x568d3e);});};AGIVertices[_0xed70('0x11')]['getVoiceQueue']=function(_0x1f1334,_0xc9d1df){this[_0xed70('0xf')]['getVoiceQueueById'](_0x1f1334)[_0xed70('0x15')](function(_0x2801da){_0xc9d1df(null,_0x2801da?_0x2801da['name']:![]);})[_0xed70('0x14')](function(_0x345df8){_0xc9d1df(_0x345df8);});};AGIVertices[_0xed70('0x11')][_0xed70('0x16')]=function(_0x47f59e,_0xa04148){this[_0xed70('0xf')][_0xed70('0x17')](_0x47f59e)[_0xed70('0x15')](function(_0x58977b){_0xa04148(null,_0x58977b?_0x58977b[_0xed70('0x13')]:![]);})[_0xed70('0x14')](function(_0x3e8643){_0xa04148(_0x3e8643);});};AGIVertices[_0xed70('0x11')][_0xed70('0x18')]=function(_0x2213a2,_0x1c1db5){this[_0xed70('0xf')]['getSquareOdbcById'](_0x2213a2)[_0xed70('0x15')](function(_0x3cfaae){_0x1c1db5(null,_0x3cfaae?_0x3cfaae['dsn']:![]);})['catch'](function(_0x560381){_0x1c1db5(_0x560381);});};AGIVertices[_0xed70('0x11')]['getUser']=function(_0x5dc747,_0xa35579){this[_0xed70('0xf')]['getUserById'](_0x5dc747)['then'](function(_0x4f5ce9){_0xa35579(null,_0x4f5ce9?_0x4f5ce9[_0xed70('0x13')]:![]);})['catch'](function(_0x1c15dc){_0xa35579(_0x1c15dc);});};AGIVertices[_0xed70('0x11')][_0xed70('0x19')]=function(_0x1ae21c,_0x2dc394){this[_0xed70('0xf')][_0xed70('0x1a')](_0x1ae21c)[_0xed70('0x15')](function(_0x424628){_0x2dc394(null,_0x424628?_0x424628[_0xed70('0x13')]:![]);})[_0xed70('0x14')](function(_0x478abf){_0x2dc394(_0x478abf);});};AGIVertices[_0xed70('0x11')][_0xed70('0x1b')]=function(_0x113823,_0x5edca1){var _0x6243e2=this;this[_0xed70('0xf')][_0xed70('0x1c')](_0x113823)[_0xed70('0x15')](function(_0x4d167d){_0x5edca1(null,_0x4d167d?_0x6243e2['getSoundPath'](_0x4d167d[_0xed70('0x1d')]):![]);})['catch'](function(_0x576bb0){_0x5edca1(_0x576bb0);});};AGIVertices[_0xed70('0x11')]['getMailAccount']=function(_0x2e6043,_0x1ad9e5){this[_0xed70('0xf')][_0xed70('0x1e')](_0x2e6043)[_0xed70('0x15')](function(_0x33009d){_0x1ad9e5(null,_0x33009d?_0x33009d:![]);})['catch'](function(_0x513829){_0x1ad9e5(_0x513829);});};AGIVertices[_0xed70('0x11')][_0xed70('0x1f')]=function(_0x79b0d2,_0x554802,_0x44d727){this['mailRpc'][_0xed70('0x1f')](_0x79b0d2,_0x554802)[_0xed70('0x15')](function(){_0x44d727(null);})[_0xed70('0x14')](function(_0x429d1b){_0x44d727(_0x429d1b);});};AGIVertices[_0xed70('0x11')][_0xed70('0x20')]=function(_0x4b038f,_0x49e432){this[_0xed70('0xf')]['getIntervalById'](_0x4b038f)[_0xed70('0x15')](function(_0x4b8ed3){if(_0x4b8ed3){if(_0x4b8ed3[_0xed70('0x21')]){_0x49e432(null,[_0x4b8ed3[_0xed70('0x22')]]);}else{_0x49e432(null,_[_0xed70('0x23')](_0x4b8ed3[_0xed70('0x24')],_0xed70('0x22')));}}else{_0x49e432(null,![]);}})[_0xed70('0x14')](function(_0x24d9b8){_0x49e432(_0x24d9b8);});};AGIVertices[_0xed70('0x11')][_0xed70('0x25')]=function(_0x10db72){return util[_0xed70('0x26')](_0xed70('0x27'),FILES_PATH,_0x10db72);};AGIVertices[_0xed70('0x11')][_0xed70('0x28')]=function(_0x108521,_0x196f5b,_0x42ef67){odbc[_0xed70('0x29')](_0x108521,function(_0x391c54){if(_0x391c54){logger['error'](_0xed70('0x2a'),_0x391c54);_0x42ef67(_0x391c54);}else{logger[_0xed70('0x2b')](_0xed70('0x2c'));odbc[_0xed70('0x2d')](_0x196f5b,function(_0x485054,_0x24014f){if(_0x485054){logger['info'](_0xed70('0x2e'),_0x196f5b);_0x42ef67(_0x485054);}else{logger[_0xed70('0x2b')](_0xed70('0x2f'),_0x196f5b);odbc[_0xed70('0x30')](function(_0x21b105){if(_0x21b105){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x21b105);}_0x42ef67(null,_0x24014f);});}});}});};AGIVertices[_0xed70('0x11')]['getSmsAccount']=function(_0x341c53,_0x63088f){this[_0xed70('0xf')][_0xed70('0x31')](_0x341c53)[_0xed70('0x15')](function(_0x50a712){_0x63088f(null,_0x50a712?_0x50a712:![]);})['catch'](function(_0x3327b2){_0x63088f(_0x3327b2);});};AGIVertices[_0xed70('0x11')]['createSmsMessage']=function(_0x3d2e3a,_0x120385){this[_0xed70('0xf')]['createSmsMessage'](_0x3d2e3a)['then'](function(_0x541708){_0x120385(null,_0x541708);})[_0xed70('0x14')](function(_0x257a85){_0x120385(_0x257a85);});};AGIVertices[_0xed70('0x11')][_0xed70('0x32')]=function(_0x386a67,_0x4004bc,_0x37c9cb){this[_0xed70('0xf')][_0xed70('0x32')]({'uniqueid':this[_0xed70('0xe')][_0xed70('0x33')],'node':_0x386a67[_0xed70('0x34')],'application':_0x386a67[_0xed70('0x35')],'data':_0x4004bc||null,'project_name':this[_0xed70('0xe')][_0xed70('0x36')],'callerid':this[_0xed70('0xe')][_0xed70('0x37')]})[_0xed70('0x15')](function(_0x436be8){if(_0x37c9cb){_0x37c9cb(null,_0x436be8);}})[_0xed70('0x14')](function(_0x2663e2){if(_0x37c9cb){_0x37c9cb(_0x2663e2);}});};AGIVertices[_0xed70('0x11')]['createSquareRecording']=function(_0x2209ec,_0x423045,_0x228baf,_0x407680){this[_0xed70('0xf')][_0xed70('0x38')]({'uniqueid':this[_0xed70('0xe')][_0xed70('0x33')],'callerid':this[_0xed70('0xe')][_0xed70('0x37')],'calleridname':this[_0xed70('0xe')][_0xed70('0x39')],'context':this[_0xed70('0xe')][_0xed70('0x3a')],'extension':this[_0xed70('0xe')][_0xed70('0x3b')],'priority':this['channel']['priority'],'accountcode':this[_0xed70('0xe')][_0xed70('0x3c')],'dnid':this[_0xed70('0xe')]['dnid'],'projectName':this[_0xed70('0xe')][_0xed70('0x36')],'saveName':_0x423045,'filename':_0x2209ec['file']||_0x423045,'savePath':_0x228baf})[_0xed70('0x15')](function(_0x444162){_0x407680(null,_0x444162);})[_0xed70('0x14')](function(_0x7e5dba){_0x407680(_0x7e5dba);});};AGIVertices['prototype'][_0xed70('0x3d')]=function(_0x352c,_0x64a3d9,_0x387b6a){this[_0xed70('0xf')][_0xed70('0x3d')]({'uniqueid':this[_0xed70('0xe')][_0xed70('0x33')],'body':_0x352c,'direction':_0x64a3d9})[_0xed70('0x15')](function(_0xb45272){if(_0x387b6a){_0x387b6a(null,_0xb45272);}})[_0xed70('0x14')](function(_0x4450b8){if(_0x387b6a){_0x387b6a(_0x4450b8);}});};AGIVertices[_0xed70('0x11')]['createCmContact']=function(_0xadb11,_0x3f0511){this[_0xed70('0xf')][_0xed70('0x3e')]({'firstName':_[_0xed70('0x3f')](_0xadb11[_0xed70('0x13')])||_['isNil'](_0xadb11[_0xed70('0x13')])?_0xed70('0x40')+Math[_0xed70('0x41')]():_0xadb11[_0xed70('0x13')],'lastName':_[_0xed70('0x3f')](_0xadb11[_0xed70('0x42')])||_[_0xed70('0x43')](_0xadb11[_0xed70('0x42')])?null:_0xadb11['lastName'],'phone':_0xadb11[_0xed70('0x44')],'ListId':_0xadb11[_0xed70('0x45')],'scheduledat':_0xadb11[_0xed70('0x46')],'callbackUniqueid':this[_0xed70('0xe')][_0xed70('0x33')],'tags':_0xed70('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0xadb11[_0xed70('0x46')][_0xed70('0x48')](),'priority':_0xadb11[_0xed70('0x49')]})[_0xed70('0x15')](function(_0x426e48){_0x3f0511(null,_0x426e48);})['catch'](function(_0x650980){_0x3f0511(_0x650980);});};AGIVertices[_0xed70('0x11')][_0xed70('0x4a')]=function(_0x1c172c,_0x235549){this[_0xed70('0xf')][_0xed70('0x4b')](_0x1c172c)[_0xed70('0x15')](function(_0x2be068){_0x235549(null,_0x2be068?_0x2be068[_0xed70('0x13')]:![]);})[_0xed70('0x14')](function(_0x43adc0){_0x235549(_0x43adc0);});};AGIVertices[_0xed70('0x11')][_0xed70('0x4c')]=function(_0x46d9db,_0x17f8ed,_0x111be2){var _0x4e07a9={'role':_0xed70('0x4d')};_0x4e07a9[_0x46d9db]=this[_0xed70('0xe')][_0xed70('0x37')];this['rpc'][_0xed70('0x4c')](_0x4e07a9,_0x17f8ed,this[_0xed70('0xe')]['uniqueid'])['then'](function(_0xb95310){_0x111be2(null,_['isNil'](_0xb95310)?![]:!![]);})[_0xed70('0x14')](function(_0x17a57d){logger[_0xed70('0x4e')](_0x17a57d);_0x111be2(null,![]);});};AGIVertices['prototype'][_0xed70('0x4f')]=function(_0x561f11,_0x37656d){var _0x5d5625={'role':_0xed70('0x4d')};_0x5d5625[_0x561f11]=this[_0xed70('0xe')][_0xed70('0x37')];this[_0xed70('0xf')][_0xed70('0x4f')](_0x5d5625)[_0xed70('0x15')](function(_0x58e106){_0x37656d(null,_[_0xed70('0x43')](_0x58e106)?![]:!![]);})[_0xed70('0x14')](function(_0x3cb259){logger['error'](_0x3cb259);_0x37656d(null,![]);});};AGIVertices[_0xed70('0x11')][_0xed70('0x50')]=function(_0xf2f3df,_0x457d62){var _0x1a948e={'role':_0xed70('0x4d')};_0x1a948e[_0xf2f3df]=this[_0xed70('0xe')][_0xed70('0x37')];this[_0xed70('0xf')]['agentLogout'](_0x1a948e)[_0xed70('0x15')](function(_0x4e566e){_0x457d62(null,_[_0xed70('0x43')](_0x4e566e)?![]:!![]);})[_0xed70('0x14')](function(_0x42867b){logger[_0xed70('0x4e')](_0x42867b);_0x457d62(null,![]);});};AGIVertices[_0xed70('0x11')][_0xed70('0x51')]=function(_0x297508,_0x166290){var _0x1add8d={'role':'agent'};_0x1add8d[_0x297508]=this['channel']['callerid'];var _0x42c4a0=_0x297508!='internal'?util[_0xed70('0x26')]('%s/%s@from-sip/n','LOCAL',this[_0xed70('0xe')][_0xed70('0x37')]):undefined;this['rpc'][_0xed70('0x51')](_0x1add8d,_0x42c4a0)[_0xed70('0x15')](function(_0x5f46c2){_0x166290(null,_[_0xed70('0x43')](_0x5f46c2)?![]:!![]);})[_0xed70('0x14')](function(_0x9f5a16){logger[_0xed70('0x4e')](_0x9f5a16);_0x166290(null,![]);});};AGIVertices[_0xed70('0x11')][_0xed70('0x52')]=function(_0x575780,_0x4bc23e){sh[_0xed70('0x53')](_[_0xed70('0x54')](_0x575780),function(_0x32b948,_0x2f7917){var _0x1158a9=_0x2f7917[_0xed70('0x55')](/(\r\n|\n|\r)/gm,'');_0x4bc23e(null,_0x1158a9);});};AGIVertices['prototype'][_0xed70('0x56')]=function(_0x1d3ce5,_0x133ddb){scripts['googleCloudTTS'](_0x1d3ce5[_0xed70('0x57')],_0x1d3ce5[_0xed70('0x58')]||_0xed70('0x59'),_0x1d3ce5['text'],_0x1d3ce5[_0xed70('0x5a')]||_0xed70('0x5b'),_0x1d3ce5[_0xed70('0x5c')]||_0xed70('0x5d'),_0x1d3ce5[_0xed70('0x5e')]||_0xed70('0x5f'))[_0xed70('0x15')](function(_0x26978d){_0x133ddb(null,_0x26978d);})['catch'](function(_0x23f6e8){_0x133ddb(_0x23f6e8);});};AGIVertices[_0xed70('0x11')][_0xed70('0x60')]=function(_0x35dbaf,_0x2b68f2){scripts[_0xed70('0x60')](_0x35dbaf[_0xed70('0x59')],_0x35dbaf['google_tts_language']||'en',0x1)[_0xed70('0x15')](function(_0x322dd9){_0x2b68f2(null,_0x322dd9);})[_0xed70('0x14')](function(_0x282797){_0x2b68f2(_0x282797);});};AGIVertices[_0xed70('0x11')][_0xed70('0x61')]=function(_0x5e094a,_0x617958){var _0x4def64={'uri':_0x5e094a['url'],'method':_0x5e094a[_0xed70('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5e094a[_0xed70('0x63')])===_0xed70('0x64')&&parseInt(_0x5e094a[_0xed70('0x63')])>=0x1?parseInt(_0x5e094a[_0xed70('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xed70('0x65'),_0xed70('0x66')],_0x4def64[_0xed70('0x62')][_0xed70('0x67')]())){try{_0x4def64[_0xed70('0x68')]=_0x5e094a[_0xed70('0x69')]?JSON[_0xed70('0x6a')](_0x5e094a[_0xed70('0x69')]):{};}catch(_0x51d47c){logger[_0xed70('0x4e')](_0xed70('0x6b'),_0x51d47c);}}try{_0x4def64['headers']=_0x5e094a[_0xed70('0xb')]?JSON[_0xed70('0x6a')](_0x5e094a[_0xed70('0xb')]):{};}catch(_0x5721d2){logger[_0xed70('0x4e')](_0xed70('0x6c'),_0x5721d2);}if(_0x5e094a['computedVariables']){try{var _0x5dec5b=require(_0x5e094a['computedVariables'])[_0xed70('0x6d')](this,_0x4def64);_0x4def64[_0xed70('0x6e')]=Mustache[_0xed70('0x6f')](_0x5e094a[_0xed70('0x70')],_0x5dec5b,{},['$$','$$']);if(_0x4def64[_0xed70('0x71')]){_0x4def64[_0xed70('0x71')]=JSON[_0xed70('0x6a')](Mustache[_0xed70('0x6f')](JSON[_0xed70('0x72')](_0x4def64[_0xed70('0x71')]),_0x5dec5b,{},['$$','$$']));}if(_0x4def64[_0xed70('0x68')]){_0x4def64[_0xed70('0x68')]=JSON[_0xed70('0x6a')](Mustache[_0xed70('0x6f')](JSON[_0xed70('0x72')](_0x4def64['body']),_0x5dec5b,{},['$$','$$']));}}catch(_0x4cdced){logger[_0xed70('0x4e')](_0xed70('0x73'),_0x4cdced);}}rp(_0x4def64)['then'](function(_0x4b8e66){var _0x6f51bb={'statusCode':_0x4b8e66[_0xed70('0x74')]||0xc8,'statusMessage':_0x4b8e66[_0xed70('0x75')]||'OK','headers':_0x4b8e66[_0xed70('0x71')]||{},'body':_0x4b8e66[_0xed70('0x68')]||{}};_0x617958(null,_0x6f51bb);})[_0xed70('0x14')](function(_0x407dcd){var _0x299241={'statusCode':_0x407dcd[_0xed70('0x74')]||0x1f4,'statusMessage':_0x407dcd[_0xed70('0x76')]||_0xed70('0x77'),'headers':_0x407dcd[_0xed70('0x78')][_0xed70('0x71')]||{},'body':_0x407dcd[_0xed70('0x78')][_0xed70('0x68')]||{}};_0x617958(null,_0x299241);});};AGIVertices[_0xed70('0x11')]['googleDialogflow']=function(_0x2db44a,_0x7d3762){scripts['googleDialogflow'](this[_0xed70('0xe')][_0xed70('0x33')],_0x2db44a['key'],_0x2db44a[_0xed70('0x59')],_0x2db44a[_0xed70('0x79')]||'en')[_0xed70('0x15')](function(_0x417666){_0x7d3762(null,_0x417666);})[_0xed70('0x14')](function(_0x1a1acc){_0x7d3762(_0x1a1acc);});};AGIVertices[_0xed70('0x11')][_0xed70('0x7a')]=function(_0x21c7da,_0xc221fd){scripts[_0xed70('0x7a')](this[_0xed70('0xe')],_0x21c7da)[_0xed70('0x15')](function(_0x3632e8){_0xc221fd(null,_0x3632e8);})[_0xed70('0x14')](function(_0x54640f){_0xc221fd(_0x54640f);});};AGIVertices['prototype']['ispeechTTS']=function(_0x9bdb03,_0x41167c){scripts['ispeechTTS'](_0x9bdb03[_0xed70('0x7b')],_0x9bdb03[_0xed70('0x59')],_0x9bdb03[_0xed70('0x7c')]||'en-US',_0x9bdb03['speed'])[_0xed70('0x15')](function(_0x3c3fab){_0x41167c(null,_0x3c3fab);})['catch'](function(_0x37fefd){_0x41167c(_0x37fefd);});};AGIVertices['prototype'][_0xed70('0x7d')]=function(_0x49c6f8,_0x4345bc,_0x94cabd){scripts[_0xed70('0x7d')](_0x4345bc,_0x49c6f8[_0xed70('0x7b')],_0x49c6f8[_0xed70('0x7e')]||_0xed70('0x5b'),this[_0xed70('0x7f')](_0x49c6f8[_0xed70('0x80')])?_0x49c6f8[_0xed70('0x80')]:undefined)[_0xed70('0x15')](function(_0x5c8867){_0x94cabd(null,_0x5c8867);})[_0xed70('0x14')](function(_0x1559fd){_0x94cabd(_0x1559fd);});};AGIVertices[_0xed70('0x11')][_0xed70('0x81')]=function(_0x227d5d,_0x219c4b){scripts['awsPolly'](_0x227d5d['aws_access_key_id'],_0x227d5d[_0xed70('0x82')],_0x227d5d[_0xed70('0x83')],_0x227d5d['aws_polly_voice']||_0xed70('0x84'),_0x227d5d[_0xed70('0x59')],_0x227d5d['aws_text_type']||_0xed70('0x59'))[_0xed70('0x15')](function(_0x3993b6){_0x219c4b(null,_0x3993b6);})[_0xed70('0x14')](function(_0x133f4e){_0x219c4b(_0x133f4e);});};AGIVertices[_0xed70('0x11')][_0xed70('0x85')]=function(_0x4efe1b,_0x332ea6){scripts[_0xed70('0x85')](this[_0xed70('0xe')]['uniqueid'],_0x4efe1b[_0xed70('0x86')],_0x4efe1b['aws_secret_access_key'],_0x4efe1b[_0xed70('0x87')],_0x4efe1b[_0xed70('0x59')],_0x4efe1b['aws_bot_name'])['then'](function(_0x95fca4){_0x332ea6(null,_0x95fca4);})[_0xed70('0x14')](function(_0x1271ea){_0x332ea6(_0x1271ea);});};AGIVertices[_0xed70('0x11')]['googleASR']=function(_0x39d8fa,_0x9fc242,_0x1167ed){scripts[_0xed70('0x88')](_0x9fc242,_0x39d8fa[_0xed70('0x7b')],_0x39d8fa[_0xed70('0x89')]||_0xed70('0x5b'))[_0xed70('0x15')](function(_0x3122fb){_0x1167ed(null,_0x3122fb);})[_0xed70('0x14')](function(_0x5783d9){_0x1167ed(_0x5783d9);});};AGIVertices[_0xed70('0x11')][_0xed70('0x8a')]=function(_0x1356f5,_0x4ed2e7,_0xe63abd){scripts['tildeASR'](_0x4ed2e7,_0x1356f5['appid'],_0x1356f5['appsecret'],_0x1356f5[_0xed70('0x6e')])[_0xed70('0x15')](function(_0x5e4134){_0xe63abd(null,_0x5e4134);})[_0xed70('0x14')](function(_0x136c06){_0xe63abd(_0x136c06);});};AGIVertices[_0xed70('0x11')][_0xed70('0x8b')]=function(_0x15725f){var _0x30a111=_[_0xed70('0x8c')](verticesWithRetry,_0x15725f[_0xed70('0x35')])?_0x15725f:_[_0xed70('0x8d')](_0x15725f);for(var _0x29d40c in _0x30a111){if(_0x30a111[_0xed70('0x8e')](_0x29d40c)){if(_0x30a111[_0x29d40c]&&_['isString'](_0x30a111[_0x29d40c])){if(_[_0xed70('0x8c')](recursiveMapAttributes,_0x29d40c)){_0x30a111[_0x29d40c]=this['replaceObjectAllVariables'](_0x30a111[_0x29d40c]);}else{_0x30a111[_0x29d40c]=this[_0xed70('0x8f')](_0x30a111[_0x29d40c]);}}}}return _0x30a111;};AGIVertices[_0xed70('0x11')][_0xed70('0x90')]=function(_0xb8563d){for(var _0x21c19b in _0xb8563d){if(_0xb8563d[_0xed70('0x8e')](_0x21c19b)){if(_[_0xed70('0x91')](_0xb8563d[_0x21c19b])){this[_0xed70('0x90')](_0xb8563d[_0x21c19b]);}else if(_[_0xed70('0x92')](_0xb8563d[_0x21c19b])){for(var _0x477d37=0x0;_0x477d37<_0xb8563d[_0x21c19b][_0xed70('0x93')];_0x477d37++){this[_0xed70('0x90')](_0xb8563d[_0x21c19b][_0x477d37]);}}else if(_[_0xed70('0x94')](_0xb8563d[_0x21c19b])){_0xb8563d[_0x21c19b]=this[_0xed70('0x8f')](_0xb8563d[_0x21c19b]);}}}};AGIVertices[_0xed70('0x11')][_0xed70('0x95')]=function(_0x44bbbb,_0x28001b){for(var _0x4a03c0 in _0x44bbbb){if(_0x44bbbb['hasOwnProperty'](_0x4a03c0)){if(_[_0xed70('0x91')](_0x44bbbb[_0x4a03c0])){if(!_[_0xed70('0x3f')](_0x44bbbb[_0x4a03c0])){this['saveRestApiResult'](_0x44bbbb[_0x4a03c0],util[_0xed70('0x26')](_0xed70('0x96'),_0x28001b,_0x4a03c0));}}else if(_[_0xed70('0x92')](_0x44bbbb[_0x4a03c0])){for(var _0x32d759=0x0;_0x32d759<_0x44bbbb[_0x4a03c0][_0xed70('0x93')];_0x32d759++){this[_0xed70('0x95')](_0x44bbbb[_0x4a03c0][_0x32d759],util['format'](_0xed70('0x96'),_0x28001b,_0x4a03c0+'['+_0x32d759+']'));}}else{if(!_[_0xed70('0x43')](_0x44bbbb[_0x4a03c0])){this[_0xed70('0xe')][_0xed70('0x97')](util[_0xed70('0x26')](_0xed70('0x96'),_0x28001b,_0x4a03c0),_0x44bbbb[_0x4a03c0]);}}}}};AGIVertices['prototype'][_0xed70('0x98')]=function(_0x32a248){try{var _0x3e8beb=JSON[_0xed70('0x6a')](_0x32a248);this[_0xed70('0x90')](_0x3e8beb);return JSON[_0xed70('0x72')](_0x3e8beb);}catch(_0x1e5e0d){return this['replaceAllVariables'](_0x32a248);}};AGIVertices['prototype'][_0xed70('0x8f')]=function(_0x224aa6){var _0x28c304=_0x224aa6['split']('{');for(var _0x6cb337=0x1;_0x6cb337<_0x28c304[_0xed70('0x93')];_0x6cb337+=0x1){var _0x3bc1c7=_0x28c304[_0x6cb337][_0xed70('0x99')]('}');if(_0x3bc1c7[_0xed70('0x93')]>0x1){_0x224aa6=_0x224aa6[_0xed70('0x9a')]('{'+_0x3bc1c7[0x0]+'}',this[_0xed70('0xe')][_0xed70('0x9b')](_0x3bc1c7[0x0])[_0xed70('0x9c')]||_0x3bc1c7[0x0]);}}if(_0x28c304['length']===0x1){return _0x224aa6['toString']();}return this[_0xed70('0x8f')](_0x224aa6);};AGIVertices[_0xed70('0x11')][_0xed70('0x9d')]=function(_0xe15101,_0x12ac9c){var _0x4df604=this[_0xed70('0xe')][_0xed70('0x9b')](_0xe15101);if(_0x4df604[_0xed70('0x9e')]===-0x1){return _0x4df604;}logger[_0xed70('0x2b')](util['format'](_0xed70('0x9f'),_0x12ac9c,_0x4df604[_0xed70('0x9c')]));return this[_0xed70('0xe')][_0xed70('0x97')](_0x12ac9c,_0x4df604[_0xed70('0x9c')]);};AGIVertices[_0xed70('0x11')][_0xed70('0x7f')]=function(_0x44b4e9){return _0x44b4e9&&_0x44b4e9!=='0'&&_0x44b4e9!=='-1'&&_0x44b4e9!=='';};AGIVertices[_0xed70('0x11')][_0xed70('0xa0')]=function(_0x2cf0ae){this[_0xed70('0x32')][_0xed70('0x6d')](this,_0x2cf0ae,'-');_0x2cf0ae[_0xed70('0xa1')]=_0x2cf0ae[_0xed70('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xed70('0x11')][_0xed70('0xa2')]=function(_0xb92119){logger['info'](util[_0xed70('0x26')](_0xed70('0xa3'),_0xb92119[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0xb92119[_0xed70('0x59')])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xa5'));}var _0x2fb188='\x22'+_0xb92119['text']+'\x22';if(this[_0xed70('0x7f')](_0xb92119[_0xed70('0x78')])){_0x2fb188+=','+_0xb92119['options'];}var _0x739156=this[_0xed70('0xe')][_0xed70('0x53')](_0xed70('0xa6'),_0x2fb188);if(_0x739156[_0xed70('0x9e')]===-0x1){return _0x739156;}return this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')](_0xed70('0xa7'),_0x2fb188));};AGIVertices[_0xed70('0x11')]['mrcprecog']=function(_0x1b83b0){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xa8'),_0x1b83b0[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x1b83b0[_0xed70('0xa9')])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xaa'));}var _0x26c954=_0x1b83b0[_0xed70('0xa9')];if(this[_0xed70('0x7f')](_0x1b83b0['options'])){_0x26c954+=','+_0x1b83b0[_0xed70('0x78')];}var _0x260df4=this[_0xed70('0xe')]['exec'](_0xed70('0xab'),_0x26c954);if(_0x260df4[_0xed70('0x9e')]===-0x1){return _0x260df4;}var _0x40a329=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xed70('0xac'));if(_0x40a329[_0xed70('0x9e')]===-0x1){return _0x40a329;}var _0x24fef3=this['getAndSetVariable'](_0xed70('0xad'),'MRCP_RECOG_TRANSCRIPT');if(_0x24fef3[_0xed70('0x9e')]===-0x1){return _0x24fef3;}var _0x2255d2=this[_0xed70('0x9d')]('RECOG_INSTANCE()',_0xed70('0xae'));if(_0x2255d2['result']===-0x1){return _0x2255d2;}return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x26c954));};AGIVertices[_0xed70('0x11')][_0xed70('0xaf')]=function(_0x4bce79){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xb0'),_0x4bce79['label']));return this[_0xed70('0xe')][_0xed70('0xaf')]([_0x4bce79[_0xed70('0xb1')],_0x4bce79[_0xed70('0xb2')]]);};AGIVertices[_0xed70('0x11')]['answer']=function(_0x255f74){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xb3'),_0x255f74[_0xed70('0x34')]));if(this[_0xed70('0x7f')](_0x255f74[_0xed70('0x63')])){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xb4'),_0x255f74[_0xed70('0x63')]));var _0x2c871a=this[_0xed70('0xe')][_0xed70('0xb5')](_0x255f74[_0xed70('0x63')]);if(_0x2c871a[_0xed70('0x9e')]===-0x1){return _0x2c871a;}}return this['channel'][_0xed70('0xb6')]();};AGIVertices[_0xed70('0x11')][_0xed70('0x47')]=function(_0x244f28){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x244f28[_0xed70('0x34')]));if(!this['isConfigured'](_0x244f28[_0xed70('0x45')])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x244f28,'no\x20list\x20selected');}_0x244f28[_0xed70('0x46')]=moment();if(this[_0xed70('0x7f')](_0x244f28['delay'])){_0x244f28[_0xed70('0x46')]=moment()[_0xed70('0xb7')](_0x244f28[_0xed70('0xb8')],_0xed70('0xb9'));}if(!this[_0xed70('0x7f')](_0x244f28[_0xed70('0x49')])){_0x244f28[_0xed70('0x49')]=0x2;}this[_0xed70('0x3e')][_0xed70('0x6d')](this,_0x244f28);return this[_0xed70('0xe')][_0xed70('0xa4')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x244f28[_0xed70('0x44')],_0x244f28[_0xed70('0x45')],_0x244f28[_0xed70('0x46')]));};AGIVertices[_0xed70('0x11')][_0xed70('0xba')]=function(_0x4bcedd){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xbb'),_0x4bcedd[_0xed70('0x34')]));var _0x3c9cfd=this[_0xed70('0xe')][_0xed70('0x53')](_0x4bcedd[_0xed70('0xbc')],_0x4bcedd[_0xed70('0x78')]);if(_0x3c9cfd[_0xed70('0x9e')]===-0x1){return _0x3c9cfd;}return this['channel']['noop'](util[_0xed70('0x26')](_0xed70('0xbd'),_0x4bcedd[_0xed70('0xbc')],_0x4bcedd['options']));};AGIVertices[_0xed70('0x11')][_0xed70('0xbe')]=function(_0x35372d){logger['info'](util[_0xed70('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x35372d[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x35372d['text'])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xa5'));}var _0x5f128d='\x22'+_0x35372d['text']+'\x22';if(this[_0xed70('0x7f')](_0x35372d[_0xed70('0x78')])){_0x5f128d+=','+_0x35372d[_0xed70('0x78')];}var _0xe92897=this[_0xed70('0xe')][_0xed70('0x53')](_0xed70('0xa6'),_0x5f128d);if(_0xe92897['result']===-0x1){return _0xe92897;}return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0xa7'),_0x5f128d));};AGIVertices[_0xed70('0x11')]['sestektts']=function(_0xddf661){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xbf'),_0xddf661[_0xed70('0x34')]));if(!this['isConfigured'](_0xddf661[_0xed70('0x59')])){return this[_0xed70('0xe')]['noop'](_0xed70('0xa5'));}var _0x46d724='\x22'+_0xddf661[_0xed70('0x59')]+'\x22';if(this['isConfigured'](_0xddf661[_0xed70('0x78')])){_0x46d724+=','+_0xddf661[_0xed70('0x78')];}var _0x4aa2b9=this[_0xed70('0xe')][_0xed70('0x53')](_0xed70('0xa6'),_0x46d724);if(_0x4aa2b9['result']===-0x1){return _0x4aa2b9;}return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0xa7'),_0x46d724));};AGIVertices[_0xed70('0x11')][_0xed70('0xc0')]=function(_0x145bdd){logger['info'](util[_0xed70('0x26')](_0xed70('0xc1'),_0x145bdd[_0xed70('0x34')]));if(!this['isConfigured'](_0x145bdd['grammar'])){return this[_0xed70('0xe')][_0xed70('0xa4')]('no\x20grammar\x20configured');}var _0xe3311a=_0x145bdd[_0xed70('0xa9')];if(this[_0xed70('0x7f')](_0x145bdd[_0xed70('0x78')])){_0xe3311a+=','+_0x145bdd[_0xed70('0x78')];}var _0x10b1f7=this['channel'][_0xed70('0x53')](_0xed70('0xab'),_0xe3311a);if(_0x10b1f7[_0xed70('0x9e')]===-0x1){return _0x10b1f7;}var _0x51226=this[_0xed70('0x9d')]('RECOG_CONFIDENCE()',_0xed70('0xc2'));if(_0x51226[_0xed70('0x9e')]===-0x1){return _0x51226;}var _0x44be77=this['getAndSetVariable'](_0xed70('0xad'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x44be77[_0xed70('0x9e')]===-0x1){return _0x44be77;}var _0x5078f0=this['getAndSetVariable']('RECOG_INSTANCE()',_0xed70('0xc3'));if(_0x5078f0['result']===-0x1){return _0x5078f0;}return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0xc4'),_0xe3311a));};AGIVertices[_0xed70('0x11')][_0xed70('0xc5')]=function(_0x59da19){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xc6'),_0x59da19['label']));if(!this[_0xed70('0x7f')](_0x59da19[_0xed70('0xa9')])){return this[_0xed70('0xe')][_0xed70('0xa4')]('no\x20grammar\x20configured');}var _0x2bcbe2=_0x59da19[_0xed70('0xa9')];if(this[_0xed70('0x7f')](_0x59da19['options'])){_0x2bcbe2+=','+_0x59da19['options'];}var _0x5e62f4=this['channel']['exec']('MRCPRecog',_0x2bcbe2);if(_0x5e62f4[_0xed70('0x9e')]===-0x1){return _0x5e62f4;}var _0x25d1c7=this[_0xed70('0x9d')](_0xed70('0xc7'),_0xed70('0xc8'));if(_0x25d1c7[_0xed70('0x9e')]===-0x1){return _0x25d1c7;}var _0x20ff1e=this[_0xed70('0x9d')]('RECOG_INPUT()',_0xed70('0xc9'));if(_0x20ff1e['result']===-0x1){return _0x20ff1e;}var _0x28bdb8=this[_0xed70('0x9d')](_0xed70('0xca'),_0xed70('0xcb'));if(_0x28bdb8[_0xed70('0x9e')]===-0x1){return _0x28bdb8;}return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2bcbe2));};AGIVertices['prototype'][_0xed70('0xcc')]=function(_0x3f5651){logger['info'](util['format'](_0xed70('0xcd'),_0x3f5651[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x3f5651[_0xed70('0xce')])){return this['channel'][_0xed70('0x4e')](_0x3f5651,_0xed70('0xcf'));}var _0x58d49e=this[_0xed70('0x18')][_0xed70('0x6d')](this,_0x3f5651[_0xed70('0xce')]);if(!_0x58d49e){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x3f5651,_0xed70('0xd0'));}if(!this[_0xed70('0x7f')](_0x3f5651['query'])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x3f5651,_0xed70('0xd1'));}var _0x12f69e=_0x3f5651['query'][_0xed70('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0xd2'),_0x12f69e));var _0x76f003=this[_0xed70('0x28')][_0xed70('0x6d')](this,_0x58d49e,_0x12f69e);this[_0xed70('0x32')][_0xed70('0x6d')](this,_0x3f5651,_0x12f69e);if(!this[_0xed70('0x7f')](_0x3f5651[_0xed70('0xd3')])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xd4'));}var _0x4880c6=this[_0xed70('0x9b')]['sync'](this,_0x3f5651[_0xed70('0xd3')]);if(!_0x4880c6){return this['channel'][_0xed70('0x4e')](_0x3f5651,_0xed70('0xd5'));}var _0x1a99b3=this;_0x76f003[_0xed70('0xd6')](function(_0x46fb70,_0x4cb87b){Object[_0xed70('0xd7')](_0x46fb70)['forEach'](function(_0xeedf1e){_0x1a99b3[_0xed70('0xe')][_0xed70('0x97')](util[_0xed70('0x26')](_0xed70('0xd8'),_0x4880c6,_0x4cb87b,_0xeedf1e),_0x46fb70[_0xeedf1e]);});});this['channel'][_0xed70('0x97')](util['format']('%s_ROWS_COUNT',_0x4880c6),_0x76f003[_0xed70('0x93')]);return this[_0xed70('0xe')]['noop'](util['format'](_0xed70('0xd9'),_0x4880c6));};AGIVertices[_0xed70('0x11')][_0xed70('0xda')]=function(_0xd72861){logger[_0xed70('0xdb')](util[_0xed70('0x26')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xd72861[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0xd72861[_0xed70('0xdc')])){return this[_0xed70('0xe')]['error'](_0xd72861,_0xed70('0xdd'));}var _0xfbaa08=this[_0xed70('0xde')][_0xed70('0x6d')](this,_0xd72861['sip_id']);if(!_0xfbaa08){return this[_0xed70('0xe')]['error'](_0xd72861,'no\x20user\x20found');}var _0xd1b2cf=this[_0xed70('0xe')]['exec'](_0xed70('0xdf'),[util['format'](_0xed70('0xe0'),_0xfbaa08),_0xd72861[_0xed70('0x63')],_0xd72861[_0xed70('0xe1')],_0xd72861[_0xed70('0x70')]]);if(_0xd1b2cf[_0xed70('0x9e')]===-0x1){return _0xd1b2cf;}return this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')](_0xed70('0xe2'),'DIAL'));};AGIVertices[_0xed70('0x11')][_0xed70('0xe3')]=function(_0x2a3e7f){logger[_0xed70('0x2b')](util[_0xed70('0x26')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x2a3e7f[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x2a3e7f[_0xed70('0x7b')])){return this['channel'][_0xed70('0xa4')]('no\x20key\x20configured');}if(!this[_0xed70('0x7f')](_0x2a3e7f[_0xed70('0x59')])){return this[_0xed70('0xe')]['noop'](_0xed70('0xa5'));}this[_0xed70('0xe')][_0xed70('0xe4')]=!![];this[_0xed70('0x32')](_0x2a3e7f);this[_0xed70('0x3d')](_0x2a3e7f['text'],'in');this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')]('Trying\x20Dialogflow:\x20%s',_0x2a3e7f['text']));var _0x55d85d=this[_0xed70('0xe5')][_0xed70('0x6d')](this,_0x2a3e7f);if(_0x55d85d){for(var _0x1dcb57 in _0x55d85d){if(_0x55d85d[_0xed70('0x8e')](_0x1dcb57)){this[_0xed70('0xe')]['setVariable'](util[_0xed70('0x26')](_0xed70('0xe6'),_0x1dcb57[_0xed70('0x67')]()),_0x55d85d[_0x1dcb57]);}}this[_0xed70('0x3d')](_0x55d85d[_0xed70('0xe7')],_0xed70('0xe8'));return this[_0xed70('0xe')][_0xed70('0xa4')](util['format'](_0xed70('0xe9'),_0x55d85d[_0xed70('0xe7')]));}return this[_0xed70('0xe')][_0xed70('0x4e')](_0x2a3e7f,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x281c60){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xea'),_0x281c60[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x281c60[_0xed70('0xeb')])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xec'));}if(!this['isConfigured'](_0x281c60[_0xed70('0xed')])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xee'));}if(!this[_0xed70('0x7f')](_0x281c60['password'])){return this['channel'][_0xed70('0xa4')](_0xed70('0xef'));}if(!this['isConfigured'](_0x281c60[_0xed70('0xf0')])){return this[_0xed70('0xe')]['noop']('no\x20text\x20configured');}this['channel'][_0xed70('0xe4')]=!![];this[_0xed70('0x32')](_0x281c60);this[_0xed70('0x3d')](_0x281c60[_0xed70('0x59')],'in');this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')]('Trying\x20SestekNDA:\x20%s',_0x281c60[_0xed70('0x59')]));var _0x3e1d12=this[_0xed70('0x7a')]['sync'](this,_0x281c60);if(_0x3e1d12){for(var _0x3a4181 in _0x3e1d12){if(_0x3e1d12['hasOwnProperty'](_0x3a4181)){this[_0xed70('0xe')][_0xed70('0x97')](util['format'](_0xed70('0xf1'),_0x3a4181[_0xed70('0x67')]()),_0x3e1d12[_0x3a4181]);}}this[_0xed70('0x3d')](_0x3e1d12[_0xed70('0xe7')],_0xed70('0xe8'));if(_0x3e1d12['audiofile']){this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0xf2'),_0x3e1d12[_0xed70('0xf3')]));var _0x89268c=this[_0xed70('0xe')][_0xed70('0xf4')](_0x3e1d12[_0xed70('0xf3')]);try{fs[_0xed70('0xf5')](_0x3e1d12['audiofile']+_0xed70('0xf6'));}catch(_0x63e9aa){logger[_0xed70('0x4e')](_0x63e9aa);}return _0x89268c;}else{return this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')]('SestekNDA\x20Result\x20%s',_0x3e1d12['speech']));}}return this[_0xed70('0xe')][_0xed70('0x4e')](_0x281c60,_0xed70('0xf7'));};AGIVertices['prototype'][_0xed70('0xf8')]=function(_0x10e64e){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0xf9'),_0x10e64e[_0xed70('0x34')]));return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xf8'));};AGIVertices[_0xed70('0x11')][_0xed70('0xfa')]=function(_0x250113){logger['info'](util['format'](_0xed70('0xfb'),_0x250113['label']));var _0x106d4e='';if(_0x250113[_0xed70('0xfc')]){if(!this['isConfigured'](_0x250113[_0xed70('0xfc')])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x250113,_0xed70('0xfd'));}else{var _0x1c6722=parseInt(_0x250113['trunk_id'],0xa);if(isNaN(_0x1c6722)){_0x106d4e=_0x250113[_0xed70('0xfc')];}else{_0x106d4e=this[_0xed70('0x19')]['sync'](this,_0x250113[_0xed70('0xfc')]);if(!_0x106d4e){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x250113,'no\x20trunk\x20found');}}}}else if(_0x250113[_0xed70('0xfe')]){_0x106d4e=_0x250113[_0xed70('0xfe')];}else{return this[_0xed70('0xe')][_0xed70('0x4e')](_0x250113,'no\x20trunk\x20selected');}var _0x36c18b=this[_0xed70('0xe')][_0xed70('0x53')](_0xed70('0xdf'),[util[_0xed70('0x26')](_0xed70('0xff'),_0x106d4e,_0x250113[_0xed70('0x44')]),_0x250113[_0xed70('0x63')],_0x250113['opts'],_0x250113['url']]);if(_0x36c18b[_0xed70('0x9e')]===-0x1){return _0x36c18b;}return this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')]('Executed\x20command\x20%s',_0xed70('0xdf')));};AGIVertices[_0xed70('0x11')][_0xed70('0x100')]=function(_0x1872af){logger['info'](util[_0xed70('0x26')](_0xed70('0x101'),_0x1872af['label']));return this[_0xed70('0xe')][_0xed70('0xa4')]('finally');};AGIVertices[_0xed70('0x11')][_0xed70('0x102')]=function(_0x13b525){logger[_0xed70('0x2b')](util[_0xed70('0x26')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x13b525[_0xed70('0x34')]));if(_0x13b525[_0xed70('0xa1')]===0x0){return this['maxRetry'](_0x13b525);}_0x13b525[_0xed70('0xa1')]-=0x1;if(!this['isConfigured'](_0x13b525[_0xed70('0x103')])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x13b525,_0xed70('0x104'));}var _0x1eefff=this[_0xed70('0x1b')][_0xed70('0x6d')](this,_0x13b525[_0xed70('0x103')]);if(!_0x1eefff){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x13b525,'no\x20file\x20audio\x20found');}if(!this[_0xed70('0x7f')](_0x13b525['variable_id'])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0xed70('0xd4'));}var _0x56708b=this[_0xed70('0xe')][_0xed70('0x105')](_0x1eefff,_0x13b525[_0xed70('0x106')],_0x13b525['maxdigit']);var _0x1a57ed=_0x56708b[_0xed70('0x9e')]?_0x56708b['result'][_0xed70('0x48')]():'';logger['info']('test',JSON[_0xed70('0x72')](_0x56708b));if(_0x56708b['result']===-0x1){this[_0xed70('0x32')]['sync'](this,_0x13b525,_0x1a57ed);return _0x56708b;}else if(_0x56708b['extra']===_0xed70('0x63')){_0x56708b['result']=_0x1a57ed[_0xed70('0x93')]>=parseInt(_0x13b525[_0xed70('0x107')])?'x':'i';}else{_0x56708b[_0xed70('0x9e')]=_0x1a57ed[_0xed70('0x93')]>=parseInt(_0x13b525[_0xed70('0x107')])&&_0x1a57ed[_0xed70('0x93')]<=parseInt(_0x13b525[_0xed70('0x108')])?'x':'i';}var _0x10bc78=this[_0xed70('0x9b')][_0xed70('0x6d')](this,_0x13b525[_0xed70('0xd3')]);if(!_0x10bc78){return this[_0xed70('0xe')]['error'](_0x13b525,_0xed70('0xd5'));}this[_0xed70('0xe')][_0xed70('0x97')](_0x10bc78,_0x1a57ed);if(this[_0xed70('0x7f')](_0x13b525['hiddendigitsnum'])){var _0x3ef6f2=parseInt(_0x13b525['hiddendigitsnum'],0xa);var _0x5c4858=rs[_0xed70('0x109')]({'charset':'*','length':_0x3ef6f2});var _0x5bf786=_0x1a57ed['length'];if(_0x5bf786>0x0){if(_0x5bf786>_0x3ef6f2){this[_0xed70('0x32')][_0xed70('0x6d')](this,_0x13b525,_0x13b525['hiddendigitspos']===_0xed70('0x10a')?_0x5c4858+_0x1a57ed[_0xed70('0x10b')](_0x3ef6f2):_0x1a57ed[_0xed70('0x10b')](0x0,_0x5bf786-_0x3ef6f2)+_0x5c4858);}else{this[_0xed70('0x32')][_0xed70('0x6d')](this,_0x13b525,rs[_0xed70('0x109')]({'charset':'*','length':_0x5bf786}));}}else{this[_0xed70('0x32')]['sync'](this,_0x13b525,'');}}else{this[_0xed70('0x32')][_0xed70('0x6d')](this,_0x13b525,_0x1a57ed);}return _0x56708b;};AGIVertices['prototype'][_0xed70('0xd')]=function(_0x786332){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x10c'),_0x786332[_0xed70('0x34')]));return this['getdigits'](_0x786332);};AGIVertices[_0xed70('0x11')]['goal']=function(_0x1fed65){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x10d'),_0x1fed65[_0xed70('0x34')]));this[_0xed70('0x32')][_0xed70('0x6d')](this,_0x1fed65,_0x1fed65[_0xed70('0x10e')]);return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x10f'),_0x1fed65[_0xed70('0x10e')]));};AGIVertices['prototype']['awspolly']=function(_0x4e7758){logger['info'](util[_0xed70('0x26')](_0xed70('0x110'),_0x4e7758['label']));if(!this['isConfigured'](_0x4e7758[_0xed70('0x86')])||!this[_0xed70('0x7f')](_0x4e7758[_0xed70('0x82')])){return this[_0xed70('0xe')]['noop'](_0xed70('0x111'));}if(!this[_0xed70('0x7f')](_0x4e7758[_0xed70('0x59')])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xa5'));}this['channel'][_0xed70('0xa4')](util['format'](_0xed70('0x112'),_0x4e7758[_0xed70('0x59')]));var _0x5df097=this[_0xed70('0x81')][_0xed70('0x6d')](this,_0x4e7758);if(_0x5df097){this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')]('aws\x20Polly\x20%s\x20file\x20created',_0x5df097));var _0x28ba8f=this[_0xed70('0xe')][_0xed70('0xf4')](_0x5df097);try{fs[_0xed70('0xf5')](_0x5df097+_0xed70('0xf6'));}catch(_0x15cd06){logger[_0xed70('0x4e')](_0x15cd06);}return _0x28ba8f;}return this[_0xed70('0xe')][_0xed70('0x4e')](_0x4e7758,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xed70('0x11')][_0xed70('0x113')]=function(_0x2b921e){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x114'),_0x2b921e[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x2b921e[_0xed70('0x86')])||!this['isConfigured'](_0x2b921e['aws_secret_access_key'])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0x111'));}if(!this['isConfigured'](_0x2b921e[_0xed70('0x115')])){return this[_0xed70('0xe')][_0xed70('0xa4')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x2b921e[_0xed70('0x59')])){return this[_0xed70('0xe')][_0xed70('0xa4')]('no\x20text\x20configured');}this[_0xed70('0xe')][_0xed70('0xe4')]=!![];this[_0xed70('0x32')](_0x2b921e);this['createSquareMessage'](_0x2b921e[_0xed70('0x59')],'in');this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')](_0xed70('0x116'),_0x2b921e[_0xed70('0x59')]));var _0x68d7ee=this['awsLex'][_0xed70('0x6d')](this,_0x2b921e);if(_0x68d7ee){for(var _0xa300a7 in _0x68d7ee){if(_0x68d7ee[_0xed70('0x8e')](_0xa300a7)&&_['isString'](_0x68d7ee[_0xa300a7])){this[_0xed70('0xe')][_0xed70('0x97')](util[_0xed70('0x26')]('AWS_LEX_%s',_0xa300a7[_0xed70('0x67')]()),_0x68d7ee[_0xa300a7]);}}if(_[_0xed70('0x43')](_0x68d7ee[_0xed70('0x76')])){return this[_0xed70('0xe')]['noop'](_0xed70('0x117'));}else{this[_0xed70('0x3d')](_0x68d7ee[_0xed70('0x76')],_0xed70('0xe8'));return this['channel']['noop'](util['format'](_0xed70('0x118'),_0x68d7ee['message']));}}return this['channel'][_0xed70('0x4e')](_0x2b921e,_0xed70('0x119'));};AGIVertices['prototype'][_0xed70('0x11a')]=function(_0x1303e1){logger[_0xed70('0x2b')](util['format'](_0xed70('0x11b'),_0x1303e1['label'],_0x1303e1[_0xed70('0x63')]));if(!this[_0xed70('0x7f')](_0x1303e1['key'])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0x11c'));}var _0x3d85b4=_0xed70('0x11d');var _0x50e0c5=util[_0xed70('0x26')](_0xed70('0x11e'),FILES_PATH,rs[_0xed70('0x109')](0x4));var _0x37d78a=util[_0xed70('0x26')](_0xed70('0x96'),_0x50e0c5,_0x3d85b4);var _0xe6af44=!![];if(_0x1303e1[_0xed70('0x11f')]===_0xed70('0x120')){_0xe6af44=![];}var _0x41c1f1=this[_0xed70('0xe')]['recordFile'](_0x50e0c5,_0x3d85b4,_0x1303e1[_0xed70('0x121')],_0x1303e1[_0xed70('0x63')],undefined,_0xe6af44);if(_0x41c1f1[_0xed70('0x9e')]!==-0x1){this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x122'),_0x37d78a));var _0x5002e1=this['googleASR'][_0xed70('0x6d')](this,_0x1303e1,_0x37d78a);if(_0x5002e1){for(var _0x53a411 in _0x5002e1){if(_0x5002e1['hasOwnProperty'](_0x53a411)){this[_0xed70('0xe')][_0xed70('0x97')](util['format'](_0xed70('0x123'),_0x53a411[_0xed70('0x67')]()),_0x5002e1[_0x53a411]);}}return this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')]('GoogleASR\x20Result\x20%s',JSON[_0xed70('0x72')](_0x5002e1)));}}return _0x41c1f1;};AGIVertices[_0xed70('0x11')][_0xed70('0x124')]=function(_0x4cb3db){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x125'),_0x4cb3db[_0xed70('0x34')]));if(!this['isConfigured'](_0x4cb3db[_0xed70('0x126')])){return this[_0xed70('0xe')]['noop'](_0xed70('0x127'));}if(!this[_0xed70('0x7f')](_0x4cb3db[_0xed70('0x128')])){return this[_0xed70('0xe')]['noop'](_0xed70('0x129'));}var _0x1543a3=_0xed70('0x11d');var _0x2c2ecc=util[_0xed70('0x26')](_0xed70('0x11e'),FILES_PATH,rs[_0xed70('0x109')](0x4));var _0x30f07d=util[_0xed70('0x26')](_0xed70('0x96'),_0x2c2ecc,_0x1543a3);var _0x2cba13=!![];if(_0x4cb3db[_0xed70('0x11f')]===_0xed70('0x120')){_0x2cba13=![];}var _0x14ec75=this[_0xed70('0xe')][_0xed70('0x12a')](_0x2c2ecc,_0x1543a3,_0x4cb3db[_0xed70('0x121')],_0x4cb3db[_0xed70('0x63')],undefined,_0x2cba13);if(_0x14ec75[_0xed70('0x9e')]!==-0x1){this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x12b'),_0x30f07d));var _0x4c8da8=this[_0xed70('0x8a')][_0xed70('0x6d')](this,_0x4cb3db,_0x30f07d);if(_0x4c8da8){for(var _0x400c3c in _0x4c8da8){if(_0x4c8da8['hasOwnProperty'](_0x400c3c)){this['channel'][_0xed70('0x97')](util['format']('TILDE_ASR_%s',_0x400c3c['toUpperCase']()),_0x4c8da8[_0x400c3c]);}}return this[_0xed70('0xe')][_0xed70('0xa4')](util['format'](_0xed70('0x12c'),JSON[_0xed70('0x72')](_0x4c8da8)));}}return _0x14ec75;};AGIVertices[_0xed70('0x11')][_0xed70('0x12d')]=function(_0x212510){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x12e'),_0x212510[_0xed70('0x34')]));return this[_0xed70('0xe')][_0xed70('0x12f')](_0x212510[_0xed70('0x3a')],_0x212510['extension'],_0x212510[_0xed70('0x130')]);};AGIVertices[_0xed70('0x11')][_0xed70('0x131')]=function(_0x6debb9){logger['info'](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x6debb9[_0xed70('0x34')]));if(!this['isConfigured'](_0x6debb9['condition'])){return this['channel'][_0xed70('0x4e')](_0x6debb9,_0xed70('0x132'));}try{var _0xce0cdd=eval(_0x6debb9[_0xed70('0x133')])?'true':_0xed70('0x134');this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')](_0xed70('0x135'),_0x6debb9[_0xed70('0x133')],_0xce0cdd));return{'code':0xc8,'result':_0xce0cdd};}catch(_0x2d035c){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xed70('0x11')][_0xed70('0x136')]=function(_0xf7ec88){logger[_0xed70('0x2b')](util['format'](_0xed70('0x137'),_0xf7ec88[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0xf7ec88[_0xed70('0x138')])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0xf7ec88,_0xed70('0x139'));}var _0x45c2a8=this[_0xed70('0x20')][_0xed70('0x6d')](this,_0xf7ec88[_0xed70('0x138')]);if(!_0x45c2a8){return this['channel']['error'](_0xf7ec88,_0xed70('0x13a'));}for(var _0x16a335=0x0;_0x16a335<_0x45c2a8[_0xed70('0x93')];_0x16a335+=0x1){var _0x3e71f1=this[_0xed70('0xe')][_0xed70('0x9b')](util[_0xed70('0x26')](_0xed70('0x13b'),_0x45c2a8[_0x16a335]));if(_0x3e71f1['result']===-0x1){return _0x3e71f1;}logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x13c'),_0x45c2a8[_0x16a335],_0x3e71f1[_0xed70('0x9c')]));if(_0x3e71f1['extra']===_0xed70('0x13d')){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x13c'),_0x45c2a8[_0x16a335],_0xed70('0x13d')));this[_0xed70('0xe')][_0xed70('0xa4')](util['format'](_0xed70('0x13c'),_0x45c2a8[_0x16a335],_0xed70('0x13d')));return{'code':0xc8,'result':_0xed70('0x13d')};}else{logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x13c'),_0x45c2a8[_0x16a335],_0xed70('0x134')));this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')]('IFTIME\x20%s\x20%s',_0x45c2a8[_0x16a335],_0xed70('0x134')));}}return{'code':0xc8,'result':_0xed70('0x134')};};AGIVertices['prototype'][_0xed70('0x13e')]=function(_0xb54f53){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x13f'),_0xb54f53[_0xed70('0x34')]));return this[_0xed70('0xe')][_0xed70('0x13e')]();};AGIVertices[_0xed70('0x11')][_0xed70('0x140')]=function(_0x82631a){logger['info'](util[_0xed70('0x26')](_0xed70('0x141'),_0x82631a[_0xed70('0x34')]));if(!this['isConfigured'](_0x82631a['key'])){return this['channel']['noop']('no\x20key\x20configured');}var _0x431e66='wav';var _0x1f6521=util[_0xed70('0x26')](_0xed70('0x11e'),FILES_PATH,rs[_0xed70('0x109')](0x4));var _0x49472d=util[_0xed70('0x26')](_0xed70('0x96'),_0x1f6521,_0x431e66);var _0x1a7a3f=!![];if(_0x82631a['beep']===_0xed70('0x120')){_0x1a7a3f=![];}var _0x18e6f1=this[_0xed70('0xe')][_0xed70('0x12a')](_0x1f6521,_0x431e66,_0x82631a[_0xed70('0x121')],_0x82631a[_0xed70('0x63')],undefined,_0x1a7a3f);if(_0x18e6f1[_0xed70('0x9e')]!==-0x1){this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')]('ispeech\x20%s\x20file\x20created',_0x49472d));var _0x4724bd=this[_0xed70('0x7d')][_0xed70('0x6d')](this,_0x82631a,_0x49472d);if(_0x4724bd){for(var _0x295127 in _0x4724bd){if(_0x4724bd['hasOwnProperty'](_0x295127)){this[_0xed70('0xe')][_0xed70('0x97')](util[_0xed70('0x26')]('ISPEECH_ASR_%s',_0x295127[_0xed70('0x67')]()),_0x4724bd[_0x295127]);}}return this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x142'),JSON[_0xed70('0x72')](_0x4724bd)));}}return _0x18e6f1;};AGIVertices[_0xed70('0x11')][_0xed70('0x143')]=function(_0x411fe2){logger[_0xed70('0x2b')](util['format'](_0xed70('0x144'),_0x411fe2[_0xed70('0x34')]));if(!this['isConfigured'](_0x411fe2[_0xed70('0x7b')])){return this['channel'][_0xed70('0xa4')](_0xed70('0x11c'));}if(!this[_0xed70('0x7f')](_0x411fe2[_0xed70('0x59')])){return this[_0xed70('0xe')][_0xed70('0xa4')]('no\x20text\x20configured');}this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')](_0xed70('0x145'),_0x411fe2[_0xed70('0x59')]));var _0x28d439=this['ispeechTTS'][_0xed70('0x6d')](this,_0x411fe2);if(_0x28d439){this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x146'),_0x28d439));var _0x17e001=this[_0xed70('0xe')][_0xed70('0xf4')](_0x28d439,_0x411fe2['intKey']);try{fs[_0xed70('0xf5')](_0x28d439+_0xed70('0xf6'));}catch(_0x4606ba){logger[_0xed70('0x4e')](_0x4606ba);}return _0x17e001;}return this[_0xed70('0xe')][_0xed70('0x4e')](_0x411fe2,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xed70('0x11')][_0xed70('0x147')]=function(_0xc9417d){logger[_0xed70('0x2b')](util['format'](_0xed70('0x148'),_0xc9417d['label']));if(!this[_0xed70('0x7f')](_0xc9417d['findBy'])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0xc9417d,_0xed70('0x149'));}logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x14a'),this[_0xed70('0xe')][_0xed70('0x37')],_0xc9417d[_0xed70('0x14b')]));var _0x1c583d=this[_0xed70('0x51')][_0xed70('0x6d')](this,_0xc9417d[_0xed70('0x14b')]);if(_0x1c583d){logger[_0xed70('0x2b')](util[_0xed70('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xed70('0xe')][_0xed70('0x37')],_0xc9417d[_0xed70('0x14b')]));this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xed70('0xe')]['callerid'],_0xc9417d['findBy']));return{'code':0xc8,'result':_0xed70('0x14c')};}else{logger['info'](util[_0xed70('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xed70('0xe')][_0xed70('0x37')],_0xc9417d[_0xed70('0x14b')]));this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x14d'),this['channel']['callerid'],_0xc9417d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xed70('0x11')][_0xed70('0x14e')]=function(_0x238e3f){logger[_0xed70('0x2b')](util['format'](_0xed70('0x14f'),_0x238e3f['label']));if(!this[_0xed70('0x7f')](_0x238e3f[_0xed70('0x14b')])){return this[_0xed70('0xe')]['error'](_0x238e3f,_0xed70('0x149'));}logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x14a'),this[_0xed70('0xe')][_0xed70('0x37')],_0x238e3f[_0xed70('0x14b')]));var _0x1126ab=this['agentLogout']['sync'](this,_0x238e3f[_0xed70('0x14b')]);if(_0x1126ab){logger['info'](util[_0xed70('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xed70('0xe')][_0xed70('0x37')],_0x238e3f[_0xed70('0x14b')]));this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x150'),this[_0xed70('0xe')][_0xed70('0x37')],_0x238e3f['findBy']));return{'code':0xc8,'result':_0xed70('0x14c')};}else{logger['info'](util['format'](_0xed70('0x14d'),this['channel'][_0xed70('0x37')],_0x238e3f['findBy']));this[_0xed70('0xe')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xed70('0xe')]['callerid'],_0x238e3f['findBy']));return{'code':0xc8,'result':_0xed70('0x151')};}};AGIVertices[_0xed70('0x11')][_0xed70('0x152')]=function(_0x3f6843){logger[_0xed70('0x2b')](util['format'](_0xed70('0x153'),_0x3f6843[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x3f6843[_0xed70('0x154')])){return this['channel'][_0xed70('0x4e')](_0x3f6843,_0xed70('0x155'));}this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x156'),_0x3f6843[_0xed70('0x154')]));var _0x549944=eval(_0x3f6843['operation']);if(!this[_0xed70('0x7f')](_0x3f6843['variable_id'])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0xd4'));}var _0x5b2f13=this[_0xed70('0x9b')][_0xed70('0x6d')](this,_0x3f6843[_0xed70('0xd3')]);if(!_0x5b2f13){return this['channel']['error'](_0x3f6843,_0xed70('0xd5'));}if(_[_0xed70('0x92')](_0x549944)){var _0x896c7b=this;_0x549944[_0xed70('0xd6')](function(_0x1bfdee,_0x131b52){_0x896c7b[_0xed70('0xe')][_0xed70('0x97')](util[_0xed70('0x26')](_0xed70('0x157'),_0x5b2f13,_0x131b52),_0x1bfdee);});return this['channel']['noop'](util['format'](_0xed70('0x158'),_0x5b2f13));}else{return this[_0xed70('0xe')][_0xed70('0x97')](_0x5b2f13,_0x549944);}};AGIVertices[_0xed70('0x11')]['menu']=function(_0x12b0a){logger['info'](util[_0xed70('0x26')](_0xed70('0x159'),_0x12b0a['label']));if(_0x12b0a[_0xed70('0xa1')]===0x0){return this['maxRetry'](_0x12b0a);}_0x12b0a[_0xed70('0xa1')]-=0x1;if(!this[_0xed70('0x7f')](_0x12b0a[_0xed70('0x103')])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x12b0a,_0xed70('0x104'));}var _0x4ff2bb=this[_0xed70('0x1b')][_0xed70('0x6d')](this,_0x12b0a['file_id']);if(!_0x4ff2bb){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x12b0a,'no\x20file\x20audio\x20found');}var _0x33b911=this[_0xed70('0xe')][_0xed70('0x105')](_0x4ff2bb,_0x12b0a[_0xed70('0x106')],_0x12b0a[_0xed70('0x15a')]);var _0xaf8c58=_0x33b911[_0xed70('0x9e')];if(_0x33b911[_0xed70('0x9e')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x12b0a,'-1');return _0x33b911;}else if(_0x33b911[_0xed70('0x9c')]==='timeout'){_0x33b911[_0xed70('0x9e')]=_0x33b911[_0xed70('0x9e')][_0xed70('0x93')]>0x0?_0x33b911[_0xed70('0x9e')]:'t';}else if(_['isEmpty'](_0x33b911[_0xed70('0x9e')])){_0x33b911[_0xed70('0x9e')]='#';_0xaf8c58='#';}if(!this[_0xed70('0x7f')](_0x12b0a['variable_id'])){this['channel'][_0xed70('0xa4')](_0xed70('0xd4'));}else{var _0x1a3d32=this[_0xed70('0x9b')][_0xed70('0x6d')](this,_0x12b0a[_0xed70('0xd3')]);if(!_0x1a3d32){return this[_0xed70('0xe')]['error'](_0x12b0a,'no\x20variable\x20found');}this[_0xed70('0xe')][_0xed70('0x97')](_0x1a3d32,_0xaf8c58);}this['createSquareDetailsReport']['sync'](this,_0x12b0a,_0xaf8c58);return _0x33b911;};AGIVertices[_0xed70('0x11')][_0xed70('0xa4')]=function(_0x441b81){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x15b'),_0x441b81['label']));return this['channel']['noop'](_0x441b81[_0xed70('0x15c')]||_0x441b81[_0xed70('0x34')]);};AGIVertices[_0xed70('0x11')][_0xed70('0x15d')]=function(_0x1a71d9){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x15e'),_0x1a71d9[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x1a71d9[_0xed70('0x14b')])){return this[_0xed70('0xe')]['error'](_0x1a71d9,'no\x20find\x20by\x20configured');}logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x14a'),this[_0xed70('0xe')][_0xed70('0x37')],_0x1a71d9[_0xed70('0x14b')]));var _0x32b113=this[_0xed70('0x4a')]['sync'](this,_0x1a71d9[_0xed70('0x15f')]);var _0x21853c=this[_0xed70('0x4c')]['sync'](this,_0x1a71d9[_0xed70('0x14b')],_0x32b113);if(_0x21853c){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x150'),this[_0xed70('0xe')]['callerid'],_0x1a71d9[_0xed70('0x14b')]));this[_0xed70('0xe')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xed70('0x37')],_0x1a71d9[_0xed70('0x14b')]));return{'code':0xc8,'result':_0xed70('0x14c')};}else{logger[_0xed70('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xed70('0xe')][_0xed70('0x37')],_0x1a71d9[_0xed70('0x14b')]));this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x150'),this[_0xed70('0xe')]['callerid'],_0x1a71d9[_0xed70('0x14b')]));return{'code':0xc8,'result':_0xed70('0x151')};}};AGIVertices[_0xed70('0x11')]['playback']=function(_0x2b393c){logger[_0xed70('0x2b')](util['format'](_0xed70('0x160'),_0x2b393c[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x2b393c[_0xed70('0x103')])){return this['channel'][_0xed70('0x4e')](_0x2b393c,_0xed70('0x104'));}var _0x2f3337=this['getSound'][_0xed70('0x6d')](this,_0x2b393c[_0xed70('0x103')]);if(!_0x2f3337){return this['channel']['error'](_0x2b393c,'no\x20file\x20audio\x20found');}var _0x2e164a=this['channel']['exec']('PLAYBACK',[_0x2f3337,_0x2b393c[_0xed70('0xe1')]]);if(_0x2e164a[_0xed70('0x9e')]===-0x1){return _0x2e164a;}return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0xbd'),'PLAYBACK',_0x2f3337));};AGIVertices['prototype']['queue']=function(_0x41f3b7){logger[_0xed70('0x2b')](util[_0xed70('0x26')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x41f3b7['label']));if(!this[_0xed70('0x7f')](_0x41f3b7[_0xed70('0x161')])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x41f3b7,_0xed70('0x162'));}var _0x577799='';var _0x135437=parseInt(_0x41f3b7[_0xed70('0x161')],0xa);if(isNaN(_0x135437)){_0x577799=_0x41f3b7[_0xed70('0x161')];}else{_0x577799=this[_0xed70('0x163')][_0xed70('0x6d')](this,_0x41f3b7[_0xed70('0x161')]);if(!_0x577799){return this[_0xed70('0xe')]['error'](_0x41f3b7,_0xed70('0x164'));}}var _0x42da38='';if(this[_0xed70('0x7f')](_0x41f3b7[_0xed70('0x103')])){var _0x3ac656=this[_0xed70('0x1b')][_0xed70('0x6d')](this,_0x41f3b7[_0xed70('0x103')]);if(_0x3ac656){_0x42da38=_0x3ac656;}}this[_0xed70('0x32')]['sync'](this,_0x41f3b7,_0x577799);if(_0x41f3b7['opts'][_0xed70('0x165')]('x')<0x0){_0x41f3b7['opts']+='x';}if(_0x41f3b7[_0xed70('0xe1')][_0xed70('0x165')]('X')<0x0){_0x41f3b7[_0xed70('0xe1')]+='X';}this[_0xed70('0xe')][_0xed70('0x97')](_0xed70('0x166'),_0x577799?_0x577799[_0xed70('0x167')]():'');var _0x5973f9=this[_0xed70('0xe')][_0xed70('0x53')](_0xed70('0x168'),[_0x577799,_0x41f3b7['opts'],_0x41f3b7['url'],_0x42da38,_0x41f3b7['timeout'],_0x41f3b7[_0xed70('0xaf')],_0x41f3b7[_0xed70('0x169')],_0x41f3b7[_0xed70('0x16a')],'',_0x41f3b7['position']]);if(_0x5973f9[_0xed70('0x9e')]===-0x1){return _0x5973f9;}return this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')](_0xed70('0xbd'),_0xed70('0x168'),_0x577799));};AGIVertices[_0xed70('0x11')][_0xed70('0x16b')]=function(_0x1cb88f){logger[_0xed70('0x2b')](util['format'](_0xed70('0x16c'),_0x1cb88f['label']));var _0x2e4cdf=_0x1cb88f[_0xed70('0x16d')]||_0xed70('0x11d');var _0x40c9be=util['format'](_0xed70('0x16e'),this[_0xed70('0xe')]['uniqueid'],rs[_0xed70('0x109')](0x5));var _0x1071e3=util[_0xed70('0x26')](_0xed70('0x16f'),FILES_PATH,_0x40c9be,_0x2e4cdf);var _0x3a56ee=util[_0xed70('0x26')](_0xed70('0x11e'),FILES_PATH,_0x40c9be);this[_0xed70('0x38')]['sync'](this,_0x1cb88f,_0x40c9be,_0x1071e3);this['channel'][_0xed70('0x97')]('RECORDING_SAVENAME',_0x40c9be);logger[_0xed70('0x2b')](_0xed70('0x170'),_0x3a56ee,_0x2e4cdf,_0x1cb88f[_0xed70('0x171')],_0x1cb88f[_0xed70('0x63')]);return this[_0xed70('0xe')]['recordFile'](_0x3a56ee,_0x2e4cdf,_0x1cb88f[_0xed70('0x171')],_0x1cb88f[_0xed70('0x63')],undefined,!![]);};AGIVertices[_0xed70('0x11')][_0xed70('0x172')]=function(_0x29fb73){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x173'),_0x29fb73['label']));if(!this[_0xed70('0x7f')](_0x29fb73[_0xed70('0x70')])){return this[_0xed70('0xe')]['noop'](_0xed70('0x174'));}var _0x4531cd=this[_0xed70('0x61')][_0xed70('0x6d')](this,_0x29fb73);logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x175'),util[_0xed70('0x176')](_0x4531cd,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x29fb73['variable_id'])){return this[_0xed70('0xe')]['noop'](_0xed70('0x177'));}var _0x4d39da=this[_0xed70('0x9b')][_0xed70('0x6d')](this,_0x29fb73[_0xed70('0xd3')]);if(!_0x4d39da){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x29fb73,'no\x20variable\x20found');}this[_0xed70('0xe')][_0xed70('0x97')](util['format'](_0xed70('0x178'),_0x4d39da),_0x4531cd[_0xed70('0x74')]?_0x4531cd[_0xed70('0x74')]:'200');this[_0xed70('0xe')][_0xed70('0x97')](util[_0xed70('0x26')]('%s_STATUS_MESSAGE',_0x4d39da),_0x4531cd[_0xed70('0x75')]?_0x4531cd[_0xed70('0x75')]:'OK');if(_0x4531cd[_0xed70('0x68')]){try{this[_0xed70('0x95')](_0x4531cd['body'],_0x4d39da);}catch(_0x221398){logger[_0xed70('0x4e')](util[_0xed70('0x26')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4d39da));}}return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0xd9'),_0x4d39da));};AGIVertices['prototype']['saydigits']=function(_0x3ae114){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x179'),_0x3ae114[_0xed70('0x34')]));return this[_0xed70('0xe')][_0xed70('0x17a')](_0x3ae114['digits'][_0xed70('0x55')](/\s+/g,''),_0x3ae114[_0xed70('0x171')]);};AGIVertices[_0xed70('0x11')][_0xed70('0x17b')]=function(_0x3427ff){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x17c'),_0x3427ff[_0xed70('0x34')]));return this[_0xed70('0xe')][_0xed70('0x17d')](_0x3427ff[_0xed70('0x64')][_0xed70('0x55')](/\s+/g,''),_0x3427ff[_0xed70('0x171')]);};AGIVertices[_0xed70('0x11')]['sayphonetic']=function(_0x4c4675){logger[_0xed70('0x2b')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4c4675[_0xed70('0x34')]));return this['channel'][_0xed70('0x17e')](_0x4c4675[_0xed70('0x59')],_0x4c4675[_0xed70('0x171')]);};AGIVertices['prototype'][_0xed70('0x17f')]=function(_0x1942f0){logger[_0xed70('0x2b')](util[_0xed70('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x1942f0[_0xed70('0x34')]));if(!this['isConfigured'](_0x1942f0['account_id'])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0x180'));}var _0xee09c2=this['getMailAccount'][_0xed70('0x6d')](this,_0x1942f0['account_id']);if(!_0xee09c2||!_0xee09c2['Smtp']){return this[_0xed70('0xe')]['error'](_0x1942f0,_0xed70('0x181'));}var _0xbf2329={'from':util[_0xed70('0x26')](_0xed70('0x182'),_0xee09c2[_0xed70('0x13')],_0xee09c2[_0xed70('0x183')]||_0xee09c2[_0xed70('0x184')][_0xed70('0x185')]),'to':_0x1942f0['to']||'','cc':_0x1942f0['cc']||'','bcc':_0x1942f0[_0xed70('0x186')]||'','subject':_0x1942f0['subject'],'html':_0x1942f0[_0xed70('0x59')],'text':_0x1942f0['text']};var _0x4149bb={'tls':{'rejectUnauthorized':![]}};if(_0xee09c2[_0xed70('0x184')]['service']){_0x4149bb['service']=_0xee09c2[_0xed70('0x184')]['service'];}else{_0x4149bb[_0xed70('0x187')]=_0xee09c2[_0xed70('0x184')][_0xed70('0x187')];_0x4149bb[_0xed70('0x188')]=_0xee09c2[_0xed70('0x184')][_0xed70('0x188')];_0x4149bb[_0xed70('0x189')]=_0xee09c2['Smtp'][_0xed70('0x189')];}if(_0xee09c2[_0xed70('0x184')][_0xed70('0x18a')]){_0x4149bb[_0xed70('0x18b')]={'user':_0xee09c2[_0xed70('0x184')][_0xed70('0x185')],'pass':_0xee09c2['Smtp'][_0xed70('0x18c')]};}if(this[_0xed70('0x7f')](_0x1942f0[_0xed70('0x18d')])){}logger['debug'](_0xed70('0x18e'),JSON[_0xed70('0x72')](_0xbf2329));this[_0xed70('0x32')]['sync'](this,_0x1942f0,_0x1942f0['account_id']);this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x18f'),_0xee09c2[_0xed70('0x13')]));this[_0xed70('0x1f')][_0xed70('0x6d')](this,_0x4149bb,_0xbf2329);return this[_0xed70('0xe')][_0xed70('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xed70('0x190')]=function(_0x2ca728){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x191'),_0x2ca728['label']));return this[_0xed70('0xe')][_0xed70('0xa4')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xed70('0x11')][_0xed70('0x192')]=function(_0x11f426){logger['info'](util['format'](_0xed70('0x193'),_0x11f426[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x11f426[_0xed70('0x194')])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0x195'));}var _0x43d983=this[_0xed70('0x196')][_0xed70('0x6d')](this,_0x11f426[_0xed70('0x194')]);if(!_0x43d983){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x11f426,_0xed70('0x197'));}var _0x273216={'body':_0x11f426['sms_text'],'phone':_0x11f426['to']||'','SmsAccountId':_0x43d983['id']};logger[_0xed70('0xdb')](_0xed70('0x198'),JSON[_0xed70('0x72')](_0x273216));this[_0xed70('0x32')][_0xed70('0x6d')](this,_0x11f426,_0x11f426[_0xed70('0x194')]);this[_0xed70('0xe')]['noop'](util[_0xed70('0x26')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x43d983[_0xed70('0x13')]));this['createSmsMessage'][_0xed70('0x6d')](this,_0x273216);return this['channel'][_0xed70('0xa4')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xed70('0x199')]=function(_0x203a91){logger[_0xed70('0x2b')](util[_0xed70('0x26')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x203a91[_0xed70('0x34')]));if(!this['isConfigured'](_0x203a91['variable_id'])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x203a91,_0xed70('0x19a'));}var _0x217859=this[_0xed70('0x9b')]['sync'](this,_0x203a91[_0xed70('0xd3')]);if(!_0x217859){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x203a91,_0xed70('0xd5'));}return this[_0xed70('0xe')][_0xed70('0x97')](_0x217859,_0x203a91[_0xed70('0x19b')]);};AGIVertices['prototype'][_0xed70('0x19c')]=function(_0x1ceba5){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x19d'),_0x1ceba5['label']));this[_0xed70('0xe')][_0xed70('0xa4')]('START\x20CALLY\x20SQUARE');if(_0x1ceba5[_0xed70('0xb6')]===_0xed70('0x19e')){this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0x19f'));return this[_0xed70('0xe')]['answer']();}return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0x1a0'));};AGIVertices[_0xed70('0x11')][_0xed70('0x1a1')]=function(_0x306025){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x1a2'),_0x306025[_0xed70('0x34')]));if(!this['isConfigured'](_0x306025[_0xed70('0x1a3')])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x306025,'no\x20subproject\x20selected');}var _0x458cb6=this[_0xed70('0x16')]['sync'](this,_0x306025['project_id']);if(!this['isConfigured'](_0x458cb6)){return this['channel']['error'](_0x306025,util['format'](_0xed70('0x1a4'),_0x306025[_0xed70('0x1a3')]));}if(_0x458cb6===this[_0xed70('0xe')][_0xed70('0x36')]){return this[_0xed70('0xe')]['error'](_0x306025,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x306025,_0x458cb6);var _0x4dc0e8=this[_0xed70('0xe')][_0xed70('0x53')](_0xed70('0x1a5'),util['format'](_0xed70('0x1a6'),config['agi'][_0xed70('0x187')]||_0xed70('0x1a7'),_0x458cb6,this[_0xed70('0xe')]['arg_1']));if(_0x4dc0e8[_0xed70('0x9e')]===-0x1){return _0x4dc0e8;}return this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')]('Executed\x20command\x20%s\x20%s',_0xed70('0x1a5'),_0x458cb6));};AGIVertices[_0xed70('0x11')][_0xed70('0x1a8')]=function(_0x4c3ad4){logger[_0xed70('0x2b')](util[_0xed70('0x26')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4c3ad4[_0xed70('0x34')]));var _0x3430dc=this[_0xed70('0x52')][_0xed70('0x6d')](this,_0x4c3ad4[_0xed70('0xb1')]);this['createSquareDetailsReport'][_0xed70('0x6d')](this,_0x4c3ad4,_0x4c3ad4[_0xed70('0xb1')]);if(this[_0xed70('0x7f')](_0x4c3ad4[_0xed70('0xd3')])){var _0x5f0024=this[_0xed70('0x9b')][_0xed70('0x6d')](this,_0x4c3ad4['variable_id']);if(_0x5f0024){this[_0xed70('0xe')][_0xed70('0x97')](_0x5f0024,_0x3430dc);return this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x1a9'),_0x4c3ad4[_0xed70('0xb1')],_0x5f0024));}}return this[_0xed70('0xe')][_0xed70('0xa4')](util['format'](_0xed70('0x1aa'),_0x4c3ad4['command']));};AGIVertices[_0xed70('0x11')][_0xed70('0x1ab')]=function(_0x4b369b){logger['info'](util[_0xed70('0x26')](_0xed70('0x1ac'),_0x4b369b[_0xed70('0x34')]));_0x4b369b[_0xed70('0x59')]=_0x4b369b[_0xed70('0x59')][_0xed70('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4b369b[_0xed70('0x57')])){return this[_0xed70('0xe')][_0xed70('0xa4')](_0xed70('0x1ad'));}if(!this['isConfigured'](_0x4b369b[_0xed70('0x59')])){return this['channel'][_0xed70('0xa4')]('no\x20text\x20configured');}this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x1ae'),_0x4b369b[_0xed70('0x59')]));var _0xa46ef0=this[_0xed70('0x56')][_0xed70('0x6d')](this,_0x4b369b);if(_0xa46ef0){this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0xa46ef0));var _0x270b4e=this[_0xed70('0xe')][_0xed70('0xf4')](_0xa46ef0);try{fs[_0xed70('0xf5')](_0xa46ef0+_0xed70('0xf6'));}catch(_0xe88892){logger[_0xed70('0x4e')](_0xe88892);}return _0x270b4e;}return this['channel'][_0xed70('0x4e')](_0x4b369b,_0xed70('0x1af'));};AGIVertices[_0xed70('0x11')][_0xed70('0x1b0')]=function(_0x33e8b9){logger['info'](util[_0xed70('0x26')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x33e8b9['label']));_0x33e8b9[_0xed70('0x59')]=_0x33e8b9[_0xed70('0x59')][_0xed70('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x33e8b9[_0xed70('0x59')])){return this['channel'][_0xed70('0xa4')]('no\x20text\x20configured');}this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x1b1'),_0x33e8b9['text']));var _0x4d2dc4=this[_0xed70('0x60')][_0xed70('0x6d')](this,_0x33e8b9);if(_0x4d2dc4){this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x1b2'),_0x4d2dc4));var _0x194173=this['channel'][_0xed70('0xf4')](_0x4d2dc4);try{fs[_0xed70('0xf5')](_0x4d2dc4+_0xed70('0xf6'));}catch(_0x3747c3){logger[_0xed70('0x4e')](_0x3747c3);}return _0x194173;}return this['channel']['error'](_0x33e8b9,_0xed70('0x1b3'));};AGIVertices[_0xed70('0x11')][_0xed70('0x1b4')]=function(_0x2b7d26){logger['info'](util[_0xed70('0x26')](_0xed70('0x1b5'),_0x2b7d26[_0xed70('0x34')]));if(!this[_0xed70('0x7f')](_0x2b7d26[_0xed70('0x14b')])){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x2b7d26,_0xed70('0x149'));}logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x14a'),this[_0xed70('0xe')][_0xed70('0x37')],_0x2b7d26['findBy']));var _0x4b447f=this[_0xed70('0x4f')][_0xed70('0x6d')](this,_0x2b7d26[_0xed70('0x14b')]);if(_0x4b447f){logger['info'](util[_0xed70('0x26')](_0xed70('0x150'),this[_0xed70('0xe')]['callerid'],_0x2b7d26[_0xed70('0x14b')]));this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x150'),this['channel'][_0xed70('0x37')],_0x2b7d26['findBy']));return{'code':0xc8,'result':_0xed70('0x14c')};}else{logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x14d'),this[_0xed70('0xe')][_0xed70('0x37')],_0x2b7d26[_0xed70('0x14b')]));this[_0xed70('0xe')][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0x14d'),this[_0xed70('0xe')][_0xed70('0x37')],_0x2b7d26[_0xed70('0x14b')]));return{'code':0xc8,'result':_0xed70('0x151')};}};AGIVertices[_0xed70('0x11')]['voicemail']=function(_0x25f289){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x1b6'),_0x25f289[_0xed70('0x34')]));var _0x2e6c3c=this['channel']['exec']('VOICEMAIL',[_0x25f289['mailbox'],_0x25f289[_0xed70('0x78')]]);if(_0x2e6c3c[_0xed70('0x9e')]===-0x1){return _0x2e6c3c;}return this['channel'][_0xed70('0xa4')](util[_0xed70('0x26')](_0xed70('0xbd'),_0xed70('0x1b7'),_0x25f289['mailbox']));};AGIVertices[_0xed70('0x11')][_0xed70('0x1b8')]=function(_0x4ec6f6){logger[_0xed70('0x2b')](util[_0xed70('0x26')](_0xed70('0x1b9'),_0x4ec6f6['label']));if(!this[_0xed70('0x7f')](_0x4ec6f6[_0xed70('0xd3')])){return this[_0xed70('0xe')]['error'](_0x4ec6f6,_0xed70('0x19a'));}var _0x1a90d5=this[_0xed70('0x9b')][_0xed70('0x6d')](this,_0x4ec6f6[_0xed70('0xd3')]);if(!_0x1a90d5){return this[_0xed70('0xe')][_0xed70('0x4e')](_0x4ec6f6,'no\x20variable\x20found');}var _0x161ca6=this['channel'][_0xed70('0x9b')](_0x1a90d5);return{'code':0xc8,'result':_0x161ca6['extra']?_0x161ca6[_0xed70('0x9c')]:'-'};};String[_0xed70('0x11')]['replaceAll']=function(_0x19059d,_0x292054){return this[_0xed70('0x99')](_0x19059d)[_0xed70('0x1ba')](_0x292054);};module[_0xed70('0x1bb')]=AGIVertices; \ No newline at end of file +var _0x6b19=['SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getSound','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','no\x20variable\x20selected\x20for\x20the\x20result','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sendSMS\x20message','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','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','replaceAll','exports','path','lodash','shelljs','randomstring','moment','mustache','request-promise','agi','../../config/environment','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','prototype','getSquareProject','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','isString','includes','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','saveRestApiResult','isArray','length','%s.%s','setVariable','stringify','split','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','isConfigured','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','exec','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','RECOG_CONFIDENCE()','getAndSetVariable','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()'];(function(_0x1e4c41,_0x5dbebe){var _0x5240ac=function(_0x2d7642){while(--_0x2d7642){_0x1e4c41['push'](_0x1e4c41['shift']());}};_0x5240ac(++_0x5dbebe);}(_0x6b19,0xf4));var _0x96b1=function(_0x43f20c,_0x28b006){_0x43f20c=_0x43f20c-0x0;var _0x25861d=_0x6b19[_0x43f20c];return _0x25861d;};'use strict';var fs=require('fs');var path=require(_0x96b1('0x0'));var util=require('util');var _=require(_0x96b1('0x1'));var sh=require(_0x96b1('0x2'));var odbc=require('odbc')();var rs=require(_0x96b1('0x3'));var moment=require(_0x96b1('0x4'));var Mustache=require(_0x96b1('0x5'));var rp=require(_0x96b1('0x6'));var logger=require('../../config/logger')(_0x96b1('0x7'));var config=require(_0x96b1('0x8'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x96b1('0x9'),_0x96b1('0xa')];var verticesWithRetry=['menu',_0x96b1('0xb'),_0x96b1('0xc')];var AGIVertices=function(_0x4b9675,_0x22e4c7,_0x6323a6){this[_0x96b1('0xd')]=_0x4b9675;this[_0x96b1('0xe')]=_0x22e4c7;this[_0x96b1('0xf')]=_0x6323a6;};AGIVertices['prototype'][_0x96b1('0x10')]=function(_0x4effd5,_0x569404){this['rpc']['getVariableById'](_0x4effd5)[_0x96b1('0x11')](function(_0x29df5c){_0x569404(null,_0x29df5c?_0x29df5c[_0x96b1('0x12')]:![]);})[_0x96b1('0x13')](function(_0x2d7569){_0x569404(_0x2d7569);});};AGIVertices['prototype'][_0x96b1('0x14')]=function(_0xfa00b9,_0xe809b6){this[_0x96b1('0xe')][_0x96b1('0x15')](_0xfa00b9)[_0x96b1('0x11')](function(_0x2eddaf){_0xe809b6(null,_0x2eddaf?_0x2eddaf[_0x96b1('0x12')]:![]);})[_0x96b1('0x13')](function(_0x5772d3){_0xe809b6(_0x5772d3);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x17')]=function(_0x3d871f,_0x350b2c){this[_0x96b1('0xe')][_0x96b1('0x18')](_0x3d871f)[_0x96b1('0x11')](function(_0x41227b){_0x350b2c(null,_0x41227b?_0x41227b[_0x96b1('0x12')]:![]);})[_0x96b1('0x13')](function(_0xd1eebb){_0x350b2c(_0xd1eebb);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x151178,_0x5c9cb4){this['rpc'][_0x96b1('0x19')](_0x151178)[_0x96b1('0x11')](function(_0x2bb819){_0x5c9cb4(null,_0x2bb819?_0x2bb819['dsn']:![]);})[_0x96b1('0x13')](function(_0x3954e3){_0x5c9cb4(_0x3954e3);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x1a')]=function(_0x1e1436,_0x276919){this[_0x96b1('0xe')][_0x96b1('0x1b')](_0x1e1436)[_0x96b1('0x11')](function(_0x3a17d3){_0x276919(null,_0x3a17d3?_0x3a17d3[_0x96b1('0x12')]:![]);})[_0x96b1('0x13')](function(_0x295f05){_0x276919(_0x295f05);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x1c')]=function(_0x232d49,_0x1db6ba){this[_0x96b1('0xe')][_0x96b1('0x1d')](_0x232d49)[_0x96b1('0x11')](function(_0x1bc6d3){_0x1db6ba(null,_0x1bc6d3?_0x1bc6d3[_0x96b1('0x12')]:![]);})[_0x96b1('0x13')](function(_0x2ad760){_0x1db6ba(_0x2ad760);});};AGIVertices['prototype']['getSound']=function(_0x86d0a5,_0x4bc715){var _0x3783c3=this;this[_0x96b1('0xe')][_0x96b1('0x1e')](_0x86d0a5)[_0x96b1('0x11')](function(_0x4e4426){_0x4bc715(null,_0x4e4426?_0x3783c3['getSoundPath'](_0x4e4426[_0x96b1('0x1f')]):![]);})[_0x96b1('0x13')](function(_0x5a9332){_0x4bc715(_0x5a9332);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x20')]=function(_0xfa903e,_0x2262ad){this[_0x96b1('0xe')][_0x96b1('0x21')](_0xfa903e)['then'](function(_0x4716a4){_0x2262ad(null,_0x4716a4?_0x4716a4:![]);})[_0x96b1('0x13')](function(_0x17446f){_0x2262ad(_0x17446f);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x22')]=function(_0x3bd701,_0x24fcbc,_0x303dc1){this['mailRpc'][_0x96b1('0x22')](_0x3bd701,_0x24fcbc)[_0x96b1('0x11')](function(){_0x303dc1(null);})[_0x96b1('0x13')](function(_0x427cbe){_0x303dc1(_0x427cbe);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x23')]=function(_0x18900c,_0xa20b04){this['rpc'][_0x96b1('0x24')](_0x18900c)[_0x96b1('0x11')](function(_0x39f9b3){if(_0x39f9b3){if(_0x39f9b3['IntervalId']){_0xa20b04(null,[_0x39f9b3['interval']]);}else{_0xa20b04(null,_[_0x96b1('0x25')](_0x39f9b3[_0x96b1('0x26')],'interval'));}}else{_0xa20b04(null,![]);}})['catch'](function(_0x5ee511){_0xa20b04(_0x5ee511);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x27')]=function(_0x3cc6e1){return util[_0x96b1('0x28')](_0x96b1('0x29'),FILES_PATH,_0x3cc6e1);};AGIVertices[_0x96b1('0x16')][_0x96b1('0x2a')]=function(_0x5c5c54,_0x325d96,_0x5bbf02){odbc['open'](_0x5c5c54,function(_0x307af1){if(_0x307af1){logger[_0x96b1('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x307af1);_0x5bbf02(_0x307af1);}else{logger[_0x96b1('0x2c')](_0x96b1('0x2d'));odbc[_0x96b1('0x2e')](_0x325d96,function(_0x3b515a,_0xe98a06){if(_0x3b515a){logger['info'](_0x96b1('0x2f'),_0x325d96);_0x5bbf02(_0x3b515a);}else{logger[_0x96b1('0x2c')](_0x96b1('0x30'),_0x325d96);odbc['close'](function(_0x3eff3e){if(_0x3eff3e){logger['error'](_0x96b1('0x31'),_0x3eff3e);}_0x5bbf02(null,_0xe98a06);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3b9d95,_0x2cb107){this[_0x96b1('0xe')][_0x96b1('0x32')](_0x3b9d95)['then'](function(_0x46008a){_0x2cb107(null,_0x46008a?_0x46008a:![]);})[_0x96b1('0x13')](function(_0x76db3c){_0x2cb107(_0x76db3c);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x33')]=function(_0x2191d2,_0x42fae6){this['rpc'][_0x96b1('0x33')](_0x2191d2)[_0x96b1('0x11')](function(_0x2a38dc){_0x42fae6(null,_0x2a38dc);})[_0x96b1('0x13')](function(_0x50949f){_0x42fae6(_0x50949f);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x34')]=function(_0x40a022,_0x2b9dc8,_0xb53b7c){this[_0x96b1('0xe')][_0x96b1('0x34')]({'uniqueid':this['channel'][_0x96b1('0x35')],'node':_0x40a022['label'],'application':_0x40a022[_0x96b1('0x36')],'data':_0x2b9dc8||null,'project_name':this[_0x96b1('0xd')][_0x96b1('0x37')],'callerid':this[_0x96b1('0xd')][_0x96b1('0x38')]})[_0x96b1('0x11')](function(_0x10dd00){if(_0xb53b7c){_0xb53b7c(null,_0x10dd00);}})[_0x96b1('0x13')](function(_0x454602){if(_0xb53b7c){_0xb53b7c(_0x454602);}});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x39')]=function(_0x17f9d3,_0x5dff5b,_0x5d8836,_0x301df2){this['rpc']['createSquareRecording']({'uniqueid':this[_0x96b1('0xd')]['uniqueid'],'callerid':this[_0x96b1('0xd')][_0x96b1('0x38')],'calleridname':this[_0x96b1('0xd')]['calleridname'],'context':this[_0x96b1('0xd')][_0x96b1('0x3a')],'extension':this[_0x96b1('0xd')][_0x96b1('0x3b')],'priority':this['channel'][_0x96b1('0x3c')],'accountcode':this['channel'][_0x96b1('0x3d')],'dnid':this[_0x96b1('0xd')][_0x96b1('0x3e')],'projectName':this[_0x96b1('0xd')][_0x96b1('0x37')],'saveName':_0x5dff5b,'filename':_0x17f9d3[_0x96b1('0x3f')]||_0x5dff5b,'savePath':_0x5d8836})[_0x96b1('0x11')](function(_0x1869f4){_0x301df2(null,_0x1869f4);})['catch'](function(_0x314d50){_0x301df2(_0x314d50);});};AGIVertices[_0x96b1('0x16')]['createSquareMessage']=function(_0x2f9127,_0x214795,_0x3ad22b){this[_0x96b1('0xe')][_0x96b1('0x40')]({'uniqueid':this[_0x96b1('0xd')][_0x96b1('0x35')],'body':_0x2f9127,'direction':_0x214795})[_0x96b1('0x11')](function(_0x3fa699){if(_0x3ad22b){_0x3ad22b(null,_0x3fa699);}})['catch'](function(_0x2c2d46){if(_0x3ad22b){_0x3ad22b(_0x2c2d46);}});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x41')]=function(_0xdcda25,_0x30b202){this['rpc'][_0x96b1('0x41')]({'firstName':_['isEmpty'](_0xdcda25[_0x96b1('0x12')])||_[_0x96b1('0x42')](_0xdcda25[_0x96b1('0x12')])?_0x96b1('0x43')+Math[_0x96b1('0x44')]():_0xdcda25['name'],'lastName':_[_0x96b1('0x45')](_0xdcda25[_0x96b1('0x46')])||_[_0x96b1('0x42')](_0xdcda25['lastName'])?null:_0xdcda25['lastName'],'phone':_0xdcda25[_0x96b1('0x47')],'ListId':_0xdcda25[_0x96b1('0x48')],'scheduledat':_0xdcda25[_0x96b1('0x49')],'callbackUniqueid':this[_0x96b1('0xd')][_0x96b1('0x35')],'tags':_0x96b1('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0xdcda25[_0x96b1('0x49')][_0x96b1('0x4b')](),'priority':_0xdcda25[_0x96b1('0x4c')]})[_0x96b1('0x11')](function(_0x46dbc6){_0x30b202(null,_0x46dbc6);})[_0x96b1('0x13')](function(_0x45634f){_0x30b202(_0x45634f);});};AGIVertices['prototype'][_0x96b1('0x4d')]=function(_0x1eca41,_0x84e701){this['rpc'][_0x96b1('0x4e')](_0x1eca41)[_0x96b1('0x11')](function(_0x347c1c){_0x84e701(null,_0x347c1c?_0x347c1c[_0x96b1('0x12')]:![]);})['catch'](function(_0x503ac6){_0x84e701(_0x503ac6);});};AGIVertices[_0x96b1('0x16')]['agentPause']=function(_0x43c33f,_0x1cf616,_0x16824c){var _0xa33c46={'role':_0x96b1('0x4f')};_0xa33c46[_0x43c33f]=this['channel'][_0x96b1('0x38')];this[_0x96b1('0xe')]['agentPause'](_0xa33c46,_0x1cf616,this['channel'][_0x96b1('0x35')])[_0x96b1('0x11')](function(_0x2d77a0){_0x16824c(null,_[_0x96b1('0x42')](_0x2d77a0)?![]:!![]);})[_0x96b1('0x13')](function(_0x3c92f6){logger['error'](_0x3c92f6);_0x16824c(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x57e1c3,_0x44f3fe){var _0x4efb76={'role':'agent'};_0x4efb76[_0x57e1c3]=this[_0x96b1('0xd')]['callerid'];this['rpc'][_0x96b1('0x50')](_0x4efb76)[_0x96b1('0x11')](function(_0x2bc7ad){_0x44f3fe(null,_[_0x96b1('0x42')](_0x2bc7ad)?![]:!![]);})[_0x96b1('0x13')](function(_0x18c6cf){logger['error'](_0x18c6cf);_0x44f3fe(null,![]);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x51')]=function(_0x3031f6,_0x23b578){var _0x189db3={'role':_0x96b1('0x4f')};_0x189db3[_0x3031f6]=this[_0x96b1('0xd')][_0x96b1('0x38')];this[_0x96b1('0xe')][_0x96b1('0x51')](_0x189db3)[_0x96b1('0x11')](function(_0x579759){_0x23b578(null,_['isNil'](_0x579759)?![]:!![]);})[_0x96b1('0x13')](function(_0x3b46a6){logger[_0x96b1('0x2b')](_0x3b46a6);_0x23b578(null,![]);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x52')]=function(_0x1a978,_0x3f88fb){var _0x2fc883={'role':_0x96b1('0x4f')};_0x2fc883[_0x1a978]=this[_0x96b1('0xd')][_0x96b1('0x38')];var _0x496d2e=_0x1a978!=_0x96b1('0x53')?util[_0x96b1('0x28')](_0x96b1('0x54'),_0x96b1('0x55'),this[_0x96b1('0xd')][_0x96b1('0x38')]):undefined;this[_0x96b1('0xe')][_0x96b1('0x52')](_0x2fc883,_0x496d2e)[_0x96b1('0x11')](function(_0x102ed3){_0x3f88fb(null,_['isNil'](_0x102ed3)?![]:!![]);})[_0x96b1('0x13')](function(_0xff8c6f){logger['error'](_0xff8c6f);_0x3f88fb(null,![]);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x56')]=function(_0x2b2965,_0x3d9ef9){sh['exec'](_['trim'](_0x2b2965),function(_0x3600f8,_0xe780c){var _0xb2ec16=_0xe780c[_0x96b1('0x57')](/(\r\n|\n|\r)/gm,'');_0x3d9ef9(null,_0xb2ec16);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x58')]=function(_0x2786d1,_0x781da9){scripts['googleCloudTTS'](_0x2786d1[_0x96b1('0x59')],_0x2786d1[_0x96b1('0x5a')]||_0x96b1('0x5b'),_0x2786d1['text'],_0x2786d1['languageCode']||_0x96b1('0x5c'),_0x2786d1[_0x96b1('0x5d')]||_0x96b1('0x5e'),_0x2786d1[_0x96b1('0x5f')]||_0x96b1('0x60'))[_0x96b1('0x11')](function(_0x39b54d){_0x781da9(null,_0x39b54d);})[_0x96b1('0x13')](function(_0x400ecf){_0x781da9(_0x400ecf);});};AGIVertices['prototype']['googleTTS']=function(_0x363177,_0x583c72){scripts['googleTTS'](_0x363177['text'],_0x363177[_0x96b1('0x61')]||'en',0x1)['then'](function(_0x4756a5){_0x583c72(null,_0x4756a5);})[_0x96b1('0x13')](function(_0x190064){_0x583c72(_0x190064);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x62')]=function(_0x1810b4,_0x11ce65){var _0x42af7e={'uri':_0x1810b4[_0x96b1('0x63')],'method':_0x1810b4[_0x96b1('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1810b4[_0x96b1('0x65')])===_0x96b1('0x66')&&parseInt(_0x1810b4['timeout'])>=0x1?parseInt(_0x1810b4[_0x96b1('0x65')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x96b1('0x67'),_0x96b1('0x68')],_0x42af7e[_0x96b1('0x64')]['toUpperCase']())){try{_0x42af7e[_0x96b1('0x69')]=_0x1810b4[_0x96b1('0xa')]?JSON[_0x96b1('0x6a')](_0x1810b4['rawBody']):{};}catch(_0x5d90de){logger[_0x96b1('0x2b')](_0x96b1('0x6b'),_0x5d90de);}}try{_0x42af7e[_0x96b1('0x6c')]=_0x1810b4[_0x96b1('0x9')]?JSON[_0x96b1('0x6a')](_0x1810b4['rawHeaders']):{};}catch(_0x1e3611){logger[_0x96b1('0x2b')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1e3611);}if(_0x1810b4[_0x96b1('0x6d')]){try{var _0x5d1b18=require(_0x1810b4[_0x96b1('0x6d')])['sync'](this,_0x42af7e);_0x42af7e[_0x96b1('0x6e')]=Mustache[_0x96b1('0x6f')](_0x1810b4['url'],_0x5d1b18,{},['$$','$$']);if(_0x42af7e[_0x96b1('0x6c')]){_0x42af7e[_0x96b1('0x6c')]=JSON[_0x96b1('0x6a')](Mustache['render'](JSON['stringify'](_0x42af7e['headers']),_0x5d1b18,{},['$$','$$']));}if(_0x42af7e['body']){_0x42af7e['body']=JSON[_0x96b1('0x6a')](Mustache[_0x96b1('0x6f')](JSON['stringify'](_0x42af7e[_0x96b1('0x69')]),_0x5d1b18,{},['$$','$$']));}}catch(_0xec9735){logger[_0x96b1('0x2b')](_0x96b1('0x70'),_0xec9735);}}rp(_0x42af7e)[_0x96b1('0x11')](function(_0x373c60){var _0x597fa6={'statusCode':_0x373c60[_0x96b1('0x71')]||0xc8,'statusMessage':_0x373c60[_0x96b1('0x72')]||'OK','headers':_0x373c60[_0x96b1('0x6c')]||{},'body':_0x373c60[_0x96b1('0x69')]||{}};_0x11ce65(null,_0x597fa6);})[_0x96b1('0x13')](function(_0x30f018){var _0x4eb781={'statusCode':_0x30f018[_0x96b1('0x71')]||0x1f4,'statusMessage':_0x30f018[_0x96b1('0x73')]||_0x96b1('0x74'),'headers':_0x30f018[_0x96b1('0x75')][_0x96b1('0x6c')]||{},'body':_0x30f018[_0x96b1('0x75')][_0x96b1('0x69')]||{}};_0x11ce65(null,_0x4eb781);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x76')]=function(_0x80edb8,_0x4a1f57){scripts['googleDialogflow'](this['channel']['uniqueid'],_0x80edb8[_0x96b1('0x77')],_0x80edb8[_0x96b1('0x5b')],_0x80edb8['dialogflow_language']||'en')[_0x96b1('0x11')](function(_0x40d90e){_0x4a1f57(null,_0x40d90e);})[_0x96b1('0x13')](function(_0x241432){_0x4a1f57(_0x241432);});};AGIVertices['prototype']['sestekNDA']=function(_0x558430,_0x9cd23d){scripts[_0x96b1('0x78')](this[_0x96b1('0xd')],_0x558430)[_0x96b1('0x11')](function(_0x1201b1){_0x9cd23d(null,_0x1201b1);})[_0x96b1('0x13')](function(_0x536b1e){_0x9cd23d(_0x536b1e);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x79')]=function(_0x4be6b3,_0x948ed){scripts[_0x96b1('0x79')](_0x4be6b3['key'],_0x4be6b3[_0x96b1('0x5b')],_0x4be6b3[_0x96b1('0x7a')]||_0x96b1('0x5c'),_0x4be6b3[_0x96b1('0x7b')])[_0x96b1('0x11')](function(_0x4695bf){_0x948ed(null,_0x4695bf);})['catch'](function(_0x4bd585){_0x948ed(_0x4bd585);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x7c')]=function(_0x3a1290,_0x50bd58,_0x26cefc){scripts['ispeechASR'](_0x50bd58,_0x3a1290[_0x96b1('0x77')],_0x3a1290[_0x96b1('0x7d')]||_0x96b1('0x5c'),this['isConfigured'](_0x3a1290[_0x96b1('0x7e')])?_0x3a1290['model']:undefined)['then'](function(_0x43e982){_0x26cefc(null,_0x43e982);})[_0x96b1('0x13')](function(_0x39d827){_0x26cefc(_0x39d827);});};AGIVertices[_0x96b1('0x16')]['awsPolly']=function(_0x3bb00e,_0x1fab1a){scripts[_0x96b1('0x7f')](_0x3bb00e[_0x96b1('0x80')],_0x3bb00e[_0x96b1('0x81')],_0x3bb00e['aws_polly_region'],_0x3bb00e[_0x96b1('0x82')]||_0x96b1('0x83'),_0x3bb00e[_0x96b1('0x5b')],_0x3bb00e[_0x96b1('0x84')]||_0x96b1('0x5b'))[_0x96b1('0x11')](function(_0x269735){_0x1fab1a(null,_0x269735);})[_0x96b1('0x13')](function(_0x2f8b6c){_0x1fab1a(_0x2f8b6c);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x85')]=function(_0x1b688f,_0x456732){scripts[_0x96b1('0x85')](this[_0x96b1('0xd')][_0x96b1('0x35')],_0x1b688f[_0x96b1('0x80')],_0x1b688f['aws_secret_access_key'],_0x1b688f[_0x96b1('0x86')],_0x1b688f['text'],_0x1b688f['aws_bot_name'])[_0x96b1('0x11')](function(_0x22160b){_0x456732(null,_0x22160b);})[_0x96b1('0x13')](function(_0x2d9f68){_0x456732(_0x2d9f68);});};AGIVertices[_0x96b1('0x16')]['googleASR']=function(_0x478cee,_0x1feec6,_0x2c7ce4){scripts[_0x96b1('0x87')](_0x1feec6,_0x478cee[_0x96b1('0x77')],_0x478cee[_0x96b1('0x88')]||'en-US')[_0x96b1('0x11')](function(_0x3fbf08){_0x2c7ce4(null,_0x3fbf08);})['catch'](function(_0x4cf330){_0x2c7ce4(_0x4cf330);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x89')]=function(_0x256c93,_0x1aa813,_0x227907){scripts[_0x96b1('0x89')](_0x1aa813,_0x256c93[_0x96b1('0x8a')],_0x256c93[_0x96b1('0x8b')],_0x256c93[_0x96b1('0x6e')])[_0x96b1('0x11')](function(_0x172bf0){_0x227907(null,_0x172bf0);})[_0x96b1('0x13')](function(_0x172869){_0x227907(_0x172869);});};AGIVertices[_0x96b1('0x16')][_0x96b1('0x8c')]=function(_0x41d58b){var _0x70ceef=_['includes'](verticesWithRetry,_0x41d58b[_0x96b1('0x36')])?_0x41d58b:_[_0x96b1('0x8d')](_0x41d58b);for(var _0x3d6c46 in _0x70ceef){if(_0x70ceef['hasOwnProperty'](_0x3d6c46)){if(_0x70ceef[_0x3d6c46]&&_[_0x96b1('0x8e')](_0x70ceef[_0x3d6c46])){if(_[_0x96b1('0x8f')](recursiveMapAttributes,_0x3d6c46)){_0x70ceef[_0x3d6c46]=this[_0x96b1('0x90')](_0x70ceef[_0x3d6c46]);}else{_0x70ceef[_0x3d6c46]=this[_0x96b1('0x91')](_0x70ceef[_0x3d6c46]);}}}}return _0x70ceef;};AGIVertices[_0x96b1('0x16')]['recursiveNodeIndex']=function(_0xdb4047){for(var _0x2dbb91 in _0xdb4047){if(_0xdb4047[_0x96b1('0x92')](_0x2dbb91)){if(_[_0x96b1('0x93')](_0xdb4047[_0x2dbb91])){this[_0x96b1('0x94')](_0xdb4047[_0x2dbb91]);}else if(_['isArray'](_0xdb4047[_0x2dbb91])){for(var _0x5c42f0=0x0;_0x5c42f0<_0xdb4047[_0x2dbb91]['length'];_0x5c42f0++){this[_0x96b1('0x94')](_0xdb4047[_0x2dbb91][_0x5c42f0]);}}else if(_[_0x96b1('0x8e')](_0xdb4047[_0x2dbb91])){_0xdb4047[_0x2dbb91]=this['replaceAllVariables'](_0xdb4047[_0x2dbb91]);}}}};AGIVertices[_0x96b1('0x16')][_0x96b1('0x95')]=function(_0xbc9ecb,_0x44c775){for(var _0x4087aa in _0xbc9ecb){if(_0xbc9ecb[_0x96b1('0x92')](_0x4087aa)){if(_[_0x96b1('0x93')](_0xbc9ecb[_0x4087aa])){if(!_[_0x96b1('0x45')](_0xbc9ecb[_0x4087aa])){this[_0x96b1('0x95')](_0xbc9ecb[_0x4087aa],util[_0x96b1('0x28')]('%s.%s',_0x44c775,_0x4087aa));}}else if(_[_0x96b1('0x96')](_0xbc9ecb[_0x4087aa])){for(var _0x48ea41=0x0;_0x48ea41<_0xbc9ecb[_0x4087aa][_0x96b1('0x97')];_0x48ea41++){this[_0x96b1('0x95')](_0xbc9ecb[_0x4087aa][_0x48ea41],util['format'](_0x96b1('0x98'),_0x44c775,_0x4087aa+'['+_0x48ea41+']'));}}else{if(!_[_0x96b1('0x42')](_0xbc9ecb[_0x4087aa])){this[_0x96b1('0xd')][_0x96b1('0x99')](util[_0x96b1('0x28')](_0x96b1('0x98'),_0x44c775,_0x4087aa),_0xbc9ecb[_0x4087aa]);}}}}};AGIVertices[_0x96b1('0x16')][_0x96b1('0x90')]=function(_0x38cdbe){try{var _0x5f4959=JSON[_0x96b1('0x6a')](_0x38cdbe);this[_0x96b1('0x94')](_0x5f4959);return JSON[_0x96b1('0x9a')](_0x5f4959);}catch(_0x3da582){return this[_0x96b1('0x91')](_0x38cdbe);}};AGIVertices[_0x96b1('0x16')]['replaceAllVariables']=function(_0x51977a){var _0x3c10a8=_0x51977a[_0x96b1('0x9b')]('{');for(var _0x3b7fcb=0x1;_0x3b7fcb<_0x3c10a8[_0x96b1('0x97')];_0x3b7fcb+=0x1){var _0x4832b8=_0x3c10a8[_0x3b7fcb][_0x96b1('0x9b')]('}');if(_0x4832b8[_0x96b1('0x97')]>0x1){_0x51977a=_0x51977a['replaceAll']('{'+_0x4832b8[0x0]+'}',this[_0x96b1('0xd')][_0x96b1('0x10')](_0x4832b8[0x0])['extra']||_0x4832b8[0x0]);}}if(_0x3c10a8[_0x96b1('0x97')]===0x1){return _0x51977a['toString']();}return this[_0x96b1('0x91')](_0x51977a);};AGIVertices[_0x96b1('0x16')]['getAndSetVariable']=function(_0x2dafd6,_0x388ffd){var _0x58b6e8=this['channel'][_0x96b1('0x10')](_0x2dafd6);if(_0x58b6e8['result']===-0x1){return _0x58b6e8;}logger['info'](util['format'](_0x96b1('0x9c'),_0x388ffd,_0x58b6e8[_0x96b1('0x9d')]));return this[_0x96b1('0xd')]['setVariable'](_0x388ffd,_0x58b6e8[_0x96b1('0x9d')]);};AGIVertices[_0x96b1('0x16')][_0x96b1('0x9e')]=function(_0x2b6764){return _0x2b6764&&_0x2b6764!=='0'&&_0x2b6764!=='-1'&&_0x2b6764!=='';};AGIVertices[_0x96b1('0x16')][_0x96b1('0x9f')]=function(_0x44c930){this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0x44c930,'-');_0x44c930['retry']=_0x44c930[_0x96b1('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x96b1('0x16')][_0x96b1('0xa1')]=function(_0xff78a){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0xa2'),_0xff78a['label']));if(!this[_0x96b1('0x9e')](_0xff78a[_0x96b1('0x5b')])){return this[_0x96b1('0xd')]['noop'](_0x96b1('0xa3'));}var _0x42013c='\x22'+_0xff78a[_0x96b1('0x5b')]+'\x22';if(this['isConfigured'](_0xff78a['options'])){_0x42013c+=','+_0xff78a[_0x96b1('0x75')];}var _0x3b59a7=this[_0x96b1('0xd')][_0x96b1('0xa4')](_0x96b1('0xa5'),_0x42013c);if(_0x3b59a7[_0x96b1('0xa6')]===-0x1){return _0x3b59a7;}return this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0xa8'),_0x42013c));};AGIVertices['prototype'][_0x96b1('0xa9')]=function(_0x2cc7fb){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0xaa'),_0x2cc7fb[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x2cc7fb['grammar'])){return this[_0x96b1('0xd')][_0x96b1('0xa7')]('no\x20grammar\x20configured');}var _0x5d2aa6=_0x2cc7fb['grammar'];if(this[_0x96b1('0x9e')](_0x2cc7fb[_0x96b1('0x75')])){_0x5d2aa6+=','+_0x2cc7fb[_0x96b1('0x75')];}var _0xe2c298=this[_0x96b1('0xd')][_0x96b1('0xa4')]('MRCPRecog',_0x5d2aa6);if(_0xe2c298['result']===-0x1){return _0xe2c298;}var _0x556aea=this['getAndSetVariable'](_0x96b1('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0x556aea['result']===-0x1){return _0x556aea;}var _0x9a39b1=this[_0x96b1('0xad')]('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x9a39b1['result']===-0x1){return _0x9a39b1;}var _0x55a8b7=this[_0x96b1('0xad')]('RECOG_INSTANCE()',_0x96b1('0xae'));if(_0x55a8b7[_0x96b1('0xa6')]===-0x1){return _0x55a8b7;}return this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0xaf'),_0x5d2aa6));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x7')]=function(_0x353316){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x353316[_0x96b1('0xab')]));return this[_0x96b1('0xd')][_0x96b1('0x7')]([_0x353316[_0x96b1('0xb0')],_0x353316[_0x96b1('0xb1')]]);};AGIVertices['prototype']['answer']=function(_0x43ac1c){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0xb2'),_0x43ac1c[_0x96b1('0xab')]));if(this[_0x96b1('0x9e')](_0x43ac1c[_0x96b1('0x65')])){logger['info'](util['format'](_0x96b1('0xb3'),_0x43ac1c[_0x96b1('0x65')]));var _0x53feae=this[_0x96b1('0xd')][_0x96b1('0xb4')](_0x43ac1c[_0x96b1('0x65')]);if(_0x53feae['result']===-0x1){return _0x53feae;}}return this['channel'][_0x96b1('0xb5')]();};AGIVertices[_0x96b1('0x16')][_0x96b1('0x4a')]=function(_0x306c88){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x306c88[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x306c88['list_id'])){return this['channel']['error'](_0x306c88,_0x96b1('0xb6'));}_0x306c88[_0x96b1('0x49')]=moment();if(this['isConfigured'](_0x306c88[_0x96b1('0xb7')])){_0x306c88[_0x96b1('0x49')]=moment()[_0x96b1('0xb8')](_0x306c88[_0x96b1('0xb7')],'minutes');}if(!this[_0x96b1('0x9e')](_0x306c88[_0x96b1('0x4c')])){_0x306c88['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x306c88);return this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')](_0x96b1('0xb9'),_0x306c88['phone'],_0x306c88[_0x96b1('0x48')],_0x306c88[_0x96b1('0x49')]));};AGIVertices[_0x96b1('0x16')]['custom_app']=function(_0x1dc9fa){logger[_0x96b1('0x2c')](util['format'](_0x96b1('0xba'),_0x1dc9fa[_0x96b1('0xab')]));var _0x116bec=this['channel'][_0x96b1('0xa4')](_0x1dc9fa['application'],_0x1dc9fa[_0x96b1('0x75')]);if(_0x116bec['result']===-0x1){return _0x116bec;}return this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')]('Executed\x20command\x20%s\x20%s',_0x1dc9fa[_0x96b1('0xbb')],_0x1dc9fa['options']));};AGIVertices[_0x96b1('0x16')][_0x96b1('0xbc')]=function(_0x27453b){logger['info'](util[_0x96b1('0x28')](_0x96b1('0xbd'),_0x27453b['label']));if(!this['isConfigured'](_0x27453b[_0x96b1('0x5b')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')]('no\x20text\x20configured');}var _0x2a5f05='\x22'+_0x27453b[_0x96b1('0x5b')]+'\x22';if(this[_0x96b1('0x9e')](_0x27453b[_0x96b1('0x75')])){_0x2a5f05+=','+_0x27453b[_0x96b1('0x75')];}var _0x534330=this[_0x96b1('0xd')][_0x96b1('0xa4')](_0x96b1('0xa5'),_0x2a5f05);if(_0x534330[_0x96b1('0xa6')]===-0x1){return _0x534330;}return this['channel']['noop'](util[_0x96b1('0x28')](_0x96b1('0xa8'),_0x2a5f05));};AGIVertices[_0x96b1('0x16')]['sestektts']=function(_0x5c3fe0){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5c3fe0[_0x96b1('0xab')]));if(!this['isConfigured'](_0x5c3fe0[_0x96b1('0x5b')])){return this[_0x96b1('0xd')]['noop'](_0x96b1('0xa3'));}var _0x4ffaa8='\x22'+_0x5c3fe0[_0x96b1('0x5b')]+'\x22';if(this[_0x96b1('0x9e')](_0x5c3fe0['options'])){_0x4ffaa8+=','+_0x5c3fe0['options'];}var _0x52ffcb=this[_0x96b1('0xd')][_0x96b1('0xa4')](_0x96b1('0xa5'),_0x4ffaa8);if(_0x52ffcb[_0x96b1('0xa6')]===-0x1){return _0x52ffcb;}return this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')](_0x96b1('0xa8'),_0x4ffaa8));};AGIVertices[_0x96b1('0x16')][_0x96b1('0xbe')]=function(_0x186bae){logger['info'](util[_0x96b1('0x28')](_0x96b1('0xbf'),_0x186bae[_0x96b1('0xab')]));if(!this['isConfigured'](_0x186bae[_0x96b1('0xc0')])){return this[_0x96b1('0xd')]['noop'](_0x96b1('0xc1'));}var _0x144c93=_0x186bae[_0x96b1('0xc0')];if(this[_0x96b1('0x9e')](_0x186bae[_0x96b1('0x75')])){_0x144c93+=','+_0x186bae[_0x96b1('0x75')];}var _0x3b63a4=this[_0x96b1('0xd')][_0x96b1('0xa4')](_0x96b1('0xc2'),_0x144c93);if(_0x3b63a4[_0x96b1('0xa6')]===-0x1){return _0x3b63a4;}var _0x478a0b=this[_0x96b1('0xad')](_0x96b1('0xac'),_0x96b1('0xc3'));if(_0x478a0b[_0x96b1('0xa6')]===-0x1){return _0x478a0b;}var _0x45353e=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x45353e['result']===-0x1){return _0x45353e;}var _0x362c6b=this[_0x96b1('0xad')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x362c6b[_0x96b1('0xa6')]===-0x1){return _0x362c6b;}return this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x144c93));};AGIVertices['prototype'][_0x96b1('0xc4')]=function(_0x536688){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0xc5'),_0x536688[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x536688[_0x96b1('0xc0')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xc1'));}var _0x4d4c00=_0x536688[_0x96b1('0xc0')];if(this[_0x96b1('0x9e')](_0x536688['options'])){_0x4d4c00+=','+_0x536688[_0x96b1('0x75')];}var _0x35d310=this[_0x96b1('0xd')][_0x96b1('0xa4')](_0x96b1('0xc2'),_0x4d4c00);if(_0x35d310['result']===-0x1){return _0x35d310;}var _0x5bfc0c=this[_0x96b1('0xad')]('RECOG_CONFIDENCE()',_0x96b1('0xc6'));if(_0x5bfc0c['result']===-0x1){return _0x5bfc0c;}var _0x3e772a=this[_0x96b1('0xad')]('RECOG_INPUT()',_0x96b1('0xc7'));if(_0x3e772a[_0x96b1('0xa6')]===-0x1){return _0x3e772a;}var _0xe0d8de=this[_0x96b1('0xad')](_0x96b1('0xc8'),_0x96b1('0xc9'));if(_0xe0d8de['result']===-0x1){return _0xe0d8de;}return this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')](_0x96b1('0xaf'),_0x4d4c00));};AGIVertices['prototype'][_0x96b1('0xca')]=function(_0x1175e3){logger['info'](util[_0x96b1('0x28')](_0x96b1('0xcb'),_0x1175e3[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x1175e3['odbc_id'])){return this[_0x96b1('0xd')]['error'](_0x1175e3,_0x96b1('0xcc'));}var _0x2fbb70=this[_0x96b1('0xcd')][_0x96b1('0xa0')](this,_0x1175e3[_0x96b1('0xce')]);if(!_0x2fbb70){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x1175e3,_0x96b1('0xcf'));}if(!this['isConfigured'](_0x1175e3[_0x96b1('0x2e')])){return this['channel'][_0x96b1('0x2b')](_0x1175e3,'no\x20query\x20configured');}var _0x5f13d7=_0x1175e3['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x96b1('0x28')](_0x96b1('0xd0'),_0x5f13d7));var _0x1cd4cd=this[_0x96b1('0x2a')][_0x96b1('0xa0')](this,_0x2fbb70,_0x5f13d7);this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0x1175e3,_0x5f13d7);if(!this[_0x96b1('0x9e')](_0x1175e3[_0x96b1('0xd1')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4daa04=this[_0x96b1('0x10')][_0x96b1('0xa0')](this,_0x1175e3['variable_id']);if(!_0x4daa04){return this['channel'][_0x96b1('0x2b')](_0x1175e3,_0x96b1('0xd2'));}var _0x4b4c64=this;_0x1cd4cd[_0x96b1('0xd3')](function(_0x835498,_0x2f5be7){Object['keys'](_0x835498)[_0x96b1('0xd3')](function(_0x244bce){_0x4b4c64[_0x96b1('0xd')]['setVariable'](util[_0x96b1('0x28')](_0x96b1('0xd4'),_0x4daa04,_0x2f5be7,_0x244bce),_0x835498[_0x244bce]);});});this[_0x96b1('0xd')]['setVariable'](util['format'](_0x96b1('0xd5'),_0x4daa04),_0x1cd4cd[_0x96b1('0x97')]);return this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0xd6'),_0x4daa04));};AGIVertices[_0x96b1('0x16')]['dial']=function(_0x5bf24e){logger[_0x96b1('0xd7')](util['format'](_0x96b1('0xd8'),_0x5bf24e['label']));if(!this[_0x96b1('0x9e')](_0x5bf24e[_0x96b1('0xd9')])){return this[_0x96b1('0xd')]['error'](_0x5bf24e,_0x96b1('0xda'));}var _0x54a6e3=this[_0x96b1('0x1a')][_0x96b1('0xa0')](this,_0x5bf24e[_0x96b1('0xd9')]);if(!_0x54a6e3){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x5bf24e,'no\x20user\x20found');}var _0x3d7279=this[_0x96b1('0xd')]['exec'](_0x96b1('0xdb'),[util[_0x96b1('0x28')](_0x96b1('0xdc'),_0x54a6e3),_0x5bf24e[_0x96b1('0x65')],_0x5bf24e[_0x96b1('0xdd')],_0x5bf24e['url']]);if(_0x3d7279[_0x96b1('0xa6')]===-0x1){return _0x3d7279;}return this['channel'][_0x96b1('0xa7')](util['format'](_0x96b1('0xde'),_0x96b1('0xdb')));};AGIVertices[_0x96b1('0x16')][_0x96b1('0xdf')]=function(_0x4a471b){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x4a471b[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x4a471b[_0x96b1('0x77')])){return this['channel'][_0x96b1('0xa7')](_0x96b1('0xe0'));}if(!this[_0x96b1('0x9e')](_0x4a471b[_0x96b1('0x5b')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xa3'));}this['channel'][_0x96b1('0xe1')]=!![];this['createSquareDetailsReport'](_0x4a471b);this[_0x96b1('0x40')](_0x4a471b[_0x96b1('0x5b')],'in');this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')]('Trying\x20Dialogflow:\x20%s',_0x4a471b[_0x96b1('0x5b')]));var _0x4e6a79=this[_0x96b1('0x76')]['sync'](this,_0x4a471b);if(_0x4e6a79){for(var _0x1b0bd8 in _0x4e6a79){if(_0x4e6a79[_0x96b1('0x92')](_0x1b0bd8)){this[_0x96b1('0xd')]['setVariable'](util['format'](_0x96b1('0xe2'),_0x1b0bd8[_0x96b1('0xe3')]()),_0x4e6a79[_0x1b0bd8]);}}this['createSquareMessage'](_0x4e6a79[_0x96b1('0xe4')],_0x96b1('0xe5'));return this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0xe6'),_0x4e6a79[_0x96b1('0xe4')]));}return this[_0x96b1('0xd')]['error'](_0x4a471b,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x96b1('0x16')][_0x96b1('0xe7')]=function(_0x115516){logger[_0x96b1('0x2c')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x115516['label']));if(!this[_0x96b1('0x9e')](_0x115516[_0x96b1('0xe8')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xe9'));}if(!this['isConfigured'](_0x115516['username'])){return this[_0x96b1('0xd')]['noop'](_0x96b1('0xea'));}if(!this[_0x96b1('0x9e')](_0x115516['password'])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xeb'));}if(!this[_0x96b1('0x9e')](_0x115516[_0x96b1('0xec')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xa3'));}this[_0x96b1('0xd')][_0x96b1('0xe1')]=!![];this[_0x96b1('0x34')](_0x115516);this[_0x96b1('0x40')](_0x115516['text'],'in');this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0xed'),_0x115516[_0x96b1('0x5b')]));var _0x2bf6d8=this[_0x96b1('0x78')][_0x96b1('0xa0')](this,_0x115516);if(_0x2bf6d8){for(var _0x392ee2 in _0x2bf6d8){if(_0x2bf6d8[_0x96b1('0x92')](_0x392ee2)){this[_0x96b1('0xd')][_0x96b1('0x99')](util[_0x96b1('0x28')](_0x96b1('0xee'),_0x392ee2[_0x96b1('0xe3')]()),_0x2bf6d8[_0x392ee2]);}}this[_0x96b1('0x40')](_0x2bf6d8['speech'],_0x96b1('0xe5'));if(_0x2bf6d8[_0x96b1('0xef')]){this[_0x96b1('0xd')]['noop'](util['format'](_0x96b1('0xf0'),_0x2bf6d8[_0x96b1('0xef')]));var _0x465e4e=this[_0x96b1('0xd')][_0x96b1('0xf1')](_0x2bf6d8['audiofile']);try{fs[_0x96b1('0xf2')](_0x2bf6d8[_0x96b1('0xef')]+_0x96b1('0xf3'));}catch(_0x4cca6f){logger['error'](_0x4cca6f);}return _0x465e4e;}else{return this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0xf4'),_0x2bf6d8[_0x96b1('0xe4')]));}}return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x115516,_0x96b1('0xf5'));};AGIVertices[_0x96b1('0x16')]['end']=function(_0x20a943){logger['info'](util[_0x96b1('0x28')](_0x96b1('0xf6'),_0x20a943[_0x96b1('0xab')]));return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xf7'));};AGIVertices[_0x96b1('0x16')][_0x96b1('0xf8')]=function(_0x33342a){logger['info'](util[_0x96b1('0x28')](_0x96b1('0xf9'),_0x33342a[_0x96b1('0xab')]));var _0x11a1ef='';if(_0x33342a[_0x96b1('0xfa')]){if(!this[_0x96b1('0x9e')](_0x33342a[_0x96b1('0xfa')])){return this[_0x96b1('0xd')]['error'](_0x33342a,'no\x20trunk\x20selected');}else{var _0x44a860=parseInt(_0x33342a[_0x96b1('0xfa')],0xa);if(isNaN(_0x44a860)){_0x11a1ef=_0x33342a[_0x96b1('0xfa')];}else{_0x11a1ef=this[_0x96b1('0x1c')]['sync'](this,_0x33342a['trunk_id']);if(!_0x11a1ef){return this['channel']['error'](_0x33342a,_0x96b1('0xfb'));}}}}else if(_0x33342a['trunk_name']){_0x11a1ef=_0x33342a[_0x96b1('0xfc')];}else{return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x33342a,'no\x20trunk\x20selected');}var _0x50e09d=this[_0x96b1('0xd')][_0x96b1('0xa4')](_0x96b1('0xdb'),[util[_0x96b1('0x28')](_0x96b1('0xfd'),_0x11a1ef,_0x33342a[_0x96b1('0x47')]),_0x33342a['timeout'],_0x33342a['opts'],_0x33342a[_0x96b1('0x63')]]);if(_0x50e09d['result']===-0x1){return _0x50e09d;}return this['channel'][_0x96b1('0xa7')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x96b1('0x16')][_0x96b1('0xfe')]=function(_0x768c7d){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0xff'),_0x768c7d[_0x96b1('0xab')]));return this[_0x96b1('0xd')][_0x96b1('0xa7')]('finally');};AGIVertices[_0x96b1('0x16')][_0x96b1('0xb')]=function(_0xac9a6d){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x100'),_0xac9a6d[_0x96b1('0xab')]));if(_0xac9a6d[_0x96b1('0x101')]===0x0){return this[_0x96b1('0x9f')](_0xac9a6d);}_0xac9a6d[_0x96b1('0x101')]-=0x1;if(!this[_0x96b1('0x9e')](_0xac9a6d[_0x96b1('0x102')])){return this['channel'][_0x96b1('0x2b')](_0xac9a6d,'no\x20file\x20audio\x20selected');}var _0xb04409=this[_0x96b1('0x103')][_0x96b1('0xa0')](this,_0xac9a6d[_0x96b1('0x102')]);if(!_0xb04409){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0xac9a6d,'no\x20file\x20audio\x20found');}if(!this[_0x96b1('0x9e')](_0xac9a6d[_0x96b1('0xd1')])){return this['channel']['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3c335a=this[_0x96b1('0xd')][_0x96b1('0x104')](_0xb04409,_0xac9a6d[_0x96b1('0x105')],_0xac9a6d['maxdigit']);var _0x540d0a=_0x3c335a['result']?_0x3c335a[_0x96b1('0xa6')][_0x96b1('0x4b')]():'';logger[_0x96b1('0x2c')](_0x96b1('0x106'),JSON['stringify'](_0x3c335a));if(_0x3c335a[_0x96b1('0xa6')]===-0x1){this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0xac9a6d,_0x540d0a);return _0x3c335a;}else if(_0x3c335a['extra']===_0x96b1('0x65')){_0x3c335a[_0x96b1('0xa6')]=_0x540d0a[_0x96b1('0x97')]>=parseInt(_0xac9a6d[_0x96b1('0x107')])?'x':'i';}else{_0x3c335a[_0x96b1('0xa6')]=_0x540d0a[_0x96b1('0x97')]>=parseInt(_0xac9a6d['mindigit'])&&_0x540d0a[_0x96b1('0x97')]<=parseInt(_0xac9a6d[_0x96b1('0x108')])?'x':'i';}var _0x3d3848=this[_0x96b1('0x10')][_0x96b1('0xa0')](this,_0xac9a6d[_0x96b1('0xd1')]);if(!_0x3d3848){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0xac9a6d,_0x96b1('0xd2'));}this[_0x96b1('0xd')][_0x96b1('0x99')](_0x3d3848,_0x540d0a);if(this[_0x96b1('0x9e')](_0xac9a6d[_0x96b1('0x109')])){var _0x3bc23a=parseInt(_0xac9a6d[_0x96b1('0x109')],0xa);var _0x573634=rs[_0x96b1('0x10a')]({'charset':'*','length':_0x3bc23a});var _0x3d1bb7=_0x540d0a['length'];if(_0x3d1bb7>0x0){if(_0x3d1bb7>_0x3bc23a){this[_0x96b1('0x34')]['sync'](this,_0xac9a6d,_0xac9a6d[_0x96b1('0x10b')]==='first'?_0x573634+_0x540d0a[_0x96b1('0x10c')](_0x3bc23a):_0x540d0a[_0x96b1('0x10c')](0x0,_0x3d1bb7-_0x3bc23a)+_0x573634);}else{this['createSquareDetailsReport'][_0x96b1('0xa0')](this,_0xac9a6d,rs[_0x96b1('0x10a')]({'charset':'*','length':_0x3d1bb7}));}}else{this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0xac9a6d,'');}}else{this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0xac9a6d,_0x540d0a);}return _0x3c335a;};AGIVertices['prototype'][_0x96b1('0xc')]=function(_0x226cd0){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x10d'),_0x226cd0[_0x96b1('0xab')]));return this[_0x96b1('0xb')](_0x226cd0);};AGIVertices['prototype'][_0x96b1('0x10e')]=function(_0x6ffafb){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x10f'),_0x6ffafb[_0x96b1('0xab')]));this[_0x96b1('0x34')]['sync'](this,_0x6ffafb,_0x6ffafb[_0x96b1('0x110')]);return this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')](_0x96b1('0x111'),_0x6ffafb[_0x96b1('0x110')]));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x112')]=function(_0x2eb743){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x113'),_0x2eb743[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x2eb743[_0x96b1('0x80')])||!this[_0x96b1('0x9e')](_0x2eb743[_0x96b1('0x81')])){return this['channel'][_0x96b1('0xa7')](_0x96b1('0x114'));}if(!this['isConfigured'](_0x2eb743[_0x96b1('0x5b')])){return this['channel']['noop'](_0x96b1('0xa3'));}this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x115'),_0x2eb743['text']));var _0x2a485c=this[_0x96b1('0x7f')]['sync'](this,_0x2eb743);if(_0x2a485c){this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')](_0x96b1('0x116'),_0x2a485c));var _0x588117=this['channel'][_0x96b1('0xf1')](_0x2a485c);try{fs[_0x96b1('0xf2')](_0x2a485c+'.wav');}catch(_0x4bcacc){logger[_0x96b1('0x2b')](_0x4bcacc);}return _0x588117;}return this['channel'][_0x96b1('0x2b')](_0x2eb743,_0x96b1('0x117'));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x118')]=function(_0x48940e){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x119'),_0x48940e[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x48940e[_0x96b1('0x80')])||!this['isConfigured'](_0x48940e[_0x96b1('0x81')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0x114'));}if(!this[_0x96b1('0x9e')](_0x48940e[_0x96b1('0x11a')])){return this['channel']['noop'](_0x96b1('0x11b'));}if(!this['isConfigured'](_0x48940e[_0x96b1('0x5b')])){return this['channel'][_0x96b1('0xa7')](_0x96b1('0xa3'));}this[_0x96b1('0xd')][_0x96b1('0xe1')]=!![];this[_0x96b1('0x34')](_0x48940e);this[_0x96b1('0x40')](_0x48940e[_0x96b1('0x5b')],'in');this[_0x96b1('0xd')][_0x96b1('0xa7')](util['format'](_0x96b1('0x11c'),_0x48940e[_0x96b1('0x5b')]));var _0x9f4d0=this[_0x96b1('0x85')][_0x96b1('0xa0')](this,_0x48940e);if(_0x9f4d0){for(var _0x5ee8ca in _0x9f4d0){if(_0x9f4d0['hasOwnProperty'](_0x5ee8ca)&&_['isString'](_0x9f4d0[_0x5ee8ca])){this[_0x96b1('0xd')][_0x96b1('0x99')](util[_0x96b1('0x28')](_0x96b1('0x11d'),_0x5ee8ca[_0x96b1('0xe3')]()),_0x9f4d0[_0x5ee8ca]);}}if(_[_0x96b1('0x42')](_0x9f4d0[_0x96b1('0x73')])){return this[_0x96b1('0xd')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x96b1('0x40')](_0x9f4d0[_0x96b1('0x73')],_0x96b1('0xe5'));return this['channel']['noop'](util[_0x96b1('0x28')](_0x96b1('0x11e'),_0x9f4d0[_0x96b1('0x73')]));}}return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x48940e,_0x96b1('0x11f'));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x120')]=function(_0x6782e3){logger[_0x96b1('0x2c')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x6782e3[_0x96b1('0xab')],_0x6782e3[_0x96b1('0x65')]));if(!this[_0x96b1('0x9e')](_0x6782e3[_0x96b1('0x77')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xe0'));}var _0x467df0=_0x96b1('0x121');var _0x26c25c=util[_0x96b1('0x28')](_0x96b1('0x122'),FILES_PATH,rs['generate'](0x4));var _0xc4e125=util[_0x96b1('0x28')](_0x96b1('0x98'),_0x26c25c,_0x467df0);var _0x159163=!![];if(_0x6782e3[_0x96b1('0x123')]===_0x96b1('0x124')){_0x159163=![];}var _0x3ab3ba=this['channel'][_0x96b1('0x125')](_0x26c25c,_0x467df0,_0x6782e3[_0x96b1('0x126')],_0x6782e3[_0x96b1('0x65')],undefined,_0x159163);if(_0x3ab3ba[_0x96b1('0xa6')]!==-0x1){this[_0x96b1('0xd')]['noop'](util['format'](_0x96b1('0x127'),_0xc4e125));var _0x4c2de0=this[_0x96b1('0x87')][_0x96b1('0xa0')](this,_0x6782e3,_0xc4e125);if(_0x4c2de0){for(var _0x5f2bfb in _0x4c2de0){if(_0x4c2de0[_0x96b1('0x92')](_0x5f2bfb)){this[_0x96b1('0xd')][_0x96b1('0x99')](util[_0x96b1('0x28')](_0x96b1('0x128'),_0x5f2bfb[_0x96b1('0xe3')]()),_0x4c2de0[_0x5f2bfb]);}}return this['channel']['noop'](util[_0x96b1('0x28')](_0x96b1('0x129'),JSON[_0x96b1('0x9a')](_0x4c2de0)));}}return _0x3ab3ba;};AGIVertices[_0x96b1('0x16')][_0x96b1('0x12a')]=function(_0x4a2924){logger['info'](util['format'](_0x96b1('0x12b'),_0x4a2924['label']));if(!this[_0x96b1('0x9e')](_0x4a2924[_0x96b1('0x8a')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0x12c'));}if(!this[_0x96b1('0x9e')](_0x4a2924[_0x96b1('0x8b')])){return this[_0x96b1('0xd')]['noop'](_0x96b1('0x12d'));}var _0xf250c7=_0x96b1('0x121');var _0x55b767=util[_0x96b1('0x28')](_0x96b1('0x122'),FILES_PATH,rs[_0x96b1('0x10a')](0x4));var _0x510007=util[_0x96b1('0x28')](_0x96b1('0x98'),_0x55b767,_0xf250c7);var _0x3152ac=!![];if(_0x4a2924[_0x96b1('0x123')]===_0x96b1('0x124')){_0x3152ac=![];}var _0xb1d5f4=this[_0x96b1('0xd')][_0x96b1('0x125')](_0x55b767,_0xf250c7,_0x4a2924[_0x96b1('0x126')],_0x4a2924['timeout'],undefined,_0x3152ac);if(_0xb1d5f4[_0x96b1('0xa6')]!==-0x1){this[_0x96b1('0xd')][_0x96b1('0xa7')](util['format'](_0x96b1('0x12e'),_0x510007));var _0x24a6c6=this[_0x96b1('0x89')][_0x96b1('0xa0')](this,_0x4a2924,_0x510007);if(_0x24a6c6){for(var _0x3b4ea7 in _0x24a6c6){if(_0x24a6c6['hasOwnProperty'](_0x3b4ea7)){this[_0x96b1('0xd')][_0x96b1('0x99')](util[_0x96b1('0x28')]('TILDE_ASR_%s',_0x3b4ea7[_0x96b1('0xe3')]()),_0x24a6c6[_0x3b4ea7]);}}return this[_0x96b1('0xd')]['noop'](util['format'](_0x96b1('0x12f'),JSON[_0x96b1('0x9a')](_0x24a6c6)));}}return _0xb1d5f4;};AGIVertices[_0x96b1('0x16')][_0x96b1('0x130')]=function(_0x33dc60){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x131'),_0x33dc60[_0x96b1('0xab')]));return this[_0x96b1('0xd')][_0x96b1('0x132')](_0x33dc60[_0x96b1('0x3a')],_0x33dc60[_0x96b1('0x3b')],_0x33dc60['priority']);};AGIVertices[_0x96b1('0x16')][_0x96b1('0x133')]=function(_0x5690f7){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x134'),_0x5690f7[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x5690f7[_0x96b1('0x135')])){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x5690f7,_0x96b1('0x136'));}try{var _0xa5ba1a=eval(_0x5690f7[_0x96b1('0x135')])?_0x96b1('0x137'):_0x96b1('0x138');this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x5690f7[_0x96b1('0x135')],_0xa5ba1a));return{'code':0xc8,'result':_0xa5ba1a};}catch(_0x54c86f){return{'code':0xc8,'result':_0x96b1('0x138')};}};AGIVertices[_0x96b1('0x16')]['gotoiftime']=function(_0x34a0cb){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x34a0cb[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x34a0cb['interval_id'])){return this['channel'][_0x96b1('0x2b')](_0x34a0cb,_0x96b1('0x139'));}var _0x59081c=this[_0x96b1('0x23')][_0x96b1('0xa0')](this,_0x34a0cb['interval_id']);if(!_0x59081c){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x34a0cb,_0x96b1('0x13a'));}for(var _0x5055be=0x0;_0x5055be<_0x59081c[_0x96b1('0x97')];_0x5055be+=0x1){var _0x3dca67=this[_0x96b1('0xd')][_0x96b1('0x10')](util[_0x96b1('0x28')]('IFTIME(%s?true:false)',_0x59081c[_0x5055be]));if(_0x3dca67[_0x96b1('0xa6')]===-0x1){return _0x3dca67;}logger['info'](util[_0x96b1('0x28')](_0x96b1('0x13b'),_0x59081c[_0x5055be],_0x3dca67[_0x96b1('0x9d')]));if(_0x3dca67[_0x96b1('0x9d')]===_0x96b1('0x137')){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x13b'),_0x59081c[_0x5055be],_0x96b1('0x137')));this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x13b'),_0x59081c[_0x5055be],_0x96b1('0x137')));return{'code':0xc8,'result':_0x96b1('0x137')};}else{logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x13b'),_0x59081c[_0x5055be],_0x96b1('0x138')));this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x13b'),_0x59081c[_0x5055be],_0x96b1('0x138')));}}return{'code':0xc8,'result':_0x96b1('0x138')};};AGIVertices[_0x96b1('0x16')]['hangup']=function(_0x52d3a8){logger[_0x96b1('0x2c')](util['format'](_0x96b1('0x13c'),_0x52d3a8[_0x96b1('0xab')]));return this['channel'][_0x96b1('0x13d')]();};AGIVertices[_0x96b1('0x16')]['ispeechasr']=function(_0x4adf5d){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x13e'),_0x4adf5d[_0x96b1('0xab')]));if(!this['isConfigured'](_0x4adf5d['key'])){return this[_0x96b1('0xd')]['noop'](_0x96b1('0xe0'));}var _0x59d47b=_0x96b1('0x121');var _0x41945e=util['format'](_0x96b1('0x122'),FILES_PATH,rs[_0x96b1('0x10a')](0x4));var _0x6dd1b7=util[_0x96b1('0x28')](_0x96b1('0x98'),_0x41945e,_0x59d47b);var _0x4b6cbc=!![];if(_0x4adf5d[_0x96b1('0x123')]===_0x96b1('0x124')){_0x4b6cbc=![];}var _0x56aca9=this[_0x96b1('0xd')][_0x96b1('0x125')](_0x41945e,_0x59d47b,_0x4adf5d[_0x96b1('0x126')],_0x4adf5d[_0x96b1('0x65')],undefined,_0x4b6cbc);if(_0x56aca9['result']!==-0x1){this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x13f'),_0x6dd1b7));var _0x2fd43e=this[_0x96b1('0x7c')][_0x96b1('0xa0')](this,_0x4adf5d,_0x6dd1b7);if(_0x2fd43e){for(var _0x1e8551 in _0x2fd43e){if(_0x2fd43e[_0x96b1('0x92')](_0x1e8551)){this[_0x96b1('0xd')][_0x96b1('0x99')](util[_0x96b1('0x28')](_0x96b1('0x140'),_0x1e8551['toUpperCase']()),_0x2fd43e[_0x1e8551]);}}return this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')]('IspeechASR\x20Result\x20%s',JSON[_0x96b1('0x9a')](_0x2fd43e)));}}return _0x56aca9;};AGIVertices[_0x96b1('0x16')][_0x96b1('0x141')]=function(_0x26d61e){logger['info'](util['format'](_0x96b1('0x142'),_0x26d61e[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x26d61e[_0x96b1('0x77')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xe0'));}if(!this[_0x96b1('0x9e')](_0x26d61e[_0x96b1('0x5b')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xa3'));}this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x143'),_0x26d61e[_0x96b1('0x5b')]));var _0x591b1e=this[_0x96b1('0x79')][_0x96b1('0xa0')](this,_0x26d61e);if(_0x591b1e){this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')]('ispeech\x20%s\x20file\x20created',_0x591b1e));var _0xb3731c=this[_0x96b1('0xd')]['streamFile'](_0x591b1e,_0x26d61e[_0x96b1('0x126')]);try{fs['unlink'](_0x591b1e+'.wav');}catch(_0x395a5e){logger[_0x96b1('0x2b')](_0x395a5e);}return _0xb3731c;}return this['channel'][_0x96b1('0x2b')](_0x26d61e,_0x96b1('0x144'));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x145')]=function(_0x1a3bb3){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x146'),_0x1a3bb3['label']));if(!this[_0x96b1('0x9e')](_0x1a3bb3[_0x96b1('0x147')])){return this['channel'][_0x96b1('0x2b')](_0x1a3bb3,_0x96b1('0x148'));}logger[_0x96b1('0x2c')](util['format'](_0x96b1('0x149'),this[_0x96b1('0xd')]['callerid'],_0x1a3bb3[_0x96b1('0x147')]));var _0x344d73=this[_0x96b1('0x52')][_0x96b1('0xa0')](this,_0x1a3bb3['findBy']);if(_0x344d73){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x14a'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x1a3bb3['findBy']));this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x14a'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x1a3bb3[_0x96b1('0x147')]));return{'code':0xc8,'result':_0x96b1('0x14b')};}else{logger['info'](util[_0x96b1('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x96b1('0xd')]['callerid'],_0x1a3bb3[_0x96b1('0x147')]));this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x14c'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x1a3bb3[_0x96b1('0x147')]));return{'code':0xc8,'result':_0x96b1('0x14d')};}};AGIVertices[_0x96b1('0x16')][_0x96b1('0x14e')]=function(_0x2bd017){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x14f'),_0x2bd017[_0x96b1('0xab')]));if(!this['isConfigured'](_0x2bd017[_0x96b1('0x147')])){return this['channel'][_0x96b1('0x2b')](_0x2bd017,_0x96b1('0x148'));}logger['info'](util['format'](_0x96b1('0x149'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x2bd017[_0x96b1('0x147')]));var _0x3a19a0=this['agentLogout']['sync'](this,_0x2bd017['findBy']);if(_0x3a19a0){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x14a'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x2bd017['findBy']));this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x14a'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x2bd017[_0x96b1('0x147')]));return{'code':0xc8,'result':_0x96b1('0x14b')};}else{logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x14c'),this['channel']['callerid'],_0x2bd017[_0x96b1('0x147')]));this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x14c'),this[_0x96b1('0xd')]['callerid'],_0x2bd017[_0x96b1('0x147')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x96b1('0x16')][_0x96b1('0x150')]=function(_0x4e715c){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x4e715c[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x4e715c[_0x96b1('0x151')])){return this['channel'][_0x96b1('0x2b')](_0x4e715c,_0x96b1('0x152'));}this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')]('math\x20%s',_0x4e715c['operation']));var _0x5ad95c=eval(_0x4e715c[_0x96b1('0x151')]);if(!this[_0x96b1('0x9e')](_0x4e715c['variable_id'])){return this[_0x96b1('0xd')][_0x96b1('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x29e5e2=this['getVariable']['sync'](this,_0x4e715c[_0x96b1('0xd1')]);if(!_0x29e5e2){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x4e715c,'no\x20variable\x20found');}if(_[_0x96b1('0x96')](_0x5ad95c)){var _0x136405=this;_0x5ad95c[_0x96b1('0xd3')](function(_0x42d939,_0x4f8e23){_0x136405[_0x96b1('0xd')][_0x96b1('0x99')](util[_0x96b1('0x28')]('%s[%s]',_0x29e5e2,_0x4f8e23),_0x42d939);});return this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')](_0x96b1('0x153'),_0x29e5e2));}else{return this['channel'][_0x96b1('0x99')](_0x29e5e2,_0x5ad95c);}};AGIVertices[_0x96b1('0x16')]['menu']=function(_0x9dae0a){logger['info'](util[_0x96b1('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x9dae0a[_0x96b1('0xab')]));if(_0x9dae0a[_0x96b1('0x101')]===0x0){return this['maxRetry'](_0x9dae0a);}_0x9dae0a[_0x96b1('0x101')]-=0x1;if(!this['isConfigured'](_0x9dae0a[_0x96b1('0x102')])){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x9dae0a,_0x96b1('0x154'));}var _0xcbace4=this[_0x96b1('0x103')][_0x96b1('0xa0')](this,_0x9dae0a['file_id']);if(!_0xcbace4){return this[_0x96b1('0xd')]['error'](_0x9dae0a,_0x96b1('0x155'));}var _0x4de19a=this['channel'][_0x96b1('0x104')](_0xcbace4,_0x9dae0a[_0x96b1('0x105')],_0x9dae0a[_0x96b1('0x156')]);var _0x4de8aa=_0x4de19a['result'];if(_0x4de19a['result']===-0x1){this[_0x96b1('0x34')]['sync'](this,_0x9dae0a,'-1');return _0x4de19a;}else if(_0x4de19a[_0x96b1('0x9d')]==='timeout'){_0x4de19a[_0x96b1('0xa6')]=_0x4de19a['result'][_0x96b1('0x97')]>0x0?_0x4de19a[_0x96b1('0xa6')]:'t';}else if(_[_0x96b1('0x45')](_0x4de19a[_0x96b1('0xa6')])){_0x4de19a[_0x96b1('0xa6')]='#';_0x4de8aa='#';}if(!this[_0x96b1('0x9e')](_0x9dae0a['variable_id'])){this['channel'][_0x96b1('0xa7')](_0x96b1('0x157'));}else{var _0x1a7510=this['getVariable'][_0x96b1('0xa0')](this,_0x9dae0a[_0x96b1('0xd1')]);if(!_0x1a7510){return this['channel'][_0x96b1('0x2b')](_0x9dae0a,_0x96b1('0xd2'));}this['channel'][_0x96b1('0x99')](_0x1a7510,_0x4de8aa);}this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0x9dae0a,_0x4de8aa);return _0x4de19a;};AGIVertices[_0x96b1('0x16')]['noop']=function(_0x4299a9){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x158'),_0x4299a9[_0x96b1('0xab')]));return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x4299a9[_0x96b1('0x159')]||_0x4299a9['label']);};AGIVertices['prototype'][_0x96b1('0x15a')]=function(_0x4cd517){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x15b'),_0x4cd517[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x4cd517['findBy'])){return this['channel'][_0x96b1('0x2b')](_0x4cd517,'no\x20find\x20by\x20configured');}logger[_0x96b1('0x2c')](util['format'](_0x96b1('0x149'),this['channel'][_0x96b1('0x38')],_0x4cd517[_0x96b1('0x147')]));var _0x2e1465=this[_0x96b1('0x4d')][_0x96b1('0xa0')](this,_0x4cd517['pause_id']);var _0x435250=this[_0x96b1('0x15c')][_0x96b1('0xa0')](this,_0x4cd517[_0x96b1('0x147')],_0x2e1465);if(_0x435250){logger['info'](util['format'](_0x96b1('0x14a'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x4cd517[_0x96b1('0x147')]));this[_0x96b1('0xd')]['noop'](util[_0x96b1('0x28')](_0x96b1('0x14a'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x4cd517[_0x96b1('0x147')]));return{'code':0xc8,'result':_0x96b1('0x14b')};}else{logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x14c'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x4cd517[_0x96b1('0x147')]));this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x96b1('0xd')][_0x96b1('0x38')],_0x4cd517[_0x96b1('0x147')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x96b1('0x15d')]=function(_0x18ae59){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x15e'),_0x18ae59[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x18ae59[_0x96b1('0x102')])){return this[_0x96b1('0xd')]['error'](_0x18ae59,_0x96b1('0x154'));}var _0x1a10a4=this[_0x96b1('0x103')][_0x96b1('0xa0')](this,_0x18ae59['file_id']);if(!_0x1a10a4){return this[_0x96b1('0xd')]['error'](_0x18ae59,_0x96b1('0x155'));}var _0x1bf83f=this[_0x96b1('0xd')][_0x96b1('0xa4')](_0x96b1('0x15f'),[_0x1a10a4,_0x18ae59[_0x96b1('0xdd')]]);if(_0x1bf83f['result']===-0x1){return _0x1bf83f;}return this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x160'),_0x96b1('0x15f'),_0x1a10a4));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x161')]=function(_0xb718ad){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x162'),_0xb718ad[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0xb718ad[_0x96b1('0x163')])){return this['channel'][_0x96b1('0x2b')](_0xb718ad,'no\x20queue\x20selected');}var _0xe743da='';var _0x544486=parseInt(_0xb718ad[_0x96b1('0x163')],0xa);if(isNaN(_0x544486)){_0xe743da=_0xb718ad[_0x96b1('0x163')];}else{_0xe743da=this[_0x96b1('0x14')][_0x96b1('0xa0')](this,_0xb718ad[_0x96b1('0x163')]);if(!_0xe743da){return this['channel']['error'](_0xb718ad,_0x96b1('0x164'));}}var _0x1b0f8e='';if(this[_0x96b1('0x9e')](_0xb718ad[_0x96b1('0x102')])){var _0x340cd7=this['getSound'][_0x96b1('0xa0')](this,_0xb718ad[_0x96b1('0x102')]);if(_0x340cd7){_0x1b0f8e=_0x340cd7;}}this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0xb718ad,_0xe743da);if(_0xb718ad['opts'][_0x96b1('0x165')]('x')<0x0){_0xb718ad[_0x96b1('0xdd')]+='x';}if(_0xb718ad[_0x96b1('0xdd')]['indexOf']('X')<0x0){_0xb718ad[_0x96b1('0xdd')]+='X';}this['channel'][_0x96b1('0x99')](_0x96b1('0x166'),_0xe743da?_0xe743da[_0x96b1('0x167')]():'');var _0x418619=this['channel'][_0x96b1('0xa4')](_0x96b1('0x168'),[_0xe743da,_0xb718ad[_0x96b1('0xdd')],_0xb718ad[_0x96b1('0x63')],_0x1b0f8e,_0xb718ad[_0x96b1('0x65')],_0xb718ad['agi'],_0xb718ad[_0x96b1('0x169')],_0xb718ad[_0x96b1('0x16a')],'',_0xb718ad['position']]);if(_0x418619[_0x96b1('0xa6')]===-0x1){return _0x418619;}return this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x160'),'QUEUE',_0xe743da));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x16b')]=function(_0x1060b7){logger[_0x96b1('0x2c')](util['format'](_0x96b1('0x16c'),_0x1060b7[_0x96b1('0xab')]));var _0x3ee23c=_0x1060b7[_0x96b1('0x16d')]||_0x96b1('0x121');var _0x2ac2fa=util['format'](_0x96b1('0x16e'),this[_0x96b1('0xd')][_0x96b1('0x35')],rs[_0x96b1('0x10a')](0x5));var _0xdc4eee=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x2ac2fa,_0x3ee23c);var _0x2f8063=util[_0x96b1('0x28')](_0x96b1('0x122'),FILES_PATH,_0x2ac2fa);this['createSquareRecording'][_0x96b1('0xa0')](this,_0x1060b7,_0x2ac2fa,_0xdc4eee);this[_0x96b1('0xd')][_0x96b1('0x99')]('RECORDING_SAVENAME',_0x2ac2fa);logger[_0x96b1('0x2c')](_0x96b1('0x16f'),_0x2f8063,_0x3ee23c,_0x1060b7['escape_digits'],_0x1060b7[_0x96b1('0x65')]);return this[_0x96b1('0xd')]['recordFile'](_0x2f8063,_0x3ee23c,_0x1060b7[_0x96b1('0x170')],_0x1060b7[_0x96b1('0x65')],undefined,!![]);};AGIVertices[_0x96b1('0x16')]['restapi']=function(_0x23e046){logger[_0x96b1('0x2c')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x23e046['label']));if(!this[_0x96b1('0x9e')](_0x23e046[_0x96b1('0x63')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0x171'));}var _0x22a4e8=this['restAPI'][_0x96b1('0xa0')](this,_0x23e046);logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x172'),util[_0x96b1('0x173')](_0x22a4e8,{'showHidden':![],'depth':null})));if(!this[_0x96b1('0x9e')](_0x23e046['variable_id'])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0x174'));}var _0x4e0bf6=this[_0x96b1('0x10')]['sync'](this,_0x23e046[_0x96b1('0xd1')]);if(!_0x4e0bf6){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x23e046,'no\x20variable\x20found');}this[_0x96b1('0xd')][_0x96b1('0x99')](util[_0x96b1('0x28')](_0x96b1('0x175'),_0x4e0bf6),_0x22a4e8[_0x96b1('0x71')]?_0x22a4e8[_0x96b1('0x71')]:'200');this[_0x96b1('0xd')]['setVariable'](util[_0x96b1('0x28')]('%s_STATUS_MESSAGE',_0x4e0bf6),_0x22a4e8['statusMessage']?_0x22a4e8['statusMessage']:'OK');if(_0x22a4e8[_0x96b1('0x69')]){try{this[_0x96b1('0x95')](_0x22a4e8[_0x96b1('0x69')],_0x4e0bf6);}catch(_0x5cf964){logger[_0x96b1('0x2b')](util[_0x96b1('0x28')](_0x96b1('0x176'),_0x4e0bf6));}}return this[_0x96b1('0xd')]['noop'](util['format'](_0x96b1('0xd6'),_0x4e0bf6));};AGIVertices['prototype'][_0x96b1('0x177')]=function(_0x58166b){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x178'),_0x58166b[_0x96b1('0xab')]));return this['channel'][_0x96b1('0x179')](_0x58166b[_0x96b1('0x17a')]['replace'](/\s+/g,''),_0x58166b[_0x96b1('0x170')]);};AGIVertices['prototype'][_0x96b1('0x17b')]=function(_0xd3a005){logger[_0x96b1('0x2c')](util['format'](_0x96b1('0x17c'),_0xd3a005[_0x96b1('0xab')]));return this['channel'][_0x96b1('0x17d')](_0xd3a005[_0x96b1('0x66')][_0x96b1('0x57')](/\s+/g,''),_0xd3a005[_0x96b1('0x170')]);};AGIVertices[_0x96b1('0x16')][_0x96b1('0x17e')]=function(_0x13ba01){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x17f'),_0x13ba01[_0x96b1('0xab')]));return this['channel']['sayPhonetic'](_0x13ba01['text'],_0x13ba01[_0x96b1('0x170')]);};AGIVertices[_0x96b1('0x16')][_0x96b1('0x180')]=function(_0x181867){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x181'),_0x181867[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x181867[_0x96b1('0x182')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0x183'));}var _0x197d0b=this[_0x96b1('0x20')][_0x96b1('0xa0')](this,_0x181867[_0x96b1('0x182')]);if(!_0x197d0b||!_0x197d0b[_0x96b1('0x184')]){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x181867,_0x96b1('0x185'));}var _0x3e336b={'from':util[_0x96b1('0x28')]('\x22%s\x22\x20<%s>',_0x197d0b['name'],_0x197d0b[_0x96b1('0x186')]||_0x197d0b[_0x96b1('0x184')]['user']),'to':_0x181867['to']||'','cc':_0x181867['cc']||'','bcc':_0x181867[_0x96b1('0x187')]||'','subject':_0x181867[_0x96b1('0x188')],'html':_0x181867['text'],'text':_0x181867[_0x96b1('0x5b')]};var _0x3f9918={'tls':{'rejectUnauthorized':![]}};if(_0x197d0b[_0x96b1('0x184')]['service']){_0x3f9918[_0x96b1('0x189')]=_0x197d0b['Smtp']['service'];}else{_0x3f9918[_0x96b1('0x18a')]=_0x197d0b[_0x96b1('0x184')][_0x96b1('0x18a')];_0x3f9918[_0x96b1('0x18b')]=_0x197d0b[_0x96b1('0x184')][_0x96b1('0x18b')];_0x3f9918[_0x96b1('0x18c')]=_0x197d0b['Smtp'][_0x96b1('0x18c')];}if(_0x197d0b['Smtp'][_0x96b1('0x18d')]){_0x3f9918[_0x96b1('0x18e')]={'user':_0x197d0b[_0x96b1('0x184')][_0x96b1('0x18f')],'pass':_0x197d0b[_0x96b1('0x184')][_0x96b1('0x190')]};}if(this['isConfigured'](_0x181867['template_id'])){}logger[_0x96b1('0xd7')]('sendMail\x20message',JSON['stringify'](_0x3e336b));this['createSquareDetailsReport'][_0x96b1('0xa0')](this,_0x181867,_0x181867[_0x96b1('0x182')]);this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x191'),_0x197d0b[_0x96b1('0x12')]));this[_0x96b1('0x22')]['sync'](this,_0x3f9918,_0x3e336b);return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0x192'));};AGIVertices['prototype'][_0x96b1('0x193')]=function(_0x1cf2ff){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x194'),_0x1cf2ff['label']));return this[_0x96b1('0xd')][_0x96b1('0xa7')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x96b1('0x16')][_0x96b1('0x195')]=function(_0x15ffd0){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x196'),_0x15ffd0[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x15ffd0[_0x96b1('0x197')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0x198'));}var _0x4c3f9b=this[_0x96b1('0x199')][_0x96b1('0xa0')](this,_0x15ffd0['sms_account_id']);if(!_0x4c3f9b){return this[_0x96b1('0xd')]['error'](_0x15ffd0,_0x96b1('0x19a'));}var _0x49998c={'body':_0x15ffd0['sms_text'],'phone':_0x15ffd0['to']||'','SmsAccountId':_0x4c3f9b['id']};logger[_0x96b1('0xd7')](_0x96b1('0x19b'),JSON[_0x96b1('0x9a')](_0x49998c));this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0x15ffd0,_0x15ffd0['sms_account_id']);this['channel']['noop'](util[_0x96b1('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4c3f9b[_0x96b1('0x12')]));this[_0x96b1('0x33')][_0x96b1('0xa0')](this,_0x49998c);return this['channel'][_0x96b1('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x10f5bf){logger[_0x96b1('0x2c')](util['format'](_0x96b1('0x19c'),_0x10f5bf[_0x96b1('0xab')]));if(!this['isConfigured'](_0x10f5bf[_0x96b1('0xd1')])){return this['channel']['error'](_0x10f5bf,_0x96b1('0x19d'));}var _0x4906dc=this[_0x96b1('0x10')][_0x96b1('0xa0')](this,_0x10f5bf[_0x96b1('0xd1')]);if(!_0x4906dc){return this['channel']['error'](_0x10f5bf,'no\x20variable\x20found');}return this[_0x96b1('0xd')][_0x96b1('0x99')](_0x4906dc,_0x10f5bf[_0x96b1('0x19e')]);};AGIVertices[_0x96b1('0x16')][_0x96b1('0x19f')]=function(_0x260786){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x1a0'),_0x260786[_0x96b1('0xab')]));this[_0x96b1('0xd')]['noop']('START\x20CALLY\x20SQUARE');if(_0x260786['answer']==='yes'){this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0x1a1'));return this['channel'][_0x96b1('0xb5')]();}return this[_0x96b1('0xd')][_0x96b1('0xa7')]('Skipped\x20Answer');};AGIVertices[_0x96b1('0x16')][_0x96b1('0x1a2')]=function(_0x2c6592){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x1a3'),_0x2c6592[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x2c6592[_0x96b1('0x1a4')])){return this[_0x96b1('0xd')]['error'](_0x2c6592,_0x96b1('0x1a5'));}var _0x105643=this[_0x96b1('0x17')][_0x96b1('0xa0')](this,_0x2c6592[_0x96b1('0x1a4')]);if(!this[_0x96b1('0x9e')](_0x105643)){return this['channel']['error'](_0x2c6592,util[_0x96b1('0x28')](_0x96b1('0x1a6'),_0x2c6592['project_id']));}if(_0x105643===this[_0x96b1('0xd')][_0x96b1('0x37')]){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x2c6592,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x96b1('0x34')]['sync'](this,_0x2c6592,_0x105643);var _0x16719c=this[_0x96b1('0xd')][_0x96b1('0xa4')]('AGI',util[_0x96b1('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x96b1('0x18a')]||_0x96b1('0x1a7'),_0x105643,this[_0x96b1('0xd')][_0x96b1('0x37')]));if(_0x16719c[_0x96b1('0xa6')]===-0x1){return _0x16719c;}return this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x160'),_0x96b1('0x1a8'),_0x105643));};AGIVertices['prototype']['system']=function(_0x282891){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x1a9'),_0x282891['label']));var _0x559120=this[_0x96b1('0x56')][_0x96b1('0xa0')](this,_0x282891[_0x96b1('0xb0')]);this[_0x96b1('0x34')][_0x96b1('0xa0')](this,_0x282891,_0x282891[_0x96b1('0xb0')]);if(this[_0x96b1('0x9e')](_0x282891[_0x96b1('0xd1')])){var _0x58d9ee=this[_0x96b1('0x10')][_0x96b1('0xa0')](this,_0x282891['variable_id']);if(_0x58d9ee){this[_0x96b1('0xd')][_0x96b1('0x99')](_0x58d9ee,_0x559120);return this[_0x96b1('0xd')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x282891[_0x96b1('0xb0')],_0x58d9ee));}}return this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x1aa'),_0x282891[_0x96b1('0xb0')]));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x1ab')]=function(_0x1307db){logger[_0x96b1('0x2c')](util['format'](_0x96b1('0x1ac'),_0x1307db[_0x96b1('0xab')]));_0x1307db[_0x96b1('0x5b')]=_0x1307db[_0x96b1('0x5b')][_0x96b1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x96b1('0x9e')](_0x1307db['apiKey'])){return this[_0x96b1('0xd')]['noop'](_0x96b1('0x1ad'));}if(!this[_0x96b1('0x9e')](_0x1307db[_0x96b1('0x5b')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xa3'));}this['channel'][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x1ae'),_0x1307db[_0x96b1('0x5b')]));var _0x3a7395=this['googleCloudTTS'][_0x96b1('0xa0')](this,_0x1307db);if(_0x3a7395){this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3a7395));var _0x8b2ea2=this[_0x96b1('0xd')][_0x96b1('0xf1')](_0x3a7395);try{fs[_0x96b1('0xf2')](_0x3a7395+_0x96b1('0xf3'));}catch(_0x25e5a5){logger[_0x96b1('0x2b')](_0x25e5a5);}return _0x8b2ea2;}return this[_0x96b1('0xd')]['error'](_0x1307db,_0x96b1('0x1af'));};AGIVertices['prototype'][_0x96b1('0x1b0')]=function(_0x216776){logger[_0x96b1('0x2c')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x216776[_0x96b1('0xab')]));_0x216776['text']=_0x216776[_0x96b1('0x5b')][_0x96b1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x216776[_0x96b1('0x5b')])){return this[_0x96b1('0xd')][_0x96b1('0xa7')](_0x96b1('0xa3'));}this[_0x96b1('0xd')]['noop'](util['format'](_0x96b1('0x1b1'),_0x216776['text']));var _0x318a9c=this[_0x96b1('0x1b2')][_0x96b1('0xa0')](this,_0x216776);if(_0x318a9c){this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x1b3'),_0x318a9c));var _0x1dc797=this[_0x96b1('0xd')]['streamFile'](_0x318a9c);try{fs[_0x96b1('0xf2')](_0x318a9c+'.wav');}catch(_0x4e33d3){logger[_0x96b1('0x2b')](_0x4e33d3);}return _0x1dc797;}return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x216776,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x96b1('0x1b4')]=function(_0x57a673){logger['info'](util[_0x96b1('0x28')](_0x96b1('0x1b5'),_0x57a673[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x57a673[_0x96b1('0x147')])){return this[_0x96b1('0xd')]['error'](_0x57a673,_0x96b1('0x148'));}logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x149'),this['channel'][_0x96b1('0x38')],_0x57a673[_0x96b1('0x147')]));var _0x359ccd=this[_0x96b1('0x50')][_0x96b1('0xa0')](this,_0x57a673[_0x96b1('0x147')]);if(_0x359ccd){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x14a'),this['channel'][_0x96b1('0x38')],_0x57a673[_0x96b1('0x147')]));this[_0x96b1('0xd')][_0x96b1('0xa7')](util[_0x96b1('0x28')](_0x96b1('0x14a'),this[_0x96b1('0xd')][_0x96b1('0x38')],_0x57a673[_0x96b1('0x147')]));return{'code':0xc8,'result':_0x96b1('0x14b')};}else{logger[_0x96b1('0x2c')](util[_0x96b1('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x96b1('0xd')]['callerid'],_0x57a673[_0x96b1('0x147')]));this['channel']['noop'](util[_0x96b1('0x28')](_0x96b1('0x14c'),this[_0x96b1('0xd')]['callerid'],_0x57a673[_0x96b1('0x147')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x96b1('0x16')][_0x96b1('0x1b6')]=function(_0x2585ae){logger[_0x96b1('0x2c')](util[_0x96b1('0x28')](_0x96b1('0x1b7'),_0x2585ae[_0x96b1('0xab')]));var _0x5060f8=this['channel'][_0x96b1('0xa4')]('VOICEMAIL',[_0x2585ae[_0x96b1('0x1b8')],_0x2585ae[_0x96b1('0x75')]]);if(_0x5060f8[_0x96b1('0xa6')]===-0x1){return _0x5060f8;}return this[_0x96b1('0xd')]['noop'](util['format'](_0x96b1('0x160'),_0x96b1('0x1b9'),_0x2585ae[_0x96b1('0x1b8')]));};AGIVertices[_0x96b1('0x16')][_0x96b1('0x1ba')]=function(_0x4ee530){logger['info'](util[_0x96b1('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4ee530[_0x96b1('0xab')]));if(!this[_0x96b1('0x9e')](_0x4ee530[_0x96b1('0xd1')])){return this[_0x96b1('0xd')][_0x96b1('0x2b')](_0x4ee530,_0x96b1('0x19d'));}var _0x4d7075=this[_0x96b1('0x10')][_0x96b1('0xa0')](this,_0x4ee530[_0x96b1('0xd1')]);if(!_0x4d7075){return this['channel'][_0x96b1('0x2b')](_0x4ee530,_0x96b1('0xd2'));}var _0x5ef427=this['channel'][_0x96b1('0x10')](_0x4d7075);return{'code':0xc8,'result':_0x5ef427['extra']?_0x5ef427[_0x96b1('0x9d')]:'-'};};String[_0x96b1('0x16')][_0x96b1('0x1bb')]=function(_0xd3ee3b,_0x2eebb2){return this[_0x96b1('0x9b')](_0xd3ee3b)['join'](_0x2eebb2);};module[_0x96b1('0x1bc')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 7af28a4..20dc353 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 _0xb821=['[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','lodash','moment','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','startAcw','interface','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','getAgent','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0xb821,0xa7));var _0x1b82=function(_0x675562,_0x322f9d){_0x675562=_0x675562-0x0;var _0x561831=_0xb821[_0x675562];return _0x561831;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x1b82('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3b1d14){this[_0x1b82('0x3')]=_0x3b1d14[_0x1b82('0x3')];this[_0x1b82('0x4')]=_0x3b1d14['agents'];this[_0x1b82('0x5')]=_0x3b1d14[_0x1b82('0x5')];this[_0x1b82('0x6')]={};ami['on'](_0x1b82('0x7'),this[_0x1b82('0x8')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xa'),this[_0x1b82('0xb')][_0x1b82('0x9')](this));ami['on']('hangup',this[_0x1b82('0xc')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xd'),this[_0x1b82('0xe')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0xf'),this[_0x1b82('0x10')][_0x1b82('0x9')](this));ami['on']('blindtransfer',this[_0x1b82('0x11')][_0x1b82('0x9')](this));ami['on'](_0x1b82('0x12'),this[_0x1b82('0x13')]['bind'](this));}function getDiff(_0x1a6285){var _0x5767aa=moment()['milliseconds'](0x0);var _0x1e553a=moment(_0x1a6285)['milliseconds'](0x0);return _0x5767aa[_0x1b82('0x14')](_0x1e553a,_0x1b82('0x15'));}Acw['prototype'][_0x1b82('0x16')]=function(_0x5dab7d){try{var _0x563261=this;var _0x1b115b=this['channels'][_0x5dab7d][_0x1b82('0x17')];var _0x25228b=this[_0x1b82('0x6')][_0x5dab7d]['queue'];var _0x514082=this[_0x1b82('0x3')][_0x25228b];var _0x5d66c3=![];var _0x3def2d=_0x1b82('0x18');if(_0x514082[_0x1b82('0x19')]){if(_0x514082['mandatoryDispositionPause'][_0x1b82('0x1a')]){_0x5d66c3=!![];_0x3def2d=_0x514082[_0x1b82('0x1b')][_0x1b82('0x1a')];}}ami[_0x1b82('0x1c')]({'action':_0x1b82('0x1d'),'interface':_0x1b115b,'paused':!![],'reason':_0x3def2d})['then'](function(_0x35a2c8){if(_0x563261[_0x1b82('0x4')][_0x1b115b]){return RpcUser[_0x1b82('0x1e')](_0x563261[_0x1b82('0x4')][_0x1b115b]['id'])[_0x1b82('0x1f')](function(_0x31fd64){if(_0x31fd64&&!_0x31fd64[_0x1b82('0x20')]){logger['info'](_0x1b82('0x21'),_0x5dab7d,_0x1b115b,_0x25228b);var _0x233740=_0x563261['channels'][_0x5dab7d][_0x1b82('0x22')]&&_0x563261[_0x1b82('0x6')][_0x5dab7d][_0x1b82('0x23')]?_0x563261['channels'][_0x5dab7d][_0x1b82('0x23')]:_0x5dab7d;return RpcUser['savePause'](_0x563261['agents'][_0x1b115b],_0x3def2d,_0x233740)['then'](function(_0xf2e556){if(!_0x5d66c3){_0x563261[_0x1b82('0x5')][_0x1b115b]={};logger[_0x1b82('0x24')](_0x1b82('0x25'),_0x5dab7d,_0x563261['voiceQueues'][_0x25228b][_0x1b82('0x26')],_0x1b115b,_0x25228b);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]=setTimeout(_0x563261[_0x1b82('0x28')][_0x1b82('0x9')](_0x563261,_0x1b115b),_0x563261[_0x1b82('0x3')][_0x25228b][_0x1b82('0x26')]*0x3e8);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x29')]=moment()[_0x1b82('0x2a')](_0x1b82('0x2b'));_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2c')]=_0x5dab7d;_0x563261['timers'][_0x1b115b][_0x1b82('0x2d')]=_0x25228b;_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2e')]=function(){var _0x457dbb=getDiff(_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x29')]);clearTimeout(_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]);_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x27')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x457dbb},_0x563261[_0x1b82('0x5')][_0x1b115b][_0x1b82('0x2c')],_0x1b115b)[_0x1b82('0x1f')](function(_0xc98ee2){logger['info'](_0x1b82('0x2f'),_0x5dab7d,_0x457dbb,_0xc98ee2);})[_0x1b82('0x30')](function(_0x544bd5){logger[_0x1b82('0x31')](_0x1b82('0x32'),_0x5dab7d,_0x544bd5);});delete _0x563261[_0x1b82('0x5')][_0x1b115b];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5dab7d,_0x1b115b,_0x25228b);}});}})[_0x1b82('0x30')](function(_0x4c98e0){logger['error'](_0x1b82('0x25'),_0x5dab7d,_0x563261[_0x1b82('0x3')][_0x25228b][_0x1b82('0x26')],_0x1b115b,_0x25228b);})['finally'](function(){delete _0x563261[_0x1b82('0x6')][_0x5dab7d];});}catch(_0x366db3){logger[_0x1b82('0x31')](_0x1b82('0x33'),_0x366db3['message']);}};Acw[_0x1b82('0x34')][_0x1b82('0x28')]=function(_0x2ee9ac){try{var _0x5ebf6c=this;if(_0x5ebf6c['timers'][_0x2ee9ac]){_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac]['timer']=![];var _0x1d3e68=_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac][_0x1b82('0x2c')];var _0x348880=_0x5ebf6c[_0x1b82('0x5')][_0x2ee9ac][_0x1b82('0x2d')];var _0x39fe4a=_0x5ebf6c[_0x1b82('0x3')][_0x348880]['acwTimeout'];logger['info'](_0x1b82('0x35'),_0x2ee9ac);RpcUser['saveUnpause'](this[_0x1b82('0x4')][_0x2ee9ac]);RpcVoiceAgentReport['update']({'acwtime':_0x39fe4a,'agentacw':!![]},_0x1d3e68,_0x2ee9ac)[_0x1b82('0x1f')](function(_0x331379){logger[_0x1b82('0x24')](_0x1b82('0x2f'),_0x1d3e68,_0x39fe4a,_0x331379);})[_0x1b82('0x30')](function(_0x202bb4){logger['error'](_0x1b82('0x32'),_0x1d3e68,_0x202bb4);});}else{logger['error'](_0x1b82('0x36'),_0x2ee9ac);if(_0x5ebf6c['timers']){logger[_0x1b82('0x24')]('[ACW][TIMERS]',JSON['stringify'](_0x5ebf6c[_0x1b82('0x5')]));}}}catch(_0x388d14){logger[_0x1b82('0x31')](_0x1b82('0x37'),_0x388d14[_0x1b82('0x38')]);}};Acw['prototype'][_0x1b82('0x8')]=function(_0x4ffa9e){try{if(this[_0x1b82('0x3')][_0x4ffa9e[_0x1b82('0x2d')]]&&(this[_0x1b82('0x3')][_0x4ffa9e[_0x1b82('0x2d')]][_0x1b82('0x2')]||this['voiceQueues'][_0x4ffa9e[_0x1b82('0x2d')]]['mandatoryDisposition'])){if(this[_0x1b82('0x4')][_0x4ffa9e[_0x1b82('0x17')]]){this['channels'][_0x4ffa9e[_0x1b82('0x2c')]]={'queue':_0x4ffa9e[_0x1b82('0x2d')],'interface':_0x4ffa9e[_0x1b82('0x17')],'destlinkedid':_0x4ffa9e[_0x1b82('0x23')]};}}}catch(_0x39f6ef){logger[_0x1b82('0x31')](_0x1b82('0x39'),_0x39f6ef['message']);}};Acw[_0x1b82('0x34')]['syncAgentConnectPreview']=function(_0xb02ec3){try{if(this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]]&&(this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]][_0x1b82('0x2')]||this[_0x1b82('0x3')][_0xb02ec3[_0x1b82('0x2d')]][_0x1b82('0x19')])){if(this[_0x1b82('0x4')][_0xb02ec3[_0x1b82('0x17')]]){this[_0x1b82('0x6')][_0xb02ec3[_0x1b82('0x2c')]]={'queue':_0xb02ec3[_0x1b82('0x2d')],'interface':_0xb02ec3['interface']};}}}catch(_0x59afed){logger[_0x1b82('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x59afed[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0xb')]=function(_0x5710f4){try{if(this[_0x1b82('0x6')][_0x5710f4['uniqueid']]&&_['isUndefined'](this[_0x1b82('0x6')][_0x5710f4[_0x1b82('0x2c')]][_0x1b82('0x22')])){logger['info'](_0x1b82('0x3a'),_0x5710f4[_0x1b82('0x2c')]);this['startAcw'](_0x5710f4['uniqueid']);}else if(this[_0x1b82('0x6')][_0x5710f4[_0x1b82('0x3b')]]&&_[_0x1b82('0x3c')](this['channels'][_0x5710f4[_0x1b82('0x3b')]][_0x1b82('0x22')])){logger[_0x1b82('0x24')](_0x1b82('0x3d'),_0x5710f4[_0x1b82('0x3b')]);this[_0x1b82('0x16')](_0x5710f4['linkedid']);}}catch(_0x3914aa){logger['error'](_0x1b82('0x3e'),_0x3914aa[_0x1b82('0x38')]);}};Acw['prototype'][_0x1b82('0xc')]=function(_0x5de11b){try{if(this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x2c')]]&&this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x2c')]][_0x1b82('0x22')]){logger[_0x1b82('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5de11b['uniqueid']);this[_0x1b82('0x16')](_0x5de11b[_0x1b82('0x2c')]);}else if(this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x3b')]]&&this[_0x1b82('0x6')][_0x5de11b[_0x1b82('0x3b')]][_0x1b82('0x22')]){logger[_0x1b82('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5de11b['linkedid']);this['startAcw'](_0x5de11b[_0x1b82('0x3b')]);}}catch(_0x2a95d2){logger[_0x1b82('0x31')](_0x1b82('0x3f'),_0x2a95d2[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0x10')]=function(_0x53f7a4){try{if(!_[_0x1b82('0x40')](this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x41')]])){this[_0x1b82('0x16')](_0x53f7a4[_0x1b82('0x41')]);if(this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x42')]]){this[_0x1b82('0x6')][_0x53f7a4['secondtransfereruniqueid']][_0x1b82('0x22')]=!![];this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x43')]]=this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x42')]];delete this['channels'][_0x53f7a4['secondtransfereruniqueid']];}}else if(!_[_0x1b82('0x40')](this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x43')]])){this[_0x1b82('0x16')](_0x53f7a4['transfertargetuniqueid']);if(this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]]){this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]][_0x1b82('0x22')]=!![];this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x41')]]=this[_0x1b82('0x6')][_0x53f7a4[_0x1b82('0x44')]];delete this[_0x1b82('0x6')][_0x53f7a4['origtransfereruniqueid']];}}}catch(_0xde1d73){logger[_0x1b82('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0xde1d73[_0x1b82('0x38')]);}};Acw[_0x1b82('0x34')][_0x1b82('0x11')]=function(_0x2a5435){try{if(this['channels'][_0x2a5435[_0x1b82('0x45')]]){logger[_0x1b82('0x24')](_0x1b82('0x46'),JSON[_0x1b82('0x47')](_0x2a5435[_0x1b82('0x45')]));this[_0x1b82('0x16')](_0x2a5435['transfereruniqueid']);}else if(this[_0x1b82('0x6')][_0x2a5435['transfererlinkedid']]){logger[_0x1b82('0x24')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x1b82('0x47')](_0x2a5435[_0x1b82('0x48')]));this[_0x1b82('0x16')](_0x2a5435[_0x1b82('0x48')]);}}catch(_0x412073){logger[_0x1b82('0x31')](_0x1b82('0x49'),_0x412073['message']);}};Acw[_0x1b82('0x34')][_0x1b82('0xe')]=function(_0x1435a2){try{if(this[_0x1b82('0x3')][_0x1435a2[_0x1b82('0x2d')]]&&this[_0x1b82('0x3')][_0x1435a2[_0x1b82('0x2d')]][_0x1b82('0x4a')]===_0x1b82('0x4b')){if(this[_0x1b82('0x4')][_0x1435a2[_0x1b82('0x17')]]){logger[_0x1b82('0x24')](_0x1b82('0x4c'),_0x1435a2['uniqueid'],_0x1435a2[_0x1b82('0x17')],_0x1435a2[_0x1b82('0x2d')]);return RpcUser[_0x1b82('0x4d')](this['agents'][_0x1435a2[_0x1b82('0x17')]],_0x1b82('0x4e'),_0x1435a2['uniqueid']);}}}catch(_0x3bf106){logger[_0x1b82('0x31')](_0x1b82('0x4f'),_0x3bf106['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x0e85=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','queue','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','milliseconds','diff','seconds','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','then','voicePause','info','destlinkedid','savePause'];(function(_0x12fbd1,_0xbe311f){var _0xc3894e=function(_0x34e15f){while(--_0x34e15f){_0x12fbd1['push'](_0x12fbd1['shift']());}};_0xc3894e(++_0xbe311f);}(_0x0e85,0x7c));var _0x50e8=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x0e85[_0x1a72f3];return _0x57ef47;};'use strict';var util=require(_0x50e8('0x0'));var _=require(_0x50e8('0x1'));var moment=require('moment');var ami=require(_0x50e8('0x2'));var logger=require(_0x50e8('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x236cf3){this['voiceQueues']=_0x236cf3[_0x50e8('0x4')];this[_0x50e8('0x5')]=_0x236cf3[_0x50e8('0x5')];this[_0x50e8('0x6')]=_0x236cf3['timers'];this[_0x50e8('0x7')]={};ami['on'](_0x50e8('0x8'),this[_0x50e8('0x9')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xb'),this[_0x50e8('0xc')]['bind'](this));ami['on'](_0x50e8('0xd'),this[_0x50e8('0xe')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xf'),this[_0x50e8('0x10')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0x11'),this[_0x50e8('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x50e8('0x13')][_0x50e8('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x50e8('0xa')](this));}function getDiff(_0x2abda1){var _0x1a4c85=moment()[_0x50e8('0x14')](0x0);var _0x54efd3=moment(_0x2abda1)[_0x50e8('0x14')](0x0);return _0x1a4c85[_0x50e8('0x15')](_0x54efd3,_0x50e8('0x16'));}Acw['prototype']['startAcw']=function(_0x30a872){try{var _0xf02b48=this;var _0x40c184=this[_0x50e8('0x7')][_0x30a872][_0x50e8('0x17')];var _0x1f0338=this['channels'][_0x30a872]['queue'];var _0x441f25=this[_0x50e8('0x4')][_0x1f0338];var _0x40d060=![];var _0x45ce11=_0x50e8('0x18');if(_0x441f25[_0x50e8('0x19')]){if(_0x441f25[_0x50e8('0x1a')]['name']){_0x40d060=!![];_0x45ce11=_0x441f25[_0x50e8('0x1a')]['name'];}}ami[_0x50e8('0x1b')]({'action':_0x50e8('0x1c'),'interface':_0x40c184,'paused':!![],'reason':_0x45ce11})[_0x50e8('0x1d')](function(_0x20f835){if(_0xf02b48[_0x50e8('0x5')][_0x40c184]){return RpcUser['getAgent'](_0xf02b48[_0x50e8('0x5')][_0x40c184]['id'])[_0x50e8('0x1d')](function(_0x58110d){if(_0x58110d&&!_0x58110d[_0x50e8('0x1e')]){logger[_0x50e8('0x1f')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);var _0x1ce7fc=_0xf02b48[_0x50e8('0x7')][_0x30a872]['attended']&&_0xf02b48['channels'][_0x30a872]['destlinkedid']?_0xf02b48[_0x50e8('0x7')][_0x30a872][_0x50e8('0x20')]:_0x30a872;return RpcUser[_0x50e8('0x21')](_0xf02b48[_0x50e8('0x5')][_0x40c184],_0x45ce11,_0x1ce7fc)[_0x50e8('0x1d')](function(_0x13b6e9){if(!_0x40d060){_0xf02b48['timers'][_0x40c184]={};logger[_0x50e8('0x1f')](_0x50e8('0x22'),_0x30a872,_0xf02b48['voiceQueues'][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x24')]=setTimeout(_0xf02b48[_0x50e8('0x25')]['bind'](_0xf02b48,_0x40c184),_0xf02b48[_0x50e8('0x4')][_0x1f0338]['acwTimeout']*0x3e8);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x26')]=moment()[_0x50e8('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x28')]=_0x30a872;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x29')]=_0x1f0338;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x2a')]=function(){var _0x2c6fb3=getDiff(_0xf02b48['timers'][_0x40c184][_0x50e8('0x26')]);clearTimeout(_0xf02b48[_0x50e8('0x6')][_0x40c184]['timer']);_0xf02b48['timers'][_0x40c184][_0x50e8('0x24')]=![];RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2c6fb3},_0xf02b48[_0x50e8('0x6')][_0x40c184]['uniqueid'],_0x40c184)['then'](function(_0x3e58a9){logger[_0x50e8('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x30a872,_0x2c6fb3,_0x3e58a9);})[_0x50e8('0x2c')](function(_0x17c6a5){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x30a872,_0x17c6a5);});delete _0xf02b48['timers'][_0x40c184];};}});}else{logger[_0x50e8('0x1f')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);}});}})[_0x50e8('0x2c')](function(_0x33fc5b){logger[_0x50e8('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30a872,_0xf02b48[_0x50e8('0x4')][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);})['finally'](function(){delete _0xf02b48[_0x50e8('0x7')][_0x30a872];});}catch(_0x1c2fdb){logger[_0x50e8('0x2d')](_0x50e8('0x2f'),_0x1c2fdb['message']);}};Acw[_0x50e8('0x30')][_0x50e8('0x25')]=function(_0x24d3ea){try{var _0x4e2a37=this;if(_0x4e2a37['timers'][_0x24d3ea]){_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x24')]=![];var _0x3f01ee=_0x4e2a37['timers'][_0x24d3ea]['uniqueid'];var _0x5dff99=_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x29')];var _0x2cbee3=_0x4e2a37[_0x50e8('0x4')][_0x5dff99][_0x50e8('0x23')];logger[_0x50e8('0x1f')](_0x50e8('0x31'),_0x24d3ea);RpcUser[_0x50e8('0x32')](this[_0x50e8('0x5')][_0x24d3ea]);RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2cbee3,'agentacw':!![]},_0x3f01ee,_0x24d3ea)['then'](function(_0x3371a4){logger[_0x50e8('0x1f')](_0x50e8('0x33'),_0x3f01ee,_0x2cbee3,_0x3371a4);})[_0x50e8('0x2c')](function(_0x5dbbe1){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x3f01ee,_0x5dbbe1);});}else{logger[_0x50e8('0x2d')](_0x50e8('0x34'),_0x24d3ea);if(_0x4e2a37[_0x50e8('0x6')]){logger['info']('[ACW][TIMERS]',JSON[_0x50e8('0x35')](_0x4e2a37[_0x50e8('0x6')]));}}}catch(_0x53705e){logger[_0x50e8('0x2d')](_0x50e8('0x36'),_0x53705e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x9')]=function(_0x313e7b){try{if(this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]&&(this['voiceQueues'][_0x313e7b[_0x50e8('0x29')]][_0x50e8('0x38')]||this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]['mandatoryDisposition'])){if(this[_0x50e8('0x5')][_0x313e7b[_0x50e8('0x17')]]){this[_0x50e8('0x7')][_0x313e7b[_0x50e8('0x28')]]={'queue':_0x313e7b['queue'],'interface':_0x313e7b[_0x50e8('0x17')],'destlinkedid':_0x313e7b['destlinkedid']};}}}catch(_0x4a2619){logger['error'](_0x50e8('0x39'),_0x4a2619[_0x50e8('0x37')]);}};Acw['prototype'][_0x50e8('0x3a')]=function(_0x2007c4){try{if(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]&&(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]['acw']||this[_0x50e8('0x4')][_0x2007c4['queue']][_0x50e8('0x19')])){if(this[_0x50e8('0x5')][_0x2007c4['interface']]){this[_0x50e8('0x7')][_0x2007c4['uniqueid']]={'queue':_0x2007c4[_0x50e8('0x29')],'interface':_0x2007c4[_0x50e8('0x17')]};}}}catch(_0x2e55ed){logger[_0x50e8('0x2d')](_0x50e8('0x3b'),_0x2e55ed[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xc')]=function(_0x141bd4){try{if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]&&_['isUndefined'](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]['attended'])){logger[_0x50e8('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x141bd4[_0x50e8('0x28')]);this['startAcw'](_0x141bd4[_0x50e8('0x28')]);}else if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]]&&_[_0x50e8('0x3d')](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]][_0x50e8('0x3e')])){logger['info'](_0x50e8('0x3f'),_0x141bd4[_0x50e8('0x3c')]);this[_0x50e8('0x40')](_0x141bd4[_0x50e8('0x3c')]);}}catch(_0x3303f5){logger[_0x50e8('0x2d')]('[ACW][syncHangupRequest]\x20%s',_0x3303f5[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xe')]=function(_0x27c80a){try{if(this['channels'][_0x27c80a[_0x50e8('0x28')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x28')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x41'),_0x27c80a[_0x50e8('0x28')]);this['startAcw'](_0x27c80a['uniqueid']);}else if(this['channels'][_0x27c80a[_0x50e8('0x3c')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x3c')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x42'),_0x27c80a['linkedid']);this[_0x50e8('0x40')](_0x27c80a[_0x50e8('0x3c')]);}}catch(_0x460c8e){logger[_0x50e8('0x2d')]('[ACW][syncHangup]\x20%s',_0x460c8e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x12')]=function(_0x1cc5ba){try{if(!_[_0x50e8('0x43')](this[_0x50e8('0x7')][_0x1cc5ba['transfereeuniqueid']])){this[_0x50e8('0x40')](_0x1cc5ba['transfereeuniqueid']);if(this['channels'][_0x1cc5ba['secondtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba['secondtransfereruniqueid']][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]]=this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];delete this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];}}else if(!_['isNil'](this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]])){this[_0x50e8('0x40')](_0x1cc5ba['transfertargetuniqueid']);if(this['channels'][_0x1cc5ba['origtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x46')]][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x47')]]=this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];delete this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];}}}catch(_0x255b48){logger[_0x50e8('0x2d')]('[ACW][syncAttendedTransfer]\x20%s',_0x255b48['message']);}};Acw['prototype'][_0x50e8('0x13')]=function(_0x3588f0){try{if(this['channels'][_0x3588f0[_0x50e8('0x48')]]){logger[_0x50e8('0x1f')](_0x50e8('0x49'),JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x48')]));this['startAcw'](_0x3588f0[_0x50e8('0x48')]);}else if(this[_0x50e8('0x7')][_0x3588f0[_0x50e8('0x4a')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x4a')]));this[_0x50e8('0x40')](_0x3588f0[_0x50e8('0x4a')]);}}catch(_0x2b59f5){logger[_0x50e8('0x2d')]('[ACW][syncBlindTransfer]\x20%s',_0x2b59f5['message']);}};Acw[_0x50e8('0x30')]['syncAgentRingNoAnswer']=function(_0x1fc530){try{if(this[_0x50e8('0x4')][_0x1fc530['queue']]&&this[_0x50e8('0x4')][_0x1fc530['queue']]['autopause']==='all'){if(this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]]){logger[_0x50e8('0x1f')](_0x50e8('0x4b'),_0x1fc530['uniqueid'],_0x1fc530['interface'],_0x1fc530[_0x50e8('0x29')]);return RpcUser[_0x50e8('0x21')](this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]],_0x50e8('0x4c'),_0x1fc530[_0x50e8('0x28')]);}}}catch(_0x42e1dd){logger[_0x50e8('0x2d')](_0x50e8('0x4d'),_0x42e1dd[_0x50e8('0x37')]);}};module[_0x50e8('0x4e')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index bfd32c8..f32cef0 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 _0xbc92=['then','actionSipShowRegistry','actionSipPeerStatus','catch','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','error','devicestatelist','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','fullybooted','resolve'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc92,0xf2));var _0x2bc9=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xbc92[_0x26b8b5];return _0x2150a9;};'use strict';var Manager=require(_0x2bc9('0x0'));var BPromise=require(_0x2bc9('0x1'));var moment=require(_0x2bc9('0x2'));var util=require(_0x2bc9('0x3'));var _=require(_0x2bc9('0x4'));var logger=require(_0x2bc9('0x5'))(_0x2bc9('0x6'));var config=require('../../config/environment');var ami=new Manager(config[_0x2bc9('0x7')]['port'],config[_0x2bc9('0x7')]['ip'],config[_0x2bc9('0x7')][_0x2bc9('0x8')],config[_0x2bc9('0x7')][_0x2bc9('0x9')],!![]);ami[_0x2bc9('0xa')]();ami[_0x2bc9('0xb')]=BPromise[_0x2bc9('0xc')](ami[_0x2bc9('0xd')]);function error(_0x5a386e){logger['error'](util[_0x2bc9('0xe')](_0x2bc9('0xf'),config[_0x2bc9('0x7')][_0x2bc9('0x8')],config[_0x2bc9('0x7')]['ip'],config['asterisk'][_0x2bc9('0x10')],util[_0x2bc9('0x11')](_0x5a386e,![],null)));}function close(){logger[_0x2bc9('0x12')](util[_0x2bc9('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x2bc9('0x8')],config[_0x2bc9('0x7')]['ip'],config[_0x2bc9('0x7')][_0x2bc9('0x10')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2bc9('0xb')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2bc9('0xb')]({'action':_0x2bc9('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x2bc9('0xb')]({'action':'sippeerstatus'});};};ami[_0x2bc9('0x14')]=function(){return function(){return ami[_0x2bc9('0xb')]({'action':_0x2bc9('0x15')});};};ami[_0x2bc9('0x16')]=function(){return function(){return ami[_0x2bc9('0xb')]({'action':_0x2bc9('0x17')});};};function connect(_0x54db60){logger[_0x2bc9('0x18')](util[_0x2bc9('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x2bc9('0x7')]['username'],config[_0x2bc9('0x7')]['ip'],config[_0x2bc9('0x7')][_0x2bc9('0x10')]));ami[_0x2bc9('0x19')](_0x2bc9('0x12'),error);ami[_0x2bc9('0x19')](_0x2bc9('0x1a'),close);}ami['on'](_0x2bc9('0x1b'),connect);ami['on']('shutdown',function(_0x1d255f){logger[_0x2bc9('0x18')](util[_0x2bc9('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config[_0x2bc9('0x7')]['ip'],config[_0x2bc9('0x7')][_0x2bc9('0x10')],util[_0x2bc9('0x11')](_0x1d255f,![],null)));});ami['on'](_0x2bc9('0x1c'),function(_0x22ab4f){logger[_0x2bc9('0x18')](util[_0x2bc9('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0x2bc9('0x7')][_0x2bc9('0x10')]));return BPromise[_0x2bc9('0x1d')]()[_0x2bc9('0x1e')](ami[_0x2bc9('0x1f')]())[_0x2bc9('0x1e')](ami['actionDeviceStateList']())[_0x2bc9('0x1e')](ami[_0x2bc9('0x20')]())[_0x2bc9('0x1e')](ami['actionQueueSummary']())[_0x2bc9('0x1e')](ami[_0x2bc9('0x16')]())[_0x2bc9('0x21')](function(_0x4ae611){console['log'](_0x4ae611);});});ami[_0x2bc9('0x19')]('error',error);ami[_0x2bc9('0x19')](_0x2bc9('0x1a'),close);module['exports']=ami; \ No newline at end of file +var _0x2d4f=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionQueueSummary','catch','log','exports','bluebird','moment','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','action','error','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','info'];(function(_0x3459f2,_0x47f3ab){var _0x246540=function(_0x2b98cf){while(--_0x2b98cf){_0x3459f2['push'](_0x3459f2['shift']());}};_0x246540(++_0x47f3ab);}(_0x2d4f,0xc6));var _0xf2d4=function(_0x2345b8,_0x507647){_0x2345b8=_0x2345b8-0x0;var _0x498136=_0x2d4f[_0x2345b8];return _0x498136;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xf2d4('0x0'));var moment=require(_0xf2d4('0x1'));var util=require(_0xf2d4('0x2'));var _=require('lodash');var logger=require(_0xf2d4('0x3'))(_0xf2d4('0x4'));var config=require(_0xf2d4('0x5'));var ami=new Manager(config[_0xf2d4('0x6')][_0xf2d4('0x7')],config['asterisk']['ip'],config[_0xf2d4('0x6')][_0xf2d4('0x8')],config[_0xf2d4('0x6')][_0xf2d4('0x9')],!![]);ami['keepConnected']();ami[_0xf2d4('0xa')]=BPromise['promisify'](ami[_0xf2d4('0xb')]);function error(_0x304427){logger[_0xf2d4('0xc')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xf2d4('0x6')][_0xf2d4('0x8')],config[_0xf2d4('0x6')]['ip'],config[_0xf2d4('0x6')][_0xf2d4('0x7')],util[_0xf2d4('0xd')](_0x304427,![],null)));}function close(){logger[_0xf2d4('0xc')](util[_0xf2d4('0xe')](_0xf2d4('0xf'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xf2d4('0x6')][_0xf2d4('0x7')]));}ami[_0xf2d4('0x10')]=function(){return function(){return ami['Action']({'action':_0xf2d4('0x11')});};};ami[_0xf2d4('0x12')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0xf2d4('0x13')]=function(){return function(){return ami[_0xf2d4('0xa')]({'action':_0xf2d4('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xf2d4('0xa')]({'action':_0xf2d4('0x15')});};};ami[_0xf2d4('0x16')]=function(){return function(){return ami[_0xf2d4('0xa')]({'action':'coreshowchannels'});};};function connect(_0x1c317a){logger[_0xf2d4('0x17')](util[_0xf2d4('0xe')](_0xf2d4('0x18'),config[_0xf2d4('0x6')][_0xf2d4('0x8')],config[_0xf2d4('0x6')]['ip'],config[_0xf2d4('0x6')][_0xf2d4('0x7')]));ami['once'](_0xf2d4('0xc'),error);ami[_0xf2d4('0x19')](_0xf2d4('0x1a'),close);}ami['on'](_0xf2d4('0x1b'),connect);ami['on'](_0xf2d4('0x1c'),function(_0x27f4b8){logger['info'](util['format'](_0xf2d4('0x1d'),config['asterisk']['username'],config[_0xf2d4('0x6')]['ip'],config[_0xf2d4('0x6')][_0xf2d4('0x7')],util[_0xf2d4('0xd')](_0x27f4b8,![],null)));});ami['on'](_0xf2d4('0x1e'),function(_0x3b5630){logger['info'](util[_0xf2d4('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk'][_0xf2d4('0x8')],config[_0xf2d4('0x6')]['ip'],config['asterisk'][_0xf2d4('0x7')]));return BPromise[_0xf2d4('0x1f')]()['then'](ami[_0xf2d4('0x10')]())[_0xf2d4('0x20')](ami[_0xf2d4('0x12')]())['then'](ami[_0xf2d4('0x13')]())['then'](ami[_0xf2d4('0x21')]())[_0xf2d4('0x20')](ami[_0xf2d4('0x16')]())[_0xf2d4('0x22')](function(_0x4a87c4){console[_0xf2d4('0x23')](_0x4a87c4);});});ami[_0xf2d4('0x19')](_0xf2d4('0xc'),error);ami[_0xf2d4('0x19')](_0xf2d4('0x1a'),close);module[_0xf2d4('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 006006d..574727a 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 _0xcfb0=['request','then','debug','rpc','memberReport','error','result','exports','jayson/promise','bluebird','../../config/logger','ami','client','http','Request'];(function(_0x263052,_0x29c4da){var _0x516a6b=function(_0x2bb985){while(--_0x2bb985){_0x263052['push'](_0x263052['shift']());}};_0x516a6b(++_0x29c4da);}(_0xcfb0,0x18e));var _0x0cfb=function(_0x34516c,_0x928ae0){_0x34516c=_0x34516c-0x0;var _0x2417d6=_0xcfb0[_0x34516c];return _0x2417d6;};'use strict';var jayson=require(_0x0cfb('0x0'));var BPromise=require(_0x0cfb('0x1'));var logger=require(_0x0cfb('0x2'))(_0x0cfb('0x3'));var client=jayson[_0x0cfb('0x4')][_0x0cfb('0x5')]({'port':0x2329});client[_0x0cfb('0x6')]=function(_0xd133af,_0x160039){return new BPromise(function(_0x4625b4,_0x14f2f3){return client[_0x0cfb('0x7')](_0xd133af,_0x160039)[_0x0cfb('0x8')](function(_0x5e4453){logger[_0x0cfb('0x9')](_0x0cfb('0xa'),_0x0cfb('0xb'),_0xd133af,_0x160039,_0x5e4453);if(_0x5e4453[_0x0cfb('0xc')]){logger[_0x0cfb('0xc')](_0x0cfb('0xa'),_0x0cfb('0xb'),_0xd133af,_0x5e4453['error']['message'],_0x160039);return _0x14f2f3(_0x5e4453[_0x0cfb('0xc')]['message']);}else{return _0x4625b4(_0x5e4453[_0x0cfb('0xd')]);}})['catch'](function(_0x3013c1){logger[_0x0cfb('0xc')]('rpc',_0x0cfb('0xb'),_0xd133af,_0x3013c1,_0x160039);return _0x14f2f3(_0x3013c1);});});};module[_0x0cfb('0xe')]=client; \ No newline at end of file +var _0xe0ab=['client','Request','request','then','debug','memberReport','error','rpc','message','catch','exports','jayson/promise','bluebird','../../config/logger','ami'];(function(_0x57e79a,_0x1c7c8f){var _0x132f21=function(_0x2cb78e){while(--_0x2cb78e){_0x57e79a['push'](_0x57e79a['shift']());}};_0x132f21(++_0x1c7c8f);}(_0xe0ab,0x1be));var _0xbe0a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe0ab[_0x19e35c];return _0x3e1fe8;};'use strict';var jayson=require(_0xbe0a('0x0'));var BPromise=require(_0xbe0a('0x1'));var logger=require(_0xbe0a('0x2'))(_0xbe0a('0x3'));var client=jayson[_0xbe0a('0x4')]['http']({'port':0x2329});client[_0xbe0a('0x5')]=function(_0x173723,_0x2cf4a8){return new BPromise(function(_0x40e112,_0x230d96){return client[_0xbe0a('0x6')](_0x173723,_0x2cf4a8)[_0xbe0a('0x7')](function(_0x54c285){logger[_0xbe0a('0x8')]('rpc',_0xbe0a('0x9'),_0x173723,_0x2cf4a8,_0x54c285);if(_0x54c285[_0xbe0a('0xa')]){logger[_0xbe0a('0xa')](_0xbe0a('0xb'),_0xbe0a('0x9'),_0x173723,_0x54c285[_0xbe0a('0xa')][_0xbe0a('0xc')],_0x2cf4a8);return _0x230d96(_0x54c285[_0xbe0a('0xa')]['message']);}else{return _0x40e112(_0x54c285['result']);}})[_0xbe0a('0xd')](function(_0x38810d){logger[_0xbe0a('0xa')](_0xbe0a('0xb'),_0xbe0a('0x9'),_0x173723,_0x38810d,_0x2cf4a8);return _0x230d96(_0x38810d);});});};module[_0xbe0a('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 47e5d69..42e48ed 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 _0x47c7=['idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x2726ce,_0x57c360){var _0x8465db=function(_0x2e27af){while(--_0x2e27af){_0x2726ce['push'](_0x2726ce['shift']());}};_0x8465db(++_0x57c360);}(_0x47c7,0x1f3));var _0x747c=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x47c7[_0x4fdcc0];return _0xc0ce94;};'use strict';var util=require('util');var _=require(_0x747c('0x0'));var moment=require(_0x747c('0x1'));function checkNameSurname(_0x3df892,_0x5d8956,_0x552a0f){var _0x2cf1a3='';if(!_[_0x747c('0x2')](_0x5d8956)&&_0x747c('0x3')===typeof _0x5d8956){_0x2cf1a3+=_0x5d8956;}if(!_[_0x747c('0x2')](_0x552a0f)&&'string'===typeof _0x552a0f){_0x2cf1a3+='\x20'+_0x552a0f;}if(_0x2cf1a3!==''){return _0x2cf1a3;}return _0x3df892;}function Action(_0x24cbab,_0x5c9a0b,_0xf4d0b2){this[_0x747c('0x4')]=_0x24cbab;this[_0x747c('0x5')]=_0xf4d0b2||undefined;this[_0x747c('0x6')]=checkNameSurname(_0x5c9a0b[_0x747c('0x7')][_0x747c('0x8')],_0x5c9a0b[_0x747c('0x7')][_0x747c('0x9')],_0x5c9a0b[_0x747c('0x7')][_0x747c('0xa')]);this[_0x747c('0xb')]=_0x5c9a0b[_0x747c('0x7')][_0x747c('0x8')];this[_0x747c('0xc')]=_0x24cbab['name'];this['active']=_0x5c9a0b[_0x747c('0xd')]||![];this[_0x747c('0xe')]=_0x24cbab[_0x747c('0xe')];this[_0x747c('0xf')]=_0x24cbab['dialQueueTimeout']||0x3;this['scheduledat']=_0x5c9a0b[_0x747c('0x10')];this[_0x747c('0x11')]=_0x5c9a0b[_0x747c('0x11')];this[_0x747c('0x12')]=_0x5c9a0b[_0x747c('0x12')];this[_0x747c('0x13')]=_0x5c9a0b[_0x747c('0x13')];this[_0x747c('0x14')]=_0x5c9a0b['countnosuchnumberretry'];this[_0x747c('0x15')]=_0x5c9a0b[_0x747c('0x15')];this[_0x747c('0x16')]=_0x5c9a0b[_0x747c('0x16')];this['countmachineretry']=_0x5c9a0b[_0x747c('0x17')];this[_0x747c('0x18')]=_0x5c9a0b['countagentrejectretry'];this['ContactId']=_0x5c9a0b['ContactId'];this[_0x747c('0x19')]=_0x5c9a0b['ListId'];this[_0x747c('0x1a')]=_0x5c9a0b[_0x747c('0x1a')];this[_0x747c('0x1b')]=_0x5c9a0b[_0x747c('0x1b')];this[_0x747c('0x1c')]=_0x5c9a0b['CampaignId'];this[_0x747c('0x1d')]=_0x5c9a0b['id'];this['ContactFirstName']=_0x5c9a0b[_0x747c('0x7')]['firstName']||'';this[_0x747c('0x1e')]=moment()[_0x747c('0x1f')](_0x747c('0x20'));this['callback']=_0x5c9a0b[_0x747c('0x21')];this[_0x747c('0x22')]=_0x5c9a0b['callbackuniqueid'];this[_0x747c('0x23')]=_0x5c9a0b[_0x747c('0x23')];this[_0x747c('0x24')]=_0x5c9a0b[_0x747c('0x24')];this[_0x747c('0x25')]='';this['originatecalleridname']='';}Action['prototype'][_0x747c('0x26')]=function(){return util['format'](_0x747c('0x27'),this['name'],this['voiceQueue'][_0x747c('0x28')]>0x0?this['number']['substring'](this[_0x747c('0x4')]['dialCutDigit']):this['number']);};Action[_0x747c('0x29')][_0x747c('0x2a')]=function(){return this[_0x747c('0xc')];};module[_0x747c('0x2b')]=Action; \ No newline at end of file +var _0x34b7=['queue','name','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','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','exports','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','lastName'];(function(_0x4d68bd,_0x1ae5bf){var _0x350bd5=function(_0x287cc3){while(--_0x287cc3){_0x4d68bd['push'](_0x4d68bd['shift']());}};_0x350bd5(++_0x1ae5bf);}(_0x34b7,0x196));var _0x734b=function(_0x1001bb,_0x4231f7){_0x1001bb=_0x1001bb-0x0;var _0x343d7b=_0x34b7[_0x1001bb];return _0x343d7b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x734b('0x0'));function checkNameSurname(_0x1aedd0,_0x6e4318,_0x354f96){var _0xa2ff85='';if(!_[_0x734b('0x1')](_0x6e4318)&&'string'===typeof _0x6e4318){_0xa2ff85+=_0x6e4318;}if(!_['isNil'](_0x354f96)&&_0x734b('0x2')===typeof _0x354f96){_0xa2ff85+='\x20'+_0x354f96;}if(_0xa2ff85!==''){return _0xa2ff85;}return _0x1aedd0;}function Action(_0x2fde69,_0x2f3128,_0x34fd70){this[_0x734b('0x3')]=_0x2fde69;this[_0x734b('0x4')]=_0x34fd70||undefined;this['name']=checkNameSurname(_0x2f3128[_0x734b('0x5')][_0x734b('0x6')],_0x2f3128['Contact']['firstName'],_0x2f3128['Contact'][_0x734b('0x7')]);this['number']=_0x2f3128[_0x734b('0x5')][_0x734b('0x6')];this[_0x734b('0x8')]=_0x2fde69[_0x734b('0x9')];this[_0x734b('0xa')]=_0x2f3128[_0x734b('0xa')]||![];this[_0x734b('0xb')]=_0x2fde69[_0x734b('0xb')];this[_0x734b('0xc')]=_0x2fde69[_0x734b('0xc')]||0x3;this[_0x734b('0xd')]=_0x2f3128[_0x734b('0xd')];this[_0x734b('0xe')]=_0x2f3128[_0x734b('0xe')];this['countcongestionretry']=_0x2f3128[_0x734b('0xf')];this[_0x734b('0x10')]=_0x2f3128[_0x734b('0x10')];this[_0x734b('0x11')]=_0x2f3128[_0x734b('0x11')];this[_0x734b('0x12')]=_0x2f3128[_0x734b('0x12')];this[_0x734b('0x13')]=_0x2f3128[_0x734b('0x13')];this[_0x734b('0x14')]=_0x2f3128[_0x734b('0x14')];this['countagentrejectretry']=_0x2f3128[_0x734b('0x15')];this[_0x734b('0x16')]=_0x2f3128[_0x734b('0x16')];this[_0x734b('0x17')]=_0x2f3128['ListId'];this['UserId']=_0x2f3128[_0x734b('0x18')];this[_0x734b('0x19')]=_0x2f3128[_0x734b('0x19')];this[_0x734b('0x1a')]=_0x2f3128[_0x734b('0x1a')];this[_0x734b('0x1b')]=_0x2f3128['id'];this[_0x734b('0x1c')]=_0x2f3128[_0x734b('0x5')][_0x734b('0x1d')]||'';this[_0x734b('0x1e')]=moment()[_0x734b('0x1f')](_0x734b('0x20'));this[_0x734b('0x21')]=_0x2f3128[_0x734b('0x21')];this['callbackuniqueid']=_0x2f3128[_0x734b('0x22')];this[_0x734b('0x23')]=_0x2f3128['callbackat'];this[_0x734b('0x24')]=_0x2f3128[_0x734b('0x24')];this[_0x734b('0x25')]='';this[_0x734b('0x26')]='';}Action[_0x734b('0x27')][_0x734b('0x28')]=function(){return util[_0x734b('0x1f')](_0x734b('0x29'),this[_0x734b('0x9')],this[_0x734b('0x3')][_0x734b('0x2a')]>0x0?this[_0x734b('0x2b')][_0x734b('0x2c')](this['voiceQueue']['dialCutDigit']):this[_0x734b('0x2b')]);};Action[_0x734b('0x27')]['getQueue']=function(){return this[_0x734b('0x8')];};module[_0x734b('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 7dfa379..b970234 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 _0x2dc4=['YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format'];(function(_0x53ba00,_0x16b33b){var _0x2027c4=function(_0x8e7821){while(--_0x8e7821){_0x53ba00['push'](_0x53ba00['shift']());}};_0x2027c4(++_0x16b33b);}(_0x2dc4,0x1c2));var _0x42dc=function(_0xbf74c,_0x3ccc7b){_0xbf74c=_0xbf74c-0x0;var _0x550da9=_0x2dc4[_0xbf74c];return _0x550da9;};'use strict';var util=require(_0x42dc('0x0'));var _=require(_0x42dc('0x1'));var moment=require(_0x42dc('0x2'));function getSeconds(_0x1e8583,_0x32c477){var _0x44e2ee=moment(_0x1e8583)[_0x42dc('0x3')](0x0);var _0xc9fc85=moment(_0x32c477)[_0x42dc('0x3')](0x0);return _0x44e2ee[_0x42dc('0x4')](_0xc9fc85,'seconds');}function AgentComplete(_0x2c1020,_0x2667a1){this['state']=0x4;this[_0x42dc('0x5')]=_0x42dc('0x6');this[_0x42dc('0x7')]=_0x2c1020[_0x42dc('0x7')];this['type']=_0x2c1020[_0x42dc('0x8')];this[_0x42dc('0x9')]=_0x2c1020[_0x42dc('0x8')]===_0x42dc('0xa')?'queue':_0x2c1020[_0x42dc('0x8')];this[_0x42dc('0xb')]=_0x2c1020['countbusyretry'];this[_0x42dc('0xc')]=_0x2c1020['countcongestionretry'];this[_0x42dc('0xd')]=_0x2c1020[_0x42dc('0xd')];this[_0x42dc('0xe')]=_0x2c1020[_0x42dc('0xb')]+_0x2c1020[_0x42dc('0xc')]+_0x2c1020[_0x42dc('0xd')]+_0x2c1020[_0x42dc('0xf')]+_0x2c1020[_0x42dc('0x10')]+_0x2c1020[_0x42dc('0x11')]+_0x2c1020['countmachineretry']+_0x2c1020[_0x42dc('0x12')];this[_0x42dc('0xf')]=_0x2c1020[_0x42dc('0xf')];this['countdropretry']=_0x2c1020[_0x42dc('0x10')];this['countabandonedretry']=_0x2c1020[_0x42dc('0x11')];this[_0x42dc('0x13')]=_0x2c1020[_0x42dc('0x13')];this[_0x42dc('0x12')]=_0x2c1020[_0x42dc('0x12')];this[_0x42dc('0x14')]=_0x2667a1[_0x42dc('0x14')];this[_0x42dc('0x15')]=_0x2c1020[_0x42dc('0x16')];this[_0x42dc('0x17')]=_0x2c1020[_0x42dc('0x18')];this[_0x42dc('0x19')]=_0x2c1020[_0x42dc('0x19')];this[_0x42dc('0x1a')]=_0x2c1020[_0x42dc('0x1a')];this[_0x42dc('0x1b')]=_0x2c1020[_0x42dc('0x1b')];this[_0x42dc('0x1c')]=moment()[_0x42dc('0x1d')](_0x42dc('0x1e'));this[_0x42dc('0x1f')]=getSeconds(_0x2c1020[_0x42dc('0x1a')],_0x2c1020['starttime']);this[_0x42dc('0x20')]=getSeconds(_0x2c1020[_0x42dc('0x1b')],_0x2c1020[_0x42dc('0x1a')]);this[_0x42dc('0x21')]=getSeconds(this[_0x42dc('0x1c')],_0x2c1020[_0x42dc('0x1b')]);this[_0x42dc('0x22')]=_0x2667a1['queue'];this[_0x42dc('0x23')]=_0x2667a1[_0x42dc('0x23')];this[_0x42dc('0x24')]=_0x2667a1[_0x42dc('0x24')];this['callback']=_0x2c1020[_0x42dc('0x25')];this['callbackuniqueid']=_0x2c1020[_0x42dc('0x26')];this[_0x42dc('0x27')]=_0x2c1020[_0x42dc('0x27')];this[_0x42dc('0x28')]=_0x2c1020[_0x42dc('0x28')];this['ContactId']=_0x2c1020['ContactId'];this[_0x42dc('0x29')]=_0x2c1020['ListId'];this[_0x42dc('0x2a')]=_0x2c1020[_0x42dc('0x2a')];this['VoiceQueueId']=_0x2c1020[_0x42dc('0x2b')];this[_0x42dc('0x2c')]=_0x2c1020[_0x42dc('0x2c')];this[_0x42dc('0x2d')]=_0x2c1020['originatecalleridnum']||'';this[_0x42dc('0x2e')]=_0x2c1020[_0x42dc('0x2e')]||'';}module[_0x42dc('0x2f')]=AgentComplete; \ No newline at end of file +var _0x09ca=['type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat'];(function(_0x4bee1f,_0x27ec1a){var _0x2f7876=function(_0x52f7e5){while(--_0x52f7e5){_0x4bee1f['push'](_0x4bee1f['shift']());}};_0x2f7876(++_0x27ec1a);}(_0x09ca,0xcf));var _0xa09c=function(_0x4f2299,_0x45fc00){_0x4f2299=_0x4f2299-0x0;var _0x5c06c0=_0x09ca[_0x4f2299];return _0x5c06c0;};'use strict';var util=require('util');var _=require(_0xa09c('0x0'));var moment=require(_0xa09c('0x1'));function getSeconds(_0x5c27c8,_0x3235be){var _0x2451e3=moment(_0x5c27c8)[_0xa09c('0x2')](0x0);var _0xfe1fc2=moment(_0x3235be)[_0xa09c('0x2')](0x0);return _0x2451e3[_0xa09c('0x3')](_0xfe1fc2,'seconds');}function AgentComplete(_0x51791e,_0x177d02){this[_0xa09c('0x4')]=0x4;this[_0xa09c('0x5')]=_0xa09c('0x6');this[_0xa09c('0x7')]=_0x51791e['scheduledat'];this[_0xa09c('0x8')]=_0x51791e[_0xa09c('0x8')];this['campaigntype']=_0x51791e[_0xa09c('0x8')]===_0xa09c('0x9')?_0xa09c('0xa'):_0x51791e['type'];this[_0xa09c('0xb')]=_0x51791e[_0xa09c('0xb')];this[_0xa09c('0xc')]=_0x51791e['countcongestionretry'];this[_0xa09c('0xd')]=_0x51791e[_0xa09c('0xd')];this[_0xa09c('0xe')]=_0x51791e[_0xa09c('0xb')]+_0x51791e[_0xa09c('0xc')]+_0x51791e[_0xa09c('0xd')]+_0x51791e[_0xa09c('0xf')]+_0x51791e['countdropretry']+_0x51791e[_0xa09c('0x10')]+_0x51791e[_0xa09c('0x11')]+_0x51791e[_0xa09c('0x12')];this[_0xa09c('0xf')]=_0x51791e[_0xa09c('0xf')];this[_0xa09c('0x13')]=_0x51791e[_0xa09c('0x13')];this[_0xa09c('0x10')]=_0x51791e['countabandonedretry'];this['countmachineretry']=_0x51791e[_0xa09c('0x11')];this[_0xa09c('0x12')]=_0x51791e[_0xa09c('0x12')];this[_0xa09c('0x14')]=_0x177d02[_0xa09c('0x14')];this[_0xa09c('0x15')]=_0x51791e[_0xa09c('0x16')];this[_0xa09c('0x17')]=_0x51791e['number'];this[_0xa09c('0x18')]=_0x51791e[_0xa09c('0x18')];this['responsetime']=_0x51791e[_0xa09c('0x19')];this[_0xa09c('0x1a')]=_0x51791e[_0xa09c('0x1a')];this['endtime']=moment()[_0xa09c('0x1b')](_0xa09c('0x1c'));this[_0xa09c('0x1d')]=getSeconds(_0x51791e[_0xa09c('0x19')],_0x51791e[_0xa09c('0x18')]);this[_0xa09c('0x1e')]=getSeconds(_0x51791e['answertime'],_0x51791e['responsetime']);this[_0xa09c('0x1f')]=getSeconds(this['endtime'],_0x51791e[_0xa09c('0x1a')]);this['queue']=_0x177d02['queue'];this['membername']=_0x177d02['membername'];this[_0xa09c('0x20')]=_0x177d02[_0xa09c('0x20')];this[_0xa09c('0x21')]=_0x51791e['callback'];this[_0xa09c('0x22')]=_0x51791e['callbackuniqueid'];this['callbackat']=_0x51791e[_0xa09c('0x23')];this[_0xa09c('0x24')]=_0x51791e[_0xa09c('0x24')];this[_0xa09c('0x25')]=_0x51791e[_0xa09c('0x25')];this[_0xa09c('0x26')]=_0x51791e[_0xa09c('0x26')];this['UserId']=_0x51791e['UserId'];this['VoiceQueueId']=_0x51791e[_0xa09c('0x27')];this['CampaignId']=_0x51791e[_0xa09c('0x28')];this[_0xa09c('0x29')]=_0x51791e[_0xa09c('0x29')]||'';this['originatecalleridname']=_0x51791e['originatecalleridname']||'';}module[_0xa09c('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index ec11faa..0c06b0a 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 _0x3d19=['countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x4eeb06,_0x2b2cd1){var _0x4c909e=function(_0x3f645c){while(--_0x3f645c){_0x4eeb06['push'](_0x4eeb06['shift']());}};_0x4c909e(++_0x2b2cd1);}(_0x3d19,0x16a));var _0x93d1=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x3d19[_0x22f8ab];return _0x2a70e5;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x7f7c5d,_0x47417e){var _0x48af0e=moment(_0x7f7c5d)[_0x93d1('0x0')](0x0);var _0x3b705b=moment(_0x47417e)[_0x93d1('0x0')](0x0);return _0x48af0e['diff'](_0x3b705b,'seconds');}function Final(_0x5a8b5b){this[_0x93d1('0x1')]=_0x5a8b5b['uniqueid'];this[_0x93d1('0x2')]=_0x5a8b5b['scheduledat'];this[_0x93d1('0x3')]=_0x5a8b5b[_0x93d1('0x3')];this[_0x93d1('0x4')]=_0x5a8b5b[_0x93d1('0x3')]===_0x93d1('0x5')?'queue':_0x5a8b5b[_0x93d1('0x3')];this[_0x93d1('0x6')]=_0x5a8b5b[_0x93d1('0x6')];this[_0x93d1('0x7')]=_0x5a8b5b[_0x93d1('0x7')];this[_0x93d1('0x8')]=_0x5a8b5b[_0x93d1('0x8')];this[_0x93d1('0x9')]=_0x5a8b5b[_0x93d1('0x6')]+_0x5a8b5b[_0x93d1('0x7')]+_0x5a8b5b[_0x93d1('0x8')]+_0x5a8b5b[_0x93d1('0xa')]+_0x5a8b5b[_0x93d1('0xb')]+_0x5a8b5b[_0x93d1('0xc')]+_0x5a8b5b[_0x93d1('0xd')]+_0x5a8b5b[_0x93d1('0xe')];this[_0x93d1('0xa')]=_0x5a8b5b[_0x93d1('0xa')];this['countdropretry']=_0x5a8b5b[_0x93d1('0xb')];this[_0x93d1('0xc')]=_0x5a8b5b[_0x93d1('0xc')];this['countmachineretry']=_0x5a8b5b['countmachineretry'];this[_0x93d1('0xe')]=_0x5a8b5b[_0x93d1('0xe')];this[_0x93d1('0xf')]=_0x5a8b5b[_0x93d1('0xf')];this[_0x93d1('0x10')]=_0x5a8b5b[_0x93d1('0x10')];this[_0x93d1('0x11')]=_0x5a8b5b[_0x93d1('0x11')];this[_0x93d1('0x12')]=_0x5a8b5b['starttime'];this[_0x93d1('0x13')]=_0x5a8b5b['responsetime'];this['endtime']=_0x5a8b5b['responsetime'];this[_0x93d1('0x14')]=_0x5a8b5b[_0x93d1('0x14')]||0x0;this[_0x93d1('0x15')]=_0x5a8b5b[_0x93d1('0x15')]||0x0;this[_0x93d1('0x16')]=_0x5a8b5b[_0x93d1('0x16')]||0x0;this[_0x93d1('0x17')]=_0x5a8b5b[_0x93d1('0x17')];this[_0x93d1('0x18')]=_0x5a8b5b[_0x93d1('0x18')];this[_0x93d1('0x19')]=_0x5a8b5b[_0x93d1('0x19')];this[_0x93d1('0x1a')]=_0x5a8b5b[_0x93d1('0x1a')];this[_0x93d1('0x1b')]=_0x5a8b5b[_0x93d1('0x1b')];this[_0x93d1('0x1c')]=_0x5a8b5b[_0x93d1('0x1c')];this[_0x93d1('0x1d')]=_0x5a8b5b['UserId'];this[_0x93d1('0x1e')]=_0x5a8b5b['VoiceQueueId'];this['CampaignId']=_0x5a8b5b['CampaignId'];this['originatecalleridnum']=_0x5a8b5b[_0x93d1('0x1f')]||'';this[_0x93d1('0x20')]=_0x5a8b5b[_0x93d1('0x20')]||'';}module[_0x93d1('0x21')]=Final; \ No newline at end of file +var _0xe8a0=['recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','calleridname','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x2c0404,_0x58673b){var _0x4c318e=function(_0x2fdbb7){while(--_0x2fdbb7){_0x2c0404['push'](_0x2c0404['shift']());}};_0x4c318e(++_0x58673b);}(_0xe8a0,0x155));var _0x0e8a=function(_0x2baf96,_0x238e4f){_0x2baf96=_0x2baf96-0x0;var _0x1105be=_0xe8a0[_0x2baf96];return _0x1105be;};'use strict';var util=require(_0x0e8a('0x0'));var _=require(_0x0e8a('0x1'));var moment=require(_0x0e8a('0x2'));function getSeconds(_0x3ebbe7,_0x586167){var _0xf625a=moment(_0x3ebbe7)['milliseconds'](0x0);var _0x2853b4=moment(_0x586167)[_0x0e8a('0x3')](0x0);return _0xf625a[_0x0e8a('0x4')](_0x2853b4,_0x0e8a('0x5'));}function Final(_0x1f53b6){this[_0x0e8a('0x6')]=_0x1f53b6[_0x0e8a('0x6')];this[_0x0e8a('0x7')]=_0x1f53b6['scheduledat'];this[_0x0e8a('0x8')]=_0x1f53b6['type'];this[_0x0e8a('0x9')]=_0x1f53b6[_0x0e8a('0x8')]==='outbound'?'queue':_0x1f53b6[_0x0e8a('0x8')];this[_0x0e8a('0xa')]=_0x1f53b6[_0x0e8a('0xa')];this['countcongestionretry']=_0x1f53b6[_0x0e8a('0xb')];this[_0x0e8a('0xc')]=_0x1f53b6[_0x0e8a('0xc')];this[_0x0e8a('0xd')]=_0x1f53b6[_0x0e8a('0xa')]+_0x1f53b6[_0x0e8a('0xb')]+_0x1f53b6['countnoanswerretry']+_0x1f53b6[_0x0e8a('0xe')]+_0x1f53b6[_0x0e8a('0xf')]+_0x1f53b6[_0x0e8a('0x10')]+_0x1f53b6['countmachineretry']+_0x1f53b6[_0x0e8a('0x11')];this[_0x0e8a('0xe')]=_0x1f53b6[_0x0e8a('0xe')];this['countdropretry']=_0x1f53b6[_0x0e8a('0xf')];this[_0x0e8a('0x10')]=_0x1f53b6['countabandonedretry'];this['countmachineretry']=_0x1f53b6[_0x0e8a('0x12')];this[_0x0e8a('0x11')]=_0x1f53b6[_0x0e8a('0x11')];this[_0x0e8a('0x13')]=_0x1f53b6['queue'];this[_0x0e8a('0x14')]=_0x1f53b6['calleridname'];this['calleridnum']=_0x1f53b6['calleridnum'];this[_0x0e8a('0x15')]=_0x1f53b6[_0x0e8a('0x15')];this['responsetime']=_0x1f53b6[_0x0e8a('0x16')];this[_0x0e8a('0x17')]=_0x1f53b6[_0x0e8a('0x16')];this[_0x0e8a('0x18')]=_0x1f53b6[_0x0e8a('0x18')]||0x0;this['holdtime']=_0x1f53b6[_0x0e8a('0x19')]||0x0;this[_0x0e8a('0x1a')]=_0x1f53b6[_0x0e8a('0x1a')]||0x0;this[_0x0e8a('0x1b')]=_0x1f53b6['callback'];this[_0x0e8a('0x1c')]=_0x1f53b6[_0x0e8a('0x1c')];this['callbackat']=_0x1f53b6['callbackat'];this['recallme']=_0x1f53b6[_0x0e8a('0x1d')];this['ContactId']=_0x1f53b6['ContactId'];this[_0x0e8a('0x1e')]=_0x1f53b6['ListId'];this[_0x0e8a('0x1f')]=_0x1f53b6[_0x0e8a('0x1f')];this[_0x0e8a('0x20')]=_0x1f53b6[_0x0e8a('0x20')];this[_0x0e8a('0x21')]=_0x1f53b6[_0x0e8a('0x21')];this[_0x0e8a('0x22')]=_0x1f53b6[_0x0e8a('0x22')]||'';this[_0x0e8a('0x23')]=_0x1f53b6[_0x0e8a('0x23')]||'';}module[_0x0e8a('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a22e3ea..758f23f 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 _0x142f=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype'];(function(_0x1ba57f,_0xb81938){var _0x5a7f02=function(_0x32b234){while(--_0x32b234){_0x1ba57f['push'](_0x1ba57f['shift']());}};_0x5a7f02(++_0xb81938);}(_0x142f,0x1cf));var _0xf142=function(_0x5b08f3,_0x40e4ea){_0x5b08f3=_0x5b08f3-0x0;var _0x3cac3e=_0x142f[_0x5b08f3];return _0x3cac3e;};'use strict';var util=require(_0xf142('0x0'));var _=require(_0xf142('0x1'));var moment=require(_0xf142('0x2'));function getSeconds(_0x6d11f7,_0x2ba066){var _0x10b626=moment(_0x6d11f7)['milliseconds'](0x0);var _0x4e99a2=moment(_0x2ba066)[_0xf142('0x3')](0x0);return _0x10b626[_0xf142('0x4')](_0x4e99a2,_0xf142('0x5'));}function Hangup(_0x2f06d5,_0x1800be){this[_0xf142('0x6')]=0x4;this['statedesc']='Answer';this[_0xf142('0x7')]=_0x2f06d5['scheduledat'];this[_0xf142('0x8')]=_0x2f06d5[_0xf142('0x8')];this[_0xf142('0x9')]=_0x2f06d5[_0xf142('0x8')]===_0xf142('0xa')?_0xf142('0xb'):_0x2f06d5[_0xf142('0x8')];this[_0xf142('0xc')]=_0x2f06d5[_0xf142('0xc')];this[_0xf142('0xd')]=_0x2f06d5[_0xf142('0xd')];this[_0xf142('0xe')]=_0x2f06d5['countnoanswerretry'];this[_0xf142('0xf')]=_0x2f06d5[_0xf142('0xc')]+_0x2f06d5[_0xf142('0xd')]+_0x2f06d5[_0xf142('0xe')]+_0x2f06d5[_0xf142('0x10')]+_0x2f06d5['countdropretry']+_0x2f06d5[_0xf142('0x11')]+_0x2f06d5['countmachineretry']+_0x2f06d5[_0xf142('0x12')];this[_0xf142('0x10')]=_0x2f06d5['countnosuchnumberretry'];this[_0xf142('0x13')]=_0x2f06d5[_0xf142('0x13')];this[_0xf142('0x11')]=_0x2f06d5[_0xf142('0x11')];this[_0xf142('0x14')]=_0x2f06d5[_0xf142('0x14')];this[_0xf142('0x12')]=_0x2f06d5[_0xf142('0x12')];this[_0xf142('0x15')]=_0x1800be[_0xf142('0x15')];this[_0xf142('0x16')]=_0x2f06d5[_0xf142('0x17')];this[_0xf142('0x18')]=_0x2f06d5['number'];this[_0xf142('0x19')]=_0x2f06d5[_0xf142('0x19')];this[_0xf142('0x1a')]=_0x2f06d5[_0xf142('0x1a')];this[_0xf142('0x1b')]=moment()[_0xf142('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x2f06d5[_0xf142('0x1a')],_0x2f06d5['starttime']);this[_0xf142('0x1d')]=0x0;this[_0xf142('0x1e')]=getSeconds(this[_0xf142('0x1b')],_0x2f06d5['responsetime']);this[_0xf142('0xb')]=_0x2f06d5[_0xf142('0xb')];this[_0xf142('0x1f')]='IVR';this[_0xf142('0x20')]=_0x1800be['cause-txt'];this[_0xf142('0x21')]=_0x2f06d5[_0xf142('0x21')];this[_0xf142('0x22')]=_0x2f06d5['callbackuniqueid'];this[_0xf142('0x23')]=_0x2f06d5['callbackat'];this[_0xf142('0x24')]=_0x2f06d5[_0xf142('0x24')];this[_0xf142('0x25')]=_0x2f06d5[_0xf142('0x25')];this[_0xf142('0x26')]=_0x2f06d5[_0xf142('0x26')];this['UserId']=_0x2f06d5[_0xf142('0x27')];this[_0xf142('0x28')]=_0x2f06d5['VoiceQueueId'];this[_0xf142('0x29')]=_0x2f06d5[_0xf142('0x29')];}module[_0xf142('0x2a')]=Hangup; \ No newline at end of file +var _0x4be1=['Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4be1,0x1d9));var _0x14be=function(_0x38db3a,_0x244702){_0x38db3a=_0x38db3a-0x0;var _0x2ead95=_0x4be1[_0x38db3a];return _0x2ead95;};'use strict';var util=require(_0x14be('0x0'));var _=require(_0x14be('0x1'));var moment=require(_0x14be('0x2'));function getSeconds(_0x590458,_0x225723){var _0x13d46b=moment(_0x590458)[_0x14be('0x3')](0x0);var _0x572ca2=moment(_0x225723)[_0x14be('0x3')](0x0);return _0x13d46b[_0x14be('0x4')](_0x572ca2,_0x14be('0x5'));}function Hangup(_0x4ec327,_0x3956d6){this[_0x14be('0x6')]=0x4;this['statedesc']=_0x14be('0x7');this[_0x14be('0x8')]=_0x4ec327[_0x14be('0x8')];this[_0x14be('0x9')]=_0x4ec327['type'];this[_0x14be('0xa')]=_0x4ec327[_0x14be('0x9')]===_0x14be('0xb')?_0x14be('0xc'):_0x4ec327['type'];this[_0x14be('0xd')]=_0x4ec327['countbusyretry'];this[_0x14be('0xe')]=_0x4ec327[_0x14be('0xe')];this[_0x14be('0xf')]=_0x4ec327['countnoanswerretry'];this['countglobal']=_0x4ec327['countbusyretry']+_0x4ec327['countcongestionretry']+_0x4ec327[_0x14be('0xf')]+_0x4ec327[_0x14be('0x10')]+_0x4ec327['countdropretry']+_0x4ec327[_0x14be('0x11')]+_0x4ec327[_0x14be('0x12')]+_0x4ec327['countagentrejectretry'];this[_0x14be('0x10')]=_0x4ec327[_0x14be('0x10')];this[_0x14be('0x13')]=_0x4ec327[_0x14be('0x13')];this['countabandonedretry']=_0x4ec327['countabandonedretry'];this['countmachineretry']=_0x4ec327[_0x14be('0x12')];this[_0x14be('0x14')]=_0x4ec327['countagentrejectretry'];this['uniqueid']=_0x3956d6['uniqueid'];this['calleridname']=_0x4ec327['name'];this[_0x14be('0x15')]=_0x4ec327['number'];this['starttime']=_0x4ec327[_0x14be('0x16')];this[_0x14be('0x17')]=_0x4ec327[_0x14be('0x17')];this[_0x14be('0x18')]=moment()[_0x14be('0x19')](_0x14be('0x1a'));this[_0x14be('0x1b')]=getSeconds(_0x4ec327[_0x14be('0x17')],_0x4ec327[_0x14be('0x16')]);this[_0x14be('0x1c')]=0x0;this[_0x14be('0x1d')]=getSeconds(this[_0x14be('0x18')],_0x4ec327[_0x14be('0x17')]);this[_0x14be('0xc')]=_0x4ec327[_0x14be('0xc')];this['membername']='IVR';this['reason']=_0x3956d6[_0x14be('0x1e')];this[_0x14be('0x1f')]=_0x4ec327[_0x14be('0x1f')];this['callbackuniqueid']=_0x4ec327[_0x14be('0x20')];this[_0x14be('0x21')]=_0x4ec327[_0x14be('0x21')];this[_0x14be('0x22')]=_0x4ec327[_0x14be('0x22')];this[_0x14be('0x23')]=_0x4ec327['ContactId'];this[_0x14be('0x24')]=_0x4ec327[_0x14be('0x24')];this[_0x14be('0x25')]=_0x4ec327[_0x14be('0x25')];this[_0x14be('0x26')]=_0x4ec327[_0x14be('0x26')];this[_0x14be('0x27')]=_0x4ec327['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index c9b84bd..66624dc 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 _0x410d=['ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','queue','calleridnum','starttime','responsetime','callback','callbackuniqueid','recallme'];(function(_0x5c172d,_0x1153b5){var _0x561522=function(_0x47f816){while(--_0x47f816){_0x5c172d['push'](_0x5c172d['shift']());}};_0x561522(++_0x1153b5);}(_0x410d,0x66));var _0xd410=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x410d[_0x378b4];return _0x11d07b;};'use strict';var util=require(_0xd410('0x0'));var _=require(_0xd410('0x1'));var moment=require(_0xd410('0x2'));function getSeconds(_0x58f5fb,_0x2e38ef){var _0x49627a=moment(_0x58f5fb)[_0xd410('0x3')](0x0);var _0x295e07=moment(_0x2e38ef)[_0xd410('0x3')](0x0);return _0x49627a[_0xd410('0x4')](_0x295e07,_0xd410('0x5'));}function History(_0x5d19b7){this[_0xd410('0x6')]=_0x5d19b7[_0xd410('0x6')];this[_0xd410('0x7')]=_0x5d19b7[_0xd410('0x7')]||undefined;this[_0xd410('0x8')]=_0x5d19b7[_0xd410('0x8')];this[_0xd410('0x9')]=_0x5d19b7[_0xd410('0x8')]==='outbound'?'queue':_0x5d19b7[_0xd410('0x8')];this[_0xd410('0xa')]=_0x5d19b7[_0xd410('0xa')];this[_0xd410('0xb')]=_0x5d19b7[_0xd410('0xb')];this[_0xd410('0xc')]=_0x5d19b7['countnoanswerretry'];this[_0xd410('0xd')]=_0x5d19b7['countbusyretry']+_0x5d19b7[_0xd410('0xb')]+_0x5d19b7[_0xd410('0xc')]+_0x5d19b7[_0xd410('0xe')]+_0x5d19b7['countdropretry']+_0x5d19b7[_0xd410('0xf')]+_0x5d19b7[_0xd410('0x10')]+_0x5d19b7['countagentrejectretry'];this[_0xd410('0xe')]=_0x5d19b7[_0xd410('0xe')];this[_0xd410('0x11')]=_0x5d19b7['countdropretry'];this[_0xd410('0xf')]=_0x5d19b7['countabandonedretry'];this[_0xd410('0x10')]=_0x5d19b7[_0xd410('0x10')];this[_0xd410('0x12')]=_0x5d19b7[_0xd410('0x12')];this[_0xd410('0x13')]=_0x5d19b7[_0xd410('0x13')];this['calleridname']=_0x5d19b7['name'];this[_0xd410('0x14')]=_0x5d19b7['number'];this[_0xd410('0x15')]=_0x5d19b7[_0xd410('0x15')];this[_0xd410('0x16')]=_0x5d19b7[_0xd410('0x16')];this['endtime']=_0x5d19b7[_0xd410('0x16')];this['ringtime']=getSeconds(_0x5d19b7[_0xd410('0x16')],_0x5d19b7[_0xd410('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0xd410('0x17')]=_0x5d19b7['callback'];this[_0xd410('0x18')]=_0x5d19b7[_0xd410('0x18')];this['callbackat']=_0x5d19b7['callbackat'];this[_0xd410('0x19')]=_0x5d19b7[_0xd410('0x19')];this[_0xd410('0x1a')]=_0x5d19b7['ContactId'];this['ListId']=_0x5d19b7[_0xd410('0x1b')];this[_0xd410('0x1c')]=_0x5d19b7['UserId'];this[_0xd410('0x1d')]=_0x5d19b7[_0xd410('0x1d')];this['CampaignId']=_0x5d19b7['CampaignId'];this[_0xd410('0x1e')]=_0x5d19b7['originatecalleridnum']||'';this[_0xd410('0x1f')]=_0x5d19b7[_0xd410('0x1f')]||'';}module['exports']=History; \ No newline at end of file +var _0x2791=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x2ba2cb,_0x4fac09){var _0x3db708=function(_0x23db21){while(--_0x23db21){_0x2ba2cb['push'](_0x2ba2cb['shift']());}};_0x3db708(++_0x4fac09);}(_0x2791,0x66));var _0x1279=function(_0x3427bc,_0x1ef233){_0x3427bc=_0x3427bc-0x0;var _0x329ea4=_0x2791[_0x3427bc];return _0x329ea4;};'use strict';var util=require(_0x1279('0x0'));var _=require(_0x1279('0x1'));var moment=require(_0x1279('0x2'));function getSeconds(_0x3d5477,_0x2b9c2e){var _0x4c6936=moment(_0x3d5477)[_0x1279('0x3')](0x0);var _0x442595=moment(_0x2b9c2e)[_0x1279('0x3')](0x0);return _0x4c6936[_0x1279('0x4')](_0x442595,'seconds');}function History(_0x213244){this['uniqueid']=_0x213244[_0x1279('0x5')];this[_0x1279('0x6')]=_0x213244[_0x1279('0x6')]||undefined;this['type']=_0x213244[_0x1279('0x7')];this[_0x1279('0x8')]=_0x213244[_0x1279('0x7')]===_0x1279('0x9')?_0x1279('0xa'):_0x213244['type'];this[_0x1279('0xb')]=_0x213244[_0x1279('0xb')];this[_0x1279('0xc')]=_0x213244[_0x1279('0xc')];this[_0x1279('0xd')]=_0x213244[_0x1279('0xd')];this['countglobal']=_0x213244[_0x1279('0xb')]+_0x213244[_0x1279('0xc')]+_0x213244[_0x1279('0xd')]+_0x213244[_0x1279('0xe')]+_0x213244[_0x1279('0xf')]+_0x213244[_0x1279('0x10')]+_0x213244[_0x1279('0x11')]+_0x213244[_0x1279('0x12')];this[_0x1279('0xe')]=_0x213244[_0x1279('0xe')];this[_0x1279('0xf')]=_0x213244[_0x1279('0xf')];this[_0x1279('0x10')]=_0x213244[_0x1279('0x10')];this[_0x1279('0x11')]=_0x213244[_0x1279('0x11')];this[_0x1279('0x12')]=_0x213244['countagentrejectretry'];this[_0x1279('0xa')]=_0x213244[_0x1279('0xa')];this[_0x1279('0x13')]=_0x213244[_0x1279('0x14')];this[_0x1279('0x15')]=_0x213244[_0x1279('0x16')];this[_0x1279('0x17')]=_0x213244[_0x1279('0x17')];this[_0x1279('0x18')]=_0x213244[_0x1279('0x18')];this['endtime']=_0x213244[_0x1279('0x18')];this['ringtime']=getSeconds(_0x213244[_0x1279('0x18')],_0x213244[_0x1279('0x17')]);this[_0x1279('0x19')]=0x0;this[_0x1279('0x1a')]=0x0;this[_0x1279('0x1b')]=_0x213244['callback'];this[_0x1279('0x1c')]=_0x213244[_0x1279('0x1c')];this[_0x1279('0x1d')]=_0x213244[_0x1279('0x1d')];this['recallme']=_0x213244[_0x1279('0x1e')];this[_0x1279('0x1f')]=_0x213244[_0x1279('0x1f')];this['ListId']=_0x213244[_0x1279('0x20')];this[_0x1279('0x21')]=_0x213244['UserId'];this['VoiceQueueId']=_0x213244['VoiceQueueId'];this['CampaignId']=_0x213244[_0x1279('0x22')];this[_0x1279('0x23')]=_0x213244['originatecalleridnum']||'';this[_0x1279('0x24')]=_0x213244[_0x1279('0x24')]||'';}module[_0x1279('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index e589c2f..862ac4f 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 _0x57b3=['predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','type','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','---------------------------','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','erlangBusyFactor','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','endtime','starttime','clearZombieChannels','[uniqueid]','actions','Action','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','resolve','then','countReScheduled','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','isSuccess','isTrunkReachable','SIP/%s','status','reachable','unmonitored','uniqueid','isNil','variable','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','statedesc','[syncHangupInAMDIvr][createHistory]','countbusyretry','countcongestionretry','countnoanswerretry','dialMachineMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','syncAgentComplete','reason','agent','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','roundrobin','locked','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','_rr','paused','unlockRR','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','checkDialMethod','progressive','predictive','booked','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','checkIsTrunkReachable','dialGlobalInterval','[syncQueueSummary]','[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','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','log','buildObj','nosuchnumber','custom:status_nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','NO\x20ANSWER\x20evt','NO\x20ANSWER\x20action','NO\x20ANSWER\x20history','EMITTING\x20status_noanswer\x20for','noanswer','custom:status_noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','EMITTING\x20status_busy\x20for','busy','custom:status_busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','dialOrderByScheduledAt','dialLimitQueue','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[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','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]','Ts\x20=\x20','p\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','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','diff','emit','answered','available','loggedIn','sumBillable','sumDuration','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout'];(function(_0x4432f2,_0x22697a){var _0x1c97d6=function(_0x1ab5df){while(--_0x1ab5df){_0x4432f2['push'](_0x4432f2['shift']());}};_0x1c97d6(++_0x22697a);}(_0x57b3,0x1ad));var _0x357b=function(_0x31230d,_0x127ab1){_0x31230d=_0x31230d-0x0;var _0x9bc518=_0x57b3[_0x31230d];return _0x9bc518;};'use strict';var util=require('util');var _=require(_0x357b('0x0'));var BPromise=require(_0x357b('0x1'));var uuid=require(_0x357b('0x2'));var moment=require(_0x357b('0x3'));var rr=require('rr');var md5=require(_0x357b('0x4'));var Redis=require('ioredis');var ut=require(_0x357b('0x5'));var config=require(_0x357b('0x6'));var logger=require(_0x357b('0x7'))(_0x357b('0x8'));var loggerBooked=require(_0x357b('0x7'))('booked');var loggerPredictive=require(_0x357b('0x7'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x357b('0x9'));var loggerSyncQueueSummary=require(_0x357b('0x7'))(_0x357b('0xa'));var ami=require('../ami');config[_0x357b('0xb')]=_[_0x357b('0xc')](config[_0x357b('0xb')],{'host':_0x357b('0xd'),'port':0x18eb});var io=require(_0x357b('0xe'))(new Redis(config[_0x357b('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x357b('0xf'));var cmHopperHistory=require(_0x357b('0x10'));var cmHopperBlack=require(_0x357b('0x11'));var voiceQueueRt=require(_0x357b('0x12'));var Action=require('./action');var History=require(_0x357b('0x13'));var Final=require(_0x357b('0x14'));var AgentComplete=require(_0x357b('0x15'));var QueueCallerAbandon=require(_0x357b('0x16'));var Hangup=require(_0x357b('0x17'));var ipAgi=process[_0x357b('0x18')][_0x357b('0x19')]||_0x357b('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x357b('0x1b')][_0x357b('0x1c')]=function(_0x2795cf){this[_0x357b('0x1d')]=this[_0x357b('0x1d')]?this['tail'][_0x357b('0x1e')](_0x2795cf):_0x2795cf();};function Dialer(_0x176159,_0x27d4f8){this['sequence']=new Sequence();this[_0x357b('0x1f')]=_0x27d4f8;this[_0x357b('0x20')]=_0x176159[_0x357b('0x20')];this['campaigns']=_0x176159[_0x357b('0x21')];this[_0x357b('0x22')]=_0x176159[_0x357b('0x22')];this[_0x357b('0x23')]=_0x176159[_0x357b('0x23')];this[_0x357b('0x24')]=config[_0x357b('0x24')]||0x2;this[_0x357b('0x25')]={};this['actions']={};this[_0x357b('0x26')]={};this[_0x357b('0x27')]={};this[_0x357b('0x28')]={};this[_0x357b('0x29')]={};this[_0x357b('0x2a')]={};this[_0x357b('0x2b')]={};this[_0x357b('0x2c')]={};this[_0x357b('0x2d')]={};ami['on']('agentconnect',this[_0x357b('0x2e')][_0x357b('0x2f')](this));ami['on'](_0x357b('0x30'),this[_0x357b('0x31')][_0x357b('0x2f')](this));ami['on'](_0x357b('0x32'),this[_0x357b('0x33')][_0x357b('0x2f')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x357b('0x2f')](this));ami['on'](_0x357b('0x34'),this[_0x357b('0xa')]['bind'](this));ami['on']('hangup',this[_0x357b('0x35')][_0x357b('0x2f')](this));ami['on'](_0x357b('0x36'),this[_0x357b('0x37')][_0x357b('0x2f')](this));ami['on'](_0x357b('0x38'),this[_0x357b('0x39')][_0x357b('0x2f')](this));ami['on'](_0x357b('0x3a'),this[_0x357b('0x3b')][_0x357b('0x2f')](this));ami['on'](_0x357b('0x3c'),this[_0x357b('0x3d')][_0x357b('0x2f')](this));this['loopCampaigns']();this[_0x357b('0x3e')]();}function isNotNull(_0x5773c9){return _0x5773c9!==null&&!_[_0x357b('0x3f')](_0x5773c9);}function checkIsLoggedIn(_0x112df1,_0x351e62){return function(){if(_0x351e62<=0x0){_0x112df1['message']=_0x357b('0x40');throw _0x112df1[_0x357b('0x41')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x105fb8){return _0x105fb8;}function checkIsActive(_0x54bde1,_0x12862c){return function(){if(!isActive(_0x12862c)){_0x54bde1[_0x357b('0x42')]=_0x357b('0x43');throw _0x54bde1['name']+_0x357b('0x44');}};}function checkInterval(_0x9ad922){return function(){if(!isNotNull(_0x9ad922[_0x357b('0x45')])){_0x9ad922[_0x357b('0x42')]=_0x357b('0x46');throw _0x9ad922[_0x357b('0x41')]+_0x357b('0x47');}if(!isNotNull(_0x9ad922['Interval'][_0x357b('0x48')])){_0x9ad922[_0x357b('0x42')]=_0x357b('0x46');throw _0x9ad922[_0x357b('0x41')]+_0x357b('0x47');}if(!isNotNull(_[_0x357b('0x49')](_0x9ad922[_0x357b('0x45')]['Intervals']))){_0x9ad922[_0x357b('0x42')]=_0x357b('0x46');throw _0x9ad922[_0x357b('0x41')]+_0x357b('0x47');}};}function msgResponse(_0x55f819,_0x3b9de1,_0x5e28b7){return{'action':_0x55f819,'response':_0x3b9de1,'message':_0x5e28b7,'stack':_0x5e28b7};}function myreject(_0x20707d){return function(_0xb67fe){return _0x20707d(msgResponse('[ifTime][Action]',_0x357b('0x4a'),JSON[_0x357b('0x4b')](_0xb67fe)));};}function getSeconds(_0x508fa8,_0x5944ab){var _0x2a6751=moment(_0x508fa8)[_0x357b('0x4c')](0x0);var _0x582aed=moment(_0x5944ab)['milliseconds'](0x0);return _0x2a6751[_0x357b('0x4d')](_0x582aed,'seconds');}function emit(_0x4bf2f9,_0x1dae74,_0x1a0f3a){io['to'](_0x4bf2f9)[_0x357b('0x4e')](_0x1dae74,_0x1a0f3a);}function emitVoiceQueueSummary(_0x53c607){if(_0x53c607['type']==='outbound'){var _0x48d956={'id':_0x53c607['id'],'name':_0x53c607[_0x357b('0x41')],'strategy':_0x53c607['strategy'],'answered':_0x53c607[_0x357b('0x4f')],'available':_0x53c607[_0x357b('0x50')],'loggedIn':_0x53c607[_0x357b('0x51')],'pTalking':_0x53c607['pTalking'],'sumBillable':_0x53c607[_0x357b('0x52')],'sumDuration':_0x53c607[_0x357b('0x53')],'sumHoldTime':_0x53c607['sumHoldTime']||0x0,'talking':_0x53c607['talking'],'total':_0x53c607[_0x357b('0x54')],'type':_0x53c607['type'],'unmanaged':_0x53c607[_0x357b('0x55')],'abandoned':_0x53c607[_0x357b('0x56')],'waiting':_0x53c607[_0x357b('0x57')],'loggedInDb':_0x53c607['loggedInDb'],'dialActive':_0x53c607['dialActive'],'dialMethod':_0x53c607[_0x357b('0x58')],'dialOriginateCallerIdName':_0x53c607['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x53c607[_0x357b('0x59')],'dialOriginateTimeout':_0x53c607['dialOriginateTimeout'],'dialPrefix':_0x53c607['dialPrefix'],'outboundAnswerAgiCallsDay':_0x53c607['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x53c607[_0x357b('0x5a')],'outboundBlacklistCallsDay':_0x53c607[_0x357b('0x5b')],'outboundBusyCallsDay':_0x53c607[_0x357b('0x5c')],'outboundCongestionCallsDay':_0x53c607[_0x357b('0x5d')],'outboundDropCallsDayACS':_0x53c607[_0x357b('0x5e')],'outboundDropCallsDayCallersExit':_0x53c607[_0x357b('0x5f')],'outboundDropCallsDayTimeout':_0x53c607['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x53c607[_0x357b('0x60')],'outboundNoSuchCallsDay':_0x53c607[_0x357b('0x61')],'outboundOriginateFailureCallsDay':_0x53c607['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x53c607[_0x357b('0x62')],'outboundRejectCallsDay':_0x53c607['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x53c607['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x53c607[_0x357b('0x63')],'predictiveIntervalAvgHoldtime':_0x53c607[_0x357b('0x64')],'predictiveIntervalAvgTalktime':_0x53c607['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x53c607['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x53c607[_0x357b('0x65')],'predictiveIntervalErlangCalls':_0x53c607[_0x357b('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x53c607[_0x357b('0x67')],'predictiveIntervalHitRate':_0x53c607[_0x357b('0x68')],'predictiveIntervalMultiplicativeFactor':_0x53c607[_0x357b('0x69')],'predictiveIntervalPauses':_0x53c607['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x53c607[_0x357b('0x6a')],'predictiveIntervalTotalCalls':_0x53c607['predictiveIntervalTotalCalls'],'message':_0x53c607[_0x357b('0x42')],'originated':_0x53c607[_0x357b('0x6b')],'erlangCalls':_0x53c607[_0x357b('0x6c')],'erlangCallToSecond':_0x53c607[_0x357b('0x6d')],'erlangAbandonmentRate':_0x53c607[_0x357b('0x6e')],'erlangBusyFactor':_0x53c607['erlangBusyFactor'],'startPredictive':_0x53c607['startPredictive'],'startProgressive':_0x53c607[_0x357b('0x2a')]};if(_0x53c607['Trunk']){_0x48d956['Trunk']={'id':_0x53c607[_0x357b('0x6f')]['id'],'name':_0x53c607['Trunk']['name'],'active':_0x53c607['Trunk'][_0x357b('0x70')],'callerid':_0x53c607[_0x357b('0x6f')][_0x357b('0x71')]};}if(_0x53c607[_0x357b('0x45')]){_0x48d956[_0x357b('0x45')]={'id':_0x53c607[_0x357b('0x45')]['id'],'name':_0x53c607['Interval']['name']};}var _0x36f5a9=md5(JSON[_0x357b('0x4b')](_0x48d956));if(_0x53c607[_0x357b('0x4')]!==_0x36f5a9){_0x53c607[_0x357b('0x4')]=_0x36f5a9;emit(util[_0x357b('0x72')](_0x357b('0x73'),_0x48d956['name']),_0x357b('0x74'),_0x48d956);}}}function emitCampaignSummary(_0x5b2bcd){if(_0x5b2bcd[_0x357b('0x75')]==='ivr'){emit(util[_0x357b('0x72')]('campaign:ivr:%s',_0x5b2bcd[_0x357b('0x41')]),_0x357b('0x76'),_0x5b2bcd);}}function checkGetDataPredictive(_0x99d83d){if(isNotNull(_0x99d83d)){if(!_[_0x357b('0x49')](_0x99d83d)){loggerPredictive[_0x357b('0x77')](_0x357b('0x78'));loggerPredictive[_0x357b('0x77')](_0x357b('0x79'),_0x99d83d[_0x357b('0x7a')]);loggerPredictive[_0x357b('0x77')](_0x357b('0x7b'),_0x99d83d['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x357b('0x77')](_0x357b('0x7c'),_0x99d83d[_0x357b('0x65')]);loggerPredictive[_0x357b('0x77')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x99d83d[_0x357b('0x7d')]);loggerPredictive[_0x357b('0x77')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x99d83d['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x357b('0x77')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x99d83d[_0x357b('0x7e')]);loggerPredictive[_0x357b('0x77')](_0x357b('0x7f'));if(_0x99d83d[_0x357b('0x7a')]>0x0){if(!_['isUndefined'](_0x99d83d[_0x357b('0x7e')])&&_0x99d83d[_0x357b('0x7e')]>0x0){return!![];}else{loggerPredictive[_0x357b('0x77')](_0x357b('0x80'));}if(!_[_0x357b('0x3f')](_0x99d83d['predictiveIntervalAvgHoldtime'])&&_0x99d83d[_0x357b('0x64')]>0x0){return!![];}else{loggerPredictive[_0x357b('0x77')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x357b('0x81'));}}else{loggerPredictive[_0x357b('0x77')](_0x357b('0x81'));}return![];}function mergeDataErlangB(_0xe3adfc){return function(_0x29f2d8){loggerPredictive[_0x357b('0x77')](_0x357b('0x82'));loggerPredictive['info'](_0x357b('0x83'),_0x29f2d8[_0x357b('0x6c')]);loggerPredictive[_0x357b('0x77')](_0x357b('0x84'),_0x29f2d8[_0x357b('0x6d')]);loggerPredictive[_0x357b('0x77')](_0x357b('0x85'),_0x29f2d8['erlangAbandonmentRate']);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x29f2d8[_0x357b('0x86')]);loggerPredictive[_0x357b('0x77')](_0x357b('0x85'),_0x29f2d8[_0x357b('0x6e')]);loggerPredictive['info'](_0x357b('0x7f'));_[_0x357b('0x87')](_0xe3adfc,_0x29f2d8);};}function getDiff(_0x56b8cf){var _0x2c687d=moment()[_0x357b('0x4c')](0x0);var _0x1600e5=moment(_0x56b8cf)[_0x357b('0x4c')](0x0);return _0x2c687d[_0x357b('0x4d')](_0x1600e5,_0x357b('0x88'));}function ifInterval(_0x1e5511,_0x2608a1){if(_[_0x357b('0x3f')](_0x2608a1)){return![];}if(getDiff(_0x2608a1)<_0x1e5511*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xc0cba8){if(isNotNull(_0xc0cba8)){if(!_[_0x357b('0x3f')](_0xc0cba8[_0x357b('0x2a')])){_0xc0cba8[_0x357b('0x2a')]=undefined;loggerPredictive['info'](_0xc0cba8[_0x357b('0x41')],_0x357b('0x89'));}if(!_[_0x357b('0x3f')](_0xc0cba8[_0x357b('0x29')])){_0xc0cba8[_0x357b('0x29')]=undefined;loggerPredictive['info'](_0xc0cba8['name'],_0x357b('0x8a'));}if(!_[_0x357b('0x3f')](_0xc0cba8[_0x357b('0x8b')])){clearInterval(_0xc0cba8[_0x357b('0x8b')]);_0xc0cba8['handlePredictive']=undefined;loggerPredictive['info'](_0xc0cba8[_0x357b('0x41')],_0x357b('0x8c'));}}}function erlangb(_0x305492,_0x2518b2){if(_0x2518b2===0x0){return 0x0;}var _0x425152=0x1;for(var _0x12ada4=0x1;_0x12ada4<=_0x2518b2;_0x12ada4+=0x1){_0x425152=0x1+_0x425152*_0x12ada4/_0x305492;}return 0x1/_0x425152;}function isVoiceQueueOutbound(_0x4e05b8){return _0x4e05b8===_0x357b('0x8d');}function isNotPreview(_0x5b7d85){return _0x5b7d85!==_0x357b('0x1f');}function isCampaignIvr(_0x5e1961){return _0x5e1961===_0x357b('0x8e');}function getCallerId(_0x16fb6f,_0x5246ad,_0x4625ee){if(!_[_0x357b('0x3f')](_0x4625ee)&&_0x357b('0x8f')===typeof _0x4625ee&&!_[_0x357b('0x49')](_0x4625ee)){if(!_[_0x357b('0x3f')](_0x5246ad)&&'string'===typeof _0x5246ad&&!_['isEmpty'](_0x5246ad)){return util['format'](_0x357b('0x90'),_0x5246ad,_0x4625ee);}return util[_0x357b('0x72')](_0x357b('0x90'),_0x4625ee,_0x4625ee);}if(!_['isUndefined'](_0x16fb6f)&&'string'===typeof _0x16fb6f&&!_[_0x357b('0x49')](_0x16fb6f)){return _0x16fb6f;}return _0x357b('0x91');}function loggerCatchQueueSummary(_0x51460f,_0x47506c){return function(_0x2e99ca){freeVariablesPredictive(_0x47506c);emitVoiceQueueSummary(_0x47506c);emitCampaignSummary(_0x47506c);loggerSyncQueueSummary['error'](_0x51460f,util[_0x357b('0x92')](_0x2e99ca,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x10da87,_0x56296b){return function(_0x19a9df){loggerPredictive['error'](_0x56296b[_0x357b('0x41')],_0x10da87);loggerPredictive['error'](_0x19a9df['stack']);freeVariablesPredictive(_0x56296b);};}function loggerCatch(_0x26a103){return function(_0x6adc4c){logger[_0x357b('0x93')](_0x26a103,util[_0x357b('0x92')](_0x6adc4c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5d8230){return _0x5d8230&&!_[_0x357b('0x3f')](_0x5d8230)&&_0x5d8230[_0x357b('0x94')]>0x0;}function decremetOriginate(_0x153528){if(!_[_0x357b('0x3f')](_0x153528)&&_0x153528!==null){if(_0x153528[_0x357b('0x95')](_0x357b('0x6b'))){if(_0x153528['originated']>0x0){_0x153528[_0x357b('0x6b')]-=0x1;}else{logger[_0x357b('0x93')](_0x357b('0x96'));}}}else{logger[_0x357b('0x93')](_0x357b('0x97'));}}function checkContactLowerLimitOriginate(_0xeae6c5,_0x43e8b2,_0x159fc1){if(_0x43e8b2>_0x159fc1){for(var _0xf43c64=0x0;_0xf43c64<_0x43e8b2-_0x159fc1;_0xf43c64+=0x1){decremetOriginate(_0xeae6c5);}}}function loggerGetContactDialer(_0x407964,_0x450bec,_0x172921){return function(_0x1f8b88){checkContactLowerLimitOriginate(_0x450bec,_0x172921,0x0);logger['error'](_0x407964,util['inspect'](_0x1f8b88,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x196d52){return function(_0x9d8d25){if(isNotNull(_0x9d8d25)&&isNotNull(_0x9d8d25[0x0])){if(_0x9d8d25[0x0]['contactsRescheduled']>0x0){_0x196d52['message']=_0x357b('0x98');logger['info'](_0x357b('0x99')+_0x196d52[_0x357b('0x41')],_0x9d8d25[0x0][_0x357b('0x9a')],'contacts');}else{_0x196d52[_0x357b('0x42')]=_0x357b('0x9b');logger['info'](_0x357b('0x9c')+_0x196d52[_0x357b('0x41')]);}}};}function notSendMessagesQueue(_0x529310){if(_0x529310[_0x357b('0x9d')]){freeVariablesPredictive(_0x529310);if(_0x529310[_0x357b('0x6b')]===0x0&&_0x529310[_0x357b('0x9e')]===0x0&&_0x529310[_0x357b('0x57')]===0x0&&(_0x529310[_0x357b('0x9f')]||0x0)===0x0){_0x529310[_0x357b('0x9d')]=![];_0x529310[_0x357b('0x50')]=0x0;_0x529310[_0x357b('0x42')]=_0x357b('0x43');loggerSyncQueueSummary[_0x357b('0x93')](_0x357b('0xa0'),_0x529310[_0x357b('0x41')],_0x357b('0xa1'));}else{_0x529310['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x357b('0x93')](_0x357b('0xa0'),_0x529310[_0x357b('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0x529310);}}function notSendMessagesCampaign(_0x37541a){if(_0x37541a[_0x357b('0x9d')]){if(_0x37541a[_0x357b('0x6b')]===0x0){_0x37541a[_0x357b('0x9d')]=![];_0x37541a[_0x357b('0x42')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x357b('0x93')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x37541a[_0x357b('0x41')],_0x357b('0xa1'));}else{_0x37541a[_0x357b('0x42')]=_0x357b('0xa2');loggerSyncQueueSummary[_0x357b('0x93')](_0x357b('0xa3'),_0x37541a['name'],_0x357b('0xa4'));}emitCampaignSummary(_0x37541a);}}function createObjHistory(_0x5f5b53,_0xa55414,_0x1847a0,_0x508260,_0x31bf2e){_0x5f5b53[_0x357b('0x42')]=_0x1847a0;var _0xa8441c=new Action(_0x5f5b53,_0xa55414);var _0x507e0b=new History(_0xa8441c);_0x507e0b[_0x357b('0xa5')]=_0x508260;_0x507e0b['statedesc']=_0x31bf2e;_0x507e0b[_0x357b('0xa6')]=_0xa8441c[_0x357b('0xa7')];return _0x507e0b;}Dialer['prototype'][_0x357b('0x3e')]=function(){var _0x224efc=this;setInterval(function(){_0x224efc[_0x357b('0xa8')](_0x224efc[_0x357b('0x27')],_0x357b('0xa9'));_0x224efc[_0x357b('0xa8')](_0x224efc[_0x357b('0xaa')],'[actions]');},0x32c8);};Dialer[_0x357b('0x1b')][_0x357b('0xa8')]=function(_0x48e93c,_0x46dde6){var _0x8010ac=this;for(var _0x559dba in _0x48e93c){if(_0x48e93c[_0x357b('0x95')](_0x559dba)){this['sequence'][_0x357b('0x1c')](function(){if(!_['isNil'](_0x48e93c[_0x559dba])){return ami[_0x357b('0xab')]({'action':'status','channel':_0x48e93c[_0x559dba][_0x357b('0xac')]})[_0x357b('0xad')](function(_0x38ba25){if(_0x38ba25[_0x357b('0x42')]===_0x357b('0xae')){setTimeout(function(){if(_0x48e93c[_0x559dba]&&_0x48e93c[_0x559dba][_0x357b('0x75')]!==_0x357b('0x8e')){_0x8010ac[_0x357b('0xaf')](_0x8010ac['voiceQueues'][_0x48e93c[_0x559dba][_0x357b('0xb0')]]);logger['error'](_0x357b('0xb1'),_0x46dde6,_0x559dba,_0x48e93c[_0x559dba][_0x357b('0xb0')]);delete _0x48e93c[_0x559dba];}if(_0x48e93c[_0x559dba]&&_0x48e93c[_0x559dba]['type']===_0x357b('0x8e')){_0x8010ac[_0x357b('0xaf')](_0x8010ac['campaigns'][_0x48e93c[_0x559dba][_0x357b('0xb0')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x46dde6,_0x559dba,_0x48e93c[_0x559dba][_0x357b('0xb0')]);delete _0x48e93c[_0x559dba];}},0x2328);}});}});}}};Dialer[_0x357b('0x1b')]['countReScheduled']=function(_0xee3202){return BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](cmHopper[_0x357b('0xb4')](_0xee3202))[_0x357b('0xad')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x357b('0x1b')]['checkIsBlackList']=function(_0x11a081){return BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](cmHopperBlack[_0x357b('0xb5')](_0x11a081))[_0x357b('0xad')](loggerCatch(_0x357b('0xb6')));};Dialer[_0x357b('0x1b')][_0x357b('0xb7')]=function(_0x93c222){return BPromise['resolve']()['then'](cmHopperBlack[_0x357b('0xb7')](_0x93c222))[_0x357b('0xad')](loggerCatch(_0x357b('0xb8')));};Dialer['prototype'][_0x357b('0xb9')]=function(_0x297c54){return BPromise[_0x357b('0xb2')]()['then'](cmHopperHistory[_0x357b('0xba')](_0x297c54))['catch'](loggerCatch(_0x357b('0xbb')));};Dialer[_0x357b('0x1b')][_0x357b('0xbc')]=function(_0x911a0c){return BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](cmHopper[_0x357b('0xbc')](_0x911a0c))[_0x357b('0xad')](loggerCatch(_0x357b('0xbd')));};Dialer[_0x357b('0x1b')][_0x357b('0xbe')]=function(_0x320dcc,_0xdc5f60,_0x1a2aac){return BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](cmHopper[_0x357b('0xbe')](_0x320dcc,_0xdc5f60,_0x1a2aac))['catch'](loggerCatch(_0x357b('0xbf')));};Dialer[_0x357b('0x1b')]['getContactDialer']=function(_0x858402,_0x402efb,_0x57892c,_0x494137){return BPromise['resolve']()['then'](cmHopper[_0x357b('0xc0')](_0x858402,_0x402efb,_0x57892c,_0x494137))[_0x357b('0xad')](loggerCatch(_0x357b('0xc1')));};Dialer[_0x357b('0x1b')][_0x357b('0xc2')]=function(_0x35468b,_0x1d429c,_0x453781){return BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](cmHopper['getContactDialerIvr'](_0x35468b,_0x1d429c,_0x453781))[_0x357b('0xad')](loggerCatch(_0x357b('0xc1')));};Dialer[_0x357b('0x1b')][_0x357b('0xc3')]=function(_0x4e71bd){return BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](voiceQueueRt[_0x357b('0xc3')](_0x4e71bd))[_0x357b('0xad')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x357b('0x1b')][_0x357b('0xc4')]=function(_0x117b83){return BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](cmHopper[_0x357b('0xc4')](_0x117b83))[_0x357b('0xad')](loggerCatch(_0x357b('0xc5')));};Dialer[_0x357b('0x1b')][_0x357b('0xc6')]=function(_0x13b6e1){return BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](cmHopperHistory['createHistory'](_0x13b6e1))[_0x357b('0xad')](loggerCatch(_0x357b('0xc7')));};Dialer[_0x357b('0x1b')]['updateOriginated']=function(_0x3e08cc){if(!_[_0x357b('0x3f')](_0x3e08cc)&&_0x3e08cc!==null){if(_0x3e08cc['hasOwnProperty'](_0x357b('0x6b'))){if(_0x3e08cc[_0x357b('0x6b')]>0x0){_0x3e08cc['originated']-=0x1;}else{logger[_0x357b('0x93')](_0x357b('0xc8'));}}}else{logger[_0x357b('0x93')](_0x357b('0xc9'));}};Dialer[_0x357b('0x1b')][_0x357b('0xca')]=function(_0x5c2731,_0x1cabac){var _0xcf351e=this;return function(_0x38c05d){_0xcf351e[_0x357b('0xaf')](_0x1cabac);logger[_0x357b('0x93')](_0x5c2731,util['inspect'](_0x38c05d,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x3cf490,_0x516700,_0x143a5f){var _0x1550c1={'state':0x19,'statedesc':_0x357b('0xcb')};this['updateOriginated'](_0x516700);this[_0x357b('0xcc')](_[_0x357b('0x87')](_0x1550c1,_[_0x357b('0xcd')](_0x143a5f,[_0x357b('0xce'),_0x357b('0xcf'),_0x357b('0xd0'),_0x357b('0xd1'),_0x357b('0xd2')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x3cf490);};Dialer['prototype'][_0x357b('0xd3')]=function(_0x376793){return _0x376793==='Success';};Dialer['prototype'][_0x357b('0xd4')]=function(_0x61b5a4){return!_[_0x357b('0x3f')](_0x61b5a4)&&_0x61b5a4&&!_['isUndefined'](_0x61b5a4['name'])&&!_['isUndefined'](_0x61b5a4[_0x357b('0x70')])&&_0x61b5a4[_0x357b('0x70')]&&(this['trunks'][util[_0x357b('0x72')](_0x357b('0xd5'),_0x61b5a4[_0x357b('0x41')])][_0x357b('0xd6')]===_0x357b('0xd7')||this[_0x357b('0x23')][util[_0x357b('0x72')]('SIP/%s',_0x61b5a4[_0x357b('0x41')])]['status']===_0x357b('0xd8'));};Dialer['prototype'][_0x357b('0xcc')]=function(_0xe8f826,_0x7f557d,_0xb65757){this[_0x357b('0xc6')](_0xe8f826)[_0x357b('0xad')](loggerCatch(_0x7f557d));this[_0x357b('0xc4')](_0xe8f826)[_0x357b('0xad')](loggerCatch(_0xb65757));};Dialer['prototype'][_0x357b('0x39')]=function(_0x36fb37){var _0x5e611e=this[_0x357b('0x27')][_0x36fb37[_0x357b('0xd9')]];var _0x255c89;if(!_[_0x357b('0xda')](_0x36fb37)&&!_['isNil'](_0x36fb37[_0x357b('0xdb')])&&!_[_0x357b('0xda')](_0x36fb37['variable']['amdstatus'])&&_0x36fb37['exten']===_0x357b('0xdc')&&_0x5e611e){if(_0x5e611e['type']!==_0x357b('0x8e')&&this[_0x357b('0x20')][_0x5e611e[_0x357b('0xb0')]][_0x357b('0xdd')]&&_0x36fb37[_0x357b('0xde')]===_0x357b('0xdf')){delete this[_0x357b('0x27')][_0x36fb37[_0x357b('0xd9')]];this[_0x357b('0xaf')](this['voiceQueues'][_0x5e611e[_0x357b('0xb0')]]);this[_0x357b('0x20')][_0x5e611e[_0x357b('0xb0')]]['outboundAnswerCallsDay']+=0x1;this[_0x357b('0x20')][_0x5e611e[_0x357b('0xb0')]][_0x357b('0xe0')]+=0x1;_0x255c89=new Hangup(_0x5e611e,_0x36fb37);_0x255c89[_0x357b('0xa5')]=0x12;_0x255c89['statedesc']=_0x357b('0xe1');_0x255c89[_0x357b('0xe2')]=_0x357b('0xe3');this[_0x357b('0xcc')](_0x255c89,_0x357b('0xe4'),'[syncHangupInAMD]');}if(_0x5e611e[_0x357b('0x75')]!==_0x357b('0x8e')&&this['voiceQueues'][_0x5e611e[_0x357b('0xb0')]][_0x357b('0xdd')]&&_0x36fb37[_0x357b('0xde')]===_0x357b('0xe5')){var _0x3d9d7e=this;return new BPromise(function(_0x3aefaa,_0x2de52b){delete _0x3d9d7e['uniqueId'][_0x36fb37[_0x357b('0xd9')]];_0x3d9d7e[_0x357b('0xaf')](_0x3d9d7e[_0x357b('0x20')][_0x5e611e[_0x357b('0xb0')]]);_0x3d9d7e[_0x357b('0x20')][_0x5e611e[_0x357b('0xb0')]][_0x357b('0x5a')]+=0x1;_0x3d9d7e[_0x357b('0x20')][_0x5e611e['queue']][_0x357b('0xe0')]+=0x1;var _0x1647cb=_0x3d9d7e[_0x357b('0x20')][_0x5e611e[_0x357b('0xb0')]];var _0x437275=new Hangup(_0x5e611e,_0x36fb37);_0x437275['state']=0x13;_0x437275['statedesc']=_0x357b('0xe6');_0x437275[_0x357b('0xe2')]=_0x357b('0xe3');_0x437275[_0x357b('0xe7')]+=0x1;_0x437275[_0x357b('0xe8')]+=0x1;_0x437275[_0x357b('0xe9')]=!![];_0x3d9d7e[_0x357b('0xc6')](_0x437275)[_0x357b('0xad')](loggerCatch(_0x357b('0xea')));if(_0x437275['countbusyretry']+_0x437275['countcongestionretry']+_0x437275['countnoanswerretry']+_0x437275[_0x357b('0xeb')]+_0x437275[_0x357b('0xec')]+_0x437275[_0x357b('0xed')]+_0x437275[_0x357b('0xe7')]+_0x437275['countagentrejectretry']>=_0x1647cb[_0x357b('0xee')]){_0x3d9d7e[_0x357b('0xef')](_0x437275,_0x3aefaa,_0x2de52b,_0x357b('0xf0'));}else{if(_0x437275[_0x357b('0xe7')]>=_0x1647cb['dialMachineMaxRetry']){_0x3d9d7e[_0x357b('0xf1')](_0x437275,_0x3aefaa,_0x2de52b,_0x357b('0xf2'));}else{_0x3d9d7e[_0x357b('0xbc')]({'active':![],'countmachineretry':_0x437275['countmachineretry'],'scheduledat':moment()[_0x357b('0xf3')](_0x1647cb[_0x357b('0xf4')],_0x357b('0xf5'))[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x437275[_0x357b('0xce')],'ListId':_0x437275[_0x357b('0xcf')],'VoiceQueueId':_0x437275[_0x357b('0xd1')]||undefined,'CampaignId':_0x437275[_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0xf7')));_0x3aefaa({'reschedule':0x1});}}});}if(_0x5e611e[_0x357b('0x75')]===_0x357b('0x8e')&&this[_0x357b('0x21')][_0x5e611e['queue']]['dialAMDActive']&&_0x36fb37['value']==='HANGUP'){delete this['uniqueId'][_0x36fb37[_0x357b('0xd9')]];this['updateOriginated'](this[_0x357b('0x21')][_0x5e611e[_0x357b('0xb0')]]);_0x255c89=new Hangup(_0x5e611e,_0x36fb37);_0x255c89[_0x357b('0xa5')]=0x12;_0x255c89[_0x357b('0xf8')]='HangupInAMD';_0x255c89[_0x357b('0xe2')]=_0x357b('0xe3');this[_0x357b('0xcc')](_0x255c89,_0x357b('0xf9'),'[syncHangupInAMDIvr]');}if(_0x5e611e['type']===_0x357b('0x8e')&&this['campaigns'][_0x5e611e[_0x357b('0xb0')]][_0x357b('0xdd')]&&_0x36fb37[_0x357b('0xde')]===_0x357b('0xe5')){var _0x3d9d7e=this;return new BPromise(function(_0x19cc7c,_0x138cf4){delete _0x3d9d7e[_0x357b('0x27')][_0x36fb37['uniqueid']];_0x3d9d7e[_0x357b('0xaf')](_0x3d9d7e[_0x357b('0x21')][_0x5e611e[_0x357b('0xb0')]]);_0x3d9d7e['campaigns'][_0x5e611e['queue']][_0x357b('0x5a')]+=0x1;_0x3d9d7e[_0x357b('0x21')][_0x5e611e[_0x357b('0xb0')]][_0x357b('0xe0')]+=0x1;var _0x4212b6=_0x3d9d7e['campaigns'][_0x5e611e['queue']];var _0x5c8131=new Hangup(_0x5e611e,_0x36fb37);_0x5c8131[_0x357b('0xa5')]=0x13;_0x5c8131['statedesc']='Machine';_0x5c8131[_0x357b('0xe2')]=_0x357b('0xe3');_0x5c8131[_0x357b('0xe7')]+=0x1;_0x5c8131[_0x357b('0xe8')]+=0x1;_0x5c8131[_0x357b('0xe9')]=!![];_0x3d9d7e['createHistory'](_0x5c8131)[_0x357b('0xad')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5c8131[_0x357b('0xfa')]+_0x5c8131[_0x357b('0xfb')]+_0x5c8131[_0x357b('0xfc')]+_0x5c8131[_0x357b('0xeb')]+_0x5c8131['countdropretry']+_0x5c8131[_0x357b('0xed')]+_0x5c8131[_0x357b('0xe7')]+_0x5c8131['countagentrejectretry']>=_0x4212b6[_0x357b('0xee')]){_0x3d9d7e[_0x357b('0xef')](_0x5c8131,_0x19cc7c,_0x138cf4,_0x357b('0xf0'));}else{if(_0x5c8131['countmachineretry']>=_0x4212b6[_0x357b('0xfd')]){_0x3d9d7e[_0x357b('0xf1')](_0x5c8131,_0x19cc7c,_0x138cf4,_0x357b('0xf2'));}else{_0x3d9d7e['rescheduleContact']({'active':![],'countmachineretry':_0x5c8131[_0x357b('0xe7')],'scheduledat':moment()[_0x357b('0xf3')](_0x4212b6[_0x357b('0xf4')],'minutes')[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x5c8131['ContactId'],'ListId':_0x5c8131['ListId'],'VoiceQueueId':_0x5c8131[_0x357b('0xd1')]||undefined,'CampaignId':_0x5c8131[_0x357b('0xd2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x19cc7c({'reschedule':0x1});}}});}}};Dialer[_0x357b('0x1b')][_0x357b('0x35')]=function(_0x2e21d6){var _0x2009cb=this[_0x357b('0x27')][_0x2e21d6[_0x357b('0xd9')]];var _0x8dd905=this;var _0x521b19;if(_0x2009cb&&_0x2009cb[_0x357b('0x75')]===_0x357b('0x8e')){delete this[_0x357b('0x27')][_0x2e21d6[_0x357b('0xd9')]];this[_0x357b('0xaf')](this[_0x357b('0x21')][_0x2009cb['queue']]);this[_0x357b('0x21')][_0x2009cb[_0x357b('0xb0')]][_0x357b('0xfe')]+=0x1;_0x521b19=new Hangup(_0x2009cb,_0x2e21d6);this[_0x357b('0xc6')](_0x521b19)[_0x357b('0xad')](loggerCatch(_0x357b('0xff')));this['moveContactManagedDialer'](_0x521b19)[_0x357b('0xad')](loggerCatch(_0x357b('0x100')));}if(_0x2009cb&&_0x2009cb['type']!==_0x357b('0x8e')&&isNotNull(this[_0x357b('0x20')][_0x2009cb[_0x357b('0xb0')]][_0x357b('0x101')])){delete this[_0x357b('0x27')][_0x2e21d6[_0x357b('0xd9')]];this['updateOriginated'](this['voiceQueues'][_0x2009cb[_0x357b('0xb0')]]);this[_0x357b('0x20')][_0x2009cb[_0x357b('0xb0')]][_0x357b('0x5a')]+=0x1;this[_0x357b('0x20')][_0x2009cb[_0x357b('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;_0x521b19=new Hangup(_0x2009cb,_0x2e21d6);_0x521b19[_0x357b('0xa5')]=0x10;_0x521b19['statedesc']=_0x357b('0x102');_0x521b19[_0x357b('0xe2')]='AGI';this[_0x357b('0xc6')](_0x521b19)[_0x357b('0xad')](loggerCatch(_0x357b('0xff')));this['moveContactManagedDialer'](_0x521b19)[_0x357b('0xad')](loggerCatch(_0x357b('0x100')));}if(_0x2009cb&&_0x2009cb['type']!==_0x357b('0x8e')&&!isNotNull(this[_0x357b('0x20')][_0x2009cb[_0x357b('0xb0')]][_0x357b('0x101')])){delete this[_0x357b('0x27')][_0x2e21d6[_0x357b('0xd9')]];this['updateOriginated'](this[_0x357b('0x20')][_0x2009cb[_0x357b('0xb0')]]);this[_0x357b('0x20')][_0x2009cb[_0x357b('0xb0')]][_0x357b('0x103')]+=0x1;_0x521b19=new Hangup(_0x2009cb,_0x2e21d6);_0x521b19[_0x357b('0xa5')]=0xc;_0x521b19['statedesc']=_0x2e21d6['cause-txt'];_0x521b19[_0x357b('0xe2')]='Unknow';this[_0x357b('0xc6')](_0x521b19)[_0x357b('0xad')](loggerCatch(_0x357b('0xff')));this[_0x357b('0xc4')](_0x521b19)['catch'](loggerCatch(_0x357b('0x100')));}};Dialer[_0x357b('0x1b')][_0x357b('0x104')]=function(_0x5b25b0){var _0x5bf3f9=this[_0x357b('0x27')][_0x5b25b0[_0x357b('0xd9')]];var _0x20320e=this;if(this[_0x357b('0x20')][_0x5b25b0[_0x357b('0xb0')]]){if(_0x5bf3f9&&_0x5bf3f9[_0x357b('0x75')]!==_0x357b('0x8e')){delete this[_0x357b('0x27')][_0x5b25b0[_0x357b('0xd9')]];this[_0x357b('0x20')][_0x5b25b0['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3cca21=new AgentComplete(_0x5bf3f9,_0x5b25b0);if(_0x5b25b0[_0x357b('0x105')]===_0x357b('0x106')){_0x3cca21['agiafterat']=this[_0x357b('0x20')][_0x5b25b0[_0x357b('0xb0')]]['dialQueueProject2']&&this['voiceQueues'][_0x5b25b0[_0x357b('0xb0')]][_0x357b('0x107')]?moment()[_0x357b('0x72')](_0x357b('0xf6')):undefined;}this[_0x357b('0xc6')](_0x3cca21)[_0x357b('0xad')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x357b('0xc4')](_0x3cca21)[_0x357b('0xad')](loggerCatch(_0x357b('0x108')));}}};Dialer[_0x357b('0x1b')][_0x357b('0x2e')]=function(_0x298946){if(this[_0x357b('0x20')][_0x298946[_0x357b('0xb0')]]){if(this[_0x357b('0x27')][_0x298946[_0x357b('0xd9')]]&&this[_0x357b('0x27')][_0x298946[_0x357b('0xd9')]][_0x357b('0x75')]!==_0x357b('0x8e')){this[_0x357b('0xaf')](this[_0x357b('0x20')][_0x298946[_0x357b('0xb0')]]);this[_0x357b('0x27')][_0x298946[_0x357b('0xd9')]][_0x357b('0x109')]=moment()[_0x357b('0x72')](_0x357b('0xf6'));}}};Dialer[_0x357b('0x1b')][_0x357b('0x10a')]=function(_0x54b9c8){this['createHistory'](_0x54b9c8)[_0x357b('0xad')](loggerCatch(_0x357b('0x10b')));this[_0x357b('0xc4')](_0x54b9c8)[_0x357b('0xad')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0x357b('0x31')]=function(_0x5066c6){var _0x2dd8c4=this[_0x357b('0x27')][_0x5066c6[_0x357b('0xd9')]];var _0x5d83db=this;if(this['voiceQueues'][_0x5066c6['queue']]){if(_0x2dd8c4&&_0x2dd8c4[_0x357b('0x75')]!==_0x357b('0x8e')){delete this[_0x357b('0x27')][_0x5066c6[_0x357b('0xd9')]];this[_0x357b('0xaf')](this[_0x357b('0x20')][_0x5066c6[_0x357b('0xb0')]]);_0x2dd8c4[_0x357b('0x10c')]=moment()[_0x357b('0x72')](_0x357b('0xf6'));var _0x1960e2=new QueueCallerAbandon(_0x2dd8c4,_0x5066c6);if(getSeconds(_0x2dd8c4[_0x357b('0x10c')],_0x2dd8c4['responsetime'])>=_0x2dd8c4[_0x357b('0x10d')]){this['voiceQueues'][_0x5066c6['queue']][_0x357b('0x65')]+=0x1;this[_0x357b('0x20')][_0x5066c6[_0x357b('0xb0')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x357b('0x20')][_0x5066c6[_0x357b('0xb0')]][_0x357b('0x67')]+=0x1;_0x1960e2[_0x357b('0xa5')]=0xa;_0x1960e2[_0x357b('0xf8')]=_0x357b('0x10e');_0x1960e2[_0x357b('0x10f')]=_0x357b('0x110');_0x1960e2[_0x357b('0x111')]=this['voiceQueues'][_0x5066c6[_0x357b('0xb0')]][_0x357b('0x112')]?moment()[_0x357b('0x72')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1960e2['countdropretry']+=0x1;_0x1960e2[_0x357b('0xe8')]+=0x1;if(_0x1960e2['countdropretry']>=this[_0x357b('0x20')][_0x5066c6[_0x357b('0xb0')]][_0x357b('0x113')]){this[_0x357b('0x10a')](_0x1960e2);}else{this[_0x357b('0xbc')]({'active':![],'countdropretry':_0x1960e2[_0x357b('0xec')],'scheduledat':moment()['add'](this['voiceQueues'][_0x5066c6[_0x357b('0xb0')]][_0x357b('0x114')],_0x357b('0xf5'))[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x2dd8c4[_0x357b('0xce')],'ListId':_0x2dd8c4[_0x357b('0xcf')],'VoiceQueueId':_0x2dd8c4[_0x357b('0xd1')]||undefined,'CampaignId':_0x2dd8c4[_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x115')));var _0x525d42=new History(_0x1960e2);_0x525d42[_0x357b('0xa5')]=0xa;_0x525d42[_0x357b('0xf8')]=_0x357b('0x10e');_0x525d42['starttime']=moment()[_0x357b('0x72')](_0x357b('0xf6'));_0x525d42[_0x357b('0xa6')]=_0x525d42[_0x357b('0xa7')];_0x525d42[_0x357b('0x116')]=_0x1960e2[_0x357b('0x116')];_0x525d42[_0x357b('0x117')]=_0x1960e2['calleridnum'];this[_0x357b('0xc6')](_0x525d42)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x357b('0x20')][_0x5066c6['queue']][_0x357b('0x7d')]+=0x1;this['voiceQueues'][_0x5066c6['queue']][_0x357b('0x5f')]+=0x1;_0x1960e2['state']=0xb;_0x1960e2[_0x357b('0xf8')]=_0x357b('0x118');_0x1960e2[_0x357b('0x10f')]='CALLEREXIT';_0x1960e2[_0x357b('0xed')]+=0x1;_0x1960e2[_0x357b('0xe8')]+=0x1;if(_0x1960e2[_0x357b('0xed')]>=this[_0x357b('0x20')][_0x5066c6[_0x357b('0xb0')]][_0x357b('0x119')]){this[_0x357b('0x10a')](_0x1960e2);}else{this[_0x357b('0xbc')]({'active':![],'countabandonedretry':_0x1960e2[_0x357b('0xed')],'scheduledat':moment()['add'](this[_0x357b('0x20')][_0x5066c6['queue']][_0x357b('0x11a')],_0x357b('0xf5'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2dd8c4['ContactId'],'ListId':_0x2dd8c4[_0x357b('0xcf')],'VoiceQueueId':_0x2dd8c4[_0x357b('0xd1')]||undefined,'CampaignId':_0x2dd8c4[_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x11b')));var _0x525d42=new History(_0x1960e2);_0x525d42[_0x357b('0xa5')]=0xb;_0x525d42[_0x357b('0xf8')]=_0x357b('0x118');_0x525d42[_0x357b('0xa7')]=moment()[_0x357b('0x72')](_0x357b('0xf6'));_0x525d42[_0x357b('0xa6')]=_0x525d42[_0x357b('0xa7')];_0x525d42[_0x357b('0x116')]=_0x1960e2[_0x357b('0x116')];_0x525d42[_0x357b('0x117')]=_0x1960e2[_0x357b('0x117')];this[_0x357b('0xc6')](_0x525d42)[_0x357b('0xad')](loggerCatch(_0x357b('0x11c')));}}}}};Dialer[_0x357b('0x1b')][_0x357b('0x37')]=function(_0x37b632){if(this[_0x357b('0xaa')][_0x37b632['uniqueid']]){this['actions'][_0x37b632[_0x357b('0xd9')]][_0x357b('0xac')]=_0x37b632['channel'];}if(this[_0x357b('0x27')][_0x37b632['uniqueid']]){this[_0x357b('0x27')][_0x37b632[_0x357b('0xd9')]]['channel']=_0x37b632['channel'];}};Dialer[_0x357b('0x1b')][_0x357b('0x3b')]=function(_0x392192){if(strategy[this[_0x357b('0x20')][this[_0x357b('0xaa')][_0x392192[_0x357b('0x11d')]][_0x357b('0xb0')]][_0x357b('0x11e')]]===_0x357b('0x11f')){if(this[_0x357b('0xaa')][_0x392192[_0x357b('0x11d')]]&&_[_0x357b('0xda')](this['actions'][_0x392192['actionid']][_0x357b('0x120')])&&_0x392192[_0x357b('0xd6')]==='1'&&_0x392192['paused']==='0'){if(this['agents'][_0x392192['stateinterface']]){if(!this[_0x357b('0x22')][_0x392192[_0x357b('0x121')]]['locked']){this[_0x357b('0x22')][_0x392192['stateinterface']]['locked']=!![];this[_0x357b('0xaa')][_0x392192[_0x357b('0x11d')]][_0x357b('0x120')]=!![];this['actions'][_0x392192[_0x357b('0x11d')]][_0x357b('0x121')]=_0x392192['stateinterface'];}}}}else if((strategy[this[_0x357b('0x20')][this['actions'][_0x392192['actionid']]['queue']][_0x357b('0x11e')]]||_0x357b('0x122'))==='rrmemory'){if(this['actions'][_0x392192[_0x357b('0x11d')]]){if(this[_0x357b('0x22')][_0x392192[_0x357b('0x121')]]){this['actions'][_0x392192[_0x357b('0x11d')]][_0x357b('0x121')]=_0x392192[_0x357b('0x121')];if(_[_0x357b('0xda')](this[_0x357b('0x2c')][this[_0x357b('0xaa')][_0x392192[_0x357b('0x11d')]][_0x357b('0xb0')]])){this[_0x357b('0x2c')][this[_0x357b('0xaa')][_0x392192[_0x357b('0x11d')]][_0x357b('0xb0')]]=[];}this['queueBooked'][this['actions'][_0x392192[_0x357b('0x11d')]][_0x357b('0xb0')]][_0x357b('0x123')](_[_0x357b('0x87')](_[_0x357b('0xcd')](this[_0x357b('0xaa')][_0x392192[_0x357b('0x11d')]],[_0x357b('0x124'),_0x357b('0x121')]),{'status':_0x392192[_0x357b('0xd6')],'paused':_0x392192['paused']}));}}}};function unlockQueueStatus(_0x4f16ec,_0x1a7310){setTimeout(function(){if(_['isUndefined'](_0x4f16ec[_0x357b('0x125')])){loggerBooked[_0x357b('0x93')](_0x357b('0x126'),_0x1a7310);}_0x4f16ec[_0x357b('0x125')]=!![];loggerBooked[_0x357b('0x77')](_0x357b('0x127'),_0x1a7310,JSON[_0x357b('0x4b')](_[_0x357b('0xcd')](_0x4f16ec,[_0x357b('0x41'),_0x357b('0x125')])));},0x1f3);}Dialer[_0x357b('0x1b')]['syncQueueStatusComplete']=function(_0x40106e){var _0x178f54=this;var _0x4afe4e=_0x178f54['voiceQueues'][_0x178f54[_0x357b('0xaa')][_0x40106e['actionid']][_0x357b('0xb0')]];if(strategy[this[_0x357b('0x20')][this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]][_0x357b('0x11e')]]==='roundrobin'){if(this['actions'][_0x40106e[_0x357b('0x11d')]]&&this[_0x357b('0xaa')][_0x40106e['actionid']][_0x357b('0x121')]){this['preview']['run'](this['actions'][_0x40106e[_0x357b('0x11d')]]['idHopper'],this[_0x357b('0xaa')][_0x40106e['actionid']][_0x357b('0x121')])[_0x357b('0xad')](function(_0x39fc6e){logger[_0x357b('0x93')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x357b('0x92')](_0x39fc6e,{'showHidden':![],'depth':null}));})[_0x357b('0x1e')](function(){_0x178f54[_0x357b('0xaf')](_0x178f54['voiceQueues'][_0x178f54[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]]);_0x178f54['agents'][_0x178f54['actions'][_0x40106e[_0x357b('0x11d')]]['stateinterface']][_0x357b('0x120')]=![];delete _0x178f54[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]];unlockQueueStatus(_0x4afe4e);});}else{this['updateOriginated'](this[_0x357b('0x20')][this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xce')],'ListId':this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xcf')],'VoiceQueueId':this['actions'][_0x40106e['actionid']][_0x357b('0xd1')]||undefined,'CampaignId':this[_0x357b('0xaa')][_0x40106e['actionid']][_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]];unlockQueueStatus(_0x4afe4e);}}else if((strategy[this['voiceQueues'][this['actions'][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]][_0x357b('0x11e')]]||'rrmemory')===_0x357b('0x122')){var _0x128731;if(this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]]&&!_[_0x357b('0x49')](this[_0x357b('0x2c')][this['actions'][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]])){if(this['queueBookedRR'][_0x178f54['actions'][_0x40106e[_0x357b('0x11d')]]['queue']]){this[_0x357b('0x2d')][_0x178f54[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]]=this['queueBookedRR'][this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]]?this['queueBookedRR'][this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]]['queue']]:this[_0x357b('0x2c')][this[_0x357b('0xaa')][_0x40106e['actionid']][_0x357b('0xb0')]]?this['queueBooked'][this['actions'][_0x40106e[_0x357b('0x11d')]]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]][_0x357b('0x128')]=this['queueBookedRR'][this[_0x357b('0xaa')][_0x40106e[_0x357b('0x11d')]][_0x357b('0xb0')]];for(var _0x55a2ae=0x0;_0x55a2ae=0x0?!![]:![];})[_0x357b('0xad')](myreject(_0x17dab8)));}}else{_0x1f2f55[_0x357b('0x123')](ami[_0x357b('0xab')]({'action':'command','command':util['format'](_0x357b('0x140'),_0x268648,!_['isUndefined'](config[_0x357b('0x13d')][_0x446944])?_0x446944:'')})[_0x357b('0xb3')](function(_0x2ebbd0){return _0x2ebbd0[_0x357b('0x142')][_0x357b('0x143')](_0x357b('0x144'))>=0x0?!![]:![];})[_0x357b('0xad')](myreject(_0x17dab8)));}BPromise[_0x357b('0x145')](_0x1f2f55)['then'](function(_0x6b5aa4){var _0x4460f1=_['some'](_0x6b5aa4);if(_0x4460f1){return _0x2f33e5(_0x4460f1);}else{_0x5eb336['message']=_0x70f10f?_0x357b('0x146'):'INTERVAL_IS_OVERTIME';return _0x17dab8(msgResponse('[ifTime][promiseAll]',_0x357b('0x13b'),_0x357b('0x147')+_0x70f10f+'\x20'+_0x5bda10+'\x20Interval\x20is\x20overtime:\x20'+util[_0x357b('0x92')](_0x268648,{'showHidden':![],'depth':null})+_0x357b('0x148')+_0x446944));}})[_0x357b('0xad')](function(_0x7a380){return _0x17dab8(msgResponse(_0x357b('0x13a'),'Failure',JSON[_0x357b('0x4b')](_0x7a380)));});});};Dialer[_0x357b('0x1b')][_0x357b('0x149')]=function(_0x3d8446){var _0x39960e=this;return function(){switch(_0x3d8446[_0x357b('0x58')]){case _0x357b('0x14a'):freeVariablesPredictive(_0x3d8446);_0x39960e['handlePower'](_0x3d8446,0x1);break;case'power':freeVariablesPredictive(_0x3d8446);_0x39960e['handlePower'](_0x3d8446,_0x3d8446['dialPowerLevel']);break;case _0x357b('0x14b'):_0x39960e[_0x357b('0x14b')](_0x3d8446);break;case _0x357b('0x14c'):freeVariablesPredictive(_0x3d8446);_0x39960e[_0x357b('0x14d')](_0x3d8446,0x1);break;default:freeVariablesPredictive(_0x3d8446);logger[_0x357b('0x93')](_0x357b('0x14e'),_0x3d8446[_0x357b('0x41')],_0x357b('0x14f'));}};};Dialer[_0x357b('0x1b')][_0x357b('0x150')]=function(_0x59d8b0){var _0x160764=this;return function(){_0x160764[_0x357b('0x151')](_0x59d8b0);};};Dialer[_0x357b('0x1b')][_0x357b('0xa')]=function(_0x2ef8d4){var _0x67009c=this;if(isNotPreview(_0x2ef8d4['dialMethod'])){if(isVoiceQueueOutbound(_0x2ef8d4[_0x357b('0x75')])&&isActive(_0x2ef8d4[_0x357b('0x152')])){_0x2ef8d4['sendMessageOneNotActive']=!![];BPromise[_0x357b('0xb2')]()[_0x357b('0xb3')](checkIsLoggedIn(_0x2ef8d4,_0x2ef8d4[_0x357b('0x51')]))['then'](checkIsActive(_0x2ef8d4,_0x2ef8d4[_0x357b('0x152')]))[_0x357b('0xb3')](checkInterval(_0x2ef8d4))['then'](_0x67009c[_0x357b('0x153')](_0x2ef8d4))[_0x357b('0xb3')](_0x67009c[_0x357b('0x138')](_0x2ef8d4[_0x357b('0x154')],_0x2ef8d4['dialTimezone'],_0x2ef8d4['name'],_0x2ef8d4))[_0x357b('0xb3')](_0x67009c[_0x357b('0x139')](_0x2ef8d4[_0x357b('0x45')],_0x2ef8d4['dialTimezone'],_0x2ef8d4[_0x357b('0x41')],_0x2ef8d4))[_0x357b('0xb3')](_0x67009c[_0x357b('0x149')](_0x2ef8d4))['catch'](loggerCatchQueueSummary(_0x357b('0x155'),_0x2ef8d4));}else{notSendMessagesQueue(_0x2ef8d4);}}else{freeVariablesPredictive(_0x2ef8d4);}};Dialer[_0x357b('0x1b')][_0x357b('0x134')]=function(){var _0xa80946=this;var _0x234cc1;for(var _0x285d1f in this[_0x357b('0x21')]){if(this[_0x357b('0x21')][_0x357b('0x95')](_0x285d1f)){_0x234cc1=this[_0x357b('0x21')][_0x285d1f];if(isCampaignIvr(_0x234cc1['type'])&&isActive(_0x234cc1[_0x357b('0x70')])){_0x234cc1[_0x357b('0x9d')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x234cc1,_0x234cc1[_0x357b('0x70')]))[_0x357b('0xb3')](checkInterval(_0x234cc1))[_0x357b('0xb3')](_0xa80946[_0x357b('0x153')](_0x234cc1))['then'](_0xa80946[_0x357b('0x138')](_0x234cc1[_0x357b('0x154')],_0x234cc1['dialTimezone'],_0x234cc1['name'],_0x234cc1))[_0x357b('0xb3')](_0xa80946['checkIfTimeIntervals'](_0x234cc1[_0x357b('0x45')],_0x234cc1['dialTimezone'],_0x234cc1[_0x357b('0x41')],_0x234cc1))[_0x357b('0xb3')](_0xa80946['launchHandleIvr'](_0x234cc1))[_0x357b('0xad')](loggerCatchQueueSummary(_0x357b('0x156'),_0x234cc1));}else{notSendMessagesCampaign(_0x234cc1);}}}};function getCallerIdRandom(_0x15a509,_0xd164c4){var _0x57a493,_0x3afc90,_0x45d581;if(_0xd164c4<=0x0){_0xd164c4=0x1;}_0x57a493=new RegExp(_0x357b('0x157')+_0xd164c4+'}$');_0x3afc90=Math[_0x357b('0x158')](0xa,_0xd164c4-0x1);_0x45d581=Math[_0x357b('0x158')](0xa,_0xd164c4)-0x1;return util[_0x357b('0x72')]('%s',_[_0x357b('0x159')](_0x15a509,_0x57a493,_[_0x357b('0x15a')](_0x3afc90,_0x45d581)));}function extractCalleridName(_0x39e26e){var _0x52c9c6=_0x39e26e['match'](/"(.*?)"/);return _0x52c9c6?_0x52c9c6[0x1]:_0x39e26e;}function extractCalleridNumber(_0x31a8ee){var _0x22d058=_0x31a8ee[_0x357b('0x15b')](/<(.*?)>/);return _0x22d058?_0x22d058[0x1]:_0x31a8ee;}Dialer[_0x357b('0x1b')][_0x357b('0x15c')]=function(_0x422160,_0x34d407){var _0x200f1c=this;var _0x5dc46e=uuid['v4']();this['actions'][_0x5dc46e]=new Action(_0x422160,_0x34d407,_0x5dc46e);return new BPromise(function(_0x4a2349,_0x33d927){if(_[_0x357b('0x3f')](_0x422160)&&_0x357b('0x15d')!==typeof _0x422160){return _0x33d927(msgResponse(_0x357b('0x15e'),_0x357b('0x13b'),_0x357b('0x15f')));}if(_[_0x357b('0x3f')](_0x34d407[_0x357b('0x160')][_0x357b('0x161')])||_0x34d407['Contact']['phone']===null){return _0x33d927(msgResponse(_0x357b('0x15e'),_0x357b('0x13b'),_0x357b('0x162')));}var _0x216c05={'XMD-CALLERID':_0x200f1c[_0x357b('0xaa')][_0x5dc46e][_0x357b('0x163')](),'XMD-AGI':_0x422160[_0x357b('0x101')]?util[_0x357b('0x72')](_0x357b('0x164'),ipAgi,_0x422160[_0x357b('0x101')]):'NONE','XMD-AGIAFTER':_0x422160['dialQueueProject2']?util[_0x357b('0x72')]('\x22agi://%s/square,%s\x22',ipAgi,_0x422160[_0x357b('0x112')]):'NONE','XMD-QUEUE':_0x422160[_0x357b('0x75')]===_0x357b('0x8d')?util[_0x357b('0x72')]('\x22%s,%s%s,,,%s\x22',_0x422160[_0x357b('0x41')],_0x422160['dialQueueOptions']||'',_0x422160['dialAgiAfterHangupAgent']?'c':'',_0x422160[_0x357b('0x10d')]||0x3):_0x357b('0x165'),'XMD-CONTACTID':_0x34d407['ContactId'],'XMD-CDRTYPE':_0x357b('0x8'),'CALLERID(all)':_0x200f1c[_0x357b('0xaa')][_0x5dc46e]['getCaller'](),'XMD-AMD':_0x422160[_0x357b('0xdd')]?_0x357b('0x166'):_0x357b('0x165'),'XMD-DESTINATION':_0x357b('0xdc')};if(_0x422160[_0x357b('0xdd')]){_0x216c05[_0x357b('0x167')]=_0x422160['dialAMDInitialSilence']||0x9c4;_0x216c05[_0x357b('0x168')]=_0x422160[_0x357b('0x169')]||0x5dc;_0x216c05[_0x357b('0x16a')]=_0x422160[_0x357b('0x16b')]||0x320;_0x216c05['XMD-AMDTOTALANALYSISTIME']=_0x422160['dialAMDTotalAnalysisTime']||0x1388;_0x216c05[_0x357b('0x16c')]=_0x422160['dialAMDMinWordLength']||0x64;_0x216c05['XMD-AMDBETWEENWORDSSILENCE']=_0x422160['dialAMDBetweenWordsSilence']||0x32;_0x216c05['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x422160[_0x357b('0x16d')]||0x3;_0x216c05['XMD-AMDSILENCETHRESHOLD']=_0x422160[_0x357b('0x16e')]||0x100;_0x216c05[_0x357b('0x16f')]=_0x422160[_0x357b('0x170')]||0x1388;}if(_0x422160[_0x357b('0x75')]===_0x357b('0x8d')){_0x216c05[_0x357b('0x171')]=_0x34d407['VoiceQueueId'];}else{_0x216c05[_0x357b('0x172')]=_0x34d407[_0x357b('0xd2')];}for(var _0x1c6126 in _0x34d407['Contact']){if(_0x34d407[_0x357b('0x160')][_0x357b('0x95')](_0x1c6126)){if(isNotNull(_0x34d407['Contact'][_0x1c6126])&&_0x1c6126!=='id'&&_0x1c6126!==_0x357b('0x173')&&_0x1c6126!==_0x357b('0x174')&&_0x1c6126!==_0x357b('0x175')){_0x216c05[util[_0x357b('0x72')](_0x357b('0x176'),_0x357b('0x177'),_[_0x357b('0x178')](_0x1c6126))]=_0x34d407['Contact'][_0x1c6126];}}}var _0x198926=_0x200f1c[_0x357b('0xd4')](_0x422160['Trunk'])?getCallerId(_0x422160['Trunk'][_0x357b('0x71')],_0x422160[_0x357b('0x179')],_0x422160[_0x357b('0x17a')]>0x0?getCallerIdRandom(_0x422160[_0x357b('0x59')],_0x422160[_0x357b('0x17a')]):_0x422160[_0x357b('0x59')]):getCallerId(_[_0x357b('0xda')](_0x422160[_0x357b('0x135')])?_0x422160[_0x357b('0x6f')]['callerid']:_0x422160[_0x357b('0x135')][_0x357b('0x71')],_0x422160[_0x357b('0x179')],_0x422160['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x422160['dialOriginateCallerIdNumber'],_0x422160[_0x357b('0x17a')]):_0x422160[_0x357b('0x59')]);if(_0x198926){_0x216c05[_0x357b('0x17b')]=_0x200f1c[_0x357b('0xaa')][_0x5dc46e]['originatecalleridname']=extractCalleridName(_0x198926);_0x216c05[_0x357b('0x17c')]=_0x200f1c['actions'][_0x5dc46e][_0x357b('0x17d')]=extractCalleridNumber(_0x198926);}return ami['Action']({'actionid':_0x5dc46e,'action':'originate','channel':_0x200f1c[_0x357b('0xd4')](_0x422160['Trunk'])?util[_0x357b('0x72')](_0x357b('0x17e'),_0x422160['Trunk'][_0x357b('0x41')],isNotNull(_0x422160['dialPrefix'])?_0x422160['dialPrefix'][_0x357b('0x17f')]()||'':'',_0x422160[_0x357b('0x180')]>0x0?_0x34d407['Contact'][_0x357b('0x161')][_0x357b('0x181')](_0x422160[_0x357b('0x180')]):_0x34d407[_0x357b('0x160')][_0x357b('0x161')]):util[_0x357b('0x72')](_0x357b('0x17e'),_['isNil'](_0x422160[_0x357b('0x135')])?_0x422160[_0x357b('0x6f')][_0x357b('0x41')]:_0x422160[_0x357b('0x135')]['name'],isNotNull(_0x422160[_0x357b('0x182')])?_0x422160[_0x357b('0x182')][_0x357b('0x17f')]()||'':'',_0x422160[_0x357b('0x180')]>0x0?_0x34d407[_0x357b('0x160')]['phone']['substring'](_0x422160[_0x357b('0x180')]):_0x34d407[_0x357b('0x160')][_0x357b('0x161')]),'callerid':_0x198926,'Exten':_0x357b('0xdc'),'Context':_0x357b('0x183'),'Priority':'1','variable':_0x216c05,'timeout':(_0x422160['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5dc46e})[_0x357b('0xb3')](function(_0x5127b5){return _0x4a2349(_0x5127b5);})['catch'](function(_0x24ee8b){_0x422160[_0x357b('0x184')]+=0x1;var _0x4597f8=new History(_0x200f1c[_0x357b('0xaa')][_0x5dc46e]);logger[_0x357b('0x93')](util[_0x357b('0x72')](_0x357b('0x185'),JSON[_0x357b('0x4b')](_0x24ee8b)));_0x4597f8[_0x357b('0xa5')]=0xe;_0x4597f8[_0x357b('0xf8')]='OriginateError';_0x4597f8['starttime']=moment()['format'](_0x357b('0xf6'));_0x4597f8[_0x357b('0xa6')]=_0x4597f8['starttime'];_0x200f1c[_0x357b('0xc6')](_0x4597f8)[_0x357b('0xad')](loggerCatch('[originate][error]'));_0x200f1c[_0x357b('0xc4')](_0x4597f8)['catch'](loggerCatch(_0x357b('0x186')))[_0x357b('0x1e')](function(){delete _0x200f1c[_0x357b('0xaa')][_0x5dc46e];return _0x33d927(msgResponse(_0x357b('0x15e'),_0x357b('0x4a'),'originate\x20action\x20Error'));});});});};Dialer[_0x357b('0x1b')][_0x357b('0x33')]=function(_0x50cbe2){var _0x47fc24=this[_0x357b('0xaa')][_0x50cbe2[_0x357b('0x11d')]];var _0xbc784a=this;if(_0x47fc24){delete this[_0x357b('0xaa')][_0x50cbe2[_0x357b('0x11d')]];_0x47fc24[_0x357b('0x187')]=moment()[_0x357b('0x72')](_0x357b('0xf6'));var _0x26f7df=_0x47fc24[_0x357b('0x75')]===_0x357b('0x8e')?this[_0x357b('0x21')][_0x47fc24['queue']]:this['voiceQueues'][_0x47fc24[_0x357b('0x188')]()];if(!this['isSuccess'](_0x50cbe2[_0x357b('0x189')])){this[_0x357b('0xaf')](_0x26f7df);return this['callProgressDetecting'](_0x47fc24,_0x26f7df,_0x50cbe2)['then'](function(_0x208a70){})[_0x357b('0xad')](loggerCatch(_0x357b('0x18a')));}else{this[_0x357b('0x27')][_0x50cbe2[_0x357b('0xd9')]]=_0x47fc24;}}};Dialer[_0x357b('0x1b')][_0x357b('0x18b')]=function(_0x2b750c,_0x4e3020,_0x5e8ca6){var _0x37edc1=new History(_0x4e3020);if(_0x37edc1[_0x357b('0xfa')]+_0x37edc1['countcongestionretry']+_0x37edc1['countnoanswerretry']+_0x37edc1[_0x357b('0xeb')]+_0x37edc1['countdropretry']+_0x37edc1[_0x357b('0xed')]+_0x37edc1[_0x357b('0xe7')]+_0x37edc1[_0x357b('0x18c')]>=_0x5e8ca6['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2b750c){case 0x3:if(_0x37edc1['countnoanswerretry']>=_0x5e8ca6[_0x357b('0x18d')]-0x1){return!![];}else{this[_0x357b('0xbc')]({'active':![],'countnoanswerretry':_0x37edc1[_0x357b('0xfc')]+=0x1,'scheduledat':moment()[_0x357b('0xf3')](_0x5e8ca6['dialNoAnswerRetryFrequency'],_0x357b('0xf5'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x37edc1[_0x357b('0xce')],'ListId':_0x37edc1[_0x357b('0xcf')],'VoiceQueueId':_0x37edc1[_0x357b('0xd1')]||undefined,'CampaignId':_0x37edc1[_0x357b('0xd2')]||undefined})['catch'](loggerCatch(_0x357b('0x18e')));}break;case 0x5:if(_0x37edc1[_0x357b('0xfa')]>=_0x5e8ca6[_0x357b('0x18f')]-0x1){return!![];}else{this[_0x357b('0xbc')]({'active':![],'countbusyretry':_0x37edc1[_0x357b('0xfa')]+=0x1,'scheduledat':moment()['add'](_0x5e8ca6['dialBusyRetryFrequency'],_0x357b('0xf5'))[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x37edc1['ContactId'],'ListId':_0x37edc1[_0x357b('0xcf')],'VoiceQueueId':_0x37edc1[_0x357b('0xd1')]||undefined,'CampaignId':_0x37edc1[_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x190')));}break;case 0x8:if(_0x37edc1[_0x357b('0xfb')]>=_0x5e8ca6[_0x357b('0x191')]-0x1){return!![];}else{this[_0x357b('0xbc')]({'active':![],'countcongestionretry':_0x37edc1[_0x357b('0xfb')]+=0x1,'scheduledat':moment()[_0x357b('0xf3')](_0x5e8ca6[_0x357b('0x192')],'minutes')[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x37edc1['ContactId'],'ListId':_0x37edc1[_0x357b('0xcf')],'VoiceQueueId':_0x37edc1[_0x357b('0xd1')]||undefined,'CampaignId':_0x37edc1['CampaignId']||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x193')));}break;case 0x0:if(_0x37edc1[_0x357b('0xeb')]>=_0x5e8ca6['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x357b('0xbc')]({'active':![],'countnosuchnumberretry':_0x37edc1[_0x357b('0xeb')]+=0x1,'scheduledat':moment()[_0x357b('0xf3')](_0x5e8ca6[_0x357b('0x194')],_0x357b('0xf5'))[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x37edc1[_0x357b('0xce')],'ListId':_0x37edc1[_0x357b('0xcf')],'VoiceQueueId':_0x37edc1[_0x357b('0xd1')]||undefined,'CampaignId':_0x37edc1[_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x195')));}break;case 0xa:if(_0x37edc1[_0x357b('0xec')]>=_0x5e8ca6[_0x357b('0x113')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x37edc1[_0x357b('0xec')]+=0x1,'scheduledat':moment()[_0x357b('0xf3')](_0x5e8ca6[_0x357b('0x114')],_0x357b('0xf5'))[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x37edc1[_0x357b('0xce')],'ListId':_0x37edc1[_0x357b('0xcf')],'VoiceQueueId':_0x37edc1[_0x357b('0xd1')]||undefined,'CampaignId':_0x37edc1['CampaignId']||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x115')));}break;case 0xb:if(_0x37edc1['countabandonedretry']>=_0x5e8ca6[_0x357b('0x119')]-0x1){return!![];}else{this[_0x357b('0xbc')]({'active':![],'countabandonedretry':_0x37edc1[_0x357b('0xed')]+=0x1,'scheduledat':moment()[_0x357b('0xf3')](_0x5e8ca6[_0x357b('0x11a')],'minutes')[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x37edc1[_0x357b('0xce')],'ListId':_0x37edc1[_0x357b('0xcf')],'VoiceQueueId':_0x37edc1[_0x357b('0xd1')]||undefined,'CampaignId':_0x37edc1[_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x11b')));}break;case 0x13:if(_0x37edc1['countmachineretry']>=_0x5e8ca6[_0x357b('0xfd')]-0x1){return!![];}else{this[_0x357b('0xbc')]({'active':![],'countmachineretry':_0x37edc1['countmachineretry']+=0x1,'scheduledat':moment()[_0x357b('0xf3')](_0x5e8ca6[_0x357b('0xf4')],_0x357b('0xf5'))[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x37edc1[_0x357b('0xce')],'ListId':_0x37edc1[_0x357b('0xcf')],'VoiceQueueId':_0x37edc1[_0x357b('0xd1')]||undefined,'CampaignId':_0x37edc1['CampaignId']||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0xf7')));}break;case 0x14:if(_0x37edc1[_0x357b('0x18c')]>=_0x5e8ca6['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0x357b('0xbc')]({'active':![],'countagentrejectretry':_0x37edc1[_0x357b('0x18c')]+=0x1,'scheduledat':moment()[_0x357b('0xf3')](_0x5e8ca6[_0x357b('0x196')],_0x357b('0xf5'))[_0x357b('0x72')](_0x357b('0xf6')),'ContactId':_0x37edc1[_0x357b('0xce')],'ListId':_0x37edc1[_0x357b('0xcf')],'VoiceQueueId':_0x37edc1[_0x357b('0xd1')]||undefined,'CampaignId':_0x37edc1[_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x197')));}break;default:return!![];}};Dialer[_0x357b('0x1b')]['callProgressDetecting']=function(_0x101c2d,_0x1876fa,_0x33f2bb){var _0x8a13ac=this;var _0x435d71=new History(_0x101c2d);return new BPromise(function(_0x178373,_0x4534b6){if(_['isUndefined'](_0x1876fa)&&'object'!==typeof _0x1876fa){return _0x4534b6(msgResponse(_0x357b('0x198'),'Failure',_0x357b('0x199')));}if(_['isUndefined'](_0x33f2bb)&&_0x357b('0x15d')!==typeof _0x33f2bb){return _0x4534b6(msgResponse(_0x357b('0x198'),'Failure',_0x357b('0x19a')));}switch(_0x33f2bb[_0x357b('0x105')]){case'0':_0x1876fa['outboundNoSuchCallsDay']+=0x1;_0x435d71['state']=0x0;_0x435d71[_0x357b('0xf8')]='NoSuchNumber';_0x435d71[_0x357b('0xeb')]+=0x1;_0x435d71['countglobal']+=0x1;console[_0x357b('0x19b')]('EMITTING\x20status_nosuchnumber\x20for',ut[_0x357b('0x19c')](_0x101c2d,_0x357b('0x19d')));ami[_0x357b('0x4e')](_0x357b('0x19e'),ut['buildObj'](_0x101c2d,_0x357b('0x19d')));_0x8a13ac[_0x357b('0xc6')](_0x435d71)[_0x357b('0xad')](loggerCatch(_0x357b('0xea')));if(_0x8a13ac['checkRetriveMax'](0x0,_0x101c2d,_0x1876fa)){if(_0x435d71[_0x357b('0xeb')]>=_0x1876fa[_0x357b('0x19f')]){_0x8a13ac['createStateFinal'](_0x435d71,_0x178373,_0x4534b6,_0x357b('0x1a0'));}else{_0x8a13ac[_0x357b('0xef')](_0x435d71,_0x178373,_0x4534b6,_0x357b('0x1a0'));}}break;case'3':_0x1876fa[_0x357b('0x60')]+=0x1;_0x435d71[_0x357b('0xa5')]=0x3;_0x435d71[_0x357b('0xf8')]=_0x357b('0x1a1');_0x435d71[_0x357b('0xfc')]+=0x1;_0x435d71[_0x357b('0xe8')]+=0x1;console[_0x357b('0x19b')](_0x357b('0x1a2'),_0x33f2bb);console[_0x357b('0x19b')](_0x357b('0x1a3'),_0x101c2d);console[_0x357b('0x19b')]('NO\x20ANSWER\x20entity',_0x1876fa);console[_0x357b('0x19b')](_0x357b('0x1a4'),_0x435d71);console[_0x357b('0x19b')](_0x357b('0x1a5'),ut['buildObj'](_0x101c2d,_0x357b('0x1a6')));ami['emit'](_0x357b('0x1a7'),ut[_0x357b('0x19c')](_0x101c2d,_0x357b('0x1a6')));_0x8a13ac['createHistory'](_0x435d71)[_0x357b('0xad')](loggerCatch(_0x357b('0x1a8')));if(_0x8a13ac[_0x357b('0x18b')](0x3,_0x101c2d,_0x1876fa)){if(_0x435d71[_0x357b('0xfc')]>=_0x1876fa['dialNoAnswerMaxRetry']){_0x8a13ac[_0x357b('0xf1')](_0x435d71,_0x178373,_0x4534b6,'reason\x203\x20ringing\x20no\x20answer');}else{_0x8a13ac[_0x357b('0xef')](_0x435d71,_0x178373,_0x4534b6,_0x357b('0x1a9'));}}break;case'5':_0x1876fa[_0x357b('0x5c')]+=0x1;_0x435d71['state']=0x5;_0x435d71[_0x357b('0xf8')]='Busy';_0x435d71[_0x357b('0xfa')]+=0x1;_0x435d71['countglobal']+=0x1;console[_0x357b('0x19b')](_0x357b('0x1aa'),ut[_0x357b('0x19c')](_0x101c2d,_0x357b('0x1ab')));ami[_0x357b('0x4e')](_0x357b('0x1ac'),ut[_0x357b('0x19c')](_0x101c2d,_0x357b('0x1ab')));_0x8a13ac['createHistory'](_0x435d71)[_0x357b('0xad')](loggerCatch(_0x357b('0x1ad')));if(_0x8a13ac[_0x357b('0x18b')](0x5,_0x101c2d,_0x1876fa)){if(_0x435d71['countbusyretry']>=_0x1876fa[_0x357b('0x18f')]){_0x8a13ac[_0x357b('0xf1')](_0x435d71,_0x178373,_0x4534b6,'reason\x205\x20busy');}else{_0x8a13ac[_0x357b('0xef')](_0x435d71,_0x178373,_0x4534b6,_0x357b('0x1ae'));}}break;case'8':_0x1876fa[_0x357b('0x5d')]+=0x1;_0x435d71[_0x357b('0xa5')]=0x8;_0x435d71[_0x357b('0xf8')]=_0x357b('0x1af');_0x435d71[_0x357b('0xfb')]+=0x1;_0x435d71['countglobal']+=0x1;_0x8a13ac[_0x357b('0xc6')](_0x435d71)[_0x357b('0xad')](loggerCatch(_0x357b('0x1b0')));if(_0x8a13ac[_0x357b('0x18b')](0x8,_0x101c2d,_0x1876fa)){if(_0x435d71[_0x357b('0xfb')]>=_0x1876fa[_0x357b('0x191')]){_0x8a13ac[_0x357b('0xf1')](_0x435d71,_0x178373,_0x4534b6,'reason\x208\x20congestion');}else{_0x8a13ac[_0x357b('0xef')](_0x435d71,_0x178373,_0x4534b6,_0x357b('0x1b1'));}}break;case'11':_0x1876fa[_0x357b('0x1b2')]+=0x1;_0x435d71[_0x357b('0xa5')]=0xb;_0x435d71['statedesc']=_0x357b('0x118');_0x435d71[_0x357b('0xed')]+=0x1;_0x435d71[_0x357b('0xe8')]+=0x1;_0x8a13ac[_0x357b('0xc6')](_0x435d71)[_0x357b('0xad')](loggerCatch(_0x357b('0x11c')));if(_0x8a13ac[_0x357b('0x18b')](0xb,_0x101c2d,_0x1876fa)){if(_0x435d71[_0x357b('0xed')]>=_0x1876fa['dialAbandonedMaxRetry']){_0x8a13ac['createStateFinal'](_0x435d71,_0x178373,_0x4534b6,'reason\x2011\x20abandoned');}else{_0x8a13ac[_0x357b('0xef')](_0x435d71,_0x178373,_0x4534b6,_0x357b('0x1b3'));}}break;case'20':_0x1876fa[_0x357b('0x1b4')]+=0x1;_0x435d71['state']=0x14;_0x435d71[_0x357b('0xf8')]='AgentReject';_0x435d71['countagentrejectretry']+=0x1;_0x435d71[_0x357b('0xe8')]+=0x1;_0x8a13ac['createHistory'](_0x435d71)[_0x357b('0xad')](loggerCatch(_0x357b('0x1b5')));if(_0x8a13ac[_0x357b('0x18b')](0x14,_0x101c2d,_0x1876fa)){if(_0x435d71['countagentrejectretry']>=_0x1876fa['dialAgentRejectMaxRetry']){_0x8a13ac[_0x357b('0xf1')](_0x435d71,_0x178373,_0x4534b6,_0x357b('0x1b6'));}else{_0x8a13ac['stateGlobal'](_0x435d71,_0x178373,_0x4534b6,_0x357b('0x1b6'));}}break;default:_0x1876fa[_0x357b('0x103')]+=0x1;_0x435d71[_0x357b('0xa5')]=0xc;_0x435d71['statedesc']=_0x33f2bb['reason'];_0x8a13ac[_0x357b('0xc6')](_0x435d71)[_0x357b('0xad')](loggerCatch(_0x357b('0x1b7')));if(_0x8a13ac[_0x357b('0x18b')](_0x33f2bb[_0x357b('0x105')],_0x101c2d,_0x1876fa)){if(_0x435d71[_0x357b('0xfa')]+_0x435d71['countcongestionretry']+_0x435d71[_0x357b('0xfc')]+_0x435d71[_0x357b('0xeb')]+_0x435d71[_0x357b('0xec')]+_0x435d71[_0x357b('0xed')]+_0x435d71[_0x357b('0xe7')]+_0x435d71[_0x357b('0x18c')]>=_0x1876fa['dialGlobalMaxRetry']){_0x8a13ac[_0x357b('0xef')](_0x435d71,_0x178373,_0x4534b6,_0x33f2bb[_0x357b('0x105')]);}else{_0x8a13ac[_0x357b('0xf1')](_0x435d71,_0x178373,_0x4534b6,_0x33f2bb[_0x357b('0x105')]);}}}});};Dialer['prototype'][_0x357b('0xef')]=function(_0x32d8b2,_0x27e76e,_0x54b175,_0x54faa0){var _0x52e60d=new Final(_0x32d8b2);_0x52e60d[_0x357b('0xa5')]=0xf;_0x52e60d[_0x357b('0xf8')]=_0x357b('0x1b8');this[_0x357b('0xf1')](_0x52e60d,_0x27e76e,_0x54b175,_0x54faa0);};Dialer[_0x357b('0x1b')][_0x357b('0xf1')]=function(_0x5193ac,_0x58dcf3,_0x57d132,_0x4ba4a9){this['moveContactManagedDialer'](_0x5193ac)[_0x357b('0xb3')](function(_0x238135){return _0x58dcf3(msgResponse(_0x357b('0x198'),_0x357b('0x1b9'),_0x4ba4a9));})['catch'](function(_0x3b653c){return _0x57d132(msgResponse(_0x357b('0x1ba'),_0x357b('0x13b'),_0x357b('0x1bb')));});};Dialer['prototype'][_0x357b('0x14b')]=function(_0x462d6b){var _0x1cc00e=this;var _0x1e817b=_0x462d6b[_0x357b('0x1bc')]/0x64;var _0x5f492a=_0x462d6b[_0x357b('0x1bd')]/(_0x462d6b[_0x357b('0x1bd')]+_0x462d6b[_0x357b('0x5a')]);var _0x1965a9=Math['round'](_0x462d6b[_0x357b('0x6a')]*(_0x462d6b['predictiveIntervalMaxThreshold']/0x64));var _0x96c9eb=Math[_0x357b('0x1be')](_0x462d6b[_0x357b('0x6a')]*(_0x462d6b[_0x357b('0x1bf')]/0x64));var _0x2fef4c=_0x462d6b['available']+_0x462d6b[_0x357b('0x9e')];var _0x293c62=Math[_0x357b('0x1c0')](_0x462d6b[_0x357b('0x6c')]*_0x462d6b['erlangAbandonmentRate']*_0x462d6b['predictiveIntervalHitRate']*_0x462d6b[_0x357b('0x69')]);if(_[_0x357b('0x3f')](_0x462d6b[_0x357b('0x2a')])){if(!_['isUndefined'](_0x462d6b[_0x357b('0x29')])){_0x462d6b[_0x357b('0x29')]=undefined;loggerPredictive[_0x357b('0x93')](_0x357b('0x1c1'),_0x357b('0x1c2'));}if(!_[_0x357b('0x3f')](_0x462d6b[_0x357b('0x8b')])){loggerPredictive[_0x357b('0x93')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x462d6b[_0x357b('0x8b')]);_0x462d6b[_0x357b('0x8b')]=undefined;}_0x462d6b['startProgressive']=moment()[_0x357b('0x72')](_0x357b('0xf6'));loggerPredictive[_0x357b('0x77')](_0x462d6b[_0x357b('0x41')],_0x357b('0x1c3'),_0x462d6b[_0x357b('0x2a')]);this['handlePower'](_0x462d6b,0x1);}else if(ifInterval(_0x462d6b[_0x357b('0x1c4')],_0x462d6b[_0x357b('0x2a')])){this[_0x357b('0x14d')](_0x462d6b,0x1);loggerPredictiveCalls['info'](_0x357b('0x1c5'),_0x462d6b[_0x357b('0x2a')],_0x462d6b[_0x357b('0x41')]);_0x462d6b[_0x357b('0x6c')]=0x0;_0x462d6b[_0x357b('0x67')]=0x0;}else if(_0x1e817b<_0x5f492a&&_0x462d6b[_0x357b('0x1c6')]===_0x357b('0x1c7')){freeVariablesPredictive(_0x462d6b);loggerPredictive['info'](_0x357b('0x1c8'),'Dropped\x20calls\x20day',_0x5f492a,_0x357b('0x2a'),_0x462d6b[_0x357b('0x41')]);}else if(_0x293c62<_0x462d6b['predictiveIntervalErlangCallsDroppedCalls']&&_0x462d6b[_0x357b('0x1c6')]==='dropRate'){freeVariablesPredictive(_0x462d6b);loggerPredictive[_0x357b('0x77')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x357b('0x1c9'),_0x293c62,'Drop\x20in\x20this\x20interval',_0x462d6b['predictiveIntervalErlangCallsDroppedCalls'],_0x357b('0x2a'),_0x462d6b[_0x357b('0x41')]);}else if(!ifInterval(_0x462d6b[_0x357b('0x1c4')],_0x462d6b['startProgressive'])&&_[_0x357b('0x3f')](_0x462d6b['startPredictive'])&&!_[_0x357b('0x3f')](_0x462d6b['startProgressive'])){_0x462d6b['startPredictive']=moment()[_0x357b('0x72')](_0x357b('0xf6'));loggerPredictive[_0x357b('0x77')](_0x462d6b['name'],_0x357b('0x1ca'),_0x462d6b[_0x357b('0x29')]);this[_0x357b('0xb9')](_0x462d6b[_0x357b('0x1c4')])[_0x357b('0xb3')](this[_0x357b('0x1cb')](_0x462d6b))[_0x357b('0xb3')](mergeDataErlangB(_0x462d6b))[_0x357b('0xb3')](this[_0x357b('0x1cc')](_0x462d6b))['catch'](loggerCatchPredictive(_0x357b('0x1cd'),_0x462d6b));}else if(!ifInterval(_0x462d6b[_0x357b('0x1c4')],_0x462d6b[_0x357b('0x29')])){_0x462d6b[_0x357b('0x67')]=0x0;_0x462d6b['startPredictive']=moment()[_0x357b('0x72')](_0x357b('0xf6'));loggerPredictive['info'](_0x462d6b[_0x357b('0x41')],_0x357b('0x1ce'),_0x462d6b['startPredictive']);clearInterval(_0x462d6b[_0x357b('0x8b')]);_0x462d6b['handlePredictive']=undefined;this[_0x357b('0xb9')](_0x462d6b[_0x357b('0x1c4')])[_0x357b('0xb3')](this[_0x357b('0x1cb')](_0x462d6b))['then'](mergeDataErlangB(_0x462d6b))[_0x357b('0xb3')](this['startMethodPredictive'](_0x462d6b))[_0x357b('0xad')](loggerCatchPredictive(_0x357b('0x1cf'),_0x462d6b));}else if(_0x462d6b['predictiveIntervalAvailable']&&_0x2fef4c<_0x462d6b[_0x357b('0x6a')]-_0x96c9eb){freeVariablesPredictive(_0x462d6b);loggerPredictive[_0x357b('0x77')](_0x462d6b['name'],_0x357b('0x1d0'),_0x2fef4c,_0x357b('0x1d1'),_0x462d6b[_0x357b('0x6a')],'-',_0x96c9eb,'=',_0x462d6b[_0x357b('0x6a')]-_0x96c9eb,')');}else if(_0x462d6b[_0x357b('0x6a')]&&_0x2fef4c>_0x462d6b['predictiveIntervalAvailable']+_0x1965a9){freeVariablesPredictive(_0x462d6b);loggerPredictive[_0x357b('0x77')](_0x462d6b[_0x357b('0x41')],_0x357b('0x1d0'),_0x2fef4c,_0x357b('0x1d2'),_0x462d6b[_0x357b('0x6a')],'+',_0x1965a9,'=',_0x462d6b[_0x357b('0x6a')]+_0x1965a9,')');}};Dialer['prototype']['getDataPredictive']=function(_0x3d68e9){var _0x5c9586=this;return function(_0x25a034){return new BPromise(function(_0x287b05,_0x556848){_[_0x357b('0x87')](_0x3d68e9,_0x25a034[0x0]);if(checkGetDataPredictive(_0x25a034[0x0])){var _0x128d54=_0x3d68e9[_0x357b('0x6a')]=_0x3d68e9['talking']+_0x3d68e9[_0x357b('0x50')];var _0x57c05c=_0x3d68e9['dialPredictiveInterval']*0x3c;var _0x686328=_0x25a034[0x0][_0x357b('0x7e')]+_0x25a034[0x0]['predictiveIntervalAvgHoldtime'];var _0x175f8e=(_0x25a034[0x0][_0x357b('0x63')]+_0x25a034[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x25a034[0x0][_0x357b('0x7d')])/_0x25a034[0x0][_0x357b('0x7a')];_0x3d68e9['predictiveIntervalHitRate']=_0x175f8e>0x0?_0x175f8e:0x1;switch(_0x3d68e9[_0x357b('0x1c6')]){case _0x357b('0x1c7'):var _0x4e691d=_0x3d68e9[_0x357b('0x1bc')]/0x64;return _0x5c9586[_0x357b('0x1d3')](_0x128d54,_0x57c05c,_0x686328,_0x175f8e,_0x4e691d)[_0x357b('0xb3')](function(_0x4f5d4a){return _0x287b05(_0x4f5d4a);});case'agentBusyFactor':var _0x8ae26c=_0x3d68e9['dialPredictiveOptimizationPercentage']/0x64;return _0x5c9586[_0x357b('0x1d4')](_0x128d54,_0x57c05c,_0x686328,_0x175f8e,_0x8ae26c)[_0x357b('0xb3')](function(_0x490b68){return _0x287b05(_0x490b68);});default:return _0x556848(msgResponse(_0x357b('0x1d5'),'Failure',_0x357b('0x1d6')));}}else{return _0x556848(msgResponse('[getDataPredictive]','Failure','check\x20failure'));}});};};Dialer[_0x357b('0x1b')]['getDataPredictiveOld']=function(_0xbfd5ce){var _0x195e95=this;return function(_0x1e0d47){return new BPromise(function(_0x43b3f4,_0x1b2891){_[_0x357b('0x87')](_0xbfd5ce,_0x1e0d47[0x0]);if(checkGetDataPredictive(_0x1e0d47[0x0])){loggerPredictive[_0x357b('0x77')](JSON[_0x357b('0x4b')](_0x1e0d47[0x0]));if(_0xbfd5ce[_0x357b('0x1c6')]===_0x357b('0x1c7')){return _0x195e95[_0x357b('0xc3')](_0xbfd5ce['id'])[_0x357b('0xb3')](function(_0x4a9435){var _0x1c2a46=_0xbfd5ce['loggedIn']-_0x4a9435[0x0]['outboundQueuePauses'];var _0x1c9870=_0xbfd5ce['dialPredictiveInterval']*0x3c;var _0x486164=_0x1e0d47[0x0][_0x357b('0x7e')]+_0x1e0d47[0x0][_0x357b('0x64')];var _0xc89b21=(_0x1e0d47[0x0][_0x357b('0x63')]+_0x1e0d47[0x0][_0x357b('0x65')]+_0x1e0d47[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1e0d47[0x0]['predictiveIntervalTotalCalls'];var _0x87ac78=_0xbfd5ce[_0x357b('0x1bc')]/0x64;_0xbfd5ce[_0x357b('0x1d7')]=_0x4a9435[0x0][_0x357b('0x1d8')]||0x0;_0xbfd5ce['predictiveIntervalHitRate']=_0xc89b21>0x0?_0xc89b21:0x1;return _0x195e95[_0x357b('0x1d3')](_0x1c2a46,_0x1c9870,_0x486164,_0xc89b21,_0x87ac78);})[_0x357b('0xb3')](function(_0x445c09){return _0x43b3f4(_0x445c09);})[_0x357b('0xad')](function(_0x5a89c6){return _0x1b2891(msgResponse(_0x357b('0x1d9'),_0x357b('0x13b'),JSON['stringify'](_0x5a89c6)));});}if(_0xbfd5ce[_0x357b('0x1c6')]===_0x357b('0x1da')){return _0x195e95[_0x357b('0xc3')](_0xbfd5ce['id'])[_0x357b('0xb3')](function(_0x298d07){var _0x2850ed=_0xbfd5ce[_0x357b('0x51')]-_0x298d07[0x0][_0x357b('0x1d8')];var _0x1e76bb=_0xbfd5ce[_0x357b('0x1c4')]*0x3c;var _0x4a64af=_0x1e0d47[0x0][_0x357b('0x7e')]+_0x1e0d47[0x0][_0x357b('0x64')];var _0x51febf=(_0x1e0d47[0x0][_0x357b('0x63')]+_0x1e0d47[0x0][_0x357b('0x65')]+_0x1e0d47[0x0][_0x357b('0x7d')])/_0x1e0d47[0x0][_0x357b('0x7a')];var _0x4c2e3b=_0xbfd5ce[_0x357b('0x1bc')]/0x64;_0xbfd5ce['predictiveIntervalPauses']=_0x298d07[0x0][_0x357b('0x1d8')]||0x0;_0xbfd5ce[_0x357b('0x68')]=_0x51febf>0x0?_0x51febf:0x1;return _0x195e95[_0x357b('0x1d4')](_0x2850ed,_0x1e76bb,_0x4a64af,_0x51febf,_0x4c2e3b);})[_0x357b('0xb3')](function(_0x28bf8c){return _0x43b3f4(_0x28bf8c);})[_0x357b('0xad')](function(_0x38e33d){return _0x1b2891(msgResponse(_0x357b('0x1d9'),_0x357b('0x13b'),JSON['stringify'](_0x38e33d)));});}}else{return _0x1b2891(msgResponse('[getDataPredictive]',_0x357b('0x13b'),'check\x20failure'));}});};};Dialer[_0x357b('0x1b')]['startMethodPredictive']=function(_0xd2a3db){var _0x4fec6a=this;return function(){var _0x243c76=0x0;var _0x258f34=Math[_0x357b('0x1c0')](_0xd2a3db[_0x357b('0x6d')]*0x3e8);if(_0x258f34>0x0){_0x258f34=_0x258f34<0x64?0x64:_0x258f34;loggerPredictive[_0x357b('0x77')](_0xd2a3db['name'],_0x357b('0x1db'),_0x258f34,_0x357b('0x4c'));_0xd2a3db[_0x357b('0x8b')]=setInterval(function(){_0x4fec6a[_0x357b('0x8b')](_0xd2a3db);loggerPredictiveCalls[_0x357b('0x77')]('[handlePredictive]',_0x243c76+=0x1);},_0x258f34);}else{loggerPredictive[_0x357b('0x77')](_0xd2a3db[_0x357b('0x41')],_0x357b('0x1dc'));}};};Dialer[_0x357b('0x1b')][_0x357b('0x1dd')]=function(_0x12073b,_0x194434){var _0x415c04=this;return function(_0x479f66){if(_[_0x357b('0x49')](_0x479f66)){if(_[_0x357b('0xda')](_0x194434[_0x357b('0xd0')])||!_0x194434[_0x357b('0x1de')]){if(_0x12073b[_0x357b('0x58')]===_0x357b('0x14c')){_0x12073b[_0x357b('0x125')]=_[_0x357b('0x3f')](_0x12073b['queueStatusComplete'])?!![]:_0x12073b[_0x357b('0x125')];var _0x170eb0=uuid['v4']();_0x415c04[_0x357b('0xaa')][_0x170eb0]=new Action(_0x12073b,_0x194434,_0x170eb0);loggerBooked['info'](_0x357b('0x1df'),_0x170eb0,_0x357b('0x1e0'),JSON[_0x357b('0x4b')](_0x12073b[_0x357b('0x125')]),_0x357b('0x1e1'),_0x12073b[_0x357b('0x41')]);if(_0x12073b[_0x357b('0x125')]){_0x12073b[_0x357b('0x125')]=![];_0x415c04[_0x357b('0x2c')][_0x415c04[_0x357b('0xaa')][_0x170eb0][_0x357b('0xb0')]]=[];ami[_0x357b('0xab')]({'actionid':_0x170eb0,'action':'queuestatus','queue':_0x12073b['name']})[_0x357b('0xad')](function(_0x356fd0){_0x415c04[_0x357b('0xaf')](_0x12073b);_0x415c04[_0x357b('0xbc')]({'active':![],'ContactId':_0x415c04[_0x357b('0xaa')][_0x170eb0]['ContactId'],'ListId':_0x415c04[_0x357b('0xaa')][_0x170eb0]['ListId'],'VoiceQueueId':_0x415c04[_0x357b('0xaa')][_0x170eb0][_0x357b('0xd1')]||undefined,'CampaignId':_0x415c04[_0x357b('0xaa')][_0x170eb0][_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x415c04[_0x357b('0xaa')][_0x170eb0];});}else{loggerBooked[_0x357b('0x77')](_0x357b('0x1e2'),JSON[_0x357b('0x4b')](_0x12073b[_0x357b('0x125')]),'Queue:\x20',_0x12073b['name']);_0x415c04[_0x357b('0xaf')](_0x12073b);_0x415c04[_0x357b('0xbc')]({'active':![],'ContactId':_0x415c04['actions'][_0x170eb0][_0x357b('0xce')],'ListId':_0x415c04[_0x357b('0xaa')][_0x170eb0][_0x357b('0xcf')],'VoiceQueueId':_0x415c04['actions'][_0x170eb0][_0x357b('0xd1')]||undefined,'CampaignId':_0x415c04[_0x357b('0xaa')][_0x170eb0][_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch(_0x357b('0x1e3')));delete _0x415c04[_0x357b('0xaa')][_0x170eb0];}}else{return _0x415c04[_0x357b('0x15c')](_0x12073b,_0x194434);}}else{if(getDiff(_0x194434[_0x357b('0x1e4')])<_0x12073b[_0x357b('0x1e5')]*0x3c){if(_0x194434[_0x357b('0x1e6')]&&!_0x194434[_0x357b('0x1e6')][_0x357b('0x1e7')]){_0x415c04['preview']['run'](_0x194434['id'])[_0x357b('0x1e')](function(){_0x415c04['updateOriginated'](_0x12073b);});}else{_0x415c04[_0x357b('0xbe')]({'active':![]},_0x194434['id'],0x1)[_0x357b('0x1e')](function(){console[_0x357b('0x19b')](_0x357b('0x1e8'));_0x415c04['updateOriginated'](_0x12073b);});}}else{_0x12073b['outboundReCallsDay']+=0x1;_0x415c04[_0x357b('0xaf')](_0x12073b);if(_0x12073b['dialRecallInQueue']){_0x415c04['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x194434[_0x357b('0xce')],'ListId':_0x194434[_0x357b('0xcf')],'VoiceQueueId':_0x194434[_0x357b('0xd1')]||undefined,'CampaignId':_0x194434[_0x357b('0xd2')]||undefined})[_0x357b('0xad')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x415c04['createHistory'](createObjHistory(_0x12073b,_0x194434,_0x357b('0x1e9'),0x17,_0x357b('0x1ea')))[_0x357b('0xad')](loggerCatch(_0x357b('0x1eb')));}else{_0x415c04[_0x357b('0xcc')](createObjHistory(_0x12073b,_0x194434,_0x357b('0x1ec'),0x16,'RecallFailedTimeout'),_0x357b('0x1ed'),_0x357b('0x1ee'));}}}}else{_0x12073b[_0x357b('0x5b')]+=0x1;_0x415c04['saveInDb'](createObjHistory(_0x12073b,_0x194434,_0x357b('0x1ef'),0xd,_0x357b('0x1f0')),_0x357b('0x1f1'),_0x357b('0x1f2'));throw'inBlackList';}};};Dialer['prototype'][_0x357b('0x151')]=function(_0x39612a){var _0x4bb593=this;var _0x12d127=[];var _0x1e68e9=_0x39612a[_0x357b('0x1f3')]-_0x39612a[_0x357b('0x6b')]-_0x39612a[_0x357b('0x1f4')];emitCampaignSummary(_0x39612a);if(_0x1e68e9>0x0){if(_0x1e68e9>this[_0x357b('0x24')]){_0x1e68e9=this[_0x357b('0x24')];}_0x39612a[_0x357b('0x1f4')]+=_0x1e68e9;this[_0x357b('0xc2')](_0x39612a['id'],_0x1e68e9,_0x39612a['dialOrderByScheduledAt'])['then'](function(_0x490f8e){_0x39612a[_0x357b('0x1f4')]-=_0x1e68e9;_0x39612a[_0x357b('0x1f4')]=_0x39612a['temp']>0x0?_0x39612a[_0x357b('0x1f4')]:0x0;if(!checkContactEmpty(_0x490f8e)){_0x39612a[_0x357b('0x42')]=_0x357b('0x9b');logger[_0x357b('0x77')](_0x357b('0x1f5')+_0x39612a[_0x357b('0x41')]);}else{_0x39612a[_0x357b('0x6b')]+=_0x490f8e[_0x357b('0x94')];_0x39612a[_0x357b('0x42')]=_0x357b('0x1f6');for(var _0x426390=0x0;_0x426390<_0x490f8e['length'];_0x426390+=0x1){_0x39612a[_0x357b('0x1f7')]+=0x1;if(_['isNil'](_0x490f8e[_0x426390])||_[_0x357b('0xda')](_0x490f8e[_0x426390][_0x357b('0x160')])||_[_0x357b('0xda')](_0x490f8e[_0x426390][_0x357b('0x160')][_0x357b('0x161')])){_0x4bb593[_0x357b('0x1f8')](_0x357b('0x1f9'),_0x39612a,_0x490f8e[_0x426390]);}else{_0x4bb593['checkIsBlackListIvr'](_[_0x357b('0xcd')](_0x490f8e[_0x426390],['CampaignId',_0x357b('0x1fa')]))['then'](_0x4bb593[_0x357b('0x1dd')](_0x39612a,_0x490f8e[_0x426390]))[_0x357b('0xad')](_0x4bb593[_0x357b('0xca')](_0x357b('0x1fb'),_0x39612a));}}}})[_0x357b('0xad')](loggerGetContactDialer(_0x357b('0x1fc'),_0x39612a,_0x1e68e9));}};Dialer[_0x357b('0x1b')][_0x357b('0x14d')]=function(_0x2b2a4f,_0x1166a0){var _0x5d99ef=this;var _0x4e237a=[];var _0x113575=_0x1166a0>=0x1?_0x1166a0:0x1;var _0x2c1ac4=[];if(_0x2b2a4f[_0x357b('0x58')]==='booked'){_0x113575=0x1;}var _0x18e92a=Math['floor'](_0x2b2a4f[_0x357b('0x50')]*_0x113575)-_0x2b2a4f['originated']-_0x2b2a4f[_0x357b('0x1f4')];emitVoiceQueueSummary(_0x2b2a4f);if(_0x2b2a4f['dialLimitQueue']>0x0){var _0x21e868=_0x2b2a4f['dialLimitQueue']-_0x2b2a4f[_0x357b('0x6b')]-_0x2b2a4f[_0x357b('0x9e')]-_0x2b2a4f[_0x357b('0x1f4')]-_0x2b2a4f[_0x357b('0x9f')];if(_0x18e92a>_0x21e868){_0x18e92a=_0x21e868;}}if(_0x18e92a>0x0){if(_0x2b2a4f[_0x357b('0x58')]===_0x357b('0x14c')){_0x18e92a=0x1;}if(_0x18e92a>this['maxNumberOriginate']){_0x18e92a=this[_0x357b('0x24')];}_0x2b2a4f[_0x357b('0x1f4')]+=_0x18e92a;for(var _0x2c9e73 in this[_0x357b('0x22')]){if(this[_0x357b('0x22')]['hasOwnProperty'](_0x2c9e73)){if(this[_0x357b('0x22')][_0x2c9e73][_0x357b('0xa5')]===_0x357b('0x1fd')&&this['agents'][_0x2c9e73][_0x357b('0xd6')]===_0x357b('0xd7')){_0x4e237a['push'](this[_0x357b('0x22')][_0x2c9e73]['id']);}}}this['getContactDialer'](_0x2b2a4f['id'],_0x4e237a,_0x18e92a,_0x2b2a4f[_0x357b('0x1fe')])['then'](function(_0x507322){_0x2b2a4f[_0x357b('0x1f4')]-=_0x18e92a;_0x2b2a4f['temp']=_0x2b2a4f['temp']>0x0?_0x2b2a4f['temp']:0x0;if(!checkContactEmpty(_0x507322)){_0x5d99ef[_0x357b('0xb4')](_0x2b2a4f)['then'](sendMessageReschedule(_0x2b2a4f))[_0x357b('0xad')](loggerCatch('[countReScheduled]\x20'));}else{_0x2b2a4f[_0x357b('0x6b')]+=_0x507322[_0x357b('0x94')];_0x2b2a4f['message']=_0x2b2a4f[_0x357b('0x58')]===_0x357b('0x14c')?_0x357b('0x166'):_0x357b('0x1f6');for(var _0x533cae=0x0;_0x533cae<_0x507322[_0x357b('0x94')];_0x533cae+=0x1){if(_[_0x357b('0xda')](_0x507322[_0x533cae])||_[_0x357b('0xda')](_0x507322[_0x533cae][_0x357b('0x160')])||_['isNil'](_0x507322[_0x533cae][_0x357b('0x160')][_0x357b('0x161')])){_0x5d99ef[_0x357b('0x1f8')](_0x357b('0x1f9'),_0x2b2a4f,_0x507322[_0x533cae]);}else{_0x5d99ef[_0x357b('0xb5')](_['pick'](_0x507322[_0x533cae],['VoiceQueueId',_0x357b('0x1fa')]))['then'](_0x5d99ef[_0x357b('0x1dd')](_0x2b2a4f,_0x507322[_0x533cae]))['catch'](_0x5d99ef[_0x357b('0xca')](_0x357b('0x1f9'),_0x2b2a4f));}}}})[_0x357b('0xad')](loggerGetContactDialer('[getContactDialer2]',_0x2b2a4f,_0x18e92a));}};Dialer['prototype'][_0x357b('0x8b')]=function(_0x51b599){var _0x544306=this;if(_0x51b599['dialLimitQueue']>0x0){var _0x81b3b7=_0x51b599[_0x357b('0x1ff')]-_0x51b599[_0x357b('0x6b')]-_0x51b599[_0x357b('0x9e')];if(_0x81b3b7>0x0){this[_0x357b('0x200')](_0x51b599);}else{loggerPredictiveCalls[_0x357b('0x77')](_0x357b('0x201'));}}else{this['tryOriginatePredictive'](_0x51b599);}};Dialer[_0x357b('0x1b')][_0x357b('0x200')]=function(_0x301192){var _0x38819b=this;var _0x1c21c0=[];_0x301192[_0x357b('0x6b')]+=0x1;for(var _0x3af1fb in this[_0x357b('0x22')]){if(this[_0x357b('0x22')]['hasOwnProperty'](_0x3af1fb)){if(this[_0x357b('0x22')][_0x3af1fb][_0x357b('0xa5')]===_0x357b('0x1fd')&&this[_0x357b('0x22')][_0x3af1fb]['status']===_0x357b('0xd7')){_0x1c21c0[_0x357b('0x123')](this[_0x357b('0x22')][_0x3af1fb]['id']);}}}this[_0x357b('0xc0')](_0x301192['id'],_0x1c21c0,0x1,_0x301192[_0x357b('0x1fe')])['then'](function(_0x17c2cb){if(!checkContactEmpty(_0x17c2cb)){checkContactLowerLimitOriginate(_0x301192,0x1,0x0);_0x38819b[_0x357b('0xb4')](_0x301192)[_0x357b('0xb3')](sendMessageReschedule(_0x301192))['catch'](loggerCatch(_0x357b('0x202')));}else{_0x301192[_0x357b('0x42')]=_0x357b('0x1f6');if(_[_0x357b('0xda')](_0x17c2cb[0x0])||_[_0x357b('0xda')](_0x17c2cb[0x0][_0x357b('0x160')])||_[_0x357b('0xda')](_0x17c2cb[0x0][_0x357b('0x160')][_0x357b('0x161')])){_0x38819b[_0x357b('0x1f8')](_0x357b('0x1f9'),_0x301192,_0x17c2cb[0x0]);}else{_0x38819b[_0x357b('0xb5')](_['pick'](_0x17c2cb[0x0],[_0x357b('0xd1'),_0x357b('0x1fa')]))[_0x357b('0xb3')](_0x38819b[_0x357b('0x1dd')](_0x301192,_0x17c2cb[0x0]))[_0x357b('0xad')](_0x38819b[_0x357b('0xca')](_0x357b('0x203'),_0x301192));}}})[_0x357b('0xad')](loggerGetContactDialer(_0x357b('0x204'),_0x301192,0x1));emitVoiceQueueSummary(_0x301192);};Dialer[_0x357b('0x1b')][_0x357b('0x1d3')]=function(_0x40da40,_0x425299,_0x3adb63,_0x1fc14c,_0x2e32dd,_0x164580){loggerPredictive[_0x357b('0x77')](_0x357b('0x205'));loggerPredictive[_0x357b('0x77')](_0x357b('0x206'),_0x40da40);loggerPredictive[_0x357b('0x77')](_0x357b('0x207'),_0x425299);loggerPredictive[_0x357b('0x77')]('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',_0x3adb63);loggerPredictive['info'](_0x357b('0x208'),_0x1fc14c);loggerPredictive['info'](_0x357b('0x209'),_0x2e32dd);loggerPredictive['info'](_0x357b('0x7f'));return new BPromise(function(_0x48dea3,_0x59c4a6){if(_0x40da40<=0x0||isNaN(_0x40da40)){return _0x59c4a6(msgResponse('[abandonmentRate]',_0x357b('0x4a'),_0x357b('0x20a')+_0x40da40));}if(_0x3adb63<=0x0||isNaN(_0x3adb63)){return _0x59c4a6(msgResponse(_0x357b('0x20b'),_0x357b('0x4a'),_0x357b('0x20c')+_0x3adb63));}if(_0x1fc14c<=0x0||isNaN(_0x1fc14c)){return _0x59c4a6(msgResponse(_0x357b('0x20b'),_0x357b('0x4a'),_0x357b('0x20d')+_0x1fc14c));}if(_0x425299<=0x0||isNaN(_0x425299)){return _0x59c4a6(msgResponse(_0x357b('0x20b'),_0x357b('0x4a'),'interval\x20=\x20'+_0x425299));}if(_0x2e32dd<=0x0||isNaN(_0x2e32dd)){return _0x59c4a6(msgResponse('[abandonmentRate]',_0x357b('0x4a'),'Amax\x20=\x20'+_0x2e32dd));}_0x164580=_0x164580||0x0;var _0x50a515=0x1/_0x3adb63;var _0xb9a86c=0x0;var _0x22eb10=0x0;var _0x234767=0x0;var _0x516f7e=0x0;for(var _0x1b194c=0x0;_0x234767<_0x2e32dd;_0x1b194c+=0x1){_0x22eb10=_0x1b194c/_0x425299;_0xb9a86c=(_0x1fc14c*_0x22eb10+_0x164580)/_0x50a515;_0x234767=erlangb(_0xb9a86c,_0x40da40);_0x516f7e=_0xb9a86c/_0x40da40*(0x1-erlangb(_0xb9a86c,_0x40da40));}return _0x48dea3({'erlangCalls':_0x1b194c,'erlangCallToSecond':_0x425299/_0x1b194c,'erlangAbandonmentRate':_0x234767,'erlangBusyFactor':_0x516f7e});});};Dialer[_0x357b('0x1b')][_0x357b('0x1d4')]=function(_0x479ae8,_0x3a431b,_0x59aae4,_0x10140c,_0xa07d79,_0x88c259){loggerPredictive[_0x357b('0x77')](_0x357b('0x20e'));loggerPredictive[_0x357b('0x77')]('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',_0x479ae8);loggerPredictive[_0x357b('0x77')](_0x357b('0x207'),_0x3a431b);loggerPredictive['info'](_0x357b('0x20f'),_0x59aae4);loggerPredictive[_0x357b('0x77')]('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',_0x10140c);loggerPredictive[_0x357b('0x77')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa07d79);loggerPredictive[_0x357b('0x77')]('---------------------------');return new BPromise(function(_0x2c4485,_0x50bf32){if(_0x479ae8<=0x0||isNaN(_0x479ae8)){return _0x50bf32(msgResponse(_0x357b('0x210'),_0x357b('0x4a'),'m\x20=\x20'+_0x479ae8));}if(_0x59aae4<=0x0||isNaN(_0x59aae4)){return _0x50bf32(msgResponse('[busyFactor]',_0x357b('0x4a'),_0x357b('0x20c')+_0x59aae4));}if(_0x10140c<=0x0||isNaN(_0x10140c)){return _0x50bf32(msgResponse(_0x357b('0x210'),_0x357b('0x4a'),_0x357b('0x20d')+_0x10140c));}if(_0x3a431b<=0x0||isNaN(_0x3a431b)){return _0x50bf32(msgResponse(_0x357b('0x210'),_0x357b('0x4a'),_0x357b('0x211')+_0x3a431b));}if(_0xa07d79<=0x0||isNaN(_0xa07d79)){return _0x50bf32(msgResponse(_0x357b('0x210'),_0x357b('0x4a'),_0x357b('0x212')+_0xa07d79));}_0x88c259=_0x88c259||0x0;var _0x3163b9=0x1/_0x59aae4;var _0x329aca=0x0;var _0x54c29a=0x0;var _0x560cf8=0x0;var _0x2070d2=0x0;for(var _0x594914=0x0;_0x2070d2<_0xa07d79;_0x594914+=0x1){_0x54c29a=_0x594914/_0x3a431b;_0x329aca=(_0x10140c*_0x54c29a+_0x88c259)/_0x3163b9;_0x560cf8=erlangb(_0x329aca,_0x479ae8);_0x2070d2=_0x329aca/_0x479ae8*(0x1-erlangb(_0x329aca,_0x479ae8));}return _0x2c4485({'erlangCalls':_0x594914,'erlangCallToSecond':_0x3a431b/_0x594914,'erlangAbandonmentRate':_0x560cf8,'erlangBusyFactor':_0x2070d2});});};module['exports']=Dialer; \ No newline at end of file +var _0x6e9a=['loopCampaigns','loopClearZombieChannels','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','ivr','format','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startProgressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','preview','string','isEmpty','\x22%s\x22\x20<%s>','inspect','error','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','waiting','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ListId','UserId','VoiceQueueId','CampaignId','Success','active','SIP/%s','reachable','unmonitored','uniqueid','exten','dialAMDActive','HANGUP','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','countmachineretry','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countabandonedretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','syncAgentComplete','reason','agiafterat','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','countglobal','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkDialMethod','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialer','getCaller','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateTimeout','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','NoSuchNumber','EMITTING\x20status_nosuchnumber\x20for','nosuchnumber','custom:status_nosuchnumber','buildObj','NoAnswer','log','NO\x20ANSWER\x20evt','NO\x20ANSWER\x20entity','NO\x20ANSWER\x20history','noanswer','[syncAgentComplete][createHistory][3]','Busy','EMITTING\x20status_busy\x20for','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','reason\x2020\x20agentreject','Global','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','[CatchErlangB]','outboundQueuePauses','predictiveIntervalPauses','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','Agent','voicePause','Contact\x20updated','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','ACTIVE','[actionOriginate]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','RUNNING','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x6e9a,0x1dc));var _0xa6e9=function(_0x5d5f03,_0x4d8cfc){_0x5d5f03=_0x5d5f03-0x0;var _0x4e1cb8=_0x6e9a[_0x5d5f03];return _0x4e1cb8;};'use strict';var util=require(_0xa6e9('0x0'));var _=require('lodash');var BPromise=require(_0xa6e9('0x1'));var uuid=require(_0xa6e9('0x2'));var moment=require(_0xa6e9('0x3'));var rr=require('rr');var md5=require(_0xa6e9('0x4'));var Redis=require(_0xa6e9('0x5'));var ut=require(_0xa6e9('0x6'));var config=require(_0xa6e9('0x7'));var logger=require(_0xa6e9('0x8'))('dialer');var loggerBooked=require(_0xa6e9('0x8'))('booked');var loggerPredictive=require('../../../config/logger')(_0xa6e9('0x9'));var loggerPredictiveCalls=require('../../../config/logger')(_0xa6e9('0xa'));var loggerSyncQueueSummary=require(_0xa6e9('0x8'))(_0xa6e9('0xb'));var ami=require(_0xa6e9('0xc'));config[_0xa6e9('0xd')]=_[_0xa6e9('0xe')](config['redis'],{'host':_0xa6e9('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa6e9('0xd')]));var cmHopper=require(_0xa6e9('0x10'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xa6e9('0x11'));var cmHopperBlack=require(_0xa6e9('0x12'));var voiceQueueRt=require(_0xa6e9('0x13'));var Action=require(_0xa6e9('0x14'));var History=require(_0xa6e9('0x15'));var Final=require(_0xa6e9('0x16'));var AgentComplete=require(_0xa6e9('0x17'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xa6e9('0x18'));var ipAgi=process[_0xa6e9('0x19')][_0xa6e9('0x1a')]||'127.0.0.1';var strategy={'rrmemory':_0xa6e9('0x1b'),'roundrobin':_0xa6e9('0x1c')};var Sequence=function(){};Sequence[_0xa6e9('0x1d')][_0xa6e9('0x1e')]=function(_0x17a92d){this[_0xa6e9('0x1f')]=this[_0xa6e9('0x1f')]?this['tail'][_0xa6e9('0x20')](_0x17a92d):_0x17a92d();};function Dialer(_0x536abc,_0x87482e){this[_0xa6e9('0x21')]=new Sequence();this['preview']=_0x87482e;this[_0xa6e9('0x22')]=_0x536abc['voiceQueues'];this[_0xa6e9('0x23')]=_0x536abc[_0xa6e9('0x23')];this[_0xa6e9('0x24')]=_0x536abc[_0xa6e9('0x24')];this[_0xa6e9('0x25')]=_0x536abc[_0xa6e9('0x25')];this[_0xa6e9('0x26')]=config[_0xa6e9('0x26')]||0x2;this[_0xa6e9('0x27')]={};this['actions']={};this['contactsId']={};this[_0xa6e9('0x28')]={};this[_0xa6e9('0x29')]={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0xa6e9('0x2a')]={};this[_0xa6e9('0x2b')]={};ami['on'](_0xa6e9('0x2c'),this[_0xa6e9('0x2d')][_0xa6e9('0x2e')](this));ami['on'](_0xa6e9('0x2f'),this[_0xa6e9('0x30')]['bind'](this));ami['on']('originateresponse',this[_0xa6e9('0x31')]['bind'](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0xa6e9('0xb')]['bind'](this));ami['on'](_0xa6e9('0x32'),this[_0xa6e9('0x33')][_0xa6e9('0x2e')](this));ami['on'](_0xa6e9('0x34'),this[_0xa6e9('0x35')][_0xa6e9('0x2e')](this));ami['on'](_0xa6e9('0x36'),this[_0xa6e9('0x37')][_0xa6e9('0x2e')](this));ami['on'](_0xa6e9('0x38'),this[_0xa6e9('0x39')][_0xa6e9('0x2e')](this));ami['on'](_0xa6e9('0x3a'),this[_0xa6e9('0x3b')]['bind'](this));this[_0xa6e9('0x3c')]();this[_0xa6e9('0x3d')]();}function isNotNull(_0x1e1b4e){return _0x1e1b4e!==null&&!_['isUndefined'](_0x1e1b4e);}function checkIsLoggedIn(_0x57dd44,_0x573cfd){return function(){if(_0x573cfd<=0x0){_0x57dd44['message']=_0xa6e9('0x3e');throw _0x57dd44[_0xa6e9('0x3f')]+_0xa6e9('0x40');}};}function isActive(_0x339078){return _0x339078;}function checkIsActive(_0x7f3636,_0xc698bf){return function(){if(!isActive(_0xc698bf)){_0x7f3636[_0xa6e9('0x41')]=_0xa6e9('0x42');throw _0x7f3636[_0xa6e9('0x3f')]+_0xa6e9('0x43');}};}function checkInterval(_0x396cc2){return function(){if(!isNotNull(_0x396cc2['Interval'])){_0x396cc2[_0xa6e9('0x41')]=_0xa6e9('0x44');throw _0x396cc2[_0xa6e9('0x3f')]+_0xa6e9('0x45');}if(!isNotNull(_0x396cc2[_0xa6e9('0x46')][_0xa6e9('0x47')])){_0x396cc2[_0xa6e9('0x41')]=_0xa6e9('0x44');throw _0x396cc2[_0xa6e9('0x3f')]+_0xa6e9('0x45');}if(!isNotNull(_['isEmpty'](_0x396cc2[_0xa6e9('0x46')][_0xa6e9('0x47')]))){_0x396cc2['message']=_0xa6e9('0x44');throw _0x396cc2[_0xa6e9('0x3f')]+_0xa6e9('0x45');}};}function msgResponse(_0x5cf21f,_0x332650,_0x212f72){return{'action':_0x5cf21f,'response':_0x332650,'message':_0x212f72,'stack':_0x212f72};}function myreject(_0x36569d){return function(_0x2b6191){return _0x36569d(msgResponse(_0xa6e9('0x48'),_0xa6e9('0x49'),JSON[_0xa6e9('0x4a')](_0x2b6191)));};}function getSeconds(_0x120325,_0x27e145){var _0x32714e=moment(_0x120325)[_0xa6e9('0x4b')](0x0);var _0xb7e3af=moment(_0x27e145)['milliseconds'](0x0);return _0x32714e[_0xa6e9('0x4c')](_0xb7e3af,_0xa6e9('0x4d'));}function emit(_0x583be3,_0x3febf6,_0x352cf3){io['to'](_0x583be3)[_0xa6e9('0x4e')](_0x3febf6,_0x352cf3);}function emitVoiceQueueSummary(_0x49b1fc){if(_0x49b1fc[_0xa6e9('0x4f')]==='outbound'){var _0x5ca6b6={'id':_0x49b1fc['id'],'name':_0x49b1fc[_0xa6e9('0x3f')],'strategy':_0x49b1fc[_0xa6e9('0x50')],'answered':_0x49b1fc['answered'],'available':_0x49b1fc[_0xa6e9('0x51')],'loggedIn':_0x49b1fc[_0xa6e9('0x52')],'pTalking':_0x49b1fc['pTalking'],'sumBillable':_0x49b1fc[_0xa6e9('0x53')],'sumDuration':_0x49b1fc[_0xa6e9('0x54')],'sumHoldTime':_0x49b1fc[_0xa6e9('0x55')]||0x0,'talking':_0x49b1fc['talking'],'total':_0x49b1fc[_0xa6e9('0x56')],'type':_0x49b1fc['type'],'unmanaged':_0x49b1fc[_0xa6e9('0x57')],'abandoned':_0x49b1fc[_0xa6e9('0x58')],'waiting':_0x49b1fc['waiting'],'loggedInDb':_0x49b1fc['loggedInDb'],'dialActive':_0x49b1fc[_0xa6e9('0x59')],'dialMethod':_0x49b1fc[_0xa6e9('0x5a')],'dialOriginateCallerIdName':_0x49b1fc[_0xa6e9('0x5b')],'dialOriginateCallerIdNumber':_0x49b1fc['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x49b1fc['dialOriginateTimeout'],'dialPrefix':_0x49b1fc[_0xa6e9('0x5c')],'outboundAnswerAgiCallsDay':_0x49b1fc[_0xa6e9('0x5d')],'outboundAnswerCallsDay':_0x49b1fc[_0xa6e9('0x5e')],'outboundBlacklistCallsDay':_0x49b1fc[_0xa6e9('0x5f')],'outboundBusyCallsDay':_0x49b1fc[_0xa6e9('0x60')],'outboundCongestionCallsDay':_0x49b1fc[_0xa6e9('0x61')],'outboundDropCallsDayACS':_0x49b1fc[_0xa6e9('0x62')],'outboundDropCallsDayCallersExit':_0x49b1fc[_0xa6e9('0x63')],'outboundDropCallsDayTimeout':_0x49b1fc[_0xa6e9('0x64')],'outboundNoAnswerCallsDay':_0x49b1fc[_0xa6e9('0x65')],'outboundNoSuchCallsDay':_0x49b1fc[_0xa6e9('0x66')],'outboundOriginateFailureCallsDay':_0x49b1fc[_0xa6e9('0x67')],'outboundReCallsDay':_0x49b1fc['outboundReCallsDay'],'outboundRejectCallsDay':_0x49b1fc['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x49b1fc[_0xa6e9('0x68')],'predictiveIntervalAnsweredCalls':_0x49b1fc[_0xa6e9('0x69')],'predictiveIntervalAvgHoldtime':_0x49b1fc[_0xa6e9('0x6a')],'predictiveIntervalAvgTalktime':_0x49b1fc[_0xa6e9('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x49b1fc[_0xa6e9('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x49b1fc[_0xa6e9('0x6d')],'predictiveIntervalErlangCalls':_0x49b1fc['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x49b1fc['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x49b1fc['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x49b1fc[_0xa6e9('0x6e')],'predictiveIntervalPauses':_0x49b1fc['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x49b1fc[_0xa6e9('0x6f')],'predictiveIntervalTotalCalls':_0x49b1fc[_0xa6e9('0x70')],'message':_0x49b1fc[_0xa6e9('0x41')],'originated':_0x49b1fc[_0xa6e9('0x71')],'erlangCalls':_0x49b1fc[_0xa6e9('0x72')],'erlangCallToSecond':_0x49b1fc['erlangCallToSecond'],'erlangAbandonmentRate':_0x49b1fc[_0xa6e9('0x73')],'erlangBusyFactor':_0x49b1fc[_0xa6e9('0x74')],'startPredictive':_0x49b1fc['startPredictive'],'startProgressive':_0x49b1fc['startProgressive']};if(_0x49b1fc[_0xa6e9('0x75')]){_0x5ca6b6['Trunk']={'id':_0x49b1fc[_0xa6e9('0x75')]['id'],'name':_0x49b1fc['Trunk'][_0xa6e9('0x3f')],'active':_0x49b1fc['Trunk']['active'],'callerid':_0x49b1fc[_0xa6e9('0x75')]['callerid']};}if(_0x49b1fc[_0xa6e9('0x46')]){_0x5ca6b6[_0xa6e9('0x46')]={'id':_0x49b1fc[_0xa6e9('0x46')]['id'],'name':_0x49b1fc[_0xa6e9('0x46')][_0xa6e9('0x3f')]};}var _0xfcc88a=md5(JSON[_0xa6e9('0x4a')](_0x5ca6b6));if(_0x49b1fc[_0xa6e9('0x4')]!==_0xfcc88a){_0x49b1fc[_0xa6e9('0x4')]=_0xfcc88a;emit(util['format']('voice:queue:%s',_0x5ca6b6[_0xa6e9('0x3f')]),'voice_queue:save',_0x5ca6b6);}}}function emitCampaignSummary(_0x221aa7){if(_0x221aa7[_0xa6e9('0x4f')]===_0xa6e9('0x76')){emit(util[_0xa6e9('0x77')]('campaign:ivr:%s',_0x221aa7[_0xa6e9('0x3f')]),_0xa6e9('0x78'),_0x221aa7);}}function checkGetDataPredictive(_0x17fa09){if(isNotNull(_0x17fa09)){if(!_['isEmpty'](_0x17fa09)){loggerPredictive[_0xa6e9('0x79')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x7a'),_0x17fa09['predictiveIntervalTotalCalls']);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x7b'),_0x17fa09[_0xa6e9('0x69')]);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x7c'),_0x17fa09['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x7d'),_0x17fa09[_0xa6e9('0x6c')]);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x7e'),_0x17fa09[_0xa6e9('0x6a')]);loggerPredictive['info'](_0xa6e9('0x7f'),_0x17fa09['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xa6e9('0x80'));if(_0x17fa09[_0xa6e9('0x70')]>0x0){if(!_[_0xa6e9('0x81')](_0x17fa09['predictiveIntervalAvgTalktime'])&&_0x17fa09[_0xa6e9('0x6b')]>0x0){return!![];}else{loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x82'));}if(!_['isUndefined'](_0x17fa09[_0xa6e9('0x6a')])&&_0x17fa09[_0xa6e9('0x6a')]>0x0){return!![];}else{loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x83'));}}else{loggerPredictive[_0xa6e9('0x79')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x84'));}}else{loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x84'));}return![];}function mergeDataErlangB(_0x51a596){return function(_0x48f225){loggerPredictive[_0xa6e9('0x79')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x85'),_0x48f225[_0xa6e9('0x72')]);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x86'),_0x48f225[_0xa6e9('0x87')]);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x88'),_0x48f225[_0xa6e9('0x73')]);loggerPredictive[_0xa6e9('0x79')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x48f225[_0xa6e9('0x74')]);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x88'),_0x48f225[_0xa6e9('0x73')]);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x80'));_[_0xa6e9('0x89')](_0x51a596,_0x48f225);};}function getDiff(_0x439c22){var _0x357e98=moment()['milliseconds'](0x0);var _0x4222bc=moment(_0x439c22)[_0xa6e9('0x4b')](0x0);return _0x357e98['diff'](_0x4222bc,_0xa6e9('0x4d'));}function ifInterval(_0x1949d0,_0x23cfc6){if(_[_0xa6e9('0x81')](_0x23cfc6)){return![];}if(getDiff(_0x23cfc6)<_0x1949d0*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x23b59d){if(isNotNull(_0x23b59d)){if(!_[_0xa6e9('0x81')](_0x23b59d[_0xa6e9('0x8a')])){_0x23b59d[_0xa6e9('0x8a')]=undefined;loggerPredictive[_0xa6e9('0x79')](_0x23b59d['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xa6e9('0x81')](_0x23b59d[_0xa6e9('0x8b')])){_0x23b59d[_0xa6e9('0x8b')]=undefined;loggerPredictive[_0xa6e9('0x79')](_0x23b59d[_0xa6e9('0x3f')],_0xa6e9('0x8c'));}if(!_[_0xa6e9('0x81')](_0x23b59d[_0xa6e9('0x8d')])){clearInterval(_0x23b59d[_0xa6e9('0x8d')]);_0x23b59d[_0xa6e9('0x8d')]=undefined;loggerPredictive[_0xa6e9('0x79')](_0x23b59d[_0xa6e9('0x3f')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x26bdb0,_0xd930a7){if(_0xd930a7===0x0){return 0x0;}var _0x42cd0e=0x1;for(var _0x3478cd=0x1;_0x3478cd<=_0xd930a7;_0x3478cd+=0x1){_0x42cd0e=0x1+_0x42cd0e*_0x3478cd/_0x26bdb0;}return 0x1/_0x42cd0e;}function isVoiceQueueOutbound(_0x5f1c5f){return _0x5f1c5f===_0xa6e9('0x8e');}function isNotPreview(_0x1d0ced){return _0x1d0ced!==_0xa6e9('0x8f');}function isCampaignIvr(_0x2ff180){return _0x2ff180===_0xa6e9('0x76');}function getCallerId(_0x58efa9,_0x28cb7f,_0xe926fc){if(!_[_0xa6e9('0x81')](_0xe926fc)&&_0xa6e9('0x90')===typeof _0xe926fc&&!_['isEmpty'](_0xe926fc)){if(!_[_0xa6e9('0x81')](_0x28cb7f)&&_0xa6e9('0x90')===typeof _0x28cb7f&&!_[_0xa6e9('0x91')](_0x28cb7f)){return util[_0xa6e9('0x77')](_0xa6e9('0x92'),_0x28cb7f,_0xe926fc);}return util[_0xa6e9('0x77')]('\x22%s\x22\x20<%s>',_0xe926fc,_0xe926fc);}if(!_[_0xa6e9('0x81')](_0x58efa9)&&_0xa6e9('0x90')===typeof _0x58efa9&&!_[_0xa6e9('0x91')](_0x58efa9)){return _0x58efa9;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x578639,_0x2c7434){return function(_0x1b66f1){freeVariablesPredictive(_0x2c7434);emitVoiceQueueSummary(_0x2c7434);emitCampaignSummary(_0x2c7434);loggerSyncQueueSummary['error'](_0x578639,util[_0xa6e9('0x93')](_0x1b66f1,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x120ef8,_0x184c0d){return function(_0xc9a3c1){loggerPredictive[_0xa6e9('0x94')](_0x184c0d[_0xa6e9('0x3f')],_0x120ef8);loggerPredictive['error'](_0xc9a3c1[_0xa6e9('0x95')]);freeVariablesPredictive(_0x184c0d);};}function loggerCatch(_0x411372){return function(_0x1ff9b8){logger['error'](_0x411372,util[_0xa6e9('0x93')](_0x1ff9b8,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x485bae){return _0x485bae&&!_[_0xa6e9('0x81')](_0x485bae)&&_0x485bae[_0xa6e9('0x96')]>0x0;}function decremetOriginate(_0x278ee2){if(!_['isUndefined'](_0x278ee2)&&_0x278ee2!==null){if(_0x278ee2[_0xa6e9('0x97')]('originated')){if(_0x278ee2[_0xa6e9('0x71')]>0x0){_0x278ee2[_0xa6e9('0x71')]-=0x1;}else{logger[_0xa6e9('0x94')](_0xa6e9('0x98'));}}}else{logger[_0xa6e9('0x94')](_0xa6e9('0x99'));}}function checkContactLowerLimitOriginate(_0xc14a64,_0x5c661a,_0x456676){if(_0x5c661a>_0x456676){for(var _0x426528=0x0;_0x426528<_0x5c661a-_0x456676;_0x426528+=0x1){decremetOriginate(_0xc14a64);}}}function loggerGetContactDialer(_0x4efade,_0x13628e,_0x413dcb){return function(_0x1d2a77){checkContactLowerLimitOriginate(_0x13628e,_0x413dcb,0x0);logger[_0xa6e9('0x94')](_0x4efade,util[_0xa6e9('0x93')](_0x1d2a77,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3e03c3){return function(_0x465277){if(isNotNull(_0x465277)&&isNotNull(_0x465277[0x0])){if(_0x465277[0x0][_0xa6e9('0x9a')]>0x0){_0x3e03c3[_0xa6e9('0x41')]=_0xa6e9('0x9b');logger[_0xa6e9('0x79')](_0xa6e9('0x9c')+_0x3e03c3[_0xa6e9('0x3f')],_0x465277[0x0][_0xa6e9('0x9a')],'contacts');}else{_0x3e03c3[_0xa6e9('0x41')]=_0xa6e9('0x9d');logger[_0xa6e9('0x79')](_0xa6e9('0x9e')+_0x3e03c3['name']);}}};}function notSendMessagesQueue(_0x26a5a8){if(_0x26a5a8[_0xa6e9('0x9f')]){freeVariablesPredictive(_0x26a5a8);if(_0x26a5a8['originated']===0x0&&_0x26a5a8[_0xa6e9('0xa0')]===0x0&&_0x26a5a8[_0xa6e9('0xa1')]===0x0&&(_0x26a5a8[_0xa6e9('0xa2')]||0x0)===0x0){_0x26a5a8[_0xa6e9('0x9f')]=![];_0x26a5a8[_0xa6e9('0x51')]=0x0;_0x26a5a8[_0xa6e9('0x41')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xa6e9('0xa3'),_0x26a5a8[_0xa6e9('0x3f')],_0xa6e9('0xa4'));}else{_0x26a5a8[_0xa6e9('0x41')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xa6e9('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x26a5a8[_0xa6e9('0x3f')],_0xa6e9('0xa5'));}emitVoiceQueueSummary(_0x26a5a8);}}function notSendMessagesCampaign(_0x572a72){if(_0x572a72[_0xa6e9('0x9f')]){if(_0x572a72['originated']===0x0){_0x572a72[_0xa6e9('0x9f')]=![];_0x572a72[_0xa6e9('0x41')]=_0xa6e9('0x42');loggerSyncQueueSummary['error'](_0xa6e9('0xa6'),_0x572a72[_0xa6e9('0x3f')],_0xa6e9('0xa4'));}else{_0x572a72[_0xa6e9('0x41')]=_0xa6e9('0xa7');loggerSyncQueueSummary[_0xa6e9('0x94')](_0xa6e9('0xa6'),_0x572a72[_0xa6e9('0x3f')],_0xa6e9('0xa5'));}emitCampaignSummary(_0x572a72);}}function createObjHistory(_0x41f440,_0x498643,_0x3010b3,_0x12ec60,_0x348b32){_0x41f440[_0xa6e9('0x41')]=_0x3010b3;var _0x3d4675=new Action(_0x41f440,_0x498643);var _0x5d58be=new History(_0x3d4675);_0x5d58be[_0xa6e9('0xa8')]=_0x12ec60;_0x5d58be[_0xa6e9('0xa9')]=_0x348b32;_0x5d58be[_0xa6e9('0xaa')]=_0x3d4675[_0xa6e9('0xab')];return _0x5d58be;}Dialer[_0xa6e9('0x1d')][_0xa6e9('0x3d')]=function(){var _0x5f3c1d=this;setInterval(function(){_0x5f3c1d[_0xa6e9('0xac')](_0x5f3c1d[_0xa6e9('0x28')],_0xa6e9('0xad'));_0x5f3c1d[_0xa6e9('0xac')](_0x5f3c1d[_0xa6e9('0xae')],_0xa6e9('0xaf'));},0x32c8);};Dialer[_0xa6e9('0x1d')]['clearZombieChannels']=function(_0x247fd8,_0x31be92){var _0x2cf36f=this;for(var _0x33d22f in _0x247fd8){if(_0x247fd8[_0xa6e9('0x97')](_0x33d22f)){this[_0xa6e9('0x21')]['enqueue'](function(){if(!_[_0xa6e9('0xb0')](_0x247fd8[_0x33d22f])){return ami[_0xa6e9('0xb1')]({'action':_0xa6e9('0xb2'),'channel':_0x247fd8[_0x33d22f][_0xa6e9('0xb3')]})[_0xa6e9('0xb4')](function(_0x4fff46){if(_0x4fff46[_0xa6e9('0x41')]===_0xa6e9('0xb5')){setTimeout(function(){if(_0x247fd8[_0x33d22f]&&_0x247fd8[_0x33d22f][_0xa6e9('0x4f')]!==_0xa6e9('0x76')){_0x2cf36f[_0xa6e9('0xb6')](_0x2cf36f['voiceQueues'][_0x247fd8[_0x33d22f]['queue']]);logger[_0xa6e9('0x94')](_0xa6e9('0xb7'),_0x31be92,_0x33d22f,_0x247fd8[_0x33d22f][_0xa6e9('0xb8')]);delete _0x247fd8[_0x33d22f];}if(_0x247fd8[_0x33d22f]&&_0x247fd8[_0x33d22f][_0xa6e9('0x4f')]===_0xa6e9('0x76')){_0x2cf36f[_0xa6e9('0xb6')](_0x2cf36f[_0xa6e9('0x23')][_0x247fd8[_0x33d22f]['queue']]);logger[_0xa6e9('0x94')](_0xa6e9('0xb9'),_0x31be92,_0x33d22f,_0x247fd8[_0x33d22f]['queue']);delete _0x247fd8[_0x33d22f];}},0x2328);}});}});}}};Dialer['prototype'][_0xa6e9('0xba')]=function(_0x16d952){return BPromise[_0xa6e9('0xbb')]()[_0xa6e9('0xbc')](cmHopper['countReScheduled'](_0x16d952))[_0xa6e9('0xb4')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xbd')]=function(_0x2b1c3e){return BPromise['resolve']()[_0xa6e9('0xbc')](cmHopperBlack[_0xa6e9('0xbd')](_0x2b1c3e))[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0xbe')));};Dialer[_0xa6e9('0x1d')]['checkIsBlackListIvr']=function(_0x30178b){return BPromise[_0xa6e9('0xbb')]()[_0xa6e9('0xbc')](cmHopperBlack[_0xa6e9('0xbf')](_0x30178b))[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0xc0')));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xc1')]=function(_0x2ca917){return BPromise['resolve']()[_0xa6e9('0xbc')](cmHopperHistory['avgHandleTime'](_0x2ca917))[_0xa6e9('0xb4')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xa6e9('0x1d')]['rescheduleContact']=function(_0x4433c8){return BPromise[_0xa6e9('0xbb')]()[_0xa6e9('0xbc')](cmHopper[_0xa6e9('0xc2')](_0x4433c8))[_0xa6e9('0xb4')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xc3')]=function(_0x5f3801,_0x49ab2c,_0x21b1a2){return BPromise[_0xa6e9('0xbb')]()[_0xa6e9('0xbc')](cmHopper[_0xa6e9('0xc3')](_0x5f3801,_0x49ab2c,_0x21b1a2))[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0xc4')));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xc5')]=function(_0x51fad3,_0x2693a5,_0x466bf4,_0x56a5fc){return BPromise['resolve']()[_0xa6e9('0xbc')](cmHopper[_0xa6e9('0xc5')](_0x51fad3,_0x2693a5,_0x466bf4,_0x56a5fc))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xc6')]=function(_0x27b8fc,_0x1369ba,_0x191bfe){return BPromise['resolve']()[_0xa6e9('0xbc')](cmHopper[_0xa6e9('0xc6')](_0x27b8fc,_0x1369ba,_0x191bfe))['catch'](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xc7')]=function(_0x2e0a34){return BPromise[_0xa6e9('0xbb')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x2e0a34))['catch'](loggerCatch(_0xa6e9('0xc8')));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xc9')]=function(_0x47b879){return BPromise[_0xa6e9('0xbb')]()['then'](cmHopper[_0xa6e9('0xc9')](_0x47b879))['catch'](loggerCatch(_0xa6e9('0xca')));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xcb')]=function(_0x5cbad4){return BPromise[_0xa6e9('0xbb')]()[_0xa6e9('0xbc')](cmHopperHistory[_0xa6e9('0xcb')](_0x5cbad4))[_0xa6e9('0xb4')](loggerCatch('[createHistory]\x20'));};Dialer[_0xa6e9('0x1d')]['updateOriginated']=function(_0x505c59){if(!_['isUndefined'](_0x505c59)&&_0x505c59!==null){if(_0x505c59[_0xa6e9('0x97')](_0xa6e9('0x71'))){if(_0x505c59[_0xa6e9('0x71')]>0x0){_0x505c59[_0xa6e9('0x71')]-=0x1;}else{logger['error'](_0xa6e9('0xcc'));}}}else{logger[_0xa6e9('0x94')](_0xa6e9('0xcd'));}};Dialer['prototype'][_0xa6e9('0xce')]=function(_0x56eaf0,_0xf412c7){var _0x1e3b17=this;return function(_0x39e126){_0x1e3b17[_0xa6e9('0xb6')](_0xf412c7);logger[_0xa6e9('0x94')](_0x56eaf0,util[_0xa6e9('0x93')](_0x39e126,{'showHidden':![],'depth':null}));};};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xcf')]=function(_0x3bbb9b,_0x26ae2b,_0x49928f){var _0x470e4b={'state':0x19,'statedesc':_0xa6e9('0xd0')};this[_0xa6e9('0xb6')](_0x26ae2b);this[_0xa6e9('0xd1')](_[_0xa6e9('0x89')](_0x470e4b,_['pick'](_0x49928f,['ContactId',_0xa6e9('0xd2'),_0xa6e9('0xd3'),_0xa6e9('0xd4'),_0xa6e9('0xd5')])),'[emptyContact][createHistory]','[emptyContact]');logger['error'](_0x3bbb9b);};Dialer[_0xa6e9('0x1d')]['isSuccess']=function(_0x2e44ab){return _0x2e44ab===_0xa6e9('0xd6');};Dialer[_0xa6e9('0x1d')]['isTrunkReachable']=function(_0x58c834){return!_[_0xa6e9('0x81')](_0x58c834)&&_0x58c834&&!_[_0xa6e9('0x81')](_0x58c834[_0xa6e9('0x3f')])&&!_[_0xa6e9('0x81')](_0x58c834[_0xa6e9('0xd7')])&&_0x58c834[_0xa6e9('0xd7')]&&(this[_0xa6e9('0x25')][util['format'](_0xa6e9('0xd8'),_0x58c834[_0xa6e9('0x3f')])][_0xa6e9('0xb2')]===_0xa6e9('0xd9')||this['trunks'][util[_0xa6e9('0x77')](_0xa6e9('0xd8'),_0x58c834[_0xa6e9('0x3f')])][_0xa6e9('0xb2')]===_0xa6e9('0xda'));};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xd1')]=function(_0xdfb0db,_0x3af3f8,_0x58aed2){this[_0xa6e9('0xcb')](_0xdfb0db)[_0xa6e9('0xb4')](loggerCatch(_0x3af3f8));this[_0xa6e9('0xc9')](_0xdfb0db)[_0xa6e9('0xb4')](loggerCatch(_0x58aed2));};Dialer[_0xa6e9('0x1d')]['syncVarSet']=function(_0x3d9315){var _0x221f87=this[_0xa6e9('0x28')][_0x3d9315[_0xa6e9('0xdb')]];var _0x52a419;if(!_[_0xa6e9('0xb0')](_0x3d9315)&&!_[_0xa6e9('0xb0')](_0x3d9315['variable'])&&!_[_0xa6e9('0xb0')](_0x3d9315['variable']['amdstatus'])&&_0x3d9315[_0xa6e9('0xdc')]==='xcally-motion-dialer'&&_0x221f87){if(_0x221f87['type']!==_0xa6e9('0x76')&&this['voiceQueues'][_0x221f87[_0xa6e9('0xb8')]][_0xa6e9('0xdd')]&&_0x3d9315['value']===_0xa6e9('0xde')){delete this[_0xa6e9('0x28')][_0x3d9315[_0xa6e9('0xdb')]];this[_0xa6e9('0xb6')](this[_0xa6e9('0x22')][_0x221f87[_0xa6e9('0xb8')]]);this['voiceQueues'][_0x221f87[_0xa6e9('0xb8')]][_0xa6e9('0x5e')]+=0x1;this['voiceQueues'][_0x221f87[_0xa6e9('0xb8')]][_0xa6e9('0x5d')]+=0x1;_0x52a419=new Hangup(_0x221f87,_0x3d9315);_0x52a419[_0xa6e9('0xa8')]=0x12;_0x52a419[_0xa6e9('0xa9')]=_0xa6e9('0xdf');_0x52a419['membername']=_0xa6e9('0xe0');this[_0xa6e9('0xd1')](_0x52a419,_0xa6e9('0xe1'),_0xa6e9('0xe2'));}if(_0x221f87[_0xa6e9('0x4f')]!==_0xa6e9('0x76')&&this['voiceQueues'][_0x221f87[_0xa6e9('0xb8')]][_0xa6e9('0xdd')]&&_0x3d9315[_0xa6e9('0xe3')]===_0xa6e9('0xe4')){var _0x56ee0b=this;return new BPromise(function(_0x567533,_0x4eb0a3){delete _0x56ee0b[_0xa6e9('0x28')][_0x3d9315[_0xa6e9('0xdb')]];_0x56ee0b[_0xa6e9('0xb6')](_0x56ee0b['voiceQueues'][_0x221f87[_0xa6e9('0xb8')]]);_0x56ee0b['voiceQueues'][_0x221f87[_0xa6e9('0xb8')]][_0xa6e9('0x5e')]+=0x1;_0x56ee0b[_0xa6e9('0x22')][_0x221f87[_0xa6e9('0xb8')]][_0xa6e9('0x5d')]+=0x1;var _0x53c649=_0x56ee0b['voiceQueues'][_0x221f87[_0xa6e9('0xb8')]];var _0x1ad4d3=new Hangup(_0x221f87,_0x3d9315);_0x1ad4d3[_0xa6e9('0xa8')]=0x13;_0x1ad4d3[_0xa6e9('0xa9')]=_0xa6e9('0xe5');_0x1ad4d3[_0xa6e9('0xe6')]=_0xa6e9('0xe0');_0x1ad4d3[_0xa6e9('0xe7')]+=0x1;_0x1ad4d3['countglobal']+=0x1;_0x1ad4d3[_0xa6e9('0xe8')]=!![];_0x56ee0b[_0xa6e9('0xcb')](_0x1ad4d3)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1ad4d3[_0xa6e9('0xe9')]+_0x1ad4d3[_0xa6e9('0xea')]+_0x1ad4d3[_0xa6e9('0xeb')]+_0x1ad4d3[_0xa6e9('0xec')]+_0x1ad4d3[_0xa6e9('0xed')]+_0x1ad4d3['countabandonedretry']+_0x1ad4d3['countmachineretry']+_0x1ad4d3['countagentrejectretry']>=_0x53c649[_0xa6e9('0xee')]){_0x56ee0b['stateGlobal'](_0x1ad4d3,_0x567533,_0x4eb0a3,_0xa6e9('0xef'));}else{if(_0x1ad4d3[_0xa6e9('0xe7')]>=_0x53c649[_0xa6e9('0xf0')]){_0x56ee0b[_0xa6e9('0xf1')](_0x1ad4d3,_0x567533,_0x4eb0a3,_0xa6e9('0xf2'));}else{_0x56ee0b['rescheduleContact']({'active':![],'countmachineretry':_0x1ad4d3[_0xa6e9('0xe7')],'scheduledat':moment()[_0xa6e9('0xf3')](_0x53c649[_0xa6e9('0xf4')],_0xa6e9('0xf5'))[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x1ad4d3[_0xa6e9('0xf7')],'ListId':_0x1ad4d3[_0xa6e9('0xd2')],'VoiceQueueId':_0x1ad4d3[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x1ad4d3[_0xa6e9('0xd5')]||undefined})['catch'](loggerCatch(_0xa6e9('0xf8')));_0x567533({'reschedule':0x1});}}});}if(_0x221f87['type']===_0xa6e9('0x76')&&this[_0xa6e9('0x23')][_0x221f87['queue']][_0xa6e9('0xdd')]&&_0x3d9315[_0xa6e9('0xe3')]==='HANGUP'){delete this['uniqueId'][_0x3d9315[_0xa6e9('0xdb')]];this[_0xa6e9('0xb6')](this['campaigns'][_0x221f87[_0xa6e9('0xb8')]]);_0x52a419=new Hangup(_0x221f87,_0x3d9315);_0x52a419[_0xa6e9('0xa8')]=0x12;_0x52a419[_0xa6e9('0xa9')]='HangupInAMD';_0x52a419[_0xa6e9('0xe6')]=_0xa6e9('0xe0');this[_0xa6e9('0xd1')](_0x52a419,_0xa6e9('0xf9'),_0xa6e9('0xfa'));}if(_0x221f87['type']===_0xa6e9('0x76')&&this[_0xa6e9('0x23')][_0x221f87[_0xa6e9('0xb8')]][_0xa6e9('0xdd')]&&_0x3d9315[_0xa6e9('0xe3')]==='MACHINE'){var _0x56ee0b=this;return new BPromise(function(_0x260f24,_0x3ff0c1){delete _0x56ee0b[_0xa6e9('0x28')][_0x3d9315[_0xa6e9('0xdb')]];_0x56ee0b[_0xa6e9('0xb6')](_0x56ee0b[_0xa6e9('0x23')][_0x221f87[_0xa6e9('0xb8')]]);_0x56ee0b[_0xa6e9('0x23')][_0x221f87['queue']][_0xa6e9('0x5e')]+=0x1;_0x56ee0b['campaigns'][_0x221f87[_0xa6e9('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xa23823=_0x56ee0b[_0xa6e9('0x23')][_0x221f87['queue']];var _0x13e717=new Hangup(_0x221f87,_0x3d9315);_0x13e717[_0xa6e9('0xa8')]=0x13;_0x13e717[_0xa6e9('0xa9')]='Machine';_0x13e717[_0xa6e9('0xe6')]='AMD';_0x13e717[_0xa6e9('0xe7')]+=0x1;_0x13e717['countglobal']+=0x1;_0x13e717[_0xa6e9('0xe8')]=!![];_0x56ee0b[_0xa6e9('0xcb')](_0x13e717)['catch'](loggerCatch(_0xa6e9('0xfb')));if(_0x13e717[_0xa6e9('0xe9')]+_0x13e717[_0xa6e9('0xea')]+_0x13e717[_0xa6e9('0xeb')]+_0x13e717[_0xa6e9('0xec')]+_0x13e717[_0xa6e9('0xed')]+_0x13e717[_0xa6e9('0xfc')]+_0x13e717['countmachineretry']+_0x13e717['countagentrejectretry']>=_0xa23823[_0xa6e9('0xee')]){_0x56ee0b[_0xa6e9('0xfd')](_0x13e717,_0x260f24,_0x3ff0c1,'reason19\x20machine....');}else{if(_0x13e717[_0xa6e9('0xe7')]>=_0xa23823[_0xa6e9('0xf0')]){_0x56ee0b[_0xa6e9('0xf1')](_0x13e717,_0x260f24,_0x3ff0c1,_0xa6e9('0xf2'));}else{_0x56ee0b[_0xa6e9('0xc2')]({'active':![],'countmachineretry':_0x13e717[_0xa6e9('0xe7')],'scheduledat':moment()['add'](_0xa23823[_0xa6e9('0xf4')],'minutes')[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x13e717[_0xa6e9('0xf7')],'ListId':_0x13e717[_0xa6e9('0xd2')],'VoiceQueueId':_0x13e717['VoiceQueueId']||undefined,'CampaignId':_0x13e717[_0xa6e9('0xd5')]||undefined})['catch'](loggerCatch(_0xa6e9('0xf8')));_0x260f24({'reschedule':0x1});}}});}}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x33')]=function(_0x2a1728){var _0x385829=this['uniqueId'][_0x2a1728['uniqueid']];var _0x20a5ec=this;var _0x1d7118;if(_0x385829&&_0x385829[_0xa6e9('0x4f')]==='ivr'){delete this[_0xa6e9('0x28')][_0x2a1728['uniqueid']];this[_0xa6e9('0xb6')](this[_0xa6e9('0x23')][_0x385829[_0xa6e9('0xb8')]]);this[_0xa6e9('0x23')][_0x385829[_0xa6e9('0xb8')]][_0xa6e9('0xfe')]+=0x1;_0x1d7118=new Hangup(_0x385829,_0x2a1728);this[_0xa6e9('0xcb')](_0x1d7118)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0xff')));this[_0xa6e9('0xc9')](_0x1d7118)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x100')));}if(_0x385829&&_0x385829[_0xa6e9('0x4f')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x385829[_0xa6e9('0xb8')]]['dialQueueProject'])){delete this[_0xa6e9('0x28')][_0x2a1728[_0xa6e9('0xdb')]];this['updateOriginated'](this[_0xa6e9('0x22')][_0x385829['queue']]);this['voiceQueues'][_0x385829['queue']][_0xa6e9('0x5e')]+=0x1;this['voiceQueues'][_0x385829[_0xa6e9('0xb8')]][_0xa6e9('0x5d')]+=0x1;_0x1d7118=new Hangup(_0x385829,_0x2a1728);_0x1d7118[_0xa6e9('0xa8')]=0x10;_0x1d7118[_0xa6e9('0xa9')]=_0xa6e9('0x101');_0x1d7118[_0xa6e9('0xe6')]=_0xa6e9('0x102');this[_0xa6e9('0xcb')](_0x1d7118)['catch'](loggerCatch(_0xa6e9('0xff')));this[_0xa6e9('0xc9')](_0x1d7118)[_0xa6e9('0xb4')](loggerCatch('[syncHangupIvr]'));}if(_0x385829&&_0x385829[_0xa6e9('0x4f')]!==_0xa6e9('0x76')&&!isNotNull(this[_0xa6e9('0x22')][_0x385829[_0xa6e9('0xb8')]][_0xa6e9('0x103')])){delete this[_0xa6e9('0x28')][_0x2a1728['uniqueid']];this[_0xa6e9('0xb6')](this[_0xa6e9('0x22')][_0x385829[_0xa6e9('0xb8')]]);this['voiceQueues'][_0x385829['queue']][_0xa6e9('0x68')]+=0x1;_0x1d7118=new Hangup(_0x385829,_0x2a1728);_0x1d7118['state']=0xc;_0x1d7118['statedesc']=_0x2a1728[_0xa6e9('0x104')];_0x1d7118['membername']='Unknow';this[_0xa6e9('0xcb')](_0x1d7118)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0xff')));this[_0xa6e9('0xc9')](_0x1d7118)['catch'](loggerCatch(_0xa6e9('0x100')));}};Dialer['prototype'][_0xa6e9('0x105')]=function(_0x58bd1a){var _0x4b1912=this[_0xa6e9('0x28')][_0x58bd1a[_0xa6e9('0xdb')]];var _0x38a532=this;if(this[_0xa6e9('0x22')][_0x58bd1a[_0xa6e9('0xb8')]]){if(_0x4b1912&&_0x4b1912[_0xa6e9('0x4f')]!==_0xa6e9('0x76')){delete this[_0xa6e9('0x28')][_0x58bd1a[_0xa6e9('0xdb')]];this[_0xa6e9('0x22')][_0x58bd1a[_0xa6e9('0xb8')]][_0xa6e9('0x5e')]+=0x1;var _0x479ba2=new AgentComplete(_0x4b1912,_0x58bd1a);if(_0x58bd1a[_0xa6e9('0x106')]==='agent'){_0x479ba2[_0xa6e9('0x107')]=this[_0xa6e9('0x22')][_0x58bd1a[_0xa6e9('0xb8')]]['dialQueueProject2']&&this[_0xa6e9('0x22')][_0x58bd1a[_0xa6e9('0xb8')]]['dialAgiAfterHangupAgent']?moment()[_0xa6e9('0x77')](_0xa6e9('0xf6')):undefined;}this['createHistory'](_0x479ba2)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x108')));this[_0xa6e9('0xc9')](_0x479ba2)[_0xa6e9('0xb4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x2d')]=function(_0x527b27){if(this[_0xa6e9('0x22')][_0x527b27['queue']]){if(this['uniqueId'][_0x527b27['uniqueid']]&&this[_0xa6e9('0x28')][_0x527b27[_0xa6e9('0xdb')]][_0xa6e9('0x4f')]!==_0xa6e9('0x76')){this[_0xa6e9('0xb6')](this['voiceQueues'][_0x527b27[_0xa6e9('0xb8')]]);this[_0xa6e9('0x28')][_0x527b27[_0xa6e9('0xdb')]]['answertime']=moment()[_0xa6e9('0x77')](_0xa6e9('0xf6'));}}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x109')]=function(_0x1889fb){this[_0xa6e9('0xcb')](_0x1889fb)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x108')));this[_0xa6e9('0xc9')](_0x1889fb)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x10a')));};Dialer[_0xa6e9('0x1d')]['syncQueueCallerAbandon']=function(_0x3c6c88){var _0x2f9e4a=this[_0xa6e9('0x28')][_0x3c6c88[_0xa6e9('0xdb')]];var _0x2728c3=this;if(this[_0xa6e9('0x22')][_0x3c6c88[_0xa6e9('0xb8')]]){if(_0x2f9e4a&&_0x2f9e4a[_0xa6e9('0x4f')]!==_0xa6e9('0x76')){delete this[_0xa6e9('0x28')][_0x3c6c88[_0xa6e9('0xdb')]];this[_0xa6e9('0xb6')](this['voiceQueues'][_0x3c6c88['queue']]);_0x2f9e4a[_0xa6e9('0x10b')]=moment()['format'](_0xa6e9('0xf6'));var _0x5e2269=new QueueCallerAbandon(_0x2f9e4a,_0x3c6c88);if(getSeconds(_0x2f9e4a[_0xa6e9('0x10b')],_0x2f9e4a[_0xa6e9('0x10c')])>=_0x2f9e4a[_0xa6e9('0x10d')]){this[_0xa6e9('0x22')][_0x3c6c88[_0xa6e9('0xb8')]][_0xa6e9('0x6d')]+=0x1;this['voiceQueues'][_0x3c6c88[_0xa6e9('0xb8')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xa6e9('0x22')][_0x3c6c88['queue']][_0xa6e9('0x10e')]+=0x1;_0x5e2269[_0xa6e9('0xa8')]=0xa;_0x5e2269['statedesc']=_0xa6e9('0x10f');_0x5e2269[_0xa6e9('0x110')]=_0xa6e9('0x111');_0x5e2269[_0xa6e9('0x107')]=this[_0xa6e9('0x22')][_0x3c6c88['queue']][_0xa6e9('0x112')]?moment()[_0xa6e9('0x77')](_0xa6e9('0xf6')):undefined;_0x5e2269[_0xa6e9('0xed')]+=0x1;_0x5e2269[_0xa6e9('0x113')]+=0x1;if(_0x5e2269[_0xa6e9('0xed')]>=this[_0xa6e9('0x22')][_0x3c6c88[_0xa6e9('0xb8')]][_0xa6e9('0x114')]){this[_0xa6e9('0x109')](_0x5e2269);}else{this[_0xa6e9('0xc2')]({'active':![],'countdropretry':_0x5e2269[_0xa6e9('0xed')],'scheduledat':moment()[_0xa6e9('0xf3')](this[_0xa6e9('0x22')][_0x3c6c88[_0xa6e9('0xb8')]]['dialDropRetryFrequency'],_0xa6e9('0xf5'))[_0xa6e9('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2f9e4a[_0xa6e9('0xf7')],'ListId':_0x2f9e4a[_0xa6e9('0xd2')],'VoiceQueueId':_0x2f9e4a[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x2f9e4a['CampaignId']||undefined})[_0xa6e9('0xb4')](loggerCatch('[rescheduleContact][Drop]'));var _0x161929=new History(_0x5e2269);_0x161929['state']=0xa;_0x161929['statedesc']=_0xa6e9('0x10f');_0x161929[_0xa6e9('0xab')]=moment()[_0xa6e9('0x77')](_0xa6e9('0xf6'));_0x161929[_0xa6e9('0xaa')]=_0x161929[_0xa6e9('0xab')];_0x161929['calleridname']=_0x5e2269[_0xa6e9('0x115')];_0x161929[_0xa6e9('0x116')]=_0x5e2269['calleridnum'];this[_0xa6e9('0xcb')](_0x161929)['catch'](loggerCatch(_0xa6e9('0x117')));}}else{this[_0xa6e9('0x22')][_0x3c6c88[_0xa6e9('0xb8')]][_0xa6e9('0x6c')]+=0x1;this[_0xa6e9('0x22')][_0x3c6c88[_0xa6e9('0xb8')]][_0xa6e9('0x63')]+=0x1;_0x5e2269['state']=0xb;_0x5e2269['statedesc']=_0xa6e9('0x118');_0x5e2269[_0xa6e9('0x110')]='CALLEREXIT';_0x5e2269[_0xa6e9('0xfc')]+=0x1;_0x5e2269['countglobal']+=0x1;if(_0x5e2269[_0xa6e9('0xfc')]>=this['voiceQueues'][_0x3c6c88[_0xa6e9('0xb8')]][_0xa6e9('0x119')]){this[_0xa6e9('0x109')](_0x5e2269);}else{this[_0xa6e9('0xc2')]({'active':![],'countabandonedretry':_0x5e2269[_0xa6e9('0xfc')],'scheduledat':moment()[_0xa6e9('0xf3')](this[_0xa6e9('0x22')][_0x3c6c88['queue']][_0xa6e9('0x11a')],_0xa6e9('0xf5'))[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x2f9e4a['ContactId'],'ListId':_0x2f9e4a[_0xa6e9('0xd2')],'VoiceQueueId':_0x2f9e4a[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x2f9e4a[_0xa6e9('0xd5')]||undefined})[_0xa6e9('0xb4')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x161929=new History(_0x5e2269);_0x161929[_0xa6e9('0xa8')]=0xb;_0x161929[_0xa6e9('0xa9')]=_0xa6e9('0x118');_0x161929[_0xa6e9('0xab')]=moment()[_0xa6e9('0x77')](_0xa6e9('0xf6'));_0x161929['endtime']=_0x161929[_0xa6e9('0xab')];_0x161929[_0xa6e9('0x115')]=_0x5e2269['calleridname'];_0x161929[_0xa6e9('0x116')]=_0x5e2269[_0xa6e9('0x116')];this['createHistory'](_0x161929)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x11b')));}}}}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x35')]=function(_0x3b001e){if(this[_0xa6e9('0xae')][_0x3b001e[_0xa6e9('0xdb')]]){this[_0xa6e9('0xae')][_0x3b001e[_0xa6e9('0xdb')]]['channel']=_0x3b001e[_0xa6e9('0xb3')];}if(this[_0xa6e9('0x28')][_0x3b001e[_0xa6e9('0xdb')]]){this[_0xa6e9('0x28')][_0x3b001e[_0xa6e9('0xdb')]]['channel']=_0x3b001e['channel'];}};Dialer['prototype'][_0xa6e9('0x39')]=function(_0x3d6d29){if(strategy[this['voiceQueues'][this[_0xa6e9('0xae')][_0x3d6d29['actionid']][_0xa6e9('0xb8')]][_0xa6e9('0x50')]]===_0xa6e9('0x1c')){if(this[_0xa6e9('0xae')][_0x3d6d29['actionid']]&&_[_0xa6e9('0xb0')](this[_0xa6e9('0xae')][_0x3d6d29[_0xa6e9('0x11c')]][_0xa6e9('0x11d')])&&_0x3d6d29[_0xa6e9('0xb2')]==='1'&&_0x3d6d29['paused']==='0'){if(this[_0xa6e9('0x24')][_0x3d6d29[_0xa6e9('0x11e')]]){if(!this[_0xa6e9('0x24')][_0x3d6d29[_0xa6e9('0x11e')]][_0xa6e9('0x11d')]){this[_0xa6e9('0x24')][_0x3d6d29[_0xa6e9('0x11e')]][_0xa6e9('0x11d')]=!![];this['actions'][_0x3d6d29[_0xa6e9('0x11c')]]['locked']=!![];this['actions'][_0x3d6d29['actionid']][_0xa6e9('0x11e')]=_0x3d6d29[_0xa6e9('0x11e')];}}}}else if((strategy[this[_0xa6e9('0x22')][this[_0xa6e9('0xae')][_0x3d6d29[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]][_0xa6e9('0x50')]]||'rrmemory')===_0xa6e9('0x1b')){if(this[_0xa6e9('0xae')][_0x3d6d29[_0xa6e9('0x11c')]]){if(this[_0xa6e9('0x24')][_0x3d6d29[_0xa6e9('0x11e')]]){this[_0xa6e9('0xae')][_0x3d6d29[_0xa6e9('0x11c')]][_0xa6e9('0x11e')]=_0x3d6d29['stateinterface'];if(_['isNil'](this['queueBooked'][this['actions'][_0x3d6d29[_0xa6e9('0x11c')]]['queue']])){this[_0xa6e9('0x2a')][this[_0xa6e9('0xae')][_0x3d6d29['actionid']][_0xa6e9('0xb8')]]=[];}this[_0xa6e9('0x2a')][this[_0xa6e9('0xae')][_0x3d6d29[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]][_0xa6e9('0x11f')](_[_0xa6e9('0x89')](_['pick'](this['actions'][_0x3d6d29[_0xa6e9('0x11c')]],[_0xa6e9('0x120'),'stateinterface']),{'status':_0x3d6d29[_0xa6e9('0xb2')],'paused':_0x3d6d29[_0xa6e9('0x121')]}));}}}};function unlockQueueStatus(_0x2e7090,_0x439fce){setTimeout(function(){if(_[_0xa6e9('0x81')](_0x2e7090[_0xa6e9('0x122')])){loggerBooked[_0xa6e9('0x94')](_0xa6e9('0x123'),_0x439fce);}_0x2e7090['queueStatusComplete']=!![];loggerBooked['info'](_0xa6e9('0x124'),_0x439fce,JSON[_0xa6e9('0x4a')](_[_0xa6e9('0x125')](_0x2e7090,[_0xa6e9('0x3f'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xa6e9('0x1d')][_0xa6e9('0x3b')]=function(_0x45fa55){var _0x3fe3cd=this;var _0x175dad=_0x3fe3cd[_0xa6e9('0x22')][_0x3fe3cd[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]];if(strategy[this[_0xa6e9('0x22')][this['actions'][_0x45fa55['actionid']][_0xa6e9('0xb8')]][_0xa6e9('0x50')]]===_0xa6e9('0x1c')){if(this[_0xa6e9('0xae')][_0x45fa55['actionid']]&&this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0x11e')]){this[_0xa6e9('0x8f')]['run'](this[_0xa6e9('0xae')][_0x45fa55['actionid']][_0xa6e9('0x120')],this['actions'][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0x11e')])[_0xa6e9('0xb4')](function(_0x5e600f){logger['error'](_0xa6e9('0x126'),util[_0xa6e9('0x93')](_0x5e600f,{'showHidden':![],'depth':null}));})[_0xa6e9('0x20')](function(){_0x3fe3cd['updateOriginated'](_0x3fe3cd[_0xa6e9('0x22')][_0x3fe3cd[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]]);_0x3fe3cd[_0xa6e9('0x24')][_0x3fe3cd[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0x11e')]]['locked']=![];delete _0x3fe3cd[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]];unlockQueueStatus(_0x175dad);});}else{this[_0xa6e9('0xb6')](this[_0xa6e9('0x22')][this[_0xa6e9('0xae')][_0x45fa55['actionid']][_0xa6e9('0xb8')]]);this[_0xa6e9('0xc2')]({'active':![],'ContactId':this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xf7')],'ListId':this[_0xa6e9('0xae')][_0x45fa55['actionid']][_0xa6e9('0xd2')],'VoiceQueueId':this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xd4')]||undefined,'CampaignId':this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xd5')]||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x127')));delete this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]];unlockQueueStatus(_0x175dad);}}else if((strategy[this[_0xa6e9('0x22')][this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]][_0xa6e9('0x50')]]||_0xa6e9('0x1b'))===_0xa6e9('0x1b')){var _0x468516;if(this['actions'][_0x45fa55[_0xa6e9('0x11c')]]&&!_['isEmpty'](this[_0xa6e9('0x2a')][this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]])){if(this[_0xa6e9('0x2b')][_0x3fe3cd['actions'][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]]){this[_0xa6e9('0x2b')][_0x3fe3cd[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]]['queue']]=this[_0xa6e9('0x2b')][this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]]['queue']]?this[_0xa6e9('0x2b')][this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]]['queue']]:this['queueBooked'][this[_0xa6e9('0xae')][_0x45fa55['actionid']][_0xa6e9('0xb8')]]?this[_0xa6e9('0x2a')][this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]][_0xa6e9('0x128')]||0x0:0x0;}this[_0xa6e9('0x2a')][this[_0xa6e9('0xae')][_0x45fa55['actionid']][_0xa6e9('0xb8')]]['_rr']=this[_0xa6e9('0x2b')][this[_0xa6e9('0xae')][_0x45fa55[_0xa6e9('0x11c')]][_0xa6e9('0xb8')]];for(var _0x3e60c8=0x0;_0x3e60c8=0x0?!![]:![];})[_0xa6e9('0xb4')](myreject(_0x8bab5c)));}}else{_0x18dfd4['push'](ami[_0xa6e9('0xb1')]({'action':_0xa6e9('0x140'),'command':util[_0xa6e9('0x77')](_0xa6e9('0x141'),_0x46abd1,!_['isUndefined'](config[_0xa6e9('0x142')][_0x1f5efd])?_0x1f5efd:'')})[_0xa6e9('0xbc')](function(_0x40b7f6){return _0x40b7f6[_0xa6e9('0x143')][_0xa6e9('0x144')](_0xa6e9('0x145'))>=0x0?!![]:![];})[_0xa6e9('0xb4')](myreject(_0x8bab5c)));}BPromise[_0xa6e9('0x146')](_0x18dfd4)['then'](function(_0x3d3440){var _0x1f841a=_[_0xa6e9('0x147')](_0x3d3440);if(_0x1f841a){return _0x501a2e(_0x1f841a);}else{_0x450f72[_0xa6e9('0x41')]=_0x3305b7?_0xa6e9('0x148'):_0xa6e9('0x149');return _0x8bab5c(msgResponse('[ifTime][promiseAll]',_0xa6e9('0x13a'),_0xa6e9('0x14a')+_0x3305b7+'\x20'+_0x3e939e+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa6e9('0x93')](_0x46abd1,{'showHidden':![],'depth':null})+_0xa6e9('0x14b')+_0x1f5efd));}})[_0xa6e9('0xb4')](function(_0x4363ff){return _0x8bab5c(msgResponse(_0xa6e9('0x138'),_0xa6e9('0x13a'),JSON['stringify'](_0x4363ff)));});});};Dialer[_0xa6e9('0x1d')]['checkDialMethod']=function(_0x5ae5ab){var _0x219fc3=this;return function(){switch(_0x5ae5ab[_0xa6e9('0x5a')]){case'progressive':freeVariablesPredictive(_0x5ae5ab);_0x219fc3[_0xa6e9('0x14c')](_0x5ae5ab,0x1);break;case _0xa6e9('0x14d'):freeVariablesPredictive(_0x5ae5ab);_0x219fc3['handlePower'](_0x5ae5ab,_0x5ae5ab[_0xa6e9('0x14e')]);break;case _0xa6e9('0x9'):_0x219fc3[_0xa6e9('0x9')](_0x5ae5ab);break;case _0xa6e9('0x14f'):freeVariablesPredictive(_0x5ae5ab);_0x219fc3[_0xa6e9('0x14c')](_0x5ae5ab,0x1);break;default:freeVariablesPredictive(_0x5ae5ab);logger[_0xa6e9('0x94')](_0xa6e9('0x150'),_0x5ae5ab[_0xa6e9('0x3f')],_0xa6e9('0x151'));}};};Dialer['prototype'][_0xa6e9('0x152')]=function(_0x2d324d){var _0x59d6a8=this;return function(){_0x59d6a8[_0xa6e9('0x153')](_0x2d324d);};};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xb')]=function(_0x5becb1){var _0x965093=this;if(isNotPreview(_0x5becb1[_0xa6e9('0x5a')])){if(isVoiceQueueOutbound(_0x5becb1[_0xa6e9('0x4f')])&&isActive(_0x5becb1[_0xa6e9('0x59')])){_0x5becb1[_0xa6e9('0x9f')]=!![];BPromise[_0xa6e9('0xbb')]()[_0xa6e9('0xbc')](checkIsLoggedIn(_0x5becb1,_0x5becb1[_0xa6e9('0x52')]))['then'](checkIsActive(_0x5becb1,_0x5becb1[_0xa6e9('0x59')]))[_0xa6e9('0xbc')](checkInterval(_0x5becb1))[_0xa6e9('0xbc')](_0x965093[_0xa6e9('0x154')](_0x5becb1))[_0xa6e9('0xbc')](_0x965093[_0xa6e9('0x137')](_0x5becb1[_0xa6e9('0x155')],_0x5becb1[_0xa6e9('0x156')],_0x5becb1[_0xa6e9('0x3f')],_0x5becb1))[_0xa6e9('0xbc')](_0x965093[_0xa6e9('0x139')](_0x5becb1[_0xa6e9('0x46')],_0x5becb1[_0xa6e9('0x156')],_0x5becb1[_0xa6e9('0x3f')],_0x5becb1))[_0xa6e9('0xbc')](_0x965093[_0xa6e9('0x157')](_0x5becb1))[_0xa6e9('0xb4')](loggerCatchQueueSummary('[syncQueueSummary]',_0x5becb1));}else{notSendMessagesQueue(_0x5becb1);}}else{freeVariablesPredictive(_0x5becb1);}};Dialer[_0xa6e9('0x1d')]['syncCampaigns']=function(){var _0x10c195=this;var _0x390cd0;for(var _0xd3592d in this[_0xa6e9('0x23')]){if(this[_0xa6e9('0x23')][_0xa6e9('0x97')](_0xd3592d)){_0x390cd0=this[_0xa6e9('0x23')][_0xd3592d];if(isCampaignIvr(_0x390cd0[_0xa6e9('0x4f')])&&isActive(_0x390cd0[_0xa6e9('0xd7')])){_0x390cd0['sendMessageOneNotActive']=!![];BPromise[_0xa6e9('0xbb')]()['then'](checkIsActive(_0x390cd0,_0x390cd0[_0xa6e9('0xd7')]))[_0xa6e9('0xbc')](checkInterval(_0x390cd0))[_0xa6e9('0xbc')](_0x10c195[_0xa6e9('0x154')](_0x390cd0))[_0xa6e9('0xbc')](_0x10c195['checkIfTime'](_0x390cd0[_0xa6e9('0x155')],_0x390cd0[_0xa6e9('0x156')],_0x390cd0[_0xa6e9('0x3f')],_0x390cd0))['then'](_0x10c195[_0xa6e9('0x139')](_0x390cd0['Interval'],_0x390cd0['dialTimezone'],_0x390cd0[_0xa6e9('0x3f')],_0x390cd0))['then'](_0x10c195[_0xa6e9('0x152')](_0x390cd0))[_0xa6e9('0xb4')](loggerCatchQueueSummary(_0xa6e9('0x158'),_0x390cd0));}else{notSendMessagesCampaign(_0x390cd0);}}}};function getCallerIdRandom(_0x435e67,_0x1ad6d7){var _0x26e64d,_0x4e2fd1,_0x188527;if(_0x1ad6d7<=0x0){_0x1ad6d7=0x1;}_0x26e64d=new RegExp(_0xa6e9('0x159')+_0x1ad6d7+'}$');_0x4e2fd1=Math[_0xa6e9('0x15a')](0xa,_0x1ad6d7-0x1);_0x188527=Math['pow'](0xa,_0x1ad6d7)-0x1;return util[_0xa6e9('0x77')]('%s',_['replace'](_0x435e67,_0x26e64d,_[_0xa6e9('0x15b')](_0x4e2fd1,_0x188527)));}function extractCalleridName(_0x1358c8){var _0x7acd32=_0x1358c8[_0xa6e9('0x15c')](/"(.*?)"/);return _0x7acd32?_0x7acd32[0x1]:_0x1358c8;}function extractCalleridNumber(_0x3ec3b1){var _0x2edd82=_0x3ec3b1['match'](/<(.*?)>/);return _0x2edd82?_0x2edd82[0x1]:_0x3ec3b1;}Dialer[_0xa6e9('0x1d')][_0xa6e9('0x15d')]=function(_0x4c2ff1,_0x207bad){var _0x1ba047=this;var _0x6bdd7b=uuid['v4']();this[_0xa6e9('0xae')][_0x6bdd7b]=new Action(_0x4c2ff1,_0x207bad,_0x6bdd7b);return new BPromise(function(_0x3aebd4,_0x1a5bb8){if(_[_0xa6e9('0x81')](_0x4c2ff1)&&_0xa6e9('0x15e')!==typeof _0x4c2ff1){return _0x1a5bb8(msgResponse('originate',_0xa6e9('0x13a'),_0xa6e9('0x15f')));}if(_[_0xa6e9('0x81')](_0x207bad[_0xa6e9('0x160')][_0xa6e9('0x161')])||_0x207bad[_0xa6e9('0x160')][_0xa6e9('0x161')]===null){return _0x1a5bb8(msgResponse(_0xa6e9('0x162'),_0xa6e9('0x13a'),_0xa6e9('0x163')));}var _0x595847={'XMD-CALLERID':_0x1ba047[_0xa6e9('0xae')][_0x6bdd7b]['getCaller'](),'XMD-AGI':_0x4c2ff1[_0xa6e9('0x103')]?util[_0xa6e9('0x77')](_0xa6e9('0x164'),ipAgi,_0x4c2ff1[_0xa6e9('0x103')]):_0xa6e9('0x165'),'XMD-AGIAFTER':_0x4c2ff1['dialQueueProject2']?util[_0xa6e9('0x77')](_0xa6e9('0x164'),ipAgi,_0x4c2ff1[_0xa6e9('0x112')]):_0xa6e9('0x165'),'XMD-QUEUE':_0x4c2ff1[_0xa6e9('0x4f')]===_0xa6e9('0x8e')?util['format'](_0xa6e9('0x166'),_0x4c2ff1['name'],_0x4c2ff1[_0xa6e9('0x167')]||'',_0x4c2ff1[_0xa6e9('0x168')]?'c':'',_0x4c2ff1[_0xa6e9('0x10d')]||0x3):'NONE','XMD-CONTACTID':_0x207bad[_0xa6e9('0xf7')],'XMD-CDRTYPE':_0xa6e9('0x169'),'CALLERID(all)':_0x1ba047[_0xa6e9('0xae')][_0x6bdd7b][_0xa6e9('0x16a')](),'XMD-AMD':_0x4c2ff1[_0xa6e9('0xdd')]?'ACTIVE':_0xa6e9('0x165'),'XMD-DESTINATION':_0xa6e9('0x16b')};if(_0x4c2ff1[_0xa6e9('0xdd')]){_0x595847[_0xa6e9('0x16c')]=_0x4c2ff1['dialAMDInitialSilence']||0x9c4;_0x595847['XMD-AMDGREETING']=_0x4c2ff1[_0xa6e9('0x16d')]||0x5dc;_0x595847['XMD-AMDAFTERGREETINGSILENCE']=_0x4c2ff1[_0xa6e9('0x16e')]||0x320;_0x595847[_0xa6e9('0x16f')]=_0x4c2ff1[_0xa6e9('0x170')]||0x1388;_0x595847[_0xa6e9('0x171')]=_0x4c2ff1[_0xa6e9('0x172')]||0x64;_0x595847[_0xa6e9('0x173')]=_0x4c2ff1[_0xa6e9('0x174')]||0x32;_0x595847['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4c2ff1['dialAMDMaximumNumberOfWords']||0x3;_0x595847[_0xa6e9('0x175')]=_0x4c2ff1['dialAMDSilenceThreshold']||0x100;_0x595847[_0xa6e9('0x176')]=_0x4c2ff1[_0xa6e9('0x177')]||0x1388;}if(_0x4c2ff1['type']==='outbound'){_0x595847[_0xa6e9('0x178')]=_0x207bad[_0xa6e9('0xd4')];}else{_0x595847[_0xa6e9('0x179')]=_0x207bad[_0xa6e9('0xd5')];}for(var _0x5bcb34 in _0x207bad['Contact']){if(_0x207bad[_0xa6e9('0x160')][_0xa6e9('0x97')](_0x5bcb34)){if(isNotNull(_0x207bad[_0xa6e9('0x160')][_0x5bcb34])&&_0x5bcb34!=='id'&&_0x5bcb34!==_0xa6e9('0x17a')&&_0x5bcb34!==_0xa6e9('0x17b')&&_0x5bcb34!==_0xa6e9('0x17c')){_0x595847[util[_0xa6e9('0x77')](_0xa6e9('0x17d'),_0xa6e9('0x17e'),_['toUpper'](_0x5bcb34))]=_0x207bad['Contact'][_0x5bcb34];}}}var _0x27af2b=_0x1ba047[_0xa6e9('0x133')](_0x4c2ff1['Trunk'])?getCallerId(_0x4c2ff1[_0xa6e9('0x75')][_0xa6e9('0x17f')],_0x4c2ff1[_0xa6e9('0x5b')],_0x4c2ff1[_0xa6e9('0x180')]>0x0?getCallerIdRandom(_0x4c2ff1[_0xa6e9('0x181')],_0x4c2ff1['dialRandomLastDigitCallerIdNumber']):_0x4c2ff1['dialOriginateCallerIdNumber']):getCallerId(_[_0xa6e9('0xb0')](_0x4c2ff1[_0xa6e9('0x134')])?_0x4c2ff1[_0xa6e9('0x75')][_0xa6e9('0x17f')]:_0x4c2ff1[_0xa6e9('0x134')][_0xa6e9('0x17f')],_0x4c2ff1['dialOriginateCallerIdName'],_0x4c2ff1[_0xa6e9('0x180')]>0x0?getCallerIdRandom(_0x4c2ff1[_0xa6e9('0x181')],_0x4c2ff1[_0xa6e9('0x180')]):_0x4c2ff1[_0xa6e9('0x181')]);if(_0x27af2b){_0x595847[_0xa6e9('0x182')]=_0x1ba047[_0xa6e9('0xae')][_0x6bdd7b]['originatecalleridname']=extractCalleridName(_0x27af2b);_0x595847[_0xa6e9('0x183')]=_0x1ba047[_0xa6e9('0xae')][_0x6bdd7b][_0xa6e9('0x184')]=extractCalleridNumber(_0x27af2b);}return ami[_0xa6e9('0xb1')]({'actionid':_0x6bdd7b,'action':_0xa6e9('0x162'),'channel':_0x1ba047['isTrunkReachable'](_0x4c2ff1[_0xa6e9('0x75')])?util[_0xa6e9('0x77')](_0xa6e9('0x185'),_0x4c2ff1['Trunk'][_0xa6e9('0x3f')],isNotNull(_0x4c2ff1[_0xa6e9('0x5c')])?_0x4c2ff1[_0xa6e9('0x5c')][_0xa6e9('0x186')]()||'':'',_0x4c2ff1[_0xa6e9('0x187')]>0x0?_0x207bad['Contact'][_0xa6e9('0x161')][_0xa6e9('0x188')](_0x4c2ff1['dialCutDigit']):_0x207bad[_0xa6e9('0x160')][_0xa6e9('0x161')]):util[_0xa6e9('0x77')](_0xa6e9('0x185'),_[_0xa6e9('0xb0')](_0x4c2ff1[_0xa6e9('0x134')])?_0x4c2ff1['Trunk']['name']:_0x4c2ff1[_0xa6e9('0x134')][_0xa6e9('0x3f')],isNotNull(_0x4c2ff1[_0xa6e9('0x5c')])?_0x4c2ff1[_0xa6e9('0x5c')][_0xa6e9('0x186')]()||'':'',_0x4c2ff1[_0xa6e9('0x187')]>0x0?_0x207bad['Contact'][_0xa6e9('0x161')][_0xa6e9('0x188')](_0x4c2ff1[_0xa6e9('0x187')]):_0x207bad[_0xa6e9('0x160')]['phone']),'callerid':_0x27af2b,'Exten':_0xa6e9('0x16b'),'Context':'from-sip','Priority':'1','variable':_0x595847,'timeout':(_0x4c2ff1[_0xa6e9('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x6bdd7b})[_0xa6e9('0xbc')](function(_0x39ce57){return _0x3aebd4(_0x39ce57);})[_0xa6e9('0xb4')](function(_0x586256){_0x4c2ff1[_0xa6e9('0x67')]+=0x1;var _0x37aae2=new History(_0x1ba047['actions'][_0x6bdd7b]);logger[_0xa6e9('0x94')](util[_0xa6e9('0x77')]('[originateError]:\x20%s',JSON[_0xa6e9('0x4a')](_0x586256)));_0x37aae2[_0xa6e9('0xa8')]=0xe;_0x37aae2['statedesc']='OriginateError';_0x37aae2[_0xa6e9('0xab')]=moment()[_0xa6e9('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x37aae2[_0xa6e9('0xaa')]=_0x37aae2[_0xa6e9('0xab')];_0x1ba047[_0xa6e9('0xcb')](_0x37aae2)['catch'](loggerCatch(_0xa6e9('0x18a')));_0x1ba047[_0xa6e9('0xc9')](_0x37aae2)[_0xa6e9('0xb4')](loggerCatch('[originate][error]'))[_0xa6e9('0x20')](function(){delete _0x1ba047[_0xa6e9('0xae')][_0x6bdd7b];return _0x1a5bb8(msgResponse(_0xa6e9('0x162'),_0xa6e9('0x49'),_0xa6e9('0x18b')));});});});};Dialer['prototype'][_0xa6e9('0x31')]=function(_0x1b276b){var _0xb3008b=this[_0xa6e9('0xae')][_0x1b276b[_0xa6e9('0x11c')]];var _0xc7cfee=this;if(_0xb3008b){delete this[_0xa6e9('0xae')][_0x1b276b[_0xa6e9('0x11c')]];_0xb3008b[_0xa6e9('0x10c')]=moment()[_0xa6e9('0x77')](_0xa6e9('0xf6'));var _0x454dcf=_0xb3008b['type']==='ivr'?this[_0xa6e9('0x23')][_0xb3008b[_0xa6e9('0xb8')]]:this['voiceQueues'][_0xb3008b[_0xa6e9('0x18c')]()];if(!this[_0xa6e9('0x18d')](_0x1b276b[_0xa6e9('0x18e')])){this[_0xa6e9('0xb6')](_0x454dcf);return this[_0xa6e9('0x18f')](_0xb3008b,_0x454dcf,_0x1b276b)[_0xa6e9('0xbc')](function(_0x5e2b7e){})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x190')));}else{this[_0xa6e9('0x28')][_0x1b276b[_0xa6e9('0xdb')]]=_0xb3008b;}}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x191')]=function(_0x3a75b0,_0x37efb7,_0x2a1a80){var _0x281104=new History(_0x37efb7);if(_0x281104[_0xa6e9('0xe9')]+_0x281104[_0xa6e9('0xea')]+_0x281104[_0xa6e9('0xeb')]+_0x281104['countnosuchnumberretry']+_0x281104['countdropretry']+_0x281104['countabandonedretry']+_0x281104[_0xa6e9('0xe7')]+_0x281104[_0xa6e9('0x192')]>=_0x2a1a80['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3a75b0){case 0x3:if(_0x281104[_0xa6e9('0xeb')]>=_0x2a1a80[_0xa6e9('0x193')]-0x1){return!![];}else{this[_0xa6e9('0xc2')]({'active':![],'countnoanswerretry':_0x281104[_0xa6e9('0xeb')]+=0x1,'scheduledat':moment()[_0xa6e9('0xf3')](_0x2a1a80[_0xa6e9('0x194')],_0xa6e9('0xf5'))[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x281104['ContactId'],'ListId':_0x281104['ListId'],'VoiceQueueId':_0x281104[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x281104[_0xa6e9('0xd5')]||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x195')));}break;case 0x5:if(_0x281104['countbusyretry']>=_0x2a1a80['dialBusyMaxRetry']-0x1){return!![];}else{this[_0xa6e9('0xc2')]({'active':![],'countbusyretry':_0x281104[_0xa6e9('0xe9')]+=0x1,'scheduledat':moment()[_0xa6e9('0xf3')](_0x2a1a80[_0xa6e9('0x196')],'minutes')[_0xa6e9('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x281104[_0xa6e9('0xf7')],'ListId':_0x281104[_0xa6e9('0xd2')],'VoiceQueueId':_0x281104[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x281104[_0xa6e9('0xd5')]||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x197')));}break;case 0x8:if(_0x281104['countcongestionretry']>=_0x2a1a80[_0xa6e9('0x198')]-0x1){return!![];}else{this[_0xa6e9('0xc2')]({'active':![],'countcongestionretry':_0x281104['countcongestionretry']+=0x1,'scheduledat':moment()[_0xa6e9('0xf3')](_0x2a1a80[_0xa6e9('0x199')],_0xa6e9('0xf5'))[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x281104[_0xa6e9('0xf7')],'ListId':_0x281104[_0xa6e9('0xd2')],'VoiceQueueId':_0x281104[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x281104[_0xa6e9('0xd5')]||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x19a')));}break;case 0x0:if(_0x281104[_0xa6e9('0xec')]>=_0x2a1a80[_0xa6e9('0x19b')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x281104[_0xa6e9('0xec')]+=0x1,'scheduledat':moment()[_0xa6e9('0xf3')](_0x2a1a80[_0xa6e9('0x19c')],_0xa6e9('0xf5'))['format'](_0xa6e9('0xf6')),'ContactId':_0x281104[_0xa6e9('0xf7')],'ListId':_0x281104[_0xa6e9('0xd2')],'VoiceQueueId':_0x281104[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x281104['CampaignId']||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x19d')));}break;case 0xa:if(_0x281104[_0xa6e9('0xed')]>=_0x2a1a80[_0xa6e9('0x114')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x281104[_0xa6e9('0xed')]+=0x1,'scheduledat':moment()[_0xa6e9('0xf3')](_0x2a1a80['dialDropRetryFrequency'],_0xa6e9('0xf5'))[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x281104[_0xa6e9('0xf7')],'ListId':_0x281104[_0xa6e9('0xd2')],'VoiceQueueId':_0x281104[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x281104['CampaignId']||undefined})['catch'](loggerCatch(_0xa6e9('0x19e')));}break;case 0xb:if(_0x281104[_0xa6e9('0xfc')]>=_0x2a1a80[_0xa6e9('0x119')]-0x1){return!![];}else{this[_0xa6e9('0xc2')]({'active':![],'countabandonedretry':_0x281104[_0xa6e9('0xfc')]+=0x1,'scheduledat':moment()[_0xa6e9('0xf3')](_0x2a1a80[_0xa6e9('0x11a')],_0xa6e9('0xf5'))[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x281104[_0xa6e9('0xf7')],'ListId':_0x281104[_0xa6e9('0xd2')],'VoiceQueueId':_0x281104[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x281104[_0xa6e9('0xd5')]||undefined})[_0xa6e9('0xb4')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x281104[_0xa6e9('0xe7')]>=_0x2a1a80[_0xa6e9('0xf0')]-0x1){return!![];}else{this[_0xa6e9('0xc2')]({'active':![],'countmachineretry':_0x281104[_0xa6e9('0xe7')]+=0x1,'scheduledat':moment()[_0xa6e9('0xf3')](_0x2a1a80[_0xa6e9('0xf4')],_0xa6e9('0xf5'))[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x281104['ContactId'],'ListId':_0x281104[_0xa6e9('0xd2')],'VoiceQueueId':_0x281104[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x281104['CampaignId']||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0xf8')));}break;case 0x14:if(_0x281104[_0xa6e9('0x192')]>=_0x2a1a80[_0xa6e9('0x19f')]-0x1){return!![];}else{this[_0xa6e9('0xc2')]({'active':![],'countagentrejectretry':_0x281104[_0xa6e9('0x192')]+=0x1,'scheduledat':moment()[_0xa6e9('0xf3')](_0x2a1a80[_0xa6e9('0x1a0')],'minutes')[_0xa6e9('0x77')](_0xa6e9('0xf6')),'ContactId':_0x281104[_0xa6e9('0xf7')],'ListId':_0x281104[_0xa6e9('0xd2')],'VoiceQueueId':_0x281104[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x281104['CampaignId']||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x1a1')));}break;default:return!![];}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x18f')]=function(_0x2f6865,_0x4562f6,_0x1a3fd0){var _0x4d2de6=this;var _0x5f3650=new History(_0x2f6865);return new BPromise(function(_0x1c8ab7,_0x147052){if(_['isUndefined'](_0x4562f6)&&_0xa6e9('0x15e')!==typeof _0x4562f6){return _0x147052(msgResponse(_0xa6e9('0x1a2'),_0xa6e9('0x13a'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x1a3fd0)&&'object'!==typeof _0x1a3fd0){return _0x147052(msgResponse(_0xa6e9('0x1a2'),'Failure','evt\x20is\x20undefine'));}switch(_0x1a3fd0[_0xa6e9('0x106')]){case'0':_0x4562f6[_0xa6e9('0x66')]+=0x1;_0x5f3650['state']=0x0;_0x5f3650[_0xa6e9('0xa9')]=_0xa6e9('0x1a3');_0x5f3650[_0xa6e9('0xec')]+=0x1;_0x5f3650[_0xa6e9('0x113')]+=0x1;console['log'](_0xa6e9('0x1a4'),ut['buildObj'](_0x2f6865,_0xa6e9('0x1a5')));ami['emit'](_0xa6e9('0x1a6'),ut[_0xa6e9('0x1a7')](_0x2f6865,'nosuchnumber'));_0x4d2de6[_0xa6e9('0xcb')](_0x5f3650)[_0xa6e9('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4d2de6[_0xa6e9('0x191')](0x0,_0x2f6865,_0x4562f6)){if(_0x5f3650[_0xa6e9('0xec')]>=_0x4562f6[_0xa6e9('0x19b')]){_0x4d2de6['createStateFinal'](_0x5f3650,_0x1c8ab7,_0x147052,'reason\x200\x20no\x20such\x20number....');}else{_0x4d2de6[_0xa6e9('0xfd')](_0x5f3650,_0x1c8ab7,_0x147052,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x4562f6['outboundNoAnswerCallsDay']+=0x1;_0x5f3650['state']=0x3;_0x5f3650[_0xa6e9('0xa9')]=_0xa6e9('0x1a8');_0x5f3650['countnoanswerretry']+=0x1;_0x5f3650[_0xa6e9('0x113')]+=0x1;console[_0xa6e9('0x1a9')](_0xa6e9('0x1aa'),_0x1a3fd0);console[_0xa6e9('0x1a9')]('NO\x20ANSWER\x20action',_0x2f6865);console[_0xa6e9('0x1a9')](_0xa6e9('0x1ab'),_0x4562f6);console[_0xa6e9('0x1a9')](_0xa6e9('0x1ac'),_0x5f3650);console[_0xa6e9('0x1a9')]('EMITTING\x20status_noanswer\x20for',ut[_0xa6e9('0x1a7')](_0x2f6865,_0xa6e9('0x1ad')));ami['emit']('custom:status_noanswer',ut[_0xa6e9('0x1a7')](_0x2f6865,_0xa6e9('0x1ad')));_0x4d2de6['createHistory'](_0x5f3650)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x1ae')));if(_0x4d2de6[_0xa6e9('0x191')](0x3,_0x2f6865,_0x4562f6)){if(_0x5f3650['countnoanswerretry']>=_0x4562f6[_0xa6e9('0x193')]){_0x4d2de6[_0xa6e9('0xf1')](_0x5f3650,_0x1c8ab7,_0x147052,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4d2de6[_0xa6e9('0xfd')](_0x5f3650,_0x1c8ab7,_0x147052,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4562f6['outboundBusyCallsDay']+=0x1;_0x5f3650[_0xa6e9('0xa8')]=0x5;_0x5f3650[_0xa6e9('0xa9')]=_0xa6e9('0x1af');_0x5f3650['countbusyretry']+=0x1;_0x5f3650[_0xa6e9('0x113')]+=0x1;console[_0xa6e9('0x1a9')](_0xa6e9('0x1b0'),ut[_0xa6e9('0x1a7')](_0x2f6865,_0xa6e9('0x1b1')));ami[_0xa6e9('0x4e')]('custom:status_busy',ut[_0xa6e9('0x1a7')](_0x2f6865,_0xa6e9('0x1b1')));_0x4d2de6[_0xa6e9('0xcb')](_0x5f3650)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x1b2')));if(_0x4d2de6[_0xa6e9('0x191')](0x5,_0x2f6865,_0x4562f6)){if(_0x5f3650[_0xa6e9('0xe9')]>=_0x4562f6[_0xa6e9('0x1b3')]){_0x4d2de6[_0xa6e9('0xf1')](_0x5f3650,_0x1c8ab7,_0x147052,'reason\x205\x20busy');}else{_0x4d2de6['stateGlobal'](_0x5f3650,_0x1c8ab7,_0x147052,_0xa6e9('0x1b4'));}}break;case'8':_0x4562f6[_0xa6e9('0x61')]+=0x1;_0x5f3650[_0xa6e9('0xa8')]=0x8;_0x5f3650[_0xa6e9('0xa9')]=_0xa6e9('0x1b5');_0x5f3650['countcongestionretry']+=0x1;_0x5f3650[_0xa6e9('0x113')]+=0x1;_0x4d2de6['createHistory'](_0x5f3650)[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x1b6')));if(_0x4d2de6[_0xa6e9('0x191')](0x8,_0x2f6865,_0x4562f6)){if(_0x5f3650[_0xa6e9('0xea')]>=_0x4562f6[_0xa6e9('0x198')]){_0x4d2de6[_0xa6e9('0xf1')](_0x5f3650,_0x1c8ab7,_0x147052,_0xa6e9('0x1b7'));}else{_0x4d2de6['stateGlobal'](_0x5f3650,_0x1c8ab7,_0x147052,_0xa6e9('0x1b7'));}}break;case'11':_0x4562f6[_0xa6e9('0x1b8')]+=0x1;_0x5f3650[_0xa6e9('0xa8')]=0xb;_0x5f3650['statedesc']=_0xa6e9('0x118');_0x5f3650[_0xa6e9('0xfc')]+=0x1;_0x5f3650['countglobal']+=0x1;_0x4d2de6['createHistory'](_0x5f3650)['catch'](loggerCatch(_0xa6e9('0x11b')));if(_0x4d2de6['checkRetriveMax'](0xb,_0x2f6865,_0x4562f6)){if(_0x5f3650['countabandonedretry']>=_0x4562f6[_0xa6e9('0x119')]){_0x4d2de6[_0xa6e9('0xf1')](_0x5f3650,_0x1c8ab7,_0x147052,'reason\x2011\x20abandoned');}else{_0x4d2de6[_0xa6e9('0xfd')](_0x5f3650,_0x1c8ab7,_0x147052,_0xa6e9('0x1b9'));}}break;case'20':_0x4562f6[_0xa6e9('0x1ba')]+=0x1;_0x5f3650[_0xa6e9('0xa8')]=0x14;_0x5f3650[_0xa6e9('0xa9')]=_0xa6e9('0x1bb');_0x5f3650['countagentrejectretry']+=0x1;_0x5f3650[_0xa6e9('0x113')]+=0x1;_0x4d2de6[_0xa6e9('0xcb')](_0x5f3650)[_0xa6e9('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4d2de6[_0xa6e9('0x191')](0x14,_0x2f6865,_0x4562f6)){if(_0x5f3650[_0xa6e9('0x192')]>=_0x4562f6[_0xa6e9('0x19f')]){_0x4d2de6[_0xa6e9('0xf1')](_0x5f3650,_0x1c8ab7,_0x147052,_0xa6e9('0x1bc'));}else{_0x4d2de6[_0xa6e9('0xfd')](_0x5f3650,_0x1c8ab7,_0x147052,'reason\x2020\x20agentreject');}}break;default:_0x4562f6[_0xa6e9('0x68')]+=0x1;_0x5f3650[_0xa6e9('0xa8')]=0xc;_0x5f3650[_0xa6e9('0xa9')]=_0x1a3fd0[_0xa6e9('0x106')];_0x4d2de6[_0xa6e9('0xcb')](_0x5f3650)['catch'](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4d2de6['checkRetriveMax'](_0x1a3fd0['reason'],_0x2f6865,_0x4562f6)){if(_0x5f3650['countbusyretry']+_0x5f3650[_0xa6e9('0xea')]+_0x5f3650[_0xa6e9('0xeb')]+_0x5f3650['countnosuchnumberretry']+_0x5f3650[_0xa6e9('0xed')]+_0x5f3650[_0xa6e9('0xfc')]+_0x5f3650[_0xa6e9('0xe7')]+_0x5f3650[_0xa6e9('0x192')]>=_0x4562f6[_0xa6e9('0xee')]){_0x4d2de6[_0xa6e9('0xfd')](_0x5f3650,_0x1c8ab7,_0x147052,_0x1a3fd0['reason']);}else{_0x4d2de6[_0xa6e9('0xf1')](_0x5f3650,_0x1c8ab7,_0x147052,_0x1a3fd0['reason']);}}}});};Dialer[_0xa6e9('0x1d')][_0xa6e9('0xfd')]=function(_0x319e1e,_0x31e864,_0x20a1e6,_0x2f9e01){var _0x37c325=new Final(_0x319e1e);_0x37c325[_0xa6e9('0xa8')]=0xf;_0x37c325[_0xa6e9('0xa9')]=_0xa6e9('0x1bd');this[_0xa6e9('0xf1')](_0x37c325,_0x31e864,_0x20a1e6,_0x2f9e01);};Dialer[_0xa6e9('0x1d')]['createStateFinal']=function(_0x2e50c5,_0x129b79,_0x6faff,_0x351205){this[_0xa6e9('0xc9')](_0x2e50c5)['then'](function(_0x46f8ea){return _0x129b79(msgResponse(_0xa6e9('0x1a2'),_0xa6e9('0xd6'),_0x351205));})['catch'](function(_0x172f2c){return _0x6faff(msgResponse('[moveContactManagedDialer][0]',_0xa6e9('0x13a'),'contact\x20not\x20moved'));});};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x9')]=function(_0x5a6188){var _0x5ab6f9=this;var _0x18b973=_0x5a6188['dialPredictiveOptimizationPercentage']/0x64;var _0x4c8a75=_0x5a6188[_0xa6e9('0x64')]/(_0x5a6188[_0xa6e9('0x64')]+_0x5a6188[_0xa6e9('0x5e')]);var _0x43774b=Math[_0xa6e9('0x1be')](_0x5a6188[_0xa6e9('0x6f')]*(_0x5a6188[_0xa6e9('0x1bf')]/0x64));var _0x4e108c=Math[_0xa6e9('0x1be')](_0x5a6188[_0xa6e9('0x6f')]*(_0x5a6188['predictiveIntervalMinThreshold']/0x64));var _0x36fa6e=_0x5a6188['available']+_0x5a6188[_0xa6e9('0xa0')];var _0x73dcc2=Math[_0xa6e9('0x1c0')](_0x5a6188[_0xa6e9('0x72')]*_0x5a6188[_0xa6e9('0x73')]*_0x5a6188[_0xa6e9('0x1c1')]*_0x5a6188[_0xa6e9('0x6e')]);if(_[_0xa6e9('0x81')](_0x5a6188[_0xa6e9('0x8a')])){if(!_[_0xa6e9('0x81')](_0x5a6188['startPredictive'])){_0x5a6188[_0xa6e9('0x8b')]=undefined;loggerPredictive[_0xa6e9('0x94')](_0xa6e9('0x1c2'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xa6e9('0x81')](_0x5a6188['handlePredictive'])){loggerPredictive[_0xa6e9('0x94')](_0xa6e9('0x1c2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5a6188[_0xa6e9('0x8d')]);_0x5a6188[_0xa6e9('0x8d')]=undefined;}_0x5a6188[_0xa6e9('0x8a')]=moment()[_0xa6e9('0x77')](_0xa6e9('0xf6'));loggerPredictive[_0xa6e9('0x79')](_0x5a6188[_0xa6e9('0x3f')],_0xa6e9('0x1c3'),_0x5a6188[_0xa6e9('0x8a')]);this[_0xa6e9('0x14c')](_0x5a6188,0x1);}else if(ifInterval(_0x5a6188[_0xa6e9('0x1c4')],_0x5a6188[_0xa6e9('0x8a')])){this[_0xa6e9('0x14c')](_0x5a6188,0x1);loggerPredictiveCalls['info'](_0xa6e9('0x1c5'),_0x5a6188[_0xa6e9('0x8a')],_0x5a6188[_0xa6e9('0x3f')]);_0x5a6188[_0xa6e9('0x72')]=0x0;_0x5a6188[_0xa6e9('0x10e')]=0x0;}else if(_0x18b973<_0x4c8a75&&_0x5a6188[_0xa6e9('0x1c6')]===_0xa6e9('0x1c7')){freeVariablesPredictive(_0x5a6188);loggerPredictive['info'](_0xa6e9('0x1c8'),_0xa6e9('0x1c9'),_0x4c8a75,_0xa6e9('0x8a'),_0x5a6188[_0xa6e9('0x3f')]);}else if(_0x73dcc2<_0x5a6188[_0xa6e9('0x10e')]&&_0x5a6188[_0xa6e9('0x1c6')]===_0xa6e9('0x1c7')){freeVariablesPredictive(_0x5a6188);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x1ca'),'Max\x20Drop\x20',_0x73dcc2,_0xa6e9('0x1cb'),_0x5a6188[_0xa6e9('0x10e')],_0xa6e9('0x8a'),_0x5a6188[_0xa6e9('0x3f')]);}else if(!ifInterval(_0x5a6188[_0xa6e9('0x1c4')],_0x5a6188[_0xa6e9('0x8a')])&&_[_0xa6e9('0x81')](_0x5a6188[_0xa6e9('0x8b')])&&!_[_0xa6e9('0x81')](_0x5a6188[_0xa6e9('0x8a')])){_0x5a6188[_0xa6e9('0x8b')]=moment()[_0xa6e9('0x77')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5a6188[_0xa6e9('0x3f')],'started\x20in\x20predictive\x20at',_0x5a6188[_0xa6e9('0x8b')]);this[_0xa6e9('0xc1')](_0x5a6188[_0xa6e9('0x1c4')])[_0xa6e9('0xbc')](this[_0xa6e9('0x1cc')](_0x5a6188))['then'](mergeDataErlangB(_0x5a6188))['then'](this['startMethodPredictive'](_0x5a6188))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5a6188));}else if(!ifInterval(_0x5a6188[_0xa6e9('0x1c4')],_0x5a6188[_0xa6e9('0x8b')])){_0x5a6188[_0xa6e9('0x10e')]=0x0;_0x5a6188['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5a6188['name'],_0xa6e9('0x1cd'),_0x5a6188[_0xa6e9('0x8b')]);clearInterval(_0x5a6188[_0xa6e9('0x8d')]);_0x5a6188[_0xa6e9('0x8d')]=undefined;this['averageHandleTime'](_0x5a6188[_0xa6e9('0x1c4')])[_0xa6e9('0xbc')](this[_0xa6e9('0x1cc')](_0x5a6188))['then'](mergeDataErlangB(_0x5a6188))[_0xa6e9('0xbc')](this[_0xa6e9('0x1ce')](_0x5a6188))[_0xa6e9('0xb4')](loggerCatchPredictive(_0xa6e9('0x1cf'),_0x5a6188));}else if(_0x5a6188['predictiveIntervalAvailable']&&_0x36fa6e<_0x5a6188['predictiveIntervalAvailable']-_0x4e108c){freeVariablesPredictive(_0x5a6188);loggerPredictive[_0xa6e9('0x79')](_0x5a6188[_0xa6e9('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x36fa6e,_0xa6e9('0x1d0'),_0x5a6188[_0xa6e9('0x6f')],'-',_0x4e108c,'=',_0x5a6188[_0xa6e9('0x6f')]-_0x4e108c,')');}else if(_0x5a6188[_0xa6e9('0x6f')]&&_0x36fa6e>_0x5a6188[_0xa6e9('0x6f')]+_0x43774b){freeVariablesPredictive(_0x5a6188);loggerPredictive[_0xa6e9('0x79')](_0x5a6188[_0xa6e9('0x3f')],_0xa6e9('0x1d1'),_0x36fa6e,_0xa6e9('0x1d2'),_0x5a6188[_0xa6e9('0x6f')],'+',_0x43774b,'=',_0x5a6188[_0xa6e9('0x6f')]+_0x43774b,')');}};Dialer[_0xa6e9('0x1d')]['getDataPredictive']=function(_0x1cd4f8){var _0x2fcd47=this;return function(_0x2c6e0c){return new BPromise(function(_0x842aa3,_0x46e830){_[_0xa6e9('0x89')](_0x1cd4f8,_0x2c6e0c[0x0]);if(checkGetDataPredictive(_0x2c6e0c[0x0])){var _0x3f43e7=_0x1cd4f8['predictiveIntervalAvailable']=_0x1cd4f8[_0xa6e9('0xa0')]+_0x1cd4f8[_0xa6e9('0x51')];var _0x14e1f8=_0x1cd4f8[_0xa6e9('0x1c4')]*0x3c;var _0x31efa9=_0x2c6e0c[0x0]['predictiveIntervalAvgTalktime']+_0x2c6e0c[0x0][_0xa6e9('0x6a')];var _0x4cbbad=(_0x2c6e0c[0x0]['predictiveIntervalAnsweredCalls']+_0x2c6e0c[0x0][_0xa6e9('0x6d')]+_0x2c6e0c[0x0][_0xa6e9('0x6c')])/_0x2c6e0c[0x0]['predictiveIntervalTotalCalls'];_0x1cd4f8[_0xa6e9('0x1c1')]=_0x4cbbad>0x0?_0x4cbbad:0x1;switch(_0x1cd4f8[_0xa6e9('0x1c6')]){case _0xa6e9('0x1c7'):var _0x1c3a4d=_0x1cd4f8[_0xa6e9('0x1d3')]/0x64;return _0x2fcd47[_0xa6e9('0x1d4')](_0x3f43e7,_0x14e1f8,_0x31efa9,_0x4cbbad,_0x1c3a4d)[_0xa6e9('0xbc')](function(_0x2449d1){return _0x842aa3(_0x2449d1);});case _0xa6e9('0x1d5'):var _0x45c3a8=_0x1cd4f8['dialPredictiveOptimizationPercentage']/0x64;return _0x2fcd47[_0xa6e9('0x1d6')](_0x3f43e7,_0x14e1f8,_0x31efa9,_0x4cbbad,_0x45c3a8)[_0xa6e9('0xbc')](function(_0x1e4d16){return _0x842aa3(_0x1e4d16);});default:return _0x46e830(msgResponse(_0xa6e9('0x1d7'),_0xa6e9('0x13a'),'Unknown\x20Predictive'));}}else{return _0x46e830(msgResponse(_0xa6e9('0x1d7'),_0xa6e9('0x13a'),_0xa6e9('0x1d8')));}});};};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x1d9')]=function(_0x53d6a2){var _0xf8bf79=this;return function(_0x4955bb){return new BPromise(function(_0x31b4e4,_0x4a4dea){_[_0xa6e9('0x89')](_0x53d6a2,_0x4955bb[0x0]);if(checkGetDataPredictive(_0x4955bb[0x0])){loggerPredictive['info'](JSON['stringify'](_0x4955bb[0x0]));if(_0x53d6a2[_0xa6e9('0x1c6')]===_0xa6e9('0x1c7')){return _0xf8bf79[_0xa6e9('0xc7')](_0x53d6a2['id'])['then'](function(_0x47f007){var _0x3670a8=_0x53d6a2[_0xa6e9('0x52')]-_0x47f007[0x0]['outboundQueuePauses'];var _0xa0dc00=_0x53d6a2[_0xa6e9('0x1c4')]*0x3c;var _0x1daa5e=_0x4955bb[0x0][_0xa6e9('0x6b')]+_0x4955bb[0x0][_0xa6e9('0x6a')];var _0x3af8cb=(_0x4955bb[0x0]['predictiveIntervalAnsweredCalls']+_0x4955bb[0x0][_0xa6e9('0x6d')]+_0x4955bb[0x0][_0xa6e9('0x6c')])/_0x4955bb[0x0][_0xa6e9('0x70')];var _0x33bb28=_0x53d6a2[_0xa6e9('0x1d3')]/0x64;_0x53d6a2['predictiveIntervalPauses']=_0x47f007[0x0]['outboundQueuePauses']||0x0;_0x53d6a2[_0xa6e9('0x1c1')]=_0x3af8cb>0x0?_0x3af8cb:0x1;return _0xf8bf79[_0xa6e9('0x1d4')](_0x3670a8,_0xa0dc00,_0x1daa5e,_0x3af8cb,_0x33bb28);})[_0xa6e9('0xbc')](function(_0x21e2c4){return _0x31b4e4(_0x21e2c4);})[_0xa6e9('0xb4')](function(_0x4bee6f){return _0x4a4dea(msgResponse(_0xa6e9('0x1da'),'Failure',JSON[_0xa6e9('0x4a')](_0x4bee6f)));});}if(_0x53d6a2[_0xa6e9('0x1c6')]==='agentBusyFactor'){return _0xf8bf79[_0xa6e9('0xc7')](_0x53d6a2['id'])[_0xa6e9('0xbc')](function(_0x2ee5ef){var _0x6cb41f=_0x53d6a2[_0xa6e9('0x52')]-_0x2ee5ef[0x0][_0xa6e9('0x1db')];var _0x55eb9e=_0x53d6a2[_0xa6e9('0x1c4')]*0x3c;var _0x1404b4=_0x4955bb[0x0][_0xa6e9('0x6b')]+_0x4955bb[0x0]['predictiveIntervalAvgHoldtime'];var _0x598510=(_0x4955bb[0x0][_0xa6e9('0x69')]+_0x4955bb[0x0][_0xa6e9('0x6d')]+_0x4955bb[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4955bb[0x0]['predictiveIntervalTotalCalls'];var _0x5f3d09=_0x53d6a2[_0xa6e9('0x1d3')]/0x64;_0x53d6a2[_0xa6e9('0x1dc')]=_0x2ee5ef[0x0]['outboundQueuePauses']||0x0;_0x53d6a2[_0xa6e9('0x1c1')]=_0x598510>0x0?_0x598510:0x1;return _0xf8bf79[_0xa6e9('0x1d6')](_0x6cb41f,_0x55eb9e,_0x1404b4,_0x598510,_0x5f3d09);})['then'](function(_0x4851a4){return _0x31b4e4(_0x4851a4);})['catch'](function(_0x500e6d){return _0x4a4dea(msgResponse(_0xa6e9('0x1da'),'Failure',JSON['stringify'](_0x500e6d)));});}}else{return _0x4a4dea(msgResponse(_0xa6e9('0x1d7'),_0xa6e9('0x13a'),_0xa6e9('0x1d8')));}});};};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x1ce')]=function(_0x1083d7){var _0x2544f9=this;return function(){var _0x51bb2b=0x0;var _0x1d21a0=Math[_0xa6e9('0x1c0')](_0x1083d7[_0xa6e9('0x87')]*0x3e8);if(_0x1d21a0>0x0){_0x1d21a0=_0x1d21a0<0x64?0x64:_0x1d21a0;loggerPredictive['info'](_0x1083d7[_0xa6e9('0x3f')],'one\x20call\x20every:',_0x1d21a0,_0xa6e9('0x4b'));_0x1083d7[_0xa6e9('0x8d')]=setInterval(function(){_0x2544f9[_0xa6e9('0x8d')](_0x1083d7);loggerPredictiveCalls[_0xa6e9('0x79')]('[handlePredictive]',_0x51bb2b+=0x1);},_0x1d21a0);}else{loggerPredictive[_0xa6e9('0x79')](_0x1083d7[_0xa6e9('0x3f')],_0xa6e9('0x1dd'));}};};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x1de')]=function(_0x5a103f,_0x5d8257){var _0xa268a6=this;return function(_0x79c867){if(_[_0xa6e9('0x91')](_0x79c867)){if(_[_0xa6e9('0xb0')](_0x5d8257[_0xa6e9('0xd3')])||!_0x5d8257[_0xa6e9('0x1df')]){if(_0x5a103f[_0xa6e9('0x5a')]===_0xa6e9('0x14f')){_0x5a103f[_0xa6e9('0x122')]=_[_0xa6e9('0x81')](_0x5a103f[_0xa6e9('0x122')])?!![]:_0x5a103f[_0xa6e9('0x122')];var _0x3e0c50=uuid['v4']();_0xa268a6[_0xa6e9('0xae')][_0x3e0c50]=new Action(_0x5a103f,_0x5d8257,_0x3e0c50);loggerBooked[_0xa6e9('0x79')]('[booked][checkContactBlack]',_0x3e0c50,_0xa6e9('0x1e0'),JSON[_0xa6e9('0x4a')](_0x5a103f[_0xa6e9('0x122')]),'Queue:\x20',_0x5a103f[_0xa6e9('0x3f')]);if(_0x5a103f[_0xa6e9('0x122')]){_0x5a103f['queueStatusComplete']=![];_0xa268a6['queueBooked'][_0xa268a6[_0xa6e9('0xae')][_0x3e0c50][_0xa6e9('0xb8')]]=[];ami[_0xa6e9('0xb1')]({'actionid':_0x3e0c50,'action':_0xa6e9('0x1e1'),'queue':_0x5a103f[_0xa6e9('0x3f')]})['catch'](function(_0x58ee92){_0xa268a6[_0xa6e9('0xb6')](_0x5a103f);_0xa268a6[_0xa6e9('0xc2')]({'active':![],'ContactId':_0xa268a6[_0xa6e9('0xae')][_0x3e0c50][_0xa6e9('0xf7')],'ListId':_0xa268a6['actions'][_0x3e0c50][_0xa6e9('0xd2')],'VoiceQueueId':_0xa268a6[_0xa6e9('0xae')][_0x3e0c50]['VoiceQueueId']||undefined,'CampaignId':_0xa268a6[_0xa6e9('0xae')][_0x3e0c50][_0xa6e9('0xd5')]||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x1e2')));delete _0xa268a6[_0xa6e9('0xae')][_0x3e0c50];});}else{loggerBooked[_0xa6e9('0x79')](_0xa6e9('0x1e3'),JSON[_0xa6e9('0x4a')](_0x5a103f[_0xa6e9('0x122')]),_0xa6e9('0x1e4'),_0x5a103f[_0xa6e9('0x3f')]);_0xa268a6[_0xa6e9('0xb6')](_0x5a103f);_0xa268a6[_0xa6e9('0xc2')]({'active':![],'ContactId':_0xa268a6[_0xa6e9('0xae')][_0x3e0c50][_0xa6e9('0xf7')],'ListId':_0xa268a6['actions'][_0x3e0c50][_0xa6e9('0xd2')],'VoiceQueueId':_0xa268a6[_0xa6e9('0xae')][_0x3e0c50][_0xa6e9('0xd4')]||undefined,'CampaignId':_0xa268a6[_0xa6e9('0xae')][_0x3e0c50][_0xa6e9('0xd5')]||undefined})['catch'](loggerCatch(_0xa6e9('0x1e2')));delete _0xa268a6['actions'][_0x3e0c50];}}else{return _0xa268a6[_0xa6e9('0x15d')](_0x5a103f,_0x5d8257);}}else{if(getDiff(_0x5d8257[_0xa6e9('0x1e5')])<_0x5a103f['dialRecallMeTimeout']*0x3c){if(_0x5d8257[_0xa6e9('0x1e6')]&&!_0x5d8257['Agent'][_0xa6e9('0x1e7')]){_0xa268a6[_0xa6e9('0x8f')]['run'](_0x5d8257['id'])[_0xa6e9('0x20')](function(){_0xa268a6[_0xa6e9('0xb6')](_0x5a103f);});}else{_0xa268a6['unlockContact']({'active':![]},_0x5d8257['id'],0x1)[_0xa6e9('0x20')](function(){console['log'](_0xa6e9('0x1e8'));_0xa268a6[_0xa6e9('0xb6')](_0x5a103f);});}}else{_0x5a103f[_0xa6e9('0x1e9')]+=0x1;_0xa268a6[_0xa6e9('0xb6')](_0x5a103f);if(_0x5a103f[_0xa6e9('0x1ea')]){_0xa268a6[_0xa6e9('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d8257[_0xa6e9('0xf7')],'ListId':_0x5d8257[_0xa6e9('0xd2')],'VoiceQueueId':_0x5d8257[_0xa6e9('0xd4')]||undefined,'CampaignId':_0x5d8257['CampaignId']||undefined})[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x1eb')));_0xa268a6[_0xa6e9('0xcb')](createObjHistory(_0x5a103f,_0x5d8257,_0xa6e9('0x1ec'),0x17,_0xa6e9('0x1ed')))[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x1ee')));}else{_0xa268a6[_0xa6e9('0xd1')](createObjHistory(_0x5a103f,_0x5d8257,_0xa6e9('0x1ef'),0x16,_0xa6e9('0x1f0')),'[Originate][HistoryRecallClose][historyCatch]',_0xa6e9('0x1f1'));}}}}else{_0x5a103f[_0xa6e9('0x5f')]+=0x1;_0xa268a6[_0xa6e9('0xd1')](createObjHistory(_0x5a103f,_0x5d8257,'BLACKLIST',0xd,_0xa6e9('0x1f2')),_0xa6e9('0x1f3'),_0xa6e9('0x1f4'));throw _0xa6e9('0x1f5');}};};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x153')]=function(_0x2734d9){var _0x14ab17=this;var _0x5708ea=[];var _0x53362a=_0x2734d9[_0xa6e9('0x1f6')]-_0x2734d9[_0xa6e9('0x71')]-_0x2734d9[_0xa6e9('0x1f7')];emitCampaignSummary(_0x2734d9);if(_0x53362a>0x0){if(_0x53362a>this[_0xa6e9('0x26')]){_0x53362a=this[_0xa6e9('0x26')];}_0x2734d9[_0xa6e9('0x1f7')]+=_0x53362a;this[_0xa6e9('0xc6')](_0x2734d9['id'],_0x53362a,_0x2734d9[_0xa6e9('0x1f8')])[_0xa6e9('0xbc')](function(_0x4069cc){_0x2734d9[_0xa6e9('0x1f7')]-=_0x53362a;_0x2734d9[_0xa6e9('0x1f7')]=_0x2734d9[_0xa6e9('0x1f7')]>0x0?_0x2734d9[_0xa6e9('0x1f7')]:0x0;if(!checkContactEmpty(_0x4069cc)){_0x2734d9['message']=_0xa6e9('0x9d');logger['info'](_0xa6e9('0x1f9')+_0x2734d9[_0xa6e9('0x3f')]);}else{_0x2734d9[_0xa6e9('0x71')]+=_0x4069cc[_0xa6e9('0x96')];_0x2734d9[_0xa6e9('0x41')]='RUNNING';for(var _0x1b7a7c=0x0;_0x1b7a7c<_0x4069cc[_0xa6e9('0x96')];_0x1b7a7c+=0x1){_0x2734d9['ivrTotalCallsDays']+=0x1;if(_[_0xa6e9('0xb0')](_0x4069cc[_0x1b7a7c])||_[_0xa6e9('0xb0')](_0x4069cc[_0x1b7a7c][_0xa6e9('0x160')])||_['isNil'](_0x4069cc[_0x1b7a7c][_0xa6e9('0x160')][_0xa6e9('0x161')])){_0x14ab17[_0xa6e9('0xcf')]('[actionOriginate]\x20',_0x2734d9,_0x4069cc[_0x1b7a7c]);}else{_0x14ab17['checkIsBlackListIvr'](_['pick'](_0x4069cc[_0x1b7a7c],[_0xa6e9('0xd5'),_0xa6e9('0x1fa')]))[_0xa6e9('0xbc')](_0x14ab17['checkContactBlack'](_0x2734d9,_0x4069cc[_0x1b7a7c]))['catch'](_0x14ab17[_0xa6e9('0xce')](_0xa6e9('0x1fb'),_0x2734d9));}}}})['catch'](loggerGetContactDialer(_0xa6e9('0x1fc'),_0x2734d9,_0x53362a));}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x14c')]=function(_0x8ffd35,_0xf6af60){var _0x493e6a=this;var _0x36ab3d=[];var _0x1951ce=_0xf6af60>=0x1?_0xf6af60:0x1;var _0x30b044=[];if(_0x8ffd35['dialMethod']===_0xa6e9('0x14f')){_0x1951ce=0x1;}var _0x3dd8b7=Math[_0xa6e9('0x1c0')](_0x8ffd35[_0xa6e9('0x51')]*_0x1951ce)-_0x8ffd35['originated']-_0x8ffd35['temp'];emitVoiceQueueSummary(_0x8ffd35);if(_0x8ffd35[_0xa6e9('0x1fd')]>0x0){var _0x576de3=_0x8ffd35[_0xa6e9('0x1fd')]-_0x8ffd35['originated']-_0x8ffd35['talking']-_0x8ffd35[_0xa6e9('0x1f7')]-_0x8ffd35['pTalking'];if(_0x3dd8b7>_0x576de3){_0x3dd8b7=_0x576de3;}}if(_0x3dd8b7>0x0){if(_0x8ffd35[_0xa6e9('0x5a')]===_0xa6e9('0x14f')){_0x3dd8b7=0x1;}if(_0x3dd8b7>this[_0xa6e9('0x26')]){_0x3dd8b7=this[_0xa6e9('0x26')];}_0x8ffd35[_0xa6e9('0x1f7')]+=_0x3dd8b7;for(var _0x303bc3 in this[_0xa6e9('0x24')]){if(this[_0xa6e9('0x24')]['hasOwnProperty'](_0x303bc3)){if(this['agents'][_0x303bc3][_0xa6e9('0xa8')]===_0xa6e9('0x1fe')&&this[_0xa6e9('0x24')][_0x303bc3][_0xa6e9('0xb2')]===_0xa6e9('0xd9')){_0x36ab3d[_0xa6e9('0x11f')](this[_0xa6e9('0x24')][_0x303bc3]['id']);}}}this[_0xa6e9('0xc5')](_0x8ffd35['id'],_0x36ab3d,_0x3dd8b7,_0x8ffd35[_0xa6e9('0x1f8')])['then'](function(_0x476aae){_0x8ffd35[_0xa6e9('0x1f7')]-=_0x3dd8b7;_0x8ffd35['temp']=_0x8ffd35['temp']>0x0?_0x8ffd35[_0xa6e9('0x1f7')]:0x0;if(!checkContactEmpty(_0x476aae)){_0x493e6a[_0xa6e9('0xba')](_0x8ffd35)[_0xa6e9('0xbc')](sendMessageReschedule(_0x8ffd35))[_0xa6e9('0xb4')](loggerCatch(_0xa6e9('0x1ff')));}else{_0x8ffd35['originated']+=_0x476aae[_0xa6e9('0x96')];_0x8ffd35[_0xa6e9('0x41')]=_0x8ffd35[_0xa6e9('0x5a')]==='booked'?_0xa6e9('0x200'):'RUNNING';for(var _0xc1a8c=0x0;_0xc1a8c<_0x476aae[_0xa6e9('0x96')];_0xc1a8c+=0x1){if(_[_0xa6e9('0xb0')](_0x476aae[_0xc1a8c])||_[_0xa6e9('0xb0')](_0x476aae[_0xc1a8c][_0xa6e9('0x160')])||_['isNil'](_0x476aae[_0xc1a8c][_0xa6e9('0x160')][_0xa6e9('0x161')])){_0x493e6a[_0xa6e9('0xcf')]('[actionOriginate]\x20',_0x8ffd35,_0x476aae[_0xc1a8c]);}else{_0x493e6a[_0xa6e9('0xbd')](_[_0xa6e9('0x125')](_0x476aae[_0xc1a8c],['VoiceQueueId',_0xa6e9('0x1fa')]))[_0xa6e9('0xbc')](_0x493e6a[_0xa6e9('0x1de')](_0x8ffd35,_0x476aae[_0xc1a8c]))[_0xa6e9('0xb4')](_0x493e6a[_0xa6e9('0xce')](_0xa6e9('0x201'),_0x8ffd35));}}}})[_0xa6e9('0xb4')](loggerGetContactDialer(_0xa6e9('0x202'),_0x8ffd35,_0x3dd8b7));}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x8d')]=function(_0x165ea4){var _0x2805c3=this;if(_0x165ea4[_0xa6e9('0x1fd')]>0x0){var _0x5a630f=_0x165ea4[_0xa6e9('0x1fd')]-_0x165ea4[_0xa6e9('0x71')]-_0x165ea4[_0xa6e9('0xa0')];if(_0x5a630f>0x0){this['tryOriginatePredictive'](_0x165ea4);}else{loggerPredictiveCalls[_0xa6e9('0x79')](_0xa6e9('0x203'));}}else{this[_0xa6e9('0x204')](_0x165ea4);}};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x204')]=function(_0x5c583a){var _0x4663ed=this;var _0x571167=[];_0x5c583a[_0xa6e9('0x71')]+=0x1;for(var _0x29d458 in this['agents']){if(this['agents'][_0xa6e9('0x97')](_0x29d458)){if(this[_0xa6e9('0x24')][_0x29d458][_0xa6e9('0xa8')]===_0xa6e9('0x1fe')&&this['agents'][_0x29d458][_0xa6e9('0xb2')]===_0xa6e9('0xd9')){_0x571167[_0xa6e9('0x11f')](this[_0xa6e9('0x24')][_0x29d458]['id']);}}}this[_0xa6e9('0xc5')](_0x5c583a['id'],_0x571167,0x1,_0x5c583a[_0xa6e9('0x1f8')])[_0xa6e9('0xbc')](function(_0x2f8e8d){if(!checkContactEmpty(_0x2f8e8d)){checkContactLowerLimitOriginate(_0x5c583a,0x1,0x0);_0x4663ed['countReScheduled'](_0x5c583a)[_0xa6e9('0xbc')](sendMessageReschedule(_0x5c583a))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x5c583a['message']=_0xa6e9('0x205');if(_[_0xa6e9('0xb0')](_0x2f8e8d[0x0])||_[_0xa6e9('0xb0')](_0x2f8e8d[0x0]['Contact'])||_[_0xa6e9('0xb0')](_0x2f8e8d[0x0][_0xa6e9('0x160')][_0xa6e9('0x161')])){_0x4663ed[_0xa6e9('0xcf')](_0xa6e9('0x201'),_0x5c583a,_0x2f8e8d[0x0]);}else{_0x4663ed[_0xa6e9('0xbd')](_[_0xa6e9('0x125')](_0x2f8e8d[0x0],[_0xa6e9('0xd4'),_0xa6e9('0x1fa')]))[_0xa6e9('0xbc')](_0x4663ed[_0xa6e9('0x1de')](_0x5c583a,_0x2f8e8d[0x0]))['catch'](_0x4663ed['loggerHandler'](_0xa6e9('0x206'),_0x5c583a));}}})['catch'](loggerGetContactDialer(_0xa6e9('0x207'),_0x5c583a,0x1));emitVoiceQueueSummary(_0x5c583a);};Dialer[_0xa6e9('0x1d')]['abandonmentRate']=function(_0x17c357,_0x3c9e1d,_0x3fe3ef,_0x14e3e0,_0x481303,_0x2df3cc){loggerPredictive['info'](_0xa6e9('0x208'));loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x209'),_0x17c357);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x20a'),_0x3c9e1d);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x20b'),_0x3fe3ef);loggerPredictive['info'](_0xa6e9('0x20c'),_0x14e3e0);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x481303);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x80'));return new BPromise(function(_0xf1d9aa,_0x5f236){if(_0x17c357<=0x0||isNaN(_0x17c357)){return _0x5f236(msgResponse('[abandonmentRate]',_0xa6e9('0x49'),_0xa6e9('0x20d')+_0x17c357));}if(_0x3fe3ef<=0x0||isNaN(_0x3fe3ef)){return _0x5f236(msgResponse(_0xa6e9('0x20e'),_0xa6e9('0x49'),'Ts\x20=\x20'+_0x3fe3ef));}if(_0x14e3e0<=0x0||isNaN(_0x14e3e0)){return _0x5f236(msgResponse(_0xa6e9('0x20e'),_0xa6e9('0x49'),_0xa6e9('0x20f')+_0x14e3e0));}if(_0x3c9e1d<=0x0||isNaN(_0x3c9e1d)){return _0x5f236(msgResponse(_0xa6e9('0x20e'),_0xa6e9('0x49'),_0xa6e9('0x210')+_0x3c9e1d));}if(_0x481303<=0x0||isNaN(_0x481303)){return _0x5f236(msgResponse(_0xa6e9('0x20e'),_0xa6e9('0x49'),_0xa6e9('0x211')+_0x481303));}_0x2df3cc=_0x2df3cc||0x0;var _0x283035=0x1/_0x3fe3ef;var _0x3ec7b4=0x0;var _0x586bb4=0x0;var _0x5125a2=0x0;var _0x391d0b=0x0;for(var _0x1b1b67=0x0;_0x5125a2<_0x481303;_0x1b1b67+=0x1){_0x586bb4=_0x1b1b67/_0x3c9e1d;_0x3ec7b4=(_0x14e3e0*_0x586bb4+_0x2df3cc)/_0x283035;_0x5125a2=erlangb(_0x3ec7b4,_0x17c357);_0x391d0b=_0x3ec7b4/_0x17c357*(0x1-erlangb(_0x3ec7b4,_0x17c357));}return _0xf1d9aa({'erlangCalls':_0x1b1b67,'erlangCallToSecond':_0x3c9e1d/_0x1b1b67,'erlangAbandonmentRate':_0x5125a2,'erlangBusyFactor':_0x391d0b});});};Dialer[_0xa6e9('0x1d')][_0xa6e9('0x1d6')]=function(_0xf18db7,_0x6fdf45,_0x3aee7b,_0x2d16fe,_0x34c9f4,_0x414cd0){loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x212'));loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x209'),_0xf18db7);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x20a'),_0x6fdf45);loggerPredictive['info'](_0xa6e9('0x20b'),_0x3aee7b);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x20c'),_0x2d16fe);loggerPredictive[_0xa6e9('0x79')](_0xa6e9('0x213'),_0x34c9f4);loggerPredictive[_0xa6e9('0x79')]('---------------------------');return new BPromise(function(_0x59f40c,_0x567f78){if(_0xf18db7<=0x0||isNaN(_0xf18db7)){return _0x567f78(msgResponse(_0xa6e9('0x214'),'Error',_0xa6e9('0x20d')+_0xf18db7));}if(_0x3aee7b<=0x0||isNaN(_0x3aee7b)){return _0x567f78(msgResponse(_0xa6e9('0x214'),_0xa6e9('0x49'),_0xa6e9('0x215')+_0x3aee7b));}if(_0x2d16fe<=0x0||isNaN(_0x2d16fe)){return _0x567f78(msgResponse(_0xa6e9('0x214'),_0xa6e9('0x49'),'p\x20=\x20'+_0x2d16fe));}if(_0x6fdf45<=0x0||isNaN(_0x6fdf45)){return _0x567f78(msgResponse(_0xa6e9('0x214'),_0xa6e9('0x49'),_0xa6e9('0x210')+_0x6fdf45));}if(_0x34c9f4<=0x0||isNaN(_0x34c9f4)){return _0x567f78(msgResponse('[busyFactor]',_0xa6e9('0x49'),_0xa6e9('0x216')+_0x34c9f4));}_0x414cd0=_0x414cd0||0x0;var _0x4345d9=0x1/_0x3aee7b;var _0x48dfed=0x0;var _0x2a9f06=0x0;var _0xb1b7dd=0x0;var _0x1cb28a=0x0;for(var _0x34dca7=0x0;_0x1cb28a<_0x34c9f4;_0x34dca7+=0x1){_0x2a9f06=_0x34dca7/_0x6fdf45;_0x48dfed=(_0x2d16fe*_0x2a9f06+_0x414cd0)/_0x4345d9;_0xb1b7dd=erlangb(_0x48dfed,_0xf18db7);_0x1cb28a=_0x48dfed/_0xf18db7*(0x1-erlangb(_0x48dfed,_0xf18db7));}return _0x59f40c({'erlangCalls':_0x34dca7,'erlangCallToSecond':_0x6fdf45/_0x34dca7,'erlangAbandonmentRate':_0xb1b7dd,'erlangBusyFactor':_0x1cb28a});});};module[_0xa6e9('0x217')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index fed4a1c..5b869ac 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 _0x3eae=['talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','droptime','ringtime'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x3eae,0xeb));var _0xe3ea=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x3eae[_0x59befa];return _0x1dd63d;};'use strict';var util=require(_0xe3ea('0x0'));var _=require(_0xe3ea('0x1'));var moment=require(_0xe3ea('0x2'));function getSeconds(_0x26fda1,_0x13c4f0){var _0x4224cc=moment(_0x26fda1)[_0xe3ea('0x3')](0x0);var _0x194fa0=moment(_0x13c4f0)[_0xe3ea('0x3')](0x0);return _0x4224cc[_0xe3ea('0x4')](_0x194fa0,_0xe3ea('0x5'));}function QueueCallerAbandon(_0x341e5,_0x5283a3){this[_0xe3ea('0x6')]=_0x341e5[_0xe3ea('0x6')];this[_0xe3ea('0x7')]=_0x341e5['type'];this[_0xe3ea('0x8')]=_0x341e5['type']===_0xe3ea('0x9')?_0xe3ea('0xa'):_0x341e5[_0xe3ea('0x7')];this[_0xe3ea('0xb')]=_0x341e5[_0xe3ea('0xb')];this[_0xe3ea('0xc')]=_0x341e5[_0xe3ea('0xc')];this['countnoanswerretry']=_0x341e5['countnoanswerretry'];this[_0xe3ea('0xd')]=_0x341e5[_0xe3ea('0xb')]+_0x341e5['countcongestionretry']+_0x341e5[_0xe3ea('0xe')]+_0x341e5['countnosuchnumberretry']+_0x341e5[_0xe3ea('0xf')]+_0x341e5['countabandonedretry']+_0x341e5['countmachineretry']+_0x341e5['countagentrejectretry'];this['countnosuchnumberretry']=_0x341e5[_0xe3ea('0x10')];this[_0xe3ea('0xf')]=_0x341e5[_0xe3ea('0xf')];this[_0xe3ea('0x11')]=_0x341e5[_0xe3ea('0x11')];this['countmachineretry']=_0x341e5[_0xe3ea('0x12')];this[_0xe3ea('0x13')]=_0x341e5[_0xe3ea('0x13')];this[_0xe3ea('0x14')]=_0x5283a3[_0xe3ea('0x14')];this[_0xe3ea('0x15')]=_0x341e5[_0xe3ea('0x16')];this[_0xe3ea('0x17')]=_0x341e5['number'];this[_0xe3ea('0x18')]=_0x341e5['starttime'];this[_0xe3ea('0x19')]=_0x341e5[_0xe3ea('0x19')];this['droptime']=_0x341e5['droptime'];this[_0xe3ea('0x1a')]=this[_0xe3ea('0x1b')];this[_0xe3ea('0x1c')]=getSeconds(_0x341e5[_0xe3ea('0x19')],_0x341e5['starttime']);this['holdtime']=getSeconds(this[_0xe3ea('0x1b')],_0x341e5['responsetime']);this[_0xe3ea('0x1d')]=0x0;this[_0xe3ea('0xa')]=_0x5283a3[_0xe3ea('0xa')];this[_0xe3ea('0x1e')]=_0x5283a3[_0xe3ea('0x1f')];this[_0xe3ea('0x20')]=_0x5283a3[_0xe3ea('0x20')];this[_0xe3ea('0x21')]=_0x341e5[_0xe3ea('0x21')];this[_0xe3ea('0x22')]=_0x341e5['callbackuniqueid'];this[_0xe3ea('0x23')]=_0x341e5[_0xe3ea('0x23')];this[_0xe3ea('0x24')]=_0x341e5[_0xe3ea('0x24')];this[_0xe3ea('0x25')]=_0x341e5[_0xe3ea('0x25')];this['ListId']=_0x341e5[_0xe3ea('0x26')];this[_0xe3ea('0x27')]=_0x341e5['UserId'];this[_0xe3ea('0x28')]=_0x341e5[_0xe3ea('0x28')];this['CampaignId']=_0x341e5['CampaignId'];this[_0xe3ea('0x29')]=_0x341e5[_0xe3ea('0x29')]||'';this[_0xe3ea('0x2a')]=_0x341e5[_0xe3ea('0x2a')]||'';}module[_0xe3ea('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xc49f=['originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x24b710,_0x2d5dcf){var _0x2722d4=function(_0x188173){while(--_0x188173){_0x24b710['push'](_0x24b710['shift']());}};_0x2722d4(++_0x2d5dcf);}(_0xc49f,0x17c));var _0xfc49=function(_0x2eed55,_0x143ff0){_0x2eed55=_0x2eed55-0x0;var _0x4141fc=_0xc49f[_0x2eed55];return _0x4141fc;};'use strict';var util=require(_0xfc49('0x0'));var _=require('lodash');var moment=require(_0xfc49('0x1'));function getSeconds(_0x890320,_0x586db0){var _0x5e3e0a=moment(_0x890320)[_0xfc49('0x2')](0x0);var _0x167048=moment(_0x586db0)[_0xfc49('0x2')](0x0);return _0x5e3e0a[_0xfc49('0x3')](_0x167048,_0xfc49('0x4'));}function QueueCallerAbandon(_0x8ab926,_0x47ce1d){this[_0xfc49('0x5')]=_0x8ab926[_0xfc49('0x5')];this[_0xfc49('0x6')]=_0x8ab926[_0xfc49('0x6')];this[_0xfc49('0x7')]=_0x8ab926[_0xfc49('0x6')]===_0xfc49('0x8')?_0xfc49('0x9'):_0x8ab926[_0xfc49('0x6')];this[_0xfc49('0xa')]=_0x8ab926[_0xfc49('0xa')];this[_0xfc49('0xb')]=_0x8ab926[_0xfc49('0xb')];this[_0xfc49('0xc')]=_0x8ab926['countnoanswerretry'];this[_0xfc49('0xd')]=_0x8ab926[_0xfc49('0xa')]+_0x8ab926[_0xfc49('0xb')]+_0x8ab926['countnoanswerretry']+_0x8ab926['countnosuchnumberretry']+_0x8ab926[_0xfc49('0xe')]+_0x8ab926[_0xfc49('0xf')]+_0x8ab926[_0xfc49('0x10')]+_0x8ab926[_0xfc49('0x11')];this['countnosuchnumberretry']=_0x8ab926[_0xfc49('0x12')];this[_0xfc49('0xe')]=_0x8ab926[_0xfc49('0xe')];this[_0xfc49('0xf')]=_0x8ab926[_0xfc49('0xf')];this['countmachineretry']=_0x8ab926[_0xfc49('0x10')];this['countagentrejectretry']=_0x8ab926[_0xfc49('0x11')];this['uniqueid']=_0x47ce1d[_0xfc49('0x13')];this[_0xfc49('0x14')]=_0x8ab926['name'];this['calleridnum']=_0x8ab926[_0xfc49('0x15')];this['starttime']=_0x8ab926[_0xfc49('0x16')];this[_0xfc49('0x17')]=_0x8ab926['responsetime'];this[_0xfc49('0x18')]=_0x8ab926[_0xfc49('0x18')];this[_0xfc49('0x19')]=this[_0xfc49('0x18')];this['ringtime']=getSeconds(_0x8ab926['responsetime'],_0x8ab926[_0xfc49('0x16')]);this[_0xfc49('0x1a')]=getSeconds(this[_0xfc49('0x18')],_0x8ab926[_0xfc49('0x17')]);this[_0xfc49('0x1b')]=0x0;this[_0xfc49('0x9')]=_0x47ce1d[_0xfc49('0x9')];this[_0xfc49('0x1c')]=_0x47ce1d[_0xfc49('0x1d')];this[_0xfc49('0x1e')]=_0x47ce1d[_0xfc49('0x1e')];this['callback']=_0x8ab926['callback'];this[_0xfc49('0x1f')]=_0x8ab926[_0xfc49('0x1f')];this[_0xfc49('0x20')]=_0x8ab926[_0xfc49('0x20')];this[_0xfc49('0x21')]=_0x8ab926[_0xfc49('0x21')];this[_0xfc49('0x22')]=_0x8ab926[_0xfc49('0x22')];this[_0xfc49('0x23')]=_0x8ab926[_0xfc49('0x23')];this[_0xfc49('0x24')]=_0x8ab926[_0xfc49('0x24')];this[_0xfc49('0x25')]=_0x8ab926[_0xfc49('0x25')];this[_0xfc49('0x26')]=_0x8ab926[_0xfc49('0x26')];this[_0xfc49('0x27')]=_0x8ab926[_0xfc49('0x27')]||'';this[_0xfc49('0x28')]=_0x8ab926[_0xfc49('0x28')]||'';}module[_0xfc49('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7387e54..a799baa 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 _0xc3b6=['Trunk','localstationid','headerinfo','path','AttachmentId','util','lodash','moment','uniqueid','format','%s/%s/%s'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xc3b6,0x12e));var _0x6c3b=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xc3b6[_0x2d61b2];return _0x12df89;};'use strict';var util=require(_0x6c3b('0x0'));var _=require(_0x6c3b('0x1'));var moment=require(_0x6c3b('0x2'));function Action(_0x585019,_0x4f1b90,_0x416838){this[_0x6c3b('0x3')]=_0x585019||undefined;this['channel']=util[_0x6c3b('0x4')](_0x6c3b('0x5'),_0x4f1b90['tech'],_0x4f1b90[_0x6c3b('0x6')]['name'],_0x416838['fax']);this[_0x6c3b('0x7')]=_0x4f1b90[_0x6c3b('0x7')];this[_0x6c3b('0x8')]=_0x4f1b90[_0x6c3b('0x8')];this[_0x6c3b('0x9')]=_0x416838[_0x6c3b('0x9')];this[_0x6c3b('0xa')]=_0x416838['AttachmentId'];}module['exports']=Action; \ No newline at end of file +var _0xcd7b=['localstationid','headerinfo','path','AttachmentId','exports','lodash','moment','uniqueid','channel','format'];(function(_0x243921,_0x3eb2fd){var _0x1021be=function(_0x2fe103){while(--_0x2fe103){_0x243921['push'](_0x243921['shift']());}};_0x1021be(++_0x3eb2fd);}(_0xcd7b,0x195));var _0xbcd7=function(_0x23d443,_0x396b4c){_0x23d443=_0x23d443-0x0;var _0x1b8aee=_0xcd7b[_0x23d443];return _0x1b8aee;};'use strict';var util=require('util');var _=require(_0xbcd7('0x0'));var moment=require(_0xbcd7('0x1'));function Action(_0x23b804,_0x1061a2,_0x5366b1){this[_0xbcd7('0x2')]=_0x23b804||undefined;this[_0xbcd7('0x3')]=util[_0xbcd7('0x4')]('%s/%s/%s',_0x1061a2['tech'],_0x1061a2['Trunk']['name'],_0x5366b1['fax']);this[_0xbcd7('0x5')]=_0x1061a2[_0xbcd7('0x5')];this[_0xbcd7('0x6')]=_0x1061a2[_0xbcd7('0x6')];this[_0xbcd7('0x7')]=_0x5366b1[_0xbcd7('0x7')];this['AttachmentId']=_0x5366b1[_0xbcd7('0x8')];}module[_0xbcd7('0x9')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ead6cb9..58a668e 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 _0x4d4c=['FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','Trunk','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','status','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','./rpcDb','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','hangup','syncHangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','prototype','syncFaxStatus','operation','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','logger','[Fax][Message][Error][NoUpdate2]','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate'];(function(_0x30b7aa,_0x298a60){var _0xf3f40b=function(_0x132e2d){while(--_0x132e2d){_0x30b7aa['push'](_0x30b7aa['shift']());}};_0xf3f40b(++_0x298a60);}(_0x4d4c,0x98));var _0xc4d4=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x4d4c[_0x3305de];return _0x3b5a84;};'use strict';var util=require('util');var _=require(_0xc4d4('0x0'));var BPromise=require(_0xc4d4('0x1'));var uuid=require(_0xc4d4('0x2'));var moment=require(_0xc4d4('0x3'));var path=require(_0xc4d4('0x4'));var tiff2pdf=require(_0xc4d4('0x5'));var gs=require('./util/gs');var logger=require(_0xc4d4('0x6'))(_0xc4d4('0x7'));var ami=require('../ami');var rpcDb=require(_0xc4d4('0x8'));var Channel=require('./channel');var ut=require(_0xc4d4('0x9'));var Action=require(_0xc4d4('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xc4d4('0xb'));var faxMessage=require(_0xc4d4('0xc'));function Fax(_0x76726e){this[_0xc4d4('0xd')]={};this[_0xc4d4('0xe')]=_0x76726e['faxAccounts'];this[_0xc4d4('0xf')]=_0x76726e[_0xc4d4('0xf')];this[_0xc4d4('0x10')]={};ami['on']('newchannel',this['syncNewchannel'][_0xc4d4('0x11')](this));ami['on'](_0xc4d4('0x12'),this[_0xc4d4('0x13')][_0xc4d4('0x11')](this));ami['on'](_0xc4d4('0x14'),this[_0xc4d4('0x15')][_0xc4d4('0x11')](this));ami['on'](_0xc4d4('0x16'),this[_0xc4d4('0x17')][_0xc4d4('0x11')](this));ami['on'](_0xc4d4('0x18'),this['syncFaxStatus'][_0xc4d4('0x11')](this));ami['on'](_0xc4d4('0x19'),this['syncReceiveFax'][_0xc4d4('0x11')](this));ami['on'](_0xc4d4('0x1a'),this[_0xc4d4('0x1b')][_0xc4d4('0x11')](this));ami['on']('originateresponse',this[_0xc4d4('0x1c')][_0xc4d4('0x11')](this));}Fax['prototype'][_0xc4d4('0x1d')]=function(_0x57a72a){if(_0x57a72a[_0xc4d4('0x1e')]===_0xc4d4('0x1f')){for(var _0x500eb0 in this['faxAccounts']){if(this[_0xc4d4('0xe')][_0xc4d4('0x20')](_0x500eb0)){if(_0x57a72a['exten']===this[_0xc4d4('0xe')][_0x500eb0][_0xc4d4('0x21')]){this[_0xc4d4('0xd')][_0x57a72a['uniqueid']]={};this['channels'][_0x57a72a[_0xc4d4('0x22')]][_0xc4d4('0x23')]=_0x57a72a['channel'];this[_0xc4d4('0xd')][_0x57a72a[_0xc4d4('0x22')]]['id']=this[_0xc4d4('0xe')][_0x500eb0]['id'];this['channels'][_0x57a72a[_0xc4d4('0x22')]][_0xc4d4('0x24')]=this[_0xc4d4('0xe')][_0x500eb0]['name'];logger[_0xc4d4('0x25')](_0x57a72a[_0xc4d4('0x22')],_0xc4d4('0x26'));}}}}if(this[_0xc4d4('0x10')][_0x57a72a[_0xc4d4('0x22')]]){this['channels'][_0x57a72a['uniqueid']]={};this[_0xc4d4('0xd')][_0x57a72a[_0xc4d4('0x22')]][_0xc4d4('0x23')]=_0x57a72a[_0xc4d4('0x23')];logger[_0xc4d4('0x25')](_0x57a72a[_0xc4d4('0x22')],_0xc4d4('0x26'));}};Fax['prototype'][_0xc4d4('0x13')]=function(_0x171876){if(this[_0xc4d4('0xd')][_0x171876['uniqueid']]){for(var _0x40c572 in _0x171876[_0xc4d4('0x27')]){if(_0x171876[_0xc4d4('0x27')]['hasOwnProperty'](_0x40c572)){this['channels'][_0x171876[_0xc4d4('0x22')]][_0x40c572]=_0x171876[_0xc4d4('0x28')];}}}};Fax['prototype']['syncNewState']=function(_0x26060a){if(this['channels'][_0x26060a[_0xc4d4('0x22')]]){this['channels'][_0x26060a[_0xc4d4('0x22')]]['channelstate']=_0x26060a[_0xc4d4('0x29')];this[_0xc4d4('0xd')][_0x26060a[_0xc4d4('0x22')]][_0xc4d4('0x2a')]=_0x26060a[_0xc4d4('0x2a')];}};Fax[_0xc4d4('0x2b')][_0xc4d4('0x17')]=function(_0x3358a1){if(this['channels'][_0x3358a1[_0xc4d4('0x22')]]){for(var _0x2f9557 in _0x3358a1['variable']){if(_0x3358a1[_0xc4d4('0x27')][_0xc4d4('0x20')](_0x2f9557)){this[_0xc4d4('0xd')][_0x3358a1[_0xc4d4('0x22')]][_0x2f9557]=_0x3358a1[_0xc4d4('0x28')];}}}};Fax[_0xc4d4('0x2b')][_0xc4d4('0x2c')]=function(_0x52ecba){if(this[_0xc4d4('0xd')][_0x52ecba[_0xc4d4('0x22')]]){this[_0xc4d4('0xd')][_0x52ecba[_0xc4d4('0x22')]][_0xc4d4('0x2d')]=_0x52ecba[_0xc4d4('0x2d')];this['channels'][_0x52ecba[_0xc4d4('0x22')]]['status']=_0x52ecba['status'];this[_0xc4d4('0xd')][_0x52ecba[_0xc4d4('0x22')]][_0xc4d4('0x21')]=_0x52ecba[_0xc4d4('0x21')];this[_0xc4d4('0xd')][_0x52ecba[_0xc4d4('0x22')]][_0xc4d4('0x2e')]=_0x52ecba[_0xc4d4('0x2e')];logger['info'](_0x52ecba[_0xc4d4('0x22')],_0xc4d4('0x2f'));}};Fax[_0xc4d4('0x2b')][_0xc4d4('0x30')]=function(_0xe593aa){var _0x3cb223=this;if(this[_0xc4d4('0xd')][_0xe593aa[_0xc4d4('0x22')]]){var _0x1f0c94=this[_0xc4d4('0xd')][_0xe593aa[_0xc4d4('0x22')]]['id'];this[_0xc4d4('0xd')][_0xe593aa[_0xc4d4('0x22')]][_0xc4d4('0x31')]=_0xe593aa[_0xc4d4('0x31')];this['channels'][_0xe593aa[_0xc4d4('0x22')]]['pagestransferred']=_0xe593aa['pagestransferred'];this[_0xc4d4('0xd')][_0xe593aa['uniqueid']]['localstationid']=_0xe593aa[_0xc4d4('0x21')];this[_0xc4d4('0xd')][_0xe593aa[_0xc4d4('0x22')]][_0xc4d4('0x32')]=_0xe593aa['resolution'];this[_0xc4d4('0xd')][_0xe593aa[_0xc4d4('0x22')]][_0xc4d4('0x33')]=_0xe593aa[_0xc4d4('0x33')];this[_0xc4d4('0xd')][_0xe593aa[_0xc4d4('0x22')]][_0xc4d4('0x2e')]=_0xe593aa[_0xc4d4('0x2e')];this['channels'][_0xe593aa['uniqueid']]['calleridnum']=_0xe593aa[_0xc4d4('0x34')];if(this[_0xc4d4('0xd')][_0xe593aa[_0xc4d4('0x22')]][_0xc4d4('0x35')]>0x0){tiff2pdf(_0xe593aa[_0xc4d4('0x2e')],_0xc4d4('0x36'),function(_0x2bd1e9){logger[_0xc4d4('0x25')](_0xe593aa[_0xc4d4('0x22')],_0xc4d4('0x37'),_0x2bd1e9[_0xc4d4('0x38')]);attachment[_0xc4d4('0x39')]({'name':path[_0xc4d4('0x3a')](_0xe593aa[_0xc4d4('0x2e')])[_0xc4d4('0x24')],'basename':path['parse'](_0xe593aa['filename'])[_0xc4d4('0x24')]+'.pdf','type':_0xc4d4('0x3b')})[_0xc4d4('0x3c')](function(_0x41f879){faxAccount[_0xc4d4('0x3d')](_0x1f0c94,{'from':_0xe593aa['calleridnum'],'mapKey':_0xc4d4('0x7'),'body':path[_0xc4d4('0x3a')](_0xe593aa[_0xc4d4('0x2e')])[_0xc4d4('0x24')]+_0xc4d4('0x3e'),'AttachmentId':_0x41f879['id']})[_0xc4d4('0x3f')](function(_0x4fb08d){logger[_0xc4d4('0x40')](_0xe593aa[_0xc4d4('0x22')],_0xc4d4('0x41'),JSON[_0xc4d4('0x42')](_0x4fb08d));});})[_0xc4d4('0x3f')](function(_0x53bc90){logger[_0xc4d4('0x40')](_0xe593aa[_0xc4d4('0x22')],'\x20receiveFax\x20',JSON[_0xc4d4('0x42')](_0x53bc90));});});}logger[_0xc4d4('0x25')](_0xe593aa[_0xc4d4('0x22')],_0xc4d4('0x43'));}};Fax[_0xc4d4('0x2b')]['syncOriginateResponse']=function(_0x4ab68a){if(this['actions'][_0x4ab68a[_0xc4d4('0x22')]]){_['merge'](this[_0xc4d4('0xd')][_0x4ab68a[_0xc4d4('0x22')]],_['pick'](_0x4ab68a,[_0xc4d4('0x44'),_0xc4d4('0x45')]));}};function updateStatus(_0x5e1e0){if(_0x5e1e0[_0xc4d4('0x46')]){faxMessage['update'](_0x5e1e0[_0xc4d4('0x46')],{'failMessage':_0xc4d4('0x47')})[_0xc4d4('0x3c')](function(_0x5f0e87){ut['logger'](_0xc4d4('0x48'),_0x5f0e87);})[_0xc4d4('0x3f')](function(_0x18a6b6){ut['logger'](_0xc4d4('0x49'),_0x18a6b6);});}else{ut[_0xc4d4('0x4a')](_0xc4d4('0x4b'));}}Fax['prototype']['updateStatus']=function(_0x565ce9,_0x35772f,_0x2bc5a9){var _0x576413=this;var _0x588fd1={};if(_0x35772f){_0x588fd1={'read':_0x35772f};}else{_0x588fd1={'failMessage':_0x2bc5a9};}if(this[_0xc4d4('0x10')][_0x565ce9][_0xc4d4('0x46')]){faxMessage[_0xc4d4('0x4c')](this[_0xc4d4('0x10')][_0x565ce9]['AttachmentId'],_0x588fd1)[_0xc4d4('0x3c')](function(_0x5ec760){ut['logger'](_0xc4d4('0x4d'),_0x5ec760);})['catch'](function(_0x1c0937){ut['logger'](_0xc4d4('0x4e'),_0x1c0937);})[_0xc4d4('0x4f')](function(){delete _0x576413[_0xc4d4('0xd')][_0x565ce9];delete _0x576413[_0xc4d4('0x10')][_0x565ce9];});}else{ut[_0xc4d4('0x4a')](_0xc4d4('0x50'));delete this[_0xc4d4('0xd')][_0x565ce9];delete this['actions'][_0x565ce9];}};Fax[_0xc4d4('0x2b')][_0xc4d4('0x1b')]=function(_0x2a72cc){var _0x13cdd6=this;if(this[_0xc4d4('0xd')][_0x2a72cc[_0xc4d4('0x22')]]){if(this[_0xc4d4('0x10')][_0x2a72cc[_0xc4d4('0x22')]]){this['channels'][_0x2a72cc[_0xc4d4('0x22')]]['id']=this[_0xc4d4('0x10')][_0x2a72cc[_0xc4d4('0x22')]]['id'];this[_0xc4d4('0xd')][_0x2a72cc[_0xc4d4('0x22')]][_0xc4d4('0x24')]=this['actions'][_0x2a72cc[_0xc4d4('0x22')]][_0xc4d4('0x24')];}logger[_0xc4d4('0x25')](_0x2a72cc['uniqueid'],this[_0xc4d4('0x10')][_0x2a72cc[_0xc4d4('0x22')]]?_0xc4d4('0x51'):_0xc4d4('0x52'),JSON['stringify'](this[_0xc4d4('0xd')][_0x2a72cc['uniqueid']]));if(this[_0xc4d4('0x10')][_0x2a72cc['uniqueid']]){if(this[_0xc4d4('0xd')][_0x2a72cc[_0xc4d4('0x22')]][_0xc4d4('0x53')]>0x0&&this['channels'][_0x2a72cc[_0xc4d4('0x22')]][_0xc4d4('0x18')]===_0xc4d4('0x54')){this['updateStatus'](_0x2a72cc[_0xc4d4('0x22')],!![]);}else{this[_0xc4d4('0x55')](_0x2a72cc[_0xc4d4('0x22')],![],this['channels'][_0x2a72cc[_0xc4d4('0x22')]][_0xc4d4('0x56')]?_0xc4d4('0x57')+this[_0xc4d4('0xd')][_0x2a72cc[_0xc4d4('0x22')]][_0xc4d4('0x56')]:'SENDING\x20FAILED');}}}};Fax[_0xc4d4('0x2b')][_0xc4d4('0x58')]=function(_0x125291){var _0x54b6b0=this;return new BPromise(function(_0x13925e,_0x1b3f1d){_0x54b6b0[_0xc4d4('0x59')](_0x125291,_0x54b6b0[_0xc4d4('0xe')][_0x125291[_0xc4d4('0x5a')]])['then'](function(_0x2416e6){ut[_0xc4d4('0x4a')](_0xc4d4('0x5b'),_0x2416e6);_0x13925e(ut[_0xc4d4('0x38')](_0xc4d4('0x5c')));})[_0xc4d4('0x3f')](function(_0x462d02){ut[_0xc4d4('0x4a')](_0xc4d4('0x5d'),_0x462d02);updateStatus(_0x125291);_0x1b3f1d(ut[_0xc4d4('0x38')]('Fax\x20failed'));});});};Fax[_0xc4d4('0x2b')][_0xc4d4('0x5e')]=function(_0x12cb27){var _0x5ead2e=this;return new BPromise(function(_0x437080,_0xd32b44){var _0x2eb95c=_0x5ead2e['checkTrunk'](_0x5ead2e['faxAccounts'][_0x12cb27[_0xc4d4('0x5a')]][_0xc4d4('0x5f')],_0x12cb27);if(_0x2eb95c['isValid']){_0x437080(ut[_0xc4d4('0x38')](_0xc4d4('0x60')));}else{_0xd32b44(ut[_0xc4d4('0x38')](_0x2eb95c['message']));}});};function originate(_0x3a729c,_0x237144,_0x908e04){return new BPromise(function(_0x238889,_0x57560f){if(_0x908e04){var _0x165015=util[_0xc4d4('0x61')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xc4d4('0x3a')](_0x3a729c[_0xc4d4('0x4')])[_0xc4d4('0x24')],_0x3a729c[_0xc4d4('0x4')]);gs[_0xc4d4('0x62')](_0x165015)[_0xc4d4('0x3c')](function(){_0x3a729c[_0xc4d4('0x4')]=util[_0xc4d4('0x61')](_0xc4d4('0x63'),path[_0xc4d4('0x3a')](_0x3a729c[_0xc4d4('0x4')])[_0xc4d4('0x64')],path[_0xc4d4('0x3a')](_0x3a729c[_0xc4d4('0x4')])[_0xc4d4('0x24')]);_0x237144[_0xc4d4('0x65')]=_0x3a729c[_0xc4d4('0x4')];ut[_0xc4d4('0x4a')](_0xc4d4('0x66'),'');ami['Action'](ut[_0xc4d4('0x67')](_0x3a729c,_0x237144))[_0xc4d4('0x3c')](function(_0x298a89){_0x238889(_0x298a89);})[_0xc4d4('0x3f')](function(_0x59b372){_0x57560f(_0x59b372);});})[_0xc4d4('0x3f')](function(_0x519bde){_0x57560f(_0x519bde);});}else{ami[_0xc4d4('0x68')](ut[_0xc4d4('0x67')](_0x3a729c,_0x237144))[_0xc4d4('0x3c')](function(_0x160e4a){_0x238889(_0x160e4a);})[_0xc4d4('0x3f')](function(_0x2aa290){_0x57560f(_0x2aa290);});}});}Fax['prototype']['execOriginate']=function(_0x59afcf,_0x336293){var _0x517d78=this;return new BPromise(function(_0x56a4f4,_0x28e0f4){var _0x283320=uuid['v4']();var _0x3ab6d1=ut[_0xc4d4('0x69')](_0x59afcf,_0x336293);_0x517d78['actions'][_0x283320]=new Action(_0x283320,_0x336293,_0x59afcf);var _0x37c9c8=_0x517d78['actions'][_0x283320];if(path[_0xc4d4('0x3a')](_0x59afcf[_0xc4d4('0x4')])[_0xc4d4('0x6a')]===_0xc4d4('0x3e')){originate(_0x37c9c8,_0x3ab6d1,!![])[_0xc4d4('0x3c')](function(_0x1703d6){_0x56a4f4(_0x1703d6);})[_0xc4d4('0x3f')](function(_0x182207){_0x28e0f4(_0x182207);});}else{originate(_0x37c9c8,_0x3ab6d1,![])[_0xc4d4('0x3c')](function(_0x17c0e3){_0x56a4f4(_0x17c0e3);})[_0xc4d4('0x3f')](function(_0x38cdb1){_0x28e0f4(_0x38cdb1);});}});};Fax[_0xc4d4('0x2b')][_0xc4d4('0x6b')]=function(_0x114370){return!_[_0xc4d4('0x6c')](_0x114370)&&!_[_0xc4d4('0x6c')](_0x114370[_0xc4d4('0x24')])&&!_['isNil'](_0x114370[_0xc4d4('0x6d')])&&_0x114370[_0xc4d4('0x6d')]&&!_[_0xc4d4('0x6c')](this['trunks'][util[_0xc4d4('0x61')](_0xc4d4('0x6e'),_0x114370[_0xc4d4('0x24')])])&&!_[_0xc4d4('0x6c')](this['trunks'][util[_0xc4d4('0x61')]('SIP/%s',_0x114370[_0xc4d4('0x24')])]['status'])&&(this[_0xc4d4('0xf')][util[_0xc4d4('0x61')](_0xc4d4('0x6e'),_0x114370[_0xc4d4('0x24')])]['status']===_0xc4d4('0x6f')||this[_0xc4d4('0xf')][util['format'](_0xc4d4('0x6e'),_0x114370[_0xc4d4('0x24')])][_0xc4d4('0x70')]===_0xc4d4('0x71'));};Fax[_0xc4d4('0x2b')]['checkTrunk']=function(_0x2dc801,_0x551dfa){if(!this[_0xc4d4('0x6b')](_0x2dc801)){ut[_0xc4d4('0x4a')](_0xc4d4('0x72'),_['isNil'](_0x2dc801)?'':_0x2dc801['name']+_0xc4d4('0x73'));return{'isValid':![],'message':_0xc4d4('0x74')};}if(_[_0xc4d4('0x6c')](_0x551dfa[_0xc4d4('0x7')])){ut['logger'](_0xc4d4('0x75'),JSON[_0xc4d4('0x42')](_0x551dfa));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xc4d4('0x6c')](_0x551dfa[_0xc4d4('0x4')])){ut['logger'](_0xc4d4('0x76'),JSON['stringify'](_0x551dfa));return{'isValid':![],'message':_0xc4d4('0x77')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xc4d4('0x78')]=Fax; \ No newline at end of file +var _0x225f=['syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','logger','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','bluebird','uuid','moment','path','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel'];(function(_0x567703,_0x4b1cfa){var _0x1cd94a=function(_0x25dcfe){while(--_0x25dcfe){_0x567703['push'](_0x567703['shift']());}};_0x1cd94a(++_0x4b1cfa);}(_0x225f,0x14d));var _0xf225=function(_0x442d42,_0x4db649){_0x442d42=_0x442d42-0x0;var _0x33079f=_0x225f[_0x442d42];return _0x33079f;};'use strict';var util=require(_0xf225('0x0'));var _=require('lodash');var BPromise=require(_0xf225('0x1'));var uuid=require(_0xf225('0x2'));var moment=require(_0xf225('0x3'));var path=require(_0xf225('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0xf225('0x5'))(_0xf225('0x6'));var ami=require(_0xf225('0x7'));var rpcDb=require(_0xf225('0x8'));var Channel=require(_0xf225('0x9'));var ut=require(_0xf225('0xa'));var Action=require('./action');var faxAccount=require(_0xf225('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xf225('0xc'));function Fax(_0x4cea05){this[_0xf225('0xd')]={};this[_0xf225('0xe')]=_0x4cea05[_0xf225('0xe')];this[_0xf225('0xf')]=_0x4cea05[_0xf225('0xf')];this[_0xf225('0x10')]={};ami['on'](_0xf225('0x11'),this[_0xf225('0x12')][_0xf225('0x13')](this));ami['on'](_0xf225('0x14'),this[_0xf225('0x15')][_0xf225('0x13')](this));ami['on'](_0xf225('0x16'),this[_0xf225('0x17')][_0xf225('0x13')](this));ami['on'](_0xf225('0x18'),this[_0xf225('0x19')][_0xf225('0x13')](this));ami['on'](_0xf225('0x1a'),this[_0xf225('0x1b')][_0xf225('0x13')](this));ami['on'](_0xf225('0x1c'),this[_0xf225('0x1d')][_0xf225('0x13')](this));ami['on'](_0xf225('0x1e'),this['syncHangup'][_0xf225('0x13')](this));ami['on'](_0xf225('0x1f'),this['syncOriginateResponse'][_0xf225('0x13')](this));}Fax[_0xf225('0x20')]['syncNewchannel']=function(_0x4c694b){if(_0x4c694b[_0xf225('0x21')]===_0xf225('0x22')){for(var _0x52754f in this[_0xf225('0xe')]){if(this[_0xf225('0xe')][_0xf225('0x23')](_0x52754f)){if(_0x4c694b[_0xf225('0x24')]===this[_0xf225('0xe')][_0x52754f]['localstationid']){this[_0xf225('0xd')][_0x4c694b[_0xf225('0x25')]]={};this[_0xf225('0xd')][_0x4c694b[_0xf225('0x25')]][_0xf225('0x26')]=_0x4c694b['channel'];this[_0xf225('0xd')][_0x4c694b[_0xf225('0x25')]]['id']=this['faxAccounts'][_0x52754f]['id'];this[_0xf225('0xd')][_0x4c694b['uniqueid']][_0xf225('0x27')]=this[_0xf225('0xe')][_0x52754f][_0xf225('0x27')];logger[_0xf225('0x28')](_0x4c694b[_0xf225('0x25')],_0xf225('0x29'));}}}}if(this['actions'][_0x4c694b[_0xf225('0x25')]]){this['channels'][_0x4c694b[_0xf225('0x25')]]={};this[_0xf225('0xd')][_0x4c694b['uniqueid']][_0xf225('0x26')]=_0x4c694b['channel'];logger['info'](_0x4c694b[_0xf225('0x25')],_0xf225('0x29'));}};Fax[_0xf225('0x20')][_0xf225('0x15')]=function(_0x3c729f){if(this[_0xf225('0xd')][_0x3c729f[_0xf225('0x25')]]){for(var _0x1a67a9 in _0x3c729f['variable']){if(_0x3c729f[_0xf225('0x2a')]['hasOwnProperty'](_0x1a67a9)){this[_0xf225('0xd')][_0x3c729f[_0xf225('0x25')]][_0x1a67a9]=_0x3c729f[_0xf225('0x2b')];}}}};Fax[_0xf225('0x20')][_0xf225('0x17')]=function(_0x40ca7a){if(this[_0xf225('0xd')][_0x40ca7a[_0xf225('0x25')]]){this[_0xf225('0xd')][_0x40ca7a[_0xf225('0x25')]][_0xf225('0x2c')]=_0x40ca7a[_0xf225('0x2c')];this[_0xf225('0xd')][_0x40ca7a[_0xf225('0x25')]][_0xf225('0x2d')]=_0x40ca7a[_0xf225('0x2d')];}};Fax[_0xf225('0x20')]['syncNewExten']=function(_0x295821){if(this['channels'][_0x295821[_0xf225('0x25')]]){for(var _0xba4a39 in _0x295821['variable']){if(_0x295821[_0xf225('0x2a')]['hasOwnProperty'](_0xba4a39)){this[_0xf225('0xd')][_0x295821[_0xf225('0x25')]][_0xba4a39]=_0x295821[_0xf225('0x2b')];}}}};Fax['prototype'][_0xf225('0x1b')]=function(_0x703571){if(this['channels'][_0x703571[_0xf225('0x25')]]){this[_0xf225('0xd')][_0x703571[_0xf225('0x25')]][_0xf225('0x2e')]=_0x703571[_0xf225('0x2e')];this[_0xf225('0xd')][_0x703571['uniqueid']][_0xf225('0x2f')]=_0x703571[_0xf225('0x2f')];this[_0xf225('0xd')][_0x703571[_0xf225('0x25')]][_0xf225('0x30')]=_0x703571[_0xf225('0x30')];this[_0xf225('0xd')][_0x703571[_0xf225('0x25')]][_0xf225('0x31')]=_0x703571[_0xf225('0x31')];logger['info'](_0x703571[_0xf225('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0xf225('0x20')][_0xf225('0x1d')]=function(_0x2d06a2){var _0x1eac0a=this;if(this[_0xf225('0xd')][_0x2d06a2[_0xf225('0x25')]]){var _0x12bbc3=this['channels'][_0x2d06a2['uniqueid']]['id'];this[_0xf225('0xd')][_0x2d06a2[_0xf225('0x25')]]['remotestationid']=_0x2d06a2[_0xf225('0x32')];this[_0xf225('0xd')][_0x2d06a2['uniqueid']][_0xf225('0x33')]=_0x2d06a2[_0xf225('0x33')];this[_0xf225('0xd')][_0x2d06a2[_0xf225('0x25')]][_0xf225('0x30')]=_0x2d06a2[_0xf225('0x30')];this[_0xf225('0xd')][_0x2d06a2['uniqueid']][_0xf225('0x34')]=_0x2d06a2[_0xf225('0x34')];this[_0xf225('0xd')][_0x2d06a2['uniqueid']][_0xf225('0x35')]=_0x2d06a2[_0xf225('0x35')];this[_0xf225('0xd')][_0x2d06a2[_0xf225('0x25')]][_0xf225('0x31')]=_0x2d06a2[_0xf225('0x31')];this[_0xf225('0xd')][_0x2d06a2['uniqueid']][_0xf225('0x36')]=_0x2d06a2[_0xf225('0x36')];if(this[_0xf225('0xd')][_0x2d06a2[_0xf225('0x25')]][_0xf225('0x33')]>0x0){tiff2pdf(_0x2d06a2[_0xf225('0x31')],_0xf225('0x37'),function(_0x2a3ce7){logger[_0xf225('0x28')](_0x2d06a2[_0xf225('0x25')],_0xf225('0x38'),_0x2a3ce7[_0xf225('0x39')]);attachment[_0xf225('0x3a')]({'name':path['parse'](_0x2d06a2[_0xf225('0x31')])['name'],'basename':path[_0xf225('0x3b')](_0x2d06a2['filename'])[_0xf225('0x27')]+'.pdf','type':_0xf225('0x3c')})[_0xf225('0x3d')](function(_0x4fa4ce){faxAccount[_0xf225('0x3e')](_0x12bbc3,{'from':_0x2d06a2[_0xf225('0x36')],'mapKey':_0xf225('0x6'),'body':path[_0xf225('0x3b')](_0x2d06a2[_0xf225('0x31')])[_0xf225('0x27')]+_0xf225('0x3f'),'AttachmentId':_0x4fa4ce['id']})[_0xf225('0x40')](function(_0x46757c){logger['error'](_0x2d06a2['uniqueid'],_0xf225('0x41'),JSON[_0xf225('0x42')](_0x46757c));});})['catch'](function(_0x5d19f8){logger[_0xf225('0x43')](_0x2d06a2['uniqueid'],'\x20receiveFax\x20',JSON[_0xf225('0x42')](_0x5d19f8));});});}logger['info'](_0x2d06a2[_0xf225('0x25')],_0xf225('0x44'));}};Fax[_0xf225('0x20')][_0xf225('0x45')]=function(_0x32c65c){if(this['actions'][_0x32c65c[_0xf225('0x25')]]){_[_0xf225('0x46')](this[_0xf225('0xd')][_0x32c65c[_0xf225('0x25')]],_[_0xf225('0x47')](_0x32c65c,[_0xf225('0x48'),_0xf225('0x49')]));}};function updateStatus(_0x1942dd){if(_0x1942dd[_0xf225('0x4a')]){faxMessage[_0xf225('0x4b')](_0x1942dd[_0xf225('0x4a')],{'failMessage':_0xf225('0x4c')})[_0xf225('0x3d')](function(_0x36b454){ut['logger'](_0xf225('0x4d'),_0x36b454);})[_0xf225('0x40')](function(_0x2f46ed){ut['logger'](_0xf225('0x4e'),_0x2f46ed);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0xf225('0x4f')]=function(_0x1ba270,_0x158ab7,_0x2d3017){var _0x32412a=this;var _0x4627ee={};if(_0x158ab7){_0x4627ee={'read':_0x158ab7};}else{_0x4627ee={'failMessage':_0x2d3017};}if(this[_0xf225('0x10')][_0x1ba270][_0xf225('0x4a')]){faxMessage[_0xf225('0x4b')](this[_0xf225('0x10')][_0x1ba270][_0xf225('0x4a')],_0x4627ee)[_0xf225('0x3d')](function(_0x4eff20){ut[_0xf225('0x50')](_0xf225('0x51'),_0x4eff20);})[_0xf225('0x40')](function(_0x1f171d){ut['logger'](_0xf225('0x52'),_0x1f171d);})[_0xf225('0x53')](function(){delete _0x32412a[_0xf225('0xd')][_0x1ba270];delete _0x32412a[_0xf225('0x10')][_0x1ba270];});}else{ut[_0xf225('0x50')](_0xf225('0x54'));delete this['channels'][_0x1ba270];delete this[_0xf225('0x10')][_0x1ba270];}};Fax[_0xf225('0x20')][_0xf225('0x55')]=function(_0x1c0b26){var _0x13f050=this;if(this[_0xf225('0xd')][_0x1c0b26['uniqueid']]){if(this[_0xf225('0x10')][_0x1c0b26[_0xf225('0x25')]]){this[_0xf225('0xd')][_0x1c0b26[_0xf225('0x25')]]['id']=this[_0xf225('0x10')][_0x1c0b26[_0xf225('0x25')]]['id'];this[_0xf225('0xd')][_0x1c0b26[_0xf225('0x25')]]['name']=this[_0xf225('0x10')][_0x1c0b26[_0xf225('0x25')]][_0xf225('0x27')];}logger['info'](_0x1c0b26['uniqueid'],this[_0xf225('0x10')][_0x1c0b26[_0xf225('0x25')]]?_0xf225('0x56'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0xf225('0xd')][_0x1c0b26[_0xf225('0x25')]]));if(this['actions'][_0x1c0b26[_0xf225('0x25')]]){if(this[_0xf225('0xd')][_0x1c0b26[_0xf225('0x25')]][_0xf225('0x57')]>0x0&&this['channels'][_0x1c0b26[_0xf225('0x25')]][_0xf225('0x1a')]===_0xf225('0x58')){this[_0xf225('0x4f')](_0x1c0b26[_0xf225('0x25')],!![]);}else{this['updateStatus'](_0x1c0b26['uniqueid'],![],this[_0xf225('0xd')][_0x1c0b26[_0xf225('0x25')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0xf225('0xd')][_0x1c0b26[_0xf225('0x25')]]['faxstatusstring']:_0xf225('0x59'));}}}};Fax[_0xf225('0x20')]['send']=function(_0x504305){var _0x5413e7=this;return new BPromise(function(_0x549ccf,_0x5dd87a){_0x5413e7[_0xf225('0x5a')](_0x504305,_0x5413e7[_0xf225('0xe')][_0x504305[_0xf225('0x5b')]])[_0xf225('0x3d')](function(_0x9e227d){ut[_0xf225('0x50')]('[Fax][execOriginate][success]',_0x9e227d);_0x549ccf(ut[_0xf225('0x39')](_0xf225('0x5c')));})[_0xf225('0x40')](function(_0x2dff2a){ut['logger'](_0xf225('0x5d'),_0x2dff2a);updateStatus(_0x504305);_0x5dd87a(ut['message'](_0xf225('0x5e')));});});};Fax[_0xf225('0x20')][_0xf225('0x5f')]=function(_0x42e6c0){var _0x33f153=this;return new BPromise(function(_0x1426d5,_0x50e50e){var _0x1f897a=_0x33f153[_0xf225('0x60')](_0x33f153[_0xf225('0xe')][_0x42e6c0[_0xf225('0x5b')]]['Trunk'],_0x42e6c0);if(_0x1f897a['isValid']){_0x1426d5(ut['message'](_0xf225('0x61')));}else{_0x50e50e(ut[_0xf225('0x39')](_0x1f897a[_0xf225('0x39')]));}});};function originate(_0x126241,_0x4471cd,_0x4aee15){return new BPromise(function(_0x25a259,_0xf33ae7){if(_0x4aee15){var _0x23db97=util[_0xf225('0x62')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xf225('0x3b')](_0x126241[_0xf225('0x4')])[_0xf225('0x27')],_0x126241['path']);gs[_0xf225('0x63')](_0x23db97)[_0xf225('0x3d')](function(){_0x126241['path']=util[_0xf225('0x62')](_0xf225('0x64'),path[_0xf225('0x3b')](_0x126241[_0xf225('0x4')])[_0xf225('0x65')],path['parse'](_0x126241['path'])[_0xf225('0x27')]);_0x4471cd[_0xf225('0x66')]=_0x126241['path'];ut[_0xf225('0x50')](_0xf225('0x67'),'');ami['Action'](ut[_0xf225('0x68')](_0x126241,_0x4471cd))['then'](function(_0xc25aab){_0x25a259(_0xc25aab);})[_0xf225('0x40')](function(_0x13b6f6){_0xf33ae7(_0x13b6f6);});})[_0xf225('0x40')](function(_0x7d272a){_0xf33ae7(_0x7d272a);});}else{ami['Action'](ut[_0xf225('0x68')](_0x126241,_0x4471cd))['then'](function(_0x27c9ee){_0x25a259(_0x27c9ee);})[_0xf225('0x40')](function(_0x4cd145){_0xf33ae7(_0x4cd145);});}});}Fax[_0xf225('0x20')]['execOriginate']=function(_0x46c9c2,_0x2d2461){var _0x14db12=this;return new BPromise(function(_0x1d486e,_0xf84e1e){var _0x291e37=uuid['v4']();var _0x466166=ut[_0xf225('0x69')](_0x46c9c2,_0x2d2461);_0x14db12['actions'][_0x291e37]=new Action(_0x291e37,_0x2d2461,_0x46c9c2);var _0x4d3a47=_0x14db12[_0xf225('0x10')][_0x291e37];if(path[_0xf225('0x3b')](_0x46c9c2[_0xf225('0x4')])['ext']===_0xf225('0x3f')){originate(_0x4d3a47,_0x466166,!![])['then'](function(_0x5743bc){_0x1d486e(_0x5743bc);})['catch'](function(_0x3a2cc3){_0xf84e1e(_0x3a2cc3);});}else{originate(_0x4d3a47,_0x466166,![])[_0xf225('0x3d')](function(_0xae9796){_0x1d486e(_0xae9796);})['catch'](function(_0x2abc82){_0xf84e1e(_0x2abc82);});}});};Fax[_0xf225('0x20')][_0xf225('0x6a')]=function(_0x7ddec){return!_['isNil'](_0x7ddec)&&!_['isNil'](_0x7ddec[_0xf225('0x27')])&&!_[_0xf225('0x6b')](_0x7ddec['active'])&&_0x7ddec[_0xf225('0x6c')]&&!_[_0xf225('0x6b')](this[_0xf225('0xf')][util['format'](_0xf225('0x6d'),_0x7ddec['name'])])&&!_['isNil'](this[_0xf225('0xf')][util['format']('SIP/%s',_0x7ddec[_0xf225('0x27')])][_0xf225('0x2f')])&&(this['trunks'][util['format'](_0xf225('0x6d'),_0x7ddec[_0xf225('0x27')])][_0xf225('0x2f')]==='reachable'||this[_0xf225('0xf')][util[_0xf225('0x62')](_0xf225('0x6d'),_0x7ddec['name'])][_0xf225('0x2f')]===_0xf225('0x6e'));};Fax[_0xf225('0x20')]['checkTrunk']=function(_0x2e67aa,_0x2d5061){if(!this[_0xf225('0x6a')](_0x2e67aa)){ut[_0xf225('0x50')](_0xf225('0x6f'),_[_0xf225('0x6b')](_0x2e67aa)?'':_0x2e67aa[_0xf225('0x27')]+_0xf225('0x70'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xf225('0x6b')](_0x2d5061[_0xf225('0x6')])){ut['logger'](_0xf225('0x71'),JSON[_0xf225('0x42')](_0x2d5061));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xf225('0x6b')](_0x2d5061[_0xf225('0x4')])){ut['logger'](_0xf225('0x72'),JSON[_0xf225('0x42')](_0x2d5061));return{'isValid':![],'message':_0xf225('0x73')};}return{'isValid':!![],'message':_0xf225('0x74')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 4bfebb2..8c7f349 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 _0x69c2=['then','catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x4451f1,_0xe1da5e){var _0x3593fb=function(_0x17bc89){while(--_0x17bc89){_0x4451f1['push'](_0x4451f1['shift']());}};_0x3593fb(++_0xe1da5e);}(_0x69c2,0x1d7));var _0x269c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x69c2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x269c('0x0'));var BPromise=require(_0x269c('0x1'));var logger=require('../../../config/logger')(_0x269c('0x2'));var _=require(_0x269c('0x3'));var faxAccount=require(_0x269c('0x4'));function loggerCatch(_0x861cb8){return function(_0x2f2e28){logger[_0x269c('0x5')](_0x861cb8,util[_0x269c('0x6')](_0x2f2e28,{'showHidden':![],'depth':null}));};}exports[_0x269c('0x7')]=function(_0x4076bd,_0x13d6b1){return BPromise[_0x269c('0x8')]()[_0x269c('0x9')](faxAccount[_0x269c('0x7')](_0x4076bd,_0x13d6b1))[_0x269c('0xa')](loggerCatch(_0x269c('0xb')));}; \ No newline at end of file +var _0x7b4c=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b4c,0x1ee));var _0xc7b4=function(_0x1d76e0,_0x198e92){_0x1d76e0=_0x1d76e0-0x0;var _0x52bfb0=_0x7b4c[_0x1d76e0];return _0x52bfb0;};'use strict';var util=require(_0xc7b4('0x0'));var BPromise=require(_0xc7b4('0x1'));var logger=require(_0xc7b4('0x2'))(_0xc7b4('0x3'));var _=require(_0xc7b4('0x4'));var faxAccount=require(_0xc7b4('0x5'));function loggerCatch(_0x1d31d6){return function(_0x5bafd0){logger[_0xc7b4('0x6')](_0x1d31d6,util[_0xc7b4('0x7')](_0x5bafd0,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0xfb809e,_0x258ae2){return BPromise[_0xc7b4('0x8')]()[_0xc7b4('0x9')](faxAccount['notify'](_0xfb809e,_0x258ae2))[_0xc7b4('0xa')](loggerCatch(_0xc7b4('0xb')));}; \ 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 c29b793..8723b41 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 _0x6ef8=['fax','bluebird','child_process','exec','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x39fdad,_0x1b8980){var _0x2089a1=function(_0x1772cb){while(--_0x1772cb){_0x39fdad['push'](_0x39fdad['shift']());}};_0x2089a1(++_0x1b8980);}(_0x6ef8,0xe4));var _0x86ef=function(_0x1cdef3,_0x2d347a){_0x1cdef3=_0x1cdef3-0x0;var _0x20ffbd=_0x6ef8[_0x1cdef3];return _0x20ffbd;};'use strict';var util=require(_0x86ef('0x0'));var logger=require(_0x86ef('0x1'))(_0x86ef('0x2'));var BPromise=require(_0x86ef('0x3'));var exec=require(_0x86ef('0x4'))[_0x86ef('0x5')];exports['execute']=function(_0x134c38){return new BPromise(function(_0x515190,_0x1edc25){exec(_0x134c38,function(_0x28bafb,_0x3c1a5e,_0x47aecc){logger['info'](_0x86ef('0x6'),_0x3c1a5e);if(_0x28bafb){logger[_0x86ef('0x7')](_0x86ef('0x6'),_0x86ef('0x8'),util[_0x86ef('0x9')](_0x28bafb,{'showHidden':![],'depth':null}),_0x3c1a5e,_0x47aecc);_0x1edc25(_0x28bafb);}_0x515190(_0x3c1a5e);});});}; \ No newline at end of file +var _0x534b=['bluebird','child_process','exec','execute','info','Exec\x20gs','util'];(function(_0x2b4c36,_0x4d1a74){var _0xb79214=function(_0x117428){while(--_0x117428){_0x2b4c36['push'](_0x2b4c36['shift']());}};_0xb79214(++_0x4d1a74);}(_0x534b,0x1bf));var _0xb534=function(_0x13c4da,_0x2f953b){_0x13c4da=_0x13c4da-0x0;var _0x497f39=_0x534b[_0x13c4da];return _0x497f39;};'use strict';var util=require(_0xb534('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0xb534('0x1'));var exec=require(_0xb534('0x2'))[_0xb534('0x3')];exports[_0xb534('0x4')]=function(_0x5d2f15){return new BPromise(function(_0x922094,_0x2aa8ce){exec(_0x5d2f15,function(_0x33a3f1,_0x345da0,_0xb90260){logger[_0xb534('0x5')](_0xb534('0x6'),_0x345da0);if(_0x33a3f1){logger[_0xb534('0x5')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x33a3f1,{'showHidden':![],'depth':null}),_0x345da0,_0xb90260);_0x2aa8ce(_0x33a3f1);}_0x922094(_0x345da0);});});}; \ 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 fdbfbc6..20c329b 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 _0xb43b=['ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','from-sip','util','lodash','../../../../config/logger','fax','message','logger','info'];(function(_0xbc49d2,_0x1f221b){var _0x4863b7=function(_0x4091a2){while(--_0x4091a2){_0xbc49d2['push'](_0xbc49d2['shift']());}};_0x4863b7(++_0x1f221b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x30343c,_0x57edf1){_0x30343c=_0x30343c-0x0;var _0x3100e5=_0xb43b[_0x30343c];return _0x3100e5;};'use strict';var util=require(_0xbb43('0x0'));var _=require(_0xbb43('0x1'));var moment=require('moment');var logger=require(_0xbb43('0x2'))(_0xbb43('0x3'));exports[_0xbb43('0x4')]=function(_0x4cf605){return{'message':_0x4cf605};};exports[_0xbb43('0x5')]=function(_0x41aff6,_0x351254){logger[_0xbb43('0x6')](_0x41aff6,util['inspect'](_0x351254,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x378df5,_0x553520){var _0x80fe61={'XMF-ECM':_0x553520[_0xbb43('0x7')],'XMF-HEADERINFO':_0x553520[_0xbb43('0x8')],'XMF-MINRATE':_0x553520[_0xbb43('0x9')],'XMF-MAXRATE':_0x553520[_0xbb43('0xa')],'XMF-MODEM':util['format'](_0xbb43('0xb'),_0x553520[_0xbb43('0xc')]),'XMF-GATEWAY':_0x553520['gateway'],'XMF-FAXDETECT':_0x553520[_0xbb43('0xd')],'XMF-T38TIMEOUT':_0x553520[_0xbb43('0xe')],'XMF-LOCALSTATIONID':_0x553520[_0xbb43('0xf')],'XMF-PATH':_0x378df5[_0xbb43('0x10')]};return _0x80fe61;};exports[_0xbb43('0x11')]=function(_0x2bef86,_0x480cc2){return{'actionid':_0x2bef86[_0xbb43('0x12')],'action':_0xbb43('0x13'),'channel':_0x2bef86['channel'],'Exten':'xcally-motion-fax','Context':_0xbb43('0x14'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x2bef86[_0xbb43('0x8')]?_0x2bef86['headerinfo']:'',_0x2bef86[_0xbb43('0xf')]),'variable':_0x480cc2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2bef86[_0xbb43('0x12')]};}; \ No newline at end of file +var _0xe13a=['ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables'];(function(_0x4cd9d8,_0x4cb901){var _0x3aa58=function(_0x174fea){while(--_0x174fea){_0x4cd9d8['push'](_0x4cd9d8['shift']());}};_0x3aa58(++_0x4cb901);}(_0xe13a,0x178));var _0xae13=function(_0x2ab54c,_0x23c65f){_0x2ab54c=_0x2ab54c-0x0;var _0x479ea1=_0xe13a[_0x2ab54c];return _0x479ea1;};'use strict';var util=require('util');var _=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var logger=require(_0xae13('0x2'))(_0xae13('0x3'));exports['message']=function(_0x3aaf90){return{'message':_0x3aaf90};};exports[_0xae13('0x4')]=function(_0x3ebbfe,_0x10abd7){logger[_0xae13('0x5')](_0x3ebbfe,util[_0xae13('0x6')](_0x10abd7,{'showHidden':![],'depth':null}));};exports[_0xae13('0x7')]=function(_0x3379ed,_0x341ba4){var _0x4ae51f={'XMF-ECM':_0x341ba4[_0xae13('0x8')],'XMF-HEADERINFO':_0x341ba4[_0xae13('0x9')],'XMF-MINRATE':_0x341ba4[_0xae13('0xa')],'XMF-MAXRATE':_0x341ba4[_0xae13('0xb')],'XMF-MODEM':util[_0xae13('0xc')](_0xae13('0xd'),_0x341ba4[_0xae13('0xe')]),'XMF-GATEWAY':_0x341ba4[_0xae13('0xf')],'XMF-FAXDETECT':_0x341ba4[_0xae13('0x10')],'XMF-T38TIMEOUT':_0x341ba4['t38timeout'],'XMF-LOCALSTATIONID':_0x341ba4[_0xae13('0x11')],'XMF-PATH':_0x3379ed[_0xae13('0x12')]};return _0x4ae51f;};exports[_0xae13('0x13')]=function(_0x3a6d41,_0x14df2d){return{'actionid':_0x3a6d41[_0xae13('0x14')],'action':_0xae13('0x15'),'channel':_0x3a6d41['channel'],'Exten':_0xae13('0x16'),'Context':_0xae13('0x17'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x3a6d41['headerinfo']?_0x3a6d41['headerinfo']:'',_0x3a6d41['localstationid']),'variable':_0x14df2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3a6d41[_0xae13('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8d1f44c..24edac0 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 _0xe69a=['./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','getAgents','then','initAgents','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','sync','catch','./realtime','./report','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory'];(function(_0x17eaab,_0x200552){var _0x197654=function(_0x5ea30a){while(--_0x5ea30a){_0x17eaab['push'](_0x17eaab['shift']());}};_0x197654(++_0x200552);}(_0xe69a,0x72));var _0xae69=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xe69a[_0xae7c2f];return _0x5d7001;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require(_0xae69('0x0'));var Report=require(_0xae69('0x1'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0xae69('0x2'));var Preview=require(_0xae69('0x3'));var Fax=require(_0xae69('0x4'));var user=require('./rpc/user');var voiceQueue=require(_0xae69('0x5'));var voiceQueueReport=require(_0xae69('0x6'));var voiceCallReport=require(_0xae69('0x7'));var trunk=require(_0xae69('0x8'));var trigger=require(_0xae69('0x9'));var template=require(_0xae69('0xa'));var cmHopperHistory=require(_0xae69('0xb'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xae69('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xae69('0xd'));var salesforce=require(_0xae69('0xe'));var sugarcrm=require(_0xae69('0xf'));var freshdesk=require(_0xae69('0x10'));var desk=require(_0xae69('0x11'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xae69('0x12'));var freshsales=require(_0xae69('0x13'));var servicenow=require(_0xae69('0x14'));var dynamics365=require(_0xae69('0x15'));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()[_0xae69('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xae69('0x16')](_0xae69('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0xae69('0x18')]())[_0xae69('0x19')](realtime[_0xae69('0x1a')]())['then'](user['getTelephones']())[_0xae69('0x19')](realtime[_0xae69('0x1b')]())[_0xae69('0x19')](trunk[_0xae69('0x1c')]())['then'](realtime['initTrunks']())['then'](voiceQueue[_0xae69('0x1d')]())[_0xae69('0x19')](realtime[_0xae69('0x1e')]())[_0xae69('0x19')](trigger['getTriggers']())[_0xae69('0x19')](realtime[_0xae69('0x1f')]())['then'](template[_0xae69('0x20')]())['then'](realtime[_0xae69('0x21')]())['then'](zendesk[_0xae69('0x22')]())[_0xae69('0x19')](realtime[_0xae69('0x23')]())['then'](salesforce['getSalesforceAccounts']())['then'](realtime[_0xae69('0x24')]())['then'](sugarcrm[_0xae69('0x25')]())[_0xae69('0x19')](realtime[_0xae69('0x26')]())[_0xae69('0x19')](freshdesk[_0xae69('0x27')]())[_0xae69('0x19')](realtime[_0xae69('0x28')]())[_0xae69('0x19')](desk[_0xae69('0x29')]())['then'](realtime[_0xae69('0x2a')]())['then'](zoho['getZohoAccounts']())[_0xae69('0x19')](realtime[_0xae69('0x2b')]())[_0xae69('0x19')](vtiger[_0xae69('0x2c')]())[_0xae69('0x19')](realtime['initVtigerAccounts']())[_0xae69('0x19')](freshsales[_0xae69('0x2d')]())['then'](realtime[_0xae69('0x2e')]())[_0xae69('0x19')](servicenow['getServicenowAccounts']())[_0xae69('0x19')](realtime['initServicenowAccounts']())[_0xae69('0x19')](dynamics365['getDynamics365Accounts']())[_0xae69('0x19')](realtime['initDynamics365Accounts']())[_0xae69('0x19')](campaign[_0xae69('0x2f')]())[_0xae69('0x19')](realtime[_0xae69('0x30')]())[_0xae69('0x19')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xae69('0x31')]())[_0xae69('0x19')](faxAccount[_0xae69('0x32')]())[_0xae69('0x19')](realtime[_0xae69('0x33')]())[_0xae69('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xae69('0x34')]()[_0xae69('0x19')](voiceQueueReport[_0xae69('0x35')]())[_0xae69('0x19')](realtime[_0xae69('0x36')]())[_0xae69('0x19')](cmHopperHistory[_0xae69('0x37')]())[_0xae69('0x19')](realtime[_0xae69('0x38')]())[_0xae69('0x19')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0xae69('0x39')]())[_0xae69('0x19')](voiceCallReport[_0xae69('0x3a')]())['then'](realtime[_0xae69('0x3b')]())[_0xae69('0x19')](function(_0x11b14f){})['catch'](function(_0x170704){console[_0xae69('0x3c')](_0x170704);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x3c1637){return initRealtime();})[_0xae69('0x19')](function(){return initParams();})['then'](function(){report[_0xae69('0x3d')]();setInterval(initRealtime,0x1388);})[_0xae69('0x3e')](function(_0x58078b){console['log'](_0x58078b);});}main(); \ No newline at end of file +var _0x1600=['getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','util','moment','./server','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./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','getTrunks','initTrunks'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x1600,0x13f));var _0x0160=function(_0x267384,_0x5d02a2){_0x267384=_0x267384-0x0;var _0x1387e6=_0x1600[_0x267384];return _0x1387e6;};'use strict';var BPromise=require('bluebird');var util=require(_0x0160('0x0'));var moment=require(_0x0160('0x1'));var server=require(_0x0160('0x2'));var Realtime=require('./realtime');var Report=require(_0x0160('0x3'));var Acw=require(_0x0160('0x4'));var Trigger=require(_0x0160('0x5'));var Dialer=require('./dialer');var Preview=require(_0x0160('0x6'));var Fax=require(_0x0160('0x7'));var user=require(_0x0160('0x8'));var voiceQueue=require(_0x0160('0x9'));var voiceQueueReport=require(_0x0160('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x0160('0xb'));var trigger=require(_0x0160('0xc'));var template=require(_0x0160('0xd'));var cmHopperHistory=require(_0x0160('0xe'));var campaign=require(_0x0160('0xf'));var voiceExtension=require(_0x0160('0x10'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x0160('0x11'));var salesforce=require(_0x0160('0x12'));var sugarcrm=require(_0x0160('0x13'));var freshdesk=require(_0x0160('0x14'));var desk=require(_0x0160('0x15'));var zoho=require(_0x0160('0x16'));var vtiger=require(_0x0160('0x17'));var freshsales=require(_0x0160('0x18'));var servicenow=require(_0x0160('0x19'));var dynamics365=require(_0x0160('0x1a'));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()[_0x0160('0x1b')](_0x0160('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0160('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0160('0x1d')]()[_0x0160('0x1e')](user[_0x0160('0x1f')]())[_0x0160('0x1e')](realtime[_0x0160('0x20')]())['then'](user[_0x0160('0x21')]())[_0x0160('0x1e')](realtime['initTelephones']())[_0x0160('0x1e')](trunk[_0x0160('0x22')]())[_0x0160('0x1e')](realtime[_0x0160('0x23')]())[_0x0160('0x1e')](voiceQueue[_0x0160('0x24')]())[_0x0160('0x1e')](realtime[_0x0160('0x25')]())[_0x0160('0x1e')](trigger[_0x0160('0x26')]())[_0x0160('0x1e')](realtime['initTriggers']())[_0x0160('0x1e')](template[_0x0160('0x27')]())[_0x0160('0x1e')](realtime[_0x0160('0x28')]())[_0x0160('0x1e')](zendesk[_0x0160('0x29')]())[_0x0160('0x1e')](realtime[_0x0160('0x2a')]())['then'](salesforce[_0x0160('0x2b')]())[_0x0160('0x1e')](realtime[_0x0160('0x2c')]())[_0x0160('0x1e')](sugarcrm['getSugarcrmAccounts']())[_0x0160('0x1e')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x0160('0x2d')]())[_0x0160('0x1e')](realtime[_0x0160('0x2e')]())[_0x0160('0x1e')](desk['getDeskAccounts']())[_0x0160('0x1e')](realtime['initDeskAccounts']())[_0x0160('0x1e')](zoho[_0x0160('0x2f')]())[_0x0160('0x1e')](realtime[_0x0160('0x30')]())[_0x0160('0x1e')](vtiger[_0x0160('0x31')]())[_0x0160('0x1e')](realtime[_0x0160('0x32')]())[_0x0160('0x1e')](freshsales[_0x0160('0x33')]())[_0x0160('0x1e')](realtime[_0x0160('0x34')]())[_0x0160('0x1e')](servicenow[_0x0160('0x35')]())['then'](realtime['initServicenowAccounts']())[_0x0160('0x1e')](dynamics365[_0x0160('0x36')]())[_0x0160('0x1e')](realtime[_0x0160('0x37')]())[_0x0160('0x1e')](campaign[_0x0160('0x38')]())['then'](realtime[_0x0160('0x39')]())[_0x0160('0x1e')](voiceExtension[_0x0160('0x3a')]())[_0x0160('0x1e')](realtime[_0x0160('0x3b')]())[_0x0160('0x1e')](faxAccount['getFaxAccounts']())[_0x0160('0x1e')](realtime[_0x0160('0x3c')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x0160('0x1e')](voiceQueueReport[_0x0160('0x3d')]())[_0x0160('0x1e')](realtime[_0x0160('0x3e')]())[_0x0160('0x1e')](cmHopperHistory[_0x0160('0x3f')]())[_0x0160('0x1e')](realtime[_0x0160('0x40')]())[_0x0160('0x1e')](cmHopperHistory[_0x0160('0x41')]())[_0x0160('0x1e')](realtime['initCampaignHopperHistory']())[_0x0160('0x1e')](voiceCallReport[_0x0160('0x42')]())[_0x0160('0x1e')](realtime['initVoiceCallReports']())[_0x0160('0x1e')](function(_0xbcbb96){})[_0x0160('0x43')](function(_0x34f2bf){console[_0x0160('0x44')](_0x34f2bf);});}function main(){return server[_0x0160('0x45')](realtime,preview,fax)['then'](function(_0x1b161b){return initRealtime();})[_0x0160('0x1e')](function(){return initParams();})[_0x0160('0x1e')](function(){report[_0x0160('0x46')]();setInterval(initRealtime,0x1388);})[_0x0160('0x43')](function(_0x4cbf6d){console['log'](_0x4cbf6d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 4d11480..28fbc30 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 _0xa938=['address','phone','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','toLowerCase','inuse','statePause','format','status','voiceStatus','interface','onhold','stringify','user:%s','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown'];(function(_0x5c8889,_0x110541){var _0x892859=function(_0x26706e){while(--_0x26706e){_0x5c8889['push'](_0x5c8889['shift']());}};_0x892859(++_0x110541);}(_0xa938,0x1ea));var _0x8a93=function(_0x10f464,_0x18183a){_0x10f464=_0x10f464-0x0;var _0x497b77=_0xa938[_0x10f464];return _0x497b77;};'use strict';var _=require(_0x8a93('0x0'));var util=require('util');var moment=require(_0x8a93('0x1'));var md5=require(_0x8a93('0x2'));var Redis=require(_0x8a93('0x3'));var config=require(_0x8a93('0x4'));config[_0x8a93('0x5')]=_[_0x8a93('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8a93('0x7'))(new Redis(config[_0x8a93('0x5')]));function Agent(_0x437098){this['id']=_0x437098['id']||0x0;this[_0x8a93('0x8')]=_0x437098['name']||'';this[_0x8a93('0x9')]=_0x437098[_0x8a93('0x9')]||'';this[_0x8a93('0xa')]=_0x437098[_0x8a93('0xa')]||'';this[_0x8a93('0xb')]=_0x437098[_0x8a93('0xb')]||'';this[_0x8a93('0xc')]=_0x8a93('0xd');this['stateTime']=0x0;this['status']=_0x8a93('0xd');this[_0x8a93('0xe')]='';this[_0x8a93('0xf')]='';this[_0x8a93('0x10')]='';this['interface']='';this[_0x8a93('0x11')]=_0x437098[_0x8a93('0x11')]||![];this['voiceStatus']=_0x8a93('0xd');this[_0x8a93('0x12')]=0x0;this[_0x8a93('0x13')]='';this[_0x8a93('0x14')]='';this['onhold']=![];this['local']=![];this[_0x8a93('0x2')]='';}Agent[_0x8a93('0x15')][_0x8a93('0x16')]=function(_0x4a676e){var _0x52e33b;if(_0x4a676e&&_0x4a676e[_0x8a93('0xc')]){_0x52e33b=_0x4a676e['state'][_0x8a93('0x17')]();switch(_0x52e33b){case'not_inuse':_0x52e33b='idle';break;case _0x8a93('0x18'):_0x52e33b='talking';break;}}if(_0x52e33b&&this['voiceStatus']!==_0x52e33b||_0x4a676e[_0x8a93('0x19')]){this[_0x8a93('0x12')]=_['toNumber'](moment()[_0x8a93('0x1a')]('x'));}if(_0x52e33b){this['voiceStatus']=_0x52e33b;}var _0x15444c={'id':this['id'],'name':this['name'],'email':this[_0x8a93('0x9')],'accountcode':this['accountcode'],'fullname':this[_0x8a93('0xb')],'state':this[_0x8a93('0xc')],'stateTime':this['stateTime'],'status':this[_0x8a93('0x1b')],'address':this[_0x8a93('0xe')],'online':this[_0x8a93('0x11')],'voiceStatus':this[_0x8a93('0x1c')],'voiceStatusTime':this[_0x8a93('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x8a93('0x1d')],'onhold':this[_0x8a93('0x1e')]};var _0x3c6890=md5(JSON[_0x8a93('0x1f')](_0x15444c));if(this[_0x8a93('0x2')]!==_0x3c6890){this[_0x8a93('0x2')]=_0x3c6890;io['to'](util[_0x8a93('0x1a')](_0x8a93('0x20'),_0x15444c['name']))[_0x8a93('0x21')](_0x8a93('0x22'),_0x15444c);}};module[_0x8a93('0x23')]=Agent; \ No newline at end of file +var _0x568f=['onhold','local','updateStatusRealtime','toLowerCase','idle','inuse','talking','voiceStatus','statePause','toNumber','status','address','stringify','format','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','unknown','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue'];(function(_0x51b61a,_0xd54166){var _0x57e357=function(_0x29019f){while(--_0x29019f){_0x51b61a['push'](_0x51b61a['shift']());}};_0x57e357(++_0xd54166);}(_0x568f,0x183));var _0xf568=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x568f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf568('0x0'));var util=require(_0xf568('0x1'));var moment=require(_0xf568('0x2'));var md5=require(_0xf568('0x3'));var Redis=require(_0xf568('0x4'));var config=require(_0xf568('0x5'));config[_0xf568('0x6')]=_['defaults'](config['redis'],{'host':_0xf568('0x7'),'port':0x18eb});var io=require(_0xf568('0x8'))(new Redis(config[_0xf568('0x6')]));function Agent(_0x2335b6){this['id']=_0x2335b6['id']||0x0;this[_0xf568('0x9')]=_0x2335b6[_0xf568('0x9')]||'';this[_0xf568('0xa')]=_0x2335b6[_0xf568('0xa')]||'';this[_0xf568('0xb')]=_0x2335b6[_0xf568('0xb')]||'';this['fullname']=_0x2335b6[_0xf568('0xc')]||'';this[_0xf568('0xd')]='unknown';this[_0xf568('0xe')]=0x0;this['status']=_0xf568('0xf');this['address']='';this[_0xf568('0x10')]='';this[_0xf568('0x11')]='';this[_0xf568('0x12')]='';this[_0xf568('0x13')]=_0x2335b6[_0xf568('0x13')]||![];this['voiceStatus']=_0xf568('0xf');this[_0xf568('0x14')]=0x0;this[_0xf568('0x15')]='';this[_0xf568('0x16')]='';this[_0xf568('0x17')]=![];this[_0xf568('0x18')]=![];this[_0xf568('0x3')]='';}Agent['prototype'][_0xf568('0x19')]=function(_0x1b92ac){var _0x268dda;if(_0x1b92ac&&_0x1b92ac[_0xf568('0xd')]){_0x268dda=_0x1b92ac[_0xf568('0xd')][_0xf568('0x1a')]();switch(_0x268dda){case'not_inuse':_0x268dda=_0xf568('0x1b');break;case _0xf568('0x1c'):_0x268dda=_0xf568('0x1d');break;}}if(_0x268dda&&this[_0xf568('0x1e')]!==_0x268dda||_0x1b92ac[_0xf568('0x1f')]){this[_0xf568('0x14')]=_[_0xf568('0x20')](moment()['format']('x'));}if(_0x268dda){this[_0xf568('0x1e')]=_0x268dda;}var _0x4113e4={'id':this['id'],'name':this['name'],'email':this[_0xf568('0xa')],'accountcode':this[_0xf568('0xb')],'fullname':this[_0xf568('0xc')],'state':this[_0xf568('0xd')],'stateTime':this['stateTime'],'status':this[_0xf568('0x21')],'address':this[_0xf568('0x22')],'online':this[_0xf568('0x13')],'voiceStatus':this[_0xf568('0x1e')],'voiceStatusTime':this[_0xf568('0x14')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xf568('0x16')],'interface':this['interface'],'onhold':this[_0xf568('0x17')]};var _0x27f70c=md5(JSON[_0xf568('0x23')](_0x4113e4));if(this[_0xf568('0x3')]!==_0x27f70c){this[_0xf568('0x3')]=_0x27f70c;io['to'](util[_0xf568('0x24')](_0xf568('0x25'),_0x4113e4[_0xf568('0x9')]))[_0xf568('0x26')](_0xf568('0x27'),_0x4113e4);}};module[_0xf568('0x28')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 576ac1b..fd34332 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 _0x7dab=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x46f250,_0x31a541){var _0x1e2c6a=function(_0xcb9dd6){while(--_0xcb9dd6){_0x46f250['push'](_0x46f250['shift']());}};_0x1e2c6a(++_0x31a541);}(_0x7dab,0x10a));var _0xb7da=function(_0x2bb471,_0x2ce9a6){_0x2bb471=_0x2bb471-0x0;var _0x50d1ba=_0x7dab[_0x2bb471];return _0x50d1ba;};'use strict';function Campaign(_0x4401fa){this['id']=_0x4401fa['id']||0x0;this[_0xb7da('0x0')]=_0x4401fa['name']||'';this[_0xb7da('0x1')]=_0x4401fa[_0xb7da('0x1')]||_0xb7da('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xb7da('0x3')]=0x0;this[_0xb7da('0x4')]=0x0;this[_0xb7da('0x5')]='';this[_0xb7da('0x6')]=!![];this[_0xb7da('0x7')]=_0x4401fa['active'];this[_0xb7da('0x8')]=_0x4401fa[_0xb7da('0x8')];this[_0xb7da('0x9')]=_0x4401fa[_0xb7da('0x9')]||null;this[_0xb7da('0xa')]=_0x4401fa[_0xb7da('0xa')]?_0x4401fa[_0xb7da('0xa')]:null;this[_0xb7da('0xb')]=_0x4401fa[_0xb7da('0xb')];this[_0xb7da('0xc')]=_0x4401fa['dialOriginateCallerIdNumber'];this[_0xb7da('0xd')]=_0x4401fa[_0xb7da('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x4401fa[_0xb7da('0xe')];this['dialCongestionRetryFrequency']=_0x4401fa[_0xb7da('0xf')];this[_0xb7da('0x10')]=_0x4401fa['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x4401fa[_0xb7da('0x11')];this[_0xb7da('0x12')]=_0x4401fa[_0xb7da('0x12')];this[_0xb7da('0x13')]=_0x4401fa[_0xb7da('0x13')];this[_0xb7da('0x14')]=_0x4401fa[_0xb7da('0x14')];this[_0xb7da('0x15')]=_0x4401fa[_0xb7da('0x15')]||0x3;this[_0xb7da('0x16')]=_0x4401fa['dialNoSuchNumberRetryFrequency']||0x96;this[_0xb7da('0x17')]=_0x4401fa[_0xb7da('0x17')]||0x3;this[_0xb7da('0x18')]=_0x4401fa[_0xb7da('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x4401fa[_0xb7da('0x19')]||0x3;this[_0xb7da('0x1a')]=_0x4401fa[_0xb7da('0x1a')]||0x96;this[_0xb7da('0x1b')]=_0x4401fa[_0xb7da('0x1b')]||0x3;this[_0xb7da('0x1c')]=_0x4401fa[_0xb7da('0x1c')]||0x96;this[_0xb7da('0x1d')]=_0x4401fa[_0xb7da('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4401fa[_0xb7da('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x4401fa[_0xb7da('0x1f')]||'DESC';this['dialPrefix']=_0x4401fa['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4401fa[_0xb7da('0x20')]||undefined;this[_0xb7da('0x21')]=_0x4401fa[_0xb7da('0x21')]||undefined;this[_0xb7da('0x22')]=_0x4401fa[_0xb7da('0x22')]?_0x4401fa['TrunkBackup']:undefined;this[_0xb7da('0x23')]=_0x4401fa[_0xb7da('0x23')]?_0x4401fa[_0xb7da('0x23')]:undefined;this[_0xb7da('0x24')]=_0x4401fa[_0xb7da('0x24')]?_0x4401fa['Interval']:undefined;this[_0xb7da('0x25')]=_0x4401fa['SquareProject']?_0x4401fa['SquareProject']:undefined;this[_0xb7da('0x26')]=_0x4401fa[_0xb7da('0x25')]?_0x4401fa[_0xb7da('0x25')][_0xb7da('0x0')]:undefined;this[_0xb7da('0x27')]=_0x4401fa[_0xb7da('0x27')]||![];this[_0xb7da('0x28')]=_0x4401fa[_0xb7da('0x28')];this[_0xb7da('0x29')]=_0x4401fa[_0xb7da('0x29')];this[_0xb7da('0x2a')]=_0x4401fa[_0xb7da('0x2a')];this[_0xb7da('0x2b')]=_0x4401fa[_0xb7da('0x2b')];this['dialAMDMinWordLength']=_0x4401fa[_0xb7da('0x2c')];this[_0xb7da('0x2d')]=_0x4401fa[_0xb7da('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x4401fa[_0xb7da('0x2e')];this['dialAMDSilenceThreshold']=_0x4401fa[_0xb7da('0x2f')];this[_0xb7da('0x30')]=_0x4401fa[_0xb7da('0x30')];}module[_0xb7da('0x31')]=Campaign; \ No newline at end of file +var _0x7284=['dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','message','sendMessageOneNotActive','active','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','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x389c69,_0x4ed7b5){var _0x12c459=function(_0x280ef1){while(--_0x280ef1){_0x389c69['push'](_0x389c69['shift']());}};_0x12c459(++_0x4ed7b5);}(_0x7284,0x9b));var _0x4728=function(_0x2fc152,_0x1faf4d){_0x2fc152=_0x2fc152-0x0;var _0x5c3709=_0x7284[_0x2fc152];return _0x5c3709;};'use strict';function Campaign(_0x58c01b){this['id']=_0x58c01b['id']||0x0;this['name']=_0x58c01b[_0x4728('0x0')]||'';this[_0x4728('0x1')]=_0x58c01b[_0x4728('0x1')]||_0x4728('0x2');this[_0x4728('0x3')]=0x0;this[_0x4728('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x4728('0x5')]='';this[_0x4728('0x6')]=!![];this[_0x4728('0x7')]=_0x58c01b[_0x4728('0x7')];this[_0x4728('0x8')]=_0x58c01b[_0x4728('0x8')];this[_0x4728('0x9')]=_0x58c01b[_0x4728('0x9')]||null;this[_0x4728('0xa')]=_0x58c01b['dialGlobalInterval']?_0x58c01b['dialGlobalInterval']:null;this[_0x4728('0xb')]=_0x58c01b[_0x4728('0xb')];this[_0x4728('0xc')]=_0x58c01b['dialOriginateCallerIdNumber'];this[_0x4728('0xd')]=_0x58c01b[_0x4728('0xd')]||0x1e;this[_0x4728('0xe')]=_0x58c01b[_0x4728('0xe')];this[_0x4728('0xf')]=_0x58c01b[_0x4728('0xf')];this[_0x4728('0x10')]=_0x58c01b[_0x4728('0x10')];this[_0x4728('0x11')]=_0x58c01b[_0x4728('0x11')];this[_0x4728('0x12')]=_0x58c01b[_0x4728('0x12')];this[_0x4728('0x13')]=_0x58c01b[_0x4728('0x13')];this[_0x4728('0x14')]=_0x58c01b['dialGlobalMaxRetry'];this[_0x4728('0x15')]=_0x58c01b[_0x4728('0x15')]||0x3;this[_0x4728('0x16')]=_0x58c01b[_0x4728('0x16')]||0x96;this[_0x4728('0x17')]=_0x58c01b['dialDropMaxRetry']||0x3;this[_0x4728('0x18')]=_0x58c01b['dialDropRetryFrequency']||0x96;this[_0x4728('0x19')]=_0x58c01b['dialAbandonedMaxRetry']||0x3;this[_0x4728('0x1a')]=_0x58c01b[_0x4728('0x1a')]||0x96;this[_0x4728('0x1b')]=_0x58c01b['dialMachineMaxRetry']||0x3;this[_0x4728('0x1c')]=_0x58c01b['dialMachineRetryFrequency']||0x96;this[_0x4728('0x1d')]=_0x58c01b[_0x4728('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x58c01b[_0x4728('0x1e')]||0x96;this[_0x4728('0x1f')]=_0x58c01b[_0x4728('0x1f')]||_0x4728('0x20');this['dialPrefix']=_0x58c01b['dialPrefix']||undefined;this[_0x4728('0x21')]=_0x58c01b[_0x4728('0x21')]||undefined;this['dialCutDigit']=_0x58c01b[_0x4728('0x22')]||undefined;this[_0x4728('0x23')]=_0x58c01b['TrunkBackup']?_0x58c01b[_0x4728('0x23')]:undefined;this[_0x4728('0x24')]=_0x58c01b['Trunk']?_0x58c01b[_0x4728('0x24')]:undefined;this[_0x4728('0x25')]=_0x58c01b['Interval']?_0x58c01b[_0x4728('0x25')]:undefined;this[_0x4728('0x26')]=_0x58c01b[_0x4728('0x26')]?_0x58c01b[_0x4728('0x26')]:undefined;this[_0x4728('0x27')]=_0x58c01b[_0x4728('0x26')]?_0x58c01b[_0x4728('0x26')]['name']:undefined;this[_0x4728('0x28')]=_0x58c01b[_0x4728('0x28')]||![];this['dialAMDInitialSilence']=_0x58c01b[_0x4728('0x29')];this[_0x4728('0x2a')]=_0x58c01b[_0x4728('0x2a')];this[_0x4728('0x2b')]=_0x58c01b['dialAMDAfterGreetingSilence'];this[_0x4728('0x2c')]=_0x58c01b[_0x4728('0x2c')];this[_0x4728('0x2d')]=_0x58c01b['dialAMDMinWordLength'];this[_0x4728('0x2e')]=_0x58c01b[_0x4728('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x58c01b[_0x4728('0x2f')];this[_0x4728('0x30')]=_0x58c01b[_0x4728('0x30')];this['dialAMDMaximumWordLength']=_0x58c01b[_0x4728('0x31')];}module[_0x4728('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 871a759..c152228 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 _0xdadc=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','calleridnum','calleridname'];(function(_0xcf4067,_0x190b22){var _0x717dd2=function(_0x6b1952){while(--_0x6b1952){_0xcf4067['push'](_0xcf4067['shift']());}};_0x717dd2(++_0x190b22);}(_0xdadc,0x75));var _0xcdad=function(_0x4fd9ff,_0x5ce510){_0x4fd9ff=_0x4fd9ff-0x0;var _0x52e3aa=_0xdadc[_0x4fd9ff];return _0x52e3aa;};'use strict';function Channel(){this[_0xcdad('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xcdad('0x1')]=0x0;this[_0xcdad('0x2')]='';this[_0xcdad('0x3')]=undefined;this[_0xcdad('0x4')]=undefined;this[_0xcdad('0x5')]=0x0;this[_0xcdad('0x6')]='';this[_0xcdad('0x7')]=0x0;this['linkedid']=0x0;this[_0xcdad('0x8')]=0x0;this[_0xcdad('0x9')]=![];this[_0xcdad('0xa')]=null;this['endtime']=null;this['unmanaged']=![];this[_0xcdad('0xb')]=![];this[_0xcdad('0xc')]='';this[_0xcdad('0xd')]='';this['duration']=0x0;this[_0xcdad('0xe')]=0x0;this[_0xcdad('0xf')]=0x0;this[_0xcdad('0x10')]=null;this['tag']=null;this['disposition']=null;this['monitor']=![];this[_0xcdad('0x11')]=null;this[_0xcdad('0x12')]=null;this[_0xcdad('0x13')]=[];this[_0xcdad('0x14')]=undefined;this[_0xcdad('0x15')]=undefined;this[_0xcdad('0x16')]=0x0;}module[_0xcdad('0x17')]=Channel; \ No newline at end of file +var _0x5800=['transferconnectedlinenum','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','uniqueid','answered','answertime','unmanaged','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum'];(function(_0x18db10,_0x633a6d){var _0x583589=function(_0x2bd71b){while(--_0x2bd71b){_0x18db10['push'](_0x18db10['shift']());}};_0x583589(++_0x633a6d);}(_0x5800,0x1b9));var _0x0580=function(_0x2c37c5,_0x2a43f8){_0x2c37c5=_0x2c37c5-0x0;var _0x48d58e=_0x5800[_0x2c37c5];return _0x48d58e;};'use strict';function Channel(){this['starttime']=null;this[_0x0580('0x0')]='';this[_0x0580('0x1')]='';this[_0x0580('0x2')]=0x0;this[_0x0580('0x3')]='';this['connectedlinenum']=undefined;this[_0x0580('0x4')]=undefined;this[_0x0580('0x5')]=0x0;this['context']='';this[_0x0580('0x6')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x0580('0x7')]=![];this[_0x0580('0x8')]=null;this['endtime']=null;this[_0x0580('0x9')]=![];this['abandoned']=![];this[_0x0580('0xa')]='';this['lastdata']='';this[_0x0580('0xb')]=0x0;this[_0x0580('0xc')]=0x0;this[_0x0580('0xd')]=0x0;this[_0x0580('0xe')]=null;this[_0x0580('0xf')]=null;this[_0x0580('0x10')]=null;this[_0x0580('0x11')]=![];this[_0x0580('0x12')]=null;this['queue']=null;this[_0x0580('0x13')]=[];this[_0x0580('0x14')]=undefined;this[_0x0580('0x15')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index bc43ba3..42c9d5d 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 _0x46fc=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','consumerKey'];(function(_0x1b50bc,_0x446512){var _0x40bfc9=function(_0x128373){while(--_0x128373){_0x1b50bc['push'](_0x1b50bc['shift']());}};_0x40bfc9(++_0x446512);}(_0x46fc,0x103));var _0xc46f=function(_0x3338fe,_0x43ca83){_0x3338fe=_0x3338fe-0x0;var _0x1bb7f1=_0x46fc[_0x3338fe];return _0x1bb7f1;};'use strict';function DeskAccount(_0x397f36){this['id']=_0x397f36['id']||0x0;this[_0xc46f('0x0')]=_0x397f36[_0xc46f('0x0')]||'';this[_0xc46f('0x1')]=_0x397f36[_0xc46f('0x1')]||'';this[_0xc46f('0x2')]=_0x397f36[_0xc46f('0x2')]||'';this[_0xc46f('0x3')]=_0x397f36[_0xc46f('0x3')]||'';this['password']=_0x397f36['password']||'';this[_0xc46f('0x4')]=_0x397f36[_0xc46f('0x4')]||'';this[_0xc46f('0x5')]=_0x397f36[_0xc46f('0x5')]||'';this[_0xc46f('0x6')]=_0x397f36[_0xc46f('0x6')]||'';this[_0xc46f('0x7')]=_0x397f36[_0xc46f('0x7')]||'';this[_0xc46f('0x8')]=_0x397f36[_0xc46f('0x8')]||'';this[_0xc46f('0x9')]=_0x397f36[_0xc46f('0x9')]||'';this[_0xc46f('0xa')]=_0x397f36[_0xc46f('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x2029=['authType','password','consumerKey','consumerSecret','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x741fde,_0x4a8cfb){var _0x544650=function(_0x144543){while(--_0x144543){_0x741fde['push'](_0x741fde['shift']());}};_0x544650(++_0x4a8cfb);}(_0x2029,0x171));var _0x9202=function(_0x1e1e53,_0x54b2f6){_0x1e1e53=_0x1e1e53-0x0;var _0x32a52b=_0x2029[_0x1e1e53];return _0x32a52b;};'use strict';function DeskAccount(_0x3420a6){this['id']=_0x3420a6['id']||0x0;this[_0x9202('0x0')]=_0x3420a6['name']||'';this[_0x9202('0x1')]=_0x3420a6[_0x9202('0x1')]||'';this[_0x9202('0x2')]=_0x3420a6[_0x9202('0x2')]||'';this[_0x9202('0x3')]=_0x3420a6[_0x9202('0x3')]||'';this[_0x9202('0x4')]=_0x3420a6[_0x9202('0x4')]||'';this[_0x9202('0x5')]=_0x3420a6[_0x9202('0x5')]||'';this[_0x9202('0x6')]=_0x3420a6[_0x9202('0x6')]||'';this['token']=_0x3420a6['token']||'';this[_0x9202('0x7')]=_0x3420a6['tokenSecret']||'';this[_0x9202('0x8')]=_0x3420a6[_0x9202('0x8')]||'';this['serverUrl']=_0x3420a6[_0x9202('0x9')]||'';this[_0x9202('0xa')]=_0x3420a6[_0x9202('0xa')]||{};}module[_0x9202('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 30b0040..f3284fa 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 _0x262b=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','username','password','remoteUri'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x262b,0x1bf));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';function Dynamics365Account(_0x26065b){this['id']=_0x26065b['id']||0x0;this['name']=_0x26065b['name']||'';this[_0xb262('0x0')]=_0x26065b[_0xb262('0x0')]||'';this['password']=_0x26065b[_0xb262('0x1')]||'';this[_0xb262('0x2')]=_0x26065b[_0xb262('0x2')]||'';this[_0xb262('0x3')]=_0x26065b['tenantId']||'';this['clientId']=_0x26065b[_0xb262('0x4')]||'';this[_0xb262('0x5')]=_0x26065b[_0xb262('0x5')]||{};this['serverUrl']=_0x26065b[_0xb262('0x6')]||'';this[_0xb262('0x7')]=_0x26065b[_0xb262('0x7')]||{};}module[_0xb262('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xd2d4=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd2d4,0xde));var _0x4d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d4[_0x20a584];return _0x4b41a8;};'use strict';function Dynamics365Account(_0xc1fce4){this['id']=_0xc1fce4['id']||0x0;this[_0x4d2d('0x0')]=_0xc1fce4[_0x4d2d('0x0')]||'';this[_0x4d2d('0x1')]=_0xc1fce4[_0x4d2d('0x1')]||'';this[_0x4d2d('0x2')]=_0xc1fce4[_0x4d2d('0x2')]||'';this[_0x4d2d('0x3')]=_0xc1fce4[_0x4d2d('0x3')]||'';this[_0x4d2d('0x4')]=_0xc1fce4['tenantId']||'';this[_0x4d2d('0x5')]=_0xc1fce4[_0x4d2d('0x5')]||'';this[_0x4d2d('0x6')]=_0xc1fce4[_0x4d2d('0x6')]||{};this[_0x4d2d('0x7')]=_0xc1fce4[_0x4d2d('0x7')]||'';this['Configurations']=_0xc1fce4[_0x4d2d('0x8')]||{};}module[_0x4d2d('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 0bcf3c9..05c3070 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 _0xdb82=['maxrate','v17,v27,v29','gateway','t38timeout','tech','Trunk','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x38bb39,_0x52f67d){var _0xf8b958=function(_0x150326){while(--_0x150326){_0x38bb39['push'](_0x38bb39['shift']());}};_0xf8b958(++_0x52f67d);}(_0xdb82,0x1dc));var _0x2db8=function(_0x38c7c2,_0xb966fe){_0x38c7c2=_0x38c7c2-0x0;var _0x19271f=_0xdb82[_0x38c7c2];return _0x19271f;};'use strict';function FaxAccount(_0x5c1465){this['id']=_0x5c1465['id']||0x0;this['name']=_0x5c1465[_0x2db8('0x0')]||'';this[_0x2db8('0x1')]=_0x5c1465['description'];this['ecm']=_0x5c1465[_0x2db8('0x2')];this[_0x2db8('0x3')]=_0x5c1465[_0x2db8('0x3')];this[_0x2db8('0x4')]=_0x5c1465[_0x2db8('0x4')];this['minrate']=_0x5c1465['minrate']||0x960;this[_0x2db8('0x5')]=_0x5c1465['maxrate']||0x3840;this['modem']=_0x5c1465['modem']||_0x2db8('0x6');this[_0x2db8('0x7')]=_0x5c1465['gateway']||'no';this['faxdetect']=_0x5c1465['faxdetect']||'no';this[_0x2db8('0x8')]=_0x5c1465[_0x2db8('0x8')]||0x1388;this[_0x2db8('0x9')]=_0x5c1465[_0x2db8('0x9')]||'SIP';this[_0x2db8('0xa')]=_0x5c1465[_0x2db8('0xa')]?_0x5c1465[_0x2db8('0xa')]:undefined;this['ListId']=_0x5c1465['ListId'];this[_0x2db8('0xb')]=_0x5c1465[_0x2db8('0xb')];}module[_0x2db8('0xc')]=FaxAccount; \ No newline at end of file +var _0xc247=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xc247,0xfe));var _0x7c24=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0xc247[_0x3ccdf8];return _0x243dab;};'use strict';function FaxAccount(_0xec41fe){this['id']=_0xec41fe['id']||0x0;this[_0x7c24('0x0')]=_0xec41fe[_0x7c24('0x0')]||'';this['description']=_0xec41fe[_0x7c24('0x1')];this[_0x7c24('0x2')]=_0xec41fe['ecm'];this['headerinfo']=_0xec41fe[_0x7c24('0x3')];this[_0x7c24('0x4')]=_0xec41fe[_0x7c24('0x4')];this[_0x7c24('0x5')]=_0xec41fe[_0x7c24('0x5')]||0x960;this[_0x7c24('0x6')]=_0xec41fe[_0x7c24('0x6')]||0x3840;this[_0x7c24('0x7')]=_0xec41fe[_0x7c24('0x7')]||'v17,v27,v29';this[_0x7c24('0x8')]=_0xec41fe['gateway']||'no';this['faxdetect']=_0xec41fe[_0x7c24('0x9')]||'no';this[_0x7c24('0xa')]=_0xec41fe[_0x7c24('0xa')]||0x1388;this[_0x7c24('0xb')]=_0xec41fe['tech']||_0x7c24('0xc');this['Trunk']=_0xec41fe[_0x7c24('0xd')]?_0xec41fe[_0x7c24('0xd')]:undefined;this[_0x7c24('0xe')]=_0xec41fe['ListId'];this[_0x7c24('0xf')]=_0xec41fe[_0x7c24('0xf')];}module[_0x7c24('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index fce82cb..7e2ca43 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 _0x6efc=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0x6efc,0xa5));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';function FreshdeskAccount(_0x516cab){this['id']=_0x516cab['id']||0x0;this[_0xc6ef('0x0')]=_0x516cab['name']||'';this[_0xc6ef('0x1')]=_0x516cab[_0xc6ef('0x1')]||'';this[_0xc6ef('0x2')]=_0x516cab[_0xc6ef('0x3')]||'';this[_0xc6ef('0x4')]=_0x516cab[_0xc6ef('0x4')]||'';this[_0xc6ef('0x5')]=_0x516cab[_0xc6ef('0x5')]||'';this[_0xc6ef('0x6')]=_0x516cab[_0xc6ef('0x6')]||{};}module[_0xc6ef('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x7ff4=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x5d7b66,_0x280faa){var _0x65455b=function(_0x17da4b){while(--_0x17da4b){_0x5d7b66['push'](_0x5d7b66['shift']());}};_0x65455b(++_0x280faa);}(_0x7ff4,0x1ad));var _0x47ff=function(_0x3a99cf,_0x8d45e4){_0x3a99cf=_0x3a99cf-0x0;var _0x1b0bdc=_0x7ff4[_0x3a99cf];return _0x1b0bdc;};'use strict';function FreshdeskAccount(_0x4a52ce){this['id']=_0x4a52ce['id']||0x0;this[_0x47ff('0x0')]=_0x4a52ce['name']||'';this[_0x47ff('0x1')]=_0x4a52ce[_0x47ff('0x1')]||'';this['apiKey']=_0x4a52ce['token']||'';this[_0x47ff('0x2')]=_0x4a52ce['remoteUri']||'';this['serverUrl']=_0x4a52ce[_0x47ff('0x3')]||'';this[_0x47ff('0x4')]=_0x4a52ce[_0x47ff('0x4')]||{};}module[_0x47ff('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1a21b55..d5ba342 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 _0x6b2b=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0x6b2b,0x169));var _0xb6b2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6b2b[_0x126558];return _0x1f6d14;};'use strict';function FreshsalesAccount(_0x33c5e4){this['id']=_0x33c5e4['id']||0x0;this['name']=_0x33c5e4[_0xb6b2('0x0')]||'';this[_0xb6b2('0x1')]=_0x33c5e4[_0xb6b2('0x1')]||'';this[_0xb6b2('0x2')]=_0x33c5e4['token']||'';this['remoteUri']=_0x33c5e4[_0xb6b2('0x3')]||'';this[_0xb6b2('0x4')]=_0x33c5e4['serverUrl']||'';this[_0xb6b2('0x5')]=_0x33c5e4['Configurations']||{};}module[_0xb6b2('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x0426=['name','username','apiKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x23f2a7,_0x3bc14f){var _0x547933=function(_0x4137e0){while(--_0x4137e0){_0x23f2a7['push'](_0x23f2a7['shift']());}};_0x547933(++_0x3bc14f);}(_0x0426,0x1d5));var _0x6042=function(_0x23c0be,_0x3d7f13){_0x23c0be=_0x23c0be-0x0;var _0x9f4f56=_0x0426[_0x23c0be];return _0x9f4f56;};'use strict';function FreshsalesAccount(_0x1e8e02){this['id']=_0x1e8e02['id']||0x0;this[_0x6042('0x0')]=_0x1e8e02[_0x6042('0x0')]||'';this['username']=_0x1e8e02[_0x6042('0x1')]||'';this[_0x6042('0x2')]=_0x1e8e02['token']||'';this[_0x6042('0x3')]=_0x1e8e02[_0x6042('0x3')]||'';this[_0x6042('0x4')]=_0x1e8e02[_0x6042('0x4')]||'';this[_0x6042('0x5')]=_0x1e8e02[_0x6042('0x5')]||{};}module[_0x6042('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 3fe4a56..30d5c7e 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 _0xd8a4=['inbound','uniqueid','queue','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','mohtime','exports','type'];(function(_0x5f48b3,_0x5ad0b1){var _0x3c27c9=function(_0x61eebf){while(--_0x61eebf){_0x5f48b3['push'](_0x5f48b3['shift']());}};_0x3c27c9(++_0x5ad0b1);}(_0xd8a4,0xa7));var _0x4d8a=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xd8a4[_0x484e36];return _0xafc85d;};'use strict';function QueueReport(){this[_0x4d8a('0x0')]=_0x4d8a('0x1');this[_0x4d8a('0x2')]='';this['calleridnum']='';this['calleridname']='';this[_0x4d8a('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x4d8a('0x4')]=0x1;this['queuecallerabandon']=![];this[_0x4d8a('0x5')]=null;this[_0x4d8a('0x6')]=![];this[_0x4d8a('0x7')]=null;this[_0x4d8a('0x8')]=![];this[_0x4d8a('0x9')]=null;this['originalposition']=0x1;this[_0x4d8a('0xa')]='';this[_0x4d8a('0xb')]='';this[_0x4d8a('0xc')]='';this[_0x4d8a('0xd')]='';this[_0x4d8a('0xe')]='';this[_0x4d8a('0xf')]='';this[_0x4d8a('0x10')]='';this[_0x4d8a('0x11')]=0x0;this['assigned']=![];this[_0x4d8a('0x12')]='';this[_0x4d8a('0x13')]=0x0;this['variables']={};}module[_0x4d8a('0x14')]=QueueReport; \ No newline at end of file +var _0xa566=['assigned','lastAssignedTo','exports','type','uniqueid','calleridnum','queue','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','priority'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0xa566,0x1d7));var _0x6a56=function(_0x3c5dcb,_0x249f6d){_0x3c5dcb=_0x3c5dcb-0x0;var _0x3eeaac=_0xa566[_0x3c5dcb];return _0x3eeaac;};'use strict';function QueueReport(){this[_0x6a56('0x0')]='inbound';this[_0x6a56('0x1')]='';this[_0x6a56('0x2')]='';this['calleridname']='';this[_0x6a56('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x6a56('0x4')]=0x1;this[_0x6a56('0x5')]=![];this[_0x6a56('0x6')]=null;this[_0x6a56('0x7')]=![];this[_0x6a56('0x8')]=null;this['queuecallerexit']=![];this[_0x6a56('0x9')]=null;this[_0x6a56('0xa')]=0x1;this[_0x6a56('0xb')]='';this['connectedlinenum']='';this[_0x6a56('0xc')]='';this[_0x6a56('0xd')]='';this['context']='';this['exten']='';this[_0x6a56('0xe')]='';this['holdtime']=0x0;this[_0x6a56('0xf')]=![];this[_0x6a56('0x10')]='';this['mohtime']=0x0;this['variables']={};}module[_0x6a56('0x11')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index d6a5fa5..a58e757 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 _0x838a=['type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x3051df,_0x5c2ec5){var _0xd29169=function(_0x33836b){while(--_0x33836b){_0x3051df['push'](_0x3051df['shift']());}};_0xd29169(++_0x5c2ec5);}(_0x838a,0xb4));var _0xa838=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x838a[_0x152678];return _0x311a9;};'use strict';function SalesforceAccount(_0x5d77f9){this['id']=_0x5d77f9['id']||0x0;this[_0xa838('0x0')]=_0x5d77f9[_0xa838('0x0')]||'';this[_0xa838('0x1')]=_0x5d77f9[_0xa838('0x1')]||'';this[_0xa838('0x2')]=_0x5d77f9[_0xa838('0x2')]||'';this[_0xa838('0x3')]=_0x5d77f9[_0xa838('0x3')]||'';this['clientId']=_0x5d77f9[_0xa838('0x4')]||'';this[_0xa838('0x5')]=_0x5d77f9[_0xa838('0x5')]||'';this[_0xa838('0x6')]=_0x5d77f9['securityToken']||'';this[_0xa838('0x7')]=_0x5d77f9[_0xa838('0x7')]||_0xa838('0x8');this[_0xa838('0x9')]=_0x5d77f9[_0xa838('0x9')]||'';this[_0xa838('0xa')]=_0x5d77f9[_0xa838('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x95d9=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x36939a,_0x481cd2){var _0x2d1c5d=function(_0xba5298){while(--_0xba5298){_0x36939a['push'](_0x36939a['shift']());}};_0x2d1c5d(++_0x481cd2);}(_0x95d9,0x7e));var _0x995d=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x95d9[_0xc67528];return _0x38e26d;};'use strict';function SalesforceAccount(_0x3086c0){this['id']=_0x3086c0['id']||0x0;this[_0x995d('0x0')]=_0x3086c0[_0x995d('0x0')]||'';this['username']=_0x3086c0[_0x995d('0x1')]||'';this[_0x995d('0x2')]=_0x3086c0[_0x995d('0x2')]||'';this[_0x995d('0x3')]=_0x3086c0[_0x995d('0x3')]||'';this[_0x995d('0x4')]=_0x3086c0[_0x995d('0x4')]||'';this[_0x995d('0x5')]=_0x3086c0[_0x995d('0x5')]||'';this[_0x995d('0x6')]=_0x3086c0[_0x995d('0x6')]||'';this[_0x995d('0x7')]=_0x3086c0[_0x995d('0x7')]||_0x995d('0x8');this[_0x995d('0x9')]=_0x3086c0['serverUrl']||'';this['Configurations']=_0x3086c0[_0x995d('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 29cd6fe..8322cda 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 _0x1650=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x1650,0x9f));var _0x0165=function(_0x4fab09,_0x2e343b){_0x4fab09=_0x4fab09-0x0;var _0xf457df=_0x1650[_0x4fab09];return _0xf457df;};'use strict';function ServicenowAccount(_0x4220d7){this['id']=_0x4220d7['id']||0x0;this[_0x0165('0x0')]=_0x4220d7[_0x0165('0x0')]||'';this[_0x0165('0x1')]=_0x4220d7['username']||'';this['password']=_0x4220d7[_0x0165('0x2')]||'';this[_0x0165('0x3')]=_0x4220d7[_0x0165('0x3')]||'';this['serverUrl']=_0x4220d7[_0x0165('0x4')]||'';this['Configurations']=_0x4220d7['Configurations']||{};}module[_0x0165('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xcc18=['remoteUri','serverUrl','Configurations','exports','name','password'];(function(_0x24f5b1,_0x350007){var _0x451a13=function(_0x30d668){while(--_0x30d668){_0x24f5b1['push'](_0x24f5b1['shift']());}};_0x451a13(++_0x350007);}(_0xcc18,0x1e4));var _0x8cc1=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xcc18[_0x1a7846];return _0x48049;};'use strict';function ServicenowAccount(_0x1558d7){this['id']=_0x1558d7['id']||0x0;this['name']=_0x1558d7[_0x8cc1('0x0')]||'';this['username']=_0x1558d7['username']||'';this['password']=_0x1558d7[_0x8cc1('0x1')]||'';this[_0x8cc1('0x2')]=_0x1558d7[_0x8cc1('0x2')]||'';this['serverUrl']=_0x1558d7[_0x8cc1('0x3')]||'';this[_0x8cc1('0x4')]=_0x1558d7['Configurations']||{};}module[_0x8cc1('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fd2153e..3248ac3 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 _0x609c=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x51eb77,_0x436673){var _0x4b26fe=function(_0x4db9dc){while(--_0x4db9dc){_0x51eb77['push'](_0x51eb77['shift']());}};_0x4b26fe(++_0x436673);}(_0x609c,0x1a1));var _0xc609=function(_0x247c6d,_0x5c7daa){_0x247c6d=_0x247c6d-0x0;var _0x14a8bc=_0x609c[_0x247c6d];return _0x14a8bc;};'use strict';function SugarcrmAccount(_0x21630c){this['id']=_0x21630c['id']||0x0;this[_0xc609('0x0')]=_0x21630c[_0xc609('0x0')]||'';this[_0xc609('0x1')]=_0x21630c[_0xc609('0x1')]||'';this['password']=_0x21630c[_0xc609('0x2')]||'';this[_0xc609('0x3')]=_0x21630c[_0xc609('0x3')]||'';this[_0xc609('0x4')]=_0x21630c['serverUrl']||'';this[_0xc609('0x5')]=_0x21630c[_0xc609('0x5')]||{};}module[_0xc609('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xf265=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x20ca12,_0x137790){var _0x432fc8=function(_0x16fd10){while(--_0x16fd10){_0x20ca12['push'](_0x20ca12['shift']());}};_0x432fc8(++_0x137790);}(_0xf265,0x1e3));var _0x5f26=function(_0x4da62b,_0x469719){_0x4da62b=_0x4da62b-0x0;var _0x39bb0c=_0xf265[_0x4da62b];return _0x39bb0c;};'use strict';function SugarcrmAccount(_0x51273d){this['id']=_0x51273d['id']||0x0;this[_0x5f26('0x0')]=_0x51273d[_0x5f26('0x0')]||'';this[_0x5f26('0x1')]=_0x51273d[_0x5f26('0x1')]||'';this[_0x5f26('0x2')]=_0x51273d[_0x5f26('0x2')]||'';this['remoteUri']=_0x51273d[_0x5f26('0x3')]||'';this[_0x5f26('0x4')]=_0x51273d[_0x5f26('0x4')]||'';this[_0x5f26('0x5')]=_0x51273d['Configurations']||{};}module[_0x5f26('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 2dc6a9b..2892806 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 _0x3212=['accountcode','unknown','stateTime','status','exports'];(function(_0x300a52,_0x4083b9){var _0xb89423=function(_0x415894){while(--_0x415894){_0x300a52['push'](_0x300a52['shift']());}};_0xb89423(++_0x4083b9);}(_0x3212,0x127));var _0x2321=function(_0x23855f,_0x95aaa1){_0x23855f=_0x23855f-0x0;var _0x1de384=_0x3212[_0x23855f];return _0x1de384;};'use strict';function Telephone(_0xaebe15){this['id']=_0xaebe15['id']||0x0;this['name']=_0xaebe15['name']||'';this[_0x2321('0x0')]=_0xaebe15[_0x2321('0x0')]||'';this['state']=_0x2321('0x1');this[_0x2321('0x2')]=0x0;this[_0x2321('0x3')]=_0x2321('0x1');this['address']='';}module[_0x2321('0x4')]=Telephone; \ No newline at end of file +var _0x736e=['unknown','status','address','exports','name','accountcode','state'];(function(_0x4f7b56,_0x285eeb){var _0x1dc474=function(_0x1c8ae5){while(--_0x1c8ae5){_0x4f7b56['push'](_0x4f7b56['shift']());}};_0x1dc474(++_0x285eeb);}(_0x736e,0x131));var _0xe736=function(_0x4ae634,_0x452d8f){_0x4ae634=_0x4ae634-0x0;var _0x5739d2=_0x736e[_0x4ae634];return _0x5739d2;};'use strict';function Telephone(_0x20cef5){this['id']=_0x20cef5['id']||0x0;this['name']=_0x20cef5[_0xe736('0x0')]||'';this[_0xe736('0x1')]=_0x20cef5[_0xe736('0x1')]||'';this[_0xe736('0x2')]=_0xe736('0x3');this['stateTime']=0x0;this[_0xe736('0x4')]=_0xe736('0x3');this[_0xe736('0x5')]='';}module[_0xe736('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 2f39865..fe23fa7 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 _0xeaba=['html','name'];(function(_0x159b8c,_0x233a94){var _0x167a34=function(_0x4cfdcb){while(--_0x4cfdcb){_0x159b8c['push'](_0x159b8c['shift']());}};_0x167a34(++_0x233a94);}(_0xeaba,0x1a9));var _0xaeab=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xeaba[_0x4e6ae6];return _0x23c108;};'use strict';function template(_0x59d9e7){this['id']=_0x59d9e7['id']||0x0;this[_0xaeab('0x0')]=_0x59d9e7[_0xaeab('0x0')]||'';this[_0xaeab('0x1')]=_0x59d9e7[_0xaeab('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x6dba=['exports','name','html'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x6dba,0x13c));var _0xa6db=function(_0xa84046,_0x456128){_0xa84046=_0xa84046-0x0;var _0x156dae=_0x6dba[_0xa84046];return _0x156dae;};'use strict';function template(_0x453be8){this['id']=_0x453be8['id']||0x0;this[_0xa6db('0x0')]=_0x453be8[_0xa6db('0x0')]||'';this[_0xa6db('0x1')]=_0x453be8[_0xa6db('0x1')]||'';}module[_0xa6db('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index d7600ca..36ec8f2 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 _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x1e3c41,_0x89eab0){var _0x3c6c25=function(_0x584da3){while(--_0x584da3){_0x1e3c41['push'](_0x1e3c41['shift']());}};_0x3c6c25(++_0x89eab0);}(_0x3e74,0x175));var _0x43e7=function(_0x2c1896,_0x8421d0){_0x2c1896=_0x2c1896-0x0;var _0x100622=_0x3e74[_0x2c1896];return _0x100622;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x268916,_0x1c27e1){var _0x38f8a4=function(_0x5e9ea6){while(--_0x5e9ea6){_0x268916['push'](_0x268916['shift']());}};_0x38f8a4(++_0x1c27e1);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('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 9b2f890..20a6514 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 _0x36a0=['registrationtime','address','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','domainport','refresh','stateRegistry'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0x36a0,0x83));var _0x036a=function(_0x2d53d9,_0x51ce3a){_0x2d53d9=_0x2d53d9-0x0;var _0x5b8129=_0x36a0[_0x2d53d9];return _0x5b8129;};'use strict';function Trunk(_0x3ffb56){this['id']=_0x3ffb56['id']||0x0;this[_0x036a('0x0')]=_0x3ffb56[_0x036a('0x0')]||![];this[_0x036a('0x1')]=_0x3ffb56[_0x036a('0x1')]||'';this[_0x036a('0x2')]=_0x036a('0x3');this[_0x036a('0x4')]=0x0;this[_0x036a('0x5')]=_0x036a('0x3');this[_0x036a('0x6')]=_0x3ffb56[_0x036a('0x6')]&&_0x3ffb56[_0x036a('0x6')][_0x036a('0x7')](':')?_0x3ffb56['registry'][_0x036a('0x8')](':')[0x0]:'';this[_0x036a('0x9')]='';this['port']='';this['domain']='';this[_0x036a('0xa')]='';this[_0x036a('0xb')]='';this[_0x036a('0xc')]=_0x036a('0x3');this[_0x036a('0xd')]='';this[_0x036a('0xe')]='';}module[_0x036a('0xf')]=Trunk; \ No newline at end of file +var _0x9bde=['exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry'];(function(_0x182ba1,_0x5ac4b0){var _0x19372c=function(_0x5a34ea){while(--_0x5a34ea){_0x182ba1['push'](_0x182ba1['shift']());}};_0x19372c(++_0x5ac4b0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x48d4a5,_0x22f784){_0x48d4a5=_0x48d4a5-0x0;var _0x80825b=_0x9bde[_0x48d4a5];return _0x80825b;};'use strict';function Trunk(_0x284147){this['id']=_0x284147['id']||0x0;this[_0xe9bd('0x0')]=_0x284147['active']||![];this[_0xe9bd('0x1')]=_0x284147['name']||'';this[_0xe9bd('0x2')]=_0xe9bd('0x3');this[_0xe9bd('0x4')]=0x0;this[_0xe9bd('0x5')]=_0xe9bd('0x3');this[_0xe9bd('0x6')]=_0x284147[_0xe9bd('0x6')]&&_0x284147['registry'][_0xe9bd('0x7')](':')?_0x284147[_0xe9bd('0x6')][_0xe9bd('0x8')](':')[0x0]:'';this[_0xe9bd('0x9')]='';this[_0xe9bd('0xa')]='';this[_0xe9bd('0xb')]='';this[_0xe9bd('0xc')]='';this[_0xe9bd('0xd')]='';this[_0xe9bd('0xe')]=_0xe9bd('0x3');this['registrationtime']='';this['address']='';}module[_0xe9bd('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 990305c..eff8630 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 _0x689e=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x26792b,_0x453deb){var _0x53d621=function(_0x50ba33){while(--_0x50ba33){_0x26792b['push'](_0x26792b['shift']());}};_0x53d621(++_0x453deb);}(_0x689e,0x14c));var _0xe689=function(_0x40a506,_0x6f03e){_0x40a506=_0x40a506-0x0;var _0x1c9ed4=_0x689e[_0x40a506];return _0x1c9ed4;};'use strict';function voiceExtension(_0x1a8178){this['id']=_0x1a8178['id']||0x0;this['exten']=_0x1a8178[_0xe689('0x0')]||'';this[_0xe689('0x1')]=_0x1a8178['recordingFormat']||_0xe689('0x2');this[_0xe689('0x3')]=_0x1a8178[_0xe689('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x809b=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x809b,0x8e));var _0xb809=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x809b[_0x50a0c2];return _0x5ebadd;};'use strict';function voiceExtension(_0x10aa54){this['id']=_0x10aa54['id']||0x0;this[_0xb809('0x0')]=_0x10aa54[_0xb809('0x0')]||'';this[_0xb809('0x1')]=_0x10aa54[_0xb809('0x1')]||_0xb809('0x2');this[_0xb809('0x3')]=_0x10aa54[_0xb809('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e744da3..d3d8a70 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 _0x2810=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','monitor_format','type','waiting','talking','answered','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0xd830f7,_0x4cede1){var _0x347cee=function(_0x118e72){while(--_0x118e72){_0xd830f7['push'](_0xd830f7['shift']());}};_0x347cee(++_0x4cede1);}(_0x2810,0x113));var _0x0281=function(_0x4597dd,_0x57ca6f){_0x4597dd=_0x4597dd-0x0;var _0x364933=_0x2810[_0x4597dd];return _0x364933;};'use strict';var statusDesc=['unknown','not_inuse',_0x0281('0x0'),_0x0281('0x1'),_0x0281('0x2'),_0x0281('0x3'),_0x0281('0x4'),_0x0281('0x5'),_0x0281('0x6')];var monitorFormat={'wav':_0x0281('0x7'),'wav49':_0x0281('0x8'),'gsm':'gsm'};var strategy={'rrmemory':_0x0281('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x1b4784){this['id']=_0x1b4784['id']||0x0;this['name']=_0x1b4784['name']||'';this[_0x0281('0xa')]=_0x1b4784[_0x0281('0xa')]||'';this[_0x0281('0xb')]=_0x1b4784['type']||'inbound';this[_0x0281('0xc')]=0x0;this[_0x0281('0xd')]=0x0;this['total']=0x0;this[_0x0281('0xe')]=0x0;this['sumDuration']=0x0;this[_0x0281('0xf')]=0x0;this[_0x0281('0x10')]=0x0;this[_0x0281('0x11')]=0x0;this[_0x0281('0x12')]=0x0;this[_0x0281('0x13')]=0x0;this[_0x0281('0x14')]=0x0;this['acw']=_0x1b4784[_0x0281('0x15')]||![];this[_0x0281('0x16')]=_0x1b4784[_0x0281('0x16')]||0xa;this[_0x0281('0x17')]=_0x1b4784[_0x0281('0x17')]||'no';this[_0x0281('0x18')]=!![];this['message']='';this[_0x0281('0x19')]=0x0;this[_0x0281('0x1a')]=0x0;this[_0x0281('0x1b')]=_0x1b4784[_0x0281('0x1b')]||null;this[_0x0281('0x1c')]=_0x1b4784['dialGlobalInterval']?_0x1b4784[_0x0281('0x1c')]:null;this[_0x0281('0x1d')]=_0x1b4784['dialActive'];this['dialMethod']=_0x1b4784['dialMethod']||_0x0281('0x1e');this[_0x0281('0x1f')]=_0x1b4784['dialLimitChannel']||0x0;this[_0x0281('0x20')]=_0x1b4784[_0x0281('0x20')]||0x0;this[_0x0281('0x21')]=_0x1b4784['dialPowerLevel']||0x1;this[_0x0281('0x22')]=_0x1b4784[_0x0281('0x22')]||_0x0281('0x23');this[_0x0281('0x24')]=_0x1b4784[_0x0281('0x24')]||0.03;this['dialPredictiveInterval']=_0x1b4784[_0x0281('0x25')]||0x258;this[_0x0281('0x26')]=_0x1b4784[_0x0281('0x26')]||_0x0281('0x27');this[_0x0281('0x28')]=_0x1b4784[_0x0281('0x28')]||_0x0281('0x27');this[_0x0281('0x29')]=_0x1b4784[_0x0281('0x29')]||0x1e;this[_0x0281('0x2a')]=_0x1b4784[_0x0281('0x2a')]||_0x0281('0x2b');this[_0x0281('0x2c')]=_0x1b4784[_0x0281('0x2c')]||0x3;this['dialQueueProject']=_0x1b4784[_0x0281('0x2d')]||undefined;this[_0x0281('0x2e')]=_0x1b4784[_0x0281('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x1b4784[_0x0281('0x2f')]||0x96;this[_0x0281('0x30')]=_0x1b4784[_0x0281('0x30')]||0x3;this[_0x0281('0x31')]=_0x1b4784['dialBusyRetryFrequency']||0x96;this[_0x0281('0x32')]=_0x1b4784[_0x0281('0x32')]||0x3;this[_0x0281('0x33')]=_0x1b4784[_0x0281('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x1b4784['dialNoSuchNumberMaxRetry']||0x3;this[_0x0281('0x34')]=_0x1b4784['dialNoSuchNumberRetryFrequency']||0x96;this[_0x0281('0x35')]=_0x1b4784[_0x0281('0x35')]||0x3;this[_0x0281('0x36')]=_0x1b4784[_0x0281('0x36')]||0x96;this['dialAbandonedMaxRetry']=_0x1b4784[_0x0281('0x37')]||0x3;this[_0x0281('0x38')]=_0x1b4784[_0x0281('0x38')]||0x96;this[_0x0281('0x39')]=_0x1b4784[_0x0281('0x39')]||0x3;this[_0x0281('0x3a')]=_0x1b4784[_0x0281('0x3a')]||0x96;this[_0x0281('0x3b')]=_0x1b4784['dialAgentRejectMaxRetry']||0x3;this[_0x0281('0x3c')]=_0x1b4784[_0x0281('0x3c')]||0x96;this[_0x0281('0x3d')]=_0x1b4784[_0x0281('0x3d')]||0x4;this[_0x0281('0x3e')]=_0x1b4784[_0x0281('0x3e')]?_0x1b4784['Trunk']:undefined;this[_0x0281('0x3f')]=_0x1b4784[_0x0281('0x3f')]?_0x1b4784[_0x0281('0x3f')]:undefined;this[_0x0281('0x40')]=_0x1b4784['dialPrefix']||undefined;this[_0x0281('0x41')]=_0x1b4784[_0x0281('0x41')]?_0x1b4784['Interval']:undefined;this[_0x0281('0x42')]=_0x1b4784[_0x0281('0x42')]||'DESC';this[_0x0281('0x43')]=_0x1b4784[_0x0281('0x43')]||undefined;this[_0x0281('0x44')]=_0x1b4784[_0x0281('0x44')]||undefined;this[_0x0281('0x45')]=strategy[_0x1b4784[_0x0281('0x45')]]||_0x0281('0x9');this[_0x0281('0x46')]=!![];this[_0x0281('0x47')]=_0x1b4784['dialAMDActive']||![];this[_0x0281('0x48')]=_0x1b4784[_0x0281('0x48')];this[_0x0281('0x49')]=_0x1b4784[_0x0281('0x49')];this[_0x0281('0x4a')]=_0x1b4784[_0x0281('0x4a')];this[_0x0281('0x4b')]=_0x1b4784['dialAMDTotalAnalysisTime'];this[_0x0281('0x4c')]=_0x1b4784['dialAMDMinWordLength'];this[_0x0281('0x4d')]=_0x1b4784[_0x0281('0x4d')];this[_0x0281('0x4e')]=_0x1b4784['dialAMDMaximumNumberOfWords'];this[_0x0281('0x4f')]=_0x1b4784['dialAMDSilenceThreshold'];this[_0x0281('0x50')]=_0x1b4784[_0x0281('0x50')];this[_0x0281('0x51')]=0x0;this[_0x0281('0x52')]=0x0;this['timeout']=_0x1b4784[_0x0281('0x53')];this[_0x0281('0x54')]=0x0;this[_0x0281('0x55')]=0x0;this[_0x0281('0x56')]=0x0;this[_0x0281('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x0281('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x0281('0x59')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x0281('0x5a')]=0x0;this[_0x0281('0x5b')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x0281('0x5c')]=0x0;this[_0x0281('0x5d')]=0x0;this[_0x0281('0x5e')]=undefined;this['startPredictive']=undefined;this[_0x0281('0x5f')]=undefined;this[_0x0281('0x60')]=1.05;this[_0x0281('0x61')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x0281('0x62')]=0x0;this[_0x0281('0x63')]=0x0;this[_0x0281('0x64')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x0281('0x65')]=0x0;this[_0x0281('0x66')]=_0x1b4784[_0x0281('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x1b4784[_0x0281('0x67')]||0xa;this[_0x0281('0x68')]=0x0;this[_0x0281('0x69')]=0x0;this[_0x0281('0x6a')]=0x1;this[_0x0281('0x6b')]=0x0;this[_0x0281('0x6c')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x0281('0x6d')]=0x0;this[_0x0281('0x6e')]=_0x1b4784[_0x0281('0x6e')]||0x1e;this[_0x0281('0x6f')]=_0x1b4784[_0x0281('0x6f')]||![];this[_0x0281('0x70')]=_0x1b4784[_0x0281('0x70')]||undefined;this[_0x0281('0x71')]=_0x1b4784[_0x0281('0x71')]||![];this[_0x0281('0x72')]=_0x1b4784['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x1b4784[_0x0281('0xa')]]?monitorFormat[_0x1b4784[_0x0281('0xa')]]:undefined;this[_0x0281('0x73')]=_0x1b4784[_0x0281('0x73')]||![];this[_0x0281('0x74')]=_0x1b4784[_0x0281('0x74')]?_0x1b4784[_0x0281('0x74')]:undefined;}module[_0x0281('0x75')]=VoiceQueue; \ No newline at end of file +var _0xd92f=['dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','ringing','ringinuse','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumHoldTime','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone'];(function(_0x27e4e5,_0x11047c){var _0x595685=function(_0xb47fbc){while(--_0xb47fbc){_0x27e4e5['push'](_0x27e4e5['shift']());}};_0x595685(++_0x11047c);}(_0xd92f,0xc9));var _0xfd92=function(_0x5cbfc4,_0x592d2d){_0x5cbfc4=_0x5cbfc4-0x0;var _0x2e59b4=_0xd92f[_0x5cbfc4];return _0x2e59b4;};'use strict';var statusDesc=[_0xfd92('0x0'),'not_inuse',_0xfd92('0x1'),'busy',_0xfd92('0x2'),'unavailable',_0xfd92('0x3'),_0xfd92('0x4'),'onhold'];var monitorFormat={'wav':_0xfd92('0x5'),'wav49':_0xfd92('0x6'),'gsm':'gsm'};var strategy={'rrmemory':_0xfd92('0x7'),'roundrobin':_0xfd92('0x8')};function VoiceQueue(_0x772469){this['id']=_0x772469['id']||0x0;this[_0xfd92('0x9')]=_0x772469[_0xfd92('0x9')]||'';this[_0xfd92('0xa')]=_0x772469['monitor_format']||'';this[_0xfd92('0xb')]=_0x772469[_0xfd92('0xb')]||'inbound';this[_0xfd92('0xc')]=0x0;this[_0xfd92('0xd')]=0x0;this[_0xfd92('0xe')]=0x0;this[_0xfd92('0xf')]=0x0;this['sumDuration']=0x0;this[_0xfd92('0x10')]=0x0;this['sumBillable']=0x0;this[_0xfd92('0x11')]=0x0;this[_0xfd92('0x12')]=0x0;this[_0xfd92('0x13')]=0x0;this['available']=0x0;this[_0xfd92('0x14')]=_0x772469['acw']||![];this[_0xfd92('0x15')]=_0x772469[_0xfd92('0x15')]||0xa;this[_0xfd92('0x16')]=_0x772469['autopause']||'no';this[_0xfd92('0x17')]=!![];this['message']='';this[_0xfd92('0x18')]=0x0;this[_0xfd92('0x19')]=0x0;this[_0xfd92('0x1a')]=_0x772469[_0xfd92('0x1a')]||null;this['dialGlobalInterval']=_0x772469[_0xfd92('0x1b')]?_0x772469[_0xfd92('0x1b')]:null;this[_0xfd92('0x1c')]=_0x772469[_0xfd92('0x1c')];this['dialMethod']=_0x772469[_0xfd92('0x1d')]||'progressive';this[_0xfd92('0x1e')]=_0x772469['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x772469[_0xfd92('0x1f')]||0x0;this[_0xfd92('0x20')]=_0x772469[_0xfd92('0x20')]||0x1;this[_0xfd92('0x21')]=_0x772469['dialPredictiveOptimization']||_0xfd92('0x22');this[_0xfd92('0x23')]=_0x772469[_0xfd92('0x23')]||0.03;this[_0xfd92('0x24')]=_0x772469[_0xfd92('0x24')]||0x258;this[_0xfd92('0x25')]=_0x772469['dialOriginateCallerIdName']||_0xfd92('0x26');this[_0xfd92('0x27')]=_0x772469[_0xfd92('0x27')]||_0xfd92('0x26');this[_0xfd92('0x28')]=_0x772469[_0xfd92('0x28')]||0x1e;this[_0xfd92('0x29')]=_0x772469[_0xfd92('0x29')]||_0xfd92('0x2a');this[_0xfd92('0x2b')]=_0x772469[_0xfd92('0x2b')]||0x3;this[_0xfd92('0x2c')]=_0x772469[_0xfd92('0x2c')]||undefined;this[_0xfd92('0x2d')]=_0x772469[_0xfd92('0x2d')]||0x3;this[_0xfd92('0x2e')]=_0x772469[_0xfd92('0x2e')]||0x96;this[_0xfd92('0x2f')]=_0x772469[_0xfd92('0x2f')]||0x3;this[_0xfd92('0x30')]=_0x772469[_0xfd92('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x772469[_0xfd92('0x31')]||0x3;this['dialNoAnswerRetryFrequency']=_0x772469[_0xfd92('0x32')]||0x96;this[_0xfd92('0x33')]=_0x772469['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x772469[_0xfd92('0x34')]||0x96;this[_0xfd92('0x35')]=_0x772469['dialDropMaxRetry']||0x3;this[_0xfd92('0x36')]=_0x772469[_0xfd92('0x36')]||0x96;this[_0xfd92('0x37')]=_0x772469[_0xfd92('0x37')]||0x3;this[_0xfd92('0x38')]=_0x772469[_0xfd92('0x38')]||0x96;this[_0xfd92('0x39')]=_0x772469[_0xfd92('0x39')]||0x3;this[_0xfd92('0x3a')]=_0x772469[_0xfd92('0x3a')]||0x96;this[_0xfd92('0x3b')]=_0x772469[_0xfd92('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x772469[_0xfd92('0x3c')]||0x96;this[_0xfd92('0x3d')]=_0x772469[_0xfd92('0x3d')]||0x4;this['Trunk']=_0x772469[_0xfd92('0x3e')]?_0x772469[_0xfd92('0x3e')]:undefined;this[_0xfd92('0x3f')]=_0x772469[_0xfd92('0x3f')]?_0x772469[_0xfd92('0x3f')]:undefined;this['dialPrefix']=_0x772469['dialPrefix']||undefined;this[_0xfd92('0x40')]=_0x772469[_0xfd92('0x40')]?_0x772469[_0xfd92('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x772469['dialOrderByScheduledAt']||_0xfd92('0x41');this[_0xfd92('0x42')]=_0x772469[_0xfd92('0x42')]||undefined;this[_0xfd92('0x43')]=_0x772469['dialCutDigit']||undefined;this[_0xfd92('0x44')]=strategy[_0x772469[_0xfd92('0x44')]]||_0xfd92('0x7');this[_0xfd92('0x45')]=!![];this[_0xfd92('0x46')]=_0x772469[_0xfd92('0x46')]||![];this[_0xfd92('0x47')]=_0x772469['dialAMDInitialSilence'];this[_0xfd92('0x48')]=_0x772469[_0xfd92('0x48')];this[_0xfd92('0x49')]=_0x772469[_0xfd92('0x49')];this['dialAMDTotalAnalysisTime']=_0x772469['dialAMDTotalAnalysisTime'];this[_0xfd92('0x4a')]=_0x772469['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x772469['dialAMDBetweenWordsSilence'];this[_0xfd92('0x4b')]=_0x772469[_0xfd92('0x4b')];this[_0xfd92('0x4c')]=_0x772469[_0xfd92('0x4c')];this[_0xfd92('0x4d')]=_0x772469['dialAMDMaximumWordLength'];this[_0xfd92('0x4e')]=0x0;this[_0xfd92('0x4f')]=0x0;this['timeout']=_0x772469['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xfd92('0x50')]=0x0;this[_0xfd92('0x51')]=0x0;this[_0xfd92('0x52')]=0x0;this[_0xfd92('0x53')]=0x0;this[_0xfd92('0x54')]=0x0;this[_0xfd92('0x55')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xfd92('0x56')]=0x0;this[_0xfd92('0x57')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xfd92('0x58')]=0x0;this[_0xfd92('0x59')]=0x0;this[_0xfd92('0x5a')]=undefined;this[_0xfd92('0x5b')]=undefined;this['handlePredictive']=undefined;this[_0xfd92('0x5c')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xfd92('0x5d')]=0x0;this[_0xfd92('0x5e')]=0x0;this[_0xfd92('0x5f')]=0x0;this[_0xfd92('0x60')]=0x0;this[_0xfd92('0x61')]=0x0;this[_0xfd92('0x62')]=0x0;this[_0xfd92('0x63')]=0x0;this[_0xfd92('0x64')]=_0x772469[_0xfd92('0x65')]||0x14;this[_0xfd92('0x66')]=_0x772469[_0xfd92('0x65')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xfd92('0x67')]=0x0;this[_0xfd92('0x68')]=0x1;this[_0xfd92('0x69')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xfd92('0x6a')]=0x0;this['dialRecallMeTimeout']=_0x772469[_0xfd92('0x6b')]||0x1e;this['dialRecallInQueue']=_0x772469['dialRecallInQueue']||![];this['dialQueueProject2']=_0x772469[_0xfd92('0x6c')]||undefined;this['dialAgiAfterHangupClient']=_0x772469[_0xfd92('0x6d')]||![];this[_0xfd92('0x6e')]=_0x772469[_0xfd92('0x6e')]||![];this[_0xfd92('0xa')]=monitorFormat[_0x772469[_0xfd92('0xa')]]?monitorFormat[_0x772469[_0xfd92('0xa')]]:undefined;this[_0xfd92('0x6f')]=_0x772469['mandatoryDisposition']||![];this[_0xfd92('0x70')]=_0x772469[_0xfd92('0x70')]?_0x772469[_0xfd92('0x70')]:undefined;}module[_0xfd92('0x71')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index d62e905..90ce769 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 _0xd689=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x388899,_0x2ae956){var _0x17b4d7=function(_0x324030){while(--_0x324030){_0x388899['push'](_0x388899['shift']());}};_0x17b4d7(++_0x2ae956);}(_0xd689,0x188));var _0x9d68=function(_0x16683a,_0x460dca){_0x16683a=_0x16683a-0x0;var _0x480406=_0xd689[_0x16683a];return _0x480406;};'use strict';function VtigerAccount(_0x2b6426){this['id']=_0x2b6426['id']||0x0;this['name']=_0x2b6426[_0x9d68('0x0')]||'';this[_0x9d68('0x1')]=_0x2b6426[_0x9d68('0x1')]||'';this['accessKey']=_0x2b6426[_0x9d68('0x2')]||'';this['remoteUri']=_0x2b6426[_0x9d68('0x3')]||'';this[_0x9d68('0x4')]=_0x2b6426[_0x9d68('0x4')]||'';this['Configurations']=_0x2b6426[_0x9d68('0x5')]||{};}module[_0x9d68('0x6')]=VtigerAccount; \ No newline at end of file +var _0x925b=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x29d15b,_0x2cc49b){var _0x48520d=function(_0x10461d){while(--_0x10461d){_0x29d15b['push'](_0x29d15b['shift']());}};_0x48520d(++_0x2cc49b);}(_0x925b,0x19f));var _0xb925=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x925b[_0x75ce5b];return _0x22195e;};'use strict';function VtigerAccount(_0x172243){this['id']=_0x172243['id']||0x0;this['name']=_0x172243[_0xb925('0x0')]||'';this[_0xb925('0x1')]=_0x172243[_0xb925('0x1')]||'';this[_0xb925('0x2')]=_0x172243[_0xb925('0x2')]||'';this[_0xb925('0x3')]=_0x172243[_0xb925('0x3')]||'';this[_0xb925('0x4')]=_0x172243[_0xb925('0x4')]||'';this[_0xb925('0x5')]=_0x172243['Configurations']||{};}module[_0xb925('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 68bb603..980c3eb 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x0b0e,0x187));var _0xe0b0=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0x0b0e[_0x395bfe];return _0x35c81c;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2ef3=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x3df06f,_0x5d89cc){var _0x26c646=function(_0x4253bf){while(--_0x4253bf){_0x3df06f['push'](_0x3df06f['shift']());}};_0x26c646(++_0x5d89cc);}(_0x2ef3,0xba));var _0x32ef=function(_0x5a4ccb,_0x34d4d5){_0x5a4ccb=_0x5a4ccb-0x0;var _0x2d979e=_0x2ef3[_0x5a4ccb];return _0x2d979e;};'use strict';function ZendeskAccount(_0x4d5ac8){this['id']=_0x4d5ac8['id']||0x0;this[_0x32ef('0x0')]=_0x4d5ac8[_0x32ef('0x0')]||'';this[_0x32ef('0x1')]=_0x4d5ac8[_0x32ef('0x1')]||'';this[_0x32ef('0x2')]=_0x4d5ac8['password']||'';this[_0x32ef('0x3')]=_0x4d5ac8[_0x32ef('0x3')]||'';this['remoteUri']=_0x4d5ac8[_0x32ef('0x4')]||'';this[_0x32ef('0x5')]=_0x4d5ac8['authType']||'';this['type']=_0x4d5ac8[_0x32ef('0x6')]||_0x32ef('0x7');this[_0x32ef('0x8')]=_0x4d5ac8[_0x32ef('0x8')]||'';this[_0x32ef('0x9')]=_0x4d5ac8[_0x32ef('0x9')]||{};}module[_0x32ef('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index b5d5127..3941801 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 _0x594d=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','description','host','zone','clientId'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x594d,0x92));var _0xd594=function(_0x305820,_0x24c94a){_0x305820=_0x305820-0x0;var _0x558285=_0x594d[_0x305820];return _0x558285;};'use strict';function ZohoAccount(_0x567e3c){this['id']=_0x567e3c['id']||0x0;this['name']=_0x567e3c['name']||'';this[_0xd594('0x0')]=_0x567e3c[_0xd594('0x0')]||'';this[_0xd594('0x1')]=_0x567e3c['host']||'';this[_0xd594('0x2')]=_0x567e3c[_0xd594('0x2')]||'';this[_0xd594('0x3')]=_0x567e3c[_0xd594('0x3')]||'';this['clientSecret']=_0x567e3c[_0xd594('0x4')]||'';this['serverUrl']=_0x567e3c[_0xd594('0x5')]||'';this[_0xd594('0x6')]=_0x567e3c[_0xd594('0x6')]||'';this[_0xd594('0x7')]=_0x567e3c[_0xd594('0x7')]||'';this[_0xd594('0x8')]=_0x567e3c[_0xd594('0x8')]||{};}module[_0xd594('0x9')]=ZohoAccount; \ No newline at end of file +var _0x5525=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5525,0xd1));var _0x5552=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5525[_0x4a9fb1];return _0x348672;};'use strict';function ZohoAccount(_0xc036cc){this['id']=_0xc036cc['id']||0x0;this[_0x5552('0x0')]=_0xc036cc[_0x5552('0x0')]||'';this[_0x5552('0x1')]=_0xc036cc[_0x5552('0x1')]||'';this[_0x5552('0x2')]=_0xc036cc[_0x5552('0x2')]||'';this['zone']=_0xc036cc[_0x5552('0x3')]||'';this[_0x5552('0x4')]=_0xc036cc['clientId']||'';this[_0x5552('0x5')]=_0xc036cc[_0x5552('0x5')]||'';this[_0x5552('0x6')]=_0xc036cc[_0x5552('0x6')]||'';this[_0x5552('0x7')]=_0xc036cc[_0x5552('0x7')]||'';this[_0x5552('0x8')]=_0xc036cc[_0x5552('0x8')]||'';this['Configurations']=_0xc036cc[_0x5552('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 736ce8d..0a87b57 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 _0x8867=['queue','name','type','membername','isNil','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','util','lodash','string','uniqueid'];(function(_0x165567,_0x5cf87c){var _0x1d7a4a=function(_0x801bc0){while(--_0x801bc0){_0x165567['push'](_0x165567['shift']());}};_0x1d7a4a(++_0x5cf87c);}(_0x8867,0x134));var _0x7886=function(_0x5b0741,_0x438df7){_0x5b0741=_0x5b0741-0x0;var _0x3ee9c9=_0x8867[_0x5b0741];return _0x3ee9c9;};'use strict';var util=require(_0x7886('0x0'));var _=require(_0x7886('0x1'));var moment=require('moment');function checkNameSurname(_0x4f2af2,_0x4b9b58,_0x4fcf48){var _0x2d58a8='';if(!_['isNil'](_0x4b9b58)&&_0x7886('0x2')===typeof _0x4b9b58){_0x2d58a8+=_0x4b9b58;}if(!_['isNil'](_0x4fcf48)&&_0x7886('0x2')===typeof _0x4fcf48){_0x2d58a8+='\x20'+_0x4fcf48;}if(_0x2d58a8!==''){return _0x2d58a8;}return _0x4f2af2;}function Action(_0x3afb61,_0x592e16,_0x169fd3,_0x19b1ce,_0x544ae){this[_0x7886('0x3')]=_0x169fd3||undefined;this['idContact']=_0x3afb61['id'];this[_0x7886('0x4')]=_0x592e16[_0x7886('0x5')];this[_0x7886('0x6')]=_0x592e16['type'];this['campaigntype']=_0x7886('0x4');this['dialAnswer']=![];this[_0x7886('0x7')]=_[_0x7886('0x8')](_0x3afb61[_0x7886('0x9')])?undefined:_0x3afb61[_0x7886('0x9')][_0x7886('0x5')];this[_0x7886('0xa')]=this[_0x7886('0x7')]?util[_0x7886('0xb')](_0x7886('0xc'),this[_0x7886('0x7')]):_0x19b1ce||undefined;this[_0x7886('0xd')]=checkNameSurname(_0x3afb61[_0x7886('0xe')][_0x7886('0xf')],_0x3afb61[_0x7886('0xe')][_0x7886('0x10')],_0x3afb61['Contact'][_0x7886('0x11')]);this[_0x7886('0x12')]=_0x3afb61[_0x7886('0x12')]||![];this['calleridnum']=_0x3afb61[_0x7886('0xe')][_0x7886('0xf')];this[_0x7886('0x13')]=_0x3afb61[_0x7886('0x13')];this[_0x7886('0x14')]=_0x3afb61[_0x7886('0x14')]||0x0;this['countcongestionretry']=_0x3afb61[_0x7886('0x15')]||0x0;this['countnoanswerretry']=_0x3afb61[_0x7886('0x16')]||0x0;this[_0x7886('0x17')]=(_0x3afb61[_0x7886('0x14')]||0x0)+(_0x3afb61['countcongestionretry']||0x0)+(_0x3afb61[_0x7886('0x16')]||0x0)+(_0x3afb61['countnosuchnumberretry']||0x0)+(_0x3afb61[_0x7886('0x18')]||0x0)+(_0x3afb61['countabandonedretry']||0x0)+(_0x3afb61['countmachineretry']||0x0)+(_0x3afb61[_0x7886('0x19')]||0x0);this[_0x7886('0x1a')]=_0x3afb61[_0x7886('0x1a')]||0x0;this[_0x7886('0x18')]=_0x3afb61[_0x7886('0x18')]||0x0;this['countabandonedretry']=_0x3afb61[_0x7886('0x1b')]||0x0;this[_0x7886('0x1c')]=_0x3afb61[_0x7886('0x1c')]||0x0;this['countagentrejectretry']=_0x3afb61['countagentrejectretry']||0x0;this['callback']=_0x3afb61['callback'];this[_0x7886('0x1d')]=_0x3afb61[_0x7886('0x1d')];this['callbackat']=_0x3afb61[_0x7886('0x1e')];this[_0x7886('0x1f')]=_0x3afb61[_0x7886('0x1f')];this[_0x7886('0x20')]=_0x3afb61[_0x7886('0x20')];this[_0x7886('0x21')]=_0x3afb61[_0x7886('0x21')];this['UserId']=_['isNil'](_0x3afb61['Agent'])?_0x3afb61[_0x7886('0x22')]:_0x3afb61[_0x7886('0x9')]['id'];this['VoiceQueueId']=_0x3afb61[_0x7886('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x7886('0x24')][_0x7886('0x25')]=function(){return util[_0x7886('0xb')](_0x7886('0x26'),this[_0x7886('0xd')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x7e7b=['queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','getCaller','\x22%s\x22\x20<%s>','exports','isNil','string','uniqueid','idContact'];(function(_0x1cb8f5,_0xcd4a21){var _0x51699d=function(_0x4a150d){while(--_0x4a150d){_0x1cb8f5['push'](_0x1cb8f5['shift']());}};_0x51699d(++_0xcd4a21);}(_0x7e7b,0x10d));var _0xb7e7=function(_0x295f2a,_0x153c68){_0x295f2a=_0x295f2a-0x0;var _0x54bc1c=_0x7e7b[_0x295f2a];return _0x54bc1c;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x4033e6,_0x1cad1c,_0xf1f391){var _0x1bda2e='';if(!_[_0xb7e7('0x0')](_0x1cad1c)&&_0xb7e7('0x1')===typeof _0x1cad1c){_0x1bda2e+=_0x1cad1c;}if(!_['isNil'](_0xf1f391)&&_0xb7e7('0x1')===typeof _0xf1f391){_0x1bda2e+='\x20'+_0xf1f391;}if(_0x1bda2e!==''){return _0x1bda2e;}return _0x4033e6;}function Action(_0x45f093,_0x3f3477,_0x3ed23f,_0x475767,_0x29307f){this[_0xb7e7('0x2')]=_0x3ed23f||undefined;this[_0xb7e7('0x3')]=_0x45f093['id'];this[_0xb7e7('0x4')]=_0x3f3477[_0xb7e7('0x5')];this['type']=_0x3f3477[_0xb7e7('0x6')];this[_0xb7e7('0x7')]=_0xb7e7('0x4');this[_0xb7e7('0x8')]=![];this[_0xb7e7('0x9')]=_[_0xb7e7('0x0')](_0x45f093['Agent'])?undefined:_0x45f093[_0xb7e7('0xa')][_0xb7e7('0x5')];this[_0xb7e7('0xb')]=this[_0xb7e7('0x9')]?util[_0xb7e7('0xc')]('SIP/%s',this[_0xb7e7('0x9')]):_0x475767||undefined;this[_0xb7e7('0xd')]=checkNameSurname(_0x45f093[_0xb7e7('0xe')]['phone'],_0x45f093['Contact'][_0xb7e7('0xf')],_0x45f093['Contact'][_0xb7e7('0x10')]);this[_0xb7e7('0x11')]=_0x45f093['active']||![];this[_0xb7e7('0x12')]=_0x45f093[_0xb7e7('0xe')][_0xb7e7('0x13')];this[_0xb7e7('0x14')]=_0x45f093[_0xb7e7('0x14')];this[_0xb7e7('0x15')]=_0x45f093['countbusyretry']||0x0;this[_0xb7e7('0x16')]=_0x45f093[_0xb7e7('0x16')]||0x0;this[_0xb7e7('0x17')]=_0x45f093['countnoanswerretry']||0x0;this[_0xb7e7('0x18')]=(_0x45f093[_0xb7e7('0x15')]||0x0)+(_0x45f093[_0xb7e7('0x16')]||0x0)+(_0x45f093['countnoanswerretry']||0x0)+(_0x45f093[_0xb7e7('0x19')]||0x0)+(_0x45f093['countdropretry']||0x0)+(_0x45f093[_0xb7e7('0x1a')]||0x0)+(_0x45f093['countmachineretry']||0x0)+(_0x45f093['countagentrejectretry']||0x0);this[_0xb7e7('0x19')]=_0x45f093[_0xb7e7('0x19')]||0x0;this[_0xb7e7('0x1b')]=_0x45f093[_0xb7e7('0x1b')]||0x0;this[_0xb7e7('0x1a')]=_0x45f093[_0xb7e7('0x1a')]||0x0;this['countmachineretry']=_0x45f093[_0xb7e7('0x1c')]||0x0;this['countagentrejectretry']=_0x45f093['countagentrejectretry']||0x0;this['callback']=_0x45f093['callback'];this[_0xb7e7('0x1d')]=_0x45f093['callbackuniqueid'];this[_0xb7e7('0x1e')]=_0x45f093[_0xb7e7('0x1e')];this['recallme']=_0x45f093[_0xb7e7('0x1f')];this[_0xb7e7('0x20')]=_0x45f093[_0xb7e7('0x20')];this[_0xb7e7('0x21')]=_0x45f093[_0xb7e7('0x21')];this[_0xb7e7('0x22')]=_[_0xb7e7('0x0')](_0x45f093[_0xb7e7('0xa')])?_0x45f093['UserId']:_0x45f093[_0xb7e7('0xa')]['id'];this[_0xb7e7('0x23')]=_0x45f093[_0xb7e7('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0xb7e7('0x24')]=function(){return util[_0xb7e7('0xc')](_0xb7e7('0x25'),this[_0xb7e7('0xd')],this['number']);};module[_0xb7e7('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0204868..94b1b87 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 _0xf426=['getCallerIdRandom','callerid','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','pTalking:\x20','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','outbound','name','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','originated','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','logger','\x20is\x20disactive','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','type','setMessage','recallMe','enqueue','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','contactId','UserId','ListId','channel','No\x20such\x20channel','updateOriginated','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannel','getContactRecallMe','agentReadyId','length','getDiff','dialRecallMeTimeout','Agent','voicePause','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','catch','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','ANSWER','responsetime','uniqueid','\x20Queue','emit','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','linkedid','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','loggerError','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','unmonitored','run','execRun','pick','unlock','unlockContact','recallme','validateContact','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','phone','substring','getCallerId','dialRandomLastDigitCallerIdNumber'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xf426,0x168));var _0x6f42=function(_0x4ec42,_0x36177b){_0x4ec42=_0x4ec42-0x0;var _0x385e11=_0xf426[_0x4ec42];return _0x385e11;};'use strict';var util=require(_0x6f42('0x0'));var _=require(_0x6f42('0x1'));var BPromise=require('bluebird');var uuid=require(_0x6f42('0x2'));var moment=require(_0x6f42('0x3'));var md5=require('md5');var Redis=require(_0x6f42('0x4'));var config=require(_0x6f42('0x5'));var logger=require(_0x6f42('0x6'))(_0x6f42('0x7'));var loggerAction=require(_0x6f42('0x6'))(_0x6f42('0x8'));var ami=require(_0x6f42('0x9'));var rpcDb=require(_0x6f42('0xa'));var Action=require(_0x6f42('0xb'));var ut=require('./util/util');config[_0x6f42('0xc')]=_[_0x6f42('0xd')](config['redis'],{'host':_0x6f42('0xe'),'port':0x18eb});var io=require(_0x6f42('0xf'))(new Redis(config[_0x6f42('0xc')]));var Sequence=function(){};Sequence[_0x6f42('0x10')]['enqueue']=function(_0x4bbf1){this[_0x6f42('0x11')]=this[_0x6f42('0x11')]?this[_0x6f42('0x11')][_0x6f42('0x12')](_0x4bbf1):_0x4bbf1();};function Preview(_0xfeec68){this[_0x6f42('0x13')]=new Sequence();this[_0x6f42('0x14')]=_0xfeec68[_0x6f42('0x15')];this['trunks']=_0xfeec68[_0x6f42('0x16')];this[_0x6f42('0x17')]={};this['agents']=_0xfeec68[_0x6f42('0x18')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x6f42('0x19')][_0x6f42('0x1a')](this));ami['on'](_0x6f42('0x1b'),this[_0x6f42('0x1c')][_0x6f42('0x1a')](this));ami['on'](_0x6f42('0x1d'),this[_0x6f42('0x1e')][_0x6f42('0x1a')](this));ami['on'](_0x6f42('0x1f'),this[_0x6f42('0x20')][_0x6f42('0x1a')](this));ami['on'](_0x6f42('0x21'),this[_0x6f42('0x22')][_0x6f42('0x1a')](this));ami['on']('varset',this[_0x6f42('0x23')][_0x6f42('0x1a')](this));ami['on'](_0x6f42('0x24'),this[_0x6f42('0x25')][_0x6f42('0x1a')](this));ami['on'](_0x6f42('0x26'),this['syncBlindTransfer']['bind'](this));this['loopCampaigns'](this[_0x6f42('0x14')]);}function emit(_0x346884,_0x42d158,_0x52272f){io['to'](_0x346884)['emit'](_0x42d158,_0x52272f);}function emitCampaignPreview(_0x4f89dc){if(_0x4f89dc['type']===_0x6f42('0x27')){var _0x2e9f37={'id':_0x4f89dc['id'],'name':_0x4f89dc[_0x6f42('0x28')],'strategy':_0x4f89dc[_0x6f42('0x29')],'answered':_0x4f89dc[_0x6f42('0x2a')],'available':_0x4f89dc[_0x6f42('0x2b')],'loggedIn':_0x4f89dc['loggedIn'],'pTalking':_0x4f89dc[_0x6f42('0x2c')],'sumBillable':_0x4f89dc[_0x6f42('0x2d')],'sumDuration':_0x4f89dc[_0x6f42('0x2e')],'sumHoldTime':_0x4f89dc[_0x6f42('0x2f')]||0x0,'talking':_0x4f89dc[_0x6f42('0x30')],'total':_0x4f89dc[_0x6f42('0x31')],'type':_0x4f89dc['type'],'unmanaged':_0x4f89dc['unmanaged'],'abandoned':_0x4f89dc['abandoned'],'waiting':_0x4f89dc[_0x6f42('0x32')],'loggedInDb':_0x4f89dc[_0x6f42('0x33')],'dialActive':_0x4f89dc[_0x6f42('0x34')],'dialMethod':_0x4f89dc[_0x6f42('0x35')],'dialOriginateCallerIdName':_0x4f89dc[_0x6f42('0x36')],'dialOriginateCallerIdNumber':_0x4f89dc[_0x6f42('0x37')],'dialOriginateTimeout':_0x4f89dc['dialOriginateTimeout'],'dialPrefix':_0x4f89dc[_0x6f42('0x38')],'outboundAnswerAgiCallsDay':_0x4f89dc[_0x6f42('0x39')],'outboundAnswerCallsDay':_0x4f89dc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4f89dc['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4f89dc[_0x6f42('0x3a')],'outboundCongestionCallsDay':_0x4f89dc[_0x6f42('0x3b')],'outboundDropCallsDayACS':_0x4f89dc[_0x6f42('0x3c')],'outboundDropCallsDayCallersExit':_0x4f89dc['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x4f89dc['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4f89dc[_0x6f42('0x3d')],'outboundNoSuchCallsDay':_0x4f89dc['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4f89dc['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4f89dc[_0x6f42('0x3e')],'outboundRejectCallsDay':_0x4f89dc[_0x6f42('0x3f')],'outboundUnknownCallsDay':_0x4f89dc['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x4f89dc[_0x6f42('0x40')],'predictiveIntervalAnsweredCalls':_0x4f89dc[_0x6f42('0x41')],'predictiveIntervalAvgHoldtime':_0x4f89dc[_0x6f42('0x42')],'predictiveIntervalAvgTalktime':_0x4f89dc['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4f89dc['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4f89dc['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4f89dc[_0x6f42('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x4f89dc[_0x6f42('0x44')],'predictiveIntervalHitRate':_0x4f89dc[_0x6f42('0x45')],'predictiveIntervalMultiplicativeFactor':_0x4f89dc[_0x6f42('0x46')],'predictiveIntervalPauses':_0x4f89dc[_0x6f42('0x47')],'predictiveIntervalAvailable':_0x4f89dc['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4f89dc['predictiveIntervalTotalCalls'],'message':_0x4f89dc[_0x6f42('0x48')],'originated':_0x4f89dc['originated'],'erlangCalls':_0x4f89dc['erlangCalls'],'erlangCallToSecond':_0x4f89dc[_0x6f42('0x49')],'erlangAbandonmentRate':_0x4f89dc[_0x6f42('0x4a')],'erlangBusyFactor':_0x4f89dc[_0x6f42('0x4b')],'startPredictive':_0x4f89dc[_0x6f42('0x4c')],'startProgressive':_0x4f89dc[_0x6f42('0x4d')]};if(_0x4f89dc['Trunk']){_0x2e9f37[_0x6f42('0x4e')]={'id':_0x4f89dc[_0x6f42('0x4e')]['id'],'name':_0x4f89dc['Trunk'][_0x6f42('0x28')],'active':_0x4f89dc[_0x6f42('0x4e')]['active'],'callerid':_0x4f89dc[_0x6f42('0x4e')]['callerid']};}if(_0x4f89dc[_0x6f42('0x4f')]){_0x2e9f37[_0x6f42('0x4f')]={'id':_0x4f89dc[_0x6f42('0x4f')]['id'],'name':_0x4f89dc['Interval']['name']};}var _0x450a95=md5(JSON[_0x6f42('0x50')](_0x2e9f37));if(_0x4f89dc[_0x6f42('0x51')]!==_0x450a95){_0x4f89dc[_0x6f42('0x51')]=_0x450a95;emit(util[_0x6f42('0x52')](_0x6f42('0x53'),_0x2e9f37[_0x6f42('0x28')]),_0x6f42('0x54'),_0x2e9f37);}}}function emitVoiceQueueChannelRemove(_0x4e4e64){logger['info'](_0x6f42('0x55'),JSON['stringify'](_0x4e4e64));emit(util[_0x6f42('0x52')]('voice:queue:%s',_0x4e4e64['name']),_0x6f42('0x56'),_0x4e4e64);}function notSendMessagesQueue(_0x24f2f1){if(_0x24f2f1['sendMessageOneNotActive']){if(_0x24f2f1[_0x6f42('0x57')]===0x0&&_0x24f2f1[_0x6f42('0x2c')]===0x0){_0x24f2f1['sendMessageOneNotActive']=![];_0x24f2f1[_0x6f42('0x2b')]=0x0;_0x24f2f1['paused']=0x0;_0x24f2f1[_0x6f42('0x48')]=_0x6f42('0x58');ut['logger'](_0x6f42('0x59'),_0x24f2f1['name']+_0x6f42('0x5a'));}else{_0x24f2f1[_0x6f42('0x48')]='IS_DISACTIVED';ut[_0x6f42('0x5b')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x24f2f1[_0x6f42('0x28')]+_0x6f42('0x5c'));}emitCampaignPreview(_0x24f2f1);}}Preview[_0x6f42('0x10')][_0x6f42('0x5d')]=function(){var _0x3656f2=this;setInterval(function(){_0x3656f2[_0x6f42('0x5e')]();},0x7cf);};Preview[_0x6f42('0x10')][_0x6f42('0x5e')]=function(){var _0x55956f=this[_0x6f42('0x14')];this[_0x6f42('0x5f')]+=0x1;for(var _0x7ec6c1 in _0x55956f){if(_0x55956f[_0x6f42('0x60')](_0x7ec6c1)&&(_0x55956f[_0x7ec6c1][_0x6f42('0x35')]==='preview'||_0x55956f[_0x7ec6c1][_0x6f42('0x35')]===_0x6f42('0x61'))&&_0x55956f[_0x7ec6c1]['type']==='outbound'){if(this[_0x6f42('0x5f')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6f42('0x62')]();}}if(_0x55956f[_0x6f42('0x60')](_0x7ec6c1)&&_0x55956f[_0x7ec6c1]['dialMethod']===_0x6f42('0x7')&&_0x55956f[_0x7ec6c1][_0x6f42('0x63')]==='outbound'){if(_0x55956f[_0x7ec6c1][_0x6f42('0x34')]){this[_0x6f42('0x64')](_0x55956f[_0x7ec6c1]);this[_0x6f42('0x65')](_0x55956f[_0x7ec6c1]);}else{notSendMessagesQueue(_0x55956f[_0x7ec6c1]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x156ecf){var _0x2542c2=this;this[_0x6f42('0x13')][_0x6f42('0x66')](function(){if(!_[_0x6f42('0x67')](_0x2542c2['actions'][_0x156ecf])){loggerAction[_0x6f42('0x68')](_0x6f42('0x69'),_0x156ecf,_0x6f42('0x6a'),_0x2542c2[_0x6f42('0x17')][_0x156ecf][_0x6f42('0x6b')],_0x6f42('0x6c'),JSON[_0x6f42('0x50')](_0x2542c2[_0x6f42('0x14')][_0x2542c2[_0x6f42('0x17')][_0x156ecf][_0x6f42('0x6b')]][_0x6f42('0x57')]),'pTalking:\x20',JSON['stringify'](_0x2542c2[_0x6f42('0x14')][_0x2542c2[_0x6f42('0x17')][_0x156ecf][_0x6f42('0x6b')]]['pTalking']),JSON['stringify'](_0x2542c2[_0x6f42('0x17')][_0x156ecf][_0x6f42('0x6d')]),JSON[_0x6f42('0x50')](_['pick'](_0x2542c2[_0x6f42('0x17')][_0x156ecf],[_0x6f42('0x6e'),_0x6f42('0x6f'),'VoiceQueueId',_0x6f42('0x70')])));return ami['Action']({'action':'status','channel':_0x2542c2[_0x6f42('0x17')][_0x156ecf][_0x6f42('0x71')]})['catch'](function(_0x1062c5){if(_0x1062c5[_0x6f42('0x48')]===_0x6f42('0x72')){setTimeout(function(){if(_0x2542c2[_0x6f42('0x17')][_0x156ecf]){ut[_0x6f42('0x73')](_0x2542c2['campaignsPreview'][_0x2542c2[_0x6f42('0x17')][_0x156ecf][_0x6f42('0x6b')]],'[clearZombieChannel]');if(_0x2542c2[_0x6f42('0x17')][_0x156ecf][_0x6f42('0x6d')]===!![]){ut[_0x6f42('0x74')](_0x2542c2[_0x6f42('0x14')][_0x2542c2['actions'][_0x156ecf][_0x6f42('0x6b')]],'[clearZombieChannel]');ut['loggerError'](_0x6f42('0x75')+_0x156ecf,_0x2542c2['actions'][_0x156ecf][_0x6f42('0x6b')]);}ut['loggerError'](_0x6f42('0x76')+_0x156ecf,_0x2542c2[_0x6f42('0x17')][_0x156ecf][_0x6f42('0x6b')]);delete _0x2542c2[_0x6f42('0x17')][_0x156ecf];}},0x2328);}});}});};Preview[_0x6f42('0x10')]['clearZombieChannels']=function(){var _0x1a6fee=this;loggerAction[_0x6f42('0x68')]('[action]',_['size'](this['actions']));for(var _0x562751 in this[_0x6f42('0x17')]){if(_0x1a6fee[_0x6f42('0x17')][_0x6f42('0x60')](_0x562751)){_0x1a6fee[_0x6f42('0x77')](_0x562751);}}};Preview[_0x6f42('0x10')]['recallMe']=function(_0x4cb9cd){var _0x4fa8ed=this;rpcDb[_0x6f42('0x78')](_0x4cb9cd['id'],ut[_0x6f42('0x79')](this[_0x6f42('0x18')]))['then'](function(_0x3dd1b5){if(!_[_0x6f42('0x67')](_0x3dd1b5)){for(var _0x5436db=0x0;_0x5436db<_0x3dd1b5[_0x6f42('0x7a')];_0x5436db+=0x1){if(ut[_0x6f42('0x7b')](_0x3dd1b5[_0x5436db]['scheduledat'])<_0x4cb9cd[_0x6f42('0x7c')]*0x3c){if(_0x3dd1b5[_0x5436db][_0x6f42('0x7d')]&&!_0x3dd1b5[_0x5436db][_0x6f42('0x7d')][_0x6f42('0x7e')]){_0x4fa8ed['run'](_0x3dd1b5[_0x5436db]['id'])[_0x6f42('0x7f')](ut[_0x6f42('0x80')](_0x6f42('0x81')))['catch'](ut[_0x6f42('0x80')]('[RecallMe]'));}else{rpcDb[_0x6f42('0x82')](_0x3dd1b5[_0x5436db]['id']);}}else{var _0xe1e948=new Action(_0x3dd1b5[_0x5436db],_0x4cb9cd);_0xe1e948[_0x6f42('0x83')]=moment()[_0x6f42('0x52')](_0x6f42('0x84'));_0x4cb9cd[_0x6f42('0x3e')]+=0x1;ut[_0x6f42('0x85')](_0xe1e948,0x17,_0x6f42('0x86'));if(_0x4cb9cd[_0x6f42('0x87')]){rpcDb[_0x6f42('0x88')](ut[_0x6f42('0x89')](_0x3dd1b5[_0x5436db]));rpcDb[_0x6f42('0x8a')](_0xe1e948,_0x6f42('0x8b'));}else{ut['logCustomer'](_0xe1e948,0x16,_0x6f42('0x8c'));rpcDb[_0x6f42('0x8a')](_0xe1e948,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0xe1e948,'[HistoryRecallClose]');}}}}})[_0x6f42('0x8d')](ut[_0x6f42('0x80')](_0x6f42('0x8e')));};Preview['prototype'][_0x6f42('0x64')]=function(_0x384761){_0x384761[_0x6f42('0x8f')]=!![];if(ut[_0x6f42('0x90')](_0x384761['loggedIn'])){_0x384761[_0x6f42('0x48')]=_0x6f42('0x91');}else if(!ut[_0x6f42('0x92')](_0x384761[_0x6f42('0x34')])){_0x384761['message']='NOT_ACTIVE';}else if(!this[_0x6f42('0x93')](_0x384761[_0x6f42('0x4e')])){if(!this['isTrunkReachable'](_0x384761[_0x6f42('0x94')])){_0x384761[_0x6f42('0x48')]=_0x6f42('0x95');}else{_0x384761[_0x6f42('0x48')]=_0x6f42('0x96');}}else{_0x384761[_0x6f42('0x48')]=_0x6f42('0x96');}emitCampaignPreview(_0x384761);};Preview[_0x6f42('0x10')]['callProgressDetectingCustomer']=function(_0x3579a5,_0x501c7e,_0x2bd919){var _0x645483=this;var _0x5cc011=this[_0x6f42('0x17')][_0x501c7e];var _0xe4053=this[_0x6f42('0x14')][_0x5cc011[_0x6f42('0x6b')]];var _0x1c2f49;if(_0xe4053){switch(_0x2bd919){case'1':_0xe4053[_0x6f42('0x97')]+=0x1;_0x5cc011[_0x6f42('0x98')]+=0x1;_0x5cc011['countglobal']=ut[_0x6f42('0x99')](_0x5cc011);ut[_0x6f42('0x85')](_0x5cc011,0x0,_0x6f42('0x9a'));ami['emit']('custom:agentnosuchnumber',ut[_0x6f42('0x9b')](_0x5cc011,_0x6f42('0x9c')));rpcDb['createCustomerHistory'](_0x5cc011,_0x6f42('0x9d'));if(ut[_0x6f42('0x99')](_0x5cc011)>=_0xe4053[_0x6f42('0x9e')]){_0x1c2f49=ut[_0x6f42('0x9f')](_0x5cc011,0xf,_0x6f42('0xa0'));rpcDb['createCustomerFinal'](_0x1c2f49,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5cc011[_0x6f42('0x98')]>=_0xe4053[_0x6f42('0xa1')]){rpcDb[_0x6f42('0xa2')](_0x5cc011,_0x6f42('0xa3'));}else{rpcDb['rescheduleContact'](ut[_0x6f42('0xa4')](_0x5cc011,_0x6f42('0x98'),_0xe4053['dialNoSuchNumberRetryFrequency']),_0x5cc011['unlockAgent'],_0x5cc011['activeContact']);}}delete this[_0x6f42('0x17')][_0x3579a5['linkedid']];break;case _0x6f42('0xa5'):var _0x2a30dc=moment()[_0x6f42('0x52')](_0x6f42('0x84'));_0x5cc011[_0x6f42('0xa6')]=_0x2a30dc;_0x5cc011['answertime']=_0x2a30dc;_0x5cc011[_0x6f42('0x6d')]=!![];_0xe4053[_0x6f42('0x2c')]+=0x1;logger[_0x6f42('0x68')]('[syncHangup][talking][increment]',_0x5cc011[_0x6f42('0xa7')],_0x6f42('0xa8'),_0xe4053[_0x6f42('0x28')],'pTalking:\x20',_0xe4053[_0x6f42('0x2c')]);ami[_0x6f42('0xa9')]('custom:agentconnect',ut[_0x6f42('0x9b')](_0x5cc011,_0x6f42('0xaa')));if(_0xe4053[_0x6f42('0xab')]){ami[_0x6f42('0xa9')](_0x6f42('0xac'),ut[_0x6f42('0xad')](_0x5cc011));}break;case'16':ami['emit'](_0x6f42('0xae'),ut[_0x6f42('0x9b')](_0x5cc011,'complete'));emitVoiceQueueChannelRemove(ut[_0x6f42('0x9b')](_0x5cc011,_0x6f42('0xaf')));_0xe4053[_0x6f42('0xb0')]+=0x1;_0xe4053['total']+=0x1;_0xe4053[_0x6f42('0x2a')]+=0x1;ut[_0x6f42('0x74')](_0xe4053,_0x6f42('0xb1'));_0x5cc011[_0x6f42('0xb2')]=ut[_0x6f42('0x99')](_0x5cc011);ut[_0x6f42('0x85')](_0x5cc011,0x4,_0x6f42('0xb3'));rpcDb[_0x6f42('0x8a')](_0x5cc011,_0x6f42('0xb4'));rpcDb['createCustomerFinal'](_0x5cc011,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x6f42('0xb5')](_0x5cc011);_0xe4053[_0x6f42('0x2e')]+=_0x5cc011[_0x6f42('0xb6')];_0xe4053['sumBillable']+=_0x5cc011[_0x6f42('0xb6')];logger[_0x6f42('0x68')]('[syncHangup][talking][decrement]',_0x5cc011[_0x6f42('0xa7')],_0x6f42('0xa8'),_0xe4053['name'],'pTalking:\x20',_0xe4053[_0x6f42('0x2c')]);delete this[_0x6f42('0x17')][_0x3579a5[_0x6f42('0xb7')]];break;case _0x6f42('0xb8'):_0xe4053['outboundBusyCallsDay']+=0x1;_0x5cc011[_0x6f42('0xb9')]+=0x1;_0x5cc011[_0x6f42('0xb2')]=ut['totalGlobal'](_0x5cc011);ut['logCustomer'](_0x5cc011,0x5,_0x6f42('0xba'));ami[_0x6f42('0xa9')](_0x6f42('0xbb'),ut[_0x6f42('0x9b')](_0x5cc011,'busy'));rpcDb['createCustomerHistory'](_0x5cc011,_0x6f42('0xbc'));if(ut[_0x6f42('0x99')](_0x5cc011)>=_0xe4053['dialGlobalMaxRetry']){_0x1c2f49=ut[_0x6f42('0x9f')](_0x5cc011,0xf,'Global');rpcDb[_0x6f42('0xa2')](_0x1c2f49,_0x6f42('0xbd'));}else{if(_0x5cc011['countbusyretry']>=_0xe4053[_0x6f42('0xbe')]){rpcDb['createCustomerFinal'](_0x5cc011,_0x6f42('0xbc'));}else{rpcDb['rescheduleContact'](ut[_0x6f42('0xa4')](_0x5cc011,_0x6f42('0xb9'),_0xe4053[_0x6f42('0xbf')]),_0x5cc011[_0x6f42('0xc0')],_0x5cc011[_0x6f42('0xc1')]);}}break;case _0x6f42('0xc2'):_0xe4053[_0x6f42('0x3d')]+=0x1;_0x5cc011[_0x6f42('0xc3')]+=0x1;_0x5cc011[_0x6f42('0xb2')]=ut['totalGlobal'](_0x5cc011);ut[_0x6f42('0x85')](_0x5cc011,0x3,_0x6f42('0xc4'));ami['emit'](_0x6f42('0xc5'),ut[_0x6f42('0x9b')](_0x5cc011,_0x6f42('0xc6')));rpcDb[_0x6f42('0x8a')](_0x5cc011,_0x6f42('0xc7'));if(ut[_0x6f42('0x99')](_0x5cc011)>=_0xe4053[_0x6f42('0x9e')]){_0x1c2f49=ut[_0x6f42('0x9f')](_0x5cc011,0xf,'Global');rpcDb['createCustomerFinal'](_0x1c2f49,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5cc011[_0x6f42('0xc3')]>=_0xe4053['dialNoAnswerMaxRetry']){rpcDb[_0x6f42('0xa2')](_0x5cc011,_0x6f42('0xc7'));}else{rpcDb[_0x6f42('0xc8')](ut[_0x6f42('0xa4')](_0x5cc011,_0x6f42('0xc3'),_0xe4053['dialNoAnswerRetryFrequency']),_0x5cc011['unlockAgent'],_0x5cc011['activeContact']);}}break;case'CONGESTION':_0xe4053['outboundCongestionCallsDay']+=0x1;_0x5cc011[_0x6f42('0xc9')]+=0x1;_0x5cc011[_0x6f42('0xb2')]=ut[_0x6f42('0x99')](_0x5cc011);ut[_0x6f42('0x85')](_0x5cc011,0x8,_0x6f42('0xca'));rpcDb[_0x6f42('0x8a')](_0x5cc011,_0x6f42('0xcb'));if(ut[_0x6f42('0x99')](_0x5cc011)>=_0xe4053[_0x6f42('0x9e')]){_0x1c2f49=ut[_0x6f42('0x9f')](_0x5cc011,0xf,'Global');rpcDb[_0x6f42('0xa2')](_0x1c2f49,_0x6f42('0xcc'));}else{if(_0x5cc011[_0x6f42('0xc9')]>=_0xe4053[_0x6f42('0xcd')]){rpcDb[_0x6f42('0xa2')](_0x5cc011,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x6f42('0xc8')](ut[_0x6f42('0xa4')](_0x5cc011,_0x6f42('0xc9'),_0xe4053[_0x6f42('0xbf')]),_0x5cc011[_0x6f42('0xc0')],_0x5cc011['activeContact']);}}break;case _0x6f42('0xce'):_0xe4053[_0x6f42('0x3f')]+=0x1;_0x5cc011[_0x6f42('0xcf')]+=0x1;_0x5cc011[_0x6f42('0xb2')]=ut['totalGlobal'](_0x5cc011);ut[_0x6f42('0x85')](_0x5cc011,0x14,_0x6f42('0xd0'));rpcDb[_0x6f42('0x8a')](_0x5cc011,'[syncHangupRequest][logAgentReject]');if(ut[_0x6f42('0x99')](_0x5cc011)>=_0xe4053[_0x6f42('0x9e')]){_0x1c2f49=ut[_0x6f42('0x9f')](_0x5cc011,0x14,'AgentReject');rpcDb[_0x6f42('0xa2')](_0x1c2f49,_0x6f42('0xd1'));}else{if(_0x5cc011['countagentrejectretry']>=_0xe4053[_0x6f42('0xd2')]){rpcDb[_0x6f42('0xa2')](_0x5cc011,_0x6f42('0xd1'));}else{rpcDb[_0x6f42('0xc8')](ut[_0x6f42('0xa4')](_0x5cc011,_0x6f42('0xcf'),_0xe4053['dialAgentRejectRetryFrequency']),_0x5cc011['unlockAgent'],_0x5cc011[_0x6f42('0xc1')]);}}break;case _0x6f42('0xd3'):_0xe4053[_0x6f42('0x40')]+=0x1;_0x5cc011[_0x6f42('0xd4')]+=0x1;_0x5cc011[_0x6f42('0xb2')]=ut['totalGlobal'](_0x5cc011);ut[_0x6f42('0x85')](_0x5cc011,0xb,_0x6f42('0xd5'));rpcDb[_0x6f42('0x8a')](_0x5cc011,_0x6f42('0xd6'));if(ut[_0x6f42('0x99')](_0x5cc011)>=_0xe4053[_0x6f42('0x9e')]){_0x1c2f49=ut[_0x6f42('0x9f')](_0x5cc011,0xf,_0x6f42('0xa0'));rpcDb[_0x6f42('0xa2')](_0x1c2f49,_0x6f42('0xd6'));}else{if(_0x5cc011[_0x6f42('0xd7')]>=_0xe4053['dialAbandonedMaxRety']){rpcDb[_0x6f42('0xa2')](_0x5cc011,_0x6f42('0xd6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5cc011,_0x6f42('0xd4'),_0xe4053[_0x6f42('0xd8')]),_0x5cc011['unlockAgent'],_0x5cc011[_0x6f42('0xc1')]);}}break;default:if(_0x5cc011[_0x6f42('0x6d')]){ut[_0x6f42('0x74')](_0xe4053,'[default]');ut[_0x6f42('0xd9')](_0x6f42('0xda')+_0xe4053[_0x6f42('0x28')],_0x3579a5);}_0xe4053['outboundUnknownCallsDay']+=0x1;_0x5cc011[_0x6f42('0xb2')]=ut[_0x6f42('0x99')](_0x5cc011);ut[_0x6f42('0x85')](_0x5cc011,0xc,_0x3579a5[_0x6f42('0xdb')]||_0x3579a5['dialstatus']);rpcDb[_0x6f42('0x8a')](_0x5cc011,_0x6f42('0xdc'));if(ut[_0x6f42('0x99')](_0x5cc011)>=_0xe4053[_0x6f42('0x9e')]){_0x1c2f49=ut[_0x6f42('0x9f')](_0x5cc011,0xf,_0x6f42('0xa0'));rpcDb[_0x6f42('0xa2')](_0x1c2f49,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x5cc011,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x3579a5[_0x6f42('0xb7')]];}if(!(_0x5cc011['dialAnswer']&&_0x2bd919==='16')){ut[_0x6f42('0x73')](_0xe4053,_0x6f42('0xdd'));logger[_0x6f42('0x68')](_0x6f42('0xde'),_0x5cc011['uniqueid'],_0x6f42('0xa8'),_0xe4053['name'],'originated:\x20',_0xe4053['originated']);}if(_0x2bd919!==_0x6f42('0xa5')){delete this[_0x6f42('0x17')][_0x3579a5[_0x6f42('0xb7')]];delete this['actions'][_0x3579a5[_0x6f42('0xdf')]];}}};Preview['prototype'][_0x6f42('0xe0')]=function(_0x56173a,_0x544f38,_0x34a8de){if(_[_0x6f42('0xe1')](_0x544f38)&&_0x6f42('0xe2')!==typeof _0x544f38){return;}if(_['isUndefined'](_0x34a8de)&&_0x6f42('0xe2')!==typeof _0x34a8de){return;}switch(_0x34a8de[_0x6f42('0xe3')]){case'0':ut[_0x6f42('0xe4')](_0x56173a,0x0,_0x6f42('0x9a'));rpcDb['createAgentHistory'](_0x56173a,_0x6f42('0xe5'));break;case'3':ut['logAgent'](_0x56173a,0x3,_0x6f42('0xc4'));rpcDb['createAgentHistory'](_0x56173a,_0x6f42('0xe6'));break;case'5':ut['logAgent'](_0x56173a,0x5,'Busy');rpcDb[_0x6f42('0xe7')](_0x56173a,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x6f42('0xe4')](_0x56173a,0x8,'Congestion');rpcDb[_0x6f42('0xe7')](_0x56173a,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x56173a,0x16,_0x6f42('0xe8'));rpcDb[_0x6f42('0xe7')](_0x56173a,_0x6f42('0xe9'));break;default:ut[_0x6f42('0xe4')](_0x56173a,0xc,_0x34a8de[_0x6f42('0xe3')]);rpcDb[_0x6f42('0xe7')](_0x56173a,_0x6f42('0xea'));}ut[_0x6f42('0x73')](_0x544f38,_0x6f42('0xeb'));logger[_0x6f42('0x68')](_0x6f42('0xec'),_0x56173a[_0x6f42('0xa7')],_0x6f42('0xa8'),_0x544f38[_0x6f42('0x28')],'originated:\x20',_0x544f38[_0x6f42('0x57')]);delete this[_0x6f42('0x17')][_0x56173a[_0x6f42('0xa7')]];};Preview['prototype']['checkInBlack']=function(_0x4e657d,_0x1315ef,_0x579ec3,_0x193c03,_0x3b8b41){var _0x259efa=this;return new BPromise(function(_0x137112,_0x353103){if(_[_0x6f42('0x67')](_0x1315ef)||_[_0x6f42('0x67')](_0x1315ef[_0x6f42('0xed')])||_[_0x6f42('0x67')](_0x1315ef['Contact']['phone'])||_[_0x6f42('0x67')](_0x1315ef[_0x6f42('0xee')])){_0x353103(ut[_0x6f42('0x48')](_0x6f42('0xef'),_0x193c03,_0x3b8b41));return;}var _0x44ed61=uuid['v4']();var _0x230fdb=_0x259efa[_0x6f42('0x14')][_0x1315ef[_0x6f42('0x6a')]['name']];var _0xa6b267=_0x579ec3?_0x259efa[_0x6f42('0x18')][_0x579ec3]['id']:undefined;_0x259efa[_0x6f42('0x17')][_0x44ed61]=new Action(_0x1315ef,_0x230fdb,_0x44ed61,_0x579ec3,_0xa6b267);var _0x4b864f=_0x259efa['actions'][_0x44ed61];_0x4b864f[_0x6f42('0xc0')]=_0x193c03;_0x4b864f[_0x6f42('0xc1')]=_0x3b8b41;_0x4b864f[_0x6f42('0xf0')]=_0x579ec3;if(_[_0x6f42('0xf1')](_0x4e657d)){_0x259efa[_0x6f42('0xf2')](_0x4b864f,_0x230fdb,_0x1315ef,_0x579ec3)[_0x6f42('0x7f')](function(_0x273c4a){logger[_0x6f42('0x68')](_0x6f42('0xf3'),_0x6f42('0xf4')+_0x4b864f[_0x6f42('0x6b')]+_0x6f42('0xf5')+_0x4b864f[_0x6f42('0xf6')],JSON[_0x6f42('0x50')](_0x273c4a));ami[_0x6f42('0xa9')](_0x6f42('0xf7'),ut[_0x6f42('0x9b')](_0x4b864f,'called'));_0x137112(ut[_0x6f42('0x48')](_0x6f42('0xf8')));})[_0x6f42('0x8d')](function(_0x4eae95){ut['logger'](_0x6f42('0xf9'),_0x4eae95);_0x353103(ut[_0x6f42('0x48')]('Call\x20failed',_0x193c03,_0x3b8b41));});}else{_0x230fdb[_0x6f42('0xfa')]+=0x1;ut[_0x6f42('0xfb')](_0x4b864f);rpcDb[_0x6f42('0xfc')](_0x4b864f,_0x6f42('0xfd'));delete _0x259efa[_0x6f42('0x17')][_0x44ed61];_0x353103(ut[_0x6f42('0x48')](_0x6f42('0xfe'),_0x193c03,_0x3b8b41));}});};Preview[_0x6f42('0x10')][_0x6f42('0x93')]=function(_0xb2c3f2){return!_[_0x6f42('0x67')](_0xb2c3f2)&&!_[_0x6f42('0x67')](_0xb2c3f2[_0x6f42('0x28')])&&!_['isNil'](_0xb2c3f2[_0x6f42('0xff')])&&_0xb2c3f2[_0x6f42('0xff')]&&!_[_0x6f42('0x67')](this[_0x6f42('0x16')][util[_0x6f42('0x52')](_0x6f42('0x100'),_0xb2c3f2[_0x6f42('0x28')])])&&!_[_0x6f42('0x67')](this[_0x6f42('0x16')][util['format'](_0x6f42('0x100'),_0xb2c3f2[_0x6f42('0x28')])]['status'])&&(this['trunks'][util['format'](_0x6f42('0x100'),_0xb2c3f2[_0x6f42('0x28')])][_0x6f42('0x101')]==='reachable'||this[_0x6f42('0x16')][util[_0x6f42('0x52')]('SIP/%s',_0xb2c3f2[_0x6f42('0x28')])]['status']===_0x6f42('0x102'));};Preview[_0x6f42('0x10')][_0x6f42('0x103')]=function(_0x306033,_0x39cc29){var _0x282016=this;return new BPromise(function(_0x40ddb1,_0x3797e3){_0x282016[_0x6f42('0x104')](_0x306033,_0x39cc29)[_0x6f42('0x7f')](function(_0x504309){_0x40ddb1(_[_0x6f42('0x105')](_0x504309,['message']));})[_0x6f42('0x8d')](function(_0x30cafd){if(_0x30cafd[_0x6f42('0x106')]){rpcDb[_0x6f42('0x107')](_0x306033);}if(_0x30cafd[_0x6f42('0xff')]){rpcDb['disableContact'](_0x306033);}_0x3797e3(_[_0x6f42('0x105')](_0x30cafd,[_0x6f42('0x48')]));});});};Preview[_0x6f42('0x10')][_0x6f42('0x104')]=function(_0x180cc5,_0x17dfa6){var _0x143e93=this;return new BPromise(function(_0x11b9cc,_0x34d080){var _0x227f0a,_0xd67c2;rpcDb['getContactPreview'](_0x180cc5)['then'](function(_0x5180ea){if(!_['isNil'](_0x5180ea[0x0])){_0xd67c2=_0x5180ea[0x0][_0x6f42('0x108')]?![]:!![];_0x227f0a=_0x5180ea[0x0]['recallme']?!![]:![];_0x227f0a=_0x17dfa6?!![]:_0x227f0a;}var _0x22c77b=_0x143e93[_0x6f42('0x109')](_0x5180ea);if(_0x22c77b['isValid']){rpcDb[_0x6f42('0x10a')](_['pick'](_0x5180ea[0x0],['VoiceQueueId','Contact.phone']))[_0x6f42('0x7f')](function(_0x43dd77){_0x143e93[_0x6f42('0x10b')](_0x43dd77,_0x5180ea[0x0],_0x17dfa6,_0xd67c2,_0x227f0a)[_0x6f42('0x7f')](function(_0x59f196){_0x11b9cc(_0x59f196);})[_0x6f42('0x8d')](function(_0x5b3a10){_0x34d080(_0x5b3a10);});})['catch'](function(_0x3acaf0){ut[_0x6f42('0x5b')](_0x6f42('0x10c'),_0x3acaf0);_0x34d080(ut['message']('Call\x20unsuccessful',_0xd67c2,_0x227f0a));});}else{_0x34d080(ut['message'](_0x22c77b['message'],_0xd67c2,_0x227f0a));}})['catch'](function(_0x2fc8b1){ut[_0x6f42('0x5b')]('[Preview][getContactPreview]',_0x2fc8b1);_0x34d080(ut['message'](_0x6f42('0x10d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x22cf14){if(_[_0x6f42('0x67')](_0x22cf14)||_[_0x6f42('0xf1')](_0x22cf14)||!_[_0x6f42('0x67')](_0x22cf14[0x0][_0x6f42('0x7d')])&&_[_0x6f42('0x67')](_0x22cf14[0x0][_0x6f42('0x7d')][_0x6f42('0x28')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x22cf14);return{'isValid':![],'message':_0x6f42('0x10e')};}var _0x3e6af9=this[_0x6f42('0x14')][_0x22cf14[0x0][_0x6f42('0x6a')][_0x6f42('0x28')]];_0x3e6af9[_0x6f42('0x48')]=_0x6f42('0x96');if(_[_0x6f42('0x67')](_0x3e6af9)){ut[_0x6f42('0x5b')](_0x6f42('0x10f'),_0x3e6af9);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x3e6af9[_0x6f42('0x4e')])){ut[_0x6f42('0x5b')](_0x6f42('0x110'),'campaign\x20Name:\x20'+_0x3e6af9['name']+_0x6f42('0x111'));if(!this[_0x6f42('0x93')](_0x3e6af9['TrunkBackup'])){ut[_0x6f42('0x5b')](_0x6f42('0x110'),_0x3e6af9['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x6f42('0x112')};}}if(!ut['isActive'](_0x3e6af9['dialActive'])){ut[_0x6f42('0x5b')](_0x6f42('0x113'),_0x3e6af9[_0x6f42('0x28')]+_0x6f42('0x114'));return{'isValid':![],'message':_0x6f42('0x115')+_0x3e6af9[_0x6f42('0x28')]+_0x6f42('0x114')};}return{'isValid':!![],'message':_0x6f42('0x116')};};Preview[_0x6f42('0x10')]['execCall']=function(_0x29e157,_0xdc5c2a,_0x6f3f45,_0x42ace2){var _0x3b1ce1=this;return new BPromise(function(_0x2b16ac,_0x5f7634){var _0x17f77c=_0x29e157[_0x6f42('0xa7')];var _0x1b19e2=_0x3b1ce1[_0x6f42('0x93')](_0xdc5c2a['Trunk'])?util[_0x6f42('0x52')](_0x6f42('0x117'),_0xdc5c2a['Trunk']['name'],_[_0x6f42('0x67')](_0xdc5c2a[_0x6f42('0x38')])?'':_0xdc5c2a[_0x6f42('0x38')][_0x6f42('0x118')]()||'',_0xdc5c2a[_0x6f42('0x119')]>0x0?_0x6f3f45[_0x6f42('0xed')][_0x6f42('0x11a')][_0x6f42('0x11b')](_0xdc5c2a[_0x6f42('0x119')]):_0x6f3f45[_0x6f42('0xed')][_0x6f42('0x11a')]):util[_0x6f42('0x52')]('SIP/%s/%s%s',_['isNil'](_0xdc5c2a[_0x6f42('0x94')])?_0xdc5c2a['Trunk'][_0x6f42('0x28')]:_0xdc5c2a[_0x6f42('0x94')][_0x6f42('0x28')],_[_0x6f42('0x67')](_0xdc5c2a[_0x6f42('0x38')])?'':_0xdc5c2a['dialPrefix'][_0x6f42('0x118')]()||'',_0xdc5c2a[_0x6f42('0x119')]>0x0?_0x6f3f45[_0x6f42('0xed')][_0x6f42('0x11a')][_0x6f42('0x11b')](_0xdc5c2a[_0x6f42('0x119')]):_0x6f3f45[_0x6f42('0xed')][_0x6f42('0x11a')]);var _0x270ac7=_0x3b1ce1[_0x6f42('0x93')](_0xdc5c2a[_0x6f42('0x4e')])?ut[_0x6f42('0x11c')](_0xdc5c2a[_0x6f42('0x4e')]['callerid'],_0xdc5c2a[_0x6f42('0x36')],_0xdc5c2a[_0x6f42('0x11d')]>0x0?ut[_0x6f42('0x11e')](_0xdc5c2a[_0x6f42('0x37')],_0xdc5c2a[_0x6f42('0x11d')]):_0xdc5c2a[_0x6f42('0x37')]):ut[_0x6f42('0x11c')](_['isNil'](_0xdc5c2a[_0x6f42('0x94')])?_0xdc5c2a[_0x6f42('0x4e')]['callerid']:_0xdc5c2a['TrunkBackup'][_0x6f42('0x11f')],_0xdc5c2a[_0x6f42('0x36')],_0xdc5c2a[_0x6f42('0x11d')]>0x0?ut[_0x6f42('0x11e')](_0xdc5c2a[_0x6f42('0x37')],_0xdc5c2a[_0x6f42('0x11d')]):_0xdc5c2a['dialOriginateCallerIdNumber']);if(_0x270ac7){_0x29e157[_0x6f42('0x120')]=ut['extractCalleridName'](_0x270ac7);_0x29e157[_0x6f42('0x121')]=ut[_0x6f42('0x122')](_0x270ac7);}var _0x18ff54=ut[_0x6f42('0x123')](_0xdc5c2a,_0x6f3f45,_0x1b19e2,_0x270ac7,_0x17f77c,_0x29e157);_['merge'](_0x29e157,ut[_0x6f42('0x124')](_0x18ff54));_0x29e157['starttime']=moment()[_0x6f42('0x52')](_0x6f42('0x84'));ami['Action'](ut[_0x6f42('0x125')](_0x29e157,_0xdc5c2a,_0x18ff54,_0x29e157[_0x6f42('0xc1')],_0x42ace2))[_0x6f42('0x7f')](function(_0x3bbb47){_0xdc5c2a[_0x6f42('0x57')]+=0x1;logger[_0x6f42('0x68')](_0x6f42('0x126'),_0x17f77c,_0x6f42('0xa8'),_0xdc5c2a[_0x6f42('0x28')],_0x6f42('0x6c'),_0xdc5c2a[_0x6f42('0x57')]);_0x2b16ac(_0x3bbb47);})['catch'](function(_0x151d19){ut[_0x6f42('0xe4')](_0x29e157,0xe,_0x6f42('0x127'));rpcDb[_0x6f42('0xe7')](_0x29e157,_0x6f42('0x128'));_0x5f7634(_0x151d19);});});};Preview[_0x6f42('0x10')][_0x6f42('0x22')]=function(_0x195200){if(this['actions'][_0x195200[_0x6f42('0xb7')]]){this[_0x6f42('0x17')][_0x195200[_0x6f42('0xb7')]][_0x6f42('0x71')]=_0x195200[_0x6f42('0x71')];}};Preview[_0x6f42('0x10')][_0x6f42('0x19')]=function(_0x3b72bd){var _0x1235c8=this;var _0x20fb13=this['actions'][_0x3b72bd[_0x6f42('0x129')]];if(_0x20fb13){if(_0x20fb13[_0x6f42('0xf0')]&&this[_0x6f42('0x18')][_0x20fb13['lookAgent']]){ut[_0x6f42('0x12a')](_0x20fb13,this[_0x6f42('0x18')][_0x20fb13[_0x6f42('0xf0')]][_0x6f42('0x28')],this[_0x6f42('0x18')][_0x20fb13[_0x6f42('0xf0')]]['id']);}var _0x1e8971=_['clone'](_0x20fb13);_0x1e8971[_0x6f42('0xa6')]=moment()[_0x6f42('0x52')](_0x6f42('0x84'));var _0x103221=_0x1235c8[_0x6f42('0x14')][_0x20fb13['queue']];if(ut[_0x6f42('0x12b')](_0x3b72bd['response'])){if(_0x20fb13['unlockAgent']){rpcDb[_0x6f42('0x107')](_0x20fb13['idContact']);}if(_0x20fb13['activeContact']){rpcDb[_0x6f42('0x82')](_0x20fb13['idContact']);}ami[_0x6f42('0xa9')](_0x6f42('0x12c'),ut[_0x6f42('0x9b')](_0x20fb13,_0x6f42('0x12d')));this['callProgressDetectingAgent'](_0x1e8971,_0x103221,_0x3b72bd);}else{_0x20fb13[_0x6f42('0x83')]=moment()[_0x6f42('0x52')](_0x6f42('0x84'));ut[_0x6f42('0xe4')](_0x1e8971,0x4,'Answer');rpcDb['createAgentHistory'](_0x1e8971,_0x6f42('0x12e'));}}};Preview[_0x6f42('0x10')]['syncHangup']=function(_0x2490bd){var _0x3ed522=this;var _0x34e89d=this[_0x6f42('0x17')][_0x2490bd['linkedid']];var _0x27e2af;if(_0x34e89d){_0x27e2af=this[_0x6f42('0x14')][_0x34e89d[_0x6f42('0x6b')]];logger[_0x6f42('0x68')](_0x6f42('0x12f'),_0x2490bd[_0x6f42('0xb7')],_0x6f42('0xa8'),_0x27e2af['name'],_0x6f42('0x130'),_0x27e2af[_0x6f42('0x2c')]);}if(this[_0x6f42('0x17')][_0x2490bd[_0x6f42('0xb7')]]&&_0x2490bd[_0x6f42('0xb7')]!==_0x2490bd[_0x6f42('0xa7')]){if(_0x2490bd[_0x6f42('0x131')]==='16'&&this[_0x6f42('0x17')][_0x2490bd[_0x6f42('0xb7')]][_0x6f42('0x6d')]){this[_0x6f42('0x132')](_0x2490bd,_0x2490bd[_0x6f42('0xb7')],_0x2490bd['cause']);}else if(this[_0x6f42('0x17')][_0x2490bd[_0x6f42('0xb7')]][_0x6f42('0x6d')]){logger[_0x6f42('0x68')](_0x6f42('0x133'),_0x2490bd[_0x6f42('0xb7')],_0x2490bd[_0x6f42('0x131')],_0x6f42('0xa8'),_0x27e2af[_0x6f42('0x28')],_0x6f42('0x130'),_0x27e2af['pTalking']);this[_0x6f42('0x132')](_0x2490bd,_0x2490bd['linkedid'],_0x2490bd['cause']);}}else if(_0x34e89d&&_[_0x6f42('0x67')](_0x34e89d[_0x6f42('0x134')])&&_0x27e2af['dialQueueProject']&&_0x2490bd[_0x6f42('0xb7')]===_0x2490bd[_0x6f42('0xa7')]&&_[_0x6f42('0x67')](_0x2490bd['reason'])&&_0x2490bd['cause']==='16'&&_0x2490bd[_0x6f42('0x135')]==='6'&&_[_0x6f42('0xe1')](_0x34e89d['transfer'])){if(_0x34e89d['unlockAgent']){rpcDb['unlockContact'](_0x34e89d[_0x6f42('0xf6')]);}if(_0x34e89d[_0x6f42('0xc1')]){rpcDb[_0x6f42('0x82')](_0x34e89d[_0x6f42('0xf6')]);}_0x2490bd[_0x6f42('0xe3')]='22';this[_0x6f42('0xe0')](_0x34e89d,_0x27e2af,_0x2490bd);}else if(_0x34e89d&&_0x34e89d[_0x6f42('0x136')]){if(_0x2490bd[_0x6f42('0x131')]==='16'&&this[_0x6f42('0x17')][_0x2490bd[_0x6f42('0xb7')]]['dialAnswer']){logger[_0x6f42('0x68')](_0x6f42('0x137'),_0x2490bd[_0x6f42('0xb7')],_0x2490bd['cause'],_0x6f42('0xa8'),_0x27e2af['name'],_0x6f42('0x130'),_0x27e2af['pTalking']);this['callProgressDetectingCustomer'](_0x2490bd,_0x2490bd[_0x6f42('0xb7')],_0x2490bd[_0x6f42('0x131')]);}else if(this[_0x6f42('0x17')][_0x2490bd[_0x6f42('0xb7')]]['dialAnswer']){logger[_0x6f42('0x68')](_0x6f42('0x133'),_0x2490bd[_0x6f42('0xb7')],_0x2490bd[_0x6f42('0x131')],_0x6f42('0xa8'),_0x27e2af[_0x6f42('0x28')],'pTalking:\x20',_0x27e2af[_0x6f42('0x2c')]);this[_0x6f42('0x132')](_0x2490bd,_0x2490bd[_0x6f42('0xb7')],_0x2490bd[_0x6f42('0x131')]);}}};Preview['prototype'][_0x6f42('0x20')]=function(_0x2587c0){if(this['actions'][_0x2587c0['destlinkedid']]&&_0x2587c0[_0x6f42('0xdf')]!==_0x2587c0['destuniqueid']){this['callProgressDetectingCustomer'](_0x2587c0,_0x2587c0['destlinkedid'],_0x2587c0['dialstatus']);}};Preview[_0x6f42('0x10')][_0x6f42('0x1e')]=function(_0x8336d){if(this[_0x6f42('0x17')][_0x8336d[_0x6f42('0xb7')]]&&_0x8336d[_0x6f42('0xb7')]!==_0x8336d['uniqueid']&&!this[_0x6f42('0x17')][_0x8336d[_0x6f42('0xb7')]][_0x6f42('0x6d')]){if(_0x8336d['cause']==='1'){this[_0x6f42('0x132')](_0x8336d,_0x8336d['linkedid'],_0x8336d[_0x6f42('0x131')]);}}};Preview[_0x6f42('0x10')][_0x6f42('0x138')]=function(_0x1daa59,_0x1d4d0a,_0x16c32d){if(this['actions'][_0x1daa59]){if(_['isNil'](this['actions'][_0x1daa59][_0x6f42('0x139')])){this['actions'][_0x1daa59][_0x6f42('0x139')]={};}this[_0x6f42('0x17')][_0x1daa59][_0x6f42('0x139')][_0x1d4d0a]=_0x16c32d;}};Preview[_0x6f42('0x10')][_0x6f42('0x23')]=function(_0xca0caf){try{if(!_[_0x6f42('0x67')](_0xca0caf)){if(ut['filterKey'](_[_0x6f42('0x13a')](_0xca0caf['variable'])[0x0])){this[_0x6f42('0x138')](_0xca0caf[_0x6f42('0xa7')],_['keys'](_0xca0caf[_0x6f42('0x13b')])[0x0],_0xca0caf[_0x6f42('0x13c')]);}}}catch(_0x1d55dc){logger['error'](_0x6f42('0x13d'),util[_0x6f42('0x13e')](_0x1d55dc,{'showHidden':![],'depth':null}));}};Preview[_0x6f42('0x10')][_0x6f42('0x25')]=function(_0x5e6240){if(_0x5e6240){if(this[_0x6f42('0x17')][_0x5e6240[_0x6f42('0x13f')]]){this[_0x6f42('0x17')][_0x5e6240[_0x6f42('0x13f')]][_0x6f42('0x136')]=!![];}}};Preview[_0x6f42('0x10')][_0x6f42('0x140')]=function(_0x4f26b8){if(_0x4f26b8){if(this[_0x6f42('0x17')][_0x4f26b8['transfererlinkedid']]){this[_0x6f42('0x17')][_0x4f26b8[_0x6f42('0x141')]]['transfer']=!![];}}};module[_0x6f42('0x142')]=Preview; \ No newline at end of file +var _0xa6d4=['outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','lookAgent','logLookAgent','clone','isFailure','custom:agentringnoanswer','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','localhost','socket.io-emitter','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','bind','hangup','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','type','outbound','name','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','clearZombieChannels','setMessage','recallMe','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','run','then','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa6d4,0x1dd));var _0x4a6d=function(_0x118eee,_0x4eef8e){_0x118eee=_0x118eee-0x0;var _0x421d5c=_0xa6d4[_0x118eee];return _0x421d5c;};'use strict';var util=require('util');var _=require(_0x4a6d('0x0'));var BPromise=require(_0x4a6d('0x1'));var uuid=require(_0x4a6d('0x2'));var moment=require(_0x4a6d('0x3'));var md5=require(_0x4a6d('0x4'));var Redis=require(_0x4a6d('0x5'));var config=require(_0x4a6d('0x6'));var logger=require(_0x4a6d('0x7'))(_0x4a6d('0x8'));var loggerAction=require(_0x4a6d('0x7'))(_0x4a6d('0x9'));var ami=require('../ami');var rpcDb=require(_0x4a6d('0xa'));var Action=require(_0x4a6d('0xb'));var ut=require('./util/util');config['redis']=_['defaults'](config['redis'],{'host':_0x4a6d('0xc'),'port':0x18eb});var io=require(_0x4a6d('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x4a6d('0xe')]['enqueue']=function(_0x55af69){this[_0x4a6d('0xf')]=this[_0x4a6d('0xf')]?this['tail'][_0x4a6d('0x10')](_0x55af69):_0x55af69();};function Preview(_0x564820){this[_0x4a6d('0x11')]=new Sequence();this['campaignsPreview']=_0x564820[_0x4a6d('0x12')];this['trunks']=_0x564820[_0x4a6d('0x13')];this[_0x4a6d('0x14')]={};this[_0x4a6d('0x15')]=_0x564820[_0x4a6d('0x15')];this[_0x4a6d('0x16')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x4a6d('0x17')](this));ami['on'](_0x4a6d('0x18'),this['syncHangup'][_0x4a6d('0x17')](this));ami['on'](_0x4a6d('0x19'),this[_0x4a6d('0x1a')][_0x4a6d('0x17')](this));ami['on']('dialend',this[_0x4a6d('0x1b')][_0x4a6d('0x17')](this));ami['on']('newexten',this[_0x4a6d('0x1c')]['bind'](this));ami['on'](_0x4a6d('0x1d'),this[_0x4a6d('0x1e')][_0x4a6d('0x17')](this));ami['on']('attendedtransfer',this[_0x4a6d('0x1f')][_0x4a6d('0x17')](this));ami['on'](_0x4a6d('0x20'),this[_0x4a6d('0x21')][_0x4a6d('0x17')](this));this[_0x4a6d('0x22')](this[_0x4a6d('0x23')]);}function emit(_0x363c30,_0x1f6449,_0x25e154){io['to'](_0x363c30)['emit'](_0x1f6449,_0x25e154);}function emitCampaignPreview(_0x328fcc){if(_0x328fcc[_0x4a6d('0x24')]===_0x4a6d('0x25')){var _0x2332cb={'id':_0x328fcc['id'],'name':_0x328fcc[_0x4a6d('0x26')],'strategy':_0x328fcc['strategy'],'answered':_0x328fcc['answered'],'available':_0x328fcc[_0x4a6d('0x27')],'loggedIn':_0x328fcc[_0x4a6d('0x28')],'pTalking':_0x328fcc[_0x4a6d('0x29')],'sumBillable':_0x328fcc[_0x4a6d('0x2a')],'sumDuration':_0x328fcc[_0x4a6d('0x2b')],'sumHoldTime':_0x328fcc[_0x4a6d('0x2c')]||0x0,'talking':_0x328fcc[_0x4a6d('0x2d')],'total':_0x328fcc[_0x4a6d('0x2e')],'type':_0x328fcc['type'],'unmanaged':_0x328fcc['unmanaged'],'abandoned':_0x328fcc[_0x4a6d('0x2f')],'waiting':_0x328fcc['waiting'],'loggedInDb':_0x328fcc[_0x4a6d('0x30')],'dialActive':_0x328fcc[_0x4a6d('0x31')],'dialMethod':_0x328fcc['dialMethod'],'dialOriginateCallerIdName':_0x328fcc[_0x4a6d('0x32')],'dialOriginateCallerIdNumber':_0x328fcc[_0x4a6d('0x33')],'dialOriginateTimeout':_0x328fcc['dialOriginateTimeout'],'dialPrefix':_0x328fcc[_0x4a6d('0x34')],'outboundAnswerAgiCallsDay':_0x328fcc[_0x4a6d('0x35')],'outboundAnswerCallsDay':_0x328fcc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x328fcc[_0x4a6d('0x36')],'outboundBusyCallsDay':_0x328fcc['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x328fcc[_0x4a6d('0x37')],'outboundDropCallsDayACS':_0x328fcc[_0x4a6d('0x38')],'outboundDropCallsDayCallersExit':_0x328fcc['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x328fcc[_0x4a6d('0x39')],'outboundNoAnswerCallsDay':_0x328fcc['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x328fcc[_0x4a6d('0x3a')],'outboundOriginateFailureCallsDay':_0x328fcc['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x328fcc[_0x4a6d('0x3b')],'outboundRejectCallsDay':_0x328fcc[_0x4a6d('0x3c')],'outboundUnknownCallsDay':_0x328fcc[_0x4a6d('0x3d')],'outboundAbandonedCallsDay':_0x328fcc[_0x4a6d('0x3e')],'predictiveIntervalAnsweredCalls':_0x328fcc['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x328fcc[_0x4a6d('0x3f')],'predictiveIntervalAvgTalktime':_0x328fcc[_0x4a6d('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x328fcc['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x328fcc[_0x4a6d('0x41')],'predictiveIntervalErlangCalls':_0x328fcc[_0x4a6d('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x328fcc[_0x4a6d('0x43')],'predictiveIntervalHitRate':_0x328fcc['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x328fcc[_0x4a6d('0x44')],'predictiveIntervalPauses':_0x328fcc[_0x4a6d('0x45')],'predictiveIntervalAvailable':_0x328fcc[_0x4a6d('0x46')],'predictiveIntervalTotalCalls':_0x328fcc[_0x4a6d('0x47')],'message':_0x328fcc[_0x4a6d('0x48')],'originated':_0x328fcc['originated'],'erlangCalls':_0x328fcc[_0x4a6d('0x49')],'erlangCallToSecond':_0x328fcc[_0x4a6d('0x4a')],'erlangAbandonmentRate':_0x328fcc[_0x4a6d('0x4b')],'erlangBusyFactor':_0x328fcc[_0x4a6d('0x4c')],'startPredictive':_0x328fcc[_0x4a6d('0x4d')],'startProgressive':_0x328fcc['startProgressive']};if(_0x328fcc[_0x4a6d('0x4e')]){_0x2332cb[_0x4a6d('0x4e')]={'id':_0x328fcc[_0x4a6d('0x4e')]['id'],'name':_0x328fcc[_0x4a6d('0x4e')][_0x4a6d('0x26')],'active':_0x328fcc[_0x4a6d('0x4e')][_0x4a6d('0x4f')],'callerid':_0x328fcc['Trunk'][_0x4a6d('0x50')]};}if(_0x328fcc[_0x4a6d('0x51')]){_0x2332cb['Interval']={'id':_0x328fcc[_0x4a6d('0x51')]['id'],'name':_0x328fcc[_0x4a6d('0x51')][_0x4a6d('0x26')]};}var _0x49c195=md5(JSON[_0x4a6d('0x52')](_0x2332cb));if(_0x328fcc[_0x4a6d('0x4')]!==_0x49c195){_0x328fcc['md5']=_0x49c195;emit(util[_0x4a6d('0x53')](_0x4a6d('0x54'),_0x2332cb[_0x4a6d('0x26')]),_0x4a6d('0x55'),_0x2332cb);}}}function emitVoiceQueueChannelRemove(_0x2bb2e0){logger[_0x4a6d('0x56')](_0x4a6d('0x57'),JSON[_0x4a6d('0x52')](_0x2bb2e0));emit(util[_0x4a6d('0x53')](_0x4a6d('0x54'),_0x2bb2e0['name']),_0x4a6d('0x58'),_0x2bb2e0);}function notSendMessagesQueue(_0x483256){if(_0x483256[_0x4a6d('0x59')]){if(_0x483256[_0x4a6d('0x5a')]===0x0&&_0x483256[_0x4a6d('0x29')]===0x0){_0x483256[_0x4a6d('0x59')]=![];_0x483256[_0x4a6d('0x27')]=0x0;_0x483256[_0x4a6d('0x5b')]=0x0;_0x483256[_0x4a6d('0x48')]=_0x4a6d('0x5c');ut[_0x4a6d('0x5d')](_0x4a6d('0x5e'),_0x483256['name']+'\x20is\x20not\x20active');}else{_0x483256['message']=_0x4a6d('0x5f');ut[_0x4a6d('0x5d')](_0x4a6d('0x5e'),_0x483256[_0x4a6d('0x26')]+_0x4a6d('0x60'));}emitCampaignPreview(_0x483256);}}Preview[_0x4a6d('0xe')][_0x4a6d('0x22')]=function(){var _0x26209e=this;setInterval(function(){_0x26209e[_0x4a6d('0x61')]();},0x7cf);};Preview[_0x4a6d('0xe')][_0x4a6d('0x61')]=function(){var _0x235ea9=this[_0x4a6d('0x23')];this[_0x4a6d('0x16')]+=0x1;for(var _0x24be4c in _0x235ea9){if(_0x235ea9[_0x4a6d('0x62')](_0x24be4c)&&(_0x235ea9[_0x24be4c][_0x4a6d('0x63')]===_0x4a6d('0x8')||_0x235ea9[_0x24be4c][_0x4a6d('0x63')]==='booked')&&_0x235ea9[_0x24be4c][_0x4a6d('0x24')]===_0x4a6d('0x25')){if(this['clockClearZombieChannels']>0x7){this[_0x4a6d('0x16')]=0x0;this[_0x4a6d('0x64')]();}}if(_0x235ea9['hasOwnProperty'](_0x24be4c)&&_0x235ea9[_0x24be4c][_0x4a6d('0x63')]===_0x4a6d('0x8')&&_0x235ea9[_0x24be4c][_0x4a6d('0x24')]===_0x4a6d('0x25')){if(_0x235ea9[_0x24be4c][_0x4a6d('0x31')]){this[_0x4a6d('0x65')](_0x235ea9[_0x24be4c]);this[_0x4a6d('0x66')](_0x235ea9[_0x24be4c]);}else{notSendMessagesQueue(_0x235ea9[_0x24be4c]);}}}};Preview[_0x4a6d('0xe')]['clearZombieChannel']=function(_0xb49f6d){var _0x718042=this;this[_0x4a6d('0x11')]['enqueue'](function(){if(!_['isNil'](_0x718042['actions'][_0xb49f6d])){loggerAction['info'](_0x4a6d('0x67'),_0xb49f6d,_0x4a6d('0x68'),_0x718042[_0x4a6d('0x14')][_0xb49f6d][_0x4a6d('0x69')],_0x4a6d('0x6a'),JSON['stringify'](_0x718042['campaignsPreview'][_0x718042[_0x4a6d('0x14')][_0xb49f6d][_0x4a6d('0x69')]][_0x4a6d('0x5a')]),_0x4a6d('0x6b'),JSON[_0x4a6d('0x52')](_0x718042[_0x4a6d('0x23')][_0x718042[_0x4a6d('0x14')][_0xb49f6d][_0x4a6d('0x69')]]['pTalking']),JSON['stringify'](_0x718042['actions'][_0xb49f6d][_0x4a6d('0x6c')]),JSON[_0x4a6d('0x52')](_[_0x4a6d('0x6d')](_0x718042['actions'][_0xb49f6d],[_0x4a6d('0x6e'),'UserId','VoiceQueueId',_0x4a6d('0x6f')])));return ami[_0x4a6d('0x70')]({'action':_0x4a6d('0x71'),'channel':_0x718042[_0x4a6d('0x14')][_0xb49f6d][_0x4a6d('0x72')]})['catch'](function(_0x4a32e2){if(_0x4a32e2[_0x4a6d('0x48')]===_0x4a6d('0x73')){setTimeout(function(){if(_0x718042['actions'][_0xb49f6d]){ut[_0x4a6d('0x74')](_0x718042['campaignsPreview'][_0x718042['actions'][_0xb49f6d]['queue']],_0x4a6d('0x75'));if(_0x718042[_0x4a6d('0x14')][_0xb49f6d]['dialAnswer']===!![]){ut[_0x4a6d('0x76')](_0x718042[_0x4a6d('0x23')][_0x718042[_0x4a6d('0x14')][_0xb49f6d][_0x4a6d('0x69')]],_0x4a6d('0x75'));ut[_0x4a6d('0x77')](_0x4a6d('0x78')+_0xb49f6d,_0x718042[_0x4a6d('0x14')][_0xb49f6d][_0x4a6d('0x69')]);}ut[_0x4a6d('0x77')](_0x4a6d('0x79')+_0xb49f6d,_0x718042[_0x4a6d('0x14')][_0xb49f6d]['queue']);delete _0x718042[_0x4a6d('0x14')][_0xb49f6d];}},0x2328);}});}});};Preview[_0x4a6d('0xe')][_0x4a6d('0x64')]=function(){var _0x1ed4ae=this;loggerAction[_0x4a6d('0x56')](_0x4a6d('0x7a'),_[_0x4a6d('0x7b')](this[_0x4a6d('0x14')]));for(var _0x2f1ee9 in this[_0x4a6d('0x14')]){if(_0x1ed4ae[_0x4a6d('0x14')]['hasOwnProperty'](_0x2f1ee9)){_0x1ed4ae[_0x4a6d('0x7c')](_0x2f1ee9);}}};Preview['prototype'][_0x4a6d('0x66')]=function(_0x425a3b){var _0x201ff0=this;rpcDb[_0x4a6d('0x7d')](_0x425a3b['id'],ut[_0x4a6d('0x7e')](this['agents']))['then'](function(_0x27b2c9){if(!_[_0x4a6d('0x7f')](_0x27b2c9)){for(var _0x55da07=0x0;_0x55da07<_0x27b2c9[_0x4a6d('0x80')];_0x55da07+=0x1){if(ut[_0x4a6d('0x81')](_0x27b2c9[_0x55da07][_0x4a6d('0x82')])<_0x425a3b[_0x4a6d('0x83')]*0x3c){if(_0x27b2c9[_0x55da07][_0x4a6d('0x84')]&&!_0x27b2c9[_0x55da07]['Agent']['voicePause']){_0x201ff0[_0x4a6d('0x85')](_0x27b2c9[_0x55da07]['id'])[_0x4a6d('0x86')](ut['logger2'](_0x4a6d('0x87')))[_0x4a6d('0x88')](ut[_0x4a6d('0x89')](_0x4a6d('0x87')));}else{rpcDb[_0x4a6d('0x8a')](_0x27b2c9[_0x55da07]['id']);}}else{var _0x4f681c=new Action(_0x27b2c9[_0x55da07],_0x425a3b);_0x4f681c[_0x4a6d('0x8b')]=moment()[_0x4a6d('0x53')](_0x4a6d('0x8c'));_0x425a3b[_0x4a6d('0x3b')]+=0x1;ut[_0x4a6d('0x8d')](_0x4f681c,0x17,_0x4a6d('0x8e'));if(_0x425a3b[_0x4a6d('0x8f')]){rpcDb[_0x4a6d('0x90')](ut['createBody'](_0x27b2c9[_0x55da07]));rpcDb[_0x4a6d('0x91')](_0x4f681c,_0x4a6d('0x92'));}else{ut['logCustomer'](_0x4f681c,0x16,_0x4a6d('0x93'));rpcDb[_0x4a6d('0x91')](_0x4f681c,'[HistoryRecallClose]');rpcDb[_0x4a6d('0x94')](_0x4f681c,_0x4a6d('0x95'));}}}}})[_0x4a6d('0x88')](ut[_0x4a6d('0x89')]('[getContactRecallMe]'));};Preview['prototype'][_0x4a6d('0x65')]=function(_0x43a9db){_0x43a9db[_0x4a6d('0x59')]=!![];if(ut[_0x4a6d('0x96')](_0x43a9db[_0x4a6d('0x28')])){_0x43a9db['message']=_0x4a6d('0x97');}else if(!ut[_0x4a6d('0x98')](_0x43a9db[_0x4a6d('0x31')])){_0x43a9db[_0x4a6d('0x48')]='NOT_ACTIVE';}else if(!this[_0x4a6d('0x99')](_0x43a9db[_0x4a6d('0x4e')])){if(!this['isTrunkReachable'](_0x43a9db[_0x4a6d('0x9a')])){_0x43a9db[_0x4a6d('0x48')]=_0x4a6d('0x9b');}else{_0x43a9db[_0x4a6d('0x48')]='ACTIVE';}}else{_0x43a9db[_0x4a6d('0x48')]=_0x4a6d('0x9c');}emitCampaignPreview(_0x43a9db);};Preview[_0x4a6d('0xe')][_0x4a6d('0x9d')]=function(_0x28b5e2,_0x187bfc,_0x5d1557){var _0x24cca6=this;var _0x28a66d=this[_0x4a6d('0x14')][_0x187bfc];var _0x584755=this[_0x4a6d('0x23')][_0x28a66d['queue']];var _0x2467bf;if(_0x584755){switch(_0x5d1557){case'1':_0x584755[_0x4a6d('0x3a')]+=0x1;_0x28a66d[_0x4a6d('0x9e')]+=0x1;_0x28a66d[_0x4a6d('0x9f')]=ut[_0x4a6d('0xa0')](_0x28a66d);ut[_0x4a6d('0x8d')](_0x28a66d,0x0,_0x4a6d('0xa1'));ami[_0x4a6d('0xa2')](_0x4a6d('0xa3'),ut['buildObj'](_0x28a66d,'nosuchnumber'));rpcDb[_0x4a6d('0x91')](_0x28a66d,_0x4a6d('0xa4'));if(ut['totalGlobal'](_0x28a66d)>=_0x584755[_0x4a6d('0xa5')]){_0x2467bf=ut[_0x4a6d('0xa6')](_0x28a66d,0xf,_0x4a6d('0xa7'));rpcDb[_0x4a6d('0x94')](_0x2467bf,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x28a66d[_0x4a6d('0x9e')]>=_0x584755[_0x4a6d('0xa8')]){rpcDb['createCustomerFinal'](_0x28a66d,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x4a6d('0xa9')](_0x28a66d,'countnosuchnumberretry',_0x584755[_0x4a6d('0xaa')]),_0x28a66d[_0x4a6d('0xab')],_0x28a66d[_0x4a6d('0xac')]);}}delete this[_0x4a6d('0x14')][_0x28b5e2[_0x4a6d('0xad')]];break;case'ANSWER':var _0x2bae37=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x28a66d[_0x4a6d('0xae')]=_0x2bae37;_0x28a66d['answertime']=_0x2bae37;_0x28a66d[_0x4a6d('0x6c')]=!![];_0x584755[_0x4a6d('0x29')]+=0x1;logger[_0x4a6d('0x56')](_0x4a6d('0xaf'),_0x28a66d['uniqueid'],_0x4a6d('0xb0'),_0x584755[_0x4a6d('0x26')],'pTalking:\x20',_0x584755[_0x4a6d('0x29')]);ami[_0x4a6d('0xa2')](_0x4a6d('0xb1'),ut['buildObj'](_0x28a66d,_0x4a6d('0xb2')));if(_0x584755[_0x4a6d('0xb3')]){ami[_0x4a6d('0xa2')](_0x4a6d('0xb4'),ut[_0x4a6d('0xb5')](_0x28a66d));}break;case'16':ami[_0x4a6d('0xa2')](_0x4a6d('0xb6'),ut[_0x4a6d('0xb7')](_0x28a66d,_0x4a6d('0xb8')));emitVoiceQueueChannelRemove(ut[_0x4a6d('0xb7')](_0x28a66d,'complete'));_0x584755[_0x4a6d('0xb9')]+=0x1;_0x584755[_0x4a6d('0x2e')]+=0x1;_0x584755[_0x4a6d('0xba')]+=0x1;ut['decrementTalkink'](_0x584755,_0x4a6d('0xbb'));_0x28a66d[_0x4a6d('0x9f')]=ut[_0x4a6d('0xa0')](_0x28a66d);ut['logCustomer'](_0x28a66d,0x4,'Answer');rpcDb['createCustomerHistory'](_0x28a66d,_0x4a6d('0xbc'));rpcDb[_0x4a6d('0x94')](_0x28a66d,_0x4a6d('0xbd'));rpcDb[_0x4a6d('0xbe')](_0x28a66d);_0x584755['sumDuration']+=_0x28a66d['talktime'];_0x584755[_0x4a6d('0x2a')]+=_0x28a66d[_0x4a6d('0xbf')];logger[_0x4a6d('0x56')](_0x4a6d('0xc0'),_0x28a66d[_0x4a6d('0xc1')],_0x4a6d('0xb0'),_0x584755[_0x4a6d('0x26')],_0x4a6d('0x6b'),_0x584755[_0x4a6d('0x29')]);delete this[_0x4a6d('0x14')][_0x28b5e2[_0x4a6d('0xad')]];break;case'BUSY':_0x584755[_0x4a6d('0xc2')]+=0x1;_0x28a66d[_0x4a6d('0xc3')]+=0x1;_0x28a66d[_0x4a6d('0x9f')]=ut[_0x4a6d('0xa0')](_0x28a66d);ut[_0x4a6d('0x8d')](_0x28a66d,0x5,_0x4a6d('0xc4'));ami[_0x4a6d('0xa2')](_0x4a6d('0xc5'),ut['buildObj'](_0x28a66d,'busy'));rpcDb[_0x4a6d('0x91')](_0x28a66d,_0x4a6d('0xc6'));if(ut['totalGlobal'](_0x28a66d)>=_0x584755[_0x4a6d('0xa5')]){_0x2467bf=ut[_0x4a6d('0xa6')](_0x28a66d,0xf,_0x4a6d('0xa7'));rpcDb[_0x4a6d('0x94')](_0x2467bf,_0x4a6d('0xc7'));}else{if(_0x28a66d['countbusyretry']>=_0x584755['dialBusyMaxRetry']){rpcDb[_0x4a6d('0x94')](_0x28a66d,_0x4a6d('0xc6'));}else{rpcDb[_0x4a6d('0xc8')](ut[_0x4a6d('0xa9')](_0x28a66d,'countbusyretry',_0x584755['dialBusyRetryFrequency']),_0x28a66d[_0x4a6d('0xab')],_0x28a66d[_0x4a6d('0xac')]);}}break;case _0x4a6d('0xc9'):_0x584755['outboundNoAnswerCallsDay']+=0x1;_0x28a66d['countnoanswerretry']+=0x1;_0x28a66d[_0x4a6d('0x9f')]=ut[_0x4a6d('0xa0')](_0x28a66d);ut[_0x4a6d('0x8d')](_0x28a66d,0x3,'NoAnswer');ami[_0x4a6d('0xa2')](_0x4a6d('0xca'),ut[_0x4a6d('0xb7')](_0x28a66d,_0x4a6d('0xcb')));rpcDb[_0x4a6d('0x91')](_0x28a66d,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x28a66d)>=_0x584755[_0x4a6d('0xa5')]){_0x2467bf=ut[_0x4a6d('0xa6')](_0x28a66d,0xf,_0x4a6d('0xa7'));rpcDb[_0x4a6d('0x94')](_0x2467bf,_0x4a6d('0xcc'));}else{if(_0x28a66d[_0x4a6d('0xcd')]>=_0x584755[_0x4a6d('0xce')]){rpcDb[_0x4a6d('0x94')](_0x28a66d,_0x4a6d('0xcf'));}else{rpcDb[_0x4a6d('0xc8')](ut['scheduledAt'](_0x28a66d,_0x4a6d('0xcd'),_0x584755[_0x4a6d('0xd0')]),_0x28a66d[_0x4a6d('0xab')],_0x28a66d[_0x4a6d('0xac')]);}}break;case'CONGESTION':_0x584755[_0x4a6d('0x37')]+=0x1;_0x28a66d[_0x4a6d('0xd1')]+=0x1;_0x28a66d[_0x4a6d('0x9f')]=ut['totalGlobal'](_0x28a66d);ut[_0x4a6d('0x8d')](_0x28a66d,0x8,_0x4a6d('0xd2'));rpcDb[_0x4a6d('0x91')](_0x28a66d,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x4a6d('0xa0')](_0x28a66d)>=_0x584755['dialGlobalMaxRetry']){_0x2467bf=ut['cloneAction'](_0x28a66d,0xf,_0x4a6d('0xa7'));rpcDb[_0x4a6d('0x94')](_0x2467bf,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x28a66d[_0x4a6d('0xd1')]>=_0x584755[_0x4a6d('0xd3')]){rpcDb['createCustomerFinal'](_0x28a66d,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x4a6d('0xa9')](_0x28a66d,_0x4a6d('0xd1'),_0x584755['dialBusyRetryFrequency']),_0x28a66d['unlockAgent'],_0x28a66d[_0x4a6d('0xac')]);}}break;case _0x4a6d('0xd4'):_0x584755[_0x4a6d('0x3c')]+=0x1;_0x28a66d[_0x4a6d('0xd5')]+=0x1;_0x28a66d[_0x4a6d('0x9f')]=ut[_0x4a6d('0xa0')](_0x28a66d);ut['logCustomer'](_0x28a66d,0x14,_0x4a6d('0xd6'));rpcDb['createCustomerHistory'](_0x28a66d,_0x4a6d('0xd7'));if(ut['totalGlobal'](_0x28a66d)>=_0x584755['dialGlobalMaxRetry']){_0x2467bf=ut[_0x4a6d('0xa6')](_0x28a66d,0x14,_0x4a6d('0xd6'));rpcDb['createCustomerFinal'](_0x2467bf,_0x4a6d('0xd8'));}else{if(_0x28a66d[_0x4a6d('0xd5')]>=_0x584755['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x28a66d,_0x4a6d('0xd8'));}else{rpcDb[_0x4a6d('0xc8')](ut[_0x4a6d('0xa9')](_0x28a66d,_0x4a6d('0xd5'),_0x584755[_0x4a6d('0xd9')]),_0x28a66d[_0x4a6d('0xab')],_0x28a66d[_0x4a6d('0xac')]);}}break;case _0x4a6d('0xda'):_0x584755[_0x4a6d('0x3e')]+=0x1;_0x28a66d[_0x4a6d('0xdb')]+=0x1;_0x28a66d[_0x4a6d('0x9f')]=ut['totalGlobal'](_0x28a66d);ut[_0x4a6d('0x8d')](_0x28a66d,0xb,_0x4a6d('0xdc'));rpcDb[_0x4a6d('0x91')](_0x28a66d,_0x4a6d('0xdd'));if(ut[_0x4a6d('0xa0')](_0x28a66d)>=_0x584755[_0x4a6d('0xa5')]){_0x2467bf=ut[_0x4a6d('0xa6')](_0x28a66d,0xf,_0x4a6d('0xa7'));rpcDb['createCustomerFinal'](_0x2467bf,_0x4a6d('0xdd'));}else{if(_0x28a66d[_0x4a6d('0xde')]>=_0x584755[_0x4a6d('0xdf')]){rpcDb[_0x4a6d('0x94')](_0x28a66d,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x4a6d('0xc8')](ut['scheduledAt'](_0x28a66d,_0x4a6d('0xdb'),_0x584755['dialAbandonedRetryFrequency']),_0x28a66d[_0x4a6d('0xab')],_0x28a66d[_0x4a6d('0xac')]);}}break;default:if(_0x28a66d[_0x4a6d('0x6c')]){ut[_0x4a6d('0x76')](_0x584755,'[default]');ut[_0x4a6d('0x77')](_0x4a6d('0xe0')+_0x584755[_0x4a6d('0x26')],_0x28b5e2);}_0x584755[_0x4a6d('0x3d')]+=0x1;_0x28a66d[_0x4a6d('0x9f')]=ut[_0x4a6d('0xa0')](_0x28a66d);ut[_0x4a6d('0x8d')](_0x28a66d,0xc,_0x28b5e2[_0x4a6d('0xe1')]||_0x28b5e2[_0x4a6d('0xe2')]);rpcDb[_0x4a6d('0x91')](_0x28a66d,_0x4a6d('0xe3'));if(ut['totalGlobal'](_0x28a66d)>=_0x584755[_0x4a6d('0xa5')]){_0x2467bf=ut[_0x4a6d('0xa6')](_0x28a66d,0xf,_0x4a6d('0xa7'));rpcDb[_0x4a6d('0x94')](_0x2467bf,_0x4a6d('0xe4'));}else{rpcDb['createCustomerFinal'](_0x28a66d,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x4a6d('0x14')][_0x28b5e2[_0x4a6d('0xad')]];}if(!(_0x28a66d[_0x4a6d('0x6c')]&&_0x5d1557==='16')){ut[_0x4a6d('0x74')](_0x584755,_0x4a6d('0xe5'));logger[_0x4a6d('0x56')](_0x4a6d('0xe6'),_0x28a66d[_0x4a6d('0xc1')],'\x20Queue',_0x584755[_0x4a6d('0x26')],'originated:\x20',_0x584755[_0x4a6d('0x5a')]);}if(_0x5d1557!==_0x4a6d('0xe7')){delete this[_0x4a6d('0x14')][_0x28b5e2[_0x4a6d('0xad')]];delete this[_0x4a6d('0x14')][_0x28b5e2[_0x4a6d('0xe8')]];}}};Preview[_0x4a6d('0xe')][_0x4a6d('0xe9')]=function(_0x1e9ebb,_0x31323b,_0x5ea7e4){if(_[_0x4a6d('0xea')](_0x31323b)&&_0x4a6d('0xeb')!==typeof _0x31323b){return;}if(_[_0x4a6d('0xea')](_0x5ea7e4)&&_0x4a6d('0xeb')!==typeof _0x5ea7e4){return;}switch(_0x5ea7e4[_0x4a6d('0xec')]){case'0':ut[_0x4a6d('0xed')](_0x1e9ebb,0x0,_0x4a6d('0xa1'));rpcDb[_0x4a6d('0xee')](_0x1e9ebb,_0x4a6d('0xef'));break;case'3':ut[_0x4a6d('0xed')](_0x1e9ebb,0x3,'NoAnswer');rpcDb[_0x4a6d('0xee')](_0x1e9ebb,_0x4a6d('0xf0'));break;case'5':ut[_0x4a6d('0xed')](_0x1e9ebb,0x5,_0x4a6d('0xc4'));rpcDb['createAgentHistory'](_0x1e9ebb,_0x4a6d('0xf1'));break;case'8':ut['logAgent'](_0x1e9ebb,0x8,'Congestion');rpcDb['createAgentHistory'](_0x1e9ebb,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x1e9ebb,0x16,_0x4a6d('0xf2'));rpcDb[_0x4a6d('0xee')](_0x1e9ebb,_0x4a6d('0xf3'));break;default:ut['logAgent'](_0x1e9ebb,0xc,_0x5ea7e4[_0x4a6d('0xec')]);rpcDb[_0x4a6d('0xee')](_0x1e9ebb,_0x4a6d('0xf4'));}ut['updateOriginated'](_0x31323b,_0x4a6d('0xf5'));logger[_0x4a6d('0x56')](_0x4a6d('0xf6'),_0x1e9ebb[_0x4a6d('0xc1')],_0x4a6d('0xb0'),_0x31323b['name'],_0x4a6d('0x6a'),_0x31323b[_0x4a6d('0x5a')]);delete this['actions'][_0x1e9ebb[_0x4a6d('0xc1')]];};Preview[_0x4a6d('0xe')][_0x4a6d('0xf7')]=function(_0x9faf79,_0x226714,_0x199dcd,_0x1698dd,_0x4a6b30){var _0x15bdd5=this;return new BPromise(function(_0x309c18,_0x490edc){if(_[_0x4a6d('0x7f')](_0x226714)||_[_0x4a6d('0x7f')](_0x226714[_0x4a6d('0xf8')])||_[_0x4a6d('0x7f')](_0x226714[_0x4a6d('0xf8')][_0x4a6d('0xf9')])||_['isNil'](_0x226714[_0x4a6d('0xfa')])){_0x490edc(ut[_0x4a6d('0x48')](_0x4a6d('0xfb'),_0x1698dd,_0x4a6b30));return;}var _0x271d5f=uuid['v4']();var _0x33786f=_0x15bdd5[_0x4a6d('0x23')][_0x226714[_0x4a6d('0x68')][_0x4a6d('0x26')]];var _0x14a349=_0x199dcd?_0x15bdd5['agents'][_0x199dcd]['id']:undefined;_0x15bdd5['actions'][_0x271d5f]=new Action(_0x226714,_0x33786f,_0x271d5f,_0x199dcd,_0x14a349);var _0x3cc574=_0x15bdd5['actions'][_0x271d5f];_0x3cc574[_0x4a6d('0xab')]=_0x1698dd;_0x3cc574['activeContact']=_0x4a6b30;_0x3cc574['lookAgent']=_0x199dcd;if(_[_0x4a6d('0xfc')](_0x9faf79)){_0x15bdd5[_0x4a6d('0xfd')](_0x3cc574,_0x33786f,_0x226714,_0x199dcd)['then'](function(_0x5e931b){logger[_0x4a6d('0x56')](_0x4a6d('0xfe'),_0x4a6d('0xff')+_0x3cc574[_0x4a6d('0x69')]+_0x4a6d('0x100')+_0x3cc574[_0x4a6d('0x101')],JSON[_0x4a6d('0x52')](_0x5e931b));ami[_0x4a6d('0xa2')](_0x4a6d('0x102'),ut['buildObj'](_0x3cc574,_0x4a6d('0x103')));_0x309c18(ut[_0x4a6d('0x48')](_0x4a6d('0x104')));})[_0x4a6d('0x88')](function(_0x128d05){ut['logger'](_0x4a6d('0x105'),_0x128d05);_0x490edc(ut[_0x4a6d('0x48')](_0x4a6d('0x106'),_0x1698dd,_0x4a6b30));});}else{_0x33786f[_0x4a6d('0x36')]+=0x1;ut['logBlacklist'](_0x3cc574);rpcDb[_0x4a6d('0x107')](_0x3cc574,'[Blacklist][error]');delete _0x15bdd5[_0x4a6d('0x14')][_0x271d5f];_0x490edc(ut['message'](_0x4a6d('0x108'),_0x1698dd,_0x4a6b30));}});};Preview[_0x4a6d('0xe')][_0x4a6d('0x99')]=function(_0x2c694f){return!_[_0x4a6d('0x7f')](_0x2c694f)&&!_[_0x4a6d('0x7f')](_0x2c694f[_0x4a6d('0x26')])&&!_[_0x4a6d('0x7f')](_0x2c694f[_0x4a6d('0x4f')])&&_0x2c694f[_0x4a6d('0x4f')]&&!_[_0x4a6d('0x7f')](this[_0x4a6d('0x13')][util[_0x4a6d('0x53')]('SIP/%s',_0x2c694f[_0x4a6d('0x26')])])&&!_[_0x4a6d('0x7f')](this[_0x4a6d('0x13')][util[_0x4a6d('0x53')](_0x4a6d('0x109'),_0x2c694f[_0x4a6d('0x26')])][_0x4a6d('0x71')])&&(this[_0x4a6d('0x13')][util[_0x4a6d('0x53')]('SIP/%s',_0x2c694f['name'])][_0x4a6d('0x71')]===_0x4a6d('0x10a')||this['trunks'][util[_0x4a6d('0x53')]('SIP/%s',_0x2c694f['name'])]['status']==='unmonitored');};Preview['prototype'][_0x4a6d('0x85')]=function(_0x355f4b,_0x383994){var _0x21960e=this;return new BPromise(function(_0x659002,_0x2b9568){_0x21960e[_0x4a6d('0x10b')](_0x355f4b,_0x383994)['then'](function(_0x3779e0){_0x659002(_[_0x4a6d('0x6d')](_0x3779e0,[_0x4a6d('0x48')]));})[_0x4a6d('0x88')](function(_0x3de3cf){if(_0x3de3cf[_0x4a6d('0x10c')]){rpcDb[_0x4a6d('0x10d')](_0x355f4b);}if(_0x3de3cf['active']){rpcDb['disableContact'](_0x355f4b);}_0x2b9568(_[_0x4a6d('0x6d')](_0x3de3cf,['message']));});});};Preview[_0x4a6d('0xe')][_0x4a6d('0x10b')]=function(_0x11a71e,_0x14ba41){var _0x3944ea=this;return new BPromise(function(_0x196bba,_0x2dcf4c){var _0x31e777,_0x9fbe82;rpcDb[_0x4a6d('0x10e')](_0x11a71e)['then'](function(_0x1cc800){if(!_['isNil'](_0x1cc800[0x0])){_0x9fbe82=_0x1cc800[0x0][_0x4a6d('0x10f')]?![]:!![];_0x31e777=_0x1cc800[0x0][_0x4a6d('0x10f')]?!![]:![];_0x31e777=_0x14ba41?!![]:_0x31e777;}var _0x5ee62a=_0x3944ea[_0x4a6d('0x110')](_0x1cc800);if(_0x5ee62a[_0x4a6d('0x111')]){rpcDb[_0x4a6d('0x112')](_[_0x4a6d('0x6d')](_0x1cc800[0x0],[_0x4a6d('0xfa'),'Contact.phone']))[_0x4a6d('0x86')](function(_0x1a027a){_0x3944ea[_0x4a6d('0xf7')](_0x1a027a,_0x1cc800[0x0],_0x14ba41,_0x9fbe82,_0x31e777)['then'](function(_0x1e938c){_0x196bba(_0x1e938c);})[_0x4a6d('0x88')](function(_0x2301e2){_0x2dcf4c(_0x2301e2);});})[_0x4a6d('0x88')](function(_0x4a8bd5){ut['logger'](_0x4a6d('0x113'),_0x4a8bd5);_0x2dcf4c(ut[_0x4a6d('0x48')](_0x4a6d('0x114'),_0x9fbe82,_0x31e777));});}else{_0x2dcf4c(ut[_0x4a6d('0x48')](_0x5ee62a[_0x4a6d('0x48')],_0x9fbe82,_0x31e777));}})['catch'](function(_0x59ddf1){ut[_0x4a6d('0x5d')](_0x4a6d('0x115'),_0x59ddf1);_0x2dcf4c(ut['message'](_0x4a6d('0x114'),![],!![]));});});};Preview[_0x4a6d('0xe')][_0x4a6d('0x110')]=function(_0xa8acd2){if(_[_0x4a6d('0x7f')](_0xa8acd2)||_[_0x4a6d('0xfc')](_0xa8acd2)||!_[_0x4a6d('0x7f')](_0xa8acd2[0x0][_0x4a6d('0x84')])&&_[_0x4a6d('0x7f')](_0xa8acd2[0x0][_0x4a6d('0x84')][_0x4a6d('0x26')])){ut[_0x4a6d('0x5d')](_0x4a6d('0x116'),_0xa8acd2);return{'isValid':![],'message':_0x4a6d('0x117')};}var _0x54c17b=this['campaignsPreview'][_0xa8acd2[0x0][_0x4a6d('0x68')][_0x4a6d('0x26')]];_0x54c17b['message']=_0x4a6d('0x9c');if(_[_0x4a6d('0x7f')](_0x54c17b)){ut[_0x4a6d('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x54c17b);return{'isValid':![],'message':_0x4a6d('0x118')};}if(!this[_0x4a6d('0x99')](_0x54c17b['Trunk'])){ut[_0x4a6d('0x5d')](_0x4a6d('0x119'),_0x4a6d('0x11a')+_0x54c17b[_0x4a6d('0x26')]+_0x4a6d('0x11b'));if(!this[_0x4a6d('0x99')](_0x54c17b[_0x4a6d('0x9a')])){ut[_0x4a6d('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x54c17b[_0x4a6d('0x26')]+_0x4a6d('0x11c'));return{'isValid':![],'message':_0x4a6d('0x11d')};}}if(!ut[_0x4a6d('0x98')](_0x54c17b[_0x4a6d('0x31')])){ut[_0x4a6d('0x5d')]('[Preview][validateContact][Campaign\x20Active]',_0x54c17b[_0x4a6d('0x26')]+_0x4a6d('0x11e'));return{'isValid':![],'message':_0x4a6d('0x11a')+_0x54c17b[_0x4a6d('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x4a6d('0x11f')};};Preview[_0x4a6d('0xe')]['execCall']=function(_0x5c46bf,_0x1e3811,_0x4ff4fb,_0x4273b8){var _0x3363d7=this;return new BPromise(function(_0x12e0d8,_0x1743ef){var _0x22d438=_0x5c46bf['uniqueid'];var _0x1b7359=_0x3363d7['isTrunkReachable'](_0x1e3811[_0x4a6d('0x4e')])?util[_0x4a6d('0x53')](_0x4a6d('0x120'),_0x1e3811['Trunk'][_0x4a6d('0x26')],_[_0x4a6d('0x7f')](_0x1e3811[_0x4a6d('0x34')])?'':_0x1e3811[_0x4a6d('0x34')][_0x4a6d('0x121')]()||'',_0x1e3811[_0x4a6d('0x122')]>0x0?_0x4ff4fb[_0x4a6d('0xf8')][_0x4a6d('0xf9')][_0x4a6d('0x123')](_0x1e3811[_0x4a6d('0x122')]):_0x4ff4fb[_0x4a6d('0xf8')][_0x4a6d('0xf9')]):util[_0x4a6d('0x53')]('SIP/%s/%s%s',_[_0x4a6d('0x7f')](_0x1e3811[_0x4a6d('0x9a')])?_0x1e3811[_0x4a6d('0x4e')]['name']:_0x1e3811['TrunkBackup'][_0x4a6d('0x26')],_[_0x4a6d('0x7f')](_0x1e3811[_0x4a6d('0x34')])?'':_0x1e3811[_0x4a6d('0x34')][_0x4a6d('0x121')]()||'',_0x1e3811[_0x4a6d('0x122')]>0x0?_0x4ff4fb['Contact']['phone']['substring'](_0x1e3811[_0x4a6d('0x122')]):_0x4ff4fb['Contact']['phone']);var _0x2aba7a=_0x3363d7[_0x4a6d('0x99')](_0x1e3811[_0x4a6d('0x4e')])?ut[_0x4a6d('0x124')](_0x1e3811[_0x4a6d('0x4e')][_0x4a6d('0x50')],_0x1e3811[_0x4a6d('0x32')],_0x1e3811[_0x4a6d('0x125')]>0x0?ut[_0x4a6d('0x126')](_0x1e3811[_0x4a6d('0x33')],_0x1e3811['dialRandomLastDigitCallerIdNumber']):_0x1e3811[_0x4a6d('0x33')]):ut[_0x4a6d('0x124')](_[_0x4a6d('0x7f')](_0x1e3811[_0x4a6d('0x9a')])?_0x1e3811[_0x4a6d('0x4e')]['callerid']:_0x1e3811['TrunkBackup'][_0x4a6d('0x50')],_0x1e3811[_0x4a6d('0x32')],_0x1e3811[_0x4a6d('0x125')]>0x0?ut[_0x4a6d('0x126')](_0x1e3811[_0x4a6d('0x33')],_0x1e3811[_0x4a6d('0x125')]):_0x1e3811['dialOriginateCallerIdNumber']);if(_0x2aba7a){_0x5c46bf[_0x4a6d('0x127')]=ut[_0x4a6d('0x128')](_0x2aba7a);_0x5c46bf['originatecalleridnum']=ut[_0x4a6d('0x129')](_0x2aba7a);}var _0x18409d=ut[_0x4a6d('0x12a')](_0x1e3811,_0x4ff4fb,_0x1b7359,_0x2aba7a,_0x22d438,_0x5c46bf);_[_0x4a6d('0x12b')](_0x5c46bf,ut[_0x4a6d('0x12c')](_0x18409d));_0x5c46bf['starttime']=moment()[_0x4a6d('0x53')](_0x4a6d('0x8c'));ami[_0x4a6d('0x70')](ut[_0x4a6d('0x12d')](_0x5c46bf,_0x1e3811,_0x18409d,_0x5c46bf[_0x4a6d('0xac')],_0x4273b8))[_0x4a6d('0x86')](function(_0x51521e){_0x1e3811[_0x4a6d('0x5a')]+=0x1;logger[_0x4a6d('0x56')](_0x4a6d('0x12e'),_0x22d438,_0x4a6d('0xb0'),_0x1e3811[_0x4a6d('0x26')],_0x4a6d('0x6a'),_0x1e3811[_0x4a6d('0x5a')]);_0x12e0d8(_0x51521e);})[_0x4a6d('0x88')](function(_0x2b9121){ut[_0x4a6d('0xed')](_0x5c46bf,0xe,_0x4a6d('0x12f'));rpcDb[_0x4a6d('0xee')](_0x5c46bf,_0x4a6d('0x130'));_0x1743ef(_0x2b9121);});});};Preview[_0x4a6d('0xe')][_0x4a6d('0x1c')]=function(_0x4caa2b){if(this[_0x4a6d('0x14')][_0x4caa2b[_0x4a6d('0xad')]]){this[_0x4a6d('0x14')][_0x4caa2b[_0x4a6d('0xad')]][_0x4a6d('0x72')]=_0x4caa2b['channel'];}};Preview[_0x4a6d('0xe')][_0x4a6d('0x131')]=function(_0x467bb9){var _0x128431=this;var _0xf4761f=this[_0x4a6d('0x14')][_0x467bb9['actionid']];if(_0xf4761f){if(_0xf4761f[_0x4a6d('0x132')]&&this[_0x4a6d('0x15')][_0xf4761f[_0x4a6d('0x132')]]){ut[_0x4a6d('0x133')](_0xf4761f,this['agents'][_0xf4761f['lookAgent']][_0x4a6d('0x26')],this[_0x4a6d('0x15')][_0xf4761f[_0x4a6d('0x132')]]['id']);}var _0x1e2d73=_[_0x4a6d('0x134')](_0xf4761f);_0x1e2d73[_0x4a6d('0xae')]=moment()[_0x4a6d('0x53')](_0x4a6d('0x8c'));var _0x5e8757=_0x128431[_0x4a6d('0x23')][_0xf4761f[_0x4a6d('0x69')]];if(ut[_0x4a6d('0x135')](_0x467bb9['response'])){if(_0xf4761f[_0x4a6d('0xab')]){rpcDb[_0x4a6d('0x10d')](_0xf4761f[_0x4a6d('0x101')]);}if(_0xf4761f[_0x4a6d('0xac')]){rpcDb[_0x4a6d('0x8a')](_0xf4761f[_0x4a6d('0x101')]);}ami['emit'](_0x4a6d('0x136'),ut['buildObj'](_0xf4761f,'rejected'));this['callProgressDetectingAgent'](_0x1e2d73,_0x5e8757,_0x467bb9);}else{_0xf4761f[_0x4a6d('0x8b')]=moment()[_0x4a6d('0x53')](_0x4a6d('0x8c'));ut['logAgent'](_0x1e2d73,0x4,_0x4a6d('0x137'));rpcDb['createAgentHistory'](_0x1e2d73,_0x4a6d('0x138'));}}};Preview['prototype']['syncHangup']=function(_0x5d0834){var _0x54b586=this;var _0x53ce5e=this[_0x4a6d('0x14')][_0x5d0834['linkedid']];var _0x39de57;if(_0x53ce5e){_0x39de57=this[_0x4a6d('0x23')][_0x53ce5e['queue']];logger[_0x4a6d('0x56')](_0x4a6d('0x139'),_0x5d0834[_0x4a6d('0xad')],_0x4a6d('0xb0'),_0x39de57['name'],_0x4a6d('0x6b'),_0x39de57[_0x4a6d('0x29')]);}if(this[_0x4a6d('0x14')][_0x5d0834[_0x4a6d('0xad')]]&&_0x5d0834[_0x4a6d('0xad')]!==_0x5d0834[_0x4a6d('0xc1')]){if(_0x5d0834[_0x4a6d('0x13a')]==='16'&&this[_0x4a6d('0x14')][_0x5d0834[_0x4a6d('0xad')]][_0x4a6d('0x6c')]){this[_0x4a6d('0x9d')](_0x5d0834,_0x5d0834[_0x4a6d('0xad')],_0x5d0834[_0x4a6d('0x13a')]);}else if(this[_0x4a6d('0x14')][_0x5d0834[_0x4a6d('0xad')]][_0x4a6d('0x6c')]){logger[_0x4a6d('0x56')](_0x4a6d('0x13b'),_0x5d0834[_0x4a6d('0xad')],_0x5d0834[_0x4a6d('0x13a')],_0x4a6d('0xb0'),_0x39de57[_0x4a6d('0x26')],_0x4a6d('0x6b'),_0x39de57[_0x4a6d('0x29')]);this[_0x4a6d('0x9d')](_0x5d0834,_0x5d0834[_0x4a6d('0xad')],_0x5d0834[_0x4a6d('0x13a')]);}}else if(_0x53ce5e&&_[_0x4a6d('0x7f')](_0x53ce5e[_0x4a6d('0x13c')])&&_0x39de57['dialQueueProject']&&_0x5d0834['linkedid']===_0x5d0834[_0x4a6d('0xc1')]&&_['isNil'](_0x5d0834[_0x4a6d('0xec')])&&_0x5d0834[_0x4a6d('0x13a')]==='16'&&_0x5d0834[_0x4a6d('0x13d')]==='6'&&_[_0x4a6d('0xea')](_0x53ce5e[_0x4a6d('0x13e')])){if(_0x53ce5e[_0x4a6d('0xab')]){rpcDb[_0x4a6d('0x10d')](_0x53ce5e[_0x4a6d('0x101')]);}if(_0x53ce5e[_0x4a6d('0xac')]){rpcDb[_0x4a6d('0x8a')](_0x53ce5e['idContact']);}_0x5d0834[_0x4a6d('0xec')]='22';this[_0x4a6d('0xe9')](_0x53ce5e,_0x39de57,_0x5d0834);}else if(_0x53ce5e&&_0x53ce5e[_0x4a6d('0x13e')]){if(_0x5d0834[_0x4a6d('0x13a')]==='16'&&this[_0x4a6d('0x14')][_0x5d0834[_0x4a6d('0xad')]]['dialAnswer']){logger[_0x4a6d('0x56')](_0x4a6d('0x13f'),_0x5d0834[_0x4a6d('0xad')],_0x5d0834[_0x4a6d('0x13a')],_0x4a6d('0xb0'),_0x39de57[_0x4a6d('0x26')],'pTalking:\x20',_0x39de57['pTalking']);this[_0x4a6d('0x9d')](_0x5d0834,_0x5d0834[_0x4a6d('0xad')],_0x5d0834[_0x4a6d('0x13a')]);}else if(this['actions'][_0x5d0834[_0x4a6d('0xad')]][_0x4a6d('0x6c')]){logger['info'](_0x4a6d('0x13b'),_0x5d0834['linkedid'],_0x5d0834[_0x4a6d('0x13a')],'\x20Queue',_0x39de57[_0x4a6d('0x26')],_0x4a6d('0x6b'),_0x39de57[_0x4a6d('0x29')]);this[_0x4a6d('0x9d')](_0x5d0834,_0x5d0834[_0x4a6d('0xad')],_0x5d0834[_0x4a6d('0x13a')]);}}};Preview[_0x4a6d('0xe')][_0x4a6d('0x1b')]=function(_0x12f9bc){if(this[_0x4a6d('0x14')][_0x12f9bc[_0x4a6d('0xe8')]]&&_0x12f9bc[_0x4a6d('0xe8')]!==_0x12f9bc['destuniqueid']){this[_0x4a6d('0x9d')](_0x12f9bc,_0x12f9bc[_0x4a6d('0xe8')],_0x12f9bc['dialstatus']);}};Preview[_0x4a6d('0xe')][_0x4a6d('0x1a')]=function(_0x241671){if(this[_0x4a6d('0x14')][_0x241671[_0x4a6d('0xad')]]&&_0x241671[_0x4a6d('0xad')]!==_0x241671['uniqueid']&&!this[_0x4a6d('0x14')][_0x241671[_0x4a6d('0xad')]][_0x4a6d('0x6c')]){if(_0x241671[_0x4a6d('0x13a')]==='1'){this['callProgressDetectingCustomer'](_0x241671,_0x241671['linkedid'],_0x241671[_0x4a6d('0x13a')]);}}};Preview[_0x4a6d('0xe')][_0x4a6d('0x140')]=function(_0x138367,_0x4cd7f0,_0x4cd247){if(this['actions'][_0x138367]){if(_[_0x4a6d('0x7f')](this[_0x4a6d('0x14')][_0x138367][_0x4a6d('0x141')])){this[_0x4a6d('0x14')][_0x138367][_0x4a6d('0x141')]={};}this[_0x4a6d('0x14')][_0x138367]['variables'][_0x4cd7f0]=_0x4cd247;}};Preview[_0x4a6d('0xe')][_0x4a6d('0x1e')]=function(_0x2230fb){try{if(!_[_0x4a6d('0x7f')](_0x2230fb)){if(ut[_0x4a6d('0x142')](_[_0x4a6d('0x143')](_0x2230fb['variable'])[0x0])){this['addVariable'](_0x2230fb[_0x4a6d('0xc1')],_[_0x4a6d('0x143')](_0x2230fb[_0x4a6d('0x144')])[0x0],_0x2230fb[_0x4a6d('0x145')]);}}}catch(_0x107e6d){logger[_0x4a6d('0x146')](_0x4a6d('0x147'),util[_0x4a6d('0x148')](_0x107e6d,{'showHidden':![],'depth':null}));}};Preview[_0x4a6d('0xe')][_0x4a6d('0x1f')]=function(_0x573bc8){if(_0x573bc8){if(this[_0x4a6d('0x14')][_0x573bc8['transfertargetlinkedid']]){this[_0x4a6d('0x14')][_0x573bc8[_0x4a6d('0x149')]][_0x4a6d('0x13e')]=!![];}}};Preview[_0x4a6d('0xe')][_0x4a6d('0x21')]=function(_0x3890f4){if(_0x3890f4){if(this[_0x4a6d('0x14')][_0x3890f4[_0x4a6d('0x14a')]]){this[_0x4a6d('0x14')][_0x3890f4[_0x4a6d('0x14a')]][_0x4a6d('0x13e')]=!![];}}};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 7472a99..c6608a7 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 _0x1db9=['lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x40efe8,_0x414716){var _0x3d9002=function(_0x2d740e){while(--_0x2d740e){_0x40efe8['push'](_0x40efe8['shift']());}};_0x3d9002(++_0x414716);}(_0x1db9,0x176));var _0x91db=function(_0x1769d6,_0x3f9e54){_0x1769d6=_0x1769d6-0x0;var _0x3bb573=_0x1db9[_0x1769d6];return _0x3bb573;};'use strict';var util=require(_0x91db('0x0'));var BPromise=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var _=require(_0x91db('0x4'));var cmHopper=require(_0x91db('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x91db('0x6'));var cmHopperBlack=require(_0x91db('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x91db('0x8'));function loggerCatch(_0x4b3f5c){return function(_0x5e69d9){logger[_0x91db('0x9')](_0x4b3f5c,util[_0x91db('0xa')](_0x5e69d9,{'showHidden':![],'depth':null}));};}function create(_0x45fea0){return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](cmHopperHistory['createHistory'](_0x45fea0))[_0x91db('0xd')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x39e939){return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](agentReportPreview['createHistory'](_0x39e939))[_0x91db('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4ac257){return BPromise['resolve']()[_0x91db('0xc')](cmHopper[_0x91db('0xe')](_0x4ac257,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x91db('0xf')]=function(_0x329277){return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](cmHopperBlack[_0x91db('0xf')](_0x329277))['catch'](loggerCatch(_0x91db('0x10')));};exports[_0x91db('0x11')]=function(_0x3cadc4){return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](cmHopper[_0x91db('0x11')](_0x3cadc4))[_0x91db('0xd')](loggerCatch(_0x91db('0x12')));};exports[_0x91db('0x13')]=function(_0x26d10c,_0x1e9679){create(_0x26d10c)[_0x91db('0xd')](loggerCatch(_0x1e9679));moveContact(_0x26d10c)['catch'](loggerCatch(_0x1e9679));};exports[_0x91db('0x14')]=function(_0x23d125,_0x39480f){createAgent(_0x23d125)[_0x91db('0xd')](loggerCatch(_0x39480f));};exports[_0x91db('0x15')]=function(_0x306e92,_0x5c15ef){create(_0x306e92)['catch'](loggerCatch(_0x5c15ef));};exports[_0x91db('0x16')]=function(_0x137edf,_0x2c3915){moveContact(_0x137edf)[_0x91db('0xd')](loggerCatch(_0x2c3915));};exports['rescheduleContact']=function(_0x168dea,_0x324de7,_0x6e3ca6){if(_0x324de7){_0x168dea[_0x91db('0x17')]=null;}if(_0x6e3ca6){_0x168dea[_0x91db('0x18')]=![];}return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](cmHopper[_0x91db('0x19')](_0x168dea))[_0x91db('0xd')](loggerCatch(_0x91db('0x1a')));};exports['countReScheduled']=function(_0x58774f){return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](cmHopper['countReScheduled'](_0x58774f))[_0x91db('0xd')](loggerCatch(_0x91db('0x1b')));};exports[_0x91db('0x1c')]=function(_0x6e3a9c){return BPromise[_0x91db('0xb')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x6e3a9c,0x1))[_0x91db('0xd')](loggerCatch(_0x91db('0x1d')));};exports[_0x91db('0x1e')]=function(_0x55e61e){return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](cmHopper[_0x91db('0x1c')]({'active':![]},_0x55e61e,0x1))[_0x91db('0xd')](loggerCatch('[activeContact]\x20'));};exports[_0x91db('0x1f')]=function(_0x2a00d1){var _0x1805ef={};_0x1805ef['type']=_0x2a00d1[_0x91db('0x20')];_0x1805ef[_0x91db('0x21')]=_0x2a00d1[_0x91db('0x21')];_0x1805ef[_0x91db('0x22')]=_0x2a00d1[_0x91db('0x22')];_0x1805ef[_0x91db('0x23')]=_0x2a00d1[_0x91db('0x23')];_0x1805ef[_0x91db('0x24')]=_0x2a00d1[_0x91db('0x24')];_0x1805ef[_0x91db('0x25')]=_0x2a00d1[_0x91db('0x26')];_0x1805ef[_0x91db('0x27')]=_0x2a00d1[_0x91db('0x26')];_0x1805ef[_0x91db('0x28')]=0x1;_0x1805ef['queuecallercompleteAt']=_0x2a00d1[_0x91db('0x29')];_0x1805ef[_0x91db('0x2a')]=_0x2a00d1[_0x91db('0x2b')];_0x1805ef[_0x91db('0x2c')]=_0x91db('0x2d');_0x1805ef['exten']=_0x91db('0x2e');_0x1805ef[_0x91db('0x2f')]=0x0;_0x1805ef[_0x91db('0x30')]=0x1;_0x1805ef['lastAssignedTo']=_0x2a00d1[_0x91db('0x2b')];_0x1805ef['queuecallerexitreason']=_0x91db('0x31');return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](voiceQueueReport[_0x91db('0x32')](_0x1805ef))['catch'](loggerCatch(_0x91db('0x33')));};exports[_0x91db('0x34')]=function(_0x468ed8,_0x527a75){return BPromise[_0x91db('0xb')]()[_0x91db('0xc')](cmHopper['getContactRecallMe'](_0x468ed8,_0x527a75))[_0x91db('0xd')](loggerCatch(_0x91db('0x35')));};exports['rescheduleContactInQueue']=function(_0x39ba97){return BPromise['resolve']()[_0x91db('0xc')](cmHopper[_0x91db('0x19')](_0x39ba97,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x24ca=['../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','resolve','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash'];(function(_0x838c70,_0x2d0cf8){var _0x4561a4=function(_0x41612c){while(--_0x41612c){_0x838c70['push'](_0x838c70['shift']());}};_0x4561a4(++_0x2d0cf8);}(_0x24ca,0x1bc));var _0xa24c=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0x24ca[_0x31abee];return _0x3c1761;};'use strict';var util=require(_0xa24c('0x0'));var BPromise=require('bluebird');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var _=require(_0xa24c('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xa24c('0x4'));var cmHopperHistory=require(_0xa24c('0x5'));var cmHopperBlack=require(_0xa24c('0x6'));var voiceQueueRt=require(_0xa24c('0x7'));var agentReportPreview=require(_0xa24c('0x8'));var voiceQueueReport=require(_0xa24c('0x9'));function loggerCatch(_0xf0511){return function(_0x3c0aaa){logger[_0xa24c('0xa')](_0xf0511,util[_0xa24c('0xb')](_0x3c0aaa,{'showHidden':![],'depth':null}));};}function create(_0x9a5013){return BPromise['resolve']()[_0xa24c('0xc')](cmHopperHistory[_0xa24c('0xd')](_0x9a5013))[_0xa24c('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x399f32){return BPromise[_0xa24c('0xf')]()[_0xa24c('0xc')](agentReportPreview[_0xa24c('0xd')](_0x399f32))[_0xa24c('0xe')](loggerCatch(_0xa24c('0x10')));}function moveContact(_0x1a71a8){return BPromise[_0xa24c('0xf')]()[_0xa24c('0xc')](cmHopper['moveContactManagedDialer'](_0x1a71a8,!![]))[_0xa24c('0xe')](loggerCatch(_0xa24c('0x11')));}exports[_0xa24c('0x12')]=function(_0x2c2af8){return BPromise['resolve']()[_0xa24c('0xc')](cmHopperBlack[_0xa24c('0x12')](_0x2c2af8))[_0xa24c('0xe')](loggerCatch(_0xa24c('0x13')));};exports[_0xa24c('0x14')]=function(_0x2d185c){return BPromise[_0xa24c('0xf')]()['then'](cmHopper['getContactPreview'](_0x2d185c))[_0xa24c('0xe')](loggerCatch(_0xa24c('0x15')));};exports['createHistory']=function(_0x5babb5,_0x221d21){create(_0x5babb5)[_0xa24c('0xe')](loggerCatch(_0x221d21));moveContact(_0x5babb5)['catch'](loggerCatch(_0x221d21));};exports[_0xa24c('0x16')]=function(_0x5de3e6,_0x558dc7){createAgent(_0x5de3e6)[_0xa24c('0xe')](loggerCatch(_0x558dc7));};exports[_0xa24c('0x17')]=function(_0xefdbd9,_0x4ff97c){create(_0xefdbd9)[_0xa24c('0xe')](loggerCatch(_0x4ff97c));};exports[_0xa24c('0x18')]=function(_0x773f70,_0x4d4bab){moveContact(_0x773f70)['catch'](loggerCatch(_0x4d4bab));};exports['rescheduleContact']=function(_0x4cd77e,_0x2173f6,_0x174b69){if(_0x2173f6){_0x4cd77e[_0xa24c('0x19')]=null;}if(_0x174b69){_0x4cd77e[_0xa24c('0x1a')]=![];}return BPromise['resolve']()[_0xa24c('0xc')](cmHopper['rescheduleContact'](_0x4cd77e))[_0xa24c('0xe')](loggerCatch(_0xa24c('0x1b')));};exports['countReScheduled']=function(_0x346ee8){return BPromise[_0xa24c('0xf')]()[_0xa24c('0xc')](cmHopper[_0xa24c('0x1c')](_0x346ee8))[_0xa24c('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0xa24c('0x1d')]=function(_0x5cc9cb){return BPromise[_0xa24c('0xf')]()[_0xa24c('0xc')](cmHopper[_0xa24c('0x1d')]({'UserId':null},_0x5cc9cb,0x1))['catch'](loggerCatch(_0xa24c('0x1e')));};exports[_0xa24c('0x1f')]=function(_0x14fd5a){return BPromise[_0xa24c('0xf')]()[_0xa24c('0xc')](cmHopper[_0xa24c('0x1d')]({'active':![]},_0x14fd5a,0x1))[_0xa24c('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0xa24c('0x20')]=function(_0x28675f){var _0x152120={};_0x152120[_0xa24c('0x21')]=_0x28675f['type'];_0x152120[_0xa24c('0x22')]=_0x28675f[_0xa24c('0x22')];_0x152120[_0xa24c('0x23')]=_0x28675f['calleridnum'];_0x152120[_0xa24c('0x24')]=_0x28675f[_0xa24c('0x24')];_0x152120[_0xa24c('0x25')]=_0x28675f['queue'];_0x152120[_0xa24c('0x26')]=_0x28675f['answertime'];_0x152120[_0xa24c('0x27')]=_0x28675f[_0xa24c('0x28')];_0x152120[_0xa24c('0x29')]=0x1;_0x152120['queuecallercompleteAt']=_0x28675f[_0xa24c('0x2a')];_0x152120[_0xa24c('0x2b')]=_0x28675f[_0xa24c('0x2c')];_0x152120['context']=_0xa24c('0x2d');_0x152120['exten']=_0xa24c('0x2e');_0x152120[_0xa24c('0x2f')]=0x0;_0x152120['assigned']=0x1;_0x152120['lastAssignedTo']=_0x28675f[_0xa24c('0x2c')];_0x152120[_0xa24c('0x30')]=_0xa24c('0x31');return BPromise[_0xa24c('0xf')]()[_0xa24c('0xc')](voiceQueueReport[_0xa24c('0x32')](_0x152120))[_0xa24c('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xa24c('0x33')]=function(_0x3ea442,_0x12825d){return BPromise[_0xa24c('0xf')]()[_0xa24c('0xc')](cmHopper[_0xa24c('0x33')](_0x3ea442,_0x12825d))[_0xa24c('0xe')](loggerCatch(_0xa24c('0x34')));};exports[_0xa24c('0x35')]=function(_0x129bb9){return BPromise['resolve']()[_0xa24c('0xc')](cmHopper[_0xa24c('0x36')](_0x129bb9,!![],!![]))[_0xa24c('0xe')](loggerCatch(_0xa24c('0x37')));}; \ 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 66ff694..577de9e 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 _0xf29d=['uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countagentrejectretry','countnosuchnumberretry','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','buildObj','lastevent','queue','interface','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','createBody','idContact','campaigntype','dialAnswer','membername','countcongestionretry','countnoanswerretry','callbackat','recallme','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','isEmpty','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','calleridname'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0xf29d,0xc4));var _0xdf29=function(_0x55b569,_0x2dc805){_0x55b569=_0x55b569-0x0;var _0x5da38d=_0xf29d[_0x55b569];return _0x5da38d;};'use strict';var util=require(_0xdf29('0x0'));var _=require(_0xdf29('0x1'));var moment=require('moment');var logger=require(_0xdf29('0x2'))(_0xdf29('0x3'));var ipAgi=process[_0xdf29('0x4')][_0xdf29('0x5')]||_0xdf29('0x6');function getSeconds(_0x5b3b99,_0x4debce){var _0x529ef8=moment(_0x5b3b99)[_0xdf29('0x7')](0x0);var _0x26d66e=moment(_0x4debce)[_0xdf29('0x7')](0x0);return _0x529ef8['diff'](_0x26d66e,_0xdf29('0x8'));}exports[_0xdf29('0x9')]=function(_0x289aad){return function(_0x54d108){logger[_0xdf29('0xa')](_0x289aad,util[_0xdf29('0xb')](_0x54d108,{'showHidden':![],'depth':null}));};};exports[_0xdf29('0xc')]=function(_0x298dbb,_0x517d89){logger['info'](_0x298dbb,util[_0xdf29('0xb')](_0x517d89,{'showHidden':![],'depth':null}));};exports[_0xdf29('0xd')]=function(_0x57d91b,_0x3f2853){logger[_0xdf29('0xa')](_0x57d91b,util[_0xdf29('0xb')](_0x3f2853,{'showHidden':![],'depth':null}));};exports[_0xdf29('0xe')]=function(_0x122b7e){return function(_0x52c98f){logger[_0xdf29('0xf')](_0x122b7e,util['inspect'](_0x52c98f,{'showHidden':![],'depth':null}));};};exports[_0xdf29('0x10')]=function(_0x196db8,_0x11bf94,_0x478d8a){return{'message':_0x196db8,'unlock':_0x11bf94,'active':_0x478d8a};};exports[_0xdf29('0x11')]=function(_0xacbef1,_0x5478df,_0xcf93bd){if(!_[_0xdf29('0x12')](_0xcf93bd)&&_0xdf29('0x13')===typeof _0xcf93bd&&!_['isEmpty'](_0xcf93bd)){if(!_[_0xdf29('0x12')](_0x5478df)&&'string'===typeof _0x5478df&&!_['isEmpty'](_0x5478df)){return util[_0xdf29('0x14')](_0xdf29('0x15'),_0x5478df,_0xcf93bd);}return util['format']('\x22%s\x22\x20<%s>',_0xcf93bd,_0xcf93bd);}if(!_[_0xdf29('0x12')](_0xacbef1)&&_0xdf29('0x13')===typeof _0xacbef1&&!_['isEmpty'](_0xacbef1)){return _0xacbef1;}return _0xdf29('0x16');};exports[_0xdf29('0x17')]=function(_0x1fb106){if(_[_0xdf29('0x18')](_0x1fb106)){return![];}return _0x1fb106;};exports[_0xdf29('0x19')]=function(_0x407f30,_0x3cc6d7,_0x2f1f7d,_0x15501e,_0xf0983b,_0x2746fc){var _0x2767a7={'XMD-QUEUE':_0x3cc6d7[_0xdf29('0x1a')]?_0x3cc6d7[_0xdf29('0x1a')][_0xdf29('0x1b')]:'','XMD-CALLERID':_0x15501e,'XMD-CALLERID-PREVIEW':_0x2746fc?util[_0xdf29('0x14')]('\x22%s\x22\x20<%s>',_0x2746fc['calleridname'],_0x2746fc[_0xdf29('0x1c')]):_0x15501e,'XMD-DIALID':_0xf0983b,'XMD-CONTACTID':_0x3cc6d7[_0xdf29('0x1d')],'XMD-CDRTYPE':_0xdf29('0x1e'),'CALLERID(all)':_0x15501e,'XMD-VOICEQUEUEID':_0x3cc6d7[_0xdf29('0x1f')],'XMD-DIALCHANNEL':_0x2f1f7d,'XMD-DIALTIMEOUT':_0x407f30[_0xdf29('0x20')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xdf29('0x21'),_0x407f30[_0xdf29('0x22')]?'g':'',_[_0xdf29('0x23')](_0x407f30[_0xdf29('0x24')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x407f30[_0xdf29('0x25')]||'','XMD-AGI':_0x407f30['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x407f30['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x407f30[_0xdf29('0x22')]?util['format'](_0xdf29('0x26'),ipAgi,_0x407f30['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2746fc?_0x2746fc['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2746fc?_0x2746fc[_0xdf29('0x27')]:'','XMD-DESTINATION':_0xdf29('0x28')};if(!_[_0xdf29('0x23')](_0x407f30[_0xdf29('0x24')])){_0x2767a7[util[_0xdf29('0x14')]('%s',_0xdf29('0x29'))]=_0x407f30['monitor_format'];_0x2767a7[util['format']('%s',_0xdf29('0x2a'))]=_0xf0983b;}if(_0x3cc6d7&&_0x3cc6d7[_0xdf29('0x2b')]){for(var _0x301bc5 in _0x3cc6d7[_0xdf29('0x2b')]){if(_0x3cc6d7[_0xdf29('0x2b')][_0xdf29('0x2c')](_0x301bc5)){if(!_[_0xdf29('0x18')](_0x3cc6d7[_0xdf29('0x2b')][_0x301bc5])&&_0x301bc5!=='id'&&_0x301bc5!==_0xdf29('0x2d')&&_0x301bc5!==_0xdf29('0x2e')&&_0x301bc5!==_0xdf29('0x2f')){_0x2767a7[util[_0xdf29('0x14')](_0xdf29('0x30'),_0xdf29('0x31'),_[_0xdf29('0x32')](_0x301bc5))]=_0x3cc6d7['Contact'][_0x301bc5];}}}}return _0x2767a7;};exports[_0xdf29('0x33')]=function(_0x29151b){var _0x581527={};for(var _0xbd89a6 in _0x29151b){if(_0x29151b[_0xdf29('0x2c')](_0xbd89a6)){_0x581527[util[_0xdf29('0x14')]('%s',_['toLower'](_0xbd89a6))]=_0x29151b[_0xbd89a6];}}return{'variables':_0x581527};};exports[_0xdf29('0x34')]=function(_0x31a0b3,_0x10d72f){if(!_[_0xdf29('0x18')](_0x31a0b3)){if(_0x31a0b3['hasOwnProperty'](_0xdf29('0x35'))){if(_0x31a0b3[_0xdf29('0x35')]>0x0){_0x31a0b3['originated']-=0x1;}else{logger[_0xdf29('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x10d72f);}}}else{logger[_0xdf29('0xa')](_0xdf29('0x36'),_0x10d72f);}};exports[_0xdf29('0x37')]=function(_0xb51e91){var _0x174c9e=moment()[_0xdf29('0x14')](_0xdf29('0x38'));_0xb51e91[_0xdf29('0x39')]=0xd;_0xb51e91[_0xdf29('0x3a')]='Blacklist';_0xb51e91[_0xdf29('0x3b')]=_0x174c9e;_0xb51e91[_0xdf29('0x3c')]=_0x174c9e;_0xb51e91[_0xdf29('0x3d')]=_0x174c9e;};exports[_0xdf29('0x3e')]=function(_0x1bab4f,_0x3524f1,_0x96be9d){var _0x26818d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1bab4f[_0xdf29('0x39')]=_0x3524f1;_0x1bab4f['statedesc']=_0x96be9d;_0x1bab4f[_0xdf29('0x3c')]=_0x26818d;_0x1bab4f[_0xdf29('0x3f')]=getSeconds(_0x1bab4f[_0xdf29('0x3c')],_0x1bab4f[_0xdf29('0x3b')]);};exports[_0xdf29('0x40')]=function(_0x53fa09,_0x10affc,_0x46fdec){_0x53fa09['membername']=_0x10affc;_0x53fa09[_0xdf29('0x41')]=_0x46fdec;};exports[_0xdf29('0x42')]=function(_0x302d2b,_0x534fa4,_0x2dbdab){var _0x319cee=moment()[_0xdf29('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x302d2b[_0xdf29('0x39')]=_0x534fa4;_0x302d2b['statedesc']=_0x2dbdab;_0x302d2b['responsetime']=_0x302d2b[_0xdf29('0x3c')]?_0x302d2b[_0xdf29('0x3c')]:_0x319cee;_0x302d2b[_0xdf29('0x3d')]=_0x302d2b[_0xdf29('0x3d')]?_0x302d2b['endtime']:_0x319cee;_0x302d2b[_0xdf29('0x3f')]=getSeconds(_0x302d2b[_0xdf29('0x3c')]||0x0,_0x302d2b[_0xdf29('0x3b')]||0x0);_0x302d2b[_0xdf29('0x43')]=_0x302d2b[_0xdf29('0x44')]?getSeconds(_0x302d2b['endtime'],_0x302d2b[_0xdf29('0x44')]):0x0;};exports[_0xdf29('0x45')]=function(_0x3d08b0){return _0x3d08b0==='Failure';};exports[_0xdf29('0x46')]=function(_0x2a69f5,_0x518ade,_0x2eaaa1,_0x20ec30,_0x158348){var _0x42e22c=_0x20ec30?'RECALL':_0x2a69f5[_0xdf29('0x47')];_0x42e22c=_0x158348?'BOOKED':_0x42e22c;return{'actionid':_0x2a69f5[_0xdf29('0x48')],'action':_0xdf29('0x49'),'channel':_0x2a69f5[_0xdf29('0x4a')],'callerid':util[_0xdf29('0x14')](_0xdf29('0x15'),_0x42e22c,_0x2a69f5[_0xdf29('0x1c')]),'Exten':_0xdf29('0x28'),'Context':_0xdf29('0x4b'),'Priority':'1','variable':_0x2eaaa1,'timeout':(_0x518ade[_0xdf29('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2a69f5[_0xdf29('0x48')]};};exports[_0xdf29('0x4d')]=function(_0x6d90a1){return _0x6d90a1[_0xdf29('0x4e')]+_0x6d90a1['countcongestionretry']+_0x6d90a1['countnoanswerretry']+_0x6d90a1[_0xdf29('0x4f')]+_0x6d90a1[_0xdf29('0x50')];};exports['cloneAction']=function(_0x4f5605){var _0x3bdfd6=_['clone'](_0x4f5605);_0x3bdfd6[_0xdf29('0x39')]=0xf;_0x3bdfd6[_0xdf29('0x3a')]=_0xdf29('0x51');return _0x3bdfd6;};exports['scheduledAt']=function(_0xc9f50,_0x3db80f,_0x330295){var _0x156c22={};_0x156c22[_0x3db80f]=_0xc9f50[_0x3db80f];_0x156c22[_0xdf29('0x52')]=![];_0x156c22[_0xdf29('0x53')]=moment()['add'](_0x330295,_0xdf29('0x54'))[_0xdf29('0x14')](_0xdf29('0x38'));_0x156c22[_0xdf29('0x1d')]=_0xc9f50[_0xdf29('0x1d')];_0x156c22['ListId']=_0xc9f50[_0xdf29('0x55')];_0x156c22[_0xdf29('0x1f')]=_0xc9f50['VoiceQueueId']||undefined;return _0x156c22;};exports[_0xdf29('0x56')]=function(_0x315a7c,_0x5018fe){if(!_['isNil'](_0x315a7c)){if(_0x315a7c['pTalking']>0x0){_0x315a7c[_0xdf29('0x57')]-=0x1;}else{logger[_0xdf29('0xa')](_0x5018fe,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xdf29('0xa')](_0x5018fe,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5134f9){if(_0x5134f9<=0x0){return!![];}return![];};exports[_0xdf29('0x58')]=function(_0x4e15eb,_0x47f695){_0x4e15eb[_0xdf29('0x59')]=_0x47f695;_0x4e15eb[_0xdf29('0x1b')]=_0x4e15eb[_0xdf29('0x5a')];_0x4e15eb[_0xdf29('0x5b')]=_0x4e15eb[_0xdf29('0x4a')];return _0x4e15eb;};exports[_0xdf29('0x5c')]=function(_0x5a4ba1){var _0x3fade5={};_0x3fade5[_0xdf29('0x5a')]=_0x5a4ba1['queue'];_0x3fade5['interface']=_0x5a4ba1[_0xdf29('0x4a')];_0x3fade5[_0xdf29('0x48')]=_0x5a4ba1[_0xdf29('0x48')];return _0x3fade5;};exports[_0xdf29('0x5d')]=function(_0x362200){var _0x3be3e2=[];for(var _0x59321a in _0x362200){if(_0x362200[_0xdf29('0x2c')](_0x59321a)){if(!_[_0xdf29('0x18')](_0x362200[_0x59321a])&&_0x362200[_0x59321a][_0xdf29('0x39')]===_0xdf29('0x5e')&&_0x362200[_0x59321a][_0xdf29('0x5f')]===_0xdf29('0x60')){_0x3be3e2[_0xdf29('0x61')](_0x362200[_0x59321a]['id']);}}}return _0x3be3e2;};exports[_0xdf29('0x62')]=function(_0x22c869){var _0x171246=moment()[_0xdf29('0x7')](0x0);var _0x1d58da=moment(_0x22c869)[_0xdf29('0x7')](0x0);return _0x171246[_0xdf29('0x63')](_0x1d58da,_0xdf29('0x8'));};exports[_0xdf29('0x64')]=function(_0x1a2050){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1a2050[_0xdf29('0x1d')],'ListId':_0x1a2050[_0xdf29('0x55')],'VoiceQueueId':_0x1a2050[_0xdf29('0x1f')]||undefined,'CampaignId':_0x1a2050['CampaignId']||undefined};};exports['filterKey']=function(_0x24e11d){if(_0x24e11d===_0xdf29('0x48')||_0x24e11d===_0xdf29('0x65')||_0x24e11d===_0xdf29('0x5a')||_0x24e11d==='type'||_0x24e11d===_0xdf29('0x66')||_0x24e11d===_0xdf29('0x67')||_0x24e11d===_0xdf29('0x68')||_0x24e11d===_0xdf29('0x4a')||_0x24e11d===_0xdf29('0x47')||_0x24e11d===_0xdf29('0x52')||_0x24e11d===_0xdf29('0x1c')||_0x24e11d===_0xdf29('0x53')||_0x24e11d===_0xdf29('0x4e')||_0x24e11d===_0xdf29('0x69')||_0x24e11d===_0xdf29('0x6a')||_0x24e11d==='countglobal'||_0x24e11d==='callback'||_0x24e11d==='callbackuniqueid'||_0x24e11d===_0xdf29('0x6b')||_0x24e11d===_0xdf29('0x6c')||_0x24e11d===_0xdf29('0x1d')||_0x24e11d===_0xdf29('0x55')||_0x24e11d==='UserId'||_0x24e11d===_0xdf29('0x1f')||_0x24e11d==='sipcallid'||_0x24e11d==='xmd-voicequeueid'||_0x24e11d==='xmd-queue'||_0x24e11d==='xmd-phone'||_0x24e11d===_0xdf29('0x6d')||_0x24e11d===_0xdf29('0x6e')||_0x24e11d===_0xdf29('0x6f')||_0x24e11d===_0xdf29('0x70')||_0x24e11d===_0xdf29('0x71')||_0x24e11d===_0xdf29('0x72')||_0x24e11d===_0xdf29('0x73')||_0x24e11d===_0xdf29('0x74')||_0x24e11d===_0xdf29('0x75')||_0x24e11d===_0xdf29('0x76')||_0x24e11d==='xmd-agi'||_0x24e11d===_0xdf29('0x77')||_0x24e11d===_0xdf29('0x78')||_0x24e11d===_0xdf29('0x79')||_0x24e11d===_0xdf29('0x7a')||_0x24e11d===_0xdf29('0x7b')||_0x24e11d===_0xdf29('0x7c')||_0x24e11d===_0xdf29('0x7d')||_0x24e11d===_0xdf29('0x7e')||_0x24e11d===_0xdf29('0x77')||_0x24e11d==='rtpaudioqosbridged'||_0x24e11d==='rtpaudioqosjitter'||_0x24e11d===_0xdf29('0x7a')||_0x24e11d===_0xdf29('0x7b')||_0x24e11d===_0xdf29('0x7c')||_0x24e11d==='rtpaudioqosrtt'||_0x24e11d==='rtpaudioqosrttbridged'||_0x24e11d===_0xdf29('0x7f')||_0x24e11d==='bridgepvtcallid'||_0x24e11d==='state'||_0x24e11d===_0xdf29('0x3a')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5ca996,_0x371a6d){var _0xaba721,_0x12a956,_0x394b71;if(_0x371a6d<=0x0){_0x371a6d=0x1;}_0xaba721=new RegExp(_0xdf29('0x80')+_0x371a6d+'}$');_0x12a956=Math[_0xdf29('0x81')](0xa,_0x371a6d-0x1);_0x394b71=Math[_0xdf29('0x81')](0xa,_0x371a6d)-0x1;return util[_0xdf29('0x14')]('%s',_['replace'](_0x5ca996,_0xaba721,_[_0xdf29('0x82')](_0x12a956,_0x394b71)));};exports[_0xdf29('0x83')]=function(_0x39aa32){var _0x133631=_0x39aa32[_0xdf29('0x84')](/"(.*?)"/);return _0x133631?_0x133631[0x1]:_0x39aa32;};exports[_0xdf29('0x85')]=function(_0x16a4da){var _0x38f076=_0x16a4da[_0xdf29('0x84')](/<(.*?)>/);return _0x38f076?_0x38f076[0x1]:_0x16a4da;}; \ No newline at end of file +var _0x19fb=['U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','state','logLookAgent','UserId','ringtime','talktime','answertime','isFailure','Failure','uniqueid','channelAgent','totalGlobal','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','buildAcw','queue','interface','not_inuse','status','reachable','push','createBody','CampaignId','filterKey','campaigntype','membername','countbusyretry','countcongestionretry','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','\x5cw{0,','replace','random','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','format','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x19fb,0xdd));var _0xb19f=function(_0x5b1b8c,_0xdd7541){_0x5b1b8c=_0x5b1b8c-0x0;var _0x116fda=_0x19fb[_0x5b1b8c];return _0x116fda;};'use strict';var util=require(_0xb19f('0x0'));var _=require(_0xb19f('0x1'));var moment=require(_0xb19f('0x2'));var logger=require(_0xb19f('0x3'))(_0xb19f('0x4'));var ipAgi=process[_0xb19f('0x5')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x47d39d,_0x16bf63){var _0x3a5895=moment(_0x47d39d)[_0xb19f('0x6')](0x0);var _0x3ca9c9=moment(_0x16bf63)['milliseconds'](0x0);return _0x3a5895[_0xb19f('0x7')](_0x3ca9c9,_0xb19f('0x8'));}exports[_0xb19f('0x9')]=function(_0x2c70a2){return function(_0x8c9198){logger[_0xb19f('0xa')](_0x2c70a2,util[_0xb19f('0xb')](_0x8c9198,{'showHidden':![],'depth':null}));};};exports[_0xb19f('0xc')]=function(_0x51b386,_0x2f3913){logger[_0xb19f('0xd')](_0x51b386,util[_0xb19f('0xb')](_0x2f3913,{'showHidden':![],'depth':null}));};exports[_0xb19f('0xe')]=function(_0x1d65e1,_0x218387){logger[_0xb19f('0xa')](_0x1d65e1,util[_0xb19f('0xb')](_0x218387,{'showHidden':![],'depth':null}));};exports[_0xb19f('0xf')]=function(_0x388aa5){return function(_0x22272f){logger[_0xb19f('0xd')](_0x388aa5,util[_0xb19f('0xb')](_0x22272f,{'showHidden':![],'depth':null}));};};exports[_0xb19f('0x10')]=function(_0x1b99c6,_0x539b4e,_0x214290){return{'message':_0x1b99c6,'unlock':_0x539b4e,'active':_0x214290};};exports[_0xb19f('0x11')]=function(_0x34518a,_0x5193e6,_0x278f4f){if(!_[_0xb19f('0x12')](_0x278f4f)&&_0xb19f('0x13')===typeof _0x278f4f&&!_['isEmpty'](_0x278f4f)){if(!_[_0xb19f('0x12')](_0x5193e6)&&_0xb19f('0x13')===typeof _0x5193e6&&!_[_0xb19f('0x14')](_0x5193e6)){return util['format'](_0xb19f('0x15'),_0x5193e6,_0x278f4f);}return util['format']('\x22%s\x22\x20<%s>',_0x278f4f,_0x278f4f);}if(!_['isUndefined'](_0x34518a)&&_0xb19f('0x13')===typeof _0x34518a&&!_[_0xb19f('0x14')](_0x34518a)){return _0x34518a;}return _0xb19f('0x16');};exports[_0xb19f('0x17')]=function(_0x47e548){if(_[_0xb19f('0x18')](_0x47e548)){return![];}return _0x47e548;};exports[_0xb19f('0x19')]=function(_0x505929,_0x1875e8,_0x5f148e,_0x3950c9,_0x2acb39,_0x3a1b1e){var _0xb449b4={'XMD-QUEUE':_0x1875e8[_0xb19f('0x1a')]?_0x1875e8[_0xb19f('0x1a')][_0xb19f('0x1b')]:'','XMD-CALLERID':_0x3950c9,'XMD-CALLERID-PREVIEW':_0x3a1b1e?util['format'](_0xb19f('0x15'),_0x3a1b1e[_0xb19f('0x1c')],_0x3a1b1e[_0xb19f('0x1d')]):_0x3950c9,'XMD-DIALID':_0x2acb39,'XMD-CONTACTID':_0x1875e8[_0xb19f('0x1e')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3950c9,'XMD-VOICEQUEUEID':_0x1875e8[_0xb19f('0x1f')],'XMD-DIALCHANNEL':_0x5f148e,'XMD-DIALTIMEOUT':_0x505929[_0xb19f('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xb19f('0x21')](_0xb19f('0x22'),_0x505929[_0xb19f('0x23')]?'g':'',_[_0xb19f('0x14')](_0x505929[_0xb19f('0x24')])?'':_0xb19f('0x25')),'XMD-DIALURL':_0x505929[_0xb19f('0x26')]||'','XMD-AGI':_0x505929[_0xb19f('0x27')]?util[_0xb19f('0x21')]('\x22agi://%s/square,%s\x22',ipAgi,_0x505929[_0xb19f('0x27')]):_0xb19f('0x28'),'XMD-AGIAFTER':_0x505929['dialQueueProject2']?util[_0xb19f('0x21')](_0xb19f('0x29'),ipAgi,_0x505929['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3a1b1e?_0x3a1b1e[_0xb19f('0x2a')]:'','XMD-ORIGINATECALLERIDNAME':_0x3a1b1e?_0x3a1b1e[_0xb19f('0x2b')]:'','XMD-DESTINATION':_0xb19f('0x2c')};if(!_[_0xb19f('0x14')](_0x505929['monitor_format'])){_0xb449b4[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x505929[_0xb19f('0x24')];_0xb449b4[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x2acb39;}if(_0x1875e8&&_0x1875e8['Contact']){for(var _0xeac9a3 in _0x1875e8[_0xb19f('0x2d')]){if(_0x1875e8[_0xb19f('0x2d')][_0xb19f('0x2e')](_0xeac9a3)){if(!_[_0xb19f('0x18')](_0x1875e8[_0xb19f('0x2d')][_0xeac9a3])&&_0xeac9a3!=='id'&&_0xeac9a3!=='tags'&&_0xeac9a3!==_0xb19f('0x2f')&&_0xeac9a3!==_0xb19f('0x30')){_0xb449b4[util['format'](_0xb19f('0x31'),_0xb19f('0x32'),_[_0xb19f('0x33')](_0xeac9a3))]=_0x1875e8[_0xb19f('0x2d')][_0xeac9a3];}}}}return _0xb449b4;};exports[_0xb19f('0x34')]=function(_0x3ca414){var _0x536ea9={};for(var _0x2856d3 in _0x3ca414){if(_0x3ca414[_0xb19f('0x2e')](_0x2856d3)){_0x536ea9[util[_0xb19f('0x21')]('%s',_[_0xb19f('0x35')](_0x2856d3))]=_0x3ca414[_0x2856d3];}}return{'variables':_0x536ea9};};exports[_0xb19f('0x36')]=function(_0x2e9796,_0x555a21){if(!_[_0xb19f('0x18')](_0x2e9796)){if(_0x2e9796[_0xb19f('0x2e')](_0xb19f('0x37'))){if(_0x2e9796[_0xb19f('0x37')]>0x0){_0x2e9796[_0xb19f('0x37')]-=0x1;}else{logger[_0xb19f('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x555a21);}}}else{logger[_0xb19f('0xa')](_0xb19f('0x38'),_0x555a21);}};exports[_0xb19f('0x39')]=function(_0x2ab764){var _0x25535d=moment()[_0xb19f('0x21')](_0xb19f('0x3a'));_0x2ab764['state']=0xd;_0x2ab764[_0xb19f('0x3b')]='Blacklist';_0x2ab764[_0xb19f('0x3c')]=_0x25535d;_0x2ab764[_0xb19f('0x3d')]=_0x25535d;_0x2ab764[_0xb19f('0x3e')]=_0x25535d;};exports['logAgent']=function(_0x30c7fc,_0x514907,_0x39fef8){var _0x2ddd2f=moment()['format'](_0xb19f('0x3a'));_0x30c7fc[_0xb19f('0x3f')]=_0x514907;_0x30c7fc[_0xb19f('0x3b')]=_0x39fef8;_0x30c7fc[_0xb19f('0x3d')]=_0x2ddd2f;_0x30c7fc['ringtime']=getSeconds(_0x30c7fc[_0xb19f('0x3d')],_0x30c7fc[_0xb19f('0x3c')]);};exports[_0xb19f('0x40')]=function(_0x2f1200,_0x2b4b5d,_0x34c4d4){_0x2f1200['membername']=_0x2b4b5d;_0x2f1200[_0xb19f('0x41')]=_0x34c4d4;};exports['logCustomer']=function(_0x1b85f6,_0x4e5444,_0x3f14cd){var _0x268b91=moment()['format'](_0xb19f('0x3a'));_0x1b85f6[_0xb19f('0x3f')]=_0x4e5444;_0x1b85f6[_0xb19f('0x3b')]=_0x3f14cd;_0x1b85f6[_0xb19f('0x3d')]=_0x1b85f6['responsetime']?_0x1b85f6[_0xb19f('0x3d')]:_0x268b91;_0x1b85f6[_0xb19f('0x3e')]=_0x1b85f6[_0xb19f('0x3e')]?_0x1b85f6['endtime']:_0x268b91;_0x1b85f6[_0xb19f('0x42')]=getSeconds(_0x1b85f6['responsetime']||0x0,_0x1b85f6[_0xb19f('0x3c')]||0x0);_0x1b85f6[_0xb19f('0x43')]=_0x1b85f6[_0xb19f('0x44')]?getSeconds(_0x1b85f6[_0xb19f('0x3e')],_0x1b85f6[_0xb19f('0x44')]):0x0;};exports[_0xb19f('0x45')]=function(_0xf33c2a){return _0xf33c2a===_0xb19f('0x46');};exports['variablesAction']=function(_0x2ba162,_0x35792d,_0x57b13b,_0x1cc9e3,_0x3ae2dd){var _0x3ab6e6=_0x1cc9e3?'RECALL':_0x2ba162[_0xb19f('0x1c')];_0x3ab6e6=_0x3ae2dd?'BOOKED':_0x3ab6e6;return{'actionid':_0x2ba162[_0xb19f('0x47')],'action':'originate','channel':_0x2ba162[_0xb19f('0x48')],'callerid':util['format'](_0xb19f('0x15'),_0x3ab6e6,_0x2ba162[_0xb19f('0x1d')]),'Exten':_0xb19f('0x2c'),'Context':'from-sip','Priority':'1','variable':_0x57b13b,'timeout':(_0x35792d['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2ba162[_0xb19f('0x47')]};};exports[_0xb19f('0x49')]=function(_0x300262){return _0x300262['countbusyretry']+_0x300262['countcongestionretry']+_0x300262['countnoanswerretry']+_0x300262[_0xb19f('0x4a')]+_0x300262[_0xb19f('0x4b')];};exports['cloneAction']=function(_0x194910){var _0x58cef4=_[_0xb19f('0x4c')](_0x194910);_0x58cef4[_0xb19f('0x3f')]=0xf;_0x58cef4[_0xb19f('0x3b')]=_0xb19f('0x4d');return _0x58cef4;};exports[_0xb19f('0x4e')]=function(_0x401787,_0x20da72,_0x5738b5){var _0x2b5cd2={};_0x2b5cd2[_0x20da72]=_0x401787[_0x20da72];_0x2b5cd2[_0xb19f('0x4f')]=![];_0x2b5cd2[_0xb19f('0x50')]=moment()['add'](_0x5738b5,'minutes')[_0xb19f('0x21')](_0xb19f('0x3a'));_0x2b5cd2[_0xb19f('0x1e')]=_0x401787[_0xb19f('0x1e')];_0x2b5cd2[_0xb19f('0x51')]=_0x401787['ListId'];_0x2b5cd2['VoiceQueueId']=_0x401787[_0xb19f('0x1f')]||undefined;return _0x2b5cd2;};exports['decrementTalkink']=function(_0x1fb044,_0x1eb96b){if(!_[_0xb19f('0x18')](_0x1fb044)){if(_0x1fb044['pTalking']>0x0){_0x1fb044[_0xb19f('0x52')]-=0x1;}else{logger[_0xb19f('0xa')](_0x1eb96b,_0xb19f('0x53'));}}else{logger[_0xb19f('0xa')](_0x1eb96b,_0xb19f('0x54'));}};exports[_0xb19f('0x55')]=function(_0xdb22ee){if(_0xdb22ee<=0x0){return!![];}return![];};exports[_0xb19f('0x56')]=function(_0x1bb897,_0x26a738){_0x1bb897[_0xb19f('0x57')]=_0x26a738;_0x1bb897[_0xb19f('0x1b')]=_0x1bb897['queue'];_0x1bb897['interface']=_0x1bb897[_0xb19f('0x48')];return _0x1bb897;};exports[_0xb19f('0x58')]=function(_0x562926){var _0x2acfd1={};_0x2acfd1[_0xb19f('0x59')]=_0x562926['queue'];_0x2acfd1[_0xb19f('0x5a')]=_0x562926[_0xb19f('0x48')];_0x2acfd1[_0xb19f('0x47')]=_0x562926[_0xb19f('0x47')];return _0x2acfd1;};exports['agentReadyId']=function(_0x28a3e1){var _0x1e42e2=[];for(var _0x177e23 in _0x28a3e1){if(_0x28a3e1['hasOwnProperty'](_0x177e23)){if(!_['isNil'](_0x28a3e1[_0x177e23])&&_0x28a3e1[_0x177e23][_0xb19f('0x3f')]===_0xb19f('0x5b')&&_0x28a3e1[_0x177e23][_0xb19f('0x5c')]===_0xb19f('0x5d')){_0x1e42e2[_0xb19f('0x5e')](_0x28a3e1[_0x177e23]['id']);}}}return _0x1e42e2;};exports['getDiff']=function(_0x17d46b){var _0x265163=moment()[_0xb19f('0x6')](0x0);var _0x5ae06d=moment(_0x17d46b)[_0xb19f('0x6')](0x0);return _0x265163[_0xb19f('0x7')](_0x5ae06d,'seconds');};exports[_0xb19f('0x5f')]=function(_0x4aca93){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4aca93[_0xb19f('0x1e')],'ListId':_0x4aca93[_0xb19f('0x51')],'VoiceQueueId':_0x4aca93['VoiceQueueId']||undefined,'CampaignId':_0x4aca93[_0xb19f('0x60')]||undefined};};exports[_0xb19f('0x61')]=function(_0x5e8b8e){if(_0x5e8b8e===_0xb19f('0x47')||_0x5e8b8e==='idContact'||_0x5e8b8e===_0xb19f('0x59')||_0x5e8b8e==='type'||_0x5e8b8e===_0xb19f('0x62')||_0x5e8b8e==='dialAnswer'||_0x5e8b8e===_0xb19f('0x63')||_0x5e8b8e==='channelAgent'||_0x5e8b8e==='calleridname'||_0x5e8b8e===_0xb19f('0x4f')||_0x5e8b8e===_0xb19f('0x1d')||_0x5e8b8e===_0xb19f('0x50')||_0x5e8b8e===_0xb19f('0x64')||_0x5e8b8e===_0xb19f('0x65')||_0x5e8b8e===_0xb19f('0x66')||_0x5e8b8e==='countglobal'||_0x5e8b8e===_0xb19f('0x67')||_0x5e8b8e===_0xb19f('0x68')||_0x5e8b8e===_0xb19f('0x69')||_0x5e8b8e===_0xb19f('0x6a')||_0x5e8b8e===_0xb19f('0x1e')||_0x5e8b8e===_0xb19f('0x51')||_0x5e8b8e===_0xb19f('0x41')||_0x5e8b8e===_0xb19f('0x1f')||_0x5e8b8e===_0xb19f('0x6b')||_0x5e8b8e===_0xb19f('0x6c')||_0x5e8b8e===_0xb19f('0x6d')||_0x5e8b8e===_0xb19f('0x6e')||_0x5e8b8e===_0xb19f('0x6f')||_0x5e8b8e==='xmd-dialurl'||_0x5e8b8e==='xmd-dialtimeout'||_0x5e8b8e==='xmd-dialoptions'||_0x5e8b8e==='xmd-dialid'||_0x5e8b8e==='xmd-dialchannel'||_0x5e8b8e===_0xb19f('0x70')||_0x5e8b8e==='xmd-cdrtype'||_0x5e8b8e==='xmd-callerid'||_0x5e8b8e===_0xb19f('0x71')||_0x5e8b8e===_0xb19f('0x72')||_0x5e8b8e==='rtpaudioqos'||_0x5e8b8e===_0xb19f('0x73')||_0x5e8b8e===_0xb19f('0x74')||_0x5e8b8e===_0xb19f('0x75')||_0x5e8b8e==='rtpaudioqosloss'||_0x5e8b8e===_0xb19f('0x76')||_0x5e8b8e===_0xb19f('0x77')||_0x5e8b8e===_0xb19f('0x78')||_0x5e8b8e===_0xb19f('0x79')||_0x5e8b8e===_0xb19f('0x73')||_0x5e8b8e==='rtpaudioqosjitter'||_0x5e8b8e===_0xb19f('0x75')||_0x5e8b8e==='rtpaudioqosloss'||_0x5e8b8e===_0xb19f('0x76')||_0x5e8b8e===_0xb19f('0x77')||_0x5e8b8e==='rtpaudioqosrttbridged'||_0x5e8b8e===_0xb19f('0x7a')||_0x5e8b8e===_0xb19f('0x7b')||_0x5e8b8e==='state'||_0x5e8b8e===_0xb19f('0x3b')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x385660,_0x12f37c){var _0x5c63bc,_0x4d078b,_0x1d3914;if(_0x12f37c<=0x0){_0x12f37c=0x1;}_0x5c63bc=new RegExp(_0xb19f('0x7c')+_0x12f37c+'}$');_0x4d078b=Math['pow'](0xa,_0x12f37c-0x1);_0x1d3914=Math['pow'](0xa,_0x12f37c)-0x1;return util[_0xb19f('0x21')]('%s',_[_0xb19f('0x7d')](_0x385660,_0x5c63bc,_[_0xb19f('0x7e')](_0x4d078b,_0x1d3914)));};exports['extractCalleridName']=function(_0x1ab59d){var _0x26515d=_0x1ab59d[_0xb19f('0x7f')](/"(.*?)"/);return _0x26515d?_0x26515d[0x1]:_0x1ab59d;};exports[_0xb19f('0x80')]=function(_0x3d0566){var _0x3d25b6=_0x3d0566[_0xb19f('0x7f')](/<(.*?)>/);return _0x3d25b6?_0x3d25b6[0x1]:_0x3d0566;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a5caf76..0d20572 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x2d540e,_0x25235e){var _0x1440f2=function(_0x1a2774){while(--_0x1a2774){_0x2d540e['push'](_0x2d540e['shift']());}};_0x1440f2(++_0x25235e);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f4f25,_0x592d31){_0x2f4f25=_0x2f4f25-0x0;var _0x6a112a=_0xb10b[_0x2f4f25];return _0x6a112a;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x52de9b,_0x19df61){var _0x1ad0c7=function(_0x26a38c){while(--_0x26a38c){_0x52de9b['push'](_0x52de9b['shift']());}};_0x1ad0c7(++_0x19df61);}(_0xb10b,0x12a));var _0xbb10=function(_0x58f8d6,_0x3de6e9){_0x58f8d6=_0x58f8d6-0x0;var _0x249399=_0xb10b[_0x58f8d6];return _0x249399;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 2c49c74..232240f 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 _0x995f=['initTrunks','trunks','initVoiceQueues','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','groupBy','uniqueid','unmanaged','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','exports','bluebird','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','triggers','campaigns','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','SIP/%s','interface','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumHoldTime','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','initTelephones','isUndefined'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0x995f,0x1b2));var _0xf995=function(_0x573752,_0x17ae4){_0x573752=_0x573752-0x0;var _0x2cb020=_0x995f[_0x573752];return _0x2cb020;};'use strict';var BPromise=require(_0xf995('0x0'));var util=require(_0xf995('0x1'));var _=require(_0xf995('0x2'));var moment=require(_0xf995('0x3'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0xf995('0x4'));var VoiceQueue=require(_0xf995('0x5'));var Trigger=require(_0xf995('0x6'));var Template=require('../model/template');var Campaign=require(_0xf995('0x7'));var VoiceExtension=require(_0xf995('0x8'));var ZendeskAccount=require(_0xf995('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xf995('0xa'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf995('0xb'));var ServicenowAccount=require(_0xf995('0xc'));var Dynamics365Account=require(_0xf995('0xd'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf995('0xe'));var Realtime=function(){this[_0xf995('0xf')]={};this[_0xf995('0x10')]={};this['trunks']={};this[_0xf995('0x11')]={};this[_0xf995('0x12')]={};this[_0xf995('0x13')]={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xf995('0x14')]={};this[_0xf995('0x15')]={};this['queueChannels']={};this[_0xf995('0x16')]={};this[_0xf995('0x17')]={};this[_0xf995('0x18')]={};this[_0xf995('0x19')]={};this['sugarcrmAccounts']={};this[_0xf995('0x1a')]={};this[_0xf995('0x1b')]={};this[_0xf995('0x1c')]={};this['vtigerAccounts']={};this[_0xf995('0x1d')]={};this[_0xf995('0x1e')]={};this['freshsalesAccounts']={};this[_0xf995('0x1f')]={};};function freeIsNotKey(_0x112be4,_0x102fdb,_0xae0512){var _0x4b2fa4=_[_0xf995('0x20')](_0x112be4,function(_0x2eec63,_0x3721cb){return _0x2eec63[_0xae0512];});for(var _0x4ad40c in _0x102fdb){if(_0x102fdb[_0xf995('0x21')](_0x4ad40c)){if(!_0x4b2fa4[_0x4ad40c]){delete _0x102fdb[_0x4ad40c];}}}}function freeIsNotKeySip(_0x195027,_0x35686e){var _0x51c5e3=_[_0xf995('0x20')](_0x195027,function(_0x4e8e82,_0xa699cd){return util[_0xf995('0x22')]('SIP/%s',_0x4e8e82[_0xf995('0x23')]);});for(var _0x135d02 in _0x35686e){if(_0x35686e[_0xf995('0x21')](_0x135d02)){if(!_0x51c5e3[_0x135d02]){delete _0x35686e[_0x135d02];}}}}function freeIsNotKeyAgent(_0x2c2343,_0x3ac66e){var _0x125e0d=_[_0xf995('0x20')](_0x2c2343,function(_0x18df77,_0x5691fe){var _0x583d5b=_[_0xf995('0x24')](_0x18df77['interface'])?util[_0xf995('0x22')](_0xf995('0x25'),_0x18df77[_0xf995('0x23')]):_0x18df77[_0xf995('0x26')];return _0x583d5b;});for(var _0x54d239 in _0x3ac66e){if(_0x3ac66e[_0xf995('0x21')](_0x54d239)){if(!_0x125e0d[_0x54d239]){delete _0x3ac66e[_0x54d239];}}}}function clearVoiceCallReports(_0x500836){_0x500836[_0xf995('0x27')]=0x0;_0x500836[_0xf995('0x28')]=0x0;_0x500836['sumHoldTime']=0x0;_0x500836[_0xf995('0x29')]=0x0;_0x500836[_0xf995('0x2a')]=0x0;}function clearCampaigns(_0x5147b6){if(!_[_0xf995('0x2b')](_0x5147b6)){for(var _0x1536f5 in _0x5147b6){if(_0x5147b6[_0xf995('0x21')](_0x1536f5)){_0x5147b6[_0x1536f5][_0xf995('0x2c')]=0x0;_0x5147b6[_0x1536f5][_0xf995('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x34ce18){if(!_[_0xf995('0x2b')](_0x34ce18)){for(var _0x5df612 in _0x34ce18){if(_0x34ce18[_0xf995('0x21')](_0x5df612)){_0x34ce18[_0x5df612][_0xf995('0x27')]=0x0;_0x34ce18[_0x5df612][_0xf995('0x28')]=0x0;_0x34ce18[_0x5df612]['unmanaged']=0x0;_0x34ce18[_0x5df612][_0xf995('0x2e')]=0x0;_0x34ce18[_0x5df612][_0xf995('0x2f')]=0x0;_0x34ce18[_0x5df612]['sumDuration']=0x0;_0x34ce18[_0x5df612]['sumBillable']=0x0;_0x34ce18[_0x5df612]['outboundAnswerAgiCallsDay']=0x0;_0x34ce18[_0x5df612]['outboundNoAnswerCallsDay']=0x0;_0x34ce18[_0x5df612][_0xf995('0x30')]=0x0;_0x34ce18[_0x5df612]['outboundCongestionCallsDay']=0x0;_0x34ce18[_0x5df612][_0xf995('0x31')]=0x0;_0x34ce18[_0x5df612][_0xf995('0x32')]=0x0;_0x34ce18[_0x5df612][_0xf995('0x33')]=0x0;_0x34ce18[_0x5df612]['outboundDropCallsDayCallersExit']=0x0;_0x34ce18[_0x5df612][_0xf995('0x34')]=0x0;_0x34ce18[_0x5df612]['outboundOriginateFailureCallsDay']=0x0;_0x34ce18[_0x5df612]['outboundRejectCallsDay']=0x0;_0x34ce18[_0x5df612][_0xf995('0x35')]=0x0;_0x34ce18[_0x5df612][_0xf995('0x36')]=0x0;_0x34ce18[_0x5df612]['outboundAnswerCallsDay']=0x0;_0x34ce18[_0x5df612][_0xf995('0x37')]=!![];}}}}Realtime[_0xf995('0x38')][_0xf995('0x39')]=function(_0x4de411,_0x424785){for(var _0x2ec884 in _0x424785){if(_0x4de411[_0xf995('0x21')](_0x2ec884)){_0x4de411[_0x2ec884]=_0x424785[_0x2ec884];}}};Realtime[_0xf995('0x38')]['initAgents']=function(){var _0x1d1ebc=this;return function(_0x1a589e){if(_0x1a589e){freeIsNotKeyAgent(_0x1a589e,_0x1d1ebc[_0xf995('0xf')]);for(var _0xe7fc36=0x0,_0x23d967={},_0x1c1f31={};_0xe7fc36<_0x1a589e[_0xf995('0x3a')];_0xe7fc36+=0x1){_0x23d967=_0x1a589e[_0xe7fc36];var _0x562b56=_['isNil'](_0x23d967[_0xf995('0x26')])?util['format'](_0xf995('0x25'),_0x23d967[_0xf995('0x23')]):_0x23d967[_0xf995('0x26')];if(_['isUndefined'](_0x1d1ebc['agents'][_0x562b56])){_0x1d1ebc[_0xf995('0xf')][_0x562b56]=new Agent(_0x23d967);}else{_0x1d1ebc[_0xf995('0x39')](_0x1d1ebc['agents'][_0x562b56],_0x23d967);}}}return _0x1d1ebc['agents'];};};Realtime['prototype'][_0xf995('0x3b')]=function(){var _0x3572a1=this;return function(_0x247daa){if(_0x247daa){freeIsNotKeySip(_0x247daa,_0x3572a1[_0xf995('0x10')]);for(var _0x387934=0x0,_0xe3af80={},_0xcb8e6={};_0x387934<_0x247daa[_0xf995('0x3a')];_0x387934+=0x1){_0xe3af80=_0x247daa[_0x387934];if(_[_0xf995('0x3c')](_0x3572a1[_0xf995('0x10')][util[_0xf995('0x22')](_0xf995('0x25'),_0xe3af80[_0xf995('0x23')])])){_0x3572a1[_0xf995('0x10')][util['format'](_0xf995('0x25'),_0xe3af80[_0xf995('0x23')])]=new Telephone(_0xe3af80);}else{_0x3572a1[_0xf995('0x39')](_0x3572a1[_0xf995('0x10')][util[_0xf995('0x22')](_0xf995('0x25'),_0xe3af80[_0xf995('0x23')])],_0xe3af80);}}}return _0x3572a1[_0xf995('0x10')];};};Realtime[_0xf995('0x38')][_0xf995('0x3d')]=function(){var _0x40bfa7=this;return function(_0xea08f){if(_0xea08f){freeIsNotKeySip(_0xea08f,_0x40bfa7[_0xf995('0x3e')]);for(var _0x53e8e3=0x0,_0x367f4b={},_0x17accd={};_0x53e8e3<_0xea08f[_0xf995('0x3a')];_0x53e8e3+=0x1){_0x367f4b=_0xea08f[_0x53e8e3];if(_[_0xf995('0x3c')](_0x40bfa7[_0xf995('0x3e')][util[_0xf995('0x22')]('SIP/%s',_0x367f4b[_0xf995('0x23')])])){_0x40bfa7[_0xf995('0x3e')][util[_0xf995('0x22')](_0xf995('0x25'),_0x367f4b['name'])]=new Trunk(_0x367f4b);}else{_0x40bfa7[_0xf995('0x39')](_0x40bfa7[_0xf995('0x3e')][util['format'](_0xf995('0x25'),_0x367f4b[_0xf995('0x23')])],_0x367f4b);}}}return _0x40bfa7['trunks'];};};Realtime[_0xf995('0x38')][_0xf995('0x3f')]=function(){var _0x19501e=this;return function(_0x58465f){if(_0x58465f){freeIsNotKey(_0x58465f,_0x19501e[_0xf995('0x11')],_0xf995('0x23'));for(var _0x54ca03=0x0,_0x56f708={},_0x3147f8={};_0x54ca03<_0x58465f[_0xf995('0x3a')];_0x54ca03+=0x1){_0x56f708=_0x58465f[_0x54ca03];if(_[_0xf995('0x3c')](_0x19501e['voiceQueues'][_0x56f708[_0xf995('0x23')]])){_0x19501e[_0xf995('0x11')][_0x56f708[_0xf995('0x23')]]=new VoiceQueue(_0x56f708);}else{_0x19501e[_0xf995('0x39')](_0x19501e[_0xf995('0x11')][_0x56f708['name']],_0x56f708);}}}return _0x19501e[_0xf995('0x11')];};};Realtime[_0xf995('0x38')]['initTriggers']=function(){var _0x317b3e=this;return function(_0x47eaa4){if(_0x47eaa4){freeIsNotKey(_0x47eaa4,_0x317b3e['triggers'],'id');for(var _0x22d2e6=0x0,_0x496161={},_0x3cb7e2={};_0x22d2e6<_0x47eaa4['length'];_0x22d2e6+=0x1){_0x496161=_0x47eaa4[_0x22d2e6];if(_[_0xf995('0x3c')](_0x317b3e[_0xf995('0x12')][_0x496161['id']])){_0x317b3e['triggers'][_0x496161['id']]=new Trigger(_0x496161);}else{_0x317b3e[_0xf995('0x39')](_0x317b3e[_0xf995('0x12')][_0x496161['id']],_0x496161);}}}return _0x317b3e[_0xf995('0x12')];};};Realtime[_0xf995('0x38')][_0xf995('0x40')]=function(){var _0x571a68=this;return function(_0x4ac003){if(_0x4ac003){freeIsNotKey(_0x4ac003,_0x571a68['templates'],'id');for(var _0x453aab=0x0,_0x42e79a={},_0x4d9137={};_0x453aab<_0x4ac003[_0xf995('0x3a')];_0x453aab+=0x1){_0x42e79a=_0x4ac003[_0x453aab];if(_['isUndefined'](_0x571a68[_0xf995('0x41')][_0x42e79a['id']])){_0x571a68['templates'][_0x42e79a['id']]=new Template(_0x42e79a);}else{_0x571a68[_0xf995('0x39')](_0x571a68[_0xf995('0x41')][_0x42e79a['id']],_0x42e79a);}}}return _0x571a68[_0xf995('0x41')];};};Realtime['prototype'][_0xf995('0x42')]=function(){var _0x2a5138=this;return function(_0x3f5718){if(_0x3f5718){freeIsNotKey(_0x3f5718,_0x2a5138[_0xf995('0x18')],'id');for(var _0x3d7488=0x0,_0x255508={},_0x3b7d49={};_0x3d7488<_0x3f5718[_0xf995('0x3a')];_0x3d7488+=0x1){_0x255508=_0x3f5718[_0x3d7488];if(_[_0xf995('0x3c')](_0x2a5138['zendeskAccounts'][_0x255508['id']])){_0x2a5138[_0xf995('0x18')][_0x255508['id']]=new ZendeskAccount(_0x255508);}else{_0x2a5138[_0xf995('0x39')](_0x2a5138[_0xf995('0x18')][_0x255508['id']],_0x255508);}}}return _0x2a5138[_0xf995('0x18')];};};Realtime[_0xf995('0x38')][_0xf995('0x43')]=function(){var _0x29f00d=this;return function(_0x34b3bc){if(_0x34b3bc){freeIsNotKey(_0x34b3bc,_0x29f00d[_0xf995('0x19')],'id');for(var _0x20e1d1=0x0,_0x3015b0={},_0x46130f={};_0x20e1d1<_0x34b3bc[_0xf995('0x3a')];_0x20e1d1+=0x1){_0x3015b0=_0x34b3bc[_0x20e1d1];if(_['isUndefined'](_0x29f00d[_0xf995('0x19')][_0x3015b0['id']])){_0x29f00d[_0xf995('0x19')][_0x3015b0['id']]=new SalesforceAccount(_0x3015b0);}else{_0x29f00d[_0xf995('0x39')](_0x29f00d[_0xf995('0x19')][_0x3015b0['id']],_0x3015b0);}}}return _0x29f00d['salesforceAccounts'];};};Realtime[_0xf995('0x38')]['initFreshdeskAccounts']=function(){var _0xddd29c=this;return function(_0x3ad50a){if(_0x3ad50a){freeIsNotKey(_0x3ad50a,_0xddd29c[_0xf995('0x1a')],'id');for(var _0x687b41=0x0,_0x228cfe={},_0x5a0aed={};_0x687b41<_0x3ad50a[_0xf995('0x3a')];_0x687b41+=0x1){_0x228cfe=_0x3ad50a[_0x687b41];if(_[_0xf995('0x3c')](_0xddd29c['freshdeskAccounts'][_0x228cfe['id']])){_0xddd29c[_0xf995('0x1a')][_0x228cfe['id']]=new FreshdeskAccount(_0x228cfe);}else{_0xddd29c[_0xf995('0x39')](_0xddd29c[_0xf995('0x1a')][_0x228cfe['id']],_0x228cfe);}}}return _0xddd29c[_0xf995('0x1a')];};};Realtime[_0xf995('0x38')][_0xf995('0x44')]=function(){var _0x470d92=this;return function(_0x21b0dd){if(_0x21b0dd){freeIsNotKey(_0x21b0dd,_0x470d92[_0xf995('0x1b')],'id');for(var _0x432dac=0x0,_0x14ea9c={},_0x1105be={};_0x432dac<_0x21b0dd[_0xf995('0x3a')];_0x432dac+=0x1){_0x14ea9c=_0x21b0dd[_0x432dac];if(_[_0xf995('0x3c')](_0x470d92[_0xf995('0x1b')][_0x14ea9c['id']])){_0x470d92['zohoAccounts'][_0x14ea9c['id']]=new ZohoAccount(_0x14ea9c);}else{_0x470d92[_0xf995('0x39')](_0x470d92[_0xf995('0x1b')][_0x14ea9c['id']],_0x14ea9c);}}}return _0x470d92['zohoAccounts'];};};Realtime[_0xf995('0x38')][_0xf995('0x45')]=function(){var _0x1b7414=this;return function(_0x26d01e){if(_0x26d01e){freeIsNotKey(_0x26d01e,_0x1b7414[_0xf995('0x1c')],'id');for(var _0x5c3832=0x0,_0x59649d={},_0x4d6242={};_0x5c3832<_0x26d01e[_0xf995('0x3a')];_0x5c3832+=0x1){_0x59649d=_0x26d01e[_0x5c3832];if(_[_0xf995('0x3c')](_0x1b7414[_0xf995('0x1c')][_0x59649d['id']])){_0x1b7414[_0xf995('0x1c')][_0x59649d['id']]=new DeskAccount(_0x59649d);}else{_0x1b7414[_0xf995('0x39')](_0x1b7414[_0xf995('0x1c')][_0x59649d['id']],_0x59649d);}}}return _0x1b7414[_0xf995('0x1c')];};};Realtime[_0xf995('0x38')]['initSugarcrmAccounts']=function(){var _0x4fde74=this;return function(_0x3943e9){if(_0x3943e9){freeIsNotKey(_0x3943e9,_0x4fde74[_0xf995('0x46')],'id');for(var _0x40cc60=0x0,_0x4ae6d5={},_0x194317={};_0x40cc60<_0x3943e9[_0xf995('0x3a')];_0x40cc60+=0x1){_0x4ae6d5=_0x3943e9[_0x40cc60];if(_[_0xf995('0x3c')](_0x4fde74['sugarcrmAccounts'][_0x4ae6d5['id']])){_0x4fde74[_0xf995('0x46')][_0x4ae6d5['id']]=new SugarcrmAccount(_0x4ae6d5);}else{_0x4fde74[_0xf995('0x39')](_0x4fde74[_0xf995('0x46')][_0x4ae6d5['id']],_0x4ae6d5);}}}return _0x4fde74[_0xf995('0x46')];};};Realtime['prototype'][_0xf995('0x47')]=function(){var _0xf055fc=this;return function(_0x25b010){if(_0x25b010){freeIsNotKey(_0x25b010,_0xf055fc[_0xf995('0x48')],'id');for(var _0x515f06=0x0,_0x1f9200={},_0x565771={};_0x515f06<_0x25b010[_0xf995('0x3a')];_0x515f06+=0x1){_0x1f9200=_0x25b010[_0x515f06];if(_[_0xf995('0x3c')](_0xf055fc['vtigerAccounts'][_0x1f9200['id']])){_0xf055fc[_0xf995('0x48')][_0x1f9200['id']]=new VtigerAccount(_0x1f9200);}else{_0xf055fc['mergeFromDatabase'](_0xf055fc[_0xf995('0x48')][_0x1f9200['id']],_0x1f9200);}}}return _0xf055fc[_0xf995('0x48')];};};Realtime['prototype'][_0xf995('0x49')]=function(){var _0x211423=this;return function(_0x1e9c42){if(_0x1e9c42){freeIsNotKey(_0x1e9c42,_0x211423['servicenowAccounts'],'id');for(var _0x3f11f2=0x0,_0x2655a8={},_0x4d8ccc={};_0x3f11f2<_0x1e9c42['length'];_0x3f11f2+=0x1){_0x2655a8=_0x1e9c42[_0x3f11f2];if(_['isUndefined'](_0x211423['servicenowAccounts'][_0x2655a8['id']])){_0x211423[_0xf995('0x1d')][_0x2655a8['id']]=new ServicenowAccount(_0x2655a8);}else{_0x211423[_0xf995('0x39')](_0x211423[_0xf995('0x1d')][_0x2655a8['id']],_0x2655a8);}}}return _0x211423[_0xf995('0x1d')];};};Realtime[_0xf995('0x38')][_0xf995('0x4a')]=function(){var _0x304ce8=this;return function(_0x17095c){if(_0x17095c){freeIsNotKey(_0x17095c,_0x304ce8[_0xf995('0x1e')],'id');for(var _0x560f90=0x0,_0x4bff42={},_0xe78940={};_0x560f90<_0x17095c[_0xf995('0x3a')];_0x560f90+=0x1){_0x4bff42=_0x17095c[_0x560f90];if(_[_0xf995('0x3c')](_0x304ce8[_0xf995('0x1e')][_0x4bff42['id']])){_0x304ce8['dynamics365Accounts'][_0x4bff42['id']]=new Dynamics365Account(_0x4bff42);}else{_0x304ce8[_0xf995('0x39')](_0x304ce8[_0xf995('0x1e')][_0x4bff42['id']],_0x4bff42);}}}return _0x304ce8['dynamics365Accounts'];};};Realtime['prototype'][_0xf995('0x4b')]=function(){var _0x193a0b=this;return function(_0x3a734f){if(_0x3a734f){freeIsNotKey(_0x3a734f,_0x193a0b['freshsalesAccounts'],'id');for(var _0x105736=0x0,_0x51866a={},_0x1ac57d={};_0x105736<_0x3a734f[_0xf995('0x3a')];_0x105736+=0x1){_0x51866a=_0x3a734f[_0x105736];if(_[_0xf995('0x3c')](_0x193a0b['freshsalesAccounts'][_0x51866a['id']])){_0x193a0b[_0xf995('0x4c')][_0x51866a['id']]=new FreshsalesAccount(_0x51866a);}else{_0x193a0b[_0xf995('0x39')](_0x193a0b['freshsalesAccounts'][_0x51866a['id']],_0x51866a);}}}return _0x193a0b[_0xf995('0x4c')];};};Realtime[_0xf995('0x38')][_0xf995('0x4d')]=function(){var _0x4aceb9=this;return function(_0xfbf5d5){for(var _0x1be1dc=0x0;_0x1be1dc<_0xfbf5d5[_0xf995('0x3a')];_0x1be1dc+=0x1){_['merge'](_0x4aceb9[_0xf995('0x11')][_0xfbf5d5[_0x1be1dc]['name']],_0xfbf5d5[_0x1be1dc]);}return _0x4aceb9[_0xf995('0x11')];};};Realtime[_0xf995('0x38')]['initVoiceQueueReports']=function(){var _0x2af574=this;return function(_0x3cb615){clearVoiceQueues(_0x2af574[_0xf995('0x11')]);if(_0x3cb615){_0x3cb615=_[_0xf995('0x4e')](_0x3cb615,_0xf995('0x4f'));for(var _0x1968dd in _0x3cb615){if(_0x3cb615[_0xf995('0x21')](_0x1968dd)){var _0x3baaed={};for(var _0x3e31ad=0x0;_0x3e31ad<_0x3cb615[_0x1968dd][_0xf995('0x3a')];_0x3e31ad+=0x1){var _0x1498c1=_0x3cb615[_0x1968dd][_0x3e31ad]['queue'];if(_0x2af574[_0xf995('0x11')][_0x1498c1]){if(_0x3cb615[_0x1968dd][_0x3e31ad]['queuecallerexit']){_0x2af574['voiceQueues'][_0x1498c1][_0xf995('0x50')]+=0x1;}if(_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x51')]){_0x2af574[_0xf995('0x11')][_0x1498c1][_0xf995('0x2e')]+=0x1;}_0x2af574[_0xf995('0x11')][_0x1498c1][_0xf995('0x2f')]+=moment(_0x3cb615[_0x1968dd][_0x3e31ad]['queuecallerleaveAt'])[_0xf995('0x52')](moment(_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x53')]),_0xf995('0x54'))||0x0;if(_0x3e31ad===_0x3cb615[_0x1968dd][_0xf995('0x3a')]-0x1){_0x2af574['voiceQueues'][_0x1498c1][_0xf995('0x29')]+=moment(_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x55')]||_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x56')]||_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x57')])['diff'](moment(_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x53')]),_0xf995('0x54'))||0x0;_0x2af574[_0xf995('0x11')][_0x1498c1]['total']+=0x1;if(_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x58')]){_0x2af574[_0xf995('0x11')][_0x1498c1][_0xf995('0x28')]+=0x1;_0x2af574[_0xf995('0x11')][_0x1498c1][_0xf995('0x2a')]+=moment(_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x55')])[_0xf995('0x52')](moment(_0x3cb615[_0x1968dd][_0x3e31ad][_0xf995('0x59')]),_0xf995('0x54'))||0x0;}}else{_0x2af574['voiceQueues'][_0x1498c1]['sumDuration']+=_0x2af574[_0xf995('0x11')][_0x1498c1][_0xf995('0x2f')]||0x0;}}}}}}return _0x2af574['voiceQueues'];};};Realtime['prototype'][_0xf995('0x5a')]=function(){var _0x3fe33a=this;return function(_0x4eff7c){clearVoiceCallReports(_0x3fe33a[_0xf995('0x5b')]);if(_0x4eff7c){for(var _0x43b6ac=0x0;_0x43b6ac<_0x4eff7c[_0xf995('0x3a')];_0x43b6ac+=0x1){_0x3fe33a[_0xf995('0x5b')][_0xf995('0x27')]+=0x1;_0x3fe33a[_0xf995('0x5b')]['sumDuration']+=_0x4eff7c[_0x43b6ac]['duration'];if(_0x4eff7c[_0x43b6ac]['disposition']==='ANSWERED'){_0x3fe33a[_0xf995('0x5b')]['answered']+=0x1;_0x3fe33a[_0xf995('0x5b')][_0xf995('0x2f')]+=_0x4eff7c[_0x43b6ac][_0xf995('0x5c')]-_0x4eff7c[_0x43b6ac][_0xf995('0x5d')]||0x0;_0x3fe33a[_0xf995('0x5b')][_0xf995('0x2a')]+=_0x4eff7c[_0x43b6ac][_0xf995('0x5d')];}}}return _0x3fe33a[_0xf995('0x5b')];};};Realtime['prototype'][_0xf995('0x5e')]=function(){var _0x565fbc=this;return function(_0x5f053f){if(_0x5f053f){freeIsNotKey(_0x5f053f,_0x565fbc[_0xf995('0x13')],_0xf995('0x23'));for(var _0x8ee78=0x0,_0x558f0a={};_0x8ee78<_0x5f053f[_0xf995('0x3a')];_0x8ee78+=0x1){_0x558f0a=_0x5f053f[_0x8ee78];if(_[_0xf995('0x3c')](_0x565fbc[_0xf995('0x13')][_0x558f0a[_0xf995('0x23')]])){_0x565fbc[_0xf995('0x13')][_0x558f0a[_0xf995('0x23')]]=new Campaign(_0x558f0a);}else{_0x565fbc[_0xf995('0x39')](_0x565fbc[_0xf995('0x13')][_0x558f0a[_0xf995('0x23')]],_0x558f0a);_0x565fbc[_0xf995('0x13')][_0x558f0a[_0xf995('0x23')]][_0xf995('0x5f')]=_0x558f0a['SquareProject']?_0x558f0a[_0xf995('0x60')][_0xf995('0x23')]:undefined;}}}return _0x565fbc[_0xf995('0x13')];};};Realtime[_0xf995('0x38')]['initVoiceExtensions']=function(){var _0x5427e8=this;return function(_0x540ece){if(_0x540ece){freeIsNotKey(_0x540ece,_0x5427e8[_0xf995('0x14')],'id');for(var _0x1b0114=0x0,_0x16abd8={};_0x1b0114<_0x540ece['length'];_0x1b0114+=0x1){_0x16abd8=_0x540ece[_0x1b0114];if(_[_0xf995('0x3c')](_0x5427e8[_0xf995('0x14')][_0x16abd8['id']])){_0x5427e8[_0xf995('0x14')][_0x16abd8['id']]=new VoiceExtension(_0x16abd8);}else{_0x5427e8[_0xf995('0x39')](_0x5427e8[_0xf995('0x14')][_0x16abd8['id']],_0x16abd8);}}}return _0x5427e8[_0xf995('0x14')];};};Realtime[_0xf995('0x38')][_0xf995('0x61')]=function(){var _0x569c8e=this;return function(_0x445ea0){clearCampaigns(_0x569c8e[_0xf995('0x13')]);for(var _0x37545e=0x0;_0x37545e<_0x445ea0[_0xf995('0x3a')];_0x37545e+=0x1){_['merge'](_0x569c8e[_0xf995('0x13')][_0x445ea0[_0x37545e][_0xf995('0x23')]],_0x445ea0[_0x37545e]);}return _0x569c8e[_0xf995('0x13')];};};Realtime[_0xf995('0x38')]['initFaxAccounts']=function(){var _0x3d96e8=this;return function(_0x1e4cd3){if(_0x1e4cd3){freeIsNotKey(_0x1e4cd3,_0x3d96e8[_0xf995('0x1f')],'id');for(var _0xa57d3d=0x0,_0x58f87e={},_0x4581c2={};_0xa57d3d<_0x1e4cd3['length'];_0xa57d3d+=0x1){_0x58f87e=_0x1e4cd3[_0xa57d3d];if(_[_0xf995('0x3c')](_0x3d96e8[_0xf995('0x1f')][_0x58f87e['id']])){_0x3d96e8[_0xf995('0x1f')][_0x58f87e['id']]=new FaxAccount(_0x58f87e);}else{_0x3d96e8['mergeFromDatabase'](_0x3d96e8[_0xf995('0x1f')][_0x58f87e['id']],_0x58f87e);}}}return _0x3d96e8[_0xf995('0x1f')];};};module[_0xf995('0x62')]=Realtime; \ No newline at end of file +var _0xcb06=['exports','bluebird','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','campaigns','templates','outbound','channels','queueChannels','outboundChannels','zendeskAccounts','freshdeskAccounts','zohoAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','hasOwnProperty','isNil','interface','name','total','answered','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','agents','length','isUndefined','initTelephones','telephones','initTrunks','initTriggers','triggers','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','servicenowAccounts','initDynamics365Accounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercompleteAt','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts'];(function(_0x181e07,_0x248035){var _0x2fae05=function(_0x188eee){while(--_0x188eee){_0x181e07['push'](_0x181e07['shift']());}};_0x2fae05(++_0x248035);}(_0xcb06,0x145));var _0x6cb0=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0xcb06[_0xe4bb3d];return _0xd9e51;};'use strict';var BPromise=require(_0x6cb0('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x6cb0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x6cb0('0x2'));var Trunk=require(_0x6cb0('0x3'));var VoiceQueue=require(_0x6cb0('0x4'));var Trigger=require(_0x6cb0('0x5'));var Template=require(_0x6cb0('0x6'));var Campaign=require(_0x6cb0('0x7'));var VoiceExtension=require(_0x6cb0('0x8'));var ZendeskAccount=require(_0x6cb0('0x9'));var SalesforceAccount=require(_0x6cb0('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x6cb0('0xb'));var ZohoAccount=require(_0x6cb0('0xc'));var DeskAccount=require(_0x6cb0('0xd'));var VtigerAccount=require(_0x6cb0('0xe'));var ServicenowAccount=require(_0x6cb0('0xf'));var Dynamics365Account=require(_0x6cb0('0x10'));var FreshsalesAccount=require(_0x6cb0('0x11'));var FaxAccount=require(_0x6cb0('0x12'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x6cb0('0x13')]={};this[_0x6cb0('0x14')]={};this['triggers']={};this[_0x6cb0('0x15')]={};this[_0x6cb0('0x16')]={};this[_0x6cb0('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x6cb0('0x18')]={};this[_0x6cb0('0x19')]={};this[_0x6cb0('0x1a')]={};this['timers']={};this[_0x6cb0('0x1b')]={};this['salesforceAccounts']={};this['sugarcrmAccounts']={};this[_0x6cb0('0x1c')]={};this[_0x6cb0('0x1d')]={};this['deskAccounts']={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0x6cb0('0x1e')]={};this[_0x6cb0('0x1f')]={};this[_0x6cb0('0x20')]={};};function freeIsNotKey(_0x4fbf37,_0x1cd819,_0x224384){var _0xa8a95e=_[_0x6cb0('0x21')](_0x4fbf37,function(_0x564953,_0x556e59){return _0x564953[_0x224384];});for(var _0x1b2e08 in _0x1cd819){if(_0x1cd819['hasOwnProperty'](_0x1b2e08)){if(!_0xa8a95e[_0x1b2e08]){delete _0x1cd819[_0x1b2e08];}}}}function freeIsNotKeySip(_0x291f66,_0x4354de){var _0x2f6265=_[_0x6cb0('0x21')](_0x291f66,function(_0x4badf0,_0x2281bb){return util[_0x6cb0('0x22')](_0x6cb0('0x23'),_0x4badf0['name']);});for(var _0x1aba81 in _0x4354de){if(_0x4354de[_0x6cb0('0x24')](_0x1aba81)){if(!_0x2f6265[_0x1aba81]){delete _0x4354de[_0x1aba81];}}}}function freeIsNotKeyAgent(_0x3c8ad3,_0x50092b){var _0x1319e8=_['mapKeys'](_0x3c8ad3,function(_0x11e6de,_0x524143){var _0x1bec12=_[_0x6cb0('0x25')](_0x11e6de[_0x6cb0('0x26')])?util[_0x6cb0('0x22')](_0x6cb0('0x23'),_0x11e6de[_0x6cb0('0x27')]):_0x11e6de['interface'];return _0x1bec12;});for(var _0x1bc2dc in _0x50092b){if(_0x50092b[_0x6cb0('0x24')](_0x1bc2dc)){if(!_0x1319e8[_0x1bc2dc]){delete _0x50092b[_0x1bc2dc];}}}}function clearVoiceCallReports(_0x2f84b2){_0x2f84b2[_0x6cb0('0x28')]=0x0;_0x2f84b2[_0x6cb0('0x29')]=0x0;_0x2f84b2['sumHoldTime']=0x0;_0x2f84b2[_0x6cb0('0x2a')]=0x0;_0x2f84b2[_0x6cb0('0x2b')]=0x0;}function clearCampaigns(_0x44be89){if(!_[_0x6cb0('0x2c')](_0x44be89)){for(var _0x45527f in _0x44be89){if(_0x44be89[_0x6cb0('0x24')](_0x45527f)){_0x44be89[_0x45527f][_0x6cb0('0x2d')]=0x0;_0x44be89[_0x45527f]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x55554d){if(!_[_0x6cb0('0x2c')](_0x55554d)){for(var _0x7fc6e in _0x55554d){if(_0x55554d['hasOwnProperty'](_0x7fc6e)){_0x55554d[_0x7fc6e][_0x6cb0('0x28')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x29')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x2e')]=0x0;_0x55554d[_0x7fc6e]['abandoned']=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x2f')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x2a')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x2b')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x30')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x31')]=0x0;_0x55554d[_0x7fc6e]['outboundBusyCallsDay']=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x32')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x33')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x34')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x35')]=0x0;_0x55554d[_0x7fc6e]['outboundDropCallsDayCallersExit']=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x36')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x37')]=0x0;_0x55554d[_0x7fc6e]['outboundRejectCallsDay']=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x38')]=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x30')]=0x0;_0x55554d[_0x7fc6e]['outboundAnswerCallsDay']=0x0;_0x55554d[_0x7fc6e][_0x6cb0('0x39')]=!![];}}}}Realtime['prototype'][_0x6cb0('0x3a')]=function(_0x3067d4,_0x38abf8){for(var _0x57aeba in _0x38abf8){if(_0x3067d4[_0x6cb0('0x24')](_0x57aeba)){_0x3067d4[_0x57aeba]=_0x38abf8[_0x57aeba];}}};Realtime[_0x6cb0('0x3b')]['initAgents']=function(){var _0x4f271e=this;return function(_0x211970){if(_0x211970){freeIsNotKeyAgent(_0x211970,_0x4f271e[_0x6cb0('0x3c')]);for(var _0x3f0f7d=0x0,_0x48fcfd={},_0x531673={};_0x3f0f7d<_0x211970[_0x6cb0('0x3d')];_0x3f0f7d+=0x1){_0x48fcfd=_0x211970[_0x3f0f7d];var _0x100d3d=_[_0x6cb0('0x25')](_0x48fcfd[_0x6cb0('0x26')])?util['format'](_0x6cb0('0x23'),_0x48fcfd['name']):_0x48fcfd['interface'];if(_[_0x6cb0('0x3e')](_0x4f271e[_0x6cb0('0x3c')][_0x100d3d])){_0x4f271e[_0x6cb0('0x3c')][_0x100d3d]=new Agent(_0x48fcfd);}else{_0x4f271e['mergeFromDatabase'](_0x4f271e[_0x6cb0('0x3c')][_0x100d3d],_0x48fcfd);}}}return _0x4f271e[_0x6cb0('0x3c')];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x3f')]=function(){var _0x4f1775=this;return function(_0x3849a2){if(_0x3849a2){freeIsNotKeySip(_0x3849a2,_0x4f1775[_0x6cb0('0x40')]);for(var _0x30daf7=0x0,_0x3d0ccd={},_0x100edc={};_0x30daf7<_0x3849a2[_0x6cb0('0x3d')];_0x30daf7+=0x1){_0x3d0ccd=_0x3849a2[_0x30daf7];if(_[_0x6cb0('0x3e')](_0x4f1775['telephones'][util[_0x6cb0('0x22')]('SIP/%s',_0x3d0ccd[_0x6cb0('0x27')])])){_0x4f1775[_0x6cb0('0x40')][util[_0x6cb0('0x22')](_0x6cb0('0x23'),_0x3d0ccd['name'])]=new Telephone(_0x3d0ccd);}else{_0x4f1775['mergeFromDatabase'](_0x4f1775[_0x6cb0('0x40')][util[_0x6cb0('0x22')](_0x6cb0('0x23'),_0x3d0ccd['name'])],_0x3d0ccd);}}}return _0x4f1775['telephones'];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x41')]=function(){var _0x39e5d0=this;return function(_0x5a68e4){if(_0x5a68e4){freeIsNotKeySip(_0x5a68e4,_0x39e5d0['trunks']);for(var _0x21d810=0x0,_0x1e296a={},_0x5c96c1={};_0x21d810<_0x5a68e4[_0x6cb0('0x3d')];_0x21d810+=0x1){_0x1e296a=_0x5a68e4[_0x21d810];if(_[_0x6cb0('0x3e')](_0x39e5d0[_0x6cb0('0x13')][util[_0x6cb0('0x22')](_0x6cb0('0x23'),_0x1e296a[_0x6cb0('0x27')])])){_0x39e5d0[_0x6cb0('0x13')][util[_0x6cb0('0x22')](_0x6cb0('0x23'),_0x1e296a['name'])]=new Trunk(_0x1e296a);}else{_0x39e5d0['mergeFromDatabase'](_0x39e5d0['trunks'][util[_0x6cb0('0x22')](_0x6cb0('0x23'),_0x1e296a[_0x6cb0('0x27')])],_0x1e296a);}}}return _0x39e5d0[_0x6cb0('0x13')];};};Realtime[_0x6cb0('0x3b')]['initVoiceQueues']=function(){var _0x31b83c=this;return function(_0x113e7f){if(_0x113e7f){freeIsNotKey(_0x113e7f,_0x31b83c[_0x6cb0('0x14')],'name');for(var _0x440898=0x0,_0x2defe6={},_0x9717d={};_0x440898<_0x113e7f[_0x6cb0('0x3d')];_0x440898+=0x1){_0x2defe6=_0x113e7f[_0x440898];if(_[_0x6cb0('0x3e')](_0x31b83c[_0x6cb0('0x14')][_0x2defe6[_0x6cb0('0x27')]])){_0x31b83c['voiceQueues'][_0x2defe6[_0x6cb0('0x27')]]=new VoiceQueue(_0x2defe6);}else{_0x31b83c[_0x6cb0('0x3a')](_0x31b83c[_0x6cb0('0x14')][_0x2defe6[_0x6cb0('0x27')]],_0x2defe6);}}}return _0x31b83c[_0x6cb0('0x14')];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x42')]=function(){var _0x400246=this;return function(_0x12fe15){if(_0x12fe15){freeIsNotKey(_0x12fe15,_0x400246['triggers'],'id');for(var _0x290c97=0x0,_0x1c865e={},_0x15741b={};_0x290c97<_0x12fe15[_0x6cb0('0x3d')];_0x290c97+=0x1){_0x1c865e=_0x12fe15[_0x290c97];if(_[_0x6cb0('0x3e')](_0x400246['triggers'][_0x1c865e['id']])){_0x400246[_0x6cb0('0x43')][_0x1c865e['id']]=new Trigger(_0x1c865e);}else{_0x400246[_0x6cb0('0x3a')](_0x400246[_0x6cb0('0x43')][_0x1c865e['id']],_0x1c865e);}}}return _0x400246[_0x6cb0('0x43')];};};Realtime['prototype']['initTemplates']=function(){var _0x519841=this;return function(_0x28ba4d){if(_0x28ba4d){freeIsNotKey(_0x28ba4d,_0x519841['templates'],'id');for(var _0x59e434=0x0,_0x253a8f={},_0x56912f={};_0x59e434<_0x28ba4d['length'];_0x59e434+=0x1){_0x253a8f=_0x28ba4d[_0x59e434];if(_[_0x6cb0('0x3e')](_0x519841[_0x6cb0('0x16')][_0x253a8f['id']])){_0x519841[_0x6cb0('0x16')][_0x253a8f['id']]=new Template(_0x253a8f);}else{_0x519841[_0x6cb0('0x3a')](_0x519841[_0x6cb0('0x16')][_0x253a8f['id']],_0x253a8f);}}}return _0x519841['templates'];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x44')]=function(){var _0x316e88=this;return function(_0x5f188c){if(_0x5f188c){freeIsNotKey(_0x5f188c,_0x316e88[_0x6cb0('0x1b')],'id');for(var _0x565961=0x0,_0x2e6a5d={},_0x192365={};_0x565961<_0x5f188c[_0x6cb0('0x3d')];_0x565961+=0x1){_0x2e6a5d=_0x5f188c[_0x565961];if(_[_0x6cb0('0x3e')](_0x316e88[_0x6cb0('0x1b')][_0x2e6a5d['id']])){_0x316e88['zendeskAccounts'][_0x2e6a5d['id']]=new ZendeskAccount(_0x2e6a5d);}else{_0x316e88[_0x6cb0('0x3a')](_0x316e88['zendeskAccounts'][_0x2e6a5d['id']],_0x2e6a5d);}}}return _0x316e88[_0x6cb0('0x1b')];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x45')]=function(){var _0x119690=this;return function(_0x5cc502){if(_0x5cc502){freeIsNotKey(_0x5cc502,_0x119690['salesforceAccounts'],'id');for(var _0x2bfa7c=0x0,_0x37bb12={},_0x1cbf30={};_0x2bfa7c<_0x5cc502[_0x6cb0('0x3d')];_0x2bfa7c+=0x1){_0x37bb12=_0x5cc502[_0x2bfa7c];if(_[_0x6cb0('0x3e')](_0x119690[_0x6cb0('0x46')][_0x37bb12['id']])){_0x119690[_0x6cb0('0x46')][_0x37bb12['id']]=new SalesforceAccount(_0x37bb12);}else{_0x119690[_0x6cb0('0x3a')](_0x119690[_0x6cb0('0x46')][_0x37bb12['id']],_0x37bb12);}}}return _0x119690[_0x6cb0('0x46')];};};Realtime['prototype'][_0x6cb0('0x47')]=function(){var _0x2ef75e=this;return function(_0x1cc433){if(_0x1cc433){freeIsNotKey(_0x1cc433,_0x2ef75e[_0x6cb0('0x1c')],'id');for(var _0x28bbd6=0x0,_0x2e8156={},_0x236c22={};_0x28bbd6<_0x1cc433[_0x6cb0('0x3d')];_0x28bbd6+=0x1){_0x2e8156=_0x1cc433[_0x28bbd6];if(_[_0x6cb0('0x3e')](_0x2ef75e[_0x6cb0('0x1c')][_0x2e8156['id']])){_0x2ef75e[_0x6cb0('0x1c')][_0x2e8156['id']]=new FreshdeskAccount(_0x2e8156);}else{_0x2ef75e[_0x6cb0('0x3a')](_0x2ef75e['freshdeskAccounts'][_0x2e8156['id']],_0x2e8156);}}}return _0x2ef75e['freshdeskAccounts'];};};Realtime['prototype'][_0x6cb0('0x48')]=function(){var _0x57478e=this;return function(_0x55df4c){if(_0x55df4c){freeIsNotKey(_0x55df4c,_0x57478e['zohoAccounts'],'id');for(var _0x2657e5=0x0,_0x4292e1={},_0x39646c={};_0x2657e5<_0x55df4c[_0x6cb0('0x3d')];_0x2657e5+=0x1){_0x4292e1=_0x55df4c[_0x2657e5];if(_['isUndefined'](_0x57478e[_0x6cb0('0x1d')][_0x4292e1['id']])){_0x57478e[_0x6cb0('0x1d')][_0x4292e1['id']]=new ZohoAccount(_0x4292e1);}else{_0x57478e[_0x6cb0('0x3a')](_0x57478e[_0x6cb0('0x1d')][_0x4292e1['id']],_0x4292e1);}}}return _0x57478e[_0x6cb0('0x1d')];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x49')]=function(){var _0x12631d=this;return function(_0x26867b){if(_0x26867b){freeIsNotKey(_0x26867b,_0x12631d['deskAccounts'],'id');for(var _0x39c096=0x0,_0x5791d2={},_0x4a22e7={};_0x39c096<_0x26867b[_0x6cb0('0x3d')];_0x39c096+=0x1){_0x5791d2=_0x26867b[_0x39c096];if(_[_0x6cb0('0x3e')](_0x12631d[_0x6cb0('0x4a')][_0x5791d2['id']])){_0x12631d[_0x6cb0('0x4a')][_0x5791d2['id']]=new DeskAccount(_0x5791d2);}else{_0x12631d['mergeFromDatabase'](_0x12631d[_0x6cb0('0x4a')][_0x5791d2['id']],_0x5791d2);}}}return _0x12631d['deskAccounts'];};};Realtime['prototype'][_0x6cb0('0x4b')]=function(){var _0x388343=this;return function(_0x1ffbed){if(_0x1ffbed){freeIsNotKey(_0x1ffbed,_0x388343['sugarcrmAccounts'],'id');for(var _0x1ddd6e=0x0,_0x4e8bbb={},_0xee0617={};_0x1ddd6e<_0x1ffbed[_0x6cb0('0x3d')];_0x1ddd6e+=0x1){_0x4e8bbb=_0x1ffbed[_0x1ddd6e];if(_['isUndefined'](_0x388343['sugarcrmAccounts'][_0x4e8bbb['id']])){_0x388343[_0x6cb0('0x4c')][_0x4e8bbb['id']]=new SugarcrmAccount(_0x4e8bbb);}else{_0x388343[_0x6cb0('0x3a')](_0x388343[_0x6cb0('0x4c')][_0x4e8bbb['id']],_0x4e8bbb);}}}return _0x388343[_0x6cb0('0x4c')];};};Realtime['prototype'][_0x6cb0('0x4d')]=function(){var _0xa87bf2=this;return function(_0x49edb2){if(_0x49edb2){freeIsNotKey(_0x49edb2,_0xa87bf2[_0x6cb0('0x4e')],'id');for(var _0xc18d9c=0x0,_0x28743a={},_0x540793={};_0xc18d9c<_0x49edb2[_0x6cb0('0x3d')];_0xc18d9c+=0x1){_0x28743a=_0x49edb2[_0xc18d9c];if(_[_0x6cb0('0x3e')](_0xa87bf2[_0x6cb0('0x4e')][_0x28743a['id']])){_0xa87bf2['vtigerAccounts'][_0x28743a['id']]=new VtigerAccount(_0x28743a);}else{_0xa87bf2['mergeFromDatabase'](_0xa87bf2['vtigerAccounts'][_0x28743a['id']],_0x28743a);}}}return _0xa87bf2[_0x6cb0('0x4e')];};};Realtime[_0x6cb0('0x3b')]['initServicenowAccounts']=function(){var _0x2ac47f=this;return function(_0x5c38e2){if(_0x5c38e2){freeIsNotKey(_0x5c38e2,_0x2ac47f[_0x6cb0('0x4f')],'id');for(var _0x50c8eb=0x0,_0x44ebb9={},_0x53f2d4={};_0x50c8eb<_0x5c38e2['length'];_0x50c8eb+=0x1){_0x44ebb9=_0x5c38e2[_0x50c8eb];if(_[_0x6cb0('0x3e')](_0x2ac47f[_0x6cb0('0x4f')][_0x44ebb9['id']])){_0x2ac47f[_0x6cb0('0x4f')][_0x44ebb9['id']]=new ServicenowAccount(_0x44ebb9);}else{_0x2ac47f[_0x6cb0('0x3a')](_0x2ac47f[_0x6cb0('0x4f')][_0x44ebb9['id']],_0x44ebb9);}}}return _0x2ac47f[_0x6cb0('0x4f')];};};Realtime['prototype'][_0x6cb0('0x50')]=function(){var _0x432230=this;return function(_0x2a1457){if(_0x2a1457){freeIsNotKey(_0x2a1457,_0x432230[_0x6cb0('0x1e')],'id');for(var _0x32f921=0x0,_0x5dcd69={},_0x281770={};_0x32f921<_0x2a1457['length'];_0x32f921+=0x1){_0x5dcd69=_0x2a1457[_0x32f921];if(_[_0x6cb0('0x3e')](_0x432230[_0x6cb0('0x1e')][_0x5dcd69['id']])){_0x432230[_0x6cb0('0x1e')][_0x5dcd69['id']]=new Dynamics365Account(_0x5dcd69);}else{_0x432230[_0x6cb0('0x3a')](_0x432230[_0x6cb0('0x1e')][_0x5dcd69['id']],_0x5dcd69);}}}return _0x432230[_0x6cb0('0x1e')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x10228f=this;return function(_0x10792b){if(_0x10792b){freeIsNotKey(_0x10792b,_0x10228f[_0x6cb0('0x1f')],'id');for(var _0xab05b1=0x0,_0x28b7d4={},_0x3e7060={};_0xab05b1<_0x10792b[_0x6cb0('0x3d')];_0xab05b1+=0x1){_0x28b7d4=_0x10792b[_0xab05b1];if(_[_0x6cb0('0x3e')](_0x10228f['freshsalesAccounts'][_0x28b7d4['id']])){_0x10228f[_0x6cb0('0x1f')][_0x28b7d4['id']]=new FreshsalesAccount(_0x28b7d4);}else{_0x10228f[_0x6cb0('0x3a')](_0x10228f[_0x6cb0('0x1f')][_0x28b7d4['id']],_0x28b7d4);}}}return _0x10228f[_0x6cb0('0x1f')];};};Realtime[_0x6cb0('0x3b')]['initVoiceQueueHopperHistory']=function(){var _0x522af8=this;return function(_0x2887f4){for(var _0x4a5de0=0x0;_0x4a5de0<_0x2887f4['length'];_0x4a5de0+=0x1){_[_0x6cb0('0x51')](_0x522af8['voiceQueues'][_0x2887f4[_0x4a5de0][_0x6cb0('0x27')]],_0x2887f4[_0x4a5de0]);}return _0x522af8[_0x6cb0('0x14')];};};Realtime['prototype'][_0x6cb0('0x52')]=function(){var _0x58b875=this;return function(_0x30ad39){clearVoiceQueues(_0x58b875[_0x6cb0('0x14')]);if(_0x30ad39){_0x30ad39=_[_0x6cb0('0x53')](_0x30ad39,_0x6cb0('0x54'));for(var _0x192127 in _0x30ad39){if(_0x30ad39[_0x6cb0('0x24')](_0x192127)){var _0x4a2f29={};for(var _0x39f656=0x0;_0x39f656<_0x30ad39[_0x192127][_0x6cb0('0x3d')];_0x39f656+=0x1){var _0x136e7d=_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x55')];if(_0x58b875[_0x6cb0('0x14')][_0x136e7d]){if(_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x56')]){_0x58b875[_0x6cb0('0x14')][_0x136e7d][_0x6cb0('0x2e')]+=0x1;}if(_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x57')]){_0x58b875[_0x6cb0('0x14')][_0x136e7d][_0x6cb0('0x58')]+=0x1;}_0x58b875[_0x6cb0('0x14')][_0x136e7d][_0x6cb0('0x2f')]+=moment(_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x59')])[_0x6cb0('0x5a')](moment(_0x30ad39[_0x192127][_0x39f656]['queuecallerjoinAt']),_0x6cb0('0x5b'))||0x0;if(_0x39f656===_0x30ad39[_0x192127][_0x6cb0('0x3d')]-0x1){_0x58b875[_0x6cb0('0x14')][_0x136e7d][_0x6cb0('0x2a')]+=moment(_0x30ad39[_0x192127][_0x39f656]['queuecallercompleteAt']||_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x5c')]||_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x5d')])[_0x6cb0('0x5a')](moment(_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x5e')]),_0x6cb0('0x5b'))||0x0;_0x58b875[_0x6cb0('0x14')][_0x136e7d]['total']+=0x1;if(_0x30ad39[_0x192127][_0x39f656]['queuecallercomplete']){_0x58b875[_0x6cb0('0x14')][_0x136e7d]['answered']+=0x1;_0x58b875['voiceQueues'][_0x136e7d][_0x6cb0('0x2b')]+=moment(_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x5f')])[_0x6cb0('0x5a')](moment(_0x30ad39[_0x192127][_0x39f656][_0x6cb0('0x59')]),_0x6cb0('0x5b'))||0x0;}}else{_0x58b875[_0x6cb0('0x14')][_0x136e7d]['sumDuration']+=_0x58b875[_0x6cb0('0x14')][_0x136e7d][_0x6cb0('0x2f')]||0x0;}}}}}}return _0x58b875[_0x6cb0('0x14')];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x60')]=function(){var _0x286e99=this;return function(_0x51354c){clearVoiceCallReports(_0x286e99['outbound']);if(_0x51354c){for(var _0x503a0c=0x0;_0x503a0c<_0x51354c[_0x6cb0('0x3d')];_0x503a0c+=0x1){_0x286e99['outbound'][_0x6cb0('0x28')]+=0x1;_0x286e99['outbound'][_0x6cb0('0x2a')]+=_0x51354c[_0x503a0c][_0x6cb0('0x61')];if(_0x51354c[_0x503a0c]['disposition']===_0x6cb0('0x62')){_0x286e99[_0x6cb0('0x17')][_0x6cb0('0x29')]+=0x1;_0x286e99['outbound']['sumHoldTime']+=_0x51354c[_0x503a0c]['duration']-_0x51354c[_0x503a0c][_0x6cb0('0x63')]||0x0;_0x286e99[_0x6cb0('0x17')][_0x6cb0('0x2b')]+=_0x51354c[_0x503a0c][_0x6cb0('0x63')];}}}return _0x286e99[_0x6cb0('0x17')];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x64')]=function(){var _0x33e0a5=this;return function(_0x567f8d){if(_0x567f8d){freeIsNotKey(_0x567f8d,_0x33e0a5['campaigns'],_0x6cb0('0x27'));for(var _0x277b92=0x0,_0x2a983d={};_0x277b92<_0x567f8d[_0x6cb0('0x3d')];_0x277b92+=0x1){_0x2a983d=_0x567f8d[_0x277b92];if(_[_0x6cb0('0x3e')](_0x33e0a5[_0x6cb0('0x15')][_0x2a983d[_0x6cb0('0x27')]])){_0x33e0a5[_0x6cb0('0x15')][_0x2a983d[_0x6cb0('0x27')]]=new Campaign(_0x2a983d);}else{_0x33e0a5[_0x6cb0('0x3a')](_0x33e0a5[_0x6cb0('0x15')][_0x2a983d[_0x6cb0('0x27')]],_0x2a983d);_0x33e0a5[_0x6cb0('0x15')][_0x2a983d[_0x6cb0('0x27')]][_0x6cb0('0x65')]=_0x2a983d[_0x6cb0('0x66')]?_0x2a983d['SquareProject'][_0x6cb0('0x27')]:undefined;}}}return _0x33e0a5[_0x6cb0('0x15')];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x67')]=function(){var _0x48b093=this;return function(_0x73a6e7){if(_0x73a6e7){freeIsNotKey(_0x73a6e7,_0x48b093[_0x6cb0('0x68')],'id');for(var _0x680c85=0x0,_0xd4c62f={};_0x680c85<_0x73a6e7[_0x6cb0('0x3d')];_0x680c85+=0x1){_0xd4c62f=_0x73a6e7[_0x680c85];if(_[_0x6cb0('0x3e')](_0x48b093[_0x6cb0('0x68')][_0xd4c62f['id']])){_0x48b093[_0x6cb0('0x68')][_0xd4c62f['id']]=new VoiceExtension(_0xd4c62f);}else{_0x48b093[_0x6cb0('0x3a')](_0x48b093['voiceExtensions'][_0xd4c62f['id']],_0xd4c62f);}}}return _0x48b093[_0x6cb0('0x68')];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x69')]=function(){var _0x1ec549=this;return function(_0xe50d9d){clearCampaigns(_0x1ec549['campaigns']);for(var _0x27116f=0x0;_0x27116f<_0xe50d9d['length'];_0x27116f+=0x1){_[_0x6cb0('0x51')](_0x1ec549['campaigns'][_0xe50d9d[_0x27116f][_0x6cb0('0x27')]],_0xe50d9d[_0x27116f]);}return _0x1ec549['campaigns'];};};Realtime[_0x6cb0('0x3b')][_0x6cb0('0x6a')]=function(){var _0x2c3d31=this;return function(_0x201cde){if(_0x201cde){freeIsNotKey(_0x201cde,_0x2c3d31['faxAccounts'],'id');for(var _0x487289=0x0,_0x5daac4={},_0x1f5b39={};_0x487289<_0x201cde[_0x6cb0('0x3d')];_0x487289+=0x1){_0x5daac4=_0x201cde[_0x487289];if(_['isUndefined'](_0x2c3d31[_0x6cb0('0x20')][_0x5daac4['id']])){_0x2c3d31[_0x6cb0('0x20')][_0x5daac4['id']]=new FaxAccount(_0x5daac4);}else{_0x2c3d31['mergeFromDatabase'](_0x2c3d31[_0x6cb0('0x20')][_0x5daac4['id']],_0x5daac4);}}}return _0x2c3d31['faxAccounts'];};};module[_0x6cb0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1a0d112..2e7a22f 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 _0xeadb=['../rpc/voiceCallReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','format','SIP/%s','length','findAgent','connectedlinenum','assigned','interface','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','originatecalleridnum','voiceAgentReport','isArray','startsWith','Local','substring','indexOf','mobile','lastIndexOf','exports','bluebird','moment','../../../config/logger','../ami','../rpc/voiceAgentReport'];(function(_0x3f9edd,_0x470eb7){var _0x17efb8=function(_0xa7c9f4){while(--_0xa7c9f4){_0x3f9edd['push'](_0x3f9edd['shift']());}};_0x17efb8(++_0x470eb7);}(_0xeadb,0x9b));var _0xbead=function(_0x284687,_0x41df38){_0x284687=_0x284687-0x0;var _0x20b152=_0xeadb[_0x284687];return _0x20b152;};'use strict';var BPromise=require(_0xbead('0x0'));var _=require('lodash');var moment=require(_0xbead('0x1'));var util=require('util');var config=require('../../../config/environment');var logger=require(_0xbead('0x2'))('ami');var ami=require(_0xbead('0x3'));var RpcVoiceAgentReport=require(_0xbead('0x4'));var RpcVoiceCallReport=require(_0xbead('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xbead('0x6'));var RpcVoiceTransferReport=require(_0xbead('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xbead('0x8'));var VoiceAgentReport=require(_0xbead('0x9'));var VoiceDialReport=require(_0xbead('0xa'));var UserReport=require(_0xbead('0xb'));function Report(_0x34cb23){this[_0xbead('0xc')]=_0x34cb23;this[_0xbead('0xd')]=_0x34cb23[_0xbead('0xd')];this['telephones']=_0x34cb23[_0xbead('0xe')];}Report[_0xbead('0xf')][_0xbead('0x10')]=function(_0x4e413c){var _0x3a198a=new VoiceQueueReport(this[_0xbead('0xc')]);var _0x48f603=new VoiceAgentReport(this[_0xbead('0xc')]);var _0xa1a778=new VoiceDialReport(this[_0xbead('0xc')]);var _0x14df91=new VoiceCallReport(this['realtime']);var _0x10d276=new UserReport(this[_0xbead('0xc')]);if(config[_0xbead('0x11')]&&config['xdr'][_0xbead('0x12')]){ami['on'](_0xbead('0x13'),this[_0xbead('0x14')][_0xbead('0x15')](this));ami['on'](_0xbead('0x16'),this['voiceCallReport'][_0xbead('0x15')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0xbead('0x15')](this));ami['on']('custom:voiceDialReport',this[_0xbead('0x17')][_0xbead('0x15')](this));ami['on'](_0xbead('0x18'),this[_0xbead('0x19')][_0xbead('0x15')](this));ami['on'](_0xbead('0x1a'),this[_0xbead('0x1b')]['bind'](this));}};Report[_0xbead('0xf')]['findAgent']=function(_0x8e0605){var _0x36c637=undefined;_0x36c637=_[_0xbead('0x1c')](this['agents'],function(_0x167d4b){return _0x167d4b[_0xbead('0x1d')]==_0x8e0605||_0x167d4b[_0xbead('0x1e')]==_0x8e0605;});if(_['isNil'](_0x36c637)){var _0x1e1cc3=_['find'](this[_0xbead('0xe')],function(_0x360a08){return _0x360a08[_0xbead('0x1d')]==_0x8e0605||_0x360a08['name']==_0x8e0605;});if(_0x1e1cc3){_0x36c637=_[_0xbead('0x1c')](this[_0xbead('0xd')],function(_0x2ced18){return _0x2ced18['interface']==util[_0xbead('0x1f')](_0xbead('0x20'),_0x1e1cc3[_0xbead('0x1e')]);});}}return _0x36c637;};Report[_0xbead('0xf')][_0xbead('0x14')]=function(_0x524eb5){for(var _0x5ecbb6=0x0;_0x5ecbb6<_0x524eb5[_0xbead('0x21')];_0x5ecbb6+=0x1){var _0x2d9ed1=this[_0xbead('0x22')](_0x524eb5[_0x5ecbb6][_0xbead('0x23')]);if(_0x2d9ed1){_0x524eb5[_0x5ecbb6][_0xbead('0x1d')]=_0x2d9ed1[_0xbead('0x1d')];_0x524eb5[_0x5ecbb6][_0xbead('0x24')]=!![];_0x524eb5[_0x5ecbb6]['lastAssignedTo']=_0x2d9ed1[_0xbead('0x1e')];_0x524eb5[_0x5ecbb6][_0xbead('0x25')]=_[_0xbead('0x26')](_0x2d9ed1[_0xbead('0x25')])?util[_0xbead('0x1f')](_0xbead('0x20'),_0x2d9ed1[_0xbead('0x1e')]):_0x2d9ed1[_0xbead('0x25')];if(_0x524eb5[_0x5ecbb6][_0xbead('0x27')]){_0x524eb5[_0x5ecbb6][_0xbead('0x28')]=moment()[_0xbead('0x1f')](_0xbead('0x29'));}if(_0x524eb5[_0x5ecbb6][_0xbead('0x2a')]){_0x524eb5[_0x5ecbb6]['queuecallerexitAt']=moment()[_0xbead('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xbead('0x14')](_0x524eb5[_0x5ecbb6]);}RpcVoiceQueueReport[_0xbead('0x2b')](_0x524eb5[_0x5ecbb6]);}};function extractCalleridNumber(_0x366bae){var _0xd51262=_0x366bae[_0xbead('0x2c')](/<(.*?)>/);return _0xd51262?_0xd51262[0x1]:_0x366bae;}Report[_0xbead('0xf')]['voiceCallReport']=function(_0xaebbff){_0xaebbff[_0xbead('0x2d')]=_0xaebbff['destination']||_0xaebbff[_0xbead('0x2e')];if(_0xaebbff[_0xbead('0x2f')]==_0xbead('0x30')){_0xaebbff[_0xbead('0x31')]=_0xbead('0x32');_0xaebbff[_0xbead('0x33')]=_0xaebbff['queue'];if(_0xaebbff[_0xbead('0x34')]=='from-voip-provider'){_0xaebbff['accountcode']='';_0xaebbff['destination']=extractCalleridNumber(_0xaebbff[_0xbead('0x35')]);}else if(_0xaebbff[_0xbead('0x34')]==_0xbead('0x36')){if(_0xaebbff[_0xbead('0x2d')]==_0xbead('0x37')){_0xaebbff['destination']=extractCalleridNumber(_0xaebbff[_0xbead('0x38')]);_0xaebbff[_0xbead('0x39')]=_0xaebbff['originatecalleridnum'];_0xaebbff[_0xbead('0x3a')]=[_0xaebbff['channel'],_0xaebbff[_0xbead('0x3b')]=_0xaebbff[_0xbead('0x3a')]][0x0];_0xaebbff[_0xbead('0x35')]=_0xaebbff['calleridpreview'];}else{_0xaebbff[_0xbead('0x2d')]=_0xaebbff[_0xbead('0x39')];_0xaebbff[_0xbead('0x39')]=_0xaebbff['originatecalleridnum'];if(_0xaebbff[_0xbead('0x3c')]==_0xbead('0x3d')){_0xaebbff[_0xbead('0x1d')]=_0xaebbff[_0xbead('0x23')];}else{_0xaebbff[_0xbead('0x1d')]='';}}}}else{_0xaebbff['callerid']=util[_0xbead('0x1f')](_0xbead('0x3e'),_0xaebbff[_0xbead('0x3f')],_0xaebbff[_0xbead('0x39')]);}RpcVoiceCallReport[_0xbead('0x2b')](_0xaebbff);if(_0xaebbff[_0xbead('0x40')]){for(var _0x4fd542=0x0;_0x4fd542<_0xaebbff[_0xbead('0x41')][_0xbead('0x21')];_0x4fd542+=0x1){_0xaebbff[_0xbead('0x42')]=_0xaebbff['monitors'][_0x4fd542]['filename'];_0xaebbff[_0xbead('0x43')]=_0xaebbff[_0xbead('0x41')][_0x4fd542]['createdAt'];if(_0xaebbff['exten']==_0xbead('0x37')){_0xaebbff[_0xbead('0x39')]=_0xaebbff[_0xbead('0x23')];_0xaebbff[_0xbead('0x3f')]=_0xaebbff[_0xbead('0x44')];_0xaebbff[_0xbead('0x23')]=_0xaebbff[_0xbead('0x1d')];_0xaebbff[_0xbead('0x44')]=_0xaebbff[_0xbead('0x45')];_0xaebbff[_0xbead('0x2e')]=_0xaebbff[_0xbead('0x46')];}else if(_0xaebbff[_0xbead('0x2e')]=='xcally-motion-dialer'){_0xaebbff[_0xbead('0x39')]=_0xaebbff['destination'];_0xaebbff[_0xbead('0x2e')]=_0xaebbff['originatecalleridnum'];}RpcVoiceRecording['create'](_0xaebbff);}}};Report['prototype'][_0xbead('0x47')]=function(_0x347388){if(_[_0xbead('0x48')](_0x347388)){_0x347388['forEach'](function(_0x428536){RpcVoiceAgentReport[_0xbead('0x2b')](_0x428536);});}else{RpcVoiceAgentReport[_0xbead('0x2b')](_0x347388);}};Report['prototype'][_0xbead('0x17')]=function(_0x54d138){RpcVoiceDialReport[_0xbead('0x2b')](_0x54d138);var _0x197719=undefined;var _0x3dc3af=_0x54d138[_0xbead('0x3b')];if(_[_0xbead('0x49')](_0x3dc3af,_0xbead('0x4a'))){var _0x500488=_0x3dc3af[_0xbead('0x4b')](_0x3dc3af[_0xbead('0x4c')]('/')+0x1,_0x3dc3af[_0xbead('0x4c')]('@'));_0x197719=_[_0xbead('0x1c')](this[_0xbead('0xd')],function(_0x37851e){return _0x37851e[_0xbead('0x4d')]==_0x500488||_0x37851e['phone']==_0x500488||_0x37851e[_0xbead('0x1d')]==_0x500488;});}else{var _0x500488=_0x3dc3af['substring'](_0x3dc3af[_0xbead('0x4c')]('/')+0x1,_0x3dc3af[_0xbead('0x4e')]('-'));_0x197719=this[_0xbead('0x22')](_0x500488);}if(_0x197719){_0x54d138['interface']=_[_0xbead('0x26')](_0x197719[_0xbead('0x25')])?util['format'](_0xbead('0x20'),_0x197719[_0xbead('0x1e')]):_0x197719[_0xbead('0x25')];_0x54d138['membername']=_0x197719[_0xbead('0x1e')];_0x54d138[_0xbead('0x1d')]=_0x197719[_0xbead('0x1d')];RpcMemberReport['voiceDialReport'](_0x54d138);}};Report[_0xbead('0xf')]['blindTransfer']=function(_0x851b16){RpcVoiceTransferReport[_0xbead('0x19')](_0x851b16);};Report['prototype'][_0xbead('0x1b')]=function(_0x881d02){RpcVoiceTransferReport[_0xbead('0x1b')](_0x881d02);};module[_0xbead('0x4f')]=Report; \ No newline at end of file +var _0xe71d=['ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','accountcode','isNil','find','name','interface','SIP/%s','length','connectedlinenum','queuecallercomplete','queuecallercompleteAt','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','startsWith','Local','indexOf','mobile','substring','lastIndexOf','attendedTransfer','exports','bluebird','lodash','util','../../../config/environment','../../../config/logger'];(function(_0x56dc84,_0x387e9e){var _0x15ab45=function(_0x4ca48f){while(--_0x4ca48f){_0x56dc84['push'](_0x56dc84['shift']());}};_0x15ab45(++_0x387e9e);}(_0xe71d,0xeb));var _0xde71=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe71d[_0x122096];return _0x3d1966;};'use strict';var BPromise=require(_0xde71('0x0'));var _=require(_0xde71('0x1'));var moment=require('moment');var util=require(_0xde71('0x2'));var config=require(_0xde71('0x3'));var logger=require(_0xde71('0x4'))(_0xde71('0x5'));var ami=require(_0xde71('0x6'));var RpcVoiceAgentReport=require(_0xde71('0x7'));var RpcVoiceCallReport=require(_0xde71('0x8'));var RpcVoiceDialReport=require(_0xde71('0x9'));var RpcMemberReport=require(_0xde71('0xa'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xde71('0xb'));var RpcVoiceTransferReport=require(_0xde71('0xc'));var VoiceQueueReport=require(_0xde71('0xd'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xde71('0xe'));var VoiceDialReport=require(_0xde71('0xf'));var UserReport=require('./userReport');function Report(_0x1f944a){this['realtime']=_0x1f944a;this[_0xde71('0x10')]=_0x1f944a['agents'];this[_0xde71('0x11')]=_0x1f944a[_0xde71('0x11')];}Report[_0xde71('0x12')][_0xde71('0x13')]=function(_0xd2c4c2){var _0x18bebe=new VoiceQueueReport(this[_0xde71('0x14')]);var _0x5a4400=new VoiceAgentReport(this[_0xde71('0x14')]);var _0x2e0394=new VoiceDialReport(this[_0xde71('0x14')]);var _0x13af6c=new VoiceCallReport(this[_0xde71('0x14')]);var _0x37928e=new UserReport(this[_0xde71('0x14')]);if(config['xdr']&&config['xdr'][_0xde71('0x15')]){ami['on'](_0xde71('0x16'),this[_0xde71('0x17')][_0xde71('0x18')](this));ami['on']('custom:voiceCallReport',this[_0xde71('0x19')]['bind'](this));ami['on'](_0xde71('0x1a'),this['voiceAgentReport']['bind'](this));ami['on'](_0xde71('0x1b'),this[_0xde71('0x1c')][_0xde71('0x18')](this));ami['on'](_0xde71('0x1d'),this[_0xde71('0x1e')]['bind'](this));ami['on'](_0xde71('0x1f'),this['attendedTransfer']['bind'](this));}};Report[_0xde71('0x12')][_0xde71('0x20')]=function(_0x23791f){var _0x19803a=undefined;_0x19803a=_['find'](this[_0xde71('0x10')],function(_0x1e9963){return _0x1e9963[_0xde71('0x21')]==_0x23791f||_0x1e9963['name']==_0x23791f;});if(_[_0xde71('0x22')](_0x19803a)){var _0x59ae2d=_[_0xde71('0x23')](this[_0xde71('0x11')],function(_0x5e3d52){return _0x5e3d52[_0xde71('0x21')]==_0x23791f||_0x5e3d52[_0xde71('0x24')]==_0x23791f;});if(_0x59ae2d){_0x19803a=_[_0xde71('0x23')](this[_0xde71('0x10')],function(_0x481927){return _0x481927[_0xde71('0x25')]==util['format'](_0xde71('0x26'),_0x59ae2d[_0xde71('0x24')]);});}}return _0x19803a;};Report[_0xde71('0x12')][_0xde71('0x17')]=function(_0x23e90c){for(var _0x5bc59e=0x0;_0x5bc59e<_0x23e90c[_0xde71('0x27')];_0x5bc59e+=0x1){var _0x245bc2=this[_0xde71('0x20')](_0x23e90c[_0x5bc59e][_0xde71('0x28')]);if(_0x245bc2){_0x23e90c[_0x5bc59e]['accountcode']=_0x245bc2[_0xde71('0x21')];_0x23e90c[_0x5bc59e]['assigned']=!![];_0x23e90c[_0x5bc59e]['lastAssignedTo']=_0x245bc2[_0xde71('0x24')];_0x23e90c[_0x5bc59e][_0xde71('0x25')]=_[_0xde71('0x22')](_0x245bc2[_0xde71('0x25')])?util['format']('SIP/%s',_0x245bc2[_0xde71('0x24')]):_0x245bc2['interface'];if(_0x23e90c[_0x5bc59e][_0xde71('0x29')]){_0x23e90c[_0x5bc59e][_0xde71('0x2a')]=moment()[_0xde71('0x2b')](_0xde71('0x2c'));}if(_0x23e90c[_0x5bc59e][_0xde71('0x2d')]){_0x23e90c[_0x5bc59e][_0xde71('0x2e')]=moment()[_0xde71('0x2b')](_0xde71('0x2c'));}RpcMemberReport[_0xde71('0x17')](_0x23e90c[_0x5bc59e]);}RpcVoiceQueueReport[_0xde71('0x2f')](_0x23e90c[_0x5bc59e]);}};function extractCalleridNumber(_0x31dbb4){var _0x9d5af3=_0x31dbb4[_0xde71('0x30')](/<(.*?)>/);return _0x9d5af3?_0x9d5af3[0x1]:_0x31dbb4;}Report[_0xde71('0x12')][_0xde71('0x19')]=function(_0x91ba07){_0x91ba07['destination']=_0x91ba07[_0xde71('0x31')]||_0x91ba07[_0xde71('0x32')];if(_0x91ba07[_0xde71('0x33')]=='dialer'){_0x91ba07['lastapplication']=_0xde71('0x34');_0x91ba07[_0xde71('0x35')]=_0x91ba07[_0xde71('0x34')];if(_0x91ba07[_0xde71('0x36')]==_0xde71('0x37')){_0x91ba07[_0xde71('0x21')]='';_0x91ba07[_0xde71('0x31')]=extractCalleridNumber(_0x91ba07['callerid']);}else if(_0x91ba07[_0xde71('0x36')]==_0xde71('0x38')){if(_0x91ba07[_0xde71('0x31')]==_0xde71('0x39')){_0x91ba07[_0xde71('0x31')]=extractCalleridNumber(_0x91ba07[_0xde71('0x3a')]);_0x91ba07[_0xde71('0x3b')]=_0x91ba07[_0xde71('0x3c')];_0x91ba07['destinationchannel']=[_0x91ba07['channel'],_0x91ba07[_0xde71('0x3d')]=_0x91ba07['destinationchannel']][0x0];_0x91ba07['callerid']=_0x91ba07[_0xde71('0x3a')];}else{_0x91ba07[_0xde71('0x31')]=_0x91ba07[_0xde71('0x3b')];_0x91ba07[_0xde71('0x3b')]=_0x91ba07[_0xde71('0x3c')];if(_0x91ba07['disposition']==_0xde71('0x3e')){_0x91ba07[_0xde71('0x21')]=_0x91ba07[_0xde71('0x28')];}else{_0x91ba07[_0xde71('0x21')]='';}}}}else{_0x91ba07['callerid']=util[_0xde71('0x2b')](_0xde71('0x3f'),_0x91ba07[_0xde71('0x40')],_0x91ba07[_0xde71('0x3b')]);}RpcVoiceCallReport['create'](_0x91ba07);if(_0x91ba07['monitor']){for(var _0x205547=0x0;_0x205547<_0x91ba07[_0xde71('0x41')][_0xde71('0x27')];_0x205547+=0x1){_0x91ba07[_0xde71('0x42')]=_0x91ba07[_0xde71('0x41')][_0x205547][_0xde71('0x43')];_0x91ba07[_0xde71('0x44')]=_0x91ba07[_0xde71('0x41')][_0x205547][_0xde71('0x44')];if(_0x91ba07[_0xde71('0x32')]==_0xde71('0x39')){_0x91ba07[_0xde71('0x3b')]=_0x91ba07['connectedlinenum'];_0x91ba07[_0xde71('0x40')]=_0x91ba07[_0xde71('0x45')];_0x91ba07['connectedlinenum']=_0x91ba07[_0xde71('0x21')];_0x91ba07[_0xde71('0x45')]=_0x91ba07[_0xde71('0x46')];_0x91ba07['exten']=_0x91ba07[_0xde71('0x3c')];}else if(_0x91ba07[_0xde71('0x32')]==_0xde71('0x47')){_0x91ba07[_0xde71('0x3b')]=_0x91ba07[_0xde71('0x31')];_0x91ba07[_0xde71('0x32')]=_0x91ba07['originatecalleridnum'];}RpcVoiceRecording[_0xde71('0x2f')](_0x91ba07);}}};Report[_0xde71('0x12')]['voiceAgentReport']=function(_0x5ddc5e){if(_['isArray'](_0x5ddc5e)){_0x5ddc5e['forEach'](function(_0x1307d0){RpcVoiceAgentReport[_0xde71('0x2f')](_0x1307d0);});}else{RpcVoiceAgentReport['create'](_0x5ddc5e);}};Report[_0xde71('0x12')][_0xde71('0x1c')]=function(_0x295d80){RpcVoiceDialReport['create'](_0x295d80);var _0xfb6958=undefined;var _0x52ccfa=_0x295d80[_0xde71('0x3d')];if(_[_0xde71('0x48')](_0x52ccfa,_0xde71('0x49'))){var _0x49c296=_0x52ccfa['substring'](_0x52ccfa[_0xde71('0x4a')]('/')+0x1,_0x52ccfa['indexOf']('@'));_0xfb6958=_[_0xde71('0x23')](this[_0xde71('0x10')],function(_0x51e2f2){return _0x51e2f2[_0xde71('0x4b')]==_0x49c296||_0x51e2f2['phone']==_0x49c296||_0x51e2f2[_0xde71('0x21')]==_0x49c296;});}else{var _0x49c296=_0x52ccfa[_0xde71('0x4c')](_0x52ccfa['indexOf']('/')+0x1,_0x52ccfa[_0xde71('0x4d')]('-'));_0xfb6958=this[_0xde71('0x20')](_0x49c296);}if(_0xfb6958){_0x295d80[_0xde71('0x25')]=_[_0xde71('0x22')](_0xfb6958['interface'])?util[_0xde71('0x2b')]('SIP/%s',_0xfb6958[_0xde71('0x24')]):_0xfb6958[_0xde71('0x25')];_0x295d80[_0xde71('0x46')]=_0xfb6958[_0xde71('0x24')];_0x295d80[_0xde71('0x21')]=_0xfb6958['accountcode'];RpcMemberReport[_0xde71('0x1c')](_0x295d80);}};Report[_0xde71('0x12')][_0xde71('0x1e')]=function(_0x19f008){RpcVoiceTransferReport[_0xde71('0x1e')](_0x19f008);};Report[_0xde71('0x12')][_0xde71('0x4e')]=function(_0x12d06b){RpcVoiceTransferReport['attendedTransfer'](_0x12d06b);};module[_0xde71('0x4f')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 81f08b9..2a85cd5 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 _0xfd5a=['redis','trunks','agents','telephones','syncRegistry','registry','bind','devicestatechange','peerstatus','syncPeerStatus','resolve','then','actionSipShowRegistry','actionSipPeerStatus','[loopSyncRealTimeShow]','error','prototype','loopSyncRealTimeShow','isNotNull','isUndefined','emit','find','username','stateRegistry','merge','omit','actionid','state','format','trunk:%s','trunk:save','[syncRegistry][UserReport]','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','telephone:%s','name','Queue','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','peer','status','address','[syncPeerStatus][UserReport]','exports','lodash','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami'];(function(_0xc811c7,_0x55e2e2){var _0x27ac3d=function(_0x3c5b1f){while(--_0x3c5b1f){_0xc811c7['push'](_0xc811c7['shift']());}};_0x27ac3d(++_0x55e2e2);}(_0xfd5a,0x76));var _0xafd5=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfd5a[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xafd5('0x0'));var moment=require('moment');var BPromise=require(_0xafd5('0x1'));var util=require(_0xafd5('0x2'));var Redis=require(_0xafd5('0x3'));var config=require(_0xafd5('0x4'));var logger=require(_0xafd5('0x5'))(_0xafd5('0x6'));var ami=require(_0xafd5('0x7'));config[_0xafd5('0x8')]=_['defaults'](config[_0xafd5('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xafd5('0x8')]));function UserReport(_0x24f26b){this[_0xafd5('0x9')]=_0x24f26b[_0xafd5('0x9')];this[_0xafd5('0xa')]=_0x24f26b['agents'];this[_0xafd5('0xb')]=_0x24f26b[_0xafd5('0xb')];ami['on']('registryentry',this[_0xafd5('0xc')]['bind'](this));ami['on'](_0xafd5('0xd'),this[_0xafd5('0xc')][_0xafd5('0xe')](this));ami['on'](_0xafd5('0xf'),this['syncDeviceState'][_0xafd5('0xe')](this));ami['on'](_0xafd5('0x10'),this[_0xafd5('0x11')][_0xafd5('0xe')](this));this['loopSyncRealTimeShow']();return BPromise[_0xafd5('0x12')]()[_0xafd5('0x13')](ami[_0xafd5('0x14')]())[_0xafd5('0x13')](ami['actionDeviceStateList']())[_0xafd5('0x13')](ami[_0xafd5('0x15')]())['catch'](loggerCatch(_0xafd5('0x16')));}function loggerCatch(_0x2be2f3){return function(_0xabed51){logger[_0xafd5('0x17')](_0x2be2f3,util['inspect'](_0xabed51,{'showHidden':![],'depth':null}));};}UserReport[_0xafd5('0x18')][_0xafd5('0x19')]=function(){setInterval(function(){BPromise['resolve']()[_0xafd5('0x13')](ami['actionSipShowRegistry']())[_0xafd5('0x13')](ami['actionDeviceStateList']())[_0xafd5('0x13')](ami['actionSipPeerStatus']())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xafd5('0x18')][_0xafd5('0x1a')]=function(_0xc2158b){return _0xc2158b!==null&&!_[_0xafd5('0x1b')](_0xc2158b);};UserReport['prototype'][_0xafd5('0x1c')]=function(_0x345a91,_0x1699a1,_0xb2f78f){io['to'](_0x345a91)[_0xafd5('0x1c')](_0x1699a1,_0xb2f78f);};UserReport[_0xafd5('0x18')][_0xafd5('0xc')]=function(_0x255d14){try{if(this[_0xafd5('0x1a')](_0x255d14)){var _0x205306=_[_0xafd5('0x1d')](this['trunks'],{'registry':_0x255d14[_0xafd5('0x1e')]});if(_0x205306){_0x255d14[_0xafd5('0x1f')]=_0x255d14['state'];_[_0xafd5('0x20')](_0x205306,_[_0xafd5('0x21')](_0x255d14,['event',_0xafd5('0x22'),_0xafd5('0x1e'),_0xafd5('0x23')]));this[_0xafd5('0x1c')](util[_0xafd5('0x24')](_0xafd5('0x25'),_0x205306['name']),_0xafd5('0x26'),_0x205306);}}}catch(_0x314648){logger[_0xafd5('0x17')](_0xafd5('0x27'),util['inspect'](_0x314648,{'showHidden':![],'depth':null}));}};UserReport[_0xafd5('0x18')][_0xafd5('0x28')]=function(_0x1ac8f9){try{if(this[_0xafd5('0x1a')](_0x1ac8f9)){if(this['agents'][_0x1ac8f9[_0xafd5('0x29')]]){if(!this[_0xafd5('0xa')][_0x1ac8f9[_0xafd5('0x29')]][_0xafd5('0x2a')]||_0x1ac8f9[_0xafd5('0x23')][_0xafd5('0x2b')]()==_0xafd5('0x2c')){this[_0xafd5('0xa')][_0x1ac8f9[_0xafd5('0x29')]][_0xafd5('0x2a')]=![];if(this[_0xafd5('0xa')][_0x1ac8f9[_0xafd5('0x29')]][_0xafd5('0x23')]!==_0x1ac8f9[_0xafd5('0x23')]['toLowerCase']()){this['agents'][_0x1ac8f9['device']][_0xafd5('0x2d')]=_[_0xafd5('0x2e')](moment()[_0xafd5('0x24')]('x'));}this['agents'][_0x1ac8f9[_0xafd5('0x29')]][_0xafd5('0x23')]=_0x1ac8f9[_0xafd5('0x23')][_0xafd5('0x2b')]();this[_0xafd5('0xa')][_0x1ac8f9[_0xafd5('0x29')]]['updateStatusRealtime'](_0x1ac8f9);}}else if(this['telephones'][_0x1ac8f9[_0xafd5('0x29')]]){if(this['telephones'][_0x1ac8f9['device']][_0xafd5('0x23')]!==_0x1ac8f9[_0xafd5('0x23')][_0xafd5('0x2b')]()){this[_0xafd5('0xb')][_0x1ac8f9[_0xafd5('0x29')]]['stateTime']=_[_0xafd5('0x2e')](moment()['format']('x'));}this[_0xafd5('0xb')][_0x1ac8f9[_0xafd5('0x29')]][_0xafd5('0x23')]=_0x1ac8f9[_0xafd5('0x23')][_0xafd5('0x2b')]();this[_0xafd5('0x1c')](util[_0xafd5('0x24')](_0xafd5('0x2f'),this[_0xafd5('0xb')][_0x1ac8f9[_0xafd5('0x29')]][_0xafd5('0x30')]),'telephone:save',this[_0xafd5('0xb')][_0x1ac8f9[_0xafd5('0x29')]]);}else if(this['trunks'][_0x1ac8f9[_0xafd5('0x29')]]){if(this['trunks'][_0x1ac8f9[_0xafd5('0x29')]][_0xafd5('0x23')]!==_0x1ac8f9[_0xafd5('0x23')][_0xafd5('0x2b')]()){this[_0xafd5('0x9')][_0x1ac8f9['device']][_0xafd5('0x2d')]=_['toNumber'](moment()[_0xafd5('0x24')]('x'));}this['trunks'][_0x1ac8f9[_0xafd5('0x29')]][_0xafd5('0x23')]=_0x1ac8f9['state'][_0xafd5('0x2b')]();this[_0xafd5('0x1c')](util['format'](_0xafd5('0x25'),this[_0xafd5('0x9')][_0x1ac8f9[_0xafd5('0x29')]]['name']),_0xafd5('0x26'),this[_0xafd5('0x9')][_0x1ac8f9[_0xafd5('0x29')]]);}else if(_['startsWith'](_0x1ac8f9['device'],_0xafd5('0x31'))){}else if(_[_0xafd5('0x32')](_0x1ac8f9[_0xafd5('0x29')],_0xafd5('0x33'))){var _0x2174e8=_0x1ac8f9[_0xafd5('0x29')];var _0x3f81b9=_0x2174e8[_0xafd5('0x34')](_0x2174e8[_0xafd5('0x35')]('/')+0x1,_0x2174e8[_0xafd5('0x35')]('@'));var _0x28f32b=_[_0xafd5('0x1d')](this[_0xafd5('0xa')],function(_0x3f2a88){return _0x3f2a88[_0xafd5('0x36')]==_0x3f81b9||_0x3f2a88[_0xafd5('0x37')]==_0x3f81b9||_0x3f2a88[_0xafd5('0x38')]==_0x3f81b9;});if(_0x28f32b){if(_0x28f32b['state']!==_0x1ac8f9[_0xafd5('0x23')][_0xafd5('0x2b')]()){_0x28f32b[_0xafd5('0x2d')]=_[_0xafd5('0x2e')](moment()['format']('x'));}_0x28f32b[_0xafd5('0x23')]=_0x1ac8f9[_0xafd5('0x23')][_0xafd5('0x2b')]();_0x28f32b[_0xafd5('0x2a')]=!![];_0x28f32b[_0xafd5('0x39')](_0x1ac8f9);}}else{}}}catch(_0x746977){logger[_0xafd5('0x17')]('[syncDeviceState][UserReport]',util['inspect'](_0x746977,{'showHidden':![],'depth':null}));}};UserReport[_0xafd5('0x18')][_0xafd5('0x11')]=function(_0x2a6f80){try{if(this[_0xafd5('0x1a')](_0x2a6f80)&&this[_0xafd5('0x1a')](_0x2a6f80[_0xafd5('0x10')])){if(this[_0xafd5('0xa')][_0x2a6f80[_0xafd5('0x3a')]]){if(!this['agents'][_0x2a6f80[_0xafd5('0x3a')]][_0xafd5('0x2a')]||_0x2a6f80[_0xafd5('0x10')][_0xafd5('0x2b')]()=='registered'){this['agents'][_0x2a6f80[_0xafd5('0x3a')]]['local']=![];this[_0xafd5('0xa')][_0x2a6f80['peer']][_0xafd5('0x3b')]=_0x2a6f80['peerstatus']['toLowerCase']();this['agents'][_0x2a6f80[_0xafd5('0x3a')]][_0xafd5('0x3c')]=_0x2a6f80[_0xafd5('0x3c')];this[_0xafd5('0xa')][_0x2a6f80[_0xafd5('0x3a')]][_0xafd5('0x39')](_0x2a6f80);}}else if(this['telephones'][_0x2a6f80[_0xafd5('0x3a')]]){this[_0xafd5('0xb')][_0x2a6f80[_0xafd5('0x3a')]][_0xafd5('0x3b')]=_0x2a6f80['peerstatus'][_0xafd5('0x2b')]();this[_0xafd5('0xb')][_0x2a6f80[_0xafd5('0x3a')]]['address']=_0x2a6f80[_0xafd5('0x3c')];this[_0xafd5('0x1c')](util['format'](_0xafd5('0x2f'),this[_0xafd5('0xb')][_0x2a6f80[_0xafd5('0x3a')]]['name']),'telephone:save',this['telephones'][_0x2a6f80['peer']]);}else if(this['trunks'][_0x2a6f80[_0xafd5('0x3a')]]){this[_0xafd5('0x9')][_0x2a6f80[_0xafd5('0x3a')]][_0xafd5('0x3b')]=_0x2a6f80[_0xafd5('0x10')]['toLowerCase']();this[_0xafd5('0x9')][_0x2a6f80[_0xafd5('0x3a')]]['address']=_0x2a6f80[_0xafd5('0x3c')];this[_0xafd5('0x1c')](util[_0xafd5('0x24')](_0xafd5('0x25'),this[_0xafd5('0x9')][_0x2a6f80[_0xafd5('0x3a')]]['name']),_0xafd5('0x26'),this[_0xafd5('0x9')][_0x2a6f80[_0xafd5('0x3a')]]);}else{}}}catch(_0x49a497){logger[_0xafd5('0x17')](_0xafd5('0x3d'),util['inspect'](_0x49a497,{'showHidden':![],'depth':null}));}};module[_0xafd5('0x3e')]=UserReport; \ No newline at end of file +var _0xdd47=['Local','substring','indexOf','mobile','accountcode','[syncDeviceState][UserReport]','peerstatus','peer','status','address','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','agents','telephones','bind','syncRegistry','devicestatechange','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','catch','inspect','prototype','actionSipShowRegistry','[loopSyncRealTimeShow]','emit','isNotNull','find','username','stateRegistry','omit','actionid','state','format','trunk:%s','name','trunk:save','error','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','trunks','startsWith'];(function(_0x44cd60,_0x28843b){var _0x20d129=function(_0x5c0998){while(--_0x5c0998){_0x44cd60['push'](_0x44cd60['shift']());}};_0x20d129(++_0x28843b);}(_0xdd47,0x185));var _0x7dd4=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xdd47[_0x3203a1];return _0x24215e;};'use strict';var _=require(_0x7dd4('0x0'));var moment=require(_0x7dd4('0x1'));var BPromise=require(_0x7dd4('0x2'));var util=require(_0x7dd4('0x3'));var Redis=require(_0x7dd4('0x4'));var config=require(_0x7dd4('0x5'));var logger=require(_0x7dd4('0x6'))('ami');var ami=require(_0x7dd4('0x7'));config[_0x7dd4('0x8')]=_[_0x7dd4('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7dd4('0xa'))(new Redis(config['redis']));function UserReport(_0x13491b){this['trunks']=_0x13491b['trunks'];this[_0x7dd4('0xb')]=_0x13491b[_0x7dd4('0xb')];this[_0x7dd4('0xc')]=_0x13491b[_0x7dd4('0xc')];ami['on']('registryentry',this['syncRegistry'][_0x7dd4('0xd')](this));ami['on']('registry',this[_0x7dd4('0xe')][_0x7dd4('0xd')](this));ami['on'](_0x7dd4('0xf'),this[_0x7dd4('0x10')]['bind'](this));ami['on']('peerstatus',this[_0x7dd4('0x11')][_0x7dd4('0xd')](this));this[_0x7dd4('0x12')]();return BPromise[_0x7dd4('0x13')]()[_0x7dd4('0x14')](ami['actionSipShowRegistry']())[_0x7dd4('0x14')](ami[_0x7dd4('0x15')]())[_0x7dd4('0x14')](ami[_0x7dd4('0x16')]())[_0x7dd4('0x17')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x1bc976){return function(_0x22cf97){logger['error'](_0x1bc976,util[_0x7dd4('0x18')](_0x22cf97,{'showHidden':![],'depth':null}));};}UserReport[_0x7dd4('0x19')][_0x7dd4('0x12')]=function(){setInterval(function(){BPromise[_0x7dd4('0x13')]()['then'](ami[_0x7dd4('0x1a')]())[_0x7dd4('0x14')](ami[_0x7dd4('0x15')]())[_0x7dd4('0x14')](ami[_0x7dd4('0x16')]())[_0x7dd4('0x17')](loggerCatch(_0x7dd4('0x1b')));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x2c6955){return _0x2c6955!==null&&!_['isUndefined'](_0x2c6955);};UserReport[_0x7dd4('0x19')][_0x7dd4('0x1c')]=function(_0x33d372,_0x137e17,_0x23c9d3){io['to'](_0x33d372)[_0x7dd4('0x1c')](_0x137e17,_0x23c9d3);};UserReport['prototype'][_0x7dd4('0xe')]=function(_0x462bfa){try{if(this[_0x7dd4('0x1d')](_0x462bfa)){var _0x6120f8=_[_0x7dd4('0x1e')](this['trunks'],{'registry':_0x462bfa[_0x7dd4('0x1f')]});if(_0x6120f8){_0x462bfa[_0x7dd4('0x20')]=_0x462bfa['state'];_['merge'](_0x6120f8,_[_0x7dd4('0x21')](_0x462bfa,['event',_0x7dd4('0x22'),'username',_0x7dd4('0x23')]));this[_0x7dd4('0x1c')](util[_0x7dd4('0x24')](_0x7dd4('0x25'),_0x6120f8[_0x7dd4('0x26')]),_0x7dd4('0x27'),_0x6120f8);}}}catch(_0x55ac4e){logger[_0x7dd4('0x28')]('[syncRegistry][UserReport]',util[_0x7dd4('0x18')](_0x55ac4e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x7dd4('0x10')]=function(_0x1f2c2d){try{if(this[_0x7dd4('0x1d')](_0x1f2c2d)){if(this[_0x7dd4('0xb')][_0x1f2c2d[_0x7dd4('0x29')]]){if(!this['agents'][_0x1f2c2d['device']][_0x7dd4('0x2a')]||_0x1f2c2d[_0x7dd4('0x23')][_0x7dd4('0x2b')]()==_0x7dd4('0x2c')){this['agents'][_0x1f2c2d[_0x7dd4('0x29')]][_0x7dd4('0x2a')]=![];if(this[_0x7dd4('0xb')][_0x1f2c2d[_0x7dd4('0x29')]][_0x7dd4('0x23')]!==_0x1f2c2d[_0x7dd4('0x23')]['toLowerCase']()){this[_0x7dd4('0xb')][_0x1f2c2d[_0x7dd4('0x29')]][_0x7dd4('0x2d')]=_[_0x7dd4('0x2e')](moment()[_0x7dd4('0x24')]('x'));}this[_0x7dd4('0xb')][_0x1f2c2d[_0x7dd4('0x29')]][_0x7dd4('0x23')]=_0x1f2c2d['state'][_0x7dd4('0x2b')]();this[_0x7dd4('0xb')][_0x1f2c2d['device']][_0x7dd4('0x2f')](_0x1f2c2d);}}else if(this['telephones'][_0x1f2c2d[_0x7dd4('0x29')]]){if(this[_0x7dd4('0xc')][_0x1f2c2d['device']][_0x7dd4('0x23')]!==_0x1f2c2d['state'][_0x7dd4('0x2b')]()){this[_0x7dd4('0xc')][_0x1f2c2d['device']][_0x7dd4('0x2d')]=_[_0x7dd4('0x2e')](moment()[_0x7dd4('0x24')]('x'));}this[_0x7dd4('0xc')][_0x1f2c2d[_0x7dd4('0x29')]][_0x7dd4('0x23')]=_0x1f2c2d[_0x7dd4('0x23')][_0x7dd4('0x2b')]();this[_0x7dd4('0x1c')](util[_0x7dd4('0x24')](_0x7dd4('0x30'),this[_0x7dd4('0xc')][_0x1f2c2d['device']]['name']),_0x7dd4('0x31'),this[_0x7dd4('0xc')][_0x1f2c2d[_0x7dd4('0x29')]]);}else if(this[_0x7dd4('0x32')][_0x1f2c2d['device']]){if(this['trunks'][_0x1f2c2d[_0x7dd4('0x29')]][_0x7dd4('0x23')]!==_0x1f2c2d[_0x7dd4('0x23')][_0x7dd4('0x2b')]()){this[_0x7dd4('0x32')][_0x1f2c2d[_0x7dd4('0x29')]]['stateTime']=_['toNumber'](moment()[_0x7dd4('0x24')]('x'));}this[_0x7dd4('0x32')][_0x1f2c2d['device']][_0x7dd4('0x23')]=_0x1f2c2d[_0x7dd4('0x23')][_0x7dd4('0x2b')]();this[_0x7dd4('0x1c')](util[_0x7dd4('0x24')]('trunk:%s',this[_0x7dd4('0x32')][_0x1f2c2d['device']][_0x7dd4('0x26')]),_0x7dd4('0x27'),this[_0x7dd4('0x32')][_0x1f2c2d['device']]);}else if(_[_0x7dd4('0x33')](_0x1f2c2d['device'],'Queue')){}else if(_[_0x7dd4('0x33')](_0x1f2c2d[_0x7dd4('0x29')],_0x7dd4('0x34'))){var _0xe0f8bc=_0x1f2c2d['device'];var _0x7d8dc=_0xe0f8bc[_0x7dd4('0x35')](_0xe0f8bc['indexOf']('/')+0x1,_0xe0f8bc[_0x7dd4('0x36')]('@'));var _0x8f22f0=_[_0x7dd4('0x1e')](this[_0x7dd4('0xb')],function(_0x205ff4){return _0x205ff4[_0x7dd4('0x37')]==_0x7d8dc||_0x205ff4['phone']==_0x7d8dc||_0x205ff4[_0x7dd4('0x38')]==_0x7d8dc;});if(_0x8f22f0){if(_0x8f22f0['state']!==_0x1f2c2d['state']['toLowerCase']()){_0x8f22f0[_0x7dd4('0x2d')]=_[_0x7dd4('0x2e')](moment()[_0x7dd4('0x24')]('x'));}_0x8f22f0[_0x7dd4('0x23')]=_0x1f2c2d[_0x7dd4('0x23')]['toLowerCase']();_0x8f22f0[_0x7dd4('0x2a')]=!![];_0x8f22f0[_0x7dd4('0x2f')](_0x1f2c2d);}}else{}}}catch(_0x1a1556){logger[_0x7dd4('0x28')](_0x7dd4('0x39'),util[_0x7dd4('0x18')](_0x1a1556,{'showHidden':![],'depth':null}));}};UserReport[_0x7dd4('0x19')][_0x7dd4('0x11')]=function(_0x5827f1){try{if(this[_0x7dd4('0x1d')](_0x5827f1)&&this['isNotNull'](_0x5827f1[_0x7dd4('0x3a')])){if(this['agents'][_0x5827f1['peer']]){if(!this[_0x7dd4('0xb')][_0x5827f1[_0x7dd4('0x3b')]][_0x7dd4('0x2a')]||_0x5827f1['peerstatus'][_0x7dd4('0x2b')]()=='registered'){this[_0x7dd4('0xb')][_0x5827f1[_0x7dd4('0x3b')]][_0x7dd4('0x2a')]=![];this[_0x7dd4('0xb')][_0x5827f1['peer']][_0x7dd4('0x3c')]=_0x5827f1[_0x7dd4('0x3a')][_0x7dd4('0x2b')]();this[_0x7dd4('0xb')][_0x5827f1['peer']][_0x7dd4('0x3d')]=_0x5827f1[_0x7dd4('0x3d')];this[_0x7dd4('0xb')][_0x5827f1[_0x7dd4('0x3b')]][_0x7dd4('0x2f')](_0x5827f1);}}else if(this[_0x7dd4('0xc')][_0x5827f1[_0x7dd4('0x3b')]]){this['telephones'][_0x5827f1[_0x7dd4('0x3b')]][_0x7dd4('0x3c')]=_0x5827f1[_0x7dd4('0x3a')][_0x7dd4('0x2b')]();this[_0x7dd4('0xc')][_0x5827f1[_0x7dd4('0x3b')]][_0x7dd4('0x3d')]=_0x5827f1[_0x7dd4('0x3d')];this['emit'](util['format'](_0x7dd4('0x30'),this[_0x7dd4('0xc')][_0x5827f1[_0x7dd4('0x3b')]]['name']),'telephone:save',this[_0x7dd4('0xc')][_0x5827f1['peer']]);}else if(this[_0x7dd4('0x32')][_0x5827f1[_0x7dd4('0x3b')]]){this['trunks'][_0x5827f1['peer']][_0x7dd4('0x3c')]=_0x5827f1[_0x7dd4('0x3a')]['toLowerCase']();this[_0x7dd4('0x32')][_0x5827f1[_0x7dd4('0x3b')]]['address']=_0x5827f1[_0x7dd4('0x3d')];this[_0x7dd4('0x1c')](util['format'](_0x7dd4('0x25'),this[_0x7dd4('0x32')][_0x5827f1[_0x7dd4('0x3b')]][_0x7dd4('0x26')]),_0x7dd4('0x27'),this[_0x7dd4('0x32')][_0x5827f1[_0x7dd4('0x3b')]]);}else{}}}catch(_0x15e1f7){logger[_0x7dd4('0x28')](_0x7dd4('0x3e'),util['inspect'](_0x15e1f7,{'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 a17c42f..536f6c4 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 _0xbf44=['exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','voiceQueues','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','custom:agentconnect','reason','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','agentringnoanswerAt','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','acw','acwtime','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','includes','custom:voiceAgentReport','values','transfereeuniqueid','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','[syncMusicOnHoldStart][VoiceAgentReport]','onhold','[syncMusicOnHoldStop][VoiceAgentReport]'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbf44,0x18a));var _0x4bf4=function(_0x21874a,_0x26f3f7){_0x21874a=_0x21874a-0x0;var _0x10b825=_0xbf44[_0x21874a];return _0x10b825;};'use strict';var _=require(_0x4bf4('0x0'));var moment=require(_0x4bf4('0x1'));var util=require('util');var Redis=require(_0x4bf4('0x2'));var config=require(_0x4bf4('0x3'));var logger=require(_0x4bf4('0x4'))(_0x4bf4('0x5'));var ami=require(_0x4bf4('0x6'));config['redis']=_[_0x4bf4('0x7')](config[_0x4bf4('0x8')],{'host':_0x4bf4('0x9'),'port':0x18eb});var io=require(_0x4bf4('0xa'))(new Redis(config[_0x4bf4('0x8')]));function VoiceAgentReport(_0x2aee4d){this[_0x4bf4('0xb')]={};this['voiceQueues']=_0x2aee4d['voiceQueues'];this[_0x4bf4('0xc')]=_0x2aee4d[_0x4bf4('0xc')];this[_0x4bf4('0xd')]={};ami['on'](_0x4bf4('0xe'),this[_0x4bf4('0xf')][_0x4bf4('0x10')](this));ami['on']('agentconnect',this[_0x4bf4('0x11')][_0x4bf4('0x10')](this));ami['on'](_0x4bf4('0x12'),this[_0x4bf4('0x13')][_0x4bf4('0x10')](this));ami['on'](_0x4bf4('0x14'),this[_0x4bf4('0x15')][_0x4bf4('0x10')](this));ami['on'](_0x4bf4('0x16'),this[_0x4bf4('0x17')][_0x4bf4('0x10')](this));ami['on'](_0x4bf4('0x18'),this['syncVarSet'][_0x4bf4('0x10')](this));ami['on'](_0x4bf4('0x19'),this[_0x4bf4('0x1a')][_0x4bf4('0x10')](this));ami['on'](_0x4bf4('0x1b'),this[_0x4bf4('0x1c')][_0x4bf4('0x10')](this));ami['on'](_0x4bf4('0x1d'),this[_0x4bf4('0x1e')][_0x4bf4('0x10')](this));ami['on']('attendedtransfer',this[_0x4bf4('0x1f')]['bind'](this));ami['on'](_0x4bf4('0x20'),this['syncBlindTransfer'][_0x4bf4('0x10')](this));}VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0x22')]=function(_0x248e20,_0x2a8e47,_0x1b41bd){io['to'](_0x248e20)[_0x4bf4('0x22')](_0x2a8e47,_0x1b41bd);};VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0x23')]=function(_0xdb4cf9){return _0xdb4cf9!==null&&!_['isUndefined'](_0xdb4cf9);};VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0xf')]=function(_0x1af775){try{if(this['isNotNull'](_0x1af775)){if(_[_0x4bf4('0x24')](this[_0x4bf4('0xb')][_0x1af775[_0x4bf4('0x25')]])){this[_0x4bf4('0xb')][_0x1af775[_0x4bf4('0x25')]]={};}if(_[_0x4bf4('0x24')](this['channels'][_0x1af775[_0x4bf4('0x25')]][_0x1af775[_0x4bf4('0x26')]])){this[_0x4bf4('0xb')][_0x1af775[_0x4bf4('0x25')]][_0x1af775['destuniqueid']]={'agentcalledAt':moment()[_0x4bf4('0x27')](_0x4bf4('0x28')),'lastevent':_0x4bf4('0x29'),'variables':this[_0x4bf4('0xd')][_0x1af775[_0x4bf4('0x25')]],'type':this[_0x4bf4('0x2a')][_0x1af775['queue']]?this[_0x4bf4('0x2a')][_0x1af775[_0x4bf4('0x2b')]][_0x4bf4('0x2c')]||_0x4bf4('0x2d'):'inbound'};}_[_0x4bf4('0x2e')](this[_0x4bf4('0xb')][_0x1af775['uniqueid']][_0x1af775[_0x4bf4('0x26')]],_[_0x4bf4('0x2f')](_0x1af775,[_0x4bf4('0x30'),_0x4bf4('0x31')]));ami[_0x4bf4('0x22')](_0x4bf4('0x32'),this[_0x4bf4('0xb')][_0x1af775[_0x4bf4('0x25')]][_0x1af775[_0x4bf4('0x26')]]);this['emit'](util['format'](_0x4bf4('0x33'),_0x1af775[_0x4bf4('0x34')]),_0x4bf4('0x35'),this[_0x4bf4('0xb')][_0x1af775[_0x4bf4('0x25')]][_0x1af775[_0x4bf4('0x26')]]);}}catch(_0x4c978e){logger[_0x4bf4('0x36')](_0x4bf4('0x37'),util[_0x4bf4('0x38')](_0x4c978e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0x11')]=function(_0x3449c1){try{if(this[_0x4bf4('0x23')](_0x3449c1)){if(this['channels'][_0x3449c1[_0x4bf4('0x25')]]){for(var _0x77b6a6 in this['channels'][_0x3449c1['uniqueid']]){if(this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x4bf4('0x39')](_0x77b6a6)){if(_0x3449c1['destuniqueid']===_0x77b6a6){this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x3a')]=moment()[_0x4bf4('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6]['lastevent']=_0x4bf4('0x3b');this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x3c')]=_0x3449c1[_0x4bf4('0x3c')];this[_0x4bf4('0xb')][_0x3449c1['uniqueid']][_0x77b6a6][_0x4bf4('0x3d')]=_0x3449c1['connectedlinenum'];this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6]['connectedlinename']=_0x3449c1[_0x4bf4('0x3e')];this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x3f')]=_0x3449c1['destchannelstate'];this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x40')]=_0x3449c1['destchannelstatedesc'];_['merge'](this[_0x4bf4('0xc')][_0x3449c1[_0x4bf4('0x41')]],_[_0x4bf4('0x42')](_0x3449c1,[_0x4bf4('0x2b'),'destconnectedlinenum']));this[_0x4bf4('0x22')](util[_0x4bf4('0x27')]('user:%s',_0x3449c1[_0x4bf4('0x34')]),'user:agentconnect',this[_0x4bf4('0xb')][_0x3449c1['uniqueid']][_0x3449c1[_0x4bf4('0x26')]]);ami[_0x4bf4('0x22')](_0x4bf4('0x43'),this[_0x4bf4('0xb')][_0x3449c1['uniqueid']][_0x77b6a6]);}else if(!this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x12')]&&!this['channels'][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6]['agentcomplete']){this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x12')]=!![];this['channels'][_0x3449c1['uniqueid']][_0x77b6a6]['agentringnoanswerAt']=moment()[_0x4bf4('0x27')](_0x4bf4('0x28'));this[_0x4bf4('0xb')][_0x3449c1['uniqueid']][_0x77b6a6][_0x4bf4('0x44')]='answered_elsewhere';this['channels'][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x45')]=_0x4bf4('0x46');this['channels'][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x47')]=_0x3449c1[_0x4bf4('0x26')];this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6][_0x4bf4('0x48')]=_0x3449c1[_0x4bf4('0x34')];ami[_0x4bf4('0x22')]('custom:agentansweredelsewhere',this[_0x4bf4('0xb')][_0x3449c1[_0x4bf4('0x25')]][_0x77b6a6]);}}}}}}catch(_0x1546fb){logger[_0x4bf4('0x36')](_0x4bf4('0x49'),util[_0x4bf4('0x38')](_0x1546fb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4bf4('0x13')]=function(_0x9ec550){try{if(this[_0x4bf4('0x23')](_0x9ec550)){if(this[_0x4bf4('0xb')][_0x9ec550[_0x4bf4('0x25')]]&&this[_0x4bf4('0xb')][_0x9ec550['uniqueid']][_0x9ec550[_0x4bf4('0x26')]]){this[_0x4bf4('0xb')][_0x9ec550['uniqueid']][_0x9ec550['destuniqueid']][_0x4bf4('0x12')]=!![];this['channels'][_0x9ec550['uniqueid']][_0x9ec550[_0x4bf4('0x26')]]['agentringnoanswerAt']=moment()['format'](_0x4bf4('0x28'));this[_0x4bf4('0xb')][_0x9ec550['uniqueid']][_0x9ec550[_0x4bf4('0x26')]][_0x4bf4('0x44')]=_0x4bf4('0x4a');this[_0x4bf4('0xb')][_0x9ec550['uniqueid']][_0x9ec550[_0x4bf4('0x26')]][_0x4bf4('0x45')]=_0x4bf4('0x4a');ami[_0x4bf4('0x22')](_0x4bf4('0x4b'),this['channels'][_0x9ec550[_0x4bf4('0x25')]][_0x9ec550[_0x4bf4('0x26')]]);}}}catch(_0x230f16){logger[_0x4bf4('0x36')](_0x4bf4('0x4c'),util['inspect'](_0x230f16,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0x15')]=function(_0x553e17){try{if(this[_0x4bf4('0x23')](_0x553e17)){if(this['channels'][_0x553e17[_0x4bf4('0x25')]]){for(var _0x267b80 in this[_0x4bf4('0xb')][_0x553e17[_0x4bf4('0x25')]]){if(this[_0x4bf4('0xb')][_0x553e17['uniqueid']][_0x4bf4('0x39')](_0x267b80)&&!this[_0x4bf4('0xb')][_0x553e17[_0x4bf4('0x25')]][_0x267b80][_0x4bf4('0x12')]&&!this['channels'][_0x553e17[_0x4bf4('0x25')]][_0x267b80][_0x4bf4('0x16')]){this[_0x4bf4('0xb')][_0x553e17['uniqueid']][_0x267b80][_0x4bf4('0x12')]=!![];this[_0x4bf4('0xb')][_0x553e17[_0x4bf4('0x25')]][_0x267b80][_0x4bf4('0x4d')]=moment()[_0x4bf4('0x27')](_0x4bf4('0x28'));this[_0x4bf4('0xb')][_0x553e17[_0x4bf4('0x25')]][_0x267b80]['reason']=_0x4bf4('0x4e');this[_0x4bf4('0xb')][_0x553e17[_0x4bf4('0x25')]][_0x267b80]['lastevent']='abandoned';ami[_0x4bf4('0x22')](_0x4bf4('0x4f'),this['channels'][_0x553e17[_0x4bf4('0x25')]][_0x267b80]);}}}}}catch(_0x3dab28){logger[_0x4bf4('0x36')](_0x4bf4('0x50'),util[_0x4bf4('0x38')](_0x3dab28,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4bf4('0x21')]['syncAgentComplete']=function(_0x287eb9){try{if(this[_0x4bf4('0x23')](_0x287eb9)){if(this['channels'][_0x287eb9[_0x4bf4('0x25')]]){for(var _0x4f76d0 in this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]]){if(this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4bf4('0x39')](_0x4f76d0)){if(this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0]['agentconnectAt']&&!this['channels'][_0x287eb9['uniqueid']][_0x4f76d0][_0x4bf4('0x16')]){this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0][_0x4bf4('0x16')]=!![];this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0][_0x4bf4('0x51')]=moment()[_0x4bf4('0x27')](_0x4bf4('0x28'));this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0][_0x4bf4('0x45')]=_0x4bf4('0x52');this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0]['talktime']=_0x287eb9[_0x4bf4('0x53')];this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0][_0x4bf4('0x44')]=_0x287eb9['reason']==_0x4bf4('0x54')?_0x4bf4('0x55'):_0x287eb9[_0x4bf4('0x44')];if(this['voiceQueues'][_0x287eb9['queue']]&&this[_0x4bf4('0x2a')][_0x287eb9[_0x4bf4('0x2b')]][_0x4bf4('0x56')]){this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0]['agentacw']=!![];this[_0x4bf4('0xb')][_0x287eb9['uniqueid']][_0x4f76d0][_0x4bf4('0x57')]=this[_0x4bf4('0x2a')][_0x287eb9['queue']]['acwTimeout'];}this['agents'][_0x287eb9[_0x4bf4('0x41')]]=_[_0x4bf4('0x2f')](this['agents'][_0x287eb9[_0x4bf4('0x41')]],[_0x4bf4('0x2b'),'destconnectedlinenum']);this[_0x4bf4('0x22')](util[_0x4bf4('0x27')](_0x4bf4('0x33'),_0x287eb9[_0x4bf4('0x34')]),_0x4bf4('0x58'),this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0]);ami[_0x4bf4('0x22')](_0x4bf4('0x59'),this[_0x4bf4('0xb')][_0x287eb9[_0x4bf4('0x25')]][_0x4f76d0]);}}}}}}catch(_0x114e8e){logger[_0x4bf4('0x36')](_0x4bf4('0x5a'),util[_0x4bf4('0x38')](_0x114e8e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0x5b')]=function(_0x278457){try{if(this[_0x4bf4('0x23')](_0x278457)){this[_0x4bf4('0x5c')](_0x278457[_0x4bf4('0x25')],_[_0x4bf4('0x5d')](_0x278457[_0x4bf4('0x5e')])[0x0],_0x278457[_0x4bf4('0x5f')]);if(this[_0x4bf4('0xb')][_0x278457['uniqueid']]){for(var _0x775321 in this[_0x4bf4('0xb')][_0x278457[_0x4bf4('0x25')]]){if(this[_0x4bf4('0xb')][_0x278457['uniqueid']][_0x4bf4('0x39')](_0x775321)){if(_[_0x4bf4('0x24')](this[_0x4bf4('0xb')][_0x278457['uniqueid']][_0x775321][_0x4bf4('0xd')])){this[_0x4bf4('0xb')][_0x278457['uniqueid']][_0x775321]['variables']={};}this[_0x4bf4('0xb')][_0x278457[_0x4bf4('0x25')]][_0x775321]['variables']=this['variables'][_0x278457[_0x4bf4('0x25')]];}}}}}catch(_0x5dea6c){logger[_0x4bf4('0x36')](_0x4bf4('0x60'),util['inspect'](_0x5dea6c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4bf4('0x5c')]=function(_0x21693f,_0x433a67,_0x1f8e24){var _0x3b2200=[_0x4bf4('0x61'),_0x4bf4('0x62'),_0x4bf4('0x63'),_0x4bf4('0x64'),_0x4bf4('0x65'),_0x4bf4('0x66'),_0x4bf4('0x67'),_0x4bf4('0x68'),_0x4bf4('0x69'),_0x4bf4('0x6a'),_0x4bf4('0x6b'),_0x4bf4('0x6c'),_0x4bf4('0x6d'),'memberdynamic','memberinterface',_0x4bf4('0x6e'),_0x4bf4('0x34'),_0x4bf4('0x6f'),_0x4bf4('0x70')];if(!_['isNil'](_0x433a67)&&!_[_0x4bf4('0x71')](_0x3b2200,_0x433a67)){if(_[_0x4bf4('0x24')](this[_0x4bf4('0xd')][_0x21693f])){this['variables'][_0x21693f]={};}this[_0x4bf4('0xd')][_0x21693f][_0x433a67]=_0x1f8e24;}};VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0x1a')]=function(_0x23cf8a){try{if(this['isNotNull'](_0x23cf8a)){if(this[_0x4bf4('0xb')][_0x23cf8a['uniqueid']]){for(var _0x3052c4 in this[_0x4bf4('0xb')][_0x23cf8a[_0x4bf4('0x25')]]){if(this[_0x4bf4('0xb')][_0x23cf8a[_0x4bf4('0x25')]][_0x4bf4('0x39')](_0x3052c4)){if(this['channels'][_0x23cf8a['uniqueid']][_0x3052c4][_0x4bf4('0x44')]==_0x4bf4('0x54')&&this[_0x4bf4('0xb')][_0x23cf8a[_0x4bf4('0x25')]][_0x3052c4]['agentcomplete']){this['channels'][_0x23cf8a[_0x4bf4('0x25')]][_0x3052c4][_0x4bf4('0x51')]=moment()[_0x4bf4('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0x4bf4('0x22')](_0x4bf4('0x72'),_[_0x4bf4('0x73')](this[_0x4bf4('0xb')][_0x23cf8a[_0x4bf4('0x25')]]));delete this[_0x4bf4('0xb')][_0x23cf8a[_0x4bf4('0x25')]];}if(this['variables'][_0x23cf8a[_0x4bf4('0x25')]]){delete this[_0x4bf4('0xd')][_0x23cf8a['uniqueid']];}}}catch(_0x30dd17){logger[_0x4bf4('0x36')]('[syncHangup][VoiceAgentReport]',util[_0x4bf4('0x38')](_0x30dd17,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4bf4('0x21')]['syncAttendedTransfer']=function(_0x172dd9){try{if(this['isNotNull'](_0x172dd9)){if(this[_0x4bf4('0xb')][_0x172dd9[_0x4bf4('0x74')]]){for(var _0x3cf4d6 in this[_0x4bf4('0xb')][_0x172dd9['transfereeuniqueid']]){if(this['channels'][_0x172dd9['transfereeuniqueid']][_0x4bf4('0x39')](_0x3cf4d6)){if(_0x172dd9['origtransfereruniqueid']===_0x3cf4d6){var _0x4b4441=moment();this[_0x4bf4('0xb')][_0x172dd9['transfereeuniqueid']][_0x3cf4d6]['agentcomplete']=!![];this['channels'][_0x172dd9[_0x4bf4('0x74')]][_0x3cf4d6][_0x4bf4('0x51')]=moment()['format'](_0x4bf4('0x28'));this['channels'][_0x172dd9[_0x4bf4('0x74')]][_0x3cf4d6][_0x4bf4('0x44')]=_0x4bf4('0x54');this['channels'][_0x172dd9[_0x4bf4('0x74')]][_0x3cf4d6][_0x4bf4('0x45')]=_0x4bf4('0x52');this['channels'][_0x172dd9['transfereeuniqueid']][_0x3cf4d6][_0x4bf4('0x53')]=_0x4b4441[_0x4bf4('0x75')](this[_0x4bf4('0xb')][_0x172dd9['transfereeuniqueid']][_0x3cf4d6][_0x4bf4('0x3a')],'seconds');}}}}if(this[_0x4bf4('0xb')][_0x172dd9[_0x4bf4('0x76')]]){var _0x100f59=this[_0x4bf4('0xb')][_0x172dd9[_0x4bf4('0x76')]];this[_0x4bf4('0xb')][_0x172dd9[_0x4bf4('0x76')]]=this[_0x4bf4('0xb')][_0x172dd9[_0x4bf4('0x74')]];this[_0x4bf4('0xb')][_0x172dd9['transfereeuniqueid']]=_0x100f59;}}}catch(_0x2d15ae){logger[_0x4bf4('0x36')](_0x4bf4('0x77'),util['inspect'](_0x2d15ae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0x78')]=function(_0x41010f){try{if(this['isNotNull'](_0x41010f)){if(this[_0x4bf4('0xb')][_0x41010f[_0x4bf4('0x74')]]){for(var _0x34498e in this[_0x4bf4('0xb')][_0x41010f[_0x4bf4('0x74')]]){if(this[_0x4bf4('0xb')][_0x41010f[_0x4bf4('0x74')]][_0x4bf4('0x39')](_0x34498e)){if(_0x41010f[_0x4bf4('0x79')]===_0x34498e){var _0x3746b2=moment();this['channels'][_0x41010f['transfereeuniqueid']][_0x34498e][_0x4bf4('0x16')]=!![];this[_0x4bf4('0xb')][_0x41010f['transfereeuniqueid']][_0x34498e][_0x4bf4('0x51')]=_0x3746b2;this['channels'][_0x41010f[_0x4bf4('0x74')]][_0x34498e]['reason']='transfer';this[_0x4bf4('0xb')][_0x41010f[_0x4bf4('0x74')]][_0x34498e][_0x4bf4('0x45')]=_0x4bf4('0x52');this[_0x4bf4('0xb')][_0x41010f[_0x4bf4('0x74')]][_0x34498e]['talktime']=_0x3746b2[_0x4bf4('0x75')](this[_0x4bf4('0xb')][_0x41010f[_0x4bf4('0x74')]][_0x34498e]['agentconnectAt'],_0x4bf4('0x7a'));}}}}}}catch(_0x1ec877){logger[_0x4bf4('0x36')](_0x4bf4('0x7b'),util[_0x4bf4('0x38')](_0x1ec877,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4bf4('0x21')][_0x4bf4('0x1c')]=function(_0x5425dc){var _0x373f6a='';try{if(this[_0x4bf4('0x23')](_0x5425dc)){if(_0x5425dc[_0x4bf4('0x7c')]){_0x373f6a=_0x5425dc['channel'][_0x4bf4('0x7d')](0x0,_0x5425dc['channel'][_0x4bf4('0x7e')]('-'));if(this[_0x4bf4('0xc')][_0x373f6a]){this['agents'][_0x373f6a]['onhold']=!![];}}}}catch(_0x224e0c){logger[_0x4bf4('0x36')](_0x4bf4('0x7f'),util['inspect'](_0x224e0c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4bf4('0x21')]['syncMusicOnHoldStop']=function(_0x42ea34){var _0x4d763d='';try{if(this[_0x4bf4('0x23')](_0x42ea34)){if(_0x42ea34[_0x4bf4('0x7c')]){_0x4d763d=_0x42ea34[_0x4bf4('0x7c')][_0x4bf4('0x7d')](0x0,_0x42ea34[_0x4bf4('0x7c')][_0x4bf4('0x7e')]('-'));if(this[_0x4bf4('0xc')][_0x4d763d]){this[_0x4bf4('0xc')][_0x4d763d][_0x4bf4('0x80')]=![];}}}}catch(_0x26c2f8){logger[_0x4bf4('0x36')](_0x4bf4('0x81'),util[_0x4bf4('0x38')](_0x26c2f8,{'showHidden':![],'depth':null}));}};module[_0x4bf4('0x82')]=VoiceAgentReport; \ No newline at end of file +var _0xa8d0=['../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isUndefined','isNotNull','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','variables','queue','type','inbound','merge','event','privilege','user:%s','membername','user:called','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','reason','rejected','custom:agentringnoanswer','error','agentcomplete','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','transfer','acw','agentacw','acwTimeout','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','value','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','transfereeuniqueid','origtransfereruniqueid','talktime','diff','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','substring','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment'];(function(_0x2f607a,_0x59541e){var _0x286a07=function(_0x4116a3){while(--_0x4116a3){_0x2f607a['push'](_0x2f607a['shift']());}};_0x286a07(++_0x59541e);}(_0xa8d0,0x178));var _0x0a8d=function(_0x487107,_0x148e9f){_0x487107=_0x487107-0x0;var _0x38d293=_0xa8d0[_0x487107];return _0x38d293;};'use strict';var _=require(_0x0a8d('0x0'));var moment=require(_0x0a8d('0x1'));var util=require(_0x0a8d('0x2'));var Redis=require(_0x0a8d('0x3'));var config=require(_0x0a8d('0x4'));var logger=require(_0x0a8d('0x5'))(_0x0a8d('0x6'));var ami=require(_0x0a8d('0x7'));config['redis']=_[_0x0a8d('0x8')](config[_0x0a8d('0x9')],{'host':_0x0a8d('0xa'),'port':0x18eb});var io=require(_0x0a8d('0xb'))(new Redis(config[_0x0a8d('0x9')]));function VoiceAgentReport(_0x52f02c){this[_0x0a8d('0xc')]={};this[_0x0a8d('0xd')]=_0x52f02c['voiceQueues'];this[_0x0a8d('0xe')]=_0x52f02c[_0x0a8d('0xe')];this['variables']={};ami['on'](_0x0a8d('0xf'),this[_0x0a8d('0x10')][_0x0a8d('0x11')](this));ami['on'](_0x0a8d('0x12'),this[_0x0a8d('0x13')][_0x0a8d('0x11')](this));ami['on'](_0x0a8d('0x14'),this[_0x0a8d('0x15')][_0x0a8d('0x11')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x0a8d('0x11')](this));ami['on']('agentcomplete',this[_0x0a8d('0x16')][_0x0a8d('0x11')](this));ami['on'](_0x0a8d('0x17'),this[_0x0a8d('0x18')][_0x0a8d('0x11')](this));ami['on'](_0x0a8d('0x19'),this[_0x0a8d('0x1a')][_0x0a8d('0x11')](this));ami['on'](_0x0a8d('0x1b'),this[_0x0a8d('0x1c')]['bind'](this));ami['on'](_0x0a8d('0x1d'),this[_0x0a8d('0x1e')][_0x0a8d('0x11')](this));ami['on'](_0x0a8d('0x1f'),this[_0x0a8d('0x20')][_0x0a8d('0x11')](this));ami['on'](_0x0a8d('0x21'),this['syncBlindTransfer']['bind'](this));}VoiceAgentReport[_0x0a8d('0x22')][_0x0a8d('0x23')]=function(_0x538d87,_0x474d03,_0x541549){io['to'](_0x538d87)[_0x0a8d('0x23')](_0x474d03,_0x541549);};VoiceAgentReport[_0x0a8d('0x22')]['isNotNull']=function(_0x3c3966){return _0x3c3966!==null&&!_[_0x0a8d('0x24')](_0x3c3966);};VoiceAgentReport[_0x0a8d('0x22')]['syncAgentCalled']=function(_0x32c6ca){try{if(this[_0x0a8d('0x25')](_0x32c6ca)){if(_[_0x0a8d('0x24')](this[_0x0a8d('0xc')][_0x32c6ca[_0x0a8d('0x26')]])){this[_0x0a8d('0xc')][_0x32c6ca[_0x0a8d('0x26')]]={};}if(_['isUndefined'](this[_0x0a8d('0xc')][_0x32c6ca['uniqueid']][_0x32c6ca[_0x0a8d('0x27')]])){this[_0x0a8d('0xc')][_0x32c6ca[_0x0a8d('0x26')]][_0x32c6ca['destuniqueid']]={'agentcalledAt':moment()[_0x0a8d('0x28')](_0x0a8d('0x29')),'lastevent':_0x0a8d('0x2a'),'variables':this[_0x0a8d('0x2b')][_0x32c6ca[_0x0a8d('0x26')]],'type':this[_0x0a8d('0xd')][_0x32c6ca[_0x0a8d('0x2c')]]?this[_0x0a8d('0xd')][_0x32c6ca[_0x0a8d('0x2c')]][_0x0a8d('0x2d')]||_0x0a8d('0x2e'):_0x0a8d('0x2e')};}_[_0x0a8d('0x2f')](this['channels'][_0x32c6ca[_0x0a8d('0x26')]][_0x32c6ca[_0x0a8d('0x27')]],_['omit'](_0x32c6ca,[_0x0a8d('0x30'),_0x0a8d('0x31')]));ami[_0x0a8d('0x23')]('custom:agentcalled',this['channels'][_0x32c6ca[_0x0a8d('0x26')]][_0x32c6ca[_0x0a8d('0x27')]]);this[_0x0a8d('0x23')](util['format'](_0x0a8d('0x32'),_0x32c6ca[_0x0a8d('0x33')]),_0x0a8d('0x34'),this[_0x0a8d('0xc')][_0x32c6ca[_0x0a8d('0x26')]][_0x32c6ca[_0x0a8d('0x27')]]);}}catch(_0x11d495){logger['error'](_0x0a8d('0x35'),util[_0x0a8d('0x36')](_0x11d495,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a8d('0x22')][_0x0a8d('0x13')]=function(_0x5d83d8){try{if(this[_0x0a8d('0x25')](_0x5d83d8)){if(this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]]){for(var _0x120435 in this['channels'][_0x5d83d8[_0x0a8d('0x26')]]){if(this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x0a8d('0x37')](_0x120435)){if(_0x5d83d8[_0x0a8d('0x27')]===_0x120435){this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x38')]=moment()['format'](_0x0a8d('0x29'));this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x39')]=_0x0a8d('0x3a');this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435]['holdtime']=_0x5d83d8[_0x0a8d('0x3b')];this['channels'][_0x5d83d8['uniqueid']][_0x120435][_0x0a8d('0x3c')]=_0x5d83d8[_0x0a8d('0x3c')];this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x3d')]=_0x5d83d8[_0x0a8d('0x3d')];this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x3e')]=_0x5d83d8[_0x0a8d('0x3e')];this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x3f')]=_0x5d83d8[_0x0a8d('0x3f')];_[_0x0a8d('0x2f')](this[_0x0a8d('0xe')][_0x5d83d8[_0x0a8d('0x40')]],_[_0x0a8d('0x41')](_0x5d83d8,[_0x0a8d('0x2c'),_0x0a8d('0x42')]));this[_0x0a8d('0x23')](util[_0x0a8d('0x28')](_0x0a8d('0x32'),_0x5d83d8['membername']),_0x0a8d('0x43'),this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x5d83d8[_0x0a8d('0x27')]]);ami['emit'](_0x0a8d('0x44'),this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435]);}else if(!this['channels'][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x14')]&&!this['channels'][_0x5d83d8[_0x0a8d('0x26')]][_0x120435]['agentcomplete']){this['channels'][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x14')]=!![];this['channels'][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x45')]=moment()[_0x0a8d('0x28')](_0x0a8d('0x29'));this['channels'][_0x5d83d8['uniqueid']][_0x120435]['reason']=_0x0a8d('0x46');this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x39')]=_0x0a8d('0x46');this[_0x0a8d('0xc')][_0x5d83d8[_0x0a8d('0x26')]][_0x120435][_0x0a8d('0x47')]=_0x5d83d8[_0x0a8d('0x27')];this[_0x0a8d('0xc')][_0x5d83d8['uniqueid']][_0x120435][_0x0a8d('0x48')]=_0x5d83d8[_0x0a8d('0x33')];ami['emit'](_0x0a8d('0x49'),this[_0x0a8d('0xc')][_0x5d83d8['uniqueid']][_0x120435]);}}}}}}catch(_0x1293c8){logger['error']('[syncAgentConnect][VoiceAgentReport]',util['inspect'](_0x1293c8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a8d('0x22')][_0x0a8d('0x15')]=function(_0x2abecd){try{if(this[_0x0a8d('0x25')](_0x2abecd)){if(this[_0x0a8d('0xc')][_0x2abecd['uniqueid']]&&this[_0x0a8d('0xc')][_0x2abecd[_0x0a8d('0x26')]][_0x2abecd['destuniqueid']]){this[_0x0a8d('0xc')][_0x2abecd[_0x0a8d('0x26')]][_0x2abecd[_0x0a8d('0x27')]][_0x0a8d('0x14')]=!![];this[_0x0a8d('0xc')][_0x2abecd['uniqueid']][_0x2abecd['destuniqueid']][_0x0a8d('0x45')]=moment()[_0x0a8d('0x28')](_0x0a8d('0x29'));this[_0x0a8d('0xc')][_0x2abecd['uniqueid']][_0x2abecd[_0x0a8d('0x27')]][_0x0a8d('0x4a')]=_0x0a8d('0x4b');this[_0x0a8d('0xc')][_0x2abecd['uniqueid']][_0x2abecd[_0x0a8d('0x27')]][_0x0a8d('0x39')]=_0x0a8d('0x4b');ami[_0x0a8d('0x23')](_0x0a8d('0x4c'),this[_0x0a8d('0xc')][_0x2abecd['uniqueid']][_0x2abecd[_0x0a8d('0x27')]]);}}}catch(_0x77dfdd){logger[_0x0a8d('0x4d')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util['inspect'](_0x77dfdd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a8d('0x22')]['syncQueueCallerAbandon']=function(_0x1e3c0d){try{if(this['isNotNull'](_0x1e3c0d)){if(this['channels'][_0x1e3c0d['uniqueid']]){for(var _0x26c2ec in this[_0x0a8d('0xc')][_0x1e3c0d[_0x0a8d('0x26')]]){if(this['channels'][_0x1e3c0d[_0x0a8d('0x26')]][_0x0a8d('0x37')](_0x26c2ec)&&!this[_0x0a8d('0xc')][_0x1e3c0d['uniqueid']][_0x26c2ec]['agentringnoanswer']&&!this[_0x0a8d('0xc')][_0x1e3c0d[_0x0a8d('0x26')]][_0x26c2ec][_0x0a8d('0x4e')]){this[_0x0a8d('0xc')][_0x1e3c0d['uniqueid']][_0x26c2ec]['agentringnoanswer']=!![];this[_0x0a8d('0xc')][_0x1e3c0d[_0x0a8d('0x26')]][_0x26c2ec][_0x0a8d('0x45')]=moment()[_0x0a8d('0x28')](_0x0a8d('0x29'));this[_0x0a8d('0xc')][_0x1e3c0d[_0x0a8d('0x26')]][_0x26c2ec]['reason']=_0x0a8d('0x4f');this[_0x0a8d('0xc')][_0x1e3c0d[_0x0a8d('0x26')]][_0x26c2ec][_0x0a8d('0x39')]=_0x0a8d('0x4f');ami[_0x0a8d('0x23')]('custom:agentqueuecallerabandon',this[_0x0a8d('0xc')][_0x1e3c0d['uniqueid']][_0x26c2ec]);}}}}}catch(_0x478c54){logger[_0x0a8d('0x4d')](_0x0a8d('0x50'),util['inspect'](_0x478c54,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a8d('0x22')]['syncAgentComplete']=function(_0x1d3cef){try{if(this['isNotNull'](_0x1d3cef)){if(this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]]){for(var _0x21c774 in this['channels'][_0x1d3cef[_0x0a8d('0x26')]]){if(this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]]['hasOwnProperty'](_0x21c774)){if(this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774][_0x0a8d('0x38')]&&!this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774][_0x0a8d('0x4e')]){this['channels'][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774][_0x0a8d('0x4e')]=!![];this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774][_0x0a8d('0x51')]=moment()[_0x0a8d('0x28')](_0x0a8d('0x29'));this['channels'][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774][_0x0a8d('0x39')]=_0x0a8d('0x52');this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774]['talktime']=_0x1d3cef['talktime'];this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774][_0x0a8d('0x4a')]=_0x1d3cef[_0x0a8d('0x4a')]==_0x0a8d('0x53')?'agent':_0x1d3cef['reason'];if(this[_0x0a8d('0xd')][_0x1d3cef['queue']]&&this['voiceQueues'][_0x1d3cef[_0x0a8d('0x2c')]][_0x0a8d('0x54')]){this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774][_0x0a8d('0x55')]=!![];this[_0x0a8d('0xc')][_0x1d3cef['uniqueid']][_0x21c774]['acwtime']=this[_0x0a8d('0xd')][_0x1d3cef[_0x0a8d('0x2c')]][_0x0a8d('0x56')];}this[_0x0a8d('0xe')][_0x1d3cef[_0x0a8d('0x40')]]=_[_0x0a8d('0x57')](this[_0x0a8d('0xe')][_0x1d3cef[_0x0a8d('0x40')]],['queue',_0x0a8d('0x42')]);this[_0x0a8d('0x23')](util[_0x0a8d('0x28')](_0x0a8d('0x32'),_0x1d3cef[_0x0a8d('0x33')]),_0x0a8d('0x58'),this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774]);ami[_0x0a8d('0x23')](_0x0a8d('0x59'),this[_0x0a8d('0xc')][_0x1d3cef[_0x0a8d('0x26')]][_0x21c774]);}}}}}}catch(_0x2720d){logger[_0x0a8d('0x4d')](_0x0a8d('0x5a'),util[_0x0a8d('0x36')](_0x2720d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a8d('0x18')]=function(_0x2e8819){try{if(this['isNotNull'](_0x2e8819)){this['addVariable'](_0x2e8819[_0x0a8d('0x26')],_[_0x0a8d('0x5b')](_0x2e8819['variable'])[0x0],_0x2e8819[_0x0a8d('0x5c')]);if(this[_0x0a8d('0xc')][_0x2e8819['uniqueid']]){for(var _0x3c2043 in this[_0x0a8d('0xc')][_0x2e8819['uniqueid']]){if(this[_0x0a8d('0xc')][_0x2e8819[_0x0a8d('0x26')]][_0x0a8d('0x37')](_0x3c2043)){if(_['isUndefined'](this['channels'][_0x2e8819['uniqueid']][_0x3c2043]['variables'])){this['channels'][_0x2e8819[_0x0a8d('0x26')]][_0x3c2043][_0x0a8d('0x2b')]={};}this['channels'][_0x2e8819[_0x0a8d('0x26')]][_0x3c2043][_0x0a8d('0x2b')]=this['variables'][_0x2e8819['uniqueid']];}}}}}catch(_0x538d41){logger[_0x0a8d('0x4d')](_0x0a8d('0x5d'),util[_0x0a8d('0x36')](_0x538d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a8d('0x22')][_0x0a8d('0x5e')]=function(_0x40bf5f,_0x17c98f,_0x38f5ac){var _0x4692bb=[_0x0a8d('0x5f'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x0a8d('0x60'),_0x0a8d('0x61'),_0x0a8d('0x62'),_0x0a8d('0x63'),'rtpaudioqosrttbridged',_0x0a8d('0x64'),_0x0a8d('0x65'),'bridgepeer',_0x0a8d('0x66'),_0x0a8d('0x67'),_0x0a8d('0x68'),_0x0a8d('0x69'),'memberlastcall',_0x0a8d('0x33'),_0x0a8d('0x6a'),_0x0a8d('0x6b')];if(!_[_0x0a8d('0x6c')](_0x17c98f)&&!_[_0x0a8d('0x6d')](_0x4692bb,_0x17c98f)){if(_[_0x0a8d('0x24')](this[_0x0a8d('0x2b')][_0x40bf5f])){this['variables'][_0x40bf5f]={};}this['variables'][_0x40bf5f][_0x17c98f]=_0x38f5ac;}};VoiceAgentReport[_0x0a8d('0x22')][_0x0a8d('0x1a')]=function(_0x472b5c){try{if(this[_0x0a8d('0x25')](_0x472b5c)){if(this[_0x0a8d('0xc')][_0x472b5c[_0x0a8d('0x26')]]){for(var _0xeae81b in this['channels'][_0x472b5c[_0x0a8d('0x26')]]){if(this[_0x0a8d('0xc')][_0x472b5c['uniqueid']]['hasOwnProperty'](_0xeae81b)){if(this[_0x0a8d('0xc')][_0x472b5c[_0x0a8d('0x26')]][_0xeae81b][_0x0a8d('0x4a')]==_0x0a8d('0x53')&&this['channels'][_0x472b5c[_0x0a8d('0x26')]][_0xeae81b][_0x0a8d('0x4e')]){this[_0x0a8d('0xc')][_0x472b5c['uniqueid']][_0xeae81b][_0x0a8d('0x51')]=moment()[_0x0a8d('0x28')](_0x0a8d('0x29'));}}}ami['emit'](_0x0a8d('0x6e'),_['values'](this[_0x0a8d('0xc')][_0x472b5c[_0x0a8d('0x26')]]));delete this[_0x0a8d('0xc')][_0x472b5c[_0x0a8d('0x26')]];}if(this[_0x0a8d('0x2b')][_0x472b5c[_0x0a8d('0x26')]]){delete this[_0x0a8d('0x2b')][_0x472b5c[_0x0a8d('0x26')]];}}}catch(_0x1f7519){logger[_0x0a8d('0x4d')]('[syncHangup][VoiceAgentReport]',util[_0x0a8d('0x36')](_0x1f7519,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a8d('0x20')]=function(_0xd10c74){try{if(this[_0x0a8d('0x25')](_0xd10c74)){if(this[_0x0a8d('0xc')][_0xd10c74[_0x0a8d('0x6f')]]){for(var _0x3ebde6 in this[_0x0a8d('0xc')][_0xd10c74['transfereeuniqueid']]){if(this[_0x0a8d('0xc')][_0xd10c74['transfereeuniqueid']][_0x0a8d('0x37')](_0x3ebde6)){if(_0xd10c74[_0x0a8d('0x70')]===_0x3ebde6){var _0x196743=moment();this[_0x0a8d('0xc')][_0xd10c74[_0x0a8d('0x6f')]][_0x3ebde6][_0x0a8d('0x4e')]=!![];this['channels'][_0xd10c74['transfereeuniqueid']][_0x3ebde6]['agentcompleteAt']=moment()['format'](_0x0a8d('0x29'));this[_0x0a8d('0xc')][_0xd10c74[_0x0a8d('0x6f')]][_0x3ebde6][_0x0a8d('0x4a')]=_0x0a8d('0x53');this[_0x0a8d('0xc')][_0xd10c74['transfereeuniqueid']][_0x3ebde6]['lastevent']=_0x0a8d('0x52');this['channels'][_0xd10c74['transfereeuniqueid']][_0x3ebde6][_0x0a8d('0x71')]=_0x196743[_0x0a8d('0x72')](this[_0x0a8d('0xc')][_0xd10c74['transfereeuniqueid']][_0x3ebde6][_0x0a8d('0x38')],'seconds');}}}}if(this[_0x0a8d('0xc')][_0xd10c74['secondtransfereruniqueid']]){var _0x57998a=this['channels'][_0xd10c74[_0x0a8d('0x73')]];this[_0x0a8d('0xc')][_0xd10c74[_0x0a8d('0x73')]]=this[_0x0a8d('0xc')][_0xd10c74[_0x0a8d('0x6f')]];this[_0x0a8d('0xc')][_0xd10c74[_0x0a8d('0x6f')]]=_0x57998a;}}}catch(_0x37b0af){logger[_0x0a8d('0x4d')](_0x0a8d('0x74'),util[_0x0a8d('0x36')](_0x37b0af,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a8d('0x22')]['syncBlindTransfer']=function(_0x1deccb){try{if(this[_0x0a8d('0x25')](_0x1deccb)){if(this[_0x0a8d('0xc')][_0x1deccb[_0x0a8d('0x6f')]]){for(var _0x3e9fe2 in this[_0x0a8d('0xc')][_0x1deccb['transfereeuniqueid']]){if(this[_0x0a8d('0xc')][_0x1deccb[_0x0a8d('0x6f')]][_0x0a8d('0x37')](_0x3e9fe2)){if(_0x1deccb[_0x0a8d('0x75')]===_0x3e9fe2){var _0x2a6789=moment();this[_0x0a8d('0xc')][_0x1deccb['transfereeuniqueid']][_0x3e9fe2]['agentcomplete']=!![];this['channels'][_0x1deccb['transfereeuniqueid']][_0x3e9fe2][_0x0a8d('0x51')]=_0x2a6789;this['channels'][_0x1deccb[_0x0a8d('0x6f')]][_0x3e9fe2][_0x0a8d('0x4a')]='transfer';this[_0x0a8d('0xc')][_0x1deccb[_0x0a8d('0x6f')]][_0x3e9fe2][_0x0a8d('0x39')]=_0x0a8d('0x52');this[_0x0a8d('0xc')][_0x1deccb[_0x0a8d('0x6f')]][_0x3e9fe2]['talktime']=_0x2a6789[_0x0a8d('0x72')](this[_0x0a8d('0xc')][_0x1deccb[_0x0a8d('0x6f')]][_0x3e9fe2][_0x0a8d('0x38')],_0x0a8d('0x76'));}}}}}}catch(_0x2a3e61){logger[_0x0a8d('0x4d')](_0x0a8d('0x77'),util['inspect'](_0x2a3e61,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a8d('0x22')]['syncMusicOnHoldStart']=function(_0x12ad90){var _0x1a3477='';try{if(this['isNotNull'](_0x12ad90)){if(_0x12ad90[_0x0a8d('0x78')]){_0x1a3477=_0x12ad90['channel']['substring'](0x0,_0x12ad90['channel'][_0x0a8d('0x79')]('-'));if(this['agents'][_0x1a3477]){this['agents'][_0x1a3477][_0x0a8d('0x7a')]=!![];}}}}catch(_0x306e49){logger[_0x0a8d('0x4d')](_0x0a8d('0x7b'),util[_0x0a8d('0x36')](_0x306e49,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a8d('0x22')][_0x0a8d('0x1e')]=function(_0x1dd37b){var _0x2dc858='';try{if(this[_0x0a8d('0x25')](_0x1dd37b)){if(_0x1dd37b['channel']){_0x2dc858=_0x1dd37b['channel'][_0x0a8d('0x7c')](0x0,_0x1dd37b['channel'][_0x0a8d('0x79')]('-'));if(this['agents'][_0x2dc858]){this[_0x0a8d('0xe')][_0x2dc858]['onhold']=![];}}}}catch(_0x446598){logger[_0x0a8d('0x4d')](_0x0a8d('0x7d'),util[_0x0a8d('0x36')](_0x446598,{'showHidden':![],'depth':null}));}};module[_0x0a8d('0x7e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 8911792..efe878e 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 _0x243b=['sipcallid','sipcalluniqueid','parse','syncMixMonitorFilename','sipcalllinkedid','[syncVarSet][VoiceCallReport]','diff','billableseconds','omit','destconnectedlinenum','user:agentcomplete','custom:voiceCallReport','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfercalleridnum','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','isNil','mohtime','milliseconds','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','inuse','busy','invalid','unavailable','set','dial','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','defaults','redis','localhost','channels','agents','syncNewExten','bind','newexten','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','then','actionCoreShowChannels','catch','log','prototype','isNotNull','emit','uniqueid','isUndefined','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','linkedid','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','from-sip','channel','split','format','user:%s','name','user:agentconnect','accountcode','OutgoingSpoolFailed','application','applicationdata','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','startsWith','match','queue','[syncNewExten][VoiceCallReport]','syncNewState','answered','answertime','xcally-motion-preview','connectedlinenum','calleridnum','calleridname','UserId','membername','[syncNewState][VoiceCallReport]','endsWith','replace','.wav49','.WAV','monitorFilename','monitors','rec','variable','mixmonitor_filename','value','xmd-callerid','callerid','type','xmd-queue','xmd-destination','destination','xmd-callerid-preview','xmcs-queue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x243b,0xb1));var _0xb243=function(_0x43ce92,_0xb9481a){_0x43ce92=_0x43ce92-0x0;var _0x12f75d=_0x243b[_0x43ce92];return _0x12f75d;};'use strict';var BPromise=require('bluebird');var _=require(_0xb243('0x0'));var moment=require(_0xb243('0x1'));var util=require(_0xb243('0x2'));var path=require(_0xb243('0x3'));var Redis=require(_0xb243('0x4'));var config=require(_0xb243('0x5'));var logger=require(_0xb243('0x6'))(_0xb243('0x7'));var ami=require('../ami');var Channel=require(_0xb243('0x8'));var statusDesc=[_0xb243('0x9'),'not_inuse',_0xb243('0xa'),_0xb243('0xb'),_0xb243('0xc'),_0xb243('0xd'),'ringing','ringinuse','onhold'];var applications=[_0xb243('0xe'),'queue','agi',_0xb243('0xf'),_0xb243('0x10'),_0xb243('0x11')];var dispositions=['NO\x20ANSWER',_0xb243('0x12'),_0xb243('0x12'),'NO\x20ANSWER',_0xb243('0x13'),_0xb243('0x13'),'ANSWERED',_0xb243('0x14'),_0xb243('0x12'),_0xb243('0x12'),_0xb243('0x12')];var actions={};config['redis']=_[_0xb243('0x15')](config[_0xb243('0x16')],{'host':_0xb243('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb243('0x16')]));function VoiceCallReport(_0x412a3c){this[_0xb243('0x18')]=_0x412a3c['channels'];this[_0xb243('0x19')]=_0x412a3c[_0xb243('0x19')];ami['on']('coreshowchannel',this[_0xb243('0x1a')][_0xb243('0x1b')](this));ami['on'](_0xb243('0x1c'),this['syncNewExten'][_0xb243('0x1b')](this));ami['on']('newchannel',this[_0xb243('0x1d')][_0xb243('0x1b')](this));ami['on'](_0xb243('0x1e'),this['syncNewState'][_0xb243('0x1b')](this));ami['on'](_0xb243('0x1f'),this[_0xb243('0x20')]['bind'](this));ami['on'](_0xb243('0x21'),this[_0xb243('0x22')][_0xb243('0x1b')](this));ami['on'](_0xb243('0x23'),this[_0xb243('0x24')]['bind'](this));ami['on'](_0xb243('0x25'),this[_0xb243('0x26')][_0xb243('0x1b')](this));ami['on'](_0xb243('0x27'),this[_0xb243('0x28')][_0xb243('0x1b')](this));ami['on'](_0xb243('0x29'),this[_0xb243('0x2a')]['bind'](this));ami['on'](_0xb243('0x2b'),this['syncMusicOnHoldStop'][_0xb243('0x1b')](this));return BPromise['resolve']()[_0xb243('0x2c')](ami[_0xb243('0x2d')]())[_0xb243('0x2e')](function(_0x176423){console[_0xb243('0x2f')](_0x176423);});}VoiceCallReport[_0xb243('0x30')][_0xb243('0x31')]=function(_0x198d73){return _0x198d73!==null&&!_['isUndefined'](_0x198d73);};VoiceCallReport['prototype']['emit']=function(_0x4dd45d,_0x12cd3e,_0x34e22a){io['to'](_0x4dd45d)[_0xb243('0x32')](_0x12cd3e,_0x34e22a);};VoiceCallReport[_0xb243('0x30')][_0xb243('0x24')]=function(_0x466208){try{if(this[_0xb243('0x31')](_0x466208)){if(_0x466208[_0xb243('0x33')]===_0x466208['linkedid']){if(!_[_0xb243('0x34')](this[_0xb243('0x18')][_0x466208[_0xb243('0x33')]])){_[_0xb243('0x35')](this[_0xb243('0x18')][_0x466208[_0xb243('0x33')]],_[_0xb243('0x36')](_0x466208,_[_0xb243('0x37')](this['channels'][_0x466208[_0xb243('0x33')]])));}}}}catch(_0x453b91){logger[_0xb243('0x38')](_0xb243('0x39'),util[_0xb243('0x3a')](_0x453b91,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb243('0x30')]['syncNewChannel']=function(_0x3d9585){try{if(this[_0xb243('0x31')](_0x3d9585)){if(_0x3d9585[_0xb243('0x33')]===_0x3d9585[_0xb243('0x3b')]&&_0x3d9585['channel']!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0xb243('0x18')][_0x3d9585['uniqueid']])){this['channels'][_0x3d9585['uniqueid']]=new Channel();this['channels'][_0x3d9585[_0xb243('0x33')]][_0xb243('0x3c')]=moment()['format'](_0xb243('0x3d'));this[_0xb243('0x18')][_0x3d9585[_0xb243('0x33')]]['disposition']=dispositions[_[_0xb243('0x3e')](_0x3d9585[_0xb243('0x3f')])];_[_0xb243('0x35')](this[_0xb243('0x18')][_0x3d9585[_0xb243('0x33')]],_[_0xb243('0x36')](_0x3d9585,_[_0xb243('0x37')](this['channels'][_0x3d9585['uniqueid']])));if(_0x3d9585[_0xb243('0x40')]===_0xb243('0x41')){if(this['agents'][_0x3d9585[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]]){this['agents'][_0x3d9585[_0xb243('0x42')]['split']('-')[0x0]]['destconnectedlinenum']=_0x3d9585['exten'];this['emit'](util[_0xb243('0x44')](_0xb243('0x45'),this[_0xb243('0x19')][_0x3d9585[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]][_0xb243('0x46')]),_0xb243('0x47'),{'destaccountcode':this[_0xb243('0x19')][_0x3d9585[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]][_0xb243('0x48')],'destconnectedlinenum':_0x3d9585['exten']});}}}}}}catch(_0x2f9c2e){logger[_0xb243('0x38')]('[syncNewChannel][VoiceCallReport]',util[_0xb243('0x3a')](_0x2f9c2e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb243('0x30')]['syncNewExten']=function(_0x30aa7c){try{if(this['isNotNull'](_0x30aa7c)){if(_0x30aa7c[_0xb243('0x33')]===_0x30aa7c[_0xb243('0x3b')]&&_0x30aa7c['exten']!='h'&&_0x30aa7c[_0xb243('0x42')]!=_0xb243('0x49')){_0x30aa7c['application']=_0x30aa7c[_0xb243('0x4a')]['toLowerCase']();_0x30aa7c[_0xb243('0x4b')]=(_0x30aa7c['appdata']||_0x30aa7c['applicationdata'])['toLowerCase']();if(_['isUndefined'](this[_0xb243('0x18')][_0x30aa7c[_0xb243('0x33')]])){this[_0xb243('0x18')][_0x30aa7c[_0xb243('0x33')]]=new Channel();this[_0xb243('0x18')][_0x30aa7c[_0xb243('0x33')]][_0xb243('0x3c')]=_0x30aa7c[_0xb243('0x4c')]?moment()[_0xb243('0x4d')](moment[_0xb243('0x4c')](_0x30aa7c[_0xb243('0x4c')])[_0xb243('0x4e')](),_0xb243('0x4e'))['format'](_0xb243('0x3d')):moment()[_0xb243('0x44')](_0xb243('0x3d'));this[_0xb243('0x18')][_0x30aa7c[_0xb243('0x33')]][_0xb243('0x4f')]=_0xb243('0x13');}_[_0xb243('0x35')](this[_0xb243('0x18')][_0x30aa7c['uniqueid']],_['pick'](_0x30aa7c,_[_0xb243('0x37')](this[_0xb243('0x18')][_0x30aa7c[_0xb243('0x33')]])));if(_[_0xb243('0x50')](applications,_0x30aa7c['application'])){this['channels'][_0x30aa7c['uniqueid']][_0xb243('0x51')]=_0x30aa7c['application'];this['channels'][_0x30aa7c[_0xb243('0x33')]][_0xb243('0x52')]=_0x30aa7c[_0xb243('0x4b')];if(_0x30aa7c[_0xb243('0x4a')]===_0xb243('0xe')&&_[_0xb243('0x53')](_0x30aa7c[_0xb243('0x4b')],'cdr(')){var _0x1c458c=_0x30aa7c[_0xb243('0x4b')][_0xb243('0x43')]('=');var _0x554730=_0x1c458c[0x0][_0xb243('0x54')](/cdr\((.*)\)/);if(_0x554730){this[_0xb243('0x18')][_0x30aa7c[_0xb243('0x33')]][_0x554730[0x1]]=_0x1c458c[0x1];}}else if(_0x30aa7c[_0xb243('0x4a')]===_0xb243('0x55')){this[_0xb243('0x18')][_0x30aa7c[_0xb243('0x33')]][_0xb243('0x55')]=_0x30aa7c[_0xb243('0x4b')][_0xb243('0x43')](',')[0x0];}}}}}catch(_0xcf2718){logger[_0xb243('0x38')](_0xb243('0x56'),util[_0xb243('0x3a')](_0xcf2718,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb243('0x30')][_0xb243('0x57')]=function(_0x44b42a){try{if(this[_0xb243('0x31')](_0x44b42a)){if(_0x44b42a[_0xb243('0x33')]!==_0x44b42a[_0xb243('0x3b')]){if(this[_0xb243('0x18')][_0x44b42a[_0xb243('0x3b')]]){if(_0x44b42a[_0xb243('0x3f')]==='6'){if(!this['channels'][_0x44b42a[_0xb243('0x3b')]][_0xb243('0x58')]){var _0x2813b6=moment();this[_0xb243('0x18')][_0x44b42a['linkedid']][_0xb243('0x58')]=!![];this[_0xb243('0x18')][_0x44b42a[_0xb243('0x3b')]][_0xb243('0x59')]=_0x2813b6[_0xb243('0x44')](_0xb243('0x3d'));if(this[_0xb243('0x18')][_0x44b42a[_0xb243('0x3b')]][_0xb243('0x3c')]){this[_0xb243('0x18')][_0x44b42a[_0xb243('0x3b')]]['holdtime']=_0x2813b6['diff'](this['channels'][_0x44b42a[_0xb243('0x3b')]][_0xb243('0x3c')],_0xb243('0x4e'));}}this[_0xb243('0x18')][_0x44b42a['linkedid']][_0xb243('0x3b')]=_0x44b42a[_0xb243('0x33')];if(_0x44b42a['calleridnum']!==_0xb243('0x5a')){this[_0xb243('0x18')][_0x44b42a['linkedid']][_0xb243('0x5b')]=_0x44b42a[_0xb243('0x5c')];}this[_0xb243('0x18')][_0x44b42a[_0xb243('0x3b')]]['connectedlinename']=_0x44b42a[_0xb243('0x5d')];this[_0xb243('0x18')][_0x44b42a[_0xb243('0x3b')]]['destinationchannel']=_0x44b42a['channel'];this[_0xb243('0x18')][_0x44b42a[_0xb243('0x3b')]][_0xb243('0x4f')]=dispositions[_[_0xb243('0x3e')](_0x44b42a[_0xb243('0x3f')])];if(this[_0xb243('0x19')][_0x44b42a[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]]){this[_0xb243('0x18')][_0x44b42a['linkedid']][_0xb243('0x5e')]=this[_0xb243('0x19')][_0x44b42a['channel']['split']('-')[0x0]]['id'];this['channels'][_0x44b42a[_0xb243('0x3b')]][_0xb243('0x5f')]=this[_0xb243('0x19')][_0x44b42a[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]][_0xb243('0x46')];}}}}else{if(this[_0xb243('0x18')][_0x44b42a[_0xb243('0x33')]]){if(_0x44b42a['channelstate']==='6'){if(this['agents'][_0x44b42a[_0xb243('0x42')]['split']('-')[0x0]]){this['channels'][_0x44b42a[_0xb243('0x33')]][_0xb243('0x5e')]=this[_0xb243('0x19')][_0x44b42a[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]]['id'];this[_0xb243('0x18')][_0x44b42a[_0xb243('0x33')]]['membername']=this[_0xb243('0x19')][_0x44b42a['channel'][_0xb243('0x43')]('-')[0x0]][_0xb243('0x46')];}}}}}}catch(_0x1c3268){logger['error'](_0xb243('0x60'),util[_0xb243('0x3a')](_0x1c3268,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x509932,_0x2630e8){if(this[_0xb243('0x18')][_0x509932]){this[_0xb243('0x18')][_0x509932]['monitor']=!![];if(_[_0xb243('0x61')](_0x2630e8,'.wav49')){_0x2630e8=_0x2630e8[_0xb243('0x62')](_0xb243('0x63'),_0xb243('0x64'));}this['channels'][_0x509932][_0xb243('0x65')]=_0x2630e8;var _0x5d5fdc=_['find'](this[_0xb243('0x18')][_0x509932][_0xb243('0x66')],{'filename':_0x2630e8});if(_['isNil'](_0x5d5fdc)){this[_0xb243('0x18')][_0x509932][_0xb243('0x66')]['push']({'filename':_0x2630e8,'createdAt':moment()[_0xb243('0x44')](_0xb243('0x3d')),'mixmonitorid':'','status':_0xb243('0x67')});}}};VoiceCallReport[_0xb243('0x30')][_0xb243('0x20')]=function(_0x134b2c){try{if(this[_0xb243('0x31')](_0x134b2c)){if(this['channels'][_0x134b2c[_0xb243('0x33')]]&&_0x134b2c[_0xb243('0x42')]!=_0xb243('0x49')){if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')])){if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')][_0xb243('0x69')])){this['syncMixMonitorFilename'](_0x134b2c[_0xb243('0x33')],_0x134b2c['value']);}else if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')]['xmd-phone'])){this[_0xb243('0x18')][_0x134b2c[_0xb243('0x33')]][_0xb243('0x5c')]=_0x134b2c[_0xb243('0x6a')];}else if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')][_0xb243('0x6b')])){this[_0xb243('0x18')][_0x134b2c['uniqueid']][_0xb243('0x6c')]=_0x134b2c[_0xb243('0x6a')];}else if(this['isNotNull'](_0x134b2c[_0xb243('0x68')]['xmd-cdrtype'])){this['channels'][_0x134b2c[_0xb243('0x33')]][_0xb243('0x6d')]=_0x134b2c[_0xb243('0x6a')];}else if(this[_0xb243('0x31')](_0x134b2c['variable'][_0xb243('0x6e')])){this['channels'][_0x134b2c[_0xb243('0x33')]][_0xb243('0x55')]=_0x134b2c[_0xb243('0x6a')][_0xb243('0x43')](',')[0x0];}else if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')]['xmd-originatecalleridnum'])){this[_0xb243('0x18')][_0x134b2c[_0xb243('0x33')]]['originatecalleridnum']=_0x134b2c['value'];}else if(this['isNotNull'](_0x134b2c[_0xb243('0x68')][_0xb243('0x6f')])){this[_0xb243('0x18')][_0x134b2c[_0xb243('0x33')]][_0xb243('0x70')]=_0x134b2c['value'];}else if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')][_0xb243('0x71')])){this[_0xb243('0x18')][_0x134b2c[_0xb243('0x33')]]['calleridpreview']=_0x134b2c[_0xb243('0x6a')];}else if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')][_0xb243('0x72')])){this[_0xb243('0x18')][_0x134b2c[_0xb243('0x33')]][_0xb243('0x55')]=_0x134b2c[_0xb243('0x6a')];}else if(this['isNotNull'](_0x134b2c['variable'][_0xb243('0x73')])){this[_0xb243('0x18')][_0x134b2c[_0xb243('0x33')]][_0xb243('0x74')]=_0x134b2c[_0xb243('0x6a')];}}}else if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')]['mixmonitor_filename'])){if(_0x134b2c[_0xb243('0x6a')]){var _0x395d20=path[_0xb243('0x75')](_0x134b2c[_0xb243('0x6a')])[_0xb243('0x46')];this[_0xb243('0x76')](_0x395d20,_0x134b2c[_0xb243('0x6a')]);}}else if(this[_0xb243('0x18')][_0x134b2c[_0xb243('0x3b')]]){if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')])){if(this[_0xb243('0x31')](_0x134b2c[_0xb243('0x68')][_0xb243('0x73')])){this['channels'][_0x134b2c[_0xb243('0x3b')]][_0xb243('0x77')]=_0x134b2c[_0xb243('0x6a')];}}}}}catch(_0x511570){logger[_0xb243('0x38')](_0xb243('0x78'),util[_0xb243('0x3a')](_0x511570,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb243('0x30')]['syncHangup']=function(_0x1a7364){try{if(this[_0xb243('0x31')](_0x1a7364)){if(this[_0xb243('0x18')][_0x1a7364[_0xb243('0x33')]]){var _0x4042a3=moment();this[_0xb243('0x18')][_0x1a7364[_0xb243('0x33')]]['endtime']=_0x4042a3[_0xb243('0x44')](_0xb243('0x3d'));this[_0xb243('0x18')][_0x1a7364[_0xb243('0x33')]][_0xb243('0x4c')]=_0x4042a3['diff'](this['channels'][_0x1a7364[_0xb243('0x33')]][_0xb243('0x3c')],_0xb243('0x4e'));if(this[_0xb243('0x18')][_0x1a7364[_0xb243('0x33')]][_0xb243('0x58')]){this[_0xb243('0x18')][_0x1a7364[_0xb243('0x33')]]['billableseconds']=_0x4042a3[_0xb243('0x79')](this[_0xb243('0x18')][_0x1a7364['uniqueid']][_0xb243('0x59')],_0xb243('0x4e'));this[_0xb243('0x18')][_0x1a7364[_0xb243('0x33')]]['holdtime']=this[_0xb243('0x18')][_0x1a7364['uniqueid']][_0xb243('0x4c')]-this['channels'][_0x1a7364[_0xb243('0x33')]][_0xb243('0x7a')];}if(_0x1a7364[_0xb243('0x40')]===_0xb243('0x41')){if(this[_0xb243('0x19')][_0x1a7364[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]]){this[_0xb243('0x19')][_0x1a7364[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]]=_[_0xb243('0x7b')](this['agents'][_0x1a7364['channel'][_0xb243('0x43')]('-')[0x0]],[_0xb243('0x7c')]);this[_0xb243('0x32')](util['format'](_0xb243('0x45'),this[_0xb243('0x19')][_0x1a7364['channel']['split']('-')[0x0]]['name']),_0xb243('0x7d'),{'destaccountcode':this[_0xb243('0x19')][_0x1a7364[_0xb243('0x42')][_0xb243('0x43')]('-')[0x0]][_0xb243('0x48')]});}}ami[_0xb243('0x32')](_0xb243('0x7e'),this['channels'][_0x1a7364[_0xb243('0x33')]]);delete this[_0xb243('0x18')][_0x1a7364[_0xb243('0x33')]];}}}catch(_0x31ba0a){logger[_0xb243('0x38')]('[syncHangup][VoiceCallReport]',util[_0xb243('0x3a')](_0x31ba0a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb243('0x30')][_0xb243('0x26')]=function(_0x48e0c9){try{if(this[_0xb243('0x31')](_0x48e0c9)){if(this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x7f')]]){this['channels'][_0x48e0c9[_0xb243('0x7f')]]['transfercalleridnum']=_0x48e0c9[_0xb243('0x80')];this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x7f')]][_0xb243('0x81')]=_0x48e0c9['transfertargetcalleridnum'];if(this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x82')]]){var _0x549770=this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x82')]];this[_0xb243('0x18')][_0x48e0c9['secondtransfereruniqueid']]=this[_0xb243('0x18')][_0x48e0c9['transfereeuniqueid']];this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x7f')]]=_0x549770;}}else if(this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x83')]]){this[_0xb243('0x18')][_0x48e0c9['transfertargetuniqueid']]['transfercalleridnum']=_0x48e0c9[_0xb243('0x80')];this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x83')]][_0xb243('0x81')]=_0x48e0c9['transfertargetcalleridnum'];if(this['channels'][_0x48e0c9[_0xb243('0x84')]]){var _0x549770=this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x84')]];this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x84')]]=this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x83')]];this[_0xb243('0x18')][_0x48e0c9[_0xb243('0x83')]]=_0x549770;}}}}catch(_0x54488a){logger[_0xb243('0x38')](_0xb243('0x85'),util[_0xb243('0x3a')](_0x54488a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb243('0x30')][_0xb243('0x28')]=function(_0x301938){try{if(this[_0xb243('0x31')](_0x301938)){if(this[_0xb243('0x18')][_0x301938[_0xb243('0x7f')]]){this[_0xb243('0x18')][_0x301938[_0xb243('0x7f')]][_0xb243('0x86')]=_0x301938[_0xb243('0x87')];this[_0xb243('0x18')][_0x301938[_0xb243('0x7f')]][_0xb243('0x81')]=_0x301938[_0xb243('0x88')];this[_0xb243('0x22')]({'event':_0xb243('0x89'),'uniqueid':_0x301938['transfereeuniqueid'],'context':_0x301938[_0xb243('0x40')],'channel':_0x301938[_0xb243('0x8a')]});}}}catch(_0x503364){logger[_0xb243('0x38')](_0xb243('0x8b'),util['inspect'](_0x503364,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb243('0x30')][_0xb243('0x2a')]=function(_0x35efc6){try{if(this[_0xb243('0x31')](_0x35efc6)){if(this[_0xb243('0x18')][_0x35efc6['uniqueid']]){if(!_['isNil'](this[_0xb243('0x18')][_0x35efc6['uniqueid']][_0xb243('0x59')])){this['channels'][_0x35efc6[_0xb243('0x33')]][_0xb243('0x8c')]=moment()[_0xb243('0x44')](_0xb243('0x3d'));}}}}catch(_0x39be62){logger[_0xb243('0x38')](_0xb243('0x8d'),util[_0xb243('0x3a')](_0x39be62,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb243('0x30')]['syncMusicOnHoldStop']=function(_0x270eb5){try{if(this[_0xb243('0x31')](_0x270eb5)){if(this[_0xb243('0x18')][_0x270eb5[_0xb243('0x33')]]){if(!_[_0xb243('0x8e')](this['channels'][_0x270eb5[_0xb243('0x33')]]['mohstarttime'])){this[_0xb243('0x18')][_0x270eb5[_0xb243('0x33')]][_0xb243('0x8f')]+=moment()[_0xb243('0x90')](0x0)['diff'](this['channels'][_0x270eb5[_0xb243('0x33')]][_0xb243('0x8c')],_0xb243('0x4e'));delete this['channels'][_0x270eb5['uniqueid']][_0xb243('0x8c')];}}}}catch(_0x3d60f7){logger[_0xb243('0x38')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0xb243('0x3a')](_0x3d60f7,{'showHidden':![],'depth':null}));}};module[_0xb243('0x91')]=VoiceCallReport; \ No newline at end of file +var _0x8d40=['secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','exports','bluebird','moment','ioredis','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','set','agi','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','catch','isNotNull','isUndefined','prototype','emit','linkedid','uniqueid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','agents','split','destconnectedlinenum','exten','user:%s','user:agentconnect','[syncNewChannel][VoiceCallReport]','application','toLowerCase','appdata','applicationdata','duration','seconds','includes','lastapplication','lastdata','startsWith','match','queue','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','name','syncMixMonitorFilename','monitor','.wav49','replace','monitorFilename','find','monitors','push','variable','value','xmd-phone','calleridnum','xmd-callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','xmd-destination','xmd-callerid-preview','xmcs-queue','sipcalluniqueid','mixmonitor_filename','sipcallid','sipcalllinkedid','endtime','billableseconds','user:agentcomplete','custom:voiceCallReport','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum'];(function(_0xeb7891,_0x4771f7){var _0x11cc19=function(_0x768961){while(--_0x768961){_0xeb7891['push'](_0xeb7891['shift']());}};_0x11cc19(++_0x4771f7);}(_0x8d40,0x9b));var _0x08d4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8d40[_0x21a9d9];return _0x46adce;};'use strict';var BPromise=require(_0x08d4('0x0'));var _=require('lodash');var moment=require(_0x08d4('0x1'));var util=require('util');var path=require('path');var Redis=require(_0x08d4('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x08d4('0x3'));var ami=require(_0x08d4('0x4'));var Channel=require(_0x08d4('0x5'));var statusDesc=[_0x08d4('0x6'),_0x08d4('0x7'),_0x08d4('0x8'),_0x08d4('0x9'),_0x08d4('0xa'),'unavailable',_0x08d4('0xb'),'ringinuse','onhold'];var applications=[_0x08d4('0xc'),'queue',_0x08d4('0xd'),'dial','playback',_0x08d4('0xe')];var dispositions=[_0x08d4('0xf'),_0x08d4('0x10'),'FAILED','NO\x20ANSWER',_0x08d4('0xf'),'NO\x20ANSWER',_0x08d4('0x11'),_0x08d4('0x12'),_0x08d4('0x10'),'FAILED',_0x08d4('0x10')];var actions={};config[_0x08d4('0x13')]=_['defaults'](config['redis'],{'host':_0x08d4('0x14'),'port':0x18eb});var io=require(_0x08d4('0x15'))(new Redis(config[_0x08d4('0x13')]));function VoiceCallReport(_0x44c739){this['channels']=_0x44c739[_0x08d4('0x16')];this['agents']=_0x44c739['agents'];ami['on']('coreshowchannel',this[_0x08d4('0x17')][_0x08d4('0x18')](this));ami['on'](_0x08d4('0x19'),this[_0x08d4('0x17')][_0x08d4('0x18')](this));ami['on'](_0x08d4('0x1a'),this[_0x08d4('0x1b')][_0x08d4('0x18')](this));ami['on'](_0x08d4('0x1c'),this[_0x08d4('0x1d')][_0x08d4('0x18')](this));ami['on']('varset',this[_0x08d4('0x1e')]['bind'](this));ami['on'](_0x08d4('0x1f'),this[_0x08d4('0x20')][_0x08d4('0x18')](this));ami['on']('newcallerid',this[_0x08d4('0x21')][_0x08d4('0x18')](this));ami['on']('attendedtransfer',this[_0x08d4('0x22')][_0x08d4('0x18')](this));ami['on'](_0x08d4('0x23'),this[_0x08d4('0x24')]['bind'](this));ami['on'](_0x08d4('0x25'),this[_0x08d4('0x26')][_0x08d4('0x18')](this));ami['on']('musiconholdstop',this[_0x08d4('0x27')][_0x08d4('0x18')](this));return BPromise[_0x08d4('0x28')]()[_0x08d4('0x29')](ami['actionCoreShowChannels']())[_0x08d4('0x2a')](function(_0x146f0b){console['log'](_0x146f0b);});}VoiceCallReport['prototype'][_0x08d4('0x2b')]=function(_0x3f06e9){return _0x3f06e9!==null&&!_[_0x08d4('0x2c')](_0x3f06e9);};VoiceCallReport[_0x08d4('0x2d')][_0x08d4('0x2e')]=function(_0xfbdd2b,_0x16e592,_0x1d1bcd){io['to'](_0xfbdd2b)[_0x08d4('0x2e')](_0x16e592,_0x1d1bcd);};VoiceCallReport[_0x08d4('0x2d')][_0x08d4('0x21')]=function(_0x1884cf){try{if(this[_0x08d4('0x2b')](_0x1884cf)){if(_0x1884cf['uniqueid']===_0x1884cf[_0x08d4('0x2f')]){if(!_[_0x08d4('0x2c')](this[_0x08d4('0x16')][_0x1884cf[_0x08d4('0x30')]])){_[_0x08d4('0x31')](this[_0x08d4('0x16')][_0x1884cf[_0x08d4('0x30')]],_[_0x08d4('0x32')](_0x1884cf,_[_0x08d4('0x33')](this[_0x08d4('0x16')][_0x1884cf[_0x08d4('0x30')]])));}}}}catch(_0x5c46b9){logger[_0x08d4('0x34')](_0x08d4('0x35'),util[_0x08d4('0x36')](_0x5c46b9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x08d4('0x1b')]=function(_0x51c925){try{if(this[_0x08d4('0x2b')](_0x51c925)){if(_0x51c925[_0x08d4('0x30')]===_0x51c925[_0x08d4('0x2f')]&&_0x51c925[_0x08d4('0x37')]!=_0x08d4('0x38')){if(_[_0x08d4('0x2c')](this[_0x08d4('0x16')][_0x51c925[_0x08d4('0x30')]])){this[_0x08d4('0x16')][_0x51c925[_0x08d4('0x30')]]=new Channel();this[_0x08d4('0x16')][_0x51c925[_0x08d4('0x30')]][_0x08d4('0x39')]=moment()[_0x08d4('0x3a')](_0x08d4('0x3b'));this[_0x08d4('0x16')][_0x51c925[_0x08d4('0x30')]][_0x08d4('0x3c')]=dispositions[_[_0x08d4('0x3d')](_0x51c925[_0x08d4('0x3e')])];_[_0x08d4('0x31')](this[_0x08d4('0x16')][_0x51c925['uniqueid']],_[_0x08d4('0x32')](_0x51c925,_[_0x08d4('0x33')](this['channels'][_0x51c925[_0x08d4('0x30')]])));if(_0x51c925[_0x08d4('0x3f')]===_0x08d4('0x40')){if(this[_0x08d4('0x41')][_0x51c925['channel'][_0x08d4('0x42')]('-')[0x0]]){this[_0x08d4('0x41')][_0x51c925[_0x08d4('0x37')][_0x08d4('0x42')]('-')[0x0]][_0x08d4('0x43')]=_0x51c925[_0x08d4('0x44')];this[_0x08d4('0x2e')](util[_0x08d4('0x3a')](_0x08d4('0x45'),this[_0x08d4('0x41')][_0x51c925[_0x08d4('0x37')]['split']('-')[0x0]]['name']),_0x08d4('0x46'),{'destaccountcode':this[_0x08d4('0x41')][_0x51c925['channel'][_0x08d4('0x42')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x51c925['exten']});}}}}}}catch(_0xa34840){logger[_0x08d4('0x34')](_0x08d4('0x47'),util[_0x08d4('0x36')](_0xa34840,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x08d4('0x2d')][_0x08d4('0x17')]=function(_0x238124){try{if(this[_0x08d4('0x2b')](_0x238124)){if(_0x238124['uniqueid']===_0x238124[_0x08d4('0x2f')]&&_0x238124[_0x08d4('0x44')]!='h'&&_0x238124[_0x08d4('0x37')]!='OutgoingSpoolFailed'){_0x238124[_0x08d4('0x48')]=_0x238124['application'][_0x08d4('0x49')]();_0x238124['applicationdata']=(_0x238124[_0x08d4('0x4a')]||_0x238124[_0x08d4('0x4b')])[_0x08d4('0x49')]();if(_[_0x08d4('0x2c')](this[_0x08d4('0x16')][_0x238124[_0x08d4('0x30')]])){this[_0x08d4('0x16')][_0x238124[_0x08d4('0x30')]]=new Channel();this['channels'][_0x238124[_0x08d4('0x30')]][_0x08d4('0x39')]=_0x238124[_0x08d4('0x4c')]?moment()['subtract'](moment[_0x08d4('0x4c')](_0x238124['duration'])[_0x08d4('0x4d')](),_0x08d4('0x4d'))[_0x08d4('0x3a')](_0x08d4('0x3b')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x08d4('0x16')][_0x238124[_0x08d4('0x30')]][_0x08d4('0x3c')]=_0x08d4('0xf');}_[_0x08d4('0x31')](this[_0x08d4('0x16')][_0x238124['uniqueid']],_[_0x08d4('0x32')](_0x238124,_['keys'](this[_0x08d4('0x16')][_0x238124[_0x08d4('0x30')]])));if(_[_0x08d4('0x4e')](applications,_0x238124[_0x08d4('0x48')])){this[_0x08d4('0x16')][_0x238124['uniqueid']][_0x08d4('0x4f')]=_0x238124['application'];this[_0x08d4('0x16')][_0x238124['uniqueid']][_0x08d4('0x50')]=_0x238124[_0x08d4('0x4b')];if(_0x238124[_0x08d4('0x48')]===_0x08d4('0xc')&&_[_0x08d4('0x51')](_0x238124['applicationdata'],'cdr(')){var _0xc5549e=_0x238124[_0x08d4('0x4b')][_0x08d4('0x42')]('=');var _0x2ead27=_0xc5549e[0x0][_0x08d4('0x52')](/cdr\((.*)\)/);if(_0x2ead27){this['channels'][_0x238124['uniqueid']][_0x2ead27[0x1]]=_0xc5549e[0x1];}}else if(_0x238124[_0x08d4('0x48')]===_0x08d4('0x53')){this[_0x08d4('0x16')][_0x238124[_0x08d4('0x30')]][_0x08d4('0x53')]=_0x238124[_0x08d4('0x4b')][_0x08d4('0x42')](',')[0x0];}}}}}catch(_0x4656e2){logger[_0x08d4('0x34')](_0x08d4('0x54'),util[_0x08d4('0x36')](_0x4656e2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x08d4('0x2d')][_0x08d4('0x1d')]=function(_0x4857f1){try{if(this[_0x08d4('0x2b')](_0x4857f1)){if(_0x4857f1[_0x08d4('0x30')]!==_0x4857f1[_0x08d4('0x2f')]){if(this['channels'][_0x4857f1[_0x08d4('0x2f')]]){if(_0x4857f1[_0x08d4('0x3e')]==='6'){if(!this[_0x08d4('0x16')][_0x4857f1['linkedid']][_0x08d4('0x55')]){var _0xe2d4f3=moment();this['channels'][_0x4857f1[_0x08d4('0x2f')]][_0x08d4('0x55')]=!![];this['channels'][_0x4857f1[_0x08d4('0x2f')]][_0x08d4('0x56')]=_0xe2d4f3[_0x08d4('0x3a')](_0x08d4('0x3b'));if(this[_0x08d4('0x16')][_0x4857f1[_0x08d4('0x2f')]][_0x08d4('0x39')]){this[_0x08d4('0x16')][_0x4857f1['linkedid']][_0x08d4('0x57')]=_0xe2d4f3[_0x08d4('0x58')](this[_0x08d4('0x16')][_0x4857f1[_0x08d4('0x2f')]]['starttime'],_0x08d4('0x4d'));}}this[_0x08d4('0x16')][_0x4857f1['linkedid']][_0x08d4('0x2f')]=_0x4857f1[_0x08d4('0x30')];if(_0x4857f1['calleridnum']!=='xcally-motion-preview'){this[_0x08d4('0x16')][_0x4857f1[_0x08d4('0x2f')]][_0x08d4('0x59')]=_0x4857f1['calleridnum'];}this[_0x08d4('0x16')][_0x4857f1[_0x08d4('0x2f')]][_0x08d4('0x5a')]=_0x4857f1[_0x08d4('0x5b')];this[_0x08d4('0x16')][_0x4857f1[_0x08d4('0x2f')]][_0x08d4('0x5c')]=_0x4857f1[_0x08d4('0x37')];this[_0x08d4('0x16')][_0x4857f1['linkedid']][_0x08d4('0x3c')]=dispositions[_[_0x08d4('0x3d')](_0x4857f1[_0x08d4('0x3e')])];if(this[_0x08d4('0x41')][_0x4857f1[_0x08d4('0x37')][_0x08d4('0x42')]('-')[0x0]]){this[_0x08d4('0x16')][_0x4857f1['linkedid']]['UserId']=this[_0x08d4('0x41')][_0x4857f1['channel'][_0x08d4('0x42')]('-')[0x0]]['id'];this[_0x08d4('0x16')][_0x4857f1[_0x08d4('0x2f')]]['membername']=this[_0x08d4('0x41')][_0x4857f1[_0x08d4('0x37')][_0x08d4('0x42')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x4857f1['uniqueid']]){if(_0x4857f1[_0x08d4('0x3e')]==='6'){if(this[_0x08d4('0x41')][_0x4857f1[_0x08d4('0x37')]['split']('-')[0x0]]){this[_0x08d4('0x16')][_0x4857f1[_0x08d4('0x30')]][_0x08d4('0x5d')]=this['agents'][_0x4857f1[_0x08d4('0x37')][_0x08d4('0x42')]('-')[0x0]]['id'];this[_0x08d4('0x16')][_0x4857f1['uniqueid']][_0x08d4('0x5e')]=this[_0x08d4('0x41')][_0x4857f1['channel'][_0x08d4('0x42')]('-')[0x0]][_0x08d4('0x5f')];}}}}}}catch(_0x18446e){logger[_0x08d4('0x34')]('[syncNewState][VoiceCallReport]',util[_0x08d4('0x36')](_0x18446e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x08d4('0x60')]=function(_0x2e466e,_0x3baffd){if(this[_0x08d4('0x16')][_0x2e466e]){this[_0x08d4('0x16')][_0x2e466e][_0x08d4('0x61')]=!![];if(_['endsWith'](_0x3baffd,_0x08d4('0x62'))){_0x3baffd=_0x3baffd[_0x08d4('0x63')]('.wav49','.WAV');}this[_0x08d4('0x16')][_0x2e466e][_0x08d4('0x64')]=_0x3baffd;var _0x222cb7=_[_0x08d4('0x65')](this[_0x08d4('0x16')][_0x2e466e][_0x08d4('0x66')],{'filename':_0x3baffd});if(_['isNil'](_0x222cb7)){this[_0x08d4('0x16')][_0x2e466e]['monitors'][_0x08d4('0x67')]({'filename':_0x3baffd,'createdAt':moment()[_0x08d4('0x3a')](_0x08d4('0x3b')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x08d4('0x2d')]['syncVarSet']=function(_0x3e9263){try{if(this[_0x08d4('0x2b')](_0x3e9263)){if(this[_0x08d4('0x16')][_0x3e9263[_0x08d4('0x30')]]&&_0x3e9263[_0x08d4('0x37')]!='OutgoingSpoolFailed'){if(this[_0x08d4('0x2b')](_0x3e9263['variable'])){if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')]['mixmonitor_filename'])){this[_0x08d4('0x60')](_0x3e9263['uniqueid'],_0x3e9263[_0x08d4('0x69')]);}else if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x6a')])){this[_0x08d4('0x16')][_0x3e9263[_0x08d4('0x30')]][_0x08d4('0x6b')]=_0x3e9263[_0x08d4('0x69')];}else if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x6c')])){this['channels'][_0x3e9263[_0x08d4('0x30')]]['callerid']=_0x3e9263[_0x08d4('0x69')];}else if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x6d')])){this['channels'][_0x3e9263[_0x08d4('0x30')]][_0x08d4('0x6e')]=_0x3e9263['value'];}else if(this['isNotNull'](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x6f')])){this[_0x08d4('0x16')][_0x3e9263[_0x08d4('0x30')]][_0x08d4('0x53')]=_0x3e9263[_0x08d4('0x69')][_0x08d4('0x42')](',')[0x0];}else if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x70')])){this['channels'][_0x3e9263['uniqueid']]['originatecalleridnum']=_0x3e9263[_0x08d4('0x69')];}else if(this['isNotNull'](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x71')])){this[_0x08d4('0x16')][_0x3e9263[_0x08d4('0x30')]]['destination']=_0x3e9263[_0x08d4('0x69')];}else if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x72')])){this[_0x08d4('0x16')][_0x3e9263[_0x08d4('0x30')]]['calleridpreview']=_0x3e9263[_0x08d4('0x69')];}else if(this[_0x08d4('0x2b')](_0x3e9263['variable'][_0x08d4('0x73')])){this['channels'][_0x3e9263[_0x08d4('0x30')]][_0x08d4('0x53')]=_0x3e9263['value'];}else if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')]['sipcallid'])){this[_0x08d4('0x16')][_0x3e9263['uniqueid']][_0x08d4('0x74')]=_0x3e9263['value'];}}}else if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x75')])){if(_0x3e9263[_0x08d4('0x69')]){var _0x23163a=path['parse'](_0x3e9263[_0x08d4('0x69')])[_0x08d4('0x5f')];this[_0x08d4('0x60')](_0x23163a,_0x3e9263[_0x08d4('0x69')]);}}else if(this[_0x08d4('0x16')][_0x3e9263[_0x08d4('0x2f')]]){if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')])){if(this[_0x08d4('0x2b')](_0x3e9263[_0x08d4('0x68')][_0x08d4('0x76')])){this[_0x08d4('0x16')][_0x3e9263[_0x08d4('0x2f')]][_0x08d4('0x77')]=_0x3e9263[_0x08d4('0x69')];}}}}}catch(_0x1f8fe1){logger[_0x08d4('0x34')]('[syncVarSet][VoiceCallReport]',util['inspect'](_0x1f8fe1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x08d4('0x2d')][_0x08d4('0x20')]=function(_0xb524c0){try{if(this[_0x08d4('0x2b')](_0xb524c0)){if(this[_0x08d4('0x16')][_0xb524c0['uniqueid']]){var _0x2fca33=moment();this[_0x08d4('0x16')][_0xb524c0['uniqueid']][_0x08d4('0x78')]=_0x2fca33[_0x08d4('0x3a')](_0x08d4('0x3b'));this['channels'][_0xb524c0[_0x08d4('0x30')]][_0x08d4('0x4c')]=_0x2fca33[_0x08d4('0x58')](this[_0x08d4('0x16')][_0xb524c0[_0x08d4('0x30')]]['starttime'],_0x08d4('0x4d'));if(this['channels'][_0xb524c0[_0x08d4('0x30')]][_0x08d4('0x55')]){this['channels'][_0xb524c0[_0x08d4('0x30')]][_0x08d4('0x79')]=_0x2fca33[_0x08d4('0x58')](this[_0x08d4('0x16')][_0xb524c0[_0x08d4('0x30')]][_0x08d4('0x56')],_0x08d4('0x4d'));this[_0x08d4('0x16')][_0xb524c0['uniqueid']][_0x08d4('0x57')]=this[_0x08d4('0x16')][_0xb524c0['uniqueid']]['duration']-this['channels'][_0xb524c0[_0x08d4('0x30')]][_0x08d4('0x79')];}if(_0xb524c0[_0x08d4('0x3f')]===_0x08d4('0x40')){if(this[_0x08d4('0x41')][_0xb524c0['channel'][_0x08d4('0x42')]('-')[0x0]]){this[_0x08d4('0x41')][_0xb524c0['channel'][_0x08d4('0x42')]('-')[0x0]]=_['omit'](this[_0x08d4('0x41')][_0xb524c0[_0x08d4('0x37')]['split']('-')[0x0]],['destconnectedlinenum']);this['emit'](util[_0x08d4('0x3a')](_0x08d4('0x45'),this[_0x08d4('0x41')][_0xb524c0['channel']['split']('-')[0x0]][_0x08d4('0x5f')]),_0x08d4('0x7a'),{'destaccountcode':this['agents'][_0xb524c0[_0x08d4('0x37')][_0x08d4('0x42')]('-')[0x0]]['accountcode']});}}ami[_0x08d4('0x2e')](_0x08d4('0x7b'),this[_0x08d4('0x16')][_0xb524c0[_0x08d4('0x30')]]);delete this['channels'][_0xb524c0['uniqueid']];}}}catch(_0x2debdc){logger['error']('[syncHangup][VoiceCallReport]',util[_0x08d4('0x36')](_0x2debdc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x08d4('0x2d')]['syncAttendedTransfer']=function(_0x2f3d35){try{if(this[_0x08d4('0x2b')](_0x2f3d35)){if(this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x7c')]]){this[_0x08d4('0x16')][_0x2f3d35['transfereeuniqueid']][_0x08d4('0x7d')]=_0x2f3d35[_0x08d4('0x7e')];this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x7c')]][_0x08d4('0x7f')]=_0x2f3d35[_0x08d4('0x80')];if(this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x81')]]){var _0x3a7fc9=this[_0x08d4('0x16')][_0x2f3d35['secondtransfereruniqueid']];this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x81')]]=this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x7c')]];this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x7c')]]=_0x3a7fc9;}}else if(this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x82')]]){this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x82')]][_0x08d4('0x7d')]=_0x2f3d35['origtransferercalleridnum'];this['channels'][_0x2f3d35[_0x08d4('0x82')]][_0x08d4('0x7f')]=_0x2f3d35[_0x08d4('0x80')];if(this[_0x08d4('0x16')][_0x2f3d35[_0x08d4('0x83')]]){var _0x3a7fc9=this['channels'][_0x2f3d35[_0x08d4('0x83')]];this[_0x08d4('0x16')][_0x2f3d35['origtransfereruniqueid']]=this['channels'][_0x2f3d35['transfertargetuniqueid']];this['channels'][_0x2f3d35[_0x08d4('0x82')]]=_0x3a7fc9;}}}}catch(_0x1cb8a1){logger[_0x08d4('0x34')](_0x08d4('0x84'),util['inspect'](_0x1cb8a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x08d4('0x2d')][_0x08d4('0x24')]=function(_0x29a5e4){try{if(this['isNotNull'](_0x29a5e4)){if(this[_0x08d4('0x16')][_0x29a5e4['transfereeuniqueid']]){this['channels'][_0x29a5e4[_0x08d4('0x7c')]]['transfercalleridnum']=_0x29a5e4[_0x08d4('0x85')];this[_0x08d4('0x16')][_0x29a5e4[_0x08d4('0x7c')]]['transferconnectedlinenum']=_0x29a5e4['extension'];this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x29a5e4[_0x08d4('0x7c')],'context':_0x29a5e4['context'],'channel':_0x29a5e4[_0x08d4('0x86')]});}}}catch(_0x2a94b0){logger[_0x08d4('0x34')](_0x08d4('0x87'),util['inspect'](_0x2a94b0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x08d4('0x2d')][_0x08d4('0x26')]=function(_0x386b19){try{if(this[_0x08d4('0x2b')](_0x386b19)){if(this['channels'][_0x386b19[_0x08d4('0x30')]]){if(!_[_0x08d4('0x88')](this[_0x08d4('0x16')][_0x386b19[_0x08d4('0x30')]][_0x08d4('0x56')])){this['channels'][_0x386b19[_0x08d4('0x30')]][_0x08d4('0x89')]=moment()[_0x08d4('0x3a')](_0x08d4('0x3b'));}}}}catch(_0x2bf12b){logger[_0x08d4('0x34')](_0x08d4('0x8a'),util['inspect'](_0x2bf12b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x08d4('0x2d')][_0x08d4('0x27')]=function(_0x4dd8a6){try{if(this[_0x08d4('0x2b')](_0x4dd8a6)){if(this['channels'][_0x4dd8a6[_0x08d4('0x30')]]){if(!_[_0x08d4('0x88')](this['channels'][_0x4dd8a6['uniqueid']][_0x08d4('0x89')])){this[_0x08d4('0x16')][_0x4dd8a6[_0x08d4('0x30')]][_0x08d4('0x8b')]+=moment()[_0x08d4('0x8c')](0x0)[_0x08d4('0x58')](this['channels'][_0x4dd8a6[_0x08d4('0x30')]][_0x08d4('0x89')],_0x08d4('0x4d'));delete this[_0x08d4('0x16')][_0x4dd8a6[_0x08d4('0x30')]][_0x08d4('0x89')];}}}}catch(_0x16d6ad){logger[_0x08d4('0x34')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x08d4('0x36')](_0x16d6ad,{'showHidden':![],'depth':null}));}};module[_0x08d4('0x8d')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 2f882c3..7e2b28d 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 _0xb99d=['connectedlinename','lastevent','connect','voice:outbound','[syncDialEnd][VoiceDialReport]','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','endtime','duration','diff','starttime','seconds','complete','answertime','answered','holdtime','billableseconds','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','error','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','voice_outbound_channel:save','custom:dialbegin','inspect','dialstatus','ANSWER','connectedlinenum'];(function(_0x2ebbf4,_0x1e9cb7){var _0x234cc8=function(_0x447cfc){while(--_0x447cfc){_0x2ebbf4['push'](_0x2ebbf4['shift']());}};_0x234cc8(++_0x1e9cb7);}(_0xb99d,0x87));var _0xdb99=function(_0x4d0dfe,_0x1356af){_0x4d0dfe=_0x4d0dfe-0x0;var _0x1f3f73=_0xb99d[_0x4d0dfe];return _0x1f3f73;};'use strict';var _=require(_0xdb99('0x0'));var moment=require(_0xdb99('0x1'));var util=require('util');var Redis=require(_0xdb99('0x2'));var config=require(_0xdb99('0x3'));var logger=require(_0xdb99('0x4'))(_0xdb99('0x5'));var ami=require(_0xdb99('0x6'));config[_0xdb99('0x7')]=_[_0xdb99('0x8')](config[_0xdb99('0x7')],{'host':_0xdb99('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdb99('0x7')]));function VoiceDialReport(_0x5006d4){this['channels']=_0x5006d4[_0xdb99('0xa')];this[_0xdb99('0xb')]=_0x5006d4['outbound'];this[_0xdb99('0xc')]={};ami['on'](_0xdb99('0xd'),this[_0xdb99('0xe')][_0xdb99('0xf')](this));ami['on'](_0xdb99('0x10'),this[_0xdb99('0x11')][_0xdb99('0xf')](this));ami['on'](_0xdb99('0x12'),this[_0xdb99('0x13')][_0xdb99('0xf')](this));ami['on'](_0xdb99('0x14'),this['syncHangup'][_0xdb99('0xf')](this));}VoiceDialReport[_0xdb99('0x15')][_0xdb99('0x16')]=function(_0x52fd81){return _0x52fd81!==null&&!_[_0xdb99('0x17')](_0x52fd81);};VoiceDialReport[_0xdb99('0x15')][_0xdb99('0x18')]=function(_0x173503,_0x24352a,_0x3b3755){io['to'](_0x173503)['emit'](_0x24352a,_0x3b3755);};VoiceDialReport['prototype'][_0xdb99('0xe')]=function(_0x2cdb06){try{if(this[_0xdb99('0x16')](_0x2cdb06)){if(this['channels'][_0x2cdb06[_0xdb99('0x19')]]){_[_0xdb99('0x1a')](this[_0xdb99('0x1b')][_0x2cdb06[_0xdb99('0x19')]],{'starttime':moment()[_0xdb99('0x1c')](_0xdb99('0x1d')),'lastevent':_0xdb99('0x1e'),'interface':_0x2cdb06[_0xdb99('0x1f')][_0xdb99('0x20')](0x0,_0x2cdb06[_0xdb99('0x1f')][_0xdb99('0x21')]('-')),'membername':_0x2cdb06[_0xdb99('0x1f')][_0xdb99('0x20')](_0x2cdb06[_0xdb99('0x1f')][_0xdb99('0x21')]('/')+0x1,_0x2cdb06[_0xdb99('0x1f')]['lastIndexOf']('-'))},_['omit'](_0x2cdb06,[_0xdb99('0x22'),'privilege']));this[_0xdb99('0x18')]('voice:outbound',_0xdb99('0x23'),this[_0xdb99('0x1b')][_0x2cdb06['uniqueid']]);ami['emit'](_0xdb99('0x24'),this['channels'][_0x2cdb06[_0xdb99('0x19')]]);}}}catch(_0x1aad09){logger['error']('[syncDialBegin][VoiceDialReport]',util[_0xdb99('0x25')](_0x1aad09,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xdb99('0x11')]=function(_0x38230f){try{if(this[_0xdb99('0x16')](_0x38230f)){if(this['channels'][_0x38230f[_0xdb99('0x19')]]){this[_0xdb99('0x1b')][_0x38230f[_0xdb99('0x19')]][_0xdb99('0x26')]=_0x38230f[_0xdb99('0x26')];if(_0x38230f[_0xdb99('0x26')]===_0xdb99('0x27')){this['channels'][_0x38230f[_0xdb99('0x19')]][_0xdb99('0x28')]=_0x38230f[_0xdb99('0x28')];this['channels'][_0x38230f[_0xdb99('0x19')]]['connectedlinename']=_0x38230f[_0xdb99('0x29')];this[_0xdb99('0x1b')][_0x38230f[_0xdb99('0x19')]]['answertime']=moment()[_0xdb99('0x1c')](_0xdb99('0x1d'));this[_0xdb99('0x1b')][_0x38230f[_0xdb99('0x19')]][_0xdb99('0x2a')]=_0xdb99('0x2b');ami[_0xdb99('0x18')]('custom:dialconnect',this['channels'][_0x38230f[_0xdb99('0x19')]]);}this[_0xdb99('0x18')](_0xdb99('0x2c'),_0xdb99('0x23'),this[_0xdb99('0x1b')][_0x38230f[_0xdb99('0x19')]]);}}}catch(_0x2b9f8e){logger['error'](_0xdb99('0x2d'),util[_0xdb99('0x25')](_0x2b9f8e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdb99('0x15')]['syncVarSet']=function(_0x2819de){try{if(this[_0xdb99('0x16')](_0x2819de)){this['addVariable'](_0x2819de['uniqueid'],_[_0xdb99('0x2e')](_0x2819de[_0xdb99('0x2f')])[0x0],_0x2819de[_0xdb99('0x30')]);if(this[_0xdb99('0x16')](_0x2819de[_0xdb99('0x2f')])&&this['isNotNull'](_0x2819de[_0xdb99('0x2f')][_0xdb99('0x31')])){if(_[_0xdb99('0x17')](this[_0xdb99('0x1b')][_0x2819de[_0xdb99('0x19')]])){this[_0xdb99('0x1b')][_0x2819de[_0xdb99('0x19')]]={'routeId':_0x2819de['value'],'variables':this[_0xdb99('0xc')][_0x2819de[_0xdb99('0x19')]]};this['emit'](_0xdb99('0x2c'),_0xdb99('0x23'),this[_0xdb99('0x1b')][_0x2819de[_0xdb99('0x19')]]);}}}}catch(_0x34f3bf){logger['error'](_0xdb99('0x32'),util['inspect'](_0x34f3bf,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xdb99('0x33')]=function(_0x2c6ca4,_0xdbaf5e,_0x32a8c7){var _0x2b82bb=['rtpaudioqos',_0xdb99('0x34'),_0xdb99('0x35'),_0xdb99('0x36'),_0xdb99('0x37'),_0xdb99('0x38'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xdb99('0x39'),'sipuri',_0xdb99('0x3a'),_0xdb99('0x3b'),_0xdb99('0x3c'),'memberdynamic',_0xdb99('0x3d'),_0xdb99('0x3e'),_0xdb99('0x3f'),_0xdb99('0x40'),_0xdb99('0x41')];if(!_[_0xdb99('0x42')](_0xdbaf5e)&&!_[_0xdb99('0x43')](_0x2b82bb,_0xdbaf5e)){if(_[_0xdb99('0x17')](this[_0xdb99('0xc')][_0x2c6ca4])){this[_0xdb99('0xc')][_0x2c6ca4]={};}this[_0xdb99('0xc')][_0x2c6ca4][_0xdbaf5e]=_0x32a8c7;}};VoiceDialReport[_0xdb99('0x15')]['syncHangup']=function(_0x548638){try{if(this['isNotNull'](_0x548638)){if(this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]]){this[_0xdb99('0x1b')][_0x548638['uniqueid']][_0xdb99('0x44')]=moment()[_0xdb99('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]][_0xdb99('0x45')]=moment(this['channels'][_0x548638[_0xdb99('0x19')]][_0xdb99('0x44')])[_0xdb99('0x46')](this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]][_0xdb99('0x47')],_0xdb99('0x48'));this[_0xdb99('0x1b')][_0x548638['uniqueid']][_0xdb99('0x2a')]=_0xdb99('0x49');this[_0xdb99('0xb')]['total']+=0x1;if(this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]][_0xdb99('0x4a')]){this['outbound'][_0xdb99('0x4b')]+=0x1;this['channels'][_0x548638[_0xdb99('0x19')]][_0xdb99('0x4c')]=moment(this[_0xdb99('0x1b')][_0x548638['uniqueid']]['answertime'])[_0xdb99('0x46')](this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]][_0xdb99('0x47')],_0xdb99('0x48'));this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]][_0xdb99('0x4d')]=moment(this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]]['endtime'])[_0xdb99('0x46')](this['channels'][_0x548638[_0xdb99('0x19')]][_0xdb99('0x4a')],_0xdb99('0x48'));this['outbound']['sumHoldTime']+=this['channels'][_0x548638[_0xdb99('0x19')]]['holdtime']||0x0;this['outbound']['sumBillable']+=this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]]['billableseconds'];}this[_0xdb99('0xb')][_0xdb99('0x4e')]+=this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]][_0xdb99('0x45')];ami[_0xdb99('0x18')](_0xdb99('0x4f'),this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]]);ami['emit'](_0xdb99('0x50'),this['channels'][_0x548638[_0xdb99('0x19')]]);this[_0xdb99('0x18')](_0xdb99('0x2c'),_0xdb99('0x51'),this[_0xdb99('0xb')]);logger[_0xdb99('0x52')](_0xdb99('0x53'),JSON[_0xdb99('0x54')](this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]]));this[_0xdb99('0x18')]('voice:outbound',_0xdb99('0x55'),this[_0xdb99('0x1b')][_0x548638[_0xdb99('0x19')]]);delete this['channels'][_0x548638[_0xdb99('0x19')]];}if(this[_0xdb99('0xc')][_0x548638[_0xdb99('0x19')]]){delete this[_0xdb99('0xc')][_0x548638[_0xdb99('0x19')]];}}}catch(_0x3931b7){logger[_0xdb99('0x56')]('[syncHangup][VoiceDialReport]',util[_0xdb99('0x25')](_0x3931b7,{'showHidden':![],'depth':null}));}};module[_0xdb99('0x57')]=VoiceDialReport; \ No newline at end of file +var _0xa039=['[syncDialEnd][VoiceDialReport]','inspect','addVariable','keys','variable','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','includes','duration','endtime','diff','starttime','seconds','lastevent','complete','outbound','total','answertime','answered','billableseconds','sumBillable','sumDuration','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','redis','localhost','channels','outboundChannels','variables','dialbegin','syncDialBegin','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','syncDialEnd','dialstatus','connectedlinenum','connectedlinename','connect','voice:outbound','voice_outbound_channel:save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa039,0x133));var _0x9a03=function(_0x305655,_0x2c8279){_0x305655=_0x305655-0x0;var _0xa31379=_0xa039[_0x305655];return _0xa31379;};'use strict';var _=require(_0x9a03('0x0'));var moment=require(_0x9a03('0x1'));var util=require(_0x9a03('0x2'));var Redis=require(_0x9a03('0x3'));var config=require('../../../config/environment');var logger=require(_0x9a03('0x4'))(_0x9a03('0x5'));var ami=require('../ami');config[_0x9a03('0x6')]=_['defaults'](config[_0x9a03('0x6')],{'host':_0x9a03('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9a03('0x6')]));function VoiceDialReport(_0x17e23a){this[_0x9a03('0x8')]=_0x17e23a[_0x9a03('0x9')];this['outbound']=_0x17e23a['outbound'];this[_0x9a03('0xa')]={};ami['on'](_0x9a03('0xb'),this[_0x9a03('0xc')][_0x9a03('0xd')](this));ami['on']('dialend',this['syncDialEnd'][_0x9a03('0xd')](this));ami['on'](_0x9a03('0xe'),this[_0x9a03('0xf')][_0x9a03('0xd')](this));ami['on'](_0x9a03('0x10'),this[_0x9a03('0x11')][_0x9a03('0xd')](this));}VoiceDialReport[_0x9a03('0x12')][_0x9a03('0x13')]=function(_0x5ef242){return _0x5ef242!==null&&!_[_0x9a03('0x14')](_0x5ef242);};VoiceDialReport[_0x9a03('0x12')][_0x9a03('0x15')]=function(_0x4229e5,_0x7ccee4,_0x1aa92d){io['to'](_0x4229e5)[_0x9a03('0x15')](_0x7ccee4,_0x1aa92d);};VoiceDialReport[_0x9a03('0x12')][_0x9a03('0xc')]=function(_0x21d6c2){try{if(this[_0x9a03('0x13')](_0x21d6c2)){if(this[_0x9a03('0x8')][_0x21d6c2[_0x9a03('0x16')]]){_['merge'](this[_0x9a03('0x8')][_0x21d6c2['uniqueid']],{'starttime':moment()[_0x9a03('0x17')](_0x9a03('0x18')),'lastevent':_0x9a03('0x19'),'interface':_0x21d6c2[_0x9a03('0x1a')][_0x9a03('0x1b')](0x0,_0x21d6c2['channel']['lastIndexOf']('-')),'membername':_0x21d6c2[_0x9a03('0x1a')]['substring'](_0x21d6c2[_0x9a03('0x1a')][_0x9a03('0x1c')]('/')+0x1,_0x21d6c2[_0x9a03('0x1a')][_0x9a03('0x1c')]('-'))},_[_0x9a03('0x1d')](_0x21d6c2,[_0x9a03('0x1e'),'privilege']));this[_0x9a03('0x15')]('voice:outbound','voice_outbound_channel:save',this[_0x9a03('0x8')][_0x21d6c2[_0x9a03('0x16')]]);ami[_0x9a03('0x15')](_0x9a03('0x1f'),this[_0x9a03('0x8')][_0x21d6c2[_0x9a03('0x16')]]);}}}catch(_0x44b36a){logger[_0x9a03('0x20')](_0x9a03('0x21'),util['inspect'](_0x44b36a,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9a03('0x22')]=function(_0x274e8a){try{if(this[_0x9a03('0x13')](_0x274e8a)){if(this[_0x9a03('0x8')][_0x274e8a[_0x9a03('0x16')]]){this[_0x9a03('0x8')][_0x274e8a['uniqueid']]['dialstatus']=_0x274e8a[_0x9a03('0x23')];if(_0x274e8a[_0x9a03('0x23')]==='ANSWER'){this['channels'][_0x274e8a[_0x9a03('0x16')]][_0x9a03('0x24')]=_0x274e8a[_0x9a03('0x24')];this[_0x9a03('0x8')][_0x274e8a[_0x9a03('0x16')]]['connectedlinename']=_0x274e8a[_0x9a03('0x25')];this['channels'][_0x274e8a[_0x9a03('0x16')]]['answertime']=moment()[_0x9a03('0x17')](_0x9a03('0x18'));this[_0x9a03('0x8')][_0x274e8a['uniqueid']]['lastevent']=_0x9a03('0x26');ami[_0x9a03('0x15')]('custom:dialconnect',this[_0x9a03('0x8')][_0x274e8a[_0x9a03('0x16')]]);}this[_0x9a03('0x15')](_0x9a03('0x27'),_0x9a03('0x28'),this[_0x9a03('0x8')][_0x274e8a[_0x9a03('0x16')]]);}}}catch(_0x2e1f39){logger[_0x9a03('0x20')](_0x9a03('0x29'),util[_0x9a03('0x2a')](_0x2e1f39,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9a03('0xf')]=function(_0x523edd){try{if(this[_0x9a03('0x13')](_0x523edd)){this[_0x9a03('0x2b')](_0x523edd['uniqueid'],_[_0x9a03('0x2c')](_0x523edd[_0x9a03('0x2d')])[0x0],_0x523edd['value']);if(this['isNotNull'](_0x523edd['variable'])&&this['isNotNull'](_0x523edd[_0x9a03('0x2d')][_0x9a03('0x2e')])){if(_[_0x9a03('0x14')](this[_0x9a03('0x8')][_0x523edd[_0x9a03('0x16')]])){this['channels'][_0x523edd[_0x9a03('0x16')]]={'routeId':_0x523edd['value'],'variables':this['variables'][_0x523edd[_0x9a03('0x16')]]};this[_0x9a03('0x15')](_0x9a03('0x27'),_0x9a03('0x28'),this[_0x9a03('0x8')][_0x523edd[_0x9a03('0x16')]]);}}}}catch(_0x3768c2){logger[_0x9a03('0x20')](_0x9a03('0x2f'),util[_0x9a03('0x2a')](_0x3768c2,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x9a03('0x2b')]=function(_0x354070,_0x1998b6,_0x346d02){var _0x319599=[_0x9a03('0x30'),_0x9a03('0x31'),_0x9a03('0x32'),_0x9a03('0x33'),_0x9a03('0x34'),_0x9a03('0x35'),_0x9a03('0x36'),_0x9a03('0x37'),_0x9a03('0x38'),'sipuri',_0x9a03('0x39'),_0x9a03('0x3a'),_0x9a03('0x3b'),_0x9a03('0x3c'),_0x9a03('0x3d'),'memberlastcall',_0x9a03('0x3e'),_0x9a03('0x3f'),_0x9a03('0x40')];if(!_['isNil'](_0x1998b6)&&!_[_0x9a03('0x41')](_0x319599,_0x1998b6)){if(_[_0x9a03('0x14')](this[_0x9a03('0xa')][_0x354070])){this['variables'][_0x354070]={};}this[_0x9a03('0xa')][_0x354070][_0x1998b6]=_0x346d02;}};VoiceDialReport['prototype'][_0x9a03('0x11')]=function(_0xcb0229){try{if(this[_0x9a03('0x13')](_0xcb0229)){if(this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]]){this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]]['endtime']=moment()[_0x9a03('0x17')](_0x9a03('0x18'));this['channels'][_0xcb0229[_0x9a03('0x16')]][_0x9a03('0x42')]=moment(this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]][_0x9a03('0x43')])[_0x9a03('0x44')](this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]][_0x9a03('0x45')],_0x9a03('0x46'));this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]][_0x9a03('0x47')]=_0x9a03('0x48');this[_0x9a03('0x49')][_0x9a03('0x4a')]+=0x1;if(this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]][_0x9a03('0x4b')]){this['outbound'][_0x9a03('0x4c')]+=0x1;this[_0x9a03('0x8')][_0xcb0229['uniqueid']]['holdtime']=moment(this[_0x9a03('0x8')][_0xcb0229['uniqueid']][_0x9a03('0x4b')])['diff'](this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]][_0x9a03('0x45')],_0x9a03('0x46'));this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]][_0x9a03('0x4d')]=moment(this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]]['endtime'])['diff'](this[_0x9a03('0x8')][_0xcb0229['uniqueid']][_0x9a03('0x4b')],_0x9a03('0x46'));this[_0x9a03('0x49')]['sumHoldTime']+=this['channels'][_0xcb0229[_0x9a03('0x16')]]['holdtime']||0x0;this[_0x9a03('0x49')][_0x9a03('0x4e')]+=this['channels'][_0xcb0229['uniqueid']][_0x9a03('0x4d')];}this[_0x9a03('0x49')][_0x9a03('0x4f')]+=this['channels'][_0xcb0229[_0x9a03('0x16')]][_0x9a03('0x42')];ami['emit']('custom:voiceDialReport',this['channels'][_0xcb0229[_0x9a03('0x16')]]);ami['emit'](_0x9a03('0x50'),this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]]);this[_0x9a03('0x15')](_0x9a03('0x27'),_0x9a03('0x51'),this[_0x9a03('0x49')]);logger['info'](_0x9a03('0x52'),JSON[_0x9a03('0x53')](this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]]));this[_0x9a03('0x15')](_0x9a03('0x27'),_0x9a03('0x54'),this[_0x9a03('0x8')][_0xcb0229['uniqueid']]);delete this[_0x9a03('0x8')][_0xcb0229[_0x9a03('0x16')]];}if(this[_0x9a03('0xa')][_0xcb0229[_0x9a03('0x16')]]){delete this[_0x9a03('0xa')][_0xcb0229[_0x9a03('0x16')]];}}}catch(_0x34b4af){logger[_0x9a03('0x20')](_0x9a03('0x55'),util[_0x9a03('0x2a')](_0x34b4af,{'showHidden':![],'depth':null}));}};module[_0x9a03('0x56')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 88409c9..9dc89b0 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 _0x386b=['voice_queue_channel:save','info','stringify','voice:queue:%s','emitVoiceQueueSummary','type','inbound','answered','available','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','Trunk','callerid','Interval','voice_queue:save','clearZombieChannels','Action','[queues]','then','isNotNull','queue','countBy','callers','toNumber','loggedIn','loggedin','[syncQueueSummary][VoiceQueueReport]','syncQueueSummaryComplete','syncNewExten','isUndefined','uniqueid','queuecallerjoinAt','position','count','pick','keys','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT','syncAgentComplete','assigned','lastAssignedTo','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','value','variable','queuestatus','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','syncHangup','length','diff','sumDuration','milliseconds','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','syncAttendedTransfer','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','syncBlindTransfer','BLIND','extension','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','bluebird','util','md5','ioredis','../../../config/logger','../model/queueReport','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','queueStatusComplete','unlockRR','channels','switch','isNil','channel','catch','message','No\x20such\x20channel','[voiceQueueReport][checkChannel]','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','syncFullyBooted','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','name'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x386b,0x7f));var _0xb386=function(_0x3b670e,_0x1159cc){_0x3b670e=_0x3b670e-0x0;var _0x547686=_0x386b[_0x3b670e];return _0x547686;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xb386('0x0'));var util=require(_0xb386('0x1'));var md5=require(_0xb386('0x2'));var Redis=require(_0xb386('0x3'));var config=require('../../../config/environment');var logger=require(_0xb386('0x4'))('ami');var ami=require('../ami');var QueueReport=require(_0xb386('0x5'));config[_0xb386('0x6')]=_[_0xb386('0x7')](config['redis'],{'host':_0xb386('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb386('0x6')]));var Sequence=function(){};Sequence[_0xb386('0x9')][_0xb386('0xa')]=function(_0x4d5360){this[_0xb386('0xb')]=this[_0xb386('0xb')]?this[_0xb386('0xb')][_0xb386('0xc')](_0x4d5360):_0x4d5360();};function VoiceQueueReport(_0x5964fa){this[_0xb386('0xd')]=new Sequence();this[_0xb386('0xe')]={};this[_0xb386('0xf')]=_0x5964fa[_0xb386('0xf')];this['channels']=_0x5964fa[_0xb386('0x10')];this[_0xb386('0x11')]=_0x5964fa[_0xb386('0x11')];this[_0xb386('0x12')]=!![];this['campaigns']=_0x5964fa[_0xb386('0x13')];this[_0xb386('0x14')]={};ami['on'](_0xb386('0x15'),this[_0xb386('0x16')]['bind'](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xb386('0x17')](this));ami['on']('queuecallerjoin',this[_0xb386('0x18')][_0xb386('0x17')](this));ami['on'](_0xb386('0x19'),this[_0xb386('0x1a')][_0xb386('0x17')](this));ami['on'](_0xb386('0x1b'),this[_0xb386('0x1c')][_0xb386('0x17')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xb386('0x17')](this));ami['on'](_0xb386('0x1d'),this[_0xb386('0x1e')][_0xb386('0x17')](this));ami['on'](_0xb386('0x1f'),this[_0xb386('0x20')][_0xb386('0x17')](this));ami['on'](_0xb386('0x21'),this['syncHangup'][_0xb386('0x17')](this));ami['on'](_0xb386('0x22'),this['syncFullyBooted'][_0xb386('0x17')](this));ami['on'](_0xb386('0x23'),this[_0xb386('0x24')][_0xb386('0x17')](this));ami['on'](_0xb386('0x25'),this[_0xb386('0x26')][_0xb386('0x17')](this));ami['on'](_0xb386('0x27'),this['syncAttendedTransfer'][_0xb386('0x17')](this));ami['on'](_0xb386('0x28'),this['syncBlindTransfer'][_0xb386('0x17')](this));this['loopQueueSummary']();this[_0xb386('0x29')]();}function isNotNull(_0x2c1341){return _0x2c1341!==null&&!_['isUndefined'](_0x2c1341);}function clearChannels(_0x5c4cf8){if(!_['isEmpty'](_0x5c4cf8)){for(var _0x495cd8 in _0x5c4cf8){if(_0x5c4cf8[_0xb386('0x2a')](_0x495cd8)){delete _0x5c4cf8[_0x495cd8];}}}}function clearCampaigns(_0x1b9035){if(!_[_0xb386('0x2b')](_0x1b9035)){for(var _0x4ab986 in _0x1b9035){if(_0x1b9035['hasOwnProperty'](_0x4ab986)){_0x1b9035[_0x4ab986][_0xb386('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x5aafc0){if(!_[_0xb386('0x2b')](_0x5aafc0)){for(var _0x279e1f in _0x5aafc0){if(_0x5aafc0[_0xb386('0x2a')](_0x279e1f)){_0x5aafc0[_0x279e1f]['originated']=0x0;_0x5aafc0[_0x279e1f][_0xb386('0x2d')]=0x0;_0x5aafc0[_0x279e1f]['pTalking']=0x0;_0x5aafc0[_0x279e1f]['waiting']=0x0;_0x5aafc0[_0x279e1f][_0xb386('0x2e')]=!![];}}}}function clearAgentBooked(_0x3b7475){if(!_[_0xb386('0x2b')](_0x3b7475)){for(var _0x9bb53 in _0x3b7475){if(_0x3b7475[_0xb386('0x2a')](_0x9bb53)){_0x3b7475[_0x9bb53][_0xb386('0x2f')]=!![];}}}}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0xdff90c=this;for(var _0x2939bd in this[_0xb386('0x30')]){if(this[_0xb386('0x30')]['hasOwnProperty'](_0x2939bd)&&!this['channels'][_0x2939bd][_0xb386('0x31')]){this[_0xb386('0xd')][_0xb386('0xa')](function(){if(!_[_0xb386('0x32')](_0xdff90c[_0xb386('0x30')][_0x2939bd])){return ami['Action']({'action':'status','channel':_0xdff90c[_0xb386('0x30')][_0x2939bd][_0xb386('0x33')]})[_0xb386('0x34')](function(_0x37620a){if(_0x37620a[_0xb386('0x35')]===_0xb386('0x36')){setTimeout(function(){if(_0xdff90c['channels'][_0x2939bd]){delete _0xdff90c[_0xb386('0x30')][_0x2939bd];logger['error'](_0xb386('0x37'),_0x2939bd);}if(_0xdff90c[_0xb386('0xe')][_0x2939bd]){delete _0xdff90c[_0xb386('0xe')][_0x2939bd];logger[_0xb386('0x38')](_0xb386('0x39'),_0x2939bd);}if(_0xdff90c['variables'][_0x2939bd]){delete _0xdff90c[_0xb386('0x14')][_0x2939bd];logger['error'](_0xb386('0x3a'),_0x2939bd);}},0x1f40);}});}});}}};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x3b')]=function(){logger[_0xb386('0x38')](_0xb386('0x3c'));clearChannels(this[_0xb386('0x30')]);this['clearQueueReport'](this[_0xb386('0xe')]);clearAgentBooked(this[_0xb386('0xf')]);clearVoiceQueues(this[_0xb386('0x11')]);clearCampaigns(this[_0xb386('0x13')]);};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x3d')]=function(_0x21d185){var _0x2af89b=this;if(!_[_0xb386('0x2b')](_0x21d185)){for(var _0x573bd3 in _0x21d185){if(_0x21d185['hasOwnProperty'](_0x573bd3)){_0x2af89b[_0xb386('0x3e')](_0x21d185[_0x573bd3]);delete _0x21d185[_0x573bd3];}}}};function loggerCatch(_0x5c11db){return function(_0x4f7fb1){logger[_0xb386('0x38')](_0x5c11db,util[_0xb386('0x3f')](_0x4f7fb1,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xb386('0x9')][_0xb386('0x40')]=function(_0x4c6790,_0xeeb3d6,_0x5931c8){io['to'](_0x4c6790)['emit'](_0xeeb3d6,_0x5931c8);};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x41')]=function(_0x22772f){this[_0xb386('0x40')](util[_0xb386('0x42')]('voice:queue:%s',_0x22772f[_0xb386('0x43')]),_0xb386('0x44'),_0x22772f);};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x3e')]=function(_0x56070c){logger[_0xb386('0x45')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xb386('0x46')](_0x56070c));this[_0xb386('0x40')](util[_0xb386('0x42')](_0xb386('0x47'),_0x56070c[_0xb386('0x43')]),'voice_queue_channel:remove',_0x56070c);};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x48')]=function(_0xa6cd1d){if(_0xa6cd1d[_0xb386('0x49')]===_0xb386('0x4a')){var _0x21ed87={'id':_0xa6cd1d['id'],'name':_0xa6cd1d[_0xb386('0x43')],'strategy':_0xa6cd1d['strategy'],'answered':_0xa6cd1d[_0xb386('0x4b')],'available':_0xa6cd1d[_0xb386('0x4c')],'loggedIn':_0xa6cd1d['loggedIn'],'pTalking':_0xa6cd1d['pTalking'],'sumBillable':_0xa6cd1d[_0xb386('0x4d')],'sumDuration':_0xa6cd1d['sumDuration'],'sumHoldTime':_0xa6cd1d[_0xb386('0x4e')]||0x0,'talking':_0xa6cd1d['talking'],'total':_0xa6cd1d[_0xb386('0x4f')],'type':_0xa6cd1d[_0xb386('0x49')],'unmanaged':_0xa6cd1d[_0xb386('0x50')],'abandoned':_0xa6cd1d[_0xb386('0x51')],'waiting':_0xa6cd1d[_0xb386('0x52')]};if(_0xa6cd1d[_0xb386('0x53')]){_0x21ed87[_0xb386('0x53')]={'id':_0xa6cd1d[_0xb386('0x53')]['id'],'name':_0xa6cd1d[_0xb386('0x53')][_0xb386('0x43')],'active':_0xa6cd1d[_0xb386('0x53')]['active'],'callerid':_0xa6cd1d[_0xb386('0x53')][_0xb386('0x54')]};}if(_0xa6cd1d[_0xb386('0x55')]){_0x21ed87[_0xb386('0x55')]={'id':_0xa6cd1d['Interval']['id'],'name':_0xa6cd1d[_0xb386('0x55')][_0xb386('0x43')]};}var _0x546a5e=md5(JSON[_0xb386('0x46')](_0x21ed87));if(_0xa6cd1d['md5']!==_0x546a5e){_0xa6cd1d[_0xb386('0x2')]=_0x546a5e;this[_0xb386('0x40')](util[_0xb386('0x42')](_0xb386('0x47'),_0x21ed87[_0xb386('0x43')]),_0xb386('0x56'),_0x21ed87);}}};VoiceQueueReport[_0xb386('0x9')]['isNotNull']=function(_0x2c872e){return _0x2c872e!==null&&!_['isUndefined'](_0x2c872e);};VoiceQueueReport['prototype'][_0xb386('0x29')]=function(){var _0x26e25e=this;setInterval(function(){_0x26e25e[_0xb386('0x57')]();ami[_0xb386('0x58')]({'action':'queues'})[_0xb386('0x34')](loggerCatch(_0xb386('0x59')));},0x2710);};VoiceQueueReport['prototype']['loopQueueSummary']=function(){var _0x3b72c1=this;setInterval(function(){if(_0x3b72c1[_0xb386('0x12')]){return ami[_0xb386('0x58')]({'action':_0xb386('0x15')})[_0xb386('0x5a')](function(_0x34ff0d){_0x3b72c1[_0xb386('0x12')]=![];})[_0xb386('0x34')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0xb386('0x9')]['syncQueueSummary']=function(_0x165d2b){try{if(this['isNotNull'](_0x165d2b)&&this[_0xb386('0x5b')](_0x165d2b[_0xb386('0x5c')])){if(this['voiceQueues'][_0x165d2b[_0xb386('0x5c')]]){var _0x17eff3=_[_0xb386('0x5d')](this[_0xb386('0x30')],_0xb386('0x5c'))[_0x165d2b[_0xb386('0x5c')]]||0x0;var _0x787e1=_0x17eff3-_0x165d2b[_0xb386('0x5e')];if(this[_0xb386('0x11')][_0x165d2b['queue']][_0xb386('0x52')]!==_[_0xb386('0x5f')](_0x165d2b[_0xb386('0x5e')])||this[_0xb386('0x11')][_0x165d2b['queue']][_0xb386('0x60')]!==_[_0xb386('0x5f')](_0x165d2b[_0xb386('0x61')])||this[_0xb386('0x11')][_0x165d2b[_0xb386('0x5c')]][_0xb386('0x4c')]!==_['toNumber'](_0x165d2b[_0xb386('0x4c')])||this[_0xb386('0x11')][_0x165d2b[_0xb386('0x5c')]][_0xb386('0x2d')]!==_0x787e1){this[_0xb386('0x11')][_0x165d2b[_0xb386('0x5c')]]['waiting']=_[_0xb386('0x5f')](_0x165d2b[_0xb386('0x5e')]);this[_0xb386('0x11')][_0x165d2b['queue']]['loggedIn']=_[_0xb386('0x5f')](_0x165d2b[_0xb386('0x61')]);this['voiceQueues'][_0x165d2b['queue']]['available']=_[_0xb386('0x5f')](_0x165d2b[_0xb386('0x4c')]);this[_0xb386('0x11')][_0x165d2b[_0xb386('0x5c')]]['talking']=_0x787e1>0x0?_0x787e1:0x0;this['voiceQueues'][_0x165d2b['queue']][_0xb386('0x2d')]=this['voiceQueues'][_0x165d2b[_0xb386('0x5c')]][_0xb386('0x2d')]>_['toNumber'](_0x165d2b[_0xb386('0x61')])?_[_0xb386('0x5f')](_0x165d2b[_0xb386('0x61')]):this[_0xb386('0x11')][_0x165d2b[_0xb386('0x5c')]][_0xb386('0x2d')];this[_0xb386('0x48')](this[_0xb386('0x11')][_0x165d2b['queue']]);}ami['emit']('custom:queuesummary',this[_0xb386('0x11')][_0x165d2b[_0xb386('0x5c')]]);}}}catch(_0x22173c){logger['error'](_0xb386('0x62'),util[_0xb386('0x3f')](_0x22173c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x63')]=function(_0x1de3bb){this[_0xb386('0x12')]=!![];};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x64')]=function(_0x14ece4){};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x18')]=function(_0x3c3348){try{if(this[_0xb386('0x5b')](_0x3c3348)){if(_[_0xb386('0x65')](this[_0xb386('0xe')][_0x3c3348['uniqueid']])){this[_0xb386('0xe')][_0x3c3348[_0xb386('0x66')]]=[];this[_0xb386('0x30')][_0x3c3348['uniqueid']]={};}var _0x50fc48=new QueueReport();_0x50fc48[_0xb386('0x43')]=_0x3c3348['queue'];_0x50fc48[_0xb386('0x49')]=this[_0xb386('0x11')][_0x50fc48['name']]&&this[_0xb386('0x11')][_0x50fc48[_0xb386('0x43')]][_0xb386('0x49')]?this[_0xb386('0x11')][_0x50fc48['name']][_0xb386('0x49')]||_0xb386('0x4a'):_0xb386('0x4a');_0x50fc48[_0xb386('0x5c')]=_0x3c3348['queue'];_0x50fc48[_0xb386('0x67')]=moment()[_0xb386('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x50fc48[_0xb386('0x68')]=_0x3c3348[_0xb386('0x68')];_0x50fc48[_0xb386('0x69')]=_0x3c3348[_0xb386('0x69')];_['merge'](_0x50fc48,_[_0xb386('0x6a')](_0x3c3348,_[_0xb386('0x6b')](_0x50fc48)));this[_0xb386('0xe')][_0x3c3348[_0xb386('0x66')]]['push'](_0x50fc48);this[_0xb386('0x30')][_0x3c3348['uniqueid']]=_0x50fc48;this[_0xb386('0x41')](_0x50fc48);}}catch(_0x2b08f2){logger[_0xb386('0x38')](_0xb386('0x6c'),util[_0xb386('0x3f')](_0x2b08f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x1a')]=function(_0x5a4713){try{if(this[_0xb386('0x5b')](_0x5a4713)){if(this[_0xb386('0xe')][_0x5a4713[_0xb386('0x66')]]){var _0x402456=_[_0xb386('0x6d')](this[_0xb386('0xe')][_0x5a4713['uniqueid']]);_0x402456[_0xb386('0x6e')]=![];_0x402456[_0xb386('0x6f')]=null;_0x402456[_0xb386('0x70')]=_0x5a4713[_0xb386('0x70')];_0x402456[_0xb386('0x71')]=_0x5a4713[_0xb386('0x71')];_0x402456[_0xb386('0x19')]=!![];_0x402456[_0xb386('0x72')]=moment()[_0xb386('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x402456[_0xb386('0x73')]=_0xb386('0x74');_0x402456['lastAssignedTo']=null;this['channels'][_0x5a4713[_0xb386('0x66')]]=_0x402456;this[_0xb386('0x3e')](_0x402456);}}}catch(_0x4dfd0c){logger[_0xb386('0x38')](_0xb386('0x75'),util[_0xb386('0x3f')](_0x4dfd0c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x1c')]=function(_0x384d49){try{if(this[_0xb386('0x5b')](_0x384d49)){if(this['queueReports'][_0x384d49[_0xb386('0x66')]]){var _0x5d1fcc=_[_0xb386('0x6d')](this[_0xb386('0xe')][_0x384d49[_0xb386('0x66')]]);_0x5d1fcc[_0xb386('0x76')]=moment()[_0xb386('0x42')](_0xb386('0x77'));_0x5d1fcc[_0xb386('0x78')]=_0x384d49[_0xb386('0x78')];_0x5d1fcc[_0xb386('0x79')]=_0x384d49['connectedlinename'];this[_0xb386('0x30')][_0x384d49[_0xb386('0x66')]]=_0x5d1fcc;this['emitVoiceQueueChannelSave'](_0x5d1fcc);}}}catch(_0x1cf095){logger[_0xb386('0x38')](_0xb386('0x7a'),util[_0xb386('0x3f')](_0x1cf095,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x1e')]=function(_0x4da19f){try{if(this[_0xb386('0x5b')](_0x4da19f)){if(this[_0xb386('0xe')][_0x4da19f[_0xb386('0x66')]]){var _0x35c440=_[_0xb386('0x6d')](this[_0xb386('0xe')][_0x4da19f[_0xb386('0x66')]]);_0x35c440['queuecallercomplete']=!![];_0x35c440[_0xb386('0x73')]=_0xb386('0x7b');}}}catch(_0x5a41c5){logger[_0xb386('0x38')]('[syncAgentConnect][VoiceQueueReport]',util['inspect'](_0x5a41c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb386('0x9')][_0xb386('0x7c')]=function(_0x55335b){try{if(this[_0xb386('0x5b')](_0x55335b)){if(this[_0xb386('0xe')][_0x55335b[_0xb386('0x66')]]){var _0x2b0931=_['last'](this[_0xb386('0xe')][_0x55335b[_0xb386('0x66')]]);_0x2b0931[_0xb386('0x19')]=![];_0x2b0931[_0xb386('0x72')]=null;_0x2b0931[_0xb386('0x7d')]=!![];_0x2b0931[_0xb386('0x7e')]=_0x55335b[_0xb386('0x7f')];_0x2b0931['holdtime']=_0x55335b[_0xb386('0x70')];_0x2b0931[_0xb386('0x6e')]=!![];_0x2b0931[_0xb386('0x80')]=![];_0x2b0931[_0xb386('0x81')]=null;if(!_0x2b0931[_0xb386('0x82')]){if(_0x55335b[_0xb386('0x83')]==_0xb386('0x82')){_0x2b0931['queuecallerexitreason']=_0xb386('0x84');}else{if(_['startsWith'](_0x55335b[_0xb386('0x33')][_0xb386('0x85')](),_0xb386('0x86'))){if(this[_0xb386('0xe')][_0x55335b[_0xb386('0x87')]]){var _0x4c0542=_['last'](this['queueReports'][_0x55335b['linkedid']]);_0x4c0542['queuecallercomplete']=![];_0x4c0542[_0xb386('0x80')]=!![];_0x4c0542['queuecallerexitAt']=moment(_0x2b0931[_0xb386('0x67')])['add'](_0x55335b[_0xb386('0x70')],_0xb386('0x88'))[_0xb386('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c0542['queuecallerexitreason']=_0xb386('0x89');_0x4c0542[_0xb386('0x82')]=!![];_0x4c0542['transfertype']=_0xb386('0x8a');_0x4c0542[_0xb386('0x8b')]=_0x55335b[_0xb386('0x8c')];_0x4c0542[_0xb386('0x8d')]=_0x55335b['uniqueid'];var _0x45c171=this[_0xb386('0xe')][_0x55335b[_0xb386('0x87')]];this['queueReports'][_0x55335b[_0xb386('0x87')]]=this[_0xb386('0xe')][_0x55335b[_0xb386('0x66')]];this[_0xb386('0xe')][_0x55335b['uniqueid']]=_0x45c171;}}else{_0x2b0931[_0xb386('0x73')]=_0xb386('0x8e')+_0x55335b['reason'][_0xb386('0x8f')]();}}}this[_0xb386('0x30')][_0x55335b[_0xb386('0x66')]]=_0x2b0931;this[_0xb386('0x3e')](_0x2b0931);}}}catch(_0x45ea36){logger[_0xb386('0x38')]('[syncAgentComplete][VoiceQueueReport]',util[_0xb386('0x3f')](_0x45ea36,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb386('0x9')]['syncVarSet']=function(_0x430a71){try{if(this[_0xb386('0x5b')](_0x430a71)){this['addVariable'](_0x430a71['uniqueid'],_[_0xb386('0x6b')](_0x430a71['variable'])[0x0],_0x430a71[_0xb386('0x90')]);if(this['queueReports'][_0x430a71[_0xb386('0x66')]]){var _0x340ec3=_[_0xb386('0x6d')](this['queueReports'][_0x430a71['uniqueid']]);if(_0x340ec3){if(this['isNotNull'](_0x430a71[_0xb386('0x91')])&&this[_0xb386('0x5b')](_0x430a71['variable'][_0xb386('0x92')])){switch(_0x430a71[_0xb386('0x90')]){case _0xb386('0x93'):_0x340ec3[_0xb386('0x80')]=![];_0x340ec3[_0xb386('0x81')]=null;break;case _0xb386('0x94'):_0x340ec3[_0xb386('0x95')]=_0xb386('0x96');ami[_0xb386('0x40')](_0xb386('0x97'),_0x340ec3);break;default:_0x340ec3['queuecallerexit']=!![];_0x340ec3[_0xb386('0x81')]=moment()[_0xb386('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x340ec3[_0xb386('0x76')]=moment()[_0xb386('0x42')](_0xb386('0x77'));}_0x340ec3[_0xb386('0x19')]=![];_0x340ec3[_0xb386('0x72')]=null;_0x340ec3['queuecallerexitreason']=_0x430a71[_0xb386('0x90')];this[_0xb386('0x30')][_0x430a71[_0xb386('0x66')]]=_0x340ec3;this['emitVoiceQueueChannelRemove'](_0x340ec3);}else if(this[_0xb386('0x5b')](_0x430a71[_0xb386('0x91')])&&this[_0xb386('0x5b')](_0x430a71['variable']['queueposition'])){if(!_0x340ec3[_0xb386('0x19')]){_0x340ec3[_0xb386('0x80')]=!![];_0x340ec3[_0xb386('0x81')]=moment()[_0xb386('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x340ec3['queuecallerexitreason']=_0xb386('0x98');_0x340ec3[_0xb386('0x76')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb386('0x30')][_0x430a71[_0xb386('0x66')]]=_0x340ec3;}}_0x340ec3[_0xb386('0x14')]=this[_0xb386('0x14')][_0x430a71[_0xb386('0x66')]];}}}}catch(_0x596c4a){logger['error'](_0xb386('0x99'),util['inspect'](_0x596c4a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x13debd,_0x43db1d,_0x865e0b){var _0x5f3379=[_0xb386('0x9a'),_0xb386('0x9b'),'rtpaudioqosjitter',_0xb386('0x9c'),'rtpaudioqosloss',_0xb386('0x9d'),_0xb386('0x9e'),_0xb386('0x9f'),_0xb386('0xa0'),'sipuri',_0xb386('0xa1'),'bridgepvtcallid',_0xb386('0xa2'),_0xb386('0xa3'),_0xb386('0xa4'),_0xb386('0xa5'),_0xb386('0x7f'),'memberpenalty',_0xb386('0xa6')];if(!_[_0xb386('0x32')](_0x43db1d)&&!_[_0xb386('0xa7')](_0x5f3379,_0x43db1d)){if(_['isUndefined'](this[_0xb386('0x14')][_0x13debd])){this['variables'][_0x13debd]={};}this[_0xb386('0x14')][_0x13debd][_0x43db1d]=_0x865e0b;}};VoiceQueueReport['prototype'][_0xb386('0xa8')]=function(_0x5aa526){try{if(this[_0xb386('0x5b')](_0x5aa526)){if(this[_0xb386('0xe')][_0x5aa526[_0xb386('0x66')]]){for(var _0x40431b=0x0,_0x99f1c={};_0x40431b0x0?_0x33dcb6:0x0;this[_0x31dd('0x11')][_0x536cb2[_0x31dd('0x5f')]]['talking']=this[_0x31dd('0x11')][_0x536cb2[_0x31dd('0x5f')]][_0x31dd('0x2d')]>_[_0x31dd('0x62')](_0x536cb2[_0x31dd('0x63')])?_[_0x31dd('0x62')](_0x536cb2[_0x31dd('0x63')]):this['voiceQueues'][_0x536cb2[_0x31dd('0x5f')]]['talking'];this[_0x31dd('0x64')](this[_0x31dd('0x11')][_0x536cb2[_0x31dd('0x5f')]]);}ami[_0x31dd('0x41')](_0x31dd('0x65'),this[_0x31dd('0x11')][_0x536cb2['queue']]);}}}catch(_0x5cd876){logger['error'](_0x31dd('0x66'),util[_0x31dd('0x40')](_0x5cd876,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x31dd('0x67')]=function(_0x3362e3){this[_0x31dd('0x12')]=!![];};VoiceQueueReport[_0x31dd('0xb')][_0x31dd('0x68')]=function(_0x24aa46){};VoiceQueueReport[_0x31dd('0xb')][_0x31dd('0x69')]=function(_0x40485d){try{if(this[_0x31dd('0x5b')](_0x40485d)){if(_[_0x31dd('0x29')](this[_0x31dd('0xe')][_0x40485d[_0x31dd('0x6a')]])){this[_0x31dd('0xe')][_0x40485d['uniqueid']]=[];this['channels'][_0x40485d[_0x31dd('0x6a')]]={};}var _0x199e8b=new QueueReport();_0x199e8b[_0x31dd('0x44')]=_0x40485d[_0x31dd('0x5f')];_0x199e8b[_0x31dd('0x52')]=this[_0x31dd('0x11')][_0x199e8b[_0x31dd('0x44')]]&&this[_0x31dd('0x11')][_0x199e8b[_0x31dd('0x44')]][_0x31dd('0x52')]?this[_0x31dd('0x11')][_0x199e8b[_0x31dd('0x44')]][_0x31dd('0x52')]||_0x31dd('0x49'):'inbound';_0x199e8b[_0x31dd('0x5f')]=_0x40485d[_0x31dd('0x5f')];_0x199e8b['queuecallerjoinAt']=moment()[_0x31dd('0x42')](_0x31dd('0x6b'));_0x199e8b[_0x31dd('0x6c')]=_0x40485d[_0x31dd('0x6c')];_0x199e8b[_0x31dd('0x6d')]=_0x40485d[_0x31dd('0x6d')];_[_0x31dd('0x6e')](_0x199e8b,_[_0x31dd('0x6f')](_0x40485d,_[_0x31dd('0x70')](_0x199e8b)));this['queueReports'][_0x40485d[_0x31dd('0x6a')]][_0x31dd('0x71')](_0x199e8b);this[_0x31dd('0x10')][_0x40485d[_0x31dd('0x6a')]]=_0x199e8b;this[_0x31dd('0x72')](_0x199e8b);}}catch(_0x5331e9){logger[_0x31dd('0x3b')](_0x31dd('0x73'),util[_0x31dd('0x40')](_0x5331e9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x31dd('0x1a')]=function(_0xb464e4){try{if(this[_0x31dd('0x5b')](_0xb464e4)){if(this[_0x31dd('0xe')][_0xb464e4[_0x31dd('0x6a')]]){var _0x24645e=_[_0x31dd('0x74')](this[_0x31dd('0xe')][_0xb464e4[_0x31dd('0x6a')]]);_0x24645e['queuecallercomplete']=![];_0x24645e[_0x31dd('0x75')]=null;_0x24645e[_0x31dd('0x76')]=_0xb464e4[_0x31dd('0x76')];_0x24645e[_0x31dd('0x77')]=_0xb464e4[_0x31dd('0x77')];_0x24645e[_0x31dd('0x78')]=!![];_0x24645e[_0x31dd('0x79')]=moment()['format'](_0x31dd('0x6b'));_0x24645e[_0x31dd('0x7a')]=_0x31dd('0x7b');_0x24645e[_0x31dd('0x7c')]=null;this[_0x31dd('0x10')][_0xb464e4['uniqueid']]=_0x24645e;this[_0x31dd('0x3f')](_0x24645e);}}}catch(_0x55751f){logger[_0x31dd('0x3b')](_0x31dd('0x7d'),util[_0x31dd('0x40')](_0x55751f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31dd('0xb')][_0x31dd('0x7e')]=function(_0x41df6b){try{if(this[_0x31dd('0x5b')](_0x41df6b)){if(this[_0x31dd('0xe')][_0x41df6b[_0x31dd('0x6a')]]){var _0x5ac924=_[_0x31dd('0x74')](this[_0x31dd('0xe')][_0x41df6b[_0x31dd('0x6a')]]);_0x5ac924['queuecallerleaveAt']=moment()[_0x31dd('0x42')](_0x31dd('0x6b'));_0x5ac924[_0x31dd('0x7f')]=_0x41df6b[_0x31dd('0x7f')];_0x5ac924['connectedlinename']=_0x41df6b[_0x31dd('0x80')];this['channels'][_0x41df6b[_0x31dd('0x6a')]]=_0x5ac924;this[_0x31dd('0x72')](_0x5ac924);}}}catch(_0x28bdaa){logger[_0x31dd('0x3b')](_0x31dd('0x81'),util[_0x31dd('0x40')](_0x28bdaa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31dd('0xb')][_0x31dd('0x1e')]=function(_0x31602d){try{if(this[_0x31dd('0x5b')](_0x31602d)){if(this['queueReports'][_0x31602d['uniqueid']]){var _0xf65fcd=_[_0x31dd('0x74')](this[_0x31dd('0xe')][_0x31602d[_0x31dd('0x6a')]]);_0xf65fcd[_0x31dd('0x82')]=!![];_0xf65fcd[_0x31dd('0x7a')]=_0x31dd('0x83');}}}catch(_0x4357c7){logger[_0x31dd('0x3b')](_0x31dd('0x84'),util[_0x31dd('0x40')](_0x4357c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31dd('0xb')][_0x31dd('0x85')]=function(_0x1d160f){try{if(this['isNotNull'](_0x1d160f)){if(this[_0x31dd('0xe')][_0x1d160f['uniqueid']]){var _0x22037b=_['last'](this[_0x31dd('0xe')][_0x1d160f['uniqueid']]);_0x22037b[_0x31dd('0x78')]=![];_0x22037b[_0x31dd('0x79')]=null;_0x22037b[_0x31dd('0x86')]=!![];_0x22037b[_0x31dd('0x7c')]=_0x1d160f['membername'];_0x22037b['holdtime']=_0x1d160f[_0x31dd('0x76')];_0x22037b['queuecallercomplete']=!![];_0x22037b[_0x31dd('0x87')]=![];_0x22037b['queuecallerexitAt']=null;if(!_0x22037b[_0x31dd('0x88')]){if(_0x1d160f[_0x31dd('0x89')]==_0x31dd('0x88')){_0x22037b[_0x31dd('0x7a')]='COMPLETED';}else{if(_[_0x31dd('0x8a')](_0x1d160f[_0x31dd('0x38')][_0x31dd('0x8b')](),_0x31dd('0x8c'))){if(this['queueReports'][_0x1d160f['linkedid']]){var _0x3c2085=_[_0x31dd('0x74')](this[_0x31dd('0xe')][_0x1d160f['linkedid']]);_0x3c2085['queuecallercomplete']=![];_0x3c2085[_0x31dd('0x87')]=!![];_0x3c2085[_0x31dd('0x8d')]=moment(_0x22037b[_0x31dd('0x8e')])[_0x31dd('0x8f')](_0x1d160f[_0x31dd('0x76')],'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3c2085['queuecallerexitreason']=_0x31dd('0x90');_0x3c2085[_0x31dd('0x88')]=!![];_0x3c2085[_0x31dd('0x91')]=_0x31dd('0x92');_0x3c2085['transferexten']=_0x1d160f['destexten'];_0x3c2085['transferuniqueid']=_0x1d160f[_0x31dd('0x6a')];var _0x1b84a7=this['queueReports'][_0x1d160f[_0x31dd('0x93')]];this[_0x31dd('0xe')][_0x1d160f['linkedid']]=this[_0x31dd('0xe')][_0x1d160f[_0x31dd('0x6a')]];this[_0x31dd('0xe')][_0x1d160f['uniqueid']]=_0x1b84a7;}}else{_0x22037b[_0x31dd('0x7a')]='COMPLETEDBY'+_0x1d160f[_0x31dd('0x89')]['toUpperCase']();}}}this[_0x31dd('0x10')][_0x1d160f[_0x31dd('0x6a')]]=_0x22037b;this[_0x31dd('0x3f')](_0x22037b);}}}catch(_0xb61e31){logger[_0x31dd('0x3b')](_0x31dd('0x94'),util['inspect'](_0xb61e31,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x31dd('0x95')]=function(_0x3597bb){try{if(this[_0x31dd('0x5b')](_0x3597bb)){this[_0x31dd('0x96')](_0x3597bb[_0x31dd('0x6a')],_['keys'](_0x3597bb[_0x31dd('0x97')])[0x0],_0x3597bb[_0x31dd('0x98')]);if(this[_0x31dd('0xe')][_0x3597bb[_0x31dd('0x6a')]]){var _0x533bf3=_[_0x31dd('0x74')](this[_0x31dd('0xe')][_0x3597bb[_0x31dd('0x6a')]]);if(_0x533bf3){if(this[_0x31dd('0x5b')](_0x3597bb[_0x31dd('0x97')])&&this[_0x31dd('0x5b')](_0x3597bb[_0x31dd('0x97')][_0x31dd('0x99')])){switch(_0x3597bb[_0x31dd('0x98')]){case _0x31dd('0x9a'):_0x533bf3['queuecallerexit']=![];_0x533bf3[_0x31dd('0x8d')]=null;break;case'TIMEOUT':_0x533bf3[_0x31dd('0x9b')]=_0x31dd('0x9c');ami[_0x31dd('0x41')](_0x31dd('0x9d'),_0x533bf3);break;default:_0x533bf3[_0x31dd('0x87')]=!![];_0x533bf3[_0x31dd('0x8d')]=moment()[_0x31dd('0x42')](_0x31dd('0x6b'));_0x533bf3[_0x31dd('0x9e')]=moment()[_0x31dd('0x42')](_0x31dd('0x6b'));}_0x533bf3[_0x31dd('0x78')]=![];_0x533bf3[_0x31dd('0x79')]=null;_0x533bf3[_0x31dd('0x7a')]=_0x3597bb[_0x31dd('0x98')];this[_0x31dd('0x10')][_0x3597bb[_0x31dd('0x6a')]]=_0x533bf3;this[_0x31dd('0x3f')](_0x533bf3);}else if(this[_0x31dd('0x5b')](_0x3597bb[_0x31dd('0x97')])&&this[_0x31dd('0x5b')](_0x3597bb['variable'][_0x31dd('0x9f')])){if(!_0x533bf3[_0x31dd('0x78')]){_0x533bf3['queuecallerexit']=!![];_0x533bf3['queuecallerexitAt']=moment()[_0x31dd('0x42')](_0x31dd('0x6b'));_0x533bf3[_0x31dd('0x7a')]=_0x31dd('0xa0');_0x533bf3['queuecallerleaveAt']=moment()[_0x31dd('0x42')](_0x31dd('0x6b'));this['channels'][_0x3597bb[_0x31dd('0x6a')]]=_0x533bf3;}}_0x533bf3[_0x31dd('0x14')]=this[_0x31dd('0x14')][_0x3597bb[_0x31dd('0x6a')]];}}}}catch(_0x48484b){logger[_0x31dd('0x3b')](_0x31dd('0xa1'),util[_0x31dd('0x40')](_0x48484b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x31dd('0xb')][_0x31dd('0x96')]=function(_0x2a5ed3,_0x4c7869,_0x16b484){var _0x4bd3a6=[_0x31dd('0xa2'),_0x31dd('0xa3'),'rtpaudioqosjitter',_0x31dd('0xa4'),_0x31dd('0xa5'),_0x31dd('0xa6'),_0x31dd('0xa7'),_0x31dd('0xa8'),'sipcallid',_0x31dd('0xa9'),_0x31dd('0xaa'),'bridgepvtcallid','membercalls',_0x31dd('0xab'),'memberinterface',_0x31dd('0xac'),_0x31dd('0xad'),_0x31dd('0xae'),_0x31dd('0xaf')];if(!_[_0x31dd('0x35')](_0x4c7869)&&!_[_0x31dd('0xb0')](_0x4bd3a6,_0x4c7869)){if(_[_0x31dd('0x29')](this[_0x31dd('0x14')][_0x2a5ed3])){this[_0x31dd('0x14')][_0x2a5ed3]={};}this[_0x31dd('0x14')][_0x2a5ed3][_0x4c7869]=_0x16b484;}};VoiceQueueReport['prototype'][_0x31dd('0x20')]=function(_0x2ecc9c){try{if(this[_0x31dd('0x5b')](_0x2ecc9c)){if(this[_0x31dd('0xe')][_0x2ecc9c[_0x31dd('0x6a')]]){for(var _0x3f8c72=0x0,_0x14480e={};_0x3f8c72=0x0?moment(_0x42ac9e[_0xaaf3('0x17')])[_0xaaf3('0xd')](_0x42ac9e[_0xaaf3('0x16')],_0xaaf3('0x18')):null,'data1':'outbound','data2':_0x42ac9e[_0xaaf3('0x12')],'data3':_0x42ac9e[_0xaaf3('0x10')],'data4':_0x42ac9e[_0xaaf3('0x19')]||null,'role':_0xaaf3('0x11'),'internal':_0x42ac9e[_0xaaf3('0x12')]?_[_0xaaf3('0x13')](_0x42ac9e['accountcode']):undefined,'uniqueid':_0x42ac9e['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x6652=['SIP/%s','queuecallerleaveAt','seconds','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','endtime','starttime','dialstring','moment','lodash','util','../client','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6652,0x128));var _0x2665=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6652[_0x2a6809];return _0x11c371;};'use strict';var moment=require(_0x2665('0x0'));var _=require(_0x2665('0x1'));var util=require(_0x2665('0x2'));var client=require(_0x2665('0x3'));exports['voiceQueueReport']=function(_0x905dca){var _0x5643dc=_0x905dca['queuecallercompleteAt']||_0x905dca[_0x2665('0x4')];return client[_0x2665('0x5')](_0x2665('0x6'),{'body':{'channel':_0x2665('0x7'),'membername':_0x905dca[_0x2665('0x8')],'interface':_[_0x2665('0x9')](_0x905dca[_0x2665('0xa')])?util[_0x2665('0xb')](_0x2665('0xc'),_0x905dca[_0x2665('0x8')]):_0x905dca[_0x2665('0xa')],'type':'TALKING','enterAt':_0x905dca[_0x2665('0xd')],'exitAt':_0x5643dc,'duration':moment(_0x5643dc)['diff'](_0x905dca[_0x2665('0xd')],_0x2665('0xe')),'data1':_0x2665('0xf'),'data2':_0x905dca[_0x2665('0x10')],'data3':_0x905dca[_0x2665('0x11')],'data4':null,'data5':_0x905dca['queue'],'role':_0x2665('0x12'),'internal':_0x905dca[_0x2665('0x13')]?_[_0x2665('0x14')](_0x905dca[_0x2665('0x13')]):undefined,'uniqueid':_0x905dca[_0x2665('0x15')]},'log':'CreateMemberReport'});};exports[_0x2665('0x16')]=function(_0x147860){return client[_0x2665('0x5')](_0x2665('0x6'),{'body':{'channel':_0x2665('0x7'),'membername':_0x147860[_0x2665('0x17')],'interface':_0x147860[_0x2665('0xa')],'type':_0x2665('0x18'),'enterAt':_0x147860['starttime'],'exitAt':_0x147860['endtime'],'duration':moment(_0x147860[_0x2665('0x19')])['diff'](_0x147860[_0x2665('0x1a')],_0x2665('0xe'))>=0x0?moment(_0x147860[_0x2665('0x19')])['diff'](_0x147860[_0x2665('0x1a')],_0x2665('0xe')):null,'data1':'outbound','data2':_0x147860[_0x2665('0x13')],'data3':_0x147860[_0x2665('0x11')],'data4':_0x147860[_0x2665('0x1b')]||null,'role':'agent','internal':_0x147860[_0x2665('0x13')]?_[_0x2665('0x14')](_0x147860[_0x2665('0x13')]):undefined,'uniqueid':_0x147860['uniqueid']},'log':_0x2665('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9deb483..91c9165 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 _0x9354=['getTemplates','Request','GetTemplate','name','html'];(function(_0x348071,_0x4218b9){var _0x19e327=function(_0x4bfa44){while(--_0x4bfa44){_0x348071['push'](_0x348071['shift']());}};_0x19e327(++_0x4218b9);}(_0x9354,0x96));var _0x4935=function(_0x399e3b,_0x5dd3d2){_0x399e3b=_0x399e3b-0x0;var _0x28c6a4=_0x9354[_0x399e3b];return _0x28c6a4;};'use strict';var client=require('../client');exports[_0x4935('0x0')]=function(_0xc3c1f3){return function(_0x4896da){return client[_0x4935('0x1')](_0x4935('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4935('0x3'),_0x4935('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x0427=['name','html','GetTemplate'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x0427,0x137));var _0x7042=function(_0x2729f3,_0x268322){_0x2729f3=_0x2729f3-0x0;var _0x25b9c4=_0x0427[_0x2729f3];return _0x25b9c4;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x1295ad){return function(_0x1fe4cf){return client['Request'](_0x7042('0x0'),{'options':{'raw':!![],'attributes':['id',_0x7042('0x1'),_0x7042('0x2')]},'log':_0x7042('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5200540..2657fdd 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 _0xeef2=['AnyConditions','Action','Actions','action','data1','data2','data4','data6','data7','../client','GetTrigger','name','channel','status','Condition','field','operator','value'];(function(_0x4ef7bc,_0x1e8207){var _0x30a74f=function(_0x5c728e){while(--_0x5c728e){_0x4ef7bc['push'](_0x4ef7bc['shift']());}};_0x30a74f(++_0x1e8207);}(_0xeef2,0x1b9));var _0x2eef=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xeef2[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0x2eef('0x0'));exports['getTriggers']=function(_0x527bfe){return function(_0x1a31da){return client['Request'](_0x2eef('0x1'),{'options':{'raw':![],'attributes':['id',_0x2eef('0x2'),_0x2eef('0x3'),_0x2eef('0x4')],'include':[{'model':_0x2eef('0x5'),'as':'AllConditions','attributes':['id',_0x2eef('0x6'),_0x2eef('0x7'),_0x2eef('0x8')]},{'model':_0x2eef('0x5'),'as':_0x2eef('0x9'),'attributes':['id','field',_0x2eef('0x7'),_0x2eef('0x8')]},{'model':_0x2eef('0xa'),'as':_0x2eef('0xb'),'attributes':['id',_0x2eef('0xc'),_0x2eef('0xd'),_0x2eef('0xe'),'data3',_0x2eef('0xf'),'data5',_0x2eef('0x10'),_0x2eef('0x11')]}]},'log':_0x2eef('0x1')});};}; \ No newline at end of file +var _0x2cad=['data1','data2','data3','data4','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','AllConditions','field','value','operator','Action','Actions','action'];(function(_0x12f5b9,_0x564924){var _0x4d30bd=function(_0x5c7a47){while(--_0x5c7a47){_0x12f5b9['push'](_0x12f5b9['shift']());}};_0x4d30bd(++_0x564924);}(_0x2cad,0x1be));var _0xd2ca=function(_0x56562d,_0x578183){_0x56562d=_0x56562d-0x0;var _0xdafef9=_0x2cad[_0x56562d];return _0xdafef9;};'use strict';var client=require(_0xd2ca('0x0'));exports[_0xd2ca('0x1')]=function(_0x1e013d){return function(_0x277857){return client[_0xd2ca('0x2')](_0xd2ca('0x3'),{'options':{'raw':![],'attributes':['id',_0xd2ca('0x4'),_0xd2ca('0x5'),_0xd2ca('0x6')],'include':[{'model':'Condition','as':_0xd2ca('0x7'),'attributes':['id',_0xd2ca('0x8'),'operator',_0xd2ca('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0xd2ca('0x8'),_0xd2ca('0xa'),_0xd2ca('0x9')]},{'model':_0xd2ca('0xb'),'as':_0xd2ca('0xc'),'attributes':['id',_0xd2ca('0xd'),_0xd2ca('0xe'),_0xd2ca('0xf'),_0xd2ca('0x10'),_0xd2ca('0x11'),'data5',_0xd2ca('0x12'),_0xd2ca('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index eea5762..9db280e 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 _0x9266=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x9266,0x121));var _0x6926=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x9266[_0x3899d1];return _0xeb4a7d;};'use strict';var client=require(_0x6926('0x0'));exports[_0x6926('0x1')]=function(_0x5f0b8a){return function(_0x13b301){return client[_0x6926('0x2')](_0x6926('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6926('0x4'),_0x6926('0x5')]},'log':_0x6926('0x3')});};}; \ No newline at end of file +var _0x5d49=['../client','Request','GetTrunk','name'];(function(_0x1d24fb,_0x2f9e07){var _0x59e146=function(_0xd56180){while(--_0xd56180){_0x1d24fb['push'](_0x1d24fb['shift']());}};_0x59e146(++_0x2f9e07);}(_0x5d49,0x108));var _0x95d4=function(_0x778809,_0x564755){_0x778809=_0x778809-0x0;var _0x3fe78f=_0x5d49[_0x778809];return _0x3fe78f;};'use strict';var client=require(_0x95d4('0x0'));exports['getTrunks']=function(_0x21b408){return function(_0x47efe){return client[_0x95d4('0x1')](_0x95d4('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x95d4('0x3'),'registry']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c9fb4af..06b5cce 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 _0x0643=['ShowUser','agent','../client','getAgents','fullname','online','pauseType','lastPauseAt','mobile','interface','getTelephones','telephone','name','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','Request'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x0643,0xf9));var _0x3064=function(_0x57fbc8,_0x5f1746){_0x57fbc8=_0x57fbc8-0x0;var _0xfcf1de=_0x0643[_0x57fbc8];return _0xfcf1de;};'use strict';var client=require(_0x3064('0x0'));exports[_0x3064('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name','email','accountcode',_0x3064('0x2'),_0x3064('0x3'),'lastLoginAt',_0x3064('0x4'),_0x3064('0x5'),'voicePause','phone',_0x3064('0x6'),_0x3064('0x7')]},'log':_0x3064('0x1')});};};exports[_0x3064('0x8')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x3064('0x9')},'attributes':['id',_0x3064('0xa'),'accountcode','internal']},'log':_0x3064('0x8')});};};exports[_0x3064('0xb')]=function(_0x214de2,_0x2d6d33,_0x238db0){return client['Request'](_0x3064('0xc'),{'body':{'type':_0x2d6d33,'uniqueid':_0x238db0},'options':{'where':{'id':_0x214de2['id']}},'log':_0x3064('0xb')});};exports[_0x3064('0xd')]=function(_0x2622d5){return client['Request'](_0x3064('0xe'),{'body':{},'options':{'where':{'id':_0x2622d5['id']}},'log':_0x3064('0xb')});};exports[_0x3064('0xf')]=function(_0xdb06c5){return client[_0x3064('0x10')](_0x3064('0x11'),{'options':{'raw':![],'where':{'role':_0x3064('0x12'),'id':_0xdb06c5},'attributes':['id',_0x3064('0xa'),'email','accountcode',_0x3064('0x2'),_0x3064('0x3'),'lastLoginAt','pauseType',_0x3064('0x5'),'voicePause',_0x3064('0x7')]},'log':_0x3064('0xf')});}; \ No newline at end of file +var _0x9cb4=['pauseType','voicePause','phone','interface','telephone','name','internal','getTelephones','savePause','PauseUser','UnpauseUser','getAgent','ShowUser','email','lastPauseAt','getAgents','Request','GetUser','agent','accountcode','fullname','online','lastLoginAt'];(function(_0x582232,_0x3dbbd9){var _0x42fe89=function(_0x4044a2){while(--_0x4044a2){_0x582232['push'](_0x582232['shift']());}};_0x42fe89(++_0x3dbbd9);}(_0x9cb4,0x1db));var _0x49cb=function(_0x20f329,_0x5e541e){_0x20f329=_0x20f329-0x0;var _0x2e36af=_0x9cb4[_0x20f329];return _0x2e36af;};'use strict';var client=require('../client');exports[_0x49cb('0x0')]=function(){return function(){return client[_0x49cb('0x1')](_0x49cb('0x2'),{'options':{'raw':![],'where':{'role':_0x49cb('0x3')},'attributes':['id','name','email',_0x49cb('0x4'),_0x49cb('0x5'),_0x49cb('0x6'),_0x49cb('0x7'),_0x49cb('0x8'),'lastPauseAt',_0x49cb('0x9'),_0x49cb('0xa'),'mobile',_0x49cb('0xb')]},'log':_0x49cb('0x0')});};};exports['getTelephones']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x49cb('0xc')},'attributes':['id',_0x49cb('0xd'),_0x49cb('0x4'),_0x49cb('0xe')]},'log':_0x49cb('0xf')});};};exports[_0x49cb('0x10')]=function(_0x532da6,_0x177476,_0x560ad6){return client[_0x49cb('0x1')](_0x49cb('0x11'),{'body':{'type':_0x177476,'uniqueid':_0x560ad6},'options':{'where':{'id':_0x532da6['id']}},'log':_0x49cb('0x10')});};exports['saveUnpause']=function(_0x33a6d5){return client['Request'](_0x49cb('0x12'),{'body':{},'options':{'where':{'id':_0x33a6d5['id']}},'log':_0x49cb('0x10')});};exports[_0x49cb('0x13')]=function(_0x2e56d8){return client[_0x49cb('0x1')](_0x49cb('0x14'),{'options':{'raw':![],'where':{'role':_0x49cb('0x3'),'id':_0x2e56d8},'attributes':['id',_0x49cb('0xd'),_0x49cb('0x15'),_0x49cb('0x4'),_0x49cb('0x5'),_0x49cb('0x6'),_0x49cb('0x7'),_0x49cb('0x8'),_0x49cb('0x16'),_0x49cb('0x9'),_0x49cb('0xb')]},'log':_0x49cb('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d731732..62309c7 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 _0x4517=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','create'];(function(_0x4340f3,_0x3768c7){var _0x1385a8=function(_0x35efd7){while(--_0x35efd7){_0x4340f3['push'](_0x4340f3['shift']());}};_0x1385a8(++_0x3768c7);}(_0x4517,0x112));var _0x7451=function(_0x5796e1,_0x5096f2){_0x5796e1=_0x5796e1-0x0;var _0x2c69f2=_0x4517[_0x5796e1];return _0x2c69f2;};'use strict';var client=require('../client');exports[_0x7451('0x0')]=function(_0x24ebb4){return client['Request'](_0x7451('0x1'),{'body':_0x24ebb4,'log':_0x7451('0x1')});};exports[_0x7451('0x2')]=function(_0x286bf4,_0x355fbd,_0x21b34c){return client[_0x7451('0x3')](_0x7451('0x4'),{'body':_0x286bf4,'options':{'where':{'uniqueid':_0x355fbd,'interface':_0x21b34c,'agentcomplete':!![]}},'log':_0x7451('0x4')});}; \ No newline at end of file +var _0xd239=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x2c32fd,_0x93cdd0){var _0x3867e9=function(_0x757efa){while(--_0x757efa){_0x2c32fd['push'](_0x2c32fd['shift']());}};_0x3867e9(++_0x93cdd0);}(_0xd239,0x92));var _0x9d23=function(_0x55c253,_0x59f0d8){_0x55c253=_0x55c253-0x0;var _0x3123f1=_0xd239[_0x55c253];return _0x3123f1;};'use strict';var client=require(_0x9d23('0x0'));exports[_0x9d23('0x1')]=function(_0x22a6cb){return client[_0x9d23('0x2')](_0x9d23('0x3'),{'body':_0x22a6cb,'log':_0x9d23('0x3')});};exports[_0x9d23('0x4')]=function(_0x21f76b,_0x244586,_0x2fe856){return client[_0x9d23('0x2')](_0x9d23('0x5'),{'body':_0x21f76b,'options':{'where':{'uniqueid':_0x244586,'interface':_0x2fe856,'agentcomplete':!![]}},'log':_0x9d23('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 22948e2..9370629 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 _0x966c=['moment','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','billableseconds','GetVoiceCallReports'];(function(_0x4fbde2,_0x364951){var _0x2bce29=function(_0x3a97c9){while(--_0x3a97c9){_0x4fbde2['push'](_0x4fbde2['shift']());}};_0x2bce29(++_0x364951);}(_0x966c,0x1b0));var _0xc966=function(_0x5971e9,_0x284346){_0x5971e9=_0x5971e9-0x0;var _0x2716c6=_0x966c[_0x5971e9];return _0x2716c6;};'use strict';var moment=require(_0xc966('0x0'));var util=require('util');var _=require('lodash');var client=require(_0xc966('0x1'));exports[_0xc966('0x2')]=function(_0x2df963){return client[_0xc966('0x3')](_0xc966('0x4'),{'body':_[_0xc966('0x5')](_0x2df963,{'source':_0x2df963[_0xc966('0x6')],'destinationcontext':_0x2df963[_0xc966('0x7')],'callerid':_0x2df963['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0xc966('0x8')]=function(){return function(){return client[_0xc966('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xc966('0x9')],'createdAt':{'$between':[moment()[_0xc966('0xa')](_0xc966('0xb'))[_0xc966('0xc')](_0xc966('0xd')),moment()[_0xc966('0xe')](_0xc966('0xb'))[_0xc966('0xc')](_0xc966('0xd'))]}},'attributes':[_0xc966('0xf'),'disposition','duration',_0xc966('0x10')]},'log':_0xc966('0x11')});};}; \ No newline at end of file +var _0x1e95=['moment','util','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','duration','billableseconds','GetVoiceCallReports'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x1e95,0x11e));var _0x51e9=function(_0x199647,_0x4ebb9a){_0x199647=_0x199647-0x0;var _0x57824c=_0x1e95[_0x199647];return _0x57824c;};'use strict';var moment=require(_0x51e9('0x0'));var util=require(_0x51e9('0x1'));var _=require(_0x51e9('0x2'));var client=require('../client');exports[_0x51e9('0x3')]=function(_0x1a71b5){return client[_0x51e9('0x4')](_0x51e9('0x5'),{'body':_[_0x51e9('0x6')](_0x1a71b5,{'source':_0x1a71b5[_0x51e9('0x7')],'destinationcontext':_0x1a71b5[_0x51e9('0x8')],'callerid':_0x1a71b5['callerid'],'amaflags':_0x51e9('0x9')}),'log':_0x51e9('0x5')});};exports[_0x51e9('0xa')]=function(){return function(){return client[_0x51e9('0x4')](_0x51e9('0xb'),{'options':{'where':{'type':[_0x51e9('0xc')],'createdAt':{'$between':[moment()[_0x51e9('0xd')]('day')[_0x51e9('0xe')](_0x51e9('0xf')),moment()[_0x51e9('0x10')](_0x51e9('0x11'))[_0x51e9('0xe')](_0x51e9('0xf'))]}},'attributes':['type',_0x51e9('0x12'),_0x51e9('0x13'),_0x51e9('0x14')]},'log':_0x51e9('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f18bc17..9cd87cc 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 _0x48ff=['Request','CreateVoiceDialReport','../client','create'];(function(_0x4a6ab4,_0x209ca9){var _0x18ce6e=function(_0x586864){while(--_0x586864){_0x4a6ab4['push'](_0x4a6ab4['shift']());}};_0x18ce6e(++_0x209ca9);}(_0x48ff,0xa6));var _0xf48f=function(_0x17bf65,_0x31068d){_0x17bf65=_0x17bf65-0x0;var _0x33f463=_0x48ff[_0x17bf65];return _0x33f463;};'use strict';var client=require(_0xf48f('0x0'));exports[_0xf48f('0x1')]=function(_0x1fee1c){return client[_0xf48f('0x2')](_0xf48f('0x3'),{'body':_0x1fee1c,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x13ca=['Request','CreateVoiceDialReport','../client','create'];(function(_0x2afb55,_0x4ec468){var _0x18ca73=function(_0x3cdd6e){while(--_0x3cdd6e){_0x2afb55['push'](_0x2afb55['shift']());}};_0x18ca73(++_0x4ec468);}(_0x13ca,0xd2));var _0xa13c=function(_0x585e79,_0xb18da5){_0x585e79=_0x585e79-0x0;var _0x2974a2=_0x13ca[_0x585e79];return _0x2974a2;};'use strict';var client=require(_0xa13c('0x0'));exports[_0xa13c('0x1')]=function(_0x24d194){return client[_0xa13c('0x2')]('CreateVoiceDialReport',{'body':_0x24d194,'log':_0xa13c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7913cea..d13bec6 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 _0x8a5c=['Request','GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x312f0e,_0x2f4af7){var _0x31b683=function(_0x27c207){while(--_0x27c207){_0x312f0e['push'](_0x312f0e['shift']());}};_0x31b683(++_0x2f4af7);}(_0x8a5c,0x136));var _0xc8a5=function(_0x2f50aa,_0x581e1a){_0x2f50aa=_0x2f50aa-0x0;var _0x54c1cd=_0x8a5c[_0x2f50aa];return _0x54c1cd;};'use strict';var client=require(_0xc8a5('0x0'));exports[_0xc8a5('0x1')]=function(){return function(){return client[_0xc8a5('0x2')](_0xc8a5('0x3'),{'options':{'raw':!![],'attributes':['id',_0xc8a5('0x4'),_0xc8a5('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xc8a5('0x1')});};}; \ No newline at end of file +var _0x93b5=['../client','getVoiceExtensions','exten','recordingFormat'];(function(_0x4b4a82,_0x1a6c90){var _0x1e88f1=function(_0x56bd8a){while(--_0x56bd8a){_0x4b4a82['push'](_0x4b4a82['shift']());}};_0x1e88f1(++_0x1a6c90);}(_0x93b5,0x178));var _0x593b=function(_0x272e8c,_0x3947c6){_0x272e8c=_0x272e8c-0x0;var _0x119d3a=_0x93b5[_0x272e8c];return _0x119d3a;};'use strict';var client=require(_0x593b('0x0'));exports[_0x593b('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x593b('0x2'),_0x593b('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x593b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 23c29cb..1f3e627 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 _0x46f6=['dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence'];(function(_0x416ea6,_0x2375d9){var _0x590656=function(_0x4d753a){while(--_0x4d753a){_0x416ea6['push'](_0x416ea6['shift']());}};_0x590656(++_0x2375d9);}(_0x46f6,0x110));var _0x646f=function(_0x57b52e,_0x4cb04b){_0x57b52e=_0x57b52e-0x0;var _0x2fb0c1=_0x46f6[_0x57b52e];return _0x2fb0c1;};'use strict';var client=require(_0x646f('0x0'));exports[_0x646f('0x1')]=function(){return function(){return client[_0x646f('0x2')](_0x646f('0x3'),{'options':{'raw':![],'attributes':['id',_0x646f('0x4'),_0x646f('0x5'),_0x646f('0x6'),_0x646f('0x7'),'monitor_format',_0x646f('0x8'),_0x646f('0x9'),'dialMethod','dialLimitChannel','dialLimitQueue',_0x646f('0xa'),_0x646f('0xb'),_0x646f('0xc'),_0x646f('0xd'),_0x646f('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0x646f('0xf'),_0x646f('0x10'),_0x646f('0x11'),_0x646f('0x12'),_0x646f('0x13'),'dialBusyRetryFrequency',_0x646f('0x14'),_0x646f('0x15'),_0x646f('0x16'),_0x646f('0x17'),'dialGlobalInterval',_0x646f('0x18'),_0x646f('0x19'),_0x646f('0x1a'),_0x646f('0x1b'),_0x646f('0x1c'),'dialAMDAfterGreetingSilence',_0x646f('0x1d'),_0x646f('0x1e'),_0x646f('0x1f'),_0x646f('0x20'),_0x646f('0x21'),_0x646f('0x22'),'timeout',_0x646f('0x23'),_0x646f('0x24'),_0x646f('0x25'),'dialAgiAfterHangupAgent',_0x646f('0x26'),_0x646f('0x27'),_0x646f('0x28'),_0x646f('0x29'),_0x646f('0x2a'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x646f('0x2b'),'dialDropMaxRetry',_0x646f('0x2c'),_0x646f('0x2d'),_0x646f('0x2e'),'dialMachineMaxRetry',_0x646f('0x2f'),_0x646f('0x30'),'dialAgentRejectRetryFrequency',_0x646f('0x31'),_0x646f('0x32'),_0x646f('0x33')],'include':[{'model':_0x646f('0x34'),'as':_0x646f('0x34'),'attributes':['id','name',_0x646f('0x35'),_0x646f('0x36')]},{'model':_0x646f('0x37'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x646f('0x34'),'as':_0x646f('0x38'),'attributes':['id','name',_0x646f('0x35'),_0x646f('0x36')]},{'model':_0x646f('0x39'),'as':'Interval','attributes':['id',_0x646f('0x4')],'include':[{'model':_0x646f('0x39'),'as':_0x646f('0x3a'),'attributes':['id',_0x646f('0x4'),_0x646f('0x3b')]}]}]},'log':_0x646f('0x1')});};}; \ No newline at end of file +var _0xf4b1=['type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','autopause','monitor_format'];(function(_0x287eaf,_0x41d318){var _0x321683=function(_0x4bda72){while(--_0x4bda72){_0x287eaf['push'](_0x287eaf['shift']());}};_0x321683(++_0x41d318);}(_0xf4b1,0xaa));var _0x1f4b=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xf4b1[_0x4154a6];return _0x3b2786;};'use strict';var client=require(_0x1f4b('0x0'));exports[_0x1f4b('0x1')]=function(){return function(){return client[_0x1f4b('0x2')](_0x1f4b('0x3'),{'options':{'raw':![],'attributes':['id',_0x1f4b('0x4'),'acw','acwTimeout',_0x1f4b('0x5'),_0x1f4b('0x6'),_0x1f4b('0x7'),_0x1f4b('0x8'),_0x1f4b('0x9'),_0x1f4b('0xa'),_0x1f4b('0xb'),'dialPowerLevel',_0x1f4b('0xc'),_0x1f4b('0xd'),_0x1f4b('0xe'),_0x1f4b('0xf'),_0x1f4b('0x10'),_0x1f4b('0x11'),'dialQueueOptions',_0x1f4b('0x12'),_0x1f4b('0x13'),_0x1f4b('0x14'),_0x1f4b('0x15'),_0x1f4b('0x16'),_0x1f4b('0x17'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x1f4b('0x18'),_0x1f4b('0x19'),'dialPrefix','dialCheckDuplicateType',_0x1f4b('0x1a'),_0x1f4b('0x1b'),'dialAMDGreeting',_0x1f4b('0x1c'),_0x1f4b('0x1d'),'dialAMDMinWordLength',_0x1f4b('0x1e'),'dialAMDMaximumNumberOfWords',_0x1f4b('0x1f'),_0x1f4b('0x20'),_0x1f4b('0x21'),_0x1f4b('0x22'),'dialRecallInQueue',_0x1f4b('0x23'),_0x1f4b('0x24'),'dialAgiAfterHangupClient',_0x1f4b('0x25'),_0x1f4b('0x6'),_0x1f4b('0x26'),_0x1f4b('0x27'),_0x1f4b('0x28'),_0x1f4b('0x29'),_0x1f4b('0x2a'),_0x1f4b('0x2b'),_0x1f4b('0x2c'),_0x1f4b('0x2d'),_0x1f4b('0x2e'),'dialMachineMaxRetry',_0x1f4b('0x2f'),'dialAgentRejectMaxRetry',_0x1f4b('0x30'),'mandatoryDisposition',_0x1f4b('0x31'),_0x1f4b('0x32')],'include':[{'model':'Trunk','as':_0x1f4b('0x33'),'attributes':['id',_0x1f4b('0x4'),_0x1f4b('0x34'),_0x1f4b('0x35')]},{'model':_0x1f4b('0x36'),'as':_0x1f4b('0x37'),'attributes':['id','name']},{'model':_0x1f4b('0x33'),'as':_0x1f4b('0x38'),'attributes':['id','name',_0x1f4b('0x34'),_0x1f4b('0x35')]},{'model':_0x1f4b('0x39'),'as':_0x1f4b('0x39'),'attributes':['id',_0x1f4b('0x4')],'include':[{'model':_0x1f4b('0x39'),'as':_0x1f4b('0x3a'),'attributes':['id',_0x1f4b('0x4'),'interval']}]}]},'log':_0x1f4b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 56bcec1..1042622 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 _0x3d65=['queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid'];(function(_0xa6d071,_0x502a94){var _0x42cbfc=function(_0x566f90){while(--_0x566f90){_0xa6d071['push'](_0xa6d071['shift']());}};_0x42cbfc(++_0x502a94);}(_0x3d65,0x8c));var _0x53d6=function(_0x2587ca,_0x231303){_0x2587ca=_0x2587ca-0x0;var _0x5aada1=_0x3d65[_0x2587ca];return _0x5aada1;};'use strict';var moment=require(_0x53d6('0x0'));var _=require(_0x53d6('0x1'));var client=require(_0x53d6('0x2'));exports[_0x53d6('0x3')]=function(_0x19ce79){return client[_0x53d6('0x4')]('CreateVoiceQueueReport',{'body':_0x19ce79,'log':_0x53d6('0x5')});};exports[_0x53d6('0x6')]=function(){return function(){return client[_0x53d6('0x4')](_0x53d6('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x53d6('0x8')]('day')[_0x53d6('0x9')](_0x53d6('0xa')),moment()[_0x53d6('0xb')](_0x53d6('0xc'))['format'](_0x53d6('0xa'))]}},'attributes':[_0x53d6('0xd'),'queue',_0x53d6('0xe'),_0x53d6('0xf'),_0x53d6('0x10'),_0x53d6('0x11'),_0x53d6('0x12'),_0x53d6('0x13'),_0x53d6('0x14'),_0x53d6('0x15')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x5e2f=['format','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','startOf','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3bb282,_0x4d230c){var _0x66ee92=function(_0x4fa048){while(--_0x4fa048){_0x3bb282['push'](_0x3bb282['shift']());}};_0x66ee92(++_0x4d230c);}(_0x5e2f,0x133));var _0xf5e2=function(_0x448012,_0x5109cf){_0x448012=_0x448012-0x0;var _0x274222=_0x5e2f[_0x448012];return _0x274222;};'use strict';var moment=require(_0xf5e2('0x0'));var _=require(_0xf5e2('0x1'));var client=require(_0xf5e2('0x2'));exports[_0xf5e2('0x3')]=function(_0x4fc359){return client[_0xf5e2('0x4')](_0xf5e2('0x5'),{'body':_0x4fc359,'log':'CreateVoiceQueueReport'});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xf5e2('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xf5e2('0x6')]('day')['format'](_0xf5e2('0x7')),moment()['endOf']('day')[_0xf5e2('0x8')](_0xf5e2('0x7'))]}},'attributes':[_0xf5e2('0x9'),'queue',_0xf5e2('0xa'),_0xf5e2('0xb'),'queuecallercomplete',_0xf5e2('0xc'),'queuecallerexit','queuecallerexitAt','queuecallerabandon',_0xf5e2('0xd')]},'log':_0xf5e2('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index f69ec22..c57ddc4 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 _0x0e00=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x39ac48,_0x529d67){var _0xedabc=function(_0x5a8fa1){while(--_0x5a8fa1){_0x39ac48['push'](_0x39ac48['shift']());}};_0xedabc(++_0x529d67);}(_0x0e00,0x15b));var _0x00e0=function(_0x918d80,_0x510b42){_0x918d80=_0x918d80-0x0;var _0x1e7925=_0x0e00[_0x918d80];return _0x1e7925;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x1a5764){return function(){return client[_0x00e0('0x0')](_0x00e0('0x1'),{'options':{'where':{'VoiceQueueId':_0x1a5764,'paused':!![]},'raw':!![]},'log':_0x00e0('0x2')});};}; \ No newline at end of file +var _0x648d=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x2cc638,_0x5edb3d){var _0x54911b=function(_0x3b4a8f){while(--_0x3b4a8f){_0x2cc638['push'](_0x2cc638['shift']());}};_0x54911b(++_0x5edb3d);}(_0x648d,0xec));var _0xd648=function(_0x2ed7b8,_0x1edcb1){_0x2ed7b8=_0x2ed7b8-0x0;var _0x2e1428=_0x648d[_0x2ed7b8];return _0x2e1428;};'use strict';var client=require('../client');exports[_0xd648('0x0')]=function(_0x1f807f){return function(){return client['Request'](_0xd648('0x1'),{'options':{'where':{'VoiceQueueId':_0x1f807f,'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 4b85b8b..d5d644b 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 _0x8311=['CreateVoiceRecording','merge','create'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x8311,0x9b));var _0x1831=function(_0x592b13,_0x3f3a48){_0x592b13=_0x592b13-0x0;var _0x362545=_0x8311[_0x592b13];return _0x362545;};'use strict';var _=require('lodash');var client=require('../client');exports[_0x1831('0x0')]=function(_0x741a57){return client['Request'](_0x1831('0x1'),{'body':_[_0x1831('0x2')](_0x741a57,{'value':_0x741a57['monitorFilename']}),'log':_0x1831('0x1')});}; \ No newline at end of file +var _0x1752=['monitorFilename','lodash','../client','Request','CreateVoiceRecording','merge'];(function(_0x5033da,_0x28668b){var _0x47e33f=function(_0x2bef96){while(--_0x2bef96){_0x5033da['push'](_0x5033da['shift']());}};_0x47e33f(++_0x28668b);}(_0x1752,0x133));var _0x2175=function(_0x424730,_0x1bd691){_0x424730=_0x424730-0x0;var _0x5d8d0b=_0x1752[_0x424730];return _0x5d8d0b;};'use strict';var _=require(_0x2175('0x0'));var client=require(_0x2175('0x1'));exports['create']=function(_0x4df7dc){return client[_0x2175('0x2')](_0x2175('0x3'),{'body':_[_0x2175('0x4')](_0x4df7dc,{'value':_0x4df7dc[_0x2175('0x5')]}),'log':_0x2175('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 5ce867f..b30c411 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 _0xb64a=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','context','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','result','transfererchannel'];(function(_0x3e5772,_0x4449dc){var _0x53724c=function(_0x35da66){while(--_0x35da66){_0x3e5772['push'](_0x3e5772['shift']());}};_0x53724c(++_0x4449dc);}(_0xb64a,0x151));var _0xab64=function(_0x24009c,_0x1faf6b){_0x24009c=_0x24009c-0x0;var _0x22d9a5=_0xb64a[_0x24009c];return _0x22d9a5;};'use strict';var client=require(_0xab64('0x0'));exports[_0xab64('0x1')]=function(_0x357e3a){return client[_0xab64('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x357e3a[_0xab64('0x3')],'transfererchannel':_0x357e3a[_0xab64('0x4')],'transferercalleridnum':_0x357e3a[_0xab64('0x5')],'transferercalleridname':_0x357e3a[_0xab64('0x6')],'transfererconnectedlinenum':_0x357e3a[_0xab64('0x7')],'transfererconnectedlinename':_0x357e3a[_0xab64('0x8')],'transfereraccountcode':_0x357e3a['transfereraccountcode'],'transferercontext':_0x357e3a[_0xab64('0x9')],'transfererexten':_0x357e3a[_0xab64('0xa')],'transfererlinkedid':_0x357e3a[_0xab64('0xb')],'transfereechannel':_0x357e3a[_0xab64('0xc')],'transfereecalleridnum':_0x357e3a[_0xab64('0xd')],'transfereecalleridname':_0x357e3a['transfereecalleridname'],'transfereeconnectedlinenum':_0x357e3a[_0xab64('0xe')],'transfereeconnectedlinename':_0x357e3a[_0xab64('0xf')],'transfereeaccountcode':_0x357e3a[_0xab64('0x10')],'transfereecontext':_0x357e3a['transfereecontext'],'transfereeexten':_0x357e3a[_0xab64('0x11')],'transfereelinkedid':_0x357e3a[_0xab64('0x12')],'isexternal':_0x357e3a['isexternal'],'context':_0x357e3a[_0xab64('0x13')],'extension':_0x357e3a['extension'],'type':_0xab64('0x14')},'log':_0xab64('0x15')});};exports[_0xab64('0x16')]=function(_0x494099){return client[_0xab64('0x2')](_0xab64('0x15'),{'body':{'result':_0x494099[_0xab64('0x3')],'transfererchannel':_0x494099[_0xab64('0x17')],'transferercalleridnum':_0x494099['origtransferercalleridnum'],'transferercalleridname':_0x494099[_0xab64('0x18')],'transfererconnectedlinenum':_0x494099[_0xab64('0x19')],'transfererconnectedlinename':_0x494099['secondtransfererconnectedlinename'],'transfereraccountcode':_0x494099['origtransfereraccountcode'],'transferercontext':_0x494099[_0xab64('0x1a')],'transfererexten':_0x494099[_0xab64('0x1b')],'transfererlinkedid':_0x494099['origtransfererlinkedid'],'transfereechannel':_0x494099['transfertargetchannel'],'transfereecalleridnum':_0x494099[_0xab64('0x1c')],'transfereecalleridname':_0x494099[_0xab64('0x1d')],'transfereeconnectedlinenum':_0x494099['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x494099[_0xab64('0x1e')],'transfereeaccountcode':_0x494099[_0xab64('0x1f')],'transfereecontext':_0x494099[_0xab64('0x20')],'transfereeexten':_0x494099[_0xab64('0x21')],'transfereelinkedid':_0x494099['transfertargetlinkedid'],'isexternal':_0x494099[_0xab64('0x22')],'context':_0x494099[_0xab64('0x23')],'extension':_0x494099[_0xab64('0x24')],'type':_0xab64('0x25')},'log':_0xab64('0x15')});}; \ No newline at end of file +var _0xfb74=['origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','blind','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb74,0x14b));var _0x4fb7=function(_0x49ebed,_0x2ed245){_0x49ebed=_0x49ebed-0x0;var _0x247194=_0xfb74[_0x49ebed];return _0x247194;};'use strict';var client=require(_0x4fb7('0x0'));exports[_0x4fb7('0x1')]=function(_0x125876){return client[_0x4fb7('0x2')](_0x4fb7('0x3'),{'body':{'result':_0x125876['result'],'transfererchannel':_0x125876[_0x4fb7('0x4')],'transferercalleridnum':_0x125876[_0x4fb7('0x5')],'transferercalleridname':_0x125876[_0x4fb7('0x6')],'transfererconnectedlinenum':_0x125876[_0x4fb7('0x7')],'transfererconnectedlinename':_0x125876[_0x4fb7('0x8')],'transfereraccountcode':_0x125876[_0x4fb7('0x9')],'transferercontext':_0x125876[_0x4fb7('0xa')],'transfererexten':_0x125876[_0x4fb7('0xb')],'transfererlinkedid':_0x125876[_0x4fb7('0xc')],'transfereechannel':_0x125876[_0x4fb7('0xd')],'transfereecalleridnum':_0x125876[_0x4fb7('0xe')],'transfereecalleridname':_0x125876['transfereecalleridname'],'transfereeconnectedlinenum':_0x125876[_0x4fb7('0xf')],'transfereeconnectedlinename':_0x125876[_0x4fb7('0x10')],'transfereeaccountcode':_0x125876[_0x4fb7('0x11')],'transfereecontext':_0x125876[_0x4fb7('0x12')],'transfereeexten':_0x125876[_0x4fb7('0x13')],'transfereelinkedid':_0x125876[_0x4fb7('0x14')],'isexternal':_0x125876[_0x4fb7('0x15')],'context':_0x125876['context'],'extension':_0x125876['extension'],'type':_0x4fb7('0x16')},'log':_0x4fb7('0x3')});};exports['attendedTransfer']=function(_0x4b7cbd){return client[_0x4fb7('0x2')](_0x4fb7('0x3'),{'body':{'result':_0x4b7cbd['result'],'transfererchannel':_0x4b7cbd['origtransfererchannel'],'transferercalleridnum':_0x4b7cbd[_0x4fb7('0x17')],'transferercalleridname':_0x4b7cbd[_0x4fb7('0x18')],'transfererconnectedlinenum':_0x4b7cbd[_0x4fb7('0x19')],'transfererconnectedlinename':_0x4b7cbd[_0x4fb7('0x1a')],'transfereraccountcode':_0x4b7cbd[_0x4fb7('0x1b')],'transferercontext':_0x4b7cbd[_0x4fb7('0x1c')],'transfererexten':_0x4b7cbd['secondtransfererexten'],'transfererlinkedid':_0x4b7cbd[_0x4fb7('0x1d')],'transfereechannel':_0x4b7cbd['transfertargetchannel'],'transfereecalleridnum':_0x4b7cbd['transfertargetcalleridnum'],'transfereecalleridname':_0x4b7cbd[_0x4fb7('0x1e')],'transfereeconnectedlinenum':_0x4b7cbd['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4b7cbd[_0x4fb7('0x1f')],'transfereeaccountcode':_0x4b7cbd[_0x4fb7('0x20')],'transfereecontext':_0x4b7cbd[_0x4fb7('0x21')],'transfereeexten':_0x4b7cbd[_0x4fb7('0x22')],'transfereelinkedid':_0x4b7cbd[_0x4fb7('0x23')],'isexternal':_0x4b7cbd[_0x4fb7('0x15')],'context':_0x4b7cbd['origtransferercontext'],'extension':_0x4b7cbd['origtransfererexten'],'type':'attended'},'log':_0x4fb7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 54d7d5e..a059ea2 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 _0xbedf=['sumHoldTime','talking','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','channels','voicechannel','map','find','uniqueid','channel','%s.%s','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','wav','status','values','voicequeuechannel','queueChannels','Hangup','exten','context','telephones','outboundChannels','outbound','run','event','emit','custom:','faxAccounts','checkAfterSend','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','format','%s/%s','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','module','Reload','Action','catch','error','message','join','command','action','Command','then','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumDuration'];(function(_0x436bc5,_0x47b676){var _0x3795fc=function(_0x12daa5){while(--_0x12daa5){_0x436bc5['push'](_0x436bc5['shift']());}};_0x3795fc(++_0x47b676);}(_0xbedf,0xe2));var _0xfbed=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0xbedf[_0x5e7b6c];return _0x3afdbd;};'use strict';var _=require(_0xfbed('0x0'));var util=require(_0xfbed('0x1'));var jayson=require(_0xfbed('0x2'));var schema=require(_0xfbed('0x3'));var BPromise=require(_0xfbed('0x4'));var moment=require(_0xfbed('0x5'));var config=require('../../../config/environment');var properties=require(_0xfbed('0x6'));var ami=require(_0xfbed('0x7'));exports[_0xfbed('0x8')]=function(_0x531047,_0x47f7fc,_0x4c8f00){return new BPromise(function(_0x50aafc,_0x5b2b27){var _0xaef696={'QueuePause':function(_0xf45a3d){return new Promise(function(_0xc6de1,_0x52679e){var _0x2365c4=util[_0xfbed('0x9')](_0xfbed('0xa'),'SIP',_0xf45a3d[_0xfbed('0xb')]);if(_0x531047[_0xfbed('0xc')]&&_0x531047[_0xfbed('0xc')][_0x2365c4]&&_0x531047[_0xfbed('0xc')][_0x2365c4][_0xfbed('0xd')]){_0x531047[_0xfbed('0xc')][_0x2365c4][_0xfbed('0xe')]();}if(_0x531047[_0xfbed('0xf')][_0x2365c4]){_0x531047[_0xfbed('0xf')][_0x2365c4]['updateStatusRealtime']({'statePause':_0xf45a3d[_0xfbed('0x10')]?!![]:![]});}_0xc6de1({'code':0xc8,'message':_0xfbed('0x11')});});},'Reload':function(_0x2d6af8){var _0xfed5cd=this;return new Promise(function(_0x295c41,_0x255de7){if(ami[_0xfbed('0x12')]()==![]){return _0x255de7(_0xfed5cd['error'](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')][_0xfbed('0x14')],_0xfbed('0x15')]['join']('\x20')));}_0x2d6af8=_[_0xfbed('0x16')](_0x2d6af8,_[_0xfbed('0x17')](properties[_0xfbed('0x18')]));_0x2d6af8['action']=_0xfbed('0x19');return ami[_0xfbed('0x1a')](_0x2d6af8)['then'](function(_0x16565e){_0x295c41({'code':0xc8,'message':_0x16565e['message']});})[_0xfbed('0x1b')](function(_0x2cbd2d){_0x255de7(_0xfed5cd[_0xfbed('0x1c')](0x1f5,_0x2cbd2d[_0xfbed('0x1d')]));});});},'Command':function(_0x46e801){var _0x57626d=this;return new Promise(function(_0x277c09,_0x145d88){if(ami['isConnected']()==![]){return _0x145d88(_0x57626d[_0xfbed('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0xfbed('0x13')][_0xfbed('0x14')],_0xfbed('0x15')][_0xfbed('0x1e')]('\x20')));}_0x46e801=_[_0xfbed('0x16')](_0x46e801,_0xfbed('0x1f'));_0x46e801[_0xfbed('0x20')]=_0xfbed('0x21');return ami[_0xfbed('0x1a')](_0x46e801)[_0xfbed('0x22')](function(_0x2a705e){_0x277c09({'code':0xc8,'message':_0x2a705e['content']});})[_0xfbed('0x1b')](function(_0x84af64){_0x145d88(_0x57626d[_0xfbed('0x1c')](0x1f5,_0x84af64[_0xfbed('0x1d')]));});});},'VoiceQueues':function(_0xcdf046){return new Promise(function(_0x2f998f,_0x267ca0){var _0x5c9be5=[];for(var _0x53511b in _0x531047[_0xfbed('0x23')]){if(_0x531047['voiceQueues']['hasOwnProperty'](_0x53511b)){var _0x528584=_0x531047['voiceQueues'][_0x53511b];var _0xa3198c={'id':_0x528584['id'],'name':_0x528584[_0xfbed('0xb')],'strategy':_0x528584[_0xfbed('0x24')],'answered':_0x528584[_0xfbed('0x25')],'available':_0x528584[_0xfbed('0x26')],'loggedIn':_0x528584[_0xfbed('0x27')],'pTalking':_0x528584[_0xfbed('0x28')],'sumBillable':_0x528584['sumBillable'],'sumDuration':_0x528584[_0xfbed('0x29')],'sumHoldTime':_0x528584[_0xfbed('0x2a')]||0x0,'talking':_0x528584[_0xfbed('0x2b')],'total':_0x528584['total'],'type':_0x528584[_0xfbed('0x2c')],'unmanaged':_0x528584[_0xfbed('0x2d')],'abandoned':_0x528584[_0xfbed('0x2e')],'waiting':_0x528584['waiting'],'loggedInDb':_0x528584[_0xfbed('0x2f')]};if(_0x528584[_0xfbed('0x2c')]==='outbound'){_0xa3198c[_0xfbed('0x30')]=_0x528584[_0xfbed('0x30')];_0xa3198c['dialMethod']=_0x528584[_0xfbed('0x31')];_0xa3198c[_0xfbed('0x32')]=_0x528584[_0xfbed('0x32')];_0xa3198c[_0xfbed('0x33')]=_0x528584['dialOriginateCallerIdNumber'];_0xa3198c['dialOriginateTimeout']=_0x528584[_0xfbed('0x34')];_0xa3198c[_0xfbed('0x35')]=_0x528584['dialPrefix'];_0xa3198c[_0xfbed('0x36')]=_0x528584['outboundAnswerAgiCallsDay'];_0xa3198c[_0xfbed('0x37')]=_0x528584[_0xfbed('0x37')];_0xa3198c[_0xfbed('0x38')]=_0x528584['outboundBlacklistCallsDay'];_0xa3198c[_0xfbed('0x39')]=_0x528584[_0xfbed('0x39')];_0xa3198c['outboundCongestionCallsDay']=_0x528584[_0xfbed('0x3a')];_0xa3198c[_0xfbed('0x3b')]=_0x528584[_0xfbed('0x3b')];_0xa3198c[_0xfbed('0x3c')]=_0x528584['outboundDropCallsDayCallersExit'];_0xa3198c[_0xfbed('0x3d')]=_0x528584[_0xfbed('0x3d')];_0xa3198c[_0xfbed('0x3e')]=_0x528584[_0xfbed('0x3e')];_0xa3198c[_0xfbed('0x3f')]=_0x528584['outboundNoSuchCallsDay'];_0xa3198c['outboundOriginateFailureCallsDay']=_0x528584[_0xfbed('0x40')];_0xa3198c[_0xfbed('0x41')]=_0x528584['outboundReCallsDay'];_0xa3198c[_0xfbed('0x42')]=_0x528584[_0xfbed('0x42')];_0xa3198c[_0xfbed('0x43')]=_0x528584[_0xfbed('0x43')];_0xa3198c['predictiveIntervalAnsweredCalls']=_0x528584[_0xfbed('0x44')];_0xa3198c[_0xfbed('0x45')]=_0x528584['predictiveIntervalAvgHoldtime'];_0xa3198c[_0xfbed('0x46')]=_0x528584[_0xfbed('0x46')];_0xa3198c['predictiveIntervalDroppedCallsCallersExit']=_0x528584[_0xfbed('0x47')];_0xa3198c[_0xfbed('0x48')]=_0x528584[_0xfbed('0x48')];_0xa3198c[_0xfbed('0x49')]=_0x528584['predictiveIntervalErlangCalls'];_0xa3198c[_0xfbed('0x4a')]=_0x528584[_0xfbed('0x4a')];_0xa3198c[_0xfbed('0x4b')]=_0x528584[_0xfbed('0x4b')];_0xa3198c[_0xfbed('0x4c')]=_0x528584[_0xfbed('0x4c')];_0xa3198c[_0xfbed('0x4d')]=_0x528584[_0xfbed('0x4d')];_0xa3198c[_0xfbed('0x4e')]=_0x528584[_0xfbed('0x4e')];_0xa3198c[_0xfbed('0x4f')]=_0x528584['predictiveIntervalTotalCalls'];_0xa3198c[_0xfbed('0x1d')]=_0x528584[_0xfbed('0x1d')];_0xa3198c[_0xfbed('0x50')]=_0x528584[_0xfbed('0x50')];_0xa3198c['erlangCalls']=_0x528584[_0xfbed('0x51')];_0xa3198c[_0xfbed('0x52')]=_0x528584[_0xfbed('0x52')];_0xa3198c[_0xfbed('0x53')]=_0x528584[_0xfbed('0x53')];_0xa3198c[_0xfbed('0x54')]=_0x528584[_0xfbed('0x54')];_0xa3198c[_0xfbed('0x55')]=_0x528584[_0xfbed('0x55')];_0xa3198c[_0xfbed('0x56')]=_0x528584['startProgressive'];}if(_0x528584[_0xfbed('0x57')]){_0xa3198c[_0xfbed('0x57')]={'id':_0x528584[_0xfbed('0x57')]['id'],'name':_0x528584['Trunk'][_0xfbed('0xb')],'active':_0x528584[_0xfbed('0x57')][_0xfbed('0x58')],'callerid':_0x528584[_0xfbed('0x57')][_0xfbed('0x59')]};}if(_0x528584['Interval']){_0xa3198c[_0xfbed('0x5a')]={'id':_0x528584[_0xfbed('0x5a')]['id'],'name':_0x528584[_0xfbed('0x5a')][_0xfbed('0xb')]};}_0x5c9be5[_0xfbed('0x5b')](_0xa3198c);}}_0x2f998f({'count':_0x5c9be5[_0xfbed('0x5c')],'rows':_0x5c9be5});});},'VoiceChannels':function(_0x3b7799){return new Promise(function(_0x41d289,_0x3013a8){var _0x11cfcb=_['values'](_0x531047[_0xfbed('0x5d')]);_0x41d289({'count':_0x11cfcb[_0xfbed('0x5c')],'rows':_0x11cfcb});});},'VoiceChannelMixMonitor':function(_0x51a737){var _0x866040=this;return new Promise(function(_0x73bf72,_0x291ba9){if(ami[_0xfbed('0x12')]()==![]){return _0x291ba9(_0x866040[_0xfbed('0x1c')](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')]['username'],_0xfbed('0x15')][_0xfbed('0x1e')]('\x20')));}var _0xbf6025=schema(properties[_0xfbed('0x5e')])[_0xfbed('0x3')](_0x51a737);if(_0xbf6025[_0xfbed('0x5c')]>0x0){return _0x291ba9(_0x866040['error'](0x1f4,_[_0xfbed('0x5f')](_0xbf6025,_0xfbed('0x1d'))[_0xfbed('0x1e')](',\x20')));}var _0x1b55f1=_[_0xfbed('0x60')](_0x531047[_0xfbed('0x5d')],{'uniqueid':_0x51a737[_0xfbed('0x61')]});if(_0x1b55f1&&_0x1b55f1[_0xfbed('0x62')]){var _0x5aaa29=util[_0xfbed('0x9')](_0xfbed('0x63'),_0x51a737['filename']||_0x51a737['uniqueid'],_0x51a737[_0xfbed('0x9')]||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x1b55f1[_0xfbed('0x62')],'file':_0x5aaa29,'options':_0xfbed('0x64')})['then'](function(_0x38a612){var _0x1eeda4=_[_0xfbed('0x60')](_0x1b55f1[_0xfbed('0x65')],{'filename':_0xfbed('0x66')+_0x5aaa29['toLowerCase']()});if(_['isNil'](_0x1eeda4)){_0x1b55f1[_0xfbed('0x65')]['push']({'filename':_0xfbed('0x66')+_0x5aaa29['toLowerCase'](),'createdAt':moment()[_0xfbed('0x9')](_0xfbed('0x67')),'mixmonitorid':_0x38a612[_0xfbed('0x68')],'status':_0xfbed('0x69')});}else{_0x1eeda4[_0xfbed('0x68')]=_0x38a612[_0xfbed('0x68')];_0x1eeda4['status']='rec';}_0x73bf72({'code':0xc8,'message':[_0x51a737[_0xfbed('0x61')],_0xfbed('0x6a'),_0x38a612[_0xfbed('0x68')]][_0xfbed('0x1e')]('\x20'),'mixmonitorid':_0x38a612[_0xfbed('0x68')]});})['catch'](function(_0xab64f8){_0x291ba9(_0x866040[_0xfbed('0x1c')](0x1f5,[_0x51a737['uniqueid'],_0xab64f8[_0xfbed('0x1d')][_0xfbed('0x6b')]()][_0xfbed('0x1e')]('\x20')));});}else{return _0x291ba9(_0x866040[_0xfbed('0x1c')](0x1f5,_0xfbed('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x4976b0){var _0x414bf1=this;return new Promise(function(_0x28abb2,_0xe0b263){if(ami[_0xfbed('0x12')]()==![]){return _0xe0b263(_0x414bf1[_0xfbed('0x1c')](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')][_0xfbed('0x14')],'ami\x20disconnected'][_0xfbed('0x1e')]('\x20')));}var _0x284b01=schema(properties[_0xfbed('0x5e')])[_0xfbed('0x3')](_0x4976b0);if(_0x284b01['length']>0x0){return _0xe0b263(_0x414bf1[_0xfbed('0x1c')](0x1f4,_['map'](_0x284b01,'message')['join'](',\x20')));}var _0x5717c5=_[_0xfbed('0x60')](_0x531047[_0xfbed('0x5d')],{'uniqueid':_0x4976b0[_0xfbed('0x61')]});if(_0x5717c5){return BPromise[_0xfbed('0x6d')]()[_0xfbed('0x22')](function(){if(_0x5717c5[_0xfbed('0x62')]){return ami['Action']({'action':_0xfbed('0x6e'),'channel':_0x5717c5['channel'],'mixmonitorid':_0x4976b0[_0xfbed('0x68')]})[_0xfbed('0x1b')](function(_0xd37004){});}})[_0xfbed('0x22')](function(){if(_0x5717c5[_0xfbed('0x6f')]){return ami[_0xfbed('0x1a')]({'action':_0xfbed('0x6e'),'channel':_0x5717c5[_0xfbed('0x6f')],'mixmonitorid':_0x4976b0[_0xfbed('0x68')]})['catch'](function(_0xeb4ebd){});}})[_0xfbed('0x22')](function(_0x1d3c97){var _0x221cdb=_[_0xfbed('0x60')](_0x5717c5[_0xfbed('0x65')],{'mixmonitorid':_0x4976b0[_0xfbed('0x68')]});if(_0x221cdb){_0x221cdb['status']=_0xfbed('0x70');}})[_0xfbed('0x22')](function(){var _0x2a8dfc=util[_0xfbed('0x9')](_0xfbed('0x63'),_0x4976b0['filename']||_0x4976b0[_0xfbed('0x61')],_0x4976b0['format']||_0xfbed('0x71'));var _0x140683=_[_0xfbed('0x60')](_0x5717c5[_0xfbed('0x65')],{'filename':_0xfbed('0x66')+_0x2a8dfc['toLowerCase']()});if(_0x140683){_0x140683[_0xfbed('0x72')]=_0xfbed('0x70');}})[_0xfbed('0x22')](function(){_0x28abb2({'code':0xc8,'message':[_0x4976b0[_0xfbed('0x61')],'StopMixMonitor\x20Success'][_0xfbed('0x1e')]('\x20')});})[_0xfbed('0x1b')](function(_0x2000fc){_0xe0b263(_0x414bf1[_0xfbed('0x1c')](0x1f5,[_0x4976b0[_0xfbed('0x61')],_0x2000fc['message']['toLowerCase']()][_0xfbed('0x1e')]('\x20')));});}else{return _0xe0b263(_0x414bf1[_0xfbed('0x1c')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x27992e){return new Promise(function(_0x467173,_0x56801b){var _0x18c7d7=_[_0xfbed('0x73')](_0x531047['queueChannels']);_0x467173({'count':_0x18c7d7['length'],'rows':_0x18c7d7});});},'VoiceQueuesChannel':function(_0x464e1f){var _0x2bb80f=this;return new Promise(function(_0x3e3968,_0x57adaf){var _0x517797=schema(properties[_0xfbed('0x74')])[_0xfbed('0x3')](_0x464e1f);if(_0x517797[_0xfbed('0x5c')]>0x0){return _0x57adaf(_0x2bb80f[_0xfbed('0x1c')](0x1f4,_[_0xfbed('0x5f')](_0x517797,_0xfbed('0x1d'))[_0xfbed('0x1e')](',\x20')));}var _0x58b172=_[_0xfbed('0x60')](_0x531047[_0xfbed('0x75')],{'uniqueid':_0x464e1f['uniqueid']});if(_0x58b172){_0x3e3968(_0x58b172);}else{return _0x57adaf(_0x2bb80f['error'](0x1f5,_0xfbed('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x2844ac){var _0x507bab=this;return new Promise(function(_0x50037e,_0x296e91){if(ami[_0xfbed('0x12')]()==![]){return _0x296e91(_0x507bab['error'](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')]['username'],_0xfbed('0x15')][_0xfbed('0x1e')]('\x20')));}var _0x1c0c2e=schema(properties['voicequeuechannelhangup'])[_0xfbed('0x3')](_0x2844ac);if(_0x1c0c2e[_0xfbed('0x5c')]>0x0){return _0x296e91(_0x507bab[_0xfbed('0x1c')](0x1f4,_[_0xfbed('0x5f')](_0x1c0c2e,_0xfbed('0x1d'))[_0xfbed('0x1e')](',\x20')));}var _0xb9de82=_['find'](_0x531047['queueChannels'],{'uniqueid':_0x2844ac[_0xfbed('0x61')]});if(_0xb9de82&&_0xb9de82[_0xfbed('0x62')]){return ami[_0xfbed('0x1a')]({'action':_0xfbed('0x76'),'channel':_0xb9de82[_0xfbed('0x62')]})[_0xfbed('0x22')](function(_0x726684){_0x50037e({'code':0xc8,'message':[_0x2844ac['uniqueid'],_0x726684[_0xfbed('0x1d')][_0xfbed('0x6b')]()][_0xfbed('0x1e')]('\x20')});})[_0xfbed('0x1b')](function(_0x4ae882){_0x296e91(_0x507bab['error'](0x1f5,[_0x2844ac[_0xfbed('0x61')],_0x4ae882[_0xfbed('0x1d')]['toLowerCase']()][_0xfbed('0x1e')]('\x20')));});}else{return _0x296e91(_0x507bab[_0xfbed('0x1c')](0x1f5,_0xfbed('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0xc5705){var _0x2a16e9=this;return new Promise(function(_0x2a5d84,_0x3e1c16){if(ami[_0xfbed('0x12')]()==![]){return _0x3e1c16(_0x2a16e9[_0xfbed('0x1c')](0x1f4,[config[_0xfbed('0x13')]['ip'],config[_0xfbed('0x13')][_0xfbed('0x14')],_0xfbed('0x15')]['join']('\x20')));}var _0xe431c2=schema(properties['voicequeuechannelredirect'])[_0xfbed('0x3')](_0xc5705);if(_0xe431c2[_0xfbed('0x5c')]>0x0){return _0x3e1c16(_0x2a16e9['error'](0x1f4,_[_0xfbed('0x5f')](_0xe431c2,_0xfbed('0x1d'))[_0xfbed('0x1e')](',\x20')));}var _0x403d3b=_[_0xfbed('0x60')](_0x531047[_0xfbed('0x75')],{'uniqueid':_0xc5705[_0xfbed('0x61')]});if(_0x403d3b&&_0x403d3b[_0xfbed('0x62')]){return ami[_0xfbed('0x1a')]({'action':'Redirect','channel':_0x403d3b[_0xfbed('0x62')],'exten':_0xc5705[_0xfbed('0x77')],'context':_0xc5705[_0xfbed('0x78')]||_0x403d3b['context'],'priority':0x1})['then'](function(_0x5b2ade){_0x2a5d84({'code':0xc8,'message':[_0xc5705['uniqueid'],_0x5b2ade[_0xfbed('0x1d')][_0xfbed('0x6b')]()][_0xfbed('0x1e')]('\x20')});})['catch'](function(_0x413c2b){_0x3e1c16(_0x2a16e9[_0xfbed('0x1c')](0x1f5,[_0xc5705['uniqueid'],_0x413c2b[_0xfbed('0x1d')][_0xfbed('0x6b')]()][_0xfbed('0x1e')]('\x20')));});}else{return _0x3e1c16(_0x2a16e9[_0xfbed('0x1c')](0x1f5,_0xfbed('0x6c')));}});},'Agents':function(_0x21c383){return new Promise(function(_0x50cc62,_0x322520){var _0x425677=_[_0xfbed('0x73')](_0x531047['agents']);_0x50cc62({'count':_0x425677[_0xfbed('0x5c')],'rows':_0x425677});});},'Telephones':function(_0x3508c7){return new Promise(function(_0xd1c996,_0x50e5a5){var _0x195aa7=_[_0xfbed('0x73')](_0x531047[_0xfbed('0x79')]);_0xd1c996({'count':_0x195aa7['length'],'rows':_0x195aa7});});},'Trunks':function(_0x3bf4b7){return new Promise(function(_0x4016c2,_0x4e8c08){var _0x593cae=_[_0xfbed('0x73')](_0x531047['trunks']);_0x4016c2({'count':_0x593cae[_0xfbed('0x5c')],'rows':_0x593cae});});},'OutboundChannels':function(_0x557dc9){return new Promise(function(_0x4d1393,_0x262b32){var _0x39518e=_['values'](_0x531047[_0xfbed('0x7a')]);_0x4d1393({'count':_0x39518e[_0xfbed('0x5c')],'rows':_0x39518e});});},'Outbound':function(_0x121e6b){return new Promise(function(_0x2649f3,_0x13dcfa){_0x2649f3(_0x531047[_0xfbed('0x7b')]);});},'Campaigns':function(_0x37785d){return new Promise(function(_0x3a8f5a,_0x4e5460){var _0x32297e=_['values'](_0x531047['campaigns']);_0x3a8f5a({'count':_0x32297e[_0xfbed('0x5c')],'rows':_0x32297e});});},'VoiceQueuesPreview':function(_0x972ab5){var _0x5936dc=this;return new Promise(function(_0x5b92a2,_0x4366b3){_0x47f7fc[_0xfbed('0x7c')](_0x972ab5['id'])[_0xfbed('0x22')](function(_0x5ea745){_0x5b92a2({'code':0xc8,'message':_0x5ea745[_0xfbed('0x1d')]});})[_0xfbed('0x1b')](function(_0x3a7d92){_0x4366b3(_0x5936dc[_0xfbed('0x1c')](0x1f4,_0x3a7d92[_0xfbed('0x1d')]));});});},'EventManager':function(_0x360dfe){var _0x1c0d22=this;return new Promise(function(_0x492645,_0x2b27f2){if(!_0x360dfe[_0xfbed('0x7d')]){return _0x2b27f2(_0x1c0d22['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xfbed('0x7e')](_0xfbed('0x7f')+_0x360dfe[_0xfbed('0x7d')],_0x360dfe[_0xfbed('0x1d')]);_0x492645({'code':0xc8,'message':_0x360dfe});});},'FaxAccounts':function(_0x1543d0){return new Promise(function(_0x351272,_0x2bef07){var _0x1bd80b=_[_0xfbed('0x73')](_0x531047[_0xfbed('0x80')]);_0x351272({'count':_0x1bd80b['length'],'rows':_0x1bd80b});});},'SendFax':function(_0x57f026){var _0x3cf1f1=this;return new Promise(function(_0x58a1ee,_0x3b0a65){_0x4c8f00['send'](_0x57f026)[_0xfbed('0x22')](function(_0x361061){_0x58a1ee({'code':0xc8,'message':_0x361061[_0xfbed('0x1d')]});})[_0xfbed('0x1b')](function(_0xe9e357){_0x3b0a65(_0x3cf1f1['error'](0x1f4,_0xe9e357[_0xfbed('0x1d')]));});});},'CheckAfterSend':function(_0x132675){var _0x3713cf=this;return new Promise(function(_0x2ec38f,_0x28d93b){_0x4c8f00[_0xfbed('0x81')](_0x132675)[_0xfbed('0x22')](function(_0x5a3269){_0x2ec38f({'code':0xc8,'message':_0x5a3269[_0xfbed('0x1d')]});})[_0xfbed('0x1b')](function(_0x2ed40c){_0x28d93b(_0x3713cf['error'](0x1f4,_0x2ed40c['message']));});});}};var _0x2c4970=jayson['server'](_0xaef696)[_0xfbed('0x82')]();_0x2c4970['on'](_0xfbed('0x1c'),function(_0x53824c){return _0x5b2b27(_0x53824c);});_0x2c4970['listen'](0x232a,_0xfbed('0x83'),function(){console[_0xfbed('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x50aafc(_0xfbed('0x85')+0x232a);});});}; \ No newline at end of file +var _0x16f9=['voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','voicechannel','find','channel','format','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','uniqueid','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','status','%s.%s','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Redirect','exten','context','values','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','name','timers','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','message','catch','command','action','Action','then','content'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16f9,0xe9));var _0x916f=function(_0x1e50c8,_0x1b9e30){_0x1e50c8=_0x1e50c8-0x0;var _0xcae15d=_0x16f9[_0x1e50c8];return _0xcae15d;};'use strict';var _=require(_0x916f('0x0'));var util=require('util');var jayson=require(_0x916f('0x1'));var schema=require(_0x916f('0x2'));var BPromise=require(_0x916f('0x3'));var moment=require('moment');var config=require(_0x916f('0x4'));var properties=require(_0x916f('0x5'));var ami=require(_0x916f('0x6'));exports[_0x916f('0x7')]=function(_0x173bea,_0x276107,_0x2ad4bc){return new BPromise(function(_0x15e2b1,_0x36a96d){var _0x17b8a0={'QueuePause':function(_0x3b49e5){return new Promise(function(_0x4e1c0e,_0x1e5fd0){var _0x3f3559=util['format']('%s/%s','SIP',_0x3b49e5[_0x916f('0x8')]);if(_0x173bea[_0x916f('0x9')]&&_0x173bea[_0x916f('0x9')][_0x3f3559]&&_0x173bea[_0x916f('0x9')][_0x3f3559]['timer']){_0x173bea[_0x916f('0x9')][_0x3f3559][_0x916f('0xa')]();}if(_0x173bea[_0x916f('0xb')][_0x3f3559]){_0x173bea['agents'][_0x3f3559][_0x916f('0xc')]({'statePause':_0x3b49e5[_0x916f('0xd')]?!![]:![]});}_0x4e1c0e({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x16054e){var _0x12855d=this;return new Promise(function(_0x3ce842,_0x1bc632){if(ami[_0x916f('0xe')]()==![]){return _0x1bc632(_0x12855d[_0x916f('0xf')](0x1f4,[config[_0x916f('0x10')]['ip'],config['asterisk'][_0x916f('0x11')],_0x916f('0x12')][_0x916f('0x13')]('\x20')));}_0x16054e=_[_0x916f('0x14')](_0x16054e,_[_0x916f('0x15')](properties['module']));_0x16054e['action']='Reload';return ami['Action'](_0x16054e)['then'](function(_0x3e4f50){_0x3ce842({'code':0xc8,'message':_0x3e4f50[_0x916f('0x16')]});})[_0x916f('0x17')](function(_0x44b75e){_0x1bc632(_0x12855d[_0x916f('0xf')](0x1f5,_0x44b75e[_0x916f('0x16')]));});});},'Command':function(_0x3e24aa){var _0x4bd0c0=this;return new Promise(function(_0x563abd,_0x338aaa){if(ami['isConnected']()==![]){return _0x338aaa(_0x4bd0c0['error'](0x1f4,[config['asterisk']['ip'],config[_0x916f('0x10')][_0x916f('0x11')],_0x916f('0x12')][_0x916f('0x13')]('\x20')));}_0x3e24aa=_[_0x916f('0x14')](_0x3e24aa,_0x916f('0x18'));_0x3e24aa[_0x916f('0x19')]='Command';return ami[_0x916f('0x1a')](_0x3e24aa)[_0x916f('0x1b')](function(_0x3068d0){_0x563abd({'code':0xc8,'message':_0x3068d0[_0x916f('0x1c')]});})[_0x916f('0x17')](function(_0x167aa2){_0x338aaa(_0x4bd0c0['error'](0x1f5,_0x167aa2[_0x916f('0x16')]));});});},'VoiceQueues':function(_0xb1713c){return new Promise(function(_0x3940eb,_0x1b8aab){var _0x50d5b3=[];for(var _0x29df9e in _0x173bea[_0x916f('0x1d')]){if(_0x173bea['voiceQueues']['hasOwnProperty'](_0x29df9e)){var _0xd4caf7=_0x173bea['voiceQueues'][_0x29df9e];var _0x25b75c={'id':_0xd4caf7['id'],'name':_0xd4caf7[_0x916f('0x8')],'strategy':_0xd4caf7[_0x916f('0x1e')],'answered':_0xd4caf7[_0x916f('0x1f')],'available':_0xd4caf7[_0x916f('0x20')],'loggedIn':_0xd4caf7[_0x916f('0x21')],'pTalking':_0xd4caf7[_0x916f('0x22')],'sumBillable':_0xd4caf7[_0x916f('0x23')],'sumDuration':_0xd4caf7[_0x916f('0x24')],'sumHoldTime':_0xd4caf7[_0x916f('0x25')]||0x0,'talking':_0xd4caf7[_0x916f('0x26')],'total':_0xd4caf7[_0x916f('0x27')],'type':_0xd4caf7[_0x916f('0x28')],'unmanaged':_0xd4caf7[_0x916f('0x29')],'abandoned':_0xd4caf7['abandoned'],'waiting':_0xd4caf7['waiting'],'loggedInDb':_0xd4caf7['loggedInDb']};if(_0xd4caf7[_0x916f('0x28')]===_0x916f('0x2a')){_0x25b75c[_0x916f('0x2b')]=_0xd4caf7['dialActive'];_0x25b75c[_0x916f('0x2c')]=_0xd4caf7[_0x916f('0x2c')];_0x25b75c[_0x916f('0x2d')]=_0xd4caf7[_0x916f('0x2d')];_0x25b75c[_0x916f('0x2e')]=_0xd4caf7[_0x916f('0x2e')];_0x25b75c['dialOriginateTimeout']=_0xd4caf7[_0x916f('0x2f')];_0x25b75c[_0x916f('0x30')]=_0xd4caf7['dialPrefix'];_0x25b75c[_0x916f('0x31')]=_0xd4caf7['outboundAnswerAgiCallsDay'];_0x25b75c['outboundAnswerCallsDay']=_0xd4caf7[_0x916f('0x32')];_0x25b75c[_0x916f('0x33')]=_0xd4caf7[_0x916f('0x33')];_0x25b75c['outboundBusyCallsDay']=_0xd4caf7[_0x916f('0x34')];_0x25b75c[_0x916f('0x35')]=_0xd4caf7[_0x916f('0x35')];_0x25b75c[_0x916f('0x36')]=_0xd4caf7['outboundDropCallsDayACS'];_0x25b75c['outboundDropCallsDayCallersExit']=_0xd4caf7[_0x916f('0x37')];_0x25b75c[_0x916f('0x38')]=_0xd4caf7['outboundDropCallsDayTimeout'];_0x25b75c[_0x916f('0x39')]=_0xd4caf7[_0x916f('0x39')];_0x25b75c['outboundNoSuchCallsDay']=_0xd4caf7[_0x916f('0x3a')];_0x25b75c[_0x916f('0x3b')]=_0xd4caf7[_0x916f('0x3b')];_0x25b75c[_0x916f('0x3c')]=_0xd4caf7[_0x916f('0x3c')];_0x25b75c[_0x916f('0x3d')]=_0xd4caf7[_0x916f('0x3d')];_0x25b75c[_0x916f('0x3e')]=_0xd4caf7[_0x916f('0x3e')];_0x25b75c['predictiveIntervalAnsweredCalls']=_0xd4caf7['predictiveIntervalAnsweredCalls'];_0x25b75c[_0x916f('0x3f')]=_0xd4caf7[_0x916f('0x3f')];_0x25b75c['predictiveIntervalAvgTalktime']=_0xd4caf7[_0x916f('0x40')];_0x25b75c[_0x916f('0x41')]=_0xd4caf7[_0x916f('0x41')];_0x25b75c[_0x916f('0x42')]=_0xd4caf7[_0x916f('0x42')];_0x25b75c[_0x916f('0x43')]=_0xd4caf7[_0x916f('0x43')];_0x25b75c['predictiveIntervalErlangCallsDroppedCalls']=_0xd4caf7[_0x916f('0x44')];_0x25b75c['predictiveIntervalHitRate']=_0xd4caf7[_0x916f('0x45')];_0x25b75c[_0x916f('0x46')]=_0xd4caf7[_0x916f('0x46')];_0x25b75c[_0x916f('0x47')]=_0xd4caf7[_0x916f('0x47')];_0x25b75c[_0x916f('0x48')]=_0xd4caf7['predictiveIntervalAvailable'];_0x25b75c[_0x916f('0x49')]=_0xd4caf7[_0x916f('0x49')];_0x25b75c['message']=_0xd4caf7['message'];_0x25b75c[_0x916f('0x4a')]=_0xd4caf7[_0x916f('0x4a')];_0x25b75c[_0x916f('0x4b')]=_0xd4caf7[_0x916f('0x4b')];_0x25b75c[_0x916f('0x4c')]=_0xd4caf7[_0x916f('0x4c')];_0x25b75c[_0x916f('0x4d')]=_0xd4caf7[_0x916f('0x4d')];_0x25b75c[_0x916f('0x4e')]=_0xd4caf7['erlangBusyFactor'];_0x25b75c[_0x916f('0x4f')]=_0xd4caf7[_0x916f('0x4f')];_0x25b75c[_0x916f('0x50')]=_0xd4caf7[_0x916f('0x50')];}if(_0xd4caf7[_0x916f('0x51')]){_0x25b75c[_0x916f('0x51')]={'id':_0xd4caf7[_0x916f('0x51')]['id'],'name':_0xd4caf7[_0x916f('0x51')]['name'],'active':_0xd4caf7[_0x916f('0x51')][_0x916f('0x52')],'callerid':_0xd4caf7[_0x916f('0x51')]['callerid']};}if(_0xd4caf7['Interval']){_0x25b75c[_0x916f('0x53')]={'id':_0xd4caf7['Interval']['id'],'name':_0xd4caf7[_0x916f('0x53')][_0x916f('0x8')]};}_0x50d5b3[_0x916f('0x54')](_0x25b75c);}}_0x3940eb({'count':_0x50d5b3[_0x916f('0x55')],'rows':_0x50d5b3});});},'VoiceChannels':function(_0x57714e){return new Promise(function(_0x188f84,_0x14d562){var _0x13b6d4=_['values'](_0x173bea['channels']);_0x188f84({'count':_0x13b6d4[_0x916f('0x55')],'rows':_0x13b6d4});});},'VoiceChannelMixMonitor':function(_0x5ea001){var _0x52690a=this;return new Promise(function(_0x233984,_0x55c34b){if(ami[_0x916f('0xe')]()==![]){return _0x55c34b(_0x52690a['error'](0x1f4,[config[_0x916f('0x10')]['ip'],config[_0x916f('0x10')][_0x916f('0x11')],_0x916f('0x12')][_0x916f('0x13')]('\x20')));}var _0x286976=schema(properties[_0x916f('0x56')])[_0x916f('0x2')](_0x5ea001);if(_0x286976['length']>0x0){return _0x55c34b(_0x52690a[_0x916f('0xf')](0x1f4,_['map'](_0x286976,_0x916f('0x16'))['join'](',\x20')));}var _0x5f1fff=_[_0x916f('0x57')](_0x173bea['channels'],{'uniqueid':_0x5ea001['uniqueid']});if(_0x5f1fff&&_0x5f1fff[_0x916f('0x58')]){var _0x1ce041=util[_0x916f('0x59')]('%s.%s',_0x5ea001[_0x916f('0x5a')]||_0x5ea001['uniqueid'],_0x5ea001['format']||_0x916f('0x5b'));return ami[_0x916f('0x1a')]({'action':_0x916f('0x5c'),'channel':_0x5f1fff['channel'],'file':_0x1ce041,'options':_0x916f('0x5d')})[_0x916f('0x1b')](function(_0x434d40){var _0x5edae2=_[_0x916f('0x57')](_0x5f1fff[_0x916f('0x5e')],{'filename':_0x916f('0x5f')+_0x1ce041[_0x916f('0x60')]()});if(_['isNil'](_0x5edae2)){_0x5f1fff['monitors'][_0x916f('0x54')]({'filename':_0x916f('0x5f')+_0x1ce041[_0x916f('0x60')](),'createdAt':moment()['format'](_0x916f('0x61')),'mixmonitorid':_0x434d40[_0x916f('0x62')],'status':_0x916f('0x63')});}else{_0x5edae2['mixmonitorid']=_0x434d40[_0x916f('0x62')];_0x5edae2['status']=_0x916f('0x63');}_0x233984({'code':0xc8,'message':[_0x5ea001[_0x916f('0x64')],'MixMonitor\x20Success',_0x434d40[_0x916f('0x62')]]['join']('\x20'),'mixmonitorid':_0x434d40[_0x916f('0x62')]});})['catch'](function(_0x12f5c3){_0x55c34b(_0x52690a[_0x916f('0xf')](0x1f5,[_0x5ea001[_0x916f('0x64')],_0x12f5c3['message'][_0x916f('0x60')]()][_0x916f('0x13')]('\x20')));});}else{return _0x55c34b(_0x52690a['error'](0x1f5,_0x916f('0x65')));}});},'VoiceChannelStopMixMonitor':function(_0x31eaa0){var _0x47cf76=this;return new Promise(function(_0x131fc4,_0x121f02){if(ami['isConnected']()==![]){return _0x121f02(_0x47cf76[_0x916f('0xf')](0x1f4,[config[_0x916f('0x10')]['ip'],config[_0x916f('0x10')][_0x916f('0x11')],_0x916f('0x12')][_0x916f('0x13')]('\x20')));}var _0x42689f=schema(properties['voicechannel'])['validate'](_0x31eaa0);if(_0x42689f[_0x916f('0x55')]>0x0){return _0x121f02(_0x47cf76['error'](0x1f4,_[_0x916f('0x66')](_0x42689f,_0x916f('0x16'))[_0x916f('0x13')](',\x20')));}var _0x391bc6=_[_0x916f('0x57')](_0x173bea['channels'],{'uniqueid':_0x31eaa0['uniqueid']});if(_0x391bc6){return BPromise[_0x916f('0x67')]()['then'](function(){if(_0x391bc6['channel']){return ami[_0x916f('0x1a')]({'action':'StopMixMonitor','channel':_0x391bc6[_0x916f('0x58')],'mixmonitorid':_0x31eaa0[_0x916f('0x62')]})['catch'](function(_0xf706c7){});}})[_0x916f('0x1b')](function(){if(_0x391bc6[_0x916f('0x68')]){return ami[_0x916f('0x1a')]({'action':'StopMixMonitor','channel':_0x391bc6[_0x916f('0x68')],'mixmonitorid':_0x31eaa0[_0x916f('0x62')]})[_0x916f('0x17')](function(_0x141510){});}})[_0x916f('0x1b')](function(_0x14fe3e){var _0x43de67=_[_0x916f('0x57')](_0x391bc6['monitors'],{'mixmonitorid':_0x31eaa0[_0x916f('0x62')]});if(_0x43de67){_0x43de67[_0x916f('0x69')]='stop';}})[_0x916f('0x1b')](function(){var _0x3f571e=util[_0x916f('0x59')](_0x916f('0x6a'),_0x31eaa0[_0x916f('0x5a')]||_0x31eaa0[_0x916f('0x64')],_0x31eaa0[_0x916f('0x59')]||_0x916f('0x5b'));var _0x565aaa=_['find'](_0x391bc6[_0x916f('0x5e')],{'filename':_0x916f('0x5f')+_0x3f571e['toLowerCase']()});if(_0x565aaa){_0x565aaa[_0x916f('0x69')]=_0x916f('0x6b');}})['then'](function(){_0x131fc4({'code':0xc8,'message':[_0x31eaa0[_0x916f('0x64')],_0x916f('0x6c')][_0x916f('0x13')]('\x20')});})['catch'](function(_0x8b7395){_0x121f02(_0x47cf76[_0x916f('0xf')](0x1f5,[_0x31eaa0['uniqueid'],_0x8b7395[_0x916f('0x16')][_0x916f('0x60')]()][_0x916f('0x13')]('\x20')));});}else{return _0x121f02(_0x47cf76[_0x916f('0xf')](0x1f5,_0x916f('0x65')));}});},'VoiceQueuesChannels':function(_0x121001){return new Promise(function(_0x2f9e1c,_0x27bd17){var _0x3558bc=_['values'](_0x173bea[_0x916f('0x6d')]);_0x2f9e1c({'count':_0x3558bc[_0x916f('0x55')],'rows':_0x3558bc});});},'VoiceQueuesChannel':function(_0x9b5b9e){var _0x3377b0=this;return new Promise(function(_0x14e4ea,_0x155eb1){var _0x3519b6=schema(properties[_0x916f('0x6e')])[_0x916f('0x2')](_0x9b5b9e);if(_0x3519b6[_0x916f('0x55')]>0x0){return _0x155eb1(_0x3377b0['error'](0x1f4,_[_0x916f('0x66')](_0x3519b6,'message')['join'](',\x20')));}var _0x3513d3=_['find'](_0x173bea[_0x916f('0x6d')],{'uniqueid':_0x9b5b9e[_0x916f('0x64')]});if(_0x3513d3){_0x14e4ea(_0x3513d3);}else{return _0x155eb1(_0x3377b0['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x1e5252){var _0x1b4f7c=this;return new Promise(function(_0x500b5c,_0x4f4bbd){if(ami['isConnected']()==![]){return _0x4f4bbd(_0x1b4f7c[_0x916f('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x916f('0x10')]['username'],_0x916f('0x12')][_0x916f('0x13')]('\x20')));}var _0xe710fb=schema(properties['voicequeuechannelhangup'])[_0x916f('0x2')](_0x1e5252);if(_0xe710fb[_0x916f('0x55')]>0x0){return _0x4f4bbd(_0x1b4f7c[_0x916f('0xf')](0x1f4,_['map'](_0xe710fb,'message')['join'](',\x20')));}var _0x56c7aa=_[_0x916f('0x57')](_0x173bea[_0x916f('0x6d')],{'uniqueid':_0x1e5252[_0x916f('0x64')]});if(_0x56c7aa&&_0x56c7aa[_0x916f('0x58')]){return ami[_0x916f('0x1a')]({'action':'Hangup','channel':_0x56c7aa[_0x916f('0x58')]})[_0x916f('0x1b')](function(_0x39425c){_0x500b5c({'code':0xc8,'message':[_0x1e5252[_0x916f('0x64')],_0x39425c[_0x916f('0x16')][_0x916f('0x60')]()][_0x916f('0x13')]('\x20')});})[_0x916f('0x17')](function(_0x13ba02){_0x4f4bbd(_0x1b4f7c['error'](0x1f5,[_0x1e5252[_0x916f('0x64')],_0x13ba02[_0x916f('0x16')][_0x916f('0x60')]()][_0x916f('0x13')]('\x20')));});}else{return _0x4f4bbd(_0x1b4f7c[_0x916f('0xf')](0x1f5,_0x916f('0x65')));}});},'VoiceQueuesChannelRedirect':function(_0x49f1ec){var _0x232c2d=this;return new Promise(function(_0x23cf3e,_0x5149bc){if(ami[_0x916f('0xe')]()==![]){return _0x5149bc(_0x232c2d[_0x916f('0xf')](0x1f4,[config[_0x916f('0x10')]['ip'],config[_0x916f('0x10')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x50c84c=schema(properties['voicequeuechannelredirect'])[_0x916f('0x2')](_0x49f1ec);if(_0x50c84c[_0x916f('0x55')]>0x0){return _0x5149bc(_0x232c2d[_0x916f('0xf')](0x1f4,_['map'](_0x50c84c,_0x916f('0x16'))[_0x916f('0x13')](',\x20')));}var _0x34362d=_[_0x916f('0x57')](_0x173bea[_0x916f('0x6d')],{'uniqueid':_0x49f1ec[_0x916f('0x64')]});if(_0x34362d&&_0x34362d[_0x916f('0x58')]){return ami[_0x916f('0x1a')]({'action':_0x916f('0x6f'),'channel':_0x34362d['channel'],'exten':_0x49f1ec[_0x916f('0x70')],'context':_0x49f1ec[_0x916f('0x71')]||_0x34362d['context'],'priority':0x1})[_0x916f('0x1b')](function(_0x554fa7){_0x23cf3e({'code':0xc8,'message':[_0x49f1ec['uniqueid'],_0x554fa7[_0x916f('0x16')][_0x916f('0x60')]()][_0x916f('0x13')]('\x20')});})[_0x916f('0x17')](function(_0x1a44ea){_0x5149bc(_0x232c2d[_0x916f('0xf')](0x1f5,[_0x49f1ec['uniqueid'],_0x1a44ea[_0x916f('0x16')][_0x916f('0x60')]()][_0x916f('0x13')]('\x20')));});}else{return _0x5149bc(_0x232c2d[_0x916f('0xf')](0x1f5,_0x916f('0x65')));}});},'Agents':function(_0x24a2d5){return new Promise(function(_0x58a29c,_0x2fad6e){var _0xf73ebd=_[_0x916f('0x72')](_0x173bea[_0x916f('0xb')]);_0x58a29c({'count':_0xf73ebd[_0x916f('0x55')],'rows':_0xf73ebd});});},'Telephones':function(_0x365769){return new Promise(function(_0x4df76b,_0x50ee3d){var _0x8ca8b8=_[_0x916f('0x72')](_0x173bea[_0x916f('0x73')]);_0x4df76b({'count':_0x8ca8b8['length'],'rows':_0x8ca8b8});});},'Trunks':function(_0x342ae9){return new Promise(function(_0xe9f7da,_0x59bb5b){var _0x2130dc=_[_0x916f('0x72')](_0x173bea[_0x916f('0x74')]);_0xe9f7da({'count':_0x2130dc[_0x916f('0x55')],'rows':_0x2130dc});});},'OutboundChannels':function(_0x432381){return new Promise(function(_0x469d6a,_0xa6d2c){var _0x5bcbc4=_['values'](_0x173bea[_0x916f('0x75')]);_0x469d6a({'count':_0x5bcbc4[_0x916f('0x55')],'rows':_0x5bcbc4});});},'Outbound':function(_0x45c799){return new Promise(function(_0x27eaf4,_0x762cdb){_0x27eaf4(_0x173bea[_0x916f('0x2a')]);});},'Campaigns':function(_0x4d9a29){return new Promise(function(_0x353eee,_0x55b6a0){var _0x20dfb0=_['values'](_0x173bea[_0x916f('0x76')]);_0x353eee({'count':_0x20dfb0[_0x916f('0x55')],'rows':_0x20dfb0});});},'VoiceQueuesPreview':function(_0x184498){var _0x47f303=this;return new Promise(function(_0x5080ee,_0x4aa903){_0x276107[_0x916f('0x77')](_0x184498['id'])[_0x916f('0x1b')](function(_0xe23961){_0x5080ee({'code':0xc8,'message':_0xe23961['message']});})[_0x916f('0x17')](function(_0x24bded){_0x4aa903(_0x47f303[_0x916f('0xf')](0x1f4,_0x24bded['message']));});});},'EventManager':function(_0x57f9c2){var _0x479524=this;return new Promise(function(_0x57bb72,_0x12b718){if(!_0x57f9c2[_0x916f('0x78')]){return _0x12b718(_0x479524[_0x916f('0xf')](0x1f4,_0x916f('0x79')));}ami[_0x916f('0x7a')](_0x916f('0x7b')+_0x57f9c2[_0x916f('0x78')],_0x57f9c2[_0x916f('0x16')]);_0x57bb72({'code':0xc8,'message':_0x57f9c2});});},'FaxAccounts':function(_0x587734){return new Promise(function(_0x3c605e,_0x57df75){var _0x5670a7=_['values'](_0x173bea[_0x916f('0x7c')]);_0x3c605e({'count':_0x5670a7[_0x916f('0x55')],'rows':_0x5670a7});});},'SendFax':function(_0x1f8ba4){var _0x422442=this;return new Promise(function(_0x23b6b9,_0x1abc22){_0x2ad4bc['send'](_0x1f8ba4)[_0x916f('0x1b')](function(_0x39f204){_0x23b6b9({'code':0xc8,'message':_0x39f204[_0x916f('0x16')]});})[_0x916f('0x17')](function(_0x4c4f24){_0x1abc22(_0x422442[_0x916f('0xf')](0x1f4,_0x4c4f24[_0x916f('0x16')]));});});},'CheckAfterSend':function(_0x5d490b){var _0x2707fc=this;return new Promise(function(_0x1bbdea,_0x59f150){_0x2ad4bc[_0x916f('0x7d')](_0x5d490b)[_0x916f('0x1b')](function(_0x2e37df){_0x1bbdea({'code':0xc8,'message':_0x2e37df[_0x916f('0x16')]});})[_0x916f('0x17')](function(_0x11ce35){_0x59f150(_0x2707fc['error'](0x1f4,_0x11ce35[_0x916f('0x16')]));});});}};var _0x439f55=jayson[_0x916f('0x7e')](_0x17b8a0)[_0x916f('0x7f')]();_0x439f55['on']('error',function(_0x478154){return _0x36a96d(_0x478154);});_0x439f55[_0x916f('0x7')](0x232a,'127.0.0.1',function(){console[_0x916f('0x80')](_0x916f('0x81'),0x232a);return _0x15e2b1(_0x916f('0x82')+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 a9d1e19..28797fc 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 _0xde97=['name','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','user:%s','toLowerCase','lodash','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','calleridname','','uniqueid','firstName','destcalleridname','destcalleridnum','phone','then','omit','info','[%s][%s]\x20Contact\x20found:%s','format','trigger:%s','action','merge','[%s][%s]\x20Contact\x20not\x20found','resolve','createContact','[%s][%s]\x20Contact\x20created:%s'];(function(_0x377d4a,_0x154b58){var _0xae1935=function(_0xb31dd9){while(--_0xb31dd9){_0x377d4a['push'](_0x377d4a['shift']());}};_0xae1935(++_0x154b58);}(_0xde97,0x192));var _0x7de9=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0xde97[_0xf2f332];return _0x56cce3;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x7de9('0x0'));var Redis=require('ioredis');var config=require(_0x7de9('0x1'));var logger=require(_0x7de9('0x2'))(_0x7de9('0x3'));var cmContactRpc=require(_0x7de9('0x4'));config['redis']=_[_0x7de9('0x5')](config[_0x7de9('0x6')],{'host':_0x7de9('0x7'),'port':0x18eb});var io=require(_0x7de9('0x8'))(new Redis(config[_0x7de9('0x6')]));function emit(_0x1fed78,_0x1952fa,_0x489f10,_0x30933a){logger['info'](_0x7de9('0x9'),_0x1fed78,'',_0x1952fa,_0x489f10,JSON[_0x7de9('0xa')](_0x30933a));io['to'](_0x1952fa)[_0x7de9('0xb')](_0x489f10,_0x30933a);}exports[_0x7de9('0xc')]=function(_0x21179a,_0x1c4d6d,_0x575362){_0x575362[_0x7de9('0xd')]=0x0;if(_0x1c4d6d['data2']&&parseInt(_0x1c4d6d[_0x7de9('0xe')],0xa)){var _0x2e2a06={'ListId':parseInt(_0x1c4d6d[_0x7de9('0xf')],0xa),'phone':_0x575362[_0x7de9('0x10')]};if(_[_0x7de9('0x11')](_0x575362[_0x7de9('0x12')])){_0x2e2a06['firstName']=_0x575362['calleridname']&&_0x575362[_0x7de9('0x13')]!==_0x7de9('0x14')?_0x575362[_0x7de9('0x13')]:_0x575362[_0x7de9('0x10')]||_0x575362[_0x7de9('0x15')];}else{_0x2e2a06[_0x7de9('0x16')]=_0x575362[_0x7de9('0x17')]&&_0x575362['destcalleridname']!==_0x7de9('0x14')?_0x575362['destcalleridname']:_0x575362[_0x7de9('0x18')]||_0x575362[_0x7de9('0x15')];_0x2e2a06[_0x7de9('0x19')]=_0x575362['destcalleridname']&&_0x575362[_0x7de9('0x17')]!==''?_0x575362['destcalleridname']:_0x575362[_0x7de9('0x18')]||_0x575362['uniqueid'];}BPromise['resolve']()[_0x7de9('0x1a')](cmContactRpc['showContact']({'where':_[_0x7de9('0x1b')](_0x2e2a06,[_0x7de9('0x16')])}))[_0x7de9('0x1a')](function(_0x104028){if(_0x104028){logger[_0x7de9('0x1c')](_0x7de9('0x1d'),_0x575362['uniqueid'],'',_0x104028['id']);if(_0x21179a){_0x575362['xmd-contactid2']=_0x104028['id'];emit(_0x575362[_0x7de9('0x15')],util[_0x7de9('0x1e')]('user:%s',_0x21179a['name']),util['format'](_0x7de9('0x1f'),_0x1c4d6d[_0x7de9('0x20')]['toLowerCase']()),_[_0x7de9('0x21')](_0x575362,{'ListId':parseInt(_0x1c4d6d[_0x7de9('0xf')],0xa)}));}return;}else{logger[_0x7de9('0x1c')](_0x7de9('0x22'),_0x575362[_0x7de9('0x15')],'');return BPromise[_0x7de9('0x23')]()[_0x7de9('0x1a')](cmContactRpc[_0x7de9('0x24')](_0x2e2a06));}})[_0x7de9('0x1a')](function(_0x3e6195){if(_0x3e6195){logger[_0x7de9('0x1c')](_0x7de9('0x25'),_0x575362[_0x7de9('0x15')],'',_0x3e6195['id']);if(_0x21179a){_0x575362['xmd-contactid2']=_0x3e6195['id'];emit(_0x575362[_0x7de9('0x15')],util[_0x7de9('0x1e')]('user:%s',_0x21179a[_0x7de9('0x26')]),util['format'](_0x7de9('0x1f'),_0x1c4d6d['action']['toLowerCase']()),_[_0x7de9('0x21')](_0x575362,{'ListId':parseInt(_0x1c4d6d['data1'],0xa)}));}}})['catch'](function(_0x4adf89){logger[_0x7de9('0x27')](_0x7de9('0x28'),_0x575362[_0x7de9('0x15')],'',JSON['stringify'](_0x4adf89));});}else{if(_0x21179a){logger[_0x7de9('0x1c')](_0x7de9('0x29'),_0x575362[_0x7de9('0x15')],'');emit(_0x575362['uniqueid'],util[_0x7de9('0x1e')](_0x7de9('0x2a'),_0x21179a[_0x7de9('0x26')]),util[_0x7de9('0x1e')](_0x7de9('0x1f'),_0x1c4d6d[_0x7de9('0x20')][_0x7de9('0x2b')]()),_['merge']({'ListId':parseInt(_0x1c4d6d[_0x7de9('0xf')],0xa)},_0x575362));}}}; \ No newline at end of file +var _0x8a2a=['info','[%s][%s]\x20Contact\x20found:%s','format','user:%s','name','trigger:%s','action','merge','data1','[%s][%s]\x20Contact\x20not\x20found','then','[%s][%s]\x20Contact\x20created:%s','xmd-contactid2','toLowerCase','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','exec','autoCreate','data2','calleridnum','isNil','routeId','calleridname','','uniqueid','firstName','destcalleridname','phone','destcalleridnum','resolve','showContact','omit'];(function(_0x598475,_0x4405d2){var _0x304ec2=function(_0xc8cb7b){while(--_0xc8cb7b){_0x598475['push'](_0x598475['shift']());}};_0x304ec2(++_0x4405d2);}(_0x8a2a,0x11f));var _0xa8a2=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0x8a2a[_0xa79977];return _0x109f10;};'use strict';var BPromise=require('bluebird');var util=require(_0xa8a2('0x0'));var _=require(_0xa8a2('0x1'));var Redis=require(_0xa8a2('0x2'));var config=require(_0xa8a2('0x3'));var logger=require(_0xa8a2('0x4'))('trigger');var cmContactRpc=require(_0xa8a2('0x5'));config[_0xa8a2('0x6')]=_[_0xa8a2('0x7')](config[_0xa8a2('0x6')],{'host':_0xa8a2('0x8'),'port':0x18eb});var io=require(_0xa8a2('0x9'))(new Redis(config[_0xa8a2('0x6')]));function emit(_0x151fbd,_0x58e8c9,_0x1628f1,_0x58860e){logger['info']('[%s][%s]',_0x151fbd,'',_0x58e8c9,_0x1628f1,JSON[_0xa8a2('0xa')](_0x58860e));io['to'](_0x58e8c9)[_0xa8a2('0xb')](_0x1628f1,_0x58860e);}exports[_0xa8a2('0xc')]=function(_0x59a522,_0x45702c,_0x394813){_0x394813[_0xa8a2('0xd')]=0x0;if(_0x45702c[_0xa8a2('0xe')]&&parseInt(_0x45702c[_0xa8a2('0xe')],0xa)){var _0x28ab32={'ListId':parseInt(_0x45702c['data1'],0xa),'phone':_0x394813[_0xa8a2('0xf')]};if(_[_0xa8a2('0x10')](_0x394813[_0xa8a2('0x11')])){_0x28ab32['firstName']=_0x394813[_0xa8a2('0x12')]&&_0x394813[_0xa8a2('0x12')]!==_0xa8a2('0x13')?_0x394813[_0xa8a2('0x12')]:_0x394813[_0xa8a2('0xf')]||_0x394813[_0xa8a2('0x14')];}else{_0x28ab32[_0xa8a2('0x15')]=_0x394813['destcalleridname']&&_0x394813[_0xa8a2('0x16')]!==_0xa8a2('0x13')?_0x394813[_0xa8a2('0x16')]:_0x394813['destcalleridnum']||_0x394813['uniqueid'];_0x28ab32[_0xa8a2('0x17')]=_0x394813[_0xa8a2('0x16')]&&_0x394813[_0xa8a2('0x16')]!==_0xa8a2('0x13')?_0x394813[_0xa8a2('0x16')]:_0x394813[_0xa8a2('0x18')]||_0x394813[_0xa8a2('0x14')];}BPromise[_0xa8a2('0x19')]()['then'](cmContactRpc[_0xa8a2('0x1a')]({'where':_[_0xa8a2('0x1b')](_0x28ab32,[_0xa8a2('0x15')])}))['then'](function(_0x415284){if(_0x415284){logger[_0xa8a2('0x1c')](_0xa8a2('0x1d'),_0x394813[_0xa8a2('0x14')],'',_0x415284['id']);if(_0x59a522){_0x394813['xmd-contactid2']=_0x415284['id'];emit(_0x394813[_0xa8a2('0x14')],util[_0xa8a2('0x1e')](_0xa8a2('0x1f'),_0x59a522[_0xa8a2('0x20')]),util[_0xa8a2('0x1e')](_0xa8a2('0x21'),_0x45702c[_0xa8a2('0x22')]['toLowerCase']()),_[_0xa8a2('0x23')](_0x394813,{'ListId':parseInt(_0x45702c[_0xa8a2('0x24')],0xa)}));}return;}else{logger['info'](_0xa8a2('0x25'),_0x394813[_0xa8a2('0x14')],'');return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x28ab32));}})[_0xa8a2('0x26')](function(_0x41b1cd){if(_0x41b1cd){logger[_0xa8a2('0x1c')](_0xa8a2('0x27'),_0x394813[_0xa8a2('0x14')],'',_0x41b1cd['id']);if(_0x59a522){_0x394813[_0xa8a2('0x28')]=_0x41b1cd['id'];emit(_0x394813[_0xa8a2('0x14')],util[_0xa8a2('0x1e')]('user:%s',_0x59a522['name']),util['format'](_0xa8a2('0x21'),_0x45702c[_0xa8a2('0x22')][_0xa8a2('0x29')]()),_[_0xa8a2('0x23')](_0x394813,{'ListId':parseInt(_0x45702c[_0xa8a2('0x24')],0xa)}));}}})['catch'](function(_0xd91004){logger[_0xa8a2('0x2a')](_0xa8a2('0x2b'),_0x394813[_0xa8a2('0x14')],'',JSON['stringify'](_0xd91004));});}else{if(_0x59a522){logger['info'](_0xa8a2('0x2c'),_0x394813['uniqueid'],'');emit(_0x394813[_0xa8a2('0x14')],util[_0xa8a2('0x1e')](_0xa8a2('0x1f'),_0x59a522[_0xa8a2('0x20')]),util['format'](_0xa8a2('0x21'),_0x45702c[_0xa8a2('0x22')][_0xa8a2('0x29')]()),_[_0xa8a2('0x23')]({'ListId':parseInt(_0x45702c[_0xa8a2('0x24')],0xa)},_0x394813));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2aeb82e..ab77d92 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 _0x71cf=['defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','info','stringify','emit','log','clone','checkTriggers','syncCustomEventNew','interface','hasOwnProperty','checkTrigger','merge','variables','length','Actions','chheckTrigger\x20action','chheckTrigger\x20evt','action','toLowerCase','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winApplication','winArguments','user:%s','format','trigger:%s:%s','jscripty','name','trigger:%s','exec','queue','urlforward','script','parse','search','replace','AllConditions','every','checkConditions','AnyConditions','some','channel','field','account','chat','operator','value','ChatWebsiteId','upperFirst','AccountId','message','event','agent','lastevent','routeId','exports','util','lodash','url','mustache','ioredis','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis'];(function(_0x391fd2,_0x20eda5){var _0x180f3c=function(_0x586a88){while(--_0x586a88){_0x391fd2['push'](_0x391fd2['shift']());}};_0x180f3c(++_0x20eda5);}(_0x71cf,0x160));var _0xf71c=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0x71cf[_0x249e96];return _0x17444c;};'use strict';var util=require(_0xf71c('0x0'));var _=require(_0xf71c('0x1'));var url=require(_0xf71c('0x2'));var Mustache=require(_0xf71c('0x3'));var Redis=require(_0xf71c('0x4'));var urlforward=require('./urlforward');var integration=require(_0xf71c('0x5'));var cmContact=require(_0xf71c('0x6'));var script=require(_0xf71c('0x7'));var cmContactRpc=require(_0xf71c('0x8'));var config=require(_0xf71c('0x9'));var logger=require(_0xf71c('0xa'))(_0xf71c('0xb'));var ami=require(_0xf71c('0xc'));config[_0xf71c('0xd')]=_[_0xf71c('0xe')](config[_0xf71c('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0xf71c('0xf'))(new Redis(config[_0xf71c('0xd')]));var operators={'equals':function(_0x218a85,_0x337e0c){return _0x218a85==_0x337e0c;},'not_equals':function(_0x3acbcb,_0x1c812b){return _0x3acbcb!=_0x1c812b;}};var barAndWebActions=[_0xf71c('0x10'),'url',_0xf71c('0x11')];function Trigger(_0x28577c){this['triggers']=_0x28577c[_0xf71c('0x12')];this['agents']=_0x28577c[_0xf71c('0x13')];this[_0xf71c('0x14')]=_0x28577c[_0xf71c('0x14')];this['templates']=_0x28577c[_0xf71c('0x15')];this[_0xf71c('0x16')]=_0x28577c[_0xf71c('0x16')];this[_0xf71c('0x17')]=_0x28577c[_0xf71c('0x17')];this[_0xf71c('0x18')]=_0x28577c['freshdeskAccounts'];this[_0xf71c('0x19')]=_0x28577c[_0xf71c('0x19')];this['sugarcrmAccounts']=_0x28577c[_0xf71c('0x1a')];this[_0xf71c('0x1b')]=_0x28577c[_0xf71c('0x1b')];this[_0xf71c('0x1c')]=_0x28577c[_0xf71c('0x1c')];this['vtigerAccounts']=_0x28577c[_0xf71c('0x1d')];this['servicenowAccounts']=_0x28577c[_0xf71c('0x1e')];this[_0xf71c('0x1f')]=_0x28577c[_0xf71c('0x1f')];this[_0xf71c('0x20')]=_0x28577c['freshsalesAccounts'];this[_0xf71c('0x21')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0xf71c('0x19')],'freshdesk':this[_0xf71c('0x18')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xf71c('0x1b')],'desk':this[_0xf71c('0x1c')],'vtiger':this[_0xf71c('0x1d')],'dynamics365':this[_0xf71c('0x1f')],'freshsales':this[_0xf71c('0x20')],'servicenow':this['servicenowAccounts']};ami['on'](_0xf71c('0x22'),this[_0xf71c('0x23')][_0xf71c('0x24')](this));ami['on']('custom:agentconnect',this[_0xf71c('0x23')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0xf71c('0x23')][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x25'),this[_0xf71c('0x23')]['bind'](this));ami['on'](_0xf71c('0x26'),this[_0xf71c('0x23')]['bind'](this));ami['on'](_0xf71c('0x27'),this[_0xf71c('0x23')]['bind'](this));ami['on']('custom:agentbusy',this[_0xf71c('0x23')][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x28'),this[_0xf71c('0x23')][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x29'),this['syncCustomEvent'][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x2a'),this[_0xf71c('0x2b')][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x2c'),this['syncAgentDial'][_0xf71c('0x24')](this));ami['on']('custom:dialend',this[_0xf71c('0x2b')][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x2d'),this['syncCustomEvent'][_0xf71c('0x24')](this));ami['on']('custom:closedinteraction',this[_0xf71c('0x23')][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x2e'),this[_0xf71c('0x23')][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x2f'),this[_0xf71c('0x23')][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x30'),this['syncCustomEvent'][_0xf71c('0x24')](this));ami['on'](_0xf71c('0x31'),this[_0xf71c('0x23')][_0xf71c('0x24')](this));}Trigger[_0xf71c('0x32')]['emit']=function(_0x11839e,_0x2dab78,_0x9ad8a1){logger[_0xf71c('0x33')](_0x11839e,_0x2dab78,JSON[_0xf71c('0x34')](_0x9ad8a1));io['to'](_0x11839e)[_0xf71c('0x35')](_0x2dab78,_0x9ad8a1);};Trigger['prototype'][_0xf71c('0x23')]=function(_0x12a939){console[_0xf71c('0x36')](_0xf71c('0x23'),_0x12a939);var _0x5292ef=_[_0xf71c('0x37')](_0x12a939);this[_0xf71c('0x38')](_0x5292ef);};Trigger[_0xf71c('0x32')][_0xf71c('0x39')]=function(_0x21050a){console['log']('SYNCCUSTOMNEW!!!',_0x21050a);var _0x32fb14=_[_0xf71c('0x37')](_0x21050a);this[_0xf71c('0x38')](_0x32fb14);};Trigger['prototype']['syncAgentDial']=function(_0x552794){if(this[_0xf71c('0x13')][_0x552794[_0xf71c('0x3a')]]){this[_0xf71c('0x23')](_0x552794);}};Trigger['prototype']['checkTriggers']=function(_0x19e2a6){var _0x2d8220;for(var _0x1c41e7 in this[_0xf71c('0x12')]){if(this[_0xf71c('0x12')][_0xf71c('0x3b')](_0x1c41e7)){if(this[_0xf71c('0x12')][_0x1c41e7]['status']){_0x2d8220=this[_0xf71c('0x3c')](this['triggers'][_0x1c41e7],_0x19e2a6);if(_0x2d8220){_[_0xf71c('0x3d')](_0x19e2a6,_0x19e2a6[_0xf71c('0x3e')]);for(var _0x50bf06=0x0,_0x5245c1,_0x5794dc,_0x22dd99;_0x50bf060x0){_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(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 b76324a..e931e4e 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 _0xe03d=[']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','password','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','destcalleridnum','calleridnum','/systemusers(','headers','substring','lastIndexOf','GET','contacts?$select=telephone1','value','outbound','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','idField','indexOf','content','ticketType','incidents','assign','getString','Descriptions','/contacts(','phonecall','Subjects','queue','Fields','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','stripTrailingSlash','remoteUri','serverUrl','callDirection','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe03d,0x168));var _0xde03=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0xe03d[_0x53b53e];return _0xbb6179;};'use strict';var _=require('lodash');var BPromise=require(_0xde03('0x0'));var rp=require(_0xde03('0x1'));var util=require(_0xde03('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0xde03('0x3'))('dynamics365');var config=require(_0xde03('0x4'));config[_0xde03('0x5')]=_[_0xde03('0x6')](config[_0xde03('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xde03('0x7'))(new Redis(config[_0xde03('0x5')]));function getAuthToken(_0x437149,_0x161ee5,_0xedb671){var _0x241161={'method':_0xde03('0x8'),'uri':_0x161ee5,'form':{'client_id':_0x437149[_0xde03('0x9')],'resource':_0x437149['remoteUri'],'username':_0x437149['username'],'password':_0x437149[_0xde03('0xa')],'grant_type':'password','client_secret':_0x437149['clientSecret']},'json':!![]};return rp(_0x241161)[_0xde03('0xb')](function(_0x21f16d){return _0x21f16d[_0xde03('0xc')];})[_0xde03('0xd')](function(_0xd1d1f8){logger['error']('['+[_0xedb671[_0xde03('0xe')]()]+_0xde03('0xf'));return _0xd1d1f8[_0xde03('0x10')];});}function getUser(_0x4f0544,_0x81c2d,_0x36be4f,_0x42d1ff,_0x317573,_0x4c2f6c){return new BPromise(function(_0x114973,_0x2c9d94){return getAuthToken(_0x81c2d,_0x42d1ff,_0x4c2f6c)[_0xde03('0xb')](function(_0xb921d0){var _0x14064e={'method':'GET','uri':_0x317573+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xde03('0x11')+_0xb921d0,'OData-Version':_0xde03('0x12')},'json':!![]};return rp(_0x14064e);})[_0xde03('0xb')](function(_0x220ece){var _0xc7e44f=_0x220ece['value'];var _0xc05a5=![];var _0x1a751b=null;if(!_[_0xde03('0x13')](_0x36be4f)){if(intUtil[_0xde03('0x14')](_0x36be4f[_0xde03('0x15')])){_0x4f0544['userEmail']=_0x36be4f['email'];for(_0x1a751b=0x0;_0x1a751b<_0xc7e44f[_0xde03('0x16')];_0x1a751b++){if(_0xc7e44f[_0x1a751b][_0xde03('0x17')]===_0x36be4f[_0xde03('0x15')]&&!_0xc7e44f[_0x1a751b]['isdisabled']){_0xc05a5=!![];logger[_0xde03('0x18')]('['+[_0x4c2f6c[_0xde03('0xe')]()]+']\x20Agent\x20found\x20'+_0xc7e44f[_0x1a751b][_0xde03('0x19')]+'!');_0x4f0544[_0xde03('0x1a')]=_0xc7e44f[_0x1a751b][_0xde03('0x19')];}}}}if(!_0xc05a5){logger['info']('['+[_0x4c2f6c[_0xde03('0xe')]()]+_0xde03('0x1b'));_0x4f0544['userEmail']=_0x81c2d['username'];for(_0x1a751b=0x0;_0x1a751b<_0xc7e44f['length'];_0x1a751b++){if(_0xc7e44f[_0x1a751b][_0xde03('0x17')]===_0x81c2d[_0xde03('0x1c')]){_0x4f0544[_0xde03('0x1a')]=_0xc7e44f[_0x1a751b]['systemuserid'];}}}_0x114973(_0x4f0544);})[_0xde03('0xd')](function(_0x45f3ec){_0x2c9d94(_0x45f3ec[_0xde03('0x10')]);});});}function createEndUser(_0x352d5d,_0x44a32f,_0xbc3a6d,_0x2e4626,_0x344c5d,_0x318b24){return new BPromise(function(_0xf63404,_0xad0e8e){return getAuthToken(_0x44a32f,_0xbc3a6d,_0x318b24)[_0xde03('0xb')](function(_0x503513){var _0x47ce61=_0x318b24[_0xde03('0x1d')]()==='outbound'?_0x344c5d[_0xde03('0x1e')]:_0x344c5d[_0xde03('0x1f')];var _0x2dc618={'method':'POST','uri':_0x2e4626+'contacts','body':{'telephone1':_0x47ce61,'fullname':_0x47ce61,'firstname':_0x47ce61,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xde03('0x20')+_0x352d5d[_0xde03('0x1a')]+')'},'headers':{'Authorization':_0xde03('0x11')+_0x503513,'OData-Version':_0xde03('0x12')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2dc618);})[_0xde03('0xb')](function(_0x56b455){var _0x5abc74=_0x56b455[_0xde03('0x21')]['odata-entityid'];var _0x38ceed=_0x5abc74[_0xde03('0x22')](_0x5abc74[_0xde03('0x23')]('(')+0x1,_0x5abc74[_0xde03('0x23')](')'));_0x352d5d['enduserId']=_0x38ceed;_0xf63404(_0x352d5d);})['catch'](function(_0x234ae2){_0xad0e8e(_0x234ae2['message']);});});}function getEndUser(_0x2d9466,_0x362ba,_0x33cb79,_0x1ceedf,_0xe527ad,_0x46a633){return new BPromise(function(_0x11fb8f,_0x4a025b){return getAuthToken(_0x362ba,_0x33cb79,_0x46a633)[_0xde03('0xb')](function(_0x40fb8){var _0x128364={'method':_0xde03('0x24'),'uri':_0x1ceedf+_0xde03('0x25'),'headers':{'Authorization':'Bearer\x20'+_0x40fb8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x128364);})['then'](function(_0x4e6cd2){var _0x434e8e=null;if(_0x4e6cd2){var _0x20ac9e=_0x4e6cd2[_0xde03('0x26')];var _0x3dfc92=![];for(_0x434e8e=0x0;_0x434e8e<_0x20ac9e[_0xde03('0x16')];_0x434e8e++){var _0x11b6f6=_0x46a633[_0xde03('0x1d')]()===_0xde03('0x27')?_0xe527ad[_0xde03('0x1e')]:_0xe527ad[_0xde03('0x1f')];if(_0x20ac9e[_0x434e8e][_0xde03('0x28')]===_0x11b6f6){_0x3dfc92=!![];_0x2d9466[_0xde03('0x29')]=_0x20ac9e[_0x434e8e][_0xde03('0x2a')];}}if(_0x3dfc92){_0x11fb8f(_0x2d9466);}else{return createEndUser(_0x2d9466,_0x362ba,_0x33cb79,_0x1ceedf,_0xe527ad,_0x46a633)[_0xde03('0xb')](function(_0x4fc19c){logger[_0xde03('0x18')]('['+[_0x46a633['toUpperCase']()]+_0xde03('0x2b'),_0x4fc19c['enduserId']);_0x11fb8f(_0x4fc19c);});}}else{return createEndUser(_0x2d9466,_0x362ba,_0x33cb79,_0x1ceedf,_0xe527ad,_0x46a633)[_0xde03('0xb')](function(_0x1af1b4){logger[_0xde03('0x18')]('['+[_0x46a633['toUpperCase']()]+_0xde03('0x2c'),_0x1af1b4[_0xde03('0x29')]);_0x11fb8f(_0x1af1b4);});}});});}function getCustomFields(_0x35f296,_0x35be82,_0x5e54c5){var _0x490cba={};if(_0x35f296[_0xde03('0x16')]>0x0){_['forEach'](_0x35f296,function(_0x100233){if(_0x100233[_0xde03('0x2d')]==='string'&&_0x100233['nameField']&&!_0x100233['customField']){var _0x47c25f=_0x100233[_0xde03('0x2e')][_0xde03('0x1d')]();var _0x2bbcb0=_0x47c25f['substring'](0x0,_0x47c25f[_0xde03('0x2f')]('_'));var _0x116d4f=_0x47c25f['substring'](_0x47c25f[_0xde03('0x2f')]('_')+0x1);if(_0x2bbcb0===_0x5e54c5){_0x490cba[_0x116d4f]=_0x100233[_0xde03('0x30')];}}});}return _0x490cba;}function getTicket(_0x4bf520,_0x12bc63,_0x477d73,_0x1b4b43,_0x10eee4,_0x3c5c46,_0x512095){return new BPromise(function(_0x5ebf8a,_0x18d0b6){var _0x511196;return getAuthToken(_0x12bc63,_0x477d73,_0x512095)[_0xde03('0xb')](function(_0x1e1bfa){if(_0x3c5c46[_0xde03('0x31')]==='incident'){_0x511196={'method':_0xde03('0x8'),'uri':_0x1b4b43+_0xde03('0x32'),'body':Object[_0xde03('0x33')]({},{'title':intUtil[_0xde03('0x34')](_0x3c5c46['Subjects'],_0x10eee4,'\x20'),'description':intUtil[_0xde03('0x34')](_0x3c5c46[_0xde03('0x35')],_0x10eee4,'\x0a'),'customerid_contact@odata.bind':_0xde03('0x36')+_0x4bf520[_0xde03('0x29')]+')','ownerid@odata.bind':_0xde03('0x20')+_0x4bf520['userId']+')','caseorigincode':'1'},getCustomFields(_0x3c5c46['Fields'],_0x10eee4,_0x3c5c46[_0xde03('0x31')])),'headers':{'Authorization':_0xde03('0x11')+_0x1e1bfa,'OData-Version':_0xde03('0x12')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3c5c46[_0xde03('0x31')]===_0xde03('0x37')){_0x511196={'method':_0xde03('0x8'),'uri':_0x1b4b43+'phonecalls','body':Object[_0xde03('0x33')]({},{'subject':intUtil['getString'](_0x3c5c46[_0xde03('0x38')],_0x10eee4,'\x20'),'phonenumber':String(_0x10eee4[_0xde03('0x1f')]),'description':intUtil[_0xde03('0x34')](_0x3c5c46[_0xde03('0x35')],_0x10eee4,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x4bf520['enduserId']+')','ownerid@odata.bind':_0xde03('0x20')+_0x4bf520[_0xde03('0x1a')]+')','directioncode':_0x4bf520['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xde03('0x20')+_0x4bf520[_0xde03('0x1a')]+')','participationtypemask':_0x4bf520['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xde03('0x36')+_0x4bf520[_0xde03('0x29')]+')','participationtypemask':_0x4bf520['callDirection']===_0xde03('0x39')?0x1:0x2}]},getCustomFields(_0x3c5c46[_0xde03('0x3a')],_0x10eee4,_0x3c5c46[_0xde03('0x31')])),'headers':{'Authorization':'Bearer\x20'+_0x1e1bfa,'OData-Version':_0xde03('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x511196);})[_0xde03('0xb')](function(_0x54fb10){var _0x489514=_0x54fb10[_0xde03('0x21')][_0xde03('0x3b')];var _0x26a87c=_0x489514[_0xde03('0x22')](_0x489514['lastIndexOf']('(')+0x1,_0x489514['lastIndexOf'](')'));_0x4bf520[_0xde03('0x3c')]=_0x26a87c;_0x5ebf8a(_0x4bf520);})['catch'](function(_0x3ce374){_0x18d0b6(_0x3ce374[_0xde03('0x10')]);});});}function emit(_0xa5cf6,_0x48f521,_0x316649,_0x21228d){var _0x21318c={'uri':util[_0xde03('0x3d')](_0xde03('0x3e'),_0xa5cf6,_0x316649,_0x21228d)};io['to'](util[_0xde03('0x3d')]('user:%s',_0x48f521))[_0xde03('0x3f')]('trigger:browser:url',_0x21318c);}exports['cs']=function(_0x57875d,_0x5f57d2,_0x13decc,_0x336f55,_0x585996,_0x2b6611,_0x2e018c,_0xaaea3c){var _0x5a8682={};_0x2b6611['remoteUri']=intUtil[_0xde03('0x40')](_0x2b6611[_0xde03('0x41')]);_0x2b6611[_0xde03('0x42')]=intUtil['stripTrailingSlash'](_0x2b6611[_0xde03('0x42')]);_0x5a8682[_0xde03('0x43')]=_0xaaea3c==='queue'||_0xaaea3c===_0xde03('0x44')?_0xde03('0x39'):_0xde03('0x27');var _0x68d3ef=util[_0xde03('0x3d')](_0xde03('0x45'),_0x2b6611[_0xde03('0x41')]);var _0x421b9e=util['format'](_0xde03('0x46'),_0x2b6611[_0xde03('0x47')]);var _0x571dff=util[_0xde03('0x3d')](_0xde03('0x48'),_0x2b6611[_0xde03('0x42')],_0x5f57d2['uniqueid'],md5(_0x5f57d2[_0xde03('0x49')]));if(_0x585996&&_0x585996[_0xde03('0x4a')]){logger[_0xde03('0x18')](_0xde03('0x4b'),_0xde03('0x4c'));_0x5f57d2[_0xde03('0x4d')]=_0x571dff;}else if(_0x2e018c&&_0x2e018c[_0xde03('0x4e')]&&_0x2e018c[_0xde03('0x4e')]!=='none'){logger[_0xde03('0x18')](_0xde03('0x4f'),_0xde03('0x4c'));_0x5f57d2[_0xde03('0x4d')]=_0x571dff;}else{_0x5f57d2['recordingURL']='';}return getUser(_0x5a8682,_0x2b6611,_0x336f55,_0x421b9e,_0x68d3ef,_0xaaea3c)[_0xde03('0xb')](function(_0x3215f5){logger[_0xde03('0x18')]('['+_0xaaea3c[_0xde03('0xe')]()+_0xde03('0x50'),_0x3215f5[_0xde03('0x1a')]);logger[_0xde03('0x18')]('['+_0xaaea3c['toUpperCase']()+_0xde03('0x51'),_0x3215f5['userEmail']);return getEndUser(_0x3215f5,_0x2b6611,_0x421b9e,_0x68d3ef,_0x5f57d2,_0xaaea3c);})['then'](function(_0x3f13c7){logger['info']('['+_0xaaea3c['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x3f13c7[_0xde03('0x29')]);logger[_0xde03('0x18')]('['+_0xaaea3c['toUpperCase']()+_0xde03('0x52'),_0x5f57d2[_0xde03('0x1f')]);return getTicket(_0x3f13c7,_0x2b6611,_0x421b9e,_0x68d3ef,_0x5f57d2,_0x13decc,_0xaaea3c);})[_0xde03('0xb')](function(_0x1fdbe7){logger[_0xde03('0x18')](util['format']('['+_0xaaea3c[_0xde03('0xe')]()+_0xde03('0x53'),_0x13decc[_0xde03('0x31')],_0x1fdbe7[_0xde03('0x3c')]));logger[_0xde03('0x18')](util[_0xde03('0x3d')]('['+_0xaaea3c[_0xde03('0xe')]()+_0xde03('0x54'),_0xaaea3c));if(_0xaaea3c!=='unmanaged'){logger[_0xde03('0x18')]('['+_0xaaea3c[_0xde03('0xe')]()+']',_0xde03('0x55'));emit(_0x2b6611[_0xde03('0x41')],_0x336f55['name'],_0x13decc[_0xde03('0x31')],_0x1fdbe7[_0xde03('0x3c')]);}})[_0xde03('0xd')](function(_0x2c7002){logger['error']('['+_0xaaea3c[_0xde03('0xe')]()+_0xde03('0x56'),util[_0xde03('0x57')](_0x2c7002,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x989d=[']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','value',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','string','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','phonecalls','callDirection','queue','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','remoteUri','serverUrl','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','name','inspect','bluebird','request-promise','util','./util','ioredis','dynamics365','redis','defaults','clientId','password','clientSecret','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','isNil','userEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase'];(function(_0x2d5669,_0x196808){var _0x14e894=function(_0x13b4fc){while(--_0x13b4fc){_0x2d5669['push'](_0x2d5669['shift']());}};_0x14e894(++_0x196808);}(_0x989d,0xfb));var _0xd989=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x989d[_0x1203f];return _0x365f0a;};'use strict';var _=require('lodash');var BPromise=require(_0xd989('0x0'));var rp=require(_0xd989('0x1'));var util=require(_0xd989('0x2'));var intUtil=require(_0xd989('0x3'));var md5=require('md5');var Redis=require(_0xd989('0x4'));var logger=require('../../../../config/logger')(_0xd989('0x5'));var config=require('../../../../config/environment');config[_0xd989('0x6')]=_[_0xd989('0x7')](config[_0xd989('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd989('0x6')]));function getAuthToken(_0x4ec9dd,_0x3feacc,_0x41bc8a){var _0x581604={'method':'POST','uri':_0x3feacc,'form':{'client_id':_0x4ec9dd[_0xd989('0x8')],'resource':_0x4ec9dd['remoteUri'],'username':_0x4ec9dd['username'],'password':_0x4ec9dd[_0xd989('0x9')],'grant_type':_0xd989('0x9'),'client_secret':_0x4ec9dd[_0xd989('0xa')]},'json':!![]};return rp(_0x581604)[_0xd989('0xb')](function(_0x1e3bd9){return _0x1e3bd9[_0xd989('0xc')];})[_0xd989('0xd')](function(_0x21bfb7){logger[_0xd989('0xe')]('['+[_0x41bc8a['toUpperCase']()]+_0xd989('0xf'));return _0x21bfb7[_0xd989('0x10')];});}function getUser(_0x467bc1,_0x8755a0,_0x1fbaea,_0x5dc1e4,_0x3752fe,_0x4f860e){return new BPromise(function(_0x3a475e,_0x222e2a){return getAuthToken(_0x8755a0,_0x5dc1e4,_0x4f860e)[_0xd989('0xb')](function(_0x42831f){var _0x5c5d79={'method':_0xd989('0x11'),'uri':_0x3752fe+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xd989('0x12')+_0x42831f,'OData-Version':_0xd989('0x13')},'json':!![]};return rp(_0x5c5d79);})[_0xd989('0xb')](function(_0x312485){var _0x53c46e=_0x312485['value'];var _0x7b4be9=![];var _0xf3a890=null;if(!_[_0xd989('0x14')](_0x1fbaea)){if(intUtil['validateEmail'](_0x1fbaea['email'])){_0x467bc1[_0xd989('0x15')]=_0x1fbaea[_0xd989('0x16')];for(_0xf3a890=0x0;_0xf3a890<_0x53c46e[_0xd989('0x17')];_0xf3a890++){if(_0x53c46e[_0xf3a890][_0xd989('0x18')]===_0x1fbaea[_0xd989('0x16')]&&!_0x53c46e[_0xf3a890][_0xd989('0x19')]){_0x7b4be9=!![];logger[_0xd989('0x1a')]('['+[_0x4f860e[_0xd989('0x1b')]()]+_0xd989('0x1c')+_0x53c46e[_0xf3a890][_0xd989('0x1d')]+'!');_0x467bc1[_0xd989('0x1e')]=_0x53c46e[_0xf3a890][_0xd989('0x1d')];}}}}if(!_0x7b4be9){logger['info']('['+[_0x4f860e['toUpperCase']()]+_0xd989('0x1f'));_0x467bc1['userEmail']=_0x8755a0['username'];for(_0xf3a890=0x0;_0xf3a890<_0x53c46e[_0xd989('0x17')];_0xf3a890++){if(_0x53c46e[_0xf3a890]['internalemailaddress']===_0x8755a0[_0xd989('0x20')]){_0x467bc1[_0xd989('0x1e')]=_0x53c46e[_0xf3a890]['systemuserid'];}}}_0x3a475e(_0x467bc1);})[_0xd989('0xd')](function(_0x4c5942){_0x222e2a(_0x4c5942[_0xd989('0x10')]);});});}function createEndUser(_0x49bcb2,_0x334c49,_0x360ed1,_0x203840,_0xa01dd2,_0xd2f30d){return new BPromise(function(_0x1b1acf,_0x11fd23){return getAuthToken(_0x334c49,_0x360ed1,_0xd2f30d)[_0xd989('0xb')](function(_0x3d8c70){var _0x5b9b55=_0xd2f30d[_0xd989('0x21')]()===_0xd989('0x22')?_0xa01dd2[_0xd989('0x23')]:_0xa01dd2[_0xd989('0x24')];var _0x14b509={'method':_0xd989('0x25'),'uri':_0x203840+_0xd989('0x26'),'body':{'telephone1':_0x5b9b55,'fullname':_0x5b9b55,'firstname':_0x5b9b55,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x49bcb2['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x3d8c70,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x14b509);})[_0xd989('0xb')](function(_0xea7dfc){var _0x21b617=_0xea7dfc[_0xd989('0x27')][_0xd989('0x28')];var _0x3c9e9a=_0x21b617[_0xd989('0x29')](_0x21b617[_0xd989('0x2a')]('(')+0x1,_0x21b617['lastIndexOf'](')'));_0x49bcb2[_0xd989('0x2b')]=_0x3c9e9a;_0x1b1acf(_0x49bcb2);})['catch'](function(_0x2ab5d4){_0x11fd23(_0x2ab5d4['message']);});});}function getEndUser(_0x158d2f,_0x3ee2b8,_0x3beb8c,_0x20d87a,_0x3dec9e,_0x91bc1f){return new BPromise(function(_0xccb32a,_0x3e4442){return getAuthToken(_0x3ee2b8,_0x3beb8c,_0x91bc1f)['then'](function(_0xd0191d){var _0x4d1eb0={'method':_0xd989('0x11'),'uri':_0x20d87a+_0xd989('0x2c'),'headers':{'Authorization':_0xd989('0x12')+_0xd0191d,'If-None-Match':null,'OData-Version':_0xd989('0x13')},'json':!![]};return rp(_0x4d1eb0);})[_0xd989('0xb')](function(_0x54f19a){var _0x2734e3=null;if(_0x54f19a){var _0x206f1d=_0x54f19a[_0xd989('0x2d')];var _0x26ba95=![];for(_0x2734e3=0x0;_0x2734e3<_0x206f1d[_0xd989('0x17')];_0x2734e3++){var _0x4e0290=_0x91bc1f[_0xd989('0x21')]()===_0xd989('0x22')?_0x3dec9e[_0xd989('0x23')]:_0x3dec9e['calleridnum'];if(_0x206f1d[_0x2734e3]['telephone1']===_0x4e0290){_0x26ba95=!![];_0x158d2f[_0xd989('0x2b')]=_0x206f1d[_0x2734e3]['contactid'];}}if(_0x26ba95){_0xccb32a(_0x158d2f);}else{return createEndUser(_0x158d2f,_0x3ee2b8,_0x3beb8c,_0x20d87a,_0x3dec9e,_0x91bc1f)['then'](function(_0x252750){logger[_0xd989('0x1a')]('['+[_0x91bc1f['toUpperCase']()]+_0xd989('0x2e'),_0x252750['enduserId']);_0xccb32a(_0x252750);});}}else{return createEndUser(_0x158d2f,_0x3ee2b8,_0x3beb8c,_0x20d87a,_0x3dec9e,_0x91bc1f)[_0xd989('0xb')](function(_0x3cbf4a){logger[_0xd989('0x1a')]('['+[_0x91bc1f[_0xd989('0x1b')]()]+_0xd989('0x2f'),_0x3cbf4a[_0xd989('0x2b')]);_0xccb32a(_0x3cbf4a);});}});});}function getCustomFields(_0x15b2c0,_0x552b6a,_0x54bd07){var _0x5b03a0={};if(_0x15b2c0[_0xd989('0x17')]>0x0){_['forEach'](_0x15b2c0,function(_0x342626){if(_0x342626[_0xd989('0x30')]===_0xd989('0x31')&&_0x342626[_0xd989('0x32')]&&!_0x342626[_0xd989('0x33')]){var _0x351fbf=_0x342626[_0xd989('0x34')][_0xd989('0x21')]();var _0x4e1ebf=_0x351fbf[_0xd989('0x29')](0x0,_0x351fbf[_0xd989('0x35')]('_'));var _0x4ade3b=_0x351fbf[_0xd989('0x29')](_0x351fbf[_0xd989('0x35')]('_')+0x1);if(_0x4e1ebf===_0x54bd07){_0x5b03a0[_0x4ade3b]=_0x342626[_0xd989('0x36')];}}});}return _0x5b03a0;}function getTicket(_0x4bd90a,_0x1f0150,_0x4c4281,_0x5be813,_0x503abc,_0x32acf5,_0x39c93c){return new BPromise(function(_0x19b95d,_0x1199ec){var _0xad0598;return getAuthToken(_0x1f0150,_0x4c4281,_0x39c93c)[_0xd989('0xb')](function(_0x42a623){if(_0x32acf5[_0xd989('0x37')]==='incident'){_0xad0598={'method':_0xd989('0x25'),'uri':_0x5be813+_0xd989('0x38'),'body':Object[_0xd989('0x39')]({},{'title':intUtil[_0xd989('0x3a')](_0x32acf5[_0xd989('0x3b')],_0x503abc,'\x20'),'description':intUtil[_0xd989('0x3a')](_0x32acf5[_0xd989('0x3c')],_0x503abc,'\x0a'),'customerid_contact@odata.bind':_0xd989('0x3d')+_0x4bd90a['enduserId']+')','ownerid@odata.bind':_0xd989('0x3e')+_0x4bd90a['userId']+')','caseorigincode':'1'},getCustomFields(_0x32acf5[_0xd989('0x3f')],_0x503abc,_0x32acf5[_0xd989('0x37')])),'headers':{'Authorization':_0xd989('0x12')+_0x42a623,'OData-Version':_0xd989('0x13')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x32acf5['ticketType']===_0xd989('0x40')){_0xad0598={'method':_0xd989('0x25'),'uri':_0x5be813+_0xd989('0x41'),'body':Object[_0xd989('0x39')]({},{'subject':intUtil[_0xd989('0x3a')](_0x32acf5['Subjects'],_0x503abc,'\x20'),'phonenumber':String(_0x503abc[_0xd989('0x24')]),'description':intUtil[_0xd989('0x3a')](_0x32acf5[_0xd989('0x3c')],_0x503abc,'\x0a'),'regardingobjectid_contact@odata.bind':_0xd989('0x3d')+_0x4bd90a['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x4bd90a[_0xd989('0x1e')]+')','directioncode':_0x4bd90a[_0xd989('0x42')]===_0xd989('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xd989('0x3e')+_0x4bd90a[_0xd989('0x1e')]+')','participationtypemask':_0x4bd90a[_0xd989('0x42')]===_0xd989('0x43')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4bd90a[_0xd989('0x2b')]+')','participationtypemask':_0x4bd90a[_0xd989('0x42')]==='queue'?0x1:0x2}]},getCustomFields(_0x32acf5[_0xd989('0x3f')],_0x503abc,_0x32acf5[_0xd989('0x37')])),'headers':{'Authorization':_0xd989('0x12')+_0x42a623,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xad0598);})[_0xd989('0xb')](function(_0x9bc37e){var _0x45d491=_0x9bc37e[_0xd989('0x27')][_0xd989('0x28')];var _0x32f483=_0x45d491['substring'](_0x45d491[_0xd989('0x2a')]('(')+0x1,_0x45d491[_0xd989('0x2a')](')'));_0x4bd90a[_0xd989('0x44')]=_0x32f483;_0x19b95d(_0x4bd90a);})[_0xd989('0xd')](function(_0x2f2af7){_0x1199ec(_0x2f2af7['message']);});});}function emit(_0x172f23,_0x226e11,_0x855699,_0x25e1c8){var _0x4d03f2={'uri':util[_0xd989('0x45')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x172f23,_0x855699,_0x25e1c8)};io['to'](util[_0xd989('0x45')](_0xd989('0x46'),_0x226e11))[_0xd989('0x47')](_0xd989('0x48'),_0x4d03f2);}exports['cs']=function(_0x2f47d3,_0x293eb2,_0x25bc30,_0xd6feb,_0x59f86b,_0x240d8e,_0x2e0b6b,_0x8b72f3){var _0x54f3d3={};_0x240d8e['remoteUri']=intUtil[_0xd989('0x49')](_0x240d8e[_0xd989('0x4a')]);_0x240d8e[_0xd989('0x4b')]=intUtil[_0xd989('0x49')](_0x240d8e[_0xd989('0x4b')]);_0x54f3d3[_0xd989('0x42')]=_0x8b72f3==='queue'||_0x8b72f3===_0xd989('0x4c')?'queue':_0xd989('0x22');var _0x55aa72=util['format']('%s/api/data/v9.0/',_0x240d8e[_0xd989('0x4a')]);var _0x9135fa=util[_0xd989('0x45')]('https://login.microsoftonline.com/%s/oauth2/token',_0x240d8e[_0xd989('0x4d')]);var _0x265fbc=util['format'](_0xd989('0x4e'),_0x240d8e[_0xd989('0x4b')],_0x293eb2[_0xd989('0x4f')],md5(_0x293eb2[_0xd989('0x4f')]));if(_0x59f86b&&_0x59f86b[_0xd989('0x50')]){logger['info'](_0xd989('0x51'),_0xd989('0x52'));_0x293eb2[_0xd989('0x53')]=_0x265fbc;}else if(_0x2e0b6b&&_0x2e0b6b[_0xd989('0x54')]&&_0x2e0b6b[_0xd989('0x54')]!==_0xd989('0x55')){logger[_0xd989('0x1a')](_0xd989('0x56'),_0xd989('0x52'));_0x293eb2[_0xd989('0x53')]=_0x265fbc;}else{_0x293eb2['recordingURL']='';}return getUser(_0x54f3d3,_0x240d8e,_0xd6feb,_0x9135fa,_0x55aa72,_0x8b72f3)[_0xd989('0xb')](function(_0x3cf183){logger[_0xd989('0x1a')]('['+_0x8b72f3[_0xd989('0x1b')]()+_0xd989('0x57'),_0x3cf183[_0xd989('0x1e')]);logger[_0xd989('0x1a')]('['+_0x8b72f3[_0xd989('0x1b')]()+_0xd989('0x58'),_0x3cf183['userEmail']);return getEndUser(_0x3cf183,_0x240d8e,_0x9135fa,_0x55aa72,_0x293eb2,_0x8b72f3);})['then'](function(_0x3feee2){logger[_0xd989('0x1a')]('['+_0x8b72f3['toUpperCase']()+_0xd989('0x59'),_0x3feee2[_0xd989('0x2b')]);logger[_0xd989('0x1a')]('['+_0x8b72f3[_0xd989('0x1b')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x293eb2[_0xd989('0x24')]);return getTicket(_0x3feee2,_0x240d8e,_0x9135fa,_0x55aa72,_0x293eb2,_0x25bc30,_0x8b72f3);})[_0xd989('0xb')](function(_0x31c68f){logger[_0xd989('0x1a')](util['format']('['+_0x8b72f3['toUpperCase']()+_0xd989('0x5a'),_0x25bc30['ticketType'],_0x31c68f['ticketId']));logger['info'](util[_0xd989('0x45')]('['+_0x8b72f3['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x8b72f3));if(_0x8b72f3!==_0xd989('0x4c')){logger[_0xd989('0x1a')]('['+_0x8b72f3[_0xd989('0x1b')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x240d8e[_0xd989('0x4a')],_0xd6feb[_0xd989('0x5b')],_0x25bc30[_0xd989('0x37')],_0x31c68f['ticketId']);}})[_0xd989('0xd')](function(_0x2171f4){logger['error']('['+_0x8b72f3['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0xd989('0x5c')](_0x2171f4,{'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 e5d17d9..d6947ee 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 _0x4e1a=['Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','GET','forEach','string','nameField','type','idField','push','content','toString','variable','variableName','customField','customVariable','Variable','name','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','stringify','serverUrl','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','unmanaged','monitor_format','calleridnum','error','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','getString','Subjects','
','Tags','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','%s/api/v2/agents','then','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x3cd000,_0x15abbd){var _0x542cd7=function(_0x3b6355){while(--_0x3b6355){_0x3cd000['push'](_0x3cd000['shift']());}};_0x542cd7(++_0x15abbd);}(_0x4e1a,0x148));var _0xa4e1=function(_0x521b7d,_0x2aa947){_0x521b7d=_0x521b7d-0x0;var _0x4f143a=_0x4e1a[_0x521b7d];return _0x4f143a;};'use strict';var _=require(_0xa4e1('0x0'));var rp=require(_0xa4e1('0x1'));var md5=require(_0xa4e1('0x2'));var util=require('util');var Redis=require(_0xa4e1('0x3'));var intUtil=require('./util');var config=require(_0xa4e1('0x4'));var logger=require(_0xa4e1('0x5'))(_0xa4e1('0x6'));config[_0xa4e1('0x7')]=_[_0xa4e1('0x8')](config['redis'],{'host':_0xa4e1('0x9'),'port':0x18eb});var io=require(_0xa4e1('0xa'))(new Redis(config[_0xa4e1('0x7')]));var headers={'Content-Type':'application/json','Accept':_0xa4e1('0xb')};function emit(_0x4ca97f,_0x1b6f0b,_0x1c7d69){io['to'](_0x4ca97f)[_0xa4e1('0xc')](_0x1b6f0b,_0x1c7d69);}function getTicket(_0x2b828e,_0x2970d2,_0x1f337a,_0x3144f5,_0x430da9){logger[_0xa4e1('0xd')](_0xa4e1('0xe'));var _0x6593e3=_['merge']({'responder_id':_0x2970d2['id'],'requester_id':_0x1f337a['id'],'name':util[_0xa4e1('0xf')](_0xa4e1('0x10'),_0x430da9['calleridname']),'phone':_0x430da9['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xa4e1('0x11')](_0x3144f5[_0xa4e1('0x12')],_0x430da9,'\x20'),'description':intUtil[_0xa4e1('0x11')](_0x3144f5['Descriptions'],_0x430da9,_0xa4e1('0x13')),'tags':getTags(_0x3144f5[_0xa4e1('0x14')],'name')},getCustomFields(_0x3144f5[_0xa4e1('0x15')],_0x430da9));_0x6593e3['custom_fields']=_[_0xa4e1('0x16')](_[_0xa4e1('0x17')](_0x6593e3[_0xa4e1('0x18')],'id'),_0xa4e1('0x19'));return request({'uri':util['format'](_0xa4e1('0x1a'),_0x2b828e[_0xa4e1('0x1b')]),'method':_0xa4e1('0x1c'),'body':_0x6593e3})['then'](function(_0x214276){logger[_0xa4e1('0xd')]('Ticket\x20created!');return _0x214276;});}function getUser(_0x52a936,_0x1038da){if(intUtil['validateEmail'](_0x1038da)){return request({'uri':util[_0xa4e1('0xf')](_0xa4e1('0x1d'),_0x52a936[_0xa4e1('0x1b')]),'qs':{'email':_0x1038da}})[_0xa4e1('0x1e')](function(_0x4451ff){if(_0x4451ff[_0xa4e1('0x1f')]){logger[_0xa4e1('0xd')](_0xa4e1('0x20'));return _['find'](_0x4451ff,function(_0x3fa92c){return _0x3fa92c[_0xa4e1('0x21')]['email']===_0x1038da;});}else{logger['info'](_0xa4e1('0x22'));return request({'uri':util[_0xa4e1('0xf')]('%s/api/v2/agents/me',_0x52a936[_0xa4e1('0x1b')])})['then'](function(_0x2e5fe6){logger[_0xa4e1('0xd')](_0xa4e1('0x23'));return _0x2e5fe6;});}});}else{logger[_0xa4e1('0xd')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa4e1('0xf')](_0xa4e1('0x24'),_0x52a936['remoteUri'])})[_0xa4e1('0x1e')](function(_0x2bf57f){logger[_0xa4e1('0xd')](_0xa4e1('0x23'));return _0x2bf57f;});}}function getEndUser(_0x1177a8,_0x19ed5e,_0x5e8252){logger[_0xa4e1('0xd')](_0xa4e1('0x25'),_0x5e8252);return request({'uri':util[_0xa4e1('0xf')]('%s/api/v2/contacts',_0x1177a8['remoteUri']),'qs':{'phone':_0x5e8252}})[_0xa4e1('0x1e')](function(_0x2038a5){if(_0x2038a5[_0xa4e1('0x1f')]){logger[_0xa4e1('0xd')]('Enduser\x20found!');return _[_0xa4e1('0x26')](_0x2038a5,{'phone':_0x5e8252});}else{logger[_0xa4e1('0xd')](_0xa4e1('0x27'));return request({'uri':util[_0xa4e1('0xf')]('%s/api/v2/contacts',_0x1177a8['remoteUri']),'method':_0xa4e1('0x1c'),'body':{'name':_0x19ed5e,'phone':_0x5e8252}})[_0xa4e1('0x1e')](function(_0x13a299){logger['info'](_0xa4e1('0x28'));return _0x13a299;});}});}function getAuth(_0x35e404){return util['format'](_0xa4e1('0x29'),new Buffer(_0x35e404[_0xa4e1('0x2a')]+':X')['toString'](_0xa4e1('0x2b')));}function request(_0x28e450){logger[_0xa4e1('0x2c')](_0xa4e1('0x2d'),JSON['stringify'](_0x28e450));return rp(_[_0xa4e1('0x8')](_0x28e450,{'method':_0xa4e1('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x257fcc,_0x10aab0){var _0x173a7a=[];if(_0x257fcc&&_0x257fcc['length']>0x0){_0x173a7a=_['map'](_0x257fcc,_0x10aab0);}return _0x173a7a;}function getCustomFields(_0x322f99,_0x29c5c2){var _0x35a8f8=[];var _0xe8d1da={'custom_fields':[]};if(_0x322f99['length']>0x0){_[_0xa4e1('0x2f')](_0x322f99,function(_0x160561){if(_0x160561['type']===_0xa4e1('0x30')&&_0x160561[_0xa4e1('0x31')]&&!_0x160561['customField']){_0xe8d1da[_0x160561['nameField']['toLowerCase']()]=_0x160561['content']['toString']();}else if(_0x160561[_0xa4e1('0x32')]==='string'&&_0x160561[_0xa4e1('0x33')]&&_0x160561['customField']){_0xe8d1da[_0xa4e1('0x18')][_0xa4e1('0x34')]({'id':_0x160561[_0xa4e1('0x33')],'value':_0x160561[_0xa4e1('0x35')][_0xa4e1('0x36')]()});}else if(_0x160561[_0xa4e1('0x32')]===_0xa4e1('0x37')&&_0x160561[_0xa4e1('0x38')]&&_0x160561[_0xa4e1('0x33')]&&_0x160561[_0xa4e1('0x39')]){_0x29c5c2[_0x160561[_0xa4e1('0x38')]]&&_0xe8d1da[_0xa4e1('0x18')][_0xa4e1('0x34')]({'id':_0x160561['idField'],'value':_0x29c5c2[_0x160561[_0xa4e1('0x38')]][_0xa4e1('0x36')]()});}else if(_0x160561[_0xa4e1('0x32')]===_0xa4e1('0x3a')&&_0x160561[_0xa4e1('0x3b')]&&_0x160561[_0xa4e1('0x3b')][_0xa4e1('0x3c')]&&_0x160561[_0xa4e1('0x33')]&&_0x160561[_0xa4e1('0x39')]){_0x29c5c2[_0x160561[_0xa4e1('0x3b')]['name']['toLowerCase']()]&&_0xe8d1da[_0xa4e1('0x18')][_0xa4e1('0x34')]({'id':_0x160561['idField'],'value':_0x29c5c2[_0x160561['Variable'][_0xa4e1('0x3c')]['toLowerCase']()]['toString']()});}});}return _0xe8d1da;}exports[_0xa4e1('0x3d')]=function(_0x490276,_0x9af146,_0x5432ce,_0x5ed13e,_0x39737d,_0x44a247){var _0x14c78a,_0x3cc5a4;_0x44a247[_0xa4e1('0x1b')]=intUtil[_0xa4e1('0x3e')](_0x44a247[_0xa4e1('0x1b')]);_0x44a247['serverUrl']=intUtil['stripTrailingSlash'](_0x44a247['serverUrl']);if(_0x39737d&&_0x39737d['monitor_format']){logger['info'](_0xa4e1('0x3f'),_0xa4e1('0x40'));_0x9af146['recordingURL']=util[_0xa4e1('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44a247['serverUrl'],_0x9af146[_0xa4e1('0x41')],md5(_0x9af146[_0xa4e1('0x41')]));}else{_0x9af146[_0xa4e1('0x42')]='';}headers['Authorization']=getAuth(_0x44a247);return getUser(_0x44a247,_0x5ed13e[_0xa4e1('0x43')])[_0xa4e1('0x1e')](function(_0x18ee30){_0x14c78a=_0x18ee30;logger['info'](_0xa4e1('0x44'),_0x14c78a['id']);return getEndUser(_0x44a247,_0x9af146[_0xa4e1('0x45')],_0x9af146['calleridnum']);})[_0xa4e1('0x1e')](function(_0x3ee43b){_0x3cc5a4=_0x3ee43b;logger[_0xa4e1('0xd')](_0xa4e1('0x46'),_0x3cc5a4['id']);return getTicket(_0x44a247,_0x14c78a,_0x3cc5a4,_0x5432ce,_0x9af146);})['then'](function(_0x55e566){if(_0x55e566&&_0x55e566['id']){logger[_0xa4e1('0xd')](_0xa4e1('0x47'));logger[_0xa4e1('0xd')](_0xa4e1('0x48'),_0x55e566['id']);logger[_0xa4e1('0xd')]('[QUEUE]',_0xa4e1('0x49'));emit(util[_0xa4e1('0xf')](_0xa4e1('0x4a'),_0x5ed13e[_0xa4e1('0x3c')]),_0xa4e1('0x4b'),{'uri':util[_0xa4e1('0xf')](_0xa4e1('0x4c'),_0x44a247['remoteUri'],_0x55e566['id'])});}})[_0xa4e1('0x4d')](function(_0x4a0000){logger['error'](_0xa4e1('0x3f'),JSON[_0xa4e1('0x4e')](_0x4a0000));});};exports['outbound']=function(_0xc2309b,_0x48f513,_0x356cd2,_0x4a6ab9,_0x6dacd4,_0x294f82,_0x4f9400){var _0x1b2ad9,_0x100eda;_0x294f82[_0xa4e1('0x1b')]=intUtil['stripTrailingSlash'](_0x294f82['remoteUri']);_0x294f82[_0xa4e1('0x4f')]=intUtil['stripTrailingSlash'](_0x294f82[_0xa4e1('0x4f')]);if(_0x4f9400&&_0x4f9400[_0xa4e1('0x50')]&&_0x4f9400[_0xa4e1('0x50')]!==_0xa4e1('0x51')){logger[_0xa4e1('0xd')](_0xa4e1('0x52'),_0xa4e1('0x40'));_0x48f513[_0xa4e1('0x42')]=util[_0xa4e1('0xf')](_0xa4e1('0x53'),_0x294f82[_0xa4e1('0x4f')],_0x48f513[_0xa4e1('0x41')],md5(_0x48f513['uniqueid']));}headers[_0xa4e1('0x54')]=getAuth(_0x294f82);return getUser(_0x294f82,_0x4a6ab9[_0xa4e1('0x43')])[_0xa4e1('0x1e')](function(_0x57cf62){_0x1b2ad9=_0x57cf62;logger['info']('The\x20User\x20ID\x20is:',_0x1b2ad9['id']);return getEndUser(_0x294f82,_0x48f513['destcalleridname'],_0x48f513[_0xa4e1('0x55')]);})[_0xa4e1('0x1e')](function(_0x5d823f){_0x100eda=_0x5d823f;logger[_0xa4e1('0xd')](_0xa4e1('0x46'),_0x100eda['id']);return getTicket(_0x294f82,_0x1b2ad9,_0x100eda,_0x356cd2,_0x48f513);})[_0xa4e1('0x1e')](function(_0x448632){if(_0x448632&&_0x448632['id']){logger[_0xa4e1('0xd')](_0xa4e1('0x47'));logger[_0xa4e1('0xd')]('The\x20Ticket\x20ID\x20is:',_0x448632['id']);logger['info'](_0xa4e1('0x52'),_0xa4e1('0x49'));emit(util['format'](_0xa4e1('0x4a'),_0x4a6ab9[_0xa4e1('0x3c')]),_0xa4e1('0x4b'),{'uri':util[_0xa4e1('0xf')](_0xa4e1('0x4c'),_0x294f82['remoteUri'],_0x448632['id'])});}})[_0xa4e1('0x4d')](function(_0x45e44f){logger['error'](_0xa4e1('0x52'),JSON[_0xa4e1('0x4e')](_0x45e44f));});};exports[_0xa4e1('0x56')]=function(_0x5daf38,_0x3f3177,_0x1cf925,_0x246e22,_0x2c322d,_0x474ea0){var _0x2a862a,_0x3d0ab5;_0x474ea0[_0xa4e1('0x1b')]=intUtil[_0xa4e1('0x3e')](_0x474ea0[_0xa4e1('0x1b')]);_0x474ea0[_0xa4e1('0x4f')]=intUtil[_0xa4e1('0x3e')](_0x474ea0[_0xa4e1('0x4f')]);if(_0x2c322d&&_0x2c322d[_0xa4e1('0x57')]){logger[_0xa4e1('0xd')]('['+_0x3f3177['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3f3177[_0xa4e1('0x42')]=util[_0xa4e1('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x474ea0[_0xa4e1('0x4f')],_0x3f3177[_0xa4e1('0x41')],md5(_0x3f3177[_0xa4e1('0x41')]));}else{_0x3f3177[_0xa4e1('0x42')]='';}headers['Authorization']=getAuth(_0x474ea0);return getUser(_0x474ea0,'')[_0xa4e1('0x1e')](function(_0x49ce45){_0x2a862a=_0x49ce45;logger[_0xa4e1('0xd')](_0xa4e1('0x44'),_0x2a862a['id']);return getEndUser(_0x474ea0,_0x3f3177[_0xa4e1('0x45')],_0x3f3177[_0xa4e1('0x58')]);})[_0xa4e1('0x1e')](function(_0x2b3c0a){_0x3d0ab5=_0x2b3c0a;logger[_0xa4e1('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3d0ab5['id']);return getTicket(_0x474ea0,_0x2a862a,_0x3d0ab5,_0x1cf925,_0x3f3177);})['then'](function(_0x3378a5){if(_0x3378a5){logger[_0xa4e1('0xd')](_0xa4e1('0x47'));logger[_0xa4e1('0xd')](_0xa4e1('0x48'),_0x3378a5['id']);}})[_0xa4e1('0x4d')](function(_0x414d94){logger[_0xa4e1('0x59')]('['+_0x3f3177[_0xa4e1('0x5a')][_0xa4e1('0x5b')]()+']',JSON['stringify'](_0x414d94));});}; \ No newline at end of file +var _0x5132=['type','string','nameField','customField','toLowerCase','content','idField','push','variable','variableName','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','%s/helpdesk/tickets/%d','unmanaged','toUpperCase','The\x20Enduser\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','application/json','info','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach'];(function(_0x5cded7,_0x1f2dc0){var _0x16aa94=function(_0x45dd2f){while(--_0x45dd2f){_0x5cded7['push'](_0x5cded7['shift']());}};_0x16aa94(++_0x1f2dc0);}(_0x5132,0x12f));var _0x2513=function(_0x4bc10d,_0x44348a){_0x4bc10d=_0x4bc10d-0x0;var _0x4fcf2e=_0x5132[_0x4bc10d];return _0x4fcf2e;};'use strict';var _=require(_0x2513('0x0'));var rp=require(_0x2513('0x1'));var md5=require(_0x2513('0x2'));var util=require(_0x2513('0x3'));var Redis=require(_0x2513('0x4'));var intUtil=require(_0x2513('0x5'));var config=require('../../../../config/environment');var logger=require(_0x2513('0x6'))(_0x2513('0x7'));config[_0x2513('0x8')]=_[_0x2513('0x9')](config[_0x2513('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2513('0x8')]));var headers={'Content-Type':_0x2513('0xa'),'Accept':_0x2513('0xa')};function emit(_0x17bb6e,_0x2d7eda,_0x51cfcc){io['to'](_0x17bb6e)['emit'](_0x2d7eda,_0x51cfcc);}function getTicket(_0x2cd5f0,_0x1de516,_0x1ff81c,_0x52d051,_0x3b5cf1){logger[_0x2513('0xb')]('Creating\x20new\x20ticket...');var _0x53380f=_['merge']({'responder_id':_0x1de516['id'],'requester_id':_0x1ff81c['id'],'name':util[_0x2513('0xc')](_0x2513('0xd'),_0x3b5cf1[_0x2513('0xe')]),'phone':_0x3b5cf1[_0x2513('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x52d051[_0x2513('0x10')],_0x3b5cf1,'\x20'),'description':intUtil[_0x2513('0x11')](_0x52d051[_0x2513('0x12')],_0x3b5cf1,_0x2513('0x13')),'tags':getTags(_0x52d051['Tags'],'name')},getCustomFields(_0x52d051[_0x2513('0x14')],_0x3b5cf1));_0x53380f['custom_fields']=_[_0x2513('0x15')](_[_0x2513('0x16')](_0x53380f[_0x2513('0x17')],'id'),_0x2513('0x18'));return request({'uri':util[_0x2513('0xc')](_0x2513('0x19'),_0x2cd5f0[_0x2513('0x1a')]),'method':_0x2513('0x1b'),'body':_0x53380f})[_0x2513('0x1c')](function(_0x5e2073){logger[_0x2513('0xb')](_0x2513('0x1d'));return _0x5e2073;});}function getUser(_0x2fd877,_0x3e98d1){if(intUtil['validateEmail'](_0x3e98d1)){return request({'uri':util[_0x2513('0xc')]('%s/api/v2/agents',_0x2fd877[_0x2513('0x1a')]),'qs':{'email':_0x3e98d1}})[_0x2513('0x1c')](function(_0x27d7fa){if(_0x27d7fa[_0x2513('0x1e')]){logger[_0x2513('0xb')]('Agent\x20found!');return _[_0x2513('0x1f')](_0x27d7fa,function(_0x29cb8e){return _0x29cb8e[_0x2513('0x20')][_0x2513('0x21')]===_0x3e98d1;});}else{logger[_0x2513('0xb')](_0x2513('0x22'));return request({'uri':util[_0x2513('0xc')]('%s/api/v2/agents/me',_0x2fd877[_0x2513('0x1a')])})[_0x2513('0x1c')](function(_0x3cad07){logger['info'](_0x2513('0x23'));return _0x3cad07;});}});}else{logger[_0x2513('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2513('0xc')](_0x2513('0x24'),_0x2fd877[_0x2513('0x1a')])})['then'](function(_0x15f1fc){logger[_0x2513('0xb')](_0x2513('0x23'));return _0x15f1fc;});}}function getEndUser(_0x314bb1,_0x211f06,_0x516ee0){logger[_0x2513('0xb')]('Searching\x20enduser\x20with\x20phone',_0x516ee0);return request({'uri':util[_0x2513('0xc')](_0x2513('0x25'),_0x314bb1[_0x2513('0x1a')]),'qs':{'phone':_0x516ee0}})[_0x2513('0x1c')](function(_0xdd74c1){if(_0xdd74c1[_0x2513('0x1e')]){logger['info']('Enduser\x20found!');return _['find'](_0xdd74c1,{'phone':_0x516ee0});}else{logger[_0x2513('0xb')](_0x2513('0x26'));return request({'uri':util[_0x2513('0xc')](_0x2513('0x25'),_0x314bb1[_0x2513('0x1a')]),'method':_0x2513('0x1b'),'body':{'name':_0x211f06,'phone':_0x516ee0}})[_0x2513('0x1c')](function(_0x9cc6a4){logger['info']('Enduser\x20created.');return _0x9cc6a4;});}});}function getAuth(_0x34a95d){return util[_0x2513('0xc')](_0x2513('0x27'),new Buffer(_0x34a95d[_0x2513('0x28')]+':X')[_0x2513('0x29')](_0x2513('0x2a')));}function request(_0x26ab5d){logger[_0x2513('0x2b')](_0x2513('0x2c'),JSON[_0x2513('0x2d')](_0x26ab5d));return rp(_[_0x2513('0x9')](_0x26ab5d,{'method':_0x2513('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x5c8dcb,_0x1b3218){var _0x3437af=[];if(_0x5c8dcb&&_0x5c8dcb[_0x2513('0x1e')]>0x0){_0x3437af=_[_0x2513('0x2f')](_0x5c8dcb,_0x1b3218);}return _0x3437af;}function getCustomFields(_0x87dea,_0x3f4a54){var _0xfdb608=[];var _0x1ae818={'custom_fields':[]};if(_0x87dea[_0x2513('0x1e')]>0x0){_[_0x2513('0x30')](_0x87dea,function(_0x1deef3){if(_0x1deef3[_0x2513('0x31')]===_0x2513('0x32')&&_0x1deef3[_0x2513('0x33')]&&!_0x1deef3[_0x2513('0x34')]){_0x1ae818[_0x1deef3[_0x2513('0x33')][_0x2513('0x35')]()]=_0x1deef3[_0x2513('0x36')][_0x2513('0x29')]();}else if(_0x1deef3['type']===_0x2513('0x32')&&_0x1deef3[_0x2513('0x37')]&&_0x1deef3[_0x2513('0x34')]){_0x1ae818[_0x2513('0x17')][_0x2513('0x38')]({'id':_0x1deef3[_0x2513('0x37')],'value':_0x1deef3['content'][_0x2513('0x29')]()});}else if(_0x1deef3[_0x2513('0x31')]===_0x2513('0x39')&&_0x1deef3['variableName']&&_0x1deef3[_0x2513('0x37')]&&_0x1deef3[_0x2513('0x34')]){_0x3f4a54[_0x1deef3[_0x2513('0x3a')]]&&_0x1ae818[_0x2513('0x17')][_0x2513('0x38')]({'id':_0x1deef3[_0x2513('0x37')],'value':_0x3f4a54[_0x1deef3['variableName']][_0x2513('0x29')]()});}else if(_0x1deef3['type']==='customVariable'&&_0x1deef3[_0x2513('0x3b')]&&_0x1deef3[_0x2513('0x3b')][_0x2513('0x3c')]&&_0x1deef3[_0x2513('0x37')]&&_0x1deef3[_0x2513('0x34')]){_0x3f4a54[_0x1deef3[_0x2513('0x3b')]['name'][_0x2513('0x35')]()]&&_0x1ae818[_0x2513('0x17')]['push']({'id':_0x1deef3[_0x2513('0x37')],'value':_0x3f4a54[_0x1deef3[_0x2513('0x3b')][_0x2513('0x3c')][_0x2513('0x35')]()][_0x2513('0x29')]()});}});}return _0x1ae818;}exports[_0x2513('0x3d')]=function(_0x351014,_0x59e66f,_0xdda949,_0x2615f9,_0x581aca,_0x169adf){var _0x2df31b,_0x16abd4;_0x169adf[_0x2513('0x1a')]=intUtil[_0x2513('0x3e')](_0x169adf[_0x2513('0x1a')]);_0x169adf[_0x2513('0x3f')]=intUtil[_0x2513('0x3e')](_0x169adf[_0x2513('0x3f')]);if(_0x581aca&&_0x581aca[_0x2513('0x40')]){logger['info'](_0x2513('0x41'),_0x2513('0x42'));_0x59e66f[_0x2513('0x43')]=util[_0x2513('0xc')](_0x2513('0x44'),_0x169adf[_0x2513('0x3f')],_0x59e66f[_0x2513('0x45')],md5(_0x59e66f[_0x2513('0x45')]));}else{_0x59e66f[_0x2513('0x43')]='';}headers[_0x2513('0x46')]=getAuth(_0x169adf);return getUser(_0x169adf,_0x2615f9[_0x2513('0x21')])[_0x2513('0x1c')](function(_0x1c1c1a){_0x2df31b=_0x1c1c1a;logger[_0x2513('0xb')](_0x2513('0x47'),_0x2df31b['id']);return getEndUser(_0x169adf,_0x59e66f['calleridname'],_0x59e66f['calleridnum']);})[_0x2513('0x1c')](function(_0x1b6438){_0x16abd4=_0x1b6438;logger[_0x2513('0xb')]('The\x20Enduser\x20ID\x20is:',_0x16abd4['id']);return getTicket(_0x169adf,_0x2df31b,_0x16abd4,_0xdda949,_0x59e66f);})[_0x2513('0x1c')](function(_0xe0e065){if(_0xe0e065&&_0xe0e065['id']){logger[_0x2513('0xb')]('Ticket\x20created!');logger['info'](_0x2513('0x48'),_0xe0e065['id']);logger[_0x2513('0xb')](_0x2513('0x41'),_0x2513('0x49'));emit(util[_0x2513('0xc')]('user:%s',_0x2615f9['name']),_0x2513('0x4a'),{'uri':util[_0x2513('0xc')]('%s/helpdesk/tickets/%d',_0x169adf['remoteUri'],_0xe0e065['id'])});}})[_0x2513('0x4b')](function(_0x46d839){logger[_0x2513('0x4c')]('[QUEUE]',JSON[_0x2513('0x2d')](_0x46d839));});};exports[_0x2513('0x4d')]=function(_0x2b12e2,_0x3651fc,_0x5dfb67,_0x5bb292,_0x3c164a,_0xb703be,_0x1b07dc){var _0x441e02,_0x35f6f9;_0xb703be['remoteUri']=intUtil[_0x2513('0x3e')](_0xb703be[_0x2513('0x1a')]);_0xb703be['serverUrl']=intUtil[_0x2513('0x3e')](_0xb703be['serverUrl']);if(_0x1b07dc&&_0x1b07dc['recordingFormat']&&_0x1b07dc[_0x2513('0x4e')]!==_0x2513('0x4f')){logger[_0x2513('0xb')]('[OUTBOUND]',_0x2513('0x42'));_0x3651fc[_0x2513('0x43')]=util[_0x2513('0xc')](_0x2513('0x44'),_0xb703be[_0x2513('0x3f')],_0x3651fc[_0x2513('0x45')],md5(_0x3651fc['uniqueid']));}headers['Authorization']=getAuth(_0xb703be);return getUser(_0xb703be,_0x5bb292[_0x2513('0x21')])[_0x2513('0x1c')](function(_0x1eccbe){_0x441e02=_0x1eccbe;logger[_0x2513('0xb')](_0x2513('0x47'),_0x441e02['id']);return getEndUser(_0xb703be,_0x3651fc[_0x2513('0x50')],_0x3651fc[_0x2513('0x51')]);})['then'](function(_0x5ae936){_0x35f6f9=_0x5ae936;logger[_0x2513('0xb')]('The\x20Enduser\x20ID\x20is:',_0x35f6f9['id']);return getTicket(_0xb703be,_0x441e02,_0x35f6f9,_0x5dfb67,_0x3651fc);})[_0x2513('0x1c')](function(_0x39d2ee){if(_0x39d2ee&&_0x39d2ee['id']){logger[_0x2513('0xb')]('Ticket\x20created!');logger[_0x2513('0xb')]('The\x20Ticket\x20ID\x20is:',_0x39d2ee['id']);logger[_0x2513('0xb')](_0x2513('0x52'),_0x2513('0x49'));emit(util['format'](_0x2513('0x53'),_0x5bb292['name']),'trigger:browser:url',{'uri':util[_0x2513('0xc')](_0x2513('0x54'),_0xb703be[_0x2513('0x1a')],_0x39d2ee['id'])});}})['catch'](function(_0x481075){logger[_0x2513('0x4c')](_0x2513('0x52'),JSON[_0x2513('0x2d')](_0x481075));});};exports[_0x2513('0x55')]=function(_0x48f3a7,_0x127a49,_0xce677d,_0x317e93,_0x53bcf7,_0x1b947a){var _0x4f2b8e,_0x5baed8;_0x1b947a[_0x2513('0x1a')]=intUtil[_0x2513('0x3e')](_0x1b947a[_0x2513('0x1a')]);_0x1b947a['serverUrl']=intUtil[_0x2513('0x3e')](_0x1b947a[_0x2513('0x3f')]);if(_0x53bcf7&&_0x53bcf7[_0x2513('0x40')]){logger['info']('['+_0x127a49['lastevent'][_0x2513('0x56')]()+']','Recording\x20is\x20enabled!');_0x127a49[_0x2513('0x43')]=util[_0x2513('0xc')](_0x2513('0x44'),_0x1b947a[_0x2513('0x3f')],_0x127a49[_0x2513('0x45')],md5(_0x127a49[_0x2513('0x45')]));}else{_0x127a49['recordingURL']='';}headers[_0x2513('0x46')]=getAuth(_0x1b947a);return getUser(_0x1b947a,'')[_0x2513('0x1c')](function(_0x47c382){_0x4f2b8e=_0x47c382;logger['info']('The\x20User\x20ID\x20is:',_0x4f2b8e['id']);return getEndUser(_0x1b947a,_0x127a49[_0x2513('0xe')],_0x127a49['calleridnum']);})[_0x2513('0x1c')](function(_0x4ba95b){_0x5baed8=_0x4ba95b;logger['info'](_0x2513('0x57'),_0x5baed8['id']);return getTicket(_0x1b947a,_0x4f2b8e,_0x5baed8,_0xce677d,_0x127a49);})['then'](function(_0x17332f){if(_0x17332f){logger[_0x2513('0xb')](_0x2513('0x1d'));logger['info'](_0x2513('0x48'),_0x17332f['id']);}})[_0x2513('0x4b')](function(_0x1b0c55){logger[_0x2513('0x4c')]('['+_0x127a49['lastevent'][_0x2513('0x56')]()+']',JSON[_0x2513('0x2d')](_0x1b0c55));});}; \ 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 cdc2247..fb9b07f 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 _0x01ed=['Getting\x20contact\x20list','/api/contacts/view/','contacts','find','work_number','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','outbound','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','inspect','request-promise','md5','util','moment','./util','../../../../config/logger','freshsales','redis','defaults','localhost','GET','headers','Getting\x20admin\x20information','email','adminEmail','info','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','adminId','catch','Getting\x20contacts\x20filter','forEach','name','All\x20Contacts'];(function(_0x57d3f0,_0x17ffdb){var _0x24eed8=function(_0x413544){while(--_0x413544){_0x57d3f0['push'](_0x57d3f0['shift']());}};_0x24eed8(++_0x17ffdb);}(_0x01ed,0x119));var _0xd01e=function(_0x13bfe3,_0x1011a6){_0x13bfe3=_0x13bfe3-0x0;var _0x4a8149=_0x01ed[_0x13bfe3];return _0x4a8149;};'use strict';var _=require('lodash');var rp=require(_0xd01e('0x0'));var md5=require(_0xd01e('0x1'));var util=require(_0xd01e('0x2'));var moment=require(_0xd01e('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0xd01e('0x4'));var config=require('../../../../config/environment');var logger=require(_0xd01e('0x5'))(_0xd01e('0x6'));config[_0xd01e('0x7')]=_[_0xd01e('0x8')](config[_0xd01e('0x7')],{'host':_0xd01e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd01e('0x7')]));function getAdminId(_0x4cad2a,_0x53a1ff,_0x5d3c7d,_0x2d43be){return new Promise(function(_0x4fade0,_0x57d6e9){var _0x62ce43=![];var _0x5c1038={'method':_0xd01e('0xa'),'uri':_0x2d43be+'/api/selector/owners','json':!![]};_0x5c1038[_0xd01e('0xb')]=_0x5d3c7d;logger['info'](_0xd01e('0xc'));return rp(_0x5c1038)['then'](function(_0x5ae223){if(_0x5ae223){var _0x6e9b02=_0x5ae223['users'];var _0x636c3=null;for(_0x636c3=0x0;_0x636c3<_0x6e9b02['length'];_0x636c3++){if(_0x6e9b02[_0x636c3][_0xd01e('0xd')]===_0x4cad2a[_0xd01e('0xe')]){_0x4cad2a['adminId']=_0x6e9b02[_0x636c3]['id'];_0x62ce43=!![];}}if(_0x62ce43){logger[_0xd01e('0xf')]('Admin\x20found:',_0x4cad2a['adminId']);_0x4fade0(_0x4cad2a);}else{_0x57d6e9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x57d6e9({'statusCode':0x194,'message':_0xd01e('0x10')});}})['catch'](function(_0x3eff83){logger[_0xd01e('0x11')]('['+[_0x53a1ff[_0xd01e('0x12')]()]+']',_0x3eff83[_0xd01e('0x13')]);_0x57d6e9(_0x3eff83);});});}function getUser(_0x229c29,_0x574577,_0x457ea6){return function(_0x154e4b){return new Promise(function(_0x1cdb83,_0x449c98){var _0x34a212={'method':_0xd01e('0xa'),'uri':_0x457ea6+_0xd01e('0x14'),'json':!![]};_0x34a212[_0xd01e('0xb')]=_0x574577;logger[_0xd01e('0xf')]('Getting\x20user\x20list');return rp(_0x34a212)[_0xd01e('0x15')](function(_0x5c2dd5){if(_0x5c2dd5){var _0x35ab93=_0x5c2dd5['users'];var _0x3ff83a=![];var _0x2c952f=null;if(_0x154e4b[_0xd01e('0x16')]!==null){logger['info'](_0xd01e('0x17'),_0x154e4b[_0xd01e('0x16')]);_0x154e4b[_0xd01e('0x18')]=_0x154e4b[_0xd01e('0x16')];for(_0x2c952f=0x0;_0x2c952f<_0x35ab93[_0xd01e('0x19')];_0x2c952f++){if(_0x35ab93[_0x2c952f][_0xd01e('0xd')]===_0x154e4b[_0xd01e('0x16')]){_0x3ff83a=!![];_0x154e4b[_0xd01e('0x1a')]=_0x35ab93[_0x2c952f]['id'];logger[_0xd01e('0xf')](_0xd01e('0x1b'),_0x154e4b[_0xd01e('0x1a')]);}}}if(!_0x3ff83a){logger[_0xd01e('0xf')](_0xd01e('0x1c'));_0x154e4b['userEmail']=_0x154e4b[_0xd01e('0xe')];_0x154e4b[_0xd01e('0x1a')]=_0x154e4b[_0xd01e('0x1d')];_0x3ff83a=!![];}if(_0x3ff83a){_0x1cdb83(_0x154e4b);}else{_0x449c98({'statusCode':0x194,'message':_0xd01e('0x10')});}}else{_0x449c98({'statusCode':0x194,'message':_0xd01e('0x10')});}})[_0xd01e('0x1e')](function(_0x33aa06){logger[_0xd01e('0x11')]('['+[_0x229c29[_0xd01e('0x12')]()]+']',_0x33aa06['message']);_0x449c98(_0x33aa06);});});};}function getEndUser(_0xdbacbf,_0x4424c5,_0x3198af){return function(_0x2ae386){return new Promise(function(_0x12fb83,_0x50b09d){var _0x424476=0x0;var _0x12d2c4={'method':_0xd01e('0xa'),'uri':_0x3198af+'/api/contacts/filters','json':!![]};_0x12d2c4[_0xd01e('0xb')]=_0x4424c5;logger[_0xd01e('0xf')](_0xd01e('0x1f'));return rp(_0x12d2c4)[_0xd01e('0x15')](function(_0x9dd326){_0x9dd326['filters'][_0xd01e('0x20')](function(_0x2a6219){if(_0x2a6219[_0xd01e('0x21')]===_0xd01e('0x22')){_0x424476=_0x2a6219['id'];}});})[_0xd01e('0x15')](function(){logger[_0xd01e('0xf')](_0xd01e('0x23'));var _0x43ab6a={'method':_0xd01e('0xa'),'uri':_0x3198af+_0xd01e('0x24')+_0x424476,'json':!![]};_0x43ab6a[_0xd01e('0xb')]=_0x4424c5;return rp(_0x43ab6a);})['then'](function(_0x371844){logger[_0xd01e('0xf')]('Searching\x20contact\x20with\x20phone',_0x2ae386['contactNumber']);if(_0x371844[_0xd01e('0x25')][_0xd01e('0x19')]>0x0){var _0x13719a=_[_0xd01e('0x26')](_0x371844['contacts'],function(_0x11c02d){if(_0x11c02d[_0xd01e('0x27')]===_0x2ae386[_0xd01e('0x28')]||_0x11c02d[_0xd01e('0x29')]===_0x2ae386[_0xd01e('0x28')]){return _0x11c02d;}});if(_0x13719a){_0x2ae386[_0xd01e('0x2a')]=_0x13719a['id'];logger[_0xd01e('0xf')](_0xd01e('0x2b'),_0x2ae386[_0xd01e('0x2a')]);_0x12fb83(_0x2ae386);}else{return createEndUser(_0x2ae386,_0xdbacbf,_0x4424c5,_0x3198af)[_0xd01e('0x15')](function(_0x404750){logger[_0xd01e('0xf')]('Contact\x20created:',_0x2ae386[_0xd01e('0x2a')]);_0x12fb83(_0x404750);});}}else{return createEndUser(_0x2ae386,_0xdbacbf,_0x4424c5,_0x3198af)[_0xd01e('0x15')](function(_0x76a6fd){logger[_0xd01e('0xf')](_0xd01e('0x2c'),_0x2ae386[_0xd01e('0x2a')]);_0x12fb83(_0x76a6fd);});}})[_0xd01e('0x1e')](function(_0x321803){throw new Error(_0x321803[_0xd01e('0x13')]);});});};}function createEndUser(_0x48448d,_0x184b47,_0x11def3,_0x3278c1){return new Promise(function(_0x4bba54,_0x4206ab){var _0x484bb9=moment();var _0x30d9f4={'method':_0xd01e('0x2d'),'uri':_0x3278c1+_0xd01e('0x2e'),'body':{'contact':{'last_name':_0x48448d['contactNumber'],'work_number':_0x48448d[_0xd01e('0x28')],'mobile_number':_0x48448d[_0xd01e('0x28')],'owner_id':_0x48448d[_0xd01e('0x1a')],'created_at':_0x484bb9[_0xd01e('0x2f')](_0xd01e('0x30'))}},'json':!![]};_0x30d9f4[_0xd01e('0xb')]=_0x11def3;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x30d9f4)[_0xd01e('0x15')](function(_0x18dfc3){_0x48448d[_0xd01e('0x2a')]=_0x18dfc3['contact']['id'];_0x4bba54(_0x48448d);})[_0xd01e('0x1e')](function(_0x2383f1){logger[_0xd01e('0x11')]('['+[_0x184b47[_0xd01e('0x12')]()]+']',_0x2383f1[_0xd01e('0x13')]);_0x4206ab(_0x2383f1[_0xd01e('0x13')]);});});}function getTicket(_0x1614e5,_0x44e3ff,_0x5e831e,_0x5c3b65,_0x42f777){return function(_0x49009d){logger['info'](_0xd01e('0x31'));return new Promise(function(_0x158734,_0x440996){var _0x8e8eeb=moment();var _0x52a852={'method':'POST','uri':_0x5e831e+_0xd01e('0x32'),'body':{'title':intUtil[_0xd01e('0x33')](_0x5c3b65[_0xd01e('0x34')],_0x42f777,'\x20'),'description':intUtil[_0xd01e('0x33')](_0x5c3b65[_0xd01e('0x35')],_0x42f777,'\x0a'),'owner_id':_0x49009d['userId'],'creater_id':_0x49009d['adminId'],'targetable_id':_0x49009d[_0xd01e('0x2a')],'targetable_type':'Contact','created_at':_0x8e8eeb['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x8e8eeb[_0xd01e('0x36')](0x1e,'m')[_0xd01e('0x2f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x52a852[_0xd01e('0xb')]=_0x44e3ff;return rp(_0x52a852)['then'](function(_0x1eca1a){_0x49009d[_0xd01e('0x37')]=_0x1eca1a[_0xd01e('0x38')]['id'];logger[_0xd01e('0xf')]('Task\x20created:',_0x49009d[_0xd01e('0x37')]);_0x158734(_0x49009d);})[_0xd01e('0x1e')](function(_0x569dc9){logger['error']('['+[_0x1614e5[_0xd01e('0x12')]()]+']',_0x569dc9['message']);_0x440996(_0x569dc9[_0xd01e('0x13')]);});});};}function emit(_0x2f5bdc,_0x53f9ff,_0x3b4af4){var _0x3077ac={'uri':_0x2f5bdc+_0xd01e('0x39')+_0x3b4af4};io['to'](util['format']('user:%s',_0x53f9ff))['emit'](_0xd01e('0x3a'),_0x3077ac);}exports['cs']=function(_0x1bc8c3,_0x5a69e8,_0xab2e7c,_0x908305,_0x4d0a6a,_0x35cca6,_0x4dd25a,_0xa1989c){var _0x3fb072={};var _0x306f37={'Authorization':_0xd01e('0x3b')+_0x35cca6[_0xd01e('0x3c')]};_0x35cca6[_0xd01e('0x3d')]=intUtil['stripTrailingSlash'](_0x35cca6['remoteUri']);_0x35cca6[_0xd01e('0x3e')]=intUtil[_0xd01e('0x3f')](_0x35cca6[_0xd01e('0x3e')]);var _0xed29d6=_0x35cca6[_0xd01e('0x3d')];_0x3fb072[_0xd01e('0xe')]=_0x35cca6[_0xd01e('0x40')];_0x3fb072[_0xd01e('0x28')]=_0xa1989c['toLowerCase']()===_0xd01e('0x41')?_0x5a69e8['destcalleridnum']:_0x5a69e8['calleridnum'];_0x3fb072[_0xd01e('0x42')]=_0xa1989c===_0xd01e('0x43')||_0xa1989c===_0xd01e('0x44')?_0xd01e('0x43'):_0xd01e('0x41');if(_0x908305){_0x3fb072['agentEmail']=_0x908305[_0xd01e('0xd')];}var _0x42d8c7=util[_0xd01e('0x2f')](_0xd01e('0x45'),_0x35cca6[_0xd01e('0x3e')],_0x5a69e8[_0xd01e('0x46')],md5(_0x5a69e8['uniqueid']));if(_0x4d0a6a&&_0x4d0a6a['monitor_format']){logger[_0xd01e('0xf')](_0xd01e('0x47'),_0xd01e('0x48'));_0x5a69e8['recordingURL']=_0x42d8c7;}else if(_0x4dd25a&&_0x4dd25a['recordingFormat']&&_0x4dd25a[_0xd01e('0x49')]!==_0xd01e('0x4a')){logger['info'](_0xd01e('0x4b'),_0xd01e('0x48'));_0x5a69e8[_0xd01e('0x4c')]=_0x42d8c7;}else{_0x5a69e8[_0xd01e('0x4c')]='';}return getAdminId(_0x3fb072,_0xa1989c,_0x306f37,_0xed29d6)['then'](getUser(_0xa1989c,_0x306f37,_0xed29d6))[_0xd01e('0x15')](getEndUser(_0xa1989c,_0x306f37,_0xed29d6))['then'](getTicket(_0xa1989c,_0x306f37,_0xed29d6,_0xab2e7c,_0x5a69e8))['then'](function(_0x453ba7){logger['info'](util[_0xd01e('0x2f')](_0xd01e('0x4d'),_0x453ba7[_0xd01e('0x37')]));if(_0xa1989c!==_0xd01e('0x44')){logger[_0xd01e('0xf')]('['+[_0xa1989c['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0xed29d6,_0x908305['name'],_0x453ba7['endUserId']);}})[_0xd01e('0x1e')](function(_0x4099d6){logger[_0xd01e('0x11')]('['+[_0xa1989c[_0xd01e('0x12')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xd01e('0x4e')](_0x4099d6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbb65=['Contact\x20created:','/api/contacts','format','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','task','ticketId','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','destcalleridnum','calleridnum','callDirection','unmanaged','queue','outbound','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','info','then','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','message','/api/selector/owners','headers','Getting\x20user\x20with\x20email','agentEmail','userEmail','length','email','Admin\x20selected','adminEmail','userId','catch','error','toUpperCase','/api/contacts/filters','filters','forEach','name','/api/contacts/view/','contactNumber','find','contacts','work_number','mobile_number','endUserId'];(function(_0x2cf891,_0x54171b){var _0x307493=function(_0x4acd75){while(--_0x4acd75){_0x2cf891['push'](_0x2cf891['shift']());}};_0x307493(++_0x54171b);}(_0xbb65,0x118));var _0x5bb6=function(_0x9f2f67,_0x129e57){_0x9f2f67=_0x9f2f67-0x0;var _0x133871=_0xbb65[_0x9f2f67];return _0x133871;};'use strict';var _=require(_0x5bb6('0x0'));var rp=require('request-promise');var md5=require(_0x5bb6('0x1'));var util=require(_0x5bb6('0x2'));var moment=require(_0x5bb6('0x3'));var Promise=require('bluebird');var Redis=require(_0x5bb6('0x4'));var intUtil=require(_0x5bb6('0x5'));var config=require(_0x5bb6('0x6'));var logger=require(_0x5bb6('0x7'))(_0x5bb6('0x8'));config[_0x5bb6('0x9')]=_[_0x5bb6('0xa')](config['redis'],{'host':_0x5bb6('0xb'),'port':0x18eb});var io=require(_0x5bb6('0xc'))(new Redis(config[_0x5bb6('0x9')]));function getAdminId(_0x306fb1,_0x30a2e1,_0x4f68ed,_0x3db437){return new Promise(function(_0x4f6dd6,_0x435510){var _0x262990=![];var _0x5b7df0={'method':_0x5bb6('0xd'),'uri':_0x3db437+'/api/selector/owners','json':!![]};_0x5b7df0['headers']=_0x4f68ed;logger[_0x5bb6('0xe')]('Getting\x20admin\x20information');return rp(_0x5b7df0)[_0x5bb6('0xf')](function(_0xba8d2e){if(_0xba8d2e){var _0x3a451e=_0xba8d2e['users'];var _0x556ca4=null;for(_0x556ca4=0x0;_0x556ca4<_0x3a451e['length'];_0x556ca4++){if(_0x3a451e[_0x556ca4]['email']===_0x306fb1['adminEmail']){_0x306fb1[_0x5bb6('0x10')]=_0x3a451e[_0x556ca4]['id'];_0x262990=!![];}}if(_0x262990){logger[_0x5bb6('0xe')](_0x5bb6('0x11'),_0x306fb1[_0x5bb6('0x10')]);_0x4f6dd6(_0x306fb1);}else{_0x435510({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x435510({'statusCode':0x194,'message':_0x5bb6('0x12')});}})['catch'](function(_0x196ba1){logger['error']('['+[_0x30a2e1['toUpperCase']()]+']',_0x196ba1[_0x5bb6('0x13')]);_0x435510(_0x196ba1);});});}function getUser(_0x35108f,_0x309064,_0x3d611e){return function(_0x53e00d){return new Promise(function(_0x2cc873,_0x42c0b6){var _0x3f5471={'method':'GET','uri':_0x3d611e+_0x5bb6('0x14'),'json':!![]};_0x3f5471[_0x5bb6('0x15')]=_0x309064;logger['info']('Getting\x20user\x20list');return rp(_0x3f5471)[_0x5bb6('0xf')](function(_0xae5e51){if(_0xae5e51){var _0x27d12e=_0xae5e51['users'];var _0xf72486=![];var _0x12d0e6=null;if(_0x53e00d['agentEmail']!==null){logger[_0x5bb6('0xe')](_0x5bb6('0x16'),_0x53e00d[_0x5bb6('0x17')]);_0x53e00d[_0x5bb6('0x18')]=_0x53e00d[_0x5bb6('0x17')];for(_0x12d0e6=0x0;_0x12d0e6<_0x27d12e[_0x5bb6('0x19')];_0x12d0e6++){if(_0x27d12e[_0x12d0e6][_0x5bb6('0x1a')]===_0x53e00d[_0x5bb6('0x17')]){_0xf72486=!![];_0x53e00d['userId']=_0x27d12e[_0x12d0e6]['id'];logger[_0x5bb6('0xe')]('User\x20found:',_0x53e00d['userId']);}}}if(!_0xf72486){logger['info'](_0x5bb6('0x1b'));_0x53e00d['userEmail']=_0x53e00d[_0x5bb6('0x1c')];_0x53e00d[_0x5bb6('0x1d')]=_0x53e00d[_0x5bb6('0x10')];_0xf72486=!![];}if(_0xf72486){_0x2cc873(_0x53e00d);}else{_0x42c0b6({'statusCode':0x194,'message':_0x5bb6('0x12')});}}else{_0x42c0b6({'statusCode':0x194,'message':_0x5bb6('0x12')});}})[_0x5bb6('0x1e')](function(_0x5eb802){logger[_0x5bb6('0x1f')]('['+[_0x35108f[_0x5bb6('0x20')]()]+']',_0x5eb802[_0x5bb6('0x13')]);_0x42c0b6(_0x5eb802);});});};}function getEndUser(_0x36516b,_0x358350,_0x30bc6c){return function(_0x36b99f){return new Promise(function(_0x2d68ee,_0x4fa3f5){var _0x2b9436=0x0;var _0x195adb={'method':_0x5bb6('0xd'),'uri':_0x30bc6c+_0x5bb6('0x21'),'json':!![]};_0x195adb['headers']=_0x358350;logger[_0x5bb6('0xe')]('Getting\x20contacts\x20filter');return rp(_0x195adb)[_0x5bb6('0xf')](function(_0x235eeb){_0x235eeb[_0x5bb6('0x22')][_0x5bb6('0x23')](function(_0x5b5237){if(_0x5b5237[_0x5bb6('0x24')]==='All\x20Contacts'){_0x2b9436=_0x5b5237['id'];}});})['then'](function(){logger[_0x5bb6('0xe')]('Getting\x20contact\x20list');var _0x1ef1f7={'method':_0x5bb6('0xd'),'uri':_0x30bc6c+_0x5bb6('0x25')+_0x2b9436,'json':!![]};_0x1ef1f7[_0x5bb6('0x15')]=_0x358350;return rp(_0x1ef1f7);})[_0x5bb6('0xf')](function(_0x4fc77c){logger[_0x5bb6('0xe')]('Searching\x20contact\x20with\x20phone',_0x36b99f[_0x5bb6('0x26')]);if(_0x4fc77c['contacts'][_0x5bb6('0x19')]>0x0){var _0x1c708b=_[_0x5bb6('0x27')](_0x4fc77c[_0x5bb6('0x28')],function(_0x5e82fa){if(_0x5e82fa[_0x5bb6('0x29')]===_0x36b99f[_0x5bb6('0x26')]||_0x5e82fa[_0x5bb6('0x2a')]===_0x36b99f[_0x5bb6('0x26')]){return _0x5e82fa;}});if(_0x1c708b){_0x36b99f[_0x5bb6('0x2b')]=_0x1c708b['id'];logger[_0x5bb6('0xe')]('Contact\x20found:',_0x36b99f[_0x5bb6('0x2b')]);_0x2d68ee(_0x36b99f);}else{return createEndUser(_0x36b99f,_0x36516b,_0x358350,_0x30bc6c)[_0x5bb6('0xf')](function(_0x4977c3){logger['info'](_0x5bb6('0x2c'),_0x36b99f['endUserId']);_0x2d68ee(_0x4977c3);});}}else{return createEndUser(_0x36b99f,_0x36516b,_0x358350,_0x30bc6c)[_0x5bb6('0xf')](function(_0x8d66c1){logger[_0x5bb6('0xe')](_0x5bb6('0x2c'),_0x36b99f[_0x5bb6('0x2b')]);_0x2d68ee(_0x8d66c1);});}})['catch'](function(_0x140531){throw new Error(_0x140531[_0x5bb6('0x13')]);});});};}function createEndUser(_0x110fef,_0x41a88e,_0xedc4d2,_0x507c67){return new Promise(function(_0x3deeaf,_0x55f6a6){var _0x1e68e1=moment();var _0x105db4={'method':'POST','uri':_0x507c67+_0x5bb6('0x2d'),'body':{'contact':{'last_name':_0x110fef['contactNumber'],'work_number':_0x110fef[_0x5bb6('0x26')],'mobile_number':_0x110fef[_0x5bb6('0x26')],'owner_id':_0x110fef['userId'],'created_at':_0x1e68e1[_0x5bb6('0x2e')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x105db4[_0x5bb6('0x15')]=_0xedc4d2;logger[_0x5bb6('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x105db4)[_0x5bb6('0xf')](function(_0x1c336d){_0x110fef[_0x5bb6('0x2b')]=_0x1c336d['contact']['id'];_0x3deeaf(_0x110fef);})['catch'](function(_0xd59075){logger['error']('['+[_0x41a88e[_0x5bb6('0x20')]()]+']',_0xd59075[_0x5bb6('0x13')]);_0x55f6a6(_0xd59075[_0x5bb6('0x13')]);});});}function getTicket(_0x4ad1c0,_0x2ff449,_0xd87990,_0x426989,_0x17fc7a){return function(_0x51d0fa){logger[_0x5bb6('0xe')](_0x5bb6('0x2f'));return new Promise(function(_0x1fa8a3,_0x20c74b){var _0x1f77d5=moment();var _0x6d091a={'method':_0x5bb6('0x30'),'uri':_0xd87990+_0x5bb6('0x31'),'body':{'title':intUtil[_0x5bb6('0x32')](_0x426989[_0x5bb6('0x33')],_0x17fc7a,'\x20'),'description':intUtil[_0x5bb6('0x32')](_0x426989[_0x5bb6('0x34')],_0x17fc7a,'\x0a'),'owner_id':_0x51d0fa[_0x5bb6('0x1d')],'creater_id':_0x51d0fa[_0x5bb6('0x10')],'targetable_id':_0x51d0fa[_0x5bb6('0x2b')],'targetable_type':_0x5bb6('0x35'),'created_at':_0x1f77d5[_0x5bb6('0x2e')](_0x5bb6('0x36')),'due_date':_0x1f77d5[_0x5bb6('0x37')](0x1e,'m')[_0x5bb6('0x2e')](_0x5bb6('0x36'))},'json':!![]};_0x6d091a[_0x5bb6('0x15')]=_0x2ff449;return rp(_0x6d091a)['then'](function(_0x357f77){_0x51d0fa['ticketId']=_0x357f77[_0x5bb6('0x38')]['id'];logger[_0x5bb6('0xe')]('Task\x20created:',_0x51d0fa[_0x5bb6('0x39')]);_0x1fa8a3(_0x51d0fa);})['catch'](function(_0x355cc9){logger['error']('['+[_0x4ad1c0[_0x5bb6('0x20')]()]+']',_0x355cc9[_0x5bb6('0x13')]);_0x20c74b(_0x355cc9[_0x5bb6('0x13')]);});});};}function emit(_0x377dd9,_0x510f6f,_0x58a847){var _0x469378={'uri':_0x377dd9+_0x5bb6('0x3a')+_0x58a847};io['to'](util[_0x5bb6('0x2e')]('user:%s',_0x510f6f))['emit'](_0x5bb6('0x3b'),_0x469378);}exports['cs']=function(_0x53aa76,_0x45bc9b,_0x43dd0d,_0x11e138,_0x21a9f3,_0x3f1b3e,_0x32aef5,_0x3f73f2){var _0x155a57={};var _0x15b20c={'Authorization':_0x5bb6('0x3c')+_0x3f1b3e[_0x5bb6('0x3d')]};_0x3f1b3e[_0x5bb6('0x3e')]=intUtil[_0x5bb6('0x3f')](_0x3f1b3e[_0x5bb6('0x3e')]);_0x3f1b3e['serverUrl']=intUtil[_0x5bb6('0x3f')](_0x3f1b3e[_0x5bb6('0x40')]);var _0x3097cf=_0x3f1b3e[_0x5bb6('0x3e')];_0x155a57[_0x5bb6('0x1c')]=_0x3f1b3e['username'];_0x155a57[_0x5bb6('0x26')]=_0x3f73f2['toLowerCase']()==='outbound'?_0x45bc9b[_0x5bb6('0x41')]:_0x45bc9b[_0x5bb6('0x42')];_0x155a57[_0x5bb6('0x43')]=_0x3f73f2==='queue'||_0x3f73f2===_0x5bb6('0x44')?_0x5bb6('0x45'):_0x5bb6('0x46');if(_0x11e138){_0x155a57['agentEmail']=_0x11e138[_0x5bb6('0x1a')];}var _0x11be75=util[_0x5bb6('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f1b3e[_0x5bb6('0x40')],_0x45bc9b['uniqueid'],md5(_0x45bc9b['uniqueid']));if(_0x21a9f3&&_0x21a9f3[_0x5bb6('0x47')]){logger['info'](_0x5bb6('0x48'),_0x5bb6('0x49'));_0x45bc9b[_0x5bb6('0x4a')]=_0x11be75;}else if(_0x32aef5&&_0x32aef5[_0x5bb6('0x4b')]&&_0x32aef5['recordingFormat']!=='none'){logger['info'](_0x5bb6('0x4c'),_0x5bb6('0x49'));_0x45bc9b[_0x5bb6('0x4a')]=_0x11be75;}else{_0x45bc9b['recordingURL']='';}return getAdminId(_0x155a57,_0x3f73f2,_0x15b20c,_0x3097cf)[_0x5bb6('0xf')](getUser(_0x3f73f2,_0x15b20c,_0x3097cf))[_0x5bb6('0xf')](getEndUser(_0x3f73f2,_0x15b20c,_0x3097cf))['then'](getTicket(_0x3f73f2,_0x15b20c,_0x3097cf,_0x43dd0d,_0x45bc9b))['then'](function(_0x23d9c6){logger[_0x5bb6('0xe')](util[_0x5bb6('0x2e')](_0x5bb6('0x4d'),_0x23d9c6[_0x5bb6('0x39')]));if(_0x3f73f2!==_0x5bb6('0x44')){logger[_0x5bb6('0xe')]('['+[_0x3f73f2[_0x5bb6('0x20')]()]+']',_0x5bb6('0x4e'));emit(_0x3097cf,_0x11e138[_0x5bb6('0x24')],_0x23d9c6[_0x5bb6('0x2b')]);}})[_0x5bb6('0x1e')](function(_0x149481){logger[_0x5bb6('0x1f')]('['+[_0x3f73f2['toUpperCase']()]+_0x5bb6('0x4f'),util[_0x5bb6('0x50')](_0x149481,{'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 e1b773c..88137b2 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 _0x8952=['log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','data3','queue','routeId','outbound'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8952,0x17e));var _0x2895=function(_0x45fd9d,_0xdb5fe1){_0x45fd9d=_0x45fd9d-0x0;var _0x541ea0=_0x8952[_0x45fd9d];return _0x541ea0;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var zendesk=require(_0x2895('0x1'));var salesforce=require(_0x2895('0x2'));var sugarcrm=require(_0x2895('0x3'));var freshdesk=require(_0x2895('0x4'));var zoho=require('./zoho');var desk=require(_0x2895('0x5'));var vtiger=require(_0x2895('0x6'));var servicenow=require(_0x2895('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x2895('0x8'));var integrations=[_0x2895('0x9'),_0x2895('0xa'),'sugarcrm','freshdesk',_0x2895('0xb'),_0x2895('0xc'),_0x2895('0xd'),_0x2895('0xe'),_0x2895('0xf'),'servicenow'];exports[_0x2895('0x10')]=function(_0x5f2632,_0x428772,_0x5af454,_0x5e66fc,_0x56c5b9,_0x9bb58c){if(_0x5af454){if(_[_0x2895('0x11')](integrations,_0x5f2632[_0x2895('0x12')]['toLowerCase']())){try{var _0x981298=null;var _0x3924be='';var _0x4b1342=_0x5af454[_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()];if(_0x4b1342){var _0x5abb23=_0x4b1342[_0x5f2632['data2']];if(_0x5abb23){var _0x1d1493=_[_0x2895('0x14')](_0x5abb23['Configurations'],{'id':parseInt(_0x5f2632[_0x2895('0x15')],0xa)});if(_0x1d1493){if(_0x5e66fc){if(_0x56c5b9&&_0x428772[_0x2895('0x16')]){_0x3924be=_0x2895('0x16');}else if(_0x428772[_0x2895('0x17')]){_0x3924be=_0x2895('0x18');}else{console[_0x2895('0x19')](_0x2895('0x1a'),_0x428772);}}else{_0x3924be=_0x2895('0x1b');}switch(_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()){case _0x2895('0x9'):zendesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xa'):salesforce[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1c'):sugarcrm[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1d'):freshdesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xb'):zoho[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xc'):desk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xd'):vtiger[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xf'):freshsales['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'servicenow':servicenow['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'dynamics365':dynamics365['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;default:console['log'](_0x2895('0x1e'));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632[_0x2895('0x12')]['toLowerCase']());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util[_0x2895('0x22')](_0x2895('0x23'),_0x5f2632[_0x2895('0x12')]['toLowerCase'](),_0x5f2632[_0x2895('0x15')]));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632['data1'][_0x2895('0x13')]());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x5f2632[_0x2895('0x12')][_0x2895('0x13')](),_0x5f2632[_0x2895('0x24')]));}}else{}}catch(_0x4a21cf){console[_0x2895('0x20')](_0x4a21cf);}}}}; \ No newline at end of file +var _0xf4f4=['EVENT\x20UNKNOWN','unmanaged','dynamics365','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data2','lodash','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales','servicenow','exec','data1','toLowerCase','find','Configurations','data3','queue'];(function(_0x41fcb7,_0x2bfa89){var _0x3c3d16=function(_0x2e1b45){while(--_0x2e1b45){_0x41fcb7['push'](_0x41fcb7['shift']());}};_0x3c3d16(++_0x2bfa89);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5d823a,_0x630d5e){_0x5d823a=_0x5d823a-0x0;var _0x2debf2=_0xf4f4[_0x5d823a];return _0x2debf2;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x4f4f('0x2'));var sugarcrm=require(_0x4f4f('0x3'));var freshdesk=require(_0x4f4f('0x4'));var zoho=require(_0x4f4f('0x5'));var desk=require(_0x4f4f('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x4f4f('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x4f4f('0x8'));var integrations=[_0x4f4f('0x9'),_0x4f4f('0xa'),_0x4f4f('0xb'),_0x4f4f('0xc'),_0x4f4f('0xd'),_0x4f4f('0xe'),_0x4f4f('0xf'),'dynamics365',_0x4f4f('0x10'),_0x4f4f('0x11')];exports[_0x4f4f('0x12')]=function(_0x2d86d1,_0x116f22,_0x11940f,_0x87a9a2,_0x7a0036,_0x49b9cf){if(_0x11940f){if(_['includes'](integrations,_0x2d86d1[_0x4f4f('0x13')][_0x4f4f('0x14')]())){try{var _0x35ee87=null;var _0x1b54b0='';var _0x282031=_0x11940f[_0x2d86d1[_0x4f4f('0x13')]['toLowerCase']()];if(_0x282031){var _0xe3d8ec=_0x282031[_0x2d86d1['data2']];if(_0xe3d8ec){var _0x216ba8=_[_0x4f4f('0x15')](_0xe3d8ec[_0x4f4f('0x16')],{'id':parseInt(_0x2d86d1[_0x4f4f('0x17')],0xa)});if(_0x216ba8){if(_0x87a9a2){if(_0x7a0036&&_0x116f22['queue']){_0x1b54b0=_0x4f4f('0x18');}else if(_0x116f22['routeId']){_0x1b54b0='outbound';}else{console['log'](_0x4f4f('0x19'),_0x116f22);}}else{_0x1b54b0=_0x4f4f('0x1a');}switch(_0x2d86d1[_0x4f4f('0x13')][_0x4f4f('0x14')]()){case _0x4f4f('0x9'):zendesk[_0x1b54b0](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf);break;case _0x4f4f('0xa'):salesforce[_0x1b54b0](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf);break;case _0x4f4f('0xb'):sugarcrm[_0x1b54b0](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf);break;case _0x4f4f('0xc'):freshdesk[_0x1b54b0](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf);break;case _0x4f4f('0xd'):zoho[_0x1b54b0](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf);break;case _0x4f4f('0xe'):desk[_0x1b54b0](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf);break;case _0x4f4f('0xf'):vtiger[_0x1b54b0](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf);break;case _0x4f4f('0x10'):freshsales['cs'](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf,_0x1b54b0);break;case'servicenow':servicenow['cs'](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf,_0x1b54b0);break;case _0x4f4f('0x1b'):dynamics365['cs'](_0x2d86d1,_0x116f22,_0x216ba8,_0x87a9a2,_0x7a0036,_0xe3d8ec,_0x49b9cf,_0x1b54b0);break;default:console[_0x4f4f('0x1c')](_0x4f4f('0x1d'));}}else{_0x35ee87=require(_0x4f4f('0x1e'))(_0x2d86d1[_0x4f4f('0x13')][_0x4f4f('0x14')]());_0x35ee87[_0x4f4f('0x1f')](_0x4f4f('0x20'),util[_0x4f4f('0x21')](_0x4f4f('0x22'),_0x2d86d1[_0x4f4f('0x13')][_0x4f4f('0x14')](),_0x2d86d1[_0x4f4f('0x17')]));}}else{_0x35ee87=require(_0x4f4f('0x1e'))(_0x2d86d1['data1']['toLowerCase']());_0x35ee87['error'](_0x4f4f('0x20'),util[_0x4f4f('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x2d86d1[_0x4f4f('0x13')][_0x4f4f('0x14')](),_0x2d86d1[_0x4f4f('0x23')]));}}else{}}catch(_0x2ec92a){console[_0x4f4f('0x1f')](_0x2ec92a);}}}}; \ 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 18d1f7d..3fee072 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 _0xfd9c=['recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','stringify','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','ticketType','assign','getString','Subjects','Descriptions','Case','sobject','create','isNil','validateEmail','find','execute','then','length','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact','Lead','Contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','toLowerCase','name','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','queue','serverUrl','monitor_format'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xfd9c,0xf9));var _0xcfd9=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0xfd9c[_0x2c6810];return _0x213881;};'use strict';var _=require(_0xcfd9('0x0'));var rp=require(_0xcfd9('0x1'));var moment=require(_0xcfd9('0x2'));var BPromise=require(_0xcfd9('0x3'));var md5=require(_0xcfd9('0x4'));var jsforce=require(_0xcfd9('0x5'));var util=require(_0xcfd9('0x6'));var Redis=require(_0xcfd9('0x7'));var intUtil=require(_0xcfd9('0x8'));var config=require(_0xcfd9('0x9'));var logger=require(_0xcfd9('0xa'))(_0xcfd9('0xb'));config[_0xcfd9('0xc')]=_['defaults'](config['redis'],{'host':_0xcfd9('0xd'),'port':0x18eb});var io=require(_0xcfd9('0xe'))(new Redis(config[_0xcfd9('0xc')]));function emit(_0x49a6c5,_0x4dda1b,_0x1f68fb){io['to'](_0x49a6c5)[_0xcfd9('0xf')](_0x4dda1b,_0x1f68fb);}function getTicket(_0x3853cd,_0x51def6,_0x58da9b,_0x5ebbc8,_0x4fbdda,_0x517dc7,_0x5cda5f,_0x474f43){var _0x10f2b0={};if(_0x5ebbc8[_0xcfd9('0x10')]==='Task'){_0x10f2b0=Object[_0xcfd9('0x11')]({},{'OwnerId':_0x51def6['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xcfd9('0x12')](_0x5ebbc8[_0xcfd9('0x13')],_0x4fbdda,'\x20'),'Description':intUtil[_0xcfd9('0x12')](_0x5ebbc8[_0xcfd9('0x14')],_0x4fbdda,'\x0a')},getCustomFields(_0x517dc7,_0x4fbdda));if(_0x58da9b){_0x10f2b0['WhoId']=_0x58da9b['id'];}}else if(_0x5ebbc8[_0xcfd9('0x10')]===_0xcfd9('0x15')){_0x10f2b0=Object['assign']({},{'OwnerId':_0x51def6['id'],'Subject':intUtil[_0xcfd9('0x12')](_0x5ebbc8[_0xcfd9('0x13')],_0x4fbdda,'\x20'),'Description':intUtil['getString'](_0x5ebbc8[_0xcfd9('0x14')],_0x4fbdda,'\x0a')},getCustomFields(_0x517dc7,_0x4fbdda));if(_0x58da9b){_0x10f2b0['ContactId']=_0x58da9b['id'];}}return _0x5cda5f[_0xcfd9('0x16')](_0x5ebbc8[_0xcfd9('0x10')])[_0xcfd9('0x17')](_0x10f2b0);}function getUser(_0x5eb33f,_0x5d902a,_0x145be1){if(!_[_0xcfd9('0x18')](_0x5d902a)&&intUtil[_0xcfd9('0x19')](_0x5d902a)){var _0x40ca6d={'Email':_0x5d902a};var _0x2a0988={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x145be1[_0xcfd9('0x16')]('User')[_0xcfd9('0x1a')](_0x40ca6d,_0x2a0988)[_0xcfd9('0x1b')]()[_0xcfd9('0x1c')](function(_0x3a5340){if(_0x3a5340[_0xcfd9('0x1d')]){var _0x27401d=_[_0xcfd9('0x1a')](_0x3a5340,function(_0xaaa946){return _0xaaa946['Email']===_0x5d902a;});if(_0x27401d){logger[_0xcfd9('0x1e')](_0xcfd9('0x1f'),_0x5d902a);return BPromise[_0xcfd9('0x20')]({'id':_0x27401d['Id'],'name':_0x27401d[_0xcfd9('0x21')]});}}else{logger['info'](_0xcfd9('0x22'),_0x5d902a);return _0x145be1[_0xcfd9('0x23')]()['then'](function(_0x56545c){return BPromise[_0xcfd9('0x20')]({'id':_0x56545c[_0xcfd9('0x24')],'name':_0x56545c[_0xcfd9('0x25')]});});}});}else{logger['info'](_0xcfd9('0x22'),_0x5d902a);return _0x145be1[_0xcfd9('0x23')]()[_0xcfd9('0x1c')](function(_0x51f8ab){return BPromise[_0xcfd9('0x20')]({'id':_0x51f8ab[_0xcfd9('0x24')],'name':_0x51f8ab[_0xcfd9('0x25')]});});}}function getEndUser(_0x55b31b,_0x39f237,_0x193911,_0x39972c,_0x23254a){var _0x516cbb={'Phone':_0x39972c};var _0x35647a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xcfd9('0x20')]()[_0xcfd9('0x1c')](function(){if(_0x39f237[_0xcfd9('0x10')]===_0xcfd9('0x26')){logger[_0xcfd9('0x1e')](_0xcfd9('0x27'),_0x39972c,_0x39f237[_0xcfd9('0x28')]);switch(_0x39f237[_0xcfd9('0x28')]){case'contact_lead':return _0x23254a['sobject']('Contact')['find'](_0x516cbb,_0x35647a)[_0xcfd9('0x1b')]()[_0xcfd9('0x1c')](function(_0x61f716){if(_0x61f716&&_0x61f716[_0xcfd9('0x1d')]){return _0x61f716;}else{return _0x23254a[_0xcfd9('0x16')]('Lead')[_0xcfd9('0x1a')](_0x516cbb,_0x35647a);}});case _0xcfd9('0x29'):return _0x23254a[_0xcfd9('0x16')]('Contact')[_0xcfd9('0x1a')](_0x516cbb,_0x35647a)[_0xcfd9('0x1b')]();case'lead':return _0x23254a[_0xcfd9('0x16')](_0xcfd9('0x2a'))[_0xcfd9('0x1a')](_0x516cbb,_0x35647a);default:return null;}}else if(_0x39f237['ticketType']===_0xcfd9('0x15')){logger[_0xcfd9('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x39972c,_0xcfd9('0x29'));return _0x23254a[_0xcfd9('0x16')](_0xcfd9('0x2b'))[_0xcfd9('0x1a')](_0x516cbb,_0x35647a)[_0xcfd9('0x1b')]();}})[_0xcfd9('0x1c')](function(_0x115dfa){if(_0x115dfa&&_0x115dfa[_0xcfd9('0x1d')]){var _0x3e0c7f=_[_0xcfd9('0x1a')](_0x115dfa,function(_0x1e88a8){return _0x1e88a8[_0xcfd9('0x2c')]===_0x39972c;});if(_0x3e0c7f){return BPromise[_0xcfd9('0x20')]({'id':_0x3e0c7f['Id'],'name':_0x3e0c7f['Name'],'phone':_0x3e0c7f[_0xcfd9('0x2c')]});}}})[_0xcfd9('0x1c')](function(_0x2642ef){if(_0x2642ef){logger[_0xcfd9('0x1e')](_0xcfd9('0x2d'),_0x39972c);return BPromise[_0xcfd9('0x20')](_0x2642ef);}else{logger['info'](_0xcfd9('0x2e'),_0x39972c);var _0x3fba59={'LastName':_0x193911!==_0xcfd9('0x2f')?_0x193911:util[_0xcfd9('0x30')](_0xcfd9('0x31'),_0x39972c),'Phone':_0x39972c};if(_0x39f237[_0xcfd9('0x32')]){if(_0x39f237[_0xcfd9('0x32')]==='contact'){logger[_0xcfd9('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x39972c,_0x39f237[_0xcfd9('0x32')]);}else if(_0x39f237['moduleCreate']==='lead'&&_0x39f237[_0xcfd9('0x10')]==='Task'){logger[_0xcfd9('0x1e')](_0xcfd9('0x33'),_0x39972c,_0x39f237['moduleCreate']);_0x3fba59[_0xcfd9('0x34')]=_0xcfd9('0x35');}else{return null;}}return _0x23254a['sobject'](_['upperFirst'](_0x39f237[_0xcfd9('0x32')]))[_0xcfd9('0x17')](_0x3fba59);}});}function getCustomFields(_0x993f2d,_0x4443e4){var _0x12c33c={};if(_0x993f2d[_0xcfd9('0x1d')]>0x0){_[_0xcfd9('0x36')](_0x993f2d,function(_0x30b0a7){if(_0x30b0a7[_0xcfd9('0x37')]==='string'&&_0x30b0a7[_0xcfd9('0x38')]){_0x12c33c[_0x30b0a7[_0xcfd9('0x38')]]=_0x30b0a7[_0xcfd9('0x39')][_0xcfd9('0x3a')]();}else if(_0x30b0a7['type']===_0xcfd9('0x3b')&&_0x30b0a7[_0xcfd9('0x3c')]&&_0x30b0a7['idField']){_0x4443e4[_0x30b0a7[_0xcfd9('0x3c')]]&&(_0x12c33c[_0x30b0a7[_0xcfd9('0x38')]]=_0x4443e4[_0x30b0a7[_0xcfd9('0x3c')]]['toString']());}else if(_0x30b0a7[_0xcfd9('0x37')]===_0xcfd9('0x3d')&&_0x30b0a7[_0xcfd9('0x3e')]&&_0x30b0a7[_0xcfd9('0x3e')]['name']&&_0x30b0a7[_0xcfd9('0x38')]){_0x4443e4[_0x30b0a7['Variable']['name'][_0xcfd9('0x3f')]()]&&(_0x12c33c[_0x30b0a7[_0xcfd9('0x38')]]=_0x4443e4[_0x30b0a7[_0xcfd9('0x3e')][_0xcfd9('0x40')][_0xcfd9('0x3f')]()][_0xcfd9('0x3a')]());}});}return _0x12c33c;}function getConnection(_0xa27487){var _0x54fce0=_0xa27487['password'][_0xcfd9('0x41')](_0xa27487['securityToken']);var _0xaf3d6=new jsforce[(_0xcfd9('0x42'))]({'oauth2':{'loginUrl':_0xa27487[_0xcfd9('0x43')]||_0xcfd9('0x44'),'clientId':_0xa27487['clientId'],'clientSecret':_0xa27487[_0xcfd9('0x45')]}});return _0xaf3d6[_0xcfd9('0x46')](_0xa27487[_0xcfd9('0x47')],_0x54fce0)['then'](function(){logger[_0xcfd9('0x1e')]('Connection\x20established.');return _0xaf3d6;});}exports[_0xcfd9('0x48')]=function(_0x3b9b97,_0x1fa165,_0x23f164,_0x488f47,_0x48f745,_0x17cd93){var _0x9f345c,_0xe20761,_0x51b6c3,_0x443e3e;_0x17cd93['serverUrl']=intUtil['stripTrailingSlash'](_0x17cd93[_0xcfd9('0x49')]);_0x17cd93['remoteUri']=intUtil['stripTrailingSlash'](_0x17cd93[_0xcfd9('0x43')]);if(_0x48f745&&_0x48f745[_0xcfd9('0x4a')]){logger[_0xcfd9('0x1e')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1fa165[_0xcfd9('0x4b')]=util['format'](_0xcfd9('0x4c'),_0x17cd93[_0xcfd9('0x49')],_0x1fa165[_0xcfd9('0x4d')],md5(_0x1fa165[_0xcfd9('0x4d')]));}else{_0x1fa165[_0xcfd9('0x4b')]='';}return getConnection(_0x17cd93)[_0xcfd9('0x1c')](function(_0x18ae65){_0x443e3e=_0x18ae65;return getUser(_0x17cd93,_0x488f47[_0xcfd9('0x4e')],_0x443e3e);})['then'](function(_0x391dba){_0x9f345c=_0x391dba;return getEndUser(_0x17cd93,_0x23f164,_0x1fa165[_0xcfd9('0x4f')],_0x1fa165[_0xcfd9('0x50')],_0x443e3e);})[_0xcfd9('0x1c')](function(_0x1ed6cd){_0xe20761=_0x1ed6cd;return getTicket(_0x17cd93,_0x9f345c,_0xe20761,_0x23f164,_0x1fa165,_0x23f164[_0xcfd9('0x51')],_0x443e3e,_0xcfd9('0x48'));})[_0xcfd9('0x1c')](function(_0x1d4498){_0x51b6c3=_0x1d4498;logger[_0xcfd9('0x1e')](_0xcfd9('0x52'),_0x51b6c3['id']);logger[_0xcfd9('0x1e')](_0xcfd9('0x53'),_0x51b6c3['id'],_0x488f47[_0xcfd9('0x40')],_0x17cd93[_0xcfd9('0x37')]);switch(_0x17cd93[_0xcfd9('0x37')]){case'integrationTab':emit(util[_0xcfd9('0x30')](_0xcfd9('0x54'),_0x488f47['name']),_0xcfd9('0x55'),{'recordId':_0x51b6c3['id']});break;case'newTab':emit(util[_0xcfd9('0x30')]('user:%s',_0x488f47[_0xcfd9('0x40')]),'trigger:browser:url',{'uri':util[_0xcfd9('0x30')](_0xcfd9('0x56'),_0x443e3e[_0xcfd9('0x57')],_0x51b6c3['id'])});break;default:logger['error'](_0xcfd9('0x58'));}})[_0xcfd9('0x59')](function(_0x4916e2){logger[_0xcfd9('0x5a')](_0xcfd9('0x5b'),JSON[_0xcfd9('0x5c')](_0x4916e2));});};exports[_0xcfd9('0x5d')]=function(_0x208c00,_0x3087cc,_0xd55698,_0x43bf42,_0x3f9adf,_0x3cafe4,_0x3ef0dc){var _0x6ac127,_0x43edb7,_0x5a9f40,_0x21d4f3;_0x3cafe4['serverUrl']=intUtil[_0xcfd9('0x5e')](_0x3cafe4['serverUrl']);_0x3cafe4[_0xcfd9('0x43')]=intUtil[_0xcfd9('0x5e')](_0x3cafe4['remoteUri']);if(_0x3ef0dc&&_0x3ef0dc[_0xcfd9('0x5f')]&&_0x3ef0dc['recordingFormat']!=='none'){logger[_0xcfd9('0x1e')](_0xcfd9('0x60'),_0xcfd9('0x61'));_0x3087cc[_0xcfd9('0x4b')]=util[_0xcfd9('0x30')](_0xcfd9('0x4c'),_0x3cafe4['serverUrl'],_0x3087cc[_0xcfd9('0x4d')],md5(_0x3087cc[_0xcfd9('0x4d')]));}return getConnection(_0x3cafe4)['then'](function(_0x415acf){_0x21d4f3=_0x415acf;return getUser(_0x3cafe4,_0x43bf42[_0xcfd9('0x4e')],_0x21d4f3);})[_0xcfd9('0x1c')](function(_0xdaaa7b){_0x6ac127=_0xdaaa7b;return getEndUser(_0x3cafe4,_0xd55698,_0x3087cc['destcalleridname'],_0x3087cc['destcalleridnum'],_0x21d4f3);})['then'](function(_0x5e597d){_0x43edb7=_0x5e597d;return getTicket(_0x3cafe4,_0x6ac127,_0x43edb7,_0xd55698,_0x3087cc,_0xd55698['Fields'],_0x21d4f3,_0xcfd9('0x5d'));})[_0xcfd9('0x1c')](function(_0x5e9ec4){_0x5a9f40=_0x5e9ec4;logger[_0xcfd9('0x1e')](_0xcfd9('0x62'),_0x5a9f40['id']);logger[_0xcfd9('0x1e')](_0xcfd9('0x63'),_0x5a9f40['id'],_0x43bf42[_0xcfd9('0x40')],_0x3cafe4[_0xcfd9('0x37')]);switch(_0x3cafe4['type']){case'integrationTab':emit(util[_0xcfd9('0x30')](_0xcfd9('0x54'),_0x43bf42[_0xcfd9('0x40')]),'trigger:salesforce:display',{'recordId':_0x5a9f40['id']});break;case _0xcfd9('0x64'):emit(util[_0xcfd9('0x30')](_0xcfd9('0x54'),_0x43bf42[_0xcfd9('0x40')]),_0xcfd9('0x65'),{'uri':util[_0xcfd9('0x30')](_0xcfd9('0x56'),_0x21d4f3['instanceUrl'],_0x5a9f40['id'])});break;default:logger[_0xcfd9('0x5a')](_0xcfd9('0x60'),_0xcfd9('0x66'));}})[_0xcfd9('0x59')](function(_0x4ca0fc){logger['error'](_0xcfd9('0x60'),JSON[_0xcfd9('0x5c')](_0x4ca0fc));});};exports[_0xcfd9('0x67')]=function(_0x1c7ba5,_0x34e1ed,_0x93404a,_0x22085e,_0x58a9d2,_0x350225){var _0x34d490,_0x1339aa,_0x4d672b,_0x57883e;_0x350225[_0xcfd9('0x49')]=intUtil[_0xcfd9('0x5e')](_0x350225['serverUrl']);_0x350225[_0xcfd9('0x43')]=intUtil[_0xcfd9('0x5e')](_0x350225[_0xcfd9('0x43')]);if(_0x58a9d2&&_0x58a9d2['monitor_format']){logger[_0xcfd9('0x1e')]('['+_0x34e1ed[_0xcfd9('0x68')][_0xcfd9('0x69')]()+']',_0xcfd9('0x61'));_0x34e1ed[_0xcfd9('0x4b')]=util['format'](_0xcfd9('0x4c'),_0x350225[_0xcfd9('0x49')],_0x34e1ed[_0xcfd9('0x4d')],md5(_0x34e1ed[_0xcfd9('0x4d')]));}else{_0x34e1ed[_0xcfd9('0x4b')]='';}return getConnection(_0x350225)[_0xcfd9('0x1c')](function(_0x366a4a){_0x57883e=_0x366a4a;if(!_[_0xcfd9('0x18')](_0x22085e)){return getUser(_0x350225,_0x22085e[_0xcfd9('0x40')],_0x57883e);}else{return getUser(_0x350225,null,_0x57883e);}})[_0xcfd9('0x1c')](function(_0x4930ef){_0x34d490=_0x4930ef;return getEndUser(_0x350225,_0x93404a,_0x34e1ed[_0xcfd9('0x4f')],_0x34e1ed['calleridnum'],_0x57883e);})[_0xcfd9('0x1c')](function(_0x21d573){_0x1339aa=_0x21d573;return getTicket(_0x350225,_0x34d490,_0x1339aa,_0x93404a,_0x34e1ed,_0x93404a[_0xcfd9('0x51')],_0x57883e);})[_0xcfd9('0x1c')](function(_0x536779){_0x4d672b=_0x536779;logger[_0xcfd9('0x1e')]('['+_0x34e1ed[_0xcfd9('0x68')]['toUpperCase']()+_0xcfd9('0x6a'),_0x4d672b['id']);logger['info']('['+_0x34e1ed[_0xcfd9('0x68')][_0xcfd9('0x69')]()+_0xcfd9('0x6b'),_0x350225[_0xcfd9('0x37')]);})['catch'](function(_0x128cd0){logger[_0xcfd9('0x5a')]('['+_0x34e1ed[_0xcfd9('0x68')][_0xcfd9('0x69')]()+']',JSON['stringify'](_0x128cd0));});}; \ No newline at end of file +var _0x3d63=['find','execute','length','Email','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','Contact','Lead','lead','Case','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','format','uniqueid','recordingURL','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','stringify','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','Task','assign','utc','getString','Subjects','WhoId','Descriptions','ContactId','create','sobject','User'];(function(_0x51e347,_0x1b565a){var _0x49ab46=function(_0x5962cf){while(--_0x5962cf){_0x51e347['push'](_0x51e347['shift']());}};_0x49ab46(++_0x1b565a);}(_0x3d63,0x12e));var _0x33d6=function(_0x555bfc,_0x56437a){_0x555bfc=_0x555bfc-0x0;var _0x1fda5e=_0x3d63[_0x555bfc];return _0x1fda5e;};'use strict';var _=require(_0x33d6('0x0'));var rp=require(_0x33d6('0x1'));var moment=require(_0x33d6('0x2'));var BPromise=require('bluebird');var md5=require(_0x33d6('0x3'));var jsforce=require(_0x33d6('0x4'));var util=require(_0x33d6('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x33d6('0x6'));var logger=require(_0x33d6('0x7'))(_0x33d6('0x8'));config[_0x33d6('0x9')]=_[_0x33d6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x33d6('0xb'))(new Redis(config[_0x33d6('0x9')]));function emit(_0x14e870,_0x366d94,_0x521e74){io['to'](_0x14e870)[_0x33d6('0xc')](_0x366d94,_0x521e74);}function getTicket(_0x486c9e,_0x58c588,_0x167cda,_0x23de4e,_0x2ca1d9,_0x1b2b45,_0x2fbb28,_0x4dd90c){var _0x2b2f71={};if(_0x23de4e[_0x33d6('0xd')]===_0x33d6('0xe')){_0x2b2f71=Object[_0x33d6('0xf')]({},{'OwnerId':_0x58c588['id'],'ActivityDate':moment[_0x33d6('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x33d6('0x11')](_0x23de4e[_0x33d6('0x12')],_0x2ca1d9,'\x20'),'Description':intUtil['getString'](_0x23de4e['Descriptions'],_0x2ca1d9,'\x0a')},getCustomFields(_0x1b2b45,_0x2ca1d9));if(_0x167cda){_0x2b2f71[_0x33d6('0x13')]=_0x167cda['id'];}}else if(_0x23de4e['ticketType']==='Case'){_0x2b2f71=Object['assign']({},{'OwnerId':_0x58c588['id'],'Subject':intUtil['getString'](_0x23de4e[_0x33d6('0x12')],_0x2ca1d9,'\x20'),'Description':intUtil[_0x33d6('0x11')](_0x23de4e[_0x33d6('0x14')],_0x2ca1d9,'\x0a')},getCustomFields(_0x1b2b45,_0x2ca1d9));if(_0x167cda){_0x2b2f71[_0x33d6('0x15')]=_0x167cda['id'];}}return _0x2fbb28['sobject'](_0x23de4e[_0x33d6('0xd')])[_0x33d6('0x16')](_0x2b2f71);}function getUser(_0x383004,_0x254ac4,_0x55d91c){if(!_['isNil'](_0x254ac4)&&intUtil['validateEmail'](_0x254ac4)){var _0x1633ee={'Email':_0x254ac4};var _0x2a39e3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x55d91c[_0x33d6('0x17')](_0x33d6('0x18'))[_0x33d6('0x19')](_0x1633ee,_0x2a39e3)[_0x33d6('0x1a')]()['then'](function(_0x2a23a4){if(_0x2a23a4[_0x33d6('0x1b')]){var _0x250f2f=_[_0x33d6('0x19')](_0x2a23a4,function(_0x3654f9){return _0x3654f9[_0x33d6('0x1c')]===_0x254ac4;});if(_0x250f2f){logger['info']('Agent\x20%s\x20found.',_0x254ac4);return BPromise[_0x33d6('0x1d')]({'id':_0x250f2f['Id'],'name':_0x250f2f[_0x33d6('0x1e')]});}}else{logger[_0x33d6('0x1f')](_0x33d6('0x20'),_0x254ac4);return _0x55d91c[_0x33d6('0x21')]()[_0x33d6('0x22')](function(_0x56bf72){return BPromise[_0x33d6('0x1d')]({'id':_0x56bf72[_0x33d6('0x23')],'name':_0x56bf72[_0x33d6('0x24')]});});}});}else{logger[_0x33d6('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x254ac4);return _0x55d91c[_0x33d6('0x21')]()[_0x33d6('0x22')](function(_0x474efa){return BPromise[_0x33d6('0x1d')]({'id':_0x474efa[_0x33d6('0x23')],'name':_0x474efa[_0x33d6('0x24')]});});}}function getEndUser(_0x3d6eab,_0x326d39,_0x389e38,_0x47ded2,_0x2ebd37){var _0x44fa74={'Phone':_0x47ded2};var _0x442af2={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x33d6('0x1d')]()[_0x33d6('0x22')](function(){if(_0x326d39['ticketType']===_0x33d6('0xe')){logger[_0x33d6('0x1f')](_0x33d6('0x25'),_0x47ded2,_0x326d39['moduleSearch']);switch(_0x326d39['moduleSearch']){case _0x33d6('0x26'):return _0x2ebd37[_0x33d6('0x17')](_0x33d6('0x27'))['find'](_0x44fa74,_0x442af2)[_0x33d6('0x1a')]()[_0x33d6('0x22')](function(_0x3402f7){if(_0x3402f7&&_0x3402f7[_0x33d6('0x1b')]){return _0x3402f7;}else{return _0x2ebd37[_0x33d6('0x17')](_0x33d6('0x28'))['find'](_0x44fa74,_0x442af2);}});case'contact':return _0x2ebd37[_0x33d6('0x17')]('Contact')[_0x33d6('0x19')](_0x44fa74,_0x442af2)[_0x33d6('0x1a')]();case _0x33d6('0x29'):return _0x2ebd37[_0x33d6('0x17')](_0x33d6('0x28'))[_0x33d6('0x19')](_0x44fa74,_0x442af2);default:return null;}}else if(_0x326d39[_0x33d6('0xd')]===_0x33d6('0x2a')){logger[_0x33d6('0x1f')](_0x33d6('0x25'),_0x47ded2,_0x33d6('0x2b'));return _0x2ebd37[_0x33d6('0x17')]('Contact')[_0x33d6('0x19')](_0x44fa74,_0x442af2)['execute']();}})[_0x33d6('0x22')](function(_0x2f8e09){if(_0x2f8e09&&_0x2f8e09[_0x33d6('0x1b')]){var _0x1a79f0=_[_0x33d6('0x19')](_0x2f8e09,function(_0x3e0f3e){return _0x3e0f3e[_0x33d6('0x2c')]===_0x47ded2;});if(_0x1a79f0){return BPromise[_0x33d6('0x1d')]({'id':_0x1a79f0['Id'],'name':_0x1a79f0[_0x33d6('0x1e')],'phone':_0x1a79f0[_0x33d6('0x2c')]});}}})['then'](function(_0x18a20d){if(_0x18a20d){logger['info'](_0x33d6('0x2d'),_0x47ded2);return BPromise[_0x33d6('0x1d')](_0x18a20d);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x47ded2);var _0x1ebab3={'LastName':_0x389e38!==_0x33d6('0x2e')?_0x389e38:util['format'](_0x33d6('0x2f'),_0x47ded2),'Phone':_0x47ded2};if(_0x326d39[_0x33d6('0x30')]){if(_0x326d39[_0x33d6('0x30')]===_0x33d6('0x2b')){logger[_0x33d6('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x47ded2,_0x326d39[_0x33d6('0x30')]);}else if(_0x326d39[_0x33d6('0x30')]===_0x33d6('0x29')&&_0x326d39[_0x33d6('0xd')]===_0x33d6('0xe')){logger[_0x33d6('0x1f')](_0x33d6('0x31'),_0x47ded2,_0x326d39[_0x33d6('0x30')]);_0x1ebab3['Company']=_0x33d6('0x32');}else{return null;}}return _0x2ebd37[_0x33d6('0x17')](_[_0x33d6('0x33')](_0x326d39[_0x33d6('0x30')]))['create'](_0x1ebab3);}});}function getCustomFields(_0x476262,_0x33fea3){var _0x2a9fd4={};if(_0x476262[_0x33d6('0x1b')]>0x0){_[_0x33d6('0x34')](_0x476262,function(_0x445a04){if(_0x445a04[_0x33d6('0x35')]===_0x33d6('0x36')&&_0x445a04[_0x33d6('0x37')]){_0x2a9fd4[_0x445a04[_0x33d6('0x37')]]=_0x445a04[_0x33d6('0x38')]['toString']();}else if(_0x445a04[_0x33d6('0x35')]===_0x33d6('0x39')&&_0x445a04['variableName']&&_0x445a04[_0x33d6('0x37')]){_0x33fea3[_0x445a04['variableName']]&&(_0x2a9fd4[_0x445a04[_0x33d6('0x37')]]=_0x33fea3[_0x445a04[_0x33d6('0x3a')]][_0x33d6('0x3b')]());}else if(_0x445a04['type']===_0x33d6('0x3c')&&_0x445a04[_0x33d6('0x3d')]&&_0x445a04[_0x33d6('0x3d')][_0x33d6('0x3e')]&&_0x445a04[_0x33d6('0x37')]){_0x33fea3[_0x445a04['Variable'][_0x33d6('0x3e')][_0x33d6('0x3f')]()]&&(_0x2a9fd4[_0x445a04[_0x33d6('0x37')]]=_0x33fea3[_0x445a04[_0x33d6('0x3d')][_0x33d6('0x3e')][_0x33d6('0x3f')]()][_0x33d6('0x3b')]());}});}return _0x2a9fd4;}function getConnection(_0x5cfcdf){var _0x54d627=_0x5cfcdf[_0x33d6('0x40')][_0x33d6('0x41')](_0x5cfcdf['securityToken']);var _0x560283=new jsforce[(_0x33d6('0x42'))]({'oauth2':{'loginUrl':_0x5cfcdf[_0x33d6('0x43')]||'https://login.salesforce.com','clientId':_0x5cfcdf['clientId'],'clientSecret':_0x5cfcdf[_0x33d6('0x44')]}});return _0x560283[_0x33d6('0x45')](_0x5cfcdf[_0x33d6('0x46')],_0x54d627)[_0x33d6('0x22')](function(){logger[_0x33d6('0x1f')](_0x33d6('0x47'));return _0x560283;});}exports[_0x33d6('0x48')]=function(_0x41cae5,_0x1250a2,_0x15b24b,_0x18248a,_0x1135f3,_0x175f56){var _0x11047a,_0x26914c,_0x2e2d60,_0x1afa83;_0x175f56[_0x33d6('0x49')]=intUtil[_0x33d6('0x4a')](_0x175f56[_0x33d6('0x49')]);_0x175f56[_0x33d6('0x43')]=intUtil[_0x33d6('0x4a')](_0x175f56[_0x33d6('0x43')]);if(_0x1135f3&&_0x1135f3[_0x33d6('0x4b')]){logger['info'](_0x33d6('0x4c'),_0x33d6('0x4d'));_0x1250a2['recordingURL']=util[_0x33d6('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x175f56['serverUrl'],_0x1250a2[_0x33d6('0x4f')],md5(_0x1250a2[_0x33d6('0x4f')]));}else{_0x1250a2[_0x33d6('0x50')]='';}return getConnection(_0x175f56)[_0x33d6('0x22')](function(_0x9188e8){_0x1afa83=_0x9188e8;return getUser(_0x175f56,_0x18248a[_0x33d6('0x51')],_0x1afa83);})['then'](function(_0x43d927){_0x11047a=_0x43d927;return getEndUser(_0x175f56,_0x15b24b,_0x1250a2['calleridname'],_0x1250a2['calleridnum'],_0x1afa83);})[_0x33d6('0x22')](function(_0x412e79){_0x26914c=_0x412e79;return getTicket(_0x175f56,_0x11047a,_0x26914c,_0x15b24b,_0x1250a2,_0x15b24b[_0x33d6('0x52')],_0x1afa83,_0x33d6('0x48'));})[_0x33d6('0x22')](function(_0x59c2a2){_0x2e2d60=_0x59c2a2;logger[_0x33d6('0x1f')](_0x33d6('0x53'),_0x2e2d60['id']);logger[_0x33d6('0x1f')](_0x33d6('0x54'),_0x2e2d60['id'],_0x18248a[_0x33d6('0x3e')],_0x175f56[_0x33d6('0x35')]);switch(_0x175f56[_0x33d6('0x35')]){case _0x33d6('0x55'):emit(util[_0x33d6('0x4e')](_0x33d6('0x56'),_0x18248a['name']),'trigger:salesforce:display',{'recordId':_0x2e2d60['id']});break;case _0x33d6('0x57'):emit(util['format'](_0x33d6('0x56'),_0x18248a[_0x33d6('0x3e')]),_0x33d6('0x58'),{'uri':util[_0x33d6('0x4e')](_0x33d6('0x59'),_0x1afa83[_0x33d6('0x5a')],_0x2e2d60['id'])});break;default:logger[_0x33d6('0x5b')](_0x33d6('0x5c'));}})['catch'](function(_0x45475c){logger['error'](_0x33d6('0x4c'),JSON[_0x33d6('0x5d')](_0x45475c));});};exports['outbound']=function(_0x989d63,_0x4443e8,_0xec6ec1,_0x1bfd3a,_0x2085d6,_0x13b38a,_0x18ce79){var _0x2a2f92,_0x48619f,_0x3be415,_0x478807;_0x13b38a[_0x33d6('0x49')]=intUtil[_0x33d6('0x4a')](_0x13b38a[_0x33d6('0x49')]);_0x13b38a[_0x33d6('0x43')]=intUtil[_0x33d6('0x4a')](_0x13b38a[_0x33d6('0x43')]);if(_0x18ce79&&_0x18ce79['recordingFormat']&&_0x18ce79['recordingFormat']!=='none'){logger[_0x33d6('0x1f')]('[OUTBOUND]',_0x33d6('0x4d'));_0x4443e8[_0x33d6('0x50')]=util[_0x33d6('0x4e')](_0x33d6('0x5e'),_0x13b38a[_0x33d6('0x49')],_0x4443e8['uniqueid'],md5(_0x4443e8[_0x33d6('0x4f')]));}return getConnection(_0x13b38a)[_0x33d6('0x22')](function(_0x178b98){_0x478807=_0x178b98;return getUser(_0x13b38a,_0x1bfd3a[_0x33d6('0x51')],_0x478807);})[_0x33d6('0x22')](function(_0x249c28){_0x2a2f92=_0x249c28;return getEndUser(_0x13b38a,_0xec6ec1,_0x4443e8['destcalleridname'],_0x4443e8[_0x33d6('0x5f')],_0x478807);})[_0x33d6('0x22')](function(_0x4f994c){_0x48619f=_0x4f994c;return getTicket(_0x13b38a,_0x2a2f92,_0x48619f,_0xec6ec1,_0x4443e8,_0xec6ec1[_0x33d6('0x52')],_0x478807,_0x33d6('0x60'));})['then'](function(_0x2d64c4){_0x3be415=_0x2d64c4;logger[_0x33d6('0x1f')](_0x33d6('0x61'),_0x3be415['id']);logger['info'](_0x33d6('0x62'),_0x3be415['id'],_0x1bfd3a[_0x33d6('0x3e')],_0x13b38a[_0x33d6('0x35')]);switch(_0x13b38a[_0x33d6('0x35')]){case _0x33d6('0x55'):emit(util[_0x33d6('0x4e')](_0x33d6('0x56'),_0x1bfd3a['name']),_0x33d6('0x63'),{'recordId':_0x3be415['id']});break;case _0x33d6('0x57'):emit(util[_0x33d6('0x4e')](_0x33d6('0x56'),_0x1bfd3a[_0x33d6('0x3e')]),'trigger:browser:url',{'uri':util[_0x33d6('0x4e')](_0x33d6('0x59'),_0x478807[_0x33d6('0x5a')],_0x3be415['id'])});break;default:logger[_0x33d6('0x5b')]('[OUTBOUND]',_0x33d6('0x64'));}})[_0x33d6('0x65')](function(_0x3d72e4){logger['error']('[OUTBOUND]',JSON[_0x33d6('0x5d')](_0x3d72e4));});};exports[_0x33d6('0x66')]=function(_0x173ee9,_0x31e8c6,_0x172369,_0x402550,_0xdf25ff,_0x4bfeb5){var _0xe679a,_0x1b1fdf,_0x502661,_0xd273cf;_0x4bfeb5[_0x33d6('0x49')]=intUtil[_0x33d6('0x4a')](_0x4bfeb5[_0x33d6('0x49')]);_0x4bfeb5[_0x33d6('0x43')]=intUtil[_0x33d6('0x4a')](_0x4bfeb5[_0x33d6('0x43')]);if(_0xdf25ff&&_0xdf25ff[_0x33d6('0x4b')]){logger['info']('['+_0x31e8c6['lastevent'][_0x33d6('0x67')]()+']','Recording\x20is\x20enabled!');_0x31e8c6['recordingURL']=util[_0x33d6('0x4e')](_0x33d6('0x5e'),_0x4bfeb5['serverUrl'],_0x31e8c6[_0x33d6('0x4f')],md5(_0x31e8c6[_0x33d6('0x4f')]));}else{_0x31e8c6[_0x33d6('0x50')]='';}return getConnection(_0x4bfeb5)[_0x33d6('0x22')](function(_0x4cd2d9){_0xd273cf=_0x4cd2d9;if(!_['isNil'](_0x402550)){return getUser(_0x4bfeb5,_0x402550[_0x33d6('0x3e')],_0xd273cf);}else{return getUser(_0x4bfeb5,null,_0xd273cf);}})[_0x33d6('0x22')](function(_0x3298d7){_0xe679a=_0x3298d7;return getEndUser(_0x4bfeb5,_0x172369,_0x31e8c6[_0x33d6('0x68')],_0x31e8c6[_0x33d6('0x69')],_0xd273cf);})[_0x33d6('0x22')](function(_0x350ced){_0x1b1fdf=_0x350ced;return getTicket(_0x4bfeb5,_0xe679a,_0x1b1fdf,_0x172369,_0x31e8c6,_0x172369[_0x33d6('0x52')],_0xd273cf);})[_0x33d6('0x22')](function(_0xf41df3){_0x502661=_0xf41df3;logger[_0x33d6('0x1f')]('['+_0x31e8c6['lastevent'][_0x33d6('0x67')]()+_0x33d6('0x6a'),_0x502661['id']);logger[_0x33d6('0x1f')]('['+_0x31e8c6[_0x33d6('0x6b')][_0x33d6('0x67')]()+_0x33d6('0x6c'),_0x4bfeb5[_0x33d6('0x35')]);})[_0x33d6('0x65')](function(_0x2a8146){logger['error']('['+_0x31e8c6[_0x33d6('0x6b')][_0x33d6('0x67')]()+']',JSON['stringify'](_0x2a8146));});}; \ 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 f7efb6b..c4f283a 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 _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x302e77,_0x12fb1f){var _0x585ebf=function(_0x38203c){while(--_0x38203c){_0x302e77['push'](_0x302e77['shift']());}};_0x585ebf(++_0x12fb1f);}(_0x1261,0x144));var _0x1126=function(_0x3a23d3,_0x4088d8){_0x3a23d3=_0x3a23d3-0x0;var _0x10803b=_0x1261[_0x3a23d3];return _0x10803b;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0xfd5ec6,_0x3c1203){var _0x4c585c=function(_0x1081c2){while(--_0x1081c2){_0xfd5ec6['push'](_0xfd5ec6['shift']());}};_0x4c585c(++_0x3c1203);}(_0x1261,0x144));var _0x1126=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x1261[_0x2d364e];return _0x1b9312;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'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 37f4a86..726d9a9 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 _0xd8fb=['calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','trigger:browser:url','error','[QUEUE]','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','version','%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','user:%s','catch','unmanaged','%s/service/v4_1/rest.php','toUpperCase','lastevent','lodash','request-promise','bluebird','md5','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','direction','forEach','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','length','phone_home','Enduser\x20found!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','map','type','string','nameField','customField','content','custom_fields','push','variable','variableName','customVariable','Variable','toLowerCase','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname'];(function(_0x3aa4b3,_0x464b82){var _0x5b226b=function(_0x116056){while(--_0x116056){_0x3aa4b3['push'](_0x3aa4b3['shift']());}};_0x5b226b(++_0x464b82);}(_0xd8fb,0x99));var _0xbd8f=function(_0x174f51,_0x3345bf){_0x174f51=_0x174f51-0x0;var _0xa7c750=_0xd8fb[_0x174f51];return _0xa7c750;};'use strict';var _=require(_0xbd8f('0x0'));var rp=require(_0xbd8f('0x1'));var BPromise=require(_0xbd8f('0x2'));var md5=require(_0xbd8f('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('sugarcrm');config[_0xbd8f('0x6')]=_[_0xbd8f('0x7')](config['redis'],{'host':_0xbd8f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd8f('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x197827,_0x403edc,_0x493298){io['to'](_0x197827)['emit'](_0x403edc,_0x493298);}function getTicket(_0x3caa93,_0x2393a9,_0x2a55b5,_0x53a2c6,_0x255af3,_0x42ae20,_0x5b834b,_0x4ac253){logger[_0xbd8f('0x9')](_0xbd8f('0xa'));var _0x12dcac=new Date();var _0x5d5705=[{'name':_0xbd8f('0xb'),'value':intUtil[_0xbd8f('0xc')](_0x53a2c6[_0xbd8f('0xd')],_0x255af3,'\x20')},{'name':_0xbd8f('0xe'),'value':_0x2393a9['id']},{'name':_0xbd8f('0xf'),'value':_0x2393a9['id']},{'name':_0xbd8f('0x10'),'value':intUtil[_0xbd8f('0xc')](_0x53a2c6[_0xbd8f('0x11')],_0x255af3,'\x0a')},{'name':_0xbd8f('0x12'),'value':_0x12dcac['toISOString']()[_0xbd8f('0x13')](0x0,0x13)[_0xbd8f('0x14')]('T','\x20')},{'name':_0xbd8f('0x15'),'value':'0'},{'name':_0xbd8f('0x16'),'value':'15'},{'name':'parent_id','value':_0x2a55b5['id']},{'name':_0xbd8f('0x17'),'value':_0xbd8f('0x18')},{'name':'parent_name','value':_0x2a55b5[_0xbd8f('0xb')]},{'name':_0xbd8f('0x19'),'value':_0x4ac253}];if(_0x42ae20['length']){_[_0xbd8f('0x1a')](_0x42ae20,function(_0x36a6af){if(_0x255af3[_0x36a6af['variableName']]){_0x5d5705['push']({'name':_0x36a6af[_0xbd8f('0x1b')],'value':_0x255af3[_0x36a6af['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0xbd8f('0x1c'),'response_type':'JSON','rest_data':JSON[_0xbd8f('0x1d')]({'session':_0x5b834b['id'],'module_name':_0xbd8f('0x1e'),'name_value_list':_0x5d5705})}});}function getAuth(_0xb47c8e){return util[_0xbd8f('0x1f')](_0xbd8f('0x20'),new Buffer(_0xb47c8e[_0xbd8f('0x21')]+':X')[_0xbd8f('0x22')](_0xbd8f('0x23')));}function getServerInfo(_0x2fbe3b){return request({'form':{'method':_0xbd8f('0x24'),'input_type':_0xbd8f('0x1c'),'response_type':_0xbd8f('0x1c'),'rest_data':JSON[_0xbd8f('0x1d')]({'session':_0x2fbe3b['id']})}});}function getUser(_0x15c4a9,_0x320ede,_0xd11ae){if(!_[_0xbd8f('0x25')](_0x320ede)){logger['info'](_0xbd8f('0x26'),_0x320ede);return request({'form':{'method':_0xbd8f('0x27'),'input_type':_0xbd8f('0x1c'),'response_type':_0xbd8f('0x1c'),'rest_data':JSON[_0xbd8f('0x1d')]({'session':_0xd11ae['id'],'module_name':_0xbd8f('0x28'),'query':util[_0xbd8f('0x1f')](_0xbd8f('0x29'),_0x320ede),'order_by':'','offset':'0','select_fields':['id','name',_0xbd8f('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xbd8f('0x2b')](function(_0x5a3a8c){if(_0x5a3a8c[_0xbd8f('0x2c')]['length']){var _0x41b2a6=_[_0xbd8f('0x2d')](_0x5a3a8c[_0xbd8f('0x2c')],function(_0x202126){return _0x202126[_0xbd8f('0x2e')][_0xbd8f('0x2a')]['value']===_0x320ede;});if(_0x41b2a6){logger[_0xbd8f('0x9')](_0xbd8f('0x2f'));return BPromise[_0xbd8f('0x30')]({'id':_0x41b2a6[_0xbd8f('0x2e')]['id'][_0xbd8f('0x31')],'name':_0x41b2a6[_0xbd8f('0x2e')][_0xbd8f('0xb')]['value']});}}logger[_0xbd8f('0x9')](_0xbd8f('0x32'));return BPromise[_0xbd8f('0x30')]({'id':_0xd11ae[_0xbd8f('0x2e')]['user_id']['value'],'name':_0xd11ae[_0xbd8f('0x2e')][_0xbd8f('0x2a')][_0xbd8f('0x31')]});});}else{logger[_0xbd8f('0x9')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xbd8f('0x30')]({'id':_0xd11ae[_0xbd8f('0x2e')][_0xbd8f('0x33')][_0xbd8f('0x31')],'name':_0xd11ae[_0xbd8f('0x2e')]['user_name'][_0xbd8f('0x31')]});}}function getEndUser(_0x407785,_0x383807,_0x3949c2,_0x2df6a6){logger['info'](_0xbd8f('0x34'),_0x3949c2);return request({'form':{'method':'get_entry_list','input_type':_0xbd8f('0x1c'),'response_type':_0xbd8f('0x1c'),'rest_data':JSON[_0xbd8f('0x1d')]({'session':_0x2df6a6['id'],'module_name':_0xbd8f('0x18'),'query':util[_0xbd8f('0x1f')](_0xbd8f('0x35'),_0x3949c2),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x22d1de){if(_0x22d1de[_0xbd8f('0x2c')][_0xbd8f('0x36')]){var _0x1d1c1e=_[_0xbd8f('0x2d')](_0x22d1de[_0xbd8f('0x2c')],function(_0x2f5f59){return _0x2f5f59[_0xbd8f('0x2e')][_0xbd8f('0x37')][_0xbd8f('0x31')]===_0x3949c2;});if(_0x1d1c1e){logger[_0xbd8f('0x9')](_0xbd8f('0x38'));return BPromise[_0xbd8f('0x30')]({'id':_0x1d1c1e[_0xbd8f('0x2e')]['id'][_0xbd8f('0x31')],'name':_0x1d1c1e['name_value_list'][_0xbd8f('0xb')][_0xbd8f('0x31')],'phone':_0x1d1c1e['name_value_list'][_0xbd8f('0x37')][_0xbd8f('0x31')]});}}else{logger[_0xbd8f('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xbd8f('0x39'),'input_type':'JSON','response_type':_0xbd8f('0x1c'),'rest_data':JSON[_0xbd8f('0x1d')]({'session':_0x2df6a6['id'],'module_name':_0xbd8f('0x18'),'name_value_list':[{'name':'first_name','value':_0x383807!==_0xbd8f('0x3a')?_0x383807:util[_0xbd8f('0x1f')](_0xbd8f('0x3b'),_0x3949c2)},{'name':'phone_home','value':_0x3949c2}]})}})[_0xbd8f('0x2b')](function(_0x3d82ef){logger[_0xbd8f('0x9')](_0xbd8f('0x3c'));return BPromise[_0xbd8f('0x30')]({'id':_0x3d82ef['id'],'name':_0x3d82ef[_0xbd8f('0x2c')][_0xbd8f('0x3d')][_0xbd8f('0x31')],'phone':_0x3d82ef[_0xbd8f('0x2c')]['phone_home']['value']});});}});}function request(_0x2907a3){logger[_0xbd8f('0x3e')](_0xbd8f('0x3f'),JSON[_0xbd8f('0x1d')](_0x2907a3));return rp(_['merge'](def,_0x2907a3));}function getTags(_0x23e678,_0x32549c){var _0x111f4b=[];if(_0x23e678&&_0x23e678[_0xbd8f('0x36')]>0x0){_0x111f4b=_[_0xbd8f('0x40')](_0x23e678,_0x32549c);}return _0x111f4b;}function getCustomFields(_0x5b3c10,_0x5346c1){var _0x44776c=[];var _0x490d15={'custom_fields':[]};if(_0x5b3c10[_0xbd8f('0x36')]>0x0){_[_0xbd8f('0x1a')](_0x5b3c10,function(_0xede200){if(_0xede200[_0xbd8f('0x41')]===_0xbd8f('0x42')&&_0xede200[_0xbd8f('0x43')]&&!_0xede200[_0xbd8f('0x44')]){_0x490d15[_0xede200[_0xbd8f('0x43')]['toLowerCase']()]=_0xede200[_0xbd8f('0x45')][_0xbd8f('0x22')]();}else if(_0xede200[_0xbd8f('0x41')]===_0xbd8f('0x42')&&_0xede200[_0xbd8f('0x1b')]&&_0xede200[_0xbd8f('0x44')]){_0x490d15[_0xbd8f('0x46')][_0xbd8f('0x47')]({'id':_0xede200['idField'],'value':_0xede200[_0xbd8f('0x45')][_0xbd8f('0x22')]()});}else if(_0xede200[_0xbd8f('0x41')]===_0xbd8f('0x48')&&_0xede200[_0xbd8f('0x49')]&&_0xede200[_0xbd8f('0x1b')]&&_0xede200[_0xbd8f('0x44')]){_0x5346c1[_0xede200[_0xbd8f('0x49')]]&&_0x490d15[_0xbd8f('0x46')][_0xbd8f('0x47')]({'id':_0xede200[_0xbd8f('0x1b')],'value':_0x5346c1[_0xede200[_0xbd8f('0x49')]][_0xbd8f('0x22')]()});}else if(_0xede200[_0xbd8f('0x41')]===_0xbd8f('0x4a')&&_0xede200[_0xbd8f('0x4b')]&&_0xede200[_0xbd8f('0x4b')][_0xbd8f('0xb')]&&_0xede200[_0xbd8f('0x1b')]&&_0xede200['customField']){_0x5346c1[_0xede200[_0xbd8f('0x4b')][_0xbd8f('0xb')][_0xbd8f('0x4c')]()]&&_0x490d15[_0xbd8f('0x46')]['push']({'id':_0xede200[_0xbd8f('0x1b')],'value':_0x5346c1[_0xede200['Variable'][_0xbd8f('0xb')][_0xbd8f('0x4c')]()][_0xbd8f('0x22')]()});}});}return _0x490d15;}function getConnection(_0x3009e0){return request({'method':'POST','form':{'method':_0xbd8f('0x4d'),'input_type':_0xbd8f('0x1c'),'response_type':_0xbd8f('0x1c'),'rest_data':JSON[_0xbd8f('0x1d')]({'user_auth':{'user_name':_0x3009e0[_0xbd8f('0x4e')],'password':_0x3009e0[_0xbd8f('0x4f')],'encryption':'PLAIN'},'application':_0xbd8f('0x50')})}})['then'](function(_0x294689){var _0x3a6577=_0x294689;if(_0x3a6577['id']){def[_0xbd8f('0x51')]=_0x3a6577['id'];return BPromise[_0xbd8f('0x30')](_0x3a6577);}else{throw new Error(util[_0xbd8f('0x1f')](_0xbd8f('0x52'),_0x3009e0['id']));}});}function setRelationship(_0x2a331d,_0x1b253a,_0x889c5a,_0x4a4247){return request({'form':{'method':_0xbd8f('0x53'),'input_type':'JSON','response_type':_0xbd8f('0x1c'),'rest_data':JSON[_0xbd8f('0x1d')]({'session':_0x2a331d['id'],'module_name':'Calls','module_id':_0x889c5a['id'],'link_field_name':_0x4a4247,'related_ids':[_0x1b253a['id']]})}});}exports[_0xbd8f('0x54')]=function(_0x517c01,_0x58d891,_0x5e924c,_0x55de68,_0x4042e0,_0x3e4e95){var _0xc78753,_0x31df71,_0x2167cb,_0x531f2b;_0x3e4e95['remoteUri']=intUtil[_0xbd8f('0x55')](_0x3e4e95[_0xbd8f('0x56')]);_0x3e4e95[_0xbd8f('0x57')]=intUtil[_0xbd8f('0x55')](_0x3e4e95[_0xbd8f('0x57')]);def['uri']=util[_0xbd8f('0x1f')]('%s/service/v4_1/rest.php',_0x3e4e95[_0xbd8f('0x56')]);if(_0x4042e0&&_0x4042e0[_0xbd8f('0x58')]){logger[_0xbd8f('0x9')]('[QUEUE]',_0xbd8f('0x59'));_0x58d891[_0xbd8f('0x5a')]=util[_0xbd8f('0x1f')](_0xbd8f('0x5b'),_0x3e4e95['serverUrl'],_0x58d891['uniqueid'],md5(_0x58d891[_0xbd8f('0x5c')]));}else{_0x58d891['recordingURL']='';}return getConnection(_0x3e4e95)[_0xbd8f('0x2b')](function(_0x20226c){_0x531f2b=_0x20226c;return getUser(_0x3e4e95,_0x55de68[_0xbd8f('0xb')],_0x531f2b);})[_0xbd8f('0x2b')](function(_0x4a86a9){_0xc78753=_0x4a86a9;logger['info'](_0xbd8f('0x5d'),_0xc78753['id']);return getEndUser(_0x3e4e95,_0x58d891[_0xbd8f('0x5e')],_0x58d891[_0xbd8f('0x5f')],_0x531f2b);})[_0xbd8f('0x2b')](function(_0x5fab2b){_0x31df71=_0x5fab2b;logger[_0xbd8f('0x9')](_0xbd8f('0x60'),_0x31df71['id']);return getTicket(_0x3e4e95,_0xc78753,_0x31df71,_0x5e924c,_0x58d891,_0x5e924c[_0xbd8f('0x61')],_0x531f2b,_0xbd8f('0x62'));})[_0xbd8f('0x2b')](function(_0x2a9c4e){_0x2167cb=_0x2a9c4e;logger['info'](_0xbd8f('0x63'));logger[_0xbd8f('0x9')](_0xbd8f('0x64'),_0x2167cb['id']);return setRelationship(_0x531f2b,_0xc78753,_0x2167cb,_0xbd8f('0x65'));})[_0xbd8f('0x2b')](function(){return setRelationship(_0x531f2b,_0x31df71,_0x2167cb,_0xbd8f('0x66'));})['then'](function(){return getServerInfo(_0x531f2b);})[_0xbd8f('0x2b')](function(_0x469c83){var _0x538fd7=parseInt(_0x469c83['version'][_0xbd8f('0x67')](0x0));var _0x6db322=util[_0xbd8f('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3e4e95['remoteUri'],_0x2167cb['id']);if(_0x538fd7>0x6){_0x6db322=util[_0xbd8f('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3e4e95['remoteUri'],_0x2167cb['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbd8f('0x1f')]('user:%s',_0x55de68[_0xbd8f('0xb')]),_0xbd8f('0x68'),{'uri':_0x6db322});})['catch'](function(_0x1fcb28){logger[_0xbd8f('0x69')](_0xbd8f('0x6a'),JSON[_0xbd8f('0x1d')](_0x1fcb28));});};exports[_0xbd8f('0x6b')]=function(_0x4c976f,_0x583d7a,_0x378e72,_0x44469e,_0x2454b8,_0x296794,_0x1ef686){var _0x105d2d,_0x4e31ba,_0x4eddf2,_0x467b0f;_0x296794[_0xbd8f('0x56')]=intUtil['stripTrailingSlash'](_0x296794[_0xbd8f('0x56')]);_0x296794[_0xbd8f('0x57')]=intUtil['stripTrailingSlash'](_0x296794[_0xbd8f('0x57')]);def[_0xbd8f('0x6c')]=util[_0xbd8f('0x1f')]('%s/service/v4_1/rest.php',_0x296794['remoteUri']);if(_0x1ef686&&_0x1ef686[_0xbd8f('0x6d')]&&_0x1ef686[_0xbd8f('0x6d')]!==_0xbd8f('0x6e')){logger[_0xbd8f('0x9')](_0xbd8f('0x6f'),'Recording\x20is\x20enabled!');_0x583d7a[_0xbd8f('0x5a')]=util[_0xbd8f('0x1f')](_0xbd8f('0x5b'),_0x296794[_0xbd8f('0x57')],_0x583d7a[_0xbd8f('0x5c')],md5(_0x583d7a[_0xbd8f('0x5c')]));}return getConnection(_0x296794)[_0xbd8f('0x2b')](function(_0x265838){_0x467b0f=_0x265838;return getUser(_0x296794,_0x44469e[_0xbd8f('0xb')],_0x467b0f);})[_0xbd8f('0x2b')](function(_0x3d70db){_0x105d2d=_0x3d70db;logger[_0xbd8f('0x9')](_0xbd8f('0x5d'),_0x105d2d['id']);return getEndUser(_0x296794,_0x583d7a[_0xbd8f('0x70')],_0x583d7a[_0xbd8f('0x71')],_0x467b0f);})[_0xbd8f('0x2b')](function(_0x2efb47){_0x4e31ba=_0x2efb47;logger[_0xbd8f('0x9')]('The\x20Enduser\x20ID\x20is:',_0x4e31ba['id']);return getTicket(_0x296794,_0x105d2d,_0x4e31ba,_0x378e72,_0x583d7a,_0x378e72[_0xbd8f('0x61')],_0x467b0f,_0xbd8f('0x72'));})[_0xbd8f('0x2b')](function(_0x85c31){_0x4eddf2=_0x85c31;logger[_0xbd8f('0x9')](_0xbd8f('0x63'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4eddf2['id']);return setRelationship(_0x467b0f,_0x105d2d,_0x4eddf2,_0xbd8f('0x65'));})[_0xbd8f('0x2b')](function(){return setRelationship(_0x467b0f,_0x4e31ba,_0x4eddf2,'contacts');})[_0xbd8f('0x2b')](function(){return getServerInfo(_0x467b0f);})['then'](function(_0x179694){var _0x1ffbeb=parseInt(_0x179694[_0xbd8f('0x73')][_0xbd8f('0x67')](0x0));var _0x5df432=util[_0xbd8f('0x1f')](_0xbd8f('0x74'),_0x296794[_0xbd8f('0x56')],_0x4eddf2['id']);if(_0x1ffbeb>0x6){_0x5df432=util['format'](_0xbd8f('0x75'),_0x296794[_0xbd8f('0x56')],_0x4eddf2['id']);}logger[_0xbd8f('0x9')](_0xbd8f('0x6f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbd8f('0x1f')](_0xbd8f('0x76'),_0x44469e[_0xbd8f('0xb')]),_0xbd8f('0x68'),{'uri':_0x5df432});})[_0xbd8f('0x77')](function(_0x23e962){logger[_0xbd8f('0x69')](_0xbd8f('0x6f'),JSON['stringify'](_0x23e962));});};exports[_0xbd8f('0x78')]=function(_0x5a5f8a,_0x3da31b,_0x4e908d,_0x107f9e,_0x314c0b,_0x5465e5){var _0x3d015f,_0x87191,_0x60cd2b,_0x2ab853;_0x5465e5['remoteUri']=intUtil[_0xbd8f('0x55')](_0x5465e5[_0xbd8f('0x56')]);_0x5465e5[_0xbd8f('0x57')]=intUtil[_0xbd8f('0x55')](_0x5465e5['serverUrl']);def['uri']=util[_0xbd8f('0x1f')](_0xbd8f('0x79'),_0x5465e5[_0xbd8f('0x56')]);if(_0x314c0b&&_0x314c0b[_0xbd8f('0x58')]){logger[_0xbd8f('0x9')]('['+_0x3da31b['lastevent'][_0xbd8f('0x7a')]()+']',_0xbd8f('0x59'));_0x3da31b[_0xbd8f('0x5a')]=util[_0xbd8f('0x1f')](_0xbd8f('0x5b'),_0x5465e5['serverUrl'],_0x3da31b['uniqueid'],md5(_0x3da31b['uniqueid']));}else{_0x3da31b[_0xbd8f('0x5a')]='';}return getConnection(_0x5465e5)['then'](function(_0x535869){_0x2ab853=_0x535869;if(!_['isNil'](_0x107f9e)){return getUser(_0x5465e5,_0x107f9e[_0xbd8f('0xb')],_0x2ab853);}else{return getUser(_0x5465e5,null,_0x2ab853);}})[_0xbd8f('0x2b')](function(_0x36e30f){_0x3d015f=_0x36e30f;logger[_0xbd8f('0x9')](_0xbd8f('0x5d'),_0x3d015f['id']);return getEndUser(_0x5465e5,_0x3da31b[_0xbd8f('0x5e')],_0x3da31b[_0xbd8f('0x5f')],_0x2ab853);})[_0xbd8f('0x2b')](function(_0x4c413e){_0x87191=_0x4c413e;logger[_0xbd8f('0x9')](_0xbd8f('0x60'),_0x87191['id']);return getTicket(_0x5465e5,_0x3d015f,_0x87191,_0x4e908d,_0x3da31b,_0x4e908d[_0xbd8f('0x61')],_0x2ab853,'Inbound');})[_0xbd8f('0x2b')](function(_0xbced1){_0x60cd2b=_0xbced1;logger[_0xbd8f('0x9')](_0xbd8f('0x63'));logger[_0xbd8f('0x9')](_0xbd8f('0x64'),_0x60cd2b['id']);return setRelationship(_0x2ab853,_0x3d015f,_0x60cd2b,_0xbd8f('0x65'));})[_0xbd8f('0x2b')](function(){return setRelationship(_0x2ab853,_0x87191,_0x60cd2b,_0xbd8f('0x66'));})[_0xbd8f('0x2b')](function(){return getServerInfo(_0x2ab853);})['catch'](function(_0xc8332c){logger[_0xbd8f('0x69')]('['+_0x3da31b[_0xbd8f('0x7b')]['toUpperCase']()+']',JSON[_0xbd8f('0x1d')](_0xc8332c));});}; \ No newline at end of file +var _0x90b1=['JSON','stringify','format','apiKey','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','push','toString','variable','customVariable','Variable','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','localhost','socket.io-emitter','redis','POST','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','length','forEach','variableName','idField','set_entry'];(function(_0x8ec76e,_0x193ee7){var _0x29843c=function(_0x2df961){while(--_0x2df961){_0x8ec76e['push'](_0x8ec76e['shift']());}};_0x29843c(++_0x193ee7);}(_0x90b1,0x1bb));var _0x190b=function(_0x4b0878,_0x2114a0){_0x4b0878=_0x4b0878-0x0;var _0x48792f=_0x90b1[_0x4b0878];return _0x48792f;};'use strict';var _=require(_0x190b('0x0'));var rp=require(_0x190b('0x1'));var BPromise=require(_0x190b('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x190b('0x3'));var intUtil=require(_0x190b('0x4'));var config=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('sugarcrm');config['redis']=_['defaults'](config['redis'],{'host':_0x190b('0x7'),'port':0x18eb});var io=require(_0x190b('0x8'))(new Redis(config[_0x190b('0x9')]));var def={'method':_0x190b('0xa'),'json':!![]};function emit(_0x311161,_0x802924,_0x32c30c){io['to'](_0x311161)['emit'](_0x802924,_0x32c30c);}function getTicket(_0x14b93d,_0x186101,_0x163966,_0x33fd04,_0x41b788,_0x409aa3,_0x3e99a3,_0x1da225){logger['info'](_0x190b('0xb'));var _0x5cf995=new Date();var _0x5701ad=[{'name':_0x190b('0xc'),'value':intUtil[_0x190b('0xd')](_0x33fd04[_0x190b('0xe')],_0x41b788,'\x20')},{'name':_0x190b('0xf'),'value':_0x186101['id']},{'name':_0x190b('0x10'),'value':_0x186101['id']},{'name':_0x190b('0x11'),'value':intUtil[_0x190b('0xd')](_0x33fd04[_0x190b('0x12')],_0x41b788,'\x0a')},{'name':_0x190b('0x13'),'value':_0x5cf995[_0x190b('0x14')]()[_0x190b('0x15')](0x0,0x13)[_0x190b('0x16')]('T','\x20')},{'name':_0x190b('0x17'),'value':'0'},{'name':_0x190b('0x18'),'value':'15'},{'name':_0x190b('0x19'),'value':_0x163966['id']},{'name':_0x190b('0x1a'),'value':_0x190b('0x1b')},{'name':'parent_name','value':_0x163966[_0x190b('0xc')]},{'name':'direction','value':_0x1da225}];if(_0x409aa3[_0x190b('0x1c')]){_[_0x190b('0x1d')](_0x409aa3,function(_0x56d07a){if(_0x41b788[_0x56d07a[_0x190b('0x1e')]]){_0x5701ad['push']({'name':_0x56d07a[_0x190b('0x1f')],'value':_0x41b788[_0x56d07a[_0x190b('0x1e')]]});}});}return request({'form':{'method':_0x190b('0x20'),'input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x3e99a3['id'],'module_name':'Calls','name_value_list':_0x5701ad})}});}function getAuth(_0x3ed24c){return util[_0x190b('0x23')]('Basic\x20%s',new Buffer(_0x3ed24c[_0x190b('0x24')]+':X')['toString']('base64'));}function getServerInfo(_0xcd15e5){return request({'form':{'method':_0x190b('0x25'),'input_type':_0x190b('0x21'),'response_type':'JSON','rest_data':JSON[_0x190b('0x22')]({'session':_0xcd15e5['id']})}});}function getUser(_0x2e633e,_0x16e989,_0x292ce3){if(!_[_0x190b('0x26')](_0x16e989)){logger[_0x190b('0x27')](_0x190b('0x28'),_0x16e989);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x292ce3['id'],'module_name':'Employees','query':util['format'](_0x190b('0x29'),_0x16e989),'order_by':'','offset':'0','select_fields':['id','name',_0x190b('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x190b('0x2b')](function(_0x51f8b4){if(_0x51f8b4[_0x190b('0x2c')][_0x190b('0x1c')]){var _0x5c89ab=_[_0x190b('0x2d')](_0x51f8b4[_0x190b('0x2c')],function(_0x359b4a){return _0x359b4a['name_value_list']['user_name'][_0x190b('0x2e')]===_0x16e989;});if(_0x5c89ab){logger['info'](_0x190b('0x2f'));return BPromise[_0x190b('0x30')]({'id':_0x5c89ab['name_value_list']['id'][_0x190b('0x2e')],'name':_0x5c89ab['name_value_list'][_0x190b('0xc')]['value']});}}logger[_0x190b('0x27')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x190b('0x30')]({'id':_0x292ce3[_0x190b('0x31')]['user_id'][_0x190b('0x2e')],'name':_0x292ce3[_0x190b('0x31')][_0x190b('0x2a')][_0x190b('0x2e')]});});}else{logger[_0x190b('0x27')](_0x190b('0x32'));return BPromise[_0x190b('0x30')]({'id':_0x292ce3[_0x190b('0x31')]['user_id']['value'],'name':_0x292ce3[_0x190b('0x31')][_0x190b('0x2a')]['value']});}}function getEndUser(_0x51dea7,_0x2dcd39,_0x3e4dd8,_0x3fbba1){logger[_0x190b('0x27')](_0x190b('0x33'),_0x3e4dd8);return request({'form':{'method':_0x190b('0x34'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x190b('0x22')]({'session':_0x3fbba1['id'],'module_name':_0x190b('0x1b'),'query':util[_0x190b('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3e4dd8),'order_by':'','offset':'0','select_fields':['id',_0x190b('0xc'),_0x190b('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x190b('0x2b')](function(_0x5a9669){if(_0x5a9669[_0x190b('0x2c')]['length']){var _0x4f12db=_[_0x190b('0x2d')](_0x5a9669[_0x190b('0x2c')],function(_0x5dcaa8){return _0x5dcaa8[_0x190b('0x31')][_0x190b('0x35')][_0x190b('0x2e')]===_0x3e4dd8;});if(_0x4f12db){logger['info'](_0x190b('0x36'));return BPromise[_0x190b('0x30')]({'id':_0x4f12db['name_value_list']['id']['value'],'name':_0x4f12db[_0x190b('0x31')]['name'][_0x190b('0x2e')],'phone':_0x4f12db[_0x190b('0x31')][_0x190b('0x35')][_0x190b('0x2e')]});}}else{logger['info'](_0x190b('0x37'));return request({'form':{'method':'set_entry','input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON['stringify']({'session':_0x3fbba1['id'],'module_name':_0x190b('0x1b'),'name_value_list':[{'name':_0x190b('0x38'),'value':_0x2dcd39!==_0x190b('0x39')?_0x2dcd39:util['format'](_0x190b('0x3a'),_0x3e4dd8)},{'name':'phone_home','value':_0x3e4dd8}]})}})['then'](function(_0x554486){logger[_0x190b('0x27')](_0x190b('0x3b'));return BPromise[_0x190b('0x30')]({'id':_0x554486['id'],'name':_0x554486[_0x190b('0x2c')]['first_name']['value'],'phone':_0x554486[_0x190b('0x2c')]['phone_home'][_0x190b('0x2e')]});});}});}function request(_0x3d67f0){logger['debug'](_0x190b('0x3c'),JSON[_0x190b('0x22')](_0x3d67f0));return rp(_[_0x190b('0x3d')](def,_0x3d67f0));}function getTags(_0x47e414,_0x4b6584){var _0x33597b=[];if(_0x47e414&&_0x47e414['length']>0x0){_0x33597b=_[_0x190b('0x3e')](_0x47e414,_0x4b6584);}return _0x33597b;}function getCustomFields(_0x596956,_0x1b8d35){var _0x12c276=[];var _0x1ce1f7={'custom_fields':[]};if(_0x596956['length']>0x0){_[_0x190b('0x1d')](_0x596956,function(_0x58e006){if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x40')&&_0x58e006[_0x190b('0x41')]&&!_0x58e006[_0x190b('0x42')]){_0x1ce1f7[_0x58e006[_0x190b('0x41')][_0x190b('0x43')]()]=_0x58e006[_0x190b('0x44')]['toString']();}else if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x40')&&_0x58e006[_0x190b('0x1f')]&&_0x58e006['customField']){_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006[_0x190b('0x1f')],'value':_0x58e006[_0x190b('0x44')][_0x190b('0x47')]()});}else if(_0x58e006['type']===_0x190b('0x48')&&_0x58e006[_0x190b('0x1e')]&&_0x58e006[_0x190b('0x1f')]&&_0x58e006['customField']){_0x1b8d35[_0x58e006[_0x190b('0x1e')]]&&_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006['idField'],'value':_0x1b8d35[_0x58e006['variableName']][_0x190b('0x47')]()});}else if(_0x58e006[_0x190b('0x3f')]===_0x190b('0x49')&&_0x58e006[_0x190b('0x4a')]&&_0x58e006[_0x190b('0x4a')][_0x190b('0xc')]&&_0x58e006['idField']&&_0x58e006[_0x190b('0x42')]){_0x1b8d35[_0x58e006[_0x190b('0x4a')][_0x190b('0xc')]['toLowerCase']()]&&_0x1ce1f7[_0x190b('0x45')][_0x190b('0x46')]({'id':_0x58e006[_0x190b('0x1f')],'value':_0x1b8d35[_0x58e006['Variable'][_0x190b('0xc')][_0x190b('0x43')]()][_0x190b('0x47')]()});}});}return _0x1ce1f7;}function getConnection(_0x3256c0){return request({'method':_0x190b('0xa'),'form':{'method':_0x190b('0x4b'),'input_type':_0x190b('0x21'),'response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'user_auth':{'user_name':_0x3256c0[_0x190b('0x4c')],'password':_0x3256c0[_0x190b('0x4d')],'encryption':'PLAIN'},'application':_0x190b('0x4e')})}})['then'](function(_0x1141c6){var _0x18f361=_0x1141c6;if(_0x18f361['id']){def['sessionID']=_0x18f361['id'];return BPromise[_0x190b('0x30')](_0x18f361);}else{throw new Error(util[_0x190b('0x23')](_0x190b('0x4f'),_0x3256c0['id']));}});}function setRelationship(_0x347a23,_0x21b1c3,_0x25036d,_0x618748){return request({'form':{'method':_0x190b('0x50'),'input_type':'JSON','response_type':_0x190b('0x21'),'rest_data':JSON[_0x190b('0x22')]({'session':_0x347a23['id'],'module_name':_0x190b('0x51'),'module_id':_0x25036d['id'],'link_field_name':_0x618748,'related_ids':[_0x21b1c3['id']]})}});}exports['queue']=function(_0x447fc4,_0x4b009d,_0x4a3db4,_0x41b16,_0x4008c4,_0x158c54){var _0x150312,_0x38e63f,_0x20314b,_0x1383e5;_0x158c54[_0x190b('0x52')]=intUtil[_0x190b('0x53')](_0x158c54[_0x190b('0x52')]);_0x158c54[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x158c54[_0x190b('0x54')]);def[_0x190b('0x55')]=util['format'](_0x190b('0x56'),_0x158c54[_0x190b('0x52')]);if(_0x4008c4&&_0x4008c4[_0x190b('0x57')]){logger[_0x190b('0x27')]('[QUEUE]','Recording\x20is\x20enabled!');_0x4b009d[_0x190b('0x58')]=util[_0x190b('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x158c54[_0x190b('0x54')],_0x4b009d['uniqueid'],md5(_0x4b009d[_0x190b('0x59')]));}else{_0x4b009d[_0x190b('0x58')]='';}return getConnection(_0x158c54)[_0x190b('0x2b')](function(_0x4d2814){_0x1383e5=_0x4d2814;return getUser(_0x158c54,_0x41b16[_0x190b('0xc')],_0x1383e5);})[_0x190b('0x2b')](function(_0xffe7cb){_0x150312=_0xffe7cb;logger[_0x190b('0x27')](_0x190b('0x5a'),_0x150312['id']);return getEndUser(_0x158c54,_0x4b009d[_0x190b('0x5b')],_0x4b009d[_0x190b('0x5c')],_0x1383e5);})[_0x190b('0x2b')](function(_0x25e2a2){_0x38e63f=_0x25e2a2;logger['info']('The\x20Enduser\x20ID\x20is:',_0x38e63f['id']);return getTicket(_0x158c54,_0x150312,_0x38e63f,_0x4a3db4,_0x4b009d,_0x4a3db4[_0x190b('0x5d')],_0x1383e5,_0x190b('0x5e'));})[_0x190b('0x2b')](function(_0x2a4db8){_0x20314b=_0x2a4db8;logger['info'](_0x190b('0x5f'));logger[_0x190b('0x27')]('The\x20Ticket\x20ID\x20is:',_0x20314b['id']);return setRelationship(_0x1383e5,_0x150312,_0x20314b,_0x190b('0x60'));})[_0x190b('0x2b')](function(){return setRelationship(_0x1383e5,_0x38e63f,_0x20314b,_0x190b('0x61'));})[_0x190b('0x2b')](function(){return getServerInfo(_0x1383e5);})[_0x190b('0x2b')](function(_0x6eeb1e){var _0x8f95e9=parseInt(_0x6eeb1e[_0x190b('0x62')]['charAt'](0x0));var _0x14d1b8=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x158c54[_0x190b('0x52')],_0x20314b['id']);if(_0x8f95e9>0x6){_0x14d1b8=util[_0x190b('0x23')](_0x190b('0x63'),_0x158c54['remoteUri'],_0x20314b['id']);}logger['info'](_0x190b('0x64'),_0x190b('0x65'));emit(util[_0x190b('0x23')](_0x190b('0x66'),_0x41b16[_0x190b('0xc')]),_0x190b('0x67'),{'uri':_0x14d1b8});})[_0x190b('0x68')](function(_0x25ba8d){logger['error'](_0x190b('0x64'),JSON[_0x190b('0x22')](_0x25ba8d));});};exports[_0x190b('0x69')]=function(_0x20b9f0,_0x172f19,_0x5aa9cb,_0x13cda6,_0x3be030,_0x6fe403,_0x4c877e){var _0x5a0493,_0x19103f,_0x33703e,_0x2b0362;_0x6fe403['remoteUri']=intUtil[_0x190b('0x53')](_0x6fe403[_0x190b('0x52')]);_0x6fe403[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x6fe403['serverUrl']);def[_0x190b('0x55')]=util['format'](_0x190b('0x56'),_0x6fe403[_0x190b('0x52')]);if(_0x4c877e&&_0x4c877e[_0x190b('0x6a')]&&_0x4c877e[_0x190b('0x6a')]!=='none'){logger[_0x190b('0x27')]('[OUTBOUND]',_0x190b('0x6b'));_0x172f19['recordingURL']=util['format'](_0x190b('0x6c'),_0x6fe403['serverUrl'],_0x172f19[_0x190b('0x59')],md5(_0x172f19[_0x190b('0x59')]));}return getConnection(_0x6fe403)[_0x190b('0x2b')](function(_0x3b6803){_0x2b0362=_0x3b6803;return getUser(_0x6fe403,_0x13cda6[_0x190b('0xc')],_0x2b0362);})['then'](function(_0x2f9922){_0x5a0493=_0x2f9922;logger[_0x190b('0x27')](_0x190b('0x5a'),_0x5a0493['id']);return getEndUser(_0x6fe403,_0x172f19['destcalleridname'],_0x172f19[_0x190b('0x6d')],_0x2b0362);})[_0x190b('0x2b')](function(_0x5f1e3c){_0x19103f=_0x5f1e3c;logger[_0x190b('0x27')](_0x190b('0x6e'),_0x19103f['id']);return getTicket(_0x6fe403,_0x5a0493,_0x19103f,_0x5aa9cb,_0x172f19,_0x5aa9cb[_0x190b('0x5d')],_0x2b0362,'Outbound');})[_0x190b('0x2b')](function(_0x26be58){_0x33703e=_0x26be58;logger[_0x190b('0x27')](_0x190b('0x5f'));logger['info'](_0x190b('0x6f'),_0x33703e['id']);return setRelationship(_0x2b0362,_0x5a0493,_0x33703e,_0x190b('0x60'));})[_0x190b('0x2b')](function(){return setRelationship(_0x2b0362,_0x19103f,_0x33703e,'contacts');})[_0x190b('0x2b')](function(){return getServerInfo(_0x2b0362);})[_0x190b('0x2b')](function(_0x2d969f){var _0x49bd3b=parseInt(_0x2d969f[_0x190b('0x62')][_0x190b('0x70')](0x0));var _0x71f228=util[_0x190b('0x23')](_0x190b('0x71'),_0x6fe403['remoteUri'],_0x33703e['id']);if(_0x49bd3b>0x6){_0x71f228=util['format'](_0x190b('0x63'),_0x6fe403[_0x190b('0x52')],_0x33703e['id']);}logger['info'](_0x190b('0x72'),_0x190b('0x65'));emit(util['format']('user:%s',_0x13cda6[_0x190b('0xc')]),_0x190b('0x67'),{'uri':_0x71f228});})['catch'](function(_0x5a7c9d){logger[_0x190b('0x73')](_0x190b('0x72'),JSON[_0x190b('0x22')](_0x5a7c9d));});};exports[_0x190b('0x74')]=function(_0x172dbf,_0x47c9c6,_0x5c9258,_0x189779,_0x4813ee,_0x254be3){var _0x82050a,_0x472dea,_0x3c9653,_0x16b41f;_0x254be3[_0x190b('0x52')]=intUtil[_0x190b('0x53')](_0x254be3[_0x190b('0x52')]);_0x254be3[_0x190b('0x54')]=intUtil[_0x190b('0x53')](_0x254be3[_0x190b('0x54')]);def['uri']=util[_0x190b('0x23')](_0x190b('0x56'),_0x254be3[_0x190b('0x52')]);if(_0x4813ee&&_0x4813ee['monitor_format']){logger['info']('['+_0x47c9c6[_0x190b('0x75')][_0x190b('0x76')]()+']','Recording\x20is\x20enabled!');_0x47c9c6[_0x190b('0x58')]=util[_0x190b('0x23')](_0x190b('0x6c'),_0x254be3['serverUrl'],_0x47c9c6[_0x190b('0x59')],md5(_0x47c9c6[_0x190b('0x59')]));}else{_0x47c9c6['recordingURL']='';}return getConnection(_0x254be3)[_0x190b('0x2b')](function(_0x2ba27b){_0x16b41f=_0x2ba27b;if(!_['isNil'](_0x189779)){return getUser(_0x254be3,_0x189779[_0x190b('0xc')],_0x16b41f);}else{return getUser(_0x254be3,null,_0x16b41f);}})['then'](function(_0x48c4d0){_0x82050a=_0x48c4d0;logger['info']('The\x20User\x20ID\x20is:',_0x82050a['id']);return getEndUser(_0x254be3,_0x47c9c6[_0x190b('0x5b')],_0x47c9c6[_0x190b('0x5c')],_0x16b41f);})['then'](function(_0x26e8ce){_0x472dea=_0x26e8ce;logger[_0x190b('0x27')]('The\x20Enduser\x20ID\x20is:',_0x472dea['id']);return getTicket(_0x254be3,_0x82050a,_0x472dea,_0x5c9258,_0x47c9c6,_0x5c9258[_0x190b('0x5d')],_0x16b41f,_0x190b('0x5e'));})[_0x190b('0x2b')](function(_0x9bd5ac){_0x3c9653=_0x9bd5ac;logger[_0x190b('0x27')](_0x190b('0x5f'));logger[_0x190b('0x27')](_0x190b('0x6f'),_0x3c9653['id']);return setRelationship(_0x16b41f,_0x82050a,_0x3c9653,_0x190b('0x60'));})['then'](function(){return setRelationship(_0x16b41f,_0x472dea,_0x3c9653,_0x190b('0x61'));})['then'](function(){return getServerInfo(_0x16b41f);})['catch'](function(_0x2c7328){logger[_0x190b('0x73')]('['+_0x47c9c6[_0x190b('0x75')][_0x190b('0x76')]()+']',JSON[_0x190b('0x22')](_0x2c7328));});}; \ 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 385b875..ff99e10 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 _0xa230=['lastIndexOf','validateEmail','isNil','test','util','length','sortBy','string','content','type','variable','variableName','push','toString','customVariable','name','Variable','toLowerCase','keyValue','key','format','%s:\x20%s','keyType','join','stripTrailingSlash','slice','substring'];(function(_0x2f76d5,_0x50f190){var _0xbbdb42=function(_0x53177b){while(--_0x53177b){_0x2f76d5['push'](_0x2f76d5['shift']());}};_0xbbdb42(++_0x50f190);}(_0xa230,0xa6));var _0x0a23=function(_0x1a73f4,_0x425c6e){_0x1a73f4=_0x1a73f4-0x0;var _0x38d335=_0xa230[_0x1a73f4];return _0x38d335;};'use strict';var _=require('lodash');var util=require(_0x0a23('0x0'));exports['getString']=function(_0x2341da,_0x46f9d8,_0x15d212){var _0x44e2fb=[];if(_0x2341da[_0x0a23('0x1')]>0x0){var _0x37557a=_[_0x0a23('0x2')](_0x2341da,['id']);for(var _0x3f5cf9=0x0;_0x3f5cf9<_0x37557a[_0x0a23('0x1')];_0x3f5cf9++){var _0x4fd79b=_0x37557a[_0x3f5cf9];if(_0x4fd79b['type']===_0x0a23('0x3')){_0x44e2fb['push'](_0x4fd79b[_0x0a23('0x4')]);}else if(_0x4fd79b[_0x0a23('0x5')]===_0x0a23('0x6')&&_0x4fd79b[_0x0a23('0x7')]){_0x46f9d8[_0x4fd79b['variableName']]&&_0x44e2fb[_0x0a23('0x8')](_0x46f9d8[_0x4fd79b[_0x0a23('0x7')]][_0x0a23('0x9')]());}else if(_0x4fd79b[_0x0a23('0x5')]===_0x0a23('0xa')&&_0x4fd79b['Variable']&&_0x4fd79b['Variable'][_0x0a23('0xb')]){_0x46f9d8[_0x4fd79b[_0x0a23('0xc')][_0x0a23('0xb')][_0x0a23('0xd')]()]&&_0x44e2fb['push'](_0x46f9d8[_0x4fd79b[_0x0a23('0xc')]['name'][_0x0a23('0xd')]()][_0x0a23('0x9')]());}else if(_0x4fd79b[_0x0a23('0x5')]===_0x0a23('0xe')){if(_0x4fd79b['keyType']===_0x0a23('0x3')&&_0x4fd79b[_0x0a23('0xf')]){_0x44e2fb[_0x0a23('0x8')](util[_0x0a23('0x10')](_0x0a23('0x11'),_0x4fd79b[_0x0a23('0xf')],_0x4fd79b['keyContent']));}else if(_0x4fd79b['keyType']===_0x0a23('0x6')&&_0x4fd79b[_0x0a23('0x7')]&&_0x4fd79b['key']){_0x46f9d8[_0x4fd79b[_0x0a23('0x7')]]&&_0x44e2fb[_0x0a23('0x8')](util[_0x0a23('0x10')]('%s:\x20%s',_0x4fd79b['key'],_0x46f9d8[_0x4fd79b[_0x0a23('0x7')]]));}else if(_0x4fd79b[_0x0a23('0x12')]===_0x0a23('0xa')&&_0x4fd79b['Variable']&&_0x4fd79b[_0x0a23('0xc')][_0x0a23('0xb')]&&_0x4fd79b[_0x0a23('0xf')]){_0x46f9d8[_0x4fd79b['Variable'][_0x0a23('0xb')][_0x0a23('0xd')]()]&&_0x44e2fb[_0x0a23('0x8')](util['format'](_0x0a23('0x11'),_0x4fd79b['key'],_0x46f9d8[_0x4fd79b[_0x0a23('0xc')]['name'][_0x0a23('0xd')]()]));}}}}return _0x44e2fb[_0x0a23('0x13')](_0x15d212);};exports[_0x0a23('0x14')]=function(_0x1391bc){var _0x277b8=_0x1391bc[_0x0a23('0x15')](-0x1);if(_0x277b8==='/'){_0x1391bc=_0x1391bc[_0x0a23('0x16')](0x0,_0x1391bc[_0x0a23('0x17')](_0x277b8));}return _0x1391bc;};exports[_0x0a23('0x18')]=function(_0x1226aa){if(!_[_0x0a23('0x19')](_0x1226aa)&&_0x1226aa!==''){var _0x210cde=/^(([^<>()\[\]\\.,;:\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 _0x210cde[_0x0a23('0x1a')](String(_0x1226aa)[_0x0a23('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xee2e=['slice','validateEmail','isNil','test','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','format','%s:\x20%s','keyContent','keyType','key','join','stripTrailingSlash'];(function(_0x182b21,_0x342135){var _0x1c1f1f=function(_0x59e18b){while(--_0x59e18b){_0x182b21['push'](_0x182b21['shift']());}};_0x1c1f1f(++_0x342135);}(_0xee2e,0xee));var _0xeee2=function(_0x4b3678,_0x86b404){_0x4b3678=_0x4b3678-0x0;var _0x45175d=_0xee2e[_0x4b3678];return _0x45175d;};'use strict';var _=require('lodash');var util=require(_0xeee2('0x0'));exports[_0xeee2('0x1')]=function(_0x4ee510,_0x239c27,_0x34227c){var _0x15bb3e=[];if(_0x4ee510[_0xeee2('0x2')]>0x0){var _0x25a5a8=_[_0xeee2('0x3')](_0x4ee510,['id']);for(var _0x399be0=0x0;_0x399be0<_0x25a5a8['length'];_0x399be0++){var _0x113d0d=_0x25a5a8[_0x399be0];if(_0x113d0d[_0xeee2('0x4')]===_0xeee2('0x5')){_0x15bb3e[_0xeee2('0x6')](_0x113d0d['content']);}else if(_0x113d0d['type']===_0xeee2('0x7')&&_0x113d0d[_0xeee2('0x8')]){_0x239c27[_0x113d0d[_0xeee2('0x8')]]&&_0x15bb3e[_0xeee2('0x6')](_0x239c27[_0x113d0d[_0xeee2('0x8')]][_0xeee2('0x9')]());}else if(_0x113d0d[_0xeee2('0x4')]===_0xeee2('0xa')&&_0x113d0d[_0xeee2('0xb')]&&_0x113d0d[_0xeee2('0xb')][_0xeee2('0xc')]){_0x239c27[_0x113d0d[_0xeee2('0xb')][_0xeee2('0xc')][_0xeee2('0xd')]()]&&_0x15bb3e[_0xeee2('0x6')](_0x239c27[_0x113d0d[_0xeee2('0xb')][_0xeee2('0xc')]['toLowerCase']()][_0xeee2('0x9')]());}else if(_0x113d0d[_0xeee2('0x4')]===_0xeee2('0xe')){if(_0x113d0d['keyType']===_0xeee2('0x5')&&_0x113d0d['key']){_0x15bb3e[_0xeee2('0x6')](util[_0xeee2('0xf')](_0xeee2('0x10'),_0x113d0d['key'],_0x113d0d[_0xeee2('0x11')]));}else if(_0x113d0d[_0xeee2('0x12')]==='variable'&&_0x113d0d['variableName']&&_0x113d0d[_0xeee2('0x13')]){_0x239c27[_0x113d0d[_0xeee2('0x8')]]&&_0x15bb3e[_0xeee2('0x6')](util[_0xeee2('0xf')](_0xeee2('0x10'),_0x113d0d[_0xeee2('0x13')],_0x239c27[_0x113d0d[_0xeee2('0x8')]]));}else if(_0x113d0d[_0xeee2('0x12')]===_0xeee2('0xa')&&_0x113d0d[_0xeee2('0xb')]&&_0x113d0d[_0xeee2('0xb')][_0xeee2('0xc')]&&_0x113d0d['key']){_0x239c27[_0x113d0d[_0xeee2('0xb')][_0xeee2('0xc')]['toLowerCase']()]&&_0x15bb3e[_0xeee2('0x6')](util[_0xeee2('0xf')](_0xeee2('0x10'),_0x113d0d['key'],_0x239c27[_0x113d0d[_0xeee2('0xb')][_0xeee2('0xc')]['toLowerCase']()]));}}}}return _0x15bb3e[_0xeee2('0x14')](_0x34227c);};exports[_0xeee2('0x15')]=function(_0x3f71d3){var _0x5a85e6=_0x3f71d3[_0xeee2('0x16')](-0x1);if(_0x5a85e6==='/'){_0x3f71d3=_0x3f71d3['substring'](0x0,_0x3f71d3['lastIndexOf'](_0x5a85e6));}return _0x3f71d3;};exports[_0xeee2('0x17')]=function(_0x36a343){if(!_[_0xeee2('0x18')](_0x36a343)&&_0x36a343!==''){var _0x57a413=/^(([^<>()\[\]\\.,;:\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 _0x57a413[_0xeee2('0x19')](String(_0x36a343)['toLowerCase']());}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 7c8ae9c..be93d84 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 _0xc3df=['Descriptions','POST','format','remoteUri','create','username','sessionName','HelpDesk','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','GET','query','Agent\x20found!','result','email1','first_name','last_name','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','%s/webservice.php','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','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','unmanaged','The\x20User\x20ID\x20is:','calleridname','Fields','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','getString','Subjects'];(function(_0x361d50,_0x296918){var _0x294751=function(_0x5aabed){while(--_0x5aabed){_0x361d50['push'](_0x361d50['shift']());}};_0x294751(++_0x296918);}(_0xc3df,0x1e4));var _0xfc3d=function(_0x111e90,_0x246d1b){_0x111e90=_0x111e90-0x0;var _0x36ac16=_0xc3df[_0x111e90];return _0x36ac16;};'use strict';var _=require(_0xfc3d('0x0'));var rp=require(_0xfc3d('0x1'));var BPromise=require(_0xfc3d('0x2'));var md5=require(_0xfc3d('0x3'));var util=require(_0xfc3d('0x4'));var Redis=require(_0xfc3d('0x5'));var intUtil=require(_0xfc3d('0x6'));var config=require(_0xfc3d('0x7'));var logger=require(_0xfc3d('0x8'))(_0xfc3d('0x9'));config[_0xfc3d('0xa')]=_[_0xfc3d('0xb')](config[_0xfc3d('0xa')],{'host':_0xfc3d('0xc'),'port':0x18eb});var io=require(_0xfc3d('0xd'))(new Redis(config[_0xfc3d('0xa')]));function emit(_0x2453dd,_0x13f8b2,_0x51b9b2){io['to'](_0x2453dd)[_0xfc3d('0xe')](_0x13f8b2,_0x51b9b2);}function getCustomFields(_0x5dc399,_0x2bca0d){var _0x5d963d={};if(_0x5dc399[_0xfc3d('0xf')]>0x0){_[_0xfc3d('0x10')](_0x5dc399,function(_0x317890){if(_0x317890[_0xfc3d('0x11')]===_0xfc3d('0x12')&&_0x317890[_0xfc3d('0x13')]){_0x5d963d[_0x317890[_0xfc3d('0x13')]]=_0x317890['content'][_0xfc3d('0x14')]();}else if(_0x317890[_0xfc3d('0x11')]==='variable'&&_0x317890['variableName']&&_0x317890[_0xfc3d('0x13')]&&_0x2bca0d[_0x317890[_0xfc3d('0x15')]]){_0x5d963d[_0x317890[_0xfc3d('0x13')]]=_0x2bca0d[_0x317890['variableName']][_0xfc3d('0x14')]();}else if(_0x317890[_0xfc3d('0x11')]==='customVariable'&&_0x317890[_0xfc3d('0x16')]&&_0x317890[_0xfc3d('0x16')]['name']&&_0x317890[_0xfc3d('0x13')]&&_0x2bca0d[_0x317890[_0xfc3d('0x16')][_0xfc3d('0x17')]['toLowerCase']()]){_0x5d963d[_0x317890[_0xfc3d('0x13')]]=_0x2bca0d[_0x317890[_0xfc3d('0x16')][_0xfc3d('0x17')][_0xfc3d('0x18')]()][_0xfc3d('0x14')]();}});}return _0x5d963d;}function createTicket(_0x5703d9,_0x448f44,_0x28c405,_0x12195e,_0x10c6f1,_0x1ad76a,_0x30e277){logger[_0xfc3d('0x19')](_0xfc3d('0x1a'));var _0x329ef0=_['merge']({'parent_id':'','assigned_user_id':_0x448f44['id'],'ticketpriorities':_0xfc3d('0x1b'),'ticketstatus':_0xfc3d('0x1c'),'ticket_title':intUtil[_0xfc3d('0x1d')](_0x12195e[_0xfc3d('0x1e')],_0x10c6f1,'\x20'),'description':intUtil[_0xfc3d('0x1d')](_0x12195e[_0xfc3d('0x1f')],_0x10c6f1,'\x0a'),'contact_id':_0x28c405['id']},getCustomFields(_0x1ad76a,_0x10c6f1));var _0x93daf7={'method':_0xfc3d('0x20'),'uri':util[_0xfc3d('0x21')]('%s/webservice.php',_0x5703d9[_0xfc3d('0x22')]),'form':{'operation':_0xfc3d('0x23'),'username':_0x5703d9[_0xfc3d('0x24')],'sessionName':_0x30e277[_0xfc3d('0x25')],'elementType':_0xfc3d('0x26'),'element':JSON[_0xfc3d('0x27')](_0x329ef0)},'json':!![]};return request(_0x93daf7)[_0xfc3d('0x28')](function(_0x122c3d){if(_0x122c3d[_0xfc3d('0x29')]){return BPromise[_0xfc3d('0x2a')]({'id':_0x122c3d['result']['id']});}else{throw new Error(util[_0xfc3d('0x21')](_0xfc3d('0x2b'),JSON[_0xfc3d('0x27')](_0x122c3d[_0xfc3d('0x2c')])));}})[_0xfc3d('0x2d')](function(_0x5133b2){var _0x5dcc61=_0x5133b2[_0xfc3d('0x2e')]||0x1f4;logger[_0xfc3d('0x2c')](_0xfc3d('0x2f'),'createTicket',_0x5dcc61,JSON[_0xfc3d('0x27')](_0x5133b2));});}function getUser(_0x2c17e6,_0x5b6122,_0x15959f){if(intUtil['validateEmail'](_0x5b6122)){logger[_0xfc3d('0x19')]('Getting\x20agent\x20with\x20email',_0x5b6122);return request({'method':_0xfc3d('0x30'),'uri':util[_0xfc3d('0x21')]('%s/webservice.php',_0x2c17e6['remoteUri']),'qs':{'operation':_0xfc3d('0x31'),'username':_0x2c17e6['username'],'sessionName':_0x15959f['sessionName'],'query':util[_0xfc3d('0x21')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x5b6122)},'json':!![]})['then'](function(_0x405d75){if(_0x405d75['success']&&_0x405d75['result'][_0xfc3d('0xf')]){logger[_0xfc3d('0x19')](_0xfc3d('0x32'));return BPromise['resolve']({'id':_0x405d75[_0xfc3d('0x33')][0x0]['id'],'email':_0x405d75[_0xfc3d('0x33')][0x0][_0xfc3d('0x34')],'name':_0x405d75['result'][0x0][_0xfc3d('0x35')]+'\x20'+_0x405d75[_0xfc3d('0x33')][_0xfc3d('0x36')]});}else{logger[_0xfc3d('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xfc3d('0x2a')]({'id':_0x15959f[_0xfc3d('0x37')],'email':_0x2c17e6[_0xfc3d('0x24')],'name':_0xfc3d('0x38')});}})[_0xfc3d('0x2d')](function(_0x466334){var _0x30f37e=_0x466334[_0xfc3d('0x2e')]||0x1f4;logger[_0xfc3d('0x2c')](_0xfc3d('0x2f'),_0xfc3d('0x39'),_0x30f37e,JSON['stringify'](_0x466334));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xfc3d('0x2a')]({'id':_0x15959f[_0xfc3d('0x37')],'email':_0x2c17e6['username'],'name':_0xfc3d('0x38')})['catch'](function(_0x582200){var _0x478221=_0x582200['statusCode']||0x1f4;logger[_0xfc3d('0x2c')](_0xfc3d('0x2f'),_0xfc3d('0x39'),_0x478221,JSON['stringify'](_0x582200));});}}function getEndUser(_0x22a746,_0x3951a4,_0x22e6c9,_0x3cadca){logger[_0xfc3d('0x19')](_0xfc3d('0x3a'),_0x22e6c9);return request({'method':'GET','uri':util[_0xfc3d('0x21')](_0xfc3d('0x3b'),_0x22a746[_0xfc3d('0x22')]),'qs':{'operation':_0xfc3d('0x31'),'username':_0x22a746[_0xfc3d('0x24')],'sessionName':_0x3cadca[_0xfc3d('0x25')],'query':util[_0xfc3d('0x21')](_0xfc3d('0x3c'),_0x22e6c9,_0x22e6c9,_0x22e6c9,_0x22e6c9,_0x22e6c9)},'json':!![]})['then'](function(_0x40c992){if(_0x40c992[_0xfc3d('0x29')]&&_0x40c992[_0xfc3d('0x33')]['length']){logger['info'](_0xfc3d('0x3d'));return BPromise[_0xfc3d('0x2a')]({'id':_0x40c992[_0xfc3d('0x33')][0x0]['id'],'name':_0x40c992[_0xfc3d('0x33')][0x0][_0xfc3d('0x3e')]+'\x20'+_0x40c992['result'][0x0][_0xfc3d('0x3f')],'phone':_0x22e6c9});}else{logger[_0xfc3d('0x19')](_0xfc3d('0x40'));return request({'method':_0xfc3d('0x20'),'uri':util['format'](_0xfc3d('0x3b'),_0x22a746[_0xfc3d('0x22')]),'form':{'operation':_0xfc3d('0x23'),'sessionName':_0x3cadca[_0xfc3d('0x25')],'elementType':_0xfc3d('0x41'),'element':JSON['stringify']({'lastname':_0x3951a4,'phone':_0x22e6c9,'assigned_user_id':'\x20'})},'json':!![]})[_0xfc3d('0x28')](function(_0x41a800){logger['info'](_0xfc3d('0x42'));return BPromise[_0xfc3d('0x2a')]({'id':_0x41a800[_0xfc3d('0x33')]['id'],'name':_0x41a800[_0xfc3d('0x33')]['lastname'],'phone':_0x41a800['result'][_0xfc3d('0x43')]});})[_0xfc3d('0x2d')](function(_0x46a02e){var _0x18d6bb=_0x46a02e[_0xfc3d('0x2e')]||0x1f4;logger[_0xfc3d('0x2c')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xfc3d('0x44'),_0x18d6bb,JSON[_0xfc3d('0x27')](_0x46a02e));});}});}function getConnection(_0x45dce2){var _0x3398b0=_0x45dce2[_0xfc3d('0x24')];var _0x4994a0=_0x45dce2[_0xfc3d('0x45')];return request({'method':'GET','uri':util[_0xfc3d('0x21')]('%s/webservice.php',_0x45dce2[_0xfc3d('0x22')]),'qs':{'operation':_0xfc3d('0x46'),'username':_0x3398b0},'json':!![]})[_0xfc3d('0x28')](function(_0x28b62d){if(_0x28b62d[_0xfc3d('0x29')]){return request({'method':_0xfc3d('0x20'),'uri':util[_0xfc3d('0x21')](_0xfc3d('0x3b'),_0x45dce2[_0xfc3d('0x22')]),'form':{'operation':_0xfc3d('0x47'),'username':_0x3398b0,'accessKey':md5(_0x28b62d[_0xfc3d('0x33')]['token']+_0x4994a0)},'json':!![]});}})[_0xfc3d('0x28')](function(_0x5c84a0){if(_0x5c84a0['success']){return BPromise[_0xfc3d('0x2a')](_0x5c84a0['result']);}else{throw new Error(util['format'](_0xfc3d('0x48'),_0x45dce2['id']));}})[_0xfc3d('0x2d')](function(_0x194512){var _0x25a29f=_0x194512[_0xfc3d('0x2e')]||0x1f4;logger[_0xfc3d('0x2c')](_0xfc3d('0x2f'),_0xfc3d('0x49'),_0x25a29f,JSON['stringify'](_0x194512));});}function request(_0x1d8f67){logger[_0xfc3d('0x19')](_0xfc3d('0x4a'),JSON['stringify'](_0x1d8f67));return rp(_0x1d8f67);}exports['queue']=function(_0x4a65d9,_0x3c29c5,_0x51fa31,_0x243f93,_0x4ffa2a,_0x51e495){var _0x23d115,_0x51f6ed,_0x108854,_0x1a34ad;_0x51e495[_0xfc3d('0x22')]=intUtil[_0xfc3d('0x4b')](_0x51e495[_0xfc3d('0x22')]);if(_0x4ffa2a&&_0x4ffa2a['monitor_format']){logger[_0xfc3d('0x19')](_0xfc3d('0x4c'),_0xfc3d('0x4d'));_0x3c29c5[_0xfc3d('0x4e')]=util[_0xfc3d('0x21')](_0xfc3d('0x4f'),_0x51e495[_0xfc3d('0x50')],_0x3c29c5[_0xfc3d('0x51')],md5(_0x3c29c5[_0xfc3d('0x51')]));}else{_0x3c29c5['recordingURL']='';}return getConnection(_0x51e495)['then'](function(_0xc20f4e){_0x1a34ad=_0xc20f4e;return getUser(_0x51e495,_0x243f93[_0xfc3d('0x52')],_0x1a34ad);})['then'](function(_0x2d8e5a){_0x23d115=_0x2d8e5a;logger['info']('The\x20User\x20ID\x20is:',_0x23d115['id']);return getEndUser(_0x51e495,_0x3c29c5['calleridname'],_0x3c29c5[_0xfc3d('0x53')],_0x1a34ad);})[_0xfc3d('0x28')](function(_0x3c891d){_0x51f6ed=_0x3c891d;logger[_0xfc3d('0x19')](_0xfc3d('0x54'),_0x51f6ed['id']);return createTicket(_0x51e495,_0x23d115,_0x51f6ed,_0x51fa31,_0x3c29c5,_0x51fa31['Fields'],_0x1a34ad);})[_0xfc3d('0x28')](function(_0x35a6e4){_0x108854=_0x35a6e4;logger[_0xfc3d('0x19')](_0xfc3d('0x55'));logger['info'](_0xfc3d('0x56'),_0x108854['id']);var _0x8ddcbf=util[_0xfc3d('0x21')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x51e495[_0xfc3d('0x22')],_[_0xfc3d('0x57')](_0x108854['id'],'x')[0x1]);logger[_0xfc3d('0x19')](_0xfc3d('0x4c'),_0xfc3d('0x58'));emit(util[_0xfc3d('0x21')](_0xfc3d('0x59'),_0x243f93['name']),_0xfc3d('0x5a'),{'uri':_0x8ddcbf});})[_0xfc3d('0x2d')](function(_0x16fc88){logger[_0xfc3d('0x2c')]('[QUEUE]',JSON[_0xfc3d('0x27')](_0x16fc88));});};exports[_0xfc3d('0x5b')]=function(_0x2c4f03,_0x265c40,_0x2e6757,_0x421f66,_0x276378,_0x4df622,_0x2ad124){var _0x16e768,_0x25a53c,_0x1bbf0a,_0x24ab2b;_0x4df622[_0xfc3d('0x22')]=intUtil[_0xfc3d('0x4b')](_0x4df622['remoteUri']);_0x4df622[_0xfc3d('0x50')]=intUtil[_0xfc3d('0x4b')](_0x4df622[_0xfc3d('0x50')]);if(_0x2ad124&&_0x2ad124['recordingFormat']&&_0x2ad124[_0xfc3d('0x5c')]!==_0xfc3d('0x5d')){logger[_0xfc3d('0x19')](_0xfc3d('0x5e'),_0xfc3d('0x4d'));_0x265c40['recordingURL']=util[_0xfc3d('0x21')](_0xfc3d('0x4f'),_0x4df622[_0xfc3d('0x50')],_0x265c40[_0xfc3d('0x51')],md5(_0x265c40[_0xfc3d('0x51')]));}return getConnection(_0x4df622)['then'](function(_0x315c02){_0x24ab2b=_0x315c02;return getUser(_0x4df622,_0x421f66[_0xfc3d('0x52')],_0x24ab2b);})[_0xfc3d('0x28')](function(_0x266daf){_0x16e768=_0x266daf;logger[_0xfc3d('0x19')]('The\x20User\x20ID\x20is:',_0x16e768['id']);return getEndUser(_0x4df622,_0x265c40['destcalleridname'],_0x265c40[_0xfc3d('0x5f')],_0x24ab2b);})['then'](function(_0x55dc9a){_0x25a53c=_0x55dc9a;logger[_0xfc3d('0x19')]('The\x20Enduser\x20ID\x20is:',_0x25a53c['id']);return createTicket(_0x4df622,_0x16e768,_0x25a53c,_0x2e6757,_0x265c40,_0x2e6757['Fields'],_0x24ab2b);})[_0xfc3d('0x28')](function(_0x18056e){_0x1bbf0a=_0x18056e;logger[_0xfc3d('0x19')](_0xfc3d('0x55'));logger[_0xfc3d('0x19')](_0xfc3d('0x56'),_0x1bbf0a['id']);var _0xb8dd3a=util[_0xfc3d('0x21')](_0xfc3d('0x60'),_0x4df622[_0xfc3d('0x22')],_[_0xfc3d('0x57')](_0x1bbf0a['id'],'x')[0x1]);logger[_0xfc3d('0x19')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfc3d('0x21')]('user:%s',_0x421f66[_0xfc3d('0x17')]),'trigger:browser:url',{'uri':_0xb8dd3a});})[_0xfc3d('0x2d')](function(_0x359103){logger[_0xfc3d('0x2c')](_0xfc3d('0x5e'),JSON[_0xfc3d('0x27')](_0x359103));});};exports[_0xfc3d('0x61')]=function(_0xefaa5,_0x168de3,_0x3bf1a9,_0x4bbec3,_0x53b81f,_0x32d38d){var _0x3d9bec,_0x251d27,_0x169598,_0x54e511;_0x32d38d['remoteUri']=intUtil[_0xfc3d('0x4b')](_0x32d38d[_0xfc3d('0x22')]);_0x32d38d[_0xfc3d('0x50')]=intUtil[_0xfc3d('0x4b')](_0x32d38d['serverUrl']);if(_0x53b81f&&_0x53b81f['monitor_format']){logger['info']('['+_0x168de3['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x168de3['recordingURL']=util[_0xfc3d('0x21')](_0xfc3d('0x4f'),_0x32d38d[_0xfc3d('0x50')],_0x168de3[_0xfc3d('0x51')],md5(_0x168de3[_0xfc3d('0x51')]));}else{_0x168de3[_0xfc3d('0x4e')]='';}return getConnection(_0x32d38d)[_0xfc3d('0x28')](function(_0x384eb7){_0x54e511=_0x384eb7;return getUser(_0x32d38d,'',_0x54e511);})[_0xfc3d('0x28')](function(_0x98dd0c){_0x3d9bec=_0x98dd0c;logger['info'](_0xfc3d('0x62'),_0x3d9bec['id']);return getEndUser(_0x32d38d,_0x168de3[_0xfc3d('0x63')],_0x168de3[_0xfc3d('0x53')],_0x54e511);})[_0xfc3d('0x28')](function(_0x1aae1d){_0x251d27=_0x1aae1d;logger[_0xfc3d('0x19')](_0xfc3d('0x54'),_0x251d27['id']);return createTicket(_0x32d38d,_0x3d9bec,_0x251d27,_0x3bf1a9,_0x168de3,_0x3bf1a9[_0xfc3d('0x64')],_0x54e511);})[_0xfc3d('0x28')](function(_0x918c4c){_0x169598=_0x918c4c;logger['info'](_0xfc3d('0x55'));logger[_0xfc3d('0x19')](_0xfc3d('0x56'),_0x169598['id']);})[_0xfc3d('0x2d')](function(_0x11d49f){logger[_0xfc3d('0x2c')]('['+_0x168de3[_0xfc3d('0x65')][_0xfc3d('0x66')]()+']',JSON[_0xfc3d('0x27')](_0x11d49f));});}; \ No newline at end of file +var _0xcff2=['The\x20Enduser\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','unmanaged','monitor_format','toUpperCase','lastevent','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','%s/webservice.php','remoteUri','create','HelpDesk','stringify','then','success','resolve','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','result','length','first_name','last_name','userId','username','admin','statusCode','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','[vTiger],\x20%s,\x20%s,\x20%s','Searching\x20end\x20user\x20with\x20phone','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','lastname','phone','accessKey','getchallenge','POST','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum'];(function(_0x2490bc,_0x4b3875){var _0x508924=function(_0x5872d6){while(--_0x5872d6){_0x2490bc['push'](_0x2490bc['shift']());}};_0x508924(++_0x4b3875);}(_0xcff2,0x143));var _0x2cff=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0xcff2[_0x3c5e54];return _0x3ae1f3;};'use strict';var _=require('lodash');var rp=require(_0x2cff('0x0'));var BPromise=require(_0x2cff('0x1'));var md5=require(_0x2cff('0x2'));var util=require(_0x2cff('0x3'));var Redis=require(_0x2cff('0x4'));var intUtil=require(_0x2cff('0x5'));var config=require(_0x2cff('0x6'));var logger=require(_0x2cff('0x7'))(_0x2cff('0x8'));config[_0x2cff('0x9')]=_['defaults'](config[_0x2cff('0x9')],{'host':_0x2cff('0xa'),'port':0x18eb});var io=require(_0x2cff('0xb'))(new Redis(config[_0x2cff('0x9')]));function emit(_0x59d858,_0x2035c0,_0x1c4281){io['to'](_0x59d858)['emit'](_0x2035c0,_0x1c4281);}function getCustomFields(_0x4657a1,_0x4c121f){var _0x13a236={};if(_0x4657a1['length']>0x0){_[_0x2cff('0xc')](_0x4657a1,function(_0x4fb68d){if(_0x4fb68d[_0x2cff('0xd')]===_0x2cff('0xe')&&_0x4fb68d[_0x2cff('0xf')]){_0x13a236[_0x4fb68d['idField']]=_0x4fb68d[_0x2cff('0x10')]['toString']();}else if(_0x4fb68d[_0x2cff('0xd')]===_0x2cff('0x11')&&_0x4fb68d[_0x2cff('0x12')]&&_0x4fb68d['idField']&&_0x4c121f[_0x4fb68d[_0x2cff('0x12')]]){_0x13a236[_0x4fb68d[_0x2cff('0xf')]]=_0x4c121f[_0x4fb68d[_0x2cff('0x12')]][_0x2cff('0x13')]();}else if(_0x4fb68d[_0x2cff('0xd')]===_0x2cff('0x14')&&_0x4fb68d[_0x2cff('0x15')]&&_0x4fb68d[_0x2cff('0x15')][_0x2cff('0x16')]&&_0x4fb68d['idField']&&_0x4c121f[_0x4fb68d[_0x2cff('0x15')]['name'][_0x2cff('0x17')]()]){_0x13a236[_0x4fb68d[_0x2cff('0xf')]]=_0x4c121f[_0x4fb68d[_0x2cff('0x15')][_0x2cff('0x16')][_0x2cff('0x17')]()][_0x2cff('0x13')]();}});}return _0x13a236;}function createTicket(_0x204834,_0xbbdde4,_0x17a7d0,_0x2a3680,_0x5769c0,_0x434d35,_0x22bb50){logger[_0x2cff('0x18')](_0x2cff('0x19'));var _0x4150c9=_[_0x2cff('0x1a')]({'parent_id':'','assigned_user_id':_0xbbdde4['id'],'ticketpriorities':_0x2cff('0x1b'),'ticketstatus':_0x2cff('0x1c'),'ticket_title':intUtil[_0x2cff('0x1d')](_0x2a3680['Subjects'],_0x5769c0,'\x20'),'description':intUtil[_0x2cff('0x1d')](_0x2a3680['Descriptions'],_0x5769c0,'\x0a'),'contact_id':_0x17a7d0['id']},getCustomFields(_0x434d35,_0x5769c0));var _0x43c3eb={'method':'POST','uri':util['format'](_0x2cff('0x1e'),_0x204834[_0x2cff('0x1f')]),'form':{'operation':_0x2cff('0x20'),'username':_0x204834['username'],'sessionName':_0x22bb50['sessionName'],'elementType':_0x2cff('0x21'),'element':JSON[_0x2cff('0x22')](_0x4150c9)},'json':!![]};return request(_0x43c3eb)[_0x2cff('0x23')](function(_0x5926e7){if(_0x5926e7[_0x2cff('0x24')]){return BPromise[_0x2cff('0x25')]({'id':_0x5926e7['result']['id']});}else{throw new Error(util[_0x2cff('0x26')](_0x2cff('0x27'),JSON['stringify'](_0x5926e7[_0x2cff('0x28')])));}})[_0x2cff('0x29')](function(_0x17cfac){var _0x38ac95=_0x17cfac['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x38ac95,JSON[_0x2cff('0x22')](_0x17cfac));});}function getUser(_0x1d9848,_0x5ca655,_0x546c79){if(intUtil[_0x2cff('0x2a')](_0x5ca655)){logger[_0x2cff('0x18')](_0x2cff('0x2b'),_0x5ca655);return request({'method':_0x2cff('0x2c'),'uri':util['format']('%s/webservice.php',_0x1d9848[_0x2cff('0x1f')]),'qs':{'operation':_0x2cff('0x2d'),'username':_0x1d9848['username'],'sessionName':_0x546c79[_0x2cff('0x2e')],'query':util[_0x2cff('0x26')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x5ca655)},'json':!![]})['then'](function(_0x279e50){if(_0x279e50[_0x2cff('0x24')]&&_0x279e50[_0x2cff('0x2f')][_0x2cff('0x30')]){logger['info']('Agent\x20found!');return BPromise[_0x2cff('0x25')]({'id':_0x279e50['result'][0x0]['id'],'email':_0x279e50['result'][0x0]['email1'],'name':_0x279e50['result'][0x0][_0x2cff('0x31')]+'\x20'+_0x279e50[_0x2cff('0x2f')][_0x2cff('0x32')]});}else{logger[_0x2cff('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x2cff('0x25')]({'id':_0x546c79[_0x2cff('0x33')],'email':_0x1d9848[_0x2cff('0x34')],'name':_0x2cff('0x35')});}})[_0x2cff('0x29')](function(_0x5b3ac4){var _0x195997=_0x5b3ac4[_0x2cff('0x36')]||0x1f4;logger[_0x2cff('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x2cff('0x37'),_0x195997,JSON[_0x2cff('0x22')](_0x5b3ac4));});}else{logger['info'](_0x2cff('0x38'));return BPromise[_0x2cff('0x25')]({'id':_0x546c79[_0x2cff('0x33')],'email':_0x1d9848[_0x2cff('0x34')],'name':'admin'})[_0x2cff('0x29')](function(_0x3a7b29){var _0x50cf29=_0x3a7b29[_0x2cff('0x36')]||0x1f4;logger[_0x2cff('0x28')](_0x2cff('0x39'),_0x2cff('0x37'),_0x50cf29,JSON[_0x2cff('0x22')](_0x3a7b29));});}}function getEndUser(_0x4c9ba0,_0x339c3b,_0x4ad196,_0x292ca6){logger[_0x2cff('0x18')](_0x2cff('0x3a'),_0x4ad196);return request({'method':_0x2cff('0x2c'),'uri':util['format'](_0x2cff('0x1e'),_0x4c9ba0['remoteUri']),'qs':{'operation':'query','username':_0x4c9ba0[_0x2cff('0x34')],'sessionName':_0x292ca6[_0x2cff('0x2e')],'query':util[_0x2cff('0x26')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x4ad196,_0x4ad196,_0x4ad196,_0x4ad196,_0x4ad196)},'json':!![]})[_0x2cff('0x23')](function(_0x14020c){if(_0x14020c[_0x2cff('0x24')]&&_0x14020c[_0x2cff('0x2f')][_0x2cff('0x30')]){logger[_0x2cff('0x18')](_0x2cff('0x3b'));return BPromise[_0x2cff('0x25')]({'id':_0x14020c[_0x2cff('0x2f')][0x0]['id'],'name':_0x14020c[_0x2cff('0x2f')][0x0][_0x2cff('0x3c')]+'\x20'+_0x14020c[_0x2cff('0x2f')][0x0]['lastname'],'phone':_0x4ad196});}else{logger[_0x2cff('0x18')](_0x2cff('0x3d'));return request({'method':'POST','uri':util[_0x2cff('0x26')]('%s/webservice.php',_0x4c9ba0[_0x2cff('0x1f')]),'form':{'operation':_0x2cff('0x20'),'sessionName':_0x292ca6[_0x2cff('0x2e')],'elementType':_0x2cff('0x3e'),'element':JSON[_0x2cff('0x22')]({'lastname':_0x339c3b,'phone':_0x4ad196,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x3df87e){logger[_0x2cff('0x18')]('Enduser\x20created.');return BPromise[_0x2cff('0x25')]({'id':_0x3df87e['result']['id'],'name':_0x3df87e['result'][_0x2cff('0x3f')],'phone':_0x3df87e[_0x2cff('0x2f')][_0x2cff('0x40')]});})[_0x2cff('0x29')](function(_0x244972){var _0x699743=_0x244972['statusCode']||0x1f4;logger[_0x2cff('0x28')](_0x2cff('0x39'),'getEndUser',_0x699743,JSON[_0x2cff('0x22')](_0x244972));});}});}function getConnection(_0x3c0354){var _0x134255=_0x3c0354[_0x2cff('0x34')];var _0x33c658=_0x3c0354[_0x2cff('0x41')];return request({'method':'GET','uri':util[_0x2cff('0x26')](_0x2cff('0x1e'),_0x3c0354[_0x2cff('0x1f')]),'qs':{'operation':_0x2cff('0x42'),'username':_0x134255},'json':!![]})[_0x2cff('0x23')](function(_0x9f221e){if(_0x9f221e[_0x2cff('0x24')]){return request({'method':_0x2cff('0x43'),'uri':util['format'](_0x2cff('0x1e'),_0x3c0354[_0x2cff('0x1f')]),'form':{'operation':_0x2cff('0x44'),'username':_0x134255,'accessKey':md5(_0x9f221e[_0x2cff('0x2f')][_0x2cff('0x45')]+_0x33c658)},'json':!![]});}})[_0x2cff('0x23')](function(_0x397575){if(_0x397575[_0x2cff('0x24')]){return BPromise['resolve'](_0x397575[_0x2cff('0x2f')]);}else{throw new Error(util[_0x2cff('0x26')](_0x2cff('0x46'),_0x3c0354['id']));}})[_0x2cff('0x29')](function(_0xbeaf37){var _0x28eb62=_0xbeaf37[_0x2cff('0x36')]||0x1f4;logger[_0x2cff('0x28')](_0x2cff('0x39'),_0x2cff('0x47'),_0x28eb62,JSON[_0x2cff('0x22')](_0xbeaf37));});}function request(_0x58418f){logger['info'](_0x2cff('0x48'),JSON[_0x2cff('0x22')](_0x58418f));return rp(_0x58418f);}exports[_0x2cff('0x49')]=function(_0xb490a,_0x2e7a42,_0x493205,_0x2afee3,_0x1ae5de,_0x82e1ad){var _0x3dff75,_0x4774fb,_0x404efb,_0x4e355c;_0x82e1ad[_0x2cff('0x1f')]=intUtil[_0x2cff('0x4a')](_0x82e1ad[_0x2cff('0x1f')]);if(_0x1ae5de&&_0x1ae5de['monitor_format']){logger[_0x2cff('0x18')](_0x2cff('0x4b'),_0x2cff('0x4c'));_0x2e7a42['recordingURL']=util[_0x2cff('0x26')](_0x2cff('0x4d'),_0x82e1ad[_0x2cff('0x4e')],_0x2e7a42['uniqueid'],md5(_0x2e7a42[_0x2cff('0x4f')]));}else{_0x2e7a42[_0x2cff('0x50')]='';}return getConnection(_0x82e1ad)[_0x2cff('0x23')](function(_0x4a967b){_0x4e355c=_0x4a967b;return getUser(_0x82e1ad,_0x2afee3[_0x2cff('0x51')],_0x4e355c);})[_0x2cff('0x23')](function(_0x2fca98){_0x3dff75=_0x2fca98;logger['info'](_0x2cff('0x52'),_0x3dff75['id']);return getEndUser(_0x82e1ad,_0x2e7a42[_0x2cff('0x53')],_0x2e7a42[_0x2cff('0x54')],_0x4e355c);})[_0x2cff('0x23')](function(_0x5a6bfd){_0x4774fb=_0x5a6bfd;logger[_0x2cff('0x18')](_0x2cff('0x55'),_0x4774fb['id']);return createTicket(_0x82e1ad,_0x3dff75,_0x4774fb,_0x493205,_0x2e7a42,_0x493205['Fields'],_0x4e355c);})[_0x2cff('0x23')](function(_0x2cd89b){_0x404efb=_0x2cd89b;logger['info']('Ticket\x20created!');logger[_0x2cff('0x18')]('The\x20Ticket\x20ID\x20is:',_0x404efb['id']);var _0x4f6a07=util[_0x2cff('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x82e1ad[_0x2cff('0x1f')],_[_0x2cff('0x56')](_0x404efb['id'],'x')[0x1]);logger[_0x2cff('0x18')]('[QUEUE]',_0x2cff('0x57'));emit(util[_0x2cff('0x26')](_0x2cff('0x58'),_0x2afee3[_0x2cff('0x16')]),_0x2cff('0x59'),{'uri':_0x4f6a07});})[_0x2cff('0x29')](function(_0x166c93){logger[_0x2cff('0x28')](_0x2cff('0x4b'),JSON[_0x2cff('0x22')](_0x166c93));});};exports['outbound']=function(_0xe2f4b3,_0x5384c9,_0x17ed11,_0x4e00df,_0x37b2ad,_0x1fcd54,_0x2b212b){var _0x2011e9,_0x3b7c85,_0x25513d,_0x3b3610;_0x1fcd54['remoteUri']=intUtil['stripTrailingSlash'](_0x1fcd54[_0x2cff('0x1f')]);_0x1fcd54[_0x2cff('0x4e')]=intUtil[_0x2cff('0x4a')](_0x1fcd54['serverUrl']);if(_0x2b212b&&_0x2b212b['recordingFormat']&&_0x2b212b[_0x2cff('0x5a')]!==_0x2cff('0x5b')){logger[_0x2cff('0x18')](_0x2cff('0x5c'),_0x2cff('0x4c'));_0x5384c9[_0x2cff('0x50')]=util[_0x2cff('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fcd54[_0x2cff('0x4e')],_0x5384c9['uniqueid'],md5(_0x5384c9[_0x2cff('0x4f')]));}return getConnection(_0x1fcd54)['then'](function(_0x302005){_0x3b3610=_0x302005;return getUser(_0x1fcd54,_0x4e00df[_0x2cff('0x51')],_0x3b3610);})[_0x2cff('0x23')](function(_0x3f563f){_0x2011e9=_0x3f563f;logger[_0x2cff('0x18')](_0x2cff('0x52'),_0x2011e9['id']);return getEndUser(_0x1fcd54,_0x5384c9[_0x2cff('0x5d')],_0x5384c9[_0x2cff('0x5e')],_0x3b3610);})['then'](function(_0x11f3cf){_0x3b7c85=_0x11f3cf;logger[_0x2cff('0x18')](_0x2cff('0x55'),_0x3b7c85['id']);return createTicket(_0x1fcd54,_0x2011e9,_0x3b7c85,_0x17ed11,_0x5384c9,_0x17ed11[_0x2cff('0x5f')],_0x3b3610);})['then'](function(_0x3e2f03){_0x25513d=_0x3e2f03;logger[_0x2cff('0x18')](_0x2cff('0x60'));logger['info'](_0x2cff('0x61'),_0x25513d['id']);var _0x29fc27=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1fcd54[_0x2cff('0x1f')],_[_0x2cff('0x56')](_0x25513d['id'],'x')[0x1]);logger[_0x2cff('0x18')](_0x2cff('0x5c'),_0x2cff('0x57'));emit(util['format'](_0x2cff('0x58'),_0x4e00df['name']),_0x2cff('0x59'),{'uri':_0x29fc27});})[_0x2cff('0x29')](function(_0x43de19){logger[_0x2cff('0x28')](_0x2cff('0x5c'),JSON[_0x2cff('0x22')](_0x43de19));});};exports[_0x2cff('0x62')]=function(_0x51b971,_0x3813e8,_0x23d666,_0x441ac0,_0x595047,_0x138b17){var _0x492f62,_0x1581ae,_0x7cca3a,_0x1b5403;_0x138b17[_0x2cff('0x1f')]=intUtil[_0x2cff('0x4a')](_0x138b17[_0x2cff('0x1f')]);_0x138b17[_0x2cff('0x4e')]=intUtil[_0x2cff('0x4a')](_0x138b17[_0x2cff('0x4e')]);if(_0x595047&&_0x595047[_0x2cff('0x63')]){logger['info']('['+_0x3813e8['lastevent'][_0x2cff('0x64')]()+']',_0x2cff('0x4c'));_0x3813e8['recordingURL']=util[_0x2cff('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x138b17[_0x2cff('0x4e')],_0x3813e8[_0x2cff('0x4f')],md5(_0x3813e8['uniqueid']));}else{_0x3813e8[_0x2cff('0x50')]='';}return getConnection(_0x138b17)[_0x2cff('0x23')](function(_0x4371d1){_0x1b5403=_0x4371d1;return getUser(_0x138b17,'',_0x1b5403);})[_0x2cff('0x23')](function(_0x9f3b0e){_0x492f62=_0x9f3b0e;logger[_0x2cff('0x18')](_0x2cff('0x52'),_0x492f62['id']);return getEndUser(_0x138b17,_0x3813e8['calleridname'],_0x3813e8[_0x2cff('0x54')],_0x1b5403);})['then'](function(_0x37960a){_0x1581ae=_0x37960a;logger[_0x2cff('0x18')](_0x2cff('0x55'),_0x1581ae['id']);return createTicket(_0x138b17,_0x492f62,_0x1581ae,_0x23d666,_0x3813e8,_0x23d666[_0x2cff('0x5f')],_0x1b5403);})[_0x2cff('0x23')](function(_0x40061b){_0x7cca3a=_0x40061b;logger[_0x2cff('0x18')](_0x2cff('0x60'));logger['info'](_0x2cff('0x61'),_0x7cca3a['id']);})['catch'](function(_0x1c62c6){logger[_0x2cff('0x28')]('['+_0x3813e8[_0x2cff('0x65')]['toUpperCase']()+']',JSON[_0x2cff('0x22')](_0x1c62c6));});}; \ 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 bbd72c7..3801c45 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 _0xa902=['stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','error','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent','toUpperCase','uniqueid','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','merge','name','Subjects','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','end-user','Caller\x20-\x20%s','authType','password','username','token','%s/token:%s','Basic\x20%s','debug','[HTTP]','length','type','string','customField','nameField','toLowerCase','toString','idField','custom_fields','push','content','variable','variableName','customVariable','Variable'];(function(_0x58fbb0,_0xe497b5){var _0x1783d2=function(_0x5554a8){while(--_0x5554a8){_0x58fbb0['push'](_0x58fbb0['shift']());}};_0x1783d2(++_0xe497b5);}(_0xa902,0x8d));var _0x2a90=function(_0x52bf5a,_0x47bb35){_0x52bf5a=_0x52bf5a-0x0;var _0xd5b6e8=_0xa902[_0x52bf5a];return _0xd5b6e8;};'use strict';var _=require(_0x2a90('0x0'));var rp=require(_0x2a90('0x1'));var md5=require(_0x2a90('0x2'));var util=require(_0x2a90('0x3'));var Redis=require(_0x2a90('0x4'));var intUtil=require('./util');var config=require(_0x2a90('0x5'));var logger=require('../../../../config/logger')('zendesk');config[_0x2a90('0x6')]=_[_0x2a90('0x7')](config[_0x2a90('0x6')],{'host':_0x2a90('0x8'),'port':0x18eb});var io=require(_0x2a90('0x9'))(new Redis(config[_0x2a90('0x6')]));function emit(_0x58369a,_0x4109e6,_0x570659){io['to'](_0x58369a)['emit'](_0x4109e6,_0x570659);}var headers={'Content-Type':_0x2a90('0xa'),'Accept':_0x2a90('0xa')};function getTicket(_0xe500bc,_0x2b0a20,_0x18a60e,_0x56550f,_0x361571){logger[_0x2a90('0xb')](_0x2a90('0xc'));return request({'uri':util[_0x2a90('0xd')]('%s/tickets.json',_0xe500bc[_0x2a90('0xe')]),'method':'POST','body':{'ticket':_[_0x2a90('0xf')]({'requester_id':_0x18a60e['id'],'submitter_id':_0x2b0a20?_0x2b0a20['id']:undefined,'assignee_id':_0x2b0a20?_0x2b0a20['id']:undefined,'tags':getTags(_0x56550f['Tags'],_0x2a90('0x10')),'subject':intUtil['getString'](_0x56550f[_0x2a90('0x11')],_0x361571,'\x20'),'description':intUtil[_0x2a90('0x12')](_0x56550f[_0x2a90('0x13')],_0x361571,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x56550f['Descriptions'],_0x361571,'\x0a')}},getCustomFields(_0x56550f['Fields'],_0x361571))}})[_0x2a90('0x14')](function(_0x3a42df){logger['info'](_0x2a90('0x15'));return _0x3a42df[_0x2a90('0x16')];});}function getUser(_0x312782,_0x25bd0e){if(intUtil[_0x2a90('0x17')](_0x25bd0e)){logger[_0x2a90('0xb')](_0x2a90('0x18'),_0x25bd0e);return request({'uri':util[_0x2a90('0xd')](_0x2a90('0x19'),_0x312782['remoteUri']),'qs':{'query':util[_0x2a90('0xd')](_0x2a90('0x1a'),_0x25bd0e)}})[_0x2a90('0x14')](function(_0x52622c){if(_0x52622c[_0x2a90('0x1b')]){logger[_0x2a90('0xb')](_0x2a90('0x1c'));return _[_0x2a90('0x1d')](_0x52622c[_0x2a90('0x1e')],{'email':_0x25bd0e,'role':_0x2a90('0x1f')});}else{logger[_0x2a90('0xb')](_0x2a90('0x20'));return request({'uri':util[_0x2a90('0xd')](_0x2a90('0x21'),_0x312782[_0x2a90('0xe')])})[_0x2a90('0x14')](function(_0x4fdd62){logger[_0x2a90('0xb')](_0x2a90('0x22'));return _0x4fdd62[_0x2a90('0x23')];});}});}else{logger[_0x2a90('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2a90('0xd')](_0x2a90('0x21'),_0x312782['remoteUri'])})[_0x2a90('0x14')](function(_0x1164a8){logger[_0x2a90('0xb')](_0x2a90('0x22'));return _0x1164a8[_0x2a90('0x23')];});}}function getEndUser(_0x1303d9,_0x29ed73,_0x24a6d3){logger['info'](_0x2a90('0x24'),_0x24a6d3);return request({'uri':util[_0x2a90('0xd')](_0x2a90('0x19'),_0x1303d9[_0x2a90('0xe')]),'qs':{'query':util[_0x2a90('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x24a6d3)}})['then'](function(_0x293765){var _0x4ed64a;if(_0x293765['results']['length']){_0x293765[_0x2a90('0x1e')]=_[_0x2a90('0x25')](_0x293765['results'],{'suspended':![],'role':'end-user'});if(_0x293765[_0x2a90('0x1e')]['length']){_0x4ed64a=_[_0x2a90('0x26')](_0x293765[_0x2a90('0x1e')]);}}if(_0x4ed64a){logger[_0x2a90('0xb')](_0x2a90('0x27'));return _0x4ed64a;}else{logger[_0x2a90('0xb')](_0x2a90('0x28'));return request({'uri':util[_0x2a90('0xd')]('%s/users.json',_0x1303d9[_0x2a90('0xe')]),'method':_0x2a90('0x29'),'body':{'user':{'role':_0x2a90('0x2a'),'name':util['format'](_0x2a90('0x2b'),_0x29ed73||_0x24a6d3),'phone':_0x24a6d3}}})[_0x2a90('0x14')](function(_0xfbb545){logger[_0x2a90('0xb')]('Enduser\x20created.');return _0xfbb545[_0x2a90('0x23')];});}});}function getAuth(_0x1b5f73){var _0xee69e4;if(_0x1b5f73[_0x2a90('0x2c')]===_0x2a90('0x2d')){_0xee69e4=util[_0x2a90('0xd')]('%s:%s',_0x1b5f73[_0x2a90('0x2e')],_0x1b5f73[_0x2a90('0x2d')]);}else if(_0x1b5f73[_0x2a90('0x2c')]===_0x2a90('0x2f')){_0xee69e4=util['format'](_0x2a90('0x30'),_0x1b5f73[_0x2a90('0x2e')],_0x1b5f73['token']);}return util[_0x2a90('0xd')](_0x2a90('0x31'),new Buffer(_0xee69e4)['toString']('base64'));}function request(_0x13ce73){logger[_0x2a90('0x32')](_0x2a90('0x33'),JSON['stringify'](_0x13ce73));return rp(_[_0x2a90('0x7')](_0x13ce73,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x41ab0d,_0x4a3e12){var _0x347fe2=[];if(_0x41ab0d&&_0x41ab0d['length']>0x0){_0x347fe2=_['map'](_0x41ab0d,_0x4a3e12);}return _0x347fe2;}function getCustomFields(_0x43ebb2,_0x47d568){var _0x463721=[];var _0x97448={'custom_fields':[]};if(_0x43ebb2[_0x2a90('0x34')]>0x0){_['forEach'](_0x43ebb2,function(_0x57a2a5){if(_0x57a2a5[_0x2a90('0x35')]===_0x2a90('0x36')&&_0x57a2a5['nameField']&&!_0x57a2a5[_0x2a90('0x37')]){_0x97448[_0x57a2a5[_0x2a90('0x38')][_0x2a90('0x39')]()]=_0x57a2a5['content'][_0x2a90('0x3a')]();}else if(_0x57a2a5[_0x2a90('0x35')]==='string'&&_0x57a2a5[_0x2a90('0x3b')]&&_0x57a2a5[_0x2a90('0x37')]){_0x97448[_0x2a90('0x3c')][_0x2a90('0x3d')]({'id':_0x57a2a5[_0x2a90('0x3b')],'value':_0x57a2a5[_0x2a90('0x3e')][_0x2a90('0x3a')]()});}else if(_0x57a2a5[_0x2a90('0x35')]===_0x2a90('0x3f')&&_0x57a2a5[_0x2a90('0x40')]&&_0x57a2a5[_0x2a90('0x3b')]&&_0x57a2a5[_0x2a90('0x37')]){_0x47d568[_0x57a2a5[_0x2a90('0x40')]]&&_0x97448[_0x2a90('0x3c')]['push']({'id':_0x57a2a5[_0x2a90('0x3b')],'value':_0x47d568[_0x57a2a5[_0x2a90('0x40')]]['toString']()});}else if(_0x57a2a5[_0x2a90('0x35')]===_0x2a90('0x41')&&_0x57a2a5[_0x2a90('0x42')]&&_0x57a2a5[_0x2a90('0x42')][_0x2a90('0x10')]&&_0x57a2a5['idField']&&_0x57a2a5[_0x2a90('0x37')]){_0x47d568[_0x57a2a5['Variable'][_0x2a90('0x10')]['toLowerCase']()]&&_0x97448[_0x2a90('0x3c')][_0x2a90('0x3d')]({'id':_0x57a2a5[_0x2a90('0x3b')],'value':_0x47d568[_0x57a2a5[_0x2a90('0x42')][_0x2a90('0x10')][_0x2a90('0x39')]()][_0x2a90('0x3a')]()});}});}return _0x97448;}exports['queue']=function(_0x5aa278,_0x2af810,_0x388613,_0x401eab,_0x28944c,_0x1ae049){var _0xff4f4a,_0x654803;_0x1ae049[_0x2a90('0xe')]=intUtil['stripTrailingSlash'](_0x1ae049[_0x2a90('0xe')]);_0x1ae049['serverUrl']=intUtil[_0x2a90('0x43')](_0x1ae049[_0x2a90('0x44')]);if(_0x28944c&&_0x28944c['monitor_format']){logger[_0x2a90('0xb')](_0x2a90('0x45'),_0x2a90('0x46'));_0x2af810[_0x2a90('0x47')]=util[_0x2a90('0xd')](_0x2a90('0x48'),_0x1ae049[_0x2a90('0x44')],_0x2af810['uniqueid'],md5(_0x2af810['uniqueid']));}else{_0x2af810[_0x2a90('0x47')]='';}headers[_0x2a90('0x49')]=getAuth(_0x1ae049);return getUser(_0x1ae049,_0x401eab[_0x2a90('0x4a')])[_0x2a90('0x14')](function(_0x29d357){_0xff4f4a=_0x29d357;logger['info']('The\x20User\x20ID\x20is:',_0xff4f4a['id']);return getEndUser(_0x1ae049,_0x2af810[_0x2a90('0x4b')],_0x2af810[_0x2a90('0x4c')]);})['then'](function(_0x5f15e0){_0x654803=_0x5f15e0;logger['info'](_0x2a90('0x4d'),_0x654803['id']);return getTicket(_0x1ae049,_0xff4f4a,_0x654803,_0x388613,_0x2af810);})['then'](function(_0x370da3){if(_0x370da3){logger[_0x2a90('0xb')](_0x2a90('0x4e'),_0x370da3['id']);switch(_0x1ae049[_0x2a90('0x35')]){case _0x2a90('0x4f'):logger[_0x2a90('0xb')]('[QUEUE]',_0x2a90('0x50'));return request({'uri':util[_0x2a90('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1ae049[_0x2a90('0xe')],_0xff4f4a['id'],_0x370da3['id']),'method':'POST'});case'newTab':logger[_0x2a90('0xb')](_0x2a90('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2a90('0x51'),_0x401eab['name']),_0x2a90('0x52'),{'uri':util[_0x2a90('0xd')]('%s/agent/tickets/%s',_0x1ae049[_0x2a90('0xe')],_0x370da3['id'])});break;default:logger[_0x2a90('0x53')](_0x2a90('0x45'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2a90('0x54')](function(_0xdb6535){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2a90('0x55')](_0xdb6535,{'showHidden':!![],'depth':null}));});};exports[_0x2a90('0x56')]=function(_0x58f859,_0x274f25,_0x504e25,_0x1302b9,_0x5ab061,_0x13440e,_0x1c8bbf){var _0x25b1ca,_0x4c267b;_0x13440e['remoteUri']=intUtil['stripTrailingSlash'](_0x13440e[_0x2a90('0xe')]);_0x13440e[_0x2a90('0x44')]=intUtil[_0x2a90('0x43')](_0x13440e[_0x2a90('0x44')]);if(_0x1c8bbf&&_0x1c8bbf[_0x2a90('0x57')]&&_0x1c8bbf[_0x2a90('0x57')]!==_0x2a90('0x58')){logger[_0x2a90('0xb')](_0x2a90('0x59'),_0x2a90('0x46'));_0x274f25[_0x2a90('0x47')]=util[_0x2a90('0xd')](_0x2a90('0x48'),_0x13440e['serverUrl'],_0x274f25['uniqueid'],md5(_0x274f25['uniqueid']));}headers[_0x2a90('0x49')]=getAuth(_0x13440e);return getUser(_0x13440e,_0x1302b9[_0x2a90('0x4a')])[_0x2a90('0x14')](function(_0x400aca){_0x25b1ca=_0x400aca;logger[_0x2a90('0xb')](_0x2a90('0x5a'),_0x25b1ca['id']);return getEndUser(_0x13440e,_0x274f25[_0x2a90('0x5b')],_0x274f25[_0x2a90('0x5c')]);})[_0x2a90('0x14')](function(_0x1de2ec){_0x4c267b=_0x1de2ec;logger[_0x2a90('0xb')](_0x2a90('0x4d'),_0x4c267b['id']);return getTicket(_0x13440e,_0x25b1ca,_0x4c267b,_0x504e25,_0x274f25);})[_0x2a90('0x14')](function(_0x420f5a){if(_0x420f5a){logger[_0x2a90('0xb')](_0x2a90('0x4e'),_0x420f5a['id']);switch(_0x13440e['type']){case _0x2a90('0x4f'):logger['info'](_0x2a90('0x59'),_0x2a90('0x50'));return request({'uri':util[_0x2a90('0xd')](_0x2a90('0x5d'),_0x13440e[_0x2a90('0xe')],_0x25b1ca['id'],_0x420f5a['id']),'method':_0x2a90('0x29')});case _0x2a90('0x5e'):logger['info'](_0x2a90('0x59'),_0x2a90('0x5f'));emit(util[_0x2a90('0xd')]('user:%s',_0x1302b9[_0x2a90('0x10')]),_0x2a90('0x52'),{'uri':util[_0x2a90('0xd')](_0x2a90('0x60'),_0x13440e['remoteUri'],_0x420f5a['id'])});break;default:logger[_0x2a90('0x53')]('[OUTBOUND]',_0x2a90('0x61'));}}})[_0x2a90('0x54')](function(_0x368ec6){logger[_0x2a90('0x53')](_0x2a90('0x62'),util[_0x2a90('0x55')](_0x368ec6,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x466513,_0x2347b6,_0x120c17,_0x3bbd96,_0x1f8788,_0x60999d){var _0x1bf4f0,_0x3dc85f;_0x60999d[_0x2a90('0xe')]=intUtil['stripTrailingSlash'](_0x60999d[_0x2a90('0xe')]);_0x60999d[_0x2a90('0x44')]=intUtil[_0x2a90('0x43')](_0x60999d['serverUrl']);if(_0x1f8788&&_0x1f8788[_0x2a90('0x63')]){logger[_0x2a90('0xb')]('['+_0x2347b6[_0x2a90('0x64')][_0x2a90('0x65')]()+']',_0x2a90('0x46'));_0x2347b6['recordingURL']=util[_0x2a90('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x60999d['serverUrl'],_0x2347b6[_0x2a90('0x66')],md5(_0x2347b6['uniqueid']));}else{_0x2347b6['recordingURL']='';}headers[_0x2a90('0x49')]=getAuth(_0x60999d);return getUser(_0x60999d)['then'](function(_0xac4adb){_0x1bf4f0=_0xac4adb;logger[_0x2a90('0xb')]('The\x20User\x20ID\x20is:',_0x1bf4f0['id']);return getEndUser(_0x60999d,_0x2347b6['calleridname'],_0x2347b6[_0x2a90('0x4c')]);})['then'](function(_0x51f11d){_0x3dc85f=_0x51f11d;logger[_0x2a90('0xb')](_0x2a90('0x4d'),_0x3dc85f['id']);return getTicket(_0x60999d,_0x1bf4f0,_0x3dc85f,_0x120c17,_0x2347b6);})[_0x2a90('0x14')](function(_0x2ec221){if(_0x2ec221){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2ec221['id']);}})[_0x2a90('0x54')](function(_0x410c0f){logger[_0x2a90('0x53')]('['+_0x2347b6[_0x2a90('0x64')][_0x2a90('0x65')]()+']'+_0x2a90('0x67'),util[_0x2a90('0x55')](_0x410c0f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2bb0=['Variable','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','catch','inspect','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','merge','Tags','name','Subjects','getString','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','string','customField','nameField','toLowerCase','content','toString','type','idField','push','variableName','custom_fields'];(function(_0x59dd17,_0x5697cb){var _0x4e7e9b=function(_0x31c117){while(--_0x31c117){_0x59dd17['push'](_0x59dd17['shift']());}};_0x4e7e9b(++_0x5697cb);}(_0x2bb0,0xf3));var _0x02bb=function(_0x1cee61,_0x2fe2b1){_0x1cee61=_0x1cee61-0x0;var _0xf7a772=_0x2bb0[_0x1cee61];return _0xf7a772;};'use strict';var _=require(_0x02bb('0x0'));var rp=require(_0x02bb('0x1'));var md5=require(_0x02bb('0x2'));var util=require('util');var Redis=require(_0x02bb('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x02bb('0x4'))('zendesk');config[_0x02bb('0x5')]=_[_0x02bb('0x6')](config[_0x02bb('0x5')],{'host':_0x02bb('0x7'),'port':0x18eb});var io=require(_0x02bb('0x8'))(new Redis(config[_0x02bb('0x5')]));function emit(_0x440f9c,_0x47d7ae,_0x6d064a){io['to'](_0x440f9c)[_0x02bb('0x9')](_0x47d7ae,_0x6d064a);}var headers={'Content-Type':_0x02bb('0xa'),'Accept':'application/json'};function getTicket(_0x3d28d5,_0x5a4a7f,_0x3edabe,_0x1863ec,_0x4d3418){logger[_0x02bb('0xb')](_0x02bb('0xc'));return request({'uri':util[_0x02bb('0xd')]('%s/tickets.json',_0x3d28d5[_0x02bb('0xe')]),'method':'POST','body':{'ticket':_[_0x02bb('0xf')]({'requester_id':_0x3edabe['id'],'submitter_id':_0x5a4a7f?_0x5a4a7f['id']:undefined,'assignee_id':_0x5a4a7f?_0x5a4a7f['id']:undefined,'tags':getTags(_0x1863ec[_0x02bb('0x10')],_0x02bb('0x11')),'subject':intUtil['getString'](_0x1863ec[_0x02bb('0x12')],_0x4d3418,'\x20'),'description':intUtil[_0x02bb('0x13')](_0x1863ec[_0x02bb('0x14')],_0x4d3418,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1863ec[_0x02bb('0x14')],_0x4d3418,'\x0a')}},getCustomFields(_0x1863ec['Fields'],_0x4d3418))}})[_0x02bb('0x15')](function(_0x17d70e){logger[_0x02bb('0xb')](_0x02bb('0x16'));return _0x17d70e[_0x02bb('0x17')];});}function getUser(_0x224e90,_0x5cf4cb){if(intUtil['validateEmail'](_0x5cf4cb)){logger[_0x02bb('0xb')](_0x02bb('0x18'),_0x5cf4cb);return request({'uri':util[_0x02bb('0xd')](_0x02bb('0x19'),_0x224e90[_0x02bb('0xe')]),'qs':{'query':util[_0x02bb('0xd')]('type:user\x20role:agent\x20email:%s',_0x5cf4cb)}})[_0x02bb('0x15')](function(_0x4b3f78){if(_0x4b3f78[_0x02bb('0x1a')]){logger[_0x02bb('0xb')](_0x02bb('0x1b'));return _['find'](_0x4b3f78[_0x02bb('0x1c')],{'email':_0x5cf4cb,'role':_0x02bb('0x1d')});}else{logger[_0x02bb('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x02bb('0xd')](_0x02bb('0x1e'),_0x224e90['remoteUri'])})[_0x02bb('0x15')](function(_0x4b9b16){logger[_0x02bb('0xb')](_0x02bb('0x1f'));return _0x4b9b16[_0x02bb('0x20')];});}});}else{logger[_0x02bb('0xb')](_0x02bb('0x21'));return request({'uri':util[_0x02bb('0xd')](_0x02bb('0x1e'),_0x224e90['remoteUri'])})['then'](function(_0x278fc9){logger['info'](_0x02bb('0x1f'));return _0x278fc9[_0x02bb('0x20')];});}}function getEndUser(_0x8ae103,_0x4d3dad,_0x20b55e){logger[_0x02bb('0xb')]('Searching\x20enduser\x20with\x20phone',_0x20b55e);return request({'uri':util[_0x02bb('0xd')](_0x02bb('0x19'),_0x8ae103[_0x02bb('0xe')]),'qs':{'query':util[_0x02bb('0xd')](_0x02bb('0x22'),_0x20b55e)}})[_0x02bb('0x15')](function(_0x5c4d31){var _0x1f2be8;if(_0x5c4d31['results'][_0x02bb('0x23')]){_0x5c4d31[_0x02bb('0x1c')]=_[_0x02bb('0x24')](_0x5c4d31['results'],{'suspended':![],'role':_0x02bb('0x25')});if(_0x5c4d31[_0x02bb('0x1c')][_0x02bb('0x23')]){_0x1f2be8=_['first'](_0x5c4d31[_0x02bb('0x1c')]);}}if(_0x1f2be8){logger[_0x02bb('0xb')](_0x02bb('0x26'));return _0x1f2be8;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x02bb('0xd')]('%s/users.json',_0x8ae103['remoteUri']),'method':_0x02bb('0x27'),'body':{'user':{'role':_0x02bb('0x25'),'name':util['format'](_0x02bb('0x28'),_0x4d3dad||_0x20b55e),'phone':_0x20b55e}}})[_0x02bb('0x15')](function(_0x2dc098){logger['info'](_0x02bb('0x29'));return _0x2dc098[_0x02bb('0x20')];});}});}function getAuth(_0x260230){var _0x277130;if(_0x260230[_0x02bb('0x2a')]===_0x02bb('0x2b')){_0x277130=util[_0x02bb('0xd')](_0x02bb('0x2c'),_0x260230[_0x02bb('0x2d')],_0x260230[_0x02bb('0x2b')]);}else if(_0x260230['authType']===_0x02bb('0x2e')){_0x277130=util[_0x02bb('0xd')]('%s/token:%s',_0x260230[_0x02bb('0x2d')],_0x260230[_0x02bb('0x2e')]);}return util[_0x02bb('0xd')](_0x02bb('0x2f'),new Buffer(_0x277130)['toString'](_0x02bb('0x30')));}function request(_0x479868){logger[_0x02bb('0x31')](_0x02bb('0x32'),JSON[_0x02bb('0x33')](_0x479868));return rp(_[_0x02bb('0x6')](_0x479868,{'method':_0x02bb('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x5d55a4,_0x12f10b){var _0x4e6e29=[];if(_0x5d55a4&&_0x5d55a4[_0x02bb('0x23')]>0x0){_0x4e6e29=_[_0x02bb('0x35')](_0x5d55a4,_0x12f10b);}return _0x4e6e29;}function getCustomFields(_0x566df4,_0x128574){var _0xc63774=[];var _0x128a12={'custom_fields':[]};if(_0x566df4[_0x02bb('0x23')]>0x0){_[_0x02bb('0x36')](_0x566df4,function(_0xee8e8e){if(_0xee8e8e['type']===_0x02bb('0x37')&&_0xee8e8e['nameField']&&!_0xee8e8e[_0x02bb('0x38')]){_0x128a12[_0xee8e8e[_0x02bb('0x39')][_0x02bb('0x3a')]()]=_0xee8e8e[_0x02bb('0x3b')][_0x02bb('0x3c')]();}else if(_0xee8e8e[_0x02bb('0x3d')]===_0x02bb('0x37')&&_0xee8e8e[_0x02bb('0x3e')]&&_0xee8e8e[_0x02bb('0x38')]){_0x128a12['custom_fields'][_0x02bb('0x3f')]({'id':_0xee8e8e[_0x02bb('0x3e')],'value':_0xee8e8e['content'][_0x02bb('0x3c')]()});}else if(_0xee8e8e[_0x02bb('0x3d')]==='variable'&&_0xee8e8e['variableName']&&_0xee8e8e[_0x02bb('0x3e')]&&_0xee8e8e[_0x02bb('0x38')]){_0x128574[_0xee8e8e[_0x02bb('0x40')]]&&_0x128a12[_0x02bb('0x41')][_0x02bb('0x3f')]({'id':_0xee8e8e[_0x02bb('0x3e')],'value':_0x128574[_0xee8e8e['variableName']][_0x02bb('0x3c')]()});}else if(_0xee8e8e['type']==='customVariable'&&_0xee8e8e[_0x02bb('0x42')]&&_0xee8e8e[_0x02bb('0x42')]['name']&&_0xee8e8e[_0x02bb('0x3e')]&&_0xee8e8e['customField']){_0x128574[_0xee8e8e[_0x02bb('0x42')][_0x02bb('0x11')][_0x02bb('0x3a')]()]&&_0x128a12['custom_fields']['push']({'id':_0xee8e8e['idField'],'value':_0x128574[_0xee8e8e['Variable'][_0x02bb('0x11')][_0x02bb('0x3a')]()][_0x02bb('0x3c')]()});}});}return _0x128a12;}exports['queue']=function(_0x134482,_0x13a831,_0x24743e,_0x493a2c,_0x130e38,_0x40b76c){var _0x23b8d6,_0x43ede8;_0x40b76c[_0x02bb('0xe')]=intUtil['stripTrailingSlash'](_0x40b76c['remoteUri']);_0x40b76c[_0x02bb('0x43')]=intUtil['stripTrailingSlash'](_0x40b76c['serverUrl']);if(_0x130e38&&_0x130e38[_0x02bb('0x44')]){logger[_0x02bb('0xb')]('[QUEUE]',_0x02bb('0x45'));_0x13a831[_0x02bb('0x46')]=util[_0x02bb('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x40b76c[_0x02bb('0x43')],_0x13a831[_0x02bb('0x47')],md5(_0x13a831[_0x02bb('0x47')]));}else{_0x13a831[_0x02bb('0x46')]='';}headers[_0x02bb('0x48')]=getAuth(_0x40b76c);return getUser(_0x40b76c,_0x493a2c[_0x02bb('0x49')])[_0x02bb('0x15')](function(_0x5b766b){_0x23b8d6=_0x5b766b;logger[_0x02bb('0xb')](_0x02bb('0x4a'),_0x23b8d6['id']);return getEndUser(_0x40b76c,_0x13a831[_0x02bb('0x4b')],_0x13a831[_0x02bb('0x4c')]);})['then'](function(_0x171f85){_0x43ede8=_0x171f85;logger[_0x02bb('0xb')](_0x02bb('0x4d'),_0x43ede8['id']);return getTicket(_0x40b76c,_0x23b8d6,_0x43ede8,_0x24743e,_0x13a831);})[_0x02bb('0x15')](function(_0x1f3c06){if(_0x1f3c06){logger[_0x02bb('0xb')](_0x02bb('0x4e'),_0x1f3c06['id']);switch(_0x40b76c[_0x02bb('0x3d')]){case _0x02bb('0x4f'):logger[_0x02bb('0xb')](_0x02bb('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x02bb('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x40b76c[_0x02bb('0xe')],_0x23b8d6['id'],_0x1f3c06['id']),'method':_0x02bb('0x27')});case _0x02bb('0x51'):logger[_0x02bb('0xb')](_0x02bb('0x50'),_0x02bb('0x52'));emit(util[_0x02bb('0xd')](_0x02bb('0x53'),_0x493a2c['name']),_0x02bb('0x54'),{'uri':util[_0x02bb('0xd')](_0x02bb('0x55'),_0x40b76c[_0x02bb('0xe')],_0x1f3c06['id'])});break;default:logger[_0x02bb('0x56')](_0x02bb('0x50'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x02bb('0x57')](function(_0x22ad38){logger[_0x02bb('0x56')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x02bb('0x58')](_0x22ad38,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x38e1b7,_0x3ef720,_0x42dd19,_0x17ecc8,_0x1045fd,_0x1eca57,_0x44b3fb){var _0x2f4460,_0x19660e;_0x1eca57[_0x02bb('0xe')]=intUtil['stripTrailingSlash'](_0x1eca57[_0x02bb('0xe')]);_0x1eca57[_0x02bb('0x43')]=intUtil[_0x02bb('0x59')](_0x1eca57['serverUrl']);if(_0x44b3fb&&_0x44b3fb[_0x02bb('0x5a')]&&_0x44b3fb[_0x02bb('0x5a')]!==_0x02bb('0x5b')){logger[_0x02bb('0xb')](_0x02bb('0x5c'),'Recording\x20is\x20enabled!');_0x3ef720[_0x02bb('0x46')]=util[_0x02bb('0xd')](_0x02bb('0x5d'),_0x1eca57[_0x02bb('0x43')],_0x3ef720[_0x02bb('0x47')],md5(_0x3ef720[_0x02bb('0x47')]));}headers[_0x02bb('0x48')]=getAuth(_0x1eca57);return getUser(_0x1eca57,_0x17ecc8[_0x02bb('0x49')])[_0x02bb('0x15')](function(_0x841e78){_0x2f4460=_0x841e78;logger[_0x02bb('0xb')](_0x02bb('0x4a'),_0x2f4460['id']);return getEndUser(_0x1eca57,_0x3ef720['destcalleridname'],_0x3ef720[_0x02bb('0x5e')]);})[_0x02bb('0x15')](function(_0x5f154e){_0x19660e=_0x5f154e;logger[_0x02bb('0xb')](_0x02bb('0x4d'),_0x19660e['id']);return getTicket(_0x1eca57,_0x2f4460,_0x19660e,_0x42dd19,_0x3ef720);})[_0x02bb('0x15')](function(_0x1823d4){if(_0x1823d4){logger[_0x02bb('0xb')](_0x02bb('0x4e'),_0x1823d4['id']);switch(_0x1eca57['type']){case _0x02bb('0x4f'):logger[_0x02bb('0xb')](_0x02bb('0x5c'),_0x02bb('0x5f'));return request({'uri':util[_0x02bb('0xd')](_0x02bb('0x60'),_0x1eca57[_0x02bb('0xe')],_0x2f4460['id'],_0x1823d4['id']),'method':_0x02bb('0x27')});case'newTab':logger[_0x02bb('0xb')](_0x02bb('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x02bb('0xd')](_0x02bb('0x53'),_0x17ecc8[_0x02bb('0x11')]),_0x02bb('0x54'),{'uri':util[_0x02bb('0xd')](_0x02bb('0x55'),_0x1eca57[_0x02bb('0xe')],_0x1823d4['id'])});break;default:logger[_0x02bb('0x56')](_0x02bb('0x5c'),_0x02bb('0x61'));}}})[_0x02bb('0x57')](function(_0x2908e5){logger[_0x02bb('0x56')](_0x02bb('0x62'),util[_0x02bb('0x58')](_0x2908e5,{'showHidden':!![],'depth':null}));});};exports[_0x02bb('0x63')]=function(_0x520416,_0x2990ee,_0x17400e,_0x135972,_0xa1607e,_0x2d1e23){var _0x1d29cd,_0x13cdf6;_0x2d1e23['remoteUri']=intUtil['stripTrailingSlash'](_0x2d1e23[_0x02bb('0xe')]);_0x2d1e23[_0x02bb('0x43')]=intUtil[_0x02bb('0x59')](_0x2d1e23[_0x02bb('0x43')]);if(_0xa1607e&&_0xa1607e[_0x02bb('0x44')]){logger[_0x02bb('0xb')]('['+_0x2990ee[_0x02bb('0x64')][_0x02bb('0x65')]()+']',_0x02bb('0x45'));_0x2990ee['recordingURL']=util[_0x02bb('0xd')](_0x02bb('0x5d'),_0x2d1e23['serverUrl'],_0x2990ee[_0x02bb('0x47')],md5(_0x2990ee[_0x02bb('0x47')]));}else{_0x2990ee['recordingURL']='';}headers[_0x02bb('0x48')]=getAuth(_0x2d1e23);return getUser(_0x2d1e23)['then'](function(_0x51a526){_0x1d29cd=_0x51a526;logger['info'](_0x02bb('0x4a'),_0x1d29cd['id']);return getEndUser(_0x2d1e23,_0x2990ee[_0x02bb('0x4b')],_0x2990ee[_0x02bb('0x4c')]);})[_0x02bb('0x15')](function(_0x4a6d30){_0x13cdf6=_0x4a6d30;logger[_0x02bb('0xb')](_0x02bb('0x4d'),_0x13cdf6['id']);return getTicket(_0x2d1e23,_0x1d29cd,_0x13cdf6,_0x17400e,_0x2990ee);})[_0x02bb('0x15')](function(_0x45ede0){if(_0x45ede0){logger['info'](_0x02bb('0x4e'),_0x45ede0['id']);}})['catch'](function(_0x5811d2){logger[_0x02bb('0x56')]('['+_0x2990ee[_0x02bb('0x64')]['toUpperCase']()+']'+_0x02bb('0x66'),util['inspect'](_0x5811d2,{'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 e7adfbd..9314cc9 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 _0xaaee=['Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','none','Recording\x20is\x20enabled!','zoho.eu','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','[OUTBOUND]','https://crm.','unmanaged','lastevent','toUpperCase','calleridnum','lodash','md5','util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','idField','toString','type','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','access_token','add','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','uri','lead','Leads','Creating\x20new\x20call...','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','com','email','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]'];(function(_0x24d1b6,_0x2c7ab6){var _0x27faec=function(_0x3336d1){while(--_0x3336d1){_0x24d1b6['push'](_0x24d1b6['shift']());}};_0x27faec(++_0x2c7ab6);}(_0xaaee,0xa9));var _0xeaae=function(_0x2ffd56,_0x5e5b4d){_0x2ffd56=_0x2ffd56-0x0;var _0x2ee0f2=_0xaaee[_0x2ffd56];return _0x2ee0f2;};'use strict';var _=require(_0xeaae('0x0'));var rp=require('request-promise');var md5=require(_0xeaae('0x1'));var util=require(_0xeaae('0x2'));var intUtil=require('./util');var moment=require(_0xeaae('0x3'));var Redis=require(_0xeaae('0x4'));var BPromise=require(_0xeaae('0x5'));var config=require(_0xeaae('0x6'));var logger=require('../../../../config/logger')(_0xeaae('0x7'));config[_0xeaae('0x8')]=_[_0xeaae('0x9')](config[_0xeaae('0x8')],{'host':_0xeaae('0xa'),'port':0x18eb});var io=require(_0xeaae('0xb'))(new Redis(config['redis']));function emit(_0x275d1c,_0x1701a9,_0x469c44){io['to'](_0x275d1c)[_0xeaae('0xc')](_0x1701a9,_0x469c44);}function request(_0x3ec6d0){logger[_0xeaae('0xd')](_0xeaae('0xe'),JSON[_0xeaae('0xf')](_0x3ec6d0));return rp(_0x3ec6d0);}function getCustomFields(_0x592993,_0x494ecb){var _0x2995ba={};if(_0x592993[_0xeaae('0x10')]>0x0){_[_0xeaae('0x11')](_0x592993,function(_0x513fbb){if(_0x513fbb['type']===_0xeaae('0x12')&&_0x513fbb[_0xeaae('0x13')]){_0x2995ba[_0x513fbb[_0xeaae('0x13')]]=_0x513fbb['content'][_0xeaae('0x14')]();}else if(_0x513fbb[_0xeaae('0x15')]===_0xeaae('0x16')&&_0x513fbb[_0xeaae('0x17')]&&_0x513fbb['idField']&&_0x494ecb[_0x513fbb['variableName']]){_0x2995ba[_0x513fbb[_0xeaae('0x13')]]=_0x494ecb[_0x513fbb[_0xeaae('0x17')]][_0xeaae('0x14')]();}else if(_0x513fbb[_0xeaae('0x15')]==='customVariable'&&_0x513fbb[_0xeaae('0x18')]&&_0x513fbb['Variable'][_0xeaae('0x19')]&&_0x513fbb[_0xeaae('0x13')]&&_0x494ecb[_0x513fbb[_0xeaae('0x18')][_0xeaae('0x19')]['toLowerCase']()]){_0x2995ba[_0x513fbb['idField']]=_0x494ecb[_0x513fbb['Variable']['name'][_0xeaae('0x1a')]()][_0xeaae('0x14')]();}});}return _0x2995ba;}function getName(_0x5b169d){if(_0x5b169d[_0xeaae('0x1b')]('\x20')>0x0){var _0x5cc79c=_0x5b169d[_0xeaae('0x1c')](/ (.+)/);if(_0x5cc79c[0x1]){return _0x5cc79c;}}return[_0x5b169d,_0x5b169d];}var accountsTokens={};function getAccessToken(_0x2ddb28){return new Promise(function(_0x3491a6,_0x52de90){if(!_[_0xeaae('0x1d')](accountsTokens[_0x2ddb28['id']])&&!_[_0xeaae('0x1d')](accountsTokens[_0x2ddb28['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x2ddb28['id']][_0xeaae('0x1e')])){_0x3491a6(accountsTokens[_0x2ddb28['id']]['access_token']);}}var _0x48f4a9;switch(_0x2ddb28[_0xeaae('0x1f')]){case'US':_0x48f4a9=_0xeaae('0x20');break;case'AU':_0x48f4a9=_0xeaae('0x21');break;case'EU':_0x48f4a9=_0xeaae('0x22');break;case'IN':_0x48f4a9=_0xeaae('0x23');break;case'CN':_0x48f4a9=_0xeaae('0x24');break;default:_0x48f4a9=_0xeaae('0x22');break;}var _0x3881f3={'method':_0xeaae('0x25'),'uri':_0x48f4a9+_0xeaae('0x26'),'qs':{'refresh_token':_0x2ddb28['refreshToken'],'client_id':_0x2ddb28[_0xeaae('0x27')],'client_secret':_0x2ddb28[_0xeaae('0x28')],'grant_type':_0xeaae('0x29')},'json':!![]};return rp(_0x3881f3)[_0xeaae('0x2a')](function(_0x98ec5a){accountsTokens[_0x2ddb28['id']]={'access_token':_0x98ec5a[_0xeaae('0x2b')],'expires_in':moment()[_0xeaae('0x2c')](_0x98ec5a[_0xeaae('0x1e')],'seconds')};_0x3491a6(_0x98ec5a['access_token']);})[_0xeaae('0x2d')](function(_0x668fd2){logger[_0xeaae('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x668fd2[_0xeaae('0x2f')]);_0x52de90(_0x668fd2);});});}function getUser(_0x30e777,_0xa334c8,_0x14a68a,_0x24d86a){logger[_0xeaae('0x30')](_0xeaae('0x31'));return request({'method':_0xeaae('0x32'),'uri':util[_0xeaae('0x33')](_0xeaae('0x34'),_0xa334c8),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xeaae('0x35')+_0x30e777},'json':!![]})[_0xeaae('0x2a')](function(_0x4c938f){if(_0x4c938f['users']){var _0x387f8e=-0x1;if(_['isArrayLikeObject'](_0x4c938f[_0xeaae('0x36')])){if(!_[_0xeaae('0x1d')](_0x24d86a)){_0x387f8e=_[_0xeaae('0x37')](_0x4c938f['users'],function(_0x4e6d26){return _0x4e6d26['email']===_0x24d86a;});}if(_0x387f8e>=0x0){logger[_0xeaae('0x30')]('Agent\x20found!');}else{logger[_0xeaae('0x30')](_0xeaae('0x38'));_0x387f8e=_[_0xeaae('0x37')](_0x4c938f['users'],function(_0x2b9367){return _0x2b9367[_0xeaae('0x39')][_0xeaae('0x19')]===_0xeaae('0x3a');});}return _0x4c938f[_0xeaae('0x36')][_0x387f8e];}else{if(_0x4c938f['user'][_0xeaae('0x39')][_0xeaae('0x19')]===_0xeaae('0x3a')){logger[_0xeaae('0x30')](_0xeaae('0x38'));user=_0x4c938f[_0xeaae('0x3b')];return user;}else{logger[_0xeaae('0x2e')](_0xeaae('0x3c'),JSON[_0xeaae('0xf')](_0x4c938f));throw new Error(_0xeaae('0x3d')+JSON[_0xeaae('0xf')](_0x4c938f));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x4c938f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x4c938f));}})[_0xeaae('0x2d')](function(_0x4eb9a2){console[_0xeaae('0x2e')](_0x4eb9a2);});}function getZohoUser(_0x49f5a0,_0x1d526a){return new BPromise(function(_0x588a60,_0x510a32){request(_0x49f5a0)[_0xeaae('0x2a')](function(_0x40a23d){var _0x58089f=null;if(_0x40a23d){_0x58089f=_0x40a23d[_0xeaae('0x3e')][0x0];_0x58089f[_0xeaae('0x3f')]=_0x1d526a;}_0x588a60(_0x58089f);})['catch'](function(_0xe8ec0a){_0x510a32(_0xe8ec0a);});});}function createEndUser(_0x38645a,_0xd0fd53,_0x116833,_0x31ccc7,_0x5a97a8,_0xd6893c){var _0x116833=getName(_0x116833);return request({'method':_0xeaae('0x25'),'uri':_0xeaae('0x40')+_0xd0fd53+'/crm/v2/'+_[_0xeaae('0x41')](_0xd6893c[_0xeaae('0x42')])+'s','body':{'data':[{'Last_Name':_0x116833[0x1],'First_Name':_0x116833[0x0],'Phone':_0x31ccc7,'Owner':{'name':!_[_0xeaae('0x1d')](_0x5a97a8['role'][_0xeaae('0x19')])?_0x5a97a8[_0xeaae('0x43')][_0xeaae('0x19')]:!_[_0xeaae('0x1d')](_0x5a97a8[_0xeaae('0x44')])?_0x5a97a8['first_name']+'\x20'+_0x5a97a8['last_name']:_0x5a97a8[_0xeaae('0x45')],'id':_0x5a97a8['id']}}]},'headers':{'Authorization':_0xeaae('0x35')+_0x38645a},'json':!![]})[_0xeaae('0x2a')](function(_0x47d796){if(_0x47d796&&_0x47d796[_0xeaae('0x3e')][0x0]['code']===_0xeaae('0x46')){var _0x503a66=_0x47d796[_0xeaae('0x3e')][0x0][_0xeaae('0x47')];_0x503a66[_0xeaae('0x3f')]=_['startCase'](_0xd6893c[_0xeaae('0x42')])+'s';return _0x503a66;}logger['error'](_0xeaae('0x3c'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xeaae('0xf')](data));})[_0xeaae('0x2d')](function(_0x5d3dd7){console[_0xeaae('0x48')](_0xeaae('0x49'),_0x5d3dd7);});}function getEndUser(_0x171f77,_0x320061,_0x2b4d2d,_0x19637d,_0x5236b6,_0x37f8c6,_0x9072c9){var _0x3e2689={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x171f77},'json':!![]};switch(_0x9072c9[_0xeaae('0x4a')]){case _0xeaae('0x4b'):_0x3e2689['uri']=_0xeaae('0x40')+_0x320061+_0xeaae('0x4c')+_0x5236b6+'))';return getZohoUser(_0x3e2689,_0xeaae('0x4d'))[_0xeaae('0x2a')](function(_0x29121a){if(_0x29121a)return _0x29121a;_0x3e2689['uri']=_0xeaae('0x40')+_0x320061+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5236b6+'))';return getZohoUser(_0x3e2689,'Leads')[_0xeaae('0x2a')](function(_0x4752ae){if(_0x4752ae)return _0x4752ae;if(_0x9072c9[_0xeaae('0x42')]!=_0xeaae('0x4e')){return createEndUser(_0x171f77,_0x320061,_0x19637d,_0x5236b6,_0x37f8c6,_0x9072c9);}else{return{};}});});break;case _0xeaae('0x4f'):_0x3e2689[_0xeaae('0x50')]=_0xeaae('0x40')+_0x320061+_0xeaae('0x4c')+_0x5236b6+'))';return getZohoUser(_0x3e2689,_0xeaae('0x4d'))[_0xeaae('0x2a')](function(_0x407a09){if(_0x407a09)return _0x407a09;if(_0x9072c9[_0xeaae('0x42')]!=_0xeaae('0x4e')){return createEndUser(_0x171f77,_0x320061,_0x19637d,_0x5236b6,_0x37f8c6,_0x9072c9);}else{return{};}});break;case _0xeaae('0x51'):_0x3e2689['uri']=_0xeaae('0x40')+_0x320061+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5236b6+'))';return getZohoUser(_0x3e2689,_0xeaae('0x52'))[_0xeaae('0x2a')](function(_0x1a6304){if(_0x1a6304)return _0x1a6304;if(_0x9072c9[_0xeaae('0x42')]!='nothing'){return createEndUser(_0x171f77,_0x320061,_0x19637d,_0x5236b6,_0x37f8c6,_0x9072c9);}else{return{};}});break;}}function getCall(_0x18637c,_0x4e2f6a,_0x48db1d,_0x44dfbd,_0x23aaf1,_0x34bf1c,_0x57f42d,_0x2e475d){logger[_0xeaae('0x30')](_0xeaae('0x53'));var _0x3f16a1={};_0x3f16a1['Owner']={'name':!_[_0xeaae('0x1d')](_0x44dfbd[_0xeaae('0x43')]['name'])&&!_[_0xeaae('0x1d')](_0x44dfbd[_0xeaae('0x39')][_0xeaae('0x19')])&&_0x44dfbd[_0xeaae('0x39')][_0xeaae('0x19')]===_0xeaae('0x54')?_0x44dfbd[_0xeaae('0x43')][_0xeaae('0x19')]:!_['isNil'](_0x44dfbd[_0xeaae('0x44')])?_0x44dfbd[_0xeaae('0x44')]+'\x20'+_0x44dfbd[_0xeaae('0x45')]:_0x44dfbd[_0xeaae('0x45')],'id':_0x44dfbd['id']};_0x3f16a1[_0xeaae('0x55')]=intUtil[_0xeaae('0x56')](_0x34bf1c['Subjects'],_0x57f42d,'\x20');_0x3f16a1[_0xeaae('0x57')]=intUtil['getString'](_0x34bf1c[_0xeaae('0x58')],_0x57f42d,'\x0a');if(_0x23aaf1['enduserType']===_0xeaae('0x4d')){_0x3f16a1[_0xeaae('0x59')]={'name':!_['isNil'](_0x23aaf1['Full_Name'])?_0x23aaf1[_0xeaae('0x5a')]:!_[_0xeaae('0x1d')](_0x23aaf1[_0xeaae('0x5b')])?_0x23aaf1[_0xeaae('0x5b')]+'\x20'+_0x23aaf1['Last_Name']:_0x23aaf1['Last_Name'],'id':_0x23aaf1['id']};}if(_0x23aaf1[_0xeaae('0x3f')]===_0xeaae('0x52')){_0x3f16a1[_0xeaae('0x5c')]={'name':!_[_0xeaae('0x1d')](_0x23aaf1[_0xeaae('0x5a')])?_0x23aaf1[_0xeaae('0x5a')]:!_[_0xeaae('0x1d')](_0x23aaf1[_0xeaae('0x5b')])?_0x23aaf1['First_Name']+'\x20'+_0x23aaf1[_0xeaae('0x5d')]:_0x23aaf1[_0xeaae('0x5d')],'id':_0x23aaf1['id']};_0x3f16a1[_0xeaae('0x5e')]=_['startCase'](_0x23aaf1[_0xeaae('0x3f')]);}if(_0x57f42d[_0xeaae('0x5f')]){_0x3f16a1['Call_Duration']=moment[_0xeaae('0x60')](parseInt(_0x57f42d[_0xeaae('0x5f')])*0x3e8)[_0xeaae('0x33')](_0xeaae('0x61'));}else if(_0x57f42d[_0xeaae('0x62')]&&_0x57f42d[_0xeaae('0x63')]){_0x3f16a1[_0xeaae('0x64')]=moment[_0xeaae('0x60')](moment(_0x57f42d[_0xeaae('0x63')],_0xeaae('0x65'))[_0xeaae('0x66')](moment(_0x57f42d[_0xeaae('0x67')],_0xeaae('0x65'))))[_0xeaae('0x33')](_0xeaae('0x61'));}switch(_0x57f42d['lastevent']){case'called':_0x3f16a1[_0xeaae('0x68')]=_0xeaae('0x69');break;case _0xeaae('0x6a'):case _0xeaae('0x6b'):_0x3f16a1[_0xeaae('0x68')]=_0xeaae('0x6c');break;case _0xeaae('0x6d'):_0x3f16a1['Call_Result']=_0xeaae('0x6e');break;case _0xeaae('0x6f'):_0x3f16a1[_0xeaae('0x68')]=_0xeaae('0x70');break;case _0xeaae('0x71'):_0x3f16a1['Call_Result']='Timeout';default:}_0x3f16a1[_0xeaae('0x72')]=(_0x2e475d===_0xeaae('0x73')?moment(_0x57f42d[_0xeaae('0x67')])[_0xeaae('0x33')](_0xeaae('0x65')):moment(_0x57f42d['agentcalledAt'])[_0xeaae('0x33')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xeaae('0x33')](_0xeaae('0x65'));_0x3f16a1[_0xeaae('0x74')]=_0x2e475d||_0xeaae('0x75');_0x3f16a1=_['merge'](_0x3f16a1,getCustomFields(_0x34bf1c[_0xeaae('0x76')],_0x57f42d));return request({'method':_0xeaae('0x25'),'uri':_0xeaae('0x40')+_0x4e2f6a+_0xeaae('0x77'),'headers':{'Authorization':_0xeaae('0x35')+_0x18637c},'body':{'data':[_0x3f16a1]},'json':!![]})[_0xeaae('0x2a')](function(_0x220524){if(_0x220524&&_0x220524[_0xeaae('0x3e')][0x0][_0xeaae('0x78')]===_0xeaae('0x46')){logger['info'](_0xeaae('0x79'));return{'id':_0x220524[_0xeaae('0x3e')][0x0]['details']['id']};}})[_0xeaae('0x2d')](function(_0x57dd4c){logger[_0xeaae('0x30')](_0xeaae('0x7a'),_0x57dd4c['stack']);console['log'](_0xeaae('0x7a'),_0x57dd4c);});}exports[_0xeaae('0x7b')]=function(_0x22b3b5,_0x20fb20,_0x20816d,_0x5a9e4e,_0x205446,_0x4567a2){var _0x3cd27e,_0x18d700,_0x333f03;_0x4567a2[_0xeaae('0x7c')]=intUtil[_0xeaae('0x7d')](_0x4567a2[_0xeaae('0x7c')]);_0x4567a2['serverUrl']=intUtil[_0xeaae('0x7d')](_0x4567a2[_0xeaae('0x7e')]);if(_0x205446&&_0x205446[_0xeaae('0x7f')]){logger[_0xeaae('0x30')]('[QUEUE]','Recording\x20is\x20enabled!');_0x20fb20['recordingURL']=_0x4567a2[_0xeaae('0x7e')]+_0xeaae('0x80')+_0x20fb20[_0xeaae('0x81')]+_0xeaae('0x82')+md5(_0x20fb20['uniqueid']);}else{_0x20fb20[_0xeaae('0x83')]='';}var _0x481524=_0x4567a2[_0xeaae('0x7c')]==='zoho.eu'?'eu':_0xeaae('0x84');return getAccessToken(_0x4567a2)['then'](function(_0x1fa9a0){_0x333f03=_0x1fa9a0;return getUser(_0x333f03,_0x481524,_0x4567a2,_0x5a9e4e[_0xeaae('0x85')]);})[_0xeaae('0x2a')](function(_0x3cf3ef){_0x3cd27e=_0x3cf3ef;logger[_0xeaae('0x30')]('The\x20User\x20ID\x20is:',_0x3cd27e['id']);return getEndUser(_0x333f03,_0x481524,_0x4567a2,_0x20fb20[_0xeaae('0x86')],_0x20fb20['calleridnum'],_0x3cd27e,_0x20816d);})[_0xeaae('0x2a')](function(_0x11e4cc){_0x18d700=_0x11e4cc;return getCall(_0x333f03,_0x481524,_0x4567a2,_0x3cd27e,_0x18d700,_0x20816d,_0x20fb20,_0xeaae('0x75'));})[_0xeaae('0x2a')](function(_0x49afc1){if(_0x49afc1){logger['info'](_0xeaae('0x87'),_0x49afc1['id']);logger['info'](_0xeaae('0x88'),_0xeaae('0x89'));emit(util['format'](_0xeaae('0x8a'),_0x5a9e4e['name']),_0xeaae('0x8b'),{'uri':'https://crm.'+_0x4567a2['host']+_0xeaae('0x8c')+_0x49afc1['id']});}})[_0xeaae('0x2d')](function(_0x42d002){logger['error'](_0xeaae('0x88'),JSON[_0xeaae('0xf')](_0x42d002));});};exports[_0xeaae('0x73')]=function(_0x286029,_0x3366c1,_0x2e4a45,_0x2c2655,_0x55dc28,_0x5021f9,_0x589699){var _0x5c9435,_0x4f5581,_0x17c969;_0x5021f9[_0xeaae('0x7c')]=intUtil[_0xeaae('0x7d')](_0x5021f9[_0xeaae('0x7c')]);_0x5021f9[_0xeaae('0x7e')]=intUtil[_0xeaae('0x7d')](_0x5021f9[_0xeaae('0x7e')]);if(_0x589699&&_0x589699['recordingFormat']&&_0x589699['recordingFormat']!==_0xeaae('0x8d')){logger['info']('[OUTBOUND]',_0xeaae('0x8e'));_0x3366c1[_0xeaae('0x83')]=_0x5021f9['serverUrl']+_0xeaae('0x80')+_0x3366c1[_0xeaae('0x81')]+_0xeaae('0x82')+md5(_0x3366c1[_0xeaae('0x81')]);}var _0x38cabd=_0x5021f9[_0xeaae('0x7c')]===_0xeaae('0x8f')?'eu':_0xeaae('0x84');return getAccessToken(_0x5021f9)[_0xeaae('0x2a')](function(_0x4b9acd){_0x17c969=_0x4b9acd;return getUser(_0x17c969,_0x38cabd,_0x5021f9,_0x2c2655[_0xeaae('0x85')]);})['then'](function(_0x272c91){_0x5c9435=_0x272c91;logger['info'](_0xeaae('0x90'),_0x5c9435['id']);return getEndUser(_0x17c969,_0x38cabd,_0x5021f9,_0x3366c1['destcalleridname'],_0x3366c1[_0xeaae('0x91')],_0x5c9435,_0x2e4a45);})['then'](function(_0x32ead6){_0x4f5581=_0x32ead6;return getCall(_0x17c969,_0x38cabd,_0x5021f9,_0x5c9435,_0x4f5581,_0x2e4a45,_0x3366c1,_0xeaae('0x92'));})[_0xeaae('0x2a')](function(_0x1b3992){if(_0x1b3992){logger['info'](_0xeaae('0x87'),_0x1b3992['id']);logger['info'](_0xeaae('0x93'),_0xeaae('0x89'));emit(util[_0xeaae('0x33')](_0xeaae('0x8a'),_0x2c2655['name']),_0xeaae('0x8b'),{'uri':_0xeaae('0x94')+_0x5021f9[_0xeaae('0x7c')]+_0xeaae('0x8c')+_0x1b3992['id']});}})[_0xeaae('0x2d')](function(_0x3055b5){logger['error'](_0xeaae('0x93'),JSON[_0xeaae('0xf')](_0x3055b5));});};exports[_0xeaae('0x95')]=function(_0x5b974d,_0x5d2de0,_0x174291,_0x27a8ce,_0x10e519,_0x2b77dc){var _0x2638f5,_0x37a581,_0x39eb97;_0x2b77dc[_0xeaae('0x7c')]=intUtil[_0xeaae('0x7d')](_0x2b77dc[_0xeaae('0x7c')]);_0x2b77dc[_0xeaae('0x7e')]=intUtil[_0xeaae('0x7d')](_0x2b77dc[_0xeaae('0x7e')]);if(_0x10e519&&_0x10e519[_0xeaae('0x7f')]){logger[_0xeaae('0x30')]('['+_0x5d2de0[_0xeaae('0x96')][_0xeaae('0x97')]()+']',_0xeaae('0x8e'));_0x5d2de0[_0xeaae('0x83')]=_0x2b77dc[_0xeaae('0x7e')]+_0xeaae('0x80')+_0x5d2de0['uniqueid']+_0xeaae('0x82')+md5(_0x5d2de0[_0xeaae('0x81')]);}else{_0x5d2de0[_0xeaae('0x83')]='';}var _0x30afdb=_0x2b77dc[_0xeaae('0x7c')]===_0xeaae('0x8f')?'eu':_0xeaae('0x84');return getAccessToken(_0x2b77dc)[_0xeaae('0x2a')](function(_0x54b53f){_0x39eb97=_0x54b53f;return getUser(_0x39eb97,_0x30afdb,_0x2b77dc);})['then'](function(_0x3a0b84){_0x2638f5=_0x3a0b84;logger[_0xeaae('0x30')](_0xeaae('0x90'),_0x2638f5['id']);return getEndUser(_0x39eb97,_0x30afdb,_0x2b77dc,_0x5d2de0[_0xeaae('0x86')],_0x5d2de0[_0xeaae('0x98')],_0x2638f5,_0x174291);})[_0xeaae('0x2a')](function(_0x5db212){_0x37a581=_0x5db212;return getCall(_0x39eb97,_0x30afdb,_0x2b77dc,_0x2638f5,_0x37a581,_0x174291,_0x5d2de0,'Inbound');})['then'](function(_0x5d27ed){if(_0x5d27ed){logger[_0xeaae('0x30')](_0xeaae('0x87'),_0x5d27ed['id']);}})[_0xeaae('0x2d')](function(_0x1cd9b6){logger['error']('['+_0x5d2de0['lastevent'][_0xeaae('0x97')]()+']',JSON['stringify'](_0x1cd9b6));});}; \ No newline at end of file +var _0xa533=['md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','stringify','length','forEach','string','idField','content','type','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','access_token','isBefore','zone','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','findIndex','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','isNil','role','first_name','last_name','code','SUCCESS','details','startCase','log','CREATE\x20ERROR','GET','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','Owner','administrator','Subjects','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','none','[OUTBOUND]','uniqueid','destcalleridnum','Outbound','https://crm.','monitor_format','toUpperCase','/downloads?type=uniqueid&token=','lodash','request-promise'];(function(_0x4c9c81,_0x155e2f){var _0x27788f=function(_0x4b894f){while(--_0x4b894f){_0x4c9c81['push'](_0x4c9c81['shift']());}};_0x27788f(++_0x155e2f);}(_0xa533,0x1c6));var _0x3a53=function(_0x1104d8,_0x13cef7){_0x1104d8=_0x1104d8-0x0;var _0x4b926a=_0xa533[_0x1104d8];return _0x4b926a;};'use strict';var _=require(_0x3a53('0x0'));var rp=require(_0x3a53('0x1'));var md5=require(_0x3a53('0x2'));var util=require(_0x3a53('0x3'));var intUtil=require(_0x3a53('0x4'));var moment=require(_0x3a53('0x5'));var Redis=require('ioredis');var BPromise=require(_0x3a53('0x6'));var config=require(_0x3a53('0x7'));var logger=require(_0x3a53('0x8'))(_0x3a53('0x9'));config[_0x3a53('0xa')]=_[_0x3a53('0xb')](config[_0x3a53('0xa')],{'host':_0x3a53('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5ef619,_0x360b1d,_0xf547ce){io['to'](_0x5ef619)[_0x3a53('0xd')](_0x360b1d,_0xf547ce);}function request(_0x284c21){logger[_0x3a53('0xe')]('[HTTP]',JSON[_0x3a53('0xf')](_0x284c21));return rp(_0x284c21);}function getCustomFields(_0x42f653,_0x3eb3e5){var _0x46b6a0={};if(_0x42f653[_0x3a53('0x10')]>0x0){_[_0x3a53('0x11')](_0x42f653,function(_0x39d933){if(_0x39d933['type']===_0x3a53('0x12')&&_0x39d933[_0x3a53('0x13')]){_0x46b6a0[_0x39d933[_0x3a53('0x13')]]=_0x39d933[_0x3a53('0x14')]['toString']();}else if(_0x39d933[_0x3a53('0x15')]==='variable'&&_0x39d933[_0x3a53('0x16')]&&_0x39d933['idField']&&_0x3eb3e5[_0x39d933[_0x3a53('0x16')]]){_0x46b6a0[_0x39d933[_0x3a53('0x13')]]=_0x3eb3e5[_0x39d933[_0x3a53('0x16')]]['toString']();}else if(_0x39d933[_0x3a53('0x15')]===_0x3a53('0x17')&&_0x39d933[_0x3a53('0x18')]&&_0x39d933['Variable']['name']&&_0x39d933[_0x3a53('0x13')]&&_0x3eb3e5[_0x39d933[_0x3a53('0x18')]['name']['toLowerCase']()]){_0x46b6a0[_0x39d933[_0x3a53('0x13')]]=_0x3eb3e5[_0x39d933[_0x3a53('0x18')][_0x3a53('0x19')][_0x3a53('0x1a')]()][_0x3a53('0x1b')]();}});}return _0x46b6a0;}function getName(_0x2fd945){if(_0x2fd945[_0x3a53('0x1c')]('\x20')>0x0){var _0x1749fd=_0x2fd945[_0x3a53('0x1d')](/ (.+)/);if(_0x1749fd[0x1]){return _0x1749fd;}}return[_0x2fd945,_0x2fd945];}var accountsTokens={};function getAccessToken(_0x4b0295){return new Promise(function(_0x53caa0,_0x2fd709){if(!_['isNil'](accountsTokens[_0x4b0295['id']])&&!_['isNil'](accountsTokens[_0x4b0295['id']][_0x3a53('0x1e')])){if(moment()[_0x3a53('0x1f')](accountsTokens[_0x4b0295['id']]['expires_in'])){_0x53caa0(accountsTokens[_0x4b0295['id']][_0x3a53('0x1e')]);}}var _0x2b1b74;switch(_0x4b0295[_0x3a53('0x20')]){case'US':_0x2b1b74='https://accounts.zoho.com';break;case'AU':_0x2b1b74='https://accounts.zoho.com.au';break;case'EU':_0x2b1b74=_0x3a53('0x21');break;case'IN':_0x2b1b74=_0x3a53('0x22');break;case'CN':_0x2b1b74='https://accounts.zoho.com.cn';break;default:_0x2b1b74=_0x3a53('0x21');break;}var _0x33123e={'method':_0x3a53('0x23'),'uri':_0x2b1b74+_0x3a53('0x24'),'qs':{'refresh_token':_0x4b0295[_0x3a53('0x25')],'client_id':_0x4b0295[_0x3a53('0x26')],'client_secret':_0x4b0295[_0x3a53('0x27')],'grant_type':_0x3a53('0x28')},'json':!![]};return rp(_0x33123e)[_0x3a53('0x29')](function(_0x415a16){accountsTokens[_0x4b0295['id']]={'access_token':_0x415a16[_0x3a53('0x1e')],'expires_in':moment()[_0x3a53('0x2a')](_0x415a16['expires_in'],_0x3a53('0x2b'))};_0x53caa0(_0x415a16[_0x3a53('0x1e')]);})[_0x3a53('0x2c')](function(_0x460a2e){logger[_0x3a53('0x2d')](_0x3a53('0x2e'),_0x460a2e[_0x3a53('0x2f')]);_0x2fd709(_0x460a2e);});});}function getUser(_0x5f3022,_0x7402de,_0x905690,_0x4db672){logger[_0x3a53('0x30')]('Search\x20user');return request({'method':'GET','uri':util[_0x3a53('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x7402de),'qs':{'type':_0x3a53('0x32')},'headers':{'Authorization':_0x3a53('0x33')+_0x5f3022},'json':!![]})[_0x3a53('0x29')](function(_0x8dd372){if(_0x8dd372[_0x3a53('0x34')]){var _0x2c0fd3=-0x1;if(_[_0x3a53('0x35')](_0x8dd372[_0x3a53('0x34')])){if(!_['isNil'](_0x4db672)){_0x2c0fd3=_['findIndex'](_0x8dd372[_0x3a53('0x34')],function(_0x2ea4a7){return _0x2ea4a7[_0x3a53('0x36')]===_0x4db672;});}if(_0x2c0fd3>=0x0){logger[_0x3a53('0x30')](_0x3a53('0x37'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x2c0fd3=_[_0x3a53('0x38')](_0x8dd372[_0x3a53('0x34')],function(_0x30723c){return _0x30723c[_0x3a53('0x39')][_0x3a53('0x19')]===_0x3a53('0x3a');});}return _0x8dd372[_0x3a53('0x34')][_0x2c0fd3];}else{if(_0x8dd372['user'][_0x3a53('0x39')]['name']===_0x3a53('0x3a')){logger[_0x3a53('0x30')](_0x3a53('0x3b'));user=_0x8dd372[_0x3a53('0x3c')];return user;}else{logger[_0x3a53('0x2d')](_0x3a53('0x3d'),JSON[_0x3a53('0xf')](_0x8dd372));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x3a53('0xf')](_0x8dd372));}}}else{logger[_0x3a53('0x2d')](_0x3a53('0x3d'),JSON[_0x3a53('0xf')](_0x8dd372));throw new Error(_0x3a53('0x3e')+JSON['stringify'](_0x8dd372));}})[_0x3a53('0x2c')](function(_0xf9bac){console[_0x3a53('0x2d')](_0xf9bac);});}function getZohoUser(_0x4839f8,_0x3c853b){return new BPromise(function(_0x589557,_0x25ee74){request(_0x4839f8)['then'](function(_0x1b7cd4){var _0x1dc9a3=null;if(_0x1b7cd4){_0x1dc9a3=_0x1b7cd4[_0x3a53('0x3f')][0x0];_0x1dc9a3[_0x3a53('0x40')]=_0x3c853b;}_0x589557(_0x1dc9a3);})[_0x3a53('0x2c')](function(_0x328645){_0x25ee74(_0x328645);});});}function createEndUser(_0x55e46b,_0x42ff49,_0x296071,_0x419247,_0x3a251a,_0x37105d){var _0x296071=getName(_0x296071);return request({'method':_0x3a53('0x23'),'uri':_0x3a53('0x41')+_0x42ff49+_0x3a53('0x42')+_['startCase'](_0x37105d[_0x3a53('0x43')])+'s','body':{'data':[{'Last_Name':_0x296071[0x1],'First_Name':_0x296071[0x0],'Phone':_0x419247,'Owner':{'name':!_[_0x3a53('0x44')](_0x3a251a[_0x3a53('0x45')][_0x3a53('0x19')])?_0x3a251a[_0x3a53('0x45')]['name']:!_[_0x3a53('0x44')](_0x3a251a[_0x3a53('0x46')])?_0x3a251a[_0x3a53('0x46')]+'\x20'+_0x3a251a[_0x3a53('0x47')]:_0x3a251a[_0x3a53('0x47')],'id':_0x3a251a['id']}}]},'headers':{'Authorization':_0x3a53('0x33')+_0x55e46b},'json':!![]})[_0x3a53('0x29')](function(_0x26975c){if(_0x26975c&&_0x26975c['data'][0x0][_0x3a53('0x48')]===_0x3a53('0x49')){var _0x43e09a=_0x26975c[_0x3a53('0x3f')][0x0][_0x3a53('0x4a')];_0x43e09a['enduserType']=_[_0x3a53('0x4b')](_0x37105d[_0x3a53('0x43')])+'s';return _0x43e09a;}logger[_0x3a53('0x2d')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x3a53('0x2c')](function(_0x5a0e5e){console[_0x3a53('0x4c')](_0x3a53('0x4d'),_0x5a0e5e);});}function getEndUser(_0x59b05e,_0x2525b8,_0x376e05,_0x4411ef,_0x162311,_0x1995cb,_0x17070d){var _0x50e5d5={'method':_0x3a53('0x4e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x59b05e},'json':!![]};switch(_0x17070d[_0x3a53('0x4f')]){case'contact_lead':_0x50e5d5[_0x3a53('0x50')]=_0x3a53('0x41')+_0x2525b8+_0x3a53('0x51')+_0x162311+'))';return getZohoUser(_0x50e5d5,'Contacts')[_0x3a53('0x29')](function(_0x43753b){if(_0x43753b)return _0x43753b;_0x50e5d5[_0x3a53('0x50')]=_0x3a53('0x41')+_0x2525b8+_0x3a53('0x52')+_0x162311+'))';return getZohoUser(_0x50e5d5,_0x3a53('0x53'))['then'](function(_0x3d5662){if(_0x3d5662)return _0x3d5662;if(_0x17070d[_0x3a53('0x43')]!=_0x3a53('0x54')){return createEndUser(_0x59b05e,_0x2525b8,_0x4411ef,_0x162311,_0x1995cb,_0x17070d);}else{return{};}});});break;case _0x3a53('0x55'):_0x50e5d5['uri']='https://www.zohoapis.'+_0x2525b8+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x162311+'))';return getZohoUser(_0x50e5d5,_0x3a53('0x56'))[_0x3a53('0x29')](function(_0x41c497){if(_0x41c497)return _0x41c497;if(_0x17070d[_0x3a53('0x43')]!='nothing'){return createEndUser(_0x59b05e,_0x2525b8,_0x4411ef,_0x162311,_0x1995cb,_0x17070d);}else{return{};}});break;case _0x3a53('0x57'):_0x50e5d5[_0x3a53('0x50')]=_0x3a53('0x41')+_0x2525b8+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x162311+'))';return getZohoUser(_0x50e5d5,_0x3a53('0x53'))['then'](function(_0x1f71f1){if(_0x1f71f1)return _0x1f71f1;if(_0x17070d[_0x3a53('0x43')]!=_0x3a53('0x54')){return createEndUser(_0x59b05e,_0x2525b8,_0x4411ef,_0x162311,_0x1995cb,_0x17070d);}else{return{};}});break;}}function getCall(_0x140ca1,_0x2c8d14,_0x8f834d,_0x2f655a,_0x3220e9,_0x43a45d,_0x198226,_0x57a364){logger[_0x3a53('0x30')](_0x3a53('0x58'));var _0x47d8b4={};_0x47d8b4[_0x3a53('0x59')]={'name':!_[_0x3a53('0x44')](_0x2f655a[_0x3a53('0x45')]['name'])&&!_[_0x3a53('0x44')](_0x2f655a[_0x3a53('0x39')][_0x3a53('0x19')])&&_0x2f655a[_0x3a53('0x39')]['name']===_0x3a53('0x5a')?_0x2f655a[_0x3a53('0x45')]['name']:!_[_0x3a53('0x44')](_0x2f655a[_0x3a53('0x46')])?_0x2f655a[_0x3a53('0x46')]+'\x20'+_0x2f655a[_0x3a53('0x47')]:_0x2f655a[_0x3a53('0x47')],'id':_0x2f655a['id']};_0x47d8b4['Subject']=intUtil['getString'](_0x43a45d[_0x3a53('0x5b')],_0x198226,'\x20');_0x47d8b4['Description']=intUtil[_0x3a53('0x5c')](_0x43a45d[_0x3a53('0x5d')],_0x198226,'\x0a');if(_0x3220e9[_0x3a53('0x40')]==='Contacts'){_0x47d8b4['Who_Id']={'name':!_[_0x3a53('0x44')](_0x3220e9[_0x3a53('0x5e')])?_0x3220e9[_0x3a53('0x5e')]:!_[_0x3a53('0x44')](_0x3220e9[_0x3a53('0x5f')])?_0x3220e9[_0x3a53('0x5f')]+'\x20'+_0x3220e9[_0x3a53('0x60')]:_0x3220e9[_0x3a53('0x60')],'id':_0x3220e9['id']};}if(_0x3220e9['enduserType']==='Leads'){_0x47d8b4[_0x3a53('0x61')]={'name':!_[_0x3a53('0x44')](_0x3220e9[_0x3a53('0x5e')])?_0x3220e9[_0x3a53('0x5e')]:!_[_0x3a53('0x44')](_0x3220e9[_0x3a53('0x5f')])?_0x3220e9[_0x3a53('0x5f')]+'\x20'+_0x3220e9[_0x3a53('0x60')]:_0x3220e9[_0x3a53('0x60')],'id':_0x3220e9['id']};_0x47d8b4['$se_module']=_[_0x3a53('0x4b')](_0x3220e9[_0x3a53('0x40')]);}if(_0x198226[_0x3a53('0x62')]){_0x47d8b4[_0x3a53('0x63')]=moment[_0x3a53('0x64')](parseInt(_0x198226['talktime'])*0x3e8)[_0x3a53('0x31')](_0x3a53('0x65'));}else if(_0x198226[_0x3a53('0x66')]&&_0x198226[_0x3a53('0x67')]){_0x47d8b4['Call_Duration']=moment[_0x3a53('0x64')](moment(_0x198226[_0x3a53('0x67')],'YYYY-MM-DDTHH:mm:ss')[_0x3a53('0x68')](moment(_0x198226['starttime'],_0x3a53('0x69'))))[_0x3a53('0x31')]('mm:ss');}switch(_0x198226[_0x3a53('0x6a')]){case _0x3a53('0x6b'):_0x47d8b4[_0x3a53('0x6c')]='Called';break;case'complete':case _0x3a53('0x6d'):_0x47d8b4[_0x3a53('0x6c')]=_0x3a53('0x6e');break;case _0x3a53('0x6f'):_0x47d8b4['Call_Result']=_0x3a53('0x70');break;case _0x3a53('0x71'):_0x47d8b4[_0x3a53('0x6c')]='Abandoned';break;case _0x3a53('0x72'):_0x47d8b4[_0x3a53('0x6c')]=_0x3a53('0x73');default:}_0x47d8b4[_0x3a53('0x74')]=(_0x57a364===_0x3a53('0x75')?moment(_0x198226[_0x3a53('0x76')])[_0x3a53('0x31')](_0x3a53('0x69')):moment(_0x198226[_0x3a53('0x77')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3a53('0x31')](_0x3a53('0x69'));_0x47d8b4[_0x3a53('0x78')]=_0x57a364||'Inbound';_0x47d8b4=_[_0x3a53('0x79')](_0x47d8b4,getCustomFields(_0x43a45d[_0x3a53('0x7a')],_0x198226));return request({'method':_0x3a53('0x23'),'uri':_0x3a53('0x41')+_0x2c8d14+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x140ca1},'body':{'data':[_0x47d8b4]},'json':!![]})[_0x3a53('0x29')](function(_0x25b4ab){if(_0x25b4ab&&_0x25b4ab[_0x3a53('0x3f')][0x0][_0x3a53('0x48')]===_0x3a53('0x49')){logger['info'](_0x3a53('0x7b'));return{'id':_0x25b4ab['data'][0x0][_0x3a53('0x4a')]['id']};}})[_0x3a53('0x2c')](function(_0x41d29b){logger[_0x3a53('0x30')](_0x3a53('0x7c'),_0x41d29b[_0x3a53('0x2f')]);console[_0x3a53('0x4c')]('err',_0x41d29b);});}exports[_0x3a53('0x7d')]=function(_0x1bfc8e,_0x3f4cb3,_0x26d7b3,_0x468c0c,_0x11203d,_0x1475dd){var _0x44e1dc,_0x5aacd1,_0x1127ef;_0x1475dd[_0x3a53('0x7e')]=intUtil[_0x3a53('0x7f')](_0x1475dd[_0x3a53('0x7e')]);_0x1475dd['serverUrl']=intUtil['stripTrailingSlash'](_0x1475dd[_0x3a53('0x80')]);if(_0x11203d&&_0x11203d['monitor_format']){logger[_0x3a53('0x30')](_0x3a53('0x81'),_0x3a53('0x82'));_0x3f4cb3['recordingURL']=_0x1475dd[_0x3a53('0x80')]+_0x3a53('0x83')+_0x3f4cb3['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x3f4cb3['uniqueid']);}else{_0x3f4cb3[_0x3a53('0x84')]='';}var _0x166920=_0x1475dd[_0x3a53('0x7e')]===_0x3a53('0x85')?'eu':_0x3a53('0x86');return getAccessToken(_0x1475dd)['then'](function(_0x536ff1){_0x1127ef=_0x536ff1;return getUser(_0x1127ef,_0x166920,_0x1475dd,_0x468c0c[_0x3a53('0x36')]);})[_0x3a53('0x29')](function(_0x458080){_0x44e1dc=_0x458080;logger[_0x3a53('0x30')](_0x3a53('0x87'),_0x44e1dc['id']);return getEndUser(_0x1127ef,_0x166920,_0x1475dd,_0x3f4cb3[_0x3a53('0x88')],_0x3f4cb3[_0x3a53('0x89')],_0x44e1dc,_0x26d7b3);})[_0x3a53('0x29')](function(_0x2baee8){_0x5aacd1=_0x2baee8;return getCall(_0x1127ef,_0x166920,_0x1475dd,_0x44e1dc,_0x5aacd1,_0x26d7b3,_0x3f4cb3,_0x3a53('0x8a'));})[_0x3a53('0x29')](function(_0x177cfe){if(_0x177cfe){logger[_0x3a53('0x30')](_0x3a53('0x8b'),_0x177cfe['id']);logger['info'](_0x3a53('0x81'),_0x3a53('0x8c'));emit(util['format'](_0x3a53('0x8d'),_0x468c0c['name']),_0x3a53('0x8e'),{'uri':'https://crm.'+_0x1475dd[_0x3a53('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x177cfe['id']});}})[_0x3a53('0x2c')](function(_0x4670e2){logger[_0x3a53('0x2d')](_0x3a53('0x81'),JSON[_0x3a53('0xf')](_0x4670e2));});};exports[_0x3a53('0x75')]=function(_0x4b0499,_0x456fb7,_0x4dbc1b,_0x5f2376,_0x10f872,_0x326e30,_0xb18e01){var _0x5b8783,_0x2aabc4,_0x227162;_0x326e30[_0x3a53('0x7e')]=intUtil[_0x3a53('0x7f')](_0x326e30[_0x3a53('0x7e')]);_0x326e30[_0x3a53('0x80')]=intUtil[_0x3a53('0x7f')](_0x326e30['serverUrl']);if(_0xb18e01&&_0xb18e01['recordingFormat']&&_0xb18e01['recordingFormat']!==_0x3a53('0x8f')){logger[_0x3a53('0x30')](_0x3a53('0x90'),'Recording\x20is\x20enabled!');_0x456fb7['recordingURL']=_0x326e30['serverUrl']+_0x3a53('0x83')+_0x456fb7[_0x3a53('0x91')]+'/downloads?type=uniqueid&token='+md5(_0x456fb7[_0x3a53('0x91')]);}var _0x1e3b82=_0x326e30['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x326e30)[_0x3a53('0x29')](function(_0x432d49){_0x227162=_0x432d49;return getUser(_0x227162,_0x1e3b82,_0x326e30,_0x5f2376[_0x3a53('0x36')]);})[_0x3a53('0x29')](function(_0x15d79c){_0x5b8783=_0x15d79c;logger[_0x3a53('0x30')]('The\x20User\x20ID\x20is:',_0x5b8783['id']);return getEndUser(_0x227162,_0x1e3b82,_0x326e30,_0x456fb7['destcalleridname'],_0x456fb7[_0x3a53('0x92')],_0x5b8783,_0x4dbc1b);})['then'](function(_0x4d800e){_0x2aabc4=_0x4d800e;return getCall(_0x227162,_0x1e3b82,_0x326e30,_0x5b8783,_0x2aabc4,_0x4dbc1b,_0x456fb7,_0x3a53('0x93'));})[_0x3a53('0x29')](function(_0x5e8ce0){if(_0x5e8ce0){logger[_0x3a53('0x30')](_0x3a53('0x8b'),_0x5e8ce0['id']);logger['info'](_0x3a53('0x90'),_0x3a53('0x8c'));emit(util[_0x3a53('0x31')](_0x3a53('0x8d'),_0x5f2376[_0x3a53('0x19')]),_0x3a53('0x8e'),{'uri':_0x3a53('0x94')+_0x326e30[_0x3a53('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5e8ce0['id']});}})['catch'](function(_0x28fe3f){logger['error'](_0x3a53('0x90'),JSON['stringify'](_0x28fe3f));});};exports['unmanaged']=function(_0x3b9cf8,_0x11b512,_0x3d3c5f,_0x311c72,_0x33a464,_0x214d24){var _0x48038f,_0x3e6d45,_0x2a6530;_0x214d24[_0x3a53('0x7e')]=intUtil['stripTrailingSlash'](_0x214d24[_0x3a53('0x7e')]);_0x214d24[_0x3a53('0x80')]=intUtil[_0x3a53('0x7f')](_0x214d24['serverUrl']);if(_0x33a464&&_0x33a464[_0x3a53('0x95')]){logger[_0x3a53('0x30')]('['+_0x11b512[_0x3a53('0x6a')][_0x3a53('0x96')]()+']',_0x3a53('0x82'));_0x11b512['recordingURL']=_0x214d24[_0x3a53('0x80')]+'/api/voice/recordings/'+_0x11b512[_0x3a53('0x91')]+_0x3a53('0x97')+md5(_0x11b512[_0x3a53('0x91')]);}else{_0x11b512[_0x3a53('0x84')]='';}var _0x4f69b2=_0x214d24['host']==='zoho.eu'?'eu':_0x3a53('0x86');return getAccessToken(_0x214d24)[_0x3a53('0x29')](function(_0x46c935){_0x2a6530=_0x46c935;return getUser(_0x2a6530,_0x4f69b2,_0x214d24);})[_0x3a53('0x29')](function(_0x1f1c26){_0x48038f=_0x1f1c26;logger[_0x3a53('0x30')](_0x3a53('0x87'),_0x48038f['id']);return getEndUser(_0x2a6530,_0x4f69b2,_0x214d24,_0x11b512[_0x3a53('0x88')],_0x11b512['calleridnum'],_0x48038f,_0x3d3c5f);})[_0x3a53('0x29')](function(_0x1db036){_0x3e6d45=_0x1db036;return getCall(_0x2a6530,_0x4f69b2,_0x214d24,_0x48038f,_0x3e6d45,_0x3d3c5f,_0x11b512,_0x3a53('0x8a'));})[_0x3a53('0x29')](function(_0x3a803c){if(_0x3a803c){logger[_0x3a53('0x30')]('The\x20Call\x20ID\x20is:',_0x3a803c['id']);}})[_0x3a53('0x2c')](function(_0x224e48){logger['error']('['+_0x11b512['lastevent'][_0x3a53('0x96')]()+']',JSON['stringify'](_0x224e48));});}; \ 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 60da83b..bd5c703 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(_0x389ff2,_0x28e614){var _0xc71b58=function(_0x4dba47){while(--_0x4dba47){_0x389ff2['push'](_0x389ff2['shift']());}};_0xc71b58(++_0x28e614);}(_0x7a54,0x106));var _0x47a5=function(_0x434823,_0x18ce85){_0x434823=_0x434823-0x0;var _0x221fb6=_0x7a54[_0x434823];return _0x221fb6;};'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(_0x243bbf,_0x3ac406){var _0x27a090=function(_0x41491d){while(--_0x41491d){_0x243bbf['push'](_0x243bbf['shift']());}};_0x27a090(++_0x3ac406);}(_0x7a54,0x106));var _0x47a5=function(_0x4f2e96,_0x36f52a){_0x4f2e96=_0x4f2e96-0x0;var _0x625cc8=_0x7a54[_0x4f2e96];return _0x625cc8;};'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 f4341cc..116daa5 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x15f311,_0x2ab9b1){var _0x30a955=function(_0x625fd5){while(--_0x625fd5){_0x15f311['push'](_0x15f311['shift']());}};_0x30a955(++_0x2ab9b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3aa066,_0x3c53a6){_0x3aa066=_0x3aa066-0x0;var _0x1b33d7=_0x5f2f[_0x3aa066];return _0x1b33d7;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x100dc4,_0x3d1456){var _0x4310cf=function(_0x5ed9c6){while(--_0x5ed9c6){_0x100dc4['push'](_0x100dc4['shift']());}};_0x4310cf(++_0x3d1456);}(_0x7a54,0x106));var _0x47a5=function(_0x525a3a,_0x2d9620){_0x525a3a=_0x525a3a-0x0;var _0x1a4765=_0x7a54[_0x525a3a];return _0x1a4765;};'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 e6097e2..b400c38 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 _0x0a9a=['rpc','message','bluebird','routing','client','http','Request','request','then','debug','error'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5228b1,_0x1fc786){_0x5228b1=_0x5228b1-0x0;var _0x2d53c1=_0x0a9a[_0x5228b1];return _0x2d53c1;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa0a9('0x0'));var logger=require('../../config/logger')(_0xa0a9('0x1'));var client=jayson[_0xa0a9('0x2')][_0xa0a9('0x3')]({'port':0x2329});client[_0xa0a9('0x4')]=function(_0x4ba993,_0x317a94){return new BPromise(function(_0x360be5,_0x50ea50){return client[_0xa0a9('0x5')](_0x4ba993,_0x317a94)[_0xa0a9('0x6')](function(_0x1aa717){logger[_0xa0a9('0x7')]('rpc',_0xa0a9('0x1'),_0x4ba993,_0x317a94,_0x1aa717);if(_0x1aa717['error']){logger[_0xa0a9('0x8')](_0xa0a9('0x9'),_0xa0a9('0x1'),_0x4ba993,_0x1aa717[_0xa0a9('0x8')]['message'],_0x317a94);return _0x50ea50(_0x1aa717[_0xa0a9('0x8')][_0xa0a9('0xa')]);}else{return _0x360be5(_0x1aa717['result']);}})['catch'](function(_0x13dc4a){logger[_0xa0a9('0x8')]('rpc',_0xa0a9('0x1'),_0x4ba993,_0x13dc4a,_0x317a94);return _0x50ea50(_0x13dc4a);});});};module['exports']=client; \ No newline at end of file +var _0x0851=['../../config/logger','routing','http','Request','request','then','debug','rpc','error','message','catch','exports','jayson/promise','bluebird'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x0851,0x8a));var _0x1085=function(_0x234a19,_0x5092d6){_0x234a19=_0x234a19-0x0;var _0x43fa18=_0x0851[_0x234a19];return _0x43fa18;};'use strict';var jayson=require(_0x1085('0x0'));var BPromise=require(_0x1085('0x1'));var logger=require(_0x1085('0x2'))(_0x1085('0x3'));var client=jayson['client'][_0x1085('0x4')]({'port':0x2329});client[_0x1085('0x5')]=function(_0x2de96f,_0x3cbd88){return new BPromise(function(_0x3b40fb,_0x3a528e){return client[_0x1085('0x6')](_0x2de96f,_0x3cbd88)[_0x1085('0x7')](function(_0x152eeb){logger[_0x1085('0x8')](_0x1085('0x9'),_0x1085('0x3'),_0x2de96f,_0x3cbd88,_0x152eeb);if(_0x152eeb['error']){logger['error'](_0x1085('0x9'),_0x1085('0x3'),_0x2de96f,_0x152eeb[_0x1085('0xa')][_0x1085('0xb')],_0x3cbd88);return _0x3a528e(_0x152eeb[_0x1085('0xa')][_0x1085('0xb')]);}else{return _0x3b40fb(_0x152eeb['result']);}})[_0x1085('0xc')](function(_0x3d3ab0){logger[_0x1085('0xa')](_0x1085('0x9'),_0x1085('0x3'),_0x2de96f,_0x3d3ab0,_0x3cbd88);return _0x3a528e(_0x3d3ab0);});});};module[_0x1085('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 56826d1..d17f4c1 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 _0x34aa=['log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch'];(function(_0x2c5b65,_0x470b64){var _0xc3a0c0=function(_0x11a2b1){while(--_0x11a2b1){_0x2c5b65['push'](_0x2c5b65['shift']());}};_0xc3a0c0(++_0x470b64);}(_0x34aa,0x171));var _0xa34a=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0x34aa[_0x43026b];return _0x4a96cd;};'use strict';var BPromise=require(_0xa34a('0x0'));var server=require('./server');var Realtime=require(_0xa34a('0x1'));var EmailChannel=require(_0xa34a('0x2'));var mailAccount=require(_0xa34a('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xa34a('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0xa34a('0x5')](mailAccount[_0xa34a('0x6')]())[_0xa34a('0x5')](realtime[_0xa34a('0x7')]())[_0xa34a('0x5')](function(){email[_0xa34a('0x8')](realtime[_0xa34a('0x9')]);return realtime;});}function main(){return server[_0xa34a('0xa')](realtime,email)[_0xa34a('0x5')](function(_0x45f2b4){return initRealtime();})[_0xa34a('0x5')](function(_0x5c858b){return db[_0xa34a('0xb')][_0xa34a('0xc')]({'attributes':['id',_0xa34a('0xd')],'raw':!![]});})[_0xa34a('0x5')](function(_0x1e08cd){return setInterval(initRealtime,_0x1e08cd['loginMailFrequency']*0x3e8);})[_0xa34a('0xe')](function(_0x19dcfa){console[_0xa34a('0xf')](_0x19dcfa);});}main(); \ No newline at end of file +var _0xa87e=['bluebird','./server','./realtime','./lib/email','../../mysqldb','resolve','then','initMailAccounts','refresh','listen','Setting','findOne','loginMailFrequency','catch','log'];(function(_0xa0d7ac,_0x23735e){var _0x44d7b1=function(_0x14ccd0){while(--_0x14ccd0){_0xa0d7ac['push'](_0xa0d7ac['shift']());}};_0x44d7b1(++_0x23735e);}(_0xa87e,0x1c2));var _0xea87=function(_0xd8b31a,_0x3c5587){_0xd8b31a=_0xd8b31a-0x0;var _0xf7a539=_0xa87e[_0xd8b31a];return _0xf7a539;};'use strict';var BPromise=require(_0xea87('0x0'));var server=require(_0xea87('0x1'));var Realtime=require(_0xea87('0x2'));var EmailChannel=require(_0xea87('0x3'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xea87('0x4'))['db'];function initRealtime(){return BPromise[_0xea87('0x5')]()[_0xea87('0x6')](mailAccount['getMailAccounts']())[_0xea87('0x6')](realtime[_0xea87('0x7')]())[_0xea87('0x6')](function(){email[_0xea87('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xea87('0x9')](realtime,email)[_0xea87('0x6')](function(_0x284019){return initRealtime();})[_0xea87('0x6')](function(_0xe43a6a){return db[_0xea87('0xa')][_0xea87('0xb')]({'attributes':['id',_0xea87('0xc')],'raw':!![]});})[_0xea87('0x6')](function(_0x21fe1d){return setInterval(initRealtime,_0x21fe1d[_0xea87('0xc')]*0x3e8);})[_0xea87('0xd')](function(_0x558ea3){console[_0xea87('0xe')](_0x558ea3);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 37bf159..a98b8b6 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 _0xa684=['./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end','error','disabled','status','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','messageStatus','send','Smtp','verify','then','exports','lodash','moment','bluebird','ioredis','email','redis','defaults','localhost','socket.io-emitter','./imap'];(function(_0x5baf32,_0x103278){var _0x539cae=function(_0x43c0c2){while(--_0x43c0c2){_0x5baf32['push'](_0x5baf32['shift']());}};_0x539cae(++_0x103278);}(_0xa684,0x95));var _0x4a68=function(_0x2afb7e,_0x148615){_0x2afb7e=_0x2afb7e-0x0;var _0x16b067=_0xa684[_0x2afb7e];return _0x16b067;};'use strict';var _=require(_0x4a68('0x0'));var moment=require(_0x4a68('0x1'));var BPromise=require(_0x4a68('0x2'));var md5=require('md5');var Redis=require(_0x4a68('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4a68('0x4'));config[_0x4a68('0x5')]=_[_0x4a68('0x6')](config[_0x4a68('0x5')],{'host':_0x4a68('0x7'),'port':0x18eb});var io=require(_0x4a68('0x8'))(new Redis(config[_0x4a68('0x5')]));var EmailImap=require(_0x4a68('0x9'));var EmailSmtp=require(_0x4a68('0xa'));var mailAccount=require(_0x4a68('0xb'));var md5Accounts={};function EmailChannel(_0x440f78){logger[_0x4a68('0xc')]('start\x20email\x20channel');this[_0x4a68('0xd')]=_0x440f78[_0x4a68('0xd')];this[_0x4a68('0xe')]={};this[_0x4a68('0xf')]=new EmailSmtp();}EmailChannel[_0x4a68('0x10')][_0x4a68('0x11')]=function(_0x4b0e6e){var _0x3ef690=this[_0x4a68('0xd')][_0x4b0e6e];var _0x587944={'id':_0x3ef690['id'],'name':_0x3ef690[_0x4a68('0x12')],'key':_0x3ef690[_0x4a68('0x13')],'active':_0x3ef690['active'],'Imap':{'status':_0x3ef690[_0x4a68('0x14')]['status'],'messageStatus':_0x3ef690[_0x4a68('0x14')]['messageStatus'],'total':_0x3ef690[_0x4a68('0x14')]['total']}};if(_[_0x4a68('0x15')](md5Accounts[_0x4b0e6e])){md5Accounts[_0x4b0e6e]={};}var _0x270934=md5(JSON[_0x4a68('0x16')](_0x587944));if(md5Accounts[_0x4b0e6e][_0x4a68('0x17')]!==_0x270934){md5Accounts[_0x4b0e6e][_0x4a68('0x17')]=_0x270934;io['emit'](_0x4a68('0x18'),_0x587944);}};EmailChannel['prototype'][_0x4a68('0x19')]=function(_0x528519){for(var _0x4b3a3a in _0x528519){if(_0x528519[_0x4a68('0x1a')](_0x4b3a3a)){if(_0x528519[_0x4b3a3a]['Imap']&&_0x528519[_0x4b3a3a][_0x4a68('0x1b')]){var _0x43d40f=_0x528519[_0x4b3a3a]['Imap'];if(!this[_0x4a68('0xe')]['hasOwnProperty'](_0x43d40f['id'])){this[_0x4a68('0xe')][_0x43d40f['id']]=new EmailImap(_0x43d40f,_0x528519[_0x4b3a3a][_0x4a68('0x4')]);this[_0x4a68('0xe')][_0x43d40f['id']]['on'](_0x4a68('0x1c'),this[_0x4a68('0x1d')][_0x4a68('0x1e')](this,_0x4b3a3a));this['imapAccounts'][_0x43d40f['id']]['on'](_0x4a68('0x4'),this[_0x4a68('0x1f')][_0x4a68('0x1e')](this,_0x4b3a3a));this[_0x4a68('0xe')][_0x43d40f['id']]['on'](_0x4a68('0x20'),this['handleImapEnd'][_0x4a68('0x1e')](this,_0x4b3a3a));this[_0x4a68('0xe')][_0x43d40f['id']]['on'](_0x4a68('0x21'),this['handleImapError'][_0x4a68('0x1e')](this,_0x4b3a3a));}}else{if(_[_0x4a68('0x15')](this[_0x4a68('0xd')][_0x4b3a3a]['Imap'])){this[_0x4a68('0xd')][_0x4b3a3a][_0x4a68('0x14')]={};}this[_0x4a68('0xd')][_0x4b3a3a][_0x4a68('0x14')]['status']=_0x4a68('0x22');this[_0x4a68('0xd')][_0x4b3a3a][_0x4a68('0x14')]['messageStatus']='';this[_0x4a68('0x11')](_0x4b3a3a);}}}};EmailChannel[_0x4a68('0x10')][_0x4a68('0x1d')]=function(_0x562109,_0x4e82bd){if(this[_0x4a68('0xd')][_0x562109]){this[_0x4a68('0xd')][_0x562109]['Imap'][_0x4a68('0x23')]='connected';this[_0x4a68('0xd')][_0x562109]['Imap']['messageStatus']=_0x4e82bd[_0x4a68('0x12')];if(_0x4e82bd['messages']){this[_0x4a68('0xd')][_0x562109][_0x4a68('0x14')]['total']=_0x4e82bd['messages'][_0x4a68('0x24')];}return this['emit'](_0x562109);}};EmailChannel[_0x4a68('0x10')][_0x4a68('0x1f')]=function(_0x378a60,_0x47d5b1){logger[_0x4a68('0xc')](_0x4a68('0x25'),_0x47d5b1[_0x4a68('0x26')],_0x47d5b1['lastName'],_0x47d5b1[_0x4a68('0x27')],_0x378a60);if(this[_0x4a68('0xd')][_0x378a60]){return mailAccount[_0x4a68('0x28')](_0x378a60,_0x47d5b1)['then'](function(_0x21d390){if(_0x21d390){logger[_0x4a68('0xc')](_0x4a68('0x29'));}})[_0x4a68('0x2a')](function(_0x4401b8){logger['error'](_0x4a68('0x2b'),JSON[_0x4a68('0x16')](_0x4401b8));});}};EmailChannel[_0x4a68('0x10')][_0x4a68('0x2c')]=function(_0x370377){if(this[_0x4a68('0xd')][_0x370377]&&this['mailAccounts'][_0x370377]['Imap']){if(this[_0x4a68('0xe')][this[_0x4a68('0xd')][_0x370377]['Imap']['id']]){delete this[_0x4a68('0xe')][this[_0x4a68('0xd')][_0x370377][_0x4a68('0x14')]['id']];}this['mailAccounts'][_0x370377][_0x4a68('0x14')][_0x4a68('0x2d')]=moment();this['emit'](_0x370377);}};EmailChannel[_0x4a68('0x10')][_0x4a68('0x2e')]=function(_0x13b95f,_0x629498){if(this[_0x4a68('0xd')][_0x13b95f]){this['mailAccounts'][_0x13b95f][_0x4a68('0x14')]['status']=_0x4a68('0x21');this[_0x4a68('0xd')][_0x13b95f]['Imap'][_0x4a68('0x2f')]=_0x629498;return this[_0x4a68('0x11')](_0x13b95f);}};EmailChannel['prototype']['sendMail']=function(_0x2dbcef,_0x1bde59){return this[_0x4a68('0xf')][_0x4a68('0x30')](_0x2dbcef,_0x1bde59);};EmailChannel[_0x4a68('0x10')]['verifySmtp']=function(_0xf9e88e){var _0x2c556d=this;if(this[_0x4a68('0xd')][_0xf9e88e['id']]){if(_['isNil'](this[_0x4a68('0xd')][_0xf9e88e['id']][_0x4a68('0x31')])){this[_0x4a68('0xd')][_0xf9e88e['id']][_0x4a68('0x31')]={};}this[_0x4a68('0xd')][_0xf9e88e['id']][_0x4a68('0x31')][_0x4a68('0x2d')]=moment();return new BPromise(function(_0x5bd19e,_0x1591ee){return _0x2c556d[_0x4a68('0xf')][_0x4a68('0x32')](_0xf9e88e)[_0x4a68('0x33')](function(_0x27e582){_0x2c556d['mailAccounts'][_0xf9e88e['id']][_0x4a68('0x31')][_0x4a68('0x23')]='verified';_0x2c556d[_0x4a68('0xd')][_0xf9e88e['id']][_0x4a68('0x31')][_0x4a68('0x2f')]='';_0x2c556d['emit'](_0xf9e88e['id']);_0x5bd19e(_0x27e582);})[_0x4a68('0x2a')](function(_0x22731a){_0x2c556d[_0x4a68('0xd')][_0xf9e88e['id']]['Smtp'][_0x4a68('0x23')]=_0x4a68('0x21');_0x2c556d[_0x4a68('0xd')][_0xf9e88e['id']][_0x4a68('0x31')][_0x4a68('0x2f')]=_0x22731a;_0x2c556d['emit'](_0xf9e88e['id']);_0x1591ee(_0x22731a);});});}return this['smtp'][_0x4a68('0x32')](_0xf9e88e);};module[_0x4a68('0x34')]=EmailChannel; \ No newline at end of file +var _0xdfd4=['handleImapError','disabled','handleImapBox','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','md5','refresh','box','handleImapEmail','bind','end','handleImapEnd','error'];(function(_0xa4e5d1,_0xb470b3){var _0x4c0150=function(_0x1ec215){while(--_0x1ec215){_0xa4e5d1['push'](_0xa4e5d1['shift']());}};_0x4c0150(++_0xb470b3);}(_0xdfd4,0x16c));var _0x4dfd=function(_0x15f694,_0x302bd3){_0x15f694=_0x15f694-0x0;var _0x108252=_0xdfd4[_0x15f694];return _0x108252;};'use strict';var _=require(_0x4dfd('0x0'));var moment=require(_0x4dfd('0x1'));var BPromise=require(_0x4dfd('0x2'));var md5=require('md5');var Redis=require(_0x4dfd('0x3'));var config=require(_0x4dfd('0x4'));var logger=require(_0x4dfd('0x5'))(_0x4dfd('0x6'));config[_0x4dfd('0x7')]=_[_0x4dfd('0x8')](config[_0x4dfd('0x7')],{'host':_0x4dfd('0x9'),'port':0x18eb});var io=require(_0x4dfd('0xa'))(new Redis(config[_0x4dfd('0x7')]));var EmailImap=require(_0x4dfd('0xb'));var EmailSmtp=require(_0x4dfd('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x374c09){logger[_0x4dfd('0xd')](_0x4dfd('0xe'));this['mailAccounts']=_0x374c09[_0x4dfd('0xf')];this[_0x4dfd('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x4dfd('0x11')][_0x4dfd('0x12')]=function(_0x461b98){var _0xa528a8=this['mailAccounts'][_0x461b98];var _0x58e4c7={'id':_0xa528a8['id'],'name':_0xa528a8[_0x4dfd('0x13')],'key':_0xa528a8[_0x4dfd('0x14')],'active':_0xa528a8[_0x4dfd('0x15')],'Imap':{'status':_0xa528a8['Imap']['status'],'messageStatus':_0xa528a8[_0x4dfd('0x16')][_0x4dfd('0x17')],'total':_0xa528a8[_0x4dfd('0x16')][_0x4dfd('0x18')]}};if(_[_0x4dfd('0x19')](md5Accounts[_0x461b98])){md5Accounts[_0x461b98]={};}var _0x47fd6b=md5(JSON[_0x4dfd('0x1a')](_0x58e4c7));if(md5Accounts[_0x461b98][_0x4dfd('0x1b')]!==_0x47fd6b){md5Accounts[_0x461b98]['md5']=_0x47fd6b;io[_0x4dfd('0x12')]('mailAccount:update',_0x58e4c7);}};EmailChannel[_0x4dfd('0x11')][_0x4dfd('0x1c')]=function(_0x597826){for(var _0x3cd717 in _0x597826){if(_0x597826['hasOwnProperty'](_0x3cd717)){if(_0x597826[_0x3cd717]['Imap']&&_0x597826[_0x3cd717][_0x4dfd('0x15')]){var _0x1cd556=_0x597826[_0x3cd717][_0x4dfd('0x16')];if(!this[_0x4dfd('0x10')]['hasOwnProperty'](_0x1cd556['id'])){this[_0x4dfd('0x10')][_0x1cd556['id']]=new EmailImap(_0x1cd556,_0x597826[_0x3cd717]['email']);this[_0x4dfd('0x10')][_0x1cd556['id']]['on'](_0x4dfd('0x1d'),this['handleImapBox']['bind'](this,_0x3cd717));this[_0x4dfd('0x10')][_0x1cd556['id']]['on'](_0x4dfd('0x6'),this[_0x4dfd('0x1e')][_0x4dfd('0x1f')](this,_0x3cd717));this[_0x4dfd('0x10')][_0x1cd556['id']]['on'](_0x4dfd('0x20'),this[_0x4dfd('0x21')][_0x4dfd('0x1f')](this,_0x3cd717));this['imapAccounts'][_0x1cd556['id']]['on'](_0x4dfd('0x22'),this[_0x4dfd('0x23')]['bind'](this,_0x3cd717));}}else{if(_[_0x4dfd('0x19')](this[_0x4dfd('0xf')][_0x3cd717][_0x4dfd('0x16')])){this[_0x4dfd('0xf')][_0x3cd717]['Imap']={};}this[_0x4dfd('0xf')][_0x3cd717][_0x4dfd('0x16')]['status']=_0x4dfd('0x24');this[_0x4dfd('0xf')][_0x3cd717][_0x4dfd('0x16')][_0x4dfd('0x17')]='';this[_0x4dfd('0x12')](_0x3cd717);}}}};EmailChannel[_0x4dfd('0x11')][_0x4dfd('0x25')]=function(_0x34207d,_0x3f6227){if(this[_0x4dfd('0xf')][_0x34207d]){this[_0x4dfd('0xf')][_0x34207d]['Imap'][_0x4dfd('0x26')]=_0x4dfd('0x27');this[_0x4dfd('0xf')][_0x34207d][_0x4dfd('0x16')][_0x4dfd('0x17')]=_0x3f6227[_0x4dfd('0x13')];if(_0x3f6227[_0x4dfd('0x28')]){this[_0x4dfd('0xf')][_0x34207d][_0x4dfd('0x16')]['total']=_0x3f6227[_0x4dfd('0x28')]['total'];}return this['emit'](_0x34207d);}};EmailChannel[_0x4dfd('0x11')]['handleImapEmail']=function(_0x51c4c7,_0x24aa3c){logger[_0x4dfd('0xd')](_0x4dfd('0x29'),_0x24aa3c['firstName'],_0x24aa3c[_0x4dfd('0x2a')],_0x24aa3c['from'],_0x51c4c7);if(this['mailAccounts'][_0x51c4c7]){return mailAccount[_0x4dfd('0x2b')](_0x51c4c7,_0x24aa3c)[_0x4dfd('0x2c')](function(_0x19548d){if(_0x19548d){logger[_0x4dfd('0xd')](_0x4dfd('0x2d'));}})['catch'](function(_0x2713b1){logger[_0x4dfd('0x22')](_0x4dfd('0x2e'),JSON['stringify'](_0x2713b1));});}};EmailChannel[_0x4dfd('0x11')][_0x4dfd('0x21')]=function(_0x3e962a){if(this['mailAccounts'][_0x3e962a]&&this[_0x4dfd('0xf')][_0x3e962a][_0x4dfd('0x16')]){if(this[_0x4dfd('0x10')][this[_0x4dfd('0xf')][_0x3e962a][_0x4dfd('0x16')]['id']]){delete this[_0x4dfd('0x10')][this['mailAccounts'][_0x3e962a][_0x4dfd('0x16')]['id']];}this[_0x4dfd('0xf')][_0x3e962a][_0x4dfd('0x16')][_0x4dfd('0x2f')]=moment();this[_0x4dfd('0x12')](_0x3e962a);}};EmailChannel[_0x4dfd('0x11')][_0x4dfd('0x23')]=function(_0x4d4ba8,_0x10dff5){if(this['mailAccounts'][_0x4d4ba8]){this['mailAccounts'][_0x4d4ba8][_0x4dfd('0x16')][_0x4dfd('0x26')]=_0x4dfd('0x22');this[_0x4dfd('0xf')][_0x4d4ba8][_0x4dfd('0x16')][_0x4dfd('0x17')]=_0x10dff5;return this[_0x4dfd('0x12')](_0x4d4ba8);}};EmailChannel[_0x4dfd('0x11')][_0x4dfd('0x30')]=function(_0x42a86e,_0x1ac702){return this[_0x4dfd('0x31')][_0x4dfd('0x32')](_0x42a86e,_0x1ac702);};EmailChannel['prototype'][_0x4dfd('0x33')]=function(_0x312ac9){var _0x8bd5fc=this;if(this['mailAccounts'][_0x312ac9['id']]){if(_['isNil'](this[_0x4dfd('0xf')][_0x312ac9['id']][_0x4dfd('0x34')])){this[_0x4dfd('0xf')][_0x312ac9['id']][_0x4dfd('0x34')]={};}this[_0x4dfd('0xf')][_0x312ac9['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x4a5369,_0x1f7b89){return _0x8bd5fc[_0x4dfd('0x31')][_0x4dfd('0x35')](_0x312ac9)[_0x4dfd('0x2c')](function(_0x3961b4){_0x8bd5fc[_0x4dfd('0xf')][_0x312ac9['id']][_0x4dfd('0x34')]['status']=_0x4dfd('0x36');_0x8bd5fc[_0x4dfd('0xf')][_0x312ac9['id']]['Smtp'][_0x4dfd('0x17')]='';_0x8bd5fc[_0x4dfd('0x12')](_0x312ac9['id']);_0x4a5369(_0x3961b4);})[_0x4dfd('0x37')](function(_0x54172a){_0x8bd5fc['mailAccounts'][_0x312ac9['id']][_0x4dfd('0x34')][_0x4dfd('0x26')]='error';_0x8bd5fc[_0x4dfd('0xf')][_0x312ac9['id']][_0x4dfd('0x34')][_0x4dfd('0x17')]=_0x54172a;_0x8bd5fc[_0x4dfd('0x12')](_0x312ac9['id']);_0x1f7b89(_0x54172a);});});}return this['smtp'][_0x4dfd('0x35')](_0x312ac9);};module[_0x4dfd('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 6c0d043..f6bf085 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 _0x1a49=['parser','handleFetchEnd','stringify','textCode','upperFirst','exports','path','randomstring','mailparser','iconv','events','EventEmitter','email','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','bind','handleEnd','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','prototype','openBox','handleOpenBox','emit','box','end','readUnseen','fetch','message','handleFetchMessage','error','handleFetchError','closeBox','handleCloseBox','body','handleMessageBody','handleMessageAttributes','handleSimpleParser'];(function(_0x2833ff,_0x110d88){var _0x4dcf2a=function(_0x34029c){while(--_0x34029c){_0x2833ff['push'](_0x2833ff['shift']());}};_0x4dcf2a(++_0x110d88);}(_0x1a49,0x1c6));var _0x91a4=function(_0x4fd37e,_0x555d86){_0x4fd37e=_0x4fd37e-0x0;var _0x19a2f3=_0x1a49[_0x4fd37e];return _0x19a2f3;};'use strict';var fs=require('fs');var path=require(_0x91a4('0x0'));var util=require('util');var Imap=require('imap');var _=require('lodash');var rs=require(_0x91a4('0x1'));var simpleParser=require(_0x91a4('0x2'))['simpleParser'];var Iconv=require(_0x91a4('0x3'))['Iconv'];var EventEmitter=require(_0x91a4('0x4'))[_0x91a4('0x5')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x91a4('0x6'));function EmailImap(_0xf91193,_0x38f575){this[_0x91a4('0x7')]=_0x91a4('0x8');this[_0x91a4('0x9')]=this[_0x91a4('0xa')](_0xf91193,_0x38f575);this['imap']=new Imap(this[_0x91a4('0x9')]);this[_0x91a4('0xb')][_0x91a4('0xc')](_0x91a4('0xd'),this[_0x91a4('0xe')][_0x91a4('0xf')](this));this['imap'][_0x91a4('0xc')]('end',this[_0x91a4('0x10')][_0x91a4('0xf')](this));this[_0x91a4('0xb')]['on']('error',this[_0x91a4('0x11')][_0x91a4('0xf')](this));this[_0x91a4('0xb')][_0x91a4('0x12')]();}util[_0x91a4('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0x91a4('0xa')]=function(_0x5a3565,_0x204151){var _0x3acc20={'connTimeout':_0x5a3565['connTimeout']?_0x5a3565[_0x91a4('0x14')]*0x3e8:0x2710,'authTimeout':_0x5a3565[_0x91a4('0x15')]?_0x5a3565[_0x91a4('0x15')]*0x3e8:0x1388};if(_[_0x91a4('0x16')](_0x5a3565[_0x91a4('0x17')])){if(_0x5a3565[_0x91a4('0x18')]){_0x3acc20[_0x91a4('0x19')]=_0x5a3565[_0x91a4('0x19')];_0x3acc20['password']=_0x5a3565[_0x91a4('0x1a')];}_0x3acc20[_0x91a4('0x1b')]=_0x5a3565[_0x91a4('0x1b')];_0x3acc20[_0x91a4('0x1c')]=_0x5a3565[_0x91a4('0x1c')]||0x3e1;if(_0x5a3565[_0x91a4('0x1d')]){_0x3acc20['tls']=!![];}else{_0x3acc20[_0x91a4('0x1d')]=![];_0x3acc20[_0x91a4('0x1e')]=_0x91a4('0x1f');}}else{_0x3acc20['user']=_0x5a3565['user'];_0x3acc20['password']=_0x5a3565[_0x91a4('0x1a')];_0x3acc20[_0x91a4('0x1b')]=utils['getHost'](_0x5a3565['service']);_0x3acc20['port']=0x3e1;_0x3acc20[_0x91a4('0x1d')]=!![];}_0x3acc20['email']=_0x204151||_0x5a3565[_0x91a4('0x19')]||'anonymous@xcally.com';return _0x3acc20;};EmailImap[_0x91a4('0x20')][_0x91a4('0xe')]=function(){this[_0x91a4('0xb')][_0x91a4('0x21')](this['mailbox'],![],this['handleOpenBox']['bind'](this));};EmailImap['prototype'][_0x91a4('0x22')]=function(_0x149512,_0x53903c){if(_0x149512){this[_0x91a4('0x11')](_0x149512,!![]);}else{this[_0x91a4('0x23')](_0x91a4('0x24'),_0x53903c);this['readUnseen']();}};EmailImap[_0x91a4('0x20')]['handleCloseBox']=function(_0x53cdab){if(_0x53cdab){this['handleError'](_0x53cdab,!![]);}else{this[_0x91a4('0xb')][_0x91a4('0x25')]();}};EmailImap[_0x91a4('0x20')][_0x91a4('0x26')]=function(){this[_0x91a4('0xb')]['search'](['UNSEEN'],this['handleReadUnseen'][_0x91a4('0xf')](this));};EmailImap[_0x91a4('0x20')]['handleReadUnseen']=function(_0x4d62c7,_0x4bbd56){if(_0x4d62c7){this['handleError'](_0x4d62c7,!![]);}else{if(_0x4bbd56['length']){try{var _0x47afd5=this[_0x91a4('0xb')][_0x91a4('0x27')](_0x4bbd56,{'bodies':'','markSeen':!![]});_0x47afd5['on'](_0x91a4('0x28'),this[_0x91a4('0x29')]['bind'](this));_0x47afd5[_0x91a4('0xc')](_0x91a4('0x2a'),this[_0x91a4('0x2b')][_0x91a4('0xf')](this));_0x47afd5[_0x91a4('0xc')](_0x91a4('0x25'),this['handleFetchEnd'][_0x91a4('0xf')](this));}catch(_0x510e4b){logger[_0x91a4('0x2a')](_0x510e4b);}}else{this['imap'][_0x91a4('0x2c')](!![],this[_0x91a4('0x2d')]['bind'](this));}}};EmailImap['prototype'][_0x91a4('0x29')]=function(_0x4d42c2,_0x5dacc9){_0x4d42c2['on'](_0x91a4('0x2e'),this[_0x91a4('0x2f')]['bind'](this));_0x4d42c2[_0x91a4('0xc')]('attributes',this[_0x91a4('0x30')][_0x91a4('0xf')](this));_0x4d42c2[_0x91a4('0xc')]('end',this['handleMessageEnd'][_0x91a4('0xf')](this));};EmailImap[_0x91a4('0x20')]['handleMessageBody']=function(_0x1b2c48,_0x5c9375){simpleParser(_0x1b2c48,{'Iconv':Iconv},this[_0x91a4('0x31')]['bind'](this));};EmailImap[_0x91a4('0x20')][_0x91a4('0x30')]=function(_0x1963c9){};EmailImap[_0x91a4('0x20')]['handleMessageEnd']=function(){};EmailImap[_0x91a4('0x20')][_0x91a4('0x31')]=function(_0x477f75,_0x3f0320){if(_0x477f75){logger[_0x91a4('0x2a')](_0x477f75);}else{var _0x4ab7f7=this;utils[_0x91a4('0x32')](this[_0x91a4('0x9')],_0x3f0320,function(_0x7efa18){_0x4ab7f7[_0x91a4('0x23')](_0x91a4('0x6'),_0x7efa18);});}};EmailImap[_0x91a4('0x20')][_0x91a4('0x33')]=function(){this[_0x91a4('0xb')][_0x91a4('0x2c')](!![],this[_0x91a4('0x2d')][_0x91a4('0xf')](this));};EmailImap[_0x91a4('0x20')]['handleFetchError']=function(_0x431615){this[_0x91a4('0x11')](_0x431615);this[_0x91a4('0xb')][_0x91a4('0x2c')](!![],this[_0x91a4('0x2d')]['bind'](this));};EmailImap[_0x91a4('0x20')][_0x91a4('0x10')]=function(){this[_0x91a4('0x23')](_0x91a4('0x25'));};EmailImap[_0x91a4('0x20')][_0x91a4('0x11')]=function(_0x352ace,_0x5ee0a8){logger['error'](_0x91a4('0x11'),this[_0x91a4('0x9')][_0x91a4('0x6')],JSON[_0x91a4('0x34')](_0x352ace));var _0x16f800='';if(_0x352ace){if(_0x352ace['textCode']){_0x16f800=_0x352ace[_0x91a4('0x35')];}else{for(var _0x1d651d in _0x352ace){if(_0x352ace['hasOwnProperty'](_0x1d651d)){_0x16f800+=_[_0x91a4('0x36')](_0x1d651d)+':\x20'+_0x352ace[_0x1d651d]+'\x0a';}}}}if(_0x5ee0a8){this[_0x91a4('0xb')][_0x91a4('0x25')]();}else{this[_0x91a4('0x23')](_0x91a4('0x2a'),_0x16f800);this['emit'](_0x91a4('0x25'));}};module[_0x91a4('0x37')]=EmailImap; \ No newline at end of file +var _0xcff6=['Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','handleReady','end','handleEnd','handleError','bind','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','getHost','anonymous@xcally.com','openBox','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','once','error','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','account','closeBox','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','emit','path','util','imap','lodash','randomstring','mailparser','iconv'];(function(_0x566d0a,_0x23882d){var _0x3b0ce0=function(_0xc92d15){while(--_0xc92d15){_0x566d0a['push'](_0x566d0a['shift']());}};_0x3b0ce0(++_0x23882d);}(_0xcff6,0x12f));var _0x6cff=function(_0x186810,_0x399556){_0x186810=_0x186810-0x0;var _0x52452f=_0xcff6[_0x186810];return _0x52452f;};'use strict';var fs=require('fs');var path=require(_0x6cff('0x0'));var util=require(_0x6cff('0x1'));var Imap=require(_0x6cff('0x2'));var _=require(_0x6cff('0x3'));var rs=require(_0x6cff('0x4'));var simpleParser=require(_0x6cff('0x5'))['simpleParser'];var Iconv=require(_0x6cff('0x6'))[_0x6cff('0x7')];var EventEmitter=require(_0x6cff('0x8'))[_0x6cff('0x9')];var utils=require(_0x6cff('0xa'));var logger=require(_0x6cff('0xb'))(_0x6cff('0xc'));function EmailImap(_0x4b610c,_0x280837){this[_0x6cff('0xd')]=_0x6cff('0xe');this['account']=this['getAccount'](_0x4b610c,_0x280837);this[_0x6cff('0x2')]=new Imap(this['account']);this[_0x6cff('0x2')]['once']('ready',this[_0x6cff('0xf')]['bind'](this));this[_0x6cff('0x2')]['once'](_0x6cff('0x10'),this[_0x6cff('0x11')]['bind'](this));this[_0x6cff('0x2')]['on']('error',this[_0x6cff('0x12')][_0x6cff('0x13')](this));this['imap']['connect']();}util[_0x6cff('0x14')](EmailImap,EventEmitter);EmailImap[_0x6cff('0x15')]['getAccount']=function(_0x3eaf98,_0x28a2a6){var _0x51c243={'connTimeout':_0x3eaf98[_0x6cff('0x16')]?_0x3eaf98[_0x6cff('0x16')]*0x3e8:0x2710,'authTimeout':_0x3eaf98[_0x6cff('0x17')]?_0x3eaf98[_0x6cff('0x17')]*0x3e8:0x1388};if(_[_0x6cff('0x18')](_0x3eaf98[_0x6cff('0x19')])){if(_0x3eaf98[_0x6cff('0x1a')]){_0x51c243[_0x6cff('0x1b')]=_0x3eaf98[_0x6cff('0x1b')];_0x51c243[_0x6cff('0x1c')]=_0x3eaf98[_0x6cff('0x1c')];}_0x51c243[_0x6cff('0x1d')]=_0x3eaf98[_0x6cff('0x1d')];_0x51c243[_0x6cff('0x1e')]=_0x3eaf98[_0x6cff('0x1e')]||0x3e1;if(_0x3eaf98['tls']){_0x51c243[_0x6cff('0x1f')]=!![];}else{_0x51c243[_0x6cff('0x1f')]=![];_0x51c243['autotls']='required';}}else{_0x51c243[_0x6cff('0x1b')]=_0x3eaf98['user'];_0x51c243[_0x6cff('0x1c')]=_0x3eaf98['password'];_0x51c243[_0x6cff('0x1d')]=utils[_0x6cff('0x20')](_0x3eaf98[_0x6cff('0x19')]);_0x51c243['port']=0x3e1;_0x51c243[_0x6cff('0x1f')]=!![];}_0x51c243['email']=_0x28a2a6||_0x3eaf98['user']||_0x6cff('0x21');return _0x51c243;};EmailImap[_0x6cff('0x15')][_0x6cff('0xf')]=function(){this['imap'][_0x6cff('0x22')](this[_0x6cff('0xd')],![],this['handleOpenBox'][_0x6cff('0x13')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x16e287,_0x58920f){if(_0x16e287){this[_0x6cff('0x12')](_0x16e287,!![]);}else{this['emit']('box',_0x58920f);this[_0x6cff('0x23')]();}};EmailImap[_0x6cff('0x15')][_0x6cff('0x24')]=function(_0x17e862){if(_0x17e862){this[_0x6cff('0x12')](_0x17e862,!![]);}else{this[_0x6cff('0x2')]['end']();}};EmailImap[_0x6cff('0x15')][_0x6cff('0x23')]=function(){this[_0x6cff('0x2')][_0x6cff('0x25')]([_0x6cff('0x26')],this[_0x6cff('0x27')][_0x6cff('0x13')](this));};EmailImap[_0x6cff('0x15')]['handleReadUnseen']=function(_0x424f49,_0x4cc3d9){if(_0x424f49){this[_0x6cff('0x12')](_0x424f49,!![]);}else{if(_0x4cc3d9[_0x6cff('0x28')]){try{var _0x18cb3a=this[_0x6cff('0x2')][_0x6cff('0x29')](_0x4cc3d9,{'bodies':'','markSeen':!![]});_0x18cb3a['on'](_0x6cff('0x2a'),this[_0x6cff('0x2b')][_0x6cff('0x13')](this));_0x18cb3a[_0x6cff('0x2c')](_0x6cff('0x2d'),this['handleFetchError'][_0x6cff('0x13')](this));_0x18cb3a[_0x6cff('0x2c')](_0x6cff('0x10'),this[_0x6cff('0x2e')][_0x6cff('0x13')](this));}catch(_0x12caeb){logger[_0x6cff('0x2d')](_0x12caeb);}}else{this['imap']['closeBox'](!![],this[_0x6cff('0x24')][_0x6cff('0x13')](this));}}};EmailImap[_0x6cff('0x15')][_0x6cff('0x2b')]=function(_0x2c63b3,_0x6f806b){_0x2c63b3['on'](_0x6cff('0x2f'),this[_0x6cff('0x30')][_0x6cff('0x13')](this));_0x2c63b3[_0x6cff('0x2c')](_0x6cff('0x31'),this[_0x6cff('0x32')][_0x6cff('0x13')](this));_0x2c63b3[_0x6cff('0x2c')](_0x6cff('0x10'),this['handleMessageEnd'][_0x6cff('0x13')](this));};EmailImap['prototype'][_0x6cff('0x30')]=function(_0x36f613,_0xa6164f){simpleParser(_0x36f613,{'Iconv':Iconv},this[_0x6cff('0x33')][_0x6cff('0x13')](this));};EmailImap[_0x6cff('0x15')]['handleMessageAttributes']=function(_0x272419){};EmailImap['prototype'][_0x6cff('0x34')]=function(){};EmailImap[_0x6cff('0x15')]['handleSimpleParser']=function(_0x466a9d,_0x15ecff){if(_0x466a9d){logger['error'](_0x466a9d);}else{var _0x206c7a=this;utils[_0x6cff('0x35')](this[_0x6cff('0x36')],_0x15ecff,function(_0x4993a7){_0x206c7a['emit'](_0x6cff('0xc'),_0x4993a7);});}};EmailImap['prototype'][_0x6cff('0x2e')]=function(){this['imap'][_0x6cff('0x37')](!![],this[_0x6cff('0x24')][_0x6cff('0x13')](this));};EmailImap[_0x6cff('0x15')][_0x6cff('0x38')]=function(_0x385c5e){this[_0x6cff('0x12')](_0x385c5e);this['imap'][_0x6cff('0x37')](!![],this[_0x6cff('0x24')][_0x6cff('0x13')](this));};EmailImap[_0x6cff('0x15')][_0x6cff('0x11')]=function(){this['emit'](_0x6cff('0x10'));};EmailImap[_0x6cff('0x15')][_0x6cff('0x12')]=function(_0x4a044d,_0x16683d){logger[_0x6cff('0x2d')](_0x6cff('0x12'),this['account'][_0x6cff('0xc')],JSON[_0x6cff('0x39')](_0x4a044d));var _0x23c000='';if(_0x4a044d){if(_0x4a044d[_0x6cff('0x3a')]){_0x23c000=_0x4a044d['textCode'];}else{for(var _0x169a3c in _0x4a044d){if(_0x4a044d[_0x6cff('0x3b')](_0x169a3c)){_0x23c000+=_[_0x6cff('0x3c')](_0x169a3c)+':\x20'+_0x4a044d[_0x169a3c]+'\x0a';}}}}if(_0x16683d){this['imap'][_0x6cff('0x10')]();}else{this['emit'](_0x6cff('0x2d'),_0x23c000);this[_0x6cff('0x3d')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8b4620c..aa03866 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 _0x98a5=['verify','toString','Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','sendMail','prototype'];(function(_0x5c0232,_0x1c449f){var _0x589366=function(_0x31cd62){while(--_0x31cd62){_0x5c0232['push'](_0x5c0232['shift']());}};_0x589366(++_0x1c449f);}(_0x98a5,0x189));var _0x598a=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x98a5[_0x396466];return _0x5e9ab4;};'use strict';var nodemailer=require(_0x598a('0x0'));var BPromise=require(_0x598a('0x1'));var inlineBase64=require(_0x598a('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x598a('0x3')]=function(_0x382980,_0x65b79e){return new BPromise(function(_0x46518b,_0x140f8a){var _0x1ccbc4=nodemailer[_0x598a('0x4')](_0x382980);_0x1ccbc4['use']('compile',inlineBase64());_0x1ccbc4[_0x598a('0x5')](_0x65b79e,function(_0x310f0e,_0x5cd0c4){if(_0x310f0e){_0x140f8a(_0x310f0e['toString']());}else{_0x46518b(_0x5cd0c4);}});});};EmailSmtp[_0x598a('0x6')][_0x598a('0x7')]=function(_0x2e45ea){return new BPromise(function(_0x522ebc,_0x11f67c){var _0x8e54ad=nodemailer[_0x598a('0x4')](_0x2e45ea);_0x8e54ad[_0x598a('0x7')](function(_0x207742,_0x5ae3ab){if(_0x207742){_0x11f67c(_0x207742[_0x598a('0x8')]());}else{if(_0x5ae3ab){_0x522ebc(_0x5ae3ab);}else{_0x11f67c(_0x598a('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xb0bf=['sendMail','toString','Not\x20verifired','nodemailer','bluebird','nodemailer-plugin-inline-base64','createTransport','compile'];(function(_0x1b82ed,_0x14bf3c){var _0x234394=function(_0x28c472){while(--_0x28c472){_0x1b82ed['push'](_0x1b82ed['shift']());}};_0x234394(++_0x14bf3c);}(_0xb0bf,0xbb));var _0xfb0b=function(_0xee4ef5,_0x5685b5){_0xee4ef5=_0xee4ef5-0x0;var _0x4a87b6=_0xb0bf[_0xee4ef5];return _0x4a87b6;};'use strict';var nodemailer=require(_0xfb0b('0x0'));var BPromise=require(_0xfb0b('0x1'));var inlineBase64=require(_0xfb0b('0x2'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x3d78e0,_0x46218f){return new BPromise(function(_0x59309e,_0x520094){var _0x3c4904=nodemailer[_0xfb0b('0x3')](_0x3d78e0);_0x3c4904['use'](_0xfb0b('0x4'),inlineBase64());_0x3c4904[_0xfb0b('0x5')](_0x46218f,function(_0x510d39,_0x16cf3d){if(_0x510d39){_0x520094(_0x510d39[_0xfb0b('0x6')]());}else{_0x59309e(_0x16cf3d);}});});};EmailSmtp['prototype']['verify']=function(_0x3615cb){return new BPromise(function(_0x2dcd15,_0x59005f){var _0x3e997e=nodemailer[_0xfb0b('0x3')](_0x3615cb);_0x3e997e['verify'](function(_0x16b8fd,_0x14b019){if(_0x16b8fd){_0x59005f(_0x16b8fd[_0xfb0b('0x6')]());}else{if(_0x14b019){_0x2dcd15(_0x14b019);}else{_0x59005f(_0xfb0b('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e31a59f..236d47f 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 _0x0594=['originTo','originCc','includes','bcc','attachments','attach','attachment','filename','attachment-','format','%s-%s','join','writeFileSync','push','contentType','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','content','BodyHTML','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','name','split','length','slice','Anonymous','value','pop','isEmpty','@xcally.com','html','test','replace','body','textAsHtml','0x1?_0x324d76[_0x4059('0x11')]():'';}return'';}function getMails(_0x4541df,_0x3334bf){var _0x17f5c3='';for(var _0x240060=0x0;_0x240060<_0x3334bf['value'][_0x4059('0xd')];_0x240060+=0x1){if(_0x3334bf[_0x4059('0x10')][_0x240060]['address']!==_0x4541df){if(!_[_0x4059('0x12')](_0x17f5c3)){_0x17f5c3+=',';}_0x17f5c3+=_0x3334bf[_0x4059('0x10')][_0x240060]['name']||_0x3334bf[_0x4059('0x10')][_0x240060]['address']||'';_0x17f5c3+='\x20<';_0x17f5c3+=_0x3334bf[_0x4059('0x10')][_0x240060]['address']?_0x3334bf[_0x4059('0x10')][_0x240060][_0x4059('0x8')]:_0x4059('0x9')+random[_0x4059('0xa')](0x6)+_0x4059('0x13');_0x17f5c3+='>';}}return _0x17f5c3;}function parseEmail(_0x480ad0,_0x36c66b,_0x24cbcb){if(_0x36c66b[_0x4059('0x14')]){var _0xab5a2d=/)<[^<]*)*<\/script>/gi;while(_0xab5a2d[_0x4059('0x15')](_0x36c66b[_0x4059('0x14')])){_0x36c66b[_0x4059('0x14')]=_0x36c66b[_0x4059('0x14')][_0x4059('0x16')](_0xab5a2d,'');}_0x24cbcb[_0x4059('0x17')]=_0x36c66b[_0x4059('0x14')];}else{_0x24cbcb['body']=_0x36c66b[_0x4059('0x18')];}if(_0x24cbcb[_0x4059('0x17')]){_0x24cbcb[_0x4059('0x17')]=_0x24cbcb[_0x4059('0x17')][_0x4059('0x16')](/Empty\x20message

';if(_0x259e7d[_0x4059('0x37')]){for(var _0x3db832=0x0;_0x3db832<_0x259e7d[_0x4059('0x37')]['length'];_0x3db832++){var _0x3cca2e=_0x259e7d[_0x4059('0x37')][_0x3db832];_0x3342c2['message']['attachments'][_0x4059('0x28')]({'filename':_0x3cca2e[_0x4059('0x38')],'content':new Buffer(_0x3cca2e[_0x4059('0x39')])});}}}_0x16d7aa(parseEmail(_0x4686c6,_0x40f1bf,_0x3342c2));});}else{_0x40f1bf['html']='

Empty\x20message

';_0x16d7aa(parseEmail(_0x4686c6,_0x40f1bf,_0x3342c2));}}else{_0x16d7aa(parseEmail(_0x4686c6,_0x40f1bf,_0x3342c2));}};exports[_0x4059('0x3a')]=function(_0x2966c2){switch(_0x2966c2){case _0x4059('0x3b'):return _0x4059('0x3c');case _0x4059('0x3d'):return _0x4059('0x3e');case _0x4059('0x3f'):return'imap-mail.outlook.com';case _0x4059('0x40'):return _0x4059('0x41');}return _0x4059('0x42');}; \ No newline at end of file +var _0x276f=['application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','Attachments','Data','

Empty\x20message

','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','127.0.0.1','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','address','generate','value','name','split','length','slice','head','pop','isEmpty','anonymous','html','test','replace','body','textAsHtml','message','originTo','originCc','includes','bcc','attachments','attach','attachment','attachment-','format','%s-%s','root','content','contentType','parser','from','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x276f,0xff));var _0xf276=function(_0x105dd5,_0x14e2c0){_0x105dd5=_0x105dd5-0x0;var _0x188b8b=_0x276f[_0x105dd5];return _0x188b8b;};'use strict';var _=require(_0xf276('0x0'));var moment=require('moment');var random=require(_0xf276('0x1'));var fs=require('fs');var path=require(_0xf276('0x2'));var util=require(_0xf276('0x3'));var tnef=require(_0xf276('0x4'));var logger=require(_0xf276('0x5'))(_0xf276('0x6'));var config=require(_0xf276('0x7'));function getAddress(_0x593266){var _0x59b238=_['head'](_0x593266['value']);return _0x59b238&&_0x59b238[_0xf276('0x8')]?_0x59b238[_0xf276('0x8')]:'anonymous'+random[_0xf276('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x58ce9c){var _0x4b414f=_['head'](_0x58ce9c[_0xf276('0xa')]);if(_0x4b414f&&_0x4b414f[_0xf276('0xb')]){var _0x32ea2b=_0x4b414f['name'][_0xf276('0xc')](/\s+/);return _0x32ea2b[_0xf276('0xd')]?_0x32ea2b[_0xf276('0xe')](0x0,-0x1)['join']('\x20'):_0x4b414f[_0xf276('0xb')];}return'Anonymous';}function getLastName(_0x53e5ac){var _0x4dac9a=_[_0xf276('0xf')](_0x53e5ac[_0xf276('0xa')]);if(_0x4dac9a&&_0x4dac9a['name']){var _0x289cda=_0x4dac9a[_0xf276('0xb')]['split'](/\s+/);return _0x289cda[_0xf276('0xd')]>0x1?_0x289cda[_0xf276('0x10')]():'';}return'';}function getMails(_0x2a4e00,_0x5dada0){var _0x2ebb0f='';for(var _0x3169d6=0x0;_0x3169d6<_0x5dada0[_0xf276('0xa')][_0xf276('0xd')];_0x3169d6+=0x1){if(_0x5dada0[_0xf276('0xa')][_0x3169d6][_0xf276('0x8')]!==_0x2a4e00){if(!_[_0xf276('0x11')](_0x2ebb0f)){_0x2ebb0f+=',';}_0x2ebb0f+=_0x5dada0[_0xf276('0xa')][_0x3169d6][_0xf276('0xb')]||_0x5dada0[_0xf276('0xa')][_0x3169d6][_0xf276('0x8')]||'';_0x2ebb0f+='\x20<';_0x2ebb0f+=_0x5dada0[_0xf276('0xa')][_0x3169d6][_0xf276('0x8')]?_0x5dada0[_0xf276('0xa')][_0x3169d6][_0xf276('0x8')]:_0xf276('0x12')+random[_0xf276('0x9')](0x6)+'@xcally.com';_0x2ebb0f+='>';}}return _0x2ebb0f;}function parseEmail(_0x204781,_0x108a6f,_0x5929bc){if(_0x108a6f[_0xf276('0x13')]){var _0x37ac12=/)<[^<]*)*<\/script>/gi;while(_0x37ac12[_0xf276('0x14')](_0x108a6f['html'])){_0x108a6f['html']=_0x108a6f[_0xf276('0x13')][_0xf276('0x15')](_0x37ac12,'');}_0x5929bc[_0xf276('0x16')]=_0x108a6f['html'];}else{_0x5929bc[_0xf276('0x16')]=_0x108a6f[_0xf276('0x17')];}if(_0x5929bc[_0xf276('0x16')]){_0x5929bc[_0xf276('0x16')]=_0x5929bc[_0xf276('0x16')][_0xf276('0x15')](/Empty\x20message

';if(_0x2ae6da[_0xf276('0x31')]){for(var _0x29075f=0x0;_0x29075f<_0x2ae6da['Attachments'][_0xf276('0xd')];_0x29075f++){var _0x62a461=_0x2ae6da[_0xf276('0x31')][_0x29075f];_0x3e3be1['message']['attachments']['push']({'filename':_0x62a461['Title'],'content':new Buffer(_0x62a461[_0xf276('0x32')])});}}}_0x5aeb65(parseEmail(_0x264636,_0x132280,_0x3e3be1));});}else{_0x132280[_0xf276('0x13')]=_0xf276('0x33');_0x5aeb65(parseEmail(_0x264636,_0x132280,_0x3e3be1));}}else{_0x5aeb65(parseEmail(_0x264636,_0x132280,_0x3e3be1));}};exports[_0xf276('0x34')]=function(_0x4f2bc5){switch(_0x4f2bc5){case _0xf276('0x35'):return _0xf276('0x36');case _0xf276('0x37'):return _0xf276('0x38');case _0xf276('0x39'):return'imap-mail.outlook.com';case'outlook365':return _0xf276('0x3a');}return _0xf276('0x3b');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a80219b..7b0a505 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x784a=['name','Service','key','SERV','Imap','Smtp','lodash'];(function(_0x219ec9,_0x304727){var _0x29389e=function(_0x111bbc){while(--_0x111bbc){_0x219ec9['push'](_0x219ec9['shift']());}};_0x29389e(++_0x304727);}(_0x784a,0x13a));var _0xa784=function(_0xea73f,_0x4d4ce7){_0xea73f=_0xea73f-0x0;var _0x7ee2e9=_0x784a[_0xea73f];return _0x7ee2e9;};'use strict';var _=require(_0xa784('0x0'));function MailAccount(_0x5144be){this['id']=_0x5144be['id']||0x0;this[_0xa784('0x1')]=_0x5144be['name']||_0xa784('0x2');this[_0xa784('0x3')]=_0x5144be['key']||_0xa784('0x4');this['active']=_0x5144be['active']||![];this[_0xa784('0x5')]=_0x5144be[_0xa784('0x5')]||[];this[_0xa784('0x6')]=_0x5144be[_0xa784('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x4d9f=['key','SERV','active','Imap','Smtp','name','Service'];(function(_0x59cebe,_0x4a9630){var _0x5ba141=function(_0x126e4d){while(--_0x126e4d){_0x59cebe['push'](_0x59cebe['shift']());}};_0x5ba141(++_0x4a9630);}(_0x4d9f,0x116));var _0xf4d9=function(_0x158b43,_0xd1017a){_0x158b43=_0x158b43-0x0;var _0x382c65=_0x4d9f[_0x158b43];return _0x382c65;};'use strict';var _=require('lodash');function MailAccount(_0x35238f){this['id']=_0x35238f['id']||0x0;this[_0xf4d9('0x0')]=_0x35238f[_0xf4d9('0x0')]||_0xf4d9('0x1');this['key']=_0x35238f[_0xf4d9('0x2')]||_0xf4d9('0x3');this[_0xf4d9('0x4')]=_0x35238f[_0xf4d9('0x4')]||![];this[_0xf4d9('0x5')]=_0x35238f[_0xf4d9('0x5')]||[];this[_0xf4d9('0x6')]=_0x35238f[_0xf4d9('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 0830e98..d7606c4 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86c8=['length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x86c8,0x1bb));var _0x886c=function(_0x541d02,_0x6c8fd9){_0x541d02=_0x541d02-0x0;var _0x5afb72=_0x86c8[_0x541d02];return _0x5afb72;};'use strict';var _=require(_0x886c('0x0'));var MailAccount=require(_0x886c('0x1'));var Realtime=function(){this[_0x886c('0x2')]={};};function freeIsNotKey(_0x293875,_0x24a86d,_0x210c37){var _0x234beb=_[_0x886c('0x3')](_0x293875,function(_0x56fd9c,_0x2398d3){return _0x56fd9c[_0x210c37];});for(var _0x196a93 in _0x24a86d){if(_0x24a86d[_0x886c('0x4')](_0x196a93)){if(!_0x234beb[_0x196a93]){delete _0x24a86d[_0x196a93];}}}}Realtime[_0x886c('0x5')][_0x886c('0x6')]=function(_0x1def5c,_0x56fdb9){for(var _0x729346 in _0x56fdb9){if(_0x1def5c[_0x886c('0x4')](_0x729346)){_0x1def5c[_0x729346]=_0x56fdb9[_0x729346];}}};Realtime[_0x886c('0x5')][_0x886c('0x7')]=function(){var _0x2fd1f4=this;return function(_0x3dcd01){if(_0x3dcd01){freeIsNotKey(_0x3dcd01,_0x2fd1f4[_0x886c('0x2')],'id');for(var _0x3b5942=0x0,_0x4165db={},_0x43a811={};_0x3b5942<_0x3dcd01[_0x886c('0x8')];_0x3b5942+=0x1){_0x4165db=_0x3dcd01[_0x3b5942];if(_[_0x886c('0x9')](_0x2fd1f4[_0x886c('0x2')][_0x4165db['id']])){_0x2fd1f4[_0x886c('0x2')][_0x4165db['id']]=new MailAccount(_0x4165db);}else{_[_0x886c('0xa')](_0x2fd1f4[_0x886c('0x2')][_0x4165db['id']],_0x4165db);}}}return _0x2fd1f4[_0x886c('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0x1f57=['length','mailAccounts','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x2148ed,_0x5094d5){var _0x146fa8=function(_0x17acf4){while(--_0x17acf4){_0x2148ed['push'](_0x2148ed['shift']());}};_0x146fa8(++_0x5094d5);}(_0x1f57,0xf4));var _0x71f5=function(_0x2b8971,_0x581f63){_0x2b8971=_0x2b8971-0x0;var _0x1aaddc=_0x1f57[_0x2b8971];return _0x1aaddc;};'use strict';var _=require(_0x71f5('0x0'));var MailAccount=require(_0x71f5('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5a1c94,_0x76ac3d,_0x2a60d0){var _0x1c7404=_[_0x71f5('0x2')](_0x5a1c94,function(_0x89863d,_0x2af1b3){return _0x89863d[_0x2a60d0];});for(var _0x29b614 in _0x76ac3d){if(_0x76ac3d[_0x71f5('0x3')](_0x29b614)){if(!_0x1c7404[_0x29b614]){delete _0x76ac3d[_0x29b614];}}}}Realtime[_0x71f5('0x4')][_0x71f5('0x5')]=function(_0x1c0bc3,_0x5e8ffd){for(var _0x529b0f in _0x5e8ffd){if(_0x1c0bc3[_0x71f5('0x3')](_0x529b0f)){_0x1c0bc3[_0x529b0f]=_0x5e8ffd[_0x529b0f];}}};Realtime[_0x71f5('0x4')]['initMailAccounts']=function(){var _0x1712a1=this;return function(_0x43ee5c){if(_0x43ee5c){freeIsNotKey(_0x43ee5c,_0x1712a1['mailAccounts'],'id');for(var _0x16093f=0x0,_0x2a011d={},_0x113485={};_0x16093f<_0x43ee5c[_0x71f5('0x6')];_0x16093f+=0x1){_0x2a011d=_0x43ee5c[_0x16093f];if(_['isUndefined'](_0x1712a1['mailAccounts'][_0x2a011d['id']])){_0x1712a1[_0x71f5('0x7')][_0x2a011d['id']]=new MailAccount(_0x2a011d);}else{_[_0x71f5('0x8')](_0x1712a1['mailAccounts'][_0x2a011d['id']],_0x2a011d);}}}return _0x1712a1[_0x71f5('0x7')];};};module[_0x71f5('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 3f61323..9998040 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7278=['key','ListId','TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','../client','getMailAccounts','Request','GetMailAccount','name','email','active'];(function(_0x4b5b23,_0x1d3616){var _0x5ada53=function(_0x365416){while(--_0x365416){_0x4b5b23['push'](_0x4b5b23['shift']());}};_0x5ada53(++_0x1d3616);}(_0x7278,0x161));var _0x8727=function(_0x484444,_0x2b6c42){_0x484444=_0x484444-0x0;var _0x4bf8f3=_0x7278[_0x484444];return _0x4bf8f3;};'use strict';var client=require(_0x8727('0x0'));exports[_0x8727('0x1')]=function(){return function(){return client[_0x8727('0x2')](_0x8727('0x3'),{'options':{'attributes':['id',_0x8727('0x4'),'service',_0x8727('0x5'),_0x8727('0x6'),_0x8727('0x7'),_0x8727('0x8'),_0x8727('0x9')],'raw':![],'include':[{'model':_0x8727('0xa'),'as':_0x8727('0xb')},{'model':'MailServerOut','as':_0x8727('0xc')}]},'log':_0x8727('0xd')});};};exports[_0x8727('0xe')]=function(_0x435911,_0x4160c3){return client['Request']('NotifyMailAccount',{'account':{'id':_0x435911},'body':_0x4160c3,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x7676=['MailServerOut','Smtp','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','name','active','ListId','TemplateId','MailServerIn'];(function(_0x2094ba,_0x3d18b7){var _0x5e6e8b=function(_0x2c0618){while(--_0x2c0618){_0x2094ba['push'](_0x2094ba['shift']());}};_0x5e6e8b(++_0x3d18b7);}(_0x7676,0xb8));var _0x6767=function(_0x4632cf,_0x3898f9){_0x4632cf=_0x4632cf-0x0;var _0x1b7500=_0x7676[_0x4632cf];return _0x1b7500;};'use strict';var client=require(_0x6767('0x0'));exports[_0x6767('0x1')]=function(){return function(){return client[_0x6767('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x6767('0x3'),'service','email',_0x6767('0x4'),'key',_0x6767('0x5'),_0x6767('0x6')],'raw':![],'include':[{'model':_0x6767('0x7'),'as':'Imap'},{'model':_0x6767('0x8'),'as':_0x6767('0x9')}]},'log':_0x6767('0xa')});};};exports['notify']=function(_0xb81431,_0x31366b){return client[_0x6767('0x2')](_0x6767('0xb'),{'account':{'id':_0xb81431},'body':_0x31366b,'log':_0x6767('0xb')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7360357..4e8f863 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5296=['127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','jayson/promise','bluebird','lodash','../../../config/logger','email','listen','sendMail','account','catch','verifySmtp','then','error','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify'];(function(_0x18c6be,_0x5ba47b){var _0x236c76=function(_0x4edaf1){while(--_0x4edaf1){_0x18c6be['push'](_0x18c6be['shift']());}};_0x236c76(++_0x5ba47b);}(_0x5296,0x116));var _0x6529=function(_0x164abf,_0x3e0c6f){_0x164abf=_0x164abf-0x0;var _0x130995=_0x5296[_0x164abf];return _0x130995;};'use strict';var jayson=require(_0x6529('0x0'));var BPromise=require(_0x6529('0x1'));var _=require(_0x6529('0x2'));var logger=require(_0x6529('0x3'))(_0x6529('0x4'));exports[_0x6529('0x5')]=function(_0x2ba3d8,_0x3821f0){return new BPromise(function(_0x201b77,_0x2e759b){var _0x4fa060={'SendMail':function(_0x4da3df){var _0x41541e=this;return new Promise(function(_0x49661c,_0x3b2782){_0x3821f0[_0x6529('0x6')](_0x4da3df[_0x6529('0x7')],_0x4da3df['message'])['then'](function(_0x195052){_0x49661c({'code':0xc8,'message':_0x195052});})[_0x6529('0x8')](function(_0x79537b){_0x3b2782(_0x41541e['error'](0x1f4,_0x79537b));});});},'VerifySmtp':function(_0x56318c){var _0x2f2bb9=this;return new Promise(function(_0x492f57,_0x278dff){_0x3821f0[_0x6529('0x9')](_0x56318c[_0x6529('0x7')])[_0x6529('0xa')](function(_0x39a160){_0x492f57({'code':0xc8,'message':'Verified'});})[_0x6529('0x8')](function(_0x2c5cf5){_0x278dff(_0x2f2bb9[_0x6529('0xb')](0x1f4,_0x2c5cf5));});});},'MailAccounts':function(_0x161169){return new Promise(function(_0x4a2505,_0x1dfdbe){var _0x2655ca=_[_0x6529('0xc')](_0x2ba3d8[_0x6529('0xd')]);for(var _0x12f0d0=0x0;_0x12f0d0<_0x2655ca[_0x6529('0xe')];_0x12f0d0+=0x1){if(_0x2655ca[_0x12f0d0]['Imap']&&_0x2655ca[_0x12f0d0][_0x6529('0xf')]['password']){delete _0x2655ca[_0x12f0d0][_0x6529('0xf')][_0x6529('0x10')];}if(_0x2655ca[_0x12f0d0]['Smtp']&&_0x2655ca[_0x12f0d0][_0x6529('0x11')][_0x6529('0x12')]){delete _0x2655ca[_0x12f0d0][_0x6529('0x11')][_0x6529('0x12')];}}_0x4a2505({'count':_0x2655ca['length'],'rows':_0x2655ca});});}};var _0x1d75e4=jayson[_0x6529('0x13')](_0x4fa060)[_0x6529('0x14')]();_0x1d75e4['on'](_0x6529('0xb'),function(_0xaf6c0c){logger[_0x6529('0xb')](JSON[_0x6529('0x15')](_0xaf6c0c));return _0x2e759b(_0xaf6c0c);});_0x1d75e4['listen'](0x232b,_0x6529('0x16'),function(){console[_0x6529('0x17')](_0x6529('0x18'),0x232b);return _0x201b77('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file +var _0xc49d=['server','http','stringify','listen','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','bluebird','lodash','../../../config/logger','email','sendMail','message','then','catch','error','verifySmtp','Verified','values','mailAccounts','Imap','password','Smtp','pass','length'];(function(_0x51beb8,_0x132a1e){var _0x59072=function(_0x37705c){while(--_0x37705c){_0x51beb8['push'](_0x51beb8['shift']());}};_0x59072(++_0x132a1e);}(_0xc49d,0xb6));var _0xdc49=function(_0x498334,_0x817eb){_0x498334=_0x498334-0x0;var _0x57a9a6=_0xc49d[_0x498334];return _0x57a9a6;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xdc49('0x0'));var _=require(_0xdc49('0x1'));var logger=require(_0xdc49('0x2'))(_0xdc49('0x3'));exports['listen']=function(_0x5da569,_0x3156a7){return new BPromise(function(_0xd9d76c,_0x58c45b){var _0x62ac81={'SendMail':function(_0x467dcd){var _0x52558d=this;return new Promise(function(_0x44f317,_0x5c7f7d){_0x3156a7[_0xdc49('0x4')](_0x467dcd['account'],_0x467dcd[_0xdc49('0x5')])[_0xdc49('0x6')](function(_0x3a5e16){_0x44f317({'code':0xc8,'message':_0x3a5e16});})[_0xdc49('0x7')](function(_0x4e0d75){_0x5c7f7d(_0x52558d[_0xdc49('0x8')](0x1f4,_0x4e0d75));});});},'VerifySmtp':function(_0x4a58b4){var _0x51367f=this;return new Promise(function(_0x317607,_0x127cfc){_0x3156a7[_0xdc49('0x9')](_0x4a58b4['account'])['then'](function(_0x90ecf){_0x317607({'code':0xc8,'message':_0xdc49('0xa')});})[_0xdc49('0x7')](function(_0x18b047){_0x127cfc(_0x51367f[_0xdc49('0x8')](0x1f4,_0x18b047));});});},'MailAccounts':function(_0x55eda5){return new Promise(function(_0x2ec61b,_0x3db089){var _0x2b50ef=_[_0xdc49('0xb')](_0x5da569[_0xdc49('0xc')]);for(var _0x6551f1=0x0;_0x6551f1<_0x2b50ef['length'];_0x6551f1+=0x1){if(_0x2b50ef[_0x6551f1][_0xdc49('0xd')]&&_0x2b50ef[_0x6551f1][_0xdc49('0xd')]['password']){delete _0x2b50ef[_0x6551f1][_0xdc49('0xd')][_0xdc49('0xe')];}if(_0x2b50ef[_0x6551f1][_0xdc49('0xf')]&&_0x2b50ef[_0x6551f1][_0xdc49('0xf')][_0xdc49('0x10')]){delete _0x2b50ef[_0x6551f1][_0xdc49('0xf')][_0xdc49('0x10')];}}_0x2ec61b({'count':_0x2b50ef[_0xdc49('0x11')],'rows':_0x2b50ef});});}};var _0x12cd04=jayson[_0xdc49('0x12')](_0x62ac81)[_0xdc49('0x13')]();_0x12cd04['on'](_0xdc49('0x8'),function(_0x7b0352){logger['error'](JSON[_0xdc49('0x14')](_0x7b0352));return _0x58c45b(_0x7b0352);});_0x12cd04[_0xdc49('0x15')](0x232b,_0xdc49('0x16'),function(){console[_0xdc49('0x17')](_0xdc49('0x18'),0x232b);return _0xd9d76c('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index f0992d4..645cc7a 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf71a=['express','sticky-session','ioredis','createServer','socket.io','polling','redis','localhost','../../config/triggers','default','../../config/socketio','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http'];(function(_0x5b406e,_0xcd06bc){var _0xe7d242=function(_0x3fc6cc){while(--_0x3fc6cc){_0x5b406e['push'](_0x5b406e['shift']());}};_0xe7d242(++_0xcd06bc);}(_0xf71a,0x19c));var _0xaf71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf71a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xaf71('0x0'));var http=require(_0xaf71('0x1'));var express=require(_0xaf71('0x2'));var sticky=require(_0xaf71('0x3'));var Redis=require(_0xaf71('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0xaf71('0x5')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xaf71('0x6'))(server,{'transports':['websocket',_0xaf71('0x7')]});config[_0xaf71('0x8')]=_['defaults'](config['redis'],{'host':_0xaf71('0x9'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0xaf71('0x8')]),'subClient':new Redis(config['redis'])}));require(_0xaf71('0xa'))[_0xaf71('0xb')]();require(_0xaf71('0xc'))[_0xaf71('0xb')](socketio);require('../../config/express')[_0xaf71('0xb')](app);require('../../routes')[_0xaf71('0xb')](app);}else{server[_0xaf71('0xd')]('listening',function(){console[_0xaf71('0xe')](_0xaf71('0xf'),config[_0xaf71('0x10')]);});}exports=module[_0xaf71('0x11')]=app; \ No newline at end of file +var _0xbda9=['socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','http','express','sticky-session','ioredis','createServer','timeout','listen','port'];(function(_0x3c21e8,_0x3e8668){var _0x184e5a=function(_0xa26a21){while(--_0xa26a21){_0x3c21e8['push'](_0x3c21e8['shift']());}};_0x184e5a(++_0x3e8668);}(_0xbda9,0x10b));var _0x9bda=function(_0xafceaf,_0x5c65ad){_0xafceaf=_0xafceaf-0x0;var _0x3684e4=_0xbda9[_0xafceaf];return _0x3684e4;};'use strict';var _=require('lodash');var http=require(_0x9bda('0x0'));var express=require(_0x9bda('0x1'));var sticky=require(_0x9bda('0x2'));var Redis=require(_0x9bda('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x9bda('0x4')](app);server[_0x9bda('0x5')]=0xdbba0;if(sticky[_0x9bda('0x6')](server,config[_0x9bda('0x7')])){var socketio=require(_0x9bda('0x8'))(server,{'transports':[_0x9bda('0x9'),_0x9bda('0xa')]});config[_0x9bda('0xb')]=_[_0x9bda('0xc')](config['redis'],{'host':_0x9bda('0xd'),'port':0x18eb});socketio[_0x9bda('0xe')](require(_0x9bda('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x9bda('0xb')])}));require(_0x9bda('0x10'))[_0x9bda('0x11')]();require(_0x9bda('0x12'))[_0x9bda('0x11')](socketio);require(_0x9bda('0x13'))[_0x9bda('0x11')](app);require(_0x9bda('0x14'))[_0x9bda('0x11')](app);}else{server[_0x9bda('0x15')](_0x9bda('0x16'),function(){console[_0x9bda('0x17')](_0x9bda('0x18'),config[_0x9bda('0x7')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e0b49c3..e8dddd2 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e3b=['../../config/logger','routing','client','http','Request','request','debug','error','rpc','message','result','exports','bluebird'];(function(_0x46cd0a,_0x180328){var _0x35f755=function(_0x596043){while(--_0x596043){_0x46cd0a['push'](_0x46cd0a['shift']());}};_0x35f755(++_0x180328);}(_0x2e3b,0x81));var _0xb2e3=function(_0x204dbd,_0x4bbf20){_0x204dbd=_0x204dbd-0x0;var _0x5306a3=_0x2e3b[_0x204dbd];return _0x5306a3;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xb2e3('0x0'));var logger=require(_0xb2e3('0x1'))(_0xb2e3('0x2'));var client=jayson[_0xb2e3('0x3')][_0xb2e3('0x4')]({'port':0x2329});client[_0xb2e3('0x5')]=function(_0x1529ca,_0xcb4d04){return new BPromise(function(_0x4d30d7,_0x2bc877){return client[_0xb2e3('0x6')](_0x1529ca,_0xcb4d04)['then'](function(_0x41ec29){logger[_0xb2e3('0x7')]('rpc',_0xb2e3('0x2'),_0x1529ca,_0xcb4d04,_0x41ec29);if(_0x41ec29[_0xb2e3('0x8')]){logger['error'](_0xb2e3('0x9'),_0xb2e3('0x2'),_0x1529ca,_0x41ec29[_0xb2e3('0x8')][_0xb2e3('0xa')],_0xcb4d04);return _0x2bc877(_0x41ec29[_0xb2e3('0x8')]['message']);}else{return _0x4d30d7(_0x41ec29[_0xb2e3('0xb')]);}})['catch'](function(_0x403675){logger[_0xb2e3('0x8')](_0xb2e3('0x9'),_0xb2e3('0x2'),_0x1529ca,_0x403675,_0xcb4d04);return _0x2bc877(_0x403675);});});};module[_0xb2e3('0xc')]=client; \ No newline at end of file +var _0x4d61=['debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x4d61,0x147));var _0x14d6=function(_0x135b81,_0x39db4b){_0x135b81=_0x135b81-0x0;var _0x5d8a8e=_0x4d61[_0x135b81];return _0x5d8a8e;};'use strict';var jayson=require(_0x14d6('0x0'));var BPromise=require(_0x14d6('0x1'));var logger=require(_0x14d6('0x2'))(_0x14d6('0x3'));var client=jayson[_0x14d6('0x4')][_0x14d6('0x5')]({'port':0x2329});client[_0x14d6('0x6')]=function(_0x455bd7,_0x2950b7){return new BPromise(function(_0x5da268,_0x3285a9){return client[_0x14d6('0x7')](_0x455bd7,_0x2950b7)[_0x14d6('0x8')](function(_0x11b2c0){logger[_0x14d6('0x9')](_0x14d6('0xa'),_0x14d6('0x3'),_0x455bd7,_0x2950b7,_0x11b2c0);if(_0x11b2c0['error']){logger[_0x14d6('0xb')]('rpc',_0x14d6('0x3'),_0x455bd7,_0x11b2c0['error'][_0x14d6('0xc')],_0x2950b7);return _0x3285a9(_0x11b2c0[_0x14d6('0xb')]['message']);}else{return _0x5da268(_0x11b2c0[_0x14d6('0xd')]);}})[_0x14d6('0xe')](function(_0x664c26){logger[_0x14d6('0xb')](_0x14d6('0xa'),_0x14d6('0x3'),_0x455bd7,_0x664c26,_0x2950b7);return _0x3285a9(_0x664c26);});});};module[_0x14d6('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 39e08ec..0803299 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf95c=['getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getChatQueues','getMailQueues','initMailQueues'];(function(_0x23ac90,_0x24e054){var _0x12dc6b=function(_0x123b03){while(--_0x123b03){_0x23ac90['push'](_0x23ac90['shift']());}};_0x12dc6b(++_0x24e054);}(_0xf95c,0x1e1));var _0xcf95=function(_0x417257,_0x4e45ae){_0x417257=_0x417257-0x0;var _0x13d72d=_0xf95c[_0x417257];return _0x13d72d;};'use strict';var BPromise=require(_0xcf95('0x0'));var server=require(_0xcf95('0x1'));var Realtime=require(_0xcf95('0x2'));var user=require(_0xcf95('0x3'));var interval=require(_0xcf95('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xcf95('0x5'));var smsQueue=require(_0xcf95('0x6'));var mailQueue=require(_0xcf95('0x7'));var faxQueue=require(_0xcf95('0x8'));var whatsappQueue=require(_0xcf95('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xcf95('0xa')]()[_0xcf95('0xb')](user[_0xcf95('0xc')]())['then'](realtime[_0xcf95('0xd')]())[_0xcf95('0xb')](interval[_0xcf95('0xe')]())[_0xcf95('0xb')](realtime[_0xcf95('0xf')]())[_0xcf95('0xb')](openchannelQueue['getOpenchannelQueues']())[_0xcf95('0xb')](realtime['initOpenchannelQueues']())[_0xcf95('0xb')](chatQueue[_0xcf95('0x10')]())[_0xcf95('0xb')](realtime['initChatQueues']())[_0xcf95('0xb')](smsQueue['getSmsQueues']())[_0xcf95('0xb')](realtime['initSmsQueues']())[_0xcf95('0xb')](mailQueue[_0xcf95('0x11')]())[_0xcf95('0xb')](realtime[_0xcf95('0x12')]())[_0xcf95('0xb')](faxQueue[_0xcf95('0x13')]())['then'](realtime[_0xcf95('0x14')]())[_0xcf95('0xb')](whatsappQueue['getWhatsappQueues']())[_0xcf95('0xb')](realtime[_0xcf95('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0xcf95('0x16')](realtime)['then'](function(_0x3fe129){return initRealtime();})[_0xcf95('0xb')](function(_0x2f356e){return setInterval(initRealtime,0x1388);})[_0xcf95('0x17')](function(_0x159653){console[_0xcf95('0x18')](_0x159653);});}main(); \ No newline at end of file +var _0x24f8=['initAgents','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents'];(function(_0x1ad813,_0x213344){var _0x145a57=function(_0x4c2cb8){while(--_0x4c2cb8){_0x1ad813['push'](_0x1ad813['shift']());}};_0x145a57(++_0x213344);}(_0x24f8,0xe6));var _0x824f=function(_0x3cd91d,_0x163516){_0x3cd91d=_0x3cd91d-0x0;var _0x3b4fab=_0x24f8[_0x3cd91d];return _0x3b4fab;};'use strict';var BPromise=require(_0x824f('0x0'));var server=require('./server');var Realtime=require(_0x824f('0x1'));var user=require(_0x824f('0x2'));var interval=require(_0x824f('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x824f('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x824f('0x5'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x824f('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x824f('0x7')]()[_0x824f('0x8')](user[_0x824f('0x9')]())['then'](realtime[_0x824f('0xa')]())['then'](interval['getIntervals']())['then'](realtime['initIntervals']())[_0x824f('0x8')](openchannelQueue['getOpenchannelQueues']())[_0x824f('0x8')](realtime[_0x824f('0xb')]())['then'](chatQueue[_0x824f('0xc')]())[_0x824f('0x8')](realtime[_0x824f('0xd')]())[_0x824f('0x8')](smsQueue['getSmsQueues']())[_0x824f('0x8')](realtime[_0x824f('0xe')]())[_0x824f('0x8')](mailQueue[_0x824f('0xf')]())[_0x824f('0x8')](realtime['initMailQueues']())['then'](faxQueue[_0x824f('0x10')]())[_0x824f('0x8')](realtime['initFaxQueues']())[_0x824f('0x8')](whatsappQueue[_0x824f('0x11')]())[_0x824f('0x8')](realtime[_0x824f('0x12')]())[_0x824f('0x8')](function(){return realtime;});}function main(){return server[_0x824f('0x13')](realtime)['then'](function(_0x13c1e8){return initRealtime();})['then'](function(_0x23a226){return setInterval(initRealtime,0x1388);})['catch'](function(_0x512a3c){console['log'](_0x512a3c);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 6722bbf..d403a9a 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48fe=['index_','push','call','nextTick','isEqual','restart','length','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','map','condition','toString','fromJSON','isString','parse','object','exports','lodash','util','EventEmitter','init','isNil','ignoreFactChanges','prototype','rules','register','isArray','concat','sync','orderBy','activeRules','execute','clone','consequence','ruleRef'];(function(_0x459573,_0x35679e){var _0x51ffcd=function(_0x37bb90){while(--_0x37bb90){_0x459573['push'](_0x459573['shift']());}};_0x51ffcd(++_0x35679e);}(_0x48fe,0x69));var _0xe48f=function(_0x6389a1,_0x4f4e7d){_0x6389a1=_0x6389a1-0x0;var _0x2dafde=_0x48fe[_0x6389a1];return _0x2dafde;};'use strict';var _=require(_0xe48f('0x0'));var util=require(_0xe48f('0x1'));var EventEmitter=require('events')[_0xe48f('0x2')];function RuleEngine(_0x7fdd81,_0x3702cd){this[_0xe48f('0x3')]();if(!_[_0xe48f('0x4')](_0x7fdd81)){this['register'](_0x7fdd81);}if(_0x3702cd){this[_0xe48f('0x5')]=_0x3702cd[_0xe48f('0x5')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0xe48f('0x6')][_0xe48f('0x3')]=function(_0x219a1a){this[_0xe48f('0x7')]=[];this['activeRules']=[];};RuleEngine[_0xe48f('0x6')][_0xe48f('0x8')]=function(_0xeea02a){if(Array[_0xe48f('0x9')](_0xeea02a)){this['rules']=this['rules'][_0xe48f('0xa')](_0xeea02a);}else if(_0xeea02a!==null&&_['isObject'](_0xeea02a)){this['rules']['push'](_0xeea02a);}this[_0xe48f('0xb')]();};RuleEngine[_0xe48f('0x6')][_0xe48f('0xb')]=function(){this['activeRules']=this[_0xe48f('0x7')]['filter'](function(_0x3c086e){if(_[_0xe48f('0x4')](_0x3c086e['on'])){_0x3c086e['on']=!![];}if(_0x3c086e['on']===!![]){return _0x3c086e;}});this['activeRules']=_[_0xe48f('0xc')](this[_0xe48f('0xd')],['p'],['asc']);};RuleEngine[_0xe48f('0x6')][_0xe48f('0xe')]=function(_0x2e750e,_0x4c6a93){var _0x5deb2a=![];_0x2e750e['result']=!![];var _0x1c3b2d=_[_0xe48f('0xf')](_0x2e750e);var _0x5923f3=_[_0xe48f('0xf')](_0x2e750e);var _0x5b7328=this['activeRules'];var _0x42c841=[];var _0x27845b=this[_0xe48f('0x5')];(function FnRuleLoop(_0x3a45f4){var _0x38355f={'rules':function(){return _0x5b7328;},'rule':function(){return _0x5b7328[_0x3a45f4];},'when':function(_0x3ebe89){if(_0x3ebe89){var _0x1be055=_0x5b7328[_0x3a45f4][_0xe48f('0x10')];_0x1be055[_0xe48f('0x11')]=_0x5b7328[_0x3a45f4]['id']||_0x5b7328[_0x3a45f4]['name']||_0xe48f('0x12')+_0x3a45f4;process['nextTick'](function(){_0x42c841[_0xe48f('0x13')](_0x1be055['ruleRef']);_0x1be055[_0xe48f('0x14')](_0x1c3b2d,_0x38355f);});}else{process[_0xe48f('0x15')](function(){_0x38355f['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5deb2a=!![];return FnRuleLoop(0x0);},'next':function(_0x33ceb6){if(!_0x27845b&&!_[_0xe48f('0x16')](_0x5923f3,_0x1c3b2d)){_0x5923f3=_['clone'](_0x1c3b2d);process[_0xe48f('0x15')](function(){_0x38355f[_0xe48f('0x17')]();});}else{process['nextTick'](function(){if(_[_0xe48f('0x4')](_0x33ceb6)){return FnRuleLoop(_0x3a45f4+0x1);}else{return FnRuleLoop(_0x33ceb6);}});}}};if(_0x3a45f4<_0x5b7328[_0xe48f('0x18')]&&_0x5deb2a===![]){var _0x5e1411=_0x5b7328[_0x3a45f4]['condition'];_0x5e1411[_0xe48f('0x14')](_0x1c3b2d,_0x38355f);}else{process[_0xe48f('0x15')](function(){_0x1c3b2d[_0xe48f('0x19')]=_0x42c841;return _0x4c6a93?_0x4c6a93(_0x1c3b2d):_[_0xe48f('0x1a')]();});}}(0x0));};RuleEngine[_0xe48f('0x6')][_0xe48f('0x1b')]=function(_0x53c7da){if(_[_0xe48f('0x4')](_0x53c7da)){return this[_0xe48f('0x7')];}else{var _0x469093=_[_0xe48f('0x1c')](_0x53c7da);return _['filter'](this[_0xe48f('0x7')],_0x469093);}};RuleEngine['prototype'][_0xe48f('0x1d')]=function(_0x111f43,_0x31e103){var _0x23f50d=_0x111f43==='on'||_0x111f43==='ON'?!![]:![];var _0x1be473=this['findRules'](_0x31e103);for(var _0x2646a3=0x0,_0x13f186=_0x1be473[_0xe48f('0x18')];_0x2646a3<_0x13f186;_0x2646a3+=0x1){_0x1be473[_0x2646a3]['on']=_0x23f50d;}this[_0xe48f('0xb')]();};RuleEngine[_0xe48f('0x6')][_0xe48f('0x1e')]=function(_0x58df18,_0x56eea6){_0x58df18=parseInt(_0x58df18,0xa);var _0x537177=this[_0xe48f('0x1b')](_0x56eea6);for(var _0x4d13a1=0x0,_0x14d674=_0x537177['length'];_0x4d13a1<_0x14d674;_0x4d13a1+=0x1){_0x537177[_0x4d13a1][_0xe48f('0x1f')]=_0x58df18;}this[_0xe48f('0xb')]();};RuleEngine[_0xe48f('0x6')][_0xe48f('0x20')]=function(){var _0x18da94=this[_0xe48f('0x7')];if(_0x18da94 instanceof Array){_0x18da94=_0x18da94[_0xe48f('0x21')](function(_0x4dc7fb){_0x4dc7fb[_0xe48f('0x22')]=_0x4dc7fb[_0xe48f('0x22')]['toString']();_0x4dc7fb['consequence']=_0x4dc7fb[_0xe48f('0x10')][_0xe48f('0x23')]();return _0x4dc7fb;});}else if(!_[_0xe48f('0x4')](_0x18da94)){_0x18da94[_0xe48f('0x22')]=_0x18da94['condition'][_0xe48f('0x23')]();_0x18da94['consequence']=_0x18da94[_0xe48f('0x10')]['toString']();}return _0x18da94;};RuleEngine[_0xe48f('0x6')][_0xe48f('0x24')]=function(_0x3117b5){this['init']();if(_[_0xe48f('0x25')](_0x3117b5)){_0x3117b5=JSON[_0xe48f('0x26')](_0x3117b5);}if(_0x3117b5 instanceof Array){_0x3117b5=_0x3117b5['map'](function(_0x198946){_0x198946[_0xe48f('0x22')]=eval('('+_0x198946[_0xe48f('0x22')]+')');_0x198946[_0xe48f('0x10')]=eval('('+_0x198946['consequence']+')');return _0x198946;});}else if(_0x3117b5!==null&&typeof _0x3117b5==_0xe48f('0x27')){_0x3117b5[_0xe48f('0x22')]=eval('('+_0x3117b5[_0xe48f('0x22')]+')');_0x3117b5[_0xe48f('0x10')]=eval('('+_0x3117b5[_0xe48f('0x10')]+')');}this[_0xe48f('0x8')](_0x3117b5);};module[_0xe48f('0x28')]=RuleEngine; \ No newline at end of file +var _0x4238=['result','clone','consequence','name','index_','nextTick','call','next','isEqual','length','condition','noop','filter','turn','prioritize','findRules','priority','toJSON','map','toString','fromJSON','object','register','exports','lodash','events','EventEmitter','init','isNil','ignoreFactChanges','inherits','rules','prototype','isArray','concat','isObject','push','sync','activeRules','execute'];(function(_0x2ee5c,_0x210778){var _0x312a5b=function(_0x1e1399){while(--_0x1e1399){_0x2ee5c['push'](_0x2ee5c['shift']());}};_0x312a5b(++_0x210778);}(_0x4238,0xe0));var _0x8423=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x4238[_0x4629ee];return _0x47fb5b;};'use strict';var _=require(_0x8423('0x0'));var util=require('util');var EventEmitter=require(_0x8423('0x1'))[_0x8423('0x2')];function RuleEngine(_0x442c94,_0xdbcff7){this[_0x8423('0x3')]();if(!_[_0x8423('0x4')](_0x442c94)){this['register'](_0x442c94);}if(_0xdbcff7){this[_0x8423('0x5')]=_0xdbcff7['ignoreFactChanges'];}return this;}util[_0x8423('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x8423('0x3')]=function(_0x56f74e){this[_0x8423('0x7')]=[];this['activeRules']=[];};RuleEngine[_0x8423('0x8')]['register']=function(_0x444f9a){if(Array[_0x8423('0x9')](_0x444f9a)){this[_0x8423('0x7')]=this[_0x8423('0x7')][_0x8423('0xa')](_0x444f9a);}else if(_0x444f9a!==null&&_[_0x8423('0xb')](_0x444f9a)){this[_0x8423('0x7')][_0x8423('0xc')](_0x444f9a);}this[_0x8423('0xd')]();};RuleEngine[_0x8423('0x8')][_0x8423('0xd')]=function(){this[_0x8423('0xe')]=this[_0x8423('0x7')]['filter'](function(_0x15805c){if(_[_0x8423('0x4')](_0x15805c['on'])){_0x15805c['on']=!![];}if(_0x15805c['on']===!![]){return _0x15805c;}});this[_0x8423('0xe')]=_['orderBy'](this[_0x8423('0xe')],['p'],['asc']);};RuleEngine[_0x8423('0x8')][_0x8423('0xf')]=function(_0x3d766e,_0x2c6bdf){var _0x9fd554=![];_0x3d766e[_0x8423('0x10')]=!![];var _0x315ba5=_[_0x8423('0x11')](_0x3d766e);var _0x22de45=_[_0x8423('0x11')](_0x3d766e);var _0x4142f2=this[_0x8423('0xe')];var _0x5293a1=[];var _0x590eb9=this['ignoreFactChanges'];(function FnRuleLoop(_0x2a444f){var _0x3d9b1f={'rules':function(){return _0x4142f2;},'rule':function(){return _0x4142f2[_0x2a444f];},'when':function(_0x5759c8){if(_0x5759c8){var _0x48f33d=_0x4142f2[_0x2a444f][_0x8423('0x12')];_0x48f33d['ruleRef']=_0x4142f2[_0x2a444f]['id']||_0x4142f2[_0x2a444f][_0x8423('0x13')]||_0x8423('0x14')+_0x2a444f;process[_0x8423('0x15')](function(){_0x5293a1[_0x8423('0xc')](_0x48f33d['ruleRef']);_0x48f33d[_0x8423('0x16')](_0x315ba5,_0x3d9b1f);});}else{process[_0x8423('0x15')](function(){_0x3d9b1f[_0x8423('0x17')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x9fd554=!![];return FnRuleLoop(0x0);},'next':function(_0x284b5d){if(!_0x590eb9&&!_[_0x8423('0x18')](_0x22de45,_0x315ba5)){_0x22de45=_['clone'](_0x315ba5);process['nextTick'](function(){_0x3d9b1f['restart']();});}else{process[_0x8423('0x15')](function(){if(_[_0x8423('0x4')](_0x284b5d)){return FnRuleLoop(_0x2a444f+0x1);}else{return FnRuleLoop(_0x284b5d);}});}}};if(_0x2a444f<_0x4142f2[_0x8423('0x19')]&&_0x9fd554===![]){var _0x1eedcf=_0x4142f2[_0x2a444f][_0x8423('0x1a')];_0x1eedcf['call'](_0x315ba5,_0x3d9b1f);}else{process[_0x8423('0x15')](function(){_0x315ba5['matchPath']=_0x5293a1;return _0x2c6bdf?_0x2c6bdf(_0x315ba5):_[_0x8423('0x1b')]();});}}(0x0));};RuleEngine[_0x8423('0x8')]['findRules']=function(_0x1b44bf){if(_[_0x8423('0x4')](_0x1b44bf)){return this[_0x8423('0x7')];}else{var _0x441d19=_['matches'](_0x1b44bf);return _[_0x8423('0x1c')](this[_0x8423('0x7')],_0x441d19);}};RuleEngine[_0x8423('0x8')][_0x8423('0x1d')]=function(_0x28f493,_0x475e87){var _0x3f3ca1=_0x28f493==='on'||_0x28f493==='ON'?!![]:![];var _0x5ab47b=this['findRules'](_0x475e87);for(var _0x5e0d12=0x0,_0x15d364=_0x5ab47b[_0x8423('0x19')];_0x5e0d12<_0x15d364;_0x5e0d12+=0x1){_0x5ab47b[_0x5e0d12]['on']=_0x3f3ca1;}this[_0x8423('0xd')]();};RuleEngine[_0x8423('0x8')][_0x8423('0x1e')]=function(_0x147080,_0x13a4f1){_0x147080=parseInt(_0x147080,0xa);var _0x3a6f1d=this[_0x8423('0x1f')](_0x13a4f1);for(var _0x582676=0x0,_0x1d508c=_0x3a6f1d[_0x8423('0x19')];_0x582676<_0x1d508c;_0x582676+=0x1){_0x3a6f1d[_0x582676][_0x8423('0x20')]=_0x147080;}this[_0x8423('0xd')]();};RuleEngine[_0x8423('0x8')][_0x8423('0x21')]=function(){var _0x56366f=this[_0x8423('0x7')];if(_0x56366f instanceof Array){_0x56366f=_0x56366f[_0x8423('0x22')](function(_0x5ea324){_0x5ea324[_0x8423('0x1a')]=_0x5ea324[_0x8423('0x1a')][_0x8423('0x23')]();_0x5ea324['consequence']=_0x5ea324[_0x8423('0x12')]['toString']();return _0x5ea324;});}else if(!_[_0x8423('0x4')](_0x56366f)){_0x56366f[_0x8423('0x1a')]=_0x56366f[_0x8423('0x1a')]['toString']();_0x56366f[_0x8423('0x12')]=_0x56366f[_0x8423('0x12')][_0x8423('0x23')]();}return _0x56366f;};RuleEngine[_0x8423('0x8')][_0x8423('0x24')]=function(_0x4d67a5){this[_0x8423('0x3')]();if(_['isString'](_0x4d67a5)){_0x4d67a5=JSON['parse'](_0x4d67a5);}if(_0x4d67a5 instanceof Array){_0x4d67a5=_0x4d67a5[_0x8423('0x22')](function(_0x475a99){_0x475a99['condition']=eval('('+_0x475a99[_0x8423('0x1a')]+')');_0x475a99[_0x8423('0x12')]=eval('('+_0x475a99[_0x8423('0x12')]+')');return _0x475a99;});}else if(_0x4d67a5!==null&&typeof _0x4d67a5==_0x8423('0x25')){_0x4d67a5['condition']=eval('('+_0x4d67a5[_0x8423('0x1a')]+')');_0x4d67a5['consequence']=eval('('+_0x4d67a5['consequence']+')');}this[_0x8423('0x26')](_0x4d67a5);};module[_0x8423('0x27')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index a0eb26b..7afc0fd 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x5096d8,_0x25b063){var _0xc120ec=function(_0x3c6866){while(--_0x3c6866){_0x5096d8['push'](_0x5096d8['shift']());}};_0xc120ec(++_0x25b063);}(_0x34e8,0x12c));var _0x834e=function(_0xfeb94b,_0x4560d6){_0xfeb94b=_0xfeb94b-0x0;var _0x402ad7=_0x34e8[_0xfeb94b];return _0x402ad7;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x5af3fd,_0x116bc4){var _0xbbbdbd=function(_0x1c49e3){while(--_0x1c49e3){_0x5af3fd['push'](_0x5af3fd['shift']());}};_0xbbbdbd(++_0x116bc4);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index d8431ee..8f1cad9 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa788=['name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','prototype','mail','chat','sms','whatsapp','Status','StatusTime','toNumber','format','chatPause','mailStatusTime','faxStatus','faxStatusTime','smsStatusTime','openchannelCurrentCapacity','busyQueue','stringify','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','socket.io-emitter'];(function(_0x3d1b70,_0xf0ef7){var _0x300efc=function(_0x2055ef){while(--_0x2055ef){_0x3d1b70['push'](_0x3d1b70['shift']());}};_0x300efc(++_0xf0ef7);}(_0xa788,0x70));var _0x8a78=function(_0x35e2cc,_0x52986b){_0x35e2cc=_0x35e2cc-0x0;var _0x5c221d=_0xa788[_0x35e2cc];return _0x5c221d;};'use strict';var _=require(_0x8a78('0x0'));var moment=require(_0x8a78('0x1'));var md5=require(_0x8a78('0x2'));var Redis=require(_0x8a78('0x3'));var config=require('../../../config/environment');config[_0x8a78('0x4')]=_[_0x8a78('0x5')](config['redis'],{'host':_0x8a78('0x6'),'port':0x18eb});var io=require(_0x8a78('0x7'))(new Redis(config['redis']));function Agent(_0x47be20){this['id']=_0x47be20['id']||0x0;this['name']=_0x47be20[_0x8a78('0x8')]||'';this[_0x8a78('0x9')]=_0x47be20['online']||!![];this['voicePause']=_0x47be20[_0x8a78('0xa')]||![];this['chatPause']=_0x47be20['chatPause']||![];this[_0x8a78('0xb')]=_0x47be20[_0x8a78('0xb')]||![];this['faxPause']=_0x47be20[_0x8a78('0xc')]||![];this[_0x8a78('0xd')]=_0x47be20[_0x8a78('0xd')]||![];this[_0x8a78('0xe')]=_0x47be20[_0x8a78('0xe')]||![];this[_0x8a78('0xf')]=_0x8a78('0x10');this[_0x8a78('0x11')]=0x0;this[_0x8a78('0x12')]=_0x47be20['chatCapacity']||0x0;this[_0x8a78('0x13')]=0x0;this[_0x8a78('0x14')]=_0x8a78('0x10');this['mailStatusTime']=0x0;this[_0x8a78('0x15')]=_0x47be20[_0x8a78('0x15')]||0x0;this[_0x8a78('0x16')]=0x0;this['faxStatus']=_0x8a78('0x10');this['faxStatusTime']=0x0;this[_0x8a78('0x17')]=_0x47be20['faxCapacity']||0x0;this[_0x8a78('0x18')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x8a78('0x19')]=_0x47be20[_0x8a78('0x19')]||0x0;this[_0x8a78('0x1a')]=0x0;this[_0x8a78('0x1b')]=_0x8a78('0x10');this[_0x8a78('0x1c')]=0x0;this[_0x8a78('0x1d')]=_0x47be20[_0x8a78('0x1d')]||0x0;this[_0x8a78('0x1e')]=0x0;this[_0x8a78('0x1f')]=_0x8a78('0x10');this[_0x8a78('0x20')]=0x0;this[_0x8a78('0x21')]=_0x47be20[_0x8a78('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8a78('0x22')]=![];this['busyQueue']=undefined;this[_0x8a78('0x2')]='';this[_0x8a78('0x23')]();}Agent['prototype'][_0x8a78('0x24')]=function(_0x28e5da){if(this[_0x28e5da+_0x8a78('0x25')]>0x0){if(this[_0x28e5da+_0x8a78('0x26')]>0x0&&this[_0x28e5da+_0x8a78('0x25')]>=this[_0x28e5da+'Capacity']){return _0x8a78('0x27');}else{return'working';}}else{return _0x8a78('0x28');}};Agent[_0x8a78('0x29')][_0x8a78('0x23')]=function(){var _0x381795=[_0x8a78('0x2a'),_0x8a78('0x2b'),'openchannel','fax',_0x8a78('0x2c'),_0x8a78('0x2d')];for(var _0x30fbe9=0x0;_0x30fbe9<_0x381795['length'];_0x30fbe9+=0x1){var _0x10e6b6=this[_0x8a78('0x24')](_0x381795[_0x30fbe9]);if(this[_0x381795[_0x30fbe9]+_0x8a78('0x2e')]!==_0x10e6b6){this[_0x381795[_0x30fbe9]+_0x8a78('0x2f')]=_[_0x8a78('0x30')](moment()[_0x8a78('0x31')]('x'));}this[_0x381795[_0x30fbe9]+_0x8a78('0x2e')]=_0x10e6b6;}var _0x503b4e={'id':this['id'],'name':this['name'],'online':this[_0x8a78('0x9')],'voicePause':this[_0x8a78('0xa')],'chatPause':this[_0x8a78('0x32')],'mailPause':this[_0x8a78('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x8a78('0xc')],'openchannelPause':this[_0x8a78('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x8a78('0x11')],'chatCapacity':this[_0x8a78('0x12')],'chatCurrentCapacity':this[_0x8a78('0x13')],'mailStatus':this[_0x8a78('0x14')],'mailStatusTime':this[_0x8a78('0x33')],'mailCapacity':this[_0x8a78('0x15')],'mailCurrentCapacity':this[_0x8a78('0x16')],'faxStatus':this[_0x8a78('0x34')],'faxStatusTime':this[_0x8a78('0x35')],'faxCapacity':this[_0x8a78('0x17')],'faxCurrentCapacity':this[_0x8a78('0x18')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x8a78('0x36')],'smsCapacity':this[_0x8a78('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x8a78('0x1b')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x8a78('0x1d')],'whatsappCurrentCapacity':this[_0x8a78('0x1e')],'openchannelStatus':this[_0x8a78('0x1f')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x8a78('0x37')],'busy':this['busy'],'busyQueue':this[_0x8a78('0x38')]};var _0x1bf327=md5(JSON[_0x8a78('0x39')](_0x503b4e));if(this[_0x8a78('0x2')]!==_0x1bf327){this[_0x8a78('0x2')]=_0x1bf327;io['emit'](_0x8a78('0x3a'),_0x503b4e);}};module[_0x8a78('0x3b')]=Agent; \ No newline at end of file +var _0x2250=['smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','mail','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','whatsappStatus','openchannelStatus','openchannelStatusTime','user:save','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2250,0x178));var _0x0225=function(_0x536755,_0x3bfa50){_0x536755=_0x536755-0x0;var _0x2b9dde=_0x2250[_0x536755];return _0x2b9dde;};'use strict';var _=require(_0x0225('0x0'));var moment=require(_0x0225('0x1'));var md5=require(_0x0225('0x2'));var Redis=require(_0x0225('0x3'));var config=require(_0x0225('0x4'));config[_0x0225('0x5')]=_[_0x0225('0x6')](config['redis'],{'host':_0x0225('0x7'),'port':0x18eb});var io=require(_0x0225('0x8'))(new Redis(config[_0x0225('0x5')]));function Agent(_0x3678c4){this['id']=_0x3678c4['id']||0x0;this[_0x0225('0x9')]=_0x3678c4[_0x0225('0x9')]||'';this[_0x0225('0xa')]=_0x3678c4[_0x0225('0xa')]||!![];this['voicePause']=_0x3678c4[_0x0225('0xb')]||![];this['chatPause']=_0x3678c4['chatPause']||![];this[_0x0225('0xc')]=_0x3678c4[_0x0225('0xc')]||![];this[_0x0225('0xd')]=_0x3678c4[_0x0225('0xd')]||![];this[_0x0225('0xe')]=_0x3678c4['smsPause']||![];this[_0x0225('0xf')]=_0x3678c4[_0x0225('0xf')]||![];this[_0x0225('0x10')]=_0x0225('0x11');this['chatStatusTime']=0x0;this[_0x0225('0x12')]=_0x3678c4['chatCapacity']||0x0;this[_0x0225('0x13')]=0x0;this[_0x0225('0x14')]='unknown';this[_0x0225('0x15')]=0x0;this[_0x0225('0x16')]=_0x3678c4[_0x0225('0x16')]||0x0;this[_0x0225('0x17')]=0x0;this[_0x0225('0x18')]=_0x0225('0x11');this[_0x0225('0x19')]=0x0;this[_0x0225('0x1a')]=_0x3678c4[_0x0225('0x1a')]||0x0;this[_0x0225('0x1b')]=0x0;this[_0x0225('0x1c')]='unknown';this[_0x0225('0x1d')]=0x0;this[_0x0225('0x1e')]=_0x3678c4['smsCapacity']||0x0;this[_0x0225('0x1f')]=0x0;this['whatsappStatus']=_0x0225('0x11');this[_0x0225('0x20')]=0x0;this[_0x0225('0x21')]=_0x3678c4[_0x0225('0x21')]||0x0;this[_0x0225('0x22')]=0x0;this['openchannelStatus']=_0x0225('0x11');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x3678c4['openchannelCapacity']||0x0;this[_0x0225('0x23')]=0x0;this[_0x0225('0x24')]=![];this[_0x0225('0x25')]=undefined;this[_0x0225('0x2')]='';this[_0x0225('0x26')]();}Agent[_0x0225('0x27')][_0x0225('0x28')]=function(_0x5e4ba4){if(this[_0x5e4ba4+_0x0225('0x29')]>0x0){if(this[_0x5e4ba4+_0x0225('0x2a')]>0x0&&this[_0x5e4ba4+_0x0225('0x29')]>=this[_0x5e4ba4+'Capacity']){return'maxcapacity';}else{return _0x0225('0x2b');}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x4b0fc3=[_0x0225('0x2c'),'chat',_0x0225('0x2d'),_0x0225('0x2e'),_0x0225('0x2f'),_0x0225('0x30')];for(var _0x340552=0x0;_0x340552<_0x4b0fc3[_0x0225('0x31')];_0x340552+=0x1){var _0x338f49=this['getChannelStatus'](_0x4b0fc3[_0x340552]);if(this[_0x4b0fc3[_0x340552]+_0x0225('0x32')]!==_0x338f49){this[_0x4b0fc3[_0x340552]+_0x0225('0x33')]=_[_0x0225('0x34')](moment()[_0x0225('0x35')]('x'));}this[_0x4b0fc3[_0x340552]+'Status']=_0x338f49;}var _0x516374={'id':this['id'],'name':this['name'],'online':this[_0x0225('0xa')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x0225('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x0225('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x0225('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x0225('0x12')],'chatCurrentCapacity':this[_0x0225('0x13')],'mailStatus':this[_0x0225('0x14')],'mailStatusTime':this[_0x0225('0x15')],'mailCapacity':this[_0x0225('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x0225('0x18')],'faxStatusTime':this[_0x0225('0x19')],'faxCapacity':this[_0x0225('0x1a')],'faxCurrentCapacity':this[_0x0225('0x1b')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x0225('0x1d')],'smsCapacity':this[_0x0225('0x1e')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x0225('0x36')],'whatsappStatusTime':this[_0x0225('0x20')],'whatsappCapacity':this[_0x0225('0x21')],'whatsappCurrentCapacity':this[_0x0225('0x22')],'openchannelStatus':this[_0x0225('0x37')],'openchannelStatusTime':this[_0x0225('0x38')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x0225('0x23')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x41eb83=md5(JSON['stringify'](_0x516374));if(this['md5']!==_0x41eb83){this[_0x0225('0x2')]=_0x41eb83;io['emit'](_0x0225('0x39'),_0x516374);}};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 1751a5d..927147e 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 _0x36d0=['mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','chatPause','available','stringify','format','name','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents'];(function(_0x5ec043,_0x5c82be){var _0x2cda95=function(_0x13eb45){while(--_0x13eb45){_0x5ec043['push'](_0x5ec043['shift']());}};_0x2cda95(++_0x5c82be);}(_0x36d0,0x85));var _0x036d=function(_0x5907eb,_0xe32b66){_0x5907eb=_0x5907eb-0x0;var _0x3ebc76=_0x36d0[_0x5907eb];return _0x3ebc76;};'use strict';var _=require(_0x036d('0x0'));var md5=require('md5');var util=require(_0x036d('0x1'));var Redis=require(_0x036d('0x2'));var config=require(_0x036d('0x3'));config['redis']=_[_0x036d('0x4')](config[_0x036d('0x5')],{'host':_0x036d('0x6'),'port':0x18eb});var io=require(_0x036d('0x7'))(new Redis(config[_0x036d('0x5')]));function ChatQueue(_0x516e2a){this['id']=_0x516e2a['id']||0x0;this['name']=_0x516e2a['name']||'';this[_0x036d('0x8')]=_0x516e2a[_0x036d('0x8')]||0xa;this[_0x036d('0x9')]=_0x516e2a[_0x036d('0x9')]||_0x036d('0xa');this['Agents']=_0x516e2a[_0x036d('0xb')];this[_0x036d('0xc')]={};this[_0x036d('0xd')]=0x0;this[_0x036d('0xe')]='';this[_0x036d('0xf')]();this[_0x036d('0x10')]();}ChatQueue['prototype'][_0x036d('0xf')]=function(){var _0x2675b3=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this[_0x036d('0xb')],'id');this['mapAgentsId'][_0x036d('0x11')]=_0x2675b3;};ChatQueue[_0x036d('0x12')]['updateRealtime']=function(){this[_0x036d('0x13')]=0x0;this[_0x036d('0x14')]=0x0;for(var _0x572624=0x0;_0x572624=0x0?this['available']:0x0;var _0x5a3f1f={'id':this['id'],'available':this[_0x036d('0x16')],'loggedIn':this[_0x036d('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x036d('0xd')]};var _0x31aa2d=md5(JSON[_0x036d('0x17')](_0x5a3f1f));if(this[_0x036d('0xe')]!==_0x31aa2d){this[_0x036d('0xe')]=_0x31aa2d;io['to'](util[_0x036d('0x18')]('chat:queue:%s',_0x5a3f1f[_0x036d('0x19')]))[_0x036d('0x1a')](_0x036d('0x1b'),_0x5a3f1f);}};module[_0x036d('0x1c')]=ChatQueue; \ No newline at end of file +var _0x05e6=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','online','available','stringify','format','chat:queue:%s','chat_queue:save','lodash','ioredis'];(function(_0x3b46f8,_0x3353fd){var _0x435b1e=function(_0x3a7b2b){while(--_0x3a7b2b){_0x3b46f8['push'](_0x3b46f8['shift']());}};_0x435b1e(++_0x3353fd);}(_0x05e6,0x184));var _0x605e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x05e6[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x605e('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x605e('0x1'));var config=require('../../../config/environment');config[_0x605e('0x2')]=_['defaults'](config[_0x605e('0x2')],{'host':_0x605e('0x3'),'port':0x18eb});var io=require(_0x605e('0x4'))(new Redis(config[_0x605e('0x2')]));function ChatQueue(_0x18f004){this['id']=_0x18f004['id']||0x0;this[_0x605e('0x5')]=_0x18f004[_0x605e('0x5')]||'';this[_0x605e('0x6')]=_0x18f004[_0x605e('0x6')]||0xa;this[_0x605e('0x7')]=_0x18f004[_0x605e('0x7')]||_0x605e('0x8');this['Agents']=_0x18f004[_0x605e('0x9')];this[_0x605e('0xa')]={};this[_0x605e('0xb')]=0x0;this[_0x605e('0xc')]='';this[_0x605e('0xd')]();this[_0x605e('0xe')]();}ChatQueue['prototype'][_0x605e('0xd')]=function(){var _0x5c583a=this[_0x605e('0xa')]['_rr'];this[_0x605e('0xa')]=_[_0x605e('0xf')](this['Agents'],'id');this[_0x605e('0xa')][_0x605e('0x10')]=_0x5c583a;};ChatQueue[_0x605e('0x11')]['updateRealtime']=function(){this[_0x605e('0x12')]=0x0;this[_0x605e('0x13')]=0x0;for(var _0x3366ea=0x0;_0x3366ea=0x0?this[_0x605e('0x15')]:0x0;var _0x38e521={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x605e('0x5')],'paused':this['paused'],'waiting':this['waiting']};var _0x3914dc=md5(JSON[_0x605e('0x16')](_0x38e521));if(this['md5']!==_0x3914dc){this['md5']=_0x3914dc;io['to'](util[_0x605e('0x17')](_0x605e('0x18'),_0x38e521[_0x605e('0x5')]))['emit'](_0x605e('0x19'),_0x38e521);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index ac4f149..1a10e5d 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(_0x3185c4,_0x4b4429){var _0x31e85f=function(_0x527a56){while(--_0x527a56){_0x3185c4['push'](_0x3185c4['shift']());}};_0x31e85f(++_0x4b4429);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x1a6475,_0x496bda){var _0x581c1b=function(_0x5af4df){while(--_0x5af4df){_0x1a6475['push'](_0x1a6475['shift']());}};_0x581c1b(++_0x496bda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 477fecd..24c76d1 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 _0x0ce8=['Intervals','exports'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x0ce8,0x1e0));var _0x80ce=function(_0xa7909,_0x1342a9){_0xa7909=_0xa7909-0x0;var _0x2fadc0=_0x0ce8[_0xa7909];return _0x2fadc0;};'use strict';function Interval(_0xdebf08){this['id']=_0xdebf08['id']||0x0;this['name']=_0xdebf08['name']||'';this[_0x80ce('0x0')]=_0xdebf08[_0x80ce('0x0')]||{};}module[_0x80ce('0x1')]=Interval; \ No newline at end of file +var _0xd99b=['Intervals','name'];(function(_0x4cc2f6,_0x543ef2){var _0x11a1cf=function(_0x1454bf){while(--_0x1454bf){_0x4cc2f6['push'](_0x4cc2f6['shift']());}};_0x11a1cf(++_0x543ef2);}(_0xd99b,0x1e7));var _0xbd99=function(_0x281bf4,_0x15cb7d){_0x281bf4=_0x281bf4-0x0;var _0x17a1ff=_0xd99b[_0x281bf4];return _0x17a1ff;};'use strict';function Interval(_0xabe600){this['id']=_0xabe600['id']||0x0;this[_0xbd99('0x0')]=_0xabe600[_0xbd99('0x0')]||'';this[_0xbd99('0x1')]=_0xabe600[_0xbd99('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 528646f..3a9a281 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 _0xd417=['mailPause','available','format','mail:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','loggedIn','paused','length','online'];(function(_0x1aec02,_0x3a7f22){var _0x10a837=function(_0x42641b){while(--_0x42641b){_0x1aec02['push'](_0x1aec02['shift']());}};_0x10a837(++_0x3a7f22);}(_0xd417,0x1eb));var _0x7d41=function(_0x4d28c7,_0x1ee9b3){_0x4d28c7=_0x4d28c7-0x0;var _0x101993=_0xd417[_0x4d28c7];return _0x101993;};'use strict';var _=require('lodash');var md5=require(_0x7d41('0x0'));var util=require(_0x7d41('0x1'));var Redis=require(_0x7d41('0x2'));var config=require(_0x7d41('0x3'));config[_0x7d41('0x4')]=_[_0x7d41('0x5')](config[_0x7d41('0x4')],{'host':_0x7d41('0x6'),'port':0x18eb});var io=require(_0x7d41('0x7'))(new Redis(config['redis']));function MailQueue(_0xa7d251){this['id']=_0xa7d251['id']||0x0;this[_0x7d41('0x8')]=_0xa7d251[_0x7d41('0x8')]||'';this['timeout']=_0xa7d251['timeout']||0xa;this[_0x7d41('0x9')]=_0xa7d251[_0x7d41('0x9')]||_0x7d41('0xa');this[_0x7d41('0xb')]=_0xa7d251[_0x7d41('0xb')];this[_0x7d41('0xc')]={};this[_0x7d41('0xd')]=0x0;this[_0x7d41('0x0')]='';this[_0x7d41('0xe')]();this['updateRealtime']();}MailQueue[_0x7d41('0xf')][_0x7d41('0xe')]=function(){var _0x1f5a6d=this['mapAgentsId']['_rr'];this[_0x7d41('0xc')]=_[_0x7d41('0x10')](this[_0x7d41('0xb')],'id');this[_0x7d41('0xc')][_0x7d41('0x11')]=_0x1f5a6d;};MailQueue['prototype']['updateRealtime']=function(){this[_0x7d41('0x12')]=0x0;this[_0x7d41('0x13')]=0x0;for(var _0x7da6f=0x0;_0x7da6f=0x0?this[_0x7d41('0x17')]:0x0;var _0x4d6fbd={'id':this['id'],'available':this[_0x7d41('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7d41('0x8')],'paused':this[_0x7d41('0x13')],'waiting':this[_0x7d41('0xd')]};var _0x4fdc54=md5(JSON['stringify'](_0x4d6fbd));if(this[_0x7d41('0x0')]!==_0x4fdc54){this[_0x7d41('0x0')]=_0x4fdc54;io['to'](util[_0x7d41('0x18')](_0x7d41('0x19'),_0x4d6fbd[_0x7d41('0x8')]))[_0x7d41('0x1a')]('mail_queue:save',_0x4d6fbd);}};module['exports']=MailQueue; \ No newline at end of file +var _0xb98d=['paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb98d,0x19d));var _0xdb98=function(_0x4d41b3,_0x431a8d){_0x4d41b3=_0x4d41b3-0x0;var _0xebc234=_0xb98d[_0x4d41b3];return _0xebc234;};'use strict';var _=require(_0xdb98('0x0'));var md5=require(_0xdb98('0x1'));var util=require(_0xdb98('0x2'));var Redis=require(_0xdb98('0x3'));var config=require(_0xdb98('0x4'));config[_0xdb98('0x5')]=_['defaults'](config['redis'],{'host':_0xdb98('0x6'),'port':0x18eb});var io=require(_0xdb98('0x7'))(new Redis(config[_0xdb98('0x5')]));function MailQueue(_0x325d4c){this['id']=_0x325d4c['id']||0x0;this['name']=_0x325d4c[_0xdb98('0x8')]||'';this['timeout']=_0x325d4c[_0xdb98('0x9')]||0xa;this['strategy']=_0x325d4c[_0xdb98('0xa')]||_0xdb98('0xb');this[_0xdb98('0xc')]=_0x325d4c[_0xdb98('0xc')];this[_0xdb98('0xd')]={};this[_0xdb98('0xe')]=0x0;this[_0xdb98('0x1')]='';this[_0xdb98('0xf')]();this['updateRealtime']();}MailQueue[_0xdb98('0x10')][_0xdb98('0xf')]=function(){var _0x55ed6e=this[_0xdb98('0xd')][_0xdb98('0x11')];this[_0xdb98('0xd')]=_[_0xdb98('0x12')](this[_0xdb98('0xc')],'id');this[_0xdb98('0xd')][_0xdb98('0x11')]=_0x55ed6e;};MailQueue[_0xdb98('0x10')][_0xdb98('0x13')]=function(){this[_0xdb98('0x14')]=0x0;this[_0xdb98('0x15')]=0x0;for(var _0x153363=0x0;_0x153363=0x0?this['available']:0x0;var _0x4d3e3f={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdb98('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xdb98('0xe')]};var _0x3e7a1d=md5(JSON[_0xdb98('0x19')](_0x4d3e3f));if(this['md5']!==_0x3e7a1d){this['md5']=_0x3e7a1d;io['to'](util[_0xdb98('0x1a')](_0xdb98('0x1b'),_0x4d3e3f[_0xdb98('0x8')]))[_0xdb98('0x1c')](_0xdb98('0x1d'),_0x4d3e3f);}};module[_0xdb98('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 e9ee81f..bc7188d 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 _0xc394=['emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s'];(function(_0x2b698c,_0x5bbdd5){var _0x535317=function(_0x2e76c0){while(--_0x2e76c0){_0x2b698c['push'](_0x2b698c['shift']());}};_0x535317(++_0x5bbdd5);}(_0xc394,0x1b5));var _0x4c39=function(_0x4496f2,_0x48ff44){_0x4496f2=_0x4496f2-0x0;var _0xf16523=_0xc394[_0x4496f2];return _0xf16523;};'use strict';var _=require(_0x4c39('0x0'));var md5=require(_0x4c39('0x1'));var util=require('util');var Redis=require(_0x4c39('0x2'));var config=require(_0x4c39('0x3'));config['redis']=_[_0x4c39('0x4')](config[_0x4c39('0x5')],{'host':_0x4c39('0x6'),'port':0x18eb});var io=require(_0x4c39('0x7'))(new Redis(config[_0x4c39('0x5')]));function OpenchannelQueue(_0x214f9e){this['id']=_0x214f9e['id']||0x0;this['name']=_0x214f9e[_0x4c39('0x8')]||'';this['timeout']=_0x214f9e[_0x4c39('0x9')]||0xa;this[_0x4c39('0xa')]=_0x214f9e[_0x4c39('0xa')]||_0x4c39('0xb');this[_0x4c39('0xc')]=_0x214f9e[_0x4c39('0xc')];this[_0x4c39('0xd')]={};this[_0x4c39('0xe')]=0x0;this[_0x4c39('0x1')]='';this[_0x4c39('0xf')]();this[_0x4c39('0x10')]();}OpenchannelQueue[_0x4c39('0x11')][_0x4c39('0xf')]=function(){var _0x1b50e6=this[_0x4c39('0xd')][_0x4c39('0x12')];this[_0x4c39('0xd')]=_['map'](this[_0x4c39('0xc')],'id');this[_0x4c39('0xd')][_0x4c39('0x12')]=_0x1b50e6;};OpenchannelQueue[_0x4c39('0x11')][_0x4c39('0x10')]=function(){this[_0x4c39('0x13')]=0x0;this[_0x4c39('0x14')]=0x0;for(var _0x3b9049=0x0;_0x3b9049=0x0?this['available']:0x0;var _0x33a1c8={'id':this['id'],'available':this[_0x4c39('0x18')],'loggedIn':this[_0x4c39('0x13')],'name':this['name'],'paused':this[_0x4c39('0x14')],'waiting':this[_0x4c39('0xe')]};var _0x2aed2b=md5(JSON[_0x4c39('0x19')](_0x33a1c8));if(this[_0x4c39('0x1')]!==_0x2aed2b){this[_0x4c39('0x1')]=_0x2aed2b;io['to'](util[_0x4c39('0x1a')](_0x4c39('0x1b'),_0x33a1c8[_0x4c39('0x8')]))[_0x4c39('0x1c')](_0x4c39('0x1d'),_0x33a1c8);}};module[_0x4c39('0x1e')]=OpenchannelQueue; \ No newline at end of file +var _0x769d=['beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','paused','online','available','loggedIn','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x769d,0x102));var _0xd769=function(_0x108f18,_0x2662f9){_0x108f18=_0x108f18-0x0;var _0x5abede=_0x769d[_0x108f18];return _0x5abede;};'use strict';var _=require(_0xd769('0x0'));var md5=require(_0xd769('0x1'));var util=require(_0xd769('0x2'));var Redis=require(_0xd769('0x3'));var config=require(_0xd769('0x4'));config[_0xd769('0x5')]=_[_0xd769('0x6')](config[_0xd769('0x5')],{'host':_0xd769('0x7'),'port':0x18eb});var io=require(_0xd769('0x8'))(new Redis(config['redis']));function OpenchannelQueue(_0x136594){this['id']=_0x136594['id']||0x0;this[_0xd769('0x9')]=_0x136594[_0xd769('0x9')]||'';this[_0xd769('0xa')]=_0x136594[_0xd769('0xa')]||0xa;this[_0xd769('0xb')]=_0x136594[_0xd769('0xb')]||_0xd769('0xc');this[_0xd769('0xd')]=_0x136594[_0xd769('0xd')];this[_0xd769('0xe')]={};this[_0xd769('0xf')]=0x0;this[_0xd769('0x1')]='';this[_0xd769('0x10')]();this['updateRealtime']();}OpenchannelQueue[_0xd769('0x11')][_0xd769('0x10')]=function(){var _0x2ebc96=this[_0xd769('0xe')]['_rr'];this[_0xd769('0xe')]=_[_0xd769('0x12')](this[_0xd769('0xd')],'id');this[_0xd769('0xe')][_0xd769('0x13')]=_0x2ebc96;};OpenchannelQueue[_0xd769('0x11')][_0xd769('0x14')]=function(){this['loggedIn']=0x0;this[_0xd769('0x15')]=0x0;for(var _0x5bbddd=0x0;_0x5bbddd=0x0?this[_0xd769('0x17')]:0x0;var _0x33a7e7={'id':this['id'],'available':this[_0xd769('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xd769('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x16e390=md5(JSON['stringify'](_0x33a7e7));if(this[_0xd769('0x1')]!==_0x16e390){this[_0xd769('0x1')]=_0x16e390;io['to'](util[_0xd769('0x19')](_0xd769('0x1a'),_0x33a7e7[_0xd769('0x9')]))[_0xd769('0x1b')](_0xd769('0x1c'),_0x33a7e7);}};module[_0xd769('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 840cfb5..d5bdf0c 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x35293e,_0x5d1114){var _0x5efeeb=function(_0x4e0939){while(--_0x4e0939){_0x35293e['push'](_0x35293e['shift']());}};_0x5efeeb(++_0x5d1114);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var md5=require(_0x0d8b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0d8b('0x2')]=_[_0x0d8b('0x3')](config[_0x0d8b('0x2')],{'host':_0x0d8b('0x4'),'port':0x18eb});var io=require(_0x0d8b('0x5'))(new Redis(config['redis']));function SmsQueue(_0x5e15e6){this['id']=_0x5e15e6['id']||0x0;this[_0x0d8b('0x6')]=_0x5e15e6[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5e15e6['timeout']||0xa;this[_0x0d8b('0x8')]=_0x5e15e6[_0x0d8b('0x8')]||'beepall';this[_0x0d8b('0x9')]=_0x5e15e6[_0x0d8b('0x9')];this[_0x0d8b('0xa')]={};this[_0x0d8b('0xb')]=0x0;this[_0x0d8b('0x1')]='';this[_0x0d8b('0xc')]();this[_0x0d8b('0xd')]();}SmsQueue[_0x0d8b('0xe')]['updateRouting']=function(){var _0x3c4bfa=this['mapAgentsId'][_0x0d8b('0xf')];this[_0x0d8b('0xa')]=_[_0x0d8b('0x10')](this[_0x0d8b('0x9')],'id');this[_0x0d8b('0xa')][_0x0d8b('0xf')]=_0x3c4bfa;};SmsQueue[_0x0d8b('0xe')][_0x0d8b('0xd')]=function(){this[_0x0d8b('0x11')]=0x0;this[_0x0d8b('0x12')]=0x0;for(var _0x5ad086=0x0;_0x5ad086=0x0?this[_0x0d8b('0x15')]:0x0;var _0x333674={'id':this['id'],'available':this[_0x0d8b('0x15')],'loggedIn':this[_0x0d8b('0x11')],'name':this[_0x0d8b('0x6')],'paused':this['paused'],'waiting':this[_0x0d8b('0xb')]};var _0x23d58f=md5(JSON[_0x0d8b('0x16')](_0x333674));if(this[_0x0d8b('0x1')]!==_0x23d58f){this[_0x0d8b('0x1')]=_0x23d58f;io['to'](util[_0x0d8b('0x17')](_0x0d8b('0x18'),_0x333674[_0x0d8b('0x6')]))['emit']('sms_queue:save',_0x333674);}};module[_0x0d8b('0x19')]=SmsQueue; \ No newline at end of file +var _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(_0x524ab9,_0x33894e){var _0x1b2390=function(_0x5c8dd8){while(--_0x5c8dd8){_0x524ab9['push'](_0x524ab9['shift']());}};_0x1b2390(++_0x33894e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb7e7[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7979b1e..8cb38a3 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 _0x5bc8=['name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','paused','length','available','loggedIn','stringify','format','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x3b9aae,_0x5dd6ae){var _0x3b1c2b=function(_0x52d99b){while(--_0x52d99b){_0x3b9aae['push'](_0x3b9aae['shift']());}};_0x3b1c2b(++_0x5dd6ae);}(_0x5bc8,0x10f));var _0x85bc=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5bc8[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x85bc('0x0'));var md5=require(_0x85bc('0x1'));var util=require(_0x85bc('0x2'));var Redis=require(_0x85bc('0x3'));var config=require(_0x85bc('0x4'));config['redis']=_[_0x85bc('0x5')](config[_0x85bc('0x6')],{'host':_0x85bc('0x7'),'port':0x18eb});var io=require(_0x85bc('0x8'))(new Redis(config[_0x85bc('0x6')]));function WhatsappQueue(_0x4a4c86){this['id']=_0x4a4c86['id']||0x0;this[_0x85bc('0x9')]=_0x4a4c86[_0x85bc('0x9')]||'';this[_0x85bc('0xa')]=_0x4a4c86[_0x85bc('0xa')]||0xa;this[_0x85bc('0xb')]=_0x4a4c86['strategy']||_0x85bc('0xc');this['Agents']=_0x4a4c86[_0x85bc('0xd')];this['mapAgentsId']={};this[_0x85bc('0xe')]=0x0;this[_0x85bc('0x1')]='';this[_0x85bc('0xf')]();this[_0x85bc('0x10')]();}WhatsappQueue[_0x85bc('0x11')]['updateRouting']=function(){var _0x4bdc9f=this[_0x85bc('0x12')]['_rr'];this[_0x85bc('0x12')]=_[_0x85bc('0x13')](this[_0x85bc('0xd')],'id');this[_0x85bc('0x12')]['_rr']=_0x4bdc9f;};WhatsappQueue[_0x85bc('0x11')][_0x85bc('0x10')]=function(){this['loggedIn']=0x0;this[_0x85bc('0x14')]=0x0;for(var _0x5cafbd=0x0;_0x5cafbd=0x0?this[_0x85bc('0x16')]:0x0;var _0xea32f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x85bc('0x17')],'name':this[_0x85bc('0x9')],'paused':this[_0x85bc('0x14')],'waiting':this[_0x85bc('0xe')]};var _0x178121=md5(JSON[_0x85bc('0x18')](_0xea32f));if(this['md5']!==_0x178121){this[_0x85bc('0x1')]=_0x178121;io['to'](util[_0x85bc('0x19')]('whatsapp:queue:%s',_0xea32f[_0x85bc('0x9')]))['emit'](_0x85bc('0x1a'),_0xea32f);}};module[_0x85bc('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x1488=['exports','lodash','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','paused','length','loggedIn','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save'];(function(_0x34677a,_0xc29ca8){var _0x3bb373=function(_0x503256){while(--_0x503256){_0x34677a['push'](_0x34677a['shift']());}};_0x3bb373(++_0xc29ca8);}(_0x1488,0x88));var _0x8148=function(_0x2cc0b3,_0x120bf1){_0x2cc0b3=_0x2cc0b3-0x0;var _0x1667ef=_0x1488[_0x2cc0b3];return _0x1667ef;};'use strict';var _=require(_0x8148('0x0'));var md5=require('md5');var util=require(_0x8148('0x1'));var Redis=require(_0x8148('0x2'));var config=require(_0x8148('0x3'));config['redis']=_['defaults'](config[_0x8148('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8148('0x5'))(new Redis(config[_0x8148('0x4')]));function WhatsappQueue(_0x11027){this['id']=_0x11027['id']||0x0;this[_0x8148('0x6')]=_0x11027[_0x8148('0x6')]||'';this[_0x8148('0x7')]=_0x11027[_0x8148('0x7')]||0xa;this[_0x8148('0x8')]=_0x11027['strategy']||_0x8148('0x9');this[_0x8148('0xa')]=_0x11027[_0x8148('0xa')];this[_0x8148('0xb')]={};this[_0x8148('0xc')]=0x0;this[_0x8148('0xd')]='';this[_0x8148('0xe')]();this[_0x8148('0xf')]();}WhatsappQueue[_0x8148('0x10')][_0x8148('0xe')]=function(){var _0x4a785c=this[_0x8148('0xb')]['_rr'];this[_0x8148('0xb')]=_[_0x8148('0x11')](this[_0x8148('0xa')],'id');this['mapAgentsId']['_rr']=_0x4a785c;};WhatsappQueue[_0x8148('0x10')][_0x8148('0xf')]=function(){this['loggedIn']=0x0;this[_0x8148('0x12')]=0x0;for(var _0x15478c=0x0;_0x15478c=0x0?this['available']:0x0;var _0xc4092a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x8148('0x6')],'paused':this['paused'],'waiting':this[_0x8148('0xc')]};var _0x4a5256=md5(JSON[_0x8148('0x15')](_0xc4092a));if(this[_0x8148('0xd')]!==_0x4a5256){this[_0x8148('0xd')]=_0x4a5256;io['to'](util[_0x8148('0x16')](_0x8148('0x17'),_0xc4092a[_0x8148('0x6')]))[_0x8148('0x18')](_0x8148('0x19'),_0xc4092a);}};module[_0x8148('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 9485d67..b4a6370 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['../model/agent','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','chatQueues','mailQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','agents','isUndefined','mergeFromDatabase','length','initOpenchannelQueues','openchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','faxQueues','initWhatsappQueues','whatsappQueues','bluebird','util'];(function(_0x2f9e24,_0x357391){var _0x593714=function(_0x37a84d){while(--_0x37a84d){_0x2f9e24['push'](_0x2f9e24['shift']());}};_0x593714(++_0x357391);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x4b84[_0x3cea78];return _0x33b66b;};'use strict';var BPromise=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x44b8('0x2'));var Interval=require('../model/interval');var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x44b8('0x3'));var SmsQueue=require(_0x44b8('0x4'));var MailQueue=require(_0x44b8('0x5'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this['agents']={};this[_0x44b8('0x6')]={};this['openchannelQueues']={};this[_0x44b8('0x7')]={};this['smsQueues']={};this[_0x44b8('0x8')]={};this['faxQueues']={};this['whatsappQueues']={};this[_0x44b8('0x9')]={};this[_0x44b8('0xa')]={};this[_0x44b8('0xb')]={};this['smsQueuesWaitingInteractions']={};this[_0x44b8('0xc')]={};this[_0x44b8('0xd')]={};};function freeIsNotKey(_0x4315f6,_0x9b6048,_0x24dd10){var _0x37e471=_[_0x44b8('0xe')](_0x4315f6,function(_0x4ae8a1,_0x147529){return _0x4ae8a1[_0x24dd10];});for(var _0x4301a6 in _0x9b6048){if(_0x9b6048['hasOwnProperty'](_0x4301a6)){if(!_0x37e471[_0x4301a6]){delete _0x9b6048[_0x4301a6];}}}}Realtime[_0x44b8('0xf')]['mergeFromDatabase']=function(_0x833ea3,_0x18d642){for(var _0x4df670 in _0x18d642){if(_0x833ea3[_0x44b8('0x10')](_0x4df670)){_0x833ea3[_0x4df670]=_0x18d642[_0x4df670];}}};Realtime['prototype']['initAgents']=function(){var _0x2a3e4c=this;return function(_0x2af0ad){if(_0x2af0ad){freeIsNotKey(_0x2af0ad,_0x2a3e4c[_0x44b8('0x11')],'id');for(var _0x41ab46=0x0,_0x5e52f2={},_0x495c74={};_0x41ab46<_0x2af0ad['length'];_0x41ab46+=0x1){_0x5e52f2=_0x2af0ad[_0x41ab46];if(_[_0x44b8('0x12')](_0x2a3e4c['agents'][_0x5e52f2['id']])){_0x2a3e4c[_0x44b8('0x11')][_0x5e52f2['id']]=new Agent(_0x5e52f2);}else{_0x2a3e4c[_0x44b8('0x13')](_0x2a3e4c['agents'][_0x5e52f2['id']],_0x5e52f2);}}}return _0x2a3e4c[_0x44b8('0x11')];};};Realtime[_0x44b8('0xf')]['initIntervals']=function(){var _0x89bc30=this;return function(_0x3f4688){if(_0x3f4688){freeIsNotKey(_0x3f4688,_0x89bc30['intervals'],'id');for(var _0xcce202=0x0,_0x8b4301={},_0xebfe79={};_0xcce202<_0x3f4688[_0x44b8('0x14')];_0xcce202+=0x1){_0x8b4301=_0x3f4688[_0xcce202];if(_[_0x44b8('0x12')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']])){_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']]=new Interval(_0x8b4301);}else{_0x89bc30[_0x44b8('0x13')](_0x89bc30[_0x44b8('0x6')][_0x8b4301['id']],_0x8b4301);}}}return _0x89bc30[_0x44b8('0x6')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x15')]=function(){var _0x48327e=this;return function(_0x56549a){if(_0x56549a){freeIsNotKey(_0x56549a,_0x48327e[_0x44b8('0x16')],'id');for(var _0x416b34=0x0,_0x1418db={},_0x305a5c={};_0x416b34<_0x56549a['length'];_0x416b34+=0x1){_0x1418db=_0x56549a[_0x416b34];if(_[_0x44b8('0x12')](_0x48327e['openchannelQueues'][_0x1418db['id']])){_0x48327e[_0x44b8('0x16')][_0x1418db['id']]=new OpenchannelQueue(_0x1418db);}else{_0x48327e[_0x44b8('0x13')](_0x48327e[_0x44b8('0x16')][_0x1418db['id']],_0x1418db);}_0x48327e[_0x44b8('0x16')][_0x1418db['id']][_0x44b8('0x17')]();_0x48327e['openchannelQueues'][_0x1418db['id']][_0x44b8('0x18')]();}}return _0x48327e['openchannelQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x19')]=function(){var _0x549a26=this;return function(_0x17ac44){if(_0x17ac44){freeIsNotKey(_0x17ac44,_0x549a26[_0x44b8('0x7')],'id');for(var _0x2656d7=0x0,_0x59c1bf={},_0xb22107={};_0x2656d7<_0x17ac44[_0x44b8('0x14')];_0x2656d7+=0x1){_0x59c1bf=_0x17ac44[_0x2656d7];if(_['isUndefined'](_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']])){_0x549a26['chatQueues'][_0x59c1bf['id']]=new ChatQueue(_0x59c1bf);}else{_0x549a26[_0x44b8('0x13')](_0x549a26['chatQueues'][_0x59c1bf['id']],_0x59c1bf);}_0x549a26['chatQueues'][_0x59c1bf['id']]['updateRouting']();_0x549a26[_0x44b8('0x7')][_0x59c1bf['id']][_0x44b8('0x18')]();}}return _0x549a26[_0x44b8('0x7')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1a')]=function(){var _0xc3f667=this;return function(_0x2cf205){if(_0x2cf205){freeIsNotKey(_0x2cf205,_0xc3f667[_0x44b8('0x1b')],'id');for(var _0xd1d320=0x0,_0x28f918={},_0x5e1129={};_0xd1d320<_0x2cf205[_0x44b8('0x14')];_0xd1d320+=0x1){_0x28f918=_0x2cf205[_0xd1d320];if(_[_0x44b8('0x12')](_0xc3f667['smsQueues'][_0x28f918['id']])){_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']]=new SmsQueue(_0x28f918);}else{_0xc3f667['mergeFromDatabase'](_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']],_0x28f918);}_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x17')]();_0xc3f667[_0x44b8('0x1b')][_0x28f918['id']][_0x44b8('0x18')]();}}return _0xc3f667['smsQueues'];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1c')]=function(){var _0x26265f=this;return function(_0x339f0f){if(_0x339f0f){freeIsNotKey(_0x339f0f,_0x26265f[_0x44b8('0x8')],'id');for(var _0x5f541d=0x0,_0x3875a5={},_0x400edc={};_0x5f541d<_0x339f0f[_0x44b8('0x14')];_0x5f541d+=0x1){_0x3875a5=_0x339f0f[_0x5f541d];if(_[_0x44b8('0x12')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']])){_0x26265f[_0x44b8('0x8')][_0x3875a5['id']]=new MailQueue(_0x3875a5);}else{_0x26265f[_0x44b8('0x13')](_0x26265f[_0x44b8('0x8')][_0x3875a5['id']],_0x3875a5);}_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x17')]();_0x26265f[_0x44b8('0x8')][_0x3875a5['id']][_0x44b8('0x18')]();}}return _0x26265f[_0x44b8('0x8')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1d')]=function(){var _0x1becb0=this;return function(_0x323c50){if(_0x323c50){freeIsNotKey(_0x323c50,_0x1becb0[_0x44b8('0x1e')],'id');for(var _0x28faa9=0x0,_0x3984f8={},_0x2c02d6={};_0x28faa9<_0x323c50[_0x44b8('0x14')];_0x28faa9+=0x1){_0x3984f8=_0x323c50[_0x28faa9];if(_['isUndefined'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']])){_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]=new FaxQueue(_0x3984f8);}else{_0x1becb0['mergeFromDatabase'](_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']],_0x3984f8);}_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']][_0x44b8('0x17')]();_0x1becb0[_0x44b8('0x1e')][_0x3984f8['id']]['updateRealtime']();}}return _0x1becb0[_0x44b8('0x1e')];};};Realtime[_0x44b8('0xf')][_0x44b8('0x1f')]=function(){var _0x1ee3cc=this;return function(_0x9cb2a){if(_0x9cb2a){freeIsNotKey(_0x9cb2a,_0x1ee3cc[_0x44b8('0x20')],'id');for(var _0x46aadd=0x0,_0x3581b8={},_0x209039={};_0x46aadd<_0x9cb2a[_0x44b8('0x14')];_0x46aadd+=0x1){_0x3581b8=_0x9cb2a[_0x46aadd];if(_[_0x44b8('0x12')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']])){_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]=new WhatsappQueue(_0x3581b8);}else{_0x1ee3cc[_0x44b8('0x13')](_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']],_0x3581b8);}_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']]['updateRouting']();_0x1ee3cc[_0x44b8('0x20')][_0x3581b8['id']][_0x44b8('0x18')]();}}return _0x1ee3cc[_0x44b8('0x20')];};};module['exports']=Realtime; \ No newline at end of file +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x4258ba,_0x51fa6f){var _0x17403b=function(_0x25ef79){while(--_0x25ef79){_0x4258ba['push'](_0x4258ba['shift']());}};_0x17403b(++_0x51fa6f);}(_0x008c,0x188));var _0xc008=function(_0x2e69fb,_0x4359e3){_0x2e69fb=_0x2e69fb-0x0;var _0x4d2404=_0x008c[_0x2e69fb];return _0x4d2404;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 54fdf4f..f4f4251 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 _0xa144=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update'];(function(_0x528f93,_0x1c7c36){var _0x1496ea=function(_0x5be121){while(--_0x5be121){_0x528f93['push'](_0x528f93['shift']());}};_0x1496ea(++_0x1c7c36);}(_0xa144,0x16a));var _0x4a14=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa144[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x4a14('0x0'));exports[_0x4a14('0x1')]=function(_0x5a6a18,_0x3879f0){return client[_0x4a14('0x2')](_0x4a14('0x3'),{'body':_0x3879f0,'options':{'where':{'id':_0x5a6a18}},'log':_0x4a14('0x4')});};exports[_0x4a14('0x5')]=function(_0x3e0573,_0x242a9c){return client['Request'](_0x4a14('0x6'),{'body':_0x242a9c,'options':{'where':{'id':_0x3e0573}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x86b5=['UpdateChatInteraction','updateChatInteraction','addTags','../client','update','Request'];(function(_0x585464,_0xbf5c2b){var _0x5a1fdd=function(_0x40e520){while(--_0x40e520){_0x585464['push'](_0x585464['shift']());}};_0x5a1fdd(++_0xbf5c2b);}(_0x86b5,0x69));var _0x586b=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x86b5[_0x516ffb];return _0x319667;};'use strict';var client=require(_0x586b('0x0'));exports[_0x586b('0x1')]=function(_0x5ed049,_0x4495f6){return client[_0x586b('0x2')](_0x586b('0x3'),{'body':_0x4495f6,'options':{'where':{'id':_0x5ed049}},'log':_0x586b('0x4')});};exports[_0x586b('0x5')]=function(_0x4ec8c6,_0x38f50c){return client[_0x586b('0x2')]('AddTagsToChatInteraction',{'body':_0x38f50c,'options':{'where':{'id':_0x4ec8c6}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3ad56b1..7d9bccb 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 _0x124f=['../client','CreateChatMessage','createChatMessage'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x124f,0x177));var _0xf124=function(_0x52cf23,_0x1c6cf4){_0x52cf23=_0x52cf23-0x0;var _0x428e08=_0x124f[_0x52cf23];return _0x428e08;};'use strict';var client=require(_0xf124('0x0'));exports['create']=function(_0x124152){return client['Request'](_0xf124('0x1'),{'body':_0x124152,'log':_0xf124('0x2')});}; \ No newline at end of file +var _0x05db=['../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05db,0xa8));var _0xb05d=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x05db[_0x49aa7d];return _0xdd0d26;};'use strict';var client=require(_0xb05d('0x0'));exports['create']=function(_0x1b65e0){return client['Request']('CreateChatMessage',{'body':_0x1b65e0,'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 ebefc9d..4b4ba58 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 _0xcab0=['GetChatQueue','timeout','User','name','online','chatPause','getChatQueues','Request'];(function(_0x3390d1,_0x1bf814){var _0x2fb4fc=function(_0x37dc2a){while(--_0x37dc2a){_0x3390d1['push'](_0x3390d1['shift']());}};_0x2fb4fc(++_0x1bf814);}(_0xcab0,0x7e));var _0x0cab=function(_0x46442a,_0x16a123){_0x46442a=_0x46442a-0x0;var _0xe7201a=_0xcab0[_0x46442a];return _0xe7201a;};'use strict';var client=require('../client');exports[_0x0cab('0x0')]=function(){return function(){return client[_0x0cab('0x1')](_0x0cab('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0cab('0x3'),'strategy'],'include':[{'model':_0x0cab('0x4'),'as':'Agents','attributes':['id',_0x0cab('0x5'),_0x0cab('0x6'),_0x0cab('0x7')]}]},'log':_0x0cab('0x0')});};}; \ No newline at end of file +var _0x4949=['../client','getChatQueues','Request','name','timeout','strategy','User','Agents','chatPause'];(function(_0x1bd1ae,_0x233e1a){var _0x2c29fe=function(_0x1e4375){while(--_0x1e4375){_0x1bd1ae['push'](_0x1bd1ae['shift']());}};_0x2c29fe(++_0x233e1a);}(_0x4949,0xbd));var _0x9494=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4949[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x9494('0x0'));exports[_0x9494('0x1')]=function(){return function(){return client[_0x9494('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x9494('0x3'),_0x9494('0x4'),_0x9494('0x5')],'include':[{'model':_0x9494('0x6'),'as':_0x9494('0x7'),'attributes':['id','name','online',_0x9494('0x8')]}]},'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 ad24e65..dc069a0 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 _0x5712=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0xf973b7,_0x46699f){var _0x499087=function(_0x45b42f){while(--_0x45b42f){_0xf973b7['push'](_0xf973b7['shift']());}};_0x499087(++_0x46699f);}(_0x5712,0x140));var _0x2571=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5712[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x2571('0x0'));exports[_0x2571('0x1')]=function(_0x247ab0){return client[_0x2571('0x2')](_0x2571('0x3'),{'body':_0x247ab0,'log':_0x2571('0x3')});};exports[_0x2571('0x4')]=function(_0x1b044e,_0x102dd6){return client[_0x2571('0x2')]('UpdateChatQueueReport',{'body':_0x102dd6,'options':{'where':{'uniqueid':_0x1b044e},'order':[['id','DESC']],'limit':0x1},'log':_0x2571('0x5')});}; \ No newline at end of file +var _0xe2cc=['../client','create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x3da826,_0x2eb0f2){var _0xc4299d=function(_0xae6acb){while(--_0xae6acb){_0x3da826['push'](_0x3da826['shift']());}};_0xc4299d(++_0x2eb0f2);}(_0xe2cc,0x69));var _0xce2c=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xe2cc[_0xefd519];return _0x4bb882;};'use strict';var client=require(_0xce2c('0x0'));exports[_0xce2c('0x1')]=function(_0x59c9fc){return client['Request'](_0xce2c('0x2'),{'body':_0x59c9fc,'log':_0xce2c('0x2')});};exports[_0xce2c('0x3')]=function(_0x15fe3c,_0x25e41a){return client[_0xce2c('0x4')](_0xce2c('0x5'),{'body':_0x25e41a,'options':{'where':{'uniqueid':_0x15fe3c},'order':[['id',_0xce2c('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index bbdd862..eae07d1 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 _0xbb6d=['Request','updateFaxInteraction','addTags','addTagsToFaxInteraction','update'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0xbb6d,0xe5));var _0xdbb6=function(_0x113f80,_0xda48db){_0x113f80=_0x113f80-0x0;var _0x269d0d=_0xbb6d[_0x113f80];return _0x269d0d;};'use strict';var client=require('../client');exports[_0xdbb6('0x0')]=function(_0x4e0629,_0x55506f){return client[_0xdbb6('0x1')]('UpdateFaxInteraction',{'body':_0x55506f,'options':{'where':{'id':_0x4e0629}},'log':_0xdbb6('0x2')});};exports[_0xdbb6('0x3')]=function(_0x16a949,_0x127127){return client['Request']('AddTagsToFaxInteraction',{'body':_0x127127,'options':{'where':{'id':_0x16a949}},'log':_0xdbb6('0x4')});}; \ No newline at end of file +var _0x1637=['addTagsToFaxInteraction','../client','update','Request','updateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x1637,0xda));var _0x7163=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x1637[_0x525c7b];return _0x27b33e;};'use strict';var client=require(_0x7163('0x0'));exports[_0x7163('0x1')]=function(_0x4d3b52,_0x170d09){return client[_0x7163('0x2')]('UpdateFaxInteraction',{'body':_0x170d09,'options':{'where':{'id':_0x4d3b52}},'log':_0x7163('0x3')});};exports[_0x7163('0x4')]=function(_0x564559,_0x4e7f01){return client[_0x7163('0x2')](_0x7163('0x5'),{'body':_0x4e7f01,'options':{'where':{'id':_0x564559}},'log':_0x7163('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2873dfa..6b272c1 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 _0xb32d=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x218fdb,_0x31f459){var _0x35826a=function(_0x189576){while(--_0x189576){_0x218fdb['push'](_0x218fdb['shift']());}};_0x35826a(++_0x31f459);}(_0xb32d,0x112));var _0xdb32=function(_0xe9bfbc,_0x488cd1){_0xe9bfbc=_0xe9bfbc-0x0;var _0x237482=_0xb32d[_0xe9bfbc];return _0x237482;};'use strict';var client=require(_0xdb32('0x0'));exports[_0xdb32('0x1')]=function(_0x5d8ae0){return client[_0xdb32('0x2')](_0xdb32('0x3'),{'body':_0x5d8ae0,'log':_0xdb32('0x4')});}; \ No newline at end of file +var _0x964b=['CreateFaxMessage','createFaxMessage','../client'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x964b,0x116));var _0xb964=function(_0x3f9ef7,_0x43a74f){_0x3f9ef7=_0x3f9ef7-0x0;var _0x4746b1=_0x964b[_0x3f9ef7];return _0x4746b1;};'use strict';var client=require(_0xb964('0x0'));exports['create']=function(_0xb6c14f){return client['Request'](_0xb964('0x1'),{'body':_0xb6c14f,'log':_0xb964('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5d8343d..26512bf 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 _0x0d59=['timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','name'];(function(_0x27a0af,_0x3e18df){var _0x1625a9=function(_0x4173b5){while(--_0x4173b5){_0x27a0af['push'](_0x27a0af['shift']());}};_0x1625a9(++_0x3e18df);}(_0x0d59,0x1a0));var _0x90d5=function(_0x39bfb6,_0x4272c8){_0x39bfb6=_0x39bfb6-0x0;var _0x23fef9=_0x0d59[_0x39bfb6];return _0x23fef9;};'use strict';var client=require(_0x90d5('0x0'));exports[_0x90d5('0x1')]=function(){return function(){return client[_0x90d5('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x90d5('0x3'),_0x90d5('0x4'),_0x90d5('0x5')],'include':[{'model':_0x90d5('0x6'),'as':_0x90d5('0x7'),'attributes':['id',_0x90d5('0x3'),_0x90d5('0x8'),_0x90d5('0x9')]}]},'log':_0x90d5('0x1')});};}; \ No newline at end of file +var _0x3fea=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','User','Agents','online'];(function(_0x3d2415,_0x18cdb3){var _0x1282af=function(_0x2212f4){while(--_0x2212f4){_0x3d2415['push'](_0x3d2415['shift']());}};_0x1282af(++_0x18cdb3);}(_0x3fea,0x183));var _0xa3fe=function(_0x486441,_0x12a028){_0x486441=_0x486441-0x0;var _0x2e5a81=_0x3fea[_0x486441];return _0x2e5a81;};'use strict';var client=require(_0xa3fe('0x0'));exports[_0xa3fe('0x1')]=function(){return function(){return client[_0xa3fe('0x2')](_0xa3fe('0x3'),{'options':{'raw':![],'attributes':['id',_0xa3fe('0x4'),_0xa3fe('0x5'),'strategy'],'include':[{'model':_0xa3fe('0x6'),'as':_0xa3fe('0x7'),'attributes':['id',_0xa3fe('0x4'),_0xa3fe('0x8'),'faxPause']}]},'log':_0xa3fe('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 908a102..416eeea 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 _0x6dfb=['../client','create','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x6dfb,0x14a));var _0xb6df=function(_0x10a3e6,_0x127927){_0x10a3e6=_0x10a3e6-0x0;var _0x44f9b7=_0x6dfb[_0x10a3e6];return _0x44f9b7;};'use strict';var client=require(_0xb6df('0x0'));exports[_0xb6df('0x1')]=function(_0x190dce){return client['Request'](_0xb6df('0x2'),{'body':_0x190dce,'log':_0xb6df('0x2')});};exports[_0xb6df('0x3')]=function(_0x37a373,_0x33b712){return client['Request'](_0xb6df('0x4'),{'body':_0x33b712,'options':{'where':{'uniqueid':_0x37a373},'order':[['id',_0xb6df('0x5')]],'limit':0x1},'log':_0xb6df('0x4')});}; \ No newline at end of file +var _0xc230=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x250fc0,_0xea7311){var _0xb51e9e=function(_0x2dfbb4){while(--_0x2dfbb4){_0x250fc0['push'](_0x250fc0['shift']());}};_0xb51e9e(++_0xea7311);}(_0xc230,0xf3));var _0x0c23=function(_0x33b4c3,_0xc06a7f){_0x33b4c3=_0x33b4c3-0x0;var _0x1021c3=_0xc230[_0x33b4c3];return _0x1021c3;};'use strict';var client=require(_0x0c23('0x0'));exports[_0x0c23('0x1')]=function(_0x47d6c5){return client[_0x0c23('0x2')](_0x0c23('0x3'),{'body':_0x47d6c5,'log':_0x0c23('0x3')});};exports[_0x0c23('0x4')]=function(_0x39eeb9,_0x5647ed){return client[_0x0c23('0x2')](_0x0c23('0x5'),{'body':_0x5647ed,'options':{'where':{'uniqueid':_0x39eeb9},'order':[['id',_0x0c23('0x6')]],'limit':0x1},'log':_0x0c23('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d5dcad1..8e2a26d 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 _0xe820=['../client','Request','Interval','Intervals','name','getIntervals'];(function(_0x35c4b6,_0x3f462e){var _0x444f74=function(_0xee09cb){while(--_0xee09cb){_0x35c4b6['push'](_0x35c4b6['shift']());}};_0x444f74(++_0x3f462e);}(_0xe820,0xd2));var _0x0e82=function(_0x5ae4f1,_0x5d66e4){_0x5ae4f1=_0x5ae4f1-0x0;var _0x1cd341=_0xe820[_0x5ae4f1];return _0x1cd341;};'use strict';var client=require(_0x0e82('0x0'));exports['getIntervals']=function(){return function(){return client[_0x0e82('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x0e82('0x2'),'as':_0x0e82('0x3'),'attributes':['id',_0x0e82('0x4'),'interval']}]},'log':_0x0e82('0x5')});};}; \ No newline at end of file +var _0x6cb4=['getIntervals','Request','GetInterval','name','Interval','Intervals','interval','../client'];(function(_0xb83888,_0x3e9052){var _0x4a6727=function(_0x206f14){while(--_0x206f14){_0xb83888['push'](_0xb83888['shift']());}};_0x4a6727(++_0x3e9052);}(_0x6cb4,0xff));var _0x46cb=function(_0x24cfe4,_0x17bcc3){_0x24cfe4=_0x24cfe4-0x0;var _0x493ef7=_0x6cb4[_0x24cfe4];return _0x493ef7;};'use strict';var client=require(_0x46cb('0x0'));exports[_0x46cb('0x1')]=function(){return function(){return client[_0x46cb('0x2')](_0x46cb('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x46cb('0x4')],'include':[{'model':_0x46cb('0x5'),'as':_0x46cb('0x6'),'attributes':['id',_0x46cb('0x4'),_0x46cb('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2148e73..2e8cb82 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 _0xc530=['UpdateMailInteraction','updateMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x48a0f3,_0x48df0b){var _0x21b18a=function(_0x1978ed){while(--_0x1978ed){_0x48a0f3['push'](_0x48a0f3['shift']());}};_0x21b18a(++_0x48df0b);}(_0xc530,0x9e));var _0x0c53=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xc530[_0x13ce0c];return _0x4388fb;};'use strict';var client=require(_0x0c53('0x0'));exports[_0x0c53('0x1')]=function(_0x273825,_0x2719fe){return client['Request'](_0x0c53('0x2'),{'body':_0x2719fe,'options':{'where':{'id':_0x273825}},'log':_0x0c53('0x3')});};exports['addTags']=function(_0xf1c588,_0x1b7419){return client['Request']('AddTagsToMailInteraction',{'body':_0x1b7419,'options':{'where':{'id':_0xf1c588}},'log':_0x0c53('0x4')});}; \ No newline at end of file +var _0x5fd2=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x2a5b82,_0xc61f63){var _0x322e1a=function(_0x3b2858){while(--_0x3b2858){_0x2a5b82['push'](_0x2a5b82['shift']());}};_0x322e1a(++_0xc61f63);}(_0x5fd2,0x92));var _0x25fd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5fd2[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0x25fd('0x0')]=function(_0x33f81c,_0xef491a){return client[_0x25fd('0x1')](_0x25fd('0x2'),{'body':_0xef491a,'options':{'where':{'id':_0x33f81c}},'log':_0x25fd('0x3')});};exports[_0x25fd('0x4')]=function(_0x2d3c86,_0x2f80d9){return client['Request'](_0x25fd('0x5'),{'body':_0x2f80d9,'options':{'where':{'id':_0x2d3c86}},'log':_0x25fd('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2898c79..35f9f81 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 _0xec60=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x5931eb,_0x5a4038){var _0x292a97=function(_0x352fb2){while(--_0x352fb2){_0x5931eb['push'](_0x5931eb['shift']());}};_0x292a97(++_0x5a4038);}(_0xec60,0x16a));var _0x0ec6=function(_0x2ee7a8,_0x302bc9){_0x2ee7a8=_0x2ee7a8-0x0;var _0x283aef=_0xec60[_0x2ee7a8];return _0x283aef;};'use strict';var client=require('../client');exports[_0x0ec6('0x0')]=function(_0x2f2ffb){return client[_0x0ec6('0x1')](_0x0ec6('0x2'),{'body':_0x2f2ffb,'log':_0x0ec6('0x3')});}; \ No newline at end of file +var _0x6f77=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x175b1f,_0x19792f){var _0x34a6cd=function(_0x23f960){while(--_0x23f960){_0x175b1f['push'](_0x175b1f['shift']());}};_0x34a6cd(++_0x19792f);}(_0x6f77,0xc7));var _0x76f7=function(_0xe1b2a8,_0x38f786){_0xe1b2a8=_0xe1b2a8-0x0;var _0x554804=_0x6f77[_0xe1b2a8];return _0x554804;};'use strict';var client=require(_0x76f7('0x0'));exports[_0x76f7('0x1')]=function(_0x51963c){return client[_0x76f7('0x2')](_0x76f7('0x3'),{'body':_0x51963c,'log':_0x76f7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c7dd260..32d1a3e 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 _0x537e=['Agents','online','mailPause','../client','getMailQueues','Request','name','strategy'];(function(_0x246cf8,_0x254192){var _0x98f540=function(_0x19d912){while(--_0x19d912){_0x246cf8['push'](_0x246cf8['shift']());}};_0x98f540(++_0x254192);}(_0x537e,0xf3));var _0xe537=function(_0x2e9c6f,_0x52f83f){_0x2e9c6f=_0x2e9c6f-0x0;var _0x535602=_0x537e[_0x2e9c6f];return _0x535602;};'use strict';var client=require(_0xe537('0x0'));exports[_0xe537('0x1')]=function(){return function(){return client[_0xe537('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xe537('0x3'),'timeout',_0xe537('0x4')],'include':[{'model':'User','as':_0xe537('0x5'),'attributes':['id',_0xe537('0x3'),_0xe537('0x6'),_0xe537('0x7')]}]},'log':_0xe537('0x1')});};}; \ No newline at end of file +var _0xd383=['timeout','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x3d2877,_0x55b976){var _0x57c92f=function(_0x386176){while(--_0x386176){_0x3d2877['push'](_0x3d2877['shift']());}};_0x57c92f(++_0x55b976);}(_0xd383,0x113));var _0x3d38=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xd383[_0x2642cb];return _0xe6e41;};'use strict';var client=require(_0x3d38('0x0'));exports[_0x3d38('0x1')]=function(){return function(){return client[_0x3d38('0x2')](_0x3d38('0x3'),{'options':{'raw':![],'attributes':['id',_0x3d38('0x4'),_0x3d38('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x3d38('0x4'),_0x3d38('0x6'),_0x3d38('0x7')]}]},'log':_0x3d38('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 1db9ba0..0c77b53 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 _0xe675=['UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport','update'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xe675,0x80));var _0x5e67=function(_0x279c9a,_0x2095ce){_0x279c9a=_0x279c9a-0x0;var _0x4b712b=_0xe675[_0x279c9a];return _0x4b712b;};'use strict';var client=require(_0x5e67('0x0'));exports['create']=function(_0x23212f){return client[_0x5e67('0x1')]('CreateMailQueueReport',{'body':_0x23212f,'log':_0x5e67('0x2')});};exports[_0x5e67('0x3')]=function(_0x1df1b0,_0x517c9e){return client[_0x5e67('0x1')](_0x5e67('0x4'),{'body':_0x517c9e,'options':{'where':{'uniqueid':_0x1df1b0},'order':[['id',_0x5e67('0x5')]],'limit':0x1},'log':_0x5e67('0x4')});}; \ No newline at end of file +var _0xe393=['Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client'];(function(_0x536da1,_0x28ea73){var _0x4c1a21=function(_0x1977fa){while(--_0x1977fa){_0x536da1['push'](_0x536da1['shift']());}};_0x4c1a21(++_0x28ea73);}(_0xe393,0xe9));var _0x3e39=function(_0x2a8122,_0xd957e){_0x2a8122=_0x2a8122-0x0;var _0x49a5c7=_0xe393[_0x2a8122];return _0x49a5c7;};'use strict';var client=require(_0x3e39('0x0'));exports['create']=function(_0x26a820){return client[_0x3e39('0x1')](_0x3e39('0x2'),{'body':_0x26a820,'log':'CreateMailQueueReport'});};exports[_0x3e39('0x3')]=function(_0x46efb6,_0xc7aae4){return client[_0x3e39('0x1')]('UpdateMailQueueReport',{'body':_0xc7aae4,'options':{'where':{'uniqueid':_0x46efb6},'order':[['id',_0x3e39('0x4')]],'limit':0x1},'log':_0x3e39('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d887e63..9f3fc76 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 _0x39ca=['../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0x1b3323,_0x3bab58){var _0x2b62a6=function(_0x507512){while(--_0x507512){_0x1b3323['push'](_0x1b3323['shift']());}};_0x2b62a6(++_0x3bab58);}(_0x39ca,0x13b));var _0xa39c=function(_0x42225e,_0x1164f2){_0x42225e=_0x42225e-0x0;var _0x2bf9e5=_0x39ca[_0x42225e];return _0x2bf9e5;};'use strict';var client=require(_0xa39c('0x0'));exports[_0xa39c('0x1')]=function(_0x207237,_0x48be1f){return client[_0xa39c('0x2')](_0xa39c('0x3'),{'body':_0x48be1f,'options':{'where':{'id':_0x207237}},'log':'updateOpenchannelInteraction'});};exports[_0xa39c('0x4')]=function(_0x8e04e7,_0x189078){return client[_0xa39c('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x189078,'options':{'where':{'id':_0x8e04e7}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x9105=['Request','AddTagsToOpenchannelInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x22a8ff,_0x3cfd02){var _0x35b165=function(_0x1649e5){while(--_0x1649e5){_0x22a8ff['push'](_0x22a8ff['shift']());}};_0x35b165(++_0x3cfd02);}(_0x9105,0xd4));var _0x5910=function(_0x5b4224,_0x32ed27){_0x5b4224=_0x5b4224-0x0;var _0x137276=_0x9105[_0x5b4224];return _0x137276;};'use strict';var client=require(_0x5910('0x0'));exports[_0x5910('0x1')]=function(_0x232964,_0x15577c){return client['Request'](_0x5910('0x2'),{'body':_0x15577c,'options':{'where':{'id':_0x232964}},'log':_0x5910('0x3')});};exports[_0x5910('0x4')]=function(_0x38a155,_0xf82959){return client[_0x5910('0x5')](_0x5910('0x6'),{'body':_0xf82959,'options':{'where':{'id':_0x38a155}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1cef25f..8660482 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 _0x153f=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x153f,0x15b));var _0xf153=function(_0x4d4b71,_0x2dafaa){_0x4d4b71=_0x4d4b71-0x0;var _0x1d6ce7=_0x153f[_0x4d4b71];return _0x1d6ce7;};'use strict';var client=require(_0xf153('0x0'));exports[_0xf153('0x1')]=function(_0xde7eae){return client[_0xf153('0x2')](_0xf153('0x3'),{'body':_0xde7eae,'log':_0xf153('0x4')});}; \ No newline at end of file +var _0x9bde=['create','Request','createOpenchannelMessage'];(function(_0x3efa4f,_0x15f08c){var _0x523be6=function(_0x13bf43){while(--_0x13bf43){_0x3efa4f['push'](_0x3efa4f['shift']());}};_0x523be6(++_0x15f08c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x377629,_0x3e8b8c){_0x377629=_0x377629-0x0;var _0x2524d6=_0x9bde[_0x377629];return _0x2524d6;};'use strict';var client=require('../client');exports[_0xe9bd('0x0')]=function(_0x4defda){return client[_0xe9bd('0x1')]('CreateOpenchannelMessage',{'body':_0x4defda,'log':_0xe9bd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 4073564..607650d 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 _0x142e=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x399119,_0x4e4cb6){var _0x2e8d00=function(_0x5060a2){while(--_0x5060a2){_0x399119['push'](_0x399119['shift']());}};_0x2e8d00(++_0x4e4cb6);}(_0x142e,0xa8));var _0xe142=function(_0x4e0830,_0xde5070){_0x4e0830=_0x4e0830-0x0;var _0x38a96b=_0x142e[_0x4e0830];return _0x38a96b;};'use strict';var client=require(_0xe142('0x0'));exports[_0xe142('0x1')]=function(){return function(){return client[_0xe142('0x2')](_0xe142('0x3'),{'options':{'raw':![],'attributes':['id',_0xe142('0x4'),_0xe142('0x5'),_0xe142('0x6')],'include':[{'model':_0xe142('0x7'),'as':_0xe142('0x8'),'attributes':['id',_0xe142('0x4'),_0xe142('0x9'),_0xe142('0xa')]}]},'log':_0xe142('0x1')});};}; \ No newline at end of file +var _0xd9eb=['User','Agents','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x40d946,_0x57b03b){var _0x5ddc1f=function(_0x34f0c4){while(--_0x34f0c4){_0x40d946['push'](_0x40d946['shift']());}};_0x5ddc1f(++_0x57b03b);}(_0xd9eb,0xe1));var _0xbd9e=function(_0x53f707,_0x51a2f7){_0x53f707=_0x53f707-0x0;var _0x10a9f5=_0xd9eb[_0x53f707];return _0x10a9f5;};'use strict';var client=require(_0xbd9e('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0xbd9e('0x1')](_0xbd9e('0x2'),{'options':{'raw':![],'attributes':['id',_0xbd9e('0x3'),_0xbd9e('0x4'),_0xbd9e('0x5')],'include':[{'model':_0xbd9e('0x6'),'as':_0xbd9e('0x7'),'attributes':['id',_0xbd9e('0x3'),_0xbd9e('0x8'),_0xbd9e('0x9')]}]},'log':_0xbd9e('0xa')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 6bd60f6..19a048e 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 _0x3eb6=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','create'];(function(_0x52b215,_0x59ebb0){var _0x3a08e8=function(_0x44e374){while(--_0x44e374){_0x52b215['push'](_0x52b215['shift']());}};_0x3a08e8(++_0x59ebb0);}(_0x3eb6,0x197));var _0x63eb=function(_0x3607f9,_0x14a452){_0x3607f9=_0x3607f9-0x0;var _0x1f2318=_0x3eb6[_0x3607f9];return _0x1f2318;};'use strict';var client=require('../client');exports[_0x63eb('0x0')]=function(_0x27bcc2){return client[_0x63eb('0x1')](_0x63eb('0x2'),{'body':_0x27bcc2,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x5c9c4d,_0x2e185d){return client[_0x63eb('0x1')](_0x63eb('0x3'),{'body':_0x2e185d,'options':{'where':{'uniqueid':_0x5c9c4d},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xa7bd=['CreateOpenchannelQueueReport','update','DESC','../client','create','Request'];(function(_0x1dd14f,_0x5a07dd){var _0x259689=function(_0x4a1ff6){while(--_0x4a1ff6){_0x1dd14f['push'](_0x1dd14f['shift']());}};_0x259689(++_0x5a07dd);}(_0xa7bd,0x141));var _0xda7b=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xa7bd[_0x47aa64];return _0x549c7a;};'use strict';var client=require(_0xda7b('0x0'));exports[_0xda7b('0x1')]=function(_0x5b36a3){return client[_0xda7b('0x2')](_0xda7b('0x3'),{'body':_0x5b36a3,'log':_0xda7b('0x3')});};exports[_0xda7b('0x4')]=function(_0xc0dcc5,_0xffd072){return client[_0xda7b('0x2')]('UpdateOpenchannelQueueReport',{'body':_0xffd072,'options':{'where':{'uniqueid':_0xc0dcc5},'order':[['id',_0xda7b('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 b81ace0..85fbaa8 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 _0x8bdc=['addTagsToSmsInteraction','../client'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x8bdc,0x11d));var _0xc8bd=function(_0x59f85a,_0x33c81a){_0x59f85a=_0x59f85a-0x0;var _0x1b6bbe=_0x8bdc[_0x59f85a];return _0x1b6bbe;};'use strict';var client=require(_0xc8bd('0x0'));exports['update']=function(_0x315eda,_0x5eda62){return client['Request']('UpdateSmsInteraction',{'body':_0x5eda62,'options':{'where':{'id':_0x315eda}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x11b603,_0x3ed65e){return client['Request']('AddTagsToSmsInteraction',{'body':_0x3ed65e,'options':{'where':{'id':_0x11b603}},'log':_0xc8bd('0x1')});}; \ No newline at end of file +var _0x8ac1=['Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8ac1,0x147));var _0x18ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8ac1[_0x4565bf];return _0x5610ba;};'use strict';var client=require(_0x18ac('0x0'));exports[_0x18ac('0x1')]=function(_0x54e94e,_0x350c2d){return client[_0x18ac('0x2')](_0x18ac('0x3'),{'body':_0x350c2d,'options':{'where':{'id':_0x54e94e}},'log':'updateSmsInteraction'});};exports[_0x18ac('0x4')]=function(_0x28f02f,_0x294287){return client[_0x18ac('0x2')](_0x18ac('0x5'),{'body':_0x294287,'options':{'where':{'id':_0x28f02f}},'log':_0x18ac('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2f085f1..7c60bf7 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 _0xf681=['create','Request','CreateSmsMessage'];(function(_0x13fd59,_0x2e05b1){var _0x2e6ce7=function(_0x519a4b){while(--_0x519a4b){_0x13fd59['push'](_0x13fd59['shift']());}};_0x2e6ce7(++_0x2e05b1);}(_0xf681,0xc9));var _0x1f68=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf681[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require('../client');exports[_0x1f68('0x0')]=function(_0x1487f6){return client[_0x1f68('0x1')](_0x1f68('0x2'),{'body':_0x1487f6,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xae6e=['CreateSmsMessage','createSmsMessage','create'];(function(_0x39d474,_0x280fb6){var _0x5915ca=function(_0x5233c1){while(--_0x5233c1){_0x39d474['push'](_0x39d474['shift']());}};_0x5915ca(++_0x280fb6);}(_0xae6e,0x1c1));var _0xeae6=function(_0x5443cc,_0xbe0622){_0x5443cc=_0x5443cc-0x0;var _0x4f6746=_0xae6e[_0x5443cc];return _0x4f6746;};'use strict';var client=require('../client');exports[_0xeae6('0x0')]=function(_0x38be7e){return client['Request'](_0xeae6('0x1'),{'body':_0x38be7e,'log':_0xeae6('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 753bcee..eed57fc 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 _0xaf04=['getSmsQueues','GetSmsQueue','name','strategy','Agents','online'];(function(_0x3b4203,_0x33c424){var _0x45d6d7=function(_0x928e1d){while(--_0x928e1d){_0x3b4203['push'](_0x3b4203['shift']());}};_0x45d6d7(++_0x33c424);}(_0xaf04,0x9d));var _0x4af0=function(_0x24b629,_0xad8dd1){_0x24b629=_0x24b629-0x0;var _0x3c18b7=_0xaf04[_0x24b629];return _0x3c18b7;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client['Request'](_0x4af0('0x0'),{'options':{'raw':![],'attributes':['id',_0x4af0('0x1'),'timeout',_0x4af0('0x2')],'include':[{'model':'User','as':_0x4af0('0x3'),'attributes':['id',_0x4af0('0x1'),_0x4af0('0x4'),'smsPause']}]},'log':_0x4af0('0x5')});};}; \ No newline at end of file +var _0x91c8=['smsPause','../client','getSmsQueues','name','timeout','User','Agents','online'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x91c8,0x129));var _0x891c=function(_0x2f71a8,_0x11563c){_0x2f71a8=_0x2f71a8-0x0;var _0x5059cc=_0x91c8[_0x2f71a8];return _0x5059cc;};'use strict';var client=require(_0x891c('0x0'));exports[_0x891c('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x891c('0x2'),_0x891c('0x3'),'strategy'],'include':[{'model':_0x891c('0x4'),'as':_0x891c('0x5'),'attributes':['id',_0x891c('0x2'),_0x891c('0x6'),_0x891c('0x7')]}]},'log':_0x891c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index bfa67c8..b582862 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 _0x5b64=['update','DESC','UpdateSmsQueueReport','../client','create','Request','CreateSmsQueueReport'];(function(_0x488304,_0x5b5b0e){var _0x51f958=function(_0xdc55ce){while(--_0xdc55ce){_0x488304['push'](_0x488304['shift']());}};_0x51f958(++_0x5b5b0e);}(_0x5b64,0x16f));var _0x45b6=function(_0x49880,_0x494c8a){_0x49880=_0x49880-0x0;var _0x229556=_0x5b64[_0x49880];return _0x229556;};'use strict';var client=require(_0x45b6('0x0'));exports[_0x45b6('0x1')]=function(_0x4d19de){return client[_0x45b6('0x2')]('CreateSmsQueueReport',{'body':_0x4d19de,'log':_0x45b6('0x3')});};exports[_0x45b6('0x4')]=function(_0x1db287,_0x15541f){return client[_0x45b6('0x2')]('UpdateSmsQueueReport',{'body':_0x15541f,'options':{'where':{'uniqueid':_0x1db287},'order':[['id',_0x45b6('0x5')]],'limit':0x1},'log':_0x45b6('0x6')});}; \ No newline at end of file +var _0x94e7=['update','Request','UpdateSmsQueueReport','DESC','create','CreateSmsQueueReport'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x94e7,0x7c));var _0x794e=function(_0x1a1285,_0x4614df){_0x1a1285=_0x1a1285-0x0;var _0x3b39f6=_0x94e7[_0x1a1285];return _0x3b39f6;};'use strict';var client=require('../client');exports[_0x794e('0x0')]=function(_0x11a613){return client['Request']('CreateSmsQueueReport',{'body':_0x11a613,'log':_0x794e('0x1')});};exports[_0x794e('0x2')]=function(_0x411fc5,_0x53871d){return client[_0x794e('0x3')](_0x794e('0x4'),{'body':_0x53871d,'options':{'where':{'uniqueid':_0x411fc5},'order':[['id',_0x794e('0x5')]],'limit':0x1},'log':_0x794e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 66b0acf..7278931 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 _0x1ae6=['whatsappCapacity','openchannelCapacity','getAgents','../client','Request','GetUser','name','online','pauseType','lastPauseAt','voicePause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','mailCapacity','smsCapacity'];(function(_0x632b63,_0x44ff9c){var _0x212574=function(_0x418722){while(--_0x418722){_0x632b63['push'](_0x632b63['shift']());}};_0x212574(++_0x44ff9c);}(_0x1ae6,0xed));var _0x61ae=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1ae6[_0x311c35];return _0x5cc50c;};'use strict';var client=require(_0x61ae('0x0'));exports['getAgents']=function(){return function(){return client[_0x61ae('0x1')](_0x61ae('0x2'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x61ae('0x3'),_0x61ae('0x4'),_0x61ae('0x5'),_0x61ae('0x6'),_0x61ae('0x7'),'chatPause',_0x61ae('0x8'),_0x61ae('0x9'),_0x61ae('0xa'),_0x61ae('0xb'),_0x61ae('0xc'),'chatCapacity',_0x61ae('0xd'),'faxCapacity',_0x61ae('0xe'),_0x61ae('0xf'),_0x61ae('0x10')]},'log':_0x61ae('0x11')});};}; \ No newline at end of file +var _0x8fac=['mailPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','GetUser','name','pauseType','lastPauseAt','voicePause','chatPause'];(function(_0x47b414,_0x350e97){var _0x56788c=function(_0x331f18){while(--_0x331f18){_0x47b414['push'](_0x47b414['shift']());}};_0x56788c(++_0x350e97);}(_0x8fac,0xcb));var _0xc8fa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8fac[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0xc8fa('0x0')]=function(){return function(){return client['Request'](_0xc8fa('0x1'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xc8fa('0x2'),'online',_0xc8fa('0x3'),_0xc8fa('0x4'),_0xc8fa('0x5'),_0xc8fa('0x6'),_0xc8fa('0x7'),'faxPause','smsPause','whatsappPause',_0xc8fa('0x8'),'chatCapacity',_0xc8fa('0x9'),_0xc8fa('0xa'),_0xc8fa('0xb'),_0xc8fa('0xc'),_0xc8fa('0xd')]},'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 d18d331..57a87b9 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 _0x1782=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x1782,0x13e));var _0x2178=function(_0x2b6858,_0x6830e){_0x2b6858=_0x2b6858-0x0;var _0x436b37=_0x1782[_0x2b6858];return _0x436b37;};'use strict';var client=require(_0x2178('0x0'));exports['update']=function(_0x131618,_0xbbb315){return client[_0x2178('0x1')](_0x2178('0x2'),{'body':_0xbbb315,'options':{'where':{'id':_0x131618}},'log':_0x2178('0x3')});};exports['addTags']=function(_0x601378,_0x1659a1){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x1659a1,'options':{'where':{'id':_0x601378}},'log':_0x2178('0x4')});}; \ No newline at end of file +var _0x46fc=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x2874a7,_0x8bd84){var _0x3d560c=function(_0x46fb70){while(--_0x46fb70){_0x2874a7['push'](_0x2874a7['shift']());}};_0x3d560c(++_0x8bd84);}(_0x46fc,0x103));var _0xc46f=function(_0x25c4dd,_0x4419bc){_0x25c4dd=_0x25c4dd-0x0;var _0x4d82f4=_0x46fc[_0x25c4dd];return _0x4d82f4;};'use strict';var client=require(_0xc46f('0x0'));exports[_0xc46f('0x1')]=function(_0xf5212c,_0x23d3ae){return client[_0xc46f('0x2')](_0xc46f('0x3'),{'body':_0x23d3ae,'options':{'where':{'id':_0xf5212c}},'log':_0xc46f('0x4')});};exports[_0xc46f('0x5')]=function(_0x3a56db,_0x5b0483){return client['Request'](_0xc46f('0x6'),{'body':_0x5b0483,'options':{'where':{'id':_0x3a56db}},'log':_0xc46f('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2fbab9f..3447561 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 _0x1c01=['Request','createWhatsappMessage','../client','create'];(function(_0x503646,_0x453904){var _0x5c4ae4=function(_0xea9944){while(--_0xea9944){_0x503646['push'](_0x503646['shift']());}};_0x5c4ae4(++_0x453904);}(_0x1c01,0xbe));var _0x11c0=function(_0x155f62,_0x5cb395){_0x155f62=_0x155f62-0x0;var _0xde3bc6=_0x1c01[_0x155f62];return _0xde3bc6;};'use strict';var client=require(_0x11c0('0x0'));exports[_0x11c0('0x1')]=function(_0x990ccf){return client[_0x11c0('0x2')]('CreateWhatsappMessage',{'body':_0x990ccf,'log':_0x11c0('0x3')});}; \ No newline at end of file +var _0x61ff=['Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x34357e,_0x5af72a){var _0x488189=function(_0xa54a00){while(--_0xa54a00){_0x34357e['push'](_0x34357e['shift']());}};_0x488189(++_0x5af72a);}(_0x61ff,0x73));var _0xf61f=function(_0x10b48a,_0x1a0a3f){_0x10b48a=_0x10b48a-0x0;var _0x2c4533=_0x61ff[_0x10b48a];return _0x2c4533;};'use strict';var client=require(_0xf61f('0x0'));exports['create']=function(_0x2b5aa4){return client[_0xf61f('0x1')](_0xf61f('0x2'),{'body':_0x2b5aa4,'log':_0xf61f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 263461b..726b790 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 _0x422f=['GetWhatsappQueue','name','strategy','User','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x4819b4,_0x1e0195){var _0x2d01d3=function(_0x11489f){while(--_0x11489f){_0x4819b4['push'](_0x4819b4['shift']());}};_0x2d01d3(++_0x1e0195);}(_0x422f,0x1c7));var _0xf422=function(_0x179177,_0x5da1a3){_0x179177=_0x179177-0x0;var _0x4cead7=_0x422f[_0x179177];return _0x4cead7;};'use strict';var client=require('../client');exports[_0xf422('0x0')]=function(){return function(){return client['Request'](_0xf422('0x1'),{'options':{'raw':![],'attributes':['id',_0xf422('0x2'),'timeout',_0xf422('0x3')],'include':[{'model':_0xf422('0x4'),'as':_0xf422('0x5'),'attributes':['id',_0xf422('0x2'),_0xf422('0x6'),_0xf422('0x7')]}]},'log':_0xf422('0x0')});};}; \ No newline at end of file +var _0x8a5c=['online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x8a5c,0x136));var _0xc8a5=function(_0x2a1459,_0x507b1f){_0x2a1459=_0x2a1459-0x0;var _0x744a61=_0x8a5c[_0x2a1459];return _0x744a61;};'use strict';var client=require(_0xc8a5('0x0'));exports[_0xc8a5('0x1')]=function(){return function(){return client[_0xc8a5('0x2')](_0xc8a5('0x3'),{'options':{'raw':![],'attributes':['id',_0xc8a5('0x4'),_0xc8a5('0x5'),_0xc8a5('0x6')],'include':[{'model':_0xc8a5('0x7'),'as':_0xc8a5('0x8'),'attributes':['id','name',_0xc8a5('0x9'),_0xc8a5('0xa')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index cc8e54a..8c8f8b1 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 _0x0a6e=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x384035,_0x16b0f7){var _0x4560c3=function(_0x303d6b){while(--_0x303d6b){_0x384035['push'](_0x384035['shift']());}};_0x4560c3(++_0x16b0f7);}(_0x0a6e,0xea));var _0xe0a6=function(_0x5251a6,_0x2be2d6){_0x5251a6=_0x5251a6-0x0;var _0x5b5af6=_0x0a6e[_0x5251a6];return _0x5b5af6;};'use strict';var client=require('../client');exports[_0xe0a6('0x0')]=function(_0x213efd){return client[_0xe0a6('0x1')](_0xe0a6('0x2'),{'body':_0x213efd,'log':_0xe0a6('0x2')});};exports[_0xe0a6('0x3')]=function(_0x986873,_0x23d88d){return client[_0xe0a6('0x1')](_0xe0a6('0x4'),{'body':_0x23d88d,'options':{'where':{'uniqueid':_0x986873},'order':[['id',_0xe0a6('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x7243=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x2ea725,_0x429ede){var _0x33fb61=function(_0x13ad58){while(--_0x13ad58){_0x2ea725['push'](_0x2ea725['shift']());}};_0x33fb61(++_0x429ede);}(_0x7243,0xb9));var _0x3724=function(_0x153732,_0x382255){_0x153732=_0x153732-0x0;var _0x44585a=_0x7243[_0x153732];return _0x44585a;};'use strict';var client=require(_0x3724('0x0'));exports[_0x3724('0x1')]=function(_0x33a126){return client[_0x3724('0x2')](_0x3724('0x3'),{'body':_0x33a126,'log':_0x3724('0x3')});};exports[_0x3724('0x4')]=function(_0x256e04,_0x3e0b95){return client['Request'](_0x3724('0x5'),{'body':_0x3e0b95,'options':{'where':{'uniqueid':_0x256e04},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index eff79ce..a0c245f 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 _0xd6b5=['createQueue','atimeout','channel','START:%s','rules','end','close','info','[%s][AGENT]\x20ROUTING\x20END','next','log','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','routing','./strategy','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find'];(function(_0xb4b6fb,_0x4c7e78){var _0x1fd50a=function(_0x5b0947){while(--_0x5b0947){_0xb4b6fb['push'](_0xb4b6fb['shift']());}};_0x1fd50a(++_0x4c7e78);}(_0xd6b5,0x95));var _0x5d6b=function(_0x36d8a5,_0x241eca){_0x36d8a5=_0x36d8a5-0x0;var _0x1d026f=_0xd6b5[_0x36d8a5];return _0x1d026f;};'use strict';var schema=require('validate');var _=require(_0x5d6b('0x0'));var util=require(_0x5d6b('0x1'));var seqqueue=require(_0x5d6b('0x2'));var logger=require('../../../../config/logger')(_0x5d6b('0x3'));var strategy=require(_0x5d6b('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x5d6b('0x5'),'message':_0x5d6b('0x6')}});function writeLog(_0x423521,_0x1f6669,_0x44f9fa){return logger['info'](util[_0x5d6b('0x7')](_0x5d6b('0x8'),_0x423521,_0x1f6669[_0x5d6b('0x9')],_0x44f9fa));}function handleFindAgent(_0x5da3ec){return function(_0x3955ca){return _0x3955ca[_0x5d6b('0x9')][_0x5d6b('0xa')]()===_0x5da3ec[_0x5d6b('0xa')]();};}exports[_0x5d6b('0xb')]=function(_0x153dbc,_0x573ff2,_0x5862a0,_0x33ee89){return function(_0x507a90){try{var _0x948c3d={'name':_0x573ff2[0x0],'timeout':_0x573ff2[0x1]};var _0x5d2005=queue[_0x5d6b('0xc')](_0x948c3d,{'typecast':!![]});if(_0x5d2005[_0x5d6b('0xd')]){logger[_0x5d6b('0xe')](_0x5d6b('0xf'),_0x153dbc,_[_0x5d6b('0x10')](_0x5d2005,_0x5d6b('0x11'))[_0x5d6b('0x12')](',\x20'));_0x507a90[_0x5d6b('0x13')]();}else{var _0xfa9f3c=_[_0x5d6b('0x14')](_0x5862a0['agents'],handleFindAgent(_0x948c3d[_0x5d6b('0x9')]));if(_0xfa9f3c){var _0x3775d1=(_0x948c3d['timeout']||0xa)*0x3e8;var _0x221521,_0x135d0c;var _0x256fdc=seqqueue[_0x5d6b('0x15')](_0x3775d1);_0x256fdc['id']=_0x153dbc;_0x256fdc[_0x5d6b('0x16')]=_0x3775d1;_0x256fdc[_0x5d6b('0x17')]=_0x33ee89['channel'];writeLog(_0x153dbc,_0xfa9f3c,util[_0x5d6b('0x7')](_0x5d6b('0x18'),_0x3775d1));_0x5862a0[_0x5d6b('0x19')][_0x153dbc]['on'](_0x5d6b('0x1a'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x153dbc);clearTimeout(_0x135d0c);_0x135d0c=undefined;_0x256fdc[_0x5d6b('0x1b')]();if(_0x5862a0[_0x5d6b('0x19')][_0x153dbc]){delete _0x5862a0['rules'][_0x153dbc];}_0x507a90['stop']();});_0x5862a0[_0x5d6b('0x19')][_0x153dbc]['on']('complete',function(){if(_0x5862a0[_0x5d6b('0x19')][_0x153dbc]){delete _0x5862a0[_0x5d6b('0x19')][_0x153dbc];}});_0x135d0c=setTimeout(function(){logger[_0x5d6b('0x1c')](_0x5d6b('0x1d'),_0x153dbc);clearTimeout(_0x135d0c);_0x256fdc[_0x5d6b('0x1b')]();_0x507a90[_0x5d6b('0x1e')]();},_0x3775d1);strategy['agent'](_0x256fdc,_0xfa9f3c,_0x5862a0,_0x33ee89);}else{logger[_0x5d6b('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x153dbc,_0x948c3d['name']);_0x507a90[_0x5d6b('0x13')]();}}}catch(_0x221add){console[_0x5d6b('0x1f')](_0x221add);logger[_0x5d6b('0xe')](_0x5d6b('0x20'),_0x153dbc,_0x221add[_0x5d6b('0x21')]);_0x507a90[_0x5d6b('0x13')]();}};}; \ No newline at end of file +var _0x2be1=['START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','createQueue','atimeout'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x2be1,0xbe));var _0x12be=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x2be1[_0x2f3ecd];return _0xffdc44;};'use strict';var schema=require(_0x12be('0x0'));var _=require(_0x12be('0x1'));var util=require(_0x12be('0x2'));var seqqueue=require(_0x12be('0x3'));var logger=require(_0x12be('0x4'))(_0x12be('0x5'));var strategy=require(_0x12be('0x6'));var queue=schema({'name':{'type':_0x12be('0x7'),'required':!![],'message':_0x12be('0x8')},'timeout':{'type':_0x12be('0x9'),'message':_0x12be('0xa')}});function writeLog(_0x25f1cb,_0x2b12d3,_0x4728c5){return logger[_0x12be('0xb')](util['format'](_0x12be('0xc'),_0x25f1cb,_0x2b12d3[_0x12be('0xd')],_0x4728c5));}function handleFindAgent(_0x2cae33){return function(_0x490722){return _0x490722[_0x12be('0xd')][_0x12be('0xe')]()===_0x2cae33[_0x12be('0xe')]();};}exports[_0x12be('0xf')]=function(_0x4fa32e,_0x19234f,_0x20894e,_0x5f54c5){return function(_0x44f52b){try{var _0x259a11={'name':_0x19234f[0x0],'timeout':_0x19234f[0x1]};var _0x5e4762=queue[_0x12be('0x0')](_0x259a11,{'typecast':!![]});if(_0x5e4762[_0x12be('0x10')]){logger[_0x12be('0x11')](_0x12be('0x12'),_0x4fa32e,_['map'](_0x5e4762,_0x12be('0x13'))[_0x12be('0x14')](',\x20'));_0x44f52b[_0x12be('0x15')]();}else{var _0x50ac78=_[_0x12be('0x16')](_0x20894e[_0x12be('0x17')],handleFindAgent(_0x259a11[_0x12be('0xd')]));if(_0x50ac78){var _0x19d443=(_0x259a11['timeout']||0xa)*0x3e8;var _0x14819c,_0x2eb778;var _0x596b5c=seqqueue[_0x12be('0x18')](_0x19d443);_0x596b5c['id']=_0x4fa32e;_0x596b5c[_0x12be('0x19')]=_0x19d443;_0x596b5c['channel']=_0x5f54c5['channel'];writeLog(_0x4fa32e,_0x50ac78,util['format'](_0x12be('0x1a'),_0x19d443));_0x20894e[_0x12be('0x1b')][_0x4fa32e]['on']('end',function(){logger[_0x12be('0xb')](_0x12be('0x1c'),_0x4fa32e);clearTimeout(_0x2eb778);_0x2eb778=undefined;_0x596b5c[_0x12be('0x1d')]();if(_0x20894e['rules'][_0x4fa32e]){delete _0x20894e[_0x12be('0x1b')][_0x4fa32e];}_0x44f52b[_0x12be('0x15')]();});_0x20894e[_0x12be('0x1b')][_0x4fa32e]['on'](_0x12be('0x1e'),function(){if(_0x20894e['rules'][_0x4fa32e]){delete _0x20894e['rules'][_0x4fa32e];}});_0x2eb778=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x4fa32e);clearTimeout(_0x2eb778);_0x596b5c['close']();_0x44f52b[_0x12be('0x1f')]();},_0x19d443);strategy[_0x12be('0x20')](_0x596b5c,_0x50ac78,_0x20894e,_0x5f54c5);}else{logger[_0x12be('0x11')](_0x12be('0x21'),_0x4fa32e,_0x259a11[_0x12be('0xd')]);_0x44f52b[_0x12be('0x15')]();}}}catch(_0x1fd4fc){console[_0x12be('0x22')](_0x1fd4fc);logger[_0x12be('0x11')]('[%s][QUEUE]\x20%s',_0x4fa32e,_0x1fd4fc[_0x12be('0x23')]);_0x44f52b[_0x12be('0x15')]();}};}; \ 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 96db69c..ef85b95 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 _0xdbf5=['$LATEST','channel','interaction','toString','postText','message','amazonlex','dialogState','Failed','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','getMustacheRender','Message','create','then','info','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime'];(function(_0x2dab3c,_0x1182b7){var _0x1b6eef=function(_0x2ab81a){while(--_0x2ab81a){_0x2dab3c['push'](_0x2dab3c['shift']());}};_0x1b6eef(++_0x1182b7);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1fdde3,_0x493f55){_0x1fdde3=_0x1fdde3-0x0;var _0x1026a0=_0xdbf5[_0x1fdde3];return _0x1026a0;};'use strict';var _=require('lodash');var moment=require(_0x5dbf('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x5dbf('0x1'))(_0x5dbf('0x2'));var rpc={'chatMessage':require(_0x5dbf('0x3')),'openchannelMessage':require(_0x5dbf('0x4')),'mailMessage':require(_0x5dbf('0x5')),'smsMessage':require(_0x5dbf('0x6')),'faxMessage':require(_0x5dbf('0x7')),'whatsappMessage':require(_0x5dbf('0x8'))};exports[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return function(_0x88128e){try{if(!_[_0x5dbf('0xa')](this['interaction'][_0x5dbf('0xb')])){logger['info'](_0x5dbf('0xc'),_0x3f8222,_0x5dbf('0xd'));return _0x88128e[_0x5dbf('0xe')]();}var _0x1813bb={'ContactId':this['contact']['id'],'sentAt':moment()[_0x5dbf('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};var _0x1c7389=this['channel'];if(_0x1c7389==='chat'){_0x1813bb[_0x5dbf('0x10')]=this['account']['id'];}else{_0x1813bb[_[_0x5dbf('0x11')](_0x1c7389)+_0x5dbf('0x12')]=this[_0x5dbf('0x13')]['id'];}_0x1813bb[_[_0x5dbf('0x11')](_0x1c7389)+_0x5dbf('0x14')]=this['interaction']['id'];if(this['interaction'][_0x5dbf('0x15')]){var _0x3480c8=_0x209b7d[0x4];if(!_['isEmpty'](_0x3480c8)){_0x1813bb[_0x5dbf('0x16')]=utils[_0x5dbf('0x17')](_0x3480c8,this);return rpc[_0x1c7389+_0x5dbf('0x18')][_0x5dbf('0x19')](_0x1813bb)[_0x5dbf('0x1a')](function(_0x472eb9){logger[_0x5dbf('0x1b')]('[%s][AMAZONLEX]\x20%s',_0x3f8222,_0x1813bb['body']);})[_0x5dbf('0x1c')](function(_0xc4cb1c){logger[_0x5dbf('0x1d')](_0x5dbf('0xc'),_0x3f8222,JSON[_0x5dbf('0x1e')](_0xc4cb1c));})['finally'](function(){logger[_0x5dbf('0x1b')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3f8222);_0x88128e['stop']();});}else{logger['info'](_0x5dbf('0x1f'),_0x3f8222);_0x88128e[_0x5dbf('0x20')]();}}else{var _0x358d46=this;var _0x2ab57c=new AWS[(_0x5dbf('0x21'))]({'accessKeyId':_0x209b7d[0x0],'secretAccessKey':_0x209b7d[0x1],'region':_0x209b7d[0x2]});var _0x5b2518={'botAlias':_0x5dbf('0x22'),'botName':_0x209b7d[0x3],'inputText':this['message'][_0x5dbf('0x16')],'userId':this[_0x5dbf('0x23')]+':'+this[_0x5dbf('0x24')]['id'][_0x5dbf('0x25')]()};_0x2ab57c[_0x5dbf('0x26')](_0x5b2518,function(_0x2f154e,_0x58085e){if(_0x2f154e){logger[_0x5dbf('0x1d')](_0x5dbf('0xc'),_0x3f8222,_0x2f154e[_0x5dbf('0x27')]);_0x88128e[_0x5dbf('0xe')]();}else if(_0x58085e&&_0x58085e[_0x5dbf('0x27')]){_0x358d46[_0x5dbf('0x16')][_0x5dbf('0x28')]=_0x58085e;_0x1813bb[_0x5dbf('0x16')]=_0x58085e[_0x5dbf('0x27')];return rpc[_0x1c7389+_0x5dbf('0x18')][_0x5dbf('0x19')](_0x1813bb)[_0x5dbf('0x1a')](function(_0x3f9e60){logger[_0x5dbf('0x1b')](_0x5dbf('0xc'),_0x3f8222,_0x1813bb[_0x5dbf('0x16')]);if(_0x58085e[_0x5dbf('0x29')]==_0x5dbf('0x2a')){_0x88128e[_0x5dbf('0xe')]();}else{_0x88128e[_0x5dbf('0x20')]();}})[_0x5dbf('0x1c')](function(_0x471027){logger[_0x5dbf('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x3f8222,JSON[_0x5dbf('0x1e')](_0x471027));_0x88128e[_0x5dbf('0xe')]();});}else{_0x88128e[_0x5dbf('0xe')]();}});}}catch(_0x1fb9a7){logger[_0x5dbf('0x1d')](_0x5dbf('0xc'),_0x3f8222,JSON[_0x5dbf('0x1e')](_0x1fb9a7));_0x88128e[_0x5dbf('0x20')]();}};}; \ No newline at end of file +var _0x187d=['finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','toString','postText','amazonlex','message','Message','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','catch','error','[%s][AMAZONLEX]\x20%s','stringify'];(function(_0x2086a6,_0x4fcaa2){var _0x35fbf0=function(_0x4088c0){while(--_0x4088c0){_0x2086a6['push'](_0x2086a6['shift']());}};_0x35fbf0(++_0x4fcaa2);}(_0x187d,0x93));var _0xd187=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x187d[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xd187('0x0'));var moment=require('moment');var AWS=require(_0xd187('0x1'));var utils=require(_0xd187('0x2'));var logger=require(_0xd187('0x3'))(_0xd187('0x4'));var rpc={'chatMessage':require(_0xd187('0x5')),'openchannelMessage':require(_0xd187('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd187('0x7')),'faxMessage':require(_0xd187('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return function(_0x1d3fe4){try{if(!_[_0xd187('0xa')](this[_0xd187('0xb')][_0xd187('0xc')])){logger[_0xd187('0xd')]('[%s][AMAZONLEX]\x20%s',_0x58ee7,_0xd187('0xe'));return _0x1d3fe4[_0xd187('0xf')]();}var _0x4039f6={'ContactId':this[_0xd187('0x10')]['id'],'sentAt':moment()[_0xd187('0x11')](_0xd187('0x12')),'direction':'out'};var _0x10d467=this[_0xd187('0x13')];if(_0x10d467===_0xd187('0x14')){_0x4039f6['ChatWebsiteId']=this[_0xd187('0x15')]['id'];}else{_0x4039f6[_[_0xd187('0x16')](_0x10d467)+_0xd187('0x17')]=this['account']['id'];}_0x4039f6[_[_0xd187('0x16')](_0x10d467)+_0xd187('0x18')]=this[_0xd187('0xb')]['id'];if(this[_0xd187('0xb')]['created']){var _0x39a927=_0x444a60[0x4];if(!_[_0xd187('0x19')](_0x39a927)){_0x4039f6[_0xd187('0x1a')]=utils[_0xd187('0x1b')](_0x39a927,this);return rpc[_0x10d467+'Message'][_0xd187('0x1c')](_0x4039f6)['then'](function(_0x5cf218){logger[_0xd187('0xd')]('[%s][AMAZONLEX]\x20%s',_0x58ee7,_0x4039f6['body']);})[_0xd187('0x1d')](function(_0x2b3290){logger[_0xd187('0x1e')](_0xd187('0x1f'),_0x58ee7,JSON[_0xd187('0x20')](_0x2b3290));})[_0xd187('0x21')](function(){logger[_0xd187('0xd')](_0xd187('0x22'),_0x58ee7);_0x1d3fe4[_0xd187('0x23')]();});}else{logger[_0xd187('0xd')](_0xd187('0x24'),_0x58ee7);_0x1d3fe4[_0xd187('0x23')]();}}else{var _0x207978=this;var _0x5204ee=new AWS[(_0xd187('0x25'))]({'accessKeyId':_0x444a60[0x0],'secretAccessKey':_0x444a60[0x1],'region':_0x444a60[0x2]});var _0x81b988={'botAlias':_0xd187('0x26'),'botName':_0x444a60[0x3],'inputText':this['message']['body'],'userId':this['channel']+':'+this[_0xd187('0xb')]['id'][_0xd187('0x27')]()};_0x5204ee[_0xd187('0x28')](_0x81b988,function(_0x4f62c8,_0x2c07c8){if(_0x4f62c8){logger['error'](_0xd187('0x1f'),_0x58ee7,_0x4f62c8['message']);_0x1d3fe4[_0xd187('0xf')]();}else if(_0x2c07c8&&_0x2c07c8['message']){_0x207978['body'][_0xd187('0x29')]=_0x2c07c8;_0x4039f6['body']=_0x2c07c8[_0xd187('0x2a')];return rpc[_0x10d467+_0xd187('0x2b')]['create'](_0x4039f6)['then'](function(_0x848ddd){logger[_0xd187('0xd')](_0xd187('0x1f'),_0x58ee7,_0x4039f6[_0xd187('0x1a')]);if(_0x2c07c8['dialogState']==_0xd187('0x2c')){_0x1d3fe4[_0xd187('0xf')]();}else{_0x1d3fe4['stop']();}})[_0xd187('0x1d')](function(_0x1c87ee){logger[_0xd187('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x58ee7,JSON[_0xd187('0x20')](_0x1c87ee));_0x1d3fe4['next']();});}else{_0x1d3fe4[_0xd187('0xf')]();}});}}catch(_0x19e75f){logger[_0xd187('0x1e')](_0xd187('0x1f'),_0x58ee7,JSON['stringify'](_0x19e75f));_0x1d3fe4[_0xd187('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index cac4dac..d89e56e 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 _0x90ab=['authentication','auth','user','inReplyTo','messageId','','replace','body','','sendMailMessage','then','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','lodash','../../../../config/logger','routing','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','next','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','mail','Smtp','service','host','port','secure'];(function(_0x478f25,_0x3a31c5){var _0x100f0f=function(_0xafc352){while(--_0xafc352){_0x478f25['push'](_0x478f25['shift']());}};_0x100f0f(++_0x3a31c5);}(_0x90ab,0x81));var _0xb90a=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0x90ab[_0x310a1b];return _0xdea206;};'use strict';var _=require(_0xb90a('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xb90a('0x1'))(_0xb90a('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb90a('0x3')),'whatsappMessage':require(_0xb90a('0x4'))};var mailRpc=require('../../mailRpc');exports[_0xb90a('0x5')]=function(_0x3072c7,_0x211df4){return function(_0x3efcad){try{if(_0x211df4[0x0]==='1'&&(_[_0xb90a('0x6')](this[_0xb90a('0x7')][_0xb90a('0x8')])||!this[_0xb90a('0x7')][_0xb90a('0x8')])){logger[_0xb90a('0x9')](_0xb90a('0xa'),_0x3072c7,'Autoreply\x20already\x20sent');return _0x3efcad[_0xb90a('0xb')]();}var _0x538e4b=this[_0xb90a('0xc')];var _0x178cf7={'body':utils[_0xb90a('0xd')](_0x211df4[0x1],this),'ContactId':this[_0xb90a('0xe')]['id'],'sentAt':moment()[_0xb90a('0xf')](_0xb90a('0x10')),'direction':_0xb90a('0x11')};if(this[_0xb90a('0x12')]){_0x178cf7['to']=this['message'][_0xb90a('0x13')]||'';_0x178cf7['cc']=this[_0xb90a('0x12')]['cc']||'';_0x178cf7[_0xb90a('0x13')]=this['message']['to']||'';_0x178cf7[_0xb90a('0x14')]=this[_0xb90a('0x12')]['phone']||'';_0x178cf7['read']=!![];if(this[_0xb90a('0x12')]['subject']){_0x178cf7[_0xb90a('0x15')]='';_0x178cf7[_0xb90a('0x15')]+=_['startsWith'](this['message']['subject'],_0xb90a('0x16'))?'':_0xb90a('0x17');_0x178cf7[_0xb90a('0x15')]+=this[_0xb90a('0x12')][_0xb90a('0x15')];}}if(this[_0xb90a('0xc')]===_0xb90a('0x18')){_0x178cf7[_0xb90a('0x19')]=this[_0xb90a('0x1a')]['id'];}else{_0x178cf7[_[_0xb90a('0x1b')](this[_0xb90a('0xc')])+'AccountId']=this[_0xb90a('0x1a')]['id'];}_0x178cf7[_['upperFirst'](this[_0xb90a('0xc')])+_0xb90a('0x1c')]=this['interaction']['id'];if(rpc[this[_0xb90a('0xc')]+_0xb90a('0x1d')]){if(this[_0xb90a('0xc')]===_0xb90a('0x1e')){var _0x5b7cdd={'tls':{'rejectUnauthorized':![]}};if(this[_0xb90a('0x1a')][_0xb90a('0x1f')]['service']){_0x5b7cdd['service']=this[_0xb90a('0x1a')][_0xb90a('0x1f')][_0xb90a('0x20')];}else{_0x5b7cdd['host']=this[_0xb90a('0x1a')][_0xb90a('0x1f')][_0xb90a('0x21')];_0x5b7cdd['port']=this[_0xb90a('0x1a')][_0xb90a('0x1f')][_0xb90a('0x22')];_0x5b7cdd[_0xb90a('0x23')]=this[_0xb90a('0x1a')][_0xb90a('0x1f')][_0xb90a('0x23')];}if(this['account'][_0xb90a('0x1f')][_0xb90a('0x24')]){_0x5b7cdd[_0xb90a('0x25')]={'user':this[_0xb90a('0x1a')]['Smtp'][_0xb90a('0x26')],'pass':this[_0xb90a('0x1a')]['Smtp']['pass']};}_0x178cf7[_0xb90a('0x27')]=this[_0xb90a('0x12')][_0xb90a('0x28')];_0x178cf7['html']=_0xb90a('0x29')+_[_0xb90a('0x2a')](_0x178cf7[_0xb90a('0x2b')],_0xb90a('0x2c'),'','replace','body','','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','next','error','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user'];(function(_0xe709a7,_0x106896){var _0x5941f5=function(_0x2a7c9a){while(--_0x2a7c9a){_0xe709a7['push'](_0xe709a7['shift']());}};_0x5941f5(++_0x106896);}(_0x6d11,0x103));var _0x16d1=function(_0x9af82e,_0x2930b8){_0x9af82e=_0x9af82e-0x0;var _0x349657=_0x6d11[_0x9af82e];return _0x349657;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require('./utils');var logger=require(_0x16d1('0x0'))('routing');var rpc={'chatMessage':require(_0x16d1('0x1')),'openchannelMessage':require(_0x16d1('0x2')),'mailMessage':require(_0x16d1('0x3')),'smsMessage':require(_0x16d1('0x4')),'faxMessage':require(_0x16d1('0x5')),'whatsappMessage':require(_0x16d1('0x6'))};var mailRpc=require(_0x16d1('0x7'));exports[_0x16d1('0x8')]=function(_0x130d43,_0x433fb2){return function(_0x4e1c2e){try{if(_0x433fb2[0x0]==='1'&&(_[_0x16d1('0x9')](this[_0x16d1('0xa')][_0x16d1('0xb')])||!this[_0x16d1('0xa')][_0x16d1('0xb')])){logger['info'](_0x16d1('0xc'),_0x130d43,_0x16d1('0xd'));return _0x4e1c2e['next']();}var _0x45aaa6=this[_0x16d1('0xe')];var _0x3de933={'body':utils[_0x16d1('0xf')](_0x433fb2[0x1],this),'ContactId':this[_0x16d1('0x10')]['id'],'sentAt':moment()['format'](_0x16d1('0x11')),'direction':_0x16d1('0x12')};if(this['message']){_0x3de933['to']=this[_0x16d1('0x13')][_0x16d1('0x14')]||'';_0x3de933['cc']=this['message']['cc']||'';_0x3de933[_0x16d1('0x14')]=this['message']['to']||'';_0x3de933['phone']=this[_0x16d1('0x13')][_0x16d1('0x15')]||'';_0x3de933[_0x16d1('0x16')]=!![];if(this['message']['subject']){_0x3de933[_0x16d1('0x17')]='';_0x3de933['subject']+=_[_0x16d1('0x18')](this['message'][_0x16d1('0x17')],'Re:')?'':'Re:\x20';_0x3de933[_0x16d1('0x17')]+=this[_0x16d1('0x13')][_0x16d1('0x17')];}}if(this[_0x16d1('0xe')]===_0x16d1('0x19')){_0x3de933[_0x16d1('0x1a')]=this[_0x16d1('0x1b')]['id'];}else{_0x3de933[_[_0x16d1('0x1c')](this[_0x16d1('0xe')])+_0x16d1('0x1d')]=this[_0x16d1('0x1b')]['id'];}_0x3de933[_[_0x16d1('0x1c')](this[_0x16d1('0xe')])+_0x16d1('0x1e')]=this[_0x16d1('0xa')]['id'];if(rpc[this[_0x16d1('0xe')]+_0x16d1('0x1f')]){if(this[_0x16d1('0xe')]===_0x16d1('0x20')){var _0x566548={'tls':{'rejectUnauthorized':![]}};if(this[_0x16d1('0x1b')][_0x16d1('0x21')][_0x16d1('0x22')]){_0x566548[_0x16d1('0x22')]=this['account']['Smtp']['service'];}else{_0x566548[_0x16d1('0x23')]=this[_0x16d1('0x1b')][_0x16d1('0x21')][_0x16d1('0x23')];_0x566548[_0x16d1('0x24')]=this[_0x16d1('0x1b')][_0x16d1('0x21')][_0x16d1('0x24')];_0x566548[_0x16d1('0x25')]=this[_0x16d1('0x1b')][_0x16d1('0x21')]['secure'];}if(this['account'][_0x16d1('0x21')][_0x16d1('0x26')]){_0x566548[_0x16d1('0x27')]={'user':this['account'][_0x16d1('0x21')][_0x16d1('0x28')],'pass':this[_0x16d1('0x1b')][_0x16d1('0x21')]['pass']};}_0x3de933[_0x16d1('0x29')]=this[_0x16d1('0x13')][_0x16d1('0x2a')];_0x3de933[_0x16d1('0x2b')]=_0x16d1('0x2c')+_[_0x16d1('0x2d')](_0x3de933[_0x16d1('0x2e')],']+(>|$)/g,''),'priorityTrue':_0x57d7bf[0x1],'priorityFalse':_0x57d7bf[0x2]};var _0x1e7ae8=gotoif['validate'](_0x479c9c,{'typecast':!![]});if(_0x1e7ae8['length']){logger[_0x541b('0x9')](_0x541b('0xa'),_0x2be77a,_[_0x541b('0xb')](_0x1e7ae8,'message')['join'](',\x20'));_0x786eb1[_0x541b('0xc')]();}else{try{var _0x28b987=eval('('+_0x479c9c[_0x541b('0xd')]+')');var _0x21370e=_0x28b987?_0x479c9c['priorityTrue']:_0x479c9c[_0x541b('0xe')];logger[_0x541b('0xf')](_0x541b('0x10'),_0x2be77a,_0x479c9c[_0x541b('0xd')],_0x28b987,_0x21370e||'next');if(_0x21370e){var _0x964c72=_[_0x541b('0x11')](_0x786eb1[_0x541b('0x12')](),{'p':_0x21370e});if(_0x964c72>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2be77a,_0x21370e||_0x541b('0x13'),_0x964c72);_0x786eb1['next'](_0x964c72);}else{logger[_0x541b('0xf')](_0x541b('0x14'),_0x2be77a,_0x21370e||_0x541b('0x13'));_0x786eb1['stop']();}}else{_0x786eb1[_0x541b('0x13')]();}}catch(_0x32e33b){logger[_0x541b('0x9')](_0x541b('0x15'),_0x2be77a,_0x32e33b[_0x541b('0x16')]);_0x786eb1[_0x541b('0xc')]();}}}catch(_0x5b7cdb){logger[_0x541b('0x9')](_0x541b('0xa'),_0x2be77a,JSON[_0x541b('0x17')](_0x5b7cdb));_0x786eb1[_0x541b('0xc')]();}};}; \ No newline at end of file +var _0x3d9d=['map','message','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','length','error','[%s][GOTOIF]\x20%s'];(function(_0x446f21,_0x44bce3){var _0x558bf4=function(_0x838858){while(--_0x838858){_0x446f21['push'](_0x446f21['shift']());}};_0x558bf4(++_0x44bce3);}(_0x3d9d,0x8d));var _0xd3d9=function(_0x53b3ee,_0x12feb7){_0x53b3ee=_0x53b3ee-0x0;var _0x50fae3=_0x3d9d[_0x53b3ee];return _0x50fae3;};'use strict';var schema=require(_0xd3d9('0x0'));var _=require(_0xd3d9('0x1'));var htmlToText=require(_0xd3d9('0x2'));var utils=require(_0xd3d9('0x3'));var logger=require('../../../../config/logger')(_0xd3d9('0x4'));var gotoif=schema({'condition':{'type':_0xd3d9('0x5'),'required':!![],'message':_0xd3d9('0x6')},'priorityTrue':{'type':'number','message':_0xd3d9('0x7')},'priorityFalse':{'type':_0xd3d9('0x8'),'message':_0xd3d9('0x9')}});exports[_0xd3d9('0xa')]=function(_0x323dde,_0x4f468f){return function(_0x1cfc39){try{var _0x4beb53={'condition':htmlToText[_0xd3d9('0xb')](utils['getMustacheRender'](_0x4f468f[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4f468f[0x1],'priorityFalse':_0x4f468f[0x2]};var _0x311138=gotoif['validate'](_0x4beb53,{'typecast':!![]});if(_0x311138[_0xd3d9('0xc')]){logger[_0xd3d9('0xd')](_0xd3d9('0xe'),_0x323dde,_[_0xd3d9('0xf')](_0x311138,_0xd3d9('0x10'))['join'](',\x20'));_0x1cfc39[_0xd3d9('0x11')]();}else{try{var _0x7dd96=eval('('+_0x4beb53[_0xd3d9('0x12')]+')');var _0x43fcf6=_0x7dd96?_0x4beb53['priorityTrue']:_0x4beb53[_0xd3d9('0x13')];logger[_0xd3d9('0x14')](_0xd3d9('0x15'),_0x323dde,_0x4beb53['condition'],_0x7dd96,_0x43fcf6||_0xd3d9('0x16'));if(_0x43fcf6){var _0x1b3378=_[_0xd3d9('0x17')](_0x1cfc39[_0xd3d9('0x18')](),{'p':_0x43fcf6});if(_0x1b3378>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x323dde,_0x43fcf6||_0xd3d9('0x16'),_0x1b3378);_0x1cfc39['next'](_0x1b3378);}else{logger[_0xd3d9('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x323dde,_0x43fcf6||'next');_0x1cfc39[_0xd3d9('0x11')]();}}else{_0x1cfc39[_0xd3d9('0x16')]();}}catch(_0x3663f3){logger[_0xd3d9('0xd')](_0xd3d9('0x19'),_0x323dde,_0x3663f3[_0xd3d9('0x10')]);_0x1cfc39[_0xd3d9('0x11')]();}}}catch(_0x2162b3){logger['error'](_0xd3d9('0xe'),_0x323dde,JSON['stringify'](_0x2162b3));_0x1cfc39['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index dac5a84..b7871b5 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 _0xa6bf=['[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info'];(function(_0x3c8b8b,_0x1f1a10){var _0x277ae9=function(_0x5a3ed0){while(--_0x5a3ed0){_0x3c8b8b['push'](_0x3c8b8b['shift']());}};_0x277ae9(++_0x1f1a10);}(_0xa6bf,0x142));var _0xfa6b=function(_0x239f35,_0x196a9f){_0x239f35=_0x239f35-0x0;var _0x1d5c6f=_0xa6bf[_0x239f35];return _0x1d5c6f;};'use strict';var schema=require(_0xfa6b('0x0'));var _=require(_0xfa6b('0x1'));var logger=require(_0xfa6b('0x2'))(_0xfa6b('0x3'));var gotop=schema({'priority':{'type':_0xfa6b('0x4'),'required':!![],'message':_0xfa6b('0x5')}});exports['consequence']=function(_0x464018,_0x23b925){return function(_0x30e0b3){try{var _0x57817f={'priority':_0x23b925[0x0]};var _0x14e11b=gotop[_0xfa6b('0x0')](_0x57817f,{'typecast':!![]});if(_0x14e11b[_0xfa6b('0x6')]){logger[_0xfa6b('0x7')](_0xfa6b('0x8'),_0x464018,_[_0xfa6b('0x9')](_0x14e11b,_0xfa6b('0xa'))[_0xfa6b('0xb')](',\x20'));_0x30e0b3[_0xfa6b('0xc')]();}else{logger[_0xfa6b('0xd')](_0xfa6b('0xe'),_0x464018,_0x57817f[_0xfa6b('0xf')]);if(_0x57817f[_0xfa6b('0xf')]){var _0x206c20=_[_0xfa6b('0x10')](_0x30e0b3['rules'](),{'p':_0x57817f['priority']});if(_0x206c20>=0x0){logger[_0xfa6b('0xd')](_0xfa6b('0x11'),_0x464018,_0x57817f[_0xfa6b('0xf')]||_0xfa6b('0x12'),_0x206c20);_0x30e0b3[_0xfa6b('0x12')](_0x206c20);}else{logger[_0xfa6b('0xd')](_0xfa6b('0x13'),_0x464018,_0x57817f[_0xfa6b('0xf')]||_0xfa6b('0x12'));_0x30e0b3[_0xfa6b('0xc')]();}}else{_0x30e0b3[_0xfa6b('0x12')]();}}}catch(_0x4acd15){logger[_0xfa6b('0x7')](_0xfa6b('0x8'),_0x464018,JSON[_0xfa6b('0x14')](_0x4acd15));_0x30e0b3['stop']();}};}; \ No newline at end of file +var _0x6380=['validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','error','stringify'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x6380,0xbe));var _0x0638=function(_0x103838,_0x224563){_0x103838=_0x103838-0x0;var _0x56f4c7=_0x6380[_0x103838];return _0x56f4c7;};'use strict';var schema=require(_0x0638('0x0'));var _=require(_0x0638('0x1'));var logger=require(_0x0638('0x2'))(_0x0638('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x0638('0x4')}});exports[_0x0638('0x5')]=function(_0x2424c9,_0x1fbb2d){return function(_0x4004e8){try{var _0x214dea={'priority':_0x1fbb2d[0x0]};var _0x552d3e=gotop['validate'](_0x214dea,{'typecast':!![]});if(_0x552d3e[_0x0638('0x6')]){logger['error'](_0x0638('0x7'),_0x2424c9,_[_0x0638('0x8')](_0x552d3e,'message')[_0x0638('0x9')](',\x20'));_0x4004e8[_0x0638('0xa')]();}else{logger[_0x0638('0xb')](_0x0638('0xc'),_0x2424c9,_0x214dea['priority']);if(_0x214dea[_0x0638('0xd')]){var _0x413b0b=_[_0x0638('0xe')](_0x4004e8[_0x0638('0xf')](),{'p':_0x214dea[_0x0638('0xd')]});if(_0x413b0b>=0x0){logger[_0x0638('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2424c9,_0x214dea[_0x0638('0xd')]||_0x0638('0x10'),_0x413b0b);_0x4004e8[_0x0638('0x10')](_0x413b0b);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x2424c9,_0x214dea[_0x0638('0xd')]||_0x0638('0x10'));_0x4004e8[_0x0638('0xa')]();}}else{_0x4004e8[_0x0638('0x10')]();}}}catch(_0x14cd2b){logger[_0x0638('0x11')]('[%s][GOTOP]\x20%s',_0x2424c9,JSON[_0x0638('0x12')](_0x14cd2b));_0x4004e8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index cb9795a..eeaaa2c 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 _0xe1eb=['Message','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0xe1eb,0x13b));var _0xbe1e=function(_0x5da3d6,_0x1942f4){_0x5da3d6=_0x5da3d6-0x0;var _0x99c976=_0xe1eb[_0x5da3d6];return _0x99c976;};'use strict';var _=require(_0xbe1e('0x0'));var utils=require(_0xbe1e('0x1'));var logger=require('../../../../config/logger')(_0xbe1e('0x2'));var rpc={'chatMessage':require(_0xbe1e('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbe1e('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xbe1e('0x5'))};exports[_0xbe1e('0x6')]=function(_0x477c6f,_0x9a330b){return function(_0x368394){try{var _0xb66d30={'body':utils[_0xbe1e('0x7')](_0x9a330b[0x0],this),'ContactId':this['contact']['id']};if(this[_0xbe1e('0x8')]===_0xbe1e('0x9')){_0xb66d30[_0xbe1e('0xa')]=this[_0xbe1e('0xb')]['id'];}else{_0xb66d30[_[_0xbe1e('0xc')](this[_0xbe1e('0x8')])+_0xbe1e('0xd')]=this[_0xbe1e('0xb')]['id'];}_0xb66d30[_['upperFirst'](this[_0xbe1e('0x8')])+_0xbe1e('0xe')]=this['interaction']['id'];if(rpc[this['channel']+_0xbe1e('0xf')]){return rpc[this[_0xbe1e('0x8')]+_0xbe1e('0xf')]['create'](_0xb66d30)['then'](function(_0x55a878){logger['info'](_0xbe1e('0x10'),_0x477c6f,_0xb66d30[_0xbe1e('0x11')]);_0x368394[_0xbe1e('0x12')]();})['catch'](function(_0x351ccb){logger[_0xbe1e('0x13')](_0xbe1e('0x10'),_0x477c6f,JSON[_0xbe1e('0x14')](_0x351ccb));_0x368394[_0xbe1e('0x15')]();});}}catch(_0x24afef){logger[_0xbe1e('0x13')](_0xbe1e('0x10'),_0x477c6f,JSON[_0xbe1e('0x14')](_0x24afef));_0x368394[_0xbe1e('0x15')]();}};}; \ No newline at end of file +var _0x71ec=['consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','account','interaction','Message','create','info','body','next','[%s][MESSAGE]\x20%s','stringify','stop','./utils','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x4c4eea,_0x2a5c6e){var _0xe8ed0c=function(_0x252787){while(--_0x252787){_0x4c4eea['push'](_0x4c4eea['shift']());}};_0xe8ed0c(++_0x2a5c6e);}(_0x71ec,0x15b));var _0xc71e=function(_0x54e3ab,_0x1c8fcc){_0x54e3ab=_0x54e3ab-0x0;var _0x5c2814=_0x71ec[_0x54e3ab];return _0x5c2814;};'use strict';var _=require('lodash');var utils=require(_0xc71e('0x0'));var logger=require('../../../../config/logger')(_0xc71e('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc71e('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc71e('0x3')),'faxMessage':require(_0xc71e('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc71e('0x5')]=function(_0x265c19,_0x52ba6d){return function(_0x571a92){try{var _0x3f07f1={'body':utils[_0xc71e('0x6')](_0x52ba6d[0x0],this),'ContactId':this[_0xc71e('0x7')]['id']};if(this[_0xc71e('0x8')]===_0xc71e('0x9')){_0x3f07f1[_0xc71e('0xa')]=this['account']['id'];}else{_0x3f07f1[_[_0xc71e('0xb')](this[_0xc71e('0x8')])+'AccountId']=this[_0xc71e('0xc')]['id'];}_0x3f07f1[_['upperFirst'](this[_0xc71e('0x8')])+'InteractionId']=this[_0xc71e('0xd')]['id'];if(rpc[this[_0xc71e('0x8')]+'Message']){return rpc[this['channel']+_0xc71e('0xe')][_0xc71e('0xf')](_0x3f07f1)['then'](function(_0x1dc9d1){logger[_0xc71e('0x10')]('[%s][MESSAGE]\x20%s',_0x265c19,_0x3f07f1[_0xc71e('0x11')]);_0x571a92[_0xc71e('0x12')]();})['catch'](function(_0x5bc6ff){logger['error'](_0xc71e('0x13'),_0x265c19,JSON[_0xc71e('0x14')](_0x5bc6ff));_0x571a92['stop']();});}}catch(_0x249b0b){logger['error'](_0xc71e('0x13'),_0x265c19,JSON[_0xc71e('0x14')](_0x249b0b));_0x571a92[_0xc71e('0x15')]();}};}; \ 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 59626f1..ff48c77 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 _0xa9ff=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing','consequence'];(function(_0x5d01d1,_0x511ae8){var _0x1526dd=function(_0x5b6ba7){while(--_0x5b6ba7){_0x5d01d1['push'](_0x5d01d1['shift']());}};_0x1526dd(++_0x511ae8);}(_0xa9ff,0xbb));var _0xfa9f=function(_0x164e8f,_0xdba27a){_0x164e8f=_0x164e8f-0x0;var _0x2b2840=_0xa9ff[_0x164e8f];return _0x2b2840;};'use strict';var utils=require('./utils');var logger=require(_0xfa9f('0x0'))(_0xfa9f('0x1'));exports[_0xfa9f('0x2')]=function(_0x45473d,_0x4bea3d){return function(_0x1793d8){try{logger[_0xfa9f('0x3')](_0xfa9f('0x4'),_0x45473d,utils[_0xfa9f('0x5')](_0x4bea3d[0x0],this));_0x1793d8[_0xfa9f('0x6')]();}catch(_0x466240){logger[_0xfa9f('0x7')](_0xfa9f('0x4'),_0x45473d,JSON[_0xfa9f('0x8')](_0x466240));_0x1793d8[_0xfa9f('0x9')]();}};}; \ No newline at end of file +var _0xd00d=['./utils','../../../../config/logger','routing','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x3aa045,_0x31aa4e){var _0x4b2824=function(_0x5824f5){while(--_0x5824f5){_0x3aa045['push'](_0x3aa045['shift']());}};_0x4b2824(++_0x31aa4e);}(_0xd00d,0xc6));var _0xdd00=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0xd00d[_0x421196];return _0x2738af;};'use strict';var utils=require(_0xdd00('0x0'));var logger=require(_0xdd00('0x1'))(_0xdd00('0x2'));exports['consequence']=function(_0x368d91,_0xf38ed2){return function(_0x18fd02){try{logger['info'](_0xdd00('0x3'),_0x368d91,utils[_0xdd00('0x4')](_0xf38ed2[0x0],this));_0x18fd02[_0xdd00('0x5')]();}catch(_0x5def56){logger[_0xdd00('0x6')](_0xdd00('0x3'),_0x368d91,JSON[_0xdd00('0x7')](_0x5def56));_0x18fd02[_0xdd00('0x8')]();}};}; \ 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 686e30d..c81a0ab 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x19b51f,_0x3ab5ed){var _0xb6644e=function(_0x4d2cca){while(--_0x4d2cca){_0x19b51f['push'](_0x19b51f['shift']());}};_0xb6644e(++_0x3ab5ed);}(_0xedd9,0xfc));var _0x9edd=function(_0x2b8764,_0x43d49f){_0x2b8764=_0x2b8764-0x0;var _0x11af3d=_0xedd9[_0x2b8764];return _0x11af3d;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file +var _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(_0x2083bf,_0x437a3e){var _0xe12a5f=function(_0x344450){while(--_0x344450){_0x2083bf['push'](_0x2083bf['shift']());}};_0xe12a5f(++_0x437a3e);}(_0x34e8,0x12c));var _0x834e=function(_0x2c5503,_0x55e063){_0x2c5503=_0x2c5503-0x0;var _0x1724a7=_0x34e8[_0x2c5503];return _0x1724a7;};'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 c7ccfe9..5007c44 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 _0x90c7=['agents','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','RINGING',':FORCED','hideNotification','busy','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','agent','isNil'];(function(_0x5cf40f,_0x1f80fd){var _0x1827a9=function(_0xa18d69){while(--_0xa18d69){_0x5cf40f['push'](_0x5cf40f['shift']());}};_0x1827a9(++_0x1f80fd);}(_0x90c7,0x72));var _0x790c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x90c7[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x790c('0x0'));var uuid=require(_0x790c('0x1'));var util=require(_0x790c('0x2'));var logger=require(_0x790c('0x3'))(_0x790c('0x4'));var Agent=function(_0x384919,_0x510d02,_0x235ffe,_0x3aba34){this[_0x790c('0x5')]=uuid['v4']();this[_0x790c('0x6')]=_0x384919;this['agent']=_0x510d02;this[_0x790c('0x7')]=_0x235ffe;this[_0x790c('0x4')]=_0x3aba34;this[_0x790c('0x6')][_0x790c('0x8')](this[_0x790c('0x9')]['bind'](this),this[_0x790c('0xa')][_0x790c('0xb')](this));this[_0x790c('0x6')]['on'](_0x790c('0xc'),this[_0x790c('0xa')][_0x790c('0xb')](this));this[_0x790c('0x6')]['on'](_0x790c('0xd'),this[_0x790c('0xe')][_0x790c('0xb')](this));};Agent[_0x790c('0xf')][_0x790c('0x8')]=function(){this['squeue'][_0x790c('0x8')](this['handleRun'][_0x790c('0xb')](this),this['handleTimeout']['bind'](this));};Agent['prototype'][_0x790c('0xe')]=function(){this[_0x790c('0xa')](!![]);};Agent[_0x790c('0xf')][_0x790c('0x9')]=function(_0x297a76){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x790c('0x6')]['id'],this[_0x790c('0x10')]['id']);if(_[_0x790c('0x11')](this['realtime'][_0x790c('0x12')][this[_0x790c('0x10')]['id']])){logger[_0x790c('0x13')](_0x790c('0x14'),this[_0x790c('0x6')]['id'],this[_0x790c('0x10')]['id']);setTimeout(this[_0x790c('0x8')][_0x790c('0xb')](this),0x3e8);}else{if(this['routing'][_0x790c('0x15')]||util[_0x790c('0x16')](this[_0x790c('0x6')]['id'],this[_0x790c('0x7')][_0x790c('0x12')][this[_0x790c('0x10')]['id']],this[_0x790c('0x6')][_0x790c('0x17')],![])){this[_0x790c('0x7')][_0x790c('0x12')][this[_0x790c('0x10')]['id']]['busy']=!![];this[_0x790c('0x7')][_0x790c('0x12')][this[_0x790c('0x10')]['id']][_0x790c('0x18')]=undefined;util[_0x790c('0x19')](this[_0x790c('0x5')],this['squeue']['id'],this[_0x790c('0x7')][_0x790c('0x12')][this[_0x790c('0x10')]['id']],null,this[_0x790c('0x4')]);util['writeLog'](this[_0x790c('0x6')]['id'],this[_0x790c('0x7')][_0x790c('0x12')][this[_0x790c('0x10')]['id']],_0x790c('0x1a')+(this['routing'][_0x790c('0x15')]?_0x790c('0x1b'):''));}else{logger[_0x790c('0x13')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x790c('0x6')]['id'],this[_0x790c('0x10')]['id']);setTimeout(this[_0x790c('0x8')][_0x790c('0xb')](this),0x3e8);}}};Agent[_0x790c('0xf')][_0x790c('0xa')]=function(_0x2954fe){if(_['isNil'](this['realtime'][_0x790c('0x12')][this[_0x790c('0x10')]['id']])){return logger[_0x790c('0x13')](_0x790c('0x14'),this[_0x790c('0x6')]['id'],this[_0x790c('0x10')]['id']);}else{logger[_0x790c('0x13')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x790c('0x6')]['id'],this['agent']['id']);util[_0x790c('0x1c')](this['notificationId'],this['squeue']['id'],this[_0x790c('0x7')][_0x790c('0x12')][this['agent']['id']],null,this['routing']);this['realtime'][_0x790c('0x12')][this[_0x790c('0x10')]['id']][_0x790c('0x1d')]=![];this[_0x790c('0x7')][_0x790c('0x12')][this[_0x790c('0x10')]['id']][_0x790c('0x18')]=undefined;util['writeLog'](this[_0x790c('0x6')]['id'],this['realtime'][_0x790c('0x12')][this[_0x790c('0x10')]['id']],_0x2954fe?_0x790c('0x1e'):_0x790c('0x1f'));}if(!_0x2954fe){setTimeout(this['push'][_0x790c('0xb')](this),0x3e8);}};function agent(_0x55e24a,_0x1af333,_0x447434,_0x4f800b){return new Agent(_0x55e24a,_0x1af333,_0x447434,_0x4f800b);}module[_0x790c('0x20')]=agent; \ No newline at end of file +var _0x11db=['handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','timeout','drained'];(function(_0x347f84,_0x3d9d73){var _0x3d0db1=function(_0x15b151){while(--_0x15b151){_0x347f84['push'](_0x347f84['shift']());}};_0x3d0db1(++_0x3d9d73);}(_0x11db,0x146));var _0xb11d=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0x11db[_0x173113];return _0x3bea89;};'use strict';var _=require(_0xb11d('0x0'));var uuid=require(_0xb11d('0x1'));var util=require(_0xb11d('0x2'));var logger=require(_0xb11d('0x3'))(_0xb11d('0x4'));var Agent=function(_0x5bdced,_0x35b41a,_0x1624f6,_0x20d50e){this[_0xb11d('0x5')]=uuid['v4']();this[_0xb11d('0x6')]=_0x5bdced;this[_0xb11d('0x7')]=_0x35b41a;this[_0xb11d('0x8')]=_0x1624f6;this[_0xb11d('0x4')]=_0x20d50e;this[_0xb11d('0x6')][_0xb11d('0x9')](this['handleRun'][_0xb11d('0xa')](this),this[_0xb11d('0xb')][_0xb11d('0xa')](this));this['squeue']['on'](_0xb11d('0xc'),this[_0xb11d('0xb')][_0xb11d('0xa')](this));this[_0xb11d('0x6')]['on'](_0xb11d('0xd'),this[_0xb11d('0xe')]['bind'](this));};Agent[_0xb11d('0xf')]['push']=function(){this[_0xb11d('0x6')]['push'](this[_0xb11d('0x10')][_0xb11d('0xa')](this),this[_0xb11d('0xb')][_0xb11d('0xa')](this));};Agent['prototype'][_0xb11d('0xe')]=function(){this[_0xb11d('0xb')](!![]);};Agent[_0xb11d('0xf')][_0xb11d('0x10')]=function(_0x390d5a){logger[_0xb11d('0x11')](_0xb11d('0x12'),this[_0xb11d('0x6')]['id'],this['agent']['id']);if(_[_0xb11d('0x13')](this['realtime'][_0xb11d('0x14')][this[_0xb11d('0x7')]['id']])){logger['info'](_0xb11d('0x15'),this[_0xb11d('0x6')]['id'],this[_0xb11d('0x7')]['id']);setTimeout(this[_0xb11d('0x9')][_0xb11d('0xa')](this),0x3e8);}else{if(this[_0xb11d('0x4')]['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this[_0xb11d('0x8')][_0xb11d('0x14')][this[_0xb11d('0x7')]['id']],this[_0xb11d('0x6')][_0xb11d('0x16')],![])){this[_0xb11d('0x8')][_0xb11d('0x14')][this[_0xb11d('0x7')]['id']]['busy']=!![];this['realtime']['agents'][this[_0xb11d('0x7')]['id']]['busyQueue']=undefined;util[_0xb11d('0x17')](this[_0xb11d('0x5')],this[_0xb11d('0x6')]['id'],this['realtime']['agents'][this[_0xb11d('0x7')]['id']],null,this[_0xb11d('0x4')]);util[_0xb11d('0x18')](this['squeue']['id'],this[_0xb11d('0x8')][_0xb11d('0x14')][this[_0xb11d('0x7')]['id']],_0xb11d('0x19')+(this[_0xb11d('0x4')]['forcedOwnership']?_0xb11d('0x1a'):''));}else{logger['info'](_0xb11d('0x1b'),this[_0xb11d('0x6')]['id'],this[_0xb11d('0x7')]['id']);setTimeout(this[_0xb11d('0x9')][_0xb11d('0xa')](this),0x3e8);}}};Agent[_0xb11d('0xf')]['handleTimeout']=function(_0x3078e7){if(_['isNil'](this[_0xb11d('0x8')]['agents'][this[_0xb11d('0x7')]['id']])){return logger['info'](_0xb11d('0x15'),this[_0xb11d('0x6')]['id'],this[_0xb11d('0x7')]['id']);}else{logger[_0xb11d('0x11')](_0xb11d('0x1c'),this[_0xb11d('0x6')]['id'],this[_0xb11d('0x7')]['id']);util['hideNotification'](this['notificationId'],this['squeue']['id'],this[_0xb11d('0x8')][_0xb11d('0x14')][this[_0xb11d('0x7')]['id']],null,this[_0xb11d('0x4')]);this['realtime'][_0xb11d('0x14')][this[_0xb11d('0x7')]['id']][_0xb11d('0x1d')]=![];this[_0xb11d('0x8')]['agents'][this[_0xb11d('0x7')]['id']][_0xb11d('0x1e')]=undefined;util[_0xb11d('0x18')](this[_0xb11d('0x6')]['id'],this[_0xb11d('0x8')]['agents'][this['agent']['id']],_0x3078e7?_0xb11d('0x1f'):_0xb11d('0x20'));}if(!_0x3078e7){setTimeout(this[_0xb11d('0x9')][_0xb11d('0xa')](this),0x3e8);}};function agent(_0xea5b2f,_0xaf3767,_0x58358d,_0x2d7fd5){return new Agent(_0xea5b2f,_0xaf3767,_0x58358d,_0x2d7fd5);}module[_0xb11d('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 0365bdd..f6038e5 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 _0x8d48=['uuid','./util','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','Agents','length','realtime','isAgentAvailable','agents','channel','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','busyQueue','exports'];(function(_0x333747,_0x3f4270){var _0x75d3bf=function(_0x38d8a2){while(--_0x38d8a2){_0x333747['push'](_0x333747['shift']());}};_0x75d3bf(++_0x3f4270);}(_0x8d48,0x140));var _0x88d4=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0x8d48[_0x493a51];return _0xc85756;};'use strict';var _=require('lodash');var uuid=require(_0x88d4('0x0'));var util=require(_0x88d4('0x1'));var logger=require('../../../../../config/logger')(_0x88d4('0x2'));var Beepall=function(_0x36fff4,_0x1047c6,_0x5974e0,_0x55276d){this[_0x88d4('0x3')]=uuid['v4']();this[_0x88d4('0x4')]=_0x36fff4;this[_0x88d4('0x5')]=_0x1047c6;this['realtime']=_0x5974e0;this[_0x88d4('0x2')]=_0x55276d;this['squeue'][_0x88d4('0x6')](this[_0x88d4('0x7')][_0x88d4('0x8')](this),this[_0x88d4('0x9')]['bind'](this));this[_0x88d4('0x4')]['on'](_0x88d4('0xa'),this[_0x88d4('0x9')][_0x88d4('0x8')](this));this[_0x88d4('0x4')]['on'](_0x88d4('0xb'),this['handleDrained'][_0x88d4('0x8')](this));};Beepall[_0x88d4('0xc')]['push']=function(){this[_0x88d4('0x4')][_0x88d4('0x6')](this[_0x88d4('0x7')][_0x88d4('0x8')](this),this['handleTimeout'][_0x88d4('0x8')](this));};Beepall['prototype'][_0x88d4('0xd')]=function(_0x2868fa){this['handleTimeout'](!![]);};Beepall['prototype']['handleRun']=function(_0x5f18cc){var _0x41b185=!![];if(!_[_0x88d4('0xe')](this[_0x88d4('0x5')])&&!_['isNil'](this['queue'][_0x88d4('0xf')])&&this[_0x88d4('0x5')][_0x88d4('0xf')][_0x88d4('0x10')]>0x0){for(var _0x947cf=0x0,_0x54b1bc;_0x947cf0x0){for(var _0x3201c2=0x0,_0x313bd7;_0x3201c20x0&&_0xac9ca6[_0x45ab10+_0xbea5('0x26')]>=_0xac9ca6[_0x45ab10+_0xbea5('0x25')]){writeLog(_0x461ccd,_0xac9ca6,_0x45ab10[_0xbea5('0x27')]()+_0xbea5('0x28'));return![];}}return!![];};exports[_0xbea5('0x29')]=function(_0x4476eb,_0x9f8e08,_0x211bde,_0x120110,_0x1f1918){return sendNotification(!![],_0x4476eb,_0x9f8e08,_0x211bde,_0x120110,_0x1f1918);};exports[_0xbea5('0x2a')]=function(_0x48b122,_0x368e22,_0xbc7ff5,_0x1c2410,_0x6d16eb){return sendNotification(![],_0x48b122,_0x368e22,_0xbc7ff5,_0x1c2410,_0x6d16eb);};exports[_0xbea5('0x2b')]=writeLog; \ No newline at end of file +var _0x4c68=['online','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','writeLog','lodash','util','../utils','mustache','../../../../../config/logger','redis','defaults','socket.io-emitter','format','user:%s','emit','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY'];(function(_0x4be90c,_0x57ea15){var _0x53bdfe=function(_0x207578){while(--_0x207578){_0x4be90c['push'](_0x4be90c['shift']());}};_0x53bdfe(++_0x57ea15);}(_0x4c68,0x198));var _0x84c6=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x4c68[_0x4653f7];return _0x5454da;};'use strict';var _=require(_0x84c6('0x0'));var util=require(_0x84c6('0x1'));var utils=require(_0x84c6('0x2'));var Mustache=require(_0x84c6('0x3'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0x84c6('0x4'))('routing');config[_0x84c6('0x5')]=_[_0x84c6('0x6')](config[_0x84c6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x84c6('0x7'))(new Redis(config[_0x84c6('0x5')]));function emit(_0xbfdd50,_0x2b423f,_0x3d5cb2){io['to'](_0xbfdd50)['emit'](_0x2b423f,_0x3d5cb2);}function sendNotification(_0x23021b,_0x2e9130,_0x52af8e,_0x1c1b8c,_0xf3b50a,_0x418145){io['to'](util[_0x84c6('0x8')](_0x84c6('0x9'),_0x1c1b8c['name']))[_0x84c6('0xa')]('user:save',_0x1c1b8c);var _0xee1cbf=_0x418145||{};var _0x584403=_0x52af8e[_0x84c6('0xb')]('.');var _0x13b89f={'uniqueid':_0x2e9130,'channel':_0x584403[0x0],'id':_0x584403[0x1],'title':_0x584403[0x0]+_0x84c6('0xc'),'interactionId':_0x584403[0x2],'queue':_0xf3b50a?_0xf3b50a[_0x84c6('0xd')]:null,'sound':_0xee1cbf[_0x84c6('0xe')][_0x84c6('0xf')],'shake':_0xee1cbf['account'][_0x84c6('0x10')]};try{if(!_0xee1cbf[_0x84c6('0x11')]){_0xee1cbf[_0x84c6('0x11')]={};}if(_0xf3b50a){_0xee1cbf['body'][_0x84c6('0x12')]=_0xf3b50a;}else if(_0xee1cbf[_0x84c6('0x11')]['queue']){delete _0xee1cbf[_0x84c6('0x11')][_0x84c6('0x12')];}_0x13b89f[_0x84c6('0x13')]=utils[_0x84c6('0x14')](_0xee1cbf[_0x84c6('0xe')][_0x84c6('0x15')],_0xee1cbf);}catch(_0x4db9ab){_0x13b89f['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x84c6('0x16')](util[_0x84c6('0x8')](_0x84c6('0x17'),_0x2e9130,_0x4db9ab['message']));}io['to'](util[_0x84c6('0x8')](_0x84c6('0x9'),_0x1c1b8c[_0x84c6('0xd')]))['emit'](util[_0x84c6('0x8')](_0x84c6('0x18'),_0x23021b?_0x84c6('0x19'):_0x84c6('0x1a')),_0x13b89f);}function writeLog(_0x418486,_0xfb2188,_0x3b6cb8){return logger[_0x84c6('0x1b')](util[_0x84c6('0x8')](_0x84c6('0x1c'),_0x418486,_0xfb2188[_0x84c6('0xd')],_0x3b6cb8));}exports[_0x84c6('0x1d')]=function(_0xaf3ec1,_0x11ab38,_0x41cf39,_0x3090dd){if(_0x11ab38[_0x84c6('0x1e')]){writeLog(_0xaf3ec1,_0x11ab38,_0x84c6('0x1f'));return![];}if(!_0x11ab38[_0x84c6('0x20')]){writeLog(_0xaf3ec1,_0x11ab38,'OFFLINE');return![];}if(_0x11ab38[_0x41cf39+_0x84c6('0x21')]){writeLog(_0xaf3ec1,_0x11ab38,'PAUSE');return![];}if(_0x3090dd&&_0x11ab38[_0x84c6('0x22')](_0x41cf39+_0x84c6('0x23'))&&_0x11ab38['hasOwnProperty'](_0x41cf39+_0x84c6('0x24'))){if(_0x11ab38[_0x41cf39+_0x84c6('0x23')]>0x0&&_0x11ab38[_0x41cf39+_0x84c6('0x24')]>=_0x11ab38[_0x41cf39+_0x84c6('0x23')]){writeLog(_0xaf3ec1,_0x11ab38,_0x41cf39[_0x84c6('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x84c6('0x26')]=function(_0x1eae93,_0x2f8689,_0x5ad8fe,_0x18e225,_0x490023){return sendNotification(!![],_0x1eae93,_0x2f8689,_0x5ad8fe,_0x18e225,_0x490023);};exports['hideNotification']=function(_0x1b155e,_0x2ade17,_0x666f77,_0x2a7362,_0x59ff77){return sendNotification(![],_0x1b155e,_0x2ade17,_0x666f77,_0x2a7362,_0x59ff77);};exports[_0x84c6('0x27')]=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 6e2a6ef..01a47f5 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 _0x55e5=['isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','lodash','../../../../config/logger','routing','string','validate','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x2b9ae5,_0x5e8539){var _0x293a88=function(_0x8b1661){while(--_0x8b1661){_0x2b9ae5['push'](_0x2b9ae5['shift']());}};_0x293a88(++_0x5e8539);}(_0x55e5,0x1bf));var _0x555e=function(_0x5cd984,_0x2bd40){_0x5cd984=_0x5cd984-0x0;var _0x455520=_0x55e5[_0x5cd984];return _0x455520;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x555e('0x0'));var utils=require('./utils');var logger=require(_0x555e('0x1'))(_0x555e('0x2'));var system=schema({'command':{'type':_0x555e('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x5982ef,_0x19228c){return function(_0x5830d0){try{var _0x1e9ee2={'command':_0x19228c[0x0]};var _0x54d005=system[_0x555e('0x4')](_0x1e9ee2,{'typecast':!![]});if(_0x54d005['length']){logger[_0x555e('0x5')](_0x555e('0x6'),_0x5982ef,_[_0x555e('0x7')](_0x54d005,'message')[_0x555e('0x8')](',\x20'));logger[_0x555e('0x9')](_0x555e('0xa'),_0x5982ef);_0x5830d0['next']();}else{var _0x2f1acd=this;var _0x246cb8=utils['getMustacheRender'](_0x19228c[0x0],this);logger[_0x555e('0x9')](_0x555e('0xb'),_0x5982ef,_0x246cb8);sh['exec'](_[_0x555e('0xc')](_0x246cb8),function(_0x46c4e9,_0x2abadd){logger[_0x555e('0x9')](_0x555e('0xd'),_0x5982ef,_0x46c4e9);if(_0x46c4e9==0x0){var _0x75b415=_0x2abadd[_0x555e('0xe')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x19228c[0x1])||_[_0x555e('0xf')](_0x19228c[0x1])){logger[_0x555e('0x9')](_0x555e('0x10'),_0x5982ef);_0x2f1acd[_0x555e('0x11')][_0x19228c[0x1]]=_0x75b415;}else{logger[_0x555e('0x9')](_0x555e('0x12'),_0x5982ef,_0x19228c[0x1],_0x75b415);_0x2f1acd[_0x555e('0x11')][_0x19228c[0x1]]=_0x75b415;}}_0x5830d0[_0x555e('0x13')]();});}}catch(_0x1a70e3){logger[_0x555e('0x5')](_0x555e('0x6'),_0x5982ef,_[_0x555e('0x14')](_0x1a70e3)?JSON[_0x555e('0x15')](_0x1a70e3):_0x1a70e3);logger[_0x555e('0x9')](_0x555e('0xa'),_0x5982ef);_0x5830d0[_0x555e('0x13')]();}};}; \ No newline at end of file +var _0xabd8=['consequence','[%s][SYSTEM]\x20%s','map','join','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','info','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','validate','shelljs','lodash','../../../../config/logger','string'];(function(_0x2ebb2f,_0xbfcddc){var _0x2e4860=function(_0x1380f2){while(--_0x1380f2){_0x2ebb2f['push'](_0x2ebb2f['shift']());}};_0x2e4860(++_0xbfcddc);}(_0xabd8,0x164));var _0x8abd=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0xabd8[_0x5275b8];return _0x568a9b;};'use strict';var schema=require(_0x8abd('0x0'));var sh=require(_0x8abd('0x1'));var _=require(_0x8abd('0x2'));var utils=require('./utils');var logger=require(_0x8abd('0x3'))('routing');var system=schema({'command':{'type':_0x8abd('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x8abd('0x5')]=function(_0x4a181d,_0x1ca080){return function(_0x1b7205){try{var _0x28733d={'command':_0x1ca080[0x0]};var _0x52277e=system[_0x8abd('0x0')](_0x28733d,{'typecast':!![]});if(_0x52277e['length']){logger['error'](_0x8abd('0x6'),_0x4a181d,_[_0x8abd('0x7')](_0x52277e,'message')[_0x8abd('0x8')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4a181d);_0x1b7205[_0x8abd('0x9')]();}else{var _0x57845c=this;var _0x18e4af=utils['getMustacheRender'](_0x1ca080[0x0],this);logger['info'](_0x8abd('0xa'),_0x4a181d,_0x18e4af);sh[_0x8abd('0xb')](_[_0x8abd('0xc')](_0x18e4af),function(_0x15914c,_0x2d4d79){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x4a181d,_0x15914c);if(_0x15914c==0x0){var _0x2146b3=_0x2d4d79['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x8abd('0xd')](_0x1ca080[0x1])||_['isEmpty'](_0x1ca080[0x1])){logger[_0x8abd('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x4a181d);_0x57845c[_0x8abd('0xf')][_0x1ca080[0x1]]=_0x2146b3;}else{logger[_0x8abd('0xe')](_0x8abd('0x10'),_0x4a181d,_0x1ca080[0x1],_0x2146b3);_0x57845c[_0x8abd('0xf')][_0x1ca080[0x1]]=_0x2146b3;}}_0x1b7205[_0x8abd('0x9')]();});}}catch(_0x336afe){logger[_0x8abd('0x11')]('[%s][SYSTEM]\x20%s',_0x4a181d,_[_0x8abd('0x12')](_0x336afe)?JSON['stringify'](_0x336afe):_0x336afe);logger[_0x8abd('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4a181d);_0x1b7205[_0x8abd('0x9')]();}};}; \ 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 0dddb2e..32215ad 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 _0xabe9=['../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','interaction','catch','stringify','finally','[%s][TAG]\x20%s','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction'];(function(_0x23496e,_0x5c2620){var _0xd5128e=function(_0x503fdc){while(--_0x503fdc){_0x23496e['push'](_0x23496e['shift']());}};_0xd5128e(++_0x5c2620);}(_0xabe9,0xc4));var _0x9abe=function(_0x57dffc,_0x48d44e){_0x57dffc=_0x57dffc-0x0;var _0x5ac6ca=_0xabe9[_0x57dffc];return _0x5ac6ca;};'use strict';var schema=require('validate');var _=require(_0x9abe('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x9abe('0x1')),'smsInteraction':require(_0x9abe('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x9abe('0x3')),'whatsappInteraction':require(_0x9abe('0x4'))};var logger=require(_0x9abe('0x5'))(_0x9abe('0x6'));var tag=schema({'tag':{'type':_0x9abe('0x7'),'required':!![],'message':_0x9abe('0x8')}});exports['consequence']=function(_0x5c794b,_0x4ab68c,_0x51eab3,_0x281d48){return function(_0x54b5b9){try{var _0x171720={'tag':_0x4ab68c[0x0]};var _0x47f972=tag[_0x9abe('0x9')](_0x171720,{'typecast':!![]});if(_0x47f972[_0x9abe('0xa')]){logger[_0x9abe('0xb')]('[%s][TAG]\x20%s',_0x5c794b,_[_0x9abe('0xc')](_0x47f972,_0x9abe('0xd'))[_0x9abe('0xe')](',\x20'));logger[_0x9abe('0xf')](_0x9abe('0x10'),_0x5c794b);_0x54b5b9[_0x9abe('0x11')]();}else{var _0x194f3c={'ids':[_0x4ab68c[0x0]]};if(rpc[_0x281d48['channel']+_0x9abe('0x12')]){rpc[_0x281d48[_0x9abe('0x13')]+_0x9abe('0x12')]['addTags'](_0x281d48['interaction']['id'],_0x194f3c)['then'](function(_0x2467c1){logger[_0x9abe('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5c794b,_0x4ab68c[0x1],_0x281d48[_0x9abe('0x13')],_0x281d48[_0x9abe('0x14')]['id']);})[_0x9abe('0x15')](function(_0xb8c541){logger['error']('[%s][TAG]\x20%s',_0x5c794b,JSON[_0x9abe('0x16')](_0xb8c541));logger[_0x9abe('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5c794b);})[_0x9abe('0x17')](function(){_0x54b5b9[_0x9abe('0x11')]();});}}}catch(_0xf46f6c){logger['error'](_0x9abe('0x18'),_0x5c794b,_['isObject'](_0xf46f6c)?JSON['stringify'](_0xf46f6c):_0xf46f6c);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5c794b);_0x54b5b9[_0x9abe('0x11')]();}};}; \ No newline at end of file +var _0x30ca=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','consequence','validate','length','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0x30ca,0x88));var _0xa30c=function(_0x3aade3,_0x344232){_0x3aade3=_0x3aade3-0x0;var _0x55d244=_0x30ca[_0x3aade3];return _0x55d244;};'use strict';var schema=require('validate');var _=require(_0xa30c('0x0'));var rpc={'chatInteraction':require(_0xa30c('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa30c('0x2')),'mailInteraction':require(_0xa30c('0x3')),'faxInteraction':require(_0xa30c('0x4')),'whatsappInteraction':require(_0xa30c('0x5'))};var logger=require(_0xa30c('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa30c('0x7')]=function(_0x57bada,_0x431096,_0x59a04f,_0x2df22c){return function(_0x18cf27){try{var _0x3a9b49={'tag':_0x431096[0x0]};var _0x3de42e=tag[_0xa30c('0x8')](_0x3a9b49,{'typecast':!![]});if(_0x3de42e[_0xa30c('0x9')]){logger['error'](_0xa30c('0xa'),_0x57bada,_[_0xa30c('0xb')](_0x3de42e,_0xa30c('0xc'))['join'](',\x20'));logger[_0xa30c('0xd')](_0xa30c('0xe'),_0x57bada);_0x18cf27[_0xa30c('0xf')]();}else{var _0x52b7a3={'ids':[_0x431096[0x0]]};if(rpc[_0x2df22c[_0xa30c('0x10')]+_0xa30c('0x11')]){rpc[_0x2df22c['channel']+_0xa30c('0x11')][_0xa30c('0x12')](_0x2df22c[_0xa30c('0x13')]['id'],_0x52b7a3)['then'](function(_0x131310){logger[_0xa30c('0xd')](_0xa30c('0x14'),_0x57bada,_0x431096[0x1],_0x2df22c['channel'],_0x2df22c[_0xa30c('0x13')]['id']);})[_0xa30c('0x15')](function(_0x5de5bb){logger[_0xa30c('0x16')]('[%s][TAG]\x20%s',_0x57bada,JSON[_0xa30c('0x17')](_0x5de5bb));logger[_0xa30c('0xd')](_0xa30c('0xe'),_0x57bada);})[_0xa30c('0x18')](function(){_0x18cf27['next']();});}}}catch(_0x34841a){logger['error'](_0xa30c('0xa'),_0x57bada,_[_0xa30c('0x19')](_0x34841a)?JSON[_0xa30c('0x17')](_0x34841a):_0x34841a);logger[_0xa30c('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x57bada);_0x18cf27['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 128583d..b20983e 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 _0xf257=['interaction','list','exports','render','body','contact','message','account'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xf257,0x82));var _0x7f25=function(_0x53b481,_0x35c1e8){_0x53b481=_0x53b481-0x0;var _0x35b801=_0xf257[_0x53b481];return _0x35b801;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x7f25('0x0')]={'getMustacheRender':function(_0x1dc4a2,_0x3f7a94){return Mustache[_0x7f25('0x1')](_0x1dc4a2,_['merge'](_0x3f7a94[_0x7f25('0x2')],{'contact':_0x3f7a94[_0x7f25('0x3')],'message':_0x3f7a94[_0x7f25('0x4')],'account':_0x3f7a94[_0x7f25('0x5')],'interaction':_0x3f7a94[_0x7f25('0x6')],'list':_0x3f7a94[_0x7f25('0x7')]}))||'';}}; \ No newline at end of file +var _0x544a=['mustache','lodash','exports','render','body','contact','account','interaction','list'];(function(_0x574993,_0x3c8962){var _0x196847=function(_0x3fc6da){while(--_0x3fc6da){_0x574993['push'](_0x574993['shift']());}};_0x196847(++_0x3c8962);}(_0x544a,0xbd));var _0xa544=function(_0x3b0f99,_0x2e58a0){_0x3b0f99=_0x3b0f99-0x0;var _0x49793e=_0x544a[_0x3b0f99];return _0x49793e;};'use strict';var Mustache=require(_0xa544('0x0'));var _=require(_0xa544('0x1'));module[_0xa544('0x2')]={'getMustacheRender':function(_0x5d759f,_0x544b38){return Mustache[_0xa544('0x3')](_0x5d759f,_['merge'](_0x544b38[_0xa544('0x4')],{'contact':_0x544b38[_0xa544('0x5')],'message':_0x544b38['message'],'account':_0x544b38[_0xa544('0x6')],'interaction':_0x544b38[_0xa544('0x7')],'list':_0x544b38[_0xa544('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f69348a..a353960 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 _0xefff=['agent','agents','busy','busyQueue','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','mailQueues','waiting','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','interval','rules','channel','message','interaction','applications','length','existsSync','app','appdata','push','slice','join','dialogflow','amazonlex','split','TagId','format','%s:%s:%s','condition','./applications/','consequence','Push\x20new\x20rule','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','matchPath','emit','complete','routing\x20is\x20empty','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty'];(function(_0x381aca,_0x3784a1){var _0x17b285=function(_0x5c6b08){while(--_0x5c6b08){_0x381aca['push'](_0x381aca['shift']());}};_0x17b285(++_0x3784a1);}(_0xefff,0x1d1));var _0xfeff=function(_0x38ffbe,_0xbce052){_0x38ffbe=_0x38ffbe-0x0;var _0x5b8f13=_0xefff[_0x38ffbe];return _0x5b8f13;};'use strict';var _=require(_0xfeff('0x0'));var util=require('util');var path=require(_0xfeff('0x1'));var fs=require('fs');var jayson=require(_0xfeff('0x2'));var BPromise=require('bluebird');var uuid=require(_0xfeff('0x3'));var config=require(_0xfeff('0x4'));var logger=require('../../../config/logger')(_0xfeff('0x5'));var rpc={'openchannelQueueReport':require(_0xfeff('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xfeff('0x7')),'smsQueueReport':require(_0xfeff('0x8')),'faxQueueReport':require(_0xfeff('0x9')),'whatsappQueueReport':require(_0xfeff('0xa'))};var RuleEngine=require(_0xfeff('0xb'));function getId(_0x20476f,_0x1365b5,_0x7052e6){return util['format'](_0xfeff('0xc'),_0x20476f,_0x1365b5||0x0,_0x7052e6||0x0);}function getIntervals(_0x13ea07,_0x1c360e){var _0x531545=[];if(!_['isNil'](_0x1c360e[_0xfeff('0xd')])&&!_[_0xfeff('0xe')](_0x13ea07[_0x1c360e['IntervalId']])&&!_[_0xfeff('0xe')](_0x13ea07[_0x1c360e['IntervalId']][_0xfeff('0xf')])){_0x531545=_['map'](_0x13ea07[_0x1c360e[_0xfeff('0xd')]]['Intervals'],_0xfeff('0x10'));}else if(!_[_0xfeff('0xe')](_0x1c360e[_0xfeff('0x10')])){_0x531545=[_0x1c360e['interval']];}return _0x531545;}exports['listen']=function(_0x37d51c){_0x37d51c[_0xfeff('0x11')]={};return new BPromise(function(_0x409348,_0x3ec510){var _0x378888={'Start':function(_0x49f8fb){var _0x407adb=this;return new Promise(function(_0x43de8b,_0x39e1cd){if(_0x49f8fb){try{var _0x5966f9=[];var _0xcdef86=getId(_0x49f8fb[_0xfeff('0x12')],_0x49f8fb['message']?_0x49f8fb[_0xfeff('0x13')]['id']:0x0,_0x49f8fb['interaction']?_0x49f8fb[_0xfeff('0x14')]['id']:0x0);if(_0x49f8fb['applications']&&_['isArray'](_0x49f8fb[_0xfeff('0x15')])&&_0x49f8fb[_0xfeff('0x15')][_0xfeff('0x16')]){for(var _0xf0ef0e=0x0;_0xf0ef0e<_0x49f8fb[_0xfeff('0x15')][_0xfeff('0x16')];_0xf0ef0e+=0x1){var _0x372f1d=_0x49f8fb['applications'][_0xf0ef0e];if(fs[_0xfeff('0x17')](path['join'](__dirname,_0xfeff('0x15'),_0x372f1d[_0xfeff('0x18')]+'.js'))){var _0x5d1437=[];switch(_0x372f1d[_0xfeff('0x18')]['toLowerCase']()){case'autoreply':var _0x2025c4=_0x372f1d[_0xfeff('0x19')]['split'](',');_0x5d1437['push'](_0x2025c4[0x0]);_0x5d1437[_0xfeff('0x1a')](_0x2025c4[_0xfeff('0x1b')](0x1,_0x2025c4['length'])[_0xfeff('0x1c')](','));break;case _0xfeff('0x1d'):var _0x1a5741=_0x372f1d['appdata']['split'](',');_0x5d1437[_0xfeff('0x1a')](_0x1a5741[0x0]);_0x5d1437[_0xfeff('0x1a')](_0x1a5741[0x1]);_0x5d1437[_0xfeff('0x1a')](_0x1a5741['slice'](0x2,_0x1a5741[_0xfeff('0x16')])['join'](','));break;case _0xfeff('0x1e'):var _0xe29778=_0x372f1d[_0xfeff('0x19')][_0xfeff('0x1f')](',');_0x5d1437[_0xfeff('0x1a')](_0xe29778[0x0]);_0x5d1437[_0xfeff('0x1a')](_0xe29778[0x1]);_0x5d1437[_0xfeff('0x1a')](_0xe29778[0x2]);_0x5d1437[_0xfeff('0x1a')](_0xe29778[0x3]);_0x5d1437[_0xfeff('0x1a')](_0xe29778[_0xfeff('0x1b')](0x4,_0xe29778[_0xfeff('0x16')])['join'](','));break;case _0xfeff('0x13'):_0x5d1437[_0xfeff('0x1a')](_0x372f1d[_0xfeff('0x19')]);break;case'tag':_0x5d1437[_0xfeff('0x1a')](_0x372f1d[_0xfeff('0x20')]);_0x5d1437['push'](_0x372f1d[_0xfeff('0x19')]);break;default:_0x5d1437=_[_0xfeff('0xe')](_0x372f1d[_0xfeff('0x19')])?[]:_0x372f1d['appdata'][_0xfeff('0x1f')](',');}var _0x15592a={'id':util[_0xfeff('0x21')](_0xfeff('0x22'),_0xcdef86,_0x372f1d['id'],_0x372f1d[_0xfeff('0x18')]),'condition':require('./interval')[_0xfeff('0x23')](_0xcdef86,getIntervals(_0x37d51c['intervals'],_0x372f1d),_0x37d51c),'consequence':require(_0xfeff('0x24')+_0x372f1d[_0xfeff('0x18')])[_0xfeff('0x25')](_0xcdef86,_0x5d1437,_0x37d51c,_0x49f8fb),'p':_0x372f1d['priority']||0x0};logger['info'](_0xfeff('0x26'),_0x15592a['id'],'on\x20interval',getIntervals(_0x37d51c[_0xfeff('0x27')],_0x372f1d)['join'](_0xfeff('0x28')));_0x5966f9[_0xfeff('0x1a')](_0x15592a);}else{logger[_0xfeff('0x29')](_0xfeff('0x2a'),path[_0xfeff('0x1c')](__dirname,_0xfeff('0x15'),_0x372f1d[_0xfeff('0x18')]+'.js'));}}_0x37d51c[_0xfeff('0x11')][_0xcdef86]=new RuleEngine(_0x5966f9);_0x37d51c['rules'][_0xcdef86]['execute'](_0x49f8fb,function(_0x4e94aa){logger[_0xfeff('0x2b')](_0xfeff('0x2c'),JSON[_0xfeff('0x2d')](_0x4e94aa[_0xfeff('0x2e')]));if(_0x37d51c[_0xfeff('0x11')][_0xcdef86]){_0x37d51c[_0xfeff('0x11')][_0xcdef86][_0xfeff('0x2f')](_0xfeff('0x30'));}});return _0x43de8b({'code':0xc8,'message':_0x49f8fb});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x43de8b({'code':0xc8,'message':_0x49f8fb});}}catch(_0x1a7ee2){logger[_0xfeff('0x29')](_0x1a7ee2['stack']);return _0x39e1cd(_0x407adb[_0xfeff('0x29')](0x1f4,_0x1a7ee2));}}return _0x39e1cd(_0xfeff('0x31'));});},'AcceptMessage':function(_0x2bb459){var _0x362bd0=this;return new Promise(function(_0x1c6989,_0x485a9e){if(_0x2bb459[_0xfeff('0x13')]&&_0x2bb459[_0xfeff('0x13')]['id']){try{var _0x5b828c=getId(_0x2bb459[_0xfeff('0x12')],_0x2bb459[_0xfeff('0x13')]?_0x2bb459[_0xfeff('0x13')]['id']:0x0,_0x2bb459[_0xfeff('0x14')]?_0x2bb459[_0xfeff('0x14')]['id']:0x0);if(_0x37d51c[_0xfeff('0x11')][_0x5b828c]){_0x37d51c[_0xfeff('0x11')][_0x5b828c][_0xfeff('0x2f')](_0xfeff('0x32'));if(rpc[_0x2bb459[_0xfeff('0x12')]+_0xfeff('0x33')]){rpc[_0x2bb459[_0xfeff('0x12')]+'QueueReport'][_0xfeff('0x34')](_0x5b828c,{'UserId':_0x2bb459[_0xfeff('0x13')][_0xfeff('0x35')]})['catch'](function(_0x3a2762){logger['error'](_0xfeff('0x36'));});}}return _0x1c6989({'code':0xc8,'message':_0x2bb459});}catch(_0x1ca4db){logger[_0xfeff('0x29')](_0x1ca4db[_0xfeff('0x37')]);return _0x485a9e(_0x362bd0[_0xfeff('0x29')](0x1f4,_0x1ca4db));}}logger['error'](_0xfeff('0x38'));return _0x485a9e(_0x362bd0['error'](0x1f4,_0xfeff('0x38')));});},'RejectMessage':function(_0xcedcc0){var _0x1c2d99=this;return new Promise(function(_0x13c758,_0x291303){if(_0xcedcc0[_0xfeff('0x39')]&&_0xcedcc0['agent']['id']){try{if(_0x37d51c[_0xfeff('0x3a')][_0xcedcc0[_0xfeff('0x39')]['id']]){_0x37d51c[_0xfeff('0x3a')][_0xcedcc0['agent']['id']][_0xfeff('0x3b')]=![];_0x37d51c['agents'][_0xcedcc0[_0xfeff('0x39')]['id']][_0xfeff('0x3c')]=undefined;}return _0x13c758({'code':0xc8,'message':_0xcedcc0});}catch(_0x5beb03){logger[_0xfeff('0x29')](_0x5beb03['stack']);return _0x291303(_0x1c2d99['error'](0x1f4,_0x5beb03));}}logger[_0xfeff('0x29')](_0xfeff('0x38'));return _0x291303(_0x1c2d99[_0xfeff('0x29')](0x1f4,_0xfeff('0x38')));});},'AbandonInteraction':function(_0x27cda8){var _0x3ff60f=this;return new Promise(function(_0x3ae6bc,_0x2a4cf5){if(_0x27cda8[_0xfeff('0x12')]&&_0x27cda8['interaction']&&_0x27cda8[_0xfeff('0x14')]['id']){try{var _0x36b07c=getId(_0x27cda8[_0xfeff('0x12')],_0x27cda8['message']?_0x27cda8[_0xfeff('0x13')]['id']:0x0,_0x27cda8[_0xfeff('0x14')]?_0x27cda8['interaction']['id']:0x0);if(_0x37d51c[_0xfeff('0x11')][_0x36b07c]){_0x37d51c[_0xfeff('0x11')][_0x36b07c][_0xfeff('0x2f')]('end');}return _0x3ae6bc({'code':0xc8,'message':_0x27cda8});}catch(_0xeff484){logger[_0xfeff('0x29')](_0xeff484[_0xfeff('0x37')]);return _0x2a4cf5(_0x3ff60f[_0xfeff('0x29')](0x1f4,_0xeff484));}}logger[_0xfeff('0x29')](_0xfeff('0x38'));return _0x2a4cf5(_0x3ff60f['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xa848c7){var _0x5cc6cf=this;return new Promise(function(_0x18ffce,_0x1d9529){if(_0x37d51c[_0xfeff('0x3a')][_0xfeff('0x3d')](_0xa848c7['id'])){for(var _0x304f07 in _0xa848c7[_0xfeff('0x3e')]){if(_0xa848c7[_0xfeff('0x3e')][_0xfeff('0x3d')](_0x304f07)){if(_0x37d51c[_0xfeff('0x3a')][_0xa848c7['id']][_0xfeff('0x3d')](_0x304f07+'CurrentCapacity')){_0x37d51c[_0xfeff('0x3a')][_0xa848c7['id']][_0x304f07+'CurrentCapacity']=parseInt(_0xa848c7[_0xfeff('0x3e')][_0x304f07],0xa);}}}_0x37d51c['agents'][_0xa848c7['id']][_0xfeff('0x3f')]();return _0x18ffce({'code':0xc8,'message':_0x37d51c[_0xfeff('0x3a')][_0xa848c7['id']]});}else{return _0x1d9529(_0x5cc6cf[_0xfeff('0x29')](0x1f4,_0xfeff('0x40')));}});},'Agents':function(_0x278daa){return new Promise(function(_0x2aebf0,_0x547f09){var _0x4afd7c=_[_0xfeff('0x41')](_0x37d51c[_0xfeff('0x3a')]);_0x2aebf0({'count':_0x4afd7c[_0xfeff('0x16')],'rows':_0x4afd7c});});},'ChatQueues':function(_0x1d039e){return new Promise(function(_0x25639a,_0xf58516){var _0x4d9903=[];for(var _0xabd797 in _0x37d51c[_0xfeff('0x42')]){if(_0x37d51c[_0xfeff('0x42')][_0xfeff('0x3d')](_0xabd797)){var _0x35431a=_0x37d51c[_0xfeff('0x42')][_0xabd797];var _0x5aaf17={'id':_0x35431a['id'],'available':_0x35431a[_0xfeff('0x43')],'loggedIn':_0x35431a['loggedIn'],'name':_0x35431a[_0xfeff('0x44')],'paused':_0x35431a[_0xfeff('0x45')],'waiting':_0x35431a['waiting']};_0x4d9903[_0xfeff('0x1a')](_0x5aaf17);}}_0x25639a({'count':_0x4d9903[_0xfeff('0x16')],'rows':_0x4d9903});});},'MailQueues':function(_0x14e14b){return new Promise(function(_0x509762,_0x17774c){var _0x30e0a3=[];for(var _0x377f9b in _0x37d51c[_0xfeff('0x46')]){if(_0x37d51c[_0xfeff('0x46')][_0xfeff('0x3d')](_0x377f9b)){var _0x3bcd66=_0x37d51c['mailQueues'][_0x377f9b];var _0x37b40a={'id':_0x3bcd66['id'],'available':_0x3bcd66[_0xfeff('0x43')],'loggedIn':_0x3bcd66['loggedIn'],'name':_0x3bcd66[_0xfeff('0x44')],'paused':_0x3bcd66[_0xfeff('0x45')],'waiting':_0x3bcd66[_0xfeff('0x47')]};_0x30e0a3[_0xfeff('0x1a')](_0x37b40a);}}_0x509762({'count':_0x30e0a3[_0xfeff('0x16')],'rows':_0x30e0a3});});},'OpenchannelQueues':function(_0x3d104b){return new Promise(function(_0x3e7a36,_0x59881c){var _0x6f9daf=[];for(var _0x26f64e in _0x37d51c[_0xfeff('0x48')]){if(_0x37d51c[_0xfeff('0x48')][_0xfeff('0x3d')](_0x26f64e)){var _0x48c6e8=_0x37d51c[_0xfeff('0x48')][_0x26f64e];var _0x3e4aab={'id':_0x48c6e8['id'],'available':_0x48c6e8[_0xfeff('0x43')],'loggedIn':_0x48c6e8[_0xfeff('0x49')],'name':_0x48c6e8[_0xfeff('0x44')],'paused':_0x48c6e8[_0xfeff('0x45')],'waiting':_0x48c6e8[_0xfeff('0x47')]};_0x6f9daf[_0xfeff('0x1a')](_0x3e4aab);}}_0x3e7a36({'count':_0x6f9daf[_0xfeff('0x16')],'rows':_0x6f9daf});});},'SmsQueues':function(_0x5a1542){return new Promise(function(_0x366fe0,_0x3a9be8){var _0xb01a8b=[];for(var _0x1c9354 in _0x37d51c[_0xfeff('0x4a')]){if(_0x37d51c[_0xfeff('0x4a')][_0xfeff('0x3d')](_0x1c9354)){var _0x4c0637=_0x37d51c[_0xfeff('0x4a')][_0x1c9354];var _0x3c3791={'id':_0x4c0637['id'],'available':_0x4c0637[_0xfeff('0x43')],'loggedIn':_0x4c0637['loggedIn'],'name':_0x4c0637['name'],'paused':_0x4c0637[_0xfeff('0x45')],'waiting':_0x4c0637[_0xfeff('0x47')]};_0xb01a8b[_0xfeff('0x1a')](_0x3c3791);}}_0x366fe0({'count':_0xb01a8b[_0xfeff('0x16')],'rows':_0xb01a8b});});},'FaxQueues':function(_0x5b355f){return new Promise(function(_0xe04336,_0x53d162){var _0x28554e=[];for(var _0x1911a4 in _0x37d51c[_0xfeff('0x4b')]){if(_0x37d51c[_0xfeff('0x4b')][_0xfeff('0x3d')](_0x1911a4)){var _0x5cfcc4=_0x37d51c[_0xfeff('0x4b')][_0x1911a4];var _0x5dd6ea={'id':_0x5cfcc4['id'],'available':_0x5cfcc4[_0xfeff('0x43')],'loggedIn':_0x5cfcc4[_0xfeff('0x49')],'name':_0x5cfcc4[_0xfeff('0x44')],'paused':_0x5cfcc4[_0xfeff('0x45')],'waiting':_0x5cfcc4[_0xfeff('0x47')]};_0x28554e[_0xfeff('0x1a')](_0x5dd6ea);}}_0xe04336({'count':_0x28554e[_0xfeff('0x16')],'rows':_0x28554e});});},'WhatsappQueues':function(_0x40f5cc){return new Promise(function(_0x259452,_0x1790a5){var _0x5608f3=[];for(var _0x35d510 in _0x37d51c['whatsappQueues']){if(_0x37d51c['whatsappQueues']['hasOwnProperty'](_0x35d510)){var _0x2903ad=_0x37d51c[_0xfeff('0x4c')][_0x35d510];var _0x14dfd6={'id':_0x2903ad['id'],'available':_0x2903ad['available'],'loggedIn':_0x2903ad[_0xfeff('0x49')],'name':_0x2903ad['name'],'paused':_0x2903ad[_0xfeff('0x45')],'waiting':_0x2903ad[_0xfeff('0x47')]};_0x5608f3['push'](_0x14dfd6);}}_0x259452({'count':_0x5608f3['length'],'rows':_0x5608f3});});},'ChatQueuesWaitingInteractions':function(_0x298ed5){return new Promise(function(_0x5a35a7,_0x177078){var _0x164399=_['values'](_0x37d51c[_0xfeff('0x4d')]);_0x5a35a7({'count':_0x164399[_0xfeff('0x16')],'rows':_0x164399});});},'MailQueuesWaitingInteractions':function(_0x48b756){return new Promise(function(_0x2e298e,_0x3ef537){var _0x5ab075=_['values'](_0x37d51c[_0xfeff('0x4e')]);_0x2e298e({'count':_0x5ab075[_0xfeff('0x16')],'rows':_0x5ab075});});},'OpenchannelQueuesWaitingInteractions':function(_0x504940){return new Promise(function(_0x239e10,_0x1c639c){var _0x3147ff=_[_0xfeff('0x41')](_0x37d51c[_0xfeff('0x4f')]);_0x239e10({'count':_0x3147ff[_0xfeff('0x16')],'rows':_0x3147ff});});},'SmsQueuesWaitingInteractions':function(_0x32c660){return new Promise(function(_0x1cddce,_0x34629b){var _0x3f627a=_[_0xfeff('0x41')](_0x37d51c[_0xfeff('0x50')]);_0x1cddce({'count':_0x3f627a[_0xfeff('0x16')],'rows':_0x3f627a});});},'FaxQueuesWaitingInteractions':function(_0x374c9a){return new Promise(function(_0x205966,_0xf244f){var _0x15a441=_[_0xfeff('0x41')](_0x37d51c['faxQueuesWaitingInteractions']);_0x205966({'count':_0x15a441[_0xfeff('0x16')],'rows':_0x15a441});});},'WhatsappQueuesWaitingInteractions':function(_0x4e3e64){return new Promise(function(_0x2fc188,_0x4e9824){var _0x3b8d38=_[_0xfeff('0x41')](_0x37d51c[_0xfeff('0x51')]);_0x2fc188({'count':_0x3b8d38['length'],'rows':_0x3b8d38});});}};var _0x35203d=jayson[_0xfeff('0x52')](_0x378888)[_0xfeff('0x53')]();_0x35203d['on']('error',function(_0x33b93d){logger['error'](JSON[_0xfeff('0x2d')](_0x33b93d));return _0x3ec510(_0x33b93d);});_0x35203d['listen'](0x232c,_0xfeff('0x54'),function(){console['log'](_0xfeff('0x55'),0x232c);return _0x409348(_0xfeff('0x56')+0x232c);});});}; \ No newline at end of file +var _0x9dec=['split','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','./applications/','info','on\x20interval','\x20|\x20','execute','Applications\x20executed','matchPath','emit','No\x20applications\x20to\x20execute','error','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','agent','busy','agents','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','loggedIn','name','paused','mailQueues','available','openchannelQueues','smsQueues','waiting','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','push','slice','dialogflow'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x9dec,0x141));var _0xc9de=function(_0x33fa07,_0x6eac7e){_0x33fa07=_0x33fa07-0x0;var _0x4159cb=_0x9dec[_0x33fa07];return _0x4159cb;};'use strict';var _=require('lodash');var util=require(_0xc9de('0x0'));var path=require(_0xc9de('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xc9de('0x2'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0xc9de('0x3'))(_0xc9de('0x4'));var rpc={'openchannelQueueReport':require(_0xc9de('0x5')),'mailQueueReport':require(_0xc9de('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xc9de('0x7')),'faxQueueReport':require(_0xc9de('0x8')),'whatsappQueueReport':require(_0xc9de('0x9'))};var RuleEngine=require(_0xc9de('0xa'));function getId(_0x1e0595,_0xe795c8,_0x26f0ba){return util[_0xc9de('0xb')](_0xc9de('0xc'),_0x1e0595,_0xe795c8||0x0,_0x26f0ba||0x0);}function getIntervals(_0xc1ccda,_0x3e2c7f){var _0x5820a6=[];if(!_[_0xc9de('0xd')](_0x3e2c7f[_0xc9de('0xe')])&&!_[_0xc9de('0xd')](_0xc1ccda[_0x3e2c7f['IntervalId']])&&!_[_0xc9de('0xd')](_0xc1ccda[_0x3e2c7f['IntervalId']][_0xc9de('0xf')])){_0x5820a6=_[_0xc9de('0x10')](_0xc1ccda[_0x3e2c7f[_0xc9de('0xe')]][_0xc9de('0xf')],_0xc9de('0x11'));}else if(!_[_0xc9de('0xd')](_0x3e2c7f[_0xc9de('0x11')])){_0x5820a6=[_0x3e2c7f[_0xc9de('0x11')]];}return _0x5820a6;}exports[_0xc9de('0x12')]=function(_0x318734){_0x318734[_0xc9de('0x13')]={};return new BPromise(function(_0xd43c1e,_0x1539d2){var _0x48f6a9={'Start':function(_0x23ebc1){var _0x1458d3=this;return new Promise(function(_0x1285bf,_0xe35854){if(_0x23ebc1){try{var _0x4bf0ae=[];var _0x566bd7=getId(_0x23ebc1[_0xc9de('0x14')],_0x23ebc1[_0xc9de('0x15')]?_0x23ebc1[_0xc9de('0x15')]['id']:0x0,_0x23ebc1[_0xc9de('0x16')]?_0x23ebc1[_0xc9de('0x16')]['id']:0x0);if(_0x23ebc1[_0xc9de('0x17')]&&_['isArray'](_0x23ebc1[_0xc9de('0x17')])&&_0x23ebc1[_0xc9de('0x17')][_0xc9de('0x18')]){for(var _0x1e6242=0x0;_0x1e6242<_0x23ebc1['applications'][_0xc9de('0x18')];_0x1e6242+=0x1){var _0x2051cd=_0x23ebc1[_0xc9de('0x17')][_0x1e6242];if(fs[_0xc9de('0x19')](path[_0xc9de('0x1a')](__dirname,_0xc9de('0x17'),_0x2051cd[_0xc9de('0x1b')]+_0xc9de('0x1c')))){var _0x630480=[];switch(_0x2051cd[_0xc9de('0x1b')][_0xc9de('0x1d')]()){case _0xc9de('0x1e'):var _0xd82409=_0x2051cd[_0xc9de('0x1f')]['split'](',');_0x630480['push'](_0xd82409[0x0]);_0x630480[_0xc9de('0x20')](_0xd82409[_0xc9de('0x21')](0x1,_0xd82409[_0xc9de('0x18')])[_0xc9de('0x1a')](','));break;case _0xc9de('0x22'):var _0x26ece7=_0x2051cd['appdata'][_0xc9de('0x23')](',');_0x630480[_0xc9de('0x20')](_0x26ece7[0x0]);_0x630480['push'](_0x26ece7[0x1]);_0x630480[_0xc9de('0x20')](_0x26ece7[_0xc9de('0x21')](0x2,_0x26ece7['length'])['join'](','));break;case _0xc9de('0x24'):var _0x411c8c=_0x2051cd['appdata'][_0xc9de('0x23')](',');_0x630480[_0xc9de('0x20')](_0x411c8c[0x0]);_0x630480['push'](_0x411c8c[0x1]);_0x630480[_0xc9de('0x20')](_0x411c8c[0x2]);_0x630480[_0xc9de('0x20')](_0x411c8c[0x3]);_0x630480[_0xc9de('0x20')](_0x411c8c[_0xc9de('0x21')](0x4,_0x411c8c['length'])[_0xc9de('0x1a')](','));break;case'message':_0x630480[_0xc9de('0x20')](_0x2051cd[_0xc9de('0x1f')]);break;case _0xc9de('0x25'):_0x630480[_0xc9de('0x20')](_0x2051cd[_0xc9de('0x26')]);_0x630480['push'](_0x2051cd[_0xc9de('0x1f')]);break;default:_0x630480=_[_0xc9de('0xd')](_0x2051cd[_0xc9de('0x1f')])?[]:_0x2051cd[_0xc9de('0x1f')][_0xc9de('0x23')](',');}var _0x379488={'id':util['format'](_0xc9de('0x27'),_0x566bd7,_0x2051cd['id'],_0x2051cd[_0xc9de('0x1b')]),'condition':require(_0xc9de('0x28'))[_0xc9de('0x29')](_0x566bd7,getIntervals(_0x318734['intervals'],_0x2051cd),_0x318734),'consequence':require(_0xc9de('0x2a')+_0x2051cd[_0xc9de('0x1b')])['consequence'](_0x566bd7,_0x630480,_0x318734,_0x23ebc1),'p':_0x2051cd['priority']||0x0};logger[_0xc9de('0x2b')]('Push\x20new\x20rule',_0x379488['id'],_0xc9de('0x2c'),getIntervals(_0x318734['intervals'],_0x2051cd)[_0xc9de('0x1a')](_0xc9de('0x2d')));_0x4bf0ae[_0xc9de('0x20')](_0x379488);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc9de('0x1a')](__dirname,_0xc9de('0x17'),_0x2051cd[_0xc9de('0x1b')]+_0xc9de('0x1c')));}}_0x318734[_0xc9de('0x13')][_0x566bd7]=new RuleEngine(_0x4bf0ae);_0x318734[_0xc9de('0x13')][_0x566bd7][_0xc9de('0x2e')](_0x23ebc1,function(_0x47e73a){logger[_0xc9de('0x2b')](_0xc9de('0x2f'),JSON['stringify'](_0x47e73a[_0xc9de('0x30')]));if(_0x318734[_0xc9de('0x13')][_0x566bd7]){_0x318734[_0xc9de('0x13')][_0x566bd7][_0xc9de('0x31')]('complete');}});return _0x1285bf({'code':0xc8,'message':_0x23ebc1});}else{logger['info'](_0xc9de('0x32'));return _0x1285bf({'code':0xc8,'message':_0x23ebc1});}}catch(_0x12dbb9){logger[_0xc9de('0x33')](_0x12dbb9['stack']);return _0xe35854(_0x1458d3['error'](0x1f4,_0x12dbb9));}}return _0xe35854('routing\x20is\x20empty');});},'AcceptMessage':function(_0x3a3410){var _0x530ff6=this;return new Promise(function(_0x471e38,_0x2397d0){if(_0x3a3410['message']&&_0x3a3410[_0xc9de('0x15')]['id']){try{var _0x5d8d80=getId(_0x3a3410[_0xc9de('0x14')],_0x3a3410['message']?_0x3a3410[_0xc9de('0x15')]['id']:0x0,_0x3a3410[_0xc9de('0x16')]?_0x3a3410[_0xc9de('0x16')]['id']:0x0);if(_0x318734[_0xc9de('0x13')][_0x5d8d80]){_0x318734[_0xc9de('0x13')][_0x5d8d80][_0xc9de('0x31')](_0xc9de('0x34'));if(rpc[_0x3a3410[_0xc9de('0x14')]+_0xc9de('0x35')]){rpc[_0x3a3410[_0xc9de('0x14')]+_0xc9de('0x35')][_0xc9de('0x36')](_0x5d8d80,{'UserId':_0x3a3410[_0xc9de('0x15')][_0xc9de('0x37')]})['catch'](function(_0x1f30e2){logger[_0xc9de('0x33')](_0xc9de('0x38'));});}}return _0x471e38({'code':0xc8,'message':_0x3a3410});}catch(_0x31de7d){logger[_0xc9de('0x33')](_0x31de7d[_0xc9de('0x39')]);return _0x2397d0(_0x530ff6[_0xc9de('0x33')](0x1f4,_0x31de7d));}}logger['error']('message\x20is\x20empty');return _0x2397d0(_0x530ff6[_0xc9de('0x33')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5814af){var _0x7ed463=this;return new Promise(function(_0x429639,_0x183804){if(_0x5814af[_0xc9de('0x3a')]&&_0x5814af[_0xc9de('0x3a')]['id']){try{if(_0x318734['agents'][_0x5814af[_0xc9de('0x3a')]['id']]){_0x318734['agents'][_0x5814af['agent']['id']][_0xc9de('0x3b')]=![];_0x318734[_0xc9de('0x3c')][_0x5814af[_0xc9de('0x3a')]['id']][_0xc9de('0x3d')]=undefined;}return _0x429639({'code':0xc8,'message':_0x5814af});}catch(_0xa23fb3){logger[_0xc9de('0x33')](_0xa23fb3['stack']);return _0x183804(_0x7ed463['error'](0x1f4,_0xa23fb3));}}logger['error'](_0xc9de('0x3e'));return _0x183804(_0x7ed463['error'](0x1f4,_0xc9de('0x3e')));});},'AbandonInteraction':function(_0x4944ee){var _0x3fb4c9=this;return new Promise(function(_0x52382e,_0x5293d6){if(_0x4944ee[_0xc9de('0x14')]&&_0x4944ee[_0xc9de('0x16')]&&_0x4944ee['interaction']['id']){try{var _0x5b9990=getId(_0x4944ee[_0xc9de('0x14')],_0x4944ee[_0xc9de('0x15')]?_0x4944ee['message']['id']:0x0,_0x4944ee[_0xc9de('0x16')]?_0x4944ee[_0xc9de('0x16')]['id']:0x0);if(_0x318734[_0xc9de('0x13')][_0x5b9990]){_0x318734[_0xc9de('0x13')][_0x5b9990]['emit'](_0xc9de('0x34'));}return _0x52382e({'code':0xc8,'message':_0x4944ee});}catch(_0x3f2066){logger[_0xc9de('0x33')](_0x3f2066['stack']);return _0x5293d6(_0x3fb4c9[_0xc9de('0x33')](0x1f4,_0x3f2066));}}logger[_0xc9de('0x33')](_0xc9de('0x3e'));return _0x5293d6(_0x3fb4c9[_0xc9de('0x33')](0x1f4,_0xc9de('0x3e')));});},'AgentCapacity':function(_0x4b5596){var _0x2e4b73=this;return new Promise(function(_0x27eedf,_0x5af2e1){if(_0x318734[_0xc9de('0x3c')][_0xc9de('0x3f')](_0x4b5596['id'])){for(var _0xa73b80 in _0x4b5596[_0xc9de('0x40')]){if(_0x4b5596[_0xc9de('0x40')]['hasOwnProperty'](_0xa73b80)){if(_0x318734[_0xc9de('0x3c')][_0x4b5596['id']][_0xc9de('0x3f')](_0xa73b80+'CurrentCapacity')){_0x318734[_0xc9de('0x3c')][_0x4b5596['id']][_0xa73b80+_0xc9de('0x41')]=parseInt(_0x4b5596[_0xc9de('0x40')][_0xa73b80],0xa);}}}_0x318734[_0xc9de('0x3c')][_0x4b5596['id']]['updateRealtime']();return _0x27eedf({'code':0xc8,'message':_0x318734['agents'][_0x4b5596['id']]});}else{return _0x5af2e1(_0x2e4b73[_0xc9de('0x33')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x49fa44){return new Promise(function(_0x135560,_0xef01bc){var _0x32554e=_[_0xc9de('0x42')](_0x318734[_0xc9de('0x3c')]);_0x135560({'count':_0x32554e[_0xc9de('0x18')],'rows':_0x32554e});});},'ChatQueues':function(_0x277bf8){return new Promise(function(_0x254ca8,_0x5f449d){var _0x2a10bd=[];for(var _0x5cfee9 in _0x318734[_0xc9de('0x43')]){if(_0x318734[_0xc9de('0x43')][_0xc9de('0x3f')](_0x5cfee9)){var _0x145ae6=_0x318734[_0xc9de('0x43')][_0x5cfee9];var _0x1161f3={'id':_0x145ae6['id'],'available':_0x145ae6['available'],'loggedIn':_0x145ae6[_0xc9de('0x44')],'name':_0x145ae6[_0xc9de('0x45')],'paused':_0x145ae6[_0xc9de('0x46')],'waiting':_0x145ae6['waiting']};_0x2a10bd['push'](_0x1161f3);}}_0x254ca8({'count':_0x2a10bd['length'],'rows':_0x2a10bd});});},'MailQueues':function(_0x96f550){return new Promise(function(_0x9a8053,_0x26165c){var _0x45022e=[];for(var _0x13702e in _0x318734[_0xc9de('0x47')]){if(_0x318734[_0xc9de('0x47')][_0xc9de('0x3f')](_0x13702e)){var _0x392277=_0x318734['mailQueues'][_0x13702e];var _0x3035c8={'id':_0x392277['id'],'available':_0x392277[_0xc9de('0x48')],'loggedIn':_0x392277['loggedIn'],'name':_0x392277[_0xc9de('0x45')],'paused':_0x392277[_0xc9de('0x46')],'waiting':_0x392277['waiting']};_0x45022e[_0xc9de('0x20')](_0x3035c8);}}_0x9a8053({'count':_0x45022e['length'],'rows':_0x45022e});});},'OpenchannelQueues':function(_0x10e049){return new Promise(function(_0x435e34,_0x398177){var _0x80a9a1=[];for(var _0x3b9011 in _0x318734['openchannelQueues']){if(_0x318734[_0xc9de('0x49')][_0xc9de('0x3f')](_0x3b9011)){var _0x561a60=_0x318734['openchannelQueues'][_0x3b9011];var _0x13a641={'id':_0x561a60['id'],'available':_0x561a60['available'],'loggedIn':_0x561a60[_0xc9de('0x44')],'name':_0x561a60[_0xc9de('0x45')],'paused':_0x561a60[_0xc9de('0x46')],'waiting':_0x561a60['waiting']};_0x80a9a1['push'](_0x13a641);}}_0x435e34({'count':_0x80a9a1[_0xc9de('0x18')],'rows':_0x80a9a1});});},'SmsQueues':function(_0x53a499){return new Promise(function(_0x4eb7ce,_0x52f50c){var _0x873af2=[];for(var _0x60297b in _0x318734[_0xc9de('0x4a')]){if(_0x318734['smsQueues'][_0xc9de('0x3f')](_0x60297b)){var _0x3d29e5=_0x318734['smsQueues'][_0x60297b];var _0x5c3e9a={'id':_0x3d29e5['id'],'available':_0x3d29e5[_0xc9de('0x48')],'loggedIn':_0x3d29e5[_0xc9de('0x44')],'name':_0x3d29e5[_0xc9de('0x45')],'paused':_0x3d29e5[_0xc9de('0x46')],'waiting':_0x3d29e5[_0xc9de('0x4b')]};_0x873af2[_0xc9de('0x20')](_0x5c3e9a);}}_0x4eb7ce({'count':_0x873af2[_0xc9de('0x18')],'rows':_0x873af2});});},'FaxQueues':function(_0x3c1212){return new Promise(function(_0x1ca5f9,_0x1af138){var _0x187580=[];for(var _0x330d45 in _0x318734['faxQueues']){if(_0x318734[_0xc9de('0x4c')][_0xc9de('0x3f')](_0x330d45)){var _0x45ace1=_0x318734[_0xc9de('0x4c')][_0x330d45];var _0x2938b5={'id':_0x45ace1['id'],'available':_0x45ace1['available'],'loggedIn':_0x45ace1[_0xc9de('0x44')],'name':_0x45ace1[_0xc9de('0x45')],'paused':_0x45ace1['paused'],'waiting':_0x45ace1[_0xc9de('0x4b')]};_0x187580[_0xc9de('0x20')](_0x2938b5);}}_0x1ca5f9({'count':_0x187580[_0xc9de('0x18')],'rows':_0x187580});});},'WhatsappQueues':function(_0x3cd064){return new Promise(function(_0x3b5a86,_0x5c90f6){var _0x5f5196=[];for(var _0x3e33b0 in _0x318734['whatsappQueues']){if(_0x318734['whatsappQueues']['hasOwnProperty'](_0x3e33b0)){var _0x45b7a9=_0x318734[_0xc9de('0x4d')][_0x3e33b0];var _0x1e6a0e={'id':_0x45b7a9['id'],'available':_0x45b7a9[_0xc9de('0x48')],'loggedIn':_0x45b7a9[_0xc9de('0x44')],'name':_0x45b7a9[_0xc9de('0x45')],'paused':_0x45b7a9[_0xc9de('0x46')],'waiting':_0x45b7a9['waiting']};_0x5f5196[_0xc9de('0x20')](_0x1e6a0e);}}_0x3b5a86({'count':_0x5f5196[_0xc9de('0x18')],'rows':_0x5f5196});});},'ChatQueuesWaitingInteractions':function(_0x45b393){return new Promise(function(_0x190d3e,_0x3debd1){var _0x4563f0=_['values'](_0x318734[_0xc9de('0x4e')]);_0x190d3e({'count':_0x4563f0[_0xc9de('0x18')],'rows':_0x4563f0});});},'MailQueuesWaitingInteractions':function(_0x253e37){return new Promise(function(_0xbf0609,_0x2fc41c){var _0xb15e48=_[_0xc9de('0x42')](_0x318734['mailQueuesWaitingInteractions']);_0xbf0609({'count':_0xb15e48[_0xc9de('0x18')],'rows':_0xb15e48});});},'OpenchannelQueuesWaitingInteractions':function(_0x53d8f3){return new Promise(function(_0x3d68d2,_0x4614c0){var _0x24757f=_[_0xc9de('0x42')](_0x318734[_0xc9de('0x4f')]);_0x3d68d2({'count':_0x24757f[_0xc9de('0x18')],'rows':_0x24757f});});},'SmsQueuesWaitingInteractions':function(_0x376867){return new Promise(function(_0x454e93,_0x4ba705){var _0x4cddc4=_[_0xc9de('0x42')](_0x318734['smsQueuesWaitingInteractions']);_0x454e93({'count':_0x4cddc4[_0xc9de('0x18')],'rows':_0x4cddc4});});},'FaxQueuesWaitingInteractions':function(_0x138d1f){return new Promise(function(_0x2e0040,_0x1bd32f){var _0x126495=_[_0xc9de('0x42')](_0x318734[_0xc9de('0x50')]);_0x2e0040({'count':_0x126495[_0xc9de('0x18')],'rows':_0x126495});});},'WhatsappQueuesWaitingInteractions':function(_0x52b854){return new Promise(function(_0xd08845,_0x541da3){var _0x530057=_[_0xc9de('0x42')](_0x318734[_0xc9de('0x51')]);_0xd08845({'count':_0x530057['length'],'rows':_0x530057});});}};var _0x52ea7f=jayson[_0xc9de('0x52')](_0x48f6a9)[_0xc9de('0x53')]();_0x52ea7f['on'](_0xc9de('0x33'),function(_0x2bb669){logger['error'](JSON[_0xc9de('0x54')](_0x2bb669));return _0x1539d2(_0x2bb669);});_0x52ea7f[_0xc9de('0x12')](0x232c,_0xc9de('0x55'),function(){console[_0xc9de('0x56')](_0xc9de('0x57'),0x232c);return _0xd43c1e(_0xc9de('0x58')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 62d8e79..39b2f91 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 _0x891b=['error','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','jayson/promise','lodash','routing','client','http','then','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','iftime\x20%s','indexOf'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xb891('0x0'));var _=require(_0xb891('0x1'));var logger=require('../../../config/logger')(_0xb891('0x2'));var client=jayson[_0xb891('0x3')][_0xb891('0x4')]({'port':0x232a});function request(_0x467558,_0x587bf1){return new BPromise(function(_0x379509,_0x44ca2e){return client['request'](_0x467558,_0x587bf1)[_0xb891('0x5')](function(_0x4eda97){if(_0x4eda97['error']){return _0x44ca2e(_0x4eda97['error'][_0xb891('0x6')]);}else{return _0x379509(_0x4eda97[_0xb891('0x7')]);}})[_0xb891('0x8')](function(_0x1ca185){return _0x44ca2e(_0x1ca185);});});}exports[_0xb891('0x9')]=function(_0x414a33,_0x119686,_0x479df5){return function(_0x160c03){if(_0x479df5[_0xb891('0xa')]&&!_0x479df5[_0xb891('0xa')][_0x414a33]){logger[_0xb891('0xb')](_0xb891('0xc'),_0x414a33);return _0x160c03[_0xb891('0xd')]();}var _0x73d424=[];for(var _0x2fc18a=0x0;_0x2fc18a<_0x119686[_0xb891('0xe')];_0x2fc18a+=0x1){_0x73d424[_0xb891('0xf')](request(_0xb891('0x10'),{'command':util['format'](_0xb891('0x11'),_0x119686[_0x2fc18a])})[_0xb891('0x5')](function(_0x917a1b){return _0x917a1b&&_0x917a1b['message']&&_0x917a1b[_0xb891('0x6')][_0xb891('0x12')]('true')>=0x0?!![]:![];})[_0xb891('0x8')](function(_0x4c0e7c){logger[_0xb891('0x13')](_0xb891('0x14'),_0x414a33,_0x119686[_0x2fc18a]);}));}BPromise[_0xb891('0x15')](_0x73d424)[_0xb891('0x5')](function(_0x1fd866){var _0x2e3bcd=_['some'](_0x1fd866);logger['info'](_0xb891('0x16'),_0x414a33,_0x119686[_0xb891('0x17')](_0xb891('0x18')),_0x2e3bcd);_0x160c03[_0xb891('0x19')](_0x2e3bcd);})[_0xb891('0x8')](function(_0x37d51c){console[_0xb891('0x1a')](_0x37d51c);logger[_0xb891('0x13')]('[%s][INTERVAL]\x20%s\x20%s',_0x414a33,_0x119686['join'](_0xb891('0x18')),_0x37d51c['stack']);_0x160c03[_0xb891('0xd')]();});};}; \ No newline at end of file +var _0x72d1=['jayson/promise','lodash','../../../config/logger','client','http','request','then','error','message','result','catch','condition','rules','info','stop','length','Command','format','iftime\x20%s','indexOf','true','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','bluebird'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x72d1,0x1b2));var _0x172d=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0x72d1[_0x7148b6];return _0x111019;};'use strict';var util=require('util');var BPromise=require(_0x172d('0x0'));var jayson=require(_0x172d('0x1'));var _=require(_0x172d('0x2'));var logger=require(_0x172d('0x3'))('routing');var client=jayson[_0x172d('0x4')][_0x172d('0x5')]({'port':0x232a});function request(_0x16fc49,_0x56f5ac){return new BPromise(function(_0x4946c4,_0x589f28){return client[_0x172d('0x6')](_0x16fc49,_0x56f5ac)[_0x172d('0x7')](function(_0x51d364){if(_0x51d364[_0x172d('0x8')]){return _0x589f28(_0x51d364[_0x172d('0x8')][_0x172d('0x9')]);}else{return _0x4946c4(_0x51d364[_0x172d('0xa')]);}})[_0x172d('0xb')](function(_0x171d67){return _0x589f28(_0x171d67);});});}exports[_0x172d('0xc')]=function(_0xb1536b,_0x2edf8e,_0x13047b){return function(_0x4e5ce6){if(_0x13047b[_0x172d('0xd')]&&!_0x13047b[_0x172d('0xd')][_0xb1536b]){logger[_0x172d('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xb1536b);return _0x4e5ce6[_0x172d('0xf')]();}var _0x2b47e6=[];for(var _0x10366f=0x0;_0x10366f<_0x2edf8e[_0x172d('0x10')];_0x10366f+=0x1){_0x2b47e6['push'](request(_0x172d('0x11'),{'command':util[_0x172d('0x12')](_0x172d('0x13'),_0x2edf8e[_0x10366f])})['then'](function(_0x22bf0f){return _0x22bf0f&&_0x22bf0f[_0x172d('0x9')]&&_0x22bf0f[_0x172d('0x9')][_0x172d('0x14')](_0x172d('0x15'))>=0x0?!![]:![];})[_0x172d('0xb')](function(_0x1f4604){logger[_0x172d('0x8')]('[%s][INTERVAL]\x20%s',_0xb1536b,_0x2edf8e[_0x10366f]);}));}BPromise[_0x172d('0x16')](_0x2b47e6)['then'](function(_0x7c44f1){var _0x7f179f=_[_0x172d('0x17')](_0x7c44f1);logger[_0x172d('0xe')](_0x172d('0x18'),_0xb1536b,_0x2edf8e[_0x172d('0x19')]('\x20|\x20'),_0x7f179f);_0x4e5ce6[_0x172d('0x1a')](_0x7f179f);})[_0x172d('0xb')](function(_0x5d88fe){console[_0x172d('0x1b')](_0x5d88fe);logger[_0x172d('0x8')](_0x172d('0x18'),_0xb1536b,_0x2edf8e['join'](_0x172d('0x1c')),_0x5d88fe['stack']);_0x4e5ce6[_0x172d('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 2dad76b..73345b0 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 _0x473c=['agentcompleteAt','diffTime','agentconnectAt','blindtransfer','transfer','transfereruniqueid','transfertype','transferexten','extension','attendedtransfer','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','origtransfereruniqueid','agententerreason','transfereeuniqueid','calleridname','secondtransfererexten','transfertargetuniqueid','clone','hangup','cause','rejected','indexOf','splice','agent','complete','lodash','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','abandoned','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername'];(function(_0x141e5a,_0x22fcc5){var _0x14ca31=function(_0x57f6f4){while(--_0x57f6f4){_0x141e5a['push'](_0x141e5a['shift']());}};_0x14ca31(++_0x22fcc5);}(_0x473c,0x1cd));var _0xc473=function(_0x296aa1,_0x20198c){_0x296aa1=_0x296aa1-0x0;var _0x377836=_0x473c[_0x296aa1];return _0x377836;};'use strict';var _=require(_0xc473('0x0'));var util=require(_0xc473('0x1'));var utils=require(_0xc473('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x253351,_0x7ecb55){utils['info'](util[_0xc473('0x3')](_0xc473('0x4'),_0x253351[_0xc473('0x5')],_0x253351[_0xc473('0x6')],_0x253351[_0xc473('0x7')],_0x253351[_0xc473('0x8')],_0x253351[_0xc473('0x9')],_0x253351[_0xc473('0xa')],_0x253351[_0xc473('0xb')],_0x253351[_0xc473('0xc')]));if(_0x253351[_0xc473('0x7')]){utils[_0xc473('0xd')](_0x253351[_0xc473('0x7')])[_0xc473('0xe')](function(_0x31d3f6){if(_0x31d3f6){_0x253351[_0xc473('0xf')]=_0x31d3f6['type'];_0x253351[_0xc473('0x10')]=_0x253351[_0xc473('0x11')]?_0x31d3f6['acw']:![];_0x253351[_0xc473('0x12')]=_0x253351[_0xc473('0x10')]?_0x31d3f6['acwTimeout']:0x0;}utils['request'](_0xc473('0x13'),_0x253351);});}else{utils[_0xc473('0x14')]('CreateVoiceAgentReport',_0x253351);}if(_0x7ecb55){delete transfers[_0x253351[_0xc473('0x5')]];}else{delete agents[_0x253351[_0xc473('0x15')]];}}exports[_0xc473('0x16')]=function(_0x59599b){try{agents[_0x59599b[_0xc473('0x15')]]=_0x59599b;agents[_0x59599b[_0xc473('0x15')]][_0xc473('0x17')]=utils[_0xc473('0x18')]();agents[_0x59599b[_0xc473('0x15')]][_0xc473('0xc')]='called';agents[_0x59599b['destuniqueid']][_0xc473('0xb')]=null;agents[_0x59599b[_0xc473('0x15')]][_0xc473('0x19')]=null;}catch(_0x5e6490){utils[_0xc473('0x1a')](_0x5e6490[_0xc473('0x1b')]);}};exports[_0xc473('0x1c')]=function(_0x32afc1){try{if(!_[_0xc473('0x1d')](agents[_0x32afc1['destuniqueid']])){agents[_0x32afc1[_0xc473('0x15')]][_0xc473('0x1c')]=!![];agents[_0x32afc1[_0xc473('0x15')]][_0xc473('0x1e')]=utils[_0xc473('0x18')]();agents[_0x32afc1['destuniqueid']][_0xc473('0xc')]=_0xc473('0x1f');agents[_0x32afc1[_0xc473('0x15')]][_0xc473('0x20')]=_0xc473('0x1f');agents[_0x32afc1[_0xc473('0x15')]][_0xc473('0x21')]=_0x32afc1[_0xc473('0x22')]?parseInt(_0x32afc1['ringtime'])/0x3e8:0x0;agents[_0x32afc1[_0xc473('0x15')]][_0xc473('0x23')]=0x0;unanswered['push'](_0x32afc1[_0xc473('0x15')]);}}catch(_0x4efdd4){utils[_0xc473('0x1a')](_0x4efdd4[_0xc473('0x1b')]);}};exports[_0xc473('0x24')]=function(_0x4e6de8){try{_[_0xc473('0x25')](agents,function(_0x476706,_0x5ded0b){if(_0x476706[_0xc473('0x5')]==_0x4e6de8[_0xc473('0x5')]&&!_['includes'](unanswered,_0x476706['destuniqueid'])){_0x476706[_0xc473('0x1c')]=!![];_0x476706[_0xc473('0x1e')]=utils[_0xc473('0x18')]();_0x476706['lastevent']=_0xc473('0x26');_0x476706[_0xc473('0x20')]=_0xc473('0x26');_0x476706['holdtime']=_0x4e6de8[_0xc473('0x21')];_0x476706['talktime']=0x0;writeDB(_0x476706);}});}catch(_0x5016da){utils[_0xc473('0x1a')](_0x5016da['stack']);}};exports['agentconnect']=function(_0xf504b3){try{if(agents[_0xf504b3['destuniqueid']]){agents[_0xf504b3[_0xc473('0x15')]]['agentconnectAt']=utils[_0xc473('0x18')]();agents[_0xf504b3[_0xc473('0x15')]]['connectedlinenum']=_0xf504b3[_0xc473('0xb')];agents[_0xf504b3[_0xc473('0x15')]][_0xc473('0x19')]=_0xf504b3['connectedlinename'];agents[_0xf504b3[_0xc473('0x15')]]['holdtime']=_0xf504b3['ringtime'];agents[_0xf504b3['destuniqueid']][_0xc473('0xc')]=_0xc473('0x27');_[_0xc473('0x25')](agents,function(_0x56dba7,_0x2fc7cb){if(_0x56dba7[_0xc473('0x15')]!=_0xf504b3[_0xc473('0x15')]&&_0x56dba7['uniqueid']==_0xf504b3['uniqueid']){_0x56dba7['talktime']=0x0;_0x56dba7[_0xc473('0x21')]=_0xf504b3[_0xc473('0x22')];_0x56dba7['agentringnoanswer']=!![];_0x56dba7[_0xc473('0x1e')]=utils['now']();_0x56dba7[_0xc473('0xc')]=_0xc473('0x28');_0x56dba7[_0xc473('0x20')]=_0xc473('0x28');_0x56dba7[_0xc473('0x29')]=_0xf504b3[_0xc473('0x15')];_0x56dba7[_0xc473('0x2a')]=_0xf504b3['membername'];writeDB(_0x56dba7);}});}}catch(_0x135ac1){utils[_0xc473('0x1a')](_0x135ac1[_0xc473('0x1b')]);}};exports[_0xc473('0x11')]=function(_0xed62f3){try{if(!_['isNil'](agents[_0xed62f3[_0xc473('0x15')]])){agents[_0xed62f3['destuniqueid']][_0xc473('0x11')]=!![];agents[_0xed62f3[_0xc473('0x15')]][_0xc473('0x2b')]=utils['now']();agents[_0xed62f3[_0xc473('0x15')]]['talktime']=utils[_0xc473('0x2c')](agents[_0xed62f3[_0xc473('0x15')]][_0xc473('0x2b')],agents[_0xed62f3[_0xc473('0x15')]][_0xc473('0x2d')]);agents[_0xed62f3[_0xc473('0x15')]][_0xc473('0x20')]=_0xed62f3[_0xc473('0x20')];agents[_0xed62f3[_0xc473('0x15')]][_0xc473('0xc')]='complete';writeDB(agents[_0xed62f3[_0xc473('0x15')]]);}}catch(_0x1beb4d){utils[_0xc473('0x1a')](_0x1beb4d['stack']);}};exports[_0xc473('0x2e')]=function(_0x49cc3b){try{if(!_['isNil'](agents[_0x49cc3b['transfereruniqueid']])){agents[_0x49cc3b['transfereruniqueid']][_0xc473('0x2f')]=!![];agents[_0x49cc3b[_0xc473('0x30')]][_0xc473('0x31')]='blind';agents[_0x49cc3b[_0xc473('0x30')]][_0xc473('0x32')]=_0x49cc3b[_0xc473('0x33')];agents[_0x49cc3b[_0xc473('0x30')]]['transferuniqueid']=agents[_0x49cc3b[_0xc473('0x30')]][_0xc473('0x5')];}}catch(_0xf06cd4){utils[_0xc473('0x1a')](_0xf06cd4[_0xc473('0x1b')]);}};exports[_0xc473('0x34')]=function(_0x289c4d){try{if(_0x289c4d['origtransfereruniqueid']==_0x289c4d[_0xc473('0x35')]){if(!_[_0xc473('0x1d')](agents[_0x289c4d[_0xc473('0x36')]])){agents[_0x289c4d[_0xc473('0x36')]][_0xc473('0x2f')]=!![];agents[_0x289c4d[_0xc473('0x36')]][_0xc473('0x31')]=_0xc473('0x37');agents[_0x289c4d[_0xc473('0x36')]]['transferexten']=_0x289c4d[_0xc473('0x38')];agents[_0x289c4d[_0xc473('0x36')]][_0xc473('0x39')]=_0x289c4d[_0xc473('0x3a')];}if(_0x289c4d['transfereeuniqueid']&&agents[_0x289c4d['transfereeuniqueid']]){agents[_0x289c4d['transfereeuniqueid']][_0xc473('0x3b')]=0x1;transfers[_0x289c4d[_0xc473('0x3c')]]=_['clone'](agents[_0x289c4d[_0xc473('0x3c')]]);transfers[_0x289c4d[_0xc473('0x3c')]][_0xc473('0xa')]=agents[_0x289c4d[_0xc473('0x36')]][_0xc473('0xa')];transfers[_0x289c4d[_0xc473('0x3c')]][_0xc473('0x3d')]=agents[_0x289c4d[_0xc473('0x36')]][_0xc473('0x3d')];transfers[_0x289c4d[_0xc473('0x3c')]][_0xc473('0x17')]=utils[_0xc473('0x18')]();transfers[_0x289c4d[_0xc473('0x3c')]][_0xc473('0x2d')]=utils['now']();transfers[_0x289c4d['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x289c4d[_0xc473('0x3c')]][_0xc473('0x3b')]=0x2;}}else if(_0x289c4d[_0xc473('0x36')]==_0x289c4d['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x289c4d['origtransfereruniqueid']])){agents[_0x289c4d[_0xc473('0x3a')]][_0xc473('0x2f')]=!![];agents[_0x289c4d[_0xc473('0x3a')]][_0xc473('0x31')]='ATTENDED';agents[_0x289c4d[_0xc473('0x3a')]][_0xc473('0x32')]=_0x289c4d[_0xc473('0x3e')];agents[_0x289c4d['origtransfereruniqueid']][_0xc473('0x39')]=_0x289c4d[_0xc473('0x36')];}if(_0x289c4d[_0xc473('0x3f')]&&agents[_0x289c4d[_0xc473('0x3f')]]){agents[_0x289c4d['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x289c4d[_0xc473('0x3f')]]=_[_0xc473('0x40')](agents[_0x289c4d[_0xc473('0x3f')]]);transfers[_0x289c4d[_0xc473('0x3f')]][_0xc473('0xa')]=agents[_0x289c4d['origtransfereruniqueid']][_0xc473('0xa')];transfers[_0x289c4d['transfertargetuniqueid']][_0xc473('0x3d')]=agents[_0x289c4d['origtransfereruniqueid']]['calleridname'];transfers[_0x289c4d[_0xc473('0x3f')]][_0xc473('0x17')]=utils[_0xc473('0x18')]();transfers[_0x289c4d[_0xc473('0x3f')]]['agentconnectAt']=utils[_0xc473('0x18')]();transfers[_0x289c4d[_0xc473('0x3f')]][_0xc473('0x21')]=0x0;transfers[_0x289c4d[_0xc473('0x3f')]][_0xc473('0x3b')]=0x2;}}}catch(_0x4ef9b5){utils[_0xc473('0x1a')](_0x4ef9b5[_0xc473('0x1b')]);}};exports[_0xc473('0x41')]=function(_0x44d997){try{if(agents[_0x44d997[_0xc473('0x5')]]&&agents[_0x44d997[_0xc473('0x5')]][_0xc473('0x20')]===_0xc473('0x1f')){if(_0x44d997[_0xc473('0x42')]==='21'){agents[_0x44d997[_0xc473('0x5')]][_0xc473('0x20')]=_0xc473('0x43');agents[_0x44d997['uniqueid']]['lastevent']=_0xc473('0x43');}writeDB(agents[_0x44d997[_0xc473('0x5')]]);var _0x40243d=unanswered[_0xc473('0x44')](_0x44d997[_0xc473('0x5')]);if(_0x40243d>-0x1)unanswered[_0xc473('0x45')](_0x40243d,0x1);}if(transfers[_0x44d997[_0xc473('0x5')]]){transfers[_0x44d997['uniqueid']][_0xc473('0x11')]=!![];transfers[_0x44d997[_0xc473('0x5')]][_0xc473('0x2b')]=utils[_0xc473('0x18')]();transfers[_0x44d997['uniqueid']][_0xc473('0x23')]=utils[_0xc473('0x2c')](transfers[_0x44d997[_0xc473('0x5')]][_0xc473('0x2b')],transfers[_0x44d997[_0xc473('0x5')]][_0xc473('0x2d')]);transfers[_0x44d997[_0xc473('0x5')]]['reason']=_0xc473('0x46');transfers[_0x44d997['uniqueid']]['lastevent']='complete';writeDB(transfers[_0x44d997[_0xc473('0x5')]],!![]);}if(agents[_0x44d997[_0xc473('0x5')]]&&agents[_0x44d997[_0xc473('0x5')]]['agentconnectAt']){agents[_0x44d997[_0xc473('0x5')]]['agentcomplete']=!![];agents[_0x44d997[_0xc473('0x5')]]['agentcompleteAt']=utils[_0xc473('0x18')]();agents[_0x44d997[_0xc473('0x5')]][_0xc473('0x23')]=utils[_0xc473('0x2c')](agents[_0x44d997[_0xc473('0x5')]][_0xc473('0x2b')],agents[_0x44d997[_0xc473('0x5')]][_0xc473('0x2d')]);agents[_0x44d997[_0xc473('0x5')]][_0xc473('0x20')]=agents[_0x44d997['uniqueid']]['transfer']?_0xc473('0x2f'):_0xc473('0x46');agents[_0x44d997[_0xc473('0x5')]][_0xc473('0xc')]=_0xc473('0x47');writeDB(agents[_0x44d997[_0xc473('0x5')]]);}}catch(_0x454792){utils[_0xc473('0x1a')](_0x454792['stack']);}}; \ No newline at end of file +var _0xcbcd=['origtransfererlinkedid','secondtransfereruniqueid','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','agentconnectAt','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','agent','util','./utils','info','format','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','error','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','abandoned','stack','agentconnect','connect','answered_elsewhere','answeredelsewheremembername','isNil','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','origtransfereruniqueid'];(function(_0x1b8300,_0x472f39){var _0x49deb2=function(_0x150f25){while(--_0x150f25){_0x1b8300['push'](_0x1b8300['shift']());}};_0x49deb2(++_0x472f39);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xcbcd[_0x456fb1];return _0x4083d6;};'use strict';var _=require('lodash');var util=require(_0xdcbc('0x0'));var utils=require(_0xdcbc('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2ca35c,_0x377827){utils[_0xdcbc('0x2')](util[_0xdcbc('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x2ca35c[_0xdcbc('0x4')],_0x2ca35c[_0xdcbc('0x5')],_0x2ca35c[_0xdcbc('0x6')],_0x2ca35c[_0xdcbc('0x7')],_0x2ca35c['interface'],_0x2ca35c[_0xdcbc('0x8')],_0x2ca35c[_0xdcbc('0x9')],_0x2ca35c['lastevent']));if(_0x2ca35c[_0xdcbc('0x6')]){utils['getVoiceQueueByName'](_0x2ca35c[_0xdcbc('0x6')])[_0xdcbc('0xa')](function(_0x54507e){if(_0x54507e){_0x2ca35c['type']=_0x54507e[_0xdcbc('0xb')];_0x2ca35c[_0xdcbc('0xc')]=_0x2ca35c[_0xdcbc('0xd')]?_0x54507e[_0xdcbc('0xe')]:![];_0x2ca35c[_0xdcbc('0xf')]=_0x2ca35c[_0xdcbc('0xc')]?_0x54507e[_0xdcbc('0x10')]:0x0;}utils[_0xdcbc('0x11')](_0xdcbc('0x12'),_0x2ca35c);});}else{utils[_0xdcbc('0x11')](_0xdcbc('0x12'),_0x2ca35c);}if(_0x377827){delete transfers[_0x2ca35c[_0xdcbc('0x4')]];}else{delete agents[_0x2ca35c[_0xdcbc('0x13')]];}}exports['agentcalled']=function(_0x364608){try{agents[_0x364608[_0xdcbc('0x13')]]=_0x364608;agents[_0x364608[_0xdcbc('0x13')]][_0xdcbc('0x14')]=utils[_0xdcbc('0x15')]();agents[_0x364608['destuniqueid']][_0xdcbc('0x16')]=_0xdcbc('0x17');agents[_0x364608[_0xdcbc('0x13')]][_0xdcbc('0x9')]=null;agents[_0x364608[_0xdcbc('0x13')]][_0xdcbc('0x18')]=null;}catch(_0xe98305){utils[_0xdcbc('0x19')](_0xe98305['stack']);}};exports[_0xdcbc('0x1a')]=function(_0x5b21fb){try{if(!_['isNil'](agents[_0x5b21fb[_0xdcbc('0x13')]])){agents[_0x5b21fb['destuniqueid']][_0xdcbc('0x1a')]=!![];agents[_0x5b21fb[_0xdcbc('0x13')]][_0xdcbc('0x1b')]=utils[_0xdcbc('0x15')]();agents[_0x5b21fb[_0xdcbc('0x13')]][_0xdcbc('0x16')]='timeout';agents[_0x5b21fb[_0xdcbc('0x13')]][_0xdcbc('0x1c')]=_0xdcbc('0x1d');agents[_0x5b21fb[_0xdcbc('0x13')]][_0xdcbc('0x1e')]=_0x5b21fb[_0xdcbc('0x1f')]?parseInt(_0x5b21fb[_0xdcbc('0x1f')])/0x3e8:0x0;agents[_0x5b21fb['destuniqueid']][_0xdcbc('0x20')]=0x0;unanswered[_0xdcbc('0x21')](_0x5b21fb[_0xdcbc('0x13')]);}}catch(_0x1c89f6){utils[_0xdcbc('0x19')](_0x1c89f6['stack']);}};exports[_0xdcbc('0x22')]=function(_0x25b732){try{_[_0xdcbc('0x23')](agents,function(_0x8852e5,_0x29b2b9){if(_0x8852e5[_0xdcbc('0x4')]==_0x25b732[_0xdcbc('0x4')]&&!_[_0xdcbc('0x24')](unanswered,_0x8852e5[_0xdcbc('0x13')])){_0x8852e5['agentringnoanswer']=!![];_0x8852e5[_0xdcbc('0x1b')]=utils[_0xdcbc('0x15')]();_0x8852e5[_0xdcbc('0x16')]=_0xdcbc('0x25');_0x8852e5[_0xdcbc('0x1c')]=_0xdcbc('0x25');_0x8852e5[_0xdcbc('0x1e')]=_0x25b732[_0xdcbc('0x1e')];_0x8852e5['talktime']=0x0;writeDB(_0x8852e5);}});}catch(_0x4a1ad2){utils[_0xdcbc('0x19')](_0x4a1ad2[_0xdcbc('0x26')]);}};exports[_0xdcbc('0x27')]=function(_0x4df13d){try{if(agents[_0x4df13d[_0xdcbc('0x13')]]){agents[_0x4df13d[_0xdcbc('0x13')]]['agentconnectAt']=utils[_0xdcbc('0x15')]();agents[_0x4df13d[_0xdcbc('0x13')]][_0xdcbc('0x9')]=_0x4df13d[_0xdcbc('0x9')];agents[_0x4df13d[_0xdcbc('0x13')]][_0xdcbc('0x18')]=_0x4df13d[_0xdcbc('0x18')];agents[_0x4df13d[_0xdcbc('0x13')]][_0xdcbc('0x1e')]=_0x4df13d[_0xdcbc('0x1f')];agents[_0x4df13d[_0xdcbc('0x13')]]['lastevent']=_0xdcbc('0x28');_[_0xdcbc('0x23')](agents,function(_0x22a21d,_0x3092bf){if(_0x22a21d[_0xdcbc('0x13')]!=_0x4df13d['destuniqueid']&&_0x22a21d[_0xdcbc('0x4')]==_0x4df13d[_0xdcbc('0x4')]){_0x22a21d['talktime']=0x0;_0x22a21d[_0xdcbc('0x1e')]=_0x4df13d[_0xdcbc('0x1f')];_0x22a21d[_0xdcbc('0x1a')]=!![];_0x22a21d['agentringnoanswerAt']=utils[_0xdcbc('0x15')]();_0x22a21d[_0xdcbc('0x16')]=_0xdcbc('0x29');_0x22a21d['reason']=_0xdcbc('0x29');_0x22a21d['answeredelsewheredestinationuniqueid']=_0x4df13d[_0xdcbc('0x13')];_0x22a21d[_0xdcbc('0x2a')]=_0x4df13d[_0xdcbc('0x7')];writeDB(_0x22a21d);}});}}catch(_0x562e10){utils[_0xdcbc('0x19')](_0x562e10['stack']);}};exports[_0xdcbc('0xd')]=function(_0x5ddfe0){try{if(!_[_0xdcbc('0x2b')](agents[_0x5ddfe0[_0xdcbc('0x13')]])){agents[_0x5ddfe0[_0xdcbc('0x13')]]['agentcomplete']=!![];agents[_0x5ddfe0[_0xdcbc('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x5ddfe0[_0xdcbc('0x13')]][_0xdcbc('0x20')]=utils[_0xdcbc('0x2c')](agents[_0x5ddfe0[_0xdcbc('0x13')]][_0xdcbc('0x2d')],agents[_0x5ddfe0[_0xdcbc('0x13')]]['agentconnectAt']);agents[_0x5ddfe0['destuniqueid']]['reason']=_0x5ddfe0[_0xdcbc('0x1c')];agents[_0x5ddfe0[_0xdcbc('0x13')]][_0xdcbc('0x16')]=_0xdcbc('0x2e');writeDB(agents[_0x5ddfe0[_0xdcbc('0x13')]]);}}catch(_0x205e8a){utils[_0xdcbc('0x19')](_0x205e8a['stack']);}};exports[_0xdcbc('0x2f')]=function(_0x38fed9){try{if(!_[_0xdcbc('0x2b')](agents[_0x38fed9[_0xdcbc('0x30')]])){agents[_0x38fed9['transfereruniqueid']][_0xdcbc('0x31')]=!![];agents[_0x38fed9[_0xdcbc('0x30')]][_0xdcbc('0x32')]=_0xdcbc('0x33');agents[_0x38fed9['transfereruniqueid']][_0xdcbc('0x34')]=_0x38fed9['extension'];agents[_0x38fed9[_0xdcbc('0x30')]]['transferuniqueid']=agents[_0x38fed9[_0xdcbc('0x30')]]['uniqueid'];}}catch(_0xafc9ae){utils[_0xdcbc('0x19')](_0xafc9ae['stack']);}};exports['attendedtransfer']=function(_0x44f1b7){try{if(_0x44f1b7[_0xdcbc('0x35')]==_0x44f1b7[_0xdcbc('0x36')]){if(!_['isNil'](agents[_0x44f1b7[_0xdcbc('0x37')]])){agents[_0x44f1b7['secondtransfereruniqueid']]['transfer']=!![];agents[_0x44f1b7[_0xdcbc('0x37')]]['transfertype']='ATTENDED';agents[_0x44f1b7[_0xdcbc('0x37')]]['transferexten']=_0x44f1b7['origtransfererexten'];agents[_0x44f1b7['secondtransfereruniqueid']][_0xdcbc('0x38')]=_0x44f1b7[_0xdcbc('0x35')];}if(_0x44f1b7[_0xdcbc('0x39')]&&agents[_0x44f1b7[_0xdcbc('0x39')]]){agents[_0x44f1b7[_0xdcbc('0x39')]][_0xdcbc('0x3a')]=0x1;transfers[_0x44f1b7[_0xdcbc('0x39')]]=_[_0xdcbc('0x3b')](agents[_0x44f1b7['transfereeuniqueid']]);transfers[_0x44f1b7[_0xdcbc('0x39')]]['calleridnum']=agents[_0x44f1b7['secondtransfereruniqueid']][_0xdcbc('0x8')];transfers[_0x44f1b7['transfereeuniqueid']][_0xdcbc('0x3c')]=agents[_0x44f1b7['secondtransfereruniqueid']][_0xdcbc('0x3c')];transfers[_0x44f1b7[_0xdcbc('0x39')]][_0xdcbc('0x14')]=utils[_0xdcbc('0x15')]();transfers[_0x44f1b7[_0xdcbc('0x39')]][_0xdcbc('0x3d')]=utils[_0xdcbc('0x15')]();transfers[_0x44f1b7[_0xdcbc('0x39')]][_0xdcbc('0x1e')]=0x0;transfers[_0x44f1b7[_0xdcbc('0x39')]][_0xdcbc('0x3a')]=0x2;}}else if(_0x44f1b7[_0xdcbc('0x37')]==_0x44f1b7['secondtransfererlinkedid']){if(!_[_0xdcbc('0x2b')](agents[_0x44f1b7[_0xdcbc('0x35')]])){agents[_0x44f1b7[_0xdcbc('0x35')]][_0xdcbc('0x31')]=!![];agents[_0x44f1b7[_0xdcbc('0x35')]][_0xdcbc('0x32')]=_0xdcbc('0x3e');agents[_0x44f1b7[_0xdcbc('0x35')]][_0xdcbc('0x34')]=_0x44f1b7[_0xdcbc('0x3f')];agents[_0x44f1b7[_0xdcbc('0x35')]][_0xdcbc('0x38')]=_0x44f1b7[_0xdcbc('0x37')];}if(_0x44f1b7[_0xdcbc('0x40')]&&agents[_0x44f1b7[_0xdcbc('0x40')]]){agents[_0x44f1b7['transfertargetuniqueid']][_0xdcbc('0x3a')]=0x1;transfers[_0x44f1b7['transfertargetuniqueid']]=_[_0xdcbc('0x3b')](agents[_0x44f1b7[_0xdcbc('0x40')]]);transfers[_0x44f1b7['transfertargetuniqueid']][_0xdcbc('0x8')]=agents[_0x44f1b7[_0xdcbc('0x35')]][_0xdcbc('0x8')];transfers[_0x44f1b7[_0xdcbc('0x40')]]['calleridname']=agents[_0x44f1b7['origtransfereruniqueid']][_0xdcbc('0x3c')];transfers[_0x44f1b7['transfertargetuniqueid']][_0xdcbc('0x14')]=utils[_0xdcbc('0x15')]();transfers[_0x44f1b7['transfertargetuniqueid']]['agentconnectAt']=utils[_0xdcbc('0x15')]();transfers[_0x44f1b7[_0xdcbc('0x40')]][_0xdcbc('0x1e')]=0x0;transfers[_0x44f1b7[_0xdcbc('0x40')]][_0xdcbc('0x3a')]=0x2;}}}catch(_0x28ac13){utils[_0xdcbc('0x19')](_0x28ac13[_0xdcbc('0x26')]);}};exports[_0xdcbc('0x41')]=function(_0x14eff4){try{if(agents[_0x14eff4['uniqueid']]&&agents[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x1c')]===_0xdcbc('0x1d')){if(_0x14eff4[_0xdcbc('0x42')]==='21'){agents[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x1c')]=_0xdcbc('0x43');agents[_0x14eff4[_0xdcbc('0x4')]]['lastevent']=_0xdcbc('0x43');}writeDB(agents[_0x14eff4[_0xdcbc('0x4')]]);var _0x11ee82=unanswered[_0xdcbc('0x44')](_0x14eff4[_0xdcbc('0x4')]);if(_0x11ee82>-0x1)unanswered[_0xdcbc('0x45')](_0x11ee82,0x1);}if(transfers[_0x14eff4[_0xdcbc('0x4')]]){transfers[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0xd')]=!![];transfers[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x2d')]=utils[_0xdcbc('0x15')]();transfers[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x20')]=utils[_0xdcbc('0x2c')](transfers[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x2d')],transfers[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x3d')]);transfers[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x1c')]=_0xdcbc('0x46');transfers[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x16')]=_0xdcbc('0x2e');writeDB(transfers[_0x14eff4[_0xdcbc('0x4')]],!![]);}if(agents[_0x14eff4[_0xdcbc('0x4')]]&&agents[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x3d')]){agents[_0x14eff4[_0xdcbc('0x4')]]['agentcomplete']=!![];agents[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x2d')]=utils[_0xdcbc('0x15')]();agents[_0x14eff4['uniqueid']][_0xdcbc('0x20')]=utils[_0xdcbc('0x2c')](agents[_0x14eff4['uniqueid']][_0xdcbc('0x2d')],agents[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x3d')]);agents[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x1c')]=agents[_0x14eff4[_0xdcbc('0x4')]][_0xdcbc('0x31')]?_0xdcbc('0x31'):_0xdcbc('0x46');agents[_0x14eff4['uniqueid']][_0xdcbc('0x16')]=_0xdcbc('0x2e');writeDB(agents[_0x14eff4['uniqueid']]);}}catch(_0x511d52){utils[_0xdcbc('0x19')](_0x511d52[_0xdcbc('0x26')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ae6e3d9..75138c6 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 _0xee64=['gotoif','lastapplication','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','channel','source','callerid','disposition','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','uniqueid','linkedid','OutgoingSpoolFailed','exten','context','now','error','stack','newstate','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','toNumber','hangup','calleridname','duration','diffTime','endtime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstartAt','musiconholdstop','mohtime','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmcs-queue','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','type','routeid','sipcallid','newexten','application','toLowerCase','appdata','cdr','split','lastIndexOf','includes'];(function(_0x356be3,_0x490e70){var _0x5110d9=function(_0x733db7){while(--_0x733db7){_0x356be3['push'](_0x356be3['shift']());}};_0x5110d9(++_0x490e70);}(_0xee64,0x1ca));var _0x4ee6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xee64[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4ee6('0x0'));var util=require(_0x4ee6('0x1'));var utils=require('./utils');var dispositions=[_0x4ee6('0x2'),_0x4ee6('0x3'),_0x4ee6('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x4ee6('0x2'),_0x4ee6('0x4'),_0x4ee6('0x5'),'FAILED',_0x4ee6('0x3'),'FAILED'];var channels={};function writeDB(_0x397641){utils[_0x4ee6('0x6')](util[_0x4ee6('0x7')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x397641['uniqueid'],_0x397641[_0x4ee6('0x8')],_0x397641['type'],_0x397641['accountcode'],_0x397641[_0x4ee6('0x9')],_0x397641['destination'],_0x397641[_0x4ee6('0xa')],_0x397641[_0x4ee6('0xb')]));if(_0x397641[_0x4ee6('0xc')]){utils[_0x4ee6('0xd')](_0x397641[_0x4ee6('0xc')])['then'](function(_0x1c0c26){if(_0x1c0c26){_0x397641[_0x4ee6('0xe')]=_0x1c0c26['id'];}utils[_0x4ee6('0xf')](_0x4ee6('0x10'),_0x397641);});}else{utils[_0x4ee6('0xf')](_0x4ee6('0x10'),_0x397641);}if(channels[_0x397641[_0x4ee6('0x11')]]){delete channels[_0x397641[_0x4ee6('0x11')]];}}exports['newchannel']=function(_0x1ac94f){try{if(_0x1ac94f[_0x4ee6('0x11')]==_0x1ac94f[_0x4ee6('0x12')]&&_0x1ac94f[_0x4ee6('0x8')]!=_0x4ee6('0x13')){channels[_0x1ac94f['uniqueid']]={'uniqueid':_0x1ac94f[_0x4ee6('0x11')],'accountcode':_0x1ac94f[_0x4ee6('0xc')],'source':_0x1ac94f['calleridnum'],'destination':_0x1ac94f[_0x4ee6('0x14')],'destinationcontext':_0x1ac94f[_0x4ee6('0x15')],'channel':_0x1ac94f[_0x4ee6('0x8')],'starttime':utils[_0x4ee6('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4ee6('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x1bde1f){utils[_0x4ee6('0x17')](_0x1bde1f[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x19')]=function(_0x127274){try{if(!_[_0x4ee6('0x1a')](channels[_0x127274[_0x4ee6('0x11')]])&&_0x127274[_0x4ee6('0x1b')]==0x6){if(_[_0x4ee6('0x1a')](channels[_0x127274['uniqueid']]['systemanswertime'])){channels[_0x127274[_0x4ee6('0x11')]][_0x4ee6('0x1c')]=utils[_0x4ee6('0x16')]();}}else if(!_[_0x4ee6('0x1a')](channels[_0x127274['linkedid']])&&_0x127274['channelstate']==0x6&&_0x127274[_0x4ee6('0x15')]!=_0x4ee6('0x1d')){channels[_0x127274[_0x4ee6('0x12')]]['accountcode']=_0x127274[_0x4ee6('0xc')];channels[_0x127274[_0x4ee6('0x12')]][_0x4ee6('0x1e')]=_0x127274[_0x4ee6('0x8')];if(_[_0x4ee6('0x1a')](channels[_0x127274[_0x4ee6('0x12')]][_0x4ee6('0x1f')])){channels[_0x127274['linkedid']]['answertime']=utils[_0x4ee6('0x16')]();}channels[_0x127274['linkedid']][_0x4ee6('0xb')]=dispositions[_[_0x4ee6('0x20')](_0x127274['channelstate'])]||'ANSWERED';}}catch(_0x29ac66){utils[_0x4ee6('0x17')](_0x29ac66[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x21')]=function(_0x37c982){try{if(!_[_0x4ee6('0x1a')](channels[_0x37c982[_0x4ee6('0x11')]])){if(_[_0x4ee6('0x1a')](channels[_0x37c982['uniqueid']][_0x4ee6('0xa')])){channels[_0x37c982['uniqueid']][_0x4ee6('0xa')]=_0x37c982[_0x4ee6('0x22')]+'\x20<'+_0x37c982['calleridnum']+'>';}channels[_0x37c982[_0x4ee6('0x11')]]['endtime']=utils['now']();channels[_0x37c982[_0x4ee6('0x11')]][_0x4ee6('0x23')]=utils[_0x4ee6('0x24')](channels[_0x37c982[_0x4ee6('0x11')]][_0x4ee6('0x25')],channels[_0x37c982[_0x4ee6('0x11')]]['starttime']);channels[_0x37c982[_0x4ee6('0x11')]][_0x4ee6('0x26')]=channels[_0x37c982['uniqueid']][_0x4ee6('0x1f')]?utils[_0x4ee6('0x24')](channels[_0x37c982['uniqueid']][_0x4ee6('0x25')],channels[_0x37c982[_0x4ee6('0x11')]][_0x4ee6('0x1f')]):0x0;writeDB(channels[_0x37c982[_0x4ee6('0x11')]]);}}catch(_0x56d778){utils[_0x4ee6('0x17')](_0x56d778[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x27')]=function(_0x23f7ec){try{if(!_['isNil'](channels[_0x23f7ec[_0x4ee6('0x28')]])){if(channels[_0x23f7ec['localtwolinkedid']][_0x4ee6('0x8')]==_0x23f7ec[_0x4ee6('0x29')]){channels[_0x23f7ec[_0x4ee6('0x28')]]['destinationchannel']=_0x23f7ec[_0x4ee6('0x2a')];channels[_0x23f7ec['localtwolinkedid']][_0x4ee6('0x2b')]=_0x4ee6('0x2c');}else if(channels[_0x23f7ec[_0x4ee6('0x28')]][_0x4ee6('0x8')]=_0x23f7ec[_0x4ee6('0x2d')]){channels[_0x23f7ec[_0x4ee6('0x28')]][_0x4ee6('0x1e')]=_0x23f7ec[_0x4ee6('0x2e')];channels[_0x23f7ec['localtwolinkedid']][_0x4ee6('0x2b')]=_0x4ee6('0x2c');}}}catch(_0x5efdf4){utils[_0x4ee6('0x17')](_0x5efdf4[_0x4ee6('0x18')]);}};exports['musiconholdstart']=function(_0x3c917d){try{if(!_['isNil'](channels[_0x3c917d[_0x4ee6('0x11')]])){channels[_0x3c917d[_0x4ee6('0x11')]][_0x4ee6('0x2f')]=utils['now']();}}catch(_0x1d122b){utils[_0x4ee6('0x17')](_0x1d122b[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x30')]=function(_0xaab418){try{if(!_[_0x4ee6('0x1a')](channels[_0xaab418[_0x4ee6('0x11')]])){if(!_[_0x4ee6('0x1a')](channels[_0xaab418[_0x4ee6('0x11')]][_0x4ee6('0x2f')])){channels[_0xaab418['uniqueid']][_0x4ee6('0x31')]+=utils[_0x4ee6('0x24')](utils[_0x4ee6('0x16')](),channels[_0xaab418[_0x4ee6('0x11')]][_0x4ee6('0x2f')]);delete channels[_0xaab418[_0x4ee6('0x11')]][_0x4ee6('0x2f')];}}}catch(_0x4ba316){utils[_0x4ee6('0x17')](_0x4ba316['stack']);}};exports['varset']=function(_0xb4cb01){try{if(!_[_0x4ee6('0x1a')](channels[_0xb4cb01[_0x4ee6('0x11')]])){if(!_['isNil'](_0xb4cb01[_0x4ee6('0x32')][_0x4ee6('0x33')])){channels[_0xb4cb01[_0x4ee6('0x11')]][_0x4ee6('0x9')]=_0xb4cb01[_0x4ee6('0x34')];}if(!_[_0x4ee6('0x1a')](_0xb4cb01[_0x4ee6('0x32')][_0x4ee6('0x35')])){channels[_0xb4cb01[_0x4ee6('0x11')]]['destination']=_0xb4cb01[_0x4ee6('0x34')];channels[_0xb4cb01[_0x4ee6('0x11')]][_0x4ee6('0xa')]='\x22'+_0xb4cb01['value']+_0x4ee6('0x36')+_0xb4cb01['value']+'>';}if(!_[_0x4ee6('0x1a')](_0xb4cb01[_0x4ee6('0x32')][_0x4ee6('0x37')])||!_[_0x4ee6('0x1a')](_0xb4cb01['variable']['xmd-callerid'])){channels[_0xb4cb01[_0x4ee6('0x11')]]['callerid']=_0xb4cb01[_0x4ee6('0x34')];}if(!_['isNil'](_0xb4cb01[_0x4ee6('0x32')]['xmd-queue'])||!_[_0x4ee6('0x1a')](_0xb4cb01[_0x4ee6('0x32')][_0x4ee6('0x38')])){channels[_0xb4cb01[_0x4ee6('0x11')]]['lastapplication']=_0x4ee6('0x39');channels[_0xb4cb01[_0x4ee6('0x11')]][_0x4ee6('0x3a')]=_0xb4cb01[_0x4ee6('0x34')];channels[_0xb4cb01['uniqueid']][_0x4ee6('0x3b')]=!![];}if(!_[_0x4ee6('0x1a')](_0xb4cb01['variable'][_0x4ee6('0x3c')])){channels[_0xb4cb01[_0x4ee6('0x11')]][_0x4ee6('0x3d')]=_0xb4cb01['value'];}if(!_['isNil'](_0xb4cb01[_0x4ee6('0x32')][_0x4ee6('0x3e')])){channels[_0xb4cb01['uniqueid']][_0x4ee6('0x3f')]=_0xb4cb01[_0x4ee6('0x34')];}if(!_[_0x4ee6('0x1a')](_0xb4cb01[_0x4ee6('0x32')]['outboundrouteid'])){channels[_0xb4cb01[_0x4ee6('0x11')]][_0x4ee6('0x40')]=_0xb4cb01['value'];}if(!_[_0x4ee6('0x1a')](_0xb4cb01[_0x4ee6('0x32')][_0x4ee6('0x41')])){channels[_0xb4cb01['uniqueid']][_0x4ee6('0x41')]=_0xb4cb01[_0x4ee6('0x34')];}}}catch(_0xc45a53){utils[_0x4ee6('0x17')](_0xc45a53[_0x4ee6('0x18')]);}};exports[_0x4ee6('0x42')]=function(_0x474f24){try{if(!_[_0x4ee6('0x1a')](channels[_0x474f24[_0x4ee6('0x11')]])){if(_0x474f24[_0x4ee6('0x43')][_0x4ee6('0x44')]()=='set'&&_['startsWith'](_0x474f24[_0x4ee6('0x45')]['toLowerCase'](),_0x4ee6('0x46'))){var _0x5bca81=_0x474f24['appdata'][_0x4ee6('0x47')]('=');var _0x39ef46=_0x5bca81[0x0]['substring'](_0x5bca81[0x0][_0x4ee6('0x48')]('(')+0x1,_0x5bca81[0x0]['lastIndexOf'](')'));var _0x31ad36=_0x5bca81[0x1];channels[_0x474f24[_0x4ee6('0x11')]][_0x39ef46]=_0x31ad36;}if(!_[_0x4ee6('0x49')]([_0x4ee6('0x21'),'noop','execif','set',_0x4ee6('0x4a')],_0x474f24['application'][_0x4ee6('0x44')]())){channels[_0x474f24['uniqueid']][_0x4ee6('0x4b')]=_0x474f24[_0x4ee6('0x43')];channels[_0x474f24[_0x4ee6('0x11')]][_0x4ee6('0x3a')]=_0x474f24[_0x4ee6('0x45')];}}}catch(_0x36ec3d){utils[_0x4ee6('0x17')](_0x36ec3d['stack']);}}; \ No newline at end of file +var _0xe0b7=['startsWith','appdata','cdr','substring','lastIndexOf','noop','execif','gotoif','toLowerCase','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','source','destination','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','context','now','stack','newstate','isNil','channelstate','systemanswertime','destinationchannel','answertime','error','hangup','callerid','calleridname','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-phone','value','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','application','set'];(function(_0x1f4782,_0x35317e){var _0x27a446=function(_0x2bcda1){while(--_0x2bcda1){_0x1f4782['push'](_0x1f4782['shift']());}};_0x27a446(++_0x35317e);}(_0xe0b7,0x103));var _0x7e0b=function(_0x2e21f1,_0x5d2fc9){_0x2e21f1=_0x2e21f1-0x0;var _0x27acc2=_0xe0b7[_0x2e21f1];return _0x27acc2;};'use strict';var _=require(_0x7e0b('0x0'));var util=require(_0x7e0b('0x1'));var utils=require(_0x7e0b('0x2'));var dispositions=['NO\x20ANSWER',_0x7e0b('0x3'),_0x7e0b('0x3'),_0x7e0b('0x4'),_0x7e0b('0x4'),_0x7e0b('0x4'),_0x7e0b('0x5'),_0x7e0b('0x6'),_0x7e0b('0x3'),_0x7e0b('0x3'),_0x7e0b('0x3')];var channels={};function writeDB(_0xc416bf){utils[_0x7e0b('0x7')](util[_0x7e0b('0x8')](_0x7e0b('0x9'),_0xc416bf['uniqueid'],_0xc416bf[_0x7e0b('0xa')],_0xc416bf[_0x7e0b('0xb')],_0xc416bf[_0x7e0b('0xc')],_0xc416bf[_0x7e0b('0xd')],_0xc416bf[_0x7e0b('0xe')],_0xc416bf['callerid'],_0xc416bf[_0x7e0b('0xf')]));if(_0xc416bf[_0x7e0b('0xc')]){utils[_0x7e0b('0x10')](_0xc416bf[_0x7e0b('0xc')])[_0x7e0b('0x11')](function(_0x2a2d3b){if(_0x2a2d3b){_0xc416bf[_0x7e0b('0x12')]=_0x2a2d3b['id'];}utils[_0x7e0b('0x13')](_0x7e0b('0x14'),_0xc416bf);});}else{utils[_0x7e0b('0x13')]('CreateVoiceCallReport',_0xc416bf);}if(channels[_0xc416bf[_0x7e0b('0x15')]]){delete channels[_0xc416bf[_0x7e0b('0x15')]];}}exports[_0x7e0b('0x16')]=function(_0xbf50b){try{if(_0xbf50b[_0x7e0b('0x15')]==_0xbf50b[_0x7e0b('0x17')]&&_0xbf50b['channel']!=_0x7e0b('0x18')){channels[_0xbf50b[_0x7e0b('0x15')]]={'uniqueid':_0xbf50b[_0x7e0b('0x15')],'accountcode':_0xbf50b[_0x7e0b('0xc')],'source':_0xbf50b[_0x7e0b('0x19')],'destination':_0xbf50b['exten'],'destinationcontext':_0xbf50b[_0x7e0b('0x1a')],'channel':_0xbf50b[_0x7e0b('0xa')],'starttime':utils[_0x7e0b('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7e0b('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x243eb0){utils['error'](_0x243eb0[_0x7e0b('0x1c')]);}};exports[_0x7e0b('0x1d')]=function(_0x4378dd){try{if(!_[_0x7e0b('0x1e')](channels[_0x4378dd[_0x7e0b('0x15')]])&&_0x4378dd[_0x7e0b('0x1f')]==0x6){if(_['isNil'](channels[_0x4378dd['uniqueid']]['systemanswertime'])){channels[_0x4378dd[_0x7e0b('0x15')]][_0x7e0b('0x20')]=utils['now']();}}else if(!_['isNil'](channels[_0x4378dd[_0x7e0b('0x17')]])&&_0x4378dd[_0x7e0b('0x1f')]==0x6&&_0x4378dd[_0x7e0b('0x1a')]!='transfer'){channels[_0x4378dd['linkedid']][_0x7e0b('0xc')]=_0x4378dd[_0x7e0b('0xc')];channels[_0x4378dd[_0x7e0b('0x17')]][_0x7e0b('0x21')]=_0x4378dd[_0x7e0b('0xa')];if(_[_0x7e0b('0x1e')](channels[_0x4378dd[_0x7e0b('0x17')]]['answertime'])){channels[_0x4378dd[_0x7e0b('0x17')]][_0x7e0b('0x22')]=utils[_0x7e0b('0x1b')]();}channels[_0x4378dd[_0x7e0b('0x17')]][_0x7e0b('0xf')]=dispositions[_['toNumber'](_0x4378dd['channelstate'])]||_0x7e0b('0x5');}}catch(_0x28feae){utils[_0x7e0b('0x23')](_0x28feae[_0x7e0b('0x1c')]);}};exports[_0x7e0b('0x24')]=function(_0x4b6f18){try{if(!_[_0x7e0b('0x1e')](channels[_0x4b6f18['uniqueid']])){if(_[_0x7e0b('0x1e')](channels[_0x4b6f18['uniqueid']]['callerid'])){channels[_0x4b6f18[_0x7e0b('0x15')]][_0x7e0b('0x25')]=_0x4b6f18[_0x7e0b('0x26')]+'\x20<'+_0x4b6f18['calleridnum']+'>';}channels[_0x4b6f18['uniqueid']][_0x7e0b('0x27')]=utils[_0x7e0b('0x1b')]();channels[_0x4b6f18[_0x7e0b('0x15')]][_0x7e0b('0x28')]=utils[_0x7e0b('0x29')](channels[_0x4b6f18[_0x7e0b('0x15')]][_0x7e0b('0x27')],channels[_0x4b6f18[_0x7e0b('0x15')]]['starttime']);channels[_0x4b6f18[_0x7e0b('0x15')]]['billableseconds']=channels[_0x4b6f18[_0x7e0b('0x15')]][_0x7e0b('0x22')]?utils[_0x7e0b('0x29')](channels[_0x4b6f18[_0x7e0b('0x15')]][_0x7e0b('0x27')],channels[_0x4b6f18[_0x7e0b('0x15')]][_0x7e0b('0x22')]):0x0;writeDB(channels[_0x4b6f18[_0x7e0b('0x15')]]);}}catch(_0x464193){utils[_0x7e0b('0x23')](_0x464193[_0x7e0b('0x1c')]);}};exports[_0x7e0b('0x2a')]=function(_0x4d8bc7){try{if(!_[_0x7e0b('0x1e')](channels[_0x4d8bc7[_0x7e0b('0x2b')]])){if(channels[_0x4d8bc7[_0x7e0b('0x2b')]][_0x7e0b('0xa')]==_0x4d8bc7[_0x7e0b('0x2c')]){channels[_0x4d8bc7[_0x7e0b('0x2b')]][_0x7e0b('0x21')]=_0x4d8bc7['secondtransfererchannel'];channels[_0x4d8bc7[_0x7e0b('0x2b')]][_0x7e0b('0x2d')]=_0x7e0b('0x2e');}else if(channels[_0x4d8bc7['localtwolinkedid']][_0x7e0b('0xa')]=_0x4d8bc7[_0x7e0b('0x2f')]){channels[_0x4d8bc7[_0x7e0b('0x2b')]][_0x7e0b('0x21')]=_0x4d8bc7[_0x7e0b('0x30')];channels[_0x4d8bc7['localtwolinkedid']][_0x7e0b('0x2d')]='_attended';}}}catch(_0x41f855){utils[_0x7e0b('0x23')](_0x41f855['stack']);}};exports[_0x7e0b('0x31')]=function(_0x820a28){try{if(!_[_0x7e0b('0x1e')](channels[_0x820a28['uniqueid']])){channels[_0x820a28['uniqueid']][_0x7e0b('0x32')]=utils[_0x7e0b('0x1b')]();}}catch(_0x443643){utils['error'](_0x443643['stack']);}};exports[_0x7e0b('0x33')]=function(_0x47291e){try{if(!_[_0x7e0b('0x1e')](channels[_0x47291e[_0x7e0b('0x15')]])){if(!_[_0x7e0b('0x1e')](channels[_0x47291e[_0x7e0b('0x15')]][_0x7e0b('0x32')])){channels[_0x47291e[_0x7e0b('0x15')]][_0x7e0b('0x34')]+=utils[_0x7e0b('0x29')](utils[_0x7e0b('0x1b')](),channels[_0x47291e[_0x7e0b('0x15')]][_0x7e0b('0x32')]);delete channels[_0x47291e['uniqueid']][_0x7e0b('0x32')];}}}catch(_0x51c0ca){utils[_0x7e0b('0x23')](_0x51c0ca['stack']);}};exports[_0x7e0b('0x35')]=function(_0x3cb02e){try{if(!_[_0x7e0b('0x1e')](channels[_0x3cb02e['uniqueid']])){if(!_['isNil'](_0x3cb02e[_0x7e0b('0x36')]['xmd-originatecalleridnum'])){channels[_0x3cb02e[_0x7e0b('0x15')]][_0x7e0b('0xd')]=_0x3cb02e['value'];}if(!_['isNil'](_0x3cb02e[_0x7e0b('0x36')][_0x7e0b('0x37')])){channels[_0x3cb02e['uniqueid']]['destination']=_0x3cb02e[_0x7e0b('0x38')];channels[_0x3cb02e[_0x7e0b('0x15')]][_0x7e0b('0x25')]='\x22'+_0x3cb02e[_0x7e0b('0x38')]+_0x7e0b('0x39')+_0x3cb02e[_0x7e0b('0x38')]+'>';}if(!_['isNil'](_0x3cb02e[_0x7e0b('0x36')][_0x7e0b('0x3a')])||!_[_0x7e0b('0x1e')](_0x3cb02e[_0x7e0b('0x36')]['xmd-callerid'])){channels[_0x3cb02e[_0x7e0b('0x15')]][_0x7e0b('0x25')]=_0x3cb02e['value'];}if(!_[_0x7e0b('0x1e')](_0x3cb02e['variable'][_0x7e0b('0x3b')])||!_[_0x7e0b('0x1e')](_0x3cb02e[_0x7e0b('0x36')][_0x7e0b('0x3c')])){channels[_0x3cb02e[_0x7e0b('0x15')]][_0x7e0b('0x3d')]=_0x7e0b('0x3e');channels[_0x3cb02e[_0x7e0b('0x15')]]['lastdata']=_0x3cb02e[_0x7e0b('0x38')];channels[_0x3cb02e['uniqueid']][_0x7e0b('0x3f')]=!![];}if(!_['isNil'](_0x3cb02e[_0x7e0b('0x36')][_0x7e0b('0x40')])){channels[_0x3cb02e[_0x7e0b('0x15')]][_0x7e0b('0x41')]=_0x3cb02e[_0x7e0b('0x38')];}if(!_[_0x7e0b('0x1e')](_0x3cb02e[_0x7e0b('0x36')][_0x7e0b('0x42')])){channels[_0x3cb02e[_0x7e0b('0x15')]][_0x7e0b('0xb')]=_0x3cb02e[_0x7e0b('0x38')];}if(!_[_0x7e0b('0x1e')](_0x3cb02e[_0x7e0b('0x36')][_0x7e0b('0x43')])){channels[_0x3cb02e[_0x7e0b('0x15')]][_0x7e0b('0x44')]=_0x3cb02e[_0x7e0b('0x38')];}if(!_['isNil'](_0x3cb02e[_0x7e0b('0x36')][_0x7e0b('0x45')])){channels[_0x3cb02e[_0x7e0b('0x15')]][_0x7e0b('0x45')]=_0x3cb02e[_0x7e0b('0x38')];}}}catch(_0x48e3fe){utils[_0x7e0b('0x23')](_0x48e3fe[_0x7e0b('0x1c')]);}};exports[_0x7e0b('0x46')]=function(_0x5a64dd){try{if(!_[_0x7e0b('0x1e')](channels[_0x5a64dd[_0x7e0b('0x15')]])){if(_0x5a64dd[_0x7e0b('0x47')]['toLowerCase']()==_0x7e0b('0x48')&&_[_0x7e0b('0x49')](_0x5a64dd[_0x7e0b('0x4a')]['toLowerCase'](),_0x7e0b('0x4b'))){var _0x268ad5=_0x5a64dd[_0x7e0b('0x4a')]['split']('=');var _0x82ba4b=_0x268ad5[0x0][_0x7e0b('0x4c')](_0x268ad5[0x0][_0x7e0b('0x4d')]('(')+0x1,_0x268ad5[0x0]['lastIndexOf'](')'));var _0x5cb987=_0x268ad5[0x1];channels[_0x5a64dd[_0x7e0b('0x15')]][_0x82ba4b]=_0x5cb987;}if(!_['includes']([_0x7e0b('0x24'),_0x7e0b('0x4e'),_0x7e0b('0x4f'),_0x7e0b('0x48'),_0x7e0b('0x50')],_0x5a64dd[_0x7e0b('0x47')][_0x7e0b('0x51')]())){channels[_0x5a64dd[_0x7e0b('0x15')]][_0x7e0b('0x3d')]=_0x5a64dd['application'];channels[_0x5a64dd[_0x7e0b('0x15')]][_0x7e0b('0x52')]=_0x5a64dd[_0x7e0b('0x4a')];}}}catch(_0x144272){utils['error'](_0x144272[_0x7e0b('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index e34995b..2bbbdd9 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 _0xdbf5=['SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','lodash','CONNECTED','shutdown','info'];(function(_0x23a8ba,_0xab5848){var _0x468389=function(_0x5ea5f4){while(--_0x5ea5f4){_0x23a8ba['push'](_0x23a8ba['shift']());}};_0x468389(++_0xab5848);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x20cf4f,_0xd08260){_0x20cf4f=_0x20cf4f-0x0;var _0x4c2905=_0xdbf5[_0x20cf4f];return _0x4c2905;};'use strict';var utils=require('./utils');var _=require(_0x5dbf('0x0'));exports['connect']=function(){utils['info'](_0x5dbf('0x1'));};exports[_0x5dbf('0x2')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x4'));};exports[_0x5dbf('0x5')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x6'));};exports[_0x5dbf('0x7')]=function(_0x3f8628){utils[_0x5dbf('0x7')](_0x3f8628);};exports[_0x5dbf('0x8')]=function(){utils[_0x5dbf('0x3')](_0x5dbf('0x9'));};exports['managerevent']=function(_0x134810){}; \ No newline at end of file +var _0x44e8=['info','CONNECTED','shutdown','fullybooted','FULLYBOOTED','error','close','CLOSE','./utils'];(function(_0x174582,_0x486a7a){var _0x1701f4=function(_0x19c96b){while(--_0x19c96b){_0x174582['push'](_0x174582['shift']());}};_0x1701f4(++_0x486a7a);}(_0x44e8,0xd7));var _0x844e=function(_0x4e7c78,_0x5d1099){_0x4e7c78=_0x4e7c78-0x0;var _0x591a09=_0x44e8[_0x4e7c78];return _0x591a09;};'use strict';var utils=require(_0x844e('0x0'));var _=require('lodash');exports['connect']=function(){utils[_0x844e('0x1')](_0x844e('0x2'));};exports[_0x844e('0x3')]=function(){utils[_0x844e('0x1')]('SHUTDOWN');};exports[_0x844e('0x4')]=function(){utils[_0x844e('0x1')](_0x844e('0x5'));};exports[_0x844e('0x6')]=function(_0x5c8f67){utils[_0x844e('0x6')](_0x5c8f67);};exports[_0x844e('0x7')]=function(){utils[_0x844e('0x1')](_0x844e('0x8'));};exports['managerevent']=function(_0x31ab50){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 7820955..92bfae5 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 _0x8357=['connectedlinenum','request','CreateVoiceDialReport','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','value','stack','dialbegin','assign','starttime','now','lastevent','called','dialend','dialstatus','ANSWER','answertime','connect','hangup','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel'];(function(_0x19813a,_0x1a689c){var _0x1c1ac1=function(_0x51caa3){while(--_0x51caa3){_0x19813a['push'](_0x19813a['shift']());}};_0x1c1ac1(++_0x1a689c);}(_0x8357,0x1e4));var _0x7835=function(_0x5db49b,_0x409070){_0x5db49b=_0x5db49b-0x0;var _0x29508d=_0x8357[_0x5db49b];return _0x29508d;};'use strict';var _=require(_0x7835('0x0'));var util=require(_0x7835('0x1'));var utils=require(_0x7835('0x2'));var dials={};function writeDB(_0x572843){utils[_0x7835('0x3')](util[_0x7835('0x4')](_0x7835('0x5'),_0x572843[_0x7835('0x6')],_0x572843[_0x7835('0x7')],_0x572843['dialstring'],_0x572843['calleridnum'],_0x572843[_0x7835('0x8')],_0x572843['dialstatus']));utils[_0x7835('0x9')](_0x7835('0xa'),_0x572843);delete dials[_0x572843['uniqueid']];}exports['newexten']=function(_0x11835c){try{if(_0x11835c['application'][_0x7835('0xb')]()==_0x7835('0xc')&&_[_0x7835('0xd')](_0x11835c[_0x7835('0xe')]['toLowerCase'](),_0x7835('0xf'))){var _0x4603f2=_0x11835c[_0x7835('0xe')][_0x7835('0x10')]('=');dials[_0x11835c[_0x7835('0x6')]]={'routeId':_0x4603f2[0x1]};}}catch(_0x291c0e){utils[_0x7835('0x11')](_0x291c0e['stack']);}};exports[_0x7835('0x12')]=function(_0x7a9441){try{if(!_[_0x7835('0x13')](_0x7a9441[_0x7835('0x14')][_0x7835('0x15')])){dials[_0x7a9441[_0x7835('0x6')]]={'routeId':_0x7a9441[_0x7835('0x16')]};}}catch(_0x448c30){utils[_0x7835('0x11')](_0x448c30[_0x7835('0x17')]);}};exports[_0x7835('0x18')]=function(_0x2cdd98){try{if(!_[_0x7835('0x13')](dials[_0x2cdd98[_0x7835('0x6')]])){dials[_0x2cdd98['uniqueid']]=_[_0x7835('0x19')](dials[_0x2cdd98[_0x7835('0x6')]],_0x2cdd98);dials[_0x2cdd98[_0x7835('0x6')]][_0x7835('0x1a')]=utils[_0x7835('0x1b')]();dials[_0x2cdd98['uniqueid']][_0x7835('0x1c')]=_0x7835('0x1d');}}catch(_0x231afa){utils[_0x7835('0x11')](_0x231afa['stack']);}};exports[_0x7835('0x1e')]=function(_0xeb12ed){try{if(!_[_0x7835('0x13')](dials[_0xeb12ed[_0x7835('0x6')]])){dials[_0xeb12ed[_0x7835('0x6')]][_0x7835('0x1f')]=_0xeb12ed['dialstatus'];if(_0xeb12ed[_0x7835('0x1f')]==_0x7835('0x20')){dials[_0xeb12ed[_0x7835('0x6')]]=_[_0x7835('0x19')](dials[_0xeb12ed[_0x7835('0x6')]],_0xeb12ed);dials[_0xeb12ed['uniqueid']][_0x7835('0x21')]=utils['now']();dials[_0xeb12ed[_0x7835('0x6')]]['lastevent']=_0x7835('0x22');}}}catch(_0x580656){utils['error'](_0x580656[_0x7835('0x17')]);}};exports[_0x7835('0x23')]=function(_0x193344){try{if(!_['isNil'](dials[_0x193344[_0x7835('0x6')]])){dials[_0x193344[_0x7835('0x6')]]=_['assign'](dials[_0x193344[_0x7835('0x6')]],{'endtime':utils[_0x7835('0x1b')](),'lastevent':'complete'});dials[_0x193344[_0x7835('0x6')]][_0x7835('0x24')]=utils[_0x7835('0x25')](dials[_0x193344[_0x7835('0x6')]][_0x7835('0x26')],dials[_0x193344[_0x7835('0x6')]][_0x7835('0x1a')]);dials[_0x193344[_0x7835('0x6')]][_0x7835('0x27')]=utils[_0x7835('0x25')](dials[_0x193344[_0x7835('0x6')]]['answertime']||dials[_0x193344[_0x7835('0x6')]][_0x7835('0x26')],dials[_0x193344[_0x7835('0x6')]][_0x7835('0x1a')]);dials[_0x193344[_0x7835('0x6')]][_0x7835('0x28')]=dials[_0x193344[_0x7835('0x6')]][_0x7835('0x21')]?utils[_0x7835('0x25')](dials[_0x193344[_0x7835('0x6')]][_0x7835('0x26')],dials[_0x193344['uniqueid']][_0x7835('0x21')]):0x0;writeDB(dials[_0x193344[_0x7835('0x6')]]);}}catch(_0x254b01){utils[_0x7835('0x11')](_0x254b01[_0x7835('0x17')]);}}; \ No newline at end of file +var _0x707b=['stack','varset','isNil','outboundrouteid','value','dialbegin','dialstatus','ANSWER','assign','answertime','now','lastevent','connect','complete','diffTime','starttime','holdtime','endtime','billableseconds','lodash','util','./utils','info','uniqueid','channel','dialstring','calleridnum','connectedlinenum','newexten','application','set','startsWith','split','error'];(function(_0x3a36e4,_0x420a62){var _0x3e3628=function(_0x528795){while(--_0x528795){_0x3a36e4['push'](_0x3a36e4['shift']());}};_0x3e3628(++_0x420a62);}(_0x707b,0xdf));var _0xb707=function(_0x18bd60,_0x288c37){_0x18bd60=_0x18bd60-0x0;var _0x286d92=_0x707b[_0x18bd60];return _0x286d92;};'use strict';var _=require(_0xb707('0x0'));var util=require(_0xb707('0x1'));var utils=require(_0xb707('0x2'));var dials={};function writeDB(_0x585d48){utils[_0xb707('0x3')](util['format']('DIAL|%s|%s|%s|%s|%s|%s',_0x585d48[_0xb707('0x4')],_0x585d48[_0xb707('0x5')],_0x585d48[_0xb707('0x6')],_0x585d48[_0xb707('0x7')],_0x585d48[_0xb707('0x8')],_0x585d48['dialstatus']));utils['request']('CreateVoiceDialReport',_0x585d48);delete dials[_0x585d48[_0xb707('0x4')]];}exports[_0xb707('0x9')]=function(_0x1cc2f2){try{if(_0x1cc2f2[_0xb707('0xa')]['toLowerCase']()==_0xb707('0xb')&&_[_0xb707('0xc')](_0x1cc2f2['appdata']['toLowerCase'](),'cdr(routeid)')){var _0x2bc886=_0x1cc2f2['appdata'][_0xb707('0xd')]('=');dials[_0x1cc2f2[_0xb707('0x4')]]={'routeId':_0x2bc886[0x1]};}}catch(_0x1ad477){utils[_0xb707('0xe')](_0x1ad477[_0xb707('0xf')]);}};exports[_0xb707('0x10')]=function(_0x338afc){try{if(!_[_0xb707('0x11')](_0x338afc['variable'][_0xb707('0x12')])){dials[_0x338afc[_0xb707('0x4')]]={'routeId':_0x338afc[_0xb707('0x13')]};}}catch(_0x5a4187){utils[_0xb707('0xe')](_0x5a4187['stack']);}};exports[_0xb707('0x14')]=function(_0x851d53){try{if(!_[_0xb707('0x11')](dials[_0x851d53[_0xb707('0x4')]])){dials[_0x851d53[_0xb707('0x4')]]=_['assign'](dials[_0x851d53[_0xb707('0x4')]],_0x851d53);dials[_0x851d53[_0xb707('0x4')]]['starttime']=utils['now']();dials[_0x851d53['uniqueid']]['lastevent']='called';}}catch(_0xa6944f){utils[_0xb707('0xe')](_0xa6944f[_0xb707('0xf')]);}};exports['dialend']=function(_0x3f6577){try{if(!_[_0xb707('0x11')](dials[_0x3f6577[_0xb707('0x4')]])){dials[_0x3f6577[_0xb707('0x4')]][_0xb707('0x15')]=_0x3f6577[_0xb707('0x15')];if(_0x3f6577[_0xb707('0x15')]==_0xb707('0x16')){dials[_0x3f6577['uniqueid']]=_[_0xb707('0x17')](dials[_0x3f6577['uniqueid']],_0x3f6577);dials[_0x3f6577[_0xb707('0x4')]][_0xb707('0x18')]=utils[_0xb707('0x19')]();dials[_0x3f6577[_0xb707('0x4')]][_0xb707('0x1a')]=_0xb707('0x1b');}}}catch(_0x529be7){utils[_0xb707('0xe')](_0x529be7[_0xb707('0xf')]);}};exports['hangup']=function(_0x2406a5){try{if(!_[_0xb707('0x11')](dials[_0x2406a5[_0xb707('0x4')]])){dials[_0x2406a5['uniqueid']]=_[_0xb707('0x17')](dials[_0x2406a5[_0xb707('0x4')]],{'endtime':utils[_0xb707('0x19')](),'lastevent':_0xb707('0x1c')});dials[_0x2406a5[_0xb707('0x4')]]['duration']=utils[_0xb707('0x1d')](dials[_0x2406a5[_0xb707('0x4')]]['endtime'],dials[_0x2406a5[_0xb707('0x4')]][_0xb707('0x1e')]);dials[_0x2406a5[_0xb707('0x4')]][_0xb707('0x1f')]=utils[_0xb707('0x1d')](dials[_0x2406a5[_0xb707('0x4')]][_0xb707('0x18')]||dials[_0x2406a5[_0xb707('0x4')]][_0xb707('0x20')],dials[_0x2406a5['uniqueid']]['starttime']);dials[_0x2406a5[_0xb707('0x4')]][_0xb707('0x21')]=dials[_0x2406a5[_0xb707('0x4')]]['answertime']?utils['diffTime'](dials[_0x2406a5['uniqueid']][_0xb707('0x20')],dials[_0x2406a5['uniqueid']][_0xb707('0x18')]):0x0;writeDB(dials[_0x2406a5[_0xb707('0x4')]]);}}catch(_0x458de2){utils['error'](_0x458de2[_0xb707('0xf')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0df1532..56cf66b 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 _0x9822=['fullybooted','error','close','managerevent','devicestatechange','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','port','password','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown'];(function(_0x36fab8,_0x5c78a7){var _0x8c4fa1=function(_0x54ab9e){while(--_0x54ab9e){_0x36fab8['push'](_0x36fab8['shift']());}};_0x8c4fa1(++_0x5c78a7);}(_0x9822,0xbf));var _0x2982=function(_0x39cac6,_0x20bc35){_0x39cac6=_0x39cac6-0x0;var _0xc016b0=_0x9822[_0x39cac6];return _0xc016b0;};var AsteriskManager=require(_0x2982('0x0'));var config=require(_0x2982('0x1'));var utils=require(_0x2982('0x2'));var ami=new AsteriskManager(config[_0x2982('0x3')][_0x2982('0x4')],config[_0x2982('0x3')]['ip'],config[_0x2982('0x3')]['username'],config['asterisk'][_0x2982('0x5')],!![]);ami['keepConnected']();if(config[_0x2982('0x6')]&&config[_0x2982('0x6')][_0x2982('0x7')]){utils[_0x2982('0x8')](_0x2982('0x9'));}else{var agents=require('./agents.controller');var calls=require(_0x2982('0xa'));var queues=require(_0x2982('0xb'));var recordings=require(_0x2982('0xc'));var members=require(_0x2982('0xd'));var dials=require(_0x2982('0xe'));var transfers=require(_0x2982('0xf'));var core=require(_0x2982('0x10'));ami['on'](_0x2982('0x11'),core['connect']);ami['on'](_0x2982('0x12'),core[_0x2982('0x12')]);ami['on'](_0x2982('0x13'),core[_0x2982('0x13')]);ami['on'](_0x2982('0x14'),core[_0x2982('0x14')]);ami['on'](_0x2982('0x15'),core[_0x2982('0x15')]);ami['on'](_0x2982('0x16'),core[_0x2982('0x16')]);ami['on'](_0x2982('0x17'),function(_0x5d1271){try{members['devicestatechange'](_0x5d1271);}catch(_0x489dec){utils['error'](_0x489dec);}});ami['on']('agentcalled',function(_0x469bbb){try{agents['agentcalled'](_0x469bbb);}catch(_0x4068d7){utils['error'](_0x4068d7);}});ami['on'](_0x2982('0x18'),function(_0x27cf54){try{agents[_0x2982('0x18')](_0x27cf54);}catch(_0x2d8ebf){utils[_0x2982('0x14')](_0x2d8ebf);}});ami['on'](_0x2982('0x19'),function(_0x597be5){try{agents['agentconnect'](_0x597be5);queues[_0x2982('0x19')](_0x597be5);}catch(_0x254f2f){utils[_0x2982('0x14')](_0x254f2f);}});ami['on'](_0x2982('0x1a'),function(_0x3a20f7){try{agents[_0x2982('0x1a')](_0x3a20f7);queues[_0x2982('0x1a')](_0x3a20f7);members[_0x2982('0x1a')](_0x3a20f7);}catch(_0x1fa93f){utils[_0x2982('0x14')](_0x1fa93f);}});ami['on'](_0x2982('0x1b'),function(_0x1bc5f9){try{agents[_0x2982('0x1b')](_0x1bc5f9);queues[_0x2982('0x1b')](_0x1bc5f9);}catch(_0x137a9d){utils['error'](_0x137a9d);}});ami['on'](_0x2982('0x1c'),function(_0x30417c){try{queues[_0x2982('0x1c')](_0x30417c);recordings['queuecallerjoin'](_0x30417c);}catch(_0x6f7826){utils[_0x2982('0x14')](_0x6f7826);}});ami['on'](_0x2982('0x1d'),function(_0x1ef2a1){try{queues[_0x2982('0x1d')](_0x1ef2a1);}catch(_0x124f4b){utils[_0x2982('0x14')](_0x124f4b);}});ami['on'](_0x2982('0x1e'),function(_0x1ee8e6){try{queues[_0x2982('0x1e')](_0x1ee8e6);calls[_0x2982('0x1e')](_0x1ee8e6);}catch(_0x17b315){utils[_0x2982('0x14')](_0x17b315);}});ami['on'](_0x2982('0x1f'),function(_0x2ef842){try{queues[_0x2982('0x1f')](_0x2ef842);calls[_0x2982('0x1f')](_0x2ef842);}catch(_0x3f40a4){utils['error'](_0x3f40a4);}});ami['on']('newstate',function(_0x2d3643){try{calls[_0x2982('0x20')](_0x2d3643);recordings[_0x2982('0x20')](_0x2d3643);}catch(_0x3ca886){utils[_0x2982('0x14')](_0x3ca886);}});ami['on']('hangup',function(_0x2550df){try{calls[_0x2982('0x21')](_0x2550df);recordings[_0x2982('0x21')](_0x2550df);dials[_0x2982('0x21')](_0x2550df);agents[_0x2982('0x21')](_0x2550df);queues[_0x2982('0x21')](_0x2550df);}catch(_0x1c97e6){utils['error'](_0x1c97e6);}});ami['on'](_0x2982('0x22'),function(_0x2bf38b){try{members[_0x2982('0x22')](_0x2bf38b);}catch(_0x2461eb){utils['error'](_0x2461eb);}});ami['on'](_0x2982('0x23'),function(_0x2d7728){try{queues['blindtransfer'](_0x2d7728);agents[_0x2982('0x23')](_0x2d7728);transfers[_0x2982('0x23')](_0x2d7728);}catch(_0x5c8a66){utils[_0x2982('0x14')](_0x5c8a66);}});ami['on'](_0x2982('0x24'),function(_0x3691f5){try{queues[_0x2982('0x24')](_0x3691f5);transfers[_0x2982('0x24')](_0x3691f5);agents['attendedtransfer'](_0x3691f5);calls[_0x2982('0x24')](_0x3691f5);}catch(_0x1213f5){utils[_0x2982('0x14')](_0x1213f5);}});ami['on'](_0x2982('0x25'),function(_0x330cc4){try{queues['varset'](_0x330cc4);recordings[_0x2982('0x25')](_0x330cc4);calls[_0x2982('0x25')](_0x330cc4);dials[_0x2982('0x25')](_0x330cc4);}catch(_0x3ea235){utils[_0x2982('0x14')](_0x3ea235);}});ami['on'](_0x2982('0x26'),function(_0x9fd8a5){try{calls[_0x2982('0x26')](_0x9fd8a5);recordings['newexten'](_0x9fd8a5);dials['newexten'](_0x9fd8a5);}catch(_0x5dae89){utils[_0x2982('0x14')](_0x5dae89);}});ami['on'](_0x2982('0x27'),function(_0x2256f8){try{calls[_0x2982('0x27')](_0x2256f8);recordings['newchannel'](_0x2256f8);}catch(_0x37c36b){utils['error'](_0x37c36b);}});ami['on']('dialbegin',function(_0x3f84f4){try{dials[_0x2982('0x28')](_0x3f84f4);}catch(_0x3196d8){utils['error'](_0x3196d8);}});ami['on']('dialend',function(_0xa1df3a){try{dials[_0x2982('0x29')](_0xa1df3a);}catch(_0x1778bd){utils[_0x2982('0x14')](_0x1778bd);}});} \ No newline at end of file +var _0x27b9=['connect','shutdown','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','../../config/environment','./utils','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller'];(function(_0x3af974,_0x491395){var _0x2fe26f=function(_0x28a182){while(--_0x28a182){_0x3af974['push'](_0x3af974['shift']());}};_0x2fe26f(++_0x491395);}(_0x27b9,0x160));var _0x927b=function(_0x1616c2,_0x28830f){_0x1616c2=_0x1616c2-0x0;var _0x46f751=_0x27b9[_0x1616c2];return _0x46f751;};var AsteriskManager=require('asterisk-manager');var config=require(_0x927b('0x0'));var utils=require(_0x927b('0x1'));var ami=new AsteriskManager(config[_0x927b('0x2')][_0x927b('0x3')],config[_0x927b('0x2')]['ip'],config[_0x927b('0x2')][_0x927b('0x4')],config[_0x927b('0x2')][_0x927b('0x5')],!![]);ami[_0x927b('0x6')]();if(config[_0x927b('0x7')]&&config[_0x927b('0x7')][_0x927b('0x8')]){utils[_0x927b('0x9')](_0x927b('0xa'));}else{var agents=require(_0x927b('0xb'));var calls=require(_0x927b('0xc'));var queues=require(_0x927b('0xd'));var recordings=require(_0x927b('0xe'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x927b('0xf'));var core=require(_0x927b('0x10'));ami['on'](_0x927b('0x11'),core['connect']);ami['on'](_0x927b('0x12'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x927b('0x13'),core['error']);ami['on'](_0x927b('0x14'),core['close']);ami['on']('managerevent',core[_0x927b('0x15')]);ami['on'](_0x927b('0x16'),function(_0x2981ad){try{members['devicestatechange'](_0x2981ad);}catch(_0x1c2faa){utils[_0x927b('0x13')](_0x1c2faa);}});ami['on'](_0x927b('0x17'),function(_0x9a6b6e){try{agents[_0x927b('0x17')](_0x9a6b6e);}catch(_0x1f2fe5){utils[_0x927b('0x13')](_0x1f2fe5);}});ami['on'](_0x927b('0x18'),function(_0x146750){try{agents[_0x927b('0x18')](_0x146750);}catch(_0x29d67){utils[_0x927b('0x13')](_0x29d67);}});ami['on'](_0x927b('0x19'),function(_0x241ac7){try{agents[_0x927b('0x19')](_0x241ac7);queues[_0x927b('0x19')](_0x241ac7);}catch(_0x26d2ab){utils['error'](_0x26d2ab);}});ami['on'](_0x927b('0x1a'),function(_0x207497){try{agents[_0x927b('0x1a')](_0x207497);queues[_0x927b('0x1a')](_0x207497);members[_0x927b('0x1a')](_0x207497);}catch(_0x447a43){utils[_0x927b('0x13')](_0x447a43);}});ami['on'](_0x927b('0x1b'),function(_0x391592){try{agents[_0x927b('0x1b')](_0x391592);queues[_0x927b('0x1b')](_0x391592);}catch(_0x344ca1){utils['error'](_0x344ca1);}});ami['on']('queuecallerjoin',function(_0x2bfb14){try{queues[_0x927b('0x1c')](_0x2bfb14);recordings[_0x927b('0x1c')](_0x2bfb14);}catch(_0x1bcfef){utils[_0x927b('0x13')](_0x1bcfef);}});ami['on']('queuecallerleave',function(_0x2069b8){try{queues[_0x927b('0x1d')](_0x2069b8);}catch(_0x45147f){utils[_0x927b('0x13')](_0x45147f);}});ami['on']('musiconholdstart',function(_0x8e4b46){try{queues['musiconholdstart'](_0x8e4b46);calls['musiconholdstart'](_0x8e4b46);}catch(_0x4ffa67){utils[_0x927b('0x13')](_0x4ffa67);}});ami['on'](_0x927b('0x1e'),function(_0x2e7cc3){try{queues[_0x927b('0x1e')](_0x2e7cc3);calls['musiconholdstop'](_0x2e7cc3);}catch(_0x660441){utils[_0x927b('0x13')](_0x660441);}});ami['on']('newstate',function(_0xbcbe1a){try{calls[_0x927b('0x1f')](_0xbcbe1a);recordings[_0x927b('0x1f')](_0xbcbe1a);}catch(_0x22b28c){utils['error'](_0x22b28c);}});ami['on'](_0x927b('0x20'),function(_0x5a6c48){try{calls[_0x927b('0x20')](_0x5a6c48);recordings[_0x927b('0x20')](_0x5a6c48);dials[_0x927b('0x20')](_0x5a6c48);agents[_0x927b('0x20')](_0x5a6c48);queues['hangup'](_0x5a6c48);}catch(_0x335d62){utils[_0x927b('0x13')](_0x335d62);}});ami['on'](_0x927b('0x21'),function(_0x1f9931){try{members[_0x927b('0x21')](_0x1f9931);}catch(_0x780aff){utils['error'](_0x780aff);}});ami['on'](_0x927b('0x22'),function(_0x39bb20){try{queues[_0x927b('0x22')](_0x39bb20);agents[_0x927b('0x22')](_0x39bb20);transfers[_0x927b('0x22')](_0x39bb20);}catch(_0x5a8c08){utils[_0x927b('0x13')](_0x5a8c08);}});ami['on'](_0x927b('0x23'),function(_0x182d7f){try{queues[_0x927b('0x23')](_0x182d7f);transfers[_0x927b('0x23')](_0x182d7f);agents['attendedtransfer'](_0x182d7f);calls[_0x927b('0x23')](_0x182d7f);}catch(_0x50545e){utils[_0x927b('0x13')](_0x50545e);}});ami['on']('varset',function(_0x2a6b5d){try{queues[_0x927b('0x24')](_0x2a6b5d);recordings[_0x927b('0x24')](_0x2a6b5d);calls['varset'](_0x2a6b5d);dials[_0x927b('0x24')](_0x2a6b5d);}catch(_0x55a4c2){utils[_0x927b('0x13')](_0x55a4c2);}});ami['on'](_0x927b('0x25'),function(_0x1d16d7){try{calls[_0x927b('0x25')](_0x1d16d7);recordings[_0x927b('0x25')](_0x1d16d7);dials['newexten'](_0x1d16d7);}catch(_0x14920d){utils['error'](_0x14920d);}});ami['on']('newchannel',function(_0x3fbea9){try{calls['newchannel'](_0x3fbea9);recordings[_0x927b('0x26')](_0x3fbea9);}catch(_0x22c9a2){utils[_0x927b('0x13')](_0x22c9a2);}});ami['on']('dialbegin',function(_0x3f27bf){try{dials[_0x927b('0x27')](_0x3f27bf);}catch(_0x175fa7){utils['error'](_0x175fa7);}});ami['on'](_0x927b('0x28'),function(_0x2d4078){try{dials['dialend'](_0x2d4078);}catch(_0x4f1fbd){utils['error'](_0x4f1fbd);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 55e19d6..625fa34 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 _0x98c0=['INUSE','device','voice','TALKING','now','agent','NOT_INUSE','duration','diffTime','exitAt','enterAt','agentcomplete','assign','cdr','isNil','data1','source','data3','destination','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','channel','data2','membername','type','interface','getUserByInterface','name','request','CreateMemberReport','split','then','internal','error','some','startsWith','devicestatechange'];(function(_0x24cc5b,_0x11383c){var _0x481cc3=function(_0x50f6b3){while(--_0x50f6b3){_0x24cc5b['push'](_0x24cc5b['shift']());}};_0x481cc3(++_0x11383c);}(_0x98c0,0x1ed));var _0x098c=function(_0x2ce6eb,_0x55f6d1){_0x2ce6eb=_0x2ce6eb-0x0;var _0x19a0af=_0x98c0[_0x2ce6eb];return _0x19a0af;};'use strict';var _=require(_0x098c('0x0'));var util=require('util');var utils=require(_0x098c('0x1'));var members={};var exclude=[_0x098c('0x2'),_0x098c('0x3')];function writeDB(_0xeeee7c){utils['info'](util[_0x098c('0x4')](_0x098c('0x5'),_0xeeee7c[_0x098c('0x6')],_0xeeee7c['interface'],_0xeeee7c[_0x098c('0x7')],_0xeeee7c[_0x098c('0x8')],_0xeeee7c[_0x098c('0x9')],_0xeeee7c[_0x098c('0xa')]));if(_0xeeee7c[_0x098c('0xb')]){utils[_0x098c('0xc')](_0xeeee7c[_0x098c('0xb')])['then'](function(_0x30c169){if(_0x30c169){_0xeeee7c[_0x098c('0x9')]=_0x30c169[_0x098c('0xd')];_0xeeee7c['internal']=_0x30c169['internal'];utils[_0x098c('0xe')](_0x098c('0xf'),_0xeeee7c);}else{utils['getUserByName'](_0xeeee7c[_0x098c('0xb')][_0x098c('0x10')]('/')[0x1])[_0x098c('0x11')](function(_0x38099e){if(_0x38099e){_0xeeee7c[_0x098c('0x9')]=_0x38099e[_0x098c('0xd')];_0xeeee7c[_0x098c('0x12')]=_0x38099e['internal'];utils[_0x098c('0xe')](_0x098c('0xf'),_0xeeee7c);}});}})['catch'](function(_0x489778){utils[_0x098c('0x13')](_0x489778);});}delete members[_0xeeee7c['interface']];}function startsWith(_0x5e5a91,_0x5bb142){return _[_0x098c('0x14')](_0x5e5a91,function(_0xcd8352){return _[_0x098c('0x15')](_0x5bb142,_0xcd8352);});}exports[_0x098c('0x16')]=function(_0x456312){switch(_0x456312['state']){case _0x098c('0x17'):case'BUSY':if(!startsWith(exclude,_0x456312[_0x098c('0x18')])){members[_0x456312[_0x098c('0x18')]]={'channel':_0x098c('0x19'),'interface':_0x456312[_0x098c('0x18')],'type':_0x098c('0x1a'),'enterAt':utils[_0x098c('0x1b')](),'role':_0x098c('0x1c')};}break;case _0x098c('0x1d'):if(!_['isNil'](members[_0x456312['device']])){members[_0x456312[_0x098c('0x18')]]['exitAt']=utils['now']();members[_0x456312[_0x098c('0x18')]][_0x098c('0x1e')]=utils[_0x098c('0x1f')](members[_0x456312[_0x098c('0x18')]][_0x098c('0x20')],members[_0x456312[_0x098c('0x18')]][_0x098c('0x21')]);if(members[_0x456312['device']][_0x098c('0x6')]){writeDB(members[_0x456312[_0x098c('0x18')]]);}}default:break;}};exports[_0x098c('0x22')]=function(_0x1bf923){if(!_['isNil'](members[_0x1bf923[_0x098c('0xb')]])){members[_0x1bf923[_0x098c('0xb')]]=_[_0x098c('0x23')](members[_0x1bf923['interface']],{'data4':_0x1bf923['queue'],'uniqueid':_0x1bf923[_0x098c('0x6')]});}};exports[_0x098c('0x24')]=function(_0x149594){if(_0x149594[_0x098c('0x7')]){var _0x1d712c=_0x149594[_0x098c('0x7')]['split']('-')[0x0];if(!_[_0x098c('0x25')](members[_0x1d712c])){members[_0x1d712c]=_['assign'](members[_0x1d712c],{'data1':members[_0x1d712c][_0x098c('0x26')]||_0x149594[_0x098c('0xa')],'data2':members[_0x1d712c][_0x098c('0x8')]||_0x149594[_0x098c('0x27')],'data3':members[_0x1d712c][_0x098c('0x28')]||_0x149594[_0x098c('0x29')],'uniqueid':members[_0x1d712c][_0x098c('0x6')]||_0x149594[_0x098c('0x6')]});if(members[_0x1d712c][_0x098c('0x20')]){writeDB(members[_0x1d712c]);}}}if(_0x149594['destinationchannel']){var _0x250d65=_0x149594[_0x098c('0x2a')][_0x098c('0x10')]('-')[0x0];if(!_[_0x098c('0x25')](members[_0x250d65])){members[_0x250d65]=_[_0x098c('0x23')](members[_0x250d65],{'data1':members[_0x250d65][_0x098c('0x26')]||_0x149594[_0x098c('0xa')],'data2':members[_0x250d65]['data2']||_0x149594[_0x098c('0x27')],'data3':members[_0x250d65][_0x098c('0x28')]||_0x149594[_0x098c('0x29')],'uniqueid':members[_0x250d65][_0x098c('0x6')]||_0x149594[_0x098c('0x6')]});if(members[_0x250d65][_0x098c('0x20')]){writeDB(members[_0x250d65]);}}}}; \ No newline at end of file +var _0x1b6a=['getUserByName','split','catch','error','some','startsWith','devicestatechange','device','voice','TALKING','now','exitAt','duration','enterAt','isNil','assign','queue','uniqueid','cdr','data1','data3','destination','destinationchannel','source','util','info','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport'];(function(_0x17d807,_0x22feee){var _0x17a6dc=function(_0x420b39){while(--_0x420b39){_0x17d807['push'](_0x17d807['shift']());}};_0x17a6dc(++_0x22feee);}(_0x1b6a,0x165));var _0xa1b6=function(_0x35c624,_0xc238b1){_0x35c624=_0x35c624-0x0;var _0x215e7b=_0x1b6a[_0x35c624];return _0x215e7b;};'use strict';var _=require('lodash');var util=require(_0xa1b6('0x0'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x5051f2){utils[_0xa1b6('0x1')](util['format']('MEMBER|%s|%s|%s|%s|%s|%s',_0x5051f2['uniqueid'],_0x5051f2['interface'],_0x5051f2[_0xa1b6('0x2')],_0x5051f2[_0xa1b6('0x3')],_0x5051f2[_0xa1b6('0x4')],_0x5051f2[_0xa1b6('0x5')]));if(_0x5051f2[_0xa1b6('0x6')]){utils[_0xa1b6('0x7')](_0x5051f2[_0xa1b6('0x6')])[_0xa1b6('0x8')](function(_0x45edde){if(_0x45edde){_0x5051f2[_0xa1b6('0x4')]=_0x45edde[_0xa1b6('0x9')];_0x5051f2[_0xa1b6('0xa')]=_0x45edde[_0xa1b6('0xa')];utils[_0xa1b6('0xb')](_0xa1b6('0xc'),_0x5051f2);}else{utils[_0xa1b6('0xd')](_0x5051f2[_0xa1b6('0x6')][_0xa1b6('0xe')]('/')[0x1])['then'](function(_0x4f834b){if(_0x4f834b){_0x5051f2['membername']=_0x4f834b[_0xa1b6('0x9')];_0x5051f2[_0xa1b6('0xa')]=_0x4f834b[_0xa1b6('0xa')];utils[_0xa1b6('0xb')](_0xa1b6('0xc'),_0x5051f2);}});}})[_0xa1b6('0xf')](function(_0x11e375){utils[_0xa1b6('0x10')](_0x11e375);});}delete members[_0x5051f2[_0xa1b6('0x6')]];}function startsWith(_0x5a1434,_0xb98990){return _[_0xa1b6('0x11')](_0x5a1434,function(_0x215cd6){return _[_0xa1b6('0x12')](_0xb98990,_0x215cd6);});}exports[_0xa1b6('0x13')]=function(_0x259553){switch(_0x259553['state']){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x259553[_0xa1b6('0x14')])){members[_0x259553[_0xa1b6('0x14')]]={'channel':_0xa1b6('0x15'),'interface':_0x259553[_0xa1b6('0x14')],'type':_0xa1b6('0x16'),'enterAt':utils[_0xa1b6('0x17')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x259553[_0xa1b6('0x14')]])){members[_0x259553[_0xa1b6('0x14')]][_0xa1b6('0x18')]=utils['now']();members[_0x259553[_0xa1b6('0x14')]][_0xa1b6('0x19')]=utils['diffTime'](members[_0x259553[_0xa1b6('0x14')]][_0xa1b6('0x18')],members[_0x259553[_0xa1b6('0x14')]][_0xa1b6('0x1a')]);if(members[_0x259553[_0xa1b6('0x14')]]['uniqueid']){writeDB(members[_0x259553[_0xa1b6('0x14')]]);}}default:break;}};exports['agentcomplete']=function(_0x31ab5e){if(!_[_0xa1b6('0x1b')](members[_0x31ab5e[_0xa1b6('0x6')]])){members[_0x31ab5e[_0xa1b6('0x6')]]=_[_0xa1b6('0x1c')](members[_0x31ab5e[_0xa1b6('0x6')]],{'data4':_0x31ab5e[_0xa1b6('0x1d')],'uniqueid':_0x31ab5e[_0xa1b6('0x1e')]});}};exports[_0xa1b6('0x1f')]=function(_0x5698c0){if(_0x5698c0['channel']){var _0x369098=_0x5698c0[_0xa1b6('0x2')]['split']('-')[0x0];if(!_[_0xa1b6('0x1b')](members[_0x369098])){members[_0x369098]=_[_0xa1b6('0x1c')](members[_0x369098],{'data1':members[_0x369098][_0xa1b6('0x20')]||_0x5698c0[_0xa1b6('0x5')],'data2':members[_0x369098][_0xa1b6('0x3')]||_0x5698c0['source'],'data3':members[_0x369098][_0xa1b6('0x21')]||_0x5698c0[_0xa1b6('0x22')],'uniqueid':members[_0x369098][_0xa1b6('0x1e')]||_0x5698c0[_0xa1b6('0x1e')]});if(members[_0x369098][_0xa1b6('0x18')]){writeDB(members[_0x369098]);}}}if(_0x5698c0[_0xa1b6('0x23')]){var _0x4a31cb=_0x5698c0[_0xa1b6('0x23')]['split']('-')[0x0];if(!_[_0xa1b6('0x1b')](members[_0x4a31cb])){members[_0x4a31cb]=_[_0xa1b6('0x1c')](members[_0x4a31cb],{'data1':members[_0x4a31cb][_0xa1b6('0x20')]||_0x5698c0[_0xa1b6('0x5')],'data2':members[_0x4a31cb]['data2']||_0x5698c0[_0xa1b6('0x24')],'data3':members[_0x4a31cb][_0xa1b6('0x21')]||_0x5698c0[_0xa1b6('0x22')],'uniqueid':members[_0x4a31cb][_0xa1b6('0x1e')]||_0x5698c0[_0xa1b6('0x1e')]});if(members[_0x4a31cb][_0xa1b6('0x18')]){writeDB(members[_0x4a31cb]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 50d5c2e..efda9e2 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 _0x3a22=['transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','ATTENDED','secondtransfererexten','transfertargetlinkedid','error','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','calleridnum','accountcode','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','varset','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','destaccountcode','lastAssignedTo','membername','agentcomplete','assigned','transfer','TRANSFER','COMPLETEDBY','reason','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER'];(function(_0x38b318,_0x1afc73){var _0x2e83f4=function(_0x43db0a){while(--_0x43db0a){_0x38b318['push'](_0x38b318['shift']());}};_0x2e83f4(++_0x1afc73);}(_0x3a22,0x1f3));var _0x23a2=function(_0x5eb047,_0xde1fe5){_0x5eb047=_0x5eb047-0x0;var _0x33e5d9=_0x3a22[_0x5eb047];return _0x33e5d9;};'use strict';var _=require(_0x23a2('0x0'));var util=require(_0x23a2('0x1'));var utils=require(_0x23a2('0x2'));var queues={};function writeDB(_0x25602e){utils[_0x23a2('0x3')](util['format'](_0x23a2('0x4'),_0x25602e[_0x23a2('0x5')],_0x25602e[_0x23a2('0x6')],_0x25602e['queue'],_0x25602e['lastAssignedTo'],_0x25602e[_0x23a2('0x7')],_0x25602e[_0x23a2('0x8')],_0x25602e['queuecallerexitreason']));if(_0x25602e[_0x23a2('0x9')]){utils['getVoiceQueueByName'](_0x25602e[_0x23a2('0x9')])[_0x23a2('0xa')](function(_0x1dd1da){if(_0x1dd1da){_0x25602e[_0x23a2('0xb')]=_0x1dd1da['type'];}utils[_0x23a2('0xc')](_0x23a2('0xd'),_0x25602e);});}else{utils[_0x23a2('0xc')](_0x23a2('0xd'),_0x25602e);}if(_0x25602e[_0x23a2('0xe')]){delete queues[_0x25602e[_0x23a2('0xe')]];}else{delete queues[_0x25602e['uniqueid']];}}exports[_0x23a2('0xf')]=function(_0x1ea947){queues[_0x1ea947[_0x23a2('0x5')]]=_[_0x23a2('0x10')](_0x1ea947,{'originalposition':_0x1ea947[_0x23a2('0x11')],'queuecallerjoinAt':utils[_0x23a2('0x12')](),'mohtime':0x0});};exports[_0x23a2('0x13')]=function(_0x258c33){if(!_['isNil'](queues[_0x258c33[_0x23a2('0x5')]])){if(queues[_0x258c33[_0x23a2('0x5')]][_0x23a2('0x14')]){if(!queues[_0x258c33[_0x23a2('0x5')]][_0x23a2('0x15')]&&!queues[_0x258c33[_0x23a2('0x5')]][_0x23a2('0x16')]){queues[_0x258c33[_0x23a2('0x5')]][_0x23a2('0x17')]=!![];queues[_0x258c33[_0x23a2('0x5')]][_0x23a2('0x18')]=utils[_0x23a2('0x12')]();queues[_0x258c33[_0x23a2('0x5')]][_0x23a2('0x19')]=_0x23a2('0x1a');}writeDB(queues[_0x258c33['uniqueid']]);}else{if(queues[_0x258c33['uniqueid']][_0x23a2('0xe')]){queues[queues[_0x258c33['uniqueid']]['transfereduniqueid']]=queues[_0x258c33[_0x23a2('0x5')]];queues[queues[_0x258c33[_0x23a2('0x5')]][_0x23a2('0xe')]][_0x23a2('0x1b')]=0x2;delete queues[_0x258c33[_0x23a2('0x5')]];}}}};exports[_0x23a2('0x1c')]=function(_0x2ccbc8){if(!_[_0x23a2('0x1d')](_0x2ccbc8[_0x23a2('0x1e')][_0x23a2('0x1f')])&&_0x2ccbc8[_0x23a2('0x20')][_0x23a2('0x21')]()!==_0x23a2('0x22')){if(!_['isNil'](queues[_0x2ccbc8['uniqueid']])){queues[_0x2ccbc8[_0x23a2('0x5')]]['queuecallerabandon']=![];queues[_0x2ccbc8[_0x23a2('0x5')]][_0x23a2('0x23')]=null;queues[_0x2ccbc8[_0x23a2('0x5')]][_0x23a2('0x16')]=!![];queues[_0x2ccbc8[_0x23a2('0x5')]][_0x23a2('0x24')]=utils[_0x23a2('0x12')]();queues[_0x2ccbc8[_0x23a2('0x5')]][_0x23a2('0x19')]=_0x2ccbc8[_0x23a2('0x20')][_0x23a2('0x21')]();writeDB(queues[_0x2ccbc8[_0x23a2('0x5')]]);}}else if(!_[_0x23a2('0x1d')](_0x2ccbc8[_0x23a2('0x1e')][_0x23a2('0x25')])){if(!_[_0x23a2('0x1d')](queues[_0x2ccbc8['uniqueid']])&&!queues[_0x2ccbc8[_0x23a2('0x5')]][_0x23a2('0x15')]){queues[_0x2ccbc8[_0x23a2('0x5')]]['queuecallerabandon']=![];queues[_0x2ccbc8[_0x23a2('0x5')]][_0x23a2('0x23')]=null;queues[_0x2ccbc8['uniqueid']][_0x23a2('0x16')]=!![];queues[_0x2ccbc8[_0x23a2('0x5')]][_0x23a2('0x24')]=utils[_0x23a2('0x12')]();queues[_0x2ccbc8[_0x23a2('0x5')]][_0x23a2('0x19')]=_0x23a2('0x26');}}};exports[_0x23a2('0x15')]=function(_0x51d07b){if(!_[_0x23a2('0x1d')](queues[_0x51d07b['uniqueid']])){queues[_0x51d07b[_0x23a2('0x5')]][_0x23a2('0x16')]=![];queues[_0x51d07b['uniqueid']][_0x23a2('0x24')]=null;queues[_0x51d07b[_0x23a2('0x5')]][_0x23a2('0x15')]=!![];queues[_0x51d07b[_0x23a2('0x5')]]['queuecallerabandonAt']=utils[_0x23a2('0x12')]();queues[_0x51d07b['uniqueid']][_0x23a2('0x19')]=_0x23a2('0x27');}};exports[_0x23a2('0x28')]=function(_0x5673ed){if(!_[_0x23a2('0x1d')](queues[_0x5673ed['uniqueid']])){queues[_0x5673ed[_0x23a2('0x5')]][_0x23a2('0x28')]=!![];queues[_0x5673ed[_0x23a2('0x5')]][_0x23a2('0x14')]=utils[_0x23a2('0x12')]();queues[_0x5673ed[_0x23a2('0x5')]][_0x23a2('0x29')]=utils[_0x23a2('0x2a')](queues[_0x5673ed['uniqueid']][_0x23a2('0x14')],queues[_0x5673ed[_0x23a2('0x5')]][_0x23a2('0x2b')]);queues[_0x5673ed[_0x23a2('0x5')]][_0x23a2('0x11')]=_0x5673ed['position'];queues[_0x5673ed['uniqueid']]['count']=_0x5673ed[_0x23a2('0x2c')];queues[_0x5673ed['uniqueid']]['connectedlinenum']=_0x5673ed[_0x23a2('0x2d')];queues[_0x5673ed[_0x23a2('0x5')]][_0x23a2('0x2e')]=_0x5673ed[_0x23a2('0x2e')];}};exports[_0x23a2('0x2f')]=function(_0x349ff3){if(!_[_0x23a2('0x1d')](queues[_0x349ff3[_0x23a2('0x5')]])){queues[_0x349ff3[_0x23a2('0x5')]][_0x23a2('0x15')]=![];queues[_0x349ff3[_0x23a2('0x5')]][_0x23a2('0x15')]=![];queues[_0x349ff3[_0x23a2('0x5')]]['queuecallerabandonAt']=null;queues[_0x349ff3[_0x23a2('0x5')]][_0x23a2('0x16')]=![];queues[_0x349ff3['uniqueid']][_0x23a2('0x19')]=null;queues[_0x349ff3['uniqueid']][_0x23a2('0x24')]=null;queues[_0x349ff3['uniqueid']]['assigned']=!![];queues[_0x349ff3[_0x23a2('0x5')]][_0x23a2('0x8')]=_0x349ff3[_0x23a2('0x30')];queues[_0x349ff3[_0x23a2('0x5')]][_0x23a2('0x31')]=_0x349ff3[_0x23a2('0x32')];}};exports[_0x23a2('0x33')]=function(_0x4b3931){if(!_['isNil'](queues[_0x4b3931['uniqueid']])){if(queues[_0x4b3931[_0x23a2('0x5')]][_0x23a2('0x14')]){queues[_0x4b3931[_0x23a2('0x5')]]['queuecallerabandon']=![];queues[_0x4b3931[_0x23a2('0x5')]][_0x23a2('0x15')]=![];queues[_0x4b3931[_0x23a2('0x5')]][_0x23a2('0x23')]=null;queues[_0x4b3931[_0x23a2('0x5')]][_0x23a2('0x16')]=![];queues[_0x4b3931['uniqueid']]['queuecallerexitAt']=null;queues[_0x4b3931['uniqueid']][_0x23a2('0x34')]=!![];queues[_0x4b3931[_0x23a2('0x5')]][_0x23a2('0x31')]=_0x4b3931[_0x23a2('0x32')];queues[_0x4b3931[_0x23a2('0x5')]]['queuecallercomplete']=!![];queues[_0x4b3931['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x4b3931['reason']==_0x23a2('0x35')){if(!queues[_0x4b3931[_0x23a2('0x5')]][_0x23a2('0x35')]){queues[_0x4b3931[_0x23a2('0x5')]][_0x23a2('0x19')]=_0x23a2('0x36');}}else{queues[_0x4b3931[_0x23a2('0x5')]][_0x23a2('0x19')]=_0x23a2('0x37')+_0x4b3931[_0x23a2('0x38')][_0x23a2('0x21')]();}writeDB(queues[_0x4b3931[_0x23a2('0x5')]]);}}};exports['blindtransfer']=function(_0x43154b){if(!_[_0x23a2('0x1d')](queues[_0x43154b[_0x23a2('0x39')]])){queues[_0x43154b[_0x23a2('0x39')]][_0x23a2('0x35')]=!![];queues[_0x43154b[_0x23a2('0x39')]][_0x23a2('0x3a')]='BLIND';queues[_0x43154b['transfereeuniqueid']][_0x23a2('0x3b')]=_0x43154b[_0x23a2('0x3c')];queues[_0x43154b['transfereeuniqueid']][_0x23a2('0x3d')]=_0x43154b['transfereeuniqueid'];queues[_0x43154b[_0x23a2('0x39')]][_0x23a2('0x19')]=_0x23a2('0x3e');}};exports['attendedtransfer']=function(_0x58d35f){try{if(_0x58d35f[_0x23a2('0x3f')]==_0x58d35f[_0x23a2('0x40')]){if(!_[_0x23a2('0x1d')](queues[_0x58d35f[_0x23a2('0x41')]])){queues[_0x58d35f[_0x23a2('0x41')]][_0x23a2('0x35')]=!![];queues[_0x58d35f['secondtransfererlinkedid']][_0x23a2('0x3a')]='ATTENDED';queues[_0x58d35f['secondtransfererlinkedid']]['transferexten']=_0x58d35f[_0x23a2('0x42')];queues[_0x58d35f[_0x23a2('0x41')]][_0x23a2('0x3d')]=_0x58d35f[_0x23a2('0x3f')];queues[_0x58d35f[_0x23a2('0x41')]][_0x23a2('0x19')]=_0x23a2('0x43');}if(!_[_0x23a2('0x1d')](queues[_0x58d35f[_0x23a2('0x40')]])){if(_0x58d35f['transfereelinkedid']&&queues[_0x58d35f['transfereelinkedid']]){queues[_0x58d35f[_0x23a2('0x44')]][_0x23a2('0x1b')]=0x1;queues[_0x58d35f[_0x23a2('0x39')]]=_[_0x23a2('0x45')](queues[_0x58d35f[_0x23a2('0x44')]]);queues[_0x58d35f[_0x23a2('0x39')]][_0x23a2('0xe')]=_0x58d35f[_0x23a2('0x46')];queues[_0x58d35f['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x58d35f[_0x23a2('0x39')]][_0x23a2('0x7')]=queues[_0x58d35f[_0x23a2('0x41')]]['calleridnum'];queues[_0x58d35f[_0x23a2('0x39')]][_0x23a2('0x47')]=queues[_0x58d35f[_0x23a2('0x41')]][_0x23a2('0x47')];queues[_0x58d35f[_0x23a2('0x39')]][_0x23a2('0x2b')]=utils[_0x23a2('0x12')]();queues[_0x58d35f[_0x23a2('0x39')]][_0x23a2('0x14')]=utils[_0x23a2('0x12')]();queues[_0x58d35f[_0x23a2('0x39')]][_0x23a2('0x29')]=0x0;queues[_0x58d35f['transfereeuniqueid']][_0x23a2('0x48')]=0x0;}else{queues[_0x58d35f[_0x23a2('0x40')]][_0x23a2('0xe')]=_0x58d35f[_0x23a2('0x41')];}}}else if(_0x58d35f[_0x23a2('0x49')]==_0x58d35f[_0x23a2('0x41')]){if(!_[_0x23a2('0x1d')](queues[_0x58d35f[_0x23a2('0x40')]])){queues[_0x58d35f[_0x23a2('0x40')]][_0x23a2('0x35')]=!![];queues[_0x58d35f[_0x23a2('0x40')]]['transfertype']=_0x23a2('0x4a');queues[_0x58d35f[_0x23a2('0x40')]]['transferexten']=_0x58d35f[_0x23a2('0x4b')];queues[_0x58d35f[_0x23a2('0x40')]][_0x23a2('0x3d')]=_0x58d35f[_0x23a2('0x49')];queues[_0x58d35f[_0x23a2('0x40')]][_0x23a2('0x19')]='ATTENDEDTRANSFER';}if(!_[_0x23a2('0x1d')](queues[_0x58d35f[_0x23a2('0x41')]])){if(_0x58d35f[_0x23a2('0x4c')]&&queues[_0x58d35f[_0x23a2('0x4c')]]){queues[_0x58d35f[_0x23a2('0x4c')]][_0x23a2('0x1b')]=0x1;queues[_0x58d35f[_0x23a2('0x46')]]=_['clone'](queues[_0x58d35f[_0x23a2('0x4c')]]);queues[_0x58d35f[_0x23a2('0x46')]][_0x23a2('0xe')]=_0x58d35f[_0x23a2('0x46')];queues[_0x58d35f[_0x23a2('0x46')]][_0x23a2('0x1b')]=0x2;queues[_0x58d35f[_0x23a2('0x46')]][_0x23a2('0x7')]=queues[_0x58d35f[_0x23a2('0x40')]][_0x23a2('0x7')];queues[_0x58d35f['transfertargetuniqueid']][_0x23a2('0x47')]=queues[_0x58d35f[_0x23a2('0x40')]][_0x23a2('0x47')];queues[_0x58d35f[_0x23a2('0x46')]][_0x23a2('0x2b')]=utils['now']();queues[_0x58d35f['transfertargetuniqueid']][_0x23a2('0x14')]=utils[_0x23a2('0x12')]();queues[_0x58d35f[_0x23a2('0x46')]]['holdtime']=0x0;queues[_0x58d35f['transfertargetuniqueid']][_0x23a2('0x48')]=0x0;}else{queues[_0x58d35f['secondtransfererlinkedid']][_0x23a2('0xe')]=_0x58d35f[_0x23a2('0x40')];}}}}catch(_0x44464d){utils[_0x23a2('0x4d')](_0x44464d['stack']);}};exports[_0x23a2('0x4e')]=function(_0x5bace5){if(!_[_0x23a2('0x1d')](queues[_0x5bace5['uniqueid']])){queues[_0x5bace5[_0x23a2('0x5')]][_0x23a2('0x4f')]=utils[_0x23a2('0x12')]();}};exports[_0x23a2('0x50')]=function(_0x10e0ac){if(!_[_0x23a2('0x1d')](queues[_0x10e0ac[_0x23a2('0x5')]])){if(!_['isNil'](queues[_0x10e0ac[_0x23a2('0x5')]][_0x23a2('0x4f')])){queues[_0x10e0ac['uniqueid']][_0x23a2('0x48')]+=utils['diffTime'](utils[_0x23a2('0x12')](),queues[_0x10e0ac[_0x23a2('0x5')]][_0x23a2('0x4f')]);delete queues[_0x10e0ac[_0x23a2('0x5')]]['musiconholdstartAt'];}}}; \ No newline at end of file +var _0xbf63=['queuecallerabandonAt','queuecallerexitAt','variable','EXITWITHKEY','queuecallerabandon','queuecallerexit','queuecallerleave','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','lastAssignedTo','membername','agentcomplete','reason','transfer','COMPLETEDBY','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','calleridname','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','holdtime','mohtime','musiconholdstop','musiconholdstartAt','lodash','util','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','queue','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','varset','value','toUpperCase','CONTINUE'];(function(_0x49f4c5,_0x2d618b){var _0x3ce8b9=function(_0x1856ba){while(--_0x1856ba){_0x49f4c5['push'](_0x49f4c5['shift']());}};_0x3ce8b9(++_0x2d618b);}(_0xbf63,0x150));var _0x3bf6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbf63[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x3bf6('0x0'));var util=require(_0x3bf6('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x157d13){utils[_0x3bf6('0x2')](util[_0x3bf6('0x3')](_0x3bf6('0x4'),_0x157d13['uniqueid'],_0x157d13['channel'],_0x157d13[_0x3bf6('0x5')],_0x157d13['lastAssignedTo'],_0x157d13[_0x3bf6('0x6')],_0x157d13['accountcode'],_0x157d13[_0x3bf6('0x7')]));if(_0x157d13['queue']){utils[_0x3bf6('0x8')](_0x157d13[_0x3bf6('0x5')])['then'](function(_0x5296a3){if(_0x5296a3){_0x157d13['type']=_0x5296a3[_0x3bf6('0x9')];}utils[_0x3bf6('0xa')](_0x3bf6('0xb'),_0x157d13);});}else{utils[_0x3bf6('0xa')](_0x3bf6('0xb'),_0x157d13);}if(_0x157d13[_0x3bf6('0xc')]){delete queues[_0x157d13[_0x3bf6('0xc')]];}else{delete queues[_0x157d13[_0x3bf6('0xd')]];}}exports[_0x3bf6('0xe')]=function(_0x5528f4){queues[_0x5528f4[_0x3bf6('0xd')]]=_[_0x3bf6('0xf')](_0x5528f4,{'originalposition':_0x5528f4[_0x3bf6('0x10')],'queuecallerjoinAt':utils[_0x3bf6('0x11')](),'mohtime':0x0});};exports[_0x3bf6('0x12')]=function(_0x2e2ec2){if(!_[_0x3bf6('0x13')](queues[_0x2e2ec2[_0x3bf6('0xd')]])){if(queues[_0x2e2ec2[_0x3bf6('0xd')]][_0x3bf6('0x14')]){if(!queues[_0x2e2ec2[_0x3bf6('0xd')]]['queuecallerabandon']&&!queues[_0x2e2ec2[_0x3bf6('0xd')]]['queuecallerexit']){queues[_0x2e2ec2[_0x3bf6('0xd')]][_0x3bf6('0x15')]=!![];queues[_0x2e2ec2[_0x3bf6('0xd')]][_0x3bf6('0x16')]=utils[_0x3bf6('0x11')]();queues[_0x2e2ec2['uniqueid']][_0x3bf6('0x7')]=_0x3bf6('0x17');}writeDB(queues[_0x2e2ec2[_0x3bf6('0xd')]]);}else{if(queues[_0x2e2ec2[_0x3bf6('0xd')]]['transfereduniqueid']){queues[queues[_0x2e2ec2[_0x3bf6('0xd')]][_0x3bf6('0xc')]]=queues[_0x2e2ec2[_0x3bf6('0xd')]];queues[queues[_0x2e2ec2['uniqueid']][_0x3bf6('0xc')]][_0x3bf6('0x18')]=0x2;delete queues[_0x2e2ec2[_0x3bf6('0xd')]];}}}};exports[_0x3bf6('0x19')]=function(_0x4866de){if(!_[_0x3bf6('0x13')](_0x4866de['variable']['queuestatus'])&&_0x4866de[_0x3bf6('0x1a')][_0x3bf6('0x1b')]()!==_0x3bf6('0x1c')){if(!_['isNil'](queues[_0x4866de[_0x3bf6('0xd')]])){queues[_0x4866de[_0x3bf6('0xd')]]['queuecallerabandon']=![];queues[_0x4866de[_0x3bf6('0xd')]][_0x3bf6('0x1d')]=null;queues[_0x4866de[_0x3bf6('0xd')]]['queuecallerexit']=!![];queues[_0x4866de['uniqueid']][_0x3bf6('0x1e')]=utils[_0x3bf6('0x11')]();queues[_0x4866de[_0x3bf6('0xd')]][_0x3bf6('0x7')]=_0x4866de[_0x3bf6('0x1a')][_0x3bf6('0x1b')]();writeDB(queues[_0x4866de[_0x3bf6('0xd')]]);}}else if(!_[_0x3bf6('0x13')](_0x4866de[_0x3bf6('0x1f')]['queueposition'])){if(!_[_0x3bf6('0x13')](queues[_0x4866de['uniqueid']])&&!queues[_0x4866de[_0x3bf6('0xd')]]['queuecallerabandon']){queues[_0x4866de[_0x3bf6('0xd')]]['queuecallerabandon']=![];queues[_0x4866de[_0x3bf6('0xd')]][_0x3bf6('0x1d')]=null;queues[_0x4866de[_0x3bf6('0xd')]]['queuecallerexit']=!![];queues[_0x4866de[_0x3bf6('0xd')]][_0x3bf6('0x1e')]=utils[_0x3bf6('0x11')]();queues[_0x4866de['uniqueid']][_0x3bf6('0x7')]=_0x3bf6('0x20');}}};exports[_0x3bf6('0x21')]=function(_0x37349d){if(!_[_0x3bf6('0x13')](queues[_0x37349d[_0x3bf6('0xd')]])){queues[_0x37349d[_0x3bf6('0xd')]][_0x3bf6('0x22')]=![];queues[_0x37349d[_0x3bf6('0xd')]][_0x3bf6('0x1e')]=null;queues[_0x37349d[_0x3bf6('0xd')]][_0x3bf6('0x21')]=!![];queues[_0x37349d[_0x3bf6('0xd')]][_0x3bf6('0x1d')]=utils[_0x3bf6('0x11')]();queues[_0x37349d[_0x3bf6('0xd')]][_0x3bf6('0x7')]='ABANDONED';}};exports[_0x3bf6('0x23')]=function(_0x1868ce){if(!_[_0x3bf6('0x13')](queues[_0x1868ce[_0x3bf6('0xd')]])){queues[_0x1868ce['uniqueid']][_0x3bf6('0x23')]=!![];queues[_0x1868ce['uniqueid']][_0x3bf6('0x14')]=utils[_0x3bf6('0x11')]();queues[_0x1868ce[_0x3bf6('0xd')]]['holdtime']=utils[_0x3bf6('0x24')](queues[_0x1868ce[_0x3bf6('0xd')]][_0x3bf6('0x14')],queues[_0x1868ce['uniqueid']][_0x3bf6('0x25')]);queues[_0x1868ce[_0x3bf6('0xd')]][_0x3bf6('0x10')]=_0x1868ce[_0x3bf6('0x10')];queues[_0x1868ce[_0x3bf6('0xd')]][_0x3bf6('0x26')]=_0x1868ce[_0x3bf6('0x26')];queues[_0x1868ce['uniqueid']]['connectedlinenum']=_0x1868ce['connectedlinenum'];queues[_0x1868ce[_0x3bf6('0xd')]]['connectedlinename']=_0x1868ce[_0x3bf6('0x27')];}};exports[_0x3bf6('0x28')]=function(_0x4c778e){if(!_['isNil'](queues[_0x4c778e[_0x3bf6('0xd')]])){queues[_0x4c778e['uniqueid']][_0x3bf6('0x21')]=![];queues[_0x4c778e['uniqueid']]['queuecallerabandon']=![];queues[_0x4c778e[_0x3bf6('0xd')]][_0x3bf6('0x1d')]=null;queues[_0x4c778e['uniqueid']]['queuecallerexit']=![];queues[_0x4c778e[_0x3bf6('0xd')]][_0x3bf6('0x7')]=null;queues[_0x4c778e[_0x3bf6('0xd')]][_0x3bf6('0x1e')]=null;queues[_0x4c778e['uniqueid']][_0x3bf6('0x29')]=!![];queues[_0x4c778e['uniqueid']][_0x3bf6('0x2a')]=_0x4c778e[_0x3bf6('0x2b')];queues[_0x4c778e['uniqueid']][_0x3bf6('0x2c')]=_0x4c778e[_0x3bf6('0x2d')];}};exports[_0x3bf6('0x2e')]=function(_0x47afa2){if(!_[_0x3bf6('0x13')](queues[_0x47afa2[_0x3bf6('0xd')]])){if(queues[_0x47afa2['uniqueid']][_0x3bf6('0x14')]){queues[_0x47afa2[_0x3bf6('0xd')]][_0x3bf6('0x21')]=![];queues[_0x47afa2[_0x3bf6('0xd')]][_0x3bf6('0x21')]=![];queues[_0x47afa2[_0x3bf6('0xd')]]['queuecallerabandonAt']=null;queues[_0x47afa2['uniqueid']][_0x3bf6('0x22')]=![];queues[_0x47afa2[_0x3bf6('0xd')]][_0x3bf6('0x1e')]=null;queues[_0x47afa2[_0x3bf6('0xd')]][_0x3bf6('0x29')]=!![];queues[_0x47afa2['uniqueid']][_0x3bf6('0x2c')]=_0x47afa2['membername'];queues[_0x47afa2[_0x3bf6('0xd')]]['queuecallercomplete']=!![];queues[_0x47afa2[_0x3bf6('0xd')]]['queuecallercompleteAt']=utils[_0x3bf6('0x11')]();if(_0x47afa2[_0x3bf6('0x2f')]=='transfer'){if(!queues[_0x47afa2['uniqueid']][_0x3bf6('0x30')]){queues[_0x47afa2[_0x3bf6('0xd')]][_0x3bf6('0x7')]='TRANSFER';}}else{queues[_0x47afa2[_0x3bf6('0xd')]][_0x3bf6('0x7')]=_0x3bf6('0x31')+_0x47afa2[_0x3bf6('0x2f')][_0x3bf6('0x1b')]();}writeDB(queues[_0x47afa2[_0x3bf6('0xd')]]);}}};exports['blindtransfer']=function(_0x953ba6){if(!_[_0x3bf6('0x13')](queues[_0x953ba6[_0x3bf6('0x32')]])){queues[_0x953ba6[_0x3bf6('0x32')]]['transfer']=!![];queues[_0x953ba6['transfereeuniqueid']][_0x3bf6('0x33')]=_0x3bf6('0x34');queues[_0x953ba6[_0x3bf6('0x32')]][_0x3bf6('0x35')]=_0x953ba6['extension'];queues[_0x953ba6[_0x3bf6('0x32')]][_0x3bf6('0x36')]=_0x953ba6['transfereeuniqueid'];queues[_0x953ba6['transfereeuniqueid']][_0x3bf6('0x7')]='BLINDTRANSFER';}};exports[_0x3bf6('0x37')]=function(_0x24f3c5){try{if(_0x24f3c5[_0x3bf6('0x38')]==_0x24f3c5['origtransfererlinkedid']){if(!_['isNil'](queues[_0x24f3c5['secondtransfererlinkedid']])){queues[_0x24f3c5[_0x3bf6('0x39')]][_0x3bf6('0x30')]=!![];queues[_0x24f3c5[_0x3bf6('0x39')]][_0x3bf6('0x33')]=_0x3bf6('0x3a');queues[_0x24f3c5['secondtransfererlinkedid']]['transferexten']=_0x24f3c5[_0x3bf6('0x3b')];queues[_0x24f3c5[_0x3bf6('0x39')]][_0x3bf6('0x36')]=_0x24f3c5['origtransfereruniqueid'];queues[_0x24f3c5[_0x3bf6('0x39')]][_0x3bf6('0x7')]=_0x3bf6('0x3c');}if(!_[_0x3bf6('0x13')](queues[_0x24f3c5[_0x3bf6('0x3d')]])){if(_0x24f3c5['transfereelinkedid']&&queues[_0x24f3c5[_0x3bf6('0x3e')]]){queues[_0x24f3c5[_0x3bf6('0x3e')]][_0x3bf6('0x18')]=0x1;queues[_0x24f3c5[_0x3bf6('0x32')]]=_[_0x3bf6('0x3f')](queues[_0x24f3c5[_0x3bf6('0x3e')]]);queues[_0x24f3c5[_0x3bf6('0x32')]][_0x3bf6('0xc')]=_0x24f3c5['transfertargetuniqueid'];queues[_0x24f3c5[_0x3bf6('0x32')]][_0x3bf6('0x18')]=0x2;queues[_0x24f3c5[_0x3bf6('0x32')]][_0x3bf6('0x6')]=queues[_0x24f3c5[_0x3bf6('0x39')]][_0x3bf6('0x6')];queues[_0x24f3c5[_0x3bf6('0x32')]][_0x3bf6('0x40')]=queues[_0x24f3c5[_0x3bf6('0x39')]][_0x3bf6('0x40')];queues[_0x24f3c5[_0x3bf6('0x32')]][_0x3bf6('0x25')]=utils[_0x3bf6('0x11')]();queues[_0x24f3c5[_0x3bf6('0x32')]][_0x3bf6('0x14')]=utils['now']();queues[_0x24f3c5[_0x3bf6('0x32')]]['holdtime']=0x0;queues[_0x24f3c5['transfereeuniqueid']]['mohtime']=0x0;}else{queues[_0x24f3c5[_0x3bf6('0x3d')]]['transfereduniqueid']=_0x24f3c5[_0x3bf6('0x39')];}}}else if(_0x24f3c5['secondtransfereruniqueid']==_0x24f3c5[_0x3bf6('0x39')]){if(!_[_0x3bf6('0x13')](queues[_0x24f3c5[_0x3bf6('0x3d')]])){queues[_0x24f3c5[_0x3bf6('0x3d')]][_0x3bf6('0x30')]=!![];queues[_0x24f3c5['origtransfererlinkedid']][_0x3bf6('0x33')]=_0x3bf6('0x3a');queues[_0x24f3c5[_0x3bf6('0x3d')]]['transferexten']=_0x24f3c5[_0x3bf6('0x41')];queues[_0x24f3c5['origtransfererlinkedid']]['transferuniqueid']=_0x24f3c5[_0x3bf6('0x42')];queues[_0x24f3c5[_0x3bf6('0x3d')]][_0x3bf6('0x7')]=_0x3bf6('0x3c');}if(!_['isNil'](queues[_0x24f3c5[_0x3bf6('0x39')]])){if(_0x24f3c5[_0x3bf6('0x43')]&&queues[_0x24f3c5[_0x3bf6('0x43')]]){queues[_0x24f3c5['transfertargetlinkedid']][_0x3bf6('0x18')]=0x1;queues[_0x24f3c5[_0x3bf6('0x44')]]=_[_0x3bf6('0x3f')](queues[_0x24f3c5['transfertargetlinkedid']]);queues[_0x24f3c5[_0x3bf6('0x44')]][_0x3bf6('0xc')]=_0x24f3c5[_0x3bf6('0x44')];queues[_0x24f3c5[_0x3bf6('0x44')]][_0x3bf6('0x18')]=0x2;queues[_0x24f3c5[_0x3bf6('0x44')]][_0x3bf6('0x6')]=queues[_0x24f3c5[_0x3bf6('0x3d')]]['calleridnum'];queues[_0x24f3c5[_0x3bf6('0x44')]]['calleridname']=queues[_0x24f3c5[_0x3bf6('0x3d')]][_0x3bf6('0x40')];queues[_0x24f3c5[_0x3bf6('0x44')]]['queuecallerjoinAt']=utils[_0x3bf6('0x11')]();queues[_0x24f3c5[_0x3bf6('0x44')]][_0x3bf6('0x14')]=utils['now']();queues[_0x24f3c5['transfertargetuniqueid']][_0x3bf6('0x45')]=0x0;queues[_0x24f3c5[_0x3bf6('0x44')]][_0x3bf6('0x46')]=0x0;}else{queues[_0x24f3c5[_0x3bf6('0x39')]][_0x3bf6('0xc')]=_0x24f3c5['origtransfererlinkedid'];}}}}catch(_0x5e1360){utils['error'](_0x5e1360['stack']);}};exports['musiconholdstart']=function(_0x234737){if(!_[_0x3bf6('0x13')](queues[_0x234737[_0x3bf6('0xd')]])){queues[_0x234737['uniqueid']]['musiconholdstartAt']=utils[_0x3bf6('0x11')]();}};exports[_0x3bf6('0x47')]=function(_0x4e28ac){if(!_[_0x3bf6('0x13')](queues[_0x4e28ac[_0x3bf6('0xd')]])){if(!_[_0x3bf6('0x13')](queues[_0x4e28ac[_0x3bf6('0xd')]][_0x3bf6('0x48')])){queues[_0x4e28ac[_0x3bf6('0xd')]][_0x3bf6('0x46')]+=utils[_0x3bf6('0x24')](utils[_0x3bf6('0x11')](),queues[_0x4e28ac[_0x3bf6('0xd')]]['musiconholdstartAt']);delete queues[_0x4e28ac[_0x3bf6('0xd')]][_0x3bf6('0x48')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 5b10ddd..ab0fa1f 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 _0xa9e0=['application','set','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','uniqueid','accountcode','exten','context','channel','isNil','channelstate','linkedid','transfer','error','varset','variable','endsWith','.wav49','value','replace','.WAV','find','monitors','stack','hangup','calleridnum','calleridname','connectedlinename','outbound','connectedlinenum','forEach','clone','newexten'];(function(_0x34eb31,_0x8f0f70){var _0x254994=function(_0xbec9a3){while(--_0xbec9a3){_0x34eb31['push'](_0x34eb31['shift']());}};_0x254994(++_0x8f0f70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var _=require(_0x0a9e('0x0'));var utils=require(_0x0a9e('0x1'));var recordings={};function writeDB(_0x29929c){utils['debug'](_0x29929c);if(_0x29929c['accountcode']){utils[_0x0a9e('0x2')](_0x29929c['accountcode'])[_0x0a9e('0x3')](function(_0x432180){if(_0x432180){_0x29929c[_0x0a9e('0x4')]=_0x432180[_0x0a9e('0x5')];_0x29929c[_0x0a9e('0x6')]=_0x432180['id'];}utils['request'](_0x0a9e('0x7'),_0x29929c);});}else{utils[_0x0a9e('0x8')](_0x0a9e('0x7'),_0x29929c);}}exports['newchannel']=function(_0x503809){try{if(_0x503809[_0x0a9e('0x9')]==_0x503809['linkedid']){recordings[_0x503809['uniqueid']]={'uniqueid':_0x503809[_0x0a9e('0x9')],'accountcode':_0x503809[_0x0a9e('0xa')],'exten':_0x503809[_0x0a9e('0xb')],'context':_0x503809[_0x0a9e('0xc')],'channel':_0x503809[_0x0a9e('0xd')],'monitors':[]};}}catch(_0xbd1168){utils['error'](_0xbd1168['stack']);}};exports['newstate']=function(_0x4cfe67){try{if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x9')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6){}else if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x10')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6&&_0x4cfe67['context']!=_0x0a9e('0x11')){recordings[_0x4cfe67[_0x0a9e('0x10')]][_0x0a9e('0xa')]=_0x4cfe67[_0x0a9e('0xa')];}}catch(_0x44dcfd){utils[_0x0a9e('0x12')](_0x44dcfd['stack']);}};exports[_0x0a9e('0x13')]=function(_0x5d0880){try{if(!_[_0x0a9e('0xe')](_0x5d0880['variable'])&&!_[_0x0a9e('0xe')](_0x5d0880[_0x0a9e('0x14')]['mixmonitor_filename'])){if(_[_0x0a9e('0x15')](_0x5d0880['value'],_0x0a9e('0x16'))){_0x5d0880[_0x0a9e('0x17')]=_0x5d0880[_0x0a9e('0x17')][_0x0a9e('0x18')](_0x0a9e('0x16'),_0x0a9e('0x19'));}if(recordings[_0x5d0880[_0x0a9e('0x10')]]){var _0x20559e=_[_0x0a9e('0x1a')](recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')],{'value':_0x5d0880[_0x0a9e('0x17')]});if(_['isNil'](_0x20559e)){recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')]['push']({'value':_0x5d0880[_0x0a9e('0x17')]});}}}}catch(_0x5a09ef){utils['error'](_0x5a09ef[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x1d')]=function(_0x38e7c4){try{if(!_[_0x0a9e('0xe')](recordings[_0x38e7c4['uniqueid']])){recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1e')]=_0x38e7c4[_0x0a9e('0x1e')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1f')]=_0x38e7c4[_0x0a9e('0x1f')];recordings[_0x38e7c4[_0x0a9e('0x9')]]['connectedlinenum']=_0x38e7c4['connectedlinenum'];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]=_0x38e7c4[_0x0a9e('0x20')];if(recordings[_0x38e7c4[_0x0a9e('0x9')]]['type']==_0x0a9e('0x21')&&recordings[_0x38e7c4['uniqueid']][_0x0a9e('0xa')]){recordings[_0x38e7c4['uniqueid']][_0x0a9e('0x22')]=recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0xa')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]='';}recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1b')][_0x0a9e('0x23')](_0x5a101a=>{var _0x3652a7=_[_0x0a9e('0x24')](recordings[_0x38e7c4[_0x0a9e('0x9')]]);_0x3652a7[_0x0a9e('0x17')]=_0x5a101a['value'];writeDB(_0x3652a7);});delete recordings[_0x38e7c4[_0x0a9e('0x9')]];}}catch(_0x40e7a3){utils[_0x0a9e('0x12')](_0x40e7a3[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x25')]=function(_0x563b45){try{if(!_[_0x0a9e('0xe')](recordings[_0x563b45[_0x0a9e('0x9')]])){if(_0x563b45[_0x0a9e('0x26')]['toLowerCase']()==_0x0a9e('0x27')&&_['startsWith'](_0x563b45[_0x0a9e('0x28')][_0x0a9e('0x29')](),_0x0a9e('0x2a'))){var _0x33bdb7=_0x563b45[_0x0a9e('0x28')]['split']('=');var _0x66c1d2=_0x33bdb7[0x0][_0x0a9e('0x2b')](_0x33bdb7[0x0][_0x0a9e('0x2c')]('(')+0x1,_0x33bdb7[0x0][_0x0a9e('0x2c')](')'));var _0x2b45ea=_0x33bdb7[0x1];recordings[_0x563b45[_0x0a9e('0x9')]][_0x66c1d2]=_0x2b45ea;}}}catch(_0x332d35){utils[_0x0a9e('0x12')](_0x332d35['stack']);}};exports[_0x0a9e('0x2d')]=function(_0x5e7238){try{if(!_[_0x0a9e('0xe')](recordings[_0x5e7238[_0x0a9e('0x9')]])){recordings[_0x5e7238[_0x0a9e('0x9')]][_0x0a9e('0x2e')]=_0x5e7238['queue'];}}catch(_0x191e91){utils[_0x0a9e('0x12')](_0x191e91[_0x0a9e('0x1c')]);}}; \ No newline at end of file +var _0xa9e0=['application','set','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','uniqueid','accountcode','exten','context','channel','isNil','channelstate','linkedid','transfer','error','varset','variable','endsWith','.wav49','value','replace','.WAV','find','monitors','stack','hangup','calleridnum','calleridname','connectedlinename','outbound','connectedlinenum','forEach','clone','newexten'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x0a9e('0x0'));var utils=require(_0x0a9e('0x1'));var recordings={};function writeDB(_0x29929c){utils['debug'](_0x29929c);if(_0x29929c['accountcode']){utils[_0x0a9e('0x2')](_0x29929c['accountcode'])[_0x0a9e('0x3')](function(_0x432180){if(_0x432180){_0x29929c[_0x0a9e('0x4')]=_0x432180[_0x0a9e('0x5')];_0x29929c[_0x0a9e('0x6')]=_0x432180['id'];}utils['request'](_0x0a9e('0x7'),_0x29929c);});}else{utils[_0x0a9e('0x8')](_0x0a9e('0x7'),_0x29929c);}}exports['newchannel']=function(_0x503809){try{if(_0x503809[_0x0a9e('0x9')]==_0x503809['linkedid']){recordings[_0x503809['uniqueid']]={'uniqueid':_0x503809[_0x0a9e('0x9')],'accountcode':_0x503809[_0x0a9e('0xa')],'exten':_0x503809[_0x0a9e('0xb')],'context':_0x503809[_0x0a9e('0xc')],'channel':_0x503809[_0x0a9e('0xd')],'monitors':[]};}}catch(_0xbd1168){utils['error'](_0xbd1168['stack']);}};exports['newstate']=function(_0x4cfe67){try{if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x9')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6){}else if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x10')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6&&_0x4cfe67['context']!=_0x0a9e('0x11')){recordings[_0x4cfe67[_0x0a9e('0x10')]][_0x0a9e('0xa')]=_0x4cfe67[_0x0a9e('0xa')];}}catch(_0x44dcfd){utils[_0x0a9e('0x12')](_0x44dcfd['stack']);}};exports[_0x0a9e('0x13')]=function(_0x5d0880){try{if(!_[_0x0a9e('0xe')](_0x5d0880['variable'])&&!_[_0x0a9e('0xe')](_0x5d0880[_0x0a9e('0x14')]['mixmonitor_filename'])){if(_[_0x0a9e('0x15')](_0x5d0880['value'],_0x0a9e('0x16'))){_0x5d0880[_0x0a9e('0x17')]=_0x5d0880[_0x0a9e('0x17')][_0x0a9e('0x18')](_0x0a9e('0x16'),_0x0a9e('0x19'));}if(recordings[_0x5d0880[_0x0a9e('0x10')]]){var _0x20559e=_[_0x0a9e('0x1a')](recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')],{'value':_0x5d0880[_0x0a9e('0x17')]});if(_['isNil'](_0x20559e)){recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')]['push']({'value':_0x5d0880[_0x0a9e('0x17')]});}}}}catch(_0x5a09ef){utils['error'](_0x5a09ef[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x1d')]=function(_0x38e7c4){try{if(!_[_0x0a9e('0xe')](recordings[_0x38e7c4['uniqueid']])){recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1e')]=_0x38e7c4[_0x0a9e('0x1e')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1f')]=_0x38e7c4[_0x0a9e('0x1f')];recordings[_0x38e7c4[_0x0a9e('0x9')]]['connectedlinenum']=_0x38e7c4['connectedlinenum'];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]=_0x38e7c4[_0x0a9e('0x20')];if(recordings[_0x38e7c4[_0x0a9e('0x9')]]['type']==_0x0a9e('0x21')&&recordings[_0x38e7c4['uniqueid']][_0x0a9e('0xa')]){recordings[_0x38e7c4['uniqueid']][_0x0a9e('0x22')]=recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0xa')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]='';}recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1b')][_0x0a9e('0x23')](_0x5a101a=>{var _0x3652a7=_[_0x0a9e('0x24')](recordings[_0x38e7c4[_0x0a9e('0x9')]]);_0x3652a7[_0x0a9e('0x17')]=_0x5a101a['value'];writeDB(_0x3652a7);});delete recordings[_0x38e7c4[_0x0a9e('0x9')]];}}catch(_0x40e7a3){utils[_0x0a9e('0x12')](_0x40e7a3[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x25')]=function(_0x563b45){try{if(!_[_0x0a9e('0xe')](recordings[_0x563b45[_0x0a9e('0x9')]])){if(_0x563b45[_0x0a9e('0x26')]['toLowerCase']()==_0x0a9e('0x27')&&_['startsWith'](_0x563b45[_0x0a9e('0x28')][_0x0a9e('0x29')](),_0x0a9e('0x2a'))){var _0x33bdb7=_0x563b45[_0x0a9e('0x28')]['split']('=');var _0x66c1d2=_0x33bdb7[0x0][_0x0a9e('0x2b')](_0x33bdb7[0x0][_0x0a9e('0x2c')]('(')+0x1,_0x33bdb7[0x0][_0x0a9e('0x2c')](')'));var _0x2b45ea=_0x33bdb7[0x1];recordings[_0x563b45[_0x0a9e('0x9')]][_0x66c1d2]=_0x2b45ea;}}}catch(_0x332d35){utils[_0x0a9e('0x12')](_0x332d35['stack']);}};exports[_0x0a9e('0x2d')]=function(_0x5e7238){try{if(!_[_0x0a9e('0xe')](recordings[_0x5e7238[_0x0a9e('0x9')]])){recordings[_0x5e7238[_0x0a9e('0x9')]][_0x0a9e('0x2e')]=_0x5e7238['queue'];}}catch(_0x191e91){utils[_0x0a9e('0x12')](_0x191e91[_0x0a9e('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 9a76a68..3474fa7 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 _0x35aa=['origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','stack','util','./utils','info','TRANSFER|%s','type','request','CreateVoiceTransferReport','blindtransfer','blind','error','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext'];(function(_0xcf89e9,_0x311a2f){var _0x444c86=function(_0x2d60a6){while(--_0x2d60a6){_0xcf89e9['push'](_0xcf89e9['shift']());}};_0x444c86(++_0x311a2f);}(_0x35aa,0xbe));var _0xa35a=function(_0x332a1b,_0x3744dd){_0x332a1b=_0x332a1b-0x0;var _0x2d1144=_0x35aa[_0x332a1b];return _0x2d1144;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var utils=require(_0xa35a('0x1'));function writeDB(_0x9a3c63){utils[_0xa35a('0x2')](util['format'](_0xa35a('0x3'),_0x9a3c63[_0xa35a('0x4')]));utils[_0xa35a('0x5')](_0xa35a('0x6'),_0x9a3c63);}exports[_0xa35a('0x7')]=function(_0x41a154){try{_0x41a154[_0xa35a('0x4')]=_0xa35a('0x8');writeDB(_0x41a154);}catch(_0x563deb){utils[_0xa35a('0x9')](_0x563deb['stack']);}};exports[_0xa35a('0xa')]=function(_0xe2919c){try{_0xe2919c=_[_0xa35a('0xb')](_0xe2919c,{'transfererchannel':_0xe2919c[_0xa35a('0xc')],'transferercalleridnum':_0xe2919c[_0xa35a('0xd')],'transferercalleridname':_0xe2919c[_0xa35a('0xe')],'transfererconnectedlinenum':_0xe2919c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xe2919c[_0xa35a('0xf')],'transfereraccountcode':_0xe2919c[_0xa35a('0x10')],'transferercontext':_0xe2919c[_0xa35a('0x11')],'transfererexten':_0xe2919c[_0xa35a('0x12')],'transfererlinkedid':_0xe2919c['origtransfererlinkedid'],'context':_0xe2919c[_0xa35a('0x13')],'extension':_0xe2919c[_0xa35a('0x14')],'type':'attended'});if(_[_0xa35a('0x15')](_0xe2919c[_0xa35a('0x16')])){_0xe2919c=_[_0xa35a('0xb')](_0xe2919c,{'transfereechannel':_0xe2919c[_0xa35a('0x17')],'transfereecalleridnum':_0xe2919c[_0xa35a('0x18')],'transfereecalleridname':_0xe2919c[_0xa35a('0x19')],'transfereeconnectedlinenum':_0xe2919c['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xe2919c['transfertargetconnectedlinename'],'transfereeaccountcode':_0xe2919c[_0xa35a('0x1a')],'transfereecontext':_0xe2919c['transfertargetcontext'],'transfereeexten':_0xe2919c[_0xa35a('0x1b')],'transfereelinkedid':_0xe2919c[_0xa35a('0x1c')]});}writeDB(_0xe2919c);}catch(_0x5160e8){utils[_0xa35a('0x9')](_0x5160e8[_0xa35a('0x1d')]);}}; \ No newline at end of file +var _0xdf71=['transfertargetcontext','stack','lodash','./utils','info','format','TRANSFER|%s','type','request','blindtransfer','error','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x3a304a,_0x93bbf9){var _0x1757a3=function(_0x3b0b6d){while(--_0x3b0b6d){_0x3a304a['push'](_0x3a304a['shift']());}};_0x1757a3(++_0x93bbf9);}(_0xdf71,0x1d2));var _0x1df7=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0xdf71[_0x44afa4];return _0xcad289;};'use strict';var _=require(_0x1df7('0x0'));var util=require('util');var utils=require(_0x1df7('0x1'));function writeDB(_0x22631a){utils[_0x1df7('0x2')](util[_0x1df7('0x3')](_0x1df7('0x4'),_0x22631a[_0x1df7('0x5')]));utils[_0x1df7('0x6')]('CreateVoiceTransferReport',_0x22631a);}exports[_0x1df7('0x7')]=function(_0x3297c0){try{_0x3297c0['type']='blind';writeDB(_0x3297c0);}catch(_0xa181be){utils[_0x1df7('0x8')](_0xa181be['stack']);}};exports[_0x1df7('0x9')]=function(_0x542f22){try{_0x542f22=_[_0x1df7('0xa')](_0x542f22,{'transfererchannel':_0x542f22[_0x1df7('0xb')],'transferercalleridnum':_0x542f22[_0x1df7('0xc')],'transferercalleridname':_0x542f22[_0x1df7('0xd')],'transfererconnectedlinenum':_0x542f22['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x542f22[_0x1df7('0xe')],'transfereraccountcode':_0x542f22[_0x1df7('0xf')],'transferercontext':_0x542f22[_0x1df7('0x10')],'transfererexten':_0x542f22[_0x1df7('0x11')],'transfererlinkedid':_0x542f22[_0x1df7('0x12')],'context':_0x542f22[_0x1df7('0x13')],'extension':_0x542f22['origtransfererexten'],'type':_0x1df7('0x14')});if(_['isNil'](_0x542f22[_0x1df7('0x15')])){_0x542f22=_[_0x1df7('0xa')](_0x542f22,{'transfereechannel':_0x542f22[_0x1df7('0x16')],'transfereecalleridnum':_0x542f22[_0x1df7('0x17')],'transfereecalleridname':_0x542f22[_0x1df7('0x18')],'transfereeconnectedlinenum':_0x542f22['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x542f22[_0x1df7('0x19')],'transfereeaccountcode':_0x542f22[_0x1df7('0x1a')],'transfereecontext':_0x542f22[_0x1df7('0x1b')],'transfereeexten':_0x542f22['transfertargetexten'],'transfereelinkedid':_0x542f22['transfertargetlinkedid']});}writeDB(_0x542f22);}catch(_0x8cfd99){utils['error'](_0x8cfd99[_0x1df7('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 89df977..93f5bcd 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 _0x8326=['add','format','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','client','http','xdr','info','debug','stringify','error','stack','request','catch','GetUser','name','then','GETUSER|','result','NOTFOUND','length','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','FOUND','addTime'];(function(_0x3f3b9f,_0x4de74e){var _0x145a4b=function(_0x35dbb5){while(--_0x35dbb5){_0x3f3b9f['push'](_0x3f3b9f['shift']());}};_0x145a4b(++_0x4de74e);}(_0x8326,0x1e0));var _0x6832=function(_0x295a55,_0x56e0dc){_0x295a55=_0x295a55-0x0;var _0x3890cf=_0x8326[_0x295a55];return _0x3890cf;};'use strict';var jayson=require('jayson/promise');var moment=require('moment');var BPromise=require(_0x6832('0x0'));var client=jayson[_0x6832('0x1')][_0x6832('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0x6832('0x3'));exports['info']=function(_0x2dc1b9){logger[_0x6832('0x4')](_0x2dc1b9);};exports[_0x6832('0x5')]=function(_0x3b42e1){logger[_0x6832('0x5')](JSON[_0x6832('0x6')](_0x3b42e1));};exports[_0x6832('0x7')]=function(_0xff5cd0){logger['error'](_0xff5cd0[_0x6832('0x8')]);};exports[_0x6832('0x9')]=function(_0x53315e,_0x5db9e2){return client[_0x6832('0x9')](_0x53315e,{'body':_0x5db9e2})['then'](function(_0x72ab64){logger['debug'](JSON[_0x6832('0x6')](_0x72ab64));})[_0x6832('0xa')](function(_0x4e83ba){logger['error'](_0x4e83ba[_0x6832('0x8')]);});};function getUser(_0x4e8bbd){return client[_0x6832('0x9')](_0x6832('0xb'),{'options':{'raw':!![],'attributes':['id','internal',_0x6832('0xc'),'interface'],'where':_0x4e8bbd,'limit':0x1}})[_0x6832('0xd')](function(_0x2b8dd9){logger['info'](_0x6832('0xe')+JSON[_0x6832('0x6')](_0x4e8bbd)+'|'+(_0x2b8dd9[_0x6832('0xf')]['length']?'FOUND':_0x6832('0x10')));return _0x2b8dd9[_0x6832('0xf')][_0x6832('0x11')]?_0x2b8dd9[_0x6832('0xf')][0x0]:null;});}exports['getUserByInternal']=function(_0x543710){return new BPromise(function(_0x1d6a2b,_0x2d817c){if(_0x543710){return getUser({'internal':_0x543710})[_0x6832('0xd')](function(_0x12b53f){return _0x1d6a2b(_0x12b53f);})[_0x6832('0xa')](function(_0x41d0b6){logger['error'](_0x41d0b6[_0x6832('0x8')]);return _0x1d6a2b(null);});}else{return _0x1d6a2b(null);}});};exports[_0x6832('0x12')]=function(_0x4270d6){return new BPromise(function(_0xf69219,_0x684c8a){if(_0x4270d6){return getUser({'interface':_0x4270d6})[_0x6832('0xd')](function(_0x1424f0){return _0xf69219(_0x1424f0);})[_0x6832('0xa')](function(_0x3600b3){logger['error'](_0x3600b3['stack']);return _0xf69219(null);});}else{return _0xf69219(null);}});};exports[_0x6832('0x13')]=function(_0xe3e60b){return new BPromise(function(_0x494774,_0xdfabe8){if(_0xe3e60b){return getUser({'name':_0xe3e60b})[_0x6832('0xd')](function(_0x4b7578){return _0x494774(_0x4b7578);})['catch'](function(_0x551a97){logger[_0x6832('0x7')](_0x551a97[_0x6832('0x8')]);return _0x494774(null);});}else{return _0x494774(null);}});};exports[_0x6832('0x14')]=function(_0x15fc74){return new BPromise(function(_0x45a90b,_0x2c11b3){if(_0x15fc74){return client['request'](_0x6832('0x15'),{'options':{'raw':!![],'attributes':['id','name','type','acw','acwTimeout'],'where':{'name':_0x15fc74},'limit':0x1}})[_0x6832('0xd')](function(_0x1a8f39){logger[_0x6832('0x4')]('GETVOICEQUEUEBYNAME|'+_0x15fc74+'|'+(_0x1a8f39[_0x6832('0xf')]['length']?_0x6832('0x16'):_0x6832('0x10')));return _0x45a90b(_0x1a8f39[_0x6832('0xf')]['length']?_0x1a8f39['result'][0x0]:null);})[_0x6832('0xa')](function(_0x339824){logger[_0x6832('0x7')](_0x339824[_0x6832('0x8')]);return _0x45a90b(null);});}else{return _0x45a90b(null);}});};exports[_0x6832('0x17')]=function(_0x35e72d,_0x3eb434){return moment(_0x35e72d)[_0x6832('0x18')](_0x3eb434,'seconds')[_0x6832('0x19')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x6832('0x1a')]=function(_0x5cc4c9,_0x278062){return moment(_0x5cc4c9)[_0x6832('0x1b')](_0x278062,_0x6832('0x1c'))[_0x6832('0x19')](_0x6832('0x1d'));};exports[_0x6832('0x1e')]=function(_0x239cc7,_0x769a46){return moment(_0x239cc7)[_0x6832('0x1f')](moment(_0x769a46),_0x6832('0x1c'));};exports[_0x6832('0x20')]=function(_0x3309b2,_0x23b753){return parseInt(_0x3309b2,0xa)+parseInt(_0x23b753,0xa);};exports[_0x6832('0x21')]=function(){return moment()['format'](_0x6832('0x1d'));};exports[_0x6832('0x22')]=function(_0x40482d,_0x3e1ae2){if(_0x3e1ae2){return moment(_0x40482d)[_0x6832('0x22')](_0x3e1ae2);}else{return!![];}};exports[_0x6832('0x23')]=function(_0x38978b,_0x5e6ea3){if(_0x5e6ea3){return moment(_0x38978b)[_0x6832('0x23')](_0x5e6ea3);}else if(_0x38978b){return!![];}else{return![];}}; \ No newline at end of file +var _0x3528=['getUserByInterface','getVoiceQueueByName','GetVoiceQueue','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','bluebird','client','http','xdr','info','debug','error','stack','request','then','stringify','catch','internal','name','interface','result','length','FOUND','NOTFOUND','getUserByInternal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3528,0xa9));var _0x8352=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3528[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x8352('0x0'));var moment=require('moment');var BPromise=require(_0x8352('0x1'));var client=jayson[_0x8352('0x2')][_0x8352('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x8352('0x4'));exports[_0x8352('0x5')]=function(_0x3c7cdc){logger['info'](_0x3c7cdc);};exports['debug']=function(_0x5cfd89){logger[_0x8352('0x6')](JSON['stringify'](_0x5cfd89));};exports[_0x8352('0x7')]=function(_0x24dd00){logger[_0x8352('0x7')](_0x24dd00[_0x8352('0x8')]);};exports[_0x8352('0x9')]=function(_0x44fe30,_0x5dfd53){return client['request'](_0x44fe30,{'body':_0x5dfd53})[_0x8352('0xa')](function(_0x322001){logger['debug'](JSON[_0x8352('0xb')](_0x322001));})[_0x8352('0xc')](function(_0x33048f){logger[_0x8352('0x7')](_0x33048f[_0x8352('0x8')]);});};function getUser(_0x53152f){return client[_0x8352('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x8352('0xd'),_0x8352('0xe'),_0x8352('0xf')],'where':_0x53152f,'limit':0x1}})[_0x8352('0xa')](function(_0xe175a4){logger[_0x8352('0x5')]('GETUSER|'+JSON[_0x8352('0xb')](_0x53152f)+'|'+(_0xe175a4[_0x8352('0x10')][_0x8352('0x11')]?_0x8352('0x12'):_0x8352('0x13')));return _0xe175a4[_0x8352('0x10')]['length']?_0xe175a4[_0x8352('0x10')][0x0]:null;});}exports[_0x8352('0x14')]=function(_0x1cbc9e){return new BPromise(function(_0x171e7a,_0x233066){if(_0x1cbc9e){return getUser({'internal':_0x1cbc9e})['then'](function(_0x175e50){return _0x171e7a(_0x175e50);})['catch'](function(_0x2fe57d){logger[_0x8352('0x7')](_0x2fe57d[_0x8352('0x8')]);return _0x171e7a(null);});}else{return _0x171e7a(null);}});};exports[_0x8352('0x15')]=function(_0x456a1a){return new BPromise(function(_0x45cf51,_0x17209e){if(_0x456a1a){return getUser({'interface':_0x456a1a})[_0x8352('0xa')](function(_0x52d04c){return _0x45cf51(_0x52d04c);})[_0x8352('0xc')](function(_0x20e215){logger[_0x8352('0x7')](_0x20e215['stack']);return _0x45cf51(null);});}else{return _0x45cf51(null);}});};exports['getUserByName']=function(_0x348513){return new BPromise(function(_0x1ca485,_0x1b0dfd){if(_0x348513){return getUser({'name':_0x348513})[_0x8352('0xa')](function(_0x491adb){return _0x1ca485(_0x491adb);})['catch'](function(_0x527e9c){logger[_0x8352('0x7')](_0x527e9c[_0x8352('0x8')]);return _0x1ca485(null);});}else{return _0x1ca485(null);}});};exports[_0x8352('0x16')]=function(_0x28af1a){return new BPromise(function(_0x48cafb,_0x212f63){if(_0x28af1a){return client[_0x8352('0x9')](_0x8352('0x17'),{'options':{'raw':!![],'attributes':['id','name','type','acw',_0x8352('0x18')],'where':{'name':_0x28af1a},'limit':0x1}})['then'](function(_0x2bdb9e){logger[_0x8352('0x5')](_0x8352('0x19')+_0x28af1a+'|'+(_0x2bdb9e[_0x8352('0x10')][_0x8352('0x11')]?'FOUND':_0x8352('0x13')));return _0x48cafb(_0x2bdb9e[_0x8352('0x10')][_0x8352('0x11')]?_0x2bdb9e[_0x8352('0x10')][0x0]:null);})[_0x8352('0xc')](function(_0xbfbf19){logger[_0x8352('0x7')](_0xbfbf19['stack']);return _0x48cafb(null);});}else{return _0x48cafb(null);}});};exports[_0x8352('0x1a')]=function(_0x522960,_0x2d41e9){return moment(_0x522960)[_0x8352('0x1b')](_0x2d41e9,_0x8352('0x1c'))[_0x8352('0x1d')](_0x8352('0x1e'));};exports['subtractTime']=function(_0x141bef,_0x4b6ec4){return moment(_0x141bef)[_0x8352('0x1f')](_0x4b6ec4,_0x8352('0x1c'))[_0x8352('0x1d')](_0x8352('0x1e'));};exports[_0x8352('0x20')]=function(_0x57340f,_0x244d22){return moment(_0x57340f)[_0x8352('0x21')](moment(_0x244d22),_0x8352('0x1c'));};exports[_0x8352('0x22')]=function(_0x3c421d,_0x4843b8){return parseInt(_0x3c421d,0xa)+parseInt(_0x4843b8,0xa);};exports[_0x8352('0x23')]=function(){return moment()[_0x8352('0x1d')](_0x8352('0x1e'));};exports['isAfter']=function(_0x5caf3b,_0x1339b2){if(_0x1339b2){return moment(_0x5caf3b)[_0x8352('0x24')](_0x1339b2);}else{return!![];}};exports[_0x8352('0x25')]=function(_0x44fe7c,_0x18dd6e){if(_0x18dd6e){return moment(_0x44fe7c)[_0x8352('0x25')](_0x18dd6e);}else if(_0x44fe7c){return!![];}else{return![];}}; \ No newline at end of file